From: Cris Di Sclafani Date: Wed, 28 Oct 2020 11:18:43 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=d25d8441adb7e6d480fa41e0dfc170dec1865d70;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9613a7c..1c3c9cc 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-28T10:54:41.401Z", "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-28T11:10:16.266Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ad2ca93..b19a1d8 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-28T10:54:41.401Z", "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-28T11:10:16.266Z", "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 cfff984..8898577 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 _0xf312=['exports','VIRTUAL','action','STRING','motionbar','jscripty','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf312,0x6f));var _0x2f31=function(_0x5a6f6c,_0x127f45){_0x5a6f6c=_0x5a6f6c-0x0;var _0x352a42=_0xf312[_0x5a6f6c];return _0x352a42;};'use strict';var Sequelize=require(_0x2f31('0x0'));module[_0x2f31('0x1')]={'name':{'type':Sequelize[_0x2f31('0x2')],'get':function(_0x5c833d){return this['getDataValue'](_0x2f31('0x3'));}},'action':{'type':Sequelize[_0x2f31('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x2f31('0x5'),_0x2f31('0x6'),_0x2f31('0x7'),'browser',_0x2f31('0x8'),'script']],'msg':_0x2f31('0x9')}},'comment':_0x2f31('0x9')},'data1':{'type':Sequelize[_0x2f31('0x4')](0x1000),'comment':_0x2f31('0xa')},'data2':{'type':Sequelize[_0x2f31('0x4')](0x1000),'comment':_0x2f31('0xb')},'data3':{'type':Sequelize[_0x2f31('0x4')](0x1000),'comment':_0x2f31('0xc')},'data4':{'type':Sequelize[_0x2f31('0x4')](0x1000)},'data5':{'type':Sequelize[_0x2f31('0x4')](0x1000)},'data6':{'type':Sequelize[_0x2f31('0x4')]},'data7':{'type':Sequelize[_0x2f31('0xd')]}}; \ No newline at end of file +var _0xbd62=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x529d8b,_0x314437){var _0x5aa90d=function(_0x2d6aa9){while(--_0x2d6aa9){_0x529d8b['push'](_0x529d8b['shift']());}};_0x5aa90d(++_0x314437);}(_0xbd62,0x1a2));var _0x2bd6=function(_0x1e006e,_0x2ed00e){_0x1e006e=_0x1e006e-0x0;var _0x1dbb1c=_0xbd62[_0x1e006e];return _0x1dbb1c;};'use strict';var Sequelize=require(_0x2bd6('0x0'));module[_0x2bd6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x282deb){return this[_0x2bd6('0x2')](_0x2bd6('0x3'));}},'action':{'type':Sequelize[_0x2bd6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2bd6('0x5'),'integration',_0x2bd6('0x6'),_0x2bd6('0x7'),'urlForward',_0x2bd6('0x8'),_0x2bd6('0x9'),_0x2bd6('0xa')]],'msg':_0x2bd6('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x2bd6('0x4')](0x1000),'comment':_0x2bd6('0xc')},'data2':{'type':Sequelize[_0x2bd6('0x4')](0x1000),'comment':_0x2bd6('0xd')},'data3':{'type':Sequelize[_0x2bd6('0x4')](0x1000),'comment':_0x2bd6('0xe')},'data4':{'type':Sequelize[_0x2bd6('0x4')](0x1000)},'data5':{'type':Sequelize[_0x2bd6('0x4')](0x1000)},'data6':{'type':Sequelize[_0x2bd6('0x4')]},'data7':{'type':Sequelize[_0x2bd6('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1da08d5..88c3214 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 _0xde9c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','sendStatus','stack','name','send','body','Action','find','params','catch','html-pdf'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xde9c,0x182));var _0xcde9=function(_0x46f390,_0x4bf251){_0x46f390=_0x46f390-0x0;var _0x67e3a8=_0xde9c[_0x46f390];return _0x67e3a8;};'use strict';var pdf=require(_0xcde9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcde9('0x1'));var zipdir=require(_0xcde9('0x2'));var jsonpatch=require(_0xcde9('0x3'));var rp=require('request-promise');var moment=require(_0xcde9('0x4'));var BPromise=require(_0xcde9('0x5'));var Mustache=require(_0xcde9('0x6'));var util=require(_0xcde9('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcde9('0x8'));var ejs=require(_0xcde9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde9('0xa'));var crypto=require(_0xcde9('0xb'));var jsforce=require(_0xcde9('0xc'));var deskjs=require(_0xcde9('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcde9('0xe'));var Redis=require(_0xcde9('0xf'));var authService=require(_0xcde9('0x10'));var qs=require(_0xcde9('0x11'));var as=require(_0xcde9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcde9('0x13'))(_0xcde9('0x14'));var utils=require('../../config/utils');var config=require(_0xcde9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1186dd,_0x119eab){_0x119eab=_0x119eab||0xcc;return function(_0x233a43){if(_0x233a43){return _0x1186dd['sendStatus'](_0x119eab);}return _0x1186dd['status'](_0x119eab)['end']();};}function respondWithResult(_0x3c23e5,_0x4ac905){_0x4ac905=_0x4ac905||0xc8;return function(_0x1cb8f3){if(_0x1cb8f3){return _0x3c23e5[_0xcde9('0x16')](_0x4ac905)[_0xcde9('0x17')](_0x1cb8f3);}};}function respondWithFilteredResult(_0x2224f0,_0x183e7e){return function(_0x29eb56){if(_0x29eb56){var _0x35dc1a=_0x29eb56[_0xcde9('0x18')],_0x7e3f73=_0x183e7e[_0xcde9('0x19')],_0xa83bd3=_0x183e7e[_0xcde9('0x19')]+_0x183e7e[_0xcde9('0x1a')],_0x99a916;if(_0xa83bd3>=_0x35dc1a){_0xa83bd3=_0x35dc1a;_0x99a916=0xc8;}else{_0x99a916=0xce;}_0x2224f0[_0xcde9('0x16')](_0x99a916);return _0x2224f0[_0xcde9('0x1b')]('Content-Range',_0x7e3f73+'-'+_0xa83bd3+'/'+_0x35dc1a)[_0xcde9('0x17')](_0x29eb56);}return null;};}function patchUpdates(_0xa5f470){return function(_0x2089db){try{jsonpatch[_0xcde9('0x1c')](_0x2089db,_0xa5f470,!![]);}catch(_0x1c3664){return BPromise['reject'](_0x1c3664);}return _0x2089db[_0xcde9('0x1d')]();};}function saveUpdates(_0x58e175,_0x3c0114){return function(_0x5680ce){if(_0x5680ce){return _0x5680ce[_0xcde9('0x1e')](_0x58e175)[_0xcde9('0x1f')](function(_0x1bf0b5){return _0x1bf0b5;});}return null;};}function removeEntity(_0x1f2524,_0x4a4458){return function(_0x2a6371){if(_0x2a6371){return _0x2a6371[_0xcde9('0x20')]()[_0xcde9('0x1f')](function(){_0x1f2524[_0xcde9('0x16')](0xcc)[_0xcde9('0x21')]();});}};}function handleEntityNotFound(_0x1ab9ca,_0x56142e){return function(_0x17b15b){if(!_0x17b15b){_0x1ab9ca[_0xcde9('0x22')](0x194);}return _0x17b15b;};}function handleError(_0x96d576,_0x379208){_0x379208=_0x379208||0x1f4;return function(_0x5ce218){logger['error'](_0x5ce218[_0xcde9('0x23')]);if(_0x5ce218['name']){delete _0x5ce218[_0xcde9('0x24')];}_0x96d576['status'](_0x379208)[_0xcde9('0x25')](_0x5ce218);};}exports[_0xcde9('0x1e')]=function(_0xa07762,_0x914ff2){if(_0xa07762[_0xcde9('0x26')]['id']){delete _0xa07762['body']['id'];}return db[_0xcde9('0x27')][_0xcde9('0x28')]({'where':{'id':_0xa07762[_0xcde9('0x29')]['id']}})[_0xcde9('0x1f')](handleEntityNotFound(_0x914ff2,null))[_0xcde9('0x1f')](saveUpdates(_0xa07762[_0xcde9('0x26')],null))[_0xcde9('0x1f')](respondWithResult(_0x914ff2,null))['catch'](handleError(_0x914ff2,null));};exports[_0xcde9('0x20')]=function(_0x2480d1,_0x19bef1){return db[_0xcde9('0x27')][_0xcde9('0x28')]({'where':{'id':_0x2480d1[_0xcde9('0x29')]['id']}})['then'](handleEntityNotFound(_0x19bef1,null))['then'](removeEntity(_0x19bef1,null))[_0xcde9('0x2a')](handleError(_0x19bef1,null));}; \ No newline at end of file +var _0x7ef9=['Action','params','destroy','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','body'];(function(_0x869299,_0x3ae9a2){var _0x279afb=function(_0x5bb31c){while(--_0x5bb31c){_0x869299['push'](_0x869299['shift']());}};_0x279afb(++_0x3ae9a2);}(_0x7ef9,0x1c7));var _0x97ef=function(_0x8f5a70,_0x201775){_0x8f5a70=_0x8f5a70-0x0;var _0x13a70a=_0x7ef9[_0x8f5a70];return _0x13a70a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97ef('0x0'));var rimraf=require(_0x97ef('0x1'));var zipdir=require(_0x97ef('0x2'));var jsonpatch=require(_0x97ef('0x3'));var rp=require('request-promise');var moment=require(_0x97ef('0x4'));var BPromise=require(_0x97ef('0x5'));var Mustache=require(_0x97ef('0x6'));var util=require('util');var path=require('path');var sox=require(_0x97ef('0x7'));var csv=require('to-csv');var ejs=require(_0x97ef('0x8'));var fs=require('fs');var _=require(_0x97ef('0x9'));var squel=require(_0x97ef('0xa'));var crypto=require(_0x97ef('0xb'));var jsforce=require(_0x97ef('0xc'));var deskjs=require(_0x97ef('0xd'));var toCsv=require(_0x97ef('0xe'));var querystring=require(_0x97ef('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x97ef('0x10'));var qs=require(_0x97ef('0x11'));var as=require(_0x97ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ef('0x13'))(_0x97ef('0x14'));var utils=require(_0x97ef('0x15'));var config=require(_0x97ef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d952,_0x29d122){_0x29d122=_0x29d122||0xcc;return function(_0x463b38){if(_0x463b38){return _0x33d952[_0x97ef('0x17')](_0x29d122);}return _0x33d952[_0x97ef('0x18')](_0x29d122)[_0x97ef('0x19')]();};}function respondWithResult(_0x8b8e72,_0x20aa40){_0x20aa40=_0x20aa40||0xc8;return function(_0x51e6f0){if(_0x51e6f0){return _0x8b8e72['status'](_0x20aa40)[_0x97ef('0x1a')](_0x51e6f0);}};}function respondWithFilteredResult(_0x59c17b,_0x5f1f01){return function(_0x1513b0){if(_0x1513b0){var _0xa8ceb2=_0x1513b0['count'],_0x57f696=_0x5f1f01['offset'],_0x380f9d=_0x5f1f01[_0x97ef('0x1b')]+_0x5f1f01[_0x97ef('0x1c')],_0x2438ac;if(_0x380f9d>=_0xa8ceb2){_0x380f9d=_0xa8ceb2;_0x2438ac=0xc8;}else{_0x2438ac=0xce;}_0x59c17b['status'](_0x2438ac);return _0x59c17b[_0x97ef('0x1d')](_0x97ef('0x1e'),_0x57f696+'-'+_0x380f9d+'/'+_0xa8ceb2)[_0x97ef('0x1a')](_0x1513b0);}return null;};}function patchUpdates(_0x445c7e){return function(_0x451e75){try{jsonpatch[_0x97ef('0x1f')](_0x451e75,_0x445c7e,!![]);}catch(_0x439cad){return BPromise[_0x97ef('0x20')](_0x439cad);}return _0x451e75['save']();};}function saveUpdates(_0x5b252c,_0x340ad8){return function(_0x3c254b){if(_0x3c254b){return _0x3c254b[_0x97ef('0x21')](_0x5b252c)['then'](function(_0x52eb74){return _0x52eb74;});}return null;};}function removeEntity(_0x5ce1a7,_0x22625b){return function(_0x5635a8){if(_0x5635a8){return _0x5635a8['destroy']()[_0x97ef('0x22')](function(){_0x5ce1a7['status'](0xcc)[_0x97ef('0x19')]();});}};}function handleEntityNotFound(_0x11618b,_0xb92a00){return function(_0x769c9f){if(!_0x769c9f){_0x11618b[_0x97ef('0x17')](0x194);}return _0x769c9f;};}function handleError(_0x12dd85,_0x5154cb){_0x5154cb=_0x5154cb||0x1f4;return function(_0x246a17){logger[_0x97ef('0x23')](_0x246a17[_0x97ef('0x24')]);if(_0x246a17['name']){delete _0x246a17[_0x97ef('0x25')];}_0x12dd85['status'](_0x5154cb)[_0x97ef('0x26')](_0x246a17);};}exports[_0x97ef('0x21')]=function(_0x1e0458,_0x16bba7){if(_0x1e0458['body']['id']){delete _0x1e0458[_0x97ef('0x27')]['id'];}return db[_0x97ef('0x28')]['find']({'where':{'id':_0x1e0458[_0x97ef('0x29')]['id']}})[_0x97ef('0x22')](handleEntityNotFound(_0x16bba7,null))['then'](saveUpdates(_0x1e0458['body'],null))[_0x97ef('0x22')](respondWithResult(_0x16bba7,null))['catch'](handleError(_0x16bba7,null));};exports[_0x97ef('0x2a')]=function(_0x5e48a0,_0x29a726){return db[_0x97ef('0x28')][_0x97ef('0x2b')]({'where':{'id':_0x5e48a0['params']['id']}})[_0x97ef('0x22')](handleEntityNotFound(_0x29a726,null))['then'](removeEntity(_0x29a726,null))[_0x97ef('0x2c')](handleError(_0x29a726,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index de2d693..b087eae 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 _0xe4d5=['request-promise','path','rimraf','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x26c5c1,_0x6f60c0){var _0xbba469=function(_0x4d74bd){while(--_0x4d74bd){_0x26c5c1['push'](_0x26c5c1['shift']());}};_0xbba469(++_0x6f60c0);}(_0xe4d5,0xfe));var _0x5e4d=function(_0xfbb69e,_0x1c65dd){_0xfbb69e=_0xfbb69e-0x0;var _0x31666f=_0xe4d5[_0xfbb69e];return _0x31666f;};'use strict';var _=require(_0x5e4d('0x0'));var util=require(_0x5e4d('0x1'));var logger=require(_0x5e4d('0x2'))(_0x5e4d('0x3'));var moment=require(_0x5e4d('0x4'));var BPromise=require(_0x5e4d('0x5'));var rp=require(_0x5e4d('0x6'));var fs=require('fs');var path=require(_0x5e4d('0x7'));var rimraf=require(_0x5e4d('0x8'));var config=require('../../config/environment');var attributes=require(_0x5e4d('0x9'));module[_0x5e4d('0xa')]=function(_0x152aca,_0x2aaaed){return _0x152aca[_0x5e4d('0xb')](_0x5e4d('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b24=['rimraf','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xab8aed,_0x395dfe){var _0x4efd54=function(_0x1c6940){while(--_0x1c6940){_0xab8aed['push'](_0xab8aed['shift']());}};_0x4efd54(++_0x395dfe);}(_0x4b24,0x65));var _0x44b2=function(_0x20c77a,_0x202f00){_0x20c77a=_0x20c77a-0x0;var _0x556005=_0x4b24[_0x20c77a];return _0x556005;};'use strict';var _=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var logger=require(_0x44b2('0x2'))(_0x44b2('0x3'));var moment=require(_0x44b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x44b2('0x5'));var fs=require('fs');var path=require(_0x44b2('0x6'));var rimraf=require(_0x44b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x44b2('0x8'));module[_0x44b2('0x9')]=function(_0x3da461,_0x4cb88d){return _0x3da461[_0x44b2('0xa')]('Action',attributes,{'tableName':_0x44b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e2945cb..be1e2d1 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(_0x10983c,_0x4a3766){var _0x9ff208=function(_0x15928f){while(--_0x15928f){_0x10983c['push'](_0x10983c['shift']());}};_0x9ff208(++_0x4a3766);}(_0xe706,0xa3));var _0x6e70=function(_0x1475a6,_0x56628c){_0x1475a6=_0x1475a6-0x0;var _0x3c0d07=_0xe706[_0x1475a6];return _0x3c0d07;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x1bacc1,_0x345d08){var _0x1b3878=function(_0x4f949a){while(--_0x4f949a){_0x1bacc1['push'](_0x1bacc1['shift']());}};_0x1b3878(++_0x345d08);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0xcb91[_0x5ce3c8];return _0xa76867;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e232a6c..a8b453d 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 _0x95dc=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x5cfa59,_0x3a8738){var _0x5295fa=function(_0x27ba1b){while(--_0x27ba1b){_0x5cfa59['push'](_0x5cfa59['shift']());}};_0x5295fa(++_0x3a8738);}(_0x95dc,0x196));var _0xc95d=function(_0x3f36ed,_0x38124c){_0x3f36ed=_0x3f36ed-0x0;var _0x402a89=_0x95dc[_0x3f36ed];return _0x402a89;};'use strict';var multer=require('multer');var util=require(_0xc95d('0x0'));var path=require(_0xc95d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc95d('0x2'));var router=express[_0xc95d('0x3')]();var auth=require(_0xc95d('0x4'));var interaction=require(_0xc95d('0x5'));var config=require(_0xc95d('0x6'));var controller=require(_0xc95d('0x7'));router['put']('/:id',auth[_0xc95d('0x8')](),controller[_0xc95d('0x9')]);router[_0xc95d('0xa')](_0xc95d('0xb'),auth[_0xc95d('0x8')](),controller[_0xc95d('0xc')]);module[_0xc95d('0xd')]=router; \ No newline at end of file +var _0x32a3=['../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b3d59,_0x37477f){var _0x232d70=function(_0x2cf796){while(--_0x2cf796){_0x2b3d59['push'](_0x2b3d59['shift']());}};_0x232d70(++_0x37477f);}(_0x32a3,0x1ce));var _0x332a=function(_0x2e6a89,_0x5b4067){_0x2e6a89=_0x2e6a89-0x0;var _0x284922=_0x32a3[_0x2e6a89];return _0x284922;};'use strict';var multer=require('multer');var util=require(_0x332a('0x0'));var path=require(_0x332a('0x1'));var timeout=require('connect-timeout');var express=require(_0x332a('0x2'));var router=express[_0x332a('0x3')]();var auth=require(_0x332a('0x4'));var interaction=require(_0x332a('0x5'));var config=require(_0x332a('0x6'));var controller=require('./action.controller');router[_0x332a('0x7')](_0x332a('0x8'),auth[_0x332a('0x9')](),controller['update']);router[_0x332a('0xa')](_0x332a('0x8'),auth['isAuthenticated'](),controller[_0x332a('0xb')]);module[_0x332a('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a46408e..63bf8b1 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 _0x3afb=['STRING','TEXT','exports'];(function(_0x772156,_0x5b5faa){var _0x79234b=function(_0x54773f){while(--_0x54773f){_0x772156['push'](_0x772156['shift']());}};_0x79234b(++_0x5b5faa);}(_0x3afb,0xa1));var _0xb3af=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x3afb[_0x479509];return _0x382da8;};'use strict';var Sequelize=require('sequelize');module[_0xb3af('0x0')]={'name':{'type':Sequelize[_0xb3af('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb3af('0x1')]},'conditions':{'type':Sequelize[_0xb3af('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb8bf=['sequelize','exports','STRING','TEXT'];(function(_0x256c5a,_0x3ef0ed){var _0x239e30=function(_0x13f729){while(--_0x13f729){_0x256c5a['push'](_0x256c5a['shift']());}};_0x239e30(++_0x3ef0ed);}(_0xb8bf,0x134));var _0xfb8b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb8bf[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xfb8b('0x0'));module[_0xfb8b('0x1')]={'name':{'type':Sequelize[_0xfb8b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xfb8b('0x2')]},'parent':{'type':Sequelize[_0xfb8b('0x2')]},'table':{'type':Sequelize[_0xfb8b('0x2')]},'conditions':{'type':Sequelize[_0xfb8b('0x3')]},'joins':{'type':Sequelize[_0xfb8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 59566fc..c76cad8 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 _0x8bdf=['findAll','rows','catch','show','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','create','params','join','left_join','cross_join','SUM(%s)','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','IS\x20NULL','operator','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','right_join','MIN(%s)','SEC_TO_TIME(%s)','ROUND(%s)','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','AnalyticCustomReport','count','include'];(function(_0x55257d,_0x3998ec){var _0x4d296d=function(_0x522f05){while(--_0x522f05){_0x55257d['push'](_0x55257d['shift']());}};_0x4d296d(++_0x3998ec);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x8bdf[_0x484e36];return _0xafc85d;};'use strict';var pdf=require(_0xf8bd('0x0'));var emlformat=require(_0xf8bd('0x1'));var rimraf=require(_0xf8bd('0x2'));var zipdir=require(_0xf8bd('0x3'));var jsonpatch=require(_0xf8bd('0x4'));var rp=require('request-promise');var moment=require(_0xf8bd('0x5'));var BPromise=require(_0xf8bd('0x6'));var Mustache=require(_0xf8bd('0x7'));var util=require(_0xf8bd('0x8'));var path=require(_0xf8bd('0x9'));var sox=require(_0xf8bd('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf8bd('0xb'));var crypto=require(_0xf8bd('0xc'));var jsforce=require(_0xf8bd('0xd'));var deskjs=require(_0xf8bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8bd('0xf'));var Papa=require(_0xf8bd('0x10'));var Redis=require('ioredis');var authService=require(_0xf8bd('0x11'));var qs=require(_0xf8bd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8bd('0x13'));var logger=require(_0xf8bd('0x14'))(_0xf8bd('0x15'));var utils=require(_0xf8bd('0x16'));var config=require('../../config/environment');var db=require(_0xf8bd('0x17'))['db'];var dbH=require(_0xf8bd('0x17'))['dbH'];function respondWithStatusCode(_0x1a009e,_0x49e8c6){_0x49e8c6=_0x49e8c6||0xcc;return function(_0x1af936){if(_0x1af936){return _0x1a009e[_0xf8bd('0x18')](_0x49e8c6);}return _0x1a009e[_0xf8bd('0x19')](_0x49e8c6)[_0xf8bd('0x1a')]();};}function respondWithResult(_0x43d517,_0xa0ee74){_0xa0ee74=_0xa0ee74||0xc8;return function(_0x56146e){if(_0x56146e){return _0x43d517['status'](_0xa0ee74)['json'](_0x56146e);}};}function respondWithFilteredResult(_0x13350a,_0x33facf){return function(_0x54dc30){if(_0x54dc30){var _0x277123=_0x54dc30['count'],_0x9d454=_0x33facf[_0xf8bd('0x1b')],_0x1bd8c6=_0x33facf[_0xf8bd('0x1b')]+_0x33facf['limit'],_0x1acf29;if(_0x1bd8c6>=_0x277123){_0x1bd8c6=_0x277123;_0x1acf29=0xc8;}else{_0x1acf29=0xce;}_0x13350a[_0xf8bd('0x19')](_0x1acf29);return _0x13350a[_0xf8bd('0x1c')](_0xf8bd('0x1d'),_0x9d454+'-'+_0x1bd8c6+'/'+_0x277123)[_0xf8bd('0x1e')](_0x54dc30);}return null;};}function patchUpdates(_0xf06524){return function(_0x1b18db){try{jsonpatch['apply'](_0x1b18db,_0xf06524,!![]);}catch(_0x15a53e){return BPromise[_0xf8bd('0x1f')](_0x15a53e);}return _0x1b18db['save']();};}function saveUpdates(_0x116946,_0x528373){return function(_0x30d533){if(_0x30d533){return _0x30d533[_0xf8bd('0x20')](_0x116946)['then'](function(_0x469813){return _0x469813;});}return null;};}function removeEntity(_0x45eb2d,_0x4c575f){return function(_0x4ea6fe){if(_0x4ea6fe){return _0x4ea6fe[_0xf8bd('0x21')]()[_0xf8bd('0x22')](function(){var _0x4edd5a=_0x4ea6fe[_0xf8bd('0x23')]({'plain':!![]});var _0x59d0b9=_0xf8bd('0x24');return db[_0xf8bd('0x25')]['destroy']({'where':{'type':_0x59d0b9,'resourceId':_0x4edd5a['id']}})[_0xf8bd('0x22')](function(){return _0x4ea6fe;});})['then'](function(){_0x45eb2d[_0xf8bd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261e8f,_0x480bc8){return function(_0x136bd2){if(!_0x136bd2){_0x261e8f['sendStatus'](0x194);}return _0x136bd2;};}function handleError(_0x5678bf,_0x329a09){_0x329a09=_0x329a09||0x1f4;return function(_0x5f3453){logger[_0xf8bd('0x26')](_0x5f3453[_0xf8bd('0x27')]);if(_0x5f3453[_0xf8bd('0x28')]){delete _0x5f3453['name'];}_0x5678bf[_0xf8bd('0x19')](_0x329a09)[_0xf8bd('0x29')](_0x5f3453);};}exports[_0xf8bd('0x2a')]=function(_0x3aa54a,_0x4fc088){var _0x4bff64={},_0x36a606={},_0x594bd1={'count':0x0,'rows':[]};var _0x4c386a=_['map'](db['AnalyticCustomReport'][_0xf8bd('0x2b')],function(_0x1f9cba){return{'name':_0x1f9cba['fieldName'],'type':_0x1f9cba[_0xf8bd('0x2c')][_0xf8bd('0x2d')]};});_0x36a606['model']=_['map'](_0x4c386a,_0xf8bd('0x28'));_0x36a606['query']=_[_0xf8bd('0x2e')](_0x3aa54a[_0xf8bd('0x2f')]);_0x36a606[_0xf8bd('0x30')]=_[_0xf8bd('0x31')](_0x36a606[_0xf8bd('0x32')],_0x36a606[_0xf8bd('0x2f')]);_0x4bff64['attributes']=_[_0xf8bd('0x31')](_0x36a606[_0xf8bd('0x32')],qs['fields'](_0x3aa54a['query'][_0xf8bd('0x33')]));_0x4bff64[_0xf8bd('0x34')]=_0x4bff64['attributes'][_0xf8bd('0x35')]?_0x4bff64[_0xf8bd('0x34')]:_0x36a606[_0xf8bd('0x32')];if(!_0x3aa54a[_0xf8bd('0x2f')][_0xf8bd('0x36')](_0xf8bd('0x37'))){_0x4bff64[_0xf8bd('0x38')]=qs['limit'](_0x3aa54a[_0xf8bd('0x2f')][_0xf8bd('0x38')]);_0x4bff64[_0xf8bd('0x1b')]=qs[_0xf8bd('0x1b')](_0x3aa54a[_0xf8bd('0x2f')][_0xf8bd('0x1b')]);}_0x4bff64[_0xf8bd('0x39')]=qs['sort'](_0x3aa54a['query'][_0xf8bd('0x3a')]);_0x4bff64['where']=qs['filters'](_[_0xf8bd('0x3b')](_0x3aa54a[_0xf8bd('0x2f')],_0x36a606[_0xf8bd('0x30')]),_0x4c386a);if(_0x3aa54a[_0xf8bd('0x2f')][_0xf8bd('0x3c')]){_0x4bff64['where']=_[_0xf8bd('0x3d')](_0x4bff64[_0xf8bd('0x3e')],{'$or':_[_0xf8bd('0x3f')](_0x4c386a,function(_0x4e0e7e){if(_0x4e0e7e['type']!==_0xf8bd('0x40')){var _0x51f862={};_0x51f862[_0x4e0e7e['name']]={'$like':'%'+_0x3aa54a[_0xf8bd('0x2f')]['filter']+'%'};return _0x51f862;}})});}_0x4bff64=_[_0xf8bd('0x3d')]({},_0x4bff64,_0x3aa54a[_0xf8bd('0x41')]);var _0x17454a={'where':_0x4bff64[_0xf8bd('0x3e')]};return db[_0xf8bd('0x42')][_0xf8bd('0x43')](_0x17454a)[_0xf8bd('0x22')](function(_0x168451){_0x594bd1[_0xf8bd('0x43')]=_0x168451;if(_0x3aa54a[_0xf8bd('0x2f')]['includeAll']){_0x4bff64[_0xf8bd('0x44')]=[{'all':!![]}];}return db[_0xf8bd('0x42')][_0xf8bd('0x45')](_0x4bff64);})[_0xf8bd('0x22')](function(_0x48b6da){_0x594bd1[_0xf8bd('0x46')]=_0x48b6da;return _0x594bd1;})[_0xf8bd('0x22')](respondWithFilteredResult(_0x4fc088,_0x4bff64))[_0xf8bd('0x47')](handleError(_0x4fc088,null));};exports[_0xf8bd('0x48')]=function(_0x504366,_0x5ecda7){var _0x4fd370={'raw':![],'where':{'id':_0x504366['params']['id']}},_0x51b21e={};_0x51b21e[_0xf8bd('0x32')]=_[_0xf8bd('0x2e')](db[_0xf8bd('0x42')][_0xf8bd('0x2b')]);_0x51b21e[_0xf8bd('0x2f')]=_[_0xf8bd('0x2e')](_0x504366[_0xf8bd('0x2f')]);_0x51b21e[_0xf8bd('0x30')]=_['intersection'](_0x51b21e[_0xf8bd('0x32')],_0x51b21e[_0xf8bd('0x2f')]);_0x4fd370[_0xf8bd('0x34')]=_[_0xf8bd('0x31')](_0x51b21e[_0xf8bd('0x32')],qs[_0xf8bd('0x33')](_0x504366[_0xf8bd('0x2f')][_0xf8bd('0x33')]));_0x4fd370[_0xf8bd('0x34')]=_0x4fd370['attributes'][_0xf8bd('0x35')]?_0x4fd370[_0xf8bd('0x34')]:_0x51b21e[_0xf8bd('0x32')];if(_0x504366[_0xf8bd('0x2f')][_0xf8bd('0x49')]){_0x4fd370[_0xf8bd('0x44')]=[{'all':!![]}];}_0x4fd370=_[_0xf8bd('0x3d')]({},_0x4fd370,_0x504366['options']);return db[_0xf8bd('0x42')][_0xf8bd('0x4a')](_0x4fd370)[_0xf8bd('0x22')](handleEntityNotFound(_0x5ecda7,null))['then'](respondWithResult(_0x5ecda7,null))[_0xf8bd('0x47')](handleError(_0x5ecda7,null));};exports['create']=function(_0x15d97f,_0x3cebed){return db[_0xf8bd('0x42')]['create'](_0x15d97f[_0xf8bd('0x4b')],{})[_0xf8bd('0x22')](function(_0x29b5a5){var _0x27b4c0=_0x15d97f[_0xf8bd('0x4c')][_0xf8bd('0x23')]({'plain':!![]});if(!_0x27b4c0)throw new Error(_0xf8bd('0x4d'));if(_0x27b4c0[_0xf8bd('0x4e')]===_0xf8bd('0x4c')){var _0xe2931a=_0x29b5a5[_0xf8bd('0x23')]({'plain':!![]});var _0x430ecb=_0xf8bd('0x4f');return db[_0xf8bd('0x50')][_0xf8bd('0x4a')]({'where':{'name':_0x430ecb,'userProfileId':_0x27b4c0[_0xf8bd('0x51')]},'raw':!![]})[_0xf8bd('0x22')](function(_0x529f24){if(_0x529f24&&_0x529f24[_0xf8bd('0x52')]===0x0){return db[_0xf8bd('0x25')][_0xf8bd('0x53')]({'name':_0xe2931a[_0xf8bd('0x28')],'resourceId':_0xe2931a['id'],'type':_0xf8bd('0x24'),'sectionId':_0x529f24['id']},{})[_0xf8bd('0x22')](function(){return _0x29b5a5;});}else{return _0x29b5a5;}})[_0xf8bd('0x47')](function(_0xcf4b86){logger[_0xf8bd('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf4b86);throw _0xcf4b86;});}return _0x29b5a5;})[_0xf8bd('0x22')](respondWithResult(_0x3cebed,0xc9))[_0xf8bd('0x47')](handleError(_0x3cebed,null));};exports[_0xf8bd('0x20')]=function(_0x315841,_0xe157f5){if(_0x315841['body']['id']){delete _0x315841[_0xf8bd('0x4b')]['id'];}return db[_0xf8bd('0x42')][_0xf8bd('0x4a')]({'where':{'id':_0x315841[_0xf8bd('0x54')]['id']}})[_0xf8bd('0x22')](handleEntityNotFound(_0xe157f5,null))['then'](saveUpdates(_0x315841[_0xf8bd('0x4b')],null))[_0xf8bd('0x22')](respondWithResult(_0xe157f5,null))[_0xf8bd('0x47')](handleError(_0xe157f5,null));};exports[_0xf8bd('0x21')]=function(_0xd5006a,_0x5ec466){return db[_0xf8bd('0x42')]['find']({'where':{'id':_0xd5006a[_0xf8bd('0x54')]['id']}})[_0xf8bd('0x22')](handleEntityNotFound(_0x5ec466,null))['then'](removeEntity(_0x5ec466,null))['catch'](handleError(_0x5ec466,null));};exports['preview']=function(_0x52338f,_0x1ddc13){var _0x49db58=0xa;var _0x2f9f5a=[_0xf8bd('0x55'),_0xf8bd('0x56'),'right_join',_0xf8bd('0x57')];var _0x312429={'SUM':_0xf8bd('0x58'),'COUNT':_0xf8bd('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf8bd('0x5a'),'GROUP_CONCAT':_0xf8bd('0x5b'),'GROUP_CONCAT ASC':_0xf8bd('0x5c'),'GROUP_CONCAT DESC':_0xf8bd('0x5d')};var _0x228deb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf8bd('0x5e'),'HOUR':_0xf8bd('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf8bd('0x60')};var _0x5962c9=function(_0x330778){return!_[_0xf8bd('0x61')](['IS\x20NULL',_0xf8bd('0x62'),_0xf8bd('0x63'),_0xf8bd('0x64')],_0x330778);};var _0x14dd54=function(_0x418cf2){if(!_0x418cf2||!_0x418cf2['rules'][_0xf8bd('0x35')]){return'';}for(var _0x350101='(',_0x10cba5=0x0;_0x10cba5<_0x418cf2['rules']['length'];_0x10cba5+=0x1){_0x10cba5>0x0&&(_0x350101+='\x20'+_0x418cf2['operator']+'\x20');_0x350101+=_0x418cf2[_0xf8bd('0x65')][_0x10cba5]['group']?_0x14dd54(_0x418cf2['rules'][_0x10cba5][_0xf8bd('0x66')]):_0x418cf2[_0xf8bd('0x65')][_0x10cba5][_0xf8bd('0x67')]+'\x20'+_0x418cf2[_0xf8bd('0x65')][_0x10cba5][_0xf8bd('0x68')]+(_0x5962c9(_0x418cf2[_0xf8bd('0x65')][_0x10cba5][_0xf8bd('0x68')])?'\x20'+_0x418cf2[_0xf8bd('0x65')][_0x10cba5]['value']:'');}return _0x350101+')';};var _0x16fa16={'where':{'id':_0x52338f[_0xf8bd('0x54')]['id']}},_0x1af941,_0x1df41,_0x36f4e3,_0x4bf354,_0x2266c3;_0x16fa16=_[_0xf8bd('0x3d')]({},_0x16fa16,_0x52338f[_0xf8bd('0x41')]);return db[_0xf8bd('0x42')]['find'](_0x16fa16)[_0xf8bd('0x22')](function(_0xe5cb30){if(_0xe5cb30){_0x1af941=_0xe5cb30;return _0xe5cb30[_0xf8bd('0x69')]();}return null;})[_0xf8bd('0x22')](function(_0x43145e){if(_0x43145e){if(!_0x43145e[_0xf8bd('0x35')]){throw new db[(_0xf8bd('0x6a'))][(_0xf8bd('0x6b'))](_0xf8bd('0x6c'),0x193);}_0x1df41=_0x43145e;return db[_0xf8bd('0x6d')][_0xf8bd('0x45')]({'raw':!![]});}return null;})[_0xf8bd('0x22')](function(_0x32afdd){if(_0x32afdd){_0x36f4e3=_[_0xf8bd('0x6e')](_0x32afdd,'id');var _0x3d76a4;var _0x5409d8=squel[_0xf8bd('0x6f')]();_0x5409d8[_0xf8bd('0x70')](_0x1af941['table']);for(var _0x39a708=0x0;_0x39a708<_0x1df41[_0xf8bd('0x35')];_0x39a708+=0x1){_0x3d76a4=_0x1df41[_0x39a708][_0xf8bd('0x71')]?_0x36f4e3[_0x1df41[_0x39a708][_0xf8bd('0x71')]]['metric']:_0x1df41[_0x39a708]['field'];_0x3d76a4=_0x1df41[_0x39a708][_0xf8bd('0x72')]?_[_0xf8bd('0x73')](_0x312429[_0x1df41[_0x39a708][_0xf8bd('0x72')]],'%s',_0x3d76a4):_0x3d76a4;_0x3d76a4=_0x1df41[_0x39a708][_0xf8bd('0x74')]?_['replace'](_0x228deb[_0x1df41[_0x39a708][_0xf8bd('0x74')]],'%s',_0x3d76a4):_0x3d76a4;if(_0x1df41[_0x39a708][_0xf8bd('0x75')]){_0x5409d8['group'](_0x3d76a4);}_0x1df41[_0x39a708][_0xf8bd('0x76')]&&_0x5409d8[_0xf8bd('0x39')](_0x3d76a4,_0x1df41[_0x39a708][_0xf8bd('0x76')]===_0xf8bd('0x77')?![]:!![]);_0x5409d8[_0xf8bd('0x67')](_0x3d76a4,_0x1df41[_0x39a708][_0xf8bd('0x78')]||_0x3d76a4);}if(_0x1af941[_0xf8bd('0x79')]){_0x1af941['joins']=JSON[_0xf8bd('0x7a')](_0x1af941['joins']);for(var _0x19639e=0x0;_0x19639e<_0x1af941[_0xf8bd('0x79')][_0xf8bd('0x35')];_0x19639e+=0x1){if(_0x1af941['joins'][_0x19639e]['type']&&_['includes'](_0x2f9f5a,_0x1af941['joins'][_0x19639e][_0xf8bd('0x2c')])&&_0x1af941[_0xf8bd('0x79')][_0x19639e][_0xf8bd('0x7b')]&&_0x1af941['joins'][_0x19639e][_0xf8bd('0x7c')]&&_0x1af941[_0xf8bd('0x79')][_0x19639e]['foreignKey']){_0x5409d8[_0x1af941['joins'][_0x19639e]['type']](_0x1af941[_0xf8bd('0x79')][_0x19639e]['foreignTable'],null,util['format'](_0xf8bd('0x7d'),_0x1af941[_0xf8bd('0x7e')],_0x1af941[_0xf8bd('0x79')][_0x19639e][_0xf8bd('0x7b')],_0x1af941['joins'][_0x19639e]['foreignTable'],_0x1af941[_0xf8bd('0x79')][_0x19639e][_0xf8bd('0x7f')]));}}}if(_0x1af941[_0xf8bd('0x80')]){_0x1af941[_0xf8bd('0x80')]=JSON[_0xf8bd('0x7a')](_0x1af941[_0xf8bd('0x80')]);_0x5409d8[_0xf8bd('0x3e')](_0x14dd54(_0x1af941[_0xf8bd('0x80')]['group']));}_0x2266c3=_0x5409d8[_0xf8bd('0x81')]();_0x5409d8['limit'](_0x49db58);_0x5409d8[_0xf8bd('0x1b')](0x0);logger[_0xf8bd('0x82')](_0xf8bd('0x83'),_0x5409d8[_0xf8bd('0x84')]());return db['sequelize'][_0xf8bd('0x2f')](_0x5409d8[_0xf8bd('0x84')](),{'type':db[_0xf8bd('0x85')][_0xf8bd('0x86')][_0xf8bd('0x87')]});}})[_0xf8bd('0x22')](respondWithResult(_0x1ddc13,null))['catch'](handleError(_0x1ddc13,null));};function runReport(_0x21934d,_0x727dd0,_0x1babb4){var _0x520317=_0x727dd0[_0xf8bd('0x28')];var _0x78b923=0xa;var _0x59943c=[_0xf8bd('0x55'),_0xf8bd('0x56'),'right_join',_0xf8bd('0x57')];var _0x152480={'SUM':_0xf8bd('0x58'),'COUNT':_0xf8bd('0x59'),'COUNT DISTINCT':_0xf8bd('0x88'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf8bd('0x5a'),'GROUP_CONCAT':_0xf8bd('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf8bd('0x5d')};var _0x16ab64={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf8bd('0x5e'),'HOUR':_0xf8bd('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf8bd('0x60')};var _0x5f75b4=function(_0x2133f8){return!_['includes']([_0xf8bd('0x89'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xf8bd('0x64')],_0x2133f8);};var _0x5d3330=function(_0x3f827c){if(!_0x3f827c||!_0x3f827c['rules']['length']){return'';}for(var _0x31f12c='(',_0x1448e9=0x0;_0x1448e9<_0x3f827c[_0xf8bd('0x65')][_0xf8bd('0x35')];_0x1448e9+=0x1){_0x1448e9>0x0&&(_0x31f12c+='\x20'+_0x3f827c[_0xf8bd('0x8a')]+'\x20');_0x31f12c+=_0x3f827c[_0xf8bd('0x65')][_0x1448e9][_0xf8bd('0x66')]?_0x5d3330(_0x3f827c[_0xf8bd('0x65')][_0x1448e9]['group']):_0x3f827c[_0xf8bd('0x65')][_0x1448e9][_0xf8bd('0x67')]+'\x20'+_0x3f827c[_0xf8bd('0x65')][_0x1448e9][_0xf8bd('0x68')]+(_0x5f75b4(_0x3f827c[_0xf8bd('0x65')][_0x1448e9][_0xf8bd('0x68')])?'\x20'+_0x3f827c[_0xf8bd('0x65')][_0x1448e9]['value']:'');}return _0x31f12c+')';};var _0x247d24={'where':{'id':_0x21934d['id']}},_0x2ef3f1,_0x10d1f3,_0xbce5ca,_0x378191,_0x34b720;_0x247d24=_[_0xf8bd('0x3d')]({},_0x247d24,_0x1babb4);return db[_0xf8bd('0x42')][_0xf8bd('0x4a')](_0x247d24)[_0xf8bd('0x22')](function(_0x3cab77){if(_0x3cab77){_0x2ef3f1=_0x3cab77;return _0x3cab77[_0xf8bd('0x69')]();}return null;})[_0xf8bd('0x22')](function(_0x243346){if(_0x243346){if(!_0x243346[_0xf8bd('0x35')]){throw new db[(_0xf8bd('0x6a'))][(_0xf8bd('0x6b'))](_0xf8bd('0x6c'),0x193);}_0x10d1f3=_0x243346;return db[_0xf8bd('0x6d')][_0xf8bd('0x45')]({'raw':!![]});}return null;})['then'](function(_0x2ff739){if(_0x2ff739){_0xbce5ca=_[_0xf8bd('0x6e')](_0x2ff739,'id');var _0x4279a7;var _0x1727cc=squel[_0xf8bd('0x6f')]();_0x1727cc['from'](_0x2ef3f1[_0xf8bd('0x7e')]);for(var _0x55a26e=0x0;_0x55a26e<_0x10d1f3[_0xf8bd('0x35')];_0x55a26e+=0x1){_0x4279a7=_0x10d1f3[_0x55a26e]['MetricId']?_0xbce5ca[_0x10d1f3[_0x55a26e]['MetricId']][_0xf8bd('0x8b')]:_0x10d1f3[_0x55a26e][_0xf8bd('0x67')];_0x4279a7=_0x10d1f3[_0x55a26e][_0xf8bd('0x72')]?_['replace'](_0x152480[_0x10d1f3[_0x55a26e][_0xf8bd('0x72')]],'%s',_0x4279a7):_0x4279a7;_0x4279a7=_0x10d1f3[_0x55a26e][_0xf8bd('0x74')]?_[_0xf8bd('0x73')](_0x16ab64[_0x10d1f3[_0x55a26e]['format']],'%s',_0x4279a7):_0x4279a7;if(_0x10d1f3[_0x55a26e][_0xf8bd('0x75')]){_0x1727cc[_0xf8bd('0x66')](_0x4279a7);}_0x10d1f3[_0x55a26e]['orderBy']&&_0x1727cc[_0xf8bd('0x39')](_0x4279a7,_0x10d1f3[_0x55a26e][_0xf8bd('0x76')]===_0xf8bd('0x77')?![]:!![]);_0x1727cc[_0xf8bd('0x67')](_0x4279a7,_0x10d1f3[_0x55a26e][_0xf8bd('0x78')]||_0x4279a7);}if(_0x2ef3f1[_0xf8bd('0x79')]){_0x2ef3f1[_0xf8bd('0x79')]=JSON['parse'](_0x2ef3f1[_0xf8bd('0x79')]);for(var _0x2115c2=0x0;_0x2115c2<_0x2ef3f1[_0xf8bd('0x79')][_0xf8bd('0x35')];_0x2115c2+=0x1){if(_0x2ef3f1['joins'][_0x2115c2][_0xf8bd('0x2c')]&&_[_0xf8bd('0x61')](_0x59943c,_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2]['type'])&&_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7b')]&&_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7c')]&&_0x2ef3f1['joins'][_0x2115c2][_0xf8bd('0x7f')]){_0x1727cc[_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x2c')]](_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7c')],null,util[_0xf8bd('0x74')]('%s.%s\x20=\x20%s.%s',_0x2ef3f1['table'],_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7b')],_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7c')],_0x2ef3f1[_0xf8bd('0x79')][_0x2115c2][_0xf8bd('0x7f')]));}}}if(_0x2ef3f1[_0xf8bd('0x80')]){_0x2ef3f1[_0xf8bd('0x80')]=JSON['parse'](_0x2ef3f1[_0xf8bd('0x80')]);_0x1727cc[_0xf8bd('0x3e')](_0x5d3330(_0x2ef3f1[_0xf8bd('0x80')][_0xf8bd('0x66')]));}_0x34b720=_0x1727cc[_0xf8bd('0x81')]();_0x1727cc[_0xf8bd('0x38')](_0x78b923);_0x1727cc[_0xf8bd('0x1b')](0x0);logger['debug'](_0xf8bd('0x83'),_0x1727cc['toString']());return db[_0xf8bd('0x85')]['query'](_0x1727cc['toString'](),{'type':db[_0xf8bd('0x85')][_0xf8bd('0x86')][_0xf8bd('0x87')]});}})[_0xf8bd('0x22')](function(_0x46570c){if(!_0x46570c[_0xf8bd('0x35')]){throw new db['Sequelize'][(_0xf8bd('0x6b'))]('No\x20available\x20data',0xcc);}if(_0x727dd0[_0xf8bd('0x8c')]===_0xf8bd('0x8d')){return null;}var _0x1afa1a=_['merge'](_0x727dd0,{'name':_0x727dd0[_0xf8bd('0x8e')]||_0x727dd0[_0xf8bd('0x28')]||_0x2ef3f1[_0xf8bd('0x28')],'basename':_0x520317,'savename':util[_0xf8bd('0x74')](_0xf8bd('0x8f'),_0x727dd0[_0xf8bd('0x28')]||_0x2ef3f1[_0xf8bd('0x28')],require(_0xf8bd('0x90'))[_0xf8bd('0x91')](0x4),_0x727dd0['output']||'csv'),'reportId':_0x2ef3f1['id'],'reportType':_0xf8bd('0x92')});return db[_0xf8bd('0x93')][_0xf8bd('0x53')](_0x1afa1a,{'raw':!![]});})[_0xf8bd('0x22')](function(_0x52a265){if(_0x2ef3f1[_0xf8bd('0x7e')]===_0xf8bd('0x94')){_0x34b720[_0xf8bd('0x3e')](_0x2ef3f1[_0xf8bd('0x7e')]+_0xf8bd('0x95'),_0x727dd0[_0xf8bd('0x96')],_0x727dd0[_0xf8bd('0x97')]);}else{_0x34b720[_0xf8bd('0x3e')](_0x2ef3f1['table']+_0xf8bd('0x98'),_0x727dd0['startDate'],_0x727dd0[_0xf8bd('0x97')]);}if(_0x52a265){logger[_0xf8bd('0x99')]('Run\x20Query:',_0x34b720[_0xf8bd('0x84')]());require(_0xf8bd('0x9a'))['fork'](path[_0xf8bd('0x55')](__dirname,_0xf8bd('0x9b'),_0x52a265['output']),[_0x52a265['id'],_0x34b720[_0xf8bd('0x84')](),path[_0xf8bd('0x55')](__dirname,_0xf8bd('0x9c'),_0x52a265[_0xf8bd('0x9d')]),_0x520317]);return _0x52a265;}else{var _0x1757da=squel[_0xf8bd('0x6f')]();_0x1757da[_0xf8bd('0x70')]('('+_0x34b720[_0xf8bd('0x84')]()+')',_0xf8bd('0x9e'));_0x1757da[_0xf8bd('0x67')]('COUNT(*)','count');_0x34b720[_0xf8bd('0x38')](_0x727dd0['limit']||_0x78b923);_0x34b720['offset'](_0x727dd0[_0xf8bd('0x1b')]||0x0);return dbH[_0xf8bd('0x85')][_0xf8bd('0x2f')](_0x1757da['toString'](),{'type':dbH[_0xf8bd('0x85')][_0xf8bd('0x86')][_0xf8bd('0x87')]})[_0xf8bd('0x22')](function(_0x9ce062){if(!_0x9ce062[_0xf8bd('0x35')]){_0x378191=0x0;}else{_0x378191=_0x9ce062[0x0][_0xf8bd('0x43')]||0x0;}return dbH['sequelize'][_0xf8bd('0x2f')](_0x34b720[_0xf8bd('0x84')](),{'type':dbH[_0xf8bd('0x85')]['QueryTypes'][_0xf8bd('0x87')]});})[_0xf8bd('0x22')](function(_0x395a14){return{'rows':_0x395a14||[],'count':_0x378191};});}});}exports['run']=function(_0x62b51c,_0x7415d5){return runReport(_0x62b51c[_0xf8bd('0x54')],_0x62b51c[_0xf8bd('0x2f')],_0x62b51c[_0xf8bd('0x41')])[_0xf8bd('0x22')](respondWithResult(_0x7415d5,null))[_0xf8bd('0x47')](handleError(_0x7415d5,null));};exports['runReport']=runReport;exports['query']=function(_0xe482ea,_0x2865d2){var _0x4dbfcc=0xa;var _0x16b04e=['join','left_join',_0xf8bd('0x9f'),_0xf8bd('0x57')];var _0x461243={'SUM':_0xf8bd('0x58'),'COUNT':_0xf8bd('0x59'),'COUNT DISTINCT':_0xf8bd('0x88'),'MAX':'MAX(%s)','MIN':_0xf8bd('0xa0'),'AVG':_0xf8bd('0x5a'),'GROUP_CONCAT':_0xf8bd('0x5b'),'GROUP_CONCAT ASC':_0xf8bd('0x5c'),'GROUP_CONCAT DESC':_0xf8bd('0x5d')};var _0x4d9f4b={'SEC_TO_TIME':_0xf8bd('0xa1'),'DATE':_0xf8bd('0x5e'),'HOUR':_0xf8bd('0x5f'),'ROUND':_0xf8bd('0xa2'),'UNIX_TIMESTAMP':_0xf8bd('0x60')};var _0x60143=function(_0xa6461f){return!_[_0xf8bd('0x61')]([_0xf8bd('0x89'),_0xf8bd('0x62'),'IS\x20EMPTY',_0xf8bd('0x64')],_0xa6461f);};var _0x4823fc=function(_0x3f944c){if(!_0x3f944c||!_0x3f944c[_0xf8bd('0x65')][_0xf8bd('0x35')]){return'';}for(var _0x5f41e8='(',_0x588b41=0x0;_0x588b41<_0x3f944c['rules'][_0xf8bd('0x35')];_0x588b41+=0x1){_0x588b41>0x0&&(_0x5f41e8+='\x20'+_0x3f944c[_0xf8bd('0x8a')]+'\x20');_0x5f41e8+=_0x3f944c[_0xf8bd('0x65')][_0x588b41][_0xf8bd('0x66')]?_0x4823fc(_0x3f944c['rules'][_0x588b41][_0xf8bd('0x66')]):_0x3f944c[_0xf8bd('0x65')][_0x588b41][_0xf8bd('0x67')]+'\x20'+_0x3f944c[_0xf8bd('0x65')][_0x588b41][_0xf8bd('0x68')]+(_0x60143(_0x3f944c[_0xf8bd('0x65')][_0x588b41]['condition'])?'\x20'+_0x3f944c[_0xf8bd('0x65')][_0x588b41][_0xf8bd('0xa3')]:'');}return _0x5f41e8+')';};var _0x10c349={'where':{'id':_0xe482ea['params']['id']}},_0x182e8b,_0x34541d,_0x4e0d37,_0x125c15,_0x2df3e9;_0x10c349=_[_0xf8bd('0x3d')]({},_0x10c349,_0xe482ea['options']);return db['AnalyticCustomReport']['find'](_0x10c349)[_0xf8bd('0x22')](function(_0x1d098a){if(_0x1d098a){_0x182e8b=_0x1d098a;return _0x1d098a[_0xf8bd('0x69')]();}return null;})[_0xf8bd('0x22')](function(_0x5add47){if(_0x5add47){if(!_0x5add47[_0xf8bd('0x35')]){throw new db[(_0xf8bd('0x6a'))][(_0xf8bd('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x34541d=_0x5add47;return db[_0xf8bd('0x6d')][_0xf8bd('0x45')]({'raw':!![]});}return null;})[_0xf8bd('0x22')](function(_0x468f64){if(_0x468f64){_0x4e0d37=_['keyBy'](_0x468f64,'id');var _0x41eab0;var _0x248f42=squel[_0xf8bd('0x6f')]();_0x248f42[_0xf8bd('0x70')](_0x182e8b[_0xf8bd('0x7e')]);for(var _0x14f4d7=0x0;_0x14f4d7<_0x34541d[_0xf8bd('0x35')];_0x14f4d7+=0x1){_0x41eab0=_0x34541d[_0x14f4d7][_0xf8bd('0x71')]?_0x4e0d37[_0x34541d[_0x14f4d7][_0xf8bd('0x71')]][_0xf8bd('0x8b')]:_0x34541d[_0x14f4d7][_0xf8bd('0x67')];_0x41eab0=_0x34541d[_0x14f4d7][_0xf8bd('0x72')]?_[_0xf8bd('0x73')](_0x461243[_0x34541d[_0x14f4d7]['function']],'%s',_0x41eab0):_0x41eab0;_0x41eab0=_0x34541d[_0x14f4d7][_0xf8bd('0x74')]?_[_0xf8bd('0x73')](_0x4d9f4b[_0x34541d[_0x14f4d7][_0xf8bd('0x74')]],'%s',_0x41eab0):_0x41eab0;if(_0x34541d[_0x14f4d7][_0xf8bd('0x75')]){_0x248f42['group'](_0x41eab0);}_0x34541d[_0x14f4d7][_0xf8bd('0x76')]&&_0x248f42[_0xf8bd('0x39')](_0x41eab0,_0x34541d[_0x14f4d7]['orderBy']==='DESC'?![]:!![]);_0x248f42[_0xf8bd('0x67')](_0x41eab0,_0x34541d[_0x14f4d7]['alias']||_0x41eab0);}if(_0x182e8b[_0xf8bd('0x79')]){_0x182e8b[_0xf8bd('0x79')]=JSON[_0xf8bd('0x7a')](_0x182e8b[_0xf8bd('0x79')]);for(var _0x251f02=0x0;_0x251f02<_0x182e8b[_0xf8bd('0x79')][_0xf8bd('0x35')];_0x251f02+=0x1){if(_0x182e8b[_0xf8bd('0x79')][_0x251f02]['type']&&_['includes'](_0x16b04e,_0x182e8b[_0xf8bd('0x79')][_0x251f02][_0xf8bd('0x2c')])&&_0x182e8b[_0xf8bd('0x79')][_0x251f02]['parentKey']&&_0x182e8b['joins'][_0x251f02][_0xf8bd('0x7c')]&&_0x182e8b[_0xf8bd('0x79')][_0x251f02][_0xf8bd('0x7f')]){_0x248f42[_0x182e8b[_0xf8bd('0x79')][_0x251f02][_0xf8bd('0x2c')]](_0x182e8b[_0xf8bd('0x79')][_0x251f02][_0xf8bd('0x7c')],null,util['format'](_0xf8bd('0x7d'),_0x182e8b[_0xf8bd('0x7e')],_0x182e8b[_0xf8bd('0x79')][_0x251f02]['parentKey'],_0x182e8b['joins'][_0x251f02][_0xf8bd('0x7c')],_0x182e8b[_0xf8bd('0x79')][_0x251f02][_0xf8bd('0x7f')]));}}}if(_0x182e8b[_0xf8bd('0x80')]){_0x182e8b[_0xf8bd('0x80')]=JSON[_0xf8bd('0x7a')](_0x182e8b['conditions']);_0x248f42[_0xf8bd('0x3e')](_0x4823fc(_0x182e8b['conditions'][_0xf8bd('0x66')]));}_0x2df3e9=_0x248f42[_0xf8bd('0x81')]();_0x248f42[_0xf8bd('0x38')](_0x4dbfcc);_0x248f42[_0xf8bd('0x1b')](0x0);logger[_0xf8bd('0x82')](_0xf8bd('0x83'),_0x248f42[_0xf8bd('0x84')]());return db[_0xf8bd('0x85')][_0xf8bd('0x2f')](_0x248f42['toString'](),{'type':db[_0xf8bd('0x85')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x2df3e9[_0xf8bd('0x84')]()};})['then'](respondWithResult(_0x2865d2,null))[_0xf8bd('0x47')](handleError(_0x2865d2,null));}; \ No newline at end of file +var _0x0ef0=['CustomReports','UserProfileResource','end','stack','name','send','AnalyticCustomReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','options','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','group','orderBy','order','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','getFields','metric','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','run','runReport','Sequelize','DESC','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ef0,0x80));var _0x00ef=function(_0x56c758,_0x540591){_0x56c758=_0x56c758-0x0;var _0x9bb0db=_0x0ef0[_0x56c758];return _0x9bb0db;};'use strict';var pdf=require(_0x00ef('0x0'));var emlformat=require(_0x00ef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x00ef('0x2'));var jsonpatch=require(_0x00ef('0x3'));var rp=require(_0x00ef('0x4'));var moment=require(_0x00ef('0x5'));var BPromise=require(_0x00ef('0x6'));var Mustache=require(_0x00ef('0x7'));var util=require('util');var path=require('path');var sox=require(_0x00ef('0x8'));var csv=require(_0x00ef('0x9'));var ejs=require(_0x00ef('0xa'));var fs=require('fs');var _=require(_0x00ef('0xb'));var squel=require('squel');var crypto=require(_0x00ef('0xc'));var jsforce=require(_0x00ef('0xd'));var deskjs=require(_0x00ef('0xe'));var toCsv=require(_0x00ef('0x9'));var querystring=require(_0x00ef('0xf'));var Papa=require('papaparse');var Redis=require(_0x00ef('0x10'));var authService=require(_0x00ef('0x11'));var qs=require(_0x00ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00ef('0x13'));var logger=require('../../config/logger')(_0x00ef('0x14'));var utils=require(_0x00ef('0x15'));var config=require(_0x00ef('0x16'));var db=require(_0x00ef('0x17'))['db'];var dbH=require(_0x00ef('0x17'))['dbH'];function respondWithStatusCode(_0x217ac9,_0x4c9a9c){_0x4c9a9c=_0x4c9a9c||0xcc;return function(_0x1e1b41){if(_0x1e1b41){return _0x217ac9[_0x00ef('0x18')](_0x4c9a9c);}return _0x217ac9[_0x00ef('0x19')](_0x4c9a9c)['end']();};}function respondWithResult(_0x2bbc55,_0x4aed97){_0x4aed97=_0x4aed97||0xc8;return function(_0x5a657a){if(_0x5a657a){return _0x2bbc55[_0x00ef('0x19')](_0x4aed97)[_0x00ef('0x1a')](_0x5a657a);}};}function respondWithFilteredResult(_0x8f5256,_0x250c3d){return function(_0x5b60ec){if(_0x5b60ec){var _0x19aa34=_0x5b60ec[_0x00ef('0x1b')],_0x4a8a86=_0x250c3d['offset'],_0xbd149a=_0x250c3d[_0x00ef('0x1c')]+_0x250c3d[_0x00ef('0x1d')],_0x164690;if(_0xbd149a>=_0x19aa34){_0xbd149a=_0x19aa34;_0x164690=0xc8;}else{_0x164690=0xce;}_0x8f5256[_0x00ef('0x19')](_0x164690);return _0x8f5256[_0x00ef('0x1e')](_0x00ef('0x1f'),_0x4a8a86+'-'+_0xbd149a+'/'+_0x19aa34)[_0x00ef('0x1a')](_0x5b60ec);}return null;};}function patchUpdates(_0x437560){return function(_0x51031e){try{jsonpatch[_0x00ef('0x20')](_0x51031e,_0x437560,!![]);}catch(_0x2c0508){return BPromise[_0x00ef('0x21')](_0x2c0508);}return _0x51031e[_0x00ef('0x22')]();};}function saveUpdates(_0x3b815b,_0x3ab135){return function(_0x2f6998){if(_0x2f6998){return _0x2f6998[_0x00ef('0x23')](_0x3b815b)[_0x00ef('0x24')](function(_0x547e82){return _0x547e82;});}return null;};}function removeEntity(_0x369db9,_0x3772e4){return function(_0x413add){if(_0x413add){return _0x413add[_0x00ef('0x25')]()[_0x00ef('0x24')](function(){var _0x283d49=_0x413add[_0x00ef('0x26')]({'plain':!![]});var _0x6d76aa=_0x00ef('0x27');return db[_0x00ef('0x28')][_0x00ef('0x25')]({'where':{'type':_0x6d76aa,'resourceId':_0x283d49['id']}})['then'](function(){return _0x413add;});})[_0x00ef('0x24')](function(){_0x369db9[_0x00ef('0x19')](0xcc)[_0x00ef('0x29')]();});}};}function handleEntityNotFound(_0x305911,_0x515b09){return function(_0x50b38b){if(!_0x50b38b){_0x305911[_0x00ef('0x18')](0x194);}return _0x50b38b;};}function handleError(_0x278dbe,_0x27dece){_0x27dece=_0x27dece||0x1f4;return function(_0x26939e){logger['error'](_0x26939e[_0x00ef('0x2a')]);if(_0x26939e['name']){delete _0x26939e[_0x00ef('0x2b')];}_0x278dbe[_0x00ef('0x19')](_0x27dece)[_0x00ef('0x2c')](_0x26939e);};}exports['index']=function(_0x3f021e,_0xf8f7db){var _0x22c0c3={},_0x973720={},_0xb3869f={'count':0x0,'rows':[]};var _0x286e98=_['map'](db[_0x00ef('0x2d')][_0x00ef('0x2e')],function(_0x1be6a7){return{'name':_0x1be6a7['fieldName'],'type':_0x1be6a7[_0x00ef('0x2f')][_0x00ef('0x30')]};});_0x973720[_0x00ef('0x31')]=_[_0x00ef('0x32')](_0x286e98,_0x00ef('0x2b'));_0x973720['query']=_[_0x00ef('0x33')](_0x3f021e[_0x00ef('0x34')]);_0x973720[_0x00ef('0x35')]=_[_0x00ef('0x36')](_0x973720[_0x00ef('0x31')],_0x973720[_0x00ef('0x34')]);_0x22c0c3[_0x00ef('0x37')]=_['intersection'](_0x973720[_0x00ef('0x31')],qs['fields'](_0x3f021e[_0x00ef('0x34')]['fields']));_0x22c0c3[_0x00ef('0x37')]=_0x22c0c3[_0x00ef('0x37')][_0x00ef('0x38')]?_0x22c0c3['attributes']:_0x973720[_0x00ef('0x31')];if(!_0x3f021e[_0x00ef('0x34')][_0x00ef('0x39')](_0x00ef('0x3a'))){_0x22c0c3[_0x00ef('0x1d')]=qs['limit'](_0x3f021e[_0x00ef('0x34')]['limit']);_0x22c0c3[_0x00ef('0x1c')]=qs[_0x00ef('0x1c')](_0x3f021e['query'][_0x00ef('0x1c')]);}_0x22c0c3['order']=qs['sort'](_0x3f021e[_0x00ef('0x34')]['sort']);_0x22c0c3[_0x00ef('0x3b')]=qs[_0x00ef('0x35')](_['pick'](_0x3f021e[_0x00ef('0x34')],_0x973720['filters']),_0x286e98);if(_0x3f021e[_0x00ef('0x34')]['filter']){_0x22c0c3[_0x00ef('0x3b')]=_['merge'](_0x22c0c3[_0x00ef('0x3b')],{'$or':_['map'](_0x286e98,function(_0x22179f){if(_0x22179f[_0x00ef('0x2f')]!==_0x00ef('0x3c')){var _0x13e5a4={};_0x13e5a4[_0x22179f[_0x00ef('0x2b')]]={'$like':'%'+_0x3f021e[_0x00ef('0x34')][_0x00ef('0x3d')]+'%'};return _0x13e5a4;}})});}_0x22c0c3=_[_0x00ef('0x3e')]({},_0x22c0c3,_0x3f021e['options']);var _0x709250={'where':_0x22c0c3['where']};return db[_0x00ef('0x2d')]['count'](_0x709250)['then'](function(_0x484702){_0xb3869f['count']=_0x484702;if(_0x3f021e['query'][_0x00ef('0x3f')]){_0x22c0c3[_0x00ef('0x40')]=[{'all':!![]}];}return db[_0x00ef('0x2d')][_0x00ef('0x41')](_0x22c0c3);})[_0x00ef('0x24')](function(_0x212539){_0xb3869f[_0x00ef('0x42')]=_0x212539;return _0xb3869f;})[_0x00ef('0x24')](respondWithFilteredResult(_0xf8f7db,_0x22c0c3))[_0x00ef('0x43')](handleError(_0xf8f7db,null));};exports[_0x00ef('0x44')]=function(_0x171335,_0x20a7b6){var _0x513ef9={'raw':![],'where':{'id':_0x171335[_0x00ef('0x45')]['id']}},_0x565917={};_0x565917[_0x00ef('0x31')]=_[_0x00ef('0x33')](db[_0x00ef('0x2d')][_0x00ef('0x2e')]);_0x565917[_0x00ef('0x34')]=_[_0x00ef('0x33')](_0x171335[_0x00ef('0x34')]);_0x565917[_0x00ef('0x35')]=_[_0x00ef('0x36')](_0x565917['model'],_0x565917[_0x00ef('0x34')]);_0x513ef9[_0x00ef('0x37')]=_[_0x00ef('0x36')](_0x565917[_0x00ef('0x31')],qs[_0x00ef('0x46')](_0x171335['query']['fields']));_0x513ef9[_0x00ef('0x37')]=_0x513ef9[_0x00ef('0x37')]['length']?_0x513ef9[_0x00ef('0x37')]:_0x565917[_0x00ef('0x31')];if(_0x171335[_0x00ef('0x34')][_0x00ef('0x3f')]){_0x513ef9['include']=[{'all':!![]}];}_0x513ef9=_[_0x00ef('0x3e')]({},_0x513ef9,_0x171335['options']);return db[_0x00ef('0x2d')][_0x00ef('0x47')](_0x513ef9)[_0x00ef('0x24')](handleEntityNotFound(_0x20a7b6,null))[_0x00ef('0x24')](respondWithResult(_0x20a7b6,null))['catch'](handleError(_0x20a7b6,null));};exports['create']=function(_0x67cd51,_0x379f50){return db[_0x00ef('0x2d')][_0x00ef('0x48')](_0x67cd51[_0x00ef('0x49')],{})[_0x00ef('0x24')](function(_0x362c6b){var _0x4d7124=_0x67cd51['user'][_0x00ef('0x26')]({'plain':!![]});if(!_0x4d7124)throw new Error(_0x00ef('0x4a'));if(_0x4d7124['role']===_0x00ef('0x4b')){var _0xf88a0d=_0x362c6b[_0x00ef('0x26')]({'plain':!![]});var _0x9d6a43='Reports';return db[_0x00ef('0x4c')]['find']({'where':{'name':_0x9d6a43,'userProfileId':_0x4d7124[_0x00ef('0x4d')]},'raw':!![]})[_0x00ef('0x24')](function(_0x25e759){if(_0x25e759&&_0x25e759[_0x00ef('0x4e')]===0x0){return db[_0x00ef('0x28')]['create']({'name':_0xf88a0d[_0x00ef('0x2b')],'resourceId':_0xf88a0d['id'],'type':_0x00ef('0x27'),'sectionId':_0x25e759['id']},{})[_0x00ef('0x24')](function(){return _0x362c6b;});}else{return _0x362c6b;}})[_0x00ef('0x43')](function(_0x23e6ab){logger[_0x00ef('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23e6ab);throw _0x23e6ab;});}return _0x362c6b;})[_0x00ef('0x24')](respondWithResult(_0x379f50,0xc9))[_0x00ef('0x43')](handleError(_0x379f50,null));};exports[_0x00ef('0x23')]=function(_0x1ddf67,_0x2af867){if(_0x1ddf67[_0x00ef('0x49')]['id']){delete _0x1ddf67[_0x00ef('0x49')]['id'];}return db[_0x00ef('0x2d')][_0x00ef('0x47')]({'where':{'id':_0x1ddf67['params']['id']}})[_0x00ef('0x24')](handleEntityNotFound(_0x2af867,null))['then'](saveUpdates(_0x1ddf67[_0x00ef('0x49')],null))[_0x00ef('0x24')](respondWithResult(_0x2af867,null))[_0x00ef('0x43')](handleError(_0x2af867,null));};exports[_0x00ef('0x25')]=function(_0x6b17a1,_0x4aa5d2){return db[_0x00ef('0x2d')][_0x00ef('0x47')]({'where':{'id':_0x6b17a1[_0x00ef('0x45')]['id']}})[_0x00ef('0x24')](handleEntityNotFound(_0x4aa5d2,null))[_0x00ef('0x24')](removeEntity(_0x4aa5d2,null))[_0x00ef('0x43')](handleError(_0x4aa5d2,null));};exports[_0x00ef('0x50')]=function(_0x5d3464,_0x31983e){var _0x102903=0xa;var _0x30fe1b=['join',_0x00ef('0x51'),_0x00ef('0x52'),_0x00ef('0x53')];var _0x5098a5={'SUM':_0x00ef('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x00ef('0x55'),'MAX':_0x00ef('0x56'),'MIN':_0x00ef('0x57'),'AVG':_0x00ef('0x58'),'GROUP_CONCAT':_0x00ef('0x59'),'GROUP_CONCAT ASC':_0x00ef('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x19f89b={'SEC_TO_TIME':_0x00ef('0x5b'),'DATE':_0x00ef('0x5c'),'HOUR':_0x00ef('0x5d'),'ROUND':_0x00ef('0x5e'),'UNIX_TIMESTAMP':_0x00ef('0x5f')};var _0x591af1=function(_0xcabbe5){return!_[_0x00ef('0x60')](['IS\x20NULL',_0x00ef('0x61'),_0x00ef('0x62'),_0x00ef('0x63')],_0xcabbe5);};var _0x53828a=function(_0x34a30d){if(!_0x34a30d||!_0x34a30d['rules'][_0x00ef('0x38')]){return'';}for(var _0x4b355e='(',_0x3aa5c1=0x0;_0x3aa5c1<_0x34a30d[_0x00ef('0x64')]['length'];_0x3aa5c1+=0x1){_0x3aa5c1>0x0&&(_0x4b355e+='\x20'+_0x34a30d[_0x00ef('0x65')]+'\x20');_0x4b355e+=_0x34a30d[_0x00ef('0x64')][_0x3aa5c1]['group']?_0x53828a(_0x34a30d[_0x00ef('0x64')][_0x3aa5c1]['group']):_0x34a30d['rules'][_0x3aa5c1][_0x00ef('0x66')]+'\x20'+_0x34a30d[_0x00ef('0x64')][_0x3aa5c1][_0x00ef('0x67')]+(_0x591af1(_0x34a30d[_0x00ef('0x64')][_0x3aa5c1][_0x00ef('0x67')])?'\x20'+_0x34a30d[_0x00ef('0x64')][_0x3aa5c1][_0x00ef('0x68')]:'');}return _0x4b355e+')';};var _0x50104a={'where':{'id':_0x5d3464[_0x00ef('0x45')]['id']}},_0x387907,_0x3ae9c7,_0x3b1d80,_0x589869,_0x3058e9;_0x50104a=_[_0x00ef('0x3e')]({},_0x50104a,_0x5d3464[_0x00ef('0x69')]);return db[_0x00ef('0x2d')][_0x00ef('0x47')](_0x50104a)[_0x00ef('0x24')](function(_0x23a15f){if(_0x23a15f){_0x387907=_0x23a15f;return _0x23a15f['getFields']();}return null;})['then'](function(_0x131446){if(_0x131446){if(!_0x131446[_0x00ef('0x38')]){throw new db['Sequelize'][(_0x00ef('0x6a'))](_0x00ef('0x6b'),0x193);}_0x3ae9c7=_0x131446;return db[_0x00ef('0x6c')][_0x00ef('0x41')]({'raw':!![]});}return null;})[_0x00ef('0x24')](function(_0x21c9a5){if(_0x21c9a5){_0x3b1d80=_[_0x00ef('0x6d')](_0x21c9a5,'id');var _0x458961;var _0x2b234f=squel[_0x00ef('0x6e')]();_0x2b234f[_0x00ef('0x6f')](_0x387907[_0x00ef('0x70')]);for(var _0x11a94b=0x0;_0x11a94b<_0x3ae9c7['length'];_0x11a94b+=0x1){_0x458961=_0x3ae9c7[_0x11a94b][_0x00ef('0x71')]?_0x3b1d80[_0x3ae9c7[_0x11a94b]['MetricId']]['metric']:_0x3ae9c7[_0x11a94b][_0x00ef('0x66')];_0x458961=_0x3ae9c7[_0x11a94b]['function']?_[_0x00ef('0x72')](_0x5098a5[_0x3ae9c7[_0x11a94b][_0x00ef('0x73')]],'%s',_0x458961):_0x458961;_0x458961=_0x3ae9c7[_0x11a94b][_0x00ef('0x74')]?_[_0x00ef('0x72')](_0x19f89b[_0x3ae9c7[_0x11a94b][_0x00ef('0x74')]],'%s',_0x458961):_0x458961;if(_0x3ae9c7[_0x11a94b][_0x00ef('0x75')]){_0x2b234f[_0x00ef('0x76')](_0x458961);}_0x3ae9c7[_0x11a94b][_0x00ef('0x77')]&&_0x2b234f[_0x00ef('0x78')](_0x458961,_0x3ae9c7[_0x11a94b][_0x00ef('0x77')]==='DESC'?![]:!![]);_0x2b234f[_0x00ef('0x66')](_0x458961,_0x3ae9c7[_0x11a94b][_0x00ef('0x79')]||_0x458961);}if(_0x387907[_0x00ef('0x7a')]){_0x387907[_0x00ef('0x7a')]=JSON[_0x00ef('0x7b')](_0x387907[_0x00ef('0x7a')]);for(var _0x4abcca=0x0;_0x4abcca<_0x387907['joins'][_0x00ef('0x38')];_0x4abcca+=0x1){if(_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x2f')]&&_[_0x00ef('0x60')](_0x30fe1b,_0x387907['joins'][_0x4abcca]['type'])&&_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7c')]&&_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7d')]&&_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7e')]){_0x2b234f[_0x387907['joins'][_0x4abcca]['type']](_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7d')],null,util[_0x00ef('0x74')](_0x00ef('0x7f'),_0x387907[_0x00ef('0x70')],_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7c')],_0x387907['joins'][_0x4abcca][_0x00ef('0x7d')],_0x387907[_0x00ef('0x7a')][_0x4abcca][_0x00ef('0x7e')]));}}}if(_0x387907['conditions']){_0x387907[_0x00ef('0x80')]=JSON['parse'](_0x387907[_0x00ef('0x80')]);_0x2b234f[_0x00ef('0x3b')](_0x53828a(_0x387907[_0x00ef('0x80')][_0x00ef('0x76')]));}_0x3058e9=_0x2b234f[_0x00ef('0x81')]();_0x2b234f['limit'](_0x102903);_0x2b234f[_0x00ef('0x1c')](0x0);logger[_0x00ef('0x82')](_0x00ef('0x83'),_0x2b234f[_0x00ef('0x84')]());return db[_0x00ef('0x85')][_0x00ef('0x34')](_0x2b234f[_0x00ef('0x84')](),{'type':db[_0x00ef('0x85')][_0x00ef('0x86')][_0x00ef('0x87')]});}})['then'](respondWithResult(_0x31983e,null))[_0x00ef('0x43')](handleError(_0x31983e,null));};function runReport(_0x5d4962,_0x210fb5,_0x442472){var _0x42db3d=_0x210fb5[_0x00ef('0x2b')];var _0xa99f30=0xa;var _0x1a7751=[_0x00ef('0x88'),_0x00ef('0x51'),_0x00ef('0x52'),_0x00ef('0x53')];var _0x247141={'SUM':_0x00ef('0x54'),'COUNT':_0x00ef('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x00ef('0x56'),'MIN':_0x00ef('0x57'),'AVG':_0x00ef('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x00ef('0x8a')};var _0x45fbe4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x00ef('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30aa1f=function(_0xe8a407){return!_[_0x00ef('0x60')]([_0x00ef('0x8b'),_0x00ef('0x61'),_0x00ef('0x62'),'IS\x20NOT\x20EMPTY'],_0xe8a407);};var _0x1f5c49=function(_0x4d419c){if(!_0x4d419c||!_0x4d419c[_0x00ef('0x64')]['length']){return'';}for(var _0x101709='(',_0x14e270=0x0;_0x14e270<_0x4d419c[_0x00ef('0x64')][_0x00ef('0x38')];_0x14e270+=0x1){_0x14e270>0x0&&(_0x101709+='\x20'+_0x4d419c[_0x00ef('0x65')]+'\x20');_0x101709+=_0x4d419c['rules'][_0x14e270][_0x00ef('0x76')]?_0x1f5c49(_0x4d419c['rules'][_0x14e270]['group']):_0x4d419c[_0x00ef('0x64')][_0x14e270][_0x00ef('0x66')]+'\x20'+_0x4d419c[_0x00ef('0x64')][_0x14e270]['condition']+(_0x30aa1f(_0x4d419c['rules'][_0x14e270][_0x00ef('0x67')])?'\x20'+_0x4d419c['rules'][_0x14e270]['value']:'');}return _0x101709+')';};var _0x5773f6={'where':{'id':_0x5d4962['id']}},_0x279c8b,_0x52a717,_0x509833,_0x273315,_0x366706;_0x5773f6=_['merge']({},_0x5773f6,_0x442472);return db[_0x00ef('0x2d')][_0x00ef('0x47')](_0x5773f6)['then'](function(_0x95002f){if(_0x95002f){_0x279c8b=_0x95002f;return _0x95002f[_0x00ef('0x8c')]();}return null;})[_0x00ef('0x24')](function(_0x22e30b){if(_0x22e30b){if(!_0x22e30b[_0x00ef('0x38')]){throw new db['Sequelize'][(_0x00ef('0x6a'))](_0x00ef('0x6b'),0x193);}_0x52a717=_0x22e30b;return db[_0x00ef('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x00ef('0x24')](function(_0x25e757){if(_0x25e757){_0x509833=_[_0x00ef('0x6d')](_0x25e757,'id');var _0x33de48;var _0x9ea2e0=squel[_0x00ef('0x6e')]();_0x9ea2e0['from'](_0x279c8b[_0x00ef('0x70')]);for(var _0xbffeca=0x0;_0xbffeca<_0x52a717['length'];_0xbffeca+=0x1){_0x33de48=_0x52a717[_0xbffeca]['MetricId']?_0x509833[_0x52a717[_0xbffeca]['MetricId']][_0x00ef('0x8d')]:_0x52a717[_0xbffeca][_0x00ef('0x66')];_0x33de48=_0x52a717[_0xbffeca][_0x00ef('0x73')]?_[_0x00ef('0x72')](_0x247141[_0x52a717[_0xbffeca][_0x00ef('0x73')]],'%s',_0x33de48):_0x33de48;_0x33de48=_0x52a717[_0xbffeca][_0x00ef('0x74')]?_[_0x00ef('0x72')](_0x45fbe4[_0x52a717[_0xbffeca][_0x00ef('0x74')]],'%s',_0x33de48):_0x33de48;if(_0x52a717[_0xbffeca][_0x00ef('0x75')]){_0x9ea2e0[_0x00ef('0x76')](_0x33de48);}_0x52a717[_0xbffeca][_0x00ef('0x77')]&&_0x9ea2e0['order'](_0x33de48,_0x52a717[_0xbffeca][_0x00ef('0x77')]==='DESC'?![]:!![]);_0x9ea2e0[_0x00ef('0x66')](_0x33de48,_0x52a717[_0xbffeca][_0x00ef('0x79')]||_0x33de48);}if(_0x279c8b['joins']){_0x279c8b[_0x00ef('0x7a')]=JSON[_0x00ef('0x7b')](_0x279c8b[_0x00ef('0x7a')]);for(var _0x37abba=0x0;_0x37abba<_0x279c8b[_0x00ef('0x7a')][_0x00ef('0x38')];_0x37abba+=0x1){if(_0x279c8b[_0x00ef('0x7a')][_0x37abba][_0x00ef('0x2f')]&&_['includes'](_0x1a7751,_0x279c8b['joins'][_0x37abba][_0x00ef('0x2f')])&&_0x279c8b[_0x00ef('0x7a')][_0x37abba][_0x00ef('0x7c')]&&_0x279c8b[_0x00ef('0x7a')][_0x37abba]['foreignTable']&&_0x279c8b[_0x00ef('0x7a')][_0x37abba][_0x00ef('0x7e')]){_0x9ea2e0[_0x279c8b['joins'][_0x37abba]['type']](_0x279c8b[_0x00ef('0x7a')][_0x37abba][_0x00ef('0x7d')],null,util[_0x00ef('0x74')](_0x00ef('0x7f'),_0x279c8b[_0x00ef('0x70')],_0x279c8b[_0x00ef('0x7a')][_0x37abba][_0x00ef('0x7c')],_0x279c8b[_0x00ef('0x7a')][_0x37abba]['foreignTable'],_0x279c8b['joins'][_0x37abba]['foreignKey']));}}}if(_0x279c8b['conditions']){_0x279c8b['conditions']=JSON[_0x00ef('0x7b')](_0x279c8b[_0x00ef('0x80')]);_0x9ea2e0['where'](_0x1f5c49(_0x279c8b[_0x00ef('0x80')]['group']));}_0x366706=_0x9ea2e0['clone']();_0x9ea2e0[_0x00ef('0x1d')](_0xa99f30);_0x9ea2e0[_0x00ef('0x1c')](0x0);logger[_0x00ef('0x82')](_0x00ef('0x83'),_0x9ea2e0[_0x00ef('0x84')]());return db[_0x00ef('0x85')][_0x00ef('0x34')](_0x9ea2e0[_0x00ef('0x84')](),{'type':db[_0x00ef('0x85')][_0x00ef('0x86')][_0x00ef('0x87')]});}})['then'](function(_0xe8f5cf){if(!_0xe8f5cf[_0x00ef('0x38')]){throw new db['Sequelize'][(_0x00ef('0x6a'))](_0x00ef('0x8e'),0xcc);}if(_0x210fb5[_0x00ef('0x8f')]===_0x00ef('0x90')){return null;}var _0x5b40cd=_['merge'](_0x210fb5,{'name':_0x210fb5['fullPath']||_0x210fb5[_0x00ef('0x2b')]||_0x279c8b['name'],'basename':_0x42db3d,'savename':util[_0x00ef('0x74')](_0x00ef('0x91'),_0x210fb5['name']||_0x279c8b['name'],require(_0x00ef('0x92'))[_0x00ef('0x93')](0x4),_0x210fb5[_0x00ef('0x8f')]||_0x00ef('0x94')),'reportId':_0x279c8b['id'],'reportType':_0x00ef('0x95')});return db[_0x00ef('0x96')]['create'](_0x5b40cd,{'raw':!![]});})['then'](function(_0x25e8b7){if(_0x279c8b[_0x00ef('0x70')]===_0x00ef('0x97')){_0x366706[_0x00ef('0x3b')](_0x279c8b['table']+_0x00ef('0x98'),_0x210fb5[_0x00ef('0x99')],_0x210fb5[_0x00ef('0x9a')]);}else{_0x366706[_0x00ef('0x3b')](_0x279c8b['table']+_0x00ef('0x9b'),_0x210fb5[_0x00ef('0x99')],_0x210fb5[_0x00ef('0x9a')]);}if(_0x25e8b7){logger[_0x00ef('0x9c')](_0x00ef('0x9d'),_0x366706['toString']());require(_0x00ef('0x9e'))[_0x00ef('0x9f')](path[_0x00ef('0x88')](__dirname,_0x00ef('0xa0'),_0x25e8b7['output']),[_0x25e8b7['id'],_0x366706[_0x00ef('0x84')](),path[_0x00ef('0x88')](__dirname,_0x00ef('0xa1'),_0x25e8b7['savename']),_0x42db3d]);return _0x25e8b7;}else{var _0x2d8f12=squel['select']();_0x2d8f12[_0x00ef('0x6f')]('('+_0x366706[_0x00ef('0x84')]()+')',_0x00ef('0xa2'));_0x2d8f12['field']('COUNT(*)',_0x00ef('0x1b'));_0x366706[_0x00ef('0x1d')](_0x210fb5[_0x00ef('0x1d')]||_0xa99f30);_0x366706['offset'](_0x210fb5[_0x00ef('0x1c')]||0x0);return dbH[_0x00ef('0x85')][_0x00ef('0x34')](_0x2d8f12[_0x00ef('0x84')](),{'type':dbH['sequelize'][_0x00ef('0x86')][_0x00ef('0x87')]})['then'](function(_0xbdc975){if(!_0xbdc975[_0x00ef('0x38')]){_0x273315=0x0;}else{_0x273315=_0xbdc975[0x0][_0x00ef('0x1b')]||0x0;}return dbH['sequelize'][_0x00ef('0x34')](_0x366706[_0x00ef('0x84')](),{'type':dbH[_0x00ef('0x85')]['QueryTypes'][_0x00ef('0x87')]});})[_0x00ef('0x24')](function(_0xb11102){return{'rows':_0xb11102||[],'count':_0x273315};});}});}exports[_0x00ef('0xa3')]=function(_0x5dbec1,_0x47a378){return runReport(_0x5dbec1[_0x00ef('0x45')],_0x5dbec1[_0x00ef('0x34')],_0x5dbec1[_0x00ef('0x69')])['then'](respondWithResult(_0x47a378,null))[_0x00ef('0x43')](handleError(_0x47a378,null));};exports[_0x00ef('0xa4')]=runReport;exports['query']=function(_0x46804b,_0x4fe549){var _0x1f22b7=0xa;var _0x1043a1=[_0x00ef('0x88'),_0x00ef('0x51'),_0x00ef('0x52'),_0x00ef('0x53')];var _0x134062={'SUM':_0x00ef('0x54'),'COUNT':_0x00ef('0x89'),'COUNT DISTINCT':_0x00ef('0x55'),'MAX':_0x00ef('0x56'),'MIN':_0x00ef('0x57'),'AVG':_0x00ef('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x00ef('0x8a')};var _0x447447={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x00ef('0x5c'),'HOUR':_0x00ef('0x5d'),'ROUND':_0x00ef('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x354818=function(_0x5e08cd){return!_[_0x00ef('0x60')]([_0x00ef('0x8b'),_0x00ef('0x61'),'IS\x20EMPTY',_0x00ef('0x63')],_0x5e08cd);};var _0x26c2f0=function(_0x5a97b8){if(!_0x5a97b8||!_0x5a97b8[_0x00ef('0x64')]['length']){return'';}for(var _0x20fd57='(',_0x4fd829=0x0;_0x4fd829<_0x5a97b8[_0x00ef('0x64')]['length'];_0x4fd829+=0x1){_0x4fd829>0x0&&(_0x20fd57+='\x20'+_0x5a97b8[_0x00ef('0x65')]+'\x20');_0x20fd57+=_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x76')]?_0x26c2f0(_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x76')]):_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x66')]+'\x20'+_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x67')]+(_0x354818(_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x67')])?'\x20'+_0x5a97b8[_0x00ef('0x64')][_0x4fd829][_0x00ef('0x68')]:'');}return _0x20fd57+')';};var _0x4420c5={'where':{'id':_0x46804b[_0x00ef('0x45')]['id']}},_0x7c0e60,_0x356509,_0x4aa3ca,_0x24f672,_0x52759c;_0x4420c5=_['merge']({},_0x4420c5,_0x46804b[_0x00ef('0x69')]);return db[_0x00ef('0x2d')][_0x00ef('0x47')](_0x4420c5)['then'](function(_0x3c5ab4){if(_0x3c5ab4){_0x7c0e60=_0x3c5ab4;return _0x3c5ab4[_0x00ef('0x8c')]();}return null;})[_0x00ef('0x24')](function(_0x16007a){if(_0x16007a){if(!_0x16007a[_0x00ef('0x38')]){throw new db[(_0x00ef('0xa5'))][(_0x00ef('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x356509=_0x16007a;return db[_0x00ef('0x6c')][_0x00ef('0x41')]({'raw':!![]});}return null;})[_0x00ef('0x24')](function(_0x4ac3df){if(_0x4ac3df){_0x4aa3ca=_['keyBy'](_0x4ac3df,'id');var _0x6e3662;var _0x302737=squel[_0x00ef('0x6e')]();_0x302737['from'](_0x7c0e60[_0x00ef('0x70')]);for(var _0x3cd5f4=0x0;_0x3cd5f4<_0x356509[_0x00ef('0x38')];_0x3cd5f4+=0x1){_0x6e3662=_0x356509[_0x3cd5f4][_0x00ef('0x71')]?_0x4aa3ca[_0x356509[_0x3cd5f4][_0x00ef('0x71')]][_0x00ef('0x8d')]:_0x356509[_0x3cd5f4]['field'];_0x6e3662=_0x356509[_0x3cd5f4][_0x00ef('0x73')]?_[_0x00ef('0x72')](_0x134062[_0x356509[_0x3cd5f4][_0x00ef('0x73')]],'%s',_0x6e3662):_0x6e3662;_0x6e3662=_0x356509[_0x3cd5f4][_0x00ef('0x74')]?_[_0x00ef('0x72')](_0x447447[_0x356509[_0x3cd5f4][_0x00ef('0x74')]],'%s',_0x6e3662):_0x6e3662;if(_0x356509[_0x3cd5f4][_0x00ef('0x75')]){_0x302737[_0x00ef('0x76')](_0x6e3662);}_0x356509[_0x3cd5f4][_0x00ef('0x77')]&&_0x302737[_0x00ef('0x78')](_0x6e3662,_0x356509[_0x3cd5f4][_0x00ef('0x77')]===_0x00ef('0xa6')?![]:!![]);_0x302737[_0x00ef('0x66')](_0x6e3662,_0x356509[_0x3cd5f4][_0x00ef('0x79')]||_0x6e3662);}if(_0x7c0e60[_0x00ef('0x7a')]){_0x7c0e60['joins']=JSON[_0x00ef('0x7b')](_0x7c0e60[_0x00ef('0x7a')]);for(var _0x295727=0x0;_0x295727<_0x7c0e60['joins'][_0x00ef('0x38')];_0x295727+=0x1){if(_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x2f')]&&_[_0x00ef('0x60')](_0x1043a1,_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x2f')])&&_0x7c0e60['joins'][_0x295727][_0x00ef('0x7c')]&&_0x7c0e60[_0x00ef('0x7a')][_0x295727]['foreignTable']&&_0x7c0e60[_0x00ef('0x7a')][_0x295727]['foreignKey']){_0x302737[_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x2f')]](_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x7c0e60[_0x00ef('0x70')],_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x7c')],_0x7c0e60[_0x00ef('0x7a')][_0x295727][_0x00ef('0x7d')],_0x7c0e60['joins'][_0x295727][_0x00ef('0x7e')]));}}}if(_0x7c0e60[_0x00ef('0x80')]){_0x7c0e60[_0x00ef('0x80')]=JSON[_0x00ef('0x7b')](_0x7c0e60['conditions']);_0x302737[_0x00ef('0x3b')](_0x26c2f0(_0x7c0e60[_0x00ef('0x80')][_0x00ef('0x76')]));}_0x52759c=_0x302737[_0x00ef('0x81')]();_0x302737[_0x00ef('0x1d')](_0x1f22b7);_0x302737['offset'](0x0);logger[_0x00ef('0x82')](_0x00ef('0x83'),_0x302737[_0x00ef('0x84')]());return db['sequelize'][_0x00ef('0x34')](_0x302737[_0x00ef('0x84')](),{'type':db[_0x00ef('0x85')][_0x00ef('0x86')][_0x00ef('0x87')]});}})[_0x00ef('0x24')](function(){return{'sql':_0x52759c[_0x00ef('0x84')]()};})[_0x00ef('0x24')](respondWithResult(_0x4fe549,null))[_0x00ef('0x43')](handleError(_0x4fe549,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 32bd719..8ab18cf 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 _0x861d=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x861d,0x19a));var _0xd861=function(_0x53577d,_0x4c7f85){_0x53577d=_0x53577d-0x0;var _0x381c01=_0x861d[_0x53577d];return _0x381c01;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd861('0x0'))(_0xd861('0x1'));var moment=require(_0xd861('0x2'));var BPromise=require(_0xd861('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd861('0x4'));var config=require(_0xd861('0x5'));var attributes=require(_0xd861('0x6'));module[_0xd861('0x7')]=function(_0x24f6ef,_0x215122){return _0x24f6ef[_0xd861('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xd861('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8096=['path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9fcda5,_0x176845){var _0x2b61be=function(_0x45b279){while(--_0x45b279){_0x9fcda5['push'](_0x9fcda5['shift']());}};_0x2b61be(++_0x176845);}(_0x8096,0x166));var _0x6809=function(_0xd88ba8,_0x3b104b){_0xd88ba8=_0xd88ba8-0x0;var _0x596923=_0x8096[_0xd88ba8];return _0x596923;};'use strict';var _=require('lodash');var util=require(_0x6809('0x0'));var logger=require(_0x6809('0x1'))(_0x6809('0x2'));var moment=require(_0x6809('0x3'));var BPromise=require(_0x6809('0x4'));var rp=require(_0x6809('0x5'));var fs=require('fs');var path=require(_0x6809('0x6'));var rimraf=require(_0x6809('0x7'));var config=require(_0x6809('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x6809('0x9')]=function(_0x596e7c,_0x2a55a2){return _0x596e7c[_0x6809('0xa')](_0x6809('0xb'),attributes,{'tableName':_0x6809('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index fa3e4ce..df3bfd9 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 _0x26f9=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26f9,0x9e));var _0x926f=function(_0x489b4d,_0x4ddcbe){_0x489b4d=_0x489b4d-0x0;var _0x17f1ba=_0x26f9[_0x489b4d];return _0x17f1ba;};'use strict';var _=require('lodash');var util=require(_0x926f('0x0'));var moment=require(_0x926f('0x1'));var BPromise=require(_0x926f('0x2'));var rs=require(_0x926f('0x3'));var fs=require('fs');var Redis=require(_0x926f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x926f('0x5'));var logger=require(_0x926f('0x6'))(_0x926f('0x7'));var config=require('../../config/environment');var jayson=require(_0x926f('0x8'));var client=jayson[_0x926f('0x9')][_0x926f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c0924,_0x14decd,_0x53819f){return new BPromise(function(_0x339fea,_0x2fe249){return client[_0x926f('0xb')](_0x5c0924,_0x53819f)[_0x926f('0xc')](function(_0x5c2162){logger['info'](_0x926f('0xd'),_0x14decd,_0x926f('0xe'));logger[_0x926f('0xf')](_0x926f('0x10'),_0x14decd,_0x926f('0xe'),JSON[_0x926f('0x11')](_0x5c2162));if(_0x5c2162['error']){if(_0x5c2162[_0x926f('0x12')][_0x926f('0x13')]===0x1f4){logger[_0x926f('0x12')](_0x926f('0xd'),_0x14decd,_0x5c2162['error']['message']);return _0x2fe249(_0x5c2162[_0x926f('0x12')]['message']);}logger[_0x926f('0x12')](_0x926f('0xd'),_0x14decd,_0x5c2162[_0x926f('0x12')][_0x926f('0x14')]);return _0x339fea(_0x5c2162[_0x926f('0x12')][_0x926f('0x14')]);}else{logger[_0x926f('0x15')](_0x926f('0xd'),_0x14decd,_0x926f('0xe'));_0x339fea(_0x5c2162['result']['message']);}})[_0x926f('0x16')](function(_0x3f499f){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x14decd,_0x3f499f);_0x2fe249(_0x3f499f);});});} \ No newline at end of file +var _0x505e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x578c34,_0x562b9a){var _0x27035a=function(_0x570451){while(--_0x570451){_0x578c34['push'](_0x578c34['shift']());}};_0x27035a(++_0x562b9a);}(_0x505e,0x11f));var _0xe505=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x505e[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0xe505('0x0'));var util=require(_0xe505('0x1'));var moment=require(_0xe505('0x2'));var BPromise=require(_0xe505('0x3'));var rs=require(_0xe505('0x4'));var fs=require('fs');var Redis=require(_0xe505('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe505('0x6'))('rpc');var config=require(_0xe505('0x7'));var jayson=require(_0xe505('0x8'));var client=jayson['client'][_0xe505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd94c,_0x255113,_0x3f6e79){return new BPromise(function(_0x411ba0,_0x39efdc){return client['request'](_0x2cd94c,_0x3f6e79)[_0xe505('0xa')](function(_0x3cf717){logger[_0xe505('0xb')](_0xe505('0xc'),_0x255113,_0xe505('0xd'));logger[_0xe505('0xe')](_0xe505('0xf'),_0x255113,_0xe505('0xd'),JSON[_0xe505('0x10')](_0x3cf717));if(_0x3cf717[_0xe505('0x11')]){if(_0x3cf717[_0xe505('0x11')][_0xe505('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x255113,_0x3cf717[_0xe505('0x11')][_0xe505('0x13')]);return _0x39efdc(_0x3cf717[_0xe505('0x11')]['message']);}logger[_0xe505('0x11')](_0xe505('0xc'),_0x255113,_0x3cf717[_0xe505('0x11')][_0xe505('0x13')]);return _0x411ba0(_0x3cf717[_0xe505('0x11')][_0xe505('0x13')]);}else{logger[_0xe505('0xb')](_0xe505('0xc'),_0x255113,_0xe505('0xd'));_0x411ba0(_0x3cf717[_0xe505('0x14')][_0xe505('0x13')]);}})[_0xe505('0x15')](function(_0x179cb9){logger[_0xe505('0x11')](_0xe505('0xc'),_0x255113,_0x179cb9);_0x39efdc(_0x179cb9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c0dcf91..c2707dc 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 _0xcc7a=['/:id/query','query','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run'];(function(_0xffad61,_0x5f0282){var _0x33ef10=function(_0x54fde3){while(--_0x54fde3){_0xffad61['push'](_0xffad61['shift']());}};_0x33ef10(++_0x5f0282);}(_0xcc7a,0x1a9));var _0xacc7=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0xcc7a[_0x176d14];return _0x89522c;};'use strict';var multer=require(_0xacc7('0x0'));var util=require(_0xacc7('0x1'));var path=require(_0xacc7('0x2'));var timeout=require(_0xacc7('0x3'));var express=require('express');var router=express[_0xacc7('0x4')]();var auth=require(_0xacc7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xacc7('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xacc7('0x7')]('/',auth[_0xacc7('0x8')](),controller[_0xacc7('0x9')]);router[_0xacc7('0x7')](_0xacc7('0xa'),auth[_0xacc7('0x8')](),controller['show']);router[_0xacc7('0x7')](_0xacc7('0xb'),auth[_0xacc7('0x8')](),controller[_0xacc7('0xc')]);router[_0xacc7('0x7')](_0xacc7('0xd'),auth[_0xacc7('0x8')](),controller[_0xacc7('0xe')]);router['get'](_0xacc7('0xf'),auth[_0xacc7('0x8')](),controller[_0xacc7('0x10')]);router[_0xacc7('0x11')]('/',auth['isAuthenticated'](),controller[_0xacc7('0x12')]);router['put']('/:id',auth[_0xacc7('0x8')](),controller[_0xacc7('0x13')]);router[_0xacc7('0x14')](_0xacc7('0xa'),auth[_0xacc7('0x8')](),controller[_0xacc7('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbe87=['put','destroy','multer','connect-timeout','express','Router','../../config/environment','get','index','/:id','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create'];(function(_0x508f59,_0x4316e9){var _0xc1390=function(_0x2c86da){while(--_0x2c86da){_0x508f59['push'](_0x508f59['shift']());}};_0xc1390(++_0x4316e9);}(_0xbe87,0xd3));var _0x7be8=function(_0x59553b,_0x4d84b2){_0x59553b=_0x59553b-0x0;var _0x2ee019=_0xbe87[_0x59553b];return _0x2ee019;};'use strict';var multer=require(_0x7be8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7be8('0x1'));var express=require(_0x7be8('0x2'));var router=express[_0x7be8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7be8('0x4'));var controller=require('./analyticCustomReport.controller');router[_0x7be8('0x5')]('/',auth['isAuthenticated'](),controller[_0x7be8('0x6')]);router['get'](_0x7be8('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x7be8('0x5')](_0x7be8('0x8'),auth[_0x7be8('0x9')](),controller[_0x7be8('0xa')]);router['get'](_0x7be8('0xb'),auth[_0x7be8('0x9')](),controller[_0x7be8('0xc')]);router[_0x7be8('0x5')](_0x7be8('0xd'),auth[_0x7be8('0x9')](),controller[_0x7be8('0xe')]);router[_0x7be8('0xf')]('/',auth[_0x7be8('0x9')](),controller[_0x7be8('0x10')]);router[_0x7be8('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7be8('0x7'),auth['isAuthenticated'](),controller[_0x7be8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7d6605c..142b600 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 _0xb0ee=['STRING','TEXT','sequelize','exports'];(function(_0x219146,_0x4f999d){var _0x524e97=function(_0x1f81a0){while(--_0x1f81a0){_0x219146['push'](_0x219146['shift']());}};_0x524e97(++_0x4f999d);}(_0xb0ee,0x17e));var _0xeb0e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb0ee[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xeb0e('0x0'));module[_0xeb0e('0x1')]={'name':{'type':Sequelize[_0xeb0e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeb0e('0x2')]},'parent':{'type':Sequelize[_0xeb0e('0x2')]},'table':{'type':Sequelize[_0xeb0e('0x2')]},'conditions':{'type':Sequelize[_0xeb0e('0x3')]},'joins':{'type':Sequelize[_0xeb0e('0x3')]}}; \ No newline at end of file +var _0x9d86=['TEXT','exports','STRING'];(function(_0xdce4e3,_0x51f1b7){var _0x5a336c=function(_0x83a472){while(--_0x83a472){_0xdce4e3['push'](_0xdce4e3['shift']());}};_0x5a336c(++_0x51f1b7);}(_0x9d86,0x181));var _0x69d8=function(_0x3820a6,_0x5b41a0){_0x3820a6=_0x3820a6-0x0;var _0x13c29b=_0x9d86[_0x3820a6];return _0x13c29b;};'use strict';var Sequelize=require('sequelize');module[_0x69d8('0x0')]={'name':{'type':Sequelize[_0x69d8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x69d8('0x1')]},'conditions':{'type':Sequelize[_0x69d8('0x2')]},'joins':{'type':Sequelize[_0x69d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 84b2c40..8b32adf 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 _0x56eb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','name','AnalyticDefaultReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','groupBy','order','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20NULL','value','metric','orderBy','DESC','alias','toString','No\x20available\x20data','web','fullPath','%s-%s.%s','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','debug','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x26a84a,_0x16133f){var _0x2c5c57=function(_0x292dbd){while(--_0x292dbd){_0x26a84a['push'](_0x26a84a['shift']());}};_0x2c5c57(++_0x16133f);}(_0x56eb,0x93));var _0xb56e=function(_0x4cc5a0,_0x2687d5){_0x4cc5a0=_0x4cc5a0-0x0;var _0x2e318c=_0x56eb[_0x4cc5a0];return _0x2e318c;};'use strict';var pdf=require(_0xb56e('0x0'));var emlformat=require(_0xb56e('0x1'));var rimraf=require(_0xb56e('0x2'));var zipdir=require(_0xb56e('0x3'));var jsonpatch=require(_0xb56e('0x4'));var rp=require(_0xb56e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb56e('0x6'));var path=require('path');var sox=require(_0xb56e('0x7'));var csv=require(_0xb56e('0x8'));var ejs=require(_0xb56e('0x9'));var fs=require('fs');var _=require(_0xb56e('0xa'));var squel=require(_0xb56e('0xb'));var crypto=require(_0xb56e('0xc'));var jsforce=require(_0xb56e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb56e('0x8'));var querystring=require(_0xb56e('0xe'));var Papa=require(_0xb56e('0xf'));var Redis=require(_0xb56e('0x10'));var authService=require(_0xb56e('0x11'));var qs=require(_0xb56e('0x12'));var as=require(_0xb56e('0x13'));var hardwareService=require(_0xb56e('0x14'));var logger=require(_0xb56e('0x15'))(_0xb56e('0x16'));var utils=require('../../config/utils');var config=require(_0xb56e('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x5718a2,_0x5b8664){_0x5b8664=_0x5b8664||0xcc;return function(_0x458ae9){if(_0x458ae9){return _0x5718a2[_0xb56e('0x18')](_0x5b8664);}return _0x5718a2[_0xb56e('0x19')](_0x5b8664)[_0xb56e('0x1a')]();};}function respondWithResult(_0x3f7fe1,_0xf00691){_0xf00691=_0xf00691||0xc8;return function(_0x199791){if(_0x199791){return _0x3f7fe1[_0xb56e('0x19')](_0xf00691)[_0xb56e('0x1b')](_0x199791);}};}function respondWithFilteredResult(_0x5b8296,_0x10482e){return function(_0x5d9ba5){if(_0x5d9ba5){var _0x1aab89=_0x5d9ba5[_0xb56e('0x1c')],_0x549839=_0x10482e[_0xb56e('0x1d')],_0xbc1ac7=_0x10482e[_0xb56e('0x1d')]+_0x10482e[_0xb56e('0x1e')],_0x299e98;if(_0xbc1ac7>=_0x1aab89){_0xbc1ac7=_0x1aab89;_0x299e98=0xc8;}else{_0x299e98=0xce;}_0x5b8296[_0xb56e('0x19')](_0x299e98);return _0x5b8296['set'](_0xb56e('0x1f'),_0x549839+'-'+_0xbc1ac7+'/'+_0x1aab89)[_0xb56e('0x1b')](_0x5d9ba5);}return null;};}function patchUpdates(_0x2f68ac){return function(_0x38401d){try{jsonpatch[_0xb56e('0x20')](_0x38401d,_0x2f68ac,!![]);}catch(_0x4ae6b0){return BPromise[_0xb56e('0x21')](_0x4ae6b0);}return _0x38401d[_0xb56e('0x22')]();};}function saveUpdates(_0x173543,_0x1dc889){return function(_0x780248){if(_0x780248){return _0x780248[_0xb56e('0x23')](_0x173543)[_0xb56e('0x24')](function(_0x8e01e1){return _0x8e01e1;});}return null;};}function removeEntity(_0x5041f3,_0x106bfa){return function(_0x55b5f7){if(_0x55b5f7){return _0x55b5f7[_0xb56e('0x25')]()[_0xb56e('0x24')](function(){var _0x319187=_0x55b5f7[_0xb56e('0x26')]({'plain':!![]});var _0x5725ed=_0xb56e('0x27');return db[_0xb56e('0x28')][_0xb56e('0x25')]({'where':{'type':_0x5725ed,'resourceId':_0x319187['id']}})[_0xb56e('0x24')](function(){return _0x55b5f7;});})[_0xb56e('0x24')](function(){_0x5041f3[_0xb56e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8d06,_0x314428){return function(_0xd4eeae){if(!_0xd4eeae){_0x2a8d06[_0xb56e('0x18')](0x194);}return _0xd4eeae;};}function handleError(_0x214f6a,_0x3d29ca){_0x3d29ca=_0x3d29ca||0x1f4;return function(_0x1abca5){logger[_0xb56e('0x29')](_0x1abca5['stack']);if(_0x1abca5[_0xb56e('0x2a')]){delete _0x1abca5[_0xb56e('0x2a')];}_0x214f6a[_0xb56e('0x19')](_0x3d29ca)['send'](_0x1abca5);};}exports['index']=function(_0x352f73,_0xf15f8c){var _0x378419={},_0x166b2f={},_0x3c838a={'count':0x0,'rows':[]};var _0x148542=_['map'](db[_0xb56e('0x2b')][_0xb56e('0x2c')],function(_0x26a002){return{'name':_0x26a002['fieldName'],'type':_0x26a002[_0xb56e('0x2d')][_0xb56e('0x2e')]};});_0x166b2f[_0xb56e('0x2f')]=_[_0xb56e('0x30')](_0x148542,_0xb56e('0x2a'));_0x166b2f[_0xb56e('0x31')]=_[_0xb56e('0x32')](_0x352f73[_0xb56e('0x31')]);_0x166b2f[_0xb56e('0x33')]=_[_0xb56e('0x34')](_0x166b2f[_0xb56e('0x2f')],_0x166b2f['query']);_0x378419[_0xb56e('0x35')]=_[_0xb56e('0x34')](_0x166b2f[_0xb56e('0x2f')],qs['fields'](_0x352f73[_0xb56e('0x31')][_0xb56e('0x36')]));_0x378419[_0xb56e('0x35')]=_0x378419[_0xb56e('0x35')][_0xb56e('0x37')]?_0x378419[_0xb56e('0x35')]:_0x166b2f['model'];if(!_0x352f73[_0xb56e('0x31')][_0xb56e('0x38')](_0xb56e('0x39'))){_0x378419['limit']=qs[_0xb56e('0x1e')](_0x352f73[_0xb56e('0x31')][_0xb56e('0x1e')]);_0x378419[_0xb56e('0x1d')]=qs[_0xb56e('0x1d')](_0x352f73[_0xb56e('0x31')][_0xb56e('0x1d')]);}_0x378419['order']=qs[_0xb56e('0x3a')](_0x352f73[_0xb56e('0x31')]['sort']);_0x378419[_0xb56e('0x3b')]=qs[_0xb56e('0x33')](_[_0xb56e('0x3c')](_0x352f73[_0xb56e('0x31')],_0x166b2f['filters']),_0x148542);if(_0x352f73[_0xb56e('0x31')][_0xb56e('0x3d')]){_0x378419['where']=_[_0xb56e('0x3e')](_0x378419[_0xb56e('0x3b')],{'$or':_['map'](_0x148542,function(_0x414f26){if(_0x414f26[_0xb56e('0x2d')]!=='VIRTUAL'){var _0x17bc7a={};_0x17bc7a[_0x414f26[_0xb56e('0x2a')]]={'$like':'%'+_0x352f73[_0xb56e('0x31')][_0xb56e('0x3d')]+'%'};return _0x17bc7a;}})});}_0x378419=_[_0xb56e('0x3e')]({},_0x378419,_0x352f73['options']);var _0xd95e55={'where':_0x378419[_0xb56e('0x3b')]};return db[_0xb56e('0x2b')]['count'](_0xd95e55)[_0xb56e('0x24')](function(_0x5b5cad){_0x3c838a[_0xb56e('0x1c')]=_0x5b5cad;if(_0x352f73['query'][_0xb56e('0x3f')]){_0x378419[_0xb56e('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xb56e('0x41')](_0x378419);})[_0xb56e('0x24')](function(_0x29dd34){_0x3c838a[_0xb56e('0x42')]=_0x29dd34;return _0x3c838a;})[_0xb56e('0x24')](respondWithFilteredResult(_0xf15f8c,_0x378419))[_0xb56e('0x43')](handleError(_0xf15f8c,null));};exports[_0xb56e('0x44')]=function(_0x2e43e1,_0x3cc624){var _0x35fd33={'raw':!![],'where':{'id':_0x2e43e1[_0xb56e('0x45')]['id']}},_0x385da9={};_0x385da9[_0xb56e('0x2f')]=_[_0xb56e('0x32')](db[_0xb56e('0x2b')][_0xb56e('0x2c')]);_0x385da9[_0xb56e('0x31')]=_[_0xb56e('0x32')](_0x2e43e1['query']);_0x385da9[_0xb56e('0x33')]=_[_0xb56e('0x34')](_0x385da9[_0xb56e('0x2f')],_0x385da9[_0xb56e('0x31')]);_0x35fd33[_0xb56e('0x35')]=_[_0xb56e('0x34')](_0x385da9[_0xb56e('0x2f')],qs[_0xb56e('0x36')](_0x2e43e1['query'][_0xb56e('0x36')]));_0x35fd33['attributes']=_0x35fd33[_0xb56e('0x35')][_0xb56e('0x37')]?_0x35fd33[_0xb56e('0x35')]:_0x385da9['model'];if(_0x2e43e1[_0xb56e('0x31')]['includeAll']){_0x35fd33[_0xb56e('0x40')]=[{'all':!![]}];}_0x35fd33=_['merge']({},_0x35fd33,_0x2e43e1['options']);return db['AnalyticDefaultReport'][_0xb56e('0x46')](_0x35fd33)[_0xb56e('0x24')](handleEntityNotFound(_0x3cc624,null))[_0xb56e('0x24')](respondWithResult(_0x3cc624,null))[_0xb56e('0x43')](handleError(_0x3cc624,null));};exports[_0xb56e('0x47')]=function(_0x2c75b9,_0x46a781){return db[_0xb56e('0x2b')][_0xb56e('0x47')](_0x2c75b9[_0xb56e('0x48')],{})[_0xb56e('0x24')](function(_0x35042d){var _0x52793e=_0x2c75b9[_0xb56e('0x49')]['get']({'plain':!![]});if(!_0x52793e)throw new Error(_0xb56e('0x4a'));if(_0x52793e[_0xb56e('0x4b')]===_0xb56e('0x49')){var _0x480f82=_0x35042d['get']({'plain':!![]});var _0x24c077=_0xb56e('0x4c');return db['UserProfileSection'][_0xb56e('0x46')]({'where':{'name':_0x24c077,'userProfileId':_0x52793e[_0xb56e('0x4d')]},'raw':!![]})['then'](function(_0x4a117d){if(_0x4a117d&&_0x4a117d[_0xb56e('0x4e')]===0x0){return db[_0xb56e('0x28')][_0xb56e('0x47')]({'name':_0x480f82['name'],'resourceId':_0x480f82['id'],'type':_0xb56e('0x27'),'sectionId':_0x4a117d['id']},{})[_0xb56e('0x24')](function(){return _0x35042d;});}else{return _0x35042d;}})[_0xb56e('0x43')](function(_0x3fa72a){logger[_0xb56e('0x29')](_0xb56e('0x4f'),_0x3fa72a);throw _0x3fa72a;});}return _0x35042d;})[_0xb56e('0x24')](respondWithResult(_0x46a781,0xc9))[_0xb56e('0x43')](handleError(_0x46a781,null));};exports[_0xb56e('0x23')]=function(_0x4d9130,_0x5521d4){if(_0x4d9130['body']['id']){delete _0x4d9130[_0xb56e('0x48')]['id'];}return db[_0xb56e('0x2b')][_0xb56e('0x46')]({'where':{'id':_0x4d9130[_0xb56e('0x45')]['id']}})[_0xb56e('0x24')](handleEntityNotFound(_0x5521d4,null))[_0xb56e('0x24')](saveUpdates(_0x4d9130[_0xb56e('0x48')],null))[_0xb56e('0x24')](respondWithResult(_0x5521d4,null))[_0xb56e('0x43')](handleError(_0x5521d4,null));};exports[_0xb56e('0x25')]=function(_0x612a3e,_0x5bd2b8){return db[_0xb56e('0x2b')][_0xb56e('0x46')]({'where':{'id':_0x612a3e[_0xb56e('0x45')]['id']}})[_0xb56e('0x24')](handleEntityNotFound(_0x5bd2b8,null))['then'](removeEntity(_0x5bd2b8,null))[_0xb56e('0x43')](handleError(_0x5bd2b8,null));};exports['preview']=function(_0x477233,_0x3dfbcc){var _0x23423e=0xa;var _0x4c7a9e=[_0xb56e('0x50'),'left_join',_0xb56e('0x51'),_0xb56e('0x52')];var _0x29cfe4={'SUM':_0xb56e('0x53'),'COUNT':_0xb56e('0x54'),'COUNT DISTINCT':_0xb56e('0x55'),'MAX':_0xb56e('0x56'),'MIN':_0xb56e('0x57'),'AVG':_0xb56e('0x58'),'GROUP_CONCAT':_0xb56e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33403d={'SEC_TO_TIME':_0xb56e('0x5a'),'DATE':_0xb56e('0x5b'),'HOUR':_0xb56e('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb56e('0x5d')};var _0x110488=function(_0x4315a3){return!_[_0xb56e('0x5e')](['IS\x20NULL',_0xb56e('0x5f'),_0xb56e('0x60'),_0xb56e('0x61')],_0x4315a3);};var _0x14465d=function(_0x3c34b1){if(!_0x3c34b1||!_0x3c34b1[_0xb56e('0x62')][_0xb56e('0x37')]){return'';}for(var _0x3bd652='(',_0x2bff5a=0x0;_0x2bff5a<_0x3c34b1['rules']['length'];_0x2bff5a+=0x1){_0x2bff5a>0x0&&(_0x3bd652+='\x20'+_0x3c34b1[_0xb56e('0x63')]+'\x20');_0x3bd652+=_0x3c34b1[_0xb56e('0x62')][_0x2bff5a][_0xb56e('0x64')]?_0x14465d(_0x3c34b1[_0xb56e('0x62')][_0x2bff5a]['group']):_0x3c34b1['rules'][_0x2bff5a][_0xb56e('0x65')]+'\x20'+_0x3c34b1[_0xb56e('0x62')][_0x2bff5a][_0xb56e('0x66')]+(_0x110488(_0x3c34b1[_0xb56e('0x62')][_0x2bff5a][_0xb56e('0x66')])?'\x20'+_0x3c34b1[_0xb56e('0x62')][_0x2bff5a]['value']:'');}return _0x3bd652+')';};var _0x4d61d5={'where':{'id':_0x477233['params']['id']}},_0x24d6e9,_0x419133,_0xad7c52,_0x175aad,_0x44a0dc;_0x4d61d5=_[_0xb56e('0x3e')]({},_0x4d61d5,_0x477233[_0xb56e('0x67')]);return db[_0xb56e('0x2b')]['find'](_0x4d61d5)[_0xb56e('0x24')](function(_0x1de86a){if(_0x1de86a){_0x24d6e9=_0x1de86a;return _0x1de86a[_0xb56e('0x68')]();}return null;})['then'](function(_0x12722a){if(_0x12722a){if(!_0x12722a[_0xb56e('0x37')]){throw new db[(_0xb56e('0x69'))][(_0xb56e('0x6a'))](_0xb56e('0x6b'),0x193);}_0x419133=_0x12722a;return db[_0xb56e('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xb56e('0x24')](function(_0x40b1e0){if(_0x40b1e0){_0xad7c52=_[_0xb56e('0x6d')](_0x40b1e0,'id');var _0x158314;var _0x464ed7=squel[_0xb56e('0x6e')]();_0x464ed7[_0xb56e('0x6f')](_0x24d6e9[_0xb56e('0x70')]);for(var _0x5ccde0=0x0;_0x5ccde0<_0x419133[_0xb56e('0x37')];_0x5ccde0+=0x1){_0x158314=_0x419133[_0x5ccde0][_0xb56e('0x71')]?_0xad7c52[_0x419133[_0x5ccde0][_0xb56e('0x71')]]['metric']:_0x419133[_0x5ccde0][_0xb56e('0x65')];_0x158314=_0x419133[_0x5ccde0][_0xb56e('0x72')]?_['replace'](_0x29cfe4[_0x419133[_0x5ccde0][_0xb56e('0x72')]],'%s',_0x158314):_0x158314;_0x158314=_0x419133[_0x5ccde0]['format']?_[_0xb56e('0x73')](_0x33403d[_0x419133[_0x5ccde0]['format']],'%s',_0x158314):_0x158314;if(_0x419133[_0x5ccde0][_0xb56e('0x74')]){_0x464ed7[_0xb56e('0x64')](_0x158314);}_0x419133[_0x5ccde0]['orderBy']&&_0x464ed7[_0xb56e('0x75')](_0x158314,_0x419133[_0x5ccde0]['orderBy']==='DESC'?![]:!![]);_0x464ed7[_0xb56e('0x65')](_0x158314,_0x419133[_0x5ccde0]['alias']||_0x158314);}if(_0x24d6e9[_0xb56e('0x76')]){_0x24d6e9['joins']=JSON[_0xb56e('0x77')](_0x24d6e9[_0xb56e('0x76')]);for(var _0x42bd9b=0x0;_0x42bd9b<_0x24d6e9[_0xb56e('0x76')][_0xb56e('0x37')];_0x42bd9b+=0x1){if(_0x24d6e9[_0xb56e('0x76')][_0x42bd9b]['type']&&_[_0xb56e('0x5e')](_0x4c7a9e,_0x24d6e9[_0xb56e('0x76')][_0x42bd9b][_0xb56e('0x2d')])&&_0x24d6e9[_0xb56e('0x76')][_0x42bd9b][_0xb56e('0x78')]&&_0x24d6e9[_0xb56e('0x76')][_0x42bd9b][_0xb56e('0x79')]&&_0x24d6e9['joins'][_0x42bd9b][_0xb56e('0x7a')]){_0x464ed7[_0x24d6e9[_0xb56e('0x76')][_0x42bd9b][_0xb56e('0x2d')]](_0x24d6e9[_0xb56e('0x76')][_0x42bd9b]['foreignTable'],null,util[_0xb56e('0x7b')](_0xb56e('0x7c'),_0x24d6e9[_0xb56e('0x70')],_0x24d6e9[_0xb56e('0x76')][_0x42bd9b]['parentKey'],_0x24d6e9[_0xb56e('0x76')][_0x42bd9b]['foreignTable'],_0x24d6e9[_0xb56e('0x76')][_0x42bd9b]['foreignKey']));}}}if(_0x24d6e9[_0xb56e('0x7d')]){_0x24d6e9[_0xb56e('0x7d')]=JSON['parse'](_0x24d6e9[_0xb56e('0x7d')]);_0x464ed7[_0xb56e('0x3b')](_0x14465d(_0x24d6e9[_0xb56e('0x7d')][_0xb56e('0x64')]));}_0x44a0dc=_0x464ed7[_0xb56e('0x7e')]();_0x464ed7[_0xb56e('0x1e')](_0x23423e);_0x464ed7[_0xb56e('0x1d')](0x0);logger['debug'](_0xb56e('0x7f'),_0x464ed7['toString']());return db[_0xb56e('0x80')][_0xb56e('0x31')](_0x464ed7['toString'](),{'type':db['sequelize'][_0xb56e('0x81')][_0xb56e('0x82')]});}})['then'](respondWithResult(_0x3dfbcc,null))[_0xb56e('0x43')](handleError(_0x3dfbcc,null));};function runReport(_0xe8728,_0x13b861,_0x333d22){var _0x120ebb=_0x13b861[_0xb56e('0x2a')];var _0x539586=0xa;var _0x719396=[_0xb56e('0x50'),_0xb56e('0x83'),_0xb56e('0x51'),_0xb56e('0x52')];var _0x1a1fbc={'SUM':_0xb56e('0x53'),'COUNT':_0xb56e('0x54'),'COUNT DISTINCT':_0xb56e('0x55'),'MAX':'MAX(%s)','MIN':_0xb56e('0x57'),'AVG':_0xb56e('0x58'),'GROUP_CONCAT':_0xb56e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb56e('0x84')};var _0x3eb61c={'SEC_TO_TIME':_0xb56e('0x5a'),'DATE':_0xb56e('0x5b'),'HOUR':_0xb56e('0x5c'),'ROUND':_0xb56e('0x85'),'UNIX_TIMESTAMP':_0xb56e('0x5d')};var _0x3bfba8=function(_0x50f38f){return!_[_0xb56e('0x5e')]([_0xb56e('0x86'),_0xb56e('0x5f'),'IS\x20EMPTY',_0xb56e('0x61')],_0x50f38f);};var _0x136750=function(_0x396ece){if(!_0x396ece||!_0x396ece[_0xb56e('0x62')][_0xb56e('0x37')]){return'';}for(var _0x22c347='(',_0x1f257a=0x0;_0x1f257a<_0x396ece[_0xb56e('0x62')][_0xb56e('0x37')];_0x1f257a+=0x1){_0x1f257a>0x0&&(_0x22c347+='\x20'+_0x396ece[_0xb56e('0x63')]+'\x20');_0x22c347+=_0x396ece[_0xb56e('0x62')][_0x1f257a]['group']?_0x136750(_0x396ece['rules'][_0x1f257a][_0xb56e('0x64')]):_0x396ece[_0xb56e('0x62')][_0x1f257a][_0xb56e('0x65')]+'\x20'+_0x396ece[_0xb56e('0x62')][_0x1f257a]['condition']+(_0x3bfba8(_0x396ece[_0xb56e('0x62')][_0x1f257a][_0xb56e('0x66')])?'\x20'+_0x396ece[_0xb56e('0x62')][_0x1f257a][_0xb56e('0x87')]:'');}return _0x22c347+')';};var _0x11d6c0={'where':{'id':_0xe8728['id']}},_0x5c174f,_0x30f0a4,_0x2865d7,_0xf0e18f,_0x110a42;_0x11d6c0=_[_0xb56e('0x3e')]({},_0x11d6c0,_0x333d22);return db[_0xb56e('0x2b')][_0xb56e('0x46')](_0x11d6c0)['then'](function(_0x4ba3f0){if(_0x4ba3f0){_0x5c174f=_0x4ba3f0;return _0x4ba3f0[_0xb56e('0x68')]();}return null;})[_0xb56e('0x24')](function(_0x197b50){if(_0x197b50){if(!_0x197b50['length']){throw new db['Sequelize'][(_0xb56e('0x6a'))](_0xb56e('0x6b'),0x193);}_0x30f0a4=_0x197b50;return db[_0xb56e('0x6c')][_0xb56e('0x41')]({'raw':!![]});}return null;})['then'](function(_0x135df4){if(_0x135df4){_0x2865d7=_['keyBy'](_0x135df4,'id');var _0x155a80;var _0x22e333=squel['select']();_0x22e333[_0xb56e('0x6f')](_0x5c174f[_0xb56e('0x70')]);for(var _0x5e562b=0x0;_0x5e562b<_0x30f0a4[_0xb56e('0x37')];_0x5e562b+=0x1){_0x155a80=_0x30f0a4[_0x5e562b][_0xb56e('0x71')]?_0x2865d7[_0x30f0a4[_0x5e562b]['MetricId']][_0xb56e('0x88')]:_0x30f0a4[_0x5e562b]['field'];_0x155a80=_0x30f0a4[_0x5e562b]['function']?_[_0xb56e('0x73')](_0x1a1fbc[_0x30f0a4[_0x5e562b][_0xb56e('0x72')]],'%s',_0x155a80):_0x155a80;_0x155a80=_0x30f0a4[_0x5e562b][_0xb56e('0x7b')]?_[_0xb56e('0x73')](_0x3eb61c[_0x30f0a4[_0x5e562b]['format']],'%s',_0x155a80):_0x155a80;if(_0x30f0a4[_0x5e562b]['groupBy']){_0x22e333[_0xb56e('0x64')](_0x155a80);}_0x30f0a4[_0x5e562b][_0xb56e('0x89')]&&_0x22e333[_0xb56e('0x75')](_0x155a80,_0x30f0a4[_0x5e562b][_0xb56e('0x89')]===_0xb56e('0x8a')?![]:!![]);_0x22e333['field'](_0x155a80,_0x30f0a4[_0x5e562b][_0xb56e('0x8b')]||_0x155a80);}if(_0x5c174f[_0xb56e('0x76')]){_0x5c174f['joins']=JSON[_0xb56e('0x77')](_0x5c174f['joins']);for(var _0x340b1d=0x0;_0x340b1d<_0x5c174f[_0xb56e('0x76')]['length'];_0x340b1d+=0x1){if(_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x2d')]&&_[_0xb56e('0x5e')](_0x719396,_0x5c174f[_0xb56e('0x76')][_0x340b1d]['type'])&&_0x5c174f['joins'][_0x340b1d]['parentKey']&&_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x79')]&&_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x7a')]){_0x22e333[_0x5c174f['joins'][_0x340b1d][_0xb56e('0x2d')]](_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x79')],null,util[_0xb56e('0x7b')](_0xb56e('0x7c'),_0x5c174f[_0xb56e('0x70')],_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x78')],_0x5c174f[_0xb56e('0x76')][_0x340b1d][_0xb56e('0x79')],_0x5c174f['joins'][_0x340b1d][_0xb56e('0x7a')]));}}}if(_0x5c174f[_0xb56e('0x7d')]){_0x5c174f[_0xb56e('0x7d')]=JSON[_0xb56e('0x77')](_0x5c174f[_0xb56e('0x7d')]);_0x22e333[_0xb56e('0x3b')](_0x136750(_0x5c174f[_0xb56e('0x7d')][_0xb56e('0x64')]));}_0x110a42=_0x22e333[_0xb56e('0x7e')]();_0x22e333['limit'](_0x539586);_0x22e333[_0xb56e('0x1d')](0x0);logger['debug'](_0xb56e('0x7f'),_0x22e333[_0xb56e('0x8c')]());return db[_0xb56e('0x80')]['query'](_0x22e333[_0xb56e('0x8c')](),{'type':db[_0xb56e('0x80')][_0xb56e('0x81')][_0xb56e('0x82')]});}})['then'](function(_0xf0dfdd){if(!_0xf0dfdd[_0xb56e('0x37')]){throw new db[(_0xb56e('0x69'))]['ValidationErrorItem'](_0xb56e('0x8d'),0xcc);}if(_0x13b861['output']===_0xb56e('0x8e')){return null;}var _0x569081=_[_0xb56e('0x3e')](_0x13b861,{'name':_0x13b861[_0xb56e('0x8f')]||_0x13b861[_0xb56e('0x2a')]||_0x5c174f[_0xb56e('0x2a')],'basename':_0x120ebb,'savename':util[_0xb56e('0x7b')](_0xb56e('0x90'),_0x13b861['name']||_0x5c174f[_0xb56e('0x2a')],require('randomstring')[_0xb56e('0x91')](0x4),_0x13b861[_0xb56e('0x92')]||'csv'),'reportId':_0x5c174f['id'],'reportType':_0xb56e('0x93')});return db[_0xb56e('0x94')]['create'](_0x569081,{'raw':!![]});})['then'](function(_0x2736a3){if(_0x5c174f['table']===_0xb56e('0x95')){_0x110a42[_0xb56e('0x3b')](_0x5c174f[_0xb56e('0x70')]+_0xb56e('0x96'),_0x13b861[_0xb56e('0x97')],_0x13b861[_0xb56e('0x98')]);}else{_0x110a42[_0xb56e('0x3b')](_0x5c174f['table']+_0xb56e('0x99'),_0x13b861[_0xb56e('0x97')],_0x13b861[_0xb56e('0x98')]);}if(_0x2736a3){logger[_0xb56e('0x9a')](_0xb56e('0x9b'),_0x110a42[_0xb56e('0x8c')]());require(_0xb56e('0x9c'))[_0xb56e('0x9d')](path['join'](__dirname,_0xb56e('0x9e'),_0x2736a3['output']),[_0x2736a3['id'],_0x110a42[_0xb56e('0x8c')](),path[_0xb56e('0x50')](__dirname,'../../files/reports',_0x2736a3[_0xb56e('0x9f')]),_0x120ebb]);return _0x2736a3;}else{var _0x332dee=squel[_0xb56e('0x6e')]();_0x332dee[_0xb56e('0x6f')]('('+_0x110a42['toString']()+')',_0xb56e('0xa0'));_0x332dee[_0xb56e('0x65')](_0xb56e('0xa1'),_0xb56e('0x1c'));_0x110a42[_0xb56e('0x1e')](_0x13b861[_0xb56e('0x1e')]||_0x539586);_0x110a42[_0xb56e('0x1d')](_0x13b861['offset']||0x0);return dbH['sequelize'][_0xb56e('0x31')](_0x332dee[_0xb56e('0x8c')](),{'type':dbH[_0xb56e('0x80')][_0xb56e('0x81')][_0xb56e('0x82')]})['then'](function(_0x52f3b4){if(!_0x52f3b4['length']){_0xf0e18f=0x0;}else{_0xf0e18f=_0x52f3b4[0x0][_0xb56e('0x1c')]||0x0;}return dbH[_0xb56e('0x80')][_0xb56e('0x31')](_0x110a42['toString'](),{'type':dbH[_0xb56e('0x80')][_0xb56e('0x81')][_0xb56e('0x82')]});})[_0xb56e('0x24')](function(_0x42393e){return{'rows':_0x42393e||[],'count':_0xf0e18f};});}});}exports[_0xb56e('0xa2')]=function(_0x589519,_0x369e9a){return runReport(_0x589519['params'],_0x589519['query'],_0x589519['options'])[_0xb56e('0x24')](respondWithResult(_0x369e9a,null))['catch'](handleError(_0x369e9a,null));};exports['runReport']=runReport;exports[_0xb56e('0x31')]=function(_0x5c1280,_0x457e7c){var _0x4f74f7=0xa;var _0x5d8160=[_0xb56e('0x50'),_0xb56e('0x83'),_0xb56e('0x51'),'cross_join'];var _0x241582={'SUM':'SUM(%s)','COUNT':_0xb56e('0x54'),'COUNT DISTINCT':_0xb56e('0x55'),'MAX':_0xb56e('0x56'),'MIN':_0xb56e('0x57'),'AVG':_0xb56e('0x58'),'GROUP_CONCAT':_0xb56e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb56e('0x84')};var _0x4e4e18={'SEC_TO_TIME':_0xb56e('0x5a'),'DATE':_0xb56e('0x5b'),'HOUR':_0xb56e('0x5c'),'ROUND':_0xb56e('0x85'),'UNIX_TIMESTAMP':_0xb56e('0x5d')};var _0x2558b4=function(_0x1a2e3c){return!_[_0xb56e('0x5e')]([_0xb56e('0x86'),_0xb56e('0x5f'),'IS\x20EMPTY',_0xb56e('0x61')],_0x1a2e3c);};var _0x538793=function(_0x3a7dbc){if(!_0x3a7dbc||!_0x3a7dbc[_0xb56e('0x62')][_0xb56e('0x37')]){return'';}for(var _0x5ed66a='(',_0x5ab810=0x0;_0x5ab810<_0x3a7dbc[_0xb56e('0x62')]['length'];_0x5ab810+=0x1){_0x5ab810>0x0&&(_0x5ed66a+='\x20'+_0x3a7dbc['operator']+'\x20');_0x5ed66a+=_0x3a7dbc[_0xb56e('0x62')][_0x5ab810][_0xb56e('0x64')]?_0x538793(_0x3a7dbc[_0xb56e('0x62')][_0x5ab810][_0xb56e('0x64')]):_0x3a7dbc[_0xb56e('0x62')][_0x5ab810]['field']+'\x20'+_0x3a7dbc[_0xb56e('0x62')][_0x5ab810]['condition']+(_0x2558b4(_0x3a7dbc[_0xb56e('0x62')][_0x5ab810][_0xb56e('0x66')])?'\x20'+_0x3a7dbc[_0xb56e('0x62')][_0x5ab810][_0xb56e('0x87')]:'');}return _0x5ed66a+')';};var _0x37095a={'where':{'id':_0x5c1280[_0xb56e('0x45')]['id']}},_0x5f2acc,_0x451ec2,_0x162e09,_0x52f8ba,_0x5a5ef0;_0x37095a=_[_0xb56e('0x3e')]({},_0x37095a,_0x5c1280[_0xb56e('0x67')]);return db[_0xb56e('0x2b')][_0xb56e('0x46')](_0x37095a)['then'](function(_0x4d48c7){if(_0x4d48c7){_0x5f2acc=_0x4d48c7;return _0x4d48c7[_0xb56e('0x68')]();}return null;})[_0xb56e('0x24')](function(_0x1d5771){if(_0x1d5771){if(!_0x1d5771[_0xb56e('0x37')]){throw new db[(_0xb56e('0x69'))][(_0xb56e('0x6a'))](_0xb56e('0x6b'),0x193);}_0x451ec2=_0x1d5771;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xb56e('0x24')](function(_0x493dcf){if(_0x493dcf){_0x162e09=_[_0xb56e('0x6d')](_0x493dcf,'id');var _0x554b56;var _0x1d21d3=squel[_0xb56e('0x6e')]();_0x1d21d3[_0xb56e('0x6f')](_0x5f2acc[_0xb56e('0x70')]);for(var _0x3f588b=0x0;_0x3f588b<_0x451ec2[_0xb56e('0x37')];_0x3f588b+=0x1){_0x554b56=_0x451ec2[_0x3f588b][_0xb56e('0x71')]?_0x162e09[_0x451ec2[_0x3f588b][_0xb56e('0x71')]][_0xb56e('0x88')]:_0x451ec2[_0x3f588b][_0xb56e('0x65')];_0x554b56=_0x451ec2[_0x3f588b][_0xb56e('0x72')]?_[_0xb56e('0x73')](_0x241582[_0x451ec2[_0x3f588b]['function']],'%s',_0x554b56):_0x554b56;_0x554b56=_0x451ec2[_0x3f588b][_0xb56e('0x7b')]?_[_0xb56e('0x73')](_0x4e4e18[_0x451ec2[_0x3f588b][_0xb56e('0x7b')]],'%s',_0x554b56):_0x554b56;if(_0x451ec2[_0x3f588b][_0xb56e('0x74')]){_0x1d21d3[_0xb56e('0x64')](_0x554b56);}_0x451ec2[_0x3f588b][_0xb56e('0x89')]&&_0x1d21d3[_0xb56e('0x75')](_0x554b56,_0x451ec2[_0x3f588b][_0xb56e('0x89')]===_0xb56e('0x8a')?![]:!![]);_0x1d21d3[_0xb56e('0x65')](_0x554b56,_0x451ec2[_0x3f588b][_0xb56e('0x8b')]||_0x554b56);}if(_0x5f2acc[_0xb56e('0x76')]){_0x5f2acc[_0xb56e('0x76')]=JSON[_0xb56e('0x77')](_0x5f2acc['joins']);for(var _0x1df5aa=0x0;_0x1df5aa<_0x5f2acc[_0xb56e('0x76')]['length'];_0x1df5aa+=0x1){if(_0x5f2acc[_0xb56e('0x76')][_0x1df5aa][_0xb56e('0x2d')]&&_[_0xb56e('0x5e')](_0x5d8160,_0x5f2acc[_0xb56e('0x76')][_0x1df5aa]['type'])&&_0x5f2acc[_0xb56e('0x76')][_0x1df5aa][_0xb56e('0x78')]&&_0x5f2acc[_0xb56e('0x76')][_0x1df5aa]['foreignTable']&&_0x5f2acc[_0xb56e('0x76')][_0x1df5aa]['foreignKey']){_0x1d21d3[_0x5f2acc['joins'][_0x1df5aa][_0xb56e('0x2d')]](_0x5f2acc[_0xb56e('0x76')][_0x1df5aa][_0xb56e('0x79')],null,util[_0xb56e('0x7b')](_0xb56e('0x7c'),_0x5f2acc['table'],_0x5f2acc[_0xb56e('0x76')][_0x1df5aa][_0xb56e('0x78')],_0x5f2acc['joins'][_0x1df5aa]['foreignTable'],_0x5f2acc[_0xb56e('0x76')][_0x1df5aa]['foreignKey']));}}}if(_0x5f2acc[_0xb56e('0x7d')]){_0x5f2acc[_0xb56e('0x7d')]=JSON['parse'](_0x5f2acc[_0xb56e('0x7d')]);_0x1d21d3[_0xb56e('0x3b')](_0x538793(_0x5f2acc[_0xb56e('0x7d')][_0xb56e('0x64')]));}_0x5a5ef0=_0x1d21d3[_0xb56e('0x7e')]();_0x1d21d3[_0xb56e('0x1e')](_0x4f74f7);_0x1d21d3['offset'](0x0);logger[_0xb56e('0xa3')](_0xb56e('0x7f'),_0x1d21d3[_0xb56e('0x8c')]());return db[_0xb56e('0x80')][_0xb56e('0x31')](_0x1d21d3['toString'](),{'type':db['sequelize'][_0xb56e('0x81')]['SELECT']});}})['then'](function(){return{'sql':_0x5a5ef0[_0xb56e('0x8c')]()};})[_0xb56e('0x24')](respondWithResult(_0x457e7c,null))[_0xb56e('0x43')](handleError(_0x457e7c,null));}; \ No newline at end of file +var _0x4c2f=['count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','DefaultReports','UserProfileResource','end','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','value','getFields','Sequelize','keyBy','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','alias','parse','joins','includes','parentKey','foreignKey','foreignTable','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','COUNT(%s)','AVG(%s)','HOUR(%s)','IS\x20EMPTY','condition','ValidationErrorItem','AnalyticMetric','DESC','%s.%s\x20=\x20%s.%s','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','select','countTable','COUNT(*)','run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','zip-dir','moment','mustache','path','sox','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x4c2f,0x8a));var _0xf4c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c2f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf4c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf4c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf4c2('0x3'));var util=require('util');var path=require(_0xf4c2('0x4'));var sox=require(_0xf4c2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf4c2('0x6'));var crypto=require(_0xf4c2('0x7'));var jsforce=require(_0xf4c2('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xf4c2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf4c2('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xf4c2('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4c2('0xc'));var logger=require(_0xf4c2('0xd'))(_0xf4c2('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf4c2('0xf'))['db'];var dbH=require(_0xf4c2('0xf'))['dbH'];function respondWithStatusCode(_0x130150,_0x4379e2){_0x4379e2=_0x4379e2||0xcc;return function(_0x3cf99f){if(_0x3cf99f){return _0x130150[_0xf4c2('0x10')](_0x4379e2);}return _0x130150[_0xf4c2('0x11')](_0x4379e2)['end']();};}function respondWithResult(_0xb2649d,_0x515e29){_0x515e29=_0x515e29||0xc8;return function(_0x2abcf2){if(_0x2abcf2){return _0xb2649d[_0xf4c2('0x11')](_0x515e29)[_0xf4c2('0x12')](_0x2abcf2);}};}function respondWithFilteredResult(_0x25d6ca,_0x4a09b1){return function(_0x3fb852){if(_0x3fb852){var _0x5ed877=_0x3fb852[_0xf4c2('0x13')],_0x21c050=_0x4a09b1[_0xf4c2('0x14')],_0x17669f=_0x4a09b1[_0xf4c2('0x14')]+_0x4a09b1[_0xf4c2('0x15')],_0x351cba;if(_0x17669f>=_0x5ed877){_0x17669f=_0x5ed877;_0x351cba=0xc8;}else{_0x351cba=0xce;}_0x25d6ca['status'](_0x351cba);return _0x25d6ca['set'](_0xf4c2('0x16'),_0x21c050+'-'+_0x17669f+'/'+_0x5ed877)[_0xf4c2('0x12')](_0x3fb852);}return null;};}function patchUpdates(_0x1b4437){return function(_0x26074c){try{jsonpatch[_0xf4c2('0x17')](_0x26074c,_0x1b4437,!![]);}catch(_0x135333){return BPromise[_0xf4c2('0x18')](_0x135333);}return _0x26074c[_0xf4c2('0x19')]();};}function saveUpdates(_0x599aa3,_0x5ae8ac){return function(_0x31fafc){if(_0x31fafc){return _0x31fafc[_0xf4c2('0x1a')](_0x599aa3)['then'](function(_0x58e39c){return _0x58e39c;});}return null;};}function removeEntity(_0x55ca02,_0x56f3d9){return function(_0x139003){if(_0x139003){return _0x139003[_0xf4c2('0x1b')]()[_0xf4c2('0x1c')](function(){var _0x8c5ac5=_0x139003[_0xf4c2('0x1d')]({'plain':!![]});var _0x1322b8=_0xf4c2('0x1e');return db[_0xf4c2('0x1f')]['destroy']({'where':{'type':_0x1322b8,'resourceId':_0x8c5ac5['id']}})[_0xf4c2('0x1c')](function(){return _0x139003;});})[_0xf4c2('0x1c')](function(){_0x55ca02['status'](0xcc)[_0xf4c2('0x20')]();});}};}function handleEntityNotFound(_0x39b8d2,_0x2e3678){return function(_0x2cdba5){if(!_0x2cdba5){_0x39b8d2[_0xf4c2('0x10')](0x194);}return _0x2cdba5;};}function handleError(_0x5d2c45,_0x11cfb5){_0x11cfb5=_0x11cfb5||0x1f4;return function(_0x32d184){logger['error'](_0x32d184[_0xf4c2('0x21')]);if(_0x32d184[_0xf4c2('0x22')]){delete _0x32d184[_0xf4c2('0x22')];}_0x5d2c45[_0xf4c2('0x11')](_0x11cfb5)['send'](_0x32d184);};}exports[_0xf4c2('0x23')]=function(_0x1b3348,_0x4d3995){var _0x5c704a={},_0x1ea875={},_0x5d558d={'count':0x0,'rows':[]};var _0x388370=_[_0xf4c2('0x24')](db[_0xf4c2('0x25')][_0xf4c2('0x26')],function(_0x1ce3e3){return{'name':_0x1ce3e3[_0xf4c2('0x27')],'type':_0x1ce3e3[_0xf4c2('0x28')][_0xf4c2('0x29')]};});_0x1ea875[_0xf4c2('0x2a')]=_[_0xf4c2('0x24')](_0x388370,_0xf4c2('0x22'));_0x1ea875[_0xf4c2('0x2b')]=_[_0xf4c2('0x2c')](_0x1b3348['query']);_0x1ea875[_0xf4c2('0x2d')]=_[_0xf4c2('0x2e')](_0x1ea875['model'],_0x1ea875[_0xf4c2('0x2b')]);_0x5c704a[_0xf4c2('0x2f')]=_[_0xf4c2('0x2e')](_0x1ea875[_0xf4c2('0x2a')],qs[_0xf4c2('0x30')](_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x30')]));_0x5c704a[_0xf4c2('0x2f')]=_0x5c704a[_0xf4c2('0x2f')][_0xf4c2('0x31')]?_0x5c704a[_0xf4c2('0x2f')]:_0x1ea875[_0xf4c2('0x2a')];if(!_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x32')](_0xf4c2('0x33'))){_0x5c704a['limit']=qs['limit'](_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x15')]);_0x5c704a['offset']=qs[_0xf4c2('0x14')](_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x14')]);}_0x5c704a[_0xf4c2('0x34')]=qs[_0xf4c2('0x35')](_0x1b3348['query']['sort']);_0x5c704a[_0xf4c2('0x36')]=qs[_0xf4c2('0x2d')](_[_0xf4c2('0x37')](_0x1b3348[_0xf4c2('0x2b')],_0x1ea875[_0xf4c2('0x2d')]),_0x388370);if(_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x38')]){_0x5c704a[_0xf4c2('0x36')]=_[_0xf4c2('0x39')](_0x5c704a[_0xf4c2('0x36')],{'$or':_['map'](_0x388370,function(_0x4a3521){if(_0x4a3521[_0xf4c2('0x28')]!==_0xf4c2('0x3a')){var _0x28da10={};_0x28da10[_0x4a3521[_0xf4c2('0x22')]]={'$like':'%'+_0x1b3348[_0xf4c2('0x2b')]['filter']+'%'};return _0x28da10;}})});}_0x5c704a=_[_0xf4c2('0x39')]({},_0x5c704a,_0x1b3348[_0xf4c2('0x3b')]);var _0xaa3fc4={'where':_0x5c704a[_0xf4c2('0x36')]};return db[_0xf4c2('0x25')][_0xf4c2('0x13')](_0xaa3fc4)[_0xf4c2('0x1c')](function(_0x226146){_0x5d558d[_0xf4c2('0x13')]=_0x226146;if(_0x1b3348[_0xf4c2('0x2b')][_0xf4c2('0x3c')]){_0x5c704a[_0xf4c2('0x3d')]=[{'all':!![]}];}return db[_0xf4c2('0x25')][_0xf4c2('0x3e')](_0x5c704a);})['then'](function(_0x2c5796){_0x5d558d[_0xf4c2('0x3f')]=_0x2c5796;return _0x5d558d;})['then'](respondWithFilteredResult(_0x4d3995,_0x5c704a))[_0xf4c2('0x40')](handleError(_0x4d3995,null));};exports[_0xf4c2('0x41')]=function(_0x3738c1,_0x5475e8){var _0x5d3b50={'raw':!![],'where':{'id':_0x3738c1[_0xf4c2('0x42')]['id']}},_0x1cdb01={};_0x1cdb01['model']=_[_0xf4c2('0x2c')](db[_0xf4c2('0x25')][_0xf4c2('0x26')]);_0x1cdb01['query']=_[_0xf4c2('0x2c')](_0x3738c1['query']);_0x1cdb01[_0xf4c2('0x2d')]=_[_0xf4c2('0x2e')](_0x1cdb01[_0xf4c2('0x2a')],_0x1cdb01[_0xf4c2('0x2b')]);_0x5d3b50['attributes']=_['intersection'](_0x1cdb01[_0xf4c2('0x2a')],qs[_0xf4c2('0x30')](_0x3738c1['query']['fields']));_0x5d3b50[_0xf4c2('0x2f')]=_0x5d3b50[_0xf4c2('0x2f')]['length']?_0x5d3b50[_0xf4c2('0x2f')]:_0x1cdb01[_0xf4c2('0x2a')];if(_0x3738c1[_0xf4c2('0x2b')][_0xf4c2('0x3c')]){_0x5d3b50[_0xf4c2('0x3d')]=[{'all':!![]}];}_0x5d3b50=_[_0xf4c2('0x39')]({},_0x5d3b50,_0x3738c1[_0xf4c2('0x3b')]);return db[_0xf4c2('0x25')][_0xf4c2('0x43')](_0x5d3b50)[_0xf4c2('0x1c')](handleEntityNotFound(_0x5475e8,null))[_0xf4c2('0x1c')](respondWithResult(_0x5475e8,null))[_0xf4c2('0x40')](handleError(_0x5475e8,null));};exports[_0xf4c2('0x44')]=function(_0x3303b5,_0x155393){return db['AnalyticDefaultReport'][_0xf4c2('0x44')](_0x3303b5[_0xf4c2('0x45')],{})[_0xf4c2('0x1c')](function(_0x72e6f4){var _0x24e85c=_0x3303b5[_0xf4c2('0x46')][_0xf4c2('0x1d')]({'plain':!![]});if(!_0x24e85c)throw new Error(_0xf4c2('0x47'));if(_0x24e85c[_0xf4c2('0x48')]==='user'){var _0x5e150b=_0x72e6f4[_0xf4c2('0x1d')]({'plain':!![]});var _0x217efb=_0xf4c2('0x49');return db['UserProfileSection'][_0xf4c2('0x43')]({'where':{'name':_0x217efb,'userProfileId':_0x24e85c[_0xf4c2('0x4a')]},'raw':!![]})['then'](function(_0x199afe){if(_0x199afe&&_0x199afe['autoAssociation']===0x0){return db[_0xf4c2('0x1f')][_0xf4c2('0x44')]({'name':_0x5e150b[_0xf4c2('0x22')],'resourceId':_0x5e150b['id'],'type':'DefaultReports','sectionId':_0x199afe['id']},{})['then'](function(){return _0x72e6f4;});}else{return _0x72e6f4;}})['catch'](function(_0x4b33e6){logger[_0xf4c2('0x4b')](_0xf4c2('0x4c'),_0x4b33e6);throw _0x4b33e6;});}return _0x72e6f4;})[_0xf4c2('0x1c')](respondWithResult(_0x155393,0xc9))[_0xf4c2('0x40')](handleError(_0x155393,null));};exports[_0xf4c2('0x1a')]=function(_0xef1e5,_0x38c178){if(_0xef1e5[_0xf4c2('0x45')]['id']){delete _0xef1e5[_0xf4c2('0x45')]['id'];}return db[_0xf4c2('0x25')]['find']({'where':{'id':_0xef1e5[_0xf4c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x38c178,null))[_0xf4c2('0x1c')](saveUpdates(_0xef1e5['body'],null))[_0xf4c2('0x1c')](respondWithResult(_0x38c178,null))['catch'](handleError(_0x38c178,null));};exports[_0xf4c2('0x1b')]=function(_0x45e26f,_0x3264e3){return db[_0xf4c2('0x25')][_0xf4c2('0x43')]({'where':{'id':_0x45e26f[_0xf4c2('0x42')]['id']}})[_0xf4c2('0x1c')](handleEntityNotFound(_0x3264e3,null))['then'](removeEntity(_0x3264e3,null))[_0xf4c2('0x40')](handleError(_0x3264e3,null));};exports[_0xf4c2('0x4d')]=function(_0x44ab64,_0x1b4769){var _0x42167f=0xa;var _0x3d9bb1=[_0xf4c2('0x4e'),'left_join',_0xf4c2('0x4f'),_0xf4c2('0x50')];var _0x196638={'SUM':_0xf4c2('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf4c2('0x52'),'MAX':_0xf4c2('0x53'),'MIN':_0xf4c2('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf4c2('0x55'),'GROUP_CONCAT ASC':_0xf4c2('0x56'),'GROUP_CONCAT DESC':_0xf4c2('0x57')};var _0x437676={'SEC_TO_TIME':_0xf4c2('0x58'),'DATE':_0xf4c2('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf4c2('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x380adc=function(_0x55552e){return!_['includes']([_0xf4c2('0x5b'),_0xf4c2('0x5c'),'IS\x20EMPTY',_0xf4c2('0x5d')],_0x55552e);};var _0x407d18=function(_0x29dc06){if(!_0x29dc06||!_0x29dc06[_0xf4c2('0x5e')][_0xf4c2('0x31')]){return'';}for(var _0x37d4a1='(',_0x29caef=0x0;_0x29caef<_0x29dc06[_0xf4c2('0x5e')][_0xf4c2('0x31')];_0x29caef+=0x1){_0x29caef>0x0&&(_0x37d4a1+='\x20'+_0x29dc06[_0xf4c2('0x5f')]+'\x20');_0x37d4a1+=_0x29dc06[_0xf4c2('0x5e')][_0x29caef][_0xf4c2('0x60')]?_0x407d18(_0x29dc06[_0xf4c2('0x5e')][_0x29caef][_0xf4c2('0x60')]):_0x29dc06[_0xf4c2('0x5e')][_0x29caef]['field']+'\x20'+_0x29dc06['rules'][_0x29caef]['condition']+(_0x380adc(_0x29dc06[_0xf4c2('0x5e')][_0x29caef]['condition'])?'\x20'+_0x29dc06['rules'][_0x29caef][_0xf4c2('0x61')]:'');}return _0x37d4a1+')';};var _0x13c95d={'where':{'id':_0x44ab64[_0xf4c2('0x42')]['id']}},_0x309c3a,_0x5e2399,_0x41b42e,_0x14c91e,_0xb1d4b6;_0x13c95d=_[_0xf4c2('0x39')]({},_0x13c95d,_0x44ab64[_0xf4c2('0x3b')]);return db[_0xf4c2('0x25')][_0xf4c2('0x43')](_0x13c95d)[_0xf4c2('0x1c')](function(_0x1eaedb){if(_0x1eaedb){_0x309c3a=_0x1eaedb;return _0x1eaedb[_0xf4c2('0x62')]();}return null;})[_0xf4c2('0x1c')](function(_0x25e982){if(_0x25e982){if(!_0x25e982[_0xf4c2('0x31')]){throw new db[(_0xf4c2('0x63'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e2399=_0x25e982;return db['AnalyticMetric'][_0xf4c2('0x3e')]({'raw':!![]});}return null;})[_0xf4c2('0x1c')](function(_0x31e8d1){if(_0x31e8d1){_0x41b42e=_[_0xf4c2('0x64')](_0x31e8d1,'id');var _0xf0d3a5;var _0x328a80=squel['select']();_0x328a80[_0xf4c2('0x65')](_0x309c3a[_0xf4c2('0x66')]);for(var _0x4e5c17=0x0;_0x4e5c17<_0x5e2399['length'];_0x4e5c17+=0x1){_0xf0d3a5=_0x5e2399[_0x4e5c17][_0xf4c2('0x67')]?_0x41b42e[_0x5e2399[_0x4e5c17][_0xf4c2('0x67')]][_0xf4c2('0x68')]:_0x5e2399[_0x4e5c17][_0xf4c2('0x69')];_0xf0d3a5=_0x5e2399[_0x4e5c17][_0xf4c2('0x6a')]?_['replace'](_0x196638[_0x5e2399[_0x4e5c17]['function']],'%s',_0xf0d3a5):_0xf0d3a5;_0xf0d3a5=_0x5e2399[_0x4e5c17]['format']?_[_0xf4c2('0x6b')](_0x437676[_0x5e2399[_0x4e5c17][_0xf4c2('0x6c')]],'%s',_0xf0d3a5):_0xf0d3a5;if(_0x5e2399[_0x4e5c17][_0xf4c2('0x6d')]){_0x328a80[_0xf4c2('0x60')](_0xf0d3a5);}_0x5e2399[_0x4e5c17][_0xf4c2('0x6e')]&&_0x328a80[_0xf4c2('0x34')](_0xf0d3a5,_0x5e2399[_0x4e5c17][_0xf4c2('0x6e')]==='DESC'?![]:!![]);_0x328a80[_0xf4c2('0x69')](_0xf0d3a5,_0x5e2399[_0x4e5c17][_0xf4c2('0x6f')]||_0xf0d3a5);}if(_0x309c3a['joins']){_0x309c3a['joins']=JSON[_0xf4c2('0x70')](_0x309c3a[_0xf4c2('0x71')]);for(var _0x3ae15f=0x0;_0x3ae15f<_0x309c3a[_0xf4c2('0x71')][_0xf4c2('0x31')];_0x3ae15f+=0x1){if(_0x309c3a['joins'][_0x3ae15f][_0xf4c2('0x28')]&&_[_0xf4c2('0x72')](_0x3d9bb1,_0x309c3a[_0xf4c2('0x71')][_0x3ae15f]['type'])&&_0x309c3a['joins'][_0x3ae15f][_0xf4c2('0x73')]&&_0x309c3a['joins'][_0x3ae15f]['foreignTable']&&_0x309c3a[_0xf4c2('0x71')][_0x3ae15f][_0xf4c2('0x74')]){_0x328a80[_0x309c3a[_0xf4c2('0x71')][_0x3ae15f][_0xf4c2('0x28')]](_0x309c3a[_0xf4c2('0x71')][_0x3ae15f][_0xf4c2('0x75')],null,util[_0xf4c2('0x6c')]('%s.%s\x20=\x20%s.%s',_0x309c3a['table'],_0x309c3a['joins'][_0x3ae15f][_0xf4c2('0x73')],_0x309c3a[_0xf4c2('0x71')][_0x3ae15f][_0xf4c2('0x75')],_0x309c3a[_0xf4c2('0x71')][_0x3ae15f][_0xf4c2('0x74')]));}}}if(_0x309c3a[_0xf4c2('0x76')]){_0x309c3a['conditions']=JSON[_0xf4c2('0x70')](_0x309c3a[_0xf4c2('0x76')]);_0x328a80[_0xf4c2('0x36')](_0x407d18(_0x309c3a[_0xf4c2('0x76')][_0xf4c2('0x60')]));}_0xb1d4b6=_0x328a80[_0xf4c2('0x77')]();_0x328a80[_0xf4c2('0x15')](_0x42167f);_0x328a80['offset'](0x0);logger[_0xf4c2('0x78')](_0xf4c2('0x79'),_0x328a80['toString']());return db[_0xf4c2('0x7a')][_0xf4c2('0x2b')](_0x328a80[_0xf4c2('0x7b')](),{'type':db['sequelize'][_0xf4c2('0x7c')]['SELECT']});}})[_0xf4c2('0x1c')](respondWithResult(_0x1b4769,null))[_0xf4c2('0x40')](handleError(_0x1b4769,null));};function runReport(_0x426a70,_0x2be5e9,_0x6abd8d){var _0x8bddc2=_0x2be5e9[_0xf4c2('0x22')];var _0x4268b8=0xa;var _0xab9fdd=[_0xf4c2('0x4e'),_0xf4c2('0x7d'),'right_join',_0xf4c2('0x50')];var _0x62a342={'SUM':_0xf4c2('0x51'),'COUNT':_0xf4c2('0x7e'),'COUNT DISTINCT':_0xf4c2('0x52'),'MAX':_0xf4c2('0x53'),'MIN':_0xf4c2('0x54'),'AVG':_0xf4c2('0x7f'),'GROUP_CONCAT':_0xf4c2('0x55'),'GROUP_CONCAT ASC':_0xf4c2('0x56'),'GROUP_CONCAT DESC':_0xf4c2('0x57')};var _0x4a87ae={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf4c2('0x59'),'HOUR':_0xf4c2('0x80'),'ROUND':_0xf4c2('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1fa827=function(_0x353403){return!_[_0xf4c2('0x72')]([_0xf4c2('0x5b'),_0xf4c2('0x5c'),_0xf4c2('0x81'),_0xf4c2('0x5d')],_0x353403);};var _0x509376=function(_0xded31d){if(!_0xded31d||!_0xded31d[_0xf4c2('0x5e')]['length']){return'';}for(var _0x9e408b='(',_0x3f616c=0x0;_0x3f616c<_0xded31d[_0xf4c2('0x5e')]['length'];_0x3f616c+=0x1){_0x3f616c>0x0&&(_0x9e408b+='\x20'+_0xded31d[_0xf4c2('0x5f')]+'\x20');_0x9e408b+=_0xded31d['rules'][_0x3f616c]['group']?_0x509376(_0xded31d[_0xf4c2('0x5e')][_0x3f616c][_0xf4c2('0x60')]):_0xded31d[_0xf4c2('0x5e')][_0x3f616c][_0xf4c2('0x69')]+'\x20'+_0xded31d[_0xf4c2('0x5e')][_0x3f616c][_0xf4c2('0x82')]+(_0x1fa827(_0xded31d[_0xf4c2('0x5e')][_0x3f616c][_0xf4c2('0x82')])?'\x20'+_0xded31d[_0xf4c2('0x5e')][_0x3f616c][_0xf4c2('0x61')]:'');}return _0x9e408b+')';};var _0x326794={'where':{'id':_0x426a70['id']}},_0x1b75f0,_0x367a33,_0x4fb595,_0x381880,_0x52ae8a;_0x326794=_[_0xf4c2('0x39')]({},_0x326794,_0x6abd8d);return db[_0xf4c2('0x25')]['find'](_0x326794)[_0xf4c2('0x1c')](function(_0x38245e){if(_0x38245e){_0x1b75f0=_0x38245e;return _0x38245e[_0xf4c2('0x62')]();}return null;})['then'](function(_0x2081ea){if(_0x2081ea){if(!_0x2081ea[_0xf4c2('0x31')]){throw new db['Sequelize'][(_0xf4c2('0x83'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x367a33=_0x2081ea;return db[_0xf4c2('0x84')][_0xf4c2('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x1057cb){if(_0x1057cb){_0x4fb595=_[_0xf4c2('0x64')](_0x1057cb,'id');var _0x1ae066;var _0x2b6e45=squel['select']();_0x2b6e45[_0xf4c2('0x65')](_0x1b75f0['table']);for(var _0x5997b0=0x0;_0x5997b0<_0x367a33[_0xf4c2('0x31')];_0x5997b0+=0x1){_0x1ae066=_0x367a33[_0x5997b0][_0xf4c2('0x67')]?_0x4fb595[_0x367a33[_0x5997b0][_0xf4c2('0x67')]][_0xf4c2('0x68')]:_0x367a33[_0x5997b0][_0xf4c2('0x69')];_0x1ae066=_0x367a33[_0x5997b0][_0xf4c2('0x6a')]?_[_0xf4c2('0x6b')](_0x62a342[_0x367a33[_0x5997b0][_0xf4c2('0x6a')]],'%s',_0x1ae066):_0x1ae066;_0x1ae066=_0x367a33[_0x5997b0][_0xf4c2('0x6c')]?_['replace'](_0x4a87ae[_0x367a33[_0x5997b0]['format']],'%s',_0x1ae066):_0x1ae066;if(_0x367a33[_0x5997b0][_0xf4c2('0x6d')]){_0x2b6e45[_0xf4c2('0x60')](_0x1ae066);}_0x367a33[_0x5997b0][_0xf4c2('0x6e')]&&_0x2b6e45[_0xf4c2('0x34')](_0x1ae066,_0x367a33[_0x5997b0][_0xf4c2('0x6e')]===_0xf4c2('0x85')?![]:!![]);_0x2b6e45['field'](_0x1ae066,_0x367a33[_0x5997b0][_0xf4c2('0x6f')]||_0x1ae066);}if(_0x1b75f0[_0xf4c2('0x71')]){_0x1b75f0['joins']=JSON[_0xf4c2('0x70')](_0x1b75f0[_0xf4c2('0x71')]);for(var _0x2af58f=0x0;_0x2af58f<_0x1b75f0['joins']['length'];_0x2af58f+=0x1){if(_0x1b75f0['joins'][_0x2af58f][_0xf4c2('0x28')]&&_[_0xf4c2('0x72')](_0xab9fdd,_0x1b75f0[_0xf4c2('0x71')][_0x2af58f][_0xf4c2('0x28')])&&_0x1b75f0[_0xf4c2('0x71')][_0x2af58f][_0xf4c2('0x73')]&&_0x1b75f0['joins'][_0x2af58f][_0xf4c2('0x75')]&&_0x1b75f0[_0xf4c2('0x71')][_0x2af58f][_0xf4c2('0x74')]){_0x2b6e45[_0x1b75f0[_0xf4c2('0x71')][_0x2af58f]['type']](_0x1b75f0[_0xf4c2('0x71')][_0x2af58f]['foreignTable'],null,util[_0xf4c2('0x6c')](_0xf4c2('0x86'),_0x1b75f0[_0xf4c2('0x66')],_0x1b75f0[_0xf4c2('0x71')][_0x2af58f][_0xf4c2('0x73')],_0x1b75f0[_0xf4c2('0x71')][_0x2af58f]['foreignTable'],_0x1b75f0[_0xf4c2('0x71')][_0x2af58f]['foreignKey']));}}}if(_0x1b75f0[_0xf4c2('0x76')]){_0x1b75f0[_0xf4c2('0x76')]=JSON[_0xf4c2('0x70')](_0x1b75f0[_0xf4c2('0x76')]);_0x2b6e45[_0xf4c2('0x36')](_0x509376(_0x1b75f0['conditions'][_0xf4c2('0x60')]));}_0x52ae8a=_0x2b6e45[_0xf4c2('0x77')]();_0x2b6e45[_0xf4c2('0x15')](_0x4268b8);_0x2b6e45[_0xf4c2('0x14')](0x0);logger[_0xf4c2('0x78')](_0xf4c2('0x79'),_0x2b6e45['toString']());return db[_0xf4c2('0x7a')]['query'](_0x2b6e45[_0xf4c2('0x7b')](),{'type':db['sequelize'][_0xf4c2('0x7c')][_0xf4c2('0x87')]});}})[_0xf4c2('0x1c')](function(_0x3a693e){if(!_0x3a693e[_0xf4c2('0x31')]){throw new db['Sequelize']['ValidationErrorItem'](_0xf4c2('0x88'),0xcc);}if(_0x2be5e9[_0xf4c2('0x89')]===_0xf4c2('0x8a')){return null;}var _0x3e6804=_[_0xf4c2('0x39')](_0x2be5e9,{'name':_0x2be5e9[_0xf4c2('0x8b')]||_0x2be5e9[_0xf4c2('0x22')]||_0x1b75f0['name'],'basename':_0x8bddc2,'savename':util['format'](_0xf4c2('0x8c'),_0x2be5e9[_0xf4c2('0x22')]||_0x1b75f0[_0xf4c2('0x22')],require(_0xf4c2('0x8d'))['generate'](0x4),_0x2be5e9['output']||'csv'),'reportId':_0x1b75f0['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x3e6804,{'raw':!![]});})['then'](function(_0x48a148){if(_0x1b75f0[_0xf4c2('0x66')]===_0xf4c2('0x8e')){_0x52ae8a['where'](_0x1b75f0[_0xf4c2('0x66')]+_0xf4c2('0x8f'),_0x2be5e9[_0xf4c2('0x90')],_0x2be5e9['endDate']);}else{_0x52ae8a[_0xf4c2('0x36')](_0x1b75f0['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2be5e9[_0xf4c2('0x90')],_0x2be5e9[_0xf4c2('0x91')]);}if(_0x48a148){logger[_0xf4c2('0x92')](_0xf4c2('0x93'),_0x52ae8a[_0xf4c2('0x7b')]());require('child_process')[_0xf4c2('0x94')](path[_0xf4c2('0x4e')](__dirname,'../../components/export/',_0x48a148[_0xf4c2('0x89')]),[_0x48a148['id'],_0x52ae8a[_0xf4c2('0x7b')](),path[_0xf4c2('0x4e')](__dirname,_0xf4c2('0x95'),_0x48a148[_0xf4c2('0x96')]),_0x8bddc2]);return _0x48a148;}else{var _0x44244f=squel[_0xf4c2('0x97')]();_0x44244f['from']('('+_0x52ae8a[_0xf4c2('0x7b')]()+')',_0xf4c2('0x98'));_0x44244f[_0xf4c2('0x69')](_0xf4c2('0x99'),_0xf4c2('0x13'));_0x52ae8a[_0xf4c2('0x15')](_0x2be5e9[_0xf4c2('0x15')]||_0x4268b8);_0x52ae8a[_0xf4c2('0x14')](_0x2be5e9[_0xf4c2('0x14')]||0x0);return dbH['sequelize']['query'](_0x44244f[_0xf4c2('0x7b')](),{'type':dbH[_0xf4c2('0x7a')][_0xf4c2('0x7c')][_0xf4c2('0x87')]})[_0xf4c2('0x1c')](function(_0x457549){if(!_0x457549[_0xf4c2('0x31')]){_0x381880=0x0;}else{_0x381880=_0x457549[0x0]['count']||0x0;}return dbH[_0xf4c2('0x7a')][_0xf4c2('0x2b')](_0x52ae8a['toString'](),{'type':dbH[_0xf4c2('0x7a')][_0xf4c2('0x7c')]['SELECT']});})[_0xf4c2('0x1c')](function(_0x3341d2){return{'rows':_0x3341d2||[],'count':_0x381880};});}});}exports[_0xf4c2('0x9a')]=function(_0x251709,_0x2c8428){return runReport(_0x251709[_0xf4c2('0x42')],_0x251709[_0xf4c2('0x2b')],_0x251709[_0xf4c2('0x3b')])[_0xf4c2('0x1c')](respondWithResult(_0x2c8428,null))['catch'](handleError(_0x2c8428,null));};exports[_0xf4c2('0x9b')]=runReport;exports[_0xf4c2('0x2b')]=function(_0x29c678,_0x593fd4){var _0x2261bf=0xa;var _0x1e30fd=['join',_0xf4c2('0x7d'),'right_join','cross_join'];var _0x14d91d={'SUM':_0xf4c2('0x51'),'COUNT':_0xf4c2('0x7e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf4c2('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf4c2('0x56'),'GROUP_CONCAT DESC':_0xf4c2('0x57')};var _0x54b7e3={'SEC_TO_TIME':_0xf4c2('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd7e9b3=function(_0x208559){return!_[_0xf4c2('0x72')](['IS\x20NULL',_0xf4c2('0x5c'),'IS\x20EMPTY',_0xf4c2('0x5d')],_0x208559);};var _0x5b5613=function(_0x2350e4){if(!_0x2350e4||!_0x2350e4[_0xf4c2('0x5e')][_0xf4c2('0x31')]){return'';}for(var _0xdc539='(',_0x20ef2b=0x0;_0x20ef2b<_0x2350e4[_0xf4c2('0x5e')]['length'];_0x20ef2b+=0x1){_0x20ef2b>0x0&&(_0xdc539+='\x20'+_0x2350e4[_0xf4c2('0x5f')]+'\x20');_0xdc539+=_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x60')]?_0x5b5613(_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x60')]):_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x69')]+'\x20'+_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x82')]+(_0xd7e9b3(_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x82')])?'\x20'+_0x2350e4[_0xf4c2('0x5e')][_0x20ef2b][_0xf4c2('0x61')]:'');}return _0xdc539+')';};var _0x4caa70={'where':{'id':_0x29c678['params']['id']}},_0x63f645,_0x54c2bd,_0x2cb723,_0x18bedf,_0x50d73f;_0x4caa70=_[_0xf4c2('0x39')]({},_0x4caa70,_0x29c678[_0xf4c2('0x3b')]);return db[_0xf4c2('0x25')][_0xf4c2('0x43')](_0x4caa70)['then'](function(_0x2ab815){if(_0x2ab815){_0x63f645=_0x2ab815;return _0x2ab815[_0xf4c2('0x62')]();}return null;})[_0xf4c2('0x1c')](function(_0x4e2d10){if(_0x4e2d10){if(!_0x4e2d10[_0xf4c2('0x31')]){throw new db[(_0xf4c2('0x63'))][(_0xf4c2('0x83'))](_0xf4c2('0x9c'),0x193);}_0x54c2bd=_0x4e2d10;return db[_0xf4c2('0x84')]['findAll']({'raw':!![]});}return null;})[_0xf4c2('0x1c')](function(_0x56efbb){if(_0x56efbb){_0x2cb723=_['keyBy'](_0x56efbb,'id');var _0x428c4d;var _0x141288=squel[_0xf4c2('0x97')]();_0x141288[_0xf4c2('0x65')](_0x63f645['table']);for(var _0x39ed56=0x0;_0x39ed56<_0x54c2bd[_0xf4c2('0x31')];_0x39ed56+=0x1){_0x428c4d=_0x54c2bd[_0x39ed56][_0xf4c2('0x67')]?_0x2cb723[_0x54c2bd[_0x39ed56][_0xf4c2('0x67')]]['metric']:_0x54c2bd[_0x39ed56][_0xf4c2('0x69')];_0x428c4d=_0x54c2bd[_0x39ed56][_0xf4c2('0x6a')]?_[_0xf4c2('0x6b')](_0x14d91d[_0x54c2bd[_0x39ed56][_0xf4c2('0x6a')]],'%s',_0x428c4d):_0x428c4d;_0x428c4d=_0x54c2bd[_0x39ed56][_0xf4c2('0x6c')]?_['replace'](_0x54b7e3[_0x54c2bd[_0x39ed56][_0xf4c2('0x6c')]],'%s',_0x428c4d):_0x428c4d;if(_0x54c2bd[_0x39ed56][_0xf4c2('0x6d')]){_0x141288[_0xf4c2('0x60')](_0x428c4d);}_0x54c2bd[_0x39ed56][_0xf4c2('0x6e')]&&_0x141288[_0xf4c2('0x34')](_0x428c4d,_0x54c2bd[_0x39ed56][_0xf4c2('0x6e')]===_0xf4c2('0x85')?![]:!![]);_0x141288[_0xf4c2('0x69')](_0x428c4d,_0x54c2bd[_0x39ed56]['alias']||_0x428c4d);}if(_0x63f645[_0xf4c2('0x71')]){_0x63f645[_0xf4c2('0x71')]=JSON[_0xf4c2('0x70')](_0x63f645['joins']);for(var _0x4c6711=0x0;_0x4c6711<_0x63f645[_0xf4c2('0x71')][_0xf4c2('0x31')];_0x4c6711+=0x1){if(_0x63f645[_0xf4c2('0x71')][_0x4c6711][_0xf4c2('0x28')]&&_[_0xf4c2('0x72')](_0x1e30fd,_0x63f645[_0xf4c2('0x71')][_0x4c6711][_0xf4c2('0x28')])&&_0x63f645['joins'][_0x4c6711][_0xf4c2('0x73')]&&_0x63f645[_0xf4c2('0x71')][_0x4c6711][_0xf4c2('0x75')]&&_0x63f645['joins'][_0x4c6711]['foreignKey']){_0x141288[_0x63f645[_0xf4c2('0x71')][_0x4c6711]['type']](_0x63f645['joins'][_0x4c6711][_0xf4c2('0x75')],null,util[_0xf4c2('0x6c')](_0xf4c2('0x86'),_0x63f645[_0xf4c2('0x66')],_0x63f645[_0xf4c2('0x71')][_0x4c6711]['parentKey'],_0x63f645[_0xf4c2('0x71')][_0x4c6711][_0xf4c2('0x75')],_0x63f645[_0xf4c2('0x71')][_0x4c6711]['foreignKey']));}}}if(_0x63f645[_0xf4c2('0x76')]){_0x63f645[_0xf4c2('0x76')]=JSON[_0xf4c2('0x70')](_0x63f645[_0xf4c2('0x76')]);_0x141288[_0xf4c2('0x36')](_0x5b5613(_0x63f645[_0xf4c2('0x76')][_0xf4c2('0x60')]));}_0x50d73f=_0x141288[_0xf4c2('0x77')]();_0x141288[_0xf4c2('0x15')](_0x2261bf);_0x141288[_0xf4c2('0x14')](0x0);logger['debug'](_0xf4c2('0x79'),_0x141288[_0xf4c2('0x7b')]());return db[_0xf4c2('0x7a')]['query'](_0x141288[_0xf4c2('0x7b')](),{'type':db[_0xf4c2('0x7a')][_0xf4c2('0x7c')][_0xf4c2('0x87')]});}})[_0xf4c2('0x1c')](function(){return{'sql':_0x50d73f[_0xf4c2('0x7b')]()};})['then'](respondWithResult(_0x593fd4,null))['catch'](handleError(_0x593fd4,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5ac6c7b..ac9a7bc 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x5b3ad2,_0x25c948){var _0x3a78c2=function(_0x28ec22){while(--_0x28ec22){_0x5b3ad2['push'](_0x5b3ad2['shift']());}};_0x3a78c2(++_0x25c948);}(_0xdb28,0x106));var _0x8db2=function(_0x38334b,_0x1dab28){_0x38334b=_0x38334b-0x0;var _0xd175ab=_0xdb28[_0x38334b];return _0xd175ab;};'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('./analyticDefaultReport.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 _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x94ff8a,_0x3b9639){var _0x439799=function(_0x2ae57){while(--_0x2ae57){_0x94ff8a['push'](_0x94ff8a['shift']());}};_0x439799(++_0x3b9639);}(_0x53ec,0x192));var _0xc53e=function(_0x33ccaf,_0x192235){_0x33ccaf=_0x33ccaf-0x0;var _0x30abf6=_0x53ec[_0x33ccaf];return _0x30abf6;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 989e08a..a95a7aa 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 _0xcffe=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x40662e,_0x27f841){var _0x1a0710=function(_0xef1fec){while(--_0xef1fec){_0x40662e['push'](_0x40662e['shift']());}};_0x1a0710(++_0x27f841);}(_0xcffe,0x1a1));var _0xecff=function(_0x3f7e8b,_0x7291d1){_0x3f7e8b=_0x3f7e8b-0x0;var _0x4eb892=_0xcffe[_0x3f7e8b];return _0x4eb892;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2fa9,_0x38a8f6,_0x50c98b){return new BPromise(function(_0x298c19,_0x1f7386){return client['request'](_0x2e2fa9,_0x50c98b)[_0xecff('0xc')](function(_0x3eefb9){logger[_0xecff('0xd')](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));logger['debug'](_0xecff('0x10'),_0x38a8f6,_0xecff('0xf'),JSON[_0xecff('0x11')](_0x3eefb9));if(_0x3eefb9[_0xecff('0x12')]){if(_0x3eefb9[_0xecff('0x12')][_0xecff('0x13')]===0x1f4){logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);return _0x1f7386(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9['error']['message']);return _0x298c19(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}else{logger['info'](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));_0x298c19(_0x3eefb9[_0xecff('0x15')]['message']);}})['catch'](function(_0x24abef){logger[_0xecff('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x38a8f6,_0x24abef);_0x1f7386(_0x24abef);});});} \ No newline at end of file +var _0x21a3=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4793cd,_0x2b5568){var _0x502813=function(_0x39bfb9){while(--_0x39bfb9){_0x4793cd['push'](_0x4793cd['shift']());}};_0x502813(++_0x2b5568);}(_0x21a3,0x66));var _0x321a=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x21a3[_0x3e0b8f];return _0x22f742;};'use strict';var _=require(_0x321a('0x0'));var util=require('util');var moment=require(_0x321a('0x1'));var BPromise=require(_0x321a('0x2'));var rs=require(_0x321a('0x3'));var fs=require('fs');var Redis=require(_0x321a('0x4'));var db=require(_0x321a('0x5'))['db'];var utils=require(_0x321a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x321a('0x7'));var jayson=require(_0x321a('0x8'));var client=jayson[_0x321a('0x9')][_0x321a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3b81,_0x388901,_0x24a04c){return new BPromise(function(_0x10c1d3,_0xdfd6b8){return client[_0x321a('0xb')](_0x5f3b81,_0x24a04c)[_0x321a('0xc')](function(_0x2c52dc){logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,_0x321a('0xf'));logger[_0x321a('0x10')](_0x321a('0x11'),_0x388901,'request\x20sent',JSON[_0x321a('0x12')](_0x2c52dc));if(_0x2c52dc[_0x321a('0x13')]){if(_0x2c52dc['error']['code']===0x1f4){logger[_0x321a('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0xdfd6b8(_0x2c52dc['error']['message']);}logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0x10c1d3(_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);}else{logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,'request\x20sent');_0x10c1d3(_0x2c52dc[_0x321a('0x15')][_0x321a('0x14')]);}})['catch'](function(_0x45ceb2){logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x45ceb2);_0xdfd6b8(_0x45ceb2);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a554da9..62ba217 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 _0x6253=['show','/:id/preview','/:id/run','/:id/query','query','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6253,0x199));var _0x3625=function(_0x3cbfb4,_0xfbb3bd){_0x3cbfb4=_0x3cbfb4-0x0;var _0x5b7995=_0x6253[_0x3cbfb4];return _0x5b7995;};'use strict';var multer=require(_0x3625('0x0'));var util=require(_0x3625('0x1'));var path=require(_0x3625('0x2'));var timeout=require(_0x3625('0x3'));var express=require('express');var router=express[_0x3625('0x4')]();var auth=require(_0x3625('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3625('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x3625('0x7')]('/',auth[_0x3625('0x8')](),controller[_0x3625('0x9')]);router[_0x3625('0x7')](_0x3625('0xa'),auth['isAuthenticated'](),controller[_0x3625('0xb')]);router[_0x3625('0x7')](_0x3625('0xc'),auth[_0x3625('0x8')](),controller['preview']);router[_0x3625('0x7')](_0x3625('0xd'),auth[_0x3625('0x8')](),controller['run']);router['get'](_0x3625('0xe'),auth[_0x3625('0x8')](),controller[_0x3625('0xf')]);router['post']('/',auth[_0x3625('0x8')](),controller[_0x3625('0x10')]);router[_0x3625('0x11')](_0x3625('0xa'),auth[_0x3625('0x8')](),controller[_0x3625('0x12')]);router[_0x3625('0x13')](_0x3625('0xa'),auth[_0x3625('0x8')](),controller['destroy']);module[_0x3625('0x14')]=router; \ No newline at end of file +var _0x9dde=['isAuthenticated','index','show','/:id/preview','preview','run','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x35e0e7,_0x5d159f){var _0x4e1ccd=function(_0x125d9d){while(--_0x125d9d){_0x35e0e7['push'](_0x35e0e7['shift']());}};_0x4e1ccd(++_0x5d159f);}(_0x9dde,0x18d));var _0xe9dd=function(_0x33bf0f,_0x3a5c5c){_0x33bf0f=_0x33bf0f-0x0;var _0x29400e=_0x9dde[_0x33bf0f];return _0x29400e;};'use strict';var multer=require(_0xe9dd('0x0'));var util=require(_0xe9dd('0x1'));var path=require(_0xe9dd('0x2'));var timeout=require(_0xe9dd('0x3'));var express=require(_0xe9dd('0x4'));var router=express[_0xe9dd('0x5')]();var auth=require(_0xe9dd('0x6'));var interaction=require(_0xe9dd('0x7'));var config=require(_0xe9dd('0x8'));var controller=require(_0xe9dd('0x9'));router[_0xe9dd('0xa')]('/',auth[_0xe9dd('0xb')](),controller[_0xe9dd('0xc')]);router[_0xe9dd('0xa')]('/:id',auth[_0xe9dd('0xb')](),controller[_0xe9dd('0xd')]);router[_0xe9dd('0xa')](_0xe9dd('0xe'),auth['isAuthenticated'](),controller[_0xe9dd('0xf')]);router['get']('/:id/run',auth[_0xe9dd('0xb')](),controller[_0xe9dd('0x10')]);router[_0xe9dd('0xa')]('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0xe9dd('0x11')]('/',auth['isAuthenticated'](),controller[_0xe9dd('0x12')]);router[_0xe9dd('0x13')](_0xe9dd('0x14'),auth[_0xe9dd('0xb')](),controller[_0xe9dd('0x15')]);router[_0xe9dd('0x16')](_0xe9dd('0x14'),auth[_0xe9dd('0xb')](),controller['destroy']);module[_0xe9dd('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8c27e49..ae8f5ad 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 _0x21a2=['ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x37c309,_0x55978f){var _0x509c24=function(_0x12523d){while(--_0x12523d){_0x37c309['push'](_0x37c309['shift']());}};_0x509c24(++_0x55978f);}(_0x21a2,0xd9));var _0x221a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x21a2[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x221a('0x0'));var moment=require(_0x221a('0x1'));module[_0x221a('0x2')]={'name':{'type':Sequelize[_0x221a('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x221a('0x4')](_0x221a('0x5'),'pdf',_0x221a('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x221a('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x221a('0x3')],'defaultValue':_0x221a('0x8')},'type':{'type':Sequelize[_0x221a('0x4')](_0x221a('0x9'),_0x221a('0xa')),'allowNull':![],'defaultValue':_0x221a('0x9')},'reportId':{'type':Sequelize[_0x221a('0xb')](0xb)[_0x221a('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8000=['STRING','ENUM','pdf','csv','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8000,0xbd));var _0x0800=function(_0xde1ff2,_0x1facb4){_0xde1ff2=_0xde1ff2-0x0;var _0x5f0bd9=_0x8000[_0xde1ff2];return _0x5f0bd9;};'use strict';var Sequelize=require(_0x0800('0x0'));var moment=require(_0x0800('0x1'));module[_0x0800('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x0800('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x0800('0x4')]('csv',_0x0800('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x0800('0x6')},'savename':{'type':Sequelize[_0x0800('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0800('0x7')]},'endDate':{'type':Sequelize[_0x0800('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0800('0x8')},'type':{'type':Sequelize['ENUM'](_0x0800('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x0800('0x9')},'reportId':{'type':Sequelize[_0x0800('0xa')](0xb)[_0x0800('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e38073c..e01019a 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 _0xf2e6=['save','then','destroy','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','user','get','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','update','body','download','basename','savename','output','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','%s.%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply'];(function(_0x11d684,_0x4d4123){var _0x78a301=function(_0x1a1966){while(--_0x1a1966){_0x11d684['push'](_0x11d684['shift']());}};_0x78a301(++_0x4d4123);}(_0xf2e6,0x9b));var _0x6f2e=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xf2e6[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require(_0x6f2e('0x0'));var emlformat=require(_0x6f2e('0x1'));var rimraf=require(_0x6f2e('0x2'));var zipdir=require(_0x6f2e('0x3'));var jsonpatch=require(_0x6f2e('0x4'));var rp=require(_0x6f2e('0x5'));var moment=require(_0x6f2e('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6f2e('0x7'));var sox=require(_0x6f2e('0x8'));var csv=require(_0x6f2e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6f2e('0xa'));var crypto=require(_0x6f2e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6f2e('0xc'));var toCsv=require(_0x6f2e('0x9'));var querystring=require(_0x6f2e('0xd'));var Papa=require(_0x6f2e('0xe'));var Redis=require(_0x6f2e('0xf'));var authService=require(_0x6f2e('0x10'));var qs=require(_0x6f2e('0x11'));var as=require(_0x6f2e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f2e('0x13'))(_0x6f2e('0x14'));var utils=require(_0x6f2e('0x15'));var config=require('../../config/environment');var db=require(_0x6f2e('0x16'))['db'];function respondWithStatusCode(_0x572a50,_0x3c8aa4){_0x3c8aa4=_0x3c8aa4||0xcc;return function(_0x1f04bb){if(_0x1f04bb){return _0x572a50[_0x6f2e('0x17')](_0x3c8aa4);}return _0x572a50[_0x6f2e('0x18')](_0x3c8aa4)[_0x6f2e('0x19')]();};}function respondWithResult(_0x4293b8,_0x2b23a6){_0x2b23a6=_0x2b23a6||0xc8;return function(_0x37c22a){if(_0x37c22a){return _0x4293b8['status'](_0x2b23a6)[_0x6f2e('0x1a')](_0x37c22a);}};}function respondWithFilteredResult(_0x56206e,_0x333285){return function(_0x2193a4){if(_0x2193a4){var _0x2cf401=_0x2193a4['count'],_0x11c766=_0x333285[_0x6f2e('0x1b')],_0x59089e=_0x333285['offset']+_0x333285[_0x6f2e('0x1c')],_0x438909;if(_0x59089e>=_0x2cf401){_0x59089e=_0x2cf401;_0x438909=0xc8;}else{_0x438909=0xce;}_0x56206e['status'](_0x438909);return _0x56206e['set'](_0x6f2e('0x1d'),_0x11c766+'-'+_0x59089e+'/'+_0x2cf401)[_0x6f2e('0x1a')](_0x2193a4);}return null;};}function patchUpdates(_0x2026cf){return function(_0x547db8){try{jsonpatch[_0x6f2e('0x1e')](_0x547db8,_0x2026cf,!![]);}catch(_0x1a2716){return BPromise['reject'](_0x1a2716);}return _0x547db8[_0x6f2e('0x1f')]();};}function saveUpdates(_0x56b586,_0x4a3e41){return function(_0x3b4183){if(_0x3b4183){return _0x3b4183['update'](_0x56b586)[_0x6f2e('0x20')](function(_0x25b077){return _0x25b077;});}return null;};}function removeEntity(_0x5067c2,_0x504c21){return function(_0x2f8a2c){if(_0x2f8a2c){return _0x2f8a2c[_0x6f2e('0x21')]()[_0x6f2e('0x20')](function(){var _0x206296=_0x2f8a2c['get']({'plain':!![]});var _0x3618d7='ExtractedReports';return db[_0x6f2e('0x22')][_0x6f2e('0x21')]({'where':{'type':_0x3618d7,'resourceId':_0x206296['id']}})['then'](function(){return _0x2f8a2c;});})[_0x6f2e('0x20')](function(){_0x5067c2[_0x6f2e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x331acf,_0x121747){return function(_0x14b1a1){if(!_0x14b1a1){_0x331acf[_0x6f2e('0x17')](0x194);}return _0x14b1a1;};}function handleError(_0x44b431,_0x17f88b){_0x17f88b=_0x17f88b||0x1f4;return function(_0x5bc074){logger[_0x6f2e('0x23')](_0x5bc074[_0x6f2e('0x24')]);if(_0x5bc074['name']){delete _0x5bc074[_0x6f2e('0x25')];}_0x44b431[_0x6f2e('0x18')](_0x17f88b)[_0x6f2e('0x26')](_0x5bc074);};}exports[_0x6f2e('0x27')]=function(_0x1e543b,_0x2840dc){var _0x733851={},_0xa96ce2={},_0x199d94={'count':0x0,'rows':[]};var _0x4e0216=_[_0x6f2e('0x28')](db[_0x6f2e('0x29')][_0x6f2e('0x2a')],function(_0x515f99){return{'name':_0x515f99['fieldName'],'type':_0x515f99[_0x6f2e('0x2b')][_0x6f2e('0x2c')]};});_0xa96ce2['model']=_['map'](_0x4e0216,_0x6f2e('0x25'));_0xa96ce2[_0x6f2e('0x2d')]=_[_0x6f2e('0x2e')](_0x1e543b['query']);_0xa96ce2[_0x6f2e('0x2f')]=_[_0x6f2e('0x30')](_0xa96ce2['model'],_0xa96ce2['query']);_0x733851[_0x6f2e('0x31')]=_[_0x6f2e('0x30')](_0xa96ce2[_0x6f2e('0x32')],qs['fields'](_0x1e543b[_0x6f2e('0x2d')][_0x6f2e('0x33')]));_0x733851['attributes']=_0x733851['attributes'][_0x6f2e('0x34')]?_0x733851['attributes']:_0xa96ce2[_0x6f2e('0x32')];if(!_0x1e543b['query'][_0x6f2e('0x35')](_0x6f2e('0x36'))){_0x733851['limit']=qs[_0x6f2e('0x1c')](_0x1e543b[_0x6f2e('0x2d')][_0x6f2e('0x1c')]);_0x733851[_0x6f2e('0x1b')]=qs[_0x6f2e('0x1b')](_0x1e543b[_0x6f2e('0x2d')][_0x6f2e('0x1b')]);}_0x733851[_0x6f2e('0x37')]=qs[_0x6f2e('0x38')](_0x1e543b['query'][_0x6f2e('0x38')]);_0x733851['where']=qs[_0x6f2e('0x2f')](_[_0x6f2e('0x39')](_0x1e543b[_0x6f2e('0x2d')],_0xa96ce2[_0x6f2e('0x2f')]),_0x4e0216);if(_0x1e543b[_0x6f2e('0x2d')][_0x6f2e('0x3a')]){_0x733851[_0x6f2e('0x3b')]=_[_0x6f2e('0x3c')](_0x733851[_0x6f2e('0x3b')],{'$or':_[_0x6f2e('0x28')](_0x4e0216,function(_0x2d66c8){if(_0x2d66c8[_0x6f2e('0x2b')]!==_0x6f2e('0x3d')){var _0x5c134f={};_0x5c134f[_0x2d66c8[_0x6f2e('0x25')]]={'$like':'%'+_0x1e543b[_0x6f2e('0x2d')][_0x6f2e('0x3a')]+'%'};return _0x5c134f;}})});}_0x733851=_[_0x6f2e('0x3c')]({},_0x733851,_0x1e543b[_0x6f2e('0x3e')]);var _0x422abc={'where':_0x733851[_0x6f2e('0x3b')]};return db[_0x6f2e('0x29')][_0x6f2e('0x3f')](_0x422abc)[_0x6f2e('0x20')](function(_0x4af491){_0x199d94['count']=_0x4af491;if(_0x1e543b['query'][_0x6f2e('0x40')]){_0x733851[_0x6f2e('0x41')]=[{'all':!![]}];}return db[_0x6f2e('0x29')][_0x6f2e('0x42')](_0x733851);})[_0x6f2e('0x20')](function(_0x1d3918){_0x199d94[_0x6f2e('0x43')]=_0x1d3918;return _0x199d94;})[_0x6f2e('0x20')](respondWithFilteredResult(_0x2840dc,_0x733851))[_0x6f2e('0x44')](handleError(_0x2840dc,null));};exports[_0x6f2e('0x45')]=function(_0x31733c,_0x4f57c6){var _0x324373={'raw':!![],'where':{'id':_0x31733c[_0x6f2e('0x46')]['id']}},_0x2e5b2c={};_0x2e5b2c[_0x6f2e('0x32')]=_[_0x6f2e('0x2e')](db[_0x6f2e('0x29')][_0x6f2e('0x2a')]);_0x2e5b2c[_0x6f2e('0x2d')]=_[_0x6f2e('0x2e')](_0x31733c['query']);_0x2e5b2c[_0x6f2e('0x2f')]=_['intersection'](_0x2e5b2c[_0x6f2e('0x32')],_0x2e5b2c[_0x6f2e('0x2d')]);_0x324373['attributes']=_[_0x6f2e('0x30')](_0x2e5b2c[_0x6f2e('0x32')],qs[_0x6f2e('0x33')](_0x31733c[_0x6f2e('0x2d')][_0x6f2e('0x33')]));_0x324373['attributes']=_0x324373[_0x6f2e('0x31')][_0x6f2e('0x34')]?_0x324373[_0x6f2e('0x31')]:_0x2e5b2c['model'];if(_0x31733c[_0x6f2e('0x2d')][_0x6f2e('0x40')]){_0x324373[_0x6f2e('0x41')]=[{'all':!![]}];}_0x324373=_[_0x6f2e('0x3c')]({},_0x324373,_0x31733c[_0x6f2e('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x324373)[_0x6f2e('0x20')](handleEntityNotFound(_0x4f57c6,null))[_0x6f2e('0x20')](respondWithResult(_0x4f57c6,null))['catch'](handleError(_0x4f57c6,null));};exports[_0x6f2e('0x47')]=function(_0x5698d1,_0x1ce729){return db[_0x6f2e('0x29')][_0x6f2e('0x47')](_0x5698d1['body'],{})[_0x6f2e('0x20')](function(_0x2e8b14){var _0x1a9c59=_0x5698d1[_0x6f2e('0x48')][_0x6f2e('0x49')]({'plain':!![]});if(!_0x1a9c59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9c59[_0x6f2e('0x4a')]===_0x6f2e('0x48')){var _0x1a1c7f=_0x2e8b14[_0x6f2e('0x49')]({'plain':!![]});var _0x3c87ac=_0x6f2e('0x4b');return db[_0x6f2e('0x4c')][_0x6f2e('0x4d')]({'where':{'name':_0x3c87ac,'userProfileId':_0x1a9c59[_0x6f2e('0x4e')]},'raw':!![]})[_0x6f2e('0x20')](function(_0x3232c6){if(_0x3232c6&&_0x3232c6[_0x6f2e('0x4f')]===0x0){return db[_0x6f2e('0x22')]['create']({'name':_0x1a1c7f[_0x6f2e('0x25')],'resourceId':_0x1a1c7f['id'],'type':_0x3232c6[_0x6f2e('0x25')],'sectionId':_0x3232c6['id']},{})['then'](function(){return _0x2e8b14;});}else{return _0x2e8b14;}})['catch'](function(_0x22ee57){logger[_0x6f2e('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22ee57);throw _0x22ee57;});}return _0x2e8b14;})[_0x6f2e('0x20')](respondWithResult(_0x1ce729,0xc9))['catch'](handleError(_0x1ce729,null));};exports[_0x6f2e('0x50')]=function(_0x40feb6,_0x45059c){if(_0x40feb6[_0x6f2e('0x51')]['id']){delete _0x40feb6[_0x6f2e('0x51')]['id'];}return db[_0x6f2e('0x29')][_0x6f2e('0x4d')]({'where':{'id':_0x40feb6['params']['id']}})[_0x6f2e('0x20')](handleEntityNotFound(_0x45059c,null))[_0x6f2e('0x20')](saveUpdates(_0x40feb6[_0x6f2e('0x51')],null))[_0x6f2e('0x20')](respondWithResult(_0x45059c,null))[_0x6f2e('0x44')](handleError(_0x45059c,null));};exports[_0x6f2e('0x21')]=function(_0x178079,_0x25b1eb){return db['AnalyticExtractedReport'][_0x6f2e('0x4d')]({'where':{'id':_0x178079['params']['id']}})[_0x6f2e('0x20')](handleEntityNotFound(_0x25b1eb,null))[_0x6f2e('0x20')](removeEntity(_0x25b1eb,null))[_0x6f2e('0x44')](handleError(_0x25b1eb,null));};exports[_0x6f2e('0x52')]=function(_0x49207c,_0x17c434,_0x35dfe3){return db[_0x6f2e('0x29')][_0x6f2e('0x4d')]({'where':{'id':_0x49207c[_0x6f2e('0x46')]['id']},'attributes':[_0x6f2e('0x25'),_0x6f2e('0x53'),_0x6f2e('0x54'),_0x6f2e('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x17c434,null))[_0x6f2e('0x20')](function(_0x4d3a03){if(_0x4d3a03){if(!fs[_0x6f2e('0x56')](path[_0x6f2e('0x57')](config[_0x6f2e('0x58')],'server/files/reports',_0x4d3a03[_0x6f2e('0x54')]))){throw new db['Sequelize'][(_0x6f2e('0x59'))](_0x6f2e('0x5a'));}if(_0x49207c['query']['exists']){return _0x17c434[_0x6f2e('0x17')](0xc8);}return _0x17c434[_0x6f2e('0x52')](path[_0x6f2e('0x57')](config['root'],_0x6f2e('0x5b'),_0x4d3a03[_0x6f2e('0x54')]),util['format'](_0x6f2e('0x5c'),_0x4d3a03[_0x6f2e('0x53')]||_0x4d3a03[_0x6f2e('0x25')],_0x4d3a03[_0x6f2e('0x55')]['toLowerCase']()));}})[_0x6f2e('0x44')](handleError(_0x17c434,null));}; \ No newline at end of file +var _0x30d6=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','AnalyticExtractedReport','includeAll','include','findAll','show','intersection','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','params','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','html-pdf'];(function(_0x3f603a,_0x3065d0){var _0x24a776=function(_0x718323){while(--_0x718323){_0x3f603a['push'](_0x3f603a['shift']());}};_0x24a776(++_0x3065d0);}(_0x30d6,0x122));var _0x630d=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x30d6[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x630d('0x0'));var emlformat=require(_0x630d('0x1'));var rimraf=require(_0x630d('0x2'));var zipdir=require(_0x630d('0x3'));var jsonpatch=require(_0x630d('0x4'));var rp=require(_0x630d('0x5'));var moment=require(_0x630d('0x6'));var BPromise=require(_0x630d('0x7'));var Mustache=require('mustache');var util=require(_0x630d('0x8'));var path=require(_0x630d('0x9'));var sox=require('sox');var csv=require(_0x630d('0xa'));var ejs=require(_0x630d('0xb'));var fs=require('fs');var _=require(_0x630d('0xc'));var squel=require('squel');var crypto=require(_0x630d('0xd'));var jsforce=require(_0x630d('0xe'));var deskjs=require(_0x630d('0xf'));var toCsv=require(_0x630d('0xa'));var querystring=require(_0x630d('0x10'));var Papa=require(_0x630d('0x11'));var Redis=require('ioredis');var authService=require(_0x630d('0x12'));var qs=require(_0x630d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x630d('0x14'));var logger=require(_0x630d('0x15'))(_0x630d('0x16'));var utils=require(_0x630d('0x17'));var config=require('../../config/environment');var db=require(_0x630d('0x18'))['db'];function respondWithStatusCode(_0x5071d5,_0x432719){_0x432719=_0x432719||0xcc;return function(_0x21463d){if(_0x21463d){return _0x5071d5[_0x630d('0x19')](_0x432719);}return _0x5071d5[_0x630d('0x1a')](_0x432719)[_0x630d('0x1b')]();};}function respondWithResult(_0x383778,_0x5196e7){_0x5196e7=_0x5196e7||0xc8;return function(_0x53d935){if(_0x53d935){return _0x383778[_0x630d('0x1a')](_0x5196e7)[_0x630d('0x1c')](_0x53d935);}};}function respondWithFilteredResult(_0x32fffa,_0xd92805){return function(_0x2efecc){if(_0x2efecc){var _0x5b0aa4=_0x2efecc[_0x630d('0x1d')],_0x769671=_0xd92805[_0x630d('0x1e')],_0x51cfef=_0xd92805[_0x630d('0x1e')]+_0xd92805[_0x630d('0x1f')],_0x121dcd;if(_0x51cfef>=_0x5b0aa4){_0x51cfef=_0x5b0aa4;_0x121dcd=0xc8;}else{_0x121dcd=0xce;}_0x32fffa['status'](_0x121dcd);return _0x32fffa[_0x630d('0x20')](_0x630d('0x21'),_0x769671+'-'+_0x51cfef+'/'+_0x5b0aa4)[_0x630d('0x1c')](_0x2efecc);}return null;};}function patchUpdates(_0x4ba9b1){return function(_0x5a046f){try{jsonpatch[_0x630d('0x22')](_0x5a046f,_0x4ba9b1,!![]);}catch(_0xffb987){return BPromise[_0x630d('0x23')](_0xffb987);}return _0x5a046f[_0x630d('0x24')]();};}function saveUpdates(_0x3d96ae,_0x5f4348){return function(_0x59f646){if(_0x59f646){return _0x59f646[_0x630d('0x25')](_0x3d96ae)['then'](function(_0x2677eb){return _0x2677eb;});}return null;};}function removeEntity(_0x506a44,_0x479a3c){return function(_0x11a576){if(_0x11a576){return _0x11a576[_0x630d('0x26')]()[_0x630d('0x27')](function(){var _0x2f20f6=_0x11a576[_0x630d('0x28')]({'plain':!![]});var _0x5c6f2f=_0x630d('0x29');return db[_0x630d('0x2a')][_0x630d('0x26')]({'where':{'type':_0x5c6f2f,'resourceId':_0x2f20f6['id']}})['then'](function(){return _0x11a576;});})[_0x630d('0x27')](function(){_0x506a44[_0x630d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eeeea,_0x2188a8){return function(_0x213d81){if(!_0x213d81){_0x3eeeea['sendStatus'](0x194);}return _0x213d81;};}function handleError(_0x2cc876,_0x32a61e){_0x32a61e=_0x32a61e||0x1f4;return function(_0x2d1251){logger[_0x630d('0x2b')](_0x2d1251[_0x630d('0x2c')]);if(_0x2d1251[_0x630d('0x2d')]){delete _0x2d1251[_0x630d('0x2d')];}_0x2cc876[_0x630d('0x1a')](_0x32a61e)[_0x630d('0x2e')](_0x2d1251);};}exports['index']=function(_0x4cf88e,_0x706e13){var _0x3878aa={},_0x22eaff={},_0x59090e={'count':0x0,'rows':[]};var _0x5d9914=_[_0x630d('0x2f')](db['AnalyticExtractedReport'][_0x630d('0x30')],function(_0x5a92ff){return{'name':_0x5a92ff[_0x630d('0x31')],'type':_0x5a92ff['type']['key']};});_0x22eaff[_0x630d('0x32')]=_[_0x630d('0x2f')](_0x5d9914,_0x630d('0x2d'));_0x22eaff[_0x630d('0x33')]=_[_0x630d('0x34')](_0x4cf88e[_0x630d('0x33')]);_0x22eaff[_0x630d('0x35')]=_['intersection'](_0x22eaff[_0x630d('0x32')],_0x22eaff['query']);_0x3878aa[_0x630d('0x36')]=_['intersection'](_0x22eaff[_0x630d('0x32')],qs[_0x630d('0x37')](_0x4cf88e[_0x630d('0x33')]['fields']));_0x3878aa['attributes']=_0x3878aa['attributes'][_0x630d('0x38')]?_0x3878aa[_0x630d('0x36')]:_0x22eaff[_0x630d('0x32')];if(!_0x4cf88e[_0x630d('0x33')][_0x630d('0x39')](_0x630d('0x3a'))){_0x3878aa[_0x630d('0x1f')]=qs[_0x630d('0x1f')](_0x4cf88e['query'][_0x630d('0x1f')]);_0x3878aa[_0x630d('0x1e')]=qs[_0x630d('0x1e')](_0x4cf88e[_0x630d('0x33')][_0x630d('0x1e')]);}_0x3878aa[_0x630d('0x3b')]=qs['sort'](_0x4cf88e[_0x630d('0x33')][_0x630d('0x3c')]);_0x3878aa[_0x630d('0x3d')]=qs[_0x630d('0x35')](_[_0x630d('0x3e')](_0x4cf88e[_0x630d('0x33')],_0x22eaff[_0x630d('0x35')]),_0x5d9914);if(_0x4cf88e[_0x630d('0x33')]['filter']){_0x3878aa[_0x630d('0x3d')]=_[_0x630d('0x3f')](_0x3878aa[_0x630d('0x3d')],{'$or':_['map'](_0x5d9914,function(_0x390cbf){if(_0x390cbf['type']!==_0x630d('0x40')){var _0x3f0e18={};_0x3f0e18[_0x390cbf[_0x630d('0x2d')]]={'$like':'%'+_0x4cf88e[_0x630d('0x33')]['filter']+'%'};return _0x3f0e18;}})});}_0x3878aa=_['merge']({},_0x3878aa,_0x4cf88e['options']);var _0x8eccd7={'where':_0x3878aa['where']};return db[_0x630d('0x41')][_0x630d('0x1d')](_0x8eccd7)[_0x630d('0x27')](function(_0x6a87f1){_0x59090e[_0x630d('0x1d')]=_0x6a87f1;if(_0x4cf88e[_0x630d('0x33')][_0x630d('0x42')]){_0x3878aa[_0x630d('0x43')]=[{'all':!![]}];}return db[_0x630d('0x41')][_0x630d('0x44')](_0x3878aa);})[_0x630d('0x27')](function(_0x17fa47){_0x59090e['rows']=_0x17fa47;return _0x59090e;})[_0x630d('0x27')](respondWithFilteredResult(_0x706e13,_0x3878aa))['catch'](handleError(_0x706e13,null));};exports[_0x630d('0x45')]=function(_0x163c96,_0x400256){var _0x3f4850={'raw':!![],'where':{'id':_0x163c96['params']['id']}},_0x42b257={};_0x42b257[_0x630d('0x32')]=_[_0x630d('0x34')](db['AnalyticExtractedReport'][_0x630d('0x30')]);_0x42b257[_0x630d('0x33')]=_[_0x630d('0x34')](_0x163c96[_0x630d('0x33')]);_0x42b257['filters']=_[_0x630d('0x46')](_0x42b257[_0x630d('0x32')],_0x42b257[_0x630d('0x33')]);_0x3f4850[_0x630d('0x36')]=_['intersection'](_0x42b257[_0x630d('0x32')],qs[_0x630d('0x37')](_0x163c96[_0x630d('0x33')]['fields']));_0x3f4850[_0x630d('0x36')]=_0x3f4850[_0x630d('0x36')]['length']?_0x3f4850['attributes']:_0x42b257[_0x630d('0x32')];if(_0x163c96[_0x630d('0x33')][_0x630d('0x42')]){_0x3f4850[_0x630d('0x43')]=[{'all':!![]}];}_0x3f4850=_[_0x630d('0x3f')]({},_0x3f4850,_0x163c96[_0x630d('0x47')]);return db[_0x630d('0x41')][_0x630d('0x48')](_0x3f4850)[_0x630d('0x27')](handleEntityNotFound(_0x400256,null))[_0x630d('0x27')](respondWithResult(_0x400256,null))[_0x630d('0x49')](handleError(_0x400256,null));};exports[_0x630d('0x4a')]=function(_0xd18064,_0x42ca82){return db['AnalyticExtractedReport']['create'](_0xd18064['body'],{})[_0x630d('0x27')](function(_0x2a37db){var _0x1a00fa=_0xd18064['user'][_0x630d('0x28')]({'plain':!![]});if(!_0x1a00fa)throw new Error(_0x630d('0x4b'));if(_0x1a00fa[_0x630d('0x4c')]===_0x630d('0x4d')){var _0x28657c=_0x2a37db[_0x630d('0x28')]({'plain':!![]});var _0x426881=_0x630d('0x29');return db[_0x630d('0x4e')][_0x630d('0x48')]({'where':{'name':_0x426881,'userProfileId':_0x1a00fa[_0x630d('0x4f')]},'raw':!![]})['then'](function(_0x11d979){if(_0x11d979&&_0x11d979[_0x630d('0x50')]===0x0){return db[_0x630d('0x2a')]['create']({'name':_0x28657c[_0x630d('0x2d')],'resourceId':_0x28657c['id'],'type':_0x11d979[_0x630d('0x2d')],'sectionId':_0x11d979['id']},{})[_0x630d('0x27')](function(){return _0x2a37db;});}else{return _0x2a37db;}})[_0x630d('0x49')](function(_0x2da56e){logger[_0x630d('0x2b')](_0x630d('0x51'),_0x2da56e);throw _0x2da56e;});}return _0x2a37db;})['then'](respondWithResult(_0x42ca82,0xc9))[_0x630d('0x49')](handleError(_0x42ca82,null));};exports[_0x630d('0x25')]=function(_0x497f56,_0xc24a23){if(_0x497f56[_0x630d('0x52')]['id']){delete _0x497f56[_0x630d('0x52')]['id'];}return db['AnalyticExtractedReport'][_0x630d('0x48')]({'where':{'id':_0x497f56['params']['id']}})[_0x630d('0x27')](handleEntityNotFound(_0xc24a23,null))['then'](saveUpdates(_0x497f56[_0x630d('0x52')],null))['then'](respondWithResult(_0xc24a23,null))['catch'](handleError(_0xc24a23,null));};exports['destroy']=function(_0x4526ce,_0x152e1c){return db[_0x630d('0x41')][_0x630d('0x48')]({'where':{'id':_0x4526ce['params']['id']}})[_0x630d('0x27')](handleEntityNotFound(_0x152e1c,null))['then'](removeEntity(_0x152e1c,null))[_0x630d('0x49')](handleError(_0x152e1c,null));};exports[_0x630d('0x53')]=function(_0x346635,_0x51f57e,_0x532b9e){return db[_0x630d('0x41')][_0x630d('0x48')]({'where':{'id':_0x346635[_0x630d('0x54')]['id']},'attributes':['name','basename',_0x630d('0x55'),'output'],'raw':!![]})[_0x630d('0x27')](handleEntityNotFound(_0x51f57e,null))[_0x630d('0x27')](function(_0xc2fd6){if(_0xc2fd6){if(!fs['existsSync'](path[_0x630d('0x56')](config[_0x630d('0x57')],_0x630d('0x58'),_0xc2fd6['savename']))){throw new db[(_0x630d('0x59'))][(_0x630d('0x5a'))](_0x630d('0x5b'));}if(_0x346635['query'][_0x630d('0x5c')]){return _0x51f57e['sendStatus'](0xc8);}return _0x51f57e[_0x630d('0x53')](path[_0x630d('0x56')](config[_0x630d('0x57')],_0x630d('0x58'),_0xc2fd6[_0x630d('0x55')]),util[_0x630d('0x5d')](_0x630d('0x5e'),_0xc2fd6[_0x630d('0x5f')]||_0xc2fd6[_0x630d('0x2d')],_0xc2fd6['output'][_0x630d('0x60')]()));}})[_0x630d('0x49')](handleError(_0x51f57e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 72d6a7e..d6a6693 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 _0xf7fd=['path','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','moment','request-promise'];(function(_0x468468,_0x5207ea){var _0x97f128=function(_0x1afa9f){while(--_0x1afa9f){_0x468468['push'](_0x468468['shift']());}};_0x97f128(++_0x5207ea);}(_0xf7fd,0xe2));var _0xdf7f=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xf7fd[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0xdf7f('0x0'));var util=require('util');var logger=require(_0xdf7f('0x1'))('api');var moment=require(_0xdf7f('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf7f('0x3'));var fs=require('fs');var path=require(_0xdf7f('0x4'));var rimraf=require('rimraf');var config=require(_0xdf7f('0x5'));var attributes=require(_0xdf7f('0x6'));module[_0xdf7f('0x7')]=function(_0x33e8f5,_0x1e3955){return _0x33e8f5['define'](_0xdf7f('0x8'),attributes,{'tableName':_0xdf7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf165=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xf165,0xae));var _0x5f16=function(_0xdb75ae,_0x1f0389){_0xdb75ae=_0xdb75ae-0x0;var _0x2dc0da=_0xf165[_0xdb75ae];return _0x2dc0da;};'use strict';var _=require(_0x5f16('0x0'));var util=require('util');var logger=require(_0x5f16('0x1'))(_0x5f16('0x2'));var moment=require(_0x5f16('0x3'));var BPromise=require(_0x5f16('0x4'));var rp=require(_0x5f16('0x5'));var fs=require('fs');var path=require(_0x5f16('0x6'));var rimraf=require(_0x5f16('0x7'));var config=require(_0x5f16('0x8'));var attributes=require(_0x5f16('0x9'));module[_0x5f16('0xa')]=function(_0xc7681d,_0x598d5a){return _0xc7681d[_0x5f16('0xb')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 933e70b..c53bf84 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 _0xa7d9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xede989,_0x2c6dc7){var _0x52e147=function(_0xa8f32b){while(--_0xa8f32b){_0xede989['push'](_0xede989['shift']());}};_0x52e147(++_0x2c6dc7);}(_0xa7d9,0x131));var _0x9a7d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa7d9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x9a7d('0x0'));var moment=require(_0x9a7d('0x1'));var BPromise=require(_0x9a7d('0x2'));var rs=require(_0x9a7d('0x3'));var fs=require('fs');var Redis=require(_0x9a7d('0x4'));var db=require(_0x9a7d('0x5'))['db'];var utils=require(_0x9a7d('0x6'));var logger=require(_0x9a7d('0x7'))(_0x9a7d('0x8'));var config=require(_0x9a7d('0x9'));var jayson=require(_0x9a7d('0xa'));var client=jayson[_0x9a7d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9ca1,_0x1fb761,_0x378c8c){return new BPromise(function(_0x51c80c,_0x4aca49){return client[_0x9a7d('0xc')](_0x2c9ca1,_0x378c8c)[_0x9a7d('0xd')](function(_0x3d63b3){logger[_0x9a7d('0xe')](_0x9a7d('0xf'),_0x1fb761,_0x9a7d('0x10'));logger['debug'](_0x9a7d('0x11'),_0x1fb761,'request\x20sent',JSON[_0x9a7d('0x12')](_0x3d63b3));if(_0x3d63b3[_0x9a7d('0x13')]){if(_0x3d63b3[_0x9a7d('0x13')][_0x9a7d('0x14')]===0x1f4){logger[_0x9a7d('0x13')](_0x9a7d('0xf'),_0x1fb761,_0x3d63b3[_0x9a7d('0x13')][_0x9a7d('0x15')]);return _0x4aca49(_0x3d63b3['error'][_0x9a7d('0x15')]);}logger[_0x9a7d('0x13')](_0x9a7d('0xf'),_0x1fb761,_0x3d63b3['error'][_0x9a7d('0x15')]);return _0x51c80c(_0x3d63b3[_0x9a7d('0x13')][_0x9a7d('0x15')]);}else{logger[_0x9a7d('0xe')](_0x9a7d('0xf'),_0x1fb761,_0x9a7d('0x10'));_0x51c80c(_0x3d63b3[_0x9a7d('0x16')][_0x9a7d('0x15')]);}})[_0x9a7d('0x17')](function(_0x20cede){logger[_0x9a7d('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1fb761,_0x20cede);_0x4aca49(_0x20cede);});});} \ No newline at end of file +var _0x2636=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31351d,_0x508e96){var _0x5cab25=function(_0x1181a7){while(--_0x1181a7){_0x31351d['push'](_0x31351d['shift']());}};_0x5cab25(++_0x508e96);}(_0x2636,0x1f1));var _0x6263=function(_0x3f7a52,_0x14fcbc){_0x3f7a52=_0x3f7a52-0x0;var _0x1b8b49=_0x2636[_0x3f7a52];return _0x1b8b49;};'use strict';var _=require(_0x6263('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6263('0x1'));var fs=require('fs');var Redis=require(_0x6263('0x2'));var db=require(_0x6263('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6263('0x4'))(_0x6263('0x5'));var config=require(_0x6263('0x6'));var jayson=require(_0x6263('0x7'));var client=jayson[_0x6263('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148886,_0x181d0d,_0x31a092){return new BPromise(function(_0x4de078,_0x587faf){return client[_0x6263('0x9')](_0x148886,_0x31a092)[_0x6263('0xa')](function(_0x4619b2){logger[_0x6263('0xb')](_0x6263('0xc'),_0x181d0d,'request\x20sent');logger[_0x6263('0xd')](_0x6263('0xe'),_0x181d0d,_0x6263('0xf'),JSON[_0x6263('0x10')](_0x4619b2));if(_0x4619b2[_0x6263('0x11')]){if(_0x4619b2[_0x6263('0x11')][_0x6263('0x12')]===0x1f4){logger['error'](_0x6263('0xc'),_0x181d0d,_0x4619b2[_0x6263('0x11')][_0x6263('0x13')]);return _0x587faf(_0x4619b2['error']['message']);}logger[_0x6263('0x11')](_0x6263('0xc'),_0x181d0d,_0x4619b2[_0x6263('0x11')][_0x6263('0x13')]);return _0x4de078(_0x4619b2[_0x6263('0x11')][_0x6263('0x13')]);}else{logger[_0x6263('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x181d0d,_0x6263('0xf'));_0x4de078(_0x4619b2[_0x6263('0x14')][_0x6263('0x13')]);}})[_0x6263('0x15')](function(_0x1a4149){logger[_0x6263('0x11')](_0x6263('0xc'),_0x181d0d,_0x1a4149);_0x587faf(_0x1a4149);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 69215eb..1236596 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 _0xdd70=['delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update'];(function(_0x23ede0,_0x250e0f){var _0x5718f6=function(_0x173a33){while(--_0x173a33){_0x23ede0['push'](_0x23ede0['shift']());}};_0x5718f6(++_0x250e0f);}(_0xdd70,0x7a));var _0x0dd7=function(_0x330eda,_0x37eb05){_0x330eda=_0x330eda-0x0;var _0x3e63eb=_0xdd70[_0x330eda];return _0x3e63eb;};'use strict';var multer=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var path=require('path');var timeout=require(_0x0dd7('0x2'));var express=require('express');var router=express[_0x0dd7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0dd7('0x4'));var config=require(_0x0dd7('0x5'));var controller=require(_0x0dd7('0x6'));router[_0x0dd7('0x7')]('/',auth[_0x0dd7('0x8')](),controller[_0x0dd7('0x9')]);router[_0x0dd7('0x7')](_0x0dd7('0xa'),auth[_0x0dd7('0x8')](),controller[_0x0dd7('0xb')]);router['get'](_0x0dd7('0xc'),auth[_0x0dd7('0x8')](),controller[_0x0dd7('0xd')]);router[_0x0dd7('0xe')]('/',auth['isAuthenticated'](),controller[_0x0dd7('0xf')]);router[_0x0dd7('0x10')]('/:id',auth[_0x0dd7('0x8')](),controller[_0x0dd7('0x11')]);router[_0x0dd7('0x12')](_0x0dd7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0dd7('0x13')]=router; \ No newline at end of file +var _0x2f7a=['create','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post'];(function(_0xae5648,_0x1b7c58){var _0x322878=function(_0x164181){while(--_0x164181){_0xae5648['push'](_0xae5648['shift']());}};_0x322878(++_0x1b7c58);}(_0x2f7a,0xcc));var _0xa2f7=function(_0x1e12cf,_0x170d73){_0x1e12cf=_0x1e12cf-0x0;var _0x3b2d2e=_0x2f7a[_0x1e12cf];return _0x3b2d2e;};'use strict';var multer=require('multer');var util=require(_0xa2f7('0x0'));var path=require(_0xa2f7('0x1'));var timeout=require(_0xa2f7('0x2'));var express=require(_0xa2f7('0x3'));var router=express['Router']();var auth=require(_0xa2f7('0x4'));var interaction=require(_0xa2f7('0x5'));var config=require(_0xa2f7('0x6'));var controller=require(_0xa2f7('0x7'));router[_0xa2f7('0x8')]('/',auth[_0xa2f7('0x9')](),controller[_0xa2f7('0xa')]);router[_0xa2f7('0x8')](_0xa2f7('0xb'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0xc')]);router[_0xa2f7('0x8')](_0xa2f7('0xd'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0xe')]);router[_0xa2f7('0xf')]('/',auth[_0xa2f7('0x9')](),controller[_0xa2f7('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa2f7('0x11')]);router[_0xa2f7('0x12')](_0xa2f7('0xb'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1ce16d3..64a3b63 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x174e79,_0x13ead5){var _0x2964e4=function(_0x254fe5){while(--_0x254fe5){_0x174e79['push'](_0x174e79['shift']());}};_0x2964e4(++_0x13ead5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x5fc3[_0x52096b];return _0x2b1cc7;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x3afcb4,_0x485fb8){var _0x10ebaf=function(_0x216aab){while(--_0x216aab){_0x3afcb4['push'](_0x3afcb4['shift']());}};_0x10ebaf(++_0x485fb8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b183784..fa1da0a 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 _0x7ecd=['include','findAll','rows','catch','show','keys','find','create','body','bulkCreate','update','params','addFields','AnalyticCustomReport','findOne','CustomReportId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll'];(function(_0x3f2f73,_0x2d6f44){var _0x1c4cb0=function(_0x28e119){while(--_0x28e119){_0x3f2f73['push'](_0x3f2f73['shift']());}};_0x1c4cb0(++_0x2d6f44);}(_0x7ecd,0x1ea));var _0xd7ec=function(_0x4533bb,_0x19138d){_0x4533bb=_0x4533bb-0x0;var _0x75b6a7=_0x7ecd[_0x4533bb];return _0x75b6a7;};'use strict';var pdf=require(_0xd7ec('0x0'));var emlformat=require(_0xd7ec('0x1'));var rimraf=require(_0xd7ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7ec('0x3'));var rp=require(_0xd7ec('0x4'));var moment=require(_0xd7ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd7ec('0x6'));var util=require(_0xd7ec('0x7'));var path=require('path');var sox=require(_0xd7ec('0x8'));var csv=require(_0xd7ec('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7ec('0xa'));var squel=require('squel');var crypto=require(_0xd7ec('0xb'));var jsforce=require(_0xd7ec('0xc'));var deskjs=require(_0xd7ec('0xd'));var toCsv=require(_0xd7ec('0x9'));var querystring=require(_0xd7ec('0xe'));var Papa=require('papaparse');var Redis=require(_0xd7ec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd7ec('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7ec('0x11'));var logger=require(_0xd7ec('0x12'))('api');var utils=require(_0xd7ec('0x13'));var config=require(_0xd7ec('0x14'));var db=require(_0xd7ec('0x15'))['db'];function respondWithStatusCode(_0x30ba51,_0x166a55){_0x166a55=_0x166a55||0xcc;return function(_0x9b03d6){if(_0x9b03d6){return _0x30ba51[_0xd7ec('0x16')](_0x166a55);}return _0x30ba51[_0xd7ec('0x17')](_0x166a55)['end']();};}function respondWithResult(_0x8966ba,_0x37e944){_0x37e944=_0x37e944||0xc8;return function(_0x30bef6){if(_0x30bef6){return _0x8966ba[_0xd7ec('0x17')](_0x37e944)[_0xd7ec('0x18')](_0x30bef6);}};}function respondWithFilteredResult(_0x2db1ff,_0x1e0f87){return function(_0x5d2ea5){if(_0x5d2ea5){var _0xb2f41a=_0x5d2ea5[_0xd7ec('0x19')],_0x48055f=_0x1e0f87[_0xd7ec('0x1a')],_0x15eb66=_0x1e0f87[_0xd7ec('0x1a')]+_0x1e0f87[_0xd7ec('0x1b')],_0x43ca9f;if(_0x15eb66>=_0xb2f41a){_0x15eb66=_0xb2f41a;_0x43ca9f=0xc8;}else{_0x43ca9f=0xce;}_0x2db1ff[_0xd7ec('0x17')](_0x43ca9f);return _0x2db1ff[_0xd7ec('0x1c')](_0xd7ec('0x1d'),_0x48055f+'-'+_0x15eb66+'/'+_0xb2f41a)[_0xd7ec('0x18')](_0x5d2ea5);}return null;};}function patchUpdates(_0x3cfbe0){return function(_0x624e97){try{jsonpatch[_0xd7ec('0x1e')](_0x624e97,_0x3cfbe0,!![]);}catch(_0x4b54de){return BPromise[_0xd7ec('0x1f')](_0x4b54de);}return _0x624e97[_0xd7ec('0x20')]();};}function saveUpdates(_0x4fefe0,_0x2a8c3c){return function(_0xd15d4d){if(_0xd15d4d){return _0xd15d4d['update'](_0x4fefe0)[_0xd7ec('0x21')](function(_0x20cc37){return _0x20cc37;});}return null;};}function removeEntity(_0x5c9c17,_0x41cf27){return function(_0x588a87){if(_0x588a87){return _0x588a87[_0xd7ec('0x22')]()['then'](function(){_0x5c9c17[_0xd7ec('0x17')](0xcc)[_0xd7ec('0x23')]();});}};}function handleEntityNotFound(_0x85b62e,_0x586a64){return function(_0x14335b){if(!_0x14335b){_0x85b62e['sendStatus'](0x194);}return _0x14335b;};}function handleError(_0x2d40d4,_0x13e590){_0x13e590=_0x13e590||0x1f4;return function(_0x290b57){logger[_0xd7ec('0x24')](_0x290b57[_0xd7ec('0x25')]);if(_0x290b57[_0xd7ec('0x26')]){delete _0x290b57[_0xd7ec('0x26')];}_0x2d40d4[_0xd7ec('0x17')](_0x13e590)[_0xd7ec('0x27')](_0x290b57);};}exports[_0xd7ec('0x28')]=function(_0x171dd8,_0x19822c){var _0x5dd307={},_0x40f030={},_0x56b366={'count':0x0,'rows':[]};var _0x3cd236=_[_0xd7ec('0x29')](db[_0xd7ec('0x2a')][_0xd7ec('0x2b')],function(_0x795ddb){return{'name':_0x795ddb[_0xd7ec('0x2c')],'type':_0x795ddb[_0xd7ec('0x2d')]['key']};});_0x40f030[_0xd7ec('0x2e')]=_[_0xd7ec('0x29')](_0x3cd236,_0xd7ec('0x26'));_0x40f030[_0xd7ec('0x2f')]=_['keys'](_0x171dd8['query']);_0x40f030[_0xd7ec('0x30')]=_[_0xd7ec('0x31')](_0x40f030['model'],_0x40f030['query']);_0x5dd307[_0xd7ec('0x32')]=_[_0xd7ec('0x31')](_0x40f030[_0xd7ec('0x2e')],qs[_0xd7ec('0x33')](_0x171dd8['query']['fields']));_0x5dd307['attributes']=_0x5dd307[_0xd7ec('0x32')][_0xd7ec('0x34')]?_0x5dd307[_0xd7ec('0x32')]:_0x40f030[_0xd7ec('0x2e')];if(!_0x171dd8[_0xd7ec('0x2f')][_0xd7ec('0x35')](_0xd7ec('0x36'))){_0x5dd307['limit']=qs[_0xd7ec('0x1b')](_0x171dd8[_0xd7ec('0x2f')][_0xd7ec('0x1b')]);_0x5dd307['offset']=qs[_0xd7ec('0x1a')](_0x171dd8['query'][_0xd7ec('0x1a')]);}_0x5dd307[_0xd7ec('0x37')]=qs['sort'](_0x171dd8[_0xd7ec('0x2f')][_0xd7ec('0x38')]);_0x5dd307[_0xd7ec('0x39')]=qs['filters'](_[_0xd7ec('0x3a')](_0x171dd8[_0xd7ec('0x2f')],_0x40f030[_0xd7ec('0x30')]),_0x3cd236);if(_0x171dd8['query'][_0xd7ec('0x3b')]){_0x5dd307['where']=_['merge'](_0x5dd307[_0xd7ec('0x39')],{'$or':_[_0xd7ec('0x29')](_0x3cd236,function(_0x4cd7c8){if(_0x4cd7c8[_0xd7ec('0x2d')]!==_0xd7ec('0x3c')){var _0x4a9361={};_0x4a9361[_0x4cd7c8[_0xd7ec('0x26')]]={'$like':'%'+_0x171dd8[_0xd7ec('0x2f')][_0xd7ec('0x3b')]+'%'};return _0x4a9361;}})});}_0x5dd307=_['merge']({},_0x5dd307,_0x171dd8[_0xd7ec('0x3d')]);var _0x4aa149={'where':_0x5dd307[_0xd7ec('0x39')]};return db[_0xd7ec('0x2a')][_0xd7ec('0x19')](_0x4aa149)[_0xd7ec('0x21')](function(_0x255069){_0x56b366[_0xd7ec('0x19')]=_0x255069;if(_0x171dd8[_0xd7ec('0x2f')][_0xd7ec('0x3e')]){_0x5dd307[_0xd7ec('0x3f')]=[{'all':!![]}];}return db[_0xd7ec('0x2a')][_0xd7ec('0x40')](_0x5dd307);})['then'](function(_0x3181c7){_0x56b366[_0xd7ec('0x41')]=_0x3181c7;return _0x56b366;})[_0xd7ec('0x21')](respondWithFilteredResult(_0x19822c,_0x5dd307))[_0xd7ec('0x42')](handleError(_0x19822c,null));};exports[_0xd7ec('0x43')]=function(_0x184cb5,_0x83ccb3){var _0x994057={'raw':![],'where':{'id':_0x184cb5['params']['id']}},_0x3b176c={};_0x3b176c['model']=_[_0xd7ec('0x44')](db[_0xd7ec('0x2a')][_0xd7ec('0x2b')]);_0x3b176c['query']=_['keys'](_0x184cb5['query']);_0x3b176c[_0xd7ec('0x30')]=_[_0xd7ec('0x31')](_0x3b176c[_0xd7ec('0x2e')],_0x3b176c[_0xd7ec('0x2f')]);_0x994057[_0xd7ec('0x32')]=_['intersection'](_0x3b176c[_0xd7ec('0x2e')],qs[_0xd7ec('0x33')](_0x184cb5[_0xd7ec('0x2f')]['fields']));_0x994057[_0xd7ec('0x32')]=_0x994057[_0xd7ec('0x32')][_0xd7ec('0x34')]?_0x994057['attributes']:_0x3b176c[_0xd7ec('0x2e')];if(_0x184cb5[_0xd7ec('0x2f')][_0xd7ec('0x3e')]){_0x994057[_0xd7ec('0x3f')]=[{'all':!![]}];}_0x994057=_['merge']({},_0x994057,_0x184cb5[_0xd7ec('0x3d')]);return db[_0xd7ec('0x2a')][_0xd7ec('0x45')](_0x994057)[_0xd7ec('0x21')](handleEntityNotFound(_0x83ccb3,null))[_0xd7ec('0x21')](respondWithResult(_0x83ccb3,null))[_0xd7ec('0x42')](handleError(_0x83ccb3,null));};exports[_0xd7ec('0x46')]=function(_0x40a5d2,_0x26f1b8){return db[_0xd7ec('0x2a')][_0xd7ec('0x46')](_0x40a5d2[_0xd7ec('0x47')],{})[_0xd7ec('0x21')](respondWithResult(_0x26f1b8,0xc9))[_0xd7ec('0x42')](handleError(_0x26f1b8,null));};exports[_0xd7ec('0x48')]=function(_0xf08dc6,_0xc55651){return db['AnalyticFieldReport']['bulkCreate'](_0xf08dc6['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xc55651,0xc9))['catch'](handleError(_0xc55651,null));};exports[_0xd7ec('0x49')]=function(_0x351aca,_0x2b467f){if(_0x351aca[_0xd7ec('0x47')]['id']){delete _0x351aca[_0xd7ec('0x47')]['id'];}return db[_0xd7ec('0x2a')][_0xd7ec('0x45')]({'where':{'id':_0x351aca[_0xd7ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b467f,null))['then'](saveUpdates(_0x351aca[_0xd7ec('0x47')],null))[_0xd7ec('0x21')](respondWithResult(_0x2b467f,null))[_0xd7ec('0x42')](handleError(_0x2b467f,null));};exports[_0xd7ec('0x22')]=function(_0xf35e12,_0xe0b1d8){return db[_0xd7ec('0x2a')]['find']({'where':{'id':_0xf35e12['params']['id']}})[_0xd7ec('0x21')](handleEntityNotFound(_0xe0b1d8,null))[_0xd7ec('0x21')](removeEntity(_0xe0b1d8,null))[_0xd7ec('0x42')](handleError(_0xe0b1d8,null));};exports['bulkDestroy']=function(_0x317dac,_0x1281d2){return db[_0xd7ec('0x2a')][_0xd7ec('0x22')]({'where':{'id':_0x317dac[_0xd7ec('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xd7ec('0x21')](respondWithResult(_0x1281d2,0xcc))[_0xd7ec('0x42')](handleError(_0x1281d2,null));};exports[_0xd7ec('0x4b')]=function(_0x1f85c4,_0x46c213,_0x454670){return db[_0xd7ec('0x4c')][_0xd7ec('0x4d')]({'where':{'id':_0x1f85c4[_0xd7ec('0x4a')]['id']}})[_0xd7ec('0x21')](handleEntityNotFound(_0x46c213,null))[_0xd7ec('0x21')](function(_0x21fba0){if(_0x21fba0){return db['sequelize']['transaction'](function(_0x3d84ea){return db['AnalyticFieldReport'][_0xd7ec('0x22')]({'where':{'CustomReportId':_0x1f85c4[_0xd7ec('0x4a')]['id']},'transaction':_0x3d84ea})['then'](function(_0x7f3ea2){var _0x2ab309=_[_0xd7ec('0x29')](_0x1f85c4[_0xd7ec('0x47')],function(_0x5251d7){delete _0x5251d7['id'];_0x5251d7[_0xd7ec('0x4e')]=_0x1f85c4[_0xd7ec('0x4a')]['id'];return _0x5251d7;});return db['AnalyticFieldReport'][_0xd7ec('0x48')](_0x2ab309,{'transaction':_0x3d84ea});});})[_0xd7ec('0x21')](function(){return db[_0xd7ec('0x2a')][_0xd7ec('0x40')]({'where':{'CustomReportId':_0x1f85c4[_0xd7ec('0x4a')]['id']}});});}})[_0xd7ec('0x21')](respondWithResult(_0x46c213,null))[_0xd7ec('0x42')](handleError(_0x46c213,null));}; \ No newline at end of file +var _0xfb16=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','update','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','merge','options','count','then','include','findAll','catch','show','params','includeAll','create','body','bulkCreate','find','ids','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1e4255,_0x829ad6){var _0x5d95df=function(_0x51fc92){while(--_0x51fc92){_0x1e4255['push'](_0x1e4255['shift']());}};_0x5d95df(++_0x829ad6);}(_0xfb16,0xd6));var _0x6fb1=function(_0x1057a4,_0x52290a){_0x1057a4=_0x1057a4-0x0;var _0x1c8328=_0xfb16[_0x1057a4];return _0x1c8328;};'use strict';var pdf=require(_0x6fb1('0x0'));var emlformat=require(_0x6fb1('0x1'));var rimraf=require(_0x6fb1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fb1('0x3'));var rp=require(_0x6fb1('0x4'));var moment=require(_0x6fb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6fb1('0x6'));var util=require(_0x6fb1('0x7'));var path=require(_0x6fb1('0x8'));var sox=require(_0x6fb1('0x9'));var csv=require('to-csv');var ejs=require(_0x6fb1('0xa'));var fs=require('fs');var _=require(_0x6fb1('0xb'));var squel=require(_0x6fb1('0xc'));var crypto=require(_0x6fb1('0xd'));var jsforce=require(_0x6fb1('0xe'));var deskjs=require(_0x6fb1('0xf'));var toCsv=require(_0x6fb1('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6fb1('0x11'));var authService=require(_0x6fb1('0x12'));var qs=require(_0x6fb1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fb1('0x14'));var logger=require('../../config/logger')(_0x6fb1('0x15'));var utils=require(_0x6fb1('0x16'));var config=require(_0x6fb1('0x17'));var db=require(_0x6fb1('0x18'))['db'];function respondWithStatusCode(_0x13403b,_0x104fac){_0x104fac=_0x104fac||0xcc;return function(_0x2505db){if(_0x2505db){return _0x13403b[_0x6fb1('0x19')](_0x104fac);}return _0x13403b['status'](_0x104fac)[_0x6fb1('0x1a')]();};}function respondWithResult(_0x2aed89,_0x3076bc){_0x3076bc=_0x3076bc||0xc8;return function(_0x5be4e6){if(_0x5be4e6){return _0x2aed89[_0x6fb1('0x1b')](_0x3076bc)[_0x6fb1('0x1c')](_0x5be4e6);}};}function respondWithFilteredResult(_0x30998f,_0xc434a8){return function(_0x337caf){if(_0x337caf){var _0x5a7735=_0x337caf['count'],_0x50cc01=_0xc434a8['offset'],_0x354255=_0xc434a8[_0x6fb1('0x1d')]+_0xc434a8['limit'],_0x3216ef;if(_0x354255>=_0x5a7735){_0x354255=_0x5a7735;_0x3216ef=0xc8;}else{_0x3216ef=0xce;}_0x30998f[_0x6fb1('0x1b')](_0x3216ef);return _0x30998f[_0x6fb1('0x1e')]('Content-Range',_0x50cc01+'-'+_0x354255+'/'+_0x5a7735)[_0x6fb1('0x1c')](_0x337caf);}return null;};}function patchUpdates(_0x32fb52){return function(_0x22a099){try{jsonpatch[_0x6fb1('0x1f')](_0x22a099,_0x32fb52,!![]);}catch(_0x203a45){return BPromise[_0x6fb1('0x20')](_0x203a45);}return _0x22a099['save']();};}function saveUpdates(_0x47a53b,_0x1175ce){return function(_0x5db7ad){if(_0x5db7ad){return _0x5db7ad[_0x6fb1('0x21')](_0x47a53b)['then'](function(_0x20ba66){return _0x20ba66;});}return null;};}function removeEntity(_0x5c64a0,_0x204839){return function(_0x50ffe0){if(_0x50ffe0){return _0x50ffe0[_0x6fb1('0x22')]()['then'](function(){_0x5c64a0['status'](0xcc)[_0x6fb1('0x1a')]();});}};}function handleEntityNotFound(_0x58abf6,_0x2ae905){return function(_0x556ea7){if(!_0x556ea7){_0x58abf6[_0x6fb1('0x19')](0x194);}return _0x556ea7;};}function handleError(_0x1505de,_0x3ce1ce){_0x3ce1ce=_0x3ce1ce||0x1f4;return function(_0x3cb041){logger[_0x6fb1('0x23')](_0x3cb041[_0x6fb1('0x24')]);if(_0x3cb041['name']){delete _0x3cb041[_0x6fb1('0x25')];}_0x1505de['status'](_0x3ce1ce)['send'](_0x3cb041);};}exports[_0x6fb1('0x26')]=function(_0x104a97,_0x36e9ca){var _0x347db3={},_0x1854e9={},_0x197efd={'count':0x0,'rows':[]};var _0x1fc73b=_[_0x6fb1('0x27')](db[_0x6fb1('0x28')]['rawAttributes'],function(_0xa898ba){return{'name':_0xa898ba[_0x6fb1('0x29')],'type':_0xa898ba[_0x6fb1('0x2a')][_0x6fb1('0x2b')]};});_0x1854e9[_0x6fb1('0x2c')]=_['map'](_0x1fc73b,_0x6fb1('0x25'));_0x1854e9[_0x6fb1('0x2d')]=_[_0x6fb1('0x2e')](_0x104a97['query']);_0x1854e9[_0x6fb1('0x2f')]=_['intersection'](_0x1854e9[_0x6fb1('0x2c')],_0x1854e9[_0x6fb1('0x2d')]);_0x347db3[_0x6fb1('0x30')]=_[_0x6fb1('0x31')](_0x1854e9[_0x6fb1('0x2c')],qs['fields'](_0x104a97['query'][_0x6fb1('0x32')]));_0x347db3[_0x6fb1('0x30')]=_0x347db3[_0x6fb1('0x30')][_0x6fb1('0x33')]?_0x347db3[_0x6fb1('0x30')]:_0x1854e9[_0x6fb1('0x2c')];if(!_0x104a97['query'][_0x6fb1('0x34')]('nolimit')){_0x347db3[_0x6fb1('0x35')]=qs[_0x6fb1('0x35')](_0x104a97[_0x6fb1('0x2d')][_0x6fb1('0x35')]);_0x347db3['offset']=qs['offset'](_0x104a97['query'][_0x6fb1('0x1d')]);}_0x347db3[_0x6fb1('0x36')]=qs[_0x6fb1('0x37')](_0x104a97[_0x6fb1('0x2d')]['sort']);_0x347db3['where']=qs[_0x6fb1('0x2f')](_[_0x6fb1('0x38')](_0x104a97[_0x6fb1('0x2d')],_0x1854e9[_0x6fb1('0x2f')]),_0x1fc73b);if(_0x104a97[_0x6fb1('0x2d')]['filter']){_0x347db3[_0x6fb1('0x39')]=_['merge'](_0x347db3[_0x6fb1('0x39')],{'$or':_[_0x6fb1('0x27')](_0x1fc73b,function(_0xe5b3f2){if(_0xe5b3f2[_0x6fb1('0x2a')]!==_0x6fb1('0x3a')){var _0x50c285={};_0x50c285[_0xe5b3f2[_0x6fb1('0x25')]]={'$like':'%'+_0x104a97[_0x6fb1('0x2d')]['filter']+'%'};return _0x50c285;}})});}_0x347db3=_[_0x6fb1('0x3b')]({},_0x347db3,_0x104a97[_0x6fb1('0x3c')]);var _0xadba86={'where':_0x347db3[_0x6fb1('0x39')]};return db['AnalyticFieldReport'][_0x6fb1('0x3d')](_0xadba86)[_0x6fb1('0x3e')](function(_0x44d0c2){_0x197efd[_0x6fb1('0x3d')]=_0x44d0c2;if(_0x104a97['query']['includeAll']){_0x347db3[_0x6fb1('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x6fb1('0x40')](_0x347db3);})['then'](function(_0x1389b7){_0x197efd['rows']=_0x1389b7;return _0x197efd;})[_0x6fb1('0x3e')](respondWithFilteredResult(_0x36e9ca,_0x347db3))[_0x6fb1('0x41')](handleError(_0x36e9ca,null));};exports[_0x6fb1('0x42')]=function(_0x23d205,_0x253f3f){var _0x903c54={'raw':![],'where':{'id':_0x23d205[_0x6fb1('0x43')]['id']}},_0x5c6f0c={};_0x5c6f0c[_0x6fb1('0x2c')]=_[_0x6fb1('0x2e')](db[_0x6fb1('0x28')]['rawAttributes']);_0x5c6f0c['query']=_[_0x6fb1('0x2e')](_0x23d205['query']);_0x5c6f0c[_0x6fb1('0x2f')]=_[_0x6fb1('0x31')](_0x5c6f0c[_0x6fb1('0x2c')],_0x5c6f0c['query']);_0x903c54[_0x6fb1('0x30')]=_['intersection'](_0x5c6f0c['model'],qs[_0x6fb1('0x32')](_0x23d205[_0x6fb1('0x2d')][_0x6fb1('0x32')]));_0x903c54['attributes']=_0x903c54['attributes'][_0x6fb1('0x33')]?_0x903c54['attributes']:_0x5c6f0c['model'];if(_0x23d205[_0x6fb1('0x2d')][_0x6fb1('0x44')]){_0x903c54[_0x6fb1('0x3f')]=[{'all':!![]}];}_0x903c54=_[_0x6fb1('0x3b')]({},_0x903c54,_0x23d205[_0x6fb1('0x3c')]);return db[_0x6fb1('0x28')]['find'](_0x903c54)[_0x6fb1('0x3e')](handleEntityNotFound(_0x253f3f,null))[_0x6fb1('0x3e')](respondWithResult(_0x253f3f,null))[_0x6fb1('0x41')](handleError(_0x253f3f,null));};exports[_0x6fb1('0x45')]=function(_0x1248cb,_0x389b06){return db['AnalyticFieldReport'][_0x6fb1('0x45')](_0x1248cb[_0x6fb1('0x46')],{})['then'](respondWithResult(_0x389b06,0xc9))[_0x6fb1('0x41')](handleError(_0x389b06,null));};exports[_0x6fb1('0x47')]=function(_0x3c3a41,_0x2f12de){return db['AnalyticFieldReport'][_0x6fb1('0x47')](_0x3c3a41[_0x6fb1('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2f12de,0xc9))[_0x6fb1('0x41')](handleError(_0x2f12de,null));};exports['update']=function(_0x1b84b7,_0x41200e){if(_0x1b84b7[_0x6fb1('0x46')]['id']){delete _0x1b84b7[_0x6fb1('0x46')]['id'];}return db[_0x6fb1('0x28')][_0x6fb1('0x48')]({'where':{'id':_0x1b84b7[_0x6fb1('0x43')]['id']}})['then'](handleEntityNotFound(_0x41200e,null))['then'](saveUpdates(_0x1b84b7['body'],null))[_0x6fb1('0x3e')](respondWithResult(_0x41200e,null))[_0x6fb1('0x41')](handleError(_0x41200e,null));};exports[_0x6fb1('0x22')]=function(_0x5e3606,_0x266752){return db[_0x6fb1('0x28')][_0x6fb1('0x48')]({'where':{'id':_0x5e3606[_0x6fb1('0x43')]['id']}})[_0x6fb1('0x3e')](handleEntityNotFound(_0x266752,null))[_0x6fb1('0x3e')](removeEntity(_0x266752,null))[_0x6fb1('0x41')](handleError(_0x266752,null));};exports['bulkDestroy']=function(_0x46c9fb,_0x25feb0){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x46c9fb['query'][_0x6fb1('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x6fb1('0x3e')](respondWithResult(_0x25feb0,0xcc))[_0x6fb1('0x41')](handleError(_0x25feb0,null));};exports[_0x6fb1('0x4a')]=function(_0x1f3adf,_0x31b386,_0x4d932d){return db[_0x6fb1('0x4b')][_0x6fb1('0x4c')]({'where':{'id':_0x1f3adf[_0x6fb1('0x43')]['id']}})[_0x6fb1('0x3e')](handleEntityNotFound(_0x31b386,null))[_0x6fb1('0x3e')](function(_0x1f1350){if(_0x1f1350){return db['sequelize'][_0x6fb1('0x4d')](function(_0x348ec5){return db[_0x6fb1('0x28')][_0x6fb1('0x22')]({'where':{'CustomReportId':_0x1f3adf[_0x6fb1('0x43')]['id']},'transaction':_0x348ec5})[_0x6fb1('0x3e')](function(_0xbce80c){var _0x14bf05=_[_0x6fb1('0x27')](_0x1f3adf['body'],function(_0x51689a){delete _0x51689a['id'];_0x51689a['CustomReportId']=_0x1f3adf[_0x6fb1('0x43')]['id'];return _0x51689a;});return db[_0x6fb1('0x28')][_0x6fb1('0x47')](_0x14bf05,{'transaction':_0x348ec5});});})[_0x6fb1('0x3e')](function(){return db[_0x6fb1('0x28')][_0x6fb1('0x40')]({'where':{'CustomReportId':_0x1f3adf[_0x6fb1('0x43')]['id']}});});}})[_0x6fb1('0x3e')](respondWithResult(_0x31b386,null))[_0x6fb1('0x41')](handleError(_0x31b386,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9e8e725..d5f62da 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 _0xe8eb=['moment','bluebird','rimraf','../../config/environment','exports','AnalyticFieldReport','lodash','util','../../config/logger','api'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xe8eb,0x1f0));var _0xbe8e=function(_0x39f0b3,_0xf0b06d){_0x39f0b3=_0x39f0b3-0x0;var _0x370168=_0xe8eb[_0x39f0b3];return _0x370168;};'use strict';var _=require(_0xbe8e('0x0'));var util=require(_0xbe8e('0x1'));var logger=require(_0xbe8e('0x2'))(_0xbe8e('0x3'));var moment=require(_0xbe8e('0x4'));var BPromise=require(_0xbe8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe8e('0x6'));var config=require(_0xbe8e('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xbe8e('0x8')]=function(_0x599b63,_0x2f53f1){return _0x599b63['define'](_0xbe8e('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x452e=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash'];(function(_0x291b93,_0x44b715){var _0x4183c8=function(_0x228c59){while(--_0x228c59){_0x291b93['push'](_0x291b93['shift']());}};_0x4183c8(++_0x44b715);}(_0x452e,0x1d3));var _0xe452=function(_0x5a4dcc,_0xd118e7){_0x5a4dcc=_0x5a4dcc-0x0;var _0x41389c=_0x452e[_0x5a4dcc];return _0x41389c;};'use strict';var _=require(_0xe452('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe452('0x1'));var rp=require(_0xe452('0x2'));var fs=require('fs');var path=require(_0xe452('0x3'));var rimraf=require(_0xe452('0x4'));var config=require(_0xe452('0x5'));var attributes=require(_0xe452('0x6'));module[_0xe452('0x7')]=function(_0x517ab7,_0x57e310){return _0x517ab7['define']('AnalyticFieldReport',attributes,{'tableName':_0xe452('0x8'),'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 3102c0f..5f2669f 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 _0x6355=['http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x325e27,_0x14e6b4){var _0x57eda6=function(_0x3609b7){while(--_0x3609b7){_0x325e27['push'](_0x325e27['shift']());}};_0x57eda6(++_0x14e6b4);}(_0x6355,0x198));var _0x5635=function(_0x39abd3,_0x4c8404){_0x39abd3=_0x39abd3-0x0;var _0x18732e=_0x6355[_0x39abd3];return _0x18732e;};'use strict';var _=require('lodash');var util=require(_0x5635('0x0'));var moment=require(_0x5635('0x1'));var BPromise=require(_0x5635('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5635('0x3'));var db=require(_0x5635('0x4'))['db'];var utils=require(_0x5635('0x5'));var logger=require(_0x5635('0x6'))(_0x5635('0x7'));var config=require(_0x5635('0x8'));var jayson=require(_0x5635('0x9'));var client=jayson['client'][_0x5635('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d1ca,_0x316e57,_0x13df85){return new BPromise(function(_0x55da43,_0x3b84c2){return client[_0x5635('0xb')](_0x24d1ca,_0x13df85)['then'](function(_0x1f570e){logger[_0x5635('0xc')](_0x5635('0xd'),_0x316e57,_0x5635('0xe'));logger['debug'](_0x5635('0xf'),_0x316e57,_0x5635('0xe'),JSON[_0x5635('0x10')](_0x1f570e));if(_0x1f570e[_0x5635('0x11')]){if(_0x1f570e['error'][_0x5635('0x12')]===0x1f4){logger[_0x5635('0x11')](_0x5635('0xd'),_0x316e57,_0x1f570e[_0x5635('0x11')][_0x5635('0x13')]);return _0x3b84c2(_0x1f570e[_0x5635('0x11')]['message']);}logger[_0x5635('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x316e57,_0x1f570e['error'][_0x5635('0x13')]);return _0x55da43(_0x1f570e[_0x5635('0x11')][_0x5635('0x13')]);}else{logger['info'](_0x5635('0xd'),_0x316e57,_0x5635('0xe'));_0x55da43(_0x1f570e[_0x5635('0x14')][_0x5635('0x13')]);}})[_0x5635('0x15')](function(_0xe646d){logger['error'](_0x5635('0xd'),_0x316e57,_0xe646d);_0x3b84c2(_0xe646d);});});} \ No newline at end of file +var _0xf37f=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x2f2f53,_0x43ea96){var _0x32d41a=function(_0x48da17){while(--_0x48da17){_0x2f2f53['push'](_0x2f2f53['shift']());}};_0x32d41a(++_0x43ea96);}(_0xf37f,0x1bb));var _0xff37=function(_0x2ab3fb,_0x187e50){_0x2ab3fb=_0x2ab3fb-0x0;var _0x177fe6=_0xf37f[_0x2ab3fb];return _0x177fe6;};'use strict';var _=require(_0xff37('0x0'));var util=require('util');var moment=require(_0xff37('0x1'));var BPromise=require(_0xff37('0x2'));var rs=require(_0xff37('0x3'));var fs=require('fs');var Redis=require(_0xff37('0x4'));var db=require(_0xff37('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff37('0x6'))(_0xff37('0x7'));var config=require(_0xff37('0x8'));var jayson=require(_0xff37('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a94b5,_0x3c78b6,_0x1f7e3f){return new BPromise(function(_0x3d8a05,_0x46e25e){return client['request'](_0x5a94b5,_0x1f7e3f)['then'](function(_0x31a7ae){logger[_0xff37('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3c78b6,_0xff37('0xb'));logger[_0xff37('0xc')](_0xff37('0xd'),_0x3c78b6,_0xff37('0xb'),JSON['stringify'](_0x31a7ae));if(_0x31a7ae[_0xff37('0xe')]){if(_0x31a7ae[_0xff37('0xe')][_0xff37('0xf')]===0x1f4){logger[_0xff37('0xe')](_0xff37('0x10'),_0x3c78b6,_0x31a7ae[_0xff37('0xe')][_0xff37('0x11')]);return _0x46e25e(_0x31a7ae[_0xff37('0xe')][_0xff37('0x11')]);}logger[_0xff37('0xe')](_0xff37('0x10'),_0x3c78b6,_0x31a7ae[_0xff37('0xe')][_0xff37('0x11')]);return _0x3d8a05(_0x31a7ae[_0xff37('0xe')][_0xff37('0x11')]);}else{logger[_0xff37('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3c78b6,_0xff37('0xb'));_0x3d8a05(_0x31a7ae[_0xff37('0x12')]['message']);}})[_0xff37('0x13')](function(_0x76b12b){logger['error'](_0xff37('0x10'),_0x3c78b6,_0x76b12b);_0x46e25e(_0x76b12b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 90f14cd..2311443 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 _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x32dcd8,_0x23fa22){var _0x3e9868=function(_0x4f9a58){while(--_0x4f9a58){_0x32dcd8['push'](_0x32dcd8['shift']());}};_0x3e9868(++_0x23fa22);}(_0x3e74,0x175));var _0x43e7=function(_0x4aaac7,_0x177802){_0x4aaac7=_0x4aaac7-0x0;var _0x589515=_0x3e74[_0x4aaac7];return _0x589515;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +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(_0x390506,_0x4c1348){var _0x9bb003=function(_0x3a2d53){while(--_0x3a2d53){_0x390506['push'](_0x390506['shift']());}};_0x9bb003(++_0x4c1348);}(_0x814b,0x1a2));var _0xb814=function(_0x2302a1,_0x4bc33d){_0x2302a1=_0x2302a1-0x0;var _0x413cae=_0x814b[_0x2302a1];return _0x413cae;};'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 fc2fd0b..7982c01 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 _0xbd5f=['exports','STRING','sequelize'];(function(_0x463a03,_0x13914f){var _0x5baa30=function(_0xa6d459){while(--_0xa6d459){_0x463a03['push'](_0x463a03['shift']());}};_0x5baa30(++_0x13914f);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x57bdec,_0x49e152){_0x57bdec=_0x57bdec-0x0;var _0x272d7a=_0xbd5f[_0x57bdec];return _0x272d7a;};'use strict';var Sequelize=require(_0xfbd5('0x0'));module[_0xfbd5('0x1')]={'name':{'type':Sequelize[_0xfbd5('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xfbd5('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xfbd5('0x2')]}}; \ No newline at end of file +var _0xc7a7=['TEXT','sequelize','exports','STRING'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xc7a7,0x171));var _0x7c7a=function(_0x44d7d9,_0x17a3d1){_0x44d7d9=_0x44d7d9-0x0;var _0x22ee20=_0xc7a7[_0x44d7d9];return _0x22ee20;};'use strict';var Sequelize=require(_0x7c7a('0x0'));module[_0x7c7a('0x1')]={'name':{'type':Sequelize[_0x7c7a('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7c7a('0x2')]},'metric':{'type':Sequelize[_0x7c7a('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 329e6d3..99809cc 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 _0x937d=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x937d,0x1f4));var _0xd937=function(_0x113bdb,_0x3e98d7){_0x113bdb=_0x113bdb-0x0;var _0x6c89e9=_0x937d[_0x113bdb];return _0x6c89e9;};'use strict';var pdf=require(_0xd937('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd937('0x1'));var rp=require(_0xd937('0x2'));var moment=require(_0xd937('0x3'));var BPromise=require(_0xd937('0x4'));var Mustache=require(_0xd937('0x5'));var util=require(_0xd937('0x6'));var path=require('path');var sox=require(_0xd937('0x7'));var csv=require(_0xd937('0x8'));var ejs=require(_0xd937('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd937('0xa'));var crypto=require(_0xd937('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd937('0xc'));var toCsv=require(_0xd937('0x8'));var querystring=require(_0xd937('0xd'));var Papa=require(_0xd937('0xe'));var Redis=require(_0xd937('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd937('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd937('0x11'));var logger=require('../../config/logger')(_0xd937('0x12'));var utils=require(_0xd937('0x13'));var config=require(_0xd937('0x14'));var db=require(_0xd937('0x15'))['db'];function respondWithStatusCode(_0xac1bac,_0x518621){_0x518621=_0x518621||0xcc;return function(_0xb3a15a){if(_0xb3a15a){return _0xac1bac[_0xd937('0x16')](_0x518621);}return _0xac1bac[_0xd937('0x17')](_0x518621)[_0xd937('0x18')]();};}function respondWithResult(_0x1c1165,_0x5361d){_0x5361d=_0x5361d||0xc8;return function(_0x3e9e5b){if(_0x3e9e5b){return _0x1c1165[_0xd937('0x17')](_0x5361d)[_0xd937('0x19')](_0x3e9e5b);}};}function respondWithFilteredResult(_0x21b87d,_0x5e9642){return function(_0x2f5ef4){if(_0x2f5ef4){var _0x10910c=_0x2f5ef4[_0xd937('0x1a')],_0x295a82=_0x5e9642[_0xd937('0x1b')],_0x569a9e=_0x5e9642['offset']+_0x5e9642[_0xd937('0x1c')],_0x3786f1;if(_0x569a9e>=_0x10910c){_0x569a9e=_0x10910c;_0x3786f1=0xc8;}else{_0x3786f1=0xce;}_0x21b87d[_0xd937('0x17')](_0x3786f1);return _0x21b87d[_0xd937('0x1d')](_0xd937('0x1e'),_0x295a82+'-'+_0x569a9e+'/'+_0x10910c)[_0xd937('0x19')](_0x2f5ef4);}return null;};}function patchUpdates(_0x4253b9){return function(_0x14cf1d){try{jsonpatch[_0xd937('0x1f')](_0x14cf1d,_0x4253b9,!![]);}catch(_0x27a1d2){return BPromise[_0xd937('0x20')](_0x27a1d2);}return _0x14cf1d[_0xd937('0x21')]();};}function saveUpdates(_0x302723,_0x2c18ea){return function(_0x166cb9){if(_0x166cb9){return _0x166cb9[_0xd937('0x22')](_0x302723)[_0xd937('0x23')](function(_0x2432e6){return _0x2432e6;});}return null;};}function removeEntity(_0x57fd07,_0x7362d9){return function(_0x168f3e){if(_0x168f3e){return _0x168f3e[_0xd937('0x24')]()[_0xd937('0x23')](function(){var _0x21b650=_0x168f3e[_0xd937('0x25')]({'plain':!![]});var _0x475080=_0xd937('0x26');return db[_0xd937('0x27')][_0xd937('0x24')]({'where':{'type':_0x475080,'resourceId':_0x21b650['id']}})[_0xd937('0x23')](function(){return _0x168f3e;});})['then'](function(){_0x57fd07['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ed55,_0x1d5a26){return function(_0x5ef39f){if(!_0x5ef39f){_0x22ed55[_0xd937('0x16')](0x194);}return _0x5ef39f;};}function handleError(_0x2a741b,_0x15919f){_0x15919f=_0x15919f||0x1f4;return function(_0x58ac18){logger['error'](_0x58ac18[_0xd937('0x28')]);if(_0x58ac18[_0xd937('0x29')]){delete _0x58ac18[_0xd937('0x29')];}_0x2a741b[_0xd937('0x17')](_0x15919f)[_0xd937('0x2a')](_0x58ac18);};}exports[_0xd937('0x2b')]=function(_0x291fb7,_0x2d29c0){var _0x40b26b={},_0x33b7d9={},_0x11aa02={'count':0x0,'rows':[]};var _0x514136=_[_0xd937('0x2c')](db[_0xd937('0x2d')][_0xd937('0x2e')],function(_0x11de50){return{'name':_0x11de50['fieldName'],'type':_0x11de50[_0xd937('0x2f')][_0xd937('0x30')]};});_0x33b7d9[_0xd937('0x31')]=_[_0xd937('0x2c')](_0x514136,_0xd937('0x29'));_0x33b7d9[_0xd937('0x32')]=_[_0xd937('0x33')](_0x291fb7[_0xd937('0x32')]);_0x33b7d9[_0xd937('0x34')]=_[_0xd937('0x35')](_0x33b7d9[_0xd937('0x31')],_0x33b7d9[_0xd937('0x32')]);_0x40b26b[_0xd937('0x36')]=_[_0xd937('0x35')](_0x33b7d9['model'],qs['fields'](_0x291fb7[_0xd937('0x32')][_0xd937('0x37')]));_0x40b26b[_0xd937('0x36')]=_0x40b26b[_0xd937('0x36')][_0xd937('0x38')]?_0x40b26b[_0xd937('0x36')]:_0x33b7d9[_0xd937('0x31')];if(!_0x291fb7[_0xd937('0x32')][_0xd937('0x39')](_0xd937('0x3a'))){_0x40b26b[_0xd937('0x1c')]=qs['limit'](_0x291fb7['query']['limit']);_0x40b26b[_0xd937('0x1b')]=qs['offset'](_0x291fb7[_0xd937('0x32')]['offset']);}_0x40b26b[_0xd937('0x3b')]=qs[_0xd937('0x3c')](_0x291fb7[_0xd937('0x32')][_0xd937('0x3c')]);_0x40b26b[_0xd937('0x3d')]=qs[_0xd937('0x34')](_[_0xd937('0x3e')](_0x291fb7[_0xd937('0x32')],_0x33b7d9[_0xd937('0x34')]),_0x514136);if(_0x291fb7[_0xd937('0x32')][_0xd937('0x3f')]){_0x40b26b[_0xd937('0x3d')]=_[_0xd937('0x40')](_0x40b26b[_0xd937('0x3d')],{'$or':_[_0xd937('0x2c')](_0x514136,function(_0x21d05e){if(_0x21d05e[_0xd937('0x2f')]!=='VIRTUAL'){var _0x10ff94={};_0x10ff94[_0x21d05e[_0xd937('0x29')]]={'$like':'%'+_0x291fb7[_0xd937('0x32')][_0xd937('0x3f')]+'%'};return _0x10ff94;}})});}_0x40b26b=_[_0xd937('0x40')]({},_0x40b26b,_0x291fb7[_0xd937('0x41')]);var _0x4d9987={'where':_0x40b26b[_0xd937('0x3d')]};return db['AnalyticMetric'][_0xd937('0x1a')](_0x4d9987)[_0xd937('0x23')](function(_0x658799){_0x11aa02[_0xd937('0x1a')]=_0x658799;if(_0x291fb7['query'][_0xd937('0x42')]){_0x40b26b[_0xd937('0x43')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xd937('0x44')](_0x40b26b);})[_0xd937('0x23')](function(_0x240562){_0x11aa02[_0xd937('0x45')]=_0x240562;return _0x11aa02;})[_0xd937('0x23')](respondWithFilteredResult(_0x2d29c0,_0x40b26b))[_0xd937('0x46')](handleError(_0x2d29c0,null));};exports['show']=function(_0x58b070,_0x3d84ce){var _0x26b615={'raw':!![],'where':{'id':_0x58b070['params']['id']}},_0x4b4be7={};_0x4b4be7[_0xd937('0x31')]=_['keys'](db[_0xd937('0x2d')][_0xd937('0x2e')]);_0x4b4be7[_0xd937('0x32')]=_[_0xd937('0x33')](_0x58b070[_0xd937('0x32')]);_0x4b4be7[_0xd937('0x34')]=_[_0xd937('0x35')](_0x4b4be7[_0xd937('0x31')],_0x4b4be7[_0xd937('0x32')]);_0x26b615[_0xd937('0x36')]=_['intersection'](_0x4b4be7[_0xd937('0x31')],qs[_0xd937('0x37')](_0x58b070[_0xd937('0x32')][_0xd937('0x37')]));_0x26b615[_0xd937('0x36')]=_0x26b615['attributes']['length']?_0x26b615['attributes']:_0x4b4be7[_0xd937('0x31')];if(_0x58b070[_0xd937('0x32')][_0xd937('0x42')]){_0x26b615[_0xd937('0x43')]=[{'all':!![]}];}_0x26b615=_[_0xd937('0x40')]({},_0x26b615,_0x58b070[_0xd937('0x41')]);return db[_0xd937('0x2d')][_0xd937('0x47')](_0x26b615)[_0xd937('0x23')](handleEntityNotFound(_0x3d84ce,null))['then'](respondWithResult(_0x3d84ce,null))['catch'](handleError(_0x3d84ce,null));};exports[_0xd937('0x48')]=function(_0x5cbff6,_0x36dd9f){return db[_0xd937('0x2d')][_0xd937('0x48')](_0x5cbff6[_0xd937('0x49')],{})[_0xd937('0x23')](function(_0x75768b){var _0x27c5eb=_0x5cbff6[_0xd937('0x4a')][_0xd937('0x25')]({'plain':!![]});if(!_0x27c5eb)throw new Error(_0xd937('0x4b'));if(_0x27c5eb[_0xd937('0x4c')]==='user'){var _0x206ecd=_0x75768b['get']({'plain':!![]});var _0x104442=_0xd937('0x26');return db[_0xd937('0x4d')][_0xd937('0x47')]({'where':{'name':_0x104442,'userProfileId':_0x27c5eb['userProfileId']},'raw':!![]})[_0xd937('0x23')](function(_0x45621e){if(_0x45621e&&_0x45621e[_0xd937('0x4e')]===0x0){return db[_0xd937('0x27')][_0xd937('0x48')]({'name':_0x206ecd[_0xd937('0x29')],'resourceId':_0x206ecd['id'],'type':_0x45621e[_0xd937('0x29')],'sectionId':_0x45621e['id']},{})[_0xd937('0x23')](function(){return _0x75768b;});}else{return _0x75768b;}})[_0xd937('0x46')](function(_0x4f76c3){logger[_0xd937('0x4f')](_0xd937('0x50'),_0x4f76c3);throw _0x4f76c3;});}return _0x75768b;})['then'](respondWithResult(_0x36dd9f,0xc9))[_0xd937('0x46')](handleError(_0x36dd9f,null));};exports[_0xd937('0x22')]=function(_0x5aced5,_0x2c4f3e){if(_0x5aced5[_0xd937('0x49')]['id']){delete _0x5aced5['body']['id'];}return db['AnalyticMetric'][_0xd937('0x47')]({'where':{'id':_0x5aced5[_0xd937('0x51')]['id']}})[_0xd937('0x23')](handleEntityNotFound(_0x2c4f3e,null))[_0xd937('0x23')](saveUpdates(_0x5aced5[_0xd937('0x49')],null))[_0xd937('0x23')](respondWithResult(_0x2c4f3e,null))[_0xd937('0x46')](handleError(_0x2c4f3e,null));};exports[_0xd937('0x24')]=function(_0x3e8bcb,_0x1c50e9){return db[_0xd937('0x2d')][_0xd937('0x47')]({'where':{'id':_0x3e8bcb['params']['id']}})['then'](handleEntityNotFound(_0x1c50e9,null))['then'](removeEntity(_0x1c50e9,null))[_0xd937('0x46')](handleError(_0x1c50e9,null));}; \ No newline at end of file +var _0xa1cc=['error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','get','UserProfileResource','destroy'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0xa1cc,0x10f));var _0xca1c=function(_0x55e59a,_0x4139cc){_0x55e59a=_0x55e59a-0x0;var _0x455228=_0xa1cc[_0x55e59a];return _0x455228;};'use strict';var pdf=require(_0xca1c('0x0'));var emlformat=require(_0xca1c('0x1'));var rimraf=require(_0xca1c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca1c('0x3'));var rp=require(_0xca1c('0x4'));var moment=require(_0xca1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca1c('0x6'));var util=require('util');var path=require(_0xca1c('0x7'));var sox=require(_0xca1c('0x8'));var csv=require(_0xca1c('0x9'));var ejs=require(_0xca1c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1c('0xb'));var jsforce=require(_0xca1c('0xc'));var deskjs=require(_0xca1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca1c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xca1c('0xf'));var as=require(_0xca1c('0x10'));var hardwareService=require(_0xca1c('0x11'));var logger=require(_0xca1c('0x12'))(_0xca1c('0x13'));var utils=require('../../config/utils');var config=require(_0xca1c('0x14'));var db=require(_0xca1c('0x15'))['db'];function respondWithStatusCode(_0x5d4588,_0x3029fd){_0x3029fd=_0x3029fd||0xcc;return function(_0x5d60df){if(_0x5d60df){return _0x5d4588[_0xca1c('0x16')](_0x3029fd);}return _0x5d4588[_0xca1c('0x17')](_0x3029fd)[_0xca1c('0x18')]();};}function respondWithResult(_0x55c182,_0x344d4c){_0x344d4c=_0x344d4c||0xc8;return function(_0x222a56){if(_0x222a56){return _0x55c182['status'](_0x344d4c)['json'](_0x222a56);}};}function respondWithFilteredResult(_0x305077,_0x2b55fd){return function(_0x196a66){if(_0x196a66){var _0x18e6ac=_0x196a66[_0xca1c('0x19')],_0x2644f0=_0x2b55fd[_0xca1c('0x1a')],_0x3ba29e=_0x2b55fd[_0xca1c('0x1a')]+_0x2b55fd[_0xca1c('0x1b')],_0x1347cf;if(_0x3ba29e>=_0x18e6ac){_0x3ba29e=_0x18e6ac;_0x1347cf=0xc8;}else{_0x1347cf=0xce;}_0x305077[_0xca1c('0x17')](_0x1347cf);return _0x305077[_0xca1c('0x1c')](_0xca1c('0x1d'),_0x2644f0+'-'+_0x3ba29e+'/'+_0x18e6ac)[_0xca1c('0x1e')](_0x196a66);}return null;};}function patchUpdates(_0x2c37de){return function(_0x47c9b0){try{jsonpatch[_0xca1c('0x1f')](_0x47c9b0,_0x2c37de,!![]);}catch(_0x202808){return BPromise['reject'](_0x202808);}return _0x47c9b0['save']();};}function saveUpdates(_0x13015c,_0x10f801){return function(_0x31aa79){if(_0x31aa79){return _0x31aa79[_0xca1c('0x20')](_0x13015c)[_0xca1c('0x21')](function(_0x13fa17){return _0x13fa17;});}return null;};}function removeEntity(_0x9c75a4,_0x5d23ac){return function(_0x115b4d){if(_0x115b4d){return _0x115b4d['destroy']()[_0xca1c('0x21')](function(){var _0x348c77=_0x115b4d[_0xca1c('0x22')]({'plain':!![]});var _0x40b169='Metrics';return db[_0xca1c('0x23')][_0xca1c('0x24')]({'where':{'type':_0x40b169,'resourceId':_0x348c77['id']}})['then'](function(){return _0x115b4d;});})[_0xca1c('0x21')](function(){_0x9c75a4['status'](0xcc)[_0xca1c('0x18')]();});}};}function handleEntityNotFound(_0x13ff50,_0x2868c4){return function(_0x77ea99){if(!_0x77ea99){_0x13ff50['sendStatus'](0x194);}return _0x77ea99;};}function handleError(_0x1c3056,_0xa1a686){_0xa1a686=_0xa1a686||0x1f4;return function(_0x75de96){logger[_0xca1c('0x25')](_0x75de96[_0xca1c('0x26')]);if(_0x75de96[_0xca1c('0x27')]){delete _0x75de96[_0xca1c('0x27')];}_0x1c3056['status'](_0xa1a686)[_0xca1c('0x28')](_0x75de96);};}exports['index']=function(_0x573fc,_0x31042a){var _0x4a2406={},_0xb2db36={},_0x3ffa43={'count':0x0,'rows':[]};var _0xec343f=_[_0xca1c('0x29')](db['AnalyticMetric'][_0xca1c('0x2a')],function(_0x267c92){return{'name':_0x267c92[_0xca1c('0x2b')],'type':_0x267c92[_0xca1c('0x2c')]['key']};});_0xb2db36[_0xca1c('0x2d')]=_['map'](_0xec343f,'name');_0xb2db36[_0xca1c('0x2e')]=_[_0xca1c('0x2f')](_0x573fc[_0xca1c('0x2e')]);_0xb2db36[_0xca1c('0x30')]=_[_0xca1c('0x31')](_0xb2db36['model'],_0xb2db36['query']);_0x4a2406[_0xca1c('0x32')]=_[_0xca1c('0x31')](_0xb2db36[_0xca1c('0x2d')],qs[_0xca1c('0x33')](_0x573fc[_0xca1c('0x2e')]['fields']));_0x4a2406[_0xca1c('0x32')]=_0x4a2406['attributes'][_0xca1c('0x34')]?_0x4a2406[_0xca1c('0x32')]:_0xb2db36[_0xca1c('0x2d')];if(!_0x573fc[_0xca1c('0x2e')]['hasOwnProperty'](_0xca1c('0x35'))){_0x4a2406[_0xca1c('0x1b')]=qs[_0xca1c('0x1b')](_0x573fc[_0xca1c('0x2e')][_0xca1c('0x1b')]);_0x4a2406[_0xca1c('0x1a')]=qs[_0xca1c('0x1a')](_0x573fc[_0xca1c('0x2e')][_0xca1c('0x1a')]);}_0x4a2406[_0xca1c('0x36')]=qs[_0xca1c('0x37')](_0x573fc[_0xca1c('0x2e')]['sort']);_0x4a2406[_0xca1c('0x38')]=qs[_0xca1c('0x30')](_['pick'](_0x573fc[_0xca1c('0x2e')],_0xb2db36[_0xca1c('0x30')]),_0xec343f);if(_0x573fc['query'][_0xca1c('0x39')]){_0x4a2406[_0xca1c('0x38')]=_[_0xca1c('0x3a')](_0x4a2406['where'],{'$or':_[_0xca1c('0x29')](_0xec343f,function(_0x192658){if(_0x192658['type']!==_0xca1c('0x3b')){var _0x59233b={};_0x59233b[_0x192658['name']]={'$like':'%'+_0x573fc[_0xca1c('0x2e')][_0xca1c('0x39')]+'%'};return _0x59233b;}})});}_0x4a2406=_[_0xca1c('0x3a')]({},_0x4a2406,_0x573fc['options']);var _0x16d00c={'where':_0x4a2406[_0xca1c('0x38')]};return db[_0xca1c('0x3c')][_0xca1c('0x19')](_0x16d00c)[_0xca1c('0x21')](function(_0x355451){_0x3ffa43[_0xca1c('0x19')]=_0x355451;if(_0x573fc[_0xca1c('0x2e')][_0xca1c('0x3d')]){_0x4a2406[_0xca1c('0x3e')]=[{'all':!![]}];}return db[_0xca1c('0x3c')][_0xca1c('0x3f')](_0x4a2406);})[_0xca1c('0x21')](function(_0x9ce40e){_0x3ffa43[_0xca1c('0x40')]=_0x9ce40e;return _0x3ffa43;})[_0xca1c('0x21')](respondWithFilteredResult(_0x31042a,_0x4a2406))['catch'](handleError(_0x31042a,null));};exports[_0xca1c('0x41')]=function(_0x3f81ae,_0x55fb2a){var _0x34609c={'raw':!![],'where':{'id':_0x3f81ae[_0xca1c('0x42')]['id']}},_0x14e75a={};_0x14e75a[_0xca1c('0x2d')]=_[_0xca1c('0x2f')](db[_0xca1c('0x3c')][_0xca1c('0x2a')]);_0x14e75a['query']=_['keys'](_0x3f81ae[_0xca1c('0x2e')]);_0x14e75a[_0xca1c('0x30')]=_[_0xca1c('0x31')](_0x14e75a['model'],_0x14e75a[_0xca1c('0x2e')]);_0x34609c[_0xca1c('0x32')]=_['intersection'](_0x14e75a[_0xca1c('0x2d')],qs[_0xca1c('0x33')](_0x3f81ae[_0xca1c('0x2e')][_0xca1c('0x33')]));_0x34609c['attributes']=_0x34609c[_0xca1c('0x32')]['length']?_0x34609c[_0xca1c('0x32')]:_0x14e75a['model'];if(_0x3f81ae[_0xca1c('0x2e')][_0xca1c('0x3d')]){_0x34609c['include']=[{'all':!![]}];}_0x34609c=_['merge']({},_0x34609c,_0x3f81ae[_0xca1c('0x43')]);return db[_0xca1c('0x3c')][_0xca1c('0x44')](_0x34609c)[_0xca1c('0x21')](handleEntityNotFound(_0x55fb2a,null))[_0xca1c('0x21')](respondWithResult(_0x55fb2a,null))[_0xca1c('0x45')](handleError(_0x55fb2a,null));};exports[_0xca1c('0x46')]=function(_0x227a80,_0x5e6fb1){return db[_0xca1c('0x3c')][_0xca1c('0x46')](_0x227a80[_0xca1c('0x47')],{})[_0xca1c('0x21')](function(_0x2b1140){var _0x166d45=_0x227a80[_0xca1c('0x48')][_0xca1c('0x22')]({'plain':!![]});if(!_0x166d45)throw new Error(_0xca1c('0x49'));if(_0x166d45[_0xca1c('0x4a')]===_0xca1c('0x48')){var _0x584df6=_0x2b1140[_0xca1c('0x22')]({'plain':!![]});var _0x29e65a=_0xca1c('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x29e65a,'userProfileId':_0x166d45[_0xca1c('0x4c')]},'raw':!![]})[_0xca1c('0x21')](function(_0x2b4eb4){if(_0x2b4eb4&&_0x2b4eb4['autoAssociation']===0x0){return db['UserProfileResource'][_0xca1c('0x46')]({'name':_0x584df6[_0xca1c('0x27')],'resourceId':_0x584df6['id'],'type':_0x2b4eb4['name'],'sectionId':_0x2b4eb4['id']},{})[_0xca1c('0x21')](function(){return _0x2b1140;});}else{return _0x2b1140;}})['catch'](function(_0xb75be3){logger[_0xca1c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb75be3);throw _0xb75be3;});}return _0x2b1140;})[_0xca1c('0x21')](respondWithResult(_0x5e6fb1,0xc9))[_0xca1c('0x45')](handleError(_0x5e6fb1,null));};exports[_0xca1c('0x20')]=function(_0x479629,_0x3c7fc9){if(_0x479629[_0xca1c('0x47')]['id']){delete _0x479629['body']['id'];}return db[_0xca1c('0x3c')]['find']({'where':{'id':_0x479629['params']['id']}})['then'](handleEntityNotFound(_0x3c7fc9,null))[_0xca1c('0x21')](saveUpdates(_0x479629['body'],null))[_0xca1c('0x21')](respondWithResult(_0x3c7fc9,null))[_0xca1c('0x45')](handleError(_0x3c7fc9,null));};exports[_0xca1c('0x24')]=function(_0x269014,_0x16633b){return db[_0xca1c('0x3c')]['find']({'where':{'id':_0x269014[_0xca1c('0x42')]['id']}})[_0xca1c('0x21')](handleEntityNotFound(_0x16633b,null))[_0xca1c('0x21')](removeEntity(_0x16633b,null))[_0xca1c('0x45')](handleError(_0x16633b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5ef7242..e07ed57 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 _0xfdc0=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2fa435,_0x3db1a9){var _0x22573b=function(_0x1baa7e){while(--_0x1baa7e){_0x2fa435['push'](_0x2fa435['shift']());}};_0x22573b(++_0x3db1a9);}(_0xfdc0,0x171));var _0x0fdc=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0xfdc0[_0x8b631b];return _0x3e6832;};'use strict';var _=require(_0x0fdc('0x0'));var util=require('util');var logger=require(_0x0fdc('0x1'))(_0x0fdc('0x2'));var moment=require(_0x0fdc('0x3'));var BPromise=require(_0x0fdc('0x4'));var rp=require(_0x0fdc('0x5'));var fs=require('fs');var path=require(_0x0fdc('0x6'));var rimraf=require(_0x0fdc('0x7'));var config=require(_0x0fdc('0x8'));var attributes=require(_0x0fdc('0x9'));module['exports']=function(_0x43fcea,_0x1a8468){return _0x43fcea[_0x0fdc('0xa')](_0x0fdc('0xb'),attributes,{'tableName':_0x0fdc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63df=['analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0x63df,0x160));var _0xf63d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf63d('0x0'));var util=require(_0xf63d('0x1'));var logger=require(_0xf63d('0x2'))(_0xf63d('0x3'));var moment=require('moment');var BPromise=require(_0xf63d('0x4'));var rp=require(_0xf63d('0x5'));var fs=require('fs');var path=require(_0xf63d('0x6'));var rimraf=require(_0xf63d('0x7'));var config=require(_0xf63d('0x8'));var attributes=require(_0xf63d('0x9'));module[_0xf63d('0xa')]=function(_0x1e52db,_0x4ff405){return _0x1e52db[_0xf63d('0xb')]('AnalyticMetric',attributes,{'tableName':_0xf63d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index bbf4699..acbe7b9 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 _0x820a=['jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1a491c,_0xc660b2){var _0x255575=function(_0x2ae282){while(--_0x2ae282){_0x1a491c['push'](_0x1a491c['shift']());}};_0x255575(++_0xc660b2);}(_0x820a,0x109));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa820('0x0'));var moment=require(_0xa820('0x1'));var BPromise=require(_0xa820('0x2'));var rs=require(_0xa820('0x3'));var fs=require('fs');var Redis=require(_0xa820('0x4'));var db=require(_0xa820('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa820('0x6'))(_0xa820('0x7'));var config=require('../../config/environment');var jayson=require(_0xa820('0x8'));var client=jayson[_0xa820('0x9')][_0xa820('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522ba9,_0x5d3734,_0x53b4f6){return new BPromise(function(_0x509df2,_0x545245){return client[_0xa820('0xb')](_0x522ba9,_0x53b4f6)['then'](function(_0x20acd8){logger[_0xa820('0xc')](_0xa820('0xd'),_0x5d3734,_0xa820('0xe'));logger['debug'](_0xa820('0xf'),_0x5d3734,_0xa820('0xe'),JSON[_0xa820('0x10')](_0x20acd8));if(_0x20acd8[_0xa820('0x11')]){if(_0x20acd8[_0xa820('0x11')][_0xa820('0x12')]===0x1f4){logger[_0xa820('0x11')](_0xa820('0xd'),_0x5d3734,_0x20acd8[_0xa820('0x11')]['message']);return _0x545245(_0x20acd8['error'][_0xa820('0x13')]);}logger[_0xa820('0x11')](_0xa820('0xd'),_0x5d3734,_0x20acd8['error'][_0xa820('0x13')]);return _0x509df2(_0x20acd8['error'][_0xa820('0x13')]);}else{logger[_0xa820('0xc')](_0xa820('0xd'),_0x5d3734,_0xa820('0xe'));_0x509df2(_0x20acd8[_0xa820('0x14')][_0xa820('0x13')]);}})['catch'](function(_0x1f9e3d){logger[_0xa820('0x11')](_0xa820('0xd'),_0x5d3734,_0x1f9e3d);_0x545245(_0x1f9e3d);});});} \ No newline at end of file +var _0xf3e1=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x209aa3,_0x3614bb){var _0x390b11=function(_0x1468f7){while(--_0x1468f7){_0x209aa3['push'](_0x209aa3['shift']());}};_0x390b11(++_0x3614bb);}(_0xf3e1,0x107));var _0x1f3e=function(_0x5046f0,_0x143f3c){_0x5046f0=_0x5046f0-0x0;var _0x423c81=_0xf3e1[_0x5046f0];return _0x423c81;};'use strict';var _=require('lodash');var util=require(_0x1f3e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f3e('0x1'));var fs=require('fs');var Redis=require(_0x1f3e('0x2'));var db=require(_0x1f3e('0x3'))['db'];var utils=require(_0x1f3e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f3e('0x5'));var jayson=require(_0x1f3e('0x6'));var client=jayson[_0x1f3e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2460a3,_0x3ef68f,_0x5d6515){return new BPromise(function(_0x222bf1,_0x4116ae){return client[_0x1f3e('0x8')](_0x2460a3,_0x5d6515)[_0x1f3e('0x9')](function(_0x553276){logger[_0x1f3e('0xa')](_0x1f3e('0xb'),_0x3ef68f,_0x1f3e('0xc'));logger[_0x1f3e('0xd')](_0x1f3e('0xe'),_0x3ef68f,'request\x20sent',JSON[_0x1f3e('0xf')](_0x553276));if(_0x553276[_0x1f3e('0x10')]){if(_0x553276[_0x1f3e('0x10')]['code']===0x1f4){logger[_0x1f3e('0x10')](_0x1f3e('0xb'),_0x3ef68f,_0x553276[_0x1f3e('0x10')][_0x1f3e('0x11')]);return _0x4116ae(_0x553276[_0x1f3e('0x10')]['message']);}logger[_0x1f3e('0x10')](_0x1f3e('0xb'),_0x3ef68f,_0x553276[_0x1f3e('0x10')][_0x1f3e('0x11')]);return _0x222bf1(_0x553276[_0x1f3e('0x10')]['message']);}else{logger[_0x1f3e('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x3ef68f,_0x1f3e('0xc'));_0x222bf1(_0x553276[_0x1f3e('0x12')][_0x1f3e('0x11')]);}})[_0x1f3e('0x13')](function(_0x23b7e8){logger[_0x1f3e('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3ef68f,_0x23b7e8);_0x4116ae(_0x23b7e8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ea4e3d5..0e80404 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 _0xc2c7=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id'];(function(_0x1aa787,_0x39d95c){var _0x4ba7e1=function(_0x4e122a){while(--_0x4e122a){_0x1aa787['push'](_0x1aa787['shift']());}};_0x4ba7e1(++_0x39d95c);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3e721e,_0x79d83){_0x3e721e=_0x3e721e-0x0;var _0x922d13=_0xc2c7[_0x3e721e];return _0x922d13;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var auth=require(_0x7c2c('0x5'));var interaction=require(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x9')]);router[_0x7c2c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7c2c('0xb')]('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xd')](_0x7c2c('0xe'),auth['isAuthenticated'](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x10')](_0x7c2c('0xe'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x11')]);module[_0x7c2c('0x12')]=router; \ No newline at end of file +var _0xadb5=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x382795,_0x43869f){var _0x468b22=function(_0xd5f3b){while(--_0xd5f3b){_0x382795['push'](_0x382795['shift']());}};_0x468b22(++_0x43869f);}(_0xadb5,0xad));var _0x5adb=function(_0x33206d,_0x2ff024){_0x33206d=_0x33206d-0x0;var _0x3abc64=_0xadb5[_0x33206d];return _0x3abc64;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router[_0x5adb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x11')]);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5a164fc..aca75df 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 _0x09d8=['sequelize'];(function(_0x4c40dd,_0x399721){var _0x38b353=function(_0x4a4950){while(--_0x4a4950){_0x4c40dd['push'](_0x4c40dd['shift']());}};_0x38b353(++_0x399721);}(_0x09d8,0x125));var _0x809d=function(_0x5d31fc,_0x51407){_0x5d31fc=_0x5d31fc-0x0;var _0x12abb5=_0x09d8[_0x5d31fc];return _0x12abb5;};'use strict';var Sequelize=require(_0x809d('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x57c1=['TEXT'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x57c1,0x1ab));var _0x157c=function(_0x51dd28,_0xf5b02){_0x51dd28=_0x51dd28-0x0;var _0x433d4d=_0x57c1[_0x51dd28];return _0x433d4d;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x157c('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 55508d6..b33521d 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 _0xe5d7=['end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x2a06bf,_0x406a88){var _0x4b407c=function(_0x48041c){while(--_0x48041c){_0x2a06bf['push'](_0x2a06bf['shift']());}};_0x4b407c(++_0x406a88);}(_0xe5d7,0xc8));var _0x7e5d=function(_0x1a12e4,_0x10e4af){_0x1a12e4=_0x1a12e4-0x0;var _0x45538c=_0xe5d7[_0x1a12e4];return _0x45538c;};'use strict';var pdf=require(_0x7e5d('0x0'));var emlformat=require(_0x7e5d('0x1'));var rimraf=require(_0x7e5d('0x2'));var zipdir=require(_0x7e5d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e5d('0x5'));var util=require(_0x7e5d('0x6'));var path=require(_0x7e5d('0x7'));var sox=require(_0x7e5d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e5d('0x9'));var squel=require('squel');var crypto=require(_0x7e5d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7e5d('0xb'));var toCsv=require(_0x7e5d('0xc'));var querystring=require(_0x7e5d('0xd'));var Papa=require(_0x7e5d('0xe'));var Redis=require(_0x7e5d('0xf'));var authService=require(_0x7e5d('0x10'));var qs=require(_0x7e5d('0x11'));var as=require(_0x7e5d('0x12'));var hardwareService=require(_0x7e5d('0x13'));var logger=require(_0x7e5d('0x14'))('api');var utils=require(_0x7e5d('0x15'));var config=require(_0x7e5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21d543,_0x42b29d){_0x42b29d=_0x42b29d||0xcc;return function(_0x5af775){if(_0x5af775){return _0x21d543[_0x7e5d('0x17')](_0x42b29d);}return _0x21d543[_0x7e5d('0x18')](_0x42b29d)[_0x7e5d('0x19')]();};}function respondWithResult(_0x3d3f12,_0xc7ae48){_0xc7ae48=_0xc7ae48||0xc8;return function(_0x40b7fa){if(_0x40b7fa){return _0x3d3f12[_0x7e5d('0x18')](_0xc7ae48)[_0x7e5d('0x1a')](_0x40b7fa);}};}function respondWithFilteredResult(_0x4ff931,_0x34500c){return function(_0x53e01a){if(_0x53e01a){var _0x16b091=_0x53e01a[_0x7e5d('0x1b')],_0x16a20c=_0x34500c['offset'],_0x62801=_0x34500c[_0x7e5d('0x1c')]+_0x34500c[_0x7e5d('0x1d')],_0x473ea8;if(_0x62801>=_0x16b091){_0x62801=_0x16b091;_0x473ea8=0xc8;}else{_0x473ea8=0xce;}_0x4ff931[_0x7e5d('0x18')](_0x473ea8);return _0x4ff931[_0x7e5d('0x1e')](_0x7e5d('0x1f'),_0x16a20c+'-'+_0x62801+'/'+_0x16b091)[_0x7e5d('0x1a')](_0x53e01a);}return null;};}function patchUpdates(_0x131d3f){return function(_0x31f2b7){try{jsonpatch[_0x7e5d('0x20')](_0x31f2b7,_0x131d3f,!![]);}catch(_0x15894a){return BPromise[_0x7e5d('0x21')](_0x15894a);}return _0x31f2b7['save']();};}function saveUpdates(_0x1562a6,_0x109201){return function(_0x560b0e){if(_0x560b0e){return _0x560b0e[_0x7e5d('0x22')](_0x1562a6)['then'](function(_0x59c06f){return _0x59c06f;});}return null;};}function removeEntity(_0xae8de8,_0x232b08){return function(_0x20b386){if(_0x20b386){return _0x20b386[_0x7e5d('0x23')]()[_0x7e5d('0x24')](function(){_0xae8de8['status'](0xcc)[_0x7e5d('0x19')]();});}};}function handleEntityNotFound(_0x5b2683,_0x334873){return function(_0x5a5d1c){if(!_0x5a5d1c){_0x5b2683[_0x7e5d('0x17')](0x194);}return _0x5a5d1c;};}function handleError(_0x23c2bf,_0x5b7ab2){_0x5b7ab2=_0x5b7ab2||0x1f4;return function(_0x3f7fa3){logger[_0x7e5d('0x25')](_0x3f7fa3['stack']);if(_0x3f7fa3[_0x7e5d('0x26')]){delete _0x3f7fa3[_0x7e5d('0x26')];}_0x23c2bf['status'](_0x5b7ab2)[_0x7e5d('0x27')](_0x3f7fa3);};}exports[_0x7e5d('0x28')]=function(_0x1f719d,_0x3df880){var _0x346681={},_0xa99d97={},_0x3bf556={'count':0x0,'rows':[]};var _0x45a008=_['map'](db[_0x7e5d('0x29')][_0x7e5d('0x2a')],function(_0x196e41){return{'name':_0x196e41[_0x7e5d('0x2b')],'type':_0x196e41[_0x7e5d('0x2c')][_0x7e5d('0x2d')]};});_0xa99d97[_0x7e5d('0x2e')]=_[_0x7e5d('0x2f')](_0x45a008,'name');_0xa99d97['query']=_[_0x7e5d('0x30')](_0x1f719d[_0x7e5d('0x31')]);_0xa99d97[_0x7e5d('0x32')]=_['intersection'](_0xa99d97[_0x7e5d('0x2e')],_0xa99d97['query']);_0x346681['attributes']=_[_0x7e5d('0x33')](_0xa99d97['model'],qs['fields'](_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x34')]));_0x346681[_0x7e5d('0x35')]=_0x346681['attributes'][_0x7e5d('0x36')]?_0x346681[_0x7e5d('0x35')]:_0xa99d97['model'];if(!_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x37')](_0x7e5d('0x38'))){_0x346681[_0x7e5d('0x1d')]=qs[_0x7e5d('0x1d')](_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x1d')]);_0x346681['offset']=qs[_0x7e5d('0x1c')](_0x1f719d['query']['offset']);}_0x346681[_0x7e5d('0x39')]=qs[_0x7e5d('0x3a')](_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x3a')]);_0x346681[_0x7e5d('0x3b')]=qs[_0x7e5d('0x32')](_[_0x7e5d('0x3c')](_0x1f719d[_0x7e5d('0x31')],_0xa99d97['filters']),_0x45a008);if(_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x3d')]){_0x346681['where']=_[_0x7e5d('0x3e')](_0x346681[_0x7e5d('0x3b')],{'$or':_[_0x7e5d('0x2f')](_0x45a008,function(_0xc49b6c){if(_0xc49b6c[_0x7e5d('0x2c')]!==_0x7e5d('0x3f')){var _0x5339aa={};_0x5339aa[_0xc49b6c[_0x7e5d('0x26')]]={'$like':'%'+_0x1f719d['query']['filter']+'%'};return _0x5339aa;}})});}_0x346681=_[_0x7e5d('0x3e')]({},_0x346681,_0x1f719d['options']);var _0x2a225a={'where':_0x346681[_0x7e5d('0x3b')]};return db[_0x7e5d('0x29')][_0x7e5d('0x1b')](_0x2a225a)[_0x7e5d('0x24')](function(_0xd86290){_0x3bf556[_0x7e5d('0x1b')]=_0xd86290;if(_0x1f719d[_0x7e5d('0x31')][_0x7e5d('0x40')]){_0x346681[_0x7e5d('0x41')]=[{'all':!![]}];}return db[_0x7e5d('0x29')][_0x7e5d('0x42')](_0x346681);})[_0x7e5d('0x24')](function(_0x256765){_0x3bf556[_0x7e5d('0x43')]=_0x256765;return _0x3bf556;})['then'](respondWithFilteredResult(_0x3df880,_0x346681))['catch'](handleError(_0x3df880,null));};exports[_0x7e5d('0x44')]=function(_0x595357,_0x1363b4){var _0x23c01f={'raw':!![],'where':{'id':_0x595357[_0x7e5d('0x45')]['id']}},_0x308f97={};_0x308f97[_0x7e5d('0x2e')]=_[_0x7e5d('0x30')](db[_0x7e5d('0x29')][_0x7e5d('0x2a')]);_0x308f97[_0x7e5d('0x31')]=_[_0x7e5d('0x30')](_0x595357[_0x7e5d('0x31')]);_0x308f97['filters']=_['intersection'](_0x308f97[_0x7e5d('0x2e')],_0x308f97[_0x7e5d('0x31')]);_0x23c01f[_0x7e5d('0x35')]=_[_0x7e5d('0x33')](_0x308f97[_0x7e5d('0x2e')],qs[_0x7e5d('0x34')](_0x595357[_0x7e5d('0x31')][_0x7e5d('0x34')]));_0x23c01f[_0x7e5d('0x35')]=_0x23c01f[_0x7e5d('0x35')]['length']?_0x23c01f[_0x7e5d('0x35')]:_0x308f97[_0x7e5d('0x2e')];if(_0x595357['query']['includeAll']){_0x23c01f[_0x7e5d('0x41')]=[{'all':!![]}];}_0x23c01f=_[_0x7e5d('0x3e')]({},_0x23c01f,_0x595357[_0x7e5d('0x46')]);return db[_0x7e5d('0x29')][_0x7e5d('0x47')](_0x23c01f)['then'](handleEntityNotFound(_0x1363b4,null))[_0x7e5d('0x24')](respondWithResult(_0x1363b4,null))[_0x7e5d('0x48')](handleError(_0x1363b4,null));};exports[_0x7e5d('0x49')]=function(_0x4408ee,_0x6c530f){return db[_0x7e5d('0x29')]['create'](_0x4408ee['body'],{})[_0x7e5d('0x24')](respondWithResult(_0x6c530f,0xc9))['catch'](handleError(_0x6c530f,null));};exports['update']=function(_0x2e27aa,_0x477d78){if(_0x2e27aa['body']['id']){delete _0x2e27aa['body']['id'];}return db['AnalyticTreeReport'][_0x7e5d('0x47')]({'where':{'id':_0x2e27aa[_0x7e5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x477d78,null))[_0x7e5d('0x24')](saveUpdates(_0x2e27aa[_0x7e5d('0x4a')],null))['then'](respondWithResult(_0x477d78,null))[_0x7e5d('0x48')](handleError(_0x477d78,null));};exports[_0x7e5d('0x23')]=function(_0x1e06ee,_0x3cdb02){return db[_0x7e5d('0x29')]['find']({'where':{'id':_0x1e06ee[_0x7e5d('0x45')]['id']}})[_0x7e5d('0x24')](handleEntityNotFound(_0x3cdb02,null))['then'](removeEntity(_0x3cdb02,null))['catch'](handleError(_0x3cdb02,null));}; \ No newline at end of file +var _0x247e=['sendStatus','error','stack','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','merge','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../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(_0xfa441d,_0x3ec966){var _0x44d7c7=function(_0x582598){while(--_0x582598){_0xfa441d['push'](_0xfa441d['shift']());}};_0x44d7c7(++_0x3ec966);}(_0x247e,0x181));var _0xe247=function(_0x2ef160,_0x5e3190){_0x2ef160=_0x2ef160-0x0;var _0x1bf26c=_0x247e[_0x2ef160];return _0x1bf26c;};'use strict';var pdf=require(_0xe247('0x0'));var emlformat=require(_0xe247('0x1'));var rimraf=require(_0xe247('0x2'));var zipdir=require(_0xe247('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe247('0x4'));var moment=require(_0xe247('0x5'));var BPromise=require(_0xe247('0x6'));var Mustache=require('mustache');var util=require(_0xe247('0x7'));var path=require(_0xe247('0x8'));var sox=require('sox');var csv=require(_0xe247('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe247('0xa'));var squel=require(_0xe247('0xb'));var crypto=require(_0xe247('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe247('0xd'));var toCsv=require(_0xe247('0x9'));var querystring=require('querystring');var Papa=require(_0xe247('0xe'));var Redis=require(_0xe247('0xf'));var authService=require(_0xe247('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe247('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe247('0x12'))(_0xe247('0x13'));var utils=require(_0xe247('0x14'));var config=require(_0xe247('0x15'));var db=require(_0xe247('0x16'))['db'];function respondWithStatusCode(_0x4c0e73,_0x992d7f){_0x992d7f=_0x992d7f||0xcc;return function(_0x2aadeb){if(_0x2aadeb){return _0x4c0e73['sendStatus'](_0x992d7f);}return _0x4c0e73['status'](_0x992d7f)[_0xe247('0x17')]();};}function respondWithResult(_0x10e71c,_0x3b8cb7){_0x3b8cb7=_0x3b8cb7||0xc8;return function(_0x2cfa27){if(_0x2cfa27){return _0x10e71c[_0xe247('0x18')](_0x3b8cb7)[_0xe247('0x19')](_0x2cfa27);}};}function respondWithFilteredResult(_0x90b357,_0x2ab9e1){return function(_0x58a6da){if(_0x58a6da){var _0x233384=_0x58a6da[_0xe247('0x1a')],_0x27ccd7=_0x2ab9e1[_0xe247('0x1b')],_0x466df5=_0x2ab9e1['offset']+_0x2ab9e1[_0xe247('0x1c')],_0x2f83c3;if(_0x466df5>=_0x233384){_0x466df5=_0x233384;_0x2f83c3=0xc8;}else{_0x2f83c3=0xce;}_0x90b357['status'](_0x2f83c3);return _0x90b357['set'](_0xe247('0x1d'),_0x27ccd7+'-'+_0x466df5+'/'+_0x233384)[_0xe247('0x19')](_0x58a6da);}return null;};}function patchUpdates(_0x466eb7){return function(_0x534202){try{jsonpatch[_0xe247('0x1e')](_0x534202,_0x466eb7,!![]);}catch(_0x3fcbe4){return BPromise[_0xe247('0x1f')](_0x3fcbe4);}return _0x534202['save']();};}function saveUpdates(_0x276045,_0x269476){return function(_0xafd3e4){if(_0xafd3e4){return _0xafd3e4[_0xe247('0x20')](_0x276045)[_0xe247('0x21')](function(_0x15776e){return _0x15776e;});}return null;};}function removeEntity(_0xc96fd6,_0x4e8b39){return function(_0x4ae299){if(_0x4ae299){return _0x4ae299[_0xe247('0x22')]()[_0xe247('0x21')](function(){_0xc96fd6[_0xe247('0x18')](0xcc)[_0xe247('0x17')]();});}};}function handleEntityNotFound(_0xf74566,_0x323fe9){return function(_0x102487){if(!_0x102487){_0xf74566[_0xe247('0x23')](0x194);}return _0x102487;};}function handleError(_0x5e3146,_0x20ebdd){_0x20ebdd=_0x20ebdd||0x1f4;return function(_0x3dc3ef){logger[_0xe247('0x24')](_0x3dc3ef[_0xe247('0x25')]);if(_0x3dc3ef['name']){delete _0x3dc3ef['name'];}_0x5e3146[_0xe247('0x18')](_0x20ebdd)[_0xe247('0x26')](_0x3dc3ef);};}exports[_0xe247('0x27')]=function(_0x22092a,_0x5bcdd7){var _0xf9e218={},_0x3d9f1f={},_0x4e2081={'count':0x0,'rows':[]};var _0x88c69=_[_0xe247('0x28')](db[_0xe247('0x29')][_0xe247('0x2a')],function(_0x595ead){return{'name':_0x595ead[_0xe247('0x2b')],'type':_0x595ead[_0xe247('0x2c')][_0xe247('0x2d')]};});_0x3d9f1f[_0xe247('0x2e')]=_[_0xe247('0x28')](_0x88c69,_0xe247('0x2f'));_0x3d9f1f[_0xe247('0x30')]=_[_0xe247('0x31')](_0x22092a[_0xe247('0x30')]);_0x3d9f1f[_0xe247('0x32')]=_[_0xe247('0x33')](_0x3d9f1f[_0xe247('0x2e')],_0x3d9f1f['query']);_0xf9e218[_0xe247('0x34')]=_[_0xe247('0x33')](_0x3d9f1f['model'],qs[_0xe247('0x35')](_0x22092a[_0xe247('0x30')][_0xe247('0x35')]));_0xf9e218[_0xe247('0x34')]=_0xf9e218['attributes'][_0xe247('0x36')]?_0xf9e218['attributes']:_0x3d9f1f[_0xe247('0x2e')];if(!_0x22092a[_0xe247('0x30')]['hasOwnProperty']('nolimit')){_0xf9e218['limit']=qs[_0xe247('0x1c')](_0x22092a[_0xe247('0x30')]['limit']);_0xf9e218[_0xe247('0x1b')]=qs[_0xe247('0x1b')](_0x22092a[_0xe247('0x30')][_0xe247('0x1b')]);}_0xf9e218[_0xe247('0x37')]=qs['sort'](_0x22092a['query'][_0xe247('0x38')]);_0xf9e218[_0xe247('0x39')]=qs['filters'](_[_0xe247('0x3a')](_0x22092a[_0xe247('0x30')],_0x3d9f1f[_0xe247('0x32')]),_0x88c69);if(_0x22092a[_0xe247('0x30')][_0xe247('0x3b')]){_0xf9e218[_0xe247('0x39')]=_['merge'](_0xf9e218[_0xe247('0x39')],{'$or':_['map'](_0x88c69,function(_0x15b47b){if(_0x15b47b[_0xe247('0x2c')]!==_0xe247('0x3c')){var _0x3f9288={};_0x3f9288[_0x15b47b[_0xe247('0x2f')]]={'$like':'%'+_0x22092a['query'][_0xe247('0x3b')]+'%'};return _0x3f9288;}})});}_0xf9e218=_['merge']({},_0xf9e218,_0x22092a[_0xe247('0x3d')]);var _0x14320c={'where':_0xf9e218['where']};return db[_0xe247('0x29')][_0xe247('0x1a')](_0x14320c)['then'](function(_0x2ab8c0){_0x4e2081[_0xe247('0x1a')]=_0x2ab8c0;if(_0x22092a['query'][_0xe247('0x3e')]){_0xf9e218['include']=[{'all':!![]}];}return db[_0xe247('0x29')][_0xe247('0x3f')](_0xf9e218);})[_0xe247('0x21')](function(_0x313b2f){_0x4e2081['rows']=_0x313b2f;return _0x4e2081;})['then'](respondWithFilteredResult(_0x5bcdd7,_0xf9e218))['catch'](handleError(_0x5bcdd7,null));};exports['show']=function(_0x1032a2,_0x54cdd7){var _0x427286={'raw':!![],'where':{'id':_0x1032a2['params']['id']}},_0x458230={};_0x458230['model']=_[_0xe247('0x31')](db[_0xe247('0x29')][_0xe247('0x2a')]);_0x458230[_0xe247('0x30')]=_['keys'](_0x1032a2[_0xe247('0x30')]);_0x458230[_0xe247('0x32')]=_[_0xe247('0x33')](_0x458230[_0xe247('0x2e')],_0x458230[_0xe247('0x30')]);_0x427286['attributes']=_[_0xe247('0x33')](_0x458230[_0xe247('0x2e')],qs[_0xe247('0x35')](_0x1032a2['query'][_0xe247('0x35')]));_0x427286[_0xe247('0x34')]=_0x427286[_0xe247('0x34')]['length']?_0x427286[_0xe247('0x34')]:_0x458230[_0xe247('0x2e')];if(_0x1032a2[_0xe247('0x30')][_0xe247('0x3e')]){_0x427286['include']=[{'all':!![]}];}_0x427286=_[_0xe247('0x40')]({},_0x427286,_0x1032a2['options']);return db[_0xe247('0x29')][_0xe247('0x41')](_0x427286)[_0xe247('0x21')](handleEntityNotFound(_0x54cdd7,null))[_0xe247('0x21')](respondWithResult(_0x54cdd7,null))[_0xe247('0x42')](handleError(_0x54cdd7,null));};exports[_0xe247('0x43')]=function(_0xb6c820,_0xba5a49){return db['AnalyticTreeReport'][_0xe247('0x43')](_0xb6c820[_0xe247('0x44')],{})['then'](respondWithResult(_0xba5a49,0xc9))[_0xe247('0x42')](handleError(_0xba5a49,null));};exports[_0xe247('0x20')]=function(_0x57207e,_0x3c2995){if(_0x57207e[_0xe247('0x44')]['id']){delete _0x57207e[_0xe247('0x44')]['id'];}return db[_0xe247('0x29')][_0xe247('0x41')]({'where':{'id':_0x57207e[_0xe247('0x45')]['id']}})[_0xe247('0x21')](handleEntityNotFound(_0x3c2995,null))[_0xe247('0x21')](saveUpdates(_0x57207e[_0xe247('0x44')],null))[_0xe247('0x21')](respondWithResult(_0x3c2995,null))[_0xe247('0x42')](handleError(_0x3c2995,null));};exports[_0xe247('0x22')]=function(_0x54a504,_0x396d0f){return db[_0xe247('0x29')]['find']({'where':{'id':_0x54a504[_0xe247('0x45')]['id']}})['then'](handleEntityNotFound(_0x396d0f,null))[_0xe247('0x21')](removeEntity(_0x396d0f,null))[_0xe247('0x42')](handleError(_0x396d0f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index dac2f8b..dc1ebb9 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 _0x7d7c=['./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x559cd9,_0x161f8a){var _0x40ca25=function(_0x348b56){while(--_0x348b56){_0x559cd9['push'](_0x559cd9['shift']());}};_0x40ca25(++_0x161f8a);}(_0x7d7c,0x1ee));var _0xc7d7=function(_0x348a2e,_0x3857a0){_0x348a2e=_0x348a2e-0x0;var _0x49b57f=_0x7d7c[_0x348a2e];return _0x49b57f;};'use strict';var _=require(_0xc7d7('0x0'));var util=require(_0xc7d7('0x1'));var logger=require(_0xc7d7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc7d7('0x3'));var fs=require('fs');var path=require(_0xc7d7('0x4'));var rimraf=require(_0xc7d7('0x5'));var config=require('../../config/environment');var attributes=require(_0xc7d7('0x6'));module[_0xc7d7('0x7')]=function(_0x4b9080,_0x3a51d4){return _0x4b9080['define'](_0xc7d7('0x8'),attributes,{'tableName':_0xc7d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd175=['api','bluebird','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0xd175,0x135));var _0x5d17=function(_0x11affa,_0x5692b9){_0x11affa=_0x11affa-0x0;var _0x25f030=_0xd175[_0x11affa];return _0x25f030;};'use strict';var _=require(_0x5d17('0x0'));var util=require(_0x5d17('0x1'));var logger=require(_0x5d17('0x2'))(_0x5d17('0x3'));var moment=require('moment');var BPromise=require(_0x5d17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d17('0x5'));var rimraf=require('rimraf');var config=require(_0x5d17('0x6'));var attributes=require(_0x5d17('0x7'));module[_0x5d17('0x8')]=function(_0x15e195,_0x1ead4b){return _0x15e195[_0x5d17('0x9')](_0x5d17('0xa'),attributes,{'tableName':_0x5d17('0xb'),'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 04fdc72..1bd5d0e 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 _0xc0b6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring'];(function(_0x1db86c,_0x571f79){var _0x5ddbb6=function(_0x20c0a2){while(--_0x20c0a2){_0x1db86c['push'](_0x1db86c['shift']());}};_0x5ddbb6(++_0x571f79);}(_0xc0b6,0x1b2));var _0x6c0b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc0b6[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x6c0b('0x0'));var util=require(_0x6c0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c0b('0x2'));var fs=require('fs');var Redis=require(_0x6c0b('0x3'));var db=require(_0x6c0b('0x4'))['db'];var utils=require(_0x6c0b('0x5'));var logger=require(_0x6c0b('0x6'))(_0x6c0b('0x7'));var config=require(_0x6c0b('0x8'));var jayson=require(_0x6c0b('0x9'));var client=jayson[_0x6c0b('0xa')][_0x6c0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d2cbc,_0x95d0d3,_0x4aafc7){return new BPromise(function(_0x57889d,_0x1f5be7){return client[_0x6c0b('0xc')](_0x4d2cbc,_0x4aafc7)[_0x6c0b('0xd')](function(_0x4ea65f){logger[_0x6c0b('0xe')](_0x6c0b('0xf'),_0x95d0d3,_0x6c0b('0x10'));logger[_0x6c0b('0x11')](_0x6c0b('0x12'),_0x95d0d3,_0x6c0b('0x10'),JSON[_0x6c0b('0x13')](_0x4ea65f));if(_0x4ea65f['error']){if(_0x4ea65f[_0x6c0b('0x14')][_0x6c0b('0x15')]===0x1f4){logger['error'](_0x6c0b('0xf'),_0x95d0d3,_0x4ea65f[_0x6c0b('0x14')][_0x6c0b('0x16')]);return _0x1f5be7(_0x4ea65f[_0x6c0b('0x14')][_0x6c0b('0x16')]);}logger[_0x6c0b('0x14')](_0x6c0b('0xf'),_0x95d0d3,_0x4ea65f['error'][_0x6c0b('0x16')]);return _0x57889d(_0x4ea65f[_0x6c0b('0x14')][_0x6c0b('0x16')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x95d0d3,_0x6c0b('0x10'));_0x57889d(_0x4ea65f['result'][_0x6c0b('0x16')]);}})['catch'](function(_0x225684){logger['error'](_0x6c0b('0xf'),_0x95d0d3,_0x225684);_0x1f5be7(_0x225684);});});} \ No newline at end of file +var _0x7d57=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x163fa6,_0x4d925b){var _0x8548de=function(_0x58f5ec){while(--_0x58f5ec){_0x163fa6['push'](_0x163fa6['shift']());}};_0x8548de(++_0x4d925b);}(_0x7d57,0x1b4));var _0x77d5=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x7d57[_0x365e54];return _0x13317a;};'use strict';var _=require(_0x77d5('0x0'));var util=require(_0x77d5('0x1'));var moment=require(_0x77d5('0x2'));var BPromise=require(_0x77d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77d5('0x4'));var db=require(_0x77d5('0x5'))['db'];var utils=require(_0x77d5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x77d5('0x7'));var jayson=require(_0x77d5('0x8'));var client=jayson[_0x77d5('0x9')][_0x77d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x342585,_0x56b3f5,_0x541be5){return new BPromise(function(_0x315d55,_0x7852ed){return client[_0x77d5('0xb')](_0x342585,_0x541be5)[_0x77d5('0xc')](function(_0x1e597b){logger[_0x77d5('0xd')](_0x77d5('0xe'),_0x56b3f5,_0x77d5('0xf'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x56b3f5,_0x77d5('0xf'),JSON[_0x77d5('0x10')](_0x1e597b));if(_0x1e597b[_0x77d5('0x11')]){if(_0x1e597b[_0x77d5('0x11')][_0x77d5('0x12')]===0x1f4){logger['error'](_0x77d5('0xe'),_0x56b3f5,_0x1e597b[_0x77d5('0x11')][_0x77d5('0x13')]);return _0x7852ed(_0x1e597b['error'][_0x77d5('0x13')]);}logger[_0x77d5('0x11')](_0x77d5('0xe'),_0x56b3f5,_0x1e597b[_0x77d5('0x11')][_0x77d5('0x13')]);return _0x315d55(_0x1e597b[_0x77d5('0x11')][_0x77d5('0x13')]);}else{logger[_0x77d5('0xd')](_0x77d5('0xe'),_0x56b3f5,_0x77d5('0xf'));_0x315d55(_0x1e597b['result'][_0x77d5('0x13')]);}})['catch'](function(_0x2061fe){logger['error'](_0x77d5('0xe'),_0x56b3f5,_0x2061fe);_0x7852ed(_0x2061fe);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f054050..1a82d6c 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 _0x75c8=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2f1220,_0x28cf1b){var _0x39ef13=function(_0x91bcf6){while(--_0x91bcf6){_0x2f1220['push'](_0x2f1220['shift']());}};_0x39ef13(++_0x28cf1b);}(_0x75c8,0xb2));var _0x875c=function(_0x246b11,_0x331109){_0x246b11=_0x246b11-0x0;var _0xba021d=_0x75c8[_0x246b11];return _0xba021d;};'use strict';var multer=require(_0x875c('0x0'));var util=require(_0x875c('0x1'));var path=require(_0x875c('0x2'));var timeout=require(_0x875c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x875c('0x4'));var interaction=require(_0x875c('0x5'));var config=require(_0x875c('0x6'));var controller=require(_0x875c('0x7'));router[_0x875c('0x8')]('/',auth[_0x875c('0x9')](),controller[_0x875c('0xa')]);router[_0x875c('0x8')](_0x875c('0xb'),auth['isAuthenticated'](),controller[_0x875c('0xc')]);router[_0x875c('0xd')]('/',auth[_0x875c('0x9')](),controller[_0x875c('0xe')]);router[_0x875c('0xf')](_0x875c('0xb'),auth[_0x875c('0x9')](),controller[_0x875c('0x10')]);router[_0x875c('0x11')](_0x875c('0xb'),auth[_0x875c('0x9')](),controller[_0x875c('0x12')]);module[_0x875c('0x13')]=router; \ No newline at end of file +var _0x0fa8=['destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0fa8,0x17c));var _0x80fa=function(_0x4441cf,_0x4509a6){_0x4441cf=_0x4441cf-0x0;var _0x3b8877=_0x0fa8[_0x4441cf];return _0x3b8877;};'use strict';var multer=require(_0x80fa('0x0'));var util=require(_0x80fa('0x1'));var path=require('path');var timeout=require(_0x80fa('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x80fa('0x3'));var interaction=require(_0x80fa('0x4'));var config=require('../../config/environment');var controller=require(_0x80fa('0x5'));router[_0x80fa('0x6')]('/',auth[_0x80fa('0x7')](),controller[_0x80fa('0x8')]);router[_0x80fa('0x6')]('/:id',auth[_0x80fa('0x7')](),controller[_0x80fa('0x9')]);router[_0x80fa('0xa')]('/',auth['isAuthenticated'](),controller[_0x80fa('0xb')]);router[_0x80fa('0xc')]('/:id',auth[_0x80fa('0x7')](),controller[_0x80fa('0xd')]);router[_0x80fa('0xe')](_0x80fa('0xf'),auth[_0x80fa('0x7')](),controller[_0x80fa('0x10')]);module[_0x80fa('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c663573..156dc8e 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 _0x305e=['sequelize','exports','STRING'];(function(_0x577b9a,_0x755ad0){var _0x3f4c9a=function(_0x55cd99){while(--_0x55cd99){_0x577b9a['push'](_0x577b9a['shift']());}};_0x3f4c9a(++_0x755ad0);}(_0x305e,0x114));var _0xe305=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x305e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe305('0x0'));module[_0xe305('0x1')]={'name':{'type':Sequelize[_0xe305('0x2')]},'basename':{'type':Sequelize[_0xe305('0x2')]},'type':{'type':Sequelize[_0xe305('0x2')]}}; \ No newline at end of file +var _0x0605=['STRING'];(function(_0x466384,_0x167f85){var _0x8b5ffd=function(_0x5ab664){while(--_0x5ab664){_0x466384['push'](_0x466384['shift']());}};_0x8b5ffd(++_0x167f85);}(_0x0605,0x15b));var _0x5060=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x0605[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5060('0x0')]},'basename':{'type':Sequelize[_0x5060('0x0')]},'type':{'type':Sequelize[_0x5060('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index db7bda3..0c2eb26 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 _0x1d74=['VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','clone','include','get','createdAt','updatedAt','omit','body','create','file','originalname','basename','filename','mimetype','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','Content-Range','json','apply','reject','save','then','destroy','status','stack','name','index','map','Attachment','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type'];(function(_0x4f5367,_0x1b461c){var _0x2cbf1c=function(_0x2b2f5a){while(--_0x2b2f5a){_0x4f5367['push'](_0x4f5367['shift']());}};_0x2cbf1c(++_0x1b461c);}(_0x1d74,0x73));var _0x41d7=function(_0x4f8560,_0x27f89c){_0x4f8560=_0x4f8560-0x0;var _0x54ef01=_0x1d74[_0x4f8560];return _0x54ef01;};'use strict';var pdf=require(_0x41d7('0x0'));var emlformat=require(_0x41d7('0x1'));var rimraf=require(_0x41d7('0x2'));var zipdir=require(_0x41d7('0x3'));var jsonpatch=require(_0x41d7('0x4'));var rp=require(_0x41d7('0x5'));var moment=require(_0x41d7('0x6'));var BPromise=require(_0x41d7('0x7'));var Mustache=require(_0x41d7('0x8'));var util=require('util');var path=require(_0x41d7('0x9'));var sox=require(_0x41d7('0xa'));var csv=require(_0x41d7('0xb'));var ejs=require(_0x41d7('0xc'));var fs=require('fs');var _=require(_0x41d7('0xd'));var squel=require(_0x41d7('0xe'));var crypto=require(_0x41d7('0xf'));var jsforce=require(_0x41d7('0x10'));var deskjs=require(_0x41d7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x41d7('0x12'));var Papa=require(_0x41d7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x41d7('0x14'));var as=require(_0x41d7('0x15'));var hardwareService=require(_0x41d7('0x16'));var logger=require(_0x41d7('0x17'))('api');var utils=require(_0x41d7('0x18'));var config=require(_0x41d7('0x19'));var db=require(_0x41d7('0x1a'))['db'];function respondWithStatusCode(_0x46b8cf,_0x2bbd40){_0x2bbd40=_0x2bbd40||0xcc;return function(_0x34f9a1){if(_0x34f9a1){return _0x46b8cf[_0x41d7('0x1b')](_0x2bbd40);}return _0x46b8cf['status'](_0x2bbd40)['end']();};}function respondWithResult(_0x434d81,_0x37841b){_0x37841b=_0x37841b||0xc8;return function(_0x194b7c){if(_0x194b7c){return _0x434d81['status'](_0x37841b)['json'](_0x194b7c);}};}function respondWithFilteredResult(_0x28cb95,_0x367ff2){return function(_0x4001d1){if(_0x4001d1){var _0x56ce82=_0x4001d1[_0x41d7('0x1c')],_0x397b8c=_0x367ff2[_0x41d7('0x1d')],_0x223bf7=_0x367ff2[_0x41d7('0x1d')]+_0x367ff2['limit'],_0x1bc8c3;if(_0x223bf7>=_0x56ce82){_0x223bf7=_0x56ce82;_0x1bc8c3=0xc8;}else{_0x1bc8c3=0xce;}_0x28cb95['status'](_0x1bc8c3);return _0x28cb95['set'](_0x41d7('0x1e'),_0x397b8c+'-'+_0x223bf7+'/'+_0x56ce82)[_0x41d7('0x1f')](_0x4001d1);}return null;};}function patchUpdates(_0x8f0464){return function(_0x564bd3){try{jsonpatch[_0x41d7('0x20')](_0x564bd3,_0x8f0464,!![]);}catch(_0x1b45c4){return BPromise[_0x41d7('0x21')](_0x1b45c4);}return _0x564bd3[_0x41d7('0x22')]();};}function saveUpdates(_0x1fa4b3,_0x13cd02){return function(_0x43ad63){if(_0x43ad63){return _0x43ad63['update'](_0x1fa4b3)[_0x41d7('0x23')](function(_0x5896b9){return _0x5896b9;});}return null;};}function removeEntity(_0x34ff48,_0x263234){return function(_0x5c7cd3){if(_0x5c7cd3){return _0x5c7cd3[_0x41d7('0x24')]()[_0x41d7('0x23')](function(){_0x34ff48[_0x41d7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d778,_0x376e39){return function(_0x363693){if(!_0x363693){_0x28d778[_0x41d7('0x1b')](0x194);}return _0x363693;};}function handleError(_0x521d22,_0x534c18){_0x534c18=_0x534c18||0x1f4;return function(_0x113eca){logger['error'](_0x113eca[_0x41d7('0x26')]);if(_0x113eca[_0x41d7('0x27')]){delete _0x113eca[_0x41d7('0x27')];}_0x521d22[_0x41d7('0x25')](_0x534c18)['send'](_0x113eca);};}exports[_0x41d7('0x28')]=function(_0x4979a4,_0x29a732){var _0xd0915={},_0x3e7c10={},_0x29111a={'count':0x0,'rows':[]};var _0xf12a2b=_[_0x41d7('0x29')](db[_0x41d7('0x2a')][_0x41d7('0x2b')],function(_0x2364d4){return{'name':_0x2364d4[_0x41d7('0x2c')],'type':_0x2364d4['type']['key']};});_0x3e7c10[_0x41d7('0x2d')]=_[_0x41d7('0x29')](_0xf12a2b,_0x41d7('0x27'));_0x3e7c10[_0x41d7('0x2e')]=_[_0x41d7('0x2f')](_0x4979a4[_0x41d7('0x2e')]);_0x3e7c10[_0x41d7('0x30')]=_[_0x41d7('0x31')](_0x3e7c10[_0x41d7('0x2d')],_0x3e7c10[_0x41d7('0x2e')]);_0xd0915[_0x41d7('0x32')]=_[_0x41d7('0x31')](_0x3e7c10['model'],qs[_0x41d7('0x33')](_0x4979a4['query']['fields']));_0xd0915[_0x41d7('0x32')]=_0xd0915[_0x41d7('0x32')][_0x41d7('0x34')]?_0xd0915[_0x41d7('0x32')]:_0x3e7c10['model'];if(!_0x4979a4[_0x41d7('0x2e')][_0x41d7('0x35')](_0x41d7('0x36'))){_0xd0915['limit']=qs[_0x41d7('0x37')](_0x4979a4['query'][_0x41d7('0x37')]);_0xd0915['offset']=qs[_0x41d7('0x1d')](_0x4979a4[_0x41d7('0x2e')]['offset']);}_0xd0915[_0x41d7('0x38')]=qs[_0x41d7('0x39')](_0x4979a4[_0x41d7('0x2e')]['sort']);_0xd0915[_0x41d7('0x3a')]=qs[_0x41d7('0x30')](_[_0x41d7('0x3b')](_0x4979a4[_0x41d7('0x2e')],_0x3e7c10[_0x41d7('0x30')]),_0xf12a2b);if(_0x4979a4['query'][_0x41d7('0x3c')]){_0xd0915['where']=_[_0x41d7('0x3d')](_0xd0915[_0x41d7('0x3a')],{'$or':_[_0x41d7('0x29')](_0xf12a2b,function(_0x340901){if(_0x340901[_0x41d7('0x3e')]!==_0x41d7('0x3f')){var _0x69a72b={};_0x69a72b[_0x340901[_0x41d7('0x27')]]={'$like':'%'+_0x4979a4[_0x41d7('0x2e')][_0x41d7('0x3c')]+'%'};return _0x69a72b;}})});}_0xd0915=_[_0x41d7('0x3d')]({},_0xd0915,_0x4979a4[_0x41d7('0x40')]);var _0x3c82c3={'where':_0xd0915[_0x41d7('0x3a')]};return db[_0x41d7('0x2a')][_0x41d7('0x1c')](_0x3c82c3)['then'](function(_0x396cc4){_0x29111a[_0x41d7('0x1c')]=_0x396cc4;if(_0x4979a4[_0x41d7('0x2e')][_0x41d7('0x41')]){_0xd0915['include']=[{'all':!![]}];}return db['Attachment'][_0x41d7('0x42')](_0xd0915);})[_0x41d7('0x23')](function(_0x549126){_0x29111a[_0x41d7('0x43')]=_0x549126;return _0x29111a;})[_0x41d7('0x23')](respondWithFilteredResult(_0x29a732,_0xd0915))['catch'](handleError(_0x29a732,null));};exports[_0x41d7('0x44')]=function(_0x18f5b5,_0x43971f){var _0x9e8a8={'raw':!![],'where':{'id':_0x18f5b5[_0x41d7('0x45')]['id']}},_0x9c57f7={};_0x9c57f7[_0x41d7('0x2d')]=_[_0x41d7('0x2f')](db['Attachment'][_0x41d7('0x2b')]);_0x9c57f7[_0x41d7('0x2e')]=_[_0x41d7('0x2f')](_0x18f5b5[_0x41d7('0x2e')]);_0x9c57f7[_0x41d7('0x30')]=_[_0x41d7('0x31')](_0x9c57f7[_0x41d7('0x2d')],_0x9c57f7[_0x41d7('0x2e')]);_0x9e8a8[_0x41d7('0x32')]=_[_0x41d7('0x31')](_0x9c57f7['model'],qs[_0x41d7('0x33')](_0x18f5b5[_0x41d7('0x2e')][_0x41d7('0x33')]));_0x9e8a8[_0x41d7('0x32')]=_0x9e8a8['attributes'][_0x41d7('0x34')]?_0x9e8a8['attributes']:_0x9c57f7['model'];if(_0x18f5b5[_0x41d7('0x2e')][_0x41d7('0x41')]){_0x9e8a8['include']=[{'all':!![]}];}_0x9e8a8=_[_0x41d7('0x3d')]({},_0x9e8a8,_0x18f5b5[_0x41d7('0x40')]);return db[_0x41d7('0x2a')][_0x41d7('0x46')](_0x9e8a8)[_0x41d7('0x23')](handleEntityNotFound(_0x43971f,null))[_0x41d7('0x23')](respondWithResult(_0x43971f,null))[_0x41d7('0x47')](handleError(_0x43971f,null));};exports[_0x41d7('0x48')]=function(_0x2bfd0f,_0x4745e5){var _0x24e312={'where':{'id':_0x2bfd0f[_0x41d7('0x45')]['id']}},_0x296d03={};_0x296d03['model']=_[_0x41d7('0x2f')](db[_0x41d7('0x2a')]['rawAttributes']);_0x24e312[_0x41d7('0x32')]=_[_0x41d7('0x31')](_0x296d03[_0x41d7('0x2d')],qs[_0x41d7('0x33')](_0x2bfd0f[_0x41d7('0x2e')]['fields']));_0x24e312[_0x41d7('0x32')]=_0x24e312[_0x41d7('0x32')]['length']?_0x24e312[_0x41d7('0x32')]:_0x296d03[_0x41d7('0x2d')];if(_0x2bfd0f[_0x41d7('0x2e')][_0x41d7('0x41')]){_0x24e312[_0x41d7('0x49')]=[{'all':!![]}];}_0x24e312=_[_0x41d7('0x3d')]({},_0x24e312,_0x2bfd0f[_0x41d7('0x40')]);return db[_0x41d7('0x2a')][_0x41d7('0x46')](_0x24e312)[_0x41d7('0x23')](handleEntityNotFound(_0x4745e5,null))[_0x41d7('0x23')](function(_0x39a4a3){if(_0x39a4a3){var _0x8be4cc=_0x39a4a3[_0x41d7('0x4a')]({'plain':!![]});_0x8be4cc=qs['omit'](_0x8be4cc,['id',_0x41d7('0x4b'),_0x41d7('0x4c')]);_0x2bfd0f['body']=_[_0x41d7('0x4d')](_0x2bfd0f[_0x41d7('0x4e')],['id',_0x41d7('0x4b'),_0x41d7('0x4c')]);return db[_0x41d7('0x2a')][_0x41d7('0x4f')](_[_0x41d7('0x3d')](_0x8be4cc,_0x2bfd0f[_0x41d7('0x4e')]),{'include':_0x2bfd0f[_0x41d7('0x2e')][_0x41d7('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4745e5,0xc9))[_0x41d7('0x47')](handleError(_0x4745e5,null));};exports['update']=function(_0x592ffc,_0x5c6fc1){if(_0x592ffc['body']['id']){delete _0x592ffc[_0x41d7('0x4e')]['id'];}return db['Attachment']['find']({'where':{'id':_0x592ffc[_0x41d7('0x45')]['id']}})[_0x41d7('0x23')](handleEntityNotFound(_0x5c6fc1,null))[_0x41d7('0x23')](saveUpdates(_0x592ffc[_0x41d7('0x4e')],null))['then'](respondWithResult(_0x5c6fc1,null))['catch'](handleError(_0x5c6fc1,null));};exports[_0x41d7('0x24')]=function(_0x13468c,_0x9ca835){return db['Attachment'][_0x41d7('0x46')]({'where':{'id':_0x13468c[_0x41d7('0x45')]['id']}})[_0x41d7('0x23')](handleEntityNotFound(_0x9ca835,null))[_0x41d7('0x23')](removeEntity(_0x9ca835,null))[_0x41d7('0x47')](handleError(_0x9ca835,null));};exports[_0x41d7('0x4f')]=function(_0x319ccf,_0x192c5a,_0x26af1d){_0x319ccf['body'][_0x41d7('0x27')]=_0x319ccf[_0x41d7('0x50')][_0x41d7('0x51')];_0x319ccf['body'][_0x41d7('0x52')]=_0x319ccf['file'][_0x41d7('0x53')];_0x319ccf['body']['type']=_0x319ccf[_0x41d7('0x50')][_0x41d7('0x54')];return db[_0x41d7('0x2a')][_0x41d7('0x4f')](_0x319ccf[_0x41d7('0x4e')])[_0x41d7('0x23')](respondWithResult(_0x192c5a,0xc9))['catch'](handleError(_0x192c5a,null));};exports[_0x41d7('0x55')]=function(_0x183eda,_0x54a367,_0x4e9680){return db[_0x41d7('0x2a')][_0x41d7('0x56')]({'where':{'id':_0x183eda[_0x41d7('0x45')]['id']},'raw':!![]})[_0x41d7('0x23')](handleEntityNotFound(_0x54a367,null))[_0x41d7('0x23')](function(_0x342a2f){if(_0x342a2f){return _0x54a367[_0x41d7('0x55')](path['join'](config[_0x41d7('0x57')],_0x41d7('0x58'),_0x342a2f[_0x41d7('0x52')]));}})['catch'](handleError(_0x54a367,null));}; \ No newline at end of file +var _0x4e0c=['originalname','file','type','mimetype','create','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','rows','catch','show','params','length','clone','find','get','omit','createdAt','updatedAt','body'];(function(_0x25b184,_0xb8e0d3){var _0x543334=function(_0x508a0c){while(--_0x508a0c){_0x25b184['push'](_0x25b184['shift']());}};_0x543334(++_0xb8e0d3);}(_0x4e0c,0x15d));var _0xc4e0=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x4e0c[_0x3aaf0a];return _0x33e6bc;};'use strict';var pdf=require(_0xc4e0('0x0'));var emlformat=require(_0xc4e0('0x1'));var rimraf=require(_0xc4e0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4e0('0x3'));var moment=require(_0xc4e0('0x4'));var BPromise=require(_0xc4e0('0x5'));var Mustache=require(_0xc4e0('0x6'));var util=require(_0xc4e0('0x7'));var path=require('path');var sox=require(_0xc4e0('0x8'));var csv=require('to-csv');var ejs=require(_0xc4e0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc4e0('0xa'));var crypto=require(_0xc4e0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc4e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc4e0('0xd'));var Papa=require(_0xc4e0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4e0('0xf'));var as=require(_0xc4e0('0x10'));var hardwareService=require(_0xc4e0('0x11'));var logger=require(_0xc4e0('0x12'))(_0xc4e0('0x13'));var utils=require('../../config/utils');var config=require(_0xc4e0('0x14'));var db=require(_0xc4e0('0x15'))['db'];function respondWithStatusCode(_0x32b5ad,_0x5647f1){_0x5647f1=_0x5647f1||0xcc;return function(_0x4e26d3){if(_0x4e26d3){return _0x32b5ad[_0xc4e0('0x16')](_0x5647f1);}return _0x32b5ad[_0xc4e0('0x17')](_0x5647f1)['end']();};}function respondWithResult(_0x2cc092,_0x4b5a72){_0x4b5a72=_0x4b5a72||0xc8;return function(_0x4f9c36){if(_0x4f9c36){return _0x2cc092[_0xc4e0('0x17')](_0x4b5a72)[_0xc4e0('0x18')](_0x4f9c36);}};}function respondWithFilteredResult(_0x20098a,_0x173fea){return function(_0xfad5f6){if(_0xfad5f6){var _0x49482b=_0xfad5f6[_0xc4e0('0x19')],_0x110a89=_0x173fea['offset'],_0x5f0d72=_0x173fea['offset']+_0x173fea[_0xc4e0('0x1a')],_0x592ba8;if(_0x5f0d72>=_0x49482b){_0x5f0d72=_0x49482b;_0x592ba8=0xc8;}else{_0x592ba8=0xce;}_0x20098a['status'](_0x592ba8);return _0x20098a[_0xc4e0('0x1b')](_0xc4e0('0x1c'),_0x110a89+'-'+_0x5f0d72+'/'+_0x49482b)[_0xc4e0('0x18')](_0xfad5f6);}return null;};}function patchUpdates(_0x23d574){return function(_0x431765){try{jsonpatch[_0xc4e0('0x1d')](_0x431765,_0x23d574,!![]);}catch(_0x45f919){return BPromise[_0xc4e0('0x1e')](_0x45f919);}return _0x431765[_0xc4e0('0x1f')]();};}function saveUpdates(_0x5df3be,_0x1eb5ec){return function(_0xe6b4b4){if(_0xe6b4b4){return _0xe6b4b4[_0xc4e0('0x20')](_0x5df3be)[_0xc4e0('0x21')](function(_0x1f27d9){return _0x1f27d9;});}return null;};}function removeEntity(_0x29937e,_0x5e16a4){return function(_0xa2cc5a){if(_0xa2cc5a){return _0xa2cc5a[_0xc4e0('0x22')]()[_0xc4e0('0x21')](function(){_0x29937e[_0xc4e0('0x17')](0xcc)[_0xc4e0('0x23')]();});}};}function handleEntityNotFound(_0x17a259,_0x322378){return function(_0x557d20){if(!_0x557d20){_0x17a259[_0xc4e0('0x16')](0x194);}return _0x557d20;};}function handleError(_0x19217b,_0x30b7bf){_0x30b7bf=_0x30b7bf||0x1f4;return function(_0x2aa386){logger['error'](_0x2aa386[_0xc4e0('0x24')]);if(_0x2aa386[_0xc4e0('0x25')]){delete _0x2aa386[_0xc4e0('0x25')];}_0x19217b[_0xc4e0('0x17')](_0x30b7bf)['send'](_0x2aa386);};}exports[_0xc4e0('0x26')]=function(_0x209a1d,_0xaa87d9){var _0x466982={},_0x216732={},_0x6adf9a={'count':0x0,'rows':[]};var _0x585dec=_[_0xc4e0('0x27')](db['Attachment'][_0xc4e0('0x28')],function(_0x997405){return{'name':_0x997405[_0xc4e0('0x29')],'type':_0x997405['type'][_0xc4e0('0x2a')]};});_0x216732[_0xc4e0('0x2b')]=_['map'](_0x585dec,_0xc4e0('0x25'));_0x216732[_0xc4e0('0x2c')]=_[_0xc4e0('0x2d')](_0x209a1d[_0xc4e0('0x2c')]);_0x216732[_0xc4e0('0x2e')]=_[_0xc4e0('0x2f')](_0x216732[_0xc4e0('0x2b')],_0x216732['query']);_0x466982[_0xc4e0('0x30')]=_[_0xc4e0('0x2f')](_0x216732[_0xc4e0('0x2b')],qs[_0xc4e0('0x31')](_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x31')]));_0x466982['attributes']=_0x466982[_0xc4e0('0x30')]['length']?_0x466982[_0xc4e0('0x30')]:_0x216732[_0xc4e0('0x2b')];if(!_0x209a1d['query'][_0xc4e0('0x32')](_0xc4e0('0x33'))){_0x466982[_0xc4e0('0x1a')]=qs[_0xc4e0('0x1a')](_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x1a')]);_0x466982[_0xc4e0('0x34')]=qs[_0xc4e0('0x34')](_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x34')]);}_0x466982[_0xc4e0('0x35')]=qs['sort'](_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x36')]);_0x466982[_0xc4e0('0x37')]=qs[_0xc4e0('0x2e')](_[_0xc4e0('0x38')](_0x209a1d[_0xc4e0('0x2c')],_0x216732[_0xc4e0('0x2e')]),_0x585dec);if(_0x209a1d['query'][_0xc4e0('0x39')]){_0x466982[_0xc4e0('0x37')]=_[_0xc4e0('0x3a')](_0x466982['where'],{'$or':_['map'](_0x585dec,function(_0x5bc5a0){if(_0x5bc5a0['type']!==_0xc4e0('0x3b')){var _0x1387d3={};_0x1387d3[_0x5bc5a0[_0xc4e0('0x25')]]={'$like':'%'+_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x39')]+'%'};return _0x1387d3;}})});}_0x466982=_[_0xc4e0('0x3a')]({},_0x466982,_0x209a1d[_0xc4e0('0x3c')]);var _0x191925={'where':_0x466982[_0xc4e0('0x37')]};return db[_0xc4e0('0x3d')][_0xc4e0('0x19')](_0x191925)[_0xc4e0('0x21')](function(_0x3fd021){_0x6adf9a['count']=_0x3fd021;if(_0x209a1d[_0xc4e0('0x2c')][_0xc4e0('0x3e')]){_0x466982[_0xc4e0('0x3f')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x466982);})[_0xc4e0('0x21')](function(_0x1ef77e){_0x6adf9a[_0xc4e0('0x40')]=_0x1ef77e;return _0x6adf9a;})[_0xc4e0('0x21')](respondWithFilteredResult(_0xaa87d9,_0x466982))[_0xc4e0('0x41')](handleError(_0xaa87d9,null));};exports[_0xc4e0('0x42')]=function(_0x4d0a90,_0x22942){var _0xa42a97={'raw':!![],'where':{'id':_0x4d0a90[_0xc4e0('0x43')]['id']}},_0x453939={};_0x453939[_0xc4e0('0x2b')]=_[_0xc4e0('0x2d')](db[_0xc4e0('0x3d')][_0xc4e0('0x28')]);_0x453939['query']=_['keys'](_0x4d0a90[_0xc4e0('0x2c')]);_0x453939[_0xc4e0('0x2e')]=_[_0xc4e0('0x2f')](_0x453939[_0xc4e0('0x2b')],_0x453939[_0xc4e0('0x2c')]);_0xa42a97[_0xc4e0('0x30')]=_[_0xc4e0('0x2f')](_0x453939[_0xc4e0('0x2b')],qs[_0xc4e0('0x31')](_0x4d0a90[_0xc4e0('0x2c')]['fields']));_0xa42a97['attributes']=_0xa42a97['attributes'][_0xc4e0('0x44')]?_0xa42a97[_0xc4e0('0x30')]:_0x453939[_0xc4e0('0x2b')];if(_0x4d0a90[_0xc4e0('0x2c')]['includeAll']){_0xa42a97[_0xc4e0('0x3f')]=[{'all':!![]}];}_0xa42a97=_[_0xc4e0('0x3a')]({},_0xa42a97,_0x4d0a90[_0xc4e0('0x3c')]);return db[_0xc4e0('0x3d')]['find'](_0xa42a97)['then'](handleEntityNotFound(_0x22942,null))[_0xc4e0('0x21')](respondWithResult(_0x22942,null))[_0xc4e0('0x41')](handleError(_0x22942,null));};exports[_0xc4e0('0x45')]=function(_0x50c889,_0xf548b6){var _0x549034={'where':{'id':_0x50c889[_0xc4e0('0x43')]['id']}},_0x5e2c2d={};_0x5e2c2d[_0xc4e0('0x2b')]=_['keys'](db['Attachment'][_0xc4e0('0x28')]);_0x549034[_0xc4e0('0x30')]=_[_0xc4e0('0x2f')](_0x5e2c2d['model'],qs['fields'](_0x50c889[_0xc4e0('0x2c')]['fields']));_0x549034['attributes']=_0x549034[_0xc4e0('0x30')][_0xc4e0('0x44')]?_0x549034[_0xc4e0('0x30')]:_0x5e2c2d[_0xc4e0('0x2b')];if(_0x50c889[_0xc4e0('0x2c')]['includeAll']){_0x549034[_0xc4e0('0x3f')]=[{'all':!![]}];}_0x549034=_[_0xc4e0('0x3a')]({},_0x549034,_0x50c889[_0xc4e0('0x3c')]);return db[_0xc4e0('0x3d')][_0xc4e0('0x46')](_0x549034)[_0xc4e0('0x21')](handleEntityNotFound(_0xf548b6,null))[_0xc4e0('0x21')](function(_0xc97d03){if(_0xc97d03){var _0xb4c06a=_0xc97d03[_0xc4e0('0x47')]({'plain':!![]});_0xb4c06a=qs[_0xc4e0('0x48')](_0xb4c06a,['id',_0xc4e0('0x49'),_0xc4e0('0x4a')]);_0x50c889[_0xc4e0('0x4b')]=_[_0xc4e0('0x48')](_0x50c889[_0xc4e0('0x4b')],['id',_0xc4e0('0x49'),'updatedAt']);return db[_0xc4e0('0x3d')]['create'](_['merge'](_0xb4c06a,_0x50c889[_0xc4e0('0x4b')]),{'include':_0x50c889[_0xc4e0('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xc4e0('0x21')](respondWithResult(_0xf548b6,0xc9))[_0xc4e0('0x41')](handleError(_0xf548b6,null));};exports[_0xc4e0('0x20')]=function(_0x3205a0,_0x49d8a4){if(_0x3205a0['body']['id']){delete _0x3205a0[_0xc4e0('0x4b')]['id'];}return db[_0xc4e0('0x3d')][_0xc4e0('0x46')]({'where':{'id':_0x3205a0[_0xc4e0('0x43')]['id']}})[_0xc4e0('0x21')](handleEntityNotFound(_0x49d8a4,null))[_0xc4e0('0x21')](saveUpdates(_0x3205a0[_0xc4e0('0x4b')],null))['then'](respondWithResult(_0x49d8a4,null))[_0xc4e0('0x41')](handleError(_0x49d8a4,null));};exports['destroy']=function(_0x380ec2,_0x2ee16b){return db[_0xc4e0('0x3d')][_0xc4e0('0x46')]({'where':{'id':_0x380ec2['params']['id']}})[_0xc4e0('0x21')](handleEntityNotFound(_0x2ee16b,null))[_0xc4e0('0x21')](removeEntity(_0x2ee16b,null))[_0xc4e0('0x41')](handleError(_0x2ee16b,null));};exports['create']=function(_0x4d3450,_0x525863,_0x336d91){_0x4d3450[_0xc4e0('0x4b')]['name']=_0x4d3450['file'][_0xc4e0('0x4c')];_0x4d3450['body']['basename']=_0x4d3450[_0xc4e0('0x4d')]['filename'];_0x4d3450[_0xc4e0('0x4b')][_0xc4e0('0x4e')]=_0x4d3450[_0xc4e0('0x4d')][_0xc4e0('0x4f')];return db['Attachment'][_0xc4e0('0x50')](_0x4d3450[_0xc4e0('0x4b')])[_0xc4e0('0x21')](respondWithResult(_0x525863,0xc9))[_0xc4e0('0x41')](handleError(_0x525863,null));};exports[_0xc4e0('0x51')]=function(_0x4f4894,_0x329720,_0x1754e9){return db['Attachment'][_0xc4e0('0x52')]({'where':{'id':_0x4f4894['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x329720,null))[_0xc4e0('0x21')](function(_0x50ffc7){if(_0x50ffc7){return _0x329720[_0xc4e0('0x51')](path['join'](config[_0xc4e0('0x53')],_0xc4e0('0x54'),_0x50ffc7['basename']));}})[_0xc4e0('0x41')](handleError(_0x329720,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ea7c5b4..22532ae 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 _0x4c4e=['moment','request-promise','path','rimraf','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x308b38,_0x33ed72){_0x308b38=_0x308b38-0x0;var _0x2d2646=_0x4c4e[_0x308b38];return _0x2d2646;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var logger=require(_0xe4c4('0x1'))(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4c4('0x4'));var fs=require('fs');var path=require(_0xe4c4('0x5'));var rimraf=require(_0xe4c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xe4c4('0x7'));module['exports']=function(_0x177732,_0x1a12a6){return _0x177732[_0xe4c4('0x8')](_0xe4c4('0x9'),attributes,{'tableName':_0xe4c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./attachment.attributes','exports','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2efa92,_0x2557f6){var _0x32704b=function(_0x190985){while(--_0x190985){_0x2efa92['push'](_0x2efa92['shift']());}};_0x32704b(++_0x2557f6);}(_0xb903,0x185));var _0x3b90=function(_0x48d6c8,_0xdff656){_0x48d6c8=_0x48d6c8-0x0;var _0x557d8a=_0xb903[_0x48d6c8];return _0x557d8a;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('Attachment',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a009265..7abfb64 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 _0xcd8b=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info'];(function(_0x350743,_0x4d2664){var _0x46360b=function(_0x151fdf){while(--_0x151fdf){_0x350743['push'](_0x350743['shift']());}};_0x46360b(++_0x4d2664);}(_0xcd8b,0x128));var _0xbcd8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xcd8b[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0xbcd8('0x0'));var moment=require(_0xbcd8('0x1'));var BPromise=require(_0xbcd8('0x2'));var rs=require(_0xbcd8('0x3'));var fs=require('fs');var Redis=require(_0xbcd8('0x4'));var db=require(_0xbcd8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbcd8('0x6'));var config=require(_0xbcd8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbcd8('0x8')][_0xbcd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x507190,_0xd711e4,_0x20dde9){return new BPromise(function(_0x40be5e,_0x4e537a){return client['request'](_0x507190,_0x20dde9)[_0xbcd8('0xa')](function(_0x4f19c9){logger[_0xbcd8('0xb')]('Attachment,\x20%s,\x20%s',_0xd711e4,_0xbcd8('0xc'));logger[_0xbcd8('0xd')](_0xbcd8('0xe'),_0xd711e4,'request\x20sent',JSON[_0xbcd8('0xf')](_0x4f19c9));if(_0x4f19c9['error']){if(_0x4f19c9[_0xbcd8('0x10')][_0xbcd8('0x11')]===0x1f4){logger['error'](_0xbcd8('0x12'),_0xd711e4,_0x4f19c9[_0xbcd8('0x10')]['message']);return _0x4e537a(_0x4f19c9[_0xbcd8('0x10')][_0xbcd8('0x13')]);}logger[_0xbcd8('0x10')]('Attachment,\x20%s,\x20%s',_0xd711e4,_0x4f19c9['error'][_0xbcd8('0x13')]);return _0x40be5e(_0x4f19c9[_0xbcd8('0x10')]['message']);}else{logger[_0xbcd8('0xb')]('Attachment,\x20%s,\x20%s',_0xd711e4,_0xbcd8('0xc'));_0x40be5e(_0x4f19c9[_0xbcd8('0x14')]['message']);}})[_0xbcd8('0x15')](function(_0x44ae28){logger['error'](_0xbcd8('0x12'),_0xd711e4,_0x44ae28);_0x4e537a(_0x44ae28);});});}exports[_0xbcd8('0x16')]=function(_0x1a82b4){var _0x12e94b=this;return new Promise(function(_0x3b11dd,_0x344ff4){return db[_0xbcd8('0x17')][_0xbcd8('0x18')](_0x1a82b4[_0xbcd8('0x19')],{'raw':_0x1a82b4[_0xbcd8('0x1a')]?_0x1a82b4[_0xbcd8('0x1a')][_0xbcd8('0x1b')]===undefined?!![]:![]:!![]})[_0xbcd8('0xa')](function(_0xa3ca31){logger[_0xbcd8('0xb')](_0xbcd8('0x16'),_0x1a82b4);logger['debug']('CreateAttachment',_0x1a82b4,JSON[_0xbcd8('0xf')](_0xa3ca31));_0x3b11dd(_0xa3ca31);})[_0xbcd8('0x15')](function(_0x21417e){logger['error'](_0xbcd8('0x16'),_0x21417e[_0xbcd8('0x13')],_0x1a82b4);_0x344ff4(_0x12e94b[_0xbcd8('0x10')](0x1f4,_0x21417e[_0xbcd8('0x13')]));});});}; \ No newline at end of file +var _0xe445=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x134918,_0x1d15eb){var _0x8e13fa=function(_0x15435b){while(--_0x15435b){_0x134918['push'](_0x134918['shift']());}};_0x8e13fa(++_0x1d15eb);}(_0xe445,0xf3));var _0x5e44=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xe445[_0x1c470d];return _0x12141b;};'use strict';var _=require(_0x5e44('0x0'));var util=require(_0x5e44('0x1'));var moment=require(_0x5e44('0x2'));var BPromise=require(_0x5e44('0x3'));var rs=require(_0x5e44('0x4'));var fs=require('fs');var Redis=require(_0x5e44('0x5'));var db=require(_0x5e44('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e44('0x7'))(_0x5e44('0x8'));var config=require(_0x5e44('0x9'));var jayson=require(_0x5e44('0xa'));var client=jayson[_0x5e44('0xb')][_0x5e44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d501b,_0x179955,_0x4b5f0b){return new BPromise(function(_0x36dc68,_0x103e5f){return client['request'](_0x1d501b,_0x4b5f0b)[_0x5e44('0xd')](function(_0x3c3d89){logger[_0x5e44('0xe')](_0x5e44('0xf'),_0x179955,_0x5e44('0x10'));logger[_0x5e44('0x11')](_0x5e44('0x12'),_0x179955,'request\x20sent',JSON[_0x5e44('0x13')](_0x3c3d89));if(_0x3c3d89['error']){if(_0x3c3d89[_0x5e44('0x14')][_0x5e44('0x15')]===0x1f4){logger[_0x5e44('0x14')](_0x5e44('0xf'),_0x179955,_0x3c3d89[_0x5e44('0x14')][_0x5e44('0x16')]);return _0x103e5f(_0x3c3d89['error']['message']);}logger[_0x5e44('0x14')](_0x5e44('0xf'),_0x179955,_0x3c3d89[_0x5e44('0x14')][_0x5e44('0x16')]);return _0x36dc68(_0x3c3d89['error'][_0x5e44('0x16')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x179955,'request\x20sent');_0x36dc68(_0x3c3d89[_0x5e44('0x17')][_0x5e44('0x16')]);}})[_0x5e44('0x18')](function(_0x2f3810){logger['error'](_0x5e44('0xf'),_0x179955,_0x2f3810);_0x103e5f(_0x2f3810);});});}exports[_0x5e44('0x19')]=function(_0x794cdc){var _0x5e78b7=this;return new Promise(function(_0x5438b0,_0x22fa2e){return db['Attachment'][_0x5e44('0x1a')](_0x794cdc[_0x5e44('0x1b')],{'raw':_0x794cdc['options']?_0x794cdc['options'][_0x5e44('0x1c')]===undefined?!![]:![]:!![]})[_0x5e44('0xd')](function(_0x2e1851){logger[_0x5e44('0xe')]('CreateAttachment',_0x794cdc);logger[_0x5e44('0x11')](_0x5e44('0x19'),_0x794cdc,JSON[_0x5e44('0x13')](_0x2e1851));_0x5438b0(_0x2e1851);})['catch'](function(_0x5a0354){logger[_0x5e44('0x14')](_0x5e44('0x19'),_0x5a0354[_0x5e44('0x16')],_0x794cdc);_0x22fa2e(_0x5e78b7[_0x5e44('0x14')](0x1f4,_0x5a0354['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4b8e474..0420e15 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 _0x85de=['originalname','replace','single','file','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','now'];(function(_0x271589,_0x59d534){var _0x406133=function(_0x16eda4){while(--_0x16eda4){_0x271589['push'](_0x271589['shift']());}};_0x406133(++_0x59d534);}(_0x85de,0x65));var _0xe85d=function(_0x35f3e0,_0xf3928d){_0x35f3e0=_0x35f3e0-0x0;var _0xaa06c2=_0x85de[_0x35f3e0];return _0xaa06c2;};'use strict';var multer=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var path=require(_0xe85d('0x2'));var timeout=require(_0xe85d('0x3'));var express=require(_0xe85d('0x4'));var router=express[_0xe85d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe85d('0x6'));var config=require(_0xe85d('0x7'));var controller=require(_0xe85d('0x8'));router[_0xe85d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe85d('0x9')](_0xe85d('0xa'),auth[_0xe85d('0xb')](),controller[_0xe85d('0xc')]);router['get'](_0xe85d('0xd'),auth[_0xe85d('0xb')](),controller[_0xe85d('0xe')]);router[_0xe85d('0xf')](_0xe85d('0x10'),auth[_0xe85d('0xb')](),controller[_0xe85d('0x11')]);var upload=multer({'storage':multer[_0xe85d('0x12')]({'destination':function(_0x16b693,_0x30988,_0x1ca3c8){_0x1ca3c8(null,path[_0xe85d('0x13')](config[_0xe85d('0x14')],_0xe85d('0x15')));},'filename':function(_0x248563,_0x233e9a,_0x157b4e){_0x157b4e(null,util['format']('%s-%s',Date[_0xe85d('0x16')](),_0x233e9a[_0xe85d('0x17')][_0xe85d('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe85d('0xf')]('/',upload[_0xe85d('0x19')](_0xe85d('0x1a')),controller[_0xe85d('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe85d('0x1c')](_0xe85d('0xa'),auth['isAuthenticated'](),controller[_0xe85d('0x1d')]);module[_0xe85d('0x1e')]=router; \ No newline at end of file +var _0x1681=['/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','file','create','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/download','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1168('0x0'));var timeout=require(_0x1168('0x1'));var express=require(_0x1168('0x2'));var router=express[_0x1168('0x3')]();var auth=require(_0x1168('0x4'));var interaction=require(_0x1168('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x1168('0x6')]('/',auth[_0x1168('0x7')](),controller['index']);router[_0x1168('0x6')](_0x1168('0x8'),auth['isAuthenticated'](),controller[_0x1168('0x9')]);router['get'](_0x1168('0xa'),auth[_0x1168('0x7')](),controller['download']);router[_0x1168('0xb')](_0x1168('0xc'),auth['isAuthenticated'](),controller[_0x1168('0xd')]);var upload=multer({'storage':multer[_0x1168('0xe')]({'destination':function(_0x4d836e,_0x5df755,_0x355409){_0x355409(null,path[_0x1168('0xf')](config[_0x1168('0x10')],_0x1168('0x11')));},'filename':function(_0x36050b,_0x50638d,_0x4123a5){_0x4123a5(null,util[_0x1168('0x12')](_0x1168('0x13'),Date[_0x1168('0x14')](),_0x50638d[_0x1168('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1168('0xb')]('/',upload['single'](_0x1168('0x16')),controller[_0x1168('0x17')]);router['put'](_0x1168('0x8'),auth[_0x1168('0x7')](),controller['update']);router[_0x1168('0x18')]('/:id',auth[_0x1168('0x7')](),controller[_0x1168('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f8cac96..25b8522 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 _0x1dfd=['minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','login','google','/login','profile','email','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add'];(function(_0x5c408d,_0xe56241){var _0xcf4512=function(_0x4934fe){while(--_0x4934fe){_0x5c408d['push'](_0x5c408d['shift']());}};_0xcf4512(++_0xe56241);}(_0x1dfd,0xdd));var _0xd1df=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1dfd[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var passport=require(_0xd1df('0x0'));var GoogleStrategy=require(_0xd1df('0x1'))[_0xd1df('0x2')];var moment=require(_0xd1df('0x3'));var db=require(_0xd1df('0x4'))['db'];var config=require(_0xd1df('0x5'));var signToken=require('../../components/auth/service')[_0xd1df('0x6')];var utils=require('../../config/utils');exports[_0xd1df('0x7')]=passport['authenticate'](_0xd1df('0x8'),{'failureRedirect':_0xd1df('0x9'),'scope':[_0xd1df('0xa'),_0xd1df('0xb')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':_0xd1df('0x9'),'session':![]});passport[_0xd1df('0xc')](new GoogleStrategy({'clientID':config[_0xd1df('0x8')]?config[_0xd1df('0x8')]['clientID']:'id','clientSecret':config['google']?config[_0xd1df('0x8')][_0xd1df('0xd')]:_0xd1df('0xe'),'callbackURL':config[_0xd1df('0x8')]?config[_0xd1df('0x8')][_0xd1df('0xf')]:''},function(_0x30927a,_0x2f7576,_0xdc7bb9,_0x2efce7){var _0x32a74a,_0x427e37;return db[_0xd1df('0x10')][_0xd1df('0x11')]({'where':{'id':0x1},'attributes':[_0xd1df('0x12'),'blockDuration'],'raw':!![]})[_0xd1df('0x13')](function(_0x47c988){_0x32a74a=_0x47c988;return db[_0xd1df('0x14')]['find']({'where':{'email':_['map'](_0xdc7bb9['emails'],'value'),'role':{'$or':['admin',_0xd1df('0x15'),'agent']}}});})[_0xd1df('0x13')](function(_0x3215bf){_0x427e37=_0x3215bf;if(_0x427e37){if(_0x427e37['disabled']){return _0x2efce7(_0xd1df('0x16'));}else if(_0x32a74a[_0xd1df('0x17')]>0x0){if(_0x427e37[_0xd1df('0x18')]){if(moment(_0x427e37[_0xd1df('0x19')])[_0xd1df('0x1a')](_0x32a74a[_0xd1df('0x17')],_0xd1df('0x1b'))>moment()){return _0x2efce7(_0xd1df('0x16'));}else{return utils[_0xd1df('0x1c')](_0x427e37,0x0,![],null)[_0xd1df('0x13')](function(){return utils[_0xd1df('0x1d')](_0x427e37);})['then'](function(){return _0x2efce7(null,_0x427e37);});}}else{return utils[_0xd1df('0x1d')](_0x427e37)[_0xd1df('0x13')](function(){return _0x2efce7(null,_0x427e37);});}}else{return utils['getLicense'](_0x427e37)[_0xd1df('0x13')](function(){return _0x2efce7(null,_0x427e37);});}}return _0x2efce7(_0xd1df('0x16'));})[_0xd1df('0x1e')](function(_0x348ae2){_0x2efce7(_0x348ae2);});})); \ No newline at end of file +var _0xcfb4=['authenticate','clientID','clientSecret','callbackURL','Setting','blockDuration','then','User','find','map','emails','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service','signToken','login','google','profile'];(function(_0x2480dc,_0x2025fd){var _0x2c4472=function(_0x3903aa){while(--_0x3903aa){_0x2480dc['push'](_0x2480dc['shift']());}};_0x2c4472(++_0x2025fd);}(_0xcfb4,0xaf));var _0x4cfb=function(_0x34227a,_0x4388c9){_0x34227a=_0x34227a-0x0;var _0x1df602=_0xcfb4[_0x34227a];return _0x1df602;};'use strict';var _=require(_0x4cfb('0x0'));var passport=require(_0x4cfb('0x1'));var GoogleStrategy=require(_0x4cfb('0x2'))[_0x4cfb('0x3')];var moment=require(_0x4cfb('0x4'));var db=require('../../mysqldb')['db'];var config=require(_0x4cfb('0x5'));var signToken=require(_0x4cfb('0x6'))[_0x4cfb('0x7')];var utils=require('../../config/utils');exports[_0x4cfb('0x8')]=passport['authenticate'](_0x4cfb('0x9'),{'failureRedirect':'/login','scope':[_0x4cfb('0xa'),'email'],'session':![]});exports['callback']=passport[_0x4cfb('0xb')]('google',{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x4cfb('0x9')][_0x4cfb('0xc')]:'id','clientSecret':config['google']?config[_0x4cfb('0x9')][_0x4cfb('0xd')]:'secret','callbackURL':config['google']?config['google'][_0x4cfb('0xe')]:''},function(_0x2380f6,_0x525782,_0x4c872d,_0x2c8067){var _0x49985b,_0x3f341e;return db[_0x4cfb('0xf')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4cfb('0x10')],'raw':!![]})[_0x4cfb('0x11')](function(_0x1c912c){_0x49985b=_0x1c912c;return db[_0x4cfb('0x12')][_0x4cfb('0x13')]({'where':{'email':_[_0x4cfb('0x14')](_0x4c872d[_0x4cfb('0x15')],'value'),'role':{'$or':['admin',_0x4cfb('0x16'),_0x4cfb('0x17')]}}});})[_0x4cfb('0x11')](function(_0x7025e8){_0x3f341e=_0x7025e8;if(_0x3f341e){if(_0x3f341e['disabled']){return _0x2c8067(_0x4cfb('0x18'));}else if(_0x49985b['blockDuration']>0x0){if(_0x3f341e[_0x4cfb('0x19')]){if(moment(_0x3f341e[_0x4cfb('0x1a')])[_0x4cfb('0x1b')](_0x49985b[_0x4cfb('0x10')],'minutes')>moment()){return _0x2c8067(_0x4cfb('0x18'));}else{return utils[_0x4cfb('0x1c')](_0x3f341e,0x0,![],null)['then'](function(){return utils[_0x4cfb('0x1d')](_0x3f341e);})[_0x4cfb('0x11')](function(){return _0x2c8067(null,_0x3f341e);});}}else{return utils[_0x4cfb('0x1d')](_0x3f341e)[_0x4cfb('0x11')](function(){return _0x2c8067(null,_0x3f341e);});}}else{return utils['getLicense'](_0x3f341e)[_0x4cfb('0x11')](function(){return _0x2c8067(null,_0x3f341e);});}}return _0x2c8067('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x4cfb('0x1e')](function(_0x3e654b){_0x2c8067(_0x3e654b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e72d87d..e60796c 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 _0x47d6=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','../../components/auth/service','get','login'];(function(_0x4cab45,_0x250992){var _0xc34398=function(_0x44f42c){while(--_0x44f42c){_0x4cab45['push'](_0x4cab45['shift']());}};_0xc34398(++_0x250992);}(_0x47d6,0x1de));var _0x647d=function(_0x4efd7e,_0x39bc71){_0x4efd7e=_0x4efd7e-0x0;var _0x2f7155=_0x47d6[_0x4efd7e];return _0x2f7155;};'use strict';var express=require(_0x647d('0x0'));var passport=require(_0x647d('0x1'));var router=express[_0x647d('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x647d('0x3'));router[_0x647d('0x4')]('/',controller[_0x647d('0x5')]);router['get'](_0x647d('0x6'),controller[_0x647d('0x7')],authService[_0x647d('0x8')],userController['login'],authService[_0x647d('0x9')]);module[_0x647d('0xa')]=router; \ No newline at end of file +var _0xb32d=['exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','get','callback','isMiddleware','setTokenCookie'];(function(_0x4d270e,_0x409796){var _0x377f75=function(_0x276518){while(--_0x276518){_0x4d270e['push'](_0x4d270e['shift']());}};_0x377f75(++_0x409796);}(_0xb32d,0x1da));var _0xdb32=function(_0x54b7d0,_0x299625){_0x54b7d0=_0x54b7d0-0x0;var _0x5e7900=_0xb32d[_0x54b7d0];return _0x5e7900;};'use strict';var express=require(_0xdb32('0x0'));var passport=require(_0xdb32('0x1'));var router=express[_0xdb32('0x2')]();var controller=require(_0xdb32('0x3'));var userController=require(_0xdb32('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xdb32('0x5')]);router[_0xdb32('0x6')]('/callback',controller[_0xdb32('0x7')],authService[_0xdb32('0x8')],userController[_0xdb32('0x5')],authService[_0xdb32('0x9')]);module[_0xdb32('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 69742fa..c782f97 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 _0x63ea=['online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordExpires','use','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','blockedAt','admin','user','agent','disabled','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','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','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json'];(function(_0x2f92d8,_0x2ef7f4){var _0x200ef1=function(_0x24f52e){while(--_0x24f52e){_0x2f92d8['push'](_0x2f92d8['shift']());}};_0x200ef1(++_0x2ef7f4);}(_0x63ea,0xb5));var _0xa63e=function(_0x5d2602,_0x124080){_0x5d2602=_0x5d2602-0x0;var _0xca9c5a=_0x63ea[_0x5d2602];return _0xca9c5a;};'use strict';var util=require(_0xa63e('0x0'));var passport=require(_0xa63e('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xa63e('0x2'));var _=require(_0xa63e('0x3'));var rs=require(_0xa63e('0x4'));var moment=require(_0xa63e('0x5'));var db=require(_0xa63e('0x6'))['db'];var authService=require(_0xa63e('0x7'));var utils=require(_0xa63e('0x8'));var client=jayson[_0xa63e('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x1ea47f,_0x563445,_0xc63f24,_0x57e417){var _0x511666,_0x5f1b98;return db[_0xa63e('0xa')][_0xa63e('0xb')]({'where':{'id':0x1},'attributes':[_0xa63e('0xc'),_0xa63e('0xd')],'raw':!![]})[_0xa63e('0xe')](function(_0x16708d){_0x511666=_0x16708d;return _0x1ea47f['findOne']({'attributes':['id',_0xa63e('0xf'),_0xa63e('0x10'),'salt',_0xa63e('0x11'),'disabled',_0xa63e('0x12'),_0xa63e('0x13'),'loginAttempts'],'where':{'name':_0x563445,'role':{'$or':[_0xa63e('0x14'),_0xa63e('0x15'),_0xa63e('0x16')]}}});})[_0xa63e('0xe')](function(_0xb8ae10){if(!_0xb8ae10||_0xb8ae10&&_0xb8ae10[_0xa63e('0xf')]!==_0x563445){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5f1b98=_0xb8ae10;return _0x5f1b98;}})['then'](function(){_0x5f1b98['authenticate'](_0xc63f24,function(_0x1a562c,_0x10a022){var _0xd83bcc=_0x5f1b98['loginAttempts']+0x1;if(_0x1a562c){return _0x57e417(_0x1a562c);}else if(!_0x10a022){if(_0x5f1b98[_0xa63e('0x17')]){return _0x57e417(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x511666[_0xa63e('0xc')]>0x0){if(_0x5f1b98[_0xa63e('0x12')]){if(_0x511666[_0xa63e('0xd')]>0x0){if(moment(_0x5f1b98[_0xa63e('0x13')])[_0xa63e('0x18')](_0x511666[_0xa63e('0xd')],_0xa63e('0x19'))>moment()){return _0x57e417(null,![],{'message':_0xa63e('0x1a')});}else{return utils[_0xa63e('0x1b')](_0x5f1b98,_0xd83bcc,![],null)[_0xa63e('0xe')](function(){return _0x57e417(null,![],{'message':_0xa63e('0x1a')});});}}else{return _0x57e417(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xd83bcc>=_0x511666[_0xa63e('0xc')]){return utils[_0xa63e('0x1b')](_0x5f1b98,0x0,!![],moment())[_0xa63e('0xe')](function(){return _0x57e417(null,![],{'message':_0xa63e('0x1a')});});}else{return utils[_0xa63e('0x1b')](_0x5f1b98,_0xd83bcc,![],null)[_0xa63e('0xe')](function(){return _0x57e417(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x57e417(null,![],{'message':_0xa63e('0x1a')});}}else{if(_0x5f1b98[_0xa63e('0x17')]){return _0x57e417(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x511666[_0xa63e('0xc')]>0x0){if(_0x5f1b98[_0xa63e('0x12')]){if(_0x511666[_0xa63e('0xd')]>0x0){if(moment(_0x5f1b98[_0xa63e('0x13')])['add'](_0x511666[_0xa63e('0xd')],_0xa63e('0x19'))>moment()){return _0x57e417(null,![],{'message':_0xa63e('0x1a')});}else{return utils[_0xa63e('0x1b')](_0x5f1b98,0x0,![],null)[_0xa63e('0xe')](function(){return utils[_0xa63e('0x1c')](_0x5f1b98);})['then'](function(){return _0x57e417(null,_0x5f1b98);});}}else{return _0x57e417(null,![],{'message':_0xa63e('0x1a')});}}else{return utils[_0xa63e('0x1b')](_0x5f1b98,0x0,![],null)[_0xa63e('0xe')](function(){return utils[_0xa63e('0x1c')](_0x5f1b98);})[_0xa63e('0xe')](function(){return _0x57e417(null,_0x5f1b98);})[_0xa63e('0x1d')](function(_0x51e94e){return _0x57e417(null,![],_0x51e94e);});}}else{if(_0x5f1b98[_0xa63e('0x12')]){return _0x57e417(null,![],{'message':_0xa63e('0x1a')});}else{return utils['getLicense'](_0x5f1b98)['then'](function(){return _0x57e417(null,_0x5f1b98);});}}}});})[_0xa63e('0x1d')](function(_0xe13998){return _0x57e417(null,![],_0xe13998);});}function sendServiceMail(_0x4e6517){return db['MailAccount'][_0xa63e('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0xa63e('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xa63e('0x20')}]})[_0xa63e('0xe')](function(_0x1ebd0c){if(!_0x1ebd0c){throw new Error(_0xa63e('0x21'));}var _0x55506b={'tls':{'rejectUnauthorized':![]}};if(_0x1ebd0c['Smtp']['service']){_0x55506b[_0xa63e('0x22')]=_0x1ebd0c[_0xa63e('0x20')][_0xa63e('0x22')];}else{_0x55506b['host']=_0x1ebd0c[_0xa63e('0x20')][_0xa63e('0x23')];_0x55506b[_0xa63e('0x24')]=_0x1ebd0c[_0xa63e('0x20')]['port'];_0x55506b['secure']=_0x1ebd0c['Smtp'][_0xa63e('0x25')];}if(_0x1ebd0c['Smtp']['authentication']){_0x55506b[_0xa63e('0x26')]={'user':_0x1ebd0c['Smtp'][_0xa63e('0x15')],'pass':_0x1ebd0c['Smtp'][_0xa63e('0x27')]};}var _0xe501cd={'account':_0x55506b,'message':_[_0xa63e('0x28')]({'from':util[_0xa63e('0x29')](_0xa63e('0x2a'),_0x1ebd0c[_0xa63e('0xf')],_0x1ebd0c[_0xa63e('0x1f')]||_0x1ebd0c['Smtp']['user'])},_0x4e6517)};return client['request'](_0xa63e('0x2b'),_0xe501cd);})[_0xa63e('0xe')](function(_0x293369){if(_0x293369[_0xa63e('0x2c')]){throw new Error(util[_0xa63e('0x29')](_0xa63e('0x2d'),_0x293369[_0xa63e('0x2c')][_0xa63e('0x2e')]||JSON[_0xa63e('0x2f')](_0x293369[_0xa63e('0x2c')])));}return!![];});}function handleError(_0x967473,_0xce466a,_0x5d4cbd){return _0x967473[_0xa63e('0x30')](_0xce466a||0x1f4)[_0xa63e('0x31')]({'message':_0x5d4cbd?_0x5d4cbd[_0xa63e('0x2e')]||_0x5d4cbd:''});}function checkPasswordPattern(_0x46419d,_0x63354a,_0x21195f){if(_0x21195f){var _0x16f7be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16f7be['test'](_0x63354a)){return _0x46419d;}else{throw new Error(_0xa63e('0x32'));}}else{return _0x46419d;}}exports[_0xa63e('0x33')]=function(_0x376ce4,_0x41e56d,_0x5ebe6b){passport[_0xa63e('0x34')](_0xa63e('0x35'),function(_0x2d4247,_0x334bda,_0x3db498){var _0x5df32a=_0x2d4247||_0x3db498;if(_0x5df32a){return handleError(_0x41e56d,0x191,_0x5df32a);}if(!_0x334bda){return handleError(_0x41e56d,0x194,{'message':_0xa63e('0x36')});}else{var _0x28217c={'payload':{'id':_0x334bda['id'],'role':_0x334bda[_0xa63e('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x28217c)['then'](function(_0x2fbafa){_0x41e56d[_0xa63e('0x37')]({'id':_0x334bda['id'],'token':_0x2fbafa,'statusCall':'','isAlreadyLogged':_0x334bda[_0xa63e('0x38')]});});}})(_0x376ce4,_0x41e56d,_0x5ebe6b);};exports[_0xa63e('0x39')]=function(_0x35fbbd,_0x163e15,_0x14d956){if(!_0x35fbbd['body']['email']){return handleError(_0x163e15,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xaeae86=rs['generate']();_0x35fbbd[_0xa63e('0x3a')]['email']=_0x35fbbd['body']['email'][_0xa63e('0x3b')]()[_0xa63e('0x3c')]();var _0x1f9d04;return db[_0xa63e('0xa')][_0xa63e('0xb')]({'where':{'id':0x1},'attributes':[_0xa63e('0xc'),'blockDuration'],'raw':!![]})[_0xa63e('0xe')](function(_0xe54538){_0x1f9d04=_0xe54538;return db[_0xa63e('0x3d')][_0xa63e('0x1e')]({'where':{'email':_0x35fbbd[_0xa63e('0x3a')]['email']}});})[_0xa63e('0xe')](function(_0x1d0700){if(!_0x1d0700){throw new Error(_0xa63e('0x3e'));}if(_0x1d0700[_0xa63e('0x17')]){throw new Error(_0xa63e('0x3f'));}if(_0x1d0700[_0xa63e('0x12')]){if(moment(_0x1d0700[_0xa63e('0x13')])['add'](_0x1f9d04['blockDuration'],_0xa63e('0x19'))>moment()){throw new Error(_0xa63e('0x40'));}else{_0x1d0700[_0xa63e('0x12')]=![];_0x1d0700[_0xa63e('0x13')]=null;}}_0x1d0700['resetPasswordToken']=_0xaeae86;_0x1d0700['resetPasswordExpires']=Date[_0xa63e('0x41')]()+0x36ee80;return _0x1d0700[_0xa63e('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x35fbbd[_0xa63e('0x3a')][_0xa63e('0x1f')],'subject':_0xa63e('0x43'),'text':_0xa63e('0x44')+_0xa63e('0x45')+_0xa63e('0x46')+_0x35fbbd['headers'][_0xa63e('0x23')]+'/reset/'+_0xaeae86+'\x0a\x0a'+_0xa63e('0x47')});})[_0xa63e('0xe')](function(){_0x163e15[_0xa63e('0x30')](0xc8)[_0xa63e('0x31')]({'message':_0xa63e('0x48')});})['catch'](function(_0x2965e1){return handleError(_0x163e15,0x1f4,_0x2965e1);});};exports[_0xa63e('0x49')]=function(_0x12274b,_0x17a118,_0x185158){var _0x22808f;return db[_0xa63e('0x3d')][_0xa63e('0x1e')]({'where':{'resetPasswordToken':_0x12274b[_0xa63e('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date[_0xa63e('0x41')]()}}})[_0xa63e('0xe')](function(_0x3621fc){_0x22808f=_0x3621fc;if(!_0x22808f){throw new Error(_0xa63e('0x4b'));}return db[_0xa63e('0xa')][_0xa63e('0xb')]({'attributes':['id','securePassword']});})[_0xa63e('0xe')](function(_0x473f6c){return checkPasswordPattern(_0x473f6c,_0x12274b[_0xa63e('0x3a')][_0xa63e('0x10')],_0x473f6c[_0xa63e('0x4c')]);})[_0xa63e('0xe')](function(){_0x22808f[_0xa63e('0x10')]=_0x12274b[_0xa63e('0x3a')][_0xa63e('0x10')];_0x22808f['resetPasswordToken']=null;_0x22808f[_0xa63e('0x4d')]=null;return _0x22808f['save']();})['then'](function(){_0x17a118['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xa63e('0x1d')](function(_0x495c38){return handleError(_0x17a118,0x1f4,_0x495c38);});};passport[_0xa63e('0x4e')](new LocalStrategy({'usernameField':_0xa63e('0xf'),'passwordField':_0xa63e('0x10')},function(_0x24a215,_0x53772e,_0x827a8e){return localAuthenticate(db[_0xa63e('0x3d')],_0x24a215,_0x53772e,_0x827a8e);})); \ No newline at end of file +var _0x82d3=['Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','token','securePassword','Password\x20reset!','passport','passport-local','Strategy','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0x82d3,0xa4));var _0x382d=function(_0x26a404,_0x5c5a06){_0x26a404=_0x26a404-0x0;var _0x30d645=_0x82d3[_0x26a404];return _0x30d645;};'use strict';var util=require('util');var passport=require(_0x382d('0x0'));var LocalStrategy=require(_0x382d('0x1'))[_0x382d('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x382d('0x3'));var db=require(_0x382d('0x4'))['db'];var authService=require(_0x382d('0x5'));var utils=require('../../config/utils');var client=jayson[_0x382d('0x6')][_0x382d('0x7')]({'port':0x232b});function localAuthenticate(_0x1429f1,_0x11be78,_0x4e40e7,_0x572337){var _0x4206c7,_0xed4629;return db[_0x382d('0x8')][_0x382d('0x9')]({'where':{'id':0x1},'attributes':[_0x382d('0xa'),_0x382d('0xb')],'raw':!![]})[_0x382d('0xc')](function(_0x10157f){_0x4206c7=_0x10157f;return _0x1429f1[_0x382d('0x9')]({'attributes':['id',_0x382d('0xd'),_0x382d('0xe'),_0x382d('0xf'),_0x382d('0x10'),_0x382d('0x11'),_0x382d('0x12'),_0x382d('0x13'),_0x382d('0x14')],'where':{'name':_0x11be78,'role':{'$or':[_0x382d('0x15'),_0x382d('0x16'),'agent']}}});})['then'](function(_0x4635a7){if(!_0x4635a7||_0x4635a7&&_0x4635a7[_0x382d('0xd')]!==_0x11be78){throw new Error(_0x382d('0x17'));}else{_0xed4629=_0x4635a7;return _0xed4629;}})[_0x382d('0xc')](function(){_0xed4629[_0x382d('0x18')](_0x4e40e7,function(_0x512846,_0x4ed267){var _0x14d288=_0xed4629[_0x382d('0x14')]+0x1;if(_0x512846){return _0x572337(_0x512846);}else if(!_0x4ed267){if(_0xed4629[_0x382d('0x11')]){return _0x572337(null,![],{'message':_0x382d('0x17')});}else if(_0x4206c7[_0x382d('0xa')]>0x0){if(_0xed4629[_0x382d('0x12')]){if(_0x4206c7[_0x382d('0xb')]>0x0){if(moment(_0xed4629[_0x382d('0x13')])[_0x382d('0x19')](_0x4206c7[_0x382d('0xb')],'minutes')>moment()){return _0x572337(null,![],{'message':_0x382d('0x17')});}else{return utils[_0x382d('0x1a')](_0xed4629,_0x14d288,![],null)[_0x382d('0xc')](function(){return _0x572337(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x572337(null,![],{'message':_0x382d('0x17')});}}else{if(_0x14d288>=_0x4206c7[_0x382d('0xa')]){return utils[_0x382d('0x1a')](_0xed4629,0x0,!![],moment())['then'](function(){return _0x572337(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x382d('0x1a')](_0xed4629,_0x14d288,![],null)[_0x382d('0xc')](function(){return _0x572337(null,![],{'message':_0x382d('0x17')});});}}}else{return _0x572337(null,![],{'message':_0x382d('0x17')});}}else{if(_0xed4629[_0x382d('0x11')]){return _0x572337(null,![],{'message':_0x382d('0x17')});}else if(_0x4206c7[_0x382d('0xa')]>0x0){if(_0xed4629[_0x382d('0x12')]){if(_0x4206c7[_0x382d('0xb')]>0x0){if(moment(_0xed4629['blockedAt'])[_0x382d('0x19')](_0x4206c7['blockDuration'],_0x382d('0x1b'))>moment()){return _0x572337(null,![],{'message':_0x382d('0x17')});}else{return utils[_0x382d('0x1a')](_0xed4629,0x0,![],null)[_0x382d('0xc')](function(){return utils[_0x382d('0x1c')](_0xed4629);})['then'](function(){return _0x572337(null,_0xed4629);});}}else{return _0x572337(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x382d('0x1a')](_0xed4629,0x0,![],null)[_0x382d('0xc')](function(){return utils['getLicense'](_0xed4629);})[_0x382d('0xc')](function(){return _0x572337(null,_0xed4629);})[_0x382d('0x1d')](function(_0x4a5387){return _0x572337(null,![],_0x4a5387);});}}else{if(_0xed4629[_0x382d('0x12')]){return _0x572337(null,![],{'message':_0x382d('0x17')});}else{return utils[_0x382d('0x1c')](_0xed4629)[_0x382d('0xc')](function(){return _0x572337(null,_0xed4629);});}}}});})['catch'](function(_0x19cf5c){return _0x572337(null,![],_0x19cf5c);});}function sendServiceMail(_0x207736){return db[_0x382d('0x1e')][_0x382d('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x382d('0xd'),_0x382d('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x382d('0x21')}]})['then'](function(_0x26d905){if(!_0x26d905){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x30247e={'tls':{'rejectUnauthorized':![]}};if(_0x26d905['Smtp'][_0x382d('0x22')]){_0x30247e['service']=_0x26d905[_0x382d('0x21')][_0x382d('0x22')];}else{_0x30247e[_0x382d('0x23')]=_0x26d905['Smtp'][_0x382d('0x23')];_0x30247e[_0x382d('0x24')]=_0x26d905[_0x382d('0x21')][_0x382d('0x24')];_0x30247e[_0x382d('0x25')]=_0x26d905[_0x382d('0x21')][_0x382d('0x25')];}if(_0x26d905[_0x382d('0x21')][_0x382d('0x26')]){_0x30247e[_0x382d('0x27')]={'user':_0x26d905['Smtp']['user'],'pass':_0x26d905[_0x382d('0x21')]['pass']};}var _0x3974e6={'account':_0x30247e,'message':_[_0x382d('0x28')]({'from':util[_0x382d('0x29')](_0x382d('0x2a'),_0x26d905[_0x382d('0xd')],_0x26d905[_0x382d('0x20')]||_0x26d905[_0x382d('0x21')][_0x382d('0x16')])},_0x207736)};return client[_0x382d('0x2b')](_0x382d('0x2c'),_0x3974e6);})[_0x382d('0xc')](function(_0x43e2c6){if(_0x43e2c6['error']){throw new Error(util['format'](_0x382d('0x2d'),_0x43e2c6['error'][_0x382d('0x2e')]||JSON[_0x382d('0x2f')](_0x43e2c6[_0x382d('0x30')])));}return!![];});}function handleError(_0xdb4384,_0x1ab242,_0x1c1ad3){return _0xdb4384[_0x382d('0x31')](_0x1ab242||0x1f4)['send']({'message':_0x1c1ad3?_0x1c1ad3[_0x382d('0x2e')]||_0x1c1ad3:''});}function checkPasswordPattern(_0x5b9acd,_0x19b5dd,_0x4e6c4e){if(_0x4e6c4e){var _0x401ae2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x401ae2[_0x382d('0x32')](_0x19b5dd)){return _0x5b9acd;}else{throw new Error(_0x382d('0x33'));}}else{return _0x5b9acd;}}exports[_0x382d('0x34')]=function(_0x553d6b,_0x5ef618,_0x15defc){passport[_0x382d('0x18')](_0x382d('0x35'),function(_0x5befe3,_0x4b076f,_0x4f16cf){var _0xc9d9ac=_0x5befe3||_0x4f16cf;if(_0xc9d9ac){return handleError(_0x5ef618,0x191,_0xc9d9ac);}if(!_0x4b076f){return handleError(_0x5ef618,0x194,{'message':_0x382d('0x36')});}else{var _0x3c3887={'payload':{'id':_0x4b076f['id'],'role':_0x4b076f[_0x382d('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x382d('0x37')](_0x3c3887)[_0x382d('0xc')](function(_0x586663){_0x5ef618[_0x382d('0x38')]({'id':_0x4b076f['id'],'token':_0x586663,'statusCall':'','isAlreadyLogged':_0x4b076f[_0x382d('0x39')]});});}})(_0x553d6b,_0x5ef618,_0x15defc);};exports[_0x382d('0x3a')]=function(_0x223bd9,_0x1dcb3b,_0x150d87){if(!_0x223bd9['body'][_0x382d('0x20')]){return handleError(_0x1dcb3b,0x1f4,{'message':_0x382d('0x3b')});}var _0x15cf13=rs[_0x382d('0x3c')]();_0x223bd9['body'][_0x382d('0x20')]=_0x223bd9[_0x382d('0x3d')]['email'][_0x382d('0x3e')]()['toLowerCase']();var _0x205f68;return db[_0x382d('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x382d('0xb')],'raw':!![]})[_0x382d('0xc')](function(_0x429c08){_0x205f68=_0x429c08;return db[_0x382d('0x3f')][_0x382d('0x1f')]({'where':{'email':_0x223bd9['body']['email']}});})[_0x382d('0xc')](function(_0x48ac52){if(!_0x48ac52){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x48ac52[_0x382d('0x11')]){throw new Error(_0x382d('0x40'));}if(_0x48ac52[_0x382d('0x12')]){if(moment(_0x48ac52['blockedAt'])['add'](_0x205f68['blockDuration'],_0x382d('0x1b'))>moment()){throw new Error(_0x382d('0x41'));}else{_0x48ac52[_0x382d('0x12')]=![];_0x48ac52['blockedAt']=null;}}_0x48ac52[_0x382d('0x42')]=_0x15cf13;_0x48ac52[_0x382d('0x43')]=Date[_0x382d('0x44')]()+0x36ee80;return _0x48ac52['save']();})[_0x382d('0xc')](function(){return sendServiceMail({'to':_0x223bd9[_0x382d('0x3d')][_0x382d('0x20')],'subject':_0x382d('0x45'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x382d('0x46')+_0x382d('0x47')+_0x223bd9['headers'][_0x382d('0x23')]+'/reset/'+_0x15cf13+'\x0a\x0a'+_0x382d('0x48')});})[_0x382d('0xc')](function(){_0x1dcb3b['status'](0xc8)[_0x382d('0x49')]({'message':'Reset\x20Email\x20sent!'});})[_0x382d('0x1d')](function(_0x22c618){return handleError(_0x1dcb3b,0x1f4,_0x22c618);});};exports[_0x382d('0x4a')]=function(_0x31db4a,_0x4abb36,_0x25af05){var _0x3e46cb;return db[_0x382d('0x3f')][_0x382d('0x1f')]({'where':{'resetPasswordToken':_0x31db4a['params'][_0x382d('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x382d('0xc')](function(_0x5c9929){_0x3e46cb=_0x5c9929;if(!_0x3e46cb){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x382d('0x8')]['findOne']({'attributes':['id',_0x382d('0x4c')]});})[_0x382d('0xc')](function(_0x28f037){return checkPasswordPattern(_0x28f037,_0x31db4a[_0x382d('0x3d')]['password'],_0x28f037[_0x382d('0x4c')]);})['then'](function(){_0x3e46cb[_0x382d('0xe')]=_0x31db4a['body']['password'];_0x3e46cb['resetPasswordToken']=null;_0x3e46cb[_0x382d('0x43')]=null;return _0x3e46cb['save']();})[_0x382d('0xc')](function(){_0x4abb36['status'](0xc8)[_0x382d('0x49')]({'message':_0x382d('0x4d')});})[_0x382d('0x1d')](function(_0x365531){return handleError(_0x4abb36,0x1f4,_0x365531);});};passport['use'](new LocalStrategy({'usernameField':_0x382d('0xd'),'passwordField':_0x382d('0xe')},function(_0x142d0b,_0x1dd198,_0x573841){return localAuthenticate(db[_0x382d('0x3f')],_0x142d0b,_0x1dd198,_0x573841);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0160149..7171b9a 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 _0x13d3=['Router','post','/forgot','/reset/:token','express'];(function(_0x2e7ff1,_0x247ff9){var _0x34ad5e=function(_0x3d33d8){while(--_0x3d33d8){_0x2e7ff1['push'](_0x2e7ff1['shift']());}};_0x34ad5e(++_0x247ff9);}(_0x13d3,0xa4));var _0x313d=function(_0x314f04,_0x5b4184){_0x314f04=_0x314f04-0x0;var _0xf0551b=_0x13d3[_0x314f04];return _0xf0551b;};'use strict';var express=require(_0x313d('0x0'));var router=express[_0x313d('0x1')]();var controller=require('./authLocal.controller');router[_0x313d('0x2')]('/',controller['login']);router[_0x313d('0x2')](_0x313d('0x3'),controller['forgot']);router[_0x313d('0x2')](_0x313d('0x4'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0x3c67=['post','login','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x2bbdcf,_0xa7bb6d){var _0x1fe8af=function(_0x5f53b8){while(--_0x5f53b8){_0x2bbdcf['push'](_0x2bbdcf['shift']());}};_0x1fe8af(++_0xa7bb6d);}(_0x3c67,0x76));var _0x73c6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3c67[_0x5a776b];return _0xbbef59;};'use strict';var express=require(_0x73c6('0x0'));var router=express[_0x73c6('0x1')]();var controller=require('./authLocal.controller');router[_0x73c6('0x2')]('/',controller[_0x73c6('0x3')]);router[_0x73c6('0x2')]('/forgot',controller[_0x73c6('0x4')]);router[_0x73c6('0x2')](_0x73c6('0x5'),controller[_0x73c6('0x6')]);module[_0x73c6('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 73ae5ae..8b4c4b7 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 _0xc7de=['STRING','BOOLEAN','exports'];(function(_0x2a9621,_0x4cd77d){var _0x149901=function(_0x1b3610){while(--_0x1b3610){_0x2a9621['push'](_0x2a9621['shift']());}};_0x149901(++_0x4cd77d);}(_0xc7de,0x155));var _0xec7d=function(_0xac8055,_0x5ababb){_0xac8055=_0xac8055-0x0;var _0x2d5608=_0xc7de[_0xac8055];return _0x2d5608;};'use strict';var Sequelize=require('sequelize');module[_0xec7d('0x0')]={'name':{'type':Sequelize[_0xec7d('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xec7d('0x1')]},'description':{'type':Sequelize[_0xec7d('0x1')]},'status':{'type':Sequelize[_0xec7d('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x7fc6=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x5a7609,_0x3e989f){var _0x14815a=function(_0x1efb36){while(--_0x1efb36){_0x5a7609['push'](_0x5a7609['shift']());}};_0x14815a(++_0x3e989f);}(_0x7fc6,0x1f3));var _0x67fc=function(_0x290940,_0x2b597f){_0x290940=_0x290940-0x0;var _0x39d827=_0x7fc6[_0x290940];return _0x39d827;};'use strict';var Sequelize=require(_0x67fc('0x0'));module[_0x67fc('0x1')]={'name':{'type':Sequelize[_0x67fc('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x67fc('0x2')]},'description':{'type':Sequelize[_0x67fc('0x2')]},'status':{'type':Sequelize[_0x67fc('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x67fc('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9e6d200..f548b88 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 _0xc175=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','Automation','includeAll','find','catch','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','addActions','getActions','Action','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5deb94,_0x4806a4){var _0x33edae=function(_0x418736){while(--_0x418736){_0x5deb94['push'](_0x5deb94['shift']());}};_0x33edae(++_0x4806a4);}(_0xc175,0x1dc));var _0x5c17=function(_0xb736b7,_0x203512){_0xb736b7=_0xb736b7-0x0;var _0x1cf3a5=_0xc175[_0xb736b7];return _0x1cf3a5;};'use strict';var pdf=require(_0x5c17('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5c17('0x1'));var zipdir=require(_0x5c17('0x2'));var jsonpatch=require(_0x5c17('0x3'));var rp=require('request-promise');var moment=require(_0x5c17('0x4'));var BPromise=require(_0x5c17('0x5'));var Mustache=require(_0x5c17('0x6'));var util=require(_0x5c17('0x7'));var path=require(_0x5c17('0x8'));var sox=require(_0x5c17('0x9'));var csv=require(_0x5c17('0xa'));var ejs=require(_0x5c17('0xb'));var fs=require('fs');var _=require(_0x5c17('0xc'));var squel=require(_0x5c17('0xd'));var crypto=require(_0x5c17('0xe'));var jsforce=require(_0x5c17('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5c17('0xa'));var querystring=require(_0x5c17('0x10'));var Papa=require(_0x5c17('0x11'));var Redis=require(_0x5c17('0x12'));var authService=require(_0x5c17('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5c17('0x14'));var hardwareService=require(_0x5c17('0x15'));var logger=require(_0x5c17('0x16'))('api');var utils=require(_0x5c17('0x17'));var config=require('../../config/environment');var db=require(_0x5c17('0x18'))['db'];function respondWithStatusCode(_0x5e2c26,_0x2d1a6e){_0x2d1a6e=_0x2d1a6e||0xcc;return function(_0x4304a3){if(_0x4304a3){return _0x5e2c26[_0x5c17('0x19')](_0x2d1a6e);}return _0x5e2c26['status'](_0x2d1a6e)[_0x5c17('0x1a')]();};}function respondWithResult(_0x246306,_0x20df03){_0x20df03=_0x20df03||0xc8;return function(_0x3930bf){if(_0x3930bf){return _0x246306['status'](_0x20df03)[_0x5c17('0x1b')](_0x3930bf);}};}function respondWithFilteredResult(_0x481379,_0x4ad3d0){return function(_0x538163){if(_0x538163){var _0x201f5a=_0x538163[_0x5c17('0x1c')],_0x5caba4=_0x4ad3d0[_0x5c17('0x1d')],_0x88d574=_0x4ad3d0[_0x5c17('0x1d')]+_0x4ad3d0[_0x5c17('0x1e')],_0x45aeee;if(_0x88d574>=_0x201f5a){_0x88d574=_0x201f5a;_0x45aeee=0xc8;}else{_0x45aeee=0xce;}_0x481379[_0x5c17('0x1f')](_0x45aeee);return _0x481379[_0x5c17('0x20')]('Content-Range',_0x5caba4+'-'+_0x88d574+'/'+_0x201f5a)['json'](_0x538163);}return null;};}function patchUpdates(_0x472698){return function(_0x214136){try{jsonpatch[_0x5c17('0x21')](_0x214136,_0x472698,!![]);}catch(_0x5ffe75){return BPromise['reject'](_0x5ffe75);}return _0x214136['save']();};}function saveUpdates(_0x420884,_0x5dfbf8){return function(_0x27eca0){if(_0x27eca0){return _0x27eca0[_0x5c17('0x22')](_0x420884)[_0x5c17('0x23')](function(_0x356ada){return _0x356ada;});}return null;};}function removeEntity(_0x3bb930,_0x28c346){return function(_0x6d370e){if(_0x6d370e){return _0x6d370e['destroy']()['then'](function(){_0x3bb930['status'](0xcc)[_0x5c17('0x1a')]();});}};}function handleEntityNotFound(_0x21ad0b,_0x34d191){return function(_0x5185e0){if(!_0x5185e0){_0x21ad0b[_0x5c17('0x19')](0x194);}return _0x5185e0;};}function handleError(_0x11539b,_0x103782){_0x103782=_0x103782||0x1f4;return function(_0x513ab3){logger[_0x5c17('0x24')](_0x513ab3[_0x5c17('0x25')]);if(_0x513ab3[_0x5c17('0x26')]){delete _0x513ab3[_0x5c17('0x26')];}_0x11539b['status'](_0x103782)[_0x5c17('0x27')](_0x513ab3);};}exports[_0x5c17('0x28')]=function(_0x16df8d,_0x100821){var _0xf96327={},_0x5a4187={},_0x19fff8={'count':0x0,'rows':[]};var _0x5eb779=_[_0x5c17('0x29')](db['Automation'][_0x5c17('0x2a')],function(_0x1ee933){return{'name':_0x1ee933[_0x5c17('0x2b')],'type':_0x1ee933[_0x5c17('0x2c')][_0x5c17('0x2d')]};});_0x5a4187[_0x5c17('0x2e')]=_[_0x5c17('0x29')](_0x5eb779,_0x5c17('0x26'));_0x5a4187[_0x5c17('0x2f')]=_[_0x5c17('0x30')](_0x16df8d['query']);_0x5a4187[_0x5c17('0x31')]=_[_0x5c17('0x32')](_0x5a4187[_0x5c17('0x2e')],_0x5a4187[_0x5c17('0x2f')]);_0xf96327[_0x5c17('0x33')]=_[_0x5c17('0x32')](_0x5a4187['model'],qs['fields'](_0x16df8d[_0x5c17('0x2f')][_0x5c17('0x34')]));_0xf96327['attributes']=_0xf96327[_0x5c17('0x33')][_0x5c17('0x35')]?_0xf96327[_0x5c17('0x33')]:_0x5a4187[_0x5c17('0x2e')];if(!_0x16df8d[_0x5c17('0x2f')]['hasOwnProperty'](_0x5c17('0x36'))){_0xf96327[_0x5c17('0x1e')]=qs[_0x5c17('0x1e')](_0x16df8d['query'][_0x5c17('0x1e')]);_0xf96327[_0x5c17('0x1d')]=qs[_0x5c17('0x1d')](_0x16df8d[_0x5c17('0x2f')][_0x5c17('0x1d')]);}_0xf96327[_0x5c17('0x37')]=qs[_0x5c17('0x38')](_0x16df8d[_0x5c17('0x2f')]['sort']);_0xf96327[_0x5c17('0x39')]=qs[_0x5c17('0x31')](_[_0x5c17('0x3a')](_0x16df8d['query'],_0x5a4187[_0x5c17('0x31')]),_0x5eb779);if(_0x16df8d[_0x5c17('0x2f')][_0x5c17('0x3b')]){_0xf96327[_0x5c17('0x39')]=_[_0x5c17('0x3c')](_0xf96327[_0x5c17('0x39')],{'$or':_[_0x5c17('0x29')](_0x5eb779,function(_0x2e9891){if(_0x2e9891['type']!==_0x5c17('0x3d')){var _0x45f26f={};_0x45f26f[_0x2e9891[_0x5c17('0x26')]]={'$like':'%'+_0x16df8d[_0x5c17('0x2f')][_0x5c17('0x3b')]+'%'};return _0x45f26f;}})});}_0xf96327=_['merge']({},_0xf96327,_0x16df8d[_0x5c17('0x3e')]);var _0x1ff841={'where':_0xf96327[_0x5c17('0x39')]};return db['Automation'][_0x5c17('0x1c')](_0x1ff841)[_0x5c17('0x23')](function(_0x32c659){_0x19fff8[_0x5c17('0x1c')]=_0x32c659;if(_0x16df8d[_0x5c17('0x2f')]['includeAll']){_0xf96327['include']=[{'all':!![]}];}return db['Automation'][_0x5c17('0x3f')](_0xf96327);})[_0x5c17('0x23')](function(_0x21c068){_0x19fff8[_0x5c17('0x40')]=_0x21c068;return _0x19fff8;})[_0x5c17('0x23')](respondWithFilteredResult(_0x100821,_0xf96327))['catch'](handleError(_0x100821,null));};exports['show']=function(_0x147369,_0xda9b39){var _0x254a07={'raw':![],'where':{'id':_0x147369[_0x5c17('0x41')]['id']}},_0x32e774={};_0x32e774['model']=_[_0x5c17('0x30')](db[_0x5c17('0x42')][_0x5c17('0x2a')]);_0x32e774['query']=_[_0x5c17('0x30')](_0x147369['query']);_0x32e774['filters']=_[_0x5c17('0x32')](_0x32e774[_0x5c17('0x2e')],_0x32e774[_0x5c17('0x2f')]);_0x254a07[_0x5c17('0x33')]=_[_0x5c17('0x32')](_0x32e774['model'],qs[_0x5c17('0x34')](_0x147369['query'][_0x5c17('0x34')]));_0x254a07[_0x5c17('0x33')]=_0x254a07[_0x5c17('0x33')][_0x5c17('0x35')]?_0x254a07[_0x5c17('0x33')]:_0x32e774[_0x5c17('0x2e')];if(_0x147369[_0x5c17('0x2f')][_0x5c17('0x43')]){_0x254a07['include']=[{'all':!![]}];}_0x254a07=_['merge']({},_0x254a07,_0x147369['options']);return db[_0x5c17('0x42')][_0x5c17('0x44')](_0x254a07)[_0x5c17('0x23')](handleEntityNotFound(_0xda9b39,null))[_0x5c17('0x23')](respondWithResult(_0xda9b39,null))[_0x5c17('0x45')](handleError(_0xda9b39,null));};exports['create']=function(_0x1ccc32,_0x2cbb33){return db[_0x5c17('0x42')][_0x5c17('0x46')](_0x1ccc32[_0x5c17('0x47')],{})[_0x5c17('0x23')](respondWithResult(_0x2cbb33,0xc9))[_0x5c17('0x45')](handleError(_0x2cbb33,null));};exports[_0x5c17('0x22')]=function(_0x4ab755,_0x375c47){if(_0x4ab755[_0x5c17('0x47')]['id']){delete _0x4ab755[_0x5c17('0x47')]['id'];}return db['Automation']['find']({'where':{'id':_0x4ab755[_0x5c17('0x41')]['id']}})[_0x5c17('0x23')](handleEntityNotFound(_0x375c47,null))['then'](saveUpdates(_0x4ab755[_0x5c17('0x47')],null))['then'](respondWithResult(_0x375c47,null))[_0x5c17('0x45')](handleError(_0x375c47,null));};exports[_0x5c17('0x48')]=function(_0x2c83e3,_0x342955){return db[_0x5c17('0x42')][_0x5c17('0x44')]({'where':{'id':_0x2c83e3[_0x5c17('0x41')]['id']}})[_0x5c17('0x23')](handleEntityNotFound(_0x342955,null))[_0x5c17('0x23')](removeEntity(_0x342955,null))[_0x5c17('0x45')](handleError(_0x342955,null));};exports[_0x5c17('0x49')]=function(_0x173065,_0x510905,_0x254dd2){return db[_0x5c17('0x4a')][_0x5c17('0x44')]({'where':{'id':_0x173065[_0x5c17('0x41')]['id']}})[_0x5c17('0x23')](handleEntityNotFound(_0x510905,null))['then'](function(_0x2e3e73){if(_0x2e3e73){return _0x2e3e73[_0x5c17('0x49')](_0x173065[_0x5c17('0x47')][_0x5c17('0x4b')],_[_0x5c17('0x4c')](_0x173065['body'],[_0x5c17('0x4b'),'id'])||{});}})[_0x5c17('0x23')](respondWithResult(_0x510905,null))['catch'](handleError(_0x510905,null));};exports[_0x5c17('0x4d')]=function(_0x33417f,_0x139d83,_0x30288f){var _0x9d9606={};var _0x39a3d9={};var _0x166725;var _0x15f0ee;return db['Automation'][_0x5c17('0x4e')]({'where':{'id':_0x33417f[_0x5c17('0x41')]['id']}})['then'](handleEntityNotFound(_0x139d83,null))[_0x5c17('0x23')](function(_0x2882d2){if(_0x2882d2){_0x166725=_0x2882d2;_0x39a3d9[_0x5c17('0x2e')]=_[_0x5c17('0x30')](db[_0x5c17('0x4a')][_0x5c17('0x2a')]);_0x39a3d9[_0x5c17('0x2f')]=_[_0x5c17('0x30')](_0x33417f['query']);_0x39a3d9[_0x5c17('0x31')]=_[_0x5c17('0x32')](_0x39a3d9['model'],_0x39a3d9['query']);_0x9d9606['attributes']=_[_0x5c17('0x32')](_0x39a3d9[_0x5c17('0x2e')],qs[_0x5c17('0x34')](_0x33417f[_0x5c17('0x2f')][_0x5c17('0x34')]));_0x9d9606[_0x5c17('0x33')]=_0x9d9606[_0x5c17('0x33')][_0x5c17('0x35')]?_0x9d9606[_0x5c17('0x33')]:_0x39a3d9['model'];_0x9d9606[_0x5c17('0x37')]=qs[_0x5c17('0x38')](_0x33417f['query']['sort']);_0x9d9606[_0x5c17('0x39')]=qs[_0x5c17('0x31')](_[_0x5c17('0x3a')](_0x33417f[_0x5c17('0x2f')],_0x39a3d9[_0x5c17('0x31')]));if(_0x33417f[_0x5c17('0x2f')][_0x5c17('0x3b')]){_0x9d9606[_0x5c17('0x39')]=_[_0x5c17('0x3c')](_0x9d9606['where'],{'$or':_[_0x5c17('0x29')](_0x9d9606['attributes'],function(_0x53008c){var _0x466c06={};_0x466c06[_0x53008c]={'$like':'%'+_0x33417f[_0x5c17('0x2f')][_0x5c17('0x3b')]+'%'};return _0x466c06;})});}_0x9d9606=_[_0x5c17('0x3c')]({},_0x9d9606,_0x33417f[_0x5c17('0x3e')]);return _0x166725[_0x5c17('0x4d')](_0x9d9606);}})[_0x5c17('0x23')](function(_0x20b65d){if(_0x20b65d){_0x15f0ee=_0x20b65d[_0x5c17('0x35')];if(!_0x33417f[_0x5c17('0x2f')]['hasOwnProperty'](_0x5c17('0x36'))){_0x9d9606[_0x5c17('0x1e')]=qs[_0x5c17('0x1e')](_0x33417f[_0x5c17('0x2f')]['limit']);_0x9d9606['offset']=qs[_0x5c17('0x1d')](_0x33417f[_0x5c17('0x2f')][_0x5c17('0x1d')]);}return _0x166725['getConditions'](_0x9d9606);}})[_0x5c17('0x23')](function(_0x4ddbf8){if(_0x4ddbf8){return _0x4ddbf8?{'count':_0x15f0ee,'rows':_0x4ddbf8}:null;}})[_0x5c17('0x23')](respondWithResult(_0x139d83,null))[_0x5c17('0x45')](handleError(_0x139d83,null));};exports[_0x5c17('0x4f')]=function(_0x24b486,_0x58bf31,_0x5dc094){return db['Action']['find']({'where':{'id':_0x24b486[_0x5c17('0x41')]['id']}})[_0x5c17('0x23')](handleEntityNotFound(_0x58bf31,null))[_0x5c17('0x23')](function(_0x2998b7){if(_0x2998b7){return _0x2998b7['addActions'](_0x24b486[_0x5c17('0x47')][_0x5c17('0x4b')],_[_0x5c17('0x4c')](_0x24b486[_0x5c17('0x47')],[_0x5c17('0x4b'),'id'])||{});}})[_0x5c17('0x23')](respondWithResult(_0x58bf31,null))[_0x5c17('0x45')](handleError(_0x58bf31,null));};exports[_0x5c17('0x50')]=function(_0x1bab34,_0x445133,_0x9312ad){var _0x12c662={};var _0x52f5ca={};var _0xa5a611;var _0x346ef0;return db[_0x5c17('0x42')][_0x5c17('0x4e')]({'where':{'id':_0x1bab34[_0x5c17('0x41')]['id']}})['then'](handleEntityNotFound(_0x445133,null))[_0x5c17('0x23')](function(_0x563758){if(_0x563758){_0xa5a611=_0x563758;_0x52f5ca[_0x5c17('0x2e')]=_['keys'](db[_0x5c17('0x51')][_0x5c17('0x2a')]);_0x52f5ca[_0x5c17('0x2f')]=_[_0x5c17('0x30')](_0x1bab34[_0x5c17('0x2f')]);_0x52f5ca[_0x5c17('0x31')]=_[_0x5c17('0x32')](_0x52f5ca['model'],_0x52f5ca[_0x5c17('0x2f')]);_0x12c662[_0x5c17('0x33')]=_['intersection'](_0x52f5ca[_0x5c17('0x2e')],qs[_0x5c17('0x34')](_0x1bab34[_0x5c17('0x2f')][_0x5c17('0x34')]));_0x12c662[_0x5c17('0x33')]=_0x12c662[_0x5c17('0x33')][_0x5c17('0x35')]?_0x12c662[_0x5c17('0x33')]:_0x52f5ca[_0x5c17('0x2e')];_0x12c662[_0x5c17('0x37')]=qs['sort'](_0x1bab34[_0x5c17('0x2f')][_0x5c17('0x38')]);_0x12c662['where']=qs[_0x5c17('0x31')](_[_0x5c17('0x3a')](_0x1bab34[_0x5c17('0x2f')],_0x52f5ca[_0x5c17('0x31')]));if(_0x1bab34[_0x5c17('0x2f')][_0x5c17('0x3b')]){_0x12c662[_0x5c17('0x39')]=_['merge'](_0x12c662['where'],{'$or':_[_0x5c17('0x29')](_0x12c662[_0x5c17('0x33')],function(_0x5993f1){var _0x26eb98={};_0x26eb98[_0x5993f1]={'$like':'%'+_0x1bab34[_0x5c17('0x2f')]['filter']+'%'};return _0x26eb98;})});}_0x12c662=_['merge']({},_0x12c662,_0x1bab34[_0x5c17('0x3e')]);return _0xa5a611[_0x5c17('0x50')](_0x12c662);}})[_0x5c17('0x23')](function(_0x293f64){if(_0x293f64){_0x346ef0=_0x293f64[_0x5c17('0x35')];if(!_0x1bab34[_0x5c17('0x2f')]['hasOwnProperty']('nolimit')){_0x12c662['limit']=qs['limit'](_0x1bab34['query'][_0x5c17('0x1e')]);_0x12c662[_0x5c17('0x1d')]=qs['offset'](_0x1bab34[_0x5c17('0x2f')]['offset']);}return _0xa5a611[_0x5c17('0x50')](_0x12c662);}})[_0x5c17('0x23')](function(_0x518b08){if(_0x518b08){return _0x518b08?{'count':_0x346ef0,'rows':_0x518b08}:null;}})[_0x5c17('0x23')](respondWithResult(_0x445133,null))[_0x5c17('0x45')](handleError(_0x445133,null));}; \ No newline at end of file +var _0x04ec=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','set','save','update','then','destroy','end','sendStatus','stack','name','send','map','Automation','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','create','body','find','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','html-pdf','eml-format','rimraf'];(function(_0x3248fd,_0x746901){var _0x5c4eff=function(_0x28d799){while(--_0x28d799){_0x3248fd['push'](_0x3248fd['shift']());}};_0x5c4eff(++_0x746901);}(_0x04ec,0x192));var _0xc04e=function(_0x2d1cf4,_0x2ea9ee){_0x2d1cf4=_0x2d1cf4-0x0;var _0x554a7c=_0x04ec[_0x2d1cf4];return _0x554a7c;};'use strict';var pdf=require(_0xc04e('0x0'));var emlformat=require(_0xc04e('0x1'));var rimraf=require(_0xc04e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc04e('0x3'));var rp=require(_0xc04e('0x4'));var moment=require(_0xc04e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc04e('0x6'));var util=require(_0xc04e('0x7'));var path=require(_0xc04e('0x8'));var sox=require('sox');var csv=require(_0xc04e('0x9'));var ejs=require(_0xc04e('0xa'));var fs=require('fs');var _=require(_0xc04e('0xb'));var squel=require(_0xc04e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc04e('0xd'));var deskjs=require(_0xc04e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc04e('0xf'));var Papa=require(_0xc04e('0x10'));var Redis=require('ioredis');var authService=require(_0xc04e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc04e('0x12'));var hardwareService=require(_0xc04e('0x13'));var logger=require(_0xc04e('0x14'))(_0xc04e('0x15'));var utils=require('../../config/utils');var config=require(_0xc04e('0x16'));var db=require(_0xc04e('0x17'))['db'];function respondWithStatusCode(_0x4c8498,_0x8bb468){_0x8bb468=_0x8bb468||0xcc;return function(_0x2c49a9){if(_0x2c49a9){return _0x4c8498['sendStatus'](_0x8bb468);}return _0x4c8498['status'](_0x8bb468)['end']();};}function respondWithResult(_0x53eb93,_0x3b4b1a){_0x3b4b1a=_0x3b4b1a||0xc8;return function(_0x3d9599){if(_0x3d9599){return _0x53eb93[_0xc04e('0x18')](_0x3b4b1a)[_0xc04e('0x19')](_0x3d9599);}};}function respondWithFilteredResult(_0x2097ed,_0x766029){return function(_0x2f3b1f){if(_0x2f3b1f){var _0x29ccbc=_0x2f3b1f[_0xc04e('0x1a')],_0x364c88=_0x766029[_0xc04e('0x1b')],_0x3f97bc=_0x766029[_0xc04e('0x1b')]+_0x766029['limit'],_0x555b5f;if(_0x3f97bc>=_0x29ccbc){_0x3f97bc=_0x29ccbc;_0x555b5f=0xc8;}else{_0x555b5f=0xce;}_0x2097ed[_0xc04e('0x18')](_0x555b5f);return _0x2097ed[_0xc04e('0x1c')]('Content-Range',_0x364c88+'-'+_0x3f97bc+'/'+_0x29ccbc)['json'](_0x2f3b1f);}return null;};}function patchUpdates(_0x4e9f39){return function(_0x1baca6){try{jsonpatch['apply'](_0x1baca6,_0x4e9f39,!![]);}catch(_0x5ce89b){return BPromise['reject'](_0x5ce89b);}return _0x1baca6[_0xc04e('0x1d')]();};}function saveUpdates(_0x19395c,_0x1e213a){return function(_0x3f1cbf){if(_0x3f1cbf){return _0x3f1cbf[_0xc04e('0x1e')](_0x19395c)[_0xc04e('0x1f')](function(_0x54c922){return _0x54c922;});}return null;};}function removeEntity(_0x404f84,_0x22ce47){return function(_0x4f7787){if(_0x4f7787){return _0x4f7787[_0xc04e('0x20')]()[_0xc04e('0x1f')](function(){_0x404f84[_0xc04e('0x18')](0xcc)[_0xc04e('0x21')]();});}};}function handleEntityNotFound(_0xc45125,_0x9c0f51){return function(_0x360bfa){if(!_0x360bfa){_0xc45125[_0xc04e('0x22')](0x194);}return _0x360bfa;};}function handleError(_0x26a517,_0x2f25ac){_0x2f25ac=_0x2f25ac||0x1f4;return function(_0x13cabc){logger['error'](_0x13cabc[_0xc04e('0x23')]);if(_0x13cabc[_0xc04e('0x24')]){delete _0x13cabc[_0xc04e('0x24')];}_0x26a517[_0xc04e('0x18')](_0x2f25ac)[_0xc04e('0x25')](_0x13cabc);};}exports['index']=function(_0xf77b9b,_0x57ad31){var _0x214fca={},_0x26d506={},_0x56d0c6={'count':0x0,'rows':[]};var _0x193c2f=_[_0xc04e('0x26')](db[_0xc04e('0x27')][_0xc04e('0x28')],function(_0x3bde83){return{'name':_0x3bde83[_0xc04e('0x29')],'type':_0x3bde83['type'][_0xc04e('0x2a')]};});_0x26d506[_0xc04e('0x2b')]=_[_0xc04e('0x26')](_0x193c2f,'name');_0x26d506[_0xc04e('0x2c')]=_['keys'](_0xf77b9b['query']);_0x26d506[_0xc04e('0x2d')]=_[_0xc04e('0x2e')](_0x26d506[_0xc04e('0x2b')],_0x26d506[_0xc04e('0x2c')]);_0x214fca[_0xc04e('0x2f')]=_['intersection'](_0x26d506[_0xc04e('0x2b')],qs[_0xc04e('0x30')](_0xf77b9b[_0xc04e('0x2c')][_0xc04e('0x30')]));_0x214fca[_0xc04e('0x2f')]=_0x214fca[_0xc04e('0x2f')][_0xc04e('0x31')]?_0x214fca[_0xc04e('0x2f')]:_0x26d506[_0xc04e('0x2b')];if(!_0xf77b9b[_0xc04e('0x2c')][_0xc04e('0x32')](_0xc04e('0x33'))){_0x214fca[_0xc04e('0x34')]=qs[_0xc04e('0x34')](_0xf77b9b[_0xc04e('0x2c')][_0xc04e('0x34')]);_0x214fca[_0xc04e('0x1b')]=qs[_0xc04e('0x1b')](_0xf77b9b[_0xc04e('0x2c')]['offset']);}_0x214fca[_0xc04e('0x35')]=qs[_0xc04e('0x36')](_0xf77b9b[_0xc04e('0x2c')]['sort']);_0x214fca[_0xc04e('0x37')]=qs[_0xc04e('0x2d')](_[_0xc04e('0x38')](_0xf77b9b[_0xc04e('0x2c')],_0x26d506[_0xc04e('0x2d')]),_0x193c2f);if(_0xf77b9b['query']['filter']){_0x214fca['where']=_[_0xc04e('0x39')](_0x214fca[_0xc04e('0x37')],{'$or':_[_0xc04e('0x26')](_0x193c2f,function(_0x520ff9){if(_0x520ff9[_0xc04e('0x3a')]!==_0xc04e('0x3b')){var _0x46a868={};_0x46a868[_0x520ff9[_0xc04e('0x24')]]={'$like':'%'+_0xf77b9b[_0xc04e('0x2c')][_0xc04e('0x3c')]+'%'};return _0x46a868;}})});}_0x214fca=_[_0xc04e('0x39')]({},_0x214fca,_0xf77b9b[_0xc04e('0x3d')]);var _0x459702={'where':_0x214fca[_0xc04e('0x37')]};return db[_0xc04e('0x27')][_0xc04e('0x1a')](_0x459702)[_0xc04e('0x1f')](function(_0x5bbc8f){_0x56d0c6[_0xc04e('0x1a')]=_0x5bbc8f;if(_0xf77b9b['query'][_0xc04e('0x3e')]){_0x214fca['include']=[{'all':!![]}];}return db[_0xc04e('0x27')][_0xc04e('0x3f')](_0x214fca);})['then'](function(_0x17f104){_0x56d0c6[_0xc04e('0x40')]=_0x17f104;return _0x56d0c6;})[_0xc04e('0x1f')](respondWithFilteredResult(_0x57ad31,_0x214fca))[_0xc04e('0x41')](handleError(_0x57ad31,null));};exports[_0xc04e('0x42')]=function(_0x39bc48,_0x200d2f){var _0x2520f8={'raw':![],'where':{'id':_0x39bc48[_0xc04e('0x43')]['id']}},_0x44a4ff={};_0x44a4ff[_0xc04e('0x2b')]=_[_0xc04e('0x44')](db[_0xc04e('0x27')][_0xc04e('0x28')]);_0x44a4ff['query']=_[_0xc04e('0x44')](_0x39bc48[_0xc04e('0x2c')]);_0x44a4ff[_0xc04e('0x2d')]=_[_0xc04e('0x2e')](_0x44a4ff[_0xc04e('0x2b')],_0x44a4ff[_0xc04e('0x2c')]);_0x2520f8[_0xc04e('0x2f')]=_[_0xc04e('0x2e')](_0x44a4ff[_0xc04e('0x2b')],qs[_0xc04e('0x30')](_0x39bc48[_0xc04e('0x2c')][_0xc04e('0x30')]));_0x2520f8[_0xc04e('0x2f')]=_0x2520f8['attributes'][_0xc04e('0x31')]?_0x2520f8['attributes']:_0x44a4ff[_0xc04e('0x2b')];if(_0x39bc48[_0xc04e('0x2c')][_0xc04e('0x3e')]){_0x2520f8['include']=[{'all':!![]}];}_0x2520f8=_[_0xc04e('0x39')]({},_0x2520f8,_0x39bc48[_0xc04e('0x3d')]);return db[_0xc04e('0x27')]['find'](_0x2520f8)[_0xc04e('0x1f')](handleEntityNotFound(_0x200d2f,null))[_0xc04e('0x1f')](respondWithResult(_0x200d2f,null))[_0xc04e('0x41')](handleError(_0x200d2f,null));};exports['create']=function(_0x250e46,_0x23bc25){return db[_0xc04e('0x27')][_0xc04e('0x45')](_0x250e46['body'],{})['then'](respondWithResult(_0x23bc25,0xc9))['catch'](handleError(_0x23bc25,null));};exports[_0xc04e('0x1e')]=function(_0x5b06cb,_0xaeb85e){if(_0x5b06cb[_0xc04e('0x46')]['id']){delete _0x5b06cb[_0xc04e('0x46')]['id'];}return db[_0xc04e('0x27')][_0xc04e('0x47')]({'where':{'id':_0x5b06cb['params']['id']}})['then'](handleEntityNotFound(_0xaeb85e,null))[_0xc04e('0x1f')](saveUpdates(_0x5b06cb[_0xc04e('0x46')],null))[_0xc04e('0x1f')](respondWithResult(_0xaeb85e,null))['catch'](handleError(_0xaeb85e,null));};exports['destroy']=function(_0x12b2e2,_0x3ba78d){return db[_0xc04e('0x27')][_0xc04e('0x47')]({'where':{'id':_0x12b2e2[_0xc04e('0x43')]['id']}})[_0xc04e('0x1f')](handleEntityNotFound(_0x3ba78d,null))[_0xc04e('0x1f')](removeEntity(_0x3ba78d,null))[_0xc04e('0x41')](handleError(_0x3ba78d,null));};exports[_0xc04e('0x48')]=function(_0x1e7be8,_0x302e46,_0xb38202){return db[_0xc04e('0x49')][_0xc04e('0x47')]({'where':{'id':_0x1e7be8[_0xc04e('0x43')]['id']}})['then'](handleEntityNotFound(_0x302e46,null))[_0xc04e('0x1f')](function(_0x41da69){if(_0x41da69){return _0x41da69[_0xc04e('0x48')](_0x1e7be8['body']['ids'],_[_0xc04e('0x4a')](_0x1e7be8[_0xc04e('0x46')],[_0xc04e('0x4b'),'id'])||{});}})[_0xc04e('0x1f')](respondWithResult(_0x302e46,null))[_0xc04e('0x41')](handleError(_0x302e46,null));};exports[_0xc04e('0x4c')]=function(_0xfc5ba6,_0x2877d2,_0x4a962c){var _0x10b5f3={};var _0x518f03={};var _0x1d3dd4;var _0x42e64e;return db['Automation'][_0xc04e('0x4d')]({'where':{'id':_0xfc5ba6['params']['id']}})[_0xc04e('0x1f')](handleEntityNotFound(_0x2877d2,null))[_0xc04e('0x1f')](function(_0x3f7281){if(_0x3f7281){_0x1d3dd4=_0x3f7281;_0x518f03[_0xc04e('0x2b')]=_[_0xc04e('0x44')](db[_0xc04e('0x49')][_0xc04e('0x28')]);_0x518f03[_0xc04e('0x2c')]=_[_0xc04e('0x44')](_0xfc5ba6[_0xc04e('0x2c')]);_0x518f03[_0xc04e('0x2d')]=_['intersection'](_0x518f03['model'],_0x518f03['query']);_0x10b5f3[_0xc04e('0x2f')]=_[_0xc04e('0x2e')](_0x518f03[_0xc04e('0x2b')],qs[_0xc04e('0x30')](_0xfc5ba6[_0xc04e('0x2c')]['fields']));_0x10b5f3['attributes']=_0x10b5f3[_0xc04e('0x2f')][_0xc04e('0x31')]?_0x10b5f3[_0xc04e('0x2f')]:_0x518f03[_0xc04e('0x2b')];_0x10b5f3[_0xc04e('0x35')]=qs[_0xc04e('0x36')](_0xfc5ba6['query']['sort']);_0x10b5f3[_0xc04e('0x37')]=qs[_0xc04e('0x2d')](_[_0xc04e('0x38')](_0xfc5ba6['query'],_0x518f03[_0xc04e('0x2d')]));if(_0xfc5ba6['query'][_0xc04e('0x3c')]){_0x10b5f3[_0xc04e('0x37')]=_[_0xc04e('0x39')](_0x10b5f3[_0xc04e('0x37')],{'$or':_[_0xc04e('0x26')](_0x10b5f3[_0xc04e('0x2f')],function(_0x54bf72){var _0x5c6034={};_0x5c6034[_0x54bf72]={'$like':'%'+_0xfc5ba6[_0xc04e('0x2c')]['filter']+'%'};return _0x5c6034;})});}_0x10b5f3=_['merge']({},_0x10b5f3,_0xfc5ba6[_0xc04e('0x3d')]);return _0x1d3dd4[_0xc04e('0x4c')](_0x10b5f3);}})[_0xc04e('0x1f')](function(_0xcd54e8){if(_0xcd54e8){_0x42e64e=_0xcd54e8[_0xc04e('0x31')];if(!_0xfc5ba6['query'][_0xc04e('0x32')]('nolimit')){_0x10b5f3[_0xc04e('0x34')]=qs[_0xc04e('0x34')](_0xfc5ba6[_0xc04e('0x2c')][_0xc04e('0x34')]);_0x10b5f3[_0xc04e('0x1b')]=qs[_0xc04e('0x1b')](_0xfc5ba6[_0xc04e('0x2c')][_0xc04e('0x1b')]);}return _0x1d3dd4[_0xc04e('0x4c')](_0x10b5f3);}})[_0xc04e('0x1f')](function(_0x553afc){if(_0x553afc){return _0x553afc?{'count':_0x42e64e,'rows':_0x553afc}:null;}})['then'](respondWithResult(_0x2877d2,null))[_0xc04e('0x41')](handleError(_0x2877d2,null));};exports[_0xc04e('0x4e')]=function(_0x202514,_0x4f8bcc,_0x19ca4a){return db[_0xc04e('0x4f')][_0xc04e('0x47')]({'where':{'id':_0x202514['params']['id']}})[_0xc04e('0x1f')](handleEntityNotFound(_0x4f8bcc,null))['then'](function(_0x4d5549){if(_0x4d5549){return _0x4d5549[_0xc04e('0x4e')](_0x202514[_0xc04e('0x46')][_0xc04e('0x4b')],_['omit'](_0x202514[_0xc04e('0x46')],[_0xc04e('0x4b'),'id'])||{});}})[_0xc04e('0x1f')](respondWithResult(_0x4f8bcc,null))[_0xc04e('0x41')](handleError(_0x4f8bcc,null));};exports['getActions']=function(_0x519dc0,_0x27443f,_0x5c3b59){var _0x17e4db={};var _0x5280a8={};var _0x477eea;var _0x161608;return db[_0xc04e('0x27')][_0xc04e('0x4d')]({'where':{'id':_0x519dc0[_0xc04e('0x43')]['id']}})[_0xc04e('0x1f')](handleEntityNotFound(_0x27443f,null))['then'](function(_0x546f20){if(_0x546f20){_0x477eea=_0x546f20;_0x5280a8[_0xc04e('0x2b')]=_['keys'](db[_0xc04e('0x4f')]['rawAttributes']);_0x5280a8[_0xc04e('0x2c')]=_[_0xc04e('0x44')](_0x519dc0[_0xc04e('0x2c')]);_0x5280a8[_0xc04e('0x2d')]=_[_0xc04e('0x2e')](_0x5280a8[_0xc04e('0x2b')],_0x5280a8[_0xc04e('0x2c')]);_0x17e4db[_0xc04e('0x2f')]=_['intersection'](_0x5280a8[_0xc04e('0x2b')],qs['fields'](_0x519dc0[_0xc04e('0x2c')][_0xc04e('0x30')]));_0x17e4db[_0xc04e('0x2f')]=_0x17e4db['attributes'][_0xc04e('0x31')]?_0x17e4db[_0xc04e('0x2f')]:_0x5280a8[_0xc04e('0x2b')];_0x17e4db['order']=qs[_0xc04e('0x36')](_0x519dc0[_0xc04e('0x2c')][_0xc04e('0x36')]);_0x17e4db[_0xc04e('0x37')]=qs['filters'](_[_0xc04e('0x38')](_0x519dc0[_0xc04e('0x2c')],_0x5280a8[_0xc04e('0x2d')]));if(_0x519dc0[_0xc04e('0x2c')]['filter']){_0x17e4db['where']=_[_0xc04e('0x39')](_0x17e4db['where'],{'$or':_[_0xc04e('0x26')](_0x17e4db[_0xc04e('0x2f')],function(_0x389647){var _0x2362b5={};_0x2362b5[_0x389647]={'$like':'%'+_0x519dc0['query'][_0xc04e('0x3c')]+'%'};return _0x2362b5;})});}_0x17e4db=_[_0xc04e('0x39')]({},_0x17e4db,_0x519dc0[_0xc04e('0x3d')]);return _0x477eea[_0xc04e('0x50')](_0x17e4db);}})[_0xc04e('0x1f')](function(_0x534b71){if(_0x534b71){_0x161608=_0x534b71[_0xc04e('0x31')];if(!_0x519dc0['query'][_0xc04e('0x32')](_0xc04e('0x33'))){_0x17e4db[_0xc04e('0x34')]=qs[_0xc04e('0x34')](_0x519dc0[_0xc04e('0x2c')]['limit']);_0x17e4db[_0xc04e('0x1b')]=qs[_0xc04e('0x1b')](_0x519dc0[_0xc04e('0x2c')][_0xc04e('0x1b')]);}return _0x477eea['getActions'](_0x17e4db);}})['then'](function(_0x2d6bd3){if(_0x2d6bd3){return _0x2d6bd3?{'count':_0x161608,'rows':_0x2d6bd3}:null;}})[_0xc04e('0x1f')](respondWithResult(_0x27443f,null))['catch'](handleError(_0x27443f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 93fcf61..5eee399 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 _0xd0bb=['Automation','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x19b2c1,_0x3a561a){var _0x2199b1=function(_0x1d2cb4){while(--_0x1d2cb4){_0x19b2c1['push'](_0x19b2c1['shift']());}};_0x2199b1(++_0x3a561a);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x297220,_0x49bec5){_0x297220=_0x297220-0x0;var _0x532a3e=_0xd0bb[_0x297220];return _0x532a3e;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./automation.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./automation.attributes','exports','Automation','lodash','util','../../config/logger','api','moment'];(function(_0x292c99,_0x7c5c8a){var _0x6a516b=function(_0x20311d){while(--_0x20311d){_0x292c99['push'](_0x292c99['shift']());}};_0x6a516b(++_0x7c5c8a);}(_0x84ab,0x12f));var _0xb84a=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x84ab[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),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 14e2b66..0fe988e 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 _0x2475=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x30b5b4,_0x30f6d3){var _0x35923b=function(_0x2df718){while(--_0x2df718){_0x30b5b4['push'](_0x30b5b4['shift']());}};_0x35923b(++_0x30f6d3);}(_0x2475,0x13a));var _0x5247=function(_0x2c9748,_0x24b70e){_0x2c9748=_0x2c9748-0x0;var _0x4a1ba0=_0x2475[_0x2c9748];return _0x4a1ba0;};'use strict';var _=require(_0x5247('0x0'));var util=require('util');var moment=require(_0x5247('0x1'));var BPromise=require(_0x5247('0x2'));var rs=require(_0x5247('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5247('0x4'))['db'];var utils=require(_0x5247('0x5'));var logger=require(_0x5247('0x6'))(_0x5247('0x7'));var config=require(_0x5247('0x8'));var jayson=require(_0x5247('0x9'));var client=jayson[_0x5247('0xa')][_0x5247('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ed05d,_0x5c56d5,_0x37fec5){return new BPromise(function(_0x5defc6,_0x27e9e8){return client[_0x5247('0xc')](_0x5ed05d,_0x37fec5)[_0x5247('0xd')](function(_0x1ec347){logger[_0x5247('0xe')](_0x5247('0xf'),_0x5c56d5,_0x5247('0x10'));logger[_0x5247('0x11')](_0x5247('0x12'),_0x5c56d5,'request\x20sent',JSON[_0x5247('0x13')](_0x1ec347));if(_0x1ec347[_0x5247('0x14')]){if(_0x1ec347[_0x5247('0x14')]['code']===0x1f4){logger[_0x5247('0x14')](_0x5247('0xf'),_0x5c56d5,_0x1ec347['error'][_0x5247('0x15')]);return _0x27e9e8(_0x1ec347[_0x5247('0x14')][_0x5247('0x15')]);}logger['error'](_0x5247('0xf'),_0x5c56d5,_0x1ec347[_0x5247('0x14')][_0x5247('0x15')]);return _0x5defc6(_0x1ec347[_0x5247('0x14')][_0x5247('0x15')]);}else{logger[_0x5247('0xe')](_0x5247('0xf'),_0x5c56d5,_0x5247('0x10'));_0x5defc6(_0x1ec347[_0x5247('0x16')][_0x5247('0x15')]);}})[_0x5247('0x17')](function(_0x42b8e8){logger[_0x5247('0x14')](_0x5247('0xf'),_0x5c56d5,_0x42b8e8);_0x27e9e8(_0x42b8e8);});});} \ No newline at end of file +var _0x3715=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch'];(function(_0x2e8775,_0x310049){var _0x4cbf35=function(_0x103483){while(--_0x103483){_0x2e8775['push'](_0x2e8775['shift']());}};_0x4cbf35(++_0x310049);}(_0x3715,0x120));var _0x5371=function(_0x1d7389,_0x51da8f){_0x1d7389=_0x1d7389-0x0;var _0xe975b3=_0x3715[_0x1d7389];return _0xe975b3;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require(_0x5371('0x2'));var BPromise=require(_0x5371('0x3'));var rs=require(_0x5371('0x4'));var fs=require('fs');var Redis=require(_0x5371('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5371('0x6'));var logger=require(_0x5371('0x7'))(_0x5371('0x8'));var config=require(_0x5371('0x9'));var jayson=require(_0x5371('0xa'));var client=jayson[_0x5371('0xb')][_0x5371('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29f5a9,_0x20b52b,_0x2327ec){return new BPromise(function(_0x5b2b3e,_0x53893e){return client['request'](_0x29f5a9,_0x2327ec)[_0x5371('0xd')](function(_0x517c19){logger[_0x5371('0xe')]('Automation,\x20%s,\x20%s',_0x20b52b,'request\x20sent');logger['debug'](_0x5371('0xf'),_0x20b52b,_0x5371('0x10'),JSON[_0x5371('0x11')](_0x517c19));if(_0x517c19[_0x5371('0x12')]){if(_0x517c19[_0x5371('0x12')][_0x5371('0x13')]===0x1f4){logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x517c19[_0x5371('0x12')][_0x5371('0x15')]);return _0x53893e(_0x517c19[_0x5371('0x12')]['message']);}logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x517c19[_0x5371('0x12')][_0x5371('0x15')]);return _0x5b2b3e(_0x517c19['error'][_0x5371('0x15')]);}else{logger[_0x5371('0xe')](_0x5371('0x14'),_0x20b52b,'request\x20sent');_0x5b2b3e(_0x517c19[_0x5371('0x16')][_0x5371('0x15')]);}})[_0x5371('0x17')](function(_0x4922c8){logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x4922c8);_0x53893e(_0x4922c8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ddb131e..f76f4cc 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 _0xa4e3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','destroy','multer','path'];(function(_0x12322d,_0x26104d){var _0x1b9de7=function(_0xc05f83){while(--_0xc05f83){_0x12322d['push'](_0x12322d['shift']());}};_0x1b9de7(++_0x26104d);}(_0xa4e3,0x129));var _0x3a4e=function(_0x5e7ca4,_0x477e53){_0x5e7ca4=_0x5e7ca4-0x0;var _0x542ed1=_0xa4e3[_0x5e7ca4];return _0x542ed1;};'use strict';var multer=require(_0x3a4e('0x0'));var util=require('util');var path=require(_0x3a4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a4e('0x2'));var router=express[_0x3a4e('0x3')]();var auth=require(_0x3a4e('0x4'));var interaction=require(_0x3a4e('0x5'));var config=require(_0x3a4e('0x6'));var controller=require(_0x3a4e('0x7'));router[_0x3a4e('0x8')]('/',auth[_0x3a4e('0x9')](),controller[_0x3a4e('0xa')]);router[_0x3a4e('0x8')](_0x3a4e('0xb'),auth[_0x3a4e('0x9')](),controller[_0x3a4e('0xc')]);router['get'](_0x3a4e('0xd'),auth['isAuthenticated'](),controller['getConditions']);router['get']('/:id/actions',auth[_0x3a4e('0x9')](),controller[_0x3a4e('0xe')]);router[_0x3a4e('0xf')]('/',auth[_0x3a4e('0x9')](),controller[_0x3a4e('0x10')]);router[_0x3a4e('0xf')](_0x3a4e('0xd'),auth['isAuthenticated'](),controller[_0x3a4e('0x11')]);router[_0x3a4e('0xf')](_0x3a4e('0x12'),auth[_0x3a4e('0x9')](),controller[_0x3a4e('0x13')]);router[_0x3a4e('0x14')](_0x3a4e('0xb'),auth[_0x3a4e('0x9')](),controller[_0x3a4e('0x15')]);router['delete'](_0x3a4e('0xb'),auth[_0x3a4e('0x9')](),controller[_0x3a4e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3da6=['../../config/environment','./automation.controller','isAuthenticated','get','show','/:id/conditions','getConditions','post','create','addConditions','/:id/actions','addActions','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3cfdd1,_0x46dbf3){var _0x50151b=function(_0x4c628e){while(--_0x4c628e){_0x3cfdd1['push'](_0x3cfdd1['shift']());}};_0x50151b(++_0x46dbf3);}(_0x3da6,0xc1));var _0x63da=function(_0x98220c,_0x1c14f1){_0x98220c=_0x98220c-0x0;var _0x4607fc=_0x3da6[_0x98220c];return _0x4607fc;};'use strict';var multer=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var timeout=require(_0x63da('0x3'));var express=require(_0x63da('0x4'));var router=express[_0x63da('0x5')]();var auth=require(_0x63da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x63da('0x7'));var controller=require(_0x63da('0x8'));router['get']('/',auth[_0x63da('0x9')](),controller['index']);router[_0x63da('0xa')]('/:id',auth[_0x63da('0x9')](),controller[_0x63da('0xb')]);router[_0x63da('0xa')](_0x63da('0xc'),auth['isAuthenticated'](),controller[_0x63da('0xd')]);router[_0x63da('0xa')]('/:id/actions',auth[_0x63da('0x9')](),controller['getActions']);router[_0x63da('0xe')]('/',auth[_0x63da('0x9')](),controller[_0x63da('0xf')]);router[_0x63da('0xe')](_0x63da('0xc'),auth['isAuthenticated'](),controller[_0x63da('0x10')]);router['post'](_0x63da('0x11'),auth[_0x63da('0x9')](),controller[_0x63da('0x12')]);router[_0x63da('0x13')](_0x63da('0x14'),auth[_0x63da('0x9')](),controller[_0x63da('0x15')]);router[_0x63da('0x16')](_0x63da('0x14'),auth[_0x63da('0x9')](),controller[_0x63da('0x17')]);module[_0x63da('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 239dff6..7115ba4 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 _0x3219=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x27f3e7,_0x263967){var _0x302ca6=function(_0x2099d5){while(--_0x2099d5){_0x27f3e7['push'](_0x27f3e7['shift']());}};_0x302ca6(++_0x263967);}(_0x3219,0x1d2));var _0x9321=function(_0x4f5c2a,_0x465535){_0x4f5c2a=_0x4f5c2a-0x0;var _0x1b2e6e=_0x3219[_0x4f5c2a];return _0x1b2e6e;};'use strict';var Sequelize=require(_0x9321('0x0'));module['exports']={'name':{'type':Sequelize[_0x9321('0x1')],'unique':_0x9321('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9321('0x3')](_0x9321('0x4')),'allowNull':![],'defaultValue':_0x9321('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9321('0x5')],'defaultValue':0x0,'comment':_0x9321('0x6')},'limitCalls':{'type':Sequelize[_0x9321('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9321('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9321('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9321('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9321('0xf')},'dialTimezone':{'type':Sequelize[_0x9321('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9321('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x9321('0x3')](_0x9321('0x11'),_0x9321('0x12'),_0x9321('0x13')),'defaultValue':_0x9321('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9321('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x9321('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9321('0x7')](0x9)[_0x9321('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9321('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9321('0x7')](0x9)[_0x9321('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9321('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9321('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9321('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9321('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9321('0x7')](0x9)[_0x9321('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9321('0x7')](0x9)[_0x9321('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9321('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9321('0x7')](0x5)[_0x9321('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9321('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9321('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9321('0x3')](_0x9321('0x1a'),_0x9321('0x1b')),'defaultValue':_0x9321('0x1a')},'dialPrefix':{'type':Sequelize[_0x9321('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9321('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)[_0x9321('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9321('0x7')](0x3)[_0x9321('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9321('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x24')}}; \ No newline at end of file +var _0xe3e8=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x256521,_0x5c93c2){var _0x372601=function(_0xe2273b){while(--_0xe2273b){_0x256521['push'](_0x256521['shift']());}};_0x372601(++_0x5c93c2);}(_0xe3e8,0x13d));var _0x8e3e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xe3e8[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x8e3e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8e3e('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8e3e('0x2')](_0x8e3e('0x3')),'allowNull':![],'defaultValue':_0x8e3e('0x3')},'description':{'type':Sequelize[_0x8e3e('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8e3e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8e3e('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8e3e('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8e3e('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8e3e('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8e3e('0xd')},'dialTimezone':{'type':Sequelize[_0x8e3e('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8e3e('0x4')],'defaultValue':_0x8e3e('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8e3e('0xf'),_0x8e3e('0x10'),'onlyIfOpen'),'defaultValue':_0x8e3e('0xf')},'dialAMDActive':{'type':Sequelize[_0x8e3e('0x11')],'defaultValue':0x0,'comment':_0x8e3e('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x8e3e('0x7')](0x9)[_0x8e3e('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8e3e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x8e3e('0x7')](0x9)[_0x8e3e('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8e3e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8e3e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8e3e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8e3e('0x7')](0x9)[_0x8e3e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e3e('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8e3e('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8e3e('0x7')](0x9)[_0x8e3e('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8e3e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8e3e('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8e3e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8e3e('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8e3e('0x7')](0x9)[_0x8e3e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e3e('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8e3e('0x2')](_0x8e3e('0x1a'),_0x8e3e('0x1b')),'defaultValue':_0x8e3e('0x1a')},'dialPrefix':{'type':Sequelize[_0x8e3e('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8e3e('0x1c')},'dialCutDigit':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8e3e('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x8e3e('0x7')](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e3e('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)[_0x8e3e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8e3e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8e3e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e3e('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 787754b..5541d7e 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 _0x4173=['addBlackLists','spread','all','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','json','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','Campaign','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','omit','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId','ListId\x20=\x20?','push','sequelize','removeLists','ids','getBlackLists'];(function(_0x5298a4,_0x15af7b){var _0x4a3225=function(_0x3c6249){while(--_0x3c6249){_0x5298a4['push'](_0x5298a4['shift']());}};_0x4a3225(++_0x15af7b);}(_0x4173,0x190));var _0x3417=function(_0x8b1bec,_0x1c8e41){_0x8b1bec=_0x8b1bec-0x0;var _0x29b1d8=_0x4173[_0x8b1bec];return _0x29b1d8;};'use strict';var pdf=require(_0x3417('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3417('0x1'));var zipdir=require(_0x3417('0x2'));var jsonpatch=require(_0x3417('0x3'));var rp=require(_0x3417('0x4'));var moment=require(_0x3417('0x5'));var BPromise=require(_0x3417('0x6'));var Mustache=require(_0x3417('0x7'));var util=require(_0x3417('0x8'));var path=require(_0x3417('0x9'));var sox=require(_0x3417('0xa'));var csv=require(_0x3417('0xb'));var ejs=require(_0x3417('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3417('0xd'));var crypto=require(_0x3417('0xe'));var jsforce=require(_0x3417('0xf'));var deskjs=require(_0x3417('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3417('0x11'));var Papa=require(_0x3417('0x12'));var Redis=require('ioredis');var authService=require(_0x3417('0x13'));var qs=require(_0x3417('0x14'));var as=require(_0x3417('0x15'));var hardwareService=require(_0x3417('0x16'));var logger=require(_0x3417('0x17'))(_0x3417('0x18'));var utils=require(_0x3417('0x19'));var config=require(_0x3417('0x1a'));var db=require(_0x3417('0x1b'))['db'];function respondWithStatusCode(_0x5c9758,_0x53899f){_0x53899f=_0x53899f||0xcc;return function(_0x1bdd21){if(_0x1bdd21){return _0x5c9758['sendStatus'](_0x53899f);}return _0x5c9758[_0x3417('0x1c')](_0x53899f)['end']();};}function respondWithResult(_0x1720ba,_0x2909bf){_0x2909bf=_0x2909bf||0xc8;return function(_0x51dd6e){if(_0x51dd6e){return _0x1720ba[_0x3417('0x1c')](_0x2909bf)['json'](_0x51dd6e);}};}function respondWithFilteredResult(_0x4d10c5,_0x5919b2){return function(_0x52b2ee){if(_0x52b2ee){var _0x51c4bf=_0x52b2ee[_0x3417('0x1d')],_0x4070e6=_0x5919b2[_0x3417('0x1e')],_0x17780e=_0x5919b2['offset']+_0x5919b2[_0x3417('0x1f')],_0x3410c5;if(_0x17780e>=_0x51c4bf){_0x17780e=_0x51c4bf;_0x3410c5=0xc8;}else{_0x3410c5=0xce;}_0x4d10c5['status'](_0x3410c5);return _0x4d10c5[_0x3417('0x20')]('Content-Range',_0x4070e6+'-'+_0x17780e+'/'+_0x51c4bf)[_0x3417('0x21')](_0x52b2ee);}return null;};}function patchUpdates(_0x48b7f3){return function(_0x1ab22a){try{jsonpatch['apply'](_0x1ab22a,_0x48b7f3,!![]);}catch(_0x17a360){return BPromise[_0x3417('0x22')](_0x17a360);}return _0x1ab22a['save']();};}function saveUpdates(_0x35cdbd,_0x4d8301){return function(_0x320f75){if(_0x320f75){return _0x320f75[_0x3417('0x23')](_0x35cdbd)[_0x3417('0x24')](function(_0x587409){return _0x587409;});}return null;};}function removeEntity(_0x29ff33,_0x4ddf74){return function(_0x5bb1d5){if(_0x5bb1d5){return _0x5bb1d5[_0x3417('0x25')]()[_0x3417('0x24')](function(){var _0x3a8706=_0x5bb1d5[_0x3417('0x26')]({'plain':!![]});var _0x23acb8=_0x3417('0x27');return db[_0x3417('0x28')][_0x3417('0x25')]({'where':{'type':_0x23acb8,'resourceId':_0x3a8706['id']}})['then'](function(){return _0x5bb1d5;});})[_0x3417('0x24')](function(){_0x29ff33[_0x3417('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1de5,_0x12bb0b){return function(_0x14c3fe){if(!_0x14c3fe){_0x3d1de5['sendStatus'](0x194);}return _0x14c3fe;};}function handleError(_0x1c1d25,_0x12b2ef){_0x12b2ef=_0x12b2ef||0x1f4;return function(_0x38b853){logger[_0x3417('0x29')](_0x38b853[_0x3417('0x2a')]);if(_0x38b853[_0x3417('0x2b')]){delete _0x38b853['name'];}_0x1c1d25[_0x3417('0x1c')](_0x12b2ef)[_0x3417('0x2c')](_0x38b853);};}exports['index']=function(_0x2eda44,_0x3de62d){var _0x2c24f2={},_0x2e9a80={},_0x100a3a={'count':0x0,'rows':[]};var _0x51d6c7=_['map'](db[_0x3417('0x2d')]['rawAttributes'],function(_0x13c631){return{'name':_0x13c631[_0x3417('0x2e')],'type':_0x13c631[_0x3417('0x2f')]['key']};});_0x2e9a80[_0x3417('0x30')]=_[_0x3417('0x31')](_0x51d6c7,'name');_0x2e9a80[_0x3417('0x32')]=_['keys'](_0x2eda44[_0x3417('0x32')]);_0x2e9a80[_0x3417('0x33')]=_[_0x3417('0x34')](_0x2e9a80[_0x3417('0x30')],_0x2e9a80[_0x3417('0x32')]);_0x2c24f2[_0x3417('0x35')]=_[_0x3417('0x34')](_0x2e9a80[_0x3417('0x30')],qs[_0x3417('0x36')](_0x2eda44[_0x3417('0x32')]['fields']));_0x2c24f2[_0x3417('0x35')]=_0x2c24f2[_0x3417('0x35')]['length']?_0x2c24f2['attributes']:_0x2e9a80[_0x3417('0x30')];if(!_0x2eda44[_0x3417('0x32')][_0x3417('0x37')](_0x3417('0x38'))){_0x2c24f2[_0x3417('0x1f')]=qs[_0x3417('0x1f')](_0x2eda44[_0x3417('0x32')][_0x3417('0x1f')]);_0x2c24f2[_0x3417('0x1e')]=qs[_0x3417('0x1e')](_0x2eda44['query'][_0x3417('0x1e')]);}_0x2c24f2[_0x3417('0x39')]=qs[_0x3417('0x3a')](_0x2eda44[_0x3417('0x32')][_0x3417('0x3a')]);_0x2c24f2['where']=qs[_0x3417('0x33')](_[_0x3417('0x3b')](_0x2eda44[_0x3417('0x32')],_0x2e9a80[_0x3417('0x33')]),_0x51d6c7);if(_0x2eda44[_0x3417('0x32')][_0x3417('0x3c')]){_0x2c24f2[_0x3417('0x3d')]=_['merge'](_0x2c24f2[_0x3417('0x3d')],{'$or':_[_0x3417('0x31')](_0x51d6c7,function(_0x333dcf){if(_0x333dcf['type']!==_0x3417('0x3e')){var _0x360b6d={};_0x360b6d[_0x333dcf['name']]={'$like':'%'+_0x2eda44[_0x3417('0x32')]['filter']+'%'};return _0x360b6d;}})});}_0x2c24f2=_[_0x3417('0x3f')]({},_0x2c24f2,_0x2eda44[_0x3417('0x40')]);var _0x5e5cf1={'where':_0x2c24f2[_0x3417('0x3d')]};return db['Campaign']['count'](_0x5e5cf1)[_0x3417('0x24')](function(_0x313677){_0x100a3a[_0x3417('0x1d')]=_0x313677;if(_0x2eda44[_0x3417('0x32')][_0x3417('0x41')]){_0x2c24f2['include']=[{'all':!![]}];}return db[_0x3417('0x2d')][_0x3417('0x42')](_0x2c24f2);})[_0x3417('0x24')](function(_0x39cb3d){_0x100a3a[_0x3417('0x43')]=_0x39cb3d;return _0x100a3a;})[_0x3417('0x24')](respondWithFilteredResult(_0x3de62d,_0x2c24f2))[_0x3417('0x44')](handleError(_0x3de62d,null));};exports[_0x3417('0x45')]=function(_0x118209,_0x3ef474){var _0x35fb3c={'raw':![],'where':{'id':_0x118209[_0x3417('0x46')]['id']}},_0x898c0b={};_0x898c0b[_0x3417('0x30')]=_[_0x3417('0x47')](db['Campaign'][_0x3417('0x48')]);_0x898c0b[_0x3417('0x32')]=_[_0x3417('0x47')](_0x118209[_0x3417('0x32')]);_0x898c0b[_0x3417('0x33')]=_['intersection'](_0x898c0b[_0x3417('0x30')],_0x898c0b['query']);_0x35fb3c['attributes']=_[_0x3417('0x34')](_0x898c0b[_0x3417('0x30')],qs[_0x3417('0x36')](_0x118209[_0x3417('0x32')][_0x3417('0x36')]));_0x35fb3c['attributes']=_0x35fb3c[_0x3417('0x35')][_0x3417('0x49')]?_0x35fb3c[_0x3417('0x35')]:_0x898c0b[_0x3417('0x30')];if(_0x118209['query'][_0x3417('0x41')]){_0x35fb3c[_0x3417('0x4a')]=[{'all':!![]}];}_0x35fb3c=_[_0x3417('0x3f')]({},_0x35fb3c,_0x118209[_0x3417('0x40')]);return db[_0x3417('0x2d')][_0x3417('0x4b')](_0x35fb3c)['then'](handleEntityNotFound(_0x3ef474,null))['then'](respondWithResult(_0x3ef474,null))[_0x3417('0x44')](handleError(_0x3ef474,null));};exports[_0x3417('0x4c')]=function(_0x59f65a,_0x58b6dc){return db[_0x3417('0x2d')]['create'](_0x59f65a['body'],{})['then'](function(_0x5d25f5){var _0x18b9d4=_0x59f65a[_0x3417('0x4d')]['get']({'plain':!![]});if(!_0x18b9d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18b9d4[_0x3417('0x4e')]==='user'){var _0x54b8ef=_0x5d25f5[_0x3417('0x26')]({'plain':!![]});var _0x19e76d=_0x3417('0x27');return db[_0x3417('0x4f')][_0x3417('0x4b')]({'where':{'name':_0x19e76d,'userProfileId':_0x18b9d4[_0x3417('0x50')]},'raw':!![]})['then'](function(_0x3fdfc1){if(_0x3fdfc1&&_0x3fdfc1[_0x3417('0x51')]===0x0){return db[_0x3417('0x28')]['create']({'name':_0x54b8ef[_0x3417('0x2b')],'resourceId':_0x54b8ef['id'],'type':_0x3fdfc1['name'],'sectionId':_0x3fdfc1['id']},{})[_0x3417('0x24')](function(){return _0x5d25f5;});}else{return _0x5d25f5;}})[_0x3417('0x44')](function(_0x301255){logger['error'](_0x3417('0x52'),_0x301255);throw _0x301255;});}return _0x5d25f5;})['then'](respondWithResult(_0x58b6dc,0xc9))[_0x3417('0x44')](handleError(_0x58b6dc,null));};exports['clone']=function(_0x5c1c40,_0x35b2bf){var _0x366561={'where':{'id':_0x5c1c40[_0x3417('0x46')]['id']}},_0x2144d2={};_0x2144d2[_0x3417('0x30')]=_[_0x3417('0x47')](db[_0x3417('0x2d')]['rawAttributes']);_0x366561[_0x3417('0x35')]=_[_0x3417('0x34')](_0x2144d2[_0x3417('0x30')],qs[_0x3417('0x36')](_0x5c1c40[_0x3417('0x32')][_0x3417('0x36')]));_0x366561[_0x3417('0x35')]=_0x366561[_0x3417('0x35')][_0x3417('0x49')]?_0x366561[_0x3417('0x35')]:_0x2144d2[_0x3417('0x30')];if(_0x5c1c40['query'][_0x3417('0x41')]){_0x366561[_0x3417('0x4a')]=[{'all':!![]}];}_0x366561=_[_0x3417('0x3f')]({},_0x366561,_0x5c1c40['options']);return db[_0x3417('0x2d')][_0x3417('0x4b')](_0x366561)['then'](handleEntityNotFound(_0x35b2bf,null))[_0x3417('0x24')](function(_0x400483){if(_0x400483){var _0x35848e=_0x400483[_0x3417('0x26')]({'plain':!![]});_0x35848e=qs['omit'](_0x35848e,['id',_0x3417('0x53'),_0x3417('0x54')]);_0x5c1c40[_0x3417('0x55')]=_['omit'](_0x5c1c40[_0x3417('0x55')],['id',_0x3417('0x53'),_0x3417('0x54')]);return db[_0x3417('0x2d')]['create'](_[_0x3417('0x3f')](_0x35848e,_0x5c1c40[_0x3417('0x55')]),{'include':_0x5c1c40[_0x3417('0x32')][_0x3417('0x41')]?[{'all':!![]}]:undefined})[_0x3417('0x24')](function(_0x36697e){var _0x7fc873=_0x5c1c40[_0x3417('0x4d')][_0x3417('0x26')]({'plain':!![]});if(!_0x7fc873)throw new Error(_0x3417('0x56'));if(_0x7fc873[_0x3417('0x4e')]===_0x3417('0x4d')){var _0x47b81c=_0x36697e[_0x3417('0x26')]({'plain':!![]});var _0x409c2a=_0x3417('0x27');return db[_0x3417('0x4f')]['find']({'where':{'name':_0x409c2a,'userProfileId':_0x7fc873[_0x3417('0x50')]},'raw':!![]})[_0x3417('0x24')](function(_0x34f1ce){if(_0x34f1ce&&_0x34f1ce['autoAssociation']===0x0){return db['UserProfileResource'][_0x3417('0x4c')]({'name':_0x47b81c['name'],'resourceId':_0x47b81c['id'],'type':_0x34f1ce[_0x3417('0x2b')],'sectionId':_0x34f1ce['id']},{})['then'](function(){return _0x36697e;});}else{return _0x36697e;}})[_0x3417('0x44')](function(_0x48fba4){logger[_0x3417('0x29')](_0x3417('0x52'),_0x48fba4);throw _0x48fba4;});}return _0x36697e;});}})[_0x3417('0x24')](respondWithResult(_0x35b2bf,0xc9))['catch'](handleError(_0x35b2bf,null));};exports['update']=function(_0x23160,_0x59ac3d){if(_0x23160[_0x3417('0x55')]['id']){delete _0x23160[_0x3417('0x55')]['id'];}return db[_0x3417('0x2d')][_0x3417('0x4b')]({'where':{'id':_0x23160['params']['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x59ac3d,null))[_0x3417('0x24')](saveUpdates(_0x23160['body'],null))[_0x3417('0x24')](respondWithResult(_0x59ac3d,null))[_0x3417('0x44')](handleError(_0x59ac3d,null));};exports[_0x3417('0x25')]=function(_0x31d18e,_0x5ca9b6){return db[_0x3417('0x2d')][_0x3417('0x4b')]({'where':{'id':_0x31d18e[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x5ca9b6,null))[_0x3417('0x24')](removeEntity(_0x5ca9b6,null))[_0x3417('0x44')](handleError(_0x5ca9b6,null));};exports[_0x3417('0x57')]=function(_0x3e93d0,_0x213a00,_0xee41fd){var _0x2e08ac={'raw':!![],'where':{}};var _0x1b6ad6={};var _0x3e8dab={'count':0x0,'rows':[]};return db['Campaign'][_0x3417('0x58')]({'where':{'id':_0x3e93d0['params']['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x213a00,null))[_0x3417('0x24')](function(_0x4142c6){if(_0x4142c6){_0x1b6ad6['model']=_[_0x3417('0x47')](db[_0x3417('0x59')][_0x3417('0x48')]);_0x1b6ad6[_0x3417('0x32')]=_[_0x3417('0x47')](_0x3e93d0[_0x3417('0x32')]);_0x1b6ad6['filters']=_[_0x3417('0x34')](_0x1b6ad6[_0x3417('0x30')],_0x1b6ad6[_0x3417('0x32')]);_0x2e08ac[_0x3417('0x35')]=_[_0x3417('0x34')](_0x1b6ad6['model'],qs[_0x3417('0x36')](_0x3e93d0[_0x3417('0x32')][_0x3417('0x36')]));_0x2e08ac[_0x3417('0x35')]=_0x2e08ac['attributes'][_0x3417('0x49')]?_0x2e08ac[_0x3417('0x35')]:_0x1b6ad6[_0x3417('0x30')];if(!_0x3e93d0[_0x3417('0x32')][_0x3417('0x37')](_0x3417('0x38'))){_0x2e08ac[_0x3417('0x1f')]=qs[_0x3417('0x1f')](_0x3e93d0['query'][_0x3417('0x1f')]);_0x2e08ac[_0x3417('0x1e')]=qs[_0x3417('0x1e')](_0x3e93d0['query'][_0x3417('0x1e')]);}_0x2e08ac[_0x3417('0x39')]=qs['sort'](_0x3e93d0['query']['sort']);_0x2e08ac[_0x3417('0x3d')]=qs[_0x3417('0x33')](_['pick'](_0x3e93d0['query'],_0x1b6ad6[_0x3417('0x33')]));_0x2e08ac['where'][_0x3417('0x5a')]=_0x4142c6['id'];if(_0x3e93d0[_0x3417('0x32')][_0x3417('0x3c')]){_0x2e08ac[_0x3417('0x3d')]=_[_0x3417('0x3f')](_0x2e08ac['where'],{'$or':_['map'](_0x2e08ac[_0x3417('0x35')],function(_0x28b932){var _0x4b43ba={};_0x4b43ba[_0x28b932]={'$like':'%'+_0x3e93d0['query']['filter']+'%'};return _0x4b43ba;})});}_0x2e08ac=_[_0x3417('0x3f')]({},_0x2e08ac,_0x3e93d0['options']);return db[_0x3417('0x59')][_0x3417('0x1d')]({'where':_0x2e08ac[_0x3417('0x3d')]})['then'](function(_0x3b07e5){_0x3e8dab[_0x3417('0x1d')]=_0x3b07e5;if(_0x3e93d0[_0x3417('0x32')][_0x3417('0x41')]){_0x2e08ac['include']=[{'all':!![]}];}return db[_0x3417('0x59')]['findAll'](_0x2e08ac);})[_0x3417('0x24')](function(_0x5a4807){_0x3e8dab['rows']=_0x5a4807;return _0x3e8dab;});}})[_0x3417('0x24')](respondWithFilteredResult(_0x213a00,_0x2e08ac))[_0x3417('0x44')](handleError(_0x213a00,null));};exports['getHopperHistories']=function(_0x2e7324,_0x4b4a56,_0x9e9afb){var _0xf9fd6f={'raw':!![],'where':{}};var _0x12847c={};var _0x2a25f2={'count':0x0,'rows':[]};return db[_0x3417('0x2d')][_0x3417('0x58')]({'where':{'id':_0x2e7324[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x4b4a56,null))[_0x3417('0x24')](function(_0x2512c9){if(_0x2512c9){_0x12847c[_0x3417('0x30')]=_[_0x3417('0x47')](db[_0x3417('0x5b')][_0x3417('0x48')]);_0x12847c[_0x3417('0x32')]=_['keys'](_0x2e7324[_0x3417('0x32')]);_0x12847c['filters']=_[_0x3417('0x34')](_0x12847c[_0x3417('0x30')],_0x12847c[_0x3417('0x32')]);_0xf9fd6f[_0x3417('0x35')]=_[_0x3417('0x34')](_0x12847c[_0x3417('0x30')],qs['fields'](_0x2e7324['query'][_0x3417('0x36')]));_0xf9fd6f[_0x3417('0x35')]=_0xf9fd6f[_0x3417('0x35')][_0x3417('0x49')]?_0xf9fd6f[_0x3417('0x35')]:_0x12847c[_0x3417('0x30')];if(!_0x2e7324['query'][_0x3417('0x37')](_0x3417('0x38'))){_0xf9fd6f[_0x3417('0x1f')]=qs[_0x3417('0x1f')](_0x2e7324[_0x3417('0x32')][_0x3417('0x1f')]);_0xf9fd6f[_0x3417('0x1e')]=qs[_0x3417('0x1e')](_0x2e7324[_0x3417('0x32')][_0x3417('0x1e')]);}_0xf9fd6f[_0x3417('0x39')]=qs['sort'](_0x2e7324[_0x3417('0x32')][_0x3417('0x3a')]);_0xf9fd6f['where']=qs[_0x3417('0x33')](_['pick'](_0x2e7324[_0x3417('0x32')],_0x12847c[_0x3417('0x33')]));_0xf9fd6f[_0x3417('0x3d')]['CampaignId']=_0x2512c9['id'];if(_0x2e7324[_0x3417('0x32')][_0x3417('0x3c')]){_0xf9fd6f[_0x3417('0x3d')]=_['merge'](_0xf9fd6f['where'],{'$or':_[_0x3417('0x31')](_0xf9fd6f['attributes'],function(_0x871d8a){var _0x577100={};_0x577100[_0x871d8a]={'$like':'%'+_0x2e7324[_0x3417('0x32')]['filter']+'%'};return _0x577100;})});}_0xf9fd6f=_['merge']({},_0xf9fd6f,_0x2e7324[_0x3417('0x40')]);return db[_0x3417('0x5b')][_0x3417('0x1d')]({'where':_0xf9fd6f['where']})[_0x3417('0x24')](function(_0xad2226){_0x2a25f2[_0x3417('0x1d')]=_0xad2226;if(_0x2e7324['query'][_0x3417('0x41')]){_0xf9fd6f['include']=[{'all':!![]}];}return db[_0x3417('0x5b')][_0x3417('0x42')](_0xf9fd6f);})[_0x3417('0x24')](function(_0x1fbbbc){_0x2a25f2['rows']=_0x1fbbbc;return _0x2a25f2;});}})[_0x3417('0x24')](respondWithFilteredResult(_0x4b4a56,_0xf9fd6f))[_0x3417('0x44')](handleError(_0x4b4a56,null));};exports['getHopperFinals']=function(_0x1c7a60,_0x105a40,_0x583313){var _0x3f7870={'raw':!![],'where':{}};var _0x3e86b9={};var _0x23540e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1c7a60[_0x3417('0x46')]['id']}})['then'](handleEntityNotFound(_0x105a40,null))[_0x3417('0x24')](function(_0x21be81){if(_0x21be81){_0x3e86b9[_0x3417('0x30')]=_['keys'](db[_0x3417('0x5c')][_0x3417('0x48')]);_0x3e86b9['query']=_[_0x3417('0x47')](_0x1c7a60[_0x3417('0x32')]);_0x3e86b9[_0x3417('0x33')]=_[_0x3417('0x34')](_0x3e86b9[_0x3417('0x30')],_0x3e86b9[_0x3417('0x32')]);_0x3f7870[_0x3417('0x35')]=_[_0x3417('0x34')](_0x3e86b9[_0x3417('0x30')],qs[_0x3417('0x36')](_0x1c7a60[_0x3417('0x32')][_0x3417('0x36')]));_0x3f7870[_0x3417('0x35')]=_0x3f7870[_0x3417('0x35')][_0x3417('0x49')]?_0x3f7870[_0x3417('0x35')]:_0x3e86b9['model'];if(!_0x1c7a60[_0x3417('0x32')][_0x3417('0x37')](_0x3417('0x38'))){_0x3f7870['limit']=qs['limit'](_0x1c7a60[_0x3417('0x32')]['limit']);_0x3f7870[_0x3417('0x1e')]=qs[_0x3417('0x1e')](_0x1c7a60[_0x3417('0x32')][_0x3417('0x1e')]);}_0x3f7870[_0x3417('0x39')]=qs['sort'](_0x1c7a60[_0x3417('0x32')][_0x3417('0x3a')]);_0x3f7870['where']=qs['filters'](_['pick'](_0x1c7a60['query'],_0x3e86b9[_0x3417('0x33')]));_0x3f7870[_0x3417('0x3d')][_0x3417('0x5a')]=_0x21be81['id'];if(_0x1c7a60['query'][_0x3417('0x3c')]){_0x3f7870[_0x3417('0x3d')]=_[_0x3417('0x3f')](_0x3f7870[_0x3417('0x3d')],{'$or':_[_0x3417('0x31')](_0x3f7870[_0x3417('0x35')],function(_0xbd44b8){var _0x5cb07e={};_0x5cb07e[_0xbd44b8]={'$like':'%'+_0x1c7a60[_0x3417('0x32')][_0x3417('0x3c')]+'%'};return _0x5cb07e;})});}_0x3f7870=_[_0x3417('0x3f')]({},_0x3f7870,_0x1c7a60['options']);return db['CmHopperFinal'][_0x3417('0x1d')]({'where':_0x3f7870[_0x3417('0x3d')]})[_0x3417('0x24')](function(_0x40f5b3){_0x23540e['count']=_0x40f5b3;if(_0x1c7a60[_0x3417('0x32')][_0x3417('0x41')]){_0x3f7870[_0x3417('0x4a')]=[{'all':!![]}];}return db[_0x3417('0x5c')][_0x3417('0x42')](_0x3f7870);})[_0x3417('0x24')](function(_0x2fb3ea){_0x23540e[_0x3417('0x43')]=_0x2fb3ea;return _0x23540e;});}})[_0x3417('0x24')](respondWithFilteredResult(_0x105a40,_0x3f7870))['catch'](handleError(_0x105a40,null));};exports[_0x3417('0x5d')]=function(_0x16ad04,_0x122328,_0x44ffb0){var _0x3a5f9d={'raw':!![],'where':{}};var _0x3d78cd={};var _0x327dc5={'count':0x0,'rows':[]};return db[_0x3417('0x2d')]['findOne']({'where':{'id':_0x16ad04[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x122328,null))[_0x3417('0x24')](function(_0x513db4){if(_0x513db4){_0x3d78cd['model']=_[_0x3417('0x47')](db[_0x3417('0x5e')][_0x3417('0x48')]);_0x3d78cd[_0x3417('0x32')]=_[_0x3417('0x47')](_0x16ad04[_0x3417('0x32')]);_0x3d78cd[_0x3417('0x33')]=_[_0x3417('0x34')](_0x3d78cd[_0x3417('0x30')],_0x3d78cd[_0x3417('0x32')]);_0x3a5f9d[_0x3417('0x35')]=_['intersection'](_0x3d78cd['model'],qs['fields'](_0x16ad04[_0x3417('0x32')][_0x3417('0x36')]));_0x3a5f9d['attributes']=_0x3a5f9d[_0x3417('0x35')][_0x3417('0x49')]?_0x3a5f9d[_0x3417('0x35')]:_0x3d78cd[_0x3417('0x30')];if(!_0x16ad04[_0x3417('0x32')][_0x3417('0x37')](_0x3417('0x38'))){_0x3a5f9d['limit']=qs['limit'](_0x16ad04[_0x3417('0x32')]['limit']);_0x3a5f9d[_0x3417('0x1e')]=qs[_0x3417('0x1e')](_0x16ad04[_0x3417('0x32')][_0x3417('0x1e')]);}_0x3a5f9d[_0x3417('0x39')]=qs[_0x3417('0x3a')](_0x16ad04[_0x3417('0x32')][_0x3417('0x3a')]);_0x3a5f9d[_0x3417('0x3d')]=qs[_0x3417('0x33')](_[_0x3417('0x3b')](_0x16ad04[_0x3417('0x32')],_0x3d78cd['filters']));_0x3a5f9d[_0x3417('0x3d')][_0x3417('0x5a')]=_0x513db4['id'];if(_0x16ad04['query'][_0x3417('0x3c')]){_0x3a5f9d[_0x3417('0x3d')]=_[_0x3417('0x3f')](_0x3a5f9d[_0x3417('0x3d')],{'$or':_['map'](_0x3a5f9d[_0x3417('0x35')],function(_0xff3007){var _0x4bd751={};_0x4bd751[_0xff3007]={'$like':'%'+_0x16ad04[_0x3417('0x32')][_0x3417('0x3c')]+'%'};return _0x4bd751;})});}_0x3a5f9d=_[_0x3417('0x3f')]({},_0x3a5f9d,_0x16ad04[_0x3417('0x40')]);return db['CmHopperBlack']['count']({'where':_0x3a5f9d[_0x3417('0x3d')]})[_0x3417('0x24')](function(_0x27ba97){_0x327dc5[_0x3417('0x1d')]=_0x27ba97;if(_0x16ad04[_0x3417('0x32')]['includeAll']){_0x3a5f9d[_0x3417('0x4a')]=[{'all':!![]}];}return db[_0x3417('0x5e')]['findAll'](_0x3a5f9d);})[_0x3417('0x24')](function(_0x26544a){_0x327dc5[_0x3417('0x43')]=_0x26544a;return _0x327dc5;});}})[_0x3417('0x24')](respondWithFilteredResult(_0x122328,_0x3a5f9d))[_0x3417('0x44')](handleError(_0x122328,null));};exports[_0x3417('0x5f')]=function(_0x5ebc2f,_0x3ac072,_0x26ca21){var _0x1b0874={};var _0x485254={};var _0xbe430e;var _0x507537;return db['Campaign'][_0x3417('0x58')]({'where':{'id':_0x5ebc2f[_0x3417('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ac072,null))[_0x3417('0x24')](function(_0x1bfbae){if(_0x1bfbae){_0xbe430e=_0x1bfbae;_0x485254[_0x3417('0x30')]=_[_0x3417('0x47')](db[_0x3417('0x60')][_0x3417('0x48')]);_0x485254[_0x3417('0x32')]=_[_0x3417('0x47')](_0x5ebc2f[_0x3417('0x32')]);_0x485254[_0x3417('0x33')]=_[_0x3417('0x34')](_0x485254[_0x3417('0x30')],_0x485254['query']);_0x1b0874[_0x3417('0x35')]=_[_0x3417('0x34')](_0x485254['model'],qs[_0x3417('0x36')](_0x5ebc2f[_0x3417('0x32')]['fields']));_0x1b0874['attributes']=_0x1b0874[_0x3417('0x35')][_0x3417('0x49')]?_0x1b0874['attributes']:_0x485254[_0x3417('0x30')];_0x1b0874[_0x3417('0x39')]=qs[_0x3417('0x3a')](_0x5ebc2f[_0x3417('0x32')][_0x3417('0x3a')]);_0x1b0874[_0x3417('0x3d')]=qs[_0x3417('0x33')](_[_0x3417('0x3b')](_0x5ebc2f[_0x3417('0x32')],_0x485254['filters']));if(_0x5ebc2f[_0x3417('0x32')]['filter']){_0x1b0874[_0x3417('0x3d')]=_[_0x3417('0x3f')](_0x1b0874[_0x3417('0x3d')],{'$or':_[_0x3417('0x31')](_0x1b0874[_0x3417('0x35')],function(_0x5ad899){var _0x5157f0={};_0x5157f0[_0x5ad899]={'$like':'%'+_0x5ebc2f[_0x3417('0x32')][_0x3417('0x3c')]+'%'};return _0x5157f0;})});}_0x1b0874=_[_0x3417('0x3f')]({},_0x1b0874,_0x5ebc2f[_0x3417('0x40')]);return _0xbe430e[_0x3417('0x5f')](_0x1b0874);}})[_0x3417('0x24')](function(_0x45b694){if(_0x45b694){_0x507537=_0x45b694[_0x3417('0x49')];if(!_0x5ebc2f[_0x3417('0x32')][_0x3417('0x37')]('nolimit')){_0x1b0874[_0x3417('0x1f')]=qs[_0x3417('0x1f')](_0x5ebc2f[_0x3417('0x32')][_0x3417('0x1f')]);_0x1b0874['offset']=qs[_0x3417('0x1e')](_0x5ebc2f[_0x3417('0x32')][_0x3417('0x1e')]);}return _0xbe430e[_0x3417('0x5f')](_0x1b0874);}})[_0x3417('0x24')](function(_0x162958){if(_0x162958){return _0x162958?{'count':_0x507537,'rows':_0x162958}:null;}})[_0x3417('0x24')](respondWithResult(_0x3ac072,null))['catch'](handleError(_0x3ac072,null));};exports[_0x3417('0x61')]=function(_0x50f48b,_0x3f152d,_0x2bf87b){var _0xcbadf4,_0x516525;return db[_0x3417('0x2d')][_0x3417('0x4b')]({'where':{'id':_0x50f48b[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x3f152d,null))['then'](function(_0x494a8e){if(_0x494a8e){_0x516525=_0x494a8e;return _0x494a8e[_0x3417('0x61')](_0x50f48b['body']['ids'],_[_0x3417('0x62')](_0x50f48b[_0x3417('0x55')],['ids','id'])||{});}return null;})['spread'](function(_0x1a2213){var _0xee7c82;_0xcbadf4=_0x1a2213||[];var _0x433d67=[];if(_0x1a2213){for(var _0x359dd1=0x0;_0x359dd1<_0x1a2213[_0x3417('0x49')];_0x359dd1+=0x1){var _0x15bcc5=_0x1a2213[_0x359dd1][_0x3417('0x26')]({'plain':!![]});_0x516525[_0x3417('0x63')]=_0x50f48b[_0x3417('0x55')]['dialCheckDuplicateType']?_0x50f48b[_0x3417('0x55')][_0x3417('0x63')]:_0x516525['dialCheckDuplicateType'];switch(_0x516525[_0x3417('0x63')]){case _0x3417('0x64'):_0xee7c82=squel[_0x3417('0x65')]()[_0x3417('0x66')](_0x3417('0x67'))[_0x3417('0x68')]([_0x3417('0x69'),_0x3417('0x6a'),_0x3417('0x6b'),'ListId',_0x3417('0x5a'),_0x3417('0x53'),'updatedAt'],squel['select']()['field'](_0x3417('0x69'),_0x3417('0x69'))[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x6a'))[_0x3417('0x6c')]('id',_0x3417('0x6b'))[_0x3417('0x6c')](_0x15bcc5[_0x3417('0x6e')][_0x3417('0x6f')](),'ListId')[_0x3417('0x6c')](_0x50f48b[_0x3417('0x46')]['id'][_0x3417('0x6f')](),'CampaignId')[_0x3417('0x6c')]('NOW()','createdAt')['field'](_0x3417('0x6d'),_0x3417('0x54'))[_0x3417('0x70')](_0x3417('0x71'))[_0x3417('0x3d')](_0x3417('0x72'))['where']('ListId\x20=\x20?',_0x15bcc5[_0x3417('0x6e')][_0x3417('0x6f')]())['where'](_0x3417('0x73'))[_0x3417('0x3d')](_0x3417('0x74'),squel[_0x3417('0x75')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x3417('0x70')](_0x3417('0x76'))['where'](_0x3417('0x77'),_0x50f48b[_0x3417('0x46')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x3417('0x78'))[_0x3417('0x70')](_0x3417('0x67'))[_0x3417('0x3d')](_0x3417('0x77'),_0x50f48b['params']['id']['toString']())))[_0x3417('0x6f')]();break;case'onlyIfOpen':_0xee7c82=squel[_0x3417('0x65')]()[_0x3417('0x66')]('cm_hopper')[_0x3417('0x68')](['phone',_0x3417('0x6a'),_0x3417('0x6b'),_0x3417('0x79'),_0x3417('0x5a'),_0x3417('0x53'),_0x3417('0x54')],squel['select']()[_0x3417('0x6c')]('phone',_0x3417('0x69'))[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x6a'))['field']('id',_0x3417('0x6b'))[_0x3417('0x6c')](_0x15bcc5[_0x3417('0x6e')][_0x3417('0x6f')](),_0x3417('0x79'))['field'](_0x50f48b[_0x3417('0x46')]['id'][_0x3417('0x6f')](),'CampaignId')[_0x3417('0x6c')](_0x3417('0x6d'),'createdAt')[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x54'))[_0x3417('0x70')](_0x3417('0x71'))[_0x3417('0x3d')](_0x3417('0x72'))[_0x3417('0x3d')](_0x3417('0x7a'),_0x15bcc5[_0x3417('0x6e')][_0x3417('0x6f')]())[_0x3417('0x3d')](_0x3417('0x73'))['where'](_0x3417('0x74'),squel[_0x3417('0x75')]()[_0x3417('0x6c')](_0x3417('0x78'))[_0x3417('0x70')]('cm_hopper')[_0x3417('0x3d')](_0x3417('0x77'),_0x50f48b[_0x3417('0x46')]['id'][_0x3417('0x6f')]())))[_0x3417('0x6f')]();break;default:_0xee7c82=squel[_0x3417('0x65')]()[_0x3417('0x66')]('cm_hopper')[_0x3417('0x68')]([_0x3417('0x69'),_0x3417('0x6a'),_0x3417('0x6b'),'ListId',_0x3417('0x5a'),_0x3417('0x53'),_0x3417('0x54')],squel['select']()[_0x3417('0x6c')]('phone',_0x3417('0x69'))[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x6a'))['field']('id',_0x3417('0x6b'))[_0x3417('0x6c')](_0x15bcc5['CmListId'][_0x3417('0x6f')](),_0x3417('0x79'))[_0x3417('0x6c')](_0x50f48b[_0x3417('0x46')]['id'][_0x3417('0x6f')](),_0x3417('0x5a'))[_0x3417('0x6c')](_0x3417('0x6d'),'createdAt')[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x54'))[_0x3417('0x70')](_0x3417('0x71'))[_0x3417('0x3d')](_0x3417('0x72'))[_0x3417('0x3d')](_0x3417('0x7a'),_0x15bcc5[_0x3417('0x6e')][_0x3417('0x6f')]())[_0x3417('0x3d')](_0x3417('0x73')))[_0x3417('0x6f')]();}_0x433d67[_0x3417('0x7b')](db[_0x3417('0x7c')][_0x3417('0x32')](_0xee7c82));}return BPromise['all'](_0x433d67);}})['then'](function(){return _0xcbadf4;})[_0x3417('0x24')](respondWithResult(_0x3f152d,null))['catch'](handleError(_0x3f152d,null));};exports[_0x3417('0x7d')]=function(_0x2a6671,_0x36de7a,_0x5519b8){return db[_0x3417('0x2d')][_0x3417('0x4b')]({'where':{'id':_0x2a6671['params']['id']}})['then'](handleEntityNotFound(_0x36de7a,null))[_0x3417('0x24')](function(_0x275e9a){if(_0x275e9a){return _0x275e9a[_0x3417('0x7d')](_0x2a6671[_0x3417('0x32')][_0x3417('0x7e')]);}})['then'](function(_0x10ee16){if(_0x10ee16){return db[_0x3417('0x59')][_0x3417('0x25')]({'where':{'ListId':_0x2a6671[_0x3417('0x32')]['ids'],'CampaignId':_0x2a6671[_0x3417('0x46')]['id']}})['then'](function(){return _0x10ee16;});}})['then'](respondWithStatusCode(_0x36de7a,null))[_0x3417('0x44')](handleError(_0x36de7a,null));};exports[_0x3417('0x7f')]=function(_0x334c0c,_0x20de55,_0x396a1f){var _0xfd04e3={'raw':!![],'where':{}};var _0xe2be95={};var _0x59fceb={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x334c0c[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x20de55,null))[_0x3417('0x24')](function(_0x1a1a31){if(_0x1a1a31){_0xe2be95[_0x3417('0x30')]=_[_0x3417('0x47')](db[_0x3417('0x60')][_0x3417('0x48')]);_0xe2be95[_0x3417('0x32')]=_[_0x3417('0x47')](_0x334c0c[_0x3417('0x32')]);_0xe2be95['filters']=_[_0x3417('0x34')](_0xe2be95['model'],_0xe2be95[_0x3417('0x32')]);_0xfd04e3[_0x3417('0x35')]=_[_0x3417('0x34')](_0xe2be95[_0x3417('0x30')],qs['fields'](_0x334c0c['query'][_0x3417('0x36')]));_0xfd04e3[_0x3417('0x35')]=_0xfd04e3[_0x3417('0x35')][_0x3417('0x49')]?_0xfd04e3[_0x3417('0x35')]:_0xe2be95['model'];if(!_0x334c0c[_0x3417('0x32')][_0x3417('0x37')](_0x3417('0x38'))){_0xfd04e3[_0x3417('0x1f')]=qs[_0x3417('0x1f')](_0x334c0c[_0x3417('0x32')]['limit']);_0xfd04e3['offset']=qs[_0x3417('0x1e')](_0x334c0c[_0x3417('0x32')][_0x3417('0x1e')]);}_0xfd04e3[_0x3417('0x39')]=qs[_0x3417('0x3a')](_0x334c0c['query'][_0x3417('0x3a')]);_0xfd04e3[_0x3417('0x3d')]=qs[_0x3417('0x33')](_['pick'](_0x334c0c['query'],_0xe2be95[_0x3417('0x33')]));_0xfd04e3[_0x3417('0x3d')][_0x3417('0x5a')]=_0x1a1a31['id'];if(_0x334c0c['query'][_0x3417('0x3c')]){_0xfd04e3[_0x3417('0x3d')]=_[_0x3417('0x3f')](_0xfd04e3[_0x3417('0x3d')],{'$or':_['map'](_0xfd04e3[_0x3417('0x35')],function(_0x2721fc){var _0xc0a259={};_0xc0a259[_0x2721fc]={'$like':'%'+_0x334c0c[_0x3417('0x32')][_0x3417('0x3c')]+'%'};return _0xc0a259;})});}_0xfd04e3=_[_0x3417('0x3f')]({},_0xfd04e3,_0x334c0c[_0x3417('0x40')]);return db[_0x3417('0x60')][_0x3417('0x1d')]({'where':_0xfd04e3[_0x3417('0x3d')]})[_0x3417('0x24')](function(_0x2c063a){_0x59fceb[_0x3417('0x1d')]=_0x2c063a;if(_0x334c0c[_0x3417('0x32')][_0x3417('0x41')]){_0xfd04e3[_0x3417('0x4a')]=[{'all':!![]}];}return db[_0x3417('0x60')]['findAll'](_0xfd04e3);})[_0x3417('0x24')](function(_0x36dd5f){_0x59fceb['rows']=_0x36dd5f;return _0x59fceb;});}})[_0x3417('0x24')](respondWithFilteredResult(_0x20de55,_0xfd04e3))[_0x3417('0x44')](handleError(_0x20de55,null));};exports[_0x3417('0x80')]=function(_0x3da4c4,_0x201904,_0x50a77f){var _0x18c3b5,_0x52454c;return db['Campaign']['find']({'where':{'id':_0x3da4c4[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x201904,null))[_0x3417('0x24')](function(_0x2815b3){if(_0x2815b3){_0x52454c=_0x2815b3;return _0x2815b3['addBlackLists'](_0x3da4c4[_0x3417('0x55')]['ids'],_[_0x3417('0x62')](_0x3da4c4[_0x3417('0x55')],['ids','id'])||{});}return null;})[_0x3417('0x81')](function(_0x59fb0b){var _0x10ebae;_0x18c3b5=_0x59fb0b||[];var _0x159d2f=[];if(_0x59fb0b){for(var _0xe62ed=0x0;_0xe62ed<_0x59fb0b[_0x3417('0x49')];_0xe62ed+=0x1){var _0x432a9e=_0x59fb0b[_0xe62ed]['get']({'plain':!![]});_0x10ebae=squel[_0x3417('0x65')]()[_0x3417('0x66')]('cm_hopper_black')['fromQuery']([_0x3417('0x69'),_0x3417('0x6b'),_0x3417('0x79'),_0x3417('0x5a'),'createdAt',_0x3417('0x54')],squel[_0x3417('0x75')]()[_0x3417('0x6c')](_0x3417('0x69'),_0x3417('0x69'))['field']('id',_0x3417('0x6b'))['field'](_0x432a9e[_0x3417('0x6e')][_0x3417('0x6f')](),_0x3417('0x79'))[_0x3417('0x6c')](_0x3da4c4[_0x3417('0x46')]['id']['toString'](),_0x3417('0x5a'))[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x53'))[_0x3417('0x6c')](_0x3417('0x6d'),_0x3417('0x54'))['from'](_0x3417('0x71'))[_0x3417('0x3d')](_0x3417('0x72'))['where'](_0x3417('0x7a'),_0x432a9e[_0x3417('0x6e')]['toString']())[_0x3417('0x3d')](_0x3417('0x73')))[_0x3417('0x6f')]();_0x159d2f[_0x3417('0x7b')](db[_0x3417('0x7c')][_0x3417('0x32')](_0x10ebae));}return BPromise[_0x3417('0x82')](_0x159d2f);}})[_0x3417('0x24')](function(){return _0x18c3b5;})[_0x3417('0x24')](respondWithResult(_0x201904,null))['catch'](handleError(_0x201904,null));};exports[_0x3417('0x83')]=function(_0x1a3d24,_0x6fa1f6,_0x5d080d){return db['Campaign']['find']({'where':{'id':_0x1a3d24[_0x3417('0x46')]['id']}})[_0x3417('0x24')](handleEntityNotFound(_0x6fa1f6,null))[_0x3417('0x24')](function(_0x3e5f86){if(_0x3e5f86){return _0x3e5f86[_0x3417('0x83')](_0x1a3d24[_0x3417('0x32')][_0x3417('0x7e')]);}})[_0x3417('0x24')](function(_0x44027f){if(_0x44027f){return db['CmHopperBlack'][_0x3417('0x25')]({'where':{'ListId':_0x1a3d24[_0x3417('0x32')][_0x3417('0x7e')],'CampaignId':_0x1a3d24[_0x3417('0x46')]['id']}})['then'](function(){return _0x44027f;});}})['then'](respondWithStatusCode(_0x6fa1f6,null))['catch'](handleError(_0x6fa1f6,null));}; \ No newline at end of file +var _0xb2fa=['end','json','count','offset','limit','reject','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','keys','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','CampaignId','CmHopper','findAll','rows','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','select','field','phone','NOW()','scheduledAt','CmListId','ListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2fa,0x6a));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xab2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab2f('0x1'));var zipdir=require(_0xab2f('0x2'));var jsonpatch=require(_0xab2f('0x3'));var rp=require('request-promise');var moment=require(_0xab2f('0x4'));var BPromise=require(_0xab2f('0x5'));var Mustache=require(_0xab2f('0x6'));var util=require('util');var path=require(_0xab2f('0x7'));var sox=require(_0xab2f('0x8'));var csv=require(_0xab2f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xab2f('0xa'));var crypto=require(_0xab2f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab2f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xab2f('0xd'));var Papa=require(_0xab2f('0xe'));var Redis=require(_0xab2f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab2f('0x10'));var as=require(_0xab2f('0x11'));var hardwareService=require(_0xab2f('0x12'));var logger=require(_0xab2f('0x13'))(_0xab2f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xab2f('0x15'))['db'];function respondWithStatusCode(_0x211011,_0x30b15b){_0x30b15b=_0x30b15b||0xcc;return function(_0x18e89b){if(_0x18e89b){return _0x211011[_0xab2f('0x16')](_0x30b15b);}return _0x211011[_0xab2f('0x17')](_0x30b15b)[_0xab2f('0x18')]();};}function respondWithResult(_0x21ad43,_0x2a3f4a){_0x2a3f4a=_0x2a3f4a||0xc8;return function(_0x4b7fb3){if(_0x4b7fb3){return _0x21ad43[_0xab2f('0x17')](_0x2a3f4a)[_0xab2f('0x19')](_0x4b7fb3);}};}function respondWithFilteredResult(_0xeb12d8,_0x263fae){return function(_0x3267a7){if(_0x3267a7){var _0x575e39=_0x3267a7[_0xab2f('0x1a')],_0x4c2ce1=_0x263fae[_0xab2f('0x1b')],_0x4d95f3=_0x263fae[_0xab2f('0x1b')]+_0x263fae[_0xab2f('0x1c')],_0x53a30a;if(_0x4d95f3>=_0x575e39){_0x4d95f3=_0x575e39;_0x53a30a=0xc8;}else{_0x53a30a=0xce;}_0xeb12d8['status'](_0x53a30a);return _0xeb12d8['set']('Content-Range',_0x4c2ce1+'-'+_0x4d95f3+'/'+_0x575e39)['json'](_0x3267a7);}return null;};}function patchUpdates(_0x2ac6c3){return function(_0x5bdaec){try{jsonpatch['apply'](_0x5bdaec,_0x2ac6c3,!![]);}catch(_0x25d53f){return BPromise[_0xab2f('0x1d')](_0x25d53f);}return _0x5bdaec[_0xab2f('0x1e')]();};}function saveUpdates(_0x459b4d,_0x4e10bc){return function(_0x33716a){if(_0x33716a){return _0x33716a['update'](_0x459b4d)['then'](function(_0x422494){return _0x422494;});}return null;};}function removeEntity(_0x1b64c2,_0x5f47b6){return function(_0x2cea6b){if(_0x2cea6b){return _0x2cea6b[_0xab2f('0x1f')]()[_0xab2f('0x20')](function(){var _0x2b3f1d=_0x2cea6b[_0xab2f('0x21')]({'plain':!![]});var _0x1489f1=_0xab2f('0x22');return db[_0xab2f('0x23')][_0xab2f('0x1f')]({'where':{'type':_0x1489f1,'resourceId':_0x2b3f1d['id']}})[_0xab2f('0x20')](function(){return _0x2cea6b;});})[_0xab2f('0x20')](function(){_0x1b64c2['status'](0xcc)[_0xab2f('0x18')]();});}};}function handleEntityNotFound(_0x3f5dd9,_0x4e19f4){return function(_0x5b5e82){if(!_0x5b5e82){_0x3f5dd9[_0xab2f('0x16')](0x194);}return _0x5b5e82;};}function handleError(_0x1a774b,_0xd9b3c1){_0xd9b3c1=_0xd9b3c1||0x1f4;return function(_0xc212bf){logger[_0xab2f('0x24')](_0xc212bf[_0xab2f('0x25')]);if(_0xc212bf[_0xab2f('0x26')]){delete _0xc212bf[_0xab2f('0x26')];}_0x1a774b[_0xab2f('0x17')](_0xd9b3c1)['send'](_0xc212bf);};}exports[_0xab2f('0x27')]=function(_0x33ab53,_0x3fe67b){var _0x55478c={},_0x28a669={},_0x57fc85={'count':0x0,'rows':[]};var _0x1ddad7=_[_0xab2f('0x28')](db[_0xab2f('0x29')][_0xab2f('0x2a')],function(_0x788656){return{'name':_0x788656[_0xab2f('0x2b')],'type':_0x788656[_0xab2f('0x2c')][_0xab2f('0x2d')]};});_0x28a669[_0xab2f('0x2e')]=_[_0xab2f('0x28')](_0x1ddad7,_0xab2f('0x26'));_0x28a669[_0xab2f('0x2f')]=_['keys'](_0x33ab53['query']);_0x28a669[_0xab2f('0x30')]=_[_0xab2f('0x31')](_0x28a669['model'],_0x28a669[_0xab2f('0x2f')]);_0x55478c[_0xab2f('0x32')]=_[_0xab2f('0x31')](_0x28a669['model'],qs['fields'](_0x33ab53['query'][_0xab2f('0x33')]));_0x55478c[_0xab2f('0x32')]=_0x55478c[_0xab2f('0x32')][_0xab2f('0x34')]?_0x55478c['attributes']:_0x28a669['model'];if(!_0x33ab53[_0xab2f('0x2f')][_0xab2f('0x35')](_0xab2f('0x36'))){_0x55478c[_0xab2f('0x1c')]=qs[_0xab2f('0x1c')](_0x33ab53[_0xab2f('0x2f')]['limit']);_0x55478c['offset']=qs[_0xab2f('0x1b')](_0x33ab53[_0xab2f('0x2f')][_0xab2f('0x1b')]);}_0x55478c['order']=qs[_0xab2f('0x37')](_0x33ab53['query']['sort']);_0x55478c[_0xab2f('0x38')]=qs[_0xab2f('0x30')](_[_0xab2f('0x39')](_0x33ab53[_0xab2f('0x2f')],_0x28a669[_0xab2f('0x30')]),_0x1ddad7);if(_0x33ab53['query'][_0xab2f('0x3a')]){_0x55478c[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0x55478c['where'],{'$or':_[_0xab2f('0x28')](_0x1ddad7,function(_0x43da48){if(_0x43da48['type']!==_0xab2f('0x3c')){var _0x43a821={};_0x43a821[_0x43da48[_0xab2f('0x26')]]={'$like':'%'+_0x33ab53[_0xab2f('0x2f')]['filter']+'%'};return _0x43a821;}})});}_0x55478c=_[_0xab2f('0x3b')]({},_0x55478c,_0x33ab53['options']);var _0x1b1909={'where':_0x55478c[_0xab2f('0x38')]};return db[_0xab2f('0x29')][_0xab2f('0x1a')](_0x1b1909)['then'](function(_0xef3a3f){_0x57fc85['count']=_0xef3a3f;if(_0x33ab53['query'][_0xab2f('0x3d')]){_0x55478c[_0xab2f('0x3e')]=[{'all':!![]}];}return db[_0xab2f('0x29')]['findAll'](_0x55478c);})[_0xab2f('0x20')](function(_0x51da7e){_0x57fc85['rows']=_0x51da7e;return _0x57fc85;})[_0xab2f('0x20')](respondWithFilteredResult(_0x3fe67b,_0x55478c))[_0xab2f('0x3f')](handleError(_0x3fe67b,null));};exports[_0xab2f('0x40')]=function(_0x12c411,_0x18735e){var _0xb631c4={'raw':![],'where':{'id':_0x12c411['params']['id']}},_0x4722af={};_0x4722af['model']=_['keys'](db[_0xab2f('0x29')][_0xab2f('0x2a')]);_0x4722af[_0xab2f('0x2f')]=_[_0xab2f('0x41')](_0x12c411[_0xab2f('0x2f')]);_0x4722af['filters']=_[_0xab2f('0x31')](_0x4722af[_0xab2f('0x2e')],_0x4722af['query']);_0xb631c4[_0xab2f('0x32')]=_[_0xab2f('0x31')](_0x4722af[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x12c411[_0xab2f('0x2f')]['fields']));_0xb631c4[_0xab2f('0x32')]=_0xb631c4['attributes'][_0xab2f('0x34')]?_0xb631c4[_0xab2f('0x32')]:_0x4722af[_0xab2f('0x2e')];if(_0x12c411['query'][_0xab2f('0x3d')]){_0xb631c4[_0xab2f('0x3e')]=[{'all':!![]}];}_0xb631c4=_[_0xab2f('0x3b')]({},_0xb631c4,_0x12c411[_0xab2f('0x42')]);return db['Campaign']['find'](_0xb631c4)['then'](handleEntityNotFound(_0x18735e,null))['then'](respondWithResult(_0x18735e,null))[_0xab2f('0x3f')](handleError(_0x18735e,null));};exports[_0xab2f('0x43')]=function(_0x4a5a1c,_0x5fcb49){return db['Campaign'][_0xab2f('0x43')](_0x4a5a1c[_0xab2f('0x44')],{})['then'](function(_0x198730){var _0x1ac98b=_0x4a5a1c[_0xab2f('0x45')]['get']({'plain':!![]});if(!_0x1ac98b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ac98b[_0xab2f('0x46')]===_0xab2f('0x45')){var _0xdbb7c6=_0x198730['get']({'plain':!![]});var _0x395b34=_0xab2f('0x22');return db[_0xab2f('0x47')][_0xab2f('0x48')]({'where':{'name':_0x395b34,'userProfileId':_0x1ac98b[_0xab2f('0x49')]},'raw':!![]})[_0xab2f('0x20')](function(_0x5d4574){if(_0x5d4574&&_0x5d4574[_0xab2f('0x4a')]===0x0){return db[_0xab2f('0x23')][_0xab2f('0x43')]({'name':_0xdbb7c6[_0xab2f('0x26')],'resourceId':_0xdbb7c6['id'],'type':_0x5d4574[_0xab2f('0x26')],'sectionId':_0x5d4574['id']},{})['then'](function(){return _0x198730;});}else{return _0x198730;}})[_0xab2f('0x3f')](function(_0xd54a4){logger[_0xab2f('0x24')](_0xab2f('0x4b'),_0xd54a4);throw _0xd54a4;});}return _0x198730;})['then'](respondWithResult(_0x5fcb49,0xc9))[_0xab2f('0x3f')](handleError(_0x5fcb49,null));};exports['clone']=function(_0x16e8e4,_0x1debb4){var _0x50e798={'where':{'id':_0x16e8e4['params']['id']}},_0x34d76c={};_0x34d76c['model']=_['keys'](db['Campaign']['rawAttributes']);_0x50e798['attributes']=_[_0xab2f('0x31')](_0x34d76c[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x16e8e4[_0xab2f('0x2f')]['fields']));_0x50e798[_0xab2f('0x32')]=_0x50e798[_0xab2f('0x32')][_0xab2f('0x34')]?_0x50e798['attributes']:_0x34d76c[_0xab2f('0x2e')];if(_0x16e8e4[_0xab2f('0x2f')][_0xab2f('0x3d')]){_0x50e798[_0xab2f('0x3e')]=[{'all':!![]}];}_0x50e798=_['merge']({},_0x50e798,_0x16e8e4[_0xab2f('0x42')]);return db['Campaign'][_0xab2f('0x48')](_0x50e798)['then'](handleEntityNotFound(_0x1debb4,null))['then'](function(_0x56f031){if(_0x56f031){var _0x18c0da=_0x56f031[_0xab2f('0x21')]({'plain':!![]});_0x18c0da=qs['omit'](_0x18c0da,['id',_0xab2f('0x4c'),_0xab2f('0x4d')]);_0x16e8e4[_0xab2f('0x44')]=_[_0xab2f('0x4e')](_0x16e8e4[_0xab2f('0x44')],['id',_0xab2f('0x4c'),'updatedAt']);return db[_0xab2f('0x29')][_0xab2f('0x43')](_[_0xab2f('0x3b')](_0x18c0da,_0x16e8e4[_0xab2f('0x44')]),{'include':_0x16e8e4[_0xab2f('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0xab2f('0x20')](function(_0x1c025a){var _0x213ae9=_0x16e8e4['user']['get']({'plain':!![]});if(!_0x213ae9)throw new Error(_0xab2f('0x4f'));if(_0x213ae9['role']===_0xab2f('0x45')){var _0x40880e=_0x1c025a[_0xab2f('0x21')]({'plain':!![]});var _0xe39628=_0xab2f('0x22');return db[_0xab2f('0x47')][_0xab2f('0x48')]({'where':{'name':_0xe39628,'userProfileId':_0x213ae9[_0xab2f('0x49')]},'raw':!![]})[_0xab2f('0x20')](function(_0x35938e){if(_0x35938e&&_0x35938e['autoAssociation']===0x0){return db[_0xab2f('0x23')][_0xab2f('0x43')]({'name':_0x40880e[_0xab2f('0x26')],'resourceId':_0x40880e['id'],'type':_0x35938e[_0xab2f('0x26')],'sectionId':_0x35938e['id']},{})[_0xab2f('0x20')](function(){return _0x1c025a;});}else{return _0x1c025a;}})[_0xab2f('0x3f')](function(_0x56d729){logger[_0xab2f('0x24')](_0xab2f('0x4b'),_0x56d729);throw _0x56d729;});}return _0x1c025a;});}})[_0xab2f('0x20')](respondWithResult(_0x1debb4,0xc9))['catch'](handleError(_0x1debb4,null));};exports[_0xab2f('0x50')]=function(_0x148db4,_0x36249a){if(_0x148db4['body']['id']){delete _0x148db4[_0xab2f('0x44')]['id'];}return db[_0xab2f('0x29')]['find']({'where':{'id':_0x148db4[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x36249a,null))['then'](saveUpdates(_0x148db4[_0xab2f('0x44')],null))[_0xab2f('0x20')](respondWithResult(_0x36249a,null))[_0xab2f('0x3f')](handleError(_0x36249a,null));};exports[_0xab2f('0x1f')]=function(_0x49a797,_0x268957){return db[_0xab2f('0x29')][_0xab2f('0x48')]({'where':{'id':_0x49a797[_0xab2f('0x51')]['id']}})['then'](handleEntityNotFound(_0x268957,null))[_0xab2f('0x20')](removeEntity(_0x268957,null))[_0xab2f('0x3f')](handleError(_0x268957,null));};exports['getHoppers']=function(_0x4bbaed,_0x340986,_0x5c2ac9){var _0x1fe22c={'raw':!![],'where':{}};var _0x1393d1={};var _0x5eed51={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4bbaed[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x340986,null))[_0xab2f('0x20')](function(_0x1138dd){if(_0x1138dd){_0x1393d1[_0xab2f('0x2e')]=_[_0xab2f('0x41')](db['CmHopper'][_0xab2f('0x2a')]);_0x1393d1[_0xab2f('0x2f')]=_[_0xab2f('0x41')](_0x4bbaed[_0xab2f('0x2f')]);_0x1393d1[_0xab2f('0x30')]=_[_0xab2f('0x31')](_0x1393d1[_0xab2f('0x2e')],_0x1393d1[_0xab2f('0x2f')]);_0x1fe22c[_0xab2f('0x32')]=_['intersection'](_0x1393d1[_0xab2f('0x2e')],qs['fields'](_0x4bbaed[_0xab2f('0x2f')][_0xab2f('0x33')]));_0x1fe22c['attributes']=_0x1fe22c[_0xab2f('0x32')][_0xab2f('0x34')]?_0x1fe22c[_0xab2f('0x32')]:_0x1393d1[_0xab2f('0x2e')];if(!_0x4bbaed[_0xab2f('0x2f')][_0xab2f('0x35')](_0xab2f('0x36'))){_0x1fe22c[_0xab2f('0x1c')]=qs['limit'](_0x4bbaed[_0xab2f('0x2f')][_0xab2f('0x1c')]);_0x1fe22c[_0xab2f('0x1b')]=qs[_0xab2f('0x1b')](_0x4bbaed[_0xab2f('0x2f')]['offset']);}_0x1fe22c['order']=qs['sort'](_0x4bbaed[_0xab2f('0x2f')][_0xab2f('0x37')]);_0x1fe22c[_0xab2f('0x38')]=qs['filters'](_['pick'](_0x4bbaed[_0xab2f('0x2f')],_0x1393d1['filters']));_0x1fe22c['where'][_0xab2f('0x52')]=_0x1138dd['id'];if(_0x4bbaed[_0xab2f('0x2f')]['filter']){_0x1fe22c[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0x1fe22c[_0xab2f('0x38')],{'$or':_['map'](_0x1fe22c[_0xab2f('0x32')],function(_0x8be0ca){var _0x1b8f92={};_0x1b8f92[_0x8be0ca]={'$like':'%'+_0x4bbaed['query'][_0xab2f('0x3a')]+'%'};return _0x1b8f92;})});}_0x1fe22c=_['merge']({},_0x1fe22c,_0x4bbaed[_0xab2f('0x42')]);return db['CmHopper'][_0xab2f('0x1a')]({'where':_0x1fe22c[_0xab2f('0x38')]})['then'](function(_0x3bc1bd){_0x5eed51[_0xab2f('0x1a')]=_0x3bc1bd;if(_0x4bbaed[_0xab2f('0x2f')][_0xab2f('0x3d')]){_0x1fe22c[_0xab2f('0x3e')]=[{'all':!![]}];}return db[_0xab2f('0x53')][_0xab2f('0x54')](_0x1fe22c);})['then'](function(_0x4c1e68){_0x5eed51[_0xab2f('0x55')]=_0x4c1e68;return _0x5eed51;});}})[_0xab2f('0x20')](respondWithFilteredResult(_0x340986,_0x1fe22c))['catch'](handleError(_0x340986,null));};exports['getHopperHistories']=function(_0x6a12d3,_0x274197,_0x5a5793){var _0x4e3c4c={'raw':!![],'where':{}};var _0x22c6bd={};var _0x421d81={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x6a12d3['params']['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x274197,null))[_0xab2f('0x20')](function(_0x45bef9){if(_0x45bef9){_0x22c6bd[_0xab2f('0x2e')]=_[_0xab2f('0x41')](db[_0xab2f('0x56')][_0xab2f('0x2a')]);_0x22c6bd['query']=_['keys'](_0x6a12d3[_0xab2f('0x2f')]);_0x22c6bd[_0xab2f('0x30')]=_['intersection'](_0x22c6bd['model'],_0x22c6bd[_0xab2f('0x2f')]);_0x4e3c4c[_0xab2f('0x32')]=_[_0xab2f('0x31')](_0x22c6bd[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x33')]));_0x4e3c4c[_0xab2f('0x32')]=_0x4e3c4c[_0xab2f('0x32')][_0xab2f('0x34')]?_0x4e3c4c['attributes']:_0x22c6bd[_0xab2f('0x2e')];if(!_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x35')]('nolimit')){_0x4e3c4c['limit']=qs[_0xab2f('0x1c')](_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x1c')]);_0x4e3c4c[_0xab2f('0x1b')]=qs[_0xab2f('0x1b')](_0x6a12d3[_0xab2f('0x2f')]['offset']);}_0x4e3c4c[_0xab2f('0x57')]=qs[_0xab2f('0x37')](_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x37')]);_0x4e3c4c[_0xab2f('0x38')]=qs[_0xab2f('0x30')](_[_0xab2f('0x39')](_0x6a12d3[_0xab2f('0x2f')],_0x22c6bd[_0xab2f('0x30')]));_0x4e3c4c[_0xab2f('0x38')][_0xab2f('0x52')]=_0x45bef9['id'];if(_0x6a12d3['query'][_0xab2f('0x3a')]){_0x4e3c4c[_0xab2f('0x38')]=_['merge'](_0x4e3c4c['where'],{'$or':_['map'](_0x4e3c4c[_0xab2f('0x32')],function(_0x3a4e26){var _0x3ab75a={};_0x3ab75a[_0x3a4e26]={'$like':'%'+_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x3a')]+'%'};return _0x3ab75a;})});}_0x4e3c4c=_[_0xab2f('0x3b')]({},_0x4e3c4c,_0x6a12d3[_0xab2f('0x42')]);return db[_0xab2f('0x56')][_0xab2f('0x1a')]({'where':_0x4e3c4c[_0xab2f('0x38')]})[_0xab2f('0x20')](function(_0x472e24){_0x421d81[_0xab2f('0x1a')]=_0x472e24;if(_0x6a12d3[_0xab2f('0x2f')][_0xab2f('0x3d')]){_0x4e3c4c['include']=[{'all':!![]}];}return db[_0xab2f('0x56')][_0xab2f('0x54')](_0x4e3c4c);})[_0xab2f('0x20')](function(_0x2a13c7){_0x421d81[_0xab2f('0x55')]=_0x2a13c7;return _0x421d81;});}})['then'](respondWithFilteredResult(_0x274197,_0x4e3c4c))[_0xab2f('0x3f')](handleError(_0x274197,null));};exports[_0xab2f('0x58')]=function(_0x108c5a,_0x681941,_0x288009){var _0x1e8232={'raw':!![],'where':{}};var _0x10f113={};var _0x21629a={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x108c5a[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x681941,null))[_0xab2f('0x20')](function(_0x160f40){if(_0x160f40){_0x10f113[_0xab2f('0x2e')]=_[_0xab2f('0x41')](db[_0xab2f('0x59')]['rawAttributes']);_0x10f113[_0xab2f('0x2f')]=_['keys'](_0x108c5a[_0xab2f('0x2f')]);_0x10f113[_0xab2f('0x30')]=_[_0xab2f('0x31')](_0x10f113[_0xab2f('0x2e')],_0x10f113[_0xab2f('0x2f')]);_0x1e8232[_0xab2f('0x32')]=_['intersection'](_0x10f113[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x108c5a['query'][_0xab2f('0x33')]));_0x1e8232[_0xab2f('0x32')]=_0x1e8232[_0xab2f('0x32')][_0xab2f('0x34')]?_0x1e8232['attributes']:_0x10f113[_0xab2f('0x2e')];if(!_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x35')](_0xab2f('0x36'))){_0x1e8232[_0xab2f('0x1c')]=qs['limit'](_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x1c')]);_0x1e8232['offset']=qs['offset'](_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x1b')]);}_0x1e8232['order']=qs[_0xab2f('0x37')](_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x37')]);_0x1e8232[_0xab2f('0x38')]=qs['filters'](_[_0xab2f('0x39')](_0x108c5a[_0xab2f('0x2f')],_0x10f113['filters']));_0x1e8232['where'][_0xab2f('0x52')]=_0x160f40['id'];if(_0x108c5a['query'][_0xab2f('0x3a')]){_0x1e8232[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0x1e8232[_0xab2f('0x38')],{'$or':_[_0xab2f('0x28')](_0x1e8232[_0xab2f('0x32')],function(_0x4cd3f1){var _0x31f866={};_0x31f866[_0x4cd3f1]={'$like':'%'+_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x3a')]+'%'};return _0x31f866;})});}_0x1e8232=_[_0xab2f('0x3b')]({},_0x1e8232,_0x108c5a['options']);return db[_0xab2f('0x59')]['count']({'where':_0x1e8232[_0xab2f('0x38')]})[_0xab2f('0x20')](function(_0x428e91){_0x21629a[_0xab2f('0x1a')]=_0x428e91;if(_0x108c5a[_0xab2f('0x2f')][_0xab2f('0x3d')]){_0x1e8232['include']=[{'all':!![]}];}return db[_0xab2f('0x59')]['findAll'](_0x1e8232);})[_0xab2f('0x20')](function(_0x4eca61){_0x21629a[_0xab2f('0x55')]=_0x4eca61;return _0x21629a;});}})['then'](respondWithFilteredResult(_0x681941,_0x1e8232))['catch'](handleError(_0x681941,null));};exports[_0xab2f('0x5a')]=function(_0x45b7bf,_0x173226,_0x1fe3b1){var _0x3c70dd={'raw':!![],'where':{}};var _0x4dedf9={};var _0x4897ed={'count':0x0,'rows':[]};return db[_0xab2f('0x29')][_0xab2f('0x5b')]({'where':{'id':_0x45b7bf['params']['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x173226,null))[_0xab2f('0x20')](function(_0x56725f){if(_0x56725f){_0x4dedf9['model']=_[_0xab2f('0x41')](db[_0xab2f('0x5c')]['rawAttributes']);_0x4dedf9[_0xab2f('0x2f')]=_[_0xab2f('0x41')](_0x45b7bf[_0xab2f('0x2f')]);_0x4dedf9[_0xab2f('0x30')]=_['intersection'](_0x4dedf9[_0xab2f('0x2e')],_0x4dedf9[_0xab2f('0x2f')]);_0x3c70dd[_0xab2f('0x32')]=_['intersection'](_0x4dedf9[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x33')]));_0x3c70dd[_0xab2f('0x32')]=_0x3c70dd[_0xab2f('0x32')][_0xab2f('0x34')]?_0x3c70dd[_0xab2f('0x32')]:_0x4dedf9[_0xab2f('0x2e')];if(!_0x45b7bf[_0xab2f('0x2f')]['hasOwnProperty'](_0xab2f('0x36'))){_0x3c70dd[_0xab2f('0x1c')]=qs[_0xab2f('0x1c')](_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x1c')]);_0x3c70dd[_0xab2f('0x1b')]=qs[_0xab2f('0x1b')](_0x45b7bf['query'][_0xab2f('0x1b')]);}_0x3c70dd[_0xab2f('0x57')]=qs[_0xab2f('0x37')](_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x37')]);_0x3c70dd[_0xab2f('0x38')]=qs[_0xab2f('0x30')](_[_0xab2f('0x39')](_0x45b7bf[_0xab2f('0x2f')],_0x4dedf9[_0xab2f('0x30')]));_0x3c70dd[_0xab2f('0x38')][_0xab2f('0x52')]=_0x56725f['id'];if(_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x3a')]){_0x3c70dd[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0x3c70dd[_0xab2f('0x38')],{'$or':_[_0xab2f('0x28')](_0x3c70dd[_0xab2f('0x32')],function(_0x51e465){var _0x2f0d47={};_0x2f0d47[_0x51e465]={'$like':'%'+_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x3a')]+'%'};return _0x2f0d47;})});}_0x3c70dd=_[_0xab2f('0x3b')]({},_0x3c70dd,_0x45b7bf[_0xab2f('0x42')]);return db[_0xab2f('0x5c')][_0xab2f('0x1a')]({'where':_0x3c70dd[_0xab2f('0x38')]})[_0xab2f('0x20')](function(_0x2cc685){_0x4897ed['count']=_0x2cc685;if(_0x45b7bf[_0xab2f('0x2f')][_0xab2f('0x3d')]){_0x3c70dd[_0xab2f('0x3e')]=[{'all':!![]}];}return db[_0xab2f('0x5c')][_0xab2f('0x54')](_0x3c70dd);})[_0xab2f('0x20')](function(_0x87de29){_0x4897ed[_0xab2f('0x55')]=_0x87de29;return _0x4897ed;});}})['then'](respondWithFilteredResult(_0x173226,_0x3c70dd))['catch'](handleError(_0x173226,null));};exports['getLists']=function(_0x43a4ca,_0x3ab7e1,_0x4a04b7){var _0xbb4e69={};var _0x402103={};var _0x1145a8;var _0x240875;return db[_0xab2f('0x29')][_0xab2f('0x5b')]({'where':{'id':_0x43a4ca['params']['id']}})['then'](handleEntityNotFound(_0x3ab7e1,null))[_0xab2f('0x20')](function(_0x462720){if(_0x462720){_0x1145a8=_0x462720;_0x402103[_0xab2f('0x2e')]=_[_0xab2f('0x41')](db[_0xab2f('0x5d')][_0xab2f('0x2a')]);_0x402103[_0xab2f('0x2f')]=_['keys'](_0x43a4ca['query']);_0x402103['filters']=_['intersection'](_0x402103[_0xab2f('0x2e')],_0x402103[_0xab2f('0x2f')]);_0xbb4e69[_0xab2f('0x32')]=_[_0xab2f('0x31')](_0x402103[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x43a4ca[_0xab2f('0x2f')][_0xab2f('0x33')]));_0xbb4e69[_0xab2f('0x32')]=_0xbb4e69[_0xab2f('0x32')][_0xab2f('0x34')]?_0xbb4e69[_0xab2f('0x32')]:_0x402103['model'];_0xbb4e69[_0xab2f('0x57')]=qs[_0xab2f('0x37')](_0x43a4ca['query'][_0xab2f('0x37')]);_0xbb4e69[_0xab2f('0x38')]=qs['filters'](_[_0xab2f('0x39')](_0x43a4ca[_0xab2f('0x2f')],_0x402103['filters']));if(_0x43a4ca[_0xab2f('0x2f')][_0xab2f('0x3a')]){_0xbb4e69[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0xbb4e69[_0xab2f('0x38')],{'$or':_[_0xab2f('0x28')](_0xbb4e69[_0xab2f('0x32')],function(_0x57af96){var _0x2afbb6={};_0x2afbb6[_0x57af96]={'$like':'%'+_0x43a4ca[_0xab2f('0x2f')][_0xab2f('0x3a')]+'%'};return _0x2afbb6;})});}_0xbb4e69=_[_0xab2f('0x3b')]({},_0xbb4e69,_0x43a4ca[_0xab2f('0x42')]);return _0x1145a8['getLists'](_0xbb4e69);}})[_0xab2f('0x20')](function(_0x568319){if(_0x568319){_0x240875=_0x568319[_0xab2f('0x34')];if(!_0x43a4ca[_0xab2f('0x2f')][_0xab2f('0x35')](_0xab2f('0x36'))){_0xbb4e69[_0xab2f('0x1c')]=qs[_0xab2f('0x1c')](_0x43a4ca[_0xab2f('0x2f')]['limit']);_0xbb4e69[_0xab2f('0x1b')]=qs[_0xab2f('0x1b')](_0x43a4ca[_0xab2f('0x2f')][_0xab2f('0x1b')]);}return _0x1145a8[_0xab2f('0x5e')](_0xbb4e69);}})[_0xab2f('0x20')](function(_0x1c66b1){if(_0x1c66b1){return _0x1c66b1?{'count':_0x240875,'rows':_0x1c66b1}:null;}})[_0xab2f('0x20')](respondWithResult(_0x3ab7e1,null))[_0xab2f('0x3f')](handleError(_0x3ab7e1,null));};exports[_0xab2f('0x5f')]=function(_0x58c7d5,_0x3f602c,_0x3b5829){var _0x166f19,_0x528620;return db[_0xab2f('0x29')][_0xab2f('0x48')]({'where':{'id':_0x58c7d5[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x3f602c,null))[_0xab2f('0x20')](function(_0x2ef30a){if(_0x2ef30a){_0x528620=_0x2ef30a;return _0x2ef30a[_0xab2f('0x5f')](_0x58c7d5[_0xab2f('0x44')][_0xab2f('0x60')],_[_0xab2f('0x4e')](_0x58c7d5[_0xab2f('0x44')],[_0xab2f('0x60'),'id'])||{});}return null;})['spread'](function(_0x118a86){var _0x2e24d8;_0x166f19=_0x118a86||[];var _0x2afe62=[];if(_0x118a86){for(var _0x41eb85=0x0;_0x41eb85<_0x118a86[_0xab2f('0x34')];_0x41eb85+=0x1){var _0x5706fb=_0x118a86[_0x41eb85][_0xab2f('0x21')]({'plain':!![]});_0x528620[_0xab2f('0x61')]=_0x58c7d5[_0xab2f('0x44')]['dialCheckDuplicateType']?_0x58c7d5['body']['dialCheckDuplicateType']:_0x528620[_0xab2f('0x61')];switch(_0x528620['dialCheckDuplicateType']){case _0xab2f('0x62'):_0x2e24d8=squel[_0xab2f('0x63')]()['into'](_0xab2f('0x64'))[_0xab2f('0x65')](['phone','scheduledAt',_0xab2f('0x66'),'ListId',_0xab2f('0x52'),'createdAt',_0xab2f('0x4d')],squel[_0xab2f('0x67')]()[_0xab2f('0x68')]('phone',_0xab2f('0x69'))[_0xab2f('0x68')](_0xab2f('0x6a'),_0xab2f('0x6b'))['field']('id','ContactId')['field'](_0x5706fb[_0xab2f('0x6c')]['toString'](),_0xab2f('0x6d'))[_0xab2f('0x68')](_0x58c7d5[_0xab2f('0x51')]['id'][_0xab2f('0x6e')](),_0xab2f('0x52'))['field'](_0xab2f('0x6a'),'createdAt')[_0xab2f('0x68')]('NOW()',_0xab2f('0x4d'))[_0xab2f('0x6f')]('cm_contacts')[_0xab2f('0x38')](_0xab2f('0x70'))[_0xab2f('0x38')](_0xab2f('0x71'),_0x5706fb[_0xab2f('0x6c')][_0xab2f('0x6e')]())[_0xab2f('0x38')](_0xab2f('0x72'))[_0xab2f('0x38')](_0xab2f('0x73'),squel[_0xab2f('0x67')]()[_0xab2f('0x68')](_0xab2f('0x74'))[_0xab2f('0x6f')](_0xab2f('0x75'))[_0xab2f('0x38')](_0xab2f('0x76'),_0x58c7d5[_0xab2f('0x51')]['id'][_0xab2f('0x6e')]()))[_0xab2f('0x38')](_0xab2f('0x73'),squel[_0xab2f('0x67')]()[_0xab2f('0x68')](_0xab2f('0x77'))[_0xab2f('0x6f')]('cm_hopper')[_0xab2f('0x38')]('CampaignId\x20=\x20?',_0x58c7d5[_0xab2f('0x51')]['id'][_0xab2f('0x6e')]())))[_0xab2f('0x6e')]();break;case _0xab2f('0x78'):_0x2e24d8=squel[_0xab2f('0x63')]()[_0xab2f('0x79')](_0xab2f('0x64'))[_0xab2f('0x65')]([_0xab2f('0x69'),_0xab2f('0x6b'),_0xab2f('0x66'),_0xab2f('0x6d'),_0xab2f('0x52'),_0xab2f('0x4c'),_0xab2f('0x4d')],squel[_0xab2f('0x67')]()[_0xab2f('0x68')](_0xab2f('0x69'),_0xab2f('0x69'))[_0xab2f('0x68')](_0xab2f('0x6a'),_0xab2f('0x6b'))[_0xab2f('0x68')]('id','ContactId')[_0xab2f('0x68')](_0x5706fb[_0xab2f('0x6c')][_0xab2f('0x6e')](),_0xab2f('0x6d'))['field'](_0x58c7d5[_0xab2f('0x51')]['id']['toString'](),'CampaignId')[_0xab2f('0x68')](_0xab2f('0x6a'),'createdAt')[_0xab2f('0x68')]('NOW()',_0xab2f('0x4d'))[_0xab2f('0x6f')](_0xab2f('0x7a'))[_0xab2f('0x38')](_0xab2f('0x70'))[_0xab2f('0x38')]('ListId\x20=\x20?',_0x5706fb[_0xab2f('0x6c')][_0xab2f('0x6e')]())[_0xab2f('0x38')](_0xab2f('0x72'))['where'](_0xab2f('0x73'),squel['select']()[_0xab2f('0x68')](_0xab2f('0x77'))[_0xab2f('0x6f')](_0xab2f('0x64'))['where'](_0xab2f('0x76'),_0x58c7d5['params']['id'][_0xab2f('0x6e')]())))[_0xab2f('0x6e')]();break;default:_0x2e24d8=squel[_0xab2f('0x63')]()['into'](_0xab2f('0x64'))['fromQuery']([_0xab2f('0x69'),_0xab2f('0x6b'),_0xab2f('0x66'),'ListId',_0xab2f('0x52'),_0xab2f('0x4c'),_0xab2f('0x4d')],squel[_0xab2f('0x67')]()[_0xab2f('0x68')](_0xab2f('0x69'),_0xab2f('0x69'))[_0xab2f('0x68')](_0xab2f('0x6a'),'scheduledAt')[_0xab2f('0x68')]('id',_0xab2f('0x66'))[_0xab2f('0x68')](_0x5706fb[_0xab2f('0x6c')][_0xab2f('0x6e')](),_0xab2f('0x6d'))[_0xab2f('0x68')](_0x58c7d5['params']['id'][_0xab2f('0x6e')](),_0xab2f('0x52'))[_0xab2f('0x68')](_0xab2f('0x6a'),'createdAt')[_0xab2f('0x68')](_0xab2f('0x6a'),_0xab2f('0x4d'))['from'](_0xab2f('0x7a'))['where']('deletedAt\x20IS\x20NULL')[_0xab2f('0x38')](_0xab2f('0x71'),_0x5706fb[_0xab2f('0x6c')][_0xab2f('0x6e')]())[_0xab2f('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0xab2f('0x6e')]();}_0x2afe62[_0xab2f('0x7b')](db[_0xab2f('0x7c')][_0xab2f('0x2f')](_0x2e24d8));}return BPromise['all'](_0x2afe62);}})[_0xab2f('0x20')](function(){return _0x166f19;})[_0xab2f('0x20')](respondWithResult(_0x3f602c,null))[_0xab2f('0x3f')](handleError(_0x3f602c,null));};exports[_0xab2f('0x7d')]=function(_0x2601e2,_0x460199,_0x3909ae){return db['Campaign'][_0xab2f('0x48')]({'where':{'id':_0x2601e2[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x460199,null))['then'](function(_0xb6135b){if(_0xb6135b){return _0xb6135b[_0xab2f('0x7d')](_0x2601e2[_0xab2f('0x2f')][_0xab2f('0x60')]);}})[_0xab2f('0x20')](function(_0x5d896e){if(_0x5d896e){return db[_0xab2f('0x53')][_0xab2f('0x1f')]({'where':{'ListId':_0x2601e2[_0xab2f('0x2f')][_0xab2f('0x60')],'CampaignId':_0x2601e2[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](function(){return _0x5d896e;});}})[_0xab2f('0x20')](respondWithStatusCode(_0x460199,null))[_0xab2f('0x3f')](handleError(_0x460199,null));};exports[_0xab2f('0x7e')]=function(_0x1c6aab,_0x20726a,_0x2b9497){var _0x219e49={'raw':!![],'where':{}};var _0x32215e={};var _0x4385eb={'count':0x0,'rows':[]};return db[_0xab2f('0x29')][_0xab2f('0x5b')]({'where':{'id':_0x1c6aab['params']['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x20726a,null))[_0xab2f('0x20')](function(_0x41bd6c){if(_0x41bd6c){_0x32215e['model']=_[_0xab2f('0x41')](db[_0xab2f('0x5d')][_0xab2f('0x2a')]);_0x32215e['query']=_[_0xab2f('0x41')](_0x1c6aab[_0xab2f('0x2f')]);_0x32215e[_0xab2f('0x30')]=_[_0xab2f('0x31')](_0x32215e[_0xab2f('0x2e')],_0x32215e[_0xab2f('0x2f')]);_0x219e49['attributes']=_['intersection'](_0x32215e[_0xab2f('0x2e')],qs[_0xab2f('0x33')](_0x1c6aab['query']['fields']));_0x219e49['attributes']=_0x219e49['attributes'][_0xab2f('0x34')]?_0x219e49[_0xab2f('0x32')]:_0x32215e[_0xab2f('0x2e')];if(!_0x1c6aab[_0xab2f('0x2f')]['hasOwnProperty'](_0xab2f('0x36'))){_0x219e49[_0xab2f('0x1c')]=qs[_0xab2f('0x1c')](_0x1c6aab[_0xab2f('0x2f')][_0xab2f('0x1c')]);_0x219e49[_0xab2f('0x1b')]=qs[_0xab2f('0x1b')](_0x1c6aab[_0xab2f('0x2f')][_0xab2f('0x1b')]);}_0x219e49[_0xab2f('0x57')]=qs[_0xab2f('0x37')](_0x1c6aab['query'][_0xab2f('0x37')]);_0x219e49[_0xab2f('0x38')]=qs[_0xab2f('0x30')](_[_0xab2f('0x39')](_0x1c6aab[_0xab2f('0x2f')],_0x32215e[_0xab2f('0x30')]));_0x219e49[_0xab2f('0x38')][_0xab2f('0x52')]=_0x41bd6c['id'];if(_0x1c6aab['query'][_0xab2f('0x3a')]){_0x219e49[_0xab2f('0x38')]=_[_0xab2f('0x3b')](_0x219e49['where'],{'$or':_[_0xab2f('0x28')](_0x219e49['attributes'],function(_0x4401fc){var _0x463111={};_0x463111[_0x4401fc]={'$like':'%'+_0x1c6aab[_0xab2f('0x2f')][_0xab2f('0x3a')]+'%'};return _0x463111;})});}_0x219e49=_[_0xab2f('0x3b')]({},_0x219e49,_0x1c6aab['options']);return db['CmList'][_0xab2f('0x1a')]({'where':_0x219e49[_0xab2f('0x38')]})['then'](function(_0x12372e){_0x4385eb[_0xab2f('0x1a')]=_0x12372e;if(_0x1c6aab[_0xab2f('0x2f')]['includeAll']){_0x219e49[_0xab2f('0x3e')]=[{'all':!![]}];}return db[_0xab2f('0x5d')][_0xab2f('0x54')](_0x219e49);})[_0xab2f('0x20')](function(_0x84cf52){_0x4385eb[_0xab2f('0x55')]=_0x84cf52;return _0x4385eb;});}})[_0xab2f('0x20')](respondWithFilteredResult(_0x20726a,_0x219e49))[_0xab2f('0x3f')](handleError(_0x20726a,null));};exports[_0xab2f('0x7f')]=function(_0xfdb0eb,_0x321a62,_0x2141fa){var _0x3764ac,_0x3558de;return db[_0xab2f('0x29')][_0xab2f('0x48')]({'where':{'id':_0xfdb0eb[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x321a62,null))['then'](function(_0x2330f7){if(_0x2330f7){_0x3558de=_0x2330f7;return _0x2330f7[_0xab2f('0x7f')](_0xfdb0eb[_0xab2f('0x44')][_0xab2f('0x60')],_[_0xab2f('0x4e')](_0xfdb0eb[_0xab2f('0x44')],[_0xab2f('0x60'),'id'])||{});}return null;})[_0xab2f('0x80')](function(_0x7ffad7){var _0x49fd71;_0x3764ac=_0x7ffad7||[];var _0x837c70=[];if(_0x7ffad7){for(var _0x154afa=0x0;_0x154afa<_0x7ffad7['length'];_0x154afa+=0x1){var _0x334d60=_0x7ffad7[_0x154afa][_0xab2f('0x21')]({'plain':!![]});_0x49fd71=squel[_0xab2f('0x63')]()[_0xab2f('0x79')](_0xab2f('0x81'))[_0xab2f('0x65')](['phone','ContactId',_0xab2f('0x6d'),_0xab2f('0x52'),'createdAt',_0xab2f('0x4d')],squel[_0xab2f('0x67')]()[_0xab2f('0x68')](_0xab2f('0x69'),_0xab2f('0x69'))[_0xab2f('0x68')]('id','ContactId')['field'](_0x334d60[_0xab2f('0x6c')]['toString'](),_0xab2f('0x6d'))[_0xab2f('0x68')](_0xfdb0eb['params']['id']['toString'](),_0xab2f('0x52'))[_0xab2f('0x68')]('NOW()','createdAt')[_0xab2f('0x68')](_0xab2f('0x6a'),_0xab2f('0x4d'))[_0xab2f('0x6f')]('cm_contacts')[_0xab2f('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0xab2f('0x71'),_0x334d60['CmListId']['toString']())[_0xab2f('0x38')](_0xab2f('0x72')))[_0xab2f('0x6e')]();_0x837c70[_0xab2f('0x7b')](db[_0xab2f('0x7c')][_0xab2f('0x2f')](_0x49fd71));}return BPromise['all'](_0x837c70);}})[_0xab2f('0x20')](function(){return _0x3764ac;})[_0xab2f('0x20')](respondWithResult(_0x321a62,null))['catch'](handleError(_0x321a62,null));};exports['removeBlackLists']=function(_0x320a79,_0x1a2c42,_0x2b47db){return db[_0xab2f('0x29')][_0xab2f('0x48')]({'where':{'id':_0x320a79[_0xab2f('0x51')]['id']}})[_0xab2f('0x20')](handleEntityNotFound(_0x1a2c42,null))[_0xab2f('0x20')](function(_0x35dd29){if(_0x35dd29){return _0x35dd29['removeBlackLists'](_0x320a79['query'][_0xab2f('0x60')]);}})[_0xab2f('0x20')](function(_0x299ec4){if(_0x299ec4){return db[_0xab2f('0x5c')]['destroy']({'where':{'ListId':_0x320a79[_0xab2f('0x2f')][_0xab2f('0x60')],'CampaignId':_0x320a79['params']['id']}})['then'](function(){return _0x299ec4;});}})['then'](respondWithStatusCode(_0x1a2c42,null))[_0xab2f('0x3f')](handleError(_0x1a2c42,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 186ae0b..bb54ea4 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a9e4a,_0x585df1){_0x4a9e4a=_0x4a9e4a-0x0;var _0xaa903e=_0xb10b[_0x4a9e4a];return _0xaa903e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x52eb16,_0x89c3d8){var _0x382d3f=function(_0x378238){while(--_0x378238){_0x52eb16['push'](_0x52eb16['shift']());}};_0x382d3f(++_0x89c3d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xb10b[_0x79b649];return _0x1af9b1;};'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 6c83503..06fd0af 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x46a9b0,_0x7279e3){var _0x4d5baf=function(_0x3b2026){while(--_0x3b2026){_0x46a9b0['push'](_0x46a9b0['shift']());}};_0x4d5baf(++_0x7279e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x2bd6db,_0x5b3a79){var _0x36aab0=function(_0x1f6ce3){while(--_0x1f6ce3){_0x2bd6db['push'](_0x2bd6db['shift']());}};_0x36aab0(++_0x5b3a79);}(_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 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 6a86422..8c716d5 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 _0x0e6f=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists','addBlackLists','put','delete','/:id','removeLists'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x0e6f,0x1b3));var _0xf0e6=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x0e6f[_0x3f2ecf];return _0xa6dd7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0e6('0x0'));var timeout=require(_0xf0e6('0x1'));var express=require(_0xf0e6('0x2'));var router=express[_0xf0e6('0x3')]();var auth=require(_0xf0e6('0x4'));var interaction=require(_0xf0e6('0x5'));var config=require(_0xf0e6('0x6'));var controller=require('./campaign.controller');router[_0xf0e6('0x7')]('/',auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x9')]);router[_0xf0e6('0x7')]('/:id',auth[_0xf0e6('0x8')](),controller[_0xf0e6('0xa')]);router[_0xf0e6('0x7')]('/:id/hoppers',auth[_0xf0e6('0x8')](),controller[_0xf0e6('0xb')]);router[_0xf0e6('0x7')](_0xf0e6('0xc'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0xd')]);router[_0xf0e6('0x7')](_0xf0e6('0xe'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0xf')]);router[_0xf0e6('0x7')](_0xf0e6('0x10'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x11')]);router[_0xf0e6('0x7')](_0xf0e6('0x12'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x13')]);router[_0xf0e6('0x7')](_0xf0e6('0x14'),auth[_0xf0e6('0x8')](),controller['getBlackLists']);router[_0xf0e6('0x15')]('/',auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x16')]);router['post'](_0xf0e6('0x17'),auth['isAuthenticated'](),controller['clone']);router[_0xf0e6('0x15')](_0xf0e6('0x12'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x18')]);router[_0xf0e6('0x15')](_0xf0e6('0x14'),auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x19')]);router[_0xf0e6('0x1a')]('/:id',auth[_0xf0e6('0x8')](),controller['update']);router[_0xf0e6('0x1b')](_0xf0e6('0x1c'),auth[_0xf0e6('0x8')](),controller['destroy']);router[_0xf0e6('0x1b')]('/:id/lists',auth[_0xf0e6('0x8')](),controller[_0xf0e6('0x1d')]);router[_0xf0e6('0x1b')](_0xf0e6('0x14'),auth[_0xf0e6('0x8')](),controller['removeBlackLists']);module[_0xf0e6('0x1e')]=router; \ No newline at end of file +var _0x7b58=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','path','express','Router','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','getHopperHistories'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x7b58,0xad));var _0x87b5=function(_0x56fb7d,_0x539ea1){_0x56fb7d=_0x56fb7d-0x0;var _0x3be1c3=_0x7b58[_0x56fb7d];return _0x3be1c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87b5('0x0'));var timeout=require('connect-timeout');var express=require(_0x87b5('0x1'));var router=express[_0x87b5('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87b5('0x3'));var controller=require(_0x87b5('0x4'));router['get']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0x6')]);router[_0x87b5('0x7')](_0x87b5('0x8'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x9')]);router['get'](_0x87b5('0xa'),auth[_0x87b5('0x5')](),controller[_0x87b5('0xb')]);router[_0x87b5('0x7')]('/:id/hopper_histories',auth[_0x87b5('0x5')](),controller[_0x87b5('0xc')]);router[_0x87b5('0x7')]('/:id/hopper_finals',auth[_0x87b5('0x5')](),controller[_0x87b5('0xd')]);router['get'](_0x87b5('0xe'),auth[_0x87b5('0x5')](),controller[_0x87b5('0xf')]);router[_0x87b5('0x7')](_0x87b5('0x10'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x11')]);router[_0x87b5('0x7')]('/:id/blacklists',auth[_0x87b5('0x5')](),controller['getBlackLists']);router['post']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0x12')]);router[_0x87b5('0x13')](_0x87b5('0x14'),auth['isAuthenticated'](),controller[_0x87b5('0x15')]);router[_0x87b5('0x13')]('/:id/lists',auth[_0x87b5('0x5')](),controller[_0x87b5('0x16')]);router[_0x87b5('0x13')](_0x87b5('0x17'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x18')]);router[_0x87b5('0x19')](_0x87b5('0x8'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x1a')]);router[_0x87b5('0x1b')](_0x87b5('0x8'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x1c')]);router['delete'](_0x87b5('0x10'),auth[_0x87b5('0x5')](),controller['removeLists']);router[_0x87b5('0x1b')](_0x87b5('0x17'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x1d')]);module[_0x87b5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2b714a7..01e635d 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 _0x7b43=['exports','STRING','TEXT','VIRTUAL','getDataValue','sequelize'];(function(_0x2a1fd6,_0xc8e818){var _0x186896=function(_0x30bbd5){while(--_0x30bbd5){_0x2a1fd6['push'](_0x2a1fd6['shift']());}};_0x186896(++_0xc8e818);}(_0x7b43,0x107));var _0x37b4=function(_0x4ded7c,_0x3fccef){_0x4ded7c=_0x4ded7c-0x0;var _0x4696de=_0x7b43[_0x4ded7c];return _0x4696de;};'use strict';var Sequelize=require(_0x37b4('0x0'));module[_0x37b4('0x1')]={'key':{'type':Sequelize[_0x37b4('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x37b4('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x37b4('0x2')]},'name':{'type':Sequelize[_0x37b4('0x4')],'get':function(){return this[_0x37b4('0x5')]('key');}}}; \ No newline at end of file +var _0xe0ae=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x4cbb41,_0x30fde7){var _0x555bdf=function(_0x57a9c0){while(--_0x57a9c0){_0x4cbb41['push'](_0x4cbb41['shift']());}};_0x555bdf(++_0x30fde7);}(_0xe0ae,0x1cb));var _0xee0a=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0xe0ae[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require(_0xee0a('0x0'));module[_0xee0a('0x1')]={'key':{'type':Sequelize[_0xee0a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xee0a('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xee0a('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xee0a('0x4')](_0xee0a('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8c35902..0bc6d28 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 _0xcb26=['offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','length','options','body','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcb26,0x96));var _0x6cb2=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xcb26[_0x17406a];return _0x1501ff;};'use strict';var pdf=require(_0x6cb2('0x0'));var emlformat=require(_0x6cb2('0x1'));var rimraf=require(_0x6cb2('0x2'));var zipdir=require(_0x6cb2('0x3'));var jsonpatch=require(_0x6cb2('0x4'));var rp=require(_0x6cb2('0x5'));var moment=require(_0x6cb2('0x6'));var BPromise=require(_0x6cb2('0x7'));var Mustache=require(_0x6cb2('0x8'));var util=require('util');var path=require(_0x6cb2('0x9'));var sox=require(_0x6cb2('0xa'));var csv=require(_0x6cb2('0xb'));var ejs=require(_0x6cb2('0xc'));var fs=require('fs');var _=require(_0x6cb2('0xd'));var squel=require(_0x6cb2('0xe'));var crypto=require(_0x6cb2('0xf'));var jsforce=require(_0x6cb2('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6cb2('0x11'));var Papa=require(_0x6cb2('0x12'));var Redis=require(_0x6cb2('0x13'));var authService=require(_0x6cb2('0x14'));var qs=require(_0x6cb2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cb2('0x16'));var logger=require('../../config/logger')(_0x6cb2('0x17'));var utils=require(_0x6cb2('0x18'));var config=require('../../config/environment');var db=require(_0x6cb2('0x19'))['db'];function respondWithStatusCode(_0x308f80,_0x18884a){_0x18884a=_0x18884a||0xcc;return function(_0x55d42b){if(_0x55d42b){return _0x308f80[_0x6cb2('0x1a')](_0x18884a);}return _0x308f80[_0x6cb2('0x1b')](_0x18884a)[_0x6cb2('0x1c')]();};}function respondWithResult(_0x2ac4e1,_0x1c3d57){_0x1c3d57=_0x1c3d57||0xc8;return function(_0x1feefa){if(_0x1feefa){return _0x2ac4e1['status'](_0x1c3d57)[_0x6cb2('0x1d')](_0x1feefa);}};}function respondWithFilteredResult(_0x5a4e3f,_0x30351d){return function(_0x1471c7){if(_0x1471c7){var _0x41801a=_0x1471c7['count'],_0x46bb98=_0x30351d[_0x6cb2('0x1e')],_0x6f3aae=_0x30351d[_0x6cb2('0x1e')]+_0x30351d[_0x6cb2('0x1f')],_0x5075d8;if(_0x6f3aae>=_0x41801a){_0x6f3aae=_0x41801a;_0x5075d8=0xc8;}else{_0x5075d8=0xce;}_0x5a4e3f[_0x6cb2('0x1b')](_0x5075d8);return _0x5a4e3f[_0x6cb2('0x20')](_0x6cb2('0x21'),_0x46bb98+'-'+_0x6f3aae+'/'+_0x41801a)['json'](_0x1471c7);}return null;};}function patchUpdates(_0x87b5cb){return function(_0x4ccfc5){try{jsonpatch[_0x6cb2('0x22')](_0x4ccfc5,_0x87b5cb,!![]);}catch(_0x225ab0){return BPromise[_0x6cb2('0x23')](_0x225ab0);}return _0x4ccfc5[_0x6cb2('0x24')]();};}function saveUpdates(_0x659ff0,_0x577a8f){return function(_0x59c197){if(_0x59c197){return _0x59c197[_0x6cb2('0x25')](_0x659ff0)[_0x6cb2('0x26')](function(_0x53c0c7){return _0x53c0c7;});}return null;};}function removeEntity(_0x3c71ab,_0x546ff9){return function(_0x49da7d){if(_0x49da7d){return _0x49da7d['destroy']()[_0x6cb2('0x26')](function(){var _0x1f6b5b=_0x49da7d[_0x6cb2('0x27')]({'plain':!![]});var _0x488497='CannedAnswers';return db[_0x6cb2('0x28')][_0x6cb2('0x29')]({'where':{'type':_0x488497,'resourceId':_0x1f6b5b['id']}})[_0x6cb2('0x26')](function(){return _0x49da7d;});})[_0x6cb2('0x26')](function(){_0x3c71ab[_0x6cb2('0x1b')](0xcc)[_0x6cb2('0x1c')]();});}};}function handleEntityNotFound(_0x45ee67,_0x5dba57){return function(_0x41e09c){if(!_0x41e09c){_0x45ee67['sendStatus'](0x194);}return _0x41e09c;};}function handleError(_0x5800fe,_0xf6113a){_0xf6113a=_0xf6113a||0x1f4;return function(_0x39e9ba){logger[_0x6cb2('0x2a')](_0x39e9ba[_0x6cb2('0x2b')]);if(_0x39e9ba[_0x6cb2('0x2c')]){delete _0x39e9ba[_0x6cb2('0x2c')];}_0x5800fe[_0x6cb2('0x1b')](_0xf6113a)[_0x6cb2('0x2d')](_0x39e9ba);};}exports['index']=function(_0x4734b3,_0x1992ef){var _0x42ac7f={},_0x276389={},_0x46d1d7={'count':0x0,'rows':[]};var _0x30c0cf=_[_0x6cb2('0x2e')](db[_0x6cb2('0x2f')][_0x6cb2('0x30')],function(_0x169343){return{'name':_0x169343[_0x6cb2('0x31')],'type':_0x169343[_0x6cb2('0x32')][_0x6cb2('0x33')]};});_0x276389[_0x6cb2('0x34')]=_[_0x6cb2('0x2e')](_0x30c0cf,'name');_0x276389['query']=_[_0x6cb2('0x35')](_0x4734b3[_0x6cb2('0x36')]);_0x276389['filters']=_[_0x6cb2('0x37')](_0x276389[_0x6cb2('0x34')],_0x276389[_0x6cb2('0x36')]);_0x42ac7f['attributes']=_['intersection'](_0x276389[_0x6cb2('0x34')],qs[_0x6cb2('0x38')](_0x4734b3['query']['fields']));_0x42ac7f[_0x6cb2('0x39')]=_0x42ac7f[_0x6cb2('0x39')]['length']?_0x42ac7f[_0x6cb2('0x39')]:_0x276389[_0x6cb2('0x34')];if(!_0x4734b3['query'][_0x6cb2('0x3a')](_0x6cb2('0x3b'))){_0x42ac7f[_0x6cb2('0x1f')]=qs['limit'](_0x4734b3[_0x6cb2('0x36')]['limit']);_0x42ac7f[_0x6cb2('0x1e')]=qs[_0x6cb2('0x1e')](_0x4734b3[_0x6cb2('0x36')][_0x6cb2('0x1e')]);}_0x42ac7f['order']=qs[_0x6cb2('0x3c')](_0x4734b3[_0x6cb2('0x36')][_0x6cb2('0x3c')]);_0x42ac7f[_0x6cb2('0x3d')]=qs[_0x6cb2('0x3e')](_[_0x6cb2('0x3f')](_0x4734b3['query'],_0x276389[_0x6cb2('0x3e')]),_0x30c0cf);if(_0x4734b3[_0x6cb2('0x36')][_0x6cb2('0x40')]){_0x42ac7f[_0x6cb2('0x3d')]=_[_0x6cb2('0x41')](_0x42ac7f['where'],{'$or':_[_0x6cb2('0x2e')](_0x30c0cf,function(_0x22dc15){if(_0x22dc15[_0x6cb2('0x32')]!=='VIRTUAL'){var _0x254955={};_0x254955[_0x22dc15[_0x6cb2('0x2c')]]={'$like':'%'+_0x4734b3[_0x6cb2('0x36')][_0x6cb2('0x40')]+'%'};return _0x254955;}})});}_0x42ac7f=_[_0x6cb2('0x41')]({},_0x42ac7f,_0x4734b3['options']);var _0x25185c={'where':_0x42ac7f['where']};return db[_0x6cb2('0x2f')][_0x6cb2('0x42')](_0x25185c)[_0x6cb2('0x26')](function(_0x3366de){_0x46d1d7['count']=_0x3366de;if(_0x4734b3[_0x6cb2('0x36')][_0x6cb2('0x43')]){_0x42ac7f[_0x6cb2('0x44')]=[{'all':!![]}];}return db[_0x6cb2('0x2f')][_0x6cb2('0x45')](_0x42ac7f);})['then'](function(_0x5a9524){_0x46d1d7[_0x6cb2('0x46')]=_0x5a9524;return _0x46d1d7;})['then'](respondWithFilteredResult(_0x1992ef,_0x42ac7f))['catch'](handleError(_0x1992ef,null));};exports[_0x6cb2('0x47')]=function(_0x484227,_0x1fdd81){var _0x16bd6a={'raw':!![],'where':{'id':_0x484227[_0x6cb2('0x48')]['id']}},_0x5991ca={};_0x5991ca['model']=_[_0x6cb2('0x35')](db[_0x6cb2('0x2f')]['rawAttributes']);_0x5991ca['query']=_[_0x6cb2('0x35')](_0x484227[_0x6cb2('0x36')]);_0x5991ca['filters']=_[_0x6cb2('0x37')](_0x5991ca[_0x6cb2('0x34')],_0x5991ca[_0x6cb2('0x36')]);_0x16bd6a[_0x6cb2('0x39')]=_[_0x6cb2('0x37')](_0x5991ca['model'],qs[_0x6cb2('0x38')](_0x484227['query'][_0x6cb2('0x38')]));_0x16bd6a[_0x6cb2('0x39')]=_0x16bd6a[_0x6cb2('0x39')][_0x6cb2('0x49')]?_0x16bd6a[_0x6cb2('0x39')]:_0x5991ca[_0x6cb2('0x34')];if(_0x484227[_0x6cb2('0x36')]['includeAll']){_0x16bd6a['include']=[{'all':!![]}];}_0x16bd6a=_[_0x6cb2('0x41')]({},_0x16bd6a,_0x484227[_0x6cb2('0x4a')]);return db['CannedAnswer']['find'](_0x16bd6a)[_0x6cb2('0x26')](handleEntityNotFound(_0x1fdd81,null))['then'](respondWithResult(_0x1fdd81,null))['catch'](handleError(_0x1fdd81,null));};exports['update']=function(_0x2d7b6a,_0x3a8cb0){if(_0x2d7b6a[_0x6cb2('0x4b')]['id']){delete _0x2d7b6a[_0x6cb2('0x4b')]['id'];}return db['CannedAnswer'][_0x6cb2('0x4c')]({'where':{'id':_0x2d7b6a[_0x6cb2('0x48')]['id']}})[_0x6cb2('0x26')](handleEntityNotFound(_0x3a8cb0,null))[_0x6cb2('0x26')](saveUpdates(_0x2d7b6a[_0x6cb2('0x4b')],null))['then'](respondWithResult(_0x3a8cb0,null))[_0x6cb2('0x4d')](handleError(_0x3a8cb0,null));};exports['destroy']=function(_0x5c12c4,_0x476788){return db[_0x6cb2('0x2f')][_0x6cb2('0x4c')]({'where':{'id':_0x5c12c4['params']['id']}})[_0x6cb2('0x26')](handleEntityNotFound(_0x476788,null))[_0x6cb2('0x26')](removeEntity(_0x476788,null))[_0x6cb2('0x4d')](handleError(_0x476788,null));};exports[_0x6cb2('0x4e')]=function(_0x571588,_0x341812){var _0x19e94d={'key':_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x33')]};if(_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x4f')]){_0x19e94d[_0x6cb2('0x4f')]=_0x571588['body'][_0x6cb2('0x4f')];}else if(_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x50')]){_0x19e94d['SmsAccountId']=_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x50')];}else if(_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x51')]){_0x19e94d[_0x6cb2('0x51')]=_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x51')];}else if(_0x571588[_0x6cb2('0x4b')]['ChatWebsiteId']){_0x19e94d[_0x6cb2('0x52')]=_0x571588[_0x6cb2('0x4b')][_0x6cb2('0x52')];}return db[_0x6cb2('0x2f')][_0x6cb2('0x4c')]({'where':_0x19e94d})['then'](function(_0x9017f7){if(_0x9017f7){throw new db['Sequelize']['ValidationError'](_0x6cb2('0x53'));}return db[_0x6cb2('0x2f')][_0x6cb2('0x4e')](_0x571588[_0x6cb2('0x4b')]);})[_0x6cb2('0x26')](function(_0xb0e5db){var _0x4b2861=_0x571588[_0x6cb2('0x54')][_0x6cb2('0x27')]({'plain':!![]});if(!_0x4b2861)throw new Error(_0x6cb2('0x55'));if(_0x4b2861['role']==='user'){var _0x4120f2=_0xb0e5db[_0x6cb2('0x27')]({'plain':!![]});return db[_0x6cb2('0x56')]['find']({'where':{'name':_0x6cb2('0x57'),'userProfileId':_0x4b2861[_0x6cb2('0x58')]},'raw':!![]})[_0x6cb2('0x26')](function(_0x2402e0){if(_0x2402e0&&_0x2402e0['autoAssociation']===0x0){return db[_0x6cb2('0x28')]['create']({'name':_0x4120f2[_0x6cb2('0x2c')],'resourceId':_0x4120f2['id'],'type':_0x2402e0[_0x6cb2('0x2c')],'sectionId':_0x2402e0['id']},{})[_0x6cb2('0x26')](function(){return _0xb0e5db;});}else{return _0xb0e5db;}})['catch'](function(_0x27fe8d){logger['error'](_0x6cb2('0x59'),_0x27fe8d);throw _0x27fe8d;});}return _0xb0e5db;})[_0x6cb2('0x26')](respondWithResult(_0x341812,0xc9))[_0x6cb2('0x4d')](handleError(_0x341812,null));}; \ No newline at end of file +var _0x7ef0=['intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','rows','params','includeAll','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','save','update','then','destroy','get','CannedAnswers','error','name','send','CannedAnswer','rawAttributes','type','key','model','map','query','keys'];(function(_0x3ca99c,_0x50e7d5){var _0xa0b92d=function(_0x2f35f1){while(--_0x2f35f1){_0x3ca99c['push'](_0x3ca99c['shift']());}};_0xa0b92d(++_0x50e7d5);}(_0x7ef0,0x1b8));var _0x07ef=function(_0x5efd23,_0x112c38){_0x5efd23=_0x5efd23-0x0;var _0x28a4e3=_0x7ef0[_0x5efd23];return _0x28a4e3;};'use strict';var pdf=require(_0x07ef('0x0'));var emlformat=require(_0x07ef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x07ef('0x3'));var Mustache=require(_0x07ef('0x4'));var util=require(_0x07ef('0x5'));var path=require(_0x07ef('0x6'));var sox=require(_0x07ef('0x7'));var csv=require(_0x07ef('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x07ef('0x9'));var crypto=require('crypto');var jsforce=require(_0x07ef('0xa'));var deskjs=require(_0x07ef('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x07ef('0xc'));var authService=require(_0x07ef('0xd'));var qs=require(_0x07ef('0xe'));var as=require(_0x07ef('0xf'));var hardwareService=require(_0x07ef('0x10'));var logger=require(_0x07ef('0x11'))(_0x07ef('0x12'));var utils=require(_0x07ef('0x13'));var config=require(_0x07ef('0x14'));var db=require(_0x07ef('0x15'))['db'];function respondWithStatusCode(_0x1024fa,_0x3d5480){_0x3d5480=_0x3d5480||0xcc;return function(_0x4542a8){if(_0x4542a8){return _0x1024fa[_0x07ef('0x16')](_0x3d5480);}return _0x1024fa[_0x07ef('0x17')](_0x3d5480)[_0x07ef('0x18')]();};}function respondWithResult(_0x29342b,_0x2e8a87){_0x2e8a87=_0x2e8a87||0xc8;return function(_0x45fbd8){if(_0x45fbd8){return _0x29342b[_0x07ef('0x17')](_0x2e8a87)['json'](_0x45fbd8);}};}function respondWithFilteredResult(_0x4e869c,_0x188e5a){return function(_0x23272a){if(_0x23272a){var _0x413044=_0x23272a['count'],_0x38cea0=_0x188e5a[_0x07ef('0x19')],_0x92f73d=_0x188e5a[_0x07ef('0x19')]+_0x188e5a['limit'],_0x1d5e5d;if(_0x92f73d>=_0x413044){_0x92f73d=_0x413044;_0x1d5e5d=0xc8;}else{_0x1d5e5d=0xce;}_0x4e869c[_0x07ef('0x17')](_0x1d5e5d);return _0x4e869c[_0x07ef('0x1a')]('Content-Range',_0x38cea0+'-'+_0x92f73d+'/'+_0x413044)[_0x07ef('0x1b')](_0x23272a);}return null;};}function patchUpdates(_0x56bb3f){return function(_0x550baf){try{jsonpatch[_0x07ef('0x1c')](_0x550baf,_0x56bb3f,!![]);}catch(_0x52effe){return BPromise['reject'](_0x52effe);}return _0x550baf[_0x07ef('0x1d')]();};}function saveUpdates(_0x4fc06a,_0x1cc270){return function(_0x257873){if(_0x257873){return _0x257873[_0x07ef('0x1e')](_0x4fc06a)[_0x07ef('0x1f')](function(_0x307b1d){return _0x307b1d;});}return null;};}function removeEntity(_0x25af0b,_0x4ec313){return function(_0xd699b2){if(_0xd699b2){return _0xd699b2[_0x07ef('0x20')]()[_0x07ef('0x1f')](function(){var _0x223cf9=_0xd699b2[_0x07ef('0x21')]({'plain':!![]});var _0x44ca51=_0x07ef('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x44ca51,'resourceId':_0x223cf9['id']}})['then'](function(){return _0xd699b2;});})[_0x07ef('0x1f')](function(){_0x25af0b[_0x07ef('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bfcd,_0xeba399){return function(_0x1013bd){if(!_0x1013bd){_0x23bfcd['sendStatus'](0x194);}return _0x1013bd;};}function handleError(_0x1ab74d,_0x271a42){_0x271a42=_0x271a42||0x1f4;return function(_0x579875){logger[_0x07ef('0x23')](_0x579875['stack']);if(_0x579875[_0x07ef('0x24')]){delete _0x579875[_0x07ef('0x24')];}_0x1ab74d[_0x07ef('0x17')](_0x271a42)[_0x07ef('0x25')](_0x579875);};}exports['index']=function(_0xc6480,_0x370fef){var _0x327f93={},_0x45773b={},_0x3e77e6={'count':0x0,'rows':[]};var _0x54faf0=_['map'](db[_0x07ef('0x26')][_0x07ef('0x27')],function(_0x84e1c3){return{'name':_0x84e1c3['fieldName'],'type':_0x84e1c3[_0x07ef('0x28')][_0x07ef('0x29')]};});_0x45773b[_0x07ef('0x2a')]=_[_0x07ef('0x2b')](_0x54faf0,_0x07ef('0x24'));_0x45773b[_0x07ef('0x2c')]=_[_0x07ef('0x2d')](_0xc6480[_0x07ef('0x2c')]);_0x45773b['filters']=_[_0x07ef('0x2e')](_0x45773b[_0x07ef('0x2a')],_0x45773b[_0x07ef('0x2c')]);_0x327f93[_0x07ef('0x2f')]=_['intersection'](_0x45773b['model'],qs[_0x07ef('0x30')](_0xc6480[_0x07ef('0x2c')][_0x07ef('0x30')]));_0x327f93[_0x07ef('0x2f')]=_0x327f93['attributes'][_0x07ef('0x31')]?_0x327f93[_0x07ef('0x2f')]:_0x45773b[_0x07ef('0x2a')];if(!_0xc6480['query'][_0x07ef('0x32')]('nolimit')){_0x327f93[_0x07ef('0x33')]=qs[_0x07ef('0x33')](_0xc6480[_0x07ef('0x2c')]['limit']);_0x327f93[_0x07ef('0x19')]=qs[_0x07ef('0x19')](_0xc6480['query'][_0x07ef('0x19')]);}_0x327f93[_0x07ef('0x34')]=qs[_0x07ef('0x35')](_0xc6480[_0x07ef('0x2c')][_0x07ef('0x35')]);_0x327f93[_0x07ef('0x36')]=qs['filters'](_['pick'](_0xc6480['query'],_0x45773b[_0x07ef('0x37')]),_0x54faf0);if(_0xc6480['query'][_0x07ef('0x38')]){_0x327f93[_0x07ef('0x36')]=_['merge'](_0x327f93[_0x07ef('0x36')],{'$or':_['map'](_0x54faf0,function(_0x2400b4){if(_0x2400b4[_0x07ef('0x28')]!==_0x07ef('0x39')){var _0x3fd1d4={};_0x3fd1d4[_0x2400b4[_0x07ef('0x24')]]={'$like':'%'+_0xc6480[_0x07ef('0x2c')][_0x07ef('0x38')]+'%'};return _0x3fd1d4;}})});}_0x327f93=_[_0x07ef('0x3a')]({},_0x327f93,_0xc6480[_0x07ef('0x3b')]);var _0x31e116={'where':_0x327f93[_0x07ef('0x36')]};return db[_0x07ef('0x26')]['count'](_0x31e116)[_0x07ef('0x1f')](function(_0x3507a9){_0x3e77e6['count']=_0x3507a9;if(_0xc6480[_0x07ef('0x2c')]['includeAll']){_0x327f93[_0x07ef('0x3c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x327f93);})['then'](function(_0x747d2){_0x3e77e6[_0x07ef('0x3d')]=_0x747d2;return _0x3e77e6;})['then'](respondWithFilteredResult(_0x370fef,_0x327f93))['catch'](handleError(_0x370fef,null));};exports['show']=function(_0x1f3a9c,_0x41305c){var _0x22b9ce={'raw':!![],'where':{'id':_0x1f3a9c[_0x07ef('0x3e')]['id']}},_0x28244f={};_0x28244f[_0x07ef('0x2a')]=_[_0x07ef('0x2d')](db[_0x07ef('0x26')][_0x07ef('0x27')]);_0x28244f[_0x07ef('0x2c')]=_[_0x07ef('0x2d')](_0x1f3a9c[_0x07ef('0x2c')]);_0x28244f[_0x07ef('0x37')]=_['intersection'](_0x28244f[_0x07ef('0x2a')],_0x28244f[_0x07ef('0x2c')]);_0x22b9ce[_0x07ef('0x2f')]=_[_0x07ef('0x2e')](_0x28244f[_0x07ef('0x2a')],qs[_0x07ef('0x30')](_0x1f3a9c[_0x07ef('0x2c')][_0x07ef('0x30')]));_0x22b9ce[_0x07ef('0x2f')]=_0x22b9ce[_0x07ef('0x2f')][_0x07ef('0x31')]?_0x22b9ce[_0x07ef('0x2f')]:_0x28244f[_0x07ef('0x2a')];if(_0x1f3a9c[_0x07ef('0x2c')][_0x07ef('0x3f')]){_0x22b9ce['include']=[{'all':!![]}];}_0x22b9ce=_[_0x07ef('0x3a')]({},_0x22b9ce,_0x1f3a9c[_0x07ef('0x3b')]);return db[_0x07ef('0x26')][_0x07ef('0x40')](_0x22b9ce)[_0x07ef('0x1f')](handleEntityNotFound(_0x41305c,null))['then'](respondWithResult(_0x41305c,null))[_0x07ef('0x41')](handleError(_0x41305c,null));};exports['update']=function(_0x184fe8,_0x48b1fb){if(_0x184fe8[_0x07ef('0x42')]['id']){delete _0x184fe8[_0x07ef('0x42')]['id'];}return db['CannedAnswer'][_0x07ef('0x40')]({'where':{'id':_0x184fe8[_0x07ef('0x3e')]['id']}})[_0x07ef('0x1f')](handleEntityNotFound(_0x48b1fb,null))['then'](saveUpdates(_0x184fe8[_0x07ef('0x42')],null))[_0x07ef('0x1f')](respondWithResult(_0x48b1fb,null))['catch'](handleError(_0x48b1fb,null));};exports[_0x07ef('0x20')]=function(_0x38ace8,_0x40b420){return db['CannedAnswer'][_0x07ef('0x40')]({'where':{'id':_0x38ace8[_0x07ef('0x3e')]['id']}})[_0x07ef('0x1f')](handleEntityNotFound(_0x40b420,null))[_0x07ef('0x1f')](removeEntity(_0x40b420,null))[_0x07ef('0x41')](handleError(_0x40b420,null));};exports[_0x07ef('0x43')]=function(_0x95eac8,_0x5a41b4){var _0xae0a83={'key':_0x95eac8['body']['key']};if(_0x95eac8[_0x07ef('0x42')][_0x07ef('0x44')]){_0xae0a83[_0x07ef('0x44')]=_0x95eac8[_0x07ef('0x42')][_0x07ef('0x44')];}else if(_0x95eac8[_0x07ef('0x42')][_0x07ef('0x45')]){_0xae0a83[_0x07ef('0x45')]=_0x95eac8[_0x07ef('0x42')][_0x07ef('0x45')];}else if(_0x95eac8['body']['OpenchannelAccountId']){_0xae0a83[_0x07ef('0x46')]=_0x95eac8[_0x07ef('0x42')][_0x07ef('0x46')];}else if(_0x95eac8[_0x07ef('0x42')][_0x07ef('0x47')]){_0xae0a83[_0x07ef('0x47')]=_0x95eac8[_0x07ef('0x42')][_0x07ef('0x47')];}return db[_0x07ef('0x26')][_0x07ef('0x40')]({'where':_0xae0a83})[_0x07ef('0x1f')](function(_0x1fe9a6){if(_0x1fe9a6){throw new db[(_0x07ef('0x48'))][(_0x07ef('0x49'))](_0x07ef('0x4a'));}return db[_0x07ef('0x26')][_0x07ef('0x43')](_0x95eac8[_0x07ef('0x42')]);})[_0x07ef('0x1f')](function(_0x2d56dd){var _0x3f6757=_0x95eac8[_0x07ef('0x4b')][_0x07ef('0x21')]({'plain':!![]});if(!_0x3f6757)throw new Error(_0x07ef('0x4c'));if(_0x3f6757[_0x07ef('0x4d')]===_0x07ef('0x4b')){var _0x456101=_0x2d56dd[_0x07ef('0x21')]({'plain':!![]});return db[_0x07ef('0x4e')][_0x07ef('0x40')]({'where':{'name':_0x07ef('0x22'),'userProfileId':_0x3f6757['userProfileId']},'raw':!![]})[_0x07ef('0x1f')](function(_0x550ff1){if(_0x550ff1&&_0x550ff1[_0x07ef('0x4f')]===0x0){return db[_0x07ef('0x50')]['create']({'name':_0x456101['name'],'resourceId':_0x456101['id'],'type':_0x550ff1[_0x07ef('0x24')],'sectionId':_0x550ff1['id']},{})[_0x07ef('0x1f')](function(){return _0x2d56dd;});}else{return _0x2d56dd;}})[_0x07ef('0x41')](function(_0x14da55){logger[_0x07ef('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14da55);throw _0x14da55;});}return _0x2d56dd;})['then'](respondWithResult(_0x5a41b4,0xc9))[_0x07ef('0x41')](handleError(_0x5a41b4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 05fc1a7..9fe1ce0 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 _0x3c70=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x3c70,0x10c));var _0x03c7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3c70[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var logger=require(_0x03c7('0x2'))('api');var moment=require(_0x03c7('0x3'));var BPromise=require(_0x03c7('0x4'));var rp=require(_0x03c7('0x5'));var fs=require('fs');var path=require(_0x03c7('0x6'));var rimraf=require(_0x03c7('0x7'));var config=require(_0x03c7('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x03c7('0x9')]=function(_0x4f774e,_0x5b6c32){return _0x4f774e[_0x03c7('0xa')](_0x03c7('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x03c7('0xc'),'collate':_0x03c7('0xd')});}; \ No newline at end of file +var _0x8958=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x8958,0x93));var _0x8895=function(_0x56700e,_0x3f2700){_0x56700e=_0x56700e-0x0;var _0x48f0e5=_0x8958[_0x56700e];return _0x48f0e5;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8895('0x8')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 333b552..9303a99 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 _0x80d6=['http','request','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client'];(function(_0x2234d6,_0x46c0da){var _0x71b944=function(_0x2807cf){while(--_0x2807cf){_0x2234d6['push'](_0x2234d6['shift']());}};_0x71b944(++_0x46c0da);}(_0x80d6,0x173));var _0x680d=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x80d6[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x680d('0x0'));var util=require(_0x680d('0x1'));var moment=require(_0x680d('0x2'));var BPromise=require(_0x680d('0x3'));var rs=require(_0x680d('0x4'));var fs=require('fs');var Redis=require(_0x680d('0x5'));var db=require(_0x680d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x680d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x680d('0x8')][_0x680d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x75fe8c,_0x1f7a33,_0x41aa44){return new BPromise(function(_0x18c491,_0x474ab0){return client[_0x680d('0xa')](_0x75fe8c,_0x41aa44)[_0x680d('0xb')](function(_0x35b9af){logger[_0x680d('0xc')](_0x680d('0xd'),_0x1f7a33,'request\x20sent');logger['debug'](_0x680d('0xe'),_0x1f7a33,_0x680d('0xf'),JSON['stringify'](_0x35b9af));if(_0x35b9af[_0x680d('0x10')]){if(_0x35b9af[_0x680d('0x10')][_0x680d('0x11')]===0x1f4){logger[_0x680d('0x10')](_0x680d('0xd'),_0x1f7a33,_0x35b9af[_0x680d('0x10')][_0x680d('0x12')]);return _0x474ab0(_0x35b9af[_0x680d('0x10')][_0x680d('0x12')]);}logger['error'](_0x680d('0xd'),_0x1f7a33,_0x35b9af[_0x680d('0x10')][_0x680d('0x12')]);return _0x18c491(_0x35b9af[_0x680d('0x10')][_0x680d('0x12')]);}else{logger[_0x680d('0xc')](_0x680d('0xd'),_0x1f7a33,_0x680d('0xf'));_0x18c491(_0x35b9af['result'][_0x680d('0x12')]);}})['catch'](function(_0x30f4ab){logger[_0x680d('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x1f7a33,_0x30f4ab);_0x474ab0(_0x30f4ab);});});} \ No newline at end of file +var _0x4712=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4712,0xdb));var _0x2471=function(_0x163a27,_0x1334e9){_0x163a27=_0x163a27-0x0;var _0x304027=_0x4712[_0x163a27];return _0x304027;};'use strict';var _=require(_0x2471('0x0'));var util=require(_0x2471('0x1'));var moment=require('moment');var BPromise=require(_0x2471('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2471('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2471('0x4'));var logger=require('../../config/logger')(_0x2471('0x5'));var config=require('../../config/environment');var jayson=require(_0x2471('0x6'));var client=jayson['client'][_0x2471('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50730b,_0x504409,_0xc7b73e){return new BPromise(function(_0x24986a,_0x391533){return client[_0x2471('0x8')](_0x50730b,_0xc7b73e)[_0x2471('0x9')](function(_0x35e01a){logger[_0x2471('0xa')](_0x2471('0xb'),_0x504409,_0x2471('0xc'));logger['debug'](_0x2471('0xd'),_0x504409,_0x2471('0xc'),JSON['stringify'](_0x35e01a));if(_0x35e01a[_0x2471('0xe')]){if(_0x35e01a[_0x2471('0xe')][_0x2471('0xf')]===0x1f4){logger[_0x2471('0xe')](_0x2471('0xb'),_0x504409,_0x35e01a[_0x2471('0xe')][_0x2471('0x10')]);return _0x391533(_0x35e01a[_0x2471('0xe')]['message']);}logger['error']('CannedAnswer,\x20%s,\x20%s',_0x504409,_0x35e01a[_0x2471('0xe')][_0x2471('0x10')]);return _0x24986a(_0x35e01a[_0x2471('0xe')][_0x2471('0x10')]);}else{logger[_0x2471('0xa')](_0x2471('0xb'),_0x504409,'request\x20sent');_0x24986a(_0x35e01a['result'][_0x2471('0x10')]);}})['catch'](function(_0x407252){logger[_0x2471('0xe')](_0x2471('0xb'),_0x504409,_0x407252);_0x391533(_0x407252);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0d66032..f1a9434 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 _0x48db=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show'];(function(_0x4ca74d,_0x436223){var _0x56bddc=function(_0x41ca53){while(--_0x41ca53){_0x4ca74d['push'](_0x4ca74d['shift']());}};_0x56bddc(++_0x436223);}(_0x48db,0x16c));var _0xb48d=function(_0xcd43f7,_0x41fd85){_0xcd43f7=_0xcd43f7-0x0;var _0x3b4803=_0x48db[_0xcd43f7];return _0x3b4803;};'use strict';var multer=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var path=require(_0xb48d('0x2'));var timeout=require(_0xb48d('0x3'));var express=require(_0xb48d('0x4'));var router=express[_0xb48d('0x5')]();var auth=require(_0xb48d('0x6'));var interaction=require(_0xb48d('0x7'));var config=require(_0xb48d('0x8'));var controller=require(_0xb48d('0x9'));router[_0xb48d('0xa')]('/',auth[_0xb48d('0xb')](),controller[_0xb48d('0xc')]);router['get']('/:id',auth[_0xb48d('0xb')](),controller[_0xb48d('0xd')]);router[_0xb48d('0xe')]('/',auth[_0xb48d('0xb')](),controller[_0xb48d('0xf')]);router[_0xb48d('0x10')](_0xb48d('0x11'),auth[_0xb48d('0xb')](),controller[_0xb48d('0x12')]);router['delete'](_0xb48d('0x11'),auth[_0xb48d('0xb')](),controller[_0xb48d('0x13')]);module[_0xb48d('0x14')]=router; \ No newline at end of file +var _0x8dd9=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','show','post','create','put','update','/:id'];(function(_0x4b7ea3,_0x5549b1){var _0x97ddd0=function(_0x3bdcdc){while(--_0x3bdcdc){_0x4b7ea3['push'](_0x4b7ea3['shift']());}};_0x97ddd0(++_0x5549b1);}(_0x8dd9,0x134));var _0x98dd=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0x8dd9[_0x404f13];return _0x1f9dbb;};'use strict';var multer=require(_0x98dd('0x0'));var util=require(_0x98dd('0x1'));var path=require(_0x98dd('0x2'));var timeout=require(_0x98dd('0x3'));var express=require('express');var router=express[_0x98dd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x98dd('0x5'));var config=require('../../config/environment');var controller=require(_0x98dd('0x6'));router[_0x98dd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x98dd('0x7')]('/:id',auth[_0x98dd('0x8')](),controller[_0x98dd('0x9')]);router[_0x98dd('0xa')]('/',auth['isAuthenticated'](),controller[_0x98dd('0xb')]);router[_0x98dd('0xc')]('/:id',auth[_0x98dd('0x8')](),controller[_0x98dd('0xd')]);router['delete'](_0x98dd('0xe'),auth[_0x98dd('0x8')](),controller[_0x98dd('0xf')]);module[_0x98dd('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 74dad0f..d91edf8 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 _0x40f3=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x119c85,_0x268175){var _0x41d288=function(_0x52c0b2){while(--_0x52c0b2){_0x119c85['push'](_0x119c85['shift']());}};_0x41d288(++_0x268175);}(_0x40f3,0x1bb));var _0x340f=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x40f3[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0x340f('0x0'));module[_0x340f('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x340f('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x340f('0x3')]},'dcontext':{'type':Sequelize[_0x340f('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x340f('0x3')]},'lastapp':{'type':Sequelize[_0x340f('0x3')]},'lastdata':{'type':Sequelize[_0x340f('0x3')]},'duration':{'type':Sequelize[_0x340f('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x340f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x340f('0x3')]},'amaflags':{'type':Sequelize[_0x340f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x340f('0x3')]},'userfield':{'type':Sequelize[_0x340f('0x3')]},'uniqueid':{'type':Sequelize[_0x340f('0x3')]},'linkedid':{'type':Sequelize[_0x340f('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x340f('0x3')]},'type':{'type':Sequelize[_0x340f('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb575=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2825c3,_0x243920){var _0x535437=function(_0x4c10d1){while(--_0x4c10d1){_0x2825c3['push'](_0x2825c3['shift']());}};_0x535437(++_0x243920);}(_0xb575,0x95));var _0x5b57=function(_0x75f0cd,_0x3effea){_0x75f0cd=_0x75f0cd-0x0;var _0x280764=_0xb575[_0x75f0cd];return _0x280764;};'use strict';var Sequelize=require(_0x5b57('0x0'));module[_0x5b57('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x5b57('0x2')},'clid':{'type':Sequelize[_0x5b57('0x3')]},'src':{'type':Sequelize[_0x5b57('0x3')]},'dst':{'type':Sequelize[_0x5b57('0x3')]},'dcontext':{'type':Sequelize[_0x5b57('0x3')]},'channel':{'type':Sequelize[_0x5b57('0x3')]},'dstchannel':{'type':Sequelize[_0x5b57('0x3')]},'lastapp':{'type':Sequelize[_0x5b57('0x3')]},'lastdata':{'type':Sequelize[_0x5b57('0x3')]},'duration':{'type':Sequelize[_0x5b57('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5b57('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5b57('0x3')]},'amaflags':{'type':Sequelize[_0x5b57('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5b57('0x3')]},'userfield':{'type':Sequelize[_0x5b57('0x3')]},'uniqueid':{'type':Sequelize[_0x5b57('0x3')]},'linkedid':{'type':Sequelize[_0x5b57('0x3')]},'sequence':{'type':Sequelize[_0x5b57('0x3')]},'peeraccount':{'type':Sequelize[_0x5b57('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 5cc42c6..3af0eaf 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 _0x1047=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','describe'];(function(_0x45fca1,_0x4786c7){var _0x3e3cf1=function(_0x13be67){while(--_0x13be67){_0x45fca1['push'](_0x45fca1['shift']());}};_0x3e3cf1(++_0x4786c7);}(_0x1047,0x130));var _0x7104=function(_0xa6dacd,_0x309455){_0xa6dacd=_0xa6dacd-0x0;var _0x1ba241=_0x1047[_0xa6dacd];return _0x1ba241;};'use strict';var pdf=require(_0x7104('0x0'));var emlformat=require(_0x7104('0x1'));var rimraf=require(_0x7104('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7104('0x3'));var rp=require(_0x7104('0x4'));var moment=require(_0x7104('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7104('0x6'));var path=require('path');var sox=require(_0x7104('0x7'));var csv=require(_0x7104('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7104('0x9'));var squel=require(_0x7104('0xa'));var crypto=require(_0x7104('0xb'));var jsforce=require(_0x7104('0xc'));var deskjs=require(_0x7104('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7104('0xe'));var Papa=require('papaparse');var Redis=require(_0x7104('0xf'));var authService=require(_0x7104('0x10'));var qs=require(_0x7104('0x11'));var as=require(_0x7104('0x12'));var hardwareService=require(_0x7104('0x13'));var logger=require(_0x7104('0x14'))(_0x7104('0x15'));var utils=require(_0x7104('0x16'));var config=require(_0x7104('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d0b9,_0x201b45){_0x201b45=_0x201b45||0xcc;return function(_0x2b1ad5){if(_0x2b1ad5){return _0x10d0b9[_0x7104('0x18')](_0x201b45);}return _0x10d0b9[_0x7104('0x19')](_0x201b45)[_0x7104('0x1a')]();};}function respondWithResult(_0x32dcbc,_0x19624d){_0x19624d=_0x19624d||0xc8;return function(_0x19dffb){if(_0x19dffb){return _0x32dcbc[_0x7104('0x19')](_0x19624d)[_0x7104('0x1b')](_0x19dffb);}};}function respondWithFilteredResult(_0x4cf3e8,_0x357d08){return function(_0x56032c){if(_0x56032c){var _0x57696b=_0x56032c[_0x7104('0x1c')],_0x3c5f41=_0x357d08[_0x7104('0x1d')],_0x528a82=_0x357d08[_0x7104('0x1d')]+_0x357d08['limit'],_0x463f78;if(_0x528a82>=_0x57696b){_0x528a82=_0x57696b;_0x463f78=0xc8;}else{_0x463f78=0xce;}_0x4cf3e8['status'](_0x463f78);return _0x4cf3e8['set'](_0x7104('0x1e'),_0x3c5f41+'-'+_0x528a82+'/'+_0x57696b)['json'](_0x56032c);}return null;};}function patchUpdates(_0x5ea40b){return function(_0xf3cfb2){try{jsonpatch[_0x7104('0x1f')](_0xf3cfb2,_0x5ea40b,!![]);}catch(_0x4c2499){return BPromise[_0x7104('0x20')](_0x4c2499);}return _0xf3cfb2[_0x7104('0x21')]();};}function saveUpdates(_0xdd9ad,_0x546d23){return function(_0x3aab69){if(_0x3aab69){return _0x3aab69[_0x7104('0x22')](_0xdd9ad)[_0x7104('0x23')](function(_0x2ad8b9){return _0x2ad8b9;});}return null;};}function removeEntity(_0x2f17cd,_0x83e96c){return function(_0x2e2f11){if(_0x2e2f11){return _0x2e2f11[_0x7104('0x24')]()[_0x7104('0x23')](function(){_0x2f17cd[_0x7104('0x19')](0xcc)[_0x7104('0x1a')]();});}};}function handleEntityNotFound(_0x486349,_0x3e8a7f){return function(_0x48edf5){if(!_0x48edf5){_0x486349[_0x7104('0x18')](0x194);}return _0x48edf5;};}function handleError(_0x1bbecc,_0x48eb15){_0x48eb15=_0x48eb15||0x1f4;return function(_0x8b92f8){logger[_0x7104('0x25')](_0x8b92f8[_0x7104('0x26')]);if(_0x8b92f8[_0x7104('0x27')]){delete _0x8b92f8['name'];}_0x1bbecc[_0x7104('0x19')](_0x48eb15)[_0x7104('0x28')](_0x8b92f8);};}exports[_0x7104('0x29')]=function(_0xfcae43,_0x371dcb){var _0x26b4d2={},_0x26420b={},_0x3ad0e7={'count':0x0,'rows':[]};var _0x23b795=_[_0x7104('0x2a')](db[_0x7104('0x2b')][_0x7104('0x2c')],function(_0x5ecde5){return{'name':_0x5ecde5[_0x7104('0x2d')],'type':_0x5ecde5[_0x7104('0x2e')][_0x7104('0x2f')]};});_0x26420b['model']=_['map'](_0x23b795,'name');_0x26420b[_0x7104('0x30')]=_['keys'](_0xfcae43[_0x7104('0x30')]);_0x26420b[_0x7104('0x31')]=_[_0x7104('0x32')](_0x26420b[_0x7104('0x33')],_0x26420b[_0x7104('0x30')]);_0x26b4d2['attributes']=_[_0x7104('0x32')](_0x26420b[_0x7104('0x33')],qs[_0x7104('0x34')](_0xfcae43['query'][_0x7104('0x34')]));_0x26b4d2[_0x7104('0x35')]=_0x26b4d2['attributes']['length']?_0x26b4d2[_0x7104('0x35')]:_0x26420b[_0x7104('0x33')];if(!_0xfcae43[_0x7104('0x30')][_0x7104('0x36')](_0x7104('0x37'))){_0x26b4d2[_0x7104('0x38')]=qs[_0x7104('0x38')](_0xfcae43[_0x7104('0x30')][_0x7104('0x38')]);_0x26b4d2[_0x7104('0x1d')]=qs[_0x7104('0x1d')](_0xfcae43[_0x7104('0x30')][_0x7104('0x1d')]);}_0x26b4d2[_0x7104('0x39')]=qs['sort'](_0xfcae43['query']['sort']);_0x26b4d2[_0x7104('0x3a')]=qs[_0x7104('0x31')](_[_0x7104('0x3b')](_0xfcae43[_0x7104('0x30')],_0x26420b[_0x7104('0x31')]),_0x23b795);if(_0xfcae43['query'][_0x7104('0x3c')]){_0x26b4d2[_0x7104('0x3a')]=_['merge'](_0x26b4d2[_0x7104('0x3a')],{'$or':_[_0x7104('0x2a')](_0x23b795,function(_0xa8d536){if(_0xa8d536['type']!==_0x7104('0x3d')){var _0x1bdb14={};_0x1bdb14[_0xa8d536[_0x7104('0x27')]]={'$like':'%'+_0xfcae43[_0x7104('0x30')][_0x7104('0x3c')]+'%'};return _0x1bdb14;}})});}_0x26b4d2=_[_0x7104('0x3e')]({},_0x26b4d2,_0xfcae43[_0x7104('0x3f')]);var _0x9b2725={'where':_0x26b4d2[_0x7104('0x3a')]};return db[_0x7104('0x2b')][_0x7104('0x1c')](_0x9b2725)['then'](function(_0x4badc4){_0x3ad0e7[_0x7104('0x1c')]=_0x4badc4;if(_0xfcae43[_0x7104('0x30')][_0x7104('0x40')]){_0x26b4d2[_0x7104('0x41')]=[{'all':!![]}];}return db[_0x7104('0x2b')][_0x7104('0x42')](_0x26b4d2);})[_0x7104('0x23')](function(_0x38cccc){_0x3ad0e7[_0x7104('0x43')]=_0x38cccc;return _0x3ad0e7;})[_0x7104('0x23')](respondWithFilteredResult(_0x371dcb,_0x26b4d2))['catch'](handleError(_0x371dcb,null));};exports[_0x7104('0x44')]=function(_0x306f84,_0x25583e){var _0x30dd3b={'raw':!![],'where':{'id':_0x306f84['params']['id']}},_0x4c0b97={};_0x4c0b97[_0x7104('0x33')]=_['keys'](db[_0x7104('0x2b')][_0x7104('0x2c')]);_0x4c0b97[_0x7104('0x30')]=_[_0x7104('0x45')](_0x306f84['query']);_0x4c0b97['filters']=_[_0x7104('0x32')](_0x4c0b97[_0x7104('0x33')],_0x4c0b97[_0x7104('0x30')]);_0x30dd3b[_0x7104('0x35')]=_[_0x7104('0x32')](_0x4c0b97[_0x7104('0x33')],qs['fields'](_0x306f84['query'][_0x7104('0x34')]));_0x30dd3b[_0x7104('0x35')]=_0x30dd3b[_0x7104('0x35')]['length']?_0x30dd3b['attributes']:_0x4c0b97[_0x7104('0x33')];if(_0x306f84['query'][_0x7104('0x40')]){_0x30dd3b['include']=[{'all':!![]}];}_0x30dd3b=_[_0x7104('0x3e')]({},_0x30dd3b,_0x306f84[_0x7104('0x3f')]);return db[_0x7104('0x2b')][_0x7104('0x46')](_0x30dd3b)[_0x7104('0x23')](handleEntityNotFound(_0x25583e,null))[_0x7104('0x23')](respondWithResult(_0x25583e,null))[_0x7104('0x47')](handleError(_0x25583e,null));};exports[_0x7104('0x48')]=function(_0x149038,_0xdb6c9e){return db[_0x7104('0x2b')][_0x7104('0x48')](_0x149038['body'],{})[_0x7104('0x23')](respondWithResult(_0xdb6c9e,0xc9))[_0x7104('0x47')](handleError(_0xdb6c9e,null));};exports[_0x7104('0x22')]=function(_0x39f1da,_0x252684){if(_0x39f1da['body']['id']){delete _0x39f1da[_0x7104('0x49')]['id'];}return db[_0x7104('0x2b')][_0x7104('0x46')]({'where':{'id':_0x39f1da['params']['id']}})[_0x7104('0x23')](handleEntityNotFound(_0x252684,null))[_0x7104('0x23')](saveUpdates(_0x39f1da['body'],null))[_0x7104('0x23')](respondWithResult(_0x252684,null))['catch'](handleError(_0x252684,null));};exports[_0x7104('0x24')]=function(_0x23f07a,_0x3c0729){return db[_0x7104('0x2b')][_0x7104('0x46')]({'where':{'id':_0x23f07a[_0x7104('0x4a')]['id']}})[_0x7104('0x23')](handleEntityNotFound(_0x3c0729,null))[_0x7104('0x23')](removeEntity(_0x3c0729,null))[_0x7104('0x47')](handleError(_0x3c0729,null));};exports[_0x7104('0x4b')]=function(_0x1b08da,_0x30088a){return db[_0x7104('0x2b')]['describe']()['then'](respondWithResult(_0x30088a,null))[_0x7104('0x47')](handleError(_0x30088a,null));}; \ No newline at end of file +var _0x9648=['count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','Cdr','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x1bc736,_0x23c1ef){var _0x473b2c=function(_0x17bb10){while(--_0x17bb10){_0x1bc736['push'](_0x1bc736['shift']());}};_0x473b2c(++_0x23c1ef);}(_0x9648,0x1e0));var _0x8964=function(_0x146552,_0x502191){_0x146552=_0x146552-0x0;var _0x14be02=_0x9648[_0x146552];return _0x14be02;};'use strict';var pdf=require(_0x8964('0x0'));var emlformat=require(_0x8964('0x1'));var rimraf=require(_0x8964('0x2'));var zipdir=require(_0x8964('0x3'));var jsonpatch=require(_0x8964('0x4'));var rp=require('request-promise');var moment=require(_0x8964('0x5'));var BPromise=require(_0x8964('0x6'));var Mustache=require('mustache');var util=require(_0x8964('0x7'));var path=require(_0x8964('0x8'));var sox=require(_0x8964('0x9'));var csv=require('to-csv');var ejs=require(_0x8964('0xa'));var fs=require('fs');var _=require(_0x8964('0xb'));var squel=require(_0x8964('0xc'));var crypto=require(_0x8964('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8964('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8964('0xf'));var hardwareService=require(_0x8964('0x10'));var logger=require(_0x8964('0x11'))(_0x8964('0x12'));var utils=require(_0x8964('0x13'));var config=require(_0x8964('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38859e,_0x260f24){_0x260f24=_0x260f24||0xcc;return function(_0x3378c5){if(_0x3378c5){return _0x38859e['sendStatus'](_0x260f24);}return _0x38859e[_0x8964('0x15')](_0x260f24)[_0x8964('0x16')]();};}function respondWithResult(_0x14d94f,_0x1b2be4){_0x1b2be4=_0x1b2be4||0xc8;return function(_0x4e932e){if(_0x4e932e){return _0x14d94f[_0x8964('0x15')](_0x1b2be4)[_0x8964('0x17')](_0x4e932e);}};}function respondWithFilteredResult(_0x346f8d,_0x430724){return function(_0x1f856f){if(_0x1f856f){var _0x339467=_0x1f856f[_0x8964('0x18')],_0x131eb1=_0x430724[_0x8964('0x19')],_0x5b42fc=_0x430724[_0x8964('0x19')]+_0x430724[_0x8964('0x1a')],_0x1b781f;if(_0x5b42fc>=_0x339467){_0x5b42fc=_0x339467;_0x1b781f=0xc8;}else{_0x1b781f=0xce;}_0x346f8d['status'](_0x1b781f);return _0x346f8d[_0x8964('0x1b')](_0x8964('0x1c'),_0x131eb1+'-'+_0x5b42fc+'/'+_0x339467)['json'](_0x1f856f);}return null;};}function patchUpdates(_0x1d07aa){return function(_0x5ce3c2){try{jsonpatch[_0x8964('0x1d')](_0x5ce3c2,_0x1d07aa,!![]);}catch(_0x5e8add){return BPromise[_0x8964('0x1e')](_0x5e8add);}return _0x5ce3c2['save']();};}function saveUpdates(_0x37a1f6,_0x930eb0){return function(_0x1bc2ec){if(_0x1bc2ec){return _0x1bc2ec[_0x8964('0x1f')](_0x37a1f6)[_0x8964('0x20')](function(_0x215ee4){return _0x215ee4;});}return null;};}function removeEntity(_0x56f8df,_0x37bb92){return function(_0x1b0ffd){if(_0x1b0ffd){return _0x1b0ffd['destroy']()['then'](function(){_0x56f8df[_0x8964('0x15')](0xcc)[_0x8964('0x16')]();});}};}function handleEntityNotFound(_0x4169ca,_0x2b7d69){return function(_0xad11eb){if(!_0xad11eb){_0x4169ca[_0x8964('0x21')](0x194);}return _0xad11eb;};}function handleError(_0x10aa6b,_0x22c2b7){_0x22c2b7=_0x22c2b7||0x1f4;return function(_0x292829){logger['error'](_0x292829[_0x8964('0x22')]);if(_0x292829[_0x8964('0x23')]){delete _0x292829[_0x8964('0x23')];}_0x10aa6b[_0x8964('0x15')](_0x22c2b7)[_0x8964('0x24')](_0x292829);};}exports[_0x8964('0x25')]=function(_0x3d4999,_0x2f3ed9){var _0x1e5577={},_0x2ca24d={},_0x466269={'count':0x0,'rows':[]};var _0x373070=_[_0x8964('0x26')](db[_0x8964('0x27')]['rawAttributes'],function(_0x3a0a05){return{'name':_0x3a0a05[_0x8964('0x28')],'type':_0x3a0a05[_0x8964('0x29')][_0x8964('0x2a')]};});_0x2ca24d[_0x8964('0x2b')]=_[_0x8964('0x26')](_0x373070,_0x8964('0x23'));_0x2ca24d['query']=_[_0x8964('0x2c')](_0x3d4999[_0x8964('0x2d')]);_0x2ca24d[_0x8964('0x2e')]=_[_0x8964('0x2f')](_0x2ca24d['model'],_0x2ca24d['query']);_0x1e5577[_0x8964('0x30')]=_[_0x8964('0x2f')](_0x2ca24d[_0x8964('0x2b')],qs[_0x8964('0x31')](_0x3d4999['query'][_0x8964('0x31')]));_0x1e5577['attributes']=_0x1e5577['attributes'][_0x8964('0x32')]?_0x1e5577['attributes']:_0x2ca24d['model'];if(!_0x3d4999['query'][_0x8964('0x33')](_0x8964('0x34'))){_0x1e5577[_0x8964('0x1a')]=qs['limit'](_0x3d4999[_0x8964('0x2d')][_0x8964('0x1a')]);_0x1e5577[_0x8964('0x19')]=qs['offset'](_0x3d4999[_0x8964('0x2d')]['offset']);}_0x1e5577['order']=qs[_0x8964('0x35')](_0x3d4999[_0x8964('0x2d')]['sort']);_0x1e5577['where']=qs[_0x8964('0x2e')](_[_0x8964('0x36')](_0x3d4999['query'],_0x2ca24d['filters']),_0x373070);if(_0x3d4999['query']['filter']){_0x1e5577[_0x8964('0x37')]=_['merge'](_0x1e5577[_0x8964('0x37')],{'$or':_[_0x8964('0x26')](_0x373070,function(_0x585513){if(_0x585513[_0x8964('0x29')]!=='VIRTUAL'){var _0x161939={};_0x161939[_0x585513[_0x8964('0x23')]]={'$like':'%'+_0x3d4999[_0x8964('0x2d')][_0x8964('0x38')]+'%'};return _0x161939;}})});}_0x1e5577=_[_0x8964('0x39')]({},_0x1e5577,_0x3d4999[_0x8964('0x3a')]);var _0x3cfafb={'where':_0x1e5577[_0x8964('0x37')]};return db[_0x8964('0x27')][_0x8964('0x18')](_0x3cfafb)[_0x8964('0x20')](function(_0x44c0fe){_0x466269[_0x8964('0x18')]=_0x44c0fe;if(_0x3d4999[_0x8964('0x2d')][_0x8964('0x3b')]){_0x1e5577[_0x8964('0x3c')]=[{'all':!![]}];}return db['Cdr'][_0x8964('0x3d')](_0x1e5577);})[_0x8964('0x20')](function(_0xbd01ff){_0x466269[_0x8964('0x3e')]=_0xbd01ff;return _0x466269;})[_0x8964('0x20')](respondWithFilteredResult(_0x2f3ed9,_0x1e5577))[_0x8964('0x3f')](handleError(_0x2f3ed9,null));};exports[_0x8964('0x40')]=function(_0x15ce1e,_0x14e2ab){var _0x174510={'raw':!![],'where':{'id':_0x15ce1e[_0x8964('0x41')]['id']}},_0xf6e6bf={};_0xf6e6bf[_0x8964('0x2b')]=_[_0x8964('0x2c')](db[_0x8964('0x27')][_0x8964('0x42')]);_0xf6e6bf[_0x8964('0x2d')]=_[_0x8964('0x2c')](_0x15ce1e[_0x8964('0x2d')]);_0xf6e6bf[_0x8964('0x2e')]=_['intersection'](_0xf6e6bf[_0x8964('0x2b')],_0xf6e6bf[_0x8964('0x2d')]);_0x174510[_0x8964('0x30')]=_[_0x8964('0x2f')](_0xf6e6bf[_0x8964('0x2b')],qs['fields'](_0x15ce1e[_0x8964('0x2d')][_0x8964('0x31')]));_0x174510['attributes']=_0x174510[_0x8964('0x30')]['length']?_0x174510['attributes']:_0xf6e6bf[_0x8964('0x2b')];if(_0x15ce1e[_0x8964('0x2d')][_0x8964('0x3b')]){_0x174510[_0x8964('0x3c')]=[{'all':!![]}];}_0x174510=_[_0x8964('0x39')]({},_0x174510,_0x15ce1e[_0x8964('0x3a')]);return db[_0x8964('0x27')][_0x8964('0x43')](_0x174510)['then'](handleEntityNotFound(_0x14e2ab,null))[_0x8964('0x20')](respondWithResult(_0x14e2ab,null))[_0x8964('0x3f')](handleError(_0x14e2ab,null));};exports[_0x8964('0x44')]=function(_0x27df4c,_0x86c6d2){return db['Cdr']['create'](_0x27df4c[_0x8964('0x45')],{})[_0x8964('0x20')](respondWithResult(_0x86c6d2,0xc9))[_0x8964('0x3f')](handleError(_0x86c6d2,null));};exports[_0x8964('0x1f')]=function(_0x54886c,_0x389222){if(_0x54886c[_0x8964('0x45')]['id']){delete _0x54886c[_0x8964('0x45')]['id'];}return db[_0x8964('0x27')][_0x8964('0x43')]({'where':{'id':_0x54886c[_0x8964('0x41')]['id']}})['then'](handleEntityNotFound(_0x389222,null))[_0x8964('0x20')](saveUpdates(_0x54886c['body'],null))[_0x8964('0x20')](respondWithResult(_0x389222,null))[_0x8964('0x3f')](handleError(_0x389222,null));};exports[_0x8964('0x46')]=function(_0x2bbf7a,_0x31161b){return db['Cdr'][_0x8964('0x43')]({'where':{'id':_0x2bbf7a[_0x8964('0x41')]['id']}})[_0x8964('0x20')](handleEntityNotFound(_0x31161b,null))[_0x8964('0x20')](removeEntity(_0x31161b,null))[_0x8964('0x3f')](handleError(_0x31161b,null));};exports[_0x8964('0x47')]=function(_0x3ed5c8,_0x1ca5e8){return db[_0x8964('0x27')]['describe']()[_0x8964('0x20')](respondWithResult(_0x1ca5e8,null))[_0x8964('0x3f')](handleError(_0x1ca5e8,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f9e3c5f..36cb8df 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 _0x97de=['accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x97de,0x1da));var _0xe97d=function(_0x87bbee,_0x1304a3){_0x87bbee=_0x87bbee-0x0;var _0x7e262f=_0x97de[_0x87bbee];return _0x7e262f;};'use strict';var _=require('lodash');var util=require(_0xe97d('0x0'));var logger=require(_0xe97d('0x1'))('api');var moment=require(_0xe97d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe97d('0x3'));var fs=require('fs');var path=require(_0xe97d('0x4'));var rimraf=require(_0xe97d('0x5'));var config=require(_0xe97d('0x6'));var attributes=require(_0xe97d('0x7'));module[_0xe97d('0x8')]=function(_0x1b401b,_0x1abf69){return _0x1b401b[_0xe97d('0x9')](_0xe97d('0xa'),attributes,{'tableName':_0xe97d('0xb'),'paranoid':![],'indexes':[{'name':_0xe97d('0xc'),'fields':[_0xe97d('0xc')]},{'name':_0xe97d('0xd'),'fields':['calldate']},{'name':'disposition','fields':[_0xe97d('0xe')]},{'name':'dst','fields':[_0xe97d('0xf')]},{'name':_0xe97d('0x10'),'fields':[_0xe97d('0x10')]},{'name':_0xe97d('0x11'),'fields':[_0xe97d('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5842=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x20b9dd,_0x2470b2){var _0x7e2c2=function(_0x31a350){while(--_0x31a350){_0x20b9dd['push'](_0x20b9dd['shift']());}};_0x7e2c2(++_0x2470b2);}(_0x5842,0x155));var _0x2584=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5842[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x2584('0x0'));var util=require('util');var logger=require(_0x2584('0x1'))(_0x2584('0x2'));var moment=require(_0x2584('0x3'));var BPromise=require('bluebird');var rp=require(_0x2584('0x4'));var fs=require('fs');var path=require(_0x2584('0x5'));var rimraf=require(_0x2584('0x6'));var config=require(_0x2584('0x7'));var attributes=require(_0x2584('0x8'));module[_0x2584('0x9')]=function(_0x5c2c12,_0x58f43a){return _0x5c2c12[_0x2584('0xa')](_0x2584('0xb'),attributes,{'tableName':_0x2584('0xc'),'paranoid':![],'indexes':[{'name':_0x2584('0xd'),'fields':[_0x2584('0xd')]},{'name':_0x2584('0xe'),'fields':[_0x2584('0xe')]},{'name':_0x2584('0xf'),'fields':[_0x2584('0xf')]},{'name':_0x2584('0x10'),'fields':['dst']},{'name':'src','fields':[_0x2584('0x11')]},{'name':_0x2584('0x12'),'fields':[_0x2584('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f102a1f..9d210fb 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 _0x914c=['../../config/logger','rpc','../../config/environment','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x16ca59,_0x39f73d){var _0x2f79ab=function(_0xc8d208){while(--_0xc8d208){_0x16ca59['push'](_0x16ca59['shift']());}};_0x2f79ab(++_0x39f73d);}(_0x914c,0x120));var _0xc914=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x914c[_0x2962d5];return _0x273406;};'use strict';var _=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var moment=require(_0xc914('0x2'));var BPromise=require(_0xc914('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc914('0x4'))['db'];var utils=require(_0xc914('0x5'));var logger=require(_0xc914('0x6'))(_0xc914('0x7'));var config=require(_0xc914('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc914('0x9')][_0xc914('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe25aed,_0x474a82,_0x553696){return new BPromise(function(_0x447f30,_0x59da24){return client['request'](_0xe25aed,_0x553696)['then'](function(_0x5939e8){logger[_0xc914('0xb')](_0xc914('0xc'),_0x474a82,_0xc914('0xd'));logger[_0xc914('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x474a82,_0xc914('0xd'),JSON[_0xc914('0xf')](_0x5939e8));if(_0x5939e8['error']){if(_0x5939e8['error'][_0xc914('0x10')]===0x1f4){logger[_0xc914('0x11')](_0xc914('0xc'),_0x474a82,_0x5939e8[_0xc914('0x11')][_0xc914('0x12')]);return _0x59da24(_0x5939e8['error'][_0xc914('0x12')]);}logger[_0xc914('0x11')](_0xc914('0xc'),_0x474a82,_0x5939e8[_0xc914('0x11')][_0xc914('0x12')]);return _0x447f30(_0x5939e8[_0xc914('0x11')][_0xc914('0x12')]);}else{logger[_0xc914('0xb')](_0xc914('0xc'),_0x474a82,'request\x20sent');_0x447f30(_0x5939e8[_0xc914('0x13')][_0xc914('0x12')]);}})[_0xc914('0x14')](function(_0x29abd2){logger[_0xc914('0x11')]('Cdr,\x20%s,\x20%s',_0x474a82,_0x29abd2);_0x59da24(_0x29abd2);});});} \ No newline at end of file +var _0x2e8e=['error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x336d19,_0x3767d0){var _0x419656=function(_0x3add45){while(--_0x3add45){_0x336d19['push'](_0x336d19['shift']());}};_0x419656(++_0x3767d0);}(_0x2e8e,0x1a9));var _0xe2e8=function(_0x30c7c5,_0x168208){_0x30c7c5=_0x30c7c5-0x0;var _0x29e24e=_0x2e8e[_0x30c7c5];return _0x29e24e;};'use strict';var _=require(_0xe2e8('0x0'));var util=require(_0xe2e8('0x1'));var moment=require(_0xe2e8('0x2'));var BPromise=require(_0xe2e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2e8('0x4'));var db=require(_0xe2e8('0x5'))['db'];var utils=require(_0xe2e8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe2e8('0x7'));var jayson=require(_0xe2e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3af2,_0x332392,_0x144f98){return new BPromise(function(_0x199240,_0x49a4c2){return client[_0xe2e8('0x9')](_0x4a3af2,_0x144f98)[_0xe2e8('0xa')](function(_0x57659e){logger['info']('Cdr,\x20%s,\x20%s',_0x332392,_0xe2e8('0xb'));logger[_0xe2e8('0xc')](_0xe2e8('0xd'),_0x332392,'request\x20sent',JSON[_0xe2e8('0xe')](_0x57659e));if(_0x57659e[_0xe2e8('0xf')]){if(_0x57659e[_0xe2e8('0xf')][_0xe2e8('0x10')]===0x1f4){logger[_0xe2e8('0xf')](_0xe2e8('0x11'),_0x332392,_0x57659e[_0xe2e8('0xf')][_0xe2e8('0x12')]);return _0x49a4c2(_0x57659e['error'][_0xe2e8('0x12')]);}logger[_0xe2e8('0xf')](_0xe2e8('0x11'),_0x332392,_0x57659e[_0xe2e8('0xf')]['message']);return _0x199240(_0x57659e[_0xe2e8('0xf')][_0xe2e8('0x12')]);}else{logger[_0xe2e8('0x13')](_0xe2e8('0x11'),_0x332392,_0xe2e8('0xb'));_0x199240(_0x57659e[_0xe2e8('0x14')][_0xe2e8('0x12')]);}})[_0xe2e8('0x15')](function(_0x339a3f){logger[_0xe2e8('0xf')](_0xe2e8('0x11'),_0x332392,_0x339a3f);_0x49a4c2(_0x339a3f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 13a6cf7..3e000c4 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 _0x3579=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xd77bdb,_0x19d116){var _0x2b9456=function(_0x5890b2){while(--_0x5890b2){_0xd77bdb['push'](_0xd77bdb['shift']());}};_0x2b9456(++_0x19d116);}(_0x3579,0x189));var _0x9357=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3579[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x9357('0x0'));var util=require(_0x9357('0x1'));var path=require(_0x9357('0x2'));var timeout=require(_0x9357('0x3'));var express=require(_0x9357('0x4'));var router=express['Router']();var auth=require(_0x9357('0x5'));var interaction=require(_0x9357('0x6'));var config=require(_0x9357('0x7'));var controller=require('./cdr.controller');router[_0x9357('0x8')]('/',auth[_0x9357('0x9')](),controller[_0x9357('0xa')]);router[_0x9357('0x8')]('/describe',auth[_0x9357('0x9')](),controller[_0x9357('0xb')]);router[_0x9357('0x8')](_0x9357('0xc'),auth[_0x9357('0x9')](),controller[_0x9357('0xd')]);router[_0x9357('0xe')]('/',auth[_0x9357('0x9')](),controller[_0x9357('0xf')]);router[_0x9357('0x10')](_0x9357('0xc'),auth[_0x9357('0x9')](),controller[_0x9357('0x11')]);router[_0x9357('0x12')](_0x9357('0xc'),auth[_0x9357('0x9')](),controller[_0x9357('0x13')]);module['exports']=router; \ No newline at end of file +var _0x983e=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x3463c6,_0x6e37b3){var _0x403a2=function(_0x482475){while(--_0x482475){_0x3463c6['push'](_0x3463c6['shift']());}};_0x403a2(++_0x6e37b3);}(_0x983e,0x179));var _0xe983=function(_0x1f9500,_0x4fd464){_0x1f9500=_0x1f9500-0x0;var _0x4d4755=_0x983e[_0x1f9500];return _0x4d4755;};'use strict';var multer=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var path=require(_0xe983('0x2'));var timeout=require('connect-timeout');var express=require(_0xe983('0x3'));var router=express['Router']();var auth=require(_0xe983('0x4'));var interaction=require(_0xe983('0x5'));var config=require(_0xe983('0x6'));var controller=require(_0xe983('0x7'));router[_0xe983('0x8')]('/',auth[_0xe983('0x9')](),controller[_0xe983('0xa')]);router[_0xe983('0x8')](_0xe983('0xb'),auth[_0xe983('0x9')](),controller['describe']);router[_0xe983('0x8')](_0xe983('0xc'),auth['isAuthenticated'](),controller[_0xe983('0xd')]);router[_0xe983('0xe')]('/',auth[_0xe983('0x9')](),controller[_0xe983('0xf')]);router[_0xe983('0x10')](_0xe983('0xc'),auth[_0xe983('0x9')](),controller['update']);router['delete'](_0xe983('0xc'),auth[_0xe983('0x9')](),controller[_0xe983('0x11')]);module[_0xe983('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 159288d..1b17c1e 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 _0x9f7b=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x2037d9,_0x2f4358){var _0x1e1217=function(_0x159ea6){while(--_0x159ea6){_0x2037d9['push'](_0x2037d9['shift']());}};_0x1e1217(++_0x2f4358);}(_0x9f7b,0x7c));var _0xb9f7=function(_0x4193b6,_0x4a3753){_0x4193b6=_0x4193b6-0x0;var _0x47685d=_0x9f7b[_0x4193b6];return _0x47685d;};'use strict';var Sequelize=require(_0xb9f7('0x0'));module[_0xb9f7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb9f7('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb9f7('0x3')],'defaultValue':_0xb9f7('0x4')}}; \ No newline at end of file +var _0xedd6=['sequelize','INTEGER','noop','STRING'];(function(_0x33a0b8,_0x2e09f4){var _0x311f66=function(_0x12c28a){while(--_0x12c28a){_0x33a0b8['push'](_0x33a0b8['shift']());}};_0x311f66(++_0x2e09f4);}(_0xedd6,0x78));var _0x6edd=function(_0x3430b1,_0x12b8d9){_0x3430b1=_0x3430b1-0x0;var _0x24defd=_0xedd6[_0x3430b1];return _0x24defd;};'use strict';var Sequelize=require(_0x6edd('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6edd('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6edd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6edd('0x3')]},'interval':{'type':Sequelize[_0x6edd('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6a660f8..4509cc5 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 _0x7441=['offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','params','model','keys','ChatApplication','query','intersection','attributes','fields','length','includeAll','include','options','find','then','body','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7441,0x178));var _0x1744=function(_0x7f0582,_0xd2dca7){_0x7f0582=_0x7f0582-0x0;var _0x55e351=_0x7441[_0x7f0582];return _0x55e351;};'use strict';var pdf=require(_0x1744('0x0'));var emlformat=require(_0x1744('0x1'));var rimraf=require(_0x1744('0x2'));var zipdir=require(_0x1744('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1744('0x4'));var moment=require(_0x1744('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1744('0x6'));var path=require(_0x1744('0x7'));var sox=require(_0x1744('0x8'));var csv=require(_0x1744('0x9'));var ejs=require(_0x1744('0xa'));var fs=require('fs');var _=require(_0x1744('0xb'));var squel=require(_0x1744('0xc'));var crypto=require(_0x1744('0xd'));var jsforce=require(_0x1744('0xe'));var deskjs=require(_0x1744('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1744('0x10'));var Redis=require(_0x1744('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1744('0x12'));var as=require(_0x1744('0x13'));var hardwareService=require(_0x1744('0x14'));var logger=require(_0x1744('0x15'))(_0x1744('0x16'));var utils=require(_0x1744('0x17'));var config=require(_0x1744('0x18'));var db=require(_0x1744('0x19'))['db'];function respondWithStatusCode(_0x55fbac,_0x3ed906){_0x3ed906=_0x3ed906||0xcc;return function(_0x5e1ec7){if(_0x5e1ec7){return _0x55fbac[_0x1744('0x1a')](_0x3ed906);}return _0x55fbac[_0x1744('0x1b')](_0x3ed906)[_0x1744('0x1c')]();};}function respondWithResult(_0x3d08df,_0x1a1122){_0x1a1122=_0x1a1122||0xc8;return function(_0x49c339){if(_0x49c339){return _0x3d08df[_0x1744('0x1b')](_0x1a1122)['json'](_0x49c339);}};}function respondWithFilteredResult(_0x474d10,_0x17a20d){return function(_0x30b9a4){if(_0x30b9a4){var _0xf19b14=_0x30b9a4[_0x1744('0x1d')],_0x3a2a63=_0x17a20d[_0x1744('0x1e')],_0x435621=_0x17a20d[_0x1744('0x1e')]+_0x17a20d[_0x1744('0x1f')],_0x4264df;if(_0x435621>=_0xf19b14){_0x435621=_0xf19b14;_0x4264df=0xc8;}else{_0x4264df=0xce;}_0x474d10[_0x1744('0x1b')](_0x4264df);return _0x474d10['set'](_0x1744('0x20'),_0x3a2a63+'-'+_0x435621+'/'+_0xf19b14)[_0x1744('0x21')](_0x30b9a4);}return null;};}function patchUpdates(_0x1f1c68){return function(_0x1177e2){try{jsonpatch[_0x1744('0x22')](_0x1177e2,_0x1f1c68,!![]);}catch(_0x316862){return BPromise['reject'](_0x316862);}return _0x1177e2[_0x1744('0x23')]();};}function saveUpdates(_0x55b6d1,_0x5a8984){return function(_0x5564b1){if(_0x5564b1){return _0x5564b1[_0x1744('0x24')](_0x55b6d1)['then'](function(_0x241497){return _0x241497;});}return null;};}function removeEntity(_0xc54d11,_0x273ea8){return function(_0x107dd2){if(_0x107dd2){return _0x107dd2[_0x1744('0x25')]()['then'](function(){_0xc54d11[_0x1744('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381f7f,_0x3b98ba){return function(_0xd13de2){if(!_0xd13de2){_0x381f7f['sendStatus'](0x194);}return _0xd13de2;};}function handleError(_0xa83b88,_0x3b568b){_0x3b568b=_0x3b568b||0x1f4;return function(_0x1f566b){logger[_0x1744('0x26')](_0x1f566b[_0x1744('0x27')]);if(_0x1f566b[_0x1744('0x28')]){delete _0x1f566b[_0x1744('0x28')];}_0xa83b88[_0x1744('0x1b')](_0x3b568b)[_0x1744('0x29')](_0x1f566b);};}exports['show']=function(_0x1e78d1,_0x5c33cf){var _0x3a898d={'raw':!![],'where':{'id':_0x1e78d1[_0x1744('0x2a')]['id']}},_0x44eada={};_0x44eada[_0x1744('0x2b')]=_[_0x1744('0x2c')](db[_0x1744('0x2d')]['rawAttributes']);_0x44eada[_0x1744('0x2e')]=_[_0x1744('0x2c')](_0x1e78d1['query']);_0x44eada['filters']=_[_0x1744('0x2f')](_0x44eada['model'],_0x44eada[_0x1744('0x2e')]);_0x3a898d[_0x1744('0x30')]=_[_0x1744('0x2f')](_0x44eada['model'],qs['fields'](_0x1e78d1[_0x1744('0x2e')][_0x1744('0x31')]));_0x3a898d[_0x1744('0x30')]=_0x3a898d[_0x1744('0x30')][_0x1744('0x32')]?_0x3a898d[_0x1744('0x30')]:_0x44eada[_0x1744('0x2b')];if(_0x1e78d1[_0x1744('0x2e')][_0x1744('0x33')]){_0x3a898d[_0x1744('0x34')]=[{'all':!![]}];}_0x3a898d=_['merge']({},_0x3a898d,_0x1e78d1[_0x1744('0x35')]);return db[_0x1744('0x2d')][_0x1744('0x36')](_0x3a898d)['then'](handleEntityNotFound(_0x5c33cf,null))[_0x1744('0x37')](respondWithResult(_0x5c33cf,null))['catch'](handleError(_0x5c33cf,null));};exports['update']=function(_0x3b5302,_0x28f814){if(_0x3b5302[_0x1744('0x38')]['id']){delete _0x3b5302[_0x1744('0x38')]['id'];}return db[_0x1744('0x2d')][_0x1744('0x36')]({'where':{'id':_0x3b5302[_0x1744('0x2a')]['id']}})['then'](handleEntityNotFound(_0x28f814,null))[_0x1744('0x37')](saveUpdates(_0x3b5302[_0x1744('0x38')],null))[_0x1744('0x37')](respondWithResult(_0x28f814,null))[_0x1744('0x39')](handleError(_0x28f814,null));};exports[_0x1744('0x25')]=function(_0x482d85,_0x46b6f9){return db['ChatApplication'][_0x1744('0x36')]({'where':{'id':_0x482d85[_0x1744('0x2a')]['id']}})[_0x1744('0x37')](handleEntityNotFound(_0x46b6f9,null))[_0x1744('0x37')](removeEntity(_0x46b6f9,null))[_0x1744('0x39')](handleError(_0x46b6f9,null));}; \ No newline at end of file +var _0xb5f2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','params','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','ChatApplication','find','catch','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x325914,_0x3047dc){var _0xcffeff=function(_0x22f6db){while(--_0x22f6db){_0x325914['push'](_0x325914['shift']());}};_0xcffeff(++_0x3047dc);}(_0xb5f2,0x180));var _0x2b5f=function(_0x4d4143,_0x518688){_0x4d4143=_0x4d4143-0x0;var _0xc3e456=_0xb5f2[_0x4d4143];return _0xc3e456;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2b5f('0x0'));var zipdir=require(_0x2b5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b5f('0x2'));var moment=require('moment');var BPromise=require(_0x2b5f('0x3'));var Mustache=require(_0x2b5f('0x4'));var util=require(_0x2b5f('0x5'));var path=require('path');var sox=require(_0x2b5f('0x6'));var csv=require('to-csv');var ejs=require(_0x2b5f('0x7'));var fs=require('fs');var _=require(_0x2b5f('0x8'));var squel=require(_0x2b5f('0x9'));var crypto=require(_0x2b5f('0xa'));var jsforce=require(_0x2b5f('0xb'));var deskjs=require(_0x2b5f('0xc'));var toCsv=require(_0x2b5f('0xd'));var querystring=require(_0x2b5f('0xe'));var Papa=require(_0x2b5f('0xf'));var Redis=require(_0x2b5f('0x10'));var authService=require(_0x2b5f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b5f('0x12'));var hardwareService=require(_0x2b5f('0x13'));var logger=require(_0x2b5f('0x14'))(_0x2b5f('0x15'));var utils=require('../../config/utils');var config=require(_0x2b5f('0x16'));var db=require(_0x2b5f('0x17'))['db'];function respondWithStatusCode(_0x17b8b5,_0x486491){_0x486491=_0x486491||0xcc;return function(_0x2c5dff){if(_0x2c5dff){return _0x17b8b5[_0x2b5f('0x18')](_0x486491);}return _0x17b8b5['status'](_0x486491)[_0x2b5f('0x19')]();};}function respondWithResult(_0x58ca0d,_0x3e5ec9){_0x3e5ec9=_0x3e5ec9||0xc8;return function(_0x5f1f7b){if(_0x5f1f7b){return _0x58ca0d[_0x2b5f('0x1a')](_0x3e5ec9)['json'](_0x5f1f7b);}};}function respondWithFilteredResult(_0x43a5f2,_0x318a71){return function(_0x57f013){if(_0x57f013){var _0x20ffb1=_0x57f013['count'],_0x367e0d=_0x318a71['offset'],_0x34f4f1=_0x318a71[_0x2b5f('0x1b')]+_0x318a71[_0x2b5f('0x1c')],_0x3940d1;if(_0x34f4f1>=_0x20ffb1){_0x34f4f1=_0x20ffb1;_0x3940d1=0xc8;}else{_0x3940d1=0xce;}_0x43a5f2[_0x2b5f('0x1a')](_0x3940d1);return _0x43a5f2[_0x2b5f('0x1d')]('Content-Range',_0x367e0d+'-'+_0x34f4f1+'/'+_0x20ffb1)[_0x2b5f('0x1e')](_0x57f013);}return null;};}function patchUpdates(_0x364ab1){return function(_0x104469){try{jsonpatch['apply'](_0x104469,_0x364ab1,!![]);}catch(_0x557f2f){return BPromise[_0x2b5f('0x1f')](_0x557f2f);}return _0x104469[_0x2b5f('0x20')]();};}function saveUpdates(_0x3cf150,_0x2841e4){return function(_0x9faa81){if(_0x9faa81){return _0x9faa81[_0x2b5f('0x21')](_0x3cf150)[_0x2b5f('0x22')](function(_0x47603f){return _0x47603f;});}return null;};}function removeEntity(_0x403791,_0x44bcfe){return function(_0x4db354){if(_0x4db354){return _0x4db354[_0x2b5f('0x23')]()[_0x2b5f('0x22')](function(){_0x403791[_0x2b5f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4579b8,_0x2e3cce){return function(_0x730479){if(!_0x730479){_0x4579b8['sendStatus'](0x194);}return _0x730479;};}function handleError(_0xe636e6,_0xdb2f18){_0xdb2f18=_0xdb2f18||0x1f4;return function(_0x5a3e5d){logger[_0x2b5f('0x24')](_0x5a3e5d[_0x2b5f('0x25')]);if(_0x5a3e5d[_0x2b5f('0x26')]){delete _0x5a3e5d['name'];}_0xe636e6['status'](_0xdb2f18)['send'](_0x5a3e5d);};}exports['show']=function(_0x43c6ff,_0x1c7072){var _0x18b03e={'raw':!![],'where':{'id':_0x43c6ff[_0x2b5f('0x27')]['id']}},_0x344a38={};_0x344a38['model']=_['keys'](db['ChatApplication'][_0x2b5f('0x28')]);_0x344a38['query']=_[_0x2b5f('0x29')](_0x43c6ff[_0x2b5f('0x2a')]);_0x344a38[_0x2b5f('0x2b')]=_[_0x2b5f('0x2c')](_0x344a38[_0x2b5f('0x2d')],_0x344a38[_0x2b5f('0x2a')]);_0x18b03e['attributes']=_['intersection'](_0x344a38['model'],qs[_0x2b5f('0x2e')](_0x43c6ff[_0x2b5f('0x2a')][_0x2b5f('0x2e')]));_0x18b03e[_0x2b5f('0x2f')]=_0x18b03e['attributes'][_0x2b5f('0x30')]?_0x18b03e[_0x2b5f('0x2f')]:_0x344a38[_0x2b5f('0x2d')];if(_0x43c6ff['query'][_0x2b5f('0x31')]){_0x18b03e[_0x2b5f('0x32')]=[{'all':!![]}];}_0x18b03e=_[_0x2b5f('0x33')]({},_0x18b03e,_0x43c6ff[_0x2b5f('0x34')]);return db[_0x2b5f('0x35')][_0x2b5f('0x36')](_0x18b03e)[_0x2b5f('0x22')](handleEntityNotFound(_0x1c7072,null))[_0x2b5f('0x22')](respondWithResult(_0x1c7072,null))[_0x2b5f('0x37')](handleError(_0x1c7072,null));};exports[_0x2b5f('0x21')]=function(_0x27928a,_0x4c24d9){if(_0x27928a[_0x2b5f('0x38')]['id']){delete _0x27928a[_0x2b5f('0x38')]['id'];}return db[_0x2b5f('0x35')]['find']({'where':{'id':_0x27928a[_0x2b5f('0x27')]['id']}})[_0x2b5f('0x22')](handleEntityNotFound(_0x4c24d9,null))['then'](saveUpdates(_0x27928a['body'],null))[_0x2b5f('0x22')](respondWithResult(_0x4c24d9,null))[_0x2b5f('0x37')](handleError(_0x4c24d9,null));};exports[_0x2b5f('0x23')]=function(_0x23a3fe,_0x1eaa5e){return db[_0x2b5f('0x35')][_0x2b5f('0x36')]({'where':{'id':_0x23a3fe[_0x2b5f('0x27')]['id']}})[_0x2b5f('0x22')](handleEntityNotFound(_0x1eaa5e,null))[_0x2b5f('0x22')](removeEntity(_0x1eaa5e,null))[_0x2b5f('0x37')](handleError(_0x1eaa5e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f52967a..b5291b6 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 _0x552a=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','define','chat_applications'];(function(_0x275797,_0x4b7a73){var _0x2219d2=function(_0x1064b7){while(--_0x1064b7){_0x275797['push'](_0x275797['shift']());}};_0x2219d2(++_0x4b7a73);}(_0x552a,0xfd));var _0xa552=function(_0x327199,_0x1283db){_0x327199=_0x327199-0x0;var _0x5a7cf0=_0x552a[_0x327199];return _0x5a7cf0;};'use strict';var _=require('lodash');var util=require(_0xa552('0x0'));var logger=require(_0xa552('0x1'))(_0xa552('0x2'));var moment=require(_0xa552('0x3'));var BPromise=require(_0xa552('0x4'));var rp=require(_0xa552('0x5'));var fs=require('fs');var path=require(_0xa552('0x6'));var rimraf=require('rimraf');var config=require(_0xa552('0x7'));var attributes=require(_0xa552('0x8'));module['exports']=function(_0x21dbda,_0xc3513){return _0x21dbda[_0xa552('0x9')]('ChatApplication',attributes,{'tableName':_0xa552('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa552('0xb')});}; \ No newline at end of file +var _0x1791=['api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2ccbbd,_0x555894){var _0x4c0daa=function(_0x458131){while(--_0x458131){_0x2ccbbd['push'](_0x2ccbbd['shift']());}};_0x4c0daa(++_0x555894);}(_0x1791,0x192));var _0x1179=function(_0x3bb45b,_0x2dcc0b){_0x3bb45b=_0x3bb45b-0x0;var _0x513162=_0x1791[_0x3bb45b];return _0x513162;};'use strict';var _=require(_0x1179('0x0'));var util=require(_0x1179('0x1'));var logger=require(_0x1179('0x2'))(_0x1179('0x3'));var moment=require(_0x1179('0x4'));var BPromise=require(_0x1179('0x5'));var rp=require(_0x1179('0x6'));var fs=require('fs');var path=require(_0x1179('0x7'));var rimraf=require(_0x1179('0x8'));var config=require('../../config/environment');var attributes=require(_0x1179('0x9'));module[_0x1179('0xa')]=function(_0x390e70,_0x2431ff){return _0x390e70[_0x1179('0xb')]('ChatApplication',attributes,{'tableName':_0x1179('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1179('0xd'),'collate':_0x1179('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 417ae8c..5a055b5 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 _0xc37f=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then'];(function(_0x24dedb,_0x116fe6){var _0x4220b2=function(_0x1bf700){while(--_0x1bf700){_0x24dedb['push'](_0x24dedb['shift']());}};_0x4220b2(++_0x116fe6);}(_0xc37f,0x1d8));var _0xfc37=function(_0x481072,_0x492887){_0x481072=_0x481072-0x0;var _0xb822f7=_0xc37f[_0x481072];return _0xb822f7;};'use strict';var _=require(_0xfc37('0x0'));var util=require(_0xfc37('0x1'));var moment=require(_0xfc37('0x2'));var BPromise=require(_0xfc37('0x3'));var rs=require(_0xfc37('0x4'));var fs=require('fs');var Redis=require(_0xfc37('0x5'));var db=require(_0xfc37('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc37('0x7'))('rpc');var config=require(_0xfc37('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc37('0x9')][_0xfc37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123d6c,_0x4f19db,_0x2ef5cd){return new BPromise(function(_0x450343,_0x17aee3){return client['request'](_0x123d6c,_0x2ef5cd)[_0xfc37('0xb')](function(_0x15d448){logger['info'](_0xfc37('0xc'),_0x4f19db,_0xfc37('0xd'));logger[_0xfc37('0xe')](_0xfc37('0xf'),_0x4f19db,_0xfc37('0xd'),JSON[_0xfc37('0x10')](_0x15d448));if(_0x15d448[_0xfc37('0x11')]){if(_0x15d448[_0xfc37('0x11')]['code']===0x1f4){logger[_0xfc37('0x11')](_0xfc37('0xc'),_0x4f19db,_0x15d448[_0xfc37('0x11')][_0xfc37('0x12')]);return _0x17aee3(_0x15d448[_0xfc37('0x11')][_0xfc37('0x12')]);}logger[_0xfc37('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4f19db,_0x15d448[_0xfc37('0x11')][_0xfc37('0x12')]);return _0x450343(_0x15d448['error'][_0xfc37('0x12')]);}else{logger[_0xfc37('0x13')](_0xfc37('0xc'),_0x4f19db,'request\x20sent');_0x450343(_0x15d448[_0xfc37('0x14')]['message']);}})[_0xfc37('0x15')](function(_0x26c227){logger[_0xfc37('0x11')](_0xfc37('0xc'),_0x4f19db,_0x26c227);_0x17aee3(_0x26c227);});});} \ No newline at end of file +var _0xd5be=['client','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x371afb,_0xa962f9){var _0x57b964=function(_0x5d3db1){while(--_0x5d3db1){_0x371afb['push'](_0x371afb['shift']());}};_0x57b964(++_0xa962f9);}(_0xd5be,0x1eb));var _0xed5b=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xd5be[_0x242a4f];return _0x122117;};'use strict';var _=require(_0xed5b('0x0'));var util=require(_0xed5b('0x1'));var moment=require('moment');var BPromise=require(_0xed5b('0x2'));var rs=require(_0xed5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed5b('0x4'))['db'];var utils=require(_0xed5b('0x5'));var logger=require(_0xed5b('0x6'))(_0xed5b('0x7'));var config=require('../../config/environment');var jayson=require(_0xed5b('0x8'));var client=jayson[_0xed5b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6d88,_0x5c3e7b,_0x21c74b){return new BPromise(function(_0x5c1d3a,_0x4d741e){return client['request'](_0x4f6d88,_0x21c74b)[_0xed5b('0xa')](function(_0x2e1ffb){logger[_0xed5b('0xb')](_0xed5b('0xc'),_0x5c3e7b,'request\x20sent');logger[_0xed5b('0xd')](_0xed5b('0xe'),_0x5c3e7b,'request\x20sent',JSON[_0xed5b('0xf')](_0x2e1ffb));if(_0x2e1ffb[_0xed5b('0x10')]){if(_0x2e1ffb[_0xed5b('0x10')]['code']===0x1f4){logger['error'](_0xed5b('0xc'),_0x5c3e7b,_0x2e1ffb[_0xed5b('0x10')]['message']);return _0x4d741e(_0x2e1ffb[_0xed5b('0x10')]['message']);}logger[_0xed5b('0x10')](_0xed5b('0xc'),_0x5c3e7b,_0x2e1ffb['error'][_0xed5b('0x11')]);return _0x5c1d3a(_0x2e1ffb[_0xed5b('0x10')][_0xed5b('0x11')]);}else{logger['info'](_0xed5b('0xc'),_0x5c3e7b,_0xed5b('0x12'));_0x5c1d3a(_0x2e1ffb[_0xed5b('0x13')][_0xed5b('0x11')]);}})['catch'](function(_0x3302cc){logger['error']('ChatApplication,\x20%s,\x20%s',_0x5c3e7b,_0x3302cc);_0x4d741e(_0x3302cc);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index fab2259..12deaae 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 _0x808c=['isAuthenticated','put','update','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','./chatApplication.controller','/:id'];(function(_0x8590ea,_0x384405){var _0x3437c7=function(_0x1d7244){while(--_0x1d7244){_0x8590ea['push'](_0x8590ea['shift']());}};_0x3437c7(++_0x384405);}(_0x808c,0xe9));var _0xc808=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x808c[_0x20589d];return _0x422de9;};'use strict';var multer=require('multer');var util=require(_0xc808('0x0'));var path=require(_0xc808('0x1'));var timeout=require(_0xc808('0x2'));var express=require(_0xc808('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc808('0x4'));var config=require('../../config/environment');var controller=require(_0xc808('0x5'));router['get'](_0xc808('0x6'),auth[_0xc808('0x7')](),controller['show']);router[_0xc808('0x8')]('/:id',auth[_0xc808('0x7')](),controller[_0xc808('0x9')]);router[_0xc808('0xa')](_0xc808('0x6'),auth[_0xc808('0x7')](),controller[_0xc808('0xb')]);module['exports']=router; \ No newline at end of file +var _0xfc5c=['./chatApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d646c,_0x3e6875){var _0x2e4fa7=function(_0x340056){while(--_0x340056){_0x4d646c['push'](_0x4d646c['shift']());}};_0x2e4fa7(++_0x3e6875);}(_0xfc5c,0xe5));var _0xcfc5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xfc5c[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xcfc5('0x0'));var util=require(_0xcfc5('0x1'));var path=require(_0xcfc5('0x2'));var timeout=require(_0xcfc5('0x3'));var express=require(_0xcfc5('0x4'));var router=express[_0xcfc5('0x5')]();var auth=require(_0xcfc5('0x6'));var interaction=require(_0xcfc5('0x7'));var config=require(_0xcfc5('0x8'));var controller=require(_0xcfc5('0x9'));router[_0xcfc5('0xa')]('/:id',auth[_0xcfc5('0xb')](),controller['show']);router['put'](_0xcfc5('0xc'),auth['isAuthenticated'](),controller[_0xcfc5('0xd')]);router[_0xcfc5('0xe')](_0xcfc5('0xc'),auth[_0xcfc5('0xb')](),controller[_0xcfc5('0xf')]);module[_0xcfc5('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7b70038..84ad0dd 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 _0xdd05=['BOOLEAN','sequelize','STRING'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xdd05,0x88));var _0x5dd0=function(_0x2f3d73,_0x2e35ac){_0x2f3d73=_0x2f3d73-0x0;var _0x2b5fb7=_0xdd05[_0x2f3d73];return _0x2b5fb7;};'use strict';var Sequelize=require(_0x5dd0('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dd0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5dd0('0x1')]},'write':{'type':Sequelize[_0x5dd0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9b80=['BOOLEAN','exports','STRING'];(function(_0x3fa079,_0x373452){var _0x12bc0c=function(_0x488a43){while(--_0x488a43){_0x3fa079['push'](_0x3fa079['shift']());}};_0x12bc0c(++_0x373452);}(_0x9b80,0x6a));var _0x09b8=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x9b80[_0xbc2974];return _0x3a5b4f;};'use strict';var Sequelize=require('sequelize');module[_0x09b8('0x0')]={'name':{'type':Sequelize[_0x09b8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x09b8('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0dad6d7..9e33746 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 _0x485b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.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','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','count','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatGroup','include','show','params','intersection','find','create','body','describe','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit','offset','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','format'];(function(_0xa5af86,_0x43ef01){var _0x4e54b7=function(_0x32c649){while(--_0x32c649){_0xa5af86['push'](_0xa5af86['shift']());}};_0x4e54b7(++_0x43ef01);}(_0x485b,0x141));var _0xb485=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x485b[_0x43776a];return _0x18eb8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb485('0x0'));var rimraf=require(_0xb485('0x1'));var zipdir=require(_0xb485('0x2'));var jsonpatch=require(_0xb485('0x3'));var rp=require(_0xb485('0x4'));var moment=require('moment');var BPromise=require(_0xb485('0x5'));var Mustache=require(_0xb485('0x6'));var util=require(_0xb485('0x7'));var path=require(_0xb485('0x8'));var sox=require(_0xb485('0x9'));var csv=require('to-csv');var ejs=require(_0xb485('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb485('0xb'));var crypto=require(_0xb485('0xc'));var jsforce=require(_0xb485('0xd'));var deskjs=require(_0xb485('0xe'));var toCsv=require(_0xb485('0xf'));var querystring=require(_0xb485('0x10'));var Papa=require(_0xb485('0x11'));var Redis=require(_0xb485('0x12'));var authService=require(_0xb485('0x13'));var qs=require(_0xb485('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb485('0x15'));var logger=require('../../config/logger')(_0xb485('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb485('0x17'))['db'];config[_0xb485('0x18')]=_['defaults'](config[_0xb485('0x18')],{'host':_0xb485('0x19'),'port':0x18eb});var socket=require(_0xb485('0x1a'))(new Redis(config[_0xb485('0x18')]));require(_0xb485('0x1b'))[_0xb485('0x1c')](socket);var jayson=require(_0xb485('0x1d'));var client=jayson[_0xb485('0x1e')][_0xb485('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1bc598,_0x1de4d0,_0x4a63e9){if(_0x4a63e9){var _0x986449=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x986449['test'](_0x1de4d0)){return _0x1bc598;}else{throw new db[(_0xb485('0x20'))][(_0xb485('0x21'))](_0xb485('0x22'));}}else{return _0x1bc598;}}function respondWithRpcPromise(_0x1f6df6,_0x3b13b9,_0x4d23c0,_0x350271){return new BPromise(function(_0x2c05f1,_0x3e56c7){var _0x222985=_0x350271||client;return _0x222985[_0xb485('0x23')](_0x1f6df6,_0x4d23c0)['then'](function(_0x452ace){logger[_0xb485('0x24')](_0xb485('0x25'),_0x3b13b9,_0xb485('0x26'));logger[_0xb485('0x27')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3b13b9,_0xb485('0x26'),JSON[_0xb485('0x28')](_0x452ace));if(_0x452ace[_0xb485('0x29')]){if(_0x452ace[_0xb485('0x29')][_0xb485('0x2a')]===0x1f4){logger[_0xb485('0x29')](_0xb485('0x25'),_0x3b13b9,_0x452ace[_0xb485('0x29')][_0xb485('0x2b')]);return _0x3e56c7(_0x452ace[_0xb485('0x29')][_0xb485('0x2b')]);}logger[_0xb485('0x29')](_0xb485('0x25'),_0x3b13b9,_0x452ace[_0xb485('0x29')][_0xb485('0x2b')]);return _0x2c05f1(_0x452ace[_0xb485('0x29')][_0xb485('0x2b')]);}else{logger[_0xb485('0x24')]('ChatGroup,\x20%s,\x20%s',_0x3b13b9,_0xb485('0x26'));_0x2c05f1(_0x452ace['result'][_0xb485('0x2b')]);}})[_0xb485('0x2c')](function(_0x285b6d){logger['error'](_0xb485('0x25'),_0x3b13b9,_0x285b6d);_0x3e56c7(_0x285b6d);});});}function respondWithStatusCode(_0x4c0428,_0x37c641){_0x37c641=_0x37c641||0xcc;return function(_0x16b11a){if(_0x16b11a){return _0x4c0428['sendStatus'](_0x37c641);}return _0x4c0428[_0xb485('0x2d')](_0x37c641)['end']();};}function respondWithResult(_0x26bb36,_0x5ee788){_0x5ee788=_0x5ee788||0xc8;return function(_0x14fe52){if(_0x14fe52){return _0x26bb36[_0xb485('0x2d')](_0x5ee788)['json'](_0x14fe52);}};}function respondWithFilteredResult(_0x404d7c,_0x3f488b){return function(_0x1cf375){if(_0x1cf375){var _0x569a85=_0x1cf375[_0xb485('0x2e')],_0x400206=_0x3f488b['offset'],_0x4ecb35=_0x3f488b['offset']+_0x3f488b['limit'],_0x1af43a;if(_0x4ecb35>=_0x569a85){_0x4ecb35=_0x569a85;_0x1af43a=0xc8;}else{_0x1af43a=0xce;}_0x404d7c[_0xb485('0x2d')](_0x1af43a);return _0x404d7c[_0xb485('0x2f')](_0xb485('0x30'),_0x400206+'-'+_0x4ecb35+'/'+_0x569a85)[_0xb485('0x31')](_0x1cf375);}return null;};}function patchUpdates(_0x2a65a3){return function(_0x5bb07f){try{jsonpatch['apply'](_0x5bb07f,_0x2a65a3,!![]);}catch(_0x53315f){return BPromise[_0xb485('0x32')](_0x53315f);}return _0x5bb07f[_0xb485('0x33')]();};}function saveUpdates(_0x526d48,_0x3ccd9a){return function(_0x51d924){if(_0x51d924){return _0x51d924[_0xb485('0x34')](_0x526d48)[_0xb485('0x35')](function(_0x518526){return _0x518526;});}return null;};}function removeEntity(_0x4d8406,_0x50c7b8){return function(_0x27f870){if(_0x27f870){return _0x27f870[_0xb485('0x36')]()[_0xb485('0x35')](function(){_0x4d8406[_0xb485('0x2d')](0xcc)[_0xb485('0x37')]();});}};}function handleEntityNotFound(_0xe52ac8,_0x4a04cb){return function(_0x5ae54a){if(!_0x5ae54a){_0xe52ac8['sendStatus'](0x194);}return _0x5ae54a;};}function handleError(_0x3b797a,_0x4297f1){_0x4297f1=_0x4297f1||0x1f4;return function(_0x55d644){logger[_0xb485('0x29')](_0x55d644[_0xb485('0x38')]);if(_0x55d644[_0xb485('0x39')]){delete _0x55d644[_0xb485('0x39')];}_0x3b797a[_0xb485('0x2d')](_0x4297f1)[_0xb485('0x3a')](_0x55d644);};}exports[_0xb485('0x3b')]=function(_0x5318bc,_0x4b3f80){var _0x4d2ed7={},_0x2e5b65={},_0x40953c={'count':0x0,'rows':[]};var _0x306fc7=_['map'](db['ChatGroup'][_0xb485('0x3c')],function(_0x5736c2){return{'name':_0x5736c2['fieldName'],'type':_0x5736c2[_0xb485('0x3d')][_0xb485('0x3e')]};});_0x2e5b65[_0xb485('0x3f')]=_[_0xb485('0x40')](_0x306fc7,'name');_0x2e5b65['query']=_[_0xb485('0x41')](_0x5318bc[_0xb485('0x42')]);_0x2e5b65[_0xb485('0x43')]=_['intersection'](_0x2e5b65[_0xb485('0x3f')],_0x2e5b65[_0xb485('0x42')]);_0x4d2ed7['attributes']=_['intersection'](_0x2e5b65[_0xb485('0x3f')],qs[_0xb485('0x44')](_0x5318bc['query']['fields']));_0x4d2ed7['attributes']=_0x4d2ed7[_0xb485('0x45')][_0xb485('0x46')]?_0x4d2ed7[_0xb485('0x45')]:_0x2e5b65[_0xb485('0x3f')];if(!_0x5318bc[_0xb485('0x42')][_0xb485('0x47')]('nolimit')){_0x4d2ed7[_0xb485('0x48')]=qs[_0xb485('0x48')](_0x5318bc[_0xb485('0x42')][_0xb485('0x48')]);_0x4d2ed7['offset']=qs['offset'](_0x5318bc[_0xb485('0x42')]['offset']);}_0x4d2ed7[_0xb485('0x49')]=qs[_0xb485('0x4a')](_0x5318bc['query'][_0xb485('0x4a')]);_0x4d2ed7['where']=qs['filters'](_[_0xb485('0x4b')](_0x5318bc[_0xb485('0x42')],_0x2e5b65[_0xb485('0x43')]),_0x306fc7);if(_0x5318bc[_0xb485('0x42')][_0xb485('0x4c')]){_0x4d2ed7[_0xb485('0x4d')]=_[_0xb485('0x4e')](_0x4d2ed7[_0xb485('0x4d')],{'$or':_[_0xb485('0x40')](_0x306fc7,function(_0x4e3220){if(_0x4e3220[_0xb485('0x3d')]!==_0xb485('0x4f')){var _0x4a213b={};_0x4a213b[_0x4e3220[_0xb485('0x39')]]={'$like':'%'+_0x5318bc[_0xb485('0x42')][_0xb485('0x4c')]+'%'};return _0x4a213b;}})});}_0x4d2ed7=_[_0xb485('0x4e')]({},_0x4d2ed7,_0x5318bc[_0xb485('0x50')]);var _0x2c40f8={'where':_0x4d2ed7['where']};return db[_0xb485('0x51')][_0xb485('0x2e')](_0x2c40f8)[_0xb485('0x35')](function(_0x4c824d){_0x40953c[_0xb485('0x2e')]=_0x4c824d;if(_0x5318bc[_0xb485('0x42')]['includeAll']){_0x4d2ed7[_0xb485('0x52')]=[{'all':!![]}];}return db[_0xb485('0x51')]['findAll'](_0x4d2ed7);})['then'](function(_0x4ce4ec){_0x40953c['rows']=_0x4ce4ec;return _0x40953c;})[_0xb485('0x35')](respondWithFilteredResult(_0x4b3f80,_0x4d2ed7))[_0xb485('0x2c')](handleError(_0x4b3f80,null));};exports[_0xb485('0x53')]=function(_0x561deb,_0x16353b){var _0x1c2d53={'raw':!![],'where':{'id':_0x561deb[_0xb485('0x54')]['id']}},_0x11ece1={};_0x11ece1[_0xb485('0x3f')]=_[_0xb485('0x41')](db[_0xb485('0x51')]['rawAttributes']);_0x11ece1['query']=_[_0xb485('0x41')](_0x561deb[_0xb485('0x42')]);_0x11ece1[_0xb485('0x43')]=_[_0xb485('0x55')](_0x11ece1['model'],_0x11ece1['query']);_0x1c2d53[_0xb485('0x45')]=_[_0xb485('0x55')](_0x11ece1[_0xb485('0x3f')],qs[_0xb485('0x44')](_0x561deb['query']['fields']));_0x1c2d53[_0xb485('0x45')]=_0x1c2d53['attributes'][_0xb485('0x46')]?_0x1c2d53[_0xb485('0x45')]:_0x11ece1['model'];if(_0x561deb['query']['includeAll']){_0x1c2d53[_0xb485('0x52')]=[{'all':!![]}];}_0x1c2d53=_[_0xb485('0x4e')]({},_0x1c2d53,_0x561deb['options']);return db[_0xb485('0x51')][_0xb485('0x56')](_0x1c2d53)['then'](handleEntityNotFound(_0x16353b,null))[_0xb485('0x35')](respondWithResult(_0x16353b,null))[_0xb485('0x2c')](handleError(_0x16353b,null));};exports[_0xb485('0x57')]=function(_0x2aea48,_0x470dd2){return db[_0xb485('0x51')][_0xb485('0x57')](_0x2aea48[_0xb485('0x58')],{})[_0xb485('0x35')](respondWithResult(_0x470dd2,0xc9))[_0xb485('0x2c')](handleError(_0x470dd2,null));};exports['update']=function(_0x4bfdf6,_0x1d263b){if(_0x4bfdf6[_0xb485('0x58')]['id']){delete _0x4bfdf6['body']['id'];}return db[_0xb485('0x51')][_0xb485('0x56')]({'where':{'id':_0x4bfdf6[_0xb485('0x54')]['id']}})[_0xb485('0x35')](handleEntityNotFound(_0x1d263b,null))[_0xb485('0x35')](saveUpdates(_0x4bfdf6['body'],null))['then'](respondWithResult(_0x1d263b,null))[_0xb485('0x2c')](handleError(_0x1d263b,null));};exports[_0xb485('0x36')]=function(_0x6655be,_0xdc14d6){return db[_0xb485('0x51')][_0xb485('0x56')]({'where':{'id':_0x6655be[_0xb485('0x54')]['id']}})[_0xb485('0x35')](handleEntityNotFound(_0xdc14d6,null))[_0xb485('0x35')](removeEntity(_0xdc14d6,null))[_0xb485('0x2c')](handleError(_0xdc14d6,null));};exports[_0xb485('0x59')]=function(_0x2ede7a,_0x242615){return db[_0xb485('0x51')][_0xb485('0x59')]()['then'](respondWithResult(_0x242615,null))[_0xb485('0x2c')](handleError(_0x242615,null));};exports['getUnread']=function(_0x128bdc,_0x482544,_0x4db58e){return db['ChatInternalMessage'][_0xb485('0x2e')]({'where':{'ChatGroupId':_0x128bdc['params']['id'],'ToId':_0x128bdc[_0xb485('0x5a')]['id'],'read':![]}})[_0xb485('0x35')](function(_0x4efd48){return{'id':_[_0xb485('0x5b')](_0x128bdc[_0xb485('0x54')]['id']),'count':_0x4efd48};})[_0xb485('0x35')](respondWithResult(_0x482544,null))[_0xb485('0x2c')](handleError(_0x482544,null));};exports[_0xb485('0x5c')]=function(_0x571d22,_0x1f0a8d,_0x71fb50){return db[_0xb485('0x51')][_0xb485('0x56')]({'where':{'id':_0x571d22[_0xb485('0x54')]['id']}})['then'](handleEntityNotFound(_0x1f0a8d,null))['then'](function(_0x357d5c){if(_0x357d5c){return _0x357d5c[_0xb485('0x5c')](_0x571d22[_0xb485('0x58')][_0xb485('0x5d')],_[_0xb485('0x5e')](_0x571d22[_0xb485('0x58')],[_0xb485('0x5d'),'id'])||{});}})[_0xb485('0x35')](respondWithResult(_0x1f0a8d,null))[_0xb485('0x2c')](handleError(_0x1f0a8d,null));};exports[_0xb485('0x5f')]=function(_0x10bae0,_0x5016cb,_0x214ea9){var _0x2f5843={};var _0x157da6={};var _0x598f02;var _0x35a902;return db['ChatGroup'][_0xb485('0x60')]({'where':{'id':_0x10bae0['params']['id']}})[_0xb485('0x35')](handleEntityNotFound(_0x5016cb,null))[_0xb485('0x35')](function(_0xdcf90e){if(_0xdcf90e){_0x598f02=_0xdcf90e;_0x157da6[_0xb485('0x3f')]=_[_0xb485('0x41')](db[_0xb485('0x61')][_0xb485('0x3c')]);_0x157da6[_0xb485('0x42')]=_['keys'](_0x10bae0['query']);_0x157da6[_0xb485('0x43')]=_['intersection'](_0x157da6[_0xb485('0x3f')],_0x157da6[_0xb485('0x42')]);_0x2f5843[_0xb485('0x45')]=_['intersection'](_0x157da6[_0xb485('0x3f')],qs[_0xb485('0x44')](_0x10bae0['query']['fields']));_0x2f5843[_0xb485('0x45')]=_0x2f5843[_0xb485('0x45')]['length']?_0x2f5843[_0xb485('0x45')]:_0x157da6[_0xb485('0x3f')];_0x2f5843[_0xb485('0x49')]=qs[_0xb485('0x4a')](_0x10bae0['query'][_0xb485('0x4a')]);_0x2f5843['where']=qs[_0xb485('0x43')](_[_0xb485('0x4b')](_0x10bae0['query'],_0x157da6['filters']));if(_0x10bae0[_0xb485('0x42')][_0xb485('0x4c')]){_0x2f5843['where']=_[_0xb485('0x4e')](_0x2f5843[_0xb485('0x4d')],{'$or':_[_0xb485('0x40')](_0x2f5843['attributes'],function(_0x77afaf){var _0x12fd02={};_0x12fd02[_0x77afaf]={'$like':'%'+_0x10bae0[_0xb485('0x42')][_0xb485('0x4c')]+'%'};return _0x12fd02;})});}_0x2f5843=_[_0xb485('0x4e')]({},_0x2f5843,_0x10bae0[_0xb485('0x50')]);return _0x598f02[_0xb485('0x5f')](_0x2f5843);}})['then'](function(_0x4b27bc){if(_0x4b27bc){_0x35a902=_0x4b27bc[_0xb485('0x46')];if(!_0x10bae0[_0xb485('0x42')][_0xb485('0x47')](_0xb485('0x62'))){_0x2f5843[_0xb485('0x48')]=qs[_0xb485('0x48')](_0x10bae0['query'][_0xb485('0x48')]);_0x2f5843[_0xb485('0x63')]=qs[_0xb485('0x63')](_0x10bae0['query'][_0xb485('0x63')]);}return _0x598f02[_0xb485('0x5f')](_0x2f5843);}})[_0xb485('0x35')](function(_0x1cb928){if(_0x1cb928){return _0x1cb928?{'count':_0x35a902,'rows':_0x1cb928}:null;}})['then'](respondWithResult(_0x5016cb,null))[_0xb485('0x2c')](handleError(_0x5016cb,null));};exports[_0xb485('0x64')]=function(_0xeb2880,_0x2d7446,_0x2cf7e7){return db[_0xb485('0x51')][_0xb485('0x56')]({'where':{'id':_0xeb2880['params']['id']}})[_0xb485('0x35')](handleEntityNotFound(_0x2d7446,null))['then'](function(_0x48cb0f){if(_0x48cb0f){return _0x48cb0f[_0xb485('0x64')](_0xeb2880['query'][_0xb485('0x5d')]);}})[_0xb485('0x35')](respondWithStatusCode(_0x2d7446,null))[_0xb485('0x2c')](handleError(_0x2d7446,null));};exports[_0xb485('0x65')]=function(_0x15a1b5,_0x75f95c,_0x67033){if(_0x15a1b5[_0xb485('0x58')]['id']){delete _0x15a1b5['body']['id'];}return db[_0xb485('0x51')][_0xb485('0x56')]({'where':{'id':_0x15a1b5[_0xb485('0x54')]['id']}})[_0xb485('0x35')](handleEntityNotFound(_0x75f95c,null))[_0xb485('0x35')](function(_0x581fe1){if(_0x581fe1){_0x15a1b5[_0xb485('0x58')]['ChatGroupId']=_0x581fe1['id'];return db[_0xb485('0x66')]['create'](_0x15a1b5[_0xb485('0x58')]);}})['then'](respondWithResult(_0x75f95c,null))[_0xb485('0x2c')](handleError(_0x75f95c,null));};exports[_0xb485('0x67')]=function(_0x4d2f31,_0xc0b0c5,_0x828664){var _0x32c87a={};var _0x3ab9aa={};var _0x5d897a;var _0x30dc3c;return db[_0xb485('0x51')]['findOne']({'where':{'id':_0x4d2f31['params']['id']}})[_0xb485('0x35')](handleEntityNotFound(_0xc0b0c5,null))[_0xb485('0x35')](function(_0x1cdae1){if(_0x1cdae1){_0x5d897a=_0x1cdae1;_0x3ab9aa[_0xb485('0x3f')]=_[_0xb485('0x41')](db[_0xb485('0x66')]['rawAttributes']);_0x3ab9aa[_0xb485('0x42')]=_[_0xb485('0x41')](_0x4d2f31[_0xb485('0x42')]);_0x3ab9aa[_0xb485('0x43')]=_[_0xb485('0x55')](_0x3ab9aa[_0xb485('0x3f')],_0x3ab9aa[_0xb485('0x42')]);_0x32c87a['attributes']=_[_0xb485('0x55')](_0x3ab9aa[_0xb485('0x3f')],qs[_0xb485('0x44')](_0x4d2f31[_0xb485('0x42')][_0xb485('0x44')]));_0x32c87a['attributes']=_0x32c87a[_0xb485('0x45')][_0xb485('0x46')]?_0x32c87a[_0xb485('0x45')]:_0x3ab9aa[_0xb485('0x3f')];_0x32c87a[_0xb485('0x49')]=qs['sort'](_0x4d2f31[_0xb485('0x42')][_0xb485('0x4a')]);_0x32c87a[_0xb485('0x4d')]=qs[_0xb485('0x43')](_[_0xb485('0x4b')](_0x4d2f31['query'],_0x3ab9aa[_0xb485('0x43')]));if(_0x4d2f31['query'][_0xb485('0x4c')]){_0x32c87a['where']=_[_0xb485('0x4e')](_0x32c87a[_0xb485('0x4d')],{'$or':_[_0xb485('0x40')](_0x32c87a[_0xb485('0x45')],function(_0xbf3e29){var _0x2cb47a={};_0x2cb47a[_0xbf3e29]={'$like':'%'+_0x4d2f31['query'][_0xb485('0x4c')]+'%'};return _0x2cb47a;})});}if(_0x4d2f31['query'][_0xb485('0x68')]){var _0x1bd32b=_0x4d2f31[_0xb485('0x42')][_0xb485('0x68')][_0xb485('0x69')](',');var _0x26aac1={};_0x26aac1[_0x1bd32b[0x0]]={'$gte':moment(_0x1bd32b[0x1])[_0xb485('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32c87a[_0xb485('0x4d')]=_[_0xb485('0x4e')](_0x32c87a[_0xb485('0x4d')],_0x26aac1);}_0x32c87a=_[_0xb485('0x4e')]({},_0x32c87a,_0x4d2f31['options']);return _0x5d897a[_0xb485('0x67')](_0x32c87a);}})['then'](function(_0x62ad03){if(_0x62ad03){_0x30dc3c=_0x62ad03[_0xb485('0x46')];if(!_0x4d2f31[_0xb485('0x42')][_0xb485('0x47')](_0xb485('0x62'))){_0x32c87a[_0xb485('0x48')]=qs[_0xb485('0x48')](_0x4d2f31[_0xb485('0x42')][_0xb485('0x48')]);_0x32c87a['offset']=qs[_0xb485('0x63')](_0x4d2f31[_0xb485('0x42')]['offset']);}return _0x5d897a[_0xb485('0x67')](_0x32c87a);}})[_0xb485('0x35')](function(_0x276264){if(_0x276264){return _0x276264?{'count':_0x30dc3c,'rows':_0x276264}:null;}})[_0xb485('0x35')](respondWithResult(_0xc0b0c5,null))['catch'](handleError(_0xc0b0c5,null));}; \ No newline at end of file +var _0x790e=['stringify','error','code','message','result','catch','status','json','count','offset','limit','set','reject','save','destroy','end','name','ChatGroup','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','options','create','body','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','order','pick','addMessage','getMessages','$gte','split','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.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','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1767b2,_0xf93bf8){var _0x10f9fd=function(_0x539403){while(--_0x539403){_0x1767b2['push'](_0x1767b2['shift']());}};_0x10f9fd(++_0xf93bf8);}(_0x790e,0x1dc));var _0xe790=function(_0x30d83b,_0x4c8984){_0x30d83b=_0x30d83b-0x0;var _0x512ba2=_0x790e[_0x30d83b];return _0x512ba2;};'use strict';var pdf=require(_0xe790('0x0'));var emlformat=require(_0xe790('0x1'));var rimraf=require(_0xe790('0x2'));var zipdir=require(_0xe790('0x3'));var jsonpatch=require(_0xe790('0x4'));var rp=require(_0xe790('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe790('0x6'));var path=require('path');var sox=require(_0xe790('0x7'));var csv=require(_0xe790('0x8'));var ejs=require(_0xe790('0x9'));var fs=require('fs');var _=require(_0xe790('0xa'));var squel=require(_0xe790('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe790('0xc'));var toCsv=require(_0xe790('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe790('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe790('0xe'));var hardwareService=require(_0xe790('0xf'));var logger=require(_0xe790('0x10'))(_0xe790('0x11'));var utils=require(_0xe790('0x12'));var config=require(_0xe790('0x13'));var db=require(_0xe790('0x14'))['db'];config['redis']=_['defaults'](config[_0xe790('0x15')],{'host':_0xe790('0x16'),'port':0x18eb});var socket=require(_0xe790('0x17'))(new Redis(config['redis']));require(_0xe790('0x18'))[_0xe790('0x19')](socket);var jayson=require(_0xe790('0x1a'));var client=jayson[_0xe790('0x1b')][_0xe790('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4e2be8,_0x542cbd,_0x3f5e0f){if(_0x3f5e0f){var _0x35383c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35383c['test'](_0x542cbd)){return _0x4e2be8;}else{throw new db[(_0xe790('0x1d'))][(_0xe790('0x1e'))](_0xe790('0x1f'));}}else{return _0x4e2be8;}}function respondWithRpcPromise(_0x250db0,_0x587935,_0x1e4d90,_0x5c335f){return new BPromise(function(_0x166600,_0x38a17a){var _0x271b54=_0x5c335f||client;return _0x271b54[_0xe790('0x20')](_0x250db0,_0x1e4d90)[_0xe790('0x21')](function(_0x4e9afd){logger[_0xe790('0x22')](_0xe790('0x23'),_0x587935,'request\x20sent');logger[_0xe790('0x24')](_0xe790('0x25'),_0x587935,_0xe790('0x26'),JSON[_0xe790('0x27')](_0x4e9afd));if(_0x4e9afd[_0xe790('0x28')]){if(_0x4e9afd[_0xe790('0x28')][_0xe790('0x29')]===0x1f4){logger['error'](_0xe790('0x23'),_0x587935,_0x4e9afd[_0xe790('0x28')][_0xe790('0x2a')]);return _0x38a17a(_0x4e9afd[_0xe790('0x28')][_0xe790('0x2a')]);}logger[_0xe790('0x28')](_0xe790('0x23'),_0x587935,_0x4e9afd['error']['message']);return _0x166600(_0x4e9afd[_0xe790('0x28')][_0xe790('0x2a')]);}else{logger[_0xe790('0x22')](_0xe790('0x23'),_0x587935,_0xe790('0x26'));_0x166600(_0x4e9afd[_0xe790('0x2b')]['message']);}})[_0xe790('0x2c')](function(_0xf25f5b){logger[_0xe790('0x28')]('ChatGroup,\x20%s,\x20%s',_0x587935,_0xf25f5b);_0x38a17a(_0xf25f5b);});});}function respondWithStatusCode(_0x12b21e,_0x25ca67){_0x25ca67=_0x25ca67||0xcc;return function(_0x408126){if(_0x408126){return _0x12b21e['sendStatus'](_0x25ca67);}return _0x12b21e[_0xe790('0x2d')](_0x25ca67)['end']();};}function respondWithResult(_0x46142e,_0x844d2f){_0x844d2f=_0x844d2f||0xc8;return function(_0x378d2b){if(_0x378d2b){return _0x46142e['status'](_0x844d2f)[_0xe790('0x2e')](_0x378d2b);}};}function respondWithFilteredResult(_0x4ff0fb,_0x4c977f){return function(_0x268cd1){if(_0x268cd1){var _0x3e6e75=_0x268cd1[_0xe790('0x2f')],_0x21f835=_0x4c977f[_0xe790('0x30')],_0xebf1=_0x4c977f['offset']+_0x4c977f[_0xe790('0x31')],_0xd2dd41;if(_0xebf1>=_0x3e6e75){_0xebf1=_0x3e6e75;_0xd2dd41=0xc8;}else{_0xd2dd41=0xce;}_0x4ff0fb[_0xe790('0x2d')](_0xd2dd41);return _0x4ff0fb[_0xe790('0x32')]('Content-Range',_0x21f835+'-'+_0xebf1+'/'+_0x3e6e75)['json'](_0x268cd1);}return null;};}function patchUpdates(_0x1eb670){return function(_0x3bb59e){try{jsonpatch['apply'](_0x3bb59e,_0x1eb670,!![]);}catch(_0x1e716d){return BPromise[_0xe790('0x33')](_0x1e716d);}return _0x3bb59e[_0xe790('0x34')]();};}function saveUpdates(_0x5ade3b,_0x5ef086){return function(_0x2fdc2f){if(_0x2fdc2f){return _0x2fdc2f['update'](_0x5ade3b)[_0xe790('0x21')](function(_0x18eb4b){return _0x18eb4b;});}return null;};}function removeEntity(_0x58012d,_0x4db05d){return function(_0x35d54e){if(_0x35d54e){return _0x35d54e[_0xe790('0x35')]()[_0xe790('0x21')](function(){_0x58012d[_0xe790('0x2d')](0xcc)[_0xe790('0x36')]();});}};}function handleEntityNotFound(_0x478c28,_0x1cc6fc){return function(_0x4a773a){if(!_0x4a773a){_0x478c28['sendStatus'](0x194);}return _0x4a773a;};}function handleError(_0x1e2bee,_0x49ab38){_0x49ab38=_0x49ab38||0x1f4;return function(_0x5bdc75){logger[_0xe790('0x28')](_0x5bdc75['stack']);if(_0x5bdc75[_0xe790('0x37')]){delete _0x5bdc75[_0xe790('0x37')];}_0x1e2bee['status'](_0x49ab38)['send'](_0x5bdc75);};}exports['index']=function(_0x4745a2,_0x24f465){var _0xc3f068={},_0x566ab2={},_0x4f8f9c={'count':0x0,'rows':[]};var _0x2a4fda=_['map'](db[_0xe790('0x38')][_0xe790('0x39')],function(_0x1318e1){return{'name':_0x1318e1[_0xe790('0x3a')],'type':_0x1318e1[_0xe790('0x3b')][_0xe790('0x3c')]};});_0x566ab2[_0xe790('0x3d')]=_[_0xe790('0x3e')](_0x2a4fda,_0xe790('0x37'));_0x566ab2['query']=_[_0xe790('0x3f')](_0x4745a2['query']);_0x566ab2[_0xe790('0x40')]=_[_0xe790('0x41')](_0x566ab2[_0xe790('0x3d')],_0x566ab2['query']);_0xc3f068[_0xe790('0x42')]=_[_0xe790('0x41')](_0x566ab2[_0xe790('0x3d')],qs[_0xe790('0x43')](_0x4745a2[_0xe790('0x44')]['fields']));_0xc3f068[_0xe790('0x42')]=_0xc3f068[_0xe790('0x42')][_0xe790('0x45')]?_0xc3f068[_0xe790('0x42')]:_0x566ab2[_0xe790('0x3d')];if(!_0x4745a2['query'][_0xe790('0x46')](_0xe790('0x47'))){_0xc3f068[_0xe790('0x31')]=qs[_0xe790('0x31')](_0x4745a2[_0xe790('0x44')][_0xe790('0x31')]);_0xc3f068[_0xe790('0x30')]=qs[_0xe790('0x30')](_0x4745a2[_0xe790('0x44')][_0xe790('0x30')]);}_0xc3f068['order']=qs['sort'](_0x4745a2[_0xe790('0x44')][_0xe790('0x48')]);_0xc3f068[_0xe790('0x49')]=qs[_0xe790('0x40')](_['pick'](_0x4745a2[_0xe790('0x44')],_0x566ab2[_0xe790('0x40')]),_0x2a4fda);if(_0x4745a2['query']['filter']){_0xc3f068[_0xe790('0x49')]=_[_0xe790('0x4a')](_0xc3f068['where'],{'$or':_[_0xe790('0x3e')](_0x2a4fda,function(_0x352321){if(_0x352321[_0xe790('0x3b')]!==_0xe790('0x4b')){var _0x1b5d1a={};_0x1b5d1a[_0x352321[_0xe790('0x37')]]={'$like':'%'+_0x4745a2[_0xe790('0x44')][_0xe790('0x4c')]+'%'};return _0x1b5d1a;}})});}_0xc3f068=_[_0xe790('0x4a')]({},_0xc3f068,_0x4745a2['options']);var _0x2a9b77={'where':_0xc3f068[_0xe790('0x49')]};return db[_0xe790('0x38')][_0xe790('0x2f')](_0x2a9b77)[_0xe790('0x21')](function(_0x44d144){_0x4f8f9c['count']=_0x44d144;if(_0x4745a2[_0xe790('0x44')][_0xe790('0x4d')]){_0xc3f068['include']=[{'all':!![]}];}return db[_0xe790('0x38')][_0xe790('0x4e')](_0xc3f068);})['then'](function(_0x2866a6){_0x4f8f9c[_0xe790('0x4f')]=_0x2866a6;return _0x4f8f9c;})[_0xe790('0x21')](respondWithFilteredResult(_0x24f465,_0xc3f068))[_0xe790('0x2c')](handleError(_0x24f465,null));};exports[_0xe790('0x50')]=function(_0x2a39a0,_0x154a2a){var _0x25f711={'raw':!![],'where':{'id':_0x2a39a0['params']['id']}},_0x1c28a9={};_0x1c28a9[_0xe790('0x3d')]=_['keys'](db[_0xe790('0x38')]['rawAttributes']);_0x1c28a9[_0xe790('0x44')]=_[_0xe790('0x3f')](_0x2a39a0[_0xe790('0x44')]);_0x1c28a9[_0xe790('0x40')]=_[_0xe790('0x41')](_0x1c28a9[_0xe790('0x3d')],_0x1c28a9[_0xe790('0x44')]);_0x25f711[_0xe790('0x42')]=_[_0xe790('0x41')](_0x1c28a9['model'],qs[_0xe790('0x43')](_0x2a39a0['query']['fields']));_0x25f711['attributes']=_0x25f711[_0xe790('0x42')]['length']?_0x25f711[_0xe790('0x42')]:_0x1c28a9[_0xe790('0x3d')];if(_0x2a39a0[_0xe790('0x44')][_0xe790('0x4d')]){_0x25f711['include']=[{'all':!![]}];}_0x25f711=_['merge']({},_0x25f711,_0x2a39a0[_0xe790('0x51')]);return db[_0xe790('0x38')]['find'](_0x25f711)[_0xe790('0x21')](handleEntityNotFound(_0x154a2a,null))[_0xe790('0x21')](respondWithResult(_0x154a2a,null))['catch'](handleError(_0x154a2a,null));};exports[_0xe790('0x52')]=function(_0x1f60f4,_0x1370fb){return db[_0xe790('0x38')]['create'](_0x1f60f4[_0xe790('0x53')],{})['then'](respondWithResult(_0x1370fb,0xc9))[_0xe790('0x2c')](handleError(_0x1370fb,null));};exports['update']=function(_0x1f9d40,_0x5e4c7f){if(_0x1f9d40[_0xe790('0x53')]['id']){delete _0x1f9d40[_0xe790('0x53')]['id'];}return db[_0xe790('0x38')][_0xe790('0x54')]({'where':{'id':_0x1f9d40[_0xe790('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e4c7f,null))[_0xe790('0x21')](saveUpdates(_0x1f9d40['body'],null))['then'](respondWithResult(_0x5e4c7f,null))['catch'](handleError(_0x5e4c7f,null));};exports['destroy']=function(_0x1ff80f,_0x77a233){return db[_0xe790('0x38')][_0xe790('0x54')]({'where':{'id':_0x1ff80f[_0xe790('0x55')]['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x77a233,null))[_0xe790('0x21')](removeEntity(_0x77a233,null))[_0xe790('0x2c')](handleError(_0x77a233,null));};exports['describe']=function(_0x2d88cf,_0x492e1f){return db[_0xe790('0x38')][_0xe790('0x56')]()[_0xe790('0x21')](respondWithResult(_0x492e1f,null))['catch'](handleError(_0x492e1f,null));};exports[_0xe790('0x57')]=function(_0x2268f1,_0x143c0a,_0x299d47){return db[_0xe790('0x58')]['count']({'where':{'ChatGroupId':_0x2268f1[_0xe790('0x55')]['id'],'ToId':_0x2268f1[_0xe790('0x59')]['id'],'read':![]}})[_0xe790('0x21')](function(_0x4a1e56){return{'id':_[_0xe790('0x5a')](_0x2268f1[_0xe790('0x55')]['id']),'count':_0x4a1e56};})[_0xe790('0x21')](respondWithResult(_0x143c0a,null))[_0xe790('0x2c')](handleError(_0x143c0a,null));};exports[_0xe790('0x5b')]=function(_0x536859,_0x5eb890,_0x52fbaa){return db[_0xe790('0x38')]['find']({'where':{'id':_0x536859['params']['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x5eb890,null))[_0xe790('0x21')](function(_0x3ba2a5){if(_0x3ba2a5){return _0x3ba2a5[_0xe790('0x5b')](_0x536859[_0xe790('0x53')][_0xe790('0x5c')],_[_0xe790('0x5d')](_0x536859[_0xe790('0x53')],[_0xe790('0x5c'),'id'])||{});}})[_0xe790('0x21')](respondWithResult(_0x5eb890,null))[_0xe790('0x2c')](handleError(_0x5eb890,null));};exports[_0xe790('0x5e')]=function(_0x2dd826,_0x52f734,_0x1a5ca2){var _0x33dea1={};var _0x8ddf61={};var _0x73732a;var _0x143d5f;return db[_0xe790('0x38')]['findOne']({'where':{'id':_0x2dd826[_0xe790('0x55')]['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x52f734,null))[_0xe790('0x21')](function(_0x33f9a9){if(_0x33f9a9){_0x73732a=_0x33f9a9;_0x8ddf61['model']=_[_0xe790('0x3f')](db[_0xe790('0x5f')][_0xe790('0x39')]);_0x8ddf61[_0xe790('0x44')]=_[_0xe790('0x3f')](_0x2dd826[_0xe790('0x44')]);_0x8ddf61[_0xe790('0x40')]=_[_0xe790('0x41')](_0x8ddf61[_0xe790('0x3d')],_0x8ddf61[_0xe790('0x44')]);_0x33dea1['attributes']=_[_0xe790('0x41')](_0x8ddf61[_0xe790('0x3d')],qs[_0xe790('0x43')](_0x2dd826[_0xe790('0x44')][_0xe790('0x43')]));_0x33dea1[_0xe790('0x42')]=_0x33dea1['attributes'][_0xe790('0x45')]?_0x33dea1[_0xe790('0x42')]:_0x8ddf61['model'];_0x33dea1[_0xe790('0x60')]=qs[_0xe790('0x48')](_0x2dd826[_0xe790('0x44')][_0xe790('0x48')]);_0x33dea1[_0xe790('0x49')]=qs[_0xe790('0x40')](_[_0xe790('0x61')](_0x2dd826[_0xe790('0x44')],_0x8ddf61['filters']));if(_0x2dd826['query'][_0xe790('0x4c')]){_0x33dea1['where']=_['merge'](_0x33dea1['where'],{'$or':_[_0xe790('0x3e')](_0x33dea1[_0xe790('0x42')],function(_0x4af886){var _0x9c024f={};_0x9c024f[_0x4af886]={'$like':'%'+_0x2dd826[_0xe790('0x44')][_0xe790('0x4c')]+'%'};return _0x9c024f;})});}_0x33dea1=_[_0xe790('0x4a')]({},_0x33dea1,_0x2dd826[_0xe790('0x51')]);return _0x73732a[_0xe790('0x5e')](_0x33dea1);}})['then'](function(_0x2ed642){if(_0x2ed642){_0x143d5f=_0x2ed642[_0xe790('0x45')];if(!_0x2dd826[_0xe790('0x44')][_0xe790('0x46')](_0xe790('0x47'))){_0x33dea1[_0xe790('0x31')]=qs[_0xe790('0x31')](_0x2dd826[_0xe790('0x44')][_0xe790('0x31')]);_0x33dea1['offset']=qs[_0xe790('0x30')](_0x2dd826[_0xe790('0x44')][_0xe790('0x30')]);}return _0x73732a[_0xe790('0x5e')](_0x33dea1);}})['then'](function(_0x1c78dc){if(_0x1c78dc){return _0x1c78dc?{'count':_0x143d5f,'rows':_0x1c78dc}:null;}})[_0xe790('0x21')](respondWithResult(_0x52f734,null))[_0xe790('0x2c')](handleError(_0x52f734,null));};exports['removeMembers']=function(_0x3f8c88,_0x1b9710,_0x3c0217){return db[_0xe790('0x38')][_0xe790('0x54')]({'where':{'id':_0x3f8c88[_0xe790('0x55')]['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x1b9710,null))[_0xe790('0x21')](function(_0x3ff20e){if(_0x3ff20e){return _0x3ff20e['removeMembers'](_0x3f8c88[_0xe790('0x44')]['ids']);}})[_0xe790('0x21')](respondWithStatusCode(_0x1b9710,null))[_0xe790('0x2c')](handleError(_0x1b9710,null));};exports[_0xe790('0x62')]=function(_0x307ca2,_0x52819a,_0x4cb9a2){if(_0x307ca2['body']['id']){delete _0x307ca2['body']['id'];}return db['ChatGroup'][_0xe790('0x54')]({'where':{'id':_0x307ca2[_0xe790('0x55')]['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x52819a,null))[_0xe790('0x21')](function(_0x496cb9){if(_0x496cb9){_0x307ca2[_0xe790('0x53')]['ChatGroupId']=_0x496cb9['id'];return db['ChatInternalMessage'][_0xe790('0x52')](_0x307ca2['body']);}})[_0xe790('0x21')](respondWithResult(_0x52819a,null))['catch'](handleError(_0x52819a,null));};exports[_0xe790('0x63')]=function(_0x5ddb85,_0x547dc7,_0x3667e4){var _0x562dcd={};var _0x1357ad={};var _0x7d06af;var _0xe8ec52;return db[_0xe790('0x38')]['findOne']({'where':{'id':_0x5ddb85['params']['id']}})[_0xe790('0x21')](handleEntityNotFound(_0x547dc7,null))[_0xe790('0x21')](function(_0x4a8118){if(_0x4a8118){_0x7d06af=_0x4a8118;_0x1357ad[_0xe790('0x3d')]=_[_0xe790('0x3f')](db['ChatInternalMessage'][_0xe790('0x39')]);_0x1357ad[_0xe790('0x44')]=_[_0xe790('0x3f')](_0x5ddb85['query']);_0x1357ad[_0xe790('0x40')]=_[_0xe790('0x41')](_0x1357ad[_0xe790('0x3d')],_0x1357ad['query']);_0x562dcd[_0xe790('0x42')]=_[_0xe790('0x41')](_0x1357ad[_0xe790('0x3d')],qs[_0xe790('0x43')](_0x5ddb85['query'][_0xe790('0x43')]));_0x562dcd['attributes']=_0x562dcd[_0xe790('0x42')]['length']?_0x562dcd['attributes']:_0x1357ad[_0xe790('0x3d')];_0x562dcd[_0xe790('0x60')]=qs[_0xe790('0x48')](_0x5ddb85[_0xe790('0x44')][_0xe790('0x48')]);_0x562dcd[_0xe790('0x49')]=qs[_0xe790('0x40')](_[_0xe790('0x61')](_0x5ddb85[_0xe790('0x44')],_0x1357ad['filters']));if(_0x5ddb85[_0xe790('0x44')][_0xe790('0x4c')]){_0x562dcd[_0xe790('0x49')]=_['merge'](_0x562dcd[_0xe790('0x49')],{'$or':_[_0xe790('0x3e')](_0x562dcd[_0xe790('0x42')],function(_0x14a966){var _0x586981={};_0x586981[_0x14a966]={'$like':'%'+_0x5ddb85['query'][_0xe790('0x4c')]+'%'};return _0x586981;})});}if(_0x5ddb85[_0xe790('0x44')][_0xe790('0x64')]){var _0x520290=_0x5ddb85[_0xe790('0x44')]['$gte'][_0xe790('0x65')](',');var _0x3f3f15={};_0x3f3f15[_0x520290[0x0]]={'$gte':moment(_0x520290[0x1])[_0xe790('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0x562dcd[_0xe790('0x49')]=_[_0xe790('0x4a')](_0x562dcd['where'],_0x3f3f15);}_0x562dcd=_[_0xe790('0x4a')]({},_0x562dcd,_0x5ddb85['options']);return _0x7d06af[_0xe790('0x63')](_0x562dcd);}})[_0xe790('0x21')](function(_0x83e312){if(_0x83e312){_0xe8ec52=_0x83e312[_0xe790('0x45')];if(!_0x5ddb85['query'][_0xe790('0x46')](_0xe790('0x47'))){_0x562dcd[_0xe790('0x31')]=qs[_0xe790('0x31')](_0x5ddb85[_0xe790('0x44')][_0xe790('0x31')]);_0x562dcd[_0xe790('0x30')]=qs['offset'](_0x5ddb85['query'][_0xe790('0x30')]);}return _0x7d06af[_0xe790('0x63')](_0x562dcd);}})[_0xe790('0x21')](function(_0x1baaf6){if(_0x1baaf6){return _0x1baaf6?{'count':_0xe8ec52,'rows':_0x1baaf6}:null;}})[_0xe790('0x21')](respondWithResult(_0x547dc7,null))[_0xe790('0x2c')](handleError(_0x547dc7,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d2494d1..39dfb46 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x2032,0xd9));var _0x2203=function(_0x335e37,_0x45d8c8){_0x335e37=_0x335e37-0x0;var _0x35928f=_0x2032[_0x335e37];return _0x35928f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x583b0a,_0x50c50a){var _0x391d1d=function(_0x1a21ee){while(--_0x1a21ee){_0x583b0a['push'](_0x583b0a['shift']());}};_0x391d1d(++_0x50c50a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52c28a,_0x34f655){_0x52c28a=_0x52c28a-0x0;var _0x569a8f=_0x5f2f[_0x52c28a];return _0x569a8f;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f882ffb..686e9f1 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 _0xf072=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','request-promise'];(function(_0x360bf7,_0x391f1a){var _0x440184=function(_0x3d1e7d){while(--_0x3d1e7d){_0x360bf7['push'](_0x360bf7['shift']());}};_0x440184(++_0x391f1a);}(_0xf072,0x1cf));var _0x2f07=function(_0x49d82a,_0x37a629){_0x49d82a=_0x49d82a-0x0;var _0x52a3bc=_0xf072[_0x49d82a];return _0x52a3bc;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x51f593,_0x38d2ec){var _0x4ccfbf=function(_0x4267c8){while(--_0x4267c8){_0x51f593['push'](_0x51f593['shift']());}};_0x4ccfbf(++_0x38d2ec);}(_0x44e8,0xd7));var _0x844e=function(_0x3a7a24,_0x1e5dc7){_0x3a7a24=_0x3a7a24-0x0;var _0x45267f=_0x44e8[_0x3a7a24];return _0x45267f;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3b13973..3f7d77e 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 _0x70f7=['moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','util'];(function(_0x41dd01,_0x3287fe){var _0x1b2a58=function(_0x399d16){while(--_0x399d16){_0x41dd01['push'](_0x41dd01['shift']());}};_0x1b2a58(++_0x3287fe);}(_0x70f7,0xf9));var _0x770f=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0x70f7[_0x9faff7];return _0x4f8043;};'use strict';var _=require('lodash');var util=require(_0x770f('0x0'));var moment=require(_0x770f('0x1'));var BPromise=require('bluebird');var rs=require(_0x770f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x770f('0x3'));var logger=require(_0x770f('0x4'))('rpc');var config=require(_0x770f('0x5'));var jayson=require(_0x770f('0x6'));var client=jayson['client'][_0x770f('0x7')]({'port':0x232a});config['redis']=_[_0x770f('0x8')](config[_0x770f('0x9')],{'host':_0x770f('0xa'),'port':0x18eb});var socket=require(_0x770f('0xb'))(new Redis(config['redis']));require(_0x770f('0xc'))[_0x770f('0xd')](socket);function respondWithRpcPromise(_0x4d9a38,_0xa4ab0f,_0x27f74c){return new BPromise(function(_0x2b4c29,_0x50ad45){return client['request'](_0x4d9a38,_0x27f74c)[_0x770f('0xe')](function(_0x2c4a4b){logger[_0x770f('0xf')]('ChatGroup,\x20%s,\x20%s',_0xa4ab0f,_0x770f('0x10'));logger[_0x770f('0x11')](_0x770f('0x12'),_0xa4ab0f,_0x770f('0x10'),JSON[_0x770f('0x13')](_0x2c4a4b));if(_0x2c4a4b[_0x770f('0x14')]){if(_0x2c4a4b[_0x770f('0x14')]['code']===0x1f4){logger[_0x770f('0x14')](_0x770f('0x15'),_0xa4ab0f,_0x2c4a4b[_0x770f('0x14')][_0x770f('0x16')]);return _0x50ad45(_0x2c4a4b['error'][_0x770f('0x16')]);}logger[_0x770f('0x14')](_0x770f('0x15'),_0xa4ab0f,_0x2c4a4b[_0x770f('0x14')]['message']);return _0x2b4c29(_0x2c4a4b[_0x770f('0x14')][_0x770f('0x16')]);}else{logger['info'](_0x770f('0x15'),_0xa4ab0f,_0x770f('0x10'));_0x2b4c29(_0x2c4a4b[_0x770f('0x17')][_0x770f('0x16')]);}})[_0x770f('0x18')](function(_0x4372f6){logger[_0x770f('0x14')]('ChatGroup,\x20%s,\x20%s',_0xa4ab0f,_0x4372f6);_0x50ad45(_0x4372f6);});});} \ No newline at end of file +var _0x6ee7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','../../mysqldb'];(function(_0x1d78a5,_0x1aa77e){var _0x38bb9f=function(_0x5a55bf){while(--_0x5a55bf){_0x1d78a5['push'](_0x1d78a5['shift']());}};_0x38bb9f(++_0x1aa77e);}(_0x6ee7,0xc5));var _0x76ee=function(_0x1ab4a9,_0x548ac7){_0x1ab4a9=_0x1ab4a9-0x0;var _0x3870a2=_0x6ee7[_0x1ab4a9];return _0x3870a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x76ee('0x0'));var BPromise=require(_0x76ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76ee('0x2'))['db'];var utils=require(_0x76ee('0x3'));var logger=require(_0x76ee('0x4'))(_0x76ee('0x5'));var config=require(_0x76ee('0x6'));var jayson=require(_0x76ee('0x7'));var client=jayson[_0x76ee('0x8')][_0x76ee('0x9')]({'port':0x232a});config['redis']=_[_0x76ee('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x76ee('0xb'))(new Redis(config['redis']));require(_0x76ee('0xc'))[_0x76ee('0xd')](socket);function respondWithRpcPromise(_0x44f5ea,_0x44dd53,_0x2f22b6){return new BPromise(function(_0x3a364c,_0x27b55e){return client[_0x76ee('0xe')](_0x44f5ea,_0x2f22b6)[_0x76ee('0xf')](function(_0x32a5f6){logger[_0x76ee('0x10')](_0x76ee('0x11'),_0x44dd53,'request\x20sent');logger['debug'](_0x76ee('0x12'),_0x44dd53,_0x76ee('0x13'),JSON[_0x76ee('0x14')](_0x32a5f6));if(_0x32a5f6[_0x76ee('0x15')]){if(_0x32a5f6[_0x76ee('0x15')][_0x76ee('0x16')]===0x1f4){logger['error'](_0x76ee('0x11'),_0x44dd53,_0x32a5f6[_0x76ee('0x15')][_0x76ee('0x17')]);return _0x27b55e(_0x32a5f6['error'][_0x76ee('0x17')]);}logger[_0x76ee('0x15')](_0x76ee('0x11'),_0x44dd53,_0x32a5f6[_0x76ee('0x15')][_0x76ee('0x17')]);return _0x3a364c(_0x32a5f6[_0x76ee('0x15')][_0x76ee('0x17')]);}else{logger[_0x76ee('0x10')](_0x76ee('0x11'),_0x44dd53,_0x76ee('0x13'));_0x3a364c(_0x32a5f6['result'][_0x76ee('0x17')]);}})[_0x76ee('0x18')](function(_0x666603){logger[_0x76ee('0x15')](_0x76ee('0x11'),_0x44dd53,_0x666603);_0x27b55e(_0x666603);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2af2dcd..5408471 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 _0x2ab9=['emit','removeListener','chatGroup:','remove','update'];(function(_0x46c3c1,_0x23055a){var _0x565266=function(_0x289437){while(--_0x289437){_0x46c3c1['push'](_0x46c3c1['shift']());}};_0x565266(++_0x23055a);}(_0x2ab9,0x9e));var _0x92ab=function(_0x5b61e4,_0x543932){_0x5b61e4=_0x5b61e4-0x0;var _0x577057=_0x2ab9[_0x5b61e4];return _0x577057;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x92ab('0x0'),_0x92ab('0x1')];function createListener(_0xd34cb2,_0x29df8d){return function(_0x4ec46e){_0x29df8d[_0x92ab('0x2')](_0xd34cb2,_0x4ec46e);};}function removeListener(_0x1f7fcc,_0x148011){return function(){ChatGroupEvents[_0x92ab('0x3')](_0x1f7fcc,_0x148011);};}exports['register']=function(_0x3fc313){for(var _0x501c26=0x0,_0x161004=events['length'];_0x501c26<_0x161004;_0x501c26++){var _0x1467d4=events[_0x501c26];var _0x3efabb=createListener(_0x92ab('0x4')+_0x1467d4,_0x3fc313);ChatGroupEvents['on'](_0x1467d4,_0x3efabb);}}; \ No newline at end of file +var _0xe301=['emit','removeListener','register','length','./chatGroup.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe301,0x1d2));var _0x1e30=function(_0x1547e7,_0x2cb2ec){_0x1547e7=_0x1547e7-0x0;var _0x5ebcd1=_0xe301[_0x1547e7];return _0x5ebcd1;};'use strict';var ChatGroupEvents=require(_0x1e30('0x0'));var events=[_0x1e30('0x1'),_0x1e30('0x2'),'update'];function createListener(_0x103bb1,_0x3e0756){return function(_0x27f35f){_0x3e0756[_0x1e30('0x3')](_0x103bb1,_0x27f35f);};}function removeListener(_0x402746,_0x2a95af){return function(){ChatGroupEvents[_0x1e30('0x4')](_0x402746,_0x2a95af);};}exports[_0x1e30('0x5')]=function(_0x17635a){for(var _0x2d3d62=0x0,_0x4edd0a=events[_0x1e30('0x6')];_0x2d3d62<_0x4edd0a;_0x2d3d62++){var _0x14a84f=events[_0x2d3d62];var _0x5b21bf=createListener('chatGroup:'+_0x14a84f,_0x17635a);ChatGroupEvents['on'](_0x14a84f,_0x5b21bf);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f5e7960..4c8b410 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 _0x4deb=['util','path','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','update','/:id','destroy','delete','removeMembers','exports'];(function(_0x311475,_0x13732e){var _0x48659b=function(_0xa8198d){while(--_0xa8198d){_0x311475['push'](_0x311475['shift']());}};_0x48659b(++_0x13732e);}(_0x4deb,0x1e0));var _0xb4de=function(_0x35c561,_0x1ade37){_0x35c561=_0x35c561-0x0;var _0x3c3f89=_0x4deb[_0x35c561];return _0x3c3f89;};'use strict';var multer=require('multer');var util=require(_0xb4de('0x0'));var path=require(_0xb4de('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb4de('0x2'));var config=require(_0xb4de('0x3'));var controller=require(_0xb4de('0x4'));router[_0xb4de('0x5')]('/',auth[_0xb4de('0x6')](),controller[_0xb4de('0x7')]);router[_0xb4de('0x5')](_0xb4de('0x8'),auth[_0xb4de('0x6')](),controller['describe']);router['get']('/:id',auth[_0xb4de('0x6')](),controller['show']);router[_0xb4de('0x5')](_0xb4de('0x9'),auth['isAuthenticated'](),controller[_0xb4de('0xa')]);router[_0xb4de('0x5')](_0xb4de('0xb'),auth[_0xb4de('0x6')](),controller[_0xb4de('0xc')]);router[_0xb4de('0x5')](_0xb4de('0xd'),auth[_0xb4de('0x6')](),controller['getMessages']);router[_0xb4de('0xe')]('/',auth[_0xb4de('0x6')](),controller[_0xb4de('0xf')]);router[_0xb4de('0xe')](_0xb4de('0xb'),auth['isAuthenticated'](),controller[_0xb4de('0x10')]);router[_0xb4de('0xe')](_0xb4de('0xd'),auth[_0xb4de('0x6')](),controller['addMessage']);router[_0xb4de('0x11')]('/:id',auth[_0xb4de('0x6')](),controller[_0xb4de('0x12')]);router['delete'](_0xb4de('0x13'),auth[_0xb4de('0x6')](),controller[_0xb4de('0x14')]);router[_0xb4de('0x15')]('/:id/members',auth['isAuthenticated'](),controller[_0xb4de('0x16')]);module[_0xb4de('0x17')]=router; \ No newline at end of file +var _0x9647=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','create','post','addMembers','addMessage'];(function(_0xeb483e,_0x39d5f6){var _0x57bf23=function(_0x1f97f7){while(--_0x1f97f7){_0xeb483e['push'](_0xeb483e['shift']());}};_0x57bf23(++_0x39d5f6);}(_0x9647,0x107));var _0x7964=function(_0x1a4f26,_0x15fc9c){_0x1a4f26=_0x1a4f26-0x0;var _0x42f75e=_0x9647[_0x1a4f26];return _0x42f75e;};'use strict';var multer=require(_0x7964('0x0'));var util=require(_0x7964('0x1'));var path=require(_0x7964('0x2'));var timeout=require(_0x7964('0x3'));var express=require('express');var router=express[_0x7964('0x4')]();var auth=require(_0x7964('0x5'));var interaction=require(_0x7964('0x6'));var config=require(_0x7964('0x7'));var controller=require(_0x7964('0x8'));router[_0x7964('0x9')]('/',auth[_0x7964('0xa')](),controller[_0x7964('0xb')]);router[_0x7964('0x9')](_0x7964('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7964('0x9')](_0x7964('0xd'),auth[_0x7964('0xa')](),controller[_0x7964('0xe')]);router[_0x7964('0x9')](_0x7964('0xf'),auth[_0x7964('0xa')](),controller['getUnread']);router[_0x7964('0x9')](_0x7964('0x10'),auth['isAuthenticated'](),controller[_0x7964('0x11')]);router[_0x7964('0x9')](_0x7964('0x12'),auth[_0x7964('0xa')](),controller['getMessages']);router['post']('/',auth[_0x7964('0xa')](),controller[_0x7964('0x13')]);router[_0x7964('0x14')](_0x7964('0x10'),auth[_0x7964('0xa')](),controller[_0x7964('0x15')]);router['post'](_0x7964('0x12'),auth[_0x7964('0xa')](),controller[_0x7964('0x16')]);router['put'](_0x7964('0xd'),auth[_0x7964('0xa')](),controller[_0x7964('0x17')]);router[_0x7964('0x18')](_0x7964('0xd'),auth[_0x7964('0xa')](),controller[_0x7964('0x19')]);router[_0x7964('0x18')](_0x7964('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1b7ba95..59dbf25 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 _0x46df=['STRING','long','DATE','out','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0x46df,0x143));var _0xf46d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x46df[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xf46d('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf46d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf46d('0x2')]},'ratingType':{'type':Sequelize[_0xf46d('0x3')](_0xf46d('0x4'),_0xf46d('0x5')),'defaultValue':_0xf46d('0x4')},'ratingMessage':{'type':Sequelize[_0xf46d('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xf46d('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf46d('0x7')]},'note':{'type':Sequelize[_0xf46d('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xf46d('0x7')]},'osName':{'type':Sequelize[_0xf46d('0x7')]},'osVersion':{'type':Sequelize[_0xf46d('0x7')]},'deviceModel':{'type':Sequelize[_0xf46d('0x7')]},'deviceVendor':{'type':Sequelize[_0xf46d('0x7')]},'deviceType':{'type':Sequelize[_0xf46d('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf46d('0x7')]},'formData':{'type':Sequelize[_0xf46d('0x6')](_0xf46d('0x8'))},'read1stAt':{'type':Sequelize[_0xf46d('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf46d('0x3')]('in',_0xf46d('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf46d('0x7')]},'customerPort':{'type':Sequelize[_0xf46d('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xba89=['STRING','long','INTEGER','ENUM','thumb','star','TEXT','DATE'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xba89,0xba));var _0x9ba8=function(_0x2b4c83,_0x29eee3){_0x2b4c83=_0x2b4c83-0x0;var _0x2a8c16=_0xba89[_0x2b4c83];return _0x2a8c16;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9ba8('0x0')]},'ratingType':{'type':Sequelize[_0x9ba8('0x1')]('star',_0x9ba8('0x2')),'defaultValue':_0x9ba8('0x3')},'ratingMessage':{'type':Sequelize[_0x9ba8('0x4')]},'pathTranscript':{'type':Sequelize[_0x9ba8('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9ba8('0x5')]},'disposition':{'type':Sequelize[_0x9ba8('0x6')]},'note':{'type':Sequelize[_0x9ba8('0x6')]},'browserName':{'type':Sequelize[_0x9ba8('0x6')]},'browserVersion':{'type':Sequelize[_0x9ba8('0x6')]},'osName':{'type':Sequelize[_0x9ba8('0x6')]},'osVersion':{'type':Sequelize[_0x9ba8('0x6')]},'deviceModel':{'type':Sequelize[_0x9ba8('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9ba8('0x6')]},'referer':{'type':Sequelize[_0x9ba8('0x4')]},'customerIp':{'type':Sequelize[_0x9ba8('0x6')]},'formData':{'type':Sequelize[_0x9ba8('0x4')](_0x9ba8('0x7'))},'read1stAt':{'type':Sequelize[_0x9ba8('0x5')]},'lastMsgAt':{'type':Sequelize[_0x9ba8('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x9ba8('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x9ba8('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 33db226..9738a29 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 _0x77d4=['ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','Users','map','Tags','TagIds','split','forEach','push','catch','ChatInteraction','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','buildExpression','some','compact','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`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)','getFullTextValue','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','params','rawAttributes','includeAll','include','merge','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','POST','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','filename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','close','server/files/chat/upload/','format','now','ChatMessage','Messages','User','CmContact','%s%d','agentAlias','System','customer','agentIdentifier','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','addTags','setTags','spread','Tag','emit','removeTags','server','files','tmp','attachments','Contact','firstName','lastName','Owner','get','mkdirSync','10px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','Account','disposition','browserName','osName','referer','N.A.','tail','existsSync','basename','renderFile','downloadInteraction.html','toFile','transcript-','download','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','test','Sequelize','ValidationError','request'];(function(_0x48ae28,_0x99af92){var _0x2a8fd5=function(_0x3e03c9){while(--_0x3e03c9){_0x48ae28['push'](_0x48ae28['shift']());}};_0x2a8fd5(++_0x99af92);}(_0x77d4,0x108));var _0x477d=function(_0x226494,_0xc4b645){_0x226494=_0x226494-0x0;var _0x27b950=_0x77d4[_0x226494];return _0x27b950;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x477d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x477d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x477d('0x2'));var moment=require(_0x477d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x477d('0x4'));var path=require(_0x477d('0x5'));var sox=require(_0x477d('0x6'));var csv=require(_0x477d('0x7'));var ejs=require(_0x477d('0x8'));var fs=require('fs');var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var db=require(_0x477d('0x13'))['db'];config[_0x477d('0x14')]=_['defaults'](config['redis'],{'host':_0x477d('0x15'),'port':0x18eb});var socket=require(_0x477d('0x16'))(new Redis(config['redis']));require(_0x477d('0x17'))[_0x477d('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x477d('0x19')]({'port':0x232b});var client9004=jayson['client'][_0x477d('0x19')]({'port':0x232c});function checkPasswordPattern(_0x234b99,_0x25fc02,_0x5985b5){if(_0x5985b5){var _0x116aa7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x116aa7[_0x477d('0x1a')](_0x25fc02)){return _0x234b99;}else{throw new db[(_0x477d('0x1b'))][(_0x477d('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 _0x234b99;}}function respondWithRpcPromise(_0x28f17a,_0x5d5553,_0x367965,_0x1399d7){return new BPromise(function(_0x159beb,_0x458489){var _0x37bcb3=_0x1399d7||client;return _0x37bcb3[_0x477d('0x1d')](_0x28f17a,_0x367965)['then'](function(_0x33db7a){logger['info'](_0x477d('0x1e'),_0x5d5553,_0x477d('0x1f'));logger[_0x477d('0x20')](_0x477d('0x21'),_0x5d5553,_0x477d('0x1f'),JSON[_0x477d('0x22')](_0x33db7a));if(_0x33db7a[_0x477d('0x23')]){if(_0x33db7a[_0x477d('0x23')][_0x477d('0x24')]===0x1f4){logger[_0x477d('0x23')](_0x477d('0x1e'),_0x5d5553,_0x33db7a[_0x477d('0x23')][_0x477d('0x25')]);return _0x458489(_0x33db7a[_0x477d('0x23')]['message']);}logger[_0x477d('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x5d5553,_0x33db7a[_0x477d('0x23')][_0x477d('0x25')]);return _0x159beb(_0x33db7a[_0x477d('0x23')][_0x477d('0x25')]);}else{logger['info'](_0x477d('0x1e'),_0x5d5553,_0x477d('0x1f'));_0x159beb(_0x33db7a[_0x477d('0x26')]['message']);}})['catch'](function(_0x198697){logger[_0x477d('0x23')](_0x477d('0x1e'),_0x5d5553,_0x198697);_0x458489(_0x198697);});});}function respondWithStatusCode(_0x5c8ef1,_0x254141){_0x254141=_0x254141||0xcc;return function(_0x297d15){if(_0x297d15){return _0x5c8ef1[_0x477d('0x27')](_0x254141);}return _0x5c8ef1[_0x477d('0x28')](_0x254141)[_0x477d('0x29')]();};}function respondWithResult(_0x537fc4,_0x2fc959){_0x2fc959=_0x2fc959||0xc8;return function(_0xeb02f5){if(_0xeb02f5){return _0x537fc4[_0x477d('0x28')](_0x2fc959)[_0x477d('0x2a')](_0xeb02f5);}};}function respondWithFilteredResult(_0x32c5d7,_0x385eb4){return function(_0x180046){if(_0x180046){var _0x98b5d9=_0x180046[_0x477d('0x2b')],_0x204541=_0x385eb4[_0x477d('0x2c')],_0x8fe6c4=_0x385eb4[_0x477d('0x2c')]+_0x385eb4[_0x477d('0x2d')],_0x41b790;if(_0x8fe6c4>=_0x98b5d9){_0x8fe6c4=_0x98b5d9;_0x41b790=0xc8;}else{_0x41b790=0xce;}_0x32c5d7[_0x477d('0x28')](_0x41b790);return _0x32c5d7[_0x477d('0x2e')](_0x477d('0x2f'),_0x204541+'-'+_0x8fe6c4+'/'+_0x98b5d9)[_0x477d('0x2a')](_0x180046);}return null;};}function patchUpdates(_0x266dbf){return function(_0x49851b){try{jsonpatch[_0x477d('0x30')](_0x49851b,_0x266dbf,!![]);}catch(_0x598e46){return BPromise[_0x477d('0x31')](_0x598e46);}return _0x49851b[_0x477d('0x32')]();};}function saveUpdates(_0x1a9610,_0x582021){return function(_0x117c97){if(_0x117c97){return _0x117c97[_0x477d('0x33')](_0x1a9610)[_0x477d('0x34')](function(_0x3d34e4){return _0x3d34e4;});}return null;};}function removeEntity(_0x249b82,_0x463fca){return function(_0xca8bf){if(_0xca8bf){return _0xca8bf[_0x477d('0x35')]()[_0x477d('0x34')](function(){_0x249b82[_0x477d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36a247,_0x17e2c4){return function(_0xb41cd8){if(!_0xb41cd8){_0x36a247['sendStatus'](0x194);}return _0xb41cd8;};}function handleError(_0x50b3f7,_0x2daf87){_0x2daf87=_0x2daf87||0x1f4;return function(_0x1b0410){logger['error'](_0x1b0410['stack']);if(_0x1b0410[_0x477d('0x36')]){delete _0x1b0410[_0x477d('0x36')];}_0x50b3f7[_0x477d('0x28')](_0x2daf87)[_0x477d('0x37')](_0x1b0410);};}function getInteractionUsers(_0x1c0d86,_0x5aa352){return new BPromise(function(_0x304055,_0x59ad77){try{if(_0x5aa352[_0x1c0d86['id']]){_0x1c0d86[_0x477d('0x38')]=_[_0x477d('0x39')](_0x5aa352[_0x1c0d86['id']],function(_0x356f41){return{'id':_0x356f41['id'],'fullname':_0x356f41['fullname']};});}}catch(_0x5170fe){_0x59ad77(_0x5170fe);}_0x304055(_0x1c0d86);});}function getInteractionTags(_0x184d50,_0x2c7089){return new BPromise(function(_0x91b02b,_0x4758a5){try{if(_0x184d50['TagIds']){_0x184d50[_0x477d('0x3a')]=[];_0x184d50[_0x477d('0x3b')][_0x477d('0x3c')](',')[_0x477d('0x3d')](function(_0x90924){_0x184d50['Tags'][_0x477d('0x3e')](_0x2c7089[_0x90924]);});}delete _0x184d50[_0x477d('0x3b')];}catch(_0x4d1c8e){_0x4758a5(_0x4d1c8e);}_0x91b02b(_0x184d50);});}function updateChatInteraction(_0x473962,_0x5c814c,_0xa43df8){return new BPromise(function(_0x7a5a47,_0x131f61){return getInteractionUsers(_0x473962,_0xa43df8)[_0x477d('0x34')](function(_0x1f9552){return getInteractionTags(_0x1f9552,_0x5c814c);})[_0x477d('0x34')](function(_0x20a45a){_0x7a5a47(_0x20a45a);})[_0x477d('0x3f')](function(_0x43ffd1){_0x131f61(_0x43ffd1);});});}exports['index']=function(_0x5759f,_0x31c9a1){var _0x20de31={},_0x432985={},_0x4d8066={'count':0x0,'rows':[]};var _0x4e0db1=_[_0x477d('0x39')](db[_0x477d('0x40')]['rawAttributes'],function(_0x20c29b){return{'name':_0x20c29b['fieldName'],'type':_0x20c29b['type'][_0x477d('0x41')]};});_0x432985[_0x477d('0x42')]=_[_0x477d('0x39')](_0x4e0db1,_0x477d('0x36'));_0x432985[_0x477d('0x43')]=_[_0x477d('0x44')](_0x5759f['query']);_0x432985[_0x477d('0x45')]=_[_0x477d('0x46')](_0x432985[_0x477d('0x42')],_0x432985[_0x477d('0x43')]);_0x20de31[_0x477d('0x47')]=_['intersection'](_0x432985['model'],qs[_0x477d('0x48')](_0x5759f[_0x477d('0x43')][_0x477d('0x48')]));_0x20de31['attributes']=_0x20de31[_0x477d('0x47')][_0x477d('0x49')]?_0x20de31[_0x477d('0x47')]:_0x432985[_0x477d('0x42')];if(!_0x5759f[_0x477d('0x43')][_0x477d('0x4a')](_0x477d('0x4b'))){_0x20de31['limit']=qs[_0x477d('0x2d')](_0x5759f[_0x477d('0x43')][_0x477d('0x2d')]);_0x20de31[_0x477d('0x2c')]=qs[_0x477d('0x2c')](_0x5759f[_0x477d('0x43')][_0x477d('0x2c')]);}_0x20de31[_0x477d('0x4c')]=qs[_0x477d('0x4d')](_0x5759f[_0x477d('0x43')][_0x477d('0x4d')]);_0x20de31[_0x477d('0x4e')]=qs[_0x477d('0x45')](_[_0x477d('0x4f')](_0x5759f[_0x477d('0x43')],_0x432985['filters']),_0x4e0db1);var _0xa20d0b=[];var _0x23d85f=squel['select']()['field']('id')['field'](_0x477d('0x36'))[_0x477d('0x50')](_0x477d('0x51'))[_0x477d('0x52')](_0x477d('0x53'));var _0x1f4168=squel[_0x477d('0x54')]()[_0x477d('0x50')]('u.id')[_0x477d('0x50')](_0x477d('0x55'))[_0x477d('0x50')](_0x477d('0x56'))[_0x477d('0x52')](_0x477d('0x57'),'ui')[_0x477d('0x58')](_0x477d('0x59'),'u','u.id\x20=\x20ui.UserId');var _0x3178ed=squel[_0x477d('0x54')]()[_0x477d('0x52')](_0x477d('0x5a'),'i')[_0x477d('0x58')]('cm_contacts','c',_0x477d('0x5b'))[_0x477d('0x58')](_0x477d('0x59'),'o',_0x477d('0x5c'))[_0x477d('0x58')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x477d('0x58')](_0x477d('0x5d'),'me',_0x477d('0x5e'))[_0x477d('0x58')](_0x477d('0x5f'),'it',_0x477d('0x60'))[_0x477d('0x58')](_0x477d('0x53'),'t','t.id\x20=\x20it.TagId');var _0x53aa58=squel['expr']();var _0x491a9a=[];var _0x545052=squel[_0x477d('0x61')]();var _0x57f73f;if(_0x5759f[_0x477d('0x43')]['search']){_0x57f73f=as[_0x477d('0x62')](_0x5759f[_0x477d('0x43')]['search']);var _0x248f85=_0x57f73f[_0x477d('0x63')];for(var _0x3d8a12=0x0;_0x3d8a12<_0x57f73f[_0x477d('0x64')][_0x477d('0x49')];_0x3d8a12++){var _0x5be779=_0x57f73f[_0x477d('0x64')][_0x3d8a12];var _0x245fbe='i';var _0x584f62=_[_0x477d('0x65')](_0x4e0db1,[_0x477d('0x36'),_0x5be779[_0x477d('0x50')]]);if(!_0x584f62){switch(_0x5be779[_0x477d('0x50')]){case _0x477d('0x66'):if(_0x5be779['value']==0x1){_0x3178ed['having']('`'+_0x5be779[_0x477d('0x50')]+_0x477d('0x67'));}else{_0x3178ed['having']('`'+_0x5be779[_0x477d('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0x5be779[_0x477d('0x68')]===_0x477d('0x69')){if(_0x5be779[_0x477d('0x6a')][_0x477d('0x3c')]('\x20')[_0x477d('0x49')]>0x1){_0x53aa58[_0x248f85]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5be779[_0x477d('0x6a')]),null);}else{var _0x23c435='%'+_0x5be779[_0x477d('0x6a')]+'%';_0x53aa58[_0x248f85](_0x477d('0x6b'),_0x23c435,_0x23c435,_0x23c435);}}else{_0x584f62=_[_0x477d('0x65')](_0x4e0db1,[_0x477d('0x36'),_0x477d('0x6c')]);_0x5be779[_0x477d('0x50')]=_0x477d('0x6c');_0x38e06f=as['buildExpression'](_0x245fbe,_0x584f62['type'],_0x5be779);_0x53aa58[_0x248f85](_0x38e06f[_0x477d('0x6d')],_0x38e06f['value'][_0x477d('0x6e')],_0x38e06f[_0x477d('0x6a')][_0x477d('0x29')]);}break;case'Tag':var _0xcb40f3=_0x5be779[_0x477d('0x6a')]['split'](',')[_0x477d('0x39')](function(_0x3ab693){return Number(_0x3ab693);});_0xcb40f3[_0x477d('0x3d')](function(_0x31e38e){_0x545052['or'](_0x477d('0x6f'),'%,'+_0x31e38e+',%');});_0x491a9a=_[_0x477d('0x70')](_0x491a9a,_0xcb40f3);break;case'User':if(_0x5be779[_0x477d('0x68')]===_0x477d('0x69')){_0x53aa58[_0x248f85](_0x477d('0x71'),'%'+_0x5be779[_0x477d('0x6a')]+'%',null);}else{_0x584f62=_['find'](_0x4e0db1,[_0x477d('0x36'),'UserId']);_0x5be779[_0x477d('0x50')]=_0x477d('0x72');_0x38e06f=as['buildExpression'](_0x245fbe,_0x584f62[_0x477d('0x73')],_0x5be779);_0x53aa58[_0x248f85](_0x38e06f[_0x477d('0x6d')],_0x38e06f[_0x477d('0x6a')]['start'],_0x38e06f['value'][_0x477d('0x29')]);}break;case _0x477d('0x74'):_0x38e06f=as[_0x477d('0x75')]('me',null,_0x5be779);_0x53aa58[_0x248f85](_0x38e06f[_0x477d('0x6d')],_0x38e06f['value'][_0x477d('0x6e')],_0x38e06f[_0x477d('0x6a')]['end']);break;}}else{var _0x38e06f=as[_0x477d('0x75')](_0x245fbe,_0x584f62[_0x477d('0x73')],_0x5be779);_0x53aa58[_0x248f85](_0x38e06f['text'],_0x38e06f[_0x477d('0x6a')][_0x477d('0x6e')],_0x38e06f[_0x477d('0x6a')]['end']);}}}else{var _0x3b1e4c=_(_0x5759f[_0x477d('0x43')])[_0x477d('0x44')]()[_0x477d('0x39')](function(_0x104dec){return _[_0x477d('0x76')](_0x4e0db1,[_0x477d('0x36'),_0x104dec])?_0x104dec:undefined;})[_0x477d('0x77')]()[_0x477d('0x6a')]();if(!_['isEmpty'](_0x3b1e4c)){_0x3b1e4c['forEach'](function(_0x3d7f61){if(_0x3d7f61==='ChatWebsiteId'){_0x3178ed[_0x477d('0x4e')]('i.ChatWebsiteId\x20IN\x20?',[][_0x477d('0x78')](_0x5759f['query'][_0x3d7f61]));}else if(_0x3d7f61===_0x477d('0x79')){var _0x2852d5=JSON[_0x477d('0x7a')](_0x5759f[_0x477d('0x43')][_0x3d7f61])['$gte'];var _0x5e9459=JSON['parse'](_0x5759f['query'][_0x3d7f61])['$lte'];_0x3178ed[_0x477d('0x4e')](_0x477d('0x7b'),_0x2852d5,_0x5e9459);}else{if(_0x5759f[_0x477d('0x43')][_0x3d7f61]===_0x477d('0x7c')){_0x3178ed[_0x477d('0x4e')]('i.'+_0x3d7f61+_0x477d('0x7d'));}else{_0x3178ed['where']('i.'+_0x3d7f61+_0x477d('0x7e'),_0x5759f['query'][_0x3d7f61]);}}});}if(_0x5759f['query'][_0x477d('0x7f')]){if(_0x5759f[_0x477d('0x43')][_0x477d('0x7f')]==0x1){_0x3178ed[_0x477d('0x80')](_0x477d('0x81'));}else{_0x3178ed[_0x477d('0x80')]('`unreadMessages`\x20>\x200');}}if(_0x5759f['query'][_0x477d('0x82')]){_0x491a9a=_[_0x477d('0x83')](_0x5759f[_0x477d('0x43')]['tag'])?_0x5759f['query'][_0x477d('0x82')]:new Array(_0x5759f[_0x477d('0x43')][_0x477d('0x82')]);_0x491a9a[_0x477d('0x3d')](function(_0xaf7a97){_0x545052['or'](_0x477d('0x6f'),'%,'+_0xaf7a97+',%');});}if(_0x5759f[_0x477d('0x43')][_0x477d('0x84')]){var _0x2a6560=_0x5759f['query'][_0x477d('0x84')][_0x477d('0x85')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x477d('0x86'));if(qs[_0x477d('0x87')](_0x2a6560)){_0x53aa58['or'](_0x477d('0x88'),_0x2a6560+'%');}else{_0x53aa58['or'](_0x477d('0x89'),qs[_0x477d('0x8a')](_0x2a6560))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2a6560+'%');}}}_0x3178ed[_0x477d('0x4e')](_0x53aa58);_0x3178ed['group'](_0x477d('0x8b'));var _0x210f63={'type':db['Sequelize'][_0x477d('0x8c')][_0x477d('0x8d')],'raw':!![]};var _0x4a1d9f=_0x3178ed[_0x477d('0x8e')]();_0x4a1d9f[_0x477d('0x50')]('i.id');_0x4a1d9f[_0x477d('0x50')](_0x477d('0x8f'),_0x477d('0x66'));if(_0x20de31[_0x477d('0x4c')]){_0x20de31[_0x477d('0x4c')][_0x477d('0x3d')](function(_0x6af36d){_0x3178ed[_0x477d('0x4c')]('i.'+_0x6af36d[0x0],_0x6af36d[0x1]===_0x477d('0x90')?![]:!![]);});}if(!_[_0x477d('0x91')](_0x491a9a)){_0x3178ed[_0x477d('0x80')](_0x545052);_0x4a1d9f[_0x477d('0x4e')](_0x477d('0x92'),_0x491a9a);}BPromise[_0x477d('0x93')]()[_0x477d('0x34')](function(){if(!_0x57f73f){if(_0x5759f['query'][_0x477d('0x94')]||_0x5759f['query']['journey'])return;_0x4a1d9f[_0x477d('0x4e')](_0x477d('0x95'));_0x3178ed['where'](_0x477d('0x95'));return;}return _0x5759f[_0x477d('0x96')][_0x477d('0x97')]({'attributes':['id'],'raw':!![]})[_0x477d('0x34')](function(_0x7c54a8){if(_[_0x477d('0x91')](_0x7c54a8)){_0x4a1d9f[_0x477d('0x4e')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3178ed[_0x477d('0x4e')](_0x477d('0x98'));}else{_0x4a1d9f['where'](_0x477d('0x99'),_[_0x477d('0x39')](_0x7c54a8,'id'));_0x3178ed[_0x477d('0x4e')](_0x477d('0x99'),_[_0x477d('0x39')](_0x7c54a8,'id'));}});})[_0x477d('0x34')](function(){db[_0x477d('0x9a')][_0x477d('0x43')](_0x4a1d9f[_0x477d('0x9b')](),_0x210f63)[_0x477d('0x34')](function(_0x20fc0c){_0x4d8066[_0x477d('0x2b')]=_0x20fc0c[_0x477d('0x49')];if(_0x4d8066[_0x477d('0x2b')]===0x0)return[];return db[_0x477d('0x9a')][_0x477d('0x43')](_0x23d85f['toString'](),_0x210f63)['then'](function(_0x1ba7e6){_0xa20d0b=_['keyBy'](_0x1ba7e6,'id');_0x210f63=_['merge'](_0x210f63,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5759f[_0x477d('0x43')][_0x477d('0x48')]){_0x20de31['attributes'][_0x477d('0x3d')](function(_0x2115ca){_0x3178ed[_0x477d('0x50')]('i.'+_0x2115ca);});}else{_0x3178ed[_0x477d('0x50')](_0x477d('0x8f'),'unreadMessages');_0x3178ed['field'](_0x477d('0x9c'),_0x477d('0x9d'));_0x3178ed[_0x477d('0x50')](_0x477d('0x9e'),_0x477d('0x9f'));_0x3178ed['field']('i.*');_0x3178ed['field'](_0x477d('0xa0'),_0x477d('0xa1'));_0x3178ed['field'](_0x477d('0xa2'),_0x477d('0xa3'));_0x3178ed[_0x477d('0x50')](_0x477d('0xa4'),_0x477d('0xa5'));_0x3178ed[_0x477d('0x50')](_0x477d('0xa6'),'Contact.phone');_0x3178ed[_0x477d('0x50')]('c.mobile',_0x477d('0xa7'));_0x3178ed[_0x477d('0x50')](_0x477d('0xa8'),_0x477d('0xa9'));_0x3178ed[_0x477d('0x50')](_0x477d('0xaa'),_0x477d('0xab'));_0x3178ed['field'](_0x477d('0xac'),_0x477d('0xad'));_0x3178ed[_0x477d('0x50')](_0x477d('0xae'),'TagIds');}if(_0x20de31[_0x477d('0x2d')])_0x3178ed['limit'](_0x20de31[_0x477d('0x2d')]);if(_0x20de31[_0x477d('0x2c')])_0x3178ed[_0x477d('0x2c')](_0x20de31[_0x477d('0x2c')]);return db[_0x477d('0x9a')]['query'](_0x3178ed[_0x477d('0x9b')](),_0x210f63);})['then'](function(_0x12428b){_0x1f4168[_0x477d('0x4e')](_0x477d('0xaf'),_['map'](_0x12428b,'id'));return db[_0x477d('0x9a')][_0x477d('0x43')](_0x1f4168[_0x477d('0x9b')](),_0x210f63)[_0x477d('0x34')](function(_0x12acd2){var _0x30ed3a=_[_0x477d('0xb0')](_0x12acd2,_0x477d('0xb1'));var _0x3f73d3=[];_0x12428b[_0x477d('0x3d')](function(_0x7f7145){_0x3f73d3[_0x477d('0x3e')](updateChatInteraction(_0x7f7145,_0xa20d0b,_0x30ed3a));});return BPromise['all'](_0x3f73d3);});});})['then'](function(_0x39dfae){_0x4d8066[_0x477d('0xb2')]=_0x39dfae;return _0x4d8066;})[_0x477d('0x34')](respondWithFilteredResult(_0x31c9a1,_0x20de31));})['catch'](handleError(_0x31c9a1,null));};exports['show']=function(_0x4de3ae,_0x50a506){var _0x37f57e={'raw':![],'where':{'id':_0x4de3ae[_0x477d('0xb3')]['id']}},_0xfef06c={};_0xfef06c[_0x477d('0x42')]=_[_0x477d('0x44')](db['ChatInteraction'][_0x477d('0xb4')]);_0xfef06c[_0x477d('0x43')]=_[_0x477d('0x44')](_0x4de3ae[_0x477d('0x43')]);_0xfef06c[_0x477d('0x45')]=_[_0x477d('0x46')](_0xfef06c['model'],_0xfef06c[_0x477d('0x43')]);_0x37f57e[_0x477d('0x47')]=_[_0x477d('0x46')](_0xfef06c['model'],qs[_0x477d('0x48')](_0x4de3ae[_0x477d('0x43')][_0x477d('0x48')]));_0x37f57e[_0x477d('0x47')]=_0x37f57e[_0x477d('0x47')]['length']?_0x37f57e[_0x477d('0x47')]:_0xfef06c[_0x477d('0x42')];if(_0x4de3ae['query'][_0x477d('0xb5')]){_0x37f57e[_0x477d('0xb6')]=[{'all':!![]}];}_0x37f57e=_[_0x477d('0xb7')]({},_0x37f57e,_0x4de3ae[_0x477d('0xb8')]);return db['ChatInteraction'][_0x477d('0x65')](_0x37f57e)['then'](handleEntityNotFound(_0x50a506,null))['then'](respondWithResult(_0x50a506,null))[_0x477d('0x3f')](handleError(_0x50a506,null));};exports[_0x477d('0xb9')]=function(_0x574a64,_0x58b5c0){return db['ChatInteraction'][_0x477d('0xb9')](_0x574a64[_0x477d('0x74')],{})[_0x477d('0x34')](respondWithResult(_0x58b5c0,0xc9))[_0x477d('0x3f')](handleError(_0x58b5c0,null));};exports['update']=function(_0x5f07fe,_0x1af813){if(_0x5f07fe[_0x477d('0x74')]['id']){delete _0x5f07fe[_0x477d('0x74')]['id'];}return db[_0x477d('0x40')][_0x477d('0x65')]({'where':{'id':_0x5f07fe['params']['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x1af813,null))[_0x477d('0x34')](saveUpdates(_0x5f07fe['body'],null))['then'](respondWithResult(_0x1af813,null))['catch'](handleError(_0x1af813,null));};exports[_0x477d('0x35')]=function(_0x111dea,_0x215f3b){return db[_0x477d('0x40')][_0x477d('0x65')]({'where':{'id':_0x111dea[_0x477d('0xb3')]['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x215f3b,null))[_0x477d('0x34')](removeEntity(_0x215f3b,null))['catch'](handleError(_0x215f3b,null));};exports[_0x477d('0xba')]=function(_0x137160,_0x59052e){return db[_0x477d('0x40')][_0x477d('0xba')]()[_0x477d('0x34')](respondWithResult(_0x59052e,null))[_0x477d('0x3f')](handleError(_0x59052e,null));};exports[_0x477d('0xbb')]=function(_0x32dc78,_0x2d73e5){var _0x467fb8=_0x32dc78[_0x477d('0xb3')]['id'];var _0x26580d;var _0x570aea;var _0x4f2515;return db['ChatInteraction'][_0x477d('0xbc')]({'where':{'id':_0x467fb8}})[_0x477d('0x34')](function(_0x3113ff){_0x26580d=_0x3113ff;return db[_0x477d('0xbd')][_0x477d('0xbc')]({'where':{'id':_0x3113ff[_0x477d('0x94')]},'attributes':['id','vidaooApiKey',_0x477d('0xbe')],'raw':!![]});})['then'](function(_0x3231b0){if(_0x3231b0&&_0x3231b0[_0x477d('0xbf')]&&_0x3231b0[_0x477d('0xbe')]){_0x570aea=_0x3231b0;var _0x5a5d14={'rejectUnauthorized':![],'method':_0x477d('0xc0'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x3231b0['vidaooApiKey']},'body':{'name':'MotionCWB:'+_0x467fb8},'redirect':'follow','json':!![]};return rp(_0x5a5d14);}else{throw new db['Sequelize'][(_0x477d('0x1c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x477d('0x34')](function(_0x48f1b2){_0x4f2515=_0x48f1b2;if(_0x4f2515['id']){var _0x309f2e={'body':_0x4f2515['join_url'],'ChatWebsiteId':_0x570aea['id'],'ChatInteractionId':_0x26580d['id'],'direction':_0x477d('0xc1'),'UserId':_0x32dc78[_0x477d('0x96')]['id']};return db['ChatMessage'][_0x477d('0xb9')](_0x309f2e,{});}else{throw new db[(_0x477d('0x1b'))][(_0x477d('0x1c'))](_0x477d('0xc2'));}})['then'](function(){return _0x26580d[_0x477d('0xc3')]({'vidaooSessionId':_0x4f2515['id']});})[_0x477d('0x34')](respondWithResult(_0x2d73e5,null))['catch'](handleError(_0x2d73e5,null));};exports[_0x477d('0xc4')]=function(_0x27fe54,_0x2bb3d6){if(_0x27fe54[_0x477d('0x74')]['id']){delete _0x27fe54[_0x477d('0x74')]['id'];}return db[_0x477d('0x40')][_0x477d('0x65')]({'where':{'id':_0x27fe54[_0x477d('0xb3')]['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x2bb3d6,null))[_0x477d('0x34')](saveUpdates(_0x27fe54[_0x477d('0x74')],null))[_0x477d('0x34')](respondWithResult(_0x2bb3d6,null))[_0x477d('0x3f')](handleError(_0x2bb3d6,null));};exports[_0x477d('0xc5')]=function(_0x35b570,_0x44e8b8,_0x4550bb){if(_0x35b570[_0x477d('0x74')]['id']){delete _0x35b570[_0x477d('0x74')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x35b570[_0x477d('0xb3')]['id']}})[_0x477d('0x34')](function(_0x205c61){if(!_0x205c61){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x477d('0xc5'),0x194,_0x477d('0xc6'));_0x44e8b8['sendStatus'](0x194);}else{if(_0x205c61['UserId']){throw new db[(_0x477d('0x1b'))][(_0x477d('0x1c'))](_0x477d('0xc7'));}}return _0x205c61;})[_0x477d('0x34')](function(_0xb2a31){if(_0xb2a31){return _0xb2a31[_0x477d('0x33')]({'closed':_0x35b570[_0x477d('0x74')][_0x477d('0xc8')],'disposition':_0x35b570[_0x477d('0x74')]['disposition']})[_0x477d('0x34')](function(_0x14f437){return _0x14f437;});}})[_0x477d('0x34')](function(_0x36700c){return respondWithRpcPromise(_0x477d('0xc9'),'abandon',_0x35b570[_0x477d('0x74')],client9004);})[_0x477d('0x34')](respondWithResult(_0x44e8b8,null))[_0x477d('0x3f')](handleError(_0x44e8b8,null));};exports[_0x477d('0xca')]=function(_0x4bffc3,_0x1dd201,_0x36e28e){_0x4bffc3['body'][_0x477d('0x36')]=_0x4bffc3['file']['originalname'];_0x4bffc3['body']['basename']=_0x4bffc3['file'][_0x477d('0xcb')];_0x4bffc3['body'][_0x477d('0x73')]=_0x4bffc3[_0x477d('0xcc')][_0x477d('0xcd')];return db[_0x477d('0xce')][_0x477d('0xb9')](_0x4bffc3['body'])[_0x477d('0x34')](respondWithResult(_0x1dd201,0xc9))[_0x477d('0x3f')](handleError(_0x1dd201,null));};exports[_0x477d('0xcf')]=function(_0x2fdbd7,_0x4154d4,_0x89c9b2){return db[_0x477d('0x40')][_0x477d('0xbc')]({'where':{'id':_0x2fdbd7[_0x477d('0xb3')]['id']},'raw':!![]})[_0x477d('0x34')](handleEntityNotFound(_0x4154d4,null))['then'](function(_0x1dae19){if(_0x1dae19){if(_0x1dae19[_0x477d('0xc8')]){return _0x4154d4[_0x477d('0x28')](0x193)[_0x477d('0x2a')]({'status':0x193,'message':_0x477d('0xd0')});}return db[_0x477d('0xce')]['findOne']({'where':{'id':_0x2fdbd7['query'][_0x477d('0xd1')]},'raw':!![]})['then'](handleEntityNotFound(_0x4154d4,null));}})[_0x477d('0x34')](function(_0x346e56){if(_0x346e56){return _0x4154d4['download'](path[_0x477d('0xd2')](config[_0x477d('0xd3')],_0x477d('0xd4'),_0x346e56['basename']));}})[_0x477d('0x3f')](handleError(_0x4154d4,null));};exports[_0x477d('0xd5')]=function(_0x24e1cf,_0x121d00){var _0xd93077=null;var _0x26efe2=null;var _0xdf1e5a=null;var _0x2746a8=null;if(_0x24e1cf[_0x477d('0x74')]['id']){delete _0x24e1cf['body']['id'];}if(_0x24e1cf[_0x477d('0x74')]['mailTranscript']){_0x2746a8=path[_0x477d('0xd2')](config[_0x477d('0xd3')],_0x477d('0xd6'),util[_0x477d('0xd7')]('transcript-%s.txt',Date[_0x477d('0xd8')]()));_0x24e1cf[_0x477d('0x74')]['pathTranscript']=_0x2746a8;}return db[_0x477d('0x40')][_0x477d('0x65')]({'where':{'id':_0x24e1cf[_0x477d('0xb3')]['id']},'include':[{'model':db[_0x477d('0xd9')],'as':_0x477d('0xda'),'include':[{'model':db[_0x477d('0xdb')],'as':_0x477d('0xdb')}]}]})[_0x477d('0x34')](handleEntityNotFound(_0x121d00,null))[_0x477d('0x34')](saveUpdates(_0x24e1cf['body'],null))[_0x477d('0x34')](function(_0x2ee60a){if(_0x2ee60a){_0xd93077=_0x2ee60a;return db[_0x477d('0xbd')][_0x477d('0x65')]({'where':{'id':_0xd93077[_0x477d('0x94')]}});}})[_0x477d('0x34')](function(_0x44928b){if(_0x44928b){_0xdf1e5a=_0x44928b;return db[_0x477d('0xdc')]['find']({'where':{'id':_0xd93077[_0x477d('0x6c')]}});}})['then'](function(_0xc1d4bd){if(_0xc1d4bd){_0x26efe2=_0xc1d4bd;if(_0x2746a8){var _0x17ac6a=null;for(var _0xe60571=0x1;_0xe60571<_0xd93077['Messages']['length'];++_0xe60571){_0x17ac6a=_0xd93077['Messages'][_0xe60571];var _0x44960c=_0x17ac6a[_0x477d('0x72')]?util['format'](_0x477d('0xdd'),_0xdf1e5a[_0x477d('0xde')],_0x17ac6a[_0x477d('0x72')]):_0x477d('0xdf');var _0x5c61aa=_0x24e1cf[_0x477d('0x74')][_0x477d('0xe0')]||util[_0x477d('0xd7')](_0x477d('0xdd'),'Visitor',_0x17ac6a[_0x477d('0x6c')]);switch(_0xdf1e5a[_0x477d('0xe1')]){case'website_alias':_0x44960c=_0x17ac6a[_0x477d('0x72')]?util[_0x477d('0xd7')]('%s%d',_0xdf1e5a['agentAlias'],_0x17ac6a[_0x477d('0x72')]):'System';break;case'agent_alias':_0x44960c=_0x17ac6a['UserId']?_0x17ac6a[_0x477d('0xdb')][_0x477d('0xe2')]||_0x17ac6a[_0x477d('0xdb')][_0x477d('0xe3')]:'System';break;case _0x477d('0xe4'):_0x44960c=_0x17ac6a[_0x477d('0x72')]?_0x17ac6a[_0x477d('0xdb')][_0x477d('0xe3')]:_0x477d('0xdf');break;default:_0x44960c=_0x17ac6a['UserId']?util[_0x477d('0xd7')](_0x477d('0xdd'),_0xdf1e5a[_0x477d('0xde')],_0x17ac6a['UserId']):'System';}var _0x50cb27=util['format'](_0x477d('0xe5'),moment(_0x17ac6a[_0x477d('0x79')])[_0x477d('0xd7')](_0x477d('0xe6')),_0x17ac6a[_0x477d('0xe7')]==='in'?_0x5c61aa:_0x44960c,_0x17ac6a[_0x477d('0x74')]);if(!_0x17ac6a[_0x477d('0xe8')]){fs[_0x477d('0xe9')](_0x2746a8,_0x50cb27);}}return db[_0x477d('0xea')][_0x477d('0xbc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x477d('0xeb'),'raw':!![]}]});}}})[_0x477d('0x34')](function(_0x5393bd){if(_0x5393bd&&_0x5393bd['Smtp']&&_0x24e1cf[_0x477d('0x74')]){var _0x280860={'tls':{'rejectUnauthorized':![]}};if(_0x5393bd['Smtp'][_0x477d('0xec')]){_0x280860['service']=_0x5393bd[_0x477d('0xeb')][_0x477d('0xec')];}else{_0x280860['host']=_0x5393bd[_0x477d('0xeb')][_0x477d('0xed')];_0x280860['port']=_0x5393bd[_0x477d('0xeb')][_0x477d('0xee')];_0x280860['secure']=_0x5393bd['Smtp'][_0x477d('0xef')];}if(_0x5393bd[_0x477d('0xeb')][_0x477d('0xf0')]){_0x280860[_0x477d('0xf1')]={'user':_0x5393bd[_0x477d('0xeb')]['user'],'pass':_0x5393bd[_0x477d('0xeb')]['pass']};}return respondWithRpcPromise(_0x477d('0xf2'),_0x477d('0xf3'),{'account':_0x280860,'message':{'from':util[_0x477d('0xd7')](_0x477d('0xf4'),_0x5393bd[_0x477d('0x36')],_0x5393bd[_0x477d('0xf5')]||_0x5393bd['Smtp'][_0x477d('0x96')]),'to':_0x24e1cf[_0x477d('0x74')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x477d('0xf6'),_0x24e1cf['body'][_0x477d('0xf7')]),'attachments':[{'path':_0x2746a8}]}})[_0x477d('0x34')](function(){return _0xd93077;})[_0x477d('0x3f')](function(_0x2976b5){console[_0x477d('0x23')](_0x2976b5);});}else{return _0xd93077;}})[_0x477d('0x34')](respondWithStatusCode(_0x121d00,0xc8))[_0x477d('0x3f')](handleError(_0x121d00,null));};exports[_0x477d('0xf8')]=function(_0x423a45,_0x59f31f,_0x41baa1){return db[_0x477d('0xd9')][_0x477d('0x65')]({'where':{'id':_0x423a45[_0x477d('0xb3')]['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x59f31f,null))['then'](function(_0x3de2c5){if(_0x3de2c5){return _0x3de2c5[_0x477d('0xf8')](_0x423a45[_0x477d('0x74')][_0x477d('0xf9')],_[_0x477d('0xfa')](_0x423a45[_0x477d('0x74')],[_0x477d('0xf9'),'id'])||{});}})['then'](respondWithResult(_0x59f31f,null))[_0x477d('0x3f')](handleError(_0x59f31f,null));};exports[_0x477d('0xfb')]=function(_0x1f99f5,_0x19255c,_0x3ef191){var _0x2624a5={'raw':![],'where':{}};var _0x28e22={};var _0x5600d4={'count':0x0,'rows':[]};return db[_0x477d('0x40')]['findOne']({'where':{'id':_0x1f99f5[_0x477d('0xb3')]['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x19255c,null))['then'](function(_0x177ced){if(_0x177ced){_0x28e22[_0x477d('0x42')]=_[_0x477d('0x44')](db[_0x477d('0xd9')][_0x477d('0xb4')]);_0x28e22[_0x477d('0x43')]=_[_0x477d('0x44')](_0x1f99f5['query']);_0x28e22[_0x477d('0x45')]=_[_0x477d('0x46')](_0x28e22[_0x477d('0x42')],_0x28e22[_0x477d('0x43')]);_0x2624a5[_0x477d('0x47')]=_[_0x477d('0x46')](_0x28e22['model'],qs[_0x477d('0x48')](_0x1f99f5[_0x477d('0x43')][_0x477d('0x48')]));_0x2624a5['attributes']=_0x2624a5[_0x477d('0x47')][_0x477d('0x49')]?_0x2624a5[_0x477d('0x47')]:_0x28e22[_0x477d('0x42')];if(!_0x1f99f5['query'][_0x477d('0x4a')]('nolimit')){_0x2624a5['limit']=qs[_0x477d('0x2d')](_0x1f99f5[_0x477d('0x43')][_0x477d('0x2d')]);_0x2624a5[_0x477d('0x2c')]=qs[_0x477d('0x2c')](_0x1f99f5[_0x477d('0x43')]['offset']);}_0x2624a5[_0x477d('0x4c')]=qs[_0x477d('0x4d')](_0x1f99f5[_0x477d('0x43')][_0x477d('0x4d')]);_0x2624a5[_0x477d('0x4e')]=qs[_0x477d('0x45')](_[_0x477d('0x4f')](_0x1f99f5['query'],_0x28e22[_0x477d('0x45')]));_0x2624a5[_0x477d('0x4e')][_0x477d('0xb1')]=_0x177ced['id'];if(_0x1f99f5[_0x477d('0x43')]['filter']){_0x2624a5[_0x477d('0x4e')]=_[_0x477d('0xb7')](_0x2624a5[_0x477d('0x4e')],{'$or':_[_0x477d('0x39')](_0x2624a5['attributes'],function(_0x35d821){var _0x39658f={};_0x39658f[_0x35d821]={'$like':'%'+_0x1f99f5[_0x477d('0x43')]['filter']+'%'};return _0x39658f;})});}if(_0x1f99f5[_0x477d('0x43')][_0x477d('0xfc')]){var _0xabfe8a=_0x1f99f5[_0x477d('0x43')][_0x477d('0xfc')][_0x477d('0x3c')](',');var _0x4e1657={};_0x4e1657[_0xabfe8a[0x0]]={'$gte':moment(_0xabfe8a[0x1])['format'](_0x477d('0xfd'))};_0x2624a5[_0x477d('0x4e')]=_[_0x477d('0xb7')](_0x2624a5[_0x477d('0x4e')],_0x4e1657);}_0x2624a5=_['merge']({},_0x2624a5,_0x1f99f5[_0x477d('0xb8')]);return db['ChatMessage'][_0x477d('0x2b')]({'where':_0x2624a5[_0x477d('0x4e')]})[_0x477d('0x34')](function(_0x170c3c){_0x5600d4[_0x477d('0x2b')]=_0x170c3c;if(_0x1f99f5['query'][_0x477d('0xb5')]){_0x2624a5[_0x477d('0xb6')]=[{'all':!![]}];}return db[_0x477d('0xd9')][_0x477d('0xfe')](_0x2624a5);})[_0x477d('0x34')](function(_0x518129){_0x5600d4[_0x477d('0xb2')]=_0x518129;return _0x5600d4;});}})[_0x477d('0x34')](respondWithFilteredResult(_0x19255c,_0x2624a5))[_0x477d('0x3f')](handleError(_0x19255c,null));};exports['getMyMessages']=function(_0x33fc87,_0x25f1a0,_0x68bdba){var _0x245d95={'where':{}},_0x4bbb6a={},_0x7dd026={'count':0x0,'rows':[]};return db[_0x477d('0x40')][_0x477d('0xbc')]({'where':{'id':_0x33fc87[_0x477d('0xb3')]['id']}})['then'](handleEntityNotFound(_0x25f1a0,null))[_0x477d('0x34')](function(_0x4933ae){if(_0x4933ae){_0x4bbb6a[_0x477d('0x42')]=_['keys'](db[_0x477d('0xd9')][_0x477d('0xb4')]);_0x4bbb6a[_0x477d('0x43')]=_['keys'](_0x33fc87[_0x477d('0x43')]);_0x4bbb6a[_0x477d('0x45')]=_[_0x477d('0x46')](_0x4bbb6a[_0x477d('0x42')],_0x4bbb6a[_0x477d('0x43')]);_0x245d95[_0x477d('0x47')]=_['intersection'](_0x4bbb6a[_0x477d('0x42')],qs[_0x477d('0x48')](_0x33fc87[_0x477d('0x43')][_0x477d('0x48')]));_0x245d95[_0x477d('0x47')]=_0x245d95[_0x477d('0x47')][_0x477d('0x49')]?_0x245d95['attributes']:_0x4bbb6a[_0x477d('0x42')];if(!_0x33fc87[_0x477d('0x43')][_0x477d('0x4a')](_0x477d('0x4b'))){_0x245d95[_0x477d('0x2d')]=qs[_0x477d('0x2d')](_0x33fc87[_0x477d('0x43')][_0x477d('0x2d')]);_0x245d95[_0x477d('0x2c')]=qs[_0x477d('0x2c')](_0x33fc87[_0x477d('0x43')][_0x477d('0x2c')]);}_0x245d95[_0x477d('0x4c')]=qs[_0x477d('0x4d')](_0x33fc87[_0x477d('0x43')][_0x477d('0x4d')]);_0x245d95[_0x477d('0x4e')]=qs['filters'](_['pick'](_0x33fc87[_0x477d('0x43')],_0x4bbb6a['filters']));_0x245d95[_0x477d('0x4e')]['ChatInteractionId']=_0x4933ae['id'];if(_0x33fc87[_0x477d('0x43')]['filter']){_0x245d95[_0x477d('0x4e')]=_[_0x477d('0xb7')](_0x245d95['where'],{'$or':_[_0x477d('0x39')](_0x245d95[_0x477d('0x47')],function(_0x221038){var _0x22a843={};_0x22a843[_0x221038]={'$like':'%'+_0x33fc87[_0x477d('0x43')]['filter']+'%'};return _0x22a843;})});}_0x245d95[_0x477d('0x4e')][_0x477d('0xe8')]=![];if(_0x33fc87['query']['id']){_0x245d95['where']['id']={'$gt':_0x33fc87[_0x477d('0x43')]['id']};}_0x245d95=_['merge']({},_0x245d95,_0x33fc87[_0x477d('0xb8')]);return db[_0x477d('0xd9')]['count']({'where':_0x245d95['where']})['then'](function(_0xd9264c){_0x7dd026['count']=_0xd9264c;_0x245d95[_0x477d('0xb6')]=[];if(_0x33fc87[_0x477d('0x43')][_0x477d('0xff')]){_0x245d95[_0x477d('0xb6')][_0x477d('0x3e')]({'model':db['User'],'as':_0x477d('0xdb'),'attributes':['id','fullname',_0x477d('0xe2')]});}if(_0x33fc87[_0x477d('0x43')][_0x477d('0xb5')]){_0x245d95['include']=[{'all':!![]}];}return db[_0x477d('0xd9')][_0x477d('0xfe')](_0x245d95);})[_0x477d('0x34')](function(_0x534aad){_0x7dd026['rows']=_0x534aad;return _0x7dd026;});}})[_0x477d('0x34')](respondWithFilteredResult(_0x25f1a0,_0x245d95))['catch'](handleError(_0x25f1a0,null));};exports[_0x477d('0x100')]=function(_0x17b2e2,_0x579e75,_0x109acb){return db['ChatInteraction'][_0x477d('0x65')]({'where':{'id':_0x17b2e2['params']['id']}})[_0x477d('0x34')](handleEntityNotFound(_0x579e75,null))[_0x477d('0x34')](function(_0x2d0e89){if(_0x2d0e89){return _0x2d0e89[_0x477d('0x101')](_0x17b2e2[_0x477d('0x74')]['ids'],_[_0x477d('0xfa')](_0x17b2e2[_0x477d('0x74')],[_0x477d('0xf9'),'id'])||{})[_0x477d('0x102')](function(){return db[_0x477d('0x103')][_0x477d('0xfe')]({'attributes':['id','name',_0x477d('0x51')],'where':{'id':_0x17b2e2['body'][_0x477d('0xf9')]}});})['then'](function(_0x347424){socket[_0x477d('0x104')]('chatInteractionTags:save',{'id':Number(_0x17b2e2[_0x477d('0xb3')]['id']),'tags':_0x347424||[]});return{'id':Number(_0x17b2e2[_0x477d('0xb3')]['id']),'tags':_0x347424||[]};});}})[_0x477d('0x34')](respondWithResult(_0x579e75,null))[_0x477d('0x3f')](handleError(_0x579e75,null));};exports[_0x477d('0x105')]=function(_0x559ad3,_0xb1397e,_0x298307){return db['ChatInteraction']['find']({'where':{'id':_0x559ad3[_0x477d('0xb3')]['id']}})['then'](handleEntityNotFound(_0xb1397e,null))[_0x477d('0x34')](function(_0x51f33b){if(_0x51f33b){return _0x51f33b[_0x477d('0x105')](_0x559ad3[_0x477d('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xb1397e,null))[_0x477d('0x3f')](handleError(_0xb1397e,null));};exports['download']=function(_0x25d951,_0x1db9bc){var _0x40f862=moment()['unix']()[_0x477d('0x9b')]();var _0x487640=path['join'](config[_0x477d('0xd3')],_0x477d('0x106'),_0x477d('0x107'),_0x477d('0x108'));var _0x568e96=path[_0x477d('0xd2')](config[_0x477d('0xd3')],_0x477d('0x106'),_0x477d('0x107'),_0x477d('0x109'));var _0x423799=path[_0x477d('0xd2')](_0x487640,_0x40f862);var _0x12be3e=util[_0x477d('0xd7')]('transcript-%d-%s.zip',_0x25d951[_0x477d('0xb3')]['id'],_0x40f862);var _0x36a401=path[_0x477d('0xd2')](_0x487640,_0x12be3e);var _0x19d4f9=[];_0x19d4f9['push']({'model':db['User'],'as':_0x477d('0xdb'),'attributes':['id','fullname'],'raw':!![]});_0x19d4f9[_0x477d('0x3e')]({'model':db['CmContact'],'as':_0x477d('0x10a'),'attributes':['id',_0x477d('0x10b'),_0x477d('0x10c')],'raw':!![]});if(_0x25d951['query'][_0x477d('0x109')]){_0x19d4f9[_0x477d('0x3e')]({'model':db['Attachment'],'as':_0x477d('0xce'),'raw':!![]});}var _0x2cb750=[{'model':db['ChatMessage'],'as':_0x477d('0xda'),'attributes':['id','body',_0x477d('0x79'),'direction','secret','read'],'include':_0x19d4f9}];_0x2cb750[_0x477d('0x3e')]({'model':db[_0x477d('0xbd')],'as':'Account','attributes':['id',_0x477d('0x36')]});_0x2cb750[_0x477d('0x3e')]({'model':db[_0x477d('0xdb')],'as':_0x477d('0x10d'),'attributes':['id',_0x477d('0xe3')]});return db[_0x477d('0x40')][_0x477d('0x65')]({'where':{'id':_0x25d951[_0x477d('0xb3')]['id']},'include':_0x2cb750})[_0x477d('0x34')](handleEntityNotFound(_0x1db9bc,null))['then'](function(_0x2b468d){if(_0x2b468d){var _0x4fccd2=_0x2b468d[_0x477d('0x10e')]({'plain':!![]});fs[_0x477d('0x10f')](_0x423799);var _0x38b49f={'format':'A4','border':_0x477d('0x110'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x477d('0x111'),'contents':{'default':util['format'](_0x477d('0x112'),util[_0x477d('0xd7')]('%s\x20#%d',_0x477d('0x113'),_0x4fccd2['id']),moment()[_0x477d('0xd7')](_0x477d('0x114'))[_0x477d('0x9b')]())}}};var _0x5efb67={'channel':_0x477d('0x113'),'account':_0x4fccd2[_0x477d('0x115')][_0x477d('0x36')],'agent':_0x4fccd2[_0x477d('0x10d')]?_0x4fccd2[_0x477d('0x10d')][_0x477d('0xe3')]:'N.A.','createdAt':moment(_0x4fccd2[_0x477d('0x79')])[_0x477d('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x477d('0x9b')](),'closedAt':_0x4fccd2[_0x477d('0xc8')]?moment(_0x4fccd2['closedAt'])['format'](_0x477d('0xfd'))[_0x477d('0x9b')]():'','disposition':_0x4fccd2[_0x477d('0x116')],'chatInfo':{'browser':_0x4fccd2[_0x477d('0x117')],'os':_0x4fccd2[_0x477d('0x118')],'referer':_0x4fccd2[_0x477d('0x119')],'customerIp':_0x4fccd2['customerIp'],'customerPort':_0x4fccd2['customerPort']?_0x4fccd2['customerPort']:_0x477d('0x11a')},'messages':_(_0x4fccd2[_0x477d('0xda')])[_0x477d('0x11b')]()[_0x477d('0x84')]({'secret':![]})[_0x477d('0x39')](function(_0x132277){if(_0x132277[_0x477d('0xce')]){var _0x53bae5=path[_0x477d('0xd2')](_0x568e96,_0x132277[_0x477d('0xce')]['basename']);if(fs[_0x477d('0x11c')](_0x53bae5)){fs['createReadStream'](_0x53bae5)['pipe'](fs['createWriteStream'](path[_0x477d('0xd2')](_0x423799,_0x132277[_0x477d('0xce')]['basename'])));}}return{'date':moment(_0x132277['createdAt'])[_0x477d('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x132277['direction']==='out'?_0x132277['User']?_0x132277['User']['fullname']:_0x477d('0xdf'):_0x132277[_0x477d('0x10a')]['firstName']+(_0x132277[_0x477d('0x10a')][_0x477d('0x10c')]?'\x20'+_0x132277[_0x477d('0x10a')][_0x477d('0x10c')]:''),'body':_0x132277['Attachment']?_0x132277[_0x477d('0xce')][_0x477d('0x11d')]:_0x132277[_0x477d('0x74')],'direction':_0x132277[_0x477d('0xe7')]===_0x477d('0xc1')?'A':'C','secret':_0x132277[_0x477d('0xe8')],'read':_0x132277[_0x477d('0x7f')],'attachment':_0x132277[_0x477d('0xce')]};})[_0x477d('0x6a')]()};return ejs[_0x477d('0x11e')](path[_0x477d('0xd2')](config[_0x477d('0xd3')],_0x477d('0x106'),'views',_0x477d('0x11f')),{'interaction':_0x5efb67})['then'](function(_0x1b31c3){return new BPromise(function(_0x45b13f,_0x4732cf){pdf[_0x477d('0xb9')](_0x1b31c3,_0x38b49f)[_0x477d('0x120')](path[_0x477d('0xd2')](_0x423799,_0x477d('0x121')+_0x4fccd2['id']+'-'+_0x40f862+'.pdf'),function(_0x5254f2,_0x439a8b){if(_0x5254f2)return _0x4732cf(_0x5254f2);_0x45b13f(_0x439a8b);});});})[_0x477d('0x34')](function(){return new BPromise(function(_0x2b5321,_0x1ccbb8){zipdir(_0x423799,{'saveTo':_0x36a401},function(_0x1bece3,_0x2db64d){if(_0x1bece3)return _0x1ccbb8(_0x1bece3);return _0x2b5321(_0x2db64d);});})[_0x477d('0x34')](function(){return new BPromise(function(_0x27adbf,_0x360fe2){rimraf(_0x423799,function(_0x318c9a){if(_0x318c9a)_0x360fe2(_0x318c9a);return _0x27adbf();});});})['then'](function(){return _0x1db9bc[_0x477d('0x122')](_0x36a401,_0x12be3e,function(_0x16ea66){if(_0x16ea66){console[_0x477d('0x123')](_0x477d('0x124'),_0x16ea66);}else{fs[_0x477d('0x125')](_0x36a401);}});});});}else{return _0x1db9bc[_0x477d('0x27')](0xc8);}})[_0x477d('0x3f')](handleError(_0x1db9bc,null));}; \ No newline at end of file +var _0x0295=['ContactId','buildExpression','text','start','Tag','union','operator','UserId','some','compact','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','rawAttributes','includeAll','merge','options','create','body','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','ids','getMessages','include','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','findAll','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','Account','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','./chatInteraction.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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','from','tools_tags','u.id','field','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','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)'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0x0295,0x1f0));var _0x5029=function(_0x2b3c9d,_0x1c8c0c){_0x2b3c9d=_0x2b3c9d-0x0;var _0x4b8037=_0x0295[_0x2b3c9d];return _0x4b8037;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var db=require('../../mysqldb')['db'];config[_0x5029('0x14')]=_[_0x5029('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232b});var client9004=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x317c20,_0x10bf55,_0x326923){if(_0x326923){var _0x457c73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x457c73[_0x5029('0x1b')](_0x10bf55)){return _0x317c20;}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0x1e'));}}else{return _0x317c20;}}function respondWithRpcPromise(_0x4f7ab4,_0x1ed567,_0x31a155,_0x35de81){return new BPromise(function(_0x4902f3,_0x8cea01){var _0x5e115f=_0x35de81||client;return _0x5e115f[_0x5029('0x1f')](_0x4f7ab4,_0x31a155)['then'](function(_0x226a5c){logger['info'](_0x5029('0x20'),_0x1ed567,_0x5029('0x21'));logger[_0x5029('0x22')](_0x5029('0x23'),_0x1ed567,'request\x20sent',JSON['stringify'](_0x226a5c));if(_0x226a5c[_0x5029('0x24')]){if(_0x226a5c['error'][_0x5029('0x25')]===0x1f4){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);return _0x8cea01(_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);}logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c['error']['message']);return _0x4902f3(_0x226a5c['error'][_0x5029('0x26')]);}else{logger[_0x5029('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x1ed567,'request\x20sent');_0x4902f3(_0x226a5c[_0x5029('0x28')][_0x5029('0x26')]);}})[_0x5029('0x29')](function(_0x5527fc){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x5527fc);_0x8cea01(_0x5527fc);});});}function respondWithStatusCode(_0x5e45c4,_0x2b6d99){_0x2b6d99=_0x2b6d99||0xcc;return function(_0x31f0a0){if(_0x31f0a0){return _0x5e45c4[_0x5029('0x2a')](_0x2b6d99);}return _0x5e45c4['status'](_0x2b6d99)[_0x5029('0x2b')]();};}function respondWithResult(_0x251f99,_0xe5313e){_0xe5313e=_0xe5313e||0xc8;return function(_0x4b6f92){if(_0x4b6f92){return _0x251f99[_0x5029('0x2c')](_0xe5313e)[_0x5029('0x2d')](_0x4b6f92);}};}function respondWithFilteredResult(_0x4cc16a,_0x1d79b9){return function(_0x25032b){if(_0x25032b){var _0x4434ff=_0x25032b[_0x5029('0x2e')],_0x1c3dd9=_0x1d79b9[_0x5029('0x2f')],_0x196830=_0x1d79b9[_0x5029('0x2f')]+_0x1d79b9[_0x5029('0x30')],_0x2a1ed6;if(_0x196830>=_0x4434ff){_0x196830=_0x4434ff;_0x2a1ed6=0xc8;}else{_0x2a1ed6=0xce;}_0x4cc16a[_0x5029('0x2c')](_0x2a1ed6);return _0x4cc16a[_0x5029('0x31')]('Content-Range',_0x1c3dd9+'-'+_0x196830+'/'+_0x4434ff)[_0x5029('0x2d')](_0x25032b);}return null;};}function patchUpdates(_0x5cb04b){return function(_0x31c621){try{jsonpatch['apply'](_0x31c621,_0x5cb04b,!![]);}catch(_0x48f387){return BPromise[_0x5029('0x32')](_0x48f387);}return _0x31c621[_0x5029('0x33')]();};}function saveUpdates(_0x1f9173,_0x4b7330){return function(_0x2a1535){if(_0x2a1535){return _0x2a1535[_0x5029('0x34')](_0x1f9173)[_0x5029('0x35')](function(_0x29c59a){return _0x29c59a;});}return null;};}function removeEntity(_0x1bb896,_0x4513b9){return function(_0x46ec59){if(_0x46ec59){return _0x46ec59[_0x5029('0x36')]()[_0x5029('0x35')](function(){_0x1bb896['status'](0xcc)[_0x5029('0x2b')]();});}};}function handleEntityNotFound(_0xa4a432,_0xc110e8){return function(_0x1b3817){if(!_0x1b3817){_0xa4a432['sendStatus'](0x194);}return _0x1b3817;};}function handleError(_0x184b8d,_0x388cca){_0x388cca=_0x388cca||0x1f4;return function(_0x3e2d88){logger['error'](_0x3e2d88['stack']);if(_0x3e2d88[_0x5029('0x37')]){delete _0x3e2d88[_0x5029('0x37')];}_0x184b8d['status'](_0x388cca)['send'](_0x3e2d88);};}function getInteractionUsers(_0x9656f2,_0x157969){return new BPromise(function(_0x270d66,_0x3210cb){try{if(_0x157969[_0x9656f2['id']]){_0x9656f2[_0x5029('0x38')]=_[_0x5029('0x39')](_0x157969[_0x9656f2['id']],function(_0x3cb84e){return{'id':_0x3cb84e['id'],'fullname':_0x3cb84e[_0x5029('0x3a')]};});}}catch(_0x10eb75){_0x3210cb(_0x10eb75);}_0x270d66(_0x9656f2);});}function getInteractionTags(_0x3effa4,_0x3e5b67){return new BPromise(function(_0xbdb3fa,_0x46314a){try{if(_0x3effa4[_0x5029('0x3b')]){_0x3effa4['Tags']=[];_0x3effa4['TagIds'][_0x5029('0x3c')](',')[_0x5029('0x3d')](function(_0x423ed1){_0x3effa4['Tags'][_0x5029('0x3e')](_0x3e5b67[_0x423ed1]);});}delete _0x3effa4[_0x5029('0x3b')];}catch(_0x52572a){_0x46314a(_0x52572a);}_0xbdb3fa(_0x3effa4);});}function updateChatInteraction(_0x247789,_0x4c3e11,_0x506f0d){return new BPromise(function(_0x5653cb,_0x2a6286){return getInteractionUsers(_0x247789,_0x506f0d)[_0x5029('0x35')](function(_0x24a18d){return getInteractionTags(_0x24a18d,_0x4c3e11);})[_0x5029('0x35')](function(_0x346fd9){_0x5653cb(_0x346fd9);})[_0x5029('0x29')](function(_0x4b2219){_0x2a6286(_0x4b2219);});});}exports[_0x5029('0x3f')]=function(_0x2ae047,_0x5a3e4d){var _0x103dfb={},_0x236455={},_0x1e040d={'count':0x0,'rows':[]};var _0x1edc00=_[_0x5029('0x39')](db[_0x5029('0x40')]['rawAttributes'],function(_0x259db8){return{'name':_0x259db8[_0x5029('0x41')],'type':_0x259db8[_0x5029('0x42')][_0x5029('0x43')]};});_0x236455[_0x5029('0x44')]=_['map'](_0x1edc00,_0x5029('0x37'));_0x236455[_0x5029('0x45')]=_[_0x5029('0x46')](_0x2ae047[_0x5029('0x45')]);_0x236455[_0x5029('0x47')]=_[_0x5029('0x48')](_0x236455[_0x5029('0x44')],_0x236455[_0x5029('0x45')]);_0x103dfb[_0x5029('0x49')]=_['intersection'](_0x236455[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4a')]));_0x103dfb['attributes']=_0x103dfb['attributes'][_0x5029('0x4b')]?_0x103dfb[_0x5029('0x49')]:_0x236455[_0x5029('0x44')];if(!_0x2ae047[_0x5029('0x45')][_0x5029('0x4c')](_0x5029('0x4d'))){_0x103dfb[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x2ae047[_0x5029('0x45')][_0x5029('0x30')]);_0x103dfb[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x2f')]);}_0x103dfb[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4f')]);_0x103dfb[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x2ae047['query'],_0x236455[_0x5029('0x47')]),_0x1edc00);var _0x5e1bcb=[];var _0x189d7d=squel[_0x5029('0x52')]()['field']('id')['field'](_0x5029('0x37'))['field']('color')[_0x5029('0x53')](_0x5029('0x54'));var _0x2e4c4e=squel['select']()['field'](_0x5029('0x55'))[_0x5029('0x56')]('u.fullname')[_0x5029('0x56')]('ui.ChatInteractionId')[_0x5029('0x53')]('user_has_chat_interactions','ui')[_0x5029('0x57')](_0x5029('0x58'),'u',_0x5029('0x59'));var _0x6d03b2=squel[_0x5029('0x52')]()[_0x5029('0x53')](_0x5029('0x5a'),'i')[_0x5029('0x57')]('cm_contacts','c',_0x5029('0x5b'))['left_join'](_0x5029('0x58'),'o',_0x5029('0x5c'))['left_join'](_0x5029('0x5d'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0x5029('0x5e'))['left_join'](_0x5029('0x5f'),'it',_0x5029('0x60'))[_0x5029('0x57')]('tools_tags','t',_0x5029('0x61'));var _0x53fd4f=squel['expr']();var _0x45c7cd=[];var _0x98abd1=squel[_0x5029('0x62')]();var _0x448273;if(_0x2ae047[_0x5029('0x45')]['search']){_0x448273=as[_0x5029('0x63')](_0x2ae047[_0x5029('0x45')][_0x5029('0x64')]);var _0x4311a6=_0x448273['sqlOperator'];for(var _0x33812b=0x0;_0x33812b<_0x448273[_0x5029('0x65')]['length'];_0x33812b++){var _0x512de9=_0x448273[_0x5029('0x65')][_0x33812b];var _0x4685a6='i';var _0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x512de9[_0x5029('0x56')]]);if(!_0x1263ba){switch(_0x512de9[_0x5029('0x56')]){case _0x5029('0x67'):if(_0x512de9[_0x5029('0x68')]==0x1){_0x6d03b2[_0x5029('0x69')]('`'+_0x512de9[_0x5029('0x56')]+'`\x20=\x200');}else{_0x6d03b2['having']('`'+_0x512de9[_0x5029('0x56')]+_0x5029('0x6a'));}break;case _0x5029('0x6b'):if(_0x512de9['operator']===_0x5029('0x6c')){if(_0x512de9[_0x5029('0x68')][_0x5029('0x3c')]('\x20')[_0x5029('0x4b')]>0x1){_0x53fd4f[_0x4311a6](_0x5029('0x6d'),qs['getFullTextValue'](_0x512de9[_0x5029('0x68')]),null);}else{var _0x352736='%'+_0x512de9[_0x5029('0x68')]+'%';_0x53fd4f[_0x4311a6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x352736,_0x352736,_0x352736);}}else{_0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x5029('0x6e')]);_0x512de9['field']=_0x5029('0x6e');_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}break;case _0x5029('0x72'):var _0x1ff8df=_0x512de9[_0x5029('0x68')][_0x5029('0x3c')](',')['map'](function(_0x13ca47){return Number(_0x13ca47);});_0x1ff8df['forEach'](function(_0x2780e2){_0x98abd1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2780e2+',%');});_0x45c7cd=_[_0x5029('0x73')](_0x45c7cd,_0x1ff8df);break;case'User':if(_0x512de9[_0x5029('0x74')]==='$substring'){_0x53fd4f[_0x4311a6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x512de9[_0x5029('0x68')]+'%',null);}else{_0x1263ba=_['find'](_0x1edc00,[_0x5029('0x37'),_0x5029('0x75')]);_0x512de9[_0x5029('0x56')]='UserId';_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba['type'],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);}break;case'body':_0x236c3f=as[_0x5029('0x6f')]('me',null,_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);break;}}else{var _0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f['text'],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}}}else{var _0x21fad4=_(_0x2ae047['query'])[_0x5029('0x46')]()['map'](function(_0x4cc275){return _[_0x5029('0x76')](_0x1edc00,[_0x5029('0x37'),_0x4cc275])?_0x4cc275:undefined;})[_0x5029('0x77')]()[_0x5029('0x68')]();if(!_['isEmpty'](_0x21fad4)){_0x21fad4[_0x5029('0x3d')](function(_0x43fcc0){if(_0x43fcc0==='ChatWebsiteId'){_0x6d03b2[_0x5029('0x50')](_0x5029('0x78'),[]['concat'](_0x2ae047['query'][_0x43fcc0]));}else if(_0x43fcc0==='createdAt'){var _0x7441d8=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7a')];var _0x46be5a=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7b')];_0x6d03b2[_0x5029('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7441d8,_0x46be5a);}else{if(_0x2ae047['query'][_0x43fcc0]===_0x5029('0x7c')){_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7d'));}else{_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7e'),_0x2ae047[_0x5029('0x45')][_0x43fcc0]);}}});}if(_0x2ae047[_0x5029('0x45')]['read']){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x7f')]==0x1){_0x6d03b2[_0x5029('0x69')]('`unreadMessages`\x20=\x200');}else{_0x6d03b2[_0x5029('0x69')](_0x5029('0x80'));}}if(_0x2ae047[_0x5029('0x45')]['tag']){_0x45c7cd=_[_0x5029('0x81')](_0x2ae047[_0x5029('0x45')][_0x5029('0x82')])?_0x2ae047['query'][_0x5029('0x82')]:new Array(_0x2ae047[_0x5029('0x45')]['tag']);_0x45c7cd[_0x5029('0x3d')](function(_0x42d795){_0x98abd1['or'](_0x5029('0x83'),'%,'+_0x42d795+',%');});}if(_0x2ae047[_0x5029('0x45')][_0x5029('0x84')]){var _0x4a2f3a=_0x2ae047[_0x5029('0x45')][_0x5029('0x84')][_0x5029('0x85')]('\x5c','\x5c\x5c')[_0x5029('0x85')]('\x27\x27',_0x5029('0x86'));if(qs['isNumeric'](_0x4a2f3a)){_0x53fd4f['or'](_0x5029('0x87'),_0x4a2f3a+'%');}else{_0x53fd4f['or'](_0x5029('0x88'),qs[_0x5029('0x89')](_0x4a2f3a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4a2f3a+'%');}}}_0x6d03b2[_0x5029('0x50')](_0x53fd4f);_0x6d03b2[_0x5029('0x8a')](_0x5029('0x8b'));var _0x3e47bd={'type':db[_0x5029('0x1c')][_0x5029('0x8c')][_0x5029('0x8d')],'raw':!![]};var _0x5e2c3e=_0x6d03b2[_0x5029('0x8e')]();_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8b'));_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');if(_0x103dfb[_0x5029('0x4e')]){_0x103dfb[_0x5029('0x4e')][_0x5029('0x3d')](function(_0x4f2ceb){_0x6d03b2[_0x5029('0x4e')]('i.'+_0x4f2ceb[0x0],_0x4f2ceb[0x1]===_0x5029('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45c7cd)){_0x6d03b2['having'](_0x98abd1);_0x5e2c3e['where'](_0x5029('0x91'),_0x45c7cd);}BPromise[_0x5029('0x92')]()[_0x5029('0x35')](function(){if(!_0x448273){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x93')]||_0x2ae047['query'][_0x5029('0x94')])return;_0x5e2c3e[_0x5029('0x50')](_0x5029('0x95'));_0x6d03b2['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x2ae047[_0x5029('0x96')][_0x5029('0x97')]({'attributes':['id'],'raw':!![]})[_0x5029('0x35')](function(_0x24a8f6){if(_['isEmpty'](_0x24a8f6)){_0x5e2c3e[_0x5029('0x50')](_0x5029('0x98'));_0x6d03b2[_0x5029('0x50')](_0x5029('0x98'));}else{_0x5e2c3e[_0x5029('0x50')](_0x5029('0x78'),_[_0x5029('0x39')](_0x24a8f6,'id'));_0x6d03b2[_0x5029('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5029('0x39')](_0x24a8f6,'id'));}});})['then'](function(){db['sequelize'][_0x5029('0x45')](_0x5e2c3e['toString'](),_0x3e47bd)[_0x5029('0x35')](function(_0xe7fa61){_0x1e040d[_0x5029('0x2e')]=_0xe7fa61[_0x5029('0x4b')];if(_0x1e040d[_0x5029('0x2e')]===0x0)return[];return db[_0x5029('0x99')][_0x5029('0x45')](_0x189d7d[_0x5029('0x9a')](),_0x3e47bd)['then'](function(_0x5b7694){_0x5e1bcb=_[_0x5029('0x9b')](_0x5b7694,'id');_0x3e47bd=_['merge'](_0x3e47bd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ae047[_0x5029('0x45')]['fields']){_0x103dfb['attributes'][_0x5029('0x3d')](function(_0xb8da0b){_0x6d03b2[_0x5029('0x56')]('i.'+_0xb8da0b);});}else{_0x6d03b2[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');_0x6d03b2[_0x5029('0x56')](_0x5029('0x9c'),_0x5029('0x9d'));_0x6d03b2['field'](_0x5029('0x9e'),_0x5029('0x9f'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa0'));_0x6d03b2[_0x5029('0x56')]('c.firstName','Contact.firstName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa1'),'Contact.lastName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa2'),_0x5029('0xa3'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa4'),_0x5029('0xa5'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa6'),'Contact.mobile');_0x6d03b2['field'](_0x5029('0xa7'),'Contact.fax');_0x6d03b2[_0x5029('0x56')]('o.fullname',_0x5029('0xa8'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa9'),'Owner.internal');_0x6d03b2[_0x5029('0x56')](_0x5029('0xaa'),_0x5029('0x3b'));}if(_0x103dfb['limit'])_0x6d03b2[_0x5029('0x30')](_0x103dfb[_0x5029('0x30')]);if(_0x103dfb[_0x5029('0x2f')])_0x6d03b2[_0x5029('0x2f')](_0x103dfb[_0x5029('0x2f')]);return db[_0x5029('0x99')][_0x5029('0x45')](_0x6d03b2[_0x5029('0x9a')](),_0x3e47bd);})[_0x5029('0x35')](function(_0x1834f2){_0x2e4c4e[_0x5029('0x50')](_0x5029('0xab'),_[_0x5029('0x39')](_0x1834f2,'id'));return db[_0x5029('0x99')][_0x5029('0x45')](_0x2e4c4e[_0x5029('0x9a')](),_0x3e47bd)[_0x5029('0x35')](function(_0x2468fa){var _0x4da8f8=_[_0x5029('0xac')](_0x2468fa,_0x5029('0xad'));var _0x2102ef=[];_0x1834f2[_0x5029('0x3d')](function(_0x34494c){_0x2102ef['push'](updateChatInteraction(_0x34494c,_0x5e1bcb,_0x4da8f8));});return BPromise[_0x5029('0xae')](_0x2102ef);});});})[_0x5029('0x35')](function(_0xec074c){_0x1e040d[_0x5029('0xaf')]=_0xec074c;return _0x1e040d;})[_0x5029('0x35')](respondWithFilteredResult(_0x5a3e4d,_0x103dfb));})['catch'](handleError(_0x5a3e4d,null));};exports[_0x5029('0xb0')]=function(_0x46be82,_0x20b00e){var _0x139971={'raw':![],'where':{'id':_0x46be82['params']['id']}},_0x3c601c={};_0x3c601c[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0x40')][_0x5029('0xb1')]);_0x3c601c[_0x5029('0x45')]=_[_0x5029('0x46')](_0x46be82[_0x5029('0x45')]);_0x3c601c[_0x5029('0x47')]=_['intersection'](_0x3c601c['model'],_0x3c601c[_0x5029('0x45')]);_0x139971[_0x5029('0x49')]=_[_0x5029('0x48')](_0x3c601c[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x46be82['query'][_0x5029('0x4a')]));_0x139971['attributes']=_0x139971[_0x5029('0x49')][_0x5029('0x4b')]?_0x139971[_0x5029('0x49')]:_0x3c601c[_0x5029('0x44')];if(_0x46be82[_0x5029('0x45')][_0x5029('0xb2')]){_0x139971['include']=[{'all':!![]}];}_0x139971=_[_0x5029('0xb3')]({},_0x139971,_0x46be82[_0x5029('0xb4')]);return db['ChatInteraction'][_0x5029('0x66')](_0x139971)[_0x5029('0x35')](handleEntityNotFound(_0x20b00e,null))['then'](respondWithResult(_0x20b00e,null))[_0x5029('0x29')](handleError(_0x20b00e,null));};exports['create']=function(_0x54c0f3,_0x50d603){return db['ChatInteraction'][_0x5029('0xb5')](_0x54c0f3['body'],{})[_0x5029('0x35')](respondWithResult(_0x50d603,0xc9))[_0x5029('0x29')](handleError(_0x50d603,null));};exports['update']=function(_0x28fc01,_0x2084cf){if(_0x28fc01['body']['id']){delete _0x28fc01[_0x5029('0xb6')]['id'];}return db[_0x5029('0x40')]['find']({'where':{'id':_0x28fc01[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x2084cf,null))['then'](saveUpdates(_0x28fc01[_0x5029('0xb6')],null))[_0x5029('0x35')](respondWithResult(_0x2084cf,null))[_0x5029('0x29')](handleError(_0x2084cf,null));};exports[_0x5029('0x36')]=function(_0xf57e38,_0x233ce5){return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0xf57e38['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x233ce5,null))[_0x5029('0x35')](removeEntity(_0x233ce5,null))[_0x5029('0x29')](handleError(_0x233ce5,null));};exports[_0x5029('0xb8')]=function(_0x3e4f7d,_0x2138cc){return db[_0x5029('0x40')][_0x5029('0xb8')]()[_0x5029('0x35')](respondWithResult(_0x2138cc,null))[_0x5029('0x29')](handleError(_0x2138cc,null));};exports[_0x5029('0xb9')]=function(_0x41ca12,_0x14f995){var _0x3ccdc9=_0x41ca12[_0x5029('0xb7')]['id'];var _0x2ac88e;var _0x55ee4f;var _0x1fa9eb;return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x3ccdc9}})[_0x5029('0x35')](function(_0x1ebc8c){_0x2ac88e=_0x1ebc8c;return db[_0x5029('0xbb')]['findOne']({'where':{'id':_0x1ebc8c[_0x5029('0x93')]},'attributes':['id',_0x5029('0xbc'),_0x5029('0xbd')],'raw':!![]});})[_0x5029('0x35')](function(_0x156da){if(_0x156da&&_0x156da['vidaooApiKey']&&_0x156da[_0x5029('0xbd')]){_0x55ee4f=_0x156da;var _0x2a3025={'rejectUnauthorized':![],'method':_0x5029('0xbe'),'uri':_0x5029('0xbf'),'headers':{'X-APIKEY':_0x156da[_0x5029('0xbc')]},'body':{'name':_0x5029('0xc0')+_0x3ccdc9},'redirect':_0x5029('0xc1'),'json':!![]};return rp(_0x2a3025);}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0xc2'));}})['then'](function(_0xb26cc0){_0x1fa9eb=_0xb26cc0;if(_0x1fa9eb['id']){var _0x4ac3b8={'body':_0x1fa9eb[_0x5029('0xc3')],'ChatWebsiteId':_0x55ee4f['id'],'ChatInteractionId':_0x2ac88e['id'],'direction':_0x5029('0xc4'),'UserId':_0x41ca12[_0x5029('0x96')]['id']};return db[_0x5029('0xc5')]['create'](_0x4ac3b8,{});}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5029('0x35')](function(){return _0x2ac88e[_0x5029('0xc6')]({'vidaooSessionId':_0x1fa9eb['id']});})['then'](respondWithResult(_0x14f995,null))[_0x5029('0x29')](handleError(_0x14f995,null));};exports[_0x5029('0xc7')]=function(_0x5b290f,_0x4a5d3e){if(_0x5b290f[_0x5029('0xb6')]['id']){delete _0x5b290f['body']['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x5b290f['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x4a5d3e,null))[_0x5029('0x35')](saveUpdates(_0x5b290f['body'],null))[_0x5029('0x35')](respondWithResult(_0x4a5d3e,null))[_0x5029('0x29')](handleError(_0x4a5d3e,null));};exports['abandon']=function(_0x3ac39a,_0x37c47b,_0x62e4af){if(_0x3ac39a['body']['id']){delete _0x3ac39a[_0x5029('0xb6')]['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x3ac39a[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](function(_0x5e7ec8){if(!_0x5e7ec8){logger[_0x5029('0x24')](_0x5029('0xc8'),'abandon',0x194,_0x5029('0xc9'));_0x37c47b[_0x5029('0x2a')](0x194);}else{if(_0x5e7ec8['UserId']){throw new db['Sequelize'][(_0x5029('0x1d'))](_0x5029('0xca'));}}return _0x5e7ec8;})['then'](function(_0x5842a5){if(_0x5842a5){return _0x5842a5['update']({'closed':_0x3ac39a[_0x5029('0xb6')][_0x5029('0xcb')],'disposition':_0x3ac39a[_0x5029('0xb6')]['disposition']})[_0x5029('0x35')](function(_0x581237){return _0x581237;});}})[_0x5029('0x35')](function(_0x5de481){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3ac39a['body'],client9004);})[_0x5029('0x35')](respondWithResult(_0x37c47b,null))[_0x5029('0x29')](handleError(_0x37c47b,null));};exports[_0x5029('0xcc')]=function(_0x11f39c,_0x12ba67,_0x5b0939){_0x11f39c[_0x5029('0xb6')][_0x5029('0x37')]=_0x11f39c[_0x5029('0xcd')][_0x5029('0xce')];_0x11f39c[_0x5029('0xb6')][_0x5029('0xcf')]=_0x11f39c['file'][_0x5029('0xd0')];_0x11f39c[_0x5029('0xb6')][_0x5029('0x42')]=_0x11f39c['file']['mimetype'];return db[_0x5029('0xd1')][_0x5029('0xb5')](_0x11f39c[_0x5029('0xb6')])[_0x5029('0x35')](respondWithResult(_0x12ba67,0xc9))[_0x5029('0x29')](handleError(_0x12ba67,null));};exports[_0x5029('0xd2')]=function(_0x181970,_0x10a16e,_0x47b508){return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0xb7')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null))[_0x5029('0x35')](function(_0x594896){if(_0x594896){if(_0x594896[_0x5029('0xcb')]){return _0x10a16e[_0x5029('0x2c')](0x193)[_0x5029('0x2d')]({'status':0x193,'message':_0x5029('0xd3')});}return db[_0x5029('0xd1')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0x45')][_0x5029('0xd4')]},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null));}})['then'](function(_0x4dc23a){if(_0x4dc23a){return _0x10a16e[_0x5029('0xd5')](path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xd8'),_0x4dc23a[_0x5029('0xcf')]));}})['catch'](handleError(_0x10a16e,null));};exports[_0x5029('0xd9')]=function(_0x17dfbd,_0xa26684){var _0x156450=null;var _0x3bb095=null;var _0x4ee7b0=null;var _0x32b1b4=null;if(_0x17dfbd[_0x5029('0xb6')]['id']){delete _0x17dfbd[_0x5029('0xb6')]['id'];}if(_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]){_0x32b1b4=path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xdb'),util[_0x5029('0xdc')](_0x5029('0xdd'),Date[_0x5029('0xde')]()));_0x17dfbd[_0x5029('0xb6')][_0x5029('0xdf')]=_0x32b1b4;}return db['ChatInteraction']['find']({'where':{'id':_0x17dfbd[_0x5029('0xb7')]['id']},'include':[{'model':db[_0x5029('0xc5')],'as':'Messages','include':[{'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0')}]}]})['then'](handleEntityNotFound(_0xa26684,null))[_0x5029('0x35')](saveUpdates(_0x17dfbd[_0x5029('0xb6')],null))[_0x5029('0x35')](function(_0x54794c){if(_0x54794c){_0x156450=_0x54794c;return db[_0x5029('0xbb')][_0x5029('0x66')]({'where':{'id':_0x156450['ChatWebsiteId']}});}})[_0x5029('0x35')](function(_0x50637d){if(_0x50637d){_0x4ee7b0=_0x50637d;return db['CmContact'][_0x5029('0x66')]({'where':{'id':_0x156450['ContactId']}});}})[_0x5029('0x35')](function(_0x139540){if(_0x139540){_0x3bb095=_0x139540;if(_0x32b1b4){var _0x35f7b5=null;for(var _0x58b3e7=0x1;_0x58b3e7<_0x156450[_0x5029('0xe1')]['length'];++_0x58b3e7){_0x35f7b5=_0x156450['Messages'][_0x58b3e7];var _0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5['UserId']):_0x5029('0xe4');var _0x1caa56=_0x17dfbd[_0x5029('0xb6')][_0x5029('0xe5')]||util[_0x5029('0xdc')](_0x5029('0xe2'),'Visitor',_0x35f7b5['ContactId']);switch(_0x4ee7b0[_0x5029('0xe6')]){case _0x5029('0xe7'):_0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')]('%s%d',_0x4ee7b0['agentAlias'],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');break;case _0x5029('0xe8'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0xe9')]||_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;case _0x5029('0xea'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;default:_0x196706=_0x35f7b5[_0x5029('0x75')]?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');}var _0x38bb6b=util['format'](_0x5029('0xeb'),moment(_0x35f7b5[_0x5029('0xec')])[_0x5029('0xdc')]('MM/DD/YYYY\x20HH:mm:ss'),_0x35f7b5[_0x5029('0xed')]==='in'?_0x1caa56:_0x196706,_0x35f7b5['body']);if(!_0x35f7b5['secret']){fs[_0x5029('0xee')](_0x32b1b4,_0x38bb6b);}}return db[_0x5029('0xef')][_0x5029('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x5029('0xf0')],'as':_0x5029('0xf1'),'raw':!![]}]});}}})[_0x5029('0x35')](function(_0x2f3103){if(_0x2f3103&&_0x2f3103['Smtp']&&_0x17dfbd[_0x5029('0xb6')]){var _0x47b6de={'tls':{'rejectUnauthorized':![]}};if(_0x2f3103['Smtp'][_0x5029('0xf2')]){_0x47b6de[_0x5029('0xf2')]=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf2')];}else{_0x47b6de[_0x5029('0xf3')]=_0x2f3103['Smtp']['host'];_0x47b6de['port']=_0x2f3103['Smtp']['port'];_0x47b6de['secure']=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf4')];}if(_0x2f3103[_0x5029('0xf1')][_0x5029('0xf5')]){_0x47b6de[_0x5029('0xf6')]={'user':_0x2f3103['Smtp'][_0x5029('0x96')],'pass':_0x2f3103['Smtp'][_0x5029('0xf7')]};}return respondWithRpcPromise(_0x5029('0xf8'),'sendMail',{'account':_0x47b6de,'message':{'from':util[_0x5029('0xdc')](_0x5029('0xf9'),_0x2f3103['name'],_0x2f3103['email']||_0x2f3103[_0x5029('0xf1')]['user']),'to':_0x17dfbd[_0x5029('0xb6')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]),'attachments':[{'path':_0x32b1b4}]}})['then'](function(){return _0x156450;})['catch'](function(_0x4aa892){console['error'](_0x4aa892);});}else{return _0x156450;}})[_0x5029('0x35')](respondWithStatusCode(_0xa26684,0xc8))[_0x5029('0x29')](handleError(_0xa26684,null));};exports['addMessage']=function(_0x28dc2d,_0xb6d199,_0x54f1cb){return db[_0x5029('0xc5')][_0x5029('0x66')]({'where':{'id':_0x28dc2d[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xb6d199,null))[_0x5029('0x35')](function(_0x1d52b5){if(_0x1d52b5){return _0x1d52b5[_0x5029('0xfa')](_0x28dc2d[_0x5029('0xb6')][_0x5029('0xfb')],_['omit'](_0x28dc2d[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{});}})[_0x5029('0x35')](respondWithResult(_0xb6d199,null))[_0x5029('0x29')](handleError(_0xb6d199,null));};exports[_0x5029('0xfc')]=function(_0xa0b531,_0xe35b61,_0x32c365){var _0x4f8884={'raw':![],'where':{}};var _0x2e5925={};var _0x5e2547={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5029('0xba')]({'where':{'id':_0xa0b531['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xe35b61,null))['then'](function(_0x3f64e1){if(_0x3f64e1){_0x2e5925[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0xc5')][_0x5029('0xb1')]);_0x2e5925['query']=_[_0x5029('0x46')](_0xa0b531[_0x5029('0x45')]);_0x2e5925[_0x5029('0x47')]=_[_0x5029('0x48')](_0x2e5925[_0x5029('0x44')],_0x2e5925[_0x5029('0x45')]);_0x4f8884[_0x5029('0x49')]=_['intersection'](_0x2e5925[_0x5029('0x44')],qs['fields'](_0xa0b531[_0x5029('0x45')][_0x5029('0x4a')]));_0x4f8884[_0x5029('0x49')]=_0x4f8884[_0x5029('0x49')]['length']?_0x4f8884[_0x5029('0x49')]:_0x2e5925[_0x5029('0x44')];if(!_0xa0b531['query']['hasOwnProperty'](_0x5029('0x4d'))){_0x4f8884[_0x5029('0x30')]=qs[_0x5029('0x30')](_0xa0b531[_0x5029('0x45')]['limit']);_0x4f8884[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0xa0b531['query'][_0x5029('0x2f')]);}_0x4f8884[_0x5029('0x4e')]=qs['sort'](_0xa0b531[_0x5029('0x45')]['sort']);_0x4f8884[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0xa0b531[_0x5029('0x45')],_0x2e5925['filters']));_0x4f8884[_0x5029('0x50')]['ChatInteractionId']=_0x3f64e1['id'];if(_0xa0b531[_0x5029('0x45')]['filter']){_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884[_0x5029('0x50')],{'$or':_['map'](_0x4f8884[_0x5029('0x49')],function(_0x37fb59){var _0x58cfe1={};_0x58cfe1[_0x37fb59]={'$like':'%'+_0xa0b531['query'][_0x5029('0x84')]+'%'};return _0x58cfe1;})});}if(_0xa0b531[_0x5029('0x45')][_0x5029('0x7a')]){var _0x239e86=_0xa0b531[_0x5029('0x45')]['$gte'][_0x5029('0x3c')](',');var _0x2fc922={};_0x2fc922[_0x239e86[0x0]]={'$gte':moment(_0x239e86[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884['where'],_0x2fc922);}_0x4f8884=_[_0x5029('0xb3')]({},_0x4f8884,_0xa0b531[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x4f8884[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x7b22ad){_0x5e2547['count']=_0x7b22ad;if(_0xa0b531[_0x5029('0x45')][_0x5029('0xb2')]){_0x4f8884[_0x5029('0xfd')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f8884);})[_0x5029('0x35')](function(_0x29ac1d){_0x5e2547['rows']=_0x29ac1d;return _0x5e2547;});}})['then'](respondWithFilteredResult(_0xe35b61,_0x4f8884))['catch'](handleError(_0xe35b61,null));};exports[_0x5029('0xfe')]=function(_0x523b0d,_0x57d3af,_0x10cf6b){var _0x6ae483={'where':{}},_0x5405a1={},_0x4b7d7e={'count':0x0,'rows':[]};return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x523b0d[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x57d3af,null))['then'](function(_0x53e729){if(_0x53e729){_0x5405a1[_0x5029('0x44')]=_['keys'](db[_0x5029('0xc5')]['rawAttributes']);_0x5405a1['query']=_[_0x5029('0x46')](_0x523b0d[_0x5029('0x45')]);_0x5405a1[_0x5029('0x47')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],_0x5405a1['query']);_0x6ae483[_0x5029('0x49')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x523b0d[_0x5029('0x45')][_0x5029('0x4a')]));_0x6ae483['attributes']=_0x6ae483[_0x5029('0x49')][_0x5029('0x4b')]?_0x6ae483[_0x5029('0x49')]:_0x5405a1['model'];if(!_0x523b0d['query'][_0x5029('0x4c')](_0x5029('0x4d'))){_0x6ae483[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x523b0d[_0x5029('0x45')][_0x5029('0x30')]);_0x6ae483[_0x5029('0x2f')]=qs['offset'](_0x523b0d['query'][_0x5029('0x2f')]);}_0x6ae483[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x523b0d[_0x5029('0x45')]['sort']);_0x6ae483[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x523b0d['query'],_0x5405a1[_0x5029('0x47')]));_0x6ae483[_0x5029('0x50')][_0x5029('0xad')]=_0x53e729['id'];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]){_0x6ae483[_0x5029('0x50')]=_[_0x5029('0xb3')](_0x6ae483[_0x5029('0x50')],{'$or':_[_0x5029('0x39')](_0x6ae483[_0x5029('0x49')],function(_0x3eae37){var _0x290290={};_0x290290[_0x3eae37]={'$like':'%'+_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]+'%'};return _0x290290;})});}_0x6ae483[_0x5029('0x50')][_0x5029('0xff')]=![];if(_0x523b0d[_0x5029('0x45')]['id']){_0x6ae483['where']['id']={'$gt':_0x523b0d[_0x5029('0x45')]['id']};}_0x6ae483=_[_0x5029('0xb3')]({},_0x6ae483,_0x523b0d[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x6ae483[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x5e9494){_0x4b7d7e[_0x5029('0x2e')]=_0x5e9494;_0x6ae483[_0x5029('0xfd')]=[];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x100')]){_0x6ae483[_0x5029('0xfd')][_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0xe0'),'attributes':['id','fullname',_0x5029('0xe9')]});}if(_0x523b0d[_0x5029('0x45')][_0x5029('0xb2')]){_0x6ae483[_0x5029('0xfd')]=[{'all':!![]}];}return db[_0x5029('0xc5')]['findAll'](_0x6ae483);})[_0x5029('0x35')](function(_0x44c4f2){_0x4b7d7e['rows']=_0x44c4f2;return _0x4b7d7e;});}})[_0x5029('0x35')](respondWithFilteredResult(_0x57d3af,_0x6ae483))['catch'](handleError(_0x57d3af,null));};exports[_0x5029('0x101')]=function(_0x4246b3,_0x26b20e,_0x1210f8){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x4246b3[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x26b20e,null))['then'](function(_0x3355f8){if(_0x3355f8){return _0x3355f8[_0x5029('0x102')](_0x4246b3[_0x5029('0xb6')]['ids'],_[_0x5029('0x103')](_0x4246b3[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{})[_0x5029('0x104')](function(){return db[_0x5029('0x72')][_0x5029('0x105')]({'attributes':['id',_0x5029('0x37'),_0x5029('0x106')],'where':{'id':_0x4246b3[_0x5029('0xb6')][_0x5029('0xfb')]}});})['then'](function(_0x351108){socket[_0x5029('0x107')](_0x5029('0x108'),{'id':Number(_0x4246b3[_0x5029('0xb7')]['id']),'tags':_0x351108||[]});return{'id':Number(_0x4246b3['params']['id']),'tags':_0x351108||[]};});}})[_0x5029('0x35')](respondWithResult(_0x26b20e,null))[_0x5029('0x29')](handleError(_0x26b20e,null));};exports[_0x5029('0x109')]=function(_0x353828,_0x462d02,_0xf147f9){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x353828['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x462d02,null))[_0x5029('0x35')](function(_0x4050ba){if(_0x4050ba){return _0x4050ba[_0x5029('0x109')](_0x353828[_0x5029('0x45')]['ids']);}})[_0x5029('0x35')](respondWithStatusCode(_0x462d02,null))[_0x5029('0x29')](handleError(_0x462d02,null));};exports[_0x5029('0xd5')]=function(_0x5c119a,_0x12c8ab){var _0x45d7ea=moment()[_0x5029('0x10a')]()['toString']();var _0xcd3b26=path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x10b'),_0x5029('0x10c'));var _0x45b31f=path[_0x5029('0xd6')](config['root'],_0x5029('0x10d'),_0x5029('0x10b'),_0x5029('0x10e'));var _0x195b81=path['join'](_0xcd3b26,_0x45d7ea);var _0x32c962=util['format'](_0x5029('0x10f'),_0x5c119a['params']['id'],_0x45d7ea);var _0x3b20f9=path[_0x5029('0xd6')](_0xcd3b26,_0x32c962);var _0x52f005=[];_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0'),'attributes':['id','fullname'],'raw':!![]});_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0x110')],'as':_0x5029('0x6b'),'attributes':['id',_0x5029('0x111'),'lastName'],'raw':!![]});if(_0x5c119a[_0x5029('0x45')]['attachments']){_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xd1')],'as':_0x5029('0xd1'),'raw':!![]});}var _0x54523d=[{'model':db[_0x5029('0xc5')],'as':_0x5029('0xe1'),'attributes':['id','body',_0x5029('0xec'),'direction','secret',_0x5029('0x7f')],'include':_0x52f005}];_0x54523d[_0x5029('0x3e')]({'model':db['ChatWebsite'],'as':_0x5029('0x112'),'attributes':['id',_0x5029('0x37')]});_0x54523d[_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0x113'),'attributes':['id','fullname']});return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x5c119a[_0x5029('0xb7')]['id']},'include':_0x54523d})[_0x5029('0x35')](handleEntityNotFound(_0x12c8ab,null))[_0x5029('0x35')](function(_0x568b05){if(_0x568b05){var _0x19fb32=_0x568b05['get']({'plain':!![]});fs[_0x5029('0x114')](_0x195b81);var _0x524300={'format':'A4','border':'10px','header':{'height':_0x5029('0x115'),'contents':{'first':_0x5029('0x116')}},'footer':{'height':_0x5029('0x117'),'contents':{'default':util[_0x5029('0xdc')](_0x5029('0x118'),util[_0x5029('0xdc')](_0x5029('0x119'),_0x5029('0x11a'),_0x19fb32['id']),moment()[_0x5029('0xdc')](_0x5029('0x11b'))[_0x5029('0x9a')]())}}};var _0x8456be={'channel':_0x5029('0x11a'),'account':_0x19fb32['Account'][_0x5029('0x37')],'agent':_0x19fb32[_0x5029('0x113')]?_0x19fb32[_0x5029('0x113')]['fullname']:_0x5029('0x11c'),'createdAt':moment(_0x19fb32['createdAt'])[_0x5029('0xdc')](_0x5029('0x11d'))['toString'](),'closedAt':_0x19fb32['closed']?moment(_0x19fb32[_0x5029('0x11e')])[_0x5029('0xdc')](_0x5029('0x11d'))[_0x5029('0x9a')]():'','disposition':_0x19fb32[_0x5029('0x11f')],'chatInfo':{'browser':_0x19fb32[_0x5029('0x120')],'os':_0x19fb32['osName'],'referer':_0x19fb32['referer'],'customerIp':_0x19fb32[_0x5029('0x121')],'customerPort':_0x19fb32[_0x5029('0x122')]?_0x19fb32[_0x5029('0x122')]:_0x5029('0x11c')},'messages':_(_0x19fb32['Messages'])[_0x5029('0x123')]()[_0x5029('0x84')]({'secret':![]})[_0x5029('0x39')](function(_0x24fb0a){if(_0x24fb0a[_0x5029('0xd1')]){var _0x8b8ea4=path[_0x5029('0xd6')](_0x45b31f,_0x24fb0a[_0x5029('0xd1')][_0x5029('0xcf')]);if(fs[_0x5029('0x124')](_0x8b8ea4)){fs[_0x5029('0x125')](_0x8b8ea4)[_0x5029('0x126')](fs['createWriteStream'](path['join'](_0x195b81,_0x24fb0a[_0x5029('0xd1')]['basename'])));}}return{'date':moment(_0x24fb0a[_0x5029('0xec')])['format'](_0x5029('0x11d'))[_0x5029('0x9a')](),'sender':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?_0x24fb0a[_0x5029('0xe0')]?_0x24fb0a[_0x5029('0xe0')]['fullname']:_0x5029('0xe4'):_0x24fb0a['Contact'][_0x5029('0x111')]+(_0x24fb0a['Contact']['lastName']?'\x20'+_0x24fb0a[_0x5029('0x6b')][_0x5029('0x127')]:''),'body':_0x24fb0a[_0x5029('0xd1')]?_0x24fb0a['Attachment']['basename']:_0x24fb0a['body'],'direction':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?'A':'C','secret':_0x24fb0a[_0x5029('0xff')],'read':_0x24fb0a[_0x5029('0x7f')],'attachment':_0x24fb0a[_0x5029('0xd1')]};})[_0x5029('0x68')]()};return ejs['renderFile'](path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x128'),'downloadInteraction.html'),{'interaction':_0x8456be})[_0x5029('0x35')](function(_0x22cff6){return new BPromise(function(_0x557bc0,_0x3b9b79){pdf['create'](_0x22cff6,_0x524300)[_0x5029('0x129')](path[_0x5029('0xd6')](_0x195b81,_0x5029('0x12a')+_0x19fb32['id']+'-'+_0x45d7ea+_0x5029('0x12b')),function(_0x348ca3,_0x1f1322){if(_0x348ca3)return _0x3b9b79(_0x348ca3);_0x557bc0(_0x1f1322);});});})[_0x5029('0x35')](function(){return new BPromise(function(_0xd4c200,_0x3d5e48){zipdir(_0x195b81,{'saveTo':_0x3b20f9},function(_0x437897,_0x2aef6b){if(_0x437897)return _0x3d5e48(_0x437897);return _0xd4c200(_0x2aef6b);});})[_0x5029('0x35')](function(){return new BPromise(function(_0x3da175,_0x3d9ff4){rimraf(_0x195b81,function(_0x1680eb){if(_0x1680eb)_0x3d9ff4(_0x1680eb);return _0x3da175();});});})['then'](function(){return _0x12c8ab[_0x5029('0xd5')](_0x3b20f9,_0x32c962,function(_0xb7a7fb){if(_0xb7a7fb){console[_0x5029('0x12c')](_0x5029('0x12d'),_0xb7a7fb);}else{fs[_0x5029('0x12e')](_0x3b20f9);}});});});}else{return _0x12c8ab[_0x5029('0x2a')](0xc8);}})['catch'](handleError(_0x12c8ab,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d1a1663..45be3d4 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 _0xbc25=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbc25,0x79));var _0x5bc2=function(_0x263b9f,_0x510f5a){_0x263b9f=_0x263b9f-0x0;var _0x4db4ab=_0xbc25[_0x263b9f];return _0x4db4ab;};'use strict';var EventEmitter=require(_0x5bc2('0x0'));var ChatInteraction=require(_0x5bc2('0x1'))['db'][_0x5bc2('0x2')];var ChatMessage=require(_0x5bc2('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5bc2('0x3')](0x0);var events={'afterCreate':_0x5bc2('0x4'),'afterUpdate':_0x5bc2('0x5'),'afterDestroy':_0x5bc2('0x6')};function emitEvent(_0x4df86b){return function(_0x6e1426,_0x1c498f,_0x3f7167){_0x6e1426[_0x5bc2('0x7')]({'attributes':['id'],'raw':!![]})[_0x5bc2('0x8')](function(_0x2d6300){_0x6e1426[_0x5bc2('0x9')](_0x5bc2('0xa'),_0x2d6300[_0x5bc2('0xb')](function(_0xb1a127){return{'id':_0xb1a127['id']};}));return ChatMessage[_0x5bc2('0xc')]({'where':{'ChatInteractionId':_0x6e1426['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x135be4){_0x6e1426[_0x5bc2('0x9')]('unreadMessages',_0x135be4[_0x5bc2('0xd')]);ChatInteractionEvents[_0x5bc2('0xe')](_0x4df86b+':'+_0x6e1426['id'],_0x6e1426);ChatInteractionEvents[_0x5bc2('0xe')](_0x4df86b,_0x6e1426);_0x3f7167(null);})[_0x5bc2('0xf')](_0x3f7167(null));};}for(var e in events){if(events[_0x5bc2('0x10')](e)){var event=events[e];ChatInteraction[_0x5bc2('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xf23c=['remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x2ff08f,_0x591f36){var _0x3aac4d=function(_0x4427ff){while(--_0x4427ff){_0x2ff08f['push'](_0x2ff08f['shift']());}};_0x3aac4d(++_0x591f36);}(_0xf23c,0x77));var _0xcf23=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0xf23c[_0x12a554];return _0x244ba0;};'use strict';var EventEmitter=require(_0xcf23('0x0'));var ChatInteraction=require(_0xcf23('0x1'))['db'][_0xcf23('0x2')];var ChatMessage=require(_0xcf23('0x1'))['db'][_0xcf23('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xcf23('0x4')](0x0);var events={'afterCreate':_0xcf23('0x5'),'afterUpdate':_0xcf23('0x6'),'afterDestroy':_0xcf23('0x7')};function emitEvent(_0x33f3de){return function(_0x224af1,_0xae84fe,_0x29d89c){_0x224af1[_0xcf23('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f4744){_0x224af1[_0xcf23('0x9')](_0xcf23('0xa'),_0x4f4744[_0xcf23('0xb')](function(_0x2a2680){return{'id':_0x2a2680['id']};}));return ChatMessage[_0xcf23('0xc')]({'where':{'ChatInteractionId':_0x224af1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf23('0xd')](function(_0xd4290a){_0x224af1[_0xcf23('0x9')]('unreadMessages',_0xd4290a[_0xcf23('0xe')]);ChatInteractionEvents[_0xcf23('0xf')](_0x33f3de+':'+_0x224af1['id'],_0x224af1);ChatInteractionEvents[_0xcf23('0xf')](_0x33f3de,_0x224af1);_0x29d89c(null);})[_0xcf23('0x10')](_0x29d89c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xcf23('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 26fb65c..91142a9 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 _0x84e7=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define'];(function(_0x5d7230,_0x5caa8e){var _0x507b7f=function(_0x53b85b){while(--_0x53b85b){_0x5d7230['push'](_0x5d7230['shift']());}};_0x507b7f(++_0x5caa8e);}(_0x84e7,0x1c0));var _0x784e=function(_0x22e41a,_0x112e7f){_0x22e41a=_0x22e41a-0x0;var _0x3b3be4=_0x84e7[_0x22e41a];return _0x3b3be4;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))(_0x784e('0x2'));var moment=require(_0x784e('0x3'));var BPromise=require(_0x784e('0x4'));var rp=require(_0x784e('0x5'));var fs=require('fs');var path=require(_0x784e('0x6'));var rimraf=require(_0x784e('0x7'));var config=require('../../config/environment');var attributes=require(_0x784e('0x8'));module[_0x784e('0x9')]=function(_0x29275e,_0x525abc){return _0x29275e[_0x784e('0xa')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x69977f,_0x338050,_0x33514b){if(_0x69977f[_0x784e('0xb')](_0x784e('0xc'))){_0x69977f[_0x784e('0xd')]=moment()[_0x784e('0xe')](_0x784e('0xf'));}_0x33514b(null,_0x69977f);}},'charset':_0x784e('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd984=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','utf8mb4'];(function(_0x4c004f,_0x5f2d9f){var _0x2d56d8=function(_0x5b5b5a){while(--_0x5b5b5a){_0x4c004f['push'](_0x4c004f['shift']());}};_0x2d56d8(++_0x5f2d9f);}(_0xd984,0x6a));var _0x4d98=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xd984[_0x5280f4];return _0xba93e7;};'use strict';var _=require(_0x4d98('0x0'));var util=require('util');var logger=require(_0x4d98('0x1'))(_0x4d98('0x2'));var moment=require('moment');var BPromise=require(_0x4d98('0x3'));var rp=require(_0x4d98('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d98('0x5'));var config=require(_0x4d98('0x6'));var attributes=require(_0x4d98('0x7'));module[_0x4d98('0x8')]=function(_0x5d9cdf,_0x1f440c){return _0x5d9cdf[_0x4d98('0x9')](_0x4d98('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ae2b,_0x55ab18,_0x17c9ac){if(_0x15ae2b[_0x4d98('0xb')](_0x4d98('0xc'))){_0x15ae2b['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x17c9ac(null,_0x15ae2b);}},'charset':_0x4d98('0xd'),'collate':_0x4d98('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 45b7975..809294b 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 _0x9446=['register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatInteraction,\x20%s,\x20%s','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','AddTagsToChatInteraction','where','addTags','body','ids','omit','spread','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x1fdc91,_0x11b2d5){var _0x2ea09e=function(_0x317bc3){while(--_0x317bc3){_0x1fdc91['push'](_0x1fdc91['shift']());}};_0x2ea09e(++_0x11b2d5);}(_0x9446,0x8f));var _0x6944=function(_0x338126,_0x2bc361){_0x338126=_0x338126-0x0;var _0x4edd6f=_0x9446[_0x338126];return _0x4edd6f;};'use strict';var _=require(_0x6944('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6944('0x1'));var fs=require('fs');var Redis=require(_0x6944('0x2'));var db=require(_0x6944('0x3'))['db'];var utils=require(_0x6944('0x4'));var logger=require(_0x6944('0x5'))('rpc');var config=require(_0x6944('0x6'));var jayson=require(_0x6944('0x7'));var client=jayson[_0x6944('0x8')][_0x6944('0x9')]({'port':0x232a});config[_0x6944('0xa')]=_[_0x6944('0xb')](config[_0x6944('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6944('0xc'))(new Redis(config[_0x6944('0xa')]));require('./chatInteraction.socket')[_0x6944('0xd')](socket);function respondWithRpcPromise(_0x21eff5,_0x5716e7,_0x24c888){return new BPromise(function(_0x201e33,_0x5980ed){return client[_0x6944('0xe')](_0x21eff5,_0x24c888)[_0x6944('0xf')](function(_0x38f5a0){logger[_0x6944('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5716e7,_0x6944('0x11'));logger['debug'](_0x6944('0x12'),_0x5716e7,_0x6944('0x11'),JSON[_0x6944('0x13')](_0x38f5a0));if(_0x38f5a0['error']){if(_0x38f5a0['error'][_0x6944('0x14')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5716e7,_0x38f5a0['error']['message']);return _0x5980ed(_0x38f5a0[_0x6944('0x15')][_0x6944('0x16')]);}logger[_0x6944('0x15')](_0x6944('0x17'),_0x5716e7,_0x38f5a0[_0x6944('0x15')]['message']);return _0x201e33(_0x38f5a0[_0x6944('0x15')][_0x6944('0x16')]);}else{logger[_0x6944('0x10')](_0x6944('0x17'),_0x5716e7,_0x6944('0x11'));_0x201e33(_0x38f5a0['result']['message']);}})[_0x6944('0x18')](function(_0x3c8d7e){logger[_0x6944('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5716e7,_0x3c8d7e);_0x5980ed(_0x3c8d7e);});});}exports[_0x6944('0x19')]=function(_0x342624){var _0x287981=this;return new Promise(function(_0x400c49,_0x1d917c){return db[_0x6944('0x1a')][_0x6944('0x1b')](_0x342624['body'],{'raw':_0x342624[_0x6944('0x1c')]?_0x342624['options'][_0x6944('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342624[_0x6944('0x1c')]?_0x342624['options']['where']||null:null,'attributes':_0x342624[_0x6944('0x1c')]?_0x342624[_0x6944('0x1c')][_0x6944('0x1e')]||null:null,'limit':_0x342624[_0x6944('0x1c')]?_0x342624['options']['limit']||null:null})['then'](function(_0x2a1a6c){logger[_0x6944('0x10')](_0x6944('0x19'),_0x342624);logger['debug']('UpdateChatInteraction',_0x342624,JSON['stringify'](_0x2a1a6c));_0x400c49(_0x2a1a6c);})[_0x6944('0x18')](function(_0x430460){logger[_0x6944('0x15')](_0x6944('0x19'),_0x430460['message'],_0x342624);_0x1d917c(_0x287981['error'](0x1f4,_0x430460['message']));});});};exports[_0x6944('0x1f')]=function(_0x17881d){return new Promise(function(_0xfa4b2a,_0x26bc66){return db[_0x6944('0x1a')]['find']({'where':_0x17881d['options']?_0x17881d['options'][_0x6944('0x20')]||null:null})[_0x6944('0xf')](function(_0x5a9589){if(_0x5a9589){return _0x5a9589[_0x6944('0x21')](_0x17881d[_0x6944('0x22')][_0x6944('0x23')],_[_0x6944('0x24')](_0x17881d[_0x6944('0x22')],[_0x6944('0x23'),'id'])||{});}})[_0x6944('0x25')](function(_0x30c1bb){logger[_0x6944('0x10')](_0x6944('0x26'),_0x17881d);logger['debug'](_0x6944('0x26'),_0x17881d,JSON[_0x6944('0x13')](_0x30c1bb));_0xfa4b2a(_0x30c1bb);})[_0x6944('0x18')](function(_0x4a4ecd){logger[_0x6944('0x15')]('AddTags',_0x4a4ecd['message'],_0x17881d);_0x26bc66(_this[_0x6944('0x15')](0x1f4,_0x4a4ecd[_0x6944('0x16')]));});});}; \ No newline at end of file +var _0xe024=['limit','UpdateChatInteraction','AddTagsToChatInteraction','where','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','ChatInteraction','options','raw','attributes'];(function(_0x5e59e7,_0xc89731){var _0x45b1a1=function(_0x25fcab){while(--_0x25fcab){_0x5e59e7['push'](_0x5e59e7['shift']());}};_0x45b1a1(++_0xc89731);}(_0xe024,0x163));var _0x4e02=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xe024[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0x4e02('0x0'));var util=require(_0x4e02('0x1'));var moment=require('moment');var BPromise=require(_0x4e02('0x2'));var rs=require(_0x4e02('0x3'));var fs=require('fs');var Redis=require(_0x4e02('0x4'));var db=require(_0x4e02('0x5'))['db'];var utils=require(_0x4e02('0x6'));var logger=require(_0x4e02('0x7'))(_0x4e02('0x8'));var config=require(_0x4e02('0x9'));var jayson=require(_0x4e02('0xa'));var client=jayson[_0x4e02('0xb')][_0x4e02('0xc')]({'port':0x232a});config['redis']=_[_0x4e02('0xd')](config[_0x4e02('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e02('0xf'))(new Redis(config[_0x4e02('0xe')]));require(_0x4e02('0x10'))['register'](socket);function respondWithRpcPromise(_0x2e323d,_0x55b55a,_0x3acf46){return new BPromise(function(_0x185bbf,_0x5708bf){return client['request'](_0x2e323d,_0x3acf46)[_0x4e02('0x11')](function(_0x4c20c4){logger['info'](_0x4e02('0x12'),_0x55b55a,_0x4e02('0x13'));logger['debug'](_0x4e02('0x14'),_0x55b55a,'request\x20sent',JSON[_0x4e02('0x15')](_0x4c20c4));if(_0x4c20c4['error']){if(_0x4c20c4['error'][_0x4e02('0x16')]===0x1f4){logger['error'](_0x4e02('0x12'),_0x55b55a,_0x4c20c4[_0x4e02('0x17')]['message']);return _0x5708bf(_0x4c20c4[_0x4e02('0x17')][_0x4e02('0x18')]);}logger[_0x4e02('0x17')](_0x4e02('0x12'),_0x55b55a,_0x4c20c4[_0x4e02('0x17')][_0x4e02('0x18')]);return _0x185bbf(_0x4c20c4['error'][_0x4e02('0x18')]);}else{logger[_0x4e02('0x19')](_0x4e02('0x12'),_0x55b55a,_0x4e02('0x13'));_0x185bbf(_0x4c20c4[_0x4e02('0x1a')]['message']);}})[_0x4e02('0x1b')](function(_0x2771f1){logger[_0x4e02('0x17')](_0x4e02('0x12'),_0x55b55a,_0x2771f1);_0x5708bf(_0x2771f1);});});}exports['UpdateChatInteraction']=function(_0x47bd44){var _0x484e83=this;return new Promise(function(_0x497ad6,_0x509950){return db[_0x4e02('0x1c')]['update'](_0x47bd44['body'],{'raw':_0x47bd44[_0x4e02('0x1d')]?_0x47bd44[_0x4e02('0x1d')][_0x4e02('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47bd44[_0x4e02('0x1d')]?_0x47bd44[_0x4e02('0x1d')]['where']||null:null,'attributes':_0x47bd44['options']?_0x47bd44['options'][_0x4e02('0x1f')]||null:null,'limit':_0x47bd44[_0x4e02('0x1d')]?_0x47bd44['options'][_0x4e02('0x20')]||null:null})['then'](function(_0x16714e){logger[_0x4e02('0x19')](_0x4e02('0x21'),_0x47bd44);logger['debug'](_0x4e02('0x21'),_0x47bd44,JSON[_0x4e02('0x15')](_0x16714e));_0x497ad6(_0x16714e);})[_0x4e02('0x1b')](function(_0x26bcd7){logger[_0x4e02('0x17')](_0x4e02('0x21'),_0x26bcd7[_0x4e02('0x18')],_0x47bd44);_0x509950(_0x484e83[_0x4e02('0x17')](0x1f4,_0x26bcd7[_0x4e02('0x18')]));});});};exports[_0x4e02('0x22')]=function(_0x58f0e){return new Promise(function(_0xd9e606,_0x29c865){return db[_0x4e02('0x1c')]['find']({'where':_0x58f0e['options']?_0x58f0e[_0x4e02('0x1d')][_0x4e02('0x23')]||null:null})[_0x4e02('0x11')](function(_0x1bde18){if(_0x1bde18){return _0x1bde18[_0x4e02('0x24')](_0x58f0e[_0x4e02('0x25')][_0x4e02('0x26')],_[_0x4e02('0x27')](_0x58f0e[_0x4e02('0x25')],[_0x4e02('0x26'),'id'])||{});}})[_0x4e02('0x28')](function(_0x862c14){logger['info'](_0x4e02('0x29'),_0x58f0e);logger[_0x4e02('0x2a')](_0x4e02('0x29'),_0x58f0e,JSON[_0x4e02('0x15')](_0x862c14));_0xd9e606(_0x862c14);})[_0x4e02('0x1b')](function(_0x23854){logger[_0x4e02('0x17')](_0x4e02('0x29'),_0x23854['message'],_0x58f0e);_0x29c865(_this[_0x4e02('0x17')](0x1f4,_0x23854[_0x4e02('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7e4d4fe..0ff46fd 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 _0x9dba=['./chatInteraction.events','save','remove','removeListener','register','length','chatInteraction:'];(function(_0x734142,_0x486cfc){var _0x23e8fa=function(_0x4449b7){while(--_0x4449b7){_0x734142['push'](_0x734142['shift']());}};_0x23e8fa(++_0x486cfc);}(_0x9dba,0xa1));var _0xa9db=function(_0x143b6c,_0x5ed8a0){_0x143b6c=_0x143b6c-0x0;var _0x9169a5=_0x9dba[_0x143b6c];return _0x9169a5;};'use strict';var ChatInteractionEvents=require(_0xa9db('0x0'));var events=[_0xa9db('0x1'),_0xa9db('0x2'),'update'];function createListener(_0x10bf5b,_0x1b04c8){return function(_0x4cb188){_0x1b04c8['emit'](_0x10bf5b,_0x4cb188);};}function removeListener(_0x90a24e,_0x3a3f61){return function(){ChatInteractionEvents[_0xa9db('0x3')](_0x90a24e,_0x3a3f61);};}exports[_0xa9db('0x4')]=function(_0x1f5418){for(var _0x305f2d=0x0,_0x3c44c8=events[_0xa9db('0x5')];_0x305f2d<_0x3c44c8;_0x305f2d++){var _0x570159=events[_0x305f2d];var _0x4317d7=createListener(_0xa9db('0x6')+_0x570159,_0x1f5418);ChatInteractionEvents['on'](_0x570159,_0x4317d7);}}; \ No newline at end of file +var _0xa5d7=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x45d51f,_0x1b60e5){var _0x9afa32=function(_0x284dda){while(--_0x284dda){_0x45d51f['push'](_0x45d51f['shift']());}};_0x9afa32(++_0x1b60e5);}(_0xa5d7,0xf8));var _0x7a5d=function(_0x2f4abe,_0x257fd4){_0x2f4abe=_0x2f4abe-0x0;var _0x30797b=_0xa5d7[_0x2f4abe];return _0x30797b;};'use strict';var ChatInteractionEvents=require(_0x7a5d('0x0'));var events=[_0x7a5d('0x1'),_0x7a5d('0x2'),_0x7a5d('0x3')];function createListener(_0x55c0f0,_0x106977){return function(_0x11d439){_0x106977[_0x7a5d('0x4')](_0x55c0f0,_0x11d439);};}function removeListener(_0x158372,_0x52ce31){return function(){ChatInteractionEvents[_0x7a5d('0x5')](_0x158372,_0x52ce31);};}exports[_0x7a5d('0x6')]=function(_0x103927){for(var _0x381c25=0x0,_0x52141f=events[_0x7a5d('0x7')];_0x381c25<_0x52141f;_0x381c25++){var _0x5ca2b5=events[_0x381c25];var _0x4bd6de=createListener(_0x7a5d('0x8')+_0x5ca2b5,_0x103927);ChatInteractionEvents['on'](_0x5ca2b5,_0x4bd6de);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9fa1b34..21e48a4 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 _0xbee0=['destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy'];(function(_0x12f7ab,_0x4cc158){var _0x1f8d5f=function(_0x1ad0ba){while(--_0x1ad0ba){_0x12f7ab['push'](_0x12f7ab['shift']());}};_0x1f8d5f(++_0x4cc158);}(_0xbee0,0x147));var _0x0bee=function(_0x396965,_0x35b09f){_0x396965=_0x396965-0x0;var _0x388333=_0xbee0[_0x396965];return _0x388333;};'use strict';var multer=require('multer');var util=require(_0x0bee('0x0'));var path=require(_0x0bee('0x1'));var timeout=require(_0x0bee('0x2'));var express=require(_0x0bee('0x3'));var router=express[_0x0bee('0x4')]();var auth=require(_0x0bee('0x5'));var interaction=require(_0x0bee('0x6'));var config=require(_0x0bee('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bee('0x8')]);router[_0x0bee('0x9')](_0x0bee('0xa'),auth[_0x0bee('0xb')](),controller['describe']);router[_0x0bee('0x9')](_0x0bee('0xc'),auth[_0x0bee('0xd')](),controller[_0x0bee('0xe')]);router['get'](_0x0bee('0xf'),auth[_0x0bee('0xd')](),controller[_0x0bee('0x10')]);router[_0x0bee('0x9')](_0x0bee('0x11'),auth[_0x0bee('0xb')](),controller[_0x0bee('0x12')]);router['get'](_0x0bee('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x0bee('0x14')]);router[_0x0bee('0x9')](_0x0bee('0x15'),auth[_0x0bee('0xb')](),controller[_0x0bee('0x16')]);router[_0x0bee('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0bee('0x18'),auth[_0x0bee('0xb')](),controller[_0x0bee('0x19')]);var upload=multer({'storage':multer[_0x0bee('0x1a')]({'destination':function(_0x548ae9,_0x55c83c,_0x54aca4){_0x54aca4(null,path[_0x0bee('0x1b')](config[_0x0bee('0x1c')],'server/files/attachments/'));},'filename':function(_0x3087c2,_0x2d6d72,_0x4af35d){_0x4af35d(null,util[_0x0bee('0x1d')](_0x0bee('0x1e'),Date['now'](),_0x2d6d72[_0x0bee('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0bee('0x17')](_0x0bee('0x20'),upload[_0x0bee('0x21')]('file'),controller[_0x0bee('0x22')]);router[_0x0bee('0x17')](_0x0bee('0x11'),auth[_0x0bee('0xd')](),controller[_0x0bee('0x23')]);router['post'](_0x0bee('0x24'),auth['isAuthenticated'](),interaction[_0x0bee('0x25')](_0x0bee('0x26'),_0x0bee('0x27')),controller[_0x0bee('0x28')]);router['put'](_0x0bee('0xc'),auth[_0x0bee('0xb')](),interaction[_0x0bee('0x25')](_0x0bee('0x26'),'chatinteraction:update'),controller[_0x0bee('0x29')]);router[_0x0bee('0x2a')](_0x0bee('0x2b'),controller[_0x0bee('0x2c')]);router[_0x0bee('0x2a')](_0x0bee('0x2d'),auth[_0x0bee('0xd')](),controller[_0x0bee('0x2e')]);router[_0x0bee('0x2a')](_0x0bee('0x2f'),controller[_0x0bee('0x30')]);router[_0x0bee('0x31')](_0x0bee('0xc'),auth[_0x0bee('0xb')](),interaction[_0x0bee('0x25')](_0x0bee('0x26'),_0x0bee('0x32')),controller[_0x0bee('0x33')]);router['delete']('/:id/tags',auth[_0x0bee('0xb')](),controller[_0x0bee('0x34')]);module[_0x0bee('0x35')]=router; \ No newline at end of file +var _0x30d3=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','root','server/files/attachments/','%s-%s','replace','single','file','attachmentUpload','tracked','chat','addTags','put','update','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized'];(function(_0x2ff387,_0x2f1d98){var _0x1af07f=function(_0x26bc35){while(--_0x26bc35){_0x2ff387['push'](_0x2ff387['shift']());}};_0x1af07f(++_0x2f1d98);}(_0x30d3,0x9f));var _0x330d=function(_0x288ed5,_0x528811){_0x288ed5=_0x288ed5-0x0;var _0x2d8a45=_0x30d3[_0x288ed5];return _0x2d8a45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x330d('0x0'));var timeout=require(_0x330d('0x1'));var express=require(_0x330d('0x2'));var router=express[_0x330d('0x3')]();var auth=require(_0x330d('0x4'));var interaction=require(_0x330d('0x5'));var config=require(_0x330d('0x6'));var controller=require('./chatInteraction.controller');router[_0x330d('0x7')]('/',auth[_0x330d('0x8')](),controller[_0x330d('0x9')]);router[_0x330d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x330d('0xa')]);router[_0x330d('0x7')](_0x330d('0xb'),auth[_0x330d('0xc')](),controller['show']);router['get'](_0x330d('0xd'),auth[_0x330d('0xc')](),controller[_0x330d('0xe')]);router[_0x330d('0x7')](_0x330d('0xf'),auth[_0x330d('0x8')](),controller[_0x330d('0x10')]);router['get'](_0x330d('0x11'),auth[_0x330d('0xc')](),controller[_0x330d('0x12')]);router['get'](_0x330d('0x13'),auth[_0x330d('0x8')](),controller[_0x330d('0x14')]);router[_0x330d('0x15')]('/',auth['isAuthenticated'](),controller[_0x330d('0x16')]);router[_0x330d('0x15')]('/:id/vidaoo',auth[_0x330d('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x330d('0x17')]({'destination':function(_0x40a237,_0x3801f4,_0x5e5baf){_0x5e5baf(null,path['join'](config[_0x330d('0x18')],_0x330d('0x19')));},'filename':function(_0x4431a4,_0x571c7f,_0x582539){_0x582539(null,util['format'](_0x330d('0x1a'),Date['now'](),_0x571c7f['originalname'][_0x330d('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x330d('0x15')]('/:id/attachment_upload',upload[_0x330d('0x1c')](_0x330d('0x1d')),controller[_0x330d('0x1e')]);router[_0x330d('0x15')](_0x330d('0xf'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x330d('0x15')]('/:id/tags',auth[_0x330d('0x8')](),interaction[_0x330d('0x1f')](_0x330d('0x20'),'chatinteraction:addtags'),controller[_0x330d('0x21')]);router[_0x330d('0x22')]('/:id',auth['isAuthenticated'](),interaction[_0x330d('0x1f')](_0x330d('0x20'),'chatinteraction:update'),controller[_0x330d('0x23')]);router[_0x330d('0x22')]('/:id/custom_update',controller['customUpdate']);router[_0x330d('0x22')](_0x330d('0x24'),auth[_0x330d('0xc')](),controller[_0x330d('0x25')]);router[_0x330d('0x22')]('/:id/close',controller['close']);router[_0x330d('0x26')](_0x330d('0xb'),auth['isAuthenticated'](),interaction[_0x330d('0x1f')](_0x330d('0x20'),_0x330d('0x27')),controller[_0x330d('0x28')]);router[_0x330d('0x26')](_0x330d('0x29'),auth['isAuthenticated'](),controller[_0x330d('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fd286a5..0617ac7 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x256db8,_0x5c4b6c){var _0x5ae465=function(_0x19cba8){while(--_0x19cba8){_0x256db8['push'](_0x256db8['shift']());}};_0x5ae465(++_0x5c4b6c);}(_0x57ca,0x108));var _0xa57c=function(_0x16831f,_0x38e6b1){_0x16831f=_0x16831f-0x0;var _0x493e20=_0x57ca[_0x16831f];return _0x493e20;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x4f9545,_0x3c7237){var _0x7d1792=function(_0x24e0a3){while(--_0x24e0a3){_0x4f9545['push'](_0x4f9545['shift']());}};_0x7d1792(++_0x3c7237);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e8bba91..ee6ca52 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 _0x947d=['lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','isEmpty','resourceId','push','messages','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','count','offset','limit','status','set','apply','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','get'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x947d,0x15b));var _0xd947=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x947d[_0x219d87];return _0x22823d;};'use strict';var pdf=require(_0xd947('0x0'));var emlformat=require(_0xd947('0x1'));var rimraf=require(_0xd947('0x2'));var zipdir=require(_0xd947('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd947('0x4'));var BPromise=require(_0xd947('0x5'));var Mustache=require('mustache');var util=require(_0xd947('0x6'));var path=require(_0xd947('0x7'));var sox=require(_0xd947('0x8'));var csv=require('to-csv');var ejs=require(_0xd947('0x9'));var fs=require('fs');var _=require(_0xd947('0xa'));var squel=require(_0xd947('0xb'));var crypto=require(_0xd947('0xc'));var jsforce=require(_0xd947('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd947('0xe'));var Redis=require(_0xd947('0xf'));var authService=require(_0xd947('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd947('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd947('0x12'))(_0xd947('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd947('0x14'))['db'];config[_0xd947('0x15')]=_['defaults'](config[_0xd947('0x15')],{'host':_0xd947('0x16'),'port':0x18eb});var socket=require(_0xd947('0x17'))(new Redis(config['redis']));require(_0xd947('0x18'))[_0xd947('0x19')](socket);function respondWithStatusCode(_0x53b748,_0x2c79f0){_0x2c79f0=_0x2c79f0||0xcc;return function(_0x577104){if(_0x577104){return _0x53b748[_0xd947('0x1a')](_0x2c79f0);}return _0x53b748['status'](_0x2c79f0)[_0xd947('0x1b')]();};}function respondWithResult(_0x4473c7,_0x36ff68){_0x36ff68=_0x36ff68||0xc8;return function(_0x191c6b){if(_0x191c6b){return _0x4473c7['status'](_0x36ff68)['json'](_0x191c6b);}};}function respondWithFilteredResult(_0x1e19ea,_0x462c38){return function(_0x5235a7){if(_0x5235a7){var _0x247541=_0x5235a7[_0xd947('0x1c')],_0x2c18ec=_0x462c38[_0xd947('0x1d')],_0x450e92=_0x462c38[_0xd947('0x1d')]+_0x462c38[_0xd947('0x1e')],_0xf8b69b;if(_0x450e92>=_0x247541){_0x450e92=_0x247541;_0xf8b69b=0xc8;}else{_0xf8b69b=0xce;}_0x1e19ea[_0xd947('0x1f')](_0xf8b69b);return _0x1e19ea[_0xd947('0x20')]('Content-Range',_0x2c18ec+'-'+_0x450e92+'/'+_0x247541)['json'](_0x5235a7);}return null;};}function patchUpdates(_0x484033){return function(_0x4bb32b){try{jsonpatch[_0xd947('0x21')](_0x4bb32b,_0x484033,!![]);}catch(_0x168d3b){return BPromise['reject'](_0x168d3b);}return _0x4bb32b['save']();};}function saveUpdates(_0x87e3a7,_0x512183){return function(_0x236a9e){if(_0x236a9e){return _0x236a9e[_0xd947('0x22')](_0x87e3a7)[_0xd947('0x23')](function(_0x2a6d0d){return _0x2a6d0d;});}return null;};}function removeEntity(_0x110768,_0x5118d8){return function(_0xaaf7a1){if(_0xaaf7a1){return _0xaaf7a1[_0xd947('0x24')]()['then'](function(){_0x110768[_0xd947('0x1f')](0xcc)[_0xd947('0x1b')]();});}};}function handleEntityNotFound(_0x49d0df,_0x2c6942){return function(_0x2dabf4){if(!_0x2dabf4){_0x49d0df['sendStatus'](0x194);}return _0x2dabf4;};}function handleError(_0x34b683,_0x50fa1d){_0x50fa1d=_0x50fa1d||0x1f4;return function(_0x5dcc9e){logger[_0xd947('0x25')](_0x5dcc9e[_0xd947('0x26')]);if(_0x5dcc9e[_0xd947('0x27')]){delete _0x5dcc9e[_0xd947('0x27')];}_0x34b683[_0xd947('0x1f')](_0x50fa1d)[_0xd947('0x28')](_0x5dcc9e);};}exports[_0xd947('0x29')]=function(_0xb65c0d,_0x34fbc0){var _0x443f21={},_0x4de8ce={},_0x1e2165={'count':0x0,'rows':[]};var _0x4aeec3=_[_0xd947('0x2a')](db[_0xd947('0x2b')][_0xd947('0x2c')],function(_0x1a6cef){return{'name':_0x1a6cef[_0xd947('0x2d')],'type':_0x1a6cef[_0xd947('0x2e')][_0xd947('0x2f')]};});_0x4de8ce['model']=_['map'](_0x4aeec3,_0xd947('0x27'));_0x4de8ce[_0xd947('0x30')]=_[_0xd947('0x31')](_0xb65c0d[_0xd947('0x30')]);_0x4de8ce[_0xd947('0x32')]=_[_0xd947('0x33')](_0x4de8ce['model'],_0x4de8ce[_0xd947('0x30')]);_0x443f21[_0xd947('0x34')]=_[_0xd947('0x33')](_0x4de8ce[_0xd947('0x35')],qs[_0xd947('0x36')](_0xb65c0d[_0xd947('0x30')][_0xd947('0x36')]));_0x443f21[_0xd947('0x34')]=_0x443f21[_0xd947('0x34')][_0xd947('0x37')]?_0x443f21[_0xd947('0x34')]:_0x4de8ce[_0xd947('0x35')];if(!_0xb65c0d[_0xd947('0x30')]['hasOwnProperty'](_0xd947('0x38'))){_0x443f21[_0xd947('0x1e')]=qs[_0xd947('0x1e')](_0xb65c0d['query'][_0xd947('0x1e')]);_0x443f21[_0xd947('0x1d')]=qs['offset'](_0xb65c0d[_0xd947('0x30')]['offset']);}_0x443f21[_0xd947('0x39')]=qs[_0xd947('0x3a')](_0xb65c0d[_0xd947('0x30')][_0xd947('0x3a')]);_0x443f21['where']=qs[_0xd947('0x32')](_[_0xd947('0x3b')](_0xb65c0d[_0xd947('0x30')],_0x4de8ce['filters']),_0x4aeec3);if(_0xb65c0d[_0xd947('0x30')][_0xd947('0x3c')]){_0x443f21['where']=_[_0xd947('0x3d')](_0x443f21[_0xd947('0x3e')],{'$or':_['map'](_0x4aeec3,function(_0x527f84){if(_0x527f84[_0xd947('0x2e')]!==_0xd947('0x3f')){var _0x130966={};_0x130966[_0x527f84['name']]={'$like':'%'+_0xb65c0d['query'][_0xd947('0x3c')]+'%'};return _0x130966;}})});}_0x443f21=_[_0xd947('0x3d')]({},_0x443f21,_0xb65c0d[_0xd947('0x40')]);var _0x46176a={'where':_0x443f21[_0xd947('0x3e')]};return db['ChatInternalMessage'][_0xd947('0x1c')](_0x46176a)[_0xd947('0x23')](function(_0x115e62){_0x1e2165[_0xd947('0x1c')]=_0x115e62;if(_0xb65c0d['query'][_0xd947('0x41')]){_0x443f21[_0xd947('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xd947('0x43')](_0x443f21);})[_0xd947('0x23')](function(_0x1601d0){_0x1e2165[_0xd947('0x44')]=_0x1601d0;return _0x1e2165;})['then'](respondWithFilteredResult(_0x34fbc0,_0x443f21))[_0xd947('0x45')](handleError(_0x34fbc0,null));};exports[_0xd947('0x46')]=function(_0x1460f9,_0x4d2f3d){var _0x24fe12={'raw':!![],'where':{'id':_0x1460f9['params']['id']}},_0xc09eb4={};_0xc09eb4[_0xd947('0x35')]=_['keys'](db[_0xd947('0x2b')][_0xd947('0x2c')]);_0xc09eb4[_0xd947('0x30')]=_[_0xd947('0x31')](_0x1460f9[_0xd947('0x30')]);_0xc09eb4[_0xd947('0x32')]=_[_0xd947('0x33')](_0xc09eb4[_0xd947('0x35')],_0xc09eb4[_0xd947('0x30')]);_0x24fe12[_0xd947('0x34')]=_[_0xd947('0x33')](_0xc09eb4['model'],qs[_0xd947('0x36')](_0x1460f9[_0xd947('0x30')][_0xd947('0x36')]));_0x24fe12[_0xd947('0x34')]=_0x24fe12['attributes']['length']?_0x24fe12[_0xd947('0x34')]:_0xc09eb4['model'];if(_0x1460f9[_0xd947('0x30')]['includeAll']){_0x24fe12[_0xd947('0x42')]=[{'all':!![]}];}_0x24fe12=_[_0xd947('0x3d')]({},_0x24fe12,_0x1460f9[_0xd947('0x40')]);return db[_0xd947('0x2b')][_0xd947('0x47')](_0x24fe12)[_0xd947('0x23')](handleEntityNotFound(_0x4d2f3d,null))[_0xd947('0x23')](respondWithResult(_0x4d2f3d,null))[_0xd947('0x45')](handleError(_0x4d2f3d,null));};exports[_0xd947('0x48')]=function(_0x40fd1e,_0x551cc0){return db['ChatInternalMessage'][_0xd947('0x48')](_0x40fd1e[_0xd947('0x49')],{})[_0xd947('0x23')](respondWithResult(_0x551cc0,0xc9))[_0xd947('0x45')](handleError(_0x551cc0,null));};exports[_0xd947('0x22')]=function(_0x28b08b,_0x3e4021){if(_0x28b08b['body']['id']){delete _0x28b08b['body']['id'];}return db[_0xd947('0x2b')][_0xd947('0x47')]({'where':{'id':_0x28b08b[_0xd947('0x4a')]['id']}})[_0xd947('0x23')](handleEntityNotFound(_0x3e4021,null))[_0xd947('0x23')](saveUpdates(_0x28b08b[_0xd947('0x49')],null))[_0xd947('0x23')](respondWithResult(_0x3e4021,null))[_0xd947('0x45')](handleError(_0x3e4021,null));};exports[_0xd947('0x24')]=function(_0x5e091c,_0x4ff2c0){return db[_0xd947('0x2b')][_0xd947('0x47')]({'where':{'id':_0x5e091c[_0xd947('0x4a')]['id']}})[_0xd947('0x23')](handleEntityNotFound(_0x4ff2c0,null))[_0xd947('0x23')](removeEntity(_0x4ff2c0,null))[_0xd947('0x45')](handleError(_0x4ff2c0,null));};exports[_0xd947('0x4b')]=function(_0x12caac,_0x11c04a){return db[_0xd947('0x2b')][_0xd947('0x4b')]()[_0xd947('0x23')](respondWithResult(_0x11c04a,null))[_0xd947('0x45')](handleError(_0x11c04a,null));};function wrapUser(_0x446f81){return function(_0x5d1ad8){var _0x11457e=_0x446f81[_0xd947('0x4c')]({'plain':!![]});_0x11457e['messages']=[];if(_0x5d1ad8){_0x11457e[_0xd947('0x4d')]=_0x5d1ad8[_0xd947('0x4e')];_0x11457e[_0xd947('0x4f')]=_0x5d1ad8;}else{_0x11457e['lastMessageAt']=moment(0x0)[_0xd947('0x50')](_0xd947('0x51'));_0x11457e[_0xd947('0x4f')]={};}return _0x11457e;};}exports[_0xd947('0x52')]=function(_0x38d9dd,_0x13a23c,_0x463c05){var _0x1c28a6=[];return db['User'][_0xd947('0x43')]({'where':{'role':[_0xd947('0x53'),'admin',_0xd947('0x54')]},'attributes':['id',_0xd947('0x55'),'name',_0xd947('0x56'),_0xd947('0x57'),_0xd947('0x58'),_0xd947('0x59'),_0xd947('0x5a'),_0xd947('0x5b'),'showWebBar'],'order':qs[_0xd947('0x3a')](_0xd947('0x5c')),'include':[{'model':db[_0xd947('0x5d')],'as':_0xd947('0x5e'),'attributes':['id',_0xd947('0x27'),_0xd947('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x18bb7f){if(_0x18bb7f){var _0x352a29=_0x38d9dd[_0xd947('0x54')]['get']({'plain':!![]});if(!_0x352a29)throw new Error(_0xd947('0x5f'));if(_0x352a29[_0xd947('0x56')]===_0xd947('0x54')){return db['UserProfileSection']['find']({'where':{'name':_0xd947('0x60'),'userProfileId':_0x352a29[_0xd947('0x61')]},'raw':!![]})[_0xd947('0x23')](function(_0x30747b){if(_0x30747b){if(_0x30747b['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x30747b['id']},'raw':!![]})[_0xd947('0x23')](function(_0x21c7e7){var _0x3f80ea=[];if(_[_0xd947('0x62')](_0x21c7e7)){_0x3f80ea=_[_0xd947('0x3c')](_0x18bb7f,function(_0x546d69){if(_0x546d69[_0xd947('0x56')]!=='agent'){return _0x546d69;}});return _0x3f80ea;}else{for(var _0x43d752=0x0;_0x43d752<_0x18bb7f['length'];_0x43d752++){var _0x403fb7=_0x18bb7f[_0x43d752];if(_0x403fb7[_0xd947('0x56')]===_0xd947('0x53')){var _0x3bbbb7=_[_0xd947('0x47')](_0x21c7e7,function(_0x319f55){return _0x319f55[_0xd947('0x63')]===_0x403fb7['id'];});if(_0x3bbbb7)_0x3f80ea[_0xd947('0x64')](_0x403fb7);}else{_0x3f80ea[_0xd947('0x64')](_0x403fb7);}}return _0x3f80ea;}});}else{return _0x18bb7f;}}else{var _0x2bb60f=_[_0xd947('0x3c')](_0x18bb7f,function(_0x48a89f){if(_0x48a89f[_0xd947('0x56')]!==_0xd947('0x53')){return _0x48a89f;}});return _0x2bb60f;}});}else{return _0x18bb7f;}}})['then'](function(_0x335048){var _0x5f4f36=[];if(_0x335048){_0x1c28a6=_0x335048;for(var _0x3028bd=0x0;_0x3028bd<_0x335048[_0xd947('0x37')];_0x3028bd+=0x1){_0x1c28a6[_0x3028bd][_0xd947('0x65')]=[];_0x5f4f36[_0xd947('0x64')](db[_0xd947('0x2b')][_0xd947('0x47')]({'where':{'FromId':[_0x38d9dd[_0xd947('0x54')]['id'],_0x335048[_0x3028bd]['id']],'ToId':[_0x38d9dd[_0xd947('0x54')]['id'],_0x335048[_0x3028bd]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xd947('0x66'),_0xd947('0x67'),_0xd947('0x49')],'order':qs[_0xd947('0x3a')](_0xd947('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd947('0x23')](wrapUser(_0x335048[_0x3028bd])));}return BPromise[_0xd947('0x69')](_0x5f4f36);}return[];})[_0xd947('0x23')](function(_0x45efc2){return{'rows':_0x45efc2,'count':_0x45efc2[_0xd947('0x37')]};})[_0xd947('0x23')](respondWithResult(_0x13a23c,null))[_0xd947('0x45')](handleError(_0x13a23c,null));}; \ No newline at end of file +var _0x9402=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','length','find','create','update','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js'];(function(_0x5b8972,_0x1fc2a3){var _0x4e7927=function(_0x3eb534){while(--_0x3eb534){_0x5b8972['push'](_0x5b8972['shift']());}};_0x4e7927(++_0x1fc2a3);}(_0x9402,0xca));var _0x2940=function(_0x25fc70,_0x60240a){_0x25fc70=_0x25fc70-0x0;var _0x23d30e=_0x9402[_0x25fc70];return _0x23d30e;};'use strict';var pdf=require(_0x2940('0x0'));var emlformat=require(_0x2940('0x1'));var rimraf=require(_0x2940('0x2'));var zipdir=require(_0x2940('0x3'));var jsonpatch=require(_0x2940('0x4'));var rp=require(_0x2940('0x5'));var moment=require(_0x2940('0x6'));var BPromise=require(_0x2940('0x7'));var Mustache=require(_0x2940('0x8'));var util=require(_0x2940('0x9'));var path=require(_0x2940('0xa'));var sox=require(_0x2940('0xb'));var csv=require(_0x2940('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2940('0xd'));var crypto=require(_0x2940('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2940('0xf'));var toCsv=require(_0x2940('0xc'));var querystring=require(_0x2940('0x10'));var Papa=require(_0x2940('0x11'));var Redis=require(_0x2940('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2940('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2940('0x14'));var logger=require(_0x2940('0x15'))('api');var utils=require(_0x2940('0x16'));var config=require(_0x2940('0x17'));var db=require(_0x2940('0x18'))['db'];config[_0x2940('0x19')]=_[_0x2940('0x1a')](config[_0x2940('0x19')],{'host':_0x2940('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x2940('0x1c')](socket);function respondWithStatusCode(_0x4f7ca1,_0x30fa96){_0x30fa96=_0x30fa96||0xcc;return function(_0x1b9fa7){if(_0x1b9fa7){return _0x4f7ca1['sendStatus'](_0x30fa96);}return _0x4f7ca1['status'](_0x30fa96)[_0x2940('0x1d')]();};}function respondWithResult(_0x54fd52,_0x338b49){_0x338b49=_0x338b49||0xc8;return function(_0x58fc9e){if(_0x58fc9e){return _0x54fd52[_0x2940('0x1e')](_0x338b49)[_0x2940('0x1f')](_0x58fc9e);}};}function respondWithFilteredResult(_0x4233ac,_0x5d845f){return function(_0x2f4890){if(_0x2f4890){var _0x3e712b=_0x2f4890['count'],_0x56857a=_0x5d845f[_0x2940('0x20')],_0x20a02f=_0x5d845f[_0x2940('0x20')]+_0x5d845f[_0x2940('0x21')],_0x4dc906;if(_0x20a02f>=_0x3e712b){_0x20a02f=_0x3e712b;_0x4dc906=0xc8;}else{_0x4dc906=0xce;}_0x4233ac[_0x2940('0x1e')](_0x4dc906);return _0x4233ac[_0x2940('0x22')](_0x2940('0x23'),_0x56857a+'-'+_0x20a02f+'/'+_0x3e712b)[_0x2940('0x1f')](_0x2f4890);}return null;};}function patchUpdates(_0x8b338a){return function(_0x4f277c){try{jsonpatch[_0x2940('0x24')](_0x4f277c,_0x8b338a,!![]);}catch(_0x3670d9){return BPromise[_0x2940('0x25')](_0x3670d9);}return _0x4f277c[_0x2940('0x26')]();};}function saveUpdates(_0x258a94,_0x3e072e){return function(_0x4ed2c0){if(_0x4ed2c0){return _0x4ed2c0['update'](_0x258a94)[_0x2940('0x27')](function(_0x1f2ec0){return _0x1f2ec0;});}return null;};}function removeEntity(_0x3db7e3,_0xf5d4f){return function(_0x3f5518){if(_0x3f5518){return _0x3f5518[_0x2940('0x28')]()[_0x2940('0x27')](function(){_0x3db7e3[_0x2940('0x1e')](0xcc)[_0x2940('0x1d')]();});}};}function handleEntityNotFound(_0x26540e,_0x226cf8){return function(_0x6a48b7){if(!_0x6a48b7){_0x26540e[_0x2940('0x29')](0x194);}return _0x6a48b7;};}function handleError(_0x465a14,_0x2ff189){_0x2ff189=_0x2ff189||0x1f4;return function(_0x5aa964){logger[_0x2940('0x2a')](_0x5aa964[_0x2940('0x2b')]);if(_0x5aa964[_0x2940('0x2c')]){delete _0x5aa964['name'];}_0x465a14['status'](_0x2ff189)[_0x2940('0x2d')](_0x5aa964);};}exports['index']=function(_0x2b65cf,_0x2ebc46){var _0x41498d={},_0x467bd1={},_0x5ad591={'count':0x0,'rows':[]};var _0x4fb100=_[_0x2940('0x2e')](db[_0x2940('0x2f')]['rawAttributes'],function(_0x43ea92){return{'name':_0x43ea92[_0x2940('0x30')],'type':_0x43ea92[_0x2940('0x31')][_0x2940('0x32')]};});_0x467bd1['model']=_[_0x2940('0x2e')](_0x4fb100,'name');_0x467bd1[_0x2940('0x33')]=_[_0x2940('0x34')](_0x2b65cf[_0x2940('0x33')]);_0x467bd1[_0x2940('0x35')]=_[_0x2940('0x36')](_0x467bd1[_0x2940('0x37')],_0x467bd1[_0x2940('0x33')]);_0x41498d[_0x2940('0x38')]=_['intersection'](_0x467bd1[_0x2940('0x37')],qs['fields'](_0x2b65cf[_0x2940('0x33')][_0x2940('0x39')]));_0x41498d[_0x2940('0x38')]=_0x41498d[_0x2940('0x38')]['length']?_0x41498d[_0x2940('0x38')]:_0x467bd1['model'];if(!_0x2b65cf['query'][_0x2940('0x3a')](_0x2940('0x3b'))){_0x41498d[_0x2940('0x21')]=qs['limit'](_0x2b65cf[_0x2940('0x33')][_0x2940('0x21')]);_0x41498d['offset']=qs[_0x2940('0x20')](_0x2b65cf[_0x2940('0x33')][_0x2940('0x20')]);}_0x41498d['order']=qs[_0x2940('0x3c')](_0x2b65cf[_0x2940('0x33')]['sort']);_0x41498d[_0x2940('0x3d')]=qs[_0x2940('0x35')](_[_0x2940('0x3e')](_0x2b65cf[_0x2940('0x33')],_0x467bd1['filters']),_0x4fb100);if(_0x2b65cf[_0x2940('0x33')][_0x2940('0x3f')]){_0x41498d[_0x2940('0x3d')]=_[_0x2940('0x40')](_0x41498d[_0x2940('0x3d')],{'$or':_[_0x2940('0x2e')](_0x4fb100,function(_0x3516fa){if(_0x3516fa['type']!==_0x2940('0x41')){var _0x3f1de5={};_0x3f1de5[_0x3516fa[_0x2940('0x2c')]]={'$like':'%'+_0x2b65cf[_0x2940('0x33')][_0x2940('0x3f')]+'%'};return _0x3f1de5;}})});}_0x41498d=_[_0x2940('0x40')]({},_0x41498d,_0x2b65cf[_0x2940('0x42')]);var _0x15c5fc={'where':_0x41498d[_0x2940('0x3d')]};return db[_0x2940('0x2f')][_0x2940('0x43')](_0x15c5fc)[_0x2940('0x27')](function(_0x28a3b6){_0x5ad591[_0x2940('0x43')]=_0x28a3b6;if(_0x2b65cf['query']['includeAll']){_0x41498d[_0x2940('0x44')]=[{'all':!![]}];}return db[_0x2940('0x2f')][_0x2940('0x45')](_0x41498d);})['then'](function(_0x574b80){_0x5ad591[_0x2940('0x46')]=_0x574b80;return _0x5ad591;})[_0x2940('0x27')](respondWithFilteredResult(_0x2ebc46,_0x41498d))[_0x2940('0x47')](handleError(_0x2ebc46,null));};exports[_0x2940('0x48')]=function(_0x5949b0,_0xb9531c){var _0x4236fd={'raw':!![],'where':{'id':_0x5949b0['params']['id']}},_0x5cb05a={};_0x5cb05a[_0x2940('0x37')]=_[_0x2940('0x34')](db['ChatInternalMessage']['rawAttributes']);_0x5cb05a[_0x2940('0x33')]=_['keys'](_0x5949b0[_0x2940('0x33')]);_0x5cb05a[_0x2940('0x35')]=_[_0x2940('0x36')](_0x5cb05a[_0x2940('0x37')],_0x5cb05a[_0x2940('0x33')]);_0x4236fd[_0x2940('0x38')]=_[_0x2940('0x36')](_0x5cb05a['model'],qs['fields'](_0x5949b0['query'][_0x2940('0x39')]));_0x4236fd[_0x2940('0x38')]=_0x4236fd[_0x2940('0x38')][_0x2940('0x49')]?_0x4236fd[_0x2940('0x38')]:_0x5cb05a[_0x2940('0x37')];if(_0x5949b0[_0x2940('0x33')]['includeAll']){_0x4236fd[_0x2940('0x44')]=[{'all':!![]}];}_0x4236fd=_['merge']({},_0x4236fd,_0x5949b0[_0x2940('0x42')]);return db[_0x2940('0x2f')][_0x2940('0x4a')](_0x4236fd)[_0x2940('0x27')](handleEntityNotFound(_0xb9531c,null))[_0x2940('0x27')](respondWithResult(_0xb9531c,null))[_0x2940('0x47')](handleError(_0xb9531c,null));};exports[_0x2940('0x4b')]=function(_0x3f6365,_0x597b8e){return db[_0x2940('0x2f')]['create'](_0x3f6365['body'],{})[_0x2940('0x27')](respondWithResult(_0x597b8e,0xc9))[_0x2940('0x47')](handleError(_0x597b8e,null));};exports[_0x2940('0x4c')]=function(_0x4e4e36,_0x4d3865){if(_0x4e4e36['body']['id']){delete _0x4e4e36[_0x2940('0x4d')]['id'];}return db[_0x2940('0x2f')]['find']({'where':{'id':_0x4e4e36[_0x2940('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d3865,null))[_0x2940('0x27')](saveUpdates(_0x4e4e36['body'],null))['then'](respondWithResult(_0x4d3865,null))[_0x2940('0x47')](handleError(_0x4d3865,null));};exports[_0x2940('0x28')]=function(_0x4f0c02,_0x523f68){return db[_0x2940('0x2f')][_0x2940('0x4a')]({'where':{'id':_0x4f0c02['params']['id']}})[_0x2940('0x27')](handleEntityNotFound(_0x523f68,null))[_0x2940('0x27')](removeEntity(_0x523f68,null))[_0x2940('0x47')](handleError(_0x523f68,null));};exports[_0x2940('0x4f')]=function(_0x3d6301,_0x3d298d){return db[_0x2940('0x2f')][_0x2940('0x4f')]()[_0x2940('0x27')](respondWithResult(_0x3d298d,null))[_0x2940('0x47')](handleError(_0x3d298d,null));};function wrapUser(_0x349939){return function(_0x2e5f86){var _0x26b236=_0x349939[_0x2940('0x50')]({'plain':!![]});_0x26b236[_0x2940('0x51')]=[];if(_0x2e5f86){_0x26b236[_0x2940('0x52')]=_0x2e5f86[_0x2940('0x53')];_0x26b236[_0x2940('0x54')]=_0x2e5f86;}else{_0x26b236['lastMessageAt']=moment(0x0)[_0x2940('0x55')](_0x2940('0x56'));_0x26b236['lastMessage']={};}return _0x26b236;};}exports[_0x2940('0x57')]=function(_0x248192,_0x3580d5,_0x3770c5){var _0x100057=[];return db['User'][_0x2940('0x45')]({'where':{'role':['agent',_0x2940('0x58'),_0x2940('0x59')]},'attributes':['id',_0x2940('0x5a'),_0x2940('0x2c'),_0x2940('0x5b'),_0x2940('0x5c'),_0x2940('0x5d'),_0x2940('0x5e'),'lastLoginAt',_0x2940('0x5f'),_0x2940('0x60')],'order':qs[_0x2940('0x3c')](_0x2940('0x61')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x2940('0x2c'),_0x2940('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x439446){if(_0x439446){var _0x2e2604=_0x248192[_0x2940('0x59')]['get']({'plain':!![]});if(!_0x2e2604)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e2604[_0x2940('0x5b')]===_0x2940('0x59')){return db[_0x2940('0x62')]['find']({'where':{'name':_0x2940('0x63'),'userProfileId':_0x2e2604[_0x2940('0x64')]},'raw':!![]})['then'](function(_0x2c4b66){if(_0x2c4b66){if(_0x2c4b66[_0x2940('0x65')]===0x0){return db['UserProfileResource'][_0x2940('0x45')]({'where':{'sectionId':_0x2c4b66['id']},'raw':!![]})[_0x2940('0x27')](function(_0x22ad35){var _0x1a58b7=[];if(_[_0x2940('0x66')](_0x22ad35)){_0x1a58b7=_[_0x2940('0x3f')](_0x439446,function(_0x118558){if(_0x118558[_0x2940('0x5b')]!=='agent'){return _0x118558;}});return _0x1a58b7;}else{for(var _0x3db28e=0x0;_0x3db28e<_0x439446['length'];_0x3db28e++){var _0x17932f=_0x439446[_0x3db28e];if(_0x17932f[_0x2940('0x5b')]===_0x2940('0x67')){var _0x412d2e=_[_0x2940('0x4a')](_0x22ad35,function(_0x14cf40){return _0x14cf40[_0x2940('0x68')]===_0x17932f['id'];});if(_0x412d2e)_0x1a58b7[_0x2940('0x69')](_0x17932f);}else{_0x1a58b7[_0x2940('0x69')](_0x17932f);}}return _0x1a58b7;}});}else{return _0x439446;}}else{var _0x15f63c=_[_0x2940('0x3f')](_0x439446,function(_0x450dde){if(_0x450dde['role']!==_0x2940('0x67')){return _0x450dde;}});return _0x15f63c;}});}else{return _0x439446;}}})[_0x2940('0x27')](function(_0x4296b7){var _0x538484=[];if(_0x4296b7){_0x100057=_0x4296b7;for(var _0x566239=0x0;_0x566239<_0x4296b7[_0x2940('0x49')];_0x566239+=0x1){_0x100057[_0x566239][_0x2940('0x51')]=[];_0x538484[_0x2940('0x69')](db['ChatInternalMessage'][_0x2940('0x4a')]({'where':{'FromId':[_0x248192[_0x2940('0x59')]['id'],_0x4296b7[_0x566239]['id']],'ToId':[_0x248192[_0x2940('0x59')]['id'],_0x4296b7[_0x566239]['id']],'ChatGroupId':null},'attributes':['id',_0x2940('0x53'),'FromId','ToId',_0x2940('0x6a'),_0x2940('0x4d')],'order':qs['sort'](_0x2940('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2940('0x27')](wrapUser(_0x4296b7[_0x566239])));}return BPromise[_0x2940('0x6c')](_0x538484);}return[];})[_0x2940('0x27')](function(_0x40662f){return{'rows':_0x40662f,'count':_0x40662f[_0x2940('0x49')]};})[_0x2940('0x27')](respondWithResult(_0x3580d5,null))[_0x2940('0x47')](handleError(_0x3580d5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c242462..162026d 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 _0xbf63=['hasOwnProperty','hook','exports','events','ChatInternalMessage','update','remove','emit'];(function(_0x1694ad,_0x4db7a9){var _0x5b7121=function(_0x17b054){while(--_0x17b054){_0x1694ad['push'](_0x1694ad['shift']());}};_0x5b7121(++_0x4db7a9);}(_0xbf63,0x1eb));var _0x3bf6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf63[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x3bf6('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3bf6('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bf6('0x2'),'afterDestroy':_0x3bf6('0x3')};function emitEvent(_0x15deaa){return function(_0x3d350a,_0x130585,_0x3eefad){ChatInternalMessageEvents[_0x3bf6('0x4')](_0x15deaa+':'+_0x3d350a['id'],_0x3d350a);ChatInternalMessageEvents[_0x3bf6('0x4')](_0x15deaa,_0x3d350a);_0x3eefad(null);};}for(var e in events){if(events[_0x3bf6('0x5')](e)){var event=events[e];ChatInternalMessage[_0x3bf6('0x6')](e,emitEvent(event));}}module[_0x3bf6('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6934=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit'];(function(_0x27aca2,_0x542e35){var _0x2be0f2=function(_0x142271){while(--_0x142271){_0x27aca2['push'](_0x27aca2['shift']());}};_0x2be0f2(++_0x542e35);}(_0x6934,0x17f));var _0x4693=function(_0x57993d,_0x27baee){_0x57993d=_0x57993d-0x0;var _0x518514=_0x6934[_0x57993d];return _0x518514;};'use strict';var EventEmitter=require(_0x4693('0x0'));var ChatInternalMessage=require(_0x4693('0x1'))['db'][_0x4693('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4693('0x3')](0x0);var events={'afterCreate':_0x4693('0x4'),'afterUpdate':'update','afterDestroy':_0x4693('0x5')};function emitEvent(_0x287500){return function(_0x2812a9,_0x2cc753,_0x557f7b){ChatInternalMessageEvents[_0x4693('0x6')](_0x287500+':'+_0x2812a9['id'],_0x2812a9);ChatInternalMessageEvents[_0x4693('0x6')](_0x287500,_0x2812a9);_0x557f7b(null);};}for(var e in events){if(events[_0x4693('0x7')](e)){var event=events[e];ChatInternalMessage[_0x4693('0x8')](e,emitEvent(event));}}module[_0x4693('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5f5bd93..6597c56 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 _0xbd2c=['define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./chatInternalMessage.attributes','exports'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0xbd2c,0x1e1));var _0xcbd2=function(_0x1428a5,_0x27f12f){_0x1428a5=_0x1428a5-0x0;var _0x240f5d=_0xbd2c[_0x1428a5];return _0x240f5d;};'use strict';var _=require(_0xcbd2('0x0'));var util=require('util');var logger=require(_0xcbd2('0x1'))(_0xcbd2('0x2'));var moment=require(_0xcbd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbd2('0x4'));var fs=require('fs');var path=require(_0xcbd2('0x5'));var rimraf=require(_0xcbd2('0x6'));var config=require('../../config/environment');var attributes=require(_0xcbd2('0x7'));module[_0xcbd2('0x8')]=function(_0x1a0a6c,_0x1ddb69){return _0x1a0a6c[_0xcbd2('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6e25=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','define','chat_internal_messages'];(function(_0x448d11,_0x4fa94f){var _0x36988e=function(_0x14e049){while(--_0x14e049){_0x448d11['push'](_0x448d11['shift']());}};_0x36988e(++_0x4fa94f);}(_0x6e25,0xb6));var _0x56e2=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x6e25[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0x56e2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56e2('0x1'));var BPromise=require(_0x56e2('0x2'));var rp=require(_0x56e2('0x3'));var fs=require('fs');var path=require(_0x56e2('0x4'));var rimraf=require(_0x56e2('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x2ea6ea,_0x2e1e01){return _0x2ea6ea[_0x56e2('0x6')]('ChatInternalMessage',attributes,{'tableName':_0x56e2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x56e2('0x8'),'collate':_0x56e2('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 502facb..3c4b6cf 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 _0x0d27=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug'];(function(_0x506466,_0x594abc){var _0x57750f=function(_0x595773){while(--_0x595773){_0x506466['push'](_0x506466['shift']());}};_0x57750f(++_0x594abc);}(_0x0d27,0xf9));var _0x70d2=function(_0x334ffd,_0xf83ba9){_0x334ffd=_0x334ffd-0x0;var _0x346dcf=_0x0d27[_0x334ffd];return _0x346dcf;};'use strict';var _=require(_0x70d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x70d2('0x1'));var rs=require(_0x70d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70d2('0x3'))['db'];var utils=require(_0x70d2('0x4'));var logger=require(_0x70d2('0x5'))(_0x70d2('0x6'));var config=require(_0x70d2('0x7'));var jayson=require(_0x70d2('0x8'));var client=jayson[_0x70d2('0x9')][_0x70d2('0xa')]({'port':0x232a});config[_0x70d2('0xb')]=_[_0x70d2('0xc')](config[_0x70d2('0xb')],{'host':_0x70d2('0xd'),'port':0x18eb});var socket=require(_0x70d2('0xe'))(new Redis(config[_0x70d2('0xb')]));require(_0x70d2('0xf'))[_0x70d2('0x10')](socket);function respondWithRpcPromise(_0x5c46db,_0x4a8a85,_0x71d4ce){return new BPromise(function(_0x1b9376,_0x409cb3){return client[_0x70d2('0x11')](_0x5c46db,_0x71d4ce)[_0x70d2('0x12')](function(_0xbfb61c){logger[_0x70d2('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a8a85,'request\x20sent');logger[_0x70d2('0x14')](_0x70d2('0x15'),_0x4a8a85,_0x70d2('0x16'),JSON[_0x70d2('0x17')](_0xbfb61c));if(_0xbfb61c[_0x70d2('0x18')]){if(_0xbfb61c[_0x70d2('0x18')][_0x70d2('0x19')]===0x1f4){logger[_0x70d2('0x18')](_0x70d2('0x1a'),_0x4a8a85,_0xbfb61c[_0x70d2('0x18')][_0x70d2('0x1b')]);return _0x409cb3(_0xbfb61c[_0x70d2('0x18')]['message']);}logger[_0x70d2('0x18')](_0x70d2('0x1a'),_0x4a8a85,_0xbfb61c[_0x70d2('0x18')]['message']);return _0x1b9376(_0xbfb61c[_0x70d2('0x18')][_0x70d2('0x1b')]);}else{logger[_0x70d2('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a8a85,_0x70d2('0x16'));_0x1b9376(_0xbfb61c[_0x70d2('0x1c')][_0x70d2('0x1b')]);}})[_0x70d2('0x1d')](function(_0x385b55){logger['error'](_0x70d2('0x1a'),_0x4a8a85,_0x385b55);_0x409cb3(_0x385b55);});});} \ No newline at end of file +var _0xb5c2=['result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x21c2eb,_0x16be3b){var _0x3e8fde=function(_0x39d8ab){while(--_0x39d8ab){_0x21c2eb['push'](_0x21c2eb['shift']());}};_0x3e8fde(++_0x16be3b);}(_0xb5c2,0x196));var _0x2b5c=function(_0x560815,_0x7cd52d){_0x560815=_0x560815-0x0;var _0xb70166=_0xb5c2[_0x560815];return _0xb70166;};'use strict';var _=require(_0x2b5c('0x0'));var util=require('util');var moment=require(_0x2b5c('0x1'));var BPromise=require(_0x2b5c('0x2'));var rs=require(_0x2b5c('0x3'));var fs=require('fs');var Redis=require(_0x2b5c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b5c('0x5'));var logger=require(_0x2b5c('0x6'))('rpc');var config=require(_0x2b5c('0x7'));var jayson=require(_0x2b5c('0x8'));var client=jayson['client'][_0x2b5c('0x9')]({'port':0x232a});config['redis']=_[_0x2b5c('0xa')](config[_0x2b5c('0xb')],{'host':_0x2b5c('0xc'),'port':0x18eb});var socket=require(_0x2b5c('0xd'))(new Redis(config[_0x2b5c('0xb')]));require(_0x2b5c('0xe'))[_0x2b5c('0xf')](socket);function respondWithRpcPromise(_0xfd9084,_0x4cef88,_0x455304){return new BPromise(function(_0x5a93b4,_0x3419a0){return client[_0x2b5c('0x10')](_0xfd9084,_0x455304)[_0x2b5c('0x11')](function(_0x4b82b0){logger[_0x2b5c('0x12')](_0x2b5c('0x13'),_0x4cef88,_0x2b5c('0x14'));logger['debug'](_0x2b5c('0x15'),_0x4cef88,'request\x20sent',JSON[_0x2b5c('0x16')](_0x4b82b0));if(_0x4b82b0[_0x2b5c('0x17')]){if(_0x4b82b0[_0x2b5c('0x17')][_0x2b5c('0x18')]===0x1f4){logger[_0x2b5c('0x17')](_0x2b5c('0x13'),_0x4cef88,_0x4b82b0[_0x2b5c('0x17')][_0x2b5c('0x19')]);return _0x3419a0(_0x4b82b0[_0x2b5c('0x17')]['message']);}logger[_0x2b5c('0x17')](_0x2b5c('0x13'),_0x4cef88,_0x4b82b0[_0x2b5c('0x17')][_0x2b5c('0x19')]);return _0x5a93b4(_0x4b82b0[_0x2b5c('0x17')][_0x2b5c('0x19')]);}else{logger['info'](_0x2b5c('0x13'),_0x4cef88,'request\x20sent');_0x5a93b4(_0x4b82b0[_0x2b5c('0x1a')][_0x2b5c('0x19')]);}})['catch'](function(_0x20d65c){logger[_0x2b5c('0x17')](_0x2b5c('0x13'),_0x4cef88,_0x20d65c);_0x3419a0(_0x20d65c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 902a4eb..76cd3cd 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 _0x9b87=['remove','update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x57ed7b,_0x4e6c9){var _0x586678=function(_0x300879){while(--_0x300879){_0x57ed7b['push'](_0x57ed7b['shift']());}};_0x586678(++_0x4e6c9);}(_0x9b87,0x8e));var _0x79b8=function(_0x300cd2,_0x2e376e){_0x300cd2=_0x300cd2-0x0;var _0x4d68fb=_0x9b87[_0x300cd2];return _0x4d68fb;};'use strict';var ChatInternalMessageEvents=require(_0x79b8('0x0'));var events=[_0x79b8('0x1'),_0x79b8('0x2'),_0x79b8('0x3')];function createListener(_0x77ad5c,_0x4386a6){return function(_0x23b645){_0x4386a6[_0x79b8('0x4')](_0x77ad5c,_0x23b645);};}function removeListener(_0xbc1e74,_0xa65bbc){return function(){ChatInternalMessageEvents[_0x79b8('0x5')](_0xbc1e74,_0xa65bbc);};}exports[_0x79b8('0x6')]=function(_0x3ccc53){for(var _0x2e21b9=0x0,_0x1d2c9f=events[_0x79b8('0x7')];_0x2e21b9<_0x1d2c9f;_0x2e21b9++){var _0x5e10fe=events[_0x2e21b9];var _0x4e0dd8=createListener('chatInternalMessage:'+_0x5e10fe,_0x3ccc53);ChatInternalMessageEvents['on'](_0x5e10fe,_0x4e0dd8);}}; \ No newline at end of file +var _0x6ec9=['./chatInternalMessage.events','remove','register','chatInternalMessage:'];(function(_0x3a3659,_0x443197){var _0x1e3218=function(_0x41eca5){while(--_0x41eca5){_0x3a3659['push'](_0x3a3659['shift']());}};_0x1e3218(++_0x443197);}(_0x6ec9,0x174));var _0x96ec=function(_0x314a3e,_0x5f520c){_0x314a3e=_0x314a3e-0x0;var _0x252c26=_0x6ec9[_0x314a3e];return _0x252c26;};'use strict';var ChatInternalMessageEvents=require(_0x96ec('0x0'));var events=['save',_0x96ec('0x1'),'update'];function createListener(_0x37c970,_0x4e91e7){return function(_0x15e89a){_0x4e91e7['emit'](_0x37c970,_0x15e89a);};}function removeListener(_0x112569,_0x286bd7){return function(){ChatInternalMessageEvents['removeListener'](_0x112569,_0x286bd7);};}exports[_0x96ec('0x2')]=function(_0x41a215){for(var _0x2fcbb7=0x0,_0x5bc079=events['length'];_0x2fcbb7<_0x5bc079;_0x2fcbb7++){var _0x5ee7a3=events[_0x2fcbb7];var _0x8214b2=createListener(_0x96ec('0x3')+_0x5ee7a3,_0x41a215);ChatInternalMessageEvents['on'](_0x5ee7a3,_0x8214b2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a25a5e8..31a1215 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 _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x44e068,_0x156947){var _0x114923=function(_0xc90d47){while(--_0xc90d47){_0x44e068['push'](_0x44e068['shift']());}};_0x114923(++_0x156947);}(_0x70e0,0x17b));var _0x070e=function(_0x3e9732,_0x4f2017){_0x3e9732=_0x3e9732-0x0;var _0xf95cb5=_0x70e0[_0x3e9732];return _0xf95cb5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2f28fa,_0x3c43ab){var _0x1a10bf=function(_0x50e5e5){while(--_0x50e5e5){_0x2f28fa['push'](_0x2f28fa['shift']());}};_0x1a10bf(++_0x3c43ab);}(_0xe706,0xa3));var _0x6e70=function(_0x150f94,_0x4f83cf){_0x150f94=_0x150f94-0x0;var _0x2e0fb6=_0xe706[_0x150f94];return _0x2e0fb6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 11e4f4e..7178c28 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 _0x0001=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x58ec72,_0x26d227){var _0xf7c89b=function(_0x4d5894){while(--_0x4d5894){_0x58ec72['push'](_0x58ec72['shift']());}};_0xf7c89b(++_0x26d227);}(_0x0001,0x1b9));var _0x1000=function(_0x16fc7,_0x52b74a){_0x16fc7=_0x16fc7-0x0;var _0x3ce042=_0x0001[_0x16fc7];return _0x3ce042;};'use strict';var Sequelize=require(_0x1000('0x0'));module[_0x1000('0x1')]={'body':{'type':Sequelize[_0x1000('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1000('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1000('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1000('0x4')]('in',_0x1000('0x5')),'defaultValue':_0x1000('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1000('0x6')]}}; \ No newline at end of file +var _0x6ca9=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0x6ca9,0xa7));var _0x96ca=function(_0x29bbf0,_0x247f64){_0x29bbf0=_0x29bbf0-0x0;var _0x47a2f2=_0x6ca9[_0x29bbf0];return _0x47a2f2;};'use strict';var Sequelize=require(_0x96ca('0x0'));module[_0x96ca('0x1')]={'body':{'type':Sequelize[_0x96ca('0x2')](_0x96ca('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96ca('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96ca('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96ca('0x5')]('in',_0x96ca('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x96ca('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 211af41..d5eec9d 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 _0x6206=['rejectMessage','SIP/%s','EventManager','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','ValidationError','request','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ChatMessage,\x20%s,\x20%s','status','end','json','count','limit','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','manual','interface','channel','event','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6206,0x1f3));var _0x6620=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x6206[_0x2d34d6];return _0x1d3d12;};'use strict';var pdf=require(_0x6620('0x0'));var emlformat=require(_0x6620('0x1'));var rimraf=require(_0x6620('0x2'));var zipdir=require(_0x6620('0x3'));var jsonpatch=require(_0x6620('0x4'));var rp=require(_0x6620('0x5'));var moment=require(_0x6620('0x6'));var BPromise=require(_0x6620('0x7'));var Mustache=require('mustache');var util=require(_0x6620('0x8'));var path=require(_0x6620('0x9'));var sox=require(_0x6620('0xa'));var csv=require(_0x6620('0xb'));var ejs=require(_0x6620('0xc'));var fs=require('fs');var _=require(_0x6620('0xd'));var squel=require(_0x6620('0xe'));var crypto=require('crypto');var jsforce=require(_0x6620('0xf'));var deskjs=require(_0x6620('0x10'));var toCsv=require(_0x6620('0xb'));var querystring=require(_0x6620('0x11'));var Papa=require(_0x6620('0x12'));var Redis=require(_0x6620('0x13'));var authService=require(_0x6620('0x14'));var qs=require(_0x6620('0x15'));var as=require(_0x6620('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6620('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6620('0x18'));var db=require(_0x6620('0x19'))['db'];config[_0x6620('0x1a')]=_['defaults'](config['redis'],{'host':_0x6620('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6620('0x1a')]));require(_0x6620('0x1c'))[_0x6620('0x1d')](socket);var jayson=require(_0x6620('0x1e'));var client=jayson[_0x6620('0x1f')][_0x6620('0x20')]({'port':0x232c});var client9002=jayson[_0x6620('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x44c897,_0xfcfef7,_0x392d01){if(_0x392d01){var _0x4fa46e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fa46e['test'](_0xfcfef7)){return _0x44c897;}else{throw new db['Sequelize'][(_0x6620('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 _0x44c897;}}function respondWithRpcPromise(_0x352453,_0x5434d3,_0x10128f,_0x512fe7){return new BPromise(function(_0x13fe66,_0xf1fd4){var _0x550fd4=_0x512fe7||client;return _0x550fd4[_0x6620('0x22')](_0x352453,_0x10128f)['then'](function(_0x2be8f8){logger[_0x6620('0x23')]('ChatMessage,\x20%s,\x20%s',_0x5434d3,'request\x20sent');logger[_0x6620('0x24')](_0x6620('0x25'),_0x5434d3,_0x6620('0x26'),JSON[_0x6620('0x27')](_0x2be8f8));if(_0x2be8f8['error']){if(_0x2be8f8['error'][_0x6620('0x28')]===0x1f4){logger[_0x6620('0x29')]('ChatMessage,\x20%s,\x20%s',_0x5434d3,_0x2be8f8['error'][_0x6620('0x2a')]);return _0xf1fd4(_0x2be8f8[_0x6620('0x29')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x5434d3,_0x2be8f8[_0x6620('0x29')]['message']);return _0x13fe66(_0x2be8f8[_0x6620('0x29')][_0x6620('0x2a')]);}else{logger[_0x6620('0x23')]('ChatMessage,\x20%s,\x20%s',_0x5434d3,_0x6620('0x26'));_0x13fe66(_0x2be8f8[_0x6620('0x2b')][_0x6620('0x2a')]);}})[_0x6620('0x2c')](function(_0x15ebb0){logger[_0x6620('0x29')](_0x6620('0x2d'),_0x5434d3,_0x15ebb0);_0xf1fd4(_0x15ebb0);});});}function respondWithStatusCode(_0x522e42,_0x397345){_0x397345=_0x397345||0xcc;return function(_0x21589a){if(_0x21589a){return _0x522e42['sendStatus'](_0x397345);}return _0x522e42[_0x6620('0x2e')](_0x397345)[_0x6620('0x2f')]();};}function respondWithResult(_0x5a543b,_0x4b63f9){_0x4b63f9=_0x4b63f9||0xc8;return function(_0x4a6536){if(_0x4a6536){return _0x5a543b[_0x6620('0x2e')](_0x4b63f9)[_0x6620('0x30')](_0x4a6536);}};}function respondWithFilteredResult(_0x4cff45,_0x102025){return function(_0x43c629){if(_0x43c629){var _0x15cfba=_0x43c629[_0x6620('0x31')],_0x1520a3=_0x102025['offset'],_0x2d9511=_0x102025['offset']+_0x102025[_0x6620('0x32')],_0x1c7b2d;if(_0x2d9511>=_0x15cfba){_0x2d9511=_0x15cfba;_0x1c7b2d=0xc8;}else{_0x1c7b2d=0xce;}_0x4cff45[_0x6620('0x2e')](_0x1c7b2d);return _0x4cff45[_0x6620('0x33')]('Content-Range',_0x1520a3+'-'+_0x2d9511+'/'+_0x15cfba)[_0x6620('0x30')](_0x43c629);}return null;};}function patchUpdates(_0x22a4de){return function(_0x330198){try{jsonpatch[_0x6620('0x34')](_0x330198,_0x22a4de,!![]);}catch(_0x506533){return BPromise[_0x6620('0x35')](_0x506533);}return _0x330198[_0x6620('0x36')]();};}function saveUpdates(_0x579f39,_0x4979db){return function(_0x5aeb92){if(_0x5aeb92){return _0x5aeb92[_0x6620('0x37')](_0x579f39)['then'](function(_0x4b9600){return _0x4b9600;});}return null;};}function removeEntity(_0x242481,_0x25c4e3){return function(_0x3e0841){if(_0x3e0841){return _0x3e0841[_0x6620('0x38')]()[_0x6620('0x39')](function(){_0x242481[_0x6620('0x2e')](0xcc)[_0x6620('0x2f')]();});}};}function handleEntityNotFound(_0x1ccc67,_0x477013){return function(_0x279beb){if(!_0x279beb){_0x1ccc67[_0x6620('0x3a')](0x194);}return _0x279beb;};}function handleError(_0x3223ba,_0x2bc707){_0x2bc707=_0x2bc707||0x1f4;return function(_0x1825a2){logger['error'](_0x1825a2[_0x6620('0x3b')]);if(_0x1825a2[_0x6620('0x3c')]){delete _0x1825a2[_0x6620('0x3c')];}_0x3223ba['status'](_0x2bc707)[_0x6620('0x3d')](_0x1825a2);};}exports[_0x6620('0x3e')]=function(_0xf8b11d,_0x733d72){var _0x29e7d0={},_0x140d49={},_0x1a895f={'count':0x0,'rows':[]};var _0x146ac1=_[_0x6620('0x3f')](db[_0x6620('0x40')][_0x6620('0x41')],function(_0x1ca3cc){return{'name':_0x1ca3cc[_0x6620('0x42')],'type':_0x1ca3cc['type'][_0x6620('0x43')]};});_0x140d49['model']=_[_0x6620('0x3f')](_0x146ac1,_0x6620('0x3c'));_0x140d49['query']=_[_0x6620('0x44')](_0xf8b11d['query']);_0x140d49[_0x6620('0x45')]=_[_0x6620('0x46')](_0x140d49[_0x6620('0x47')],_0x140d49['query']);_0x29e7d0[_0x6620('0x48')]=_[_0x6620('0x46')](_0x140d49[_0x6620('0x47')],qs[_0x6620('0x49')](_0xf8b11d[_0x6620('0x4a')][_0x6620('0x49')]));_0x29e7d0[_0x6620('0x48')]=_0x29e7d0[_0x6620('0x48')][_0x6620('0x4b')]?_0x29e7d0[_0x6620('0x48')]:_0x140d49[_0x6620('0x47')];if(!_0xf8b11d[_0x6620('0x4a')][_0x6620('0x4c')](_0x6620('0x4d'))){_0x29e7d0['limit']=qs['limit'](_0xf8b11d[_0x6620('0x4a')][_0x6620('0x32')]);_0x29e7d0['offset']=qs[_0x6620('0x4e')](_0xf8b11d[_0x6620('0x4a')][_0x6620('0x4e')]);}_0x29e7d0['order']=qs['sort'](_0xf8b11d[_0x6620('0x4a')][_0x6620('0x4f')]);_0x29e7d0[_0x6620('0x50')]=qs[_0x6620('0x45')](_[_0x6620('0x51')](_0xf8b11d['query'],_0x140d49[_0x6620('0x45')]),_0x146ac1);if(_0xf8b11d[_0x6620('0x4a')][_0x6620('0x52')]){_0x29e7d0[_0x6620('0x50')]=_['merge'](_0x29e7d0[_0x6620('0x50')],{'$or':_[_0x6620('0x3f')](_0x146ac1,function(_0xd76705){if(_0xd76705[_0x6620('0x53')]!=='VIRTUAL'){var _0x7d3c09={};_0x7d3c09[_0xd76705[_0x6620('0x3c')]]={'$like':'%'+_0xf8b11d[_0x6620('0x4a')][_0x6620('0x52')]+'%'};return _0x7d3c09;}})});}_0x29e7d0=_[_0x6620('0x54')]({},_0x29e7d0,_0xf8b11d[_0x6620('0x55')]);var _0xf9bfb4={'where':_0x29e7d0[_0x6620('0x50')]};return db['ChatMessage'][_0x6620('0x31')](_0xf9bfb4)['then'](function(_0x56b1da){_0x1a895f['count']=_0x56b1da;if(_0xf8b11d[_0x6620('0x4a')][_0x6620('0x56')]){_0x29e7d0[_0x6620('0x57')]=[{'all':!![]}];}return db[_0x6620('0x40')][_0x6620('0x58')](_0x29e7d0);})['then'](function(_0x168f09){_0x1a895f[_0x6620('0x59')]=_0x168f09;return _0x1a895f;})['then'](respondWithFilteredResult(_0x733d72,_0x29e7d0))[_0x6620('0x2c')](handleError(_0x733d72,null));};exports[_0x6620('0x5a')]=function(_0x2ea14d,_0x399a82){var _0x1291ee={'raw':!![],'where':{'id':_0x2ea14d[_0x6620('0x5b')]['id']}},_0x33cf8b={};_0x33cf8b[_0x6620('0x47')]=_['keys'](db[_0x6620('0x40')][_0x6620('0x41')]);_0x33cf8b[_0x6620('0x4a')]=_[_0x6620('0x44')](_0x2ea14d[_0x6620('0x4a')]);_0x33cf8b['filters']=_[_0x6620('0x46')](_0x33cf8b['model'],_0x33cf8b[_0x6620('0x4a')]);_0x1291ee[_0x6620('0x48')]=_['intersection'](_0x33cf8b[_0x6620('0x47')],qs[_0x6620('0x49')](_0x2ea14d[_0x6620('0x4a')][_0x6620('0x49')]));_0x1291ee[_0x6620('0x48')]=_0x1291ee[_0x6620('0x48')]['length']?_0x1291ee[_0x6620('0x48')]:_0x33cf8b[_0x6620('0x47')];if(_0x2ea14d[_0x6620('0x4a')][_0x6620('0x56')]){_0x1291ee[_0x6620('0x57')]=[{'all':!![]}];}_0x1291ee=_[_0x6620('0x54')]({},_0x1291ee,_0x2ea14d[_0x6620('0x55')]);return db['ChatMessage'][_0x6620('0x5c')](_0x1291ee)['then'](handleEntityNotFound(_0x399a82,null))['then'](respondWithResult(_0x399a82,null))[_0x6620('0x2c')](handleError(_0x399a82,null));};exports[_0x6620('0x5d')]=function(_0x27aa19,_0x478110){return db[_0x6620('0x40')][_0x6620('0x5d')](_0x27aa19[_0x6620('0x5e')],{})[_0x6620('0x39')](respondWithResult(_0x478110,0xc9))[_0x6620('0x2c')](handleError(_0x478110,null));};exports[_0x6620('0x37')]=function(_0x4a2be8,_0x3f4d2a){if(_0x4a2be8[_0x6620('0x5e')]['id']){delete _0x4a2be8[_0x6620('0x5e')]['id'];}return db[_0x6620('0x40')][_0x6620('0x5c')]({'where':{'id':_0x4a2be8[_0x6620('0x5b')]['id']}})[_0x6620('0x39')](handleEntityNotFound(_0x3f4d2a,null))[_0x6620('0x39')](saveUpdates(_0x4a2be8[_0x6620('0x5e')],null))[_0x6620('0x39')](respondWithResult(_0x3f4d2a,null))[_0x6620('0x2c')](handleError(_0x3f4d2a,null));};exports['destroy']=function(_0x3d90f4,_0x2fe5a6){return db['ChatMessage'][_0x6620('0x5c')]({'where':{'id':_0x3d90f4[_0x6620('0x5b')]['id']}})[_0x6620('0x39')](handleEntityNotFound(_0x2fe5a6,null))[_0x6620('0x39')](removeEntity(_0x2fe5a6,null))[_0x6620('0x2c')](handleError(_0x2fe5a6,null));};exports[_0x6620('0x5f')]=function(_0x1266c1,_0x3c3dde){return db[_0x6620('0x40')]['describe']()[_0x6620('0x39')](respondWithResult(_0x3c3dde,null))['catch'](handleError(_0x3c3dde,null));};var interaction_log=require('../../config/logger')(_0x6620('0x60'));exports[_0x6620('0x61')]=function(_0x57790c,_0x5c6c8f,_0x5ac376){var _0x53b7b6={'channel':_0x6620('0x62')};if(_0x57790c['body']['id']){delete _0x57790c[_0x6620('0x5e')]['id'];}_0x57790c[_0x6620('0x5e')]['read']=!![];_0x57790c['body']['readAt']=moment()['format'](_0x6620('0x63'));_0x57790c['body'][_0x6620('0x64')]=_0x57790c[_0x6620('0x5e')][_0x6620('0x64')]||_0x57790c['user']['id'];return db[_0x6620('0x40')][_0x6620('0x5c')]({'where':{'id':_0x57790c[_0x6620('0x5b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x6620('0x39')](handleEntityNotFound(_0x5c6c8f,null))['then'](saveUpdates(_0x57790c['body'],null))['then'](function(_0x341d1d){if(_0x341d1d){_0x53b7b6[_0x6620('0x2a')]=_0x341d1d[_0x6620('0x65')]({'plain':!![]});return db[_0x6620('0x66')][_0x6620('0x5c')]({'where':{'id':_0x341d1d[_0x6620('0x67')]}});}return null;})[_0x6620('0x39')](handleEntityNotFound(_0x5c6c8f,null))['then'](function(_0x159fcd){if(_0x159fcd){return _0x159fcd[_0x6620('0x37')]({'UserId':_0x57790c[_0x6620('0x5e')]['UserId'],'read1stAt':_[_0x6620('0x68')](_0x159fcd[_0x6620('0x69')])?moment()[_0x6620('0x6a')](_0x6620('0x63')):undefined});}return null;})[_0x6620('0x39')](function(_0x2c0b57){if(_0x2c0b57){_0x53b7b6[_0x6620('0x6b')]=_0x2c0b57[_0x6620('0x65')]({'plain':!![]});interaction_log[_0x6620('0x23')](_0x6620('0x6c'),_0x57790c[_0x6620('0x6d')]['id'],_0x57790c['user'][_0x6620('0x3c')],_0x57790c[_0x6620('0x6d')][_0x6620('0x6e')],_0x53b7b6[_0x6620('0x6b')]['id'],_0x57790c[_0x6620('0x5e')]?JSON[_0x6620('0x27')](_0x57790c[_0x6620('0x5e')]):_0x6620('0x6f'));return respondWithRpcPromise(_0x6620('0x70'),'acceptMessage',_0x53b7b6);}return null;})[_0x6620('0x39')](function(_0x12db5f){if(_0x12db5f){if(_0x57790c[_0x6620('0x5e')][_0x6620('0x71')]){_0x53b7b6[_0x6620('0x2a')][_0x6620('0x72')]=util[_0x6620('0x6a')]('SIP/%s',_0x57790c['user'][_0x6620('0x3c')]);_0x53b7b6['message'][_0x6620('0x73')]=_0x53b7b6[_0x6620('0x73')];_0x53b7b6[_0x6620('0x2a')][_0x6620('0x74')]=_0x6620('0x61');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6620('0x75'),'message':_['merge'](_0x53b7b6['message'],JSON[_0x6620('0x76')](_0x53b7b6[_0x6620('0x6b')]['formData']))},client9002)[_0x6620('0x39')](function(){return _0x53b7b6;});}return _0x53b7b6;}return null;})[_0x6620('0x39')](respondWithResult(_0x5c6c8f,null))['catch'](handleError(_0x5c6c8f,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x6620('0x35')]=function(_0x4e7055,_0x125c23,_0x4fb359){var _0x543e88={'agent':{},'channel':_0x6620('0x62')};if(_0x4e7055[_0x6620('0x5e')]['id']){delete _0x4e7055[_0x6620('0x5e')]['id'];}_0x4e7055['body'][_0x6620('0x64')]=_0x4e7055[_0x6620('0x5e')]['UserId']||_0x4e7055[_0x6620('0x6d')]['id'];_0x543e88['agent']['id']=_0x4e7055[_0x6620('0x5e')]['UserId'];return db[_0x6620('0x40')][_0x6620('0x5c')]({'where':{'id':_0x4e7055[_0x6620('0x5b')]['id'],'UserId':null}})[_0x6620('0x39')](handleEntityNotFound(_0x125c23,null))['then'](function(_0x1f1639){if(_0x1f1639){_0x543e88['message']=_0x1f1639[_0x6620('0x65')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1f1639['ChatInteractionId']}});}return null;})[_0x6620('0x39')](handleEntityNotFound(_0x125c23,null))[_0x6620('0x39')](function(_0x41a0a3){if(_0x41a0a3){_0x543e88[_0x6620('0x6b')]=_0x41a0a3[_0x6620('0x65')]({'plain':!![]});interaction_log[_0x6620('0x23')](_0x6620('0x77'),_0x4e7055[_0x6620('0x6d')]['id'],_0x4e7055[_0x6620('0x6d')]['name'],_0x4e7055[_0x6620('0x6d')]['role'],_0x543e88[_0x6620('0x6b')]['id'],_0x4e7055[_0x6620('0x5e')]?JSON['stringify'](_0x4e7055['body']):_0x6620('0x6f'));return respondWithRpcPromise(_0x6620('0x78'),_0x6620('0x79'),_0x543e88);}return null;})['then'](function(_0x904c25){if(_0x904c25){_0x904c25['message'][_0x6620('0x72')]=util[_0x6620('0x6a')](_0x6620('0x7a'),_0x4e7055['user'][_0x6620('0x3c')]);_0x904c25[_0x6620('0x2a')][_0x6620('0x73')]=_0x543e88[_0x6620('0x73')];_0x904c25[_0x6620('0x2a')][_0x6620('0x74')]=_0x6620('0x35');respondWithRpcPromise('EventManager',_0x6620('0x7b'),{'event':'rejectmessage','message':_0x904c25[_0x6620('0x2a')]},client9002);return _0x543e88;}return null;})[_0x6620('0x39')](respondWithResult(_0x125c23,null))[_0x6620('0x2c')](handleError(_0x125c23,null));}; \ No newline at end of file +var _0x7a51=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','count','offset','set','Content-Range','apply','save','update','destroy','sendStatus','stack','send','index','map','ChatMessage','rawAttributes','fieldName','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','parse','formData','reject','rejectMessage','interface','event','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x7a51,0x162));var _0x17a5=function(_0xaee70f,_0x33c2df){_0xaee70f=_0xaee70f-0x0;var _0xc0609b=_0x7a51[_0xaee70f];return _0xc0609b;};'use strict';var pdf=require(_0x17a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17a5('0x1'));var zipdir=require(_0x17a5('0x2'));var jsonpatch=require(_0x17a5('0x3'));var rp=require(_0x17a5('0x4'));var moment=require(_0x17a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x17a5('0x6'));var util=require(_0x17a5('0x7'));var path=require(_0x17a5('0x8'));var sox=require(_0x17a5('0x9'));var csv=require(_0x17a5('0xa'));var ejs=require(_0x17a5('0xb'));var fs=require('fs');var _=require(_0x17a5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x17a5('0xa'));var querystring=require('querystring');var Papa=require(_0x17a5('0xd'));var Redis=require(_0x17a5('0xe'));var authService=require(_0x17a5('0xf'));var qs=require(_0x17a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17a5('0x11'));var logger=require(_0x17a5('0x12'))('api');var utils=require(_0x17a5('0x13'));var config=require(_0x17a5('0x14'));var db=require(_0x17a5('0x15'))['db'];config[_0x17a5('0x16')]=_[_0x17a5('0x17')](config[_0x17a5('0x16')],{'host':_0x17a5('0x18'),'port':0x18eb});var socket=require(_0x17a5('0x19'))(new Redis(config[_0x17a5('0x16')]));require('./chatMessage.socket')[_0x17a5('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x17a5('0x1b')]({'port':0x232c});var client9002=jayson[_0x17a5('0x1c')][_0x17a5('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1e2318,_0x448645,_0x34d13d){if(_0x34d13d){var _0x52d234=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52d234[_0x17a5('0x1d')](_0x448645)){return _0x1e2318;}else{throw new db[(_0x17a5('0x1e'))][(_0x17a5('0x1f'))](_0x17a5('0x20'));}}else{return _0x1e2318;}}function respondWithRpcPromise(_0x438788,_0x2634b3,_0x3b5403,_0x17847c){return new BPromise(function(_0x4dd59d,_0x575a80){var _0x32f94a=_0x17847c||client;return _0x32f94a[_0x17a5('0x21')](_0x438788,_0x3b5403)[_0x17a5('0x22')](function(_0x13019d){logger[_0x17a5('0x23')](_0x17a5('0x24'),_0x2634b3,'request\x20sent');logger['debug'](_0x17a5('0x25'),_0x2634b3,'request\x20sent',JSON[_0x17a5('0x26')](_0x13019d));if(_0x13019d[_0x17a5('0x27')]){if(_0x13019d[_0x17a5('0x27')][_0x17a5('0x28')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2634b3,_0x13019d['error'][_0x17a5('0x29')]);return _0x575a80(_0x13019d[_0x17a5('0x27')][_0x17a5('0x29')]);}logger[_0x17a5('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2634b3,_0x13019d[_0x17a5('0x27')]['message']);return _0x4dd59d(_0x13019d[_0x17a5('0x27')][_0x17a5('0x29')]);}else{logger[_0x17a5('0x23')](_0x17a5('0x24'),_0x2634b3,_0x17a5('0x2a'));_0x4dd59d(_0x13019d[_0x17a5('0x2b')][_0x17a5('0x29')]);}})[_0x17a5('0x2c')](function(_0x4ae380){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2634b3,_0x4ae380);_0x575a80(_0x4ae380);});});}function respondWithStatusCode(_0x30318d,_0x477e4c){_0x477e4c=_0x477e4c||0xcc;return function(_0x4221b7){if(_0x4221b7){return _0x30318d['sendStatus'](_0x477e4c);}return _0x30318d['status'](_0x477e4c)['end']();};}function respondWithResult(_0x2147eb,_0x82af4d){_0x82af4d=_0x82af4d||0xc8;return function(_0xd7d437){if(_0xd7d437){return _0x2147eb[_0x17a5('0x2d')](_0x82af4d)[_0x17a5('0x2e')](_0xd7d437);}};}function respondWithFilteredResult(_0x5871f8,_0x2b6b09){return function(_0x1d0814){if(_0x1d0814){var _0x43295b=_0x1d0814[_0x17a5('0x2f')],_0x1fbcca=_0x2b6b09[_0x17a5('0x30')],_0xf7e254=_0x2b6b09[_0x17a5('0x30')]+_0x2b6b09['limit'],_0x1fa91e;if(_0xf7e254>=_0x43295b){_0xf7e254=_0x43295b;_0x1fa91e=0xc8;}else{_0x1fa91e=0xce;}_0x5871f8[_0x17a5('0x2d')](_0x1fa91e);return _0x5871f8[_0x17a5('0x31')](_0x17a5('0x32'),_0x1fbcca+'-'+_0xf7e254+'/'+_0x43295b)[_0x17a5('0x2e')](_0x1d0814);}return null;};}function patchUpdates(_0x55e636){return function(_0x3f9e0f){try{jsonpatch[_0x17a5('0x33')](_0x3f9e0f,_0x55e636,!![]);}catch(_0x167013){return BPromise['reject'](_0x167013);}return _0x3f9e0f[_0x17a5('0x34')]();};}function saveUpdates(_0x408332,_0x331155){return function(_0x1ea020){if(_0x1ea020){return _0x1ea020[_0x17a5('0x35')](_0x408332)[_0x17a5('0x22')](function(_0x3601e6){return _0x3601e6;});}return null;};}function removeEntity(_0x41b245,_0xe9f4db){return function(_0x190ecf){if(_0x190ecf){return _0x190ecf[_0x17a5('0x36')]()['then'](function(){_0x41b245[_0x17a5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21bc97,_0x371b4c){return function(_0x4fcff0){if(!_0x4fcff0){_0x21bc97[_0x17a5('0x37')](0x194);}return _0x4fcff0;};}function handleError(_0x108eea,_0x59e9d8){_0x59e9d8=_0x59e9d8||0x1f4;return function(_0x32bf71){logger['error'](_0x32bf71[_0x17a5('0x38')]);if(_0x32bf71['name']){delete _0x32bf71['name'];}_0x108eea[_0x17a5('0x2d')](_0x59e9d8)[_0x17a5('0x39')](_0x32bf71);};}exports[_0x17a5('0x3a')]=function(_0x1df47a,_0x2a8232){var _0x26f194={},_0x337bf7={},_0x10558c={'count':0x0,'rows':[]};var _0x314e9f=_[_0x17a5('0x3b')](db[_0x17a5('0x3c')][_0x17a5('0x3d')],function(_0x5c86f6){return{'name':_0x5c86f6[_0x17a5('0x3e')],'type':_0x5c86f6['type']['key']};});_0x337bf7[_0x17a5('0x3f')]=_[_0x17a5('0x3b')](_0x314e9f,_0x17a5('0x40'));_0x337bf7[_0x17a5('0x41')]=_['keys'](_0x1df47a['query']);_0x337bf7[_0x17a5('0x42')]=_['intersection'](_0x337bf7[_0x17a5('0x3f')],_0x337bf7[_0x17a5('0x41')]);_0x26f194[_0x17a5('0x43')]=_['intersection'](_0x337bf7['model'],qs['fields'](_0x1df47a['query'][_0x17a5('0x44')]));_0x26f194[_0x17a5('0x43')]=_0x26f194[_0x17a5('0x43')][_0x17a5('0x45')]?_0x26f194[_0x17a5('0x43')]:_0x337bf7[_0x17a5('0x3f')];if(!_0x1df47a[_0x17a5('0x41')][_0x17a5('0x46')](_0x17a5('0x47'))){_0x26f194[_0x17a5('0x48')]=qs[_0x17a5('0x48')](_0x1df47a[_0x17a5('0x41')]['limit']);_0x26f194[_0x17a5('0x30')]=qs['offset'](_0x1df47a[_0x17a5('0x41')][_0x17a5('0x30')]);}_0x26f194['order']=qs[_0x17a5('0x49')](_0x1df47a[_0x17a5('0x41')][_0x17a5('0x49')]);_0x26f194[_0x17a5('0x4a')]=qs['filters'](_[_0x17a5('0x4b')](_0x1df47a[_0x17a5('0x41')],_0x337bf7['filters']),_0x314e9f);if(_0x1df47a[_0x17a5('0x41')][_0x17a5('0x4c')]){_0x26f194['where']=_[_0x17a5('0x4d')](_0x26f194[_0x17a5('0x4a')],{'$or':_['map'](_0x314e9f,function(_0x4504cc){if(_0x4504cc[_0x17a5('0x4e')]!=='VIRTUAL'){var _0x17c207={};_0x17c207[_0x4504cc['name']]={'$like':'%'+_0x1df47a[_0x17a5('0x41')]['filter']+'%'};return _0x17c207;}})});}_0x26f194=_['merge']({},_0x26f194,_0x1df47a['options']);var _0x53ac8b={'where':_0x26f194[_0x17a5('0x4a')]};return db[_0x17a5('0x3c')]['count'](_0x53ac8b)[_0x17a5('0x22')](function(_0x164929){_0x10558c['count']=_0x164929;if(_0x1df47a[_0x17a5('0x41')][_0x17a5('0x4f')]){_0x26f194[_0x17a5('0x50')]=[{'all':!![]}];}return db[_0x17a5('0x3c')][_0x17a5('0x51')](_0x26f194);})[_0x17a5('0x22')](function(_0x19e2f2){_0x10558c[_0x17a5('0x52')]=_0x19e2f2;return _0x10558c;})['then'](respondWithFilteredResult(_0x2a8232,_0x26f194))['catch'](handleError(_0x2a8232,null));};exports[_0x17a5('0x53')]=function(_0x2e6cc4,_0x3b675a){var _0x3d8680={'raw':!![],'where':{'id':_0x2e6cc4[_0x17a5('0x54')]['id']}},_0x6a1c92={};_0x6a1c92['model']=_[_0x17a5('0x55')](db[_0x17a5('0x3c')][_0x17a5('0x3d')]);_0x6a1c92['query']=_[_0x17a5('0x55')](_0x2e6cc4[_0x17a5('0x41')]);_0x6a1c92[_0x17a5('0x42')]=_[_0x17a5('0x56')](_0x6a1c92[_0x17a5('0x3f')],_0x6a1c92[_0x17a5('0x41')]);_0x3d8680[_0x17a5('0x43')]=_[_0x17a5('0x56')](_0x6a1c92[_0x17a5('0x3f')],qs[_0x17a5('0x44')](_0x2e6cc4[_0x17a5('0x41')][_0x17a5('0x44')]));_0x3d8680[_0x17a5('0x43')]=_0x3d8680[_0x17a5('0x43')][_0x17a5('0x45')]?_0x3d8680['attributes']:_0x6a1c92[_0x17a5('0x3f')];if(_0x2e6cc4[_0x17a5('0x41')][_0x17a5('0x4f')]){_0x3d8680['include']=[{'all':!![]}];}_0x3d8680=_[_0x17a5('0x4d')]({},_0x3d8680,_0x2e6cc4['options']);return db[_0x17a5('0x3c')][_0x17a5('0x57')](_0x3d8680)[_0x17a5('0x22')](handleEntityNotFound(_0x3b675a,null))[_0x17a5('0x22')](respondWithResult(_0x3b675a,null))['catch'](handleError(_0x3b675a,null));};exports[_0x17a5('0x58')]=function(_0x16cb55,_0x3ba218){return db['ChatMessage'][_0x17a5('0x58')](_0x16cb55[_0x17a5('0x59')],{})[_0x17a5('0x22')](respondWithResult(_0x3ba218,0xc9))[_0x17a5('0x2c')](handleError(_0x3ba218,null));};exports[_0x17a5('0x35')]=function(_0x482058,_0x5b5bbe){if(_0x482058['body']['id']){delete _0x482058['body']['id'];}return db[_0x17a5('0x3c')][_0x17a5('0x57')]({'where':{'id':_0x482058[_0x17a5('0x54')]['id']}})[_0x17a5('0x22')](handleEntityNotFound(_0x5b5bbe,null))[_0x17a5('0x22')](saveUpdates(_0x482058[_0x17a5('0x59')],null))[_0x17a5('0x22')](respondWithResult(_0x5b5bbe,null))['catch'](handleError(_0x5b5bbe,null));};exports[_0x17a5('0x36')]=function(_0x276bc2,_0x2d1e20){return db[_0x17a5('0x3c')][_0x17a5('0x57')]({'where':{'id':_0x276bc2[_0x17a5('0x54')]['id']}})[_0x17a5('0x22')](handleEntityNotFound(_0x2d1e20,null))[_0x17a5('0x22')](removeEntity(_0x2d1e20,null))['catch'](handleError(_0x2d1e20,null));};exports[_0x17a5('0x5a')]=function(_0x84555e,_0xc2c606){return db['ChatMessage'][_0x17a5('0x5a')]()[_0x17a5('0x22')](respondWithResult(_0xc2c606,null))[_0x17a5('0x2c')](handleError(_0xc2c606,null));};var interaction_log=require(_0x17a5('0x12'))(_0x17a5('0x5b'));exports[_0x17a5('0x5c')]=function(_0x8d9bee,_0x344156,_0x35114e){var _0x48724d={'channel':_0x17a5('0x5d')};if(_0x8d9bee[_0x17a5('0x59')]['id']){delete _0x8d9bee['body']['id'];}_0x8d9bee['body'][_0x17a5('0x5e')]=!![];_0x8d9bee[_0x17a5('0x59')][_0x17a5('0x5f')]=moment()['format'](_0x17a5('0x60'));_0x8d9bee[_0x17a5('0x59')][_0x17a5('0x61')]=_0x8d9bee[_0x17a5('0x59')][_0x17a5('0x61')]||_0x8d9bee['user']['id'];return db[_0x17a5('0x3c')]['find']({'where':{'id':_0x8d9bee[_0x17a5('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x17a5('0x62')],'as':_0x17a5('0x63')}]})['then'](handleEntityNotFound(_0x344156,null))[_0x17a5('0x22')](saveUpdates(_0x8d9bee[_0x17a5('0x59')],null))[_0x17a5('0x22')](function(_0x280c20){if(_0x280c20){_0x48724d[_0x17a5('0x29')]=_0x280c20[_0x17a5('0x64')]({'plain':!![]});return db[_0x17a5('0x65')][_0x17a5('0x57')]({'where':{'id':_0x280c20[_0x17a5('0x66')]}});}return null;})[_0x17a5('0x22')](handleEntityNotFound(_0x344156,null))['then'](function(_0x3674d4){if(_0x3674d4){return _0x3674d4[_0x17a5('0x35')]({'UserId':_0x8d9bee[_0x17a5('0x59')][_0x17a5('0x61')],'read1stAt':_[_0x17a5('0x67')](_0x3674d4[_0x17a5('0x68')])?moment()[_0x17a5('0x69')](_0x17a5('0x60')):undefined});}return null;})[_0x17a5('0x22')](function(_0x3f4826){if(_0x3f4826){_0x48724d[_0x17a5('0x6a')]=_0x3f4826[_0x17a5('0x64')]({'plain':!![]});interaction_log[_0x17a5('0x23')](_0x17a5('0x6b'),_0x8d9bee[_0x17a5('0x6c')]['id'],_0x8d9bee[_0x17a5('0x6c')][_0x17a5('0x40')],_0x8d9bee[_0x17a5('0x6c')][_0x17a5('0x6d')],_0x48724d[_0x17a5('0x6a')]['id'],_0x8d9bee[_0x17a5('0x59')]?JSON[_0x17a5('0x26')](_0x8d9bee[_0x17a5('0x59')]):_0x17a5('0x6e'));return respondWithRpcPromise(_0x17a5('0x6f'),_0x17a5('0x70'),_0x48724d);}return null;})[_0x17a5('0x22')](function(_0xbef048){if(_0xbef048){if(_0x8d9bee['body'][_0x17a5('0x71')]){_0x48724d[_0x17a5('0x29')]['interface']=util['format'](_0x17a5('0x72'),_0x8d9bee[_0x17a5('0x6c')][_0x17a5('0x40')]);_0x48724d[_0x17a5('0x29')][_0x17a5('0x73')]=_0x48724d['channel'];_0x48724d[_0x17a5('0x29')]['event']=_0x17a5('0x5c');return respondWithRpcPromise(_0x17a5('0x74'),_0x17a5('0x74'),{'event':_0x17a5('0x75'),'message':_[_0x17a5('0x4d')](_0x48724d[_0x17a5('0x29')],JSON[_0x17a5('0x76')](_0x48724d[_0x17a5('0x6a')][_0x17a5('0x77')]))},client9002)['then'](function(){return _0x48724d;});}return _0x48724d;}return null;})[_0x17a5('0x22')](respondWithResult(_0x344156,null))[_0x17a5('0x2c')](handleError(_0x344156,null));};var interaction_log=require(_0x17a5('0x12'))(_0x17a5('0x5b'));exports[_0x17a5('0x78')]=function(_0x52f133,_0x3319c0,_0x35be50){var _0xb0677e={'agent':{},'channel':_0x17a5('0x5d')};if(_0x52f133[_0x17a5('0x59')]['id']){delete _0x52f133[_0x17a5('0x59')]['id'];}_0x52f133[_0x17a5('0x59')]['UserId']=_0x52f133[_0x17a5('0x59')][_0x17a5('0x61')]||_0x52f133[_0x17a5('0x6c')]['id'];_0xb0677e['agent']['id']=_0x52f133['body'][_0x17a5('0x61')];return db[_0x17a5('0x3c')][_0x17a5('0x57')]({'where':{'id':_0x52f133['params']['id'],'UserId':null}})[_0x17a5('0x22')](handleEntityNotFound(_0x3319c0,null))[_0x17a5('0x22')](function(_0x336063){if(_0x336063){_0xb0677e['message']=_0x336063[_0x17a5('0x64')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x336063[_0x17a5('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3319c0,null))[_0x17a5('0x22')](function(_0x2fd18d){if(_0x2fd18d){_0xb0677e[_0x17a5('0x6a')]=_0x2fd18d[_0x17a5('0x64')]({'plain':!![]});interaction_log[_0x17a5('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52f133[_0x17a5('0x6c')]['id'],_0x52f133[_0x17a5('0x6c')][_0x17a5('0x40')],_0x52f133['user'][_0x17a5('0x6d')],_0xb0677e['interaction']['id'],_0x52f133[_0x17a5('0x59')]?JSON[_0x17a5('0x26')](_0x52f133[_0x17a5('0x59')]):_0x17a5('0x6e'));return respondWithRpcPromise('RejectMessage',_0x17a5('0x79'),_0xb0677e);}return null;})[_0x17a5('0x22')](function(_0x1abc38){if(_0x1abc38){_0x1abc38[_0x17a5('0x29')][_0x17a5('0x7a')]=util[_0x17a5('0x69')](_0x17a5('0x72'),_0x52f133[_0x17a5('0x6c')][_0x17a5('0x40')]);_0x1abc38['message'][_0x17a5('0x73')]=_0xb0677e[_0x17a5('0x73')];_0x1abc38[_0x17a5('0x29')][_0x17a5('0x7b')]=_0x17a5('0x78');respondWithRpcPromise(_0x17a5('0x74'),_0x17a5('0x74'),{'event':_0x17a5('0x7c'),'message':_0x1abc38[_0x17a5('0x29')]},client9002);return _0xb0677e;}return null;})[_0x17a5('0x22')](respondWithResult(_0x3319c0,null))[_0x17a5('0x2c')](handleError(_0x3319c0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9fbf2df..f2acf1e 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 _0x4c7d=['emit','hasOwnProperty','hook','exports','events','ChatMessage','remove'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x4c7d,0xa5));var _0xd4c7=function(_0x4e15ef,_0x355dcb){_0x4e15ef=_0x4e15ef-0x0;var _0x2a050f=_0x4c7d[_0x4e15ef];return _0x2a050f;};'use strict';var EventEmitter=require(_0xd4c7('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xd4c7('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd4c7('0x2')};function emitEvent(_0x58ee48){return function(_0xf8f68,_0x3b0be2,_0x9c097c){ChatMessageEvents[_0xd4c7('0x3')](_0x58ee48+':'+_0xf8f68['id'],_0xf8f68);ChatMessageEvents[_0xd4c7('0x3')](_0x58ee48,_0xf8f68);_0x9c097c(null);};}for(var e in events){if(events[_0xd4c7('0x4')](e)){var event=events[e];ChatMessage[_0xd4c7('0x5')](e,emitEvent(event));}}module[_0xd4c7('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xde0a=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde0a,0x1e6));var _0xade0=function(_0x495f61,_0x3186ba){_0x495f61=_0x495f61-0x0;var _0x52c620=_0xde0a[_0x495f61];return _0x52c620;};'use strict';var EventEmitter=require(_0xade0('0x0'));var ChatMessage=require(_0xade0('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xade0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xade0('0x3'),'afterDestroy':_0xade0('0x4')};function emitEvent(_0x334133){return function(_0x7833ab,_0x248161,_0x1cf864){ChatMessageEvents[_0xade0('0x5')](_0x334133+':'+_0x7833ab['id'],_0x7833ab);ChatMessageEvents[_0xade0('0x5')](_0x334133,_0x7833ab);_0x1cf864(null);};}for(var e in events){if(events[_0xade0('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xade0('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index cf42831..edf3aca 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 _0xd86c=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt'];(function(_0x22526a,_0x1de763){var _0xc0189e=function(_0x454bcc){while(--_0x454bcc){_0x22526a['push'](_0x22526a['shift']());}};_0xc0189e(++_0x1de763);}(_0xd86c,0x1a3));var _0xcd86=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xd86c[_0x257495];return _0x3849aa;};'use strict';var _=require(_0xcd86('0x0'));var util=require(_0xcd86('0x1'));var logger=require(_0xcd86('0x2'))(_0xcd86('0x3'));var moment=require(_0xcd86('0x4'));var BPromise=require(_0xcd86('0x5'));var rp=require(_0xcd86('0x6'));var fs=require('fs');var path=require(_0xcd86('0x7'));var rimraf=require(_0xcd86('0x8'));var config=require(_0xcd86('0x9'));var attributes=require(_0xcd86('0xa'));module['exports']=function(_0x56ae83,_0x34ea79){return _0x56ae83[_0xcd86('0xb')](_0xcd86('0xc'),attributes,{'tableName':_0xcd86('0xd'),'paranoid':![],'indexes':[{'name':_0xcd86('0xe'),'fields':[_0xcd86('0xf')],'type':_0xcd86('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2670d1,_0x585947,_0x14cddc){var _0x14a036=_0x56ae83[_0xcd86('0x11')];var _0x426beb=_0x2670d1[_0xcd86('0x12')]({'plain':!![]});if(_0x426beb[_0xcd86('0x13')][_0xcd86('0x14')]()==='in'||_0x426beb['direction'][_0xcd86('0x14')]()===_0xcd86('0x15')&&!_0x426beb['secret']&&!_[_0xcd86('0x16')](_0x426beb[_0xcd86('0x17')])){_0x14a036[_0xcd86('0x18')][_0xcd86('0x19')]({'where':{'id':_0x426beb[_0xcd86('0x1a')]}})['then'](function(_0x48bef1){if(_0x48bef1){_0x48bef1[_0xcd86('0x1b')]({'lastMsgAt':_0x426beb[_0xcd86('0x1c')],'lastMsgDirection':_0x426beb['direction'][_0xcd86('0x14')]()});}})[_0xcd86('0x1d')](function(_0x1a4449){console['error'](_0x1a4449);});}_0x14cddc();}},'charset':_0xcd86('0x1e'),'collate':_0xcd86('0x1f')});}; \ No newline at end of file +var _0xb5ab=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','then','update'];(function(_0x5161cf,_0xcd0fce){var _0x5c052a=function(_0x40b025){while(--_0x40b025){_0x5161cf['push'](_0x5161cf['shift']());}};_0x5c052a(++_0xcd0fce);}(_0xb5ab,0x1d8));var _0xbb5a=function(_0x1fa008,_0x2012be){_0x1fa008=_0x1fa008-0x0;var _0x21e1dc=_0xb5ab[_0x1fa008];return _0x21e1dc;};'use strict';var _=require(_0xbb5a('0x0'));var util=require('util');var logger=require(_0xbb5a('0x1'))(_0xbb5a('0x2'));var moment=require(_0xbb5a('0x3'));var BPromise=require(_0xbb5a('0x4'));var rp=require(_0xbb5a('0x5'));var fs=require('fs');var path=require(_0xbb5a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xbb5a('0x7')]=function(_0xb41342,_0x10c289){return _0xb41342['define'](_0xbb5a('0x8'),attributes,{'tableName':_0xbb5a('0x9'),'paranoid':![],'indexes':[{'name':_0xbb5a('0xa'),'fields':[_0xbb5a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f00df,_0x43721a,_0x40360d){var _0x3a1b5a=_0xb41342[_0xbb5a('0xc')];var _0x43a355=_0x2f00df[_0xbb5a('0xd')]({'plain':!![]});if(_0x43a355[_0xbb5a('0xe')][_0xbb5a('0xf')]()==='in'||_0x43a355[_0xbb5a('0xe')][_0xbb5a('0xf')]()===_0xbb5a('0x10')&&!_0x43a355['secret']&&!_[_0xbb5a('0x11')](_0x43a355['UserId'])){_0x3a1b5a[_0xbb5a('0x12')][_0xbb5a('0x13')]({'where':{'id':_0x43a355['ChatInteractionId']}})[_0xbb5a('0x14')](function(_0x83344b){if(_0x83344b){_0x83344b[_0xbb5a('0x15')]({'lastMsgAt':_0x43a355['createdAt'],'lastMsgDirection':_0x43a355[_0xbb5a('0xe')][_0xbb5a('0xf')]()});}})[_0xbb5a('0x16')](function(_0x16f031){console[_0xbb5a('0x17')](_0x16f031);});}_0x40360d();}},'charset':_0xbb5a('0x18'),'collate':_0xbb5a('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0704953..02e9610 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 _0x023d=['http','redis','defaults','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x43bd41,_0x9e5b40){var _0xecbe39=function(_0x5f5b1a){while(--_0x5f5b1a){_0x43bd41['push'](_0x43bd41['shift']());}};_0xecbe39(++_0x9e5b40);}(_0x023d,0x1ab));var _0xd023=function(_0x229f03,_0x417ce7){_0x229f03=_0x229f03-0x0;var _0x2d5987=_0x023d[_0x229f03];return _0x2d5987;};'use strict';var _=require(_0xd023('0x0'));var util=require(_0xd023('0x1'));var moment=require(_0xd023('0x2'));var BPromise=require(_0xd023('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd023('0x4'));var db=require(_0xd023('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd023('0x6'));var config=require(_0xd023('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd023('0x8')]({'port':0x232a});config[_0xd023('0x9')]=_[_0xd023('0xa')](config[_0xd023('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xd023('0xb')](socket);function respondWithRpcPromise(_0x527006,_0x4e58a6,_0x274670){return new BPromise(function(_0x4b8707,_0x54c532){return client[_0xd023('0xc')](_0x527006,_0x274670)['then'](function(_0x1e65ef){logger[_0xd023('0xd')]('ChatMessage,\x20%s,\x20%s',_0x4e58a6,_0xd023('0xe'));logger[_0xd023('0xf')](_0xd023('0x10'),_0x4e58a6,_0xd023('0xe'),JSON[_0xd023('0x11')](_0x1e65ef));if(_0x1e65ef[_0xd023('0x12')]){if(_0x1e65ef[_0xd023('0x12')]['code']===0x1f4){logger['error'](_0xd023('0x13'),_0x4e58a6,_0x1e65ef[_0xd023('0x12')][_0xd023('0x14')]);return _0x54c532(_0x1e65ef[_0xd023('0x12')]['message']);}logger[_0xd023('0x12')](_0xd023('0x13'),_0x4e58a6,_0x1e65ef[_0xd023('0x12')][_0xd023('0x14')]);return _0x4b8707(_0x1e65ef['error']['message']);}else{logger['info'](_0xd023('0x13'),_0x4e58a6,'request\x20sent');_0x4b8707(_0x1e65ef[_0xd023('0x15')]['message']);}})[_0xd023('0x16')](function(_0x2e5aae){logger[_0xd023('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4e58a6,_0x2e5aae);_0x54c532(_0x2e5aae);});});}exports[_0xd023('0x17')]=function(_0x8c5040){var _0x1c28cc=this;return new Promise(function(_0xdb5e8b,_0x52fb6f){return db[_0xd023('0x18')]['create'](_0x8c5040[_0xd023('0x19')],{'raw':_0x8c5040[_0xd023('0x1a')]?_0x8c5040[_0xd023('0x1a')][_0xd023('0x1b')]===undefined?!![]:![]:!![]})[_0xd023('0x1c')](function(_0x65e1db){logger[_0xd023('0xd')](_0xd023('0x17'),_0x8c5040);logger['debug']('CreateChatMessage',_0x8c5040,JSON[_0xd023('0x11')](_0x65e1db));_0xdb5e8b(_0x65e1db);})[_0xd023('0x16')](function(_0x13e6cc){logger['error'](_0xd023('0x17'),_0x13e6cc[_0xd023('0x14')],_0x8c5040);_0x52fb6f(_0x1c28cc['error'](0x1f4,_0x13e6cc[_0xd023('0x14')]));});});}; \ No newline at end of file +var _0x4a65=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage'];(function(_0x32ad26,_0x5f35ad){var _0x1621ae=function(_0x14ec4c){while(--_0x14ec4c){_0x32ad26['push'](_0x32ad26['shift']());}};_0x1621ae(++_0x5f35ad);}(_0x4a65,0x1ef));var _0x54a6=function(_0x2c7cd9,_0x1b32ec){_0x2c7cd9=_0x2c7cd9-0x0;var _0x1c0a07=_0x4a65[_0x2c7cd9];return _0x1c0a07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x54a6('0x0'));var BPromise=require('bluebird');var rs=require(_0x54a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54a6('0x2'));var logger=require(_0x54a6('0x3'))(_0x54a6('0x4'));var config=require(_0x54a6('0x5'));var jayson=require(_0x54a6('0x6'));var client=jayson[_0x54a6('0x7')][_0x54a6('0x8')]({'port':0x232a});config[_0x54a6('0x9')]=_[_0x54a6('0xa')](config['redis'],{'host':_0x54a6('0xb'),'port':0x18eb});var socket=require(_0x54a6('0xc'))(new Redis(config[_0x54a6('0x9')]));require(_0x54a6('0xd'))[_0x54a6('0xe')](socket);function respondWithRpcPromise(_0x89953d,_0x1d460a,_0x4d5255){return new BPromise(function(_0xda0186,_0xf24df1){return client[_0x54a6('0xf')](_0x89953d,_0x4d5255)[_0x54a6('0x10')](function(_0x172c8b){logger[_0x54a6('0x11')](_0x54a6('0x12'),_0x1d460a,_0x54a6('0x13'));logger[_0x54a6('0x14')](_0x54a6('0x15'),_0x1d460a,'request\x20sent',JSON[_0x54a6('0x16')](_0x172c8b));if(_0x172c8b[_0x54a6('0x17')]){if(_0x172c8b[_0x54a6('0x17')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1d460a,_0x172c8b['error'][_0x54a6('0x18')]);return _0xf24df1(_0x172c8b['error'][_0x54a6('0x18')]);}logger['error'](_0x54a6('0x12'),_0x1d460a,_0x172c8b[_0x54a6('0x17')][_0x54a6('0x18')]);return _0xda0186(_0x172c8b['error'][_0x54a6('0x18')]);}else{logger[_0x54a6('0x11')](_0x54a6('0x12'),_0x1d460a,_0x54a6('0x13'));_0xda0186(_0x172c8b[_0x54a6('0x19')][_0x54a6('0x18')]);}})[_0x54a6('0x1a')](function(_0x3e4a26){logger[_0x54a6('0x17')](_0x54a6('0x12'),_0x1d460a,_0x3e4a26);_0xf24df1(_0x3e4a26);});});}exports['CreateChatMessage']=function(_0x22a001){var _0xea8ea4=this;return new Promise(function(_0x40a4ea,_0x3a5b7c){return db[_0x54a6('0x1b')][_0x54a6('0x1c')](_0x22a001[_0x54a6('0x1d')],{'raw':_0x22a001[_0x54a6('0x1e')]?_0x22a001['options'][_0x54a6('0x1f')]===undefined?!![]:![]:!![]})[_0x54a6('0x10')](function(_0x1d074c){logger[_0x54a6('0x11')]('CreateChatMessage',_0x22a001);logger[_0x54a6('0x14')]('CreateChatMessage',_0x22a001,JSON[_0x54a6('0x16')](_0x1d074c));_0x40a4ea(_0x1d074c);})[_0x54a6('0x1a')](function(_0x52d16f){logger[_0x54a6('0x17')](_0x54a6('0x20'),_0x52d16f['message'],_0x22a001);_0x3a5b7c(_0xea8ea4[_0x54a6('0x17')](0x1f4,_0x52d16f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f153eef..a5bff09 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 _0xe3da=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x10d193,_0x2e437b){var _0x3ed3c1=function(_0x4709ce){while(--_0x4709ce){_0x10d193['push'](_0x10d193['shift']());}};_0x3ed3c1(++_0x2e437b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var ChatMessageEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){ChatMessageEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);ChatMessageEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file +var _0x9582=['update','emit','removeListener','register','length','./chatMessage.events','save','remove'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x9582,0x95));var _0x2958=function(_0x739261,_0x165953){_0x739261=_0x739261-0x0;var _0x27613b=_0x9582[_0x739261];return _0x27613b;};'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 fde8059..8f02f3b 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 _0x17ba=['index','isAuthenticated','describe','show','post','tracked','chat','create','put','update','/:id/accept','reject','delete','/:id','exports','multer','util','path','express','Router','./chatMessage.controller','get'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x17ba,0xbf));var _0xa17b=function(_0x2a47b7,_0x47ad45){_0x2a47b7=_0x2a47b7-0x0;var _0x5d90b1=_0x17ba[_0x2a47b7];return _0x5d90b1;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require(_0xa17b('0x2'));var timeout=require('connect-timeout');var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa17b('0x5'));router[_0xa17b('0x6')]('/',auth['isAuthenticated'](),controller[_0xa17b('0x7')]);router[_0xa17b('0x6')]('/describe',auth[_0xa17b('0x8')](),controller[_0xa17b('0x9')]);router['get']('/:id',auth[_0xa17b('0x8')](),controller[_0xa17b('0xa')]);router[_0xa17b('0xb')]('/',auth[_0xa17b('0x8')](),interaction[_0xa17b('0xc')](_0xa17b('0xd'),'chatmessage:create'),controller[_0xa17b('0xe')]);router[_0xa17b('0xf')]('/:id',controller[_0xa17b('0x10')]);router[_0xa17b('0xf')](_0xa17b('0x11'),auth[_0xa17b('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0xa17b('0x8')](),controller[_0xa17b('0x12')]);router[_0xa17b('0x13')](_0xa17b('0x14'),auth[_0xa17b('0x8')](),controller['destroy']);module[_0xa17b('0x15')]=router; \ No newline at end of file +var _0x4b88=['chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','/:id','isAuthenticated','show','tracked'];(function(_0x2db1f0,_0x30ab93){var _0x5a8815=function(_0x1c653f){while(--_0x1c653f){_0x2db1f0['push'](_0x2db1f0['shift']());}};_0x5a8815(++_0x30ab93);}(_0x4b88,0xaa));var _0x84b8=function(_0x25c513,_0x5452bd){_0x25c513=_0x25c513-0x0;var _0x271bc1=_0x4b88[_0x25c513];return _0x271bc1;};'use strict';var multer=require('multer');var util=require(_0x84b8('0x0'));var path=require(_0x84b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x84b8('0x2'));var router=express['Router']();var auth=require(_0x84b8('0x3'));var interaction=require(_0x84b8('0x4'));var config=require(_0x84b8('0x5'));var controller=require(_0x84b8('0x6'));router[_0x84b8('0x7')]('/',auth['isAuthenticated'](),controller[_0x84b8('0x8')]);router['get'](_0x84b8('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x84b8('0x7')](_0x84b8('0xa'),auth[_0x84b8('0xb')](),controller[_0x84b8('0xc')]);router['post']('/',auth[_0x84b8('0xb')](),interaction[_0x84b8('0xd')](_0x84b8('0xe'),_0x84b8('0xf')),controller[_0x84b8('0x10')]);router[_0x84b8('0x11')](_0x84b8('0xa'),controller['update']);router[_0x84b8('0x11')](_0x84b8('0x12'),auth[_0x84b8('0xb')](),controller['accept']);router['put'](_0x84b8('0x13'),auth[_0x84b8('0xb')](),controller[_0x84b8('0x14')]);router[_0x84b8('0x15')](_0x84b8('0xa'),auth[_0x84b8('0xb')](),controller[_0x84b8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c39f7aa..1a9b90c 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 _0xf845=['medium','sequelize','TEXT'];(function(_0x36f7c5,_0x30b391){var _0x27aa96=function(_0x2a46ca){while(--_0x2a46ca){_0x36f7c5['push'](_0x36f7c5['shift']());}};_0x27aa96(++_0x30b391);}(_0xf845,0x199));var _0x5f84=function(_0x3da0bb,_0x43f5d7){_0x3da0bb=_0x3da0bb-0x0;var _0x503583=_0xf845[_0x3da0bb];return _0x503583;};'use strict';var Sequelize=require(_0x5f84('0x0'));module['exports']={'body':{'type':Sequelize[_0x5f84('0x1')](_0x5f84('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xe45b=['exports','TEXT','medium','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe45b,0x12f));var _0xbe45=function(_0x58c459,_0x2ee065){_0x58c459=_0x58c459-0x0;var _0x232780=_0xe45b[_0x58c459];return _0x232780;};'use strict';var Sequelize=require(_0xbe45('0x0'));module[_0xbe45('0x1')]={'body':{'type':Sequelize[_0xbe45('0x2')](_0xbe45('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cc80eab..c80c25d 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 _0xe0ae=['destroy','end','name','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then'];(function(_0xed0b99,_0x129123){var _0x5f33=function(_0x22c2c9){while(--_0x22c2c9){_0xed0b99['push'](_0xed0b99['shift']());}};_0x5f33(++_0x129123);}(_0xe0ae,0xa1));var _0xee0a=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xe0ae[_0x43aee5];return _0x76d1d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xee0a('0x0'));var zipdir=require(_0xee0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee0a('0x2'));var moment=require('moment');var BPromise=require(_0xee0a('0x3'));var Mustache=require(_0xee0a('0x4'));var util=require('util');var path=require(_0xee0a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee0a('0x6'));var fs=require('fs');var _=require(_0xee0a('0x7'));var squel=require(_0xee0a('0x8'));var crypto=require(_0xee0a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee0a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xb'));var Redis=require(_0xee0a('0xc'));var authService=require(_0xee0a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xee0a('0xe'));var hardwareService=require(_0xee0a('0xf'));var logger=require('../../config/logger')(_0xee0a('0x10'));var utils=require('../../config/utils');var config=require(_0xee0a('0x11'));var db=require(_0xee0a('0x12'))['db'];function respondWithStatusCode(_0x4e60ee,_0x1fcf59){_0x1fcf59=_0x1fcf59||0xcc;return function(_0x5c56d9){if(_0x5c56d9){return _0x4e60ee[_0xee0a('0x13')](_0x1fcf59);}return _0x4e60ee[_0xee0a('0x14')](_0x1fcf59)['end']();};}function respondWithResult(_0x4e1cd0,_0x325a8e){_0x325a8e=_0x325a8e||0xc8;return function(_0x41b70a){if(_0x41b70a){return _0x4e1cd0[_0xee0a('0x14')](_0x325a8e)[_0xee0a('0x15')](_0x41b70a);}};}function respondWithFilteredResult(_0x41d4e4,_0x57afe6){return function(_0xb891a9){if(_0xb891a9){var _0xd39431=_0xb891a9[_0xee0a('0x16')],_0x50063f=_0x57afe6[_0xee0a('0x17')],_0x2c804a=_0x57afe6['offset']+_0x57afe6[_0xee0a('0x18')],_0x35d1e4;if(_0x2c804a>=_0xd39431){_0x2c804a=_0xd39431;_0x35d1e4=0xc8;}else{_0x35d1e4=0xce;}_0x41d4e4[_0xee0a('0x14')](_0x35d1e4);return _0x41d4e4[_0xee0a('0x19')]('Content-Range',_0x50063f+'-'+_0x2c804a+'/'+_0xd39431)[_0xee0a('0x15')](_0xb891a9);}return null;};}function patchUpdates(_0x1ffdb5){return function(_0xe1f346){try{jsonpatch[_0xee0a('0x1a')](_0xe1f346,_0x1ffdb5,!![]);}catch(_0x5d29e0){return BPromise[_0xee0a('0x1b')](_0x5d29e0);}return _0xe1f346[_0xee0a('0x1c')]();};}function saveUpdates(_0x452d97,_0x201d32){return function(_0x5c981e){if(_0x5c981e){return _0x5c981e[_0xee0a('0x1d')](_0x452d97)[_0xee0a('0x1e')](function(_0x31e98a){return _0x31e98a;});}return null;};}function removeEntity(_0x21197f,_0x39fa96){return function(_0x1eb176){if(_0x1eb176){return _0x1eb176[_0xee0a('0x1f')]()['then'](function(){_0x21197f[_0xee0a('0x14')](0xcc)[_0xee0a('0x20')]();});}};}function handleEntityNotFound(_0x27989c,_0x38d029){return function(_0x567810){if(!_0x567810){_0x27989c[_0xee0a('0x13')](0x194);}return _0x567810;};}function handleError(_0x197616,_0x1fe1a3){_0x1fe1a3=_0x1fe1a3||0x1f4;return function(_0x2c414d){logger['error'](_0x2c414d['stack']);if(_0x2c414d['name']){delete _0x2c414d[_0xee0a('0x21')];}_0x197616['status'](_0x1fe1a3)['send'](_0x2c414d);};}exports[_0xee0a('0x22')]=function(_0x2c8965,_0xe5365f){var _0x50d415={},_0x3c3d48={},_0xe14449={'count':0x0,'rows':[]};var _0x15b1c0=_[_0xee0a('0x23')](db[_0xee0a('0x24')][_0xee0a('0x25')],function(_0x145332){return{'name':_0x145332[_0xee0a('0x26')],'type':_0x145332[_0xee0a('0x27')][_0xee0a('0x28')]};});_0x3c3d48['model']=_[_0xee0a('0x23')](_0x15b1c0,_0xee0a('0x21'));_0x3c3d48[_0xee0a('0x29')]=_[_0xee0a('0x2a')](_0x2c8965[_0xee0a('0x29')]);_0x3c3d48[_0xee0a('0x2b')]=_['intersection'](_0x3c3d48[_0xee0a('0x2c')],_0x3c3d48[_0xee0a('0x29')]);_0x50d415[_0xee0a('0x2d')]=_[_0xee0a('0x2e')](_0x3c3d48['model'],qs[_0xee0a('0x2f')](_0x2c8965['query'][_0xee0a('0x2f')]));_0x50d415[_0xee0a('0x2d')]=_0x50d415[_0xee0a('0x2d')][_0xee0a('0x30')]?_0x50d415[_0xee0a('0x2d')]:_0x3c3d48[_0xee0a('0x2c')];if(!_0x2c8965[_0xee0a('0x29')][_0xee0a('0x31')]('nolimit')){_0x50d415[_0xee0a('0x18')]=qs[_0xee0a('0x18')](_0x2c8965['query'][_0xee0a('0x18')]);_0x50d415[_0xee0a('0x17')]=qs[_0xee0a('0x17')](_0x2c8965['query'][_0xee0a('0x17')]);}_0x50d415[_0xee0a('0x32')]=qs[_0xee0a('0x33')](_0x2c8965['query'][_0xee0a('0x33')]);_0x50d415[_0xee0a('0x34')]=qs[_0xee0a('0x2b')](_['pick'](_0x2c8965['query'],_0x3c3d48[_0xee0a('0x2b')]),_0x15b1c0);if(_0x2c8965[_0xee0a('0x29')][_0xee0a('0x35')]){_0x50d415[_0xee0a('0x34')]=_[_0xee0a('0x36')](_0x50d415[_0xee0a('0x34')],{'$or':_[_0xee0a('0x23')](_0x15b1c0,function(_0x616351){if(_0x616351[_0xee0a('0x27')]!=='VIRTUAL'){var _0x15a3e7={};_0x15a3e7[_0x616351[_0xee0a('0x21')]]={'$like':'%'+_0x2c8965['query'][_0xee0a('0x35')]+'%'};return _0x15a3e7;}})});}_0x50d415=_[_0xee0a('0x36')]({},_0x50d415,_0x2c8965['options']);var _0x2fdf87={'where':_0x50d415[_0xee0a('0x34')]};return db[_0xee0a('0x24')][_0xee0a('0x16')](_0x2fdf87)[_0xee0a('0x1e')](function(_0x84e79f){_0xe14449[_0xee0a('0x16')]=_0x84e79f;if(_0x2c8965[_0xee0a('0x29')][_0xee0a('0x37')]){_0x50d415['include']=[{'all':!![]}];}return db[_0xee0a('0x24')][_0xee0a('0x38')](_0x50d415);})[_0xee0a('0x1e')](function(_0xf3efee){_0xe14449['rows']=_0xf3efee;return _0xe14449;})['then'](respondWithFilteredResult(_0xe5365f,_0x50d415))[_0xee0a('0x39')](handleError(_0xe5365f,null));};exports[_0xee0a('0x3a')]=function(_0x581c64,_0xd1c900){var _0x1b69b9={'raw':!![],'where':{'id':_0x581c64[_0xee0a('0x3b')]['id']}},_0x28bee3={};_0x28bee3['model']=_['keys'](db[_0xee0a('0x24')][_0xee0a('0x25')]);_0x28bee3['query']=_[_0xee0a('0x2a')](_0x581c64[_0xee0a('0x29')]);_0x28bee3['filters']=_[_0xee0a('0x2e')](_0x28bee3[_0xee0a('0x2c')],_0x28bee3[_0xee0a('0x29')]);_0x1b69b9[_0xee0a('0x2d')]=_[_0xee0a('0x2e')](_0x28bee3[_0xee0a('0x2c')],qs[_0xee0a('0x2f')](_0x581c64['query']['fields']));_0x1b69b9[_0xee0a('0x2d')]=_0x1b69b9['attributes']['length']?_0x1b69b9['attributes']:_0x28bee3[_0xee0a('0x2c')];if(_0x581c64[_0xee0a('0x29')]['includeAll']){_0x1b69b9['include']=[{'all':!![]}];}_0x1b69b9=_['merge']({},_0x1b69b9,_0x581c64['options']);return db[_0xee0a('0x24')][_0xee0a('0x3c')](_0x1b69b9)[_0xee0a('0x1e')](handleEntityNotFound(_0xd1c900,null))[_0xee0a('0x1e')](respondWithResult(_0xd1c900,null))[_0xee0a('0x39')](handleError(_0xd1c900,null));};exports[_0xee0a('0x3d')]=function(_0x57dd36,_0x1a72a2){return db['ChatOfflineMessage'][_0xee0a('0x3d')](_0x57dd36[_0xee0a('0x3e')],{})[_0xee0a('0x1e')](respondWithResult(_0x1a72a2,0xc9))[_0xee0a('0x39')](handleError(_0x1a72a2,null));};exports['update']=function(_0x3ef07b,_0x219dd3){if(_0x3ef07b[_0xee0a('0x3e')]['id']){delete _0x3ef07b[_0xee0a('0x3e')]['id'];}return db[_0xee0a('0x24')][_0xee0a('0x3c')]({'where':{'id':_0x3ef07b[_0xee0a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x219dd3,null))['then'](saveUpdates(_0x3ef07b[_0xee0a('0x3e')],null))[_0xee0a('0x1e')](respondWithResult(_0x219dd3,null))[_0xee0a('0x39')](handleError(_0x219dd3,null));};exports[_0xee0a('0x1f')]=function(_0x495b60,_0x42bbd5){return db[_0xee0a('0x24')][_0xee0a('0x3c')]({'where':{'id':_0x495b60[_0xee0a('0x3b')]['id']}})[_0xee0a('0x1e')](handleEntityNotFound(_0x42bbd5,null))[_0xee0a('0x1e')](removeEntity(_0x42bbd5,null))[_0xee0a('0x39')](handleError(_0x42bbd5,null));};exports['describe']=function(_0x11e895,_0x33fee4){return db[_0xee0a('0x24')][_0xee0a('0x3f')]()[_0xee0a('0x1e')](respondWithResult(_0x33fee4,null))['catch'](handleError(_0x33fee4,null));}; \ No newline at end of file +var _0xe2fe=['keys','fields','find','create','update','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','key','model','query','filters','intersection','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25ddf7,_0x346dbc){_0x346dbc=_0x346dbc||0xcc;return function(_0xa13e7b){if(_0xa13e7b){return _0x25ddf7[_0xee2f('0x10')](_0x346dbc);}return _0x25ddf7[_0xee2f('0x11')](_0x346dbc)[_0xee2f('0x12')]();};}function respondWithResult(_0x4faa8f,_0x3861e6){_0x3861e6=_0x3861e6||0xc8;return function(_0x531c3a){if(_0x531c3a){return _0x4faa8f[_0xee2f('0x11')](_0x3861e6)[_0xee2f('0x13')](_0x531c3a);}};}function respondWithFilteredResult(_0x48b30c,_0x445ba8){return function(_0x145241){if(_0x145241){var _0x28b614=_0x145241[_0xee2f('0x14')],_0x1bbf7d=_0x445ba8['offset'],_0x390c2c=_0x445ba8[_0xee2f('0x15')]+_0x445ba8[_0xee2f('0x16')],_0x58f42a;if(_0x390c2c>=_0x28b614){_0x390c2c=_0x28b614;_0x58f42a=0xc8;}else{_0x58f42a=0xce;}_0x48b30c['status'](_0x58f42a);return _0x48b30c['set'](_0xee2f('0x17'),_0x1bbf7d+'-'+_0x390c2c+'/'+_0x28b614)['json'](_0x145241);}return null;};}function patchUpdates(_0x69db88){return function(_0x3e0b31){try{jsonpatch[_0xee2f('0x18')](_0x3e0b31,_0x69db88,!![]);}catch(_0x5b83b5){return BPromise[_0xee2f('0x19')](_0x5b83b5);}return _0x3e0b31[_0xee2f('0x1a')]();};}function saveUpdates(_0x4db2cc,_0x21fdf4){return function(_0x3d892d){if(_0x3d892d){return _0x3d892d['update'](_0x4db2cc)['then'](function(_0x40d1fd){return _0x40d1fd;});}return null;};}function removeEntity(_0x3a1852,_0x1ea808){return function(_0x203b2f){if(_0x203b2f){return _0x203b2f[_0xee2f('0x1b')]()[_0xee2f('0x1c')](function(){_0x3a1852[_0xee2f('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250399,_0x2c47c5){return function(_0x15ceda){if(!_0x15ceda){_0x250399[_0xee2f('0x10')](0x194);}return _0x15ceda;};}function handleError(_0x820101,_0xf77cf5){_0xf77cf5=_0xf77cf5||0x1f4;return function(_0x15a1b1){logger[_0xee2f('0x1d')](_0x15a1b1[_0xee2f('0x1e')]);if(_0x15a1b1[_0xee2f('0x1f')]){delete _0x15a1b1[_0xee2f('0x1f')];}_0x820101[_0xee2f('0x11')](_0xf77cf5)[_0xee2f('0x20')](_0x15a1b1);};}exports[_0xee2f('0x21')]=function(_0x53f6ed,_0x4ef690){var _0x58ba65={},_0x18bdbb={},_0x18ff19={'count':0x0,'rows':[]};var _0x2cb0cb=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x4d8398){return{'name':_0x4d8398[_0xee2f('0x25')],'type':_0x4d8398['type'][_0xee2f('0x26')]};});_0x18bdbb[_0xee2f('0x27')]=_[_0xee2f('0x22')](_0x2cb0cb,_0xee2f('0x1f'));_0x18bdbb[_0xee2f('0x28')]=_['keys'](_0x53f6ed[_0xee2f('0x28')]);_0x18bdbb[_0xee2f('0x29')]=_['intersection'](_0x18bdbb['model'],_0x18bdbb[_0xee2f('0x28')]);_0x58ba65['attributes']=_[_0xee2f('0x2a')](_0x18bdbb[_0xee2f('0x27')],qs['fields'](_0x53f6ed[_0xee2f('0x28')]['fields']));_0x58ba65['attributes']=_0x58ba65['attributes'][_0xee2f('0x2b')]?_0x58ba65[_0xee2f('0x2c')]:_0x18bdbb['model'];if(!_0x53f6ed[_0xee2f('0x28')][_0xee2f('0x2d')](_0xee2f('0x2e'))){_0x58ba65[_0xee2f('0x16')]=qs[_0xee2f('0x16')](_0x53f6ed['query'][_0xee2f('0x16')]);_0x58ba65['offset']=qs[_0xee2f('0x15')](_0x53f6ed[_0xee2f('0x28')][_0xee2f('0x15')]);}_0x58ba65['order']=qs[_0xee2f('0x2f')](_0x53f6ed['query'][_0xee2f('0x2f')]);_0x58ba65['where']=qs[_0xee2f('0x29')](_[_0xee2f('0x30')](_0x53f6ed[_0xee2f('0x28')],_0x18bdbb[_0xee2f('0x29')]),_0x2cb0cb);if(_0x53f6ed[_0xee2f('0x28')][_0xee2f('0x31')]){_0x58ba65[_0xee2f('0x32')]=_[_0xee2f('0x33')](_0x58ba65[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x2cb0cb,function(_0x433547){if(_0x433547['type']!==_0xee2f('0x34')){var _0x47e54b={};_0x47e54b[_0x433547[_0xee2f('0x1f')]]={'$like':'%'+_0x53f6ed[_0xee2f('0x28')][_0xee2f('0x31')]+'%'};return _0x47e54b;}})});}_0x58ba65=_[_0xee2f('0x33')]({},_0x58ba65,_0x53f6ed[_0xee2f('0x35')]);var _0x436f8f={'where':_0x58ba65[_0xee2f('0x32')]};return db[_0xee2f('0x23')]['count'](_0x436f8f)['then'](function(_0x5dbbf7){_0x18ff19[_0xee2f('0x14')]=_0x5dbbf7;if(_0x53f6ed['query'][_0xee2f('0x36')]){_0x58ba65['include']=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x58ba65);})['then'](function(_0x430ac1){_0x18ff19[_0xee2f('0x37')]=_0x430ac1;return _0x18ff19;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x4ef690,_0x58ba65))[_0xee2f('0x38')](handleError(_0x4ef690,null));};exports['show']=function(_0x5986f4,_0x3f2194){var _0x5e12b7={'raw':!![],'where':{'id':_0x5986f4[_0xee2f('0x39')]['id']}},_0x5a7825={};_0x5a7825[_0xee2f('0x27')]=_[_0xee2f('0x3a')](db['ChatOfflineMessage'][_0xee2f('0x24')]);_0x5a7825[_0xee2f('0x28')]=_[_0xee2f('0x3a')](_0x5986f4['query']);_0x5a7825['filters']=_[_0xee2f('0x2a')](_0x5a7825[_0xee2f('0x27')],_0x5a7825[_0xee2f('0x28')]);_0x5e12b7[_0xee2f('0x2c')]=_['intersection'](_0x5a7825[_0xee2f('0x27')],qs[_0xee2f('0x3b')](_0x5986f4[_0xee2f('0x28')][_0xee2f('0x3b')]));_0x5e12b7[_0xee2f('0x2c')]=_0x5e12b7[_0xee2f('0x2c')][_0xee2f('0x2b')]?_0x5e12b7[_0xee2f('0x2c')]:_0x5a7825[_0xee2f('0x27')];if(_0x5986f4[_0xee2f('0x28')]['includeAll']){_0x5e12b7['include']=[{'all':!![]}];}_0x5e12b7=_['merge']({},_0x5e12b7,_0x5986f4['options']);return db[_0xee2f('0x23')][_0xee2f('0x3c')](_0x5e12b7)[_0xee2f('0x1c')](handleEntityNotFound(_0x3f2194,null))[_0xee2f('0x1c')](respondWithResult(_0x3f2194,null))[_0xee2f('0x38')](handleError(_0x3f2194,null));};exports['create']=function(_0xd191ef,_0x36c5cc){return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0xd191ef['body'],{})['then'](respondWithResult(_0x36c5cc,0xc9))['catch'](handleError(_0x36c5cc,null));};exports[_0xee2f('0x3e')]=function(_0x54cc44,_0x4bb7c8){if(_0x54cc44['body']['id']){delete _0x54cc44['body']['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3c')]({'where':{'id':_0x54cc44[_0xee2f('0x39')]['id']}})['then'](handleEntityNotFound(_0x4bb7c8,null))[_0xee2f('0x1c')](saveUpdates(_0x54cc44['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x4bb7c8,null))[_0xee2f('0x38')](handleError(_0x4bb7c8,null));};exports[_0xee2f('0x1b')]=function(_0x2e804a,_0x3d86b4){return db['ChatOfflineMessage']['find']({'where':{'id':_0x2e804a[_0xee2f('0x39')]['id']}})['then'](handleEntityNotFound(_0x3d86b4,null))[_0xee2f('0x1c')](removeEntity(_0x3d86b4,null))[_0xee2f('0x38')](handleError(_0x3d86b4,null));};exports[_0xee2f('0x3f')]=function(_0x88e683,_0x4fb3a0){return db['ChatOfflineMessage'][_0xee2f('0x3f')]()[_0xee2f('0x1c')](respondWithResult(_0x4fb3a0,null))[_0xee2f('0x38')](handleError(_0x4fb3a0,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 61bb4e8..f93919c 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 _0x4e70=['exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x4e70,0x149));var _0x04e7=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x4e70[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x04e7('0x0'));var util=require(_0x04e7('0x1'));var logger=require(_0x04e7('0x2'))('api');var moment=require(_0x04e7('0x3'));var BPromise=require(_0x04e7('0x4'));var rp=require(_0x04e7('0x5'));var fs=require('fs');var path=require(_0x04e7('0x6'));var rimraf=require('rimraf');var config=require(_0x04e7('0x7'));var attributes=require(_0x04e7('0x8'));module[_0x04e7('0x9')]=function(_0x1dd16a,_0x2ff420){return _0x1dd16a['define']('ChatOfflineMessage',attributes,{'tableName':_0x04e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x04e7('0xb'),'collate':_0x04e7('0xc')});}; \ No newline at end of file +var _0xf34d=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x30b401,_0x5c3c1b){var _0x4220e5=function(_0x13a529){while(--_0x13a529){_0x30b401['push'](_0x30b401['shift']());}};_0x4220e5(++_0x5c3c1b);}(_0xf34d,0x1a8));var _0xdf34=function(_0x4b0c65,_0x181b55){_0x4b0c65=_0x4b0c65-0x0;var _0x415deb=_0xf34d[_0x4b0c65];return _0x415deb;};'use strict';var _=require(_0xdf34('0x0'));var util=require(_0xdf34('0x1'));var logger=require(_0xdf34('0x2'))(_0xdf34('0x3'));var moment=require(_0xdf34('0x4'));var BPromise=require(_0xdf34('0x5'));var rp=require(_0xdf34('0x6'));var fs=require('fs');var path=require(_0xdf34('0x7'));var rimraf=require(_0xdf34('0x8'));var config=require(_0xdf34('0x9'));var attributes=require(_0xdf34('0xa'));module['exports']=function(_0x433ac7,_0x61a9e5){return _0x433ac7[_0xdf34('0xb')](_0xdf34('0xc'),attributes,{'tableName':_0xdf34('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf34('0xe'),'collate':_0xdf34('0xf')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0fbea0f..8709203 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 _0x2f3a=['message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x2f3a,0x117));var _0xa2f3=function(_0x633f99,_0x1c6c03){_0x633f99=_0x633f99-0x0;var _0x2098de=_0x2f3a[_0x633f99];return _0x2098de;};'use strict';var _=require('lodash');var util=require(_0xa2f3('0x0'));var moment=require(_0xa2f3('0x1'));var BPromise=require(_0xa2f3('0x2'));var rs=require(_0xa2f3('0x3'));var fs=require('fs');var Redis=require(_0xa2f3('0x4'));var db=require(_0xa2f3('0x5'))['db'];var utils=require(_0xa2f3('0x6'));var logger=require(_0xa2f3('0x7'))(_0xa2f3('0x8'));var config=require(_0xa2f3('0x9'));var jayson=require(_0xa2f3('0xa'));var client=jayson[_0xa2f3('0xb')][_0xa2f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xefaa00,_0xb7ef3a,_0x5c61f6){return new BPromise(function(_0x516e16,_0x3967c4){return client[_0xa2f3('0xd')](_0xefaa00,_0x5c61f6)[_0xa2f3('0xe')](function(_0x1a95a2){logger['info'](_0xa2f3('0xf'),_0xb7ef3a,_0xa2f3('0x10'));logger[_0xa2f3('0x11')](_0xa2f3('0x12'),_0xb7ef3a,_0xa2f3('0x10'),JSON['stringify'](_0x1a95a2));if(_0x1a95a2[_0xa2f3('0x13')]){if(_0x1a95a2[_0xa2f3('0x13')]['code']===0x1f4){logger['error'](_0xa2f3('0xf'),_0xb7ef3a,_0x1a95a2[_0xa2f3('0x13')][_0xa2f3('0x14')]);return _0x3967c4(_0x1a95a2[_0xa2f3('0x13')]['message']);}logger[_0xa2f3('0x13')](_0xa2f3('0xf'),_0xb7ef3a,_0x1a95a2[_0xa2f3('0x13')][_0xa2f3('0x14')]);return _0x516e16(_0x1a95a2[_0xa2f3('0x13')]['message']);}else{logger[_0xa2f3('0x15')](_0xa2f3('0xf'),_0xb7ef3a,_0xa2f3('0x10'));_0x516e16(_0x1a95a2[_0xa2f3('0x16')][_0xa2f3('0x14')]);}})['catch'](function(_0x5b073a){logger['error'](_0xa2f3('0xf'),_0xb7ef3a,_0x5b073a);_0x3967c4(_0x5b073a);});});} \ No newline at end of file +var _0x7f4f=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x6f1501,_0x205f5d){var _0x2eecdb=function(_0x1d8cda){while(--_0x1d8cda){_0x6f1501['push'](_0x6f1501['shift']());}};_0x2eecdb(++_0x205f5d);}(_0x7f4f,0x1cc));var _0xf7f4=function(_0xbfa674,_0x3fa895){_0xbfa674=_0xbfa674-0x0;var _0x58bac9=_0x7f4f[_0xbfa674];return _0x58bac9;};'use strict';var _=require(_0xf7f4('0x0'));var util=require('util');var moment=require(_0xf7f4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7f4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7f4('0x3'))(_0xf7f4('0x4'));var config=require(_0xf7f4('0x5'));var jayson=require(_0xf7f4('0x6'));var client=jayson[_0xf7f4('0x7')][_0xf7f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ef5f6,_0x322ec7,_0x3719ec){return new BPromise(function(_0x14ba84,_0x5ae1d1){return client[_0xf7f4('0x9')](_0x5ef5f6,_0x3719ec)[_0xf7f4('0xa')](function(_0x468821){logger['info'](_0xf7f4('0xb'),_0x322ec7,'request\x20sent');logger[_0xf7f4('0xc')](_0xf7f4('0xd'),_0x322ec7,_0xf7f4('0xe'),JSON[_0xf7f4('0xf')](_0x468821));if(_0x468821['error']){if(_0x468821[_0xf7f4('0x10')][_0xf7f4('0x11')]===0x1f4){logger[_0xf7f4('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x322ec7,_0x468821[_0xf7f4('0x10')][_0xf7f4('0x12')]);return _0x5ae1d1(_0x468821[_0xf7f4('0x10')][_0xf7f4('0x12')]);}logger[_0xf7f4('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x322ec7,_0x468821[_0xf7f4('0x10')][_0xf7f4('0x12')]);return _0x14ba84(_0x468821['error'][_0xf7f4('0x12')]);}else{logger[_0xf7f4('0x13')](_0xf7f4('0xb'),_0x322ec7,_0xf7f4('0xe'));_0x14ba84(_0x468821[_0xf7f4('0x14')][_0xf7f4('0x12')]);}})[_0xf7f4('0x15')](function(_0x265fad){logger[_0xf7f4('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x322ec7,_0x265fad);_0x5ae1d1(_0x265fad);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8fb4135..4a53188 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 _0x8aba=['update','delete','destroy','exports','multer','path','Router','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x2c77da,_0x36daa2){var _0x2189d1=function(_0x185c82){while(--_0x185c82){_0x2c77da['push'](_0x2c77da['shift']());}};_0x2189d1(++_0x36daa2);}(_0x8aba,0xe1));var _0xa8ab=function(_0x3beaa0,_0x280279){_0x3beaa0=_0x3beaa0-0x0;var _0x5350e8=_0x8aba[_0x3beaa0];return _0x5350e8;};'use strict';var multer=require(_0xa8ab('0x0'));var util=require('util');var path=require(_0xa8ab('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa8ab('0x2')]();var auth=require(_0xa8ab('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8ab('0x4'));router[_0xa8ab('0x5')]('/',auth[_0xa8ab('0x6')](),controller[_0xa8ab('0x7')]);router['get'](_0xa8ab('0x8'),auth[_0xa8ab('0x6')](),controller['describe']);router[_0xa8ab('0x5')](_0xa8ab('0x9'),auth[_0xa8ab('0x6')](),controller[_0xa8ab('0xa')]);router[_0xa8ab('0xb')]('/',auth[_0xa8ab('0x6')](),controller[_0xa8ab('0xc')]);router['put'](_0xa8ab('0x9'),auth[_0xa8ab('0x6')](),controller[_0xa8ab('0xd')]);router[_0xa8ab('0xe')]('/:id',auth[_0xa8ab('0x6')](),controller[_0xa8ab('0xf')]);module[_0xa8ab('0x10')]=router; \ No newline at end of file +var _0x9b7e=['describe','show','/:id','update','exports','multer','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x5b0413,_0x3f4093){var _0x2b9b26=function(_0x58669e){while(--_0x58669e){_0x5b0413['push'](_0x5b0413['shift']());}};_0x2b9b26(++_0x3f4093);}(_0x9b7e,0x7a));var _0xe9b7=function(_0x2872b0,_0x4b0855){_0x2872b0=_0x2872b0-0x0;var _0x58b379=_0x9b7e[_0x2872b0];return _0x58b379;};'use strict';var multer=require(_0xe9b7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe9b7('0x1'));var router=express['Router']();var auth=require(_0xe9b7('0x2'));var interaction=require(_0xe9b7('0x3'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xe9b7('0x4')]('/',auth[_0xe9b7('0x5')](),controller[_0xe9b7('0x6')]);router[_0xe9b7('0x4')](_0xe9b7('0x7'),auth['isAuthenticated'](),controller[_0xe9b7('0x8')]);router['get']('/:id',auth[_0xe9b7('0x5')](),controller[_0xe9b7('0x9')]);router['post']('/',auth[_0xe9b7('0x5')](),controller['create']);router['put'](_0xe9b7('0xa'),auth['isAuthenticated'](),controller[_0xe9b7('0xb')]);router['delete'](_0xe9b7('0xa'),auth[_0xe9b7('0x5')](),controller['destroy']);module[_0xe9b7('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 8151322..284c9f2 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 _0xa4dd=['INTEGER','sequelize','exports','ENUM'];(function(_0x32144d,_0x3bf972){var _0x47a0bf=function(_0x186ca9){while(--_0x186ca9){_0x32144d['push'](_0x32144d['shift']());}};_0x47a0bf(++_0x3bf972);}(_0xa4dd,0x181));var _0xda4d=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0xa4dd[_0x3d73ba];return _0x47e406;};'use strict';var Sequelize=require(_0xda4d('0x0'));module[_0xda4d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xda4d('0x2')]('mouseOver','timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xda4d('0x3')]}}; \ No newline at end of file +var _0x6f21=['mouseOver','sequelize','exports','STRING','ENUM'];(function(_0x40c309,_0x172e10){var _0xdcaa9d=function(_0xfd5626){while(--_0xfd5626){_0x40c309['push'](_0x40c309['shift']());}};_0xdcaa9d(++_0x172e10);}(_0x6f21,0xf6));var _0x16f2=function(_0x5436ce,_0x3bf06a){_0x5436ce=_0x5436ce-0x0;var _0x7308f8=_0x6f21[_0x5436ce];return _0x7308f8;};'use strict';var Sequelize=require(_0x16f2('0x0'));module[_0x16f2('0x1')]={'name':{'type':Sequelize[_0x16f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x16f2('0x3')](_0x16f2('0x4'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x16f2('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d993eb5..992a018 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 _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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xcb91[_0x3132e8];return _0x43eb8c;};'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 +var _0xd8b0=['eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','filters','model','attributes','intersection','length','query','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf'];(function(_0x31bd36,_0x14d2fb){var _0x65b855=function(_0x603a40){while(--_0x603a40){_0x31bd36['push'](_0x31bd36['shift']());}};_0x65b855(++_0x14d2fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={'raw':!![],'where':{'id':_0xa2af02[_0x0d8b('0x28')]['id']}},_0x28f639={};_0x28f639['model']=_[_0x0d8b('0x29')](db['ChatProactiveAction'][_0x0d8b('0x2a')]);_0x28f639['query']=_[_0x0d8b('0x29')](_0xa2af02['query']);_0x28f639[_0x0d8b('0x2b')]=_['intersection'](_0x28f639[_0x0d8b('0x2c')],_0x28f639['query']);_0x59a905[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x28f639[_0x0d8b('0x2c')],qs['fields'](_0xa2af02['query']['fields']));_0x59a905[_0x0d8b('0x2d')]=_0x59a905['attributes'][_0x0d8b('0x2f')]?_0x59a905['attributes']:_0x28f639['model'];if(_0xa2af02[_0x0d8b('0x30')][_0x0d8b('0x31')]){_0x59a905[_0x0d8b('0x32')]=[{'all':!![]}];}_0x59a905=_[_0x0d8b('0x33')]({},_0x59a905,_0xa2af02[_0x0d8b('0x34')]);return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x59a905)[_0x0d8b('0x22')](handleEntityNotFound(_0x4fe6f9,null))['then'](respondWithResult(_0x4fe6f9,null))[_0x0d8b('0x37')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x38')]=function(_0x4b3ea0,_0xb18586){return db[_0x0d8b('0x35')][_0x0d8b('0x38')](_0x4b3ea0['body'],{})[_0x0d8b('0x22')](respondWithResult(_0xb18586,0xc9))[_0x0d8b('0x37')](handleError(_0xb18586,null));};exports[_0x0d8b('0x21')]=function(_0x31ceba,_0x933e01){if(_0x31ceba['body']['id']){delete _0x31ceba[_0x0d8b('0x39')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x31ceba[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x933e01,null))[_0x0d8b('0x22')](saveUpdates(_0x31ceba[_0x0d8b('0x39')],null))[_0x0d8b('0x22')](respondWithResult(_0x933e01,null))['catch'](handleError(_0x933e01,null));};exports['destroy']=function(_0x41b4f9,_0x5c2c04){return db['ChatProactiveAction'][_0x0d8b('0x36')]({'where':{'id':_0x41b4f9[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x5c2c04,null))[_0x0d8b('0x22')](removeEntity(_0x5c2c04,null))[_0x0d8b('0x37')](handleError(_0x5c2c04,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 62dc28c..358ce18 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 _0xbefb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xbefb,0xda));var _0xbbef=function(_0x35e502,_0x4cf622){_0x35e502=_0x35e502-0x0;var _0x3c1718=_0xbefb[_0x35e502];return _0x3c1718;};'use strict';var _=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var logger=require(_0xbbef('0x2'))(_0xbbef('0x3'));var moment=require(_0xbbef('0x4'));var BPromise=require(_0xbbef('0x5'));var rp=require(_0xbbef('0x6'));var fs=require('fs');var path=require(_0xbbef('0x7'));var rimraf=require(_0xbbef('0x8'));var config=require(_0xbbef('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0xbbef('0xa')]=function(_0x4b21bf,_0x314b8d){return _0x4b21bf[_0xbbef('0xb')]('ChatProactiveAction',attributes,{'tableName':_0xbbef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67a3=['define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67a3,0xfe));var _0x367a=function(_0x44fb1e,_0x24780d){_0x44fb1e=_0x44fb1e-0x0;var _0x443dab=_0x67a3[_0x44fb1e];return _0x443dab;};'use strict';var _=require(_0x367a('0x0'));var util=require(_0x367a('0x1'));var logger=require(_0x367a('0x2'))(_0x367a('0x3'));var moment=require(_0x367a('0x4'));var BPromise=require(_0x367a('0x5'));var rp=require(_0x367a('0x6'));var fs=require('fs');var path=require(_0x367a('0x7'));var rimraf=require(_0x367a('0x8'));var config=require(_0x367a('0x9'));var attributes=require(_0x367a('0xa'));module[_0x367a('0xb')]=function(_0x10dfa2,_0x5483a2){return _0x10dfa2[_0x367a('0xc')](_0x367a('0xd'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c516d16..ae13751 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 _0x2ac9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d774f,_0x4ac71c){var _0x1fbb61=function(_0x4daa2f){while(--_0x4daa2f){_0x1d774f['push'](_0x1d774f['shift']());}};_0x1fbb61(++_0x4ac71c);}(_0x2ac9,0x6f));var _0x92ac=function(_0x2dec09,_0x569401){_0x2dec09=_0x2dec09-0x0;var _0x407a10=_0x2ac9[_0x2dec09];return _0x407a10;};'use strict';var _=require(_0x92ac('0x0'));var util=require(_0x92ac('0x1'));var moment=require(_0x92ac('0x2'));var BPromise=require(_0x92ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92ac('0x4'))['db'];var utils=require(_0x92ac('0x5'));var logger=require(_0x92ac('0x6'))(_0x92ac('0x7'));var config=require(_0x92ac('0x8'));var jayson=require(_0x92ac('0x9'));var client=jayson[_0x92ac('0xa')][_0x92ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b59f4,_0x582447,_0xd88063){return new BPromise(function(_0x443077,_0x3e3eef){return client['request'](_0x5b59f4,_0xd88063)[_0x92ac('0xc')](function(_0x3daebf){logger[_0x92ac('0xd')](_0x92ac('0xe'),_0x582447,'request\x20sent');logger[_0x92ac('0xf')](_0x92ac('0x10'),_0x582447,_0x92ac('0x11'),JSON['stringify'](_0x3daebf));if(_0x3daebf[_0x92ac('0x12')]){if(_0x3daebf[_0x92ac('0x12')][_0x92ac('0x13')]===0x1f4){logger[_0x92ac('0x12')](_0x92ac('0xe'),_0x582447,_0x3daebf[_0x92ac('0x12')][_0x92ac('0x14')]);return _0x3e3eef(_0x3daebf[_0x92ac('0x12')]['message']);}logger[_0x92ac('0x12')](_0x92ac('0xe'),_0x582447,_0x3daebf[_0x92ac('0x12')][_0x92ac('0x14')]);return _0x443077(_0x3daebf[_0x92ac('0x12')][_0x92ac('0x14')]);}else{logger[_0x92ac('0xd')](_0x92ac('0xe'),_0x582447,'request\x20sent');_0x443077(_0x3daebf[_0x92ac('0x15')]['message']);}})[_0x92ac('0x16')](function(_0x390ccc){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x582447,_0x390ccc);_0x3e3eef(_0x390ccc);});});} \ No newline at end of file +var _0x9da0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x51cc51,_0x163fa1){var _0x3a54e0=function(_0x18b731){while(--_0x18b731){_0x51cc51['push'](_0x51cc51['shift']());}};_0x3a54e0(++_0x163fa1);}(_0x9da0,0x176));var _0x09da=function(_0x6b2591,_0x2be87b){_0x6b2591=_0x6b2591-0x0;var _0x3a74bb=_0x9da0[_0x6b2591];return _0x3a74bb;};'use strict';var _=require('lodash');var util=require(_0x09da('0x0'));var moment=require(_0x09da('0x1'));var BPromise=require(_0x09da('0x2'));var rs=require(_0x09da('0x3'));var fs=require('fs');var Redis=require(_0x09da('0x4'));var db=require(_0x09da('0x5'))['db'];var utils=require(_0x09da('0x6'));var logger=require(_0x09da('0x7'))(_0x09da('0x8'));var config=require(_0x09da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x09da('0xa')][_0x09da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ae3c5,_0x33532d,_0x398869){return new BPromise(function(_0x138c66,_0x7697ca){return client[_0x09da('0xc')](_0x2ae3c5,_0x398869)[_0x09da('0xd')](function(_0x27394c){logger[_0x09da('0xe')](_0x09da('0xf'),_0x33532d,_0x09da('0x10'));logger[_0x09da('0x11')](_0x09da('0x12'),_0x33532d,'request\x20sent',JSON[_0x09da('0x13')](_0x27394c));if(_0x27394c[_0x09da('0x14')]){if(_0x27394c['error'][_0x09da('0x15')]===0x1f4){logger['error'](_0x09da('0xf'),_0x33532d,_0x27394c[_0x09da('0x14')]['message']);return _0x7697ca(_0x27394c[_0x09da('0x14')][_0x09da('0x16')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x33532d,_0x27394c[_0x09da('0x14')][_0x09da('0x16')]);return _0x138c66(_0x27394c['error']['message']);}else{logger[_0x09da('0xe')](_0x09da('0xf'),_0x33532d,_0x09da('0x10'));_0x138c66(_0x27394c[_0x09da('0x17')][_0x09da('0x16')]);}})[_0x09da('0x18')](function(_0xbf7dc8){logger[_0x09da('0x14')](_0x09da('0xf'),_0x33532d,_0xbf7dc8);_0x7697ca(_0xbf7dc8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 68af801..9b51eaa 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 _0xd5d2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xd5d2,0x154));var _0x2d5d=function(_0x22730b,_0x3aafcd){_0x22730b=_0x22730b-0x0;var _0x20af64=_0xd5d2[_0x22730b];return _0x20af64;};'use strict';var multer=require('multer');var util=require(_0x2d5d('0x0'));var path=require(_0x2d5d('0x1'));var timeout=require(_0x2d5d('0x2'));var express=require(_0x2d5d('0x3'));var router=express[_0x2d5d('0x4')]();var auth=require(_0x2d5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d5d('0x6'));var controller=require(_0x2d5d('0x7'));router[_0x2d5d('0x8')](_0x2d5d('0x9'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xb')]);router[_0x2d5d('0xc')]('/',auth[_0x2d5d('0xa')](),controller['create']);router[_0x2d5d('0xd')](_0x2d5d('0x9'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xe')]);router[_0x2d5d('0xf')](_0x2d5d('0x9'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe1c9=['update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','create','put','/:id'];(function(_0x3458a1,_0x14ebe6){var _0x372780=function(_0x3ee949){while(--_0x3ee949){_0x3458a1['push'](_0x3458a1['shift']());}};_0x372780(++_0x14ebe6);}(_0xe1c9,0x1df));var _0x9e1c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xe1c9[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e1c('0x0'));var timeout=require(_0x9e1c('0x1'));var express=require(_0x9e1c('0x2'));var router=express[_0x9e1c('0x3')]();var auth=require(_0x9e1c('0x4'));var interaction=require(_0x9e1c('0x5'));var config=require(_0x9e1c('0x6'));var controller=require(_0x9e1c('0x7'));router[_0x9e1c('0x8')]('/:id',auth[_0x9e1c('0x9')](),controller[_0x9e1c('0xa')]);router['post']('/',auth[_0x9e1c('0x9')](),controller[_0x9e1c('0xb')]);router[_0x9e1c('0xc')](_0x9e1c('0xd'),auth[_0x9e1c('0x9')](),controller[_0x9e1c('0xe')]);router[_0x9e1c('0xf')](_0x9e1c('0xd'),auth[_0x9e1c('0x9')](),controller['destroy']);module[_0x9e1c('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 9424dda..c64dd1d 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 _0x5026=['STRING','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x58cd58,_0x13964d){var _0x5637fc=function(_0x48cfda){while(--_0x48cfda){_0x58cd58['push'](_0x58cd58['shift']());}};_0x5637fc(++_0x13964d);}(_0x5026,0xed));var _0x6502=function(_0x30895b,_0xb9755a){_0x30895b=_0x30895b-0x0;var _0x1febf0=_0x5026[_0x30895b];return _0x1febf0;};'use strict';var Sequelize=require(_0x6502('0x0'));module[_0x6502('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6502('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6502('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6502('0x4'),'beepall',_0x6502('0x5'))}}; \ No newline at end of file +var _0x81c7=['sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x54ed23,_0x137310){var _0x51df35=function(_0x16cc4e){while(--_0x16cc4e){_0x54ed23['push'](_0x54ed23['shift']());}};_0x51df35(++_0x137310);}(_0x81c7,0x12c));var _0x781c=function(_0x527290,_0x5901ec){_0x527290=_0x527290-0x0;var _0x3493de=_0x81c7[_0x527290];return _0x3493de;};'use strict';var Sequelize=require(_0x781c('0x0'));module[_0x781c('0x1')]={'name':{'type':Sequelize[_0x781c('0x2')],'unique':_0x781c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x781c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x781c('0x4'),_0x781c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b147a0b..b5edc50 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 _0x320f=['where','filters','filter','type','VIRTUAL','merge','options','ChatQueue','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','agent','chatPause','createdAt','format','SIP','updatedAt','getTeams','addTeams','ids','Team','online','interface','flatMap','Agents','each','findOrCreate','forEach','emit','userChatQueue:save','select','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','find','transaction','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','test','Sequelize','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','count','offset','limit','json','apply','reject','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0x320f,0xec));var _0xf320=function(_0x1f660d,_0x13dd32){_0x1f660d=_0x1f660d-0x0;var _0xbe651=_0x320f[_0x1f660d];return _0xbe651;};'use strict';var pdf=require(_0xf320('0x0'));var emlformat=require(_0xf320('0x1'));var rimraf=require(_0xf320('0x2'));var zipdir=require(_0xf320('0x3'));var jsonpatch=require(_0xf320('0x4'));var rp=require(_0xf320('0x5'));var moment=require(_0xf320('0x6'));var BPromise=require(_0xf320('0x7'));var Mustache=require(_0xf320('0x8'));var util=require('util');var path=require(_0xf320('0x9'));var sox=require('sox');var csv=require(_0xf320('0xa'));var ejs=require(_0xf320('0xb'));var fs=require('fs');var _=require(_0xf320('0xc'));var squel=require(_0xf320('0xd'));var crypto=require(_0xf320('0xe'));var jsforce=require(_0xf320('0xf'));var deskjs=require(_0xf320('0x10'));var toCsv=require(_0xf320('0xa'));var querystring=require(_0xf320('0x11'));var Papa=require(_0xf320('0x12'));var Redis=require(_0xf320('0x13'));var authService=require(_0xf320('0x14'));var qs=require(_0xf320('0x15'));var as=require(_0xf320('0x16'));var hardwareService=require(_0xf320('0x17'));var logger=require('../../config/logger')(_0xf320('0x18'));var utils=require('../../config/utils');var config=require(_0xf320('0x19'));var db=require(_0xf320('0x1a'))['db'];config[_0xf320('0x1b')]=_[_0xf320('0x1c')](config[_0xf320('0x1b')],{'host':_0xf320('0x1d'),'port':0x18eb});var socket=require(_0xf320('0x1e'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xf320('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf320('0x20')][_0xf320('0x21')]({'port':0x232a});function checkPasswordPattern(_0x50872b,_0x256a77,_0x5c2438){if(_0x5c2438){var _0x5cd855=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cd855[_0xf320('0x22')](_0x256a77)){return _0x50872b;}else{throw new db[(_0xf320('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 _0x50872b;}}function respondWithRpcPromise(_0x2f29b8,_0x4aa575,_0x3fd0c7,_0x449e90){return new BPromise(function(_0x2a55e2,_0x2c2d2f){var _0x501e57=_0x449e90||client;return _0x501e57[_0xf320('0x24')](_0x2f29b8,_0x3fd0c7)[_0xf320('0x25')](function(_0x2376b1){logger['info'](_0xf320('0x26'),_0x4aa575,'request\x20sent');logger['debug'](_0xf320('0x27'),_0x4aa575,_0xf320('0x28'),JSON[_0xf320('0x29')](_0x2376b1));if(_0x2376b1[_0xf320('0x2a')]){if(_0x2376b1[_0xf320('0x2a')][_0xf320('0x2b')]===0x1f4){logger[_0xf320('0x2a')](_0xf320('0x26'),_0x4aa575,_0x2376b1[_0xf320('0x2a')][_0xf320('0x2c')]);return _0x2c2d2f(_0x2376b1[_0xf320('0x2a')][_0xf320('0x2c')]);}logger['error'](_0xf320('0x26'),_0x4aa575,_0x2376b1[_0xf320('0x2a')][_0xf320('0x2c')]);return _0x2a55e2(_0x2376b1['error'][_0xf320('0x2c')]);}else{logger['info'](_0xf320('0x26'),_0x4aa575,_0xf320('0x28'));_0x2a55e2(_0x2376b1['result'][_0xf320('0x2c')]);}})['catch'](function(_0x2a849e){logger[_0xf320('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x4aa575,_0x2a849e);_0x2c2d2f(_0x2a849e);});});}function respondWithStatusCode(_0x1cd5b9,_0xb43f0e){_0xb43f0e=_0xb43f0e||0xcc;return function(_0xe6afe2){if(_0xe6afe2){return _0x1cd5b9[_0xf320('0x2d')](_0xb43f0e);}return _0x1cd5b9[_0xf320('0x2e')](_0xb43f0e)[_0xf320('0x2f')]();};}function respondWithResult(_0x565bb9,_0xcebd0e){_0xcebd0e=_0xcebd0e||0xc8;return function(_0x48f1cb){if(_0x48f1cb){return _0x565bb9[_0xf320('0x2e')](_0xcebd0e)['json'](_0x48f1cb);}};}function respondWithFilteredResult(_0x3529a8,_0x120541){return function(_0x99e1cc){if(_0x99e1cc){var _0x1c7578=_0x99e1cc[_0xf320('0x30')],_0x3e4677=_0x120541[_0xf320('0x31')],_0x1ac874=_0x120541['offset']+_0x120541[_0xf320('0x32')],_0x341026;if(_0x1ac874>=_0x1c7578){_0x1ac874=_0x1c7578;_0x341026=0xc8;}else{_0x341026=0xce;}_0x3529a8[_0xf320('0x2e')](_0x341026);return _0x3529a8['set']('Content-Range',_0x3e4677+'-'+_0x1ac874+'/'+_0x1c7578)[_0xf320('0x33')](_0x99e1cc);}return null;};}function patchUpdates(_0x24bbf7){return function(_0x193d5d){try{jsonpatch[_0xf320('0x34')](_0x193d5d,_0x24bbf7,!![]);}catch(_0x4254fa){return BPromise[_0xf320('0x35')](_0x4254fa);}return _0x193d5d['save']();};}function saveUpdates(_0x245fb5,_0x435256){return function(_0x496552){if(_0x496552){return _0x496552[_0xf320('0x36')](_0x245fb5)[_0xf320('0x25')](function(_0x4131f0){return _0x4131f0;});}return null;};}function removeEntity(_0x54bf55,_0x46a74b){return function(_0x512512){if(_0x512512){return _0x512512['destroy']()['then'](function(){var _0x1bd6b3=_0x512512[_0xf320('0x37')]({'plain':!![]});var _0x102b4=_0xf320('0x38');return db[_0xf320('0x39')][_0xf320('0x3a')]({'where':{'type':_0x102b4,'resourceId':_0x1bd6b3['id']}})['then'](function(){return _0x512512;});})[_0xf320('0x25')](function(){_0x54bf55['status'](0xcc)[_0xf320('0x2f')]();});}};}function handleEntityNotFound(_0x219151,_0x1acf6f){return function(_0x482831){if(!_0x482831){_0x219151['sendStatus'](0x194);}return _0x482831;};}function handleError(_0x1688b0,_0x4bc4fc){_0x4bc4fc=_0x4bc4fc||0x1f4;return function(_0x137788){logger['error'](_0x137788[_0xf320('0x3b')]);if(_0x137788[_0xf320('0x3c')]){delete _0x137788[_0xf320('0x3c')];}_0x1688b0[_0xf320('0x2e')](_0x4bc4fc)[_0xf320('0x3d')](_0x137788);};}exports[_0xf320('0x3e')]=function(_0x1b150d,_0x4aa051){var _0x1d2b1f={},_0x374490={},_0x468ddc={'count':0x0,'rows':[]};var _0x5dad8e=_[_0xf320('0x3f')](db['ChatQueue']['rawAttributes'],function(_0x55dee1){return{'name':_0x55dee1['fieldName'],'type':_0x55dee1['type'][_0xf320('0x40')]};});_0x374490[_0xf320('0x41')]=_[_0xf320('0x3f')](_0x5dad8e,_0xf320('0x3c'));_0x374490['query']=_[_0xf320('0x42')](_0x1b150d[_0xf320('0x43')]);_0x374490['filters']=_[_0xf320('0x44')](_0x374490['model'],_0x374490['query']);_0x1d2b1f[_0xf320('0x45')]=_[_0xf320('0x44')](_0x374490[_0xf320('0x41')],qs[_0xf320('0x46')](_0x1b150d['query'][_0xf320('0x46')]));_0x1d2b1f['attributes']=_0x1d2b1f['attributes'][_0xf320('0x47')]?_0x1d2b1f[_0xf320('0x45')]:_0x374490[_0xf320('0x41')];if(!_0x1b150d['query'][_0xf320('0x48')](_0xf320('0x49'))){_0x1d2b1f['limit']=qs[_0xf320('0x32')](_0x1b150d[_0xf320('0x43')][_0xf320('0x32')]);_0x1d2b1f[_0xf320('0x31')]=qs[_0xf320('0x31')](_0x1b150d[_0xf320('0x43')]['offset']);}_0x1d2b1f[_0xf320('0x4a')]=qs['sort'](_0x1b150d['query'][_0xf320('0x4b')]);_0x1d2b1f[_0xf320('0x4c')]=qs[_0xf320('0x4d')](_['pick'](_0x1b150d[_0xf320('0x43')],_0x374490['filters']),_0x5dad8e);if(_0x1b150d[_0xf320('0x43')][_0xf320('0x4e')]){_0x1d2b1f[_0xf320('0x4c')]=_['merge'](_0x1d2b1f['where'],{'$or':_['map'](_0x5dad8e,function(_0x59b321){if(_0x59b321[_0xf320('0x4f')]!==_0xf320('0x50')){var _0x4ddcda={};_0x4ddcda[_0x59b321[_0xf320('0x3c')]]={'$like':'%'+_0x1b150d[_0xf320('0x43')][_0xf320('0x4e')]+'%'};return _0x4ddcda;}})});}_0x1d2b1f=_[_0xf320('0x51')]({},_0x1d2b1f,_0x1b150d[_0xf320('0x52')]);var _0x5c2a0d={'where':_0x1d2b1f[_0xf320('0x4c')]};return db[_0xf320('0x53')][_0xf320('0x30')](_0x5c2a0d)[_0xf320('0x25')](function(_0x18830c){_0x468ddc[_0xf320('0x30')]=_0x18830c;if(_0x1b150d[_0xf320('0x43')][_0xf320('0x54')]){_0x1d2b1f[_0xf320('0x55')]=[{'all':!![]}];}return db[_0xf320('0x53')][_0xf320('0x56')](_0x1d2b1f);})[_0xf320('0x25')](function(_0x499b90){_0x468ddc[_0xf320('0x57')]=_0x499b90;return _0x468ddc;})[_0xf320('0x25')](respondWithFilteredResult(_0x4aa051,_0x1d2b1f))['catch'](handleError(_0x4aa051,null));};exports[_0xf320('0x58')]=function(_0x5185d8,_0x5efd1d){var _0x174b45={'raw':!![],'where':{'id':_0x5185d8[_0xf320('0x59')]['id']}},_0x533ec1={};_0x533ec1['model']=_['keys'](db[_0xf320('0x53')][_0xf320('0x5a')]);_0x533ec1['query']=_[_0xf320('0x42')](_0x5185d8['query']);_0x533ec1[_0xf320('0x4d')]=_[_0xf320('0x44')](_0x533ec1[_0xf320('0x41')],_0x533ec1[_0xf320('0x43')]);_0x174b45[_0xf320('0x45')]=_[_0xf320('0x44')](_0x533ec1['model'],qs[_0xf320('0x46')](_0x5185d8[_0xf320('0x43')][_0xf320('0x46')]));_0x174b45[_0xf320('0x45')]=_0x174b45['attributes'][_0xf320('0x47')]?_0x174b45[_0xf320('0x45')]:_0x533ec1[_0xf320('0x41')];if(_0x5185d8[_0xf320('0x43')][_0xf320('0x54')]){_0x174b45[_0xf320('0x55')]=[{'all':!![]}];}_0x174b45=_[_0xf320('0x51')]({},_0x174b45,_0x5185d8['options']);return db[_0xf320('0x53')]['find'](_0x174b45)[_0xf320('0x25')](handleEntityNotFound(_0x5efd1d,null))[_0xf320('0x25')](respondWithResult(_0x5efd1d,null))[_0xf320('0x5b')](handleError(_0x5efd1d,null));};exports[_0xf320('0x5c')]=function(_0x39055c,_0x1a1052){return db['ChatQueue']['create'](_0x39055c[_0xf320('0x5d')],{})[_0xf320('0x25')](function(_0x249793){var _0x5b097a=_0x39055c[_0xf320('0x5e')][_0xf320('0x37')]({'plain':!![]});if(!_0x5b097a)throw new Error(_0xf320('0x5f'));if(_0x5b097a[_0xf320('0x60')]===_0xf320('0x5e')){var _0x360c69=_0x249793[_0xf320('0x37')]({'plain':!![]});var _0x27ac8e=_0xf320('0x38');return db[_0xf320('0x61')]['find']({'where':{'name':_0x27ac8e,'userProfileId':_0x5b097a[_0xf320('0x62')]},'raw':!![]})[_0xf320('0x25')](function(_0x329667){if(_0x329667&&_0x329667[_0xf320('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x360c69[_0xf320('0x3c')],'resourceId':_0x360c69['id'],'type':_0x329667[_0xf320('0x3c')],'sectionId':_0x329667['id']},{})[_0xf320('0x25')](function(){return _0x249793;});}else{return _0x249793;}})['catch'](function(_0x2bb9ce){logger[_0xf320('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bb9ce);throw _0x2bb9ce;});}return _0x249793;})[_0xf320('0x25')](respondWithResult(_0x1a1052,0xc9))[_0xf320('0x5b')](handleError(_0x1a1052,null));};exports[_0xf320('0x36')]=function(_0x2237a5,_0x1d5175){if(_0x2237a5['body']['id']){delete _0x2237a5[_0xf320('0x5d')]['id'];}return db[_0xf320('0x53')]['find']({'where':{'id':_0x2237a5[_0xf320('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d5175,null))['then'](saveUpdates(_0x2237a5[_0xf320('0x5d')],null))[_0xf320('0x25')](respondWithResult(_0x1d5175,null))[_0xf320('0x5b')](handleError(_0x1d5175,null));};exports[_0xf320('0x3a')]=function(_0x507fe2,_0x2f555c){return db[_0xf320('0x53')]['find']({'where':{'id':_0x507fe2[_0xf320('0x59')]['id']}})[_0xf320('0x25')](handleEntityNotFound(_0x2f555c,null))[_0xf320('0x25')](removeEntity(_0x2f555c,null))['catch'](handleError(_0x2f555c,null));};exports[_0xf320('0x64')]=function(_0x58565b,_0x2660b3){return db[_0xf320('0x53')]['describe']()[_0xf320('0x25')](respondWithResult(_0x2660b3,null))[_0xf320('0x5b')](handleError(_0x2660b3,null));};exports[_0xf320('0x65')]=function(_0x22926e,_0x1a5e8b,_0x4dca71){var _0x5d55c5={'raw':!![],'where':{}},_0x37d87b={},_0x8ec1c7;return db[_0xf320('0x53')][_0xf320('0x66')]({'where':{'id':_0x22926e[_0xf320('0x59')]['id']}})[_0xf320('0x25')](handleEntityNotFound(_0x1a5e8b,null))[_0xf320('0x25')](function(_0x55773f){if(_0x55773f){_0x8ec1c7=_0x55773f[_0xf320('0x37')]({'plain':!![]});_0x37d87b[_0xf320('0x41')]=_[_0xf320('0x42')](db[_0xf320('0x67')][_0xf320('0x5a')]);_0x37d87b[_0xf320('0x43')]=_['keys'](_0x22926e[_0xf320('0x43')]);_0x37d87b[_0xf320('0x4d')]=_[_0xf320('0x44')](_0x37d87b['model'],_0x37d87b[_0xf320('0x43')]);_0x5d55c5['attributes']=_[_0xf320('0x44')](_0x37d87b['model'],qs[_0xf320('0x46')](_0x22926e[_0xf320('0x43')][_0xf320('0x46')]));_0x5d55c5['attributes']=_0x5d55c5[_0xf320('0x45')][_0xf320('0x47')]?_0x5d55c5[_0xf320('0x45')]:_0x37d87b[_0xf320('0x41')];if(!_0x22926e[_0xf320('0x43')]['hasOwnProperty']('nolimit')){_0x5d55c5[_0xf320('0x32')]=qs[_0xf320('0x32')](_0x22926e[_0xf320('0x43')][_0xf320('0x32')]);_0x5d55c5[_0xf320('0x31')]=qs[_0xf320('0x31')](_0x22926e[_0xf320('0x43')][_0xf320('0x31')]);}_0x5d55c5[_0xf320('0x4a')]=qs[_0xf320('0x4b')](_0x22926e[_0xf320('0x43')]['sort']);_0x5d55c5[_0xf320('0x4c')]=qs[_0xf320('0x4d')](_[_0xf320('0x68')](_0x22926e['query'],_0x37d87b[_0xf320('0x4d')]));_0x5d55c5['where'][_0xf320('0x69')]=_0x55773f['id'];if(_0x22926e[_0xf320('0x43')][_0xf320('0x4e')]){_0x5d55c5[_0xf320('0x4c')]=_[_0xf320('0x51')](_0x5d55c5['where'],{'$or':_[_0xf320('0x3f')](_0x5d55c5[_0xf320('0x45')],function(_0x53f106){var _0x3c89b8={};_0x3c89b8[_0x53f106]={'$like':'%'+_0x22926e[_0xf320('0x43')][_0xf320('0x4e')]+'%'};return _0x3c89b8;})});}_0x5d55c5=_['merge']({},_0x5d55c5,_0x22926e[_0xf320('0x52')]);return db[_0xf320('0x67')][_0xf320('0x56')](_0x5d55c5);}})[_0xf320('0x25')](function(_0x9442e6){if(_0x9442e6){return db[_0xf320('0x6a')][_0xf320('0x6b')]({'where':{'id':_[_0xf320('0x3f')](_0x9442e6,'UserId'),'role':_0xf320('0x6c')},'attributes':['id',_0xf320('0x3c'),_0xf320('0x6d'),'updatedAt',_0xf320('0x6e')]});}})[_0xf320('0x25')](function(_0x376c0e){if(_0x376c0e){return{'count':_0x376c0e[_0xf320('0x30')],'rows':_['map'](_0x376c0e[_0xf320('0x57')],function(_0xa066a0){return{'membername':_0xa066a0[_0xf320('0x3c')],'UserId':_0xa066a0['id'],'queue_name':_0x8ec1c7[_0xf320('0x3c')],'ChatQueueId':_0x8ec1c7['id'],'interface':util[_0xf320('0x6f')]('%s/%s',_0xf320('0x70'),_0xa066a0[_0xf320('0x3c')]),'penalty':0x0,'paused':_0xa066a0[_0xf320('0x6d')],'createdAt':_0xa066a0[_0xf320('0x6e')],'updatedAt':_0xa066a0[_0xf320('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf320('0x25')](respondWithFilteredResult(_0x1a5e8b,_0x5d55c5))['catch'](handleError(_0x1a5e8b,null));};exports[_0xf320('0x72')]=function(_0x2eaf2d,_0x50bfe1,_0x21b27c){var _0x43c464={};var _0x1cfe43={};var _0x44baa5;var _0x2274a1;return db[_0xf320('0x53')][_0xf320('0x66')]({'where':{'id':_0x2eaf2d[_0xf320('0x59')]['id']}})['then'](handleEntityNotFound(_0x50bfe1,null))[_0xf320('0x25')](function(_0x3da5d8){if(_0x3da5d8){_0x44baa5=_0x3da5d8;_0x1cfe43[_0xf320('0x41')]=_['keys'](db['Team']['rawAttributes']);_0x1cfe43[_0xf320('0x43')]=_[_0xf320('0x42')](_0x2eaf2d[_0xf320('0x43')]);_0x1cfe43[_0xf320('0x4d')]=_[_0xf320('0x44')](_0x1cfe43[_0xf320('0x41')],_0x1cfe43['query']);_0x43c464['attributes']=_[_0xf320('0x44')](_0x1cfe43['model'],qs['fields'](_0x2eaf2d[_0xf320('0x43')][_0xf320('0x46')]));_0x43c464['attributes']=_0x43c464[_0xf320('0x45')]['length']?_0x43c464[_0xf320('0x45')]:_0x1cfe43[_0xf320('0x41')];_0x43c464[_0xf320('0x4a')]=qs[_0xf320('0x4b')](_0x2eaf2d[_0xf320('0x43')][_0xf320('0x4b')]);_0x43c464[_0xf320('0x4c')]=qs[_0xf320('0x4d')](_[_0xf320('0x68')](_0x2eaf2d[_0xf320('0x43')],_0x1cfe43[_0xf320('0x4d')]));if(_0x2eaf2d[_0xf320('0x43')][_0xf320('0x4e')]){_0x43c464[_0xf320('0x4c')]=_['merge'](_0x43c464['where'],{'$or':_[_0xf320('0x3f')](_0x43c464[_0xf320('0x45')],function(_0x99bb58){var _0x317ba1={};_0x317ba1[_0x99bb58]={'$like':'%'+_0x2eaf2d[_0xf320('0x43')][_0xf320('0x4e')]+'%'};return _0x317ba1;})});}_0x43c464=_[_0xf320('0x51')]({},_0x43c464,_0x2eaf2d[_0xf320('0x52')]);return _0x44baa5[_0xf320('0x72')](_0x43c464);}})[_0xf320('0x25')](function(_0x337628){if(_0x337628){_0x2274a1=_0x337628[_0xf320('0x47')];if(!_0x2eaf2d[_0xf320('0x43')][_0xf320('0x48')]('nolimit')){_0x43c464[_0xf320('0x32')]=qs[_0xf320('0x32')](_0x2eaf2d['query'][_0xf320('0x32')]);_0x43c464[_0xf320('0x31')]=qs['offset'](_0x2eaf2d[_0xf320('0x43')]['offset']);}return _0x44baa5[_0xf320('0x72')](_0x43c464);}})['then'](function(_0x46a911){if(_0x46a911){return _0x46a911?{'count':_0x2274a1,'rows':_0x46a911}:null;}})[_0xf320('0x25')](respondWithResult(_0x50bfe1,null))['catch'](handleError(_0x50bfe1,null));};exports[_0xf320('0x73')]=function(_0x271b0f,_0x2f8912,_0x9c6a37){var _0x183b2a=_0x271b0f[_0xf320('0x5d')][_0xf320('0x74')];return db[_0xf320('0x75')][_0xf320('0x56')]({'where':{'id':_0x183b2a},'attributes':['id'],'include':[{'model':db[_0xf320('0x6a')],'as':'Agents','attributes':['id',_0xf320('0x3c'),_0xf320('0x76'),'voicePause',_0xf320('0x77')],'raw':!![]}]})[_0xf320('0x25')](function(_0x16564f){if(_0x16564f){var _0x5ab831=_[_0xf320('0x78')](_0x16564f,function(_0x380a08){var _0x59bca4=_0x380a08['get']({'plain':!![]});return _0x59bca4[_0xf320('0x79')];});return db[_0xf320('0x53')]['find']({'where':{'id':_0x271b0f[_0xf320('0x59')]['id']}})['then'](function(_0x40d4d7){return db['sequelize']['transaction'](function(_0x57f79b){return _0x40d4d7['addTeams'](_0x183b2a,{'transaction':_0x57f79b})['then'](function(){return BPromise[_0xf320('0x7a')](_0x5ab831,function(_0x596f37){return db[_0xf320('0x67')][_0xf320('0x7b')]({'where':{'UserId':_0x596f37['id'],'ChatQueueId':_0x271b0f[_0xf320('0x59')]['id']},'transaction':_0x57f79b});});})['then'](function(){_0x5ab831[_0xf320('0x7c')](function(_0x4449b5){socket[_0xf320('0x7d')](_0xf320('0x7e'),{'UserId':_0x4449b5['id'],'ChatQueueId':_0x40d4d7['id']});});});});});}})['then'](respondWithStatusCode(_0x2f8912,null))[_0xf320('0x5b')](handleError(_0x2f8912,null));};exports['removeTeams']=function(_0x17a8b2,_0x5289f9,_0x21bf47){return db[_0xf320('0x75')][_0xf320('0x56')]({'where':{'id':_0x17a8b2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf320('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf320('0x25')](handleEntityNotFound(_0x5289f9,null))['then'](function(_0xcff83f){var _0x1e51de=_['map'](_0xcff83f,'id');var _0x2b6cb5=[];var _0x60fb46=[];var _0x231d6f=squel[_0xf320('0x7f')]();_0x231d6f['field']('tq.TeamId')[_0xf320('0x80')](_0xf320('0x81'),'tq')['join'](_0xf320('0x82'),'ut',_0xf320('0x83'))[_0xf320('0x4c')](_0xf320('0x84'),_0x17a8b2[_0xf320('0x59')]['id']);for(var _0x2676c8=0x0;_0x2676c8<_0xcff83f['length'];_0x2676c8+=0x1){let _0x458add=_0xcff83f[_0x2676c8];for(var _0x409d50=0x0;_0x409d50<_0x458add['Agents'][_0xf320('0x47')];_0x409d50+=0x1){let _0x35ae03=_0x458add[_0xf320('0x79')][_0x409d50];var _0x23fc8f=_0x231d6f['clone']();_0x23fc8f[_0xf320('0x4c')]('ut.UserId\x20=\x20?',_0x35ae03['id']);_0x60fb46[_0xf320('0x85')](db[_0xf320('0x86')][_0xf320('0x43')](_0x23fc8f[_0xf320('0x87')](),{'type':db['sequelize'][_0xf320('0x88')][_0xf320('0x89')]})[_0xf320('0x25')](function(_0x4415fa){if(_0x4415fa[_0xf320('0x47')]===0x1){return _0x35ae03['id'];}else{var _0x516e7d=_[_0xf320('0x8a')](_['map'](_0x4415fa,_0xf320('0x8b')),function(_0x546bfa){return _[_0xf320('0x8c')](_0x1e51de,_0x546bfa);});if(_0x516e7d){return _0x35ae03['id'];}}}));}}return BPromise[_0xf320('0x8d')](_0x60fb46)[_0xf320('0x25')](function(_0x56fecd){_0x2b6cb5=_(_0x2b6cb5)[_0xf320('0x8e')](_0x56fecd)[_0xf320('0x8f')]()[_0xf320('0x90')]();return db[_0xf320('0x53')][_0xf320('0x91')]({'where':{'id':_0x17a8b2[_0xf320('0x59')]['id']}})[_0xf320('0x25')](function(_0xa14917){return db[_0xf320('0x86')][_0xf320('0x92')](function(_0x4f793e){return _0xa14917[_0xf320('0x93')](_0x17a8b2[_0xf320('0x43')][_0xf320('0x74')],{'transaction':_0x4f793e})[_0xf320('0x25')](function(){if(!_[_0xf320('0x94')](_0x2b6cb5)){return _0xa14917[_0xf320('0x95')](_0x2b6cb5,{'transaction':_0x4f793e});}})[_0xf320('0x25')](function(){_0x2b6cb5[_0xf320('0x7c')](function(_0x1bf0cc){socket[_0xf320('0x7d')](_0xf320('0x96'),{'UserId':_0x1bf0cc,'ChatQueueId':_0xa14917['id']});});});});});});})[_0xf320('0x25')](respondWithStatusCode(_0x5289f9,null))[_0xf320('0x5b')](handleError(_0x5289f9,null));};exports[_0xf320('0x97')]=function(_0x462e2,_0x4ec294,_0x2368be){return db[_0xf320('0x53')][_0xf320('0x91')]({'where':{'id':_0x462e2[_0xf320('0x59')]['id']}})['then'](handleEntityNotFound(_0x4ec294,null))['then'](function(_0x2ad3dc){if(_0x2ad3dc){return _0x2ad3dc[_0xf320('0x97')](_0x462e2[_0xf320('0x5d')][_0xf320('0x74')],_[_0xf320('0x98')](_0x462e2['body'],[_0xf320('0x74'),'id'])||{})[_0xf320('0x99')](function(_0x25f490){for(var _0x1763a1=0x0;_0x1763a1<_0x462e2[_0xf320('0x5d')][_0xf320('0x74')][_0xf320('0x47')];_0x1763a1+=0x1){socket[_0xf320('0x7d')]('userChatQueue:save',{'UserId':_0x462e2[_0xf320('0x5d')][_0xf320('0x74')][_0x1763a1],'ChatQueueId':_0x462e2[_0xf320('0x59')]['id']});}return _0x25f490;});}})[_0xf320('0x25')](respondWithResult(_0x4ec294,null))[_0xf320('0x5b')](handleError(_0x4ec294,null));};exports['removeAgents']=function(_0x4bbabc,_0x3f9f27,_0x204cb7){return db[_0xf320('0x53')][_0xf320('0x91')]({'where':{'id':_0x4bbabc[_0xf320('0x59')]['id']}})[_0xf320('0x25')](handleEntityNotFound(_0x3f9f27,null))[_0xf320('0x25')](function(_0x2871ae){if(_0x2871ae){return _0x2871ae[_0xf320('0x95')](_0x4bbabc[_0xf320('0x43')]['ids'])[_0xf320('0x25')](function(){if(_[_0xf320('0x9a')](_0x4bbabc[_0xf320('0x43')][_0xf320('0x74')])){for(var _0x523534=0x0;_0x523534<_0x4bbabc[_0xf320('0x43')][_0xf320('0x74')][_0xf320('0x47')];_0x523534+=0x1){socket['emit'](_0xf320('0x96'),{'UserId':Number(_0x4bbabc[_0xf320('0x43')]['ids'][_0x523534]),'ChatQueueId':Number(_0x4bbabc[_0xf320('0x59')]['id'])});}}else{socket[_0xf320('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x4bbabc[_0xf320('0x43')]['ids']),'ChatQueueId':Number(_0x4bbabc[_0xf320('0x59')]['id'])});}});}})[_0xf320('0x25')](respondWithStatusCode(_0x3f9f27,null))[_0xf320('0x5b')](handleError(_0x3f9f27,null));};exports[_0xf320('0x9b')]=function(_0x5abfd4,_0x2840cb,_0x89a2e6){var _0x2becaa={};var _0x3177a7={};var _0x1caddc;var _0x27ad03;return db[_0xf320('0x53')][_0xf320('0x66')]({'where':{'id':_0x5abfd4[_0xf320('0x59')]['id']}})[_0xf320('0x25')](handleEntityNotFound(_0x2840cb,null))[_0xf320('0x25')](function(_0x1bd42d){if(_0x1bd42d){_0x1caddc=_0x1bd42d;_0x3177a7[_0xf320('0x41')]=_[_0xf320('0x42')](db[_0xf320('0x6a')][_0xf320('0x5a')]);_0x3177a7[_0xf320('0x43')]=_[_0xf320('0x42')](_0x5abfd4[_0xf320('0x43')]);_0x3177a7['filters']=_['intersection'](_0x3177a7[_0xf320('0x41')],_0x3177a7[_0xf320('0x43')]);_0x2becaa[_0xf320('0x45')]=_[_0xf320('0x44')](_0x3177a7[_0xf320('0x41')],qs[_0xf320('0x46')](_0x5abfd4['query'][_0xf320('0x46')]));_0x2becaa[_0xf320('0x45')]=_0x2becaa[_0xf320('0x45')]['length']?_0x2becaa[_0xf320('0x45')]:_0x3177a7[_0xf320('0x41')];_0x2becaa[_0xf320('0x4a')]=qs[_0xf320('0x4b')](_0x5abfd4['query'][_0xf320('0x4b')]);_0x2becaa[_0xf320('0x4c')]=qs[_0xf320('0x4d')](_[_0xf320('0x68')](_0x5abfd4[_0xf320('0x43')],_0x3177a7[_0xf320('0x4d')]));if(_0x5abfd4[_0xf320('0x43')][_0xf320('0x4e')]){_0x2becaa[_0xf320('0x4c')]=_[_0xf320('0x51')](_0x2becaa['where'],{'$or':_[_0xf320('0x3f')](_0x2becaa[_0xf320('0x45')],function(_0x55f8e8){var _0x550b85={};_0x550b85[_0x55f8e8]={'$like':'%'+_0x5abfd4[_0xf320('0x43')][_0xf320('0x4e')]+'%'};return _0x550b85;})});}_0x2becaa=_[_0xf320('0x51')]({},_0x2becaa,_0x5abfd4[_0xf320('0x52')]);return _0x1caddc[_0xf320('0x9b')](_0x2becaa);}})[_0xf320('0x25')](function(_0x456af0){if(_0x456af0){_0x27ad03=_0x456af0[_0xf320('0x47')];if(!_0x5abfd4['query']['hasOwnProperty']('nolimit')){_0x2becaa[_0xf320('0x32')]=qs[_0xf320('0x32')](_0x5abfd4[_0xf320('0x43')][_0xf320('0x32')]);_0x2becaa[_0xf320('0x31')]=qs[_0xf320('0x31')](_0x5abfd4[_0xf320('0x43')][_0xf320('0x31')]);}return _0x1caddc['getAgents'](_0x2becaa);}})['then'](function(_0x117f8d){if(_0x117f8d){return _0x117f8d?{'count':_0x27ad03,'rows':_0x117f8d}:null;}})['then'](respondWithResult(_0x2840cb,null))[_0xf320('0x5b')](handleError(_0x2840cb,null));}; \ No newline at end of file +var _0x6b15=['tq.TeamId','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','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','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','count','limit','set','apply','save','get','ChatQueues','destroy','end','stack','name','index','map','ChatQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','findOne','getTeams','ids','Team','User','Agents','online','voicePause','interface','each','findOrCreate','emit','userChatQueue:save','field'];(function(_0x236512,_0x180979){var _0x5cea6f=function(_0x254e48){while(--_0x254e48){_0x236512['push'](_0x236512['shift']());}};_0x5cea6f(++_0x180979);}(_0x6b15,0xb6));var _0x56b1=function(_0x41f011,_0x401839){_0x41f011=_0x41f011-0x0;var _0x34c887=_0x6b15[_0x41f011];return _0x34c887;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x56b1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x56b1('0x1'));var rp=require(_0x56b1('0x2'));var moment=require('moment');var BPromise=require(_0x56b1('0x3'));var Mustache=require(_0x56b1('0x4'));var util=require(_0x56b1('0x5'));var path=require(_0x56b1('0x6'));var sox=require(_0x56b1('0x7'));var csv=require(_0x56b1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x56b1('0x9'));var squel=require(_0x56b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x56b1('0xb'));var deskjs=require(_0x56b1('0xc'));var toCsv=require(_0x56b1('0x8'));var querystring=require('querystring');var Papa=require(_0x56b1('0xd'));var Redis=require(_0x56b1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x56b1('0xf'));var as=require(_0x56b1('0x10'));var hardwareService=require(_0x56b1('0x11'));var logger=require(_0x56b1('0x12'))(_0x56b1('0x13'));var utils=require(_0x56b1('0x14'));var config=require(_0x56b1('0x15'));var db=require(_0x56b1('0x16'))['db'];config['redis']=_[_0x56b1('0x17')](config[_0x56b1('0x18')],{'host':_0x56b1('0x19'),'port':0x18eb});var socket=require(_0x56b1('0x1a'))(new Redis(config[_0x56b1('0x18')]));require(_0x56b1('0x1b'))[_0x56b1('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x56b1('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2a054c,_0x28d03f,_0x330684){if(_0x330684){var _0x593a70=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x593a70[_0x56b1('0x1e')](_0x28d03f)){return _0x2a054c;}else{throw new db[(_0x56b1('0x1f'))]['ValidationError'](_0x56b1('0x20'));}}else{return _0x2a054c;}}function respondWithRpcPromise(_0x163a5d,_0x1feb2a,_0x3f0f3a,_0x1a2bc8){return new BPromise(function(_0x3b2b55,_0xbefe2a){var _0x1e15a9=_0x1a2bc8||client;return _0x1e15a9['request'](_0x163a5d,_0x3f0f3a)[_0x56b1('0x21')](function(_0x33f988){logger[_0x56b1('0x22')](_0x56b1('0x23'),_0x1feb2a,'request\x20sent');logger['debug'](_0x56b1('0x24'),_0x1feb2a,_0x56b1('0x25'),JSON['stringify'](_0x33f988));if(_0x33f988[_0x56b1('0x26')]){if(_0x33f988[_0x56b1('0x26')]['code']===0x1f4){logger['error'](_0x56b1('0x23'),_0x1feb2a,_0x33f988[_0x56b1('0x26')][_0x56b1('0x27')]);return _0xbefe2a(_0x33f988[_0x56b1('0x26')]['message']);}logger[_0x56b1('0x26')]('ChatQueue,\x20%s,\x20%s',_0x1feb2a,_0x33f988[_0x56b1('0x26')]['message']);return _0x3b2b55(_0x33f988[_0x56b1('0x26')][_0x56b1('0x27')]);}else{logger[_0x56b1('0x22')](_0x56b1('0x23'),_0x1feb2a,'request\x20sent');_0x3b2b55(_0x33f988[_0x56b1('0x28')][_0x56b1('0x27')]);}})[_0x56b1('0x29')](function(_0x22f51f){logger[_0x56b1('0x26')](_0x56b1('0x23'),_0x1feb2a,_0x22f51f);_0xbefe2a(_0x22f51f);});});}function respondWithStatusCode(_0xf70442,_0x53cf33){_0x53cf33=_0x53cf33||0xcc;return function(_0x231940){if(_0x231940){return _0xf70442[_0x56b1('0x2a')](_0x53cf33);}return _0xf70442[_0x56b1('0x2b')](_0x53cf33)['end']();};}function respondWithResult(_0x1aa1f2,_0x180b39){_0x180b39=_0x180b39||0xc8;return function(_0x3ca874){if(_0x3ca874){return _0x1aa1f2[_0x56b1('0x2b')](_0x180b39)[_0x56b1('0x2c')](_0x3ca874);}};}function respondWithFilteredResult(_0x1d7717,_0x3384df){return function(_0xb2223c){if(_0xb2223c){var _0x178e8c=_0xb2223c[_0x56b1('0x2d')],_0x29f9ca=_0x3384df['offset'],_0x49a4ac=_0x3384df['offset']+_0x3384df[_0x56b1('0x2e')],_0x230fce;if(_0x49a4ac>=_0x178e8c){_0x49a4ac=_0x178e8c;_0x230fce=0xc8;}else{_0x230fce=0xce;}_0x1d7717[_0x56b1('0x2b')](_0x230fce);return _0x1d7717[_0x56b1('0x2f')]('Content-Range',_0x29f9ca+'-'+_0x49a4ac+'/'+_0x178e8c)['json'](_0xb2223c);}return null;};}function patchUpdates(_0x580fb0){return function(_0x2b162a){try{jsonpatch[_0x56b1('0x30')](_0x2b162a,_0x580fb0,!![]);}catch(_0x322c5b){return BPromise['reject'](_0x322c5b);}return _0x2b162a[_0x56b1('0x31')]();};}function saveUpdates(_0x3ba210,_0x5648a2){return function(_0x2ab8aa){if(_0x2ab8aa){return _0x2ab8aa['update'](_0x3ba210)[_0x56b1('0x21')](function(_0x352145){return _0x352145;});}return null;};}function removeEntity(_0x27a3bb,_0x4ea937){return function(_0xb8d873){if(_0xb8d873){return _0xb8d873['destroy']()[_0x56b1('0x21')](function(){var _0x51f9f1=_0xb8d873[_0x56b1('0x32')]({'plain':!![]});var _0x1f6d8c=_0x56b1('0x33');return db['UserProfileResource'][_0x56b1('0x34')]({'where':{'type':_0x1f6d8c,'resourceId':_0x51f9f1['id']}})['then'](function(){return _0xb8d873;});})[_0x56b1('0x21')](function(){_0x27a3bb['status'](0xcc)[_0x56b1('0x35')]();});}};}function handleEntityNotFound(_0x5a6485,_0x3676ba){return function(_0x2a7de3){if(!_0x2a7de3){_0x5a6485['sendStatus'](0x194);}return _0x2a7de3;};}function handleError(_0x5ca7c7,_0x3885e8){_0x3885e8=_0x3885e8||0x1f4;return function(_0x2eca0b){logger[_0x56b1('0x26')](_0x2eca0b[_0x56b1('0x36')]);if(_0x2eca0b[_0x56b1('0x37')]){delete _0x2eca0b['name'];}_0x5ca7c7[_0x56b1('0x2b')](_0x3885e8)['send'](_0x2eca0b);};}exports[_0x56b1('0x38')]=function(_0x387d75,_0x13cd17){var _0x5c5321={},_0x2dcfb8={},_0x2984ac={'count':0x0,'rows':[]};var _0x124d38=_[_0x56b1('0x39')](db[_0x56b1('0x3a')]['rawAttributes'],function(_0x2c9643){return{'name':_0x2c9643[_0x56b1('0x3b')],'type':_0x2c9643[_0x56b1('0x3c')][_0x56b1('0x3d')]};});_0x2dcfb8[_0x56b1('0x3e')]=_[_0x56b1('0x39')](_0x124d38,_0x56b1('0x37'));_0x2dcfb8[_0x56b1('0x3f')]=_[_0x56b1('0x40')](_0x387d75[_0x56b1('0x3f')]);_0x2dcfb8['filters']=_[_0x56b1('0x41')](_0x2dcfb8[_0x56b1('0x3e')],_0x2dcfb8[_0x56b1('0x3f')]);_0x5c5321[_0x56b1('0x42')]=_[_0x56b1('0x41')](_0x2dcfb8[_0x56b1('0x3e')],qs[_0x56b1('0x43')](_0x387d75['query'][_0x56b1('0x43')]));_0x5c5321[_0x56b1('0x42')]=_0x5c5321['attributes'][_0x56b1('0x44')]?_0x5c5321['attributes']:_0x2dcfb8[_0x56b1('0x3e')];if(!_0x387d75[_0x56b1('0x3f')][_0x56b1('0x45')](_0x56b1('0x46'))){_0x5c5321[_0x56b1('0x2e')]=qs[_0x56b1('0x2e')](_0x387d75[_0x56b1('0x3f')]['limit']);_0x5c5321[_0x56b1('0x47')]=qs[_0x56b1('0x47')](_0x387d75[_0x56b1('0x3f')][_0x56b1('0x47')]);}_0x5c5321[_0x56b1('0x48')]=qs[_0x56b1('0x49')](_0x387d75['query'][_0x56b1('0x49')]);_0x5c5321[_0x56b1('0x4a')]=qs[_0x56b1('0x4b')](_[_0x56b1('0x4c')](_0x387d75['query'],_0x2dcfb8['filters']),_0x124d38);if(_0x387d75[_0x56b1('0x3f')]['filter']){_0x5c5321[_0x56b1('0x4a')]=_['merge'](_0x5c5321[_0x56b1('0x4a')],{'$or':_[_0x56b1('0x39')](_0x124d38,function(_0xcdc7d1){if(_0xcdc7d1[_0x56b1('0x3c')]!==_0x56b1('0x4d')){var _0x44d172={};_0x44d172[_0xcdc7d1[_0x56b1('0x37')]]={'$like':'%'+_0x387d75[_0x56b1('0x3f')][_0x56b1('0x4e')]+'%'};return _0x44d172;}})});}_0x5c5321=_[_0x56b1('0x4f')]({},_0x5c5321,_0x387d75[_0x56b1('0x50')]);var _0x12e298={'where':_0x5c5321[_0x56b1('0x4a')]};return db['ChatQueue'][_0x56b1('0x2d')](_0x12e298)[_0x56b1('0x21')](function(_0x32bc4e){_0x2984ac[_0x56b1('0x2d')]=_0x32bc4e;if(_0x387d75[_0x56b1('0x3f')]['includeAll']){_0x5c5321[_0x56b1('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0x56b1('0x52')](_0x5c5321);})['then'](function(_0x40a2ab){_0x2984ac['rows']=_0x40a2ab;return _0x2984ac;})[_0x56b1('0x21')](respondWithFilteredResult(_0x13cd17,_0x5c5321))[_0x56b1('0x29')](handleError(_0x13cd17,null));};exports[_0x56b1('0x53')]=function(_0x7854d3,_0x104aff){var _0x4f699c={'raw':!![],'where':{'id':_0x7854d3[_0x56b1('0x54')]['id']}},_0x183e5d={};_0x183e5d[_0x56b1('0x3e')]=_[_0x56b1('0x40')](db['ChatQueue'][_0x56b1('0x55')]);_0x183e5d[_0x56b1('0x3f')]=_[_0x56b1('0x40')](_0x7854d3['query']);_0x183e5d['filters']=_[_0x56b1('0x41')](_0x183e5d[_0x56b1('0x3e')],_0x183e5d[_0x56b1('0x3f')]);_0x4f699c[_0x56b1('0x42')]=_['intersection'](_0x183e5d['model'],qs[_0x56b1('0x43')](_0x7854d3[_0x56b1('0x3f')]['fields']));_0x4f699c[_0x56b1('0x42')]=_0x4f699c[_0x56b1('0x42')][_0x56b1('0x44')]?_0x4f699c[_0x56b1('0x42')]:_0x183e5d[_0x56b1('0x3e')];if(_0x7854d3[_0x56b1('0x3f')][_0x56b1('0x56')]){_0x4f699c[_0x56b1('0x51')]=[{'all':!![]}];}_0x4f699c=_[_0x56b1('0x4f')]({},_0x4f699c,_0x7854d3[_0x56b1('0x50')]);return db['ChatQueue'][_0x56b1('0x57')](_0x4f699c)[_0x56b1('0x21')](handleEntityNotFound(_0x104aff,null))[_0x56b1('0x21')](respondWithResult(_0x104aff,null))[_0x56b1('0x29')](handleError(_0x104aff,null));};exports[_0x56b1('0x58')]=function(_0x370793,_0x41ed53){return db[_0x56b1('0x3a')][_0x56b1('0x58')](_0x370793[_0x56b1('0x59')],{})[_0x56b1('0x21')](function(_0x253fcf){var _0x1104fe=_0x370793[_0x56b1('0x5a')][_0x56b1('0x32')]({'plain':!![]});if(!_0x1104fe)throw new Error(_0x56b1('0x5b'));if(_0x1104fe[_0x56b1('0x5c')]===_0x56b1('0x5a')){var _0x29951b=_0x253fcf[_0x56b1('0x32')]({'plain':!![]});var _0x10a3ef=_0x56b1('0x33');return db[_0x56b1('0x5d')][_0x56b1('0x57')]({'where':{'name':_0x10a3ef,'userProfileId':_0x1104fe[_0x56b1('0x5e')]},'raw':!![]})[_0x56b1('0x21')](function(_0x708d5a){if(_0x708d5a&&_0x708d5a[_0x56b1('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x29951b[_0x56b1('0x37')],'resourceId':_0x29951b['id'],'type':_0x708d5a[_0x56b1('0x37')],'sectionId':_0x708d5a['id']},{})['then'](function(){return _0x253fcf;});}else{return _0x253fcf;}})['catch'](function(_0x167f38){logger[_0x56b1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x167f38);throw _0x167f38;});}return _0x253fcf;})[_0x56b1('0x21')](respondWithResult(_0x41ed53,0xc9))['catch'](handleError(_0x41ed53,null));};exports[_0x56b1('0x60')]=function(_0xc25829,_0x95e645){if(_0xc25829[_0x56b1('0x59')]['id']){delete _0xc25829[_0x56b1('0x59')]['id'];}return db[_0x56b1('0x3a')][_0x56b1('0x57')]({'where':{'id':_0xc25829[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x95e645,null))[_0x56b1('0x21')](saveUpdates(_0xc25829[_0x56b1('0x59')],null))[_0x56b1('0x21')](respondWithResult(_0x95e645,null))[_0x56b1('0x29')](handleError(_0x95e645,null));};exports[_0x56b1('0x34')]=function(_0x28045d,_0x5be4b8){return db[_0x56b1('0x3a')]['find']({'where':{'id':_0x28045d[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x5be4b8,null))['then'](removeEntity(_0x5be4b8,null))[_0x56b1('0x29')](handleError(_0x5be4b8,null));};exports[_0x56b1('0x61')]=function(_0x451934,_0x4afecf){return db[_0x56b1('0x3a')]['describe']()[_0x56b1('0x21')](respondWithResult(_0x4afecf,null))['catch'](handleError(_0x4afecf,null));};exports[_0x56b1('0x62')]=function(_0x3a5059,_0x3f478b,_0xb4bd20){var _0x16fe6a={'raw':!![],'where':{}},_0x40f94f={},_0x4e15b5;return db[_0x56b1('0x3a')]['findOne']({'where':{'id':_0x3a5059[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x3f478b,null))[_0x56b1('0x21')](function(_0x533c22){if(_0x533c22){_0x4e15b5=_0x533c22['get']({'plain':!![]});_0x40f94f[_0x56b1('0x3e')]=_[_0x56b1('0x40')](db['UserChatQueue']['rawAttributes']);_0x40f94f[_0x56b1('0x3f')]=_[_0x56b1('0x40')](_0x3a5059['query']);_0x40f94f[_0x56b1('0x4b')]=_[_0x56b1('0x41')](_0x40f94f[_0x56b1('0x3e')],_0x40f94f[_0x56b1('0x3f')]);_0x16fe6a[_0x56b1('0x42')]=_['intersection'](_0x40f94f['model'],qs[_0x56b1('0x43')](_0x3a5059[_0x56b1('0x3f')][_0x56b1('0x43')]));_0x16fe6a[_0x56b1('0x42')]=_0x16fe6a[_0x56b1('0x42')][_0x56b1('0x44')]?_0x16fe6a[_0x56b1('0x42')]:_0x40f94f[_0x56b1('0x3e')];if(!_0x3a5059['query'][_0x56b1('0x45')](_0x56b1('0x46'))){_0x16fe6a[_0x56b1('0x2e')]=qs[_0x56b1('0x2e')](_0x3a5059[_0x56b1('0x3f')][_0x56b1('0x2e')]);_0x16fe6a['offset']=qs[_0x56b1('0x47')](_0x3a5059[_0x56b1('0x3f')]['offset']);}_0x16fe6a['order']=qs[_0x56b1('0x49')](_0x3a5059[_0x56b1('0x3f')][_0x56b1('0x49')]);_0x16fe6a[_0x56b1('0x4a')]=qs[_0x56b1('0x4b')](_[_0x56b1('0x4c')](_0x3a5059['query'],_0x40f94f[_0x56b1('0x4b')]));_0x16fe6a[_0x56b1('0x4a')][_0x56b1('0x63')]=_0x533c22['id'];if(_0x3a5059[_0x56b1('0x3f')]['filter']){_0x16fe6a['where']=_[_0x56b1('0x4f')](_0x16fe6a[_0x56b1('0x4a')],{'$or':_[_0x56b1('0x39')](_0x16fe6a[_0x56b1('0x42')],function(_0x2d2ebc){var _0x21c983={};_0x21c983[_0x2d2ebc]={'$like':'%'+_0x3a5059[_0x56b1('0x3f')][_0x56b1('0x4e')]+'%'};return _0x21c983;})});}_0x16fe6a=_[_0x56b1('0x4f')]({},_0x16fe6a,_0x3a5059[_0x56b1('0x50')]);return db[_0x56b1('0x64')][_0x56b1('0x52')](_0x16fe6a);}})[_0x56b1('0x21')](function(_0x5b7e8c){if(_0x5b7e8c){return db['User'][_0x56b1('0x65')]({'where':{'id':_[_0x56b1('0x39')](_0x5b7e8c,_0x56b1('0x66')),'role':_0x56b1('0x67')},'attributes':['id','name','chatPause',_0x56b1('0x68'),_0x56b1('0x69')]});}})['then'](function(_0x5b407a){if(_0x5b407a){return{'count':_0x5b407a[_0x56b1('0x2d')],'rows':_[_0x56b1('0x39')](_0x5b407a[_0x56b1('0x6a')],function(_0x3b11ed){return{'membername':_0x3b11ed[_0x56b1('0x37')],'UserId':_0x3b11ed['id'],'queue_name':_0x4e15b5['name'],'ChatQueueId':_0x4e15b5['id'],'interface':util[_0x56b1('0x6b')]('%s/%s','SIP',_0x3b11ed[_0x56b1('0x37')]),'penalty':0x0,'paused':_0x3b11ed['chatPause'],'createdAt':_0x3b11ed[_0x56b1('0x69')],'updatedAt':_0x3b11ed[_0x56b1('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x56b1('0x21')](respondWithFilteredResult(_0x3f478b,_0x16fe6a))[_0x56b1('0x29')](handleError(_0x3f478b,null));};exports['getTeams']=function(_0x55420f,_0x5616a5,_0x145b71){var _0x58e054={};var _0x2e8a96={};var _0x595337;var _0x3e7e60;return db[_0x56b1('0x3a')][_0x56b1('0x6c')]({'where':{'id':_0x55420f[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x5616a5,null))[_0x56b1('0x21')](function(_0x10f211){if(_0x10f211){_0x595337=_0x10f211;_0x2e8a96[_0x56b1('0x3e')]=_[_0x56b1('0x40')](db['Team'][_0x56b1('0x55')]);_0x2e8a96[_0x56b1('0x3f')]=_[_0x56b1('0x40')](_0x55420f[_0x56b1('0x3f')]);_0x2e8a96['filters']=_[_0x56b1('0x41')](_0x2e8a96['model'],_0x2e8a96[_0x56b1('0x3f')]);_0x58e054[_0x56b1('0x42')]=_['intersection'](_0x2e8a96['model'],qs[_0x56b1('0x43')](_0x55420f[_0x56b1('0x3f')][_0x56b1('0x43')]));_0x58e054['attributes']=_0x58e054['attributes'][_0x56b1('0x44')]?_0x58e054[_0x56b1('0x42')]:_0x2e8a96[_0x56b1('0x3e')];_0x58e054['order']=qs['sort'](_0x55420f[_0x56b1('0x3f')][_0x56b1('0x49')]);_0x58e054[_0x56b1('0x4a')]=qs[_0x56b1('0x4b')](_[_0x56b1('0x4c')](_0x55420f['query'],_0x2e8a96['filters']));if(_0x55420f[_0x56b1('0x3f')][_0x56b1('0x4e')]){_0x58e054[_0x56b1('0x4a')]=_['merge'](_0x58e054['where'],{'$or':_[_0x56b1('0x39')](_0x58e054[_0x56b1('0x42')],function(_0x401da5){var _0x3ee48e={};_0x3ee48e[_0x401da5]={'$like':'%'+_0x55420f[_0x56b1('0x3f')][_0x56b1('0x4e')]+'%'};return _0x3ee48e;})});}_0x58e054=_['merge']({},_0x58e054,_0x55420f[_0x56b1('0x50')]);return _0x595337[_0x56b1('0x6d')](_0x58e054);}})[_0x56b1('0x21')](function(_0x5e74c6){if(_0x5e74c6){_0x3e7e60=_0x5e74c6['length'];if(!_0x55420f['query'][_0x56b1('0x45')](_0x56b1('0x46'))){_0x58e054[_0x56b1('0x2e')]=qs[_0x56b1('0x2e')](_0x55420f[_0x56b1('0x3f')][_0x56b1('0x2e')]);_0x58e054[_0x56b1('0x47')]=qs[_0x56b1('0x47')](_0x55420f[_0x56b1('0x3f')][_0x56b1('0x47')]);}return _0x595337[_0x56b1('0x6d')](_0x58e054);}})[_0x56b1('0x21')](function(_0x4f8aa3){if(_0x4f8aa3){return _0x4f8aa3?{'count':_0x3e7e60,'rows':_0x4f8aa3}:null;}})[_0x56b1('0x21')](respondWithResult(_0x5616a5,null))[_0x56b1('0x29')](handleError(_0x5616a5,null));};exports['addTeams']=function(_0x534352,_0x4c942d,_0x3d30b9){var _0x327836=_0x534352[_0x56b1('0x59')][_0x56b1('0x6e')];return db[_0x56b1('0x6f')][_0x56b1('0x52')]({'where':{'id':_0x327836},'attributes':['id'],'include':[{'model':db[_0x56b1('0x70')],'as':_0x56b1('0x71'),'attributes':['id',_0x56b1('0x37'),_0x56b1('0x72'),_0x56b1('0x73'),_0x56b1('0x74')],'raw':!![]}]})[_0x56b1('0x21')](function(_0x14006d){if(_0x14006d){var _0x3e778f=_['flatMap'](_0x14006d,function(_0x2b4fe6){var _0x2d4b56=_0x2b4fe6[_0x56b1('0x32')]({'plain':!![]});return _0x2d4b56[_0x56b1('0x71')];});return db[_0x56b1('0x3a')][_0x56b1('0x57')]({'where':{'id':_0x534352[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](function(_0x431319){return db['sequelize']['transaction'](function(_0x9dac78){return _0x431319['addTeams'](_0x327836,{'transaction':_0x9dac78})['then'](function(){return BPromise[_0x56b1('0x75')](_0x3e778f,function(_0x53fb1e){return db['UserChatQueue'][_0x56b1('0x76')]({'where':{'UserId':_0x53fb1e['id'],'ChatQueueId':_0x534352[_0x56b1('0x54')]['id']},'transaction':_0x9dac78});});})[_0x56b1('0x21')](function(){_0x3e778f['forEach'](function(_0x46bcd0){socket[_0x56b1('0x77')](_0x56b1('0x78'),{'UserId':_0x46bcd0['id'],'ChatQueueId':_0x431319['id']});});});});});}})[_0x56b1('0x21')](respondWithStatusCode(_0x4c942d,null))[_0x56b1('0x29')](handleError(_0x4c942d,null));};exports['removeTeams']=function(_0x419173,_0x434d43,_0x582233){return db[_0x56b1('0x6f')][_0x56b1('0x52')]({'where':{'id':_0x419173[_0x56b1('0x3f')][_0x56b1('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x56b1('0x70')],'as':_0x56b1('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x434d43,null))['then'](function(_0x3a1cf2){var _0x359f2f=_[_0x56b1('0x39')](_0x3a1cf2,'id');var _0x2281af=[];var _0x4e236a=[];var _0x203cf5=squel['select']();_0x203cf5[_0x56b1('0x79')](_0x56b1('0x7a'))[_0x56b1('0x7b')](_0x56b1('0x7c'),'tq')['join']('user_has_teams','ut',_0x56b1('0x7d'))[_0x56b1('0x4a')](_0x56b1('0x7e'),_0x419173[_0x56b1('0x54')]['id']);for(var _0x5cd2d3=0x0;_0x5cd2d3<_0x3a1cf2[_0x56b1('0x44')];_0x5cd2d3+=0x1){let _0x67a612=_0x3a1cf2[_0x5cd2d3];for(var _0x56eb18=0x0;_0x56eb18<_0x67a612[_0x56b1('0x71')]['length'];_0x56eb18+=0x1){let _0x33ac34=_0x67a612[_0x56b1('0x71')][_0x56eb18];var _0x5556f8=_0x203cf5[_0x56b1('0x7f')]();_0x5556f8[_0x56b1('0x4a')](_0x56b1('0x80'),_0x33ac34['id']);_0x4e236a[_0x56b1('0x81')](db[_0x56b1('0x82')][_0x56b1('0x3f')](_0x5556f8[_0x56b1('0x83')](),{'type':db[_0x56b1('0x82')][_0x56b1('0x84')][_0x56b1('0x85')]})[_0x56b1('0x21')](function(_0x4a9de5){if(_0x4a9de5['length']===0x1){return _0x33ac34['id'];}else{var _0x158bcd=_[_0x56b1('0x86')](_[_0x56b1('0x39')](_0x4a9de5,_0x56b1('0x87')),function(_0x474adf){return _[_0x56b1('0x88')](_0x359f2f,_0x474adf);});if(_0x158bcd){return _0x33ac34['id'];}}}));}}return BPromise[_0x56b1('0x89')](_0x4e236a)[_0x56b1('0x21')](function(_0x16ba82){_0x2281af=_(_0x2281af)[_0x56b1('0x8a')](_0x16ba82)[_0x56b1('0x8b')]()[_0x56b1('0x8c')]();return db[_0x56b1('0x3a')][_0x56b1('0x57')]({'where':{'id':_0x419173[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](function(_0x5f2bb7){return db[_0x56b1('0x82')][_0x56b1('0x8d')](function(_0x36b913){return _0x5f2bb7[_0x56b1('0x8e')](_0x419173['query'][_0x56b1('0x6e')],{'transaction':_0x36b913})[_0x56b1('0x21')](function(){if(!_[_0x56b1('0x8f')](_0x2281af)){return _0x5f2bb7[_0x56b1('0x90')](_0x2281af,{'transaction':_0x36b913});}})['then'](function(){_0x2281af[_0x56b1('0x91')](function(_0x1322c9){socket[_0x56b1('0x77')](_0x56b1('0x92'),{'UserId':_0x1322c9,'ChatQueueId':_0x5f2bb7['id']});});});});});});})[_0x56b1('0x21')](respondWithStatusCode(_0x434d43,null))[_0x56b1('0x29')](handleError(_0x434d43,null));};exports[_0x56b1('0x93')]=function(_0x1bc5ec,_0x1cf24f,_0x8dac3c){return db[_0x56b1('0x3a')]['find']({'where':{'id':_0x1bc5ec[_0x56b1('0x54')]['id']}})['then'](handleEntityNotFound(_0x1cf24f,null))[_0x56b1('0x21')](function(_0x1b50fe){if(_0x1b50fe){return _0x1b50fe[_0x56b1('0x93')](_0x1bc5ec[_0x56b1('0x59')][_0x56b1('0x6e')],_[_0x56b1('0x94')](_0x1bc5ec['body'],[_0x56b1('0x6e'),'id'])||{})[_0x56b1('0x95')](function(_0x3d1ddc){for(var _0x3a2512=0x0;_0x3a2512<_0x1bc5ec[_0x56b1('0x59')][_0x56b1('0x6e')][_0x56b1('0x44')];_0x3a2512+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x1bc5ec[_0x56b1('0x59')]['ids'][_0x3a2512],'ChatQueueId':_0x1bc5ec[_0x56b1('0x54')]['id']});}return _0x3d1ddc;});}})[_0x56b1('0x21')](respondWithResult(_0x1cf24f,null))[_0x56b1('0x29')](handleError(_0x1cf24f,null));};exports['removeAgents']=function(_0x342bd8,_0x8f7bc0,_0x416f13){return db[_0x56b1('0x3a')]['find']({'where':{'id':_0x342bd8[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x8f7bc0,null))['then'](function(_0xc41c49){if(_0xc41c49){return _0xc41c49[_0x56b1('0x90')](_0x342bd8[_0x56b1('0x3f')][_0x56b1('0x6e')])[_0x56b1('0x21')](function(){if(_[_0x56b1('0x96')](_0x342bd8[_0x56b1('0x3f')]['ids'])){for(var _0x22c70d=0x0;_0x22c70d<_0x342bd8['query'][_0x56b1('0x6e')][_0x56b1('0x44')];_0x22c70d+=0x1){socket['emit'](_0x56b1('0x92'),{'UserId':Number(_0x342bd8[_0x56b1('0x3f')][_0x56b1('0x6e')][_0x22c70d]),'ChatQueueId':Number(_0x342bd8[_0x56b1('0x54')]['id'])});}}else{socket[_0x56b1('0x77')](_0x56b1('0x92'),{'UserId':Number(_0x342bd8['query'][_0x56b1('0x6e')]),'ChatQueueId':Number(_0x342bd8[_0x56b1('0x54')]['id'])});}});}})[_0x56b1('0x21')](respondWithStatusCode(_0x8f7bc0,null))[_0x56b1('0x29')](handleError(_0x8f7bc0,null));};exports[_0x56b1('0x97')]=function(_0x39ba45,_0x322c37,_0x3e46d5){var _0x112f28={};var _0x119e2b={};var _0x38ba99;var _0x52ad1f;return db[_0x56b1('0x3a')][_0x56b1('0x6c')]({'where':{'id':_0x39ba45[_0x56b1('0x54')]['id']}})[_0x56b1('0x21')](handleEntityNotFound(_0x322c37,null))['then'](function(_0x2f54b3){if(_0x2f54b3){_0x38ba99=_0x2f54b3;_0x119e2b['model']=_[_0x56b1('0x40')](db[_0x56b1('0x70')][_0x56b1('0x55')]);_0x119e2b['query']=_[_0x56b1('0x40')](_0x39ba45['query']);_0x119e2b['filters']=_[_0x56b1('0x41')](_0x119e2b['model'],_0x119e2b[_0x56b1('0x3f')]);_0x112f28['attributes']=_['intersection'](_0x119e2b[_0x56b1('0x3e')],qs[_0x56b1('0x43')](_0x39ba45['query'][_0x56b1('0x43')]));_0x112f28[_0x56b1('0x42')]=_0x112f28[_0x56b1('0x42')][_0x56b1('0x44')]?_0x112f28['attributes']:_0x119e2b['model'];_0x112f28['order']=qs['sort'](_0x39ba45[_0x56b1('0x3f')][_0x56b1('0x49')]);_0x112f28[_0x56b1('0x4a')]=qs[_0x56b1('0x4b')](_['pick'](_0x39ba45[_0x56b1('0x3f')],_0x119e2b['filters']));if(_0x39ba45[_0x56b1('0x3f')][_0x56b1('0x4e')]){_0x112f28[_0x56b1('0x4a')]=_['merge'](_0x112f28['where'],{'$or':_[_0x56b1('0x39')](_0x112f28['attributes'],function(_0x5b5add){var _0x3aeef8={};_0x3aeef8[_0x5b5add]={'$like':'%'+_0x39ba45[_0x56b1('0x3f')]['filter']+'%'};return _0x3aeef8;})});}_0x112f28=_[_0x56b1('0x4f')]({},_0x112f28,_0x39ba45['options']);return _0x38ba99[_0x56b1('0x97')](_0x112f28);}})['then'](function(_0xf10a36){if(_0xf10a36){_0x52ad1f=_0xf10a36[_0x56b1('0x44')];if(!_0x39ba45[_0x56b1('0x3f')][_0x56b1('0x45')](_0x56b1('0x46'))){_0x112f28['limit']=qs[_0x56b1('0x2e')](_0x39ba45[_0x56b1('0x3f')][_0x56b1('0x2e')]);_0x112f28[_0x56b1('0x47')]=qs[_0x56b1('0x47')](_0x39ba45[_0x56b1('0x3f')][_0x56b1('0x47')]);}return _0x38ba99[_0x56b1('0x97')](_0x112f28);}})['then'](function(_0x7cf477){if(_0x7cf477){return _0x7cf477?{'count':_0x52ad1f,'rows':_0x7cf477}:null;}})[_0x56b1('0x21')](respondWithResult(_0x322c37,null))[_0x56b1('0x29')](handleError(_0x322c37,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 585c569..7d0ff5c 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x31513f,_0x5b7b85){var _0x402935=function(_0x51da87){while(--_0x51da87){_0x31513f['push'](_0x31513f['shift']());}};_0x402935(++_0x5b7b85);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x0b0e[_0x2a276d];return _0x2914cd;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x9c0f21,_0x191219){var _0x439b7b=function(_0x12b4bc){while(--_0x12b4bc){_0x9c0f21['push'](_0x9c0f21['shift']());}};_0x439b7b(++_0x191219);}(_0xb10b,0x12a));var _0xbb10=function(_0x56edce,_0x3718d7){_0x56edce=_0x56edce-0x0;var _0x3ea2fe=_0xb10b[_0x56edce];return _0x3ea2fe;};'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 08e0fd5..cdb9567 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 _0x7fd3=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x7fd3,0x1ac));var _0x37fd=function(_0x490865,_0x4e31d1){_0x490865=_0x490865-0x0;var _0x3da536=_0x7fd3[_0x490865];return _0x3da536;};'use strict';var _=require('lodash');var util=require(_0x37fd('0x0'));var logger=require(_0x37fd('0x1'))('api');var moment=require(_0x37fd('0x2'));var BPromise=require(_0x37fd('0x3'));var rp=require(_0x37fd('0x4'));var fs=require('fs');var path=require(_0x37fd('0x5'));var rimraf=require(_0x37fd('0x6'));var config=require(_0x37fd('0x7'));var attributes=require(_0x37fd('0x8'));module['exports']=function(_0xe24473,_0x283852){return _0xe24473[_0x37fd('0x9')](_0x37fd('0xa'),attributes,{'tableName':_0x37fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fe1=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue'];(function(_0x2a7f0f,_0x2d5a3a){var _0x35274e=function(_0x648b2b){while(--_0x648b2b){_0x2a7f0f['push'](_0x2a7f0f['shift']());}};_0x35274e(++_0x2d5a3a);}(_0x6fe1,0x195));var _0x16fe=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x6fe1[_0x50a004];return _0x5e9992;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x16fe('0x0'))('api');var moment=require(_0x16fe('0x1'));var BPromise=require('bluebird');var rp=require(_0x16fe('0x2'));var fs=require('fs');var path=require(_0x16fe('0x3'));var rimraf=require(_0x16fe('0x4'));var config=require(_0x16fe('0x5'));var attributes=require(_0x16fe('0x6'));module['exports']=function(_0x13edeb,_0x6832ba){return _0x13edeb[_0x16fe('0x7')](_0x16fe('0x8'),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 f8008b1..6595c6a 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 _0x2d7b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ChatQueue','findAll','options','attributes','limit','include','model','GetChatQueue','stringify','catch','ShowChatQueue','find','raw','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23d97e,_0x1642b3){var _0x20afb1=function(_0x4a9353){while(--_0x4a9353){_0x23d97e['push'](_0x23d97e['shift']());}};_0x20afb1(++_0x1642b3);}(_0x2d7b,0x1ee));var _0xb2d7=function(_0x11deb5,_0x46b0f0){_0x11deb5=_0x11deb5-0x0;var _0x5ee90f=_0x2d7b[_0x11deb5];return _0x5ee90f;};'use strict';var _=require(_0xb2d7('0x0'));var util=require('util');var moment=require(_0xb2d7('0x1'));var BPromise=require(_0xb2d7('0x2'));var rs=require(_0xb2d7('0x3'));var fs=require('fs');var Redis=require(_0xb2d7('0x4'));var db=require(_0xb2d7('0x5'))['db'];var utils=require(_0xb2d7('0x6'));var logger=require(_0xb2d7('0x7'))(_0xb2d7('0x8'));var config=require(_0xb2d7('0x9'));var jayson=require(_0xb2d7('0xa'));var client=jayson[_0xb2d7('0xb')][_0xb2d7('0xc')]({'port':0x232a});config[_0xb2d7('0xd')]=_[_0xb2d7('0xe')](config['redis'],{'host':_0xb2d7('0xf'),'port':0x18eb});var socket=require(_0xb2d7('0x10'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x38b771,_0x1c2e14,_0x10d588){return new BPromise(function(_0x1e2b4c,_0x161c35){return client[_0xb2d7('0x11')](_0x38b771,_0x10d588)[_0xb2d7('0x12')](function(_0x526ba8){logger[_0xb2d7('0x13')](_0xb2d7('0x14'),_0x1c2e14,'request\x20sent');logger[_0xb2d7('0x15')](_0xb2d7('0x16'),_0x1c2e14,_0xb2d7('0x17'),JSON['stringify'](_0x526ba8));if(_0x526ba8[_0xb2d7('0x18')]){if(_0x526ba8[_0xb2d7('0x18')][_0xb2d7('0x19')]===0x1f4){logger[_0xb2d7('0x18')](_0xb2d7('0x14'),_0x1c2e14,_0x526ba8[_0xb2d7('0x18')][_0xb2d7('0x1a')]);return _0x161c35(_0x526ba8['error'][_0xb2d7('0x1a')]);}logger['error'](_0xb2d7('0x14'),_0x1c2e14,_0x526ba8[_0xb2d7('0x18')]['message']);return _0x1e2b4c(_0x526ba8[_0xb2d7('0x18')][_0xb2d7('0x1a')]);}else{logger[_0xb2d7('0x13')]('ChatQueue,\x20%s,\x20%s',_0x1c2e14,_0xb2d7('0x17'));_0x1e2b4c(_0x526ba8[_0xb2d7('0x1b')][_0xb2d7('0x1a')]);}})['catch'](function(_0x3d6e26){logger[_0xb2d7('0x18')](_0xb2d7('0x14'),_0x1c2e14,_0x3d6e26);_0x161c35(_0x3d6e26);});});}exports['GetChatQueue']=function(_0x4f36b0){var _0x19b62c=this;return new Promise(function(_0x46e407,_0x393162){return db[_0xb2d7('0x1c')][_0xb2d7('0x1d')]({'raw':_0x4f36b0[_0xb2d7('0x1e')]?_0x4f36b0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f36b0['options']?_0x4f36b0[_0xb2d7('0x1e')]['where']||null:null,'attributes':_0x4f36b0['options']?_0x4f36b0[_0xb2d7('0x1e')][_0xb2d7('0x1f')]||null:null,'limit':_0x4f36b0[_0xb2d7('0x1e')]?_0x4f36b0[_0xb2d7('0x1e')][_0xb2d7('0x20')]||null:null,'include':_0x4f36b0[_0xb2d7('0x1e')]?_0x4f36b0['options'][_0xb2d7('0x21')]?_['map'](_0x4f36b0[_0xb2d7('0x1e')]['include'],function(_0x3f1901){return{'model':db[_0x3f1901[_0xb2d7('0x22')]],'as':_0x3f1901['as'],'attributes':_0x3f1901['attributes'],'include':_0x3f1901[_0xb2d7('0x21')]?_['map'](_0x3f1901[_0xb2d7('0x21')],function(_0x554144){return{'model':db[_0x554144[_0xb2d7('0x22')]],'as':_0x554144['as'],'attributes':_0x554144[_0xb2d7('0x1f')],'include':_0x554144[_0xb2d7('0x21')]?_['map'](_0x554144[_0xb2d7('0x21')],function(_0x4edc53){return{'model':db[_0x4edc53[_0xb2d7('0x22')]],'as':_0x4edc53['as'],'attributes':_0x4edc53[_0xb2d7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb2d7('0x12')](function(_0x279a88){logger[_0xb2d7('0x13')](_0xb2d7('0x23'),_0x4f36b0);logger['debug'](_0xb2d7('0x23'),_0x4f36b0,JSON[_0xb2d7('0x24')](_0x279a88));_0x46e407(_0x279a88);})[_0xb2d7('0x25')](function(_0x1d698e){logger[_0xb2d7('0x18')]('GetChatQueue',_0x1d698e[_0xb2d7('0x1a')],_0x4f36b0);_0x393162(_0x19b62c[_0xb2d7('0x18')](0x1f4,_0x1d698e[_0xb2d7('0x1a')]));});});};exports[_0xb2d7('0x26')]=function(_0x2e5af1){var _0x42b7cb=this;return new Promise(function(_0x160029,_0x8d321d){return db[_0xb2d7('0x1c')][_0xb2d7('0x27')]({'raw':_0x2e5af1['options']?_0x2e5af1[_0xb2d7('0x1e')][_0xb2d7('0x28')]===undefined?!![]:![]:!![],'where':_0x2e5af1[_0xb2d7('0x1e')]?_0x2e5af1['options']['where']||null:null,'attributes':_0x2e5af1[_0xb2d7('0x1e')]?_0x2e5af1['options'][_0xb2d7('0x1f')]||null:null,'include':_0x2e5af1['options']?_0x2e5af1['options'][_0xb2d7('0x21')]?_['map'](_0x2e5af1['options'][_0xb2d7('0x21')],function(_0xd7616b){return{'model':db[_0xd7616b[_0xb2d7('0x22')]],'as':_0xd7616b['as'],'attributes':_0xd7616b[_0xb2d7('0x1f')],'include':_0xd7616b[_0xb2d7('0x21')]?_[_0xb2d7('0x29')](_0xd7616b['include'],function(_0xca1fe4){return{'model':db[_0xca1fe4[_0xb2d7('0x22')]],'as':_0xca1fe4['as'],'attributes':_0xca1fe4[_0xb2d7('0x1f')],'include':_0xca1fe4[_0xb2d7('0x21')]?_['map'](_0xca1fe4['include'],function(_0x3848aa){return{'model':db[_0x3848aa[_0xb2d7('0x22')]],'as':_0x3848aa['as'],'attributes':_0x3848aa[_0xb2d7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb2d7('0x12')](function(_0x257480){logger['info']('ShowChatQueue',_0x2e5af1);logger[_0xb2d7('0x15')]('ShowChatQueue',_0x2e5af1,JSON[_0xb2d7('0x24')](_0x257480));_0x160029(_0x257480);})['catch'](function(_0x399ea3){logger[_0xb2d7('0x18')]('ShowChatQueue',_0x399ea3['message'],_0x2e5af1);_0x8d321d(_0x42b7cb[_0xb2d7('0x18')](0x1f4,_0x399ea3[_0xb2d7('0x1a')]));});});}; \ No newline at end of file +var _0x87d9=['where','attributes','limit','include','map','model','then','catch','ShowChatQueue','ChatQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','options','raw'];(function(_0x437367,_0x1dbce4){var _0x439611=function(_0x350f82){while(--_0x350f82){_0x437367['push'](_0x437367['shift']());}};_0x439611(++_0x1dbce4);}(_0x87d9,0x143));var _0x987d=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x87d9[_0x1193ea];return _0x5e4000;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require(_0x987d('0x1'));var BPromise=require(_0x987d('0x2'));var rs=require(_0x987d('0x3'));var fs=require('fs');var Redis=require(_0x987d('0x4'));var db=require(_0x987d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x987d('0x6'))('rpc');var config=require(_0x987d('0x7'));var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});config[_0x987d('0xa')]=_['defaults'](config[_0x987d('0xa')],{'host':_0x987d('0xb'),'port':0x18eb});var socket=require(_0x987d('0xc'))(new Redis(config[_0x987d('0xa')]));require(_0x987d('0xd'))[_0x987d('0xe')](socket);function respondWithRpcPromise(_0x3ec400,_0x5ccede,_0x247a8f){return new BPromise(function(_0x42c96d,_0x10f8be){return client[_0x987d('0xf')](_0x3ec400,_0x247a8f)['then'](function(_0x19d62d){logger[_0x987d('0x10')](_0x987d('0x11'),_0x5ccede,_0x987d('0x12'));logger[_0x987d('0x13')](_0x987d('0x14'),_0x5ccede,_0x987d('0x12'),JSON[_0x987d('0x15')](_0x19d62d));if(_0x19d62d[_0x987d('0x16')]){if(_0x19d62d['error']['code']===0x1f4){logger[_0x987d('0x16')](_0x987d('0x11'),_0x5ccede,_0x19d62d[_0x987d('0x16')][_0x987d('0x17')]);return _0x10f8be(_0x19d62d[_0x987d('0x16')][_0x987d('0x17')]);}logger[_0x987d('0x16')](_0x987d('0x11'),_0x5ccede,_0x19d62d[_0x987d('0x16')][_0x987d('0x17')]);return _0x42c96d(_0x19d62d[_0x987d('0x16')][_0x987d('0x17')]);}else{logger[_0x987d('0x10')](_0x987d('0x11'),_0x5ccede,'request\x20sent');_0x42c96d(_0x19d62d[_0x987d('0x18')][_0x987d('0x17')]);}})['catch'](function(_0x54e242){logger[_0x987d('0x16')](_0x987d('0x11'),_0x5ccede,_0x54e242);_0x10f8be(_0x54e242);});});}exports[_0x987d('0x19')]=function(_0x302064){var _0x57b9db=this;return new Promise(function(_0x4414b7,_0x129763){return db['ChatQueue']['findAll']({'raw':_0x302064[_0x987d('0x1a')]?_0x302064[_0x987d('0x1a')][_0x987d('0x1b')]===undefined?!![]:![]:!![],'where':_0x302064[_0x987d('0x1a')]?_0x302064['options'][_0x987d('0x1c')]||null:null,'attributes':_0x302064[_0x987d('0x1a')]?_0x302064[_0x987d('0x1a')][_0x987d('0x1d')]||null:null,'limit':_0x302064[_0x987d('0x1a')]?_0x302064[_0x987d('0x1a')][_0x987d('0x1e')]||null:null,'include':_0x302064[_0x987d('0x1a')]?_0x302064['options'][_0x987d('0x1f')]?_[_0x987d('0x20')](_0x302064[_0x987d('0x1a')][_0x987d('0x1f')],function(_0x48a478){return{'model':db[_0x48a478[_0x987d('0x21')]],'as':_0x48a478['as'],'attributes':_0x48a478[_0x987d('0x1d')],'include':_0x48a478['include']?_[_0x987d('0x20')](_0x48a478[_0x987d('0x1f')],function(_0x2a5a5b){return{'model':db[_0x2a5a5b[_0x987d('0x21')]],'as':_0x2a5a5b['as'],'attributes':_0x2a5a5b['attributes'],'include':_0x2a5a5b[_0x987d('0x1f')]?_['map'](_0x2a5a5b['include'],function(_0x19338c){return{'model':db[_0x19338c[_0x987d('0x21')]],'as':_0x19338c['as'],'attributes':_0x19338c[_0x987d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x987d('0x22')](function(_0x4ffa12){logger[_0x987d('0x10')](_0x987d('0x19'),_0x302064);logger[_0x987d('0x13')](_0x987d('0x19'),_0x302064,JSON[_0x987d('0x15')](_0x4ffa12));_0x4414b7(_0x4ffa12);})[_0x987d('0x23')](function(_0x2f831d){logger['error'](_0x987d('0x19'),_0x2f831d[_0x987d('0x17')],_0x302064);_0x129763(_0x57b9db[_0x987d('0x16')](0x1f4,_0x2f831d[_0x987d('0x17')]));});});};exports[_0x987d('0x24')]=function(_0x2f3bec){var _0x301d20=this;return new Promise(function(_0x20df9d,_0x2d5ba2){return db[_0x987d('0x25')][_0x987d('0x26')]({'raw':_0x2f3bec[_0x987d('0x1a')]?_0x2f3bec[_0x987d('0x1a')][_0x987d('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f3bec[_0x987d('0x1a')]?_0x2f3bec[_0x987d('0x1a')]['where']||null:null,'attributes':_0x2f3bec[_0x987d('0x1a')]?_0x2f3bec[_0x987d('0x1a')][_0x987d('0x1d')]||null:null,'include':_0x2f3bec[_0x987d('0x1a')]?_0x2f3bec['options'][_0x987d('0x1f')]?_['map'](_0x2f3bec[_0x987d('0x1a')][_0x987d('0x1f')],function(_0x2ba9f9){return{'model':db[_0x2ba9f9['model']],'as':_0x2ba9f9['as'],'attributes':_0x2ba9f9['attributes'],'include':_0x2ba9f9['include']?_[_0x987d('0x20')](_0x2ba9f9[_0x987d('0x1f')],function(_0x2f17e7){return{'model':db[_0x2f17e7[_0x987d('0x21')]],'as':_0x2f17e7['as'],'attributes':_0x2f17e7[_0x987d('0x1d')],'include':_0x2f17e7['include']?_['map'](_0x2f17e7[_0x987d('0x1f')],function(_0x181f62){return{'model':db[_0x181f62[_0x987d('0x21')]],'as':_0x181f62['as'],'attributes':_0x181f62[_0x987d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x987d('0x22')](function(_0x23cacb){logger['info'](_0x987d('0x24'),_0x2f3bec);logger[_0x987d('0x13')](_0x987d('0x24'),_0x2f3bec,JSON[_0x987d('0x15')](_0x23cacb));_0x20df9d(_0x23cacb);})[_0x987d('0x23')](function(_0x18b07b){logger[_0x987d('0x16')](_0x987d('0x24'),_0x18b07b[_0x987d('0x17')],_0x2f3bec);_0x2d5ba2(_0x301d20['error'](0x1f4,_0x18b07b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 44581d9..b26026e 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x54e950,_0x2e669a){var _0x26e41=function(_0x3bb716){while(--_0x3bb716){_0x54e950['push'](_0x54e950['shift']());}};_0x26e41(++_0x2e669a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2f3b14,_0x554f94){_0x2f3b14=_0x2f3b14-0x0;var _0x20e924=_0x0b0e[_0x2f3b14];return _0x20e924;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x259989,_0x3d1f40){var _0x428e41=function(_0x223e59){while(--_0x223e59){_0x259989['push'](_0x259989['shift']());}};_0x428e41(++_0x3d1f40);}(_0xadb5,0xad));var _0x5adb=function(_0x173541,_0x25cbe1){_0x173541=_0x173541-0x0;var _0x29bc7c=_0xadb5[_0x173541];return _0x29bc7c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 88d380b..e9d972b 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 _0x3bc0=['post','create','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x2a664e,_0x3fbd13){var _0x188f83=function(_0x45620a){while(--_0x45620a){_0x2a664e['push'](_0x2a664e['shift']());}};_0x188f83(++_0x3fbd13);}(_0x3bc0,0x183));var _0x03bc=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x3bc0[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0x03bc('0x0'));var util=require(_0x03bc('0x1'));var path=require(_0x03bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x03bc('0x3'));var router=express[_0x03bc('0x4')]();var auth=require(_0x03bc('0x5'));var interaction=require(_0x03bc('0x6'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x03bc('0x7')]('/',auth[_0x03bc('0x8')](),controller[_0x03bc('0x9')]);router[_0x03bc('0x7')]('/describe',auth[_0x03bc('0x8')](),controller[_0x03bc('0xa')]);router[_0x03bc('0x7')](_0x03bc('0xb'),auth[_0x03bc('0x8')](),controller[_0x03bc('0xc')]);router[_0x03bc('0x7')]('/:id/members',auth[_0x03bc('0x8')](),controller[_0x03bc('0xd')]);router['get'](_0x03bc('0xe'),auth[_0x03bc('0x8')](),controller[_0x03bc('0xf')]);router[_0x03bc('0x7')](_0x03bc('0x10'),auth[_0x03bc('0x8')](),controller[_0x03bc('0x11')]);router[_0x03bc('0x12')]('/',auth[_0x03bc('0x8')](),controller[_0x03bc('0x13')]);router[_0x03bc('0x12')](_0x03bc('0xe'),auth[_0x03bc('0x8')](),controller[_0x03bc('0x14')]);router[_0x03bc('0x12')](_0x03bc('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x03bc('0x15')](_0x03bc('0xb'),auth[_0x03bc('0x8')](),controller[_0x03bc('0x16')]);router[_0x03bc('0x17')](_0x03bc('0xb'),auth['isAuthenticated'](),controller[_0x03bc('0x18')]);router[_0x03bc('0x17')](_0x03bc('0xe'),auth[_0x03bc('0x8')](),controller[_0x03bc('0x19')]);router[_0x03bc('0x17')](_0x03bc('0x10'),auth[_0x03bc('0x8')](),controller['removeAgents']);module[_0x03bc('0x1a')]=router; \ No newline at end of file +var _0xdd5c=['delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./chatQueue.controller','get','/describe','describe','/:id','show','/:id/members','isAuthenticated','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update'];(function(_0x24c2c9,_0x4d16d7){var _0x26273a=function(_0x4e9d15){while(--_0x4e9d15){_0x24c2c9['push'](_0x24c2c9['shift']());}};_0x26273a(++_0x4d16d7);}(_0xdd5c,0xd7));var _0xcdd5=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xdd5c[_0x215e65];return _0xa85842;};'use strict';var multer=require(_0xcdd5('0x0'));var util=require('util');var path=require(_0xcdd5('0x1'));var timeout=require(_0xcdd5('0x2'));var express=require(_0xcdd5('0x3'));var router=express[_0xcdd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcdd5('0x5'));var config=require('../../config/environment');var controller=require(_0xcdd5('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcdd5('0x7')](_0xcdd5('0x8'),auth['isAuthenticated'](),controller[_0xcdd5('0x9')]);router[_0xcdd5('0x7')](_0xcdd5('0xa'),auth['isAuthenticated'](),controller[_0xcdd5('0xb')]);router[_0xcdd5('0x7')](_0xcdd5('0xc'),auth[_0xcdd5('0xd')](),controller[_0xcdd5('0xe')]);router[_0xcdd5('0x7')]('/:id/teams',auth[_0xcdd5('0xd')](),controller[_0xcdd5('0xf')]);router[_0xcdd5('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xcdd5('0x10')]);router[_0xcdd5('0x11')]('/',auth['isAuthenticated'](),controller[_0xcdd5('0x12')]);router[_0xcdd5('0x11')](_0xcdd5('0x13'),auth[_0xcdd5('0xd')](),controller[_0xcdd5('0x14')]);router['post'](_0xcdd5('0x15'),auth['isAuthenticated'](),controller[_0xcdd5('0x16')]);router[_0xcdd5('0x17')](_0xcdd5('0xa'),auth['isAuthenticated'](),controller[_0xcdd5('0x18')]);router[_0xcdd5('0x19')](_0xcdd5('0xa'),auth[_0xcdd5('0xd')](),controller[_0xcdd5('0x1a')]);router[_0xcdd5('0x19')]('/:id/teams',auth[_0xcdd5('0xd')](),controller[_0xcdd5('0x1b')]);router['delete'](_0xcdd5('0x15'),auth['isAuthenticated'](),controller[_0xcdd5('0x1c')]);module[_0xcdd5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 8deedf3..12c12c0 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 _0x9290=['exports','STRING','DATE','sequelize'];(function(_0x1e1bb5,_0x23b4e9){var _0x413b4c=function(_0x1483c1){while(--_0x1483c1){_0x1e1bb5['push'](_0x1e1bb5['shift']());}};_0x413b4c(++_0x23b4e9);}(_0x9290,0xdb));var _0x0929=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0x9290[_0x47f4c2];return _0x22c63e;};'use strict';var moment=require('moment');var Sequelize=require(_0x0929('0x0'));module[_0x0929('0x1')]={'uniqueid':{'type':Sequelize[_0x0929('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0929('0x2')]},'joinAt':{'type':Sequelize[_0x0929('0x3')]},'leaveAt':{'type':Sequelize[_0x0929('0x3')]},'acceptAt':{'type':Sequelize[_0x0929('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca04=['DATE','sequelize','STRING'];(function(_0x56da29,_0x40b31e){var _0x55beb9=function(_0x4bea2e){while(--_0x4bea2e){_0x56da29['push'](_0x56da29['shift']());}};_0x55beb9(++_0x40b31e);}(_0xca04,0x115));var _0x4ca0=function(_0x39b18d,_0x5220ab){_0x39b18d=_0x39b18d-0x0;var _0x3af684=_0xca04[_0x39b18d];return _0x3af684;};'use strict';var moment=require('moment');var Sequelize=require(_0x4ca0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ca0('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4ca0('0x1')]},'joinAt':{'type':Sequelize[_0x4ca0('0x2')]},'leaveAt':{'type':Sequelize[_0x4ca0('0x2')]},'acceptAt':{'type':Sequelize[_0x4ca0('0x2')]},'exitAt':{'type':Sequelize[_0x4ca0('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3858998..9c3caa5 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 _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','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','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x175ac7,_0x5e8d45){var _0x125dec=function(_0x1e65d2){while(--_0x1e65d2){_0x175ac7['push'](_0x175ac7['shift']());}};_0x125dec(++_0x5e8d45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['ChatQueueReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file +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(_0x1010b0,_0x4c68be){var _0x579dbd=function(_0x3b3b05){while(--_0x3b3b05){_0x1010b0['push'](_0x1010b0['shift']());}};_0x579dbd(++_0x4c68be);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xcb91[_0x2984d0];return _0x2885f2;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9cd3975..71211f2 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 _0x7ada=['ChatQueueReport','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43dffc,_0x3f2378){var _0x4165ae=function(_0x319448){while(--_0x319448){_0x43dffc['push'](_0x43dffc['shift']());}};_0x4165ae(++_0x3f2378);}(_0x7ada,0x19a));var _0xa7ad=function(_0xec8e1b,_0x5076a5){_0xec8e1b=_0xec8e1b-0x0;var _0x4de93d=_0x7ada[_0xec8e1b];return _0x4de93d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa7ad('0x0'))(_0xa7ad('0x1'));var moment=require(_0xa7ad('0x2'));var BPromise=require(_0xa7ad('0x3'));var rp=require(_0xa7ad('0x4'));var fs=require('fs');var path=require(_0xa7ad('0x5'));var rimraf=require(_0xa7ad('0x6'));var config=require(_0xa7ad('0x7'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x19810f,_0x240238){return _0x19810f['define'](_0xa7ad('0x8'),attributes,{'tableName':_0xa7ad('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa7ad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50f0=['define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x2e0bfd,_0x27e787){var _0x202119=function(_0x5bc1f2){while(--_0x5bc1f2){_0x2e0bfd['push'](_0x2e0bfd['shift']());}};_0x202119(++_0x27e787);}(_0x50f0,0xc4));var _0x050f=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0x50f0[_0x1a0c59];return _0xed67c9;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var logger=require(_0x050f('0x2'))(_0x050f('0x3'));var moment=require(_0x050f('0x4'));var BPromise=require(_0x050f('0x5'));var rp=require(_0x050f('0x6'));var fs=require('fs');var path=require(_0x050f('0x7'));var rimraf=require(_0x050f('0x8'));var config=require(_0x050f('0x9'));var attributes=require(_0x050f('0xa'));module[_0x050f('0xb')]=function(_0x52aede,_0x3c8eb3){return _0x52aede[_0x050f('0xc')](_0x050f('0xd'),attributes,{'tableName':_0x050f('0xe'),'paranoid':![],'indexes':[{'name':_0x050f('0xf'),'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 d356b9b..4581994 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 _0xba9c=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','where','attributes','limit'];(function(_0x3e320d,_0x486482){var _0x4ca26a=function(_0x281da4){while(--_0x281da4){_0x3e320d['push'](_0x3e320d['shift']());}};_0x4ca26a(++_0x486482);}(_0xba9c,0x174));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcba9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcba9('0x1'));var rs=require(_0xcba9('0x2'));var fs=require('fs');var Redis=require(_0xcba9('0x3'));var db=require(_0xcba9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba9('0x5'))(_0xcba9('0x6'));var config=require(_0xcba9('0x7'));var jayson=require(_0xcba9('0x8'));var client=jayson[_0xcba9('0x9')][_0xcba9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46da49,_0xb8173b,_0x297690){return new BPromise(function(_0x4d942b,_0xca47){return client['request'](_0x46da49,_0x297690)['then'](function(_0x41d30a){logger[_0xcba9('0xb')](_0xcba9('0xc'),_0xb8173b,_0xcba9('0xd'));logger[_0xcba9('0xe')](_0xcba9('0xf'),_0xb8173b,'request\x20sent',JSON[_0xcba9('0x10')](_0x41d30a));if(_0x41d30a[_0xcba9('0x11')]){if(_0x41d30a['error']['code']===0x1f4){logger[_0xcba9('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0xb8173b,_0x41d30a[_0xcba9('0x11')]['message']);return _0xca47(_0x41d30a['error'][_0xcba9('0x12')]);}logger[_0xcba9('0x11')](_0xcba9('0xc'),_0xb8173b,_0x41d30a[_0xcba9('0x11')][_0xcba9('0x12')]);return _0x4d942b(_0x41d30a['error'][_0xcba9('0x12')]);}else{logger[_0xcba9('0xb')](_0xcba9('0xc'),_0xb8173b,_0xcba9('0xd'));_0x4d942b(_0x41d30a['result'][_0xcba9('0x12')]);}})[_0xcba9('0x13')](function(_0x39897d){logger[_0xcba9('0x11')](_0xcba9('0xc'),_0xb8173b,_0x39897d);_0xca47(_0x39897d);});});}exports[_0xcba9('0x14')]=function(_0x39a63f){var _0xc4d1ae=this;return new Promise(function(_0x118b5b,_0x99ae72){return db[_0xcba9('0x15')][_0xcba9('0x16')](_0x39a63f[_0xcba9('0x17')],{'raw':_0x39a63f[_0xcba9('0x18')]?_0x39a63f[_0xcba9('0x18')][_0xcba9('0x19')]===undefined?!![]:![]:!![]})[_0xcba9('0x1a')](function(_0x2ac963){logger['info'](_0xcba9('0x14'),_0x39a63f);logger[_0xcba9('0xe')]('CreateChatQueueReport',_0x39a63f,JSON[_0xcba9('0x10')](_0x2ac963));_0x118b5b(_0x2ac963);})[_0xcba9('0x13')](function(_0x408b09){logger[_0xcba9('0x11')](_0xcba9('0x14'),_0x408b09[_0xcba9('0x12')],_0x39a63f);_0x99ae72(_0xc4d1ae[_0xcba9('0x11')](0x1f4,_0x408b09[_0xcba9('0x12')]));});});};exports[_0xcba9('0x1b')]=function(_0x18e703){var _0x1cf1d9=this;return new Promise(function(_0x26145f,_0x23bd9a){return db[_0xcba9('0x15')]['update'](_0x18e703['body'],{'raw':_0x18e703[_0xcba9('0x18')]?_0x18e703['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18e703[_0xcba9('0x18')]?_0x18e703[_0xcba9('0x18')][_0xcba9('0x1c')]||null:null,'attributes':_0x18e703['options']?_0x18e703[_0xcba9('0x18')][_0xcba9('0x1d')]||null:null,'limit':_0x18e703[_0xcba9('0x18')]?_0x18e703[_0xcba9('0x18')][_0xcba9('0x1e')]||null:null})[_0xcba9('0x1a')](function(_0x1f9211){logger['info'](_0xcba9('0x1b'),_0x18e703);logger[_0xcba9('0xe')](_0xcba9('0x1b'),_0x18e703,JSON[_0xcba9('0x10')](_0x1f9211));_0x26145f(_0x1f9211);})['catch'](function(_0x3a9223){logger[_0xcba9('0x11')](_0xcba9('0x1b'),_0x3a9223[_0xcba9('0x12')],_0x18e703);_0x23bd9a(_0x1cf1d9[_0xcba9('0x11')](0x1f4,_0x3a9223['message']));});});}; \ No newline at end of file +var _0xdaf6=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x146ecc,_0x36ce85){var _0xbe071e=function(_0x554993){while(--_0x554993){_0x146ecc['push'](_0x146ecc['shift']());}};_0xbe071e(++_0x36ce85);}(_0xdaf6,0x96));var _0x6daf=function(_0x49f19e,_0x1c3aa3){_0x49f19e=_0x49f19e-0x0;var _0x280b5a=_0xdaf6[_0x49f19e];return _0x280b5a;};'use strict';var _=require(_0x6daf('0x0'));var util=require(_0x6daf('0x1'));var moment=require(_0x6daf('0x2'));var BPromise=require(_0x6daf('0x3'));var rs=require(_0x6daf('0x4'));var fs=require('fs');var Redis=require(_0x6daf('0x5'));var db=require(_0x6daf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6daf('0x7'));var config=require(_0x6daf('0x8'));var jayson=require(_0x6daf('0x9'));var client=jayson[_0x6daf('0xa')][_0x6daf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3647d0,_0x5808a8,_0x1f2252){return new BPromise(function(_0x415cc7,_0x2d0dc8){return client[_0x6daf('0xc')](_0x3647d0,_0x1f2252)[_0x6daf('0xd')](function(_0x4863da){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5808a8,'request\x20sent');logger[_0x6daf('0xe')](_0x6daf('0xf'),_0x5808a8,'request\x20sent',JSON[_0x6daf('0x10')](_0x4863da));if(_0x4863da[_0x6daf('0x11')]){if(_0x4863da[_0x6daf('0x11')]['code']===0x1f4){logger[_0x6daf('0x11')](_0x6daf('0x12'),_0x5808a8,_0x4863da[_0x6daf('0x11')][_0x6daf('0x13')]);return _0x2d0dc8(_0x4863da['error'][_0x6daf('0x13')]);}logger['error'](_0x6daf('0x12'),_0x5808a8,_0x4863da[_0x6daf('0x11')][_0x6daf('0x13')]);return _0x415cc7(_0x4863da['error'][_0x6daf('0x13')]);}else{logger[_0x6daf('0x14')](_0x6daf('0x12'),_0x5808a8,_0x6daf('0x15'));_0x415cc7(_0x4863da[_0x6daf('0x16')][_0x6daf('0x13')]);}})[_0x6daf('0x17')](function(_0x3b136b){logger[_0x6daf('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5808a8,_0x3b136b);_0x2d0dc8(_0x3b136b);});});}exports[_0x6daf('0x18')]=function(_0x4c2cc2){var _0xd7881e=this;return new Promise(function(_0x317dac,_0x44ae57){return db[_0x6daf('0x19')][_0x6daf('0x1a')](_0x4c2cc2[_0x6daf('0x1b')],{'raw':_0x4c2cc2[_0x6daf('0x1c')]?_0x4c2cc2[_0x6daf('0x1c')][_0x6daf('0x1d')]===undefined?!![]:![]:!![]})[_0x6daf('0xd')](function(_0xe15815){logger[_0x6daf('0x14')](_0x6daf('0x18'),_0x4c2cc2);logger[_0x6daf('0xe')](_0x6daf('0x18'),_0x4c2cc2,JSON['stringify'](_0xe15815));_0x317dac(_0xe15815);})[_0x6daf('0x17')](function(_0x221986){logger[_0x6daf('0x11')](_0x6daf('0x18'),_0x221986['message'],_0x4c2cc2);_0x44ae57(_0xd7881e[_0x6daf('0x11')](0x1f4,_0x221986[_0x6daf('0x13')]));});});};exports[_0x6daf('0x1e')]=function(_0x5af147){var _0x4b1111=this;return new Promise(function(_0x520d8e,_0x2a961d){return db[_0x6daf('0x19')][_0x6daf('0x1f')](_0x5af147['body'],{'raw':_0x5af147[_0x6daf('0x1c')]?_0x5af147[_0x6daf('0x1c')][_0x6daf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af147[_0x6daf('0x1c')]?_0x5af147['options'][_0x6daf('0x20')]||null:null,'attributes':_0x5af147['options']?_0x5af147[_0x6daf('0x1c')]['attributes']||null:null,'limit':_0x5af147[_0x6daf('0x1c')]?_0x5af147[_0x6daf('0x1c')]['limit']||null:null})[_0x6daf('0xd')](function(_0x171e91){logger['info'](_0x6daf('0x1e'),_0x5af147);logger[_0x6daf('0xe')](_0x6daf('0x1e'),_0x5af147,JSON[_0x6daf('0x10')](_0x171e91));_0x520d8e(_0x171e91);})['catch'](function(_0x4cb5a1){logger[_0x6daf('0x11')](_0x6daf('0x1e'),_0x4cb5a1['message'],_0x5af147);_0x2a961d(_0x4b1111[_0x6daf('0x11')](0x1f4,_0x4cb5a1[_0x6daf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1c7c2de..7e18395 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 _0xf48d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xf48d,0x80));var _0xdf48=function(_0x1a50e5,_0x14accb){_0x1a50e5=_0x1a50e5-0x0;var _0x53b463=_0xf48d[_0x1a50e5];return _0x53b463;};'use strict';var multer=require(_0xdf48('0x0'));var util=require(_0xdf48('0x1'));var path=require(_0xdf48('0x2'));var timeout=require(_0xdf48('0x3'));var express=require('express');var router=express[_0xdf48('0x4')]();var auth=require(_0xdf48('0x5'));var interaction=require(_0xdf48('0x6'));var config=require(_0xdf48('0x7'));var controller=require(_0xdf48('0x8'));router[_0xdf48('0x9')]('/',auth[_0xdf48('0xa')](),controller[_0xdf48('0xb')]);router[_0xdf48('0x9')](_0xdf48('0xc'),auth['isAuthenticated'](),controller[_0xdf48('0xd')]);router[_0xdf48('0x9')](_0xdf48('0xe'),auth[_0xdf48('0xa')](),controller[_0xdf48('0xf')]);router[_0xdf48('0x10')]('/',auth[_0xdf48('0xa')](),controller[_0xdf48('0x11')]);router[_0xdf48('0x12')](_0xdf48('0xe'),auth['isAuthenticated'](),controller[_0xdf48('0x13')]);router[_0xdf48('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdf48('0x15')]);module['exports']=router; \ No newline at end of file +var _0x76ab=['update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x538536,_0x586688){var _0x225fd5=function(_0x357f6c){while(--_0x357f6c){_0x538536['push'](_0x538536['shift']());}};_0x225fd5(++_0x586688);}(_0x76ab,0x1d0));var _0xb76a=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x76ab[_0x71e493];return _0x3d40ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb76a('0x0'));var timeout=require(_0xb76a('0x1'));var express=require(_0xb76a('0x2'));var router=express[_0xb76a('0x3')]();var auth=require(_0xb76a('0x4'));var interaction=require(_0xb76a('0x5'));var config=require(_0xb76a('0x6'));var controller=require(_0xb76a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb76a('0x8')]);router[_0xb76a('0x9')](_0xb76a('0xa'),auth[_0xb76a('0xb')](),controller['describe']);router['get'](_0xb76a('0xc'),auth['isAuthenticated'](),controller[_0xb76a('0xd')]);router['post']('/',auth[_0xb76a('0xb')](),controller[_0xb76a('0xe')]);router[_0xb76a('0xf')](_0xb76a('0xc'),auth[_0xb76a('0xb')](),controller[_0xb76a('0x10')]);router[_0xb76a('0x11')](_0xb76a('0xc'),auth[_0xb76a('0xb')](),controller[_0xb76a('0x12')]);module[_0xb76a('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 c7cd5cd..dc64c80 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 _0x9a3a=['sequelize','STRING','ENUM','account','agent','NOW','moment'];(function(_0x11df9d,_0x151a80){var _0x88c9=function(_0x327cec){while(--_0x327cec){_0x11df9d['push'](_0x11df9d['shift']());}};_0x88c9(++_0x151a80);}(_0x9a3a,0x179));var _0xa9a3=function(_0x409b63,_0x1b25a6){_0x409b63=_0x409b63-0x0;var _0x157adc=_0x9a3a[_0x409b63];return _0x157adc;};'use strict';var moment=require(_0xa9a3('0x0'));var Sequelize=require(_0xa9a3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa9a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa9a3('0x3')](_0xa9a3('0x4'),_0xa9a3('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa9a3('0x6')]}}; \ No newline at end of file +var _0xd17c=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xd17c,0x87));var _0xcd17=function(_0x2f0bc9,_0x5af49e){_0x2f0bc9=_0x2f0bc9-0x0;var _0x20c5fc=_0xd17c[_0x2f0bc9];return _0x20c5fc;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd17('0x0'));module[_0xcd17('0x1')]={'uniqueid':{'type':Sequelize[_0xcd17('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcd17('0x3')](_0xcd17('0x4'),_0xcd17('0x5'),_0xcd17('0x6')),'allowNull':![],'defaultValue':_0xcd17('0x6')},'transferredAt':{'type':Sequelize[_0xcd17('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xcd17('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5a21560..882e960 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 _0x5233=['send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name'];(function(_0x597b14,_0x4eadc8){var _0x32dd31=function(_0x388ba3){while(--_0x388ba3){_0x597b14['push'](_0x597b14['shift']());}};_0x32dd31(++_0x4eadc8);}(_0x5233,0x72));var _0x3523=function(_0xb24175,_0x540856){_0xb24175=_0xb24175-0x0;var _0x554f0d=_0x5233[_0xb24175];return _0x554f0d;};'use strict';var pdf=require(_0x3523('0x0'));var emlformat=require(_0x3523('0x1'));var rimraf=require(_0x3523('0x2'));var zipdir=require(_0x3523('0x3'));var jsonpatch=require(_0x3523('0x4'));var rp=require(_0x3523('0x5'));var moment=require(_0x3523('0x6'));var BPromise=require(_0x3523('0x7'));var Mustache=require('mustache');var util=require(_0x3523('0x8'));var path=require(_0x3523('0x9'));var sox=require(_0x3523('0xa'));var csv=require(_0x3523('0xb'));var ejs=require(_0x3523('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3523('0xd'));var jsforce=require(_0x3523('0xe'));var deskjs=require(_0x3523('0xf'));var toCsv=require(_0x3523('0xb'));var querystring=require(_0x3523('0x10'));var Papa=require(_0x3523('0x11'));var Redis=require(_0x3523('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3523('0x13'));var as=require(_0x3523('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3523('0x15'))(_0x3523('0x16'));var utils=require(_0x3523('0x17'));var config=require(_0x3523('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3031bb,_0x46487c){_0x46487c=_0x46487c||0xcc;return function(_0x2ea40e){if(_0x2ea40e){return _0x3031bb['sendStatus'](_0x46487c);}return _0x3031bb[_0x3523('0x19')](_0x46487c)[_0x3523('0x1a')]();};}function respondWithResult(_0x467e52,_0x331778){_0x331778=_0x331778||0xc8;return function(_0x11de83){if(_0x11de83){return _0x467e52[_0x3523('0x19')](_0x331778)['json'](_0x11de83);}};}function respondWithFilteredResult(_0x15207a,_0x21a93c){return function(_0x3feda1){if(_0x3feda1){var _0x183b0e=_0x3feda1['count'],_0x51c1cd=_0x21a93c[_0x3523('0x1b')],_0x4dcd2a=_0x21a93c['offset']+_0x21a93c[_0x3523('0x1c')],_0x598ccb;if(_0x4dcd2a>=_0x183b0e){_0x4dcd2a=_0x183b0e;_0x598ccb=0xc8;}else{_0x598ccb=0xce;}_0x15207a[_0x3523('0x19')](_0x598ccb);return _0x15207a['set'](_0x3523('0x1d'),_0x51c1cd+'-'+_0x4dcd2a+'/'+_0x183b0e)[_0x3523('0x1e')](_0x3feda1);}return null;};}function patchUpdates(_0x40111f){return function(_0x11623a){try{jsonpatch[_0x3523('0x1f')](_0x11623a,_0x40111f,!![]);}catch(_0x39e991){return BPromise[_0x3523('0x20')](_0x39e991);}return _0x11623a[_0x3523('0x21')]();};}function saveUpdates(_0x3dee42,_0x4ea18a){return function(_0x192ffc){if(_0x192ffc){return _0x192ffc[_0x3523('0x22')](_0x3dee42)[_0x3523('0x23')](function(_0x5f2d1b){return _0x5f2d1b;});}return null;};}function removeEntity(_0x55478d,_0x285b78){return function(_0x42eb18){if(_0x42eb18){return _0x42eb18['destroy']()['then'](function(){_0x55478d[_0x3523('0x19')](0xcc)[_0x3523('0x1a')]();});}};}function handleEntityNotFound(_0x51552c,_0x4c5a2a){return function(_0x11c672){if(!_0x11c672){_0x51552c[_0x3523('0x24')](0x194);}return _0x11c672;};}function handleError(_0xea2f08,_0x3b9364){_0x3b9364=_0x3b9364||0x1f4;return function(_0x342233){logger[_0x3523('0x25')](_0x342233[_0x3523('0x26')]);if(_0x342233[_0x3523('0x27')]){delete _0x342233['name'];}_0xea2f08['status'](_0x3b9364)[_0x3523('0x28')](_0x342233);};}exports[_0x3523('0x29')]=function(_0x5046a7,_0x2580dd){var _0x4a69c8={},_0x127aa0={},_0x484bbf={'count':0x0,'rows':[]};var _0x5164bc=_[_0x3523('0x2a')](db['ChatTransferReport'][_0x3523('0x2b')],function(_0x1241cc){return{'name':_0x1241cc[_0x3523('0x2c')],'type':_0x1241cc[_0x3523('0x2d')][_0x3523('0x2e')]};});_0x127aa0['model']=_[_0x3523('0x2a')](_0x5164bc,_0x3523('0x27'));_0x127aa0[_0x3523('0x2f')]=_[_0x3523('0x30')](_0x5046a7['query']);_0x127aa0[_0x3523('0x31')]=_[_0x3523('0x32')](_0x127aa0[_0x3523('0x33')],_0x127aa0[_0x3523('0x2f')]);_0x4a69c8['attributes']=_[_0x3523('0x32')](_0x127aa0[_0x3523('0x33')],qs[_0x3523('0x34')](_0x5046a7[_0x3523('0x2f')][_0x3523('0x34')]));_0x4a69c8[_0x3523('0x35')]=_0x4a69c8[_0x3523('0x35')][_0x3523('0x36')]?_0x4a69c8[_0x3523('0x35')]:_0x127aa0[_0x3523('0x33')];if(!_0x5046a7[_0x3523('0x2f')][_0x3523('0x37')]('nolimit')){_0x4a69c8[_0x3523('0x1c')]=qs['limit'](_0x5046a7[_0x3523('0x2f')][_0x3523('0x1c')]);_0x4a69c8[_0x3523('0x1b')]=qs[_0x3523('0x1b')](_0x5046a7[_0x3523('0x2f')][_0x3523('0x1b')]);}_0x4a69c8[_0x3523('0x38')]=qs['sort'](_0x5046a7[_0x3523('0x2f')][_0x3523('0x39')]);_0x4a69c8[_0x3523('0x3a')]=qs[_0x3523('0x31')](_[_0x3523('0x3b')](_0x5046a7['query'],_0x127aa0[_0x3523('0x31')]),_0x5164bc);if(_0x5046a7[_0x3523('0x2f')][_0x3523('0x3c')]){_0x4a69c8[_0x3523('0x3a')]=_[_0x3523('0x3d')](_0x4a69c8['where'],{'$or':_[_0x3523('0x2a')](_0x5164bc,function(_0x4e82d9){if(_0x4e82d9[_0x3523('0x2d')]!==_0x3523('0x3e')){var _0x4c32e0={};_0x4c32e0[_0x4e82d9[_0x3523('0x27')]]={'$like':'%'+_0x5046a7[_0x3523('0x2f')]['filter']+'%'};return _0x4c32e0;}})});}_0x4a69c8=_[_0x3523('0x3d')]({},_0x4a69c8,_0x5046a7[_0x3523('0x3f')]);var _0x163af5={'where':_0x4a69c8[_0x3523('0x3a')]};return db[_0x3523('0x40')]['count'](_0x163af5)[_0x3523('0x23')](function(_0x2d38e5){_0x484bbf['count']=_0x2d38e5;if(_0x5046a7[_0x3523('0x2f')]['includeAll']){_0x4a69c8[_0x3523('0x41')]=[{'all':!![]}];}return db[_0x3523('0x40')][_0x3523('0x42')](_0x4a69c8);})[_0x3523('0x23')](function(_0x4cf7a3){_0x484bbf[_0x3523('0x43')]=_0x4cf7a3;return _0x484bbf;})[_0x3523('0x23')](respondWithFilteredResult(_0x2580dd,_0x4a69c8))[_0x3523('0x44')](handleError(_0x2580dd,null));};exports[_0x3523('0x45')]=function(_0x3d3f52,_0x17a41f){var _0x1d92e4={'raw':!![],'where':{'id':_0x3d3f52[_0x3523('0x46')]['id']}},_0x515afa={};_0x515afa[_0x3523('0x33')]=_[_0x3523('0x30')](db[_0x3523('0x40')]['rawAttributes']);_0x515afa[_0x3523('0x2f')]=_[_0x3523('0x30')](_0x3d3f52[_0x3523('0x2f')]);_0x515afa['filters']=_[_0x3523('0x32')](_0x515afa[_0x3523('0x33')],_0x515afa[_0x3523('0x2f')]);_0x1d92e4[_0x3523('0x35')]=_[_0x3523('0x32')](_0x515afa['model'],qs[_0x3523('0x34')](_0x3d3f52['query'][_0x3523('0x34')]));_0x1d92e4[_0x3523('0x35')]=_0x1d92e4[_0x3523('0x35')]['length']?_0x1d92e4['attributes']:_0x515afa['model'];if(_0x3d3f52[_0x3523('0x2f')][_0x3523('0x47')]){_0x1d92e4[_0x3523('0x41')]=[{'all':!![]}];}_0x1d92e4=_[_0x3523('0x3d')]({},_0x1d92e4,_0x3d3f52[_0x3523('0x3f')]);return db[_0x3523('0x40')][_0x3523('0x48')](_0x1d92e4)[_0x3523('0x23')](handleEntityNotFound(_0x17a41f,null))[_0x3523('0x23')](respondWithResult(_0x17a41f,null))['catch'](handleError(_0x17a41f,null));};exports[_0x3523('0x49')]=function(_0x12cfb6,_0x12dcee){return db[_0x3523('0x40')][_0x3523('0x49')](_0x12cfb6[_0x3523('0x4a')],{})[_0x3523('0x23')](respondWithResult(_0x12dcee,0xc9))[_0x3523('0x44')](handleError(_0x12dcee,null));};exports['update']=function(_0x4c5290,_0x4d4687){if(_0x4c5290[_0x3523('0x4a')]['id']){delete _0x4c5290[_0x3523('0x4a')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x4c5290['params']['id']}})['then'](handleEntityNotFound(_0x4d4687,null))['then'](saveUpdates(_0x4c5290['body'],null))[_0x3523('0x23')](respondWithResult(_0x4d4687,null))['catch'](handleError(_0x4d4687,null));};exports[_0x3523('0x4b')]=function(_0x7200f5,_0x32be96){return db[_0x3523('0x40')]['find']({'where':{'id':_0x7200f5[_0x3523('0x46')]['id']}})[_0x3523('0x23')](handleEntityNotFound(_0x32be96,null))[_0x3523('0x23')](removeEntity(_0x32be96,null))[_0x3523('0x44')](handleError(_0x32be96,null));};exports[_0x3523('0x4c')]=function(_0x53efa5,_0x583dca){return db['ChatTransferReport'][_0x3523('0x4c')]()[_0x3523('0x23')](respondWithResult(_0x583dca,null))['catch'](handleError(_0x583dca,null));}; \ No newline at end of file +var _0xcd42=['stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','destroy','error'];(function(_0x573dad,_0x7a803a){var _0x326a96=function(_0x4c879e){while(--_0x4c879e){_0x573dad['push'](_0x573dad['shift']());}};_0x326a96(++_0x7a803a);}(_0xcd42,0x157));var _0x2cd4=function(_0x477627,_0x5ec622){_0x477627=_0x477627-0x0;var _0x394c7d=_0xcd42[_0x477627];return _0x394c7d;};'use strict';var pdf=require(_0x2cd4('0x0'));var emlformat=require(_0x2cd4('0x1'));var rimraf=require(_0x2cd4('0x2'));var zipdir=require(_0x2cd4('0x3'));var jsonpatch=require(_0x2cd4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2cd4('0x5'));var Mustache=require('mustache');var util=require(_0x2cd4('0x6'));var path=require(_0x2cd4('0x7'));var sox=require(_0x2cd4('0x8'));var csv=require(_0x2cd4('0x9'));var ejs=require(_0x2cd4('0xa'));var fs=require('fs');var _=require(_0x2cd4('0xb'));var squel=require(_0x2cd4('0xc'));var crypto=require(_0x2cd4('0xd'));var jsforce=require(_0x2cd4('0xe'));var deskjs=require(_0x2cd4('0xf'));var toCsv=require(_0x2cd4('0x9'));var querystring=require(_0x2cd4('0x10'));var Papa=require(_0x2cd4('0x11'));var Redis=require(_0x2cd4('0x12'));var authService=require(_0x2cd4('0x13'));var qs=require(_0x2cd4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cd4('0x15'))(_0x2cd4('0x16'));var utils=require('../../config/utils');var config=require(_0x2cd4('0x17'));var db=require(_0x2cd4('0x18'))['db'];function respondWithStatusCode(_0xf86ab1,_0x4d78f2){_0x4d78f2=_0x4d78f2||0xcc;return function(_0x4d494c){if(_0x4d494c){return _0xf86ab1[_0x2cd4('0x19')](_0x4d78f2);}return _0xf86ab1['status'](_0x4d78f2)['end']();};}function respondWithResult(_0x8c92c7,_0x58ade5){_0x58ade5=_0x58ade5||0xc8;return function(_0xcca931){if(_0xcca931){return _0x8c92c7[_0x2cd4('0x1a')](_0x58ade5)[_0x2cd4('0x1b')](_0xcca931);}};}function respondWithFilteredResult(_0x45556f,_0x340a9a){return function(_0x55f002){if(_0x55f002){var _0x2d7208=_0x55f002[_0x2cd4('0x1c')],_0xfcf23e=_0x340a9a['offset'],_0x5928d5=_0x340a9a['offset']+_0x340a9a[_0x2cd4('0x1d')],_0x1ac3ad;if(_0x5928d5>=_0x2d7208){_0x5928d5=_0x2d7208;_0x1ac3ad=0xc8;}else{_0x1ac3ad=0xce;}_0x45556f[_0x2cd4('0x1a')](_0x1ac3ad);return _0x45556f[_0x2cd4('0x1e')](_0x2cd4('0x1f'),_0xfcf23e+'-'+_0x5928d5+'/'+_0x2d7208)[_0x2cd4('0x1b')](_0x55f002);}return null;};}function patchUpdates(_0x17074e){return function(_0x49fd58){try{jsonpatch['apply'](_0x49fd58,_0x17074e,!![]);}catch(_0x221306){return BPromise[_0x2cd4('0x20')](_0x221306);}return _0x49fd58[_0x2cd4('0x21')]();};}function saveUpdates(_0x2612f5,_0x3f71d7){return function(_0x1f5a10){if(_0x1f5a10){return _0x1f5a10[_0x2cd4('0x22')](_0x2612f5)['then'](function(_0x48bef3){return _0x48bef3;});}return null;};}function removeEntity(_0x211090,_0x4f6415){return function(_0x3a2a3a){if(_0x3a2a3a){return _0x3a2a3a[_0x2cd4('0x23')]()['then'](function(){_0x211090[_0x2cd4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ae0f,_0x426335){return function(_0x42a910){if(!_0x42a910){_0x48ae0f[_0x2cd4('0x19')](0x194);}return _0x42a910;};}function handleError(_0x16e3c4,_0x3375d1){_0x3375d1=_0x3375d1||0x1f4;return function(_0x1c7987){logger[_0x2cd4('0x24')](_0x1c7987[_0x2cd4('0x25')]);if(_0x1c7987[_0x2cd4('0x26')]){delete _0x1c7987[_0x2cd4('0x26')];}_0x16e3c4[_0x2cd4('0x1a')](_0x3375d1)[_0x2cd4('0x27')](_0x1c7987);};}exports[_0x2cd4('0x28')]=function(_0x27cba5,_0x5c09d2){var _0x55a556={},_0x1c297e={},_0x324d53={'count':0x0,'rows':[]};var _0x4eafc1=_[_0x2cd4('0x29')](db[_0x2cd4('0x2a')][_0x2cd4('0x2b')],function(_0x155baa){return{'name':_0x155baa[_0x2cd4('0x2c')],'type':_0x155baa['type'][_0x2cd4('0x2d')]};});_0x1c297e[_0x2cd4('0x2e')]=_['map'](_0x4eafc1,_0x2cd4('0x26'));_0x1c297e[_0x2cd4('0x2f')]=_[_0x2cd4('0x30')](_0x27cba5[_0x2cd4('0x2f')]);_0x1c297e[_0x2cd4('0x31')]=_[_0x2cd4('0x32')](_0x1c297e[_0x2cd4('0x2e')],_0x1c297e[_0x2cd4('0x2f')]);_0x55a556[_0x2cd4('0x33')]=_[_0x2cd4('0x32')](_0x1c297e[_0x2cd4('0x2e')],qs[_0x2cd4('0x34')](_0x27cba5[_0x2cd4('0x2f')][_0x2cd4('0x34')]));_0x55a556['attributes']=_0x55a556[_0x2cd4('0x33')][_0x2cd4('0x35')]?_0x55a556[_0x2cd4('0x33')]:_0x1c297e[_0x2cd4('0x2e')];if(!_0x27cba5['query']['hasOwnProperty']('nolimit')){_0x55a556[_0x2cd4('0x1d')]=qs[_0x2cd4('0x1d')](_0x27cba5[_0x2cd4('0x2f')][_0x2cd4('0x1d')]);_0x55a556[_0x2cd4('0x36')]=qs[_0x2cd4('0x36')](_0x27cba5[_0x2cd4('0x2f')]['offset']);}_0x55a556[_0x2cd4('0x37')]=qs[_0x2cd4('0x38')](_0x27cba5['query'][_0x2cd4('0x38')]);_0x55a556[_0x2cd4('0x39')]=qs['filters'](_[_0x2cd4('0x3a')](_0x27cba5['query'],_0x1c297e[_0x2cd4('0x31')]),_0x4eafc1);if(_0x27cba5['query']['filter']){_0x55a556[_0x2cd4('0x39')]=_[_0x2cd4('0x3b')](_0x55a556[_0x2cd4('0x39')],{'$or':_[_0x2cd4('0x29')](_0x4eafc1,function(_0x4c0648){if(_0x4c0648[_0x2cd4('0x3c')]!==_0x2cd4('0x3d')){var _0x42435b={};_0x42435b[_0x4c0648[_0x2cd4('0x26')]]={'$like':'%'+_0x27cba5[_0x2cd4('0x2f')][_0x2cd4('0x3e')]+'%'};return _0x42435b;}})});}_0x55a556=_['merge']({},_0x55a556,_0x27cba5[_0x2cd4('0x3f')]);var _0x11d332={'where':_0x55a556['where']};return db[_0x2cd4('0x2a')][_0x2cd4('0x1c')](_0x11d332)[_0x2cd4('0x40')](function(_0x48d679){_0x324d53[_0x2cd4('0x1c')]=_0x48d679;if(_0x27cba5[_0x2cd4('0x2f')][_0x2cd4('0x41')]){_0x55a556['include']=[{'all':!![]}];}return db[_0x2cd4('0x2a')][_0x2cd4('0x42')](_0x55a556);})['then'](function(_0x1360a4){_0x324d53[_0x2cd4('0x43')]=_0x1360a4;return _0x324d53;})[_0x2cd4('0x40')](respondWithFilteredResult(_0x5c09d2,_0x55a556))[_0x2cd4('0x44')](handleError(_0x5c09d2,null));};exports[_0x2cd4('0x45')]=function(_0x21fdef,_0x43178a){var _0x30add3={'raw':!![],'where':{'id':_0x21fdef[_0x2cd4('0x46')]['id']}},_0xe7f788={};_0xe7f788[_0x2cd4('0x2e')]=_[_0x2cd4('0x30')](db['ChatTransferReport'][_0x2cd4('0x2b')]);_0xe7f788[_0x2cd4('0x2f')]=_[_0x2cd4('0x30')](_0x21fdef[_0x2cd4('0x2f')]);_0xe7f788['filters']=_[_0x2cd4('0x32')](_0xe7f788[_0x2cd4('0x2e')],_0xe7f788['query']);_0x30add3[_0x2cd4('0x33')]=_[_0x2cd4('0x32')](_0xe7f788[_0x2cd4('0x2e')],qs[_0x2cd4('0x34')](_0x21fdef[_0x2cd4('0x2f')][_0x2cd4('0x34')]));_0x30add3[_0x2cd4('0x33')]=_0x30add3[_0x2cd4('0x33')][_0x2cd4('0x35')]?_0x30add3['attributes']:_0xe7f788[_0x2cd4('0x2e')];if(_0x21fdef[_0x2cd4('0x2f')][_0x2cd4('0x41')]){_0x30add3[_0x2cd4('0x47')]=[{'all':!![]}];}_0x30add3=_[_0x2cd4('0x3b')]({},_0x30add3,_0x21fdef['options']);return db[_0x2cd4('0x2a')][_0x2cd4('0x48')](_0x30add3)[_0x2cd4('0x40')](handleEntityNotFound(_0x43178a,null))[_0x2cd4('0x40')](respondWithResult(_0x43178a,null))[_0x2cd4('0x44')](handleError(_0x43178a,null));};exports[_0x2cd4('0x49')]=function(_0x4ab3d5,_0x2757e5){return db[_0x2cd4('0x2a')][_0x2cd4('0x49')](_0x4ab3d5['body'],{})['then'](respondWithResult(_0x2757e5,0xc9))['catch'](handleError(_0x2757e5,null));};exports['update']=function(_0x356ea5,_0x4ca2cc){if(_0x356ea5['body']['id']){delete _0x356ea5[_0x2cd4('0x4a')]['id'];}return db[_0x2cd4('0x2a')]['find']({'where':{'id':_0x356ea5[_0x2cd4('0x46')]['id']}})[_0x2cd4('0x40')](handleEntityNotFound(_0x4ca2cc,null))[_0x2cd4('0x40')](saveUpdates(_0x356ea5['body'],null))[_0x2cd4('0x40')](respondWithResult(_0x4ca2cc,null))[_0x2cd4('0x44')](handleError(_0x4ca2cc,null));};exports[_0x2cd4('0x23')]=function(_0x505c4c,_0x5ae31a){return db[_0x2cd4('0x2a')][_0x2cd4('0x48')]({'where':{'id':_0x505c4c['params']['id']}})[_0x2cd4('0x40')](handleEntityNotFound(_0x5ae31a,null))['then'](removeEntity(_0x5ae31a,null))['catch'](handleError(_0x5ae31a,null));};exports[_0x2cd4('0x4b')]=function(_0x134710,_0x3762e5){return db['ChatTransferReport'][_0x2cd4('0x4b')]()[_0x2cd4('0x40')](respondWithResult(_0x3762e5,null))[_0x2cd4('0x44')](handleError(_0x3762e5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 260a47a..a6d6cb9 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 _0x9957=['exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x3e0eb3,_0x2985f8){var _0xf114a8=function(_0x36cb26){while(--_0x36cb26){_0x3e0eb3['push'](_0x3e0eb3['shift']());}};_0xf114a8(++_0x2985f8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x435e26,_0x566bfe){_0x435e26=_0x435e26-0x0;var _0x4c6d40=_0x8ef6[_0x435e26];return _0x4c6d40;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d365c8e..3d1758a 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 _0x2899=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x37e188,_0x49d9b9){var _0xd8f577=function(_0x2925f8){while(--_0x2925f8){_0x37e188['push'](_0x37e188['shift']());}};_0xd8f577(++_0x49d9b9);}(_0x2899,0xaa));var _0x9289=function(_0x19d2ba,_0x57d007){_0x19d2ba=_0x19d2ba-0x0;var _0x29c1e3=_0x2899[_0x19d2ba];return _0x29c1e3;};'use strict';var _=require(_0x9289('0x0'));var util=require(_0x9289('0x1'));var moment=require(_0x9289('0x2'));var BPromise=require(_0x9289('0x3'));var rs=require(_0x9289('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9289('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9289('0x6'));var config=require(_0x9289('0x7'));var jayson=require(_0x9289('0x8'));var client=jayson[_0x9289('0x9')][_0x9289('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3022,_0x43c1b2,_0x520b9b){return new BPromise(function(_0x2bb306,_0x2bc236){return client[_0x9289('0xb')](_0x4c3022,_0x520b9b)[_0x9289('0xc')](function(_0x34c948){logger[_0x9289('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x43c1b2,_0x9289('0xe'));logger[_0x9289('0xf')](_0x9289('0x10'),_0x43c1b2,_0x9289('0xe'),JSON[_0x9289('0x11')](_0x34c948));if(_0x34c948[_0x9289('0x12')]){if(_0x34c948[_0x9289('0x12')][_0x9289('0x13')]===0x1f4){logger[_0x9289('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x43c1b2,_0x34c948[_0x9289('0x12')][_0x9289('0x14')]);return _0x2bc236(_0x34c948[_0x9289('0x12')][_0x9289('0x14')]);}logger[_0x9289('0x12')](_0x9289('0x15'),_0x43c1b2,_0x34c948[_0x9289('0x12')][_0x9289('0x14')]);return _0x2bb306(_0x34c948[_0x9289('0x12')][_0x9289('0x14')]);}else{logger[_0x9289('0xd')](_0x9289('0x15'),_0x43c1b2,'request\x20sent');_0x2bb306(_0x34c948['result'][_0x9289('0x14')]);}})[_0x9289('0x16')](function(_0x5854bd){logger[_0x9289('0x12')](_0x9289('0x15'),_0x43c1b2,_0x5854bd);_0x2bc236(_0x5854bd);});});} \ No newline at end of file +var _0xc584=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc584,0xa8));var _0x4c58=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xc584[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var moment=require(_0x4c58('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c58('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c58('0x3'));var logger=require(_0x4c58('0x4'))(_0x4c58('0x5'));var config=require('../../config/environment');var jayson=require(_0x4c58('0x6'));var client=jayson[_0x4c58('0x7')][_0x4c58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fbd47,_0x7dead8,_0x5b43cb){return new BPromise(function(_0x50e4f6,_0x4e3129){return client[_0x4c58('0x9')](_0x2fbd47,_0x5b43cb)[_0x4c58('0xa')](function(_0x4550da){logger[_0x4c58('0xb')](_0x4c58('0xc'),_0x7dead8,_0x4c58('0xd'));logger[_0x4c58('0xe')](_0x4c58('0xf'),_0x7dead8,_0x4c58('0xd'),JSON[_0x4c58('0x10')](_0x4550da));if(_0x4550da[_0x4c58('0x11')]){if(_0x4550da[_0x4c58('0x11')]['code']===0x1f4){logger['error'](_0x4c58('0xc'),_0x7dead8,_0x4550da['error'][_0x4c58('0x12')]);return _0x4e3129(_0x4550da[_0x4c58('0x11')][_0x4c58('0x12')]);}logger[_0x4c58('0x11')](_0x4c58('0xc'),_0x7dead8,_0x4550da[_0x4c58('0x11')]['message']);return _0x50e4f6(_0x4550da[_0x4c58('0x11')]['message']);}else{logger[_0x4c58('0xb')](_0x4c58('0xc'),_0x7dead8,_0x4c58('0xd'));_0x50e4f6(_0x4550da[_0x4c58('0x13')][_0x4c58('0x12')]);}})[_0x4c58('0x14')](function(_0x49916c){logger[_0x4c58('0x11')](_0x4c58('0xc'),_0x7dead8,_0x49916c);_0x4e3129(_0x49916c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index e329eeb..f45dc60 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 _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);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(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x757a,0xde));var _0xa757=function(_0x2854f5,_0x59c45e){_0x2854f5=_0x2854f5-0x0;var _0x39706a=_0x757a[_0x2854f5];return _0x39706a;};'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 509396c..fc3c556 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 _0xc507=['textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Contact\x20us','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','thumb','stringify','input','name','text','parse','getDataValue','setDataValue','onlineForm'];(function(_0x1a3a13,_0x265290){var _0x1a9d2b=function(_0x36a8e7){while(--_0x36a8e7){_0x1a3a13['push'](_0x1a3a13['shift']());}};_0x1a9d2b(++_0x265290);}(_0xc507,0x73));var _0x7c50=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0xc507[_0x5933fb];return _0x44d988;};'use strict';var Sequelize=require(_0x7c50('0x0'));var rs=require(_0x7c50('0x1'));module[_0x7c50('0x2')]={'name':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![],'unique':_0x7c50('0x4')},'description':{'type':Sequelize[_0x7c50('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x7c50('0x5')},'mapKeyOffline':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x6')},'customerAlias':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![],'defaultValue':_0x7c50('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![],'defaultValue':_0x7c50('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![],'defaultValue':_0x7c50('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7c50('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7c50('0x3')]},'animation':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7c50('0xb')](_0x7c50('0xc'),_0x7c50('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0xe')},'start_chat_button':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0xf')},'download_transcript':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7c50('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7c50('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x12')},'noteTitle':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x13')},'placeholderMessage':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x14')},'closingMessage':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x15')},'ratingType':{'type':Sequelize[_0x7c50('0xb')](_0x7c50('0x16'),_0x7c50('0x17')),'defaultValue':_0x7c50('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7c50('0x18')]({'items':[{'type':_0x7c50('0x19'),'variable':null,'config':{'placeholder':_0x7c50('0x1a'),'type':_0x7c50('0x1b'),'required':!![]},'props':{'title':_0x7c50('0x1a'),'helpText':''}},{'type':_0x7c50('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7c50('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x7c50('0x1c')](this[_0x7c50('0x1d')]('onlineForm')):{};},'set':function(_0x55c04c){return this[_0x7c50('0x1e')](_0x7c50('0x1f'),JSON[_0x7c50('0x18')](_0x55c04c));}},'offlineForm':{'type':Sequelize[_0x7c50('0x10')],'defaultValue':function(){return JSON[_0x7c50('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7c50('0x5'),'type':_0x7c50('0x5')},'variable':null},{'type':_0x7c50('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x7c50('0x21'),'helpText':_0x7c50('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x7c50('0x1d')](_0x7c50('0x23'))?JSON[_0x7c50('0x1c')](this[_0x7c50('0x1d')](_0x7c50('0x23'))):{};},'set':function(_0x446a08){return this[_0x7c50('0x1e')]('offlineForm',JSON[_0x7c50('0x18')](_0x446a08));}},'token':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7c50('0x3')]},'waitingTitle':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x25')},'offlineMessageBody':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x27')},'skipUnmanaged':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7c50('0x29')},'enableCustomerAttachment':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7c50('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7c50('0x10')],'defaultValue':function(){return _0x7c50('0x2a');}},'notificationSound':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7c50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x2c')},'verticalAlignment':{'type':Sequelize[_0x7c50('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7c50('0x3')],'allowNull':![],'defaultValue':_0x7c50('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7c50('0x3')],'defaultValue':_0x7c50('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7c50('0xa')],'defaultValue':![],'comment':_0x7c50('0x2f'),'set':function(_0x428194){if(!_0x428194)this[_0x7c50('0x1e')](_0x7c50('0x30'),null);this['setDataValue']('mandatoryDisposition',_0x428194);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0xf3be=['text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name'];(function(_0x3d3ddd,_0x59b504){var _0x52a4f9=function(_0x349a69){while(--_0x349a69){_0x3d3ddd['push'](_0x3d3ddd['shift']());}};_0x52a4f9(++_0x59b504);}(_0xf3be,0x1e1));var _0xef3b=function(_0x26c2f7,_0x3904b5){_0x26c2f7=_0x26c2f7-0x0;var _0x27ae5d=_0xf3be[_0x26c2f7];return _0x27ae5d;};'use strict';var Sequelize=require(_0xef3b('0x0'));var rs=require(_0xef3b('0x1'));module[_0xef3b('0x2')]={'name':{'type':Sequelize[_0xef3b('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xef3b('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x5')},'key':{'type':Sequelize[_0xef3b('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x6')},'customerAlias':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xef3b('0x3')],'allowNull':![],'defaultValue':_0xef3b('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xef3b('0x3')],'allowNull':![],'defaultValue':_0xef3b('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xef3b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xef3b('0xa')](_0xef3b('0xb'),'squared'),'defaultValue':_0xef3b('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0xc')},'start_chat_button':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0xd')},'offline_chat_button':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0xe')},'header_offline':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0xf')},'download_transcript':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xef3b('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xef3b('0x10')]},'closingQuestion':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x13')},'noteTitle':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x14')},'placeholderMessage':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x16')},'closingMessageButton':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x17')},'ratingType':{'type':Sequelize[_0xef3b('0xa')](_0xef3b('0x18'),_0xef3b('0x19')),'defaultValue':_0xef3b('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xef3b('0x10')],'defaultValue':function(){return JSON[_0xef3b('0x1a')]({'items':[{'type':_0xef3b('0x1b'),'variable':null,'config':{'placeholder':_0xef3b('0x1c'),'type':_0xef3b('0x1d'),'required':!![]},'props':{'title':_0xef3b('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0xef3b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xef3b('0x1e')](_0xef3b('0x1f'))?JSON[_0xef3b('0x20')](this[_0xef3b('0x1e')](_0xef3b('0x1f'))):{};},'set':function(_0x179338){return this['setDataValue']('onlineForm',JSON[_0xef3b('0x1a')](_0x179338));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xef3b('0x1b'),'props':{'title':_0xef3b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xef3b('0x5'),'type':_0xef3b('0x5')},'variable':null},{'type':_0xef3b('0x21'),'config':{'placeholder':_0xef3b('0x22')},'props':{'title':_0xef3b('0x22'),'helpText':_0xef3b('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xef3b('0x24'))?JSON[_0xef3b('0x20')](this[_0xef3b('0x1e')](_0xef3b('0x24'))):{};},'set':function(_0x27ab13){return this[_0xef3b('0x25')](_0xef3b('0x24'),JSON['stringify'](_0x27ab13));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xef3b('0x26')]();}},'autoclose':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xef3b('0x3')]},'forwardOffline':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xef3b('0x3')]},'waitingTitle':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x29')},'offlineMessageBody':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x2a')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xef3b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xef3b('0x10')],'defaultValue':function(){return _0xef3b('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0xef3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x2e')},'defaultTitle':{'type':Sequelize[_0xef3b('0x3')]},'customerAvatar':{'type':Sequelize[_0xef3b('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xef3b('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xef3b('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef3b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xef3b('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef3b('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cd13a){if(!_0x1cd13a)this[_0xef3b('0x25')](_0xef3b('0x31'),null);this[_0xef3b('0x25')](_0xef3b('0x32'),_0x1cd13a);}},'vidaooEscalation':{'type':Sequelize[_0xef3b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xef3b('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 ec32d2a..70ec57d 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 _0x80f3=['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','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','name','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','../../config/license/util','getLicense','custom','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','chat','no\x20available\x20attributes','difference','updatedAt','createdAt','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','CmContact','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','Contacts','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','notify','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','License','chatLicenseExceeded','all','server/files/chat/iframe.js','x-real-ip','referer','virtual','alignment','verticalAlignment','textColor','sequelize','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','items','fromKey','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','test','Sequelize'];(function(_0x473978,_0x38be98){var _0x304576=function(_0xe50f36){while(--_0xe50f36){_0x473978['push'](_0x473978['shift']());}};_0x304576(++_0x38be98);}(_0x80f3,0xf8));var _0x380f=function(_0x3b29d5,_0x12faa2){_0x3b29d5=_0x3b29d5-0x0;var _0x20b96d=_0x80f3[_0x3b29d5];return _0x20b96d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x380f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x380f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x380f('0x2'));var moment=require(_0x380f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x380f('0x4'));var util=require(_0x380f('0x5'));var path=require('path');var sox=require(_0x380f('0x6'));var csv=require(_0x380f('0x7'));var ejs=require(_0x380f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x380f('0x9'));var crypto=require(_0x380f('0xa'));var jsforce=require(_0x380f('0xb'));var deskjs=require(_0x380f('0xc'));var toCsv=require(_0x380f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x380f('0xd'));var authService=require(_0x380f('0xe'));var qs=require(_0x380f('0xf'));var as=require(_0x380f('0x10'));var hardwareService=require(_0x380f('0x11'));var logger=require(_0x380f('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x380f('0x13'))['db'];config['redis']=_[_0x380f('0x14')](config[_0x380f('0x15')],{'host':_0x380f('0x16'),'port':0x18eb});var socket=require(_0x380f('0x17'))(new Redis(config[_0x380f('0x15')]));require(_0x380f('0x18'))[_0x380f('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x380f('0x1a')][_0x380f('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x380f('0x1b')]({'port':0x232a});var client9003=jayson[_0x380f('0x1a')][_0x380f('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x5e2718,_0x329e8c,_0x1410a4){if(_0x1410a4){var _0x47a864=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47a864[_0x380f('0x1c')](_0x329e8c)){return _0x5e2718;}else{throw new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x1f'));}}else{return _0x5e2718;}}function respondWithRpcPromise(_0x18b7dd,_0x19073e,_0x2074bf,_0x26846a){return new BPromise(function(_0x5ac6ce,_0x387ec5){var _0x3aa35c=_0x26846a||client;return _0x3aa35c[_0x380f('0x20')](_0x18b7dd,_0x2074bf)[_0x380f('0x21')](function(_0x2de427){logger[_0x380f('0x22')](_0x380f('0x23'),_0x19073e,'request\x20sent');logger['debug'](_0x380f('0x24'),_0x19073e,_0x380f('0x25'),JSON[_0x380f('0x26')](_0x2de427));if(_0x2de427[_0x380f('0x27')]){if(_0x2de427[_0x380f('0x27')]['code']===0x1f4){logger[_0x380f('0x27')](_0x380f('0x23'),_0x19073e,_0x2de427[_0x380f('0x27')][_0x380f('0x28')]);return _0x387ec5(_0x2de427['error'][_0x380f('0x28')]);}logger[_0x380f('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x19073e,_0x2de427[_0x380f('0x27')][_0x380f('0x28')]);return _0x5ac6ce(_0x2de427[_0x380f('0x27')]['message']);}else{logger['info'](_0x380f('0x23'),_0x19073e,_0x380f('0x25'));_0x5ac6ce(_0x2de427[_0x380f('0x29')][_0x380f('0x28')]);}})[_0x380f('0x2a')](function(_0x24c3d2){logger[_0x380f('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x19073e,_0x24c3d2);_0x387ec5(_0x24c3d2);});});}function respondWithStatusCode(_0x404620,_0x69163c){_0x69163c=_0x69163c||0xcc;return function(_0x1de457){if(_0x1de457){return _0x404620[_0x380f('0x2b')](_0x69163c);}return _0x404620['status'](_0x69163c)['end']();};}function respondWithResult(_0x334700,_0x38ca92){_0x38ca92=_0x38ca92||0xc8;return function(_0x412526){if(_0x412526){return _0x334700[_0x380f('0x2c')](_0x38ca92)[_0x380f('0x2d')](_0x412526);}};}function respondWithFilteredResult(_0x530895,_0x609d87){return function(_0x300676){if(_0x300676){var _0x27e6f3=_0x300676[_0x380f('0x2e')],_0x337d77=_0x609d87['offset'],_0x46895a=_0x609d87[_0x380f('0x2f')]+_0x609d87[_0x380f('0x30')],_0x525d04;if(_0x46895a>=_0x27e6f3){_0x46895a=_0x27e6f3;_0x525d04=0xc8;}else{_0x525d04=0xce;}_0x530895[_0x380f('0x2c')](_0x525d04);return _0x530895[_0x380f('0x31')]('Content-Range',_0x337d77+'-'+_0x46895a+'/'+_0x27e6f3)[_0x380f('0x2d')](_0x300676);}return null;};}function patchUpdates(_0x228f78){return function(_0x3b8ac9){try{jsonpatch[_0x380f('0x32')](_0x3b8ac9,_0x228f78,!![]);}catch(_0xba7f0d){return BPromise[_0x380f('0x33')](_0xba7f0d);}return _0x3b8ac9['save']();};}function saveUpdates(_0xc53fa6,_0x13005a){return function(_0x373dd4){if(_0x373dd4){return _0x373dd4[_0x380f('0x34')](_0xc53fa6)[_0x380f('0x21')](function(_0x38f425){return _0x38f425;});}return null;};}function removeEntity(_0x51566a,_0x30503a){return function(_0x2375a7){if(_0x2375a7){return _0x2375a7[_0x380f('0x35')]()[_0x380f('0x21')](function(){var _0x102fdf=_0x2375a7[_0x380f('0x36')]({'plain':!![]});var _0x5aea4a=_0x380f('0x37');return db[_0x380f('0x38')][_0x380f('0x35')]({'where':{'type':_0x5aea4a,'resourceId':_0x102fdf['id']}})[_0x380f('0x21')](function(){return _0x2375a7;});})[_0x380f('0x21')](function(){_0x51566a[_0x380f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe841ff,_0x37d070){return function(_0x46a407){if(!_0x46a407){_0xe841ff['sendStatus'](0x194);}return _0x46a407;};}function handleError(_0x1d9de1,_0x4e60f7){_0x4e60f7=_0x4e60f7||0x1f4;return function(_0x32d8e3){logger['error'](_0x32d8e3['stack']);if(_0x32d8e3[_0x380f('0x39')]){delete _0x32d8e3[_0x380f('0x39')];}_0x1d9de1['status'](_0x4e60f7)['send'](_0x32d8e3);};}exports['index']=function(_0x51d791,_0x460361){var _0xa93b4e={'include':[{'model':db[_0x380f('0x3a')],'as':_0x380f('0x3b')}]},_0x293193={},_0x1b1996={'count':0x0,'rows':[]};var _0x154387=_[_0x380f('0x3c')](db[_0x380f('0x3d')][_0x380f('0x3e')],function(_0x1b6696){return{'name':_0x1b6696[_0x380f('0x3f')],'type':_0x1b6696[_0x380f('0x40')]['key']};});_0x293193[_0x380f('0x41')]=_[_0x380f('0x3c')](_0x154387,_0x380f('0x39'));_0x293193[_0x380f('0x42')]=_[_0x380f('0x43')](_0x51d791[_0x380f('0x42')]);_0x293193[_0x380f('0x44')]=_[_0x380f('0x45')](_0x293193['model'],_0x293193['query']);_0xa93b4e[_0x380f('0x46')]=_[_0x380f('0x45')](_0x293193[_0x380f('0x41')],qs[_0x380f('0x47')](_0x51d791[_0x380f('0x42')][_0x380f('0x47')]));_0xa93b4e[_0x380f('0x46')]=_0xa93b4e['attributes'][_0x380f('0x48')]?_0xa93b4e[_0x380f('0x46')]:_0x293193['model'];if(!_0x51d791[_0x380f('0x42')][_0x380f('0x49')](_0x380f('0x4a'))){_0xa93b4e[_0x380f('0x30')]=qs[_0x380f('0x30')](_0x51d791[_0x380f('0x42')][_0x380f('0x30')]);_0xa93b4e[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x51d791[_0x380f('0x42')]['offset']);}_0xa93b4e[_0x380f('0x4b')]=qs[_0x380f('0x4c')](_0x51d791['query'][_0x380f('0x4c')]);_0xa93b4e[_0x380f('0x4d')]=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0x51d791['query'],_0x293193['filters']),_0x154387);if(_0x51d791['query'][_0x380f('0x4f')]){_0xa93b4e['where']=_[_0x380f('0x50')](_0xa93b4e[_0x380f('0x4d')],{'$or':_[_0x380f('0x3c')](_0x154387,function(_0x61f835){if(_0x61f835[_0x380f('0x40')]!=='VIRTUAL'){var _0xf30612={};_0xf30612[_0x61f835['name']]={'$like':'%'+_0x51d791['query'][_0x380f('0x4f')]+'%'};return _0xf30612;}})});}_0xa93b4e=_[_0x380f('0x50')]({},_0xa93b4e,_0x51d791[_0x380f('0x51')]);var _0x216a21={'where':_0xa93b4e[_0x380f('0x4d')]};return db[_0x380f('0x3d')][_0x380f('0x2e')](_0x216a21)[_0x380f('0x21')](function(_0x1599aa){_0x1b1996[_0x380f('0x2e')]=_0x1599aa;if(_0x51d791[_0x380f('0x42')][_0x380f('0x52')]){_0xa93b4e[_0x380f('0x53')]=[{'all':!![]}];}return db[_0x380f('0x3d')][_0x380f('0x54')](_0xa93b4e);})[_0x380f('0x21')](function(_0x415163){_0x1b1996[_0x380f('0x55')]=_0x415163;return _0x1b1996;})[_0x380f('0x21')](respondWithFilteredResult(_0x460361,_0xa93b4e))[_0x380f('0x2a')](handleError(_0x460361,null));};exports[_0x380f('0x56')]=function(_0x162c60,_0x2d2516){var _0x379af5={'raw':![],'where':{'id':_0x162c60['params']['id']},'include':[{'model':db[_0x380f('0x3a')],'as':_0x380f('0x3b')}]},_0x101b56={};_0x101b56[_0x380f('0x41')]=_[_0x380f('0x43')](db[_0x380f('0x3d')][_0x380f('0x3e')]);_0x101b56[_0x380f('0x42')]=_[_0x380f('0x43')](_0x162c60[_0x380f('0x42')]);_0x101b56[_0x380f('0x44')]=_[_0x380f('0x45')](_0x101b56['model'],_0x101b56[_0x380f('0x42')]);_0x379af5[_0x380f('0x46')]=_[_0x380f('0x45')](_0x101b56[_0x380f('0x41')],qs['fields'](_0x162c60[_0x380f('0x42')][_0x380f('0x47')]));_0x379af5[_0x380f('0x46')]=_0x379af5[_0x380f('0x46')][_0x380f('0x48')]?_0x379af5[_0x380f('0x46')]:_0x101b56[_0x380f('0x41')];if(_0x162c60['query']['includeAll']){_0x379af5['include']=[{'all':!![]}];}_0x379af5=_[_0x380f('0x50')]({},_0x379af5,_0x162c60[_0x380f('0x51')]);return db[_0x380f('0x3d')]['find'](_0x379af5)['then'](handleEntityNotFound(_0x2d2516,null))['then'](respondWithResult(_0x2d2516,null))['catch'](handleError(_0x2d2516,null));};exports[_0x380f('0x57')]=function(_0x8c5fa4,_0x452992){return db['ChatWebsite']['create'](_0x8c5fa4['body'],{})[_0x380f('0x21')](function(_0x5706e8){var _0x33d29d=_0x8c5fa4[_0x380f('0x58')][_0x380f('0x36')]({'plain':!![]});if(!_0x33d29d)throw new Error(_0x380f('0x59'));if(_0x33d29d[_0x380f('0x5a')]===_0x380f('0x58')){var _0x13712c=_0x5706e8['get']({'plain':!![]});var _0x2ce694='ChatWebsites';return db['UserProfileSection'][_0x380f('0x5b')]({'where':{'name':_0x2ce694,'userProfileId':_0x33d29d[_0x380f('0x5c')]},'raw':!![]})[_0x380f('0x21')](function(_0xcc0243){if(_0xcc0243&&_0xcc0243[_0x380f('0x5d')]===0x0){return db[_0x380f('0x38')][_0x380f('0x57')]({'name':_0x13712c[_0x380f('0x39')],'resourceId':_0x13712c['id'],'type':_0xcc0243[_0x380f('0x39')],'sectionId':_0xcc0243['id']},{})[_0x380f('0x21')](function(){return _0x5706e8;});}else{return _0x5706e8;}})[_0x380f('0x2a')](function(_0x4372d2){logger[_0x380f('0x27')](_0x380f('0x5e'),_0x4372d2);throw _0x4372d2;});}return _0x5706e8;})[_0x380f('0x21')](respondWithResult(_0x452992,0xc9))[_0x380f('0x2a')](handleError(_0x452992,null));};exports[_0x380f('0x34')]=function(_0x437855,_0x10ae09){if(_0x437855[_0x380f('0x5f')]['id']){delete _0x437855[_0x380f('0x5f')]['id'];}return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x437855[_0x380f('0x60')]['id']},'include':[{'model':db[_0x380f('0x3a')],'as':_0x380f('0x3b')}]})['then'](handleEntityNotFound(_0x10ae09,null))[_0x380f('0x21')](saveUpdates(_0x437855[_0x380f('0x5f')],null))[_0x380f('0x21')](respondWithResult(_0x10ae09,null))[_0x380f('0x2a')](handleError(_0x10ae09,null));};exports['destroy']=function(_0x3fcd6a,_0x39e1ce){return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x3fcd6a[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x39e1ce,null))['then'](removeEntity(_0x39e1ce,null))[_0x380f('0x2a')](handleError(_0x39e1ce,null));};exports[_0x380f('0x61')]=function(_0x1d49f9,_0x8faca9){return db[_0x380f('0x3d')]['describe']()['then'](respondWithResult(_0x8faca9,null))[_0x380f('0x2a')](handleError(_0x8faca9,null));};exports[_0x380f('0x62')]=function(_0x30b05f,_0x46c8a7,_0x5ad2aa){if(_0x30b05f['body']['id']){delete _0x30b05f['body']['id'];}return db['ChatWebsite'][_0x380f('0x5b')]({'where':{'id':_0x30b05f[_0x380f('0x60')]['id']}})['then'](handleEntityNotFound(_0x46c8a7,null))[_0x380f('0x21')](function(_0x42a59c){if(_0x42a59c){_0x30b05f[_0x380f('0x5f')][_0x380f('0x63')]=_0x42a59c['id'];return db[_0x380f('0x64')][_0x380f('0x57')](_0x30b05f['body']);}})['then'](respondWithResult(_0x46c8a7,null))[_0x380f('0x2a')](handleError(_0x46c8a7,null));};exports[_0x380f('0x65')]=function(_0x2f8c25,_0x31725a,_0x3876f7){var _0x26401c={'raw':![],'where':{}};var _0x53857e={};var _0x1527fd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x380f('0x66')]({'where':{'id':_0x2f8c25['params']['id']}})['then'](handleEntityNotFound(_0x31725a,null))[_0x380f('0x21')](function(_0x41efad){if(_0x41efad){_0x53857e[_0x380f('0x41')]=_['keys'](db[_0x380f('0x64')][_0x380f('0x3e')]);_0x53857e[_0x380f('0x42')]=_['keys'](_0x2f8c25[_0x380f('0x42')]);_0x53857e['filters']=_[_0x380f('0x45')](_0x53857e[_0x380f('0x41')],_0x53857e[_0x380f('0x42')]);_0x26401c['attributes']=_[_0x380f('0x45')](_0x53857e['model'],qs[_0x380f('0x47')](_0x2f8c25['query']['fields']));_0x26401c['attributes']=_0x26401c[_0x380f('0x46')][_0x380f('0x48')]?_0x26401c[_0x380f('0x46')]:_0x53857e[_0x380f('0x41')];if(!_0x2f8c25[_0x380f('0x42')][_0x380f('0x49')](_0x380f('0x4a'))){_0x26401c[_0x380f('0x30')]=qs[_0x380f('0x30')](_0x2f8c25[_0x380f('0x42')][_0x380f('0x30')]);_0x26401c[_0x380f('0x2f')]=qs['offset'](_0x2f8c25['query'][_0x380f('0x2f')]);}_0x26401c['order']=qs[_0x380f('0x4c')](_0x2f8c25[_0x380f('0x42')][_0x380f('0x4c')]);_0x26401c['where']=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0x2f8c25[_0x380f('0x42')],_0x53857e['filters']));_0x26401c[_0x380f('0x4d')]['ChatWebsiteId']=_0x41efad['id'];if(_0x2f8c25[_0x380f('0x42')]['filter']){_0x26401c[_0x380f('0x4d')]=_[_0x380f('0x50')](_0x26401c[_0x380f('0x4d')],{'$or':_[_0x380f('0x3c')](_0x26401c[_0x380f('0x46')],function(_0x2340c5){var _0x9511cd={};_0x9511cd[_0x2340c5]={'$like':'%'+_0x2f8c25[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x9511cd;})});}_0x26401c=_[_0x380f('0x50')]({},_0x26401c,_0x2f8c25[_0x380f('0x51')]);return db[_0x380f('0x64')][_0x380f('0x2e')]({'where':_0x26401c['where']})[_0x380f('0x21')](function(_0x3ca4fe){_0x1527fd[_0x380f('0x2e')]=_0x3ca4fe;if(_0x2f8c25[_0x380f('0x42')][_0x380f('0x52')]){_0x26401c[_0x380f('0x53')]=[{'all':!![]}];}return db[_0x380f('0x64')]['findAll'](_0x26401c);})[_0x380f('0x21')](function(_0x343eea){_0x1527fd['rows']=_0x343eea;return _0x1527fd;});}})['then'](respondWithFilteredResult(_0x31725a,_0x26401c))[_0x380f('0x2a')](handleError(_0x31725a,null));};exports[_0x380f('0x67')]=function(_0x5239bd,_0x66b297,_0xa66001){return db[_0x380f('0x3d')]['find']({'where':{'id':_0x5239bd['params']['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x66b297,null))['then'](function(_0x18f513){if(_0x18f513){return _0x18f513[_0x380f('0x67')](_0x5239bd[_0x380f('0x42')][_0x380f('0x68')]);}})[_0x380f('0x21')](respondWithStatusCode(_0x66b297,null))['catch'](handleError(_0x66b297,null));};exports[_0x380f('0x69')]=function(_0x11f935,_0x527df2,_0x1d691d){if(_0x11f935[_0x380f('0x5f')]['id']){delete _0x11f935[_0x380f('0x5f')]['id'];}return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x11f935[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x527df2,null))[_0x380f('0x21')](function(_0x389daf){if(_0x389daf){_0x11f935[_0x380f('0x5f')]['ChatWebsiteId']=_0x389daf['id'];return db[_0x380f('0x6a')][_0x380f('0x57')](_0x11f935[_0x380f('0x5f')]);}})['then'](respondWithResult(_0x527df2,null))[_0x380f('0x2a')](handleError(_0x527df2,null));};exports[_0x380f('0x6b')]=function(_0x17abcf,_0x4220b7,_0x2eedc4){var _0x15fd51={'raw':![],'where':{}};var _0x470cf8={};var _0x13bd0b={'count':0x0,'rows':[]};return db[_0x380f('0x3d')][_0x380f('0x66')]({'where':{'id':_0x17abcf['params']['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x4220b7,null))[_0x380f('0x21')](function(_0x301779){if(_0x301779){_0x470cf8[_0x380f('0x41')]=_[_0x380f('0x43')](db['CannedAnswer'][_0x380f('0x3e')]);_0x470cf8[_0x380f('0x42')]=_[_0x380f('0x43')](_0x17abcf[_0x380f('0x42')]);_0x470cf8[_0x380f('0x44')]=_['intersection'](_0x470cf8[_0x380f('0x41')],_0x470cf8[_0x380f('0x42')]);_0x15fd51['attributes']=_[_0x380f('0x45')](_0x470cf8[_0x380f('0x41')],qs[_0x380f('0x47')](_0x17abcf[_0x380f('0x42')][_0x380f('0x47')]));_0x15fd51[_0x380f('0x46')]=_0x15fd51[_0x380f('0x46')][_0x380f('0x48')]?_0x15fd51[_0x380f('0x46')]:_0x470cf8[_0x380f('0x41')];if(!_0x17abcf[_0x380f('0x42')]['hasOwnProperty']('nolimit')){_0x15fd51['limit']=qs[_0x380f('0x30')](_0x17abcf[_0x380f('0x42')][_0x380f('0x30')]);_0x15fd51[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x17abcf[_0x380f('0x42')][_0x380f('0x2f')]);}_0x15fd51[_0x380f('0x4b')]=qs[_0x380f('0x4c')](_0x17abcf[_0x380f('0x42')]['sort']);_0x15fd51[_0x380f('0x4d')]=qs[_0x380f('0x44')](_['pick'](_0x17abcf['query'],_0x470cf8[_0x380f('0x44')]));_0x15fd51['where'][_0x380f('0x63')]=_0x301779['id'];if(_0x17abcf[_0x380f('0x42')][_0x380f('0x4f')]){_0x15fd51['where']=_['merge'](_0x15fd51[_0x380f('0x4d')],{'$or':_[_0x380f('0x3c')](_0x15fd51['attributes'],function(_0x3d5f49){var _0x5c2f63={};_0x5c2f63[_0x3d5f49]={'$like':'%'+_0x17abcf[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x5c2f63;})});}_0x15fd51=_[_0x380f('0x50')]({},_0x15fd51,_0x17abcf['options']);return db[_0x380f('0x6a')]['count']({'where':_0x15fd51[_0x380f('0x4d')]})[_0x380f('0x21')](function(_0x5f49e5){_0x13bd0b['count']=_0x5f49e5;if(_0x17abcf[_0x380f('0x42')][_0x380f('0x52')]){_0x15fd51[_0x380f('0x53')]=[{'all':!![]}];}return db[_0x380f('0x6a')]['findAll'](_0x15fd51);})['then'](function(_0x43e9a9){_0x13bd0b[_0x380f('0x55')]=_0x43e9a9;return _0x13bd0b;});}})['then'](respondWithFilteredResult(_0x4220b7,_0x15fd51))['catch'](handleError(_0x4220b7,null));};exports[_0x380f('0x6c')]=function(_0x492c60,_0x54f747,_0x3d2c25){return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x492c60[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x54f747,null))[_0x380f('0x21')](function(_0x5d87ed){if(_0x5d87ed){return _0x5d87ed[_0x380f('0x6c')](_0x492c60[_0x380f('0x42')][_0x380f('0x68')]);}})[_0x380f('0x21')](respondWithStatusCode(_0x54f747,null))[_0x380f('0x2a')](handleError(_0x54f747,null));};exports[_0x380f('0x6d')]=function(_0x4b26fd,_0x2c1f50,_0x327c1a){_0x4b26fd['body'][_0x380f('0x6e')]=_0x4b26fd[_0x380f('0x6f')][_0x380f('0x70')];return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x4b26fd[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x2c1f50,null))[_0x380f('0x21')](saveUpdates(_0x4b26fd['body'],null))['then'](respondWithResult(_0x2c1f50,null))[_0x380f('0x2a')](handleError(_0x2c1f50,null));};exports[_0x380f('0x71')]=function(_0x25b791,_0x57b158,_0x33b02f){_0x25b791['body'][_0x380f('0x72')]=_0x25b791[_0x380f('0x6f')][_0x380f('0x70')];return db[_0x380f('0x3d')]['find']({'where':{'id':_0x25b791[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x57b158,null))[_0x380f('0x21')](saveUpdates(_0x25b791['body'],null))[_0x380f('0x21')](respondWithResult(_0x57b158,null))[_0x380f('0x2a')](handleError(_0x57b158,null));};exports['addCustomerAvatar']=function(_0x51c935,_0x46e7ef,_0x396903){_0x51c935['body'][_0x380f('0x73')]=_0x51c935[_0x380f('0x6f')]['filename'];return db[_0x380f('0x3d')]['find']({'where':{'id':_0x51c935[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x46e7ef,null))[_0x380f('0x21')](saveUpdates(_0x51c935[_0x380f('0x5f')],null))[_0x380f('0x21')](respondWithResult(_0x46e7ef,null))['catch'](handleError(_0x46e7ef,null));};exports[_0x380f('0x74')]=function(_0x32c9cd,_0x140de5,_0x1231e8){_0x32c9cd[_0x380f('0x5f')][_0x380f('0x75')]=_0x32c9cd[_0x380f('0x6f')][_0x380f('0x70')];return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x32c9cd[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x140de5,null))[_0x380f('0x21')](saveUpdates(_0x32c9cd[_0x380f('0x5f')],null))['then'](respondWithResult(_0x140de5,null))[_0x380f('0x2a')](handleError(_0x140de5,null));};exports[_0x380f('0x76')]=function(_0x3f021f,_0x376bcf,_0x570d8a){var _0x9f67c=path[_0x380f('0x77')](config['root'],'server/files/images/logos/default_logo.svg');var _0x162478={'where':{'id':_0x3f021f[_0x380f('0x60')]['id']},'attributes':['id',_0x380f('0x6e')],'raw':!![]};var _0x345fd3=![];return require(_0x380f('0x78'))[_0x380f('0x79')]()['then'](function(_0x28aad4){if(_0x28aad4){_0x345fd3=_0x28aad4[_0x380f('0x7a')];}})[_0x380f('0x21')](function(){return db[_0x380f('0x3d')][_0x380f('0x5b')](_0x162478);})[_0x380f('0x21')](handleEntityNotFound(_0x376bcf,null))[_0x380f('0x21')](function(_0x3299c1){if(_0x3299c1){if(!_['isNil'](_0x3299c1[_0x380f('0x6e')])){if(fs['existsSync'](path[_0x380f('0x77')](config[_0x380f('0x7b')],_0x380f('0x7c'),_0x3299c1[_0x380f('0x6e')]))&&_0x345fd3){_0x9f67c=path['join'](config[_0x380f('0x7b')],_0x380f('0x7c'),_0x3299c1[_0x380f('0x6e')]);}}return _0x376bcf[_0x380f('0x7d')](_0x9f67c);}})['catch'](handleError(_0x376bcf,null));};exports[_0x380f('0x7e')]=function(_0x39fba4,_0x47fcaa,_0x26aec9){var _0xa30960=path[_0x380f('0x77')](config['root'],_0x380f('0x7f'));var _0x1e6c82={'where':{'id':_0x39fba4['params']['id']},'attributes':['id',_0x380f('0x72')],'raw':!![]};return db[_0x380f('0x3d')][_0x380f('0x5b')](_0x1e6c82)[_0x380f('0x21')](handleEntityNotFound(_0x47fcaa,null))[_0x380f('0x21')](function(_0x54ed74){if(_0x54ed74){if(!_[_0x380f('0x80')](_0x54ed74[_0x380f('0x72')])){if(fs[_0x380f('0x81')](path[_0x380f('0x77')](config[_0x380f('0x7b')],_0x380f('0x82'),_0x54ed74[_0x380f('0x72')]))){_0xa30960=path['join'](config['root'],_0x380f('0x82'),_0x54ed74[_0x380f('0x72')]);}}return _0x47fcaa['download'](_0xa30960);}})[_0x380f('0x2a')](handleError(_0x47fcaa,null));};exports[_0x380f('0x83')]=function(_0x54fbe2,_0x1ec633,_0x40ada4){var _0x35175b=path[_0x380f('0x77')](config[_0x380f('0x7b')],_0x380f('0x84'));var _0x44b609={'where':{'id':_0x54fbe2[_0x380f('0x60')]['id']},'attributes':['id',_0x380f('0x73'),_0x380f('0x85')],'raw':!![]};return db['ChatWebsite'][_0x380f('0x5b')](_0x44b609)[_0x380f('0x21')](handleEntityNotFound(_0x1ec633,null))[_0x380f('0x21')](function(_0x37deff){if(_0x37deff){if(!_[_0x380f('0x80')](_0x37deff[_0x380f('0x73')])){if(fs['existsSync'](path[_0x380f('0x77')](config['root'],_0x380f('0x82'),_0x37deff[_0x380f('0x73')]))&&_0x37deff[_0x380f('0x85')]){_0x35175b=path[_0x380f('0x77')](config[_0x380f('0x7b')],'server/files/images/avatars/',_0x37deff[_0x380f('0x73')]);}}return _0x1ec633[_0x380f('0x7d')](_0x35175b);}})['catch'](handleError(_0x1ec633,null));};exports[_0x380f('0x86')]=function(_0x534fc7,_0x4a85ac,_0xfa471b){var _0x2a8143=path[_0x380f('0x77')](config[_0x380f('0x7b')],_0x380f('0x87'));var _0x5dc020={'where':{'id':_0x534fc7[_0x380f('0x60')]['id']},'attributes':['id',_0x380f('0x75')],'raw':!![]};return db['ChatWebsite']['find'](_0x5dc020)[_0x380f('0x21')](handleEntityNotFound(_0x4a85ac,null))[_0x380f('0x21')](function(_0x35738c){if(_0x35738c){if(!_[_0x380f('0x80')](_0x35738c['systemAvatar'])){if(fs[_0x380f('0x81')](path[_0x380f('0x77')](config[_0x380f('0x7b')],_0x380f('0x82'),_0x35738c[_0x380f('0x75')]))){_0x2a8143=path[_0x380f('0x77')](config['root'],_0x380f('0x82'),_0x35738c['systemAvatar']);}}return _0x4a85ac[_0x380f('0x7d')](_0x2a8143);}})[_0x380f('0x2a')](handleError(_0x4a85ac,null));};exports['notify']=function(_0x143748,_0x1dd5f1,_0x4bd260){var _0x389757=require(_0x380f('0x88'));var _0x2c220c=new _0x389757();var _0x52bfe9=_0x2c220c[_0x380f('0x89')](_0x143748[_0x380f('0x8a')][_0x380f('0x8b')])['getResult']();var _0x56f1f2={'body':_0x143748[_0x380f('0x5f')],'channel':_0x380f('0x8c')};var _0x18a068=[];var _0x244312=[];var _0x2d1520={};var _0x184f58=![];return db['CmContact'][_0x380f('0x61')]()['then'](function(_0x3fef5d){if(!_0x3fef5d){throw new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x8d'));}_0x18a068=_[_0x380f('0x8e')](_[_0x380f('0x43')](_0x3fef5d),['createdAt',_0x380f('0x8f')]);_0x244312=_[_0x380f('0x8e')](_[_0x380f('0x43')](_0x3fef5d),[_0x380f('0x90'),_0x380f('0x8f'),_0x380f('0x91'),_0x380f('0x92')]);if(_0x143748[_0x380f('0x5f')]['id']){delete _0x143748[_0x380f('0x5f')]['id'];}if(_['isNil'](_0x143748[_0x380f('0x5f')][_0x380f('0x93')])){throw new db['Sequelize'][(_0x380f('0x1e'))](_0x380f('0x94'));}if(_['isNil'](_0x143748[_0x380f('0x5f')][_0x380f('0x5f')])||_0x143748[_0x380f('0x5f')][_0x380f('0x5f')]===''){throw new db[(_0x380f('0x1d'))]['ValidationError'](_0x380f('0x95'));}if(_[_0x380f('0x80')](_0x143748['body'][_0x380f('0x96')])){throw new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x97')+_0x244312);}if(!_[_0x380f('0x98')](_0x244312,_0x143748[_0x380f('0x5f')]['mapKey'])){throw new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x99')+_0x244312);}_0x2d1520[_0x143748[_0x380f('0x5f')][_0x380f('0x96')]]=_0x143748['body'][_0x380f('0x93')];})[_0x380f('0x21')](function(){return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x143748[_0x380f('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x380f('0x9a'),'include':[{'model':db[_0x380f('0x9b')],'as':'Contacts','where':_0x2d1520,'limit':0x1,'order':[['updatedAt',_0x380f('0x9c')]]}]},{'model':db[_0x380f('0x9d')],'as':_0x380f('0x9e')}]});})[_0x380f('0x21')](handleEntityNotFound(_0x1dd5f1,null))['then'](function(_0x5668f2){if(_0x5668f2&&_0x5668f2[_0x380f('0x9a')]){_0x56f1f2['account']=_0x5668f2;_0x56f1f2[_0x380f('0x9f')]=_0x5668f2[_0x380f('0x9e')];_0x56f1f2['list']=_0x5668f2[_0x380f('0x9a')];_0x56f1f2[_0x380f('0x9f')]=_[_0x380f('0xa0')](_0x56f1f2[_0x380f('0x9f')],[_0x380f('0xa1')],[_0x380f('0xa2')]);if(_0x56f1f2['account'][_0x380f('0x9e')]){delete _0x56f1f2['account'][_0x380f('0x9e')];}if(_0x56f1f2[_0x380f('0xa3')][_0x380f('0x9a')]&&_0x56f1f2['account'][_0x380f('0x9a')][_0x380f('0xa4')][_0x380f('0x48')]){return _0x56f1f2[_0x380f('0xa3')][_0x380f('0x9a')][_0x380f('0xa4')][0x0];}var _0x56452a=_[_0x380f('0x14')](_0x143748[_0x380f('0x5f')],{'firstName':_0x143748[_0x380f('0x5f')][_0x380f('0x93')],'ListId':_0x5668f2[_0x380f('0x92')]});_0x56452a[_0x143748[_0x380f('0x5f')][_0x380f('0x96')]]=_0x143748[_0x380f('0x5f')]['from'];return db[_0x380f('0x9b')]['create'](_0x56452a,{'fields':_0x18a068,'raw':!![]});}})['then'](handleEntityNotFound(_0x1dd5f1,null))[_0x380f('0x21')](function(_0x377b4f){_0x56f1f2['contact']=_0x377b4f;var _0x20e315=_0x143748['body'][_0x380f('0xa5')];if(_0x143748[_0x380f('0x8a')]['cf-connecting-ip']){_0x20e315=_0x143748[_0x380f('0x8a')][_0x380f('0xa6')];}else if(_0x143748[_0x380f('0x8a')]['x-forwarded-for']){_0x20e315=_[_0x380f('0xa7')](_0x143748[_0x380f('0x8a')][_0x380f('0xa8')][_0x380f('0xa9')](','));}if(_0x377b4f){var _0x2f1c08={'ContactId':_0x377b4f['id'],'ChatWebsiteId':_0x143748[_0x380f('0x60')]['id'],'from':(_0x377b4f[_0x380f('0xaa')]||'')+'\x20'+(_0x377b4f[_0x380f('0xab')]||''),'customerIp':_0x20e315,'customerPort':_0x143748[_0x380f('0x8a')][_0x380f('0xac')]?_0x143748[_0x380f('0x8a')][_0x380f('0xac')]:null,'referer':_0x143748[_0x380f('0x5f')]['referer'],'browserName':_0x52bfe9[_0x380f('0xad')][_0x380f('0x39')]&&_0x52bfe9[_0x380f('0xad')][_0x380f('0xae')]?util[_0x380f('0xaf')](_0x380f('0xb0'),_0x52bfe9['browser']['name'],_0x52bfe9[_0x380f('0xad')][_0x380f('0xae')]):'unknown','browserVersion':_0x52bfe9[_0x380f('0xad')]['version']||_0x380f('0xb1'),'osName':util[_0x380f('0xaf')](_0x380f('0xb0'),_0x52bfe9['os'][_0x380f('0x39')],_0x52bfe9['os'][_0x380f('0xae')]),'osVersion':_0x52bfe9['os'][_0x380f('0xae')],'deviceModel':_0x52bfe9[_0x380f('0xb2')]['model']&&_0x52bfe9['device'][_0x380f('0xb3')]?util[_0x380f('0xaf')](_0x380f('0xb4'),_0x52bfe9[_0x380f('0xb2')]['model'],_0x52bfe9['device']['vendor'],_0x52bfe9[_0x380f('0xb2')][_0x380f('0x40')]):null,'deviceVendor':_0x52bfe9['device'][_0x380f('0xb3')],'deviceType':_0x52bfe9[_0x380f('0xb2')][_0x380f('0x40')],'formData':JSON['stringify'](_0x143748[_0x380f('0x5f')])};var _0x455ce5={'ChatWebsiteId':_0x143748[_0x380f('0x60')]['id'],'closed':![]};if(_0x143748[_0x380f('0x5f')][_0x380f('0xb5')]){_0x455ce5[_0x380f('0xb5')]=_0x143748[_0x380f('0x5f')][_0x380f('0xb5')];return db[_0x380f('0xb6')][_0x380f('0x5b')]({'where':_0x455ce5})[_0x380f('0x21')](function(_0x25a0db){if(_0x25a0db){return[_0x25a0db,![]];}_0x2f1c08[_0x380f('0xb5')]=_0x143748[_0x380f('0x5f')][_0x380f('0xb5')];_0x2f1c08[_0x380f('0xb7')]=_0x143748['body'][_0x380f('0xb7')];return db[_0x380f('0xb6')][_0x380f('0x57')](_0x2f1c08)[_0x380f('0x21')](function(_0x37d7ef){return[_0x37d7ef,!![]];});});}_0x455ce5[_0x380f('0xb8')]=_0x377b4f['id'];if(_0x143748['body']['interaction']&&_0x143748['body'][_0x380f('0xb9')]['id']){_0x455ce5['id']=_0x143748[_0x380f('0x5f')][_0x380f('0xb9')]['id'];return db[_0x380f('0xb6')][_0x380f('0x5b')]({'where':_0x455ce5})['then'](function(_0x4e28d0){if(_0x4e28d0){return[_0x4e28d0,![]];}return db[_0x380f('0xb6')][_0x380f('0x57')](_0x2f1c08)[_0x380f('0x21')](function(_0x4d88f2){return[_0x4d88f2,!![]];});});}return db[_0x380f('0xb6')]['create'](_0x2f1c08)[_0x380f('0x21')](function(_0x5dbd2b){return[_0x5dbd2b,!![]];});}})[_0x380f('0xba')](function(_0x97f4,_0xacefca){if(_0x97f4){_0x184f58=_0xacefca;if(!_0xacefca){var _0x17e2f9={'from':(_0x56f1f2[_0x380f('0xbb')][_0x380f('0xaa')]||'')+'\x20'+(_0x56f1f2[_0x380f('0xbb')]['lastName']||'')};if(_0x143748[_0x380f('0x5f')][_0x380f('0xb5')]&&_0x143748[_0x380f('0x5f')][_0x380f('0xbc')]&&_0x143748[_0x380f('0x5f')][_0x380f('0xb5')]!=_0x143748['body'][_0x380f('0xbc')]){_0x17e2f9[_0x380f('0xb5')]=_0x143748[_0x380f('0x5f')][_0x380f('0xbc')];}return _0x97f4[_0x380f('0x34')](_0x17e2f9);}else{return _0x97f4;}}})[_0x380f('0x21')](function(_0xfb209f){_0x56f1f2[_0x380f('0xb9')]=_0xfb209f['get']({'plain':!![]});_0x56f1f2[_0x380f('0xb9')][_0x380f('0xbd')]=_0x184f58;if(_0x56f1f2[_0x380f('0xb9')]['created']){if(_0x56f1f2[_0x380f('0xa3')][_0x380f('0xbe')]){_0x56f1f2[_0x380f('0x9f')][_0x380f('0xbf')]({'id':0x0,'priority':_0x56f1f2[_0x380f('0x9f')][_0x380f('0x48')]+0x1,'app':_0x380f('0xc0'),'appdata':_0x380f('0xc1'),'interval':_0x380f('0xc2')});}}return db[_0x380f('0xc3')][_0x380f('0x57')]({'body':_0x143748[_0x380f('0x5f')][_0x380f('0x5f')],'ChatWebsiteId':_0x143748[_0x380f('0x60')]['id'],'ChatInteractionId':_0xfb209f['id'],'direction':'in','ContactId':_0x56f1f2[_0x380f('0xbb')]['id'],'AttachmentId':_0x143748[_0x380f('0x5f')][_0x380f('0xc4')]});})[_0x380f('0x21')](function(_0xdcb2ac){_0x56f1f2[_0x380f('0x28')]=_0xdcb2ac;if(_0x56f1f2[_0x380f('0xb9')][_0x380f('0xc5')]){return db[_0x380f('0xc6')][_0x380f('0x5b')]({'attributes':['id','name'],'where':{'id':_0x56f1f2[_0x380f('0xb9')]['UserId']}})[_0x380f('0x21')](function(_0x32d72e){if(_0x32d72e){_0x56f1f2[_0x380f('0x9f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x380f('0xc7'),'appdata':_0x32d72e[_0x380f('0x39')]+','+(_0x56f1f2[_0x380f('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':_0x380f('0xc2')});_0x56f1f2[_0x380f('0xc8')]=!![];}return respondWithRpcPromise(_0x380f('0xc9'),_0x380f('0xca'),_0x56f1f2);});}return respondWithRpcPromise('Start',_0x380f('0xca'),_0x56f1f2);})[_0x380f('0x21')](function(_0x450f1e){respondWithRpcPromise(_0x380f('0xcb'),'EventManager',{'event':_0x380f('0xcc'),'message':_0x450f1e},client9002);return _0x450f1e;})[_0x380f('0x21')](respondWithResult(_0x1dd5f1,null))[_0x380f('0x2a')](handleError(_0x1dd5f1,null));};exports[_0x380f('0xcd')]=function(_0x1ab3ec,_0x4e0f30,_0x22ecbd){var _0x47dad7,_0x5d936c,_0x3761f9;var _0x350e2a=[];var _0x1fb509=[];var _0x4fe000={};return db[_0x380f('0x9b')][_0x380f('0x61')]()['then'](function(_0x44a6be){if(!_0x44a6be){throw new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x8d'));}_0x1fb509=_[_0x380f('0x8e')](_[_0x380f('0x43')](_0x44a6be),[_0x380f('0x90'),'updatedAt']);_0x350e2a=_['difference'](_[_0x380f('0x43')](_0x44a6be),[_0x380f('0x90'),'updatedAt',_0x380f('0x91'),_0x380f('0x92')]);if(_0x1ab3ec[_0x380f('0x5f')]['id']){delete _0x1ab3ec[_0x380f('0x5f')]['id'];}if(_[_0x380f('0x80')](_0x1ab3ec['body'][_0x380f('0x93')])){throw _0x4e0f30[_0x380f('0x2c')](0x1f4)[_0x380f('0xce')](new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0x94')));}if(_[_0x380f('0x80')](_0x1ab3ec[_0x380f('0x5f')][_0x380f('0x5f')])||_0x1ab3ec['body'][_0x380f('0x5f')]===''){throw _0x4e0f30[_0x380f('0x2c')](0x1f4)[_0x380f('0xce')](new db[(_0x380f('0x1d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x380f('0x80')](_0x1ab3ec[_0x380f('0x5f')][_0x380f('0xcf')])){throw _0x4e0f30['status'](0x1f4)[_0x380f('0xce')](new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))](_0x380f('0xd0')+_0x350e2a));}if(!_[_0x380f('0x98')](_0x350e2a,_0x1ab3ec[_0x380f('0x5f')][_0x380f('0xcf')])){throw _0x4e0f30['status'](0x1f4)[_0x380f('0xce')](new db[(_0x380f('0x1d'))][(_0x380f('0x1e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x350e2a));}_0x4fe000[_0x1ab3ec['body']['mapKeyOffline']]=_0x1ab3ec[_0x380f('0x5f')]['from'];})[_0x380f('0x21')](function(){return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x1ab3ec[_0x380f('0x60')]['id']},'include':[{'model':db[_0x380f('0xd1')],'as':_0x380f('0x9a')}]});})['then'](handleEntityNotFound(_0x4e0f30,null))[_0x380f('0x21')](function(_0x3159d7){if(_0x3159d7&&_0x3159d7['List']){_0x5d936c=_0x3159d7;var _0x1b6a4e=_['defaults'](_0x1ab3ec[_0x380f('0x5f')],{'firstName':_0x1ab3ec['body'][_0x380f('0x93')],'phone':_0x1ab3ec[_0x380f('0x5f')][_0x380f('0x93')],'ListId':_0x3159d7['ListId']});_0x1b6a4e[_0x1ab3ec['body'][_0x380f('0xcf')]]=_0x1ab3ec[_0x380f('0x5f')]['from'];return db['CmContact'][_0x380f('0xd2')]({'where':_0x4fe000,'defaults':_0x1b6a4e});}})[_0x380f('0xba')](function(_0x2d674f){if(_0x2d674f){_0x3761f9=_0x2d674f;var _0x109e38=fs[_0x380f('0xd3')](path['join'](config['root'],_0x380f('0xd4')),_0x380f('0xd5'));var _0x19c07f=ejs[_0x380f('0xd6')](_0x109e38,{'body':_[_0x380f('0xd7')](_0x1ab3ec['body'][_0x380f('0x5f')]),'bodyTitle':_0x5d936c[_0x380f('0xd8')]});return db[_0x380f('0xd9')][_0x380f('0x57')]({'body':_0x19c07f,'ContactId':_0x2d674f['id'],'ChatWebsiteId':_0x5d936c['id']});}})['then'](function(_0x3eaa22){if(_0x3eaa22){_0x47dad7=_0x3eaa22;return db[_0x380f('0xda')][_0x380f('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x380f('0xdb')],'as':_0x380f('0xdc'),'raw':!![]}]});}})[_0x380f('0x21')](function(_0x41f51e){if(_0x41f51e&&_0x41f51e[_0x380f('0xdc')]&&_0x5d936c[_0x380f('0xdd')]){var _0x52a568={'tls':{'rejectUnauthorized':![]}};if(_0x41f51e[_0x380f('0xdc')][_0x380f('0xde')]){_0x52a568[_0x380f('0xde')]=_0x41f51e['Smtp'][_0x380f('0xde')];}else{_0x52a568[_0x380f('0xdf')]=_0x41f51e['Smtp'][_0x380f('0xdf')];_0x52a568['port']=_0x41f51e[_0x380f('0xdc')][_0x380f('0xe0')];_0x52a568[_0x380f('0xe1')]=_0x41f51e[_0x380f('0xdc')][_0x380f('0xe1')];}if(_0x41f51e[_0x380f('0xdc')][_0x380f('0xe2')]){_0x52a568[_0x380f('0xe3')]={'user':_0x41f51e[_0x380f('0xdc')][_0x380f('0x58')],'pass':_0x41f51e[_0x380f('0xdc')][_0x380f('0xe4')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x52a568,'message':{'from':util[_0x380f('0xaf')](_0x380f('0xe5'),_0x41f51e['name'],_0x41f51e[_0x380f('0xe6')]||_0x41f51e['Smtp'][_0x380f('0x58')]),'to':_0x5d936c[_0x380f('0xdd')],'subject':_0x5d936c[_0x380f('0xe7')],'text':_0x47dad7['body']}},client9003)[_0x380f('0x21')](function(){return _0x47dad7;})[_0x380f('0x2a')](function(_0x880ce3){console[_0x380f('0x27')](_0x880ce3);});}})[_0x380f('0x21')](function(){if(_0x47dad7){return _0x47dad7;}})[_0x380f('0x21')](respondWithResult(_0x4e0f30,null))[_0x380f('0x2a')](handleError(_0x4e0f30,null));};exports[_0x380f('0xe8')]=function(_0x3b87fb,_0x2ef0c1,_0x32cec8){return db[_0x380f('0xb6')]['find']({'where':{'id':_0x3b87fb['params']['id']}})['then'](handleEntityNotFound(_0x2ef0c1,null))['then'](function(_0x2585c5){if(_0x2585c5){return _0x2585c5[_0x380f('0xe8')](_0x3b87fb[_0x380f('0x5f')]['ids'],_[_0x380f('0xe9')](_0x3b87fb[_0x380f('0x5f')],[_0x380f('0x68'),'id'])||{});}})[_0x380f('0x21')](respondWithResult(_0x2ef0c1,null))[_0x380f('0x2a')](handleError(_0x2ef0c1,null));};exports[_0x380f('0xea')]=function(_0xeceea5,_0x147925,_0x6c8c22){var _0x273ba9={'raw':![],'where':{}};var _0x5d2588={};var _0x1f63a7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x380f('0x66')]({'where':{'id':_0xeceea5['params']['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x147925,null))[_0x380f('0x21')](function(_0x34371b){if(_0x34371b){_0x5d2588['model']=_[_0x380f('0x43')](db[_0x380f('0xb6')]['rawAttributes']);_0x5d2588['query']=_['keys'](_0xeceea5[_0x380f('0x42')]);_0x5d2588['filters']=_[_0x380f('0x45')](_0x5d2588[_0x380f('0x41')],_0x5d2588[_0x380f('0x42')]);_0x273ba9['attributes']=_['intersection'](_0x5d2588[_0x380f('0x41')],qs[_0x380f('0x47')](_0xeceea5['query'][_0x380f('0x47')]));_0x273ba9[_0x380f('0x46')]=_0x273ba9['attributes']['length']?_0x273ba9[_0x380f('0x46')]:_0x5d2588[_0x380f('0x41')];if(!_0xeceea5['query']['hasOwnProperty'](_0x380f('0x4a'))){_0x273ba9['limit']=qs['limit'](_0xeceea5[_0x380f('0x42')][_0x380f('0x30')]);_0x273ba9[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0xeceea5[_0x380f('0x42')][_0x380f('0x2f')]);}_0x273ba9['order']=qs[_0x380f('0x4c')](_0xeceea5[_0x380f('0x42')][_0x380f('0x4c')]);_0x273ba9['where']=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0xeceea5[_0x380f('0x42')],_0x5d2588[_0x380f('0x44')]));_0x273ba9['where']['ChatWebsiteId']=_0x34371b['id'];if(_0xeceea5['query']['filter']){_0x273ba9[_0x380f('0x4d')]=_['merge'](_0x273ba9['where'],{'$or':_[_0x380f('0x3c')](_0x273ba9[_0x380f('0x46')],function(_0x227833){var _0x56e4b9={};_0x56e4b9[_0x227833]={'$like':'%'+_0xeceea5[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x56e4b9;})});}_0x273ba9=_['merge']({},_0x273ba9,_0xeceea5[_0x380f('0x51')]);return db[_0x380f('0xb6')][_0x380f('0x2e')]({'where':_0x273ba9[_0x380f('0x4d')]})[_0x380f('0x21')](function(_0x3e98df){_0x1f63a7[_0x380f('0x2e')]=_0x3e98df;if(_0xeceea5['query'][_0x380f('0x52')]){_0x273ba9[_0x380f('0x53')]=[{'model':db['CmContact'],'as':_0x380f('0xeb'),'required':![]},{'model':db[_0x380f('0xc6')],'as':_0x380f('0xec'),'attributes':[_0x380f('0x39'),'fullname',_0x380f('0xed')],'required':![]},{'model':db['Tag'],'as':_0x380f('0xee'),'attributes':['id',_0x380f('0x39'),_0x380f('0xef')],'where':_0xeceea5['query'][_0x380f('0xf0')]?{'id':_0xeceea5[_0x380f('0x42')]['tag']}:undefined,'required':_0xeceea5[_0x380f('0x42')]['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x273ba9);})['then'](function(_0x24fb4e){_0x1f63a7['rows']=_0x24fb4e;return _0x1f63a7;});}})[_0x380f('0x21')](respondWithFilteredResult(_0x147925,_0x273ba9))[_0x380f('0x2a')](handleError(_0x147925,null));};function iftimePromise(_0x2104f6,_0x248826){return respondWithRpcPromise('Command',_0x380f('0xf1'),{'command':_0x248826[_0x380f('0xf2')]?util[_0x380f('0xaf')](_0x380f('0xf3'),_0x2104f6[_0x380f('0xf4')],_0x248826[_0x380f('0xf2')]):util['format'](_0x380f('0xf5'),_0x2104f6[_0x380f('0xf4')])},client9002)[_0x380f('0x21')](function(_0xd5346d){var _0x52579=_0xd5346d&&_0xd5346d[_0x380f('0xf6')]('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x248826['id'],_0x2104f6['id'],_0x2104f6['interval'],_0x52579?'ONLINE':_0x380f('0xf7'),_0x248826[_0x380f('0xf2')]?_0x248826[_0x380f('0xf2')]:'No\x20timezone');return _0x52579;})[_0x380f('0x2a')](function(_0x17f6a9){logger['error'](_0x380f('0xf8'),_0x248826['id'],_0x2104f6['id'],_0x2104f6[_0x380f('0xf4')],util['inspect'](_0x17f6a9,{'showHidden':![],'depth':null}),_0x248826[_0x380f('0xf2')]?_0x248826[_0x380f('0xf2')]:'No\x20timezone');return![];});}exports[_0x380f('0xf1')]=function(_0x291c4d,_0x457f13,_0x176c5b){var _0x485a5c=0x0;var _0x397c43=0x0;var _0x44d95f=![];var _0x2ea79c;var _0x3d1844;return db[_0x380f('0x3d')][_0x380f('0x5b')]({'where':{'id':_0x291c4d[_0x380f('0x60')]['id']},'include':[{'model':db[_0x380f('0xf9')],'as':_0x380f('0xf9'),'include':[{'model':db[_0x380f('0xf9')],'as':_0x380f('0xfa'),'attributes':['id',_0x380f('0xf4')],'raw':!![]}]}]})[_0x380f('0x21')](handleEntityNotFound(_0x457f13,null))[_0x380f('0x21')](function(_0x37f178){if(_0x37f178){_0x2ea79c=_0x37f178;return _0x37f178[_0x380f('0xfb')]({'raw':!![]});}})['then'](function(_0xac51bb){if(_0x2ea79c){if(_0xac51bb){_0x3d1844=_0xac51bb;}}return require('../../config/license/util')[_0x380f('0x79')]();})['then'](function(_0x2e6d61){if(_0x2e6d61){_0x397c43=_0x2e6d61['virtual'];_0x44d95f=_0x2e6d61[_0x380f('0x7a')];}})[_0x380f('0x21')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x380f('0x21')](function(_0x26a47e){_0x485a5c=_0x26a47e;if(_0x397c43&&_0x26a47e>_0x397c43){return db[_0x380f('0xfc')]['findOne']({'where':{'id':0x1}})['then'](function(_0x910523){if(_0x910523){_0x910523['increment'](_0x380f('0xfd'));}});}})[_0x380f('0x21')](function(){if(_0x2ea79c['Interval']&&_0x2ea79c[_0x380f('0xf9')][_0x380f('0xfa')]){var _0x5a87f2=[];for(var _0x2a13d0=0x0;_0x2a13d0<_0x2ea79c[_0x380f('0xf9')][_0x380f('0xfa')][_0x380f('0x48')];_0x2a13d0++){var _0x3258cf=_0x2ea79c[_0x380f('0xf9')][_0x380f('0xfa')][_0x2a13d0][_0x380f('0x36')]({'plain':!![]});_0x5a87f2[_0x380f('0xbf')](iftimePromise(_0x3258cf,_0x2ea79c));}return BPromise[_0x380f('0xfe')](_0x5a87f2)['then'](function(_0x410b31){return _['some'](_0x410b31);});}else{return!![];}})[_0x380f('0x21')](function(_0x327491){var _0x2628be=fs[_0x380f('0xd3')](path['join'](config[_0x380f('0x7b')],_0x380f('0xff')),'utf8');var _0x1f11f4={'remote':_0x2ea79c['remote'],'query':querystring['stringify'](_[_0x380f('0x50')](_0x2ea79c[_0x380f('0x36')]({'plain':!![]}),{'customerIp':_0x291c4d[_0x380f('0x8a')]['x-forwarded-for']||_0x291c4d[_0x380f('0x8a')][_0x380f('0x100')]||_0x291c4d['connection']['remoteAddress']||_0x291c4d['ip'],'referer':_0x291c4d[_0x380f('0x8a')][_0x380f('0x101')],'openedInteractions':_0x485a5c,'maxInteractions':_0x397c43,'virtual':_0x44d95f[_0x380f('0x102')],'online':_0x327491,'custom':_0x44d95f}))['replace'](/'/g,'\x5c\x27')};_0x457f13[_0x380f('0xce')](ejs['render'](Mustache[_0x380f('0xd6')](_0x2628be,_0x1f11f4),{'proactiveActions':_0x3d1844,'alignment':_0x2ea79c[_0x380f('0x103')],'verticalAlignment':_0x2ea79c[_0x380f('0x104')],'div_color':_0x2ea79c[_0x380f('0xef')],'text_color':_0x2ea79c[_0x380f('0x105')]}));})[_0x380f('0x2a')](handleError(_0x457f13,null));};exports['addApplications']=function(_0x1b1e36,_0x599662,_0xf042e0){return db['ChatWebsite'][_0x380f('0x66')]({'where':{'id':_0x1b1e36[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x599662,null))['then'](function(_0x5adeaa){if(_0x5adeaa){return db[_0x380f('0x106')]['transaction'](function(_0x31b6af){return db[_0x380f('0x9d')][_0x380f('0x35')]({'where':{'ChatWebsiteId':_0x1b1e36[_0x380f('0x60')]['id']},'transaction':_0x31b6af})['then'](function(_0x411ab7){var _0x994ef7=_[_0x380f('0x3c')](_0x1b1e36['body'],function(_0x4bf2e4){_0x4bf2e4[_0x380f('0x63')]=_0x1b1e36[_0x380f('0x60')]['id'];return _0x4bf2e4;});return db['ChatApplication']['bulkCreate'](_0x994ef7,{'transaction':_0x31b6af});});})[_0x380f('0x21')](function(){return db['ChatApplication'][_0x380f('0x107')]({'where':{'ChatWebsiteId':_0x1b1e36[_0x380f('0x60')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x599662,null))['catch'](handleError(_0x599662,null));};exports['getApplications']=function(_0x3513aa,_0x26f459,_0x4d0678){var _0x5826c9={};var _0x693600={};var _0x1221ea;var _0x41bcd0;return db[_0x380f('0x3d')]['findOne']({'where':{'id':_0x3513aa[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x26f459,null))[_0x380f('0x21')](function(_0x5abd22){if(_0x5abd22){_0x1221ea=_0x5abd22;_0x693600[_0x380f('0x41')]=_[_0x380f('0x43')](db['ChatApplication'][_0x380f('0x3e')]);_0x693600[_0x380f('0x42')]=_['keys'](_0x3513aa['query']);_0x693600[_0x380f('0x44')]=_[_0x380f('0x45')](_0x693600['model'],_0x693600[_0x380f('0x42')]);_0x5826c9[_0x380f('0x46')]=_[_0x380f('0x45')](_0x693600['model'],qs[_0x380f('0x47')](_0x3513aa[_0x380f('0x42')][_0x380f('0x47')]));_0x5826c9[_0x380f('0x46')]=_0x5826c9[_0x380f('0x46')][_0x380f('0x48')]?_0x5826c9[_0x380f('0x46')]:_0x693600[_0x380f('0x41')];_0x5826c9[_0x380f('0x4b')]=qs[_0x380f('0x4c')](_0x3513aa['query'][_0x380f('0x4c')]);_0x5826c9['where']=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0x3513aa['query'],_0x693600[_0x380f('0x44')]));if(_0x3513aa[_0x380f('0x42')][_0x380f('0x4f')]){_0x5826c9[_0x380f('0x4d')]=_[_0x380f('0x50')](_0x5826c9['where'],{'$or':_[_0x380f('0x3c')](_0x5826c9['attributes'],function(_0x997e51){var _0x412b11={};_0x412b11[_0x997e51]={'$like':'%'+_0x3513aa['query'][_0x380f('0x4f')]+'%'};return _0x412b11;})});}_0x5826c9=_[_0x380f('0x50')]({},_0x5826c9,_0x3513aa[_0x380f('0x51')]);return _0x1221ea[_0x380f('0x108')](_0x5826c9);}})[_0x380f('0x21')](function(_0xfb387b){if(_0xfb387b){_0x41bcd0=_0xfb387b[_0x380f('0x48')];if(!_0x3513aa[_0x380f('0x42')][_0x380f('0x49')](_0x380f('0x4a'))){_0x5826c9[_0x380f('0x30')]=qs[_0x380f('0x30')](_0x3513aa[_0x380f('0x42')][_0x380f('0x30')]);_0x5826c9[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x3513aa[_0x380f('0x42')][_0x380f('0x2f')]);}return _0x1221ea[_0x380f('0x108')](_0x5826c9);}})[_0x380f('0x21')](function(_0x4cc786){if(_0x4cc786){return _0x4cc786?{'count':_0x41bcd0,'rows':_0x4cc786}:null;}})[_0x380f('0x21')](respondWithResult(_0x26f459,null))[_0x380f('0x2a')](handleError(_0x26f459,null));};exports[_0x380f('0x109')]=function(_0x37b96e,_0x5c6d13,_0x5c0c41){return db[_0x380f('0x10a')][_0x380f('0x5b')]({'where':{'id':_0x37b96e[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x5c6d13,null))[_0x380f('0x21')](function(_0x222f24){if(_0x222f24){return _0x222f24[_0x380f('0x109')](_0x37b96e[_0x380f('0x5f')]['ids'],_[_0x380f('0xe9')](_0x37b96e[_0x380f('0x5f')],['ids','id'])||{});}})[_0x380f('0x21')](respondWithResult(_0x5c6d13,null))['catch'](handleError(_0x5c6d13,null));};exports[_0x380f('0xfb')]=function(_0x84abba,_0x14dbc2,_0x2191ee){var _0x2ab782={};var _0x2baa2c={};var _0x53435f;var _0xfbe581;return db['ChatWebsite']['findOne']({'where':{'id':_0x84abba[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x14dbc2,null))[_0x380f('0x21')](function(_0x2f6b13){if(_0x2f6b13){_0x53435f=_0x2f6b13;_0x2baa2c['model']=_[_0x380f('0x43')](db[_0x380f('0x10b')][_0x380f('0x3e')]);_0x2baa2c[_0x380f('0x42')]=_[_0x380f('0x43')](_0x84abba['query']);_0x2baa2c[_0x380f('0x44')]=_[_0x380f('0x45')](_0x2baa2c[_0x380f('0x41')],_0x2baa2c[_0x380f('0x42')]);_0x2ab782['attributes']=_['intersection'](_0x2baa2c['model'],qs[_0x380f('0x47')](_0x84abba[_0x380f('0x42')]['fields']));_0x2ab782[_0x380f('0x46')]=_0x2ab782[_0x380f('0x46')][_0x380f('0x48')]?_0x2ab782[_0x380f('0x46')]:_0x2baa2c['model'];_0x2ab782[_0x380f('0x4b')]=qs[_0x380f('0x4c')](_0x84abba[_0x380f('0x42')]['sort']);_0x2ab782[_0x380f('0x4d')]=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0x84abba[_0x380f('0x42')],_0x2baa2c[_0x380f('0x44')]));if(_0x84abba['query'][_0x380f('0x4f')]){_0x2ab782['where']=_['merge'](_0x2ab782[_0x380f('0x4d')],{'$or':_['map'](_0x2ab782[_0x380f('0x46')],function(_0x452d5b){var _0x2d97bd={};_0x2d97bd[_0x452d5b]={'$like':'%'+_0x84abba[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x2d97bd;})});}_0x2ab782=_[_0x380f('0x50')]({},_0x2ab782,_0x84abba[_0x380f('0x51')]);return _0x53435f[_0x380f('0xfb')](_0x2ab782);}})[_0x380f('0x21')](function(_0x364ec5){if(_0x364ec5){_0xfbe581=_0x364ec5[_0x380f('0x48')];if(!_0x84abba[_0x380f('0x42')]['hasOwnProperty'](_0x380f('0x4a'))){_0x2ab782['limit']=qs[_0x380f('0x30')](_0x84abba[_0x380f('0x42')][_0x380f('0x30')]);_0x2ab782[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x84abba[_0x380f('0x42')][_0x380f('0x2f')]);}return _0x53435f[_0x380f('0xfb')](_0x2ab782);}})[_0x380f('0x21')](function(_0x240ef8){if(_0x240ef8){return _0x240ef8?{'count':_0xfbe581,'rows':_0x240ef8}:null;}})['then'](respondWithResult(_0x14dbc2,null))['catch'](handleError(_0x14dbc2,null));};exports[_0x380f('0x10c')]=function(_0x4d1b9c,_0x3f0d61,_0xb9a98c){var _0x4574e2=_0x4d1b9c[_0x380f('0x42')][_0x380f('0x10d')]===_0x380f('0x10e')?'offlineForm':'onlineForm';return db[_0x380f('0x3d')][_0x380f('0x5b')]({'attributes':['id',_0x4574e2],'where':{'id':_0x4d1b9c['params']['id']}})['then'](handleEntityNotFound(_0x3f0d61,null))[_0x380f('0x21')](function(_0x191023){if(_0x191023){var _0x58e58d=_0x191023[_0x4574e2];var _0x8dda88=_0x58e58d&&_0x58e58d['items']?_0x58e58d[_0x380f('0x10f')]:[];_0x3f0d61['send']({'fromKey':_[_0x380f('0x80')](_0x58e58d[_0x380f('0x110')])?undefined:_0x58e58d[_0x380f('0x110')],'count':_0x8dda88[_0x380f('0x48')],'rows':_0x8dda88});}})[_0x380f('0x2a')](handleError(_0x3f0d61,null));};exports['getOfflineMessages']=function(_0x5a3489,_0x4482cf,_0x1d9ded){var _0x45c217={'raw':![],'where':{}};var _0x55bb45={};var _0x428868={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x380f('0x66')]({'where':{'id':_0x5a3489['params']['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x4482cf,null))['then'](function(_0x5b0d20){if(_0x5b0d20){_0x55bb45['model']=_['keys'](db[_0x380f('0xd9')][_0x380f('0x3e')]);_0x55bb45[_0x380f('0x42')]=_[_0x380f('0x43')](_0x5a3489['query']);_0x55bb45['filters']=_['intersection'](_0x55bb45[_0x380f('0x41')],_0x55bb45[_0x380f('0x42')]);_0x45c217['attributes']=_[_0x380f('0x45')](_0x55bb45[_0x380f('0x41')],qs['fields'](_0x5a3489[_0x380f('0x42')][_0x380f('0x47')]));_0x45c217[_0x380f('0x46')]=_0x45c217[_0x380f('0x46')][_0x380f('0x48')]?_0x45c217[_0x380f('0x46')]:_0x55bb45[_0x380f('0x41')];if(!_0x5a3489['query'][_0x380f('0x49')](_0x380f('0x4a'))){_0x45c217[_0x380f('0x30')]=qs[_0x380f('0x30')](_0x5a3489['query']['limit']);_0x45c217[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x5a3489['query']['offset']);}_0x45c217[_0x380f('0x4b')]=qs['sort'](_0x5a3489['query'][_0x380f('0x4c')]);_0x45c217[_0x380f('0x4d')]=qs[_0x380f('0x44')](_[_0x380f('0x4e')](_0x5a3489[_0x380f('0x42')],_0x55bb45[_0x380f('0x44')]));_0x45c217[_0x380f('0x4d')][_0x380f('0x63')]=_0x5b0d20['id'];if(_0x5a3489[_0x380f('0x42')]['filter']){_0x45c217[_0x380f('0x4d')]=_[_0x380f('0x50')](_0x45c217[_0x380f('0x4d')],{'$or':_['map'](_0x45c217[_0x380f('0x46')],function(_0x13ee77){var _0x61858d={};_0x61858d[_0x13ee77]={'$like':'%'+_0x5a3489[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x61858d;})});}_0x45c217=_[_0x380f('0x50')]({},_0x45c217,_0x5a3489['options']);return db[_0x380f('0xd9')][_0x380f('0x2e')]({'where':_0x45c217[_0x380f('0x4d')]})['then'](function(_0xf315bf){_0x428868[_0x380f('0x2e')]=_0xf315bf;if(_0x5a3489['query']['includeAll']){_0x45c217[_0x380f('0x53')]=[{'all':!![]}];}else{_0x45c217[_0x380f('0x53')]=[{'model':db['CmContact'],'as':_0x380f('0xeb'),'required':![]}];}return db[_0x380f('0xd9')][_0x380f('0x54')](_0x45c217);})[_0x380f('0x21')](function(_0x4e9ec4){_0x428868['rows']=_0x4e9ec4;return _0x428868;});}})[_0x380f('0x21')](respondWithFilteredResult(_0x4482cf,_0x45c217))[_0x380f('0x2a')](handleError(_0x4482cf,null));};exports[_0x380f('0x111')]=function(_0x49fa3f,_0x2abac7,_0x4dc8){return db[_0x380f('0x3d')]['find']({'where':{'id':_0x49fa3f['params']['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x2abac7,null))['then'](function(_0x3cd805){if(_0x3cd805){return _0x3cd805[_0x380f('0x111')](_0x49fa3f[_0x380f('0x5f')][_0x380f('0x68')],_[_0x380f('0xe9')](_0x49fa3f['body'],['ids','id'])||{})[_0x380f('0xba')](function(_0x2dde10){for(var _0x393633=0x0;_0x393633<_0x49fa3f[_0x380f('0x5f')][_0x380f('0x68')][_0x380f('0x48')];_0x393633+=0x1){socket[_0x380f('0x112')]('userChatWebsite:save',{'UserId':_0x49fa3f['body'][_0x380f('0x68')][_0x393633],'ChatWebsiteId':_0x49fa3f[_0x380f('0x60')]['id']});}return _0x2dde10;});}})[_0x380f('0x21')](respondWithResult(_0x2abac7,null))['catch'](handleError(_0x2abac7,null));};exports['removeAgents']=function(_0x360ac7,_0x2abebb,_0x388102){return db[_0x380f('0x3d')]['find']({'where':{'id':_0x360ac7[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x2abebb,null))[_0x380f('0x21')](function(_0x106ae1){if(_0x106ae1){return _0x106ae1[_0x380f('0x113')](_0x360ac7['query'][_0x380f('0x68')])[_0x380f('0x21')](function(){if(_['isArray'](_0x360ac7[_0x380f('0x42')][_0x380f('0x68')])){for(var _0x324b87=0x0;_0x324b87<_0x360ac7[_0x380f('0x42')][_0x380f('0x68')][_0x380f('0x48')];_0x324b87+=0x1){socket[_0x380f('0x112')](_0x380f('0x114'),{'UserId':Number(_0x360ac7[_0x380f('0x42')][_0x380f('0x68')][_0x324b87]),'ChatWebsiteId':Number(_0x360ac7[_0x380f('0x60')]['id'])});}}else{socket[_0x380f('0x112')](_0x380f('0x114'),{'UserId':Number(_0x360ac7[_0x380f('0x42')]['ids']),'ChatWebsiteId':Number(_0x360ac7['params']['id'])});}});}})[_0x380f('0x21')](respondWithStatusCode(_0x2abebb,null))['catch'](handleError(_0x2abebb,null));};exports[_0x380f('0x115')]=function(_0x104c44,_0x194e23,_0x3cf479){var _0x29f62d={};var _0x4e2c6c={};var _0xa74cae;var _0x9af0ab;return db['ChatWebsite']['findOne']({'where':{'id':_0x104c44[_0x380f('0x60')]['id']}})[_0x380f('0x21')](handleEntityNotFound(_0x194e23,null))[_0x380f('0x21')](function(_0xfe41bd){if(_0xfe41bd){_0xa74cae=_0xfe41bd;_0x4e2c6c[_0x380f('0x41')]=_[_0x380f('0x43')](db['User'][_0x380f('0x3e')]);_0x4e2c6c[_0x380f('0x42')]=_['keys'](_0x104c44['query']);_0x4e2c6c['filters']=_[_0x380f('0x45')](_0x4e2c6c[_0x380f('0x41')],_0x4e2c6c['query']);_0x29f62d[_0x380f('0x46')]=_[_0x380f('0x45')](_0x4e2c6c[_0x380f('0x41')],qs[_0x380f('0x47')](_0x104c44[_0x380f('0x42')]['fields']));_0x29f62d[_0x380f('0x46')]=_0x29f62d[_0x380f('0x46')]['length']?_0x29f62d[_0x380f('0x46')]:_0x4e2c6c[_0x380f('0x41')];_0x29f62d[_0x380f('0x4b')]=qs[_0x380f('0x4c')](_0x104c44[_0x380f('0x42')]['sort']);_0x29f62d[_0x380f('0x4d')]=qs[_0x380f('0x44')](_['pick'](_0x104c44[_0x380f('0x42')],_0x4e2c6c['filters']));if(_0x104c44[_0x380f('0x42')][_0x380f('0x4f')]){_0x29f62d[_0x380f('0x4d')]=_[_0x380f('0x50')](_0x29f62d[_0x380f('0x4d')],{'$or':_['map'](_0x29f62d[_0x380f('0x46')],function(_0x37bed8){var _0x35714a={};_0x35714a[_0x37bed8]={'$like':'%'+_0x104c44[_0x380f('0x42')][_0x380f('0x4f')]+'%'};return _0x35714a;})});}_0x29f62d=_[_0x380f('0x50')]({},_0x29f62d,_0x104c44[_0x380f('0x51')]);return _0xa74cae['getAgents'](_0x29f62d);}})[_0x380f('0x21')](function(_0x213725){if(_0x213725){_0x9af0ab=_0x213725['length'];if(!_0x104c44['query']['hasOwnProperty'](_0x380f('0x4a'))){_0x29f62d[_0x380f('0x30')]=qs[_0x380f('0x30')](_0x104c44[_0x380f('0x42')]['limit']);_0x29f62d[_0x380f('0x2f')]=qs[_0x380f('0x2f')](_0x104c44[_0x380f('0x42')][_0x380f('0x2f')]);}return _0xa74cae['getAgents'](_0x29f62d);}})[_0x380f('0x21')](function(_0x549016){if(_0x549016){return _0x549016?{'count':_0x9af0ab,'rows':_0x549016}:null;}})['then'](respondWithResult(_0x194e23,null))['catch'](handleError(_0x194e23,null));}; \ No newline at end of file +var _0xe02b=['tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','some','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','alignment','color','sequelize','transaction','findAndCountAll','priority','getApplications','chatProactiveAction','addProactiveActions','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','limit','set','reject','save','destroy','get','ChatWebsites','UserProfileResource','sendStatus','name','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show','Pause','keys','length','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rows','ids','nolimit','order','CannedAnswer','removeAnswers','addLogo','addAvatar','agentAvatar','file','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','ChatApplication','applications','Applications','list','orderBy','asc','account','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','notify','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','getInteractions','Contact','Owner'];(function(_0x508aa9,_0x26fcad){var _0x3e17e4=function(_0x5437f3){while(--_0x5437f3){_0x508aa9['push'](_0x508aa9['shift']());}};_0x3e17e4(++_0x26fcad);}(_0xe02b,0x144));var _0xbe02=function(_0x4fde9a,_0x5d1eda){_0x4fde9a=_0x4fde9a-0x0;var _0x58f321=_0xe02b[_0x4fde9a];return _0x58f321;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe02('0x0'));var rimraf=require(_0xbe02('0x1'));var zipdir=require(_0xbe02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe02('0x3'));var moment=require(_0xbe02('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe02('0x5'));var util=require(_0xbe02('0x6'));var path=require('path');var sox=require(_0xbe02('0x7'));var csv=require(_0xbe02('0x8'));var ejs=require(_0xbe02('0x9'));var fs=require('fs');var _=require(_0xbe02('0xa'));var squel=require(_0xbe02('0xb'));var crypto=require(_0xbe02('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe02('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe02('0xe'));var Papa=require(_0xbe02('0xf'));var Redis=require('ioredis');var authService=require(_0xbe02('0x10'));var qs=require(_0xbe02('0x11'));var as=require(_0xbe02('0x12'));var hardwareService=require(_0xbe02('0x13'));var logger=require(_0xbe02('0x14'))(_0xbe02('0x15'));var utils=require(_0xbe02('0x16'));var config=require('../../config/environment');var db=require(_0xbe02('0x17'))['db'];config[_0xbe02('0x18')]=_[_0xbe02('0x19')](config[_0xbe02('0x18')],{'host':_0xbe02('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe02('0x18')]));require(_0xbe02('0x1b'))[_0xbe02('0x1c')](socket);var jayson=require(_0xbe02('0x1d'));var client=jayson['client'][_0xbe02('0x1e')]({'port':0x232c});var client9002=jayson[_0xbe02('0x1f')][_0xbe02('0x1e')]({'port':0x232a});var client9003=jayson[_0xbe02('0x1f')][_0xbe02('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x2643eb,_0x4539a4,_0x320c9d){if(_0x320c9d){var _0x2b3b1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b3b1f['test'](_0x4539a4)){return _0x2643eb;}else{throw new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x22'));}}else{return _0x2643eb;}}function respondWithRpcPromise(_0x3da871,_0x4174dd,_0x51ac78,_0x52a972){return new BPromise(function(_0x13b52f,_0x29a059){var _0x34506c=_0x52a972||client;return _0x34506c['request'](_0x3da871,_0x51ac78)[_0xbe02('0x23')](function(_0x4c0c09){logger[_0xbe02('0x24')](_0xbe02('0x25'),_0x4174dd,_0xbe02('0x26'));logger[_0xbe02('0x27')](_0xbe02('0x28'),_0x4174dd,_0xbe02('0x26'),JSON[_0xbe02('0x29')](_0x4c0c09));if(_0x4c0c09[_0xbe02('0x2a')]){if(_0x4c0c09['error'][_0xbe02('0x2b')]===0x1f4){logger['error'](_0xbe02('0x25'),_0x4174dd,_0x4c0c09[_0xbe02('0x2a')][_0xbe02('0x2c')]);return _0x29a059(_0x4c0c09[_0xbe02('0x2a')][_0xbe02('0x2c')]);}logger[_0xbe02('0x2a')](_0xbe02('0x25'),_0x4174dd,_0x4c0c09['error'][_0xbe02('0x2c')]);return _0x13b52f(_0x4c0c09[_0xbe02('0x2a')][_0xbe02('0x2c')]);}else{logger[_0xbe02('0x24')](_0xbe02('0x25'),_0x4174dd,_0xbe02('0x26'));_0x13b52f(_0x4c0c09[_0xbe02('0x2d')][_0xbe02('0x2c')]);}})['catch'](function(_0x3e919c){logger[_0xbe02('0x2a')](_0xbe02('0x25'),_0x4174dd,_0x3e919c);_0x29a059(_0x3e919c);});});}function respondWithStatusCode(_0x54b7e3,_0x46947a){_0x46947a=_0x46947a||0xcc;return function(_0x2bdd76){if(_0x2bdd76){return _0x54b7e3['sendStatus'](_0x46947a);}return _0x54b7e3[_0xbe02('0x2e')](_0x46947a)[_0xbe02('0x2f')]();};}function respondWithResult(_0x1b5324,_0x5b81af){_0x5b81af=_0x5b81af||0xc8;return function(_0x25f623){if(_0x25f623){return _0x1b5324[_0xbe02('0x2e')](_0x5b81af)[_0xbe02('0x30')](_0x25f623);}};}function respondWithFilteredResult(_0x30b8ba,_0x9cf528){return function(_0x4f74f4){if(_0x4f74f4){var _0x2218d2=_0x4f74f4[_0xbe02('0x31')],_0x57a43b=_0x9cf528[_0xbe02('0x32')],_0x3b97e6=_0x9cf528['offset']+_0x9cf528[_0xbe02('0x33')],_0x5c0d67;if(_0x3b97e6>=_0x2218d2){_0x3b97e6=_0x2218d2;_0x5c0d67=0xc8;}else{_0x5c0d67=0xce;}_0x30b8ba[_0xbe02('0x2e')](_0x5c0d67);return _0x30b8ba[_0xbe02('0x34')]('Content-Range',_0x57a43b+'-'+_0x3b97e6+'/'+_0x2218d2)[_0xbe02('0x30')](_0x4f74f4);}return null;};}function patchUpdates(_0x30d5c4){return function(_0x478a62){try{jsonpatch['apply'](_0x478a62,_0x30d5c4,!![]);}catch(_0x53a67d){return BPromise[_0xbe02('0x35')](_0x53a67d);}return _0x478a62[_0xbe02('0x36')]();};}function saveUpdates(_0x2e5465,_0x4e7a0b){return function(_0x5bcd9b){if(_0x5bcd9b){return _0x5bcd9b['update'](_0x2e5465)[_0xbe02('0x23')](function(_0xc482ad){return _0xc482ad;});}return null;};}function removeEntity(_0x337f8a,_0x49677d){return function(_0xd571ad){if(_0xd571ad){return _0xd571ad[_0xbe02('0x37')]()[_0xbe02('0x23')](function(){var _0x556dc4=_0xd571ad[_0xbe02('0x38')]({'plain':!![]});var _0x36fe23=_0xbe02('0x39');return db[_0xbe02('0x3a')][_0xbe02('0x37')]({'where':{'type':_0x36fe23,'resourceId':_0x556dc4['id']}})[_0xbe02('0x23')](function(){return _0xd571ad;});})[_0xbe02('0x23')](function(){_0x337f8a[_0xbe02('0x2e')](0xcc)[_0xbe02('0x2f')]();});}};}function handleEntityNotFound(_0x54f3dd,_0x35239a){return function(_0x54c688){if(!_0x54c688){_0x54f3dd[_0xbe02('0x3b')](0x194);}return _0x54c688;};}function handleError(_0x2edb8e,_0x37e784){_0x37e784=_0x37e784||0x1f4;return function(_0x30035a){logger[_0xbe02('0x2a')](_0x30035a['stack']);if(_0x30035a[_0xbe02('0x3c')]){delete _0x30035a[_0xbe02('0x3c')];}_0x2edb8e['status'](_0x37e784)['send'](_0x30035a);};}exports[_0xbe02('0x3d')]=function(_0x4bd7ca,_0x3e077f){var _0x1858ca={'include':[{'model':db['Pause'],'as':_0xbe02('0x3e')}]},_0x2a4b83={},_0x42e5cf={'count':0x0,'rows':[]};var _0x59b9f8=_[_0xbe02('0x3f')](db[_0xbe02('0x40')][_0xbe02('0x41')],function(_0x3a4d3d){return{'name':_0x3a4d3d['fieldName'],'type':_0x3a4d3d[_0xbe02('0x42')][_0xbe02('0x43')]};});_0x2a4b83[_0xbe02('0x44')]=_[_0xbe02('0x3f')](_0x59b9f8,_0xbe02('0x3c'));_0x2a4b83[_0xbe02('0x45')]=_['keys'](_0x4bd7ca[_0xbe02('0x45')]);_0x2a4b83[_0xbe02('0x46')]=_['intersection'](_0x2a4b83[_0xbe02('0x44')],_0x2a4b83[_0xbe02('0x45')]);_0x1858ca[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x2a4b83['model'],qs[_0xbe02('0x49')](_0x4bd7ca[_0xbe02('0x45')]['fields']));_0x1858ca['attributes']=_0x1858ca[_0xbe02('0x47')]['length']?_0x1858ca[_0xbe02('0x47')]:_0x2a4b83[_0xbe02('0x44')];if(!_0x4bd7ca[_0xbe02('0x45')][_0xbe02('0x4a')]('nolimit')){_0x1858ca[_0xbe02('0x33')]=qs[_0xbe02('0x33')](_0x4bd7ca[_0xbe02('0x45')][_0xbe02('0x33')]);_0x1858ca[_0xbe02('0x32')]=qs['offset'](_0x4bd7ca[_0xbe02('0x45')][_0xbe02('0x32')]);}_0x1858ca['order']=qs[_0xbe02('0x4b')](_0x4bd7ca['query'][_0xbe02('0x4b')]);_0x1858ca[_0xbe02('0x4c')]=qs[_0xbe02('0x46')](_[_0xbe02('0x4d')](_0x4bd7ca[_0xbe02('0x45')],_0x2a4b83[_0xbe02('0x46')]),_0x59b9f8);if(_0x4bd7ca[_0xbe02('0x45')]['filter']){_0x1858ca[_0xbe02('0x4c')]=_[_0xbe02('0x4e')](_0x1858ca[_0xbe02('0x4c')],{'$or':_[_0xbe02('0x3f')](_0x59b9f8,function(_0x57a294){if(_0x57a294['type']!=='VIRTUAL'){var _0x455813={};_0x455813[_0x57a294[_0xbe02('0x3c')]]={'$like':'%'+_0x4bd7ca[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x455813;}})});}_0x1858ca=_['merge']({},_0x1858ca,_0x4bd7ca['options']);var _0x381bac={'where':_0x1858ca[_0xbe02('0x4c')]};return db[_0xbe02('0x40')]['count'](_0x381bac)[_0xbe02('0x23')](function(_0x44ed6f){_0x42e5cf[_0xbe02('0x31')]=_0x44ed6f;if(_0x4bd7ca['query'][_0xbe02('0x50')]){_0x1858ca[_0xbe02('0x51')]=[{'all':!![]}];}return db[_0xbe02('0x40')][_0xbe02('0x52')](_0x1858ca);})[_0xbe02('0x23')](function(_0x2d2188){_0x42e5cf['rows']=_0x2d2188;return _0x42e5cf;})[_0xbe02('0x23')](respondWithFilteredResult(_0x3e077f,_0x1858ca))[_0xbe02('0x53')](handleError(_0x3e077f,null));};exports[_0xbe02('0x54')]=function(_0x49e24b,_0x205f2e){var _0x4237fc={'raw':![],'where':{'id':_0x49e24b['params']['id']},'include':[{'model':db[_0xbe02('0x55')],'as':_0xbe02('0x3e')}]},_0x529611={};_0x529611[_0xbe02('0x44')]=_[_0xbe02('0x56')](db['ChatWebsite'][_0xbe02('0x41')]);_0x529611[_0xbe02('0x45')]=_[_0xbe02('0x56')](_0x49e24b[_0xbe02('0x45')]);_0x529611[_0xbe02('0x46')]=_['intersection'](_0x529611[_0xbe02('0x44')],_0x529611[_0xbe02('0x45')]);_0x4237fc['attributes']=_['intersection'](_0x529611[_0xbe02('0x44')],qs[_0xbe02('0x49')](_0x49e24b[_0xbe02('0x45')][_0xbe02('0x49')]));_0x4237fc[_0xbe02('0x47')]=_0x4237fc['attributes'][_0xbe02('0x57')]?_0x4237fc[_0xbe02('0x47')]:_0x529611[_0xbe02('0x44')];if(_0x49e24b[_0xbe02('0x45')][_0xbe02('0x50')]){_0x4237fc[_0xbe02('0x51')]=[{'all':!![]}];}_0x4237fc=_[_0xbe02('0x4e')]({},_0x4237fc,_0x49e24b[_0xbe02('0x58')]);return db[_0xbe02('0x40')][_0xbe02('0x59')](_0x4237fc)[_0xbe02('0x23')](handleEntityNotFound(_0x205f2e,null))[_0xbe02('0x23')](respondWithResult(_0x205f2e,null))[_0xbe02('0x53')](handleError(_0x205f2e,null));};exports[_0xbe02('0x5a')]=function(_0x5b4826,_0x5dcd11){return db[_0xbe02('0x40')][_0xbe02('0x5a')](_0x5b4826[_0xbe02('0x5b')],{})[_0xbe02('0x23')](function(_0x4a6f6f){var _0x3f2e11=_0x5b4826[_0xbe02('0x5c')]['get']({'plain':!![]});if(!_0x3f2e11)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f2e11['role']===_0xbe02('0x5c')){var _0x4fc105=_0x4a6f6f['get']({'plain':!![]});var _0x10a7df=_0xbe02('0x39');return db[_0xbe02('0x5d')][_0xbe02('0x59')]({'where':{'name':_0x10a7df,'userProfileId':_0x3f2e11[_0xbe02('0x5e')]},'raw':!![]})[_0xbe02('0x23')](function(_0x45e7ff){if(_0x45e7ff&&_0x45e7ff[_0xbe02('0x5f')]===0x0){return db[_0xbe02('0x3a')][_0xbe02('0x5a')]({'name':_0x4fc105[_0xbe02('0x3c')],'resourceId':_0x4fc105['id'],'type':_0x45e7ff[_0xbe02('0x3c')],'sectionId':_0x45e7ff['id']},{})['then'](function(){return _0x4a6f6f;});}else{return _0x4a6f6f;}})[_0xbe02('0x53')](function(_0x4698ba){logger['error'](_0xbe02('0x60'),_0x4698ba);throw _0x4698ba;});}return _0x4a6f6f;})[_0xbe02('0x23')](respondWithResult(_0x5dcd11,0xc9))[_0xbe02('0x53')](handleError(_0x5dcd11,null));};exports[_0xbe02('0x61')]=function(_0x2a945b,_0x11f94f){if(_0x2a945b[_0xbe02('0x5b')]['id']){delete _0x2a945b[_0xbe02('0x5b')]['id'];}return db[_0xbe02('0x40')]['find']({'where':{'id':_0x2a945b[_0xbe02('0x62')]['id']},'include':[{'model':db[_0xbe02('0x55')],'as':_0xbe02('0x3e')}]})[_0xbe02('0x23')](handleEntityNotFound(_0x11f94f,null))['then'](saveUpdates(_0x2a945b[_0xbe02('0x5b')],null))[_0xbe02('0x23')](respondWithResult(_0x11f94f,null))['catch'](handleError(_0x11f94f,null));};exports[_0xbe02('0x37')]=function(_0x2ed8d1,_0x4353d9){return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x2ed8d1[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x4353d9,null))[_0xbe02('0x23')](removeEntity(_0x4353d9,null))['catch'](handleError(_0x4353d9,null));};exports[_0xbe02('0x63')]=function(_0x36a1b9,_0x46487c){return db[_0xbe02('0x40')][_0xbe02('0x63')]()[_0xbe02('0x23')](respondWithResult(_0x46487c,null))[_0xbe02('0x53')](handleError(_0x46487c,null));};exports['addDisposition']=function(_0x4c7f66,_0x540290,_0x5cc17a){if(_0x4c7f66[_0xbe02('0x5b')]['id']){delete _0x4c7f66[_0xbe02('0x5b')]['id'];}return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x4c7f66[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x540290,null))[_0xbe02('0x23')](function(_0x37450b){if(_0x37450b){_0x4c7f66[_0xbe02('0x5b')][_0xbe02('0x64')]=_0x37450b['id'];return db[_0xbe02('0x65')]['create'](_0x4c7f66[_0xbe02('0x5b')]);}})[_0xbe02('0x23')](respondWithResult(_0x540290,null))[_0xbe02('0x53')](handleError(_0x540290,null));};exports[_0xbe02('0x66')]=function(_0x7714b5,_0x1a875d,_0x8192){var _0x2b5a8e={'raw':![],'where':{}};var _0x4ef5d1={};var _0x272c05={'count':0x0,'rows':[]};return db[_0xbe02('0x40')][_0xbe02('0x67')]({'where':{'id':_0x7714b5[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x1a875d,null))[_0xbe02('0x23')](function(_0x105544){if(_0x105544){_0x4ef5d1[_0xbe02('0x44')]=_['keys'](db['Disposition'][_0xbe02('0x41')]);_0x4ef5d1[_0xbe02('0x45')]=_[_0xbe02('0x56')](_0x7714b5[_0xbe02('0x45')]);_0x4ef5d1[_0xbe02('0x46')]=_[_0xbe02('0x48')](_0x4ef5d1[_0xbe02('0x44')],_0x4ef5d1[_0xbe02('0x45')]);_0x2b5a8e[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x4ef5d1['model'],qs[_0xbe02('0x49')](_0x7714b5['query'][_0xbe02('0x49')]));_0x2b5a8e[_0xbe02('0x47')]=_0x2b5a8e[_0xbe02('0x47')]['length']?_0x2b5a8e[_0xbe02('0x47')]:_0x4ef5d1[_0xbe02('0x44')];if(!_0x7714b5[_0xbe02('0x45')][_0xbe02('0x4a')]('nolimit')){_0x2b5a8e['limit']=qs['limit'](_0x7714b5[_0xbe02('0x45')][_0xbe02('0x33')]);_0x2b5a8e[_0xbe02('0x32')]=qs['offset'](_0x7714b5[_0xbe02('0x45')][_0xbe02('0x32')]);}_0x2b5a8e['order']=qs[_0xbe02('0x4b')](_0x7714b5['query'][_0xbe02('0x4b')]);_0x2b5a8e[_0xbe02('0x4c')]=qs[_0xbe02('0x46')](_[_0xbe02('0x4d')](_0x7714b5[_0xbe02('0x45')],_0x4ef5d1[_0xbe02('0x46')]));_0x2b5a8e[_0xbe02('0x4c')]['ChatWebsiteId']=_0x105544['id'];if(_0x7714b5[_0xbe02('0x45')][_0xbe02('0x4f')]){_0x2b5a8e[_0xbe02('0x4c')]=_['merge'](_0x2b5a8e['where'],{'$or':_[_0xbe02('0x3f')](_0x2b5a8e[_0xbe02('0x47')],function(_0x16770a){var _0x21020d={};_0x21020d[_0x16770a]={'$like':'%'+_0x7714b5[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x21020d;})});}_0x2b5a8e=_[_0xbe02('0x4e')]({},_0x2b5a8e,_0x7714b5[_0xbe02('0x58')]);return db[_0xbe02('0x65')]['count']({'where':_0x2b5a8e[_0xbe02('0x4c')]})['then'](function(_0x259e21){_0x272c05['count']=_0x259e21;if(_0x7714b5[_0xbe02('0x45')][_0xbe02('0x50')]){_0x2b5a8e['include']=[{'all':!![]}];}return db[_0xbe02('0x65')][_0xbe02('0x52')](_0x2b5a8e);})[_0xbe02('0x23')](function(_0x1a2fc0){_0x272c05[_0xbe02('0x68')]=_0x1a2fc0;return _0x272c05;});}})['then'](respondWithFilteredResult(_0x1a875d,_0x2b5a8e))[_0xbe02('0x53')](handleError(_0x1a875d,null));};exports['removeDispositions']=function(_0x87a45c,_0xf60528,_0x5f18ba){return db[_0xbe02('0x40')]['find']({'where':{'id':_0x87a45c[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0xf60528,null))[_0xbe02('0x23')](function(_0x347549){if(_0x347549){return _0x347549['removeDispositions'](_0x87a45c[_0xbe02('0x45')][_0xbe02('0x69')]);}})[_0xbe02('0x23')](respondWithStatusCode(_0xf60528,null))[_0xbe02('0x53')](handleError(_0xf60528,null));};exports['addAnswer']=function(_0x791169,_0x146aee,_0x4bc1c3){if(_0x791169['body']['id']){delete _0x791169[_0xbe02('0x5b')]['id'];}return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x791169[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x146aee,null))['then'](function(_0x5b9de9){if(_0x5b9de9){_0x791169[_0xbe02('0x5b')][_0xbe02('0x64')]=_0x5b9de9['id'];return db['CannedAnswer'][_0xbe02('0x5a')](_0x791169[_0xbe02('0x5b')]);}})[_0xbe02('0x23')](respondWithResult(_0x146aee,null))[_0xbe02('0x53')](handleError(_0x146aee,null));};exports['getAnswers']=function(_0x38f951,_0x1308a2,_0xeb2457){var _0x3c6c6a={'raw':![],'where':{}};var _0x102877={};var _0x5b456a={'count':0x0,'rows':[]};return db[_0xbe02('0x40')][_0xbe02('0x67')]({'where':{'id':_0x38f951['params']['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x1308a2,null))[_0xbe02('0x23')](function(_0x58c52c){if(_0x58c52c){_0x102877[_0xbe02('0x44')]=_['keys'](db['CannedAnswer'][_0xbe02('0x41')]);_0x102877[_0xbe02('0x45')]=_[_0xbe02('0x56')](_0x38f951['query']);_0x102877[_0xbe02('0x46')]=_['intersection'](_0x102877[_0xbe02('0x44')],_0x102877[_0xbe02('0x45')]);_0x3c6c6a[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x102877[_0xbe02('0x44')],qs[_0xbe02('0x49')](_0x38f951[_0xbe02('0x45')]['fields']));_0x3c6c6a[_0xbe02('0x47')]=_0x3c6c6a[_0xbe02('0x47')][_0xbe02('0x57')]?_0x3c6c6a['attributes']:_0x102877[_0xbe02('0x44')];if(!_0x38f951[_0xbe02('0x45')]['hasOwnProperty'](_0xbe02('0x6a'))){_0x3c6c6a['limit']=qs[_0xbe02('0x33')](_0x38f951[_0xbe02('0x45')][_0xbe02('0x33')]);_0x3c6c6a[_0xbe02('0x32')]=qs['offset'](_0x38f951[_0xbe02('0x45')][_0xbe02('0x32')]);}_0x3c6c6a[_0xbe02('0x6b')]=qs[_0xbe02('0x4b')](_0x38f951[_0xbe02('0x45')][_0xbe02('0x4b')]);_0x3c6c6a['where']=qs['filters'](_[_0xbe02('0x4d')](_0x38f951[_0xbe02('0x45')],_0x102877['filters']));_0x3c6c6a[_0xbe02('0x4c')][_0xbe02('0x64')]=_0x58c52c['id'];if(_0x38f951[_0xbe02('0x45')][_0xbe02('0x4f')]){_0x3c6c6a['where']=_['merge'](_0x3c6c6a['where'],{'$or':_[_0xbe02('0x3f')](_0x3c6c6a[_0xbe02('0x47')],function(_0x535f59){var _0x1a98e2={};_0x1a98e2[_0x535f59]={'$like':'%'+_0x38f951[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x1a98e2;})});}_0x3c6c6a=_[_0xbe02('0x4e')]({},_0x3c6c6a,_0x38f951[_0xbe02('0x58')]);return db[_0xbe02('0x6c')][_0xbe02('0x31')]({'where':_0x3c6c6a['where']})[_0xbe02('0x23')](function(_0x44a172){_0x5b456a[_0xbe02('0x31')]=_0x44a172;if(_0x38f951[_0xbe02('0x45')]['includeAll']){_0x3c6c6a['include']=[{'all':!![]}];}return db[_0xbe02('0x6c')][_0xbe02('0x52')](_0x3c6c6a);})[_0xbe02('0x23')](function(_0x39502e){_0x5b456a[_0xbe02('0x68')]=_0x39502e;return _0x5b456a;});}})['then'](respondWithFilteredResult(_0x1308a2,_0x3c6c6a))[_0xbe02('0x53')](handleError(_0x1308a2,null));};exports[_0xbe02('0x6d')]=function(_0x50302a,_0x38320e,_0x11399f){return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x50302a[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x38320e,null))[_0xbe02('0x23')](function(_0x199c23){if(_0x199c23){return _0x199c23[_0xbe02('0x6d')](_0x50302a['query']['ids']);}})[_0xbe02('0x23')](respondWithStatusCode(_0x38320e,null))['catch'](handleError(_0x38320e,null));};exports[_0xbe02('0x6e')]=function(_0x36a275,_0x5ad63e,_0x5d6627){_0x36a275[_0xbe02('0x5b')]['sitepic']=_0x36a275['file']['filename'];return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x36a275[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x5ad63e,null))[_0xbe02('0x23')](saveUpdates(_0x36a275[_0xbe02('0x5b')],null))['then'](respondWithResult(_0x5ad63e,null))[_0xbe02('0x53')](handleError(_0x5ad63e,null));};exports[_0xbe02('0x6f')]=function(_0x312860,_0x5c9688,_0x28f0f3){_0x312860[_0xbe02('0x5b')][_0xbe02('0x70')]=_0x312860[_0xbe02('0x71')][_0xbe02('0x72')];return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x312860[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x5c9688,null))['then'](saveUpdates(_0x312860['body'],null))['then'](respondWithResult(_0x5c9688,null))['catch'](handleError(_0x5c9688,null));};exports[_0xbe02('0x73')]=function(_0x128649,_0x2b8e5b,_0x177d2f){_0x128649['body']['customerAvatar']=_0x128649[_0xbe02('0x71')]['filename'];return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x128649[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x2b8e5b,null))[_0xbe02('0x23')](saveUpdates(_0x128649[_0xbe02('0x5b')],null))[_0xbe02('0x23')](respondWithResult(_0x2b8e5b,null))[_0xbe02('0x53')](handleError(_0x2b8e5b,null));};exports[_0xbe02('0x74')]=function(_0x274745,_0x519cf0,_0x4fe02e){_0x274745[_0xbe02('0x5b')]['systemAvatar']=_0x274745[_0xbe02('0x71')][_0xbe02('0x72')];return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x274745[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x519cf0,null))['then'](saveUpdates(_0x274745[_0xbe02('0x5b')],null))[_0xbe02('0x23')](respondWithResult(_0x519cf0,null))[_0xbe02('0x53')](handleError(_0x519cf0,null));};exports[_0xbe02('0x75')]=function(_0x469e08,_0x1e5baa,_0x44dd66){var _0x2b6f3c=path[_0xbe02('0x76')](config['root'],_0xbe02('0x77'));var _0x5bf55f={'where':{'id':_0x469e08[_0xbe02('0x62')]['id']},'attributes':['id',_0xbe02('0x78')],'raw':!![]};var _0x193f25=![];return require(_0xbe02('0x79'))['getLicense']()[_0xbe02('0x23')](function(_0x46085f){if(_0x46085f){_0x193f25=_0x46085f[_0xbe02('0x7a')];}})[_0xbe02('0x23')](function(){return db['ChatWebsite']['find'](_0x5bf55f);})[_0xbe02('0x23')](handleEntityNotFound(_0x1e5baa,null))[_0xbe02('0x23')](function(_0x150b2e){if(_0x150b2e){if(!_[_0xbe02('0x7b')](_0x150b2e[_0xbe02('0x78')])){if(fs[_0xbe02('0x7c')](path[_0xbe02('0x76')](config[_0xbe02('0x7d')],'server/files/images/logos/',_0x150b2e[_0xbe02('0x78')]))&&_0x193f25){_0x2b6f3c=path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0x7e'),_0x150b2e[_0xbe02('0x78')]);}}return _0x1e5baa[_0xbe02('0x7f')](_0x2b6f3c);}})['catch'](handleError(_0x1e5baa,null));};exports[_0xbe02('0x80')]=function(_0x5045c7,_0x5c8818,_0x415ee2){var _0x2ae61d=path['join'](config[_0xbe02('0x7d')],_0xbe02('0x81'));var _0x4b52f4={'where':{'id':_0x5045c7[_0xbe02('0x62')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xbe02('0x40')]['find'](_0x4b52f4)[_0xbe02('0x23')](handleEntityNotFound(_0x5c8818,null))[_0xbe02('0x23')](function(_0x46e164){if(_0x46e164){if(!_['isNil'](_0x46e164[_0xbe02('0x70')])){if(fs[_0xbe02('0x7c')](path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0x82'),_0x46e164[_0xbe02('0x70')]))){_0x2ae61d=path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0x82'),_0x46e164[_0xbe02('0x70')]);}}return _0x5c8818['download'](_0x2ae61d);}})['catch'](handleError(_0x5c8818,null));};exports[_0xbe02('0x83')]=function(_0x326699,_0xfd668b,_0x2d4768){var _0x53c0f8=path[_0xbe02('0x76')](config['root'],_0xbe02('0x84'));var _0x538982={'where':{'id':_0x326699[_0xbe02('0x62')]['id']},'attributes':['id',_0xbe02('0x85'),'showCustomerAvatar'],'raw':!![]};return db[_0xbe02('0x40')]['find'](_0x538982)[_0xbe02('0x23')](handleEntityNotFound(_0xfd668b,null))[_0xbe02('0x23')](function(_0x2bc5e9){if(_0x2bc5e9){if(!_[_0xbe02('0x7b')](_0x2bc5e9[_0xbe02('0x85')])){if(fs['existsSync'](path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0x82'),_0x2bc5e9[_0xbe02('0x85')]))&&_0x2bc5e9[_0xbe02('0x86')]){_0x53c0f8=path[_0xbe02('0x76')](config['root'],_0xbe02('0x82'),_0x2bc5e9[_0xbe02('0x85')]);}}return _0xfd668b[_0xbe02('0x7f')](_0x53c0f8);}})[_0xbe02('0x53')](handleError(_0xfd668b,null));};exports['getSystemAvatar']=function(_0x4368a8,_0x250218,_0x38f277){var _0xf46a3f=path[_0xbe02('0x76')](config['root'],_0xbe02('0x87'));var _0x20c9a7={'where':{'id':_0x4368a8[_0xbe02('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xbe02('0x40')][_0xbe02('0x59')](_0x20c9a7)[_0xbe02('0x23')](handleEntityNotFound(_0x250218,null))[_0xbe02('0x23')](function(_0x15f925){if(_0x15f925){if(!_[_0xbe02('0x7b')](_0x15f925['systemAvatar'])){if(fs[_0xbe02('0x7c')](path[_0xbe02('0x76')](config['root'],_0xbe02('0x82'),_0x15f925[_0xbe02('0x88')]))){_0xf46a3f=path['join'](config['root'],'server/files/images/avatars/',_0x15f925[_0xbe02('0x88')]);}}return _0x250218[_0xbe02('0x7f')](_0xf46a3f);}})[_0xbe02('0x53')](handleError(_0x250218,null));};exports['notify']=function(_0x5cf82b,_0x1a6387,_0x4925cf){var _0x26e874=require(_0xbe02('0x89'));var _0x58560f=new _0x26e874();var _0x3b4dfd=_0x58560f[_0xbe02('0x8a')](_0x5cf82b[_0xbe02('0x8b')]['user-agent'])[_0xbe02('0x8c')]();var _0x2ec8b1={'body':_0x5cf82b[_0xbe02('0x5b')],'channel':_0xbe02('0x8d')};var _0xa9956c=[];var _0x568a67=[];var _0x498dad={};var _0x416368=![];return db[_0xbe02('0x8e')][_0xbe02('0x63')]()[_0xbe02('0x23')](function(_0x226b17){if(!_0x226b17){throw new db[(_0xbe02('0x20'))]['ValidationError'](_0xbe02('0x8f'));}_0xa9956c=_['difference'](_['keys'](_0x226b17),[_0xbe02('0x90'),_0xbe02('0x91')]);_0x568a67=_[_0xbe02('0x92')](_[_0xbe02('0x56')](_0x226b17),[_0xbe02('0x90'),_0xbe02('0x91'),_0xbe02('0x93'),_0xbe02('0x94')]);if(_0x5cf82b[_0xbe02('0x5b')]['id']){delete _0x5cf82b[_0xbe02('0x5b')]['id'];}if(_[_0xbe02('0x7b')](_0x5cf82b[_0xbe02('0x5b')]['from'])){throw new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x95'));}if(_[_0xbe02('0x7b')](_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x5b')])||_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x5b')]===''){throw new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x96'));}if(_[_0xbe02('0x7b')](_0x5cf82b['body'][_0xbe02('0x97')])){throw new db['Sequelize'][(_0xbe02('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x568a67);}if(!_[_0xbe02('0x98')](_0x568a67,_0x5cf82b['body'][_0xbe02('0x97')])){throw new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x99')+_0x568a67);}_0x498dad[_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x97')]]=_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x9a')];})[_0xbe02('0x23')](function(){return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x5cf82b[_0xbe02('0x62')]['id']},'include':[{'model':db[_0xbe02('0x9b')],'as':_0xbe02('0x9c'),'include':[{'model':db[_0xbe02('0x8e')],'as':_0xbe02('0x9d'),'where':_0x498dad,'limit':0x1,'order':[[_0xbe02('0x91'),'DESC']]}]},{'model':db[_0xbe02('0x9e')],'as':'Applications'}]});})[_0xbe02('0x23')](handleEntityNotFound(_0x1a6387,null))['then'](function(_0x30f716){if(_0x30f716&&_0x30f716[_0xbe02('0x9c')]){_0x2ec8b1['account']=_0x30f716;_0x2ec8b1[_0xbe02('0x9f')]=_0x30f716[_0xbe02('0xa0')];_0x2ec8b1[_0xbe02('0xa1')]=_0x30f716[_0xbe02('0x9c')];_0x2ec8b1[_0xbe02('0x9f')]=_[_0xbe02('0xa2')](_0x2ec8b1[_0xbe02('0x9f')],['priority'],[_0xbe02('0xa3')]);if(_0x2ec8b1[_0xbe02('0xa4')]['Applications']){delete _0x2ec8b1['account']['Applications'];}if(_0x2ec8b1[_0xbe02('0xa4')]['List']&&_0x2ec8b1[_0xbe02('0xa4')][_0xbe02('0x9c')]['Contacts'][_0xbe02('0x57')]){return _0x2ec8b1[_0xbe02('0xa4')][_0xbe02('0x9c')][_0xbe02('0x9d')][0x0];}var _0x1cdfa4=_[_0xbe02('0x19')](_0x5cf82b[_0xbe02('0x5b')],{'firstName':_0x5cf82b[_0xbe02('0x5b')]['from'],'ListId':_0x30f716[_0xbe02('0x94')]});_0x1cdfa4[_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x97')]]=_0x5cf82b[_0xbe02('0x5b')]['from'];return db[_0xbe02('0x8e')][_0xbe02('0x5a')](_0x1cdfa4,{'fields':_0xa9956c,'raw':!![]});}})[_0xbe02('0x23')](handleEntityNotFound(_0x1a6387,null))[_0xbe02('0x23')](function(_0x31f401){_0x2ec8b1[_0xbe02('0xa5')]=_0x31f401;var _0x563dd4=_0x5cf82b['body']['customerIp'];if(_0x5cf82b[_0xbe02('0x8b')][_0xbe02('0xa6')]){_0x563dd4=_0x5cf82b['headers'][_0xbe02('0xa6')];}else if(_0x5cf82b[_0xbe02('0x8b')][_0xbe02('0xa7')]){_0x563dd4=_[_0xbe02('0xa8')](_0x5cf82b[_0xbe02('0x8b')][_0xbe02('0xa7')][_0xbe02('0xa9')](','));}if(_0x31f401){var _0x4ef67c={'ContactId':_0x31f401['id'],'ChatWebsiteId':_0x5cf82b[_0xbe02('0x62')]['id'],'from':(_0x31f401[_0xbe02('0xaa')]||'')+'\x20'+(_0x31f401[_0xbe02('0xab')]||''),'customerIp':_0x563dd4,'customerPort':_0x5cf82b[_0xbe02('0x8b')]['x-real-port']?_0x5cf82b[_0xbe02('0x8b')][_0xbe02('0xac')]:null,'referer':_0x5cf82b['body'][_0xbe02('0xad')],'browserName':_0x3b4dfd[_0xbe02('0xae')][_0xbe02('0x3c')]&&_0x3b4dfd['browser'][_0xbe02('0xaf')]?util[_0xbe02('0xb0')]('%s\x20%s',_0x3b4dfd[_0xbe02('0xae')][_0xbe02('0x3c')],_0x3b4dfd[_0xbe02('0xae')]['version']):'unknown','browserVersion':_0x3b4dfd['browser'][_0xbe02('0xaf')]||_0xbe02('0xb1'),'osName':util[_0xbe02('0xb0')]('%s\x20%s',_0x3b4dfd['os'][_0xbe02('0x3c')],_0x3b4dfd['os'][_0xbe02('0xaf')]),'osVersion':_0x3b4dfd['os']['version'],'deviceModel':_0x3b4dfd['device'][_0xbe02('0x44')]&&_0x3b4dfd[_0xbe02('0xb2')]['vendor']?util[_0xbe02('0xb0')](_0xbe02('0xb3'),_0x3b4dfd[_0xbe02('0xb2')][_0xbe02('0x44')],_0x3b4dfd[_0xbe02('0xb2')][_0xbe02('0xb4')],_0x3b4dfd[_0xbe02('0xb2')][_0xbe02('0x42')]):null,'deviceVendor':_0x3b4dfd[_0xbe02('0xb2')][_0xbe02('0xb4')],'deviceType':_0x3b4dfd[_0xbe02('0xb2')][_0xbe02('0x42')],'formData':JSON['stringify'](_0x5cf82b[_0xbe02('0x5b')])};var _0x39d69a={'ChatWebsiteId':_0x5cf82b['params']['id'],'closed':![]};if(_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb5')]){_0x39d69a[_0xbe02('0xb5')]=_0x5cf82b['body'][_0xbe02('0xb5')];return db[_0xbe02('0xb6')]['find']({'where':_0x39d69a})[_0xbe02('0x23')](function(_0x4beee3){if(_0x4beee3){return[_0x4beee3,![]];}_0x4ef67c[_0xbe02('0xb5')]=_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb5')];_0x4ef67c['externalUrl']=_0x5cf82b['body'][_0xbe02('0xb7')];return db[_0xbe02('0xb6')][_0xbe02('0x5a')](_0x4ef67c)[_0xbe02('0x23')](function(_0x3c8089){return[_0x3c8089,!![]];});});}_0x39d69a[_0xbe02('0xb8')]=_0x31f401['id'];if(_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb9')]&&_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb9')]['id']){_0x39d69a['id']=_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb9')]['id'];return db[_0xbe02('0xb6')]['find']({'where':_0x39d69a})[_0xbe02('0x23')](function(_0x35e78e){if(_0x35e78e){return[_0x35e78e,![]];}return db[_0xbe02('0xb6')][_0xbe02('0x5a')](_0x4ef67c)[_0xbe02('0x23')](function(_0x104eee){return[_0x104eee,!![]];});});}return db[_0xbe02('0xb6')][_0xbe02('0x5a')](_0x4ef67c)[_0xbe02('0x23')](function(_0x4844f2){return[_0x4844f2,!![]];});}})[_0xbe02('0xba')](function(_0x21aae1,_0x51c980){if(_0x21aae1){_0x416368=_0x51c980;if(!_0x51c980){var _0x41f97f={'from':(_0x2ec8b1[_0xbe02('0xa5')][_0xbe02('0xaa')]||'')+'\x20'+(_0x2ec8b1[_0xbe02('0xa5')]['lastName']||'')};if(_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb5')]&&_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xbb')]&&_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xb5')]!=_0x5cf82b['body']['messageId']){_0x41f97f[_0xbe02('0xb5')]=_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0xbb')];}return _0x21aae1[_0xbe02('0x61')](_0x41f97f);}else{return _0x21aae1;}}})[_0xbe02('0x23')](function(_0x138017){_0x2ec8b1[_0xbe02('0xb9')]=_0x138017['get']({'plain':!![]});_0x2ec8b1['interaction'][_0xbe02('0xbc')]=_0x416368;if(_0x2ec8b1['interaction'][_0xbe02('0xbc')]){if(_0x2ec8b1[_0xbe02('0xa4')][_0xbe02('0xbd')]){_0x2ec8b1['applications'][_0xbe02('0xbe')]({'id':0x0,'priority':_0x2ec8b1[_0xbe02('0x9f')][_0xbe02('0x57')]+0x1,'app':_0xbe02('0xbf'),'appdata':_0xbe02('0xc0'),'interval':'*,*,*,*'});}}return db[_0xbe02('0xc1')][_0xbe02('0x5a')]({'body':_0x5cf82b[_0xbe02('0x5b')][_0xbe02('0x5b')],'ChatWebsiteId':_0x5cf82b[_0xbe02('0x62')]['id'],'ChatInteractionId':_0x138017['id'],'direction':'in','ContactId':_0x2ec8b1[_0xbe02('0xa5')]['id'],'AttachmentId':_0x5cf82b[_0xbe02('0x5b')]['AttachmentId']});})[_0xbe02('0x23')](function(_0x1ea34d){_0x2ec8b1[_0xbe02('0x2c')]=_0x1ea34d;if(_0x2ec8b1[_0xbe02('0xb9')][_0xbe02('0xc2')]){return db[_0xbe02('0xc3')][_0xbe02('0x59')]({'attributes':['id',_0xbe02('0x3c')],'where':{'id':_0x2ec8b1[_0xbe02('0xb9')][_0xbe02('0xc2')]}})[_0xbe02('0x23')](function(_0x316cf8){if(_0x316cf8){_0x2ec8b1['applications'][_0xbe02('0xc4')]({'id':0x0,'priority':0x0,'app':_0xbe02('0xc5'),'appdata':_0x316cf8[_0xbe02('0x3c')]+','+(_0x2ec8b1['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbe02('0xc6')});_0x2ec8b1[_0xbe02('0xc7')]=!![];}return respondWithRpcPromise('Start',_0xbe02('0xc8'),_0x2ec8b1);});}return respondWithRpcPromise(_0xbe02('0xc9'),'startRouting',_0x2ec8b1);})['then'](function(_0x316538){respondWithRpcPromise(_0xbe02('0xca'),_0xbe02('0xca'),{'event':_0xbe02('0xcb'),'message':_0x316538},client9002);return _0x316538;})[_0xbe02('0x23')](respondWithResult(_0x1a6387,null))['catch'](handleError(_0x1a6387,null));};exports[_0xbe02('0xcc')]=function(_0x33fb3a,_0x378a4a,_0x5c46ec){var _0x15fee4,_0x56964c,_0x571ab0;var _0xc43014=[];var _0x13c7d0=[];var _0x4fbd15={};return db['CmContact'][_0xbe02('0x63')]()['then'](function(_0x4ecddf){if(!_0x4ecddf){throw new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x8f'));}_0x13c7d0=_[_0xbe02('0x92')](_[_0xbe02('0x56')](_0x4ecddf),[_0xbe02('0x90'),'updatedAt']);_0xc43014=_[_0xbe02('0x92')](_[_0xbe02('0x56')](_0x4ecddf),['createdAt',_0xbe02('0x91'),_0xbe02('0x93'),_0xbe02('0x94')]);if(_0x33fb3a['body']['id']){delete _0x33fb3a[_0xbe02('0x5b')]['id'];}if(_[_0xbe02('0x7b')](_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0x9a')])){throw _0x378a4a['status'](0x1f4)[_0xbe02('0xcd')](new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0x95')));}if(_[_0xbe02('0x7b')](_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0x5b')])||_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0x5b')]===''){throw _0x378a4a[_0xbe02('0x2e')](0x1f4)[_0xbe02('0xcd')](new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbe02('0x7b')](_0x33fb3a['body'][_0xbe02('0xce')])){throw _0x378a4a[_0xbe02('0x2e')](0x1f4)[_0xbe02('0xcd')](new db[(_0xbe02('0x20'))][(_0xbe02('0x21'))](_0xbe02('0xcf')+_0xc43014));}if(!_[_0xbe02('0x98')](_0xc43014,_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0xce')])){throw _0x378a4a[_0xbe02('0x2e')](0x1f4)[_0xbe02('0xcd')](new db[(_0xbe02('0x20'))]['ValidationError'](_0xbe02('0xd0')+_0xc43014));}_0x4fbd15[_0x33fb3a['body'][_0xbe02('0xce')]]=_0x33fb3a['body'][_0xbe02('0x9a')];})[_0xbe02('0x23')](function(){return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x33fb3a['params']['id']},'include':[{'model':db[_0xbe02('0x9b')],'as':'List'}]});})[_0xbe02('0x23')](handleEntityNotFound(_0x378a4a,null))[_0xbe02('0x23')](function(_0x58e873){if(_0x58e873&&_0x58e873['List']){_0x56964c=_0x58e873;var _0x383684=_['defaults'](_0x33fb3a[_0xbe02('0x5b')],{'firstName':_0x33fb3a[_0xbe02('0x5b')]['from'],'phone':_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0x9a')],'ListId':_0x58e873[_0xbe02('0x94')]});_0x383684[_0x33fb3a['body'][_0xbe02('0xce')]]=_0x33fb3a[_0xbe02('0x5b')]['from'];return db[_0xbe02('0x8e')][_0xbe02('0xd1')]({'where':_0x4fbd15,'defaults':_0x383684});}})[_0xbe02('0xba')](function(_0x26f203){if(_0x26f203){_0x571ab0=_0x26f203;var _0x47924f=fs[_0xbe02('0xd2')](path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0xd3')),_0xbe02('0xd4'));var _0x305fd3=ejs[_0xbe02('0xd5')](_0x47924f,{'body':_[_0xbe02('0xd6')](_0x33fb3a[_0xbe02('0x5b')][_0xbe02('0x5b')]),'bodyTitle':_0x56964c[_0xbe02('0xd7')]});return db[_0xbe02('0xd8')][_0xbe02('0x5a')]({'body':_0x305fd3,'ContactId':_0x26f203['id'],'ChatWebsiteId':_0x56964c['id']});}})[_0xbe02('0x23')](function(_0x14954f){if(_0x14954f){_0x15fee4=_0x14954f;return db['MailAccount'][_0xbe02('0x67')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xbe02('0xd9'),'raw':!![]}]});}})[_0xbe02('0x23')](function(_0x1eb99b){if(_0x1eb99b&&_0x1eb99b[_0xbe02('0xd9')]&&_0x56964c[_0xbe02('0xda')]){var _0x553beb={'tls':{'rejectUnauthorized':![]}};if(_0x1eb99b[_0xbe02('0xd9')][_0xbe02('0xdb')]){_0x553beb[_0xbe02('0xdb')]=_0x1eb99b['Smtp'][_0xbe02('0xdb')];}else{_0x553beb[_0xbe02('0xdc')]=_0x1eb99b['Smtp']['host'];_0x553beb[_0xbe02('0xdd')]=_0x1eb99b[_0xbe02('0xd9')][_0xbe02('0xdd')];_0x553beb[_0xbe02('0xde')]=_0x1eb99b[_0xbe02('0xd9')]['secure'];}if(_0x1eb99b[_0xbe02('0xd9')][_0xbe02('0xdf')]){_0x553beb['auth']={'user':_0x1eb99b['Smtp'][_0xbe02('0x5c')],'pass':_0x1eb99b['Smtp'][_0xbe02('0xe0')]};}return respondWithRpcPromise('SendMail',_0xbe02('0xe1'),{'account':_0x553beb,'message':{'from':util['format'](_0xbe02('0xe2'),_0x1eb99b[_0xbe02('0x3c')],_0x1eb99b[_0xbe02('0xe3')]||_0x1eb99b[_0xbe02('0xd9')]['user']),'to':_0x56964c['forwardOfflineAddress'],'subject':_0x56964c['offlineMessageSubject'],'text':_0x15fee4[_0xbe02('0x5b')]}},client9003)[_0xbe02('0x23')](function(){return _0x15fee4;})['catch'](function(_0x48e4f4){console[_0xbe02('0x2a')](_0x48e4f4);});}})[_0xbe02('0x23')](function(){if(_0x15fee4){return _0x15fee4;}})[_0xbe02('0x23')](respondWithResult(_0x378a4a,null))[_0xbe02('0x53')](handleError(_0x378a4a,null));};exports['addInteraction']=function(_0xf2e00e,_0x53f961,_0x5dcf32){return db[_0xbe02('0xb6')][_0xbe02('0x59')]({'where':{'id':_0xf2e00e[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x53f961,null))[_0xbe02('0x23')](function(_0x7cc490){if(_0x7cc490){return _0x7cc490[_0xbe02('0xe4')](_0xf2e00e[_0xbe02('0x5b')][_0xbe02('0x69')],_['omit'](_0xf2e00e[_0xbe02('0x5b')],['ids','id'])||{});}})[_0xbe02('0x23')](respondWithResult(_0x53f961,null))[_0xbe02('0x53')](handleError(_0x53f961,null));};exports[_0xbe02('0xe5')]=function(_0x910eb6,_0x2589b3,_0x11c3ca){var _0x5acdc0={'raw':![],'where':{}};var _0x1aa80e={};var _0x272a46={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x910eb6[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x2589b3,null))[_0xbe02('0x23')](function(_0x54a768){if(_0x54a768){_0x1aa80e[_0xbe02('0x44')]=_['keys'](db[_0xbe02('0xb6')][_0xbe02('0x41')]);_0x1aa80e[_0xbe02('0x45')]=_['keys'](_0x910eb6['query']);_0x1aa80e[_0xbe02('0x46')]=_[_0xbe02('0x48')](_0x1aa80e[_0xbe02('0x44')],_0x1aa80e['query']);_0x5acdc0[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x1aa80e[_0xbe02('0x44')],qs[_0xbe02('0x49')](_0x910eb6[_0xbe02('0x45')]['fields']));_0x5acdc0[_0xbe02('0x47')]=_0x5acdc0[_0xbe02('0x47')][_0xbe02('0x57')]?_0x5acdc0[_0xbe02('0x47')]:_0x1aa80e['model'];if(!_0x910eb6[_0xbe02('0x45')][_0xbe02('0x4a')](_0xbe02('0x6a'))){_0x5acdc0[_0xbe02('0x33')]=qs['limit'](_0x910eb6['query'][_0xbe02('0x33')]);_0x5acdc0[_0xbe02('0x32')]=qs[_0xbe02('0x32')](_0x910eb6[_0xbe02('0x45')][_0xbe02('0x32')]);}_0x5acdc0[_0xbe02('0x6b')]=qs[_0xbe02('0x4b')](_0x910eb6[_0xbe02('0x45')][_0xbe02('0x4b')]);_0x5acdc0[_0xbe02('0x4c')]=qs[_0xbe02('0x46')](_[_0xbe02('0x4d')](_0x910eb6[_0xbe02('0x45')],_0x1aa80e['filters']));_0x5acdc0['where']['ChatWebsiteId']=_0x54a768['id'];if(_0x910eb6[_0xbe02('0x45')][_0xbe02('0x4f')]){_0x5acdc0[_0xbe02('0x4c')]=_['merge'](_0x5acdc0['where'],{'$or':_['map'](_0x5acdc0[_0xbe02('0x47')],function(_0x2509ad){var _0x5a1c61={};_0x5a1c61[_0x2509ad]={'$like':'%'+_0x910eb6[_0xbe02('0x45')]['filter']+'%'};return _0x5a1c61;})});}_0x5acdc0=_['merge']({},_0x5acdc0,_0x910eb6[_0xbe02('0x58')]);return db[_0xbe02('0xb6')]['count']({'where':_0x5acdc0[_0xbe02('0x4c')]})[_0xbe02('0x23')](function(_0x23550a){_0x272a46[_0xbe02('0x31')]=_0x23550a;if(_0x910eb6[_0xbe02('0x45')][_0xbe02('0x50')]){_0x5acdc0[_0xbe02('0x51')]=[{'model':db[_0xbe02('0x8e')],'as':_0xbe02('0xe6'),'required':![]},{'model':db['User'],'as':_0xbe02('0xe7'),'attributes':[_0xbe02('0x3c'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x910eb6[_0xbe02('0x45')][_0xbe02('0xe8')]?{'id':_0x910eb6[_0xbe02('0x45')][_0xbe02('0xe8')]}:undefined,'required':_0x910eb6[_0xbe02('0x45')][_0xbe02('0xe8')]?!![]:![]}];}return db['ChatInteraction'][_0xbe02('0x52')](_0x5acdc0);})[_0xbe02('0x23')](function(_0x300321){_0x272a46[_0xbe02('0x68')]=_0x300321;return _0x272a46;});}})['then'](respondWithFilteredResult(_0x2589b3,_0x5acdc0))['catch'](handleError(_0x2589b3,null));};function iftimePromise(_0xd85308,_0x2242f8){return respondWithRpcPromise('Command',_0xbe02('0xe9'),{'command':_0x2242f8[_0xbe02('0xea')]?util[_0xbe02('0xb0')](_0xbe02('0xeb'),_0xd85308[_0xbe02('0xec')],_0x2242f8[_0xbe02('0xea')]):util[_0xbe02('0xb0')](_0xbe02('0xed'),_0xd85308[_0xbe02('0xec')])},client9002)[_0xbe02('0x23')](function(_0x327e8f){var _0x13e84e=_0x327e8f&&_0x327e8f['indexOf'](_0xbe02('0xee'))>=0x0?!![]:![];logger['info'](_0xbe02('0xef'),_0x2242f8['id'],_0xd85308['id'],_0xd85308[_0xbe02('0xec')],_0x13e84e?_0xbe02('0xf0'):_0xbe02('0xf1'),_0x2242f8[_0xbe02('0xea')]?_0x2242f8[_0xbe02('0xea')]:'No\x20timezone');return _0x13e84e;})['catch'](function(_0x2771ee){logger[_0xbe02('0x2a')](_0xbe02('0xef'),_0x2242f8['id'],_0xd85308['id'],_0xd85308[_0xbe02('0xec')],util[_0xbe02('0xf2')](_0x2771ee,{'showHidden':![],'depth':null}),_0x2242f8[_0xbe02('0xea')]?_0x2242f8[_0xbe02('0xea')]:_0xbe02('0xf3'));return![];});}exports[_0xbe02('0xe9')]=function(_0x37cc09,_0x4c4d90,_0x184972){var _0x37199a=0x0;var _0x12afb=0x0;var _0x4e30d3=![];var _0xe4b584;var _0x5cbd15;return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x37cc09[_0xbe02('0x62')]['id']},'include':[{'model':db[_0xbe02('0xf4')],'as':_0xbe02('0xf4'),'include':[{'model':db[_0xbe02('0xf4')],'as':_0xbe02('0xf5'),'attributes':['id',_0xbe02('0xec')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4c4d90,null))[_0xbe02('0x23')](function(_0x5b4c16){if(_0x5b4c16){_0xe4b584=_0x5b4c16;return _0x5b4c16[_0xbe02('0xf6')]({'raw':!![]});}})[_0xbe02('0x23')](function(_0x357e2b){if(_0xe4b584){if(_0x357e2b){_0x5cbd15=_0x357e2b;}}return require(_0xbe02('0x79'))['getLicense']();})[_0xbe02('0x23')](function(_0x317601){if(_0x317601){_0x12afb=_0x317601[_0xbe02('0xf7')];_0x4e30d3=_0x317601[_0xbe02('0x7a')];}})['then'](function(){return db[_0xbe02('0xb6')][_0xbe02('0x31')]({'where':{'closed':![]}});})[_0xbe02('0x23')](function(_0x55e61b){_0x37199a=_0x55e61b;if(_0x12afb&&_0x55e61b>_0x12afb){return db['License'][_0xbe02('0x67')]({'where':{'id':0x1}})['then'](function(_0x2a2eaa){if(_0x2a2eaa){_0x2a2eaa[_0xbe02('0xf8')](_0xbe02('0xf9'));}});}})['then'](function(){if(_0xe4b584[_0xbe02('0xf4')]&&_0xe4b584[_0xbe02('0xf4')]['Intervals']){var _0x2265b9=[];for(var _0x1600df=0x0;_0x1600df<_0xe4b584[_0xbe02('0xf4')]['Intervals'][_0xbe02('0x57')];_0x1600df++){var _0x3c00c1=_0xe4b584['Interval'][_0xbe02('0xf5')][_0x1600df][_0xbe02('0x38')]({'plain':!![]});_0x2265b9['push'](iftimePromise(_0x3c00c1,_0xe4b584));}return BPromise['all'](_0x2265b9)[_0xbe02('0x23')](function(_0x4890e9){return _[_0xbe02('0xfa')](_0x4890e9);});}else{return!![];}})['then'](function(_0x4ec4fb){var _0x25da44=fs[_0xbe02('0xd2')](path[_0xbe02('0x76')](config[_0xbe02('0x7d')],_0xbe02('0xfb')),'utf8');var _0x3d489d={'remote':_0xe4b584[_0xbe02('0xfc')],'query':querystring[_0xbe02('0x29')](_[_0xbe02('0x4e')](_0xe4b584[_0xbe02('0x38')]({'plain':!![]}),{'customerIp':_0x37cc09[_0xbe02('0x8b')]['x-forwarded-for']||_0x37cc09[_0xbe02('0x8b')][_0xbe02('0xfd')]||_0x37cc09['connection'][_0xbe02('0xfe')]||_0x37cc09['ip'],'referer':_0x37cc09[_0xbe02('0x8b')][_0xbe02('0xad')],'openedInteractions':_0x37199a,'maxInteractions':_0x12afb,'virtual':_0x4e30d3['virtual'],'online':_0x4ec4fb,'custom':_0x4e30d3}))['replace'](/'/g,'\x5c\x27')};_0x4c4d90['send'](ejs['render'](Mustache['render'](_0x25da44,_0x3d489d),{'proactiveActions':_0x5cbd15,'alignment':_0xe4b584[_0xbe02('0xff')],'verticalAlignment':_0xe4b584['verticalAlignment'],'div_color':_0xe4b584[_0xbe02('0x100')],'text_color':_0xe4b584['textColor']}));})[_0xbe02('0x53')](handleError(_0x4c4d90,null));};exports['addApplications']=function(_0x43d73b,_0x267d26,_0x2a2f06){return db[_0xbe02('0x40')][_0xbe02('0x67')]({'where':{'id':_0x43d73b[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x267d26,null))[_0xbe02('0x23')](function(_0x4f5e6b){if(_0x4f5e6b){return db[_0xbe02('0x101')][_0xbe02('0x102')](function(_0x4bfb80){return db[_0xbe02('0x9e')][_0xbe02('0x37')]({'where':{'ChatWebsiteId':_0x43d73b['params']['id']},'transaction':_0x4bfb80})['then'](function(_0x4bd763){var _0x2cee9a=_[_0xbe02('0x3f')](_0x43d73b[_0xbe02('0x5b')],function(_0x5a4388){_0x5a4388[_0xbe02('0x64')]=_0x43d73b[_0xbe02('0x62')]['id'];return _0x5a4388;});return db[_0xbe02('0x9e')]['bulkCreate'](_0x2cee9a,{'transaction':_0x4bfb80});});})[_0xbe02('0x23')](function(){return db[_0xbe02('0x9e')][_0xbe02('0x103')]({'where':{'ChatWebsiteId':_0x43d73b[_0xbe02('0x62')]['id']},'order':_0xbe02('0x104')});});}})[_0xbe02('0x23')](respondWithResult(_0x267d26,null))['catch'](handleError(_0x267d26,null));};exports[_0xbe02('0x105')]=function(_0x42641d,_0xde447c,_0x234d25){var _0x3701d3={};var _0x1d8a04={};var _0xb0a41f;var _0x3f1fac;return db[_0xbe02('0x40')][_0xbe02('0x67')]({'where':{'id':_0x42641d[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0xde447c,null))['then'](function(_0x233d54){if(_0x233d54){_0xb0a41f=_0x233d54;_0x1d8a04['model']=_['keys'](db[_0xbe02('0x9e')][_0xbe02('0x41')]);_0x1d8a04[_0xbe02('0x45')]=_[_0xbe02('0x56')](_0x42641d[_0xbe02('0x45')]);_0x1d8a04[_0xbe02('0x46')]=_[_0xbe02('0x48')](_0x1d8a04[_0xbe02('0x44')],_0x1d8a04[_0xbe02('0x45')]);_0x3701d3[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x1d8a04[_0xbe02('0x44')],qs[_0xbe02('0x49')](_0x42641d[_0xbe02('0x45')][_0xbe02('0x49')]));_0x3701d3['attributes']=_0x3701d3[_0xbe02('0x47')]['length']?_0x3701d3[_0xbe02('0x47')]:_0x1d8a04[_0xbe02('0x44')];_0x3701d3['order']=qs[_0xbe02('0x4b')](_0x42641d[_0xbe02('0x45')]['sort']);_0x3701d3[_0xbe02('0x4c')]=qs[_0xbe02('0x46')](_['pick'](_0x42641d[_0xbe02('0x45')],_0x1d8a04['filters']));if(_0x42641d['query']['filter']){_0x3701d3['where']=_[_0xbe02('0x4e')](_0x3701d3[_0xbe02('0x4c')],{'$or':_[_0xbe02('0x3f')](_0x3701d3[_0xbe02('0x47')],function(_0xb7b14a){var _0x2da35b={};_0x2da35b[_0xb7b14a]={'$like':'%'+_0x42641d[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x2da35b;})});}_0x3701d3=_[_0xbe02('0x4e')]({},_0x3701d3,_0x42641d[_0xbe02('0x58')]);return _0xb0a41f['getApplications'](_0x3701d3);}})[_0xbe02('0x23')](function(_0x5728b5){if(_0x5728b5){_0x3f1fac=_0x5728b5[_0xbe02('0x57')];if(!_0x42641d['query'][_0xbe02('0x4a')]('nolimit')){_0x3701d3[_0xbe02('0x33')]=qs[_0xbe02('0x33')](_0x42641d['query'][_0xbe02('0x33')]);_0x3701d3[_0xbe02('0x32')]=qs['offset'](_0x42641d[_0xbe02('0x45')][_0xbe02('0x32')]);}return _0xb0a41f[_0xbe02('0x105')](_0x3701d3);}})[_0xbe02('0x23')](function(_0x508b88){if(_0x508b88){return _0x508b88?{'count':_0x3f1fac,'rows':_0x508b88}:null;}})[_0xbe02('0x23')](respondWithResult(_0xde447c,null))[_0xbe02('0x53')](handleError(_0xde447c,null));};exports['addProactiveActions']=function(_0x2aea4a,_0x4ac769,_0x8291fb){return db[_0xbe02('0x106')][_0xbe02('0x59')]({'where':{'id':_0x2aea4a['params']['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x4ac769,null))[_0xbe02('0x23')](function(_0x3dbb26){if(_0x3dbb26){return _0x3dbb26[_0xbe02('0x107')](_0x2aea4a[_0xbe02('0x5b')][_0xbe02('0x69')],_[_0xbe02('0x108')](_0x2aea4a[_0xbe02('0x5b')],['ids','id'])||{});}})[_0xbe02('0x23')](respondWithResult(_0x4ac769,null))['catch'](handleError(_0x4ac769,null));};exports[_0xbe02('0xf6')]=function(_0xca95a1,_0x548c83,_0xa9b896){var _0x240188={};var _0x42d47d={};var _0x3de7e0;var _0x2465f5;return db[_0xbe02('0x40')]['findOne']({'where':{'id':_0xca95a1[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x548c83,null))[_0xbe02('0x23')](function(_0x2c8f2a){if(_0x2c8f2a){_0x3de7e0=_0x2c8f2a;_0x42d47d['model']=_[_0xbe02('0x56')](db[_0xbe02('0x109')][_0xbe02('0x41')]);_0x42d47d['query']=_[_0xbe02('0x56')](_0xca95a1['query']);_0x42d47d[_0xbe02('0x46')]=_[_0xbe02('0x48')](_0x42d47d[_0xbe02('0x44')],_0x42d47d[_0xbe02('0x45')]);_0x240188[_0xbe02('0x47')]=_[_0xbe02('0x48')](_0x42d47d['model'],qs[_0xbe02('0x49')](_0xca95a1[_0xbe02('0x45')][_0xbe02('0x49')]));_0x240188[_0xbe02('0x47')]=_0x240188[_0xbe02('0x47')][_0xbe02('0x57')]?_0x240188[_0xbe02('0x47')]:_0x42d47d[_0xbe02('0x44')];_0x240188[_0xbe02('0x6b')]=qs[_0xbe02('0x4b')](_0xca95a1[_0xbe02('0x45')][_0xbe02('0x4b')]);_0x240188[_0xbe02('0x4c')]=qs['filters'](_['pick'](_0xca95a1[_0xbe02('0x45')],_0x42d47d[_0xbe02('0x46')]));if(_0xca95a1[_0xbe02('0x45')][_0xbe02('0x4f')]){_0x240188[_0xbe02('0x4c')]=_[_0xbe02('0x4e')](_0x240188[_0xbe02('0x4c')],{'$or':_['map'](_0x240188[_0xbe02('0x47')],function(_0x1b9cc0){var _0x5ae851={};_0x5ae851[_0x1b9cc0]={'$like':'%'+_0xca95a1[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x5ae851;})});}_0x240188=_[_0xbe02('0x4e')]({},_0x240188,_0xca95a1[_0xbe02('0x58')]);return _0x3de7e0[_0xbe02('0xf6')](_0x240188);}})[_0xbe02('0x23')](function(_0x4b78a0){if(_0x4b78a0){_0x2465f5=_0x4b78a0[_0xbe02('0x57')];if(!_0xca95a1['query'][_0xbe02('0x4a')]('nolimit')){_0x240188['limit']=qs[_0xbe02('0x33')](_0xca95a1[_0xbe02('0x45')][_0xbe02('0x33')]);_0x240188[_0xbe02('0x32')]=qs['offset'](_0xca95a1['query'][_0xbe02('0x32')]);}return _0x3de7e0[_0xbe02('0xf6')](_0x240188);}})[_0xbe02('0x23')](function(_0x179299){if(_0x179299){return _0x179299?{'count':_0x2465f5,'rows':_0x179299}:null;}})[_0xbe02('0x23')](respondWithResult(_0x548c83,null))[_0xbe02('0x53')](handleError(_0x548c83,null));};exports['getFields']=function(_0xeebaac,_0x2c74bf,_0x7a925c){var _0x22b321=_0xeebaac[_0xbe02('0x45')][_0xbe02('0x10a')]===_0xbe02('0x10b')?_0xbe02('0x10c'):_0xbe02('0x10d');return db[_0xbe02('0x40')]['find']({'attributes':['id',_0x22b321],'where':{'id':_0xeebaac[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x2c74bf,null))[_0xbe02('0x23')](function(_0x44847d){if(_0x44847d){var _0x4c7509=_0x44847d[_0x22b321];var _0x35e1a3=_0x4c7509&&_0x4c7509[_0xbe02('0x10e')]?_0x4c7509[_0xbe02('0x10e')]:[];_0x2c74bf['send']({'fromKey':_[_0xbe02('0x7b')](_0x4c7509[_0xbe02('0x10f')])?undefined:_0x4c7509[_0xbe02('0x10f')],'count':_0x35e1a3[_0xbe02('0x57')],'rows':_0x35e1a3});}})[_0xbe02('0x53')](handleError(_0x2c74bf,null));};exports['getOfflineMessages']=function(_0x1547c1,_0x50a600,_0x283b9c){var _0x4a9321={'raw':![],'where':{}};var _0x3bccb2={};var _0x379eeb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbe02('0x67')]({'where':{'id':_0x1547c1[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x50a600,null))[_0xbe02('0x23')](function(_0x51d323){if(_0x51d323){_0x3bccb2[_0xbe02('0x44')]=_[_0xbe02('0x56')](db[_0xbe02('0xd8')][_0xbe02('0x41')]);_0x3bccb2[_0xbe02('0x45')]=_[_0xbe02('0x56')](_0x1547c1['query']);_0x3bccb2[_0xbe02('0x46')]=_['intersection'](_0x3bccb2['model'],_0x3bccb2['query']);_0x4a9321['attributes']=_['intersection'](_0x3bccb2[_0xbe02('0x44')],qs['fields'](_0x1547c1[_0xbe02('0x45')]['fields']));_0x4a9321[_0xbe02('0x47')]=_0x4a9321[_0xbe02('0x47')]['length']?_0x4a9321[_0xbe02('0x47')]:_0x3bccb2[_0xbe02('0x44')];if(!_0x1547c1[_0xbe02('0x45')][_0xbe02('0x4a')]('nolimit')){_0x4a9321[_0xbe02('0x33')]=qs[_0xbe02('0x33')](_0x1547c1[_0xbe02('0x45')]['limit']);_0x4a9321[_0xbe02('0x32')]=qs['offset'](_0x1547c1[_0xbe02('0x45')][_0xbe02('0x32')]);}_0x4a9321[_0xbe02('0x6b')]=qs[_0xbe02('0x4b')](_0x1547c1['query']['sort']);_0x4a9321[_0xbe02('0x4c')]=qs['filters'](_['pick'](_0x1547c1[_0xbe02('0x45')],_0x3bccb2[_0xbe02('0x46')]));_0x4a9321['where'][_0xbe02('0x64')]=_0x51d323['id'];if(_0x1547c1[_0xbe02('0x45')][_0xbe02('0x4f')]){_0x4a9321['where']=_[_0xbe02('0x4e')](_0x4a9321[_0xbe02('0x4c')],{'$or':_['map'](_0x4a9321['attributes'],function(_0x250885){var _0x42eff3={};_0x42eff3[_0x250885]={'$like':'%'+_0x1547c1[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x42eff3;})});}_0x4a9321=_[_0xbe02('0x4e')]({},_0x4a9321,_0x1547c1[_0xbe02('0x58')]);return db[_0xbe02('0xd8')]['count']({'where':_0x4a9321[_0xbe02('0x4c')]})[_0xbe02('0x23')](function(_0xf27813){_0x379eeb['count']=_0xf27813;if(_0x1547c1[_0xbe02('0x45')][_0xbe02('0x50')]){_0x4a9321['include']=[{'all':!![]}];}else{_0x4a9321['include']=[{'model':db[_0xbe02('0x8e')],'as':_0xbe02('0xe6'),'required':![]}];}return db[_0xbe02('0xd8')][_0xbe02('0x52')](_0x4a9321);})[_0xbe02('0x23')](function(_0x251cb4){_0x379eeb[_0xbe02('0x68')]=_0x251cb4;return _0x379eeb;});}})[_0xbe02('0x23')](respondWithFilteredResult(_0x50a600,_0x4a9321))[_0xbe02('0x53')](handleError(_0x50a600,null));};exports['addAgents']=function(_0x118e4a,_0x32a4ba,_0x1b10fd){return db[_0xbe02('0x40')][_0xbe02('0x59')]({'where':{'id':_0x118e4a[_0xbe02('0x62')]['id']}})['then'](handleEntityNotFound(_0x32a4ba,null))[_0xbe02('0x23')](function(_0x239c4f){if(_0x239c4f){return _0x239c4f['addAgents'](_0x118e4a[_0xbe02('0x5b')]['ids'],_['omit'](_0x118e4a['body'],[_0xbe02('0x69'),'id'])||{})[_0xbe02('0xba')](function(_0x466e7a){for(var _0x56db40=0x0;_0x56db40<_0x118e4a['body'][_0xbe02('0x69')][_0xbe02('0x57')];_0x56db40+=0x1){socket['emit'](_0xbe02('0x110'),{'UserId':_0x118e4a['body'][_0xbe02('0x69')][_0x56db40],'ChatWebsiteId':_0x118e4a[_0xbe02('0x62')]['id']});}return _0x466e7a;});}})[_0xbe02('0x23')](respondWithResult(_0x32a4ba,null))['catch'](handleError(_0x32a4ba,null));};exports[_0xbe02('0x111')]=function(_0x130105,_0x54c550,_0x134241){return db['ChatWebsite'][_0xbe02('0x59')]({'where':{'id':_0x130105['params']['id']}})['then'](handleEntityNotFound(_0x54c550,null))[_0xbe02('0x23')](function(_0x1d6d25){if(_0x1d6d25){return _0x1d6d25[_0xbe02('0x111')](_0x130105[_0xbe02('0x45')]['ids'])['then'](function(){if(_[_0xbe02('0x112')](_0x130105['query'][_0xbe02('0x69')])){for(var _0x3e29f6=0x0;_0x3e29f6<_0x130105[_0xbe02('0x45')][_0xbe02('0x69')][_0xbe02('0x57')];_0x3e29f6+=0x1){socket[_0xbe02('0x113')](_0xbe02('0x114'),{'UserId':Number(_0x130105[_0xbe02('0x45')][_0xbe02('0x69')][_0x3e29f6]),'ChatWebsiteId':Number(_0x130105[_0xbe02('0x62')]['id'])});}}else{socket[_0xbe02('0x113')]('userChatWebsite:remove',{'UserId':Number(_0x130105[_0xbe02('0x45')]['ids']),'ChatWebsiteId':Number(_0x130105[_0xbe02('0x62')]['id'])});}});}})[_0xbe02('0x23')](respondWithStatusCode(_0x54c550,null))[_0xbe02('0x53')](handleError(_0x54c550,null));};exports[_0xbe02('0x115')]=function(_0x268046,_0x42afa4,_0x2df53a){var _0x4a1db6={};var _0xb92708={};var _0x1e44f6;var _0x4dd652;return db['ChatWebsite'][_0xbe02('0x67')]({'where':{'id':_0x268046[_0xbe02('0x62')]['id']}})[_0xbe02('0x23')](handleEntityNotFound(_0x42afa4,null))[_0xbe02('0x23')](function(_0x5403d6){if(_0x5403d6){_0x1e44f6=_0x5403d6;_0xb92708[_0xbe02('0x44')]=_[_0xbe02('0x56')](db[_0xbe02('0xc3')][_0xbe02('0x41')]);_0xb92708['query']=_[_0xbe02('0x56')](_0x268046[_0xbe02('0x45')]);_0xb92708[_0xbe02('0x46')]=_['intersection'](_0xb92708[_0xbe02('0x44')],_0xb92708[_0xbe02('0x45')]);_0x4a1db6[_0xbe02('0x47')]=_['intersection'](_0xb92708['model'],qs[_0xbe02('0x49')](_0x268046[_0xbe02('0x45')][_0xbe02('0x49')]));_0x4a1db6['attributes']=_0x4a1db6[_0xbe02('0x47')][_0xbe02('0x57')]?_0x4a1db6[_0xbe02('0x47')]:_0xb92708[_0xbe02('0x44')];_0x4a1db6['order']=qs[_0xbe02('0x4b')](_0x268046[_0xbe02('0x45')]['sort']);_0x4a1db6[_0xbe02('0x4c')]=qs[_0xbe02('0x46')](_[_0xbe02('0x4d')](_0x268046[_0xbe02('0x45')],_0xb92708[_0xbe02('0x46')]));if(_0x268046[_0xbe02('0x45')]['filter']){_0x4a1db6['where']=_[_0xbe02('0x4e')](_0x4a1db6[_0xbe02('0x4c')],{'$or':_[_0xbe02('0x3f')](_0x4a1db6[_0xbe02('0x47')],function(_0x5dd516){var _0x469cac={};_0x469cac[_0x5dd516]={'$like':'%'+_0x268046[_0xbe02('0x45')][_0xbe02('0x4f')]+'%'};return _0x469cac;})});}_0x4a1db6=_[_0xbe02('0x4e')]({},_0x4a1db6,_0x268046[_0xbe02('0x58')]);return _0x1e44f6[_0xbe02('0x115')](_0x4a1db6);}})[_0xbe02('0x23')](function(_0x483077){if(_0x483077){_0x4dd652=_0x483077[_0xbe02('0x57')];if(!_0x268046[_0xbe02('0x45')][_0xbe02('0x4a')](_0xbe02('0x6a'))){_0x4a1db6['limit']=qs[_0xbe02('0x33')](_0x268046[_0xbe02('0x45')]['limit']);_0x4a1db6[_0xbe02('0x32')]=qs[_0xbe02('0x32')](_0x268046[_0xbe02('0x45')][_0xbe02('0x32')]);}return _0x1e44f6[_0xbe02('0x115')](_0x4a1db6);}})[_0xbe02('0x23')](function(_0x1e11d9){if(_0x1e11d9){return _0x1e11d9?{'count':_0x4dd652,'rows':_0x1e11d9}:null;}})['then'](respondWithResult(_0x42afa4,null))[_0xbe02('0x53')](handleError(_0x42afa4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4925a9b..04cb611 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 _0xf7ed=['update','emit','hook','exports','../../mysqldb','ChatWebsite','save'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x207f1c,_0x1bdfb4){_0x207f1c=_0x207f1c-0x0;var _0x24e0f6=_0xf7ed[_0x207f1c];return _0x24e0f6;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xdf7e('0x0'))['db'][_0xdf7e('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf7e('0x2'),'afterUpdate':_0xdf7e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2cbe1a){return function(_0x1447a3,_0x5107c9,_0x29b2db){ChatWebsiteEvents[_0xdf7e('0x4')](_0x2cbe1a+':'+_0x1447a3['id'],_0x1447a3);ChatWebsiteEvents[_0xdf7e('0x4')](_0x2cbe1a,_0x1447a3);_0x29b2db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xdf7e('0x5')](e,emitEvent(event));}}module[_0xdf7e('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x15a9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x1b93d2,_0x34a3e9){var _0x542f20=function(_0xfc3f76){while(--_0xfc3f76){_0x1b93d2['push'](_0x1b93d2['shift']());}};_0x542f20(++_0x34a3e9);}(_0x15a9,0x18a));var _0x915a=function(_0x4d9d1f,_0x27949a){_0x4d9d1f=_0x4d9d1f-0x0;var _0x23762d=_0x15a9[_0x4d9d1f];return _0x23762d;};'use strict';var EventEmitter=require(_0x915a('0x0'));var ChatWebsite=require(_0x915a('0x1'))['db'][_0x915a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x915a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x915a('0x4'),'afterDestroy':_0x915a('0x5')};function emitEvent(_0x310621){return function(_0x186578,_0x4607a4,_0x351141){ChatWebsiteEvents[_0x915a('0x6')](_0x310621+':'+_0x186578['id'],_0x186578);ChatWebsiteEvents[_0x915a('0x6')](_0x310621,_0x186578);_0x351141(null);};}for(var e in events){if(events[_0x915a('0x7')](e)){var event=events[e];ChatWebsite[_0x915a('0x8')](e,emitEvent(event));}}module[_0x915a('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 0450083..b5a155c 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 _0x0aaf=['request-promise','rimraf','../../config/environment','exports','ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird'];(function(_0x3ffa04,_0x32fb53){var _0x4a434c=function(_0x4b256a){while(--_0x4b256a){_0x3ffa04['push'](_0x3ffa04['shift']());}};_0x4a434c(++_0x32fb53);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x129f74,_0x3d64d8){_0x129f74=_0x129f74-0x0;var _0x1cf683=_0x0aaf[_0x129f74];return _0x1cf683;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0aa('0x0'))(_0xf0aa('0x1'));var moment=require(_0xf0aa('0x2'));var BPromise=require(_0xf0aa('0x3'));var rp=require(_0xf0aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0aa('0x5'));var config=require(_0xf0aa('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xf0aa('0x7')]=function(_0x4c20b5,_0x752f1b){return _0x4c20b5['define'](_0xf0aa('0x8'),attributes,{'tableName':_0xf0aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7c8=['request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xb7c8,0x119));var _0x8b7c=function(_0x394505,_0x5605c3){_0x394505=_0x394505-0x0;var _0x31098a=_0xb7c8[_0x394505];return _0x31098a;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0a9d811..c63f661 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 _0x5fab=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./chatWebsite.socket','register'];(function(_0x27fdcc,_0x421cb5){var _0x17c2de=function(_0x2fa372){while(--_0x2fa372){_0x27fdcc['push'](_0x27fdcc['shift']());}};_0x17c2de(++_0x421cb5);}(_0x5fab,0x177));var _0xb5fa=function(_0x43ceb0,_0x1c6db0){_0x43ceb0=_0x43ceb0-0x0;var _0x58cb5a=_0x5fab[_0x43ceb0];return _0x58cb5a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file +var _0x6343=['socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x6343,0x168));var _0x3634=function(_0x64c3d2,_0x224cd3){_0x64c3d2=_0x64c3d2-0x0;var _0x1d7853=_0x6343[_0x64c3d2];return _0x1d7853;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('ChatWebsite,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 926534f..981f292 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x482393,_0x355061){var _0x4c07ae=function(_0x139328){while(--_0x139328){_0x482393['push'](_0x482393['shift']());}};_0x4c07ae(++_0x355061);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b3017,_0x531959){_0x3b3017=_0x3b3017-0x0;var _0xd8fd8d=_0xb10b[_0x3b3017];return _0xd8fd8d;};'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 +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5cdbd5,_0x2512c1){var _0x3887ed=function(_0x676f9b){while(--_0x676f9b){_0x5cdbd5['push'](_0x5cdbd5['shift']());}};_0x3887ed(++_0x2512c1);}(_0x7a54,0x106));var _0x47a5=function(_0x935e80,_0x35bbd8){_0x935e80=_0x935e80-0x0;var _0x52b975=_0x7a54[_0x935e80];return _0x52b975;};'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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a42a54f..497f42a 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 _0xcd4e=['/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/users','addAgents','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo'];(function(_0x46507c,_0x22bae8){var _0x2885a5=function(_0x134a3c){while(--_0x134a3c){_0x46507c['push'](_0x46507c['shift']());}};_0x2885a5(++_0x22bae8);}(_0xcd4e,0x123));var _0xecd4=function(_0x1b3c2c,_0x2b8fd5){_0x1b3c2c=_0x1b3c2c-0x0;var _0x497854=_0xcd4e[_0x1b3c2c];return _0x497854;};'use strict';var multer=require(_0xecd4('0x0'));var util=require(_0xecd4('0x1'));var path=require(_0xecd4('0x2'));var timeout=require(_0xecd4('0x3'));var express=require(_0xecd4('0x4'));var router=express['Router']();var auth=require(_0xecd4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecd4('0x6'));var controller=require(_0xecd4('0x7'));router[_0xecd4('0x8')]('/',auth['isAuthenticated'](),controller[_0xecd4('0x9')]);router[_0xecd4('0x8')](_0xecd4('0xa'),auth['isAuthenticated'](),controller[_0xecd4('0xb')]);router[_0xecd4('0x8')](_0xecd4('0xc'),auth[_0xecd4('0xd')](),controller[_0xecd4('0xe')]);router[_0xecd4('0x8')](_0xecd4('0xf'),auth['isAuthenticated'](),controller[_0xecd4('0x10')]);router[_0xecd4('0x8')](_0xecd4('0x11'),auth[_0xecd4('0xd')](),controller['getAnswers']);router[_0xecd4('0x8')](_0xecd4('0x12'),controller['getLogo']);router[_0xecd4('0x8')](_0xecd4('0x13'),controller[_0xecd4('0x14')]);router[_0xecd4('0x8')](_0xecd4('0x15'),controller[_0xecd4('0x16')]);router['get'](_0xecd4('0x17'),controller[_0xecd4('0x18')]);router['get'](_0xecd4('0x19'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x1a')]);router[_0xecd4('0x8')]('/:id/snippet',controller[_0xecd4('0x1b')]);router[_0xecd4('0x8')](_0xecd4('0x1c'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x1d')]);router[_0xecd4('0x8')](_0xecd4('0x1e'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x1f')]);router[_0xecd4('0x8')]('/:id/fields',controller[_0xecd4('0x20')]);router[_0xecd4('0x8')]('/:id/offline_messages',auth[_0xecd4('0xd')](),controller[_0xecd4('0x21')]);router['get']('/:id/users',auth[_0xecd4('0xd')](),controller[_0xecd4('0x22')]);router[_0xecd4('0x23')]('/',auth[_0xecd4('0xd')](),controller[_0xecd4('0x24')]);router[_0xecd4('0x23')](_0xecd4('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xecd4('0x23')]('/:id/canned_answers',auth[_0xecd4('0xd')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xecd4('0x25')]({'destination':function(_0x5d8c70,_0xe57c59,_0x33caef){_0x33caef(null,path[_0xecd4('0x26')](config[_0xecd4('0x27')],_0xecd4('0x28')));},'filename':function(_0x354820,_0x327aed,_0x418f85){_0x418f85(null,util[_0xecd4('0x29')](_0xecd4('0x2a'),Date[_0xecd4('0x2b')](),_0x327aed[_0xecd4('0x2c')]));}})});router[_0xecd4('0x23')]('/:id/logo',upload[_0xecd4('0x2d')](_0xecd4('0x2e')),controller[_0xecd4('0x2f')]);var upload=multer({'storage':multer[_0xecd4('0x25')]({'destination':function(_0x151c8e,_0x3fad86,_0xbd999f){_0xbd999f(null,path[_0xecd4('0x26')](config[_0xecd4('0x27')],_0xecd4('0x30')));},'filename':function(_0x5a62a9,_0x42823b,_0x14c63a){_0x14c63a(null,util['format'](_0xecd4('0x2a'),Date[_0xecd4('0x2b')](),_0x42823b[_0xecd4('0x2c')]));}})});router['post'](_0xecd4('0x13'),upload[_0xecd4('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xecd4('0x25')]({'destination':function(_0x567b56,_0x4982af,_0x29937b){_0x29937b(null,path[_0xecd4('0x26')](config['root'],_0xecd4('0x30')));},'filename':function(_0x518dfe,_0x4bfb12,_0x3867eb){_0x3867eb(null,util[_0xecd4('0x29')](_0xecd4('0x2a'),Date[_0xecd4('0x2b')](),_0x4bfb12['originalname']));}})});router['post'](_0xecd4('0x15'),upload[_0xecd4('0x2d')]('file'),controller[_0xecd4('0x31')]);var upload=multer({'storage':multer[_0xecd4('0x25')]({'destination':function(_0xbeb0bd,_0x989ed9,_0x4c6bbd){_0x4c6bbd(null,path['join'](config[_0xecd4('0x27')],_0xecd4('0x30')));},'filename':function(_0x32afd8,_0x5cd616,_0x4dcb3d){_0x4dcb3d(null,util['format'](_0xecd4('0x2a'),Date[_0xecd4('0x2b')](),_0x5cd616[_0xecd4('0x2c')]));}})});router['post'](_0xecd4('0x17'),upload[_0xecd4('0x2d')]('file'),controller[_0xecd4('0x32')]);router[_0xecd4('0x23')](_0xecd4('0x33'),controller[_0xecd4('0x34')]);router[_0xecd4('0x23')](_0xecd4('0x35'),controller['offline']);router[_0xecd4('0x23')](_0xecd4('0x19'),auth['isAuthenticated'](),controller[_0xecd4('0x36')]);router['post'](_0xecd4('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xecd4('0x1e'),auth[_0xecd4('0xd')](),controller['addProactiveActions']);router['post'](_0xecd4('0x37'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x38')]);router['put']('/:id',auth[_0xecd4('0xd')](),controller[_0xecd4('0x39')]);router[_0xecd4('0x3a')]('/:id',auth['isAuthenticated'](),controller[_0xecd4('0x3b')]);router[_0xecd4('0x3a')](_0xecd4('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xecd4('0x3a')](_0xecd4('0x11'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x3c')]);router['delete'](_0xecd4('0x37'),auth[_0xecd4('0xd')](),controller[_0xecd4('0x3d')]);module['exports']=router; \ No newline at end of file +var _0x67c0=['originalname','/:id/logo','file','addLogo','server/files/images/avatars/','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','/:id/applications','addApplications','update','destroy','delete','/:id/dispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','create','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now'];(function(_0x2084c4,_0x5bd62f){var _0x567d55=function(_0x26c955){while(--_0x26c955){_0x2084c4['push'](_0x2084c4['shift']());}};_0x567d55(++_0x5bd62f);}(_0x67c0,0x197));var _0x067c=function(_0x198677,_0x195a18){_0x198677=_0x198677-0x0;var _0xdf4884=_0x67c0[_0x198677];return _0xdf4884;};'use strict';var multer=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var path=require(_0x067c('0x2'));var timeout=require(_0x067c('0x3'));var express=require(_0x067c('0x4'));var router=express[_0x067c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x067c('0x6'));var config=require(_0x067c('0x7'));var controller=require(_0x067c('0x8'));router[_0x067c('0x9')]('/',auth[_0x067c('0xa')](),controller[_0x067c('0xb')]);router[_0x067c('0x9')](_0x067c('0xc'),auth[_0x067c('0xa')](),controller[_0x067c('0xd')]);router[_0x067c('0x9')](_0x067c('0xe'),auth[_0x067c('0xa')](),controller[_0x067c('0xf')]);router[_0x067c('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x067c('0x10')]);router['get'](_0x067c('0x11'),auth['isAuthenticated'](),controller[_0x067c('0x12')]);router[_0x067c('0x9')]('/:id/logo',controller[_0x067c('0x13')]);router['get'](_0x067c('0x14'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0x067c('0x15')]);router[_0x067c('0x9')](_0x067c('0x16'),controller['getSystemAvatar']);router[_0x067c('0x9')](_0x067c('0x17'),auth[_0x067c('0xa')](),controller['getInteractions']);router[_0x067c('0x9')]('/:id/snippet',controller[_0x067c('0x18')]);router[_0x067c('0x9')]('/:id/applications',auth[_0x067c('0xa')](),controller[_0x067c('0x19')]);router[_0x067c('0x9')](_0x067c('0x1a'),auth[_0x067c('0xa')](),controller[_0x067c('0x1b')]);router[_0x067c('0x9')](_0x067c('0x1c'),controller[_0x067c('0x1d')]);router['get']('/:id/offline_messages',auth[_0x067c('0xa')](),controller['getOfflineMessages']);router[_0x067c('0x9')](_0x067c('0x1e'),auth[_0x067c('0xa')](),controller['getAgents']);router['post']('/',auth[_0x067c('0xa')](),controller[_0x067c('0x1f')]);router[_0x067c('0x20')]('/:id/dispositions',auth[_0x067c('0xa')](),controller[_0x067c('0x21')]);router[_0x067c('0x20')](_0x067c('0x11'),auth[_0x067c('0xa')](),controller[_0x067c('0x22')]);var upload=multer({'storage':multer[_0x067c('0x23')]({'destination':function(_0x3868aa,_0x43c091,_0xe10e29){_0xe10e29(null,path[_0x067c('0x24')](config[_0x067c('0x25')],'server/files/images/logos/'));},'filename':function(_0x4f2e85,_0x10fd3e,_0x23085f){_0x23085f(null,util[_0x067c('0x26')](_0x067c('0x27'),Date[_0x067c('0x28')](),_0x10fd3e[_0x067c('0x29')]));}})});router[_0x067c('0x20')](_0x067c('0x2a'),upload['single'](_0x067c('0x2b')),controller[_0x067c('0x2c')]);var upload=multer({'storage':multer[_0x067c('0x23')]({'destination':function(_0x400e5b,_0x242ae8,_0x4f83aa){_0x4f83aa(null,path[_0x067c('0x24')](config['root'],_0x067c('0x2d')));},'filename':function(_0x1d1b77,_0x2c4430,_0x5a727b){_0x5a727b(null,util[_0x067c('0x26')](_0x067c('0x27'),Date[_0x067c('0x28')](),_0x2c4430['originalname']));}})});router[_0x067c('0x20')](_0x067c('0x14'),upload[_0x067c('0x2e')]('file'),controller[_0x067c('0x2f')]);var upload=multer({'storage':multer[_0x067c('0x23')]({'destination':function(_0x5902c6,_0x4546d1,_0x16eed7){_0x16eed7(null,path[_0x067c('0x24')](config[_0x067c('0x25')],_0x067c('0x2d')));},'filename':function(_0x205450,_0x164884,_0x2eb67c){_0x2eb67c(null,util[_0x067c('0x26')]('%s-%s',Date[_0x067c('0x28')](),_0x164884[_0x067c('0x29')]));}})});router[_0x067c('0x20')](_0x067c('0x30'),upload['single'](_0x067c('0x2b')),controller[_0x067c('0x31')]);var upload=multer({'storage':multer[_0x067c('0x23')]({'destination':function(_0x304229,_0x4f5e10,_0xeea515){_0xeea515(null,path[_0x067c('0x24')](config['root'],_0x067c('0x2d')));},'filename':function(_0x224b3c,_0x5ce4ab,_0x4411ce){_0x4411ce(null,util[_0x067c('0x26')]('%s-%s',Date[_0x067c('0x28')](),_0x5ce4ab[_0x067c('0x29')]));}})});router[_0x067c('0x20')]('/:id/system_avatar',upload[_0x067c('0x2e')](_0x067c('0x2b')),controller['addSystemAvatar']);router[_0x067c('0x20')](_0x067c('0x32'),controller[_0x067c('0x33')]);router[_0x067c('0x20')](_0x067c('0x34'),controller[_0x067c('0x35')]);router[_0x067c('0x20')](_0x067c('0x17'),auth['isAuthenticated'](),controller[_0x067c('0x36')]);router['post'](_0x067c('0x37'),auth[_0x067c('0xa')](),controller[_0x067c('0x38')]);router[_0x067c('0x20')](_0x067c('0x1a'),auth[_0x067c('0xa')](),controller['addProactiveActions']);router[_0x067c('0x20')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x067c('0xe'),auth[_0x067c('0xa')](),controller[_0x067c('0x39')]);router['delete'](_0x067c('0xe'),auth['isAuthenticated'](),controller[_0x067c('0x3a')]);router[_0x067c('0x3b')](_0x067c('0x3c'),auth[_0x067c('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x067c('0xa')](),controller[_0x067c('0x3d')]);router['delete'](_0x067c('0x1e'),auth['isAuthenticated'](),controller[_0x067c('0x3e')]);module[_0x067c('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index da940dd..a83c2e3 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 _0x3974=['sequelize','exports','STRING','Google'];(function(_0x7da239,_0x554000){var _0x4a8f6a=function(_0x364f4d){while(--_0x364f4d){_0x7da239['push'](_0x7da239['shift']());}};_0x4a8f6a(++_0x554000);}(_0x3974,0xbc));var _0x4397=function(_0x77f7e7,_0x193d5d){_0x77f7e7=_0x77f7e7-0x0;var _0xe0ad51=_0x3974[_0x77f7e7];return _0xe0ad51;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'name':{'type':Sequelize[_0x4397('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x4397('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x4397('0x2')]},'data2':{'type':Sequelize[_0x4397('0x2')]}}; \ No newline at end of file +var _0xc492=['exports','STRING','Google','sequelize'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xc492,0xd7));var _0x2c49=function(_0x31547a,_0x4f4d03){_0x31547a=_0x31547a-0x0;var _0x2fba60=_0xc492[_0x31547a];return _0x2fba60;};'use strict';var Sequelize=require(_0x2c49('0x0'));module[_0x2c49('0x1')]={'name':{'type':Sequelize[_0x2c49('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x2c49('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2c55f55..b421182 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 _0xa78d=['count','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x4b5aae,_0x2d3796){var _0x2cc44e=function(_0xf0e66f){while(--_0xf0e66f){_0x4b5aae['push'](_0x4b5aae['shift']());}};_0x2cc44e(++_0x2d3796);}(_0xa78d,0x9d));var _0xda78=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa78d[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda78('0x0'));var rimraf=require(_0xda78('0x1'));var zipdir=require(_0xda78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda78('0x3'));var moment=require('moment');var BPromise=require(_0xda78('0x4'));var Mustache=require(_0xda78('0x5'));var util=require(_0xda78('0x6'));var path=require(_0xda78('0x7'));var sox=require(_0xda78('0x8'));var csv=require(_0xda78('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda78('0xa'));var squel=require(_0xda78('0xb'));var crypto=require(_0xda78('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda78('0xd'));var toCsv=require(_0xda78('0x9'));var querystring=require(_0xda78('0xe'));var Papa=require(_0xda78('0xf'));var Redis=require('ioredis');var authService=require(_0xda78('0x10'));var qs=require(_0xda78('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda78('0x12'));var logger=require(_0xda78('0x13'))(_0xda78('0x14'));var utils=require('../../config/utils');var config=require(_0xda78('0x15'));var db=require(_0xda78('0x16'))['db'];function respondWithStatusCode(_0x1b2a86,_0x10eb0e){_0x10eb0e=_0x10eb0e||0xcc;return function(_0x556105){if(_0x556105){return _0x1b2a86[_0xda78('0x17')](_0x10eb0e);}return _0x1b2a86[_0xda78('0x18')](_0x10eb0e)['end']();};}function respondWithResult(_0x2864b9,_0x3e0cf1){_0x3e0cf1=_0x3e0cf1||0xc8;return function(_0x6012ab){if(_0x6012ab){return _0x2864b9[_0xda78('0x18')](_0x3e0cf1)[_0xda78('0x19')](_0x6012ab);}};}function respondWithFilteredResult(_0x2c019d,_0x3fa7ea){return function(_0xd79f6b){if(_0xd79f6b){var _0x5db8dd=_0xd79f6b['count'],_0x58d8cc=_0x3fa7ea[_0xda78('0x1a')],_0x1e316f=_0x3fa7ea['offset']+_0x3fa7ea[_0xda78('0x1b')],_0xe1f1ac;if(_0x1e316f>=_0x5db8dd){_0x1e316f=_0x5db8dd;_0xe1f1ac=0xc8;}else{_0xe1f1ac=0xce;}_0x2c019d[_0xda78('0x18')](_0xe1f1ac);return _0x2c019d[_0xda78('0x1c')](_0xda78('0x1d'),_0x58d8cc+'-'+_0x1e316f+'/'+_0x5db8dd)[_0xda78('0x19')](_0xd79f6b);}return null;};}function patchUpdates(_0x54df5f){return function(_0x11266d){try{jsonpatch['apply'](_0x11266d,_0x54df5f,!![]);}catch(_0x3f43c4){return BPromise[_0xda78('0x1e')](_0x3f43c4);}return _0x11266d[_0xda78('0x1f')]();};}function saveUpdates(_0x42b15e,_0x299a3e){return function(_0x107091){if(_0x107091){return _0x107091[_0xda78('0x20')](_0x42b15e)[_0xda78('0x21')](function(_0x2955cf){return _0x2955cf;});}return null;};}function removeEntity(_0x2e4120,_0x10e000){return function(_0x369827){if(_0x369827){return _0x369827[_0xda78('0x22')]()[_0xda78('0x21')](function(){_0x2e4120[_0xda78('0x18')](0xcc)[_0xda78('0x23')]();});}};}function handleEntityNotFound(_0x1af891,_0x110626){return function(_0x1f3887){if(!_0x1f3887){_0x1af891['sendStatus'](0x194);}return _0x1f3887;};}function handleError(_0x50fdf6,_0x2aadee){_0x2aadee=_0x2aadee||0x1f4;return function(_0x159c30){logger[_0xda78('0x24')](_0x159c30[_0xda78('0x25')]);if(_0x159c30[_0xda78('0x26')]){delete _0x159c30[_0xda78('0x26')];}_0x50fdf6['status'](_0x2aadee)[_0xda78('0x27')](_0x159c30);};}exports[_0xda78('0x28')]=function(_0x50568b,_0x3e3d5a){var _0x1ce018={},_0x3e3fbe={},_0x276b72={'count':0x0,'rows':[]};var _0x1939db=_[_0xda78('0x29')](db[_0xda78('0x2a')][_0xda78('0x2b')],function(_0x4243ce){return{'name':_0x4243ce[_0xda78('0x2c')],'type':_0x4243ce[_0xda78('0x2d')][_0xda78('0x2e')]};});_0x3e3fbe[_0xda78('0x2f')]=_[_0xda78('0x29')](_0x1939db,_0xda78('0x26'));_0x3e3fbe[_0xda78('0x30')]=_[_0xda78('0x31')](_0x50568b['query']);_0x3e3fbe[_0xda78('0x32')]=_['intersection'](_0x3e3fbe['model'],_0x3e3fbe[_0xda78('0x30')]);_0x1ce018[_0xda78('0x33')]=_[_0xda78('0x34')](_0x3e3fbe[_0xda78('0x2f')],qs[_0xda78('0x35')](_0x50568b[_0xda78('0x30')][_0xda78('0x35')]));_0x1ce018[_0xda78('0x33')]=_0x1ce018['attributes'][_0xda78('0x36')]?_0x1ce018[_0xda78('0x33')]:_0x3e3fbe[_0xda78('0x2f')];if(!_0x50568b[_0xda78('0x30')][_0xda78('0x37')](_0xda78('0x38'))){_0x1ce018['limit']=qs[_0xda78('0x1b')](_0x50568b[_0xda78('0x30')]['limit']);_0x1ce018[_0xda78('0x1a')]=qs['offset'](_0x50568b[_0xda78('0x30')][_0xda78('0x1a')]);}_0x1ce018[_0xda78('0x39')]=qs[_0xda78('0x3a')](_0x50568b[_0xda78('0x30')][_0xda78('0x3a')]);_0x1ce018[_0xda78('0x3b')]=qs['filters'](_[_0xda78('0x3c')](_0x50568b[_0xda78('0x30')],_0x3e3fbe['filters']),_0x1939db);if(_0x50568b['query'][_0xda78('0x3d')]){_0x1ce018['where']=_[_0xda78('0x3e')](_0x1ce018[_0xda78('0x3b')],{'$or':_[_0xda78('0x29')](_0x1939db,function(_0x1007ff){if(_0x1007ff[_0xda78('0x2d')]!==_0xda78('0x3f')){var _0x14284f={};_0x14284f[_0x1007ff[_0xda78('0x26')]]={'$like':'%'+_0x50568b[_0xda78('0x30')][_0xda78('0x3d')]+'%'};return _0x14284f;}})});}_0x1ce018=_['merge']({},_0x1ce018,_0x50568b[_0xda78('0x40')]);var _0x362c69={'where':_0x1ce018[_0xda78('0x3b')]};return db[_0xda78('0x2a')][_0xda78('0x41')](_0x362c69)['then'](function(_0x1286c4){_0x276b72[_0xda78('0x41')]=_0x1286c4;if(_0x50568b[_0xda78('0x30')][_0xda78('0x42')]){_0x1ce018[_0xda78('0x43')]=[{'all':!![]}];}return db[_0xda78('0x2a')][_0xda78('0x44')](_0x1ce018);})[_0xda78('0x21')](function(_0x40da7a){_0x276b72['rows']=_0x40da7a;return _0x276b72;})[_0xda78('0x21')](respondWithFilteredResult(_0x3e3d5a,_0x1ce018))[_0xda78('0x45')](handleError(_0x3e3d5a,null));};exports['show']=function(_0x449b6c,_0x26e554){var _0x5cbe14={'raw':!![],'where':{'id':_0x449b6c[_0xda78('0x46')]['id']}},_0x5ac784={};_0x5ac784[_0xda78('0x2f')]=_[_0xda78('0x31')](db[_0xda78('0x2a')]['rawAttributes']);_0x5ac784[_0xda78('0x30')]=_[_0xda78('0x31')](_0x449b6c[_0xda78('0x30')]);_0x5ac784[_0xda78('0x32')]=_[_0xda78('0x34')](_0x5ac784[_0xda78('0x2f')],_0x5ac784[_0xda78('0x30')]);_0x5cbe14['attributes']=_[_0xda78('0x34')](_0x5ac784['model'],qs[_0xda78('0x35')](_0x449b6c[_0xda78('0x30')][_0xda78('0x35')]));_0x5cbe14[_0xda78('0x33')]=_0x5cbe14[_0xda78('0x33')][_0xda78('0x36')]?_0x5cbe14[_0xda78('0x33')]:_0x5ac784[_0xda78('0x2f')];if(_0x449b6c[_0xda78('0x30')]['includeAll']){_0x5cbe14[_0xda78('0x43')]=[{'all':!![]}];}_0x5cbe14=_[_0xda78('0x3e')]({},_0x5cbe14,_0x449b6c[_0xda78('0x40')]);return db[_0xda78('0x2a')][_0xda78('0x47')](_0x5cbe14)[_0xda78('0x21')](handleEntityNotFound(_0x26e554,null))[_0xda78('0x21')](respondWithResult(_0x26e554,null))[_0xda78('0x45')](handleError(_0x26e554,null));};exports[_0xda78('0x48')]=function(_0x1464d7,_0x148674){return db[_0xda78('0x2a')][_0xda78('0x48')](_0x1464d7['body'],{})['then'](respondWithResult(_0x148674,0xc9))[_0xda78('0x45')](handleError(_0x148674,null));};exports[_0xda78('0x20')]=function(_0x24e461,_0x2795c4){if(_0x24e461['body']['id']){delete _0x24e461[_0xda78('0x49')]['id'];}return db[_0xda78('0x2a')][_0xda78('0x47')]({'where':{'id':_0x24e461[_0xda78('0x46')]['id']}})[_0xda78('0x21')](handleEntityNotFound(_0x2795c4,null))[_0xda78('0x21')](saveUpdates(_0x24e461['body'],null))[_0xda78('0x21')](respondWithResult(_0x2795c4,null))[_0xda78('0x45')](handleError(_0x2795c4,null));};exports[_0xda78('0x22')]=function(_0x4447cf,_0x14ecc4){return db['CloudProvider'][_0xda78('0x47')]({'where':{'id':_0x4447cf[_0xda78('0x46')]['id']}})[_0xda78('0x21')](handleEntityNotFound(_0x14ecc4,null))[_0xda78('0x21')](removeEntity(_0x14ecc4,null))['catch'](handleError(_0x14ecc4,null));}; \ No newline at end of file +var _0x92d5=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','count','limit','set','apply','update','then','destroy','end','sendStatus','error','stack','name','index','CloudProvider','fieldName','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','offset','order'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x92d5,0x1b5));var _0x592d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x92d5[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x592d('0x0'));var emlformat=require(_0x592d('0x1'));var rimraf=require(_0x592d('0x2'));var zipdir=require(_0x592d('0x3'));var jsonpatch=require(_0x592d('0x4'));var rp=require(_0x592d('0x5'));var moment=require('moment');var BPromise=require(_0x592d('0x6'));var Mustache=require('mustache');var util=require(_0x592d('0x7'));var path=require(_0x592d('0x8'));var sox=require(_0x592d('0x9'));var csv=require('to-csv');var ejs=require(_0x592d('0xa'));var fs=require('fs');var _=require(_0x592d('0xb'));var squel=require(_0x592d('0xc'));var crypto=require(_0x592d('0xd'));var jsforce=require(_0x592d('0xe'));var deskjs=require(_0x592d('0xf'));var toCsv=require(_0x592d('0x10'));var querystring=require(_0x592d('0x11'));var Papa=require(_0x592d('0x12'));var Redis=require(_0x592d('0x13'));var authService=require(_0x592d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x592d('0x15'));var hardwareService=require(_0x592d('0x16'));var logger=require(_0x592d('0x17'))(_0x592d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2926c0,_0x5d7f1a){_0x5d7f1a=_0x5d7f1a||0xcc;return function(_0x3b34e6){if(_0x3b34e6){return _0x2926c0['sendStatus'](_0x5d7f1a);}return _0x2926c0[_0x592d('0x19')](_0x5d7f1a)['end']();};}function respondWithResult(_0x461cf0,_0x551b83){_0x551b83=_0x551b83||0xc8;return function(_0x16d2bf){if(_0x16d2bf){return _0x461cf0[_0x592d('0x19')](_0x551b83)[_0x592d('0x1a')](_0x16d2bf);}};}function respondWithFilteredResult(_0x51b473,_0x1b3ce1){return function(_0x52606f){if(_0x52606f){var _0x1a7e0a=_0x52606f[_0x592d('0x1b')],_0x39ac1f=_0x1b3ce1['offset'],_0x5c8a8b=_0x1b3ce1['offset']+_0x1b3ce1[_0x592d('0x1c')],_0x4b3c0e;if(_0x5c8a8b>=_0x1a7e0a){_0x5c8a8b=_0x1a7e0a;_0x4b3c0e=0xc8;}else{_0x4b3c0e=0xce;}_0x51b473[_0x592d('0x19')](_0x4b3c0e);return _0x51b473[_0x592d('0x1d')]('Content-Range',_0x39ac1f+'-'+_0x5c8a8b+'/'+_0x1a7e0a)[_0x592d('0x1a')](_0x52606f);}return null;};}function patchUpdates(_0x1e1963){return function(_0xeccdab){try{jsonpatch[_0x592d('0x1e')](_0xeccdab,_0x1e1963,!![]);}catch(_0xe6ebf1){return BPromise['reject'](_0xe6ebf1);}return _0xeccdab['save']();};}function saveUpdates(_0x2020a1,_0x315352){return function(_0x15466e){if(_0x15466e){return _0x15466e[_0x592d('0x1f')](_0x2020a1)[_0x592d('0x20')](function(_0x2f87ed){return _0x2f87ed;});}return null;};}function removeEntity(_0x150a3a,_0x1ed1e7){return function(_0x347803){if(_0x347803){return _0x347803[_0x592d('0x21')]()[_0x592d('0x20')](function(){_0x150a3a[_0x592d('0x19')](0xcc)[_0x592d('0x22')]();});}};}function handleEntityNotFound(_0x4b65fb,_0x5aee5b){return function(_0x54f984){if(!_0x54f984){_0x4b65fb[_0x592d('0x23')](0x194);}return _0x54f984;};}function handleError(_0xb1b824,_0x818bb8){_0x818bb8=_0x818bb8||0x1f4;return function(_0x2a9835){logger[_0x592d('0x24')](_0x2a9835[_0x592d('0x25')]);if(_0x2a9835[_0x592d('0x26')]){delete _0x2a9835[_0x592d('0x26')];}_0xb1b824[_0x592d('0x19')](_0x818bb8)['send'](_0x2a9835);};}exports[_0x592d('0x27')]=function(_0x3d84e6,_0x328ee8){var _0x5becdb={},_0x3dd4ed={},_0x1c5d31={'count':0x0,'rows':[]};var _0x2a140f=_['map'](db[_0x592d('0x28')]['rawAttributes'],function(_0x57b49b){return{'name':_0x57b49b[_0x592d('0x29')],'type':_0x57b49b['type']['key']};});_0x3dd4ed[_0x592d('0x2a')]=_[_0x592d('0x2b')](_0x2a140f,_0x592d('0x26'));_0x3dd4ed[_0x592d('0x2c')]=_[_0x592d('0x2d')](_0x3d84e6[_0x592d('0x2c')]);_0x3dd4ed[_0x592d('0x2e')]=_['intersection'](_0x3dd4ed[_0x592d('0x2a')],_0x3dd4ed[_0x592d('0x2c')]);_0x5becdb[_0x592d('0x2f')]=_[_0x592d('0x30')](_0x3dd4ed['model'],qs['fields'](_0x3d84e6[_0x592d('0x2c')][_0x592d('0x31')]));_0x5becdb[_0x592d('0x2f')]=_0x5becdb[_0x592d('0x2f')]['length']?_0x5becdb[_0x592d('0x2f')]:_0x3dd4ed[_0x592d('0x2a')];if(!_0x3d84e6[_0x592d('0x2c')][_0x592d('0x32')]('nolimit')){_0x5becdb['limit']=qs['limit'](_0x3d84e6[_0x592d('0x2c')][_0x592d('0x1c')]);_0x5becdb[_0x592d('0x33')]=qs[_0x592d('0x33')](_0x3d84e6[_0x592d('0x2c')]['offset']);}_0x5becdb[_0x592d('0x34')]=qs[_0x592d('0x35')](_0x3d84e6[_0x592d('0x2c')][_0x592d('0x35')]);_0x5becdb[_0x592d('0x36')]=qs[_0x592d('0x2e')](_[_0x592d('0x37')](_0x3d84e6[_0x592d('0x2c')],_0x3dd4ed[_0x592d('0x2e')]),_0x2a140f);if(_0x3d84e6[_0x592d('0x2c')][_0x592d('0x38')]){_0x5becdb['where']=_[_0x592d('0x39')](_0x5becdb[_0x592d('0x36')],{'$or':_[_0x592d('0x2b')](_0x2a140f,function(_0x32c496){if(_0x32c496['type']!==_0x592d('0x3a')){var _0x47c004={};_0x47c004[_0x32c496['name']]={'$like':'%'+_0x3d84e6['query'][_0x592d('0x38')]+'%'};return _0x47c004;}})});}_0x5becdb=_['merge']({},_0x5becdb,_0x3d84e6[_0x592d('0x3b')]);var _0x2b75e2={'where':_0x5becdb[_0x592d('0x36')]};return db[_0x592d('0x28')]['count'](_0x2b75e2)['then'](function(_0xcb7706){_0x1c5d31[_0x592d('0x1b')]=_0xcb7706;if(_0x3d84e6[_0x592d('0x2c')][_0x592d('0x3c')]){_0x5becdb[_0x592d('0x3d')]=[{'all':!![]}];}return db[_0x592d('0x28')]['findAll'](_0x5becdb);})[_0x592d('0x20')](function(_0x273c6a){_0x1c5d31['rows']=_0x273c6a;return _0x1c5d31;})['then'](respondWithFilteredResult(_0x328ee8,_0x5becdb))[_0x592d('0x3e')](handleError(_0x328ee8,null));};exports[_0x592d('0x3f')]=function(_0x10f76b,_0x7ab00a){var _0x483246={'raw':!![],'where':{'id':_0x10f76b[_0x592d('0x40')]['id']}},_0x5937e6={};_0x5937e6[_0x592d('0x2a')]=_[_0x592d('0x2d')](db[_0x592d('0x28')][_0x592d('0x41')]);_0x5937e6['query']=_[_0x592d('0x2d')](_0x10f76b['query']);_0x5937e6[_0x592d('0x2e')]=_['intersection'](_0x5937e6[_0x592d('0x2a')],_0x5937e6['query']);_0x483246[_0x592d('0x2f')]=_['intersection'](_0x5937e6[_0x592d('0x2a')],qs[_0x592d('0x31')](_0x10f76b[_0x592d('0x2c')][_0x592d('0x31')]));_0x483246[_0x592d('0x2f')]=_0x483246['attributes'][_0x592d('0x42')]?_0x483246[_0x592d('0x2f')]:_0x5937e6[_0x592d('0x2a')];if(_0x10f76b[_0x592d('0x2c')][_0x592d('0x3c')]){_0x483246[_0x592d('0x3d')]=[{'all':!![]}];}_0x483246=_['merge']({},_0x483246,_0x10f76b[_0x592d('0x3b')]);return db['CloudProvider'][_0x592d('0x43')](_0x483246)[_0x592d('0x20')](handleEntityNotFound(_0x7ab00a,null))[_0x592d('0x20')](respondWithResult(_0x7ab00a,null))[_0x592d('0x3e')](handleError(_0x7ab00a,null));};exports[_0x592d('0x44')]=function(_0x5a1934,_0x3b773d){return db[_0x592d('0x28')]['create'](_0x5a1934[_0x592d('0x45')],{})[_0x592d('0x20')](respondWithResult(_0x3b773d,0xc9))['catch'](handleError(_0x3b773d,null));};exports[_0x592d('0x1f')]=function(_0x4ccdd7,_0x260513){if(_0x4ccdd7[_0x592d('0x45')]['id']){delete _0x4ccdd7['body']['id'];}return db[_0x592d('0x28')][_0x592d('0x43')]({'where':{'id':_0x4ccdd7[_0x592d('0x40')]['id']}})[_0x592d('0x20')](handleEntityNotFound(_0x260513,null))[_0x592d('0x20')](saveUpdates(_0x4ccdd7[_0x592d('0x45')],null))['then'](respondWithResult(_0x260513,null))[_0x592d('0x3e')](handleError(_0x260513,null));};exports[_0x592d('0x21')]=function(_0x1f3ddf,_0x41037e){return db[_0x592d('0x28')][_0x592d('0x43')]({'where':{'id':_0x1f3ddf['params']['id']}})[_0x592d('0x20')](handleEntityNotFound(_0x41037e,null))[_0x592d('0x20')](removeEntity(_0x41037e,null))['catch'](handleError(_0x41037e,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3aedf4f..c9aee0c 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 _0x3c8e=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x2cbb74,_0x241c10){var _0xa6d18=function(_0x5a2940){while(--_0x5a2940){_0x2cbb74['push'](_0x2cbb74['shift']());}};_0xa6d18(++_0x241c10);}(_0x3c8e,0xfd));var _0xe3c8=function(_0x2b2a99,_0x5c4694){_0x2b2a99=_0x2b2a99-0x0;var _0x28760b=_0x3c8e[_0x2b2a99];return _0x28760b;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var logger=require(_0xe3c8('0x2'))('api');var moment=require(_0xe3c8('0x3'));var BPromise=require(_0xe3c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c8('0x5'));var rimraf=require(_0xe3c8('0x6'));var config=require(_0xe3c8('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xe3c8('0x8')]=function(_0x4c1930,_0x5c17df){return _0x4c1930[_0xe3c8('0x9')](_0xe3c8('0xa'),attributes,{'tableName':_0xe3c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28d9=['rimraf','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','moment','request-promise','path'];(function(_0x28ee4e,_0x2faaf0){var _0x135a13=function(_0x5bb126){while(--_0x5bb126){_0x28ee4e['push'](_0x28ee4e['shift']());}};_0x135a13(++_0x2faaf0);}(_0x28d9,0x1d9));var _0x928d=function(_0x40969f,_0x2e8f81){_0x40969f=_0x40969f-0x0;var _0x35ad93=_0x28d9[_0x40969f];return _0x35ad93;};'use strict';var _=require(_0x928d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x928d('0x1'));var BPromise=require('bluebird');var rp=require(_0x928d('0x2'));var fs=require('fs');var path=require(_0x928d('0x3'));var rimraf=require(_0x928d('0x4'));var config=require('../../config/environment');var attributes=require(_0x928d('0x5'));module[_0x928d('0x6')]=function(_0x312ce1,_0x1e4835){return _0x312ce1['define'](_0x928d('0x7'),attributes,{'tableName':_0x928d('0x8'),'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 6c455f8..f65e92a 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 _0x8426=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3fb07b,_0x2920ca){var _0x15cdb4=function(_0x93d9d5){while(--_0x93d9d5){_0x3fb07b['push'](_0x3fb07b['shift']());}};_0x15cdb4(++_0x2920ca);}(_0x8426,0x116));var _0x6842=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8426[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x6842('0x0'));var moment=require(_0x6842('0x1'));var BPromise=require(_0x6842('0x2'));var rs=require(_0x6842('0x3'));var fs=require('fs');var Redis=require(_0x6842('0x4'));var db=require(_0x6842('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6842('0x6'))(_0x6842('0x7'));var config=require(_0x6842('0x8'));var jayson=require(_0x6842('0x9'));var client=jayson[_0x6842('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39ae34,_0x42a1f0,_0x3610af){return new BPromise(function(_0x6aa9ab,_0x98c3ec){return client['request'](_0x39ae34,_0x3610af)[_0x6842('0xb')](function(_0x14790d){logger['info'](_0x6842('0xc'),_0x42a1f0,'request\x20sent');logger[_0x6842('0xd')](_0x6842('0xe'),_0x42a1f0,_0x6842('0xf'),JSON[_0x6842('0x10')](_0x14790d));if(_0x14790d['error']){if(_0x14790d[_0x6842('0x11')]['code']===0x1f4){logger[_0x6842('0x11')](_0x6842('0xc'),_0x42a1f0,_0x14790d[_0x6842('0x11')]['message']);return _0x98c3ec(_0x14790d[_0x6842('0x11')]['message']);}logger[_0x6842('0x11')]('CloudProvider,\x20%s,\x20%s',_0x42a1f0,_0x14790d[_0x6842('0x11')][_0x6842('0x12')]);return _0x6aa9ab(_0x14790d[_0x6842('0x11')][_0x6842('0x12')]);}else{logger['info'](_0x6842('0xc'),_0x42a1f0,_0x6842('0xf'));_0x6aa9ab(_0x14790d[_0x6842('0x13')][_0x6842('0x12')]);}})[_0x6842('0x14')](function(_0x3fca11){logger[_0x6842('0x11')](_0x6842('0xc'),_0x42a1f0,_0x3fca11);_0x98c3ec(_0x3fca11);});});} \ No newline at end of file +var _0x03ab=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0x03ab,0xda));var _0xb03a=function(_0xcf03f4,_0x669f9c){_0xcf03f4=_0xcf03f4-0x0;var _0x59b6c2=_0x03ab[_0xcf03f4];return _0x59b6c2;};'use strict';var _=require(_0xb03a('0x0'));var util=require(_0xb03a('0x1'));var moment=require(_0xb03a('0x2'));var BPromise=require(_0xb03a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb03a('0x4'));var db=require(_0xb03a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb03a('0x6'))(_0xb03a('0x7'));var config=require(_0xb03a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb03a('0x9')][_0xb03a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1090d2,_0x586b66,_0x4f51c){return new BPromise(function(_0x499123,_0x4ed0cb){return client[_0xb03a('0xb')](_0x1090d2,_0x4f51c)[_0xb03a('0xc')](function(_0x187c39){logger[_0xb03a('0xd')](_0xb03a('0xe'),_0x586b66,'request\x20sent');logger[_0xb03a('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x586b66,'request\x20sent',JSON[_0xb03a('0x10')](_0x187c39));if(_0x187c39[_0xb03a('0x11')]){if(_0x187c39['error'][_0xb03a('0x12')]===0x1f4){logger[_0xb03a('0x11')](_0xb03a('0xe'),_0x586b66,_0x187c39[_0xb03a('0x11')][_0xb03a('0x13')]);return _0x4ed0cb(_0x187c39[_0xb03a('0x11')][_0xb03a('0x13')]);}logger[_0xb03a('0x11')](_0xb03a('0xe'),_0x586b66,_0x187c39[_0xb03a('0x11')][_0xb03a('0x13')]);return _0x499123(_0x187c39[_0xb03a('0x11')][_0xb03a('0x13')]);}else{logger[_0xb03a('0xd')](_0xb03a('0xe'),_0x586b66,'request\x20sent');_0x499123(_0x187c39[_0xb03a('0x14')][_0xb03a('0x13')]);}})[_0xb03a('0x15')](function(_0xda1a51){logger[_0xb03a('0x11')](_0xb03a('0xe'),_0x586b66,_0xda1a51);_0x4ed0cb(_0xda1a51);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index abc65e1..716e46f 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 _0xf0d8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','get','post','create','put','/:id','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0d8,0x13f));var _0x8f0d=function(_0x4cad1b,_0x3ae807){_0x4cad1b=_0x4cad1b-0x0;var _0x1b65fe=_0xf0d8[_0x4cad1b];return _0x1b65fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f0d('0x0'));var timeout=require(_0x8f0d('0x1'));var express=require(_0x8f0d('0x2'));var router=express[_0x8f0d('0x3')]();var auth=require(_0x8f0d('0x4'));var interaction=require(_0x8f0d('0x5'));var config=require(_0x8f0d('0x6'));var controller=require(_0x8f0d('0x7'));router['get']('/',auth[_0x8f0d('0x8')](),controller['index']);router[_0x8f0d('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8f0d('0xa')]('/',auth[_0x8f0d('0x8')](),controller[_0x8f0d('0xb')]);router[_0x8f0d('0xc')](_0x8f0d('0xd'),auth[_0x8f0d('0x8')](),controller[_0x8f0d('0xe')]);router[_0x8f0d('0xf')](_0x8f0d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8f0d('0x10')]=router; \ No newline at end of file +var _0x00e5=['./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x00e5,0xd6));var _0x500e=function(_0x22a29a,_0x4f0d4f){_0x22a29a=_0x22a29a-0x0;var _0x188b41=_0x00e5[_0x22a29a];return _0x188b41;};'use strict';var multer=require('multer');var util=require(_0x500e('0x0'));var path=require(_0x500e('0x1'));var timeout=require(_0x500e('0x2'));var express=require('express');var router=express[_0x500e('0x3')]();var auth=require(_0x500e('0x4'));var interaction=require(_0x500e('0x5'));var config=require(_0x500e('0x6'));var controller=require(_0x500e('0x7'));router[_0x500e('0x8')]('/',auth[_0x500e('0x9')](),controller[_0x500e('0xa')]);router[_0x500e('0x8')](_0x500e('0xb'),auth[_0x500e('0x9')](),controller[_0x500e('0xc')]);router[_0x500e('0xd')]('/',auth[_0x500e('0x9')](),controller[_0x500e('0xe')]);router[_0x500e('0xf')](_0x500e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x500e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x500e('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index dae4923..b62e40e 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 _0xb82e=['sequelize','exports','STRING','name'];(function(_0x59a313,_0x4ac352){var _0x304587=function(_0x1bdd11){while(--_0x1bdd11){_0x59a313['push'](_0x59a313['shift']());}};_0x304587(++_0x4ac352);}(_0xb82e,0xa0));var _0xeb82=function(_0x5cdf5e,_0x36c34b){_0x5cdf5e=_0x5cdf5e-0x0;var _0x50a5f4=_0xb82e[_0x5cdf5e];return _0x50a5f4;};'use strict';var Sequelize=require(_0xeb82('0x0'));module[_0xeb82('0x1')]={'name':{'type':Sequelize[_0xeb82('0x2')],'unique':_0xeb82('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xeb82('0x2')]},'companyId':{'type':Sequelize[_0xeb82('0x2')]},'website':{'type':Sequelize[_0xeb82('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xeb82('0x2')]},'type':{'type':Sequelize[_0xeb82('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xeb82('0x2')]},'city':{'type':Sequelize[_0xeb82('0x2')]},'country':{'type':Sequelize[_0xeb82('0x2')]},'email':{'type':Sequelize[_0xeb82('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xeb82('0x2')]},'sPostalCode':{'type':Sequelize[_0xeb82('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xeb82('0x2')]},'description':{'type':Sequelize[_0xeb82('0x2')]}}; \ No newline at end of file +var _0x869e=['STRING','sequelize','exports','name'];(function(_0x2ebd19,_0x4666e4){var _0x1ec212=function(_0x3dc40a){while(--_0x3dc40a){_0x2ebd19['push'](_0x2ebd19['shift']());}};_0x1ec212(++_0x4666e4);}(_0x869e,0x119));var _0xe869=function(_0x3b3a6c,_0x2867ef){_0x3b3a6c=_0x3b3a6c-0x0;var _0x21691c=_0x869e[_0x3b3a6c];return _0x21691c;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe869('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe869('0x3')]},'companyId':{'type':Sequelize[_0xe869('0x3')]},'website':{'type':Sequelize[_0xe869('0x3')]},'phone':{'type':Sequelize[_0xe869('0x3')]},'fax':{'type':Sequelize[_0xe869('0x3')]},'type':{'type':Sequelize[_0xe869('0x3')]},'street':{'type':Sequelize[_0xe869('0x3')]},'postalCode':{'type':Sequelize[_0xe869('0x3')]},'city':{'type':Sequelize[_0xe869('0x3')]},'country':{'type':Sequelize[_0xe869('0x3')]},'email':{'type':Sequelize[_0xe869('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe869('0x3')]},'sStreet':{'type':Sequelize[_0xe869('0x3')]},'sPostalCode':{'type':Sequelize[_0xe869('0x3')]},'sCity':{'type':Sequelize[_0xe869('0x3')]},'sCountry':{'type':Sequelize[_0xe869('0x3')]},'description':{'type':Sequelize[_0xe869('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 481d7d1..a573601 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 _0x71fa=['get','Companies','then','end','error','stack','name','describe','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','map','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy'];(function(_0x515e13,_0x3fabd7){var _0x1dd659=function(_0xc76ee7){while(--_0xc76ee7){_0x515e13['push'](_0x515e13['shift']());}};_0x1dd659(++_0x3fabd7);}(_0x71fa,0x1d1));var _0xa71f=function(_0x3e5010,_0x4e9599){_0x3e5010=_0x3e5010-0x0;var _0x363551=_0x71fa[_0x3e5010];return _0x363551;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa71f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa71f('0x1'));var jsonpatch=require(_0xa71f('0x2'));var rp=require(_0xa71f('0x3'));var moment=require(_0xa71f('0x4'));var BPromise=require(_0xa71f('0x5'));var Mustache=require(_0xa71f('0x6'));var util=require(_0xa71f('0x7'));var path=require('path');var sox=require(_0xa71f('0x8'));var csv=require(_0xa71f('0x9'));var ejs=require(_0xa71f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa71f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa71f('0xc'));var toCsv=require(_0xa71f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa71f('0xd'));var authService=require(_0xa71f('0xe'));var qs=require(_0xa71f('0xf'));var as=require(_0xa71f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa71f('0x11'))(_0xa71f('0x12'));var utils=require(_0xa71f('0x13'));var config=require(_0xa71f('0x14'));var db=require(_0xa71f('0x15'))['db'];function respondWithStatusCode(_0x4865a2,_0x26ba60){_0x26ba60=_0x26ba60||0xcc;return function(_0x59f44c){if(_0x59f44c){return _0x4865a2[_0xa71f('0x16')](_0x26ba60);}return _0x4865a2['status'](_0x26ba60)['end']();};}function respondWithResult(_0x2ad223,_0x5dac31){_0x5dac31=_0x5dac31||0xc8;return function(_0x2c38da){if(_0x2c38da){return _0x2ad223[_0xa71f('0x17')](_0x5dac31)[_0xa71f('0x18')](_0x2c38da);}};}function respondWithFilteredResult(_0x3e572f,_0x3044b1){return function(_0x421930){if(_0x421930){var _0x409665=_0x421930[_0xa71f('0x19')],_0x42bf7e=_0x3044b1[_0xa71f('0x1a')],_0x460544=_0x3044b1[_0xa71f('0x1a')]+_0x3044b1[_0xa71f('0x1b')],_0xde20d5;if(_0x460544>=_0x409665){_0x460544=_0x409665;_0xde20d5=0xc8;}else{_0xde20d5=0xce;}_0x3e572f[_0xa71f('0x17')](_0xde20d5);return _0x3e572f[_0xa71f('0x1c')](_0xa71f('0x1d'),_0x42bf7e+'-'+_0x460544+'/'+_0x409665)['json'](_0x421930);}return null;};}function patchUpdates(_0x1ef262){return function(_0x4945aa){try{jsonpatch[_0xa71f('0x1e')](_0x4945aa,_0x1ef262,!![]);}catch(_0x127579){return BPromise['reject'](_0x127579);}return _0x4945aa['save']();};}function saveUpdates(_0x3f62c8,_0x511b56){return function(_0x231694){if(_0x231694){return _0x231694[_0xa71f('0x1f')](_0x3f62c8)['then'](function(_0x1809f1){return _0x1809f1;});}return null;};}function removeEntity(_0x2a42e9,_0x49822f){return function(_0x186807){if(_0x186807){return _0x186807[_0xa71f('0x20')]()['then'](function(){var _0x307e36=_0x186807[_0xa71f('0x21')]({'plain':!![]});var _0x10661b=_0xa71f('0x22');return db['UserProfileResource'][_0xa71f('0x20')]({'where':{'type':_0x10661b,'resourceId':_0x307e36['id']}})[_0xa71f('0x23')](function(){return _0x186807;});})['then'](function(){_0x2a42e9[_0xa71f('0x17')](0xcc)[_0xa71f('0x24')]();});}};}function handleEntityNotFound(_0x1a7e10,_0x1e1151){return function(_0x57deec){if(!_0x57deec){_0x1a7e10[_0xa71f('0x16')](0x194);}return _0x57deec;};}function handleError(_0x7802a0,_0x4639b6){_0x4639b6=_0x4639b6||0x1f4;return function(_0xc351fd){logger[_0xa71f('0x25')](_0xc351fd[_0xa71f('0x26')]);if(_0xc351fd[_0xa71f('0x27')]){delete _0xc351fd[_0xa71f('0x27')];}_0x7802a0['status'](_0x4639b6)['send'](_0xc351fd);};}exports['index']=function(_0x5d98e8,_0x4c3b21){var _0x5b362d={},_0x333bd1={},_0x10935c={'count':0x0,'rows':[]};return db['CmCompany'][_0xa71f('0x28')]()['then'](function(_0x1926e5){_0x333bd1['model']=_[_0xa71f('0x29')](_0x1926e5);_0x333bd1[_0xa71f('0x2a')]=_[_0xa71f('0x29')](_0x5d98e8['query']);_0x333bd1[_0xa71f('0x2b')]=_[_0xa71f('0x2c')](_0x333bd1[_0xa71f('0x2d')],_0x333bd1[_0xa71f('0x2a')]);_0x5b362d[_0xa71f('0x2e')]=_[_0xa71f('0x2c')](_0x333bd1[_0xa71f('0x2d')],qs[_0xa71f('0x2f')](_0x5d98e8[_0xa71f('0x2a')][_0xa71f('0x2f')]));_0x5b362d[_0xa71f('0x2e')]=_0x5b362d[_0xa71f('0x2e')]['length']?_0x5b362d[_0xa71f('0x2e')]:_0x333bd1[_0xa71f('0x2d')];if(!_0x5d98e8['query']['hasOwnProperty'](_0xa71f('0x30'))){_0x5b362d[_0xa71f('0x1b')]=qs['limit'](_0x5d98e8[_0xa71f('0x2a')][_0xa71f('0x1b')]);_0x5b362d['offset']=qs['offset'](_0x5d98e8['query'][_0xa71f('0x1a')]);}_0x5b362d[_0xa71f('0x31')]=qs['sort'](_0x5d98e8[_0xa71f('0x2a')][_0xa71f('0x32')]);_0x5b362d[_0xa71f('0x33')]=qs['filters'](_[_0xa71f('0x34')](_0x5d98e8[_0xa71f('0x2a')],_0x333bd1[_0xa71f('0x2b')]),_0x1926e5);if(_0x5d98e8[_0xa71f('0x2a')][_0xa71f('0x35')]){_0x5b362d[_0xa71f('0x33')]=_['merge'](_0x5b362d[_0xa71f('0x33')],{'$or':_['map'](_0x5b362d[_0xa71f('0x2e')],function(_0x4b6a3f){var _0x4a66cd={};_0x4a66cd[_0x4b6a3f]={'$like':'%'+_0x5d98e8[_0xa71f('0x2a')][_0xa71f('0x35')]+'%'};return _0x4a66cd;})});}_0x5b362d=_[_0xa71f('0x36')]({},_0x5b362d,_0x5d98e8[_0xa71f('0x37')]);var _0x497f18={'where':_0x5b362d[_0xa71f('0x33')]};return db[_0xa71f('0x38')][_0xa71f('0x19')](_0x497f18)[_0xa71f('0x23')](function(_0x459d81){_0x10935c[_0xa71f('0x19')]=_0x459d81;if(_0x5d98e8['query'][_0xa71f('0x39')]){_0x5b362d[_0xa71f('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0xa71f('0x3b')](_0x5b362d);})['then'](function(_0x70ee3d){_0x10935c[_0xa71f('0x3c')]=_0x70ee3d;return _0x10935c;})['then'](respondWithFilteredResult(_0x4c3b21,_0x5b362d))[_0xa71f('0x3d')](handleError(_0x4c3b21,null));})['catch'](handleError(_0x4c3b21,null));};exports[_0xa71f('0x3e')]=function(_0x506eec,_0x2c7f97){var _0x2d23a5={'raw':![],'where':{'id':_0x506eec[_0xa71f('0x3f')]['id']}},_0x28365a={};_0x28365a[_0xa71f('0x2d')]=_['keys'](db[_0xa71f('0x38')][_0xa71f('0x40')]);_0x28365a[_0xa71f('0x2a')]=_[_0xa71f('0x29')](_0x506eec[_0xa71f('0x2a')]);_0x28365a[_0xa71f('0x2b')]=_[_0xa71f('0x2c')](_0x28365a['model'],_0x28365a['query']);_0x2d23a5[_0xa71f('0x2e')]=_[_0xa71f('0x2c')](_0x28365a[_0xa71f('0x2d')],qs['fields'](_0x506eec[_0xa71f('0x2a')][_0xa71f('0x2f')]));_0x2d23a5[_0xa71f('0x2e')]=_0x2d23a5[_0xa71f('0x2e')][_0xa71f('0x41')]?_0x2d23a5[_0xa71f('0x2e')]:_0x28365a[_0xa71f('0x2d')];if(_0x506eec[_0xa71f('0x2a')][_0xa71f('0x39')]){_0x2d23a5[_0xa71f('0x3a')]=[{'all':!![]}];}_0x2d23a5=_[_0xa71f('0x36')]({},_0x2d23a5,_0x506eec[_0xa71f('0x37')]);return db['CmCompany'][_0xa71f('0x42')](_0x2d23a5)[_0xa71f('0x23')](handleEntityNotFound(_0x2c7f97,null))['then'](respondWithResult(_0x2c7f97,null))[_0xa71f('0x3d')](handleError(_0x2c7f97,null));};exports[_0xa71f('0x43')]=function(_0x4f778a,_0xace4d4){return db[_0xa71f('0x38')][_0xa71f('0x43')](_0x4f778a[_0xa71f('0x44')],{})[_0xa71f('0x23')](function(_0x19915e){var _0x546122=_0x4f778a['user'][_0xa71f('0x21')]({'plain':!![]});if(!_0x546122)throw new Error(_0xa71f('0x45'));if(_0x546122[_0xa71f('0x46')]===_0xa71f('0x47')){var _0x43f6a5=_0x19915e[_0xa71f('0x21')]({'plain':!![]});var _0x2be292=_0xa71f('0x22');return db[_0xa71f('0x48')]['find']({'where':{'name':_0x2be292,'userProfileId':_0x546122['userProfileId']},'raw':!![]})[_0xa71f('0x23')](function(_0xb0f604){if(_0xb0f604&&_0xb0f604[_0xa71f('0x49')]===0x0){return db[_0xa71f('0x4a')][_0xa71f('0x43')]({'name':_0x43f6a5[_0xa71f('0x27')],'resourceId':_0x43f6a5['id'],'type':_0xb0f604['name'],'sectionId':_0xb0f604['id']},{})['then'](function(){return _0x19915e;});}else{return _0x19915e;}})[_0xa71f('0x3d')](function(_0x33d496){logger['error'](_0xa71f('0x4b'),_0x33d496);throw _0x33d496;});}return _0x19915e;})[_0xa71f('0x23')](respondWithResult(_0xace4d4,0xc9))[_0xa71f('0x3d')](handleError(_0xace4d4,null));};exports[_0xa71f('0x1f')]=function(_0x1ab35d,_0x514e8b){if(_0x1ab35d[_0xa71f('0x44')]['id']){delete _0x1ab35d[_0xa71f('0x44')]['id'];}return db[_0xa71f('0x38')][_0xa71f('0x42')]({'where':{'id':_0x1ab35d['params']['id']}})[_0xa71f('0x23')](handleEntityNotFound(_0x514e8b,null))[_0xa71f('0x23')](saveUpdates(_0x1ab35d[_0xa71f('0x44')],null))[_0xa71f('0x23')](respondWithResult(_0x514e8b,null))[_0xa71f('0x3d')](handleError(_0x514e8b,null));};exports['destroy']=function(_0x3becdf,_0x2e4787){return db[_0xa71f('0x38')][_0xa71f('0x42')]({'where':{'id':_0x3becdf[_0xa71f('0x3f')]['id']}})[_0xa71f('0x23')](handleEntityNotFound(_0x2e4787,null))['then'](removeEntity(_0x2e4787,null))[_0xa71f('0x3d')](handleError(_0x2e4787,null));};exports['describe']=function(_0x4ecb17,_0x16a43c){return db[_0xa71f('0x38')][_0xa71f('0x28')]()[_0xa71f('0x23')](respondWithResult(_0x16a43c,null))[_0xa71f('0x3d')](handleError(_0x16a43c,null));};exports[_0xa71f('0x4c')]=function(_0x42866f,_0x43ae81,_0x4ea79f){return db[_0xa71f('0x4d')]['find']({'where':{'id':_0x42866f[_0xa71f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43ae81,null))[_0xa71f('0x23')](function(_0x4fc926){if(_0x4fc926){return _0x4fc926[_0xa71f('0x4c')](_0x42866f[_0xa71f('0x44')][_0xa71f('0x4e')],_[_0xa71f('0x4f')](_0x42866f['body'],['ids','id'])||{});}})[_0xa71f('0x23')](respondWithResult(_0x43ae81,null))['catch'](handleError(_0x43ae81,null));};exports['getContacts']=function(_0xbb5574,_0x2457ce,_0x285699){var _0x2e436e={};var _0x4117e1={};var _0x310a9f;var _0x21de56;return db[_0xa71f('0x38')][_0xa71f('0x50')]({'where':{'id':_0xbb5574[_0xa71f('0x3f')]['id']}})[_0xa71f('0x23')](handleEntityNotFound(_0x2457ce,null))[_0xa71f('0x23')](function(_0x3180d7){if(_0x3180d7){_0x310a9f=_0x3180d7;_0x4117e1[_0xa71f('0x2d')]=_[_0xa71f('0x29')](db[_0xa71f('0x4d')][_0xa71f('0x40')]);_0x4117e1[_0xa71f('0x2a')]=_[_0xa71f('0x29')](_0xbb5574[_0xa71f('0x2a')]);_0x4117e1[_0xa71f('0x2b')]=_[_0xa71f('0x2c')](_0x4117e1[_0xa71f('0x2d')],_0x4117e1[_0xa71f('0x2a')]);_0x2e436e['attributes']=_[_0xa71f('0x2c')](_0x4117e1[_0xa71f('0x2d')],qs[_0xa71f('0x2f')](_0xbb5574[_0xa71f('0x2a')][_0xa71f('0x2f')]));_0x2e436e[_0xa71f('0x2e')]=_0x2e436e['attributes'][_0xa71f('0x41')]?_0x2e436e[_0xa71f('0x2e')]:_0x4117e1[_0xa71f('0x2d')];_0x2e436e[_0xa71f('0x31')]=qs['sort'](_0xbb5574['query']['sort']);_0x2e436e[_0xa71f('0x33')]=qs[_0xa71f('0x2b')](_[_0xa71f('0x34')](_0xbb5574[_0xa71f('0x2a')],_0x4117e1[_0xa71f('0x2b')]));if(_0xbb5574[_0xa71f('0x2a')][_0xa71f('0x35')]){_0x2e436e['where']=_[_0xa71f('0x36')](_0x2e436e[_0xa71f('0x33')],{'$or':_[_0xa71f('0x51')](_0x2e436e[_0xa71f('0x2e')],function(_0x5b2d30){var _0x555135={};_0x555135[_0x5b2d30]={'$like':'%'+_0xbb5574[_0xa71f('0x2a')][_0xa71f('0x35')]+'%'};return _0x555135;})});}_0x2e436e=_['merge']({},_0x2e436e,_0xbb5574['options']);return _0x310a9f['getContacts'](_0x2e436e);}})[_0xa71f('0x23')](function(_0x47943e){if(_0x47943e){_0x21de56=_0x47943e[_0xa71f('0x41')];if(!_0xbb5574[_0xa71f('0x2a')]['hasOwnProperty'](_0xa71f('0x30'))){_0x2e436e[_0xa71f('0x1b')]=qs['limit'](_0xbb5574['query']['limit']);_0x2e436e[_0xa71f('0x1a')]=qs[_0xa71f('0x1a')](_0xbb5574[_0xa71f('0x2a')][_0xa71f('0x1a')]);}return _0x310a9f[_0xa71f('0x52')](_0x2e436e);}})['then'](function(_0xa2949d){if(_0xa2949d){return _0xa2949d?{'count':_0x21de56,'rows':_0xa2949d}:null;}})[_0xa71f('0x23')](respondWithResult(_0x2457ce,null))['catch'](handleError(_0x2457ce,null));}; \ No newline at end of file +var _0x2eb9=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','options','includeAll','include','catch','show','params','rawAttributes','merge','CmCompany','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addContacts','CmContact','ids','getContacts','keys','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','query','filters','intersection','model','attributes','fields'];(function(_0x3033a6,_0x4a211c){var _0x21155c=function(_0x1f4645){while(--_0x1f4645){_0x3033a6['push'](_0x3033a6['shift']());}};_0x21155c(++_0x4a211c);}(_0x2eb9,0x1cf));var _0x92eb=function(_0x55d0e2,_0x483962){_0x55d0e2=_0x55d0e2-0x0;var _0x14ba61=_0x2eb9[_0x55d0e2];return _0x14ba61;};'use strict';var pdf=require(_0x92eb('0x0'));var emlformat=require(_0x92eb('0x1'));var rimraf=require(_0x92eb('0x2'));var zipdir=require(_0x92eb('0x3'));var jsonpatch=require(_0x92eb('0x4'));var rp=require(_0x92eb('0x5'));var moment=require(_0x92eb('0x6'));var BPromise=require(_0x92eb('0x7'));var Mustache=require(_0x92eb('0x8'));var util=require(_0x92eb('0x9'));var path=require(_0x92eb('0xa'));var sox=require(_0x92eb('0xb'));var csv=require('to-csv');var ejs=require(_0x92eb('0xc'));var fs=require('fs');var _=require(_0x92eb('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92eb('0xe'));var toCsv=require(_0x92eb('0xf'));var querystring=require(_0x92eb('0x10'));var Papa=require(_0x92eb('0x11'));var Redis=require(_0x92eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x92eb('0x13'));var as=require(_0x92eb('0x14'));var hardwareService=require(_0x92eb('0x15'));var logger=require(_0x92eb('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x92eb('0x17'));var db=require(_0x92eb('0x18'))['db'];function respondWithStatusCode(_0xc435e2,_0x565c8d){_0x565c8d=_0x565c8d||0xcc;return function(_0x1d1f23){if(_0x1d1f23){return _0xc435e2[_0x92eb('0x19')](_0x565c8d);}return _0xc435e2[_0x92eb('0x1a')](_0x565c8d)[_0x92eb('0x1b')]();};}function respondWithResult(_0x3e369d,_0x1de4eb){_0x1de4eb=_0x1de4eb||0xc8;return function(_0x3bde82){if(_0x3bde82){return _0x3e369d[_0x92eb('0x1a')](_0x1de4eb)['json'](_0x3bde82);}};}function respondWithFilteredResult(_0x50ccb7,_0x17cab7){return function(_0x3f93ad){if(_0x3f93ad){var _0x244d95=_0x3f93ad[_0x92eb('0x1c')],_0x1b2156=_0x17cab7[_0x92eb('0x1d')],_0x13e50a=_0x17cab7[_0x92eb('0x1d')]+_0x17cab7['limit'],_0x3ab358;if(_0x13e50a>=_0x244d95){_0x13e50a=_0x244d95;_0x3ab358=0xc8;}else{_0x3ab358=0xce;}_0x50ccb7[_0x92eb('0x1a')](_0x3ab358);return _0x50ccb7[_0x92eb('0x1e')](_0x92eb('0x1f'),_0x1b2156+'-'+_0x13e50a+'/'+_0x244d95)[_0x92eb('0x20')](_0x3f93ad);}return null;};}function patchUpdates(_0x37ccbb){return function(_0x2f3686){try{jsonpatch[_0x92eb('0x21')](_0x2f3686,_0x37ccbb,!![]);}catch(_0x1946fa){return BPromise['reject'](_0x1946fa);}return _0x2f3686[_0x92eb('0x22')]();};}function saveUpdates(_0x268666,_0x475cea){return function(_0x53fa8e){if(_0x53fa8e){return _0x53fa8e['update'](_0x268666)[_0x92eb('0x23')](function(_0x3ecda3){return _0x3ecda3;});}return null;};}function removeEntity(_0x5168e1,_0x390b33){return function(_0x28440a){if(_0x28440a){return _0x28440a[_0x92eb('0x24')]()[_0x92eb('0x23')](function(){var _0x13cc91=_0x28440a['get']({'plain':!![]});var _0x1bcf80='Companies';return db['UserProfileResource'][_0x92eb('0x24')]({'where':{'type':_0x1bcf80,'resourceId':_0x13cc91['id']}})[_0x92eb('0x23')](function(){return _0x28440a;});})[_0x92eb('0x23')](function(){_0x5168e1[_0x92eb('0x1a')](0xcc)[_0x92eb('0x1b')]();});}};}function handleEntityNotFound(_0xeb56e3,_0x5d07ad){return function(_0x49980e){if(!_0x49980e){_0xeb56e3[_0x92eb('0x19')](0x194);}return _0x49980e;};}function handleError(_0x82c06b,_0x3b1d20){_0x3b1d20=_0x3b1d20||0x1f4;return function(_0x35509b){logger[_0x92eb('0x25')](_0x35509b['stack']);if(_0x35509b[_0x92eb('0x26')]){delete _0x35509b['name'];}_0x82c06b[_0x92eb('0x1a')](_0x3b1d20)[_0x92eb('0x27')](_0x35509b);};}exports[_0x92eb('0x28')]=function(_0x3dd8db,_0x2591b6){var _0xb59f44={},_0x72eb07={},_0x4c7654={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x92eb('0x23')](function(_0x30f0e1){_0x72eb07['model']=_['keys'](_0x30f0e1);_0x72eb07[_0x92eb('0x29')]=_['keys'](_0x3dd8db[_0x92eb('0x29')]);_0x72eb07[_0x92eb('0x2a')]=_[_0x92eb('0x2b')](_0x72eb07[_0x92eb('0x2c')],_0x72eb07[_0x92eb('0x29')]);_0xb59f44[_0x92eb('0x2d')]=_[_0x92eb('0x2b')](_0x72eb07[_0x92eb('0x2c')],qs[_0x92eb('0x2e')](_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x2e')]));_0xb59f44[_0x92eb('0x2d')]=_0xb59f44[_0x92eb('0x2d')][_0x92eb('0x2f')]?_0xb59f44['attributes']:_0x72eb07[_0x92eb('0x2c')];if(!_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x30')](_0x92eb('0x31'))){_0xb59f44['limit']=qs[_0x92eb('0x32')](_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x32')]);_0xb59f44[_0x92eb('0x1d')]=qs[_0x92eb('0x1d')](_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x1d')]);}_0xb59f44[_0x92eb('0x33')]=qs['sort'](_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x34')]);_0xb59f44[_0x92eb('0x35')]=qs[_0x92eb('0x2a')](_[_0x92eb('0x36')](_0x3dd8db[_0x92eb('0x29')],_0x72eb07[_0x92eb('0x2a')]),_0x30f0e1);if(_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x37')]){_0xb59f44[_0x92eb('0x35')]=_['merge'](_0xb59f44[_0x92eb('0x35')],{'$or':_[_0x92eb('0x38')](_0xb59f44[_0x92eb('0x2d')],function(_0x4a2e5d){var _0x4b77b4={};_0x4b77b4[_0x4a2e5d]={'$like':'%'+_0x3dd8db[_0x92eb('0x29')][_0x92eb('0x37')]+'%'};return _0x4b77b4;})});}_0xb59f44=_['merge']({},_0xb59f44,_0x3dd8db[_0x92eb('0x39')]);var _0x333a46={'where':_0xb59f44[_0x92eb('0x35')]};return db['CmCompany']['count'](_0x333a46)[_0x92eb('0x23')](function(_0x1824f1){_0x4c7654[_0x92eb('0x1c')]=_0x1824f1;if(_0x3dd8db['query'][_0x92eb('0x3a')]){_0xb59f44[_0x92eb('0x3b')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0xb59f44);})[_0x92eb('0x23')](function(_0x163ee6){_0x4c7654['rows']=_0x163ee6;return _0x4c7654;})['then'](respondWithFilteredResult(_0x2591b6,_0xb59f44))['catch'](handleError(_0x2591b6,null));})[_0x92eb('0x3c')](handleError(_0x2591b6,null));};exports[_0x92eb('0x3d')]=function(_0xd3f6b2,_0x38e7f4){var _0x46ab33={'raw':![],'where':{'id':_0xd3f6b2[_0x92eb('0x3e')]['id']}},_0x47b089={};_0x47b089['model']=_['keys'](db['CmCompany'][_0x92eb('0x3f')]);_0x47b089[_0x92eb('0x29')]=_['keys'](_0xd3f6b2[_0x92eb('0x29')]);_0x47b089[_0x92eb('0x2a')]=_[_0x92eb('0x2b')](_0x47b089[_0x92eb('0x2c')],_0x47b089['query']);_0x46ab33[_0x92eb('0x2d')]=_[_0x92eb('0x2b')](_0x47b089[_0x92eb('0x2c')],qs[_0x92eb('0x2e')](_0xd3f6b2['query']['fields']));_0x46ab33[_0x92eb('0x2d')]=_0x46ab33[_0x92eb('0x2d')][_0x92eb('0x2f')]?_0x46ab33[_0x92eb('0x2d')]:_0x47b089[_0x92eb('0x2c')];if(_0xd3f6b2[_0x92eb('0x29')][_0x92eb('0x3a')]){_0x46ab33[_0x92eb('0x3b')]=[{'all':!![]}];}_0x46ab33=_[_0x92eb('0x40')]({},_0x46ab33,_0xd3f6b2[_0x92eb('0x39')]);return db[_0x92eb('0x41')][_0x92eb('0x42')](_0x46ab33)['then'](handleEntityNotFound(_0x38e7f4,null))['then'](respondWithResult(_0x38e7f4,null))['catch'](handleError(_0x38e7f4,null));};exports['create']=function(_0x1067a8,_0x5e73aa){return db[_0x92eb('0x41')][_0x92eb('0x43')](_0x1067a8['body'],{})[_0x92eb('0x23')](function(_0x2c2e4c){var _0x155fc7=_0x1067a8[_0x92eb('0x44')][_0x92eb('0x45')]({'plain':!![]});if(!_0x155fc7)throw new Error(_0x92eb('0x46'));if(_0x155fc7['role']==='user'){var _0x5f4326=_0x2c2e4c[_0x92eb('0x45')]({'plain':!![]});var _0x3864f0=_0x92eb('0x47');return db[_0x92eb('0x48')][_0x92eb('0x42')]({'where':{'name':_0x3864f0,'userProfileId':_0x155fc7[_0x92eb('0x49')]},'raw':!![]})[_0x92eb('0x23')](function(_0xbd09a5){if(_0xbd09a5&&_0xbd09a5[_0x92eb('0x4a')]===0x0){return db[_0x92eb('0x4b')]['create']({'name':_0x5f4326[_0x92eb('0x26')],'resourceId':_0x5f4326['id'],'type':_0xbd09a5[_0x92eb('0x26')],'sectionId':_0xbd09a5['id']},{})['then'](function(){return _0x2c2e4c;});}else{return _0x2c2e4c;}})[_0x92eb('0x3c')](function(_0xd39597){logger[_0x92eb('0x25')](_0x92eb('0x4c'),_0xd39597);throw _0xd39597;});}return _0x2c2e4c;})[_0x92eb('0x23')](respondWithResult(_0x5e73aa,0xc9))[_0x92eb('0x3c')](handleError(_0x5e73aa,null));};exports[_0x92eb('0x4d')]=function(_0xdbc9a7,_0x5e6575){if(_0xdbc9a7[_0x92eb('0x4e')]['id']){delete _0xdbc9a7[_0x92eb('0x4e')]['id'];}return db['CmCompany']['find']({'where':{'id':_0xdbc9a7[_0x92eb('0x3e')]['id']}})[_0x92eb('0x23')](handleEntityNotFound(_0x5e6575,null))[_0x92eb('0x23')](saveUpdates(_0xdbc9a7['body'],null))[_0x92eb('0x23')](respondWithResult(_0x5e6575,null))['catch'](handleError(_0x5e6575,null));};exports[_0x92eb('0x24')]=function(_0xdc7cfa,_0x41d04e){return db['CmCompany'][_0x92eb('0x42')]({'where':{'id':_0xdc7cfa[_0x92eb('0x3e')]['id']}})[_0x92eb('0x23')](handleEntityNotFound(_0x41d04e,null))[_0x92eb('0x23')](removeEntity(_0x41d04e,null))[_0x92eb('0x3c')](handleError(_0x41d04e,null));};exports['describe']=function(_0xb10ce4,_0x54b54d){return db[_0x92eb('0x41')][_0x92eb('0x4f')]()[_0x92eb('0x23')](respondWithResult(_0x54b54d,null))[_0x92eb('0x3c')](handleError(_0x54b54d,null));};exports[_0x92eb('0x50')]=function(_0x2d6a13,_0x2add3e,_0x39e9ef){return db[_0x92eb('0x51')]['find']({'where':{'id':_0x2d6a13['params']['id']}})[_0x92eb('0x23')](handleEntityNotFound(_0x2add3e,null))['then'](function(_0x35307a){if(_0x35307a){return _0x35307a[_0x92eb('0x50')](_0x2d6a13['body']['ids'],_['omit'](_0x2d6a13[_0x92eb('0x4e')],[_0x92eb('0x52'),'id'])||{});}})[_0x92eb('0x23')](respondWithResult(_0x2add3e,null))[_0x92eb('0x3c')](handleError(_0x2add3e,null));};exports[_0x92eb('0x53')]=function(_0x376a1e,_0x5f4a83,_0x2f5cf1){var _0x218475={};var _0x22780={};var _0x1ec560;var _0x4abf2f;return db[_0x92eb('0x41')]['findOne']({'where':{'id':_0x376a1e[_0x92eb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5f4a83,null))[_0x92eb('0x23')](function(_0x259f64){if(_0x259f64){_0x1ec560=_0x259f64;_0x22780[_0x92eb('0x2c')]=_[_0x92eb('0x54')](db[_0x92eb('0x51')][_0x92eb('0x3f')]);_0x22780[_0x92eb('0x29')]=_['keys'](_0x376a1e['query']);_0x22780[_0x92eb('0x2a')]=_[_0x92eb('0x2b')](_0x22780[_0x92eb('0x2c')],_0x22780[_0x92eb('0x29')]);_0x218475[_0x92eb('0x2d')]=_['intersection'](_0x22780[_0x92eb('0x2c')],qs[_0x92eb('0x2e')](_0x376a1e[_0x92eb('0x29')]['fields']));_0x218475[_0x92eb('0x2d')]=_0x218475[_0x92eb('0x2d')][_0x92eb('0x2f')]?_0x218475['attributes']:_0x22780[_0x92eb('0x2c')];_0x218475[_0x92eb('0x33')]=qs[_0x92eb('0x34')](_0x376a1e[_0x92eb('0x29')][_0x92eb('0x34')]);_0x218475['where']=qs['filters'](_['pick'](_0x376a1e[_0x92eb('0x29')],_0x22780['filters']));if(_0x376a1e[_0x92eb('0x29')][_0x92eb('0x37')]){_0x218475['where']=_[_0x92eb('0x40')](_0x218475[_0x92eb('0x35')],{'$or':_[_0x92eb('0x38')](_0x218475['attributes'],function(_0x1cd2fe){var _0x43bbd4={};_0x43bbd4[_0x1cd2fe]={'$like':'%'+_0x376a1e[_0x92eb('0x29')]['filter']+'%'};return _0x43bbd4;})});}_0x218475=_['merge']({},_0x218475,_0x376a1e[_0x92eb('0x39')]);return _0x1ec560[_0x92eb('0x53')](_0x218475);}})[_0x92eb('0x23')](function(_0x445079){if(_0x445079){_0x4abf2f=_0x445079[_0x92eb('0x2f')];if(!_0x376a1e['query']['hasOwnProperty'](_0x92eb('0x31'))){_0x218475['limit']=qs['limit'](_0x376a1e[_0x92eb('0x29')][_0x92eb('0x32')]);_0x218475[_0x92eb('0x1d')]=qs[_0x92eb('0x1d')](_0x376a1e[_0x92eb('0x29')][_0x92eb('0x1d')]);}return _0x1ec560['getContacts'](_0x218475);}})[_0x92eb('0x23')](function(_0x59819d){if(_0x59819d){return _0x59819d?{'count':_0x4abf2f,'rows':_0x59819d}:null;}})[_0x92eb('0x23')](respondWithResult(_0x5f4a83,null))[_0x92eb('0x3c')](handleError(_0x5f4a83,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index be1b472..1299ceb 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 _0x4f2b=['rimraf','../../config/environment','define','CmCompany','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2fa318,_0x391e3f){var _0x36358c=function(_0x6806f){while(--_0x6806f){_0x2fa318['push'](_0x2fa318['shift']());}};_0x36358c(++_0x391e3f);}(_0x4f2b,0xb4));var _0xb4f2=function(_0x39efd4,_0x34c244){_0x39efd4=_0x39efd4-0x0;var _0x1027d9=_0x4f2b[_0x39efd4];return _0x1027d9;};'use strict';var _=require(_0xb4f2('0x0'));var util=require(_0xb4f2('0x1'));var logger=require(_0xb4f2('0x2'))(_0xb4f2('0x3'));var moment=require('moment');var BPromise=require(_0xb4f2('0x4'));var rp=require(_0xb4f2('0x5'));var fs=require('fs');var path=require(_0xb4f2('0x6'));var rimraf=require(_0xb4f2('0x7'));var config=require(_0xb4f2('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x169fe5,_0x1e67dd){return _0x169fe5[_0xb4f2('0x9')](_0xb4f2('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x054f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0x415330,_0x4e7228){var _0x4e30cf=function(_0x181f83){while(--_0x181f83){_0x415330['push'](_0x415330['shift']());}};_0x4e30cf(++_0x4e7228);}(_0x054f,0x194));var _0xf054=function(_0x4d7d23,_0x81f531){_0x4d7d23=_0x4d7d23-0x0;var _0x25c429=_0x054f[_0x4d7d23];return _0x25c429;};'use strict';var _=require(_0xf054('0x0'));var util=require(_0xf054('0x1'));var logger=require(_0xf054('0x2'))(_0xf054('0x3'));var moment=require(_0xf054('0x4'));var BPromise=require(_0xf054('0x5'));var rp=require(_0xf054('0x6'));var fs=require('fs');var path=require(_0xf054('0x7'));var rimraf=require(_0xf054('0x8'));var config=require(_0xf054('0x9'));var attributes=require(_0xf054('0xa'));module['exports']=function(_0x4516a3,_0x43573d){return _0x4516a3[_0xf054('0xb')](_0xf054('0xc'),attributes,{'tableName':_0xf054('0xd'),'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 604e0d1..b9bf07b 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 _0xf774=['code','CmCompany,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error'];(function(_0xa8df4d,_0x346e39){var _0x27ac1c=function(_0x344604){while(--_0x344604){_0xa8df4d['push'](_0xa8df4d['shift']());}};_0x27ac1c(++_0x346e39);}(_0xf774,0xe8));var _0x4f77=function(_0x207528,_0x56bc44){_0x207528=_0x207528-0x0;var _0x32e433=_0xf774[_0x207528];return _0x32e433;};'use strict';var _=require('lodash');var util=require(_0x4f77('0x0'));var moment=require(_0x4f77('0x1'));var BPromise=require(_0x4f77('0x2'));var rs=require(_0x4f77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f77('0x4'))['db'];var utils=require(_0x4f77('0x5'));var logger=require('../../config/logger')(_0x4f77('0x6'));var config=require(_0x4f77('0x7'));var jayson=require(_0x4f77('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35665b,_0x3a0e6c,_0x21527b){return new BPromise(function(_0x484b35,_0x2c630c){return client[_0x4f77('0x9')](_0x35665b,_0x21527b)['then'](function(_0xdc860){logger[_0x4f77('0xa')]('CmCompany,\x20%s,\x20%s',_0x3a0e6c,_0x4f77('0xb'));logger[_0x4f77('0xc')](_0x4f77('0xd'),_0x3a0e6c,'request\x20sent',JSON['stringify'](_0xdc860));if(_0xdc860[_0x4f77('0xe')]){if(_0xdc860[_0x4f77('0xe')][_0x4f77('0xf')]===0x1f4){logger[_0x4f77('0xe')](_0x4f77('0x10'),_0x3a0e6c,_0xdc860[_0x4f77('0xe')][_0x4f77('0x11')]);return _0x2c630c(_0xdc860[_0x4f77('0xe')][_0x4f77('0x11')]);}logger[_0x4f77('0xe')](_0x4f77('0x10'),_0x3a0e6c,_0xdc860['error'][_0x4f77('0x11')]);return _0x484b35(_0xdc860[_0x4f77('0xe')][_0x4f77('0x11')]);}else{logger['info'](_0x4f77('0x10'),_0x3a0e6c,'request\x20sent');_0x484b35(_0xdc860[_0x4f77('0x12')][_0x4f77('0x11')]);}})['catch'](function(_0x1d8f07){logger[_0x4f77('0xe')](_0x4f77('0x10'),_0x3a0e6c,_0x1d8f07);_0x2c630c(_0x1d8f07);});});} \ No newline at end of file +var _0xa8ed=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xa8ed,0x1d6));var _0xda8e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa8ed[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xda8e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda8e('0x1'));var rs=require(_0xda8e('0x2'));var fs=require('fs');var Redis=require(_0xda8e('0x3'));var db=require(_0xda8e('0x4'))['db'];var utils=require(_0xda8e('0x5'));var logger=require(_0xda8e('0x6'))('rpc');var config=require(_0xda8e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xda8e('0x8')][_0xda8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x315b30,_0x542dd3,_0x15663e){return new BPromise(function(_0x163f4b,_0x6609ad){return client[_0xda8e('0xa')](_0x315b30,_0x15663e)[_0xda8e('0xb')](function(_0x39f072){logger['info'](_0xda8e('0xc'),_0x542dd3,'request\x20sent');logger['debug'](_0xda8e('0xd'),_0x542dd3,_0xda8e('0xe'),JSON[_0xda8e('0xf')](_0x39f072));if(_0x39f072[_0xda8e('0x10')]){if(_0x39f072[_0xda8e('0x10')][_0xda8e('0x11')]===0x1f4){logger[_0xda8e('0x10')](_0xda8e('0xc'),_0x542dd3,_0x39f072[_0xda8e('0x10')]['message']);return _0x6609ad(_0x39f072[_0xda8e('0x10')][_0xda8e('0x12')]);}logger[_0xda8e('0x10')](_0xda8e('0xc'),_0x542dd3,_0x39f072[_0xda8e('0x10')][_0xda8e('0x12')]);return _0x163f4b(_0x39f072[_0xda8e('0x10')][_0xda8e('0x12')]);}else{logger[_0xda8e('0x13')](_0xda8e('0xc'),_0x542dd3,_0xda8e('0xe'));_0x163f4b(_0x39f072[_0xda8e('0x14')][_0xda8e('0x12')]);}})['catch'](function(_0x2a2246){logger[_0xda8e('0x10')]('CmCompany,\x20%s,\x20%s',_0x542dd3,_0x2a2246);_0x6609ad(_0x2a2246);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a6b13a1..abff221 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 _0x008c=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','create','addContacts','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x140d01,_0x3d0a6e){var _0x2219be=function(_0x2e18e3){while(--_0x2e18e3){_0x140d01['push'](_0x140d01['shift']());}};_0x2219be(++_0x3d0a6e);}(_0x008c,0x188));var _0xc008=function(_0x2093f0,_0x1f903c){_0x2093f0=_0x2093f0-0x0;var _0x37829f=_0x008c[_0x2093f0];return _0x37829f;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x14')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','create','addContacts','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x26b1e6,_0x287009){var _0x3d004a=function(_0x3741a6){while(--_0x3741a6){_0x26b1e6['push'](_0x26b1e6['shift']());}};_0x3d004a(++_0x287009);}(_0x008c,0x188));var _0xc008=function(_0x389b48,_0x2a1760){_0x389b48=_0x389b48-0x0;var _0x1cc751=_0x008c[_0x389b48];return _0x1cc751;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6532b68..019ce1a 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 _0x2cd5=['STRING','TEXT','INTEGER','UNSIGNED','NOW','sequelize'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2cd5,0x9b));var _0x52cd=function(_0x1a3f88,_0x3e0d6d){_0x1a3f88=_0x1a3f88-0x0;var _0x1dca45=_0x2cd5[_0x1a3f88];return _0x1dca45;};'use strict';var _=require('lodash');var Sequelize=require(_0x52cd('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x52cd('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x52cd('0x1')]},'street':{'type':Sequelize[_0x52cd('0x1')]},'postalCode':{'type':Sequelize[_0x52cd('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x52cd('0x1')]},'dateOfBirth':{'type':Sequelize[_0x52cd('0x1')]},'description':{'type':Sequelize[_0x52cd('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x52cd('0x1')]},'fax':{'type':Sequelize[_0x52cd('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x52cd('0x1')]},'facebook':{'type':Sequelize[_0x52cd('0x1')]},'fb_data':{'type':Sequelize[_0x52cd('0x1')]},'twitter':{'type':Sequelize[_0x52cd('0x1')]},'skype':{'type':Sequelize[_0x52cd('0x1')]},'teams':{'type':Sequelize[_0x52cd('0x1')]},'viber':{'type':Sequelize[_0x52cd('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x52cd('0x1')]},'telegram':{'type':Sequelize[_0x52cd('0x1')]},'UserId':{'type':Sequelize[_0x52cd('0x3')]},'priority':{'type':Sequelize[_0x52cd('0x3')](0x2)[_0x52cd('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x52cd('0x5')]},'dialTimezone':{'type':Sequelize[_0x52cd('0x1')]},'utcOffset':{'type':Sequelize[_0x52cd('0x3')]}}; \ No newline at end of file +var _0x0901=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x52bd65,_0x160646){var _0x13fd57=function(_0xe84392){while(--_0xe84392){_0x52bd65['push'](_0x52bd65['shift']());}};_0x13fd57(++_0x160646);}(_0x0901,0x134));var _0x1090=function(_0x2270ca,_0x56950c){_0x2270ca=_0x2270ca-0x0;var _0x309389=_0x0901[_0x2270ca];return _0x309389;};'use strict';var _=require(_0x1090('0x0'));var Sequelize=require(_0x1090('0x1'));module[_0x1090('0x2')]={'firstName':{'type':Sequelize[_0x1090('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1090('0x3')]},'street':{'type':Sequelize[_0x1090('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1090('0x3')]},'dateOfBirth':{'type':Sequelize[_0x1090('0x3')]},'description':{'type':Sequelize[_0x1090('0x4')]},'phone':{'type':Sequelize[_0x1090('0x3')]},'mobile':{'type':Sequelize[_0x1090('0x3')]},'fax':{'type':Sequelize[_0x1090('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x1090('0x3')]},'facebook':{'type':Sequelize[_0x1090('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1090('0x3')]},'skype':{'type':Sequelize[_0x1090('0x3')]},'teams':{'type':Sequelize[_0x1090('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x1090('0x3')]},'UserId':{'type':Sequelize[_0x1090('0x5')]},'priority':{'type':Sequelize[_0x1090('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1090('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x1090('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d371971..e8e1775 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 _0xa63b=['No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','file','parse','meta','import','User','agent','binding','stringify','start\x20child\x20process\x20correctly!','exit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','stack','name','send','index','CmContact','then','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','nolimit','order','sort','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','left_join','cm_contact_has_tags','where','c.deletedAt\x20IS\x20NULL','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','datetime','castTo','DATE','text','start','hasOwnProperty','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','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','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.id','clone','DESC','having','t.id\x20IN\x20?','resolve','some','user','getLists','sequelize','toString','merge','fields','c.firstName','c.lastName','c.email','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','params','catch','describe','tags','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','update','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','spread','show','omit','format','cf_%d','$and','pickBy','setFields','toParam','phone','getTags','rawAttributes','pick','options','setTags','ids','getHoppers','includeAll','include','getHopperHistories','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values'];(function(_0x196666,_0x3c1e32){var _0x59afb2=function(_0xd36ecf){while(--_0xd36ecf){_0x196666['push'](_0x196666['shift']());}};_0x59afb2(++_0x3c1e32);}(_0xa63b,0x107));var _0xba63=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa63b[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba63('0x0'));var rimraf=require(_0xba63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba63('0x2'));var rp=require(_0xba63('0x3'));var moment=require('moment');var BPromise=require(_0xba63('0x4'));var Mustache=require(_0xba63('0x5'));var util=require(_0xba63('0x6'));var path=require(_0xba63('0x7'));var sox=require(_0xba63('0x8'));var csv=require(_0xba63('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xba63('0xa'));var squel=require('squel');var crypto=require(_0xba63('0xb'));var jsforce=require(_0xba63('0xc'));var deskjs=require(_0xba63('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba63('0xe'));var Papa=require(_0xba63('0xf'));var Redis=require(_0xba63('0x10'));var authService=require(_0xba63('0x11'));var qs=require(_0xba63('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba63('0x13'));var logger=require(_0xba63('0x14'))(_0xba63('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xba63('0x16'))['db'];config['redis']=_[_0xba63('0x17')](config[_0xba63('0x18')],{'host':_0xba63('0x19'),'port':0x18eb});var socket=require(_0xba63('0x1a'))(new Redis(config[_0xba63('0x18')]));require('./cmContact.socket')[_0xba63('0x1b')](socket);function respondWithStatusCode(_0x47dffe,_0x364f89){_0x364f89=_0x364f89||0xcc;return function(_0x2f26c3){if(_0x2f26c3){return _0x47dffe[_0xba63('0x1c')](_0x364f89);}return _0x47dffe['status'](_0x364f89)[_0xba63('0x1d')]();};}function respondWithResult(_0x1f80af,_0x1da7d0){_0x1da7d0=_0x1da7d0||0xc8;return function(_0x208a8d){if(_0x208a8d){return _0x1f80af[_0xba63('0x1e')](_0x1da7d0)[_0xba63('0x1f')](_0x208a8d);}};}function respondWithFilteredResult(_0x31f8b1,_0x4fbea2){return function(_0x30000e){if(_0x30000e){var _0x41a7ec=_0x30000e[_0xba63('0x20')],_0x375078=_0x4fbea2[_0xba63('0x21')],_0x2b3bfc=_0x4fbea2['offset']+_0x4fbea2[_0xba63('0x22')],_0x22eb87;if(_0x2b3bfc>=_0x41a7ec){_0x2b3bfc=_0x41a7ec;_0x22eb87=0xc8;}else{_0x22eb87=0xce;}_0x31f8b1[_0xba63('0x1e')](_0x22eb87);return _0x31f8b1[_0xba63('0x23')](_0xba63('0x24'),_0x375078+'-'+_0x2b3bfc+'/'+_0x41a7ec)[_0xba63('0x1f')](_0x30000e);}return null;};}function patchUpdates(_0x586ef7){return function(_0x2b54c8){try{jsonpatch[_0xba63('0x25')](_0x2b54c8,_0x586ef7,!![]);}catch(_0x21301c){return BPromise[_0xba63('0x26')](_0x21301c);}return _0x2b54c8['save']();};}function saveUpdates(_0x4969bc,_0x412727){return function(_0x51fa27){if(_0x51fa27){return _0x51fa27['update'](_0x4969bc)['then'](function(_0x4e8c8e){return _0x4e8c8e;});}return null;};}function removeEntity(_0x2dd920,_0x13e7fd){return function(_0x195ddd){if(_0x195ddd){return _0x195ddd['destroy']()['then'](function(){_0x2dd920[_0xba63('0x1e')](0xcc)[_0xba63('0x1d')]();});}};}function handleEntityNotFound(_0x4c8412,_0x336175){return function(_0x3c14d4){if(!_0x3c14d4){_0x4c8412[_0xba63('0x1c')](0x194);}return _0x3c14d4;};}function handleError(_0xf61081,_0x32bbee){_0x32bbee=_0x32bbee||0x1f4;return function(_0x304991){logger['error'](_0x304991[_0xba63('0x27')]);if(_0x304991[_0xba63('0x28')]){delete _0x304991[_0xba63('0x28')];}_0xf61081['status'](_0x32bbee)[_0xba63('0x29')](_0x304991);};}exports[_0xba63('0x2a')]=function(_0x164ef9,_0x4bbb29){var _0x23e094={},_0x2dfccb={},_0x2d7281={'count':0x0,'rows':[]};return db[_0xba63('0x2b')]['describe']()[_0xba63('0x2c')](function(_0x3f3fd7){var _0x1c7bc1=[];for(var _0x24e65c=0x0;_0x24e65c0x1){_0x45baf0['or'](_0xba63('0x6a'),qs[_0xba63('0x6b')](_0x4e7c47),null);}else{if(qs[_0xba63('0x6c')](_0x4e7c47)){_0x45baf0['or'](_0xba63('0x6d'),_0x4e7c47+'%');_0x45baf0['or'](_0xba63('0x6e'),_0x4e7c47+'%');_0x45baf0['or']('c.mobile\x20LIKE\x20?',_0x4e7c47+'%');_0x45baf0['or'](_0xba63('0x6f'),_0x4e7c47+'%');}else if(qs[_0xba63('0x70')](_0x4e7c47)){_0x45baf0['or'](_0xba63('0x71'),_0x4e7c47+'%');}else{_0x45baf0['or'](_0xba63('0x72'),'%'+_0x4e7c47+'%');_0x45baf0['or']('c.lastName\x20LIKE\x20?','%'+_0x4e7c47+'%');_0x45baf0['or'](_0xba63('0x71'),'%'+_0x4e7c47+'%');}}}}_0x15ed05['where'](_0x45baf0);_0x15ed05['group'](_0xba63('0x73'));var _0xc59203={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x16ca4a=_0x15ed05[_0xba63('0x74')]()[_0xba63('0x41')]('c.id');if(_0x23e094[_0xba63('0x3e')]){_0x23e094['order'][_0xba63('0x54')](function(_0x4c90e2){_0x15ed05[_0xba63('0x3e')]('c.'+_0x4c90e2[0x0],_0x4c90e2[0x1]===_0xba63('0x75')?![]:!![]);});}if(!_['isEmpty'](_0x21f124)){_0x15ed05[_0xba63('0x76')](_0x1c7866);_0x16ca4a[_0xba63('0x49')](_0xba63('0x77'),_0x21f124);}BPromise[_0xba63('0x78')]()[_0xba63('0x2c')](function(){if(_0x43e8fb&&!_[_0xba63('0x79')](_0x43e8fb['conditions'],[_0xba63('0x41'),'User'])){return _0x164ef9[_0xba63('0x7a')][_0xba63('0x7b')]({'attributes':['id'],'raw':!![]})[_0xba63('0x2c')](function(_0x537c4b){if(_['isEmpty'](_0x537c4b)){_0x16ca4a['where']('c.ListId\x20IS\x20NULL');_0x15ed05[_0xba63('0x49')]('c.ListId\x20IS\x20NULL');}else{_0x16ca4a['where'](_0xba63('0x62'),_[_0xba63('0x53')](_0x537c4b,'id'));_0x15ed05[_0xba63('0x49')](_0xba63('0x62'),_[_0xba63('0x53')](_0x537c4b,'id'));}});}else{return;}})[_0xba63('0x2c')](function(){db[_0xba63('0x7c')][_0xba63('0x39')](_0x16ca4a[_0xba63('0x7d')](),_0xc59203)['then'](function(_0x11f9fb){_0x2d7281[_0xba63('0x20')]=_0x11f9fb[_0xba63('0x2e')];if(_0x2d7281[_0xba63('0x20')]===0x0)return[];return db['sequelize'][_0xba63('0x39')](_0x30354f['toString'](),_0xc59203);})[_0xba63('0x2c')](function(_0xabea96){_0x367a60=_['keyBy'](_0xabea96,'id');_0xc59203=_[_0xba63('0x7e')](_0xc59203,{'model':db[_0xba63('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x164ef9[_0xba63('0x39')][_0xba63('0x7f')]){_0x23e094[_0xba63('0x3c')][_0xba63('0x54')](function(_0x52f465){_0x15ed05['field']('c.'+_0x52f465);});}else{_0x15ed05[_0xba63('0x41')]('c.id');_0x15ed05[_0xba63('0x41')](_0xba63('0x80'));_0x15ed05['field'](_0xba63('0x81'));_0x15ed05[_0xba63('0x41')]('c.phone');_0x15ed05[_0xba63('0x41')]('c.mobile');_0x15ed05[_0xba63('0x41')]('c.fax');_0x15ed05[_0xba63('0x41')](_0xba63('0x82'));_0x15ed05['field']('c.ListId');_0x15ed05['field'](_0xba63('0x83'));_0x15ed05['field'](_0xba63('0x84'),_0xba63('0x85'));}if(_0x23e094['limit'])_0x15ed05[_0xba63('0x22')](_0x23e094[_0xba63('0x22')]);if(_0x23e094[_0xba63('0x21')])_0x15ed05['offset'](_0x23e094[_0xba63('0x21')]);return db[_0xba63('0x7c')][_0xba63('0x39')](_0x15ed05['toString'](),_0xc59203);})['then'](function(_0x4f9120){_0x4f9120['forEach'](function(_0x5b42b6){if(_0x5b42b6[_0xba63('0x85')]){_0x5b42b6[_0xba63('0x86')]=[];_0x5b42b6['TagIds'][_0xba63('0x52')](',')['forEach'](function(_0xd1f01b){_0x5b42b6['Tags'][_0xba63('0x31')](_0x367a60[_0xd1f01b]);});}delete _0x5b42b6[_0xba63('0x85')];});_0x2d7281[_0xba63('0x87')]=_0x4f9120;return _0x2d7281;})[_0xba63('0x2c')](respondWithFilteredResult(_0x4bbb29,_0x23e094));});})['catch'](handleError(_0x4bbb29,null));};exports[_0xba63('0x88')]=function(_0x4c609e,_0x28be1e){return db[_0xba63('0x2b')][_0xba63('0x4f')]({'where':{'id':_0x4c609e[_0xba63('0x89')]['id']}})[_0xba63('0x2c')](handleEntityNotFound(_0x28be1e,null))[_0xba63('0x2c')](removeEntity(_0x28be1e,null))[_0xba63('0x8a')](handleError(_0x28be1e,null));};exports[_0xba63('0x8b')]=function(_0x15cf47,_0x291cd2){return db[_0xba63('0x2b')][_0xba63('0x8b')]()['then'](function(_0x223363){delete _0x223363[_0xba63('0x8c')];for(var _0x56af68=0x0;_0x56af68=_0x18215c){_0x2cf5c7=_0x18215c;_0x18d35b=0xc8;}else{_0x18d35b=0xce;}_0x4b8ee0['status'](_0x18d35b);return _0x4b8ee0[_0x8887('0x20')](_0x8887('0x21'),_0x4764c6+'-'+_0x2cf5c7+'/'+_0x18215c)['json'](_0x45cf2c);}return null;};}function patchUpdates(_0x5a893f){return function(_0xe609f4){try{jsonpatch[_0x8887('0x22')](_0xe609f4,_0x5a893f,!![]);}catch(_0x2175bb){return BPromise['reject'](_0x2175bb);}return _0xe609f4['save']();};}function saveUpdates(_0x1824f6,_0x1ddc8a){return function(_0x9bee35){if(_0x9bee35){return _0x9bee35['update'](_0x1824f6)['then'](function(_0x571429){return _0x571429;});}return null;};}function removeEntity(_0x505bfa,_0xa98f2c){return function(_0x3f25b4){if(_0x3f25b4){return _0x3f25b4[_0x8887('0x23')]()[_0x8887('0x24')](function(){_0x505bfa[_0x8887('0x1b')](0xcc)[_0x8887('0x25')]();});}};}function handleEntityNotFound(_0x428065,_0x483929){return function(_0x105880){if(!_0x105880){_0x428065[_0x8887('0x1a')](0x194);}return _0x105880;};}function handleError(_0x1d7687,_0x18ea2d){_0x18ea2d=_0x18ea2d||0x1f4;return function(_0x592ecb){logger[_0x8887('0x26')](_0x592ecb[_0x8887('0x27')]);if(_0x592ecb['name']){delete _0x592ecb[_0x8887('0x28')];}_0x1d7687[_0x8887('0x1b')](_0x18ea2d)[_0x8887('0x29')](_0x592ecb);};}exports[_0x8887('0x2a')]=function(_0x2d31ec,_0x237a08){var _0x27971e={},_0x5f078e={},_0xae5e9d={'count':0x0,'rows':[]};return db['CmContact'][_0x8887('0x2b')]()[_0x8887('0x24')](function(_0x2a7542){var _0x432bf8=[];for(var _0x5b9a3b=0x0;_0x5b9a3b0x1){_0x23db1f['or'](_0x8887('0x68'),qs[_0x8887('0x69')](_0x1728fe),null);}else{if(qs[_0x8887('0x6a')](_0x1728fe)){_0x23db1f['or'](_0x8887('0x6b'),_0x1728fe+'%');_0x23db1f['or'](_0x8887('0x6c'),_0x1728fe+'%');_0x23db1f['or']('c.mobile\x20LIKE\x20?',_0x1728fe+'%');_0x23db1f['or'](_0x8887('0x6d'),_0x1728fe+'%');}else if(qs[_0x8887('0x6e')](_0x1728fe)){_0x23db1f['or']('c.email\x20LIKE\x20?',_0x1728fe+'%');}else{_0x23db1f['or'](_0x8887('0x6f'),'%'+_0x1728fe+'%');_0x23db1f['or']('c.lastName\x20LIKE\x20?','%'+_0x1728fe+'%');_0x23db1f['or']('c.email\x20LIKE\x20?','%'+_0x1728fe+'%');}}}}_0xdfca54[_0x8887('0x3e')](_0x23db1f);_0xdfca54[_0x8887('0x70')](_0x8887('0x71'));var _0x58281e={'type':db[_0x8887('0x72')][_0x8887('0x73')][_0x8887('0x74')],'raw':!![]};var _0x26eea1=_0xdfca54[_0x8887('0x75')]()[_0x8887('0x40')](_0x8887('0x71'));if(_0x27971e['order']){_0x27971e[_0x8887('0x76')][_0x8887('0x54')](function(_0x5e16ad){_0xdfca54[_0x8887('0x76')]('c.'+_0x5e16ad[0x0],_0x5e16ad[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8887('0x77')](_0x5aef06)){_0xdfca54['having'](_0x49a0b4);_0x26eea1[_0x8887('0x3e')](_0x8887('0x78'),_0x5aef06);}BPromise['resolve']()[_0x8887('0x24')](function(){if(_0x41acff&&!_[_0x8887('0x79')](_0x41acff[_0x8887('0x4f')],[_0x8887('0x40'),_0x8887('0x57')])){return _0x2d31ec[_0x8887('0x7a')][_0x8887('0x7b')]({'attributes':['id'],'raw':!![]})[_0x8887('0x24')](function(_0x54470a){if(_[_0x8887('0x77')](_0x54470a)){_0x26eea1['where'](_0x8887('0x7c'));_0xdfca54['where'](_0x8887('0x7c'));}else{_0x26eea1['where']('c.ListId\x20IN\x20?',_[_0x8887('0x53')](_0x54470a,'id'));_0xdfca54[_0x8887('0x3e')](_0x8887('0x61'),_[_0x8887('0x53')](_0x54470a,'id'));}});}else{return;}})[_0x8887('0x24')](function(){db[_0x8887('0x7d')][_0x8887('0x37')](_0x26eea1[_0x8887('0x7e')](),_0x58281e)['then'](function(_0xf50170){_0xae5e9d[_0x8887('0x1d')]=_0xf50170[_0x8887('0x2c')];if(_0xae5e9d[_0x8887('0x1d')]===0x0)return[];return db[_0x8887('0x7d')]['query'](_0x394442['toString'](),_0x58281e);})[_0x8887('0x24')](function(_0x2bcd91){_0x1b4f06=_[_0x8887('0x7f')](_0x2bcd91,'id');_0x58281e=_[_0x8887('0x80')](_0x58281e,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d31ec[_0x8887('0x37')][_0x8887('0x3b')]){_0x27971e['attributes']['forEach'](function(_0x33bbe6){_0xdfca54[_0x8887('0x40')]('c.'+_0x33bbe6);});}else{_0xdfca54['field'](_0x8887('0x71'));_0xdfca54['field'](_0x8887('0x81'));_0xdfca54['field'](_0x8887('0x82'));_0xdfca54[_0x8887('0x40')](_0x8887('0x83'));_0xdfca54[_0x8887('0x40')](_0x8887('0x84'));_0xdfca54[_0x8887('0x40')](_0x8887('0x85'));_0xdfca54[_0x8887('0x40')](_0x8887('0x86'));_0xdfca54[_0x8887('0x40')](_0x8887('0x87'));_0xdfca54['field'](_0x8887('0x88'));_0xdfca54['field'](_0x8887('0x89'),_0x8887('0x8a'));}if(_0x27971e[_0x8887('0x1f')])_0xdfca54[_0x8887('0x1f')](_0x27971e[_0x8887('0x1f')]);if(_0x27971e[_0x8887('0x1e')])_0xdfca54[_0x8887('0x1e')](_0x27971e[_0x8887('0x1e')]);return db[_0x8887('0x7d')][_0x8887('0x37')](_0xdfca54[_0x8887('0x7e')](),_0x58281e);})['then'](function(_0x473569){_0x473569[_0x8887('0x54')](function(_0x502ff0){if(_0x502ff0[_0x8887('0x8a')]){_0x502ff0[_0x8887('0x8b')]=[];_0x502ff0[_0x8887('0x8a')]['split'](',')[_0x8887('0x54')](function(_0x4e2365){_0x502ff0[_0x8887('0x8b')][_0x8887('0x30')](_0x1b4f06[_0x4e2365]);});}delete _0x502ff0[_0x8887('0x8a')];});_0xae5e9d[_0x8887('0x8c')]=_0x473569;return _0xae5e9d;})[_0x8887('0x24')](respondWithFilteredResult(_0x237a08,_0x27971e));});})[_0x8887('0x8d')](handleError(_0x237a08,null));};exports[_0x8887('0x23')]=function(_0x320d7e,_0x5e4128){return db['CmContact'][_0x8887('0x50')]({'where':{'id':_0x320d7e[_0x8887('0x8e')]['id']}})[_0x8887('0x24')](handleEntityNotFound(_0x5e4128,null))[_0x8887('0x24')](removeEntity(_0x5e4128,null))[_0x8887('0x8d')](handleError(_0x5e4128,null));};exports[_0x8887('0x2b')]=function(_0x16a77a,_0x2b84f2){return db[_0x8887('0x8f')][_0x8887('0x2b')]()[_0x8887('0x24')](function(_0x41c21d){delete _0x41c21d[_0x8887('0x90')];for(var _0x26ae64=0x0;_0x26ae64{}\s\\|]/g,'-');_0x3f0257(null,util[_0xe032('0x21')]('%s-%s%s',path[_0xe032('0x22')](_0x4608e4[_0xe032('0x1f')],path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])));}})});router[_0xe032('0x16')]('/csv',upload['single']('file'),controller[_0xe032('0x25')]);var upload=multer({'storage':multer[_0xe032('0x1d')]({'destination':function(_0x302559,_0x2a56e5,_0x2bfe8f){_0x2bfe8f(null,path[_0xe032('0x26')](config[_0xe032('0x1e')],_0xe032('0x27')));},'filename':function(_0x4dcbf1,_0x1ac20b,_0x5bb36a){_0x1ac20b[_0xe032('0x1f')]=_0x1ac20b[_0xe032('0x1f')][_0xe032('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bb36a(null,util[_0xe032('0x21')]('%s-%s%s',path['basename'](_0x1ac20b[_0xe032('0x1f')],path[_0xe032('0x23')](_0x1ac20b[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path['extname'](_0x1ac20b['originalname'])));}})});router['post'](_0xe032('0x28'),upload[_0xe032('0x29')](_0xe032('0x2a')),controller[_0xe032('0x2b')]);router['post'](_0xe032('0x2c'),auth[_0xe032('0x8')](),controller[_0xe032('0x2d')]);router[_0xe032('0x2e')](_0xe032('0xc'),auth['isAuthenticated'](),controller[_0xe032('0x2f')]);router[_0xe032('0x30')](_0xe032('0xc'),auth[_0xe032('0x8')](),controller['destroy']);module[_0xe032('0x31')]=router; \ No newline at end of file +var _0x1cb9=['put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','post','/merge','create','/create_many','setTags','join','replace','format','%s-%s%s','basename','extname','originalname','now','/csv','single','file','uploadCsv','diskStorage','root','/upload','upload','/upload/:id','import'];(function(_0x5679a8,_0x317cf9){var _0x49d157=function(_0x1463a3){while(--_0x1463a3){_0x5679a8['push'](_0x5679a8['shift']());}};_0x49d157(++_0x317cf9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5c07cd,_0x577420){_0x5c07cd=_0x5c07cd-0x0;var _0x5c81fe=_0x1cb9[_0x5c07cd];return _0x5c81fe;};'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('./cmContact.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['describe']);router[_0x91cb('0x7')]('/:id',auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0x7')](_0x91cb('0xb'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0x7')](_0x91cb('0xd'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0x7')](_0x91cb('0xf'),auth['isAuthenticated'](),controller[_0x91cb('0x10')]);router[_0x91cb('0x7')]('/:id/hopper_finals',auth[_0x91cb('0x8')](),controller[_0x91cb('0x11')]);router[_0x91cb('0x7')](_0x91cb('0x12'),auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0x91cb('0x13')](_0x91cb('0x14'),auth['isAuthenticated'](),controller['merge']);router[_0x91cb('0x13')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x15')]);router['post'](_0x91cb('0x16'),auth[_0x91cb('0x8')](),controller['bulkCreate']);router[_0x91cb('0x13')](_0x91cb('0xb'),auth[_0x91cb('0x8')](),controller[_0x91cb('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fba4f,_0x7dcf60,_0x4ca8e8){_0x4ca8e8(null,path[_0x91cb('0x18')](config['root'],'server/files/tmp'));},'filename':function(_0x281ff3,_0x160ded,_0x56e409){_0x160ded['originalname']=_0x160ded['originalname'][_0x91cb('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56e409(null,util[_0x91cb('0x1a')](_0x91cb('0x1b'),path[_0x91cb('0x1c')](_0x160ded['originalname'],path[_0x91cb('0x1d')](_0x160ded[_0x91cb('0x1e')])),Date[_0x91cb('0x1f')](),path['extname'](_0x160ded[_0x91cb('0x1e')])));}})});router[_0x91cb('0x13')](_0x91cb('0x20'),upload[_0x91cb('0x21')](_0x91cb('0x22')),controller[_0x91cb('0x23')]);var upload=multer({'storage':multer[_0x91cb('0x24')]({'destination':function(_0x423c4f,_0x264e9b,_0x4c8438){_0x4c8438(null,path['join'](config[_0x91cb('0x25')],'server/files/tmp'));},'filename':function(_0x1c67d2,_0x34d372,_0x318031){_0x34d372['originalname']=_0x34d372[_0x91cb('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x318031(null,util[_0x91cb('0x1a')](_0x91cb('0x1b'),path[_0x91cb('0x1c')](_0x34d372[_0x91cb('0x1e')],path[_0x91cb('0x1d')](_0x34d372['originalname'])),Date[_0x91cb('0x1f')](),path['extname'](_0x34d372[_0x91cb('0x1e')])));}})});router[_0x91cb('0x13')](_0x91cb('0x26'),upload['single'](_0x91cb('0x22')),controller[_0x91cb('0x27')]);router[_0x91cb('0x13')](_0x91cb('0x28'),auth[_0x91cb('0x8')](),controller[_0x91cb('0x29')]);router[_0x91cb('0x2a')](_0x91cb('0x2b'),auth[_0x91cb('0x8')](),controller['update']);router[_0x91cb('0x2c')](_0x91cb('0x2b'),auth[_0x91cb('0x8')](),controller[_0x91cb('0x2d')]);module[_0x91cb('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 60f7de1..b39adaf 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 _0xd9ce=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd9ce,0xeb));var _0xed9c=function(_0x639fd7,_0x2d4036){_0x639fd7=_0x639fd7-0x0;var _0x5b5c1a=_0xd9ce[_0x639fd7];return _0x5b5c1a;};'use strict';var Sequelize=require(_0xed9c('0x0'));module[_0xed9c('0x1')]={'CmContactId':{'type':Sequelize[_0xed9c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xed9c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xed9c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xed9c('0x3')],'defaultValue':_0xed9c('0x4')},'OrderBy':{'type':Sequelize[_0xed9c('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x308a=['INTEGER','STRING','sequelize'];(function(_0x52002d,_0x56a4b7){var _0x255b0e=function(_0x10ab9b){while(--_0x10ab9b){_0x52002d['push'](_0x52002d['shift']());}};_0x255b0e(++_0x56a4b7);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa308('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xa308('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa308('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa308('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa308('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'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 da2dd7c..b816810 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 _0x15f0=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmContactHasItem','count','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','find','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x414f45,_0x1ee7d3){var _0x3bc907=function(_0x2e22de){while(--_0x2e22de){_0x414f45['push'](_0x414f45['shift']());}};_0x3bc907(++_0x1ee7d3);}(_0x15f0,0x1bc));var _0x015f=function(_0x177815,_0x68297c){_0x177815=_0x177815-0x0;var _0x1e6dba=_0x15f0[_0x177815];return _0x1e6dba;};'use strict';var pdf=require(_0x015f('0x0'));var emlformat=require(_0x015f('0x1'));var rimraf=require(_0x015f('0x2'));var zipdir=require(_0x015f('0x3'));var jsonpatch=require(_0x015f('0x4'));var rp=require(_0x015f('0x5'));var moment=require('moment');var BPromise=require(_0x015f('0x6'));var Mustache=require(_0x015f('0x7'));var util=require(_0x015f('0x8'));var path=require(_0x015f('0x9'));var sox=require(_0x015f('0xa'));var csv=require('to-csv');var ejs=require(_0x015f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x015f('0xc'));var crypto=require('crypto');var jsforce=require(_0x015f('0xd'));var deskjs=require(_0x015f('0xe'));var toCsv=require(_0x015f('0xf'));var querystring=require(_0x015f('0x10'));var Papa=require(_0x015f('0x11'));var Redis=require('ioredis');var authService=require(_0x015f('0x12'));var qs=require(_0x015f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x015f('0x14'));var logger=require('../../config/logger')(_0x015f('0x15'));var utils=require('../../config/utils');var config=require(_0x015f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28eeb4,_0x281947){_0x281947=_0x281947||0xcc;return function(_0xbb6ada){if(_0xbb6ada){return _0x28eeb4[_0x015f('0x17')](_0x281947);}return _0x28eeb4[_0x015f('0x18')](_0x281947)[_0x015f('0x19')]();};}function respondWithResult(_0x86b719,_0x450a34){_0x450a34=_0x450a34||0xc8;return function(_0x36477d){if(_0x36477d){return _0x86b719[_0x015f('0x18')](_0x450a34)[_0x015f('0x1a')](_0x36477d);}};}function respondWithFilteredResult(_0x36efe5,_0x5a167b){return function(_0x20a3f5){if(_0x20a3f5){var _0x3114f1=_0x20a3f5['count'],_0x238101=_0x5a167b[_0x015f('0x1b')],_0x454509=_0x5a167b['offset']+_0x5a167b['limit'],_0x191a02;if(_0x454509>=_0x3114f1){_0x454509=_0x3114f1;_0x191a02=0xc8;}else{_0x191a02=0xce;}_0x36efe5[_0x015f('0x18')](_0x191a02);return _0x36efe5[_0x015f('0x1c')](_0x015f('0x1d'),_0x238101+'-'+_0x454509+'/'+_0x3114f1)[_0x015f('0x1a')](_0x20a3f5);}return null;};}function patchUpdates(_0x5b254){return function(_0x4fb1b9){try{jsonpatch[_0x015f('0x1e')](_0x4fb1b9,_0x5b254,!![]);}catch(_0x1249d4){return BPromise['reject'](_0x1249d4);}return _0x4fb1b9[_0x015f('0x1f')]();};}function saveUpdates(_0x505af9,_0x155600){return function(_0x4fe0c5){if(_0x4fe0c5){return _0x4fe0c5[_0x015f('0x20')](_0x505af9)[_0x015f('0x21')](function(_0x5d687b){return _0x5d687b;});}return null;};}function removeEntity(_0x13d8a1,_0x5acbf9){return function(_0x1b67c1){if(_0x1b67c1){return _0x1b67c1[_0x015f('0x22')]()[_0x015f('0x21')](function(){var _0xae531b=_0x1b67c1[_0x015f('0x23')]({'plain':!![]});var _0x2b8fc7='CmContactHasItems';return db[_0x015f('0x24')][_0x015f('0x22')]({'where':{'type':_0x2b8fc7,'resourceId':_0xae531b['id']}})[_0x015f('0x21')](function(){return _0x1b67c1;});})[_0x015f('0x21')](function(){_0x13d8a1[_0x015f('0x18')](0xcc)[_0x015f('0x19')]();});}};}function handleEntityNotFound(_0x20db52,_0x33a3f5){return function(_0x283692){if(!_0x283692){_0x20db52['sendStatus'](0x194);}return _0x283692;};}function handleError(_0x755c53,_0x5ab9af){_0x5ab9af=_0x5ab9af||0x1f4;return function(_0x401148){logger[_0x015f('0x25')](_0x401148[_0x015f('0x26')]);if(_0x401148[_0x015f('0x27')]){delete _0x401148[_0x015f('0x27')];}_0x755c53[_0x015f('0x18')](_0x5ab9af)[_0x015f('0x28')](_0x401148);};}exports[_0x015f('0x29')]=function(_0x5b5468,_0x4411af){var _0x4f394={},_0x2ad54f={},_0x2580cb={'count':0x0,'rows':[]};var _0x25544c=_[_0x015f('0x2a')](db['CmContactHasItem'][_0x015f('0x2b')],function(_0x10848b){return{'name':_0x10848b[_0x015f('0x2c')],'type':_0x10848b[_0x015f('0x2d')][_0x015f('0x2e')]};});_0x2ad54f['model']=_[_0x015f('0x2a')](_0x25544c,_0x015f('0x27'));_0x2ad54f[_0x015f('0x2f')]=_[_0x015f('0x30')](_0x5b5468[_0x015f('0x2f')]);_0x2ad54f[_0x015f('0x31')]=_[_0x015f('0x32')](_0x2ad54f[_0x015f('0x33')],_0x2ad54f[_0x015f('0x2f')]);_0x4f394[_0x015f('0x34')]=_['intersection'](_0x2ad54f[_0x015f('0x33')],qs['fields'](_0x5b5468[_0x015f('0x2f')][_0x015f('0x35')]));_0x4f394[_0x015f('0x34')]=_0x4f394[_0x015f('0x34')][_0x015f('0x36')]?_0x4f394[_0x015f('0x34')]:_0x2ad54f[_0x015f('0x33')];if(!_0x5b5468[_0x015f('0x2f')][_0x015f('0x37')](_0x015f('0x38'))){_0x4f394[_0x015f('0x39')]=qs[_0x015f('0x39')](_0x5b5468[_0x015f('0x2f')][_0x015f('0x39')]);_0x4f394[_0x015f('0x1b')]=qs[_0x015f('0x1b')](_0x5b5468[_0x015f('0x2f')]['offset']);}_0x4f394[_0x015f('0x3a')]=qs[_0x015f('0x3b')](_0x5b5468['query'][_0x015f('0x3b')]);_0x4f394['where']=qs[_0x015f('0x31')](_[_0x015f('0x3c')](_0x5b5468[_0x015f('0x2f')],_0x2ad54f[_0x015f('0x31')]),_0x25544c);if(_0x5b5468[_0x015f('0x2f')][_0x015f('0x3d')]){_0x4f394[_0x015f('0x3e')]=_[_0x015f('0x3f')](_0x4f394['where'],{'$or':_[_0x015f('0x2a')](_0x25544c,function(_0x1a81ef){if(_0x1a81ef[_0x015f('0x2d')]!==_0x015f('0x40')){var _0x3c1553={};_0x3c1553[_0x1a81ef['name']]={'$like':'%'+_0x5b5468[_0x015f('0x2f')][_0x015f('0x3d')]+'%'};return _0x3c1553;}})});}_0x4f394=_[_0x015f('0x3f')]({},_0x4f394,_0x5b5468[_0x015f('0x41')]);var _0x52eb9c={'where':_0x4f394[_0x015f('0x3e')]};return db[_0x015f('0x42')][_0x015f('0x43')](_0x52eb9c)[_0x015f('0x21')](function(_0x1a1626){_0x2580cb[_0x015f('0x43')]=_0x1a1626;if(_0x5b5468[_0x015f('0x2f')][_0x015f('0x44')]){_0x4f394[_0x015f('0x45')]=[{'all':!![]}];}return db[_0x015f('0x42')][_0x015f('0x46')](_0x4f394);})['then'](function(_0x347b59){_0x2580cb[_0x015f('0x47')]=_0x347b59;return _0x2580cb;})[_0x015f('0x21')](respondWithFilteredResult(_0x4411af,_0x4f394))[_0x015f('0x48')](handleError(_0x4411af,null));};exports['show']=function(_0x1ba14a,_0x171029){var _0x25f168={'raw':!![],'where':{'id':_0x1ba14a[_0x015f('0x49')]['id']}},_0x5f26e9={};_0x5f26e9[_0x015f('0x33')]=_[_0x015f('0x30')](db['CmContactHasItem']['rawAttributes']);_0x5f26e9['query']=_['keys'](_0x1ba14a[_0x015f('0x2f')]);_0x5f26e9['filters']=_[_0x015f('0x32')](_0x5f26e9[_0x015f('0x33')],_0x5f26e9['query']);_0x25f168['attributes']=_[_0x015f('0x32')](_0x5f26e9['model'],qs[_0x015f('0x35')](_0x1ba14a[_0x015f('0x2f')][_0x015f('0x35')]));_0x25f168[_0x015f('0x34')]=_0x25f168[_0x015f('0x34')][_0x015f('0x36')]?_0x25f168[_0x015f('0x34')]:_0x5f26e9[_0x015f('0x33')];if(_0x1ba14a[_0x015f('0x2f')][_0x015f('0x44')]){_0x25f168[_0x015f('0x45')]=[{'all':!![]}];}_0x25f168=_[_0x015f('0x3f')]({},_0x25f168,_0x1ba14a[_0x015f('0x41')]);return db[_0x015f('0x42')]['find'](_0x25f168)[_0x015f('0x21')](handleEntityNotFound(_0x171029,null))[_0x015f('0x21')](respondWithResult(_0x171029,null))[_0x015f('0x48')](handleError(_0x171029,null));};exports[_0x015f('0x4a')]=function(_0x456e20,_0xdfb99c){return db[_0x015f('0x42')][_0x015f('0x4a')](_0x456e20[_0x015f('0x4b')],{})[_0x015f('0x21')](function(_0x3d94fe){var _0x3d444e=_0x456e20[_0x015f('0x4c')][_0x015f('0x23')]({'plain':!![]});if(!_0x3d444e)throw new Error(_0x015f('0x4d'));if(_0x3d444e['role']===_0x015f('0x4c')){var _0x51da65=_0x3d94fe[_0x015f('0x23')]({'plain':!![]});var _0x297ece=_0x015f('0x4e');return db[_0x015f('0x4f')][_0x015f('0x50')]({'where':{'name':_0x297ece,'userProfileId':_0x3d444e[_0x015f('0x51')]},'raw':!![]})[_0x015f('0x21')](function(_0x4b08cb){if(_0x4b08cb&&_0x4b08cb[_0x015f('0x52')]===0x0){return db[_0x015f('0x24')][_0x015f('0x4a')]({'name':_0x51da65['name'],'resourceId':_0x51da65['id'],'type':_0x4b08cb[_0x015f('0x27')],'sectionId':_0x4b08cb['id']},{})['then'](function(){return _0x3d94fe;});}else{return _0x3d94fe;}})[_0x015f('0x48')](function(_0x28a29a){logger[_0x015f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28a29a);throw _0x28a29a;});}return _0x3d94fe;})[_0x015f('0x21')](respondWithResult(_0xdfb99c,0xc9))[_0x015f('0x48')](handleError(_0xdfb99c,null));};exports[_0x015f('0x20')]=function(_0xc0e839,_0x14ab63){if(_0xc0e839[_0x015f('0x4b')]['id']){delete _0xc0e839[_0x015f('0x4b')]['id'];}return db['CmContactHasItem'][_0x015f('0x50')]({'where':{'id':_0xc0e839[_0x015f('0x49')]['id']}})[_0x015f('0x21')](handleEntityNotFound(_0x14ab63,null))['then'](saveUpdates(_0xc0e839[_0x015f('0x4b')],null))[_0x015f('0x21')](respondWithResult(_0x14ab63,null))['catch'](handleError(_0x14ab63,null));};exports[_0x015f('0x22')]=function(_0x2f14a3,_0x3fb12b){return db['CmContactHasItem']['find']({'where':{'id':_0x2f14a3['params']['id']}})['then'](handleEntityNotFound(_0x3fb12b,null))['then'](removeEntity(_0x3fb12b,null))[_0x015f('0x48')](handleError(_0x3fb12b,null));}; \ No newline at end of file +var _0x8dbb=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0x8dbb,0xb1));var _0xb8db=function(_0x2321ed,_0x186614){_0x2321ed=_0x2321ed-0x0;var _0x342219=_0x8dbb[_0x2321ed];return _0x342219;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb8db('0x0'));var rimraf=require(_0xb8db('0x1'));var zipdir=require(_0xb8db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8db('0x3'));var moment=require(_0xb8db('0x4'));var BPromise=require(_0xb8db('0x5'));var Mustache=require(_0xb8db('0x6'));var util=require(_0xb8db('0x7'));var path=require(_0xb8db('0x8'));var sox=require(_0xb8db('0x9'));var csv=require(_0xb8db('0xa'));var ejs=require(_0xb8db('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8db('0xc'));var crypto=require('crypto');var jsforce=require(_0xb8db('0xd'));var deskjs=require(_0xb8db('0xe'));var toCsv=require(_0xb8db('0xa'));var querystring=require(_0xb8db('0xf'));var Papa=require(_0xb8db('0x10'));var Redis=require('ioredis');var authService=require(_0xb8db('0x11'));var qs=require(_0xb8db('0x12'));var as=require(_0xb8db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8db('0x14'))(_0xb8db('0x15'));var utils=require(_0xb8db('0x16'));var config=require(_0xb8db('0x17'));var db=require(_0xb8db('0x18'))['db'];function respondWithStatusCode(_0x28ac6d,_0x50a8f3){_0x50a8f3=_0x50a8f3||0xcc;return function(_0x837118){if(_0x837118){return _0x28ac6d[_0xb8db('0x19')](_0x50a8f3);}return _0x28ac6d['status'](_0x50a8f3)[_0xb8db('0x1a')]();};}function respondWithResult(_0x1339f2,_0x338f62){_0x338f62=_0x338f62||0xc8;return function(_0x16c0e7){if(_0x16c0e7){return _0x1339f2['status'](_0x338f62)[_0xb8db('0x1b')](_0x16c0e7);}};}function respondWithFilteredResult(_0x524c8e,_0x258dde){return function(_0x39bf6f){if(_0x39bf6f){var _0x2636d2=_0x39bf6f[_0xb8db('0x1c')],_0x3d523a=_0x258dde[_0xb8db('0x1d')],_0x200053=_0x258dde[_0xb8db('0x1d')]+_0x258dde[_0xb8db('0x1e')],_0x1dc15b;if(_0x200053>=_0x2636d2){_0x200053=_0x2636d2;_0x1dc15b=0xc8;}else{_0x1dc15b=0xce;}_0x524c8e[_0xb8db('0x1f')](_0x1dc15b);return _0x524c8e[_0xb8db('0x20')](_0xb8db('0x21'),_0x3d523a+'-'+_0x200053+'/'+_0x2636d2)[_0xb8db('0x1b')](_0x39bf6f);}return null;};}function patchUpdates(_0x4ae7c3){return function(_0x44e7c3){try{jsonpatch[_0xb8db('0x22')](_0x44e7c3,_0x4ae7c3,!![]);}catch(_0x2ca4bd){return BPromise[_0xb8db('0x23')](_0x2ca4bd);}return _0x44e7c3[_0xb8db('0x24')]();};}function saveUpdates(_0x1b191f,_0x624fe7){return function(_0x111cfa){if(_0x111cfa){return _0x111cfa['update'](_0x1b191f)[_0xb8db('0x25')](function(_0x2a7101){return _0x2a7101;});}return null;};}function removeEntity(_0x4147e1,_0x3824ac){return function(_0x3f00b8){if(_0x3f00b8){return _0x3f00b8[_0xb8db('0x26')]()[_0xb8db('0x25')](function(){var _0x1149fc=_0x3f00b8[_0xb8db('0x27')]({'plain':!![]});var _0x5a0b28='CmContactHasItems';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a0b28,'resourceId':_0x1149fc['id']}})[_0xb8db('0x25')](function(){return _0x3f00b8;});})[_0xb8db('0x25')](function(){_0x4147e1[_0xb8db('0x1f')](0xcc)[_0xb8db('0x1a')]();});}};}function handleEntityNotFound(_0x1ead0e,_0x352a12){return function(_0x56923a){if(!_0x56923a){_0x1ead0e[_0xb8db('0x19')](0x194);}return _0x56923a;};}function handleError(_0x369a2a,_0xb05dbd){_0xb05dbd=_0xb05dbd||0x1f4;return function(_0x27d940){logger['error'](_0x27d940[_0xb8db('0x28')]);if(_0x27d940[_0xb8db('0x29')]){delete _0x27d940[_0xb8db('0x29')];}_0x369a2a['status'](_0xb05dbd)[_0xb8db('0x2a')](_0x27d940);};}exports[_0xb8db('0x2b')]=function(_0x3bca9f,_0x3055f3){var _0x544fc8={},_0x500c21={},_0x985ae9={'count':0x0,'rows':[]};var _0x3fb2bd=_[_0xb8db('0x2c')](db[_0xb8db('0x2d')][_0xb8db('0x2e')],function(_0x131f40){return{'name':_0x131f40[_0xb8db('0x2f')],'type':_0x131f40[_0xb8db('0x30')][_0xb8db('0x31')]};});_0x500c21[_0xb8db('0x32')]=_[_0xb8db('0x2c')](_0x3fb2bd,'name');_0x500c21['query']=_[_0xb8db('0x33')](_0x3bca9f['query']);_0x500c21[_0xb8db('0x34')]=_['intersection'](_0x500c21[_0xb8db('0x32')],_0x500c21['query']);_0x544fc8[_0xb8db('0x35')]=_[_0xb8db('0x36')](_0x500c21[_0xb8db('0x32')],qs[_0xb8db('0x37')](_0x3bca9f['query'][_0xb8db('0x37')]));_0x544fc8['attributes']=_0x544fc8[_0xb8db('0x35')][_0xb8db('0x38')]?_0x544fc8['attributes']:_0x500c21[_0xb8db('0x32')];if(!_0x3bca9f[_0xb8db('0x39')][_0xb8db('0x3a')](_0xb8db('0x3b'))){_0x544fc8[_0xb8db('0x1e')]=qs[_0xb8db('0x1e')](_0x3bca9f['query'][_0xb8db('0x1e')]);_0x544fc8[_0xb8db('0x1d')]=qs[_0xb8db('0x1d')](_0x3bca9f[_0xb8db('0x39')][_0xb8db('0x1d')]);}_0x544fc8['order']=qs[_0xb8db('0x3c')](_0x3bca9f[_0xb8db('0x39')][_0xb8db('0x3c')]);_0x544fc8[_0xb8db('0x3d')]=qs[_0xb8db('0x34')](_[_0xb8db('0x3e')](_0x3bca9f[_0xb8db('0x39')],_0x500c21[_0xb8db('0x34')]),_0x3fb2bd);if(_0x3bca9f[_0xb8db('0x39')][_0xb8db('0x3f')]){_0x544fc8[_0xb8db('0x3d')]=_[_0xb8db('0x40')](_0x544fc8['where'],{'$or':_[_0xb8db('0x2c')](_0x3fb2bd,function(_0x580627){if(_0x580627['type']!=='VIRTUAL'){var _0x28561e={};_0x28561e[_0x580627[_0xb8db('0x29')]]={'$like':'%'+_0x3bca9f[_0xb8db('0x39')]['filter']+'%'};return _0x28561e;}})});}_0x544fc8=_[_0xb8db('0x40')]({},_0x544fc8,_0x3bca9f[_0xb8db('0x41')]);var _0x3d8d22={'where':_0x544fc8[_0xb8db('0x3d')]};return db[_0xb8db('0x2d')][_0xb8db('0x1c')](_0x3d8d22)[_0xb8db('0x25')](function(_0x3c82e9){_0x985ae9['count']=_0x3c82e9;if(_0x3bca9f[_0xb8db('0x39')]['includeAll']){_0x544fc8[_0xb8db('0x42')]=[{'all':!![]}];}return db[_0xb8db('0x2d')]['findAll'](_0x544fc8);})['then'](function(_0x5e4e29){_0x985ae9[_0xb8db('0x43')]=_0x5e4e29;return _0x985ae9;})['then'](respondWithFilteredResult(_0x3055f3,_0x544fc8))[_0xb8db('0x44')](handleError(_0x3055f3,null));};exports[_0xb8db('0x45')]=function(_0x51d21b,_0x204031){var _0x5656ca={'raw':!![],'where':{'id':_0x51d21b[_0xb8db('0x46')]['id']}},_0x54f6f4={};_0x54f6f4[_0xb8db('0x32')]=_['keys'](db[_0xb8db('0x2d')][_0xb8db('0x2e')]);_0x54f6f4['query']=_[_0xb8db('0x33')](_0x51d21b[_0xb8db('0x39')]);_0x54f6f4['filters']=_[_0xb8db('0x36')](_0x54f6f4[_0xb8db('0x32')],_0x54f6f4[_0xb8db('0x39')]);_0x5656ca['attributes']=_[_0xb8db('0x36')](_0x54f6f4[_0xb8db('0x32')],qs[_0xb8db('0x37')](_0x51d21b[_0xb8db('0x39')][_0xb8db('0x37')]));_0x5656ca[_0xb8db('0x35')]=_0x5656ca[_0xb8db('0x35')][_0xb8db('0x38')]?_0x5656ca[_0xb8db('0x35')]:_0x54f6f4[_0xb8db('0x32')];if(_0x51d21b['query'][_0xb8db('0x47')]){_0x5656ca[_0xb8db('0x42')]=[{'all':!![]}];}_0x5656ca=_[_0xb8db('0x40')]({},_0x5656ca,_0x51d21b[_0xb8db('0x41')]);return db[_0xb8db('0x2d')][_0xb8db('0x48')](_0x5656ca)[_0xb8db('0x25')](handleEntityNotFound(_0x204031,null))[_0xb8db('0x25')](respondWithResult(_0x204031,null))[_0xb8db('0x44')](handleError(_0x204031,null));};exports[_0xb8db('0x49')]=function(_0x9c016,_0x1e605d){return db[_0xb8db('0x2d')][_0xb8db('0x49')](_0x9c016['body'],{})['then'](function(_0x459ffe){var _0x58ae8a=_0x9c016['user'][_0xb8db('0x27')]({'plain':!![]});if(!_0x58ae8a)throw new Error(_0xb8db('0x4a'));if(_0x58ae8a[_0xb8db('0x4b')]==='user'){var _0x56ee86=_0x459ffe[_0xb8db('0x27')]({'plain':!![]});var _0x15d16a='CmContactHasItems';return db[_0xb8db('0x4c')][_0xb8db('0x48')]({'where':{'name':_0x15d16a,'userProfileId':_0x58ae8a[_0xb8db('0x4d')]},'raw':!![]})[_0xb8db('0x25')](function(_0x40bdc2){if(_0x40bdc2&&_0x40bdc2[_0xb8db('0x4e')]===0x0){return db[_0xb8db('0x4f')]['create']({'name':_0x56ee86[_0xb8db('0x29')],'resourceId':_0x56ee86['id'],'type':_0x40bdc2['name'],'sectionId':_0x40bdc2['id']},{})['then'](function(){return _0x459ffe;});}else{return _0x459ffe;}})[_0xb8db('0x44')](function(_0x5f0b8e){logger[_0xb8db('0x50')](_0xb8db('0x51'),_0x5f0b8e);throw _0x5f0b8e;});}return _0x459ffe;})[_0xb8db('0x25')](respondWithResult(_0x1e605d,0xc9))[_0xb8db('0x44')](handleError(_0x1e605d,null));};exports[_0xb8db('0x52')]=function(_0x2d7191,_0x1dbcea){if(_0x2d7191[_0xb8db('0x53')]['id']){delete _0x2d7191[_0xb8db('0x53')]['id'];}return db[_0xb8db('0x2d')][_0xb8db('0x48')]({'where':{'id':_0x2d7191[_0xb8db('0x46')]['id']}})[_0xb8db('0x25')](handleEntityNotFound(_0x1dbcea,null))[_0xb8db('0x25')](saveUpdates(_0x2d7191[_0xb8db('0x53')],null))[_0xb8db('0x25')](respondWithResult(_0x1dbcea,null))[_0xb8db('0x44')](handleError(_0x1dbcea,null));};exports['destroy']=function(_0x488f61,_0x8a67b0){return db[_0xb8db('0x2d')]['find']({'where':{'id':_0x488f61[_0xb8db('0x46')]['id']}})[_0xb8db('0x25')](handleEntityNotFound(_0x8a67b0,null))[_0xb8db('0x25')](removeEntity(_0x8a67b0,null))['catch'](handleError(_0x8a67b0,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d77bcc8..6a9bc6b 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 _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x5d72b8,_0x454ca3){var _0x17ad7d=function(_0x958466){while(--_0x958466){_0x5d72b8['push'](_0x5d72b8['shift']());}};_0x17ad7d(++_0x454ca3);}(_0x4745,0x1e7));var _0x5474=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4745[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('CmContactHasItem',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc949=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items'];(function(_0x101d13,_0x366fc4){var _0x5fb6be=function(_0x6be2ab){while(--_0x6be2ab){_0x101d13['push'](_0x101d13['shift']());}};_0x5fb6be(++_0x366fc4);}(_0xc949,0x181));var _0x9c94=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc949[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9098924..c1388da 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 _0xe119=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x46a7c4,_0x5b18f6){var _0x506235=function(_0x36a4f8){while(--_0x36a4f8){_0x46a7c4['push'](_0x46a7c4['shift']());}};_0x506235(++_0x5b18f6);}(_0xe119,0x1c8));var _0x9e11=function(_0x4c4c59,_0x936c3){_0x4c4c59=_0x4c4c59-0x0;var _0x4ce621=_0xe119[_0x4c4c59];return _0x4ce621;};'use strict';var _=require(_0x9e11('0x0'));var util=require(_0x9e11('0x1'));var moment=require(_0x9e11('0x2'));var BPromise=require(_0x9e11('0x3'));var rs=require(_0x9e11('0x4'));var fs=require('fs');var Redis=require(_0x9e11('0x5'));var db=require(_0x9e11('0x6'))['db'];var utils=require(_0x9e11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e11('0x8'));var jayson=require(_0x9e11('0x9'));var client=jayson[_0x9e11('0xa')][_0x9e11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x389996,_0x425635,_0x5ecff6){return new BPromise(function(_0x54fee8,_0x59e1a3){return client[_0x9e11('0xc')](_0x389996,_0x5ecff6)[_0x9e11('0xd')](function(_0x5729fb){logger['info'](_0x9e11('0xe'),_0x425635,_0x9e11('0xf'));logger[_0x9e11('0x10')](_0x9e11('0x11'),_0x425635,_0x9e11('0xf'),JSON[_0x9e11('0x12')](_0x5729fb));if(_0x5729fb[_0x9e11('0x13')]){if(_0x5729fb[_0x9e11('0x13')]['code']===0x1f4){logger[_0x9e11('0x13')](_0x9e11('0xe'),_0x425635,_0x5729fb['error'][_0x9e11('0x14')]);return _0x59e1a3(_0x5729fb[_0x9e11('0x13')][_0x9e11('0x14')]);}logger[_0x9e11('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x425635,_0x5729fb[_0x9e11('0x13')][_0x9e11('0x14')]);return _0x54fee8(_0x5729fb[_0x9e11('0x13')]['message']);}else{logger[_0x9e11('0x15')](_0x9e11('0xe'),_0x425635,_0x9e11('0xf'));_0x54fee8(_0x5729fb[_0x9e11('0x16')][_0x9e11('0x14')]);}})[_0x9e11('0x17')](function(_0x3473f8){logger[_0x9e11('0x13')](_0x9e11('0xe'),_0x425635,_0x3473f8);_0x59e1a3(_0x3473f8);});});} \ No newline at end of file +var _0x09f4=['message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3682ad,_0x3d954f){var _0x212ff3=function(_0x11c536){while(--_0x11c536){_0x3682ad['push'](_0x3682ad['shift']());}};_0x212ff3(++_0x3d954f);}(_0x09f4,0x1a5));var _0x409f=function(_0x96c2f6,_0x5e66be){_0x96c2f6=_0x96c2f6-0x0;var _0x2fd9f6=_0x09f4[_0x96c2f6];return _0x2fd9f6;};'use strict';var _=require('lodash');var util=require(_0x409f('0x0'));var moment=require(_0x409f('0x1'));var BPromise=require('bluebird');var rs=require(_0x409f('0x2'));var fs=require('fs');var Redis=require(_0x409f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x409f('0x4'));var logger=require(_0x409f('0x5'))('rpc');var config=require(_0x409f('0x6'));var jayson=require(_0x409f('0x7'));var client=jayson[_0x409f('0x8')][_0x409f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f10a,_0x1b731f,_0x210f96){return new BPromise(function(_0x276232,_0x3627d1){return client[_0x409f('0xa')](_0x41f10a,_0x210f96)[_0x409f('0xb')](function(_0xc1b11c){logger[_0x409f('0xc')](_0x409f('0xd'),_0x1b731f,_0x409f('0xe'));logger[_0x409f('0xf')](_0x409f('0x10'),_0x1b731f,_0x409f('0xe'),JSON[_0x409f('0x11')](_0xc1b11c));if(_0xc1b11c[_0x409f('0x12')]){if(_0xc1b11c[_0x409f('0x12')]['code']===0x1f4){logger['error'](_0x409f('0xd'),_0x1b731f,_0xc1b11c[_0x409f('0x12')][_0x409f('0x13')]);return _0x3627d1(_0xc1b11c[_0x409f('0x12')][_0x409f('0x13')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1b731f,_0xc1b11c[_0x409f('0x12')][_0x409f('0x13')]);return _0x276232(_0xc1b11c['error'][_0x409f('0x13')]);}else{logger[_0x409f('0xc')](_0x409f('0xd'),_0x1b731f,_0x409f('0xe'));_0x276232(_0xc1b11c[_0x409f('0x14')]['message']);}})[_0x409f('0x15')](function(_0x35a201){logger[_0x409f('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x1b731f,_0x35a201);_0x3627d1(_0x35a201);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a8dd5b7..63a0b62 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 _0x8d02=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller'];(function(_0x530aaa,_0x5b667b){var _0x130e0b=function(_0x16eacb){while(--_0x16eacb){_0x530aaa['push'](_0x530aaa['shift']());}};_0x130e0b(++_0x5b667b);}(_0x8d02,0x189));var _0x28d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8d02[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x28d0('0x0'));var path=require(_0x28d0('0x1'));var timeout=require('connect-timeout');var express=require(_0x28d0('0x2'));var router=express[_0x28d0('0x3')]();var auth=require(_0x28d0('0x4'));var interaction=require(_0x28d0('0x5'));var config=require('../../config/environment');var controller=require(_0x28d0('0x6'));router[_0x28d0('0x7')]('/',auth[_0x28d0('0x8')](),controller[_0x28d0('0x9')]);router[_0x28d0('0x7')](_0x28d0('0xa'),auth[_0x28d0('0x8')](),controller[_0x28d0('0xb')]);router[_0x28d0('0xc')]('/',auth['isAuthenticated'](),controller[_0x28d0('0xd')]);router[_0x28d0('0xe')]('/:id',auth[_0x28d0('0x8')](),controller['update']);router['delete'](_0x28d0('0xa'),auth[_0x28d0('0x8')](),controller[_0x28d0('0xf')]);module['exports']=router; \ No newline at end of file +var _0x38c0=['/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2eae24,_0x48c754){var _0x182b93=function(_0xae2dc5){while(--_0xae2dc5){_0x2eae24['push'](_0x2eae24['shift']());}};_0x182b93(++_0x48c754);}(_0x38c0,0x187));var _0x038c=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x38c0[_0x380a3f];return _0x2b4eca;};'use strict';var multer=require(_0x038c('0x0'));var util=require(_0x038c('0x1'));var path=require('path');var timeout=require(_0x038c('0x2'));var express=require(_0x038c('0x3'));var router=express[_0x038c('0x4')]();var auth=require(_0x038c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x038c('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x038c('0x7')]('/',auth[_0x038c('0x8')](),controller['index']);router['get'](_0x038c('0x9'),auth[_0x038c('0x8')](),controller[_0x038c('0xa')]);router[_0x038c('0xb')]('/',auth[_0x038c('0x8')](),controller['create']);router[_0x038c('0xc')](_0x038c('0x9'),auth[_0x038c('0x8')](),controller[_0x038c('0xd')]);router['delete']('/:id',auth[_0x038c('0x8')](),controller[_0x038c('0xe')]);module[_0x038c('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 2ceae32..5be8734 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 _0xf48d=['INTEGER','STRING','exports'];(function(_0x3c2250,_0x24268c){var _0x55ae7d=function(_0x21a082){while(--_0x21a082){_0x3c2250['push'](_0x3c2250['shift']());}};_0x55ae7d(++_0x24268c);}(_0xf48d,0x1d6));var _0xdf48=function(_0xfcfe92,_0x14ea66){_0xfcfe92=_0xfcfe92-0x0;var _0x166ba1=_0xf48d[_0xfcfe92];return _0x166ba1;};'use strict';var Sequelize=require('sequelize');module[_0xdf48('0x0')]={'CmContactId':{'type':Sequelize[_0xdf48('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xdf48('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x2f84=['exports','INTEGER','STRING','sequelize'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x2f84,0x1bb));var _0x42f8=function(_0x242211,_0x57a02a){_0x242211=_0x242211-0x0;var _0x1a0cdf=_0x2f84[_0x242211];return _0x1a0cdf;};'use strict';var Sequelize=require(_0x42f8('0x0'));module[_0x42f8('0x1')]={'CmContactId':{'type':Sequelize[_0x42f8('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x42f8('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 8fe2e0c..76a5114 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 _0xd805=['index','map','CmContactHasPhone','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','fields','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','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send'];(function(_0x4d399c,_0x42cb73){var _0x279ca4=function(_0x11dc0a){while(--_0x11dc0a){_0x4d399c['push'](_0x4d399c['shift']());}};_0x279ca4(++_0x42cb73);}(_0xd805,0x1ad));var _0x5d80=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xd805[_0x2df724];return _0x1b2504;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d80('0x0'));var rimraf=require(_0x5d80('0x1'));var zipdir=require(_0x5d80('0x2'));var jsonpatch=require(_0x5d80('0x3'));var rp=require(_0x5d80('0x4'));var moment=require('moment');var BPromise=require(_0x5d80('0x5'));var Mustache=require(_0x5d80('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5d80('0x7'));var ejs=require(_0x5d80('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d80('0x9'));var jsforce=require(_0x5d80('0xa'));var deskjs=require(_0x5d80('0xb'));var toCsv=require(_0x5d80('0x7'));var querystring=require(_0x5d80('0xc'));var Papa=require(_0x5d80('0xd'));var Redis=require(_0x5d80('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5d80('0xf'));var as=require(_0x5d80('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d80('0x11'))('api');var utils=require(_0x5d80('0x12'));var config=require(_0x5d80('0x13'));var db=require(_0x5d80('0x14'))['db'];function respondWithStatusCode(_0x434c04,_0x3c8aa4){_0x3c8aa4=_0x3c8aa4||0xcc;return function(_0xbe8a5){if(_0xbe8a5){return _0x434c04[_0x5d80('0x15')](_0x3c8aa4);}return _0x434c04[_0x5d80('0x16')](_0x3c8aa4)['end']();};}function respondWithResult(_0x1c5830,_0x214a2b){_0x214a2b=_0x214a2b||0xc8;return function(_0x56a819){if(_0x56a819){return _0x1c5830[_0x5d80('0x16')](_0x214a2b)[_0x5d80('0x17')](_0x56a819);}};}function respondWithFilteredResult(_0x153309,_0x1e3326){return function(_0x534104){if(_0x534104){var _0x4cc201=_0x534104[_0x5d80('0x18')],_0x25e72b=_0x1e3326['offset'],_0x5b80aa=_0x1e3326['offset']+_0x1e3326[_0x5d80('0x19')],_0x4d937c;if(_0x5b80aa>=_0x4cc201){_0x5b80aa=_0x4cc201;_0x4d937c=0xc8;}else{_0x4d937c=0xce;}_0x153309[_0x5d80('0x16')](_0x4d937c);return _0x153309[_0x5d80('0x1a')](_0x5d80('0x1b'),_0x25e72b+'-'+_0x5b80aa+'/'+_0x4cc201)['json'](_0x534104);}return null;};}function patchUpdates(_0x1f08ba){return function(_0x313b91){try{jsonpatch['apply'](_0x313b91,_0x1f08ba,!![]);}catch(_0x38e4e6){return BPromise[_0x5d80('0x1c')](_0x38e4e6);}return _0x313b91['save']();};}function saveUpdates(_0x5bd707,_0x5eeb9c){return function(_0x15bb9b){if(_0x15bb9b){return _0x15bb9b[_0x5d80('0x1d')](_0x5bd707)[_0x5d80('0x1e')](function(_0x4fd84c){return _0x4fd84c;});}return null;};}function removeEntity(_0x441dce,_0x562a93){return function(_0x43b9f1){if(_0x43b9f1){return _0x43b9f1[_0x5d80('0x1f')]()[_0x5d80('0x1e')](function(){var _0x2406f2=_0x43b9f1[_0x5d80('0x20')]({'plain':!![]});var _0x549f8a='CmContactHasPhones';return db[_0x5d80('0x21')][_0x5d80('0x1f')]({'where':{'type':_0x549f8a,'resourceId':_0x2406f2['id']}})[_0x5d80('0x1e')](function(){return _0x43b9f1;});})[_0x5d80('0x1e')](function(){_0x441dce[_0x5d80('0x16')](0xcc)[_0x5d80('0x22')]();});}};}function handleEntityNotFound(_0x807da0,_0x4ef048){return function(_0x56835a){if(!_0x56835a){_0x807da0[_0x5d80('0x15')](0x194);}return _0x56835a;};}function handleError(_0x1643ed,_0x8826a7){_0x8826a7=_0x8826a7||0x1f4;return function(_0xe08083){logger[_0x5d80('0x23')](_0xe08083[_0x5d80('0x24')]);if(_0xe08083[_0x5d80('0x25')]){delete _0xe08083[_0x5d80('0x25')];}_0x1643ed[_0x5d80('0x16')](_0x8826a7)[_0x5d80('0x26')](_0xe08083);};}exports[_0x5d80('0x27')]=function(_0x3bdf86,_0x1e0408){var _0x1f9c2c={},_0x5671a0={},_0x3961a4={'count':0x0,'rows':[]};var _0x4f82cd=_[_0x5d80('0x28')](db[_0x5d80('0x29')][_0x5d80('0x2a')],function(_0x24a346){return{'name':_0x24a346['fieldName'],'type':_0x24a346[_0x5d80('0x2b')][_0x5d80('0x2c')]};});_0x5671a0[_0x5d80('0x2d')]=_[_0x5d80('0x28')](_0x4f82cd,_0x5d80('0x25'));_0x5671a0[_0x5d80('0x2e')]=_[_0x5d80('0x2f')](_0x3bdf86[_0x5d80('0x2e')]);_0x5671a0[_0x5d80('0x30')]=_[_0x5d80('0x31')](_0x5671a0[_0x5d80('0x2d')],_0x5671a0[_0x5d80('0x2e')]);_0x1f9c2c[_0x5d80('0x32')]=_[_0x5d80('0x31')](_0x5671a0[_0x5d80('0x2d')],qs['fields'](_0x3bdf86[_0x5d80('0x2e')]['fields']));_0x1f9c2c['attributes']=_0x1f9c2c[_0x5d80('0x32')][_0x5d80('0x33')]?_0x1f9c2c[_0x5d80('0x32')]:_0x5671a0['model'];if(!_0x3bdf86[_0x5d80('0x2e')]['hasOwnProperty'](_0x5d80('0x34'))){_0x1f9c2c[_0x5d80('0x19')]=qs['limit'](_0x3bdf86['query'][_0x5d80('0x19')]);_0x1f9c2c[_0x5d80('0x35')]=qs[_0x5d80('0x35')](_0x3bdf86['query'][_0x5d80('0x35')]);}_0x1f9c2c[_0x5d80('0x36')]=qs[_0x5d80('0x37')](_0x3bdf86[_0x5d80('0x2e')]['sort']);_0x1f9c2c['where']=qs[_0x5d80('0x30')](_[_0x5d80('0x38')](_0x3bdf86[_0x5d80('0x2e')],_0x5671a0[_0x5d80('0x30')]),_0x4f82cd);if(_0x3bdf86[_0x5d80('0x2e')]['filter']){_0x1f9c2c[_0x5d80('0x39')]=_['merge'](_0x1f9c2c[_0x5d80('0x39')],{'$or':_['map'](_0x4f82cd,function(_0x305f5f){if(_0x305f5f[_0x5d80('0x2b')]!==_0x5d80('0x3a')){var _0x5ce53c={};_0x5ce53c[_0x305f5f[_0x5d80('0x25')]]={'$like':'%'+_0x3bdf86[_0x5d80('0x2e')][_0x5d80('0x3b')]+'%'};return _0x5ce53c;}})});}_0x1f9c2c=_[_0x5d80('0x3c')]({},_0x1f9c2c,_0x3bdf86[_0x5d80('0x3d')]);var _0x5a250f={'where':_0x1f9c2c[_0x5d80('0x39')]};return db[_0x5d80('0x29')][_0x5d80('0x18')](_0x5a250f)[_0x5d80('0x1e')](function(_0x270fa7){_0x3961a4['count']=_0x270fa7;if(_0x3bdf86[_0x5d80('0x2e')][_0x5d80('0x3e')]){_0x1f9c2c[_0x5d80('0x3f')]=[{'all':!![]}];}return db[_0x5d80('0x29')]['findAll'](_0x1f9c2c);})[_0x5d80('0x1e')](function(_0x14431a){_0x3961a4['rows']=_0x14431a;return _0x3961a4;})['then'](respondWithFilteredResult(_0x1e0408,_0x1f9c2c))[_0x5d80('0x40')](handleError(_0x1e0408,null));};exports[_0x5d80('0x41')]=function(_0x1e97d7,_0x26a4a2){var _0x3b997c={'raw':!![],'where':{'id':_0x1e97d7['params']['id']}},_0x56df02={};_0x56df02[_0x5d80('0x2d')]=_[_0x5d80('0x2f')](db[_0x5d80('0x29')][_0x5d80('0x2a')]);_0x56df02['query']=_[_0x5d80('0x2f')](_0x1e97d7[_0x5d80('0x2e')]);_0x56df02[_0x5d80('0x30')]=_[_0x5d80('0x31')](_0x56df02[_0x5d80('0x2d')],_0x56df02['query']);_0x3b997c[_0x5d80('0x32')]=_['intersection'](_0x56df02['model'],qs[_0x5d80('0x42')](_0x1e97d7[_0x5d80('0x2e')][_0x5d80('0x42')]));_0x3b997c[_0x5d80('0x32')]=_0x3b997c[_0x5d80('0x32')]['length']?_0x3b997c[_0x5d80('0x32')]:_0x56df02[_0x5d80('0x2d')];if(_0x1e97d7[_0x5d80('0x2e')][_0x5d80('0x3e')]){_0x3b997c[_0x5d80('0x3f')]=[{'all':!![]}];}_0x3b997c=_['merge']({},_0x3b997c,_0x1e97d7[_0x5d80('0x3d')]);return db[_0x5d80('0x29')]['find'](_0x3b997c)[_0x5d80('0x1e')](handleEntityNotFound(_0x26a4a2,null))[_0x5d80('0x1e')](respondWithResult(_0x26a4a2,null))['catch'](handleError(_0x26a4a2,null));};exports[_0x5d80('0x43')]=function(_0x1e796f,_0x88e010){return db[_0x5d80('0x29')][_0x5d80('0x43')](_0x1e796f[_0x5d80('0x44')],{})['then'](function(_0x3b6eee){var _0x5d2600=_0x1e796f[_0x5d80('0x45')][_0x5d80('0x20')]({'plain':!![]});if(!_0x5d2600)throw new Error(_0x5d80('0x46'));if(_0x5d2600[_0x5d80('0x47')]==='user'){var _0x4942fd=_0x3b6eee['get']({'plain':!![]});var _0x5a3287='CmContactHasPhones';return db[_0x5d80('0x48')][_0x5d80('0x49')]({'where':{'name':_0x5a3287,'userProfileId':_0x5d2600[_0x5d80('0x4a')]},'raw':!![]})[_0x5d80('0x1e')](function(_0x374d91){if(_0x374d91&&_0x374d91[_0x5d80('0x4b')]===0x0){return db[_0x5d80('0x21')][_0x5d80('0x43')]({'name':_0x4942fd['name'],'resourceId':_0x4942fd['id'],'type':_0x374d91['name'],'sectionId':_0x374d91['id']},{})[_0x5d80('0x1e')](function(){return _0x3b6eee;});}else{return _0x3b6eee;}})['catch'](function(_0x3e5130){logger['error'](_0x5d80('0x4c'),_0x3e5130);throw _0x3e5130;});}return _0x3b6eee;})[_0x5d80('0x1e')](respondWithResult(_0x88e010,0xc9))[_0x5d80('0x40')](handleError(_0x88e010,null));};exports['update']=function(_0x2ecd1d,_0x1c2d6a){if(_0x2ecd1d[_0x5d80('0x44')]['id']){delete _0x2ecd1d['body']['id'];}return db[_0x5d80('0x29')][_0x5d80('0x49')]({'where':{'id':_0x2ecd1d['params']['id']}})[_0x5d80('0x1e')](handleEntityNotFound(_0x1c2d6a,null))['then'](saveUpdates(_0x2ecd1d['body'],null))[_0x5d80('0x1e')](respondWithResult(_0x1c2d6a,null))[_0x5d80('0x40')](handleError(_0x1c2d6a,null));};exports[_0x5d80('0x1f')]=function(_0xc755f,_0x44a766){return db[_0x5d80('0x29')]['find']({'where':{'id':_0xc755f[_0x5d80('0x4d')]['id']}})[_0x5d80('0x1e')](handleEntityNotFound(_0x44a766,null))['then'](removeEntity(_0x44a766,null))[_0x5d80('0x40')](handleError(_0x44a766,null));}; \ No newline at end of file +var _0xe69f=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','name','index','map','CmContactHasPhone','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasPhones','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xe69f,0x129));var _0xfe69=function(_0x69a337,_0x88706a){_0x69a337=_0x69a337-0x0;var _0x3d9613=_0xe69f[_0x69a337];return _0x3d9613;};'use strict';var pdf=require(_0xfe69('0x0'));var emlformat=require(_0xfe69('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfe69('0x2'));var jsonpatch=require(_0xfe69('0x3'));var rp=require(_0xfe69('0x4'));var moment=require(_0xfe69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfe69('0x6'));var util=require('util');var path=require(_0xfe69('0x7'));var sox=require('sox');var csv=require(_0xfe69('0x8'));var ejs=require(_0xfe69('0x9'));var fs=require('fs');var _=require(_0xfe69('0xa'));var squel=require(_0xfe69('0xb'));var crypto=require('crypto');var jsforce=require(_0xfe69('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfe69('0x8'));var querystring=require(_0xfe69('0xd'));var Papa=require(_0xfe69('0xe'));var Redis=require(_0xfe69('0xf'));var authService=require(_0xfe69('0x10'));var qs=require(_0xfe69('0x11'));var as=require(_0xfe69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe69('0x13'))('api');var utils=require(_0xfe69('0x14'));var config=require(_0xfe69('0x15'));var db=require(_0xfe69('0x16'))['db'];function respondWithStatusCode(_0x3fb22a,_0x5e1120){_0x5e1120=_0x5e1120||0xcc;return function(_0x106c10){if(_0x106c10){return _0x3fb22a[_0xfe69('0x17')](_0x5e1120);}return _0x3fb22a[_0xfe69('0x18')](_0x5e1120)[_0xfe69('0x19')]();};}function respondWithResult(_0x3893b2,_0x1b4d02){_0x1b4d02=_0x1b4d02||0xc8;return function(_0x4d6e4d){if(_0x4d6e4d){return _0x3893b2[_0xfe69('0x18')](_0x1b4d02)[_0xfe69('0x1a')](_0x4d6e4d);}};}function respondWithFilteredResult(_0x154606,_0x7a2f93){return function(_0x29f22b){if(_0x29f22b){var _0x4d62cd=_0x29f22b[_0xfe69('0x1b')],_0x388fbc=_0x7a2f93[_0xfe69('0x1c')],_0x423d91=_0x7a2f93[_0xfe69('0x1c')]+_0x7a2f93[_0xfe69('0x1d')],_0x78cd8e;if(_0x423d91>=_0x4d62cd){_0x423d91=_0x4d62cd;_0x78cd8e=0xc8;}else{_0x78cd8e=0xce;}_0x154606['status'](_0x78cd8e);return _0x154606[_0xfe69('0x1e')](_0xfe69('0x1f'),_0x388fbc+'-'+_0x423d91+'/'+_0x4d62cd)[_0xfe69('0x1a')](_0x29f22b);}return null;};}function patchUpdates(_0x123051){return function(_0x4c1b9d){try{jsonpatch[_0xfe69('0x20')](_0x4c1b9d,_0x123051,!![]);}catch(_0x226ea){return BPromise[_0xfe69('0x21')](_0x226ea);}return _0x4c1b9d[_0xfe69('0x22')]();};}function saveUpdates(_0x291e5c,_0x19e85c){return function(_0x1350d9){if(_0x1350d9){return _0x1350d9[_0xfe69('0x23')](_0x291e5c)['then'](function(_0x3e0ffb){return _0x3e0ffb;});}return null;};}function removeEntity(_0x113b59,_0x433629){return function(_0x4fcead){if(_0x4fcead){return _0x4fcead[_0xfe69('0x24')]()['then'](function(){var _0x3d7205=_0x4fcead[_0xfe69('0x25')]({'plain':!![]});var _0x12eb39='CmContactHasPhones';return db[_0xfe69('0x26')]['destroy']({'where':{'type':_0x12eb39,'resourceId':_0x3d7205['id']}})[_0xfe69('0x27')](function(){return _0x4fcead;});})[_0xfe69('0x27')](function(){_0x113b59[_0xfe69('0x18')](0xcc)[_0xfe69('0x19')]();});}};}function handleEntityNotFound(_0x1e1fb5,_0x542fc0){return function(_0x4c324c){if(!_0x4c324c){_0x1e1fb5[_0xfe69('0x17')](0x194);}return _0x4c324c;};}function handleError(_0x404ccd,_0x140fed){_0x140fed=_0x140fed||0x1f4;return function(_0x1d2eb5){logger[_0xfe69('0x28')](_0x1d2eb5['stack']);if(_0x1d2eb5[_0xfe69('0x29')]){delete _0x1d2eb5[_0xfe69('0x29')];}_0x404ccd['status'](_0x140fed)['send'](_0x1d2eb5);};}exports[_0xfe69('0x2a')]=function(_0x1c7794,_0x227071){var _0x274cb6={},_0x2de739={},_0xafc146={'count':0x0,'rows':[]};var _0x1513da=_[_0xfe69('0x2b')](db[_0xfe69('0x2c')]['rawAttributes'],function(_0x17e572){return{'name':_0x17e572['fieldName'],'type':_0x17e572[_0xfe69('0x2d')][_0xfe69('0x2e')]};});_0x2de739['model']=_['map'](_0x1513da,_0xfe69('0x29'));_0x2de739[_0xfe69('0x2f')]=_[_0xfe69('0x30')](_0x1c7794[_0xfe69('0x2f')]);_0x2de739[_0xfe69('0x31')]=_[_0xfe69('0x32')](_0x2de739[_0xfe69('0x33')],_0x2de739[_0xfe69('0x2f')]);_0x274cb6[_0xfe69('0x34')]=_[_0xfe69('0x32')](_0x2de739[_0xfe69('0x33')],qs[_0xfe69('0x35')](_0x1c7794[_0xfe69('0x2f')]['fields']));_0x274cb6[_0xfe69('0x34')]=_0x274cb6[_0xfe69('0x34')][_0xfe69('0x36')]?_0x274cb6['attributes']:_0x2de739[_0xfe69('0x33')];if(!_0x1c7794[_0xfe69('0x2f')]['hasOwnProperty'](_0xfe69('0x37'))){_0x274cb6[_0xfe69('0x1d')]=qs[_0xfe69('0x1d')](_0x1c7794['query'][_0xfe69('0x1d')]);_0x274cb6[_0xfe69('0x1c')]=qs[_0xfe69('0x1c')](_0x1c7794[_0xfe69('0x2f')]['offset']);}_0x274cb6['order']=qs[_0xfe69('0x38')](_0x1c7794[_0xfe69('0x2f')][_0xfe69('0x38')]);_0x274cb6[_0xfe69('0x39')]=qs[_0xfe69('0x31')](_[_0xfe69('0x3a')](_0x1c7794[_0xfe69('0x2f')],_0x2de739[_0xfe69('0x31')]),_0x1513da);if(_0x1c7794[_0xfe69('0x2f')][_0xfe69('0x3b')]){_0x274cb6['where']=_[_0xfe69('0x3c')](_0x274cb6[_0xfe69('0x39')],{'$or':_[_0xfe69('0x2b')](_0x1513da,function(_0x40758d){if(_0x40758d[_0xfe69('0x2d')]!==_0xfe69('0x3d')){var _0x1c773f={};_0x1c773f[_0x40758d[_0xfe69('0x29')]]={'$like':'%'+_0x1c7794['query']['filter']+'%'};return _0x1c773f;}})});}_0x274cb6=_['merge']({},_0x274cb6,_0x1c7794[_0xfe69('0x3e')]);var _0x30694e={'where':_0x274cb6[_0xfe69('0x39')]};return db['CmContactHasPhone'][_0xfe69('0x1b')](_0x30694e)[_0xfe69('0x27')](function(_0x4f09d7){_0xafc146[_0xfe69('0x1b')]=_0x4f09d7;if(_0x1c7794[_0xfe69('0x2f')][_0xfe69('0x3f')]){_0x274cb6[_0xfe69('0x40')]=[{'all':!![]}];}return db[_0xfe69('0x2c')]['findAll'](_0x274cb6);})[_0xfe69('0x27')](function(_0x2cf149){_0xafc146[_0xfe69('0x41')]=_0x2cf149;return _0xafc146;})['then'](respondWithFilteredResult(_0x227071,_0x274cb6))['catch'](handleError(_0x227071,null));};exports[_0xfe69('0x42')]=function(_0x543aa9,_0x45a1e9){var _0x4a2e3e={'raw':!![],'where':{'id':_0x543aa9[_0xfe69('0x43')]['id']}},_0x516382={};_0x516382[_0xfe69('0x33')]=_['keys'](db[_0xfe69('0x2c')][_0xfe69('0x44')]);_0x516382[_0xfe69('0x2f')]=_[_0xfe69('0x30')](_0x543aa9['query']);_0x516382['filters']=_['intersection'](_0x516382[_0xfe69('0x33')],_0x516382[_0xfe69('0x2f')]);_0x4a2e3e[_0xfe69('0x34')]=_[_0xfe69('0x32')](_0x516382[_0xfe69('0x33')],qs['fields'](_0x543aa9[_0xfe69('0x2f')][_0xfe69('0x35')]));_0x4a2e3e[_0xfe69('0x34')]=_0x4a2e3e[_0xfe69('0x34')][_0xfe69('0x36')]?_0x4a2e3e[_0xfe69('0x34')]:_0x516382[_0xfe69('0x33')];if(_0x543aa9[_0xfe69('0x2f')][_0xfe69('0x3f')]){_0x4a2e3e[_0xfe69('0x40')]=[{'all':!![]}];}_0x4a2e3e=_['merge']({},_0x4a2e3e,_0x543aa9[_0xfe69('0x3e')]);return db['CmContactHasPhone']['find'](_0x4a2e3e)[_0xfe69('0x27')](handleEntityNotFound(_0x45a1e9,null))[_0xfe69('0x27')](respondWithResult(_0x45a1e9,null))[_0xfe69('0x45')](handleError(_0x45a1e9,null));};exports[_0xfe69('0x46')]=function(_0x3a3378,_0x31cff4){return db[_0xfe69('0x2c')][_0xfe69('0x46')](_0x3a3378['body'],{})[_0xfe69('0x27')](function(_0x20cb4b){var _0x1dfbec=_0x3a3378[_0xfe69('0x47')]['get']({'plain':!![]});if(!_0x1dfbec)throw new Error(_0xfe69('0x48'));if(_0x1dfbec['role']==='user'){var _0xcea3b9=_0x20cb4b['get']({'plain':!![]});var _0x1c24e1=_0xfe69('0x49');return db[_0xfe69('0x4a')][_0xfe69('0x4b')]({'where':{'name':_0x1c24e1,'userProfileId':_0x1dfbec[_0xfe69('0x4c')]},'raw':!![]})[_0xfe69('0x27')](function(_0x478050){if(_0x478050&&_0x478050[_0xfe69('0x4d')]===0x0){return db['UserProfileResource'][_0xfe69('0x46')]({'name':_0xcea3b9[_0xfe69('0x29')],'resourceId':_0xcea3b9['id'],'type':_0x478050['name'],'sectionId':_0x478050['id']},{})[_0xfe69('0x27')](function(){return _0x20cb4b;});}else{return _0x20cb4b;}})[_0xfe69('0x45')](function(_0x132aea){logger[_0xfe69('0x28')](_0xfe69('0x4e'),_0x132aea);throw _0x132aea;});}return _0x20cb4b;})[_0xfe69('0x27')](respondWithResult(_0x31cff4,0xc9))[_0xfe69('0x45')](handleError(_0x31cff4,null));};exports[_0xfe69('0x23')]=function(_0x514ac8,_0x14d9b6){if(_0x514ac8[_0xfe69('0x4f')]['id']){delete _0x514ac8[_0xfe69('0x4f')]['id'];}return db['CmContactHasPhone'][_0xfe69('0x4b')]({'where':{'id':_0x514ac8[_0xfe69('0x43')]['id']}})[_0xfe69('0x27')](handleEntityNotFound(_0x14d9b6,null))[_0xfe69('0x27')](saveUpdates(_0x514ac8[_0xfe69('0x4f')],null))[_0xfe69('0x27')](respondWithResult(_0x14d9b6,null))[_0xfe69('0x45')](handleError(_0x14d9b6,null));};exports[_0xfe69('0x24')]=function(_0x4200ce,_0x4eb5d8){return db['CmContactHasPhone'][_0xfe69('0x4b')]({'where':{'id':_0x4200ce[_0xfe69('0x43')]['id']}})[_0xfe69('0x27')](handleEntityNotFound(_0x4eb5d8,null))['then'](removeEntity(_0x4eb5d8,null))[_0xfe69('0x45')](handleError(_0x4eb5d8,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 0a8f0d6..86fae35 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 _0x23f5=['path','./cmContactHasPhone.attributes','define','CmContactHasPhone','cm_contact_has_phones','lodash','../../config/logger','moment','bluebird'];(function(_0x130247,_0x115039){var _0x14adba=function(_0x405a1d){while(--_0x405a1d){_0x130247['push'](_0x130247['shift']());}};_0x14adba(++_0x115039);}(_0x23f5,0x95));var _0x523f=function(_0x396910,_0x397bda){_0x396910=_0x396910-0x0;var _0x217d81=_0x23f5[_0x396910];return _0x217d81;};'use strict';var _=require(_0x523f('0x0'));var util=require('util');var logger=require(_0x523f('0x1'))('api');var moment=require(_0x523f('0x2'));var BPromise=require(_0x523f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x523f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x523f('0x5'));module['exports']=function(_0x5c21a1,_0x5b10e7){return _0x5c21a1[_0x523f('0x6')](_0x523f('0x7'),attributes,{'tableName':_0x523f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20a2=['rimraf','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','lodash','api','moment','bluebird','request-promise','path'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x20a2,0x102));var _0x220a=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x20a2[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x220a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x220a('0x1'));var moment=require(_0x220a('0x2'));var BPromise=require(_0x220a('0x3'));var rp=require(_0x220a('0x4'));var fs=require('fs');var path=require(_0x220a('0x5'));var rimraf=require(_0x220a('0x6'));var config=require('../../config/environment');var attributes=require(_0x220a('0x7'));module[_0x220a('0x8')]=function(_0x1ccdf4,_0x1a69f8){return _0x1ccdf4[_0x220a('0x9')](_0x220a('0xa'),attributes,{'tableName':'cm_contact_has_phones','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 235e0c6..2345bd5 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 _0x09db=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x15de11,_0x3cd20d){var _0x4f1c07=function(_0xf74624){while(--_0xf74624){_0x15de11['push'](_0x15de11['shift']());}};_0x4f1c07(++_0x3cd20d);}(_0x09db,0x6c));var _0xb09d=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x09db[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xb09d('0x0'));var util=require(_0xb09d('0x1'));var moment=require(_0xb09d('0x2'));var BPromise=require(_0xb09d('0x3'));var rs=require(_0xb09d('0x4'));var fs=require('fs');var Redis=require(_0xb09d('0x5'));var db=require(_0xb09d('0x6'))['db'];var utils=require(_0xb09d('0x7'));var logger=require(_0xb09d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb09d('0x9'));var client=jayson[_0xb09d('0xa')][_0xb09d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ad766,_0x3d955d,_0x206dd8){return new BPromise(function(_0x1ec973,_0x230a88){return client[_0xb09d('0xc')](_0x4ad766,_0x206dd8)[_0xb09d('0xd')](function(_0x486fbc){logger[_0xb09d('0xe')](_0xb09d('0xf'),_0x3d955d,_0xb09d('0x10'));logger[_0xb09d('0x11')](_0xb09d('0x12'),_0x3d955d,_0xb09d('0x10'),JSON[_0xb09d('0x13')](_0x486fbc));if(_0x486fbc[_0xb09d('0x14')]){if(_0x486fbc[_0xb09d('0x14')][_0xb09d('0x15')]===0x1f4){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x3d955d,_0x486fbc[_0xb09d('0x14')]['message']);return _0x230a88(_0x486fbc[_0xb09d('0x14')][_0xb09d('0x16')]);}logger[_0xb09d('0x14')](_0xb09d('0xf'),_0x3d955d,_0x486fbc[_0xb09d('0x14')][_0xb09d('0x16')]);return _0x1ec973(_0x486fbc[_0xb09d('0x14')][_0xb09d('0x16')]);}else{logger['info'](_0xb09d('0xf'),_0x3d955d,_0xb09d('0x10'));_0x1ec973(_0x486fbc['result'][_0xb09d('0x16')]);}})['catch'](function(_0x4c1923){logger[_0xb09d('0x14')]('CmContactHasPhone,\x20%s,\x20%s',_0x3d955d,_0x4c1923);_0x230a88(_0x4c1923);});});} \ No newline at end of file +var _0x7a0b=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x7a0b,0x85));var _0xb7a0=function(_0xe7ba73,_0x1a1dd3){_0xe7ba73=_0xe7ba73-0x0;var _0x9bfee0=_0x7a0b[_0xe7ba73];return _0x9bfee0;};'use strict';var _=require(_0xb7a0('0x0'));var util=require(_0xb7a0('0x1'));var moment=require(_0xb7a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7a0('0x3'));var fs=require('fs');var Redis=require(_0xb7a0('0x4'));var db=require(_0xb7a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a0('0x6'))(_0xb7a0('0x7'));var config=require(_0xb7a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb7a0('0x9')][_0xb7a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39176b,_0x2e7f81,_0x4e0a5f){return new BPromise(function(_0x4c128a,_0x226de4){return client[_0xb7a0('0xb')](_0x39176b,_0x4e0a5f)['then'](function(_0x3f78ec){logger[_0xb7a0('0xc')](_0xb7a0('0xd'),_0x2e7f81,_0xb7a0('0xe'));logger[_0xb7a0('0xf')](_0xb7a0('0x10'),_0x2e7f81,_0xb7a0('0xe'),JSON['stringify'](_0x3f78ec));if(_0x3f78ec[_0xb7a0('0x11')]){if(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x12')]===0x1f4){logger[_0xb7a0('0x11')](_0xb7a0('0xd'),_0x2e7f81,_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);return _0x226de4(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);}logger[_0xb7a0('0x11')](_0xb7a0('0xd'),_0x2e7f81,_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);return _0x4c128a(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);}else{logger[_0xb7a0('0xc')](_0xb7a0('0xd'),_0x2e7f81,'request\x20sent');_0x4c128a(_0x3f78ec[_0xb7a0('0x14')][_0xb7a0('0x13')]);}})[_0xb7a0('0x15')](function(_0x3494dd){logger['error'](_0xb7a0('0xd'),_0x2e7f81,_0x3494dd);_0x226de4(_0x3494dd);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 787d0af..3570aca 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 _0xae4f=['../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','post','create','put','delete','multer','util','path','Router'];(function(_0x492e60,_0x4c4be3){var _0x22cbfb=function(_0x1e596b){while(--_0x1e596b){_0x492e60['push'](_0x492e60['shift']());}};_0x22cbfb(++_0x4c4be3);}(_0xae4f,0x1af));var _0xfae4=function(_0x3fdba2,_0x430bf2){_0x3fdba2=_0x3fdba2-0x0;var _0x16ec4d=_0xae4f[_0x3fdba2];return _0x16ec4d;};'use strict';var multer=require(_0xfae4('0x0'));var util=require(_0xfae4('0x1'));var path=require(_0xfae4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfae4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfae4('0x4'));var config=require(_0xfae4('0x5'));var controller=require(_0xfae4('0x6'));router[_0xfae4('0x7')]('/',auth[_0xfae4('0x8')](),controller[_0xfae4('0x9')]);router[_0xfae4('0x7')](_0xfae4('0xa'),auth[_0xfae4('0x8')](),controller['show']);router[_0xfae4('0xb')]('/',auth[_0xfae4('0x8')](),controller[_0xfae4('0xc')]);router[_0xfae4('0xd')](_0xfae4('0xa'),auth[_0xfae4('0x8')](),controller['update']);router[_0xfae4('0xe')]('/:id',auth[_0xfae4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7281=['show','post','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x5b682f,_0x3befac){var _0x47f01b=function(_0xe2c7be){while(--_0xe2c7be){_0x5b682f['push'](_0x5b682f['shift']());}};_0x47f01b(++_0x3befac);}(_0x7281,0x18c));var _0x1728=function(_0x1ee24c,_0x18ccfe){_0x1ee24c=_0x1ee24c-0x0;var _0x2e5c77=_0x7281[_0x1ee24c];return _0x2e5c77;};'use strict';var multer=require(_0x1728('0x0'));var util=require(_0x1728('0x1'));var path=require(_0x1728('0x2'));var timeout=require('connect-timeout');var express=require(_0x1728('0x3'));var router=express['Router']();var auth=require(_0x1728('0x4'));var interaction=require(_0x1728('0x5'));var config=require(_0x1728('0x6'));var controller=require(_0x1728('0x7'));router[_0x1728('0x8')]('/',auth[_0x1728('0x9')](),controller[_0x1728('0xa')]);router[_0x1728('0x8')](_0x1728('0xb'),auth[_0x1728('0x9')](),controller[_0x1728('0xc')]);router[_0x1728('0xd')]('/',auth[_0x1728('0x9')](),controller['create']);router['put'](_0x1728('0xb'),auth[_0x1728('0x9')](),controller[_0x1728('0xe')]);router['delete'](_0x1728('0xb'),auth[_0x1728('0x9')](),controller[_0x1728('0xf')]);module[_0x1728('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 47c2e55..ba2558c 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 _0xd18a=['STRING','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xd18a,0x13a));var _0xad18=function(_0x294c4b,_0x44fa5a){_0x294c4b=_0x294c4b-0x0;var _0x463096=_0xd18a[_0x294c4b];return _0x463096;};'use strict';var Sequelize=require(_0xad18('0x0'));var _=require(_0xad18('0x1'));module[_0xad18('0x2')]={'name':{'type':Sequelize[_0xad18('0x3')],'get':function(_0x2b13d6){return this[_0xad18('0x4')](_0xad18('0x5'));}},'alias':{'type':Sequelize[_0xad18('0x6')],'allowNull':![],'set':function(_0x507ba9){this['setDataValue'](_0xad18('0x5'),_0x507ba9?_0x507ba9:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xad18('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xad18('0x7')),'get':function(){if(this[_0xad18('0x4')](_0xad18('0x8'))===_0xad18('0x9')){return JSON[_0xad18('0xa')](this[_0xad18('0x4')](_0xad18('0xb')));}else{return this[_0xad18('0x4')]('values');}},'set':function(_0x4ce884){if(Array[_0xad18('0xc')](_0x4ce884)){this[_0xad18('0xd')](_0xad18('0xb'),JSON[_0xad18('0xe')](_0x4ce884));}else{this[_0xad18('0xd')]('values',_0x4ce884);}}},'required':{'type':Sequelize[_0xad18('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xd496=['stringify','sequelize','lodash','VIRTUAL','STRING','setDataValue','alias','getDataValue','TEXT','type','select','parse','values','isArray'];(function(_0x40804c,_0x19c449){var _0x5bf269=function(_0x525eeb){while(--_0x525eeb){_0x40804c['push'](_0x40804c['shift']());}};_0x5bf269(++_0x19c449);}(_0xd496,0xfd));var _0x6d49=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xd496[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x6d49('0x0'));var _=require(_0x6d49('0x1'));module['exports']={'name':{'type':Sequelize[_0x6d49('0x2')],'get':function(_0x4cc2ad){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x6d49('0x3')],'allowNull':![],'set':function(_0x2ac943){this[_0x6d49('0x4')](_0x6d49('0x5'),_0x2ac943?_0x2ac943:this[_0x6d49('0x6')]('name'));}},'type':{'type':Sequelize[_0x6d49('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x6d49('0x7')]('long'),'get':function(){if(this[_0x6d49('0x6')](_0x6d49('0x8'))===_0x6d49('0x9')){return JSON[_0x6d49('0xa')](this[_0x6d49('0x6')](_0x6d49('0xb')));}else{return this['getDataValue'](_0x6d49('0xb'));}},'set':function(_0x58f29c){if(Array[_0x6d49('0xc')](_0x58f29c)){this[_0x6d49('0x4')](_0x6d49('0xb'),JSON[_0x6d49('0xd')](_0x58f29c));}else{this[_0x6d49('0x4')](_0x6d49('0xb'),_0x58f29c);}}},'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 89e4448..482c4b8 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 _0x4af9=['intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','filter','options','includeAll','findAll','rows','catch','show','length','include','find','body','params','create','Sequelize','TEXT','text','number','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters'];(function(_0x42b3fd,_0x4adca9){var _0x12f2b4=function(_0x417bb5){while(--_0x417bb5){_0x42b3fd['push'](_0x42b3fd['shift']());}};_0x12f2b4(++_0x4adca9);}(_0x4af9,0x1c7));var _0x94af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4af9[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x94af('0x0'));var emlformat=require(_0x94af('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x94af('0x2'));var rp=require(_0x94af('0x3'));var moment=require('moment');var BPromise=require(_0x94af('0x4'));var Mustache=require(_0x94af('0x5'));var util=require(_0x94af('0x6'));var path=require('path');var sox=require(_0x94af('0x7'));var csv=require(_0x94af('0x8'));var ejs=require(_0x94af('0x9'));var fs=require('fs');var _=require(_0x94af('0xa'));var squel=require('squel');var crypto=require(_0x94af('0xb'));var jsforce=require(_0x94af('0xc'));var deskjs=require(_0x94af('0xd'));var toCsv=require(_0x94af('0x8'));var querystring=require('querystring');var Papa=require(_0x94af('0xe'));var Redis=require('ioredis');var authService=require(_0x94af('0xf'));var qs=require(_0x94af('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94af('0x11'))(_0x94af('0x12'));var utils=require(_0x94af('0x13'));var config=require('../../config/environment');var db=require(_0x94af('0x14'))['db'];function respondWithStatusCode(_0x35fbf6,_0x3568d0){_0x3568d0=_0x3568d0||0xcc;return function(_0x574af5){if(_0x574af5){return _0x35fbf6[_0x94af('0x15')](_0x3568d0);}return _0x35fbf6[_0x94af('0x16')](_0x3568d0)[_0x94af('0x17')]();};}function respondWithResult(_0x2ebcfe,_0x287b7d){_0x287b7d=_0x287b7d||0xc8;return function(_0x50b114){if(_0x50b114){return _0x2ebcfe['status'](_0x287b7d)[_0x94af('0x18')](_0x50b114);}};}function respondWithFilteredResult(_0x3943f1,_0x50aed9){return function(_0xc4dcd7){if(_0xc4dcd7){var _0x483c40=_0xc4dcd7[_0x94af('0x19')],_0x26874d=_0x50aed9[_0x94af('0x1a')],_0x1aa796=_0x50aed9[_0x94af('0x1a')]+_0x50aed9[_0x94af('0x1b')],_0x1fbea0;if(_0x1aa796>=_0x483c40){_0x1aa796=_0x483c40;_0x1fbea0=0xc8;}else{_0x1fbea0=0xce;}_0x3943f1[_0x94af('0x16')](_0x1fbea0);return _0x3943f1[_0x94af('0x1c')](_0x94af('0x1d'),_0x26874d+'-'+_0x1aa796+'/'+_0x483c40)[_0x94af('0x18')](_0xc4dcd7);}return null;};}function patchUpdates(_0x2bd491){return function(_0x1f172f){try{jsonpatch[_0x94af('0x1e')](_0x1f172f,_0x2bd491,!![]);}catch(_0x4d4697){return BPromise[_0x94af('0x1f')](_0x4d4697);}return _0x1f172f[_0x94af('0x20')]();};}function saveUpdates(_0x2ad4fd,_0x451f83){return function(_0x3fb549){if(_0x3fb549){return _0x3fb549[_0x94af('0x21')](_0x2ad4fd)[_0x94af('0x22')](function(_0x2f2851){return _0x2f2851;});}return null;};}function removeEntity(_0x575b82,_0x508702){return function(_0x153a87){if(_0x153a87){return _0x153a87[_0x94af('0x23')]()[_0x94af('0x22')](function(){_0x575b82['status'](0xcc)[_0x94af('0x17')]();});}};}function handleEntityNotFound(_0x24b695,_0x1cda1d){return function(_0x56800f){if(!_0x56800f){_0x24b695[_0x94af('0x15')](0x194);}return _0x56800f;};}function handleError(_0x111e18,_0x98e313){_0x98e313=_0x98e313||0x1f4;return function(_0x4eff14){logger['error'](_0x4eff14[_0x94af('0x24')]);if(_0x4eff14[_0x94af('0x25')]){delete _0x4eff14[_0x94af('0x25')];}_0x111e18[_0x94af('0x16')](_0x98e313)[_0x94af('0x26')](_0x4eff14);};}exports[_0x94af('0x27')]=function(_0x3850fb,_0x529935){var _0x225071={},_0x254538={},_0x321baa={'count':0x0,'rows':[]};var _0x5452ad=_['map'](db[_0x94af('0x28')][_0x94af('0x29')],function(_0x26ad09){return{'name':_0x26ad09[_0x94af('0x2a')],'type':_0x26ad09[_0x94af('0x2b')]['key']};});_0x254538[_0x94af('0x2c')]=_[_0x94af('0x2d')](_['map'](_0x5452ad,_0x94af('0x25')),[_0x94af('0x25')]);_0x254538[_0x94af('0x2e')]=_[_0x94af('0x2f')](_0x3850fb[_0x94af('0x2e')]);_0x254538[_0x94af('0x30')]=_[_0x94af('0x31')](_0x254538[_0x94af('0x2c')],_0x254538[_0x94af('0x2e')]);_0x225071[_0x94af('0x32')]=_['intersection'](_0x254538[_0x94af('0x2c')],qs[_0x94af('0x33')](_0x3850fb[_0x94af('0x2e')][_0x94af('0x33')]));_0x225071[_0x94af('0x32')]=_0x225071['attributes']['length']?_0x225071[_0x94af('0x32')]:_0x254538['model'];if(!_0x3850fb[_0x94af('0x2e')][_0x94af('0x34')]('nolimit')){_0x225071['limit']=qs[_0x94af('0x1b')](_0x3850fb[_0x94af('0x2e')][_0x94af('0x1b')]);_0x225071['offset']=qs[_0x94af('0x1a')](_0x3850fb[_0x94af('0x2e')][_0x94af('0x1a')]);}_0x225071[_0x94af('0x35')]=qs[_0x94af('0x36')](_0x3850fb[_0x94af('0x2e')]['sort']);_0x225071[_0x94af('0x37')]=qs[_0x94af('0x30')](_[_0x94af('0x38')](_0x3850fb[_0x94af('0x2e')],_0x254538[_0x94af('0x30')]),_0x5452ad);if(_0x3850fb['query']['filter']){_0x225071[_0x94af('0x37')]=_[_0x94af('0x39')](_0x225071[_0x94af('0x37')],{'$or':_[_0x94af('0x3a')](_0x5452ad,function(_0x38b7ec){if(_0x38b7ec[_0x94af('0x2b')]!=='VIRTUAL'){var _0x54e62b={};_0x54e62b[_0x38b7ec[_0x94af('0x25')]]={'$like':'%'+_0x3850fb[_0x94af('0x2e')][_0x94af('0x3b')]+'%'};return _0x54e62b;}})});}_0x225071=_[_0x94af('0x39')]({},_0x225071,_0x3850fb[_0x94af('0x3c')]);var _0x581e56={'where':_0x225071['where']};return db[_0x94af('0x28')][_0x94af('0x19')](_0x581e56)[_0x94af('0x22')](function(_0x26dc08){_0x321baa[_0x94af('0x19')]=_0x26dc08;if(_0x3850fb[_0x94af('0x2e')][_0x94af('0x3d')]){_0x225071['include']=[{'all':!![]}];}return db['CmCustomField'][_0x94af('0x3e')](_0x225071);})[_0x94af('0x22')](function(_0x23055d){_0x321baa[_0x94af('0x3f')]=_0x23055d;return _0x321baa;})[_0x94af('0x22')](respondWithFilteredResult(_0x529935,_0x225071))[_0x94af('0x40')](handleError(_0x529935,null));};exports[_0x94af('0x41')]=function(_0x4426fc,_0x9104d0){var _0x359c85={'raw':!![],'where':{'id':_0x4426fc['params']['id']}},_0x33bdb8={};_0x33bdb8[_0x94af('0x2c')]=_['keys'](db[_0x94af('0x28')]['rawAttributes']);_0x33bdb8['query']=_[_0x94af('0x2f')](_0x4426fc[_0x94af('0x2e')]);_0x33bdb8[_0x94af('0x30')]=_[_0x94af('0x31')](_0x33bdb8['model'],_0x33bdb8['query']);_0x359c85[_0x94af('0x32')]=_[_0x94af('0x31')](_0x33bdb8[_0x94af('0x2c')],qs[_0x94af('0x33')](_0x4426fc[_0x94af('0x2e')][_0x94af('0x33')]));_0x359c85[_0x94af('0x32')]=_0x359c85[_0x94af('0x32')][_0x94af('0x42')]?_0x359c85[_0x94af('0x32')]:_0x33bdb8[_0x94af('0x2c')];if(_0x4426fc[_0x94af('0x2e')][_0x94af('0x3d')]){_0x359c85[_0x94af('0x43')]=[{'all':!![]}];}_0x359c85=_[_0x94af('0x39')]({},_0x359c85,_0x4426fc[_0x94af('0x3c')]);return db[_0x94af('0x28')][_0x94af('0x44')](_0x359c85)[_0x94af('0x22')](handleEntityNotFound(_0x9104d0,null))[_0x94af('0x22')](respondWithResult(_0x9104d0,null))[_0x94af('0x40')](handleError(_0x9104d0,null));};exports[_0x94af('0x21')]=function(_0x5227fc,_0x54b638){if(_0x5227fc[_0x94af('0x45')]['id']){delete _0x5227fc['body']['id'];}return db[_0x94af('0x28')][_0x94af('0x44')]({'where':{'id':_0x5227fc[_0x94af('0x46')]['id']}})[_0x94af('0x22')](handleEntityNotFound(_0x54b638,null))[_0x94af('0x22')](saveUpdates(_0x5227fc['body'],null))[_0x94af('0x22')](respondWithResult(_0x54b638,null))[_0x94af('0x40')](handleError(_0x54b638,null));};exports[_0x94af('0x23')]=function(_0x4d94c3,_0x3db1e6){return db[_0x94af('0x28')]['find']({'where':{'id':_0x4d94c3[_0x94af('0x46')]['id']}})[_0x94af('0x22')](handleEntityNotFound(_0x3db1e6,null))['then'](removeEntity(_0x3db1e6,null))[_0x94af('0x40')](handleError(_0x3db1e6,null));};exports[_0x94af('0x47')]=function(_0x5f27f5,_0x58545e){var _0x50b93a;return db['sequelize']['transaction'](function(_0x4eeb08){return db[_0x94af('0x28')][_0x94af('0x47')](_0x5f27f5['body'],{'transaction':_0x4eeb08})['then'](function(_0x2d7722){_0x50b93a=_0x2d7722;var _0x10e31a={'type':db[_0x94af('0x48')][_0x94af('0x49')],'transaction':_0x4eeb08};switch(_0x5f27f5[_0x94af('0x45')][_0x94af('0x2b')]){case _0x94af('0x4a'):_0x10e31a[_0x94af('0x2b')]=db[_0x94af('0x48')]['TEXT'];break;case _0x94af('0x4b'):_0x10e31a[_0x94af('0x2b')]=db[_0x94af('0x48')]['INTEGER'];break;case _0x94af('0x4c'):_0x10e31a['type']=db[_0x94af('0x48')]['BOOLEAN'];_0x10e31a[_0x94af('0x4d')]=![];break;default:}return db[_0x94af('0x4e')][_0x94af('0x4f')][_0x94af('0x50')](_0x94af('0x51'),util[_0x94af('0x52')](_0x94af('0x53'),_0x50b93a['id']),_0x10e31a);})[_0x94af('0x22')](function(){return _0x50b93a;});})[_0x94af('0x22')](respondWithResult(_0x58545e,0xc9))['catch'](handleError(_0x58545e,null));}; \ No newline at end of file +var _0x397f=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','CmCustomField','type','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','body','find','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','desk.js'];(function(_0x58f83c,_0x563967){var _0x5d2f70=function(_0x22d679){while(--_0x22d679){_0x58f83c['push'](_0x58f83c['shift']());}};_0x5d2f70(++_0x563967);}(_0x397f,0x12d));var _0xf397=function(_0x1256c6,_0x33ff05){_0x1256c6=_0x1256c6-0x0;var _0x56b6cc=_0x397f[_0x1256c6];return _0x56b6cc;};'use strict';var pdf=require(_0xf397('0x0'));var emlformat=require(_0xf397('0x1'));var rimraf=require(_0xf397('0x2'));var zipdir=require(_0xf397('0x3'));var jsonpatch=require(_0xf397('0x4'));var rp=require(_0xf397('0x5'));var moment=require(_0xf397('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf397('0x7'));var util=require(_0xf397('0x8'));var path=require(_0xf397('0x9'));var sox=require('sox');var csv=require(_0xf397('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf397('0xb'));var squel=require(_0xf397('0xc'));var crypto=require(_0xf397('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf397('0xe'));var toCsv=require(_0xf397('0xa'));var querystring=require(_0xf397('0xf'));var Papa=require(_0xf397('0x10'));var Redis=require('ioredis');var authService=require(_0xf397('0x11'));var qs=require(_0xf397('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf397('0x13'));var logger=require(_0xf397('0x14'))('api');var utils=require(_0xf397('0x15'));var config=require('../../config/environment');var db=require(_0xf397('0x16'))['db'];function respondWithStatusCode(_0x4cc22e,_0x522c96){_0x522c96=_0x522c96||0xcc;return function(_0x3f1bf0){if(_0x3f1bf0){return _0x4cc22e[_0xf397('0x17')](_0x522c96);}return _0x4cc22e['status'](_0x522c96)[_0xf397('0x18')]();};}function respondWithResult(_0x17f17d,_0x170892){_0x170892=_0x170892||0xc8;return function(_0x4b56b7){if(_0x4b56b7){return _0x17f17d[_0xf397('0x19')](_0x170892)[_0xf397('0x1a')](_0x4b56b7);}};}function respondWithFilteredResult(_0x274466,_0x46d35f){return function(_0x2e4c9f){if(_0x2e4c9f){var _0x37fabc=_0x2e4c9f[_0xf397('0x1b')],_0x91f1b4=_0x46d35f[_0xf397('0x1c')],_0x2ce622=_0x46d35f[_0xf397('0x1c')]+_0x46d35f[_0xf397('0x1d')],_0x4c8d83;if(_0x2ce622>=_0x37fabc){_0x2ce622=_0x37fabc;_0x4c8d83=0xc8;}else{_0x4c8d83=0xce;}_0x274466[_0xf397('0x19')](_0x4c8d83);return _0x274466[_0xf397('0x1e')]('Content-Range',_0x91f1b4+'-'+_0x2ce622+'/'+_0x37fabc)['json'](_0x2e4c9f);}return null;};}function patchUpdates(_0x4dfd52){return function(_0x488253){try{jsonpatch[_0xf397('0x1f')](_0x488253,_0x4dfd52,!![]);}catch(_0x2d53b0){return BPromise[_0xf397('0x20')](_0x2d53b0);}return _0x488253[_0xf397('0x21')]();};}function saveUpdates(_0x99834d,_0x31f233){return function(_0x66a84d){if(_0x66a84d){return _0x66a84d[_0xf397('0x22')](_0x99834d)[_0xf397('0x23')](function(_0x189732){return _0x189732;});}return null;};}function removeEntity(_0x20f605,_0x338061){return function(_0x3edeb6){if(_0x3edeb6){return _0x3edeb6[_0xf397('0x24')]()[_0xf397('0x23')](function(){_0x20f605[_0xf397('0x19')](0xcc)[_0xf397('0x18')]();});}};}function handleEntityNotFound(_0x4b047c,_0x597d93){return function(_0x2765e0){if(!_0x2765e0){_0x4b047c[_0xf397('0x17')](0x194);}return _0x2765e0;};}function handleError(_0x1f9ac1,_0x289fb6){_0x289fb6=_0x289fb6||0x1f4;return function(_0x4250f1){logger[_0xf397('0x25')](_0x4250f1['stack']);if(_0x4250f1[_0xf397('0x26')]){delete _0x4250f1[_0xf397('0x26')];}_0x1f9ac1['status'](_0x289fb6)['send'](_0x4250f1);};}exports[_0xf397('0x27')]=function(_0x1ebd53,_0x39d0d5){var _0x2bd80b={},_0x2e3c8e={},_0x15e908={'count':0x0,'rows':[]};var _0x2644ea=_[_0xf397('0x28')](db[_0xf397('0x29')]['rawAttributes'],function(_0x25d297){return{'name':_0x25d297['fieldName'],'type':_0x25d297[_0xf397('0x2a')]['key']};});_0x2e3c8e[_0xf397('0x2b')]=_[_0xf397('0x2c')](_[_0xf397('0x28')](_0x2644ea,_0xf397('0x26')),[_0xf397('0x26')]);_0x2e3c8e[_0xf397('0x2d')]=_['keys'](_0x1ebd53['query']);_0x2e3c8e[_0xf397('0x2e')]=_[_0xf397('0x2f')](_0x2e3c8e[_0xf397('0x2b')],_0x2e3c8e[_0xf397('0x2d')]);_0x2bd80b[_0xf397('0x30')]=_[_0xf397('0x2f')](_0x2e3c8e[_0xf397('0x2b')],qs[_0xf397('0x31')](_0x1ebd53['query'][_0xf397('0x31')]));_0x2bd80b[_0xf397('0x30')]=_0x2bd80b[_0xf397('0x30')][_0xf397('0x32')]?_0x2bd80b[_0xf397('0x30')]:_0x2e3c8e[_0xf397('0x2b')];if(!_0x1ebd53['query']['hasOwnProperty'](_0xf397('0x33'))){_0x2bd80b['limit']=qs[_0xf397('0x1d')](_0x1ebd53[_0xf397('0x2d')][_0xf397('0x1d')]);_0x2bd80b['offset']=qs[_0xf397('0x1c')](_0x1ebd53[_0xf397('0x2d')][_0xf397('0x1c')]);}_0x2bd80b[_0xf397('0x34')]=qs[_0xf397('0x35')](_0x1ebd53['query'][_0xf397('0x35')]);_0x2bd80b[_0xf397('0x36')]=qs[_0xf397('0x2e')](_[_0xf397('0x37')](_0x1ebd53[_0xf397('0x2d')],_0x2e3c8e[_0xf397('0x2e')]),_0x2644ea);if(_0x1ebd53['query'][_0xf397('0x38')]){_0x2bd80b['where']=_['merge'](_0x2bd80b[_0xf397('0x36')],{'$or':_['map'](_0x2644ea,function(_0x35fd2a){if(_0x35fd2a[_0xf397('0x2a')]!==_0xf397('0x39')){var _0x26ca6c={};_0x26ca6c[_0x35fd2a[_0xf397('0x26')]]={'$like':'%'+_0x1ebd53['query'][_0xf397('0x38')]+'%'};return _0x26ca6c;}})});}_0x2bd80b=_[_0xf397('0x3a')]({},_0x2bd80b,_0x1ebd53[_0xf397('0x3b')]);var _0x4427ca={'where':_0x2bd80b[_0xf397('0x36')]};return db[_0xf397('0x29')][_0xf397('0x1b')](_0x4427ca)['then'](function(_0x4bc657){_0x15e908[_0xf397('0x1b')]=_0x4bc657;if(_0x1ebd53[_0xf397('0x2d')][_0xf397('0x3c')]){_0x2bd80b['include']=[{'all':!![]}];}return db[_0xf397('0x29')][_0xf397('0x3d')](_0x2bd80b);})[_0xf397('0x23')](function(_0x524afb){_0x15e908['rows']=_0x524afb;return _0x15e908;})[_0xf397('0x23')](respondWithFilteredResult(_0x39d0d5,_0x2bd80b))[_0xf397('0x3e')](handleError(_0x39d0d5,null));};exports[_0xf397('0x3f')]=function(_0x305b13,_0x418fc8){var _0x2e1b48={'raw':!![],'where':{'id':_0x305b13[_0xf397('0x40')]['id']}},_0x4a19a5={};_0x4a19a5['model']=_[_0xf397('0x41')](db[_0xf397('0x29')]['rawAttributes']);_0x4a19a5[_0xf397('0x2d')]=_['keys'](_0x305b13[_0xf397('0x2d')]);_0x4a19a5['filters']=_[_0xf397('0x2f')](_0x4a19a5[_0xf397('0x2b')],_0x4a19a5[_0xf397('0x2d')]);_0x2e1b48['attributes']=_[_0xf397('0x2f')](_0x4a19a5[_0xf397('0x2b')],qs[_0xf397('0x31')](_0x305b13[_0xf397('0x2d')][_0xf397('0x31')]));_0x2e1b48[_0xf397('0x30')]=_0x2e1b48[_0xf397('0x30')]['length']?_0x2e1b48[_0xf397('0x30')]:_0x4a19a5[_0xf397('0x2b')];if(_0x305b13['query']['includeAll']){_0x2e1b48['include']=[{'all':!![]}];}_0x2e1b48=_[_0xf397('0x3a')]({},_0x2e1b48,_0x305b13[_0xf397('0x3b')]);return db[_0xf397('0x29')]['find'](_0x2e1b48)[_0xf397('0x23')](handleEntityNotFound(_0x418fc8,null))['then'](respondWithResult(_0x418fc8,null))[_0xf397('0x3e')](handleError(_0x418fc8,null));};exports['update']=function(_0x4cab2b,_0x23d12e){if(_0x4cab2b[_0xf397('0x42')]['id']){delete _0x4cab2b[_0xf397('0x42')]['id'];}return db['CmCustomField'][_0xf397('0x43')]({'where':{'id':_0x4cab2b[_0xf397('0x40')]['id']}})[_0xf397('0x23')](handleEntityNotFound(_0x23d12e,null))[_0xf397('0x23')](saveUpdates(_0x4cab2b[_0xf397('0x42')],null))[_0xf397('0x23')](respondWithResult(_0x23d12e,null))[_0xf397('0x3e')](handleError(_0x23d12e,null));};exports['destroy']=function(_0x5a1731,_0x2afedb){return db[_0xf397('0x29')][_0xf397('0x43')]({'where':{'id':_0x5a1731['params']['id']}})[_0xf397('0x23')](handleEntityNotFound(_0x2afedb,null))['then'](removeEntity(_0x2afedb,null))[_0xf397('0x3e')](handleError(_0x2afedb,null));};exports[_0xf397('0x44')]=function(_0x55ed30,_0x42d5f0){var _0x4d8ba5;return db[_0xf397('0x45')][_0xf397('0x46')](function(_0x266701){return db[_0xf397('0x29')][_0xf397('0x44')](_0x55ed30[_0xf397('0x42')],{'transaction':_0x266701})[_0xf397('0x23')](function(_0x4a5742){_0x4d8ba5=_0x4a5742;var _0x519a26={'type':db[_0xf397('0x47')][_0xf397('0x48')],'transaction':_0x266701};switch(_0x55ed30[_0xf397('0x42')][_0xf397('0x2a')]){case _0xf397('0x49'):_0x519a26[_0xf397('0x2a')]=db[_0xf397('0x47')]['TEXT'];break;case'number':_0x519a26[_0xf397('0x2a')]=db[_0xf397('0x47')][_0xf397('0x4a')];break;case'switch':_0x519a26['type']=db[_0xf397('0x47')][_0xf397('0x4b')];_0x519a26['defaultValue']=![];break;default:}return db[_0xf397('0x45')][_0xf397('0x4c')][_0xf397('0x4d')](_0xf397('0x4e'),util['format']('cf_%d',_0x4d8ba5['id']),_0x519a26);})['then'](function(){return _0x4d8ba5;});})['then'](respondWithResult(_0x42d5f0,0xc9))['catch'](handleError(_0x42d5f0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 71f34ba..5073823 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 _0x93e9=['moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api'];(function(_0x3f9cf3,_0x53872e){var _0x4acd9f=function(_0x4a4cfe){while(--_0x4a4cfe){_0x3f9cf3['push'](_0x3f9cf3['shift']());}};_0x4acd9f(++_0x53872e);}(_0x93e9,0xcc));var _0x993e=function(_0x5e58b4,_0x84cca0){_0x5e58b4=_0x5e58b4-0x0;var _0x5a52f5=_0x93e9[_0x5e58b4];return _0x5a52f5;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c32=['./cmCustomField.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x3c32,0x161));var _0x23c3=function(_0x1d8fa4,_0x33ac24){_0x1d8fa4=_0x1d8fa4-0x0;var _0x1de0da=_0x3c32[_0x1d8fa4];return _0x1de0da;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var logger=require(_0x23c3('0x2'))('api');var moment=require(_0x23c3('0x3'));var BPromise=require(_0x23c3('0x4'));var rp=require(_0x23c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x23c3('0x7'));module[_0x23c3('0x8')]=function(_0x1ec17b,_0x190132){return _0x1ec17b[_0x23c3('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','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 4bb3dfb..2e02a51 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 _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x550357,_0xfcb437){var _0x5bbdc3=function(_0x51ce18){while(--_0x51ce18){_0x550357['push'](_0x550357['shift']());}};_0x5bbdc3(++_0xfcb437);}(_0x222f,0x1a4));var _0xf222=function(_0xf7058b,_0x22c9b7){_0xf7058b=_0xf7058b-0x0;var _0x24cbf0=_0x222f[_0xf7058b];return _0x24cbf0;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('CmCustomField,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file +var _0x4d9e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2c647e,_0x2daedd){_0x2c647e=_0x2c647e-0x0;var _0x1a90ff=_0x4d9e[_0x2c647e];return _0x1a90ff;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 18f4dd7..5e388e5 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 _0x559f=['exports','util','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x559f,0x71));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf559('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf559('0x1'));var router=express[_0xf559('0x2')]();var auth=require(_0xf559('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf559('0x4'));var controller=require(_0xf559('0x5'));router['get']('/',auth[_0xf559('0x6')](),controller[_0xf559('0x7')]);router['get'](_0xf559('0x8'),auth[_0xf559('0x6')](),controller[_0xf559('0x9')]);router[_0xf559('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf559('0xb')](_0xf559('0x8'),auth['isAuthenticated'](),controller[_0xf559('0xc')]);router[_0xf559('0xd')]('/:id',auth[_0xf559('0x6')](),controller[_0xf559('0xe')]);module[_0xf559('0xf')]=router; \ No newline at end of file +var _0x98ce=['update','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','create','put','/:id'];(function(_0x348b8d,_0x5f21a8){var _0x459b4b=function(_0x15b321){while(--_0x15b321){_0x348b8d['push'](_0x348b8d['shift']());}};_0x459b4b(++_0x5f21a8);}(_0x98ce,0x113));var _0xe98c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x98ce[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xe98c('0x0'));var util=require('util');var path=require(_0xe98c('0x1'));var timeout=require('connect-timeout');var express=require(_0xe98c('0x2'));var router=express[_0xe98c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe98c('0x4'));var config=require(_0xe98c('0x5'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xe98c('0x6')](),controller['index']);router[_0xe98c('0x7')]('/:id',auth[_0xe98c('0x6')](),controller[_0xe98c('0x8')]);router[_0xe98c('0x9')]('/',auth[_0xe98c('0x6')](),controller[_0xe98c('0xa')]);router[_0xe98c('0xb')](_0xe98c('0xc'),auth[_0xe98c('0x6')](),controller[_0xe98c('0xd')]);router[_0xe98c('0xe')](_0xe98c('0xc'),auth[_0xe98c('0x6')](),controller['destroy']);module[_0xe98c('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ec48b90..88f308b 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 _0x524e=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports'];(function(_0x2ce426,_0x2c7a2d){var _0xdbc337=function(_0x5189e6){while(--_0x5189e6){_0x2ce426['push'](_0x2ce426['shift']());}};_0xdbc337(++_0x2c7a2d);}(_0x524e,0x15e));var _0xe524=function(_0x5da721,_0x1a583b){_0x5da721=_0x5da721-0x0;var _0x588eb1=_0x524e[_0x5da721];return _0x588eb1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe524('0x0')]={'phone':{'type':Sequelize[_0xe524('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe524('0x3')],'defaultValue':moment()[_0xe524('0x4')](_0xe524('0x5'))},'countbusyretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe524('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe524('0x3')]},'priority':{'type':Sequelize[_0xe524('0x6')](0x2)[_0xe524('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'ListId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'UserId':{'type':Sequelize[_0xe524('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe524('0x6')],'unique':_0xe524('0x8')},'CampaignId':{'type':Sequelize[_0xe524('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe524('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe524('0x1')]}}; \ No newline at end of file +var _0xe2fe=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xee2f('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee2f('0x2')],'defaultValue':moment()[_0xee2f('0x3')](_0xee2f('0x4'))},'countbusyretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xee2f('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee2f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xee2f('0x5')](0x2)[_0xee2f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xee2f('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 84afed9..0a56944 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 _0x3545=['$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','CmHopper','findAll','rows','catch','show','find','create','body','params','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','describe','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','CmCompany','Company','CmList','update','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x3545,0xef));var _0x5354=function(_0x3b3933,_0x4a5bd2){_0x3b3933=_0x3b3933-0x0;var _0x41d2c4=_0x3545[_0x3b3933];return _0x41d2c4;};'use strict';var pdf=require(_0x5354('0x0'));var emlformat=require(_0x5354('0x1'));var rimraf=require(_0x5354('0x2'));var zipdir=require(_0x5354('0x3'));var jsonpatch=require(_0x5354('0x4'));var rp=require('request-promise');var moment=require(_0x5354('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5354('0x6'));var util=require(_0x5354('0x7'));var path=require(_0x5354('0x8'));var sox=require('sox');var csv=require(_0x5354('0x9'));var ejs=require(_0x5354('0xa'));var fs=require('fs');var _=require(_0x5354('0xb'));var squel=require(_0x5354('0xc'));var crypto=require(_0x5354('0xd'));var jsforce=require(_0x5354('0xe'));var deskjs=require(_0x5354('0xf'));var toCsv=require(_0x5354('0x9'));var querystring=require(_0x5354('0x10'));var Papa=require(_0x5354('0x11'));var Redis=require(_0x5354('0x12'));var shared=require('../../config/environment');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5354('0x13'));var hardwareService=require(_0x5354('0x14'));var logger=require(_0x5354('0x15'))(_0x5354('0x16'));var utils=require(_0x5354('0x17'));var config=require(_0x5354('0x18'));var db=require(_0x5354('0x19'))['db'];function respondWithStatusCode(_0x13e636,_0x5a732e){_0x5a732e=_0x5a732e||0xcc;return function(_0x360541){if(_0x360541){return _0x13e636[_0x5354('0x1a')](_0x5a732e);}return _0x13e636[_0x5354('0x1b')](_0x5a732e)[_0x5354('0x1c')]();};}function respondWithResult(_0x366f6f,_0x569ce6){_0x569ce6=_0x569ce6||0xc8;return function(_0x44735e){if(_0x44735e){return _0x366f6f['status'](_0x569ce6)['json'](_0x44735e);}};}function respondWithFilteredResult(_0x5141ee,_0x73ab4e){return function(_0x2b3a7e){if(_0x2b3a7e){var _0x42f893=_0x2b3a7e[_0x5354('0x1d')],_0x1af7fc=_0x73ab4e[_0x5354('0x1e')],_0x2c10bc=_0x73ab4e['offset']+_0x73ab4e[_0x5354('0x1f')],_0x4f3f0c;if(_0x2c10bc>=_0x42f893){_0x2c10bc=_0x42f893;_0x4f3f0c=0xc8;}else{_0x4f3f0c=0xce;}_0x5141ee['status'](_0x4f3f0c);return _0x5141ee[_0x5354('0x20')](_0x5354('0x21'),_0x1af7fc+'-'+_0x2c10bc+'/'+_0x42f893)[_0x5354('0x22')](_0x2b3a7e);}return null;};}function patchUpdates(_0x264bad){return function(_0x494ccc){try{jsonpatch['apply'](_0x494ccc,_0x264bad,!![]);}catch(_0x2739d3){return BPromise[_0x5354('0x23')](_0x2739d3);}return _0x494ccc['save']();};}function saveUpdates(_0x1e8365,_0x4dc9ca){return function(_0x1d0f16){if(_0x1d0f16){return _0x1d0f16['update'](_0x1e8365)[_0x5354('0x24')](function(_0x1a4428){return _0x1a4428;});}return null;};}function removeEntity(_0x1a6382,_0x9903c7){return function(_0x4bd174){if(_0x4bd174){return _0x4bd174['destroy']()[_0x5354('0x24')](function(){_0x1a6382['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x143516,_0x142fae){return function(_0x586aa4){if(!_0x586aa4){_0x143516[_0x5354('0x1a')](0x194);}return _0x586aa4;};}function handleError(_0x518c72,_0x57e513){_0x57e513=_0x57e513||0x1f4;return function(_0x745e39){logger[_0x5354('0x25')](_0x745e39[_0x5354('0x26')]);if(_0x745e39[_0x5354('0x27')]){delete _0x745e39[_0x5354('0x27')];}_0x518c72['status'](_0x57e513)[_0x5354('0x28')](_0x745e39);};}exports[_0x5354('0x29')]=function(_0x361552,_0x294257){var _0x55f677={},_0x5727fb={},_0x2f34fa={'count':0x0,'rows':[]};var _0x5209ec=_[_0x5354('0x2a')](db['CmHopper'][_0x5354('0x2b')],function(_0x4e7bb9){return{'name':_0x4e7bb9[_0x5354('0x2c')],'type':_0x4e7bb9[_0x5354('0x2d')]['key']};});_0x5727fb[_0x5354('0x2e')]=_['map'](_0x5209ec,_0x5354('0x27'));_0x5727fb[_0x5354('0x2f')]=_[_0x5354('0x30')](_0x361552[_0x5354('0x2f')]);_0x5727fb[_0x5354('0x31')]=_[_0x5354('0x32')](_0x5727fb[_0x5354('0x2e')],_0x5727fb['query']);_0x5727fb['filters']=_[_0x5354('0x33')](_0x5727fb['filters'],[_0x5354('0x34'),_0x5354('0x35'),_0x5354('0x36'),'$gte',_0x5354('0x37'),'$lte',_0x5354('0x38'),_0x5354('0x39'),_0x5354('0x3a'),_0x5354('0x3b'),_0x5354('0x3c'),_0x5354('0x3d'),_0x5354('0x3e'),_0x5354('0x3f'),_0x5354('0x40'),_0x5354('0x41'),'$notILike',_0x5354('0x3f'),_0x5354('0x42'),_0x5354('0x43'),_0x5354('0x44'),_0x5354('0x45')]);_0x55f677[_0x5354('0x46')]=_['intersection'](_0x5727fb[_0x5354('0x2e')],qs[_0x5354('0x47')](_0x361552['query'][_0x5354('0x47')]));_0x55f677[_0x5354('0x46')]=_0x55f677[_0x5354('0x46')][_0x5354('0x48')]?_0x55f677[_0x5354('0x46')]:_0x5727fb['model'];if(!_0x361552[_0x5354('0x2f')]['hasOwnProperty']('nolimit')){_0x55f677['limit']=qs['limit'](_0x361552[_0x5354('0x2f')][_0x5354('0x1f')]);_0x55f677[_0x5354('0x1e')]=qs[_0x5354('0x1e')](_0x361552[_0x5354('0x2f')][_0x5354('0x1e')]);}_0x55f677[_0x5354('0x49')]=qs[_0x5354('0x4a')](_0x361552[_0x5354('0x2f')][_0x5354('0x4a')]);_0x55f677['where']=qs[_0x5354('0x31')](_[_0x5354('0x4b')](_0x361552['query'],_0x5727fb[_0x5354('0x31')]),_0x5209ec);if(_0x361552[_0x5354('0x2f')][_0x5354('0x4c')]){_0x55f677[_0x5354('0x4d')]=_['merge'](_0x55f677[_0x5354('0x4d')],{'$or':_[_0x5354('0x2a')](_0x5209ec,function(_0x290172){if(_0x290172[_0x5354('0x2d')]!==_0x5354('0x4e')){var _0x89d91b={};_0x89d91b[_0x290172['name']]={'$like':'%'+_0x361552[_0x5354('0x2f')][_0x5354('0x4c')]+'%'};return _0x89d91b;}})});}_0x55f677=_[_0x5354('0x4f')]({},_0x55f677,_0x361552[_0x5354('0x50')]);var _0x56c65c={'where':_0x55f677[_0x5354('0x4d')]};return db['CmHopper'][_0x5354('0x1d')](_0x56c65c)['then'](function(_0x1a12ac){_0x2f34fa[_0x5354('0x1d')]=_0x1a12ac;if(_0x361552[_0x5354('0x2f')][_0x5354('0x51')]){_0x55f677['include']=[{'all':!![]}];}return db[_0x5354('0x52')][_0x5354('0x53')](_0x55f677);})[_0x5354('0x24')](function(_0xd92cc){_0x2f34fa[_0x5354('0x54')]=_0xd92cc;return _0x2f34fa;})['then'](respondWithFilteredResult(_0x294257,_0x55f677))[_0x5354('0x55')](handleError(_0x294257,null));};exports[_0x5354('0x56')]=function(_0x24cf2b,_0x48d0b3){var _0x1efdb0={'raw':!![],'where':{'id':_0x24cf2b['params']['id']}},_0x4a1009={};_0x4a1009[_0x5354('0x2e')]=_[_0x5354('0x30')](db[_0x5354('0x52')]['rawAttributes']);_0x4a1009[_0x5354('0x2f')]=_[_0x5354('0x30')](_0x24cf2b['query']);_0x4a1009[_0x5354('0x31')]=_[_0x5354('0x32')](_0x4a1009['model'],_0x4a1009[_0x5354('0x2f')]);_0x1efdb0[_0x5354('0x46')]=_[_0x5354('0x32')](_0x4a1009['model'],qs[_0x5354('0x47')](_0x24cf2b[_0x5354('0x2f')][_0x5354('0x47')]));_0x1efdb0[_0x5354('0x46')]=_0x1efdb0[_0x5354('0x46')][_0x5354('0x48')]?_0x1efdb0[_0x5354('0x46')]:_0x4a1009['model'];if(_0x24cf2b[_0x5354('0x2f')]['includeAll']){_0x1efdb0['include']=[{'all':!![]}];}_0x1efdb0=_[_0x5354('0x4f')]({},_0x1efdb0,_0x24cf2b[_0x5354('0x50')]);return db[_0x5354('0x52')][_0x5354('0x57')](_0x1efdb0)[_0x5354('0x24')](handleEntityNotFound(_0x48d0b3,null))[_0x5354('0x24')](respondWithResult(_0x48d0b3,null))[_0x5354('0x55')](handleError(_0x48d0b3,null));};exports['create']=function(_0x5a58b9,_0x9d7bc7){return db[_0x5354('0x52')][_0x5354('0x58')](_0x5a58b9['body'],{})[_0x5354('0x24')](respondWithResult(_0x9d7bc7,0xc9))[_0x5354('0x55')](handleError(_0x9d7bc7,null));};exports['update']=function(_0x329804,_0x48cd04){if(_0x329804[_0x5354('0x59')]['id']){delete _0x329804[_0x5354('0x59')]['id'];}return db[_0x5354('0x52')][_0x5354('0x57')]({'where':{'id':_0x329804[_0x5354('0x5a')]['id']}})[_0x5354('0x24')](handleEntityNotFound(_0x48cd04,null))[_0x5354('0x24')](saveUpdates(_0x329804[_0x5354('0x59')],null))[_0x5354('0x24')](respondWithResult(_0x48cd04,null))[_0x5354('0x55')](handleError(_0x48cd04,null));};exports['describe']=function(_0xc362ef,_0xf37d1b){return db['CmHopper']['describe']()[_0x5354('0x24')](respondWithResult(_0xf37d1b,null))['catch'](handleError(_0xf37d1b,null));};exports[_0x5354('0x5b')]=function(_0x2f2c7d,_0x25dd6b){var _0x4c220e;return db[_0x5354('0x52')][_0x5354('0x57')]({'where':{'id':_0x2f2c7d[_0x5354('0x5a')]['id']}})['then'](handleEntityNotFound(_0x25dd6b,null))[_0x5354('0x24')](function(_0x5a588d){if(_0x5a588d){return _0x5a588d[_0x5354('0x5b')]()['then'](function(_0x20f787){return _0x20f787;});}})[_0x5354('0x24')](function(_0xc87a51){_0x4c220e=_0xc87a51;if(_0xc87a51){if(_0xc87a51[_0x5354('0x5c')]||_0xc87a51[_0x5354('0x5d')]){return db[_0xc87a51[_0x5354('0x5c')]?_0x5354('0x5e'):'Campaign'][_0x5354('0x57')]({'where':{'id':_0xc87a51[_0x5354('0x5c')]?_0xc87a51[_0x5354('0x5c')]:_0xc87a51[_0x5354('0x5d')]},'attributes':['id',_0x5354('0x27')],'raw':!![]});}}})[_0x5354('0x24')](function(_0x8dabe1){var _0x119912={};if(_0x8dabe1){_[_0x5354('0x4f')](_0x119912,_[_0x5354('0x5f')](_0x4c220e['dataValues'],[_0x5354('0x60'),_0x5354('0x61'),'id']));_0x119912['state']=0x15;_0x119912[_0x5354('0x62')]=_0x5354('0x63');_0x119912[_0x5354('0x64')]=_0x8dabe1[_0x5354('0x27')];_0x119912[_0x5354('0x65')]=_0x2f2c7d[_0x5354('0x66')]['name'];_0x119912[_0x5354('0x67')]=_0x2f2c7d['user']['id'];_0x119912[_0x5354('0x63')]=!![];_0x119912['deletedat']=moment()['format'](_0x5354('0x68'));_0x119912[_0x5354('0x69')]=_0x4c220e['phone'];_0x119912[_0x5354('0x6a')]=_0x4c220e['VoiceQueueId']?'queue':_0x5354('0x6b');return db[_0x5354('0x6c')][_0x5354('0x57')]({'where':{'id':_0x119912[_0x5354('0x6d')]},'attributes':[_0x5354('0x6e'),_0x5354('0x6f')]})['then'](function(_0x4e934d){if(!_[_0x5354('0x70')](_0x25dd6b)&&!_[_0x5354('0x70')](_0x4e934d[_0x5354('0x6e')])){_0x119912[_0x5354('0x71')]=_0x4e934d[_0x5354('0x6e')];if(!_[_0x5354('0x70')](_0x4e934d[_0x5354('0x6f')])){_0x119912[_0x5354('0x71')]+='\x20'+_0x4e934d[_0x5354('0x6f')];}}})[_0x5354('0x72')](function(){return db[_0x5354('0x73')]['create'](_0x119912);});}})[_0x5354('0x24')](function(){return _0x25dd6b[_0x5354('0x1b')](0xcc)[_0x5354('0x1c')]();})[_0x5354('0x55')](handleError(_0x25dd6b,null));};exports['getPreview']=function(_0x35535a,_0x3f302c,_0x3249ad){var _0x6eac52=[];return db[_0x5354('0x6c')][_0x5354('0x74')]()[_0x5354('0x24')](function(_0x2b8f9f){_0x6eac52=_[_0x5354('0x30')](_0x2b8f9f);return _0x35535a[_0x5354('0x66')][_0x5354('0x75')]({'where':{'type':_0x5354('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x5354('0x77')],'raw':!![]});})['then'](function(_0x36d4ca){if(_0x36d4ca&&_0x36d4ca[_0x5354('0x48')]){return db[_0x5354('0x78')][_0x5354('0x79')](function(_0x3dc937){var _0x12c169={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5354('0x7a')](_0x5354('0x68'))},'VoiceQueueId':{'$in':_[_0x5354('0x2a')](_0x36d4ca,'id')},'$or':[{'UserId':null},{'UserId':_0x35535a[_0x5354('0x66')]['id']}]};var _0x34b302=[];if(_0x35535a[_0x5354('0x59')][_0x5354('0x7b')]&&_0x35535a['body']['direction']===_0x5354('0x7c')){if(!_[_0x5354('0x7d')](_0x35535a[_0x5354('0x59')][_0x5354('0x7e')])){_0x12c169['id']={'$in':_0x35535a[_0x5354('0x59')][_0x5354('0x7e')]};}_0x34b302=[[_0x5354('0x7f'),_0x5354('0x80')],[_0x5354('0x81'),_0x36d4ca[0x0]['dialOrderByScheduledAt']===_0x5354('0x80')?_0x5354('0x82'):_0x5354('0x80')],db['sequelize'][_0x5354('0x83')](_0x5354('0x84')),['id','DESC']];}else{if(!_[_0x5354('0x7d')](_0x35535a[_0x5354('0x59')][_0x5354('0x7e')])){_0x12c169['id']={'$notIn':_0x35535a[_0x5354('0x59')][_0x5354('0x7e')]};}_0x34b302=[['priority',_0x5354('0x82')],['scheduledAt',_0x36d4ca[0x0][_0x5354('0x77')]],db[_0x5354('0x78')][_0x5354('0x83')](_0x5354('0x85')),['id','ASC']];}return db[_0x5354('0x52')]['findOne']({'attributes':['id','scheduledat'],'where':_0x12c169,'order':_0x34b302,'transaction':_0x3dc937,'lock':_0x3dc937['LOCK'][_0x5354('0x86')],'include':[{'model':db[_0x5354('0x6c')],'as':'Contact','attributes':_0x6eac52,'include':[{'model':db[_0x5354('0x87')],'as':_0x5354('0x88'),'attributes':['id','name']}]},{'model':db[_0x5354('0x89')],'as':'List','attributes':['id',_0x5354('0x27')]},{'model':db[_0x5354('0x5e')],'as':'Queue','attributes':['id',_0x5354('0x27'),'dialActive']}]})[_0x5354('0x24')](function(_0xfe8d79){if(_0xfe8d79){return _0xfe8d79[_0x5354('0x8a')]({'UserId':_0x35535a[_0x5354('0x66')]['id']},{'transaction':_0x3dc937});}});});}})[_0x5354('0x24')](handleEntityNotFound(_0x3f302c,null))['then'](respondWithResult(_0x3f302c,null))[_0x5354('0x55')](handleError(_0x3f302c,null));};exports[_0x5354('0x8b')]=function(_0x56d24f,_0x40983b,_0x484dba){return _0x56d24f[_0x5354('0x66')][_0x5354('0x75')]({'where':{'type':_0x5354('0x76'),'dialActive':!![],'dialMethod':_0x5354('0x8c')},'attributes':['id'],'raw':!![]})[_0x5354('0x24')](function(_0xd2b0cc){if(_0xd2b0cc&&_0xd2b0cc[_0x5354('0x48')]){return db['CmHopper'][_0x5354('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5354('0x7a')](_0x5354('0x68'))},'VoiceQueueId':{'$in':_['map'](_0xd2b0cc,'id')},'$or':[{'UserId':null},{'UserId':_0x56d24f[_0x5354('0x66')]['id']}]}});}return 0x0;})[_0x5354('0x24')](function(_0x9b8a6c){if(!_['isNil'](_0x9b8a6c)&&_['isNumber'](_0x9b8a6c)){return _0x40983b[_0x5354('0x1b')](0xc8)[_0x5354('0x22')]({'contacts':_0x9b8a6c});}else{logger[_0x5354('0x25')](_0x5354('0x8d'),_0x5354('0x8b'),0x194,_0x5354('0x8e'));_0x40983b[_0x5354('0x1a')](0x194);}})[_0x5354('0x55')](handleError(_0x40983b,null));};exports[_0x5354('0x8f')]=function(_0x3d2a42,_0x104285,_0x4bb5b0){var _0x724f7d=shared[_0x5354('0x90')];var _0x3f68da=[];_[_0x5354('0x2a')](_0x724f7d,function(_0x2f2b71){_0x3f68da[_0x5354('0x91')]({'id':_0x2f2b71[_0x5354('0x27')],'name':_0x2f2b71['name'],'utcOffset':_0x2f2b71[_0x5354('0x92')]});});return _0x104285[_0x5354('0x1b')](0xc8)['json']({'tz':_0x3f68da});};exports['getTimezone']=function(_0x2b9309,_0x2f13c3,_0x199b70){var _0x545696=shared[_0x5354('0x90')];var _0x2043a6={};if(!_[_0x5354('0x70')](_0x545696[_0x2b9309['body']['id']]))_0x2043a6=_0x545696[_0x2b9309['body']['id']];return _0x2f13c3[_0x5354('0x1b')](0xc8)[_0x5354('0x22')](_0x2043a6);}; \ No newline at end of file +var _0xb29e=['VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','user','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','isNil','calleridname','firstName','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','direction','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/environment','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','count','offset','limit','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$in','$like','$notLike','$iLike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x30720e,_0x55753f){var _0x5674ac=function(_0x32b76f){while(--_0x32b76f){_0x30720e['push'](_0x30720e['shift']());}};_0x5674ac(++_0x55753f);}(_0xb29e,0x1eb));var _0xeb29=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0xb29e[_0x196e1b];return _0x5e1f18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb29('0x0'));var rimraf=require(_0xeb29('0x1'));var zipdir=require(_0xeb29('0x2'));var jsonpatch=require(_0xeb29('0x3'));var rp=require('request-promise');var moment=require(_0xeb29('0x4'));var BPromise=require(_0xeb29('0x5'));var Mustache=require('mustache');var util=require(_0xeb29('0x6'));var path=require(_0xeb29('0x7'));var sox=require(_0xeb29('0x8'));var csv=require(_0xeb29('0x9'));var ejs=require(_0xeb29('0xa'));var fs=require('fs');var _=require(_0xeb29('0xb'));var squel=require(_0xeb29('0xc'));var crypto=require(_0xeb29('0xd'));var jsforce=require(_0xeb29('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb29('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var shared=require(_0xeb29('0x10'));var authService=require(_0xeb29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb29('0x12'));var hardwareService=require(_0xeb29('0x13'));var logger=require(_0xeb29('0x14'))(_0xeb29('0x15'));var utils=require(_0xeb29('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e99e5,_0x2b1f05){_0x2b1f05=_0x2b1f05||0xcc;return function(_0x4da77f){if(_0x4da77f){return _0x2e99e5[_0xeb29('0x17')](_0x2b1f05);}return _0x2e99e5['status'](_0x2b1f05)[_0xeb29('0x18')]();};}function respondWithResult(_0x21573b,_0xabc4c1){_0xabc4c1=_0xabc4c1||0xc8;return function(_0x95c4ee){if(_0x95c4ee){return _0x21573b[_0xeb29('0x19')](_0xabc4c1)['json'](_0x95c4ee);}};}function respondWithFilteredResult(_0x349e50,_0x4c8cdb){return function(_0x4d2f0c){if(_0x4d2f0c){var _0x58d443=_0x4d2f0c[_0xeb29('0x1a')],_0x4790f7=_0x4c8cdb[_0xeb29('0x1b')],_0x40cb07=_0x4c8cdb[_0xeb29('0x1b')]+_0x4c8cdb[_0xeb29('0x1c')],_0x107bc3;if(_0x40cb07>=_0x58d443){_0x40cb07=_0x58d443;_0x107bc3=0xc8;}else{_0x107bc3=0xce;}_0x349e50[_0xeb29('0x19')](_0x107bc3);return _0x349e50['set'](_0xeb29('0x1d'),_0x4790f7+'-'+_0x40cb07+'/'+_0x58d443)[_0xeb29('0x1e')](_0x4d2f0c);}return null;};}function patchUpdates(_0x33d73c){return function(_0x14599b){try{jsonpatch['apply'](_0x14599b,_0x33d73c,!![]);}catch(_0x32c041){return BPromise[_0xeb29('0x1f')](_0x32c041);}return _0x14599b[_0xeb29('0x20')]();};}function saveUpdates(_0xcae4c2,_0x1d1c31){return function(_0xd96133){if(_0xd96133){return _0xd96133['update'](_0xcae4c2)[_0xeb29('0x21')](function(_0x2106b1){return _0x2106b1;});}return null;};}function removeEntity(_0x46cf01,_0x3387cf){return function(_0x4a0a42){if(_0x4a0a42){return _0x4a0a42[_0xeb29('0x22')]()['then'](function(){_0x46cf01[_0xeb29('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565c53,_0x3a8a75){return function(_0x12bdb7){if(!_0x12bdb7){_0x565c53[_0xeb29('0x17')](0x194);}return _0x12bdb7;};}function handleError(_0x413cbb,_0x3f7f1a){_0x3f7f1a=_0x3f7f1a||0x1f4;return function(_0x111ea5){logger[_0xeb29('0x23')](_0x111ea5[_0xeb29('0x24')]);if(_0x111ea5['name']){delete _0x111ea5[_0xeb29('0x25')];}_0x413cbb[_0xeb29('0x19')](_0x3f7f1a)['send'](_0x111ea5);};}exports[_0xeb29('0x26')]=function(_0x158743,_0x10f7ab){var _0x28108a={},_0x9eab61={},_0xd0592a={'count':0x0,'rows':[]};var _0x2e3ea3=_[_0xeb29('0x27')](db[_0xeb29('0x28')][_0xeb29('0x29')],function(_0x5ca62a){return{'name':_0x5ca62a[_0xeb29('0x2a')],'type':_0x5ca62a[_0xeb29('0x2b')]['key']};});_0x9eab61[_0xeb29('0x2c')]=_[_0xeb29('0x27')](_0x2e3ea3,_0xeb29('0x25'));_0x9eab61[_0xeb29('0x2d')]=_[_0xeb29('0x2e')](_0x158743[_0xeb29('0x2d')]);_0x9eab61[_0xeb29('0x2f')]=_[_0xeb29('0x30')](_0x9eab61['model'],_0x9eab61[_0xeb29('0x2d')]);_0x9eab61['filters']=_[_0xeb29('0x31')](_0x9eab61[_0xeb29('0x2f')],[_0xeb29('0x32'),_0xeb29('0x33'),_0xeb29('0x34'),_0xeb29('0x35'),_0xeb29('0x36'),_0xeb29('0x37'),_0xeb29('0x38'),'$eq',_0xeb29('0x39'),'$between','$notBetween',_0xeb29('0x3a'),'$notIn',_0xeb29('0x3b'),_0xeb29('0x3c'),_0xeb29('0x3d'),'$notILike',_0xeb29('0x3b'),'$overlap',_0xeb29('0x3e'),_0xeb29('0x3f'),_0xeb29('0x40')]);_0x28108a[_0xeb29('0x41')]=_['intersection'](_0x9eab61[_0xeb29('0x2c')],qs[_0xeb29('0x42')](_0x158743[_0xeb29('0x2d')][_0xeb29('0x42')]));_0x28108a[_0xeb29('0x41')]=_0x28108a[_0xeb29('0x41')][_0xeb29('0x43')]?_0x28108a[_0xeb29('0x41')]:_0x9eab61[_0xeb29('0x2c')];if(!_0x158743[_0xeb29('0x2d')][_0xeb29('0x44')](_0xeb29('0x45'))){_0x28108a[_0xeb29('0x1c')]=qs[_0xeb29('0x1c')](_0x158743[_0xeb29('0x2d')][_0xeb29('0x1c')]);_0x28108a[_0xeb29('0x1b')]=qs[_0xeb29('0x1b')](_0x158743[_0xeb29('0x2d')][_0xeb29('0x1b')]);}_0x28108a[_0xeb29('0x46')]=qs[_0xeb29('0x47')](_0x158743[_0xeb29('0x2d')][_0xeb29('0x47')]);_0x28108a['where']=qs[_0xeb29('0x2f')](_[_0xeb29('0x48')](_0x158743['query'],_0x9eab61['filters']),_0x2e3ea3);if(_0x158743[_0xeb29('0x2d')][_0xeb29('0x49')]){_0x28108a[_0xeb29('0x4a')]=_[_0xeb29('0x4b')](_0x28108a[_0xeb29('0x4a')],{'$or':_['map'](_0x2e3ea3,function(_0x1db675){if(_0x1db675['type']!==_0xeb29('0x4c')){var _0x393c60={};_0x393c60[_0x1db675[_0xeb29('0x25')]]={'$like':'%'+_0x158743[_0xeb29('0x2d')][_0xeb29('0x49')]+'%'};return _0x393c60;}})});}_0x28108a=_[_0xeb29('0x4b')]({},_0x28108a,_0x158743[_0xeb29('0x4d')]);var _0xddd791={'where':_0x28108a[_0xeb29('0x4a')]};return db[_0xeb29('0x28')][_0xeb29('0x1a')](_0xddd791)[_0xeb29('0x21')](function(_0x54a54e){_0xd0592a[_0xeb29('0x1a')]=_0x54a54e;if(_0x158743[_0xeb29('0x2d')][_0xeb29('0x4e')]){_0x28108a[_0xeb29('0x4f')]=[{'all':!![]}];}return db[_0xeb29('0x28')][_0xeb29('0x50')](_0x28108a);})[_0xeb29('0x21')](function(_0x491196){_0xd0592a[_0xeb29('0x51')]=_0x491196;return _0xd0592a;})['then'](respondWithFilteredResult(_0x10f7ab,_0x28108a))[_0xeb29('0x52')](handleError(_0x10f7ab,null));};exports[_0xeb29('0x53')]=function(_0x1e73b3,_0x55cac3){var _0x57efb9={'raw':!![],'where':{'id':_0x1e73b3[_0xeb29('0x54')]['id']}},_0x2ff9f6={};_0x2ff9f6[_0xeb29('0x2c')]=_[_0xeb29('0x2e')](db[_0xeb29('0x28')][_0xeb29('0x29')]);_0x2ff9f6['query']=_[_0xeb29('0x2e')](_0x1e73b3[_0xeb29('0x2d')]);_0x2ff9f6[_0xeb29('0x2f')]=_[_0xeb29('0x30')](_0x2ff9f6[_0xeb29('0x2c')],_0x2ff9f6[_0xeb29('0x2d')]);_0x57efb9[_0xeb29('0x41')]=_[_0xeb29('0x30')](_0x2ff9f6[_0xeb29('0x2c')],qs['fields'](_0x1e73b3[_0xeb29('0x2d')][_0xeb29('0x42')]));_0x57efb9['attributes']=_0x57efb9['attributes'][_0xeb29('0x43')]?_0x57efb9['attributes']:_0x2ff9f6[_0xeb29('0x2c')];if(_0x1e73b3[_0xeb29('0x2d')][_0xeb29('0x4e')]){_0x57efb9[_0xeb29('0x4f')]=[{'all':!![]}];}_0x57efb9=_[_0xeb29('0x4b')]({},_0x57efb9,_0x1e73b3['options']);return db['CmHopper'][_0xeb29('0x55')](_0x57efb9)['then'](handleEntityNotFound(_0x55cac3,null))[_0xeb29('0x21')](respondWithResult(_0x55cac3,null))[_0xeb29('0x52')](handleError(_0x55cac3,null));};exports['create']=function(_0x42a055,_0x356857){return db['CmHopper'][_0xeb29('0x56')](_0x42a055[_0xeb29('0x57')],{})[_0xeb29('0x21')](respondWithResult(_0x356857,0xc9))[_0xeb29('0x52')](handleError(_0x356857,null));};exports['update']=function(_0x2fc347,_0x4862b6){if(_0x2fc347[_0xeb29('0x57')]['id']){delete _0x2fc347['body']['id'];}return db[_0xeb29('0x28')][_0xeb29('0x55')]({'where':{'id':_0x2fc347['params']['id']}})[_0xeb29('0x21')](handleEntityNotFound(_0x4862b6,null))[_0xeb29('0x21')](saveUpdates(_0x2fc347['body'],null))[_0xeb29('0x21')](respondWithResult(_0x4862b6,null))[_0xeb29('0x52')](handleError(_0x4862b6,null));};exports[_0xeb29('0x58')]=function(_0x4cfac8,_0x21a266){return db[_0xeb29('0x28')][_0xeb29('0x58')]()[_0xeb29('0x21')](respondWithResult(_0x21a266,null))['catch'](handleError(_0x21a266,null));};exports['destroy']=function(_0x475884,_0x331bc0){var _0x310afc;return db[_0xeb29('0x28')][_0xeb29('0x55')]({'where':{'id':_0x475884['params']['id']}})[_0xeb29('0x21')](handleEntityNotFound(_0x331bc0,null))['then'](function(_0x11c0eb){if(_0x11c0eb){return _0x11c0eb[_0xeb29('0x22')]()[_0xeb29('0x21')](function(_0x2a0f71){return _0x2a0f71;});}})['then'](function(_0x2c1451){_0x310afc=_0x2c1451;if(_0x2c1451){if(_0x2c1451[_0xeb29('0x59')]||_0x2c1451[_0xeb29('0x5a')]){return db[_0x2c1451['VoiceQueueId']?_0xeb29('0x5b'):_0xeb29('0x5c')][_0xeb29('0x55')]({'where':{'id':_0x2c1451[_0xeb29('0x59')]?_0x2c1451[_0xeb29('0x59')]:_0x2c1451[_0xeb29('0x5a')]},'attributes':['id',_0xeb29('0x25')],'raw':!![]});}}})['then'](function(_0x21c3e6){var _0x5cff23={};if(_0x21c3e6){_[_0xeb29('0x4b')](_0x5cff23,_[_0xeb29('0x5d')](_0x310afc[_0xeb29('0x5e')],['createdAt',_0xeb29('0x5f'),'id']));_0x5cff23[_0xeb29('0x60')]=0x15;_0x5cff23[_0xeb29('0x61')]=_0xeb29('0x62');_0x5cff23['campaign']=_0x21c3e6[_0xeb29('0x25')];_0x5cff23['membername']=_0x475884[_0xeb29('0x63')]['name'];_0x5cff23['UserId']=_0x475884[_0xeb29('0x63')]['id'];_0x5cff23[_0xeb29('0x62')]=!![];_0x5cff23['deletedat']=moment()[_0xeb29('0x64')](_0xeb29('0x65'));_0x5cff23['calleridnum']=_0x310afc[_0xeb29('0x66')];_0x5cff23['campaigntype']=_0x310afc[_0xeb29('0x59')]?_0xeb29('0x67'):_0xeb29('0x68');return db[_0xeb29('0x69')][_0xeb29('0x55')]({'where':{'id':_0x5cff23[_0xeb29('0x6a')]},'attributes':['firstName','lastName']})[_0xeb29('0x21')](function(_0x24139f){if(!_['isNil'](_0x331bc0)&&!_[_0xeb29('0x6b')](_0x24139f['firstName'])){_0x5cff23[_0xeb29('0x6c')]=_0x24139f[_0xeb29('0x6d')];if(!_['isNil'](_0x24139f[_0xeb29('0x6e')])){_0x5cff23[_0xeb29('0x6c')]+='\x20'+_0x24139f[_0xeb29('0x6e')];}}})[_0xeb29('0x6f')](function(){return db[_0xeb29('0x70')][_0xeb29('0x56')](_0x5cff23);});}})[_0xeb29('0x21')](function(){return _0x331bc0[_0xeb29('0x19')](0xcc)[_0xeb29('0x18')]();})[_0xeb29('0x52')](handleError(_0x331bc0,null));};exports[_0xeb29('0x71')]=function(_0x31a8b6,_0x1d9212,_0x3f4000){var _0x6242da=[];return db[_0xeb29('0x69')][_0xeb29('0x58')]()['then'](function(_0x402c62){_0x6242da=_['keys'](_0x402c62);return _0x31a8b6[_0xeb29('0x63')][_0xeb29('0x72')]({'where':{'type':_0xeb29('0x73'),'dialActive':!![],'dialMethod':_0xeb29('0x74')},'attributes':['id',_0xeb29('0x75')],'raw':!![]});})[_0xeb29('0x21')](function(_0x52c1d9){if(_0x52c1d9&&_0x52c1d9[_0xeb29('0x43')]){return db['sequelize']['transaction'](function(_0x512a83){var _0x5bc8b5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeb29('0x64')](_0xeb29('0x65'))},'VoiceQueueId':{'$in':_[_0xeb29('0x27')](_0x52c1d9,'id')},'$or':[{'UserId':null},{'UserId':_0x31a8b6['user']['id']}]};var _0x6025fa=[];if(_0x31a8b6[_0xeb29('0x57')][_0xeb29('0x76')]&&_0x31a8b6['body'][_0xeb29('0x76')]==='prev'){if(!_['isEmpty'](_0x31a8b6['body'][_0xeb29('0x77')])){_0x5bc8b5['id']={'$in':_0x31a8b6['body'][_0xeb29('0x77')]};}_0x6025fa=[[_0xeb29('0x78'),_0xeb29('0x79')],[_0xeb29('0x7a'),_0x52c1d9[0x0][_0xeb29('0x75')]==='ASC'?'DESC':_0xeb29('0x79')],db['sequelize']['literal'](_0xeb29('0x7b')),['id',_0xeb29('0x7c')]];}else{if(!_[_0xeb29('0x7d')](_0x31a8b6[_0xeb29('0x57')][_0xeb29('0x77')])){_0x5bc8b5['id']={'$notIn':_0x31a8b6[_0xeb29('0x57')][_0xeb29('0x77')]};}_0x6025fa=[[_0xeb29('0x78'),_0xeb29('0x7c')],[_0xeb29('0x7a'),_0x52c1d9[0x0][_0xeb29('0x75')]],db[_0xeb29('0x7e')][_0xeb29('0x7f')](_0xeb29('0x80')),['id',_0xeb29('0x79')]];}return db[_0xeb29('0x28')][_0xeb29('0x81')]({'attributes':['id','scheduledat'],'where':_0x5bc8b5,'order':_0x6025fa,'transaction':_0x512a83,'lock':_0x512a83[_0xeb29('0x82')][_0xeb29('0x83')],'include':[{'model':db['CmContact'],'as':_0xeb29('0x84'),'attributes':_0x6242da,'include':[{'model':db[_0xeb29('0x85')],'as':_0xeb29('0x86'),'attributes':['id',_0xeb29('0x25')]}]},{'model':db[_0xeb29('0x87')],'as':_0xeb29('0x88'),'attributes':['id','name']},{'model':db[_0xeb29('0x5b')],'as':_0xeb29('0x89'),'attributes':['id',_0xeb29('0x25'),_0xeb29('0x8a')]}]})['then'](function(_0x33a022){if(_0x33a022){return _0x33a022['update']({'UserId':_0x31a8b6[_0xeb29('0x63')]['id']},{'transaction':_0x512a83});}});});}})[_0xeb29('0x21')](handleEntityNotFound(_0x1d9212,null))['then'](respondWithResult(_0x1d9212,null))[_0xeb29('0x52')](handleError(_0x1d9212,null));};exports[_0xeb29('0x8b')]=function(_0x10ad8f,_0x5b2e13,_0x5af3f2){return _0x10ad8f[_0xeb29('0x63')][_0xeb29('0x72')]({'where':{'type':_0xeb29('0x73'),'dialActive':!![],'dialMethod':_0xeb29('0x74')},'attributes':['id'],'raw':!![]})[_0xeb29('0x21')](function(_0x166445){if(_0x166445&&_0x166445[_0xeb29('0x43')]){return db[_0xeb29('0x28')][_0xeb29('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeb29('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x166445,'id')},'$or':[{'UserId':null},{'UserId':_0x10ad8f['user']['id']}]}});}return 0x0;})['then'](function(_0x12de16){if(!_[_0xeb29('0x6b')](_0x12de16)&&_['isNumber'](_0x12de16)){return _0x5b2e13[_0xeb29('0x19')](0xc8)[_0xeb29('0x1e')]({'contacts':_0x12de16});}else{logger[_0xeb29('0x23')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xeb29('0x8b'),0x194,'entity\x20not\x20found');_0x5b2e13[_0xeb29('0x17')](0x194);}})[_0xeb29('0x52')](handleError(_0x5b2e13,null));};exports[_0xeb29('0x8c')]=function(_0x5c919d,_0x4b05ca,_0xb3a610){var _0x36b4df=shared[_0xeb29('0x8d')];var _0x4140e5=[];_[_0xeb29('0x27')](_0x36b4df,function(_0x39ad54){_0x4140e5[_0xeb29('0x8e')]({'id':_0x39ad54[_0xeb29('0x25')],'name':_0x39ad54[_0xeb29('0x25')],'utcOffset':_0x39ad54[_0xeb29('0x8f')]});});return _0x4b05ca['status'](0xc8)[_0xeb29('0x1e')]({'tz':_0x4140e5});};exports[_0xeb29('0x90')]=function(_0x3649eb,_0x189789,_0x4761c4){var _0x37b169=shared[_0xeb29('0x8d')];var _0x5c247d={};if(!_[_0xeb29('0x6b')](_0x37b169[_0x3649eb[_0xeb29('0x57')]['id']]))_0x5c247d=_0x37b169[_0x3649eb['body']['id']];return _0x189789[_0xeb29('0x19')](0xc8)[_0xeb29('0x1e')](_0x5c247d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index eda16e9..f1d78d6 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 _0x63f8=['path','rimraf','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x39ea37,_0x14dbba){var _0x1c6558=function(_0x575406){while(--_0x575406){_0x39ea37['push'](_0x39ea37['shift']());}};_0x1c6558(++_0x14dbba);}(_0x63f8,0x1d7));var _0x863f=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x63f8[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x863f('0x0'));var util=require(_0x863f('0x1'));var logger=require(_0x863f('0x2'))(_0x863f('0x3'));var moment=require(_0x863f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x863f('0x5'));var rimraf=require(_0x863f('0x6'));var config=require('../../config/environment');var attributes=require(_0x863f('0x7'));module['exports']=function(_0x3acaa2,_0x4a8d3d){return _0x3acaa2[_0x863f('0x8')](_0x863f('0x9'),attributes,{'tableName':_0x863f('0xa'),'paranoid':![],'indexes':[{'name':_0x863f('0xb'),'fields':[_0x863f('0xb')]},{'name':_0x863f('0xc'),'fields':[_0x863f('0xc')]},{'name':_0x863f('0xd'),'fields':[_0x863f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdef=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x46f6b8,_0x38d1b5){var _0x42ac20=function(_0x4ffb46){while(--_0x4ffb46){_0x46f6b8['push'](_0x46f6b8['shift']());}};_0x42ac20(++_0x38d1b5);}(_0xfdef,0x15c));var _0xffde=function(_0x5a11a6,_0x3016be){_0x5a11a6=_0x5a11a6-0x0;var _0x587761=_0xfdef[_0x5a11a6];return _0x587761;};'use strict';var _=require(_0xffde('0x0'));var util=require(_0xffde('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xffde('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffde('0x3'));var rimraf=require(_0xffde('0x4'));var config=require(_0xffde('0x5'));var attributes=require(_0xffde('0x6'));module[_0xffde('0x7')]=function(_0x2b47da,_0x242c16){return _0x2b47da[_0xffde('0x8')](_0xffde('0x9'),attributes,{'tableName':_0xffde('0xa'),'paranoid':![],'indexes':[{'name':_0xffde('0xb'),'fields':[_0xffde('0xb')]},{'name':_0xffde('0xc'),'fields':[_0xffde('0xc')]},{'name':'priority','fields':[_0xffde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f52fd7b..ac534e7 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 _0x153b=['CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','model','attributes','map','GetCmHopper','ShowCmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','name','includes','UserId','push','all','MoveContactManagedDialer','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','length','GetCmHopperPreview','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x3db202,_0x5d257a){var _0x355009=function(_0x454b08){while(--_0x454b08){_0x3db202['push'](_0x3db202['shift']());}};_0x355009(++_0x5d257a);}(_0x153b,0xc6));var _0xb153=function(_0x49195d,_0x27556e){_0x49195d=_0x49195d-0x0;var _0x54fad8=_0x153b[_0x49195d];return _0x54fad8;};'use strict';var _=require('lodash');var util=require(_0xb153('0x0'));var moment=require('moment');var BPromise=require(_0xb153('0x1'));var rs=require(_0xb153('0x2'));var fs=require('fs');var Redis=require(_0xb153('0x3'));var db=require(_0xb153('0x4'))['db'];var utils=require(_0xb153('0x5'));var logger=require(_0xb153('0x6'))(_0xb153('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb153('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c1291,_0x52d694,_0x59e385){return new BPromise(function(_0x1e1599,_0x396212){return client[_0xb153('0x9')](_0x1c1291,_0x59e385)[_0xb153('0xa')](function(_0x1a48c5){logger[_0xb153('0xb')](_0xb153('0xc'),_0x52d694,_0xb153('0xd'));logger[_0xb153('0xe')](_0xb153('0xf'),_0x52d694,'request\x20sent',JSON[_0xb153('0x10')](_0x1a48c5));if(_0x1a48c5[_0xb153('0x11')]){if(_0x1a48c5['error'][_0xb153('0x12')]===0x1f4){logger[_0xb153('0x11')](_0xb153('0xc'),_0x52d694,_0x1a48c5[_0xb153('0x11')][_0xb153('0x13')]);return _0x396212(_0x1a48c5['error']['message']);}logger[_0xb153('0x11')](_0xb153('0xc'),_0x52d694,_0x1a48c5['error'][_0xb153('0x13')]);return _0x1e1599(_0x1a48c5['error'][_0xb153('0x13')]);}else{logger[_0xb153('0xb')](_0xb153('0xc'),_0x52d694,'request\x20sent');_0x1e1599(_0x1a48c5[_0xb153('0x14')][_0xb153('0x13')]);}})[_0xb153('0x15')](function(_0x42c52c){logger[_0xb153('0x11')](_0xb153('0xc'),_0x52d694,_0x42c52c);_0x396212(_0x42c52c);});});}exports['GetCmHopper']=function(_0x4bc280){var _0xd662c6=this;return new Promise(function(_0x173b21,_0x2c1066){return db[_0xb153('0x16')][_0xb153('0x17')]({'raw':_0x4bc280[_0xb153('0x18')]?_0x4bc280[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'where':_0x4bc280[_0xb153('0x18')]?_0x4bc280[_0xb153('0x18')][_0xb153('0x1a')]||null:null,'attributes':_0x4bc280['options']?_0x4bc280[_0xb153('0x18')]['attributes']||null:null,'limit':_0x4bc280['options']?_0x4bc280[_0xb153('0x18')][_0xb153('0x1b')]||null:null,'include':_0x4bc280[_0xb153('0x18')]?_0x4bc280[_0xb153('0x18')][_0xb153('0x1c')]?_['map'](_0x4bc280['options'][_0xb153('0x1c')],function(_0x4b6d18){return{'model':db[_0x4b6d18[_0xb153('0x1d')]],'as':_0x4b6d18['as'],'attributes':_0x4b6d18[_0xb153('0x1e')],'include':_0x4b6d18['include']?_[_0xb153('0x1f')](_0x4b6d18[_0xb153('0x1c')],function(_0x510b0a){return{'model':db[_0x510b0a[_0xb153('0x1d')]],'as':_0x510b0a['as'],'attributes':_0x510b0a['attributes'],'include':_0x510b0a[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x510b0a['include'],function(_0x17daa2){return{'model':db[_0x17daa2[_0xb153('0x1d')]],'as':_0x17daa2['as'],'attributes':_0x17daa2[_0xb153('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb153('0xa')](function(_0x56dcdb){logger[_0xb153('0xb')](_0xb153('0x20'),_0x4bc280);logger[_0xb153('0xe')](_0xb153('0x20'),_0x4bc280,JSON[_0xb153('0x10')](_0x56dcdb));_0x173b21(_0x56dcdb);})[_0xb153('0x15')](function(_0x5da52e){logger['error'](_0xb153('0x20'),_0x5da52e[_0xb153('0x13')],_0x4bc280);_0x2c1066(_0xd662c6[_0xb153('0x11')](0x1f4,_0x5da52e[_0xb153('0x13')]));});});};exports[_0xb153('0x21')]=function(_0xb5a55c){var _0x119527=this;return new Promise(function(_0x248c94,_0xabd249){return db[_0xb153('0x16')][_0xb153('0x22')]({'raw':_0xb5a55c[_0xb153('0x18')]?_0xb5a55c[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'where':_0xb5a55c['options']?_0xb5a55c['options'][_0xb153('0x1a')]||null:null,'attributes':_0xb5a55c[_0xb153('0x18')]?_0xb5a55c['options'][_0xb153('0x1e')]||null:null,'include':_0xb5a55c[_0xb153('0x18')]?_0xb5a55c[_0xb153('0x18')][_0xb153('0x1c')]?_[_0xb153('0x1f')](_0xb5a55c[_0xb153('0x18')][_0xb153('0x1c')],function(_0x32ead7){return{'model':db[_0x32ead7[_0xb153('0x1d')]],'as':_0x32ead7['as'],'attributes':_0x32ead7[_0xb153('0x1e')],'include':_0x32ead7[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x32ead7[_0xb153('0x1c')],function(_0x50e1b0){return{'model':db[_0x50e1b0[_0xb153('0x1d')]],'as':_0x50e1b0['as'],'attributes':_0x50e1b0[_0xb153('0x1e')],'include':_0x50e1b0[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x50e1b0[_0xb153('0x1c')],function(_0x22aba6){return{'model':db[_0x22aba6[_0xb153('0x1d')]],'as':_0x22aba6['as'],'attributes':_0x22aba6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb153('0xa')](function(_0xf202ac){logger[_0xb153('0xb')](_0xb153('0x21'),_0xb5a55c);logger['debug']('ShowCmHopper',_0xb5a55c,JSON[_0xb153('0x10')](_0xf202ac));_0x248c94(_0xf202ac);})['catch'](function(_0x23a97c){logger['error'](_0xb153('0x21'),_0x23a97c[_0xb153('0x13')],_0xb5a55c);_0xabd249(_0x119527[_0xb153('0x11')](0x1f4,_0x23a97c[_0xb153('0x13')]));});});};exports[_0xb153('0x23')]=function(_0x27d7c9){var _0x25fc5e=this;return new Promise(function(_0x4aa2ab,_0x513355){return db[_0xb153('0x16')]['create'](_0x27d7c9[_0xb153('0x24')],{'raw':_0x27d7c9['options']?_0x27d7c9[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![]})[_0xb153('0xa')](function(_0x432acf){logger['info'](_0xb153('0x23'),_0x27d7c9);logger[_0xb153('0xe')](_0xb153('0x23'),_0x27d7c9,JSON[_0xb153('0x10')](_0x432acf));_0x4aa2ab(_0x432acf);})[_0xb153('0x15')](function(_0x438a29){logger[_0xb153('0x11')]('CreateCmHopper',_0x438a29[_0xb153('0x13')],_0x27d7c9);_0x513355(_0x25fc5e['error'](0x1f4,_0x438a29[_0xb153('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3684bc){var _0x2fddc4=this;return new Promise(function(_0x43efdd,_0x444139){return db[_0xb153('0x16')][_0xb153('0x25')](_0x3684bc[_0xb153('0x24')],{'raw':_0x3684bc['options']?_0x3684bc[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3684bc[_0xb153('0x18')]?_0x3684bc[_0xb153('0x18')][_0xb153('0x1a')]||null:null,'attributes':_0x3684bc[_0xb153('0x18')]?_0x3684bc[_0xb153('0x18')][_0xb153('0x1e')]||null:null,'limit':_0x3684bc[_0xb153('0x18')]?_0x3684bc[_0xb153('0x18')][_0xb153('0x1b')]||null:null})[_0xb153('0xa')](function(_0x499f3e){logger[_0xb153('0xb')](_0xb153('0x26'),_0x3684bc);logger['debug']('UpdateCmHopper',_0x3684bc,JSON['stringify'](_0x499f3e));_0x43efdd(_0x499f3e);})[_0xb153('0x15')](function(_0x58a431){logger[_0xb153('0x11')](_0xb153('0x26'),_0x58a431[_0xb153('0x13')],_0x3684bc);_0x444139(_0x2fddc4[_0xb153('0x11')](0x1f4,_0x58a431[_0xb153('0x13')]));});});};exports[_0xb153('0x27')]=function(_0x5d2443){var _0xe3f391=this;return new Promise(function(_0x383476,_0x3289fa){return db[_0xb153('0x16')][_0xb153('0x28')]({'where':_0x5d2443[_0xb153('0x18')]?_0x5d2443['options'][_0xb153('0x1a')]||null:null})['then'](function(_0x10dd8f){logger[_0xb153('0xb')]('DestroyCmHopper',_0x5d2443);logger[_0xb153('0xe')](_0xb153('0x27'),_0x5d2443,JSON[_0xb153('0x10')](_0x10dd8f));_0x383476(_0x10dd8f);})[_0xb153('0x15')](function(_0x20f939){logger[_0xb153('0x11')](_0xb153('0x27'),_0x20f939[_0xb153('0x13')],_0x5d2443);_0x3289fa(_0xe3f391['error'](0x1f4,_0x20f939[_0xb153('0x13')]));});});};exports[_0xb153('0x29')]=function(_0x615149){var _0x3f147d=this;return new Promise(function(_0x3e92f2,_0x1b5b24){return db[_0xb153('0x2a')][_0xb153('0x2b')]()[_0xb153('0xa')](function(_0x27e812){return db[_0xb153('0x2c')][_0xb153('0x2d')](function(_0x4e33d3){return db[_0xb153('0x16')][_0xb153('0x17')]({'where':_0x615149[_0xb153('0x18')]?_0x615149[_0xb153('0x18')][_0xb153('0x1a')]||null:null,'attributes':_0x615149['options']?_0x615149[_0xb153('0x18')]['attributes']||null:null,'limit':_0x615149[_0xb153('0x18')]?_0x615149[_0xb153('0x18')][_0xb153('0x1b')]||null:null,'order':_0x615149[_0xb153('0x18')]?_0x615149[_0xb153('0x18')]['order']||null:null,'transaction':_0x4e33d3,'lock':_0x4e33d3[_0xb153('0x2e')][_0xb153('0x2f')],'include':[{'model':db[_0xb153('0x2a')],'as':_0xb153('0x30'),'attributes':_[_0xb153('0x31')](_0x27e812)},{'model':db['User'],'as':'Agent','attributes':['id',_0xb153('0x32'),'voicePause']}]})[_0xb153('0xa')](function(_0x53394f){var _0x252127=[];var _0x3598a8=[];for(var _0x3219ff=0x0;_0x3219ff<_0x53394f['length'];_0x3219ff+=0x1){if(!_0x3598a8[_0xb153('0x33')](_0x53394f[_0x3219ff][_0xb153('0x34')])){_0x3598a8[_0xb153('0x35')](_0x53394f[_0x3219ff]['UserId']);_0x252127[_0xb153('0x35')](_0x53394f[_0x3219ff]['update'](_0x615149[_0xb153('0x24')],{'transaction':_0x4e33d3}));}}return BPromise[_0xb153('0x36')](_0x252127);});})[_0xb153('0xa')](function(_0x18bf67){logger[_0xb153('0xb')](_0xb153('0x29'),_0x615149);logger[_0xb153('0xe')](_0xb153('0x29'),_0x615149,JSON[_0xb153('0x10')](_0x18bf67));_0x3e92f2(_0x18bf67);})[_0xb153('0x15')](function(_0x37a05e){logger[_0xb153('0x11')](_0xb153('0x29'),_0x37a05e['message'],_0x615149);_0x1b5b24(_0x3f147d[_0xb153('0x11')](0x1f4,_0x37a05e[_0xb153('0x13')]));});});});};exports[_0xb153('0x37')]=function(_0x22d350){var _0x1f89c5=this;return new Promise(function(_0x3efb24,_0x379009){return db['sequelize']['transaction'](function(_0x27055a){return db['CmHopperFinal'][_0xb153('0x38')](_0x22d350[_0xb153('0x24')],{'raw':_0x22d350['options']?_0x22d350[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'transaction':_0x27055a})[_0xb153('0xa')](function(){return db['CmHopper'][_0xb153('0x28')]({'where':_0x22d350[_0xb153('0x18')]?_0x22d350[_0xb153('0x18')]['where']||null:null,'transaction':_0x27055a});});})[_0xb153('0xa')](function(_0x34ecc8){logger[_0xb153('0xb')](_0xb153('0x37'),_0x22d350);logger[_0xb153('0xe')](_0xb153('0x37'),_0x22d350,JSON[_0xb153('0x10')](_0x34ecc8));_0x3efb24(_0x34ecc8);})[_0xb153('0x15')](function(_0xceaf8a){logger[_0xb153('0x11')](_0xb153('0x37'),_0xceaf8a['message'],_0x22d350);_0x379009(_0x1f89c5[_0xb153('0x11')](0x1f4,_0xceaf8a[_0xb153('0x13')]));});});};exports[_0xb153('0x39')]=function(_0x38f3fe){var _0x297cc1=this;return new Promise(function(_0x52327f,_0x143066){return db[_0xb153('0x16')][_0xb153('0x17')]({'raw':_0x38f3fe[_0xb153('0x18')]?_0x38f3fe[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'where':_0x38f3fe[_0xb153('0x18')]?_0x38f3fe[_0xb153('0x18')][_0xb153('0x1a')]||null:null,'attributes':[[db[_0xb153('0x2c')]['fn'](_0xb153('0x3a'),db[_0xb153('0x2c')]['fn']('IF',db[_0xb153('0x2c')][_0xb153('0x3b')](_0xb153('0x3c')+util['format'](_0xb153('0x3d'),moment()[_0xb153('0x3e')](_0xb153('0x3f')))+_0xb153('0x40')))),_0xb153('0x41')]]})[_0xb153('0xa')](function(_0x27e803){logger[_0xb153('0xb')]('CountReScheduled',_0x38f3fe);logger[_0xb153('0xe')](_0xb153('0x39'),_0x38f3fe,JSON[_0xb153('0x10')](_0x27e803));_0x52327f(_0x27e803);})[_0xb153('0x15')](function(_0x216da7){logger[_0xb153('0x11')](_0xb153('0x39'),_0x216da7[_0xb153('0x13')],_0x38f3fe);_0x143066(_0x297cc1[_0xb153('0x11')](0x1f4,_0x216da7[_0xb153('0x13')]));});});};exports[_0xb153('0x42')]=function(_0x4bda7d){var _0x1f636c=this;return new Promise(function(_0x377e57,_0x785881){return db[_0xb153('0x2a')][_0xb153('0x2b')]()[_0xb153('0xa')](function(_0x224361){return db[_0xb153('0x2c')][_0xb153('0x2d')](function(_0x2fd8f7){return db[_0xb153('0x16')][_0xb153('0x17')]({'where':_0x4bda7d['options']?_0x4bda7d[_0xb153('0x18')][_0xb153('0x1a')]||null:null,'attributes':_0x4bda7d['options']?_0x4bda7d['options']['attributes']||null:null,'limit':0x1,'order':_0x4bda7d[_0xb153('0x18')]?_0x4bda7d[_0xb153('0x18')][_0xb153('0x43')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x2fd8f7,'lock':_0x2fd8f7[_0xb153('0x2e')][_0xb153('0x2f')],'include':_0x4bda7d['options']?_0x4bda7d[_0xb153('0x18')][_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x4bda7d[_0xb153('0x18')][_0xb153('0x1c')],function(_0x17ef45){return{'model':db[_0x17ef45[_0xb153('0x1d')]],'as':_0x17ef45['as'],'attributes':_0x17ef45[_0xb153('0x1e')],'include':_0x17ef45[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x17ef45[_0xb153('0x1c')],function(_0x32f0ac){return{'model':db[_0x32f0ac[_0xb153('0x1d')]],'as':_0x32f0ac['as'],'attributes':_0x32f0ac['attributes'],'include':_0x32f0ac[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x32f0ac[_0xb153('0x1c')],function(_0x45ed98){return{'model':db[_0x45ed98[_0xb153('0x1d')]],'as':_0x45ed98['as'],'attributes':_0x45ed98[_0xb153('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb153('0xa')](function(_0x44d121){var _0x2b240f=[];for(var _0x21df3d=0x0;_0x21df3d<_0x44d121[_0xb153('0x44')];_0x21df3d+=0x1){_0x2b240f[_0xb153('0x35')](_0x44d121[_0x21df3d][_0xb153('0x25')](_0x4bda7d[_0xb153('0x24')],{'transaction':_0x2fd8f7}));}return BPromise[_0xb153('0x36')](_0x2b240f);});})[_0xb153('0xa')](function(_0x317d83){logger[_0xb153('0xb')](_0xb153('0x42'),_0x4bda7d);logger[_0xb153('0xe')]('GetContactRecallMe',_0x4bda7d,JSON[_0xb153('0x10')](_0x317d83));_0x377e57(_0x317d83);})[_0xb153('0x15')](function(_0x5ef1b4){logger[_0xb153('0x11')](_0xb153('0x42'),_0x5ef1b4[_0xb153('0x13')],_0x4bda7d);_0x785881(_0x1f636c['error'](0x1f4,_0x5ef1b4[_0xb153('0x13')]));});});});};exports[_0xb153('0x45')]=function(_0x36828f){var _0xc047e8=this;return new Promise(function(_0x25d5b3,_0x47749a){db[_0xb153('0x2a')][_0xb153('0x2b')]()['then'](function(_0x58f1ce){return db[_0xb153('0x16')][_0xb153('0x17')]({'raw':_0x36828f[_0xb153('0x18')]?_0x36828f[_0xb153('0x18')][_0xb153('0x19')]===undefined?!![]:![]:!![],'where':_0x36828f[_0xb153('0x18')]?_0x36828f['options'][_0xb153('0x1a')]||null:null,'attributes':_0x36828f[_0xb153('0x18')]?_0x36828f[_0xb153('0x18')][_0xb153('0x1e')]||null:null,'limit':_0x36828f[_0xb153('0x18')]?_0x36828f['options'][_0xb153('0x1b')]||null:null,'include':_0x36828f['options']?_0x36828f[_0xb153('0x18')][_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x36828f['options'][_0xb153('0x1c')],function(_0x54b717){return{'model':db[_0x54b717[_0xb153('0x1d')]],'as':_0x54b717['as'],'attributes':_0x54b717['as']===_0xb153('0x30')?_[_0xb153('0x31')](_0x58f1ce):_0x54b717[_0xb153('0x1e')],'include':_0x54b717['include']?_['map'](_0x54b717['include'],function(_0x4eef49){return{'model':db[_0x4eef49[_0xb153('0x1d')]],'as':_0x4eef49['as'],'attributes':_0x4eef49[_0xb153('0x1e')],'include':_0x4eef49[_0xb153('0x1c')]?_[_0xb153('0x1f')](_0x4eef49[_0xb153('0x1c')],function(_0x52ec32){return{'model':db[_0x52ec32[_0xb153('0x1d')]],'as':_0x52ec32['as'],'attributes':_0x52ec32[_0xb153('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb153('0xa')](function(_0x21182f){logger[_0xb153('0xb')]('GetCmHopper',_0x36828f);logger[_0xb153('0xe')]('GetCmHopper',_0x36828f,JSON[_0xb153('0x10')](_0x21182f));_0x25d5b3(_0x21182f);})[_0xb153('0x15')](function(_0x125145){logger[_0xb153('0x11')](_0xb153('0x20'),_0x125145[_0xb153('0x13')],_0x36828f);_0x47749a(_0xc047e8[_0xb153('0x11')](0x1f4,_0x125145[_0xb153('0x13')]));});});});}; \ No newline at end of file +var _0x61ab=['\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','CmHopper,\x20%s,\x20%s','catch','GetCmHopper','options','raw','where','include','map','model','attributes','ShowCmHopper','CmHopper','find','CreateCmHopper','body','limit','UpdateCmHopper','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','keys','Agent','name','length','includes','UserId','push','update','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','format'];(function(_0x5b55b1,_0x1e36e6){var _0x2a4e3f=function(_0x338bc6){while(--_0x338bc6){_0x5b55b1['push'](_0x5b55b1['shift']());}};_0x2a4e3f(++_0x1e36e6);}(_0x61ab,0x127));var _0xb61a=function(_0x339e9b,_0x4252fe){_0x339e9b=_0x339e9b-0x0;var _0x4f63ab=_0x61ab[_0x339e9b];return _0x4f63ab;};'use strict';var _=require(_0xb61a('0x0'));var util=require(_0xb61a('0x1'));var moment=require(_0xb61a('0x2'));var BPromise=require(_0xb61a('0x3'));var rs=require(_0xb61a('0x4'));var fs=require('fs');var Redis=require(_0xb61a('0x5'));var db=require(_0xb61a('0x6'))['db'];var utils=require(_0xb61a('0x7'));var logger=require(_0xb61a('0x8'))(_0xb61a('0x9'));var config=require(_0xb61a('0xa'));var jayson=require(_0xb61a('0xb'));var client=jayson[_0xb61a('0xc')][_0xb61a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x107b0c,_0xa41ee2,_0x5f2371){return new BPromise(function(_0x59a3b2,_0x1bc580){return client[_0xb61a('0xe')](_0x107b0c,_0x5f2371)[_0xb61a('0xf')](function(_0x2bb0ff){logger[_0xb61a('0x10')]('CmHopper,\x20%s,\x20%s',_0xa41ee2,_0xb61a('0x11'));logger[_0xb61a('0x12')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xa41ee2,_0xb61a('0x11'),JSON[_0xb61a('0x13')](_0x2bb0ff));if(_0x2bb0ff['error']){if(_0x2bb0ff[_0xb61a('0x14')]['code']===0x1f4){logger[_0xb61a('0x14')]('CmHopper,\x20%s,\x20%s',_0xa41ee2,_0x2bb0ff[_0xb61a('0x14')]['message']);return _0x1bc580(_0x2bb0ff[_0xb61a('0x14')]['message']);}logger[_0xb61a('0x14')]('CmHopper,\x20%s,\x20%s',_0xa41ee2,_0x2bb0ff[_0xb61a('0x14')][_0xb61a('0x15')]);return _0x59a3b2(_0x2bb0ff[_0xb61a('0x14')][_0xb61a('0x15')]);}else{logger[_0xb61a('0x10')](_0xb61a('0x16'),_0xa41ee2,_0xb61a('0x11'));_0x59a3b2(_0x2bb0ff['result'][_0xb61a('0x15')]);}})[_0xb61a('0x17')](function(_0x514230){logger[_0xb61a('0x14')](_0xb61a('0x16'),_0xa41ee2,_0x514230);_0x1bc580(_0x514230);});});}exports[_0xb61a('0x18')]=function(_0x24945e){var _0x3b91e7=this;return new Promise(function(_0x5d12f5,_0x36164a){return db['CmHopper']['findAll']({'raw':_0x24945e[_0xb61a('0x19')]?_0x24945e[_0xb61a('0x19')][_0xb61a('0x1a')]===undefined?!![]:![]:!![],'where':_0x24945e[_0xb61a('0x19')]?_0x24945e[_0xb61a('0x19')][_0xb61a('0x1b')]||null:null,'attributes':_0x24945e['options']?_0x24945e['options']['attributes']||null:null,'limit':_0x24945e[_0xb61a('0x19')]?_0x24945e[_0xb61a('0x19')]['limit']||null:null,'include':_0x24945e[_0xb61a('0x19')]?_0x24945e['options'][_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x24945e[_0xb61a('0x19')]['include'],function(_0x391943){return{'model':db[_0x391943[_0xb61a('0x1e')]],'as':_0x391943['as'],'attributes':_0x391943['attributes'],'include':_0x391943[_0xb61a('0x1c')]?_['map'](_0x391943[_0xb61a('0x1c')],function(_0x19acbf){return{'model':db[_0x19acbf['model']],'as':_0x19acbf['as'],'attributes':_0x19acbf[_0xb61a('0x1f')],'include':_0x19acbf[_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x19acbf[_0xb61a('0x1c')],function(_0x10e91e){return{'model':db[_0x10e91e['model']],'as':_0x10e91e['as'],'attributes':_0x10e91e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb61a('0xf')](function(_0x185905){logger[_0xb61a('0x10')](_0xb61a('0x18'),_0x24945e);logger[_0xb61a('0x12')]('GetCmHopper',_0x24945e,JSON['stringify'](_0x185905));_0x5d12f5(_0x185905);})['catch'](function(_0x16fd29){logger['error'](_0xb61a('0x18'),_0x16fd29[_0xb61a('0x15')],_0x24945e);_0x36164a(_0x3b91e7[_0xb61a('0x14')](0x1f4,_0x16fd29['message']));});});};exports[_0xb61a('0x20')]=function(_0x1ec8d6){var _0x3de35e=this;return new Promise(function(_0x3d756d,_0x24dec6){return db[_0xb61a('0x21')][_0xb61a('0x22')]({'raw':_0x1ec8d6[_0xb61a('0x19')]?_0x1ec8d6[_0xb61a('0x19')][_0xb61a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ec8d6[_0xb61a('0x19')]?_0x1ec8d6[_0xb61a('0x19')][_0xb61a('0x1b')]||null:null,'attributes':_0x1ec8d6[_0xb61a('0x19')]?_0x1ec8d6['options'][_0xb61a('0x1f')]||null:null,'include':_0x1ec8d6[_0xb61a('0x19')]?_0x1ec8d6['options'][_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x1ec8d6[_0xb61a('0x19')][_0xb61a('0x1c')],function(_0x5cec81){return{'model':db[_0x5cec81[_0xb61a('0x1e')]],'as':_0x5cec81['as'],'attributes':_0x5cec81[_0xb61a('0x1f')],'include':_0x5cec81[_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x5cec81['include'],function(_0x434192){return{'model':db[_0x434192['model']],'as':_0x434192['as'],'attributes':_0x434192[_0xb61a('0x1f')],'include':_0x434192['include']?_[_0xb61a('0x1d')](_0x434192['include'],function(_0x2c6bf2){return{'model':db[_0x2c6bf2['model']],'as':_0x2c6bf2['as'],'attributes':_0x2c6bf2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb61a('0xf')](function(_0x501e88){logger[_0xb61a('0x10')]('ShowCmHopper',_0x1ec8d6);logger[_0xb61a('0x12')](_0xb61a('0x20'),_0x1ec8d6,JSON[_0xb61a('0x13')](_0x501e88));_0x3d756d(_0x501e88);})[_0xb61a('0x17')](function(_0x406437){logger['error'](_0xb61a('0x20'),_0x406437['message'],_0x1ec8d6);_0x24dec6(_0x3de35e[_0xb61a('0x14')](0x1f4,_0x406437['message']));});});};exports[_0xb61a('0x23')]=function(_0xecd71a){var _0x5b06e0=this;return new Promise(function(_0x14b985,_0x5243c8){return db[_0xb61a('0x21')]['create'](_0xecd71a[_0xb61a('0x24')],{'raw':_0xecd71a[_0xb61a('0x19')]?_0xecd71a[_0xb61a('0x19')][_0xb61a('0x1a')]===undefined?!![]:![]:!![]})[_0xb61a('0xf')](function(_0x1ef71c){logger[_0xb61a('0x10')](_0xb61a('0x23'),_0xecd71a);logger[_0xb61a('0x12')](_0xb61a('0x23'),_0xecd71a,JSON[_0xb61a('0x13')](_0x1ef71c));_0x14b985(_0x1ef71c);})[_0xb61a('0x17')](function(_0x1911d4){logger[_0xb61a('0x14')]('CreateCmHopper',_0x1911d4[_0xb61a('0x15')],_0xecd71a);_0x5243c8(_0x5b06e0[_0xb61a('0x14')](0x1f4,_0x1911d4['message']));});});};exports['UpdateCmHopper']=function(_0x51e434){var _0x489d25=this;return new Promise(function(_0xda704d,_0x5513cf){return db[_0xb61a('0x21')]['update'](_0x51e434[_0xb61a('0x24')],{'raw':_0x51e434[_0xb61a('0x19')]?_0x51e434[_0xb61a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e434['options']?_0x51e434[_0xb61a('0x19')][_0xb61a('0x1b')]||null:null,'attributes':_0x51e434[_0xb61a('0x19')]?_0x51e434[_0xb61a('0x19')][_0xb61a('0x1f')]||null:null,'limit':_0x51e434[_0xb61a('0x19')]?_0x51e434[_0xb61a('0x19')][_0xb61a('0x25')]||null:null})[_0xb61a('0xf')](function(_0x4c950a){logger[_0xb61a('0x10')](_0xb61a('0x26'),_0x51e434);logger[_0xb61a('0x12')]('UpdateCmHopper',_0x51e434,JSON['stringify'](_0x4c950a));_0xda704d(_0x4c950a);})[_0xb61a('0x17')](function(_0x2a760f){logger[_0xb61a('0x14')]('UpdateCmHopper',_0x2a760f[_0xb61a('0x15')],_0x51e434);_0x5513cf(_0x489d25[_0xb61a('0x14')](0x1f4,_0x2a760f[_0xb61a('0x15')]));});});};exports[_0xb61a('0x27')]=function(_0x55a649){var _0x299675=this;return new Promise(function(_0x2ce7ed,_0x3a648d){return db[_0xb61a('0x21')][_0xb61a('0x28')]({'where':_0x55a649[_0xb61a('0x19')]?_0x55a649[_0xb61a('0x19')]['where']||null:null})[_0xb61a('0xf')](function(_0x23547d){logger[_0xb61a('0x10')](_0xb61a('0x27'),_0x55a649);logger[_0xb61a('0x12')](_0xb61a('0x27'),_0x55a649,JSON[_0xb61a('0x13')](_0x23547d));_0x2ce7ed(_0x23547d);})['catch'](function(_0x311cc4){logger[_0xb61a('0x14')](_0xb61a('0x27'),_0x311cc4[_0xb61a('0x15')],_0x55a649);_0x3a648d(_0x299675[_0xb61a('0x14')](0x1f4,_0x311cc4['message']));});});};exports['GetContactDialer']=function(_0x40ba52){var _0x3acbea=this;return new Promise(function(_0x4b2737,_0x272af9){return db[_0xb61a('0x29')][_0xb61a('0x2a')]()[_0xb61a('0xf')](function(_0x50e36e){return db[_0xb61a('0x2b')][_0xb61a('0x2c')](function(_0x2bceb6){return db[_0xb61a('0x21')][_0xb61a('0x2d')]({'where':_0x40ba52['options']?_0x40ba52[_0xb61a('0x19')]['where']||null:null,'attributes':_0x40ba52['options']?_0x40ba52['options'][_0xb61a('0x1f')]||null:null,'limit':_0x40ba52[_0xb61a('0x19')]?_0x40ba52[_0xb61a('0x19')][_0xb61a('0x25')]||null:null,'order':_0x40ba52[_0xb61a('0x19')]?_0x40ba52[_0xb61a('0x19')][_0xb61a('0x2e')]||null:null,'transaction':_0x2bceb6,'lock':_0x2bceb6[_0xb61a('0x2f')]['UPDATE'],'include':[{'model':db[_0xb61a('0x29')],'as':'Contact','attributes':_[_0xb61a('0x30')](_0x50e36e)},{'model':db['User'],'as':_0xb61a('0x31'),'attributes':['id',_0xb61a('0x32'),'voicePause']}]})[_0xb61a('0xf')](function(_0x4963d0){var _0x2eec63=[];var _0xbbf4cb=[];for(var _0x4b70c3=0x0;_0x4b70c3<_0x4963d0[_0xb61a('0x33')];_0x4b70c3+=0x1){if(!_0xbbf4cb[_0xb61a('0x34')](_0x4963d0[_0x4b70c3][_0xb61a('0x35')])){_0xbbf4cb[_0xb61a('0x36')](_0x4963d0[_0x4b70c3]['UserId']);_0x2eec63[_0xb61a('0x36')](_0x4963d0[_0x4b70c3][_0xb61a('0x37')](_0x40ba52[_0xb61a('0x24')],{'transaction':_0x2bceb6}));}}return BPromise[_0xb61a('0x38')](_0x2eec63);});})['then'](function(_0x11b9b1){logger[_0xb61a('0x10')]('GetContactDialer',_0x40ba52);logger['debug']('GetContactDialer',_0x40ba52,JSON[_0xb61a('0x13')](_0x11b9b1));_0x4b2737(_0x11b9b1);})['catch'](function(_0x2624e9){logger[_0xb61a('0x14')](_0xb61a('0x39'),_0x2624e9[_0xb61a('0x15')],_0x40ba52);_0x272af9(_0x3acbea[_0xb61a('0x14')](0x1f4,_0x2624e9[_0xb61a('0x15')]));});});});};exports[_0xb61a('0x3a')]=function(_0x25e430){var _0x13edf2=this;return new Promise(function(_0x133446,_0x4fc165){return db[_0xb61a('0x2b')][_0xb61a('0x2c')](function(_0x257329){return db[_0xb61a('0x3b')][_0xb61a('0x3c')](_0x25e430['body'],{'raw':_0x25e430[_0xb61a('0x19')]?_0x25e430[_0xb61a('0x19')][_0xb61a('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x257329})[_0xb61a('0xf')](function(){return db[_0xb61a('0x21')][_0xb61a('0x28')]({'where':_0x25e430['options']?_0x25e430['options']['where']||null:null,'transaction':_0x257329});});})['then'](function(_0x59ccf2){logger[_0xb61a('0x10')](_0xb61a('0x3a'),_0x25e430);logger['debug'](_0xb61a('0x3a'),_0x25e430,JSON[_0xb61a('0x13')](_0x59ccf2));_0x133446(_0x59ccf2);})['catch'](function(_0x18d142){logger[_0xb61a('0x14')](_0xb61a('0x3a'),_0x18d142[_0xb61a('0x15')],_0x25e430);_0x4fc165(_0x13edf2[_0xb61a('0x14')](0x1f4,_0x18d142[_0xb61a('0x15')]));});});};exports[_0xb61a('0x3d')]=function(_0xfe60ce){var _0x14a3c0=this;return new Promise(function(_0x360075,_0x35d598){return db['CmHopper'][_0xb61a('0x2d')]({'raw':_0xfe60ce[_0xb61a('0x19')]?_0xfe60ce[_0xb61a('0x19')][_0xb61a('0x1a')]===undefined?!![]:![]:!![],'where':_0xfe60ce['options']?_0xfe60ce[_0xb61a('0x19')][_0xb61a('0x1b')]||null:null,'attributes':[[db[_0xb61a('0x2b')]['fn'](_0xb61a('0x3e'),db[_0xb61a('0x2b')]['fn']('IF',db['sequelize'][_0xb61a('0x3f')]('`scheduledat`\x20>=\x20'+util[_0xb61a('0x40')](_0xb61a('0x41'),moment()['format'](_0xb61a('0x42')))+_0xb61a('0x43')))),_0xb61a('0x44')]]})[_0xb61a('0xf')](function(_0x1585f0){logger[_0xb61a('0x10')](_0xb61a('0x3d'),_0xfe60ce);logger[_0xb61a('0x12')](_0xb61a('0x3d'),_0xfe60ce,JSON[_0xb61a('0x13')](_0x1585f0));_0x360075(_0x1585f0);})[_0xb61a('0x17')](function(_0x19afff){logger['error'](_0xb61a('0x3d'),_0x19afff[_0xb61a('0x15')],_0xfe60ce);_0x35d598(_0x14a3c0['error'](0x1f4,_0x19afff[_0xb61a('0x15')]));});});};exports['GetContactRecallMe']=function(_0x3df0b2){var _0x5c86b1=this;return new Promise(function(_0xdf2168,_0x2a2662){return db['CmContact']['describe']()[_0xb61a('0xf')](function(_0x187e41){return db['sequelize']['transaction'](function(_0x2fa116){return db[_0xb61a('0x21')][_0xb61a('0x2d')]({'where':_0x3df0b2[_0xb61a('0x19')]?_0x3df0b2['options']['where']||null:null,'attributes':_0x3df0b2[_0xb61a('0x19')]?_0x3df0b2[_0xb61a('0x19')][_0xb61a('0x1f')]||null:null,'limit':0x1,'order':_0x3df0b2[_0xb61a('0x19')]?_0x3df0b2['options']['order']||null:null,'group':db['CmHopper'][_0xb61a('0x35')],'transaction':_0x2fa116,'lock':_0x2fa116[_0xb61a('0x2f')]['UPDATE'],'include':_0x3df0b2[_0xb61a('0x19')]?_0x3df0b2['options'][_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x3df0b2[_0xb61a('0x19')][_0xb61a('0x1c')],function(_0x4d211a){return{'model':db[_0x4d211a[_0xb61a('0x1e')]],'as':_0x4d211a['as'],'attributes':_0x4d211a[_0xb61a('0x1f')],'include':_0x4d211a['include']?_[_0xb61a('0x1d')](_0x4d211a[_0xb61a('0x1c')],function(_0x1bcf23){return{'model':db[_0x1bcf23[_0xb61a('0x1e')]],'as':_0x1bcf23['as'],'attributes':_0x1bcf23[_0xb61a('0x1f')],'include':_0x1bcf23[_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x1bcf23[_0xb61a('0x1c')],function(_0x4fb892){return{'model':db[_0x4fb892[_0xb61a('0x1e')]],'as':_0x4fb892['as'],'attributes':_0x4fb892['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b8fcc){var _0x383eb9=[];for(var _0x277063=0x0;_0x277063<_0x1b8fcc[_0xb61a('0x33')];_0x277063+=0x1){_0x383eb9['push'](_0x1b8fcc[_0x277063][_0xb61a('0x37')](_0x3df0b2[_0xb61a('0x24')],{'transaction':_0x2fa116}));}return BPromise['all'](_0x383eb9);});})[_0xb61a('0xf')](function(_0x5b2d5d){logger[_0xb61a('0x10')]('GetContactRecallMe',_0x3df0b2);logger[_0xb61a('0x12')](_0xb61a('0x45'),_0x3df0b2,JSON[_0xb61a('0x13')](_0x5b2d5d));_0xdf2168(_0x5b2d5d);})['catch'](function(_0x172135){logger['error'](_0xb61a('0x45'),_0x172135[_0xb61a('0x15')],_0x3df0b2);_0x2a2662(_0x5c86b1[_0xb61a('0x14')](0x1f4,_0x172135[_0xb61a('0x15')]));});});});};exports[_0xb61a('0x46')]=function(_0x1d2d90){var _0xa1039f=this;return new Promise(function(_0x3f9704,_0x5d083d){db[_0xb61a('0x29')][_0xb61a('0x2a')]()[_0xb61a('0xf')](function(_0x57749f){return db['CmHopper'][_0xb61a('0x2d')]({'raw':_0x1d2d90['options']?_0x1d2d90['options'][_0xb61a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d2d90[_0xb61a('0x19')]?_0x1d2d90[_0xb61a('0x19')][_0xb61a('0x1b')]||null:null,'attributes':_0x1d2d90[_0xb61a('0x19')]?_0x1d2d90[_0xb61a('0x19')][_0xb61a('0x1f')]||null:null,'limit':_0x1d2d90[_0xb61a('0x19')]?_0x1d2d90[_0xb61a('0x19')]['limit']||null:null,'include':_0x1d2d90[_0xb61a('0x19')]?_0x1d2d90[_0xb61a('0x19')][_0xb61a('0x1c')]?_[_0xb61a('0x1d')](_0x1d2d90[_0xb61a('0x19')][_0xb61a('0x1c')],function(_0x3bd58a){return{'model':db[_0x3bd58a[_0xb61a('0x1e')]],'as':_0x3bd58a['as'],'attributes':_0x3bd58a['as']===_0xb61a('0x47')?_[_0xb61a('0x30')](_0x57749f):_0x3bd58a[_0xb61a('0x1f')],'include':_0x3bd58a['include']?_[_0xb61a('0x1d')](_0x3bd58a[_0xb61a('0x1c')],function(_0x3154dc){return{'model':db[_0x3154dc[_0xb61a('0x1e')]],'as':_0x3154dc['as'],'attributes':_0x3154dc[_0xb61a('0x1f')],'include':_0x3154dc['include']?_[_0xb61a('0x1d')](_0x3154dc[_0xb61a('0x1c')],function(_0x5f3665){return{'model':db[_0x5f3665[_0xb61a('0x1e')]],'as':_0x5f3665['as'],'attributes':_0x5f3665[_0xb61a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb61a('0xf')](function(_0x1b1582){logger[_0xb61a('0x10')](_0xb61a('0x18'),_0x1d2d90);logger[_0xb61a('0x12')]('GetCmHopper',_0x1d2d90,JSON[_0xb61a('0x13')](_0x1b1582));_0x3f9704(_0x1b1582);})[_0xb61a('0x17')](function(_0x2183e3){logger[_0xb61a('0x14')]('GetCmHopper',_0x2183e3[_0xb61a('0x15')],_0x1d2d90);_0x5d083d(_0xa1039f['error'](0x1f4,_0x2183e3[_0xb61a('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index fed52d2..492b911 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 _0x207c=['/timezone','getTimezone','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts','/timezones','getTimezones','/:id','post','/preview','getPreview'];(function(_0x1af46c,_0x3eb0cd){var _0x56c554=function(_0x4197d1){while(--_0x4197d1){_0x1af46c['push'](_0x1af46c['shift']());}};_0x56c554(++_0x3eb0cd);}(_0x207c,0x1e8));var _0xc207=function(_0x558222,_0x105cdb){_0x558222=_0x558222-0x0;var _0x4e1044=_0x207c[_0x558222];return _0x4e1044;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['getOpenContacts']);router[_0xc207('0x8')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0x8')](_0xc207('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc207('0xa')](),controller['create']);router[_0xc207('0xf')](_0xc207('0x10'),auth['isAuthenticated'](),controller[_0xc207('0x11')]);router[_0xc207('0xf')](_0xc207('0x12'),auth[_0xc207('0xa')](),controller[_0xc207('0x13')]);router['put'](_0xc207('0xe'),auth[_0xc207('0xa')](),controller[_0xc207('0x14')]);router[_0xc207('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc207('0x16')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','get','/:id','show','post','create','/preview','getPreview','/timezone','getTimezone','delete','destroy','multer','path'];(function(_0x2e5a33,_0x2e768c){var _0x1f5221=function(_0x29f9df){while(--_0x29f9df){_0x2e5a33['push'](_0x2e5a33['shift']());}};_0x1f5221(++_0x2e768c);}(_0x6aa7,0x178));var _0x76aa=function(_0x567ad7,_0xd29289){_0x567ad7=_0x567ad7-0x0;var _0x1ac59e=_0x6aa7[_0x567ad7];return _0x1ac59e;};'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['get'](_0x76aa('0xe'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0x11'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x12')]);router[_0x76aa('0x13')]('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0x14')]);router['post'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x13')](_0x76aa('0x17'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x18')]);router['put']('/:id',auth[_0x76aa('0xa')](),controller['update']);router[_0x76aa('0x19')](_0x76aa('0x11'),auth['isAuthenticated'](),controller[_0x76aa('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 0c29341..3696b5d 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 _0xac83=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xac83,0x15b));var _0x3ac8=function(_0x225b4e,_0x179ee4){_0x225b4e=_0x225b4e-0x0;var _0x24237a=_0xac83[_0x225b4e];return _0x24237a;};'use strict';var moment=require(_0x3ac8('0x0'));var Sequelize=require(_0x3ac8('0x1'));module[_0x3ac8('0x2')]={'CmHopperId':{'type':Sequelize[_0x3ac8('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3ac8('0x4')],'defaultValue':moment()[_0x3ac8('0x5')](_0x3ac8('0x6'))},'countbusyretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3ac8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa64c=['exports','INTEGER','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x1b1ea4,_0x2c77f0){var _0x24cbd8=function(_0x1d8c5e){while(--_0x1d8c5e){_0x1b1ea4['push'](_0x1b1ea4['shift']());}};_0x24cbd8(++_0x2c77f0);}(_0xa64c,0x16b));var _0xca64=function(_0x32d56a,_0x4c07bf){_0x32d56a=_0x32d56a-0x0;var _0x139bf1=_0xa64c[_0x32d56a];return _0x139bf1;};'use strict';var moment=require(_0xca64('0x0'));var Sequelize=require('sequelize');module[_0xca64('0x1')]={'CmHopperId':{'type':Sequelize[_0xca64('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xca64('0x3'))},'countbusyretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca64('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index ceb1ace..db69ed2 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 _0x39e6=['end','json','count','offset','limit','set','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','where','pick','filter','merge','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status'];(function(_0x3e0600,_0x9bb3c9){var _0x5e1117=function(_0x508ca2){while(--_0x508ca2){_0x3e0600['push'](_0x3e0600['shift']());}};_0x5e1117(++_0x9bb3c9);}(_0x39e6,0x173));var _0x639e=function(_0x20bbaa,_0x2d39be){_0x20bbaa=_0x20bbaa-0x0;var _0x33e6c5=_0x39e6[_0x20bbaa];return _0x33e6c5;};'use strict';var pdf=require(_0x639e('0x0'));var emlformat=require(_0x639e('0x1'));var rimraf=require(_0x639e('0x2'));var zipdir=require(_0x639e('0x3'));var jsonpatch=require(_0x639e('0x4'));var rp=require('request-promise');var moment=require(_0x639e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x639e('0x6'));var util=require(_0x639e('0x7'));var path=require(_0x639e('0x8'));var sox=require(_0x639e('0x9'));var csv=require(_0x639e('0xa'));var ejs=require(_0x639e('0xb'));var fs=require('fs');var _=require(_0x639e('0xc'));var squel=require('squel');var crypto=require(_0x639e('0xd'));var jsforce=require(_0x639e('0xe'));var deskjs=require(_0x639e('0xf'));var toCsv=require(_0x639e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x639e('0x10'));var authService=require(_0x639e('0x11'));var qs=require(_0x639e('0x12'));var as=require(_0x639e('0x13'));var hardwareService=require(_0x639e('0x14'));var logger=require(_0x639e('0x15'))(_0x639e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238df1,_0x36e124){_0x36e124=_0x36e124||0xcc;return function(_0x57af7a){if(_0x57af7a){return _0x238df1['sendStatus'](_0x36e124);}return _0x238df1[_0x639e('0x17')](_0x36e124)[_0x639e('0x18')]();};}function respondWithResult(_0x3c8c3b,_0x38d123){_0x38d123=_0x38d123||0xc8;return function(_0x4d5d38){if(_0x4d5d38){return _0x3c8c3b[_0x639e('0x17')](_0x38d123)[_0x639e('0x19')](_0x4d5d38);}};}function respondWithFilteredResult(_0x2b90c8,_0x51c57d){return function(_0x33522b){if(_0x33522b){var _0x2266c2=_0x33522b[_0x639e('0x1a')],_0x5c758c=_0x51c57d[_0x639e('0x1b')],_0x45d061=_0x51c57d[_0x639e('0x1b')]+_0x51c57d[_0x639e('0x1c')],_0x23ec43;if(_0x45d061>=_0x2266c2){_0x45d061=_0x2266c2;_0x23ec43=0xc8;}else{_0x23ec43=0xce;}_0x2b90c8[_0x639e('0x17')](_0x23ec43);return _0x2b90c8[_0x639e('0x1d')]('Content-Range',_0x5c758c+'-'+_0x45d061+'/'+_0x2266c2)['json'](_0x33522b);}return null;};}function patchUpdates(_0x25742a){return function(_0x3f8060){try{jsonpatch[_0x639e('0x1e')](_0x3f8060,_0x25742a,!![]);}catch(_0x5b933c){return BPromise[_0x639e('0x1f')](_0x5b933c);}return _0x3f8060['save']();};}function saveUpdates(_0x40ca3e,_0xeeb33e){return function(_0x484401){if(_0x484401){return _0x484401[_0x639e('0x20')](_0x40ca3e)[_0x639e('0x21')](function(_0x5ea455){return _0x5ea455;});}return null;};}function removeEntity(_0x20a5fd,_0x1c28b3){return function(_0x363dce){if(_0x363dce){return _0x363dce[_0x639e('0x22')]()[_0x639e('0x21')](function(){var _0x3bbdc7=_0x363dce['get']({'plain':!![]});var _0x20b57e=_0x639e('0x23');return db[_0x639e('0x24')][_0x639e('0x22')]({'where':{'type':_0x20b57e,'resourceId':_0x3bbdc7['id']}})[_0x639e('0x21')](function(){return _0x363dce;});})['then'](function(){_0x20a5fd['status'](0xcc)[_0x639e('0x18')]();});}};}function handleEntityNotFound(_0x586f1e,_0x2edd24){return function(_0x50d077){if(!_0x50d077){_0x586f1e[_0x639e('0x25')](0x194);}return _0x50d077;};}function handleError(_0x48a069,_0x1544a9){_0x1544a9=_0x1544a9||0x1f4;return function(_0x30f275){logger[_0x639e('0x26')](_0x30f275['stack']);if(_0x30f275['name']){delete _0x30f275[_0x639e('0x27')];}_0x48a069['status'](_0x1544a9)[_0x639e('0x28')](_0x30f275);};}exports[_0x639e('0x29')]=function(_0x4b6347,_0x12478a){var _0x2d8902={},_0x3e4964={},_0x50ba69={'count':0x0,'rows':[]};var _0x3af4d2=_[_0x639e('0x2a')](db['CmHopperAdditionalPhone'][_0x639e('0x2b')],function(_0x341384){return{'name':_0x341384[_0x639e('0x2c')],'type':_0x341384[_0x639e('0x2d')][_0x639e('0x2e')]};});_0x3e4964[_0x639e('0x2f')]=_['map'](_0x3af4d2,_0x639e('0x27'));_0x3e4964['query']=_[_0x639e('0x30')](_0x4b6347[_0x639e('0x31')]);_0x3e4964[_0x639e('0x32')]=_['intersection'](_0x3e4964[_0x639e('0x2f')],_0x3e4964[_0x639e('0x31')]);_0x2d8902[_0x639e('0x33')]=_['intersection'](_0x3e4964[_0x639e('0x2f')],qs[_0x639e('0x34')](_0x4b6347['query'][_0x639e('0x34')]));_0x2d8902[_0x639e('0x33')]=_0x2d8902[_0x639e('0x33')][_0x639e('0x35')]?_0x2d8902[_0x639e('0x33')]:_0x3e4964[_0x639e('0x2f')];if(!_0x4b6347[_0x639e('0x31')]['hasOwnProperty'](_0x639e('0x36'))){_0x2d8902[_0x639e('0x1c')]=qs[_0x639e('0x1c')](_0x4b6347[_0x639e('0x31')]['limit']);_0x2d8902[_0x639e('0x1b')]=qs[_0x639e('0x1b')](_0x4b6347[_0x639e('0x31')][_0x639e('0x1b')]);}_0x2d8902['order']=qs['sort'](_0x4b6347['query']['sort']);_0x2d8902[_0x639e('0x37')]=qs[_0x639e('0x32')](_[_0x639e('0x38')](_0x4b6347[_0x639e('0x31')],_0x3e4964[_0x639e('0x32')]),_0x3af4d2);if(_0x4b6347[_0x639e('0x31')][_0x639e('0x39')]){_0x2d8902[_0x639e('0x37')]=_['merge'](_0x2d8902['where'],{'$or':_['map'](_0x3af4d2,function(_0x390b04){if(_0x390b04['type']!=='VIRTUAL'){var _0x178b60={};_0x178b60[_0x390b04[_0x639e('0x27')]]={'$like':'%'+_0x4b6347[_0x639e('0x31')][_0x639e('0x39')]+'%'};return _0x178b60;}})});}_0x2d8902=_[_0x639e('0x3a')]({},_0x2d8902,_0x4b6347['options']);var _0x10f4ae={'where':_0x2d8902[_0x639e('0x37')]};return db[_0x639e('0x3b')]['count'](_0x10f4ae)[_0x639e('0x21')](function(_0x29dcfd){_0x50ba69[_0x639e('0x1a')]=_0x29dcfd;if(_0x4b6347[_0x639e('0x31')][_0x639e('0x3c')]){_0x2d8902[_0x639e('0x3d')]=[{'all':!![]}];}return db[_0x639e('0x3b')][_0x639e('0x3e')](_0x2d8902);})[_0x639e('0x21')](function(_0x5949f0){_0x50ba69[_0x639e('0x3f')]=_0x5949f0;return _0x50ba69;})[_0x639e('0x21')](respondWithFilteredResult(_0x12478a,_0x2d8902))[_0x639e('0x40')](handleError(_0x12478a,null));};exports[_0x639e('0x41')]=function(_0x55a030,_0x4a2422){var _0x155877={'raw':!![],'where':{'id':_0x55a030[_0x639e('0x42')]['id']}},_0x69c2f={};_0x69c2f['model']=_[_0x639e('0x30')](db[_0x639e('0x3b')]['rawAttributes']);_0x69c2f[_0x639e('0x31')]=_['keys'](_0x55a030[_0x639e('0x31')]);_0x69c2f['filters']=_[_0x639e('0x43')](_0x69c2f[_0x639e('0x2f')],_0x69c2f['query']);_0x155877[_0x639e('0x33')]=_[_0x639e('0x43')](_0x69c2f[_0x639e('0x2f')],qs['fields'](_0x55a030[_0x639e('0x31')][_0x639e('0x34')]));_0x155877[_0x639e('0x33')]=_0x155877[_0x639e('0x33')][_0x639e('0x35')]?_0x155877[_0x639e('0x33')]:_0x69c2f[_0x639e('0x2f')];if(_0x55a030[_0x639e('0x31')][_0x639e('0x3c')]){_0x155877['include']=[{'all':!![]}];}_0x155877=_[_0x639e('0x3a')]({},_0x155877,_0x55a030['options']);return db[_0x639e('0x3b')][_0x639e('0x44')](_0x155877)[_0x639e('0x21')](handleEntityNotFound(_0x4a2422,null))[_0x639e('0x21')](respondWithResult(_0x4a2422,null))[_0x639e('0x40')](handleError(_0x4a2422,null));};exports['create']=function(_0x37315f,_0x1cf793){return db[_0x639e('0x3b')][_0x639e('0x45')](_0x37315f[_0x639e('0x46')],{})['then'](function(_0x5d68e6){var _0x59e4b3=_0x37315f['user'][_0x639e('0x47')]({'plain':!![]});if(!_0x59e4b3)throw new Error(_0x639e('0x48'));if(_0x59e4b3[_0x639e('0x49')]===_0x639e('0x4a')){var _0x3de9c3=_0x5d68e6[_0x639e('0x47')]({'plain':!![]});var _0x2e2682=_0x639e('0x23');return db[_0x639e('0x4b')][_0x639e('0x44')]({'where':{'name':_0x2e2682,'userProfileId':_0x59e4b3[_0x639e('0x4c')]},'raw':!![]})[_0x639e('0x21')](function(_0x502f43){if(_0x502f43&&_0x502f43[_0x639e('0x4d')]===0x0){return db[_0x639e('0x24')][_0x639e('0x45')]({'name':_0x3de9c3['name'],'resourceId':_0x3de9c3['id'],'type':_0x502f43[_0x639e('0x27')],'sectionId':_0x502f43['id']},{})[_0x639e('0x21')](function(){return _0x5d68e6;});}else{return _0x5d68e6;}})[_0x639e('0x40')](function(_0x21ad8e){logger[_0x639e('0x26')](_0x639e('0x4e'),_0x21ad8e);throw _0x21ad8e;});}return _0x5d68e6;})[_0x639e('0x21')](respondWithResult(_0x1cf793,0xc9))[_0x639e('0x40')](handleError(_0x1cf793,null));};exports['update']=function(_0x57bba4,_0xd4a567){if(_0x57bba4['body']['id']){delete _0x57bba4[_0x639e('0x46')]['id'];}return db[_0x639e('0x3b')][_0x639e('0x44')]({'where':{'id':_0x57bba4[_0x639e('0x42')]['id']}})[_0x639e('0x21')](handleEntityNotFound(_0xd4a567,null))[_0x639e('0x21')](saveUpdates(_0x57bba4[_0x639e('0x46')],null))[_0x639e('0x21')](respondWithResult(_0xd4a567,null))[_0x639e('0x40')](handleError(_0xd4a567,null));};exports[_0x639e('0x22')]=function(_0x1efaa6,_0xf9b38b){return db['CmHopperAdditionalPhone'][_0x639e('0x44')]({'where':{'id':_0x1efaa6[_0x639e('0x42')]['id']}})[_0x639e('0x21')](handleEntityNotFound(_0xf9b38b,null))[_0x639e('0x21')](removeEntity(_0xf9b38b,null))[_0x639e('0x40')](handleError(_0xf9b38b,null));}; \ No newline at end of file +var _0x8d0d=['VIRTUAL','merge','options','includeAll','rows','catch','show','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','set','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','index','CmHopperAdditionalPhone','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','map'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8d0d,0xbd));var _0xd8d0=function(_0x20e754,_0x3cbd96){_0x20e754=_0x20e754-0x0;var _0x1a4b3c=_0x8d0d[_0x20e754];return _0x1a4b3c;};'use strict';var pdf=require(_0xd8d0('0x0'));var emlformat=require(_0xd8d0('0x1'));var rimraf=require(_0xd8d0('0x2'));var zipdir=require(_0xd8d0('0x3'));var jsonpatch=require(_0xd8d0('0x4'));var rp=require(_0xd8d0('0x5'));var moment=require(_0xd8d0('0x6'));var BPromise=require(_0xd8d0('0x7'));var Mustache=require(_0xd8d0('0x8'));var util=require(_0xd8d0('0x9'));var path=require(_0xd8d0('0xa'));var sox=require(_0xd8d0('0xb'));var csv=require(_0xd8d0('0xc'));var ejs=require(_0xd8d0('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8d0('0xe'));var jsforce=require(_0xd8d0('0xf'));var deskjs=require(_0xd8d0('0x10'));var toCsv=require(_0xd8d0('0xc'));var querystring=require(_0xd8d0('0x11'));var Papa=require(_0xd8d0('0x12'));var Redis=require(_0xd8d0('0x13'));var authService=require(_0xd8d0('0x14'));var qs=require(_0xd8d0('0x15'));var as=require(_0xd8d0('0x16'));var hardwareService=require(_0xd8d0('0x17'));var logger=require(_0xd8d0('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xd8d0('0x19'));var db=require(_0xd8d0('0x1a'))['db'];function respondWithStatusCode(_0x4dcef1,_0x218b19){_0x218b19=_0x218b19||0xcc;return function(_0x5639e9){if(_0x5639e9){return _0x4dcef1['sendStatus'](_0x218b19);}return _0x4dcef1[_0xd8d0('0x1b')](_0x218b19)[_0xd8d0('0x1c')]();};}function respondWithResult(_0x5c5ae9,_0x19490f){_0x19490f=_0x19490f||0xc8;return function(_0x11fb49){if(_0x11fb49){return _0x5c5ae9[_0xd8d0('0x1b')](_0x19490f)[_0xd8d0('0x1d')](_0x11fb49);}};}function respondWithFilteredResult(_0x49898f,_0x8b1dca){return function(_0x375a40){if(_0x375a40){var _0x5aa1b4=_0x375a40[_0xd8d0('0x1e')],_0x4daa61=_0x8b1dca[_0xd8d0('0x1f')],_0x558c54=_0x8b1dca[_0xd8d0('0x1f')]+_0x8b1dca['limit'],_0x57f718;if(_0x558c54>=_0x5aa1b4){_0x558c54=_0x5aa1b4;_0x57f718=0xc8;}else{_0x57f718=0xce;}_0x49898f[_0xd8d0('0x1b')](_0x57f718);return _0x49898f[_0xd8d0('0x20')]('Content-Range',_0x4daa61+'-'+_0x558c54+'/'+_0x5aa1b4)[_0xd8d0('0x1d')](_0x375a40);}return null;};}function patchUpdates(_0x155178){return function(_0x239639){try{jsonpatch[_0xd8d0('0x21')](_0x239639,_0x155178,!![]);}catch(_0x171727){return BPromise['reject'](_0x171727);}return _0x239639[_0xd8d0('0x22')]();};}function saveUpdates(_0x3b01c4,_0x4940da){return function(_0x1f1022){if(_0x1f1022){return _0x1f1022[_0xd8d0('0x23')](_0x3b01c4)[_0xd8d0('0x24')](function(_0x2c4eba){return _0x2c4eba;});}return null;};}function removeEntity(_0x486315,_0x5d6fcb){return function(_0x5a2ac5){if(_0x5a2ac5){return _0x5a2ac5[_0xd8d0('0x25')]()['then'](function(){var _0x51fe99=_0x5a2ac5[_0xd8d0('0x26')]({'plain':!![]});var _0x511683=_0xd8d0('0x27');return db[_0xd8d0('0x28')]['destroy']({'where':{'type':_0x511683,'resourceId':_0x51fe99['id']}})[_0xd8d0('0x24')](function(){return _0x5a2ac5;});})[_0xd8d0('0x24')](function(){_0x486315[_0xd8d0('0x1b')](0xcc)[_0xd8d0('0x1c')]();});}};}function handleEntityNotFound(_0x3f24da,_0x57dfab){return function(_0x214e71){if(!_0x214e71){_0x3f24da[_0xd8d0('0x29')](0x194);}return _0x214e71;};}function handleError(_0xf4a487,_0x1cd5d4){_0x1cd5d4=_0x1cd5d4||0x1f4;return function(_0x4bb2a8){logger[_0xd8d0('0x2a')](_0x4bb2a8[_0xd8d0('0x2b')]);if(_0x4bb2a8['name']){delete _0x4bb2a8[_0xd8d0('0x2c')];}_0xf4a487[_0xd8d0('0x1b')](_0x1cd5d4)['send'](_0x4bb2a8);};}exports[_0xd8d0('0x2d')]=function(_0x2e4a28,_0x387d75){var _0x15a429={},_0x225f1c={},_0x3bc12c={'count':0x0,'rows':[]};var _0x9632c2=_['map'](db[_0xd8d0('0x2e')]['rawAttributes'],function(_0x53051a){return{'name':_0x53051a['fieldName'],'type':_0x53051a[_0xd8d0('0x2f')][_0xd8d0('0x30')]};});_0x225f1c['model']=_['map'](_0x9632c2,_0xd8d0('0x2c'));_0x225f1c[_0xd8d0('0x31')]=_[_0xd8d0('0x32')](_0x2e4a28[_0xd8d0('0x31')]);_0x225f1c[_0xd8d0('0x33')]=_[_0xd8d0('0x34')](_0x225f1c['model'],_0x225f1c[_0xd8d0('0x31')]);_0x15a429[_0xd8d0('0x35')]=_[_0xd8d0('0x34')](_0x225f1c[_0xd8d0('0x36')],qs[_0xd8d0('0x37')](_0x2e4a28[_0xd8d0('0x31')]['fields']));_0x15a429['attributes']=_0x15a429[_0xd8d0('0x35')][_0xd8d0('0x38')]?_0x15a429[_0xd8d0('0x35')]:_0x225f1c['model'];if(!_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x39')](_0xd8d0('0x3a'))){_0x15a429[_0xd8d0('0x3b')]=qs[_0xd8d0('0x3b')](_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x3b')]);_0x15a429['offset']=qs[_0xd8d0('0x1f')](_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x1f')]);}_0x15a429[_0xd8d0('0x3c')]=qs[_0xd8d0('0x3d')](_0x2e4a28[_0xd8d0('0x31')]['sort']);_0x15a429['where']=qs[_0xd8d0('0x33')](_[_0xd8d0('0x3e')](_0x2e4a28['query'],_0x225f1c[_0xd8d0('0x33')]),_0x9632c2);if(_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x3f')]){_0x15a429['where']=_['merge'](_0x15a429[_0xd8d0('0x40')],{'$or':_[_0xd8d0('0x41')](_0x9632c2,function(_0xd70521){if(_0xd70521['type']!==_0xd8d0('0x42')){var _0x40ac44={};_0x40ac44[_0xd70521['name']]={'$like':'%'+_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x3f')]+'%'};return _0x40ac44;}})});}_0x15a429=_[_0xd8d0('0x43')]({},_0x15a429,_0x2e4a28[_0xd8d0('0x44')]);var _0x567aed={'where':_0x15a429[_0xd8d0('0x40')]};return db[_0xd8d0('0x2e')][_0xd8d0('0x1e')](_0x567aed)['then'](function(_0x41e528){_0x3bc12c['count']=_0x41e528;if(_0x2e4a28[_0xd8d0('0x31')][_0xd8d0('0x45')]){_0x15a429['include']=[{'all':!![]}];}return db[_0xd8d0('0x2e')]['findAll'](_0x15a429);})[_0xd8d0('0x24')](function(_0x529aa2){_0x3bc12c[_0xd8d0('0x46')]=_0x529aa2;return _0x3bc12c;})['then'](respondWithFilteredResult(_0x387d75,_0x15a429))[_0xd8d0('0x47')](handleError(_0x387d75,null));};exports[_0xd8d0('0x48')]=function(_0x523f26,_0x39819e){var _0x1615e4={'raw':!![],'where':{'id':_0x523f26['params']['id']}},_0x4d2e75={};_0x4d2e75[_0xd8d0('0x36')]=_['keys'](db['CmHopperAdditionalPhone'][_0xd8d0('0x49')]);_0x4d2e75[_0xd8d0('0x31')]=_[_0xd8d0('0x32')](_0x523f26[_0xd8d0('0x31')]);_0x4d2e75[_0xd8d0('0x33')]=_[_0xd8d0('0x34')](_0x4d2e75[_0xd8d0('0x36')],_0x4d2e75[_0xd8d0('0x31')]);_0x1615e4['attributes']=_[_0xd8d0('0x34')](_0x4d2e75[_0xd8d0('0x36')],qs['fields'](_0x523f26[_0xd8d0('0x31')][_0xd8d0('0x37')]));_0x1615e4[_0xd8d0('0x35')]=_0x1615e4[_0xd8d0('0x35')][_0xd8d0('0x38')]?_0x1615e4['attributes']:_0x4d2e75[_0xd8d0('0x36')];if(_0x523f26['query']['includeAll']){_0x1615e4[_0xd8d0('0x4a')]=[{'all':!![]}];}_0x1615e4=_[_0xd8d0('0x43')]({},_0x1615e4,_0x523f26['options']);return db['CmHopperAdditionalPhone'][_0xd8d0('0x4b')](_0x1615e4)[_0xd8d0('0x24')](handleEntityNotFound(_0x39819e,null))[_0xd8d0('0x24')](respondWithResult(_0x39819e,null))[_0xd8d0('0x47')](handleError(_0x39819e,null));};exports[_0xd8d0('0x4c')]=function(_0x1cd918,_0x405577){return db['CmHopperAdditionalPhone']['create'](_0x1cd918['body'],{})[_0xd8d0('0x24')](function(_0x3a423a){var _0x2da82b=_0x1cd918[_0xd8d0('0x4d')][_0xd8d0('0x26')]({'plain':!![]});if(!_0x2da82b)throw new Error(_0xd8d0('0x4e'));if(_0x2da82b[_0xd8d0('0x4f')]==='user'){var _0xf61187=_0x3a423a[_0xd8d0('0x26')]({'plain':!![]});var _0x43688e=_0xd8d0('0x27');return db['UserProfileSection'][_0xd8d0('0x4b')]({'where':{'name':_0x43688e,'userProfileId':_0x2da82b[_0xd8d0('0x50')]},'raw':!![]})['then'](function(_0x43efdd){if(_0x43efdd&&_0x43efdd[_0xd8d0('0x51')]===0x0){return db[_0xd8d0('0x28')][_0xd8d0('0x4c')]({'name':_0xf61187[_0xd8d0('0x2c')],'resourceId':_0xf61187['id'],'type':_0x43efdd['name'],'sectionId':_0x43efdd['id']},{})['then'](function(){return _0x3a423a;});}else{return _0x3a423a;}})[_0xd8d0('0x47')](function(_0x2ce584){logger[_0xd8d0('0x2a')](_0xd8d0('0x52'),_0x2ce584);throw _0x2ce584;});}return _0x3a423a;})[_0xd8d0('0x24')](respondWithResult(_0x405577,0xc9))['catch'](handleError(_0x405577,null));};exports[_0xd8d0('0x23')]=function(_0x2d64fd,_0x237341){if(_0x2d64fd[_0xd8d0('0x53')]['id']){delete _0x2d64fd[_0xd8d0('0x53')]['id'];}return db[_0xd8d0('0x2e')][_0xd8d0('0x4b')]({'where':{'id':_0x2d64fd[_0xd8d0('0x54')]['id']}})[_0xd8d0('0x24')](handleEntityNotFound(_0x237341,null))['then'](saveUpdates(_0x2d64fd[_0xd8d0('0x53')],null))[_0xd8d0('0x24')](respondWithResult(_0x237341,null))[_0xd8d0('0x47')](handleError(_0x237341,null));};exports[_0xd8d0('0x25')]=function(_0x3b8af6,_0x137157){return db['CmHopperAdditionalPhone'][_0xd8d0('0x4b')]({'where':{'id':_0x3b8af6[_0xd8d0('0x54')]['id']}})['then'](handleEntityNotFound(_0x137157,null))[_0xd8d0('0x24')](removeEntity(_0x137157,null))[_0xd8d0('0x47')](handleError(_0x137157,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4376e2c..5b0b3fb 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 _0x7a0d=['bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x47fe17,_0x5acf80){var _0x1510d7=function(_0x3d42b4){while(--_0x3d42b4){_0x47fe17['push'](_0x47fe17['shift']());}};_0x1510d7(++_0x5acf80);}(_0x7a0d,0x188));var _0xd7a0=function(_0x237aab,_0x523604){_0x237aab=_0x237aab-0x0;var _0x55b525=_0x7a0d[_0x237aab];return _0x55b525;};'use strict';var _=require(_0xd7a0('0x0'));var util=require(_0xd7a0('0x1'));var logger=require(_0xd7a0('0x2'))(_0xd7a0('0x3'));var moment=require('moment');var BPromise=require(_0xd7a0('0x4'));var rp=require(_0xd7a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7a0('0x6'));var config=require(_0xd7a0('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xd7a0('0x8')]=function(_0x53e2f1,_0x548465){return _0x53e2f1[_0xd7a0('0x9')](_0xd7a0('0xa'),attributes,{'tableName':_0xd7a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e10=['lodash','../../config/logger','moment','bluebird','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x8e10,0xbe));var _0x08e1=function(_0x5b620e,_0x266273){_0x5b620e=_0x5b620e-0x0;var _0x6b7008=_0x8e10[_0x5b620e];return _0x6b7008;};'use strict';var _=require(_0x08e1('0x0'));var util=require('util');var logger=require(_0x08e1('0x1'))('api');var moment=require(_0x08e1('0x2'));var BPromise=require(_0x08e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08e1('0x4'));var rimraf=require(_0x08e1('0x5'));var config=require('../../config/environment');var attributes=require(_0x08e1('0x6'));module[_0x08e1('0x7')]=function(_0x5d08d6,_0x32cfbb){return _0x5d08d6[_0x08e1('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x08e1('0x9'),'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 a9040ec..c87f5db 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 _0xf359=['countmachineretry','SwapAdditionalPhones','ListId','ASC','waitTime','scheduledat','add','minutes','phone','isNil','countnosuchnumberretry','createdAt','updatedAt','countdropretry','additionalToHop','sequelize','transaction','update','field','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry'];(function(_0x3f0dd2,_0x56c41){var _0x1a8ebf=function(_0x1571fd){while(--_0x1571fd){_0x3f0dd2['push'](_0x3f0dd2['shift']());}};_0x1a8ebf(++_0x56c41);}(_0xf359,0x8a));var _0x9f35=function(_0x52d39d,_0x5e551d){_0x52d39d=_0x52d39d-0x0;var _0x5e1bb9=_0xf359[_0x52d39d];return _0x5e1bb9;};'use strict';var _=require(_0x9f35('0x0'));var util=require(_0x9f35('0x1'));var moment=require(_0x9f35('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f35('0x3'));var fs=require('fs');var Redis=require(_0x9f35('0x4'));var db=require(_0x9f35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f35('0x6'))('rpc');var config=require(_0x9f35('0x7'));var jayson=require(_0x9f35('0x8'));var client=jayson[_0x9f35('0x9')][_0x9f35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x115168,_0x250c40,_0x178159){return new BPromise(function(_0x32da10,_0x136ca5){return client[_0x9f35('0xb')](_0x115168,_0x178159)[_0x9f35('0xc')](function(_0x5f8795){logger[_0x9f35('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x250c40,'request\x20sent');logger[_0x9f35('0xe')](_0x9f35('0xf'),_0x250c40,'request\x20sent',JSON[_0x9f35('0x10')](_0x5f8795));if(_0x5f8795[_0x9f35('0x11')]){if(_0x5f8795['error'][_0x9f35('0x12')]===0x1f4){logger[_0x9f35('0x11')](_0x9f35('0x13'),_0x250c40,_0x5f8795[_0x9f35('0x11')][_0x9f35('0x14')]);return _0x136ca5(_0x5f8795[_0x9f35('0x11')]['message']);}logger[_0x9f35('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x250c40,_0x5f8795[_0x9f35('0x11')][_0x9f35('0x14')]);return _0x32da10(_0x5f8795[_0x9f35('0x11')][_0x9f35('0x14')]);}else{logger[_0x9f35('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x250c40,'request\x20sent');_0x32da10(_0x5f8795[_0x9f35('0x15')][_0x9f35('0x14')]);}})[_0x9f35('0x16')](function(_0x1f934d){logger[_0x9f35('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x250c40,_0x1f934d);_0x136ca5(_0x1f934d);});});}exports[_0x9f35('0x17')]=function(_0x1355ec){var _0x582883=this;return new Promise(function(_0x7a3869,_0x5a54a4){return db[_0x9f35('0x18')][_0x9f35('0x19')]({'raw':!![],'where':{'ContactId':_0x1355ec['body'][_0x9f35('0x1a')],'ListId':_0x1355ec[_0x9f35('0x1b')]['ListId'],'VoiceQueueId':_0x1355ec[_0x9f35('0x1b')][_0x9f35('0x1c')]===undefined?null:_0x1355ec[_0x9f35('0x1b')][_0x9f35('0x1c')],'CampaignId':_0x1355ec[_0x9f35('0x1b')]['CampaignId']===undefined?null:_0x1355ec[_0x9f35('0x1b')][_0x9f35('0x1d')]}})[_0x9f35('0xc')](function(_0x9ff902){if(_0x9ff902!=null){return db[_0x9f35('0x1e')][_0x9f35('0x19')]({'raw':!![],'where':{'CmHopperId':_0x9ff902['id'],'OrderBy':{'$gt':_0x9ff902[_0x9f35('0x1f')]}},'order':[[_0x9f35('0x1f'),'ASC']]})[_0x9f35('0xc')](function(_0x12b347){var _0x57f098=0x0;if(_0x12b347){if(_0x12b347[_0x9f35('0x20')]+_0x12b347[_0x9f35('0x21')]+_0x12b347[_0x9f35('0x22')]+_0x12b347['countnosuchnumberretry']+_0x12b347['countdropretry']+_0x12b347[_0x9f35('0x23')]+_0x12b347['countmachineretry']+_0x12b347[_0x9f35('0x24')]<_0x1355ec[_0x9f35('0x25')][_0x9f35('0x26')])_0x57f098=0x1;_0x7a3869({'additional':_0x57f098});}else{return db[_0x9f35('0x1e')][_0x9f35('0x19')]({'raw':!![],'where':{'CmHopperId':_0x9ff902['id']},'order':[['OrderBy','ASC']]})[_0x9f35('0xc')](function(_0x45a8d5){var _0x3b6177=0x0;if(_0x45a8d5){if(_0x45a8d5[_0x9f35('0x20')]+_0x45a8d5[_0x9f35('0x21')]+_0x45a8d5[_0x9f35('0x22')]+_0x45a8d5['countnosuchnumberretry']+_0x45a8d5['countdropretry']+_0x45a8d5[_0x9f35('0x23')]+_0x45a8d5[_0x9f35('0x27')]+_0x45a8d5[_0x9f35('0x24')]<_0x1355ec[_0x9f35('0x25')][_0x9f35('0x26')])_0x3b6177=0x1;_0x7a3869({'additional':_0x3b6177});}else{_0x7a3869({'additional':0x0});}})[_0x9f35('0x16')](function(_0x1cd25b){logger['error']('VerifyAdditionalPhones',_0x1cd25b['message'],_0x1355ec);_0x5a54a4(_0x582883[_0x9f35('0x11')](0x1f4,_0x1cd25b[_0x9f35('0x14')]));});}})[_0x9f35('0x16')](function(_0x263cde){logger[_0x9f35('0x11')](_0x9f35('0x17'),_0x263cde['message'],_0x1355ec);_0x5a54a4(_0x582883['error'](0x1f4,_0x263cde[_0x9f35('0x14')]));});}else _0x7a3869({'additional':0x0});});});};exports[_0x9f35('0x28')]=function(_0x2424b0){var _0x8f303=this;return new Promise(function(_0x1c0458,_0x450ed5){return db[_0x9f35('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x2424b0[_0x9f35('0x1b')][_0x9f35('0x1a')],'ListId':_0x2424b0['body'][_0x9f35('0x29')],'VoiceQueueId':_0x2424b0[_0x9f35('0x1b')][_0x9f35('0x1c')]===undefined?null:_0x2424b0[_0x9f35('0x1b')]['VoiceQueueId'],'CampaignId':_0x2424b0[_0x9f35('0x1b')]['CampaignId']===undefined?null:_0x2424b0[_0x9f35('0x1b')]['CampaignId']}})['then'](function(_0x5e992b){if(_0x5e992b!=null){return db[_0x9f35('0x1e')][_0x9f35('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5e992b['id'],'OrderBy':{'$gt':_0x5e992b[_0x9f35('0x1f')]}},'order':[[_0x9f35('0x1f'),_0x9f35('0x2a')]]})[_0x9f35('0xc')](function(_0x61f422){if(_0x61f422)return activateAdditionalPhone(_0x5e992b,_0x2424b0[_0x9f35('0x1b')],_0x61f422,_0x2424b0['duration'],_0x2424b0[_0x9f35('0x2b')])['then'](function(_0x1b10c2){_0x1c0458(_0x1b10c2);});else{return db[_0x9f35('0x1e')][_0x9f35('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5e992b['id']},'order':[[_0x9f35('0x1f'),_0x9f35('0x2a')]]})['then'](function(_0x4bfae5){if(_0x4bfae5)return activateAdditionalPhone(_0x5e992b,_0x2424b0[_0x9f35('0x1b')],_0x4bfae5,_0x2424b0['duration'],_0x2424b0[_0x9f35('0x2b')])['then'](function(_0x2edaf1){_0x1c0458(_0x2edaf1);});else{_0x1c0458({'id':_0x5e992b['id'],'phone':''});}})[_0x9f35('0x16')](function(_0x3038e6){logger[_0x9f35('0x11')](_0x9f35('0x17'),_0x3038e6['message'],_0x2424b0);_0x450ed5(_0x8f303[_0x9f35('0x11')](0x1f4,_0x3038e6['message']));});}})['catch'](function(_0x93c06){logger[_0x9f35('0x11')](_0x9f35('0x17'),_0x93c06[_0x9f35('0x14')],_0x2424b0);_0x450ed5(_0x8f303[_0x9f35('0x11')](0x1f4,_0x93c06[_0x9f35('0x14')]));});}else _0x1c0458(0x1);});});};function activateAdditionalPhone(_0x499168,_0x328d3b,_0x4ca867,_0xfecc30,_0x382677){return new Promise(function(_0x7ad83c,_0x12c096){logger[_0x9f35('0xd')](_0x9f35('0x17'),_0x4ca867);var _0x4262f3;if(moment()>moment(_0x4ca867[_0x9f35('0x2c')])){_0x4262f3=moment()[_0x9f35('0x2d')](_0x382677||0x3,'minutes');}else{if(_0x4ca867[_0x9f35('0x1f')]==0x0){_0x4262f3=moment(_0x4ca867[_0x9f35('0x2c')]);}else{_0x4262f3=moment()[_0x9f35('0x2d')](_0x382677||0x3,_0x9f35('0x2e'));}}var _0x24c965={'phone':_0x499168[_0x9f35('0x2f')],'active':0x0,'OrderBy':_[_0x9f35('0x30')](_0x499168[_0x9f35('0x1f')])?0x0:_0x499168[_0x9f35('0x1f')],'scheduledat':moment()[_0x9f35('0x2d')](_0xfecc30||0x1,_0x9f35('0x2e')),'countbusyretry':_0x328d3b[_0x9f35('0x20')],'countcongestionretry':_0x328d3b['countcongestionretry'],'countnoanswerretry':_0x328d3b[_0x9f35('0x22')],'countnosuchnumberretry':_0x328d3b[_0x9f35('0x31')],'countdropretry':_0x328d3b['countdropretry'],'countabandonedretry':_0x328d3b['countabandonedretry'],'countmachineretry':_0x328d3b[_0x9f35('0x27')],'countagentrejectretry':_0x328d3b[_0x9f35('0x24')],'createdAt':_0x328d3b[_0x9f35('0x32')],'updatedAt':_0x328d3b[_0x9f35('0x33')]};var _0x5c62e6={'CmHopperId':_0x499168['id'],'phone':_0x4ca867[_0x9f35('0x2f')],'active':0x0,'OrderBy':_[_0x9f35('0x30')](_0x4ca867[_0x9f35('0x1f')])?0x0:_0x4ca867[_0x9f35('0x1f')],'scheduledat':_0x4262f3,'countbusyretry':_0x4ca867['countbusyretry'],'countcongestionretry':_0x4ca867[_0x9f35('0x21')],'countnoanswerretry':_0x4ca867['countnoanswerretry'],'countnosuchnumberretry':_0x328d3b[_0x9f35('0x31')],'countdropretry':_0x328d3b[_0x9f35('0x34')],'countabandonedretry':_0x328d3b[_0x9f35('0x23')],'countmachineretry':_0x328d3b['countmachineretry'],'countagentrejectretry':_0x328d3b['countagentrejectretry'],'createdAt':_0x4ca867[_0x9f35('0x32')],'updatedAt':_0x4ca867[_0x9f35('0x33')]};logger[_0x9f35('0xd')]('hopperToAdd',_0x24c965);logger[_0x9f35('0xd')](_0x9f35('0x35'),_0x5c62e6);return db[_0x9f35('0x36')][_0x9f35('0x37')](function(_0xcadc93){return db[_0x9f35('0x1e')][_0x9f35('0x38')](_0x24c965,{'where':{'id':_0x4ca867['id']}},{'transaction':_0xcadc93})[_0x9f35('0xc')](function(){return db['CmHopper']['update'](_0x5c62e6,{'where':{'id':_0x499168['id']}},{'transaction':_0xcadc93});});})['then'](function(_0x56bd13){_0x7ad83c({'id':_0x499168['id'],'phone':_0x4ca867[_0x9f35('0x2f')]});})['catch'](function(_0x1b179e){logger['error'](_0x9f35('0x17'),_0x1b179e['message'],req);_0x12c096(_this[_0x9f35('0x11')](0x1f4,_0x1b179e[_0x9f35('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0x12767a){var _0x271cab=this;return new Promise(function(_0x58527c,_0x112179){return db[_0x9f35('0x18')][_0x9f35('0x38')](_0x12767a[_0x9f35('0x1b')][_0x9f35('0x39')],{'where':{'id':_0x12767a[_0x9f35('0x1b')]['id']}})[_0x9f35('0xc')](function(_0x900579){_0x58527c(_0x900579);})[_0x9f35('0x16')](function(_0x57a4d9){logger[_0x9f35('0x11')](_0x9f35('0x3a'),_0x57a4d9['message'],_0x12767a);_0x112179(_0x271cab[_0x9f35('0x11')](0x1f4,_0x57a4d9[_0x9f35('0x14')]));});});}; \ No newline at end of file +var _0xd3ad=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','phone','isNil','minutes','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','field','IncrementPreviewCounters','lodash'];(function(_0xc7bb6e,_0x2900c3){var _0x2a6291=function(_0x217775){while(--_0x217775){_0xc7bb6e['push'](_0xc7bb6e['shift']());}};_0x2a6291(++_0x2900c3);}(_0xd3ad,0x77));var _0xdd3a=function(_0x44d0b3,_0x129858){_0x44d0b3=_0x44d0b3-0x0;var _0x152314=_0xd3ad[_0x44d0b3];return _0x152314;};'use strict';var _=require(_0xdd3a('0x0'));var util=require(_0xdd3a('0x1'));var moment=require('moment');var BPromise=require(_0xdd3a('0x2'));var rs=require(_0xdd3a('0x3'));var fs=require('fs');var Redis=require(_0xdd3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd3a('0x5'));var logger=require(_0xdd3a('0x6'))(_0xdd3a('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd3a('0x8'));var client=jayson[_0xdd3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f162,_0x45deb2,_0x531cf6){return new BPromise(function(_0x47d22f,_0x267111){return client[_0xdd3a('0xa')](_0x11f162,_0x531cf6)[_0xdd3a('0xb')](function(_0x3eb4b9){logger[_0xdd3a('0xc')](_0xdd3a('0xd'),_0x45deb2,_0xdd3a('0xe'));logger[_0xdd3a('0xf')](_0xdd3a('0x10'),_0x45deb2,_0xdd3a('0xe'),JSON[_0xdd3a('0x11')](_0x3eb4b9));if(_0x3eb4b9[_0xdd3a('0x12')]){if(_0x3eb4b9[_0xdd3a('0x12')][_0xdd3a('0x13')]===0x1f4){logger[_0xdd3a('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x45deb2,_0x3eb4b9[_0xdd3a('0x12')][_0xdd3a('0x14')]);return _0x267111(_0x3eb4b9[_0xdd3a('0x12')][_0xdd3a('0x14')]);}logger['error'](_0xdd3a('0xd'),_0x45deb2,_0x3eb4b9[_0xdd3a('0x12')]['message']);return _0x47d22f(_0x3eb4b9[_0xdd3a('0x12')][_0xdd3a('0x14')]);}else{logger[_0xdd3a('0xc')](_0xdd3a('0xd'),_0x45deb2,_0xdd3a('0xe'));_0x47d22f(_0x3eb4b9['result']['message']);}})[_0xdd3a('0x15')](function(_0x44a341){logger[_0xdd3a('0x12')](_0xdd3a('0xd'),_0x45deb2,_0x44a341);_0x267111(_0x44a341);});});}exports[_0xdd3a('0x16')]=function(_0x39f29d){var _0x12dc03=this;return new Promise(function(_0x49cd4b,_0xc59753){return db[_0xdd3a('0x17')][_0xdd3a('0x18')]({'raw':!![],'where':{'ContactId':_0x39f29d[_0xdd3a('0x19')][_0xdd3a('0x1a')],'ListId':_0x39f29d[_0xdd3a('0x19')][_0xdd3a('0x1b')],'VoiceQueueId':_0x39f29d['body'][_0xdd3a('0x1c')]===undefined?null:_0x39f29d[_0xdd3a('0x19')]['VoiceQueueId'],'CampaignId':_0x39f29d[_0xdd3a('0x19')][_0xdd3a('0x1d')]===undefined?null:_0x39f29d[_0xdd3a('0x19')]['CampaignId']}})[_0xdd3a('0xb')](function(_0x200817){if(_0x200817!=null){return db[_0xdd3a('0x1e')][_0xdd3a('0x18')]({'raw':!![],'where':{'CmHopperId':_0x200817['id'],'OrderBy':{'$gt':_0x200817['OrderBy']}},'order':[[_0xdd3a('0x1f'),_0xdd3a('0x20')]]})[_0xdd3a('0xb')](function(_0x35c558){var _0x58d630=0x0;if(_0x35c558){if(_0x35c558[_0xdd3a('0x21')]+_0x35c558[_0xdd3a('0x22')]+_0x35c558[_0xdd3a('0x23')]+_0x35c558[_0xdd3a('0x24')]+_0x35c558[_0xdd3a('0x25')]+_0x35c558[_0xdd3a('0x26')]+_0x35c558[_0xdd3a('0x27')]+_0x35c558[_0xdd3a('0x28')]<_0x39f29d[_0xdd3a('0x29')][_0xdd3a('0x2a')])_0x58d630=0x1;_0x49cd4b({'additional':_0x58d630});}else{return db[_0xdd3a('0x1e')][_0xdd3a('0x18')]({'raw':!![],'where':{'CmHopperId':_0x200817['id']},'order':[[_0xdd3a('0x1f'),_0xdd3a('0x20')]]})[_0xdd3a('0xb')](function(_0x3be752){var _0x339022=0x0;if(_0x3be752){if(_0x3be752[_0xdd3a('0x21')]+_0x3be752[_0xdd3a('0x22')]+_0x3be752[_0xdd3a('0x23')]+_0x3be752[_0xdd3a('0x24')]+_0x3be752[_0xdd3a('0x25')]+_0x3be752[_0xdd3a('0x26')]+_0x3be752[_0xdd3a('0x27')]+_0x3be752[_0xdd3a('0x28')]<_0x39f29d[_0xdd3a('0x29')][_0xdd3a('0x2a')])_0x339022=0x1;_0x49cd4b({'additional':_0x339022});}else{_0x49cd4b({'additional':0x0});}})['catch'](function(_0x7b86a1){logger[_0xdd3a('0x12')](_0xdd3a('0x16'),_0x7b86a1[_0xdd3a('0x14')],_0x39f29d);_0xc59753(_0x12dc03[_0xdd3a('0x12')](0x1f4,_0x7b86a1[_0xdd3a('0x14')]));});}})[_0xdd3a('0x15')](function(_0x2bde00){logger[_0xdd3a('0x12')]('VerifyAdditionalPhones',_0x2bde00['message'],_0x39f29d);_0xc59753(_0x12dc03[_0xdd3a('0x12')](0x1f4,_0x2bde00['message']));});}else _0x49cd4b({'additional':0x0});});});};exports[_0xdd3a('0x2b')]=function(_0x64f3e3){var _0x1580ee=this;return new Promise(function(_0x2aa397,_0x46aaae){return db[_0xdd3a('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x64f3e3[_0xdd3a('0x19')][_0xdd3a('0x1a')],'ListId':_0x64f3e3[_0xdd3a('0x19')][_0xdd3a('0x1b')],'VoiceQueueId':_0x64f3e3[_0xdd3a('0x19')][_0xdd3a('0x1c')]===undefined?null:_0x64f3e3[_0xdd3a('0x19')][_0xdd3a('0x1c')],'CampaignId':_0x64f3e3['body'][_0xdd3a('0x1d')]===undefined?null:_0x64f3e3[_0xdd3a('0x19')][_0xdd3a('0x1d')]}})['then'](function(_0x3a7545){if(_0x3a7545!=null){return db[_0xdd3a('0x1e')][_0xdd3a('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3a7545['id'],'OrderBy':{'$gt':_0x3a7545[_0xdd3a('0x1f')]}},'order':[[_0xdd3a('0x1f'),'ASC']]})[_0xdd3a('0xb')](function(_0x1310f4){if(_0x1310f4)return activateAdditionalPhone(_0x3a7545,_0x64f3e3['body'],_0x1310f4,_0x64f3e3[_0xdd3a('0x2c')],_0x64f3e3[_0xdd3a('0x2d')])['then'](function(_0x2e08c9){_0x2aa397(_0x2e08c9);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3a7545['id']},'order':[[_0xdd3a('0x1f'),_0xdd3a('0x20')]]})[_0xdd3a('0xb')](function(_0x3f34de){if(_0x3f34de)return activateAdditionalPhone(_0x3a7545,_0x64f3e3[_0xdd3a('0x19')],_0x3f34de,_0x64f3e3['duration'],_0x64f3e3[_0xdd3a('0x2d')])[_0xdd3a('0xb')](function(_0x252569){_0x2aa397(_0x252569);});else{_0x2aa397({'id':_0x3a7545['id'],'phone':''});}})['catch'](function(_0x5014ef){logger['error']('VerifyAdditionalPhones',_0x5014ef[_0xdd3a('0x14')],_0x64f3e3);_0x46aaae(_0x1580ee[_0xdd3a('0x12')](0x1f4,_0x5014ef['message']));});}})[_0xdd3a('0x15')](function(_0x28e77f){logger[_0xdd3a('0x12')]('VerifyAdditionalPhones',_0x28e77f[_0xdd3a('0x14')],_0x64f3e3);_0x46aaae(_0x1580ee[_0xdd3a('0x12')](0x1f4,_0x28e77f[_0xdd3a('0x14')]));});}else _0x2aa397(0x1);});});};function activateAdditionalPhone(_0x2f83bb,_0x61eacf,_0x28e212,_0x3d6cf6,_0x382c4f){return new Promise(function(_0xe745eb,_0x4d18fa){logger[_0xdd3a('0xc')](_0xdd3a('0x16'),_0x28e212);var _0x411a77;if(moment()>moment(_0x28e212[_0xdd3a('0x2e')])){_0x411a77=moment()[_0xdd3a('0x2f')](_0x382c4f||0x3,'minutes');}else{if(_0x28e212['OrderBy']==0x0){_0x411a77=moment(_0x28e212[_0xdd3a('0x2e')]);}else{_0x411a77=moment()[_0xdd3a('0x2f')](_0x382c4f||0x3,'minutes');}}var _0x390afc={'phone':_0x2f83bb[_0xdd3a('0x30')],'active':0x0,'OrderBy':_[_0xdd3a('0x31')](_0x2f83bb[_0xdd3a('0x1f')])?0x0:_0x2f83bb[_0xdd3a('0x1f')],'scheduledat':moment()[_0xdd3a('0x2f')](_0x3d6cf6||0x1,_0xdd3a('0x32')),'countbusyretry':_0x61eacf['countbusyretry'],'countcongestionretry':_0x61eacf[_0xdd3a('0x22')],'countnoanswerretry':_0x61eacf[_0xdd3a('0x23')],'countnosuchnumberretry':_0x61eacf[_0xdd3a('0x24')],'countdropretry':_0x61eacf['countdropretry'],'countabandonedretry':_0x61eacf[_0xdd3a('0x26')],'countmachineretry':_0x61eacf['countmachineretry'],'countagentrejectretry':_0x61eacf[_0xdd3a('0x28')],'createdAt':_0x61eacf[_0xdd3a('0x33')],'updatedAt':_0x61eacf['updatedAt']};var _0x3ccce1={'CmHopperId':_0x2f83bb['id'],'phone':_0x28e212['phone'],'active':0x0,'OrderBy':_[_0xdd3a('0x31')](_0x28e212['OrderBy'])?0x0:_0x28e212[_0xdd3a('0x1f')],'scheduledat':_0x411a77,'countbusyretry':_0x28e212[_0xdd3a('0x21')],'countcongestionretry':_0x28e212['countcongestionretry'],'countnoanswerretry':_0x28e212[_0xdd3a('0x23')],'countnosuchnumberretry':_0x61eacf[_0xdd3a('0x24')],'countdropretry':_0x61eacf[_0xdd3a('0x25')],'countabandonedretry':_0x61eacf[_0xdd3a('0x26')],'countmachineretry':_0x61eacf[_0xdd3a('0x27')],'countagentrejectretry':_0x61eacf[_0xdd3a('0x28')],'createdAt':_0x28e212[_0xdd3a('0x33')],'updatedAt':_0x28e212[_0xdd3a('0x34')]};logger[_0xdd3a('0xc')](_0xdd3a('0x35'),_0x390afc);logger[_0xdd3a('0xc')](_0xdd3a('0x36'),_0x3ccce1);return db[_0xdd3a('0x37')][_0xdd3a('0x38')](function(_0x3dcd4c){return db[_0xdd3a('0x1e')][_0xdd3a('0x39')](_0x390afc,{'where':{'id':_0x28e212['id']}},{'transaction':_0x3dcd4c})[_0xdd3a('0xb')](function(){return db[_0xdd3a('0x17')][_0xdd3a('0x39')](_0x3ccce1,{'where':{'id':_0x2f83bb['id']}},{'transaction':_0x3dcd4c});});})[_0xdd3a('0xb')](function(_0x540d50){_0xe745eb({'id':_0x2f83bb['id'],'phone':_0x28e212['phone']});})[_0xdd3a('0x15')](function(_0x4246cf){logger[_0xdd3a('0x12')](_0xdd3a('0x16'),_0x4246cf['message'],req);_0x4d18fa(_this['error'](0x1f4,_0x4246cf['message']));});});}exports['IncrementPreviewCounters']=function(_0x899737){var _0x105ecd=this;return new Promise(function(_0x4ebc2e,_0x50879e){return db[_0xdd3a('0x17')][_0xdd3a('0x39')](_0x899737[_0xdd3a('0x19')][_0xdd3a('0x3a')],{'where':{'id':_0x899737[_0xdd3a('0x19')]['id']}})[_0xdd3a('0xb')](function(_0x3d07a0){_0x4ebc2e(_0x3d07a0);})['catch'](function(_0x1fdd89){logger[_0xdd3a('0x12')](_0xdd3a('0x3b'),_0x1fdd89[_0xdd3a('0x14')],_0x899737);_0x50879e(_0x105ecd['error'](0x1f4,_0x1fdd89[_0xdd3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4d9123e..2a7be13 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 _0xd0f5=['index','isAuthenticated','show','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get'];(function(_0x1a04b9,_0x25a5f7){var _0x26328a=function(_0x3b2522){while(--_0x3b2522){_0x1a04b9['push'](_0x1a04b9['shift']());}};_0x26328a(++_0x25a5f7);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var path=require('path');var timeout=require(_0x5d0f('0x2'));var express=require(_0x5d0f('0x3'));var router=express[_0x5d0f('0x4')]();var auth=require(_0x5d0f('0x5'));var interaction=require(_0x5d0f('0x6'));var config=require(_0x5d0f('0x7'));var controller=require(_0x5d0f('0x8'));router[_0x5d0f('0x9')]('/',auth['isAuthenticated'](),controller[_0x5d0f('0xa')]);router[_0x5d0f('0x9')]('/:id',auth[_0x5d0f('0xb')](),controller[_0x5d0f('0xc')]);router[_0x5d0f('0xd')]('/',auth[_0x5d0f('0xb')](),controller['create']);router[_0x5d0f('0xe')](_0x5d0f('0xf'),auth[_0x5d0f('0xb')](),controller['update']);router[_0x5d0f('0x10')](_0x5d0f('0xf'),auth['isAuthenticated'](),controller[_0x5d0f('0x11')]);module[_0x5d0f('0x12')]=router; \ No newline at end of file +var _0x3cca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','update','delete'];(function(_0x3294da,_0x21f0ab){var _0x26fab9=function(_0x5c18e3){while(--_0x5c18e3){_0x3294da['push'](_0x3294da['shift']());}};_0x26fab9(++_0x21f0ab);}(_0x3cca,0xce));var _0xa3cc=function(_0x2ce43c,_0x2fa7ab){_0x2ce43c=_0x2ce43c-0x0;var _0x235157=_0x3cca[_0x2ce43c];return _0x235157;};'use strict';var multer=require(_0xa3cc('0x0'));var util=require(_0xa3cc('0x1'));var path=require(_0xa3cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3cc('0x3'));var router=express[_0xa3cc('0x4')]();var auth=require(_0xa3cc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa3cc('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa3cc('0x7')]);router[_0xa3cc('0x8')](_0xa3cc('0x9'),auth[_0xa3cc('0xa')](),controller['show']);router[_0xa3cc('0xb')]('/',auth[_0xa3cc('0xa')](),controller[_0xa3cc('0xc')]);router['put']('/:id',auth[_0xa3cc('0xa')](),controller[_0xa3cc('0xd')]);router[_0xa3cc('0xe')](_0xa3cc('0x9'),auth[_0xa3cc('0xa')](),controller[_0xa3cc('0xf')]);module[_0xa3cc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 15cd41b..3053045 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 _0xef96=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xef96,0x139));var _0x6ef9=function(_0x3c4ebf,_0xc55028){_0x3c4ebf=_0x3c4ebf-0x0;var _0x1f2c76=_0xef96[_0x3c4ebf];return _0x1f2c76;};'use strict';var moment=require(_0x6ef9('0x0'));var Sequelize=require(_0x6ef9('0x1'));module[_0x6ef9('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6ef9('0x3')],'unique':_0x6ef9('0x4')},'ListId':{'type':Sequelize[_0x6ef9('0x3')],'unique':_0x6ef9('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6ef9('0x3')],'unique':_0x6ef9('0x4')}}; \ No newline at end of file +var _0x2681=['contactListQueue','sequelize','exports','INTEGER'];(function(_0x2e785e,_0x232c0a){var _0x230f26=function(_0x55570a){while(--_0x55570a){_0x2e785e['push'](_0x2e785e['shift']());}};_0x230f26(++_0x232c0a);}(_0x2681,0x1c9));var _0x1268=function(_0x1d97c9,_0x139dd5){_0x1d97c9=_0x1d97c9-0x0;var _0x238378=_0x2681[_0x1d97c9];return _0x238378;};'use strict';var moment=require('moment');var Sequelize=require(_0x1268('0x0'));module[_0x1268('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1268('0x2')],'unique':_0x1268('0x3')},'ListId':{'type':Sequelize[_0x1268('0x2')],'unique':_0x1268('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1268('0x2')],'unique':_0x1268('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 067180e..6841ce4 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(_0x2bb7c6,_0x4c9352){var _0x56a8ab=function(_0x3ac42f){while(--_0x3ac42f){_0x2bb7c6['push'](_0x2bb7c6['shift']());}};_0x56a8ab(++_0x4c9352);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x3e929a,_0x379803){var _0x41b0fb=function(_0x3b4e5e){while(--_0x3b4e5e){_0x3e929a['push'](_0x3e929a['shift']());}};_0x41b0fb(++_0x379803);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 fd7c129..56b064b 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x27157e,_0x46180c){var _0x3ab344=function(_0x54f7a7){while(--_0x54f7a7){_0x27157e['push'](_0x27157e['shift']());}};_0x3ab344(++_0x46180c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x410da2,_0xdb5f1e){var _0x463d66=function(_0xf8e6af){while(--_0xf8e6af){_0x410da2['push'](_0x410da2['shift']());}};_0x463d66(++_0xdb5f1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index d287c98..3d91068 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 _0x85c3=['request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetCmHopperBlack','options','raw','where','attributes','limit','include','model','map','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x4cdad2,_0x1e56af){var _0x6c6eea=function(_0x51ed98){while(--_0x51ed98){_0x4cdad2['push'](_0x4cdad2['shift']());}};_0x6c6eea(++_0x1e56af);}(_0x85c3,0xb8));var _0x385c=function(_0x49bc7a,_0x4e3693){_0x49bc7a=_0x49bc7a-0x0;var _0x571963=_0x85c3[_0x49bc7a];return _0x571963;};'use strict';var _=require(_0x385c('0x0'));var util=require(_0x385c('0x1'));var moment=require('moment');var BPromise=require(_0x385c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x385c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x385c('0x4'))('rpc');var config=require(_0x385c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x385c('0x6')][_0x385c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48ca94,_0x4f1c70,_0x4dc194){return new BPromise(function(_0x90bd1a,_0x4184f7){return client[_0x385c('0x8')](_0x48ca94,_0x4dc194)[_0x385c('0x9')](function(_0x38ab76){logger[_0x385c('0xa')](_0x385c('0xb'),_0x4f1c70,_0x385c('0xc'));logger[_0x385c('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4f1c70,'request\x20sent',JSON[_0x385c('0xe')](_0x38ab76));if(_0x38ab76[_0x385c('0xf')]){if(_0x38ab76['error']['code']===0x1f4){logger[_0x385c('0xf')](_0x385c('0xb'),_0x4f1c70,_0x38ab76[_0x385c('0xf')][_0x385c('0x10')]);return _0x4184f7(_0x38ab76[_0x385c('0xf')][_0x385c('0x10')]);}logger[_0x385c('0xf')](_0x385c('0xb'),_0x4f1c70,_0x38ab76[_0x385c('0xf')][_0x385c('0x10')]);return _0x90bd1a(_0x38ab76[_0x385c('0xf')][_0x385c('0x10')]);}else{logger[_0x385c('0xa')](_0x385c('0xb'),_0x4f1c70,_0x385c('0xc'));_0x90bd1a(_0x38ab76[_0x385c('0x11')][_0x385c('0x10')]);}})['catch'](function(_0x43598d){logger[_0x385c('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4f1c70,_0x43598d);_0x4184f7(_0x43598d);});});}exports[_0x385c('0x12')]=function(_0x3fc6e1){var _0x3b1db1=this;return new Promise(function(_0x4fada0,_0x294988){return db['CmHopperBlack']['findAll']({'raw':_0x3fc6e1[_0x385c('0x13')]?_0x3fc6e1[_0x385c('0x13')][_0x385c('0x14')]===undefined?!![]:![]:!![],'where':_0x3fc6e1[_0x385c('0x13')]?_0x3fc6e1['options'][_0x385c('0x15')]||null:null,'attributes':_0x3fc6e1[_0x385c('0x13')]?_0x3fc6e1['options'][_0x385c('0x16')]||null:null,'limit':_0x3fc6e1[_0x385c('0x13')]?_0x3fc6e1['options'][_0x385c('0x17')]||null:null,'include':_0x3fc6e1[_0x385c('0x13')]?_0x3fc6e1[_0x385c('0x13')][_0x385c('0x18')]?_['map'](_0x3fc6e1[_0x385c('0x13')]['include'],function(_0x5e0ee0){return{'model':db[_0x5e0ee0[_0x385c('0x19')]],'as':_0x5e0ee0['as'],'attributes':_0x5e0ee0[_0x385c('0x16')],'include':_0x5e0ee0['include']?_['map'](_0x5e0ee0[_0x385c('0x18')],function(_0x3be204){return{'model':db[_0x3be204['model']],'as':_0x3be204['as'],'attributes':_0x3be204[_0x385c('0x16')],'include':_0x3be204[_0x385c('0x18')]?_[_0x385c('0x1a')](_0x3be204[_0x385c('0x18')],function(_0x59a3b7){return{'model':db[_0x59a3b7[_0x385c('0x19')]],'as':_0x59a3b7['as'],'attributes':_0x59a3b7[_0x385c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x385c('0x9')](function(_0x524d35){logger[_0x385c('0xa')](_0x385c('0x12'),_0x3fc6e1);logger['debug'](_0x385c('0x12'),_0x3fc6e1,JSON['stringify'](_0x524d35));_0x4fada0(_0x524d35);})['catch'](function(_0x97a009){logger[_0x385c('0xf')](_0x385c('0x12'),_0x97a009[_0x385c('0x10')],_0x3fc6e1);_0x294988(_0x3b1db1[_0x385c('0xf')](0x1f4,_0x97a009[_0x385c('0x10')]));});});};exports[_0x385c('0x1b')]=function(_0x314a1d){var _0x2ae5f6=this;return new Promise(function(_0x5b7778,_0x3428ff){return db[_0x385c('0x1c')][_0x385c('0x1d')](_0x314a1d[_0x385c('0x1e')],{'raw':_0x314a1d[_0x385c('0x13')]?_0x314a1d[_0x385c('0x13')][_0x385c('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314a1d[_0x385c('0x13')]?_0x314a1d[_0x385c('0x13')][_0x385c('0x15')]||null:null,'attributes':_0x314a1d['options']?_0x314a1d[_0x385c('0x13')][_0x385c('0x16')]||null:null,'limit':_0x314a1d['options']?_0x314a1d[_0x385c('0x13')][_0x385c('0x17')]||null:null})[_0x385c('0x9')](function(_0xbafebb){logger['info'](_0x385c('0x1b'),_0x314a1d);logger[_0x385c('0xd')](_0x385c('0x1b'),_0x314a1d,JSON[_0x385c('0xe')](_0xbafebb));_0x5b7778(_0xbafebb);})['catch'](function(_0x346d16){logger[_0x385c('0xf')](_0x385c('0x1b'),_0x346d16[_0x385c('0x10')],_0x314a1d);_0x3428ff(_0x2ae5f6['error'](0x1f4,_0x346d16[_0x385c('0x10')]));});});};exports[_0x385c('0x1f')]=function(_0x43d085){var _0x5e011f=this;return new Promise(function(_0x1adf86,_0x5236fe){return db[_0x385c('0x1c')]['destroy']({'where':_0x43d085['options']?_0x43d085[_0x385c('0x13')]['where']||null:null})[_0x385c('0x9')](function(_0x3c6507){logger[_0x385c('0xa')]('DestroyCmHopperBlack',_0x43d085);logger['debug'](_0x385c('0x1f'),_0x43d085,JSON['stringify'](_0x3c6507));_0x1adf86(_0x3c6507);})['catch'](function(_0x219b09){logger[_0x385c('0xf')](_0x385c('0x1f'),_0x219b09[_0x385c('0x10')],_0x43d085);_0x5236fe(_0x5e011f[_0x385c('0xf')](0x1f4,_0x219b09[_0x385c('0x10')]));});});}; \ No newline at end of file +var _0x9656=['raw','where','attributes','include','map','model','then','UpdateCmHopperBlack','update','body','limit','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9656,0x12c));var _0x6965=function(_0x103ec9,_0x3bbee2){_0x103ec9=_0x103ec9-0x0;var _0x335786=_0x9656[_0x103ec9];return _0x335786;};'use strict';var _=require(_0x6965('0x0'));var util=require(_0x6965('0x1'));var moment=require(_0x6965('0x2'));var BPromise=require(_0x6965('0x3'));var rs=require(_0x6965('0x4'));var fs=require('fs');var Redis=require(_0x6965('0x5'));var db=require(_0x6965('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6965('0x7'))(_0x6965('0x8'));var config=require(_0x6965('0x9'));var jayson=require(_0x6965('0xa'));var client=jayson[_0x6965('0xb')][_0x6965('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3920e8,_0x4bd48b,_0x418c59){return new BPromise(function(_0x402234,_0x43fbee){return client[_0x6965('0xd')](_0x3920e8,_0x418c59)['then'](function(_0x553ba2){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4bd48b,_0x6965('0xe'));logger[_0x6965('0xf')](_0x6965('0x10'),_0x4bd48b,_0x6965('0xe'),JSON[_0x6965('0x11')](_0x553ba2));if(_0x553ba2['error']){if(_0x553ba2[_0x6965('0x12')]['code']===0x1f4){logger[_0x6965('0x12')](_0x6965('0x13'),_0x4bd48b,_0x553ba2[_0x6965('0x12')]['message']);return _0x43fbee(_0x553ba2[_0x6965('0x12')][_0x6965('0x14')]);}logger['error'](_0x6965('0x13'),_0x4bd48b,_0x553ba2[_0x6965('0x12')]['message']);return _0x402234(_0x553ba2[_0x6965('0x12')][_0x6965('0x14')]);}else{logger[_0x6965('0x15')](_0x6965('0x13'),_0x4bd48b,'request\x20sent');_0x402234(_0x553ba2[_0x6965('0x16')][_0x6965('0x14')]);}})[_0x6965('0x17')](function(_0x5b0cb3){logger['error'](_0x6965('0x13'),_0x4bd48b,_0x5b0cb3);_0x43fbee(_0x5b0cb3);});});}exports[_0x6965('0x18')]=function(_0xd28fcb){var _0x1f8f3d=this;return new Promise(function(_0x4b5a1c,_0x542ccf){return db[_0x6965('0x19')][_0x6965('0x1a')]({'raw':_0xd28fcb['options']?_0xd28fcb[_0x6965('0x1b')][_0x6965('0x1c')]===undefined?!![]:![]:!![],'where':_0xd28fcb[_0x6965('0x1b')]?_0xd28fcb[_0x6965('0x1b')][_0x6965('0x1d')]||null:null,'attributes':_0xd28fcb[_0x6965('0x1b')]?_0xd28fcb[_0x6965('0x1b')][_0x6965('0x1e')]||null:null,'limit':_0xd28fcb['options']?_0xd28fcb[_0x6965('0x1b')]['limit']||null:null,'include':_0xd28fcb[_0x6965('0x1b')]?_0xd28fcb[_0x6965('0x1b')][_0x6965('0x1f')]?_[_0x6965('0x20')](_0xd28fcb[_0x6965('0x1b')][_0x6965('0x1f')],function(_0x25bea9){return{'model':db[_0x25bea9[_0x6965('0x21')]],'as':_0x25bea9['as'],'attributes':_0x25bea9['attributes'],'include':_0x25bea9['include']?_[_0x6965('0x20')](_0x25bea9['include'],function(_0x234af0){return{'model':db[_0x234af0[_0x6965('0x21')]],'as':_0x234af0['as'],'attributes':_0x234af0['attributes'],'include':_0x234af0['include']?_['map'](_0x234af0['include'],function(_0x4c409d){return{'model':db[_0x4c409d[_0x6965('0x21')]],'as':_0x4c409d['as'],'attributes':_0x4c409d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6965('0x22')](function(_0x397dc6){logger[_0x6965('0x15')]('GetCmHopperBlack',_0xd28fcb);logger[_0x6965('0xf')](_0x6965('0x18'),_0xd28fcb,JSON[_0x6965('0x11')](_0x397dc6));_0x4b5a1c(_0x397dc6);})[_0x6965('0x17')](function(_0x2afcd9){logger['error'](_0x6965('0x18'),_0x2afcd9[_0x6965('0x14')],_0xd28fcb);_0x542ccf(_0x1f8f3d[_0x6965('0x12')](0x1f4,_0x2afcd9[_0x6965('0x14')]));});});};exports[_0x6965('0x23')]=function(_0x308e23){var _0x20e65e=this;return new Promise(function(_0x345074,_0x5a0c46){return db[_0x6965('0x19')][_0x6965('0x24')](_0x308e23[_0x6965('0x25')],{'raw':_0x308e23[_0x6965('0x1b')]?_0x308e23[_0x6965('0x1b')][_0x6965('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308e23[_0x6965('0x1b')]?_0x308e23['options'][_0x6965('0x1d')]||null:null,'attributes':_0x308e23['options']?_0x308e23[_0x6965('0x1b')][_0x6965('0x1e')]||null:null,'limit':_0x308e23[_0x6965('0x1b')]?_0x308e23[_0x6965('0x1b')][_0x6965('0x26')]||null:null})[_0x6965('0x22')](function(_0x6636c7){logger['info'](_0x6965('0x23'),_0x308e23);logger['debug']('UpdateCmHopperBlack',_0x308e23,JSON[_0x6965('0x11')](_0x6636c7));_0x345074(_0x6636c7);})[_0x6965('0x17')](function(_0x3e131b){logger['error'](_0x6965('0x23'),_0x3e131b[_0x6965('0x14')],_0x308e23);_0x5a0c46(_0x20e65e[_0x6965('0x12')](0x1f4,_0x3e131b[_0x6965('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x15b23a){var _0x3347c5=this;return new Promise(function(_0x40fbf9,_0x4a13b4){return db[_0x6965('0x19')][_0x6965('0x27')]({'where':_0x15b23a[_0x6965('0x1b')]?_0x15b23a['options']['where']||null:null})[_0x6965('0x22')](function(_0x59addb){logger[_0x6965('0x15')](_0x6965('0x28'),_0x15b23a);logger[_0x6965('0xf')](_0x6965('0x28'),_0x15b23a,JSON[_0x6965('0x11')](_0x59addb));_0x40fbf9(_0x59addb);})[_0x6965('0x17')](function(_0x4f5437){logger['error'](_0x6965('0x28'),_0x4f5437['message'],_0x15b23a);_0x4a13b4(_0x3347c5[_0x6965('0x12')](0x1f4,_0x4f5437['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 60be17e..b4f5b31 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 _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','/:id','isAuthenticated','show','put','update','delete','exports','util','path','express','Router'];(function(_0x317cc3,_0x319661){var _0x329b98=function(_0x14dd2f){while(--_0x14dd2f){_0x317cc3['push'](_0x317cc3['shift']());}};_0x329b98(++_0x319661);}(_0x5c12,0x188));var _0x25c1=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x5c12[_0x2cc569];return _0x1bfc2e;};'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['describe']);router[_0x25c1('0x8')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')]('/:id',auth[_0x25c1('0xc')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller['destroy']);module[_0x25c1('0x11')]=router; \ No newline at end of file +var _0x2d17=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put'];(function(_0x44af3b,_0x157b10){var _0x1eab0e=function(_0x441da1){while(--_0x441da1){_0x44af3b['push'](_0x44af3b['shift']());}};_0x1eab0e(++_0x157b10);}(_0x2d17,0x17e));var _0x72d1=function(_0x31b410,_0x171dee){_0x31b410=_0x31b410-0x0;var _0x36dd51=_0x2d17[_0x31b410];return _0x36dd51;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0x8')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xc')]);router[_0x72d1('0xd')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0xf')](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x10')]);module[_0x72d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f2c16da..1a0963d 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 _0xfc10=['followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x368b83,_0x3f5f52){var _0x188fe7=function(_0x2fb1cf){while(--_0x2fb1cf){_0x368b83['push'](_0x368b83['shift']());}};_0x188fe7(++_0x3f5f52);}(_0xfc10,0x156));var _0x0fc1=function(_0x48dd2b,_0x342f07){_0x48dd2b=_0x48dd2b-0x0;var _0x2e8172=_0xfc10[_0x48dd2b];return _0x2e8172;};'use strict';var Sequelize=require(_0x0fc1('0x0'));var moment=require(_0x0fc1('0x1'));module[_0x0fc1('0x2')]={'state':{'type':Sequelize[_0x0fc1('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0fc1('0x4')]},'scheduledat':{'type':Sequelize[_0x0fc1('0x5')]},'countbusyretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0fc1('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0fc1('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0fc1('0x4')]},'calleridnum':{'type':Sequelize[_0x0fc1('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0fc1('0x5')]},'responsetime':{'type':Sequelize[_0x0fc1('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0fc1('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0fc1('0x4')]},'campaign':{'type':Sequelize[_0x0fc1('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x0fc1('0x4')]},'disposition':{'type':Sequelize[_0x0fc1('0x4')]},'dispositionat':{'type':Sequelize[_0x0fc1('0x5')],'set':function(_0x50d4c2){var _0x2d5649=this[_0x0fc1('0x6')](_0x0fc1('0x7'));if(_0x2d5649&&_0x50d4c2){this[_0x0fc1('0x8')](_0x0fc1('0x9'),moment(_0x50d4c2)[_0x0fc1('0xa')](moment(_0x2d5649),'seconds'));}return this[_0x0fc1('0x8')](_0x0fc1('0xb'),_0x50d4c2);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0fc1('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0fc1('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0fc1('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x0fc1('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0fc1('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0fc1('0x5')]},'deleted':{'type':Sequelize[_0x0fc1('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0fc1('0x5')]},'recallme':{'type':Sequelize[_0x0fc1('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0fc1('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0fc1('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x43b5=['STRING','DATE','endtime','followuptime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x43b5,0x152));var _0x543b=function(_0x1a87c6,_0x381810){_0x1a87c6=_0x1a87c6-0x0;var _0x3bfd5c=_0x43b5[_0x1a87c6];return _0x3bfd5c;};'use strict';var Sequelize=require(_0x543b('0x0'));var moment=require('moment');module[_0x543b('0x1')]={'state':{'type':Sequelize[_0x543b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x543b('0x3')]},'scheduledat':{'type':Sequelize[_0x543b('0x4')]},'countbusyretry':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x543b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x543b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x543b('0x3')]},'calleridname':{'type':Sequelize[_0x543b('0x3')]},'starttime':{'type':Sequelize[_0x543b('0x4')]},'responsetime':{'type':Sequelize[_0x543b('0x4')]},'answertime':{'type':Sequelize[_0x543b('0x4')]},'droptime':{'type':Sequelize[_0x543b('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x543b('0x3')]},'campaign':{'type':Sequelize[_0x543b('0x3')]},'campaigntype':{'type':Sequelize[_0x543b('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x543b('0x3')]},'disposition':{'type':Sequelize[_0x543b('0x3')]},'dispositionat':{'type':Sequelize[_0x543b('0x4')],'set':function(_0xc511e2){var _0x136732=this['getDataValue'](_0x543b('0x5'));if(_0x136732&&_0xc511e2){this['setDataValue'](_0x543b('0x6'),moment(_0xc511e2)[_0x543b('0x7')](moment(_0x136732),'seconds'));}return this[_0x543b('0x8')](_0x543b('0x9'),_0xc511e2);}},'amd':{'type':Sequelize[_0x543b('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x543b('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x543b('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x543b('0x4')]},'callback':{'type':Sequelize[_0x543b('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x543b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x543b('0x4')]},'deleted':{'type':Sequelize[_0x543b('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x543b('0x4')]},'recallme':{'type':Sequelize[_0x543b('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x543b('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x543b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x543b('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 1174603..fc2b018 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 _0xa486=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','map','CmHopperFinal','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa486,0x17d));var _0x6a48=function(_0x3b0503,_0x5ecab3){_0x3b0503=_0x3b0503-0x0;var _0x52511a=_0xa486[_0x3b0503];return _0x52511a;};'use strict';var pdf=require(_0x6a48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a48('0x2'));var rp=require('request-promise');var moment=require(_0x6a48('0x3'));var BPromise=require(_0x6a48('0x4'));var Mustache=require(_0x6a48('0x5'));var util=require(_0x6a48('0x6'));var path=require(_0x6a48('0x7'));var sox=require(_0x6a48('0x8'));var csv=require(_0x6a48('0x9'));var ejs=require(_0x6a48('0xa'));var fs=require('fs');var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x9'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var db=require(_0x6a48('0x19'))['db'];function respondWithStatusCode(_0x416d66,_0x3f099a){_0x3f099a=_0x3f099a||0xcc;return function(_0x3c5ef9){if(_0x3c5ef9){return _0x416d66[_0x6a48('0x1a')](_0x3f099a);}return _0x416d66[_0x6a48('0x1b')](_0x3f099a)[_0x6a48('0x1c')]();};}function respondWithResult(_0x2df927,_0x4636e5){_0x4636e5=_0x4636e5||0xc8;return function(_0x9909af){if(_0x9909af){return _0x2df927[_0x6a48('0x1b')](_0x4636e5)[_0x6a48('0x1d')](_0x9909af);}};}function respondWithFilteredResult(_0x180319,_0x43f5fa){return function(_0x3315c1){if(_0x3315c1){var _0x10867e=_0x3315c1[_0x6a48('0x1e')],_0x231930=_0x43f5fa[_0x6a48('0x1f')],_0xaf303c=_0x43f5fa[_0x6a48('0x1f')]+_0x43f5fa['limit'],_0xad96d0;if(_0xaf303c>=_0x10867e){_0xaf303c=_0x10867e;_0xad96d0=0xc8;}else{_0xad96d0=0xce;}_0x180319[_0x6a48('0x1b')](_0xad96d0);return _0x180319[_0x6a48('0x20')](_0x6a48('0x21'),_0x231930+'-'+_0xaf303c+'/'+_0x10867e)[_0x6a48('0x1d')](_0x3315c1);}return null;};}function patchUpdates(_0x51a4ef){return function(_0x2757b7){try{jsonpatch[_0x6a48('0x22')](_0x2757b7,_0x51a4ef,!![]);}catch(_0x3f583c){return BPromise['reject'](_0x3f583c);}return _0x2757b7[_0x6a48('0x23')]();};}function saveUpdates(_0x6a0206,_0x426272){return function(_0x56fc96){if(_0x56fc96){return _0x56fc96[_0x6a48('0x24')](_0x6a0206)[_0x6a48('0x25')](function(_0x14dc20){return _0x14dc20;});}return null;};}function removeEntity(_0x22642a,_0x4ee111){return function(_0x1afaf3){if(_0x1afaf3){return _0x1afaf3[_0x6a48('0x26')]()['then'](function(){_0x22642a['status'](0xcc)[_0x6a48('0x1c')]();});}};}function handleEntityNotFound(_0x31ed88,_0x4cb5d0){return function(_0x2eae9f){if(!_0x2eae9f){_0x31ed88['sendStatus'](0x194);}return _0x2eae9f;};}function handleError(_0x508432,_0x4f38a2){_0x4f38a2=_0x4f38a2||0x1f4;return function(_0x4fe71c){logger[_0x6a48('0x27')](_0x4fe71c['stack']);if(_0x4fe71c[_0x6a48('0x28')]){delete _0x4fe71c['name'];}_0x508432['status'](_0x4f38a2)['send'](_0x4fe71c);};}exports['index']=function(_0x15b75a,_0x29cfd2){var _0x2cb60e={},_0x20ecb0={},_0x4c53cc={'count':0x0,'rows':[]};var _0x370bfe=_[_0x6a48('0x29')](db[_0x6a48('0x2a')][_0x6a48('0x2b')],function(_0x5188e8){return{'name':_0x5188e8['fieldName'],'type':_0x5188e8[_0x6a48('0x2c')][_0x6a48('0x2d')]};});_0x20ecb0[_0x6a48('0x2e')]=_[_0x6a48('0x29')](_0x370bfe,_0x6a48('0x28'));_0x20ecb0['query']=_[_0x6a48('0x2f')](_0x15b75a['query']);_0x20ecb0['filters']=_[_0x6a48('0x30')](_0x20ecb0[_0x6a48('0x2e')],_0x20ecb0[_0x6a48('0x31')]);_0x2cb60e[_0x6a48('0x32')]=_[_0x6a48('0x30')](_0x20ecb0[_0x6a48('0x2e')],qs[_0x6a48('0x33')](_0x15b75a[_0x6a48('0x31')][_0x6a48('0x33')]));_0x2cb60e[_0x6a48('0x32')]=_0x2cb60e[_0x6a48('0x32')][_0x6a48('0x34')]?_0x2cb60e['attributes']:_0x20ecb0[_0x6a48('0x2e')];if(!_0x15b75a[_0x6a48('0x31')][_0x6a48('0x35')]('nolimit')){_0x2cb60e[_0x6a48('0x36')]=qs['limit'](_0x15b75a[_0x6a48('0x31')]['limit']);_0x2cb60e[_0x6a48('0x1f')]=qs[_0x6a48('0x1f')](_0x15b75a[_0x6a48('0x31')]['offset']);}_0x2cb60e[_0x6a48('0x37')]=qs[_0x6a48('0x38')](_0x15b75a['query']['sort']);_0x2cb60e[_0x6a48('0x39')]=qs[_0x6a48('0x3a')](_[_0x6a48('0x3b')](_0x15b75a[_0x6a48('0x31')],_0x20ecb0[_0x6a48('0x3a')]),_0x370bfe);if(_0x15b75a[_0x6a48('0x31')][_0x6a48('0x3c')]){_0x2cb60e[_0x6a48('0x39')]=_['merge'](_0x2cb60e[_0x6a48('0x39')],{'$or':_[_0x6a48('0x29')](_0x370bfe,function(_0x35c3cf){if(_0x35c3cf[_0x6a48('0x2c')]!==_0x6a48('0x3d')){var _0x434f53={};_0x434f53[_0x35c3cf[_0x6a48('0x28')]]={'$like':'%'+_0x15b75a[_0x6a48('0x31')][_0x6a48('0x3c')]+'%'};return _0x434f53;}})});}_0x2cb60e=_[_0x6a48('0x3e')]({},_0x2cb60e,_0x15b75a[_0x6a48('0x3f')]);var _0x42b8c5={'where':_0x2cb60e[_0x6a48('0x39')]};return db[_0x6a48('0x2a')]['count'](_0x42b8c5)[_0x6a48('0x25')](function(_0x3afa36){_0x4c53cc['count']=_0x3afa36;if(_0x15b75a[_0x6a48('0x31')][_0x6a48('0x40')]){_0x2cb60e[_0x6a48('0x41')]=[{'all':!![]}];}return db[_0x6a48('0x2a')]['findAll'](_0x2cb60e);})[_0x6a48('0x25')](function(_0x8fd3c6){_0x4c53cc[_0x6a48('0x42')]=_0x8fd3c6;return _0x4c53cc;})[_0x6a48('0x25')](respondWithFilteredResult(_0x29cfd2,_0x2cb60e))[_0x6a48('0x43')](handleError(_0x29cfd2,null));};exports[_0x6a48('0x44')]=function(_0x8b6d35,_0x4e7413){var _0x5cbb47={'raw':!![],'where':{'id':_0x8b6d35[_0x6a48('0x45')]['id']}},_0x18b571={};_0x18b571['model']=_[_0x6a48('0x2f')](db[_0x6a48('0x2a')]['rawAttributes']);_0x18b571[_0x6a48('0x31')]=_[_0x6a48('0x2f')](_0x8b6d35[_0x6a48('0x31')]);_0x18b571[_0x6a48('0x3a')]=_[_0x6a48('0x30')](_0x18b571['model'],_0x18b571[_0x6a48('0x31')]);_0x5cbb47['attributes']=_['intersection'](_0x18b571[_0x6a48('0x2e')],qs['fields'](_0x8b6d35[_0x6a48('0x31')]['fields']));_0x5cbb47[_0x6a48('0x32')]=_0x5cbb47[_0x6a48('0x32')][_0x6a48('0x34')]?_0x5cbb47['attributes']:_0x18b571[_0x6a48('0x2e')];if(_0x8b6d35['query']['includeAll']){_0x5cbb47['include']=[{'all':!![]}];}_0x5cbb47=_[_0x6a48('0x3e')]({},_0x5cbb47,_0x8b6d35['options']);return db[_0x6a48('0x2a')][_0x6a48('0x46')](_0x5cbb47)[_0x6a48('0x25')](handleEntityNotFound(_0x4e7413,null))[_0x6a48('0x25')](respondWithResult(_0x4e7413,null))['catch'](handleError(_0x4e7413,null));};exports[_0x6a48('0x47')]=function(_0x53f7b7,_0x3b861a){return db[_0x6a48('0x2a')]['describe']()['then'](respondWithResult(_0x3b861a,null))[_0x6a48('0x43')](handleError(_0x3b861a,null));};exports[_0x6a48('0x24')]=function(_0x5c91cf,_0x130ca0){if(_0x5c91cf[_0x6a48('0x48')][_0x6a48('0x49')]){delete _0x5c91cf[_0x6a48('0x48')][_0x6a48('0x49')];}return db[_0x6a48('0x2a')][_0x6a48('0x46')]({'where':{'uniqueid':_0x5c91cf['params']['id']}})[_0x6a48('0x25')](handleEntityNotFound(_0x130ca0,null))[_0x6a48('0x25')](saveUpdates(_0x5c91cf['body'],null))[_0x6a48('0x25')](respondWithResult(_0x130ca0,null))[_0x6a48('0x43')](handleError(_0x130ca0,null));};exports[_0x6a48('0x4a')]=function(_0x3742f9,_0x375358,_0x58b400){return db[_0x6a48('0x2a')][_0x6a48('0x4b')]({'raw':![],'where':{'VoiceQueueId':_0x3742f9[_0x6a48('0x45')]['id']},'attributes':[[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0x6a48('0x4e')](_0x6a48('0x4f')))),_0x6a48('0x50')],[db['sequelize']['fn'](_0x6a48('0x4d'),db['sequelize']['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x6a48('0x51')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x52')))),'busyContacts'],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0x6a48('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x6a48('0x4c')]['fn']('COUNT',db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6a48('0x53')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6a48('0x54')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db['sequelize']['fn']('IF',db[_0x6a48('0x4c')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6a48('0x55')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0x6a48('0x4e')](_0x6a48('0x56')))),_0x6a48('0x57')]]})['then'](handleEntityNotFound(_0x375358,null))[_0x6a48('0x25')](respondWithResult(_0x375358,null))[_0x6a48('0x43')](handleError(_0x375358,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x476ef6,_0x4a0baa,_0x4314ac){return db[_0x6a48('0x2a')][_0x6a48('0x4b')]({'raw':![],'where':{'CampaignId':_0x476ef6[_0x6a48('0x45')]['id']},'attributes':[[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db['sequelize'][_0x6a48('0x4e')](_0x6a48('0x4f')))),_0x6a48('0x50')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x58')))),_0x6a48('0x51')],[db[_0x6a48('0x4c')]['fn']('COUNT',db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x52')))),_0x6a48('0x59')],[db[_0x6a48('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x6a48('0x4e')](_0x6a48('0x5a')))),_0x6a48('0x5b')],[db[_0x6a48('0x4c')]['fn']('COUNT',db[_0x6a48('0x4c')]['fn']('IF',db['sequelize'][_0x6a48('0x4e')](_0x6a48('0x5c')))),_0x6a48('0x53')],[db[_0x6a48('0x4c')]['fn']('COUNT',db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x5d')))),_0x6a48('0x54')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x5e')))),_0x6a48('0x55')],[db[_0x6a48('0x4c')]['fn'](_0x6a48('0x4d'),db[_0x6a48('0x4c')]['fn']('IF',db[_0x6a48('0x4c')][_0x6a48('0x4e')](_0x6a48('0x56')))),_0x6a48('0x57')]]})[_0x6a48('0x25')](handleEntityNotFound(_0x4a0baa,null))[_0x6a48('0x25')](respondWithResult(_0x4a0baa,null))[_0x6a48('0x43')](handleError(_0x4a0baa,null));};exports[_0x6a48('0x5f')]=function(_0x27ed0c,_0x5a10bc,_0x4435ab){return db['VoiceQueue'][_0x6a48('0x46')]({'where':{'id':_0x27ed0c[_0x6a48('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a10bc,null))[_0x6a48('0x25')](function(_0x42ef67){var _0x5acda6;if(_0x42ef67){_0x5acda6=squel[_0x6a48('0x60')]()['into'](_0x6a48('0x61'))['fromQuery']([_0x6a48('0x62'),_0x6a48('0x63'),_0x6a48('0x64'),'ListId',_0x6a48('0x65'),_0x6a48('0x66'),'updatedAt'],squel['select']()[_0x6a48('0x67')]('ANY_VALUE(calleridnum)','phone')['field'](_0x6a48('0x68'),_0x6a48('0x63'))[_0x6a48('0x67')](_0x6a48('0x69'),_0x6a48('0x64'))['field'](_0x6a48('0x6a'),_0x6a48('0x6b'))[_0x6a48('0x67')](_0x6a48('0x6c'),_0x6a48('0x65'))[_0x6a48('0x67')](_0x6a48('0x68'),_0x6a48('0x66'))[_0x6a48('0x67')]('NOW()',_0x6a48('0x6d'))[_0x6a48('0x6e')](_0x6a48('0x6f'))[_0x6a48('0x39')]('VoiceQueueId\x20=\x20?',_0x27ed0c[_0x6a48('0x45')]['id'][_0x6a48('0x70')]())[_0x6a48('0x39')](_0x6a48('0x71'),_0x27ed0c['body'][_0x6a48('0x72')]['toString']())[_0x6a48('0x39')](_0x6a48('0x73'))['where'](_0x6a48('0x74'),squel[_0x6a48('0x75')]()[_0x6a48('0x67')]('phone')[_0x6a48('0x6e')](_0x6a48('0x61'))[_0x6a48('0x39')](_0x6a48('0x76'),_0x27ed0c[_0x6a48('0x45')]['id'][_0x6a48('0x70')]()))[_0x6a48('0x39')](_0x6a48('0x74'),squel[_0x6a48('0x75')]()['field'](_0x6a48('0x77'))[_0x6a48('0x6e')]('cm_hopper_final')[_0x6a48('0x39')]('VoiceQueueId\x20=\x20?',_0x27ed0c[_0x6a48('0x45')]['id'][_0x6a48('0x70')]())[_0x6a48('0x39')](_0x6a48('0x78')))[_0x6a48('0x79')](_0x6a48('0x64')))[_0x6a48('0x70')]();return db[_0x6a48('0x4c')][_0x6a48('0x31')](_0x5acda6);}return[];})[_0x6a48('0x25')](respondWithResult(_0x5a10bc,null))['catch'](handleError(_0x5a10bc,null));};exports[_0x6a48('0x7a')]=function(_0xdcfa2d,_0x2b1ad4,_0xf2cd45){return db[_0x6a48('0x7b')][_0x6a48('0x46')]({'where':{'id':_0xdcfa2d[_0x6a48('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b1ad4,null))['then'](function(_0x471e27){var _0x2695d1;if(_0x471e27){_0x2695d1=squel['insert']()['into'](_0x6a48('0x61'))[_0x6a48('0x7c')]([_0x6a48('0x62'),_0x6a48('0x63'),_0x6a48('0x64'),'ListId',_0x6a48('0x7d'),'createdAt',_0x6a48('0x6d')],squel[_0x6a48('0x75')]()[_0x6a48('0x67')](_0x6a48('0x7e'),_0x6a48('0x62'))[_0x6a48('0x67')](_0x6a48('0x68'),_0x6a48('0x63'))[_0x6a48('0x67')](_0x6a48('0x69'),_0x6a48('0x64'))['field'](_0x6a48('0x6a'),_0x6a48('0x6b'))[_0x6a48('0x67')](_0x6a48('0x7f'),_0x6a48('0x7d'))['field']('NOW()',_0x6a48('0x66'))['field'](_0x6a48('0x68'),_0x6a48('0x6d'))[_0x6a48('0x6e')](_0x6a48('0x6f'))[_0x6a48('0x39')]('CampaignId\x20=\x20?',_0xdcfa2d['params']['id'][_0x6a48('0x70')]())['where'](_0x6a48('0x71'),_0xdcfa2d['body'][_0x6a48('0x72')][_0x6a48('0x70')]())[_0x6a48('0x39')](_0x6a48('0x73'))['where'](_0x6a48('0x74'),squel[_0x6a48('0x75')]()[_0x6a48('0x67')]('phone')[_0x6a48('0x6e')](_0x6a48('0x61'))['where']('CampaignId\x20=\x20?',_0xdcfa2d[_0x6a48('0x45')]['id'][_0x6a48('0x70')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6a48('0x75')]()['field'](_0x6a48('0x77'))[_0x6a48('0x6e')](_0x6a48('0x6f'))[_0x6a48('0x39')](_0x6a48('0x80'),_0xdcfa2d[_0x6a48('0x45')]['id'][_0x6a48('0x70')]())[_0x6a48('0x39')](_0x6a48('0x78')))['group']('ContactId'))[_0x6a48('0x70')]();return db['sequelize'][_0x6a48('0x31')](_0x2695d1);}return[];})[_0x6a48('0x25')](respondWithResult(_0x2b1ad4,null))[_0x6a48('0x43')](handleError(_0x2b1ad4,null));};exports[_0x6a48('0x81')]=function(_0x24acc7,_0x312306,_0x3e1c26){return db[_0x6a48('0x82')]['findOne']({'where':{'VoiceQueueId':_0x24acc7[_0x6a48('0x48')][_0x6a48('0x65')],'CampaignId':_0x24acc7[_0x6a48('0x48')][_0x6a48('0x7d')],'ContactId':_0x24acc7['body'][_0x6a48('0x64')]}})[_0x6a48('0x25')](handleEntityNotFound(_0x312306,null))[_0x6a48('0x25')](function(_0x3a46ab){if(_0x3a46ab){return _0x3a46ab;}return null;})[_0x6a48('0x25')](respondWithResult(_0x312306,null))['catch'](handleError(_0x312306,null));}; \ No newline at end of file +var _0x2b47=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','CmHopperFinal','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','keys','include','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','find','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','toString','state\x20=\x204','group','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x2bbcde,_0x216bc5){var _0x3e1b74=function(_0x3cf024){while(--_0x3cf024){_0x2bbcde['push'](_0x2bbcde['shift']());}};_0x3e1b74(++_0x216bc5);}(_0x2b47,0x177));var _0x72b4=function(_0x29a7a9,_0x7adc87){_0x29a7a9=_0x29a7a9-0x0;var _0x51be2a=_0x2b47[_0x29a7a9];return _0x51be2a;};'use strict';var pdf=require(_0x72b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x72b4('0x1'));var zipdir=require(_0x72b4('0x2'));var jsonpatch=require(_0x72b4('0x3'));var rp=require('request-promise');var moment=require(_0x72b4('0x4'));var BPromise=require(_0x72b4('0x5'));var Mustache=require(_0x72b4('0x6'));var util=require(_0x72b4('0x7'));var path=require(_0x72b4('0x8'));var sox=require(_0x72b4('0x9'));var csv=require('to-csv');var ejs=require(_0x72b4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72b4('0xb'));var crypto=require(_0x72b4('0xc'));var jsforce=require(_0x72b4('0xd'));var deskjs=require(_0x72b4('0xe'));var toCsv=require(_0x72b4('0xf'));var querystring=require(_0x72b4('0x10'));var Papa=require(_0x72b4('0x11'));var Redis=require(_0x72b4('0x12'));var authService=require(_0x72b4('0x13'));var qs=require(_0x72b4('0x14'));var as=require(_0x72b4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b4('0x16'))(_0x72b4('0x17'));var utils=require(_0x72b4('0x18'));var config=require(_0x72b4('0x19'));var db=require(_0x72b4('0x1a'))['db'];function respondWithStatusCode(_0x2b80f0,_0x19435a){_0x19435a=_0x19435a||0xcc;return function(_0x25cbed){if(_0x25cbed){return _0x2b80f0[_0x72b4('0x1b')](_0x19435a);}return _0x2b80f0[_0x72b4('0x1c')](_0x19435a)[_0x72b4('0x1d')]();};}function respondWithResult(_0x5bafa2,_0x3ae95d){_0x3ae95d=_0x3ae95d||0xc8;return function(_0x2d0b4f){if(_0x2d0b4f){return _0x5bafa2[_0x72b4('0x1c')](_0x3ae95d)[_0x72b4('0x1e')](_0x2d0b4f);}};}function respondWithFilteredResult(_0x5cd685,_0x5c6303){return function(_0x3eff87){if(_0x3eff87){var _0x5c7c36=_0x3eff87[_0x72b4('0x1f')],_0x21ff7d=_0x5c6303[_0x72b4('0x20')],_0x2d4fd0=_0x5c6303[_0x72b4('0x20')]+_0x5c6303[_0x72b4('0x21')],_0x5ac4fc;if(_0x2d4fd0>=_0x5c7c36){_0x2d4fd0=_0x5c7c36;_0x5ac4fc=0xc8;}else{_0x5ac4fc=0xce;}_0x5cd685[_0x72b4('0x1c')](_0x5ac4fc);return _0x5cd685[_0x72b4('0x22')](_0x72b4('0x23'),_0x21ff7d+'-'+_0x2d4fd0+'/'+_0x5c7c36)[_0x72b4('0x1e')](_0x3eff87);}return null;};}function patchUpdates(_0x1a1543){return function(_0x53c344){try{jsonpatch[_0x72b4('0x24')](_0x53c344,_0x1a1543,!![]);}catch(_0x52f908){return BPromise[_0x72b4('0x25')](_0x52f908);}return _0x53c344[_0x72b4('0x26')]();};}function saveUpdates(_0x518fda,_0x13d8d1){return function(_0xc74320){if(_0xc74320){return _0xc74320['update'](_0x518fda)[_0x72b4('0x27')](function(_0x563ddf){return _0x563ddf;});}return null;};}function removeEntity(_0x1f6547,_0x5dce4d){return function(_0x567592){if(_0x567592){return _0x567592[_0x72b4('0x28')]()['then'](function(){_0x1f6547[_0x72b4('0x1c')](0xcc)[_0x72b4('0x1d')]();});}};}function handleEntityNotFound(_0x1da2a5,_0x4f4ce8){return function(_0x3a21d6){if(!_0x3a21d6){_0x1da2a5[_0x72b4('0x1b')](0x194);}return _0x3a21d6;};}function handleError(_0x355d21,_0x48f8e0){_0x48f8e0=_0x48f8e0||0x1f4;return function(_0x2a29d8){logger[_0x72b4('0x29')](_0x2a29d8[_0x72b4('0x2a')]);if(_0x2a29d8[_0x72b4('0x2b')]){delete _0x2a29d8[_0x72b4('0x2b')];}_0x355d21[_0x72b4('0x1c')](_0x48f8e0)[_0x72b4('0x2c')](_0x2a29d8);};}exports['index']=function(_0x3743c8,_0x5d0d20){var _0x32c0ab={},_0x20bcb0={},_0x3489bc={'count':0x0,'rows':[]};var _0x464a4d=_[_0x72b4('0x2d')](db[_0x72b4('0x2e')]['rawAttributes'],function(_0x3a5a55){return{'name':_0x3a5a55[_0x72b4('0x2f')],'type':_0x3a5a55[_0x72b4('0x30')][_0x72b4('0x31')]};});_0x20bcb0[_0x72b4('0x32')]=_[_0x72b4('0x2d')](_0x464a4d,_0x72b4('0x2b'));_0x20bcb0[_0x72b4('0x33')]=_['keys'](_0x3743c8[_0x72b4('0x33')]);_0x20bcb0[_0x72b4('0x34')]=_['intersection'](_0x20bcb0[_0x72b4('0x32')],_0x20bcb0[_0x72b4('0x33')]);_0x32c0ab[_0x72b4('0x35')]=_[_0x72b4('0x36')](_0x20bcb0[_0x72b4('0x32')],qs[_0x72b4('0x37')](_0x3743c8[_0x72b4('0x33')][_0x72b4('0x37')]));_0x32c0ab[_0x72b4('0x35')]=_0x32c0ab[_0x72b4('0x35')][_0x72b4('0x38')]?_0x32c0ab[_0x72b4('0x35')]:_0x20bcb0[_0x72b4('0x32')];if(!_0x3743c8[_0x72b4('0x33')][_0x72b4('0x39')](_0x72b4('0x3a'))){_0x32c0ab['limit']=qs['limit'](_0x3743c8[_0x72b4('0x33')]['limit']);_0x32c0ab[_0x72b4('0x20')]=qs['offset'](_0x3743c8[_0x72b4('0x33')][_0x72b4('0x20')]);}_0x32c0ab[_0x72b4('0x3b')]=qs[_0x72b4('0x3c')](_0x3743c8['query'][_0x72b4('0x3c')]);_0x32c0ab[_0x72b4('0x3d')]=qs[_0x72b4('0x34')](_[_0x72b4('0x3e')](_0x3743c8[_0x72b4('0x33')],_0x20bcb0[_0x72b4('0x34')]),_0x464a4d);if(_0x3743c8[_0x72b4('0x33')][_0x72b4('0x3f')]){_0x32c0ab[_0x72b4('0x3d')]=_['merge'](_0x32c0ab['where'],{'$or':_[_0x72b4('0x2d')](_0x464a4d,function(_0x55a6ab){if(_0x55a6ab['type']!==_0x72b4('0x40')){var _0x5edb79={};_0x5edb79[_0x55a6ab[_0x72b4('0x2b')]]={'$like':'%'+_0x3743c8[_0x72b4('0x33')][_0x72b4('0x3f')]+'%'};return _0x5edb79;}})});}_0x32c0ab=_[_0x72b4('0x41')]({},_0x32c0ab,_0x3743c8[_0x72b4('0x42')]);var _0x5b61e2={'where':_0x32c0ab[_0x72b4('0x3d')]};return db[_0x72b4('0x2e')][_0x72b4('0x1f')](_0x5b61e2)[_0x72b4('0x27')](function(_0xc0e19){_0x3489bc[_0x72b4('0x1f')]=_0xc0e19;if(_0x3743c8[_0x72b4('0x33')][_0x72b4('0x43')]){_0x32c0ab['include']=[{'all':!![]}];}return db[_0x72b4('0x2e')][_0x72b4('0x44')](_0x32c0ab);})['then'](function(_0x466f42){_0x3489bc[_0x72b4('0x45')]=_0x466f42;return _0x3489bc;})[_0x72b4('0x27')](respondWithFilteredResult(_0x5d0d20,_0x32c0ab))[_0x72b4('0x46')](handleError(_0x5d0d20,null));};exports['show']=function(_0x1b8152,_0x982a27){var _0x46d043={'raw':!![],'where':{'id':_0x1b8152[_0x72b4('0x47')]['id']}},_0x1c02ee={};_0x1c02ee['model']=_['keys'](db[_0x72b4('0x2e')][_0x72b4('0x48')]);_0x1c02ee['query']=_[_0x72b4('0x49')](_0x1b8152['query']);_0x1c02ee[_0x72b4('0x34')]=_['intersection'](_0x1c02ee['model'],_0x1c02ee[_0x72b4('0x33')]);_0x46d043[_0x72b4('0x35')]=_['intersection'](_0x1c02ee[_0x72b4('0x32')],qs[_0x72b4('0x37')](_0x1b8152['query'][_0x72b4('0x37')]));_0x46d043[_0x72b4('0x35')]=_0x46d043[_0x72b4('0x35')][_0x72b4('0x38')]?_0x46d043[_0x72b4('0x35')]:_0x1c02ee['model'];if(_0x1b8152['query'][_0x72b4('0x43')]){_0x46d043[_0x72b4('0x4a')]=[{'all':!![]}];}_0x46d043=_[_0x72b4('0x41')]({},_0x46d043,_0x1b8152[_0x72b4('0x42')]);return db[_0x72b4('0x2e')]['find'](_0x46d043)['then'](handleEntityNotFound(_0x982a27,null))[_0x72b4('0x27')](respondWithResult(_0x982a27,null))[_0x72b4('0x46')](handleError(_0x982a27,null));};exports[_0x72b4('0x4b')]=function(_0x28a465,_0x4caeba){return db[_0x72b4('0x2e')][_0x72b4('0x4b')]()[_0x72b4('0x27')](respondWithResult(_0x4caeba,null))[_0x72b4('0x46')](handleError(_0x4caeba,null));};exports['update']=function(_0x12069b,_0x43869d){if(_0x12069b[_0x72b4('0x4c')]['uniqueid']){delete _0x12069b[_0x72b4('0x4c')][_0x72b4('0x4d')];}return db[_0x72b4('0x2e')]['find']({'where':{'uniqueid':_0x12069b['params']['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x43869d,null))[_0x72b4('0x27')](saveUpdates(_0x12069b['body'],null))[_0x72b4('0x27')](respondWithResult(_0x43869d,null))[_0x72b4('0x46')](handleError(_0x43869d,null));};exports[_0x72b4('0x4e')]=function(_0x31f717,_0xd6edfe,_0x515bcf){return db[_0x72b4('0x2e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x31f717[_0x72b4('0x47')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x72b4('0x51')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x53')))),'noAnswerContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')]['literal'](_0x72b4('0x54')))),_0x72b4('0x55')],[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x56')))),_0x72b4('0x57')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x58')))),'abandonedContacts'],[db['sequelize']['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x72b4('0x59')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0x72b4('0x5a')]]})[_0x72b4('0x27')](handleEntityNotFound(_0xd6edfe,null))[_0x72b4('0x27')](respondWithResult(_0xd6edfe,null))[_0x72b4('0x46')](handleError(_0xd6edfe,null));};exports[_0x72b4('0x5b')]=function(_0x291bc3,_0x1a4346,_0x126e09){return db[_0x72b4('0x2e')][_0x72b4('0x44')]({'raw':![],'where':{'CampaignId':_0x291bc3[_0x72b4('0x47')]['id']},'attributes':[[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')]['literal'](_0x72b4('0x5c')))),'noSuchContacts'],[db['sequelize']['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')](_0x72b4('0x53')))),_0x72b4('0x5d')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x54')))),_0x72b4('0x55')],[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x5e')))),_0x72b4('0x5f')],[db[_0x72b4('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x72b4('0x57')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72b4('0x60')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x61')))),'reCallContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x62')))),'answeringMachine']]})[_0x72b4('0x27')](handleEntityNotFound(_0x1a4346,null))[_0x72b4('0x27')](respondWithResult(_0x1a4346,null))['catch'](handleError(_0x1a4346,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xe693d3,_0x3dccba,_0x2dbf1b){return db['VoiceQueue'][_0x72b4('0x63')]({'where':{'id':_0xe693d3[_0x72b4('0x47')]['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x3dccba,null))[_0x72b4('0x27')](function(_0x1dd69a){var _0x4a2fc5;if(_0x1dd69a){_0x4a2fc5=squel[_0x72b4('0x64')]()[_0x72b4('0x65')]('cm_hopper')[_0x72b4('0x66')]([_0x72b4('0x67'),_0x72b4('0x68'),_0x72b4('0x69'),_0x72b4('0x6a'),_0x72b4('0x6b'),_0x72b4('0x6c'),_0x72b4('0x6d')],squel['select']()[_0x72b4('0x6e')](_0x72b4('0x6f'),'phone')[_0x72b4('0x6e')](_0x72b4('0x70'),'scheduledAt')[_0x72b4('0x6e')](_0x72b4('0x71'),_0x72b4('0x69'))[_0x72b4('0x6e')]('ANY_VALUE(ListId)',_0x72b4('0x6a'))[_0x72b4('0x6e')](_0x72b4('0x72'),'VoiceQueueId')['field'](_0x72b4('0x70'),_0x72b4('0x6c'))[_0x72b4('0x6e')](_0x72b4('0x70'),_0x72b4('0x6d'))['from'](_0x72b4('0x73'))[_0x72b4('0x3d')](_0x72b4('0x74'),_0xe693d3[_0x72b4('0x47')]['id']['toString']())[_0x72b4('0x3d')](_0x72b4('0x75'),_0xe693d3[_0x72b4('0x4c')][_0x72b4('0x76')]['toString']())[_0x72b4('0x3d')](_0x72b4('0x77'))['where'](_0x72b4('0x78'),squel[_0x72b4('0x79')]()['field'](_0x72b4('0x67'))[_0x72b4('0x7a')](_0x72b4('0x7b'))[_0x72b4('0x3d')](_0x72b4('0x74'),_0xe693d3[_0x72b4('0x47')]['id']['toString']()))['where'](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x7c'))[_0x72b4('0x7a')](_0x72b4('0x73'))[_0x72b4('0x3d')]('VoiceQueueId\x20=\x20?',_0xe693d3[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x7e')))[_0x72b4('0x7f')]('ContactId'))[_0x72b4('0x7d')]();return db[_0x72b4('0x4f')][_0x72b4('0x33')](_0x4a2fc5);}return[];})[_0x72b4('0x27')](respondWithResult(_0x3dccba,null))[_0x72b4('0x46')](handleError(_0x3dccba,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x402e78,_0x35463d,_0x20462b){return db['Campaign'][_0x72b4('0x63')]({'where':{'id':_0x402e78[_0x72b4('0x47')]['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x35463d,null))[_0x72b4('0x27')](function(_0x2c08b4){var _0x4045d3;if(_0x2c08b4){_0x4045d3=squel[_0x72b4('0x64')]()[_0x72b4('0x65')](_0x72b4('0x7b'))[_0x72b4('0x66')](['phone',_0x72b4('0x68'),_0x72b4('0x69'),_0x72b4('0x6a'),'CampaignId','createdAt',_0x72b4('0x6d')],squel[_0x72b4('0x79')]()['field'](_0x72b4('0x6f'),_0x72b4('0x67'))['field']('NOW()',_0x72b4('0x68'))[_0x72b4('0x6e')](_0x72b4('0x71'),'ContactId')[_0x72b4('0x6e')](_0x72b4('0x80'),_0x72b4('0x6a'))[_0x72b4('0x6e')](_0x72b4('0x81'),_0x72b4('0x82'))[_0x72b4('0x6e')](_0x72b4('0x70'),'createdAt')['field'](_0x72b4('0x70'),_0x72b4('0x6d'))[_0x72b4('0x7a')](_0x72b4('0x73'))['where'](_0x72b4('0x83'),_0x402e78[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x75'),_0x402e78[_0x72b4('0x4c')][_0x72b4('0x76')][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x77'))[_0x72b4('0x3d')](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x67'))[_0x72b4('0x7a')](_0x72b4('0x7b'))[_0x72b4('0x3d')](_0x72b4('0x83'),_0x402e78['params']['id'][_0x72b4('0x7d')]()))[_0x72b4('0x3d')](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x7c'))['from'](_0x72b4('0x73'))['where'](_0x72b4('0x83'),_0x402e78[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x7e')))['group'](_0x72b4('0x69')))['toString']();return db[_0x72b4('0x4f')][_0x72b4('0x33')](_0x4045d3);}return[];})['then'](respondWithResult(_0x35463d,null))[_0x72b4('0x46')](handleError(_0x35463d,null));};exports[_0x72b4('0x84')]=function(_0x487ab6,_0x690a0f,_0x424eb9){return db[_0x72b4('0x85')][_0x72b4('0x86')]({'where':{'VoiceQueueId':_0x487ab6[_0x72b4('0x4c')][_0x72b4('0x6b')],'CampaignId':_0x487ab6[_0x72b4('0x4c')][_0x72b4('0x82')],'ContactId':_0x487ab6['body'][_0x72b4('0x69')]}})[_0x72b4('0x27')](handleEntityNotFound(_0x690a0f,null))[_0x72b4('0x27')](function(_0x4dd867){if(_0x4dd867){return _0x4dd867;}return null;})['then'](respondWithResult(_0x690a0f,null))[_0x72b4('0x46')](handleError(_0x690a0f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bcc8764..0c312a9 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 _0x1c42=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30dbdb,_0x128bcc){var _0x2cf595=function(_0x31ba95){while(--_0x31ba95){_0x30dbdb['push'](_0x30dbdb['shift']());}};_0x2cf595(++_0x128bcc);}(_0x1c42,0x13a));var _0x21c4=function(_0x513629,_0x16dfc3){_0x513629=_0x513629-0x0;var _0x42557f=_0x1c42[_0x513629];return _0x42557f;};'use strict';var _=require('lodash');var util=require(_0x21c4('0x0'));var logger=require(_0x21c4('0x1'))(_0x21c4('0x2'));var moment=require('moment');var BPromise=require(_0x21c4('0x3'));var rp=require(_0x21c4('0x4'));var fs=require('fs');var path=require(_0x21c4('0x5'));var rimraf=require(_0x21c4('0x6'));var config=require(_0x21c4('0x7'));var attributes=require(_0x21c4('0x8'));module[_0x21c4('0x9')]=function(_0x8d4312,_0x4fc4da){return _0x8d4312[_0x21c4('0xa')](_0x21c4('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x21c4('0xc'),'fields':['calleridnum']},{'name':_0x21c4('0xd'),'fields':[_0x21c4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cee=['bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2a8926,_0x4276ef){var _0x5dd011=function(_0x5f5d3e){while(--_0x5f5d3e){_0x2a8926['push'](_0x2a8926['shift']());}};_0x5dd011(++_0x4276ef);}(_0x0cee,0x12f));var _0xe0ce=function(_0x570805,_0x18f64a){_0x570805=_0x570805-0x0;var _0x13d372=_0x0cee[_0x570805];return _0x13d372;};'use strict';var _=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var logger=require(_0xe0ce('0x2'))(_0xe0ce('0x3'));var moment=require(_0xe0ce('0x4'));var BPromise=require(_0xe0ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ce('0x6'));var config=require(_0xe0ce('0x7'));var attributes=require(_0xe0ce('0x8'));module[_0xe0ce('0x9')]=function(_0x1cfee1,_0x1ce646){return _0x1cfee1[_0xe0ce('0xa')](_0xe0ce('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe0ce('0xc'),'fields':[_0xe0ce('0xc')]},{'name':'uniqueid','fields':[_0xe0ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2d7f266..5320b43 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 _0xfd4e=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperFinal','create','body','options','raw','then','CreateCmHopperFinal','catch','lodash','moment'];(function(_0x219750,_0x45cef3){var _0x3d77da=function(_0x2eb961){while(--_0x2eb961){_0x219750['push'](_0x219750['shift']());}};_0x3d77da(++_0x45cef3);}(_0xfd4e,0x1c0));var _0xefd4=function(_0x96b297,_0x43c5a8){_0x96b297=_0x96b297-0x0;var _0x17a487=_0xfd4e[_0x96b297];return _0x17a487;};'use strict';var _=require(_0xefd4('0x0'));var util=require('util');var moment=require(_0xefd4('0x1'));var BPromise=require(_0xefd4('0x2'));var rs=require(_0xefd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xefd4('0x4'));var logger=require(_0xefd4('0x5'))(_0xefd4('0x6'));var config=require(_0xefd4('0x7'));var jayson=require(_0xefd4('0x8'));var client=jayson[_0xefd4('0x9')][_0xefd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19587c,_0x3cb922,_0x5c97d6){return new BPromise(function(_0x2bf272,_0x49568e){return client[_0xefd4('0xb')](_0x19587c,_0x5c97d6)['then'](function(_0x3ad092){logger[_0xefd4('0xc')](_0xefd4('0xd'),_0x3cb922,_0xefd4('0xe'));logger[_0xefd4('0xf')](_0xefd4('0x10'),_0x3cb922,_0xefd4('0xe'),JSON[_0xefd4('0x11')](_0x3ad092));if(_0x3ad092[_0xefd4('0x12')]){if(_0x3ad092[_0xefd4('0x12')][_0xefd4('0x13')]===0x1f4){logger[_0xefd4('0x12')](_0xefd4('0xd'),_0x3cb922,_0x3ad092[_0xefd4('0x12')]['message']);return _0x49568e(_0x3ad092[_0xefd4('0x12')][_0xefd4('0x14')]);}logger[_0xefd4('0x12')](_0xefd4('0xd'),_0x3cb922,_0x3ad092[_0xefd4('0x12')][_0xefd4('0x14')]);return _0x2bf272(_0x3ad092[_0xefd4('0x12')][_0xefd4('0x14')]);}else{logger[_0xefd4('0xc')](_0xefd4('0xd'),_0x3cb922,'request\x20sent');_0x2bf272(_0x3ad092[_0xefd4('0x15')][_0xefd4('0x14')]);}})['catch'](function(_0x15123a){logger[_0xefd4('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x3cb922,_0x15123a);_0x49568e(_0x15123a);});});}exports['CreateCmHopperFinal']=function(_0x3c193f){var _0x475733=this;return new Promise(function(_0x319d42,_0x4c0146){return db[_0xefd4('0x16')][_0xefd4('0x17')](_0x3c193f[_0xefd4('0x18')],{'raw':_0x3c193f[_0xefd4('0x19')]?_0x3c193f[_0xefd4('0x19')][_0xefd4('0x1a')]===undefined?!![]:![]:!![]})[_0xefd4('0x1b')](function(_0x3273f4){logger[_0xefd4('0xc')](_0xefd4('0x1c'),_0x3c193f);logger[_0xefd4('0xf')](_0xefd4('0x1c'),_0x3c193f,JSON['stringify'](_0x3273f4));_0x319d42(_0x3273f4);})[_0xefd4('0x1d')](function(_0x5ee75c){logger['error'](_0xefd4('0x1c'),_0x5ee75c[_0xefd4('0x14')],_0x3c193f);_0x4c0146(_0x475733[_0xefd4('0x12')](0x1f4,_0x5ee75c['message']));});});}; \ No newline at end of file +var _0x8393=['CreateCmHopperFinal','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw'];(function(_0x47df83,_0x1042b3){var _0x4e9815=function(_0x4f3d7d){while(--_0x4f3d7d){_0x47df83['push'](_0x47df83['shift']());}};_0x4e9815(++_0x1042b3);}(_0x8393,0x1e1));var _0x3839=function(_0x1d447c,_0x3e00f2){_0x1d447c=_0x1d447c-0x0;var _0x38dda6=_0x8393[_0x1d447c];return _0x38dda6;};'use strict';var _=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var moment=require(_0x3839('0x2'));var BPromise=require(_0x3839('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3839('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3839('0x5'));var logger=require(_0x3839('0x6'))(_0x3839('0x7'));var config=require(_0x3839('0x8'));var jayson=require(_0x3839('0x9'));var client=jayson[_0x3839('0xa')][_0x3839('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xee7dbc,_0x5444d8,_0x7f097c){return new BPromise(function(_0x36caa8,_0x1ec6b3){return client[_0x3839('0xc')](_0xee7dbc,_0x7f097c)[_0x3839('0xd')](function(_0x578bed){logger[_0x3839('0xe')](_0x3839('0xf'),_0x5444d8,'request\x20sent');logger[_0x3839('0x10')](_0x3839('0x11'),_0x5444d8,_0x3839('0x12'),JSON[_0x3839('0x13')](_0x578bed));if(_0x578bed[_0x3839('0x14')]){if(_0x578bed[_0x3839('0x14')][_0x3839('0x15')]===0x1f4){logger[_0x3839('0x14')](_0x3839('0xf'),_0x5444d8,_0x578bed['error'][_0x3839('0x16')]);return _0x1ec6b3(_0x578bed['error']['message']);}logger[_0x3839('0x14')](_0x3839('0xf'),_0x5444d8,_0x578bed['error'][_0x3839('0x16')]);return _0x36caa8(_0x578bed[_0x3839('0x14')][_0x3839('0x16')]);}else{logger[_0x3839('0xe')](_0x3839('0xf'),_0x5444d8,_0x3839('0x12'));_0x36caa8(_0x578bed[_0x3839('0x17')][_0x3839('0x16')]);}})[_0x3839('0x18')](function(_0x17cebc){logger[_0x3839('0x14')]('CmHopperFinal,\x20%s,\x20%s',_0x5444d8,_0x17cebc);_0x1ec6b3(_0x17cebc);});});}exports['CreateCmHopperFinal']=function(_0x1def28){var _0x3fc57e=this;return new Promise(function(_0x51aa5b,_0x43ad04){return db['CmHopperFinal'][_0x3839('0x19')](_0x1def28[_0x3839('0x1a')],{'raw':_0x1def28['options']?_0x1def28[_0x3839('0x1b')][_0x3839('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1e91b6){logger[_0x3839('0xe')](_0x3839('0x1d'),_0x1def28);logger[_0x3839('0x10')](_0x3839('0x1d'),_0x1def28,JSON[_0x3839('0x13')](_0x1e91b6));_0x51aa5b(_0x1e91b6);})['catch'](function(_0x447e68){logger[_0x3839('0x14')](_0x3839('0x1d'),_0x447e68[_0x3839('0x16')],_0x1def28);_0x43ad04(_0x3fc57e['error'](0x1f4,_0x447e68[_0x3839('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ef3b43f..0d34e07 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 _0xaa7e=['checkContactHopper','put','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x112166,_0x318237){var _0x594ade=function(_0x73c2fa){while(--_0x73c2fa){_0x112166['push'](_0x112166['shift']());}};_0x594ade(++_0x318237);}(_0xaa7e,0x16b));var _0xeaa7=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0xaa7e[_0x29771f];return _0x279baf;};'use strict';var multer=require(_0xeaa7('0x0'));var util=require('util');var path=require(_0xeaa7('0x1'));var timeout=require('connect-timeout');var express=require(_0xeaa7('0x2'));var router=express['Router']();var auth=require(_0xeaa7('0x3'));var interaction=require(_0xeaa7('0x4'));var config=require(_0xeaa7('0x5'));var controller=require(_0xeaa7('0x6'));router[_0xeaa7('0x7')]('/',auth[_0xeaa7('0x8')](),controller[_0xeaa7('0x9')]);router['get'](_0xeaa7('0xa'),auth['isAuthenticated'](),controller[_0xeaa7('0xb')]);router[_0xeaa7('0x7')](_0xeaa7('0xc'),auth[_0xeaa7('0x8')](),controller[_0xeaa7('0xd')]);router[_0xeaa7('0x7')](_0xeaa7('0xe'),auth[_0xeaa7('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xeaa7('0x7')](_0xeaa7('0xf'),auth[_0xeaa7('0x8')](),controller[_0xeaa7('0x10')]);router[_0xeaa7('0x11')](_0xeaa7('0x12'),auth[_0xeaa7('0x8')](),controller[_0xeaa7('0x13')]);router[_0xeaa7('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xeaa7('0x8')](),controller[_0xeaa7('0x14')]);router[_0xeaa7('0x11')]('/checkContactHopper',auth[_0xeaa7('0x8')](),controller[_0xeaa7('0x15')]);router[_0xeaa7('0x16')](_0xeaa7('0xc'),auth[_0xeaa7('0x8')](),controller['update']);module[_0xeaa7('0x17')]=router; \ No newline at end of file +var _0xb393=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','update','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0xb393,0x161));var _0x3b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb393[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3b39('0x0'));var util=require(_0x3b39('0x1'));var path=require(_0x3b39('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b39('0x3'));var router=express[_0x3b39('0x4')]();var auth=require(_0x3b39('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3b39('0x6'));var controller=require(_0x3b39('0x7'));router[_0x3b39('0x8')]('/',auth[_0x3b39('0x9')](),controller['index']);router[_0x3b39('0x8')](_0x3b39('0xa'),auth['isAuthenticated'](),controller[_0x3b39('0xb')]);router[_0x3b39('0x8')]('/:id',auth[_0x3b39('0x9')](),controller['show']);router[_0x3b39('0x8')]('/voice/queue/countAttributes/:id',auth[_0x3b39('0x9')](),controller[_0x3b39('0xc')]);router['get'](_0x3b39('0xd'),auth[_0x3b39('0x9')](),controller[_0x3b39('0xe')]);router[_0x3b39('0xf')](_0x3b39('0x10'),auth[_0x3b39('0x9')](),controller[_0x3b39('0x11')]);router[_0x3b39('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x3b39('0x9')](),controller[_0x3b39('0x12')]);router[_0x3b39('0xf')](_0x3b39('0x13'),auth[_0x3b39('0x9')](),controller[_0x3b39('0x14')]);router['put'](_0x3b39('0x15'),auth[_0x3b39('0x9')](),controller[_0x3b39('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c13362b..a32f6a1 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 _0x7d15=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x127fb1,_0x5c2bd0){var _0x4a8561=function(_0x1e53a2){while(--_0x1e53a2){_0x127fb1['push'](_0x127fb1['shift']());}};_0x4a8561(++_0x5c2bd0);}(_0x7d15,0x168));var _0x57d1=function(_0x37e393,_0x3e91c0){_0x37e393=_0x37e393-0x0;var _0x9a529d=_0x7d15[_0x37e393];return _0x9a529d;};'use strict';var Sequelize=require(_0x57d1('0x0'));module[_0x57d1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x57d1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x57d1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x57d1('0x3')]},'calleridnum':{'type':Sequelize[_0x57d1('0x3')]},'calleridname':{'type':Sequelize[_0x57d1('0x3')]},'starttime':{'type':Sequelize[_0x57d1('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x57d1('0x4')]},'droptime':{'type':Sequelize[_0x57d1('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x57d1('0x3')]},'campaigntype':{'type':Sequelize[_0x57d1('0x3')]},'membername':{'type':Sequelize[_0x57d1('0x3')]},'reason':{'type':Sequelize[_0x57d1('0x3')]},'amd':{'type':Sequelize[_0x57d1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x57d1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x57d1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x57d1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x57d1('0x4')]},'recallme':{'type':Sequelize[_0x57d1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x57d1('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x57d1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4dbe=['DATE','BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4dbe,0x147));var _0xe4db=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4dbe[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xe4db('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe4db('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe4db('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xe4db('0x1')]},'originatecalleridname':{'type':Sequelize[_0xe4db('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe4db('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe4db('0x3')]},'answertime':{'type':Sequelize[_0xe4db('0x3')]},'droptime':{'type':Sequelize[_0xe4db('0x3')]},'endtime':{'type':Sequelize[_0xe4db('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe4db('0x1')]},'campaign':{'type':Sequelize[_0xe4db('0x1')]},'campaigntype':{'type':Sequelize[_0xe4db('0x1')]},'membername':{'type':Sequelize[_0xe4db('0x1')]},'reason':{'type':Sequelize[_0xe4db('0x1')]},'amd':{'type':Sequelize[_0xe4db('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xe4db('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe4db('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe4db('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe4db('0x3')]},'edited':{'type':Sequelize[_0xe4db('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe4db('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a7ab667..34c6346 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 _0x9f24=['length','include','merge','find','create','body','describe','uniqueid','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','rows','catch','show','params'];(function(_0x3a4e0,_0x577c4d){var _0x16ccbf=function(_0x361d8d){while(--_0x361d8d){_0x3a4e0['push'](_0x3a4e0['shift']());}};_0x16ccbf(++_0x577c4d);}(_0x9f24,0x9e));var _0x49f2=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x9f24[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0x49f2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49f2('0x1'));var jsonpatch=require(_0x49f2('0x2'));var rp=require(_0x49f2('0x3'));var moment=require(_0x49f2('0x4'));var BPromise=require(_0x49f2('0x5'));var Mustache=require('mustache');var util=require(_0x49f2('0x6'));var path=require(_0x49f2('0x7'));var sox=require(_0x49f2('0x8'));var csv=require(_0x49f2('0x9'));var ejs=require(_0x49f2('0xa'));var fs=require('fs');var _=require(_0x49f2('0xb'));var squel=require(_0x49f2('0xc'));var crypto=require(_0x49f2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x49f2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49f2('0xe'));var authService=require(_0x49f2('0xf'));var qs=require(_0x49f2('0x10'));var as=require(_0x49f2('0x11'));var hardwareService=require(_0x49f2('0x12'));var logger=require(_0x49f2('0x13'))(_0x49f2('0x14'));var utils=require(_0x49f2('0x15'));var config=require('../../config/environment');var db=require(_0x49f2('0x16'))['db'];function respondWithStatusCode(_0x250a00,_0x129468){_0x129468=_0x129468||0xcc;return function(_0x2a06dd){if(_0x2a06dd){return _0x250a00['sendStatus'](_0x129468);}return _0x250a00[_0x49f2('0x17')](_0x129468)[_0x49f2('0x18')]();};}function respondWithResult(_0x9056c1,_0x5bca5e){_0x5bca5e=_0x5bca5e||0xc8;return function(_0x623507){if(_0x623507){return _0x9056c1[_0x49f2('0x17')](_0x5bca5e)[_0x49f2('0x19')](_0x623507);}};}function respondWithFilteredResult(_0x2a16f5,_0x4e7cdf){return function(_0x54cbcc){if(_0x54cbcc){var _0x1339d7=_0x54cbcc[_0x49f2('0x1a')],_0xde9d6e=_0x4e7cdf[_0x49f2('0x1b')],_0x412097=_0x4e7cdf[_0x49f2('0x1b')]+_0x4e7cdf[_0x49f2('0x1c')],_0x112320;if(_0x412097>=_0x1339d7){_0x412097=_0x1339d7;_0x112320=0xc8;}else{_0x112320=0xce;}_0x2a16f5[_0x49f2('0x17')](_0x112320);return _0x2a16f5[_0x49f2('0x1d')](_0x49f2('0x1e'),_0xde9d6e+'-'+_0x412097+'/'+_0x1339d7)[_0x49f2('0x19')](_0x54cbcc);}return null;};}function patchUpdates(_0x191ddd){return function(_0x456012){try{jsonpatch[_0x49f2('0x1f')](_0x456012,_0x191ddd,!![]);}catch(_0x43b13b){return BPromise[_0x49f2('0x20')](_0x43b13b);}return _0x456012[_0x49f2('0x21')]();};}function saveUpdates(_0x4f476f,_0x238c5e){return function(_0x6cce8d){if(_0x6cce8d){return _0x6cce8d[_0x49f2('0x22')](_0x4f476f)[_0x49f2('0x23')](function(_0x533d52){return _0x533d52;});}return null;};}function removeEntity(_0x1d5bf6,_0x525ff0){return function(_0x3be462){if(_0x3be462){return _0x3be462[_0x49f2('0x24')]()[_0x49f2('0x23')](function(){_0x1d5bf6['status'](0xcc)[_0x49f2('0x18')]();});}};}function handleEntityNotFound(_0x32de80,_0x27b945){return function(_0x1f61a8){if(!_0x1f61a8){_0x32de80[_0x49f2('0x25')](0x194);}return _0x1f61a8;};}function handleError(_0x17bb30,_0x5d0b8a){_0x5d0b8a=_0x5d0b8a||0x1f4;return function(_0x53248c){logger[_0x49f2('0x26')](_0x53248c[_0x49f2('0x27')]);if(_0x53248c[_0x49f2('0x28')]){delete _0x53248c['name'];}_0x17bb30['status'](_0x5d0b8a)[_0x49f2('0x29')](_0x53248c);};}exports['index']=function(_0x498cc7,_0x573745){var _0x2a8039={},_0x2f4907={},_0xab4834={'count':0x0,'rows':[]};var _0xe06370=_[_0x49f2('0x2a')](db[_0x49f2('0x2b')][_0x49f2('0x2c')],function(_0x3583f9){return{'name':_0x3583f9[_0x49f2('0x2d')],'type':_0x3583f9[_0x49f2('0x2e')][_0x49f2('0x2f')]};});_0x2f4907[_0x49f2('0x30')]=_[_0x49f2('0x2a')](_0xe06370,_0x49f2('0x28'));_0x2f4907[_0x49f2('0x31')]=_[_0x49f2('0x32')](_0x498cc7[_0x49f2('0x31')]);_0x2f4907[_0x49f2('0x33')]=_[_0x49f2('0x34')](_0x2f4907[_0x49f2('0x30')],_0x2f4907[_0x49f2('0x31')]);_0x2a8039[_0x49f2('0x35')]=_[_0x49f2('0x34')](_0x2f4907['model'],qs[_0x49f2('0x36')](_0x498cc7[_0x49f2('0x31')][_0x49f2('0x36')]));_0x2a8039[_0x49f2('0x35')]=_0x2a8039[_0x49f2('0x35')]['length']?_0x2a8039[_0x49f2('0x35')]:_0x2f4907[_0x49f2('0x30')];if(!_0x498cc7[_0x49f2('0x31')]['hasOwnProperty'](_0x49f2('0x37'))){_0x2a8039[_0x49f2('0x1c')]=qs[_0x49f2('0x1c')](_0x498cc7['query'][_0x49f2('0x1c')]);_0x2a8039[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x498cc7[_0x49f2('0x31')][_0x49f2('0x1b')]);}_0x2a8039[_0x49f2('0x38')]=qs[_0x49f2('0x39')](_0x498cc7[_0x49f2('0x31')][_0x49f2('0x39')]);_0x2a8039[_0x49f2('0x3a')]=qs['filters'](_[_0x49f2('0x3b')](_0x498cc7[_0x49f2('0x31')],_0x2f4907[_0x49f2('0x33')]),_0xe06370);if(_0x498cc7[_0x49f2('0x31')][_0x49f2('0x3c')]){_0x2a8039['where']=_['merge'](_0x2a8039['where'],{'$or':_[_0x49f2('0x2a')](_0xe06370,function(_0x27ba05){if(_0x27ba05['type']!==_0x49f2('0x3d')){var _0x49d801={};_0x49d801[_0x27ba05[_0x49f2('0x28')]]={'$like':'%'+_0x498cc7['query']['filter']+'%'};return _0x49d801;}})});}_0x2a8039=_['merge']({},_0x2a8039,_0x498cc7[_0x49f2('0x3e')]);var _0x9c1d8a={'where':_0x2a8039[_0x49f2('0x3a')]};return db['CmHopperHistory'][_0x49f2('0x1a')](_0x9c1d8a)[_0x49f2('0x23')](function(_0x3fa481){_0xab4834[_0x49f2('0x1a')]=_0x3fa481;if(_0x498cc7[_0x49f2('0x31')]['includeAll']){_0x2a8039['include']=[{'all':!![]}];}return db[_0x49f2('0x2b')]['findAll'](_0x2a8039);})[_0x49f2('0x23')](function(_0x266880){_0xab4834[_0x49f2('0x3f')]=_0x266880;return _0xab4834;})['then'](respondWithFilteredResult(_0x573745,_0x2a8039))[_0x49f2('0x40')](handleError(_0x573745,null));};exports[_0x49f2('0x41')]=function(_0x2859cd,_0x244e90){var _0x447a90={'raw':!![],'where':{'id':_0x2859cd[_0x49f2('0x42')]['id']}},_0x174d12={};_0x174d12[_0x49f2('0x30')]=_[_0x49f2('0x32')](db[_0x49f2('0x2b')][_0x49f2('0x2c')]);_0x174d12[_0x49f2('0x31')]=_[_0x49f2('0x32')](_0x2859cd[_0x49f2('0x31')]);_0x174d12[_0x49f2('0x33')]=_[_0x49f2('0x34')](_0x174d12['model'],_0x174d12[_0x49f2('0x31')]);_0x447a90[_0x49f2('0x35')]=_[_0x49f2('0x34')](_0x174d12[_0x49f2('0x30')],qs[_0x49f2('0x36')](_0x2859cd[_0x49f2('0x31')]['fields']));_0x447a90[_0x49f2('0x35')]=_0x447a90[_0x49f2('0x35')][_0x49f2('0x43')]?_0x447a90[_0x49f2('0x35')]:_0x174d12['model'];if(_0x2859cd[_0x49f2('0x31')]['includeAll']){_0x447a90[_0x49f2('0x44')]=[{'all':!![]}];}_0x447a90=_[_0x49f2('0x45')]({},_0x447a90,_0x2859cd[_0x49f2('0x3e')]);return db[_0x49f2('0x2b')][_0x49f2('0x46')](_0x447a90)[_0x49f2('0x23')](handleEntityNotFound(_0x244e90,null))[_0x49f2('0x23')](respondWithResult(_0x244e90,null))['catch'](handleError(_0x244e90,null));};exports[_0x49f2('0x47')]=function(_0x5e61bc,_0x25414e){return db['CmHopperHistory'][_0x49f2('0x47')](_0x5e61bc[_0x49f2('0x48')],{})[_0x49f2('0x23')](respondWithResult(_0x25414e,0xc9))[_0x49f2('0x40')](handleError(_0x25414e,null));};exports[_0x49f2('0x49')]=function(_0x5df462,_0x1c2817){return db[_0x49f2('0x2b')][_0x49f2('0x49')]()[_0x49f2('0x23')](respondWithResult(_0x1c2817,null))['catch'](handleError(_0x1c2817,null));};exports['update']=function(_0x154e1c,_0x1a0101){if(_0x154e1c['body'][_0x49f2('0x4a')]){delete _0x154e1c[_0x49f2('0x48')][_0x49f2('0x4a')];}return db[_0x49f2('0x2b')]['find']({'where':{'uniqueid':_0x154e1c[_0x49f2('0x42')]['id']}})[_0x49f2('0x23')](handleEntityNotFound(_0x1a0101,null))[_0x49f2('0x23')](saveUpdates(_0x154e1c['body'],null))['then'](respondWithResult(_0x1a0101,null))[_0x49f2('0x40')](handleError(_0x1a0101,null));}; \ No newline at end of file +var _0x8047=['query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','CmHopperHistory','findAll','rows','catch','show','keys','rawAttributes','find','create','describe','body','uniqueid','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','fieldName','type','key','model'];(function(_0xc7a71b,_0x35a41a){var _0x534afb=function(_0x5b8e6e){while(--_0x5b8e6e){_0xc7a71b['push'](_0xc7a71b['shift']());}};_0x534afb(++_0x35a41a);}(_0x8047,0x1d4));var _0x7804=function(_0x56e351,_0xd36aca){_0x56e351=_0x56e351-0x0;var _0x18fd2c=_0x8047[_0x56e351];return _0x18fd2c;};'use strict';var pdf=require(_0x7804('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7804('0x1'));var zipdir=require(_0x7804('0x2'));var jsonpatch=require(_0x7804('0x3'));var rp=require('request-promise');var moment=require(_0x7804('0x4'));var BPromise=require(_0x7804('0x5'));var Mustache=require(_0x7804('0x6'));var util=require(_0x7804('0x7'));var path=require(_0x7804('0x8'));var sox=require(_0x7804('0x9'));var csv=require('to-csv');var ejs=require(_0x7804('0xa'));var fs=require('fs');var _=require(_0x7804('0xb'));var squel=require(_0x7804('0xc'));var crypto=require('crypto');var jsforce=require(_0x7804('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7804('0xe'));var querystring=require('querystring');var Papa=require(_0x7804('0xf'));var Redis=require(_0x7804('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7804('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7804('0x12'));var logger=require(_0x7804('0x13'))(_0x7804('0x14'));var utils=require('../../config/utils');var config=require(_0x7804('0x15'));var db=require(_0x7804('0x16'))['db'];function respondWithStatusCode(_0x1b222f,_0x2813c6){_0x2813c6=_0x2813c6||0xcc;return function(_0x1a8e79){if(_0x1a8e79){return _0x1b222f[_0x7804('0x17')](_0x2813c6);}return _0x1b222f['status'](_0x2813c6)['end']();};}function respondWithResult(_0x4bfe1a,_0xbba6a1){_0xbba6a1=_0xbba6a1||0xc8;return function(_0x1c8533){if(_0x1c8533){return _0x4bfe1a['status'](_0xbba6a1)[_0x7804('0x18')](_0x1c8533);}};}function respondWithFilteredResult(_0x17f21f,_0x530863){return function(_0x15d811){if(_0x15d811){var _0x33d16c=_0x15d811['count'],_0x2638ea=_0x530863[_0x7804('0x19')],_0xd8b13d=_0x530863[_0x7804('0x19')]+_0x530863['limit'],_0x35ee81;if(_0xd8b13d>=_0x33d16c){_0xd8b13d=_0x33d16c;_0x35ee81=0xc8;}else{_0x35ee81=0xce;}_0x17f21f[_0x7804('0x1a')](_0x35ee81);return _0x17f21f[_0x7804('0x1b')](_0x7804('0x1c'),_0x2638ea+'-'+_0xd8b13d+'/'+_0x33d16c)['json'](_0x15d811);}return null;};}function patchUpdates(_0x3578bd){return function(_0x5f31ef){try{jsonpatch[_0x7804('0x1d')](_0x5f31ef,_0x3578bd,!![]);}catch(_0x3a05b4){return BPromise[_0x7804('0x1e')](_0x3a05b4);}return _0x5f31ef[_0x7804('0x1f')]();};}function saveUpdates(_0x2f3818,_0x2797e0){return function(_0x426986){if(_0x426986){return _0x426986['update'](_0x2f3818)[_0x7804('0x20')](function(_0x569aaa){return _0x569aaa;});}return null;};}function removeEntity(_0x207b8a,_0x5d2f2e){return function(_0x42a2ba){if(_0x42a2ba){return _0x42a2ba[_0x7804('0x21')]()[_0x7804('0x20')](function(){_0x207b8a[_0x7804('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf5f2,_0x29bdca){return function(_0x3f9bba){if(!_0x3f9bba){_0x4cf5f2['sendStatus'](0x194);}return _0x3f9bba;};}function handleError(_0x59052f,_0x32624e){_0x32624e=_0x32624e||0x1f4;return function(_0xef5313){logger[_0x7804('0x22')](_0xef5313['stack']);if(_0xef5313[_0x7804('0x23')]){delete _0xef5313[_0x7804('0x23')];}_0x59052f[_0x7804('0x1a')](_0x32624e)[_0x7804('0x24')](_0xef5313);};}exports[_0x7804('0x25')]=function(_0x4777b8,_0xf32204){var _0x47908c={},_0x51d58d={},_0x495bec={'count':0x0,'rows':[]};var _0xf7c20=_[_0x7804('0x26')](db['CmHopperHistory']['rawAttributes'],function(_0x139ff){return{'name':_0x139ff[_0x7804('0x27')],'type':_0x139ff[_0x7804('0x28')][_0x7804('0x29')]};});_0x51d58d[_0x7804('0x2a')]=_['map'](_0xf7c20,_0x7804('0x23'));_0x51d58d[_0x7804('0x2b')]=_['keys'](_0x4777b8[_0x7804('0x2b')]);_0x51d58d[_0x7804('0x2c')]=_[_0x7804('0x2d')](_0x51d58d[_0x7804('0x2a')],_0x51d58d['query']);_0x47908c[_0x7804('0x2e')]=_['intersection'](_0x51d58d[_0x7804('0x2a')],qs['fields'](_0x4777b8[_0x7804('0x2b')][_0x7804('0x2f')]));_0x47908c[_0x7804('0x2e')]=_0x47908c['attributes']['length']?_0x47908c[_0x7804('0x2e')]:_0x51d58d['model'];if(!_0x4777b8[_0x7804('0x2b')][_0x7804('0x30')]('nolimit')){_0x47908c[_0x7804('0x31')]=qs[_0x7804('0x31')](_0x4777b8[_0x7804('0x2b')][_0x7804('0x31')]);_0x47908c[_0x7804('0x19')]=qs['offset'](_0x4777b8[_0x7804('0x2b')][_0x7804('0x19')]);}_0x47908c[_0x7804('0x32')]=qs[_0x7804('0x33')](_0x4777b8[_0x7804('0x2b')][_0x7804('0x33')]);_0x47908c[_0x7804('0x34')]=qs[_0x7804('0x2c')](_['pick'](_0x4777b8['query'],_0x51d58d[_0x7804('0x2c')]),_0xf7c20);if(_0x4777b8[_0x7804('0x2b')][_0x7804('0x35')]){_0x47908c[_0x7804('0x34')]=_[_0x7804('0x36')](_0x47908c[_0x7804('0x34')],{'$or':_['map'](_0xf7c20,function(_0x31a7cd){if(_0x31a7cd[_0x7804('0x28')]!==_0x7804('0x37')){var _0x140f95={};_0x140f95[_0x31a7cd[_0x7804('0x23')]]={'$like':'%'+_0x4777b8['query'][_0x7804('0x35')]+'%'};return _0x140f95;}})});}_0x47908c=_['merge']({},_0x47908c,_0x4777b8[_0x7804('0x38')]);var _0x31e1fb={'where':_0x47908c[_0x7804('0x34')]};return db['CmHopperHistory'][_0x7804('0x39')](_0x31e1fb)[_0x7804('0x20')](function(_0x2e0711){_0x495bec['count']=_0x2e0711;if(_0x4777b8['query'][_0x7804('0x3a')]){_0x47908c[_0x7804('0x3b')]=[{'all':!![]}];}return db[_0x7804('0x3c')][_0x7804('0x3d')](_0x47908c);})[_0x7804('0x20')](function(_0x193347){_0x495bec[_0x7804('0x3e')]=_0x193347;return _0x495bec;})[_0x7804('0x20')](respondWithFilteredResult(_0xf32204,_0x47908c))[_0x7804('0x3f')](handleError(_0xf32204,null));};exports[_0x7804('0x40')]=function(_0x4baa56,_0xd0f8e9){var _0xbbd436={'raw':!![],'where':{'id':_0x4baa56['params']['id']}},_0x2237e9={};_0x2237e9[_0x7804('0x2a')]=_[_0x7804('0x41')](db[_0x7804('0x3c')][_0x7804('0x42')]);_0x2237e9[_0x7804('0x2b')]=_[_0x7804('0x41')](_0x4baa56['query']);_0x2237e9[_0x7804('0x2c')]=_[_0x7804('0x2d')](_0x2237e9[_0x7804('0x2a')],_0x2237e9[_0x7804('0x2b')]);_0xbbd436[_0x7804('0x2e')]=_[_0x7804('0x2d')](_0x2237e9['model'],qs[_0x7804('0x2f')](_0x4baa56['query'][_0x7804('0x2f')]));_0xbbd436[_0x7804('0x2e')]=_0xbbd436[_0x7804('0x2e')]['length']?_0xbbd436[_0x7804('0x2e')]:_0x2237e9[_0x7804('0x2a')];if(_0x4baa56[_0x7804('0x2b')]['includeAll']){_0xbbd436[_0x7804('0x3b')]=[{'all':!![]}];}_0xbbd436=_['merge']({},_0xbbd436,_0x4baa56[_0x7804('0x38')]);return db[_0x7804('0x3c')][_0x7804('0x43')](_0xbbd436)[_0x7804('0x20')](handleEntityNotFound(_0xd0f8e9,null))[_0x7804('0x20')](respondWithResult(_0xd0f8e9,null))['catch'](handleError(_0xd0f8e9,null));};exports[_0x7804('0x44')]=function(_0x340ebd,_0x50c28b){return db[_0x7804('0x3c')]['create'](_0x340ebd['body'],{})[_0x7804('0x20')](respondWithResult(_0x50c28b,0xc9))[_0x7804('0x3f')](handleError(_0x50c28b,null));};exports['describe']=function(_0x305923,_0x28f303){return db['CmHopperHistory'][_0x7804('0x45')]()[_0x7804('0x20')](respondWithResult(_0x28f303,null))[_0x7804('0x3f')](handleError(_0x28f303,null));};exports['update']=function(_0x155997,_0x4e4895){if(_0x155997[_0x7804('0x46')][_0x7804('0x47')]){delete _0x155997[_0x7804('0x46')][_0x7804('0x47')];}return db[_0x7804('0x3c')][_0x7804('0x43')]({'where':{'uniqueid':_0x155997[_0x7804('0x48')]['id']}})[_0x7804('0x20')](handleEntityNotFound(_0x4e4895,null))[_0x7804('0x20')](saveUpdates(_0x155997[_0x7804('0x46')],null))['then'](respondWithResult(_0x4e4895,null))[_0x7804('0x3f')](handleError(_0x4e4895,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 74f7b3c..cecc50f 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 _0x0767=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0767,0x1bf));var _0x7076=function(_0xe32ace,_0x2068df){_0xe32ace=_0xe32ace-0x0;var _0x166029=_0x0767[_0xe32ace];return _0x166029;};'use strict';var _=require(_0x7076('0x0'));var util=require(_0x7076('0x1'));var logger=require(_0x7076('0x2'))(_0x7076('0x3'));var moment=require(_0x7076('0x4'));var BPromise=require(_0x7076('0x5'));var rp=require(_0x7076('0x6'));var fs=require('fs');var path=require(_0x7076('0x7'));var rimraf=require(_0x7076('0x8'));var config=require(_0x7076('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x7076('0xa')]=function(_0x29c018,_0x32d055){return _0x29c018[_0x7076('0xb')]('CmHopperHistory',attributes,{'tableName':_0x7076('0xc'),'paranoid':![],'indexes':[{'name':_0x7076('0xd'),'fields':[_0x7076('0xd')]},{'name':_0x7076('0xe'),'fields':[_0x7076('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5cf=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x98f2ba,_0x1f681d){var _0x2c9d5c=function(_0x5f0999){while(--_0x5f0999){_0x98f2ba['push'](_0x98f2ba['shift']());}};_0x2c9d5c(++_0x1f681d);}(_0xe5cf,0x1b3));var _0xfe5c=function(_0x4c3891,_0x3cf5fc){_0x4c3891=_0x4c3891-0x0;var _0x34ae0e=_0xe5cf[_0x4c3891];return _0x34ae0e;};'use strict';var _=require(_0xfe5c('0x0'));var util=require('util');var logger=require(_0xfe5c('0x1'))(_0xfe5c('0x2'));var moment=require('moment');var BPromise=require(_0xfe5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5c('0x4'));var config=require(_0xfe5c('0x5'));var attributes=require(_0xfe5c('0x6'));module[_0xfe5c('0x7')]=function(_0xeb9e82,_0x112ad0){return _0xeb9e82[_0xfe5c('0x8')](_0xfe5c('0x9'),attributes,{'tableName':_0xfe5c('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xfe5c('0xb')]},{'name':_0xfe5c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 607c2be..a0a8420 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 _0x96cc=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x96cc,0x16c));var _0xc96c=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0x96cc[_0x25f39c];return _0x19bb4a;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')](_0x99c402[_0xc96c('0x1a')],{'raw':_0x99c402[_0xc96c('0x1b')]?_0x99c402[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![]})[_0xc96c('0xc')](function(_0x41daba){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x1d')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x41daba));_0x2ae19a(_0x41daba);})[_0xc96c('0x16')](function(_0x325c54){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0x325c54['message'],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0x325c54[_0xc96c('0x14')]));});});};exports[_0xc96c('0x1e')]=function(_0x10ae21){var _0x2b1df9=this;return new Promise(function(_0x35f480,_0x40f23d){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x23')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x27')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x29')))),_0xc96c('0x2a')],[db[_0xc96c('0x21')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x2c'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x2d')))),_0xc96c('0x2e')]]})['then'](function(_0x2b1dec){logger[_0xc96c('0xd')](_0xc96c('0x1e'),_0x10ae21);logger[_0xc96c('0x1d')](_0xc96c('0x1e'),_0x10ae21,JSON[_0xc96c('0x11')](_0x2b1dec));_0x35f480(_0x2b1dec);})['catch'](function(_0x35dfb7){logger[_0xc96c('0x12')](_0xc96c('0x1e'),_0x35dfb7[_0xc96c('0x14')],_0x10ae21);_0x40f23d(_0x2b1df9[_0xc96c('0x12')](0x1f4,_0x35dfb7[_0xc96c('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x56b5c9){var _0x33b4bb=this;return new Promise(function(_0x156d0f,_0x5006ec){return db['CmHopperHistory'][_0xc96c('0x1f')]({'raw':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x31')))),_0xc96c('0x32')],[db['sequelize']['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xc96c('0x33')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x34')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc96c('0x35')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc96c('0x37')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x38')))),_0xc96c('0x39')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xc96c('0x3a')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc96c('0x3b')],[db[_0xc96c('0x21')]['fn']('COUNT',db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3c')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc96c('0x3e')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3f')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x40')))),_0xc96c('0x41')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0xad88c3){logger[_0xc96c('0xd')]('GetVoiceQueueHopperHistory',_0x56b5c9);logger['debug']('GetVoiceQueueHopperHistory',_0x56b5c9,JSON['stringify'](_0xad88c3));_0x156d0f(_0xad88c3);})[_0xc96c('0x16')](function(_0x46c6fb){logger[_0xc96c('0x12')](_0xc96c('0x42'),_0x46c6fb[_0xc96c('0x14')],_0x56b5c9);_0x5006ec(_0x33b4bb[_0xc96c('0x12')](0x1f4,_0x46c6fb[_0xc96c('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x47115b){var _0x48dc98=this;return new Promise(function(_0x3c4b60,_0x103e90){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x47115b[_0xc96c('0x1b')]?_0x47115b['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x47115b[_0xc96c('0x1b')]?_0x47115b[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x43')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x44')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0x55219a){logger[_0xc96c('0xd')](_0xc96c('0x45'),_0x47115b);logger[_0xc96c('0x1d')](_0xc96c('0x45'),_0x47115b,JSON['stringify'](_0x55219a));_0x3c4b60(_0x55219a);})[_0xc96c('0x16')](function(_0x4629ce){logger['error']('GetCampaignHopperHistory',_0x4629ce['message'],_0x47115b);_0x103e90(_0x48dc98[_0xc96c('0x12')](0x1f4,_0x4629ce[_0xc96c('0x14')]));});});}; \ No newline at end of file +var _0xb688=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4212c1,_0xb66a71){var _0x224635=function(_0x4f48c3){while(--_0x4f48c3){_0x4212c1['push'](_0x4212c1['shift']());}};_0x224635(++_0xb66a71);}(_0xb688,0xcf));var _0x8b68=function(_0xffad61,_0x5f0282){_0xffad61=_0xffad61-0x0;var _0x33ef10=_0xb688[_0xffad61];return _0x33ef10;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee56,_0x37677d,_0x2bbffd){return new BPromise(function(_0x130892,_0xa5571b){return client[_0x8b68('0xb')](_0x57ee56,_0x2bbffd)[_0x8b68('0xc')](function(_0x261753){logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x37677d,_0x8b68('0xf'));logger[_0x8b68('0x10')](_0x8b68('0x11'),_0x37677d,_0x8b68('0xf'),JSON['stringify'](_0x261753));if(_0x261753[_0x8b68('0x12')]){if(_0x261753[_0x8b68('0x12')][_0x8b68('0x13')]===0x1f4){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);return _0xa5571b(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}logger['error'](_0x8b68('0xe'),_0x37677d,_0x261753['error']['message']);return _0x130892(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}else{logger[_0x8b68('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x37677d,'request\x20sent');_0x130892(_0x261753[_0x8b68('0x15')]['message']);}})[_0x8b68('0x16')](function(_0xb44923){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0xb44923);_0xa5571b(_0xb44923);});});}exports['CreateCmHopperHistory']=function(_0xd17693){var _0x203dd4=this;return new Promise(function(_0x4a68c7,_0x42b3bd){return db[_0x8b68('0x17')][_0x8b68('0x18')](_0xd17693[_0x8b68('0x19')],{'raw':_0xd17693[_0x8b68('0x1a')]?_0xd17693['options'][_0x8b68('0x1b')]===undefined?!![]:![]:!![]})[_0x8b68('0xc')](function(_0x59e9b1){logger[_0x8b68('0xd')](_0x8b68('0x1c'),_0xd17693);logger[_0x8b68('0x10')]('CreateCmHopperHistory',_0xd17693,JSON['stringify'](_0x59e9b1));_0x4a68c7(_0x59e9b1);})[_0x8b68('0x16')](function(_0x59cb26){logger[_0x8b68('0x12')](_0x8b68('0x1c'),_0x59cb26[_0x8b68('0x14')],_0xd17693);_0x42b3bd(_0x203dd4[_0x8b68('0x12')](0x1f4,_0x59cb26[_0x8b68('0x14')]));});});};exports[_0x8b68('0x1d')]=function(_0x59bb8a){var _0x1a6fe8=this;return new Promise(function(_0x46e827,_0x4ca77d){return db[_0x8b68('0x17')][_0x8b68('0x1e')]({'raw':_0x59bb8a[_0x8b68('0x1a')]?_0x59bb8a['options']['raw']===undefined?!![]:![]:!![],'where':_0x59bb8a['options']?_0x59bb8a[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x8b68('0x21')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal'](_0x8b68('0x25')))),_0x8b68('0x26')],[db[_0x8b68('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x27')))),_0x8b68('0x28')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x29'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x2a')))),_0x8b68('0x2b')]]})[_0x8b68('0xc')](function(_0x232fa9){logger[_0x8b68('0xd')](_0x8b68('0x1d'),_0x59bb8a);logger[_0x8b68('0x10')](_0x8b68('0x1d'),_0x59bb8a,JSON[_0x8b68('0x2c')](_0x232fa9));_0x46e827(_0x232fa9);})[_0x8b68('0x16')](function(_0x18dfae){logger[_0x8b68('0x12')](_0x8b68('0x1d'),_0x18dfae['message'],_0x59bb8a);_0x4ca77d(_0x1a6fe8['error'](0x1f4,_0x18dfae[_0x8b68('0x14')]));});});};exports[_0x8b68('0x2d')]=function(_0x23554d){var _0xb9b5b1=this;return new Promise(function(_0xf2154f,_0xce486c){return db[_0x8b68('0x17')][_0x8b68('0x1e')]({'raw':_0x23554d['options']?_0x23554d[_0x8b68('0x1a')][_0x8b68('0x1b')]===undefined?!![]:![]:!![],'where':_0x23554d[_0x8b68('0x1a')]?_0x23554d[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[_0x8b68('0x2e'),_0x8b68('0x2f')],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x30')))),_0x8b68('0x31')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x8b68('0x32')],[db[_0x8b68('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8b68('0x33')))),_0x8b68('0x34')],[db['sequelize']['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x8b68('0x35')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x36')))),_0x8b68('0x37')],[db['sequelize']['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8b68('0x38')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db['sequelize'][_0x8b68('0x23')](_0x8b68('0x39')))),_0x8b68('0x3a')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x3b')))),_0x8b68('0x3c')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x3d')))),'outboundBlacklistCallsDay'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x8b68('0x3e')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x8b68('0x3f')],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal'](_0x8b68('0x40')))),_0x8b68('0x3e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x41')))),_0x8b68('0x42')]],'group':['campaign']})['then'](function(_0x4492fd){logger[_0x8b68('0xd')](_0x8b68('0x2d'),_0x23554d);logger['debug'](_0x8b68('0x2d'),_0x23554d,JSON[_0x8b68('0x2c')](_0x4492fd));_0xf2154f(_0x4492fd);})[_0x8b68('0x16')](function(_0x4dda69){logger[_0x8b68('0x12')]('GetVoiceQueueHopperHistory',_0x4dda69[_0x8b68('0x14')],_0x23554d);_0xce486c(_0xb9b5b1[_0x8b68('0x12')](0x1f4,_0x4dda69['message']));});});};exports[_0x8b68('0x43')]=function(_0x25842e){var _0x6ac18=this;return new Promise(function(_0xcd88b4,_0x8cc614){return db['CmHopperHistory'][_0x8b68('0x1e')]({'raw':_0x25842e[_0x8b68('0x1a')]?_0x25842e[_0x8b68('0x1a')][_0x8b68('0x1b')]===undefined?!![]:![]:!![],'where':_0x25842e[_0x8b68('0x1a')]?_0x25842e[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[_0x8b68('0x2e'),'name'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')][_0x8b68('0x44')]('id')),_0x8b68('0x45')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x33')))),_0x8b68('0x46')]],'group':[_0x8b68('0x2e')]})[_0x8b68('0xc')](function(_0x28e7aa){logger[_0x8b68('0xd')](_0x8b68('0x43'),_0x25842e);logger[_0x8b68('0x10')](_0x8b68('0x43'),_0x25842e,JSON[_0x8b68('0x2c')](_0x28e7aa));_0xcd88b4(_0x28e7aa);})['catch'](function(_0xaac776){logger['error']('GetCampaignHopperHistory',_0xaac776[_0x8b68('0x14')],_0x25842e);_0x8cc614(_0x6ac18['error'](0x1f4,_0xaac776[_0x8b68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 690e367..afa5fe3 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 _0x99fc=['path','connect-timeout','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x442dbe,_0x4e0211){var _0x20d241=function(_0x5ae99e){while(--_0x5ae99e){_0x442dbe['push'](_0x442dbe['shift']());}};_0x20d241(++_0x4e0211);}(_0x99fc,0x1b3));var _0xc99f=function(_0x2329a1,_0x5bc404){_0x2329a1=_0x2329a1-0x0;var _0x443128=_0x99fc[_0x2329a1];return _0x443128;};'use strict';var multer=require(_0xc99f('0x0'));var util=require(_0xc99f('0x1'));var path=require(_0xc99f('0x2'));var timeout=require(_0xc99f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc99f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc99f('0x5'));var controller=require(_0xc99f('0x6'));router[_0xc99f('0x7')]('/',auth[_0xc99f('0x8')](),controller[_0xc99f('0x9')]);router[_0xc99f('0x7')](_0xc99f('0xa'),auth[_0xc99f('0x8')](),controller[_0xc99f('0xb')]);router[_0xc99f('0x7')](_0xc99f('0xc'),auth[_0xc99f('0x8')](),controller[_0xc99f('0xd')]);router[_0xc99f('0xe')]('/',auth[_0xc99f('0x8')](),controller[_0xc99f('0xf')]);router[_0xc99f('0x10')](_0xc99f('0xc'),auth[_0xc99f('0x8')](),controller[_0xc99f('0x11')]);module[_0xc99f('0x12')]=router; \ No newline at end of file +var _0x7174=['create','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5b98ae,_0x140bdd){var _0x3aaaac=function(_0x296db0){while(--_0x296db0){_0x5b98ae['push'](_0x5b98ae['shift']());}};_0x3aaaac(++_0x140bdd);}(_0x7174,0x18a));var _0x4717=function(_0x465e2f,_0x5ecdfe){_0x465e2f=_0x465e2f-0x0;var _0x178164=_0x7174[_0x465e2f];return _0x178164;};'use strict';var multer=require(_0x4717('0x0'));var util=require(_0x4717('0x1'));var path=require('path');var timeout=require(_0x4717('0x2'));var express=require(_0x4717('0x3'));var router=express['Router']();var auth=require(_0x4717('0x4'));var interaction=require(_0x4717('0x5'));var config=require(_0x4717('0x6'));var controller=require(_0x4717('0x7'));router[_0x4717('0x8')]('/',auth[_0x4717('0x9')](),controller[_0x4717('0xa')]);router['get'](_0x4717('0xb'),auth[_0x4717('0x9')](),controller['describe']);router[_0x4717('0x8')](_0x4717('0xc'),auth[_0x4717('0x9')](),controller[_0x4717('0xd')]);router['post']('/',auth[_0x4717('0x9')](),controller[_0x4717('0xe')]);router['put'](_0x4717('0xc'),auth[_0x4717('0x9')](),controller[_0x4717('0xf')]);module[_0x4717('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ec19b93..e51cbe6 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 _0xa13c=['STRING','name','sequelize','exports'];(function(_0x4aa89a,_0x2aeded){var _0x574c62=function(_0x1ad1a0){while(--_0x1ad1a0){_0x4aa89a['push'](_0x4aa89a['shift']());}};_0x574c62(++_0x2aeded);}(_0xa13c,0x1de));var _0xca13=function(_0x104aac,_0xba2de2){_0x104aac=_0x104aac-0x0;var _0x98dfe7=_0xa13c[_0x104aac];return _0x98dfe7;};'use strict';var Sequelize=require(_0xca13('0x0'));module[_0xca13('0x1')]={'name':{'type':Sequelize[_0xca13('0x2')],'unique':_0xca13('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xca13('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1aeb=['STRING','name','sequelize','exports'];(function(_0x2836de,_0x439609){var _0x374b2c=function(_0x53a939){while(--_0x53a939){_0x2836de['push'](_0x2836de['shift']());}};_0x374b2c(++_0x439609);}(_0x1aeb,0x14e));var _0xb1ae=function(_0x297251,_0x22dca8){_0x297251=_0x297251-0x0;var _0x267653=_0x1aeb[_0x297251];return _0x267653;};'use strict';var Sequelize=require(_0xb1ae('0x0'));module[_0xb1ae('0x1')]={'name':{'type':Sequelize[_0xb1ae('0x2')],'unique':_0xb1ae('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb1ae('0x2')]},'dialPrefix':{'type':Sequelize[_0xb1ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index bd65c6b..97acd9a 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 _0x18cf=['util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','CmContact','isArray','tags','join','each','omit','ids','push','dataValues','errors','getContacts','CustomFields','format','CmCustomField','cf_%d','raw','isEmpty','now','writeFileSync','Content-disposition','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findOne','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x18cf,0x11a));var _0xf18c=function(_0x12e7e9,_0x1e3ef0){_0x12e7e9=_0x12e7e9-0x0;var _0x521143=_0x18cf[_0x12e7e9];return _0x521143;};'use strict';var pdf=require(_0xf18c('0x0'));var emlformat=require(_0xf18c('0x1'));var rimraf=require(_0xf18c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf18c('0x3'));var rp=require(_0xf18c('0x4'));var moment=require('moment');var BPromise=require(_0xf18c('0x5'));var Mustache=require('mustache');var util=require(_0xf18c('0x6'));var path=require(_0xf18c('0x7'));var sox=require('sox');var csv=require(_0xf18c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf18c('0x9'));var squel=require(_0xf18c('0xa'));var crypto=require(_0xf18c('0xb'));var jsforce=require(_0xf18c('0xc'));var deskjs=require(_0xf18c('0xd'));var toCsv=require(_0xf18c('0x8'));var querystring=require(_0xf18c('0xe'));var Papa=require(_0xf18c('0xf'));var Redis=require(_0xf18c('0x10'));var authService=require(_0xf18c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf18c('0x12'));var hardwareService=require(_0xf18c('0x13'));var logger=require('../../config/logger')(_0xf18c('0x14'));var utils=require(_0xf18c('0x15'));var config=require(_0xf18c('0x16'));var db=require(_0xf18c('0x17'))['db'];config['redis']=_[_0xf18c('0x18')](config[_0xf18c('0x19')],{'host':_0xf18c('0x1a'),'port':0x18eb});var socket=require(_0xf18c('0x1b'))(new Redis(config[_0xf18c('0x19')]));require(_0xf18c('0x1c'))['register'](socket);function respondWithStatusCode(_0x30f06c,_0x2a759a){_0x2a759a=_0x2a759a||0xcc;return function(_0x31785d){if(_0x31785d){return _0x30f06c[_0xf18c('0x1d')](_0x2a759a);}return _0x30f06c['status'](_0x2a759a)['end']();};}function respondWithResult(_0x20f4ad,_0x466e08){_0x466e08=_0x466e08||0xc8;return function(_0xd2e134){if(_0xd2e134){return _0x20f4ad['status'](_0x466e08)[_0xf18c('0x1e')](_0xd2e134);}};}function respondWithFilteredResult(_0x1bf14a,_0x4d2f95){return function(_0x222a00){if(_0x222a00){var _0x1e4ac6=_0x222a00['count'],_0x4d0503=_0x4d2f95[_0xf18c('0x1f')],_0x43f272=_0x4d2f95[_0xf18c('0x1f')]+_0x4d2f95[_0xf18c('0x20')],_0x32f864;if(_0x43f272>=_0x1e4ac6){_0x43f272=_0x1e4ac6;_0x32f864=0xc8;}else{_0x32f864=0xce;}_0x1bf14a[_0xf18c('0x21')](_0x32f864);return _0x1bf14a[_0xf18c('0x22')](_0xf18c('0x23'),_0x4d0503+'-'+_0x43f272+'/'+_0x1e4ac6)[_0xf18c('0x1e')](_0x222a00);}return null;};}function patchUpdates(_0x9d4826){return function(_0x32de20){try{jsonpatch[_0xf18c('0x24')](_0x32de20,_0x9d4826,!![]);}catch(_0x316640){return BPromise[_0xf18c('0x25')](_0x316640);}return _0x32de20[_0xf18c('0x26')]();};}function saveUpdates(_0x59517c,_0x1f8591){return function(_0x497f55){if(_0x497f55){return _0x497f55[_0xf18c('0x27')](_0x59517c)[_0xf18c('0x28')](function(_0xb5a223){return _0xb5a223;});}return null;};}function removeEntity(_0x17c90c,_0x1077af){return function(_0x550e5c){if(_0x550e5c){return _0x550e5c[_0xf18c('0x29')]()['then'](function(){var _0x50d589=_0x550e5c[_0xf18c('0x2a')]({'plain':!![]});var _0x26e2c8=_0xf18c('0x2b');return db[_0xf18c('0x2c')][_0xf18c('0x29')]({'where':{'type':_0x26e2c8,'resourceId':_0x50d589['id']}})[_0xf18c('0x28')](function(){return _0x550e5c;});})[_0xf18c('0x28')](function(){_0x17c90c[_0xf18c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcaff2f,_0x3c564b){return function(_0x4cae7c){if(!_0x4cae7c){_0xcaff2f[_0xf18c('0x1d')](0x194);}return _0x4cae7c;};}function handleError(_0x3f5b96,_0x5302f6){_0x5302f6=_0x5302f6||0x1f4;return function(_0x133472){logger[_0xf18c('0x2d')](_0x133472[_0xf18c('0x2e')]);if(_0x133472['name']){delete _0x133472[_0xf18c('0x2f')];}_0x3f5b96['status'](_0x5302f6)[_0xf18c('0x30')](_0x133472);};}exports[_0xf18c('0x31')]=function(_0x20ec3f,_0x3fef77){var _0x262769={},_0x5b39d8={},_0x26b99e={'count':0x0,'rows':[]};var _0x232dd8=_[_0xf18c('0x32')](db[_0xf18c('0x33')][_0xf18c('0x34')],function(_0x2716af){return{'name':_0x2716af[_0xf18c('0x35')],'type':_0x2716af[_0xf18c('0x36')][_0xf18c('0x37')]};});_0x5b39d8[_0xf18c('0x38')]=_[_0xf18c('0x32')](_0x232dd8,_0xf18c('0x2f'));_0x5b39d8[_0xf18c('0x39')]=_[_0xf18c('0x3a')](_0x20ec3f[_0xf18c('0x39')]);_0x5b39d8[_0xf18c('0x3b')]=_[_0xf18c('0x3c')](_0x5b39d8['model'],_0x5b39d8['query']);_0x262769['attributes']=_[_0xf18c('0x3c')](_0x5b39d8[_0xf18c('0x38')],qs[_0xf18c('0x3d')](_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x3d')]));_0x262769[_0xf18c('0x3e')]=_0x262769[_0xf18c('0x3e')]['length']?_0x262769[_0xf18c('0x3e')]:_0x5b39d8['model'];if(!_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x3f')](_0xf18c('0x40'))){_0x262769[_0xf18c('0x20')]=qs['limit'](_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x20')]);_0x262769[_0xf18c('0x1f')]=qs[_0xf18c('0x1f')](_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x1f')]);}_0x262769[_0xf18c('0x41')]=qs[_0xf18c('0x42')](_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x42')]);_0x262769[_0xf18c('0x43')]=qs[_0xf18c('0x3b')](_[_0xf18c('0x44')](_0x20ec3f[_0xf18c('0x39')],_0x5b39d8[_0xf18c('0x3b')]),_0x232dd8);if(_0x20ec3f['query'][_0xf18c('0x45')]){_0x262769['where']=_[_0xf18c('0x46')](_0x262769['where'],{'$or':_[_0xf18c('0x32')](_0x232dd8,function(_0x2967b7){if(_0x2967b7['type']!==_0xf18c('0x47')){var _0x31416b={};_0x31416b[_0x2967b7['name']]={'$like':'%'+_0x20ec3f[_0xf18c('0x39')]['filter']+'%'};return _0x31416b;}})});}_0x262769=_[_0xf18c('0x46')]({},_0x262769,_0x20ec3f[_0xf18c('0x48')]);var _0x476643={'where':_0x262769[_0xf18c('0x43')]};return db[_0xf18c('0x33')][_0xf18c('0x49')](_0x476643)[_0xf18c('0x28')](function(_0x1cf743){_0x26b99e[_0xf18c('0x49')]=_0x1cf743;if(_0x20ec3f[_0xf18c('0x39')][_0xf18c('0x4a')]){_0x262769[_0xf18c('0x4b')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x262769);})[_0xf18c('0x28')](function(_0x490a79){_0x26b99e[_0xf18c('0x4c')]=_0x490a79;return _0x26b99e;})[_0xf18c('0x28')](respondWithFilteredResult(_0x3fef77,_0x262769))[_0xf18c('0x4d')](handleError(_0x3fef77,null));};exports['show']=function(_0x3740b4,_0x786968){var _0xb69311={'raw':![],'where':{'id':_0x3740b4[_0xf18c('0x4e')]['id']}},_0x19ebef={};_0x19ebef[_0xf18c('0x38')]=_[_0xf18c('0x3a')](db[_0xf18c('0x33')][_0xf18c('0x34')]);_0x19ebef['query']=_[_0xf18c('0x3a')](_0x3740b4['query']);_0x19ebef[_0xf18c('0x3b')]=_['intersection'](_0x19ebef[_0xf18c('0x38')],_0x19ebef[_0xf18c('0x39')]);_0xb69311['attributes']=_[_0xf18c('0x3c')](_0x19ebef[_0xf18c('0x38')],qs['fields'](_0x3740b4[_0xf18c('0x39')][_0xf18c('0x3d')]));_0xb69311[_0xf18c('0x3e')]=_0xb69311[_0xf18c('0x3e')][_0xf18c('0x4f')]?_0xb69311[_0xf18c('0x3e')]:_0x19ebef['model'];if(_0x3740b4[_0xf18c('0x39')][_0xf18c('0x4a')]){_0xb69311[_0xf18c('0x4b')]=[{'all':!![]}];}_0xb69311=_[_0xf18c('0x46')]({},_0xb69311,_0x3740b4[_0xf18c('0x48')]);return db[_0xf18c('0x33')]['find'](_0xb69311)['then'](handleEntityNotFound(_0x786968,null))[_0xf18c('0x28')](respondWithResult(_0x786968,null))[_0xf18c('0x4d')](handleError(_0x786968,null));};exports['create']=function(_0xf55873,_0x334149){return db[_0xf18c('0x33')][_0xf18c('0x50')](_0xf55873[_0xf18c('0x51')],{})[_0xf18c('0x28')](function(_0x1787ae){var _0x4b7f1f=_0xf55873[_0xf18c('0x52')][_0xf18c('0x2a')]({'plain':!![]});if(!_0x4b7f1f)throw new Error(_0xf18c('0x53'));if(_0x4b7f1f[_0xf18c('0x54')]===_0xf18c('0x52')){var _0x32fda0=_0x1787ae[_0xf18c('0x2a')]({'plain':!![]});var _0x3d48a5=_0xf18c('0x2b');return db['UserProfileSection'][_0xf18c('0x55')]({'where':{'name':_0x3d48a5,'userProfileId':_0x4b7f1f[_0xf18c('0x56')]},'raw':!![]})[_0xf18c('0x28')](function(_0x399c06){if(_0x399c06&&_0x399c06[_0xf18c('0x57')]===0x0){return db[_0xf18c('0x2c')][_0xf18c('0x50')]({'name':_0x32fda0['name'],'resourceId':_0x32fda0['id'],'type':_0x399c06[_0xf18c('0x2f')],'sectionId':_0x399c06['id']},{})['then'](function(){return _0x1787ae;});}else{return _0x1787ae;}})[_0xf18c('0x4d')](function(_0x56acea){logger[_0xf18c('0x2d')](_0xf18c('0x58'),_0x56acea);throw _0x56acea;});}return _0x1787ae;})[_0xf18c('0x28')](respondWithResult(_0x334149,0xc9))[_0xf18c('0x4d')](handleError(_0x334149,null));};exports[_0xf18c('0x27')]=function(_0x5a87cf,_0x21a45c){if(_0x5a87cf['body']['id']){delete _0x5a87cf[_0xf18c('0x51')]['id'];}return db[_0xf18c('0x33')]['find']({'where':{'id':_0x5a87cf[_0xf18c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x21a45c,null))[_0xf18c('0x28')](saveUpdates(_0x5a87cf[_0xf18c('0x51')],null))['then'](respondWithResult(_0x21a45c,null))['catch'](handleError(_0x21a45c,null));};exports[_0xf18c('0x29')]=function(_0x4ee2fc,_0x51e051){return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x4ee2fc[_0xf18c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51e051,null))['then'](removeEntity(_0x51e051,null))[_0xf18c('0x4d')](handleError(_0x51e051,null));};exports['describe']=function(_0x2b9cd8,_0x178427){return db[_0xf18c('0x33')][_0xf18c('0x59')]()[_0xf18c('0x28')](respondWithResult(_0x178427,null))[_0xf18c('0x4d')](handleError(_0x178427,null));};exports[_0xf18c('0x5a')]=function(_0x19af97,_0x4612e8,_0x4a1b12){if(_0x19af97[_0xf18c('0x51')]['id']){delete _0x19af97['body']['id'];}return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x19af97[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x4612e8,null))[_0xf18c('0x28')](function(_0x1bcc3f){if(_0x1bcc3f){_0x19af97[_0xf18c('0x51')][_0xf18c('0x5b')]=_0x1bcc3f['id'];return db[_0xf18c('0x5c')]['create'](_0x19af97[_0xf18c('0x51')]);}})[_0xf18c('0x28')](respondWithResult(_0x4612e8,null))[_0xf18c('0x4d')](handleError(_0x4612e8,null));};exports[_0xf18c('0x5d')]=function(_0x5f6d78,_0x5eaff2,_0x307ff4){var _0x21c54e={'raw':![],'where':{}};var _0x92404c={};var _0x3e9ac5={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x5f6d78[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x5eaff2,null))[_0xf18c('0x28')](function(_0x1834b7){if(_0x1834b7){_0x92404c[_0xf18c('0x38')]=_['keys'](db[_0xf18c('0x5c')]['rawAttributes']);_0x92404c[_0xf18c('0x39')]=_[_0xf18c('0x3a')](_0x5f6d78[_0xf18c('0x39')]);_0x92404c[_0xf18c('0x3b')]=_['intersection'](_0x92404c[_0xf18c('0x38')],_0x92404c[_0xf18c('0x39')]);_0x21c54e[_0xf18c('0x3e')]=_['intersection'](_0x92404c[_0xf18c('0x38')],qs['fields'](_0x5f6d78[_0xf18c('0x39')][_0xf18c('0x3d')]));_0x21c54e[_0xf18c('0x3e')]=_0x21c54e[_0xf18c('0x3e')]['length']?_0x21c54e[_0xf18c('0x3e')]:_0x92404c[_0xf18c('0x38')];if(!_0x5f6d78['query'][_0xf18c('0x3f')](_0xf18c('0x40'))){_0x21c54e[_0xf18c('0x20')]=qs['limit'](_0x5f6d78[_0xf18c('0x39')][_0xf18c('0x20')]);_0x21c54e[_0xf18c('0x1f')]=qs[_0xf18c('0x1f')](_0x5f6d78[_0xf18c('0x39')][_0xf18c('0x1f')]);}_0x21c54e[_0xf18c('0x41')]=qs[_0xf18c('0x42')](_0x5f6d78[_0xf18c('0x39')][_0xf18c('0x42')]);_0x21c54e[_0xf18c('0x43')]=qs[_0xf18c('0x3b')](_[_0xf18c('0x44')](_0x5f6d78[_0xf18c('0x39')],_0x92404c['filters']));_0x21c54e[_0xf18c('0x43')][_0xf18c('0x5b')]=_0x1834b7['id'];if(_0x5f6d78['query'][_0xf18c('0x45')]){_0x21c54e[_0xf18c('0x43')]=_[_0xf18c('0x46')](_0x21c54e[_0xf18c('0x43')],{'$or':_['map'](_0x21c54e[_0xf18c('0x3e')],function(_0x55a473){var _0x446f0e={};_0x446f0e[_0x55a473]={'$like':'%'+_0x5f6d78['query'][_0xf18c('0x45')]+'%'};return _0x446f0e;})});}_0x21c54e=_['merge']({},_0x21c54e,_0x5f6d78[_0xf18c('0x48')]);return db[_0xf18c('0x5c')][_0xf18c('0x49')]({'where':_0x21c54e[_0xf18c('0x43')]})[_0xf18c('0x28')](function(_0x4a81ec){_0x3e9ac5[_0xf18c('0x49')]=_0x4a81ec;if(_0x5f6d78[_0xf18c('0x39')][_0xf18c('0x4a')]){_0x21c54e[_0xf18c('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x21c54e);})[_0xf18c('0x28')](function(_0x331d9e){_0x3e9ac5['rows']=_0x331d9e;return _0x3e9ac5;});}})[_0xf18c('0x28')](respondWithFilteredResult(_0x5eaff2,_0x21c54e))['catch'](handleError(_0x5eaff2,null));};exports['removeDispositions']=function(_0x181feb,_0x48ce12,_0x1c0667){return db[_0xf18c('0x33')]['find']({'where':{'id':_0x181feb[_0xf18c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x48ce12,null))[_0xf18c('0x28')](function(_0x200388){if(_0x200388){return _0x200388[_0xf18c('0x5e')](_0x181feb[_0xf18c('0x39')]['ids']);}})[_0xf18c('0x28')](respondWithStatusCode(_0x48ce12,null))[_0xf18c('0x4d')](handleError(_0x48ce12,null));};exports['addContacts']=function(_0x545eb3,_0x48300e,_0x4ec7e4){return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x545eb3[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x48300e,null))['then'](function(_0x1d7528){if(_0x1d7528){var _0xf11fa3=[];var _0x319f98={'success':[],'errors':[]};return db[_0xf18c('0x5f')][_0xf18c('0x59')]()[_0xf18c('0x28')](function(_0x11e843){if(_0x545eb3[_0xf18c('0x51')]['tags']&&_[_0xf18c('0x60')](_0x545eb3[_0xf18c('0x51')]['tags'])){if(_0x545eb3[_0xf18c('0x51')]['tags']['length']){_0x545eb3[_0xf18c('0x51')][_0xf18c('0x61')]=_0x545eb3[_0xf18c('0x51')]['tags'][_0xf18c('0x62')](';')+';';}else{_0x545eb3[_0xf18c('0x51')][_0xf18c('0x61')]=null;}}else{_0x545eb3['body'][_0xf18c('0x61')]=null;}if(_0x545eb3[_0xf18c('0x51')]&&_['isArray'](_0x545eb3[_0xf18c('0x51')])){for(var _0x320e8d=0x0;_0x320e8d<_0x545eb3[_0xf18c('0x51')]['length'];_0x320e8d+=0x1){_0x545eb3[_0xf18c('0x51')][_0x320e8d][_0xf18c('0x5b')]=_0x545eb3[_0xf18c('0x4e')]['id'];_0xf11fa3['push'](_0x545eb3[_0xf18c('0x51')][_0x320e8d]);}return BPromise[_0xf18c('0x63')](_0xf11fa3,function(_0x1701fe){return db['CmContact'][_0xf18c('0x50')](_[_0xf18c('0x64')](_0x1701fe,[_0xf18c('0x65'),'id'])||{},{'fields':_[_0xf18c('0x3a')](_0x11e843),'raw':!![]})[_0xf18c('0x28')](function(_0x1ee400){_0x319f98['success'][_0xf18c('0x66')](_0x1ee400[_0xf18c('0x67')]);})['catch'](function(_0x3f7c96){_0x319f98[_0xf18c('0x68')][_0xf18c('0x66')]({'data':_0x1701fe,'error':_0x3f7c96['message']});});})[_0xf18c('0x28')](function(_0x1db45f){return _0x319f98;})['catch'](function(_0x5ea3f7){return _0x5ea3f7;});}else{_0x48300e['status'](0x190)[_0xf18c('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x48300e,null))[_0xf18c('0x4d')](handleError(_0x48300e,null));};exports[_0xf18c('0x69')]=function(_0x21c35d,_0x19b0f1,_0x26dc77){var _0x23e9b4;return db['CmList'][_0xf18c('0x55')]({'where':{'id':_0x21c35d[_0xf18c('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xf18c('0x6a')}]})[_0xf18c('0x28')](handleEntityNotFound(_0x19b0f1,null))[_0xf18c('0x28')](function(_0x542fdc){if(_0x542fdc){_0x23e9b4=_0x542fdc;return db[_0xf18c('0x5f')][_0xf18c('0x34')];}})['then'](function(_0x587461){if(_0x587461){var _0x31cb7c={};var _0x5b874d={};_0x5b874d[_0xf18c('0x38')]=_['concat'](_[_0xf18c('0x3a')](_0x587461),_[_0xf18c('0x32')](_0x23e9b4[_0xf18c('0x6a')],function(_0x5a7ea1){return util[_0xf18c('0x6b')]('cf_%d',_0x5a7ea1['id']);}));_0x5b874d['query']=_['keys'](_0x21c35d[_0xf18c('0x39')]);_0x5b874d['filters']=_[_0xf18c('0x3c')](_0x5b874d[_0xf18c('0x38')],_0x5b874d[_0xf18c('0x39')]);_0x31cb7c[_0xf18c('0x3e')]=_[_0xf18c('0x3c')](_0x5b874d[_0xf18c('0x38')],qs[_0xf18c('0x3d')](_0x21c35d[_0xf18c('0x39')][_0xf18c('0x3d')]));_0x31cb7c[_0xf18c('0x3e')]=_0x31cb7c[_0xf18c('0x3e')][_0xf18c('0x4f')]?_0x31cb7c[_0xf18c('0x3e')]:_0x5b874d[_0xf18c('0x38')];if(!_0x21c35d[_0xf18c('0x39')][_0xf18c('0x3f')](_0xf18c('0x40'))){_0x31cb7c[_0xf18c('0x20')]=qs['limit'](_0x21c35d['query']['limit']);_0x31cb7c['offset']=qs[_0xf18c('0x1f')](_0x21c35d[_0xf18c('0x39')][_0xf18c('0x1f')]);}_0x31cb7c[_0xf18c('0x41')]=qs[_0xf18c('0x42')](_0x21c35d[_0xf18c('0x39')]['sort']);_0x31cb7c['where']=qs['filters'](_[_0xf18c('0x44')](_0x21c35d['query'],_0x5b874d[_0xf18c('0x3b')]));_0x31cb7c['raw']=!![];if(_0x21c35d['query'][_0xf18c('0x45')]){_0x31cb7c[_0xf18c('0x43')]=_[_0xf18c('0x46')](_0x31cb7c['where'],{'$or':_['map'](_0x31cb7c[_0xf18c('0x3e')],function(_0x172af4){var _0xfa7457={};_0xfa7457[_0x172af4]={'$like':'%'+_0x21c35d[_0xf18c('0x39')][_0xf18c('0x45')]+'%'};return _0xfa7457;})});}_0x31cb7c=_[_0xf18c('0x46')]({},_0x31cb7c,_0x21c35d[_0xf18c('0x48')]);return _0x23e9b4[_0xf18c('0x69')](_0x31cb7c);}})[_0xf18c('0x28')](respondWithResult(_0x19b0f1,null))[_0xf18c('0x4d')](handleError(_0x19b0f1,null));};exports['getContactsCsv']=function(_0x5a163b,_0x29a2ae,_0x40d79c){var _0x429bff;return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x5a163b[_0xf18c('0x4e')]['id']},'include':[{'model':db[_0xf18c('0x6c')],'as':_0xf18c('0x6a')}]})[_0xf18c('0x28')](handleEntityNotFound(_0x29a2ae,null))[_0xf18c('0x28')](function(_0x24eff5){if(_0x24eff5){_0x429bff=_0x24eff5;return db[_0xf18c('0x5f')]['rawAttributes'];}})[_0xf18c('0x28')](function(_0x48e6c7){if(_0x48e6c7){var _0x8aab2d={};var _0x1c53fb={};_0x1c53fb[_0xf18c('0x38')]=_['concat'](_[_0xf18c('0x3a')](_0x48e6c7),_[_0xf18c('0x32')](_0x429bff[_0xf18c('0x6a')],function(_0xa3c031){return util[_0xf18c('0x6b')](_0xf18c('0x6d'),_0xa3c031['id']);}));_0x1c53fb[_0xf18c('0x39')]=_[_0xf18c('0x3a')](_0x5a163b[_0xf18c('0x39')]);_0x1c53fb['filters']=_[_0xf18c('0x3c')](_0x1c53fb['model'],_0x1c53fb[_0xf18c('0x39')]);_0x8aab2d[_0xf18c('0x3e')]=_[_0xf18c('0x3c')](_0x1c53fb[_0xf18c('0x38')],qs['fields'](_0x5a163b[_0xf18c('0x39')][_0xf18c('0x3d')]));_0x8aab2d['attributes']=_0x8aab2d['attributes']['length']?_0x8aab2d[_0xf18c('0x3e')]:_0x1c53fb[_0xf18c('0x38')];if(!_0x5a163b['query'][_0xf18c('0x3f')](_0xf18c('0x40'))){_0x8aab2d['limit']=qs[_0xf18c('0x20')](_0x5a163b[_0xf18c('0x39')][_0xf18c('0x20')]);_0x8aab2d['offset']=qs[_0xf18c('0x1f')](_0x5a163b['query'][_0xf18c('0x1f')]);}_0x8aab2d[_0xf18c('0x41')]=qs[_0xf18c('0x42')](_0x5a163b[_0xf18c('0x39')][_0xf18c('0x42')]);_0x8aab2d[_0xf18c('0x43')]=qs[_0xf18c('0x3b')](_[_0xf18c('0x44')](_0x5a163b[_0xf18c('0x39')],_0x1c53fb['filters']));_0x8aab2d[_0xf18c('0x6e')]=!![];if(_0x5a163b['query'][_0xf18c('0x45')]){_0x8aab2d[_0xf18c('0x43')]=_[_0xf18c('0x46')](_0x8aab2d[_0xf18c('0x43')],{'$or':_['map'](_0x8aab2d[_0xf18c('0x3e')],function(_0x3de208){var _0x22093e={};_0x22093e[_0x3de208]={'$like':'%'+_0x5a163b[_0xf18c('0x39')][_0xf18c('0x45')]+'%'};return _0x22093e;})});}_0x8aab2d=_[_0xf18c('0x46')]({},_0x8aab2d,_0x5a163b[_0xf18c('0x48')]);return _0x429bff[_0xf18c('0x69')](_0x8aab2d);}})[_0xf18c('0x28')](function(_0x3747b5){if(!_[_0xf18c('0x6f')](_0x3747b5)){var _0x4cabb2=toCsv(_0x3747b5);var _0x202c55=Date[_0xf18c('0x70')]();fs[_0xf18c('0x71')](util[_0xf18c('0x6b')]('/tmp/list_%d_%s.csv',_0x429bff['id'],_0x202c55),_0x4cabb2);_0x29a2ae['setHeader'](_0xf18c('0x72'),'attachment;\x20filename='+util[_0xf18c('0x6b')]('list_%d_%s.csv',_0x429bff['id'],_0x202c55));_0x29a2ae['setHeader'](_0xf18c('0x73'),_0xf18c('0x74'));return _0x29a2ae[_0xf18c('0x75')](util['format'](_0xf18c('0x76'),_0x429bff['id'],_0x202c55));}else{return _0x29a2ae[_0xf18c('0x1d')](0xcc);}})[_0xf18c('0x4d')](handleError(_0x29a2ae,null));};exports[_0xf18c('0x77')]=function(_0x214ff2,_0x382c21,_0x3d42bd){var _0x1c893e;delete _0x214ff2[_0xf18c('0x51')]['id'];return db[_0xf18c('0x33')]['findOne']({'where':{'id':_0x214ff2[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x382c21,null))[_0xf18c('0x28')](function(_0x5d473e){if(_0x5d473e){return db[_0xf18c('0x78')][_0xf18c('0x79')](function(_0x51b696){return db[_0xf18c('0x6c')][_0xf18c('0x50')](_0x214ff2[_0xf18c('0x51')],{'transaction':_0x51b696})[_0xf18c('0x28')](function(_0x71d8f6){_0x1c893e=_0x71d8f6;return _0x5d473e[_0xf18c('0x7a')](_0x71d8f6,{'transaction':_0x51b696});})[_0xf18c('0x28')](function(){var _0x2a04a4={'type':db[_0xf18c('0x7b')][_0xf18c('0x7c')],'transaction':_0x51b696};switch(_0x214ff2['body']['type']){case'text':_0x2a04a4[_0xf18c('0x36')]=db['Sequelize'][_0xf18c('0x7c')];break;case _0xf18c('0x7d'):_0x2a04a4[_0xf18c('0x36')]=db[_0xf18c('0x7b')][_0xf18c('0x7e')];break;case _0xf18c('0x7f'):_0x2a04a4[_0xf18c('0x36')]=db[_0xf18c('0x7b')][_0xf18c('0x80')];_0x2a04a4[_0xf18c('0x81')]=![];break;default:}return db['sequelize'][_0xf18c('0x82')][_0xf18c('0x83')](_0xf18c('0x84'),util['format'](_0xf18c('0x85'),_0x1c893e['id']),_0x2a04a4);})[_0xf18c('0x28')](function(){return _0x1c893e;});});}})[_0xf18c('0x28')](respondWithResult(_0x382c21,null))['catch'](handleError(_0x382c21,null));};exports['getCustomFields']=function(_0x3834a0,_0x3f0c32,_0x2c41b0){var _0x5c5814={};var _0x30b98b={};var _0x588e03;var _0x45ebe9;return db[_0xf18c('0x33')][_0xf18c('0x86')]({'where':{'id':_0x3834a0['params']['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x3f0c32,null))[_0xf18c('0x28')](function(_0x129821){if(_0x129821){_0x588e03=_0x129821;_0x30b98b[_0xf18c('0x38')]=_['keys'](db[_0xf18c('0x6c')][_0xf18c('0x34')]);_0x30b98b[_0xf18c('0x39')]=_[_0xf18c('0x3a')](_0x3834a0[_0xf18c('0x39')]);_0x30b98b[_0xf18c('0x3b')]=_['intersection'](_0x30b98b[_0xf18c('0x38')],_0x30b98b[_0xf18c('0x39')]);_0x5c5814[_0xf18c('0x3e')]=_[_0xf18c('0x3c')](_0x30b98b[_0xf18c('0x38')],qs['fields'](_0x3834a0[_0xf18c('0x39')][_0xf18c('0x3d')]));_0x5c5814[_0xf18c('0x3e')]=_0x5c5814[_0xf18c('0x3e')][_0xf18c('0x4f')]?_0x5c5814['attributes']:_0x30b98b[_0xf18c('0x38')];_0x5c5814[_0xf18c('0x41')]=qs['sort'](_0x3834a0[_0xf18c('0x39')]['sort']);_0x5c5814['where']=qs[_0xf18c('0x3b')](_[_0xf18c('0x44')](_0x3834a0[_0xf18c('0x39')],_0x30b98b[_0xf18c('0x3b')]));_0x5c5814[_0xf18c('0x43')]=_[_0xf18c('0x46')](_0x5c5814[_0xf18c('0x43')],{'$or':[{'ListId':_0x129821['id']},{'ListId':null}]});if(_0x3834a0[_0xf18c('0x39')][_0xf18c('0x45')]){_0x5c5814['where']=_[_0xf18c('0x46')](_0x5c5814['where'],{'$or':_[_0xf18c('0x32')](_0x5c5814[_0xf18c('0x3e')],function(_0x98254d){var _0x58a4e2={};_0x58a4e2[_0x98254d]={'$like':'%'+_0x3834a0['query'][_0xf18c('0x45')]+'%'};return _0x58a4e2;})});}_0x5c5814=_[_0xf18c('0x46')]({},_0x5c5814,_0x3834a0[_0xf18c('0x48')]);return db[_0xf18c('0x6c')][_0xf18c('0x87')](_0x5c5814);}})[_0xf18c('0x28')](respondWithResult(_0x3f0c32,null))['catch'](handleError(_0x3f0c32,null));};exports[_0xf18c('0x88')]=function(_0x324c5e,_0x43b757,_0x2cd2ac){return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x324c5e[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x43b757,null))[_0xf18c('0x28')](function(_0x3d473b){if(_0x3d473b){return _0x3d473b['addAgents'](_0x324c5e[_0xf18c('0x51')][_0xf18c('0x65')],_[_0xf18c('0x64')](_0x324c5e['body'],[_0xf18c('0x65'),'id'])||{})[_0xf18c('0x89')](function(_0x3a8a0e){for(var _0x4df6b8=0x0;_0x4df6b8<_0x324c5e['body'][_0xf18c('0x65')][_0xf18c('0x4f')];_0x4df6b8+=0x1){socket[_0xf18c('0x8a')](_0xf18c('0x8b'),{'UserId':_0x324c5e['body'][_0xf18c('0x65')][_0x4df6b8],'CmListId':_0x324c5e[_0xf18c('0x4e')]['id']});}return _0x3a8a0e;});}})[_0xf18c('0x28')](respondWithResult(_0x43b757,null))[_0xf18c('0x4d')](handleError(_0x43b757,null));};exports['removeAgents']=function(_0x1062a1,_0x509e97,_0x2d8fd7){return db[_0xf18c('0x33')][_0xf18c('0x55')]({'where':{'id':_0x1062a1[_0xf18c('0x4e')]['id']}})[_0xf18c('0x28')](handleEntityNotFound(_0x509e97,null))['then'](function(_0x4eed4c){if(_0x4eed4c){return _0x4eed4c[_0xf18c('0x8c')](_0x1062a1[_0xf18c('0x39')]['ids'])[_0xf18c('0x28')](function(){if(_[_0xf18c('0x60')](_0x1062a1[_0xf18c('0x39')]['ids'])){for(var _0x96b12b=0x0;_0x96b12b<_0x1062a1['query']['ids'][_0xf18c('0x4f')];_0x96b12b+=0x1){socket[_0xf18c('0x8a')](_0xf18c('0x8d'),{'UserId':Number(_0x1062a1[_0xf18c('0x39')][_0xf18c('0x65')][_0x96b12b]),'CmListId':Number(_0x1062a1[_0xf18c('0x4e')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x1062a1[_0xf18c('0x39')][_0xf18c('0x65')]),'CmListId':Number(_0x1062a1[_0xf18c('0x4e')]['id'])});}});}})[_0xf18c('0x28')](respondWithStatusCode(_0x509e97,null))[_0xf18c('0x4d')](handleError(_0x509e97,null));};exports[_0xf18c('0x8e')]=function(_0x175d33,_0x8fd116,_0x327c1f){var _0x561c45={};var _0x3cb6b4={};var _0x28b17f;var _0x446beb;return db[_0xf18c('0x33')][_0xf18c('0x86')]({'where':{'id':_0x175d33[_0xf18c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8fd116,null))[_0xf18c('0x28')](function(_0x20762b){if(_0x20762b){_0x28b17f=_0x20762b;_0x3cb6b4[_0xf18c('0x38')]=_[_0xf18c('0x3a')](db[_0xf18c('0x8f')][_0xf18c('0x34')]);_0x3cb6b4[_0xf18c('0x39')]=_['keys'](_0x175d33[_0xf18c('0x39')]);_0x3cb6b4[_0xf18c('0x3b')]=_[_0xf18c('0x3c')](_0x3cb6b4['model'],_0x3cb6b4['query']);_0x561c45[_0xf18c('0x3e')]=_[_0xf18c('0x3c')](_0x3cb6b4[_0xf18c('0x38')],qs['fields'](_0x175d33['query']['fields']));_0x561c45[_0xf18c('0x3e')]=_0x561c45['attributes']['length']?_0x561c45[_0xf18c('0x3e')]:_0x3cb6b4[_0xf18c('0x38')];_0x561c45['order']=qs[_0xf18c('0x42')](_0x175d33['query'][_0xf18c('0x42')]);_0x561c45['where']=qs[_0xf18c('0x3b')](_[_0xf18c('0x44')](_0x175d33[_0xf18c('0x39')],_0x3cb6b4['filters']));if(_0x175d33[_0xf18c('0x39')][_0xf18c('0x45')]){_0x561c45['where']=_['merge'](_0x561c45[_0xf18c('0x43')],{'$or':_[_0xf18c('0x32')](_0x561c45[_0xf18c('0x3e')],function(_0x2c0334){var _0x131765={};_0x131765[_0x2c0334]={'$like':'%'+_0x175d33[_0xf18c('0x39')][_0xf18c('0x45')]+'%'};return _0x131765;})});}_0x561c45=_['merge']({},_0x561c45,_0x175d33['options']);return _0x28b17f[_0xf18c('0x8e')](_0x561c45);}})[_0xf18c('0x28')](function(_0x4153ff){if(_0x4153ff){_0x446beb=_0x4153ff['length'];if(!_0x175d33['query']['hasOwnProperty'](_0xf18c('0x40'))){_0x561c45[_0xf18c('0x20')]=qs[_0xf18c('0x20')](_0x175d33[_0xf18c('0x39')][_0xf18c('0x20')]);_0x561c45['offset']=qs['offset'](_0x175d33[_0xf18c('0x39')][_0xf18c('0x1f')]);}return _0x28b17f['getAgents'](_0x561c45);}})[_0xf18c('0x28')](function(_0x2af521){if(_0x2af521){return _0x2af521?{'count':_0x446beb,'rows':_0x2af521}:null;}})['then'](respondWithResult(_0x8fd116,null))[_0xf18c('0x4d')](handleError(_0x8fd116,null));}; \ No newline at end of file +var _0x2e42=['removeAgents','userCmList:remove','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Lists','UserProfileResource','then','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','findOne','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','CmCustomField','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save'];(function(_0x24d2e9,_0x2a10b9){var _0x133887=function(_0x10060a){while(--_0x10060a){_0x24d2e9['push'](_0x24d2e9['shift']());}};_0x133887(++_0x2a10b9);}(_0x2e42,0x90));var _0x22e4=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x2e42[_0x13e724];return _0x334a44;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22e4('0x2'));var moment=require(_0x22e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x22e4('0x4'));var util=require(_0x22e4('0x5'));var path=require(_0x22e4('0x6'));var sox=require('sox');var csv=require(_0x22e4('0x7'));var ejs=require(_0x22e4('0x8'));var fs=require('fs');var _=require(_0x22e4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x22e4('0xa'));var deskjs=require(_0x22e4('0xb'));var toCsv=require(_0x22e4('0x7'));var querystring=require(_0x22e4('0xc'));var Papa=require('papaparse');var Redis=require(_0x22e4('0xd'));var authService=require(_0x22e4('0xe'));var qs=require(_0x22e4('0xf'));var as=require(_0x22e4('0x10'));var hardwareService=require(_0x22e4('0x11'));var logger=require('../../config/logger')(_0x22e4('0x12'));var utils=require(_0x22e4('0x13'));var config=require(_0x22e4('0x14'));var db=require(_0x22e4('0x15'))['db'];config[_0x22e4('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x22e4('0x17'))(new Redis(config[_0x22e4('0x16')]));require(_0x22e4('0x18'))[_0x22e4('0x19')](socket);function respondWithStatusCode(_0xa17b06,_0x254e57){_0x254e57=_0x254e57||0xcc;return function(_0x489258){if(_0x489258){return _0xa17b06[_0x22e4('0x1a')](_0x254e57);}return _0xa17b06[_0x22e4('0x1b')](_0x254e57)['end']();};}function respondWithResult(_0x31ae71,_0x9f6164){_0x9f6164=_0x9f6164||0xc8;return function(_0x4390c2){if(_0x4390c2){return _0x31ae71[_0x22e4('0x1b')](_0x9f6164)[_0x22e4('0x1c')](_0x4390c2);}};}function respondWithFilteredResult(_0x59a751,_0x5e3160){return function(_0x482dc4){if(_0x482dc4){var _0x4b69dc=_0x482dc4[_0x22e4('0x1d')],_0x555d88=_0x5e3160[_0x22e4('0x1e')],_0x5ac007=_0x5e3160[_0x22e4('0x1e')]+_0x5e3160[_0x22e4('0x1f')],_0x5b794b;if(_0x5ac007>=_0x4b69dc){_0x5ac007=_0x4b69dc;_0x5b794b=0xc8;}else{_0x5b794b=0xce;}_0x59a751[_0x22e4('0x1b')](_0x5b794b);return _0x59a751['set'](_0x22e4('0x20'),_0x555d88+'-'+_0x5ac007+'/'+_0x4b69dc)['json'](_0x482dc4);}return null;};}function patchUpdates(_0x34c888){return function(_0x5a1fe9){try{jsonpatch[_0x22e4('0x21')](_0x5a1fe9,_0x34c888,!![]);}catch(_0x34fe8c){return BPromise[_0x22e4('0x22')](_0x34fe8c);}return _0x5a1fe9[_0x22e4('0x23')]();};}function saveUpdates(_0x8f66bd,_0x58611a){return function(_0x5e3abc){if(_0x5e3abc){return _0x5e3abc[_0x22e4('0x24')](_0x8f66bd)['then'](function(_0x3384cc){return _0x3384cc;});}return null;};}function removeEntity(_0x2c1378,_0x101c4a){return function(_0x2dae04){if(_0x2dae04){return _0x2dae04[_0x22e4('0x25')]()['then'](function(){var _0x491b45=_0x2dae04[_0x22e4('0x26')]({'plain':!![]});var _0x39a1a2=_0x22e4('0x27');return db[_0x22e4('0x28')][_0x22e4('0x25')]({'where':{'type':_0x39a1a2,'resourceId':_0x491b45['id']}})[_0x22e4('0x29')](function(){return _0x2dae04;});})[_0x22e4('0x29')](function(){_0x2c1378[_0x22e4('0x1b')](0xcc)[_0x22e4('0x2a')]();});}};}function handleEntityNotFound(_0x2b12c3,_0x279c41){return function(_0x5e38e5){if(!_0x5e38e5){_0x2b12c3[_0x22e4('0x1a')](0x194);}return _0x5e38e5;};}function handleError(_0x394900,_0x417c83){_0x417c83=_0x417c83||0x1f4;return function(_0x4f4662){logger[_0x22e4('0x2b')](_0x4f4662[_0x22e4('0x2c')]);if(_0x4f4662[_0x22e4('0x2d')]){delete _0x4f4662['name'];}_0x394900[_0x22e4('0x1b')](_0x417c83)[_0x22e4('0x2e')](_0x4f4662);};}exports[_0x22e4('0x2f')]=function(_0x460f85,_0x5f0d80){var _0x4458ef={},_0x221941={},_0x324c9c={'count':0x0,'rows':[]};var _0x227b55=_[_0x22e4('0x30')](db[_0x22e4('0x31')][_0x22e4('0x32')],function(_0x3e593b){return{'name':_0x3e593b[_0x22e4('0x33')],'type':_0x3e593b['type'][_0x22e4('0x34')]};});_0x221941['model']=_['map'](_0x227b55,'name');_0x221941[_0x22e4('0x35')]=_['keys'](_0x460f85[_0x22e4('0x35')]);_0x221941[_0x22e4('0x36')]=_[_0x22e4('0x37')](_0x221941[_0x22e4('0x38')],_0x221941[_0x22e4('0x35')]);_0x4458ef[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x221941[_0x22e4('0x38')],qs[_0x22e4('0x3a')](_0x460f85['query'][_0x22e4('0x3a')]));_0x4458ef[_0x22e4('0x39')]=_0x4458ef[_0x22e4('0x39')]['length']?_0x4458ef[_0x22e4('0x39')]:_0x221941['model'];if(!_0x460f85[_0x22e4('0x35')][_0x22e4('0x3b')](_0x22e4('0x3c'))){_0x4458ef['limit']=qs[_0x22e4('0x1f')](_0x460f85[_0x22e4('0x35')][_0x22e4('0x1f')]);_0x4458ef['offset']=qs[_0x22e4('0x1e')](_0x460f85[_0x22e4('0x35')]['offset']);}_0x4458ef[_0x22e4('0x3d')]=qs['sort'](_0x460f85[_0x22e4('0x35')][_0x22e4('0x3e')]);_0x4458ef[_0x22e4('0x3f')]=qs[_0x22e4('0x36')](_['pick'](_0x460f85[_0x22e4('0x35')],_0x221941['filters']),_0x227b55);if(_0x460f85[_0x22e4('0x35')][_0x22e4('0x40')]){_0x4458ef[_0x22e4('0x3f')]=_[_0x22e4('0x41')](_0x4458ef[_0x22e4('0x3f')],{'$or':_[_0x22e4('0x30')](_0x227b55,function(_0x24afeb){if(_0x24afeb[_0x22e4('0x42')]!==_0x22e4('0x43')){var _0x3bb832={};_0x3bb832[_0x24afeb['name']]={'$like':'%'+_0x460f85[_0x22e4('0x35')][_0x22e4('0x40')]+'%'};return _0x3bb832;}})});}_0x4458ef=_[_0x22e4('0x41')]({},_0x4458ef,_0x460f85[_0x22e4('0x44')]);var _0x18fe8f={'where':_0x4458ef[_0x22e4('0x3f')]};return db[_0x22e4('0x31')][_0x22e4('0x1d')](_0x18fe8f)[_0x22e4('0x29')](function(_0x41fda7){_0x324c9c[_0x22e4('0x1d')]=_0x41fda7;if(_0x460f85[_0x22e4('0x35')][_0x22e4('0x45')]){_0x4458ef[_0x22e4('0x46')]=[{'all':!![]}];}return db[_0x22e4('0x31')][_0x22e4('0x47')](_0x4458ef);})[_0x22e4('0x29')](function(_0x264f9e){_0x324c9c[_0x22e4('0x48')]=_0x264f9e;return _0x324c9c;})[_0x22e4('0x29')](respondWithFilteredResult(_0x5f0d80,_0x4458ef))[_0x22e4('0x49')](handleError(_0x5f0d80,null));};exports[_0x22e4('0x4a')]=function(_0x8d5e05,_0x509b96){var _0x280102={'raw':![],'where':{'id':_0x8d5e05[_0x22e4('0x4b')]['id']}},_0x4da63a={};_0x4da63a[_0x22e4('0x38')]=_[_0x22e4('0x4c')](db[_0x22e4('0x31')][_0x22e4('0x32')]);_0x4da63a[_0x22e4('0x35')]=_[_0x22e4('0x4c')](_0x8d5e05[_0x22e4('0x35')]);_0x4da63a[_0x22e4('0x36')]=_['intersection'](_0x4da63a[_0x22e4('0x38')],_0x4da63a[_0x22e4('0x35')]);_0x280102[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x4da63a['model'],qs[_0x22e4('0x3a')](_0x8d5e05['query'][_0x22e4('0x3a')]));_0x280102['attributes']=_0x280102[_0x22e4('0x39')][_0x22e4('0x4d')]?_0x280102[_0x22e4('0x39')]:_0x4da63a['model'];if(_0x8d5e05[_0x22e4('0x35')][_0x22e4('0x45')]){_0x280102['include']=[{'all':!![]}];}_0x280102=_[_0x22e4('0x41')]({},_0x280102,_0x8d5e05[_0x22e4('0x44')]);return db['CmList'][_0x22e4('0x4e')](_0x280102)[_0x22e4('0x29')](handleEntityNotFound(_0x509b96,null))[_0x22e4('0x29')](respondWithResult(_0x509b96,null))[_0x22e4('0x49')](handleError(_0x509b96,null));};exports['create']=function(_0x122bf0,_0x4a2e4f){return db[_0x22e4('0x31')][_0x22e4('0x4f')](_0x122bf0['body'],{})['then'](function(_0x2fb149){var _0x3d1df1=_0x122bf0[_0x22e4('0x50')][_0x22e4('0x26')]({'plain':!![]});if(!_0x3d1df1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d1df1[_0x22e4('0x51')]===_0x22e4('0x50')){var _0x327b9e=_0x2fb149[_0x22e4('0x26')]({'plain':!![]});var _0x138f8c=_0x22e4('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x138f8c,'userProfileId':_0x3d1df1['userProfileId']},'raw':!![]})[_0x22e4('0x29')](function(_0x25ccb2){if(_0x25ccb2&&_0x25ccb2['autoAssociation']===0x0){return db[_0x22e4('0x28')][_0x22e4('0x4f')]({'name':_0x327b9e[_0x22e4('0x2d')],'resourceId':_0x327b9e['id'],'type':_0x25ccb2[_0x22e4('0x2d')],'sectionId':_0x25ccb2['id']},{})[_0x22e4('0x29')](function(){return _0x2fb149;});}else{return _0x2fb149;}})[_0x22e4('0x49')](function(_0x1eed77){logger[_0x22e4('0x2b')](_0x22e4('0x52'),_0x1eed77);throw _0x1eed77;});}return _0x2fb149;})[_0x22e4('0x29')](respondWithResult(_0x4a2e4f,0xc9))['catch'](handleError(_0x4a2e4f,null));};exports[_0x22e4('0x24')]=function(_0xc1c834,_0x1433a9){if(_0xc1c834[_0x22e4('0x53')]['id']){delete _0xc1c834['body']['id'];}return db['CmList'][_0x22e4('0x4e')]({'where':{'id':_0xc1c834['params']['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x1433a9,null))[_0x22e4('0x29')](saveUpdates(_0xc1c834[_0x22e4('0x53')],null))[_0x22e4('0x29')](respondWithResult(_0x1433a9,null))[_0x22e4('0x49')](handleError(_0x1433a9,null));};exports[_0x22e4('0x25')]=function(_0xac76c5,_0x2a13d0){return db[_0x22e4('0x31')][_0x22e4('0x4e')]({'where':{'id':_0xac76c5[_0x22e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a13d0,null))[_0x22e4('0x29')](removeEntity(_0x2a13d0,null))[_0x22e4('0x49')](handleError(_0x2a13d0,null));};exports[_0x22e4('0x54')]=function(_0x41332e,_0x54bcbb){return db[_0x22e4('0x31')]['describe']()[_0x22e4('0x29')](respondWithResult(_0x54bcbb,null))[_0x22e4('0x49')](handleError(_0x54bcbb,null));};exports['addDisposition']=function(_0x3c0a9f,_0x12c345,_0x500ada){if(_0x3c0a9f[_0x22e4('0x53')]['id']){delete _0x3c0a9f[_0x22e4('0x53')]['id'];}return db[_0x22e4('0x31')][_0x22e4('0x4e')]({'where':{'id':_0x3c0a9f[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x12c345,null))[_0x22e4('0x29')](function(_0x19bc62){if(_0x19bc62){_0x3c0a9f[_0x22e4('0x53')][_0x22e4('0x55')]=_0x19bc62['id'];return db[_0x22e4('0x56')][_0x22e4('0x4f')](_0x3c0a9f[_0x22e4('0x53')]);}})[_0x22e4('0x29')](respondWithResult(_0x12c345,null))[_0x22e4('0x49')](handleError(_0x12c345,null));};exports['getDispositions']=function(_0x5272bd,_0x1528b0,_0x4decf0){var _0x114adb={'raw':![],'where':{}};var _0x5aa9d3={};var _0x1ca5da={'count':0x0,'rows':[]};return db['CmList'][_0x22e4('0x57')]({'where':{'id':_0x5272bd[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x1528b0,null))[_0x22e4('0x29')](function(_0x4a28e4){if(_0x4a28e4){_0x5aa9d3[_0x22e4('0x38')]=_[_0x22e4('0x4c')](db['Disposition']['rawAttributes']);_0x5aa9d3[_0x22e4('0x35')]=_[_0x22e4('0x4c')](_0x5272bd[_0x22e4('0x35')]);_0x5aa9d3['filters']=_[_0x22e4('0x37')](_0x5aa9d3['model'],_0x5aa9d3['query']);_0x114adb[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x5aa9d3['model'],qs[_0x22e4('0x3a')](_0x5272bd[_0x22e4('0x35')][_0x22e4('0x3a')]));_0x114adb[_0x22e4('0x39')]=_0x114adb[_0x22e4('0x39')][_0x22e4('0x4d')]?_0x114adb[_0x22e4('0x39')]:_0x5aa9d3[_0x22e4('0x38')];if(!_0x5272bd['query'][_0x22e4('0x3b')](_0x22e4('0x3c'))){_0x114adb[_0x22e4('0x1f')]=qs[_0x22e4('0x1f')](_0x5272bd[_0x22e4('0x35')][_0x22e4('0x1f')]);_0x114adb[_0x22e4('0x1e')]=qs['offset'](_0x5272bd[_0x22e4('0x35')][_0x22e4('0x1e')]);}_0x114adb['order']=qs[_0x22e4('0x3e')](_0x5272bd[_0x22e4('0x35')][_0x22e4('0x3e')]);_0x114adb[_0x22e4('0x3f')]=qs[_0x22e4('0x36')](_[_0x22e4('0x58')](_0x5272bd[_0x22e4('0x35')],_0x5aa9d3[_0x22e4('0x36')]));_0x114adb[_0x22e4('0x3f')][_0x22e4('0x55')]=_0x4a28e4['id'];if(_0x5272bd[_0x22e4('0x35')][_0x22e4('0x40')]){_0x114adb[_0x22e4('0x3f')]=_['merge'](_0x114adb[_0x22e4('0x3f')],{'$or':_[_0x22e4('0x30')](_0x114adb[_0x22e4('0x39')],function(_0x155d3f){var _0x4b1b9d={};_0x4b1b9d[_0x155d3f]={'$like':'%'+_0x5272bd['query']['filter']+'%'};return _0x4b1b9d;})});}_0x114adb=_['merge']({},_0x114adb,_0x5272bd['options']);return db['Disposition'][_0x22e4('0x1d')]({'where':_0x114adb[_0x22e4('0x3f')]})[_0x22e4('0x29')](function(_0x459be9){_0x1ca5da['count']=_0x459be9;if(_0x5272bd[_0x22e4('0x35')]['includeAll']){_0x114adb['include']=[{'all':!![]}];}return db[_0x22e4('0x56')][_0x22e4('0x47')](_0x114adb);})[_0x22e4('0x29')](function(_0x1dc6e9){_0x1ca5da[_0x22e4('0x48')]=_0x1dc6e9;return _0x1ca5da;});}})[_0x22e4('0x29')](respondWithFilteredResult(_0x1528b0,_0x114adb))[_0x22e4('0x49')](handleError(_0x1528b0,null));};exports['removeDispositions']=function(_0x2e92fe,_0xb66e80,_0x37d0c0){return db[_0x22e4('0x31')][_0x22e4('0x4e')]({'where':{'id':_0x2e92fe[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0xb66e80,null))['then'](function(_0x4bff65){if(_0x4bff65){return _0x4bff65[_0x22e4('0x59')](_0x2e92fe[_0x22e4('0x35')][_0x22e4('0x5a')]);}})[_0x22e4('0x29')](respondWithStatusCode(_0xb66e80,null))['catch'](handleError(_0xb66e80,null));};exports[_0x22e4('0x5b')]=function(_0x19f681,_0x36a66b,_0x3ddc25){return db[_0x22e4('0x31')][_0x22e4('0x4e')]({'where':{'id':_0x19f681[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x36a66b,null))[_0x22e4('0x29')](function(_0x36ffc0){if(_0x36ffc0){var _0x5aee72=[];var _0x1a1747={'success':[],'errors':[]};return db[_0x22e4('0x5c')][_0x22e4('0x54')]()[_0x22e4('0x29')](function(_0x5ca107){if(_0x19f681['body'][_0x22e4('0x5d')]&&_[_0x22e4('0x5e')](_0x19f681[_0x22e4('0x53')][_0x22e4('0x5d')])){if(_0x19f681[_0x22e4('0x53')]['tags'][_0x22e4('0x4d')]){_0x19f681[_0x22e4('0x53')][_0x22e4('0x5d')]=_0x19f681[_0x22e4('0x53')]['tags'][_0x22e4('0x5f')](';')+';';}else{_0x19f681[_0x22e4('0x53')][_0x22e4('0x5d')]=null;}}else{_0x19f681[_0x22e4('0x53')][_0x22e4('0x5d')]=null;}if(_0x19f681['body']&&_[_0x22e4('0x5e')](_0x19f681[_0x22e4('0x53')])){for(var _0x44cd1e=0x0;_0x44cd1e<_0x19f681['body'][_0x22e4('0x4d')];_0x44cd1e+=0x1){_0x19f681[_0x22e4('0x53')][_0x44cd1e][_0x22e4('0x55')]=_0x19f681['params']['id'];_0x5aee72[_0x22e4('0x60')](_0x19f681[_0x22e4('0x53')][_0x44cd1e]);}return BPromise[_0x22e4('0x61')](_0x5aee72,function(_0x297d1c){return db[_0x22e4('0x5c')][_0x22e4('0x4f')](_[_0x22e4('0x62')](_0x297d1c,[_0x22e4('0x5a'),'id'])||{},{'fields':_[_0x22e4('0x4c')](_0x5ca107),'raw':!![]})[_0x22e4('0x29')](function(_0x18bdba){_0x1a1747['success'][_0x22e4('0x60')](_0x18bdba['dataValues']);})[_0x22e4('0x49')](function(_0x3fc81a){_0x1a1747['errors'][_0x22e4('0x60')]({'data':_0x297d1c,'error':_0x3fc81a[_0x22e4('0x63')]});});})[_0x22e4('0x29')](function(_0x5c1567){return _0x1a1747;})['catch'](function(_0x1d83ba){return _0x1d83ba;});}else{_0x36a66b[_0x22e4('0x1b')](0x190)[_0x22e4('0x1c')]({'message':_0x22e4('0x64')});}});}})['then'](respondWithResult(_0x36a66b,null))[_0x22e4('0x49')](handleError(_0x36a66b,null));};exports[_0x22e4('0x65')]=function(_0x34a9d6,_0xddead8,_0x3a8dc0){var _0x3ea728;return db['CmList'][_0x22e4('0x4e')]({'where':{'id':_0x34a9d6[_0x22e4('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x22e4('0x66')}]})[_0x22e4('0x29')](handleEntityNotFound(_0xddead8,null))[_0x22e4('0x29')](function(_0x3cc4e5){if(_0x3cc4e5){_0x3ea728=_0x3cc4e5;return db['CmContact'][_0x22e4('0x32')];}})[_0x22e4('0x29')](function(_0x3a0155){if(_0x3a0155){var _0x1c477f={};var _0x47d9da={};_0x47d9da['model']=_[_0x22e4('0x67')](_[_0x22e4('0x4c')](_0x3a0155),_[_0x22e4('0x30')](_0x3ea728[_0x22e4('0x66')],function(_0x52012f){return util[_0x22e4('0x68')](_0x22e4('0x69'),_0x52012f['id']);}));_0x47d9da[_0x22e4('0x35')]=_[_0x22e4('0x4c')](_0x34a9d6[_0x22e4('0x35')]);_0x47d9da[_0x22e4('0x36')]=_['intersection'](_0x47d9da[_0x22e4('0x38')],_0x47d9da['query']);_0x1c477f[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x47d9da[_0x22e4('0x38')],qs[_0x22e4('0x3a')](_0x34a9d6['query'][_0x22e4('0x3a')]));_0x1c477f['attributes']=_0x1c477f[_0x22e4('0x39')][_0x22e4('0x4d')]?_0x1c477f[_0x22e4('0x39')]:_0x47d9da[_0x22e4('0x38')];if(!_0x34a9d6[_0x22e4('0x35')]['hasOwnProperty'](_0x22e4('0x3c'))){_0x1c477f['limit']=qs[_0x22e4('0x1f')](_0x34a9d6[_0x22e4('0x35')]['limit']);_0x1c477f[_0x22e4('0x1e')]=qs[_0x22e4('0x1e')](_0x34a9d6['query']['offset']);}_0x1c477f['order']=qs[_0x22e4('0x3e')](_0x34a9d6[_0x22e4('0x35')]['sort']);_0x1c477f[_0x22e4('0x3f')]=qs['filters'](_[_0x22e4('0x58')](_0x34a9d6['query'],_0x47d9da[_0x22e4('0x36')]));_0x1c477f[_0x22e4('0x6a')]=!![];if(_0x34a9d6[_0x22e4('0x35')]['filter']){_0x1c477f[_0x22e4('0x3f')]=_[_0x22e4('0x41')](_0x1c477f['where'],{'$or':_[_0x22e4('0x30')](_0x1c477f['attributes'],function(_0x4120c8){var _0x270920={};_0x270920[_0x4120c8]={'$like':'%'+_0x34a9d6[_0x22e4('0x35')]['filter']+'%'};return _0x270920;})});}_0x1c477f=_[_0x22e4('0x41')]({},_0x1c477f,_0x34a9d6[_0x22e4('0x44')]);return _0x3ea728[_0x22e4('0x65')](_0x1c477f);}})[_0x22e4('0x29')](respondWithResult(_0xddead8,null))['catch'](handleError(_0xddead8,null));};exports[_0x22e4('0x6b')]=function(_0x5b5f01,_0x14573f,_0x1b5f41){var _0x8cf963;return db[_0x22e4('0x31')]['find']({'where':{'id':_0x5b5f01[_0x22e4('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x22e4('0x66')}]})[_0x22e4('0x29')](handleEntityNotFound(_0x14573f,null))['then'](function(_0x2aa48a){if(_0x2aa48a){_0x8cf963=_0x2aa48a;return db['CmContact'][_0x22e4('0x32')];}})[_0x22e4('0x29')](function(_0x1cbf14){if(_0x1cbf14){var _0x233dfc={};var _0x285b58={};_0x285b58[_0x22e4('0x38')]=_['concat'](_[_0x22e4('0x4c')](_0x1cbf14),_[_0x22e4('0x30')](_0x8cf963[_0x22e4('0x66')],function(_0x7088ea){return util[_0x22e4('0x68')](_0x22e4('0x69'),_0x7088ea['id']);}));_0x285b58['query']=_[_0x22e4('0x4c')](_0x5b5f01['query']);_0x285b58[_0x22e4('0x36')]=_[_0x22e4('0x37')](_0x285b58['model'],_0x285b58[_0x22e4('0x35')]);_0x233dfc[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x285b58[_0x22e4('0x38')],qs[_0x22e4('0x3a')](_0x5b5f01[_0x22e4('0x35')][_0x22e4('0x3a')]));_0x233dfc[_0x22e4('0x39')]=_0x233dfc[_0x22e4('0x39')][_0x22e4('0x4d')]?_0x233dfc['attributes']:_0x285b58[_0x22e4('0x38')];if(!_0x5b5f01['query'][_0x22e4('0x3b')](_0x22e4('0x3c'))){_0x233dfc[_0x22e4('0x1f')]=qs[_0x22e4('0x1f')](_0x5b5f01['query'][_0x22e4('0x1f')]);_0x233dfc[_0x22e4('0x1e')]=qs['offset'](_0x5b5f01[_0x22e4('0x35')][_0x22e4('0x1e')]);}_0x233dfc[_0x22e4('0x3d')]=qs['sort'](_0x5b5f01[_0x22e4('0x35')][_0x22e4('0x3e')]);_0x233dfc['where']=qs[_0x22e4('0x36')](_[_0x22e4('0x58')](_0x5b5f01['query'],_0x285b58[_0x22e4('0x36')]));_0x233dfc[_0x22e4('0x6a')]=!![];if(_0x5b5f01[_0x22e4('0x35')][_0x22e4('0x40')]){_0x233dfc[_0x22e4('0x3f')]=_[_0x22e4('0x41')](_0x233dfc['where'],{'$or':_[_0x22e4('0x30')](_0x233dfc[_0x22e4('0x39')],function(_0x37c244){var _0x4f3a6f={};_0x4f3a6f[_0x37c244]={'$like':'%'+_0x5b5f01[_0x22e4('0x35')]['filter']+'%'};return _0x4f3a6f;})});}_0x233dfc=_['merge']({},_0x233dfc,_0x5b5f01[_0x22e4('0x44')]);return _0x8cf963[_0x22e4('0x65')](_0x233dfc);}})[_0x22e4('0x29')](function(_0x3aca46){if(!_['isEmpty'](_0x3aca46)){var _0x44d7ce=toCsv(_0x3aca46);var _0x2a175b=Date[_0x22e4('0x6c')]();fs[_0x22e4('0x6d')](util[_0x22e4('0x68')](_0x22e4('0x6e'),_0x8cf963['id'],_0x2a175b),_0x44d7ce);_0x14573f[_0x22e4('0x6f')]('Content-disposition','attachment;\x20filename='+util[_0x22e4('0x68')](_0x22e4('0x70'),_0x8cf963['id'],_0x2a175b));_0x14573f[_0x22e4('0x6f')](_0x22e4('0x71'),_0x22e4('0x72'));return _0x14573f[_0x22e4('0x73')](util[_0x22e4('0x68')]('/tmp/list_%d_%s.csv',_0x8cf963['id'],_0x2a175b));}else{return _0x14573f[_0x22e4('0x1a')](0xcc);}})['catch'](handleError(_0x14573f,null));};exports[_0x22e4('0x74')]=function(_0x486ee2,_0x499e80,_0x59169){var _0x156d08;delete _0x486ee2['body']['id'];return db[_0x22e4('0x31')][_0x22e4('0x57')]({'where':{'id':_0x486ee2[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x499e80,null))[_0x22e4('0x29')](function(_0x588ed6){if(_0x588ed6){return db[_0x22e4('0x75')][_0x22e4('0x76')](function(_0x434be8){return db[_0x22e4('0x77')][_0x22e4('0x4f')](_0x486ee2['body'],{'transaction':_0x434be8})[_0x22e4('0x29')](function(_0x386694){_0x156d08=_0x386694;return _0x588ed6['addCustomFields'](_0x386694,{'transaction':_0x434be8});})['then'](function(){var _0x48575f={'type':db[_0x22e4('0x78')][_0x22e4('0x79')],'transaction':_0x434be8};switch(_0x486ee2[_0x22e4('0x53')][_0x22e4('0x42')]){case _0x22e4('0x7a'):_0x48575f[_0x22e4('0x42')]=db[_0x22e4('0x78')][_0x22e4('0x79')];break;case _0x22e4('0x7b'):_0x48575f[_0x22e4('0x42')]=db[_0x22e4('0x78')][_0x22e4('0x7c')];break;case _0x22e4('0x7d'):_0x48575f[_0x22e4('0x42')]=db[_0x22e4('0x78')][_0x22e4('0x7e')];_0x48575f[_0x22e4('0x7f')]=![];break;default:}return db[_0x22e4('0x75')][_0x22e4('0x80')][_0x22e4('0x81')](_0x22e4('0x82'),util[_0x22e4('0x68')](_0x22e4('0x83'),_0x156d08['id']),_0x48575f);})['then'](function(){return _0x156d08;});});}})[_0x22e4('0x29')](respondWithResult(_0x499e80,null))[_0x22e4('0x49')](handleError(_0x499e80,null));};exports[_0x22e4('0x84')]=function(_0x4d04b4,_0x295cd5,_0x4b9ac0){var _0xd9aee7={};var _0x58418c={};var _0x11f0dc;var _0x53e941;return db[_0x22e4('0x31')][_0x22e4('0x57')]({'where':{'id':_0x4d04b4[_0x22e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x295cd5,null))[_0x22e4('0x29')](function(_0x557b50){if(_0x557b50){_0x11f0dc=_0x557b50;_0x58418c[_0x22e4('0x38')]=_[_0x22e4('0x4c')](db[_0x22e4('0x77')][_0x22e4('0x32')]);_0x58418c[_0x22e4('0x35')]=_['keys'](_0x4d04b4[_0x22e4('0x35')]);_0x58418c['filters']=_['intersection'](_0x58418c[_0x22e4('0x38')],_0x58418c['query']);_0xd9aee7[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x58418c[_0x22e4('0x38')],qs['fields'](_0x4d04b4[_0x22e4('0x35')]['fields']));_0xd9aee7['attributes']=_0xd9aee7[_0x22e4('0x39')][_0x22e4('0x4d')]?_0xd9aee7[_0x22e4('0x39')]:_0x58418c[_0x22e4('0x38')];_0xd9aee7[_0x22e4('0x3d')]=qs['sort'](_0x4d04b4[_0x22e4('0x35')][_0x22e4('0x3e')]);_0xd9aee7[_0x22e4('0x3f')]=qs[_0x22e4('0x36')](_['pick'](_0x4d04b4[_0x22e4('0x35')],_0x58418c['filters']));_0xd9aee7[_0x22e4('0x3f')]=_['merge'](_0xd9aee7[_0x22e4('0x3f')],{'$or':[{'ListId':_0x557b50['id']},{'ListId':null}]});if(_0x4d04b4[_0x22e4('0x35')][_0x22e4('0x40')]){_0xd9aee7[_0x22e4('0x3f')]=_[_0x22e4('0x41')](_0xd9aee7['where'],{'$or':_[_0x22e4('0x30')](_0xd9aee7[_0x22e4('0x39')],function(_0x1dc030){var _0x1f15e9={};_0x1f15e9[_0x1dc030]={'$like':'%'+_0x4d04b4['query'][_0x22e4('0x40')]+'%'};return _0x1f15e9;})});}_0xd9aee7=_[_0x22e4('0x41')]({},_0xd9aee7,_0x4d04b4[_0x22e4('0x44')]);return db[_0x22e4('0x77')][_0x22e4('0x85')](_0xd9aee7);}})[_0x22e4('0x29')](respondWithResult(_0x295cd5,null))[_0x22e4('0x49')](handleError(_0x295cd5,null));};exports['addAgents']=function(_0x552fe7,_0x4f6e2b,_0x24a236){return db[_0x22e4('0x31')]['find']({'where':{'id':_0x552fe7[_0x22e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f6e2b,null))[_0x22e4('0x29')](function(_0x676612){if(_0x676612){return _0x676612[_0x22e4('0x86')](_0x552fe7[_0x22e4('0x53')]['ids'],_[_0x22e4('0x62')](_0x552fe7[_0x22e4('0x53')],[_0x22e4('0x5a'),'id'])||{})[_0x22e4('0x87')](function(_0x2c689e){for(var _0x275538=0x0;_0x275538<_0x552fe7['body'][_0x22e4('0x5a')][_0x22e4('0x4d')];_0x275538+=0x1){socket[_0x22e4('0x88')](_0x22e4('0x89'),{'UserId':_0x552fe7[_0x22e4('0x53')][_0x22e4('0x5a')][_0x275538],'CmListId':_0x552fe7['params']['id']});}return _0x2c689e;});}})[_0x22e4('0x29')](respondWithResult(_0x4f6e2b,null))['catch'](handleError(_0x4f6e2b,null));};exports[_0x22e4('0x8a')]=function(_0x399973,_0x3d2e05,_0x202e5d){return db['CmList']['find']({'where':{'id':_0x399973['params']['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x3d2e05,null))[_0x22e4('0x29')](function(_0xe16855){if(_0xe16855){return _0xe16855['removeAgents'](_0x399973[_0x22e4('0x35')][_0x22e4('0x5a')])[_0x22e4('0x29')](function(){if(_[_0x22e4('0x5e')](_0x399973[_0x22e4('0x35')][_0x22e4('0x5a')])){for(var _0x43703b=0x0;_0x43703b<_0x399973[_0x22e4('0x35')]['ids'][_0x22e4('0x4d')];_0x43703b+=0x1){socket[_0x22e4('0x88')](_0x22e4('0x8b'),{'UserId':Number(_0x399973[_0x22e4('0x35')]['ids'][_0x43703b]),'CmListId':Number(_0x399973[_0x22e4('0x4b')]['id'])});}}else{socket['emit'](_0x22e4('0x8b'),{'UserId':Number(_0x399973['query'][_0x22e4('0x5a')]),'CmListId':Number(_0x399973['params']['id'])});}});}})[_0x22e4('0x29')](respondWithStatusCode(_0x3d2e05,null))[_0x22e4('0x49')](handleError(_0x3d2e05,null));};exports[_0x22e4('0x8c')]=function(_0x4761c7,_0x1d3266,_0x4953cc){var _0x30ff97={};var _0x1c36c9={};var _0x2aea66;var _0x4d21e5;return db['CmList'][_0x22e4('0x57')]({'where':{'id':_0x4761c7[_0x22e4('0x4b')]['id']}})[_0x22e4('0x29')](handleEntityNotFound(_0x1d3266,null))['then'](function(_0x2def58){if(_0x2def58){_0x2aea66=_0x2def58;_0x1c36c9[_0x22e4('0x38')]=_[_0x22e4('0x4c')](db['User'][_0x22e4('0x32')]);_0x1c36c9[_0x22e4('0x35')]=_[_0x22e4('0x4c')](_0x4761c7[_0x22e4('0x35')]);_0x1c36c9[_0x22e4('0x36')]=_['intersection'](_0x1c36c9[_0x22e4('0x38')],_0x1c36c9[_0x22e4('0x35')]);_0x30ff97[_0x22e4('0x39')]=_[_0x22e4('0x37')](_0x1c36c9[_0x22e4('0x38')],qs[_0x22e4('0x3a')](_0x4761c7['query']['fields']));_0x30ff97[_0x22e4('0x39')]=_0x30ff97[_0x22e4('0x39')][_0x22e4('0x4d')]?_0x30ff97[_0x22e4('0x39')]:_0x1c36c9[_0x22e4('0x38')];_0x30ff97['order']=qs[_0x22e4('0x3e')](_0x4761c7['query'][_0x22e4('0x3e')]);_0x30ff97[_0x22e4('0x3f')]=qs['filters'](_[_0x22e4('0x58')](_0x4761c7['query'],_0x1c36c9['filters']));if(_0x4761c7[_0x22e4('0x35')][_0x22e4('0x40')]){_0x30ff97[_0x22e4('0x3f')]=_['merge'](_0x30ff97[_0x22e4('0x3f')],{'$or':_[_0x22e4('0x30')](_0x30ff97[_0x22e4('0x39')],function(_0x290a04){var _0x79cc1b={};_0x79cc1b[_0x290a04]={'$like':'%'+_0x4761c7[_0x22e4('0x35')][_0x22e4('0x40')]+'%'};return _0x79cc1b;})});}_0x30ff97=_[_0x22e4('0x41')]({},_0x30ff97,_0x4761c7[_0x22e4('0x44')]);return _0x2aea66[_0x22e4('0x8c')](_0x30ff97);}})[_0x22e4('0x29')](function(_0x4d3a47){if(_0x4d3a47){_0x4d21e5=_0x4d3a47[_0x22e4('0x4d')];if(!_0x4761c7[_0x22e4('0x35')][_0x22e4('0x3b')](_0x22e4('0x3c'))){_0x30ff97[_0x22e4('0x1f')]=qs[_0x22e4('0x1f')](_0x4761c7[_0x22e4('0x35')]['limit']);_0x30ff97[_0x22e4('0x1e')]=qs[_0x22e4('0x1e')](_0x4761c7[_0x22e4('0x35')][_0x22e4('0x1e')]);}return _0x2aea66['getAgents'](_0x30ff97);}})['then'](function(_0x1f0ae2){if(_0x1f0ae2){return _0x1f0ae2?{'count':_0x4d21e5,'rows':_0x1f0ae2}:null;}})[_0x22e4('0x29')](respondWithResult(_0x1d3266,null))[_0x22e4('0x49')](handleError(_0x1d3266,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index afcdec0..b322ac2 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 _0x0c16=['save','remove','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x0c16,0x17d));var _0x60c1=function(_0x1b57b2,_0x2a5d29){_0x1b57b2=_0x1b57b2-0x0;var _0x344553=_0x0c16[_0x1b57b2];return _0x344553;};'use strict';var EventEmitter=require(_0x60c1('0x0'));var CmList=require(_0x60c1('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x60c1('0x2')](0x0);var events={'afterCreate':_0x60c1('0x3'),'afterUpdate':'update','afterDestroy':_0x60c1('0x4')};function emitEvent(_0x12eb98){return function(_0x109cbd,_0x7bb682,_0x1ad217){CmListEvents['emit'](_0x12eb98+':'+_0x109cbd['id'],_0x109cbd);CmListEvents['emit'](_0x12eb98,_0x109cbd);_0x1ad217(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x60c1('0x5')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x1527=['../../mysqldb','CmList','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4e448b,_0x10dee3){var _0x13638d=function(_0x812d6a){while(--_0x812d6a){_0x4e448b['push'](_0x4e448b['shift']());}};_0x13638d(++_0x10dee3);}(_0x1527,0xbc));var _0x7152=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x1527[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require(_0x7152('0x0'));var CmList=require(_0x7152('0x1'))['db'][_0x7152('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7152('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7152('0x4'),'afterDestroy':_0x7152('0x5')};function emitEvent(_0x29fc70){return function(_0x37b4cd,_0x4720d2,_0x2dcada){CmListEvents[_0x7152('0x6')](_0x29fc70+':'+_0x37b4cd['id'],_0x37b4cd);CmListEvents['emit'](_0x29fc70,_0x37b4cd);_0x2dcada(null);};}for(var e in events){if(events[_0x7152('0x7')](e)){var event=events[e];CmList[_0x7152('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e4956c5..74836ce 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 _0xb209=['cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cmList.attributes','exports','define','CmList'];(function(_0x412945,_0xc93eeb){var _0x3b4f8c=function(_0x216b48){while(--_0x216b48){_0x412945['push'](_0x412945['shift']());}};_0x3b4f8c(++_0xc93eeb);}(_0xb209,0x76));var _0x9b20=function(_0xfdbc0,_0x3d360d){_0xfdbc0=_0xfdbc0-0x0;var _0x2e8d80=_0xb209[_0xfdbc0];return _0x2e8d80;};'use strict';var _=require(_0x9b20('0x0'));var util=require(_0x9b20('0x1'));var logger=require(_0x9b20('0x2'))(_0x9b20('0x3'));var moment=require(_0x9b20('0x4'));var BPromise=require(_0x9b20('0x5'));var rp=require(_0x9b20('0x6'));var fs=require('fs');var path=require(_0x9b20('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9b20('0x8'));module[_0x9b20('0x9')]=function(_0xd8ac6e,_0xd81586){return _0xd8ac6e[_0x9b20('0xa')](_0x9b20('0xb'),attributes,{'tableName':_0x9b20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd892=['exports','define','cm_lists','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x22b9b7,_0x203492){var _0xbd7673=function(_0x25fc63){while(--_0x25fc63){_0x22b9b7['push'](_0x22b9b7['shift']());}};_0xbd7673(++_0x203492);}(_0xd892,0x158));var _0x2d89=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd892[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x2d89('0x0'));var util=require('util');var logger=require(_0x2d89('0x1'))(_0x2d89('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d89('0x3'));var fs=require('fs');var path=require(_0x2d89('0x4'));var rimraf=require(_0x2d89('0x5'));var config=require(_0x2d89('0x6'));var attributes=require(_0x2d89('0x7'));module[_0x2d89('0x8')]=function(_0xa29e05,_0x18ccc2){return _0xa29e05[_0x2d89('0x9')]('CmList',attributes,{'tableName':_0x2d89('0xa'),'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 ef406b1..27b1c13 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 _0xfa5e=['http','redis','defaults','register','request','then','info','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0xfa5e,0x15f));var _0xefa5=function(_0x28cc2b,_0x26d2e7){_0x28cc2b=_0x28cc2b-0x0;var _0x4dce8a=_0xfa5e[_0x28cc2b];return _0x4dce8a;};'use strict';var _=require(_0xefa5('0x0'));var util=require(_0xefa5('0x1'));var moment=require('moment');var BPromise=require(_0xefa5('0x2'));var rs=require(_0xefa5('0x3'));var fs=require('fs');var Redis=require(_0xefa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xefa5('0x5'));var logger=require(_0xefa5('0x6'))('rpc');var config=require(_0xefa5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xefa5('0x8')][_0xefa5('0x9')]({'port':0x232a});config[_0xefa5('0xa')]=_[_0xefa5('0xb')](config[_0xefa5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0xefa5('0xc')](socket);function respondWithRpcPromise(_0x407c7d,_0xf18f01,_0x4fc8c4){return new BPromise(function(_0x23b1d7,_0x4ebd4a){return client[_0xefa5('0xd')](_0x407c7d,_0x4fc8c4)[_0xefa5('0xe')](function(_0x55948f){logger[_0xefa5('0xf')]('CmList,\x20%s,\x20%s',_0xf18f01,_0xefa5('0x10'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xf18f01,'request\x20sent',JSON[_0xefa5('0x11')](_0x55948f));if(_0x55948f[_0xefa5('0x12')]){if(_0x55948f[_0xefa5('0x12')][_0xefa5('0x13')]===0x1f4){logger[_0xefa5('0x12')]('CmList,\x20%s,\x20%s',_0xf18f01,_0x55948f['error']['message']);return _0x4ebd4a(_0x55948f[_0xefa5('0x12')][_0xefa5('0x14')]);}logger[_0xefa5('0x12')]('CmList,\x20%s,\x20%s',_0xf18f01,_0x55948f['error'][_0xefa5('0x14')]);return _0x23b1d7(_0x55948f[_0xefa5('0x12')]['message']);}else{logger['info'](_0xefa5('0x15'),_0xf18f01,_0xefa5('0x10'));_0x23b1d7(_0x55948f[_0xefa5('0x16')][_0xefa5('0x14')]);}})[_0xefa5('0x17')](function(_0x5687ca){logger[_0xefa5('0x12')](_0xefa5('0x15'),_0xf18f01,_0x5687ca);_0x4ebd4a(_0x5687ca);});});} \ No newline at end of file +var _0x3d04=['message','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','CmList,\x20%s,\x20%s'];(function(_0x22a91c,_0x5ce13f){var _0x733c2f=function(_0x1ef119){while(--_0x1ef119){_0x22a91c['push'](_0x22a91c['shift']());}};_0x733c2f(++_0x5ce13f);}(_0x3d04,0x100));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x43d0('0x0'));var moment=require(_0x43d0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43d0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x43d0('0x3'));var logger=require(_0x43d0('0x4'))(_0x43d0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x43d0('0x6')][_0x43d0('0x7')]({'port':0x232a});config[_0x43d0('0x8')]=_[_0x43d0('0x9')](config[_0x43d0('0x8')],{'host':_0x43d0('0xa'),'port':0x18eb});var socket=require(_0x43d0('0xb'))(new Redis(config['redis']));require('./cmList.socket')[_0x43d0('0xc')](socket);function respondWithRpcPromise(_0x1b0e23,_0x99a5c3,_0x250275){return new BPromise(function(_0x2a5647,_0x12c2c6){return client[_0x43d0('0xd')](_0x1b0e23,_0x250275)[_0x43d0('0xe')](function(_0x2e9620){logger[_0x43d0('0xf')]('CmList,\x20%s,\x20%s',_0x99a5c3,_0x43d0('0x10'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x99a5c3,_0x43d0('0x10'),JSON[_0x43d0('0x11')](_0x2e9620));if(_0x2e9620[_0x43d0('0x12')]){if(_0x2e9620[_0x43d0('0x12')]['code']===0x1f4){logger[_0x43d0('0x12')]('CmList,\x20%s,\x20%s',_0x99a5c3,_0x2e9620['error']['message']);return _0x12c2c6(_0x2e9620[_0x43d0('0x12')]['message']);}logger[_0x43d0('0x12')](_0x43d0('0x13'),_0x99a5c3,_0x2e9620[_0x43d0('0x12')][_0x43d0('0x14')]);return _0x2a5647(_0x2e9620[_0x43d0('0x12')]['message']);}else{logger[_0x43d0('0xf')]('CmList,\x20%s,\x20%s',_0x99a5c3,'request\x20sent');_0x2a5647(_0x2e9620[_0x43d0('0x15')][_0x43d0('0x14')]);}})[_0x43d0('0x16')](function(_0x19ae36){logger['error'](_0x43d0('0x13'),_0x99a5c3,_0x19ae36);_0x12c2c6(_0x19ae36);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6c848c6..e95aa88 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 _0xc3a8=['cmList:','./cmList.events','save','remove','emit','register','length'];(function(_0x407295,_0x23b866){var _0x4adf24=function(_0x39dabf){while(--_0x39dabf){_0x407295['push'](_0x407295['shift']());}};_0x4adf24(++_0x23b866);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0xc3a8[_0x21c6b8];return _0x39d474;};'use strict';var CmListEvents=require(_0x8c3a('0x0'));var events=[_0x8c3a('0x1'),_0x8c3a('0x2'),'update'];function createListener(_0x1790e6,_0x5b6a76){return function(_0x3142c7){_0x5b6a76[_0x8c3a('0x3')](_0x1790e6,_0x3142c7);};}function removeListener(_0x3585d1,_0x1d993b){return function(){CmListEvents['removeListener'](_0x3585d1,_0x1d993b);};}exports[_0x8c3a('0x4')]=function(_0x2477f9){for(var _0x18a92a=0x0,_0x170999=events[_0x8c3a('0x5')];_0x18a92a<_0x170999;_0x18a92a++){var _0x37047e=events[_0x18a92a];var _0x58a9b0=createListener(_0x8c3a('0x6')+_0x37047e,_0x2477f9);CmListEvents['on'](_0x37047e,_0x58a9b0);}}; \ No newline at end of file +var _0x5b5a=['removeListener','register','cmList:','save','remove','emit'];(function(_0x472a7c,_0x2afa0b){var _0x5cb86a=function(_0x14946d){while(--_0x14946d){_0x472a7c['push'](_0x472a7c['shift']());}};_0x5cb86a(++_0x2afa0b);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x17cdcc,_0x29d5de){_0x17cdcc=_0x17cdcc-0x0;var _0x38f5f6=_0x5b5a[_0x17cdcc];return _0x38f5f6;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xa5b5('0x0'),_0xa5b5('0x1'),'update'];function createListener(_0x454eee,_0x2e4253){return function(_0x2c7e95){_0x2e4253[_0xa5b5('0x2')](_0x454eee,_0x2c7e95);};}function removeListener(_0x1c76ae,_0x45f433){return function(){CmListEvents[_0xa5b5('0x3')](_0x1c76ae,_0x45f433);};}exports[_0xa5b5('0x4')]=function(_0x509b78){for(var _0x33678e=0x0,_0x29c137=events['length'];_0x33678e<_0x29c137;_0x33678e++){var _0x32a09a=events[_0x33678e];var _0x1936d6=createListener(_0xa5b5('0x5')+_0x32a09a,_0x509b78);CmListEvents['on'](_0x32a09a,_0x1936d6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9155d35..ea12a49 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 _0xe730=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','post','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x2ecb9a,_0x9c37bd){var _0x22f268=function(_0x54056c){while(--_0x54056c){_0x2ecb9a['push'](_0x2ecb9a['shift']());}};_0x22f268(++_0x9c37bd);}(_0xe730,0xb5));var _0x0e73=function(_0x456cf7,_0x1ef5d2){_0x456cf7=_0x456cf7-0x0;var _0x2b2e8c=_0xe730[_0x456cf7];return _0x2b2e8c;};'use strict';var multer=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var path=require(_0x0e73('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0e73('0x3'));var interaction=require(_0x0e73('0x4'));var config=require(_0x0e73('0x5'));var controller=require(_0x0e73('0x6'));router[_0x0e73('0x7')]('/',auth[_0x0e73('0x8')](),controller[_0x0e73('0x9')]);router[_0x0e73('0x7')](_0x0e73('0xa'),auth[_0x0e73('0x8')](),controller[_0x0e73('0xb')]);router['get'](_0x0e73('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0e73('0xd'),auth[_0x0e73('0x8')](),controller[_0x0e73('0xe')]);router[_0x0e73('0x7')](_0x0e73('0xf'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x10')]);router[_0x0e73('0x7')]('/:id/contacts/csv',auth[_0x0e73('0x8')](),controller[_0x0e73('0x11')]);router['get'](_0x0e73('0x12'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x13')]);router[_0x0e73('0x7')](_0x0e73('0x14'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x15')]);router['post']('/',auth[_0x0e73('0x8')](),controller[_0x0e73('0x16')]);router['post'](_0x0e73('0xd'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x17')]);router[_0x0e73('0x18')](_0x0e73('0xf'),auth[_0x0e73('0x8')](),controller['addContacts']);router[_0x0e73('0x18')](_0x0e73('0x12'),auth[_0x0e73('0x8')](),controller['addCustomField']);router[_0x0e73('0x18')](_0x0e73('0x14'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x19')]);router[_0x0e73('0x1a')](_0x0e73('0xc'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x1b')]);router[_0x0e73('0x1c')](_0x0e73('0xc'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x1d')]);router[_0x0e73('0x1c')]('/:id/dispositions',auth[_0x0e73('0x8')](),controller[_0x0e73('0x1e')]);router[_0x0e73('0x1c')](_0x0e73('0x14'),auth[_0x0e73('0x8')](),controller[_0x0e73('0x1f')]);module[_0x0e73('0x20')]=router; \ No newline at end of file +var _0xbaab=['addAgents','put','/:id','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users'];(function(_0x107dc1,_0x4a5e58){var _0x16e154=function(_0x58fa20){while(--_0x58fa20){_0x107dc1['push'](_0x107dc1['shift']());}};_0x16e154(++_0x4a5e58);}(_0xbaab,0x1b8));var _0xbbaa=function(_0x9bd1ef,_0x1e951c){_0x9bd1ef=_0x9bd1ef-0x0;var _0x317562=_0xbaab[_0x9bd1ef];return _0x317562;};'use strict';var multer=require(_0xbbaa('0x0'));var util=require(_0xbbaa('0x1'));var path=require(_0xbbaa('0x2'));var timeout=require(_0xbbaa('0x3'));var express=require(_0xbbaa('0x4'));var router=express[_0xbbaa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbaa('0x6'));var config=require(_0xbbaa('0x7'));var controller=require(_0xbbaa('0x8'));router[_0xbbaa('0x9')]('/',auth[_0xbbaa('0xa')](),controller[_0xbbaa('0xb')]);router[_0xbbaa('0x9')](_0xbbaa('0xc'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0xd')]);router['get']('/:id',auth[_0xbbaa('0xa')](),controller[_0xbbaa('0xe')]);router[_0xbbaa('0x9')](_0xbbaa('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/contacts',auth[_0xbbaa('0xa')](),controller['getContacts']);router[_0xbbaa('0x9')](_0xbbaa('0x10'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x11')]);router[_0xbbaa('0x9')](_0xbbaa('0x12'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x13')]);router['get']('/:id/users',auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x14')]);router[_0xbbaa('0x15')]('/',auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x16')]);router[_0xbbaa('0x15')](_0xbbaa('0xf'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x17')]);router['post'](_0xbbaa('0x18'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x19')]);router[_0xbbaa('0x15')](_0xbbaa('0x12'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x1a')]);router['post'](_0xbbaa('0x1b'),auth['isAuthenticated'](),controller[_0xbbaa('0x1c')]);router[_0xbbaa('0x1d')](_0xbbaa('0x1e'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x1f')]);router[_0xbbaa('0x20')](_0xbbaa('0x1e'),auth[_0xbbaa('0xa')](),controller[_0xbbaa('0x21')]);router[_0xbbaa('0x20')](_0xbbaa('0xf'),auth['isAuthenticated'](),controller[_0xbbaa('0x22')]);router[_0xbbaa('0x20')](_0xbbaa('0x1b'),auth[_0xbbaa('0xa')](),controller['removeAgents']);module[_0xbbaa('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9314a0c..bae410a 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x5dc83f,_0x33c350){var _0x19bc23=function(_0x3f1f26){while(--_0x3f1f26){_0x5dc83f['push'](_0x5dc83f['shift']());}};_0x19bc23(++_0x33c350);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xdc21c5,_0x5d2931){var _0x5d0da5=function(_0x1b6d28){while(--_0x1b6d28){_0xdc21c5['push'](_0xdc21c5['shift']());}};_0x5d0da5(++_0x5d2931);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 397d743..551eb63 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 _0x5b0d=['sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','body','Condition','find','params','catch','eml-format','zip-dir','bluebird','util','path'];(function(_0x2ac9bc,_0x115deb){var _0x19b9f7=function(_0x2a73e5){while(--_0x2a73e5){_0x2ac9bc['push'](_0x2ac9bc['shift']());}};_0x19b9f7(++_0x115deb);}(_0x5b0d,0x153));var _0xd5b0=function(_0x14f3ca,_0x2107ad){_0x14f3ca=_0x14f3ca-0x0;var _0x45ed70=_0x5b0d[_0x14f3ca];return _0x45ed70;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd5b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5b0('0x2'));var Mustache=require('mustache');var util=require(_0xd5b0('0x3'));var path=require(_0xd5b0('0x4'));var sox=require(_0xd5b0('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5b0('0x6'));var squel=require(_0xd5b0('0x7'));var crypto=require(_0xd5b0('0x8'));var jsforce=require(_0xd5b0('0x9'));var deskjs=require(_0xd5b0('0xa'));var toCsv=require(_0xd5b0('0xb'));var querystring=require(_0xd5b0('0xc'));var Papa=require('papaparse');var Redis=require(_0xd5b0('0xd'));var authService=require(_0xd5b0('0xe'));var qs=require(_0xd5b0('0xf'));var as=require(_0xd5b0('0x10'));var hardwareService=require(_0xd5b0('0x11'));var logger=require('../../config/logger')(_0xd5b0('0x12'));var utils=require(_0xd5b0('0x13'));var config=require(_0xd5b0('0x14'));var db=require(_0xd5b0('0x15'))['db'];function respondWithStatusCode(_0x1f7938,_0x353d69){_0x353d69=_0x353d69||0xcc;return function(_0x457da2){if(_0x457da2){return _0x1f7938['sendStatus'](_0x353d69);}return _0x1f7938[_0xd5b0('0x16')](_0x353d69)['end']();};}function respondWithResult(_0x20d2a9,_0x59f83f){_0x59f83f=_0x59f83f||0xc8;return function(_0x51d039){if(_0x51d039){return _0x20d2a9[_0xd5b0('0x16')](_0x59f83f)['json'](_0x51d039);}};}function respondWithFilteredResult(_0x583549,_0x54e788){return function(_0x344338){if(_0x344338){var _0x19d39c=_0x344338[_0xd5b0('0x17')],_0x4bd442=_0x54e788[_0xd5b0('0x18')],_0x4a050d=_0x54e788[_0xd5b0('0x18')]+_0x54e788['limit'],_0x3b0c3b;if(_0x4a050d>=_0x19d39c){_0x4a050d=_0x19d39c;_0x3b0c3b=0xc8;}else{_0x3b0c3b=0xce;}_0x583549[_0xd5b0('0x16')](_0x3b0c3b);return _0x583549['set'](_0xd5b0('0x19'),_0x4bd442+'-'+_0x4a050d+'/'+_0x19d39c)['json'](_0x344338);}return null;};}function patchUpdates(_0x50cf25){return function(_0x28bd4c){try{jsonpatch[_0xd5b0('0x1a')](_0x28bd4c,_0x50cf25,!![]);}catch(_0x5ace6a){return BPromise[_0xd5b0('0x1b')](_0x5ace6a);}return _0x28bd4c[_0xd5b0('0x1c')]();};}function saveUpdates(_0x309c54,_0x48f84e){return function(_0x45610e){if(_0x45610e){return _0x45610e[_0xd5b0('0x1d')](_0x309c54)[_0xd5b0('0x1e')](function(_0xb460cf){return _0xb460cf;});}return null;};}function removeEntity(_0x226d96,_0x4e767a){return function(_0x2153fc){if(_0x2153fc){return _0x2153fc[_0xd5b0('0x1f')]()[_0xd5b0('0x1e')](function(){_0x226d96[_0xd5b0('0x16')](0xcc)[_0xd5b0('0x20')]();});}};}function handleEntityNotFound(_0x129726,_0x53ea42){return function(_0x4c83ee){if(!_0x4c83ee){_0x129726[_0xd5b0('0x21')](0x194);}return _0x4c83ee;};}function handleError(_0x38e4e8,_0x3b5c86){_0x3b5c86=_0x3b5c86||0x1f4;return function(_0xa7ee07){logger[_0xd5b0('0x22')](_0xa7ee07[_0xd5b0('0x23')]);if(_0xa7ee07[_0xd5b0('0x24')]){delete _0xa7ee07[_0xd5b0('0x24')];}_0x38e4e8['status'](_0x3b5c86)[_0xd5b0('0x25')](_0xa7ee07);};}exports[_0xd5b0('0x1d')]=function(_0x1653bf,_0x207171){if(_0x1653bf[_0xd5b0('0x26')]['id']){delete _0x1653bf[_0xd5b0('0x26')]['id'];}return db[_0xd5b0('0x27')][_0xd5b0('0x28')]({'where':{'id':_0x1653bf[_0xd5b0('0x29')]['id']}})['then'](handleEntityNotFound(_0x207171,null))[_0xd5b0('0x1e')](saveUpdates(_0x1653bf['body'],null))[_0xd5b0('0x1e')](respondWithResult(_0x207171,null))[_0xd5b0('0x2a')](handleError(_0x207171,null));};exports[_0xd5b0('0x1f')]=function(_0x311e4b,_0x212ea7){return db[_0xd5b0('0x27')]['find']({'where':{'id':_0x311e4b[_0xd5b0('0x29')]['id']}})[_0xd5b0('0x1e')](handleEntityNotFound(_0x212ea7,null))[_0xd5b0('0x1e')](removeEntity(_0x212ea7,null))[_0xd5b0('0x2a')](handleError(_0x212ea7,null));}; \ No newline at end of file +var _0xcefb=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','update','then','destroy','error','stack','name','send','body','find','params','catch','Condition','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xcefb,0x1cb));var _0xbcef=function(_0x2d2a9b,_0x5870ff){_0x2d2a9b=_0x2d2a9b-0x0;var _0x3d2d49=_0xcefb[_0x2d2a9b];return _0x3d2d49;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbcef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbcef('0x2'));var BPromise=require(_0xbcef('0x3'));var Mustache=require(_0xbcef('0x4'));var util=require(_0xbcef('0x5'));var path=require(_0xbcef('0x6'));var sox=require('sox');var csv=require(_0xbcef('0x7'));var ejs=require(_0xbcef('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbcef('0x9'));var crypto=require('crypto');var jsforce=require(_0xbcef('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbcef('0xb'));var Papa=require('papaparse');var Redis=require(_0xbcef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbcef('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcef('0xe'))(_0xbcef('0xf'));var utils=require(_0xbcef('0x10'));var config=require(_0xbcef('0x11'));var db=require(_0xbcef('0x12'))['db'];function respondWithStatusCode(_0x2ebb57,_0xd10324){_0xd10324=_0xd10324||0xcc;return function(_0x193bf2){if(_0x193bf2){return _0x2ebb57[_0xbcef('0x13')](_0xd10324);}return _0x2ebb57['status'](_0xd10324)[_0xbcef('0x14')]();};}function respondWithResult(_0x465c58,_0x54f06d){_0x54f06d=_0x54f06d||0xc8;return function(_0x4183e0){if(_0x4183e0){return _0x465c58[_0xbcef('0x15')](_0x54f06d)[_0xbcef('0x16')](_0x4183e0);}};}function respondWithFilteredResult(_0x4331db,_0x20d5f7){return function(_0x52afa9){if(_0x52afa9){var _0x252a00=_0x52afa9['count'],_0x5e1af9=_0x20d5f7[_0xbcef('0x17')],_0x2eacb7=_0x20d5f7['offset']+_0x20d5f7[_0xbcef('0x18')],_0x1daed7;if(_0x2eacb7>=_0x252a00){_0x2eacb7=_0x252a00;_0x1daed7=0xc8;}else{_0x1daed7=0xce;}_0x4331db['status'](_0x1daed7);return _0x4331db[_0xbcef('0x19')]('Content-Range',_0x5e1af9+'-'+_0x2eacb7+'/'+_0x252a00)['json'](_0x52afa9);}return null;};}function patchUpdates(_0x7db857){return function(_0x3fef4a){try{jsonpatch['apply'](_0x3fef4a,_0x7db857,!![]);}catch(_0x746e64){return BPromise[_0xbcef('0x1a')](_0x746e64);}return _0x3fef4a['save']();};}function saveUpdates(_0x115516,_0x1b1238){return function(_0x32c2b1){if(_0x32c2b1){return _0x32c2b1[_0xbcef('0x1b')](_0x115516)[_0xbcef('0x1c')](function(_0x2f885f){return _0x2f885f;});}return null;};}function removeEntity(_0x13ac89,_0x4690d7){return function(_0x59cc37){if(_0x59cc37){return _0x59cc37[_0xbcef('0x1d')]()[_0xbcef('0x1c')](function(){_0x13ac89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x487fd2,_0x193956){return function(_0x547e9c){if(!_0x547e9c){_0x487fd2[_0xbcef('0x13')](0x194);}return _0x547e9c;};}function handleError(_0xa4710b,_0x5e8725){_0x5e8725=_0x5e8725||0x1f4;return function(_0x59ee6e){logger[_0xbcef('0x1e')](_0x59ee6e[_0xbcef('0x1f')]);if(_0x59ee6e[_0xbcef('0x20')]){delete _0x59ee6e[_0xbcef('0x20')];}_0xa4710b['status'](_0x5e8725)[_0xbcef('0x21')](_0x59ee6e);};}exports[_0xbcef('0x1b')]=function(_0x483639,_0x11d9df){if(_0x483639[_0xbcef('0x22')]['id']){delete _0x483639['body']['id'];}return db['Condition'][_0xbcef('0x23')]({'where':{'id':_0x483639[_0xbcef('0x24')]['id']}})[_0xbcef('0x1c')](handleEntityNotFound(_0x11d9df,null))[_0xbcef('0x1c')](saveUpdates(_0x483639[_0xbcef('0x22')],null))[_0xbcef('0x1c')](respondWithResult(_0x11d9df,null))[_0xbcef('0x25')](handleError(_0x11d9df,null));};exports[_0xbcef('0x1d')]=function(_0x4396ed,_0xa20241){return db[_0xbcef('0x26')][_0xbcef('0x23')]({'where':{'id':_0x4396ed['params']['id']}})[_0xbcef('0x1c')](handleEntityNotFound(_0xa20241,null))[_0xbcef('0x1c')](removeEntity(_0xa20241,null))[_0xbcef('0x25')](handleError(_0xa20241,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 29a16cd..8238143 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 _0x01cb=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','tools_conditions','lodash'];(function(_0x3669d6,_0x5a446b){var _0xbee59e=function(_0x1bca37){while(--_0x1bca37){_0x3669d6['push'](_0x3669d6['shift']());}};_0xbee59e(++_0x5a446b);}(_0x01cb,0x95));var _0xb01c=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x01cb[_0x34bd34];return _0x4e36d6;};'use strict';var _=require(_0xb01c('0x0'));var util=require(_0xb01c('0x1'));var logger=require('../../config/logger')(_0xb01c('0x2'));var moment=require(_0xb01c('0x3'));var BPromise=require(_0xb01c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb01c('0x5'));var rimraf=require(_0xb01c('0x6'));var config=require(_0xb01c('0x7'));var attributes=require('./condition.attributes');module[_0xb01c('0x8')]=function(_0x5eb6a5,_0x48beb3){return _0x5eb6a5['define']('Condition',attributes,{'tableName':_0xb01c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6307=['rimraf','../../config/environment','./condition.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a7ad9,_0x53abbf){var _0x1e9870=function(_0x253a00){while(--_0x253a00){_0x3a7ad9['push'](_0x3a7ad9['shift']());}};_0x1e9870(++_0x53abbf);}(_0x6307,0x131));var _0x7630=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6307[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7630('0x0'));var util=require(_0x7630('0x1'));var logger=require(_0x7630('0x2'))(_0x7630('0x3'));var moment=require(_0x7630('0x4'));var BPromise=require(_0x7630('0x5'));var rp=require(_0x7630('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7630('0x7'));var config=require(_0x7630('0x8'));var attributes=require(_0x7630('0x9'));module[_0x7630('0xa')]=function(_0x26a467,_0x39159e){return _0x26a467[_0x7630('0xb')]('Condition',attributes,{'tableName':'tools_conditions','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 d70f67d..3bebfc2 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 _0xfd94=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x102b2b,_0x45d45e){var _0x55db93=function(_0x502524){while(--_0x502524){_0x102b2b['push'](_0x102b2b['shift']());}};_0x55db93(++_0x45d45e);}(_0xfd94,0xca));var _0x4fd9=function(_0x56ac6a,_0x35ed04){_0x56ac6a=_0x56ac6a-0x0;var _0x169575=_0xfd94[_0x56ac6a];return _0x169575;};'use strict';var _=require(_0x4fd9('0x0'));var util=require(_0x4fd9('0x1'));var moment=require(_0x4fd9('0x2'));var BPromise=require(_0x4fd9('0x3'));var rs=require(_0x4fd9('0x4'));var fs=require('fs');var Redis=require(_0x4fd9('0x5'));var db=require(_0x4fd9('0x6'))['db'];var utils=require(_0x4fd9('0x7'));var logger=require(_0x4fd9('0x8'))(_0x4fd9('0x9'));var config=require(_0x4fd9('0xa'));var jayson=require(_0x4fd9('0xb'));var client=jayson['client'][_0x4fd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d25ae,_0x2af8e7,_0x1e3476){return new BPromise(function(_0x879620,_0x428c32){return client[_0x4fd9('0xd')](_0x5d25ae,_0x1e3476)['then'](function(_0x40735a){logger[_0x4fd9('0xe')](_0x4fd9('0xf'),_0x2af8e7,_0x4fd9('0x10'));logger[_0x4fd9('0x11')](_0x4fd9('0x12'),_0x2af8e7,_0x4fd9('0x10'),JSON[_0x4fd9('0x13')](_0x40735a));if(_0x40735a['error']){if(_0x40735a[_0x4fd9('0x14')][_0x4fd9('0x15')]===0x1f4){logger[_0x4fd9('0x14')](_0x4fd9('0xf'),_0x2af8e7,_0x40735a[_0x4fd9('0x14')][_0x4fd9('0x16')]);return _0x428c32(_0x40735a[_0x4fd9('0x14')][_0x4fd9('0x16')]);}logger['error'](_0x4fd9('0xf'),_0x2af8e7,_0x40735a[_0x4fd9('0x14')][_0x4fd9('0x16')]);return _0x879620(_0x40735a[_0x4fd9('0x14')]['message']);}else{logger[_0x4fd9('0xe')]('Condition,\x20%s,\x20%s',_0x2af8e7,'request\x20sent');_0x879620(_0x40735a[_0x4fd9('0x17')]['message']);}})[_0x4fd9('0x18')](function(_0x3d740f){logger[_0x4fd9('0x14')]('Condition,\x20%s,\x20%s',_0x2af8e7,_0x3d740f);_0x428c32(_0x3d740f);});});} \ No newline at end of file +var _0xb3ef=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','util'];(function(_0x3ab05e,_0xc208bf){var _0x946f59=function(_0x1a6820){while(--_0x1a6820){_0x3ab05e['push'](_0x3ab05e['shift']());}};_0x946f59(++_0xc208bf);}(_0xb3ef,0x1e2));var _0xfb3e=function(_0x18ed36,_0x40cfaf){_0x18ed36=_0x18ed36-0x0;var _0x174738=_0xb3ef[_0x18ed36];return _0x174738;};'use strict';var _=require('lodash');var util=require(_0xfb3e('0x0'));var moment=require(_0xfb3e('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb3e('0x2'));var fs=require('fs');var Redis=require(_0xfb3e('0x3'));var db=require(_0xfb3e('0x4'))['db'];var utils=require(_0xfb3e('0x5'));var logger=require(_0xfb3e('0x6'))(_0xfb3e('0x7'));var config=require(_0xfb3e('0x8'));var jayson=require(_0xfb3e('0x9'));var client=jayson['client'][_0xfb3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362b90,_0x39bf85,_0x200528){return new BPromise(function(_0x2673e0,_0x4c5537){return client[_0xfb3e('0xb')](_0x362b90,_0x200528)[_0xfb3e('0xc')](function(_0x432c5d){logger['info'](_0xfb3e('0xd'),_0x39bf85,_0xfb3e('0xe'));logger[_0xfb3e('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x39bf85,_0xfb3e('0xe'),JSON[_0xfb3e('0x10')](_0x432c5d));if(_0x432c5d[_0xfb3e('0x11')]){if(_0x432c5d['error']['code']===0x1f4){logger[_0xfb3e('0x11')](_0xfb3e('0xd'),_0x39bf85,_0x432c5d['error'][_0xfb3e('0x12')]);return _0x4c5537(_0x432c5d['error'][_0xfb3e('0x12')]);}logger[_0xfb3e('0x11')]('Condition,\x20%s,\x20%s',_0x39bf85,_0x432c5d[_0xfb3e('0x11')]['message']);return _0x2673e0(_0x432c5d[_0xfb3e('0x11')][_0xfb3e('0x12')]);}else{logger[_0xfb3e('0x13')](_0xfb3e('0xd'),_0x39bf85,'request\x20sent');_0x2673e0(_0x432c5d[_0xfb3e('0x14')][_0xfb3e('0x12')]);}})['catch'](function(_0x1f4d7f){logger[_0xfb3e('0x11')](_0xfb3e('0xd'),_0x39bf85,_0x1f4d7f);_0x4c5537(_0x1f4d7f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 683ab27..b11eb85 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 _0x2454=['isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','/:id'];(function(_0x4c11f5,_0x2484ea){var _0x51632f=function(_0x57cd0a){while(--_0x57cd0a){_0x4c11f5['push'](_0x4c11f5['shift']());}};_0x51632f(++_0x2484ea);}(_0x2454,0x14a));var _0x4245=function(_0x55bf5e,_0x686f5f){_0x55bf5e=_0x55bf5e-0x0;var _0x48dc91=_0x2454[_0x55bf5e];return _0x48dc91;};'use strict';var multer=require(_0x4245('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4245('0x1'));var express=require(_0x4245('0x2'));var router=express[_0x4245('0x3')]();var auth=require(_0x4245('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4245('0x5'));var controller=require(_0x4245('0x6'));router['put'](_0x4245('0x7'),auth[_0x4245('0x8')](),controller[_0x4245('0x9')]);router[_0x4245('0xa')](_0x4245('0x7'),auth[_0x4245('0x8')](),controller[_0x4245('0xb')]);module[_0x4245('0xc')]=router; \ No newline at end of file +var _0x5d5a=['/:id','isAuthenticated','update','delete','exports','util','connect-timeout','express','../../components/interaction/service','./condition.controller','put'];(function(_0x4b94dc,_0x193ed9){var _0x3047f2=function(_0x36cdfe){while(--_0x36cdfe){_0x4b94dc['push'](_0x4b94dc['shift']());}};_0x3047f2(++_0x193ed9);}(_0x5d5a,0x1e9));var _0xa5d5=function(_0x2d613b,_0x5aabdd){_0x2d613b=_0x2d613b-0x0;var _0x142158=_0x5d5a[_0x2d613b];return _0x142158;};'use strict';var multer=require('multer');var util=require(_0xa5d5('0x0'));var path=require('path');var timeout=require(_0xa5d5('0x1'));var express=require(_0xa5d5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa5d5('0x3'));var config=require('../../config/environment');var controller=require(_0xa5d5('0x4'));router[_0xa5d5('0x5')](_0xa5d5('0x6'),auth[_0xa5d5('0x7')](),controller[_0xa5d5('0x8')]);router[_0xa5d5('0x9')](_0xa5d5('0x6'),auth[_0xa5d5('0x7')](),controller['destroy']);module[_0xa5d5('0xa')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index f65bde8..e5cb966 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 _0xf2c7=['sequelize','exports','STRING','name'];(function(_0x5c6d19,_0x2d4dca){var _0x27c9fa=function(_0x108b6c){while(--_0x108b6c){_0x5c6d19['push'](_0x5c6d19['shift']());}};_0x27c9fa(++_0x2d4dca);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xf2c7[_0x59b439];return _0x521ea3;};'use strict';var Sequelize=require(_0x7f2c('0x0'));module[_0x7f2c('0x1')]={'name':{'type':Sequelize[_0x7f2c('0x2')],'allowNull':![],'unique':_0x7f2c('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7f2c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb790=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb790,0xe5));var _0x0b79=function(_0x31ba1a,_0x4e88ce){_0x31ba1a=_0x31ba1a-0x0;var _0xf8402b=_0xb790[_0x31ba1a];return _0xf8402b;};'use strict';var Sequelize=require('sequelize');module[_0x0b79('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0b79('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 85a452b..7cc3300 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 _0x9bde=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','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','status','end'];(function(_0x37f34d,_0x443bd0){var _0x51c1c8=function(_0x20ef9e){while(--_0x20ef9e){_0x37f34d['push'](_0x37f34d['shift']());}};_0x51c1c8(++_0x443bd0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5dd1b8,_0x46153f){_0x5dd1b8=_0x5dd1b8-0x0;var _0x1be3ad=_0x9bde[_0x5dd1b8];return _0x1be3ad;};'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'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){var _0x238ab1=_0x4ecaf5[_0xe9bd('0x27')]({'plain':!![]});var _0x36f8c0=_0xe9bd('0x28');return db['UserProfileResource'][_0xe9bd('0x26')]({'where':{'type':_0x36f8c0,'resourceId':_0x238ab1['id']}})[_0xe9bd('0x25')](function(){return _0x4ecaf5;});})[_0xe9bd('0x25')](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x29')](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('0x19')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}exports[_0xe9bd('0x2d')]=function(_0x519f48,_0x5b7f1d){var _0x1de54c={},_0x56e409={},_0xa45eb0={'count':0x0,'rows':[]};var _0x1f2c0e=_[_0xe9bd('0x2e')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')],function(_0x509e36){return{'name':_0x509e36['fieldName'],'type':_0x509e36[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x56e409[_0xe9bd('0x33')]=_[_0xe9bd('0x2e')](_0x1f2c0e,_0xe9bd('0x2b'));_0x56e409[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x519f48[_0xe9bd('0x34')]);_0x56e409[_0xe9bd('0x36')]=_['intersection'](_0x56e409[_0xe9bd('0x33')],_0x56e409[_0xe9bd('0x34')]);_0x1de54c[_0xe9bd('0x37')]=_['intersection'](_0x56e409['model'],qs[_0xe9bd('0x38')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x1de54c[_0xe9bd('0x37')]=_0x1de54c[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x1de54c[_0xe9bd('0x37')]:_0x56e409[_0xe9bd('0x33')];if(!_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x1de54c[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x1de54c[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x519f48[_0xe9bd('0x34')]['offset']);}_0x1de54c[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x519f48['query'][_0xe9bd('0x3d')]);_0x1de54c[_0xe9bd('0x3e')]=qs['filters'](_['pick'](_0x519f48[_0xe9bd('0x34')],_0x56e409[_0xe9bd('0x36')]),_0x1f2c0e);if(_0x519f48['query'][_0xe9bd('0x3f')]){_0x1de54c[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x1de54c['where'],{'$or':_[_0xe9bd('0x2e')](_0x1f2c0e,function(_0x4d1945){if(_0x4d1945[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x63d67c={};_0x63d67c[_0x4d1945[_0xe9bd('0x2b')]]={'$like':'%'+_0x519f48['query'][_0xe9bd('0x3f')]+'%'};return _0x63d67c;}})});}_0x1de54c=_[_0xe9bd('0x40')]({},_0x1de54c,_0x519f48[_0xe9bd('0x42')]);var _0x3f1212={'where':_0x1de54c[_0xe9bd('0x3e')]};return db[_0xe9bd('0x2f')][_0xe9bd('0x1c')](_0x3f1212)[_0xe9bd('0x25')](function(_0x2b5a71){_0xa45eb0[_0xe9bd('0x1c')]=_0x2b5a71;if(_0x519f48['query']['includeAll']){_0x1de54c[_0xe9bd('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe9bd('0x44')](_0x1de54c);})[_0xe9bd('0x25')](function(_0x41881a){_0xa45eb0['rows']=_0x41881a;return _0xa45eb0;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5b7f1d,_0x1de54c))[_0xe9bd('0x45')](handleError(_0x5b7f1d,null));};exports[_0xe9bd('0x46')]=function(_0x5a4460,_0x2ef01b){var _0x3a5703={'raw':!![],'where':{'id':_0x5a4460[_0xe9bd('0x47')]['id']}},_0x2b3cd7={};_0x2b3cd7[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x2b3cd7[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x5a4460[_0xe9bd('0x34')]);_0x2b3cd7[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x2b3cd7[_0xe9bd('0x33')],_0x2b3cd7[_0xe9bd('0x34')]);_0x3a5703['attributes']=_['intersection'](_0x2b3cd7[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x5a4460[_0xe9bd('0x34')]['fields']));_0x3a5703['attributes']=_0x3a5703[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3a5703[_0xe9bd('0x37')]:_0x2b3cd7[_0xe9bd('0x33')];if(_0x5a4460[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3a5703[_0xe9bd('0x43')]=[{'all':!![]}];}_0x3a5703=_['merge']({},_0x3a5703,_0x5a4460[_0xe9bd('0x42')]);return db['ContactItemType'][_0xe9bd('0x4a')](_0x3a5703)[_0xe9bd('0x25')](handleEntityNotFound(_0x2ef01b,null))[_0xe9bd('0x25')](respondWithResult(_0x2ef01b,null))[_0xe9bd('0x45')](handleError(_0x2ef01b,null));};exports[_0xe9bd('0x4b')]=function(_0x4b7b67,_0x3317d6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4b')](_0x4b7b67['body'],{})[_0xe9bd('0x25')](function(_0x476f23){var _0x34f787=_0x4b7b67['user'][_0xe9bd('0x27')]({'plain':!![]});if(!_0x34f787)throw new Error(_0xe9bd('0x4c'));if(_0x34f787[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0x1ee09c=_0x476f23['get']({'plain':!![]});var _0x3f4833='ContactItemTypes';return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x3f4833,'userProfileId':_0x34f787[_0xe9bd('0x50')]},'raw':!![]})[_0xe9bd('0x25')](function(_0x194b7d){if(_0x194b7d&&_0x194b7d['autoAssociation']===0x0){return db[_0xe9bd('0x51')]['create']({'name':_0x1ee09c[_0xe9bd('0x2b')],'resourceId':_0x1ee09c['id'],'type':_0x194b7d[_0xe9bd('0x2b')],'sectionId':_0x194b7d['id']},{})['then'](function(){return _0x476f23;});}else{return _0x476f23;}})['catch'](function(_0x1ce539){logger['error'](_0xe9bd('0x52'),_0x1ce539);throw _0x1ce539;});}return _0x476f23;})['then'](respondWithResult(_0x3317d6,0xc9))[_0xe9bd('0x45')](handleError(_0x3317d6,null));};exports[_0xe9bd('0x24')]=function(_0x5496d7,_0x55f619){if(_0x5496d7['body']['id']){delete _0x5496d7[_0xe9bd('0x53')]['id'];}return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x5496d7['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x55f619,null))[_0xe9bd('0x25')](saveUpdates(_0x5496d7[_0xe9bd('0x53')],null))[_0xe9bd('0x25')](respondWithResult(_0x55f619,null))['catch'](handleError(_0x55f619,null));};exports['destroy']=function(_0x441f89,_0x493aae){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x441f89[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x493aae,null))[_0xe9bd('0x25')](removeEntity(_0x493aae,null))[_0xe9bd('0x45')](handleError(_0x493aae,null));}; \ No newline at end of file +var _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','index','map','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','merge','ContactItemType','count','includeAll','findAll','catch','show','keys','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x44d3,_0x200862){var _0x1d3cad=function(_0x3adb2a){while(--_0x3adb2a){_0x44d3['push'](_0x44d3['shift']());}};_0x1d3cad(++_0x200862);}(_0x70e0,0x17b));var _0x070e=function(_0x150a08,_0x479962){_0x150a08=_0x150a08-0x0;var _0x27159f=_0x70e0[_0x150a08];return _0x27159f;};'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(){var _0x33e8c6=_0xf8dd5d[_0x070e('0x22')]({'plain':!![]});var _0xa86797=_0x070e('0x23');return db[_0x070e('0x24')]['destroy']({'where':{'type':_0xa86797,'resourceId':_0x33e8c6['id']}})[_0x070e('0x20')](function(){return _0xf8dd5d;});})[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf17c56,_0x5f3e9d){return function(_0x4a2dbd){if(!_0x4a2dbd){_0xf17c56[_0x070e('0x16')](0x194);}return _0x4a2dbd;};}function handleError(_0x25f6e,_0x41deb1){_0x41deb1=_0x41deb1||0x1f4;return function(_0x1743cc){logger[_0x070e('0x25')](_0x1743cc['stack']);if(_0x1743cc[_0x070e('0x26')]){delete _0x1743cc[_0x070e('0x26')];}_0x25f6e[_0x070e('0x1a')](_0x41deb1)[_0x070e('0x27')](_0x1743cc);};}exports[_0x070e('0x28')]=function(_0x28d7f2,_0x1a1892){var _0x26373b={},_0x5e8326={},_0x282344={'count':0x0,'rows':[]};var _0x351641=_[_0x070e('0x29')](db['ContactItemType']['rawAttributes'],function(_0x13097f){return{'name':_0x13097f[_0x070e('0x2a')],'type':_0x13097f[_0x070e('0x2b')]['key']};});_0x5e8326[_0x070e('0x2c')]=_[_0x070e('0x29')](_0x351641,_0x070e('0x26'));_0x5e8326[_0x070e('0x2d')]=_['keys'](_0x28d7f2['query']);_0x5e8326['filters']=_['intersection'](_0x5e8326[_0x070e('0x2c')],_0x5e8326['query']);_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x5e8326['model'],qs['fields'](_0x28d7f2[_0x070e('0x2d')][_0x070e('0x30')]));_0x26373b['attributes']=_0x26373b['attributes'][_0x070e('0x31')]?_0x26373b[_0x070e('0x2e')]:_0x5e8326[_0x070e('0x2c')];if(!_0x28d7f2[_0x070e('0x2d')][_0x070e('0x32')]('nolimit')){_0x26373b['limit']=qs[_0x070e('0x19')](_0x28d7f2[_0x070e('0x2d')][_0x070e('0x19')]);_0x26373b[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x28d7f2['query'][_0x070e('0x18')]);}_0x26373b[_0x070e('0x33')]=qs['sort'](_0x28d7f2[_0x070e('0x2d')][_0x070e('0x34')]);_0x26373b['where']=qs['filters'](_['pick'](_0x28d7f2[_0x070e('0x2d')],_0x5e8326[_0x070e('0x35')]),_0x351641);if(_0x28d7f2[_0x070e('0x2d')][_0x070e('0x36')]){_0x26373b[_0x070e('0x37')]=_['merge'](_0x26373b[_0x070e('0x37')],{'$or':_[_0x070e('0x29')](_0x351641,function(_0xb53332){if(_0xb53332['type']!==_0x070e('0x38')){var _0x72cbc7={};_0x72cbc7[_0xb53332[_0x070e('0x26')]]={'$like':'%'+_0x28d7f2['query'][_0x070e('0x36')]+'%'};return _0x72cbc7;}})});}_0x26373b=_[_0x070e('0x39')]({},_0x26373b,_0x28d7f2['options']);var _0x173602={'where':_0x26373b['where']};return db[_0x070e('0x3a')][_0x070e('0x3b')](_0x173602)[_0x070e('0x20')](function(_0x30319c){_0x282344[_0x070e('0x3b')]=_0x30319c;if(_0x28d7f2['query'][_0x070e('0x3c')]){_0x26373b['include']=[{'all':!![]}];}return db['ContactItemType'][_0x070e('0x3d')](_0x26373b);})[_0x070e('0x20')](function(_0x38879f){_0x282344['rows']=_0x38879f;return _0x282344;})[_0x070e('0x20')](respondWithFilteredResult(_0x1a1892,_0x26373b))[_0x070e('0x3e')](handleError(_0x1a1892,null));};exports[_0x070e('0x3f')]=function(_0x7dc240,_0x4a4ee3){var _0x13e4e0={'raw':!![],'where':{'id':_0x7dc240['params']['id']}},_0x5851ab={};_0x5851ab['model']=_[_0x070e('0x40')](db[_0x070e('0x3a')][_0x070e('0x41')]);_0x5851ab[_0x070e('0x2d')]=_[_0x070e('0x40')](_0x7dc240['query']);_0x5851ab[_0x070e('0x35')]=_['intersection'](_0x5851ab[_0x070e('0x2c')],_0x5851ab[_0x070e('0x2d')]);_0x13e4e0[_0x070e('0x2e')]=_['intersection'](_0x5851ab['model'],qs[_0x070e('0x30')](_0x7dc240['query'][_0x070e('0x30')]));_0x13e4e0[_0x070e('0x2e')]=_0x13e4e0[_0x070e('0x2e')]['length']?_0x13e4e0[_0x070e('0x2e')]:_0x5851ab[_0x070e('0x2c')];if(_0x7dc240['query']['includeAll']){_0x13e4e0[_0x070e('0x42')]=[{'all':!![]}];}_0x13e4e0=_[_0x070e('0x39')]({},_0x13e4e0,_0x7dc240[_0x070e('0x43')]);return db[_0x070e('0x3a')][_0x070e('0x44')](_0x13e4e0)['then'](handleEntityNotFound(_0x4a4ee3,null))[_0x070e('0x20')](respondWithResult(_0x4a4ee3,null))[_0x070e('0x3e')](handleError(_0x4a4ee3,null));};exports[_0x070e('0x45')]=function(_0x391dee,_0x79eaa0){return db[_0x070e('0x3a')][_0x070e('0x45')](_0x391dee[_0x070e('0x46')],{})[_0x070e('0x20')](function(_0x66a3f3){var _0x210c4d=_0x391dee[_0x070e('0x47')][_0x070e('0x22')]({'plain':!![]});if(!_0x210c4d)throw new Error(_0x070e('0x48'));if(_0x210c4d[_0x070e('0x49')]==='user'){var _0x171621=_0x66a3f3[_0x070e('0x22')]({'plain':!![]});var _0x40298a=_0x070e('0x23');return db[_0x070e('0x4a')][_0x070e('0x44')]({'where':{'name':_0x40298a,'userProfileId':_0x210c4d[_0x070e('0x4b')]},'raw':!![]})[_0x070e('0x20')](function(_0x1c64d2){if(_0x1c64d2&&_0x1c64d2['autoAssociation']===0x0){return db[_0x070e('0x24')]['create']({'name':_0x171621[_0x070e('0x26')],'resourceId':_0x171621['id'],'type':_0x1c64d2[_0x070e('0x26')],'sectionId':_0x1c64d2['id']},{})['then'](function(){return _0x66a3f3;});}else{return _0x66a3f3;}})[_0x070e('0x3e')](function(_0x130a50){logger[_0x070e('0x25')](_0x070e('0x4c'),_0x130a50);throw _0x130a50;});}return _0x66a3f3;})[_0x070e('0x20')](respondWithResult(_0x79eaa0,0xc9))[_0x070e('0x3e')](handleError(_0x79eaa0,null));};exports[_0x070e('0x1f')]=function(_0x5694fa,_0x296978){if(_0x5694fa['body']['id']){delete _0x5694fa['body']['id'];}return db[_0x070e('0x3a')][_0x070e('0x44')]({'where':{'id':_0x5694fa[_0x070e('0x4d')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x296978,null))[_0x070e('0x20')](saveUpdates(_0x5694fa[_0x070e('0x46')],null))[_0x070e('0x20')](respondWithResult(_0x296978,null))[_0x070e('0x3e')](handleError(_0x296978,null));};exports['destroy']=function(_0x477e69,_0x51d27d){return db['ContactItemType'][_0x070e('0x44')]({'where':{'id':_0x477e69[_0x070e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x51d27d,null))[_0x070e('0x20')](removeEntity(_0x51d27d,null))[_0x070e('0x3e')](handleError(_0x51d27d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index dc867f8..dbfd1aa 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 _0xf569=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','ContactItemType','tools_contact_item_types','util'];(function(_0x5c4dd8,_0x4e17bd){var _0x5e4891=function(_0x17ab59){while(--_0x17ab59){_0x5c4dd8['push'](_0x5c4dd8['shift']());}};_0x5e4891(++_0x4e17bd);}(_0xf569,0xd0));var _0x9f56=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xf569[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var logger=require(_0x9f56('0x1'))(_0x9f56('0x2'));var moment=require(_0x9f56('0x3'));var BPromise=require(_0x9f56('0x4'));var rp=require(_0x9f56('0x5'));var fs=require('fs');var path=require(_0x9f56('0x6'));var rimraf=require(_0x9f56('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f56('0x8'));module['exports']=function(_0x467a46,_0x3488f2){return _0x467a46['define'](_0x9f56('0x9'),attributes,{'tableName':_0x9f56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x510e=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x510e,0x1ed));var _0xe510=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x510e[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var logger=require(_0xe510('0x2'))(_0xe510('0x3'));var moment=require(_0xe510('0x4'));var BPromise=require(_0xe510('0x5'));var rp=require(_0xe510('0x6'));var fs=require('fs');var path=require(_0xe510('0x7'));var rimraf=require(_0xe510('0x8'));var config=require('../../config/environment');var attributes=require(_0xe510('0x9'));module[_0xe510('0xa')]=function(_0x236d08,_0x37870d){return _0x236d08[_0xe510('0xb')](_0xe510('0xc'),attributes,{'tableName':_0xe510('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 58cfe44..589ee2a 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 _0xc577=['http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x14d2a2,_0x5d93c9){var _0x38e94b=function(_0x47d34b){while(--_0x47d34b){_0x14d2a2['push'](_0x14d2a2['shift']());}};_0x38e94b(++_0x5d93c9);}(_0xc577,0x172));var _0x7c57=function(_0xabbfc7,_0x33d449){_0xabbfc7=_0xabbfc7-0x0;var _0x2a2a62=_0xc577[_0xabbfc7];return _0x2a2a62;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc454,_0x2f2c8f,_0x4bb81b){return new BPromise(function(_0x4e5cb2,_0x5c7ffb){return client[_0x7c57('0xb')](_0x2bc454,_0x4bb81b)['then'](function(_0x3ea732){logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));logger['debug'](_0x7c57('0xf'),_0x2f2c8f,_0x7c57('0xe'),JSON['stringify'](_0x3ea732));if(_0x3ea732[_0x7c57('0x10')]){if(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x11')]===0x1f4){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x5c7ffb(_0x3ea732['error']['message']);}logger['error'](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x4e5cb2(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);}else{logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));_0x4e5cb2(_0x3ea732['result']['message']);}})[_0x7c57('0x13')](function(_0x2975f0){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x2975f0);_0x5c7ffb(_0x2975f0);});});} \ 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(_0x4532a2,_0x2e74e5){var _0x5a3963=function(_0x42013b){while(--_0x42013b){_0x4532a2['push'](_0x4532a2['shift']());}};_0x5a3963(++_0x2e74e5);}(_0x00b3,0x17a));var _0x300b=function(_0x3ecce0,_0x3cd203){_0x3ecce0=_0x3ecce0-0x0;var _0x2e46d7=_0x00b3[_0x3ecce0];return _0x2e46d7;};'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 de4a0dd..17325e7 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 _0xfc77=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x48959c,_0x25ac7e){var _0x81e07c=function(_0xed5a24){while(--_0xed5a24){_0x48959c['push'](_0x48959c['shift']());}};_0x81e07c(++_0x25ac7e);}(_0xfc77,0x90));var _0x7fc7=function(_0x397d61,_0x1f2002){_0x397d61=_0x397d61-0x0;var _0x270833=_0xfc77[_0x397d61];return _0x270833;};'use strict';var multer=require(_0x7fc7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7fc7('0x1'));var express=require(_0x7fc7('0x2'));var router=express[_0x7fc7('0x3')]();var auth=require(_0x7fc7('0x4'));var interaction=require(_0x7fc7('0x5'));var config=require(_0x7fc7('0x6'));var controller=require(_0x7fc7('0x7'));router[_0x7fc7('0x8')]('/',auth[_0x7fc7('0x9')](),controller[_0x7fc7('0xa')]);router[_0x7fc7('0x8')](_0x7fc7('0xb'),auth[_0x7fc7('0x9')](),controller[_0x7fc7('0xc')]);router[_0x7fc7('0xd')]('/',auth['isAuthenticated'](),controller[_0x7fc7('0xe')]);router[_0x7fc7('0xf')](_0x7fc7('0xb'),auth[_0x7fc7('0x9')](),controller[_0x7fc7('0x10')]);router['delete'](_0x7fc7('0xb'),auth[_0x7fc7('0x9')](),controller[_0x7fc7('0x11')]);module[_0x7fc7('0x12')]=router; \ No newline at end of file +var _0x0c06=['express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x568898,_0x3a4afd){var _0x5ab461=function(_0x4bf5a2){while(--_0x4bf5a2){_0x568898['push'](_0x568898['shift']());}};_0x5ab461(++_0x3a4afd);}(_0x0c06,0x11d));var _0x60c0=function(_0x226732,_0xbd15b8){_0x226732=_0x226732-0x0;var _0x5f3fad=_0x0c06[_0x226732];return _0x5f3fad;};'use strict';var multer=require('multer');var util=require(_0x60c0('0x0'));var path=require(_0x60c0('0x1'));var timeout=require(_0x60c0('0x2'));var express=require(_0x60c0('0x3'));var router=express[_0x60c0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x60c0('0x5'));var config=require(_0x60c0('0x6'));var controller=require(_0x60c0('0x7'));router[_0x60c0('0x8')]('/',auth[_0x60c0('0x9')](),controller[_0x60c0('0xa')]);router[_0x60c0('0x8')](_0x60c0('0xb'),auth['isAuthenticated'](),controller[_0x60c0('0xc')]);router[_0x60c0('0xd')]('/',auth[_0x60c0('0x9')](),controller[_0x60c0('0xe')]);router['put'](_0x60c0('0xb'),auth[_0x60c0('0x9')](),controller[_0x60c0('0xf')]);router['delete'](_0x60c0('0xb'),auth['isAuthenticated'](),controller[_0x60c0('0x10')]);module[_0x60c0('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index fc2bc1a..7990422 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 _0x1f2b=['STRING','sequelize','exports'];(function(_0x2d11f1,_0xdc089b){var _0x7196fc=function(_0x23d567){while(--_0x23d567){_0x2d11f1['push'](_0x2d11f1['shift']());}};_0x7196fc(++_0xdc089b);}(_0x1f2b,0x76));var _0xb1f2=function(_0x1fd02e,_0x4fcbbb){_0x1fd02e=_0x1fd02e-0x0;var _0x48a8f9=_0x1f2b[_0x1fd02e];return _0x48a8f9;};'use strict';var Sequelize=require(_0xb1f2('0x0'));module[_0xb1f2('0x1')]={'name':{'type':Sequelize[_0xb1f2('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c34=['sequelize','exports','STRING','name'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x3c34,0x14c));var _0x43c3=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x3c34[_0x2b8077];return _0x308091;};'use strict';var Sequelize=require(_0x43c3('0x0'));module[_0x43c3('0x1')]={'name':{'type':Sequelize[_0x43c3('0x2')],'allowNull':![],'unique':_0x43c3('0x3')},'description':{'type':Sequelize[_0x43c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c97968c..ad56616 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 _0x3694=['params','keys','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','omit','updatedAt','update','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','addItem','DashboardId','DashboardItem','getItems','order','sort','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','CustomDashboards','UserProfileResource','destroy','end','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x3694,0x1a6));var _0x4369=function(_0x15872c,_0x339822){_0x15872c=_0x15872c-0x0;var _0x264492=_0x3694[_0x15872c];return _0x264492;};'use strict';var pdf=require(_0x4369('0x0'));var emlformat=require(_0x4369('0x1'));var rimraf=require(_0x4369('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4369('0x3'));var rp=require(_0x4369('0x4'));var moment=require(_0x4369('0x5'));var BPromise=require(_0x4369('0x6'));var Mustache=require(_0x4369('0x7'));var util=require('util');var path=require(_0x4369('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4369('0x9'));var fs=require('fs');var _=require(_0x4369('0xa'));var squel=require(_0x4369('0xb'));var crypto=require(_0x4369('0xc'));var jsforce=require(_0x4369('0xd'));var deskjs=require(_0x4369('0xe'));var toCsv=require(_0x4369('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4369('0x10'));var authService=require(_0x4369('0x11'));var qs=require(_0x4369('0x12'));var as=require(_0x4369('0x13'));var hardwareService=require(_0x4369('0x14'));var logger=require(_0x4369('0x15'))(_0x4369('0x16'));var utils=require('../../config/utils');var config=require(_0x4369('0x17'));var db=require(_0x4369('0x18'))['db'];config[_0x4369('0x19')]=_[_0x4369('0x1a')](config[_0x4369('0x19')],{'host':_0x4369('0x1b'),'port':0x18eb});var socket=require(_0x4369('0x1c'))(new Redis(config[_0x4369('0x19')]));require(_0x4369('0x1d'))['register'](socket);function respondWithStatusCode(_0x4cbceb,_0x5c1a24){_0x5c1a24=_0x5c1a24||0xcc;return function(_0x405e4e){if(_0x405e4e){return _0x4cbceb[_0x4369('0x1e')](_0x5c1a24);}return _0x4cbceb[_0x4369('0x1f')](_0x5c1a24)['end']();};}function respondWithResult(_0x4703c3,_0x190775){_0x190775=_0x190775||0xc8;return function(_0xf8e13a){if(_0xf8e13a){return _0x4703c3[_0x4369('0x1f')](_0x190775)[_0x4369('0x20')](_0xf8e13a);}};}function respondWithFilteredResult(_0x518737,_0x3bc5e7){return function(_0x58826c){if(_0x58826c){var _0x305b30=_0x58826c[_0x4369('0x21')],_0x53741f=_0x3bc5e7[_0x4369('0x22')],_0x1d4a4a=_0x3bc5e7[_0x4369('0x22')]+_0x3bc5e7[_0x4369('0x23')],_0x2f92c0;if(_0x1d4a4a>=_0x305b30){_0x1d4a4a=_0x305b30;_0x2f92c0=0xc8;}else{_0x2f92c0=0xce;}_0x518737['status'](_0x2f92c0);return _0x518737[_0x4369('0x24')]('Content-Range',_0x53741f+'-'+_0x1d4a4a+'/'+_0x305b30)['json'](_0x58826c);}return null;};}function patchUpdates(_0x264978){return function(_0x5adf89){try{jsonpatch[_0x4369('0x25')](_0x5adf89,_0x264978,!![]);}catch(_0x2618df){return BPromise[_0x4369('0x26')](_0x2618df);}return _0x5adf89[_0x4369('0x27')]();};}function saveUpdates(_0x4f3ee6,_0x49bdb0){return function(_0x18d275){if(_0x18d275){return _0x18d275['update'](_0x4f3ee6)['then'](function(_0x26fcae){return _0x26fcae;});}return null;};}function removeEntity(_0x35d787,_0x217467){return function(_0x376afe){if(_0x376afe){return _0x376afe['destroy']()[_0x4369('0x28')](function(){var _0xd338d1=_0x376afe['get']({'plain':!![]});var _0x366895=_0x4369('0x29');return db[_0x4369('0x2a')][_0x4369('0x2b')]({'where':{'type':_0x366895,'resourceId':_0xd338d1['id']}})[_0x4369('0x28')](function(){return _0x376afe;});})[_0x4369('0x28')](function(){_0x35d787[_0x4369('0x1f')](0xcc)[_0x4369('0x2c')]();});}};}function handleEntityNotFound(_0x241cd2,_0x7cf6d7){return function(_0x1f7158){if(!_0x1f7158){_0x241cd2[_0x4369('0x1e')](0x194);}return _0x1f7158;};}function handleError(_0x303b40,_0xb4770c){_0xb4770c=_0xb4770c||0x1f4;return function(_0x6b8bbd){logger[_0x4369('0x2d')](_0x6b8bbd[_0x4369('0x2e')]);if(_0x6b8bbd['name']){delete _0x6b8bbd[_0x4369('0x2f')];}_0x303b40[_0x4369('0x1f')](_0xb4770c)[_0x4369('0x30')](_0x6b8bbd);};}exports[_0x4369('0x31')]=function(_0x2431f5,_0x4384aa){var _0x56b103={},_0x374990={},_0x14d771={'count':0x0,'rows':[]};var _0x25ded3=_['map'](db[_0x4369('0x32')][_0x4369('0x33')],function(_0x14706a){return{'name':_0x14706a[_0x4369('0x34')],'type':_0x14706a[_0x4369('0x35')][_0x4369('0x36')]};});_0x374990[_0x4369('0x37')]=_[_0x4369('0x38')](_0x25ded3,_0x4369('0x2f'));_0x374990[_0x4369('0x39')]=_['keys'](_0x2431f5[_0x4369('0x39')]);_0x374990['filters']=_[_0x4369('0x3a')](_0x374990[_0x4369('0x37')],_0x374990['query']);_0x56b103[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x374990[_0x4369('0x37')],qs[_0x4369('0x3c')](_0x2431f5['query'][_0x4369('0x3c')]));_0x56b103[_0x4369('0x3b')]=_0x56b103[_0x4369('0x3b')]['length']?_0x56b103['attributes']:_0x374990[_0x4369('0x37')];if(!_0x2431f5[_0x4369('0x39')]['hasOwnProperty'](_0x4369('0x3d'))){_0x56b103[_0x4369('0x23')]=qs[_0x4369('0x23')](_0x2431f5[_0x4369('0x39')][_0x4369('0x23')]);_0x56b103[_0x4369('0x22')]=qs['offset'](_0x2431f5[_0x4369('0x39')][_0x4369('0x22')]);}_0x56b103['order']=qs['sort'](_0x2431f5[_0x4369('0x39')]['sort']);_0x56b103[_0x4369('0x3e')]=qs[_0x4369('0x3f')](_[_0x4369('0x40')](_0x2431f5['query'],_0x374990[_0x4369('0x3f')]),_0x25ded3);if(_0x2431f5[_0x4369('0x39')][_0x4369('0x41')]){_0x56b103[_0x4369('0x3e')]=_[_0x4369('0x42')](_0x56b103['where'],{'$or':_[_0x4369('0x38')](_0x25ded3,function(_0x5c10bf){if(_0x5c10bf[_0x4369('0x35')]!=='VIRTUAL'){var _0x29de6c={};_0x29de6c[_0x5c10bf[_0x4369('0x2f')]]={'$like':'%'+_0x2431f5[_0x4369('0x39')][_0x4369('0x41')]+'%'};return _0x29de6c;}})});}_0x56b103=_[_0x4369('0x42')]({},_0x56b103,_0x2431f5[_0x4369('0x43')]);var _0x7519a9={'where':_0x56b103[_0x4369('0x3e')]};return db[_0x4369('0x32')]['count'](_0x7519a9)['then'](function(_0x491d51){_0x14d771[_0x4369('0x21')]=_0x491d51;if(_0x2431f5[_0x4369('0x39')][_0x4369('0x44')]){_0x56b103[_0x4369('0x45')]=[{'all':!![]}];}return db[_0x4369('0x32')][_0x4369('0x46')](_0x56b103);})[_0x4369('0x28')](function(_0x5b0c8c){_0x14d771[_0x4369('0x47')]=_0x5b0c8c;return _0x14d771;})[_0x4369('0x28')](respondWithFilteredResult(_0x4384aa,_0x56b103))[_0x4369('0x48')](handleError(_0x4384aa,null));};exports[_0x4369('0x49')]=function(_0x200914,_0x1a2238){var _0x209134={'raw':![],'where':{'id':_0x200914[_0x4369('0x4a')]['id']}},_0x1c168b={};_0x1c168b[_0x4369('0x37')]=_[_0x4369('0x4b')](db[_0x4369('0x32')]['rawAttributes']);_0x1c168b['query']=_[_0x4369('0x4b')](_0x200914[_0x4369('0x39')]);_0x1c168b['filters']=_[_0x4369('0x3a')](_0x1c168b['model'],_0x1c168b[_0x4369('0x39')]);_0x209134[_0x4369('0x3b')]=_['intersection'](_0x1c168b[_0x4369('0x37')],qs[_0x4369('0x3c')](_0x200914[_0x4369('0x39')]['fields']));_0x209134['attributes']=_0x209134['attributes'][_0x4369('0x4c')]?_0x209134[_0x4369('0x3b')]:_0x1c168b[_0x4369('0x37')];if(_0x200914[_0x4369('0x39')][_0x4369('0x44')]){_0x209134[_0x4369('0x45')]=[{'all':!![]}];}_0x209134=_[_0x4369('0x42')]({},_0x209134,_0x200914[_0x4369('0x43')]);return db[_0x4369('0x32')][_0x4369('0x4d')](_0x209134)[_0x4369('0x28')](handleEntityNotFound(_0x1a2238,null))[_0x4369('0x28')](respondWithResult(_0x1a2238,null))[_0x4369('0x48')](handleError(_0x1a2238,null));};exports[_0x4369('0x4e')]=function(_0x1a42e0,_0x29144b){return db['Dashboard'][_0x4369('0x4e')](_0x1a42e0['body'],{})['then'](function(_0x23392a){var _0x4701cd=_0x1a42e0['user'][_0x4369('0x4f')]({'plain':!![]});if(!_0x4701cd)throw new Error(_0x4369('0x50'));if(_0x4701cd[_0x4369('0x51')]===_0x4369('0x52')){var _0x19fc64=_0x23392a[_0x4369('0x4f')]({'plain':!![]});var _0x1129d4=_0x4369('0x29');return db[_0x4369('0x53')][_0x4369('0x4d')]({'where':{'name':_0x1129d4,'userProfileId':_0x4701cd[_0x4369('0x54')]},'raw':!![]})[_0x4369('0x28')](function(_0x1fb473){if(_0x1fb473&&_0x1fb473[_0x4369('0x55')]===0x0){return db[_0x4369('0x2a')][_0x4369('0x4e')]({'name':_0x19fc64[_0x4369('0x2f')],'resourceId':_0x19fc64['id'],'type':_0x1fb473['name'],'sectionId':_0x1fb473['id']},{})[_0x4369('0x28')](function(){return _0x23392a;});}else{return _0x23392a;}})[_0x4369('0x48')](function(_0x5d18b5){logger[_0x4369('0x2d')](_0x4369('0x56'),_0x5d18b5);throw _0x5d18b5;});}return _0x23392a;})['then'](respondWithResult(_0x29144b,0xc9))[_0x4369('0x48')](handleError(_0x29144b,null));};exports[_0x4369('0x57')]=function(_0x229e0b,_0x5321c3){var _0x167f80={'where':{'id':_0x229e0b[_0x4369('0x4a')]['id']}},_0x55f754={};_0x55f754['model']=_[_0x4369('0x4b')](db[_0x4369('0x32')]['rawAttributes']);_0x167f80[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x55f754[_0x4369('0x37')],qs[_0x4369('0x3c')](_0x229e0b[_0x4369('0x39')][_0x4369('0x3c')]));_0x167f80[_0x4369('0x3b')]=_0x167f80['attributes']['length']?_0x167f80[_0x4369('0x3b')]:_0x55f754['model'];if(_0x229e0b[_0x4369('0x39')][_0x4369('0x44')]){_0x167f80[_0x4369('0x45')]=[{'all':!![]}];}_0x167f80=_[_0x4369('0x42')]({},_0x167f80,_0x229e0b[_0x4369('0x43')]);return db[_0x4369('0x32')]['find'](_0x167f80)[_0x4369('0x28')](handleEntityNotFound(_0x5321c3,null))[_0x4369('0x28')](function(_0xa34636){if(_0xa34636){var _0x42915c=_0xa34636[_0x4369('0x4f')]({'plain':!![]});_0x42915c=qs['omit'](_0x42915c,['id',_0x4369('0x58'),'updatedAt']);_0x229e0b[_0x4369('0x59')]=_[_0x4369('0x5a')](_0x229e0b[_0x4369('0x59')],['id','createdAt',_0x4369('0x5b')]);return db[_0x4369('0x32')][_0x4369('0x4e')](_['merge'](_0x42915c,_0x229e0b[_0x4369('0x59')]),{'include':_0x229e0b[_0x4369('0x39')][_0x4369('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x291b84){var _0x2631d2=_0x229e0b[_0x4369('0x52')][_0x4369('0x4f')]({'plain':!![]});if(!_0x2631d2)throw new Error(_0x4369('0x50'));if(_0x2631d2['role']===_0x4369('0x52')){var _0x53198a=_0x291b84[_0x4369('0x4f')]({'plain':!![]});var _0x1727f7=_0x4369('0x29');return db[_0x4369('0x53')][_0x4369('0x4d')]({'where':{'name':_0x1727f7,'userProfileId':_0x2631d2[_0x4369('0x54')]},'raw':!![]})[_0x4369('0x28')](function(_0x511c0f){if(_0x511c0f&&_0x511c0f['autoAssociation']===0x0){return db[_0x4369('0x2a')][_0x4369('0x4e')]({'name':_0x53198a[_0x4369('0x2f')],'resourceId':_0x53198a['id'],'type':_0x511c0f[_0x4369('0x2f')],'sectionId':_0x511c0f['id']},{})['then'](function(){return _0x291b84;});}else{return _0x291b84;}})[_0x4369('0x48')](function(_0x14a3e0){logger[_0x4369('0x2d')](_0x4369('0x56'),_0x14a3e0);throw _0x14a3e0;});}return _0x291b84;});}})[_0x4369('0x28')](respondWithResult(_0x5321c3,0xc9))[_0x4369('0x48')](handleError(_0x5321c3,null));};exports[_0x4369('0x5c')]=function(_0x2e1849,_0x28c7f6){if(_0x2e1849[_0x4369('0x59')]['id']){delete _0x2e1849[_0x4369('0x59')]['id'];}return db[_0x4369('0x32')][_0x4369('0x4d')]({'where':{'id':_0x2e1849[_0x4369('0x4a')]['id']}})[_0x4369('0x28')](handleEntityNotFound(_0x28c7f6,null))[_0x4369('0x28')](saveUpdates(_0x2e1849[_0x4369('0x59')],null))[_0x4369('0x28')](respondWithResult(_0x28c7f6,null))[_0x4369('0x48')](handleError(_0x28c7f6,null));};exports['destroy']=function(_0x44b1a3,_0x4df46b){return db[_0x4369('0x32')][_0x4369('0x4d')]({'where':{'id':_0x44b1a3[_0x4369('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4df46b,null))[_0x4369('0x28')](removeEntity(_0x4df46b,null))[_0x4369('0x48')](handleError(_0x4df46b,null));};function widgetAttributes(_0x440470){try{switch(_0x440470['type']){case _0x4369('0x5d'):return[{'name':_0x4369('0x5e'),'value':_0x440470[_0x4369('0x5e')]||(_0x440470[_0x4369('0x5f')]&&_0x440470['attrs'][0x0]?_0x440470['attrs'][0x0]['value']:undefined)||_0x4369('0x60')}];case _0x4369('0x61'):return[{'name':_0x4369('0x62'),'value':_0x440470['attrPath']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470[_0x4369('0x5f')][0x0][_0x4369('0x63')]:undefined)||''}];case _0x4369('0x64'):return[{'name':_0x4369('0x65'),'value':_0x440470[_0x4369('0x65')]||(_0x440470['attrs']&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470[_0x4369('0x5f')][0x0][_0x4369('0x63')]:undefined)||_0x4369('0x66')},{'name':'attrTimezone','value':_0x440470[_0x4369('0x67')]||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x1]?_0x440470[_0x4369('0x5f')][0x1]['value']:undefined)||_0x4369('0x68')},{'name':_0x4369('0x69'),'value':_0x440470[_0x4369('0x69')]||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x2]?_0x440470['attrs'][0x2][_0x4369('0x63')]:undefined)||0xc}];case _0x4369('0x6a'):return[{'name':_0x4369('0x6b'),'value':_0x440470[_0x4369('0x6b')]||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470[_0x4369('0x5f')][0x0][_0x4369('0x63')]:undefined)||_0x4369('0x6c')},{'name':'attrVoiceQueues','value':_0x440470[_0x4369('0x6d')]||(_0x440470['attrs']&&_0x440470[_0x4369('0x5f')][0x1]?_0x440470[_0x4369('0x5f')][0x1][_0x4369('0x63')]:undefined)||[]},{'name':_0x4369('0x69'),'value':_0x440470['attrFontSize']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x2]?_0x440470[_0x4369('0x5f')][0x2][_0x4369('0x63')]:undefined)||0x14}];case _0x4369('0x6e'):case _0x4369('0x6f'):return[{'name':_0x4369('0x70'),'value':_0x440470['attrSerie1']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470[_0x4369('0x5f')][0x0][_0x4369('0x63')]:undefined)||'total'},{'name':_0x4369('0x71'),'value':_0x440470['attrSerie2']||(_0x440470[_0x4369('0x5f')]&&_0x440470['attrs'][0x1]?_0x440470[_0x4369('0x5f')][0x1][_0x4369('0x63')]:undefined)||null},{'name':_0x4369('0x72'),'value':_0x440470['attrSerie3']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x2]?_0x440470[_0x4369('0x5f')][0x2]['value']:undefined)||null},{'name':_0x4369('0x6d'),'value':_0x440470[_0x4369('0x6d')]||(_0x440470['attrs']&&_0x440470[_0x4369('0x5f')][0x3]?_0x440470[_0x4369('0x5f')][0x3]['value']:undefined)||[]}];case _0x4369('0x73'):return[{'name':_0x4369('0x74'),'type':_0x440470[_0x4369('0x75')]||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470['attrs'][0x0][_0x4369('0x35')]:undefined)||null,'value':_0x440470['attrReport']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x0]?_0x440470[_0x4369('0x5f')][0x0][_0x4369('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x440470['attrRefresh']||(_0x440470[_0x4369('0x5f')]&&_0x440470[_0x4369('0x5f')][0x1]?_0x440470[_0x4369('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x226c4a){logger[_0x4369('0x2d')]('widgetAttributes:\x20%s',JSON['stringify'](_0x226c4a));return[];}}exports[_0x4369('0x76')]=function(_0x2ca3cb,_0x4c96dc,_0x3390b5){if(_0x2ca3cb[_0x4369('0x59')]['id']){delete _0x2ca3cb[_0x4369('0x59')]['id'];}return db[_0x4369('0x32')][_0x4369('0x4d')]({'where':{'id':_0x2ca3cb[_0x4369('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c96dc,null))[_0x4369('0x28')](function(_0x1621a9){if(_0x1621a9){_0x2ca3cb[_0x4369('0x59')][_0x4369('0x77')]=_0x1621a9['id'];_0x2ca3cb[_0x4369('0x59')][_0x4369('0x5f')]=widgetAttributes(_0x2ca3cb['body']);return db[_0x4369('0x78')][_0x4369('0x4e')](_0x2ca3cb[_0x4369('0x59')]);}})[_0x4369('0x28')](respondWithResult(_0x4c96dc,null))[_0x4369('0x48')](handleError(_0x4c96dc,null));};exports[_0x4369('0x79')]=function(_0x33419f,_0x22dfd9,_0x356c7c){var _0x3b36ab={};var _0x58d529={};var _0x18fc7a;var _0x195b13;return db[_0x4369('0x32')]['findOne']({'where':{'id':_0x33419f[_0x4369('0x4a')]['id']}})[_0x4369('0x28')](handleEntityNotFound(_0x22dfd9,null))['then'](function(_0x9c88bc){if(_0x9c88bc){_0x18fc7a=_0x9c88bc;_0x58d529[_0x4369('0x37')]=_[_0x4369('0x4b')](db['DashboardItem'][_0x4369('0x33')]);_0x58d529[_0x4369('0x39')]=_[_0x4369('0x4b')](_0x33419f[_0x4369('0x39')]);_0x58d529[_0x4369('0x3f')]=_[_0x4369('0x3a')](_0x58d529[_0x4369('0x37')],_0x58d529[_0x4369('0x39')]);_0x3b36ab[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x58d529[_0x4369('0x37')],qs['fields'](_0x33419f['query'][_0x4369('0x3c')]));_0x3b36ab[_0x4369('0x3b')]=_0x3b36ab[_0x4369('0x3b')][_0x4369('0x4c')]?_0x3b36ab['attributes']:_0x58d529['model'];_0x3b36ab[_0x4369('0x7a')]=qs[_0x4369('0x7b')](_0x33419f['query'][_0x4369('0x7b')]);_0x3b36ab[_0x4369('0x3e')]=qs[_0x4369('0x3f')](_[_0x4369('0x40')](_0x33419f['query'],_0x58d529[_0x4369('0x3f')]));if(_0x33419f['query'][_0x4369('0x41')]){_0x3b36ab[_0x4369('0x3e')]=_[_0x4369('0x42')](_0x3b36ab['where'],{'$or':_['map'](_0x3b36ab[_0x4369('0x3b')],function(_0x1db9b7){var _0x9819a7={};_0x9819a7[_0x1db9b7]={'$like':'%'+_0x33419f['query'][_0x4369('0x41')]+'%'};return _0x9819a7;})});}_0x3b36ab=_[_0x4369('0x42')]({},_0x3b36ab,_0x33419f[_0x4369('0x43')]);return _0x18fc7a[_0x4369('0x79')](_0x3b36ab);}})[_0x4369('0x28')](function(_0x318761){if(_0x318761){_0x195b13=_0x318761['length'];if(!_0x33419f['query']['hasOwnProperty'](_0x4369('0x3d'))){_0x3b36ab[_0x4369('0x23')]=qs[_0x4369('0x23')](_0x33419f['query'][_0x4369('0x23')]);_0x3b36ab[_0x4369('0x22')]=qs[_0x4369('0x22')](_0x33419f['query'][_0x4369('0x22')]);}return _0x18fc7a['getItems'](_0x3b36ab);}})['then'](function(_0x662b97){if(_0x662b97){return _0x662b97?{'count':_0x195b13,'rows':_0x662b97}:null;}})[_0x4369('0x28')](respondWithResult(_0x22dfd9,null))[_0x4369('0x48')](handleError(_0x22dfd9,null));}; \ No newline at end of file +var _0x0776=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','update','iframe','attrUrl','attrs','custom','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0xc76c2f,_0x6c9f0a){var _0x224e6c=function(_0x45606a){while(--_0x45606a){_0xc76c2f['push'](_0xc76c2f['shift']());}};_0x224e6c(++_0x6c9f0a);}(_0x0776,0x6a));var _0x6077=function(_0x29b347,_0x5864ed){_0x29b347=_0x29b347-0x0;var _0x587e7d=_0x0776[_0x29b347];return _0x587e7d;};'use strict';var pdf=require(_0x6077('0x0'));var emlformat=require(_0x6077('0x1'));var rimraf=require(_0x6077('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6077('0x3'));var rp=require(_0x6077('0x4'));var moment=require(_0x6077('0x5'));var BPromise=require(_0x6077('0x6'));var Mustache=require(_0x6077('0x7'));var util=require('util');var path=require(_0x6077('0x8'));var sox=require(_0x6077('0x9'));var csv=require('to-csv');var ejs=require(_0x6077('0xa'));var fs=require('fs');var _=require(_0x6077('0xb'));var squel=require('squel');var crypto=require(_0x6077('0xc'));var jsforce=require(_0x6077('0xd'));var deskjs=require(_0x6077('0xe'));var toCsv=require(_0x6077('0xf'));var querystring=require(_0x6077('0x10'));var Papa=require('papaparse');var Redis=require(_0x6077('0x11'));var authService=require(_0x6077('0x12'));var qs=require(_0x6077('0x13'));var as=require(_0x6077('0x14'));var hardwareService=require(_0x6077('0x15'));var logger=require(_0x6077('0x16'))('api');var utils=require(_0x6077('0x17'));var config=require('../../config/environment');var db=require(_0x6077('0x18'))['db'];config[_0x6077('0x19')]=_[_0x6077('0x1a')](config[_0x6077('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6077('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')[_0x6077('0x1c')](socket);function respondWithStatusCode(_0x42bdb2,_0x1985d9){_0x1985d9=_0x1985d9||0xcc;return function(_0x4ffc02){if(_0x4ffc02){return _0x42bdb2[_0x6077('0x1d')](_0x1985d9);}return _0x42bdb2[_0x6077('0x1e')](_0x1985d9)[_0x6077('0x1f')]();};}function respondWithResult(_0x19dc50,_0x26c568){_0x26c568=_0x26c568||0xc8;return function(_0x42fe99){if(_0x42fe99){return _0x19dc50['status'](_0x26c568)[_0x6077('0x20')](_0x42fe99);}};}function respondWithFilteredResult(_0x4d1cf4,_0x288a37){return function(_0x2e7c87){if(_0x2e7c87){var _0x273f97=_0x2e7c87['count'],_0x376218=_0x288a37[_0x6077('0x21')],_0x2fbc40=_0x288a37[_0x6077('0x21')]+_0x288a37['limit'],_0x122b72;if(_0x2fbc40>=_0x273f97){_0x2fbc40=_0x273f97;_0x122b72=0xc8;}else{_0x122b72=0xce;}_0x4d1cf4['status'](_0x122b72);return _0x4d1cf4[_0x6077('0x22')](_0x6077('0x23'),_0x376218+'-'+_0x2fbc40+'/'+_0x273f97)[_0x6077('0x20')](_0x2e7c87);}return null;};}function patchUpdates(_0x53a9b7){return function(_0x500ffd){try{jsonpatch[_0x6077('0x24')](_0x500ffd,_0x53a9b7,!![]);}catch(_0x2188a8){return BPromise[_0x6077('0x25')](_0x2188a8);}return _0x500ffd[_0x6077('0x26')]();};}function saveUpdates(_0x155700,_0x3c8ac9){return function(_0x2f51f6){if(_0x2f51f6){return _0x2f51f6['update'](_0x155700)[_0x6077('0x27')](function(_0x3afefd){return _0x3afefd;});}return null;};}function removeEntity(_0x187615,_0xfea2ef){return function(_0x5f35ef){if(_0x5f35ef){return _0x5f35ef[_0x6077('0x28')]()['then'](function(){var _0x595f37=_0x5f35ef[_0x6077('0x29')]({'plain':!![]});var _0x1d9f88=_0x6077('0x2a');return db['UserProfileResource'][_0x6077('0x28')]({'where':{'type':_0x1d9f88,'resourceId':_0x595f37['id']}})[_0x6077('0x27')](function(){return _0x5f35ef;});})[_0x6077('0x27')](function(){_0x187615['status'](0xcc)[_0x6077('0x1f')]();});}};}function handleEntityNotFound(_0x413a77,_0x16ae2c){return function(_0x2e10ba){if(!_0x2e10ba){_0x413a77[_0x6077('0x1d')](0x194);}return _0x2e10ba;};}function handleError(_0x2856a0,_0x4fc621){_0x4fc621=_0x4fc621||0x1f4;return function(_0x183e72){logger[_0x6077('0x2b')](_0x183e72[_0x6077('0x2c')]);if(_0x183e72[_0x6077('0x2d')]){delete _0x183e72[_0x6077('0x2d')];}_0x2856a0['status'](_0x4fc621)[_0x6077('0x2e')](_0x183e72);};}exports[_0x6077('0x2f')]=function(_0x1e3b98,_0x4d2bfd){var _0x1e0169={},_0x88fe18={},_0x3f3fe6={'count':0x0,'rows':[]};var _0x203962=_[_0x6077('0x30')](db[_0x6077('0x31')][_0x6077('0x32')],function(_0x923851){return{'name':_0x923851['fieldName'],'type':_0x923851[_0x6077('0x33')][_0x6077('0x34')]};});_0x88fe18['model']=_['map'](_0x203962,_0x6077('0x2d'));_0x88fe18['query']=_[_0x6077('0x35')](_0x1e3b98['query']);_0x88fe18[_0x6077('0x36')]=_[_0x6077('0x37')](_0x88fe18[_0x6077('0x38')],_0x88fe18['query']);_0x1e0169[_0x6077('0x39')]=_[_0x6077('0x37')](_0x88fe18['model'],qs[_0x6077('0x3a')](_0x1e3b98[_0x6077('0x3b')][_0x6077('0x3a')]));_0x1e0169['attributes']=_0x1e0169[_0x6077('0x39')][_0x6077('0x3c')]?_0x1e0169['attributes']:_0x88fe18[_0x6077('0x38')];if(!_0x1e3b98[_0x6077('0x3b')][_0x6077('0x3d')](_0x6077('0x3e'))){_0x1e0169[_0x6077('0x3f')]=qs[_0x6077('0x3f')](_0x1e3b98[_0x6077('0x3b')][_0x6077('0x3f')]);_0x1e0169[_0x6077('0x21')]=qs['offset'](_0x1e3b98[_0x6077('0x3b')][_0x6077('0x21')]);}_0x1e0169[_0x6077('0x40')]=qs[_0x6077('0x41')](_0x1e3b98[_0x6077('0x3b')]['sort']);_0x1e0169['where']=qs[_0x6077('0x36')](_[_0x6077('0x42')](_0x1e3b98[_0x6077('0x3b')],_0x88fe18[_0x6077('0x36')]),_0x203962);if(_0x1e3b98['query'][_0x6077('0x43')]){_0x1e0169[_0x6077('0x44')]=_[_0x6077('0x45')](_0x1e0169[_0x6077('0x44')],{'$or':_[_0x6077('0x30')](_0x203962,function(_0x163529){if(_0x163529[_0x6077('0x33')]!==_0x6077('0x46')){var _0x503f33={};_0x503f33[_0x163529[_0x6077('0x2d')]]={'$like':'%'+_0x1e3b98[_0x6077('0x3b')]['filter']+'%'};return _0x503f33;}})});}_0x1e0169=_[_0x6077('0x45')]({},_0x1e0169,_0x1e3b98['options']);var _0x4db3b7={'where':_0x1e0169['where']};return db[_0x6077('0x31')][_0x6077('0x47')](_0x4db3b7)[_0x6077('0x27')](function(_0x25ce88){_0x3f3fe6['count']=_0x25ce88;if(_0x1e3b98[_0x6077('0x3b')][_0x6077('0x48')]){_0x1e0169['include']=[{'all':!![]}];}return db[_0x6077('0x31')][_0x6077('0x49')](_0x1e0169);})[_0x6077('0x27')](function(_0x25d59b){_0x3f3fe6[_0x6077('0x4a')]=_0x25d59b;return _0x3f3fe6;})[_0x6077('0x27')](respondWithFilteredResult(_0x4d2bfd,_0x1e0169))[_0x6077('0x4b')](handleError(_0x4d2bfd,null));};exports[_0x6077('0x4c')]=function(_0x1b81f9,_0x351c3c){var _0x3afcfc={'raw':![],'where':{'id':_0x1b81f9[_0x6077('0x4d')]['id']}},_0x5c6a48={};_0x5c6a48[_0x6077('0x38')]=_[_0x6077('0x35')](db[_0x6077('0x31')][_0x6077('0x32')]);_0x5c6a48[_0x6077('0x3b')]=_[_0x6077('0x35')](_0x1b81f9[_0x6077('0x3b')]);_0x5c6a48[_0x6077('0x36')]=_[_0x6077('0x37')](_0x5c6a48[_0x6077('0x38')],_0x5c6a48[_0x6077('0x3b')]);_0x3afcfc[_0x6077('0x39')]=_['intersection'](_0x5c6a48[_0x6077('0x38')],qs[_0x6077('0x3a')](_0x1b81f9[_0x6077('0x3b')][_0x6077('0x3a')]));_0x3afcfc[_0x6077('0x39')]=_0x3afcfc[_0x6077('0x39')]['length']?_0x3afcfc[_0x6077('0x39')]:_0x5c6a48[_0x6077('0x38')];if(_0x1b81f9[_0x6077('0x3b')]['includeAll']){_0x3afcfc[_0x6077('0x4e')]=[{'all':!![]}];}_0x3afcfc=_[_0x6077('0x45')]({},_0x3afcfc,_0x1b81f9[_0x6077('0x4f')]);return db[_0x6077('0x31')]['find'](_0x3afcfc)['then'](handleEntityNotFound(_0x351c3c,null))[_0x6077('0x27')](respondWithResult(_0x351c3c,null))['catch'](handleError(_0x351c3c,null));};exports[_0x6077('0x50')]=function(_0xe533d,_0x560747){return db['Dashboard'][_0x6077('0x50')](_0xe533d['body'],{})[_0x6077('0x27')](function(_0x5c9301){var _0x2f7d43=_0xe533d['user'][_0x6077('0x29')]({'plain':!![]});if(!_0x2f7d43)throw new Error(_0x6077('0x51'));if(_0x2f7d43[_0x6077('0x52')]===_0x6077('0x53')){var _0x29af8e=_0x5c9301[_0x6077('0x29')]({'plain':!![]});var _0x44e216=_0x6077('0x2a');return db[_0x6077('0x54')][_0x6077('0x55')]({'where':{'name':_0x44e216,'userProfileId':_0x2f7d43[_0x6077('0x56')]},'raw':!![]})[_0x6077('0x27')](function(_0x3c267c){if(_0x3c267c&&_0x3c267c[_0x6077('0x57')]===0x0){return db[_0x6077('0x58')][_0x6077('0x50')]({'name':_0x29af8e[_0x6077('0x2d')],'resourceId':_0x29af8e['id'],'type':_0x3c267c[_0x6077('0x2d')],'sectionId':_0x3c267c['id']},{})[_0x6077('0x27')](function(){return _0x5c9301;});}else{return _0x5c9301;}})[_0x6077('0x4b')](function(_0x2a1773){logger[_0x6077('0x2b')](_0x6077('0x59'),_0x2a1773);throw _0x2a1773;});}return _0x5c9301;})['then'](respondWithResult(_0x560747,0xc9))[_0x6077('0x4b')](handleError(_0x560747,null));};exports[_0x6077('0x5a')]=function(_0x582adf,_0xec42a1){var _0x374e8c={'where':{'id':_0x582adf[_0x6077('0x4d')]['id']}},_0x54da89={};_0x54da89['model']=_['keys'](db[_0x6077('0x31')][_0x6077('0x32')]);_0x374e8c[_0x6077('0x39')]=_[_0x6077('0x37')](_0x54da89[_0x6077('0x38')],qs[_0x6077('0x3a')](_0x582adf[_0x6077('0x3b')][_0x6077('0x3a')]));_0x374e8c['attributes']=_0x374e8c[_0x6077('0x39')]['length']?_0x374e8c[_0x6077('0x39')]:_0x54da89[_0x6077('0x38')];if(_0x582adf[_0x6077('0x3b')]['includeAll']){_0x374e8c['include']=[{'all':!![]}];}_0x374e8c=_[_0x6077('0x45')]({},_0x374e8c,_0x582adf[_0x6077('0x4f')]);return db[_0x6077('0x31')][_0x6077('0x55')](_0x374e8c)['then'](handleEntityNotFound(_0xec42a1,null))[_0x6077('0x27')](function(_0x54beb2){if(_0x54beb2){var _0x135ebe=_0x54beb2[_0x6077('0x29')]({'plain':!![]});_0x135ebe=qs[_0x6077('0x5b')](_0x135ebe,['id',_0x6077('0x5c'),_0x6077('0x5d')]);_0x582adf[_0x6077('0x5e')]=_[_0x6077('0x5b')](_0x582adf[_0x6077('0x5e')],['id',_0x6077('0x5c'),_0x6077('0x5d')]);return db[_0x6077('0x31')][_0x6077('0x50')](_['merge'](_0x135ebe,_0x582adf[_0x6077('0x5e')]),{'include':_0x582adf[_0x6077('0x3b')][_0x6077('0x48')]?[{'all':!![]}]:undefined})[_0x6077('0x27')](function(_0x465109){var _0x37c6bd=_0x582adf['user'][_0x6077('0x29')]({'plain':!![]});if(!_0x37c6bd)throw new Error(_0x6077('0x51'));if(_0x37c6bd['role']===_0x6077('0x53')){var _0xc54127=_0x465109[_0x6077('0x29')]({'plain':!![]});var _0x1336bc=_0x6077('0x2a');return db[_0x6077('0x54')][_0x6077('0x55')]({'where':{'name':_0x1336bc,'userProfileId':_0x37c6bd[_0x6077('0x56')]},'raw':!![]})['then'](function(_0x354e6a){if(_0x354e6a&&_0x354e6a[_0x6077('0x57')]===0x0){return db[_0x6077('0x58')]['create']({'name':_0xc54127[_0x6077('0x2d')],'resourceId':_0xc54127['id'],'type':_0x354e6a[_0x6077('0x2d')],'sectionId':_0x354e6a['id']},{})[_0x6077('0x27')](function(){return _0x465109;});}else{return _0x465109;}})['catch'](function(_0xce0d48){logger[_0x6077('0x2b')](_0x6077('0x59'),_0xce0d48);throw _0xce0d48;});}return _0x465109;});}})['then'](respondWithResult(_0xec42a1,0xc9))[_0x6077('0x4b')](handleError(_0xec42a1,null));};exports[_0x6077('0x5f')]=function(_0x4a5bee,_0x166423){if(_0x4a5bee[_0x6077('0x5e')]['id']){delete _0x4a5bee[_0x6077('0x5e')]['id'];}return db[_0x6077('0x31')][_0x6077('0x55')]({'where':{'id':_0x4a5bee[_0x6077('0x4d')]['id']}})[_0x6077('0x27')](handleEntityNotFound(_0x166423,null))['then'](saveUpdates(_0x4a5bee['body'],null))['then'](respondWithResult(_0x166423,null))[_0x6077('0x4b')](handleError(_0x166423,null));};exports[_0x6077('0x28')]=function(_0x32341b,_0xe69970){return db['Dashboard'][_0x6077('0x55')]({'where':{'id':_0x32341b[_0x6077('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe69970,null))['then'](removeEntity(_0xe69970,null))[_0x6077('0x4b')](handleError(_0xe69970,null));};function widgetAttributes(_0x5064c8){try{switch(_0x5064c8['type']){case _0x6077('0x60'):return[{'name':'attrUrl','value':_0x5064c8[_0x6077('0x61')]||(_0x5064c8['attrs']&&_0x5064c8['attrs'][0x0]?_0x5064c8[_0x6077('0x62')][0x0]['value']:undefined)||'https://'}];case _0x6077('0x63'):return[{'name':'attrPath','value':_0x5064c8['attrPath']||(_0x5064c8['attrs']&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0][_0x6077('0x64')]:undefined)||''}];case _0x6077('0x65'):return[{'name':_0x6077('0x66'),'value':_0x5064c8['attrHourFormat']||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x6077('0x67'),'value':_0x5064c8['attrTimezone']||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8['attrs'][0x1]?_0x5064c8['attrs'][0x1][_0x6077('0x64')]:undefined)||_0x6077('0x68')},{'name':_0x6077('0x69'),'value':_0x5064c8[_0x6077('0x69')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x2]?_0x5064c8[_0x6077('0x62')][0x2][_0x6077('0x64')]:undefined)||0xc}];case _0x6077('0x6a'):return[{'name':_0x6077('0x6b'),'value':_0x5064c8[_0x6077('0x6b')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0][_0x6077('0x64')]:undefined)||_0x6077('0x6c')},{'name':_0x6077('0x6d'),'value':_0x5064c8[_0x6077('0x6d')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x1]?_0x5064c8[_0x6077('0x62')][0x1][_0x6077('0x64')]:undefined)||[]},{'name':_0x6077('0x69'),'value':_0x5064c8['attrFontSize']||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x2]?_0x5064c8[_0x6077('0x62')][0x2][_0x6077('0x64')]:undefined)||0x14}];case _0x6077('0x6e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x5064c8[_0x6077('0x6f')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0]['value']:undefined)||_0x6077('0x6c')},{'name':_0x6077('0x70'),'value':_0x5064c8[_0x6077('0x70')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x1]?_0x5064c8[_0x6077('0x62')][0x1][_0x6077('0x64')]:undefined)||null},{'name':_0x6077('0x71'),'value':_0x5064c8[_0x6077('0x71')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x2]?_0x5064c8[_0x6077('0x62')][0x2]['value']:undefined)||null},{'name':_0x6077('0x6d'),'value':_0x5064c8[_0x6077('0x6d')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x3]?_0x5064c8[_0x6077('0x62')][0x3][_0x6077('0x64')]:undefined)||[]}];case _0x6077('0x72'):return[{'name':_0x6077('0x73'),'type':_0x5064c8[_0x6077('0x74')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0][_0x6077('0x33')]:undefined)||null,'value':_0x5064c8[_0x6077('0x73')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x0]?_0x5064c8[_0x6077('0x62')][0x0][_0x6077('0x64')]:undefined)||null},{'name':_0x6077('0x75'),'value':_0x5064c8[_0x6077('0x75')]||(_0x5064c8[_0x6077('0x62')]&&_0x5064c8[_0x6077('0x62')][0x1]?_0x5064c8[_0x6077('0x62')][0x1][_0x6077('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x5687bc){logger['error'](_0x6077('0x76'),JSON[_0x6077('0x77')](_0x5687bc));return[];}}exports[_0x6077('0x78')]=function(_0x58f1a9,_0x382b84,_0x1f4e54){if(_0x58f1a9['body']['id']){delete _0x58f1a9[_0x6077('0x5e')]['id'];}return db[_0x6077('0x31')][_0x6077('0x55')]({'where':{'id':_0x58f1a9[_0x6077('0x4d')]['id']}})[_0x6077('0x27')](handleEntityNotFound(_0x382b84,null))[_0x6077('0x27')](function(_0x274d9a){if(_0x274d9a){_0x58f1a9[_0x6077('0x5e')][_0x6077('0x79')]=_0x274d9a['id'];_0x58f1a9[_0x6077('0x5e')][_0x6077('0x62')]=widgetAttributes(_0x58f1a9[_0x6077('0x5e')]);return db[_0x6077('0x7a')][_0x6077('0x50')](_0x58f1a9[_0x6077('0x5e')]);}})[_0x6077('0x27')](respondWithResult(_0x382b84,null))[_0x6077('0x4b')](handleError(_0x382b84,null));};exports[_0x6077('0x7b')]=function(_0x5a8338,_0xd47bfe,_0x5ef948){var _0x849307={};var _0x2f9b49={};var _0x23857d;var _0x37fd83;return db[_0x6077('0x31')][_0x6077('0x7c')]({'where':{'id':_0x5a8338[_0x6077('0x4d')]['id']}})[_0x6077('0x27')](handleEntityNotFound(_0xd47bfe,null))[_0x6077('0x27')](function(_0x49b5e4){if(_0x49b5e4){_0x23857d=_0x49b5e4;_0x2f9b49[_0x6077('0x38')]=_[_0x6077('0x35')](db[_0x6077('0x7a')]['rawAttributes']);_0x2f9b49[_0x6077('0x3b')]=_[_0x6077('0x35')](_0x5a8338[_0x6077('0x3b')]);_0x2f9b49['filters']=_[_0x6077('0x37')](_0x2f9b49[_0x6077('0x38')],_0x2f9b49[_0x6077('0x3b')]);_0x849307['attributes']=_[_0x6077('0x37')](_0x2f9b49[_0x6077('0x38')],qs[_0x6077('0x3a')](_0x5a8338[_0x6077('0x3b')]['fields']));_0x849307[_0x6077('0x39')]=_0x849307[_0x6077('0x39')][_0x6077('0x3c')]?_0x849307[_0x6077('0x39')]:_0x2f9b49[_0x6077('0x38')];_0x849307[_0x6077('0x40')]=qs['sort'](_0x5a8338[_0x6077('0x3b')][_0x6077('0x41')]);_0x849307['where']=qs[_0x6077('0x36')](_[_0x6077('0x42')](_0x5a8338[_0x6077('0x3b')],_0x2f9b49[_0x6077('0x36')]));if(_0x5a8338[_0x6077('0x3b')]['filter']){_0x849307[_0x6077('0x44')]=_[_0x6077('0x45')](_0x849307[_0x6077('0x44')],{'$or':_[_0x6077('0x30')](_0x849307[_0x6077('0x39')],function(_0x352b0c){var _0x5e1b9d={};_0x5e1b9d[_0x352b0c]={'$like':'%'+_0x5a8338[_0x6077('0x3b')][_0x6077('0x43')]+'%'};return _0x5e1b9d;})});}_0x849307=_[_0x6077('0x45')]({},_0x849307,_0x5a8338['options']);return _0x23857d[_0x6077('0x7b')](_0x849307);}})['then'](function(_0x1746f5){if(_0x1746f5){_0x37fd83=_0x1746f5[_0x6077('0x3c')];if(!_0x5a8338[_0x6077('0x3b')][_0x6077('0x3d')](_0x6077('0x3e'))){_0x849307[_0x6077('0x3f')]=qs[_0x6077('0x3f')](_0x5a8338[_0x6077('0x3b')][_0x6077('0x3f')]);_0x849307[_0x6077('0x21')]=qs['offset'](_0x5a8338[_0x6077('0x3b')][_0x6077('0x21')]);}return _0x23857d[_0x6077('0x7b')](_0x849307);}})[_0x6077('0x27')](function(_0x34ebf0){if(_0x34ebf0){return _0x34ebf0?{'count':_0x37fd83,'rows':_0x34ebf0}:null;}})[_0x6077('0x27')](respondWithResult(_0xd47bfe,null))['catch'](handleError(_0xd47bfe,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6b1f083..511aff6 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 _0x1f93=['hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1f93,0x122));var _0x31f9=function(_0x5212fd,_0x233214){_0x5212fd=_0x5212fd-0x0;var _0x446697=_0x1f93[_0x5212fd];return _0x446697;};'use strict';var EventEmitter=require(_0x31f9('0x0'));var Dashboard=require(_0x31f9('0x1'))['db'][_0x31f9('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x31f9('0x3')](0x0);var events={'afterCreate':_0x31f9('0x4'),'afterUpdate':'update','afterDestroy':_0x31f9('0x5')};function emitEvent(_0x3b8834){return function(_0x5850a7,_0x10b06c,_0x1b5e97){DashboardEvents['emit'](_0x3b8834+':'+_0x5850a7['id'],_0x5850a7);DashboardEvents[_0x31f9('0x6')](_0x3b8834,_0x5850a7);_0x1b5e97(null);};}for(var e in events){if(events[_0x31f9('0x7')](e)){var event=events[e];Dashboard[_0x31f9('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x90a5=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x12d96f,_0x4c996a){var _0x788fea=function(_0x49f96c){while(--_0x49f96c){_0x12d96f['push'](_0x12d96f['shift']());}};_0x788fea(++_0x4c996a);}(_0x90a5,0xab));var _0x590a=function(_0xd87624,_0x131c38){_0xd87624=_0xd87624-0x0;var _0x431d53=_0x90a5[_0xd87624];return _0x431d53;};'use strict';var EventEmitter=require(_0x590a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x590a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x590a('0x2')](0x0);var events={'afterCreate':_0x590a('0x3'),'afterUpdate':_0x590a('0x4'),'afterDestroy':_0x590a('0x5')};function emitEvent(_0x1e74b4){return function(_0x5d9849,_0x107c2b,_0xfd9781){DashboardEvents[_0x590a('0x6')](_0x1e74b4+':'+_0x5d9849['id'],_0x5d9849);DashboardEvents[_0x590a('0x6')](_0x1e74b4,_0x5d9849);_0xfd9781(null);};}for(var e in events){if(events[_0x590a('0x7')](e)){var event=events[e];Dashboard[_0x590a('0x8')](e,emitEvent(event));}}module[_0x590a('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b4bed4e..c36aaa2 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 _0x0a8e=['../../config/logger','api','moment','path','rimraf','./dashboard.attributes','exports','define','util'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x0a8e,0xc5));var _0xe0a8=function(_0x164f36,_0x24abaf){_0x164f36=_0x164f36-0x0;var _0x2d8d96=_0x0a8e[_0x164f36];return _0x2d8d96;};'use strict';var _=require('lodash');var util=require(_0xe0a8('0x0'));var logger=require(_0xe0a8('0x1'))(_0xe0a8('0x2'));var moment=require(_0xe0a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0a8('0x4'));var rimraf=require(_0xe0a8('0x5'));var config=require('../../config/environment');var attributes=require(_0xe0a8('0x6'));module[_0xe0a8('0x7')]=function(_0x542260,_0x3d98bc){return _0x542260[_0xe0a8('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda80=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','api','bluebird','request-promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xda80,0x98));var _0x0da8=function(_0x18a728,_0x1538ed){_0x18a728=_0x18a728-0x0;var _0x2a8604=_0xda80[_0x18a728];return _0x2a8604;};'use strict';var _=require(_0x0da8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0da8('0x1'));var moment=require('moment');var BPromise=require(_0x0da8('0x2'));var rp=require(_0x0da8('0x3'));var fs=require('fs');var path=require(_0x0da8('0x4'));var rimraf=require(_0x0da8('0x5'));var config=require(_0x0da8('0x6'));var attributes=require(_0x0da8('0x7'));module[_0x0da8('0x8')]=function(_0x23185e,_0x5ed584){return _0x23185e[_0x0da8('0x9')](_0x0da8('0xa'),attributes,{'tableName':_0x0da8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ba28be4..ce110c5 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 _0x7d4a=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x7d4a,0x13d));var _0xa7d4=function(_0x1e1bea,_0x41d02){_0x1e1bea=_0x1e1bea-0x0;var _0x1999cb=_0x7d4a[_0x1e1bea];return _0x1999cb;};'use strict';var _=require('lodash');var util=require(_0xa7d4('0x0'));var moment=require(_0xa7d4('0x1'));var BPromise=require(_0xa7d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7d4('0x3'));var db=require(_0xa7d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d4('0x5'))(_0xa7d4('0x6'));var config=require(_0xa7d4('0x7'));var jayson=require(_0xa7d4('0x8'));var client=jayson[_0xa7d4('0x9')][_0xa7d4('0xa')]({'port':0x232a});config[_0xa7d4('0xb')]=_[_0xa7d4('0xc')](config[_0xa7d4('0xb')],{'host':_0xa7d4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7d4('0xb')]));require(_0xa7d4('0xe'))[_0xa7d4('0xf')](socket);function respondWithRpcPromise(_0x2ed04e,_0x57bd27,_0x694b0e){return new BPromise(function(_0x44fb6,_0x4aaf2){return client['request'](_0x2ed04e,_0x694b0e)[_0xa7d4('0x10')](function(_0x1ed934){logger[_0xa7d4('0x11')](_0xa7d4('0x12'),_0x57bd27,_0xa7d4('0x13'));logger[_0xa7d4('0x14')](_0xa7d4('0x15'),_0x57bd27,_0xa7d4('0x13'),JSON[_0xa7d4('0x16')](_0x1ed934));if(_0x1ed934[_0xa7d4('0x17')]){if(_0x1ed934[_0xa7d4('0x17')]['code']===0x1f4){logger['error'](_0xa7d4('0x12'),_0x57bd27,_0x1ed934['error'][_0xa7d4('0x18')]);return _0x4aaf2(_0x1ed934['error']['message']);}logger[_0xa7d4('0x17')](_0xa7d4('0x12'),_0x57bd27,_0x1ed934[_0xa7d4('0x17')]['message']);return _0x44fb6(_0x1ed934[_0xa7d4('0x17')][_0xa7d4('0x18')]);}else{logger[_0xa7d4('0x11')](_0xa7d4('0x12'),_0x57bd27,_0xa7d4('0x13'));_0x44fb6(_0x1ed934[_0xa7d4('0x19')][_0xa7d4('0x18')]);}})['catch'](function(_0xe12d8b){logger[_0xa7d4('0x17')]('Dashboard,\x20%s,\x20%s',_0x57bd27,_0xe12d8b);_0x4aaf2(_0xe12d8b);});});} \ No newline at end of file +var _0x8ade=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x137a39,_0x4e17fe){var _0xee46f2=function(_0x35d0aa){while(--_0x35d0aa){_0x137a39['push'](_0x137a39['shift']());}};_0xee46f2(++_0x4e17fe);}(_0x8ade,0xda));var _0xe8ad=function(_0x39110a,_0x32f86e){_0x39110a=_0x39110a-0x0;var _0x563bbe=_0x8ade[_0x39110a];return _0x563bbe;};'use strict';var _=require(_0xe8ad('0x0'));var util=require(_0xe8ad('0x1'));var moment=require(_0xe8ad('0x2'));var BPromise=require(_0xe8ad('0x3'));var rs=require(_0xe8ad('0x4'));var fs=require('fs');var Redis=require(_0xe8ad('0x5'));var db=require(_0xe8ad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8ad('0x7'))(_0xe8ad('0x8'));var config=require(_0xe8ad('0x9'));var jayson=require(_0xe8ad('0xa'));var client=jayson[_0xe8ad('0xb')][_0xe8ad('0xc')]({'port':0x232a});config[_0xe8ad('0xd')]=_[_0xe8ad('0xe')](config['redis'],{'host':_0xe8ad('0xf'),'port':0x18eb});var socket=require(_0xe8ad('0x10'))(new Redis(config[_0xe8ad('0xd')]));require(_0xe8ad('0x11'))[_0xe8ad('0x12')](socket);function respondWithRpcPromise(_0x398722,_0x24a056,_0x408dad){return new BPromise(function(_0x3103db,_0x18c988){return client[_0xe8ad('0x13')](_0x398722,_0x408dad)[_0xe8ad('0x14')](function(_0x4ca420){logger['info']('Dashboard,\x20%s,\x20%s',_0x24a056,_0xe8ad('0x15'));logger[_0xe8ad('0x16')](_0xe8ad('0x17'),_0x24a056,'request\x20sent',JSON[_0xe8ad('0x18')](_0x4ca420));if(_0x4ca420[_0xe8ad('0x19')]){if(_0x4ca420[_0xe8ad('0x19')][_0xe8ad('0x1a')]===0x1f4){logger[_0xe8ad('0x19')](_0xe8ad('0x1b'),_0x24a056,_0x4ca420[_0xe8ad('0x19')][_0xe8ad('0x1c')]);return _0x18c988(_0x4ca420['error'][_0xe8ad('0x1c')]);}logger[_0xe8ad('0x19')]('Dashboard,\x20%s,\x20%s',_0x24a056,_0x4ca420['error'][_0xe8ad('0x1c')]);return _0x3103db(_0x4ca420[_0xe8ad('0x19')]['message']);}else{logger[_0xe8ad('0x1d')](_0xe8ad('0x1b'),_0x24a056,_0xe8ad('0x15'));_0x3103db(_0x4ca420[_0xe8ad('0x1e')][_0xe8ad('0x1c')]);}})[_0xe8ad('0x1f')](function(_0x185749){logger[_0xe8ad('0x19')]('Dashboard,\x20%s,\x20%s',_0x24a056,_0x185749);_0x18c988(_0x185749);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a4103c6..71de757 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 _0x69a3=['removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x14ae77,_0x2c4bda){var _0x31e534=function(_0x175e62){while(--_0x175e62){_0x14ae77['push'](_0x14ae77['shift']());}};_0x31e534(++_0x2c4bda);}(_0x69a3,0x112));var _0x369a=function(_0x14ba81,_0x2d7cd8){_0x14ba81=_0x14ba81-0x0;var _0x1b0b2f=_0x69a3[_0x14ba81];return _0x1b0b2f;};'use strict';var DashboardEvents=require(_0x369a('0x0'));var events=['save',_0x369a('0x1'),'update'];function createListener(_0x3bafe7,_0x3a42d3){return function(_0x288965){_0x3a42d3['emit'](_0x3bafe7,_0x288965);};}function removeListener(_0x5a1376,_0x50011e){return function(){DashboardEvents[_0x369a('0x2')](_0x5a1376,_0x50011e);};}exports[_0x369a('0x3')]=function(_0x4b1a92){for(var _0x367058=0x0,_0x574b7f=events[_0x369a('0x4')];_0x367058<_0x574b7f;_0x367058++){var _0x312bda=events[_0x367058];var _0x1dbf63=createListener(_0x369a('0x5')+_0x312bda,_0x4b1a92);DashboardEvents['on'](_0x312bda,_0x1dbf63);}}; \ No newline at end of file +var _0xca2f=['emit','register','length','remove','update'];(function(_0x7cbd6e,_0x7e214a){var _0x4c7de9=function(_0x2bc16a){while(--_0x2bc16a){_0x7cbd6e['push'](_0x7cbd6e['shift']());}};_0x4c7de9(++_0x7e214a);}(_0xca2f,0xcb));var _0xfca2=function(_0x51f194,_0x2379d7){_0x51f194=_0x51f194-0x0;var _0x23fb69=_0xca2f[_0x51f194];return _0x23fb69;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xfca2('0x0'),_0xfca2('0x1')];function createListener(_0xc80783,_0x2a2a2a){return function(_0x2f1752){_0x2a2a2a[_0xfca2('0x2')](_0xc80783,_0x2f1752);};}function removeListener(_0x1bdbc2,_0x3b7d06){return function(){DashboardEvents['removeListener'](_0x1bdbc2,_0x3b7d06);};}exports[_0xfca2('0x3')]=function(_0x1e8217){for(var _0x332120=0x0,_0x39d39c=events[_0xfca2('0x4')];_0x332120<_0x39d39c;_0x332120++){var _0x184c04=events[_0x332120];var _0x40e3d8=createListener('dashboard:'+_0x184c04,_0x1e8217);DashboardEvents['on'](_0x184c04,_0x40e3d8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 06200d8..732964f 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 _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(_0xe24841,_0x2c0f66){var _0x2e41b3=function(_0xd50fbe){while(--_0xd50fbe){_0xe24841['push'](_0xe24841['shift']());}};_0x2e41b3(++_0x2c0f66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xcb91[_0x3d4ef1];return _0x409423;};'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 +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x2e1238,_0x39a36f){var _0x10f14d=function(_0x31502b){while(--_0x31502b){_0x2e1238['push'](_0x2e1238['shift']());}};_0x10f14d(++_0x39a36f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 25804c0..750e228 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 _0x93d5=['getDataValue','setDataValue','attrs','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse'];(function(_0x20d02b,_0x59f41b){var _0x48b984=function(_0x5be351){while(--_0x5be351){_0x20d02b['push'](_0x20d02b['shift']());}};_0x48b984(++_0x59f41b);}(_0x93d5,0x1da));var _0x593d=function(_0x2f6bf1,_0xa0beb8){_0x2f6bf1=_0x2f6bf1-0x0;var _0x49cd45=_0x93d5[_0x2f6bf1];return _0x49cd45;};'use strict';var Sequelize=require(_0x593d('0x0'));var squel=require(_0x593d('0x1'));var _=require(_0x593d('0x2'));module[_0x593d('0x3')]={'title':{'type':Sequelize[_0x593d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x593d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x593d('0x5')]('long'),'get':function(){try{return JSON[_0x593d('0x6')](this[_0x593d('0x7')]('attrs'));}catch(_0x32b1bd){return[];}},'set':function(_0x22efd9){try{this[_0x593d('0x8')](_0x593d('0x9'),JSON['stringify'](_0x22efd9));}catch(_0x3ec258){this[_0x593d('0x8')](_0x593d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x593d('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x593d('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x593d('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x593d('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x593d('0x4')],'allowNull':![],'defaultValue':_0x593d('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x593d('0x4')]}}; \ No newline at end of file +var _0x3a1f=['#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x1c3186,_0x24126e){var _0x5df9ed=function(_0x4c5da2){while(--_0x4c5da2){_0x1c3186['push'](_0x1c3186['shift']());}};_0x5df9ed(++_0x24126e);}(_0x3a1f,0x14b));var _0xf3a1=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x3a1f[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0xf3a1('0x0'));var squel=require(_0xf3a1('0x1'));var _=require(_0xf3a1('0x2'));module[_0xf3a1('0x3')]={'title':{'type':Sequelize[_0xf3a1('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xf3a1('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf3a1('0x5')](_0xf3a1('0x6')),'get':function(){try{return JSON[_0xf3a1('0x7')](this[_0xf3a1('0x8')](_0xf3a1('0x9')));}catch(_0x2e4168){return[];}},'set':function(_0x33ebd6){try{this[_0xf3a1('0xa')](_0xf3a1('0x9'),JSON[_0xf3a1('0xb')](_0x33ebd6));}catch(_0x24725b){this[_0xf3a1('0xa')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf3a1('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf3a1('0xc')]},'col':{'type':Sequelize[_0xf3a1('0xc')]},'background':{'type':Sequelize[_0xf3a1('0x4')],'allowNull':![],'defaultValue':_0xf3a1('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xf3a1('0x4')],'allowNull':![],'defaultValue':_0xf3a1('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf3a1('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 37702e7..5998faf 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 _0x5a58=['attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','rimraf','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x3ce996,_0x3da2e6){var _0x57f1dc=function(_0x39a1b1){while(--_0x39a1b1){_0x3ce996['push'](_0x3ce996['shift']());}};_0x57f1dc(++_0x3da2e6);}(_0x5a58,0x119));var _0x85a5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5a58[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x85a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x85a5('0x2'));var Mustache=require('mustache');var util=require(_0x85a5('0x3'));var path=require(_0x85a5('0x4'));var sox=require(_0x85a5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x85a5('0x6'));var squel=require(_0x85a5('0x7'));var crypto=require('crypto');var jsforce=require(_0x85a5('0x8'));var deskjs=require(_0x85a5('0x9'));var toCsv=require(_0x85a5('0xa'));var querystring=require(_0x85a5('0xb'));var Papa=require(_0x85a5('0xc'));var Redis=require('ioredis');var authService=require(_0x85a5('0xd'));var qs=require(_0x85a5('0xe'));var as=require(_0x85a5('0xf'));var hardwareService=require(_0x85a5('0x10'));var logger=require(_0x85a5('0x11'))(_0x85a5('0x12'));var utils=require(_0x85a5('0x13'));var config=require(_0x85a5('0x14'));var db=require(_0x85a5('0x15'))['db'];config[_0x85a5('0x16')]=_[_0x85a5('0x17')](config[_0x85a5('0x16')],{'host':_0x85a5('0x18'),'port':0x18eb});var socket=require(_0x85a5('0x19'))(new Redis(config[_0x85a5('0x16')]));require(_0x85a5('0x1a'))[_0x85a5('0x1b')](socket);function respondWithStatusCode(_0x47a3a7,_0x2bf361){_0x2bf361=_0x2bf361||0xcc;return function(_0x44993d){if(_0x44993d){return _0x47a3a7[_0x85a5('0x1c')](_0x2bf361);}return _0x47a3a7[_0x85a5('0x1d')](_0x2bf361)[_0x85a5('0x1e')]();};}function respondWithResult(_0x55b803,_0x3fedb7){_0x3fedb7=_0x3fedb7||0xc8;return function(_0x414c9f){if(_0x414c9f){return _0x55b803[_0x85a5('0x1d')](_0x3fedb7)[_0x85a5('0x1f')](_0x414c9f);}};}function respondWithFilteredResult(_0x378fcd,_0x44a85d){return function(_0x178495){if(_0x178495){var _0x246fa2=_0x178495[_0x85a5('0x20')],_0x4faddf=_0x44a85d[_0x85a5('0x21')],_0x82cee4=_0x44a85d['offset']+_0x44a85d[_0x85a5('0x22')],_0x296325;if(_0x82cee4>=_0x246fa2){_0x82cee4=_0x246fa2;_0x296325=0xc8;}else{_0x296325=0xce;}_0x378fcd[_0x85a5('0x1d')](_0x296325);return _0x378fcd['set'](_0x85a5('0x23'),_0x4faddf+'-'+_0x82cee4+'/'+_0x246fa2)['json'](_0x178495);}return null;};}function patchUpdates(_0x283903){return function(_0x56b31d){try{jsonpatch['apply'](_0x56b31d,_0x283903,!![]);}catch(_0x117639){return BPromise[_0x85a5('0x24')](_0x117639);}return _0x56b31d['save']();};}function saveUpdates(_0xd89aa2,_0x21de22){return function(_0x2a889f){if(_0x2a889f){return _0x2a889f[_0x85a5('0x25')](_0xd89aa2)[_0x85a5('0x26')](function(_0x37686d){return _0x37686d;});}return null;};}function removeEntity(_0x29769e,_0x4643b6){return function(_0x569c1a){if(_0x569c1a){return _0x569c1a[_0x85a5('0x27')]()[_0x85a5('0x26')](function(){_0x29769e[_0x85a5('0x1d')](0xcc)[_0x85a5('0x1e')]();});}};}function handleEntityNotFound(_0x522644,_0x46e037){return function(_0x443621){if(!_0x443621){_0x522644[_0x85a5('0x1c')](0x194);}return _0x443621;};}function handleError(_0x28e175,_0x2676cb){_0x2676cb=_0x2676cb||0x1f4;return function(_0x2eabfa){logger[_0x85a5('0x28')](_0x2eabfa['stack']);if(_0x2eabfa[_0x85a5('0x29')]){delete _0x2eabfa[_0x85a5('0x29')];}_0x28e175[_0x85a5('0x1d')](_0x2676cb)['send'](_0x2eabfa);};}exports[_0x85a5('0x2a')]=function(_0x2a939e,_0x5c1513){var _0x276367={'raw':![],'where':{'id':_0x2a939e['params']['id']}},_0x324278={};_0x324278[_0x85a5('0x2b')]=_[_0x85a5('0x2c')](db[_0x85a5('0x2d')][_0x85a5('0x2e')]);_0x324278[_0x85a5('0x2f')]=_[_0x85a5('0x2c')](_0x2a939e[_0x85a5('0x2f')]);_0x324278[_0x85a5('0x30')]=_[_0x85a5('0x31')](_0x324278[_0x85a5('0x2b')],_0x324278['query']);_0x276367[_0x85a5('0x32')]=_[_0x85a5('0x31')](_0x324278[_0x85a5('0x2b')],qs['fields'](_0x2a939e[_0x85a5('0x2f')][_0x85a5('0x33')]));_0x276367[_0x85a5('0x32')]=_0x276367[_0x85a5('0x32')]['length']?_0x276367[_0x85a5('0x32')]:_0x324278[_0x85a5('0x2b')];if(_0x2a939e[_0x85a5('0x2f')][_0x85a5('0x34')]){_0x276367[_0x85a5('0x35')]=[{'all':!![]}];}_0x276367=_[_0x85a5('0x36')]({},_0x276367,_0x2a939e[_0x85a5('0x37')]);return db[_0x85a5('0x2d')][_0x85a5('0x38')](_0x276367)['then'](handleEntityNotFound(_0x5c1513,null))['then'](respondWithResult(_0x5c1513,null))['catch'](handleError(_0x5c1513,null));};exports[_0x85a5('0x27')]=function(_0x78f4a9,_0xd6c773){return db['DashboardItem'][_0x85a5('0x38')]({'where':{'id':_0x78f4a9[_0x85a5('0x39')]['id']}})[_0x85a5('0x26')](handleEntityNotFound(_0xd6c773,null))['then'](removeEntity(_0xd6c773,null))[_0x85a5('0x3a')](handleError(_0xd6c773,null));};function widgetAttributes(_0x530013){try{switch(_0x530013[_0x85a5('0x3b')]){case _0x85a5('0x3c'):return[{'name':_0x85a5('0x3d'),'value':_0x530013[_0x85a5('0x3d')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013['attrs'][0x0]?_0x530013['attrs'][0x0][_0x85a5('0x3f')]:undefined)||_0x85a5('0x40')}];case _0x85a5('0x41'):return[{'name':'attrPath','value':_0x530013[_0x85a5('0x42')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x0]?_0x530013[_0x85a5('0x3e')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x530013[_0x85a5('0x43')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x0]?_0x530013[_0x85a5('0x3e')][0x0][_0x85a5('0x3f')]:undefined)||_0x85a5('0x44')},{'name':_0x85a5('0x45'),'value':_0x530013[_0x85a5('0x45')]||(_0x530013['attrs']&&_0x530013[_0x85a5('0x3e')][0x1]?_0x530013[_0x85a5('0x3e')][0x1][_0x85a5('0x3f')]:undefined)||_0x85a5('0x46')},{'name':_0x85a5('0x47'),'value':_0x530013[_0x85a5('0x47')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x2]?_0x530013[_0x85a5('0x3e')][0x2][_0x85a5('0x3f')]:undefined)||0xc}];case _0x85a5('0x48'):return[{'name':_0x85a5('0x49'),'value':_0x530013[_0x85a5('0x49')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x0]?_0x530013[_0x85a5('0x3e')][0x0][_0x85a5('0x3f')]:undefined)||'total'},{'name':_0x85a5('0x4a'),'value':_0x530013['attrVoiceQueues']||(_0x530013[_0x85a5('0x3e')]&&_0x530013['attrs'][0x1]?_0x530013[_0x85a5('0x3e')][0x1][_0x85a5('0x3f')]:undefined)||[]},{'name':_0x85a5('0x47'),'value':_0x530013[_0x85a5('0x47')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x2]?_0x530013[_0x85a5('0x3e')][0x2][_0x85a5('0x3f')]:undefined)||0x14}];case'multibar-chart':case _0x85a5('0x4b'):return[{'name':_0x85a5('0x4c'),'value':_0x530013[_0x85a5('0x4c')]||(_0x530013['attrs']&&_0x530013[_0x85a5('0x3e')][0x0]?_0x530013[_0x85a5('0x3e')][0x0][_0x85a5('0x3f')]:undefined)||_0x85a5('0x4d')},{'name':_0x85a5('0x4e'),'value':_0x530013[_0x85a5('0x4e')]||(_0x530013['attrs']&&_0x530013[_0x85a5('0x3e')][0x1]?_0x530013[_0x85a5('0x3e')][0x1][_0x85a5('0x3f')]:undefined)||null},{'name':_0x85a5('0x4f'),'value':_0x530013[_0x85a5('0x4f')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x2]?_0x530013[_0x85a5('0x3e')][0x2][_0x85a5('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x530013[_0x85a5('0x4a')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x3]?_0x530013['attrs'][0x3][_0x85a5('0x3f')]:undefined)||[]}];case _0x85a5('0x50'):return[{'name':'attrReport','type':_0x530013[_0x85a5('0x51')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013['attrs'][0x0]?_0x530013['attrs'][0x0][_0x85a5('0x3b')]:undefined)||null,'value':_0x530013[_0x85a5('0x52')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013[_0x85a5('0x3e')][0x0]?_0x530013[_0x85a5('0x3e')][0x0][_0x85a5('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x530013[_0x85a5('0x53')]||(_0x530013[_0x85a5('0x3e')]&&_0x530013['attrs'][0x1]?_0x530013['attrs'][0x1][_0x85a5('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x666f1){logger[_0x85a5('0x28')](_0x85a5('0x54'),JSON['stringify'](_0x666f1));return[];}}exports[_0x85a5('0x55')]=function(_0x14b704,_0x2773f9){if(_0x14b704['body']){_0x14b704[_0x85a5('0x56')][_0x85a5('0x3e')]=widgetAttributes(_0x14b704[_0x85a5('0x56')]);}return db[_0x85a5('0x2d')]['create'](_0x14b704[_0x85a5('0x56')],{})['then'](respondWithResult(_0x2773f9,0xc9))['catch'](handleError(_0x2773f9,null));};exports[_0x85a5('0x25')]=function(_0xe1287b,_0x1b8622){if(_0xe1287b[_0x85a5('0x56')]['id']){delete _0xe1287b[_0x85a5('0x56')]['id'];}_0xe1287b[_0x85a5('0x56')][_0x85a5('0x3e')]=widgetAttributes(_0xe1287b['body']);return db[_0x85a5('0x2d')][_0x85a5('0x38')]({'where':{'id':_0xe1287b[_0x85a5('0x39')]['id']}})[_0x85a5('0x26')](handleEntityNotFound(_0x1b8622,null))[_0x85a5('0x26')](saveUpdates(_0xe1287b[_0x85a5('0x56')],null))[_0x85a5('0x26')](respondWithResult(_0x1b8622,null))[_0x85a5('0x3a')](handleError(_0x1b8622,null));}; \ No newline at end of file +var _0xf7cf=['DashboardItem','catch','find','type','iframe','attrs','https://','custom','attrPath','attrHourFormat','attrTimezone','value','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','query','filters','intersection','fields','attributes','includeAll','merge','options'];(function(_0x9765f2,_0x4fe9c6){var _0x27c61c=function(_0x13876c){while(--_0x13876c){_0x9765f2['push'](_0x9765f2['shift']());}};_0x27c61c(++_0x4fe9c6);}(_0xf7cf,0xc5));var _0xff7c=function(_0x2a3b3e,_0x415238){_0x2a3b3e=_0x2a3b3e-0x0;var _0x3bb5f6=_0xf7cf[_0x2a3b3e];return _0x3bb5f6;};'use strict';var pdf=require(_0xff7c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff7c('0x1'));var zipdir=require(_0xff7c('0x2'));var jsonpatch=require(_0xff7c('0x3'));var rp=require(_0xff7c('0x4'));var moment=require('moment');var BPromise=require(_0xff7c('0x5'));var Mustache=require(_0xff7c('0x6'));var util=require('util');var path=require(_0xff7c('0x7'));var sox=require('sox');var csv=require(_0xff7c('0x8'));var ejs=require(_0xff7c('0x9'));var fs=require('fs');var _=require(_0xff7c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff7c('0xb'));var deskjs=require(_0xff7c('0xc'));var toCsv=require(_0xff7c('0x8'));var querystring=require(_0xff7c('0xd'));var Papa=require(_0xff7c('0xe'));var Redis=require(_0xff7c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xff7c('0x10'));var as=require(_0xff7c('0x11'));var hardwareService=require(_0xff7c('0x12'));var logger=require('../../config/logger')(_0xff7c('0x13'));var utils=require(_0xff7c('0x14'));var config=require(_0xff7c('0x15'));var db=require(_0xff7c('0x16'))['db'];config['redis']=_[_0xff7c('0x17')](config[_0xff7c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xff7c('0x19'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xff7c('0x1a')](socket);function respondWithStatusCode(_0x3e0afa,_0x2cfcc3){_0x2cfcc3=_0x2cfcc3||0xcc;return function(_0x13267d){if(_0x13267d){return _0x3e0afa['sendStatus'](_0x2cfcc3);}return _0x3e0afa[_0xff7c('0x1b')](_0x2cfcc3)[_0xff7c('0x1c')]();};}function respondWithResult(_0x39744c,_0x5203ab){_0x5203ab=_0x5203ab||0xc8;return function(_0x1c5fba){if(_0x1c5fba){return _0x39744c[_0xff7c('0x1b')](_0x5203ab)[_0xff7c('0x1d')](_0x1c5fba);}};}function respondWithFilteredResult(_0x1c3b1c,_0x5df419){return function(_0x2bae17){if(_0x2bae17){var _0x11d01e=_0x2bae17[_0xff7c('0x1e')],_0xb89694=_0x5df419[_0xff7c('0x1f')],_0x394655=_0x5df419[_0xff7c('0x1f')]+_0x5df419[_0xff7c('0x20')],_0x58c200;if(_0x394655>=_0x11d01e){_0x394655=_0x11d01e;_0x58c200=0xc8;}else{_0x58c200=0xce;}_0x1c3b1c[_0xff7c('0x1b')](_0x58c200);return _0x1c3b1c[_0xff7c('0x21')]('Content-Range',_0xb89694+'-'+_0x394655+'/'+_0x11d01e)[_0xff7c('0x1d')](_0x2bae17);}return null;};}function patchUpdates(_0x1c43a7){return function(_0x48bd53){try{jsonpatch[_0xff7c('0x22')](_0x48bd53,_0x1c43a7,!![]);}catch(_0x225fd0){return BPromise[_0xff7c('0x23')](_0x225fd0);}return _0x48bd53['save']();};}function saveUpdates(_0x56b412,_0x12fb31){return function(_0x5631ec){if(_0x5631ec){return _0x5631ec[_0xff7c('0x24')](_0x56b412)[_0xff7c('0x25')](function(_0x4c1e4f){return _0x4c1e4f;});}return null;};}function removeEntity(_0x14929a,_0x33a5d6){return function(_0x88ed2f){if(_0x88ed2f){return _0x88ed2f[_0xff7c('0x26')]()['then'](function(){_0x14929a[_0xff7c('0x1b')](0xcc)[_0xff7c('0x1c')]();});}};}function handleEntityNotFound(_0xd8e186,_0x5408b0){return function(_0x565b36){if(!_0x565b36){_0xd8e186[_0xff7c('0x27')](0x194);}return _0x565b36;};}function handleError(_0x42b371,_0x44a9f3){_0x44a9f3=_0x44a9f3||0x1f4;return function(_0x58f05b){logger[_0xff7c('0x28')](_0x58f05b[_0xff7c('0x29')]);if(_0x58f05b[_0xff7c('0x2a')]){delete _0x58f05b[_0xff7c('0x2a')];}_0x42b371[_0xff7c('0x1b')](_0x44a9f3)[_0xff7c('0x2b')](_0x58f05b);};}exports[_0xff7c('0x2c')]=function(_0x4e0f90,_0x40986e){var _0x14ddde={'raw':![],'where':{'id':_0x4e0f90[_0xff7c('0x2d')]['id']}},_0xe992ee={};_0xe992ee[_0xff7c('0x2e')]=_['keys'](db['DashboardItem']['rawAttributes']);_0xe992ee[_0xff7c('0x2f')]=_['keys'](_0x4e0f90[_0xff7c('0x2f')]);_0xe992ee[_0xff7c('0x30')]=_[_0xff7c('0x31')](_0xe992ee[_0xff7c('0x2e')],_0xe992ee['query']);_0x14ddde['attributes']=_['intersection'](_0xe992ee['model'],qs[_0xff7c('0x32')](_0x4e0f90[_0xff7c('0x2f')]['fields']));_0x14ddde[_0xff7c('0x33')]=_0x14ddde['attributes']['length']?_0x14ddde[_0xff7c('0x33')]:_0xe992ee[_0xff7c('0x2e')];if(_0x4e0f90[_0xff7c('0x2f')][_0xff7c('0x34')]){_0x14ddde['include']=[{'all':!![]}];}_0x14ddde=_[_0xff7c('0x35')]({},_0x14ddde,_0x4e0f90[_0xff7c('0x36')]);return db[_0xff7c('0x37')]['find'](_0x14ddde)['then'](handleEntityNotFound(_0x40986e,null))[_0xff7c('0x25')](respondWithResult(_0x40986e,null))[_0xff7c('0x38')](handleError(_0x40986e,null));};exports['destroy']=function(_0xb53f05,_0x342c36){return db[_0xff7c('0x37')][_0xff7c('0x39')]({'where':{'id':_0xb53f05[_0xff7c('0x2d')]['id']}})[_0xff7c('0x25')](handleEntityNotFound(_0x342c36,null))[_0xff7c('0x25')](removeEntity(_0x342c36,null))[_0xff7c('0x38')](handleError(_0x342c36,null));};function widgetAttributes(_0x2cf042){try{switch(_0x2cf042[_0xff7c('0x3a')]){case _0xff7c('0x3b'):return[{'name':'attrUrl','value':_0x2cf042['attrUrl']||(_0x2cf042['attrs']&&_0x2cf042['attrs'][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0]['value']:undefined)||_0xff7c('0x3d')}];case _0xff7c('0x3e'):return[{'name':_0xff7c('0x3f'),'value':_0x2cf042['attrPath']||(_0x2cf042['attrs']&&_0x2cf042['attrs'][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2cf042[_0xff7c('0x40')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xff7c('0x41'),'value':_0x2cf042[_0xff7c('0x41')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x1]?_0x2cf042[_0xff7c('0x3c')][0x1][_0xff7c('0x42')]:undefined)||_0xff7c('0x43')},{'name':_0xff7c('0x44'),'value':_0x2cf042[_0xff7c('0x44')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042['attrs'][0x2]?_0x2cf042[_0xff7c('0x3c')][0x2][_0xff7c('0x42')]:undefined)||0xc}];case _0xff7c('0x45'):return[{'name':'attrMetric','value':_0x2cf042[_0xff7c('0x46')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042['attrs'][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0]['value']:undefined)||_0xff7c('0x47')},{'name':_0xff7c('0x48'),'value':_0x2cf042[_0xff7c('0x48')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042['attrs'][0x1]?_0x2cf042[_0xff7c('0x3c')][0x1]['value']:undefined)||[]},{'name':_0xff7c('0x44'),'value':_0x2cf042[_0xff7c('0x44')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x2]?_0x2cf042[_0xff7c('0x3c')][0x2][_0xff7c('0x42')]:undefined)||0x14}];case'multibar-chart':case _0xff7c('0x49'):return[{'name':_0xff7c('0x4a'),'value':_0x2cf042[_0xff7c('0x4a')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0][_0xff7c('0x42')]:undefined)||'total'},{'name':'attrSerie2','value':_0x2cf042[_0xff7c('0x4b')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x1]?_0x2cf042[_0xff7c('0x3c')][0x1][_0xff7c('0x42')]:undefined)||null},{'name':_0xff7c('0x4c'),'value':_0x2cf042['attrSerie3']||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x2]?_0x2cf042[_0xff7c('0x3c')][0x2]['value']:undefined)||null},{'name':_0xff7c('0x48'),'value':_0x2cf042[_0xff7c('0x48')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x3]?_0x2cf042[_0xff7c('0x3c')][0x3][_0xff7c('0x42')]:undefined)||[]}];case _0xff7c('0x4d'):return[{'name':_0xff7c('0x4e'),'type':_0x2cf042['reportType']||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042['attrs'][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0][_0xff7c('0x3a')]:undefined)||null,'value':_0x2cf042[_0xff7c('0x4e')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042[_0xff7c('0x3c')][0x0]?_0x2cf042[_0xff7c('0x3c')][0x0]['value']:undefined)||null},{'name':_0xff7c('0x4f'),'value':_0x2cf042[_0xff7c('0x4f')]||(_0x2cf042[_0xff7c('0x3c')]&&_0x2cf042['attrs'][0x1]?_0x2cf042[_0xff7c('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x442039){logger[_0xff7c('0x28')](_0xff7c('0x50'),JSON[_0xff7c('0x51')](_0x442039));return[];}}exports[_0xff7c('0x52')]=function(_0x49f60a,_0xf1d528){if(_0x49f60a['body']){_0x49f60a[_0xff7c('0x53')][_0xff7c('0x3c')]=widgetAttributes(_0x49f60a[_0xff7c('0x53')]);}return db[_0xff7c('0x37')][_0xff7c('0x52')](_0x49f60a[_0xff7c('0x53')],{})[_0xff7c('0x25')](respondWithResult(_0xf1d528,0xc9))[_0xff7c('0x38')](handleError(_0xf1d528,null));};exports[_0xff7c('0x24')]=function(_0x2d06dc,_0x4609dc){if(_0x2d06dc[_0xff7c('0x53')]['id']){delete _0x2d06dc[_0xff7c('0x53')]['id'];}_0x2d06dc['body']['attrs']=widgetAttributes(_0x2d06dc['body']);return db['DashboardItem'][_0xff7c('0x39')]({'where':{'id':_0x2d06dc['params']['id']}})[_0xff7c('0x25')](handleEntityNotFound(_0x4609dc,null))['then'](saveUpdates(_0x2d06dc[_0xff7c('0x53')],null))[_0xff7c('0x25')](respondWithResult(_0x4609dc,null))[_0xff7c('0x38')](handleError(_0x4609dc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9e537db..be55a6d 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 _0x29d4=['save','update','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x29d4,0x1a1));var _0x429d=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x29d4[_0x311c35];return _0x5cc50c;};'use strict';var EventEmitter=require(_0x429d('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x429d('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x429d('0x2')](0x0);var events={'afterCreate':_0x429d('0x3'),'afterUpdate':_0x429d('0x4'),'afterDestroy':_0x429d('0x5')};function emitEvent(_0x4e287b){return function(_0xc3989d,_0x3f43f5,_0x36a3d8){DashboardItemEvents[_0x429d('0x6')](_0x4e287b+':'+_0xc3989d['id'],_0xc3989d);DashboardItemEvents[_0x429d('0x6')](_0x4e287b,_0xc3989d);_0x36a3d8(null);};}for(var e in events){if(events[_0x429d('0x7')](e)){var event=events[e];DashboardItem[_0x429d('0x8')](e,emitEvent(event));}}module[_0x429d('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x255c=['hook','events','../../mysqldb','save','update','emit'];(function(_0x478a4c,_0x5dd168){var _0x47107d=function(_0x1cd2aa){while(--_0x1cd2aa){_0x478a4c['push'](_0x478a4c['shift']());}};_0x47107d(++_0x5dd168);}(_0x255c,0xfd));var _0xc255=function(_0x1ca4b7,_0x3e0323){_0x1ca4b7=_0x1ca4b7-0x0;var _0x485d56=_0x255c[_0x1ca4b7];return _0x485d56;};'use strict';var EventEmitter=require(_0xc255('0x0'));var DashboardItem=require(_0xc255('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc255('0x2'),'afterUpdate':_0xc255('0x3'),'afterDestroy':'remove'};function emitEvent(_0x532582){return function(_0x4f9cd6,_0x339516,_0x3852b7){DashboardItemEvents[_0xc255('0x4')](_0x532582+':'+_0x4f9cd6['id'],_0x4f9cd6);DashboardItemEvents[_0xc255('0x4')](_0x532582,_0x4f9cd6);_0x3852b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xc255('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2986d38..befe5de 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 _0x3714=['define','DashboardItem','dashboard_items','lodash','api','bluebird','request-promise','path','./dashboardItem.attributes','exports'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x3714,0x111));var _0x4371=function(_0x3ba111,_0x34c6cd){_0x3ba111=_0x3ba111-0x0;var _0x456074=_0x3714[_0x3ba111];return _0x456074;};'use strict';var _=require(_0x4371('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4371('0x1'));var moment=require('moment');var BPromise=require(_0x4371('0x2'));var rp=require(_0x4371('0x3'));var fs=require('fs');var path=require(_0x4371('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4371('0x5'));module[_0x4371('0x6')]=function(_0x15f786,_0x36e376){return _0x15f786[_0x4371('0x7')](_0x4371('0x8'),attributes,{'tableName':_0x4371('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90a5=['dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','define','DashboardItem'];(function(_0x57dd6b,_0x33d298){var _0x124079=function(_0x251d64){while(--_0x251d64){_0x57dd6b['push'](_0x57dd6b['shift']());}};_0x124079(++_0x33d298);}(_0x90a5,0x146));var _0x590a=function(_0x1be299,_0x2b3798){_0x1be299=_0x1be299-0x0;var _0x213246=_0x90a5[_0x1be299];return _0x213246;};'use strict';var _=require(_0x590a('0x0'));var util=require(_0x590a('0x1'));var logger=require(_0x590a('0x2'))(_0x590a('0x3'));var moment=require(_0x590a('0x4'));var BPromise=require(_0x590a('0x5'));var rp=require(_0x590a('0x6'));var fs=require('fs');var path=require(_0x590a('0x7'));var rimraf=require(_0x590a('0x8'));var config=require('../../config/environment');var attributes=require(_0x590a('0x9'));module['exports']=function(_0x3a25f1,_0x2125cb){return _0x3a25f1[_0x590a('0xa')](_0x590a('0xb'),attributes,{'tableName':_0x590a('0xc'),'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 4e6a382..5ac54c9 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 _0xbcd4=['DashboardItem,\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','redis','defaults','localhost','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbcd4,0x19c));var _0x4bcd=function(_0x16b002,_0x16df14){_0x16b002=_0x16b002-0x0;var _0x409dab=_0xbcd4[_0x16b002];return _0x409dab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4bcd('0x0'));var BPromise=require(_0x4bcd('0x1'));var rs=require(_0x4bcd('0x2'));var fs=require('fs');var Redis=require(_0x4bcd('0x3'));var db=require(_0x4bcd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bcd('0x5'))(_0x4bcd('0x6'));var config=require(_0x4bcd('0x7'));var jayson=require(_0x4bcd('0x8'));var client=jayson[_0x4bcd('0x9')][_0x4bcd('0xa')]({'port':0x232a});config[_0x4bcd('0xb')]=_[_0x4bcd('0xc')](config[_0x4bcd('0xb')],{'host':_0x4bcd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bcd('0xb')]));require(_0x4bcd('0xe'))[_0x4bcd('0xf')](socket);function respondWithRpcPromise(_0x4d9db6,_0x42443f,_0x1be8d3){return new BPromise(function(_0x20846b,_0x367446){return client['request'](_0x4d9db6,_0x1be8d3)['then'](function(_0x1a0b91){logger[_0x4bcd('0x10')](_0x4bcd('0x11'),_0x42443f,_0x4bcd('0x12'));logger[_0x4bcd('0x13')](_0x4bcd('0x14'),_0x42443f,'request\x20sent',JSON[_0x4bcd('0x15')](_0x1a0b91));if(_0x1a0b91[_0x4bcd('0x16')]){if(_0x1a0b91['error'][_0x4bcd('0x17')]===0x1f4){logger[_0x4bcd('0x16')](_0x4bcd('0x11'),_0x42443f,_0x1a0b91[_0x4bcd('0x16')]['message']);return _0x367446(_0x1a0b91[_0x4bcd('0x16')][_0x4bcd('0x18')]);}logger['error'](_0x4bcd('0x11'),_0x42443f,_0x1a0b91[_0x4bcd('0x16')][_0x4bcd('0x18')]);return _0x20846b(_0x1a0b91[_0x4bcd('0x16')][_0x4bcd('0x18')]);}else{logger[_0x4bcd('0x10')]('DashboardItem,\x20%s,\x20%s',_0x42443f,'request\x20sent');_0x20846b(_0x1a0b91[_0x4bcd('0x19')][_0x4bcd('0x18')]);}})[_0x4bcd('0x1a')](function(_0x183997){logger[_0x4bcd('0x16')](_0x4bcd('0x11'),_0x42443f,_0x183997);_0x367446(_0x183997);});});} \ No newline at end of file +var _0xe5a2=['socket.io-emitter','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x25a5cc,_0x29d283){var _0x42b15e=function(_0x2dba9e){while(--_0x2dba9e){_0x25a5cc['push'](_0x25a5cc['shift']());}};_0x42b15e(++_0x29d283);}(_0xe5a2,0x188));var _0x2e5a=function(_0x49c65f,_0xc83bf7){_0x49c65f=_0x49c65f-0x0;var _0xc89c94=_0xe5a2[_0x49c65f];return _0xc89c94;};'use strict';var _=require(_0x2e5a('0x0'));var util=require(_0x2e5a('0x1'));var moment=require('moment');var BPromise=require(_0x2e5a('0x2'));var rs=require(_0x2e5a('0x3'));var fs=require('fs');var Redis=require(_0x2e5a('0x4'));var db=require(_0x2e5a('0x5'))['db'];var utils=require(_0x2e5a('0x6'));var logger=require(_0x2e5a('0x7'))(_0x2e5a('0x8'));var config=require(_0x2e5a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2e5a('0xa')][_0x2e5a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2e5a('0xc')],{'host':_0x2e5a('0xd'),'port':0x18eb});var socket=require(_0x2e5a('0xe'))(new Redis(config[_0x2e5a('0xc')]));require('./dashboardItem.socket')[_0x2e5a('0xf')](socket);function respondWithRpcPromise(_0x244ca9,_0x2123f0,_0x44b8fa){return new BPromise(function(_0x184d24,_0x565bdc){return client[_0x2e5a('0x10')](_0x244ca9,_0x44b8fa)[_0x2e5a('0x11')](function(_0x46bf1d){logger[_0x2e5a('0x12')]('DashboardItem,\x20%s,\x20%s',_0x2123f0,_0x2e5a('0x13'));logger[_0x2e5a('0x14')](_0x2e5a('0x15'),_0x2123f0,'request\x20sent',JSON[_0x2e5a('0x16')](_0x46bf1d));if(_0x46bf1d[_0x2e5a('0x17')]){if(_0x46bf1d[_0x2e5a('0x17')][_0x2e5a('0x18')]===0x1f4){logger[_0x2e5a('0x17')](_0x2e5a('0x19'),_0x2123f0,_0x46bf1d[_0x2e5a('0x17')]['message']);return _0x565bdc(_0x46bf1d[_0x2e5a('0x17')][_0x2e5a('0x1a')]);}logger[_0x2e5a('0x17')](_0x2e5a('0x19'),_0x2123f0,_0x46bf1d['error']['message']);return _0x184d24(_0x46bf1d[_0x2e5a('0x17')][_0x2e5a('0x1a')]);}else{logger[_0x2e5a('0x12')]('DashboardItem,\x20%s,\x20%s',_0x2123f0,_0x2e5a('0x13'));_0x184d24(_0x46bf1d[_0x2e5a('0x1b')][_0x2e5a('0x1a')]);}})[_0x2e5a('0x1c')](function(_0x3a1204){logger[_0x2e5a('0x17')](_0x2e5a('0x19'),_0x2123f0,_0x3a1204);_0x565bdc(_0x3a1204);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6aaad1e..1b7e293 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 _0x77db=['emit','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x77db,0x11c));var _0xb77d=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x77db[_0x28f32c];return _0x355402;};'use strict';var DashboardItemEvents=require(_0xb77d('0x0'));var events=[_0xb77d('0x1'),_0xb77d('0x2'),'update'];function createListener(_0x3a5096,_0x176866){return function(_0x236484){_0x176866[_0xb77d('0x3')](_0x3a5096,_0x236484);};}function removeListener(_0x5412d7,_0x33b3b6){return function(){DashboardItemEvents['removeListener'](_0x5412d7,_0x33b3b6);};}exports[_0xb77d('0x4')]=function(_0x526ae3){for(var _0x2f2e70=0x0,_0x1bca4d=events[_0xb77d('0x5')];_0x2f2e70<_0x1bca4d;_0x2f2e70++){var _0x4d8365=events[_0x2f2e70];var _0x16d0d4=createListener(_0xb77d('0x6')+_0x4d8365,_0x526ae3);DashboardItemEvents['on'](_0x4d8365,_0x16d0d4);}}; \ No newline at end of file +var _0x162c=['dashboardItem:','./dashboardItem.events','emit'];(function(_0xe480b1,_0x551e26){var _0x2fbf55=function(_0x158b5c){while(--_0x158b5c){_0xe480b1['push'](_0xe480b1['shift']());}};_0x2fbf55(++_0x551e26);}(_0x162c,0x154));var _0xc162=function(_0x21d717,_0x57342b){_0x21d717=_0x21d717-0x0;var _0xfdde90=_0x162c[_0x21d717];return _0xfdde90;};'use strict';var DashboardItemEvents=require(_0xc162('0x0'));var events=['save','remove','update'];function createListener(_0x2b586b,_0x293f5e){return function(_0x12a126){_0x293f5e[_0xc162('0x1')](_0x2b586b,_0x12a126);};}function removeListener(_0x40a056,_0x4002be){return function(){DashboardItemEvents['removeListener'](_0x40a056,_0x4002be);};}exports['register']=function(_0x663b4a){for(var _0xababf7=0x0,_0x4332fd=events['length'];_0xababf7<_0x4332fd;_0xababf7++){var _0x412e00=events[_0xababf7];var _0x48982b=createListener(_0xc162('0x2')+_0x412e00,_0x663b4a);DashboardItemEvents['on'](_0x412e00,_0x48982b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2bab288..06232e3 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 _0x31f0=['create','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','post'];(function(_0x64bfc4,_0x46d7fe){var _0x4f6d04=function(_0x4db4bd){while(--_0x4db4bd){_0x64bfc4['push'](_0x64bfc4['shift']());}};_0x4f6d04(++_0x46d7fe);}(_0x31f0,0xb7));var _0x031f=function(_0x3059ae,_0x3a8d09){_0x3059ae=_0x3059ae-0x0;var _0x318044=_0x31f0[_0x3059ae];return _0x318044;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x031f('0x8')]('/',auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller['update']);router[_0x031f('0xd')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller[_0x031f('0xe')]);module[_0x031f('0xf')]=router; \ No newline at end of file +var _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x1d1d0f,_0x2984c3){var _0x18bde0=function(_0x1f5084){while(--_0x1f5084){_0x1d1d0f['push'](_0x1d1d0f['shift']());}};_0x18bde0(++_0x2984c3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x464149,_0x10a59d){_0x464149=_0x464149-0x0;var _0x1d9296=_0xdbf5[_0x464149];return _0x1d9296;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 75463a9..7182fd1 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 _0x30e5=['STRING','sequelize'];(function(_0x3a95be,_0x918035){var _0x409d55=function(_0x26738f){while(--_0x26738f){_0x3a95be['push'](_0x3a95be['shift']());}};_0x409d55(++_0x918035);}(_0x30e5,0x11f));var _0x530e=function(_0x5000f8,_0x142d82){_0x5000f8=_0x5000f8-0x0;var _0xab04e7=_0x30e5[_0x5000f8];return _0xab04e7;};'use strict';var Sequelize=require(_0x530e('0x0'));module['exports']={'name':{'type':Sequelize[_0x530e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x53f7=['exports','STRING','sequelize'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x53f7,0x12b));var _0x753f=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x53f7[_0x4169d8];return _0x32084a;};'use strict';var Sequelize=require(_0x753f('0x0'));module[_0x753f('0x1')]={'name':{'type':Sequelize[_0x753f('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 f08f4e1..7783c04 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 _0x41be=['sox','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','Disposition','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4c2a64,_0x5291b6){var _0x5e544f=function(_0x4fff98){while(--_0x4fff98){_0x4c2a64['push'](_0x4c2a64['shift']());}};_0x5e544f(++_0x5291b6);}(_0x41be,0x1c5));var _0xe41b=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x41be[_0x593752];return _0x4612be;};'use strict';var pdf=require(_0xe41b('0x0'));var emlformat=require(_0xe41b('0x1'));var rimraf=require(_0xe41b('0x2'));var zipdir=require(_0xe41b('0x3'));var jsonpatch=require(_0xe41b('0x4'));var rp=require(_0xe41b('0x5'));var moment=require(_0xe41b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe41b('0x7'));var util=require(_0xe41b('0x8'));var path=require('path');var sox=require(_0xe41b('0x9'));var csv=require('to-csv');var ejs=require(_0xe41b('0xa'));var fs=require('fs');var _=require(_0xe41b('0xb'));var squel=require(_0xe41b('0xc'));var crypto=require('crypto');var jsforce=require(_0xe41b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe41b('0xe'));var Redis=require(_0xe41b('0xf'));var authService=require(_0xe41b('0x10'));var qs=require(_0xe41b('0x11'));var as=require(_0xe41b('0x12'));var hardwareService=require(_0xe41b('0x13'));var logger=require('../../config/logger')(_0xe41b('0x14'));var utils=require(_0xe41b('0x15'));var config=require(_0xe41b('0x16'));var db=require(_0xe41b('0x17'))['db'];function respondWithStatusCode(_0x5efddd,_0x182b61){_0x182b61=_0x182b61||0xcc;return function(_0xf9b575){if(_0xf9b575){return _0x5efddd[_0xe41b('0x18')](_0x182b61);}return _0x5efddd[_0xe41b('0x19')](_0x182b61)['end']();};}function respondWithResult(_0x299126,_0x569192){_0x569192=_0x569192||0xc8;return function(_0x122fc8){if(_0x122fc8){return _0x299126[_0xe41b('0x19')](_0x569192)[_0xe41b('0x1a')](_0x122fc8);}};}function respondWithFilteredResult(_0x5bdbde,_0x2e6ac8){return function(_0x575b22){if(_0x575b22){var _0x1f0b44=_0x575b22[_0xe41b('0x1b')],_0xc17e3f=_0x2e6ac8[_0xe41b('0x1c')],_0x15baa7=_0x2e6ac8[_0xe41b('0x1c')]+_0x2e6ac8[_0xe41b('0x1d')],_0x46eee0;if(_0x15baa7>=_0x1f0b44){_0x15baa7=_0x1f0b44;_0x46eee0=0xc8;}else{_0x46eee0=0xce;}_0x5bdbde['status'](_0x46eee0);return _0x5bdbde['set']('Content-Range',_0xc17e3f+'-'+_0x15baa7+'/'+_0x1f0b44)['json'](_0x575b22);}return null;};}function patchUpdates(_0x2bf0be){return function(_0x99b9f9){try{jsonpatch['apply'](_0x99b9f9,_0x2bf0be,!![]);}catch(_0x38007e){return BPromise['reject'](_0x38007e);}return _0x99b9f9[_0xe41b('0x1e')]();};}function saveUpdates(_0x2b6675,_0x5f25a7){return function(_0x3a7481){if(_0x3a7481){return _0x3a7481['update'](_0x2b6675)[_0xe41b('0x1f')](function(_0x215bc){return _0x215bc;});}return null;};}function removeEntity(_0x5cc408,_0x4c68f3){return function(_0x3bb0c0){if(_0x3bb0c0){return _0x3bb0c0[_0xe41b('0x20')]()[_0xe41b('0x1f')](function(){var _0x4d2ac5=_0x3bb0c0[_0xe41b('0x21')]({'plain':!![]});var _0x4a0f24=_0xe41b('0x22');return db[_0xe41b('0x23')]['destroy']({'where':{'type':_0x4a0f24,'resourceId':_0x4d2ac5['id']}})[_0xe41b('0x1f')](function(){return _0x3bb0c0;});})[_0xe41b('0x1f')](function(){_0x5cc408[_0xe41b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b08e,_0x44c6fd){return function(_0x4683d0){if(!_0x4683d0){_0x10b08e[_0xe41b('0x18')](0x194);}return _0x4683d0;};}function handleError(_0x27b545,_0x13c2ca){_0x13c2ca=_0x13c2ca||0x1f4;return function(_0x4584de){logger[_0xe41b('0x24')](_0x4584de[_0xe41b('0x25')]);if(_0x4584de[_0xe41b('0x26')]){delete _0x4584de['name'];}_0x27b545[_0xe41b('0x19')](_0x13c2ca)['send'](_0x4584de);};}exports[_0xe41b('0x27')]=function(_0x3cf39c,_0xc1b6ce){var _0x1903d3={},_0x5c0f51={},_0x53b7cf={'count':0x0,'rows':[]};var _0x1a409d=_[_0xe41b('0x28')](db['Disposition'][_0xe41b('0x29')],function(_0x423428){return{'name':_0x423428['fieldName'],'type':_0x423428[_0xe41b('0x2a')][_0xe41b('0x2b')]};});_0x5c0f51[_0xe41b('0x2c')]=_[_0xe41b('0x28')](_0x1a409d,_0xe41b('0x26'));_0x5c0f51[_0xe41b('0x2d')]=_[_0xe41b('0x2e')](_0x3cf39c[_0xe41b('0x2d')]);_0x5c0f51[_0xe41b('0x2f')]=_[_0xe41b('0x30')](_0x5c0f51[_0xe41b('0x2c')],_0x5c0f51['query']);_0x1903d3[_0xe41b('0x31')]=_['intersection'](_0x5c0f51['model'],qs[_0xe41b('0x32')](_0x3cf39c[_0xe41b('0x2d')][_0xe41b('0x32')]));_0x1903d3[_0xe41b('0x31')]=_0x1903d3[_0xe41b('0x31')]['length']?_0x1903d3[_0xe41b('0x31')]:_0x5c0f51[_0xe41b('0x2c')];if(!_0x3cf39c['query'][_0xe41b('0x33')]('nolimit')){_0x1903d3[_0xe41b('0x1d')]=qs['limit'](_0x3cf39c[_0xe41b('0x2d')]['limit']);_0x1903d3[_0xe41b('0x1c')]=qs['offset'](_0x3cf39c[_0xe41b('0x2d')][_0xe41b('0x1c')]);}_0x1903d3['order']=qs[_0xe41b('0x34')](_0x3cf39c[_0xe41b('0x2d')][_0xe41b('0x34')]);_0x1903d3[_0xe41b('0x35')]=qs[_0xe41b('0x2f')](_['pick'](_0x3cf39c[_0xe41b('0x2d')],_0x5c0f51['filters']),_0x1a409d);if(_0x3cf39c['query'][_0xe41b('0x36')]){_0x1903d3[_0xe41b('0x35')]=_[_0xe41b('0x37')](_0x1903d3[_0xe41b('0x35')],{'$or':_[_0xe41b('0x28')](_0x1a409d,function(_0xad034d){if(_0xad034d[_0xe41b('0x2a')]!==_0xe41b('0x38')){var _0x17733d={};_0x17733d[_0xad034d[_0xe41b('0x26')]]={'$like':'%'+_0x3cf39c[_0xe41b('0x2d')][_0xe41b('0x36')]+'%'};return _0x17733d;}})});}_0x1903d3=_['merge']({},_0x1903d3,_0x3cf39c['options']);var _0x26107e={'where':_0x1903d3['where']};return db[_0xe41b('0x39')][_0xe41b('0x1b')](_0x26107e)[_0xe41b('0x1f')](function(_0x58e2aa){_0x53b7cf[_0xe41b('0x1b')]=_0x58e2aa;if(_0x3cf39c[_0xe41b('0x2d')][_0xe41b('0x3a')]){_0x1903d3[_0xe41b('0x3b')]=[{'all':!![]}];}return db[_0xe41b('0x39')][_0xe41b('0x3c')](_0x1903d3);})[_0xe41b('0x1f')](function(_0x1c066f){_0x53b7cf[_0xe41b('0x3d')]=_0x1c066f;return _0x53b7cf;})[_0xe41b('0x1f')](respondWithFilteredResult(_0xc1b6ce,_0x1903d3))[_0xe41b('0x3e')](handleError(_0xc1b6ce,null));};exports[_0xe41b('0x3f')]=function(_0x732d87,_0x134e37){var _0x2e9dc1={'raw':!![],'where':{'id':_0x732d87[_0xe41b('0x40')]['id']}},_0x1f4e32={};_0x1f4e32[_0xe41b('0x2c')]=_[_0xe41b('0x2e')](db[_0xe41b('0x39')]['rawAttributes']);_0x1f4e32[_0xe41b('0x2d')]=_[_0xe41b('0x2e')](_0x732d87['query']);_0x1f4e32[_0xe41b('0x2f')]=_[_0xe41b('0x30')](_0x1f4e32[_0xe41b('0x2c')],_0x1f4e32['query']);_0x2e9dc1[_0xe41b('0x31')]=_[_0xe41b('0x30')](_0x1f4e32[_0xe41b('0x2c')],qs[_0xe41b('0x32')](_0x732d87[_0xe41b('0x2d')][_0xe41b('0x32')]));_0x2e9dc1['attributes']=_0x2e9dc1['attributes'][_0xe41b('0x41')]?_0x2e9dc1[_0xe41b('0x31')]:_0x1f4e32[_0xe41b('0x2c')];if(_0x732d87[_0xe41b('0x2d')][_0xe41b('0x3a')]){_0x2e9dc1[_0xe41b('0x3b')]=[{'all':!![]}];}_0x2e9dc1=_[_0xe41b('0x37')]({},_0x2e9dc1,_0x732d87[_0xe41b('0x42')]);return db[_0xe41b('0x39')]['find'](_0x2e9dc1)[_0xe41b('0x1f')](handleEntityNotFound(_0x134e37,null))['then'](respondWithResult(_0x134e37,null))[_0xe41b('0x3e')](handleError(_0x134e37,null));};exports[_0xe41b('0x43')]=function(_0x48e107,_0x120e6c){return db[_0xe41b('0x39')][_0xe41b('0x43')](_0x48e107[_0xe41b('0x44')],{})[_0xe41b('0x1f')](function(_0x6b4042){var _0x5da299=_0x48e107[_0xe41b('0x45')][_0xe41b('0x21')]({'plain':!![]});if(!_0x5da299)throw new Error(_0xe41b('0x46'));if(_0x5da299['role']===_0xe41b('0x45')){var _0x2e60b6=_0x6b4042[_0xe41b('0x21')]({'plain':!![]});var _0x163ca3='Dispositions';return db[_0xe41b('0x47')][_0xe41b('0x48')]({'where':{'name':_0x163ca3,'userProfileId':_0x5da299[_0xe41b('0x49')]},'raw':!![]})[_0xe41b('0x1f')](function(_0x13b591){if(_0x13b591&&_0x13b591[_0xe41b('0x4a')]===0x0){return db['UserProfileResource'][_0xe41b('0x43')]({'name':_0x2e60b6[_0xe41b('0x26')],'resourceId':_0x2e60b6['id'],'type':_0x13b591[_0xe41b('0x26')],'sectionId':_0x13b591['id']},{})[_0xe41b('0x1f')](function(){return _0x6b4042;});}else{return _0x6b4042;}})['catch'](function(_0x10a862){logger[_0xe41b('0x24')](_0xe41b('0x4b'),_0x10a862);throw _0x10a862;});}return _0x6b4042;})[_0xe41b('0x1f')](respondWithResult(_0x120e6c,0xc9))[_0xe41b('0x3e')](handleError(_0x120e6c,null));};exports[_0xe41b('0x4c')]=function(_0x2730dd,_0x266918){if(_0x2730dd['body']['id']){delete _0x2730dd[_0xe41b('0x44')]['id'];}return db['Disposition'][_0xe41b('0x48')]({'where':{'id':_0x2730dd[_0xe41b('0x40')]['id']}})['then'](handleEntityNotFound(_0x266918,null))[_0xe41b('0x1f')](saveUpdates(_0x2730dd[_0xe41b('0x44')],null))[_0xe41b('0x1f')](respondWithResult(_0x266918,null))[_0xe41b('0x3e')](handleError(_0x266918,null));};exports[_0xe41b('0x20')]=function(_0x3ab918,_0x1d127c){return db[_0xe41b('0x39')][_0xe41b('0x48')]({'where':{'id':_0x3ab918[_0xe41b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d127c,null))['then'](removeEntity(_0x1d127c,null))[_0xe41b('0x3e')](handleError(_0x1d127c,null));}; \ No newline at end of file +var _0x3bcf=['Content-Range','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','index','map','Disposition','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x25bd30,_0x273220){var _0x5656a0=function(_0x419706){while(--_0x419706){_0x25bd30['push'](_0x25bd30['shift']());}};_0x5656a0(++_0x273220);}(_0x3bcf,0x1c1));var _0xf3bc=function(_0x3eb54c,_0x4dd2ee){_0x3eb54c=_0x3eb54c-0x0;var _0x442d58=_0x3bcf[_0x3eb54c];return _0x442d58;};'use strict';var pdf=require(_0xf3bc('0x0'));var emlformat=require(_0xf3bc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3bc('0x2'));var rp=require(_0xf3bc('0x3'));var moment=require(_0xf3bc('0x4'));var BPromise=require(_0xf3bc('0x5'));var Mustache=require(_0xf3bc('0x6'));var util=require('util');var path=require(_0xf3bc('0x7'));var sox=require(_0xf3bc('0x8'));var csv=require(_0xf3bc('0x9'));var ejs=require(_0xf3bc('0xa'));var fs=require('fs');var _=require(_0xf3bc('0xb'));var squel=require(_0xf3bc('0xc'));var crypto=require(_0xf3bc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3bc('0x9'));var querystring=require(_0xf3bc('0xe'));var Papa=require(_0xf3bc('0xf'));var Redis=require(_0xf3bc('0x10'));var authService=require(_0xf3bc('0x11'));var qs=require(_0xf3bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3bc('0x13'));var logger=require('../../config/logger')(_0xf3bc('0x14'));var utils=require(_0xf3bc('0x15'));var config=require(_0xf3bc('0x16'));var db=require(_0xf3bc('0x17'))['db'];function respondWithStatusCode(_0x517170,_0x4bf93a){_0x4bf93a=_0x4bf93a||0xcc;return function(_0x3e63e8){if(_0x3e63e8){return _0x517170[_0xf3bc('0x18')](_0x4bf93a);}return _0x517170[_0xf3bc('0x19')](_0x4bf93a)['end']();};}function respondWithResult(_0x1d5efb,_0x55d49f){_0x55d49f=_0x55d49f||0xc8;return function(_0x44bb76){if(_0x44bb76){return _0x1d5efb[_0xf3bc('0x19')](_0x55d49f)[_0xf3bc('0x1a')](_0x44bb76);}};}function respondWithFilteredResult(_0xb9d191,_0x5c235f){return function(_0x39e0e4){if(_0x39e0e4){var _0x5725e5=_0x39e0e4[_0xf3bc('0x1b')],_0x307083=_0x5c235f[_0xf3bc('0x1c')],_0x653ba7=_0x5c235f[_0xf3bc('0x1c')]+_0x5c235f[_0xf3bc('0x1d')],_0x58110e;if(_0x653ba7>=_0x5725e5){_0x653ba7=_0x5725e5;_0x58110e=0xc8;}else{_0x58110e=0xce;}_0xb9d191['status'](_0x58110e);return _0xb9d191[_0xf3bc('0x1e')](_0xf3bc('0x1f'),_0x307083+'-'+_0x653ba7+'/'+_0x5725e5)[_0xf3bc('0x1a')](_0x39e0e4);}return null;};}function patchUpdates(_0x1d662a){return function(_0x5569de){try{jsonpatch[_0xf3bc('0x20')](_0x5569de,_0x1d662a,!![]);}catch(_0x1e6d4f){return BPromise[_0xf3bc('0x21')](_0x1e6d4f);}return _0x5569de['save']();};}function saveUpdates(_0x5c9467,_0x36d37f){return function(_0xfc2bbb){if(_0xfc2bbb){return _0xfc2bbb[_0xf3bc('0x22')](_0x5c9467)[_0xf3bc('0x23')](function(_0x1d6b9c){return _0x1d6b9c;});}return null;};}function removeEntity(_0x1c1a08,_0x57faa2){return function(_0x28cbe9){if(_0x28cbe9){return _0x28cbe9[_0xf3bc('0x24')]()[_0xf3bc('0x23')](function(){var _0x1fcfa9=_0x28cbe9[_0xf3bc('0x25')]({'plain':!![]});var _0xd7b4af=_0xf3bc('0x26');return db[_0xf3bc('0x27')]['destroy']({'where':{'type':_0xd7b4af,'resourceId':_0x1fcfa9['id']}})[_0xf3bc('0x23')](function(){return _0x28cbe9;});})['then'](function(){_0x1c1a08['status'](0xcc)[_0xf3bc('0x28')]();});}};}function handleEntityNotFound(_0x22d634,_0x4d0e20){return function(_0x1433b5){if(!_0x1433b5){_0x22d634['sendStatus'](0x194);}return _0x1433b5;};}function handleError(_0x394bbd,_0x1885ee){_0x1885ee=_0x1885ee||0x1f4;return function(_0x458565){logger[_0xf3bc('0x29')](_0x458565[_0xf3bc('0x2a')]);if(_0x458565['name']){delete _0x458565['name'];}_0x394bbd[_0xf3bc('0x19')](_0x1885ee)['send'](_0x458565);};}exports[_0xf3bc('0x2b')]=function(_0x517ee0,_0x5c1bfb){var _0x237df7={},_0x2c91a8={},_0x36f61c={'count':0x0,'rows':[]};var _0x3f0294=_[_0xf3bc('0x2c')](db[_0xf3bc('0x2d')][_0xf3bc('0x2e')],function(_0x55bbbe){return{'name':_0x55bbbe[_0xf3bc('0x2f')],'type':_0x55bbbe[_0xf3bc('0x30')][_0xf3bc('0x31')]};});_0x2c91a8[_0xf3bc('0x32')]=_[_0xf3bc('0x2c')](_0x3f0294,_0xf3bc('0x33'));_0x2c91a8['query']=_[_0xf3bc('0x34')](_0x517ee0[_0xf3bc('0x35')]);_0x2c91a8['filters']=_[_0xf3bc('0x36')](_0x2c91a8[_0xf3bc('0x32')],_0x2c91a8[_0xf3bc('0x35')]);_0x237df7['attributes']=_[_0xf3bc('0x36')](_0x2c91a8[_0xf3bc('0x32')],qs[_0xf3bc('0x37')](_0x517ee0[_0xf3bc('0x35')]['fields']));_0x237df7[_0xf3bc('0x38')]=_0x237df7[_0xf3bc('0x38')]['length']?_0x237df7[_0xf3bc('0x38')]:_0x2c91a8[_0xf3bc('0x32')];if(!_0x517ee0[_0xf3bc('0x35')]['hasOwnProperty'](_0xf3bc('0x39'))){_0x237df7[_0xf3bc('0x1d')]=qs[_0xf3bc('0x1d')](_0x517ee0[_0xf3bc('0x35')]['limit']);_0x237df7[_0xf3bc('0x1c')]=qs[_0xf3bc('0x1c')](_0x517ee0['query']['offset']);}_0x237df7[_0xf3bc('0x3a')]=qs[_0xf3bc('0x3b')](_0x517ee0[_0xf3bc('0x35')][_0xf3bc('0x3b')]);_0x237df7[_0xf3bc('0x3c')]=qs[_0xf3bc('0x3d')](_['pick'](_0x517ee0[_0xf3bc('0x35')],_0x2c91a8['filters']),_0x3f0294);if(_0x517ee0['query'][_0xf3bc('0x3e')]){_0x237df7[_0xf3bc('0x3c')]=_[_0xf3bc('0x3f')](_0x237df7[_0xf3bc('0x3c')],{'$or':_[_0xf3bc('0x2c')](_0x3f0294,function(_0x41fe84){if(_0x41fe84[_0xf3bc('0x30')]!==_0xf3bc('0x40')){var _0x5021e4={};_0x5021e4[_0x41fe84[_0xf3bc('0x33')]]={'$like':'%'+_0x517ee0[_0xf3bc('0x35')][_0xf3bc('0x3e')]+'%'};return _0x5021e4;}})});}_0x237df7=_['merge']({},_0x237df7,_0x517ee0[_0xf3bc('0x41')]);var _0x324457={'where':_0x237df7[_0xf3bc('0x3c')]};return db[_0xf3bc('0x2d')][_0xf3bc('0x1b')](_0x324457)[_0xf3bc('0x23')](function(_0x435f4a){_0x36f61c[_0xf3bc('0x1b')]=_0x435f4a;if(_0x517ee0[_0xf3bc('0x35')][_0xf3bc('0x42')]){_0x237df7[_0xf3bc('0x43')]=[{'all':!![]}];}return db[_0xf3bc('0x2d')][_0xf3bc('0x44')](_0x237df7);})[_0xf3bc('0x23')](function(_0x5ae2d1){_0x36f61c[_0xf3bc('0x45')]=_0x5ae2d1;return _0x36f61c;})[_0xf3bc('0x23')](respondWithFilteredResult(_0x5c1bfb,_0x237df7))['catch'](handleError(_0x5c1bfb,null));};exports[_0xf3bc('0x46')]=function(_0x5e328d,_0x42b8e0){var _0x25fd63={'raw':!![],'where':{'id':_0x5e328d['params']['id']}},_0x4ff9bd={};_0x4ff9bd[_0xf3bc('0x32')]=_[_0xf3bc('0x34')](db[_0xf3bc('0x2d')][_0xf3bc('0x2e')]);_0x4ff9bd[_0xf3bc('0x35')]=_[_0xf3bc('0x34')](_0x5e328d[_0xf3bc('0x35')]);_0x4ff9bd[_0xf3bc('0x3d')]=_[_0xf3bc('0x36')](_0x4ff9bd[_0xf3bc('0x32')],_0x4ff9bd[_0xf3bc('0x35')]);_0x25fd63[_0xf3bc('0x38')]=_[_0xf3bc('0x36')](_0x4ff9bd[_0xf3bc('0x32')],qs['fields'](_0x5e328d[_0xf3bc('0x35')][_0xf3bc('0x37')]));_0x25fd63[_0xf3bc('0x38')]=_0x25fd63[_0xf3bc('0x38')]['length']?_0x25fd63[_0xf3bc('0x38')]:_0x4ff9bd[_0xf3bc('0x32')];if(_0x5e328d['query']['includeAll']){_0x25fd63[_0xf3bc('0x43')]=[{'all':!![]}];}_0x25fd63=_[_0xf3bc('0x3f')]({},_0x25fd63,_0x5e328d[_0xf3bc('0x41')]);return db[_0xf3bc('0x2d')][_0xf3bc('0x47')](_0x25fd63)[_0xf3bc('0x23')](handleEntityNotFound(_0x42b8e0,null))['then'](respondWithResult(_0x42b8e0,null))[_0xf3bc('0x48')](handleError(_0x42b8e0,null));};exports[_0xf3bc('0x49')]=function(_0x269f8f,_0x40f038){return db['Disposition']['create'](_0x269f8f['body'],{})[_0xf3bc('0x23')](function(_0x36e681){var _0x58738c=_0x269f8f[_0xf3bc('0x4a')][_0xf3bc('0x25')]({'plain':!![]});if(!_0x58738c)throw new Error(_0xf3bc('0x4b'));if(_0x58738c[_0xf3bc('0x4c')]===_0xf3bc('0x4a')){var _0x25bbcf=_0x36e681['get']({'plain':!![]});var _0x2e111e=_0xf3bc('0x26');return db['UserProfileSection'][_0xf3bc('0x47')]({'where':{'name':_0x2e111e,'userProfileId':_0x58738c[_0xf3bc('0x4d')]},'raw':!![]})[_0xf3bc('0x23')](function(_0x22680e){if(_0x22680e&&_0x22680e['autoAssociation']===0x0){return db[_0xf3bc('0x27')]['create']({'name':_0x25bbcf['name'],'resourceId':_0x25bbcf['id'],'type':_0x22680e[_0xf3bc('0x33')],'sectionId':_0x22680e['id']},{})['then'](function(){return _0x36e681;});}else{return _0x36e681;}})['catch'](function(_0x45029e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45029e);throw _0x45029e;});}return _0x36e681;})[_0xf3bc('0x23')](respondWithResult(_0x40f038,0xc9))[_0xf3bc('0x48')](handleError(_0x40f038,null));};exports[_0xf3bc('0x22')]=function(_0xfce866,_0x1951b0){if(_0xfce866[_0xf3bc('0x4e')]['id']){delete _0xfce866[_0xf3bc('0x4e')]['id'];}return db['Disposition']['find']({'where':{'id':_0xfce866[_0xf3bc('0x4f')]['id']}})[_0xf3bc('0x23')](handleEntityNotFound(_0x1951b0,null))[_0xf3bc('0x23')](saveUpdates(_0xfce866[_0xf3bc('0x4e')],null))[_0xf3bc('0x23')](respondWithResult(_0x1951b0,null))[_0xf3bc('0x48')](handleError(_0x1951b0,null));};exports[_0xf3bc('0x24')]=function(_0x17c57c,_0x4dd750){return db[_0xf3bc('0x2d')]['find']({'where':{'id':_0x17c57c[_0xf3bc('0x4f')]['id']}})[_0xf3bc('0x23')](handleEntityNotFound(_0x4dd750,null))[_0xf3bc('0x23')](removeEntity(_0x4dd750,null))[_0xf3bc('0x48')](handleError(_0x4dd750,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3be3e92..74d8847 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 _0x2689=['name','ListId','name_chat','name_mail','MailAccountId','SmsAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','path','rimraf','define','Disposition','tools_dispositions','name_voice'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2689,0xb4));var _0x9268=function(_0x434138,_0x74656){_0x434138=_0x434138-0x0;var _0x40ebdd=_0x2689[_0x434138];return _0x40ebdd;};'use strict';var _=require('lodash');var util=require(_0x9268('0x0'));var logger=require(_0x9268('0x1'))(_0x9268('0x2'));var moment=require(_0x9268('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9268('0x4'));var rimraf=require(_0x9268('0x5'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module['exports']=function(_0x4edfdd,_0x3c960e){return _0x4edfdd[_0x9268('0x6')](_0x9268('0x7'),attributes,{'tableName':_0x9268('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9268('0x9'),'fields':[_0x9268('0xa'),_0x9268('0xb')]},{'unique':!![],'name':_0x9268('0xc'),'fields':[_0x9268('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x9268('0xd'),'fields':[_0x9268('0xa'),_0x9268('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x9268('0xa'),_0x9268('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0x9268('0xa'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x9268('0xa'),_0x9268('0x10')]},{'unique':!![],'name':_0x9268('0x11'),'fields':['name',_0x9268('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x209c=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','path','rimraf'];(function(_0x44c036,_0x42f8e5){var _0x1db27e=function(_0x1ba824){while(--_0x1ba824){_0x44c036['push'](_0x44c036['shift']());}};_0x1db27e(++_0x42f8e5);}(_0x209c,0x1f4));var _0xc209=function(_0x3b0b98,_0x112da7){_0x3b0b98=_0x3b0b98-0x0;var _0x435953=_0x209c[_0x3b0b98];return _0x435953;};'use strict';var _=require('lodash');var util=require(_0xc209('0x0'));var logger=require(_0xc209('0x1'))(_0xc209('0x2'));var moment=require(_0xc209('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc209('0x4'));var rimraf=require(_0xc209('0x5'));var config=require('../../config/environment');var attributes=require(_0xc209('0x6'));module[_0xc209('0x7')]=function(_0x35f424,_0x191e23){return _0x35f424[_0xc209('0x8')](_0xc209('0x9'),attributes,{'tableName':_0xc209('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc209('0xb'),'fields':['name','ListId']},{'unique':!![],'name':_0xc209('0xc'),'fields':['name',_0xc209('0xd')]},{'unique':!![],'name':_0xc209('0xe'),'fields':[_0xc209('0xf'),_0xc209('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xc209('0xf'),_0xc209('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xc209('0xf'),_0xc209('0x12')]},{'unique':!![],'name':_0xc209('0x13'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xc209('0x14'),'fields':[_0xc209('0xf'),_0xc209('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 06043a5..3ab1673 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 _0xbc21=['../../config/environment','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','util','moment','../../config/utils','rpc'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbc21,0x19a));var _0x1bc2=function(_0x13beea,_0x526573){_0x13beea=_0x13beea-0x0;var _0x37335f=_0xbc21[_0x13beea];return _0x37335f;};'use strict';var _=require('lodash');var util=require(_0x1bc2('0x0'));var moment=require(_0x1bc2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1bc2('0x2'));var logger=require('../../config/logger')(_0x1bc2('0x3'));var config=require(_0x1bc2('0x4'));var jayson=require(_0x1bc2('0x5'));var client=jayson['client'][_0x1bc2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xb1fe9e,_0x2c8fa2,_0x17fa87){return new BPromise(function(_0x58d0b5,_0x12d3ab){return client[_0x1bc2('0x7')](_0xb1fe9e,_0x17fa87)[_0x1bc2('0x8')](function(_0x2c1d5e){logger[_0x1bc2('0x9')](_0x1bc2('0xa'),_0x2c8fa2,'request\x20sent');logger[_0x1bc2('0xb')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2c8fa2,'request\x20sent',JSON[_0x1bc2('0xc')](_0x2c1d5e));if(_0x2c1d5e['error']){if(_0x2c1d5e['error']['code']===0x1f4){logger[_0x1bc2('0xd')](_0x1bc2('0xa'),_0x2c8fa2,_0x2c1d5e[_0x1bc2('0xd')][_0x1bc2('0xe')]);return _0x12d3ab(_0x2c1d5e[_0x1bc2('0xd')][_0x1bc2('0xe')]);}logger[_0x1bc2('0xd')]('Disposition,\x20%s,\x20%s',_0x2c8fa2,_0x2c1d5e[_0x1bc2('0xd')][_0x1bc2('0xe')]);return _0x58d0b5(_0x2c1d5e[_0x1bc2('0xd')][_0x1bc2('0xe')]);}else{logger[_0x1bc2('0x9')](_0x1bc2('0xa'),_0x2c8fa2,_0x1bc2('0xf'));_0x58d0b5(_0x2c1d5e[_0x1bc2('0x10')][_0x1bc2('0xe')]);}})[_0x1bc2('0x11')](function(_0x388a0f){logger[_0x1bc2('0xd')](_0x1bc2('0xa'),_0x2c8fa2,_0x388a0f);_0x12d3ab(_0x388a0f);});});} \ No newline at end of file +var _0xc55f=['request\x20sent','debug','stringify','code','error','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','Disposition,\x20%s,\x20%s'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xc55f,0x9f));var _0xfc55=function(_0x2c7183,_0x47f6b5){_0x2c7183=_0x2c7183-0x0;var _0x1893ef=_0xc55f[_0x2c7183];return _0x1893ef;};'use strict';var _=require(_0xfc55('0x0'));var util=require(_0xfc55('0x1'));var moment=require(_0xfc55('0x2'));var BPromise=require(_0xfc55('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc55('0x4'));var db=require(_0xfc55('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc55('0x6'));var config=require(_0xfc55('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc55('0x8')][_0xfc55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d324b,_0x3659e4,_0x2e43a9){return new BPromise(function(_0x469f28,_0xb935fd){return client['request'](_0x1d324b,_0x2e43a9)[_0xfc55('0xa')](function(_0x1b98cf){logger['info'](_0xfc55('0xb'),_0x3659e4,_0xfc55('0xc'));logger[_0xfc55('0xd')]('Disposition,\x20%s,\x20%s,\x20%s',_0x3659e4,'request\x20sent',JSON[_0xfc55('0xe')](_0x1b98cf));if(_0x1b98cf['error']){if(_0x1b98cf['error'][_0xfc55('0xf')]===0x1f4){logger[_0xfc55('0x10')](_0xfc55('0xb'),_0x3659e4,_0x1b98cf[_0xfc55('0x10')][_0xfc55('0x11')]);return _0xb935fd(_0x1b98cf['error'][_0xfc55('0x11')]);}logger['error'](_0xfc55('0xb'),_0x3659e4,_0x1b98cf[_0xfc55('0x10')]['message']);return _0x469f28(_0x1b98cf['error'][_0xfc55('0x11')]);}else{logger[_0xfc55('0x12')](_0xfc55('0xb'),_0x3659e4,'request\x20sent');_0x469f28(_0x1b98cf['result'][_0xfc55('0x11')]);}})['catch'](function(_0x4fe50b){logger['error'](_0xfc55('0xb'),_0x3659e4,_0x4fe50b);_0xb935fd(_0x4fe50b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 9c9d43b..2aa5616 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 _0x1c9a=['path','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x346758,_0x3a796c){var _0xf0cae1=function(_0x367760){while(--_0x367760){_0x346758['push'](_0x346758['shift']());}};_0xf0cae1(++_0x3a796c);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2356b8,_0x431b4a){_0x2356b8=_0x2356b8-0x0;var _0x43dcd3=_0x1c9a[_0x2356b8];return _0x43dcd3;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0xa')]('/',auth['isAuthenticated'](),controller[_0xa1c9('0xb')]);router[_0xa1c9('0xc')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller['update']);router[_0xa1c9('0xe')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xf')]);module[_0xa1c9('0x10')]=router; \ No newline at end of file +var _0xb458=['../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service'];(function(_0x547c85,_0x30fba4){var _0x59adec=function(_0x44d94e){while(--_0x44d94e){_0x547c85['push'](_0x547c85['shift']());}};_0x59adec(++_0x30fba4);}(_0xb458,0x94));var _0x8b45=function(_0x3005bc,_0xeea208){_0x3005bc=_0x3005bc-0x0;var _0x236d5d=_0xb458[_0x3005bc];return _0x236d5d;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b45('0x4'));var config=require(_0x8b45('0x5'));var controller=require(_0x8b45('0x6'));router[_0x8b45('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x7')](_0x8b45('0x9'),auth[_0x8b45('0xa')](),controller[_0x8b45('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8b45('0xc')]);router[_0x8b45('0xd')](_0x8b45('0x9'),auth[_0x8b45('0xa')](),controller[_0x8b45('0xe')]);router[_0x8b45('0xf')](_0x8b45('0x9'),auth[_0x8b45('0xa')](),controller['destroy']);module[_0x8b45('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index eaf11c4..d73e615 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 _0x44a4=['ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes'];(function(_0x5976db,_0x5d976c){var _0x581036=function(_0x47fa5e){while(--_0x47fa5e){_0x5976db['push'](_0x5976db['shift']());}};_0x581036(++_0x5d976c);}(_0x44a4,0x90));var _0x444a=function(_0x1b0de6,_0x311be2){_0x1b0de6=_0x1b0de6-0x0;var _0x1cb304=_0x44a4[_0x1b0de6];return _0x1cb304;};'use strict';var Sequelize=require('sequelize');module[_0x444a('0x0')]={'name':{'type':Sequelize[_0x444a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x444a('0x2'),'no'),'defaultValue':_0x444a('0x2')},'headerinfo':{'type':Sequelize[_0x444a('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x444a('0x3')](_0x444a('0x4'),_0x444a('0x5'),_0x444a('0x6'),_0x444a('0x7'),_0x444a('0x8'),_0x444a('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x444a('0x3')](_0x444a('0x4'),_0x444a('0x5'),_0x444a('0x6'),_0x444a('0x7'),_0x444a('0x8'),_0x444a('0x9')),'defaultValue':_0x444a('0x9')},'modem':{'type':Sequelize[_0x444a('0x1')],'defaultValue':_0x444a('0xa')},'gateway':{'type':Sequelize[_0x444a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x444a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x444a('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x444a('0x3')](_0x444a('0xc'),_0x444a('0xd'),'DADHI',_0x444a('0xe')),'defaultValue':_0x444a('0xc')},'key':{'type':Sequelize[_0x444a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x444a('0xf');}},'notificationSound':{'type':Sequelize[_0x444a('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x444a('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x444a('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x444a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x444a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x444a('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x444a('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2004e4){if(!_0x2004e4)this[_0x444a('0x12')](_0x444a('0x13'),null);this[_0x444a('0x12')](_0x444a('0x14'),_0x2004e4);}}}; \ No newline at end of file +var _0x0d0e=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','14400','2400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x31c169,_0xbe8544){var _0x3acd4c=function(_0x16a819){while(--_0x16a819){_0x31c169['push'](_0x31c169['shift']());}};_0x3acd4c(++_0xbe8544);}(_0x0d0e,0xac));var _0xe0d0=function(_0xd24596,_0x51ccff){_0xd24596=_0xd24596-0x0;var _0x548c16=_0x0d0e[_0xd24596];return _0x548c16;};'use strict';var Sequelize=require(_0xe0d0('0x0'));module[_0xe0d0('0x1')]={'name':{'type':Sequelize[_0xe0d0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe0d0('0x2')]},'ecm':{'type':Sequelize[_0xe0d0('0x3')]('yes','no'),'defaultValue':_0xe0d0('0x4')},'headerinfo':{'type':Sequelize[_0xe0d0('0x2')],'defaultValue':_0xe0d0('0x5')},'localstationid':{'type':Sequelize[_0xe0d0('0x2')],'unique':_0xe0d0('0x6')},'minrate':{'type':Sequelize[_0xe0d0('0x3')]('2400','4800',_0xe0d0('0x7'),_0xe0d0('0x8'),'12000',_0xe0d0('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xe0d0('0x3')](_0xe0d0('0xa'),'4800',_0xe0d0('0x7'),_0xe0d0('0x8'),'12000',_0xe0d0('0x9')),'defaultValue':_0xe0d0('0x9')},'modem':{'type':Sequelize[_0xe0d0('0x2')],'defaultValue':_0xe0d0('0xb')},'gateway':{'type':Sequelize[_0xe0d0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe0d0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe0d0('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe0d0('0x3')]('SIP',_0xe0d0('0xd'),_0xe0d0('0xe'),_0xe0d0('0xf')),'defaultValue':_0xe0d0('0x10')},'key':{'type':Sequelize[_0xe0d0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe0d0('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe0d0('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe0d0('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe0d0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe0d0('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe0d0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe0d0('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe0d0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe0d0('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xe0d0('0x12')],'defaultValue':![],'comment':_0xe0d0('0x14'),'set':function(_0x3b1945){if(!_0x3b1945)this['setDataValue'](_0xe0d0('0x15'),null);this[_0xe0d0('0x16')](_0xe0d0('0x17'),_0x3b1945);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index eeceea7..ea2b49d 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 _0xb7c5=['bulkCreate','findAndCountAll','getApplications','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','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','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','format','\x22%s\x22\x20<%s>','Contacts','FaxInteraction','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','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~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','limit','set','Content-Range','reject','get','FaxAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxAccount','count','includeAll','findAll','rows','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','omit','CmContact','Contact','User','Owner','Tag','tag','addApplications','FaxApplication'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xb7c5,0x1bc));var _0x5b7c=function(_0x157111,_0x3a9771){_0x157111=_0x157111-0x0;var _0x5b00c4=_0xb7c5[_0x157111];return _0x5b00c4;};'use strict';var pdf=require(_0x5b7c('0x0'));var emlformat=require(_0x5b7c('0x1'));var rimraf=require(_0x5b7c('0x2'));var zipdir=require(_0x5b7c('0x3'));var jsonpatch=require(_0x5b7c('0x4'));var rp=require(_0x5b7c('0x5'));var moment=require('moment');var BPromise=require(_0x5b7c('0x6'));var Mustache=require('mustache');var util=require(_0x5b7c('0x7'));var path=require('path');var sox=require(_0x5b7c('0x8'));var csv=require(_0x5b7c('0x9'));var ejs=require(_0x5b7c('0xa'));var fs=require('fs');var _=require(_0x5b7c('0xb'));var squel=require(_0x5b7c('0xc'));var crypto=require(_0x5b7c('0xd'));var jsforce=require(_0x5b7c('0xe'));var deskjs=require(_0x5b7c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5b7c('0x10'));var Papa=require(_0x5b7c('0x11'));var Redis=require(_0x5b7c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5b7c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b7c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5b7c('0x15'))['db'];config[_0x5b7c('0x16')]=_[_0x5b7c('0x17')](config[_0x5b7c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b7c('0x18'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x5b7c('0x19')](socket);var jayson=require(_0x5b7c('0x1a'));var client=jayson[_0x5b7c('0x1b')][_0x5b7c('0x1c')]({'port':0x232c});var client9002=jayson[_0x5b7c('0x1b')][_0x5b7c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x341873,_0x521f5c,_0x3e97be){if(_0x3e97be){var _0x2cd16f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cd16f[_0x5b7c('0x1d')](_0x521f5c)){return _0x341873;}else{throw new db['Sequelize']['ValidationError'](_0x5b7c('0x1e'));}}else{return _0x341873;}}function respondWithRpcPromise(_0x1f09c2,_0x30921e,_0x56bbea,_0x4cbb11){return new BPromise(function(_0x3f652d,_0x4503f4){var _0x2dc96b=_0x4cbb11||client;return _0x2dc96b['request'](_0x1f09c2,_0x56bbea)[_0x5b7c('0x1f')](function(_0x183530){logger[_0x5b7c('0x20')](_0x5b7c('0x21'),_0x30921e,_0x5b7c('0x22'));logger[_0x5b7c('0x23')](_0x5b7c('0x24'),_0x30921e,_0x5b7c('0x22'),JSON[_0x5b7c('0x25')](_0x183530));if(_0x183530[_0x5b7c('0x26')]){if(_0x183530[_0x5b7c('0x26')][_0x5b7c('0x27')]===0x1f4){logger[_0x5b7c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x30921e,_0x183530[_0x5b7c('0x26')][_0x5b7c('0x28')]);return _0x4503f4(_0x183530[_0x5b7c('0x26')][_0x5b7c('0x28')]);}logger[_0x5b7c('0x26')](_0x5b7c('0x21'),_0x30921e,_0x183530[_0x5b7c('0x26')]['message']);return _0x3f652d(_0x183530['error'][_0x5b7c('0x28')]);}else{logger[_0x5b7c('0x20')](_0x5b7c('0x21'),_0x30921e,_0x5b7c('0x22'));_0x3f652d(_0x183530['result'][_0x5b7c('0x28')]);}})[_0x5b7c('0x29')](function(_0x59496f){logger['error'](_0x5b7c('0x21'),_0x30921e,_0x59496f);_0x4503f4(_0x59496f);});});}function respondWithStatusCode(_0x1b8b3a,_0x3b896f){_0x3b896f=_0x3b896f||0xcc;return function(_0x4a1cb2){if(_0x4a1cb2){return _0x1b8b3a['sendStatus'](_0x3b896f);}return _0x1b8b3a['status'](_0x3b896f)[_0x5b7c('0x2a')]();};}function respondWithResult(_0x532945,_0x467a04){_0x467a04=_0x467a04||0xc8;return function(_0xa67c0b){if(_0xa67c0b){return _0x532945[_0x5b7c('0x2b')](_0x467a04)[_0x5b7c('0x2c')](_0xa67c0b);}};}function respondWithFilteredResult(_0x3c2e3b,_0x3eb882){return function(_0x163006){if(_0x163006){var _0x560fdb=_0x163006['count'],_0x45a0ad=_0x3eb882[_0x5b7c('0x2d')],_0x5d9346=_0x3eb882[_0x5b7c('0x2d')]+_0x3eb882[_0x5b7c('0x2e')],_0x39522b;if(_0x5d9346>=_0x560fdb){_0x5d9346=_0x560fdb;_0x39522b=0xc8;}else{_0x39522b=0xce;}_0x3c2e3b['status'](_0x39522b);return _0x3c2e3b[_0x5b7c('0x2f')](_0x5b7c('0x30'),_0x45a0ad+'-'+_0x5d9346+'/'+_0x560fdb)[_0x5b7c('0x2c')](_0x163006);}return null;};}function patchUpdates(_0x22e247){return function(_0x5a3214){try{jsonpatch['apply'](_0x5a3214,_0x22e247,!![]);}catch(_0x379eea){return BPromise[_0x5b7c('0x31')](_0x379eea);}return _0x5a3214['save']();};}function saveUpdates(_0xe4ae2d,_0x513ae2){return function(_0x4710ba){if(_0x4710ba){return _0x4710ba['update'](_0xe4ae2d)[_0x5b7c('0x1f')](function(_0x5a8d12){return _0x5a8d12;});}return null;};}function removeEntity(_0x13bcec,_0x2a212d){return function(_0x133313){if(_0x133313){return _0x133313['destroy']()[_0x5b7c('0x1f')](function(){var _0x3c362d=_0x133313[_0x5b7c('0x32')]({'plain':!![]});var _0x492023=_0x5b7c('0x33');return db[_0x5b7c('0x34')][_0x5b7c('0x35')]({'where':{'type':_0x492023,'resourceId':_0x3c362d['id']}})[_0x5b7c('0x1f')](function(){return _0x133313;});})[_0x5b7c('0x1f')](function(){_0x13bcec['status'](0xcc)[_0x5b7c('0x2a')]();});}};}function handleEntityNotFound(_0x1ff68f,_0x16193a){return function(_0x4ef87b){if(!_0x4ef87b){_0x1ff68f[_0x5b7c('0x36')](0x194);}return _0x4ef87b;};}function handleError(_0x1df85b,_0x4a2f54){_0x4a2f54=_0x4a2f54||0x1f4;return function(_0x1fab3d){logger[_0x5b7c('0x26')](_0x1fab3d[_0x5b7c('0x37')]);if(_0x1fab3d[_0x5b7c('0x38')]){delete _0x1fab3d[_0x5b7c('0x38')];}_0x1df85b[_0x5b7c('0x2b')](_0x4a2f54)[_0x5b7c('0x39')](_0x1fab3d);};}exports['index']=function(_0x26fec7,_0x245dee){var _0x53c920={'include':[{'model':db[_0x5b7c('0x3a')],'as':_0x5b7c('0x3b')}]},_0x5980a4={},_0xaf2543={'count':0x0,'rows':[]};var _0x30c9fd=_[_0x5b7c('0x3c')](db['FaxAccount'][_0x5b7c('0x3d')],function(_0x2ecb26){return{'name':_0x2ecb26['fieldName'],'type':_0x2ecb26[_0x5b7c('0x3e')][_0x5b7c('0x3f')]};});_0x5980a4['model']=_[_0x5b7c('0x3c')](_0x30c9fd,_0x5b7c('0x38'));_0x5980a4[_0x5b7c('0x40')]=_['keys'](_0x26fec7[_0x5b7c('0x40')]);_0x5980a4[_0x5b7c('0x41')]=_[_0x5b7c('0x42')](_0x5980a4['model'],_0x5980a4['query']);_0x53c920[_0x5b7c('0x43')]=_[_0x5b7c('0x42')](_0x5980a4['model'],qs['fields'](_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x44')]));_0x53c920['attributes']=_0x53c920['attributes'][_0x5b7c('0x45')]?_0x53c920['attributes']:_0x5980a4[_0x5b7c('0x46')];if(!_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x47')]('nolimit')){_0x53c920[_0x5b7c('0x2e')]=qs[_0x5b7c('0x2e')](_0x26fec7['query']['limit']);_0x53c920[_0x5b7c('0x2d')]=qs[_0x5b7c('0x2d')](_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x2d')]);}_0x53c920[_0x5b7c('0x48')]=qs[_0x5b7c('0x49')](_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x49')]);_0x53c920[_0x5b7c('0x4a')]=qs[_0x5b7c('0x41')](_[_0x5b7c('0x4b')](_0x26fec7[_0x5b7c('0x40')],_0x5980a4['filters']),_0x30c9fd);if(_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x4c')]){_0x53c920['where']=_['merge'](_0x53c920[_0x5b7c('0x4a')],{'$or':_[_0x5b7c('0x3c')](_0x30c9fd,function(_0x47152b){if(_0x47152b['type']!==_0x5b7c('0x4d')){var _0x562d9c={};_0x562d9c[_0x47152b[_0x5b7c('0x38')]]={'$like':'%'+_0x26fec7[_0x5b7c('0x40')]['filter']+'%'};return _0x562d9c;}})});}_0x53c920=_[_0x5b7c('0x4e')]({},_0x53c920,_0x26fec7[_0x5b7c('0x4f')]);var _0x291093={'where':_0x53c920[_0x5b7c('0x4a')]};return db[_0x5b7c('0x50')][_0x5b7c('0x51')](_0x291093)[_0x5b7c('0x1f')](function(_0x3d082d){_0xaf2543['count']=_0x3d082d;if(_0x26fec7[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0x53c920['include']=[{'all':!![]}];}return db['FaxAccount'][_0x5b7c('0x53')](_0x53c920);})[_0x5b7c('0x1f')](function(_0xf4fea0){_0xaf2543[_0x5b7c('0x54')]=_0xf4fea0;return _0xaf2543;})[_0x5b7c('0x1f')](respondWithFilteredResult(_0x245dee,_0x53c920))['catch'](handleError(_0x245dee,null));};exports['show']=function(_0x4a0e71,_0x2fcd58){var _0x345739={'raw':![],'where':{'id':_0x4a0e71[_0x5b7c('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x5b7c('0x3b')}]},_0x5a46a7={};_0x5a46a7['model']=_[_0x5b7c('0x56')](db[_0x5b7c('0x50')]['rawAttributes']);_0x5a46a7[_0x5b7c('0x40')]=_['keys'](_0x4a0e71[_0x5b7c('0x40')]);_0x5a46a7[_0x5b7c('0x41')]=_[_0x5b7c('0x42')](_0x5a46a7[_0x5b7c('0x46')],_0x5a46a7[_0x5b7c('0x40')]);_0x345739['attributes']=_[_0x5b7c('0x42')](_0x5a46a7['model'],qs['fields'](_0x4a0e71[_0x5b7c('0x40')][_0x5b7c('0x44')]));_0x345739[_0x5b7c('0x43')]=_0x345739['attributes']['length']?_0x345739[_0x5b7c('0x43')]:_0x5a46a7[_0x5b7c('0x46')];if(_0x4a0e71[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0x345739[_0x5b7c('0x57')]=[{'all':!![]}];}_0x345739=_[_0x5b7c('0x4e')]({},_0x345739,_0x4a0e71['options']);return db[_0x5b7c('0x50')][_0x5b7c('0x58')](_0x345739)['then'](handleEntityNotFound(_0x2fcd58,null))[_0x5b7c('0x1f')](respondWithResult(_0x2fcd58,null))[_0x5b7c('0x29')](handleError(_0x2fcd58,null));};exports[_0x5b7c('0x59')]=function(_0xe26017,_0x3ccbe2){return db[_0x5b7c('0x50')]['create'](_0xe26017[_0x5b7c('0x5a')],{})[_0x5b7c('0x1f')](function(_0x41395e){var _0x422ff8=_0xe26017[_0x5b7c('0x5b')][_0x5b7c('0x32')]({'plain':!![]});if(!_0x422ff8)throw new Error(_0x5b7c('0x5c'));if(_0x422ff8[_0x5b7c('0x5d')]===_0x5b7c('0x5b')){var _0x470c16=_0x41395e[_0x5b7c('0x32')]({'plain':!![]});var _0x44757a=_0x5b7c('0x33');return db[_0x5b7c('0x5e')]['find']({'where':{'name':_0x44757a,'userProfileId':_0x422ff8['userProfileId']},'raw':!![]})[_0x5b7c('0x1f')](function(_0x4acd26){if(_0x4acd26&&_0x4acd26[_0x5b7c('0x5f')]===0x0){return db['UserProfileResource'][_0x5b7c('0x59')]({'name':_0x470c16[_0x5b7c('0x38')],'resourceId':_0x470c16['id'],'type':_0x4acd26[_0x5b7c('0x38')],'sectionId':_0x4acd26['id']},{})['then'](function(){return _0x41395e;});}else{return _0x41395e;}})[_0x5b7c('0x29')](function(_0x60c2f9){logger['error'](_0x5b7c('0x60'),_0x60c2f9);throw _0x60c2f9;});}return _0x41395e;})[_0x5b7c('0x1f')](respondWithResult(_0x3ccbe2,0xc9))['catch'](handleError(_0x3ccbe2,null));};exports[_0x5b7c('0x61')]=function(_0x20e6b5,_0x489d4d){if(_0x20e6b5[_0x5b7c('0x5a')]['id']){delete _0x20e6b5[_0x5b7c('0x5a')]['id'];}return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x20e6b5[_0x5b7c('0x55')]['id']},'include':[{'model':db[_0x5b7c('0x3a')],'as':_0x5b7c('0x3b')}]})[_0x5b7c('0x1f')](handleEntityNotFound(_0x489d4d,null))[_0x5b7c('0x1f')](saveUpdates(_0x20e6b5['body'],null))[_0x5b7c('0x1f')](respondWithResult(_0x489d4d,null))[_0x5b7c('0x29')](handleError(_0x489d4d,null));};exports[_0x5b7c('0x35')]=function(_0x58215a,_0x39f565){return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x58215a[_0x5b7c('0x55')]['id']}})['then'](handleEntityNotFound(_0x39f565,null))[_0x5b7c('0x1f')](removeEntity(_0x39f565,null))['catch'](handleError(_0x39f565,null));};exports['describe']=function(_0x2b8833,_0x1178fa){return db[_0x5b7c('0x50')]['describe']()['then'](respondWithResult(_0x1178fa,null))['catch'](handleError(_0x1178fa,null));};exports[_0x5b7c('0x62')]=function(_0x45934b,_0x5cf78a,_0x3d1803){if(_0x45934b[_0x5b7c('0x5a')]['id']){delete _0x45934b[_0x5b7c('0x5a')]['id'];}return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x45934b['params']['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x5cf78a,null))[_0x5b7c('0x1f')](function(_0x3ed6a5){if(_0x3ed6a5){_0x45934b['body'][_0x5b7c('0x63')]=_0x3ed6a5['id'];return db[_0x5b7c('0x64')][_0x5b7c('0x59')](_0x45934b[_0x5b7c('0x5a')]);}})['then'](respondWithResult(_0x5cf78a,null))[_0x5b7c('0x29')](handleError(_0x5cf78a,null));};exports[_0x5b7c('0x65')]=function(_0xe9dbd3,_0x2517e2,_0x39f7d3){var _0x54bb1d={'raw':![],'where':{}};var _0x1fd30c={};var _0xff6293={'count':0x0,'rows':[]};return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0xe9dbd3[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x2517e2,null))[_0x5b7c('0x1f')](function(_0x44dfd5){if(_0x44dfd5){_0x1fd30c[_0x5b7c('0x46')]=_['keys'](db[_0x5b7c('0x64')]['rawAttributes']);_0x1fd30c[_0x5b7c('0x40')]=_['keys'](_0xe9dbd3[_0x5b7c('0x40')]);_0x1fd30c['filters']=_[_0x5b7c('0x42')](_0x1fd30c['model'],_0x1fd30c[_0x5b7c('0x40')]);_0x54bb1d[_0x5b7c('0x43')]=_['intersection'](_0x1fd30c[_0x5b7c('0x46')],qs[_0x5b7c('0x44')](_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x44')]));_0x54bb1d[_0x5b7c('0x43')]=_0x54bb1d[_0x5b7c('0x43')][_0x5b7c('0x45')]?_0x54bb1d['attributes']:_0x1fd30c[_0x5b7c('0x46')];if(!_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x47')](_0x5b7c('0x67'))){_0x54bb1d[_0x5b7c('0x2e')]=qs[_0x5b7c('0x2e')](_0xe9dbd3['query']['limit']);_0x54bb1d[_0x5b7c('0x2d')]=qs['offset'](_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x2d')]);}_0x54bb1d[_0x5b7c('0x48')]=qs[_0x5b7c('0x49')](_0xe9dbd3['query'][_0x5b7c('0x49')]);_0x54bb1d[_0x5b7c('0x4a')]=qs[_0x5b7c('0x41')](_[_0x5b7c('0x4b')](_0xe9dbd3[_0x5b7c('0x40')],_0x1fd30c[_0x5b7c('0x41')]));_0x54bb1d[_0x5b7c('0x4a')][_0x5b7c('0x63')]=_0x44dfd5['id'];if(_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x4c')]){_0x54bb1d['where']=_[_0x5b7c('0x4e')](_0x54bb1d[_0x5b7c('0x4a')],{'$or':_[_0x5b7c('0x3c')](_0x54bb1d['attributes'],function(_0xf43e94){var _0x1b92bb={};_0x1b92bb[_0xf43e94]={'$like':'%'+_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x4c')]+'%'};return _0x1b92bb;})});}_0x54bb1d=_[_0x5b7c('0x4e')]({},_0x54bb1d,_0xe9dbd3[_0x5b7c('0x4f')]);return db[_0x5b7c('0x64')][_0x5b7c('0x51')]({'where':_0x54bb1d[_0x5b7c('0x4a')]})[_0x5b7c('0x1f')](function(_0x52cd44){_0xff6293['count']=_0x52cd44;if(_0xe9dbd3[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0x54bb1d[_0x5b7c('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x5b7c('0x53')](_0x54bb1d);})[_0x5b7c('0x1f')](function(_0x1fa3a2){_0xff6293[_0x5b7c('0x54')]=_0x1fa3a2;return _0xff6293;});}})[_0x5b7c('0x1f')](respondWithFilteredResult(_0x2517e2,_0x54bb1d))[_0x5b7c('0x29')](handleError(_0x2517e2,null));};exports['removeDispositions']=function(_0x46c012,_0x4ae026,_0x296de2){return db['FaxAccount']['find']({'where':{'id':_0x46c012[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x4ae026,null))[_0x5b7c('0x1f')](function(_0x2321e9){if(_0x2321e9){return _0x2321e9[_0x5b7c('0x68')](_0x46c012['query']['ids']);}})[_0x5b7c('0x1f')](respondWithStatusCode(_0x4ae026,null))[_0x5b7c('0x29')](handleError(_0x4ae026,null));};exports[_0x5b7c('0x69')]=function(_0x4b9656,_0x185efc,_0x3a1c27){if(_0x4b9656['body']['id']){delete _0x4b9656[_0x5b7c('0x5a')]['id'];}return db[_0x5b7c('0x50')]['find']({'where':{'id':_0x4b9656[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x185efc,null))[_0x5b7c('0x1f')](function(_0x12d89f){if(_0x12d89f){_0x4b9656[_0x5b7c('0x5a')]['FaxAccountId']=_0x12d89f['id'];return db['CannedAnswer'][_0x5b7c('0x59')](_0x4b9656['body']);}})['then'](respondWithResult(_0x185efc,null))[_0x5b7c('0x29')](handleError(_0x185efc,null));};exports[_0x5b7c('0x6a')]=function(_0x45f154,_0x326326,_0x5d062a){var _0x133832={'raw':![],'where':{}};var _0x5ed9d3={};var _0x1b0ec5={'count':0x0,'rows':[]};return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0x45f154[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x326326,null))['then'](function(_0x3d0655){if(_0x3d0655){_0x5ed9d3['model']=_[_0x5b7c('0x56')](db[_0x5b7c('0x6b')][_0x5b7c('0x3d')]);_0x5ed9d3[_0x5b7c('0x40')]=_[_0x5b7c('0x56')](_0x45f154['query']);_0x5ed9d3['filters']=_['intersection'](_0x5ed9d3[_0x5b7c('0x46')],_0x5ed9d3[_0x5b7c('0x40')]);_0x133832['attributes']=_['intersection'](_0x5ed9d3['model'],qs[_0x5b7c('0x44')](_0x45f154[_0x5b7c('0x40')][_0x5b7c('0x44')]));_0x133832[_0x5b7c('0x43')]=_0x133832[_0x5b7c('0x43')]['length']?_0x133832[_0x5b7c('0x43')]:_0x5ed9d3[_0x5b7c('0x46')];if(!_0x45f154[_0x5b7c('0x40')][_0x5b7c('0x47')](_0x5b7c('0x67'))){_0x133832['limit']=qs[_0x5b7c('0x2e')](_0x45f154['query'][_0x5b7c('0x2e')]);_0x133832[_0x5b7c('0x2d')]=qs[_0x5b7c('0x2d')](_0x45f154[_0x5b7c('0x40')]['offset']);}_0x133832[_0x5b7c('0x48')]=qs[_0x5b7c('0x49')](_0x45f154[_0x5b7c('0x40')]['sort']);_0x133832['where']=qs[_0x5b7c('0x41')](_[_0x5b7c('0x4b')](_0x45f154[_0x5b7c('0x40')],_0x5ed9d3[_0x5b7c('0x41')]));_0x133832[_0x5b7c('0x4a')][_0x5b7c('0x63')]=_0x3d0655['id'];if(_0x45f154[_0x5b7c('0x40')][_0x5b7c('0x4c')]){_0x133832['where']=_[_0x5b7c('0x4e')](_0x133832[_0x5b7c('0x4a')],{'$or':_[_0x5b7c('0x3c')](_0x133832[_0x5b7c('0x43')],function(_0x308196){var _0x423990={};_0x423990[_0x308196]={'$like':'%'+_0x45f154[_0x5b7c('0x40')]['filter']+'%'};return _0x423990;})});}_0x133832=_[_0x5b7c('0x4e')]({},_0x133832,_0x45f154[_0x5b7c('0x4f')]);return db['CannedAnswer'][_0x5b7c('0x51')]({'where':_0x133832[_0x5b7c('0x4a')]})[_0x5b7c('0x1f')](function(_0x272e75){_0x1b0ec5['count']=_0x272e75;if(_0x45f154[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0x133832[_0x5b7c('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5b7c('0x53')](_0x133832);})[_0x5b7c('0x1f')](function(_0x32f228){_0x1b0ec5[_0x5b7c('0x54')]=_0x32f228;return _0x1b0ec5;});}})['then'](respondWithFilteredResult(_0x326326,_0x133832))['catch'](handleError(_0x326326,null));};exports[_0x5b7c('0x6c')]=function(_0x3a447e,_0x540042,_0x10fbde){return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x3a447e[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x540042,null))[_0x5b7c('0x1f')](function(_0x44c6cf){if(_0x44c6cf){return _0x44c6cf[_0x5b7c('0x6c')](_0x3a447e[_0x5b7c('0x40')][_0x5b7c('0x6d')]);}})[_0x5b7c('0x1f')](respondWithStatusCode(_0x540042,null))[_0x5b7c('0x29')](handleError(_0x540042,null));};exports[_0x5b7c('0x6e')]=function(_0x5cb9be,_0x355e66,_0x18aeda){return db['FaxInteraction'][_0x5b7c('0x58')]({'where':{'id':_0x5cb9be['params']['id']}})['then'](handleEntityNotFound(_0x355e66,null))[_0x5b7c('0x1f')](function(_0x360bab){if(_0x360bab){return _0x360bab[_0x5b7c('0x6e')](_0x5cb9be[_0x5b7c('0x5a')][_0x5b7c('0x6d')],_[_0x5b7c('0x6f')](_0x5cb9be[_0x5b7c('0x5a')],[_0x5b7c('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x355e66,null))[_0x5b7c('0x29')](handleError(_0x355e66,null));};exports['getInteractions']=function(_0x204254,_0xb38e4,_0x4dbeb0){var _0x2aa31b={'raw':![],'where':{}};var _0x54fed9={};var _0xcb89c2={'count':0x0,'rows':[]};return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0x204254[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0xb38e4,null))[_0x5b7c('0x1f')](function(_0x34953a){if(_0x34953a){_0x54fed9['model']=_[_0x5b7c('0x56')](db['FaxInteraction']['rawAttributes']);_0x54fed9['query']=_[_0x5b7c('0x56')](_0x204254[_0x5b7c('0x40')]);_0x54fed9[_0x5b7c('0x41')]=_[_0x5b7c('0x42')](_0x54fed9[_0x5b7c('0x46')],_0x54fed9[_0x5b7c('0x40')]);_0x2aa31b['attributes']=_[_0x5b7c('0x42')](_0x54fed9['model'],qs['fields'](_0x204254[_0x5b7c('0x40')]['fields']));_0x2aa31b[_0x5b7c('0x43')]=_0x2aa31b['attributes'][_0x5b7c('0x45')]?_0x2aa31b[_0x5b7c('0x43')]:_0x54fed9[_0x5b7c('0x46')];if(!_0x204254['query'][_0x5b7c('0x47')](_0x5b7c('0x67'))){_0x2aa31b['limit']=qs[_0x5b7c('0x2e')](_0x204254[_0x5b7c('0x40')][_0x5b7c('0x2e')]);_0x2aa31b['offset']=qs[_0x5b7c('0x2d')](_0x204254[_0x5b7c('0x40')][_0x5b7c('0x2d')]);}_0x2aa31b['order']=qs[_0x5b7c('0x49')](_0x204254[_0x5b7c('0x40')][_0x5b7c('0x49')]);_0x2aa31b[_0x5b7c('0x4a')]=qs['filters'](_[_0x5b7c('0x4b')](_0x204254[_0x5b7c('0x40')],_0x54fed9[_0x5b7c('0x41')]));_0x2aa31b[_0x5b7c('0x4a')]['FaxAccountId']=_0x34953a['id'];if(_0x204254[_0x5b7c('0x40')][_0x5b7c('0x4c')]){_0x2aa31b[_0x5b7c('0x4a')]=_[_0x5b7c('0x4e')](_0x2aa31b[_0x5b7c('0x4a')],{'$or':_['map'](_0x2aa31b[_0x5b7c('0x43')],function(_0x369ba6){var _0x2299ec={};_0x2299ec[_0x369ba6]={'$like':'%'+_0x204254[_0x5b7c('0x40')][_0x5b7c('0x4c')]+'%'};return _0x2299ec;})});}_0x2aa31b=_['merge']({},_0x2aa31b,_0x204254[_0x5b7c('0x4f')]);return db['FaxInteraction'][_0x5b7c('0x51')]({'where':_0x2aa31b[_0x5b7c('0x4a')]})[_0x5b7c('0x1f')](function(_0xcf68cf){_0xcb89c2[_0x5b7c('0x51')]=_0xcf68cf;if(_0x204254[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0x2aa31b[_0x5b7c('0x57')]=[{'model':db[_0x5b7c('0x70')],'as':_0x5b7c('0x71'),'required':![]},{'model':db[_0x5b7c('0x72')],'as':_0x5b7c('0x73'),'attributes':[_0x5b7c('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x5b7c('0x74')],'as':'Tags','attributes':['id',_0x5b7c('0x38'),'color'],'where':_0x204254[_0x5b7c('0x40')][_0x5b7c('0x75')]?{'id':_0x204254[_0x5b7c('0x40')][_0x5b7c('0x75')]}:undefined,'required':_0x204254[_0x5b7c('0x40')][_0x5b7c('0x75')]?!![]:![]}];}return db['FaxInteraction'][_0x5b7c('0x53')](_0x2aa31b);})[_0x5b7c('0x1f')](function(_0x1d5b7b){_0xcb89c2['rows']=_0x1d5b7b;return _0xcb89c2;});}})[_0x5b7c('0x1f')](respondWithFilteredResult(_0xb38e4,_0x2aa31b))[_0x5b7c('0x29')](handleError(_0xb38e4,null));};exports[_0x5b7c('0x76')]=function(_0x359e7e,_0x2027e4,_0x191376){return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0x359e7e['params']['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x2027e4,null))[_0x5b7c('0x1f')](function(_0x48300a){if(_0x48300a){return db['sequelize']['transaction'](function(_0x5d9323){return db[_0x5b7c('0x77')][_0x5b7c('0x35')]({'where':{'FaxAccountId':_0x359e7e[_0x5b7c('0x55')]['id']},'transaction':_0x5d9323})['then'](function(_0x5b1594){var _0x4d8e50=_['map'](_0x359e7e[_0x5b7c('0x5a')],function(_0x5ee53c){_0x5ee53c[_0x5b7c('0x63')]=_0x359e7e[_0x5b7c('0x55')]['id'];return _0x5ee53c;});return db[_0x5b7c('0x77')][_0x5b7c('0x78')](_0x4d8e50,{'transaction':_0x5d9323});});})[_0x5b7c('0x1f')](function(){return db[_0x5b7c('0x77')][_0x5b7c('0x79')]({'where':{'FaxAccountId':_0x359e7e[_0x5b7c('0x55')]['id']},'order':'priority'});});}})[_0x5b7c('0x1f')](respondWithResult(_0x2027e4,null))['catch'](handleError(_0x2027e4,null));};exports[_0x5b7c('0x7a')]=function(_0x322759,_0x355591,_0x251df5){var _0x2a374d={};var _0x5d3091={};var _0x66a627;var _0x33297d;return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0x322759[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x355591,null))[_0x5b7c('0x1f')](function(_0x3ebf8a){if(_0x3ebf8a){_0x66a627=_0x3ebf8a;_0x5d3091['model']=_[_0x5b7c('0x56')](db[_0x5b7c('0x77')][_0x5b7c('0x3d')]);_0x5d3091[_0x5b7c('0x40')]=_['keys'](_0x322759[_0x5b7c('0x40')]);_0x5d3091[_0x5b7c('0x41')]=_['intersection'](_0x5d3091['model'],_0x5d3091[_0x5b7c('0x40')]);_0x2a374d[_0x5b7c('0x43')]=_[_0x5b7c('0x42')](_0x5d3091[_0x5b7c('0x46')],qs[_0x5b7c('0x44')](_0x322759[_0x5b7c('0x40')]['fields']));_0x2a374d[_0x5b7c('0x43')]=_0x2a374d['attributes'][_0x5b7c('0x45')]?_0x2a374d['attributes']:_0x5d3091[_0x5b7c('0x46')];_0x2a374d[_0x5b7c('0x48')]=qs[_0x5b7c('0x49')](_0x322759[_0x5b7c('0x40')][_0x5b7c('0x49')]);_0x2a374d[_0x5b7c('0x4a')]=qs[_0x5b7c('0x41')](_[_0x5b7c('0x4b')](_0x322759[_0x5b7c('0x40')],_0x5d3091[_0x5b7c('0x41')]));if(_0x322759[_0x5b7c('0x40')][_0x5b7c('0x4c')]){_0x2a374d[_0x5b7c('0x4a')]=_[_0x5b7c('0x4e')](_0x2a374d[_0x5b7c('0x4a')],{'$or':_[_0x5b7c('0x3c')](_0x2a374d[_0x5b7c('0x43')],function(_0x4a2110){var _0x25c6df={};_0x25c6df[_0x4a2110]={'$like':'%'+_0x322759[_0x5b7c('0x40')][_0x5b7c('0x4c')]+'%'};return _0x25c6df;})});}_0x2a374d=_[_0x5b7c('0x4e')]({},_0x2a374d,_0x322759[_0x5b7c('0x4f')]);return _0x66a627[_0x5b7c('0x7a')](_0x2a374d);}})[_0x5b7c('0x1f')](function(_0x28a2b5){if(_0x28a2b5){_0x33297d=_0x28a2b5['length'];if(!_0x322759[_0x5b7c('0x40')][_0x5b7c('0x47')](_0x5b7c('0x67'))){_0x2a374d['limit']=qs[_0x5b7c('0x2e')](_0x322759['query'][_0x5b7c('0x2e')]);_0x2a374d[_0x5b7c('0x2d')]=qs[_0x5b7c('0x2d')](_0x322759[_0x5b7c('0x40')][_0x5b7c('0x2d')]);}return _0x66a627['getApplications'](_0x2a374d);}})[_0x5b7c('0x1f')](function(_0x2f4d2d){if(_0x2f4d2d){return _0x2f4d2d?{'count':_0x33297d,'rows':_0x2f4d2d}:null;}})[_0x5b7c('0x1f')](respondWithResult(_0x355591,null))[_0x5b7c('0x29')](handleError(_0x355591,null));};function Extension(_0x21b2f1,_0x2f37f7,_0x31686b,_0x5d93e5){this['context']=_0x5b7c('0x7b');this[_0x5b7c('0x7c')]=_0x21b2f1[_0x5b7c('0x7d')];this[_0x5b7c('0x7e')]=_0x5d93e5;this[_0x5b7c('0x3e')]='system';this['description']=_0x5b7c('0x7f');this[_0x5b7c('0x63')]=_0x21b2f1['id'];this[_0x5b7c('0x80')]=_0x2f37f7;this[_0x5b7c('0x81')]=_0x31686b;}function createExtensionsReciveFax(_0x25047e){var _0x1043cc=0x1;var _0x92764a=[];_0x92764a[_0x5b7c('0x82')](new Extension(_0x25047e,_0x1043cc,'',_0x5b7c('0x83')));_0x1043cc+=0x1;_0x92764a[_0x5b7c('0x82')](new Extension(_0x25047e,_0x1043cc,'CDR(type)=inbound-fax',_0x5b7c('0x84')));_0x1043cc+=0x1;for(var _0x50cd3b in _0x25047e){if(_0x25047e[_0x5b7c('0x47')](_0x50cd3b)&&(_0x50cd3b===_0x5b7c('0x85')||_0x50cd3b===_0x5b7c('0x7d')||_0x50cd3b===_0x5b7c('0x86')||_0x50cd3b===_0x5b7c('0x87')||_0x50cd3b==='headerinfo'||_0x50cd3b===_0x5b7c('0x88')||_0x50cd3b==='minrate'||_0x50cd3b===_0x5b7c('0x89')||_0x50cd3b===_0x5b7c('0x8a'))){_0x92764a[_0x5b7c('0x82')](new Extension(_0x25047e,_0x1043cc,'FAXOPT('+_0x50cd3b+')='+_0x25047e[_0x50cd3b],_0x5b7c('0x84')));_0x1043cc+=0x1;}}_0x92764a['push'](new Extension(_0x25047e,_0x1043cc,'6',_0x5b7c('0x8b')));_0x1043cc+=0x1;_0x92764a[_0x5b7c('0x82')](new Extension(_0x25047e,_0x1043cc,_0x5b7c('0x8c'),_0x5b7c('0x8d')));_0x1043cc=0x0;return _0x92764a;}exports[_0x5b7c('0x8e')]=function(_0x1a0b7e,_0xd04b79,_0x4576f2){var _0x432d4f;return db[_0x5b7c('0x8f')][_0x5b7c('0x90')](function(_0x32e3ca){return db[_0x5b7c('0x50')]['create'](_0x1a0b7e['body'],{'transaction':_0x32e3ca})[_0x5b7c('0x1f')](function(_0x3a2b4b){_0x432d4f=_0x3a2b4b[_0x5b7c('0x32')]({'plain':!![]});return db[_0x5b7c('0x91')]['bulkCreate'](createExtensionsReciveFax(_0x432d4f),{'transaction':_0x32e3ca});});})['then'](function(){return _0x432d4f;})[_0x5b7c('0x1f')](respondWithResult(_0xd04b79,null))[_0x5b7c('0x29')](handleError(_0xd04b79,null));};exports[_0x5b7c('0x92')]=function(_0x14caaf,_0x179fe2,_0x1c1bb1){var _0x3d6ae1;return db[_0x5b7c('0x8f')]['transaction'](function(_0x4c09a5){return db[_0x5b7c('0x50')][_0x5b7c('0x61')](_0x14caaf['body'],{'where':{'id':_0x14caaf[_0x5b7c('0x5a')]['id']},'transaction':_0x4c09a5})[_0x5b7c('0x1f')](function(_0x32b268){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x14caaf['body']['id']},'transaction':_0x4c09a5})[_0x5b7c('0x1f')](function(_0xcee964){return db[_0x5b7c('0x91')][_0x5b7c('0x78')](createExtensionsReciveFax(_[_0x5b7c('0x6f')](_0x14caaf['body'],[_0x5b7c('0x93'),_0x5b7c('0x3f'),'createdAt',_0x5b7c('0x94'),'TrunkId',_0x5b7c('0x95')])),{'transaction':_0x4c09a5});});});})[_0x5b7c('0x1f')](function(){return db[_0x5b7c('0x50')][_0x5b7c('0x96')](_0x14caaf[_0x5b7c('0x5a')]['id']);})[_0x5b7c('0x1f')](respondWithResult(_0x179fe2,null))[_0x5b7c('0x29')](handleError(_0x179fe2,null));};exports[_0x5b7c('0x97')]=function(_0xf230ae,_0x49391d,_0x2a1624){var _0xd6e56d={'raw':!![],'where':{}};var _0x537210={};var _0x1cd721={'count':0x0,'rows':[]};return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0xf230ae[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x49391d,null))[_0x5b7c('0x1f')](function(_0x5ca54d){if(_0x5ca54d){_0x537210['model']=_[_0x5b7c('0x56')](db[_0x5b7c('0x98')][_0x5b7c('0x3d')]);_0x537210[_0x5b7c('0x40')]=_[_0x5b7c('0x56')](_0xf230ae[_0x5b7c('0x40')]);_0x537210[_0x5b7c('0x41')]=_[_0x5b7c('0x42')](_0x537210[_0x5b7c('0x46')],_0x537210[_0x5b7c('0x40')]);_0xd6e56d[_0x5b7c('0x43')]=_[_0x5b7c('0x42')](_0x537210['model'],qs['fields'](_0xf230ae[_0x5b7c('0x40')]['fields']));_0xd6e56d[_0x5b7c('0x43')]=_0xd6e56d[_0x5b7c('0x43')][_0x5b7c('0x45')]?_0xd6e56d[_0x5b7c('0x43')]:_0x537210['model'];if(!_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x47')]('nolimit')){_0xd6e56d[_0x5b7c('0x2e')]=qs[_0x5b7c('0x2e')](_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x2e')]);_0xd6e56d[_0x5b7c('0x2d')]=qs[_0x5b7c('0x2d')](_0xf230ae['query']['offset']);}_0xd6e56d[_0x5b7c('0x48')]=qs['sort'](_0xf230ae[_0x5b7c('0x40')]['sort']);_0xd6e56d[_0x5b7c('0x4a')]=qs[_0x5b7c('0x41')](_['pick'](_0xf230ae['query'],_0x537210[_0x5b7c('0x41')]));_0xd6e56d[_0x5b7c('0x4a')][_0x5b7c('0x63')]=_0x5ca54d['id'];if(_0xf230ae['query'][_0x5b7c('0x4c')]){_0xd6e56d['where']=_['merge'](_0xd6e56d[_0x5b7c('0x4a')],{'$or':_['map'](_0xd6e56d[_0x5b7c('0x43')],function(_0x129f59){var _0x98560a={};_0x98560a[_0x129f59]={'$like':'%'+_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x4c')]+'%'};return _0x98560a;})});}if(_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x99')]){var _0x4d8da7=_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x99')][_0x5b7c('0x9a')](',');var _0x1f6350={};_0x1f6350[_0x4d8da7[0x0]]={'$gte':moment(_0x4d8da7[0x1])['format'](_0x5b7c('0x9b'))};_0xd6e56d[_0x5b7c('0x4a')]=_[_0x5b7c('0x4e')](_0xd6e56d[_0x5b7c('0x4a')],_0x1f6350);}_0xd6e56d=_[_0x5b7c('0x4e')]({},_0xd6e56d,_0xf230ae[_0x5b7c('0x4f')]);return db[_0x5b7c('0x98')]['count']({'where':_0xd6e56d['where']})[_0x5b7c('0x1f')](function(_0x39192a){_0x1cd721[_0x5b7c('0x51')]=_0x39192a;if(_0xf230ae[_0x5b7c('0x40')][_0x5b7c('0x52')]){_0xd6e56d[_0x5b7c('0x57')]=[{'all':!![]}];}return db[_0x5b7c('0x98')][_0x5b7c('0x53')](_0xd6e56d);})[_0x5b7c('0x1f')](function(_0x28f6b7){_0x1cd721[_0x5b7c('0x54')]=_0x28f6b7;return _0x1cd721;});}})[_0x5b7c('0x1f')](respondWithFilteredResult(_0x49391d,_0xd6e56d))['catch'](handleError(_0x49391d,null));};exports['send']=function(_0x1d8f30,_0x1cf577,_0x2ca2d9){var _0x5d5d83,_0x51d799={},_0x12a268;if(_0x1d8f30[_0x5b7c('0x5a')]['to']){_0x12a268=_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0];}return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x1d8f30[_0x5b7c('0x55')]['id']},'include':[{'model':db[_0x5b7c('0x9c')],'as':_0x5b7c('0x9d'),'include':[{'model':db[_0x5b7c('0x70')],'as':'Contacts','where':{'fax':_0x12a268},'limit':0x1,'order':[['updatedAt',_0x5b7c('0x9e')]]}]}]})[_0x5b7c('0x1f')](handleEntityNotFound(_0x1cf577,null))[_0x5b7c('0x1f')](function(_0x21b79a){_0x5d5d83=_0x21b79a;if(_0x1d8f30['body'][_0x5b7c('0x9f')]&&_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][_0x5b7c('0x45')]){for(var _0x16c628=0x0;_0x16c628<_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][_0x5b7c('0x45')];_0x16c628+=0x1){_0x1d8f30['body'][_0x5b7c('0x9f')][_0x16c628]={'filename':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][_0x16c628][_0x5b7c('0x38')],'id':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][_0x16c628]['id'],'path':path[_0x5b7c('0xa0')](config[_0x5b7c('0xa1')],_0x5b7c('0xa2'),_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][_0x16c628][_0x5b7c('0xa3')])};}}return respondWithRpcPromise(_0x5b7c('0xa4'),_0x5b7c('0xa4'),{'FaxAccountId':_['isNil'](_0x1d8f30['params']['id'])?undefined:_0x1d8f30[_0x5b7c('0x55')]['id'],'path':_['isNil'](_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0][_0x5b7c('0xa5')])?undefined:_0x1d8f30['body'][_0x5b7c('0x9f')][0x0][_0x5b7c('0xa5')],'fax':_[_0x5b7c('0xa6')](_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0])?undefined:_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x5d5d83){if(_['isNil'](_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0xa7')])){_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0xa7')]=util[_0x5b7c('0xa8')](_0x5b7c('0xa9'),_0x5d5d83['name'],_0x5d5d83['fax']);}if(_0x5d5d83[_0x5b7c('0x9d')]){if(_0x5d5d83[_0x5b7c('0x9d')]['Contacts']['length']){return _0x5d5d83[_0x5b7c('0x9d')][_0x5b7c('0xaa')][0x0];}else{return db[_0x5b7c('0x70')]['create'](_[_0x5b7c('0x17')](_0x1d8f30[_0x5b7c('0x5a')],{'firstName':_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0],'phone':_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0],'fax':_0x1d8f30['body']['to'][0x0],'ListId':_0x5d5d83[_0x5b7c('0x95')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x5b7c('0x1f')](function(_0x5b9426){if(_0x5b9426){return db[_0x5b7c('0xab')][_0x5b7c('0x58')]({'where':{'ContactId':_0x5b9426['id'],'closed':![],'FaxAccountId':_0x5d5d83['id']}})[_0x5b7c('0x1f')](function(_0x237c0d){if(_0x237c0d){return[_0x237c0d,![]];}return db[_0x5b7c('0xab')][_0x5b7c('0x59')]({'UserId':_0x1d8f30[_0x5b7c('0x5b')]['id'],'ContactId':_0x5b9426['id'],'FaxAccountId':_0x5d5d83['id'],'fax':_0x1d8f30['body']['to'][0x0],'firstMsgDirection':_0x5b7c('0xac'),'Messages':[_[_0x5b7c('0x4e')](_0x1d8f30[_0x5b7c('0x5a')],{'read':![],'body':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0][_0x5b7c('0xad')],'FaxAccountId':_0x5d5d83['id'],'UserId':_0x1d8f30[_0x5b7c('0x5b')]['id'],'ContactId':_0x5b9426['id'],'AttachmentId':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5b7c('0xae')}]})[_0x5b7c('0x1f')](function(_0x4c2868){return[_0x4c2868,!![]];});});}else{throw new Error(_0x5b7c('0xaf'));}})[_0x5b7c('0xb0')](function(_0xc7dd34,_0x33844b){if(_0x33844b){return _0xc7dd34;}return db['FaxMessage'][_0x5b7c('0x59')]({'direction':_0x5b7c('0xac'),'read':![],'body':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0]['filename'],'FaxAccountId':_0x5d5d83['id'],'FaxInteractionId':_0xc7dd34['id'],'UserId':_0x1d8f30[_0x5b7c('0x5b')]['id'],'ContactId':_0xc7dd34[_0x5b7c('0xb1')],'AttachmentId':_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0]['id']})[_0x5b7c('0x1f')](function(_0x31884f){_0xc7dd34[_0x5b7c('0xb2')][_0x5b7c('0xae')]=[];_0xc7dd34[_0x5b7c('0xb2')]['Messages'][_0x5b7c('0x82')](_0x31884f[_0x5b7c('0xb2')]);return _0xc7dd34;});})[_0x5b7c('0x1f')](function(_0x5d4b69){respondWithRpcPromise(_0x5b7c('0xb3'),_0x5b7c('0xb3'),{'FaxAccountId':_['isNil'](_0x1d8f30[_0x5b7c('0x55')]['id'])?undefined:_0x1d8f30['params']['id'],'path':_[_0x5b7c('0xa6')](_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0][_0x5b7c('0xa5')])?undefined:_0x1d8f30[_0x5b7c('0x5a')][_0x5b7c('0x9f')][0x0]['path'],'fax':_[_0x5b7c('0xa6')](_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0])?undefined:_0x1d8f30[_0x5b7c('0x5a')]['to'][0x0],'AttachmentId':_0x1d8f30[_0x5b7c('0x5a')]['attachments'][0x0]['id']},client9002)[_0x5b7c('0x1f')](function(_0x43a754){logger['info']('SendFaxRpc,\x20%s',_0x43a754);})[_0x5b7c('0x29')](function(_0xaa5f6e){logger[_0x5b7c('0x20')](_0x5b7c('0xb4'),_0xaa5f6e);});return _0x5d4b69;})['then'](respondWithResult(_0x1cf577,null))[_0x5b7c('0x29')](handleError(_0x1cf577,null));};exports[_0x5b7c('0xb5')]=function(_0x8b1581,_0x28793d,_0x242665){return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x8b1581[_0x5b7c('0x55')]['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0x28793d,null))[_0x5b7c('0x1f')](function(_0x4dcd72){if(_0x4dcd72){return _0x4dcd72[_0x5b7c('0xb5')](_0x8b1581[_0x5b7c('0x5a')][_0x5b7c('0x6d')],_[_0x5b7c('0x6f')](_0x8b1581[_0x5b7c('0x5a')],['ids','id'])||{})[_0x5b7c('0xb0')](function(_0x4c95aa){for(var _0x28d1b=0x0;_0x28d1b<_0x8b1581['body'][_0x5b7c('0x6d')][_0x5b7c('0x45')];_0x28d1b+=0x1){socket['emit'](_0x5b7c('0xb6'),{'UserId':_0x8b1581['body'][_0x5b7c('0x6d')][_0x28d1b],'FaxAccountId':_0x8b1581[_0x5b7c('0x55')]['id']});}return _0x4c95aa;});}})[_0x5b7c('0x1f')](respondWithResult(_0x28793d,null))[_0x5b7c('0x29')](handleError(_0x28793d,null));};exports['removeAgents']=function(_0x37444b,_0xd2cb30,_0x9c358b){return db[_0x5b7c('0x50')][_0x5b7c('0x58')]({'where':{'id':_0x37444b['params']['id']}})[_0x5b7c('0x1f')](handleEntityNotFound(_0xd2cb30,null))[_0x5b7c('0x1f')](function(_0x109bb3){if(_0x109bb3){return _0x109bb3[_0x5b7c('0xb7')](_0x37444b[_0x5b7c('0x40')]['ids'])[_0x5b7c('0x1f')](function(){if(_[_0x5b7c('0xb8')](_0x37444b['query'][_0x5b7c('0x6d')])){for(var _0x5e8ae2=0x0;_0x5e8ae2<_0x37444b['query'][_0x5b7c('0x6d')][_0x5b7c('0x45')];_0x5e8ae2+=0x1){socket[_0x5b7c('0xb9')](_0x5b7c('0xba'),{'UserId':Number(_0x37444b[_0x5b7c('0x40')][_0x5b7c('0x6d')][_0x5e8ae2]),'FaxAccountId':Number(_0x37444b['params']['id'])});}}else{socket[_0x5b7c('0xb9')](_0x5b7c('0xba'),{'UserId':Number(_0x37444b[_0x5b7c('0x40')][_0x5b7c('0x6d')]),'FaxAccountId':Number(_0x37444b[_0x5b7c('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xd2cb30,null))[_0x5b7c('0x29')](handleError(_0xd2cb30,null));};exports[_0x5b7c('0xbb')]=function(_0x486363,_0x1f418c,_0x11c27c){var _0x466d3f={};var _0xe8fbf7={};var _0x43d41d;var _0x16ee44;return db[_0x5b7c('0x50')][_0x5b7c('0x66')]({'where':{'id':_0x486363[_0x5b7c('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f418c,null))[_0x5b7c('0x1f')](function(_0xb0cb17){if(_0xb0cb17){_0x43d41d=_0xb0cb17;_0xe8fbf7[_0x5b7c('0x46')]=_[_0x5b7c('0x56')](db[_0x5b7c('0x72')][_0x5b7c('0x3d')]);_0xe8fbf7['query']=_[_0x5b7c('0x56')](_0x486363[_0x5b7c('0x40')]);_0xe8fbf7[_0x5b7c('0x41')]=_[_0x5b7c('0x42')](_0xe8fbf7[_0x5b7c('0x46')],_0xe8fbf7['query']);_0x466d3f['attributes']=_[_0x5b7c('0x42')](_0xe8fbf7[_0x5b7c('0x46')],qs[_0x5b7c('0x44')](_0x486363['query'][_0x5b7c('0x44')]));_0x466d3f[_0x5b7c('0x43')]=_0x466d3f['attributes'][_0x5b7c('0x45')]?_0x466d3f[_0x5b7c('0x43')]:_0xe8fbf7['model'];_0x466d3f['order']=qs[_0x5b7c('0x49')](_0x486363[_0x5b7c('0x40')][_0x5b7c('0x49')]);_0x466d3f[_0x5b7c('0x4a')]=qs[_0x5b7c('0x41')](_[_0x5b7c('0x4b')](_0x486363[_0x5b7c('0x40')],_0xe8fbf7[_0x5b7c('0x41')]));if(_0x486363[_0x5b7c('0x40')]['filter']){_0x466d3f['where']=_[_0x5b7c('0x4e')](_0x466d3f[_0x5b7c('0x4a')],{'$or':_[_0x5b7c('0x3c')](_0x466d3f['attributes'],function(_0x353e93){var _0x55d832={};_0x55d832[_0x353e93]={'$like':'%'+_0x486363[_0x5b7c('0x40')][_0x5b7c('0x4c')]+'%'};return _0x55d832;})});}_0x466d3f=_[_0x5b7c('0x4e')]({},_0x466d3f,_0x486363['options']);return _0x43d41d[_0x5b7c('0xbb')](_0x466d3f);}})['then'](function(_0x8ab535){if(_0x8ab535){_0x16ee44=_0x8ab535[_0x5b7c('0x45')];if(!_0x486363[_0x5b7c('0x40')][_0x5b7c('0x47')](_0x5b7c('0x67'))){_0x466d3f['limit']=qs[_0x5b7c('0x2e')](_0x486363[_0x5b7c('0x40')][_0x5b7c('0x2e')]);_0x466d3f[_0x5b7c('0x2d')]=qs[_0x5b7c('0x2d')](_0x486363[_0x5b7c('0x40')][_0x5b7c('0x2d')]);}return _0x43d41d[_0x5b7c('0xbb')](_0x466d3f);}})[_0x5b7c('0x1f')](function(_0x49eec5){if(_0x49eec5){return _0x49eec5?{'count':_0x16ee44,'rows':_0x49eec5}:null;}})['then'](respondWithResult(_0x1f418c,null))['catch'](handleError(_0x1f418c,null));}; \ No newline at end of file +var _0x2c83=['dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','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','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','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','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','includeAll','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','appdata','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','List','List\x20not\x20found','filename','Messages','Contact\x20not\x20found'];(function(_0x2e15b7,_0x14a32b){var _0x257a6c=function(_0x1d14b7){while(--_0x1d14b7){_0x2e15b7['push'](_0x2e15b7['shift']());}};_0x257a6c(++_0x14a32b);}(_0x2c83,0xcb));var _0x32c8=function(_0x4a78f,_0x33581c){_0x4a78f=_0x4a78f-0x0;var _0x2bb41b=_0x2c83[_0x4a78f];return _0x2bb41b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32c8('0x1'));var jsonpatch=require(_0x32c8('0x2'));var rp=require(_0x32c8('0x3'));var moment=require(_0x32c8('0x4'));var BPromise=require(_0x32c8('0x5'));var Mustache=require(_0x32c8('0x6'));var util=require(_0x32c8('0x7'));var path=require(_0x32c8('0x8'));var sox=require(_0x32c8('0x9'));var csv=require(_0x32c8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x32c8('0xb'));var squel=require(_0x32c8('0xc'));var crypto=require(_0x32c8('0xd'));var jsforce=require(_0x32c8('0xe'));var deskjs=require(_0x32c8('0xf'));var toCsv=require(_0x32c8('0xa'));var querystring=require(_0x32c8('0x10'));var Papa=require(_0x32c8('0x11'));var Redis=require(_0x32c8('0x12'));var authService=require(_0x32c8('0x13'));var qs=require(_0x32c8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32c8('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x32c8('0x16'));var db=require(_0x32c8('0x17'))['db'];config[_0x32c8('0x18')]=_[_0x32c8('0x19')](config['redis'],{'host':_0x32c8('0x1a'),'port':0x18eb});var socket=require(_0x32c8('0x1b'))(new Redis(config[_0x32c8('0x18')]));require(_0x32c8('0x1c'))[_0x32c8('0x1d')](socket);var jayson=require(_0x32c8('0x1e'));var client=jayson[_0x32c8('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x32c8('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x14f882,_0x3cfdc2,_0xc89622){if(_0xc89622){var _0x498004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x498004['test'](_0x3cfdc2)){return _0x14f882;}else{throw new db[(_0x32c8('0x20'))][(_0x32c8('0x21'))](_0x32c8('0x22'));}}else{return _0x14f882;}}function respondWithRpcPromise(_0x578cff,_0x160c68,_0x51fe28,_0x2d6944){return new BPromise(function(_0x4d7323,_0x158dd9){var _0x40d81b=_0x2d6944||client;return _0x40d81b[_0x32c8('0x23')](_0x578cff,_0x51fe28)[_0x32c8('0x24')](function(_0x5e0ecc){logger[_0x32c8('0x25')](_0x32c8('0x26'),_0x160c68,_0x32c8('0x27'));logger[_0x32c8('0x28')](_0x32c8('0x29'),_0x160c68,_0x32c8('0x27'),JSON['stringify'](_0x5e0ecc));if(_0x5e0ecc[_0x32c8('0x2a')]){if(_0x5e0ecc['error'][_0x32c8('0x2b')]===0x1f4){logger[_0x32c8('0x2a')](_0x32c8('0x26'),_0x160c68,_0x5e0ecc[_0x32c8('0x2a')]['message']);return _0x158dd9(_0x5e0ecc['error'][_0x32c8('0x2c')]);}logger[_0x32c8('0x2a')](_0x32c8('0x26'),_0x160c68,_0x5e0ecc[_0x32c8('0x2a')][_0x32c8('0x2c')]);return _0x4d7323(_0x5e0ecc['error'][_0x32c8('0x2c')]);}else{logger[_0x32c8('0x25')](_0x32c8('0x26'),_0x160c68,'request\x20sent');_0x4d7323(_0x5e0ecc['result'][_0x32c8('0x2c')]);}})[_0x32c8('0x2d')](function(_0x402345){logger[_0x32c8('0x2a')](_0x32c8('0x26'),_0x160c68,_0x402345);_0x158dd9(_0x402345);});});}function respondWithStatusCode(_0x142c72,_0x41c6b4){_0x41c6b4=_0x41c6b4||0xcc;return function(_0x4ee754){if(_0x4ee754){return _0x142c72[_0x32c8('0x2e')](_0x41c6b4);}return _0x142c72['status'](_0x41c6b4)[_0x32c8('0x2f')]();};}function respondWithResult(_0x4d6484,_0x1bcfcb){_0x1bcfcb=_0x1bcfcb||0xc8;return function(_0x234f5b){if(_0x234f5b){return _0x4d6484[_0x32c8('0x30')](_0x1bcfcb)['json'](_0x234f5b);}};}function respondWithFilteredResult(_0x151be4,_0x4f34d6){return function(_0x11a269){if(_0x11a269){var _0x49bef6=_0x11a269[_0x32c8('0x31')],_0x26e6f3=_0x4f34d6[_0x32c8('0x32')],_0x5400f6=_0x4f34d6[_0x32c8('0x32')]+_0x4f34d6[_0x32c8('0x33')],_0x3c68f5;if(_0x5400f6>=_0x49bef6){_0x5400f6=_0x49bef6;_0x3c68f5=0xc8;}else{_0x3c68f5=0xce;}_0x151be4[_0x32c8('0x30')](_0x3c68f5);return _0x151be4['set'](_0x32c8('0x34'),_0x26e6f3+'-'+_0x5400f6+'/'+_0x49bef6)[_0x32c8('0x35')](_0x11a269);}return null;};}function patchUpdates(_0x401e67){return function(_0x552dfd){try{jsonpatch[_0x32c8('0x36')](_0x552dfd,_0x401e67,!![]);}catch(_0x14c75a){return BPromise['reject'](_0x14c75a);}return _0x552dfd[_0x32c8('0x37')]();};}function saveUpdates(_0x25a60a,_0x3f70b9){return function(_0x4c6b34){if(_0x4c6b34){return _0x4c6b34['update'](_0x25a60a)['then'](function(_0x1237e8){return _0x1237e8;});}return null;};}function removeEntity(_0x2d6d02,_0x4aef20){return function(_0x4a4c54){if(_0x4a4c54){return _0x4a4c54[_0x32c8('0x38')]()['then'](function(){var _0x5a7f8f=_0x4a4c54[_0x32c8('0x39')]({'plain':!![]});var _0x3fefcf=_0x32c8('0x3a');return db[_0x32c8('0x3b')][_0x32c8('0x38')]({'where':{'type':_0x3fefcf,'resourceId':_0x5a7f8f['id']}})[_0x32c8('0x24')](function(){return _0x4a4c54;});})[_0x32c8('0x24')](function(){_0x2d6d02[_0x32c8('0x30')](0xcc)[_0x32c8('0x2f')]();});}};}function handleEntityNotFound(_0x26991e,_0x1177bf){return function(_0x126810){if(!_0x126810){_0x26991e[_0x32c8('0x2e')](0x194);}return _0x126810;};}function handleError(_0x164176,_0x24fd58){_0x24fd58=_0x24fd58||0x1f4;return function(_0x311430){logger[_0x32c8('0x2a')](_0x311430[_0x32c8('0x3c')]);if(_0x311430[_0x32c8('0x3d')]){delete _0x311430['name'];}_0x164176['status'](_0x24fd58)[_0x32c8('0x3e')](_0x311430);};}exports[_0x32c8('0x3f')]=function(_0x117046,_0x595e33){var _0x3b8c72={'include':[{'model':db[_0x32c8('0x40')],'as':'mandatoryDispositionPause'}]},_0x434861={},_0x4c4eb1={'count':0x0,'rows':[]};var _0x589e53=_[_0x32c8('0x41')](db[_0x32c8('0x42')][_0x32c8('0x43')],function(_0x30b7d5){return{'name':_0x30b7d5['fieldName'],'type':_0x30b7d5[_0x32c8('0x44')]['key']};});_0x434861[_0x32c8('0x45')]=_['map'](_0x589e53,'name');_0x434861[_0x32c8('0x46')]=_['keys'](_0x117046['query']);_0x434861[_0x32c8('0x47')]=_[_0x32c8('0x48')](_0x434861[_0x32c8('0x45')],_0x434861['query']);_0x3b8c72[_0x32c8('0x49')]=_[_0x32c8('0x48')](_0x434861[_0x32c8('0x45')],qs[_0x32c8('0x4a')](_0x117046['query']['fields']));_0x3b8c72['attributes']=_0x3b8c72[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x3b8c72[_0x32c8('0x49')]:_0x434861[_0x32c8('0x45')];if(!_0x117046[_0x32c8('0x46')][_0x32c8('0x4c')]('nolimit')){_0x3b8c72['limit']=qs[_0x32c8('0x33')](_0x117046[_0x32c8('0x46')][_0x32c8('0x33')]);_0x3b8c72['offset']=qs[_0x32c8('0x32')](_0x117046['query'][_0x32c8('0x32')]);}_0x3b8c72[_0x32c8('0x4d')]=qs['sort'](_0x117046[_0x32c8('0x46')][_0x32c8('0x4e')]);_0x3b8c72[_0x32c8('0x4f')]=qs['filters'](_[_0x32c8('0x50')](_0x117046[_0x32c8('0x46')],_0x434861[_0x32c8('0x47')]),_0x589e53);if(_0x117046['query'][_0x32c8('0x51')]){_0x3b8c72[_0x32c8('0x4f')]=_['merge'](_0x3b8c72['where'],{'$or':_[_0x32c8('0x41')](_0x589e53,function(_0x48a011){if(_0x48a011[_0x32c8('0x44')]!=='VIRTUAL'){var _0x33e530={};_0x33e530[_0x48a011[_0x32c8('0x3d')]]={'$like':'%'+_0x117046[_0x32c8('0x46')][_0x32c8('0x51')]+'%'};return _0x33e530;}})});}_0x3b8c72=_[_0x32c8('0x52')]({},_0x3b8c72,_0x117046[_0x32c8('0x53')]);var _0x415e7c={'where':_0x3b8c72[_0x32c8('0x4f')]};return db['FaxAccount'][_0x32c8('0x31')](_0x415e7c)[_0x32c8('0x24')](function(_0x396adb){_0x4c4eb1['count']=_0x396adb;if(_0x117046[_0x32c8('0x46')]['includeAll']){_0x3b8c72['include']=[{'all':!![]}];}return db[_0x32c8('0x42')][_0x32c8('0x54')](_0x3b8c72);})['then'](function(_0x129d4e){_0x4c4eb1[_0x32c8('0x55')]=_0x129d4e;return _0x4c4eb1;})[_0x32c8('0x24')](respondWithFilteredResult(_0x595e33,_0x3b8c72))['catch'](handleError(_0x595e33,null));};exports[_0x32c8('0x56')]=function(_0x566b8e,_0x5e2d8a){var _0x36bc0b={'raw':![],'where':{'id':_0x566b8e[_0x32c8('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x32c8('0x58')}]},_0x9ae354={};_0x9ae354[_0x32c8('0x45')]=_[_0x32c8('0x59')](db[_0x32c8('0x42')][_0x32c8('0x43')]);_0x9ae354[_0x32c8('0x46')]=_[_0x32c8('0x59')](_0x566b8e['query']);_0x9ae354['filters']=_[_0x32c8('0x48')](_0x9ae354[_0x32c8('0x45')],_0x9ae354[_0x32c8('0x46')]);_0x36bc0b[_0x32c8('0x49')]=_['intersection'](_0x9ae354[_0x32c8('0x45')],qs[_0x32c8('0x4a')](_0x566b8e[_0x32c8('0x46')][_0x32c8('0x4a')]));_0x36bc0b[_0x32c8('0x49')]=_0x36bc0b[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x36bc0b[_0x32c8('0x49')]:_0x9ae354[_0x32c8('0x45')];if(_0x566b8e[_0x32c8('0x46')]['includeAll']){_0x36bc0b['include']=[{'all':!![]}];}_0x36bc0b=_[_0x32c8('0x52')]({},_0x36bc0b,_0x566b8e['options']);return db[_0x32c8('0x42')][_0x32c8('0x5a')](_0x36bc0b)[_0x32c8('0x24')](handleEntityNotFound(_0x5e2d8a,null))[_0x32c8('0x24')](respondWithResult(_0x5e2d8a,null))[_0x32c8('0x2d')](handleError(_0x5e2d8a,null));};exports['create']=function(_0x136434,_0x17921c){return db[_0x32c8('0x42')][_0x32c8('0x5b')](_0x136434[_0x32c8('0x5c')],{})[_0x32c8('0x24')](function(_0x342bc1){var _0x26290b=_0x136434[_0x32c8('0x5d')][_0x32c8('0x39')]({'plain':!![]});if(!_0x26290b)throw new Error(_0x32c8('0x5e'));if(_0x26290b[_0x32c8('0x5f')]==='user'){var _0x573898=_0x342bc1[_0x32c8('0x39')]({'plain':!![]});var _0x2e37a8='FaxAccounts';return db[_0x32c8('0x60')][_0x32c8('0x5a')]({'where':{'name':_0x2e37a8,'userProfileId':_0x26290b[_0x32c8('0x61')]},'raw':!![]})[_0x32c8('0x24')](function(_0x5ede6d){if(_0x5ede6d&&_0x5ede6d[_0x32c8('0x62')]===0x0){return db[_0x32c8('0x3b')][_0x32c8('0x5b')]({'name':_0x573898['name'],'resourceId':_0x573898['id'],'type':_0x5ede6d[_0x32c8('0x3d')],'sectionId':_0x5ede6d['id']},{})[_0x32c8('0x24')](function(){return _0x342bc1;});}else{return _0x342bc1;}})[_0x32c8('0x2d')](function(_0x4b317f){logger[_0x32c8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b317f);throw _0x4b317f;});}return _0x342bc1;})[_0x32c8('0x24')](respondWithResult(_0x17921c,0xc9))[_0x32c8('0x2d')](handleError(_0x17921c,null));};exports[_0x32c8('0x63')]=function(_0x40b3bf,_0x346ef0){if(_0x40b3bf['body']['id']){delete _0x40b3bf[_0x32c8('0x5c')]['id'];}return db[_0x32c8('0x42')][_0x32c8('0x5a')]({'where':{'id':_0x40b3bf['params']['id']},'include':[{'model':db[_0x32c8('0x40')],'as':_0x32c8('0x58')}]})[_0x32c8('0x24')](handleEntityNotFound(_0x346ef0,null))[_0x32c8('0x24')](saveUpdates(_0x40b3bf['body'],null))['then'](respondWithResult(_0x346ef0,null))[_0x32c8('0x2d')](handleError(_0x346ef0,null));};exports['destroy']=function(_0x60d606,_0x2f82df){return db[_0x32c8('0x42')][_0x32c8('0x5a')]({'where':{'id':_0x60d606[_0x32c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f82df,null))[_0x32c8('0x24')](removeEntity(_0x2f82df,null))[_0x32c8('0x2d')](handleError(_0x2f82df,null));};exports['describe']=function(_0x5ef901,_0x31ab2a){return db['FaxAccount'][_0x32c8('0x64')]()[_0x32c8('0x24')](respondWithResult(_0x31ab2a,null))[_0x32c8('0x2d')](handleError(_0x31ab2a,null));};exports[_0x32c8('0x65')]=function(_0x49387a,_0x47a166,_0x1f3950){if(_0x49387a[_0x32c8('0x5c')]['id']){delete _0x49387a['body']['id'];}return db[_0x32c8('0x42')]['find']({'where':{'id':_0x49387a[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x47a166,null))[_0x32c8('0x24')](function(_0x41053f){if(_0x41053f){_0x49387a[_0x32c8('0x5c')]['FaxAccountId']=_0x41053f['id'];return db[_0x32c8('0x66')]['create'](_0x49387a[_0x32c8('0x5c')]);}})['then'](respondWithResult(_0x47a166,null))[_0x32c8('0x2d')](handleError(_0x47a166,null));};exports[_0x32c8('0x67')]=function(_0x5ba18a,_0x427433,_0x63d34e){var _0x53c91d={'raw':![],'where':{}};var _0x33d457={};var _0x5b01ab={'count':0x0,'rows':[]};return db['FaxAccount'][_0x32c8('0x68')]({'where':{'id':_0x5ba18a['params']['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x427433,null))[_0x32c8('0x24')](function(_0x2782f1){if(_0x2782f1){_0x33d457['model']=_['keys'](db[_0x32c8('0x66')][_0x32c8('0x43')]);_0x33d457[_0x32c8('0x46')]=_[_0x32c8('0x59')](_0x5ba18a[_0x32c8('0x46')]);_0x33d457['filters']=_[_0x32c8('0x48')](_0x33d457[_0x32c8('0x45')],_0x33d457[_0x32c8('0x46')]);_0x53c91d[_0x32c8('0x49')]=_[_0x32c8('0x48')](_0x33d457['model'],qs[_0x32c8('0x4a')](_0x5ba18a['query'][_0x32c8('0x4a')]));_0x53c91d[_0x32c8('0x49')]=_0x53c91d[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x53c91d[_0x32c8('0x49')]:_0x33d457[_0x32c8('0x45')];if(!_0x5ba18a[_0x32c8('0x46')]['hasOwnProperty']('nolimit')){_0x53c91d[_0x32c8('0x33')]=qs[_0x32c8('0x33')](_0x5ba18a[_0x32c8('0x46')][_0x32c8('0x33')]);_0x53c91d[_0x32c8('0x32')]=qs[_0x32c8('0x32')](_0x5ba18a[_0x32c8('0x46')][_0x32c8('0x32')]);}_0x53c91d[_0x32c8('0x4d')]=qs[_0x32c8('0x4e')](_0x5ba18a[_0x32c8('0x46')]['sort']);_0x53c91d[_0x32c8('0x4f')]=qs['filters'](_[_0x32c8('0x50')](_0x5ba18a[_0x32c8('0x46')],_0x33d457[_0x32c8('0x47')]));_0x53c91d[_0x32c8('0x4f')][_0x32c8('0x69')]=_0x2782f1['id'];if(_0x5ba18a['query'][_0x32c8('0x51')]){_0x53c91d[_0x32c8('0x4f')]=_['merge'](_0x53c91d[_0x32c8('0x4f')],{'$or':_[_0x32c8('0x41')](_0x53c91d[_0x32c8('0x49')],function(_0x3afa91){var _0x411e6={};_0x411e6[_0x3afa91]={'$like':'%'+_0x5ba18a[_0x32c8('0x46')][_0x32c8('0x51')]+'%'};return _0x411e6;})});}_0x53c91d=_[_0x32c8('0x52')]({},_0x53c91d,_0x5ba18a[_0x32c8('0x53')]);return db['Disposition']['count']({'where':_0x53c91d[_0x32c8('0x4f')]})[_0x32c8('0x24')](function(_0x11bc17){_0x5b01ab[_0x32c8('0x31')]=_0x11bc17;if(_0x5ba18a[_0x32c8('0x46')]['includeAll']){_0x53c91d[_0x32c8('0x6a')]=[{'all':!![]}];}return db[_0x32c8('0x66')][_0x32c8('0x54')](_0x53c91d);})['then'](function(_0x530409){_0x5b01ab['rows']=_0x530409;return _0x5b01ab;});}})[_0x32c8('0x24')](respondWithFilteredResult(_0x427433,_0x53c91d))['catch'](handleError(_0x427433,null));};exports[_0x32c8('0x6b')]=function(_0x4369b4,_0x5297fe,_0x1f5c73){return db[_0x32c8('0x42')]['find']({'where':{'id':_0x4369b4[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x5297fe,null))['then'](function(_0x14679b){if(_0x14679b){return _0x14679b[_0x32c8('0x6b')](_0x4369b4[_0x32c8('0x46')][_0x32c8('0x6c')]);}})[_0x32c8('0x24')](respondWithStatusCode(_0x5297fe,null))[_0x32c8('0x2d')](handleError(_0x5297fe,null));};exports[_0x32c8('0x6d')]=function(_0x58ee00,_0x531f49,_0x6f0bec){if(_0x58ee00[_0x32c8('0x5c')]['id']){delete _0x58ee00[_0x32c8('0x5c')]['id'];}return db['FaxAccount'][_0x32c8('0x5a')]({'where':{'id':_0x58ee00[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x531f49,null))[_0x32c8('0x24')](function(_0x2530b6){if(_0x2530b6){_0x58ee00['body'][_0x32c8('0x69')]=_0x2530b6['id'];return db[_0x32c8('0x6e')][_0x32c8('0x5b')](_0x58ee00[_0x32c8('0x5c')]);}})['then'](respondWithResult(_0x531f49,null))[_0x32c8('0x2d')](handleError(_0x531f49,null));};exports[_0x32c8('0x6f')]=function(_0x49d18c,_0x2f6a1b,_0x475c6c){var _0x548c4f={'raw':![],'where':{}};var _0x274bd3={};var _0x57b363={'count':0x0,'rows':[]};return db[_0x32c8('0x42')][_0x32c8('0x68')]({'where':{'id':_0x49d18c['params']['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x2f6a1b,null))['then'](function(_0x6a0aa2){if(_0x6a0aa2){_0x274bd3[_0x32c8('0x45')]=_[_0x32c8('0x59')](db[_0x32c8('0x6e')]['rawAttributes']);_0x274bd3[_0x32c8('0x46')]=_[_0x32c8('0x59')](_0x49d18c['query']);_0x274bd3[_0x32c8('0x47')]=_[_0x32c8('0x48')](_0x274bd3[_0x32c8('0x45')],_0x274bd3[_0x32c8('0x46')]);_0x548c4f['attributes']=_['intersection'](_0x274bd3['model'],qs[_0x32c8('0x4a')](_0x49d18c[_0x32c8('0x46')][_0x32c8('0x4a')]));_0x548c4f[_0x32c8('0x49')]=_0x548c4f[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x548c4f['attributes']:_0x274bd3[_0x32c8('0x45')];if(!_0x49d18c[_0x32c8('0x46')]['hasOwnProperty'](_0x32c8('0x70'))){_0x548c4f[_0x32c8('0x33')]=qs['limit'](_0x49d18c[_0x32c8('0x46')][_0x32c8('0x33')]);_0x548c4f['offset']=qs[_0x32c8('0x32')](_0x49d18c['query']['offset']);}_0x548c4f[_0x32c8('0x4d')]=qs[_0x32c8('0x4e')](_0x49d18c[_0x32c8('0x46')][_0x32c8('0x4e')]);_0x548c4f[_0x32c8('0x4f')]=qs[_0x32c8('0x47')](_[_0x32c8('0x50')](_0x49d18c[_0x32c8('0x46')],_0x274bd3[_0x32c8('0x47')]));_0x548c4f[_0x32c8('0x4f')][_0x32c8('0x69')]=_0x6a0aa2['id'];if(_0x49d18c[_0x32c8('0x46')][_0x32c8('0x51')]){_0x548c4f['where']=_[_0x32c8('0x52')](_0x548c4f[_0x32c8('0x4f')],{'$or':_[_0x32c8('0x41')](_0x548c4f[_0x32c8('0x49')],function(_0x592fd0){var _0x536f6a={};_0x536f6a[_0x592fd0]={'$like':'%'+_0x49d18c[_0x32c8('0x46')][_0x32c8('0x51')]+'%'};return _0x536f6a;})});}_0x548c4f=_[_0x32c8('0x52')]({},_0x548c4f,_0x49d18c[_0x32c8('0x53')]);return db[_0x32c8('0x6e')]['count']({'where':_0x548c4f[_0x32c8('0x4f')]})[_0x32c8('0x24')](function(_0x3a9131){_0x57b363[_0x32c8('0x31')]=_0x3a9131;if(_0x49d18c[_0x32c8('0x46')][_0x32c8('0x71')]){_0x548c4f[_0x32c8('0x6a')]=[{'all':!![]}];}return db[_0x32c8('0x6e')]['findAll'](_0x548c4f);})['then'](function(_0x2b17a0){_0x57b363['rows']=_0x2b17a0;return _0x57b363;});}})[_0x32c8('0x24')](respondWithFilteredResult(_0x2f6a1b,_0x548c4f))[_0x32c8('0x2d')](handleError(_0x2f6a1b,null));};exports['removeAnswers']=function(_0x5f443a,_0x2f3ba6,_0x39e578){return db[_0x32c8('0x42')][_0x32c8('0x5a')]({'where':{'id':_0x5f443a[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x2f3ba6,null))[_0x32c8('0x24')](function(_0x4ee78c){if(_0x4ee78c){return _0x4ee78c[_0x32c8('0x72')](_0x5f443a[_0x32c8('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x2f3ba6,null))[_0x32c8('0x2d')](handleError(_0x2f3ba6,null));};exports[_0x32c8('0x73')]=function(_0x1935e8,_0x59966f,_0x3197aa){return db['FaxInteraction'][_0x32c8('0x5a')]({'where':{'id':_0x1935e8[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x59966f,null))[_0x32c8('0x24')](function(_0x208597){if(_0x208597){return _0x208597[_0x32c8('0x73')](_0x1935e8[_0x32c8('0x5c')][_0x32c8('0x6c')],_[_0x32c8('0x74')](_0x1935e8[_0x32c8('0x5c')],['ids','id'])||{});}})[_0x32c8('0x24')](respondWithResult(_0x59966f,null))[_0x32c8('0x2d')](handleError(_0x59966f,null));};exports['getInteractions']=function(_0xb35938,_0x3dfb8f,_0x5f2974){var _0x41ff61={'raw':![],'where':{}};var _0x3e018e={};var _0x2df620={'count':0x0,'rows':[]};return db[_0x32c8('0x42')][_0x32c8('0x68')]({'where':{'id':_0xb35938[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x3dfb8f,null))[_0x32c8('0x24')](function(_0x540516){if(_0x540516){_0x3e018e[_0x32c8('0x45')]=_['keys'](db['FaxInteraction'][_0x32c8('0x43')]);_0x3e018e[_0x32c8('0x46')]=_[_0x32c8('0x59')](_0xb35938['query']);_0x3e018e[_0x32c8('0x47')]=_['intersection'](_0x3e018e[_0x32c8('0x45')],_0x3e018e[_0x32c8('0x46')]);_0x41ff61[_0x32c8('0x49')]=_[_0x32c8('0x48')](_0x3e018e[_0x32c8('0x45')],qs[_0x32c8('0x4a')](_0xb35938[_0x32c8('0x46')][_0x32c8('0x4a')]));_0x41ff61['attributes']=_0x41ff61[_0x32c8('0x49')]['length']?_0x41ff61[_0x32c8('0x49')]:_0x3e018e[_0x32c8('0x45')];if(!_0xb35938[_0x32c8('0x46')][_0x32c8('0x4c')](_0x32c8('0x70'))){_0x41ff61[_0x32c8('0x33')]=qs[_0x32c8('0x33')](_0xb35938[_0x32c8('0x46')][_0x32c8('0x33')]);_0x41ff61['offset']=qs['offset'](_0xb35938[_0x32c8('0x46')][_0x32c8('0x32')]);}_0x41ff61['order']=qs[_0x32c8('0x4e')](_0xb35938['query'][_0x32c8('0x4e')]);_0x41ff61[_0x32c8('0x4f')]=qs[_0x32c8('0x47')](_[_0x32c8('0x50')](_0xb35938[_0x32c8('0x46')],_0x3e018e['filters']));_0x41ff61[_0x32c8('0x4f')][_0x32c8('0x69')]=_0x540516['id'];if(_0xb35938[_0x32c8('0x46')][_0x32c8('0x51')]){_0x41ff61['where']=_[_0x32c8('0x52')](_0x41ff61[_0x32c8('0x4f')],{'$or':_['map'](_0x41ff61[_0x32c8('0x49')],function(_0x4a6a95){var _0x9d7b20={};_0x9d7b20[_0x4a6a95]={'$like':'%'+_0xb35938[_0x32c8('0x46')]['filter']+'%'};return _0x9d7b20;})});}_0x41ff61=_['merge']({},_0x41ff61,_0xb35938[_0x32c8('0x53')]);return db[_0x32c8('0x75')][_0x32c8('0x31')]({'where':_0x41ff61[_0x32c8('0x4f')]})[_0x32c8('0x24')](function(_0x58c52b){_0x2df620[_0x32c8('0x31')]=_0x58c52b;if(_0xb35938['query']['includeAll']){_0x41ff61[_0x32c8('0x6a')]=[{'model':db[_0x32c8('0x76')],'as':_0x32c8('0x77'),'required':![]},{'model':db[_0x32c8('0x78')],'as':'Owner','attributes':[_0x32c8('0x3d'),'fullname',_0x32c8('0x79')],'required':![]},{'model':db[_0x32c8('0x7a')],'as':_0x32c8('0x7b'),'attributes':['id','name',_0x32c8('0x7c')],'where':_0xb35938['query'][_0x32c8('0x7d')]?{'id':_0xb35938[_0x32c8('0x46')][_0x32c8('0x7d')]}:undefined,'required':_0xb35938[_0x32c8('0x46')][_0x32c8('0x7d')]?!![]:![]}];}return db[_0x32c8('0x75')][_0x32c8('0x54')](_0x41ff61);})['then'](function(_0x1522bc){_0x2df620[_0x32c8('0x55')]=_0x1522bc;return _0x2df620;});}})['then'](respondWithFilteredResult(_0x3dfb8f,_0x41ff61))[_0x32c8('0x2d')](handleError(_0x3dfb8f,null));};exports[_0x32c8('0x7e')]=function(_0x976325,_0x4206b6,_0x4331c5){return db[_0x32c8('0x42')]['findOne']({'where':{'id':_0x976325[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x4206b6,null))['then'](function(_0x4a5687){if(_0x4a5687){return db[_0x32c8('0x7f')][_0x32c8('0x80')](function(_0x3474d5){return db[_0x32c8('0x81')][_0x32c8('0x38')]({'where':{'FaxAccountId':_0x976325[_0x32c8('0x57')]['id']},'transaction':_0x3474d5})['then'](function(_0xf32a7e){var _0x2ebfdf=_[_0x32c8('0x41')](_0x976325[_0x32c8('0x5c')],function(_0x34cc73){_0x34cc73[_0x32c8('0x69')]=_0x976325[_0x32c8('0x57')]['id'];return _0x34cc73;});return db['FaxApplication'][_0x32c8('0x82')](_0x2ebfdf,{'transaction':_0x3474d5});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x976325[_0x32c8('0x57')]['id']},'order':_0x32c8('0x83')});});}})[_0x32c8('0x24')](respondWithResult(_0x4206b6,null))[_0x32c8('0x2d')](handleError(_0x4206b6,null));};exports['getApplications']=function(_0x1a56ab,_0x3a596f,_0x4b17b4){var _0x3aaa2d={};var _0xf1a07={};var _0xc85b43;var _0x2759d7;return db[_0x32c8('0x42')][_0x32c8('0x68')]({'where':{'id':_0x1a56ab[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x3a596f,null))[_0x32c8('0x24')](function(_0x4c7557){if(_0x4c7557){_0xc85b43=_0x4c7557;_0xf1a07[_0x32c8('0x45')]=_[_0x32c8('0x59')](db[_0x32c8('0x81')]['rawAttributes']);_0xf1a07[_0x32c8('0x46')]=_['keys'](_0x1a56ab[_0x32c8('0x46')]);_0xf1a07[_0x32c8('0x47')]=_[_0x32c8('0x48')](_0xf1a07[_0x32c8('0x45')],_0xf1a07[_0x32c8('0x46')]);_0x3aaa2d[_0x32c8('0x49')]=_['intersection'](_0xf1a07[_0x32c8('0x45')],qs['fields'](_0x1a56ab[_0x32c8('0x46')][_0x32c8('0x4a')]));_0x3aaa2d['attributes']=_0x3aaa2d[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x3aaa2d[_0x32c8('0x49')]:_0xf1a07['model'];_0x3aaa2d[_0x32c8('0x4d')]=qs[_0x32c8('0x4e')](_0x1a56ab[_0x32c8('0x46')][_0x32c8('0x4e')]);_0x3aaa2d[_0x32c8('0x4f')]=qs['filters'](_[_0x32c8('0x50')](_0x1a56ab['query'],_0xf1a07[_0x32c8('0x47')]));if(_0x1a56ab[_0x32c8('0x46')]['filter']){_0x3aaa2d[_0x32c8('0x4f')]=_[_0x32c8('0x52')](_0x3aaa2d['where'],{'$or':_[_0x32c8('0x41')](_0x3aaa2d[_0x32c8('0x49')],function(_0x4d1b09){var _0x25db2a={};_0x25db2a[_0x4d1b09]={'$like':'%'+_0x1a56ab[_0x32c8('0x46')][_0x32c8('0x51')]+'%'};return _0x25db2a;})});}_0x3aaa2d=_[_0x32c8('0x52')]({},_0x3aaa2d,_0x1a56ab[_0x32c8('0x53')]);return _0xc85b43['getApplications'](_0x3aaa2d);}})[_0x32c8('0x24')](function(_0x4287f4){if(_0x4287f4){_0x2759d7=_0x4287f4['length'];if(!_0x1a56ab[_0x32c8('0x46')][_0x32c8('0x4c')]('nolimit')){_0x3aaa2d['limit']=qs['limit'](_0x1a56ab[_0x32c8('0x46')][_0x32c8('0x33')]);_0x3aaa2d['offset']=qs[_0x32c8('0x32')](_0x1a56ab[_0x32c8('0x46')]['offset']);}return _0xc85b43[_0x32c8('0x84')](_0x3aaa2d);}})[_0x32c8('0x24')](function(_0x31aaeb){if(_0x31aaeb){return _0x31aaeb?{'count':_0x2759d7,'rows':_0x31aaeb}:null;}})[_0x32c8('0x24')](respondWithResult(_0x3a596f,null))['catch'](handleError(_0x3a596f,null));};function Extension(_0x5731e6,_0x6004cf,_0x16449c,_0x35481d){this[_0x32c8('0x85')]=_0x32c8('0x86');this[_0x32c8('0x87')]=_0x5731e6[_0x32c8('0x88')];this[_0x32c8('0x89')]=_0x35481d;this[_0x32c8('0x44')]=_0x32c8('0x8a');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x5731e6['id'];this[_0x32c8('0x83')]=_0x6004cf;this[_0x32c8('0x8b')]=_0x16449c;}function createExtensionsReciveFax(_0x9b5a65){var _0x40e23e=0x1;var _0x101c44=[];_0x101c44[_0x32c8('0x8c')](new Extension(_0x9b5a65,_0x40e23e,'','Answer'));_0x40e23e+=0x1;_0x101c44['push'](new Extension(_0x9b5a65,_0x40e23e,_0x32c8('0x8d'),'Set'));_0x40e23e+=0x1;for(var _0x1df3ec in _0x9b5a65){if(_0x9b5a65[_0x32c8('0x4c')](_0x1df3ec)&&(_0x1df3ec===_0x32c8('0x8e')||_0x1df3ec===_0x32c8('0x88')||_0x1df3ec===_0x32c8('0x8f')||_0x1df3ec===_0x32c8('0x90')||_0x1df3ec===_0x32c8('0x91')||_0x1df3ec==='maxrate'||_0x1df3ec===_0x32c8('0x92')||_0x1df3ec===_0x32c8('0x93')||_0x1df3ec===_0x32c8('0x94'))){_0x101c44['push'](new Extension(_0x9b5a65,_0x40e23e,_0x32c8('0x95')+_0x1df3ec+')='+_0x9b5a65[_0x1df3ec],_0x32c8('0x96')));_0x40e23e+=0x1;}}_0x101c44[_0x32c8('0x8c')](new Extension(_0x9b5a65,_0x40e23e,'6',_0x32c8('0x97')));_0x40e23e+=0x1;_0x101c44[_0x32c8('0x8c')](new Extension(_0x9b5a65,_0x40e23e,_0x32c8('0x98'),_0x32c8('0x99')));_0x40e23e=0x0;return _0x101c44;}exports[_0x32c8('0x9a')]=function(_0x1f3404,_0x2f32cd,_0x34b6a3){var _0x26b4ac;return db[_0x32c8('0x7f')]['transaction'](function(_0x2fc4ed){return db[_0x32c8('0x42')][_0x32c8('0x5b')](_0x1f3404[_0x32c8('0x5c')],{'transaction':_0x2fc4ed})[_0x32c8('0x24')](function(_0x3dc994){_0x26b4ac=_0x3dc994[_0x32c8('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x26b4ac),{'transaction':_0x2fc4ed});});})[_0x32c8('0x24')](function(){return _0x26b4ac;})[_0x32c8('0x24')](respondWithResult(_0x2f32cd,null))[_0x32c8('0x2d')](handleError(_0x2f32cd,null));};exports[_0x32c8('0x9b')]=function(_0x3abcad,_0x2cd567,_0x57bf8a){var _0x2f9f9f;return db['sequelize']['transaction'](function(_0x5a103e){return db[_0x32c8('0x42')][_0x32c8('0x63')](_0x3abcad[_0x32c8('0x5c')],{'where':{'id':_0x3abcad[_0x32c8('0x5c')]['id']},'transaction':_0x5a103e})[_0x32c8('0x24')](function(_0x37fa04){return db[_0x32c8('0x9c')][_0x32c8('0x38')]({'where':{'FaxAccountId':_0x3abcad[_0x32c8('0x5c')]['id']},'transaction':_0x5a103e})[_0x32c8('0x24')](function(_0x453a4f){return db[_0x32c8('0x9c')][_0x32c8('0x82')](createExtensionsReciveFax(_['omit'](_0x3abcad[_0x32c8('0x5c')],['tech',_0x32c8('0x9d'),_0x32c8('0x9e'),_0x32c8('0x9f'),_0x32c8('0xa0'),_0x32c8('0xa1')])),{'transaction':_0x5a103e});});});})[_0x32c8('0x24')](function(){return db[_0x32c8('0x42')][_0x32c8('0xa2')](_0x3abcad[_0x32c8('0x5c')]['id']);})[_0x32c8('0x24')](respondWithResult(_0x2cd567,null))['catch'](handleError(_0x2cd567,null));};exports[_0x32c8('0xa3')]=function(_0x481b5a,_0x453e5e,_0x450aa6){var _0x5c44b0={'raw':!![],'where':{}};var _0xaa7296={};var _0xea0359={'count':0x0,'rows':[]};return db[_0x32c8('0x42')][_0x32c8('0x68')]({'where':{'id':_0x481b5a[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x453e5e,null))['then'](function(_0x1b96b3){if(_0x1b96b3){_0xaa7296[_0x32c8('0x45')]=_[_0x32c8('0x59')](db[_0x32c8('0xa4')][_0x32c8('0x43')]);_0xaa7296[_0x32c8('0x46')]=_['keys'](_0x481b5a['query']);_0xaa7296['filters']=_[_0x32c8('0x48')](_0xaa7296[_0x32c8('0x45')],_0xaa7296[_0x32c8('0x46')]);_0x5c44b0[_0x32c8('0x49')]=_[_0x32c8('0x48')](_0xaa7296[_0x32c8('0x45')],qs['fields'](_0x481b5a[_0x32c8('0x46')][_0x32c8('0x4a')]));_0x5c44b0[_0x32c8('0x49')]=_0x5c44b0[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x5c44b0[_0x32c8('0x49')]:_0xaa7296['model'];if(!_0x481b5a[_0x32c8('0x46')][_0x32c8('0x4c')](_0x32c8('0x70'))){_0x5c44b0[_0x32c8('0x33')]=qs[_0x32c8('0x33')](_0x481b5a['query']['limit']);_0x5c44b0[_0x32c8('0x32')]=qs['offset'](_0x481b5a['query'][_0x32c8('0x32')]);}_0x5c44b0[_0x32c8('0x4d')]=qs[_0x32c8('0x4e')](_0x481b5a[_0x32c8('0x46')][_0x32c8('0x4e')]);_0x5c44b0[_0x32c8('0x4f')]=qs[_0x32c8('0x47')](_[_0x32c8('0x50')](_0x481b5a[_0x32c8('0x46')],_0xaa7296[_0x32c8('0x47')]));_0x5c44b0[_0x32c8('0x4f')]['FaxAccountId']=_0x1b96b3['id'];if(_0x481b5a[_0x32c8('0x46')][_0x32c8('0x51')]){_0x5c44b0['where']=_[_0x32c8('0x52')](_0x5c44b0[_0x32c8('0x4f')],{'$or':_['map'](_0x5c44b0[_0x32c8('0x49')],function(_0x3f59cc){var _0x1bd9ed={};_0x1bd9ed[_0x3f59cc]={'$like':'%'+_0x481b5a[_0x32c8('0x46')]['filter']+'%'};return _0x1bd9ed;})});}if(_0x481b5a[_0x32c8('0x46')]['$gte']){var _0x5e0041=_0x481b5a[_0x32c8('0x46')][_0x32c8('0xa5')][_0x32c8('0xa6')](',');var _0x1b036d={};_0x1b036d[_0x5e0041[0x0]]={'$gte':moment(_0x5e0041[0x1])[_0x32c8('0xa7')](_0x32c8('0xa8'))};_0x5c44b0[_0x32c8('0x4f')]=_[_0x32c8('0x52')](_0x5c44b0[_0x32c8('0x4f')],_0x1b036d);}_0x5c44b0=_['merge']({},_0x5c44b0,_0x481b5a[_0x32c8('0x53')]);return db[_0x32c8('0xa4')][_0x32c8('0x31')]({'where':_0x5c44b0[_0x32c8('0x4f')]})[_0x32c8('0x24')](function(_0x2e2627){_0xea0359[_0x32c8('0x31')]=_0x2e2627;if(_0x481b5a['query'][_0x32c8('0x71')]){_0x5c44b0[_0x32c8('0x6a')]=[{'all':!![]}];}return db[_0x32c8('0xa4')][_0x32c8('0x54')](_0x5c44b0);})[_0x32c8('0x24')](function(_0x9e12d){_0xea0359['rows']=_0x9e12d;return _0xea0359;});}})[_0x32c8('0x24')](respondWithFilteredResult(_0x453e5e,_0x5c44b0))[_0x32c8('0x2d')](handleError(_0x453e5e,null));};exports[_0x32c8('0x3e')]=function(_0x57bdcf,_0xff3832,_0x2cde1a){var _0x1448a7,_0x17dbc3={},_0x3c6704;if(_0x57bdcf[_0x32c8('0x5c')]['to']){_0x3c6704=_0x57bdcf[_0x32c8('0x5c')]['to'][0x0];}return db[_0x32c8('0x42')][_0x32c8('0x5a')]({'where':{'id':_0x57bdcf[_0x32c8('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x32c8('0x76')],'as':_0x32c8('0xa9'),'where':{'fax':_0x3c6704},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x32c8('0x24')](handleEntityNotFound(_0xff3832,null))[_0x32c8('0x24')](function(_0xe6f0f0){_0x1448a7=_0xe6f0f0;if(_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')]&&_0x57bdcf[_0x32c8('0x5c')]['attachments']['length']){for(var _0x5bdd2e=0x0;_0x5bdd2e<_0x57bdcf[_0x32c8('0x5c')]['attachments'][_0x32c8('0x4b')];_0x5bdd2e+=0x1){_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')][_0x5bdd2e]={'filename':_0x57bdcf[_0x32c8('0x5c')]['attachments'][_0x5bdd2e][_0x32c8('0x3d')],'id':_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')][_0x5bdd2e]['id'],'path':path[_0x32c8('0xab')](config[_0x32c8('0xac')],'server/files/attachments',_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')][_0x5bdd2e][_0x32c8('0xad')])};}}return respondWithRpcPromise(_0x32c8('0xae'),_0x32c8('0xae'),{'FaxAccountId':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x57')]['id'])?undefined:_0x57bdcf[_0x32c8('0x57')]['id'],'path':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x5c')]['attachments'][0x0][_0x32c8('0x8')])?undefined:_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')][0x0][_0x32c8('0x8')],'fax':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x5c')]['to'][0x0])?undefined:_0x57bdcf['body']['to'][0x0]},client9002);})[_0x32c8('0x24')](function(){if(_0x1448a7){if(_['isNil'](_0x57bdcf['body'][_0x32c8('0xb0')])){_0x57bdcf['body'][_0x32c8('0xb0')]=util['format']('\x22%s\x22\x20<%s>',_0x1448a7[_0x32c8('0x3d')],_0x1448a7[_0x32c8('0xb1')]);}if(_0x1448a7[_0x32c8('0xb2')]){if(_0x1448a7[_0x32c8('0xb2')][_0x32c8('0xa9')][_0x32c8('0x4b')]){return _0x1448a7[_0x32c8('0xb2')][_0x32c8('0xa9')][0x0];}else{return db[_0x32c8('0x76')][_0x32c8('0x5b')](_[_0x32c8('0x19')](_0x57bdcf['body'],{'firstName':_0x57bdcf['body']['to'][0x0],'phone':_0x57bdcf[_0x32c8('0x5c')]['to'][0x0],'fax':_0x57bdcf[_0x32c8('0x5c')]['to'][0x0],'ListId':_0x1448a7[_0x32c8('0xa1')]}));}}else{throw new Error(_0x32c8('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x32c8('0x24')](function(_0x496408){if(_0x496408){return db[_0x32c8('0x75')]['find']({'where':{'ContactId':_0x496408['id'],'closed':![],'FaxAccountId':_0x1448a7['id']}})[_0x32c8('0x24')](function(_0x34f028){if(_0x34f028){return[_0x34f028,![]];}return db[_0x32c8('0x75')][_0x32c8('0x5b')]({'UserId':_0x57bdcf[_0x32c8('0x5d')]['id'],'ContactId':_0x496408['id'],'FaxAccountId':_0x1448a7['id'],'fax':_0x57bdcf[_0x32c8('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x57bdcf['body'],{'read':![],'body':_0x57bdcf['body']['attachments'][0x0][_0x32c8('0xb4')],'FaxAccountId':_0x1448a7['id'],'UserId':_0x57bdcf['user']['id'],'ContactId':_0x496408['id'],'AttachmentId':_0x57bdcf[_0x32c8('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x32c8('0xa4')],'as':_0x32c8('0xb5')}]})[_0x32c8('0x24')](function(_0x11f455){return[_0x11f455,!![]];});});}else{throw new Error(_0x32c8('0xb6'));}})['spread'](function(_0xd4012,_0x3de39d){if(_0x3de39d){return _0xd4012;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x57bdcf['body'][_0x32c8('0xaa')][0x0][_0x32c8('0xb4')],'FaxAccountId':_0x1448a7['id'],'FaxInteractionId':_0xd4012['id'],'UserId':_0x57bdcf[_0x32c8('0x5d')]['id'],'ContactId':_0xd4012['ContactId'],'AttachmentId':_0x57bdcf['body'][_0x32c8('0xaa')][0x0]['id']})[_0x32c8('0x24')](function(_0x3ae4b2){_0xd4012[_0x32c8('0xb7')]['Messages']=[];_0xd4012['dataValues']['Messages'][_0x32c8('0x8c')](_0x3ae4b2[_0x32c8('0xb7')]);return _0xd4012;});})[_0x32c8('0x24')](function(_0xf718c4){respondWithRpcPromise('SendFax',_0x32c8('0xb8'),{'FaxAccountId':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x57')]['id'])?undefined:_0x57bdcf[_0x32c8('0x57')]['id'],'path':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x5c')][_0x32c8('0xaa')][0x0][_0x32c8('0x8')])?undefined:_0x57bdcf['body'][_0x32c8('0xaa')][0x0]['path'],'fax':_[_0x32c8('0xaf')](_0x57bdcf[_0x32c8('0x5c')]['to'][0x0])?undefined:_0x57bdcf[_0x32c8('0x5c')]['to'][0x0],'AttachmentId':_0x57bdcf['body'][_0x32c8('0xaa')][0x0]['id']},client9002)[_0x32c8('0x24')](function(_0x13eec7){logger['info']('SendFaxRpc,\x20%s',_0x13eec7);})[_0x32c8('0x2d')](function(_0x40eb66){logger['info'](_0x32c8('0xb9'),_0x40eb66);});return _0xf718c4;})[_0x32c8('0x24')](respondWithResult(_0xff3832,null))['catch'](handleError(_0xff3832,null));};exports[_0x32c8('0xba')]=function(_0x9427cb,_0x411633,_0x28a7c8){return db[_0x32c8('0x42')]['find']({'where':{'id':_0x9427cb[_0x32c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x411633,null))[_0x32c8('0x24')](function(_0x11f2c9){if(_0x11f2c9){return _0x11f2c9[_0x32c8('0xba')](_0x9427cb['body'][_0x32c8('0x6c')],_[_0x32c8('0x74')](_0x9427cb[_0x32c8('0x5c')],[_0x32c8('0x6c'),'id'])||{})[_0x32c8('0xbb')](function(_0x342d42){for(var _0x15919f=0x0;_0x15919f<_0x9427cb[_0x32c8('0x5c')][_0x32c8('0x6c')]['length'];_0x15919f+=0x1){socket[_0x32c8('0xbc')](_0x32c8('0xbd'),{'UserId':_0x9427cb[_0x32c8('0x5c')]['ids'][_0x15919f],'FaxAccountId':_0x9427cb['params']['id']});}return _0x342d42;});}})['then'](respondWithResult(_0x411633,null))[_0x32c8('0x2d')](handleError(_0x411633,null));};exports[_0x32c8('0xbe')]=function(_0x2149b2,_0x34dfba,_0x467b46){return db[_0x32c8('0x42')][_0x32c8('0x5a')]({'where':{'id':_0x2149b2[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x34dfba,null))['then'](function(_0xedc9bb){if(_0xedc9bb){return _0xedc9bb[_0x32c8('0xbe')](_0x2149b2[_0x32c8('0x46')][_0x32c8('0x6c')])[_0x32c8('0x24')](function(){if(_[_0x32c8('0xbf')](_0x2149b2[_0x32c8('0x46')][_0x32c8('0x6c')])){for(var _0x4162e6=0x0;_0x4162e6<_0x2149b2[_0x32c8('0x46')][_0x32c8('0x6c')][_0x32c8('0x4b')];_0x4162e6+=0x1){socket[_0x32c8('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x2149b2[_0x32c8('0x46')]['ids'][_0x4162e6]),'FaxAccountId':Number(_0x2149b2[_0x32c8('0x57')]['id'])});}}else{socket[_0x32c8('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x2149b2[_0x32c8('0x46')][_0x32c8('0x6c')]),'FaxAccountId':Number(_0x2149b2[_0x32c8('0x57')]['id'])});}});}})[_0x32c8('0x24')](respondWithStatusCode(_0x34dfba,null))['catch'](handleError(_0x34dfba,null));};exports[_0x32c8('0xc0')]=function(_0x596a16,_0x2570e2,_0x56b477){var _0x45ac36={};var _0x1316fa={};var _0x1a65c3;var _0x4ae63;return db['FaxAccount']['findOne']({'where':{'id':_0x596a16[_0x32c8('0x57')]['id']}})[_0x32c8('0x24')](handleEntityNotFound(_0x2570e2,null))['then'](function(_0x196af4){if(_0x196af4){_0x1a65c3=_0x196af4;_0x1316fa[_0x32c8('0x45')]=_[_0x32c8('0x59')](db['User']['rawAttributes']);_0x1316fa[_0x32c8('0x46')]=_['keys'](_0x596a16[_0x32c8('0x46')]);_0x1316fa[_0x32c8('0x47')]=_[_0x32c8('0x48')](_0x1316fa['model'],_0x1316fa[_0x32c8('0x46')]);_0x45ac36[_0x32c8('0x49')]=_[_0x32c8('0x48')](_0x1316fa[_0x32c8('0x45')],qs[_0x32c8('0x4a')](_0x596a16['query'][_0x32c8('0x4a')]));_0x45ac36[_0x32c8('0x49')]=_0x45ac36[_0x32c8('0x49')][_0x32c8('0x4b')]?_0x45ac36['attributes']:_0x1316fa['model'];_0x45ac36['order']=qs[_0x32c8('0x4e')](_0x596a16[_0x32c8('0x46')][_0x32c8('0x4e')]);_0x45ac36['where']=qs[_0x32c8('0x47')](_[_0x32c8('0x50')](_0x596a16[_0x32c8('0x46')],_0x1316fa['filters']));if(_0x596a16[_0x32c8('0x46')][_0x32c8('0x51')]){_0x45ac36[_0x32c8('0x4f')]=_['merge'](_0x45ac36[_0x32c8('0x4f')],{'$or':_['map'](_0x45ac36[_0x32c8('0x49')],function(_0x286403){var _0x462412={};_0x462412[_0x286403]={'$like':'%'+_0x596a16[_0x32c8('0x46')][_0x32c8('0x51')]+'%'};return _0x462412;})});}_0x45ac36=_['merge']({},_0x45ac36,_0x596a16[_0x32c8('0x53')]);return _0x1a65c3[_0x32c8('0xc0')](_0x45ac36);}})['then'](function(_0x6fdc6d){if(_0x6fdc6d){_0x4ae63=_0x6fdc6d[_0x32c8('0x4b')];if(!_0x596a16[_0x32c8('0x46')][_0x32c8('0x4c')](_0x32c8('0x70'))){_0x45ac36[_0x32c8('0x33')]=qs[_0x32c8('0x33')](_0x596a16['query']['limit']);_0x45ac36[_0x32c8('0x32')]=qs['offset'](_0x596a16[_0x32c8('0x46')][_0x32c8('0x32')]);}return _0x1a65c3['getAgents'](_0x45ac36);}})['then'](function(_0x33c57f){if(_0x33c57f){return _0x33c57f?{'count':_0x4ae63,'rows':_0x33c57f}:null;}})[_0x32c8('0x24')](respondWithResult(_0x2570e2,null))[_0x32c8('0x2d')](handleError(_0x2570e2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7ac3e85..1d3f8d0 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 _0xab06=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x57ee02,_0x58b0c4){var _0x2fc9b0=function(_0x565e77){while(--_0x565e77){_0x57ee02['push'](_0x57ee02['shift']());}};_0x2fc9b0(++_0x58b0c4);}(_0xab06,0xe5));var _0x6ab0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xab06[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x6ab0('0x0'));var FaxAccount=require(_0x6ab0('0x1'))['db'][_0x6ab0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6ab0('0x3')](0x0);var events={'afterCreate':_0x6ab0('0x4'),'afterUpdate':_0x6ab0('0x5'),'afterDestroy':_0x6ab0('0x6')};function emitEvent(_0x51c0dd){return function(_0x38a6dc,_0x197a15,_0x147816){FaxAccountEvents[_0x6ab0('0x7')](_0x51c0dd+':'+_0x38a6dc['id'],_0x38a6dc);FaxAccountEvents[_0x6ab0('0x7')](_0x51c0dd,_0x38a6dc);_0x147816(null);};}for(var e in events){if(events[_0x6ab0('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6ab0('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xc44b=['update','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x27279f,_0x2cc389){var _0x28b608=function(_0x29b76c){while(--_0x29b76c){_0x27279f['push'](_0x27279f['shift']());}};_0x28b608(++_0x2cc389);}(_0xc44b,0x9a));var _0xbc44=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xc44b[_0x2b55b5];return _0x103d28;};'use strict';var EventEmitter=require(_0xbc44('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xbc44('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc44('0x2'),'afterDestroy':'remove'};function emitEvent(_0x91c475){return function(_0x1081ff,_0x50fa54,_0x150d3e){FaxAccountEvents['emit'](_0x91c475+':'+_0x1081ff['id'],_0x1081ff);FaxAccountEvents['emit'](_0x91c475,_0x1081ff);_0x150d3e(null);};}for(var e in events){if(events[_0xbc44('0x3')](e)){var event=events[e];FaxAccount[_0xbc44('0x4')](e,emitEvent(event));}}module[_0xbc44('0x5')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c220243..6c8f2d6 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 _0xb5a3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','lodash'];(function(_0x12e69a,_0x35654c){var _0x3ba3cb=function(_0x34cb97){while(--_0x34cb97){_0x12e69a['push'](_0x12e69a['shift']());}};_0x3ba3cb(++_0x35654c);}(_0xb5a3,0x143));var _0x3b5a=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0xb5a3[_0x2dbcef];return _0x5a90ea;};'use strict';var _=require(_0x3b5a('0x0'));var util=require('util');var logger=require(_0x3b5a('0x1'))(_0x3b5a('0x2'));var moment=require(_0x3b5a('0x3'));var BPromise=require(_0x3b5a('0x4'));var rp=require(_0x3b5a('0x5'));var fs=require('fs');var path=require(_0x3b5a('0x6'));var rimraf=require(_0x3b5a('0x7'));var config=require(_0x3b5a('0x8'));var attributes=require('./faxAccount.attributes');module[_0x3b5a('0x9')]=function(_0x24a57e,_0x4f91f6){return _0x24a57e[_0x3b5a('0xa')](_0x3b5a('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabc3=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x27b16a,_0x1676ab){var _0x103faa=function(_0x3a5485){while(--_0x3a5485){_0x27b16a['push'](_0x27b16a['shift']());}};_0x103faa(++_0x1676ab);}(_0xabc3,0x154));var _0x3abc=function(_0x3d7d0c,_0x3c9289){_0x3d7d0c=_0x3d7d0c-0x0;var _0x145f6f=_0xabc3[_0x3d7d0c];return _0x145f6f;};'use strict';var _=require(_0x3abc('0x0'));var util=require(_0x3abc('0x1'));var logger=require(_0x3abc('0x2'))(_0x3abc('0x3'));var moment=require(_0x3abc('0x4'));var BPromise=require(_0x3abc('0x5'));var rp=require(_0x3abc('0x6'));var fs=require('fs');var path=require(_0x3abc('0x7'));var rimraf=require('rimraf');var config=require(_0x3abc('0x8'));var attributes=require(_0x3abc('0x9'));module[_0x3abc('0xa')]=function(_0x27a681,_0x30a5e9){return _0x27a681['define'](_0x3abc('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 02a9639..bc79183 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 _0xfb7c=['find','account','CmList','List','Contacts','FaxApplication','Applications','applications','list','orderBy','asc','length','create','contact','get','autoclose','close','*,*,*,*','created','interaction','ContactId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','map','model','include','then','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0xf7ee71,_0x786ff4){var _0x2341d3=function(_0x132fee){while(--_0x132fee){_0xf7ee71['push'](_0xf7ee71['shift']());}};_0x2341d3(++_0x786ff4);}(_0xfb7c,0xd5));var _0xcfb7=function(_0x454f38,_0x4fb675){_0x454f38=_0x454f38-0x0;var _0x460fe8=_0xfb7c[_0x454f38];return _0x460fe8;};'use strict';var _=require(_0xcfb7('0x0'));var util=require(_0xcfb7('0x1'));var moment=require(_0xcfb7('0x2'));var BPromise=require(_0xcfb7('0x3'));var rs=require(_0xcfb7('0x4'));var fs=require('fs');var Redis=require(_0xcfb7('0x5'));var db=require(_0xcfb7('0x6'))['db'];var utils=require(_0xcfb7('0x7'));var logger=require(_0xcfb7('0x8'))(_0xcfb7('0x9'));var config=require(_0xcfb7('0xa'));var jayson=require(_0xcfb7('0xb'));var client=jayson[_0xcfb7('0xc')][_0xcfb7('0xd')]({'port':0x232c});config[_0xcfb7('0xe')]=_[_0xcfb7('0xf')](config[_0xcfb7('0xe')],{'host':_0xcfb7('0x10'),'port':0x18eb});var socket=require(_0xcfb7('0x11'))(new Redis(config[_0xcfb7('0xe')]));require(_0xcfb7('0x12'))[_0xcfb7('0x13')](socket);function respondWithRpcPromise(_0x549393,_0x177620,_0x5bfa71){return new BPromise(function(_0x29a511,_0x2248eb){return client[_0xcfb7('0x14')](_0x549393,_0x5bfa71)['then'](function(_0x231b44){logger['info'](_0xcfb7('0x15'),_0x177620,_0xcfb7('0x16'));logger[_0xcfb7('0x17')](_0xcfb7('0x18'),_0x177620,_0xcfb7('0x16'),JSON['stringify'](_0x231b44));if(_0x231b44['error']){if(_0x231b44[_0xcfb7('0x19')][_0xcfb7('0x1a')]===0x1f4){logger['error'](_0xcfb7('0x15'),_0x177620,_0x231b44['error'][_0xcfb7('0x1b')]);return _0x2248eb(_0x231b44['error'][_0xcfb7('0x1b')]);}logger[_0xcfb7('0x19')](_0xcfb7('0x15'),_0x177620,_0x231b44[_0xcfb7('0x19')]['message']);return _0x29a511(_0x231b44[_0xcfb7('0x19')]['message']);}else{logger[_0xcfb7('0x1c')](_0xcfb7('0x15'),_0x177620,'request\x20sent');_0x29a511(_0x231b44[_0xcfb7('0x1d')][_0xcfb7('0x1b')]);}})[_0xcfb7('0x1e')](function(_0x3a5aba){logger[_0xcfb7('0x19')](_0xcfb7('0x15'),_0x177620,_0x3a5aba);_0x2248eb(_0x3a5aba);});});}exports[_0xcfb7('0x1f')]=function(_0x276726){var _0x2147a3=this;return new Promise(function(_0x197def,_0x1da797){return db[_0xcfb7('0x20')][_0xcfb7('0x21')]({'raw':_0x276726[_0xcfb7('0x22')]?_0x276726[_0xcfb7('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x276726[_0xcfb7('0x22')]?_0x276726[_0xcfb7('0x22')][_0xcfb7('0x23')]||null:null,'attributes':_0x276726['options']?_0x276726['options'][_0xcfb7('0x24')]||null:null,'limit':_0x276726[_0xcfb7('0x22')]?_0x276726['options'][_0xcfb7('0x25')]||null:null,'include':_0x276726[_0xcfb7('0x22')]?_0x276726[_0xcfb7('0x22')]['include']?_[_0xcfb7('0x26')](_0x276726[_0xcfb7('0x22')]['include'],function(_0xf93ac1){return{'model':db[_0xf93ac1[_0xcfb7('0x27')]],'as':_0xf93ac1['as'],'attributes':_0xf93ac1['attributes'],'include':_0xf93ac1[_0xcfb7('0x28')]?_[_0xcfb7('0x26')](_0xf93ac1[_0xcfb7('0x28')],function(_0x5b7cc2){return{'model':db[_0x5b7cc2[_0xcfb7('0x27')]],'as':_0x5b7cc2['as'],'attributes':_0x5b7cc2['attributes'],'include':_0x5b7cc2['include']?_['map'](_0x5b7cc2[_0xcfb7('0x28')],function(_0x4696f5){return{'model':db[_0x4696f5[_0xcfb7('0x27')]],'as':_0x4696f5['as'],'attributes':_0x4696f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xcfb7('0x29')](function(_0x4ec79c){logger['info'](_0xcfb7('0x1f'),_0x276726);logger[_0xcfb7('0x17')](_0xcfb7('0x1f'),_0x276726,JSON[_0xcfb7('0x2a')](_0x4ec79c));_0x197def(_0x4ec79c);})[_0xcfb7('0x1e')](function(_0x67125f){logger['error'](_0xcfb7('0x1f'),_0x67125f[_0xcfb7('0x1b')],_0x276726);_0x1da797(_0x2147a3[_0xcfb7('0x19')](0x1f4,_0x67125f[_0xcfb7('0x1b')]));});});};exports[_0xcfb7('0x2b')]=function(_0x161989,_0x12d87f,_0x427586){var _0x5c5df0=this;return new Promise(function(_0x4d69c2,_0x2fae25){var _0x4682d3={'body':_0x161989[_0xcfb7('0x2c')],'channel':_0xcfb7('0x2d')};var _0x1c3b0d=[];var _0x38df45=[];var _0x21754e={};return db[_0xcfb7('0x2e')][_0xcfb7('0x2f')]()[_0xcfb7('0x29')](function(_0x1a249c){if(!_0x1a249c){throw new db[(_0xcfb7('0x30'))][(_0xcfb7('0x31'))](_0xcfb7('0x32'));}_0x1c3b0d=_[_0xcfb7('0x33')](_['keys'](_0x1a249c),[_0xcfb7('0x34'),_0xcfb7('0x35')]);_0x38df45=_['difference'](_[_0xcfb7('0x36')](_0x1a249c),[_0xcfb7('0x34'),_0xcfb7('0x35'),_0xcfb7('0x37'),_0xcfb7('0x38')]);if(_0x161989[_0xcfb7('0x2c')]['id']){delete _0x161989[_0xcfb7('0x2c')]['id'];}if(_[_0xcfb7('0x39')](_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3a')])){throw new db[(_0xcfb7('0x30'))][(_0xcfb7('0x31'))](_0xcfb7('0x3b'));}if(_[_0xcfb7('0x39')](_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x2c')])||_0x161989[_0xcfb7('0x2c')]['body']===''){throw new db[(_0xcfb7('0x30'))][(_0xcfb7('0x31'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcfb7('0x39')](_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3c')])){throw new db[(_0xcfb7('0x30'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x38df45);}if(!_[_0xcfb7('0x3d')](_0x38df45,_0x161989['body'][_0xcfb7('0x3c')])){throw new db['Sequelize'][(_0xcfb7('0x31'))](_0xcfb7('0x3e')+_0x38df45);}_0x21754e[_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3c')]]=_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3a')];})['then'](function(){return db['FaxAccount'][_0xcfb7('0x3f')]({'where':{'id':_0x161989[_0xcfb7('0x40')]['id']},'include':[{'model':db[_0xcfb7('0x41')],'as':_0xcfb7('0x42'),'include':[{'model':db[_0xcfb7('0x2e')],'as':_0xcfb7('0x43'),'where':_0x21754e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcfb7('0x44')],'as':_0xcfb7('0x45')}]});})['then'](function(_0x5d08e0){if(_0x5d08e0&&_0x5d08e0['List']){var _0xdd2cf8=_0x5d08e0['get']({'plain':!![]});_0x4682d3[_0xcfb7('0x40')]=_0xdd2cf8;_0x4682d3[_0xcfb7('0x46')]=_0xdd2cf8['Applications'];_0x4682d3[_0xcfb7('0x47')]=_0xdd2cf8['List'];_0x4682d3['applications']=_[_0xcfb7('0x48')](_0x4682d3[_0xcfb7('0x46')],['priority'],[_0xcfb7('0x49')]);if(_0x4682d3[_0xcfb7('0x40')]['Applications']){delete _0x4682d3[_0xcfb7('0x40')]['Applications'];}if(_0x4682d3[_0xcfb7('0x40')]['List']&&_0x4682d3['account'][_0xcfb7('0x42')]['Contacts'][_0xcfb7('0x4a')]){return _0x4682d3[_0xcfb7('0x40')][_0xcfb7('0x42')][_0xcfb7('0x43')][0x0];}var _0xb5b68b=_[_0xcfb7('0xf')](_0x161989[_0xcfb7('0x2c')],{'firstName':_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3a')],'ListId':_0xdd2cf8[_0xcfb7('0x38')]});_0xb5b68b[_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x3c')]]=_0x161989[_0xcfb7('0x2c')]['from'];return db[_0xcfb7('0x2e')][_0xcfb7('0x4b')](_0xb5b68b,{'fields':_0x1c3b0d,'raw':!![]});}})[_0xcfb7('0x29')](function(_0x1eced4){_0x4682d3[_0xcfb7('0x4c')]=_0x1eced4;if(_0x1eced4){var _0x177142={'ContactId':_0x1eced4['id'],'FaxAccountId':_0x161989[_0xcfb7('0x40')]['id'],'fax':_0x1eced4['fax']};return db['FaxInteraction'][_0xcfb7('0x3f')]({'where':{'ContactId':_0x1eced4['id'],'closed':![],'FaxAccountId':_0x161989[_0xcfb7('0x40')]['id']}})[_0xcfb7('0x29')](function(_0x7ab295){if(_0x7ab295){return[_0x7ab295,![]];}return db['FaxInteraction'][_0xcfb7('0x4b')](_0x177142)[_0xcfb7('0x29')](function(_0x31f4bf){return[_0x31f4bf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xef6f64,_0xfed9f1){var _0x178282=_0xef6f64[_0xcfb7('0x4d')]({'plain':!![]});if(_0xfed9f1){if(_0x4682d3[_0xcfb7('0x40')][_0xcfb7('0x4e')]){_0x4682d3[_0xcfb7('0x46')]['push']({'id':0x0,'priority':_0x4682d3['applications'][_0xcfb7('0x4a')]+0x1,'app':_0xcfb7('0x4f'),'appdata':'unmanaged','interval':_0xcfb7('0x50')});}_0x178282['created']=!![];}else{_0x178282[_0xcfb7('0x51')]=![];}_0x4682d3[_0xcfb7('0x52')]=_0x178282;return db['FaxMessage'][_0xcfb7('0x4b')]({'body':_0x161989[_0xcfb7('0x2c')][_0xcfb7('0x2c')],'FaxAccountId':_0x161989['account']['id'],'FaxInteractionId':_0xef6f64['id'],'direction':'in','ContactId':_0xef6f64[_0xcfb7('0x53')],'AttachmentId':_0x161989[_0xcfb7('0x2c')]['AttachmentId']});})[_0xcfb7('0x29')](function(_0x489ab8){_0x4682d3[_0xcfb7('0x1b')]=_0x489ab8;if(_0x4682d3['interaction'][_0xcfb7('0x54')]){return db[_0xcfb7('0x55')][_0xcfb7('0x3f')]({'attributes':['id','name'],'where':{'id':_0x4682d3[_0xcfb7('0x52')]['UserId']}})[_0xcfb7('0x29')](function(_0x57f4ae){if(_0x57f4ae){_0x4682d3[_0xcfb7('0x46')][_0xcfb7('0x56')]({'id':0x0,'priority':0x0,'app':_0xcfb7('0x57'),'appdata':_0x57f4ae[_0xcfb7('0x58')]+','+(_0x4682d3[_0xcfb7('0x40')][_0xcfb7('0x59')]||0xa),'interval':_0xcfb7('0x50')});}return respondWithRpcPromise(_0xcfb7('0x5a'),_0xcfb7('0x5b'),_0x4682d3);});}return respondWithRpcPromise('Start',_0xcfb7('0x5b'),_0x4682d3);})[_0xcfb7('0x29')](function(_0x1bed5f){_0x4d69c2(_0x1bed5f);})[_0xcfb7('0x1e')](function(_0x308889){_0x2fae25(_0x5c5df0[_0xcfb7('0x19')](0x1f4,_0x308889['message']));});});}; \ No newline at end of file +var _0xa713=['FaxAccount,\x20%s,\x20%s','result','GetFaxAccount','FaxAccount','options','raw','attributes','include','map','model','then','catch','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','CompanyId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','Contacts','DESC','FaxApplication','get','Applications','list','applications','orderBy','asc','List','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','FaxMessage','UserId','User','find','name','interaction','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1a8fc3,_0x4f82ac){var _0x5ac998=function(_0x5ec9f3){while(--_0x5ec9f3){_0x1a8fc3['push'](_0x1a8fc3['shift']());}};_0x5ac998(++_0x4f82ac);}(_0xa713,0xe7));var _0x3a71=function(_0x54853e,_0x331249){_0x54853e=_0x54853e-0x0;var _0x1b7581=_0xa713[_0x54853e];return _0x1b7581;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a71('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a71('0x2'));var db=require(_0x3a71('0x3'))['db'];var utils=require(_0x3a71('0x4'));var logger=require(_0x3a71('0x5'))(_0x3a71('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a71('0x7')][_0x3a71('0x8')]({'port':0x232c});config[_0x3a71('0x9')]=_[_0x3a71('0xa')](config[_0x3a71('0x9')],{'host':_0x3a71('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a71('0x9')]));require(_0x3a71('0xc'))[_0x3a71('0xd')](socket);function respondWithRpcPromise(_0x592a70,_0x288530,_0x9bbcb1){return new BPromise(function(_0xfe526e,_0x33bda5){return client[_0x3a71('0xe')](_0x592a70,_0x9bbcb1)['then'](function(_0x1aaef6){logger[_0x3a71('0xf')]('FaxAccount,\x20%s,\x20%s',_0x288530,'request\x20sent');logger['debug'](_0x3a71('0x10'),_0x288530,_0x3a71('0x11'),JSON[_0x3a71('0x12')](_0x1aaef6));if(_0x1aaef6[_0x3a71('0x13')]){if(_0x1aaef6[_0x3a71('0x13')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x288530,_0x1aaef6[_0x3a71('0x13')]['message']);return _0x33bda5(_0x1aaef6['error']['message']);}logger[_0x3a71('0x13')]('FaxAccount,\x20%s,\x20%s',_0x288530,_0x1aaef6[_0x3a71('0x13')][_0x3a71('0x14')]);return _0xfe526e(_0x1aaef6[_0x3a71('0x13')][_0x3a71('0x14')]);}else{logger[_0x3a71('0xf')](_0x3a71('0x15'),_0x288530,'request\x20sent');_0xfe526e(_0x1aaef6[_0x3a71('0x16')]['message']);}})['catch'](function(_0x538458){logger['error'](_0x3a71('0x15'),_0x288530,_0x538458);_0x33bda5(_0x538458);});});}exports[_0x3a71('0x17')]=function(_0x41262e){var _0x377a32=this;return new Promise(function(_0x42a1d1,_0x5052ca){return db[_0x3a71('0x18')]['findAll']({'raw':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')][_0x3a71('0x1a')]===undefined?!![]:![]:!![],'where':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')]['where']||null:null,'attributes':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')][_0x3a71('0x1b')]||null:null,'limit':_0x41262e[_0x3a71('0x19')]?_0x41262e['options']['limit']||null:null,'include':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')][_0x3a71('0x1c')]?_[_0x3a71('0x1d')](_0x41262e['options'][_0x3a71('0x1c')],function(_0x140d69){return{'model':db[_0x140d69[_0x3a71('0x1e')]],'as':_0x140d69['as'],'attributes':_0x140d69[_0x3a71('0x1b')],'include':_0x140d69[_0x3a71('0x1c')]?_['map'](_0x140d69[_0x3a71('0x1c')],function(_0x4f712c){return{'model':db[_0x4f712c['model']],'as':_0x4f712c['as'],'attributes':_0x4f712c[_0x3a71('0x1b')],'include':_0x4f712c[_0x3a71('0x1c')]?_[_0x3a71('0x1d')](_0x4f712c[_0x3a71('0x1c')],function(_0x1fbac8){return{'model':db[_0x1fbac8['model']],'as':_0x1fbac8['as'],'attributes':_0x1fbac8[_0x3a71('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a71('0x1f')](function(_0x27237f){logger['info'](_0x3a71('0x17'),_0x41262e);logger['debug'](_0x3a71('0x17'),_0x41262e,JSON[_0x3a71('0x12')](_0x27237f));_0x42a1d1(_0x27237f);})[_0x3a71('0x20')](function(_0x36ca44){logger[_0x3a71('0x13')](_0x3a71('0x17'),_0x36ca44[_0x3a71('0x14')],_0x41262e);_0x5052ca(_0x377a32[_0x3a71('0x13')](0x1f4,_0x36ca44[_0x3a71('0x14')]));});});};exports['NotifyFaxAccount']=function(_0x5782c6,_0x24f266,_0x369fe6){var _0x301271=this;return new Promise(function(_0x41647f,_0x28e106){var _0x38746a={'body':_0x5782c6[_0x3a71('0x21')],'channel':_0x3a71('0x22')};var _0x437064=[];var _0x5d644a=[];var _0x27b811={};return db[_0x3a71('0x23')][_0x3a71('0x24')]()[_0x3a71('0x1f')](function(_0x4e568f){if(!_0x4e568f){throw new db['Sequelize'][(_0x3a71('0x25'))](_0x3a71('0x26'));}_0x437064=_['difference'](_[_0x3a71('0x27')](_0x4e568f),['createdAt',_0x3a71('0x28')]);_0x5d644a=_[_0x3a71('0x29')](_['keys'](_0x4e568f),['createdAt',_0x3a71('0x28'),_0x3a71('0x2a'),'ListId']);if(_0x5782c6[_0x3a71('0x21')]['id']){delete _0x5782c6[_0x3a71('0x21')]['id'];}if(_['isNil'](_0x5782c6['body'][_0x3a71('0x2b')])){throw new db[(_0x3a71('0x2c'))]['ValidationError'](_0x3a71('0x2d'));}if(_[_0x3a71('0x2e')](_0x5782c6['body'][_0x3a71('0x21')])||_0x5782c6[_0x3a71('0x21')][_0x3a71('0x21')]===''){throw new db['Sequelize'][(_0x3a71('0x25'))](_0x3a71('0x2f'));}if(_[_0x3a71('0x2e')](_0x5782c6['body']['mapKey'])){throw new db[(_0x3a71('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d644a);}if(!_[_0x3a71('0x30')](_0x5d644a,_0x5782c6['body']['mapKey'])){throw new db[(_0x3a71('0x2c'))]['ValidationError'](_0x3a71('0x31')+_0x5d644a);}_0x27b811[_0x5782c6['body'][_0x3a71('0x32')]]=_0x5782c6[_0x3a71('0x21')][_0x3a71('0x2b')];})[_0x3a71('0x1f')](function(){return db[_0x3a71('0x18')]['find']({'where':{'id':_0x5782c6[_0x3a71('0x33')]['id']},'include':[{'model':db[_0x3a71('0x34')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3a71('0x35'),'where':_0x27b811,'limit':0x1,'order':[['updatedAt',_0x3a71('0x36')]]}]},{'model':db[_0x3a71('0x37')],'as':'Applications'}]});})[_0x3a71('0x1f')](function(_0x54354f){if(_0x54354f&&_0x54354f['List']){var _0x497103=_0x54354f[_0x3a71('0x38')]({'plain':!![]});_0x38746a[_0x3a71('0x33')]=_0x497103;_0x38746a['applications']=_0x497103[_0x3a71('0x39')];_0x38746a[_0x3a71('0x3a')]=_0x497103['List'];_0x38746a[_0x3a71('0x3b')]=_[_0x3a71('0x3c')](_0x38746a[_0x3a71('0x3b')],['priority'],[_0x3a71('0x3d')]);if(_0x38746a[_0x3a71('0x33')][_0x3a71('0x39')]){delete _0x38746a[_0x3a71('0x33')][_0x3a71('0x39')];}if(_0x38746a[_0x3a71('0x33')][_0x3a71('0x3e')]&&_0x38746a[_0x3a71('0x33')]['List'][_0x3a71('0x35')][_0x3a71('0x3f')]){return _0x38746a[_0x3a71('0x33')]['List'][_0x3a71('0x35')][0x0];}var _0x333f97=_[_0x3a71('0xa')](_0x5782c6['body'],{'firstName':_0x5782c6['body'][_0x3a71('0x2b')],'ListId':_0x497103['ListId']});_0x333f97[_0x5782c6[_0x3a71('0x21')]['mapKey']]=_0x5782c6[_0x3a71('0x21')][_0x3a71('0x2b')];return db[_0x3a71('0x23')][_0x3a71('0x40')](_0x333f97,{'fields':_0x437064,'raw':!![]});}})['then'](function(_0x4bec43){_0x38746a[_0x3a71('0x41')]=_0x4bec43;if(_0x4bec43){var _0x5daa42={'ContactId':_0x4bec43['id'],'FaxAccountId':_0x5782c6[_0x3a71('0x33')]['id'],'fax':_0x4bec43[_0x3a71('0x22')]};return db[_0x3a71('0x42')]['find']({'where':{'ContactId':_0x4bec43['id'],'closed':![],'FaxAccountId':_0x5782c6[_0x3a71('0x33')]['id']}})['then'](function(_0x18c2c1){if(_0x18c2c1){return[_0x18c2c1,![]];}return db[_0x3a71('0x42')][_0x3a71('0x40')](_0x5daa42)['then'](function(_0x126230){return[_0x126230,!![]];});});}else{throw new Error(_0x3a71('0x43'));}})[_0x3a71('0x44')](function(_0x54023e,_0x450063){var _0x4a96c1=_0x54023e[_0x3a71('0x38')]({'plain':!![]});if(_0x450063){if(_0x38746a[_0x3a71('0x33')][_0x3a71('0x45')]){_0x38746a['applications'][_0x3a71('0x46')]({'id':0x0,'priority':_0x38746a['applications'][_0x3a71('0x3f')]+0x1,'app':_0x3a71('0x47'),'appdata':'unmanaged','interval':_0x3a71('0x48')});}_0x4a96c1[_0x3a71('0x49')]=!![];}else{_0x4a96c1[_0x3a71('0x49')]=![];}_0x38746a['interaction']=_0x4a96c1;return db[_0x3a71('0x4a')][_0x3a71('0x40')]({'body':_0x5782c6[_0x3a71('0x21')][_0x3a71('0x21')],'FaxAccountId':_0x5782c6['account']['id'],'FaxInteractionId':_0x54023e['id'],'direction':'in','ContactId':_0x54023e['ContactId'],'AttachmentId':_0x5782c6[_0x3a71('0x21')]['AttachmentId']});})[_0x3a71('0x1f')](function(_0xa53fc){_0x38746a[_0x3a71('0x14')]=_0xa53fc;if(_0x38746a['interaction'][_0x3a71('0x4b')]){return db[_0x3a71('0x4c')][_0x3a71('0x4d')]({'attributes':['id',_0x3a71('0x4e')],'where':{'id':_0x38746a[_0x3a71('0x4f')][_0x3a71('0x4b')]}})['then'](function(_0x3b7bdc){if(_0x3b7bdc){_0x38746a[_0x3a71('0x3b')][_0x3a71('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b7bdc[_0x3a71('0x4e')]+','+(_0x38746a['account'][_0x3a71('0x51')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3a71('0x52'),_0x3a71('0x53'),_0x38746a);});}return respondWithRpcPromise(_0x3a71('0x52'),_0x3a71('0x53'),_0x38746a);})['then'](function(_0x5e906a){_0x41647f(_0x5e906a);})[_0x3a71('0x20')](function(_0x1bdf9e){_0x28e106(_0x301271['error'](0x1f4,_0x1bdf9e[_0x3a71('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1e4092b..34a81d4 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['./faxAccount.events','save','update','removeListener','length','faxAccount:'];(function(_0x4d7432,_0x469887){var _0x35a835=function(_0x41ffcf){while(--_0x41ffcf){_0x4d7432['push'](_0x4d7432['shift']());}};_0x35a835(++_0x469887);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var FaxAccountEvents=require(_0x5432('0x0'));var events=[_0x5432('0x1'),'remove',_0x5432('0x2')];function createListener(_0x533c92,_0x12c8d8){return function(_0x480fb7){_0x12c8d8['emit'](_0x533c92,_0x480fb7);};}function removeListener(_0x20f704,_0x36ce53){return function(){FaxAccountEvents[_0x5432('0x3')](_0x20f704,_0x36ce53);};}exports['register']=function(_0x209e2e){for(var _0xbb0075=0x0,_0x4a6e76=events[_0x5432('0x4')];_0xbb0075<_0x4a6e76;_0xbb0075++){var _0x50394d=events[_0xbb0075];var _0xc8252e=createListener(_0x5432('0x5')+_0x50394d,_0x209e2e);FaxAccountEvents['on'](_0x50394d,_0xc8252e);}}; \ No newline at end of file +var _0x0424=['removeListener','register','length','remove','update','emit'];(function(_0x3d73f8,_0x19bf26){var _0x3d0ae3=function(_0x3cca23){while(--_0x3cca23){_0x3d73f8['push'](_0x3d73f8['shift']());}};_0x3d0ae3(++_0x19bf26);}(_0x0424,0x159));var _0x4042=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x0424[_0xf2628e];return _0x13863a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x4042('0x0'),_0x4042('0x1')];function createListener(_0x161add,_0x292a62){return function(_0x53f080){_0x292a62[_0x4042('0x2')](_0x161add,_0x53f080);};}function removeListener(_0x519987,_0x491eae){return function(){FaxAccountEvents[_0x4042('0x3')](_0x519987,_0x491eae);};}exports[_0x4042('0x4')]=function(_0x472795){for(var _0xc0fba0=0x0,_0x3abaf1=events[_0x4042('0x5')];_0xc0fba0<_0x3abaf1;_0xc0fba0++){var _0x10ec07=events[_0xc0fba0];var _0x5d11bf=createListener('faxAccount:'+_0x10ec07,_0x472795);FaxAccountEvents['on'](_0x10ec07,_0x5d11bf);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 506be48..2059cea 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 _0x00c5=['create','addDisposition','addAnswer','/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post'];(function(_0x5b0ab8,_0x207606){var _0x233002=function(_0x1c0244){while(--_0x1c0244){_0x5b0ab8['push'](_0x5b0ab8['shift']());}};_0x233002(++_0x207606);}(_0x00c5,0xa8));var _0x500c=function(_0x4d9b20,_0x5cffb9){_0x4d9b20=_0x4d9b20-0x0;var _0x32b26f=_0x00c5[_0x4d9b20];return _0x32b26f;};'use strict';var multer=require('multer');var util=require(_0x500c('0x0'));var path=require('path');var timeout=require(_0x500c('0x1'));var express=require('express');var router=express[_0x500c('0x2')]();var auth=require(_0x500c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x500c('0x4'));var controller=require('./faxAccount.controller');router[_0x500c('0x5')]('/',auth[_0x500c('0x6')](),controller[_0x500c('0x7')]);router[_0x500c('0x5')](_0x500c('0x8'),auth[_0x500c('0x6')](),controller['describe']);router[_0x500c('0x5')](_0x500c('0x9'),auth[_0x500c('0x6')](),controller[_0x500c('0xa')]);router[_0x500c('0x5')](_0x500c('0xb'),auth[_0x500c('0x6')](),controller['getDispositions']);router[_0x500c('0x5')](_0x500c('0xc'),auth['isAuthenticated'](),controller[_0x500c('0xd')]);router['get']('/:id/interactions',auth[_0x500c('0x6')](),controller[_0x500c('0xe')]);router[_0x500c('0x5')](_0x500c('0xf'),auth[_0x500c('0x6')](),controller[_0x500c('0x10')]);router[_0x500c('0x5')](_0x500c('0x11'),auth[_0x500c('0x6')](),controller[_0x500c('0x12')]);router[_0x500c('0x5')](_0x500c('0x13'),auth[_0x500c('0x6')](),controller[_0x500c('0x14')]);router[_0x500c('0x15')]('/',auth['isAuthenticated'](),controller[_0x500c('0x16')]);router[_0x500c('0x15')]('/:id/dispositions',auth[_0x500c('0x6')](),controller[_0x500c('0x17')]);router[_0x500c('0x15')](_0x500c('0xc'),auth[_0x500c('0x6')](),controller[_0x500c('0x18')]);router['post'](_0x500c('0x19'),auth[_0x500c('0x6')](),controller['addInteraction']);router[_0x500c('0x15')](_0x500c('0xf'),auth[_0x500c('0x6')](),controller[_0x500c('0x1a')]);router[_0x500c('0x15')](_0x500c('0x1b'),auth[_0x500c('0x6')](),controller[_0x500c('0x1c')]);router['post'](_0x500c('0x1d'),auth[_0x500c('0x6')](),controller['updateAccountApplications']);router[_0x500c('0x15')](_0x500c('0x1e'),auth[_0x500c('0x6')](),controller[_0x500c('0x1f')]);router[_0x500c('0x15')](_0x500c('0x13'),auth[_0x500c('0x6')](),controller[_0x500c('0x20')]);router[_0x500c('0x21')](_0x500c('0x9'),auth[_0x500c('0x6')](),controller['update']);router[_0x500c('0x22')](_0x500c('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x500c('0x22')](_0x500c('0xb'),auth[_0x500c('0x6')](),controller[_0x500c('0x23')]);router[_0x500c('0x22')](_0x500c('0xc'),auth[_0x500c('0x6')](),controller[_0x500c('0x24')]);router[_0x500c('0x22')](_0x500c('0x13'),auth[_0x500c('0x6')](),controller['removeAgents']);module[_0x500c('0x25')]=router; \ No newline at end of file +var _0x732c=['/:id/canned_answers','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe','describe','show','/:id/dispositions','getDispositions','isAuthenticated','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/users','post','addDisposition'];(function(_0x3196bf,_0x34315a){var _0x24da8b=function(_0x318622){while(--_0x318622){_0x3196bf['push'](_0x3196bf['shift']());}};_0x24da8b(++_0x34315a);}(_0x732c,0x101));var _0xc732=function(_0x4162dc,_0x5231ec){_0x4162dc=_0x4162dc-0x0;var _0x419651=_0x732c[_0x4162dc];return _0x419651;};'use strict';var multer=require(_0xc732('0x0'));var util=require(_0xc732('0x1'));var path=require(_0xc732('0x2'));var timeout=require(_0xc732('0x3'));var express=require(_0xc732('0x4'));var router=express[_0xc732('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc732('0x6'));var config=require(_0xc732('0x7'));var controller=require('./faxAccount.controller');router[_0xc732('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc732('0x8')](_0xc732('0x9'),auth['isAuthenticated'](),controller[_0xc732('0xa')]);router[_0xc732('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc732('0xb')]);router[_0xc732('0x8')](_0xc732('0xc'),auth['isAuthenticated'](),controller[_0xc732('0xd')]);router[_0xc732('0x8')]('/:id/canned_answers',auth[_0xc732('0xe')](),controller[_0xc732('0xf')]);router[_0xc732('0x8')](_0xc732('0x10'),auth[_0xc732('0xe')](),controller[_0xc732('0x11')]);router[_0xc732('0x8')]('/:id/applications',auth[_0xc732('0xe')](),controller[_0xc732('0x12')]);router[_0xc732('0x8')](_0xc732('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc732('0x8')](_0xc732('0x14'),auth[_0xc732('0xe')](),controller['getAgents']);router[_0xc732('0x15')]('/',auth[_0xc732('0xe')](),controller['create']);router[_0xc732('0x15')](_0xc732('0xc'),auth[_0xc732('0xe')](),controller[_0xc732('0x16')]);router[_0xc732('0x15')](_0xc732('0x17'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xc732('0x10'),auth[_0xc732('0xe')](),controller['addInteraction']);router[_0xc732('0x15')]('/:id/applications',auth[_0xc732('0xe')](),controller[_0xc732('0x18')]);router[_0xc732('0x15')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0xc732('0x19')]);router[_0xc732('0x15')](_0xc732('0x1a'),auth[_0xc732('0xe')](),controller[_0xc732('0x1b')]);router[_0xc732('0x15')](_0xc732('0x1c'),auth['isAuthenticated'](),controller[_0xc732('0x1d')]);router[_0xc732('0x15')](_0xc732('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0xc732('0x1e')]('/:id',auth[_0xc732('0xe')](),controller[_0xc732('0x1f')]);router[_0xc732('0x20')]('/:id',auth[_0xc732('0xe')](),controller['destroy']);router[_0xc732('0x20')](_0xc732('0xc'),auth[_0xc732('0xe')](),controller[_0xc732('0x21')]);router[_0xc732('0x20')](_0xc732('0x17'),auth[_0xc732('0xe')](),controller[_0xc732('0x22')]);router['delete'](_0xc732('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 74e9ade..2b7878d 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 _0x4888=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x4888,0x198));var _0x8488=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x4888[_0x6173fc];return _0x965fbe;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'priority':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8488('0x2')],'allowNull':![],'defaultValue':_0x8488('0x3')},'appdata':{'type':Sequelize[_0x8488('0x4')]()},'description':{'type':Sequelize[_0x8488('0x2')]},'interval':{'type':Sequelize[_0x8488('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd916=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x5698ae,_0x39ec23){var _0x74b9bf=function(_0x462f56){while(--_0x462f56){_0x5698ae['push'](_0x5698ae['shift']());}};_0x74b9bf(++_0x39ec23);}(_0xd916,0x18a));var _0x6d91=function(_0x29ecd3,_0x2fe836){_0x29ecd3=_0x29ecd3-0x0;var _0x2b3cb5=_0xd916[_0x29ecd3];return _0x2b3cb5;};'use strict';var Sequelize=require(_0x6d91('0x0'));module[_0x6d91('0x1')]={'priority':{'type':Sequelize[_0x6d91('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d91('0x3')],'allowNull':![],'defaultValue':_0x6d91('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6d91('0x3')]},'interval':{'type':Sequelize[_0x6d91('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 95bfe2f..8bc1b70 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 _0x5fab=['sort','where','merge','filter','options','count','includeAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order'];(function(_0x3c472a,_0xbe009d){var _0x25f0c2=function(_0x52fc39){while(--_0x52fc39){_0x3c472a['push'](_0x3c472a['shift']());}};_0x25f0c2(++_0xbe009d);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c27b6,_0x4a3c28){_0x5c27b6=_0x5c27b6-0x0;var _0x284ce4=_0x5fab[_0x5c27b6];return _0x284ce4;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];function respondWithStatusCode(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0xcc;return function(_0x2ad830){if(_0x2ad830){return _0x309740[_0xb5fa('0x19')](_0x4d3576);}return _0x309740['status'](_0x4d3576)[_0xb5fa('0x1a')]();};}function respondWithResult(_0x577af0,_0x265992){_0x265992=_0x265992||0xc8;return function(_0x3fc372){if(_0x3fc372){return _0x577af0[_0xb5fa('0x1b')](_0x265992)[_0xb5fa('0x1c')](_0x3fc372);}};}function respondWithFilteredResult(_0x8e9d1c,_0x5371cf){return function(_0x567f31){if(_0x567f31){var _0x38e964=_0x567f31['count'],_0x587043=_0x5371cf['offset'],_0x31f252=_0x5371cf[_0xb5fa('0x1d')]+_0x5371cf[_0xb5fa('0x1e')],_0x27c8f7;if(_0x31f252>=_0x38e964){_0x31f252=_0x38e964;_0x27c8f7=0xc8;}else{_0x27c8f7=0xce;}_0x8e9d1c[_0xb5fa('0x1b')](_0x27c8f7);return _0x8e9d1c[_0xb5fa('0x1f')](_0xb5fa('0x20'),_0x587043+'-'+_0x31f252+'/'+_0x38e964)[_0xb5fa('0x1c')](_0x567f31);}return null;};}function patchUpdates(_0x3b0f69){return function(_0x21f4f4){try{jsonpatch[_0xb5fa('0x21')](_0x21f4f4,_0x3b0f69,!![]);}catch(_0x368cb1){return BPromise[_0xb5fa('0x22')](_0x368cb1);}return _0x21f4f4[_0xb5fa('0x23')]();};}function saveUpdates(_0x5cd822,_0x432bfa){return function(_0x519e20){if(_0x519e20){return _0x519e20[_0xb5fa('0x24')](_0x5cd822)['then'](function(_0xd0fe2b){return _0xd0fe2b;});}return null;};}function removeEntity(_0x43c09f,_0x4e05c0){return function(_0x40dfdf){if(_0x40dfdf){return _0x40dfdf[_0xb5fa('0x25')]()[_0xb5fa('0x26')](function(){_0x43c09f['status'](0xcc)[_0xb5fa('0x1a')]();});}};}function handleEntityNotFound(_0xec108f,_0x444237){return function(_0x542348){if(!_0x542348){_0xec108f[_0xb5fa('0x19')](0x194);}return _0x542348;};}function handleError(_0x5d55f7,_0x106c4b){_0x106c4b=_0x106c4b||0x1f4;return function(_0x264591){logger[_0xb5fa('0x27')](_0x264591[_0xb5fa('0x28')]);if(_0x264591[_0xb5fa('0x29')]){delete _0x264591[_0xb5fa('0x29')];}_0x5d55f7[_0xb5fa('0x1b')](_0x106c4b)[_0xb5fa('0x2a')](_0x264591);};}exports['index']=function(_0x4ec294,_0x5bdf11){var _0x5a1c39={},_0x28a350={},_0x460b54={'count':0x0,'rows':[]};var _0x12c0d4=_[_0xb5fa('0x2b')](db[_0xb5fa('0x2c')][_0xb5fa('0x2d')],function(_0x358549){return{'name':_0x358549[_0xb5fa('0x2e')],'type':_0x358549[_0xb5fa('0x2f')][_0xb5fa('0x30')]};});_0x28a350[_0xb5fa('0x31')]=_[_0xb5fa('0x2b')](_0x12c0d4,_0xb5fa('0x29'));_0x28a350[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x4ec294[_0xb5fa('0x32')]);_0x28a350[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],_0x28a350[_0xb5fa('0x32')]);_0x5a1c39[_0xb5fa('0x36')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],qs[_0xb5fa('0x37')](_0x4ec294['query'][_0xb5fa('0x37')]));_0x5a1c39['attributes']=_0x5a1c39['attributes']['length']?_0x5a1c39[_0xb5fa('0x36')]:_0x28a350['model'];if(!_0x4ec294[_0xb5fa('0x32')]['hasOwnProperty']('nolimit')){_0x5a1c39[_0xb5fa('0x1e')]=qs[_0xb5fa('0x1e')](_0x4ec294['query']['limit']);_0x5a1c39[_0xb5fa('0x1d')]=qs[_0xb5fa('0x1d')](_0x4ec294[_0xb5fa('0x32')]['offset']);}_0x5a1c39[_0xb5fa('0x38')]=qs[_0xb5fa('0x39')](_0x4ec294['query'][_0xb5fa('0x39')]);_0x5a1c39[_0xb5fa('0x3a')]=qs[_0xb5fa('0x34')](_['pick'](_0x4ec294[_0xb5fa('0x32')],_0x28a350[_0xb5fa('0x34')]),_0x12c0d4);if(_0x4ec294[_0xb5fa('0x32')]['filter']){_0x5a1c39[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x5a1c39[_0xb5fa('0x3a')],{'$or':_[_0xb5fa('0x2b')](_0x12c0d4,function(_0x5e7770){if(_0x5e7770['type']!=='VIRTUAL'){var _0x49e786={};_0x49e786[_0x5e7770['name']]={'$like':'%'+_0x4ec294['query'][_0xb5fa('0x3c')]+'%'};return _0x49e786;}})});}_0x5a1c39=_['merge']({},_0x5a1c39,_0x4ec294[_0xb5fa('0x3d')]);var _0x3ae696={'where':_0x5a1c39[_0xb5fa('0x3a')]};return db[_0xb5fa('0x2c')][_0xb5fa('0x3e')](_0x3ae696)[_0xb5fa('0x26')](function(_0x4b4c4c){_0x460b54['count']=_0x4b4c4c;if(_0x4ec294['query'][_0xb5fa('0x3f')]){_0x5a1c39['include']=[{'all':!![]}];}return db[_0xb5fa('0x2c')]['findAll'](_0x5a1c39);})['then'](function(_0x3cdf63){_0x460b54[_0xb5fa('0x40')]=_0x3cdf63;return _0x460b54;})[_0xb5fa('0x26')](respondWithFilteredResult(_0x5bdf11,_0x5a1c39))[_0xb5fa('0x41')](handleError(_0x5bdf11,null));};exports[_0xb5fa('0x42')]=function(_0x26ef1b,_0x337c53){var _0x83df0b={'raw':!![],'where':{'id':_0x26ef1b[_0xb5fa('0x43')]['id']}},_0x19e370={};_0x19e370['model']=_[_0xb5fa('0x33')](db['FaxApplication'][_0xb5fa('0x2d')]);_0x19e370[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x26ef1b[_0xb5fa('0x32')]);_0x19e370[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],_0x19e370[_0xb5fa('0x32')]);_0x83df0b['attributes']=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],qs['fields'](_0x26ef1b[_0xb5fa('0x32')]['fields']));_0x83df0b[_0xb5fa('0x36')]=_0x83df0b[_0xb5fa('0x36')]['length']?_0x83df0b['attributes']:_0x19e370[_0xb5fa('0x31')];if(_0x26ef1b[_0xb5fa('0x32')][_0xb5fa('0x3f')]){_0x83df0b[_0xb5fa('0x44')]=[{'all':!![]}];}_0x83df0b=_[_0xb5fa('0x3b')]({},_0x83df0b,_0x26ef1b[_0xb5fa('0x3d')]);return db[_0xb5fa('0x2c')][_0xb5fa('0x45')](_0x83df0b)['then'](handleEntityNotFound(_0x337c53,null))[_0xb5fa('0x26')](respondWithResult(_0x337c53,null))[_0xb5fa('0x41')](handleError(_0x337c53,null));};exports['create']=function(_0xee6baa,_0x2c378a){return db[_0xb5fa('0x2c')][_0xb5fa('0x46')](_0xee6baa[_0xb5fa('0x47')],{})[_0xb5fa('0x26')](respondWithResult(_0x2c378a,0xc9))[_0xb5fa('0x41')](handleError(_0x2c378a,null));};exports[_0xb5fa('0x24')]=function(_0x20f5f5,_0x464e36){if(_0x20f5f5[_0xb5fa('0x47')]['id']){delete _0x20f5f5[_0xb5fa('0x47')]['id'];}return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x20f5f5[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x464e36,null))['then'](saveUpdates(_0x20f5f5['body'],null))[_0xb5fa('0x26')](respondWithResult(_0x464e36,null))['catch'](handleError(_0x464e36,null));};exports[_0xb5fa('0x25')]=function(_0x1049d9,_0x5404f6){return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x1049d9[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x5404f6,null))[_0xb5fa('0x26')](removeEntity(_0x5404f6,null))[_0xb5fa('0x41')](handleError(_0x5404f6,null));}; \ No newline at end of file +var _0xc4aa=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['FaxApplication']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['FaxApplication'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4cd0f08..584eca9 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 _0xec57=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x5328c8,_0x2152f0){var _0x51e75e=function(_0x44fcee){while(--_0x44fcee){_0x5328c8['push'](_0x5328c8['shift']());}};_0x51e75e(++_0x2152f0);}(_0xec57,0x92));var _0x7ec5=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xec57[_0x5235a6];return _0x1cf37e;};'use strict';var _=require('lodash');var util=require(_0x7ec5('0x0'));var logger=require(_0x7ec5('0x1'))(_0x7ec5('0x2'));var moment=require('moment');var BPromise=require(_0x7ec5('0x3'));var rp=require(_0x7ec5('0x4'));var fs=require('fs');var path=require(_0x7ec5('0x5'));var rimraf=require('rimraf');var config=require(_0x7ec5('0x6'));var attributes=require(_0x7ec5('0x7'));module[_0x7ec5('0x8')]=function(_0x50cd25,_0x5c02c2){return _0x50cd25[_0x7ec5('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ec5('0xa'),'collate':_0x7ec5('0xb')});}; \ No newline at end of file +var _0x7838=['moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x252220,_0x16170e){var _0x443f4b=function(_0x25a017){while(--_0x25a017){_0x252220['push'](_0x252220['shift']());}};_0x443f4b(++_0x16170e);}(_0x7838,0x1ec));var _0x8783=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7838[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x8783('0x0'));var util=require(_0x8783('0x1'));var logger=require(_0x8783('0x2'))(_0x8783('0x3'));var moment=require(_0x8783('0x4'));var BPromise=require(_0x8783('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8783('0x6'));var rimraf=require(_0x8783('0x7'));var config=require(_0x8783('0x8'));var attributes=require(_0x8783('0x9'));module[_0x8783('0xa')]=function(_0xdf00d5,_0x84ae22){return _0xdf00d5[_0x8783('0xb')](_0x8783('0xc'),attributes,{'tableName':_0x8783('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8783('0xe'),'collate':_0x8783('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 759e3c5..eb6dc01 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 _0xcda2=['message','result','catch','FaxApplication','update','options','raw','where','limit','UpdateFaxApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5226c9,_0x14392b){var _0x31ca41=function(_0x448a89){while(--_0x448a89){_0x5226c9['push'](_0x5226c9['shift']());}};_0x31ca41(++_0x14392b);}(_0xcda2,0xdc));var _0x2cda=function(_0x423797,_0x3d393b){_0x423797=_0x423797-0x0;var _0x57ec0c=_0xcda2[_0x423797];return _0x57ec0c;};'use strict';var _=require(_0x2cda('0x0'));var util=require('util');var moment=require(_0x2cda('0x1'));var BPromise=require(_0x2cda('0x2'));var rs=require(_0x2cda('0x3'));var fs=require('fs');var Redis=require(_0x2cda('0x4'));var db=require(_0x2cda('0x5'))['db'];var utils=require(_0x2cda('0x6'));var logger=require(_0x2cda('0x7'))(_0x2cda('0x8'));var config=require(_0x2cda('0x9'));var jayson=require(_0x2cda('0xa'));var client=jayson[_0x2cda('0xb')][_0x2cda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dda9d,_0x225a0d,_0x23269d){return new BPromise(function(_0xeaa5e1,_0x204e6b){return client['request'](_0x2dda9d,_0x23269d)[_0x2cda('0xd')](function(_0x1e0de7){logger[_0x2cda('0xe')](_0x2cda('0xf'),_0x225a0d,_0x2cda('0x10'));logger['debug'](_0x2cda('0x11'),_0x225a0d,_0x2cda('0x10'),JSON[_0x2cda('0x12')](_0x1e0de7));if(_0x1e0de7['error']){if(_0x1e0de7[_0x2cda('0x13')]['code']===0x1f4){logger[_0x2cda('0x13')](_0x2cda('0xf'),_0x225a0d,_0x1e0de7[_0x2cda('0x13')][_0x2cda('0x14')]);return _0x204e6b(_0x1e0de7[_0x2cda('0x13')][_0x2cda('0x14')]);}logger[_0x2cda('0x13')](_0x2cda('0xf'),_0x225a0d,_0x1e0de7['error']['message']);return _0xeaa5e1(_0x1e0de7[_0x2cda('0x13')][_0x2cda('0x14')]);}else{logger['info'](_0x2cda('0xf'),_0x225a0d,'request\x20sent');_0xeaa5e1(_0x1e0de7[_0x2cda('0x15')][_0x2cda('0x14')]);}})[_0x2cda('0x16')](function(_0x4f4ef1){logger[_0x2cda('0x13')](_0x2cda('0xf'),_0x225a0d,_0x4f4ef1);_0x204e6b(_0x4f4ef1);});});}exports['UpdateFaxApplication']=function(_0x3a216e){var _0x42bbaf=this;return new Promise(function(_0x2c5120,_0x470340){return db[_0x2cda('0x17')][_0x2cda('0x18')](_0x3a216e['body'],{'raw':_0x3a216e[_0x2cda('0x19')]?_0x3a216e[_0x2cda('0x19')][_0x2cda('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a216e[_0x2cda('0x19')]?_0x3a216e['options'][_0x2cda('0x1b')]||null:null,'attributes':_0x3a216e['options']?_0x3a216e[_0x2cda('0x19')]['attributes']||null:null,'limit':_0x3a216e[_0x2cda('0x19')]?_0x3a216e[_0x2cda('0x19')][_0x2cda('0x1c')]||null:null})[_0x2cda('0xd')](function(_0x307ff8){logger[_0x2cda('0xe')](_0x2cda('0x1d'),_0x3a216e);logger['debug'](_0x2cda('0x1d'),_0x3a216e,JSON[_0x2cda('0x12')](_0x307ff8));_0x2c5120(_0x307ff8);})[_0x2cda('0x16')](function(_0x56fe81){logger[_0x2cda('0x13')]('UpdateFaxApplication',_0x56fe81[_0x2cda('0x14')],_0x3a216e);_0x470340(_0x42bbaf[_0x2cda('0x13')](0x1f4,_0x56fe81[_0x2cda('0x14')]));});});}; \ No newline at end of file +var _0x8bfc=['rpc','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','limit','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x47a07e,_0x4c7f71){var _0x1f2e77=function(_0x191023){while(--_0x191023){_0x47a07e['push'](_0x47a07e['shift']());}};_0x1f2e77(++_0x4c7f71);}(_0x8bfc,0xc4));var _0xc8bf=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x8bfc[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0xc8bf('0x0'));var util=require(_0xc8bf('0x1'));var moment=require(_0xc8bf('0x2'));var BPromise=require(_0xc8bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8bf('0x4'))['db'];var utils=require(_0xc8bf('0x5'));var logger=require(_0xc8bf('0x6'))(_0xc8bf('0x7'));var config=require('../../config/environment');var jayson=require(_0xc8bf('0x8'));var client=jayson[_0xc8bf('0x9')][_0xc8bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23d2c3,_0x33f7e8,_0x1d5c2d){return new BPromise(function(_0x103a5c,_0x45cae3){return client[_0xc8bf('0xb')](_0x23d2c3,_0x1d5c2d)[_0xc8bf('0xc')](function(_0x3e3a56){logger['info'](_0xc8bf('0xd'),_0x33f7e8,'request\x20sent');logger[_0xc8bf('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x33f7e8,_0xc8bf('0xf'),JSON['stringify'](_0x3e3a56));if(_0x3e3a56[_0xc8bf('0x10')]){if(_0x3e3a56[_0xc8bf('0x10')][_0xc8bf('0x11')]===0x1f4){logger['error'](_0xc8bf('0xd'),_0x33f7e8,_0x3e3a56[_0xc8bf('0x10')][_0xc8bf('0x12')]);return _0x45cae3(_0x3e3a56[_0xc8bf('0x10')][_0xc8bf('0x12')]);}logger[_0xc8bf('0x10')]('FaxApplication,\x20%s,\x20%s',_0x33f7e8,_0x3e3a56[_0xc8bf('0x10')][_0xc8bf('0x12')]);return _0x103a5c(_0x3e3a56[_0xc8bf('0x10')][_0xc8bf('0x12')]);}else{logger[_0xc8bf('0x13')](_0xc8bf('0xd'),_0x33f7e8,'request\x20sent');_0x103a5c(_0x3e3a56[_0xc8bf('0x14')][_0xc8bf('0x12')]);}})['catch'](function(_0x30784a){logger[_0xc8bf('0x10')](_0xc8bf('0xd'),_0x33f7e8,_0x30784a);_0x45cae3(_0x30784a);});});}exports[_0xc8bf('0x15')]=function(_0x5824e7){var _0x326f13=this;return new Promise(function(_0x3bd8d7,_0x132f76){return db[_0xc8bf('0x16')][_0xc8bf('0x17')](_0x5824e7['body'],{'raw':_0x5824e7[_0xc8bf('0x18')]?_0x5824e7['options'][_0xc8bf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5824e7['options']?_0x5824e7[_0xc8bf('0x18')][_0xc8bf('0x1a')]||null:null,'attributes':_0x5824e7['options']?_0x5824e7['options']['attributes']||null:null,'limit':_0x5824e7[_0xc8bf('0x18')]?_0x5824e7[_0xc8bf('0x18')][_0xc8bf('0x1b')]||null:null})[_0xc8bf('0xc')](function(_0x16c8bb){logger[_0xc8bf('0x13')](_0xc8bf('0x15'),_0x5824e7);logger['debug'](_0xc8bf('0x15'),_0x5824e7,JSON[_0xc8bf('0x1c')](_0x16c8bb));_0x3bd8d7(_0x16c8bb);})['catch'](function(_0x4459e1){logger[_0xc8bf('0x10')](_0xc8bf('0x15'),_0x4459e1[_0xc8bf('0x12')],_0x5824e7);_0x132f76(_0x326f13[_0xc8bf('0x10')](0x1f4,_0x4459e1[_0xc8bf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c38171b..00134f0 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeda8=['isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x5e685f,_0x4d2fc3){var _0x418ffa=function(_0xfe5d62){while(--_0xfe5d62){_0x5e685f['push'](_0x5e685f['shift']());}};_0x418ffa(++_0x4d2fc3);}(_0xeda8,0x104));var _0x8eda=function(_0x515370,_0x3802fd){_0x515370=_0x515370-0x0;var _0x713448=_0xeda8[_0x515370];return _0x713448;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8eda('0x10')](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1d6429,_0x372b02){var _0x4616b2=function(_0x25d0a3){while(--_0x25d0a3){_0x1d6429['push'](_0x1d6429['shift']());}};_0x4616b2(++_0x372b02);}(_0x6aa7,0x178));var _0x76aa=function(_0x203289,_0xa82a00){_0x203289=_0x203289-0x0;var _0x49075e=_0x6aa7[_0x203289];return _0x49075e;};'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['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xc')]);router[_0x76aa('0xd')]('/:id',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 786aaef..94c2de3 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 _0xcb98=['STRING','ENUM','out','exports','DATE'];(function(_0x17fea7,_0x102927){var _0x3150c3=function(_0x1d6bd0){while(--_0x1d6bd0){_0x17fea7['push'](_0x17fea7['shift']());}};_0x3150c3(++_0x102927);}(_0xcb98,0x18e));var _0x8cb9=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xcb98[_0x11155f];return _0xd07e48;};'use strict';var Sequelize=require('sequelize');module[_0x8cb9('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8cb9('0x1')]},'disposition':{'type':Sequelize[_0x8cb9('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8cb9('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x8cb9('0x3')]('in',_0x8cb9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8cb9('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x8cb9('0x3')]('in',_0x8cb9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x431d=['out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x292cea,_0x5dfbbf){var _0x393c61=function(_0x27ca5c){while(--_0x27ca5c){_0x292cea['push'](_0x292cea['shift']());}};_0x393c61(++_0x5dfbbf);}(_0x431d,0x144));var _0xd431=function(_0x5e8721,_0x378840){_0x5e8721=_0x5e8721-0x0;var _0xc78d88=_0x431d[_0x5e8721];return _0xc78d88;};'use strict';var Sequelize=require(_0xd431('0x0'));module[_0xd431('0x1')]={'closed':{'type':Sequelize[_0xd431('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd431('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd431('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd431('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd431('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd431('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 3333456..5b60c1e 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 _0x10b8=['u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','User','UserId','buildExpression','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','format','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','map','fullname','Tags','split','forEach','push','TagIds','FaxInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','select'];(function(_0x114b54,_0x3ed9bb){var _0x21c37f=function(_0x5df3ec){while(--_0x5df3ec){_0x114b54['push'](_0x114b54['shift']());}};_0x21c37f(++_0x3ed9bb);}(_0x10b8,0x166));var _0x810b=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x10b8[_0x2db12b];return _0x20990b;};'use strict';var pdf=require(_0x810b('0x0'));var emlformat=require(_0x810b('0x1'));var rimraf=require(_0x810b('0x2'));var zipdir=require(_0x810b('0x3'));var jsonpatch=require(_0x810b('0x4'));var rp=require(_0x810b('0x5'));var moment=require('moment');var BPromise=require(_0x810b('0x6'));var Mustache=require(_0x810b('0x7'));var util=require(_0x810b('0x8'));var path=require('path');var sox=require(_0x810b('0x9'));var csv=require(_0x810b('0xa'));var ejs=require(_0x810b('0xb'));var fs=require('fs');var _=require(_0x810b('0xc'));var squel=require(_0x810b('0xd'));var crypto=require(_0x810b('0xe'));var jsforce=require(_0x810b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x810b('0xa'));var querystring=require('querystring');var Papa=require(_0x810b('0x10'));var Redis=require(_0x810b('0x11'));var authService=require(_0x810b('0x12'));var qs=require(_0x810b('0x13'));var as=require(_0x810b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x810b('0x15'))(_0x810b('0x16'));var utils=require(_0x810b('0x17'));var config=require(_0x810b('0x18'));var db=require('../../mysqldb')['db'];config[_0x810b('0x19')]=_[_0x810b('0x1a')](config[_0x810b('0x19')],{'host':_0x810b('0x1b'),'port':0x18eb});var socket=require(_0x810b('0x1c'))(new Redis(config[_0x810b('0x19')]));require(_0x810b('0x1d'))[_0x810b('0x1e')](socket);function respondWithStatusCode(_0x26209b,_0x3e3e52){_0x3e3e52=_0x3e3e52||0xcc;return function(_0x4d7dcd){if(_0x4d7dcd){return _0x26209b['sendStatus'](_0x3e3e52);}return _0x26209b[_0x810b('0x1f')](_0x3e3e52)[_0x810b('0x20')]();};}function respondWithResult(_0x1f2d52,_0xea1d2a){_0xea1d2a=_0xea1d2a||0xc8;return function(_0x3a8115){if(_0x3a8115){return _0x1f2d52[_0x810b('0x1f')](_0xea1d2a)[_0x810b('0x21')](_0x3a8115);}};}function respondWithFilteredResult(_0x2c404f,_0x43f099){return function(_0x1cdcee){if(_0x1cdcee){var _0x4a31a6=_0x1cdcee[_0x810b('0x22')],_0x3424bc=_0x43f099[_0x810b('0x23')],_0x540741=_0x43f099['offset']+_0x43f099[_0x810b('0x24')],_0x10753a;if(_0x540741>=_0x4a31a6){_0x540741=_0x4a31a6;_0x10753a=0xc8;}else{_0x10753a=0xce;}_0x2c404f['status'](_0x10753a);return _0x2c404f[_0x810b('0x25')]('Content-Range',_0x3424bc+'-'+_0x540741+'/'+_0x4a31a6)[_0x810b('0x21')](_0x1cdcee);}return null;};}function patchUpdates(_0x51b3be){return function(_0x280928){try{jsonpatch[_0x810b('0x26')](_0x280928,_0x51b3be,!![]);}catch(_0x288ceb){return BPromise['reject'](_0x288ceb);}return _0x280928[_0x810b('0x27')]();};}function saveUpdates(_0x483284,_0x121178){return function(_0x214610){if(_0x214610){return _0x214610[_0x810b('0x28')](_0x483284)[_0x810b('0x29')](function(_0x4fdf04){return _0x4fdf04;});}return null;};}function removeEntity(_0x6196a7,_0x525277){return function(_0x6284c7){if(_0x6284c7){return _0x6284c7[_0x810b('0x2a')]()[_0x810b('0x29')](function(){_0x6196a7[_0x810b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf6e4,_0x4bd4f9){return function(_0x8fa638){if(!_0x8fa638){_0x2cf6e4[_0x810b('0x2b')](0x194);}return _0x8fa638;};}function handleError(_0x46b9d3,_0x550ab8){_0x550ab8=_0x550ab8||0x1f4;return function(_0x1236e0){logger[_0x810b('0x2c')](_0x1236e0[_0x810b('0x2d')]);if(_0x1236e0[_0x810b('0x2e')]){delete _0x1236e0[_0x810b('0x2e')];}_0x46b9d3[_0x810b('0x1f')](_0x550ab8)['send'](_0x1236e0);};}function getInteractionUsers(_0x4eb0f3,_0x190f9d){return new BPromise(function(_0x217c0a,_0x18129d){try{if(_0x190f9d[_0x4eb0f3['id']]){_0x4eb0f3['Users']=_[_0x810b('0x2f')](_0x190f9d[_0x4eb0f3['id']],function(_0x4c6e20){return{'id':_0x4c6e20['id'],'fullname':_0x4c6e20[_0x810b('0x30')]};});}}catch(_0xa52aa8){_0x18129d(_0xa52aa8);}_0x217c0a(_0x4eb0f3);});}function getInteractionTags(_0x387221,_0x34f72c){return new BPromise(function(_0x83448b,_0x212a4b){try{if(_0x387221['TagIds']){_0x387221[_0x810b('0x31')]=[];_0x387221['TagIds'][_0x810b('0x32')](',')[_0x810b('0x33')](function(_0x450925){_0x387221['Tags'][_0x810b('0x34')](_0x34f72c[_0x450925]);});}delete _0x387221[_0x810b('0x35')];}catch(_0x57a575){_0x212a4b(_0x57a575);}_0x83448b(_0x387221);});}function updateFaxInteraction(_0x716257,_0x37a908,_0x1d2f45){return new BPromise(function(_0x5cead3,_0x84f20d){return getInteractionUsers(_0x716257,_0x1d2f45)[_0x810b('0x29')](function(_0x280089){return getInteractionTags(_0x280089,_0x37a908);})['then'](function(_0x16b723){_0x5cead3(_0x16b723);})['catch'](function(_0xd35d3){_0x84f20d(_0xd35d3);});});}exports['index']=function(_0x1a1626,_0x71b8eb){var _0x9224cd={},_0x4b61e3={},_0x3cbe75={'count':0x0,'rows':[]};var _0x34494c=_[_0x810b('0x2f')](db[_0x810b('0x36')][_0x810b('0x37')],function(_0x399fe9){return{'name':_0x399fe9[_0x810b('0x38')],'type':_0x399fe9[_0x810b('0x39')]['key']};});_0x4b61e3[_0x810b('0x3a')]=_[_0x810b('0x2f')](_0x34494c,_0x810b('0x2e'));_0x4b61e3[_0x810b('0x3b')]=_['keys'](_0x1a1626[_0x810b('0x3b')]);_0x4b61e3[_0x810b('0x3c')]=_[_0x810b('0x3d')](_0x4b61e3[_0x810b('0x3a')],_0x4b61e3[_0x810b('0x3b')]);_0x9224cd[_0x810b('0x3e')]=_['intersection'](_0x4b61e3[_0x810b('0x3a')],qs[_0x810b('0x3f')](_0x1a1626[_0x810b('0x3b')][_0x810b('0x3f')]));_0x9224cd[_0x810b('0x3e')]=_0x9224cd['attributes']['length']?_0x9224cd[_0x810b('0x3e')]:_0x4b61e3['model'];if(!_0x1a1626[_0x810b('0x3b')][_0x810b('0x40')](_0x810b('0x41'))){_0x9224cd[_0x810b('0x24')]=qs['limit'](_0x1a1626[_0x810b('0x3b')]['limit']);_0x9224cd[_0x810b('0x23')]=qs[_0x810b('0x23')](_0x1a1626[_0x810b('0x3b')][_0x810b('0x23')]);}_0x9224cd[_0x810b('0x42')]=qs[_0x810b('0x43')](_0x1a1626[_0x810b('0x3b')][_0x810b('0x43')]);_0x9224cd['where']=qs[_0x810b('0x3c')](_[_0x810b('0x44')](_0x1a1626[_0x810b('0x3b')],_0x4b61e3['filters']),_0x34494c);var _0x455e9c=[];var _0x284260=squel['select']()[_0x810b('0x45')]('id')['field'](_0x810b('0x2e'))[_0x810b('0x45')](_0x810b('0x46'))[_0x810b('0x47')](_0x810b('0x48'));var _0x2a30e5=squel[_0x810b('0x49')]()[_0x810b('0x45')](_0x810b('0x4a'))[_0x810b('0x45')](_0x810b('0x4b'))[_0x810b('0x45')](_0x810b('0x4c'))['from'](_0x810b('0x4d'),'ui')['left_join'](_0x810b('0x4e'),'u',_0x810b('0x4f'));var _0x48e984=squel[_0x810b('0x49')]()[_0x810b('0x47')](_0x810b('0x50'),'i')[_0x810b('0x51')](_0x810b('0x52'),'c',_0x810b('0x53'))[_0x810b('0x51')](_0x810b('0x4e'),'o',_0x810b('0x54'))['left_join'](_0x810b('0x55'),'a',_0x810b('0x56'))['left_join'](_0x810b('0x57'),'me',_0x810b('0x58'))[_0x810b('0x51')](_0x810b('0x59'),'it',_0x810b('0x5a'))[_0x810b('0x51')](_0x810b('0x48'),'t',_0x810b('0x5b'));var _0x32db35=squel[_0x810b('0x5c')]();var _0x3091dc=[];var _0x5435af=squel['expr']();var _0x12e481;if(_0x1a1626['query']['search']){_0x12e481=as['parseSearch'](_0x1a1626[_0x810b('0x3b')][_0x810b('0x5d')]);var _0x210009=_0x12e481[_0x810b('0x5e')];for(var _0x3146ed=0x0;_0x3146ed<_0x12e481[_0x810b('0x5f')]['length'];_0x3146ed++){var _0x190db4=_0x12e481[_0x810b('0x5f')][_0x3146ed];var _0x7fb528='i';var _0x25fdf7=_[_0x810b('0x60')](_0x34494c,[_0x810b('0x2e'),_0x190db4[_0x810b('0x45')]]);if(!_0x25fdf7){switch(_0x190db4['field']){case _0x810b('0x61'):if(_0x190db4[_0x810b('0x62')]==0x1){_0x48e984[_0x810b('0x63')]('`'+_0x190db4[_0x810b('0x45')]+'`\x20=\x200');}else{_0x48e984['having']('`'+_0x190db4[_0x810b('0x45')]+'`\x20>\x200');}break;case _0x810b('0x64'):if(_0x190db4[_0x810b('0x65')]===_0x810b('0x66')){if(_0x190db4[_0x810b('0x62')][_0x810b('0x32')]('\x20')[_0x810b('0x67')]>0x1){_0x32db35[_0x210009](_0x810b('0x68'),qs[_0x810b('0x69')](_0x190db4[_0x810b('0x62')]),null);}else{var _0x14fe1b='%'+_0x190db4[_0x810b('0x62')]+'%';_0x32db35[_0x210009](_0x810b('0x6a'),_0x14fe1b,_0x14fe1b,_0x14fe1b);}}else{_0x25fdf7=_[_0x810b('0x60')](_0x34494c,[_0x810b('0x2e'),_0x810b('0x6b')]);_0x190db4[_0x810b('0x45')]=_0x810b('0x6b');_0x27354e=as['buildExpression'](_0x7fb528,_0x25fdf7[_0x810b('0x39')],_0x190db4);_0x32db35[_0x210009](_0x27354e[_0x810b('0x6c')],_0x27354e['value'][_0x810b('0x6d')],_0x27354e['value']['end']);}break;case _0x810b('0x6e'):var _0x2548cc=_0x190db4[_0x810b('0x62')]['split'](',')[_0x810b('0x2f')](function(_0xd40678){return Number(_0xd40678);});_0x2548cc[_0x810b('0x33')](function(_0x5085c8){_0x5435af['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5085c8+',%');});_0x3091dc=_['union'](_0x3091dc,_0x2548cc);break;case _0x810b('0x6f'):if(_0x190db4[_0x810b('0x65')]===_0x810b('0x66')){_0x32db35[_0x210009]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x190db4[_0x810b('0x62')]+'%',null);}else{_0x25fdf7=_[_0x810b('0x60')](_0x34494c,[_0x810b('0x2e'),_0x810b('0x70')]);_0x190db4[_0x810b('0x45')]='UserId';_0x27354e=as[_0x810b('0x71')](_0x7fb528,_0x25fdf7['type'],_0x190db4);_0x32db35[_0x210009](_0x27354e[_0x810b('0x6c')],_0x27354e[_0x810b('0x62')][_0x810b('0x6d')],_0x27354e[_0x810b('0x62')][_0x810b('0x20')]);}break;case _0x810b('0x72'):_0x27354e=as[_0x810b('0x71')]('me',null,_0x190db4);_0x32db35[_0x210009](_0x27354e['text'],_0x27354e['value'][_0x810b('0x6d')],_0x27354e[_0x810b('0x62')][_0x810b('0x20')]);break;}}else{var _0x27354e=as['buildExpression'](_0x7fb528,_0x25fdf7[_0x810b('0x39')],_0x190db4);_0x32db35[_0x210009](_0x27354e[_0x810b('0x6c')],_0x27354e[_0x810b('0x62')]['start'],_0x27354e['value'][_0x810b('0x20')]);}}}else{var _0x4745da=_(_0x1a1626[_0x810b('0x3b')])['keys']()[_0x810b('0x2f')](function(_0x4a5d6d){return _[_0x810b('0x73')](_0x34494c,[_0x810b('0x2e'),_0x4a5d6d])?_0x4a5d6d:undefined;})[_0x810b('0x74')]()[_0x810b('0x62')]();if(!_[_0x810b('0x75')](_0x4745da)){_0x4745da[_0x810b('0x33')](function(_0x48f769){if(_0x48f769===_0x810b('0x76')){_0x48e984[_0x810b('0x77')](_0x810b('0x78'),[][_0x810b('0x79')](_0x1a1626[_0x810b('0x3b')][_0x48f769]));}else if(_0x48f769===_0x810b('0x7a')){var _0x3d4bf9=JSON[_0x810b('0x7b')](_0x1a1626[_0x810b('0x3b')][_0x48f769])[_0x810b('0x7c')];var _0x59e580=JSON[_0x810b('0x7b')](_0x1a1626[_0x810b('0x3b')][_0x48f769])[_0x810b('0x7d')];_0x48e984[_0x810b('0x77')](_0x810b('0x7e'),_0x3d4bf9,_0x59e580);}else{if(_0x1a1626[_0x810b('0x3b')][_0x48f769]==='null'){_0x48e984[_0x810b('0x77')]('i.'+_0x48f769+_0x810b('0x7f'));}else{_0x48e984[_0x810b('0x77')]('i.'+_0x48f769+_0x810b('0x80'),_0x1a1626[_0x810b('0x3b')][_0x48f769]);}}});}if(_0x1a1626['query'][_0x810b('0x81')]){if(_0x1a1626['query'][_0x810b('0x81')]==0x1){_0x48e984[_0x810b('0x63')]('`unreadMessages`\x20=\x200');}else{_0x48e984[_0x810b('0x63')](_0x810b('0x82'));}}if(_0x1a1626[_0x810b('0x3b')][_0x810b('0x83')]){_0x3091dc=_[_0x810b('0x84')](_0x1a1626[_0x810b('0x3b')][_0x810b('0x83')])?_0x1a1626['query'][_0x810b('0x83')]:new Array(_0x1a1626[_0x810b('0x3b')][_0x810b('0x83')]);_0x3091dc[_0x810b('0x33')](function(_0x2c20cc){_0x5435af['or'](_0x810b('0x85'),'%,'+_0x2c20cc+',%');});}if(_0x1a1626['query'][_0x810b('0x86')]){var _0x61016c=_0x1a1626['query']['filter'][_0x810b('0x87')]('\x5c','\x5c\x5c')[_0x810b('0x87')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x810b('0x88')](_0x61016c)){_0x32db35['or'](_0x810b('0x89'),_0x61016c+'%')['or'](_0x810b('0x8a'),_0x61016c+'%');}_0x32db35['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x61016c+'%');}}_0x48e984['where'](_0x32db35);_0x48e984[_0x810b('0x8b')](_0x810b('0x8c'));var _0x1db8a6={'type':db[_0x810b('0x8d')][_0x810b('0x8e')]['SELECT'],'raw':!![]};var _0x5d5c90=_0x48e984['clone']();_0x5d5c90[_0x810b('0x45')](_0x810b('0x8c'));_0x5d5c90[_0x810b('0x45')](_0x810b('0x8f'),_0x810b('0x61'));if(_0x9224cd[_0x810b('0x42')]){_0x9224cd[_0x810b('0x42')][_0x810b('0x33')](function(_0x1430ad){_0x48e984['order']('i.'+_0x1430ad[0x0],_0x1430ad[0x1]===_0x810b('0x90')?![]:!![]);});}if(!_[_0x810b('0x75')](_0x3091dc)){_0x48e984['having'](_0x5435af);_0x5d5c90[_0x810b('0x77')](_0x810b('0x91'),_0x3091dc);}BPromise[_0x810b('0x92')]()['then'](function(){if(!_0x12e481){if(_0x1a1626[_0x810b('0x3b')]['FaxAccountId']||_0x1a1626['query'][_0x810b('0x93')])return;_0x5d5c90[_0x810b('0x77')](_0x810b('0x94'));_0x48e984['where'](_0x810b('0x94'));return;}return _0x1a1626[_0x810b('0x95')][_0x810b('0x96')]({'attributes':['id'],'raw':!![]})[_0x810b('0x29')](function(_0x38af53){if(_[_0x810b('0x75')](_0x38af53)){_0x5d5c90['where']('i.FaxAccountId\x20IS\x20NULL');_0x48e984[_0x810b('0x77')](_0x810b('0x97'));}else{_0x5d5c90[_0x810b('0x77')](_0x810b('0x78'),_['map'](_0x38af53,'id'));_0x48e984[_0x810b('0x77')](_0x810b('0x78'),_[_0x810b('0x2f')](_0x38af53,'id'));}});})[_0x810b('0x29')](function(){db[_0x810b('0x98')][_0x810b('0x3b')](_0x5d5c90[_0x810b('0x99')](),_0x1db8a6)[_0x810b('0x29')](function(_0x5a6594){_0x3cbe75[_0x810b('0x22')]=_0x5a6594[_0x810b('0x67')];if(_0x3cbe75['count']===0x0)return[];return db[_0x810b('0x98')][_0x810b('0x3b')](_0x284260[_0x810b('0x99')](),_0x1db8a6)['then'](function(_0x2187cc){_0x455e9c=_[_0x810b('0x9a')](_0x2187cc,'id');_0x1db8a6=_[_0x810b('0x9b')](_0x1db8a6,{'model':db[_0x810b('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a1626[_0x810b('0x3b')][_0x810b('0x3f')]){_0x9224cd[_0x810b('0x3e')][_0x810b('0x33')](function(_0x4719c0){_0x48e984[_0x810b('0x45')]('i.'+_0x4719c0);});}else{_0x48e984['field'](_0x810b('0x8f'),_0x810b('0x61'));_0x48e984[_0x810b('0x45')]('a.key',_0x810b('0x9c'));_0x48e984[_0x810b('0x45')]('a.mandatoryDisposition',_0x810b('0x9d'));_0x48e984[_0x810b('0x45')](_0x810b('0x9e'));_0x48e984[_0x810b('0x45')]('c.firstName','Contact.firstName');_0x48e984[_0x810b('0x45')](_0x810b('0x9f'),_0x810b('0xa0'));_0x48e984[_0x810b('0x45')](_0x810b('0xa1'),_0x810b('0xa2'));_0x48e984[_0x810b('0x45')](_0x810b('0xa3'),_0x810b('0xa4'));_0x48e984[_0x810b('0x45')](_0x810b('0xa5'),_0x810b('0xa6'));_0x48e984[_0x810b('0x45')](_0x810b('0xa7'),_0x810b('0xa8'));_0x48e984[_0x810b('0x45')]('o.fullname',_0x810b('0xa9'));_0x48e984[_0x810b('0x45')](_0x810b('0xaa'),_0x810b('0xab'));_0x48e984['field'](_0x810b('0xac'),'TagIds');}if(_0x9224cd['limit'])_0x48e984[_0x810b('0x24')](_0x9224cd[_0x810b('0x24')]);if(_0x9224cd[_0x810b('0x23')])_0x48e984[_0x810b('0x23')](_0x9224cd['offset']);return db[_0x810b('0x98')]['query'](_0x48e984[_0x810b('0x99')](),_0x1db8a6);})[_0x810b('0x29')](function(_0x4d6c6c){_0x2a30e5[_0x810b('0x77')](_0x810b('0xad'),_[_0x810b('0x2f')](_0x4d6c6c,'id'));return db[_0x810b('0x98')]['query'](_0x2a30e5[_0x810b('0x99')](),_0x1db8a6)[_0x810b('0x29')](function(_0x25a88d){var _0x53c50c=_[_0x810b('0xae')](_0x25a88d,_0x810b('0xaf'));var _0x4a1a00=[];_0x4d6c6c[_0x810b('0x33')](function(_0x2b9274){_0x4a1a00[_0x810b('0x34')](updateFaxInteraction(_0x2b9274,_0x455e9c,_0x53c50c));});return BPromise[_0x810b('0xb0')](_0x4a1a00);});});})['then'](function(_0x2fbfff){_0x3cbe75[_0x810b('0xb1')]=_0x2fbfff;return _0x3cbe75;})[_0x810b('0x29')](respondWithFilteredResult(_0x71b8eb,_0x9224cd));})[_0x810b('0xb2')](handleError(_0x71b8eb,null));};exports[_0x810b('0xb3')]=function(_0x49b89b,_0x144f0b){var _0xf66d03={'raw':![],'where':{'id':_0x49b89b[_0x810b('0xb4')]['id']}},_0x5d38a2={};_0x5d38a2[_0x810b('0x3a')]=_['keys'](db['FaxInteraction'][_0x810b('0x37')]);_0x5d38a2[_0x810b('0x3b')]=_[_0x810b('0xb5')](_0x49b89b['query']);_0x5d38a2[_0x810b('0x3c')]=_['intersection'](_0x5d38a2[_0x810b('0x3a')],_0x5d38a2[_0x810b('0x3b')]);_0xf66d03['attributes']=_[_0x810b('0x3d')](_0x5d38a2[_0x810b('0x3a')],qs['fields'](_0x49b89b['query'][_0x810b('0x3f')]));_0xf66d03[_0x810b('0x3e')]=_0xf66d03[_0x810b('0x3e')]['length']?_0xf66d03[_0x810b('0x3e')]:_0x5d38a2[_0x810b('0x3a')];if(_0x49b89b[_0x810b('0x3b')][_0x810b('0xb6')]){_0xf66d03[_0x810b('0xb7')]=[{'all':!![]}];}_0xf66d03=_[_0x810b('0x9b')]({},_0xf66d03,_0x49b89b[_0x810b('0xb8')]);return db[_0x810b('0x36')][_0x810b('0x60')](_0xf66d03)[_0x810b('0x29')](handleEntityNotFound(_0x144f0b,null))[_0x810b('0x29')](respondWithResult(_0x144f0b,null))[_0x810b('0xb2')](handleError(_0x144f0b,null));};exports[_0x810b('0xb9')]=function(_0x63dbe,_0xecbeab){return db['FaxInteraction']['create'](_0x63dbe[_0x810b('0x72')],{})['then'](respondWithResult(_0xecbeab,0xc9))['catch'](handleError(_0xecbeab,null));};exports['update']=function(_0x54d3df,_0x2808c3){if(_0x54d3df[_0x810b('0x72')]['id']){delete _0x54d3df[_0x810b('0x72')]['id'];}return db[_0x810b('0x36')][_0x810b('0x60')]({'where':{'id':_0x54d3df['params']['id']}})[_0x810b('0x29')](handleEntityNotFound(_0x2808c3,null))[_0x810b('0x29')](saveUpdates(_0x54d3df[_0x810b('0x72')],null))[_0x810b('0x29')](respondWithResult(_0x2808c3,null))['catch'](handleError(_0x2808c3,null));};exports[_0x810b('0x2a')]=function(_0x518f7a,_0x54545c){return db[_0x810b('0x36')][_0x810b('0x60')]({'where':{'id':_0x518f7a['params']['id']}})[_0x810b('0x29')](handleEntityNotFound(_0x54545c,null))[_0x810b('0x29')](removeEntity(_0x54545c,null))[_0x810b('0xb2')](handleError(_0x54545c,null));};exports[_0x810b('0xba')]=function(_0x211a3c,_0x20c567){return db[_0x810b('0x36')][_0x810b('0xba')]()['then'](respondWithResult(_0x20c567,null))[_0x810b('0xb2')](handleError(_0x20c567,null));};exports[_0x810b('0xbb')]=function(_0x53a9a9,_0x992aa4,_0x500789){return db[_0x810b('0xbc')][_0x810b('0x60')]({'where':{'id':_0x53a9a9['params']['id']}})[_0x810b('0x29')](handleEntityNotFound(_0x992aa4,null))[_0x810b('0x29')](function(_0x530fe0){if(_0x530fe0){return _0x530fe0[_0x810b('0xbb')](_0x53a9a9[_0x810b('0x72')]['ids'],_['omit'](_0x53a9a9['body'],[_0x810b('0xbd'),'id'])||{});}})[_0x810b('0x29')](respondWithResult(_0x992aa4,null))[_0x810b('0xb2')](handleError(_0x992aa4,null));};exports[_0x810b('0xbe')]=function(_0x376136,_0x20019f,_0x169575){var _0x3dc0d0={'raw':![],'where':{}};var _0x1f2b32={};var _0x10087b={'count':0x0,'rows':[]};return db[_0x810b('0x36')][_0x810b('0xbf')]({'where':{'id':_0x376136[_0x810b('0xb4')]['id']}})[_0x810b('0x29')](handleEntityNotFound(_0x20019f,null))['then'](function(_0x158b09){if(_0x158b09){_0x1f2b32[_0x810b('0x3a')]=_[_0x810b('0xb5')](db[_0x810b('0xbc')][_0x810b('0x37')]);_0x1f2b32[_0x810b('0x3b')]=_[_0x810b('0xb5')](_0x376136[_0x810b('0x3b')]);_0x1f2b32[_0x810b('0x3c')]=_[_0x810b('0x3d')](_0x1f2b32[_0x810b('0x3a')],_0x1f2b32[_0x810b('0x3b')]);_0x3dc0d0[_0x810b('0x3e')]=_[_0x810b('0x3d')](_0x1f2b32[_0x810b('0x3a')],qs['fields'](_0x376136['query'][_0x810b('0x3f')]));_0x3dc0d0[_0x810b('0x3e')]=_0x3dc0d0[_0x810b('0x3e')]['length']?_0x3dc0d0[_0x810b('0x3e')]:_0x1f2b32[_0x810b('0x3a')];if(!_0x376136[_0x810b('0x3b')][_0x810b('0x40')](_0x810b('0x41'))){_0x3dc0d0['limit']=qs[_0x810b('0x24')](_0x376136['query'][_0x810b('0x24')]);_0x3dc0d0[_0x810b('0x23')]=qs[_0x810b('0x23')](_0x376136[_0x810b('0x3b')][_0x810b('0x23')]);}_0x3dc0d0[_0x810b('0x42')]=qs[_0x810b('0x43')](_0x376136[_0x810b('0x3b')]['sort']);_0x3dc0d0[_0x810b('0x77')]=qs[_0x810b('0x3c')](_[_0x810b('0x44')](_0x376136['query'],_0x1f2b32[_0x810b('0x3c')]));_0x3dc0d0[_0x810b('0x77')][_0x810b('0xaf')]=_0x158b09['id'];if(_0x376136[_0x810b('0x3b')]['filter']){_0x3dc0d0[_0x810b('0x77')]=_[_0x810b('0x9b')](_0x3dc0d0[_0x810b('0x77')],{'$or':_[_0x810b('0x2f')](_0x3dc0d0[_0x810b('0x3e')],function(_0xf211c2){var _0x815562={};_0x815562[_0xf211c2]={'$like':'%'+_0x376136[_0x810b('0x3b')]['filter']+'%'};return _0x815562;})});}if(_0x376136[_0x810b('0x3b')][_0x810b('0x7c')]){var _0x5e930e=_0x376136[_0x810b('0x3b')][_0x810b('0x7c')][_0x810b('0x32')](',');var _0x4bce0d={};_0x4bce0d[_0x5e930e[0x0]]={'$gte':moment(_0x5e930e[0x1])['format'](_0x810b('0xc0'))};_0x3dc0d0['where']=_['merge'](_0x3dc0d0[_0x810b('0x77')],_0x4bce0d);}_0x3dc0d0=_[_0x810b('0x9b')]({},_0x3dc0d0,_0x376136[_0x810b('0xb8')]);return db['FaxMessage'][_0x810b('0x22')]({'where':_0x3dc0d0[_0x810b('0x77')]})[_0x810b('0x29')](function(_0x426357){_0x10087b[_0x810b('0x22')]=_0x426357;if(_0x376136['query'][_0x810b('0xb6')]){_0x3dc0d0[_0x810b('0xb7')]=[{'all':!![]}];}return db[_0x810b('0xbc')][_0x810b('0xc1')](_0x3dc0d0);})[_0x810b('0x29')](function(_0x528f62){_0x10087b[_0x810b('0xb1')]=_0x528f62;return _0x10087b;});}})['then'](respondWithFilteredResult(_0x20019f,_0x3dc0d0))[_0x810b('0xb2')](handleError(_0x20019f,null));};exports['addTags']=function(_0x42ac4a,_0x34469c,_0x5d7800){return db[_0x810b('0x36')][_0x810b('0x60')]({'where':{'id':_0x42ac4a[_0x810b('0xb4')]['id']}})['then'](handleEntityNotFound(_0x34469c,null))[_0x810b('0x29')](function(_0x74aaef){if(_0x74aaef){return _0x74aaef[_0x810b('0xc2')](_0x42ac4a[_0x810b('0x72')][_0x810b('0xbd')],_[_0x810b('0xc3')](_0x42ac4a['body'],[_0x810b('0xbd'),'id'])||{})[_0x810b('0xc4')](function(){return db[_0x810b('0x6e')][_0x810b('0xc1')]({'attributes':['id',_0x810b('0x2e'),_0x810b('0x46')],'where':{'id':_0x42ac4a['body'][_0x810b('0xbd')]}});})[_0x810b('0x29')](function(_0x4ad887){socket[_0x810b('0xc5')](_0x810b('0xc6'),{'id':Number(_0x42ac4a[_0x810b('0xb4')]['id']),'tags':_0x4ad887||[]});return{'id':Number(_0x42ac4a[_0x810b('0xb4')]['id']),'tags':_0x4ad887||[]};});}})[_0x810b('0x29')](respondWithResult(_0x34469c,null))[_0x810b('0xb2')](handleError(_0x34469c,null));};exports[_0x810b('0xc7')]=function(_0x2a9cbc,_0x2f6db9,_0x38e862){return db[_0x810b('0x36')][_0x810b('0x60')]({'where':{'id':_0x2a9cbc[_0x810b('0xb4')]['id']}})[_0x810b('0x29')](handleEntityNotFound(_0x2f6db9,null))[_0x810b('0x29')](function(_0x52d140){if(_0x52d140){return _0x52d140['removeTags'](_0x2a9cbc['query'][_0x810b('0xbd')]);}})[_0x810b('0x29')](respondWithStatusCode(_0x2f6db9,null))['catch'](handleError(_0x2f6db9,null));};exports[_0x810b('0xc8')]=function(_0x42a19f,_0x4d000f){var _0x14d71c=moment()[_0x810b('0xc9')]()[_0x810b('0x99')]();var _0xbdbffa=path[_0x810b('0xca')](config[_0x810b('0xcb')],_0x810b('0xcc'),'files',_0x810b('0xcd'));var _0x241d5a=path[_0x810b('0xca')](config[_0x810b('0xcb')],_0x810b('0xcc'),_0x810b('0xce'),'attachments');var _0x58a099=path[_0x810b('0xca')](_0xbdbffa,_0x14d71c);var _0x2d84f4=util[_0x810b('0xcf')](_0x810b('0xd0'),_0x42a19f[_0x810b('0xb4')]['id'],_0x14d71c);var _0xbb5368=path[_0x810b('0xca')](_0xbdbffa,_0x2d84f4);var _0x450699=[];_0x450699[_0x810b('0x34')]({'model':db['Attachment'],'as':_0x810b('0xd1'),'raw':!![]});var _0x31c485=[{'model':db[_0x810b('0xbc')],'as':_0x810b('0xd2'),'attributes':['id',_0x810b('0x72'),_0x810b('0x7a')],'include':_0x450699}];return db[_0x810b('0x36')]['find']({'where':{'id':_0x42a19f[_0x810b('0xb4')]['id']},'include':_0x31c485})[_0x810b('0x29')](handleEntityNotFound(_0x4d000f,null))[_0x810b('0x29')](function(_0x142ad6){if(_0x142ad6&&_0x142ad6[_0x810b('0xd2')]){var _0x158372=_0x142ad6['get']({'plain':!![]});fs[_0x810b('0xd3')](_0x58a099);for(var _0xb9d2e4=0x0;_0xb9d2e4<_0x158372[_0x810b('0xd2')][_0x810b('0x67')];_0xb9d2e4++){var _0x274bf0=_0x158372[_0x810b('0xd2')][_0xb9d2e4]['Attachment'];if(_0x274bf0){var _0x5df7de=path['join'](_0x241d5a,_0x274bf0[_0x810b('0xd4')]);if(fs['existsSync'](_0x5df7de)){fs['createReadStream'](_0x5df7de)['pipe'](fs['createWriteStream'](path[_0x810b('0xca')](_0x58a099,_0x274bf0[_0x810b('0xd4')])));}}}return BPromise[_0x810b('0x92')]()[_0x810b('0x29')](function(){return new BPromise(function(_0x144a9b,_0x44426b){zipdir(_0x58a099,{'saveTo':_0xbb5368},function(_0x285c08,_0x268857){if(_0x285c08)return _0x44426b(_0x285c08);return _0x144a9b(_0x268857);});})[_0x810b('0x29')](function(){return new BPromise(function(_0x699f15,_0x3f7967){rimraf(_0x58a099,function(_0x4a90e2){if(_0x4a90e2)_0x3f7967(_0x4a90e2);return _0x699f15();});});})['then'](function(){return _0x4d000f[_0x810b('0xc8')](_0xbb5368,_0x2d84f4,function(_0x4df8d6){if(_0x4df8d6){console[_0x810b('0xd5')](_0x810b('0xd6'),_0x4df8d6);}else{fs[_0x810b('0xd7')](_0xbb5368);}});});});}else{return _0x4d000f[_0x810b('0x2b')](0xc8);}})[_0x810b('0xb2')](handleError(_0x4d000f,null));}; \ No newline at end of file +var _0x0664=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','show','params','include','merge','options','create','describe','addMessage','ids','omit','FaxMessage','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','Users','Tags','split','forEach','push','TagIds','catch','index','FaxInteraction','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes'];(function(_0x5cab70,_0x502cf7){var _0x134b1b=function(_0xc62f42){while(--_0xc62f42){_0x5cab70['push'](_0x5cab70['shift']());}};_0x134b1b(++_0x502cf7);}(_0x0664,0x93));var _0x4066=function(_0x593138,_0x30aed){_0x593138=_0x593138-0x0;var _0x2b2315=_0x0664[_0x593138];return _0x2b2315;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4066('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4066('0x1'));var jsonpatch=require(_0x4066('0x2'));var rp=require('request-promise');var moment=require(_0x4066('0x3'));var BPromise=require(_0x4066('0x4'));var Mustache=require(_0x4066('0x5'));var util=require(_0x4066('0x6'));var path=require(_0x4066('0x7'));var sox=require(_0x4066('0x8'));var csv=require(_0x4066('0x9'));var ejs=require(_0x4066('0xa'));var fs=require('fs');var _=require(_0x4066('0xb'));var squel=require(_0x4066('0xc'));var crypto=require('crypto');var jsforce=require(_0x4066('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4066('0x9'));var querystring=require(_0x4066('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4066('0xf'));var qs=require(_0x4066('0x10'));var as=require(_0x4066('0x11'));var hardwareService=require(_0x4066('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4066('0x13'))['db'];config[_0x4066('0x14')]=_[_0x4066('0x15')](config[_0x4066('0x14')],{'host':_0x4066('0x16'),'port':0x18eb});var socket=require(_0x4066('0x17'))(new Redis(config[_0x4066('0x14')]));require(_0x4066('0x18'))['register'](socket);function respondWithStatusCode(_0x42a09c,_0x152404){_0x152404=_0x152404||0xcc;return function(_0x47a602){if(_0x47a602){return _0x42a09c[_0x4066('0x19')](_0x152404);}return _0x42a09c['status'](_0x152404)[_0x4066('0x1a')]();};}function respondWithResult(_0x5f37ea,_0x50f71d){_0x50f71d=_0x50f71d||0xc8;return function(_0x430ae4){if(_0x430ae4){return _0x5f37ea[_0x4066('0x1b')](_0x50f71d)[_0x4066('0x1c')](_0x430ae4);}};}function respondWithFilteredResult(_0x3d1237,_0x296e40){return function(_0x17803d){if(_0x17803d){var _0x3a73de=_0x17803d['count'],_0x12df77=_0x296e40['offset'],_0x23de64=_0x296e40[_0x4066('0x1d')]+_0x296e40[_0x4066('0x1e')],_0xa73fb2;if(_0x23de64>=_0x3a73de){_0x23de64=_0x3a73de;_0xa73fb2=0xc8;}else{_0xa73fb2=0xce;}_0x3d1237['status'](_0xa73fb2);return _0x3d1237[_0x4066('0x1f')](_0x4066('0x20'),_0x12df77+'-'+_0x23de64+'/'+_0x3a73de)[_0x4066('0x1c')](_0x17803d);}return null;};}function patchUpdates(_0x35ae6b){return function(_0x361f1d){try{jsonpatch[_0x4066('0x21')](_0x361f1d,_0x35ae6b,!![]);}catch(_0x5439d4){return BPromise['reject'](_0x5439d4);}return _0x361f1d['save']();};}function saveUpdates(_0x549504,_0x3b2b7f){return function(_0x1eb1a8){if(_0x1eb1a8){return _0x1eb1a8[_0x4066('0x22')](_0x549504)[_0x4066('0x23')](function(_0x213dc0){return _0x213dc0;});}return null;};}function removeEntity(_0x5afa04,_0x21a1f7){return function(_0x1433a9){if(_0x1433a9){return _0x1433a9[_0x4066('0x24')]()[_0x4066('0x23')](function(){_0x5afa04[_0x4066('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6c52,_0x2984ef){return function(_0x36f67d){if(!_0x36f67d){_0x4b6c52[_0x4066('0x19')](0x194);}return _0x36f67d;};}function handleError(_0xac8304,_0x4b3b31){_0x4b3b31=_0x4b3b31||0x1f4;return function(_0x212baf){logger[_0x4066('0x25')](_0x212baf[_0x4066('0x26')]);if(_0x212baf[_0x4066('0x27')]){delete _0x212baf[_0x4066('0x27')];}_0xac8304[_0x4066('0x1b')](_0x4b3b31)[_0x4066('0x28')](_0x212baf);};}function getInteractionUsers(_0x540a9,_0x30a4e0){return new BPromise(function(_0x2e3daf,_0x496c35){try{if(_0x30a4e0[_0x540a9['id']]){_0x540a9[_0x4066('0x29')]=_['map'](_0x30a4e0[_0x540a9['id']],function(_0x5e264c){return{'id':_0x5e264c['id'],'fullname':_0x5e264c['fullname']};});}}catch(_0xec42d1){_0x496c35(_0xec42d1);}_0x2e3daf(_0x540a9);});}function getInteractionTags(_0x47cba8,_0x458a4f){return new BPromise(function(_0x2a39e7,_0x3beb7c){try{if(_0x47cba8['TagIds']){_0x47cba8[_0x4066('0x2a')]=[];_0x47cba8['TagIds'][_0x4066('0x2b')](',')[_0x4066('0x2c')](function(_0x5eaaca){_0x47cba8['Tags'][_0x4066('0x2d')](_0x458a4f[_0x5eaaca]);});}delete _0x47cba8[_0x4066('0x2e')];}catch(_0x5c82ab){_0x3beb7c(_0x5c82ab);}_0x2a39e7(_0x47cba8);});}function updateFaxInteraction(_0x111818,_0x313d7a,_0x15f830){return new BPromise(function(_0x5d8598,_0x3b96e4){return getInteractionUsers(_0x111818,_0x15f830)['then'](function(_0x15980f){return getInteractionTags(_0x15980f,_0x313d7a);})[_0x4066('0x23')](function(_0x2f4ce8){_0x5d8598(_0x2f4ce8);})[_0x4066('0x2f')](function(_0x245b91){_0x3b96e4(_0x245b91);});});}exports[_0x4066('0x30')]=function(_0x102ff6,_0x3753e6){var _0x210d32={},_0x1fcbd7={},_0x219010={'count':0x0,'rows':[]};var _0x2c5b3c=_['map'](db[_0x4066('0x31')][_0x4066('0x32')],function(_0x4e0c3c){return{'name':_0x4e0c3c[_0x4066('0x33')],'type':_0x4e0c3c[_0x4066('0x34')]['key']};});_0x1fcbd7[_0x4066('0x35')]=_[_0x4066('0x36')](_0x2c5b3c,_0x4066('0x27'));_0x1fcbd7[_0x4066('0x37')]=_[_0x4066('0x38')](_0x102ff6[_0x4066('0x37')]);_0x1fcbd7[_0x4066('0x39')]=_[_0x4066('0x3a')](_0x1fcbd7[_0x4066('0x35')],_0x1fcbd7['query']);_0x210d32[_0x4066('0x3b')]=_[_0x4066('0x3a')](_0x1fcbd7['model'],qs[_0x4066('0x3c')](_0x102ff6[_0x4066('0x37')][_0x4066('0x3c')]));_0x210d32['attributes']=_0x210d32[_0x4066('0x3b')][_0x4066('0x3d')]?_0x210d32[_0x4066('0x3b')]:_0x1fcbd7[_0x4066('0x35')];if(!_0x102ff6[_0x4066('0x37')][_0x4066('0x3e')](_0x4066('0x3f'))){_0x210d32['limit']=qs[_0x4066('0x1e')](_0x102ff6[_0x4066('0x37')][_0x4066('0x1e')]);_0x210d32[_0x4066('0x1d')]=qs[_0x4066('0x1d')](_0x102ff6['query'][_0x4066('0x1d')]);}_0x210d32[_0x4066('0x40')]=qs['sort'](_0x102ff6[_0x4066('0x37')][_0x4066('0x41')]);_0x210d32[_0x4066('0x42')]=qs[_0x4066('0x39')](_[_0x4066('0x43')](_0x102ff6['query'],_0x1fcbd7[_0x4066('0x39')]),_0x2c5b3c);var _0x44548e=[];var _0x4ee422=squel[_0x4066('0x44')]()[_0x4066('0x45')]('id')[_0x4066('0x45')](_0x4066('0x27'))[_0x4066('0x45')](_0x4066('0x46'))[_0x4066('0x47')]('tools_tags');var _0x2ba0d2=squel[_0x4066('0x44')]()[_0x4066('0x45')](_0x4066('0x48'))[_0x4066('0x45')](_0x4066('0x49'))['field'](_0x4066('0x4a'))['from'](_0x4066('0x4b'),'ui')['left_join'](_0x4066('0x4c'),'u',_0x4066('0x4d'));var _0x35edec=squel[_0x4066('0x44')]()['from'](_0x4066('0x4e'),'i')[_0x4066('0x4f')]('cm_contacts','c',_0x4066('0x50'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x4066('0x4f')](_0x4066('0x51'),'a',_0x4066('0x52'))[_0x4066('0x4f')](_0x4066('0x53'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x4066('0x4f')](_0x4066('0x54'),'it',_0x4066('0x55'))[_0x4066('0x4f')](_0x4066('0x56'),'t','t.id\x20=\x20it.TagId');var _0x36f0fd=squel[_0x4066('0x57')]();var _0x9434f0=[];var _0x322fe6=squel[_0x4066('0x57')]();var _0x634231;if(_0x102ff6[_0x4066('0x37')]['search']){_0x634231=as[_0x4066('0x58')](_0x102ff6[_0x4066('0x37')][_0x4066('0x59')]);var _0x402452=_0x634231[_0x4066('0x5a')];for(var _0x4c0155=0x0;_0x4c0155<_0x634231[_0x4066('0x5b')][_0x4066('0x3d')];_0x4c0155++){var _0x59e58d=_0x634231[_0x4066('0x5b')][_0x4c0155];var _0x32646f='i';var _0x34330a=_[_0x4066('0x5c')](_0x2c5b3c,[_0x4066('0x27'),_0x59e58d[_0x4066('0x45')]]);if(!_0x34330a){switch(_0x59e58d['field']){case _0x4066('0x5d'):if(_0x59e58d[_0x4066('0x5e')]==0x1){_0x35edec[_0x4066('0x5f')]('`'+_0x59e58d['field']+_0x4066('0x60'));}else{_0x35edec['having']('`'+_0x59e58d[_0x4066('0x45')]+_0x4066('0x61'));}break;case'Contact':if(_0x59e58d['operator']==='$substring'){if(_0x59e58d[_0x4066('0x5e')][_0x4066('0x2b')]('\x20')[_0x4066('0x3d')]>0x1){_0x36f0fd[_0x402452](_0x4066('0x62'),qs['getFullTextValue'](_0x59e58d['value']),null);}else{var _0x4359f6='%'+_0x59e58d[_0x4066('0x5e')]+'%';_0x36f0fd[_0x402452]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4359f6,_0x4359f6,_0x4359f6);}}else{_0x34330a=_['find'](_0x2c5b3c,[_0x4066('0x27'),'ContactId']);_0x59e58d[_0x4066('0x45')]='ContactId';_0x9a0bc=as[_0x4066('0x63')](_0x32646f,_0x34330a[_0x4066('0x34')],_0x59e58d);_0x36f0fd[_0x402452](_0x9a0bc[_0x4066('0x64')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x65')],_0x9a0bc[_0x4066('0x5e')]['end']);}break;case _0x4066('0x66'):var _0x19a742=_0x59e58d[_0x4066('0x5e')][_0x4066('0x2b')](',')[_0x4066('0x36')](function(_0x58727a){return Number(_0x58727a);});_0x19a742['forEach'](function(_0x3256ca){_0x322fe6['or'](_0x4066('0x67'),'%,'+_0x3256ca+',%');});_0x9434f0=_[_0x4066('0x68')](_0x9434f0,_0x19a742);break;case'User':if(_0x59e58d[_0x4066('0x69')]==='$substring'){_0x36f0fd[_0x402452](_0x4066('0x6a'),'%'+_0x59e58d[_0x4066('0x5e')]+'%',null);}else{_0x34330a=_['find'](_0x2c5b3c,[_0x4066('0x27'),'UserId']);_0x59e58d[_0x4066('0x45')]=_0x4066('0x6b');_0x9a0bc=as['buildExpression'](_0x32646f,_0x34330a['type'],_0x59e58d);_0x36f0fd[_0x402452](_0x9a0bc[_0x4066('0x64')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x65')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x1a')]);}break;case _0x4066('0x6c'):_0x9a0bc=as[_0x4066('0x63')]('me',null,_0x59e58d);_0x36f0fd[_0x402452](_0x9a0bc[_0x4066('0x64')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x65')],_0x9a0bc[_0x4066('0x5e')]['end']);break;}}else{var _0x9a0bc=as['buildExpression'](_0x32646f,_0x34330a['type'],_0x59e58d);_0x36f0fd[_0x402452](_0x9a0bc[_0x4066('0x64')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x65')],_0x9a0bc[_0x4066('0x5e')][_0x4066('0x1a')]);}}}else{var _0x21551d=_(_0x102ff6[_0x4066('0x37')])[_0x4066('0x38')]()[_0x4066('0x36')](function(_0x75ced4){return _[_0x4066('0x6d')](_0x2c5b3c,[_0x4066('0x27'),_0x75ced4])?_0x75ced4:undefined;})['compact']()['value']();if(!_[_0x4066('0x6e')](_0x21551d)){_0x21551d[_0x4066('0x2c')](function(_0x241806){if(_0x241806===_0x4066('0x6f')){_0x35edec[_0x4066('0x42')](_0x4066('0x70'),[][_0x4066('0x71')](_0x102ff6['query'][_0x241806]));}else if(_0x241806===_0x4066('0x72')){var _0x44fbba=JSON['parse'](_0x102ff6[_0x4066('0x37')][_0x241806])[_0x4066('0x73')];var _0x54d465=JSON[_0x4066('0x74')](_0x102ff6[_0x4066('0x37')][_0x241806])['$lte'];_0x35edec['where'](_0x4066('0x75'),_0x44fbba,_0x54d465);}else{if(_0x102ff6[_0x4066('0x37')][_0x241806]===_0x4066('0x76')){_0x35edec[_0x4066('0x42')]('i.'+_0x241806+_0x4066('0x77'));}else{_0x35edec[_0x4066('0x42')]('i.'+_0x241806+_0x4066('0x78'),_0x102ff6[_0x4066('0x37')][_0x241806]);}}});}if(_0x102ff6[_0x4066('0x37')][_0x4066('0x79')]){if(_0x102ff6[_0x4066('0x37')]['read']==0x1){_0x35edec[_0x4066('0x5f')](_0x4066('0x7a'));}else{_0x35edec[_0x4066('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x102ff6[_0x4066('0x37')][_0x4066('0x7b')]){_0x9434f0=_[_0x4066('0x7c')](_0x102ff6[_0x4066('0x37')][_0x4066('0x7b')])?_0x102ff6[_0x4066('0x37')][_0x4066('0x7b')]:new Array(_0x102ff6[_0x4066('0x37')][_0x4066('0x7b')]);_0x9434f0[_0x4066('0x2c')](function(_0x4c1b3b){_0x322fe6['or'](_0x4066('0x67'),'%,'+_0x4c1b3b+',%');});}if(_0x102ff6[_0x4066('0x37')][_0x4066('0x7d')]){var _0x3dc2bb=_0x102ff6[_0x4066('0x37')][_0x4066('0x7d')][_0x4066('0x7e')]('\x5c','\x5c\x5c')[_0x4066('0x7e')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x3dc2bb)){_0x36f0fd['or'](_0x4066('0x7f'),_0x3dc2bb+'%')['or'](_0x4066('0x80'),_0x3dc2bb+'%');}_0x36f0fd['or'](_0x4066('0x81'),_0x3dc2bb+'%');}}_0x35edec[_0x4066('0x42')](_0x36f0fd);_0x35edec[_0x4066('0x82')]('i.id');var _0xa8c3a0={'type':db[_0x4066('0x83')][_0x4066('0x84')]['SELECT'],'raw':!![]};var _0x37096a=_0x35edec[_0x4066('0x85')]();_0x37096a[_0x4066('0x45')](_0x4066('0x86'));_0x37096a[_0x4066('0x45')](_0x4066('0x87'),_0x4066('0x5d'));if(_0x210d32[_0x4066('0x40')]){_0x210d32['order'][_0x4066('0x2c')](function(_0x56d9b4){_0x35edec[_0x4066('0x40')]('i.'+_0x56d9b4[0x0],_0x56d9b4[0x1]===_0x4066('0x88')?![]:!![]);});}if(!_[_0x4066('0x6e')](_0x9434f0)){_0x35edec[_0x4066('0x5f')](_0x322fe6);_0x37096a[_0x4066('0x42')](_0x4066('0x89'),_0x9434f0);}BPromise[_0x4066('0x8a')]()[_0x4066('0x23')](function(){if(!_0x634231){if(_0x102ff6[_0x4066('0x37')][_0x4066('0x6f')]||_0x102ff6[_0x4066('0x37')][_0x4066('0x8b')])return;_0x37096a[_0x4066('0x42')](_0x4066('0x8c'));_0x35edec[_0x4066('0x42')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x102ff6['user'][_0x4066('0x8d')]({'attributes':['id'],'raw':!![]})[_0x4066('0x23')](function(_0x3f893f){if(_[_0x4066('0x6e')](_0x3f893f)){_0x37096a[_0x4066('0x42')](_0x4066('0x8e'));_0x35edec[_0x4066('0x42')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x37096a['where'](_0x4066('0x70'),_['map'](_0x3f893f,'id'));_0x35edec[_0x4066('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0x4066('0x36')](_0x3f893f,'id'));}});})['then'](function(){db[_0x4066('0x8f')][_0x4066('0x37')](_0x37096a[_0x4066('0x90')](),_0xa8c3a0)['then'](function(_0x296319){_0x219010[_0x4066('0x91')]=_0x296319[_0x4066('0x3d')];if(_0x219010[_0x4066('0x91')]===0x0)return[];return db[_0x4066('0x8f')][_0x4066('0x37')](_0x4ee422[_0x4066('0x90')](),_0xa8c3a0)[_0x4066('0x23')](function(_0x598649){_0x44548e=_[_0x4066('0x92')](_0x598649,'id');_0xa8c3a0=_['merge'](_0xa8c3a0,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x102ff6['query']['fields']){_0x210d32[_0x4066('0x3b')][_0x4066('0x2c')](function(_0x143022){_0x35edec[_0x4066('0x45')]('i.'+_0x143022);});}else{_0x35edec[_0x4066('0x45')](_0x4066('0x87'),_0x4066('0x5d'));_0x35edec['field'](_0x4066('0x93'),_0x4066('0x94'));_0x35edec[_0x4066('0x45')](_0x4066('0x95'),_0x4066('0x96'));_0x35edec[_0x4066('0x45')]('i.*');_0x35edec['field']('c.firstName',_0x4066('0x97'));_0x35edec[_0x4066('0x45')]('c.lastName',_0x4066('0x98'));_0x35edec[_0x4066('0x45')](_0x4066('0x99'),_0x4066('0x9a'));_0x35edec[_0x4066('0x45')](_0x4066('0x9b'),_0x4066('0x9c'));_0x35edec[_0x4066('0x45')](_0x4066('0x9d'),'Contact.mobile');_0x35edec[_0x4066('0x45')](_0x4066('0x9e'),'Contact.fax');_0x35edec[_0x4066('0x45')](_0x4066('0x9f'),'Owner.fullname');_0x35edec[_0x4066('0x45')](_0x4066('0xa0'),_0x4066('0xa1'));_0x35edec[_0x4066('0x45')](_0x4066('0xa2'),'TagIds');}if(_0x210d32[_0x4066('0x1e')])_0x35edec[_0x4066('0x1e')](_0x210d32[_0x4066('0x1e')]);if(_0x210d32[_0x4066('0x1d')])_0x35edec['offset'](_0x210d32['offset']);return db['sequelize'][_0x4066('0x37')](_0x35edec[_0x4066('0x90')](),_0xa8c3a0);})[_0x4066('0x23')](function(_0x446f88){_0x2ba0d2[_0x4066('0x42')]('ui.FaxInteractionId\x20IN\x20?',_[_0x4066('0x36')](_0x446f88,'id'));return db[_0x4066('0x8f')]['query'](_0x2ba0d2['toString'](),_0xa8c3a0)[_0x4066('0x23')](function(_0x46569d){var _0x1aa37a=_[_0x4066('0xa3')](_0x46569d,_0x4066('0xa4'));var _0x2d556c=[];_0x446f88[_0x4066('0x2c')](function(_0x40d502){_0x2d556c[_0x4066('0x2d')](updateFaxInteraction(_0x40d502,_0x44548e,_0x1aa37a));});return BPromise[_0x4066('0xa5')](_0x2d556c);});});})[_0x4066('0x23')](function(_0x11c1be){_0x219010[_0x4066('0xa6')]=_0x11c1be;return _0x219010;})['then'](respondWithFilteredResult(_0x3753e6,_0x210d32));})[_0x4066('0x2f')](handleError(_0x3753e6,null));};exports[_0x4066('0xa7')]=function(_0x46425d,_0x1ffcab){var _0xcc4bcc={'raw':![],'where':{'id':_0x46425d[_0x4066('0xa8')]['id']}},_0x5d6728={};_0x5d6728[_0x4066('0x35')]=_['keys'](db['FaxInteraction'][_0x4066('0x32')]);_0x5d6728['query']=_[_0x4066('0x38')](_0x46425d['query']);_0x5d6728[_0x4066('0x39')]=_[_0x4066('0x3a')](_0x5d6728['model'],_0x5d6728[_0x4066('0x37')]);_0xcc4bcc[_0x4066('0x3b')]=_['intersection'](_0x5d6728[_0x4066('0x35')],qs[_0x4066('0x3c')](_0x46425d[_0x4066('0x37')]['fields']));_0xcc4bcc[_0x4066('0x3b')]=_0xcc4bcc[_0x4066('0x3b')][_0x4066('0x3d')]?_0xcc4bcc['attributes']:_0x5d6728[_0x4066('0x35')];if(_0x46425d['query']['includeAll']){_0xcc4bcc[_0x4066('0xa9')]=[{'all':!![]}];}_0xcc4bcc=_[_0x4066('0xaa')]({},_0xcc4bcc,_0x46425d[_0x4066('0xab')]);return db[_0x4066('0x31')][_0x4066('0x5c')](_0xcc4bcc)[_0x4066('0x23')](handleEntityNotFound(_0x1ffcab,null))[_0x4066('0x23')](respondWithResult(_0x1ffcab,null))['catch'](handleError(_0x1ffcab,null));};exports[_0x4066('0xac')]=function(_0x4ea76a,_0x3f335c){return db['FaxInteraction'][_0x4066('0xac')](_0x4ea76a[_0x4066('0x6c')],{})[_0x4066('0x23')](respondWithResult(_0x3f335c,0xc9))['catch'](handleError(_0x3f335c,null));};exports['update']=function(_0x2ddb42,_0x2eac0f){if(_0x2ddb42[_0x4066('0x6c')]['id']){delete _0x2ddb42['body']['id'];}return db[_0x4066('0x31')]['find']({'where':{'id':_0x2ddb42[_0x4066('0xa8')]['id']}})['then'](handleEntityNotFound(_0x2eac0f,null))[_0x4066('0x23')](saveUpdates(_0x2ddb42[_0x4066('0x6c')],null))[_0x4066('0x23')](respondWithResult(_0x2eac0f,null))[_0x4066('0x2f')](handleError(_0x2eac0f,null));};exports[_0x4066('0x24')]=function(_0x77942d,_0x5c88c6){return db[_0x4066('0x31')]['find']({'where':{'id':_0x77942d[_0x4066('0xa8')]['id']}})[_0x4066('0x23')](handleEntityNotFound(_0x5c88c6,null))['then'](removeEntity(_0x5c88c6,null))[_0x4066('0x2f')](handleError(_0x5c88c6,null));};exports[_0x4066('0xad')]=function(_0x12ff62,_0x41e447){return db['FaxInteraction'][_0x4066('0xad')]()[_0x4066('0x23')](respondWithResult(_0x41e447,null))['catch'](handleError(_0x41e447,null));};exports[_0x4066('0xae')]=function(_0x54b704,_0x44c422,_0x4bfd99){return db['FaxMessage'][_0x4066('0x5c')]({'where':{'id':_0x54b704[_0x4066('0xa8')]['id']}})[_0x4066('0x23')](handleEntityNotFound(_0x44c422,null))[_0x4066('0x23')](function(_0x307fd0){if(_0x307fd0){return _0x307fd0[_0x4066('0xae')](_0x54b704[_0x4066('0x6c')][_0x4066('0xaf')],_[_0x4066('0xb0')](_0x54b704['body'],[_0x4066('0xaf'),'id'])||{});}})[_0x4066('0x23')](respondWithResult(_0x44c422,null))[_0x4066('0x2f')](handleError(_0x44c422,null));};exports['getMessages']=function(_0xd8155c,_0xcd1163,_0xb5faf2){var _0x47e02e={'raw':![],'where':{}};var _0x50fdf6={};var _0x4871d6={'count':0x0,'rows':[]};return db[_0x4066('0x31')]['findOne']({'where':{'id':_0xd8155c['params']['id']}})[_0x4066('0x23')](handleEntityNotFound(_0xcd1163,null))['then'](function(_0x2395c4){if(_0x2395c4){_0x50fdf6[_0x4066('0x35')]=_[_0x4066('0x38')](db[_0x4066('0xb1')][_0x4066('0x32')]);_0x50fdf6[_0x4066('0x37')]=_['keys'](_0xd8155c[_0x4066('0x37')]);_0x50fdf6[_0x4066('0x39')]=_['intersection'](_0x50fdf6['model'],_0x50fdf6[_0x4066('0x37')]);_0x47e02e[_0x4066('0x3b')]=_['intersection'](_0x50fdf6[_0x4066('0x35')],qs['fields'](_0xd8155c['query'][_0x4066('0x3c')]));_0x47e02e[_0x4066('0x3b')]=_0x47e02e['attributes'][_0x4066('0x3d')]?_0x47e02e[_0x4066('0x3b')]:_0x50fdf6[_0x4066('0x35')];if(!_0xd8155c[_0x4066('0x37')]['hasOwnProperty'](_0x4066('0x3f'))){_0x47e02e[_0x4066('0x1e')]=qs['limit'](_0xd8155c[_0x4066('0x37')]['limit']);_0x47e02e[_0x4066('0x1d')]=qs['offset'](_0xd8155c['query'][_0x4066('0x1d')]);}_0x47e02e[_0x4066('0x40')]=qs[_0x4066('0x41')](_0xd8155c[_0x4066('0x37')][_0x4066('0x41')]);_0x47e02e['where']=qs[_0x4066('0x39')](_['pick'](_0xd8155c[_0x4066('0x37')],_0x50fdf6[_0x4066('0x39')]));_0x47e02e[_0x4066('0x42')][_0x4066('0xa4')]=_0x2395c4['id'];if(_0xd8155c[_0x4066('0x37')][_0x4066('0x7d')]){_0x47e02e['where']=_['merge'](_0x47e02e[_0x4066('0x42')],{'$or':_[_0x4066('0x36')](_0x47e02e[_0x4066('0x3b')],function(_0x3c6732){var _0x47d46a={};_0x47d46a[_0x3c6732]={'$like':'%'+_0xd8155c[_0x4066('0x37')][_0x4066('0x7d')]+'%'};return _0x47d46a;})});}if(_0xd8155c['query'][_0x4066('0x73')]){var _0x1ce3be=_0xd8155c['query'][_0x4066('0x73')][_0x4066('0x2b')](',');var _0x43f2b2={};_0x43f2b2[_0x1ce3be[0x0]]={'$gte':moment(_0x1ce3be[0x1])['format'](_0x4066('0xb2'))};_0x47e02e[_0x4066('0x42')]=_[_0x4066('0xaa')](_0x47e02e[_0x4066('0x42')],_0x43f2b2);}_0x47e02e=_[_0x4066('0xaa')]({},_0x47e02e,_0xd8155c[_0x4066('0xab')]);return db[_0x4066('0xb1')]['count']({'where':_0x47e02e[_0x4066('0x42')]})[_0x4066('0x23')](function(_0x66a9b0){_0x4871d6['count']=_0x66a9b0;if(_0xd8155c[_0x4066('0x37')][_0x4066('0xb3')]){_0x47e02e[_0x4066('0xa9')]=[{'all':!![]}];}return db['FaxMessage'][_0x4066('0xb4')](_0x47e02e);})[_0x4066('0x23')](function(_0x32bdd3){_0x4871d6[_0x4066('0xa6')]=_0x32bdd3;return _0x4871d6;});}})[_0x4066('0x23')](respondWithFilteredResult(_0xcd1163,_0x47e02e))[_0x4066('0x2f')](handleError(_0xcd1163,null));};exports[_0x4066('0xb5')]=function(_0xa099a6,_0x34e53e,_0x50696c){return db[_0x4066('0x31')][_0x4066('0x5c')]({'where':{'id':_0xa099a6[_0x4066('0xa8')]['id']}})[_0x4066('0x23')](handleEntityNotFound(_0x34e53e,null))[_0x4066('0x23')](function(_0x28ea9b){if(_0x28ea9b){return _0x28ea9b[_0x4066('0xb6')](_0xa099a6[_0x4066('0x6c')][_0x4066('0xaf')],_[_0x4066('0xb0')](_0xa099a6['body'],[_0x4066('0xaf'),'id'])||{})[_0x4066('0xb7')](function(){return db[_0x4066('0x66')][_0x4066('0xb4')]({'attributes':['id',_0x4066('0x27'),_0x4066('0x46')],'where':{'id':_0xa099a6[_0x4066('0x6c')][_0x4066('0xaf')]}});})[_0x4066('0x23')](function(_0x4a2c00){socket[_0x4066('0xb8')]('faxInteractionTags:save',{'id':Number(_0xa099a6[_0x4066('0xa8')]['id']),'tags':_0x4a2c00||[]});return{'id':Number(_0xa099a6['params']['id']),'tags':_0x4a2c00||[]};});}})[_0x4066('0x23')](respondWithResult(_0x34e53e,null))[_0x4066('0x2f')](handleError(_0x34e53e,null));};exports[_0x4066('0xb9')]=function(_0x34af78,_0x3055d1,_0x4c07d9){return db['FaxInteraction'][_0x4066('0x5c')]({'where':{'id':_0x34af78[_0x4066('0xa8')]['id']}})[_0x4066('0x23')](handleEntityNotFound(_0x3055d1,null))['then'](function(_0x17cb22){if(_0x17cb22){return _0x17cb22[_0x4066('0xb9')](_0x34af78[_0x4066('0x37')][_0x4066('0xaf')]);}})[_0x4066('0x23')](respondWithStatusCode(_0x3055d1,null))[_0x4066('0x2f')](handleError(_0x3055d1,null));};exports[_0x4066('0xba')]=function(_0x51174c,_0x58013c){var _0x55de80=moment()[_0x4066('0xbb')]()[_0x4066('0x90')]();var _0x5192a1=path[_0x4066('0xbc')](config['root'],_0x4066('0xbd'),_0x4066('0xbe'),_0x4066('0xbf'));var _0x3fa51f=path[_0x4066('0xbc')](config[_0x4066('0xc0')],'server',_0x4066('0xbe'),_0x4066('0xc1'));var _0x216ce1=path['join'](_0x5192a1,_0x55de80);var _0x395fa2=util[_0x4066('0xc2')](_0x4066('0xc3'),_0x51174c[_0x4066('0xa8')]['id'],_0x55de80);var _0x1d0d16=path[_0x4066('0xbc')](_0x5192a1,_0x395fa2);var _0x1e6ad9=[];_0x1e6ad9[_0x4066('0x2d')]({'model':db[_0x4066('0xc4')],'as':'Attachment','raw':!![]});var _0x31a093=[{'model':db[_0x4066('0xb1')],'as':'Messages','attributes':['id',_0x4066('0x6c'),_0x4066('0x72')],'include':_0x1e6ad9}];return db[_0x4066('0x31')][_0x4066('0x5c')]({'where':{'id':_0x51174c[_0x4066('0xa8')]['id']},'include':_0x31a093})['then'](handleEntityNotFound(_0x58013c,null))[_0x4066('0x23')](function(_0x115895){if(_0x115895&&_0x115895[_0x4066('0xc5')]){var _0x33cb6b=_0x115895[_0x4066('0xc6')]({'plain':!![]});fs['mkdirSync'](_0x216ce1);for(var _0x4bb08a=0x0;_0x4bb08a<_0x33cb6b[_0x4066('0xc5')][_0x4066('0x3d')];_0x4bb08a++){var _0xf68788=_0x33cb6b['Messages'][_0x4bb08a][_0x4066('0xc4')];if(_0xf68788){var _0x10bc2d=path[_0x4066('0xbc')](_0x3fa51f,_0xf68788[_0x4066('0xc7')]);if(fs[_0x4066('0xc8')](_0x10bc2d)){fs[_0x4066('0xc9')](_0x10bc2d)[_0x4066('0xca')](fs[_0x4066('0xcb')](path[_0x4066('0xbc')](_0x216ce1,_0xf68788[_0x4066('0xc7')])));}}}return BPromise['resolve']()[_0x4066('0x23')](function(){return new BPromise(function(_0x3592fb,_0x458149){zipdir(_0x216ce1,{'saveTo':_0x1d0d16},function(_0x58a24a,_0x189cd7){if(_0x58a24a)return _0x458149(_0x58a24a);return _0x3592fb(_0x189cd7);});})['then'](function(){return new BPromise(function(_0x508f81,_0x496327){rimraf(_0x216ce1,function(_0x1998bf){if(_0x1998bf)_0x496327(_0x1998bf);return _0x508f81();});});})[_0x4066('0x23')](function(){return _0x58013c[_0x4066('0xba')](_0x1d0d16,_0x395fa2,function(_0x5ecce7){if(_0x5ecce7){console[_0x4066('0xcc')](_0x4066('0xcd'),_0x5ecce7);}else{fs[_0x4066('0xce')](_0x1d0d16);}});});});}else{return _0x58013c[_0x4066('0x19')](0xc8);}})[_0x4066('0x2f')](handleError(_0x58013c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6a080e4..32e6bdb 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=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(_0x53fba6,_0x30fce6){var _0x3551c1=function(_0x3c14f0){while(--_0x3c14f0){_0x53fba6['push'](_0x53fba6['shift']());}};_0x3551c1(++_0x30fce6);}(_0x814b,0x1a2));var _0xb814=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x814b[_0x2a7b8e];return _0x29b5c8;};'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 d6fb2e1..a1e4712 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 _0x70e0=['path','rimraf','./faxInteraction.attributes','fax_interactions','changed','closed','closedAt','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x30ab10,_0x50bd70){var _0x499e9e=function(_0x34cdc0){while(--_0x34cdc0){_0x30ab10['push'](_0x30ab10['shift']());}};_0x499e9e(++_0x50bd70);}(_0x70e0,0x17b));var _0x070e=function(_0x32cc37,_0x3fca47){_0x32cc37=_0x32cc37-0x0;var _0x2cc339=_0x70e0[_0x32cc37];return _0x2cc339;};'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 +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(_0x87867b,_0x2cc4fb){var _0xc95e2e=function(_0x5e2300){while(--_0x5e2300){_0x87867b['push'](_0x87867b['shift']());}};_0xc95e2e(++_0x2cc4fb);}(_0xe706,0xa3));var _0x6e70=function(_0x197d5c,_0x1936b0){_0x197d5c=_0x197d5c-0x0;var _0x13dc71=_0xe706[_0x197d5c];return _0x13dc71;};'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 diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 12f3818..c4af1d9 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 _0x242a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','find','ids','spread','AddTags'];(function(_0x5a7cbc,_0x573d85){var _0x44d2cc=function(_0x154862){while(--_0x154862){_0x5a7cbc['push'](_0x5a7cbc['shift']());}};_0x44d2cc(++_0x573d85);}(_0x242a,0xb5));var _0xa242=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x242a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa242('0x0'));var util=require(_0xa242('0x1'));var moment=require(_0xa242('0x2'));var BPromise=require(_0xa242('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa242('0x4'));var db=require(_0xa242('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa242('0x6'))(_0xa242('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa242('0x8')]({'port':0x232a});config[_0xa242('0x9')]=_[_0xa242('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa242('0xb'))(new Redis(config[_0xa242('0x9')]));require(_0xa242('0xc'))[_0xa242('0xd')](socket);function respondWithRpcPromise(_0x531fb5,_0x2056b0,_0xda9db9){return new BPromise(function(_0x40706e,_0x5648b6){return client[_0xa242('0xe')](_0x531fb5,_0xda9db9)[_0xa242('0xf')](function(_0x3e9e93){logger[_0xa242('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x2056b0,_0xa242('0x11'));logger[_0xa242('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2056b0,_0xa242('0x11'),JSON[_0xa242('0x13')](_0x3e9e93));if(_0x3e9e93[_0xa242('0x14')]){if(_0x3e9e93[_0xa242('0x14')][_0xa242('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2056b0,_0x3e9e93[_0xa242('0x14')][_0xa242('0x16')]);return _0x5648b6(_0x3e9e93[_0xa242('0x14')][_0xa242('0x16')]);}logger['error'](_0xa242('0x17'),_0x2056b0,_0x3e9e93[_0xa242('0x14')][_0xa242('0x16')]);return _0x40706e(_0x3e9e93['error']['message']);}else{logger[_0xa242('0x10')](_0xa242('0x17'),_0x2056b0,_0xa242('0x11'));_0x40706e(_0x3e9e93['result'][_0xa242('0x16')]);}})['catch'](function(_0x52986e){logger[_0xa242('0x14')](_0xa242('0x17'),_0x2056b0,_0x52986e);_0x5648b6(_0x52986e);});});}exports[_0xa242('0x18')]=function(_0x503ace){var _0x31cf97=this;return new Promise(function(_0x1feac1,_0x59622f){return db[_0xa242('0x19')][_0xa242('0x1a')](_0x503ace[_0xa242('0x1b')],{'raw':_0x503ace[_0xa242('0x1c')]?_0x503ace[_0xa242('0x1c')][_0xa242('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503ace[_0xa242('0x1c')]?_0x503ace[_0xa242('0x1c')]['where']||null:null,'attributes':_0x503ace[_0xa242('0x1c')]?_0x503ace[_0xa242('0x1c')][_0xa242('0x1e')]||null:null,'limit':_0x503ace[_0xa242('0x1c')]?_0x503ace['options']['limit']||null:null})[_0xa242('0xf')](function(_0x5314b3){logger[_0xa242('0x10')](_0xa242('0x18'),_0x503ace);logger[_0xa242('0x12')](_0xa242('0x18'),_0x503ace,JSON['stringify'](_0x5314b3));_0x1feac1(_0x5314b3);})['catch'](function(_0x1d24ea){logger[_0xa242('0x14')](_0xa242('0x18'),_0x1d24ea[_0xa242('0x16')],_0x503ace);_0x59622f(_0x31cf97['error'](0x1f4,_0x1d24ea[_0xa242('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5645a8){return new Promise(function(_0x3ccffd,_0x382396){return db[_0xa242('0x19')][_0xa242('0x1f')]({'where':_0x5645a8[_0xa242('0x1c')]?_0x5645a8[_0xa242('0x1c')]['where']||null:null})['then'](function(_0x2821da){if(_0x2821da){return _0x2821da['addTags'](_0x5645a8[_0xa242('0x1b')][_0xa242('0x20')],_['omit'](_0x5645a8[_0xa242('0x1b')],[_0xa242('0x20'),'id'])||{});}})[_0xa242('0x21')](function(_0x53cd5f){logger['info'](_0xa242('0x22'),_0x5645a8);logger[_0xa242('0x12')](_0xa242('0x22'),_0x5645a8,JSON['stringify'](_0x53cd5f));_0x3ccffd(_0x53cd5f);})[_0xa242('0x23')](function(_0x2d5fcc){logger['error'](_0xa242('0x22'),_0x2d5fcc[_0xa242('0x16')],_0x5645a8);_0x382396(_this[_0xa242('0x14')](0x1f4,_0x2d5fcc[_0xa242('0x16')]));});});}; \ No newline at end of file +var _0x330a=['info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','then','FaxInteraction','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','register','request'];(function(_0x5f08e1,_0x5651f2){var _0x515ff1=function(_0x487342){while(--_0x487342){_0x5f08e1['push'](_0x5f08e1['shift']());}};_0x515ff1(++_0x5651f2);}(_0x330a,0x1d2));var _0xa330=function(_0xcd4d8e,_0x1fc2fd){_0xcd4d8e=_0xcd4d8e-0x0;var _0x1c3c61=_0x330a[_0xcd4d8e];return _0x1c3c61;};'use strict';var _=require(_0xa330('0x0'));var util=require(_0xa330('0x1'));var moment=require('moment');var BPromise=require(_0xa330('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa330('0x3'));var db=require(_0xa330('0x4'))['db'];var utils=require(_0xa330('0x5'));var logger=require(_0xa330('0x6'))(_0xa330('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa330('0x8')]({'port':0x232a});config['redis']=_[_0xa330('0x9')](config[_0xa330('0xa')],{'host':_0xa330('0xb'),'port':0x18eb});var socket=require(_0xa330('0xc'))(new Redis(config[_0xa330('0xa')]));require('./faxInteraction.socket')[_0xa330('0xd')](socket);function respondWithRpcPromise(_0x5bc9a8,_0x142c0a,_0x4bdd0c){return new BPromise(function(_0x27011a,_0x3a2e25){return client[_0xa330('0xe')](_0x5bc9a8,_0x4bdd0c)['then'](function(_0x37ec47){logger[_0xa330('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x142c0a,_0xa330('0x10'));logger[_0xa330('0x11')](_0xa330('0x12'),_0x142c0a,_0xa330('0x10'),JSON['stringify'](_0x37ec47));if(_0x37ec47[_0xa330('0x13')]){if(_0x37ec47[_0xa330('0x13')][_0xa330('0x14')]===0x1f4){logger[_0xa330('0x13')](_0xa330('0x15'),_0x142c0a,_0x37ec47[_0xa330('0x13')]['message']);return _0x3a2e25(_0x37ec47[_0xa330('0x13')]['message']);}logger['error'](_0xa330('0x15'),_0x142c0a,_0x37ec47['error'][_0xa330('0x16')]);return _0x27011a(_0x37ec47[_0xa330('0x13')][_0xa330('0x16')]);}else{logger[_0xa330('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x142c0a,'request\x20sent');_0x27011a(_0x37ec47[_0xa330('0x17')][_0xa330('0x16')]);}})[_0xa330('0x18')](function(_0x31ba04){logger[_0xa330('0x13')](_0xa330('0x15'),_0x142c0a,_0x31ba04);_0x3a2e25(_0x31ba04);});});}exports[_0xa330('0x19')]=function(_0x4a7e99){var _0x1ed495=this;return new Promise(function(_0x1702c2,_0x51ba3c){return db['FaxInteraction'][_0xa330('0x1a')](_0x4a7e99[_0xa330('0x1b')],{'raw':_0x4a7e99[_0xa330('0x1c')]?_0x4a7e99[_0xa330('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a7e99[_0xa330('0x1c')]?_0x4a7e99[_0xa330('0x1c')][_0xa330('0x1d')]||null:null,'attributes':_0x4a7e99['options']?_0x4a7e99['options'][_0xa330('0x1e')]||null:null,'limit':_0x4a7e99[_0xa330('0x1c')]?_0x4a7e99[_0xa330('0x1c')][_0xa330('0x1f')]||null:null})[_0xa330('0x20')](function(_0x4d7a4b){logger['info'](_0xa330('0x19'),_0x4a7e99);logger[_0xa330('0x11')](_0xa330('0x19'),_0x4a7e99,JSON['stringify'](_0x4d7a4b));_0x1702c2(_0x4d7a4b);})[_0xa330('0x18')](function(_0x547a07){logger[_0xa330('0x13')](_0xa330('0x19'),_0x547a07[_0xa330('0x16')],_0x4a7e99);_0x51ba3c(_0x1ed495[_0xa330('0x13')](0x1f4,_0x547a07[_0xa330('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x51f4a4){return new Promise(function(_0x9bc6f1,_0x42b40e){return db[_0xa330('0x21')]['find']({'where':_0x51f4a4['options']?_0x51f4a4['options'][_0xa330('0x1d')]||null:null})[_0xa330('0x20')](function(_0x40717e){if(_0x40717e){return _0x40717e['addTags'](_0x51f4a4[_0xa330('0x1b')]['ids'],_['omit'](_0x51f4a4['body'],[_0xa330('0x22'),'id'])||{});}})[_0xa330('0x23')](function(_0x2a30cc){logger[_0xa330('0xf')]('AddTags',_0x51f4a4);logger['debug'](_0xa330('0x24'),_0x51f4a4,JSON['stringify'](_0x2a30cc));_0x9bc6f1(_0x2a30cc);})['catch'](function(_0x24e9cf){logger[_0xa330('0x13')](_0xa330('0x24'),_0x24e9cf[_0xa330('0x16')],_0x51f4a4);_0x42b40e(_this[_0xa330('0x13')](0x1f4,_0x24e9cf[_0xa330('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d9da3b6..90710cf 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 _0x9196=['faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x4e183e,_0x566bde){var _0x16964b=function(_0x2a948b){while(--_0x2a948b){_0x4e183e['push'](_0x4e183e['shift']());}};_0x16964b(++_0x566bde);}(_0x9196,0xd1));var _0x6919=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9196[_0x1cc8fe];return _0x230054;};'use strict';var FaxInteractionEvents=require(_0x6919('0x0'));var events=[_0x6919('0x1'),'remove',_0x6919('0x2')];function createListener(_0x2387db,_0x38f11c){return function(_0x180669){_0x38f11c[_0x6919('0x3')](_0x2387db,_0x180669);};}function removeListener(_0x155f47,_0x518d92){return function(){FaxInteractionEvents[_0x6919('0x4')](_0x155f47,_0x518d92);};}exports[_0x6919('0x5')]=function(_0x33d3f){for(var _0x3bc10a=0x0,_0x106ea3=events[_0x6919('0x6')];_0x3bc10a<_0x106ea3;_0x3bc10a++){var _0x2ec378=events[_0x3bc10a];var _0x36c25f=createListener(_0x6919('0x7')+_0x2ec378,_0x33d3f);FaxInteractionEvents['on'](_0x2ec378,_0x36c25f);}}; \ No newline at end of file +var _0xc072=['remove','update','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x3f8b65,_0x164321){var _0x29e730=function(_0x2a9c1f){while(--_0x2a9c1f){_0x3f8b65['push'](_0x3f8b65['shift']());}};_0x29e730(++_0x164321);}(_0xc072,0x1be));var _0x2c07=function(_0x3e3e12,_0x1c1103){_0x3e3e12=_0x3e3e12-0x0;var _0x42272e=_0xc072[_0x3e3e12];return _0x42272e;};'use strict';var FaxInteractionEvents=require(_0x2c07('0x0'));var events=[_0x2c07('0x1'),_0x2c07('0x2'),_0x2c07('0x3')];function createListener(_0xb4fc86,_0xf7176c){return function(_0x49c5e1){_0xf7176c[_0x2c07('0x4')](_0xb4fc86,_0x49c5e1);};}function removeListener(_0x3f6c87,_0x45e7dd){return function(){FaxInteractionEvents['removeListener'](_0x3f6c87,_0x45e7dd);};}exports[_0x2c07('0x5')]=function(_0x5d238a){for(var _0x838a2e=0x0,_0x3f0c11=events[_0x2c07('0x6')];_0x838a2e<_0x3f0c11;_0x838a2e++){var _0x2e76b6=events[_0x838a2e];var _0x227d18=createListener(_0x2c07('0x7')+_0x2e76b6,_0x5d238a);FaxInteractionEvents['on'](_0x2e76b6,_0x227d18);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fbc06d3..1609508 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 _0xef3a=['isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get'];(function(_0x34f82a,_0x519e18){var _0x4d91c3=function(_0x560d3d){while(--_0x560d3d){_0x34f82a['push'](_0x34f82a['shift']());}};_0x4d91c3(++_0x519e18);}(_0xef3a,0xa6));var _0xaef3=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0xef3a[_0x1488cd];return _0x63fa13;};'use strict';var multer=require(_0xaef3('0x0'));var util=require('util');var path=require(_0xaef3('0x1'));var timeout=require('connect-timeout');var express=require(_0xaef3('0x2'));var router=express['Router']();var auth=require(_0xaef3('0x3'));var interaction=require(_0xaef3('0x4'));var config=require(_0xaef3('0x5'));var controller=require(_0xaef3('0x6'));router[_0xaef3('0x7')]('/',auth[_0xaef3('0x8')](),controller[_0xaef3('0x9')]);router[_0xaef3('0x7')](_0xaef3('0xa'),auth[_0xaef3('0x8')](),controller[_0xaef3('0xb')]);router[_0xaef3('0x7')](_0xaef3('0xc'),auth[_0xaef3('0x8')](),controller['show']);router[_0xaef3('0x7')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xaef3('0x7')](_0xaef3('0xd'),auth[_0xaef3('0x8')](),controller[_0xaef3('0xe')]);router[_0xaef3('0xf')]('/',auth[_0xaef3('0x8')](),controller[_0xaef3('0x10')]);router[_0xaef3('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaef3('0x11')]);router[_0xaef3('0xf')](_0xaef3('0x12'),auth[_0xaef3('0x8')](),interaction['tracked'](_0xaef3('0x13'),_0xaef3('0x14')),controller[_0xaef3('0x15')]);router['put'](_0xaef3('0xc'),auth['isAuthenticated'](),interaction[_0xaef3('0x16')](_0xaef3('0x13'),_0xaef3('0x17')),controller[_0xaef3('0x18')]);router[_0xaef3('0x19')](_0xaef3('0xc'),auth[_0xaef3('0x8')](),interaction[_0xaef3('0x16')](_0xaef3('0x13'),_0xaef3('0x1a')),controller[_0xaef3('0x1b')]);router[_0xaef3('0x19')](_0xaef3('0x12'),auth['isAuthenticated'](),controller['removeTags']);module[_0xaef3('0x1c')]=router; \ No newline at end of file +var _0x572a=['/:id/tags','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy'];(function(_0x1c1590,_0x500f27){var _0x35e550=function(_0x133974){while(--_0x133974){_0x1c1590['push'](_0x1c1590['shift']());}};_0x35e550(++_0x500f27);}(_0x572a,0x12f));var _0xa572=function(_0x2e358b,_0x4878e9){_0x2e358b=_0x2e358b-0x0;var _0x474f9b=_0x572a[_0x2e358b];return _0x474f9b;};'use strict';var multer=require(_0xa572('0x0'));var util=require('util');var path=require(_0xa572('0x1'));var timeout=require(_0xa572('0x2'));var express=require(_0xa572('0x3'));var router=express['Router']();var auth=require(_0xa572('0x4'));var interaction=require(_0xa572('0x5'));var config=require(_0xa572('0x6'));var controller=require(_0xa572('0x7'));router['get']('/',auth[_0xa572('0x8')](),controller['index']);router[_0xa572('0x9')](_0xa572('0xa'),auth['isAuthenticated'](),controller[_0xa572('0xb')]);router[_0xa572('0x9')](_0xa572('0xc'),auth[_0xa572('0x8')](),controller[_0xa572('0xd')]);router[_0xa572('0x9')](_0xa572('0xe'),auth[_0xa572('0x8')](),controller['getMessages']);router[_0xa572('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xa572('0xf')]('/',auth['isAuthenticated'](),controller[_0xa572('0x10')]);router['post'](_0xa572('0xe'),auth[_0xa572('0x8')](),controller[_0xa572('0x11')]);router[_0xa572('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa572('0x12')](_0xa572('0x13'),_0xa572('0x14')),controller[_0xa572('0x15')]);router['put'](_0xa572('0xc'),auth[_0xa572('0x8')](),interaction[_0xa572('0x12')]('fax',_0xa572('0x16')),controller[_0xa572('0x17')]);router[_0xa572('0x18')](_0xa572('0xc'),auth[_0xa572('0x8')](),interaction['tracked'](_0xa572('0x13'),_0xa572('0x19')),controller[_0xa572('0x1a')]);router[_0xa572('0x18')](_0xa572('0x1b'),auth[_0xa572('0x8')](),controller[_0xa572('0x1c')]);module[_0xa572('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ca7b7a9..59d59ce 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 _0x74ba=['sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x74ba,0x1d4));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa74b('0x0'));module[_0xa74b('0x1')]={'body':{'type':Sequelize[_0xa74b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa74b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa74b('0x4')]('in',_0xa74b('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xa74b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc1b0=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x5ee5c4,_0x526282){var _0x21b1a0=function(_0x20a1b5){while(--_0x20a1b5){_0x5ee5c4['push'](_0x5ee5c4['shift']());}};_0x21b1a0(++_0x526282);}(_0xc1b0,0x16c));var _0x0c1b=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0xc1b0[_0x581960];return _0x4ee892;};'use strict';var Sequelize=require(_0x0c1b('0x0'));module[_0x0c1b('0x1')]={'body':{'type':Sequelize[_0x0c1b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0c1b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0c1b('0x4')),'defaultValue':_0x0c1b('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0c1b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0c1b('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a0be293..665bd34 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 _0xede0=['user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','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','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','count','offset','set','json','apply','reject','save','update','destroy','then','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','name','keys','filters','intersection','attributes','fields','query','length','nolimit','limit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','body','find','params','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xede0,0x1c0));var _0x0ede=function(_0xebec32,_0x20dc3c){_0xebec32=_0xebec32-0x0;var _0x59a4ce=_0xede0[_0xebec32];return _0x59a4ce;};'use strict';var pdf=require(_0x0ede('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0ede('0x1'));var zipdir=require(_0x0ede('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ede('0x3'));var moment=require(_0x0ede('0x4'));var BPromise=require(_0x0ede('0x5'));var Mustache=require(_0x0ede('0x6'));var util=require(_0x0ede('0x7'));var path=require(_0x0ede('0x8'));var sox=require(_0x0ede('0x9'));var csv=require(_0x0ede('0xa'));var ejs=require(_0x0ede('0xb'));var fs=require('fs');var _=require(_0x0ede('0xc'));var squel=require('squel');var crypto=require(_0x0ede('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ede('0xa'));var querystring=require(_0x0ede('0xe'));var Papa=require('papaparse');var Redis=require(_0x0ede('0xf'));var authService=require(_0x0ede('0x10'));var qs=require(_0x0ede('0x11'));var as=require(_0x0ede('0x12'));var hardwareService=require(_0x0ede('0x13'));var logger=require(_0x0ede('0x14'))(_0x0ede('0x15'));var utils=require(_0x0ede('0x16'));var config=require(_0x0ede('0x17'));var db=require(_0x0ede('0x18'))['db'];config[_0x0ede('0x19')]=_[_0x0ede('0x1a')](config[_0x0ede('0x19')],{'host':_0x0ede('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ede('0x19')]));require(_0x0ede('0x1c'))[_0x0ede('0x1d')](socket);var jayson=require(_0x0ede('0x1e'));var client=jayson[_0x0ede('0x1f')][_0x0ede('0x20')]({'port':0x232c});var client9002=jayson[_0x0ede('0x1f')][_0x0ede('0x20')]({'port':0x232a});function checkPasswordPattern(_0xbd3098,_0x23025c,_0x2cb6ee){if(_0x2cb6ee){var _0x1942cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1942cd['test'](_0x23025c)){return _0xbd3098;}else{throw new db['Sequelize'][(_0x0ede('0x21'))](_0x0ede('0x22'));}}else{return _0xbd3098;}}function respondWithRpcPromise(_0x1239f3,_0x8d99dd,_0x5351a7,_0x56e97d){return new BPromise(function(_0x1f7506,_0x4de6dd){var _0x380888=_0x56e97d||client;return _0x380888[_0x0ede('0x23')](_0x1239f3,_0x5351a7)['then'](function(_0x489535){logger[_0x0ede('0x24')](_0x0ede('0x25'),_0x8d99dd,'request\x20sent');logger[_0x0ede('0x26')](_0x0ede('0x27'),_0x8d99dd,_0x0ede('0x28'),JSON[_0x0ede('0x29')](_0x489535));if(_0x489535[_0x0ede('0x2a')]){if(_0x489535['error'][_0x0ede('0x2b')]===0x1f4){logger[_0x0ede('0x2a')](_0x0ede('0x25'),_0x8d99dd,_0x489535[_0x0ede('0x2a')][_0x0ede('0x2c')]);return _0x4de6dd(_0x489535[_0x0ede('0x2a')][_0x0ede('0x2c')]);}logger[_0x0ede('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x8d99dd,_0x489535['error']['message']);return _0x1f7506(_0x489535[_0x0ede('0x2a')]['message']);}else{logger[_0x0ede('0x24')](_0x0ede('0x25'),_0x8d99dd,_0x0ede('0x28'));_0x1f7506(_0x489535['result'][_0x0ede('0x2c')]);}})['catch'](function(_0x1d97f3){logger[_0x0ede('0x2a')](_0x0ede('0x25'),_0x8d99dd,_0x1d97f3);_0x4de6dd(_0x1d97f3);});});}function respondWithStatusCode(_0x32e689,_0x749865){_0x749865=_0x749865||0xcc;return function(_0x56b2b7){if(_0x56b2b7){return _0x32e689[_0x0ede('0x2d')](_0x749865);}return _0x32e689[_0x0ede('0x2e')](_0x749865)['end']();};}function respondWithResult(_0x3f4d5f,_0x23f92c){_0x23f92c=_0x23f92c||0xc8;return function(_0x4b1abe){if(_0x4b1abe){return _0x3f4d5f[_0x0ede('0x2e')](_0x23f92c)['json'](_0x4b1abe);}};}function respondWithFilteredResult(_0x5c98ee,_0x28a478){return function(_0x157b3f){if(_0x157b3f){var _0x4b3b5e=_0x157b3f[_0x0ede('0x2f')],_0x2aec94=_0x28a478[_0x0ede('0x30')],_0x194eb0=_0x28a478[_0x0ede('0x30')]+_0x28a478['limit'],_0x1df75d;if(_0x194eb0>=_0x4b3b5e){_0x194eb0=_0x4b3b5e;_0x1df75d=0xc8;}else{_0x1df75d=0xce;}_0x5c98ee[_0x0ede('0x2e')](_0x1df75d);return _0x5c98ee[_0x0ede('0x31')]('Content-Range',_0x2aec94+'-'+_0x194eb0+'/'+_0x4b3b5e)[_0x0ede('0x32')](_0x157b3f);}return null;};}function patchUpdates(_0x1062c3){return function(_0x259aff){try{jsonpatch[_0x0ede('0x33')](_0x259aff,_0x1062c3,!![]);}catch(_0x23c3a4){return BPromise[_0x0ede('0x34')](_0x23c3a4);}return _0x259aff[_0x0ede('0x35')]();};}function saveUpdates(_0x53309c,_0xb72db7){return function(_0x5e1003){if(_0x5e1003){return _0x5e1003[_0x0ede('0x36')](_0x53309c)['then'](function(_0x2cec20){return _0x2cec20;});}return null;};}function removeEntity(_0x32c093,_0x3120bd){return function(_0x47d17b){if(_0x47d17b){return _0x47d17b[_0x0ede('0x37')]()[_0x0ede('0x38')](function(){_0x32c093[_0x0ede('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d484c,_0x2c9801){return function(_0x504cee){if(!_0x504cee){_0x1d484c[_0x0ede('0x2d')](0x194);}return _0x504cee;};}function handleError(_0x5a8f0c,_0x2e0dad){_0x2e0dad=_0x2e0dad||0x1f4;return function(_0x49ba6b){logger[_0x0ede('0x2a')](_0x49ba6b['stack']);if(_0x49ba6b['name']){delete _0x49ba6b['name'];}_0x5a8f0c[_0x0ede('0x2e')](_0x2e0dad)['send'](_0x49ba6b);};}exports[_0x0ede('0x39')]=function(_0xa05753,_0x48e04f){var _0x39219d={},_0x114485={},_0x51bcdc={'count':0x0,'rows':[]};var _0x33dcd3=_['map'](db[_0x0ede('0x3a')][_0x0ede('0x3b')],function(_0x40e432){return{'name':_0x40e432[_0x0ede('0x3c')],'type':_0x40e432[_0x0ede('0x3d')][_0x0ede('0x3e')]};});_0x114485[_0x0ede('0x3f')]=_[_0x0ede('0x40')](_0x33dcd3,_0x0ede('0x41'));_0x114485['query']=_[_0x0ede('0x42')](_0xa05753['query']);_0x114485[_0x0ede('0x43')]=_[_0x0ede('0x44')](_0x114485[_0x0ede('0x3f')],_0x114485['query']);_0x39219d[_0x0ede('0x45')]=_[_0x0ede('0x44')](_0x114485['model'],qs[_0x0ede('0x46')](_0xa05753[_0x0ede('0x47')][_0x0ede('0x46')]));_0x39219d[_0x0ede('0x45')]=_0x39219d[_0x0ede('0x45')][_0x0ede('0x48')]?_0x39219d[_0x0ede('0x45')]:_0x114485[_0x0ede('0x3f')];if(!_0xa05753[_0x0ede('0x47')]['hasOwnProperty'](_0x0ede('0x49'))){_0x39219d['limit']=qs['limit'](_0xa05753[_0x0ede('0x47')][_0x0ede('0x4a')]);_0x39219d[_0x0ede('0x30')]=qs[_0x0ede('0x30')](_0xa05753[_0x0ede('0x47')][_0x0ede('0x30')]);}_0x39219d['order']=qs[_0x0ede('0x4b')](_0xa05753[_0x0ede('0x47')]['sort']);_0x39219d[_0x0ede('0x4c')]=qs[_0x0ede('0x43')](_[_0x0ede('0x4d')](_0xa05753[_0x0ede('0x47')],_0x114485[_0x0ede('0x43')]),_0x33dcd3);if(_0xa05753[_0x0ede('0x47')]['filter']){_0x39219d[_0x0ede('0x4c')]=_[_0x0ede('0x4e')](_0x39219d[_0x0ede('0x4c')],{'$or':_[_0x0ede('0x40')](_0x33dcd3,function(_0x52b95f){if(_0x52b95f['type']!=='VIRTUAL'){var _0x24d22e={};_0x24d22e[_0x52b95f['name']]={'$like':'%'+_0xa05753[_0x0ede('0x47')]['filter']+'%'};return _0x24d22e;}})});}_0x39219d=_[_0x0ede('0x4e')]({},_0x39219d,_0xa05753[_0x0ede('0x4f')]);var _0xa061d7={'where':_0x39219d['where']};return db['FaxMessage'][_0x0ede('0x2f')](_0xa061d7)[_0x0ede('0x38')](function(_0x500f26){_0x51bcdc['count']=_0x500f26;if(_0xa05753[_0x0ede('0x47')][_0x0ede('0x50')]){_0x39219d[_0x0ede('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x0ede('0x52')](_0x39219d);})[_0x0ede('0x38')](function(_0x4fad1c){_0x51bcdc[_0x0ede('0x53')]=_0x4fad1c;return _0x51bcdc;})['then'](respondWithFilteredResult(_0x48e04f,_0x39219d))[_0x0ede('0x54')](handleError(_0x48e04f,null));};exports['show']=function(_0x4023c2,_0xf8eb9f){var _0x1b07d8={'raw':!![],'where':{'id':_0x4023c2['params']['id']}},_0x372d5a={};_0x372d5a[_0x0ede('0x3f')]=_[_0x0ede('0x42')](db[_0x0ede('0x3a')]['rawAttributes']);_0x372d5a['query']=_[_0x0ede('0x42')](_0x4023c2[_0x0ede('0x47')]);_0x372d5a[_0x0ede('0x43')]=_[_0x0ede('0x44')](_0x372d5a[_0x0ede('0x3f')],_0x372d5a[_0x0ede('0x47')]);_0x1b07d8[_0x0ede('0x45')]=_[_0x0ede('0x44')](_0x372d5a['model'],qs[_0x0ede('0x46')](_0x4023c2['query']['fields']));_0x1b07d8[_0x0ede('0x45')]=_0x1b07d8['attributes'][_0x0ede('0x48')]?_0x1b07d8[_0x0ede('0x45')]:_0x372d5a[_0x0ede('0x3f')];if(_0x4023c2[_0x0ede('0x47')]['includeAll']){_0x1b07d8[_0x0ede('0x51')]=[{'all':!![]}];}_0x1b07d8=_[_0x0ede('0x4e')]({},_0x1b07d8,_0x4023c2['options']);return db[_0x0ede('0x3a')]['find'](_0x1b07d8)['then'](handleEntityNotFound(_0xf8eb9f,null))['then'](respondWithResult(_0xf8eb9f,null))[_0x0ede('0x54')](handleError(_0xf8eb9f,null));};exports['update']=function(_0x1c33f6,_0x14341d){if(_0x1c33f6[_0x0ede('0x55')]['id']){delete _0x1c33f6[_0x0ede('0x55')]['id'];}return db[_0x0ede('0x3a')][_0x0ede('0x56')]({'where':{'id':_0x1c33f6['params']['id']}})[_0x0ede('0x38')](handleEntityNotFound(_0x14341d,null))[_0x0ede('0x38')](saveUpdates(_0x1c33f6[_0x0ede('0x55')],null))[_0x0ede('0x38')](respondWithResult(_0x14341d,null))[_0x0ede('0x54')](handleError(_0x14341d,null));};exports[_0x0ede('0x37')]=function(_0x25b43a,_0x1713d7){return db[_0x0ede('0x3a')][_0x0ede('0x56')]({'where':{'id':_0x25b43a[_0x0ede('0x57')]['id']}})['then'](handleEntityNotFound(_0x1713d7,null))['then'](removeEntity(_0x1713d7,null))['catch'](handleError(_0x1713d7,null));};exports[_0x0ede('0x58')]=function(_0x43f480,_0x54281e){return db[_0x0ede('0x3a')]['describe']()[_0x0ede('0x38')](respondWithResult(_0x54281e,null))['catch'](handleError(_0x54281e,null));};var interaction_log=require(_0x0ede('0x14'))(_0x0ede('0x59'));exports['accept']=function(_0x2865d7,_0x14721,_0x3a160d){var _0x1b6d92={'channel':_0x0ede('0x5a')};if(_0x2865d7[_0x0ede('0x55')]['id']){delete _0x2865d7[_0x0ede('0x55')]['id'];}_0x2865d7[_0x0ede('0x55')][_0x0ede('0x5b')]=!![];_0x2865d7['body'][_0x0ede('0x5c')]=moment()[_0x0ede('0x5d')](_0x0ede('0x5e'));_0x2865d7[_0x0ede('0x55')][_0x0ede('0x5f')]=_0x2865d7[_0x0ede('0x55')][_0x0ede('0x5f')]||_0x2865d7[_0x0ede('0x60')]['id'];return db[_0x0ede('0x3a')][_0x0ede('0x56')]({'where':{'id':_0x2865d7[_0x0ede('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x0ede('0x61')],'as':_0x0ede('0x62')}]})[_0x0ede('0x38')](handleEntityNotFound(_0x14721,null))[_0x0ede('0x38')](saveUpdates(_0x2865d7[_0x0ede('0x55')],null))[_0x0ede('0x38')](function(_0x5f107d){if(_0x5f107d){_0x1b6d92[_0x0ede('0x2c')]=_0x5f107d[_0x0ede('0x63')]({'plain':!![]});return db[_0x0ede('0x64')]['find']({'where':{'id':_0x5f107d[_0x0ede('0x65')]}});}return null;})[_0x0ede('0x38')](handleEntityNotFound(_0x14721,null))[_0x0ede('0x38')](function(_0x223c17){if(_0x223c17){return _0x223c17[_0x0ede('0x36')]({'UserId':_0x2865d7[_0x0ede('0x55')][_0x0ede('0x5f')],'read1stAt':_[_0x0ede('0x66')](_0x223c17['read1stAt'])?moment()['format'](_0x0ede('0x5e')):undefined});}return null;})[_0x0ede('0x38')](function(_0x5fcedc){if(_0x5fcedc){_0x1b6d92[_0x0ede('0x67')]=_0x5fcedc['get']({'plain':!![]});interaction_log[_0x0ede('0x24')](_0x0ede('0x68'),_0x2865d7[_0x0ede('0x60')]['id'],_0x2865d7[_0x0ede('0x60')][_0x0ede('0x41')],_0x2865d7[_0x0ede('0x60')][_0x0ede('0x69')],_0x1b6d92['interaction']['id'],_0x2865d7[_0x0ede('0x55')]?JSON[_0x0ede('0x29')](_0x2865d7['body']):_0x0ede('0x6a'));return respondWithRpcPromise(_0x0ede('0x6b'),_0x0ede('0x6c'),_0x1b6d92);}return null;})[_0x0ede('0x38')](function(_0x511cb1){if(_0x511cb1){if(_0x2865d7[_0x0ede('0x55')][_0x0ede('0x6d')]){_0x1b6d92['message'][_0x0ede('0x6e')]=util['format'](_0x0ede('0x6f'),_0x2865d7[_0x0ede('0x60')][_0x0ede('0x41')]);_0x1b6d92[_0x0ede('0x2c')][_0x0ede('0x70')]=_0x1b6d92['channel'];_0x1b6d92[_0x0ede('0x2c')][_0x0ede('0x71')]=_0x0ede('0x72');return respondWithRpcPromise('EventManager',_0x0ede('0x73'),{'event':_0x0ede('0x74'),'message':_0x1b6d92[_0x0ede('0x2c')]},client9002)[_0x0ede('0x38')](function(){return _0x1b6d92;});}return _0x1b6d92;}return null;})[_0x0ede('0x38')](respondWithResult(_0x14721,null))['catch'](handleError(_0x14721,null));};var interaction_log=require('../../config/logger')(_0x0ede('0x59'));exports['reject']=function(_0x4f7fc3,_0x5179aa,_0x4db314){var _0x3a5018={'agent':{},'channel':'fax'};if(_0x4f7fc3[_0x0ede('0x55')]['id']){delete _0x4f7fc3['body']['id'];}_0x4f7fc3[_0x0ede('0x55')]['UserId']=_0x4f7fc3[_0x0ede('0x55')][_0x0ede('0x5f')]||_0x4f7fc3[_0x0ede('0x60')]['id'];_0x3a5018[_0x0ede('0x75')]['id']=_0x4f7fc3['body']['UserId'];return db[_0x0ede('0x3a')][_0x0ede('0x56')]({'where':{'id':_0x4f7fc3[_0x0ede('0x57')]['id'],'UserId':null}})[_0x0ede('0x38')](handleEntityNotFound(_0x5179aa,null))['then'](function(_0x4b5b63){if(_0x4b5b63){_0x3a5018[_0x0ede('0x2c')]=_0x4b5b63[_0x0ede('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x0ede('0x56')]({'where':{'id':_0x4b5b63[_0x0ede('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5179aa,null))[_0x0ede('0x38')](function(_0x12359f){if(_0x12359f){_0x3a5018[_0x0ede('0x67')]=_0x12359f['get']({'plain':!![]});interaction_log[_0x0ede('0x24')](_0x0ede('0x76'),_0x4f7fc3[_0x0ede('0x60')]['id'],_0x4f7fc3['user'][_0x0ede('0x41')],_0x4f7fc3[_0x0ede('0x60')]['role'],_0x3a5018[_0x0ede('0x67')]['id'],_0x4f7fc3[_0x0ede('0x55')]?JSON[_0x0ede('0x29')](_0x4f7fc3[_0x0ede('0x55')]):'null');return respondWithRpcPromise(_0x0ede('0x77'),_0x0ede('0x78'),_0x3a5018);}return null;})[_0x0ede('0x38')](function(_0x294815){if(_0x294815){_0x294815[_0x0ede('0x2c')][_0x0ede('0x6e')]=util[_0x0ede('0x5d')](_0x0ede('0x6f'),_0x4f7fc3[_0x0ede('0x60')][_0x0ede('0x41')]);_0x294815[_0x0ede('0x2c')][_0x0ede('0x70')]=_0x3a5018[_0x0ede('0x70')];_0x294815[_0x0ede('0x2c')][_0x0ede('0x71')]=_0x0ede('0x34');respondWithRpcPromise('EventManager',_0x0ede('0x73'),{'event':_0x0ede('0x79'),'message':_0x294815[_0x0ede('0x2c')]},client9002);return _0x3a5018;}return null;})[_0x0ede('0x38')](respondWithResult(_0x5179aa,null))['catch'](handleError(_0x5179aa,null));};exports[_0x0ede('0x7a')]=function(_0x1d57c9,_0x1eee5e){var _0x5266c6;return db[_0x0ede('0x3a')][_0x0ede('0x7a')](_0x1d57c9['body'],{})[_0x0ede('0x38')](function(_0x26eef0){_0x5266c6=_0x26eef0;return db['CmContact'][_0x0ede('0x7b')]({'where':{'id':_0x5266c6[_0x0ede('0x7c')]}});})[_0x0ede('0x38')](function(_0x18c5a9){if(_[_0x0ede('0x66')](_0x18c5a9)){return;}else{_0x5266c6[_0x0ede('0x5a')]=_0x18c5a9[_0x0ede('0x5a')];return db[_0x0ede('0x7d')]['findOne']({'where':{'id':_0x5266c6['AttachmentId']}});}})[_0x0ede('0x38')](function(_0x27009a){return respondWithRpcPromise(_0x0ede('0x7e'),_0x0ede('0x7e'),{'FaxAccountId':_[_0x0ede('0x66')](_0x1d57c9[_0x0ede('0x55')])?undefined:_0x1d57c9['body'][_0x0ede('0x7f')],'path':_[_0x0ede('0x66')](_0x27009a)?undefined:util[_0x0ede('0x5d')](_0x0ede('0x80'),_0x27009a['basename']),'fax':_[_0x0ede('0x66')](_0x5266c6[_0x0ede('0x5a')])?undefined:_0x5266c6[_0x0ede('0x5a')],'AttachmentId':_0x5266c6['AttachmentId']},client9002);})['then'](respondWithResult(_0x1eee5e,0xc9))['catch'](handleError(_0x1eee5e,null));};exports[_0x0ede('0x81')]=function(_0x255bd5,_0x408402){var _0x3cb495=path[_0x0ede('0x82')](config[_0x0ede('0x83')],_0x0ede('0x84'),_0x0ede('0x85'),_0x0ede('0x86'));return db['FaxMessage'][_0x0ede('0x56')]({'where':{'id':_0x255bd5[_0x0ede('0x57')]['id']},'include':[{'model':db[_0x0ede('0x7d')],'as':_0x0ede('0x7d')}]})[_0x0ede('0x38')](handleEntityNotFound(_0x408402,null))[_0x0ede('0x38')](function(_0x4a5c56){if(_0x4a5c56){return _0x408402['download'](path['join'](_0x3cb495,_0x4a5c56[_0x0ede('0x7d')][_0x0ede('0x87')]));}})[_0x0ede('0x54')](handleError(_0x408402,null));}; \ No newline at end of file +var _0xc854=['keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','VIRTUAL','merge','options','FaxMessage','include','findAll','rows','show','params','includeAll','find','body','describe','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interface','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','Attachment','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.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','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','name','send','map','rawAttributes','type','key','model','query'];(function(_0x3b6c46,_0x1a9710){var _0x4178a4=function(_0x21ad33){while(--_0x21ad33){_0x3b6c46['push'](_0x3b6c46['shift']());}};_0x4178a4(++_0x1a9710);}(_0xc854,0x1d0));var _0x4c85=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0xc854[_0x4b3300];return _0x2d26d3;};'use strict';var pdf=require(_0x4c85('0x0'));var emlformat=require(_0x4c85('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c85('0x2'));var jsonpatch=require(_0x4c85('0x3'));var rp=require('request-promise');var moment=require(_0x4c85('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c85('0x5'));var util=require(_0x4c85('0x6'));var path=require(_0x4c85('0x7'));var sox=require(_0x4c85('0x8'));var csv=require(_0x4c85('0x9'));var ejs=require(_0x4c85('0xa'));var fs=require('fs');var _=require(_0x4c85('0xb'));var squel=require(_0x4c85('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c85('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4c85('0xe'));var Papa=require(_0x4c85('0xf'));var Redis=require(_0x4c85('0x10'));var authService=require(_0x4c85('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c85('0x12'));var logger=require(_0x4c85('0x13'))('api');var utils=require(_0x4c85('0x14'));var config=require(_0x4c85('0x15'));var db=require('../../mysqldb')['db'];config[_0x4c85('0x16')]=_[_0x4c85('0x17')](config[_0x4c85('0x16')],{'host':_0x4c85('0x18'),'port':0x18eb});var socket=require(_0x4c85('0x19'))(new Redis(config[_0x4c85('0x16')]));require(_0x4c85('0x1a'))[_0x4c85('0x1b')](socket);var jayson=require(_0x4c85('0x1c'));var client=jayson[_0x4c85('0x1d')][_0x4c85('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4c85('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x345285,_0x8df312,_0x5c5c19){if(_0x5c5c19){var _0x55f927=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55f927[_0x4c85('0x1f')](_0x8df312)){return _0x345285;}else{throw new db[(_0x4c85('0x20'))][(_0x4c85('0x21'))](_0x4c85('0x22'));}}else{return _0x345285;}}function respondWithRpcPromise(_0x2264d7,_0x27dfde,_0x23fffe,_0x50fd56){return new BPromise(function(_0x4dbcf5,_0x3b8564){var _0x5df433=_0x50fd56||client;return _0x5df433[_0x4c85('0x23')](_0x2264d7,_0x23fffe)[_0x4c85('0x24')](function(_0x269d27){logger[_0x4c85('0x25')](_0x4c85('0x26'),_0x27dfde,_0x4c85('0x27'));logger[_0x4c85('0x28')](_0x4c85('0x29'),_0x27dfde,_0x4c85('0x27'),JSON[_0x4c85('0x2a')](_0x269d27));if(_0x269d27['error']){if(_0x269d27['error']['code']===0x1f4){logger[_0x4c85('0x2b')](_0x4c85('0x26'),_0x27dfde,_0x269d27[_0x4c85('0x2b')][_0x4c85('0x2c')]);return _0x3b8564(_0x269d27[_0x4c85('0x2b')][_0x4c85('0x2c')]);}logger[_0x4c85('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x27dfde,_0x269d27[_0x4c85('0x2b')]['message']);return _0x4dbcf5(_0x269d27[_0x4c85('0x2b')][_0x4c85('0x2c')]);}else{logger['info'](_0x4c85('0x26'),_0x27dfde,_0x4c85('0x27'));_0x4dbcf5(_0x269d27[_0x4c85('0x2d')][_0x4c85('0x2c')]);}})[_0x4c85('0x2e')](function(_0x114466){logger[_0x4c85('0x2b')](_0x4c85('0x26'),_0x27dfde,_0x114466);_0x3b8564(_0x114466);});});}function respondWithStatusCode(_0x28b71c,_0x969a3d){_0x969a3d=_0x969a3d||0xcc;return function(_0xdbb181){if(_0xdbb181){return _0x28b71c[_0x4c85('0x2f')](_0x969a3d);}return _0x28b71c[_0x4c85('0x30')](_0x969a3d)[_0x4c85('0x31')]();};}function respondWithResult(_0x3a6e00,_0x12c398){_0x12c398=_0x12c398||0xc8;return function(_0x1f8233){if(_0x1f8233){return _0x3a6e00[_0x4c85('0x30')](_0x12c398)[_0x4c85('0x32')](_0x1f8233);}};}function respondWithFilteredResult(_0x5f47e0,_0x27ad6c){return function(_0x372b58){if(_0x372b58){var _0x4576ce=_0x372b58[_0x4c85('0x33')],_0x5a8dc6=_0x27ad6c[_0x4c85('0x34')],_0x389342=_0x27ad6c[_0x4c85('0x34')]+_0x27ad6c[_0x4c85('0x35')],_0x2e6ecd;if(_0x389342>=_0x4576ce){_0x389342=_0x4576ce;_0x2e6ecd=0xc8;}else{_0x2e6ecd=0xce;}_0x5f47e0[_0x4c85('0x30')](_0x2e6ecd);return _0x5f47e0[_0x4c85('0x36')](_0x4c85('0x37'),_0x5a8dc6+'-'+_0x389342+'/'+_0x4576ce)[_0x4c85('0x32')](_0x372b58);}return null;};}function patchUpdates(_0xbdb171){return function(_0x50f2e5){try{jsonpatch[_0x4c85('0x38')](_0x50f2e5,_0xbdb171,!![]);}catch(_0x32db4b){return BPromise['reject'](_0x32db4b);}return _0x50f2e5[_0x4c85('0x39')]();};}function saveUpdates(_0x1d194f,_0x5901f0){return function(_0x292bd8){if(_0x292bd8){return _0x292bd8[_0x4c85('0x3a')](_0x1d194f)['then'](function(_0x33bf67){return _0x33bf67;});}return null;};}function removeEntity(_0x4e1b93,_0x3106f2){return function(_0x3e7689){if(_0x3e7689){return _0x3e7689[_0x4c85('0x3b')]()['then'](function(){_0x4e1b93[_0x4c85('0x30')](0xcc)[_0x4c85('0x31')]();});}};}function handleEntityNotFound(_0x36c377,_0x49cdf6){return function(_0x4160e6){if(!_0x4160e6){_0x36c377[_0x4c85('0x2f')](0x194);}return _0x4160e6;};}function handleError(_0x4f000a,_0x5c8f61){_0x5c8f61=_0x5c8f61||0x1f4;return function(_0x10e1ba){logger[_0x4c85('0x2b')](_0x10e1ba['stack']);if(_0x10e1ba[_0x4c85('0x3c')]){delete _0x10e1ba[_0x4c85('0x3c')];}_0x4f000a[_0x4c85('0x30')](_0x5c8f61)[_0x4c85('0x3d')](_0x10e1ba);};}exports['index']=function(_0x107278,_0x1573f7){var _0xd0031b={},_0x3e9559={},_0x25d44f={'count':0x0,'rows':[]};var _0x366942=_[_0x4c85('0x3e')](db['FaxMessage'][_0x4c85('0x3f')],function(_0x3654dc){return{'name':_0x3654dc['fieldName'],'type':_0x3654dc[_0x4c85('0x40')][_0x4c85('0x41')]};});_0x3e9559[_0x4c85('0x42')]=_['map'](_0x366942,_0x4c85('0x3c'));_0x3e9559[_0x4c85('0x43')]=_[_0x4c85('0x44')](_0x107278[_0x4c85('0x43')]);_0x3e9559[_0x4c85('0x45')]=_[_0x4c85('0x46')](_0x3e9559[_0x4c85('0x42')],_0x3e9559['query']);_0xd0031b[_0x4c85('0x47')]=_[_0x4c85('0x46')](_0x3e9559[_0x4c85('0x42')],qs[_0x4c85('0x48')](_0x107278[_0x4c85('0x43')][_0x4c85('0x48')]));_0xd0031b[_0x4c85('0x47')]=_0xd0031b[_0x4c85('0x47')][_0x4c85('0x49')]?_0xd0031b[_0x4c85('0x47')]:_0x3e9559[_0x4c85('0x42')];if(!_0x107278[_0x4c85('0x43')]['hasOwnProperty'](_0x4c85('0x4a'))){_0xd0031b[_0x4c85('0x35')]=qs['limit'](_0x107278[_0x4c85('0x43')][_0x4c85('0x35')]);_0xd0031b[_0x4c85('0x34')]=qs[_0x4c85('0x34')](_0x107278[_0x4c85('0x43')][_0x4c85('0x34')]);}_0xd0031b['order']=qs['sort'](_0x107278[_0x4c85('0x43')]['sort']);_0xd0031b[_0x4c85('0x4b')]=qs[_0x4c85('0x45')](_[_0x4c85('0x4c')](_0x107278[_0x4c85('0x43')],_0x3e9559['filters']),_0x366942);if(_0x107278[_0x4c85('0x43')][_0x4c85('0x4d')]){_0xd0031b[_0x4c85('0x4b')]=_['merge'](_0xd0031b[_0x4c85('0x4b')],{'$or':_[_0x4c85('0x3e')](_0x366942,function(_0x291324){if(_0x291324[_0x4c85('0x40')]!==_0x4c85('0x4e')){var _0x5d71ea={};_0x5d71ea[_0x291324['name']]={'$like':'%'+_0x107278['query'][_0x4c85('0x4d')]+'%'};return _0x5d71ea;}})});}_0xd0031b=_[_0x4c85('0x4f')]({},_0xd0031b,_0x107278[_0x4c85('0x50')]);var _0x3daf9e={'where':_0xd0031b['where']};return db[_0x4c85('0x51')][_0x4c85('0x33')](_0x3daf9e)['then'](function(_0x5a9b2f){_0x25d44f[_0x4c85('0x33')]=_0x5a9b2f;if(_0x107278['query']['includeAll']){_0xd0031b[_0x4c85('0x52')]=[{'all':!![]}];}return db[_0x4c85('0x51')][_0x4c85('0x53')](_0xd0031b);})[_0x4c85('0x24')](function(_0x4fb93f){_0x25d44f[_0x4c85('0x54')]=_0x4fb93f;return _0x25d44f;})[_0x4c85('0x24')](respondWithFilteredResult(_0x1573f7,_0xd0031b))['catch'](handleError(_0x1573f7,null));};exports[_0x4c85('0x55')]=function(_0x219666,_0x785c10){var _0x5f0154={'raw':!![],'where':{'id':_0x219666[_0x4c85('0x56')]['id']}},_0x26dfab={};_0x26dfab['model']=_[_0x4c85('0x44')](db[_0x4c85('0x51')][_0x4c85('0x3f')]);_0x26dfab[_0x4c85('0x43')]=_['keys'](_0x219666['query']);_0x26dfab[_0x4c85('0x45')]=_['intersection'](_0x26dfab['model'],_0x26dfab['query']);_0x5f0154[_0x4c85('0x47')]=_['intersection'](_0x26dfab[_0x4c85('0x42')],qs[_0x4c85('0x48')](_0x219666['query'][_0x4c85('0x48')]));_0x5f0154[_0x4c85('0x47')]=_0x5f0154['attributes'][_0x4c85('0x49')]?_0x5f0154[_0x4c85('0x47')]:_0x26dfab[_0x4c85('0x42')];if(_0x219666[_0x4c85('0x43')][_0x4c85('0x57')]){_0x5f0154[_0x4c85('0x52')]=[{'all':!![]}];}_0x5f0154=_[_0x4c85('0x4f')]({},_0x5f0154,_0x219666['options']);return db['FaxMessage'][_0x4c85('0x58')](_0x5f0154)[_0x4c85('0x24')](handleEntityNotFound(_0x785c10,null))[_0x4c85('0x24')](respondWithResult(_0x785c10,null))[_0x4c85('0x2e')](handleError(_0x785c10,null));};exports[_0x4c85('0x3a')]=function(_0x4b82ad,_0x387e38){if(_0x4b82ad[_0x4c85('0x59')]['id']){delete _0x4b82ad[_0x4c85('0x59')]['id'];}return db[_0x4c85('0x51')]['find']({'where':{'id':_0x4b82ad['params']['id']}})['then'](handleEntityNotFound(_0x387e38,null))[_0x4c85('0x24')](saveUpdates(_0x4b82ad[_0x4c85('0x59')],null))[_0x4c85('0x24')](respondWithResult(_0x387e38,null))[_0x4c85('0x2e')](handleError(_0x387e38,null));};exports[_0x4c85('0x3b')]=function(_0x372226,_0xb9397b){return db['FaxMessage'][_0x4c85('0x58')]({'where':{'id':_0x372226['params']['id']}})[_0x4c85('0x24')](handleEntityNotFound(_0xb9397b,null))['then'](removeEntity(_0xb9397b,null))[_0x4c85('0x2e')](handleError(_0xb9397b,null));};exports[_0x4c85('0x5a')]=function(_0x408985,_0x532224){return db['FaxMessage']['describe']()[_0x4c85('0x24')](respondWithResult(_0x532224,null))[_0x4c85('0x2e')](handleError(_0x532224,null));};var interaction_log=require(_0x4c85('0x13'))('fax-interactions');exports['accept']=function(_0x20ac93,_0x4f3b15,_0x2a9a6f){var _0x23a2a8={'channel':_0x4c85('0x5b')};if(_0x20ac93[_0x4c85('0x59')]['id']){delete _0x20ac93['body']['id'];}_0x20ac93[_0x4c85('0x59')][_0x4c85('0x5c')]=!![];_0x20ac93[_0x4c85('0x59')][_0x4c85('0x5d')]=moment()[_0x4c85('0x5e')](_0x4c85('0x5f'));_0x20ac93[_0x4c85('0x59')]['UserId']=_0x20ac93[_0x4c85('0x59')][_0x4c85('0x60')]||_0x20ac93[_0x4c85('0x61')]['id'];return db['FaxMessage'][_0x4c85('0x58')]({'where':{'id':_0x20ac93[_0x4c85('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x4c85('0x62')],'as':'Contact'}]})[_0x4c85('0x24')](handleEntityNotFound(_0x4f3b15,null))[_0x4c85('0x24')](saveUpdates(_0x20ac93[_0x4c85('0x59')],null))[_0x4c85('0x24')](function(_0x3b2e70){if(_0x3b2e70){_0x23a2a8[_0x4c85('0x2c')]=_0x3b2e70['get']({'plain':!![]});return db[_0x4c85('0x63')][_0x4c85('0x58')]({'where':{'id':_0x3b2e70[_0x4c85('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4f3b15,null))[_0x4c85('0x24')](function(_0x5ebda9){if(_0x5ebda9){return _0x5ebda9['update']({'UserId':_0x20ac93[_0x4c85('0x59')]['UserId'],'read1stAt':_[_0x4c85('0x65')](_0x5ebda9[_0x4c85('0x66')])?moment()[_0x4c85('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4c85('0x24')](function(_0x41e709){if(_0x41e709){_0x23a2a8[_0x4c85('0x67')]=_0x41e709[_0x4c85('0x68')]({'plain':!![]});interaction_log[_0x4c85('0x25')](_0x4c85('0x69'),_0x20ac93[_0x4c85('0x61')]['id'],_0x20ac93[_0x4c85('0x61')][_0x4c85('0x3c')],_0x20ac93[_0x4c85('0x61')][_0x4c85('0x6a')],_0x23a2a8[_0x4c85('0x67')]['id'],_0x20ac93['body']?JSON[_0x4c85('0x2a')](_0x20ac93[_0x4c85('0x59')]):_0x4c85('0x6b'));return respondWithRpcPromise(_0x4c85('0x6c'),'acceptMessage',_0x23a2a8);}return null;})['then'](function(_0x2b5d61){if(_0x2b5d61){if(_0x20ac93[_0x4c85('0x59')]['manual']){_0x23a2a8[_0x4c85('0x2c')]['interface']=util[_0x4c85('0x5e')](_0x4c85('0x6d'),_0x20ac93[_0x4c85('0x61')][_0x4c85('0x3c')]);_0x23a2a8['message'][_0x4c85('0x6e')]=_0x23a2a8[_0x4c85('0x6e')];_0x23a2a8[_0x4c85('0x2c')][_0x4c85('0x6f')]='accept';return respondWithRpcPromise(_0x4c85('0x70'),_0x4c85('0x70'),{'event':_0x4c85('0x71'),'message':_0x23a2a8[_0x4c85('0x2c')]},client9002)[_0x4c85('0x24')](function(){return _0x23a2a8;});}return _0x23a2a8;}return null;})['then'](respondWithResult(_0x4f3b15,null))[_0x4c85('0x2e')](handleError(_0x4f3b15,null));};var interaction_log=require(_0x4c85('0x13'))('fax-interactions');exports[_0x4c85('0x72')]=function(_0x32e1d7,_0x22eca7,_0x41a931){var _0x283932={'agent':{},'channel':'fax'};if(_0x32e1d7['body']['id']){delete _0x32e1d7[_0x4c85('0x59')]['id'];}_0x32e1d7[_0x4c85('0x59')][_0x4c85('0x60')]=_0x32e1d7[_0x4c85('0x59')]['UserId']||_0x32e1d7['user']['id'];_0x283932[_0x4c85('0x73')]['id']=_0x32e1d7['body'][_0x4c85('0x60')];return db['FaxMessage'][_0x4c85('0x58')]({'where':{'id':_0x32e1d7[_0x4c85('0x56')]['id'],'UserId':null}})[_0x4c85('0x24')](handleEntityNotFound(_0x22eca7,null))[_0x4c85('0x24')](function(_0x1d3d95){if(_0x1d3d95){_0x283932['message']=_0x1d3d95[_0x4c85('0x68')]({'plain':!![]});return db[_0x4c85('0x63')]['find']({'where':{'id':_0x1d3d95['FaxInteractionId']}});}return null;})[_0x4c85('0x24')](handleEntityNotFound(_0x22eca7,null))['then'](function(_0x129dcb){if(_0x129dcb){_0x283932['interaction']=_0x129dcb[_0x4c85('0x68')]({'plain':!![]});interaction_log[_0x4c85('0x25')](_0x4c85('0x74'),_0x32e1d7[_0x4c85('0x61')]['id'],_0x32e1d7[_0x4c85('0x61')][_0x4c85('0x3c')],_0x32e1d7[_0x4c85('0x61')][_0x4c85('0x6a')],_0x283932[_0x4c85('0x67')]['id'],_0x32e1d7[_0x4c85('0x59')]?JSON[_0x4c85('0x2a')](_0x32e1d7['body']):_0x4c85('0x6b'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x283932);}return null;})[_0x4c85('0x24')](function(_0x17c4fe){if(_0x17c4fe){_0x17c4fe[_0x4c85('0x2c')][_0x4c85('0x75')]=util[_0x4c85('0x5e')]('SIP/%s',_0x32e1d7[_0x4c85('0x61')][_0x4c85('0x3c')]);_0x17c4fe[_0x4c85('0x2c')]['channel']=_0x283932[_0x4c85('0x6e')];_0x17c4fe[_0x4c85('0x2c')]['event']='reject';respondWithRpcPromise(_0x4c85('0x70'),_0x4c85('0x70'),{'event':_0x4c85('0x76'),'message':_0x17c4fe['message']},client9002);return _0x283932;}return null;})['then'](respondWithResult(_0x22eca7,null))[_0x4c85('0x2e')](handleError(_0x22eca7,null));};exports['create']=function(_0xbd38ec,_0x303e66){var _0x1ed008;return db[_0x4c85('0x51')][_0x4c85('0x77')](_0xbd38ec[_0x4c85('0x59')],{})[_0x4c85('0x24')](function(_0x2d21c4){_0x1ed008=_0x2d21c4;return db[_0x4c85('0x62')]['findOne']({'where':{'id':_0x1ed008[_0x4c85('0x78')]}});})[_0x4c85('0x24')](function(_0x1c8509){if(_[_0x4c85('0x65')](_0x1c8509)){return;}else{_0x1ed008['fax']=_0x1c8509[_0x4c85('0x5b')];return db['Attachment'][_0x4c85('0x79')]({'where':{'id':_0x1ed008[_0x4c85('0x7a')]}});}})[_0x4c85('0x24')](function(_0x4685d9){return respondWithRpcPromise('SendFax',_0x4c85('0x7b'),{'FaxAccountId':_[_0x4c85('0x65')](_0xbd38ec['body'])?undefined:_0xbd38ec['body'][_0x4c85('0x7c')],'path':_[_0x4c85('0x65')](_0x4685d9)?undefined:util[_0x4c85('0x5e')](_0x4c85('0x7d'),_0x4685d9[_0x4c85('0x7e')]),'fax':_[_0x4c85('0x65')](_0x1ed008[_0x4c85('0x5b')])?undefined:_0x1ed008['fax'],'AttachmentId':_0x1ed008[_0x4c85('0x7a')]},client9002);})[_0x4c85('0x24')](respondWithResult(_0x303e66,0xc9))['catch'](handleError(_0x303e66,null));};exports[_0x4c85('0x7f')]=function(_0x385f47,_0x207b86){var _0x12216b=path['join'](config[_0x4c85('0x80')],_0x4c85('0x81'),_0x4c85('0x82'),_0x4c85('0x83'));return db['FaxMessage'][_0x4c85('0x58')]({'where':{'id':_0x385f47[_0x4c85('0x56')]['id']},'include':[{'model':db[_0x4c85('0x84')],'as':_0x4c85('0x84')}]})['then'](handleEntityNotFound(_0x207b86,null))[_0x4c85('0x24')](function(_0x25b5a6){if(_0x25b5a6){return _0x207b86[_0x4c85('0x7f')](path['join'](_0x12216b,_0x25b5a6['Attachment']['basename']));}})[_0x4c85('0x2e')](handleError(_0x207b86,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6536c10..f77023d 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(_0xb0336d,_0x106a81){var _0x28e10e=function(_0x13c0a5){while(--_0x13c0a5){_0xb0336d['push'](_0xb0336d['shift']());}};_0x28e10e(++_0x106a81);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x27cd67,_0x38bc73){_0x27cd67=_0x27cd67-0x0;var _0x3bb7ed=_0xe14b[_0x27cd67];return _0x3bb7ed;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a7cccb0..4edc812 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 _0xa3d8=['body','models','direction','toLowerCase','FaxInteraction','FaxInteractionId','update','catch','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x2c801b,_0x7ec62b){var _0x788a6d=function(_0x8ad62){while(--_0x8ad62){_0x2c801b['push'](_0x2c801b['shift']());}};_0x788a6d(++_0x7ec62b);}(_0xa3d8,0x1d7));var _0x8a3d=function(_0x3bba8e,_0x5d6a2f){_0x3bba8e=_0x3bba8e-0x0;var _0x2eb7d0=_0xa3d8[_0x3bba8e];return _0x2eb7d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a3d('0x0'))(_0x8a3d('0x1'));var moment=require(_0x8a3d('0x2'));var BPromise=require(_0x8a3d('0x3'));var rp=require(_0x8a3d('0x4'));var fs=require('fs');var path=require(_0x8a3d('0x5'));var rimraf=require(_0x8a3d('0x6'));var config=require('../../config/environment');var attributes=require(_0x8a3d('0x7'));module[_0x8a3d('0x8')]=function(_0x335561,_0x56f28a){return _0x335561[_0x8a3d('0x9')](_0x8a3d('0xa'),attributes,{'tableName':_0x8a3d('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x8a3d('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19501e,_0x5364b7,_0x590256){var _0x3fae25=_0x335561[_0x8a3d('0xd')];var _0x3c6a8e=_0x19501e['get']({'plain':!![]});if(_0x3c6a8e[_0x8a3d('0xe')][_0x8a3d('0xf')]()==='in'||_0x3c6a8e['direction']['toLowerCase']()==='out'&&!_0x3c6a8e['secret']&&!_['isNil'](_0x3c6a8e['UserId'])){_0x3fae25[_0x8a3d('0x10')]['findOne']({'where':{'id':_0x3c6a8e[_0x8a3d('0x11')]}})['then'](function(_0x19189a){if(_0x19189a){_0x19189a[_0x8a3d('0x12')]({'lastMsgAt':_0x3c6a8e['createdAt'],'lastMsgDirection':_0x3c6a8e['direction']['toLowerCase']()});}})[_0x8a3d('0x13')](function(_0x18cea5){console['error'](_0x18cea5);});}_0x590256();}},'charset':_0x8a3d('0x14'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2359=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./faxMessage.attributes','define'];(function(_0x38d5e5,_0x4d632f){var _0x123942=function(_0x22d7e5){while(--_0x22d7e5){_0x38d5e5['push'](_0x38d5e5['shift']());}};_0x123942(++_0x4d632f);}(_0x2359,0x16f));var _0x9235=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2359[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9235('0x0'));var util=require(_0x9235('0x1'));var logger=require(_0x9235('0x2'))(_0x9235('0x3'));var moment=require(_0x9235('0x4'));var BPromise=require('bluebird');var rp=require(_0x9235('0x5'));var fs=require('fs');var path=require(_0x9235('0x6'));var rimraf=require(_0x9235('0x7'));var config=require('../../config/environment');var attributes=require(_0x9235('0x8'));module['exports']=function(_0x3434e8,_0x545f0c){return _0x3434e8[_0x9235('0x9')](_0x9235('0xa'),attributes,{'tableName':_0x9235('0xb'),'paranoid':![],'indexes':[{'name':_0x9235('0xc'),'fields':[_0x9235('0xd')],'type':_0x9235('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcfdba1,_0x2aba55,_0x4b6462){var _0x161de0=_0x3434e8[_0x9235('0xf')];var _0x700649=_0xcfdba1[_0x9235('0x10')]({'plain':!![]});if(_0x700649[_0x9235('0x11')][_0x9235('0x12')]()==='in'||_0x700649[_0x9235('0x11')]['toLowerCase']()===_0x9235('0x13')&&!_0x700649[_0x9235('0x14')]&&!_[_0x9235('0x15')](_0x700649[_0x9235('0x16')])){_0x161de0[_0x9235('0x17')][_0x9235('0x18')]({'where':{'id':_0x700649[_0x9235('0x19')]}})[_0x9235('0x1a')](function(_0x32313a){if(_0x32313a){_0x32313a['update']({'lastMsgAt':_0x700649['createdAt'],'lastMsgDirection':_0x700649[_0x9235('0x11')][_0x9235('0x12')]()});}})['catch'](function(_0x464269){console['error'](_0x464269);});}_0x4b6462();}},'charset':_0x9235('0x1b'),'collate':_0x9235('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 51c4088..15afbea 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 _0x6a2b=['client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage','create','body','options','raw','then','CreateFaxMessage','debug','UpdateFaxMessage','update','where','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a2b,0x1e2));var _0xb6a2=function(_0x2a40b2,_0x35c0c1){_0x2a40b2=_0x2a40b2-0x0;var _0x6c4056=_0x6a2b[_0x2a40b2];return _0x6c4056;};'use strict';var _=require('lodash');var util=require(_0xb6a2('0x0'));var moment=require(_0xb6a2('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6a2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a2('0x3'))['db'];var utils=require(_0xb6a2('0x4'));var logger=require(_0xb6a2('0x5'))(_0xb6a2('0x6'));var config=require('../../config/environment');var jayson=require(_0xb6a2('0x7'));var client=jayson[_0xb6a2('0x8')][_0xb6a2('0x9')]({'port':0x232a});config[_0xb6a2('0xa')]=_['defaults'](config[_0xb6a2('0xa')],{'host':_0xb6a2('0xb'),'port':0x18eb});var socket=require(_0xb6a2('0xc'))(new Redis(config[_0xb6a2('0xa')]));require(_0xb6a2('0xd'))['register'](socket);function respondWithRpcPromise(_0x3008e7,_0x281af3,_0x2b8cb7){return new BPromise(function(_0x188479,_0x4751d1){return client['request'](_0x3008e7,_0x2b8cb7)['then'](function(_0x4b430c){logger[_0xb6a2('0xe')](_0xb6a2('0xf'),_0x281af3,_0xb6a2('0x10'));logger['debug'](_0xb6a2('0x11'),_0x281af3,'request\x20sent',JSON[_0xb6a2('0x12')](_0x4b430c));if(_0x4b430c[_0xb6a2('0x13')]){if(_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x14')]===0x1f4){logger[_0xb6a2('0x13')]('FaxMessage,\x20%s,\x20%s',_0x281af3,_0x4b430c['error'][_0xb6a2('0x15')]);return _0x4751d1(_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x15')]);}logger[_0xb6a2('0x13')]('FaxMessage,\x20%s,\x20%s',_0x281af3,_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x15')]);return _0x188479(_0x4b430c[_0xb6a2('0x13')]['message']);}else{logger[_0xb6a2('0xe')](_0xb6a2('0xf'),_0x281af3,'request\x20sent');_0x188479(_0x4b430c['result']['message']);}})[_0xb6a2('0x16')](function(_0x4ad5c7){logger[_0xb6a2('0x13')](_0xb6a2('0xf'),_0x281af3,_0x4ad5c7);_0x4751d1(_0x4ad5c7);});});}exports['CreateFaxMessage']=function(_0x2f684a){var _0x29bc34=this;return new Promise(function(_0x4e523c,_0x495316){return db[_0xb6a2('0x17')][_0xb6a2('0x18')](_0x2f684a[_0xb6a2('0x19')],{'raw':_0x2f684a['options']?_0x2f684a[_0xb6a2('0x1a')][_0xb6a2('0x1b')]===undefined?!![]:![]:!![]})[_0xb6a2('0x1c')](function(_0x2eb909){logger[_0xb6a2('0xe')](_0xb6a2('0x1d'),_0x2f684a);logger[_0xb6a2('0x1e')](_0xb6a2('0x1d'),_0x2f684a,JSON[_0xb6a2('0x12')](_0x2eb909));_0x4e523c(_0x2eb909);})[_0xb6a2('0x16')](function(_0x4967bb){logger[_0xb6a2('0x13')](_0xb6a2('0x1d'),_0x4967bb[_0xb6a2('0x15')],_0x2f684a);_0x495316(_0x29bc34[_0xb6a2('0x13')](0x1f4,_0x4967bb[_0xb6a2('0x15')]));});});};exports[_0xb6a2('0x1f')]=function(_0x4b2b66){var _0x386138=this;return new Promise(function(_0x442369,_0x6adfe3){return db['FaxMessage'][_0xb6a2('0x20')](_0x4b2b66['body'],{'raw':_0x4b2b66['options']?_0x4b2b66[_0xb6a2('0x1a')][_0xb6a2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2b66['options']?_0x4b2b66['options'][_0xb6a2('0x21')]||null:null,'attributes':_0x4b2b66['options']?_0x4b2b66[_0xb6a2('0x1a')][_0xb6a2('0x22')]||null:null,'limit':_0x4b2b66[_0xb6a2('0x1a')]?_0x4b2b66[_0xb6a2('0x1a')]['limit']||null:null})[_0xb6a2('0x1c')](function(_0x31eeb8){logger[_0xb6a2('0xe')](_0xb6a2('0x1f'),_0x4b2b66);logger['debug'](_0xb6a2('0x1f'),_0x4b2b66,JSON[_0xb6a2('0x12')](_0x31eeb8));_0x442369(_0x31eeb8);})['catch'](function(_0x3a3f3d){logger[_0xb6a2('0x13')](_0xb6a2('0x1f'),_0x3a3f3d[_0xb6a2('0x15')],_0x4b2b66);_0x6adfe3(_0x386138[_0xb6a2('0x13')](0x1f4,_0x3a3f3d[_0xb6a2('0x15')]));});});}; \ No newline at end of file +var _0x1060=['message','info','catch','CreateFaxMessage','FaxMessage','create','options','debug','UpdateFaxMessage','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x580c79,_0x5dae47){var _0x1f6577=function(_0x2f9395){while(--_0x2f9395){_0x580c79['push'](_0x580c79['shift']());}};_0x1f6577(++_0x5dae47);}(_0x1060,0x147));var _0x0106=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1060[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x0106('0x0'));var util=require(_0x0106('0x1'));var moment=require(_0x0106('0x2'));var BPromise=require(_0x0106('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0106('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0106('0x5'));var logger=require(_0x0106('0x6'))(_0x0106('0x7'));var config=require(_0x0106('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0106('0x9')][_0x0106('0xa')]({'port':0x232a});config[_0x0106('0xb')]=_[_0x0106('0xc')](config[_0x0106('0xb')],{'host':_0x0106('0xd'),'port':0x18eb});var socket=require(_0x0106('0xe'))(new Redis(config[_0x0106('0xb')]));require(_0x0106('0xf'))[_0x0106('0x10')](socket);function respondWithRpcPromise(_0x5096b7,_0x1af388,_0x35b32f){return new BPromise(function(_0x58e927,_0x14ff5c){return client[_0x0106('0x11')](_0x5096b7,_0x35b32f)[_0x0106('0x12')](function(_0xb2c07d){logger['info'](_0x0106('0x13'),_0x1af388,_0x0106('0x14'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1af388,'request\x20sent',JSON[_0x0106('0x15')](_0xb2c07d));if(_0xb2c07d[_0x0106('0x16')]){if(_0xb2c07d[_0x0106('0x16')][_0x0106('0x17')]===0x1f4){logger[_0x0106('0x16')]('FaxMessage,\x20%s,\x20%s',_0x1af388,_0xb2c07d[_0x0106('0x16')][_0x0106('0x18')]);return _0x14ff5c(_0xb2c07d['error'][_0x0106('0x18')]);}logger[_0x0106('0x16')](_0x0106('0x13'),_0x1af388,_0xb2c07d[_0x0106('0x16')][_0x0106('0x18')]);return _0x58e927(_0xb2c07d[_0x0106('0x16')][_0x0106('0x18')]);}else{logger[_0x0106('0x19')]('FaxMessage,\x20%s,\x20%s',_0x1af388,_0x0106('0x14'));_0x58e927(_0xb2c07d['result'][_0x0106('0x18')]);}})[_0x0106('0x1a')](function(_0x28c5e8){logger[_0x0106('0x16')](_0x0106('0x13'),_0x1af388,_0x28c5e8);_0x14ff5c(_0x28c5e8);});});}exports[_0x0106('0x1b')]=function(_0x433c21){var _0x299b50=this;return new Promise(function(_0xca8243,_0x5c680e){return db[_0x0106('0x1c')][_0x0106('0x1d')](_0x433c21['body'],{'raw':_0x433c21[_0x0106('0x1e')]?_0x433c21[_0x0106('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x0106('0x12')](function(_0x305460){logger[_0x0106('0x19')](_0x0106('0x1b'),_0x433c21);logger[_0x0106('0x1f')]('CreateFaxMessage',_0x433c21,JSON[_0x0106('0x15')](_0x305460));_0xca8243(_0x305460);})[_0x0106('0x1a')](function(_0x164b4a){logger[_0x0106('0x16')](_0x0106('0x1b'),_0x164b4a[_0x0106('0x18')],_0x433c21);_0x5c680e(_0x299b50[_0x0106('0x16')](0x1f4,_0x164b4a[_0x0106('0x18')]));});});};exports[_0x0106('0x20')]=function(_0x3dad8f){var _0x512173=this;return new Promise(function(_0x129d81,_0x566c52){return db[_0x0106('0x1c')][_0x0106('0x21')](_0x3dad8f[_0x0106('0x22')],{'raw':_0x3dad8f[_0x0106('0x1e')]?_0x3dad8f['options'][_0x0106('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dad8f[_0x0106('0x1e')]?_0x3dad8f[_0x0106('0x1e')][_0x0106('0x24')]||null:null,'attributes':_0x3dad8f['options']?_0x3dad8f[_0x0106('0x1e')][_0x0106('0x25')]||null:null,'limit':_0x3dad8f[_0x0106('0x1e')]?_0x3dad8f[_0x0106('0x1e')][_0x0106('0x26')]||null:null})[_0x0106('0x12')](function(_0x28d9ff){logger[_0x0106('0x19')]('UpdateFaxMessage',_0x3dad8f);logger['debug'](_0x0106('0x20'),_0x3dad8f,JSON[_0x0106('0x15')](_0x28d9ff));_0x129d81(_0x28d9ff);})[_0x0106('0x1a')](function(_0x27a2b0){logger[_0x0106('0x16')](_0x0106('0x20'),_0x27a2b0[_0x0106('0x18')],_0x3dad8f);_0x566c52(_0x512173[_0x0106('0x16')](0x1f4,_0x27a2b0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a6997cd..092c6c1 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index bcf02d5..99c8941 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 _0xd14a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util'];(function(_0x35db1b,_0x1b17ad){var _0x35e716=function(_0x2a8532){while(--_0x2a8532){_0x35db1b['push'](_0x35db1b['shift']());}};_0x35e716(++_0x1b17ad);}(_0xd14a,0x1be));var _0xad14=function(_0x33ac31,_0x569436){_0x33ac31=_0x33ac31-0x0;var _0x456324=_0xd14a[_0x33ac31];return _0x456324;};'use strict';var multer=require(_0xad14('0x0'));var util=require(_0xad14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad14('0x2'));var router=express[_0xad14('0x3')]();var auth=require(_0xad14('0x4'));var interaction=require(_0xad14('0x5'));var config=require(_0xad14('0x6'));var controller=require(_0xad14('0x7'));router[_0xad14('0x8')]('/',auth[_0xad14('0x9')](),controller[_0xad14('0xa')]);router['get'](_0xad14('0xb'),auth[_0xad14('0x9')](),controller[_0xad14('0xc')]);router[_0xad14('0x8')](_0xad14('0xd'),auth[_0xad14('0x9')](),controller[_0xad14('0xe')]);router[_0xad14('0x8')](_0xad14('0xf'),auth[_0xad14('0x9')](),controller[_0xad14('0x10')]);router[_0xad14('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xad14('0x12'),_0xad14('0x13')),controller[_0xad14('0x14')]);router[_0xad14('0x15')](_0xad14('0xd'),auth[_0xad14('0x9')](),controller[_0xad14('0x16')]);router['put'](_0xad14('0x17'),auth[_0xad14('0x9')](),controller['accept']);router[_0xad14('0x15')](_0xad14('0x18'),auth[_0xad14('0x9')](),controller[_0xad14('0x19')]);router['delete'](_0xad14('0xd'),auth[_0xad14('0x9')](),controller[_0xad14('0x1a')]);module[_0xad14('0x1b')]=router; \ No newline at end of file +var _0x1c83=['../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','Router','../../components/interaction/service'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x1c83,0x16c));var _0x31c8=function(_0x8ca117,_0x3c73a7){_0x8ca117=_0x8ca117-0x0;var _0x16e12b=_0x1c83[_0x8ca117];return _0x16e12b;};'use strict';var multer=require('multer');var util=require(_0x31c8('0x0'));var path=require(_0x31c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31c8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x31c8('0x3'));var config=require(_0x31c8('0x4'));var controller=require(_0x31c8('0x5'));router[_0x31c8('0x6')]('/',auth[_0x31c8('0x7')](),controller[_0x31c8('0x8')]);router[_0x31c8('0x6')](_0x31c8('0x9'),auth[_0x31c8('0x7')](),controller[_0x31c8('0xa')]);router[_0x31c8('0x6')](_0x31c8('0xb'),auth[_0x31c8('0x7')](),controller[_0x31c8('0xc')]);router[_0x31c8('0x6')](_0x31c8('0xd'),auth['isAuthenticated'](),controller[_0x31c8('0xe')]);router['post']('/',auth[_0x31c8('0x7')](),interaction['tracked']('fax','faxmessage:create'),controller['create']);router['put']('/:id',auth[_0x31c8('0x7')](),controller[_0x31c8('0xf')]);router[_0x31c8('0x10')](_0x31c8('0x11'),auth[_0x31c8('0x7')](),controller[_0x31c8('0x12')]);router['put'](_0x31c8('0x13'),auth[_0x31c8('0x7')](),controller[_0x31c8('0x14')]);router[_0x31c8('0x15')](_0x31c8('0xb'),auth['isAuthenticated'](),controller[_0x31c8('0x16')]);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 1690dd9..12076a8 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 _0x2afc=['rrmemory','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x21d532,_0x4552a4){var _0x37bda1=function(_0x134a6f){while(--_0x134a6f){_0x21d532['push'](_0x21d532['shift']());}};_0x37bda1(++_0x4552a4);}(_0x2afc,0x87));var _0xc2af=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x2afc[_0x474d97];return _0x1edf25;};'use strict';var Sequelize=require(_0xc2af('0x0'));module[_0xc2af('0x1')]={'name':{'type':Sequelize[_0xc2af('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc2af('0x2')]},'timeout':{'type':Sequelize[_0xc2af('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc2af('0x4')](_0xc2af('0x5'),'beepall',_0xc2af('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc2af('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd9f5=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x984aee,_0x1bebe4){var _0x137d1c=function(_0xde29da){while(--_0xde29da){_0x984aee['push'](_0x984aee['shift']());}};_0x137d1c(++_0x1bebe4);}(_0xd9f5,0x92));var _0x5d9f=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xd9f5[_0x3ee55a];return _0x581800;};'use strict';var Sequelize=require(_0x5d9f('0x0'));module[_0x5d9f('0x1')]={'name':{'type':Sequelize[_0x5d9f('0x2')],'unique':_0x5d9f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d9f('0x2')]},'timeout':{'type':Sequelize[_0x5d9f('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5d9f('0x5'),_0x5d9f('0x6'),_0x5d9f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5d9f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 5f0e190..452d574 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 _0xcae2=['Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','offset','sort','where','filters','merge','VIRTUAL','filter','options','rows','catch','show','rawAttributes','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','UserFaxQueue','order','pick','FaxQueueId','findAll','User','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','hasOwnProperty','addTeams','ids'];(function(_0x4d274d,_0x398bb1){var _0x33aae2=function(_0xc7a69d){while(--_0xc7a69d){_0x4d274d['push'](_0x4d274d['shift']());}};_0x33aae2(++_0x398bb1);}(_0xcae2,0x143));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x2cae('0x0'));var emlformat=require(_0x2cae('0x1'));var rimraf=require(_0x2cae('0x2'));var zipdir=require(_0x2cae('0x3'));var jsonpatch=require(_0x2cae('0x4'));var rp=require(_0x2cae('0x5'));var moment=require(_0x2cae('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2cae('0x7'));var util=require(_0x2cae('0x8'));var path=require(_0x2cae('0x9'));var sox=require(_0x2cae('0xa'));var csv=require('to-csv');var ejs=require(_0x2cae('0xb'));var fs=require('fs');var _=require(_0x2cae('0xc'));var squel=require(_0x2cae('0xd'));var crypto=require(_0x2cae('0xe'));var jsforce=require(_0x2cae('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cae('0x10'));var authService=require(_0x2cae('0x11'));var qs=require(_0x2cae('0x12'));var as=require(_0x2cae('0x13'));var hardwareService=require(_0x2cae('0x14'));var logger=require(_0x2cae('0x15'))('api');var utils=require(_0x2cae('0x16'));var config=require('../../config/environment');var db=require(_0x2cae('0x17'))['db'];config[_0x2cae('0x18')]=_[_0x2cae('0x19')](config[_0x2cae('0x18')],{'host':_0x2cae('0x1a'),'port':0x18eb});var socket=require(_0x2cae('0x1b'))(new Redis(config['redis']));require(_0x2cae('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f393,_0x13c76f){_0x13c76f=_0x13c76f||0xcc;return function(_0x51d416){if(_0x51d416){return _0x42f393[_0x2cae('0x1d')](_0x13c76f);}return _0x42f393[_0x2cae('0x1e')](_0x13c76f)[_0x2cae('0x1f')]();};}function respondWithResult(_0x7e2228,_0x5ede26){_0x5ede26=_0x5ede26||0xc8;return function(_0x3fda2f){if(_0x3fda2f){return _0x7e2228[_0x2cae('0x1e')](_0x5ede26)['json'](_0x3fda2f);}};}function respondWithFilteredResult(_0x5a6184,_0x235286){return function(_0x1788a3){if(_0x1788a3){var _0xe6314f=_0x1788a3[_0x2cae('0x20')],_0x2813b1=_0x235286['offset'],_0x164aee=_0x235286['offset']+_0x235286[_0x2cae('0x21')],_0x398290;if(_0x164aee>=_0xe6314f){_0x164aee=_0xe6314f;_0x398290=0xc8;}else{_0x398290=0xce;}_0x5a6184[_0x2cae('0x1e')](_0x398290);return _0x5a6184[_0x2cae('0x22')](_0x2cae('0x23'),_0x2813b1+'-'+_0x164aee+'/'+_0xe6314f)[_0x2cae('0x24')](_0x1788a3);}return null;};}function patchUpdates(_0x420159){return function(_0x40872e){try{jsonpatch['apply'](_0x40872e,_0x420159,!![]);}catch(_0x4bc93c){return BPromise[_0x2cae('0x25')](_0x4bc93c);}return _0x40872e[_0x2cae('0x26')]();};}function saveUpdates(_0x5d800e,_0x4b2f85){return function(_0x48f0f5){if(_0x48f0f5){return _0x48f0f5[_0x2cae('0x27')](_0x5d800e)[_0x2cae('0x28')](function(_0x4ced40){return _0x4ced40;});}return null;};}function removeEntity(_0x555914,_0x309ae3){return function(_0x1c8063){if(_0x1c8063){return _0x1c8063[_0x2cae('0x29')]()[_0x2cae('0x28')](function(){var _0x4049d5=_0x1c8063[_0x2cae('0x2a')]({'plain':!![]});var _0x11413f=_0x2cae('0x2b');return db[_0x2cae('0x2c')][_0x2cae('0x29')]({'where':{'type':_0x11413f,'resourceId':_0x4049d5['id']}})[_0x2cae('0x28')](function(){return _0x1c8063;});})[_0x2cae('0x28')](function(){_0x555914[_0x2cae('0x1e')](0xcc)[_0x2cae('0x1f')]();});}};}function handleEntityNotFound(_0x3422bb,_0x2d8e66){return function(_0x564892){if(!_0x564892){_0x3422bb['sendStatus'](0x194);}return _0x564892;};}function handleError(_0x56bedb,_0x5afca5){_0x5afca5=_0x5afca5||0x1f4;return function(_0x7d5421){logger[_0x2cae('0x2d')](_0x7d5421[_0x2cae('0x2e')]);if(_0x7d5421[_0x2cae('0x2f')]){delete _0x7d5421['name'];}_0x56bedb[_0x2cae('0x1e')](_0x5afca5)[_0x2cae('0x30')](_0x7d5421);};}exports[_0x2cae('0x31')]=function(_0x5d1fc8,_0x2db662){var _0x5cdbac={},_0x3dfde5={},_0x594c4f={'count':0x0,'rows':[]};var _0x47a256=_[_0x2cae('0x32')](db[_0x2cae('0x33')]['rawAttributes'],function(_0x335345){return{'name':_0x335345[_0x2cae('0x34')],'type':_0x335345[_0x2cae('0x35')][_0x2cae('0x36')]};});_0x3dfde5[_0x2cae('0x37')]=_[_0x2cae('0x32')](_0x47a256,'name');_0x3dfde5['query']=_[_0x2cae('0x38')](_0x5d1fc8[_0x2cae('0x39')]);_0x3dfde5['filters']=_['intersection'](_0x3dfde5['model'],_0x3dfde5[_0x2cae('0x39')]);_0x5cdbac[_0x2cae('0x3a')]=_['intersection'](_0x3dfde5['model'],qs['fields'](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x5cdbac[_0x2cae('0x3a')]=_0x5cdbac[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x5cdbac['attributes']:_0x3dfde5[_0x2cae('0x37')];if(!_0x5d1fc8[_0x2cae('0x39')]['hasOwnProperty'](_0x2cae('0x3d'))){_0x5cdbac[_0x2cae('0x21')]=qs[_0x2cae('0x21')](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x21')]);_0x5cdbac[_0x2cae('0x3e')]=qs['offset'](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3e')]);}_0x5cdbac['order']=qs[_0x2cae('0x3f')](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x5cdbac[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_['pick'](_0x5d1fc8['query'],_0x3dfde5[_0x2cae('0x41')]),_0x47a256);if(_0x5d1fc8[_0x2cae('0x39')]['filter']){_0x5cdbac[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x5cdbac[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x47a256,function(_0x436ce5){if(_0x436ce5[_0x2cae('0x35')]!==_0x2cae('0x43')){var _0x504b47={};_0x504b47[_0x436ce5[_0x2cae('0x2f')]]={'$like':'%'+_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x504b47;}})});}_0x5cdbac=_[_0x2cae('0x42')]({},_0x5cdbac,_0x5d1fc8[_0x2cae('0x45')]);var _0x4c05ed={'where':_0x5cdbac['where']};return db[_0x2cae('0x33')][_0x2cae('0x20')](_0x4c05ed)[_0x2cae('0x28')](function(_0x45e00c){_0x594c4f['count']=_0x45e00c;if(_0x5d1fc8[_0x2cae('0x39')]['includeAll']){_0x5cdbac['include']=[{'all':!![]}];}return db[_0x2cae('0x33')]['findAll'](_0x5cdbac);})['then'](function(_0x261ee8){_0x594c4f[_0x2cae('0x46')]=_0x261ee8;return _0x594c4f;})[_0x2cae('0x28')](respondWithFilteredResult(_0x2db662,_0x5cdbac))[_0x2cae('0x47')](handleError(_0x2db662,null));};exports[_0x2cae('0x48')]=function(_0x3f1e74,_0x2a61b7){var _0x61e001={'raw':!![],'where':{'id':_0x3f1e74['params']['id']}},_0x4a21d4={};_0x4a21d4['model']=_[_0x2cae('0x38')](db['FaxQueue'][_0x2cae('0x49')]);_0x4a21d4['query']=_[_0x2cae('0x38')](_0x3f1e74['query']);_0x4a21d4[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x4a21d4[_0x2cae('0x37')],_0x4a21d4[_0x2cae('0x39')]);_0x61e001[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x4a21d4[_0x2cae('0x37')],qs[_0x2cae('0x3b')](_0x3f1e74[_0x2cae('0x39')]['fields']));_0x61e001[_0x2cae('0x3a')]=_0x61e001['attributes']['length']?_0x61e001[_0x2cae('0x3a')]:_0x4a21d4[_0x2cae('0x37')];if(_0x3f1e74[_0x2cae('0x39')]['includeAll']){_0x61e001['include']=[{'all':!![]}];}_0x61e001=_[_0x2cae('0x42')]({},_0x61e001,_0x3f1e74[_0x2cae('0x45')]);return db[_0x2cae('0x33')][_0x2cae('0x4b')](_0x61e001)[_0x2cae('0x28')](handleEntityNotFound(_0x2a61b7,null))[_0x2cae('0x28')](respondWithResult(_0x2a61b7,null))[_0x2cae('0x47')](handleError(_0x2a61b7,null));};exports[_0x2cae('0x4c')]=function(_0x2cc6e4,_0x40e0ff){return db['FaxQueue'][_0x2cae('0x4c')](_0x2cc6e4[_0x2cae('0x4d')],{})['then'](function(_0x2e3761){var _0x48143d=_0x2cc6e4['user'][_0x2cae('0x2a')]({'plain':!![]});if(!_0x48143d)throw new Error(_0x2cae('0x4e'));if(_0x48143d[_0x2cae('0x4f')]===_0x2cae('0x50')){var _0x56777c=_0x2e3761[_0x2cae('0x2a')]({'plain':!![]});var _0x3ab2aa=_0x2cae('0x2b');return db[_0x2cae('0x51')][_0x2cae('0x4b')]({'where':{'name':_0x3ab2aa,'userProfileId':_0x48143d[_0x2cae('0x52')]},'raw':!![]})[_0x2cae('0x28')](function(_0x10bc21){if(_0x10bc21&&_0x10bc21[_0x2cae('0x53')]===0x0){return db[_0x2cae('0x2c')][_0x2cae('0x4c')]({'name':_0x56777c[_0x2cae('0x2f')],'resourceId':_0x56777c['id'],'type':_0x10bc21['name'],'sectionId':_0x10bc21['id']},{})[_0x2cae('0x28')](function(){return _0x2e3761;});}else{return _0x2e3761;}})[_0x2cae('0x47')](function(_0x2a607b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a607b);throw _0x2a607b;});}return _0x2e3761;})[_0x2cae('0x28')](respondWithResult(_0x40e0ff,0xc9))[_0x2cae('0x47')](handleError(_0x40e0ff,null));};exports['update']=function(_0x5cd9f7,_0x440608){if(_0x5cd9f7[_0x2cae('0x4d')]['id']){delete _0x5cd9f7[_0x2cae('0x4d')]['id'];}return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x5cd9f7['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x440608,null))[_0x2cae('0x28')](saveUpdates(_0x5cd9f7[_0x2cae('0x4d')],null))[_0x2cae('0x28')](respondWithResult(_0x440608,null))[_0x2cae('0x47')](handleError(_0x440608,null));};exports[_0x2cae('0x29')]=function(_0x5da670,_0x4bbf22){return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x5da670[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x4bbf22,null))[_0x2cae('0x28')](removeEntity(_0x4bbf22,null))[_0x2cae('0x47')](handleError(_0x4bbf22,null));};exports[_0x2cae('0x55')]=function(_0x2502f8,_0x500c0f){return db[_0x2cae('0x33')][_0x2cae('0x55')]()[_0x2cae('0x28')](respondWithResult(_0x500c0f,null))[_0x2cae('0x47')](handleError(_0x500c0f,null));};exports[_0x2cae('0x56')]=function(_0x46f0a5,_0x291d7b,_0x57bef1){var _0x4d06b5={'raw':!![],'where':{}},_0x138a9f={},_0x35474d;return db[_0x2cae('0x33')]['findOne']({'where':{'id':_0x46f0a5[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x291d7b,null))[_0x2cae('0x28')](function(_0xad85ba){if(_0xad85ba){_0x35474d=_0xad85ba[_0x2cae('0x2a')]({'plain':!![]});_0x138a9f[_0x2cae('0x37')]=_[_0x2cae('0x38')](db[_0x2cae('0x57')][_0x2cae('0x49')]);_0x138a9f['query']=_[_0x2cae('0x38')](_0x46f0a5['query']);_0x138a9f[_0x2cae('0x41')]=_['intersection'](_0x138a9f[_0x2cae('0x37')],_0x138a9f[_0x2cae('0x39')]);_0x4d06b5[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x138a9f[_0x2cae('0x37')],qs[_0x2cae('0x3b')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x4d06b5[_0x2cae('0x3a')]=_0x4d06b5[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x4d06b5['attributes']:_0x138a9f['model'];if(!_0x46f0a5['query']['hasOwnProperty'](_0x2cae('0x3d'))){_0x4d06b5[_0x2cae('0x21')]=qs['limit'](_0x46f0a5['query'][_0x2cae('0x21')]);_0x4d06b5[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3e')]);}_0x4d06b5[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x4d06b5[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x46f0a5['query'],_0x138a9f[_0x2cae('0x41')]));_0x4d06b5[_0x2cae('0x40')][_0x2cae('0x5a')]=_0xad85ba['id'];if(_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x44')]){_0x4d06b5[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x4d06b5[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x4d06b5[_0x2cae('0x3a')],function(_0x4c1a2f){var _0x4536d3={};_0x4536d3[_0x4c1a2f]={'$like':'%'+_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x4536d3;})});}_0x4d06b5=_[_0x2cae('0x42')]({},_0x4d06b5,_0x46f0a5[_0x2cae('0x45')]);return db[_0x2cae('0x57')][_0x2cae('0x5b')](_0x4d06b5);}})[_0x2cae('0x28')](function(_0x2d4c21){if(_0x2d4c21){return db[_0x2cae('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x2d4c21,_0x2cae('0x5d')),'role':_0x2cae('0x5e')},'attributes':['id',_0x2cae('0x2f'),_0x2cae('0x5f'),_0x2cae('0x60'),_0x2cae('0x61')]});}})[_0x2cae('0x28')](function(_0x33b03c){if(_0x33b03c){return{'count':_0x33b03c[_0x2cae('0x20')],'rows':_['map'](_0x33b03c[_0x2cae('0x46')],function(_0x12588b){return{'membername':_0x12588b[_0x2cae('0x2f')],'UserId':_0x12588b['id'],'queue_name':_0x35474d[_0x2cae('0x2f')],'FaxQueueId':_0x35474d['id'],'interface':util['format']('%s/%s',_0x2cae('0x62'),_0x12588b[_0x2cae('0x2f')]),'penalty':0x0,'paused':_0x12588b[_0x2cae('0x5f')],'createdAt':_0x12588b[_0x2cae('0x61')],'updatedAt':_0x12588b[_0x2cae('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x291d7b,_0x4d06b5))[_0x2cae('0x47')](handleError(_0x291d7b,null));};exports[_0x2cae('0x63')]=function(_0x4dbb80,_0x2c3ac4,_0x595394){var _0x22afa3={};var _0x5ed531={};var _0x4e626c;var _0x10ef04;return db[_0x2cae('0x33')]['findOne']({'where':{'id':_0x4dbb80[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x2c3ac4,null))[_0x2cae('0x28')](function(_0x3b35e2){if(_0x3b35e2){_0x4e626c=_0x3b35e2;_0x5ed531['model']=_[_0x2cae('0x38')](db['Team'][_0x2cae('0x49')]);_0x5ed531[_0x2cae('0x39')]=_[_0x2cae('0x38')](_0x4dbb80[_0x2cae('0x39')]);_0x5ed531[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x5ed531[_0x2cae('0x37')],_0x5ed531[_0x2cae('0x39')]);_0x22afa3[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x5ed531['model'],qs['fields'](_0x4dbb80[_0x2cae('0x39')]['fields']));_0x22afa3[_0x2cae('0x3a')]=_0x22afa3['attributes']['length']?_0x22afa3[_0x2cae('0x3a')]:_0x5ed531[_0x2cae('0x37')];_0x22afa3[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x4dbb80['query'][_0x2cae('0x3f')]);_0x22afa3[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x4dbb80[_0x2cae('0x39')],_0x5ed531[_0x2cae('0x41')]));if(_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x44')]){_0x22afa3[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x22afa3[_0x2cae('0x40')],{'$or':_['map'](_0x22afa3['attributes'],function(_0x4dc4c3){var _0xd661ba={};_0xd661ba[_0x4dc4c3]={'$like':'%'+_0x4dbb80['query'][_0x2cae('0x44')]+'%'};return _0xd661ba;})});}_0x22afa3=_['merge']({},_0x22afa3,_0x4dbb80[_0x2cae('0x45')]);return _0x4e626c[_0x2cae('0x63')](_0x22afa3);}})[_0x2cae('0x28')](function(_0x530bc5){if(_0x530bc5){_0x10ef04=_0x530bc5[_0x2cae('0x3c')];if(!_0x4dbb80['query'][_0x2cae('0x64')](_0x2cae('0x3d'))){_0x22afa3[_0x2cae('0x21')]=qs['limit'](_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x21')]);_0x22afa3[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x3e')]);}return _0x4e626c[_0x2cae('0x63')](_0x22afa3);}})[_0x2cae('0x28')](function(_0x8e23f4){if(_0x8e23f4){return _0x8e23f4?{'count':_0x10ef04,'rows':_0x8e23f4}:null;}})[_0x2cae('0x28')](respondWithResult(_0x2c3ac4,null))[_0x2cae('0x47')](handleError(_0x2c3ac4,null));};exports[_0x2cae('0x65')]=function(_0x2000fa,_0xd4acff,_0x430067){var _0xf9be34=_0x2000fa[_0x2cae('0x4d')][_0x2cae('0x66')];return db[_0x2cae('0x67')][_0x2cae('0x5b')]({'where':{'id':_0xf9be34},'attributes':['id'],'include':[{'model':db[_0x2cae('0x5c')],'as':_0x2cae('0x68'),'attributes':['id',_0x2cae('0x2f'),_0x2cae('0x69'),_0x2cae('0x6a'),'interface'],'raw':!![]}]})[_0x2cae('0x28')](function(_0x16ba9f){if(_0x16ba9f){var _0xaffd1c=_[_0x2cae('0x6b')](_0x16ba9f,function(_0x2cb60c){var _0x34a3ed=_0x2cb60c[_0x2cae('0x2a')]({'plain':!![]});return _0x34a3ed['Agents'];});return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x2000fa[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](function(_0x177b6f){return db['sequelize'][_0x2cae('0x6c')](function(_0x43fef4){return _0x177b6f[_0x2cae('0x65')](_0xf9be34,{'transaction':_0x43fef4})[_0x2cae('0x28')](function(){return BPromise[_0x2cae('0x6d')](_0xaffd1c,function(_0x4d93de){return db['UserFaxQueue'][_0x2cae('0x6e')]({'where':{'UserId':_0x4d93de['id'],'FaxQueueId':_0x2000fa[_0x2cae('0x54')]['id']},'transaction':_0x43fef4});});})[_0x2cae('0x28')](function(){_0xaffd1c['forEach'](function(_0x4fc1ee){socket['emit']('userFaxQueue:save',{'UserId':_0x4fc1ee['id'],'FaxQueueId':_0x177b6f['id']});});});});});}})['then'](respondWithStatusCode(_0xd4acff,null))[_0x2cae('0x47')](handleError(_0xd4acff,null));};exports[_0x2cae('0x6f')]=function(_0x2aabff,_0x30f006,_0x3b6088){return db[_0x2cae('0x67')]['findAll']({'where':{'id':_0x2aabff[_0x2cae('0x39')][_0x2cae('0x66')]},'attributes':['id'],'include':[{'model':db[_0x2cae('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30f006,null))[_0x2cae('0x28')](function(_0x9afd59){var _0x27f1c0=_[_0x2cae('0x32')](_0x9afd59,'id');var _0x1fcc57=[];var _0x3e292b=[];var _0xa86b8b=squel['select']();_0xa86b8b[_0x2cae('0x70')](_0x2cae('0x71'))[_0x2cae('0x72')]('team_has_fax_queues','tq')[_0x2cae('0x73')](_0x2cae('0x74'),'ut',_0x2cae('0x75'))[_0x2cae('0x40')](_0x2cae('0x76'),_0x2aabff[_0x2cae('0x54')]['id']);for(var _0x495402=0x0;_0x495402<_0x9afd59[_0x2cae('0x3c')];_0x495402+=0x1){let _0x1d8da4=_0x9afd59[_0x495402];for(var _0x57743e=0x0;_0x57743e<_0x1d8da4[_0x2cae('0x68')][_0x2cae('0x3c')];_0x57743e+=0x1){let _0x490a70=_0x1d8da4[_0x2cae('0x68')][_0x57743e];var _0x27aca6=_0xa86b8b[_0x2cae('0x77')]();_0x27aca6[_0x2cae('0x40')](_0x2cae('0x78'),_0x490a70['id']);_0x3e292b[_0x2cae('0x79')](db[_0x2cae('0x7a')][_0x2cae('0x39')](_0x27aca6[_0x2cae('0x7b')](),{'type':db[_0x2cae('0x7a')]['QueryTypes'][_0x2cae('0x7c')]})[_0x2cae('0x28')](function(_0x3f2cf7){if(_0x3f2cf7[_0x2cae('0x3c')]===0x1){return _0x490a70['id'];}else{var _0x2c466f=_[_0x2cae('0x7d')](_[_0x2cae('0x32')](_0x3f2cf7,_0x2cae('0x7e')),function(_0x34e72d){return _[_0x2cae('0x7f')](_0x27f1c0,_0x34e72d);});if(_0x2c466f){return _0x490a70['id'];}}}));}}return BPromise[_0x2cae('0x80')](_0x3e292b)[_0x2cae('0x28')](function(_0x37861f){_0x1fcc57=_(_0x1fcc57)['union'](_0x37861f)[_0x2cae('0x81')]()['value']();return db[_0x2cae('0x33')]['find']({'where':{'id':_0x2aabff[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](function(_0x273bae){return db['sequelize'][_0x2cae('0x6c')](function(_0x5db58d){return _0x273bae[_0x2cae('0x6f')](_0x2aabff[_0x2cae('0x39')][_0x2cae('0x66')],{'transaction':_0x5db58d})[_0x2cae('0x28')](function(){if(!_[_0x2cae('0x82')](_0x1fcc57)){return _0x273bae[_0x2cae('0x83')](_0x1fcc57,{'transaction':_0x5db58d});}})[_0x2cae('0x28')](function(){_0x1fcc57[_0x2cae('0x84')](function(_0x4192d6){socket[_0x2cae('0x85')](_0x2cae('0x86'),{'UserId':_0x4192d6,'FaxQueueId':_0x273bae['id']});});});});});});})[_0x2cae('0x28')](respondWithStatusCode(_0x30f006,null))[_0x2cae('0x47')](handleError(_0x30f006,null));};exports[_0x2cae('0x87')]=function(_0x3ec017,_0x45b3b2,_0x1dad79){return db[_0x2cae('0x33')]['find']({'where':{'id':_0x3ec017[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x45b3b2,null))[_0x2cae('0x28')](function(_0x4f5e84){if(_0x4f5e84){return _0x4f5e84[_0x2cae('0x87')](_0x3ec017[_0x2cae('0x4d')][_0x2cae('0x66')],_[_0x2cae('0x88')](_0x3ec017[_0x2cae('0x4d')],['ids','id'])||{})[_0x2cae('0x89')](function(_0x447bb6){for(var _0x354d2a=0x0;_0x354d2a<_0x3ec017[_0x2cae('0x4d')]['ids'][_0x2cae('0x3c')];_0x354d2a+=0x1){socket['emit'](_0x2cae('0x8a'),{'UserId':_0x3ec017[_0x2cae('0x4d')]['ids'][_0x354d2a],'FaxQueueId':_0x3ec017['params']['id']});}return _0x447bb6;});}})[_0x2cae('0x28')](respondWithResult(_0x45b3b2,null))[_0x2cae('0x47')](handleError(_0x45b3b2,null));};exports[_0x2cae('0x83')]=function(_0x58692e,_0x8c6fc5,_0x46d3fc){return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x58692e['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x8c6fc5,null))[_0x2cae('0x28')](function(_0x9d3149){if(_0x9d3149){return _0x9d3149[_0x2cae('0x83')](_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')])[_0x2cae('0x28')](function(){if(_[_0x2cae('0x8b')](_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')])){for(var _0x52526a=0x0;_0x52526a<_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')][_0x2cae('0x3c')];_0x52526a+=0x1){socket['emit'](_0x2cae('0x86'),{'UserId':Number(_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')][_0x52526a]),'FaxQueueId':Number(_0x58692e[_0x2cae('0x54')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')]),'FaxQueueId':Number(_0x58692e[_0x2cae('0x54')]['id'])});}});}})[_0x2cae('0x28')](respondWithStatusCode(_0x8c6fc5,null))[_0x2cae('0x47')](handleError(_0x8c6fc5,null));};exports[_0x2cae('0x8c')]=function(_0x3e13b7,_0x1f0531,_0xcad4dd){var _0x2f62ba={};var _0x30ca8b={};var _0x2051c3;var _0x288834;return db['FaxQueue'][_0x2cae('0x8d')]({'where':{'id':_0x3e13b7['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x1f0531,null))[_0x2cae('0x28')](function(_0x430812){if(_0x430812){_0x2051c3=_0x430812;_0x30ca8b[_0x2cae('0x37')]=_[_0x2cae('0x38')](db['User'][_0x2cae('0x49')]);_0x30ca8b[_0x2cae('0x39')]=_['keys'](_0x3e13b7[_0x2cae('0x39')]);_0x30ca8b[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x30ca8b[_0x2cae('0x37')],_0x30ca8b['query']);_0x2f62ba[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x30ca8b['model'],qs['fields'](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x2f62ba['attributes']=_0x2f62ba[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x2f62ba[_0x2cae('0x3a')]:_0x30ca8b[_0x2cae('0x37')];_0x2f62ba[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x2f62ba[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x3e13b7[_0x2cae('0x39')],_0x30ca8b[_0x2cae('0x41')]));if(_0x3e13b7[_0x2cae('0x39')]['filter']){_0x2f62ba[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x2f62ba[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x2f62ba['attributes'],function(_0x54ea64){var _0x43c098={};_0x43c098[_0x54ea64]={'$like':'%'+_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x43c098;})});}_0x2f62ba=_[_0x2cae('0x42')]({},_0x2f62ba,_0x3e13b7['options']);return _0x2051c3['getAgents'](_0x2f62ba);}})[_0x2cae('0x28')](function(_0x1a0b64){if(_0x1a0b64){_0x288834=_0x1a0b64[_0x2cae('0x3c')];if(!_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x64')]('nolimit')){_0x2f62ba[_0x2cae('0x21')]=qs[_0x2cae('0x21')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x21')]);_0x2f62ba[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3e')]);}return _0x2051c3[_0x2cae('0x8c')](_0x2f62ba);}})['then'](function(_0x34c08d){if(_0x34c08d){return _0x34c08d?{'count':_0x288834,'rows':_0x34c08d}:null;}})['then'](respondWithResult(_0x1f0531,null))['catch'](handleError(_0x1f0531,null));}; \ No newline at end of file +var _0x94df=['ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','fieldName','key','map','keys','filters','model','attributes','intersection','fields','length','limit','query','order','sort','where','pick','filter','type','merge','FaxQueue','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','FaxQueueId','UserFaxQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','emit','userFaxQueue:save','Team','ids','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams'];(function(_0x5a245c,_0x486bd3){var _0x2e17ca=function(_0x1df2eb){while(--_0x1df2eb){_0x5a245c['push'](_0x5a245c['shift']());}};_0x2e17ca(++_0x486bd3);}(_0x94df,0xa3));var _0xf94d=function(_0x1d9844,_0x4d314e){_0x1d9844=_0x1d9844-0x0;var _0x3facab=_0x94df[_0x1d9844];return _0x3facab;};'use strict';var pdf=require(_0xf94d('0x0'));var emlformat=require(_0xf94d('0x1'));var rimraf=require(_0xf94d('0x2'));var zipdir=require(_0xf94d('0x3'));var jsonpatch=require(_0xf94d('0x4'));var rp=require(_0xf94d('0x5'));var moment=require('moment');var BPromise=require(_0xf94d('0x6'));var Mustache=require(_0xf94d('0x7'));var util=require(_0xf94d('0x8'));var path=require(_0xf94d('0x9'));var sox=require(_0xf94d('0xa'));var csv=require(_0xf94d('0xb'));var ejs=require(_0xf94d('0xc'));var fs=require('fs');var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xb'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf94d('0x1b')](config[_0xf94d('0x1c')],{'host':_0xf94d('0x1d'),'port':0x18eb});var socket=require(_0xf94d('0x1e'))(new Redis(config[_0xf94d('0x1c')]));require(_0xf94d('0x1f'))['register'](socket);function respondWithStatusCode(_0x596da8,_0x36ff94){_0x36ff94=_0x36ff94||0xcc;return function(_0x17234f){if(_0x17234f){return _0x596da8[_0xf94d('0x20')](_0x36ff94);}return _0x596da8[_0xf94d('0x21')](_0x36ff94)[_0xf94d('0x22')]();};}function respondWithResult(_0x14020b,_0x2c557b){_0x2c557b=_0x2c557b||0xc8;return function(_0x4fa8bf){if(_0x4fa8bf){return _0x14020b[_0xf94d('0x21')](_0x2c557b)['json'](_0x4fa8bf);}};}function respondWithFilteredResult(_0x192a58,_0x4c6ef6){return function(_0x29f4bc){if(_0x29f4bc){var _0x559e0c=_0x29f4bc[_0xf94d('0x23')],_0x30d231=_0x4c6ef6['offset'],_0x3bf001=_0x4c6ef6[_0xf94d('0x24')]+_0x4c6ef6['limit'],_0x510eef;if(_0x3bf001>=_0x559e0c){_0x3bf001=_0x559e0c;_0x510eef=0xc8;}else{_0x510eef=0xce;}_0x192a58[_0xf94d('0x21')](_0x510eef);return _0x192a58[_0xf94d('0x25')](_0xf94d('0x26'),_0x30d231+'-'+_0x3bf001+'/'+_0x559e0c)[_0xf94d('0x27')](_0x29f4bc);}return null;};}function patchUpdates(_0x5f261c){return function(_0x4325ff){try{jsonpatch['apply'](_0x4325ff,_0x5f261c,!![]);}catch(_0x39f75d){return BPromise[_0xf94d('0x28')](_0x39f75d);}return _0x4325ff[_0xf94d('0x29')]();};}function saveUpdates(_0x56e5f5,_0x3f6b24){return function(_0x8f50){if(_0x8f50){return _0x8f50[_0xf94d('0x2a')](_0x56e5f5)[_0xf94d('0x2b')](function(_0x47470d){return _0x47470d;});}return null;};}function removeEntity(_0x533714,_0x301d2e){return function(_0x51f7f8){if(_0x51f7f8){return _0x51f7f8[_0xf94d('0x2c')]()[_0xf94d('0x2b')](function(){var _0x302abf=_0x51f7f8[_0xf94d('0x2d')]({'plain':!![]});var _0x997b6c=_0xf94d('0x2e');return db[_0xf94d('0x2f')][_0xf94d('0x2c')]({'where':{'type':_0x997b6c,'resourceId':_0x302abf['id']}})[_0xf94d('0x2b')](function(){return _0x51f7f8;});})[_0xf94d('0x2b')](function(){_0x533714[_0xf94d('0x21')](0xcc)[_0xf94d('0x22')]();});}};}function handleEntityNotFound(_0xbe954d,_0x5aa72c){return function(_0x4d31ec){if(!_0x4d31ec){_0xbe954d['sendStatus'](0x194);}return _0x4d31ec;};}function handleError(_0x5e63bb,_0xbb4a6){_0xbb4a6=_0xbb4a6||0x1f4;return function(_0x1e8242){logger['error'](_0x1e8242[_0xf94d('0x30')]);if(_0x1e8242[_0xf94d('0x31')]){delete _0x1e8242[_0xf94d('0x31')];}_0x5e63bb['status'](_0xbb4a6)[_0xf94d('0x32')](_0x1e8242);};}exports['index']=function(_0x1b46d6,_0x1d15c5){var _0x51b69a={},_0x2378b0={},_0x4a0dd7={'count':0x0,'rows':[]};var _0x18faf1=_['map'](db['FaxQueue']['rawAttributes'],function(_0x20a270){return{'name':_0x20a270[_0xf94d('0x33')],'type':_0x20a270['type'][_0xf94d('0x34')]};});_0x2378b0['model']=_[_0xf94d('0x35')](_0x18faf1,_0xf94d('0x31'));_0x2378b0['query']=_[_0xf94d('0x36')](_0x1b46d6['query']);_0x2378b0[_0xf94d('0x37')]=_['intersection'](_0x2378b0[_0xf94d('0x38')],_0x2378b0['query']);_0x51b69a[_0xf94d('0x39')]=_[_0xf94d('0x3a')](_0x2378b0[_0xf94d('0x38')],qs[_0xf94d('0x3b')](_0x1b46d6['query']['fields']));_0x51b69a['attributes']=_0x51b69a[_0xf94d('0x39')][_0xf94d('0x3c')]?_0x51b69a[_0xf94d('0x39')]:_0x2378b0[_0xf94d('0x38')];if(!_0x1b46d6['query']['hasOwnProperty']('nolimit')){_0x51b69a[_0xf94d('0x3d')]=qs[_0xf94d('0x3d')](_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x3d')]);_0x51b69a['offset']=qs[_0xf94d('0x24')](_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x24')]);}_0x51b69a[_0xf94d('0x3f')]=qs['sort'](_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x40')]);_0x51b69a[_0xf94d('0x41')]=qs[_0xf94d('0x37')](_[_0xf94d('0x42')](_0x1b46d6[_0xf94d('0x3e')],_0x2378b0[_0xf94d('0x37')]),_0x18faf1);if(_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x43')]){_0x51b69a[_0xf94d('0x41')]=_['merge'](_0x51b69a['where'],{'$or':_[_0xf94d('0x35')](_0x18faf1,function(_0x49d203){if(_0x49d203[_0xf94d('0x44')]!=='VIRTUAL'){var _0x368502={};_0x368502[_0x49d203[_0xf94d('0x31')]]={'$like':'%'+_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x43')]+'%'};return _0x368502;}})});}_0x51b69a=_[_0xf94d('0x45')]({},_0x51b69a,_0x1b46d6['options']);var _0x2d95ee={'where':_0x51b69a['where']};return db[_0xf94d('0x46')]['count'](_0x2d95ee)[_0xf94d('0x2b')](function(_0x40af20){_0x4a0dd7[_0xf94d('0x23')]=_0x40af20;if(_0x1b46d6[_0xf94d('0x3e')][_0xf94d('0x47')]){_0x51b69a[_0xf94d('0x48')]=[{'all':!![]}];}return db[_0xf94d('0x46')]['findAll'](_0x51b69a);})[_0xf94d('0x2b')](function(_0x2df442){_0x4a0dd7[_0xf94d('0x49')]=_0x2df442;return _0x4a0dd7;})['then'](respondWithFilteredResult(_0x1d15c5,_0x51b69a))[_0xf94d('0x4a')](handleError(_0x1d15c5,null));};exports[_0xf94d('0x4b')]=function(_0x41c72d,_0x241ac1){var _0x3ab19={'raw':!![],'where':{'id':_0x41c72d[_0xf94d('0x4c')]['id']}},_0x30b99b={};_0x30b99b['model']=_[_0xf94d('0x36')](db[_0xf94d('0x46')][_0xf94d('0x4d')]);_0x30b99b[_0xf94d('0x3e')]=_[_0xf94d('0x36')](_0x41c72d[_0xf94d('0x3e')]);_0x30b99b['filters']=_['intersection'](_0x30b99b[_0xf94d('0x38')],_0x30b99b[_0xf94d('0x3e')]);_0x3ab19[_0xf94d('0x39')]=_[_0xf94d('0x3a')](_0x30b99b[_0xf94d('0x38')],qs['fields'](_0x41c72d[_0xf94d('0x3e')]['fields']));_0x3ab19[_0xf94d('0x39')]=_0x3ab19[_0xf94d('0x39')][_0xf94d('0x3c')]?_0x3ab19[_0xf94d('0x39')]:_0x30b99b[_0xf94d('0x38')];if(_0x41c72d['query'][_0xf94d('0x47')]){_0x3ab19[_0xf94d('0x48')]=[{'all':!![]}];}_0x3ab19=_[_0xf94d('0x45')]({},_0x3ab19,_0x41c72d[_0xf94d('0x4e')]);return db['FaxQueue'][_0xf94d('0x4f')](_0x3ab19)['then'](handleEntityNotFound(_0x241ac1,null))['then'](respondWithResult(_0x241ac1,null))[_0xf94d('0x4a')](handleError(_0x241ac1,null));};exports[_0xf94d('0x50')]=function(_0x38d70d,_0x5557ee){return db[_0xf94d('0x46')]['create'](_0x38d70d[_0xf94d('0x51')],{})[_0xf94d('0x2b')](function(_0x33d0c2){var _0x42ec76=_0x38d70d[_0xf94d('0x52')][_0xf94d('0x2d')]({'plain':!![]});if(!_0x42ec76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42ec76[_0xf94d('0x53')]===_0xf94d('0x52')){var _0x3b63da=_0x33d0c2[_0xf94d('0x2d')]({'plain':!![]});var _0x58e04b=_0xf94d('0x2e');return db['UserProfileSection'][_0xf94d('0x4f')]({'where':{'name':_0x58e04b,'userProfileId':_0x42ec76['userProfileId']},'raw':!![]})[_0xf94d('0x2b')](function(_0xdcee74){if(_0xdcee74&&_0xdcee74[_0xf94d('0x54')]===0x0){return db[_0xf94d('0x2f')][_0xf94d('0x50')]({'name':_0x3b63da['name'],'resourceId':_0x3b63da['id'],'type':_0xdcee74['name'],'sectionId':_0xdcee74['id']},{})[_0xf94d('0x2b')](function(){return _0x33d0c2;});}else{return _0x33d0c2;}})[_0xf94d('0x4a')](function(_0x26cd82){logger[_0xf94d('0x55')](_0xf94d('0x56'),_0x26cd82);throw _0x26cd82;});}return _0x33d0c2;})[_0xf94d('0x2b')](respondWithResult(_0x5557ee,0xc9))['catch'](handleError(_0x5557ee,null));};exports[_0xf94d('0x2a')]=function(_0x17471f,_0x3d85f){if(_0x17471f[_0xf94d('0x51')]['id']){delete _0x17471f['body']['id'];}return db['FaxQueue'][_0xf94d('0x4f')]({'where':{'id':_0x17471f[_0xf94d('0x4c')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x3d85f,null))['then'](saveUpdates(_0x17471f[_0xf94d('0x51')],null))[_0xf94d('0x2b')](respondWithResult(_0x3d85f,null))[_0xf94d('0x4a')](handleError(_0x3d85f,null));};exports[_0xf94d('0x2c')]=function(_0x42e78c,_0x161ca9){return db[_0xf94d('0x46')][_0xf94d('0x4f')]({'where':{'id':_0x42e78c[_0xf94d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x161ca9,null))[_0xf94d('0x2b')](removeEntity(_0x161ca9,null))['catch'](handleError(_0x161ca9,null));};exports[_0xf94d('0x57')]=function(_0x4c8812,_0x99333e){return db[_0xf94d('0x46')][_0xf94d('0x57')]()['then'](respondWithResult(_0x99333e,null))[_0xf94d('0x4a')](handleError(_0x99333e,null));};exports[_0xf94d('0x58')]=function(_0x12c20f,_0xe3752f,_0x58df52){var _0x4bbbea={'raw':!![],'where':{}},_0x35411b={},_0x572dff;return db['FaxQueue'][_0xf94d('0x59')]({'where':{'id':_0x12c20f[_0xf94d('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe3752f,null))[_0xf94d('0x2b')](function(_0x5bbb3e){if(_0x5bbb3e){_0x572dff=_0x5bbb3e['get']({'plain':!![]});_0x35411b['model']=_[_0xf94d('0x36')](db['UserFaxQueue'][_0xf94d('0x4d')]);_0x35411b['query']=_['keys'](_0x12c20f['query']);_0x35411b[_0xf94d('0x37')]=_['intersection'](_0x35411b['model'],_0x35411b[_0xf94d('0x3e')]);_0x4bbbea['attributes']=_[_0xf94d('0x3a')](_0x35411b[_0xf94d('0x38')],qs['fields'](_0x12c20f[_0xf94d('0x3e')]['fields']));_0x4bbbea['attributes']=_0x4bbbea[_0xf94d('0x39')]['length']?_0x4bbbea[_0xf94d('0x39')]:_0x35411b[_0xf94d('0x38')];if(!_0x12c20f[_0xf94d('0x3e')][_0xf94d('0x5a')]('nolimit')){_0x4bbbea[_0xf94d('0x3d')]=qs[_0xf94d('0x3d')](_0x12c20f[_0xf94d('0x3e')][_0xf94d('0x3d')]);_0x4bbbea[_0xf94d('0x24')]=qs[_0xf94d('0x24')](_0x12c20f['query'][_0xf94d('0x24')]);}_0x4bbbea[_0xf94d('0x3f')]=qs[_0xf94d('0x40')](_0x12c20f[_0xf94d('0x3e')][_0xf94d('0x40')]);_0x4bbbea['where']=qs[_0xf94d('0x37')](_[_0xf94d('0x42')](_0x12c20f[_0xf94d('0x3e')],_0x35411b[_0xf94d('0x37')]));_0x4bbbea['where'][_0xf94d('0x5b')]=_0x5bbb3e['id'];if(_0x12c20f[_0xf94d('0x3e')][_0xf94d('0x43')]){_0x4bbbea[_0xf94d('0x41')]=_[_0xf94d('0x45')](_0x4bbbea[_0xf94d('0x41')],{'$or':_[_0xf94d('0x35')](_0x4bbbea[_0xf94d('0x39')],function(_0x170a3f){var _0x18befa={};_0x18befa[_0x170a3f]={'$like':'%'+_0x12c20f[_0xf94d('0x3e')][_0xf94d('0x43')]+'%'};return _0x18befa;})});}_0x4bbbea=_[_0xf94d('0x45')]({},_0x4bbbea,_0x12c20f[_0xf94d('0x4e')]);return db[_0xf94d('0x5c')][_0xf94d('0x5d')](_0x4bbbea);}})[_0xf94d('0x2b')](function(_0x362035){if(_0x362035){return db[_0xf94d('0x5e')][_0xf94d('0x5f')]({'where':{'id':_[_0xf94d('0x35')](_0x362035,_0xf94d('0x60')),'role':_0xf94d('0x61')},'attributes':['id','name','faxPause',_0xf94d('0x62'),_0xf94d('0x63')]});}})[_0xf94d('0x2b')](function(_0x2ceb4d){if(_0x2ceb4d){return{'count':_0x2ceb4d['count'],'rows':_[_0xf94d('0x35')](_0x2ceb4d[_0xf94d('0x49')],function(_0x500ea5){return{'membername':_0x500ea5[_0xf94d('0x31')],'UserId':_0x500ea5['id'],'queue_name':_0x572dff['name'],'FaxQueueId':_0x572dff['id'],'interface':util[_0xf94d('0x64')](_0xf94d('0x65'),_0xf94d('0x66'),_0x500ea5[_0xf94d('0x31')]),'penalty':0x0,'paused':_0x500ea5[_0xf94d('0x67')],'createdAt':_0x500ea5[_0xf94d('0x63')],'updatedAt':_0x500ea5[_0xf94d('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf94d('0x2b')](respondWithFilteredResult(_0xe3752f,_0x4bbbea))['catch'](handleError(_0xe3752f,null));};exports[_0xf94d('0x68')]=function(_0x17de38,_0x308c2e,_0xf9b47e){var _0x326177={};var _0x48e75b={};var _0x25a669;var _0xee295f;return db['FaxQueue'][_0xf94d('0x59')]({'where':{'id':_0x17de38[_0xf94d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x308c2e,null))[_0xf94d('0x2b')](function(_0x402f85){if(_0x402f85){_0x25a669=_0x402f85;_0x48e75b[_0xf94d('0x38')]=_['keys'](db['Team'][_0xf94d('0x4d')]);_0x48e75b[_0xf94d('0x3e')]=_[_0xf94d('0x36')](_0x17de38[_0xf94d('0x3e')]);_0x48e75b['filters']=_[_0xf94d('0x3a')](_0x48e75b[_0xf94d('0x38')],_0x48e75b[_0xf94d('0x3e')]);_0x326177[_0xf94d('0x39')]=_['intersection'](_0x48e75b[_0xf94d('0x38')],qs[_0xf94d('0x3b')](_0x17de38[_0xf94d('0x3e')][_0xf94d('0x3b')]));_0x326177[_0xf94d('0x39')]=_0x326177['attributes'][_0xf94d('0x3c')]?_0x326177[_0xf94d('0x39')]:_0x48e75b['model'];_0x326177[_0xf94d('0x3f')]=qs['sort'](_0x17de38[_0xf94d('0x3e')][_0xf94d('0x40')]);_0x326177[_0xf94d('0x41')]=qs[_0xf94d('0x37')](_[_0xf94d('0x42')](_0x17de38[_0xf94d('0x3e')],_0x48e75b[_0xf94d('0x37')]));if(_0x17de38[_0xf94d('0x3e')][_0xf94d('0x43')]){_0x326177[_0xf94d('0x41')]=_[_0xf94d('0x45')](_0x326177[_0xf94d('0x41')],{'$or':_['map'](_0x326177[_0xf94d('0x39')],function(_0x3cf35e){var _0x460a21={};_0x460a21[_0x3cf35e]={'$like':'%'+_0x17de38[_0xf94d('0x3e')][_0xf94d('0x43')]+'%'};return _0x460a21;})});}_0x326177=_[_0xf94d('0x45')]({},_0x326177,_0x17de38[_0xf94d('0x4e')]);return _0x25a669[_0xf94d('0x68')](_0x326177);}})[_0xf94d('0x2b')](function(_0xd5d668){if(_0xd5d668){_0xee295f=_0xd5d668[_0xf94d('0x3c')];if(!_0x17de38[_0xf94d('0x3e')][_0xf94d('0x5a')]('nolimit')){_0x326177['limit']=qs[_0xf94d('0x3d')](_0x17de38[_0xf94d('0x3e')][_0xf94d('0x3d')]);_0x326177['offset']=qs['offset'](_0x17de38[_0xf94d('0x3e')][_0xf94d('0x24')]);}return _0x25a669[_0xf94d('0x68')](_0x326177);}})[_0xf94d('0x2b')](function(_0x49b1b9){if(_0x49b1b9){return _0x49b1b9?{'count':_0xee295f,'rows':_0x49b1b9}:null;}})['then'](respondWithResult(_0x308c2e,null))[_0xf94d('0x4a')](handleError(_0x308c2e,null));};exports[_0xf94d('0x69')]=function(_0x3f00cd,_0x2f0881,_0x418479){var _0x462e7=_0x3f00cd[_0xf94d('0x51')]['ids'];return db['Team']['findAll']({'where':{'id':_0x462e7},'attributes':['id'],'include':[{'model':db[_0xf94d('0x5e')],'as':_0xf94d('0x6a'),'attributes':['id',_0xf94d('0x31'),_0xf94d('0x6b'),_0xf94d('0x6c'),_0xf94d('0x6d')],'raw':!![]}]})[_0xf94d('0x2b')](function(_0x5ea974){if(_0x5ea974){var _0x3a92b0=_[_0xf94d('0x6e')](_0x5ea974,function(_0x5a5a3e){var _0x430ed0=_0x5a5a3e[_0xf94d('0x2d')]({'plain':!![]});return _0x430ed0[_0xf94d('0x6a')];});return db[_0xf94d('0x46')][_0xf94d('0x4f')]({'where':{'id':_0x3f00cd[_0xf94d('0x4c')]['id']}})[_0xf94d('0x2b')](function(_0x127548){return db[_0xf94d('0x6f')]['transaction'](function(_0x3706c3){return _0x127548['addTeams'](_0x462e7,{'transaction':_0x3706c3})['then'](function(){return BPromise['each'](_0x3a92b0,function(_0x4ed17c){return db[_0xf94d('0x5c')][_0xf94d('0x70')]({'where':{'UserId':_0x4ed17c['id'],'FaxQueueId':_0x3f00cd[_0xf94d('0x4c')]['id']},'transaction':_0x3706c3});});})['then'](function(){_0x3a92b0['forEach'](function(_0x34c83c){socket[_0xf94d('0x71')](_0xf94d('0x72'),{'UserId':_0x34c83c['id'],'FaxQueueId':_0x127548['id']});});});});});}})['then'](respondWithStatusCode(_0x2f0881,null))['catch'](handleError(_0x2f0881,null));};exports['removeTeams']=function(_0x3f46b4,_0x39251a,_0x64a792){return db[_0xf94d('0x73')][_0xf94d('0x5d')]({'where':{'id':_0x3f46b4[_0xf94d('0x3e')][_0xf94d('0x74')]},'attributes':['id'],'include':[{'model':db[_0xf94d('0x5e')],'as':_0xf94d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf94d('0x2b')](handleEntityNotFound(_0x39251a,null))[_0xf94d('0x2b')](function(_0x57b9d9){var _0xbb5a6d=_[_0xf94d('0x35')](_0x57b9d9,'id');var _0xfb251d=[];var _0x6f28a1=[];var _0xe95bb6=squel[_0xf94d('0x75')]();_0xe95bb6[_0xf94d('0x76')](_0xf94d('0x77'))['from'](_0xf94d('0x78'),'tq')[_0xf94d('0x79')](_0xf94d('0x7a'),'ut',_0xf94d('0x7b'))['where'](_0xf94d('0x7c'),_0x3f46b4[_0xf94d('0x4c')]['id']);for(var _0x1ce9ee=0x0;_0x1ce9ee<_0x57b9d9['length'];_0x1ce9ee+=0x1){let _0x2d3765=_0x57b9d9[_0x1ce9ee];for(var _0x597260=0x0;_0x597260<_0x2d3765[_0xf94d('0x6a')][_0xf94d('0x3c')];_0x597260+=0x1){let _0x3d55fa=_0x2d3765[_0xf94d('0x6a')][_0x597260];var _0x1bd582=_0xe95bb6[_0xf94d('0x7d')]();_0x1bd582['where'](_0xf94d('0x7e'),_0x3d55fa['id']);_0x6f28a1[_0xf94d('0x7f')](db[_0xf94d('0x6f')]['query'](_0x1bd582[_0xf94d('0x80')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xf94d('0x2b')](function(_0x4097bf){if(_0x4097bf['length']===0x1){return _0x3d55fa['id'];}else{var _0x1c224d=_[_0xf94d('0x81')](_[_0xf94d('0x35')](_0x4097bf,_0xf94d('0x82')),function(_0x322461){return _[_0xf94d('0x83')](_0xbb5a6d,_0x322461);});if(_0x1c224d){return _0x3d55fa['id'];}}}));}}return BPromise[_0xf94d('0x84')](_0x6f28a1)['then'](function(_0x4744e4){_0xfb251d=_(_0xfb251d)[_0xf94d('0x85')](_0x4744e4)['compact']()[_0xf94d('0x86')]();return db[_0xf94d('0x46')][_0xf94d('0x4f')]({'where':{'id':_0x3f46b4[_0xf94d('0x4c')]['id']}})[_0xf94d('0x2b')](function(_0x3f1c48){return db[_0xf94d('0x6f')]['transaction'](function(_0x4d34fa){return _0x3f1c48['removeTeams'](_0x3f46b4[_0xf94d('0x3e')]['ids'],{'transaction':_0x4d34fa})[_0xf94d('0x2b')](function(){if(!_[_0xf94d('0x87')](_0xfb251d)){return _0x3f1c48[_0xf94d('0x88')](_0xfb251d,{'transaction':_0x4d34fa});}})[_0xf94d('0x2b')](function(){_0xfb251d['forEach'](function(_0x5502ae){socket[_0xf94d('0x71')](_0xf94d('0x89'),{'UserId':_0x5502ae,'FaxQueueId':_0x3f1c48['id']});});});});});});})[_0xf94d('0x2b')](respondWithStatusCode(_0x39251a,null))['catch'](handleError(_0x39251a,null));};exports[_0xf94d('0x8a')]=function(_0x1b570d,_0x58d008,_0x35abd8){return db[_0xf94d('0x46')][_0xf94d('0x4f')]({'where':{'id':_0x1b570d[_0xf94d('0x4c')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x58d008,null))[_0xf94d('0x2b')](function(_0x3de020){if(_0x3de020){return _0x3de020[_0xf94d('0x8a')](_0x1b570d[_0xf94d('0x51')][_0xf94d('0x74')],_['omit'](_0x1b570d[_0xf94d('0x51')],['ids','id'])||{})[_0xf94d('0x8b')](function(_0x4ae9a9){for(var _0x1aa044=0x0;_0x1aa044<_0x1b570d[_0xf94d('0x51')][_0xf94d('0x74')]['length'];_0x1aa044+=0x1){socket[_0xf94d('0x71')](_0xf94d('0x72'),{'UserId':_0x1b570d['body'][_0xf94d('0x74')][_0x1aa044],'FaxQueueId':_0x1b570d[_0xf94d('0x4c')]['id']});}return _0x4ae9a9;});}})[_0xf94d('0x2b')](respondWithResult(_0x58d008,null))['catch'](handleError(_0x58d008,null));};exports[_0xf94d('0x88')]=function(_0x371d77,_0x1b5d77,_0x4301da){return db[_0xf94d('0x46')][_0xf94d('0x4f')]({'where':{'id':_0x371d77['params']['id']}})['then'](handleEntityNotFound(_0x1b5d77,null))[_0xf94d('0x2b')](function(_0x33b28d){if(_0x33b28d){return _0x33b28d[_0xf94d('0x88')](_0x371d77[_0xf94d('0x3e')][_0xf94d('0x74')])[_0xf94d('0x2b')](function(){if(_[_0xf94d('0x8c')](_0x371d77['query']['ids'])){for(var _0x10336c=0x0;_0x10336c<_0x371d77[_0xf94d('0x3e')]['ids'][_0xf94d('0x3c')];_0x10336c+=0x1){socket[_0xf94d('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x371d77[_0xf94d('0x3e')][_0xf94d('0x74')][_0x10336c]),'FaxQueueId':Number(_0x371d77[_0xf94d('0x4c')]['id'])});}}else{socket[_0xf94d('0x71')](_0xf94d('0x89'),{'UserId':Number(_0x371d77['query']['ids']),'FaxQueueId':Number(_0x371d77[_0xf94d('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b5d77,null))['catch'](handleError(_0x1b5d77,null));};exports[_0xf94d('0x8d')]=function(_0x266eb8,_0xb88144,_0x3c4021){var _0x3a67ba={};var _0x30449e={};var _0x19cf3d;var _0x1bf58a;return db['FaxQueue'][_0xf94d('0x59')]({'where':{'id':_0x266eb8['params']['id']}})['then'](handleEntityNotFound(_0xb88144,null))[_0xf94d('0x2b')](function(_0x525c37){if(_0x525c37){_0x19cf3d=_0x525c37;_0x30449e[_0xf94d('0x38')]=_[_0xf94d('0x36')](db[_0xf94d('0x5e')][_0xf94d('0x4d')]);_0x30449e[_0xf94d('0x3e')]=_[_0xf94d('0x36')](_0x266eb8['query']);_0x30449e[_0xf94d('0x37')]=_[_0xf94d('0x3a')](_0x30449e[_0xf94d('0x38')],_0x30449e[_0xf94d('0x3e')]);_0x3a67ba[_0xf94d('0x39')]=_[_0xf94d('0x3a')](_0x30449e[_0xf94d('0x38')],qs['fields'](_0x266eb8['query'][_0xf94d('0x3b')]));_0x3a67ba['attributes']=_0x3a67ba[_0xf94d('0x39')][_0xf94d('0x3c')]?_0x3a67ba[_0xf94d('0x39')]:_0x30449e['model'];_0x3a67ba[_0xf94d('0x3f')]=qs[_0xf94d('0x40')](_0x266eb8['query'][_0xf94d('0x40')]);_0x3a67ba['where']=qs[_0xf94d('0x37')](_[_0xf94d('0x42')](_0x266eb8[_0xf94d('0x3e')],_0x30449e['filters']));if(_0x266eb8['query'][_0xf94d('0x43')]){_0x3a67ba[_0xf94d('0x41')]=_[_0xf94d('0x45')](_0x3a67ba['where'],{'$or':_[_0xf94d('0x35')](_0x3a67ba[_0xf94d('0x39')],function(_0x4f0a3e){var _0x3de0c8={};_0x3de0c8[_0x4f0a3e]={'$like':'%'+_0x266eb8[_0xf94d('0x3e')]['filter']+'%'};return _0x3de0c8;})});}_0x3a67ba=_[_0xf94d('0x45')]({},_0x3a67ba,_0x266eb8[_0xf94d('0x4e')]);return _0x19cf3d[_0xf94d('0x8d')](_0x3a67ba);}})[_0xf94d('0x2b')](function(_0x140658){if(_0x140658){_0x1bf58a=_0x140658['length'];if(!_0x266eb8[_0xf94d('0x3e')][_0xf94d('0x5a')](_0xf94d('0x8e'))){_0x3a67ba['limit']=qs[_0xf94d('0x3d')](_0x266eb8[_0xf94d('0x3e')][_0xf94d('0x3d')]);_0x3a67ba['offset']=qs['offset'](_0x266eb8[_0xf94d('0x3e')][_0xf94d('0x24')]);}return _0x19cf3d[_0xf94d('0x8d')](_0x3a67ba);}})[_0xf94d('0x2b')](function(_0x1ffffa){if(_0x1ffffa){return _0x1ffffa?{'count':_0x1bf58a,'rows':_0x1ffffa}:null;}})[_0xf94d('0x2b')](respondWithResult(_0xb88144,null))[_0xf94d('0x4a')](handleError(_0xb88144,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index dbff628..26e64c7 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 _0xb217=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x297fcf,_0x552332){var _0x226115=function(_0x579bd0){while(--_0x579bd0){_0x297fcf['push'](_0x297fcf['shift']());}};_0x226115(++_0x552332);}(_0xb217,0xdb));var _0x7b21=function(_0x1ea56f,_0xfd6b47){_0x1ea56f=_0x1ea56f-0x0;var _0x194a87=_0xb217[_0x1ea56f];return _0x194a87;};'use strict';var EventEmitter=require(_0x7b21('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7b21('0x1')](0x0);var events={'afterCreate':_0x7b21('0x2'),'afterUpdate':_0x7b21('0x3'),'afterDestroy':_0x7b21('0x4')};function emitEvent(_0x4fa786){return function(_0x22737f,_0x3915ce,_0x5daf37){FaxQueueEvents[_0x7b21('0x5')](_0x4fa786+':'+_0x22737f['id'],_0x22737f);FaxQueueEvents[_0x7b21('0x5')](_0x4fa786,_0x22737f);_0x5daf37(null);};}for(var e in events){if(events[_0x7b21('0x6')](e)){var event=events[e];FaxQueue[_0x7b21('0x7')](e,emitEvent(event));}}module[_0x7b21('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x88d2=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88d2,0x94));var _0x288d=function(_0x24d2d9,_0x3ba9aa){_0x24d2d9=_0x24d2d9-0x0;var _0x46a992=_0x88d2[_0x24d2d9];return _0x46a992;};'use strict';var EventEmitter=require(_0x288d('0x0'));var FaxQueue=require(_0x288d('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x288d('0x2')](0x0);var events={'afterCreate':_0x288d('0x3'),'afterUpdate':_0x288d('0x4'),'afterDestroy':_0x288d('0x5')};function emitEvent(_0x3a7ee6){return function(_0x3aa00e,_0x3a7c5e,_0x13ee01){FaxQueueEvents[_0x288d('0x6')](_0x3a7ee6+':'+_0x3aa00e['id'],_0x3aa00e);FaxQueueEvents[_0x288d('0x6')](_0x3a7ee6,_0x3aa00e);_0x13ee01(null);};}for(var e in events){if(events[_0x288d('0x7')](e)){var event=events[e];FaxQueue[_0x288d('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 27bf287..057be68 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 _0x81ae=['moment','bluebird','path','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x81ae,0x152));var _0xe81a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x81ae[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe81a('0x0'));var util=require('util');var logger=require(_0xe81a('0x1'))(_0xe81a('0x2'));var moment=require(_0xe81a('0x3'));var BPromise=require(_0xe81a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe81a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe81a('0x6'));module[_0xe81a('0x7')]=function(_0x2b7d51,_0x26804c){return _0x2b7d51[_0xe81a('0x8')](_0xe81a('0x9'),attributes,{'tableName':_0xe81a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf06b=['./faxQueue.attributes','exports','FaxQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0xf06b,0xb7));var _0xbf06=function(_0x5cd084,_0x1aefb1){_0x5cd084=_0x5cd084-0x0;var _0x12a08b=_0xf06b[_0x5cd084];return _0x12a08b;};'use strict';var _=require('lodash');var util=require(_0xbf06('0x0'));var logger=require(_0xbf06('0x1'))(_0xbf06('0x2'));var moment=require(_0xbf06('0x3'));var BPromise=require(_0xbf06('0x4'));var rp=require(_0xbf06('0x5'));var fs=require('fs');var path=require(_0xbf06('0x6'));var rimraf=require(_0xbf06('0x7'));var config=require(_0xbf06('0x8'));var attributes=require(_0xbf06('0x9'));module[_0xbf06('0xa')]=function(_0xdc278c,_0x46e74c){return _0xdc278c['define'](_0xbf06('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index c8483f5..b8e9e1d 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 _0x3a7f=['rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','FaxQueue,\x20%s,\x20%s','message','FaxQueue','options','raw','where','limit','include','map','model','attributes','GetFaxQueue','stringify','ShowFaxQueue','find','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3a7f,0x103));var _0xf3a7=function(_0x3e841c,_0x6eccf0){_0x3e841c=_0x3e841c-0x0;var _0x502104=_0x3a7f[_0x3e841c];return _0x502104;};'use strict';var _=require(_0xf3a7('0x0'));var util=require(_0xf3a7('0x1'));var moment=require(_0xf3a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a7('0x3'));var db=require(_0xf3a7('0x4'))['db'];var utils=require(_0xf3a7('0x5'));var logger=require(_0xf3a7('0x6'))(_0xf3a7('0x7'));var config=require(_0xf3a7('0x8'));var jayson=require(_0xf3a7('0x9'));var client=jayson[_0xf3a7('0xa')]['http']({'port':0x232a});config[_0xf3a7('0xb')]=_['defaults'](config[_0xf3a7('0xb')],{'host':_0xf3a7('0xc'),'port':0x18eb});var socket=require(_0xf3a7('0xd'))(new Redis(config[_0xf3a7('0xb')]));require('./faxQueue.socket')[_0xf3a7('0xe')](socket);function respondWithRpcPromise(_0x5aa73a,_0x449cfc,_0x4b9618){return new BPromise(function(_0x37efbe,_0x3faefc){return client[_0xf3a7('0xf')](_0x5aa73a,_0x4b9618)[_0xf3a7('0x10')](function(_0x3f7178){logger[_0xf3a7('0x11')]('FaxQueue,\x20%s,\x20%s',_0x449cfc,_0xf3a7('0x12'));logger[_0xf3a7('0x13')](_0xf3a7('0x14'),_0x449cfc,_0xf3a7('0x12'),JSON['stringify'](_0x3f7178));if(_0x3f7178[_0xf3a7('0x15')]){if(_0x3f7178[_0xf3a7('0x15')]['code']===0x1f4){logger[_0xf3a7('0x15')](_0xf3a7('0x16'),_0x449cfc,_0x3f7178[_0xf3a7('0x15')]['message']);return _0x3faefc(_0x3f7178['error']['message']);}logger[_0xf3a7('0x15')](_0xf3a7('0x16'),_0x449cfc,_0x3f7178[_0xf3a7('0x15')][_0xf3a7('0x17')]);return _0x37efbe(_0x3f7178[_0xf3a7('0x15')][_0xf3a7('0x17')]);}else{logger['info'](_0xf3a7('0x16'),_0x449cfc,_0xf3a7('0x12'));_0x37efbe(_0x3f7178['result'][_0xf3a7('0x17')]);}})['catch'](function(_0xe91ed){logger['error'](_0xf3a7('0x16'),_0x449cfc,_0xe91ed);_0x3faefc(_0xe91ed);});});}exports['GetFaxQueue']=function(_0x2ebbfe){var _0x3601e1=this;return new Promise(function(_0x40de4d,_0x359938){return db[_0xf3a7('0x18')]['findAll']({'raw':_0x2ebbfe[_0xf3a7('0x19')]?_0x2ebbfe[_0xf3a7('0x19')][_0xf3a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ebbfe[_0xf3a7('0x19')]?_0x2ebbfe[_0xf3a7('0x19')][_0xf3a7('0x1b')]||null:null,'attributes':_0x2ebbfe[_0xf3a7('0x19')]?_0x2ebbfe[_0xf3a7('0x19')]['attributes']||null:null,'limit':_0x2ebbfe[_0xf3a7('0x19')]?_0x2ebbfe[_0xf3a7('0x19')][_0xf3a7('0x1c')]||null:null,'include':_0x2ebbfe[_0xf3a7('0x19')]?_0x2ebbfe[_0xf3a7('0x19')][_0xf3a7('0x1d')]?_[_0xf3a7('0x1e')](_0x2ebbfe[_0xf3a7('0x19')][_0xf3a7('0x1d')],function(_0x158ea9){return{'model':db[_0x158ea9[_0xf3a7('0x1f')]],'as':_0x158ea9['as'],'attributes':_0x158ea9[_0xf3a7('0x20')],'include':_0x158ea9[_0xf3a7('0x1d')]?_[_0xf3a7('0x1e')](_0x158ea9[_0xf3a7('0x1d')],function(_0x1c8c7e){return{'model':db[_0x1c8c7e[_0xf3a7('0x1f')]],'as':_0x1c8c7e['as'],'attributes':_0x1c8c7e[_0xf3a7('0x20')],'include':_0x1c8c7e[_0xf3a7('0x1d')]?_[_0xf3a7('0x1e')](_0x1c8c7e[_0xf3a7('0x1d')],function(_0x44ae8c){return{'model':db[_0x44ae8c['model']],'as':_0x44ae8c['as'],'attributes':_0x44ae8c[_0xf3a7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f088c){logger[_0xf3a7('0x11')](_0xf3a7('0x21'),_0x2ebbfe);logger[_0xf3a7('0x13')](_0xf3a7('0x21'),_0x2ebbfe,JSON[_0xf3a7('0x22')](_0x2f088c));_0x40de4d(_0x2f088c);})['catch'](function(_0x450977){logger['error'](_0xf3a7('0x21'),_0x450977[_0xf3a7('0x17')],_0x2ebbfe);_0x359938(_0x3601e1[_0xf3a7('0x15')](0x1f4,_0x450977[_0xf3a7('0x17')]));});});};exports[_0xf3a7('0x23')]=function(_0x57632a){var _0x12ffa1=this;return new Promise(function(_0x2c9839,_0x164a96){return db['FaxQueue'][_0xf3a7('0x24')]({'raw':_0x57632a[_0xf3a7('0x19')]?_0x57632a[_0xf3a7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57632a[_0xf3a7('0x19')]?_0x57632a[_0xf3a7('0x19')][_0xf3a7('0x1b')]||null:null,'attributes':_0x57632a[_0xf3a7('0x19')]?_0x57632a[_0xf3a7('0x19')][_0xf3a7('0x20')]||null:null,'include':_0x57632a['options']?_0x57632a[_0xf3a7('0x19')][_0xf3a7('0x1d')]?_['map'](_0x57632a[_0xf3a7('0x19')]['include'],function(_0x1ccc26){return{'model':db[_0x1ccc26[_0xf3a7('0x1f')]],'as':_0x1ccc26['as'],'attributes':_0x1ccc26[_0xf3a7('0x20')],'include':_0x1ccc26['include']?_[_0xf3a7('0x1e')](_0x1ccc26[_0xf3a7('0x1d')],function(_0x41f9b5){return{'model':db[_0x41f9b5['model']],'as':_0x41f9b5['as'],'attributes':_0x41f9b5[_0xf3a7('0x20')],'include':_0x41f9b5[_0xf3a7('0x1d')]?_[_0xf3a7('0x1e')](_0x41f9b5['include'],function(_0x185765){return{'model':db[_0x185765['model']],'as':_0x185765['as'],'attributes':_0x185765['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3a7('0x10')](function(_0x5d9362){logger['info'](_0xf3a7('0x23'),_0x57632a);logger[_0xf3a7('0x13')](_0xf3a7('0x23'),_0x57632a,JSON['stringify'](_0x5d9362));_0x2c9839(_0x5d9362);})[_0xf3a7('0x25')](function(_0x43d8b4){logger[_0xf3a7('0x15')](_0xf3a7('0x23'),_0x43d8b4[_0xf3a7('0x17')],_0x57632a);_0x164a96(_0x12ffa1['error'](0x1f4,_0x43d8b4['message']));});});}; \ No newline at end of file +var _0xf4a1=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','find','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request'];(function(_0x4f2e4b,_0x2d084c){var _0x3afdbb=function(_0x14b574){while(--_0x14b574){_0x4f2e4b['push'](_0x4f2e4b['shift']());}};_0x3afdbb(++_0x2d084c);}(_0xf4a1,0x1dc));var _0x1f4a=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xf4a1[_0x99868f];return _0x27a71b;};'use strict';var _=require('lodash');var util=require(_0x1f4a('0x0'));var moment=require(_0x1f4a('0x1'));var BPromise=require(_0x1f4a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f4a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f4a('0x4'));var logger=require('../../config/logger')(_0x1f4a('0x5'));var config=require(_0x1f4a('0x6'));var jayson=require(_0x1f4a('0x7'));var client=jayson[_0x1f4a('0x8')][_0x1f4a('0x9')]({'port':0x232a});config[_0x1f4a('0xa')]=_['defaults'](config[_0x1f4a('0xa')],{'host':_0x1f4a('0xb'),'port':0x18eb});var socket=require(_0x1f4a('0xc'))(new Redis(config[_0x1f4a('0xa')]));require(_0x1f4a('0xd'))[_0x1f4a('0xe')](socket);function respondWithRpcPromise(_0x514212,_0x209404,_0x37680c){return new BPromise(function(_0x4af3f6,_0x32c404){return client[_0x1f4a('0xf')](_0x514212,_0x37680c)[_0x1f4a('0x10')](function(_0x3d1022){logger[_0x1f4a('0x11')](_0x1f4a('0x12'),_0x209404,_0x1f4a('0x13'));logger[_0x1f4a('0x14')](_0x1f4a('0x15'),_0x209404,_0x1f4a('0x13'),JSON[_0x1f4a('0x16')](_0x3d1022));if(_0x3d1022[_0x1f4a('0x17')]){if(_0x3d1022['error'][_0x1f4a('0x18')]===0x1f4){logger[_0x1f4a('0x17')]('FaxQueue,\x20%s,\x20%s',_0x209404,_0x3d1022[_0x1f4a('0x17')][_0x1f4a('0x19')]);return _0x32c404(_0x3d1022[_0x1f4a('0x17')]['message']);}logger[_0x1f4a('0x17')](_0x1f4a('0x12'),_0x209404,_0x3d1022['error'][_0x1f4a('0x19')]);return _0x4af3f6(_0x3d1022[_0x1f4a('0x17')][_0x1f4a('0x19')]);}else{logger['info'](_0x1f4a('0x12'),_0x209404,_0x1f4a('0x13'));_0x4af3f6(_0x3d1022[_0x1f4a('0x1a')]['message']);}})[_0x1f4a('0x1b')](function(_0x37c010){logger[_0x1f4a('0x17')](_0x1f4a('0x12'),_0x209404,_0x37c010);_0x32c404(_0x37c010);});});}exports[_0x1f4a('0x1c')]=function(_0x1315c3){var _0xbec4be=this;return new Promise(function(_0x1df640,_0x302dd0){return db[_0x1f4a('0x1d')][_0x1f4a('0x1e')]({'raw':_0x1315c3[_0x1f4a('0x1f')]?_0x1315c3[_0x1f4a('0x1f')][_0x1f4a('0x20')]===undefined?!![]:![]:!![],'where':_0x1315c3[_0x1f4a('0x1f')]?_0x1315c3['options'][_0x1f4a('0x21')]||null:null,'attributes':_0x1315c3[_0x1f4a('0x1f')]?_0x1315c3[_0x1f4a('0x1f')][_0x1f4a('0x22')]||null:null,'limit':_0x1315c3[_0x1f4a('0x1f')]?_0x1315c3[_0x1f4a('0x1f')][_0x1f4a('0x23')]||null:null,'include':_0x1315c3[_0x1f4a('0x1f')]?_0x1315c3[_0x1f4a('0x1f')]['include']?_[_0x1f4a('0x24')](_0x1315c3[_0x1f4a('0x1f')][_0x1f4a('0x25')],function(_0x279d2e){return{'model':db[_0x279d2e[_0x1f4a('0x26')]],'as':_0x279d2e['as'],'attributes':_0x279d2e[_0x1f4a('0x22')],'include':_0x279d2e[_0x1f4a('0x25')]?_[_0x1f4a('0x24')](_0x279d2e[_0x1f4a('0x25')],function(_0x52fe61){return{'model':db[_0x52fe61[_0x1f4a('0x26')]],'as':_0x52fe61['as'],'attributes':_0x52fe61[_0x1f4a('0x22')],'include':_0x52fe61[_0x1f4a('0x25')]?_[_0x1f4a('0x24')](_0x52fe61[_0x1f4a('0x25')],function(_0x20d31a){return{'model':db[_0x20d31a[_0x1f4a('0x26')]],'as':_0x20d31a['as'],'attributes':_0x20d31a[_0x1f4a('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53b6a2){logger[_0x1f4a('0x11')]('GetFaxQueue',_0x1315c3);logger['debug']('GetFaxQueue',_0x1315c3,JSON[_0x1f4a('0x16')](_0x53b6a2));_0x1df640(_0x53b6a2);})[_0x1f4a('0x1b')](function(_0x4570d1){logger['error'](_0x1f4a('0x1c'),_0x4570d1[_0x1f4a('0x19')],_0x1315c3);_0x302dd0(_0xbec4be['error'](0x1f4,_0x4570d1[_0x1f4a('0x19')]));});});};exports[_0x1f4a('0x27')]=function(_0x5ded4a){var _0x5251c5=this;return new Promise(function(_0x1df3da,_0x418513){return db[_0x1f4a('0x1d')][_0x1f4a('0x28')]({'raw':_0x5ded4a['options']?_0x5ded4a[_0x1f4a('0x1f')][_0x1f4a('0x20')]===undefined?!![]:![]:!![],'where':_0x5ded4a[_0x1f4a('0x1f')]?_0x5ded4a[_0x1f4a('0x1f')]['where']||null:null,'attributes':_0x5ded4a[_0x1f4a('0x1f')]?_0x5ded4a['options'][_0x1f4a('0x22')]||null:null,'include':_0x5ded4a[_0x1f4a('0x1f')]?_0x5ded4a[_0x1f4a('0x1f')][_0x1f4a('0x25')]?_[_0x1f4a('0x24')](_0x5ded4a['options'][_0x1f4a('0x25')],function(_0x528744){return{'model':db[_0x528744[_0x1f4a('0x26')]],'as':_0x528744['as'],'attributes':_0x528744['attributes'],'include':_0x528744['include']?_[_0x1f4a('0x24')](_0x528744['include'],function(_0x2467cc){return{'model':db[_0x2467cc[_0x1f4a('0x26')]],'as':_0x2467cc['as'],'attributes':_0x2467cc[_0x1f4a('0x22')],'include':_0x2467cc[_0x1f4a('0x25')]?_[_0x1f4a('0x24')](_0x2467cc[_0x1f4a('0x25')],function(_0x4eb371){return{'model':db[_0x4eb371[_0x1f4a('0x26')]],'as':_0x4eb371['as'],'attributes':_0x4eb371[_0x1f4a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1f4a('0x10')](function(_0x121c1f){logger[_0x1f4a('0x11')]('ShowFaxQueue',_0x5ded4a);logger[_0x1f4a('0x14')]('ShowFaxQueue',_0x5ded4a,JSON['stringify'](_0x121c1f));_0x1df3da(_0x121c1f);})[_0x1f4a('0x1b')](function(_0x5a2743){logger[_0x1f4a('0x17')](_0x1f4a('0x27'),_0x5a2743[_0x1f4a('0x19')],_0x5ded4a);_0x418513(_0x5251c5[_0x1f4a('0x17')](0x1f4,_0x5a2743['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ff95e7d..5d30db1 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 _0x9725=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','emit'];(function(_0x57b5c0,_0x5264ca){var _0x198f8a=function(_0x3da54a){while(--_0x3da54a){_0x57b5c0['push'](_0x57b5c0['shift']());}};_0x198f8a(++_0x5264ca);}(_0x9725,0x174));var _0x5972=function(_0x1ffeec,_0x266855){_0x1ffeec=_0x1ffeec-0x0;var _0x12b142=_0x9725[_0x1ffeec];return _0x12b142;};'use strict';var FaxQueueEvents=require(_0x5972('0x0'));var events=[_0x5972('0x1'),_0x5972('0x2'),'update'];function createListener(_0xc02611,_0x216778){return function(_0x52f63a){_0x216778[_0x5972('0x3')](_0xc02611,_0x52f63a);};}function removeListener(_0x2bf8cc,_0x2b80fb){return function(){FaxQueueEvents[_0x5972('0x4')](_0x2bf8cc,_0x2b80fb);};}exports[_0x5972('0x5')]=function(_0x5b6f22){for(var _0x347cd6=0x0,_0x51b984=events[_0x5972('0x6')];_0x347cd6<_0x51b984;_0x347cd6++){var _0x31dc7d=events[_0x347cd6];var _0x4cd87c=createListener(_0x5972('0x7')+_0x31dc7d,_0x5b6f22);FaxQueueEvents['on'](_0x31dc7d,_0x4cd87c);}}; \ No newline at end of file +var _0x5cd1=['length','./faxQueue.events','save','remove','update'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x5cd1,0x137));var _0x15cd=function(_0xb7fdde,_0x512432){_0xb7fdde=_0xb7fdde-0x0;var _0x39ef79=_0x5cd1[_0xb7fdde];return _0x39ef79;};'use strict';var FaxQueueEvents=require(_0x15cd('0x0'));var events=[_0x15cd('0x1'),_0x15cd('0x2'),_0x15cd('0x3')];function createListener(_0x4907f1,_0x234786){return function(_0x1aef0f){_0x234786['emit'](_0x4907f1,_0x1aef0f);};}function removeListener(_0x2d55b2,_0x547907){return function(){FaxQueueEvents['removeListener'](_0x2d55b2,_0x547907);};}exports['register']=function(_0x4bf925){for(var _0x5eb329=0x0,_0x4d99d5=events[_0x15cd('0x4')];_0x5eb329<_0x4d99d5;_0x5eb329++){var _0x3b1402=events[_0x5eb329];var _0xeef87e=createListener('faxQueue:'+_0x3b1402,_0x4bf925);FaxQueueEvents['on'](_0x3b1402,_0xeef87e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7873c1a..9537b50 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1e7f4d,_0x20acaa){_0x1e7f4d=_0x1e7f4d-0x0;var _0x5f0fd9=_0x0b0e[_0x1e7f4d];return _0x5f0fd9;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0x0b0e[_0xd413a4];return _0x9170f4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3a5026f..8120e3d 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 _0xac87=['DATE','sequelize','STRING'];(function(_0x2aef93,_0x2d691c){var _0x597efb=function(_0x1eeaba){while(--_0x1eeaba){_0x2aef93['push'](_0x2aef93['shift']());}};_0x597efb(++_0x2d691c);}(_0xac87,0xd3));var _0x7ac8=function(_0x347183,_0x41a4d7){_0x347183=_0x347183-0x0;var _0x5ef6cc=_0xac87[_0x347183];return _0x5ef6cc;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ac8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7ac8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7ac8('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7ac8('0x2')]},'exitAt':{'type':Sequelize[_0x7ac8('0x2')]},'reason':{'type':Sequelize[_0x7ac8('0x1')]}}; \ No newline at end of file +var _0x660d=['STRING','DATE','moment','sequelize'];(function(_0x4829aa,_0x521ae6){var _0x44d8dd=function(_0x2e30a5){while(--_0x2e30a5){_0x4829aa['push'](_0x4829aa['shift']());}};_0x44d8dd(++_0x521ae6);}(_0x660d,0xaa));var _0xd660=function(_0x4184f9,_0x1c90c0){_0x4184f9=_0x4184f9-0x0;var _0x7256b0=_0x660d[_0x4184f9];return _0x7256b0;};'use strict';var moment=require(_0xd660('0x0'));var Sequelize=require(_0xd660('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd660('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd660('0x2')]},'joinAt':{'type':Sequelize[_0xd660('0x3')]},'leaveAt':{'type':Sequelize[_0xd660('0x3')]},'acceptAt':{'type':Sequelize[_0xd660('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 82f8933..e72696c 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 _0x483e=['merge','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','options','FaxQueueReport','then','findAll','rows','catch','show','params','includeAll','include'];(function(_0x52621f,_0xb5e6e7){var _0x56f661=function(_0x2e02f3){while(--_0x2e02f3){_0x52621f['push'](_0x52621f['shift']());}};_0x56f661(++_0xb5e6e7);}(_0x483e,0x1d3));var _0xe483=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x483e[_0x4b5813];return _0x423465;};'use strict';var pdf=require(_0xe483('0x0'));var emlformat=require(_0xe483('0x1'));var rimraf=require(_0xe483('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe483('0x3'));var rp=require('request-promise');var moment=require(_0xe483('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe483('0x5'));var util=require(_0xe483('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe483('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe483('0x8'));var squel=require(_0xe483('0x9'));var crypto=require(_0xe483('0xa'));var jsforce=require(_0xe483('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe483('0xc'));var Papa=require(_0xe483('0xd'));var Redis=require(_0xe483('0xe'));var authService=require(_0xe483('0xf'));var qs=require(_0xe483('0x10'));var as=require(_0xe483('0x11'));var hardwareService=require(_0xe483('0x12'));var logger=require('../../config/logger')(_0xe483('0x13'));var utils=require(_0xe483('0x14'));var config=require(_0xe483('0x15'));var db=require(_0xe483('0x16'))['db'];function respondWithStatusCode(_0x384c78,_0x1b93fc){_0x1b93fc=_0x1b93fc||0xcc;return function(_0x53a268){if(_0x53a268){return _0x384c78[_0xe483('0x17')](_0x1b93fc);}return _0x384c78[_0xe483('0x18')](_0x1b93fc)[_0xe483('0x19')]();};}function respondWithResult(_0x259404,_0xf6e322){_0xf6e322=_0xf6e322||0xc8;return function(_0x524384){if(_0x524384){return _0x259404[_0xe483('0x18')](_0xf6e322)[_0xe483('0x1a')](_0x524384);}};}function respondWithFilteredResult(_0x4b8e3b,_0x23d663){return function(_0x38db57){if(_0x38db57){var _0x44ef83=_0x38db57[_0xe483('0x1b')],_0x38e14b=_0x23d663[_0xe483('0x1c')],_0xc31d61=_0x23d663[_0xe483('0x1c')]+_0x23d663['limit'],_0xe40aed;if(_0xc31d61>=_0x44ef83){_0xc31d61=_0x44ef83;_0xe40aed=0xc8;}else{_0xe40aed=0xce;}_0x4b8e3b[_0xe483('0x18')](_0xe40aed);return _0x4b8e3b[_0xe483('0x1d')]('Content-Range',_0x38e14b+'-'+_0xc31d61+'/'+_0x44ef83)['json'](_0x38db57);}return null;};}function patchUpdates(_0x5b119a){return function(_0x28539e){try{jsonpatch[_0xe483('0x1e')](_0x28539e,_0x5b119a,!![]);}catch(_0x52971a){return BPromise[_0xe483('0x1f')](_0x52971a);}return _0x28539e[_0xe483('0x20')]();};}function saveUpdates(_0x14d96d,_0x3d9f40){return function(_0x13f183){if(_0x13f183){return _0x13f183[_0xe483('0x21')](_0x14d96d)['then'](function(_0x28fe75){return _0x28fe75;});}return null;};}function removeEntity(_0xb01d50,_0x55a01b){return function(_0x4e8447){if(_0x4e8447){return _0x4e8447[_0xe483('0x22')]()['then'](function(){_0xb01d50['status'](0xcc)[_0xe483('0x19')]();});}};}function handleEntityNotFound(_0x1c5683,_0x3f39b6){return function(_0x1cde45){if(!_0x1cde45){_0x1c5683[_0xe483('0x17')](0x194);}return _0x1cde45;};}function handleError(_0x52fd2d,_0x15e6aa){_0x15e6aa=_0x15e6aa||0x1f4;return function(_0x1dafc7){logger[_0xe483('0x23')](_0x1dafc7[_0xe483('0x24')]);if(_0x1dafc7['name']){delete _0x1dafc7[_0xe483('0x25')];}_0x52fd2d[_0xe483('0x18')](_0x15e6aa)[_0xe483('0x26')](_0x1dafc7);};}exports[_0xe483('0x27')]=function(_0x3d9ae0,_0x42a2bd){var _0x46e74b={},_0x24c866={},_0xba7532={'count':0x0,'rows':[]};var _0x22b266=_[_0xe483('0x28')](db['FaxQueueReport'][_0xe483('0x29')],function(_0x5aba17){return{'name':_0x5aba17[_0xe483('0x2a')],'type':_0x5aba17[_0xe483('0x2b')][_0xe483('0x2c')]};});_0x24c866['model']=_[_0xe483('0x28')](_0x22b266,'name');_0x24c866[_0xe483('0x2d')]=_[_0xe483('0x2e')](_0x3d9ae0[_0xe483('0x2d')]);_0x24c866[_0xe483('0x2f')]=_['intersection'](_0x24c866[_0xe483('0x30')],_0x24c866[_0xe483('0x2d')]);_0x46e74b[_0xe483('0x31')]=_[_0xe483('0x32')](_0x24c866[_0xe483('0x30')],qs[_0xe483('0x33')](_0x3d9ae0[_0xe483('0x2d')][_0xe483('0x33')]));_0x46e74b[_0xe483('0x31')]=_0x46e74b['attributes'][_0xe483('0x34')]?_0x46e74b[_0xe483('0x31')]:_0x24c866['model'];if(!_0x3d9ae0['query'][_0xe483('0x35')](_0xe483('0x36'))){_0x46e74b['limit']=qs['limit'](_0x3d9ae0[_0xe483('0x2d')][_0xe483('0x37')]);_0x46e74b[_0xe483('0x1c')]=qs[_0xe483('0x1c')](_0x3d9ae0[_0xe483('0x2d')][_0xe483('0x1c')]);}_0x46e74b[_0xe483('0x38')]=qs[_0xe483('0x39')](_0x3d9ae0['query'][_0xe483('0x39')]);_0x46e74b[_0xe483('0x3a')]=qs[_0xe483('0x2f')](_[_0xe483('0x3b')](_0x3d9ae0[_0xe483('0x2d')],_0x24c866[_0xe483('0x2f')]),_0x22b266);if(_0x3d9ae0[_0xe483('0x2d')]['filter']){_0x46e74b[_0xe483('0x3a')]=_['merge'](_0x46e74b[_0xe483('0x3a')],{'$or':_[_0xe483('0x28')](_0x22b266,function(_0x4c4aa3){if(_0x4c4aa3['type']!==_0xe483('0x3c')){var _0x3be813={};_0x3be813[_0x4c4aa3[_0xe483('0x25')]]={'$like':'%'+_0x3d9ae0[_0xe483('0x2d')][_0xe483('0x3d')]+'%'};return _0x3be813;}})});}_0x46e74b=_['merge']({},_0x46e74b,_0x3d9ae0[_0xe483('0x3e')]);var _0x3413d4={'where':_0x46e74b['where']};return db[_0xe483('0x3f')][_0xe483('0x1b')](_0x3413d4)[_0xe483('0x40')](function(_0x154277){_0xba7532[_0xe483('0x1b')]=_0x154277;if(_0x3d9ae0['query']['includeAll']){_0x46e74b['include']=[{'all':!![]}];}return db[_0xe483('0x3f')][_0xe483('0x41')](_0x46e74b);})[_0xe483('0x40')](function(_0x2e992e){_0xba7532[_0xe483('0x42')]=_0x2e992e;return _0xba7532;})[_0xe483('0x40')](respondWithFilteredResult(_0x42a2bd,_0x46e74b))[_0xe483('0x43')](handleError(_0x42a2bd,null));};exports[_0xe483('0x44')]=function(_0x58aac2,_0x26b2d9){var _0x165303={'raw':!![],'where':{'id':_0x58aac2[_0xe483('0x45')]['id']}},_0x1ab5d8={};_0x1ab5d8['model']=_['keys'](db['FaxQueueReport'][_0xe483('0x29')]);_0x1ab5d8[_0xe483('0x2d')]=_['keys'](_0x58aac2[_0xe483('0x2d')]);_0x1ab5d8[_0xe483('0x2f')]=_['intersection'](_0x1ab5d8[_0xe483('0x30')],_0x1ab5d8[_0xe483('0x2d')]);_0x165303[_0xe483('0x31')]=_[_0xe483('0x32')](_0x1ab5d8[_0xe483('0x30')],qs[_0xe483('0x33')](_0x58aac2['query'][_0xe483('0x33')]));_0x165303['attributes']=_0x165303['attributes']['length']?_0x165303[_0xe483('0x31')]:_0x1ab5d8[_0xe483('0x30')];if(_0x58aac2[_0xe483('0x2d')][_0xe483('0x46')]){_0x165303[_0xe483('0x47')]=[{'all':!![]}];}_0x165303=_[_0xe483('0x48')]({},_0x165303,_0x58aac2[_0xe483('0x3e')]);return db[_0xe483('0x3f')][_0xe483('0x49')](_0x165303)[_0xe483('0x40')](handleEntityNotFound(_0x26b2d9,null))[_0xe483('0x40')](respondWithResult(_0x26b2d9,null))['catch'](handleError(_0x26b2d9,null));};exports[_0xe483('0x4a')]=function(_0x229027,_0x4357f1){return db[_0xe483('0x3f')][_0xe483('0x4a')](_0x229027[_0xe483('0x4b')],{})[_0xe483('0x40')](respondWithResult(_0x4357f1,0xc9))['catch'](handleError(_0x4357f1,null));};exports['update']=function(_0x43e53d,_0xd6936e){if(_0x43e53d[_0xe483('0x4b')]['id']){delete _0x43e53d[_0xe483('0x4b')]['id'];}return db[_0xe483('0x3f')]['find']({'where':{'id':_0x43e53d['params']['id']}})[_0xe483('0x40')](handleEntityNotFound(_0xd6936e,null))['then'](saveUpdates(_0x43e53d[_0xe483('0x4b')],null))['then'](respondWithResult(_0xd6936e,null))[_0xe483('0x43')](handleError(_0xd6936e,null));};exports['destroy']=function(_0x4edfe6,_0x3867ff){return db[_0xe483('0x3f')][_0xe483('0x49')]({'where':{'id':_0x4edfe6[_0xe483('0x45')]['id']}})[_0xe483('0x40')](handleEntityNotFound(_0x3867ff,null))['then'](removeEntity(_0x3867ff,null))[_0xe483('0x43')](handleError(_0x3867ff,null));};exports[_0xe483('0x4c')]=function(_0x3dc0a4,_0x3a11c2){return db[_0xe483('0x3f')][_0xe483('0x4c')]()['then'](respondWithResult(_0x3a11c2,null))['catch'](handleError(_0x3a11c2,null));}; \ No newline at end of file +var _0xfb1b=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','count','rows','catch','params','includeAll','include','find','create','body','describe'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0xfb1b,0x92));var _0xbfb1=function(_0x204237,_0x127e78){_0x204237=_0x204237-0x0;var _0x4bc6c6=_0xfb1b[_0x204237];return _0x4bc6c6;};'use strict';var pdf=require(_0xbfb1('0x0'));var emlformat=require(_0xbfb1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbfb1('0x2'));var jsonpatch=require(_0xbfb1('0x3'));var rp=require(_0xbfb1('0x4'));var moment=require(_0xbfb1('0x5'));var BPromise=require(_0xbfb1('0x6'));var Mustache=require(_0xbfb1('0x7'));var util=require(_0xbfb1('0x8'));var path=require(_0xbfb1('0x9'));var sox=require(_0xbfb1('0xa'));var csv=require(_0xbfb1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbfb1('0xc'));var squel=require(_0xbfb1('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfb1('0xe'));var deskjs=require(_0xbfb1('0xf'));var toCsv=require(_0xbfb1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbfb1('0x10'));var as=require(_0xbfb1('0x11'));var hardwareService=require(_0xbfb1('0x12'));var logger=require(_0xbfb1('0x13'))(_0xbfb1('0x14'));var utils=require('../../config/utils');var config=require(_0xbfb1('0x15'));var db=require(_0xbfb1('0x16'))['db'];function respondWithStatusCode(_0x15706b,_0x6f59a){_0x6f59a=_0x6f59a||0xcc;return function(_0x59f85e){if(_0x59f85e){return _0x15706b[_0xbfb1('0x17')](_0x6f59a);}return _0x15706b[_0xbfb1('0x18')](_0x6f59a)[_0xbfb1('0x19')]();};}function respondWithResult(_0x334881,_0x33b4a8){_0x33b4a8=_0x33b4a8||0xc8;return function(_0x65cbd0){if(_0x65cbd0){return _0x334881[_0xbfb1('0x18')](_0x33b4a8)[_0xbfb1('0x1a')](_0x65cbd0);}};}function respondWithFilteredResult(_0x58e591,_0x31a604){return function(_0x54d320){if(_0x54d320){var _0x252133=_0x54d320['count'],_0xf2da1c=_0x31a604[_0xbfb1('0x1b')],_0x339fba=_0x31a604[_0xbfb1('0x1b')]+_0x31a604['limit'],_0xa7ba31;if(_0x339fba>=_0x252133){_0x339fba=_0x252133;_0xa7ba31=0xc8;}else{_0xa7ba31=0xce;}_0x58e591[_0xbfb1('0x18')](_0xa7ba31);return _0x58e591[_0xbfb1('0x1c')](_0xbfb1('0x1d'),_0xf2da1c+'-'+_0x339fba+'/'+_0x252133)[_0xbfb1('0x1a')](_0x54d320);}return null;};}function patchUpdates(_0x2be28a){return function(_0x244b46){try{jsonpatch[_0xbfb1('0x1e')](_0x244b46,_0x2be28a,!![]);}catch(_0x1dfe4e){return BPromise[_0xbfb1('0x1f')](_0x1dfe4e);}return _0x244b46[_0xbfb1('0x20')]();};}function saveUpdates(_0x58004f,_0x41f7c3){return function(_0x694a13){if(_0x694a13){return _0x694a13[_0xbfb1('0x21')](_0x58004f)[_0xbfb1('0x22')](function(_0x1b52e0){return _0x1b52e0;});}return null;};}function removeEntity(_0x247c54,_0x33ada9){return function(_0x56364a){if(_0x56364a){return _0x56364a[_0xbfb1('0x23')]()['then'](function(){_0x247c54['status'](0xcc)[_0xbfb1('0x19')]();});}};}function handleEntityNotFound(_0x4f83df,_0x617f8d){return function(_0x2e2aba){if(!_0x2e2aba){_0x4f83df[_0xbfb1('0x17')](0x194);}return _0x2e2aba;};}function handleError(_0x57af46,_0x4fca45){_0x4fca45=_0x4fca45||0x1f4;return function(_0x4dfa27){logger[_0xbfb1('0x24')](_0x4dfa27[_0xbfb1('0x25')]);if(_0x4dfa27[_0xbfb1('0x26')]){delete _0x4dfa27[_0xbfb1('0x26')];}_0x57af46[_0xbfb1('0x18')](_0x4fca45)[_0xbfb1('0x27')](_0x4dfa27);};}exports[_0xbfb1('0x28')]=function(_0x321072,_0x4c0546){var _0x4c1947={},_0x26243d={},_0x37d63c={'count':0x0,'rows':[]};var _0x27e245=_['map'](db['FaxQueueReport'][_0xbfb1('0x29')],function(_0x32991b){return{'name':_0x32991b[_0xbfb1('0x2a')],'type':_0x32991b[_0xbfb1('0x2b')]['key']};});_0x26243d[_0xbfb1('0x2c')]=_[_0xbfb1('0x2d')](_0x27e245,_0xbfb1('0x26'));_0x26243d['query']=_[_0xbfb1('0x2e')](_0x321072[_0xbfb1('0x2f')]);_0x26243d[_0xbfb1('0x30')]=_[_0xbfb1('0x31')](_0x26243d[_0xbfb1('0x2c')],_0x26243d[_0xbfb1('0x2f')]);_0x4c1947[_0xbfb1('0x32')]=_[_0xbfb1('0x31')](_0x26243d[_0xbfb1('0x2c')],qs[_0xbfb1('0x33')](_0x321072[_0xbfb1('0x2f')][_0xbfb1('0x33')]));_0x4c1947[_0xbfb1('0x32')]=_0x4c1947[_0xbfb1('0x32')][_0xbfb1('0x34')]?_0x4c1947['attributes']:_0x26243d[_0xbfb1('0x2c')];if(!_0x321072[_0xbfb1('0x2f')]['hasOwnProperty']('nolimit')){_0x4c1947[_0xbfb1('0x35')]=qs[_0xbfb1('0x35')](_0x321072[_0xbfb1('0x2f')][_0xbfb1('0x35')]);_0x4c1947[_0xbfb1('0x1b')]=qs['offset'](_0x321072[_0xbfb1('0x2f')][_0xbfb1('0x1b')]);}_0x4c1947[_0xbfb1('0x36')]=qs[_0xbfb1('0x37')](_0x321072[_0xbfb1('0x2f')]['sort']);_0x4c1947[_0xbfb1('0x38')]=qs[_0xbfb1('0x30')](_[_0xbfb1('0x39')](_0x321072[_0xbfb1('0x2f')],_0x26243d[_0xbfb1('0x30')]),_0x27e245);if(_0x321072[_0xbfb1('0x2f')][_0xbfb1('0x3a')]){_0x4c1947[_0xbfb1('0x38')]=_[_0xbfb1('0x3b')](_0x4c1947['where'],{'$or':_[_0xbfb1('0x2d')](_0x27e245,function(_0x13f09c){if(_0x13f09c[_0xbfb1('0x2b')]!==_0xbfb1('0x3c')){var _0x10b2c3={};_0x10b2c3[_0x13f09c[_0xbfb1('0x26')]]={'$like':'%'+_0x321072[_0xbfb1('0x2f')][_0xbfb1('0x3a')]+'%'};return _0x10b2c3;}})});}_0x4c1947=_['merge']({},_0x4c1947,_0x321072[_0xbfb1('0x3d')]);var _0x3046dd={'where':_0x4c1947['where']};return db[_0xbfb1('0x3e')]['count'](_0x3046dd)[_0xbfb1('0x22')](function(_0x509801){_0x37d63c[_0xbfb1('0x3f')]=_0x509801;if(_0x321072[_0xbfb1('0x2f')]['includeAll']){_0x4c1947['include']=[{'all':!![]}];}return db[_0xbfb1('0x3e')]['findAll'](_0x4c1947);})[_0xbfb1('0x22')](function(_0x66ce2a){_0x37d63c[_0xbfb1('0x40')]=_0x66ce2a;return _0x37d63c;})[_0xbfb1('0x22')](respondWithFilteredResult(_0x4c0546,_0x4c1947))[_0xbfb1('0x41')](handleError(_0x4c0546,null));};exports['show']=function(_0x3eed87,_0x17b4cf){var _0x483a9e={'raw':!![],'where':{'id':_0x3eed87[_0xbfb1('0x42')]['id']}},_0xe886b8={};_0xe886b8[_0xbfb1('0x2c')]=_[_0xbfb1('0x2e')](db[_0xbfb1('0x3e')][_0xbfb1('0x29')]);_0xe886b8[_0xbfb1('0x2f')]=_['keys'](_0x3eed87[_0xbfb1('0x2f')]);_0xe886b8[_0xbfb1('0x30')]=_[_0xbfb1('0x31')](_0xe886b8[_0xbfb1('0x2c')],_0xe886b8['query']);_0x483a9e['attributes']=_[_0xbfb1('0x31')](_0xe886b8['model'],qs[_0xbfb1('0x33')](_0x3eed87[_0xbfb1('0x2f')]['fields']));_0x483a9e[_0xbfb1('0x32')]=_0x483a9e[_0xbfb1('0x32')][_0xbfb1('0x34')]?_0x483a9e[_0xbfb1('0x32')]:_0xe886b8[_0xbfb1('0x2c')];if(_0x3eed87[_0xbfb1('0x2f')][_0xbfb1('0x43')]){_0x483a9e[_0xbfb1('0x44')]=[{'all':!![]}];}_0x483a9e=_[_0xbfb1('0x3b')]({},_0x483a9e,_0x3eed87['options']);return db['FaxQueueReport'][_0xbfb1('0x45')](_0x483a9e)[_0xbfb1('0x22')](handleEntityNotFound(_0x17b4cf,null))[_0xbfb1('0x22')](respondWithResult(_0x17b4cf,null))['catch'](handleError(_0x17b4cf,null));};exports[_0xbfb1('0x46')]=function(_0x1d5bc3,_0x712ae5){return db[_0xbfb1('0x3e')][_0xbfb1('0x46')](_0x1d5bc3[_0xbfb1('0x47')],{})[_0xbfb1('0x22')](respondWithResult(_0x712ae5,0xc9))[_0xbfb1('0x41')](handleError(_0x712ae5,null));};exports['update']=function(_0x479417,_0x266e3f){if(_0x479417['body']['id']){delete _0x479417['body']['id'];}return db[_0xbfb1('0x3e')][_0xbfb1('0x45')]({'where':{'id':_0x479417[_0xbfb1('0x42')]['id']}})['then'](handleEntityNotFound(_0x266e3f,null))['then'](saveUpdates(_0x479417[_0xbfb1('0x47')],null))[_0xbfb1('0x22')](respondWithResult(_0x266e3f,null))[_0xbfb1('0x41')](handleError(_0x266e3f,null));};exports[_0xbfb1('0x23')]=function(_0x3f3f45,_0x2dc9b0){return db[_0xbfb1('0x3e')][_0xbfb1('0x45')]({'where':{'id':_0x3f3f45[_0xbfb1('0x42')]['id']}})[_0xbfb1('0x22')](handleEntityNotFound(_0x2dc9b0,null))[_0xbfb1('0x22')](removeEntity(_0x2dc9b0,null))[_0xbfb1('0x41')](handleError(_0x2dc9b0,null));};exports[_0xbfb1('0x48')]=function(_0x4b6135,_0x470470){return db[_0xbfb1('0x3e')][_0xbfb1('0x48')]()[_0xbfb1('0x22')](respondWithResult(_0x470470,null))['catch'](handleError(_0x470470,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0c035ee..a8b6bf6 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 _0x55c3=['exports','define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes'];(function(_0x36ca99,_0x4993f4){var _0x1c38ce=function(_0x3c99a9){while(--_0x3c99a9){_0x36ca99['push'](_0x36ca99['shift']());}};_0x1c38ce(++_0x4993f4);}(_0x55c3,0x189));var _0x355c=function(_0x438e73,_0x386da6){_0x438e73=_0x438e73-0x0;var _0x21e035=_0x55c3[_0x438e73];return _0x21e035;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var logger=require(_0x355c('0x1'))(_0x355c('0x2'));var moment=require(_0x355c('0x3'));var BPromise=require(_0x355c('0x4'));var rp=require(_0x355c('0x5'));var fs=require('fs');var path=require(_0x355c('0x6'));var rimraf=require(_0x355c('0x7'));var config=require(_0x355c('0x8'));var attributes=require(_0x355c('0x9'));module[_0x355c('0xa')]=function(_0x19c4e4,_0x8570ef){return _0x19c4e4[_0x355c('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x355c('0xc'),'fields':[_0x355c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb67=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x53bbcf,_0x2dc661){var _0x3bbd4c=function(_0x3af609){while(--_0x3af609){_0x53bbcf['push'](_0x53bbcf['shift']());}};_0x3bbd4c(++_0x2dc661);}(_0xfb67,0xdd));var _0x7fb6=function(_0x2dabf3,_0x583d83){_0x2dabf3=_0x2dabf3-0x0;var _0x34258a=_0xfb67[_0x2dabf3];return _0x34258a;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))(_0x7fb6('0x3'));var moment=require(_0x7fb6('0x4'));var BPromise=require(_0x7fb6('0x5'));var rp=require(_0x7fb6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb6('0x7'));var config=require(_0x7fb6('0x8'));var attributes=require(_0x7fb6('0x9'));module[_0x7fb6('0xa')]=function(_0x3e7393,_0x59b2e2){return _0x3e7393[_0x7fb6('0xb')](_0x7fb6('0xc'),attributes,{'tableName':_0x7fb6('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7fb6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 63c0325..8d6e2da 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 _0x9ebf=['stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x9ebf,0xce));var _0xf9eb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9ebf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf9eb('0x0'));var util=require(_0xf9eb('0x1'));var moment=require('moment');var BPromise=require(_0xf9eb('0x2'));var rs=require(_0xf9eb('0x3'));var fs=require('fs');var Redis=require(_0xf9eb('0x4'));var db=require(_0xf9eb('0x5'))['db'];var utils=require(_0xf9eb('0x6'));var logger=require(_0xf9eb('0x7'))(_0xf9eb('0x8'));var config=require(_0xf9eb('0x9'));var jayson=require(_0xf9eb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9635,_0x9d8cc6,_0x38f90d){return new BPromise(function(_0x3bd49f,_0x2abd34){return client[_0xf9eb('0xb')](_0x3c9635,_0x38f90d)[_0xf9eb('0xc')](function(_0x5b8cde){logger[_0xf9eb('0xd')](_0xf9eb('0xe'),_0x9d8cc6,_0xf9eb('0xf'));logger[_0xf9eb('0x10')](_0xf9eb('0x11'),_0x9d8cc6,_0xf9eb('0xf'),JSON[_0xf9eb('0x12')](_0x5b8cde));if(_0x5b8cde[_0xf9eb('0x13')]){if(_0x5b8cde[_0xf9eb('0x13')]['code']===0x1f4){logger['error'](_0xf9eb('0xe'),_0x9d8cc6,_0x5b8cde[_0xf9eb('0x13')][_0xf9eb('0x14')]);return _0x2abd34(_0x5b8cde[_0xf9eb('0x13')][_0xf9eb('0x14')]);}logger[_0xf9eb('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x9d8cc6,_0x5b8cde[_0xf9eb('0x13')][_0xf9eb('0x14')]);return _0x3bd49f(_0x5b8cde[_0xf9eb('0x13')][_0xf9eb('0x14')]);}else{logger[_0xf9eb('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x9d8cc6,_0xf9eb('0xf'));_0x3bd49f(_0x5b8cde[_0xf9eb('0x15')][_0xf9eb('0x14')]);}})[_0xf9eb('0x16')](function(_0x1dc80f){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x9d8cc6,_0x1dc80f);_0x2abd34(_0x1dc80f);});});}exports[_0xf9eb('0x17')]=function(_0x2defeb){var _0x594580=this;return new Promise(function(_0x67b416,_0x57c329){return db[_0xf9eb('0x18')]['create'](_0x2defeb[_0xf9eb('0x19')],{'raw':_0x2defeb[_0xf9eb('0x1a')]?_0x2defeb['options'][_0xf9eb('0x1b')]===undefined?!![]:![]:!![]})[_0xf9eb('0xc')](function(_0x5d0ee6){logger[_0xf9eb('0xd')](_0xf9eb('0x17'),_0x2defeb);logger[_0xf9eb('0x10')](_0xf9eb('0x17'),_0x2defeb,JSON['stringify'](_0x5d0ee6));_0x67b416(_0x5d0ee6);})[_0xf9eb('0x16')](function(_0x4896da){logger['error'](_0xf9eb('0x17'),_0x4896da[_0xf9eb('0x14')],_0x2defeb);_0x57c329(_0x594580[_0xf9eb('0x13')](0x1f4,_0x4896da[_0xf9eb('0x14')]));});});};exports[_0xf9eb('0x1c')]=function(_0x3fd34e){var _0x54cd26=this;return new Promise(function(_0x59d840,_0x1a90cc){return db['FaxQueueReport'][_0xf9eb('0x1d')](_0x3fd34e['body'],{'raw':_0x3fd34e[_0xf9eb('0x1a')]?_0x3fd34e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd34e[_0xf9eb('0x1a')]?_0x3fd34e[_0xf9eb('0x1a')][_0xf9eb('0x1e')]||null:null,'attributes':_0x3fd34e[_0xf9eb('0x1a')]?_0x3fd34e[_0xf9eb('0x1a')]['attributes']||null:null,'limit':_0x3fd34e[_0xf9eb('0x1a')]?_0x3fd34e['options'][_0xf9eb('0x1f')]||null:null})[_0xf9eb('0xc')](function(_0x5e5c84){logger[_0xf9eb('0xd')]('UpdateFaxQueueReport',_0x3fd34e);logger[_0xf9eb('0x10')](_0xf9eb('0x1c'),_0x3fd34e,JSON[_0xf9eb('0x12')](_0x5e5c84));_0x59d840(_0x5e5c84);})[_0xf9eb('0x16')](function(_0x34964f){logger[_0xf9eb('0x13')](_0xf9eb('0x1c'),_0x34964f[_0xf9eb('0x14')],_0x3fd34e);_0x1a90cc(_0x54cd26[_0xf9eb('0x13')](0x1f4,_0x34964f[_0xf9eb('0x14')]));});});}; \ No newline at end of file +var _0x529f=['CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x529f,0x1ac));var _0xf529=function(_0x576a50,_0x4650f8){_0x576a50=_0x576a50-0x0;var _0x2c4d05=_0x529f[_0x576a50];return _0x2c4d05;};'use strict';var _=require(_0xf529('0x0'));var util=require(_0xf529('0x1'));var moment=require(_0xf529('0x2'));var BPromise=require('bluebird');var rs=require(_0xf529('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf529('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf529('0x5'))('rpc');var config=require(_0xf529('0x6'));var jayson=require(_0xf529('0x7'));var client=jayson['client'][_0xf529('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x301877,_0x475a98,_0x132d76){return new BPromise(function(_0x392f3e,_0x2838c3){return client[_0xf529('0x9')](_0x301877,_0x132d76)[_0xf529('0xa')](function(_0x4ca58a){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x475a98,_0xf529('0xb'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x475a98,_0xf529('0xb'),JSON[_0xf529('0xc')](_0x4ca58a));if(_0x4ca58a[_0xf529('0xd')]){if(_0x4ca58a['error'][_0xf529('0xe')]===0x1f4){logger[_0xf529('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x475a98,_0x4ca58a[_0xf529('0xd')][_0xf529('0xf')]);return _0x2838c3(_0x4ca58a['error'][_0xf529('0xf')]);}logger['error'](_0xf529('0x10'),_0x475a98,_0x4ca58a[_0xf529('0xd')][_0xf529('0xf')]);return _0x392f3e(_0x4ca58a[_0xf529('0xd')][_0xf529('0xf')]);}else{logger[_0xf529('0x11')](_0xf529('0x10'),_0x475a98,_0xf529('0xb'));_0x392f3e(_0x4ca58a[_0xf529('0x12')][_0xf529('0xf')]);}})[_0xf529('0x13')](function(_0x2473f3){logger[_0xf529('0xd')](_0xf529('0x10'),_0x475a98,_0x2473f3);_0x2838c3(_0x2473f3);});});}exports[_0xf529('0x14')]=function(_0xdd0ceb){var _0x544450=this;return new Promise(function(_0x3ce2fc,_0x141bbe){return db[_0xf529('0x15')][_0xf529('0x16')](_0xdd0ceb[_0xf529('0x17')],{'raw':_0xdd0ceb[_0xf529('0x18')]?_0xdd0ceb['options']['raw']===undefined?!![]:![]:!![]})[_0xf529('0xa')](function(_0x17b9d1){logger[_0xf529('0x11')](_0xf529('0x14'),_0xdd0ceb);logger[_0xf529('0x19')](_0xf529('0x14'),_0xdd0ceb,JSON[_0xf529('0xc')](_0x17b9d1));_0x3ce2fc(_0x17b9d1);})[_0xf529('0x13')](function(_0x4c49c5){logger[_0xf529('0xd')](_0xf529('0x14'),_0x4c49c5[_0xf529('0xf')],_0xdd0ceb);_0x141bbe(_0x544450[_0xf529('0xd')](0x1f4,_0x4c49c5[_0xf529('0xf')]));});});};exports[_0xf529('0x1a')]=function(_0xd44ec0){var _0x3b6475=this;return new Promise(function(_0x4830f5,_0x29e9e6){return db[_0xf529('0x15')][_0xf529('0x1b')](_0xd44ec0[_0xf529('0x17')],{'raw':_0xd44ec0[_0xf529('0x18')]?_0xd44ec0[_0xf529('0x18')][_0xf529('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd44ec0[_0xf529('0x18')]?_0xd44ec0[_0xf529('0x18')][_0xf529('0x1d')]||null:null,'attributes':_0xd44ec0[_0xf529('0x18')]?_0xd44ec0[_0xf529('0x18')][_0xf529('0x1e')]||null:null,'limit':_0xd44ec0[_0xf529('0x18')]?_0xd44ec0['options'][_0xf529('0x1f')]||null:null})[_0xf529('0xa')](function(_0x23f75f){logger[_0xf529('0x11')](_0xf529('0x1a'),_0xd44ec0);logger[_0xf529('0x19')](_0xf529('0x1a'),_0xd44ec0,JSON[_0xf529('0xc')](_0x23f75f));_0x4830f5(_0x23f75f);})[_0xf529('0x13')](function(_0x112716){logger['error'](_0xf529('0x1a'),_0x112716[_0xf529('0xf')],_0xd44ec0);_0x29e9e6(_0x3b6475[_0xf529('0xd')](0x1f4,_0x112716[_0xf529('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index be5a1c4..429c6e9 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 _0xa0d9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x44e0b6,_0x214d32){var _0x418592=function(_0x1760f2){while(--_0x1760f2){_0x44e0b6['push'](_0x44e0b6['shift']());}};_0x418592(++_0x214d32);}(_0xa0d9,0x1f0));var _0x9a0d=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xa0d9[_0x523adf];return _0x283870;};'use strict';var multer=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var path=require(_0x9a0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a0d('0x3'));var router=express[_0x9a0d('0x4')]();var auth=require(_0x9a0d('0x5'));var interaction=require(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var controller=require(_0x9a0d('0x8'));router[_0x9a0d('0x9')]('/',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0xb')]);router[_0x9a0d('0x9')]('/describe',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0xc')]);router[_0x9a0d('0x9')](_0x9a0d('0xd'),auth[_0x9a0d('0xa')](),controller['show']);router[_0x9a0d('0xe')]('/',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0xf')]);router[_0x9a0d('0x10')](_0x9a0d('0xd'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x11')]);router[_0x9a0d('0x12')](_0x9a0d('0xd'),auth['isAuthenticated'](),controller[_0x9a0d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1391=['express','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x168762,_0x92d1bd){var _0x4249ae=function(_0x190781){while(--_0x190781){_0x168762['push'](_0x168762['shift']());}};_0x4249ae(++_0x92d1bd);}(_0x1391,0x172));var _0x1139=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x1391[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x1139('0x0'));var util=require(_0x1139('0x1'));var path=require(_0x1139('0x2'));var timeout=require(_0x1139('0x3'));var express=require(_0x1139('0x4'));var router=express['Router']();var auth=require(_0x1139('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1139('0x6'));var controller=require(_0x1139('0x7'));router[_0x1139('0x8')]('/',auth[_0x1139('0x9')](),controller[_0x1139('0xa')]);router[_0x1139('0x8')](_0x1139('0xb'),auth[_0x1139('0x9')](),controller[_0x1139('0xc')]);router['get']('/:id',auth[_0x1139('0x9')](),controller[_0x1139('0xd')]);router[_0x1139('0xe')]('/',auth[_0x1139('0x9')](),controller[_0x1139('0xf')]);router[_0x1139('0x10')](_0x1139('0x11'),auth[_0x1139('0x9')](),controller[_0x1139('0x12')]);router[_0x1139('0x13')](_0x1139('0x11'),auth[_0x1139('0x9')](),controller[_0x1139('0x14')]);module[_0x1139('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 049fe8c..52777a5 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 _0x8b3c=['NOW','exports','STRING','account','agent','queue','DATE'];(function(_0x275e26,_0x2e4203){var _0x329165=function(_0x7d7360){while(--_0x7d7360){_0x275e26['push'](_0x275e26['shift']());}};_0x329165(++_0x2e4203);}(_0x8b3c,0x104));var _0xc8b3=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0x8b3c[_0x55c979];return _0x690107;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc8b3('0x0')]={'uniqueid':{'type':Sequelize[_0xc8b3('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc8b3('0x2'),_0xc8b3('0x3'),'queue'),'allowNull':![],'defaultValue':_0xc8b3('0x4')},'transferredAt':{'type':Sequelize[_0xc8b3('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xc8b3('0x6')]}}; \ No newline at end of file +var _0x42bf=['moment','ENUM','account','agent','queue','NOW'];(function(_0x438100,_0x4c3108){var _0x2762e7=function(_0x591c6b){while(--_0x591c6b){_0x438100['push'](_0x438100['shift']());}};_0x2762e7(++_0x4c3108);}(_0x42bf,0x1c8));var _0xf42b=function(_0x2312b5,_0x38f0d0){_0x2312b5=_0x2312b5-0x0;var _0x374937=_0x42bf[_0x2312b5];return _0x374937;};'use strict';var moment=require(_0xf42b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf42b('0x1')](_0xf42b('0x2'),_0xf42b('0x3'),_0xf42b('0x4')),'allowNull':![],'defaultValue':_0xf42b('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf42b('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4f1d9f8..b865273 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 _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(_0x33fdfa,_0x41be60){var _0x5b390a=function(_0x442a0f){while(--_0x442a0f){_0x33fdfa['push'](_0x33fdfa['shift']());}};_0x5b390a(++_0x41be60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'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 +var _0x0b0e=['index','map','FaxTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject','update','then','destroy','end','error','name'];(function(_0x1aed94,_0x59ca41){var _0x1c91f6=function(_0x40e026){while(--_0x40e026){_0x1aed94['push'](_0x1aed94['shift']());}};_0x1c91f6(++_0x59ca41);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f7a55,_0x352d22){_0x1f7a55=_0x1f7a55-0x0;var _0x2a291b=_0x0b0e[_0x1f7a55];return _0x2a291b;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['FaxTransferReport'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['FaxTransferReport'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['FaxTransferReport'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));};exports[_0xe0b0('0x46')]=function(_0x5f5486,_0x5d018d){return db[_0xe0b0('0x25')]['describe']()['then'](respondWithResult(_0x5d018d,null))[_0xe0b0('0x43')](handleError(_0x5d018d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 67b4be5..841bdbd 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 _0xf280=['request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xf280,0x113));var _0x0f28=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xf280[_0x313df3];return _0x241d59;};'use strict';var _=require(_0x0f28('0x0'));var util=require('util');var logger=require(_0x0f28('0x1'))(_0x0f28('0x2'));var moment=require(_0x0f28('0x3'));var BPromise=require(_0x0f28('0x4'));var rp=require(_0x0f28('0x5'));var fs=require('fs');var path=require(_0x0f28('0x6'));var rimraf=require('rimraf');var config=require(_0x0f28('0x7'));var attributes=require(_0x0f28('0x8'));module[_0x0f28('0x9')]=function(_0x35784,_0xfd95c3){return _0x35784[_0x0f28('0xa')](_0x0f28('0xb'),attributes,{'tableName':_0x0f28('0xc'),'paranoid':![],'indexes':[{'name':_0x0f28('0xd'),'fields':[_0x0f28('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebe6=['rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xebe6,0x13a));var _0x6ebe=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0xebe6[_0x1eed52];return _0x57782a;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var logger=require(_0x6ebe('0x2'))(_0x6ebe('0x3'));var moment=require(_0x6ebe('0x4'));var BPromise=require(_0x6ebe('0x5'));var rp=require(_0x6ebe('0x6'));var fs=require('fs');var path=require(_0x6ebe('0x7'));var rimraf=require(_0x6ebe('0x8'));var config=require(_0x6ebe('0x9'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x1c3c2c,_0x2a63a5){return _0x1c3c2c[_0x6ebe('0xa')](_0x6ebe('0xb'),attributes,{'tableName':_0x6ebe('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6ebe('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 c62d8f0..299c41d 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 _0xe195=['message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe195,0x1a4));var _0x5e19=function(_0x5dc627,_0x3b407e){_0x5dc627=_0x5dc627-0x0;var _0xda792d=_0xe195[_0x5dc627];return _0xda792d;};'use strict';var _=require(_0x5e19('0x0'));var util=require(_0x5e19('0x1'));var moment=require(_0x5e19('0x2'));var BPromise=require(_0x5e19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e19('0x4'))['db'];var utils=require(_0x5e19('0x5'));var logger=require(_0x5e19('0x6'))(_0x5e19('0x7'));var config=require(_0x5e19('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e19('0x9')][_0x5e19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb9b9,_0x5e7cbd,_0x1896a7){return new BPromise(function(_0x27a879,_0x41aab0){return client[_0x5e19('0xb')](_0x3eb9b9,_0x1896a7)[_0x5e19('0xc')](function(_0x5dd292){logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x5e7cbd,_0x5e19('0xf'));logger[_0x5e19('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5e7cbd,_0x5e19('0xf'),JSON[_0x5e19('0x11')](_0x5dd292));if(_0x5dd292[_0x5e19('0x12')]){if(_0x5dd292[_0x5e19('0x12')][_0x5e19('0x13')]===0x1f4){logger['error'](_0x5e19('0xe'),_0x5e7cbd,_0x5dd292[_0x5e19('0x12')][_0x5e19('0x14')]);return _0x41aab0(_0x5dd292['error']['message']);}logger[_0x5e19('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5e7cbd,_0x5dd292[_0x5e19('0x12')][_0x5e19('0x14')]);return _0x27a879(_0x5dd292[_0x5e19('0x12')]['message']);}else{logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x5e7cbd,_0x5e19('0xf'));_0x27a879(_0x5dd292['result']['message']);}})[_0x5e19('0x15')](function(_0x54dc4d){logger['error'](_0x5e19('0xe'),_0x5e7cbd,_0x54dc4d);_0x41aab0(_0x54dc4d);});});} \ No newline at end of file +var _0x12cc=['request','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x389afc,_0x4f4b9f){var _0x24e64b=function(_0x3b31ac){while(--_0x3b31ac){_0x389afc['push'](_0x389afc['shift']());}};_0x24e64b(++_0x4f4b9f);}(_0x12cc,0x83));var _0xc12c=function(_0x254f0a,_0x176b1f){_0x254f0a=_0x254f0a-0x0;var _0xb1c8e7=_0x12cc[_0x254f0a];return _0xb1c8e7;};'use strict';var _=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var moment=require(_0xc12c('0x2'));var BPromise=require(_0xc12c('0x3'));var rs=require(_0xc12c('0x4'));var fs=require('fs');var Redis=require(_0xc12c('0x5'));var db=require(_0xc12c('0x6'))['db'];var utils=require(_0xc12c('0x7'));var logger=require(_0xc12c('0x8'))(_0xc12c('0x9'));var config=require(_0xc12c('0xa'));var jayson=require(_0xc12c('0xb'));var client=jayson['client'][_0xc12c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34e7ca,_0x948091,_0x4a8810){return new BPromise(function(_0x1f5c3a,_0x1d0526){return client[_0xc12c('0xd')](_0x34e7ca,_0x4a8810)['then'](function(_0x548f4f){logger[_0xc12c('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x948091,'request\x20sent');logger[_0xc12c('0xf')](_0xc12c('0x10'),_0x948091,_0xc12c('0x11'),JSON[_0xc12c('0x12')](_0x548f4f));if(_0x548f4f[_0xc12c('0x13')]){if(_0x548f4f[_0xc12c('0x13')]['code']===0x1f4){logger[_0xc12c('0x13')](_0xc12c('0x14'),_0x948091,_0x548f4f[_0xc12c('0x13')][_0xc12c('0x15')]);return _0x1d0526(_0x548f4f['error'][_0xc12c('0x15')]);}logger['error'](_0xc12c('0x14'),_0x948091,_0x548f4f[_0xc12c('0x13')][_0xc12c('0x15')]);return _0x1f5c3a(_0x548f4f['error']['message']);}else{logger[_0xc12c('0xe')](_0xc12c('0x14'),_0x948091,_0xc12c('0x11'));_0x1f5c3a(_0x548f4f[_0xc12c('0x16')]['message']);}})[_0xc12c('0x17')](function(_0x351183){logger[_0xc12c('0x13')](_0xc12c('0x14'),_0x948091,_0x351183);_0x1d0526(_0x351183);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8c6314b..a6969c8 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 _0x8321=['/describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x348d8d,_0x25a6dd){var _0x2a7d1f=function(_0x32fed7){while(--_0x32fed7){_0x348d8d['push'](_0x348d8d['shift']());}};_0x2a7d1f(++_0x25a6dd);}(_0x8321,0x184));var _0x1832=function(_0xa2f5d4,_0x2ed0aa){_0xa2f5d4=_0xa2f5d4-0x0;var _0x5f080f=_0x8321[_0xa2f5d4];return _0x5f080f;};'use strict';var multer=require(_0x1832('0x0'));var util=require(_0x1832('0x1'));var path=require(_0x1832('0x2'));var timeout=require(_0x1832('0x3'));var express=require('express');var router=express[_0x1832('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1832('0x5'));var config=require(_0x1832('0x6'));var controller=require(_0x1832('0x7'));router[_0x1832('0x8')]('/',auth[_0x1832('0x9')](),controller[_0x1832('0xa')]);router[_0x1832('0x8')](_0x1832('0xb'),auth[_0x1832('0x9')](),controller['describe']);router[_0x1832('0x8')](_0x1832('0xc'),auth[_0x1832('0x9')](),controller[_0x1832('0xd')]);router['post']('/',auth[_0x1832('0x9')](),controller[_0x1832('0xe')]);router[_0x1832('0xf')](_0x1832('0xc'),auth[_0x1832('0x9')](),controller['update']);router[_0x1832('0x10')](_0x1832('0xc'),auth[_0x1832('0x9')](),controller[_0x1832('0x11')]);module[_0x1832('0x12')]=router; \ No newline at end of file +var _0x434f=['show','post','create','put','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x434f,0x1b5));var _0xf434=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x434f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf434('0x0'));var util=require(_0xf434('0x1'));var path=require(_0xf434('0x2'));var timeout=require(_0xf434('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf434('0x4'));var config=require(_0xf434('0x5'));var controller=require(_0xf434('0x6'));router[_0xf434('0x7')]('/',auth[_0xf434('0x8')](),controller[_0xf434('0x9')]);router['get'](_0xf434('0xa'),auth['isAuthenticated'](),controller[_0xf434('0xb')]);router['get'](_0xf434('0xc'),auth[_0xf434('0x8')](),controller[_0xf434('0xd')]);router[_0xf434('0xe')]('/',auth['isAuthenticated'](),controller[_0xf434('0xf')]);router[_0xf434('0x10')]('/:id',auth[_0xf434('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf434('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1d1305c..0121633 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 _0x85d0=['./intDeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d16d8,_0x41ba11){var _0x380a3d=function(_0x49778b){while(--_0x49778b){_0x5d16d8['push'](_0x5d16d8['shift']());}};_0x380a3d(++_0x41ba11);}(_0x85d0,0x164));var _0x085d=function(_0x3241b6,_0x598ef7){_0x3241b6=_0x3241b6-0x0;var _0x377496=_0x85d0[_0x3241b6];return _0x377496;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x085d('0x0'));var router=express[_0x085d('0x1')]();var auth=require(_0x085d('0x2'));var interaction=require(_0x085d('0x3'));var config=require(_0x085d('0x4'));var controller=require(_0x085d('0x5'));router['get']('/',auth[_0x085d('0x6')](),controller['index']);router[_0x085d('0x7')](_0x085d('0x8'),auth[_0x085d('0x6')](),controller['show']);router[_0x085d('0x7')](_0x085d('0x9'),auth[_0x085d('0x6')](),controller[_0x085d('0xa')]);router[_0x085d('0x7')](_0x085d('0xb'),auth[_0x085d('0x6')](),controller[_0x085d('0xc')]);router[_0x085d('0xd')]('/',auth['isAuthenticated'](),controller[_0x085d('0xe')]);router[_0x085d('0xd')](_0x085d('0x9'),auth[_0x085d('0x6')](),controller['addConfiguration']);router[_0x085d('0xf')](_0x085d('0x8'),auth['isAuthenticated'](),controller[_0x085d('0x10')]);router[_0x085d('0x11')](_0x085d('0x8'),auth[_0x085d('0x6')](),controller['destroy']);module[_0x085d('0x12')]=router; \ No newline at end of file +var _0xa751=['./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x2b8b04,_0x1a7012){var _0x25a2f6=function(_0xe8336b){while(--_0xe8336b){_0x2b8b04['push'](_0x2b8b04['shift']());}};_0x25a2f6(++_0x1a7012);}(_0xa751,0x175));var _0x1a75=function(_0x14b12a,_0x52b5b4){_0x14b12a=_0x14b12a-0x0;var _0x40ff82=_0xa751[_0x14b12a];return _0x40ff82;};'use strict';var multer=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var path=require(_0x1a75('0x2'));var timeout=require(_0x1a75('0x3'));var express=require('express');var router=express[_0x1a75('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var controller=require(_0x1a75('0x7'));router['get']('/',auth[_0x1a75('0x8')](),controller[_0x1a75('0x9')]);router[_0x1a75('0xa')](_0x1a75('0xb'),auth[_0x1a75('0x8')](),controller[_0x1a75('0xc')]);router[_0x1a75('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1a75('0xa')](_0x1a75('0xd'),auth[_0x1a75('0x8')](),controller[_0x1a75('0xe')]);router[_0x1a75('0xf')]('/',auth[_0x1a75('0x8')](),controller[_0x1a75('0x10')]);router[_0x1a75('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a75('0x11')](_0x1a75('0xb'),auth[_0x1a75('0x8')](),controller[_0x1a75('0x12')]);router['delete']('/:id',auth[_0x1a75('0x8')](),controller[_0x1a75('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 ee745f3..e1a9a5f 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 _0x3556=['exports','STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3556,0xa7));var _0x6355=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3556[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x6355('0x0'));module[_0x6355('0x1')]={'name':{'type':Sequelize[_0x6355('0x2')]},'description':{'type':Sequelize[_0x6355('0x2')]},'username':{'type':Sequelize[_0x6355('0x2')]},'remoteUri':{'type':Sequelize[_0x6355('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x6355('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x6355('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6355('0x2')]},'tokenSecret':{'type':Sequelize[_0x6355('0x2')]},'serverUrl':{'type':Sequelize[_0x6355('0x2')]},'type':{'type':Sequelize[_0x6355('0x4')](_0x6355('0x5'),_0x6355('0x6')),'defaultValue':_0x6355('0x5')}}; \ No newline at end of file +var _0xee42=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee42,0xd0));var _0x2ee4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xee42[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2ee4('0x0'));module[_0x2ee4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2ee4('0x2')]},'authType':{'type':Sequelize[_0x2ee4('0x3')](_0x2ee4('0x4')),'defaultValue':_0x2ee4('0x4')},'password':{'type':Sequelize[_0x2ee4('0x2')]},'consumerKey':{'type':Sequelize[_0x2ee4('0x2')]},'consumerSecret':{'type':Sequelize[_0x2ee4('0x2')]},'token':{'type':Sequelize[_0x2ee4('0x2')]},'tokenSecret':{'type':Sequelize[_0x2ee4('0x2')]},'serverUrl':{'type':Sequelize[_0x2ee4('0x2')]},'type':{'type':Sequelize[_0x2ee4('0x3')]('integrationTab',_0x2ee4('0x5')),'defaultValue':_0x2ee4('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 0be3df9..0422901 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 _0x1d18=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','params','find','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getDescriptions','channel','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','concat','entries','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','count','offset','limit','reject','save','update','then','destroy','end','name','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes'];(function(_0x728360,_0x47529f){var _0x2ecad0=function(_0x197ff4){while(--_0x197ff4){_0x728360['push'](_0x728360['shift']());}};_0x2ecad0(++_0x47529f);}(_0x1d18,0x195));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x81d1('0x0'));var emlformat=require(_0x81d1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81d1('0x2'));var moment=require(_0x81d1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x81d1('0x4'));var util=require(_0x81d1('0x5'));var path=require(_0x81d1('0x6'));var sox=require(_0x81d1('0x7'));var csv=require(_0x81d1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x81d1('0x9'));var squel=require(_0x81d1('0xa'));var crypto=require('crypto');var jsforce=require(_0x81d1('0xb'));var deskjs=require(_0x81d1('0xc'));var toCsv=require(_0x81d1('0x8'));var querystring=require(_0x81d1('0xd'));var Papa=require(_0x81d1('0xe'));var Redis=require(_0x81d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81d1('0x10'));var as=require(_0x81d1('0x11'));var hardwareService=require(_0x81d1('0x12'));var logger=require('../../config/logger')(_0x81d1('0x13'));var utils=require(_0x81d1('0x14'));var config=require(_0x81d1('0x15'));var db=require(_0x81d1('0x16'))['db'];var integrations=require(_0x81d1('0x17'));var jayson=require(_0x81d1('0x18'));var client=jayson[_0x81d1('0x19')][_0x81d1('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x401c28,_0x4e8363,_0x517bc7){if(_0x517bc7){var _0x105c0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x105c0e[_0x81d1('0x1b')](_0x4e8363)){return _0x401c28;}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 _0x401c28;}}function respondWithRpcPromise(_0x6869d,_0x89a95f,_0x17348d,_0x40b490){return new BPromise(function(_0x1b41f1,_0x37e2e2){var _0x2371d0=_0x40b490||client;return _0x2371d0[_0x81d1('0x1c')](_0x6869d,_0x17348d)['then'](function(_0x427876){logger[_0x81d1('0x1d')](_0x81d1('0x1e'),_0x89a95f,_0x81d1('0x1f'));logger['debug'](_0x81d1('0x20'),_0x89a95f,_0x81d1('0x1f'),JSON[_0x81d1('0x21')](_0x427876));if(_0x427876[_0x81d1('0x22')]){if(_0x427876[_0x81d1('0x22')][_0x81d1('0x23')]===0x1f4){logger[_0x81d1('0x22')]('DeskAccount,\x20%s,\x20%s',_0x89a95f,_0x427876['error']['message']);return _0x37e2e2(_0x427876[_0x81d1('0x22')][_0x81d1('0x24')]);}logger['error'](_0x81d1('0x1e'),_0x89a95f,_0x427876[_0x81d1('0x22')][_0x81d1('0x24')]);return _0x1b41f1(_0x427876[_0x81d1('0x22')][_0x81d1('0x24')]);}else{logger[_0x81d1('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x89a95f,_0x81d1('0x1f'));_0x1b41f1(_0x427876[_0x81d1('0x25')]['message']);}})['catch'](function(_0xaf779f){logger[_0x81d1('0x22')](_0x81d1('0x1e'),_0x89a95f,_0xaf779f);_0x37e2e2(_0xaf779f);});});}function respondWithStatusCode(_0xfba5b7,_0x497986){_0x497986=_0x497986||0xcc;return function(_0x3360f9){if(_0x3360f9){return _0xfba5b7['sendStatus'](_0x497986);}return _0xfba5b7[_0x81d1('0x26')](_0x497986)['end']();};}function respondWithResult(_0x2eb855,_0x1e8f64){_0x1e8f64=_0x1e8f64||0xc8;return function(_0x21d6c6){if(_0x21d6c6){return _0x2eb855[_0x81d1('0x26')](_0x1e8f64)[_0x81d1('0x27')](_0x21d6c6);}};}function respondWithFilteredResult(_0x4e2e54,_0x54ed24){return function(_0xe34ff4){if(_0xe34ff4){var _0x31b9c2=_0xe34ff4[_0x81d1('0x28')],_0x482fd2=_0x54ed24[_0x81d1('0x29')],_0x31d149=_0x54ed24[_0x81d1('0x29')]+_0x54ed24[_0x81d1('0x2a')],_0x139460;if(_0x31d149>=_0x31b9c2){_0x31d149=_0x31b9c2;_0x139460=0xc8;}else{_0x139460=0xce;}_0x4e2e54[_0x81d1('0x26')](_0x139460);return _0x4e2e54['set']('Content-Range',_0x482fd2+'-'+_0x31d149+'/'+_0x31b9c2)['json'](_0xe34ff4);}return null;};}function patchUpdates(_0x6a40d8){return function(_0x1c8e76){try{jsonpatch['apply'](_0x1c8e76,_0x6a40d8,!![]);}catch(_0x409384){return BPromise[_0x81d1('0x2b')](_0x409384);}return _0x1c8e76[_0x81d1('0x2c')]();};}function saveUpdates(_0x65bb1e,_0x47ec9a){return function(_0x4cf5f2){if(_0x4cf5f2){return _0x4cf5f2[_0x81d1('0x2d')](_0x65bb1e)[_0x81d1('0x2e')](function(_0x23f189){return _0x23f189;});}return null;};}function removeEntity(_0x2875fb,_0x5cb176){return function(_0xe99757){if(_0xe99757){return _0xe99757[_0x81d1('0x2f')]()['then'](function(){_0x2875fb[_0x81d1('0x26')](0xcc)[_0x81d1('0x30')]();});}};}function handleEntityNotFound(_0x1aa5d7,_0x2d10fd){return function(_0x5d908c){if(!_0x5d908c){_0x1aa5d7['sendStatus'](0x194);}return _0x5d908c;};}function handleError(_0x1f8683,_0x32e078){_0x32e078=_0x32e078||0x1f4;return function(_0x46cc17){logger[_0x81d1('0x22')](_0x46cc17['stack']);if(_0x46cc17[_0x81d1('0x31')]){delete _0x46cc17[_0x81d1('0x31')];}_0x1f8683[_0x81d1('0x26')](_0x32e078)['send'](_0x46cc17);};}exports['index']=function(_0x3f6009,_0x92d968){var _0x238ef8={},_0x2abf9c={},_0x1e8caf={'count':0x0,'rows':[]};var _0x2adb41=_[_0x81d1('0x32')](db[_0x81d1('0x33')][_0x81d1('0x34')],function(_0xb4da5e){return{'name':_0xb4da5e[_0x81d1('0x35')],'type':_0xb4da5e[_0x81d1('0x36')][_0x81d1('0x37')]};});_0x2abf9c[_0x81d1('0x38')]=_[_0x81d1('0x32')](_0x2adb41,_0x81d1('0x31'));_0x2abf9c['query']=_[_0x81d1('0x39')](_0x3f6009['query']);_0x2abf9c[_0x81d1('0x3a')]=_[_0x81d1('0x3b')](_0x2abf9c[_0x81d1('0x38')],_0x2abf9c[_0x81d1('0x3c')]);_0x238ef8['attributes']=_[_0x81d1('0x3b')](_0x2abf9c[_0x81d1('0x38')],qs[_0x81d1('0x3d')](_0x3f6009[_0x81d1('0x3c')][_0x81d1('0x3d')]));_0x238ef8[_0x81d1('0x3e')]=_0x238ef8[_0x81d1('0x3e')]['length']?_0x238ef8[_0x81d1('0x3e')]:_0x2abf9c[_0x81d1('0x38')];if(!_0x3f6009[_0x81d1('0x3c')][_0x81d1('0x3f')](_0x81d1('0x40'))){_0x238ef8[_0x81d1('0x2a')]=qs['limit'](_0x3f6009['query'][_0x81d1('0x2a')]);_0x238ef8[_0x81d1('0x29')]=qs[_0x81d1('0x29')](_0x3f6009[_0x81d1('0x3c')][_0x81d1('0x29')]);}_0x238ef8[_0x81d1('0x41')]=qs[_0x81d1('0x42')](_0x3f6009['query']['sort']);_0x238ef8[_0x81d1('0x43')]=qs[_0x81d1('0x3a')](_[_0x81d1('0x44')](_0x3f6009['query'],_0x2abf9c['filters']),_0x2adb41);if(_0x3f6009[_0x81d1('0x3c')][_0x81d1('0x45')]){_0x238ef8[_0x81d1('0x43')]=_['merge'](_0x238ef8[_0x81d1('0x43')],{'$or':_[_0x81d1('0x32')](_0x2adb41,function(_0x5952f7){if(_0x5952f7[_0x81d1('0x36')]!==_0x81d1('0x46')){var _0x2b8a50={};_0x2b8a50[_0x5952f7[_0x81d1('0x31')]]={'$like':'%'+_0x3f6009[_0x81d1('0x3c')][_0x81d1('0x45')]+'%'};return _0x2b8a50;}})});}_0x238ef8=_[_0x81d1('0x47')]({},_0x238ef8,_0x3f6009[_0x81d1('0x48')]);var _0x5aa580={'where':_0x238ef8[_0x81d1('0x43')]};return db[_0x81d1('0x33')][_0x81d1('0x28')](_0x5aa580)['then'](function(_0x12120b){_0x1e8caf[_0x81d1('0x28')]=_0x12120b;if(_0x3f6009['query'][_0x81d1('0x49')]){_0x238ef8[_0x81d1('0x4a')]=[{'all':!![]}];}return db['DeskAccount'][_0x81d1('0x4b')](_0x238ef8);})[_0x81d1('0x2e')](function(_0x3738f5){_0x1e8caf[_0x81d1('0x4c')]=_0x3738f5;return _0x1e8caf;})[_0x81d1('0x2e')](respondWithFilteredResult(_0x92d968,_0x238ef8))[_0x81d1('0x4d')](handleError(_0x92d968,null));};exports[_0x81d1('0x4e')]=function(_0x5a0a38,_0x1611db){var _0x3cdadb={'raw':![],'where':{'id':_0x5a0a38['params']['id']}},_0x33d1a4={};_0x33d1a4[_0x81d1('0x38')]=_[_0x81d1('0x39')](db['DeskAccount']['rawAttributes']);_0x33d1a4[_0x81d1('0x3c')]=_[_0x81d1('0x39')](_0x5a0a38[_0x81d1('0x3c')]);_0x33d1a4[_0x81d1('0x3a')]=_['intersection'](_0x33d1a4['model'],_0x33d1a4[_0x81d1('0x3c')]);_0x3cdadb[_0x81d1('0x3e')]=_['intersection'](_0x33d1a4[_0x81d1('0x38')],qs[_0x81d1('0x3d')](_0x5a0a38[_0x81d1('0x3c')][_0x81d1('0x3d')]));_0x3cdadb['attributes']=_0x3cdadb[_0x81d1('0x3e')][_0x81d1('0x4f')]?_0x3cdadb[_0x81d1('0x3e')]:_0x33d1a4[_0x81d1('0x38')];if(_0x5a0a38[_0x81d1('0x3c')][_0x81d1('0x49')]){_0x3cdadb[_0x81d1('0x4a')]=[{'all':!![]}];}_0x3cdadb=_['merge']({},_0x3cdadb,_0x5a0a38[_0x81d1('0x48')]);return db[_0x81d1('0x33')]['find'](_0x3cdadb)['then'](handleEntityNotFound(_0x1611db,null))['then'](respondWithResult(_0x1611db,null))[_0x81d1('0x4d')](handleError(_0x1611db,null));};exports[_0x81d1('0x50')]=function(_0x59fe8b,_0x38ef97){return db[_0x81d1('0x33')][_0x81d1('0x50')](_0x59fe8b[_0x81d1('0x51')],{})[_0x81d1('0x2e')](respondWithResult(_0x38ef97,0xc9))[_0x81d1('0x4d')](handleError(_0x38ef97,null));};exports[_0x81d1('0x2d')]=function(_0x118ffa,_0x9df625){if(_0x118ffa['body']['id']){delete _0x118ffa[_0x81d1('0x51')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x118ffa[_0x81d1('0x52')]['id']}})[_0x81d1('0x2e')](handleEntityNotFound(_0x9df625,null))[_0x81d1('0x2e')](saveUpdates(_0x118ffa[_0x81d1('0x51')],null))[_0x81d1('0x2e')](respondWithResult(_0x9df625,null))['catch'](handleError(_0x9df625,null));};exports['destroy']=function(_0xe069de,_0x8c92fc){return db[_0x81d1('0x33')][_0x81d1('0x53')]({'where':{'id':_0xe069de[_0x81d1('0x52')]['id']}})[_0x81d1('0x2e')](handleEntityNotFound(_0x8c92fc,null))[_0x81d1('0x2e')](removeEntity(_0x8c92fc,null))['catch'](handleError(_0x8c92fc,null));};exports[_0x81d1('0x54')]=function(_0x5a5e87,_0x5e5530,_0x104612){var _0x143e4a={};var _0x4bc385={};var _0x5b324c;var _0x21d6b1;return db[_0x81d1('0x33')][_0x81d1('0x55')]({'where':{'id':_0x5a5e87[_0x81d1('0x52')]['id']}})[_0x81d1('0x2e')](handleEntityNotFound(_0x5e5530,null))[_0x81d1('0x2e')](function(_0x5b3e49){if(_0x5b3e49){_0x5b324c=_0x5b3e49;_0x4bc385[_0x81d1('0x38')]=_[_0x81d1('0x39')](db[_0x81d1('0x56')][_0x81d1('0x34')]);_0x4bc385[_0x81d1('0x3c')]=_[_0x81d1('0x39')](_0x5a5e87[_0x81d1('0x3c')]);_0x4bc385[_0x81d1('0x3a')]=_[_0x81d1('0x3b')](_0x4bc385[_0x81d1('0x38')],_0x4bc385[_0x81d1('0x3c')]);_0x143e4a[_0x81d1('0x3e')]=_[_0x81d1('0x3b')](_0x4bc385[_0x81d1('0x38')],qs[_0x81d1('0x3d')](_0x5a5e87[_0x81d1('0x3c')][_0x81d1('0x3d')]));_0x143e4a[_0x81d1('0x3e')]=_0x143e4a['attributes'][_0x81d1('0x4f')]?_0x143e4a['attributes']:_0x4bc385[_0x81d1('0x38')];_0x143e4a[_0x81d1('0x41')]=qs[_0x81d1('0x42')](_0x5a5e87['query'][_0x81d1('0x42')]);_0x143e4a[_0x81d1('0x43')]=qs[_0x81d1('0x3a')](_['pick'](_0x5a5e87[_0x81d1('0x3c')],_0x4bc385['filters']));if(_0x5a5e87[_0x81d1('0x3c')][_0x81d1('0x45')]){_0x143e4a[_0x81d1('0x43')]=_[_0x81d1('0x47')](_0x143e4a[_0x81d1('0x43')],{'$or':_[_0x81d1('0x32')](_0x143e4a['attributes'],function(_0x3ae9cf){var _0x4f055c={};_0x4f055c[_0x3ae9cf]={'$like':'%'+_0x5a5e87['query'][_0x81d1('0x45')]+'%'};return _0x4f055c;})});}_0x143e4a=_[_0x81d1('0x47')]({},_0x143e4a,_0x5a5e87[_0x81d1('0x48')]);return _0x5b324c['getConfigurations'](_0x143e4a);}})[_0x81d1('0x2e')](function(_0x1e2802){if(_0x1e2802){_0x21d6b1=_0x1e2802['length'];if(!_0x5a5e87[_0x81d1('0x3c')][_0x81d1('0x3f')](_0x81d1('0x40'))){_0x143e4a[_0x81d1('0x2a')]=qs[_0x81d1('0x2a')](_0x5a5e87[_0x81d1('0x3c')][_0x81d1('0x2a')]);_0x143e4a[_0x81d1('0x29')]=qs[_0x81d1('0x29')](_0x5a5e87[_0x81d1('0x3c')][_0x81d1('0x29')]);}return _0x5b324c[_0x81d1('0x54')](_0x143e4a);}})[_0x81d1('0x2e')](function(_0x3464e0){if(_0x3464e0){return _0x3464e0?{'count':_0x21d6b1,'rows':_0x3464e0}:null;}})[_0x81d1('0x2e')](respondWithResult(_0x5e5530,null))['catch'](handleError(_0x5e5530,null));};exports['addConfiguration']=function(_0x15220b,_0x547742,_0x1c0d47){if(_0x15220b[_0x81d1('0x51')]['id']){delete _0x15220b[_0x81d1('0x51')]['id'];}return db[_0x81d1('0x33')][_0x81d1('0x55')]({'where':{'id':_0x15220b[_0x81d1('0x52')]['id']}})['then'](handleEntityNotFound(_0x547742,null))['then'](function(_0x1e0fe1){if(_0x1e0fe1){_0x15220b[_0x81d1('0x51')][_0x81d1('0x57')]=_0x1e0fe1['id'];_0x15220b[_0x81d1('0x51')][_0x81d1('0x58')]=integrations['getSubjects'](_0x15220b[_0x81d1('0x51')]['channel'],_0x15220b[_0x81d1('0x51')][_0x81d1('0x36')]);_0x15220b['body']['Descriptions']=integrations[_0x81d1('0x59')](_0x15220b['body'][_0x81d1('0x5a')],_0x15220b[_0x81d1('0x51')]['type']);return db['DeskConfiguration'][_0x81d1('0x50')](_0x15220b[_0x81d1('0x51')],{'include':[{'model':db[_0x81d1('0x5b')],'as':_0x81d1('0x58')},{'model':db[_0x81d1('0x5b')],'as':_0x81d1('0x5c')}]});}return null;})[_0x81d1('0x2e')](respondWithResult(_0x547742,null))[_0x81d1('0x4d')](handleError(_0x547742,null));};exports['getFields']=function(_0xfebe04,_0x127b5b,_0x1ad629){var _0x1df7c8=[{'name':_0x81d1('0x5d'),'label':_0x81d1('0x5d'),'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 _0x387f9a='';return db[_0x81d1('0x33')]['findOne']({'where':{'id':_0xfebe04[_0x81d1('0x52')]['id']},'attributes':['id',_0x81d1('0x5e'),_0x81d1('0x5f'),_0x81d1('0x60'),_0x81d1('0x61'),_0x81d1('0x62'),'consumerSecret',_0x81d1('0x63'),_0x81d1('0x64')]})['then'](handleEntityNotFound(_0x127b5b,null))['then'](function(_0x1eb88){if(_0x1eb88){_0x387f9a=_0x1eb88['remoteUri'];var _0x4bfa75=_0x387f9a['slice'](-0x1);if(_0x4bfa75==='/'){_0x387f9a=_0x387f9a[_0x81d1('0x65')](0x0,_0x387f9a[_0x81d1('0x66')](_0x4bfa75));}var _0x2719cc={'method':_0x81d1('0x67'),'uri':util['format'](_0x81d1('0x68'),_0x387f9a),'headers':{'Content-Type':_0x81d1('0x69'),'Accept':_0x81d1('0x69')},'json':!![]};if(_0x1eb88[_0x81d1('0x5f')]===_0x81d1('0x6a')){_0x2719cc['headers'][_0x81d1('0x6b')]=util[_0x81d1('0x6c')](_0x81d1('0x6d'),new Buffer(util['format'](_0x81d1('0x6e'),_0x1eb88[_0x81d1('0x60')],_0x1eb88[_0x81d1('0x61')]))['toString']('base64'));}return rp(_0x2719cc)[_0x81d1('0x2e')](function(_0x25753c){return _0x1df7c8[_0x81d1('0x6f')](_[_0x81d1('0x32')](_0x25753c['_embedded'][_0x81d1('0x70')],function(_0x24fe15){return{'id':_0x24fe15[_0x81d1('0x31')],'name':_0x24fe15[_0x81d1('0x31')],'type':_0x24fe15['type'],'active':_0x24fe15['active'],'label':_0x24fe15['label'],'custom':!![]};}));});}})[_0x81d1('0x2e')](function(_0x331854){return{'count':_0x331854[_0x81d1('0x4f')],'rows':_0x331854};})[_0x81d1('0x2e')](respondWithResult(_0x127b5b,null))['catch'](function(_0x1f0063){var _0x4714fe=_0xfebe04[_0x81d1('0x3c')][_0x81d1('0x1b')]?0x1f4:_0x1f0063[_0x81d1('0x71')]||0x1f4;logger[_0x81d1('0x22')](_0x81d1('0x72'),_0x81d1('0x73'),_0x4714fe,JSON[_0x81d1('0x21')](_0x1f0063));delete _0x1f0063[_0x81d1('0x31')];if(_0x4714fe===0x191){_0x4714fe=0x190;}_0x127b5b[_0x81d1('0x26')](_0x4714fe)[_0x81d1('0x74')](_0xfebe04[_0x81d1('0x3c')][_0x81d1('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x1f0063[_0x81d1('0x71')]}:_0x1f0063);});}; \ No newline at end of file +var _0xcd19=['name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','DeskAccount','includeAll','findAll','rows','catch','include','find','create','body','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','Descriptions','getDescriptions','DeskField','Subjects','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','stack'];(function(_0x44cad0,_0x229ce2){var _0x360e6f=function(_0x5a185e){while(--_0x5a185e){_0x44cad0['push'](_0x44cad0['shift']());}};_0x360e6f(++_0x229ce2);}(_0xcd19,0x1b6));var _0x9cd1=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xcd19[_0x3070dc];return _0x431489;};'use strict';var pdf=require(_0x9cd1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cd1('0x1'));var zipdir=require(_0x9cd1('0x2'));var jsonpatch=require(_0x9cd1('0x3'));var rp=require('request-promise');var moment=require(_0x9cd1('0x4'));var BPromise=require(_0x9cd1('0x5'));var Mustache=require('mustache');var util=require(_0x9cd1('0x6'));var path=require(_0x9cd1('0x7'));var sox=require(_0x9cd1('0x8'));var csv=require(_0x9cd1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cd1('0xa'));var squel=require(_0x9cd1('0xb'));var crypto=require('crypto');var jsforce=require(_0x9cd1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cd1('0xd'));var authService=require(_0x9cd1('0xe'));var qs=require(_0x9cd1('0xf'));var as=require(_0x9cd1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd1('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9cd1('0x12'))['db'];var integrations=require(_0x9cd1('0x13'));var jayson=require(_0x9cd1('0x14'));var client=jayson[_0x9cd1('0x15')][_0x9cd1('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5a677f,_0x14bc74,_0x1cf60e){if(_0x1cf60e){var _0x5d28e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d28e7['test'](_0x14bc74)){return _0x5a677f;}else{throw new db[(_0x9cd1('0x17'))]['ValidationError'](_0x9cd1('0x18'));}}else{return _0x5a677f;}}function respondWithRpcPromise(_0x309246,_0x1fe2c9,_0x83cd9c,_0x1be2d0){return new BPromise(function(_0x4c9f27,_0x4ee32f){var _0x5d2093=_0x1be2d0||client;return _0x5d2093[_0x9cd1('0x19')](_0x309246,_0x83cd9c)[_0x9cd1('0x1a')](function(_0x3f1f4c){logger[_0x9cd1('0x1b')](_0x9cd1('0x1c'),_0x1fe2c9,_0x9cd1('0x1d'));logger[_0x9cd1('0x1e')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1fe2c9,_0x9cd1('0x1d'),JSON[_0x9cd1('0x1f')](_0x3f1f4c));if(_0x3f1f4c[_0x9cd1('0x20')]){if(_0x3f1f4c[_0x9cd1('0x20')][_0x9cd1('0x21')]===0x1f4){logger[_0x9cd1('0x20')](_0x9cd1('0x1c'),_0x1fe2c9,_0x3f1f4c[_0x9cd1('0x20')]['message']);return _0x4ee32f(_0x3f1f4c['error']['message']);}logger[_0x9cd1('0x20')]('DeskAccount,\x20%s,\x20%s',_0x1fe2c9,_0x3f1f4c[_0x9cd1('0x20')][_0x9cd1('0x22')]);return _0x4c9f27(_0x3f1f4c['error']['message']);}else{logger[_0x9cd1('0x1b')](_0x9cd1('0x1c'),_0x1fe2c9,_0x9cd1('0x1d'));_0x4c9f27(_0x3f1f4c[_0x9cd1('0x23')][_0x9cd1('0x22')]);}})['catch'](function(_0x1d0917){logger['error'](_0x9cd1('0x1c'),_0x1fe2c9,_0x1d0917);_0x4ee32f(_0x1d0917);});});}function respondWithStatusCode(_0x2a609d,_0xc69cd3){_0xc69cd3=_0xc69cd3||0xcc;return function(_0x78197e){if(_0x78197e){return _0x2a609d[_0x9cd1('0x24')](_0xc69cd3);}return _0x2a609d[_0x9cd1('0x25')](_0xc69cd3)[_0x9cd1('0x26')]();};}function respondWithResult(_0x10180e,_0x8cd113){_0x8cd113=_0x8cd113||0xc8;return function(_0x288414){if(_0x288414){return _0x10180e[_0x9cd1('0x25')](_0x8cd113)['json'](_0x288414);}};}function respondWithFilteredResult(_0x303581,_0x522600){return function(_0x102caf){if(_0x102caf){var _0xe57da=_0x102caf[_0x9cd1('0x27')],_0x4868e0=_0x522600['offset'],_0x24520f=_0x522600[_0x9cd1('0x28')]+_0x522600[_0x9cd1('0x29')],_0x1d96f3;if(_0x24520f>=_0xe57da){_0x24520f=_0xe57da;_0x1d96f3=0xc8;}else{_0x1d96f3=0xce;}_0x303581['status'](_0x1d96f3);return _0x303581[_0x9cd1('0x2a')](_0x9cd1('0x2b'),_0x4868e0+'-'+_0x24520f+'/'+_0xe57da)[_0x9cd1('0x2c')](_0x102caf);}return null;};}function patchUpdates(_0x127724){return function(_0x4b5434){try{jsonpatch[_0x9cd1('0x2d')](_0x4b5434,_0x127724,!![]);}catch(_0x532de8){return BPromise[_0x9cd1('0x2e')](_0x532de8);}return _0x4b5434[_0x9cd1('0x2f')]();};}function saveUpdates(_0x2d474d,_0x41eddd){return function(_0x516f48){if(_0x516f48){return _0x516f48[_0x9cd1('0x30')](_0x2d474d)[_0x9cd1('0x1a')](function(_0x38cefb){return _0x38cefb;});}return null;};}function removeEntity(_0x9740f8,_0x52d239){return function(_0x54ee54){if(_0x54ee54){return _0x54ee54['destroy']()['then'](function(){_0x9740f8[_0x9cd1('0x25')](0xcc)[_0x9cd1('0x26')]();});}};}function handleEntityNotFound(_0x29e47b,_0x7b99a3){return function(_0x5f19a0){if(!_0x5f19a0){_0x29e47b['sendStatus'](0x194);}return _0x5f19a0;};}function handleError(_0x125c12,_0x32e7e9){_0x32e7e9=_0x32e7e9||0x1f4;return function(_0x16ba19){logger[_0x9cd1('0x20')](_0x16ba19[_0x9cd1('0x31')]);if(_0x16ba19[_0x9cd1('0x32')]){delete _0x16ba19[_0x9cd1('0x32')];}_0x125c12[_0x9cd1('0x25')](_0x32e7e9)['send'](_0x16ba19);};}exports[_0x9cd1('0x33')]=function(_0x37ef09,_0x471633){var _0x24e039={},_0x2ce3b0={},_0x4e522d={'count':0x0,'rows':[]};var _0x49039f=_['map'](db['DeskAccount'][_0x9cd1('0x34')],function(_0x319f63){return{'name':_0x319f63['fieldName'],'type':_0x319f63[_0x9cd1('0x35')][_0x9cd1('0x36')]};});_0x2ce3b0[_0x9cd1('0x37')]=_[_0x9cd1('0x38')](_0x49039f,'name');_0x2ce3b0[_0x9cd1('0x39')]=_[_0x9cd1('0x3a')](_0x37ef09[_0x9cd1('0x39')]);_0x2ce3b0[_0x9cd1('0x3b')]=_[_0x9cd1('0x3c')](_0x2ce3b0[_0x9cd1('0x37')],_0x2ce3b0[_0x9cd1('0x39')]);_0x24e039['attributes']=_[_0x9cd1('0x3c')](_0x2ce3b0[_0x9cd1('0x37')],qs['fields'](_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x3d')]));_0x24e039[_0x9cd1('0x3e')]=_0x24e039[_0x9cd1('0x3e')][_0x9cd1('0x3f')]?_0x24e039[_0x9cd1('0x3e')]:_0x2ce3b0[_0x9cd1('0x37')];if(!_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x40')](_0x9cd1('0x41'))){_0x24e039[_0x9cd1('0x29')]=qs[_0x9cd1('0x29')](_0x37ef09[_0x9cd1('0x39')]['limit']);_0x24e039[_0x9cd1('0x28')]=qs[_0x9cd1('0x28')](_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x28')]);}_0x24e039[_0x9cd1('0x42')]=qs[_0x9cd1('0x43')](_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x43')]);_0x24e039['where']=qs[_0x9cd1('0x3b')](_[_0x9cd1('0x44')](_0x37ef09[_0x9cd1('0x39')],_0x2ce3b0[_0x9cd1('0x3b')]),_0x49039f);if(_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x45')]){_0x24e039[_0x9cd1('0x46')]=_[_0x9cd1('0x47')](_0x24e039['where'],{'$or':_[_0x9cd1('0x38')](_0x49039f,function(_0x2775bf){if(_0x2775bf[_0x9cd1('0x35')]!=='VIRTUAL'){var _0x542608={};_0x542608[_0x2775bf[_0x9cd1('0x32')]]={'$like':'%'+_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x45')]+'%'};return _0x542608;}})});}_0x24e039=_[_0x9cd1('0x47')]({},_0x24e039,_0x37ef09[_0x9cd1('0x48')]);var _0x30d776={'where':_0x24e039[_0x9cd1('0x46')]};return db[_0x9cd1('0x49')][_0x9cd1('0x27')](_0x30d776)['then'](function(_0x3b462e){_0x4e522d[_0x9cd1('0x27')]=_0x3b462e;if(_0x37ef09[_0x9cd1('0x39')][_0x9cd1('0x4a')]){_0x24e039['include']=[{'all':!![]}];}return db['DeskAccount'][_0x9cd1('0x4b')](_0x24e039);})[_0x9cd1('0x1a')](function(_0xd2199a){_0x4e522d[_0x9cd1('0x4c')]=_0xd2199a;return _0x4e522d;})[_0x9cd1('0x1a')](respondWithFilteredResult(_0x471633,_0x24e039))[_0x9cd1('0x4d')](handleError(_0x471633,null));};exports['show']=function(_0x59fcce,_0x4383db){var _0x24ad45={'raw':![],'where':{'id':_0x59fcce['params']['id']}},_0x3102d0={};_0x3102d0[_0x9cd1('0x37')]=_[_0x9cd1('0x3a')](db[_0x9cd1('0x49')][_0x9cd1('0x34')]);_0x3102d0[_0x9cd1('0x39')]=_['keys'](_0x59fcce['query']);_0x3102d0[_0x9cd1('0x3b')]=_['intersection'](_0x3102d0[_0x9cd1('0x37')],_0x3102d0[_0x9cd1('0x39')]);_0x24ad45[_0x9cd1('0x3e')]=_[_0x9cd1('0x3c')](_0x3102d0[_0x9cd1('0x37')],qs[_0x9cd1('0x3d')](_0x59fcce[_0x9cd1('0x39')][_0x9cd1('0x3d')]));_0x24ad45[_0x9cd1('0x3e')]=_0x24ad45['attributes'][_0x9cd1('0x3f')]?_0x24ad45[_0x9cd1('0x3e')]:_0x3102d0[_0x9cd1('0x37')];if(_0x59fcce[_0x9cd1('0x39')][_0x9cd1('0x4a')]){_0x24ad45[_0x9cd1('0x4e')]=[{'all':!![]}];}_0x24ad45=_['merge']({},_0x24ad45,_0x59fcce['options']);return db[_0x9cd1('0x49')][_0x9cd1('0x4f')](_0x24ad45)['then'](handleEntityNotFound(_0x4383db,null))['then'](respondWithResult(_0x4383db,null))[_0x9cd1('0x4d')](handleError(_0x4383db,null));};exports[_0x9cd1('0x50')]=function(_0x68f011,_0x590cc3){return db[_0x9cd1('0x49')][_0x9cd1('0x50')](_0x68f011[_0x9cd1('0x51')],{})[_0x9cd1('0x1a')](respondWithResult(_0x590cc3,0xc9))[_0x9cd1('0x4d')](handleError(_0x590cc3,null));};exports[_0x9cd1('0x30')]=function(_0x119f55,_0x23ff36){if(_0x119f55[_0x9cd1('0x51')]['id']){delete _0x119f55[_0x9cd1('0x51')]['id'];}return db[_0x9cd1('0x49')]['find']({'where':{'id':_0x119f55[_0x9cd1('0x52')]['id']}})['then'](handleEntityNotFound(_0x23ff36,null))[_0x9cd1('0x1a')](saveUpdates(_0x119f55[_0x9cd1('0x51')],null))[_0x9cd1('0x1a')](respondWithResult(_0x23ff36,null))['catch'](handleError(_0x23ff36,null));};exports['destroy']=function(_0x124cf7,_0x2b847c){return db[_0x9cd1('0x49')][_0x9cd1('0x4f')]({'where':{'id':_0x124cf7[_0x9cd1('0x52')]['id']}})[_0x9cd1('0x1a')](handleEntityNotFound(_0x2b847c,null))[_0x9cd1('0x1a')](removeEntity(_0x2b847c,null))['catch'](handleError(_0x2b847c,null));};exports[_0x9cd1('0x53')]=function(_0x25fceb,_0x4cd660,_0x80a4ec){var _0x214835={};var _0xd1cd00={};var _0x2e840d;var _0x568472;return db[_0x9cd1('0x49')]['findOne']({'where':{'id':_0x25fceb[_0x9cd1('0x52')]['id']}})[_0x9cd1('0x1a')](handleEntityNotFound(_0x4cd660,null))[_0x9cd1('0x1a')](function(_0x10ad4f){if(_0x10ad4f){_0x2e840d=_0x10ad4f;_0xd1cd00[_0x9cd1('0x37')]=_[_0x9cd1('0x3a')](db[_0x9cd1('0x54')]['rawAttributes']);_0xd1cd00['query']=_[_0x9cd1('0x3a')](_0x25fceb[_0x9cd1('0x39')]);_0xd1cd00[_0x9cd1('0x3b')]=_[_0x9cd1('0x3c')](_0xd1cd00[_0x9cd1('0x37')],_0xd1cd00[_0x9cd1('0x39')]);_0x214835['attributes']=_[_0x9cd1('0x3c')](_0xd1cd00[_0x9cd1('0x37')],qs[_0x9cd1('0x3d')](_0x25fceb[_0x9cd1('0x39')][_0x9cd1('0x3d')]));_0x214835[_0x9cd1('0x3e')]=_0x214835['attributes'][_0x9cd1('0x3f')]?_0x214835[_0x9cd1('0x3e')]:_0xd1cd00[_0x9cd1('0x37')];_0x214835['order']=qs['sort'](_0x25fceb['query'][_0x9cd1('0x43')]);_0x214835['where']=qs[_0x9cd1('0x3b')](_[_0x9cd1('0x44')](_0x25fceb[_0x9cd1('0x39')],_0xd1cd00[_0x9cd1('0x3b')]));if(_0x25fceb[_0x9cd1('0x39')][_0x9cd1('0x45')]){_0x214835['where']=_[_0x9cd1('0x47')](_0x214835[_0x9cd1('0x46')],{'$or':_['map'](_0x214835[_0x9cd1('0x3e')],function(_0x59dc8c){var _0x32df32={};_0x32df32[_0x59dc8c]={'$like':'%'+_0x25fceb[_0x9cd1('0x39')]['filter']+'%'};return _0x32df32;})});}_0x214835=_[_0x9cd1('0x47')]({},_0x214835,_0x25fceb['options']);return _0x2e840d[_0x9cd1('0x53')](_0x214835);}})[_0x9cd1('0x1a')](function(_0x492390){if(_0x492390){_0x568472=_0x492390['length'];if(!_0x25fceb['query']['hasOwnProperty']('nolimit')){_0x214835['limit']=qs['limit'](_0x25fceb[_0x9cd1('0x39')][_0x9cd1('0x29')]);_0x214835[_0x9cd1('0x28')]=qs[_0x9cd1('0x28')](_0x25fceb[_0x9cd1('0x39')][_0x9cd1('0x28')]);}return _0x2e840d[_0x9cd1('0x53')](_0x214835);}})['then'](function(_0x1865fe){if(_0x1865fe){return _0x1865fe?{'count':_0x568472,'rows':_0x1865fe}:null;}})[_0x9cd1('0x1a')](respondWithResult(_0x4cd660,null))['catch'](handleError(_0x4cd660,null));};exports[_0x9cd1('0x55')]=function(_0x2085c8,_0x100d83,_0x1c5ac3){if(_0x2085c8[_0x9cd1('0x51')]['id']){delete _0x2085c8[_0x9cd1('0x51')]['id'];}return db[_0x9cd1('0x49')][_0x9cd1('0x56')]({'where':{'id':_0x2085c8[_0x9cd1('0x52')]['id']}})['then'](handleEntityNotFound(_0x100d83,null))[_0x9cd1('0x1a')](function(_0x3ceb91){if(_0x3ceb91){_0x2085c8[_0x9cd1('0x51')][_0x9cd1('0x57')]=_0x3ceb91['id'];_0x2085c8[_0x9cd1('0x51')]['Subjects']=integrations['getSubjects'](_0x2085c8[_0x9cd1('0x51')]['channel'],_0x2085c8[_0x9cd1('0x51')]['type']);_0x2085c8[_0x9cd1('0x51')][_0x9cd1('0x58')]=integrations[_0x9cd1('0x59')](_0x2085c8[_0x9cd1('0x51')]['channel'],_0x2085c8['body'][_0x9cd1('0x35')]);return db[_0x9cd1('0x54')][_0x9cd1('0x50')](_0x2085c8[_0x9cd1('0x51')],{'include':[{'model':db[_0x9cd1('0x5a')],'as':_0x9cd1('0x5b')},{'model':db[_0x9cd1('0x5a')],'as':_0x9cd1('0x58')}]});}return null;})[_0x9cd1('0x1a')](respondWithResult(_0x100d83,null))[_0x9cd1('0x4d')](handleError(_0x100d83,null));};exports['getFields']=function(_0x139e39,_0x446c49,_0x1d63d1){var _0x716258=[{'name':_0x9cd1('0x5c'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1857a5='';return db[_0x9cd1('0x49')]['findOne']({'where':{'id':_0x139e39[_0x9cd1('0x52')]['id']},'attributes':['id','remoteUri',_0x9cd1('0x5d'),_0x9cd1('0x5e'),_0x9cd1('0x5f'),_0x9cd1('0x60'),_0x9cd1('0x61'),_0x9cd1('0x62'),_0x9cd1('0x63')]})[_0x9cd1('0x1a')](handleEntityNotFound(_0x446c49,null))['then'](function(_0x4bfc78){if(_0x4bfc78){_0x1857a5=_0x4bfc78['remoteUri'];var _0x1ccd30=_0x1857a5[_0x9cd1('0x64')](-0x1);if(_0x1ccd30==='/'){_0x1857a5=_0x1857a5[_0x9cd1('0x65')](0x0,_0x1857a5[_0x9cd1('0x66')](_0x1ccd30));}var _0x142aba={'method':_0x9cd1('0x67'),'uri':util[_0x9cd1('0x68')](_0x9cd1('0x69'),_0x1857a5),'headers':{'Content-Type':_0x9cd1('0x6a'),'Accept':_0x9cd1('0x6a')},'json':!![]};if(_0x4bfc78[_0x9cd1('0x5d')]===_0x9cd1('0x6b')){_0x142aba[_0x9cd1('0x6c')][_0x9cd1('0x6d')]=util['format'](_0x9cd1('0x6e'),new Buffer(util[_0x9cd1('0x68')](_0x9cd1('0x6f'),_0x4bfc78[_0x9cd1('0x5e')],_0x4bfc78['password']))[_0x9cd1('0x70')]('base64'));}return rp(_0x142aba)[_0x9cd1('0x1a')](function(_0x3c3230){return _0x716258[_0x9cd1('0x71')](_[_0x9cd1('0x38')](_0x3c3230[_0x9cd1('0x72')]['entries'],function(_0x5b5f8a){return{'id':_0x5b5f8a['name'],'name':_0x5b5f8a['name'],'type':_0x5b5f8a[_0x9cd1('0x35')],'active':_0x5b5f8a[_0x9cd1('0x73')],'label':_0x5b5f8a[_0x9cd1('0x74')],'custom':!![]};}));});}})['then'](function(_0x539e4b){return{'count':_0x539e4b[_0x9cd1('0x3f')],'rows':_0x539e4b};})[_0x9cd1('0x1a')](respondWithResult(_0x446c49,null))['catch'](function(_0x579189){var _0x4bf142=_0x139e39[_0x9cd1('0x39')]['test']?0x1f4:_0x579189[_0x9cd1('0x75')]||0x1f4;logger[_0x9cd1('0x20')](_0x9cd1('0x76'),_0x9cd1('0x77'),_0x4bf142,JSON[_0x9cd1('0x1f')](_0x579189));delete _0x579189[_0x9cd1('0x32')];if(_0x4bf142===0x191){_0x4bf142=0x190;}_0x446c49['status'](_0x4bf142)[_0x9cd1('0x78')](_0x139e39[_0x9cd1('0x39')][_0x9cd1('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x579189[_0x9cd1('0x75')]}:_0x579189);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8048050..29172d5 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 _0x1e23=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1e23,0x1ad));var _0x31e2=function(_0x362f7e,_0xf6cffe){_0x362f7e=_0x362f7e-0x0;var _0x213f29=_0x1e23[_0x362f7e];return _0x213f29;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x31e2('0x0'));var BPromise=require(_0x31e2('0x1'));var rp=require(_0x31e2('0x2'));var fs=require('fs');var path=require(_0x31e2('0x3'));var rimraf=require(_0x31e2('0x4'));var config=require(_0x31e2('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x31e2('0x6'));module[_0x31e2('0x7')]=function(_0x5d5b9f,_0x324181){return _0x5d5b9f[_0x31e2('0x8')](_0x31e2('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7455=['util','bluebird','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash'];(function(_0x5e01ba,_0x316153){var _0x553736=function(_0x37365c){while(--_0x37365c){_0x5e01ba['push'](_0x5e01ba['shift']());}};_0x553736(++_0x316153);}(_0x7455,0x67));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5745('0x0'));var util=require(_0x5745('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5745('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5745('0x3'));var attributes=require(_0x5745('0x4'));var integrations=require(_0x5745('0x5'));module['exports']=function(_0x255711,_0x28e555){return _0x255711[_0x5745('0x6')]('DeskAccount',attributes,{'tableName':_0x5745('0x7'),'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 f9d9bf6..53d4dbd 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 _0xc202=['ShowDeskAccount','find','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','options','where','limit','include','model','attributes','map','catch'];(function(_0x219849,_0x999a1){var _0x44dba3=function(_0x383fc4){while(--_0x383fc4){_0x219849['push'](_0x219849['shift']());}};_0x44dba3(++_0x999a1);}(_0xc202,0x139));var _0x2c20=function(_0x7dba8a,_0x5c540a){_0x7dba8a=_0x7dba8a-0x0;var _0x29e9f7=_0xc202[_0x7dba8a];return _0x29e9f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c20('0x0'));var BPromise=require(_0x2c20('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c20('0x2'));var db=require(_0x2c20('0x3'))['db'];var utils=require(_0x2c20('0x4'));var logger=require(_0x2c20('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c20('0x6'));var client=jayson['client'][_0x2c20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e96ed,_0x2895fb,_0x48706a){return new BPromise(function(_0x2aecc6,_0x4facf2){return client[_0x2c20('0x8')](_0x5e96ed,_0x48706a)[_0x2c20('0x9')](function(_0x144d0e){logger[_0x2c20('0xa')]('DeskAccount,\x20%s,\x20%s',_0x2895fb,_0x2c20('0xb'));logger[_0x2c20('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2895fb,_0x2c20('0xb'),JSON[_0x2c20('0xd')](_0x144d0e));if(_0x144d0e['error']){if(_0x144d0e[_0x2c20('0xe')]['code']===0x1f4){logger[_0x2c20('0xe')](_0x2c20('0xf'),_0x2895fb,_0x144d0e['error'][_0x2c20('0x10')]);return _0x4facf2(_0x144d0e['error']['message']);}logger['error'](_0x2c20('0xf'),_0x2895fb,_0x144d0e[_0x2c20('0xe')][_0x2c20('0x10')]);return _0x2aecc6(_0x144d0e[_0x2c20('0xe')][_0x2c20('0x10')]);}else{logger[_0x2c20('0xa')]('DeskAccount,\x20%s,\x20%s',_0x2895fb,_0x2c20('0xb'));_0x2aecc6(_0x144d0e[_0x2c20('0x11')]['message']);}})['catch'](function(_0x30d095){logger[_0x2c20('0xe')](_0x2c20('0xf'),_0x2895fb,_0x30d095);_0x4facf2(_0x30d095);});});}exports[_0x2c20('0x12')]=function(_0x274931){var _0x186c0d=this;return new Promise(function(_0x5ea744,_0x14fa81){return db[_0x2c20('0x13')]['findAll']({'raw':_0x274931['options']?_0x274931[_0x2c20('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x274931['options']?_0x274931[_0x2c20('0x14')][_0x2c20('0x15')]||null:null,'attributes':_0x274931[_0x2c20('0x14')]?_0x274931[_0x2c20('0x14')]['attributes']||null:null,'limit':_0x274931[_0x2c20('0x14')]?_0x274931[_0x2c20('0x14')][_0x2c20('0x16')]||null:null,'include':_0x274931['options']?_0x274931[_0x2c20('0x14')]['include']?_['map'](_0x274931['options'][_0x2c20('0x17')],function(_0x2baae2){return{'model':db[_0x2baae2[_0x2c20('0x18')]],'as':_0x2baae2['as'],'attributes':_0x2baae2[_0x2c20('0x19')],'include':_0x2baae2[_0x2c20('0x17')]?_[_0x2c20('0x1a')](_0x2baae2[_0x2c20('0x17')],function(_0x2356fc){return{'model':db[_0x2356fc['model']],'as':_0x2356fc['as'],'attributes':_0x2356fc[_0x2c20('0x19')],'include':_0x2356fc[_0x2c20('0x17')]?_[_0x2c20('0x1a')](_0x2356fc[_0x2c20('0x17')],function(_0x2db4db){return{'model':db[_0x2db4db[_0x2c20('0x18')]],'as':_0x2db4db['as'],'attributes':_0x2db4db['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c20('0x9')](function(_0x3f855a){logger['info'](_0x2c20('0x12'),_0x274931);logger[_0x2c20('0xc')](_0x2c20('0x12'),_0x274931,JSON[_0x2c20('0xd')](_0x3f855a));_0x5ea744(_0x3f855a);})[_0x2c20('0x1b')](function(_0x210790){logger[_0x2c20('0xe')](_0x2c20('0x12'),_0x210790['message'],_0x274931);_0x14fa81(_0x186c0d[_0x2c20('0xe')](0x1f4,_0x210790['message']));});});};exports[_0x2c20('0x1c')]=function(_0x2b936c){var _0x4c307f=this;return new Promise(function(_0x65f7ce,_0x1760e9){return db[_0x2c20('0x13')][_0x2c20('0x1d')]({'raw':_0x2b936c['options']?_0x2b936c['options'][_0x2c20('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b936c[_0x2c20('0x14')]?_0x2b936c[_0x2c20('0x14')][_0x2c20('0x15')]||null:null,'attributes':_0x2b936c[_0x2c20('0x14')]?_0x2b936c['options']['attributes']||null:null,'include':_0x2b936c[_0x2c20('0x14')]?_0x2b936c['options']['include']?_[_0x2c20('0x1a')](_0x2b936c[_0x2c20('0x14')][_0x2c20('0x17')],function(_0x4ee711){return{'model':db[_0x4ee711['model']],'as':_0x4ee711['as'],'attributes':_0x4ee711[_0x2c20('0x19')],'include':_0x4ee711[_0x2c20('0x17')]?_[_0x2c20('0x1a')](_0x4ee711[_0x2c20('0x17')],function(_0x1db681){return{'model':db[_0x1db681[_0x2c20('0x18')]],'as':_0x1db681['as'],'attributes':_0x1db681['attributes'],'include':_0x1db681[_0x2c20('0x17')]?_[_0x2c20('0x1a')](_0x1db681['include'],function(_0x56f70f){return{'model':db[_0x56f70f['model']],'as':_0x56f70f['as'],'attributes':_0x56f70f[_0x2c20('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c4471){logger['info'](_0x2c20('0x1c'),_0x2b936c);logger[_0x2c20('0xc')](_0x2c20('0x1c'),_0x2b936c,JSON[_0x2c20('0xd')](_0x5c4471));_0x65f7ce(_0x5c4471);})['catch'](function(_0x57a121){logger[_0x2c20('0xe')](_0x2c20('0x1c'),_0x57a121[_0x2c20('0x10')],_0x2b936c);_0x1760e9(_0x4c307f[_0x2c20('0xe')](0x1f4,_0x57a121[_0x2c20('0x10')]));});});}; \ No newline at end of file +var _0x9761=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','DeskAccount','options','where','limit','include','map','model','attributes','GetDeskAccount','catch','raw','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc8b400,_0x4ef3e4){var _0x135f09=function(_0x3fa1e5){while(--_0x3fa1e5){_0xc8b400['push'](_0xc8b400['shift']());}};_0x135f09(++_0x4ef3e4);}(_0x9761,0x122));var _0x1976=function(_0x2f6e38,_0x18ec65){_0x2f6e38=_0x2f6e38-0x0;var _0x1d5fd2=_0x9761[_0x2f6e38];return _0x1d5fd2;};'use strict';var _=require(_0x1976('0x0'));var util=require(_0x1976('0x1'));var moment=require(_0x1976('0x2'));var BPromise=require(_0x1976('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1976('0x4'))['db'];var utils=require(_0x1976('0x5'));var logger=require(_0x1976('0x6'))(_0x1976('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1976('0x8')][_0x1976('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40f75b,_0x362be1,_0x4d6a71){return new BPromise(function(_0x14502e,_0x581190){return client[_0x1976('0xa')](_0x40f75b,_0x4d6a71)[_0x1976('0xb')](function(_0x64194e){logger[_0x1976('0xc')](_0x1976('0xd'),_0x362be1,_0x1976('0xe'));logger[_0x1976('0xf')](_0x1976('0x10'),_0x362be1,_0x1976('0xe'),JSON[_0x1976('0x11')](_0x64194e));if(_0x64194e[_0x1976('0x12')]){if(_0x64194e[_0x1976('0x12')][_0x1976('0x13')]===0x1f4){logger['error'](_0x1976('0xd'),_0x362be1,_0x64194e[_0x1976('0x12')]['message']);return _0x581190(_0x64194e[_0x1976('0x12')][_0x1976('0x14')]);}logger[_0x1976('0x12')](_0x1976('0xd'),_0x362be1,_0x64194e['error'][_0x1976('0x14')]);return _0x14502e(_0x64194e['error'][_0x1976('0x14')]);}else{logger['info'](_0x1976('0xd'),_0x362be1,'request\x20sent');_0x14502e(_0x64194e[_0x1976('0x15')]['message']);}})['catch'](function(_0x18badc){logger[_0x1976('0x12')](_0x1976('0xd'),_0x362be1,_0x18badc);_0x581190(_0x18badc);});});}exports['GetDeskAccount']=function(_0x368ca6){var _0x43a5ac=this;return new Promise(function(_0x1752b7,_0xad2a91){return db[_0x1976('0x16')]['findAll']({'raw':_0x368ca6[_0x1976('0x17')]?_0x368ca6['options']['raw']===undefined?!![]:![]:!![],'where':_0x368ca6[_0x1976('0x17')]?_0x368ca6[_0x1976('0x17')][_0x1976('0x18')]||null:null,'attributes':_0x368ca6['options']?_0x368ca6[_0x1976('0x17')]['attributes']||null:null,'limit':_0x368ca6[_0x1976('0x17')]?_0x368ca6[_0x1976('0x17')][_0x1976('0x19')]||null:null,'include':_0x368ca6[_0x1976('0x17')]?_0x368ca6[_0x1976('0x17')][_0x1976('0x1a')]?_[_0x1976('0x1b')](_0x368ca6[_0x1976('0x17')][_0x1976('0x1a')],function(_0x5a175c){return{'model':db[_0x5a175c[_0x1976('0x1c')]],'as':_0x5a175c['as'],'attributes':_0x5a175c[_0x1976('0x1d')],'include':_0x5a175c['include']?_[_0x1976('0x1b')](_0x5a175c['include'],function(_0x5413c5){return{'model':db[_0x5413c5[_0x1976('0x1c')]],'as':_0x5413c5['as'],'attributes':_0x5413c5[_0x1976('0x1d')],'include':_0x5413c5[_0x1976('0x1a')]?_[_0x1976('0x1b')](_0x5413c5[_0x1976('0x1a')],function(_0x41903a){return{'model':db[_0x41903a[_0x1976('0x1c')]],'as':_0x41903a['as'],'attributes':_0x41903a[_0x1976('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1976('0xb')](function(_0x14145d){logger[_0x1976('0xc')](_0x1976('0x1e'),_0x368ca6);logger['debug'](_0x1976('0x1e'),_0x368ca6,JSON['stringify'](_0x14145d));_0x1752b7(_0x14145d);})[_0x1976('0x1f')](function(_0x587eac){logger[_0x1976('0x12')](_0x1976('0x1e'),_0x587eac[_0x1976('0x14')],_0x368ca6);_0xad2a91(_0x43a5ac[_0x1976('0x12')](0x1f4,_0x587eac[_0x1976('0x14')]));});});};exports['ShowDeskAccount']=function(_0x2eb249){var _0x447b0b=this;return new Promise(function(_0x530f3e,_0x2dfd92){return db[_0x1976('0x16')]['find']({'raw':_0x2eb249['options']?_0x2eb249[_0x1976('0x17')][_0x1976('0x20')]===undefined?!![]:![]:!![],'where':_0x2eb249['options']?_0x2eb249['options'][_0x1976('0x18')]||null:null,'attributes':_0x2eb249['options']?_0x2eb249[_0x1976('0x17')][_0x1976('0x1d')]||null:null,'include':_0x2eb249[_0x1976('0x17')]?_0x2eb249[_0x1976('0x17')][_0x1976('0x1a')]?_[_0x1976('0x1b')](_0x2eb249[_0x1976('0x17')][_0x1976('0x1a')],function(_0x5aa866){return{'model':db[_0x5aa866[_0x1976('0x1c')]],'as':_0x5aa866['as'],'attributes':_0x5aa866[_0x1976('0x1d')],'include':_0x5aa866[_0x1976('0x1a')]?_[_0x1976('0x1b')](_0x5aa866[_0x1976('0x1a')],function(_0x5cc259){return{'model':db[_0x5cc259[_0x1976('0x1c')]],'as':_0x5cc259['as'],'attributes':_0x5cc259[_0x1976('0x1d')],'include':_0x5cc259[_0x1976('0x1a')]?_[_0x1976('0x1b')](_0x5cc259[_0x1976('0x1a')],function(_0xbb1be2){return{'model':db[_0xbb1be2[_0x1976('0x1c')]],'as':_0xbb1be2['as'],'attributes':_0xbb1be2['attributes']};}):[]};}):[]};}):[]:[]})[_0x1976('0xb')](function(_0x177d5a){logger[_0x1976('0xc')]('ShowDeskAccount',_0x2eb249);logger[_0x1976('0xf')](_0x1976('0x21'),_0x2eb249,JSON[_0x1976('0x11')](_0x177d5a));_0x530f3e(_0x177d5a);})[_0x1976('0x1f')](function(_0x2ba193){logger[_0x1976('0x12')]('ShowDeskAccount',_0x2ba193['message'],_0x2eb249);_0x2dfd92(_0x447b0b['error'](0x1f4,_0x2ba193['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8643616..7eef940 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 _0x4815=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x3be04c,_0x3ec0ed){var _0x25942d=function(_0x38af3b){while(--_0x38af3b){_0x3be04c['push'](_0x3be04c['shift']());}};_0x25942d(++_0x3ec0ed);}(_0x4815,0xff));var _0x5481=function(_0x28a739,_0x53092a){_0x28a739=_0x28a739-0x0;var _0x449513=_0x4815[_0x28a739];return _0x449513;};'use strict';var multer=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var path=require(_0x5481('0x2'));var timeout=require(_0x5481('0x3'));var express=require(_0x5481('0x4'));var router=express[_0x5481('0x5')]();var auth=require(_0x5481('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5481('0x7'));router[_0x5481('0x8')]('/',auth[_0x5481('0x9')](),controller[_0x5481('0xa')]);router[_0x5481('0x8')](_0x5481('0xb'),auth[_0x5481('0x9')](),controller[_0x5481('0xc')]);router[_0x5481('0x8')](_0x5481('0xd'),auth[_0x5481('0x9')](),controller[_0x5481('0xe')]);router[_0x5481('0x8')](_0x5481('0xf'),auth[_0x5481('0x9')](),controller[_0x5481('0x10')]);router['get']('/:id/descriptions',auth[_0x5481('0x9')](),controller[_0x5481('0x11')]);router[_0x5481('0x8')](_0x5481('0x12'),auth['isAuthenticated'](),controller[_0x5481('0x13')]);router['post']('/',auth[_0x5481('0x9')](),controller[_0x5481('0x14')]);router[_0x5481('0x15')]('/:id/tags',auth[_0x5481('0x9')](),controller['setTags']);router[_0x5481('0x16')](_0x5481('0xb'),auth[_0x5481('0x9')](),controller[_0x5481('0x17')]);router[_0x5481('0x18')](_0x5481('0xb'),auth[_0x5481('0x9')](),controller[_0x5481('0x19')]);module[_0x5481('0x1a')]=router; \ No newline at end of file +var _0xb145=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0xb145,0xa3));var _0x5b14=function(_0x51b8bb,_0x28eda6){_0x51b8bb=_0x51b8bb-0x0;var _0x4e8570=_0xb145[_0x51b8bb];return _0x4e8570;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var auth=require(_0x5b14('0x5'));var interaction=require(_0x5b14('0x6'));var config=require(_0x5b14('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x5b14('0x8')]('/',auth[_0x5b14('0x9')](),controller[_0x5b14('0xa')]);router[_0x5b14('0x8')]('/:id',auth[_0x5b14('0x9')](),controller[_0x5b14('0xb')]);router[_0x5b14('0x8')](_0x5b14('0xc'),auth[_0x5b14('0x9')](),controller['getFields']);router[_0x5b14('0x8')](_0x5b14('0xd'),auth['isAuthenticated'](),controller[_0x5b14('0xe')]);router[_0x5b14('0x8')](_0x5b14('0xf'),auth[_0x5b14('0x9')](),controller[_0x5b14('0x10')]);router['get'](_0x5b14('0x11'),auth['isAuthenticated'](),controller[_0x5b14('0x12')]);router[_0x5b14('0x13')]('/',auth[_0x5b14('0x9')](),controller[_0x5b14('0x14')]);router[_0x5b14('0x13')](_0x5b14('0x11'),auth['isAuthenticated'](),controller[_0x5b14('0x15')]);router[_0x5b14('0x16')](_0x5b14('0x17'),auth[_0x5b14('0x9')](),controller[_0x5b14('0x18')]);router[_0x5b14('0x19')](_0x5b14('0x17'),auth[_0x5b14('0x9')](),controller[_0x5b14('0x1a')]);module[_0x5b14('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 24f77ea..e61a6ab 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 _0x3ef0=['exports','STRING','sequelize'];(function(_0x5ac94d,_0x5d3a8c){var _0x563863=function(_0x39285d){while(--_0x39285d){_0x5ac94d['push'](_0x5ac94d['shift']());}};_0x563863(++_0x5d3a8c);}(_0x3ef0,0x197));var _0x03ef=function(_0x54b135,_0x4df52e){_0x54b135=_0x54b135-0x0;var _0x277558=_0x3ef0[_0x54b135];return _0x277558;};'use strict';var Sequelize=require(_0x03ef('0x0'));module[_0x03ef('0x1')]={'name':{'type':Sequelize[_0x03ef('0x2')]},'description':{'type':Sequelize[_0x03ef('0x2')]}}; \ No newline at end of file +var _0xfecf=['STRING','sequelize'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0xfecf,0xab));var _0xffec=function(_0x24f53d,_0x3741f7){_0x24f53d=_0x24f53d-0x0;var _0x5096ba=_0xfecf[_0x24f53d];return _0x5096ba;};'use strict';var Sequelize=require(_0xffec('0x0'));module['exports']={'name':{'type':Sequelize[_0xffec('0x1')]},'description':{'type':Sequelize[_0xffec('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 96401a8..c4ed6d5 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 _0x4abf=['api','../../config/utils','../../config/environment','../../mysqldb','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','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','status','json','offset','limit','set','Content-Range','apply','save','destroy','end','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','then','rows','catch','show','params','find','create','body','getFields','DeskField','order','getSubjects','getDescriptions','findOne','Tag','setTags','ids','html-pdf','eml-format','zip-dir','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4abf,0xac));var _0xf4ab=function(_0x305b49,_0x17ed26){_0x305b49=_0x305b49-0x0;var _0x364e28=_0x4abf[_0x305b49];return _0x364e28;};'use strict';var pdf=require(_0xf4ab('0x0'));var emlformat=require(_0xf4ab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf4ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf4ab('0x3'));var Mustache=require(_0xf4ab('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf4ab('0x5'));var csv=require(_0xf4ab('0x6'));var ejs=require(_0xf4ab('0x7'));var fs=require('fs');var _=require(_0xf4ab('0x8'));var squel=require('squel');var crypto=require(_0xf4ab('0x9'));var jsforce=require(_0xf4ab('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ab('0x6'));var querystring=require('querystring');var Papa=require(_0xf4ab('0xb'));var Redis=require(_0xf4ab('0xc'));var authService=require(_0xf4ab('0xd'));var qs=require(_0xf4ab('0xe'));var as=require(_0xf4ab('0xf'));var hardwareService=require(_0xf4ab('0x10'));var logger=require(_0xf4ab('0x11'))(_0xf4ab('0x12'));var utils=require(_0xf4ab('0x13'));var config=require(_0xf4ab('0x14'));var db=require(_0xf4ab('0x15'))['db'];var jayson=require(_0xf4ab('0x16'));var client=jayson[_0xf4ab('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x52ab9e,_0x17181a,_0x54eabf){if(_0x54eabf){var _0x35eab2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35eab2[_0xf4ab('0x18')](_0x17181a)){return _0x52ab9e;}else{throw new db[(_0xf4ab('0x19'))][(_0xf4ab('0x1a'))](_0xf4ab('0x1b'));}}else{return _0x52ab9e;}}function respondWithRpcPromise(_0x37bbd6,_0x47abb8,_0x2e7b69,_0x1c5202){return new BPromise(function(_0xc26111,_0x5d50cb){var _0x1e1a02=_0x1c5202||client;return _0x1e1a02[_0xf4ab('0x1c')](_0x37bbd6,_0x2e7b69)['then'](function(_0x196ea7){logger[_0xf4ab('0x1d')](_0xf4ab('0x1e'),_0x47abb8,_0xf4ab('0x1f'));logger[_0xf4ab('0x20')](_0xf4ab('0x21'),_0x47abb8,_0xf4ab('0x1f'),JSON['stringify'](_0x196ea7));if(_0x196ea7['error']){if(_0x196ea7[_0xf4ab('0x22')]['code']===0x1f4){logger[_0xf4ab('0x22')](_0xf4ab('0x1e'),_0x47abb8,_0x196ea7[_0xf4ab('0x22')]['message']);return _0x5d50cb(_0x196ea7[_0xf4ab('0x22')][_0xf4ab('0x23')]);}logger[_0xf4ab('0x22')](_0xf4ab('0x1e'),_0x47abb8,_0x196ea7[_0xf4ab('0x22')]['message']);return _0xc26111(_0x196ea7[_0xf4ab('0x22')][_0xf4ab('0x23')]);}else{logger[_0xf4ab('0x1d')](_0xf4ab('0x1e'),_0x47abb8,_0xf4ab('0x1f'));_0xc26111(_0x196ea7[_0xf4ab('0x24')][_0xf4ab('0x23')]);}})['catch'](function(_0x910ef1){logger['error'](_0xf4ab('0x1e'),_0x47abb8,_0x910ef1);_0x5d50cb(_0x910ef1);});});}function respondWithStatusCode(_0x550e29,_0x561ba5){_0x561ba5=_0x561ba5||0xcc;return function(_0x55388d){if(_0x55388d){return _0x550e29['sendStatus'](_0x561ba5);}return _0x550e29['status'](_0x561ba5)['end']();};}function respondWithResult(_0x5f5af2,_0x19d6a8){_0x19d6a8=_0x19d6a8||0xc8;return function(_0x9863d1){if(_0x9863d1){return _0x5f5af2[_0xf4ab('0x25')](_0x19d6a8)[_0xf4ab('0x26')](_0x9863d1);}};}function respondWithFilteredResult(_0x1efb48,_0x5880f5){return function(_0x4fb5e4){if(_0x4fb5e4){var _0x325b38=_0x4fb5e4['count'],_0x3cf5b1=_0x5880f5[_0xf4ab('0x27')],_0x52f419=_0x5880f5[_0xf4ab('0x27')]+_0x5880f5[_0xf4ab('0x28')],_0x46877c;if(_0x52f419>=_0x325b38){_0x52f419=_0x325b38;_0x46877c=0xc8;}else{_0x46877c=0xce;}_0x1efb48[_0xf4ab('0x25')](_0x46877c);return _0x1efb48[_0xf4ab('0x29')](_0xf4ab('0x2a'),_0x3cf5b1+'-'+_0x52f419+'/'+_0x325b38)[_0xf4ab('0x26')](_0x4fb5e4);}return null;};}function patchUpdates(_0x25d68f){return function(_0x3e49f2){try{jsonpatch[_0xf4ab('0x2b')](_0x3e49f2,_0x25d68f,!![]);}catch(_0x318a2c){return BPromise['reject'](_0x318a2c);}return _0x3e49f2[_0xf4ab('0x2c')]();};}function saveUpdates(_0x57a2f5,_0x46b3b0){return function(_0x158ed8){if(_0x158ed8){return _0x158ed8['update'](_0x57a2f5)['then'](function(_0x2f7f0b){return _0x2f7f0b;});}return null;};}function removeEntity(_0x3e1bb5,_0x28bf09){return function(_0x315586){if(_0x315586){return _0x315586[_0xf4ab('0x2d')]()['then'](function(){_0x3e1bb5['status'](0xcc)[_0xf4ab('0x2e')]();});}};}function handleEntityNotFound(_0x25ac48,_0x29bd4c){return function(_0x526c68){if(!_0x526c68){_0x25ac48[_0xf4ab('0x2f')](0x194);}return _0x526c68;};}function handleError(_0x18cf46,_0x151bfe){_0x151bfe=_0x151bfe||0x1f4;return function(_0x433527){logger[_0xf4ab('0x22')](_0x433527[_0xf4ab('0x30')]);if(_0x433527[_0xf4ab('0x31')]){delete _0x433527[_0xf4ab('0x31')];}_0x18cf46[_0xf4ab('0x25')](_0x151bfe)[_0xf4ab('0x32')](_0x433527);};}exports[_0xf4ab('0x33')]=function(_0x19d695,_0x5f1722){var _0x7dd642={},_0x1c6afb={},_0x7bf0fd={'count':0x0,'rows':[]};var _0x460637=_[_0xf4ab('0x34')](db[_0xf4ab('0x35')][_0xf4ab('0x36')],function(_0x1b15aa){return{'name':_0x1b15aa[_0xf4ab('0x37')],'type':_0x1b15aa[_0xf4ab('0x38')][_0xf4ab('0x39')]};});_0x1c6afb[_0xf4ab('0x3a')]=_[_0xf4ab('0x34')](_0x460637,_0xf4ab('0x31'));_0x1c6afb['query']=_[_0xf4ab('0x3b')](_0x19d695[_0xf4ab('0x3c')]);_0x1c6afb[_0xf4ab('0x3d')]=_[_0xf4ab('0x3e')](_0x1c6afb['model'],_0x1c6afb[_0xf4ab('0x3c')]);_0x7dd642[_0xf4ab('0x3f')]=_[_0xf4ab('0x3e')](_0x1c6afb[_0xf4ab('0x3a')],qs['fields'](_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x40')]));_0x7dd642[_0xf4ab('0x3f')]=_0x7dd642['attributes'][_0xf4ab('0x41')]?_0x7dd642[_0xf4ab('0x3f')]:_0x1c6afb[_0xf4ab('0x3a')];if(!_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x42')](_0xf4ab('0x43'))){_0x7dd642[_0xf4ab('0x28')]=qs['limit'](_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x28')]);_0x7dd642['offset']=qs[_0xf4ab('0x27')](_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x27')]);}_0x7dd642['order']=qs[_0xf4ab('0x44')](_0x19d695['query'][_0xf4ab('0x44')]);_0x7dd642[_0xf4ab('0x45')]=qs['filters'](_[_0xf4ab('0x46')](_0x19d695[_0xf4ab('0x3c')],_0x1c6afb[_0xf4ab('0x3d')]),_0x460637);if(_0x19d695[_0xf4ab('0x3c')]['filter']){_0x7dd642['where']=_[_0xf4ab('0x47')](_0x7dd642['where'],{'$or':_['map'](_0x460637,function(_0x24c25d){if(_0x24c25d[_0xf4ab('0x38')]!==_0xf4ab('0x48')){var _0x171303={};_0x171303[_0x24c25d[_0xf4ab('0x31')]]={'$like':'%'+_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x49')]+'%'};return _0x171303;}})});}_0x7dd642=_[_0xf4ab('0x47')]({},_0x7dd642,_0x19d695[_0xf4ab('0x4a')]);var _0x127410={'where':_0x7dd642[_0xf4ab('0x45')]};return db[_0xf4ab('0x35')][_0xf4ab('0x4b')](_0x127410)['then'](function(_0x18698e){_0x7bf0fd[_0xf4ab('0x4b')]=_0x18698e;if(_0x19d695[_0xf4ab('0x3c')][_0xf4ab('0x4c')]){_0x7dd642[_0xf4ab('0x4d')]=[{'all':!![]}];}return db[_0xf4ab('0x35')]['findAll'](_0x7dd642);})[_0xf4ab('0x4e')](function(_0x479c5c){_0x7bf0fd[_0xf4ab('0x4f')]=_0x479c5c;return _0x7bf0fd;})[_0xf4ab('0x4e')](respondWithFilteredResult(_0x5f1722,_0x7dd642))[_0xf4ab('0x50')](handleError(_0x5f1722,null));};exports[_0xf4ab('0x51')]=function(_0x24f6a7,_0x448646){var _0x25e6cc={'raw':![],'where':{'id':_0x24f6a7[_0xf4ab('0x52')]['id']}},_0x5d83a0={};_0x5d83a0[_0xf4ab('0x3a')]=_[_0xf4ab('0x3b')](db[_0xf4ab('0x35')][_0xf4ab('0x36')]);_0x5d83a0[_0xf4ab('0x3c')]=_[_0xf4ab('0x3b')](_0x24f6a7[_0xf4ab('0x3c')]);_0x5d83a0[_0xf4ab('0x3d')]=_[_0xf4ab('0x3e')](_0x5d83a0['model'],_0x5d83a0[_0xf4ab('0x3c')]);_0x25e6cc[_0xf4ab('0x3f')]=_[_0xf4ab('0x3e')](_0x5d83a0[_0xf4ab('0x3a')],qs[_0xf4ab('0x40')](_0x24f6a7[_0xf4ab('0x3c')][_0xf4ab('0x40')]));_0x25e6cc[_0xf4ab('0x3f')]=_0x25e6cc['attributes'][_0xf4ab('0x41')]?_0x25e6cc[_0xf4ab('0x3f')]:_0x5d83a0[_0xf4ab('0x3a')];if(_0x24f6a7[_0xf4ab('0x3c')][_0xf4ab('0x4c')]){_0x25e6cc[_0xf4ab('0x4d')]=[{'all':!![]}];}_0x25e6cc=_[_0xf4ab('0x47')]({},_0x25e6cc,_0x24f6a7['options']);return db[_0xf4ab('0x35')][_0xf4ab('0x53')](_0x25e6cc)['then'](handleEntityNotFound(_0x448646,null))[_0xf4ab('0x4e')](respondWithResult(_0x448646,null))[_0xf4ab('0x50')](handleError(_0x448646,null));};exports[_0xf4ab('0x54')]=function(_0x2042c4,_0x268af9){return db['DeskConfiguration']['create'](_0x2042c4[_0xf4ab('0x55')],{})[_0xf4ab('0x4e')](respondWithResult(_0x268af9,0xc9))[_0xf4ab('0x50')](handleError(_0x268af9,null));};exports['update']=function(_0xf84d73,_0x3a1755){if(_0xf84d73[_0xf4ab('0x55')]['id']){delete _0xf84d73[_0xf4ab('0x55')]['id'];}return db[_0xf4ab('0x35')][_0xf4ab('0x53')]({'where':{'id':_0xf84d73['params']['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x3a1755,null))[_0xf4ab('0x4e')](saveUpdates(_0xf84d73[_0xf4ab('0x55')],null))[_0xf4ab('0x4e')](respondWithResult(_0x3a1755,null))['catch'](handleError(_0x3a1755,null));};exports['destroy']=function(_0x87f24b,_0x126ee0){return db[_0xf4ab('0x35')]['find']({'where':{'id':_0x87f24b['params']['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x126ee0,null))[_0xf4ab('0x4e')](removeEntity(_0x126ee0,null))['catch'](handleError(_0x126ee0,null));};exports[_0xf4ab('0x56')]=function(_0x266dd7,_0x50ba37,_0x11ee86){var _0x83d33d={};var _0x43c7c3={};var _0x53ea7f;var _0x76fb29;return db[_0xf4ab('0x35')]['findOne']({'where':{'id':_0x266dd7['params']['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x50ba37,null))[_0xf4ab('0x4e')](function(_0x4ce06e){if(_0x4ce06e){_0x53ea7f=_0x4ce06e;_0x43c7c3[_0xf4ab('0x3a')]=_[_0xf4ab('0x3b')](db[_0xf4ab('0x57')][_0xf4ab('0x36')]);_0x43c7c3['query']=_[_0xf4ab('0x3b')](_0x266dd7[_0xf4ab('0x3c')]);_0x43c7c3[_0xf4ab('0x3d')]=_[_0xf4ab('0x3e')](_0x43c7c3[_0xf4ab('0x3a')],_0x43c7c3[_0xf4ab('0x3c')]);_0x83d33d['attributes']=_[_0xf4ab('0x3e')](_0x43c7c3[_0xf4ab('0x3a')],qs['fields'](_0x266dd7[_0xf4ab('0x3c')][_0xf4ab('0x40')]));_0x83d33d[_0xf4ab('0x3f')]=_0x83d33d['attributes'][_0xf4ab('0x41')]?_0x83d33d[_0xf4ab('0x3f')]:_0x43c7c3['model'];_0x83d33d[_0xf4ab('0x58')]=qs[_0xf4ab('0x44')](_0x266dd7[_0xf4ab('0x3c')][_0xf4ab('0x44')]);_0x83d33d[_0xf4ab('0x45')]=qs[_0xf4ab('0x3d')](_[_0xf4ab('0x46')](_0x266dd7[_0xf4ab('0x3c')],_0x43c7c3['filters']));if(_0x266dd7[_0xf4ab('0x3c')][_0xf4ab('0x49')]){_0x83d33d[_0xf4ab('0x45')]=_[_0xf4ab('0x47')](_0x83d33d['where'],{'$or':_[_0xf4ab('0x34')](_0x83d33d[_0xf4ab('0x3f')],function(_0x2c01ba){var _0x5853ca={};_0x5853ca[_0x2c01ba]={'$like':'%'+_0x266dd7[_0xf4ab('0x3c')]['filter']+'%'};return _0x5853ca;})});}_0x83d33d=_[_0xf4ab('0x47')]({},_0x83d33d,_0x266dd7[_0xf4ab('0x4a')]);return _0x53ea7f[_0xf4ab('0x56')](_0x83d33d);}})[_0xf4ab('0x4e')](function(_0x3961ea){if(_0x3961ea){_0x76fb29=_0x3961ea[_0xf4ab('0x41')];if(!_0x266dd7['query'][_0xf4ab('0x42')](_0xf4ab('0x43'))){_0x83d33d[_0xf4ab('0x28')]=qs[_0xf4ab('0x28')](_0x266dd7[_0xf4ab('0x3c')][_0xf4ab('0x28')]);_0x83d33d[_0xf4ab('0x27')]=qs[_0xf4ab('0x27')](_0x266dd7['query'][_0xf4ab('0x27')]);}return _0x53ea7f['getFields'](_0x83d33d);}})[_0xf4ab('0x4e')](function(_0x44911e){if(_0x44911e){return _0x44911e?{'count':_0x76fb29,'rows':_0x44911e}:null;}})['then'](respondWithResult(_0x50ba37,null))[_0xf4ab('0x50')](handleError(_0x50ba37,null));};exports[_0xf4ab('0x59')]=function(_0x2eac87,_0x2f8287,_0x13a439){var _0x43ce40={};var _0x44a0d6={};var _0x3d8d9e;var _0x3617fc;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2eac87[_0xf4ab('0x52')]['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x2f8287,null))[_0xf4ab('0x4e')](function(_0x2d2108){if(_0x2d2108){_0x3d8d9e=_0x2d2108;_0x44a0d6['model']=_['keys'](db['DeskField'][_0xf4ab('0x36')]);_0x44a0d6['query']=_[_0xf4ab('0x3b')](_0x2eac87[_0xf4ab('0x3c')]);_0x44a0d6[_0xf4ab('0x3d')]=_['intersection'](_0x44a0d6[_0xf4ab('0x3a')],_0x44a0d6[_0xf4ab('0x3c')]);_0x43ce40[_0xf4ab('0x3f')]=_['intersection'](_0x44a0d6[_0xf4ab('0x3a')],qs[_0xf4ab('0x40')](_0x2eac87['query'][_0xf4ab('0x40')]));_0x43ce40[_0xf4ab('0x3f')]=_0x43ce40[_0xf4ab('0x3f')]['length']?_0x43ce40[_0xf4ab('0x3f')]:_0x44a0d6['model'];_0x43ce40[_0xf4ab('0x58')]=qs[_0xf4ab('0x44')](_0x2eac87[_0xf4ab('0x3c')][_0xf4ab('0x44')]);_0x43ce40['where']=qs[_0xf4ab('0x3d')](_[_0xf4ab('0x46')](_0x2eac87['query'],_0x44a0d6[_0xf4ab('0x3d')]));if(_0x2eac87[_0xf4ab('0x3c')][_0xf4ab('0x49')]){_0x43ce40[_0xf4ab('0x45')]=_['merge'](_0x43ce40['where'],{'$or':_[_0xf4ab('0x34')](_0x43ce40[_0xf4ab('0x3f')],function(_0x3f8613){var _0x5b73b9={};_0x5b73b9[_0x3f8613]={'$like':'%'+_0x2eac87[_0xf4ab('0x3c')][_0xf4ab('0x49')]+'%'};return _0x5b73b9;})});}_0x43ce40=_['merge']({},_0x43ce40,_0x2eac87[_0xf4ab('0x4a')]);return _0x3d8d9e['getSubjects'](_0x43ce40);}})['then'](function(_0x2ad23a){if(_0x2ad23a){_0x3617fc=_0x2ad23a[_0xf4ab('0x41')];if(!_0x2eac87[_0xf4ab('0x3c')]['hasOwnProperty'](_0xf4ab('0x43'))){_0x43ce40[_0xf4ab('0x28')]=qs[_0xf4ab('0x28')](_0x2eac87[_0xf4ab('0x3c')][_0xf4ab('0x28')]);_0x43ce40[_0xf4ab('0x27')]=qs[_0xf4ab('0x27')](_0x2eac87[_0xf4ab('0x3c')][_0xf4ab('0x27')]);}return _0x3d8d9e[_0xf4ab('0x59')](_0x43ce40);}})['then'](function(_0x42a28c){if(_0x42a28c){return _0x42a28c?{'count':_0x3617fc,'rows':_0x42a28c}:null;}})['then'](respondWithResult(_0x2f8287,null))['catch'](handleError(_0x2f8287,null));};exports[_0xf4ab('0x5a')]=function(_0x97a758,_0x423e85,_0x58e5c0){var _0x4f3930={};var _0x2584be={};var _0xd0ccfa;var _0x33b32f;return db[_0xf4ab('0x35')][_0xf4ab('0x5b')]({'where':{'id':_0x97a758[_0xf4ab('0x52')]['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x423e85,null))['then'](function(_0x5c72ca){if(_0x5c72ca){_0xd0ccfa=_0x5c72ca;_0x2584be['model']=_[_0xf4ab('0x3b')](db[_0xf4ab('0x57')][_0xf4ab('0x36')]);_0x2584be['query']=_[_0xf4ab('0x3b')](_0x97a758[_0xf4ab('0x3c')]);_0x2584be[_0xf4ab('0x3d')]=_[_0xf4ab('0x3e')](_0x2584be[_0xf4ab('0x3a')],_0x2584be[_0xf4ab('0x3c')]);_0x4f3930[_0xf4ab('0x3f')]=_[_0xf4ab('0x3e')](_0x2584be[_0xf4ab('0x3a')],qs['fields'](_0x97a758['query'][_0xf4ab('0x40')]));_0x4f3930[_0xf4ab('0x3f')]=_0x4f3930[_0xf4ab('0x3f')][_0xf4ab('0x41')]?_0x4f3930[_0xf4ab('0x3f')]:_0x2584be[_0xf4ab('0x3a')];_0x4f3930[_0xf4ab('0x58')]=qs['sort'](_0x97a758[_0xf4ab('0x3c')][_0xf4ab('0x44')]);_0x4f3930['where']=qs[_0xf4ab('0x3d')](_[_0xf4ab('0x46')](_0x97a758['query'],_0x2584be[_0xf4ab('0x3d')]));if(_0x97a758[_0xf4ab('0x3c')][_0xf4ab('0x49')]){_0x4f3930['where']=_[_0xf4ab('0x47')](_0x4f3930[_0xf4ab('0x45')],{'$or':_[_0xf4ab('0x34')](_0x4f3930[_0xf4ab('0x3f')],function(_0x5117ac){var _0x5082f6={};_0x5082f6[_0x5117ac]={'$like':'%'+_0x97a758[_0xf4ab('0x3c')][_0xf4ab('0x49')]+'%'};return _0x5082f6;})});}_0x4f3930=_['merge']({},_0x4f3930,_0x97a758['options']);return _0xd0ccfa[_0xf4ab('0x5a')](_0x4f3930);}})[_0xf4ab('0x4e')](function(_0x3e557f){if(_0x3e557f){_0x33b32f=_0x3e557f[_0xf4ab('0x41')];if(!_0x97a758[_0xf4ab('0x3c')][_0xf4ab('0x42')]('nolimit')){_0x4f3930['limit']=qs['limit'](_0x97a758[_0xf4ab('0x3c')]['limit']);_0x4f3930['offset']=qs[_0xf4ab('0x27')](_0x97a758[_0xf4ab('0x3c')][_0xf4ab('0x27')]);}return _0xd0ccfa[_0xf4ab('0x5a')](_0x4f3930);}})[_0xf4ab('0x4e')](function(_0xc08bdb){if(_0xc08bdb){return _0xc08bdb?{'count':_0x33b32f,'rows':_0xc08bdb}:null;}})[_0xf4ab('0x4e')](respondWithResult(_0x423e85,null))[_0xf4ab('0x50')](handleError(_0x423e85,null));};exports['getTags']=function(_0x33fcf3,_0x4fb8d8,_0xdbd87d){var _0x30fb5f={};var _0x2bc4c3={};var _0x4786be;var _0x1445ae;return db[_0xf4ab('0x35')]['findOne']({'where':{'id':_0x33fcf3['params']['id']}})['then'](handleEntityNotFound(_0x4fb8d8,null))[_0xf4ab('0x4e')](function(_0xf5ce7f){if(_0xf5ce7f){_0x4786be=_0xf5ce7f;_0x2bc4c3[_0xf4ab('0x3a')]=_[_0xf4ab('0x3b')](db[_0xf4ab('0x5c')][_0xf4ab('0x36')]);_0x2bc4c3[_0xf4ab('0x3c')]=_[_0xf4ab('0x3b')](_0x33fcf3[_0xf4ab('0x3c')]);_0x2bc4c3[_0xf4ab('0x3d')]=_[_0xf4ab('0x3e')](_0x2bc4c3[_0xf4ab('0x3a')],_0x2bc4c3[_0xf4ab('0x3c')]);_0x30fb5f[_0xf4ab('0x3f')]=_[_0xf4ab('0x3e')](_0x2bc4c3[_0xf4ab('0x3a')],qs['fields'](_0x33fcf3[_0xf4ab('0x3c')]['fields']));_0x30fb5f[_0xf4ab('0x3f')]=_0x30fb5f[_0xf4ab('0x3f')][_0xf4ab('0x41')]?_0x30fb5f[_0xf4ab('0x3f')]:_0x2bc4c3['model'];_0x30fb5f[_0xf4ab('0x58')]=qs['sort'](_0x33fcf3[_0xf4ab('0x3c')][_0xf4ab('0x44')]);_0x30fb5f[_0xf4ab('0x45')]=qs['filters'](_[_0xf4ab('0x46')](_0x33fcf3[_0xf4ab('0x3c')],_0x2bc4c3[_0xf4ab('0x3d')]));if(_0x33fcf3[_0xf4ab('0x3c')]['filter']){_0x30fb5f[_0xf4ab('0x45')]=_[_0xf4ab('0x47')](_0x30fb5f[_0xf4ab('0x45')],{'$or':_[_0xf4ab('0x34')](_0x30fb5f[_0xf4ab('0x3f')],function(_0x1f5d14){var _0x38878c={};_0x38878c[_0x1f5d14]={'$like':'%'+_0x33fcf3[_0xf4ab('0x3c')][_0xf4ab('0x49')]+'%'};return _0x38878c;})});}_0x30fb5f=_[_0xf4ab('0x47')]({},_0x30fb5f,_0x33fcf3['options']);return _0x4786be['getTags'](_0x30fb5f);}})[_0xf4ab('0x4e')](function(_0x2db47e){if(_0x2db47e){_0x1445ae=_0x2db47e[_0xf4ab('0x41')];if(!_0x33fcf3[_0xf4ab('0x3c')][_0xf4ab('0x42')](_0xf4ab('0x43'))){_0x30fb5f[_0xf4ab('0x28')]=qs['limit'](_0x33fcf3[_0xf4ab('0x3c')][_0xf4ab('0x28')]);_0x30fb5f[_0xf4ab('0x27')]=qs[_0xf4ab('0x27')](_0x33fcf3[_0xf4ab('0x3c')]['offset']);}return _0x4786be['getTags'](_0x30fb5f);}})[_0xf4ab('0x4e')](function(_0x1f6ded){if(_0x1f6ded){return _0x1f6ded?{'count':_0x1445ae,'rows':_0x1f6ded}:null;}})[_0xf4ab('0x4e')](respondWithResult(_0x4fb8d8,null))[_0xf4ab('0x50')](handleError(_0x4fb8d8,null));};exports[_0xf4ab('0x5d')]=function(_0x2a6dde,_0x21d9a2,_0x14c7a6){if(_0x2a6dde['body']['id']){delete _0x2a6dde[_0xf4ab('0x55')]['id'];}return db[_0xf4ab('0x35')]['findOne']({'where':{'id':_0x2a6dde['params']['id']}})[_0xf4ab('0x4e')](handleEntityNotFound(_0x21d9a2,null))['then'](function(_0x50268c){if(_0x50268c){return _0x50268c[_0xf4ab('0x5d')](_0x2a6dde['body'][_0xf4ab('0x5e')]||[]);}return null;})[_0xf4ab('0x4e')](respondWithResult(_0x21d9a2,null))[_0xf4ab('0x50')](handleError(_0x21d9a2,null));}; \ No newline at end of file +var _0x851c=['order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','show','params','find','create','body','getFields','getSubjects','DeskField','getDescriptions','findOne','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','apply','reject','save','update','end','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x851c,0x19d));var _0xc851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc851('0x0'));var emlformat=require(_0xc851('0x1'));var rimraf=require(_0xc851('0x2'));var zipdir=require(_0xc851('0x3'));var jsonpatch=require(_0xc851('0x4'));var rp=require(_0xc851('0x5'));var moment=require(_0xc851('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc851('0x7'));var util=require(_0xc851('0x8'));var path=require('path');var sox=require(_0xc851('0x9'));var csv=require(_0xc851('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc851('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc851('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc851('0xd'));var Papa=require(_0xc851('0xe'));var Redis=require(_0xc851('0xf'));var authService=require(_0xc851('0x10'));var qs=require(_0xc851('0x11'));var as=require(_0xc851('0x12'));var hardwareService=require(_0xc851('0x13'));var logger=require(_0xc851('0x14'))('api');var utils=require(_0xc851('0x15'));var config=require(_0xc851('0x16'));var db=require(_0xc851('0x17'))['db'];var jayson=require(_0xc851('0x18'));var client=jayson[_0xc851('0x19')][_0xc851('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3301f8,_0xd619c3,_0x314e2c){if(_0x314e2c){var _0x261b0f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x261b0f[_0xc851('0x1b')](_0xd619c3)){return _0x3301f8;}else{throw new db[(_0xc851('0x1c'))][(_0xc851('0x1d'))](_0xc851('0x1e'));}}else{return _0x3301f8;}}function respondWithRpcPromise(_0x42cae5,_0x458951,_0x5e67ee,_0xc2be54){return new BPromise(function(_0x5ad5e1,_0x2b4839){var _0x5178ca=_0xc2be54||client;return _0x5178ca[_0xc851('0x1f')](_0x42cae5,_0x5e67ee)[_0xc851('0x20')](function(_0x2235b9){logger[_0xc851('0x21')](_0xc851('0x22'),_0x458951,_0xc851('0x23'));logger[_0xc851('0x24')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x458951,_0xc851('0x23'),JSON[_0xc851('0x25')](_0x2235b9));if(_0x2235b9['error']){if(_0x2235b9[_0xc851('0x26')][_0xc851('0x27')]===0x1f4){logger[_0xc851('0x26')](_0xc851('0x22'),_0x458951,_0x2235b9['error'][_0xc851('0x28')]);return _0x2b4839(_0x2235b9[_0xc851('0x26')][_0xc851('0x28')]);}logger[_0xc851('0x26')](_0xc851('0x22'),_0x458951,_0x2235b9['error']['message']);return _0x5ad5e1(_0x2235b9[_0xc851('0x26')][_0xc851('0x28')]);}else{logger[_0xc851('0x21')](_0xc851('0x22'),_0x458951,_0xc851('0x23'));_0x5ad5e1(_0x2235b9[_0xc851('0x29')]['message']);}})[_0xc851('0x2a')](function(_0x517452){logger['error'](_0xc851('0x22'),_0x458951,_0x517452);_0x2b4839(_0x517452);});});}function respondWithStatusCode(_0x1d6bc4,_0x4a2ef0){_0x4a2ef0=_0x4a2ef0||0xcc;return function(_0x16b3c4){if(_0x16b3c4){return _0x1d6bc4[_0xc851('0x2b')](_0x4a2ef0);}return _0x1d6bc4[_0xc851('0x2c')](_0x4a2ef0)['end']();};}function respondWithResult(_0x2c6d43,_0x4407a6){_0x4407a6=_0x4407a6||0xc8;return function(_0x283b10){if(_0x283b10){return _0x2c6d43[_0xc851('0x2c')](_0x4407a6)[_0xc851('0x2d')](_0x283b10);}};}function respondWithFilteredResult(_0x2fc8f1,_0x3ebd7b){return function(_0x3d20eb){if(_0x3d20eb){var _0x3f9a52=_0x3d20eb['count'],_0x24f1f1=_0x3ebd7b[_0xc851('0x2e')],_0x279a40=_0x3ebd7b[_0xc851('0x2e')]+_0x3ebd7b['limit'],_0x13a826;if(_0x279a40>=_0x3f9a52){_0x279a40=_0x3f9a52;_0x13a826=0xc8;}else{_0x13a826=0xce;}_0x2fc8f1[_0xc851('0x2c')](_0x13a826);return _0x2fc8f1['set']('Content-Range',_0x24f1f1+'-'+_0x279a40+'/'+_0x3f9a52)['json'](_0x3d20eb);}return null;};}function patchUpdates(_0x3a04fd){return function(_0x4bba14){try{jsonpatch[_0xc851('0x2f')](_0x4bba14,_0x3a04fd,!![]);}catch(_0x509263){return BPromise[_0xc851('0x30')](_0x509263);}return _0x4bba14[_0xc851('0x31')]();};}function saveUpdates(_0x11d4a7,_0x34b7e4){return function(_0x3eb4b3){if(_0x3eb4b3){return _0x3eb4b3[_0xc851('0x32')](_0x11d4a7)[_0xc851('0x20')](function(_0x2848e6){return _0x2848e6;});}return null;};}function removeEntity(_0x3da3b8,_0x1c6b64){return function(_0x4282d1){if(_0x4282d1){return _0x4282d1['destroy']()[_0xc851('0x20')](function(){_0x3da3b8['status'](0xcc)[_0xc851('0x33')]();});}};}function handleEntityNotFound(_0x10042c,_0x4249ae){return function(_0x2aca26){if(!_0x2aca26){_0x10042c[_0xc851('0x2b')](0x194);}return _0x2aca26;};}function handleError(_0x23d824,_0x7bc799){_0x7bc799=_0x7bc799||0x1f4;return function(_0x4d4531){logger['error'](_0x4d4531[_0xc851('0x34')]);if(_0x4d4531[_0xc851('0x35')]){delete _0x4d4531['name'];}_0x23d824['status'](_0x7bc799)[_0xc851('0x36')](_0x4d4531);};}exports[_0xc851('0x37')]=function(_0x258f8b,_0x543807){var _0x3acbc5={},_0x370cf8={},_0x4477d9={'count':0x0,'rows':[]};var _0x33a1e0=_[_0xc851('0x38')](db[_0xc851('0x39')][_0xc851('0x3a')],function(_0x4b02b5){return{'name':_0x4b02b5[_0xc851('0x3b')],'type':_0x4b02b5[_0xc851('0x3c')][_0xc851('0x3d')]};});_0x370cf8[_0xc851('0x3e')]=_[_0xc851('0x38')](_0x33a1e0,'name');_0x370cf8[_0xc851('0x3f')]=_[_0xc851('0x40')](_0x258f8b[_0xc851('0x3f')]);_0x370cf8['filters']=_[_0xc851('0x41')](_0x370cf8['model'],_0x370cf8[_0xc851('0x3f')]);_0x3acbc5['attributes']=_[_0xc851('0x41')](_0x370cf8['model'],qs[_0xc851('0x42')](_0x258f8b[_0xc851('0x3f')][_0xc851('0x42')]));_0x3acbc5['attributes']=_0x3acbc5[_0xc851('0x43')][_0xc851('0x44')]?_0x3acbc5[_0xc851('0x43')]:_0x370cf8[_0xc851('0x3e')];if(!_0x258f8b['query'][_0xc851('0x45')](_0xc851('0x46'))){_0x3acbc5[_0xc851('0x47')]=qs['limit'](_0x258f8b['query'][_0xc851('0x47')]);_0x3acbc5['offset']=qs['offset'](_0x258f8b['query']['offset']);}_0x3acbc5[_0xc851('0x48')]=qs[_0xc851('0x49')](_0x258f8b[_0xc851('0x3f')][_0xc851('0x49')]);_0x3acbc5[_0xc851('0x4a')]=qs[_0xc851('0x4b')](_[_0xc851('0x4c')](_0x258f8b[_0xc851('0x3f')],_0x370cf8[_0xc851('0x4b')]),_0x33a1e0);if(_0x258f8b[_0xc851('0x3f')][_0xc851('0x4d')]){_0x3acbc5[_0xc851('0x4a')]=_[_0xc851('0x4e')](_0x3acbc5[_0xc851('0x4a')],{'$or':_['map'](_0x33a1e0,function(_0x59205a){if(_0x59205a[_0xc851('0x3c')]!=='VIRTUAL'){var _0x591460={};_0x591460[_0x59205a[_0xc851('0x35')]]={'$like':'%'+_0x258f8b[_0xc851('0x3f')]['filter']+'%'};return _0x591460;}})});}_0x3acbc5=_['merge']({},_0x3acbc5,_0x258f8b[_0xc851('0x4f')]);var _0x19a9b4={'where':_0x3acbc5['where']};return db[_0xc851('0x39')][_0xc851('0x50')](_0x19a9b4)['then'](function(_0x2d364f){_0x4477d9[_0xc851('0x50')]=_0x2d364f;if(_0x258f8b[_0xc851('0x3f')][_0xc851('0x51')]){_0x3acbc5[_0xc851('0x52')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xc851('0x53')](_0x3acbc5);})[_0xc851('0x20')](function(_0x2782ac){_0x4477d9['rows']=_0x2782ac;return _0x4477d9;})[_0xc851('0x20')](respondWithFilteredResult(_0x543807,_0x3acbc5))[_0xc851('0x2a')](handleError(_0x543807,null));};exports[_0xc851('0x54')]=function(_0x5e8e40,_0x53c81f){var _0x1fcc0a={'raw':![],'where':{'id':_0x5e8e40[_0xc851('0x55')]['id']}},_0x1392b7={};_0x1392b7['model']=_[_0xc851('0x40')](db['DeskConfiguration'][_0xc851('0x3a')]);_0x1392b7[_0xc851('0x3f')]=_[_0xc851('0x40')](_0x5e8e40[_0xc851('0x3f')]);_0x1392b7[_0xc851('0x4b')]=_[_0xc851('0x41')](_0x1392b7[_0xc851('0x3e')],_0x1392b7[_0xc851('0x3f')]);_0x1fcc0a['attributes']=_[_0xc851('0x41')](_0x1392b7[_0xc851('0x3e')],qs['fields'](_0x5e8e40[_0xc851('0x3f')][_0xc851('0x42')]));_0x1fcc0a[_0xc851('0x43')]=_0x1fcc0a[_0xc851('0x43')]['length']?_0x1fcc0a['attributes']:_0x1392b7[_0xc851('0x3e')];if(_0x5e8e40['query'][_0xc851('0x51')]){_0x1fcc0a['include']=[{'all':!![]}];}_0x1fcc0a=_[_0xc851('0x4e')]({},_0x1fcc0a,_0x5e8e40[_0xc851('0x4f')]);return db[_0xc851('0x39')][_0xc851('0x56')](_0x1fcc0a)[_0xc851('0x20')](handleEntityNotFound(_0x53c81f,null))['then'](respondWithResult(_0x53c81f,null))[_0xc851('0x2a')](handleError(_0x53c81f,null));};exports['create']=function(_0x2b14a8,_0x4bcafd){return db[_0xc851('0x39')][_0xc851('0x57')](_0x2b14a8[_0xc851('0x58')],{})[_0xc851('0x20')](respondWithResult(_0x4bcafd,0xc9))[_0xc851('0x2a')](handleError(_0x4bcafd,null));};exports['update']=function(_0x3378da,_0x2c58be){if(_0x3378da[_0xc851('0x58')]['id']){delete _0x3378da[_0xc851('0x58')]['id'];}return db[_0xc851('0x39')][_0xc851('0x56')]({'where':{'id':_0x3378da[_0xc851('0x55')]['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x2c58be,null))[_0xc851('0x20')](saveUpdates(_0x3378da[_0xc851('0x58')],null))[_0xc851('0x20')](respondWithResult(_0x2c58be,null))[_0xc851('0x2a')](handleError(_0x2c58be,null));};exports['destroy']=function(_0x3353ee,_0x3f0d86){return db[_0xc851('0x39')][_0xc851('0x56')]({'where':{'id':_0x3353ee[_0xc851('0x55')]['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x3f0d86,null))['then'](removeEntity(_0x3f0d86,null))[_0xc851('0x2a')](handleError(_0x3f0d86,null));};exports['getFields']=function(_0x25746d,_0x544b8a,_0x51b79f){var _0x438cdb={};var _0x479086={};var _0xa1331f;var _0x39ef78;return db[_0xc851('0x39')]['findOne']({'where':{'id':_0x25746d[_0xc851('0x55')]['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x544b8a,null))[_0xc851('0x20')](function(_0x59c970){if(_0x59c970){_0xa1331f=_0x59c970;_0x479086[_0xc851('0x3e')]=_[_0xc851('0x40')](db['DeskField'][_0xc851('0x3a')]);_0x479086[_0xc851('0x3f')]=_[_0xc851('0x40')](_0x25746d['query']);_0x479086[_0xc851('0x4b')]=_[_0xc851('0x41')](_0x479086['model'],_0x479086[_0xc851('0x3f')]);_0x438cdb[_0xc851('0x43')]=_[_0xc851('0x41')](_0x479086[_0xc851('0x3e')],qs['fields'](_0x25746d['query']['fields']));_0x438cdb['attributes']=_0x438cdb[_0xc851('0x43')][_0xc851('0x44')]?_0x438cdb[_0xc851('0x43')]:_0x479086[_0xc851('0x3e')];_0x438cdb[_0xc851('0x48')]=qs[_0xc851('0x49')](_0x25746d['query'][_0xc851('0x49')]);_0x438cdb[_0xc851('0x4a')]=qs['filters'](_[_0xc851('0x4c')](_0x25746d[_0xc851('0x3f')],_0x479086['filters']));if(_0x25746d[_0xc851('0x3f')][_0xc851('0x4d')]){_0x438cdb['where']=_[_0xc851('0x4e')](_0x438cdb[_0xc851('0x4a')],{'$or':_[_0xc851('0x38')](_0x438cdb['attributes'],function(_0x56c221){var _0x4b84e7={};_0x4b84e7[_0x56c221]={'$like':'%'+_0x25746d[_0xc851('0x3f')][_0xc851('0x4d')]+'%'};return _0x4b84e7;})});}_0x438cdb=_['merge']({},_0x438cdb,_0x25746d[_0xc851('0x4f')]);return _0xa1331f[_0xc851('0x59')](_0x438cdb);}})[_0xc851('0x20')](function(_0x368d3a){if(_0x368d3a){_0x39ef78=_0x368d3a[_0xc851('0x44')];if(!_0x25746d[_0xc851('0x3f')][_0xc851('0x45')](_0xc851('0x46'))){_0x438cdb[_0xc851('0x47')]=qs[_0xc851('0x47')](_0x25746d[_0xc851('0x3f')][_0xc851('0x47')]);_0x438cdb[_0xc851('0x2e')]=qs['offset'](_0x25746d[_0xc851('0x3f')][_0xc851('0x2e')]);}return _0xa1331f['getFields'](_0x438cdb);}})[_0xc851('0x20')](function(_0x4cff02){if(_0x4cff02){return _0x4cff02?{'count':_0x39ef78,'rows':_0x4cff02}:null;}})[_0xc851('0x20')](respondWithResult(_0x544b8a,null))[_0xc851('0x2a')](handleError(_0x544b8a,null));};exports[_0xc851('0x5a')]=function(_0x1f1469,_0x4f5c17,_0x5eb871){var _0x10fafc={};var _0x585f50={};var _0x26ded7;var _0x595175;return db[_0xc851('0x39')]['findOne']({'where':{'id':_0x1f1469[_0xc851('0x55')]['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x4f5c17,null))[_0xc851('0x20')](function(_0x587366){if(_0x587366){_0x26ded7=_0x587366;_0x585f50['model']=_['keys'](db[_0xc851('0x5b')]['rawAttributes']);_0x585f50[_0xc851('0x3f')]=_[_0xc851('0x40')](_0x1f1469['query']);_0x585f50['filters']=_['intersection'](_0x585f50[_0xc851('0x3e')],_0x585f50[_0xc851('0x3f')]);_0x10fafc[_0xc851('0x43')]=_[_0xc851('0x41')](_0x585f50[_0xc851('0x3e')],qs['fields'](_0x1f1469['query'][_0xc851('0x42')]));_0x10fafc[_0xc851('0x43')]=_0x10fafc[_0xc851('0x43')]['length']?_0x10fafc[_0xc851('0x43')]:_0x585f50['model'];_0x10fafc['order']=qs[_0xc851('0x49')](_0x1f1469['query']['sort']);_0x10fafc['where']=qs[_0xc851('0x4b')](_[_0xc851('0x4c')](_0x1f1469[_0xc851('0x3f')],_0x585f50[_0xc851('0x4b')]));if(_0x1f1469['query'][_0xc851('0x4d')]){_0x10fafc[_0xc851('0x4a')]=_[_0xc851('0x4e')](_0x10fafc[_0xc851('0x4a')],{'$or':_[_0xc851('0x38')](_0x10fafc[_0xc851('0x43')],function(_0x365d09){var _0x5cd05c={};_0x5cd05c[_0x365d09]={'$like':'%'+_0x1f1469['query'][_0xc851('0x4d')]+'%'};return _0x5cd05c;})});}_0x10fafc=_[_0xc851('0x4e')]({},_0x10fafc,_0x1f1469['options']);return _0x26ded7['getSubjects'](_0x10fafc);}})[_0xc851('0x20')](function(_0x2102f7){if(_0x2102f7){_0x595175=_0x2102f7[_0xc851('0x44')];if(!_0x1f1469[_0xc851('0x3f')][_0xc851('0x45')]('nolimit')){_0x10fafc[_0xc851('0x47')]=qs[_0xc851('0x47')](_0x1f1469[_0xc851('0x3f')][_0xc851('0x47')]);_0x10fafc['offset']=qs[_0xc851('0x2e')](_0x1f1469[_0xc851('0x3f')][_0xc851('0x2e')]);}return _0x26ded7['getSubjects'](_0x10fafc);}})['then'](function(_0x42d11c){if(_0x42d11c){return _0x42d11c?{'count':_0x595175,'rows':_0x42d11c}:null;}})[_0xc851('0x20')](respondWithResult(_0x4f5c17,null))['catch'](handleError(_0x4f5c17,null));};exports[_0xc851('0x5c')]=function(_0x35fa67,_0x45576c,_0x109aa4){var _0x55c8b8={};var _0x1b015d={};var _0x94c1b8;var _0x45d17a;return db[_0xc851('0x39')][_0xc851('0x5d')]({'where':{'id':_0x35fa67[_0xc851('0x55')]['id']}})['then'](handleEntityNotFound(_0x45576c,null))[_0xc851('0x20')](function(_0x103dea){if(_0x103dea){_0x94c1b8=_0x103dea;_0x1b015d['model']=_[_0xc851('0x40')](db['DeskField'][_0xc851('0x3a')]);_0x1b015d['query']=_[_0xc851('0x40')](_0x35fa67[_0xc851('0x3f')]);_0x1b015d[_0xc851('0x4b')]=_['intersection'](_0x1b015d['model'],_0x1b015d[_0xc851('0x3f')]);_0x55c8b8['attributes']=_[_0xc851('0x41')](_0x1b015d[_0xc851('0x3e')],qs[_0xc851('0x42')](_0x35fa67[_0xc851('0x3f')][_0xc851('0x42')]));_0x55c8b8[_0xc851('0x43')]=_0x55c8b8['attributes'][_0xc851('0x44')]?_0x55c8b8['attributes']:_0x1b015d['model'];_0x55c8b8[_0xc851('0x48')]=qs[_0xc851('0x49')](_0x35fa67[_0xc851('0x3f')]['sort']);_0x55c8b8['where']=qs[_0xc851('0x4b')](_['pick'](_0x35fa67['query'],_0x1b015d[_0xc851('0x4b')]));if(_0x35fa67['query'][_0xc851('0x4d')]){_0x55c8b8[_0xc851('0x4a')]=_[_0xc851('0x4e')](_0x55c8b8['where'],{'$or':_[_0xc851('0x38')](_0x55c8b8[_0xc851('0x43')],function(_0x19d62e){var _0x2b9fef={};_0x2b9fef[_0x19d62e]={'$like':'%'+_0x35fa67[_0xc851('0x3f')][_0xc851('0x4d')]+'%'};return _0x2b9fef;})});}_0x55c8b8=_['merge']({},_0x55c8b8,_0x35fa67[_0xc851('0x4f')]);return _0x94c1b8['getDescriptions'](_0x55c8b8);}})[_0xc851('0x20')](function(_0x180247){if(_0x180247){_0x45d17a=_0x180247[_0xc851('0x44')];if(!_0x35fa67[_0xc851('0x3f')][_0xc851('0x45')](_0xc851('0x46'))){_0x55c8b8[_0xc851('0x47')]=qs[_0xc851('0x47')](_0x35fa67[_0xc851('0x3f')][_0xc851('0x47')]);_0x55c8b8[_0xc851('0x2e')]=qs[_0xc851('0x2e')](_0x35fa67[_0xc851('0x3f')][_0xc851('0x2e')]);}return _0x94c1b8[_0xc851('0x5c')](_0x55c8b8);}})[_0xc851('0x20')](function(_0x5ed913){if(_0x5ed913){return _0x5ed913?{'count':_0x45d17a,'rows':_0x5ed913}:null;}})[_0xc851('0x20')](respondWithResult(_0x45576c,null))[_0xc851('0x2a')](handleError(_0x45576c,null));};exports[_0xc851('0x5e')]=function(_0xfd9b5d,_0x2578bb,_0x38d732){var _0x2110b9={};var _0x44338b={};var _0x25dd21;var _0x9befb3;return db[_0xc851('0x39')]['findOne']({'where':{'id':_0xfd9b5d[_0xc851('0x55')]['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x2578bb,null))[_0xc851('0x20')](function(_0x124011){if(_0x124011){_0x25dd21=_0x124011;_0x44338b[_0xc851('0x3e')]=_['keys'](db[_0xc851('0x5f')][_0xc851('0x3a')]);_0x44338b[_0xc851('0x3f')]=_[_0xc851('0x40')](_0xfd9b5d[_0xc851('0x3f')]);_0x44338b['filters']=_[_0xc851('0x41')](_0x44338b['model'],_0x44338b['query']);_0x2110b9[_0xc851('0x43')]=_[_0xc851('0x41')](_0x44338b[_0xc851('0x3e')],qs[_0xc851('0x42')](_0xfd9b5d[_0xc851('0x3f')]['fields']));_0x2110b9[_0xc851('0x43')]=_0x2110b9[_0xc851('0x43')][_0xc851('0x44')]?_0x2110b9[_0xc851('0x43')]:_0x44338b[_0xc851('0x3e')];_0x2110b9[_0xc851('0x48')]=qs[_0xc851('0x49')](_0xfd9b5d[_0xc851('0x3f')]['sort']);_0x2110b9[_0xc851('0x4a')]=qs[_0xc851('0x4b')](_[_0xc851('0x4c')](_0xfd9b5d[_0xc851('0x3f')],_0x44338b[_0xc851('0x4b')]));if(_0xfd9b5d[_0xc851('0x3f')]['filter']){_0x2110b9[_0xc851('0x4a')]=_['merge'](_0x2110b9[_0xc851('0x4a')],{'$or':_[_0xc851('0x38')](_0x2110b9[_0xc851('0x43')],function(_0x1a511d){var _0x588d0a={};_0x588d0a[_0x1a511d]={'$like':'%'+_0xfd9b5d[_0xc851('0x3f')][_0xc851('0x4d')]+'%'};return _0x588d0a;})});}_0x2110b9=_['merge']({},_0x2110b9,_0xfd9b5d[_0xc851('0x4f')]);return _0x25dd21['getTags'](_0x2110b9);}})[_0xc851('0x20')](function(_0x911924){if(_0x911924){_0x9befb3=_0x911924[_0xc851('0x44')];if(!_0xfd9b5d['query']['hasOwnProperty'](_0xc851('0x46'))){_0x2110b9[_0xc851('0x47')]=qs[_0xc851('0x47')](_0xfd9b5d['query'][_0xc851('0x47')]);_0x2110b9[_0xc851('0x2e')]=qs[_0xc851('0x2e')](_0xfd9b5d[_0xc851('0x3f')][_0xc851('0x2e')]);}return _0x25dd21[_0xc851('0x5e')](_0x2110b9);}})[_0xc851('0x20')](function(_0x5dcfa0){if(_0x5dcfa0){return _0x5dcfa0?{'count':_0x9befb3,'rows':_0x5dcfa0}:null;}})[_0xc851('0x20')](respondWithResult(_0x2578bb,null))[_0xc851('0x2a')](handleError(_0x2578bb,null));};exports[_0xc851('0x60')]=function(_0x354014,_0x5bdeca,_0x3e9d99){if(_0x354014[_0xc851('0x58')]['id']){delete _0x354014[_0xc851('0x58')]['id'];}return db[_0xc851('0x39')]['findOne']({'where':{'id':_0x354014['params']['id']}})[_0xc851('0x20')](handleEntityNotFound(_0x5bdeca,null))[_0xc851('0x20')](function(_0x47cf78){if(_0x47cf78){return _0x47cf78[_0xc851('0x60')](_0x354014[_0xc851('0x58')]['ids']||[]);}return null;})[_0xc851('0x20')](respondWithResult(_0x5bdeca,null))[_0xc851('0x2a')](handleError(_0x5bdeca,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bb9450c..37ed4c0 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 _0x3b4b=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','moment'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x3b4b,0xd5));var _0xb3b4=function(_0x2bf34b,_0x4c128f){_0x2bf34b=_0x2bf34b-0x0;var _0x23cd2e=_0x3b4b[_0x2bf34b];return _0x23cd2e;};'use strict';var _=require('lodash');var util=require(_0xb3b4('0x0'));var logger=require(_0xb3b4('0x1'))('api');var moment=require(_0xb3b4('0x2'));var BPromise=require(_0xb3b4('0x3'));var rp=require(_0xb3b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3b4('0x5'));var config=require(_0xb3b4('0x6'));var attributes=require(_0xb3b4('0x7'));module[_0xb3b4('0x8')]=function(_0x1fb796,_0x3f3c2d){return _0x1fb796[_0xb3b4('0x9')](_0xb3b4('0xa'),attributes,{'tableName':_0xb3b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x059b=['int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x53dbef,_0x3722ab){var _0x209af1=function(_0x2ab2c7){while(--_0x2ab2c7){_0x53dbef['push'](_0x53dbef['shift']());}};_0x209af1(++_0x3722ab);}(_0x059b,0x156));var _0xb059=function(_0x116c01,_0x4f9949){_0x116c01=_0x116c01-0x0;var _0x1a7d0c=_0x059b[_0x116c01];return _0x1a7d0c;};'use strict';var _=require(_0xb059('0x0'));var util=require(_0xb059('0x1'));var logger=require('../../config/logger')(_0xb059('0x2'));var moment=require(_0xb059('0x3'));var BPromise=require(_0xb059('0x4'));var rp=require(_0xb059('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb059('0x6'));var config=require(_0xb059('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xb059('0x8')]=function(_0x41d68a,_0x3d5e27){return _0x41d68a[_0xb059('0x9')]('DeskConfiguration',attributes,{'tableName':_0xb059('0xa'),'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 a2f557c..fcef3f9 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 _0x758e=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash'];(function(_0x3fd02a,_0x5067e9){var _0x1c0364=function(_0x4c90eb){while(--_0x4c90eb){_0x3fd02a['push'](_0x3fd02a['shift']());}};_0x1c0364(++_0x5067e9);}(_0x758e,0x1af));var _0xe758=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x758e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe758('0x1'));var rs=require(_0xe758('0x2'));var fs=require('fs');var Redis=require(_0xe758('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe758('0x4'))(_0xe758('0x5'));var config=require(_0xe758('0x6'));var jayson=require(_0xe758('0x7'));var client=jayson['client'][_0xe758('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e792,_0x46eec3,_0x5357cf){return new BPromise(function(_0x4c03ba,_0x454ee0){return client['request'](_0x21e792,_0x5357cf)['then'](function(_0x4c16c3){logger['info'](_0xe758('0x9'),_0x46eec3,_0xe758('0xa'));logger[_0xe758('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x46eec3,_0xe758('0xa'),JSON['stringify'](_0x4c16c3));if(_0x4c16c3[_0xe758('0xc')]){if(_0x4c16c3[_0xe758('0xc')][_0xe758('0xd')]===0x1f4){logger['error'](_0xe758('0x9'),_0x46eec3,_0x4c16c3['error'][_0xe758('0xe')]);return _0x454ee0(_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);}logger[_0xe758('0xc')](_0xe758('0x9'),_0x46eec3,_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);return _0x4c03ba(_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);}else{logger['info'](_0xe758('0x9'),_0x46eec3,'request\x20sent');_0x4c03ba(_0x4c16c3['result'][_0xe758('0xe')]);}})[_0xe758('0xf')](function(_0x540eb6){logger['error'](_0xe758('0x9'),_0x46eec3,_0x540eb6);_0x454ee0(_0x540eb6);});});} \ No newline at end of file +var _0xf4dd=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x245122,_0x16cd51){var _0xc5b35d=function(_0x5af9e2){while(--_0x5af9e2){_0x245122['push'](_0x245122['shift']());}};_0xc5b35d(++_0x16cd51);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x47c695,_0x119c83){_0x47c695=_0x47c695-0x0;var _0x15b54c=_0xf4dd[_0x47c695];return _0x15b54c;};'use strict';var _=require(_0xdf4d('0x0'));var util=require(_0xdf4d('0x1'));var moment=require(_0xdf4d('0x2'));var BPromise=require(_0xdf4d('0x3'));var rs=require(_0xdf4d('0x4'));var fs=require('fs');var Redis=require(_0xdf4d('0x5'));var db=require(_0xdf4d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf4d('0x7'))('rpc');var config=require(_0xdf4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdf4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4334b0,_0x5ee8f5,_0x64c256){return new BPromise(function(_0x4a3e29,_0x34918e){return client[_0xdf4d('0xa')](_0x4334b0,_0x64c256)[_0xdf4d('0xb')](function(_0x49c7ef){logger[_0xdf4d('0xc')](_0xdf4d('0xd'),_0x5ee8f5,_0xdf4d('0xe'));logger[_0xdf4d('0xf')](_0xdf4d('0x10'),_0x5ee8f5,_0xdf4d('0xe'),JSON[_0xdf4d('0x11')](_0x49c7ef));if(_0x49c7ef[_0xdf4d('0x12')]){if(_0x49c7ef[_0xdf4d('0x12')]['code']===0x1f4){logger[_0xdf4d('0x12')](_0xdf4d('0xd'),_0x5ee8f5,_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);return _0x34918e(_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);}logger[_0xdf4d('0x12')](_0xdf4d('0xd'),_0x5ee8f5,_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);return _0x4a3e29(_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);}else{logger[_0xdf4d('0xc')](_0xdf4d('0xd'),_0x5ee8f5,_0xdf4d('0xe'));_0x4a3e29(_0x49c7ef[_0xdf4d('0x14')][_0xdf4d('0x13')]);}})[_0xdf4d('0x15')](function(_0x357a70){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5ee8f5,_0x357a70);_0x34918e(_0x357a70);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3741ef9..c911bc8 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 _0x3fe0=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3fe0,0x76));var _0x03fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3fe0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x03fe('0x0'));var util=require(_0x03fe('0x1'));var path=require(_0x03fe('0x2'));var timeout=require(_0x03fe('0x3'));var express=require(_0x03fe('0x4'));var router=express[_0x03fe('0x5')]();var auth=require(_0x03fe('0x6'));var interaction=require(_0x03fe('0x7'));var config=require('../../config/environment');var controller=require(_0x03fe('0x8'));router[_0x03fe('0x9')]('/',auth[_0x03fe('0xa')](),controller[_0x03fe('0xb')]);router[_0x03fe('0x9')](_0x03fe('0xc'),auth[_0x03fe('0xa')](),controller[_0x03fe('0xd')]);router[_0x03fe('0xe')]('/',auth['isAuthenticated'](),controller[_0x03fe('0xf')]);router[_0x03fe('0x10')](_0x03fe('0xc'),auth[_0x03fe('0xa')](),controller['update']);router[_0x03fe('0x11')](_0x03fe('0xc'),auth[_0x03fe('0xa')](),controller[_0x03fe('0x12')]);module[_0x03fe('0x13')]=router; \ No newline at end of file +var _0xbce5=['put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xbce5,0x94));var _0x5bce=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0xbce5[_0x45fe9c];return _0x233d48;};'use strict';var multer=require('multer');var util=require(_0x5bce('0x0'));var path=require(_0x5bce('0x1'));var timeout=require(_0x5bce('0x2'));var express=require(_0x5bce('0x3'));var router=express[_0x5bce('0x4')]();var auth=require(_0x5bce('0x5'));var interaction=require(_0x5bce('0x6'));var config=require(_0x5bce('0x7'));var controller=require(_0x5bce('0x8'));router[_0x5bce('0x9')]('/',auth[_0x5bce('0xa')](),controller[_0x5bce('0xb')]);router[_0x5bce('0x9')](_0x5bce('0xc'),auth[_0x5bce('0xa')](),controller['show']);router[_0x5bce('0xd')]('/',auth[_0x5bce('0xa')](),controller['create']);router[_0x5bce('0xe')](_0x5bce('0xc'),auth['isAuthenticated'](),controller[_0x5bce('0xf')]);router['delete'](_0x5bce('0xc'),auth[_0x5bce('0xa')](),controller[_0x5bce('0x10')]);module[_0x5bce('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 556c2c7..beff3bd 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 _0xedc3=['exports','ENUM','variable','customVariable','STRING','sequelize'];(function(_0xb48d7b,_0x82ad33){var _0x475fec=function(_0x385c4b){while(--_0x385c4b){_0xb48d7b['push'](_0xb48d7b['shift']());}};_0x475fec(++_0x82ad33);}(_0xedc3,0x71));var _0x3edc=function(_0x8692e2,_0x17ddb3){_0x8692e2=_0x8692e2-0x0;var _0xf7b90d=_0xedc3[_0x8692e2];return _0xf7b90d;};'use strict';var Sequelize=require(_0x3edc('0x0'));module[_0x3edc('0x1')]={'type':{'type':Sequelize[_0x3edc('0x2')]('string',_0x3edc('0x3'),_0x3edc('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3edc('0x5')]},'key':{'type':Sequelize[_0x3edc('0x5')]},'keyType':{'type':Sequelize[_0x3edc('0x2')]('string',_0x3edc('0x3'),_0x3edc('0x4'))},'keyContent':{'type':Sequelize[_0x3edc('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3edc('0x5')]}}; \ No newline at end of file +var _0x1baa=['ENUM','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x219730,_0x2faf33){var _0x7be2bc=function(_0x4f9787){while(--_0x4f9787){_0x219730['push'](_0x219730['shift']());}};_0x7be2bc(++_0x2faf33);}(_0x1baa,0x72));var _0xa1ba=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x1baa[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa1ba('0x0')]('string',_0xa1ba('0x1'),_0xa1ba('0x2'),_0xa1ba('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa1ba('0x4')]},'keyType':{'type':Sequelize[_0xa1ba('0x0')]('string',_0xa1ba('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xa1ba('0x4')]},'idField':{'type':Sequelize[_0xa1ba('0x4')]},'nameField':{'type':Sequelize[_0xa1ba('0x4')]},'customField':{'type':Sequelize[_0xa1ba('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2633c1f..7e54e2e 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 _0x8a8d=['hasOwnProperty','nolimit','pick','filters','filter','where','merge','options','includeAll','findAll','rows','show','keys','include','catch','create','body','find','params','html-pdf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length'];(function(_0x388af7,_0x17530b){var _0x1000f8=function(_0xf14643){while(--_0xf14643){_0x388af7['push'](_0x388af7['shift']());}};_0x1000f8(++_0x17530b);}(_0x8a8d,0x167));var _0xd8a8=function(_0x4a5309,_0x4bb3bb){_0x4a5309=_0x4a5309-0x0;var _0x266240=_0x8a8d[_0x4a5309];return _0x266240;};'use strict';var pdf=require(_0xd8a8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd8a8('0x2'));var BPromise=require(_0xd8a8('0x3'));var Mustache=require(_0xd8a8('0x4'));var util=require(_0xd8a8('0x5'));var path=require('path');var sox=require(_0xd8a8('0x6'));var csv=require(_0xd8a8('0x7'));var ejs=require(_0xd8a8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8a8('0x9'));var crypto=require(_0xd8a8('0xa'));var jsforce=require(_0xd8a8('0xb'));var deskjs=require(_0xd8a8('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8a8('0xd'));var authService=require(_0xd8a8('0xe'));var qs=require(_0xd8a8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8a8('0x10'))('api');var utils=require(_0xd8a8('0x11'));var config=require(_0xd8a8('0x12'));var db=require(_0xd8a8('0x13'))['db'];function respondWithStatusCode(_0x441ff4,_0x12d07e){_0x12d07e=_0x12d07e||0xcc;return function(_0xf8801a){if(_0xf8801a){return _0x441ff4['sendStatus'](_0x12d07e);}return _0x441ff4[_0xd8a8('0x14')](_0x12d07e)[_0xd8a8('0x15')]();};}function respondWithResult(_0x56fffc,_0x3475df){_0x3475df=_0x3475df||0xc8;return function(_0xcaad11){if(_0xcaad11){return _0x56fffc['status'](_0x3475df)[_0xd8a8('0x16')](_0xcaad11);}};}function respondWithFilteredResult(_0x370230,_0x249f6a){return function(_0x1d7699){if(_0x1d7699){var _0x5ac1e9=_0x1d7699[_0xd8a8('0x17')],_0x708f21=_0x249f6a[_0xd8a8('0x18')],_0x5b6fe5=_0x249f6a[_0xd8a8('0x18')]+_0x249f6a[_0xd8a8('0x19')],_0x284e1a;if(_0x5b6fe5>=_0x5ac1e9){_0x5b6fe5=_0x5ac1e9;_0x284e1a=0xc8;}else{_0x284e1a=0xce;}_0x370230[_0xd8a8('0x14')](_0x284e1a);return _0x370230['set'](_0xd8a8('0x1a'),_0x708f21+'-'+_0x5b6fe5+'/'+_0x5ac1e9)[_0xd8a8('0x16')](_0x1d7699);}return null;};}function patchUpdates(_0x2b9db7){return function(_0x53dc6d){try{jsonpatch[_0xd8a8('0x1b')](_0x53dc6d,_0x2b9db7,!![]);}catch(_0x51c356){return BPromise[_0xd8a8('0x1c')](_0x51c356);}return _0x53dc6d[_0xd8a8('0x1d')]();};}function saveUpdates(_0x48a57c,_0x557a5a){return function(_0x340989){if(_0x340989){return _0x340989[_0xd8a8('0x1e')](_0x48a57c)[_0xd8a8('0x1f')](function(_0x4222e0){return _0x4222e0;});}return null;};}function removeEntity(_0x11c36b,_0x5cd62f){return function(_0x12b818){if(_0x12b818){return _0x12b818[_0xd8a8('0x20')]()['then'](function(){_0x11c36b[_0xd8a8('0x14')](0xcc)[_0xd8a8('0x15')]();});}};}function handleEntityNotFound(_0x271210,_0x34c776){return function(_0x48a17a){if(!_0x48a17a){_0x271210['sendStatus'](0x194);}return _0x48a17a;};}function handleError(_0x167312,_0x3842d5){_0x3842d5=_0x3842d5||0x1f4;return function(_0x3cf48e){logger[_0xd8a8('0x21')](_0x3cf48e[_0xd8a8('0x22')]);if(_0x3cf48e[_0xd8a8('0x23')]){delete _0x3cf48e[_0xd8a8('0x23')];}_0x167312['status'](_0x3842d5)[_0xd8a8('0x24')](_0x3cf48e);};}exports[_0xd8a8('0x25')]=function(_0xa0bd3d,_0x1a7d9b){var _0x359765={},_0xfe1862={},_0x1ad71a={'count':0x0,'rows':[]};var _0x2b405c=_[_0xd8a8('0x26')](db[_0xd8a8('0x27')][_0xd8a8('0x28')],function(_0x16629a){return{'name':_0x16629a[_0xd8a8('0x29')],'type':_0x16629a[_0xd8a8('0x2a')]['key']};});_0xfe1862[_0xd8a8('0x2b')]=_[_0xd8a8('0x26')](_0x2b405c,_0xd8a8('0x23'));_0xfe1862['query']=_['keys'](_0xa0bd3d[_0xd8a8('0x2c')]);_0xfe1862['filters']=_[_0xd8a8('0x2d')](_0xfe1862['model'],_0xfe1862[_0xd8a8('0x2c')]);_0x359765[_0xd8a8('0x2e')]=_['intersection'](_0xfe1862[_0xd8a8('0x2b')],qs['fields'](_0xa0bd3d[_0xd8a8('0x2c')][_0xd8a8('0x2f')]));_0x359765[_0xd8a8('0x2e')]=_0x359765[_0xd8a8('0x2e')][_0xd8a8('0x30')]?_0x359765[_0xd8a8('0x2e')]:_0xfe1862[_0xd8a8('0x2b')];if(!_0xa0bd3d[_0xd8a8('0x2c')][_0xd8a8('0x31')](_0xd8a8('0x32'))){_0x359765['limit']=qs[_0xd8a8('0x19')](_0xa0bd3d[_0xd8a8('0x2c')][_0xd8a8('0x19')]);_0x359765[_0xd8a8('0x18')]=qs[_0xd8a8('0x18')](_0xa0bd3d[_0xd8a8('0x2c')][_0xd8a8('0x18')]);}_0x359765['order']=qs['sort'](_0xa0bd3d[_0xd8a8('0x2c')]['sort']);_0x359765['where']=qs['filters'](_[_0xd8a8('0x33')](_0xa0bd3d[_0xd8a8('0x2c')],_0xfe1862[_0xd8a8('0x34')]),_0x2b405c);if(_0xa0bd3d['query'][_0xd8a8('0x35')]){_0x359765[_0xd8a8('0x36')]=_['merge'](_0x359765['where'],{'$or':_[_0xd8a8('0x26')](_0x2b405c,function(_0x547a33){if(_0x547a33[_0xd8a8('0x2a')]!=='VIRTUAL'){var _0x18c302={};_0x18c302[_0x547a33['name']]={'$like':'%'+_0xa0bd3d[_0xd8a8('0x2c')]['filter']+'%'};return _0x18c302;}})});}_0x359765=_[_0xd8a8('0x37')]({},_0x359765,_0xa0bd3d[_0xd8a8('0x38')]);var _0x23da86={'where':_0x359765[_0xd8a8('0x36')]};return db[_0xd8a8('0x27')][_0xd8a8('0x17')](_0x23da86)['then'](function(_0x3b47eb){_0x1ad71a[_0xd8a8('0x17')]=_0x3b47eb;if(_0xa0bd3d[_0xd8a8('0x2c')][_0xd8a8('0x39')]){_0x359765['include']=[{'all':!![]}];}return db[_0xd8a8('0x27')][_0xd8a8('0x3a')](_0x359765);})[_0xd8a8('0x1f')](function(_0x2b3dfb){_0x1ad71a[_0xd8a8('0x3b')]=_0x2b3dfb;return _0x1ad71a;})[_0xd8a8('0x1f')](respondWithFilteredResult(_0x1a7d9b,_0x359765))['catch'](handleError(_0x1a7d9b,null));};exports[_0xd8a8('0x3c')]=function(_0x5861ce,_0x186179){var _0x3976df={'raw':!![],'where':{'id':_0x5861ce['params']['id']}},_0x30e0f8={};_0x30e0f8[_0xd8a8('0x2b')]=_[_0xd8a8('0x3d')](db[_0xd8a8('0x27')]['rawAttributes']);_0x30e0f8[_0xd8a8('0x2c')]=_[_0xd8a8('0x3d')](_0x5861ce[_0xd8a8('0x2c')]);_0x30e0f8['filters']=_[_0xd8a8('0x2d')](_0x30e0f8[_0xd8a8('0x2b')],_0x30e0f8[_0xd8a8('0x2c')]);_0x3976df[_0xd8a8('0x2e')]=_[_0xd8a8('0x2d')](_0x30e0f8[_0xd8a8('0x2b')],qs[_0xd8a8('0x2f')](_0x5861ce['query'][_0xd8a8('0x2f')]));_0x3976df[_0xd8a8('0x2e')]=_0x3976df[_0xd8a8('0x2e')]['length']?_0x3976df['attributes']:_0x30e0f8['model'];if(_0x5861ce[_0xd8a8('0x2c')][_0xd8a8('0x39')]){_0x3976df[_0xd8a8('0x3e')]=[{'all':!![]}];}_0x3976df=_[_0xd8a8('0x37')]({},_0x3976df,_0x5861ce['options']);return db[_0xd8a8('0x27')]['find'](_0x3976df)[_0xd8a8('0x1f')](handleEntityNotFound(_0x186179,null))['then'](respondWithResult(_0x186179,null))[_0xd8a8('0x3f')](handleError(_0x186179,null));};exports['create']=function(_0x445bd5,_0x4d82b0){return db[_0xd8a8('0x27')][_0xd8a8('0x40')](_0x445bd5[_0xd8a8('0x41')],{})[_0xd8a8('0x1f')](respondWithResult(_0x4d82b0,0xc9))[_0xd8a8('0x3f')](handleError(_0x4d82b0,null));};exports['update']=function(_0x176a66,_0x41ae64){if(_0x176a66[_0xd8a8('0x41')]['id']){delete _0x176a66[_0xd8a8('0x41')]['id'];}return db[_0xd8a8('0x27')][_0xd8a8('0x42')]({'where':{'id':_0x176a66[_0xd8a8('0x43')]['id']}})[_0xd8a8('0x1f')](handleEntityNotFound(_0x41ae64,null))[_0xd8a8('0x1f')](saveUpdates(_0x176a66[_0xd8a8('0x41')],null))[_0xd8a8('0x1f')](respondWithResult(_0x41ae64,null))[_0xd8a8('0x3f')](handleError(_0x41ae64,null));};exports[_0xd8a8('0x20')]=function(_0x4c2514,_0x1627fb){return db['DeskField'][_0xd8a8('0x42')]({'where':{'id':_0x4c2514[_0xd8a8('0x43')]['id']}})[_0xd8a8('0x1f')](handleEntityNotFound(_0x1627fb,null))['then'](removeEntity(_0x1627fb,null))[_0xd8a8('0x3f')](handleError(_0x1627fb,null));}; \ No newline at end of file +var _0x974a=['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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','name','send','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','DeskField','params','length','includeAll','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xb6c490,_0x23b361){var _0x3be82d=function(_0x28bcf2){while(--_0x28bcf2){_0xb6c490['push'](_0xb6c490['shift']());}};_0x3be82d(++_0x23b361);}(_0x974a,0x120));var _0xa974=function(_0x3b6de2,_0xe7a524){_0x3b6de2=_0x3b6de2-0x0;var _0x11459d=_0x974a[_0x3b6de2];return _0x11459d;};'use strict';var pdf=require(_0xa974('0x0'));var emlformat=require(_0xa974('0x1'));var rimraf=require(_0xa974('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa974('0x3'));var rp=require(_0xa974('0x4'));var moment=require(_0xa974('0x5'));var BPromise=require(_0xa974('0x6'));var Mustache=require(_0xa974('0x7'));var util=require(_0xa974('0x8'));var path=require(_0xa974('0x9'));var sox=require(_0xa974('0xa'));var csv=require(_0xa974('0xb'));var ejs=require(_0xa974('0xc'));var fs=require('fs');var _=require(_0xa974('0xd'));var squel=require(_0xa974('0xe'));var crypto=require(_0xa974('0xf'));var jsforce=require(_0xa974('0x10'));var deskjs=require(_0xa974('0x11'));var toCsv=require(_0xa974('0xb'));var querystring=require(_0xa974('0x12'));var Papa=require(_0xa974('0x13'));var Redis=require(_0xa974('0x14'));var authService=require(_0xa974('0x15'));var qs=require(_0xa974('0x16'));var as=require(_0xa974('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa974('0x18'))(_0xa974('0x19'));var utils=require(_0xa974('0x1a'));var config=require(_0xa974('0x1b'));var db=require(_0xa974('0x1c'))['db'];function respondWithStatusCode(_0x4b6835,_0x48c2d4){_0x48c2d4=_0x48c2d4||0xcc;return function(_0x4b5be3){if(_0x4b5be3){return _0x4b6835[_0xa974('0x1d')](_0x48c2d4);}return _0x4b6835[_0xa974('0x1e')](_0x48c2d4)[_0xa974('0x1f')]();};}function respondWithResult(_0x501b32,_0x33b1e1){_0x33b1e1=_0x33b1e1||0xc8;return function(_0x4445d4){if(_0x4445d4){return _0x501b32[_0xa974('0x1e')](_0x33b1e1)[_0xa974('0x20')](_0x4445d4);}};}function respondWithFilteredResult(_0xa252d0,_0x537129){return function(_0x3f3133){if(_0x3f3133){var _0x497e6f=_0x3f3133[_0xa974('0x21')],_0x28d091=_0x537129[_0xa974('0x22')],_0x1af33a=_0x537129[_0xa974('0x22')]+_0x537129[_0xa974('0x23')],_0x2384d6;if(_0x1af33a>=_0x497e6f){_0x1af33a=_0x497e6f;_0x2384d6=0xc8;}else{_0x2384d6=0xce;}_0xa252d0[_0xa974('0x1e')](_0x2384d6);return _0xa252d0[_0xa974('0x24')]('Content-Range',_0x28d091+'-'+_0x1af33a+'/'+_0x497e6f)[_0xa974('0x20')](_0x3f3133);}return null;};}function patchUpdates(_0x297918){return function(_0x3e681c){try{jsonpatch[_0xa974('0x25')](_0x3e681c,_0x297918,!![]);}catch(_0x1519b6){return BPromise[_0xa974('0x26')](_0x1519b6);}return _0x3e681c[_0xa974('0x27')]();};}function saveUpdates(_0x1d2afa,_0x2665dd){return function(_0x2e10c8){if(_0x2e10c8){return _0x2e10c8[_0xa974('0x28')](_0x1d2afa)['then'](function(_0x23080d){return _0x23080d;});}return null;};}function removeEntity(_0x512b23,_0xaa0144){return function(_0x7d5b60){if(_0x7d5b60){return _0x7d5b60[_0xa974('0x29')]()[_0xa974('0x2a')](function(){_0x512b23[_0xa974('0x1e')](0xcc)[_0xa974('0x1f')]();});}};}function handleEntityNotFound(_0x2bc11d,_0x2a880a){return function(_0x296a40){if(!_0x296a40){_0x2bc11d[_0xa974('0x1d')](0x194);}return _0x296a40;};}function handleError(_0x3674e3,_0x2c37c9){_0x2c37c9=_0x2c37c9||0x1f4;return function(_0x7484dd){logger['error'](_0x7484dd['stack']);if(_0x7484dd[_0xa974('0x2b')]){delete _0x7484dd['name'];}_0x3674e3[_0xa974('0x1e')](_0x2c37c9)[_0xa974('0x2c')](_0x7484dd);};}exports['index']=function(_0x410b04,_0x328bae){var _0x329c93={},_0x989294={},_0x24091f={'count':0x0,'rows':[]};var _0x31d073=_['map'](db['DeskField'][_0xa974('0x2d')],function(_0x5fc72a){return{'name':_0x5fc72a['fieldName'],'type':_0x5fc72a[_0xa974('0x2e')][_0xa974('0x2f')]};});_0x989294[_0xa974('0x30')]=_['map'](_0x31d073,_0xa974('0x2b'));_0x989294[_0xa974('0x31')]=_[_0xa974('0x32')](_0x410b04[_0xa974('0x31')]);_0x989294[_0xa974('0x33')]=_['intersection'](_0x989294['model'],_0x989294['query']);_0x329c93[_0xa974('0x34')]=_[_0xa974('0x35')](_0x989294[_0xa974('0x30')],qs['fields'](_0x410b04[_0xa974('0x31')][_0xa974('0x36')]));_0x329c93[_0xa974('0x34')]=_0x329c93[_0xa974('0x34')]['length']?_0x329c93[_0xa974('0x34')]:_0x989294[_0xa974('0x30')];if(!_0x410b04[_0xa974('0x31')]['hasOwnProperty'](_0xa974('0x37'))){_0x329c93['limit']=qs['limit'](_0x410b04[_0xa974('0x31')][_0xa974('0x23')]);_0x329c93[_0xa974('0x22')]=qs[_0xa974('0x22')](_0x410b04[_0xa974('0x31')][_0xa974('0x22')]);}_0x329c93[_0xa974('0x38')]=qs[_0xa974('0x39')](_0x410b04[_0xa974('0x31')][_0xa974('0x39')]);_0x329c93[_0xa974('0x3a')]=qs[_0xa974('0x33')](_[_0xa974('0x3b')](_0x410b04['query'],_0x989294['filters']),_0x31d073);if(_0x410b04[_0xa974('0x31')][_0xa974('0x3c')]){_0x329c93[_0xa974('0x3a')]=_[_0xa974('0x3d')](_0x329c93['where'],{'$or':_[_0xa974('0x3e')](_0x31d073,function(_0xd426ca){if(_0xd426ca[_0xa974('0x2e')]!==_0xa974('0x3f')){var _0x13c509={};_0x13c509[_0xd426ca[_0xa974('0x2b')]]={'$like':'%'+_0x410b04[_0xa974('0x31')][_0xa974('0x3c')]+'%'};return _0x13c509;}})});}_0x329c93=_['merge']({},_0x329c93,_0x410b04[_0xa974('0x40')]);var _0x2d7690={'where':_0x329c93[_0xa974('0x3a')]};return db['DeskField'][_0xa974('0x21')](_0x2d7690)[_0xa974('0x2a')](function(_0x478f73){_0x24091f[_0xa974('0x21')]=_0x478f73;if(_0x410b04[_0xa974('0x31')]['includeAll']){_0x329c93[_0xa974('0x41')]=[{'all':!![]}];}return db[_0xa974('0x42')]['findAll'](_0x329c93);})[_0xa974('0x2a')](function(_0x1f279d){_0x24091f['rows']=_0x1f279d;return _0x24091f;})[_0xa974('0x2a')](respondWithFilteredResult(_0x328bae,_0x329c93))['catch'](handleError(_0x328bae,null));};exports['show']=function(_0x42a506,_0x259829){var _0x16723a={'raw':!![],'where':{'id':_0x42a506[_0xa974('0x43')]['id']}},_0x2c7950={};_0x2c7950[_0xa974('0x30')]=_['keys'](db[_0xa974('0x42')]['rawAttributes']);_0x2c7950[_0xa974('0x31')]=_['keys'](_0x42a506[_0xa974('0x31')]);_0x2c7950[_0xa974('0x33')]=_['intersection'](_0x2c7950[_0xa974('0x30')],_0x2c7950[_0xa974('0x31')]);_0x16723a['attributes']=_[_0xa974('0x35')](_0x2c7950[_0xa974('0x30')],qs[_0xa974('0x36')](_0x42a506['query'][_0xa974('0x36')]));_0x16723a[_0xa974('0x34')]=_0x16723a[_0xa974('0x34')][_0xa974('0x44')]?_0x16723a[_0xa974('0x34')]:_0x2c7950['model'];if(_0x42a506[_0xa974('0x31')][_0xa974('0x45')]){_0x16723a[_0xa974('0x41')]=[{'all':!![]}];}_0x16723a=_[_0xa974('0x3d')]({},_0x16723a,_0x42a506['options']);return db['DeskField'][_0xa974('0x46')](_0x16723a)[_0xa974('0x2a')](handleEntityNotFound(_0x259829,null))[_0xa974('0x2a')](respondWithResult(_0x259829,null))[_0xa974('0x47')](handleError(_0x259829,null));};exports[_0xa974('0x48')]=function(_0x313423,_0x216704){return db[_0xa974('0x42')][_0xa974('0x48')](_0x313423['body'],{})['then'](respondWithResult(_0x216704,0xc9))[_0xa974('0x47')](handleError(_0x216704,null));};exports['update']=function(_0x2211be,_0xb4d5dc){if(_0x2211be[_0xa974('0x49')]['id']){delete _0x2211be[_0xa974('0x49')]['id'];}return db[_0xa974('0x42')][_0xa974('0x46')]({'where':{'id':_0x2211be[_0xa974('0x43')]['id']}})[_0xa974('0x2a')](handleEntityNotFound(_0xb4d5dc,null))[_0xa974('0x2a')](saveUpdates(_0x2211be[_0xa974('0x49')],null))[_0xa974('0x2a')](respondWithResult(_0xb4d5dc,null))[_0xa974('0x47')](handleError(_0xb4d5dc,null));};exports[_0xa974('0x29')]=function(_0x483a59,_0x3d388b){return db[_0xa974('0x42')][_0xa974('0x46')]({'where':{'id':_0x483a59['params']['id']}})[_0xa974('0x2a')](handleEntityNotFound(_0x3d388b,null))[_0xa974('0x2a')](removeEntity(_0x3d388b,null))[_0xa974('0x47')](handleError(_0x3d388b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 20e6490..6064c7e 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 _0x473b=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index'];(function(_0x36565a,_0x36246f){var _0x1b0a7f=function(_0x279099){while(--_0x279099){_0x36565a['push'](_0x36565a['shift']());}};_0x1b0a7f(++_0x36246f);}(_0x473b,0x1d4));var _0xb473=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x473b[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xb473('0x0'));var util=require(_0xb473('0x1'));var logger=require('../../config/logger')(_0xb473('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb473('0x3'));var fs=require('fs');var path=require(_0xb473('0x4'));var rimraf=require(_0xb473('0x5'));var config=require(_0xb473('0x6'));var attributes=require(_0xb473('0x7'));module[_0xb473('0x8')]=function(_0x1d4994,_0x5e5848){return _0x1d4994['define'](_0xb473('0x9'),attributes,{'tableName':_0xb473('0xa'),'paranoid':![],'indexes':[{'name':_0xb473('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cfe=['desk_unique_index','idField','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields'];(function(_0x251bc2,_0x35bd21){var _0xef3802=function(_0x230a1a){while(--_0x230a1a){_0x251bc2['push'](_0x251bc2['shift']());}};_0xef3802(++_0x35bd21);}(_0x5cfe,0x12d));var _0xe5cf=function(_0x1101e3,_0x1492e9){_0x1101e3=_0x1101e3-0x0;var _0x1aa5c6=_0x5cfe[_0x1101e3];return _0x1aa5c6;};'use strict';var _=require('lodash');var util=require(_0xe5cf('0x0'));var logger=require(_0xe5cf('0x1'))('api');var moment=require(_0xe5cf('0x2'));var BPromise=require(_0xe5cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5cf('0x4'));var rimraf=require(_0xe5cf('0x5'));var config=require(_0xe5cf('0x6'));var attributes=require(_0xe5cf('0x7'));module[_0xe5cf('0x8')]=function(_0x53d911,_0x212d99){return _0x53d911['define'](_0xe5cf('0x9'),attributes,{'tableName':_0xe5cf('0xa'),'paranoid':![],'indexes':[{'name':_0xe5cf('0xb'),'fields':[_0xe5cf('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index c566e8e..64b5135 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 _0xb0cd=['../../config/environment','jayson/promise','client','request','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5e71af,_0x4942e8){var _0x563565=function(_0x3eadd5){while(--_0x3eadd5){_0x5e71af['push'](_0x5e71af['shift']());}};_0x563565(++_0x4942e8);}(_0xb0cd,0x172));var _0xdb0c=function(_0x3032be,_0x50a581){_0x3032be=_0x3032be-0x0;var _0x39cc43=_0xb0cd[_0x3032be];return _0x39cc43;};'use strict';var _=require(_0xdb0c('0x0'));var util=require(_0xdb0c('0x1'));var moment=require(_0xdb0c('0x2'));var BPromise=require(_0xdb0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb0c('0x5'));var logger=require(_0xdb0c('0x6'))(_0xdb0c('0x7'));var config=require(_0xdb0c('0x8'));var jayson=require(_0xdb0c('0x9'));var client=jayson[_0xdb0c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a2894,_0x35943c,_0x539f14){return new BPromise(function(_0x1f43c5,_0x3cd225){return client[_0xdb0c('0xb')](_0x4a2894,_0x539f14)['then'](function(_0x5508f9){logger['info'](_0xdb0c('0xc'),_0x35943c,_0xdb0c('0xd'));logger['debug'](_0xdb0c('0xe'),_0x35943c,_0xdb0c('0xd'),JSON[_0xdb0c('0xf')](_0x5508f9));if(_0x5508f9['error']){if(_0x5508f9[_0xdb0c('0x10')][_0xdb0c('0x11')]===0x1f4){logger[_0xdb0c('0x10')]('DeskField,\x20%s,\x20%s',_0x35943c,_0x5508f9[_0xdb0c('0x10')][_0xdb0c('0x12')]);return _0x3cd225(_0x5508f9[_0xdb0c('0x10')][_0xdb0c('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x35943c,_0x5508f9[_0xdb0c('0x10')][_0xdb0c('0x12')]);return _0x1f43c5(_0x5508f9['error'][_0xdb0c('0x12')]);}else{logger[_0xdb0c('0x13')]('DeskField,\x20%s,\x20%s',_0x35943c,_0xdb0c('0xd'));_0x1f43c5(_0x5508f9[_0xdb0c('0x14')][_0xdb0c('0x12')]);}})['catch'](function(_0x5227bc){logger[_0xdb0c('0x10')](_0xdb0c('0xc'),_0x35943c,_0x5227bc);_0x3cd225(_0x5227bc);});});} \ No newline at end of file +var _0xa4e0=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s'];(function(_0x1ca66c,_0x3e3868){var _0x5a78ce=function(_0x5432ac){while(--_0x5432ac){_0x1ca66c['push'](_0x1ca66c['shift']());}};_0x5a78ce(++_0x3e3868);}(_0xa4e0,0xde));var _0x0a4e=function(_0x260cba,_0x3e59a1){_0x260cba=_0x260cba-0x0;var _0x54ff8d=_0xa4e0[_0x260cba];return _0x54ff8d;};'use strict';var _=require(_0x0a4e('0x0'));var util=require(_0x0a4e('0x1'));var moment=require(_0x0a4e('0x2'));var BPromise=require(_0x0a4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4e('0x4'));var db=require(_0x0a4e('0x5'))['db'];var utils=require(_0x0a4e('0x6'));var logger=require(_0x0a4e('0x7'))(_0x0a4e('0x8'));var config=require('../../config/environment');var jayson=require(_0x0a4e('0x9'));var client=jayson['client'][_0x0a4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a63cd,_0x5b531c,_0x4e636f){return new BPromise(function(_0x41dd11,_0x35d3a8){return client[_0x0a4e('0xb')](_0x8a63cd,_0x4e636f)['then'](function(_0x3813a9){logger[_0x0a4e('0xc')]('DeskField,\x20%s,\x20%s',_0x5b531c,'request\x20sent');logger[_0x0a4e('0xd')](_0x0a4e('0xe'),_0x5b531c,_0x0a4e('0xf'),JSON[_0x0a4e('0x10')](_0x3813a9));if(_0x3813a9[_0x0a4e('0x11')]){if(_0x3813a9[_0x0a4e('0x11')][_0x0a4e('0x12')]===0x1f4){logger[_0x0a4e('0x11')](_0x0a4e('0x13'),_0x5b531c,_0x3813a9[_0x0a4e('0x11')]['message']);return _0x35d3a8(_0x3813a9['error'][_0x0a4e('0x14')]);}logger[_0x0a4e('0x11')](_0x0a4e('0x13'),_0x5b531c,_0x3813a9['error'][_0x0a4e('0x14')]);return _0x41dd11(_0x3813a9[_0x0a4e('0x11')][_0x0a4e('0x14')]);}else{logger[_0x0a4e('0xc')](_0x0a4e('0x13'),_0x5b531c,'request\x20sent');_0x41dd11(_0x3813a9[_0x0a4e('0x15')][_0x0a4e('0x14')]);}})['catch'](function(_0x53f26d){logger[_0x0a4e('0x11')](_0x0a4e('0x13'),_0x5b531c,_0x53f26d);_0x35d3a8(_0x53f26d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e3b92b8..9477f53 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 _0xe34c=['isAuthenticated','/:id','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x4df7e1,_0x1e173b){var _0x5d7612=function(_0x16d074){while(--_0x16d074){_0x4df7e1['push'](_0x4df7e1['shift']());}};_0x5d7612(++_0x1e173b);}(_0xe34c,0xbc));var _0xce34=function(_0x1448a7,_0x26f598){_0x1448a7=_0x1448a7-0x0;var _0x6721af=_0xe34c[_0x1448a7];return _0x6721af;};'use strict';var multer=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var path=require(_0xce34('0x2'));var timeout=require(_0xce34('0x3'));var express=require(_0xce34('0x4'));var router=express['Router']();var auth=require(_0xce34('0x5'));var interaction=require(_0xce34('0x6'));var config=require(_0xce34('0x7'));var controller=require(_0xce34('0x8'));router[_0xce34('0x9')]('/',auth[_0xce34('0xa')](),controller['index']);router[_0xce34('0x9')](_0xce34('0xb'),auth[_0xce34('0xa')](),controller[_0xce34('0xc')]);router[_0xce34('0x9')]('/:id/configurations',auth[_0xce34('0xa')](),controller['getConfigurations']);router[_0xce34('0x9')](_0xce34('0xd'),auth[_0xce34('0xa')](),controller['getFields']);router[_0xce34('0xe')]('/',auth[_0xce34('0xa')](),controller[_0xce34('0xf')]);router[_0xce34('0xe')](_0xce34('0x10'),auth['isAuthenticated'](),controller[_0xce34('0x11')]);router[_0xce34('0x12')]('/:id',auth[_0xce34('0xa')](),controller[_0xce34('0x13')]);router[_0xce34('0x14')]('/:id',auth[_0xce34('0xa')](),controller[_0xce34('0x15')]);module['exports']=router; \ No newline at end of file +var _0x21da=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put'];(function(_0x2f152f,_0x5c3f26){var _0x53432d=function(_0xa41dbd){while(--_0xa41dbd){_0x2f152f['push'](_0x2f152f['shift']());}};_0x53432d(++_0x5c3f26);}(_0x21da,0x148));var _0xa21d=function(_0x30b0b7,_0x313503){_0x30b0b7=_0x30b0b7-0x0;var _0x5e2c8b=_0x21da[_0x30b0b7];return _0x5e2c8b;};'use strict';var multer=require(_0xa21d('0x0'));var util=require(_0xa21d('0x1'));var path=require(_0xa21d('0x2'));var timeout=require(_0xa21d('0x3'));var express=require(_0xa21d('0x4'));var router=express[_0xa21d('0x5')]();var auth=require(_0xa21d('0x6'));var interaction=require(_0xa21d('0x7'));var config=require(_0xa21d('0x8'));var controller=require(_0xa21d('0x9'));router[_0xa21d('0xa')]('/',auth['isAuthenticated'](),controller[_0xa21d('0xb')]);router[_0xa21d('0xa')](_0xa21d('0xc'),auth[_0xa21d('0xd')](),controller['show']);router[_0xa21d('0xa')](_0xa21d('0xe'),auth['isAuthenticated'](),controller[_0xa21d('0xf')]);router[_0xa21d('0xa')](_0xa21d('0x10'),auth[_0xa21d('0xd')](),controller[_0xa21d('0x11')]);router['post']('/',auth[_0xa21d('0xd')](),controller[_0xa21d('0x12')]);router[_0xa21d('0x13')](_0xa21d('0xe'),auth['isAuthenticated'](),controller[_0xa21d('0x14')]);router[_0xa21d('0x15')]('/:id',auth[_0xa21d('0xd')](),controller[_0xa21d('0x16')]);router['delete'](_0xa21d('0xc'),auth[_0xa21d('0xd')](),controller[_0xa21d('0x17')]);module[_0xa21d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9d8d0a4..047d873 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 _0xe7fa=['sequelize','exports','STRING'];(function(_0x27dd21,_0x2c2d12){var _0x12d8d4=function(_0xa33620){while(--_0xa33620){_0x27dd21['push'](_0x27dd21['shift']());}};_0x12d8d4(++_0x2c2d12);}(_0xe7fa,0x117));var _0xae7f=function(_0x34f2e1,_0x11e61c){_0x34f2e1=_0x34f2e1-0x0;var _0x4224d3=_0xe7fa[_0x34f2e1];return _0x4224d3;};'use strict';var Sequelize=require(_0xae7f('0x0'));module[_0xae7f('0x1')]={'name':{'type':Sequelize[_0xae7f('0x2')]},'username':{'type':Sequelize[_0xae7f('0x2')]},'password':{'type':Sequelize[_0xae7f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xae7f('0x2')]},'clientId':{'type':Sequelize[_0xae7f('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb14=['sequelize','STRING'];(function(_0x1691f0,_0x1a3fef){var _0x5ad7db=function(_0x171907){while(--_0x171907){_0x1691f0['push'](_0x1691f0['shift']());}};_0x5ad7db(++_0x1a3fef);}(_0xbb14,0x1aa));var _0x4bb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbb14[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4bb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x4bb1('0x1')]},'username':{'type':Sequelize[_0x4bb1('0x1')]},'password':{'type':Sequelize[_0x4bb1('0x1')]},'remoteUri':{'type':Sequelize[_0x4bb1('0x1')]},'tenantId':{'type':Sequelize[_0x4bb1('0x1')]},'clientId':{'type':Sequelize[_0x4bb1('0x1')]},'clientSecret':{'type':Sequelize[_0x4bb1('0x1')]},'serverUrl':{'type':Sequelize[_0x4bb1('0x1')]},'description':{'type':Sequelize[_0x4bb1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 09feaaf..f090590 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 _0x0d8c=['EntityNameAttributeMetadata','StateAttributeMetadata','push','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','stringify','error','code','message','result','catch','status','end','json','count','offset','set','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','params','include','find','create','body','order','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','Incident','PhoneCall','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','username','access_token','GET','Bearer\x20','4.0','value','EntityDefinitions(','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','all','MemoAttributeMetadata','DateTimeAttributeMetadata'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x0d8c,0x1b0));var _0xc0d8=function(_0x1bbfe4,_0x22160b){_0x1bbfe4=_0x1bbfe4-0x0;var _0x3546cf=_0x0d8c[_0x1bbfe4];return _0x3546cf;};'use strict';var pdf=require(_0xc0d8('0x0'));var emlformat=require(_0xc0d8('0x1'));var rimraf=require(_0xc0d8('0x2'));var zipdir=require(_0xc0d8('0x3'));var jsonpatch=require(_0xc0d8('0x4'));var rp=require(_0xc0d8('0x5'));var moment=require(_0xc0d8('0x6'));var BPromise=require(_0xc0d8('0x7'));var Mustache=require(_0xc0d8('0x8'));var util=require(_0xc0d8('0x9'));var path=require(_0xc0d8('0xa'));var sox=require(_0xc0d8('0xb'));var csv=require(_0xc0d8('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc0d8('0xd'));var squel=require(_0xc0d8('0xe'));var crypto=require('crypto');var jsforce=require(_0xc0d8('0xf'));var deskjs=require(_0xc0d8('0x10'));var toCsv=require(_0xc0d8('0xc'));var querystring=require(_0xc0d8('0x11'));var Papa=require(_0xc0d8('0x12'));var Redis=require(_0xc0d8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc0d8('0x14'));var as=require(_0xc0d8('0x15'));var hardwareService=require(_0xc0d8('0x16'));var logger=require(_0xc0d8('0x17'))(_0xc0d8('0x18'));var utils=require('../../config/utils');var config=require(_0xc0d8('0x19'));var db=require(_0xc0d8('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc0d8('0x1b'));var client=jayson['client'][_0xc0d8('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x22ef21,_0x23e36f,_0x5b013d){if(_0x5b013d){var _0x5d37b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d37b0[_0xc0d8('0x1d')](_0x23e36f)){return _0x22ef21;}else{throw new db['Sequelize'][(_0xc0d8('0x1e'))](_0xc0d8('0x1f'));}}else{return _0x22ef21;}}function respondWithRpcPromise(_0x168c18,_0x5c68d2,_0x3cd335,_0x450124){return new BPromise(function(_0x37c494,_0x2b2987){var _0x2d21a0=_0x450124||client;return _0x2d21a0[_0xc0d8('0x20')](_0x168c18,_0x3cd335)[_0xc0d8('0x21')](function(_0xde0b54){logger[_0xc0d8('0x22')](_0xc0d8('0x23'),_0x5c68d2,_0xc0d8('0x24'));logger[_0xc0d8('0x25')](_0xc0d8('0x26'),_0x5c68d2,_0xc0d8('0x24'),JSON[_0xc0d8('0x27')](_0xde0b54));if(_0xde0b54[_0xc0d8('0x28')]){if(_0xde0b54[_0xc0d8('0x28')][_0xc0d8('0x29')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5c68d2,_0xde0b54[_0xc0d8('0x28')]['message']);return _0x2b2987(_0xde0b54[_0xc0d8('0x28')][_0xc0d8('0x2a')]);}logger[_0xc0d8('0x28')](_0xc0d8('0x23'),_0x5c68d2,_0xde0b54[_0xc0d8('0x28')][_0xc0d8('0x2a')]);return _0x37c494(_0xde0b54['error'][_0xc0d8('0x2a')]);}else{logger[_0xc0d8('0x22')](_0xc0d8('0x23'),_0x5c68d2,'request\x20sent');_0x37c494(_0xde0b54[_0xc0d8('0x2b')][_0xc0d8('0x2a')]);}})[_0xc0d8('0x2c')](function(_0x484d65){logger[_0xc0d8('0x28')](_0xc0d8('0x23'),_0x5c68d2,_0x484d65);_0x2b2987(_0x484d65);});});}function respondWithStatusCode(_0xf7f55d,_0x494264){_0x494264=_0x494264||0xcc;return function(_0x122880){if(_0x122880){return _0xf7f55d['sendStatus'](_0x494264);}return _0xf7f55d[_0xc0d8('0x2d')](_0x494264)[_0xc0d8('0x2e')]();};}function respondWithResult(_0xf56876,_0x5f56c8){_0x5f56c8=_0x5f56c8||0xc8;return function(_0x1e01c6){if(_0x1e01c6){return _0xf56876['status'](_0x5f56c8)[_0xc0d8('0x2f')](_0x1e01c6);}};}function respondWithFilteredResult(_0x409736,_0x2a1e4f){return function(_0x505489){if(_0x505489){var _0x5501df=_0x505489[_0xc0d8('0x30')],_0x8e000b=_0x2a1e4f[_0xc0d8('0x31')],_0x2d9eb7=_0x2a1e4f['offset']+_0x2a1e4f['limit'],_0x1293be;if(_0x2d9eb7>=_0x5501df){_0x2d9eb7=_0x5501df;_0x1293be=0xc8;}else{_0x1293be=0xce;}_0x409736[_0xc0d8('0x2d')](_0x1293be);return _0x409736[_0xc0d8('0x32')]('Content-Range',_0x8e000b+'-'+_0x2d9eb7+'/'+_0x5501df)[_0xc0d8('0x2f')](_0x505489);}return null;};}function patchUpdates(_0x41ab11){return function(_0x5c9629){try{jsonpatch[_0xc0d8('0x33')](_0x5c9629,_0x41ab11,!![]);}catch(_0x3c356a){return BPromise[_0xc0d8('0x34')](_0x3c356a);}return _0x5c9629['save']();};}function saveUpdates(_0x56b4d0,_0x1c9428){return function(_0x11b466){if(_0x11b466){return _0x11b466[_0xc0d8('0x35')](_0x56b4d0)[_0xc0d8('0x21')](function(_0x107fff){return _0x107fff;});}return null;};}function removeEntity(_0x55f7e9,_0x3f6424){return function(_0x382147){if(_0x382147){return _0x382147[_0xc0d8('0x36')]()[_0xc0d8('0x21')](function(){_0x55f7e9[_0xc0d8('0x2d')](0xcc)[_0xc0d8('0x2e')]();});}};}function handleEntityNotFound(_0xeffccc,_0x5ac770){return function(_0x78913b){if(!_0x78913b){_0xeffccc[_0xc0d8('0x37')](0x194);}return _0x78913b;};}function handleError(_0x413cdc,_0x449251){_0x449251=_0x449251||0x1f4;return function(_0x575ede){logger[_0xc0d8('0x28')](_0x575ede[_0xc0d8('0x38')]);if(_0x575ede[_0xc0d8('0x39')]){delete _0x575ede[_0xc0d8('0x39')];}_0x413cdc['status'](_0x449251)[_0xc0d8('0x3a')](_0x575ede);};}exports[_0xc0d8('0x3b')]=function(_0x26e3d1,_0x5b5d1f){var _0x1e4d67={},_0x48ebc0={},_0x18bcf9={'count':0x0,'rows':[]};var _0x12f211=_[_0xc0d8('0x3c')](db[_0xc0d8('0x3d')][_0xc0d8('0x3e')],function(_0x3a4ee2){return{'name':_0x3a4ee2[_0xc0d8('0x3f')],'type':_0x3a4ee2[_0xc0d8('0x40')]['key']};});_0x48ebc0[_0xc0d8('0x41')]=_[_0xc0d8('0x3c')](_0x12f211,_0xc0d8('0x39'));_0x48ebc0[_0xc0d8('0x42')]=_[_0xc0d8('0x43')](_0x26e3d1[_0xc0d8('0x42')]);_0x48ebc0[_0xc0d8('0x44')]=_[_0xc0d8('0x45')](_0x48ebc0[_0xc0d8('0x41')],_0x48ebc0[_0xc0d8('0x42')]);_0x1e4d67['attributes']=_['intersection'](_0x48ebc0['model'],qs[_0xc0d8('0x46')](_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x46')]));_0x1e4d67[_0xc0d8('0x47')]=_0x1e4d67[_0xc0d8('0x47')][_0xc0d8('0x48')]?_0x1e4d67['attributes']:_0x48ebc0[_0xc0d8('0x41')];if(!_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x49')](_0xc0d8('0x4a'))){_0x1e4d67['limit']=qs[_0xc0d8('0x4b')](_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x4b')]);_0x1e4d67[_0xc0d8('0x31')]=qs[_0xc0d8('0x31')](_0x26e3d1['query'][_0xc0d8('0x31')]);}_0x1e4d67['order']=qs['sort'](_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x4c')]);_0x1e4d67['where']=qs[_0xc0d8('0x44')](_[_0xc0d8('0x4d')](_0x26e3d1[_0xc0d8('0x42')],_0x48ebc0[_0xc0d8('0x44')]),_0x12f211);if(_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x4e')]){_0x1e4d67['where']=_[_0xc0d8('0x4f')](_0x1e4d67['where'],{'$or':_['map'](_0x12f211,function(_0x1e398e){if(_0x1e398e['type']!==_0xc0d8('0x50')){var _0x31625a={};_0x31625a[_0x1e398e[_0xc0d8('0x39')]]={'$like':'%'+_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x4e')]+'%'};return _0x31625a;}})});}_0x1e4d67=_[_0xc0d8('0x4f')]({},_0x1e4d67,_0x26e3d1[_0xc0d8('0x51')]);var _0x4749e3={'where':_0x1e4d67[_0xc0d8('0x52')]};return db['Dynamics365Account'][_0xc0d8('0x30')](_0x4749e3)[_0xc0d8('0x21')](function(_0x106d3f){_0x18bcf9[_0xc0d8('0x30')]=_0x106d3f;if(_0x26e3d1[_0xc0d8('0x42')][_0xc0d8('0x53')]){_0x1e4d67['include']=[{'all':!![]}];}return db[_0xc0d8('0x3d')][_0xc0d8('0x54')](_0x1e4d67);})[_0xc0d8('0x21')](function(_0x9016af){_0x18bcf9[_0xc0d8('0x55')]=_0x9016af;return _0x18bcf9;})[_0xc0d8('0x21')](respondWithFilteredResult(_0x5b5d1f,_0x1e4d67))[_0xc0d8('0x2c')](handleError(_0x5b5d1f,null));};exports[_0xc0d8('0x56')]=function(_0x4d5336,_0xff675b){var _0x153c70={'raw':![],'where':{'id':_0x4d5336[_0xc0d8('0x57')]['id']}},_0x1b5b96={};_0x1b5b96[_0xc0d8('0x41')]=_[_0xc0d8('0x43')](db[_0xc0d8('0x3d')]['rawAttributes']);_0x1b5b96['query']=_['keys'](_0x4d5336[_0xc0d8('0x42')]);_0x1b5b96[_0xc0d8('0x44')]=_[_0xc0d8('0x45')](_0x1b5b96[_0xc0d8('0x41')],_0x1b5b96[_0xc0d8('0x42')]);_0x153c70['attributes']=_[_0xc0d8('0x45')](_0x1b5b96[_0xc0d8('0x41')],qs[_0xc0d8('0x46')](_0x4d5336[_0xc0d8('0x42')][_0xc0d8('0x46')]));_0x153c70[_0xc0d8('0x47')]=_0x153c70['attributes'][_0xc0d8('0x48')]?_0x153c70[_0xc0d8('0x47')]:_0x1b5b96[_0xc0d8('0x41')];if(_0x4d5336[_0xc0d8('0x42')][_0xc0d8('0x53')]){_0x153c70[_0xc0d8('0x58')]=[{'all':!![]}];}_0x153c70=_['merge']({},_0x153c70,_0x4d5336[_0xc0d8('0x51')]);return db[_0xc0d8('0x3d')][_0xc0d8('0x59')](_0x153c70)[_0xc0d8('0x21')](handleEntityNotFound(_0xff675b,null))[_0xc0d8('0x21')](respondWithResult(_0xff675b,null))[_0xc0d8('0x2c')](handleError(_0xff675b,null));};exports[_0xc0d8('0x5a')]=function(_0x5c484a,_0xc76dec){return db[_0xc0d8('0x3d')][_0xc0d8('0x5a')](_0x5c484a[_0xc0d8('0x5b')],{})[_0xc0d8('0x21')](respondWithResult(_0xc76dec,0xc9))[_0xc0d8('0x2c')](handleError(_0xc76dec,null));};exports[_0xc0d8('0x35')]=function(_0xf70c41,_0x1e0f9c){if(_0xf70c41['body']['id']){delete _0xf70c41['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0xf70c41[_0xc0d8('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e0f9c,null))[_0xc0d8('0x21')](saveUpdates(_0xf70c41[_0xc0d8('0x5b')],null))[_0xc0d8('0x21')](respondWithResult(_0x1e0f9c,null))['catch'](handleError(_0x1e0f9c,null));};exports[_0xc0d8('0x36')]=function(_0xee7f07,_0x2f5f36){return db['Dynamics365Account']['find']({'where':{'id':_0xee7f07[_0xc0d8('0x57')]['id']}})[_0xc0d8('0x21')](handleEntityNotFound(_0x2f5f36,null))[_0xc0d8('0x21')](removeEntity(_0x2f5f36,null))['catch'](handleError(_0x2f5f36,null));};exports['getConfigurations']=function(_0x3134ea,_0xb3ed14,_0xd50682){var _0x560191={};var _0x38d929={};var _0x46db05;var _0x5242e5;return db['Dynamics365Account']['findOne']({'where':{'id':_0x3134ea['params']['id']}})['then'](handleEntityNotFound(_0xb3ed14,null))['then'](function(_0x2d3152){if(_0x2d3152){_0x46db05=_0x2d3152;_0x38d929[_0xc0d8('0x41')]=_[_0xc0d8('0x43')](db['Dynamics365Configuration'][_0xc0d8('0x3e')]);_0x38d929[_0xc0d8('0x42')]=_[_0xc0d8('0x43')](_0x3134ea[_0xc0d8('0x42')]);_0x38d929[_0xc0d8('0x44')]=_[_0xc0d8('0x45')](_0x38d929['model'],_0x38d929[_0xc0d8('0x42')]);_0x560191[_0xc0d8('0x47')]=_[_0xc0d8('0x45')](_0x38d929[_0xc0d8('0x41')],qs[_0xc0d8('0x46')](_0x3134ea[_0xc0d8('0x42')][_0xc0d8('0x46')]));_0x560191[_0xc0d8('0x47')]=_0x560191['attributes']['length']?_0x560191['attributes']:_0x38d929['model'];_0x560191[_0xc0d8('0x5c')]=qs[_0xc0d8('0x4c')](_0x3134ea[_0xc0d8('0x42')]['sort']);_0x560191['where']=qs[_0xc0d8('0x44')](_['pick'](_0x3134ea['query'],_0x38d929[_0xc0d8('0x44')]));if(_0x3134ea[_0xc0d8('0x42')][_0xc0d8('0x4e')]){_0x560191[_0xc0d8('0x52')]=_[_0xc0d8('0x4f')](_0x560191[_0xc0d8('0x52')],{'$or':_[_0xc0d8('0x3c')](_0x560191['attributes'],function(_0x32573d){var _0x4d3017={};_0x4d3017[_0x32573d]={'$like':'%'+_0x3134ea[_0xc0d8('0x42')][_0xc0d8('0x4e')]+'%'};return _0x4d3017;})});}_0x560191=_['merge']({},_0x560191,_0x3134ea[_0xc0d8('0x51')]);return _0x46db05[_0xc0d8('0x5d')](_0x560191);}})[_0xc0d8('0x21')](function(_0x1d6623){if(_0x1d6623){_0x5242e5=_0x1d6623['length'];if(!_0x3134ea[_0xc0d8('0x42')][_0xc0d8('0x49')]('nolimit')){_0x560191[_0xc0d8('0x4b')]=qs[_0xc0d8('0x4b')](_0x3134ea[_0xc0d8('0x42')]['limit']);_0x560191['offset']=qs['offset'](_0x3134ea[_0xc0d8('0x42')][_0xc0d8('0x31')]);}return _0x46db05[_0xc0d8('0x5d')](_0x560191);}})[_0xc0d8('0x21')](function(_0x548cb6){if(_0x548cb6){return _0x548cb6?{'count':_0x5242e5,'rows':_0x548cb6}:null;}})[_0xc0d8('0x21')](respondWithResult(_0xb3ed14,null))[_0xc0d8('0x2c')](handleError(_0xb3ed14,null));};exports[_0xc0d8('0x5e')]=function(_0x111b2c,_0x34a631,_0x15c8f4){if(_0x111b2c[_0xc0d8('0x5b')]['id']){delete _0x111b2c[_0xc0d8('0x5b')]['id'];}return db[_0xc0d8('0x3d')][_0xc0d8('0x5f')]({'where':{'id':_0x111b2c[_0xc0d8('0x57')]['id']}})[_0xc0d8('0x21')](handleEntityNotFound(_0x34a631,null))[_0xc0d8('0x21')](function(_0x4640f0){if(_0x4640f0){_0x111b2c[_0xc0d8('0x5b')]['AccountId']=_0x4640f0['id'];_0x111b2c['body'][_0xc0d8('0x60')]=integrations[_0xc0d8('0x61')](_0x111b2c[_0xc0d8('0x5b')][_0xc0d8('0x62')],_0x111b2c[_0xc0d8('0x5b')][_0xc0d8('0x40')]);_0x111b2c[_0xc0d8('0x5b')][_0xc0d8('0x63')]=integrations[_0xc0d8('0x64')](_0x111b2c[_0xc0d8('0x5b')]['channel'],_0x111b2c[_0xc0d8('0x5b')][_0xc0d8('0x40')]);return db['Dynamics365Configuration']['create'](_0x111b2c[_0xc0d8('0x5b')],{'include':[{'model':db[_0xc0d8('0x65')],'as':_0xc0d8('0x60')},{'model':db[_0xc0d8('0x65')],'as':_0xc0d8('0x63')}]});}return null;})[_0xc0d8('0x21')](respondWithResult(_0x34a631,null))[_0xc0d8('0x2c')](handleError(_0x34a631,null));};exports['getFields']=function(_0x135281,_0x17614b,_0x550523){var _0x355b22=_0x135281[_0xc0d8('0x42')][_0xc0d8('0x66')];var _0x5758c3=_0x355b22==='incident'?_0xc0d8('0x67'):_0xc0d8('0x68');var _0x1bf1a3='';var _0x307c78='';var _0x5dd06f='';var _0x316dd3='';var _0x437b0c='';var _0x421c71='';var _0x3cda1c='';var _0x1c5b0c='';var _0xc3f8b=['title','description','customerid',_0xc0d8('0x69'),_0xc0d8('0x6a'),_0xc0d8('0x6b'),_0xc0d8('0x6c'),_0xc0d8('0x6d'),'directioncode','phonecall_activity_parties'];var _0x39ad1f=[_0xc0d8('0x6e'),_0xc0d8('0x6f'),_0xc0d8('0x70'),_0xc0d8('0x71'),'contactidname',_0xc0d8('0x72'),'contractdetailidname',_0xc0d8('0x73'),_0xc0d8('0x74'),_0xc0d8('0x75'),_0xc0d8('0x76'),_0xc0d8('0x77'),_0xc0d8('0x78'),_0xc0d8('0x79'),_0xc0d8('0x7a'),'customeridname',_0xc0d8('0x7b'),_0xc0d8('0x7c'),'emailaddress',_0xc0d8('0x7d'),_0xc0d8('0x7e'),'entityimage_url',_0xc0d8('0x7f'),'exchangerate',_0xc0d8('0x80'),_0xc0d8('0x81'),_0xc0d8('0x82'),'influencescore','kbarticleidname','lastonholdtime',_0xc0d8('0x83'),_0xc0d8('0x84'),_0xc0d8('0x85'),_0xc0d8('0x86'),_0xc0d8('0x87'),_0xc0d8('0x88'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xc0d8('0x89'),'msdyn_iotalertname','numberofchildincidents',_0xc0d8('0x8a'),_0xc0d8('0x8b'),_0xc0d8('0x8c'),_0xc0d8('0x8d'),_0xc0d8('0x8e'),_0xc0d8('0x8f'),'primarycontactidname',_0xc0d8('0x90'),_0xc0d8('0x91'),_0xc0d8('0x92'),_0xc0d8('0x93'),_0xc0d8('0x94'),'resolvebykpiidname',_0xc0d8('0x95'),'responsiblecontactidname',_0xc0d8('0x96'),'sentimentvalue','slainvokedidname',_0xc0d8('0x97'),_0xc0d8('0x98'),'statecode',_0xc0d8('0x99'),'subjectidname',_0xc0d8('0x9a'),_0xc0d8('0x9b'),'transactioncurrencyidname',_0xc0d8('0x9c'),_0xc0d8('0x9d'),_0xc0d8('0x9e')];var _0x3fcc6c=_0xc3f8b[_0xc0d8('0x9f')](_0x39ad1f);return db[_0xc0d8('0x3d')][_0xc0d8('0x5f')]({'where':{'id':_0x135281[_0xc0d8('0x57')]['id']},'attributes':['id','username',_0xc0d8('0xa0'),'remoteUri',_0xc0d8('0xa1'),_0xc0d8('0xa2'),_0xc0d8('0xa3')]})[_0xc0d8('0x21')](handleEntityNotFound(_0x17614b,null))['then'](function(_0x3f59e0){if(_0x3f59e0){_0x1c5b0c=_0x3f59e0[_0xc0d8('0xa4')];var _0x203f65=_0x1c5b0c[_0xc0d8('0xa5')](-0x1);if(_0x203f65==='/'){_0x1c5b0c=_0x1c5b0c[_0xc0d8('0xa6')](0x0,_0x1c5b0c[_0xc0d8('0xa7')](_0x203f65));}_0x3cda1c=util[_0xc0d8('0xa8')](_0xc0d8('0xa9'),_0x1c5b0c);var _0x5b390f={'method':'POST','uri':_0xc0d8('0xaa')+_0x3f59e0['tenantId']+_0xc0d8('0xab'),'form':{'client_id':_0x3f59e0[_0xc0d8('0xa2')],'resource':_0x1c5b0c,'username':_0x3f59e0[_0xc0d8('0xac')],'password':_0x3f59e0[_0xc0d8('0xa0')],'grant_type':_0xc0d8('0xa0'),'client_secret':_0x3f59e0['clientSecret']},'json':!![]};return rp(_0x5b390f);}})[_0xc0d8('0x21')](function(_0x588ca7){_0x421c71=_0x588ca7[_0xc0d8('0xad')];var _0x2fd893={'method':_0xc0d8('0xae'),'uri':encodeURI(_0x3cda1c+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5758c3+'\x27'),'headers':{'Authorization':_0xc0d8('0xaf')+_0x421c71,'If-None-Match':null,'OData-Version':_0xc0d8('0xb0')},'json':!![]};return rp(_0x2fd893);})[_0xc0d8('0x21')](function(_0x3bc9a8){var _0x4dba6b=_0x3bc9a8[_0xc0d8('0xb1')][0x0];var _0x3852f5=_0x4dba6b['MetadataId'];var _0x1ffdf8={'method':_0xc0d8('0xae'),'uri':_0x3cda1c+_0xc0d8('0xb2')+_0x3852f5+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xc0d8('0xaf')+_0x421c71,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ffdf8);})[_0xc0d8('0x21')](function(_0x457863){_0x1bf1a3=_0x457863;_0x307c78=_0x1bf1a3['Attributes'];_0x307c78=_['remove'](_0x307c78,function(_0x78543){return!_0x3fcc6c[_0xc0d8('0xb3')](_0x78543[_0xc0d8('0xb4')]);});var _0x1f9797=[];var _0x2cc722=[];_0x307c78[_0xc0d8('0xb5')](function(_0x49e7da){if(_0x49e7da['@odata.type']){var _0x155800=_0x49e7da['@odata.type'][_0xc0d8('0xa6')](_0x49e7da[_0xc0d8('0xb6')][_0xc0d8('0xa7')]('.')+0x1);if(_0x155800===_0xc0d8('0xb7')){_0x1f9797['push'](getSelectList(_0x3cda1c,_0x355b22,_0x2cc722,_0x1bf1a3[_0xc0d8('0xb8')],_0x49e7da[_0xc0d8('0xb8')],_0x421c71));}}});return Promise['all'](_0x1f9797);})['then'](function(_0x3a44f7){_0x5dd06f=_0x3a44f7[0x0];var _0x23a070=[];var _0xe56e55=[];_0x307c78[_0xc0d8('0xb5')](function(_0x5e04ce){if(!_[_0xc0d8('0xb9')](_0x5e04ce['@odata.type'])){var _0x33016f=_0x5e04ce['@odata.type'][_0xc0d8('0xa6')](_0x5e04ce['@odata.type']['lastIndexOf']('.')+0x1);if(_0x33016f==='BooleanAttributeMetadata'){_0x23a070['push'](getBooleanList(_0x3cda1c,_0x355b22,_0xe56e55,_0x1bf1a3[_0xc0d8('0xb8')],_0x5e04ce[_0xc0d8('0xb8')],_0x421c71));}}});return Promise[_0xc0d8('0xba')](_0x23a070);})['then'](function(_0x5f57e1){_0x316dd3=_0x5f57e1[0x0];var _0x5adbed=[];var _0x37ea7b=[];_0x307c78['forEach'](function(_0x4f5be9){if(_0x4f5be9[_0xc0d8('0xb6')]){var _0xaf1d38=_0x4f5be9[_0xc0d8('0xb6')][_0xc0d8('0xa6')](_0x4f5be9[_0xc0d8('0xb6')][_0xc0d8('0xa7')]('.')+0x1);if(_0xaf1d38==='StringAttributeMetadata'||_0xaf1d38==='DoubleAttributeMetadata'||_0xaf1d38==='BigIntAttributeMetadata'||_0xaf1d38==='IntegerAttributeMetadata'||_0xaf1d38===_0xc0d8('0xbb')||_0xaf1d38===_0xc0d8('0xbc')||_0xaf1d38==='StatusAttributeMetadata'||_0xaf1d38===_0xc0d8('0xbd')||_0xaf1d38===_0xc0d8('0xbe')||_0xaf1d38==='DecimalAttributeMetadata'){_0x5adbed[_0xc0d8('0xbf')](getInputList(_0x3cda1c,_0x355b22,_0xaf1d38,_0x37ea7b,_0x1bf1a3['MetadataId'],_0x4f5be9[_0xc0d8('0xb8')],_0x421c71));}}});return Promise[_0xc0d8('0xba')](_0x5adbed);})[_0xc0d8('0x21')](function(_0x2d7260){_0x437b0c=_0x2d7260[0x0];var _0x238b8b=_0x5dd06f[_0xc0d8('0x9f')](_0x316dd3)[_0xc0d8('0x9f')](_0x437b0c);var _0x5b303a={'count':_0x238b8b[_0xc0d8('0x48')],'rows':_0x238b8b};return _0x5b303a;})['then'](respondWithResult(_0x17614b,null))['catch'](function(_0x1d0c7b){var _0x3258fd=_0x135281[_0xc0d8('0x42')][_0xc0d8('0x1d')]?0x1f4:_0x1d0c7b[_0xc0d8('0xc0')]||0x1f4;logger[_0xc0d8('0x28')](_0x1d0c7b['stack']);delete _0x1d0c7b[_0xc0d8('0x39')];if(_0x3258fd===0x191){_0x3258fd=0x190;}_0x17614b[_0xc0d8('0x2d')](_0x3258fd)[_0xc0d8('0x3a')](_0x135281[_0xc0d8('0x42')][_0xc0d8('0x1d')]?{'message':_0xc0d8('0xc1'),'statusCode':_0x1d0c7b[_0xc0d8('0xc0')]}:_0x1d0c7b);});};function getSelectList(_0x2f7c83,_0x5eb9de,_0x3085d5,_0x215a92,_0x4e1562,_0x2e71fc){var _0x220851={'method':'GET','uri':_0x2f7c83+'EntityDefinitions('+_0x215a92+')/Attributes('+_0x4e1562+_0xc0d8('0xc2')+_0xc0d8('0xc3'),'headers':{'Authorization':_0xc0d8('0xaf')+_0x2e71fc,'If-None-Match':null,'OData-Version':_0xc0d8('0xb0')},'json':!![]};return rp(_0x220851)[_0xc0d8('0x21')](function(_0x4107ed){var _0x3dae96=[];var _0x103f3e=_0x4107ed[_0xc0d8('0xc4')][_0xc0d8('0xc5')];_0x103f3e['forEach'](function(_0x1d9b3a){_0x3dae96[_0xc0d8('0xbf')]({'name':_0x1d9b3a[_0xc0d8('0xc6')][_0xc0d8('0xc7')][_0xc0d8('0xc6')],'value':String(_0x1d9b3a['Value'])});});var _0x15c8d5={'id':_0x5eb9de+'_'+_0x4107ed[_0xc0d8('0xb4')],'name':_0x4107ed[_0xc0d8('0xc8')][_0xc0d8('0xc7')][_0xc0d8('0xc6')],'custom':![],'options':_0x3dae96};_0x3085d5[_0xc0d8('0xbf')](_0x15c8d5);return _0x3085d5;});}function getBooleanList(_0x3eda1e,_0x32bb29,_0x68e20f,_0x565bb6,_0x17b041,_0x36645d){var _0x123c72={'method':'GET','uri':_0x3eda1e+'EntityDefinitions('+_0x565bb6+_0xc0d8('0xc9')+_0x17b041+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc0d8('0xaf')+_0x36645d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x123c72)['then'](function(_0x5d9b26){var _0x5ba4bb=[];_0x5ba4bb[_0xc0d8('0xbf')]({'name':_0x5d9b26[_0xc0d8('0xc4')][_0xc0d8('0xca')][_0xc0d8('0xc6')][_0xc0d8('0xc7')][_0xc0d8('0xc6')],'value':'true'},{'name':_0x5d9b26[_0xc0d8('0xc4')][_0xc0d8('0xcb')][_0xc0d8('0xc6')][_0xc0d8('0xc7')][_0xc0d8('0xc6')],'value':_0xc0d8('0xcc')});var _0x51914f={'id':_0x32bb29+'_'+_0x5d9b26[_0xc0d8('0xb4')],'name':_0x5d9b26['DisplayName'][_0xc0d8('0xc7')][_0xc0d8('0xc6')],'custom':![],'options':_0x5ba4bb};_0x68e20f[_0xc0d8('0xbf')](_0x51914f);return _0x68e20f;});}function getInputList(_0x19d487,_0x5e8652,_0x4e2403,_0x378a79,_0x56de35,_0x18af58,_0x4bc4e3){var _0x10fbcd={'method':_0xc0d8('0xae'),'uri':_0x19d487+_0xc0d8('0xb2')+_0x56de35+_0xc0d8('0xc9')+_0x18af58+_0xc0d8('0xcd')+_0x4e2403+_0xc0d8('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x4bc4e3,'If-None-Match':null,'OData-Version':_0xc0d8('0xb0')},'json':!![]};return rp(_0x10fbcd)['then'](function(_0x19dd10){var _0x363f4f={'id':_0x5e8652+'_'+_0x19dd10['LogicalName'],'name':_0x19dd10[_0xc0d8('0xc8')][_0xc0d8('0xc7')]?_0x19dd10['DisplayName'][_0xc0d8('0xc7')][_0xc0d8('0xc6')]:_0x19dd10[_0xc0d8('0xb4')],'custom':![],'options':[]};_0x378a79[_0xc0d8('0xbf')](_0x363f4f);return _0x378a79;});} \ No newline at end of file +var _0xf165=['intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','rows','show','params','includeAll','options','find','catch','create','body','update','destroy','findOne','Dynamics365Configuration','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','length','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters'];(function(_0xfd71be,_0x132326){var _0x2c9413=function(_0xab752e){while(--_0xab752e){_0xfd71be['push'](_0xfd71be['shift']());}};_0x2c9413(++_0x132326);}(_0xf165,0x9c));var _0x5f16=function(_0x42a313,_0x300988){_0x42a313=_0x42a313-0x0;var _0x486a46=_0xf165[_0x42a313];return _0x486a46;};'use strict';var pdf=require(_0x5f16('0x0'));var emlformat=require(_0x5f16('0x1'));var rimraf=require(_0x5f16('0x2'));var zipdir=require(_0x5f16('0x3'));var jsonpatch=require(_0x5f16('0x4'));var rp=require('request-promise');var moment=require(_0x5f16('0x5'));var BPromise=require(_0x5f16('0x6'));var Mustache=require(_0x5f16('0x7'));var util=require(_0x5f16('0x8'));var path=require(_0x5f16('0x9'));var sox=require(_0x5f16('0xa'));var csv=require(_0x5f16('0xb'));var ejs=require(_0x5f16('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f16('0xd'));var crypto=require(_0x5f16('0xe'));var jsforce=require(_0x5f16('0xf'));var deskjs=require(_0x5f16('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f16('0x11'));var authService=require(_0x5f16('0x12'));var qs=require(_0x5f16('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f16('0x14'));var logger=require(_0x5f16('0x15'))(_0x5f16('0x16'));var utils=require(_0x5f16('0x17'));var config=require(_0x5f16('0x18'));var db=require(_0x5f16('0x19'))['db'];var integrations=require(_0x5f16('0x1a'));var jayson=require(_0x5f16('0x1b'));var client=jayson['client'][_0x5f16('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4ba653,_0x411e08,_0x4084e5){if(_0x4084e5){var _0x587e54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x587e54[_0x5f16('0x1d')](_0x411e08)){return _0x4ba653;}else{throw new db['Sequelize'][(_0x5f16('0x1e'))](_0x5f16('0x1f'));}}else{return _0x4ba653;}}function respondWithRpcPromise(_0x129909,_0x4130a0,_0x375433,_0x4b7cac){return new BPromise(function(_0xc9e70f,_0x43cc91){var _0x4be688=_0x4b7cac||client;return _0x4be688[_0x5f16('0x20')](_0x129909,_0x375433)[_0x5f16('0x21')](function(_0x4ba9fe){logger['info'](_0x5f16('0x22'),_0x4130a0,'request\x20sent');logger[_0x5f16('0x23')](_0x5f16('0x24'),_0x4130a0,_0x5f16('0x25'),JSON[_0x5f16('0x26')](_0x4ba9fe));if(_0x4ba9fe[_0x5f16('0x27')]){if(_0x4ba9fe[_0x5f16('0x27')][_0x5f16('0x28')]===0x1f4){logger[_0x5f16('0x27')]('Dynamics365Account,\x20%s,\x20%s',_0x4130a0,_0x4ba9fe[_0x5f16('0x27')]['message']);return _0x43cc91(_0x4ba9fe[_0x5f16('0x27')][_0x5f16('0x29')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4130a0,_0x4ba9fe[_0x5f16('0x27')][_0x5f16('0x29')]);return _0xc9e70f(_0x4ba9fe[_0x5f16('0x27')][_0x5f16('0x29')]);}else{logger[_0x5f16('0x2a')]('Dynamics365Account,\x20%s,\x20%s',_0x4130a0,_0x5f16('0x25'));_0xc9e70f(_0x4ba9fe[_0x5f16('0x2b')][_0x5f16('0x29')]);}})['catch'](function(_0x280f2c){logger['error'](_0x5f16('0x22'),_0x4130a0,_0x280f2c);_0x43cc91(_0x280f2c);});});}function respondWithStatusCode(_0x3ff363,_0x42f5d3){_0x42f5d3=_0x42f5d3||0xcc;return function(_0x1beebc){if(_0x1beebc){return _0x3ff363[_0x5f16('0x2c')](_0x42f5d3);}return _0x3ff363[_0x5f16('0x2d')](_0x42f5d3)[_0x5f16('0x2e')]();};}function respondWithResult(_0x457308,_0x1bf2ba){_0x1bf2ba=_0x1bf2ba||0xc8;return function(_0xd9272a){if(_0xd9272a){return _0x457308[_0x5f16('0x2d')](_0x1bf2ba)[_0x5f16('0x2f')](_0xd9272a);}};}function respondWithFilteredResult(_0x396670,_0x41d9cf){return function(_0x41d682){if(_0x41d682){var _0xd26a8e=_0x41d682[_0x5f16('0x30')],_0x9c3dc8=_0x41d9cf[_0x5f16('0x31')],_0x4cfffc=_0x41d9cf[_0x5f16('0x31')]+_0x41d9cf[_0x5f16('0x32')],_0x222ab4;if(_0x4cfffc>=_0xd26a8e){_0x4cfffc=_0xd26a8e;_0x222ab4=0xc8;}else{_0x222ab4=0xce;}_0x396670[_0x5f16('0x2d')](_0x222ab4);return _0x396670[_0x5f16('0x33')](_0x5f16('0x34'),_0x9c3dc8+'-'+_0x4cfffc+'/'+_0xd26a8e)['json'](_0x41d682);}return null;};}function patchUpdates(_0x566420){return function(_0x36e6fd){try{jsonpatch[_0x5f16('0x35')](_0x36e6fd,_0x566420,!![]);}catch(_0x130bb9){return BPromise['reject'](_0x130bb9);}return _0x36e6fd['save']();};}function saveUpdates(_0x5fc32,_0x5c96ed){return function(_0x5c6cc2){if(_0x5c6cc2){return _0x5c6cc2['update'](_0x5fc32)[_0x5f16('0x21')](function(_0x333fe6){return _0x333fe6;});}return null;};}function removeEntity(_0x2b9b95,_0x288b8a){return function(_0x3aaef4){if(_0x3aaef4){return _0x3aaef4['destroy']()['then'](function(){_0x2b9b95[_0x5f16('0x2d')](0xcc)[_0x5f16('0x2e')]();});}};}function handleEntityNotFound(_0x3efb66,_0x3c12fc){return function(_0x3a26f8){if(!_0x3a26f8){_0x3efb66['sendStatus'](0x194);}return _0x3a26f8;};}function handleError(_0x38b116,_0x5a02d6){_0x5a02d6=_0x5a02d6||0x1f4;return function(_0x3d06cc){logger[_0x5f16('0x27')](_0x3d06cc[_0x5f16('0x36')]);if(_0x3d06cc['name']){delete _0x3d06cc[_0x5f16('0x37')];}_0x38b116[_0x5f16('0x2d')](_0x5a02d6)[_0x5f16('0x38')](_0x3d06cc);};}exports['index']=function(_0x195991,_0x524d74){var _0xad9fc6={},_0x60c74a={},_0x3abfcf={'count':0x0,'rows':[]};var _0x2636d5=_[_0x5f16('0x39')](db[_0x5f16('0x3a')][_0x5f16('0x3b')],function(_0x2cc0c2){return{'name':_0x2cc0c2[_0x5f16('0x3c')],'type':_0x2cc0c2[_0x5f16('0x3d')]['key']};});_0x60c74a['model']=_[_0x5f16('0x39')](_0x2636d5,_0x5f16('0x37'));_0x60c74a[_0x5f16('0x3e')]=_[_0x5f16('0x3f')](_0x195991[_0x5f16('0x3e')]);_0x60c74a[_0x5f16('0x40')]=_[_0x5f16('0x41')](_0x60c74a[_0x5f16('0x42')],_0x60c74a[_0x5f16('0x3e')]);_0xad9fc6[_0x5f16('0x43')]=_[_0x5f16('0x41')](_0x60c74a[_0x5f16('0x42')],qs[_0x5f16('0x44')](_0x195991[_0x5f16('0x3e')][_0x5f16('0x44')]));_0xad9fc6[_0x5f16('0x43')]=_0xad9fc6['attributes']['length']?_0xad9fc6[_0x5f16('0x43')]:_0x60c74a[_0x5f16('0x42')];if(!_0x195991[_0x5f16('0x3e')][_0x5f16('0x45')](_0x5f16('0x46'))){_0xad9fc6['limit']=qs['limit'](_0x195991['query']['limit']);_0xad9fc6[_0x5f16('0x31')]=qs[_0x5f16('0x31')](_0x195991[_0x5f16('0x3e')][_0x5f16('0x31')]);}_0xad9fc6[_0x5f16('0x47')]=qs['sort'](_0x195991[_0x5f16('0x3e')]['sort']);_0xad9fc6[_0x5f16('0x48')]=qs[_0x5f16('0x40')](_[_0x5f16('0x49')](_0x195991[_0x5f16('0x3e')],_0x60c74a[_0x5f16('0x40')]),_0x2636d5);if(_0x195991[_0x5f16('0x3e')][_0x5f16('0x4a')]){_0xad9fc6['where']=_[_0x5f16('0x4b')](_0xad9fc6['where'],{'$or':_[_0x5f16('0x39')](_0x2636d5,function(_0x29ba8d){if(_0x29ba8d['type']!==_0x5f16('0x4c')){var _0x4b4a3d={};_0x4b4a3d[_0x29ba8d[_0x5f16('0x37')]]={'$like':'%'+_0x195991[_0x5f16('0x3e')][_0x5f16('0x4a')]+'%'};return _0x4b4a3d;}})});}_0xad9fc6=_[_0x5f16('0x4b')]({},_0xad9fc6,_0x195991['options']);var _0x99c72e={'where':_0xad9fc6[_0x5f16('0x48')]};return db['Dynamics365Account'][_0x5f16('0x30')](_0x99c72e)[_0x5f16('0x21')](function(_0x3b5055){_0x3abfcf[_0x5f16('0x30')]=_0x3b5055;if(_0x195991[_0x5f16('0x3e')]['includeAll']){_0xad9fc6[_0x5f16('0x4d')]=[{'all':!![]}];}return db[_0x5f16('0x3a')]['findAll'](_0xad9fc6);})[_0x5f16('0x21')](function(_0x57460b){_0x3abfcf[_0x5f16('0x4e')]=_0x57460b;return _0x3abfcf;})['then'](respondWithFilteredResult(_0x524d74,_0xad9fc6))['catch'](handleError(_0x524d74,null));};exports[_0x5f16('0x4f')]=function(_0x5a64b4,_0x1a4085){var _0x1cf368={'raw':![],'where':{'id':_0x5a64b4[_0x5f16('0x50')]['id']}},_0x59646a={};_0x59646a['model']=_[_0x5f16('0x3f')](db[_0x5f16('0x3a')][_0x5f16('0x3b')]);_0x59646a['query']=_[_0x5f16('0x3f')](_0x5a64b4[_0x5f16('0x3e')]);_0x59646a[_0x5f16('0x40')]=_['intersection'](_0x59646a[_0x5f16('0x42')],_0x59646a[_0x5f16('0x3e')]);_0x1cf368[_0x5f16('0x43')]=_[_0x5f16('0x41')](_0x59646a[_0x5f16('0x42')],qs[_0x5f16('0x44')](_0x5a64b4[_0x5f16('0x3e')][_0x5f16('0x44')]));_0x1cf368[_0x5f16('0x43')]=_0x1cf368[_0x5f16('0x43')]['length']?_0x1cf368['attributes']:_0x59646a[_0x5f16('0x42')];if(_0x5a64b4['query'][_0x5f16('0x51')]){_0x1cf368[_0x5f16('0x4d')]=[{'all':!![]}];}_0x1cf368=_[_0x5f16('0x4b')]({},_0x1cf368,_0x5a64b4[_0x5f16('0x52')]);return db[_0x5f16('0x3a')][_0x5f16('0x53')](_0x1cf368)['then'](handleEntityNotFound(_0x1a4085,null))['then'](respondWithResult(_0x1a4085,null))[_0x5f16('0x54')](handleError(_0x1a4085,null));};exports[_0x5f16('0x55')]=function(_0x549f62,_0x5ccd95){return db[_0x5f16('0x3a')][_0x5f16('0x55')](_0x549f62[_0x5f16('0x56')],{})[_0x5f16('0x21')](respondWithResult(_0x5ccd95,0xc9))['catch'](handleError(_0x5ccd95,null));};exports[_0x5f16('0x57')]=function(_0x29aeca,_0xbf5b7c){if(_0x29aeca['body']['id']){delete _0x29aeca[_0x5f16('0x56')]['id'];}return db[_0x5f16('0x3a')][_0x5f16('0x53')]({'where':{'id':_0x29aeca[_0x5f16('0x50')]['id']}})[_0x5f16('0x21')](handleEntityNotFound(_0xbf5b7c,null))[_0x5f16('0x21')](saveUpdates(_0x29aeca[_0x5f16('0x56')],null))[_0x5f16('0x21')](respondWithResult(_0xbf5b7c,null))[_0x5f16('0x54')](handleError(_0xbf5b7c,null));};exports[_0x5f16('0x58')]=function(_0x4fac4a,_0x46a065){return db[_0x5f16('0x3a')]['find']({'where':{'id':_0x4fac4a[_0x5f16('0x50')]['id']}})[_0x5f16('0x21')](handleEntityNotFound(_0x46a065,null))['then'](removeEntity(_0x46a065,null))[_0x5f16('0x54')](handleError(_0x46a065,null));};exports['getConfigurations']=function(_0x3d2119,_0x27255e,_0x3c8725){var _0x413902={};var _0x38d812={};var _0x4c4f8c;var _0x5ba908;return db[_0x5f16('0x3a')][_0x5f16('0x59')]({'where':{'id':_0x3d2119[_0x5f16('0x50')]['id']}})['then'](handleEntityNotFound(_0x27255e,null))['then'](function(_0x40ef83){if(_0x40ef83){_0x4c4f8c=_0x40ef83;_0x38d812[_0x5f16('0x42')]=_[_0x5f16('0x3f')](db[_0x5f16('0x5a')][_0x5f16('0x3b')]);_0x38d812[_0x5f16('0x3e')]=_['keys'](_0x3d2119[_0x5f16('0x3e')]);_0x38d812[_0x5f16('0x40')]=_[_0x5f16('0x41')](_0x38d812[_0x5f16('0x42')],_0x38d812[_0x5f16('0x3e')]);_0x413902[_0x5f16('0x43')]=_['intersection'](_0x38d812[_0x5f16('0x42')],qs[_0x5f16('0x44')](_0x3d2119[_0x5f16('0x3e')]['fields']));_0x413902[_0x5f16('0x43')]=_0x413902['attributes']['length']?_0x413902[_0x5f16('0x43')]:_0x38d812[_0x5f16('0x42')];_0x413902[_0x5f16('0x47')]=qs[_0x5f16('0x5b')](_0x3d2119[_0x5f16('0x3e')][_0x5f16('0x5b')]);_0x413902[_0x5f16('0x48')]=qs[_0x5f16('0x40')](_[_0x5f16('0x49')](_0x3d2119[_0x5f16('0x3e')],_0x38d812[_0x5f16('0x40')]));if(_0x3d2119[_0x5f16('0x3e')][_0x5f16('0x4a')]){_0x413902[_0x5f16('0x48')]=_[_0x5f16('0x4b')](_0x413902[_0x5f16('0x48')],{'$or':_[_0x5f16('0x39')](_0x413902[_0x5f16('0x43')],function(_0x5a1583){var _0x2bb41a={};_0x2bb41a[_0x5a1583]={'$like':'%'+_0x3d2119[_0x5f16('0x3e')][_0x5f16('0x4a')]+'%'};return _0x2bb41a;})});}_0x413902=_[_0x5f16('0x4b')]({},_0x413902,_0x3d2119['options']);return _0x4c4f8c[_0x5f16('0x5c')](_0x413902);}})['then'](function(_0x1bfc5d){if(_0x1bfc5d){_0x5ba908=_0x1bfc5d['length'];if(!_0x3d2119[_0x5f16('0x3e')][_0x5f16('0x45')]('nolimit')){_0x413902[_0x5f16('0x32')]=qs[_0x5f16('0x32')](_0x3d2119[_0x5f16('0x3e')][_0x5f16('0x32')]);_0x413902[_0x5f16('0x31')]=qs['offset'](_0x3d2119[_0x5f16('0x3e')]['offset']);}return _0x4c4f8c['getConfigurations'](_0x413902);}})[_0x5f16('0x21')](function(_0x4d6bd7){if(_0x4d6bd7){return _0x4d6bd7?{'count':_0x5ba908,'rows':_0x4d6bd7}:null;}})[_0x5f16('0x21')](respondWithResult(_0x27255e,null))[_0x5f16('0x54')](handleError(_0x27255e,null));};exports[_0x5f16('0x5d')]=function(_0x23018f,_0x3f64bf,_0x299286){if(_0x23018f['body']['id']){delete _0x23018f['body']['id'];}return db[_0x5f16('0x3a')][_0x5f16('0x59')]({'where':{'id':_0x23018f[_0x5f16('0x50')]['id']}})[_0x5f16('0x21')](handleEntityNotFound(_0x3f64bf,null))[_0x5f16('0x21')](function(_0x7c8e6b){if(_0x7c8e6b){_0x23018f[_0x5f16('0x56')][_0x5f16('0x5e')]=_0x7c8e6b['id'];_0x23018f[_0x5f16('0x56')][_0x5f16('0x5f')]=integrations[_0x5f16('0x60')](_0x23018f[_0x5f16('0x56')][_0x5f16('0x61')],_0x23018f[_0x5f16('0x56')][_0x5f16('0x3d')]);_0x23018f[_0x5f16('0x56')][_0x5f16('0x62')]=integrations[_0x5f16('0x63')](_0x23018f[_0x5f16('0x56')]['channel'],_0x23018f['body'][_0x5f16('0x3d')]);return db[_0x5f16('0x5a')][_0x5f16('0x55')](_0x23018f['body'],{'include':[{'model':db[_0x5f16('0x64')],'as':_0x5f16('0x5f')},{'model':db['Dynamics365Field'],'as':_0x5f16('0x62')}]});}return null;})[_0x5f16('0x21')](respondWithResult(_0x3f64bf,null))[_0x5f16('0x54')](handleError(_0x3f64bf,null));};exports[_0x5f16('0x65')]=function(_0x445094,_0xc7beac,_0x20b2f0){var _0xde49cb=_0x445094[_0x5f16('0x3e')][_0x5f16('0x66')];var _0x4248f0=_0xde49cb===_0x5f16('0x67')?_0x5f16('0x68'):_0x5f16('0x69');var _0x32e4f1='';var _0x2769f3='';var _0x7b0aee='';var _0x424943='';var _0x45bb3a='';var _0x499fd5='';var _0x1bfd9c='';var _0x3622f1='';var _0x149578=[_0x5f16('0x6a'),_0x5f16('0x6b'),'customerid',_0x5f16('0x6c'),'caseorigincode',_0x5f16('0x6d'),'phonenumber',_0x5f16('0x6e'),_0x5f16('0x6f'),_0x5f16('0x70')];var _0x39e825=[_0x5f16('0x71'),_0x5f16('0x72'),_0x5f16('0x73'),'billedserviceunits','contactidname','contactidyominame',_0x5f16('0x74'),'contractidname',_0x5f16('0x75'),_0x5f16('0x76'),'createdbyname',_0x5f16('0x77'),_0x5f16('0x78'),'createdonbehalfbyname',_0x5f16('0x79'),_0x5f16('0x7a'),_0x5f16('0x7b'),_0x5f16('0x7c'),'emailaddress',_0x5f16('0x7d'),_0x5f16('0x7e'),'entityimage_url',_0x5f16('0x7f'),_0x5f16('0x80'),'firstresponsebykpiidname',_0x5f16('0x81'),_0x5f16('0x82'),'influencescore',_0x5f16('0x83'),_0x5f16('0x84'),_0x5f16('0x85'),'modifiedbyexternalpartyname',_0x5f16('0x86'),_0x5f16('0x87'),_0x5f16('0x88'),_0x5f16('0x89'),_0x5f16('0x8a'),_0x5f16('0x8b'),_0x5f16('0x8c'),_0x5f16('0x8d'),'numberofchildincidents',_0x5f16('0x8e'),'overriddencreatedon',_0x5f16('0x8f'),_0x5f16('0x90'),_0x5f16('0x91'),'parentcaseidname',_0x5f16('0x92'),_0x5f16('0x93'),_0x5f16('0x94'),'productidname','productserialnumber','resolveby',_0x5f16('0x95'),_0x5f16('0x96'),_0x5f16('0x97'),'responsiblecontactidyominame',_0x5f16('0x98'),_0x5f16('0x99'),_0x5f16('0x9a'),_0x5f16('0x9b'),_0x5f16('0x9c'),_0x5f16('0x9d'),_0x5f16('0x9e'),_0x5f16('0x9f'),_0x5f16('0xa0'),_0x5f16('0xa1'),_0x5f16('0xa2'),_0x5f16('0xa3'),_0x5f16('0xa4')];var _0x568d7d=_0x149578['concat'](_0x39e825);return db['Dynamics365Account'][_0x5f16('0x59')]({'where':{'id':_0x445094['params']['id']},'attributes':['id',_0x5f16('0xa5'),_0x5f16('0xa6'),_0x5f16('0xa7'),_0x5f16('0xa8'),'clientId',_0x5f16('0xa9')]})['then'](handleEntityNotFound(_0xc7beac,null))[_0x5f16('0x21')](function(_0x130a51){if(_0x130a51){_0x3622f1=_0x130a51['remoteUri'];var _0x261fa4=_0x3622f1[_0x5f16('0xaa')](-0x1);if(_0x261fa4==='/'){_0x3622f1=_0x3622f1[_0x5f16('0xab')](0x0,_0x3622f1[_0x5f16('0xac')](_0x261fa4));}_0x1bfd9c=util[_0x5f16('0xad')](_0x5f16('0xae'),_0x3622f1);var _0x5e76a0={'method':_0x5f16('0xaf'),'uri':_0x5f16('0xb0')+_0x130a51[_0x5f16('0xa8')]+'/oauth2/token','form':{'client_id':_0x130a51[_0x5f16('0xb1')],'resource':_0x3622f1,'username':_0x130a51[_0x5f16('0xa5')],'password':_0x130a51[_0x5f16('0xa6')],'grant_type':_0x5f16('0xa6'),'client_secret':_0x130a51[_0x5f16('0xa9')]},'json':!![]};return rp(_0x5e76a0);}})[_0x5f16('0x21')](function(_0x288623){_0x499fd5=_0x288623['access_token'];var _0x2bfcf4={'method':_0x5f16('0xb2'),'uri':encodeURI(_0x1bfd9c+_0x5f16('0xb3')+_0x4248f0+'\x27'),'headers':{'Authorization':_0x5f16('0xb4')+_0x499fd5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2bfcf4);})['then'](function(_0x133231){var _0x104c75=_0x133231[_0x5f16('0xb5')][0x0];var _0xa0accf=_0x104c75[_0x5f16('0xb6')];var _0xf46379={'method':'GET','uri':_0x1bfd9c+_0x5f16('0xb7')+_0xa0accf+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x499fd5,'If-None-Match':null,'OData-Version':_0x5f16('0xb8')},'json':!![]};return rp(_0xf46379);})[_0x5f16('0x21')](function(_0xc8bd94){_0x32e4f1=_0xc8bd94;_0x2769f3=_0x32e4f1['Attributes'];_0x2769f3=_[_0x5f16('0xb9')](_0x2769f3,function(_0x58d8a4){return!_0x568d7d[_0x5f16('0xba')](_0x58d8a4[_0x5f16('0xbb')]);});var _0x1ad01a=[];var _0x21e898=[];_0x2769f3[_0x5f16('0xbc')](function(_0x16e850){if(_0x16e850[_0x5f16('0xbd')]){var _0x33f166=_0x16e850[_0x5f16('0xbd')][_0x5f16('0xab')](_0x16e850['@odata.type'][_0x5f16('0xac')]('.')+0x1);if(_0x33f166===_0x5f16('0xbe')){_0x1ad01a['push'](getSelectList(_0x1bfd9c,_0xde49cb,_0x21e898,_0x32e4f1[_0x5f16('0xb6')],_0x16e850[_0x5f16('0xb6')],_0x499fd5));}}});return Promise['all'](_0x1ad01a);})[_0x5f16('0x21')](function(_0x6a20bb){_0x7b0aee=_0x6a20bb[0x0];var _0x1f46ce=[];var _0x13c933=[];_0x2769f3[_0x5f16('0xbc')](function(_0x31c27a){if(!_[_0x5f16('0xbf')](_0x31c27a[_0x5f16('0xbd')])){var _0x434862=_0x31c27a[_0x5f16('0xbd')][_0x5f16('0xab')](_0x31c27a['@odata.type'][_0x5f16('0xac')]('.')+0x1);if(_0x434862===_0x5f16('0xc0')){_0x1f46ce[_0x5f16('0xc1')](getBooleanList(_0x1bfd9c,_0xde49cb,_0x13c933,_0x32e4f1[_0x5f16('0xb6')],_0x31c27a[_0x5f16('0xb6')],_0x499fd5));}}});return Promise[_0x5f16('0xc2')](_0x1f46ce);})[_0x5f16('0x21')](function(_0x18fe68){_0x424943=_0x18fe68[0x0];var _0x3a0766=[];var _0x30567a=[];_0x2769f3[_0x5f16('0xbc')](function(_0x230040){if(_0x230040['@odata.type']){var _0x369dd4=_0x230040[_0x5f16('0xbd')]['substring'](_0x230040['@odata.type'][_0x5f16('0xac')]('.')+0x1);if(_0x369dd4===_0x5f16('0xc3')||_0x369dd4==='DoubleAttributeMetadata'||_0x369dd4===_0x5f16('0xc4')||_0x369dd4===_0x5f16('0xc5')||_0x369dd4==='MemoAttributeMetadata'||_0x369dd4===_0x5f16('0xc6')||_0x369dd4===_0x5f16('0xc7')||_0x369dd4===_0x5f16('0xc8')||_0x369dd4===_0x5f16('0xc9')||_0x369dd4===_0x5f16('0xca')){_0x3a0766[_0x5f16('0xc1')](getInputList(_0x1bfd9c,_0xde49cb,_0x369dd4,_0x30567a,_0x32e4f1['MetadataId'],_0x230040[_0x5f16('0xb6')],_0x499fd5));}}});return Promise[_0x5f16('0xc2')](_0x3a0766);})[_0x5f16('0x21')](function(_0x1465e9){_0x45bb3a=_0x1465e9[0x0];var _0x996b8b=_0x7b0aee[_0x5f16('0xcb')](_0x424943)[_0x5f16('0xcb')](_0x45bb3a);var _0x3cf582={'count':_0x996b8b[_0x5f16('0xcc')],'rows':_0x996b8b};return _0x3cf582;})['then'](respondWithResult(_0xc7beac,null))[_0x5f16('0x54')](function(_0x209e32){var _0x1a25ec=_0x445094[_0x5f16('0x3e')][_0x5f16('0x1d')]?0x1f4:_0x209e32[_0x5f16('0xcd')]||0x1f4;logger[_0x5f16('0x27')](_0x209e32['stack']);delete _0x209e32[_0x5f16('0x37')];if(_0x1a25ec===0x191){_0x1a25ec=0x190;}_0xc7beac[_0x5f16('0x2d')](_0x1a25ec)[_0x5f16('0x38')](_0x445094[_0x5f16('0x3e')][_0x5f16('0x1d')]?{'message':_0x5f16('0xce'),'statusCode':_0x209e32[_0x5f16('0xcd')]}:_0x209e32);});};function getSelectList(_0x1f9abf,_0x265fe8,_0xc970b3,_0x5b6520,_0xdddec1,_0x14a8a2){var _0x3f3041={'method':_0x5f16('0xb2'),'uri':_0x1f9abf+_0x5f16('0xb7')+_0x5b6520+')/Attributes('+_0xdddec1+_0x5f16('0xcf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x5f16('0xb4')+_0x14a8a2,'If-None-Match':null,'OData-Version':_0x5f16('0xb8')},'json':!![]};return rp(_0x3f3041)[_0x5f16('0x21')](function(_0x5d5f68){var _0x5c78ca=[];var _0x254e04=_0x5d5f68[_0x5f16('0xd0')]['Options'];_0x254e04['forEach'](function(_0x40a788){_0x5c78ca[_0x5f16('0xc1')]({'name':_0x40a788[_0x5f16('0xd1')]['UserLocalizedLabel'][_0x5f16('0xd1')],'value':String(_0x40a788[_0x5f16('0xd2')])});});var _0x5d14a1={'id':_0x265fe8+'_'+_0x5d5f68[_0x5f16('0xbb')],'name':_0x5d5f68['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x5c78ca};_0xc970b3[_0x5f16('0xc1')](_0x5d14a1);return _0xc970b3;});}function getBooleanList(_0x49eb1c,_0x156cd7,_0x2a7bb8,_0x57fcea,_0x504e4a,_0x2d7f64){var _0x52f152={'method':'GET','uri':_0x49eb1c+_0x5f16('0xb7')+_0x57fcea+_0x5f16('0xd3')+_0x504e4a+_0x5f16('0xd4'),'headers':{'Authorization':_0x5f16('0xb4')+_0x2d7f64,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52f152)[_0x5f16('0x21')](function(_0x3d9faf){var _0x3ee52c=[];_0x3ee52c[_0x5f16('0xc1')]({'name':_0x3d9faf[_0x5f16('0xd0')][_0x5f16('0xd5')][_0x5f16('0xd1')]['UserLocalizedLabel']['Label'],'value':_0x5f16('0xd6')},{'name':_0x3d9faf[_0x5f16('0xd0')][_0x5f16('0xd7')][_0x5f16('0xd1')]['UserLocalizedLabel']['Label'],'value':_0x5f16('0xd8')});var _0x529abf={'id':_0x156cd7+'_'+_0x3d9faf[_0x5f16('0xbb')],'name':_0x3d9faf[_0x5f16('0xd9')][_0x5f16('0xda')]['Label'],'custom':![],'options':_0x3ee52c};_0x2a7bb8['push'](_0x529abf);return _0x2a7bb8;});}function getInputList(_0x250ff2,_0x1eff31,_0x4b482b,_0x41f2c1,_0x2317d9,_0x27f145,_0x280a8c){var _0x279c6f={'method':_0x5f16('0xb2'),'uri':_0x250ff2+_0x5f16('0xb7')+_0x2317d9+')/Attributes('+_0x27f145+_0x5f16('0xdb')+_0x4b482b+_0x5f16('0xdc'),'headers':{'Authorization':_0x5f16('0xb4')+_0x280a8c,'If-None-Match':null,'OData-Version':_0x5f16('0xb8')},'json':!![]};return rp(_0x279c6f)[_0x5f16('0x21')](function(_0x1344c9){var _0x3aceb0={'id':_0x1eff31+'_'+_0x1344c9[_0x5f16('0xbb')],'name':_0x1344c9[_0x5f16('0xd9')]['UserLocalizedLabel']?_0x1344c9[_0x5f16('0xd9')]['UserLocalizedLabel'][_0x5f16('0xd1')]:_0x1344c9[_0x5f16('0xbb')],'custom':![],'options':[]};_0x41f2c1[_0x5f16('0xc1')](_0x3aceb0);return _0x41f2c1;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 64317a6..b4e9f82 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 _0x3971=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','int_dynamics365_accounts','lodash','util','../../config/logger','api'];(function(_0x1d767e,_0x336129){var _0x36ee38=function(_0xf19e3d){while(--_0xf19e3d){_0x1d767e['push'](_0x1d767e['shift']());}};_0x36ee38(++_0x336129);}(_0x3971,0x7a));var _0x1397=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x3971[_0x3a8dc1];return _0x4b3595;};'use strict';var _=require(_0x1397('0x0'));var util=require(_0x1397('0x1'));var logger=require(_0x1397('0x2'))(_0x1397('0x3'));var moment=require(_0x1397('0x4'));var BPromise=require(_0x1397('0x5'));var rp=require(_0x1397('0x6'));var fs=require('fs');var path=require(_0x1397('0x7'));var rimraf=require(_0x1397('0x8'));var config=require(_0x1397('0x9'));var attributes=require(_0x1397('0xa'));var integrations=require(_0x1397('0xb'));module[_0x1397('0xc')]=function(_0x1f73b8,_0xe37953){return _0x1f73b8['define']('Dynamics365Account',attributes,{'tableName':_0x1397('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc76=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_dynamics365_accounts','../../config/logger','moment','bluebird'];(function(_0x2be03a,_0x2cbb1f){var _0x56faaf=function(_0x205bea){while(--_0x205bea){_0x2be03a['push'](_0x2be03a['shift']());}};_0x56faaf(++_0x2cbb1f);}(_0xdc76,0x1ec));var _0x6dc7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdc76[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6dc7('0x0'))('api');var moment=require(_0x6dc7('0x1'));var BPromise=require(_0x6dc7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6dc7('0x3'));var rimraf=require(_0x6dc7('0x4'));var config=require(_0x6dc7('0x5'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x6dc7('0x6'));module['exports']=function(_0x1ca254,_0x5aced0){return _0x1ca254[_0x6dc7('0x7')]('Dynamics365Account',attributes,{'tableName':_0x6dc7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2565dc8..7a8ee30 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 _0x5c91=['include','map','model','debug','stringify','ShowDynamics365Account','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x5c91,0x1e9));var _0x15c9=function(_0x5eed63,_0x433df4){_0x5eed63=_0x5eed63-0x0;var _0x529db8=_0x5c91[_0x5eed63];return _0x529db8;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bcb6,_0x2c213e,_0x51a779){return new BPromise(function(_0x191695,_0x114775){return client[_0x15c9('0xc')](_0x42bcb6,_0x51a779)['then'](function(_0x23adaf){logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,'request\x20sent');logger['debug'](_0x15c9('0xf'),_0x2c213e,_0x15c9('0x10'),JSON['stringify'](_0x23adaf));if(_0x23adaf['error']){if(_0x23adaf['error'][_0x15c9('0x11')]===0x1f4){logger[_0x15c9('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2c213e,_0x23adaf[_0x15c9('0x12')][_0x15c9('0x13')]);return _0x114775(_0x23adaf[_0x15c9('0x12')]['message']);}logger['error'](_0x15c9('0xe'),_0x2c213e,_0x23adaf[_0x15c9('0x12')]['message']);return _0x191695(_0x23adaf[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,_0x15c9('0x10'));_0x191695(_0x23adaf[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x5eb50e){logger[_0x15c9('0x12')](_0x15c9('0xe'),_0x2c213e,_0x5eb50e);_0x114775(_0x5eb50e);});});}exports[_0x15c9('0x16')]=function(_0x449f20){var _0x2390a4=this;return new Promise(function(_0x2d36e5,_0x1c4b1a){return db[_0x15c9('0x17')]['findAll']({'raw':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1a')]||null:null,'attributes':_0x449f20[_0x15c9('0x18')]?_0x449f20['options'][_0x15c9('0x1b')]||null:null,'limit':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1c')]||null:null,'include':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')],function(_0x499ae2){return{'model':db[_0x499ae2[_0x15c9('0x1f')]],'as':_0x499ae2['as'],'attributes':_0x499ae2['attributes'],'include':_0x499ae2[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x499ae2['include'],function(_0x229ae9){return{'model':db[_0x229ae9[_0x15c9('0x1f')]],'as':_0x229ae9['as'],'attributes':_0x229ae9[_0x15c9('0x1b')],'include':_0x229ae9['include']?_['map'](_0x229ae9[_0x15c9('0x1d')],function(_0x3f372b){return{'model':db[_0x3f372b[_0x15c9('0x1f')]],'as':_0x3f372b['as'],'attributes':_0x3f372b[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12f6ed){logger[_0x15c9('0xd')](_0x15c9('0x16'),_0x449f20);logger[_0x15c9('0x20')](_0x15c9('0x16'),_0x449f20,JSON[_0x15c9('0x21')](_0x12f6ed));_0x2d36e5(_0x12f6ed);})[_0x15c9('0x15')](function(_0x86fd2e){logger['error'](_0x15c9('0x16'),_0x86fd2e[_0x15c9('0x13')],_0x449f20);_0x1c4b1a(_0x2390a4[_0x15c9('0x12')](0x1f4,_0x86fd2e[_0x15c9('0x13')]));});});};exports[_0x15c9('0x22')]=function(_0x201e8b){var _0x411357=this;return new Promise(function(_0x7cf151,_0x32aba4){return db[_0x15c9('0x17')][_0x15c9('0x23')]({'raw':_0x201e8b[_0x15c9('0x18')]?_0x201e8b['options'][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')]['where']||null:null,'attributes':_0x201e8b[_0x15c9('0x18')]?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1b')]||null:null,'include':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1d')]?_['map'](_0x201e8b['options'][_0x15c9('0x1d')],function(_0x1c0ad4){return{'model':db[_0x1c0ad4['model']],'as':_0x1c0ad4['as'],'attributes':_0x1c0ad4[_0x15c9('0x1b')],'include':_0x1c0ad4[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x1c0ad4[_0x15c9('0x1d')],function(_0x12649d){return{'model':db[_0x12649d[_0x15c9('0x1f')]],'as':_0x12649d['as'],'attributes':_0x12649d['attributes'],'include':_0x12649d[_0x15c9('0x1d')]?_['map'](_0x12649d[_0x15c9('0x1d')],function(_0x2cddaf){return{'model':db[_0x2cddaf['model']],'as':_0x2cddaf['as'],'attributes':_0x2cddaf[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x15c9('0x24')](function(_0x58e57e){logger[_0x15c9('0xd')](_0x15c9('0x22'),_0x201e8b);logger['debug']('ShowDynamics365Account',_0x201e8b,JSON[_0x15c9('0x21')](_0x58e57e));_0x7cf151(_0x58e57e);})[_0x15c9('0x15')](function(_0x4a81d5){logger['error']('ShowDynamics365Account',_0x4a81d5[_0x15c9('0x13')],_0x201e8b);_0x32aba4(_0x411357[_0x15c9('0x12')](0x1f4,_0x4a81d5['message']));});});}; \ No newline at end of file +var _0xf966=['Dynamics365Account','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','options','where','attributes','limit','include','model','map','GetDynamics365Account','ShowDynamics365Account'];(function(_0x31d1bb,_0x42a2f7){var _0x4b6582=function(_0x38ba3e){while(--_0x38ba3e){_0x31d1bb['push'](_0x31d1bb['shift']());}};_0x4b6582(++_0x42a2f7);}(_0xf966,0x184));var _0x6f96=function(_0x565b51,_0xa8503c){_0x565b51=_0x565b51-0x0;var _0x8eb1b9=_0xf966[_0x565b51];return _0x8eb1b9;};'use strict';var _=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var moment=require(_0x6f96('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f96('0x3'));var fs=require('fs');var Redis=require(_0x6f96('0x4'));var db=require(_0x6f96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f96('0x6'))(_0x6f96('0x7'));var config=require(_0x6f96('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f96('0x9')][_0x6f96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x652db3,_0x749c71,_0x2e62e6){return new BPromise(function(_0x663c1f,_0x3918eb){return client[_0x6f96('0xb')](_0x652db3,_0x2e62e6)[_0x6f96('0xc')](function(_0x447a46){logger[_0x6f96('0xd')](_0x6f96('0xe'),_0x749c71,_0x6f96('0xf'));logger[_0x6f96('0x10')](_0x6f96('0x11'),_0x749c71,'request\x20sent',JSON[_0x6f96('0x12')](_0x447a46));if(_0x447a46['error']){if(_0x447a46['error'][_0x6f96('0x13')]===0x1f4){logger[_0x6f96('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x749c71,_0x447a46[_0x6f96('0x14')][_0x6f96('0x15')]);return _0x3918eb(_0x447a46[_0x6f96('0x14')][_0x6f96('0x15')]);}logger[_0x6f96('0x14')](_0x6f96('0xe'),_0x749c71,_0x447a46[_0x6f96('0x14')][_0x6f96('0x15')]);return _0x663c1f(_0x447a46['error'][_0x6f96('0x15')]);}else{logger[_0x6f96('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x749c71,_0x6f96('0xf'));_0x663c1f(_0x447a46[_0x6f96('0x16')]['message']);}})['catch'](function(_0x2cb315){logger[_0x6f96('0x14')](_0x6f96('0xe'),_0x749c71,_0x2cb315);_0x3918eb(_0x2cb315);});});}exports['GetDynamics365Account']=function(_0x421e59){var _0x48c4d5=this;return new Promise(function(_0x19cd18,_0x330d55){return db['Dynamics365Account']['findAll']({'raw':_0x421e59[_0x6f96('0x17')]?_0x421e59[_0x6f96('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x421e59[_0x6f96('0x17')]?_0x421e59['options'][_0x6f96('0x18')]||null:null,'attributes':_0x421e59[_0x6f96('0x17')]?_0x421e59[_0x6f96('0x17')][_0x6f96('0x19')]||null:null,'limit':_0x421e59[_0x6f96('0x17')]?_0x421e59['options'][_0x6f96('0x1a')]||null:null,'include':_0x421e59['options']?_0x421e59[_0x6f96('0x17')][_0x6f96('0x1b')]?_['map'](_0x421e59[_0x6f96('0x17')]['include'],function(_0x280a55){return{'model':db[_0x280a55[_0x6f96('0x1c')]],'as':_0x280a55['as'],'attributes':_0x280a55[_0x6f96('0x19')],'include':_0x280a55[_0x6f96('0x1b')]?_[_0x6f96('0x1d')](_0x280a55[_0x6f96('0x1b')],function(_0x475ee9){return{'model':db[_0x475ee9[_0x6f96('0x1c')]],'as':_0x475ee9['as'],'attributes':_0x475ee9[_0x6f96('0x19')],'include':_0x475ee9['include']?_[_0x6f96('0x1d')](_0x475ee9[_0x6f96('0x1b')],function(_0x38922d){return{'model':db[_0x38922d[_0x6f96('0x1c')]],'as':_0x38922d['as'],'attributes':_0x38922d[_0x6f96('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f96('0xc')](function(_0x490c5b){logger['info']('GetDynamics365Account',_0x421e59);logger[_0x6f96('0x10')](_0x6f96('0x1e'),_0x421e59,JSON[_0x6f96('0x12')](_0x490c5b));_0x19cd18(_0x490c5b);})['catch'](function(_0x19941b){logger[_0x6f96('0x14')](_0x6f96('0x1e'),_0x19941b[_0x6f96('0x15')],_0x421e59);_0x330d55(_0x48c4d5[_0x6f96('0x14')](0x1f4,_0x19941b['message']));});});};exports[_0x6f96('0x1f')]=function(_0xa25290){var _0x5b9284=this;return new Promise(function(_0xf7e1ff,_0x29fa27){return db[_0x6f96('0x20')][_0x6f96('0x21')]({'raw':_0xa25290[_0x6f96('0x17')]?_0xa25290[_0x6f96('0x17')][_0x6f96('0x22')]===undefined?!![]:![]:!![],'where':_0xa25290[_0x6f96('0x17')]?_0xa25290['options'][_0x6f96('0x18')]||null:null,'attributes':_0xa25290[_0x6f96('0x17')]?_0xa25290[_0x6f96('0x17')][_0x6f96('0x19')]||null:null,'include':_0xa25290[_0x6f96('0x17')]?_0xa25290[_0x6f96('0x17')]['include']?_[_0x6f96('0x1d')](_0xa25290[_0x6f96('0x17')][_0x6f96('0x1b')],function(_0x31207a){return{'model':db[_0x31207a[_0x6f96('0x1c')]],'as':_0x31207a['as'],'attributes':_0x31207a[_0x6f96('0x19')],'include':_0x31207a['include']?_[_0x6f96('0x1d')](_0x31207a['include'],function(_0x1a390f){return{'model':db[_0x1a390f[_0x6f96('0x1c')]],'as':_0x1a390f['as'],'attributes':_0x1a390f['attributes'],'include':_0x1a390f[_0x6f96('0x1b')]?_['map'](_0x1a390f[_0x6f96('0x1b')],function(_0x28624c){return{'model':db[_0x28624c[_0x6f96('0x1c')]],'as':_0x28624c['as'],'attributes':_0x28624c[_0x6f96('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f96('0xc')](function(_0x3352e9){logger['info']('ShowDynamics365Account',_0xa25290);logger[_0x6f96('0x10')]('ShowDynamics365Account',_0xa25290,JSON[_0x6f96('0x12')](_0x3352e9));_0xf7e1ff(_0x3352e9);})['catch'](function(_0x3e0b67){logger[_0x6f96('0x14')](_0x6f96('0x1f'),_0x3e0b67[_0x6f96('0x15')],_0xa25290);_0x29fa27(_0x5b9284[_0x6f96('0x14')](0x1f4,_0x3e0b67[_0x6f96('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f85a87b..d460787 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 _0xe8d5=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40c329,_0x553cb8){var _0x2a7841=function(_0x4fb764){while(--_0x4fb764){_0x40c329['push'](_0x40c329['shift']());}};_0x2a7841(++_0x553cb8);}(_0xe8d5,0x130));var _0x5e8d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xe8d5[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x5e8d('0x0'));var util=require('util');var path=require(_0x5e8d('0x1'));var timeout=require(_0x5e8d('0x2'));var express=require(_0x5e8d('0x3'));var router=express[_0x5e8d('0x4')]();var auth=require(_0x5e8d('0x5'));var interaction=require(_0x5e8d('0x6'));var config=require(_0x5e8d('0x7'));var controller=require(_0x5e8d('0x8'));router[_0x5e8d('0x9')]('/',auth[_0x5e8d('0xa')](),controller[_0x5e8d('0xb')]);router[_0x5e8d('0x9')](_0x5e8d('0xc'),auth['isAuthenticated'](),controller[_0x5e8d('0xd')]);router[_0x5e8d('0x9')](_0x5e8d('0xe'),auth[_0x5e8d('0xa')](),controller[_0x5e8d('0xf')]);router[_0x5e8d('0x9')](_0x5e8d('0x10'),auth[_0x5e8d('0xa')](),controller[_0x5e8d('0x11')]);router[_0x5e8d('0x9')](_0x5e8d('0x12'),auth[_0x5e8d('0xa')](),controller[_0x5e8d('0x13')]);router[_0x5e8d('0x14')]('/',auth['isAuthenticated'](),controller[_0x5e8d('0x15')]);router[_0x5e8d('0x16')](_0x5e8d('0xc'),auth['isAuthenticated'](),controller[_0x5e8d('0x17')]);router['delete'](_0x5e8d('0xc'),auth[_0x5e8d('0xa')](),controller[_0x5e8d('0x18')]);module[_0x5e8d('0x19')]=router; \ No newline at end of file +var _0xcf9a=['../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46f800,_0x404d02){var _0x230e63=function(_0x3a5dfd){while(--_0x3a5dfd){_0x46f800['push'](_0x46f800['shift']());}};_0x230e63(++_0x404d02);}(_0xcf9a,0x19e));var _0xacf9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf9a[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0xacf9('0x0'));var path=require(_0xacf9('0x1'));var timeout=require('connect-timeout');var express=require(_0xacf9('0x2'));var router=express[_0xacf9('0x3')]();var auth=require(_0xacf9('0x4'));var interaction=require(_0xacf9('0x5'));var config=require(_0xacf9('0x6'));var controller=require(_0xacf9('0x7'));router['get']('/',auth[_0xacf9('0x8')](),controller[_0xacf9('0x9')]);router['get'](_0xacf9('0xa'),auth[_0xacf9('0x8')](),controller[_0xacf9('0xb')]);router[_0xacf9('0xc')]('/:id/fields',auth[_0xacf9('0x8')](),controller[_0xacf9('0xd')]);router[_0xacf9('0xc')]('/:id/subjects',auth[_0xacf9('0x8')](),controller[_0xacf9('0xe')]);router[_0xacf9('0xc')](_0xacf9('0xf'),auth[_0xacf9('0x8')](),controller[_0xacf9('0x10')]);router['post']('/',auth[_0xacf9('0x8')](),controller[_0xacf9('0x11')]);router[_0xacf9('0x12')](_0xacf9('0xa'),auth[_0xacf9('0x8')](),controller['update']);router['delete']('/:id',auth[_0xacf9('0x8')](),controller[_0xacf9('0x13')]);module[_0xacf9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a69deba..45c2422 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 _0x450b=['exports','STRING','incident','phonecall','sequelize'];(function(_0xcd61b9,_0x3db343){var _0xdf743e=function(_0x30f4a1){while(--_0x30f4a1){_0xcd61b9['push'](_0xcd61b9['shift']());}};_0xdf743e(++_0x3db343);}(_0x450b,0x15d));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb450('0x0'));module[_0xb450('0x1')]={'name':{'type':Sequelize[_0xb450('0x2')]},'description':{'type':Sequelize[_0xb450('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xb450('0x3'),_0xb450('0x4')),'defaultValue':_0xb450('0x3')}}; \ No newline at end of file +var _0x79e2=['phonecall','incident','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x79e2,0x65));var _0x279e=function(_0xbc3e0c,_0x29be9b){_0xbc3e0c=_0xbc3e0c-0x0;var _0x5a25af=_0x79e2[_0xbc3e0c];return _0x5a25af;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x279e('0x0')]('incident',_0x279e('0x1')),'defaultValue':_0x279e('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3d6e97e..2a42ef0 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 _0x0123=['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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','count','offset','limit','set','Content-Range','apply','update','destroy','name','send','index','map','Dynamics365Configuration','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','body','getFields','findOne','Dynamics365Field','rawAttributes','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','test'];(function(_0x1dfb94,_0x566293){var _0x3d0027=function(_0x585563){while(--_0x585563){_0x1dfb94['push'](_0x1dfb94['shift']());}};_0x3d0027(++_0x566293);}(_0x0123,0xf0));var _0x3012=function(_0x23c681,_0x2f28bc){_0x23c681=_0x23c681-0x0;var _0x2bdfe9=_0x0123[_0x23c681];return _0x2bdfe9;};'use strict';var pdf=require(_0x3012('0x0'));var emlformat=require(_0x3012('0x1'));var rimraf=require(_0x3012('0x2'));var zipdir=require(_0x3012('0x3'));var jsonpatch=require(_0x3012('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3012('0x5'));var Mustache=require(_0x3012('0x6'));var util=require(_0x3012('0x7'));var path=require(_0x3012('0x8'));var sox=require(_0x3012('0x9'));var csv=require(_0x3012('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3012('0xb'));var squel=require(_0x3012('0xc'));var crypto=require(_0x3012('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3012('0xe'));var toCsv=require(_0x3012('0xa'));var querystring=require('querystring');var Papa=require(_0x3012('0xf'));var Redis=require(_0x3012('0x10'));var authService=require(_0x3012('0x11'));var qs=require(_0x3012('0x12'));var as=require(_0x3012('0x13'));var hardwareService=require(_0x3012('0x14'));var logger=require(_0x3012('0x15'))(_0x3012('0x16'));var utils=require('../../config/utils');var config=require(_0x3012('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3012('0x18'));var client=jayson[_0x3012('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x353f1b,_0x4c031e,_0x4d5014){if(_0x4d5014){var _0x1272ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1272ad[_0x3012('0x1a')](_0x4c031e)){return _0x353f1b;}else{throw new db[(_0x3012('0x1b'))]['ValidationError'](_0x3012('0x1c'));}}else{return _0x353f1b;}}function respondWithRpcPromise(_0x501f91,_0x46260d,_0x2619d5,_0x37434b){return new BPromise(function(_0x5689b6,_0x45611f){var _0x53f1a2=_0x37434b||client;return _0x53f1a2['request'](_0x501f91,_0x2619d5)[_0x3012('0x1d')](function(_0x1fed5e){logger[_0x3012('0x1e')](_0x3012('0x1f'),_0x46260d,_0x3012('0x20'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x46260d,_0x3012('0x20'),JSON[_0x3012('0x21')](_0x1fed5e));if(_0x1fed5e[_0x3012('0x22')]){if(_0x1fed5e[_0x3012('0x22')][_0x3012('0x23')]===0x1f4){logger[_0x3012('0x22')](_0x3012('0x1f'),_0x46260d,_0x1fed5e['error'][_0x3012('0x24')]);return _0x45611f(_0x1fed5e[_0x3012('0x22')]['message']);}logger[_0x3012('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46260d,_0x1fed5e[_0x3012('0x22')][_0x3012('0x24')]);return _0x5689b6(_0x1fed5e[_0x3012('0x22')][_0x3012('0x24')]);}else{logger[_0x3012('0x1e')](_0x3012('0x1f'),_0x46260d,_0x3012('0x20'));_0x5689b6(_0x1fed5e[_0x3012('0x25')][_0x3012('0x24')]);}})[_0x3012('0x26')](function(_0x263900){logger[_0x3012('0x22')](_0x3012('0x1f'),_0x46260d,_0x263900);_0x45611f(_0x263900);});});}function respondWithStatusCode(_0x5e4759,_0x1393c8){_0x1393c8=_0x1393c8||0xcc;return function(_0x2d2fe0){if(_0x2d2fe0){return _0x5e4759['sendStatus'](_0x1393c8);}return _0x5e4759['status'](_0x1393c8)[_0x3012('0x27')]();};}function respondWithResult(_0x2d87bc,_0x3e147f){_0x3e147f=_0x3e147f||0xc8;return function(_0x48dbee){if(_0x48dbee){return _0x2d87bc[_0x3012('0x28')](_0x3e147f)['json'](_0x48dbee);}};}function respondWithFilteredResult(_0x2124d4,_0x71e111){return function(_0x346985){if(_0x346985){var _0x437981=_0x346985[_0x3012('0x29')],_0x498af5=_0x71e111[_0x3012('0x2a')],_0x3254db=_0x71e111['offset']+_0x71e111[_0x3012('0x2b')],_0x3aaae2;if(_0x3254db>=_0x437981){_0x3254db=_0x437981;_0x3aaae2=0xc8;}else{_0x3aaae2=0xce;}_0x2124d4[_0x3012('0x28')](_0x3aaae2);return _0x2124d4[_0x3012('0x2c')](_0x3012('0x2d'),_0x498af5+'-'+_0x3254db+'/'+_0x437981)['json'](_0x346985);}return null;};}function patchUpdates(_0x3b82d2){return function(_0x5db268){try{jsonpatch[_0x3012('0x2e')](_0x5db268,_0x3b82d2,!![]);}catch(_0x3eebb4){return BPromise['reject'](_0x3eebb4);}return _0x5db268['save']();};}function saveUpdates(_0x4ef3d1,_0x4c1502){return function(_0x4f4c0d){if(_0x4f4c0d){return _0x4f4c0d[_0x3012('0x2f')](_0x4ef3d1)[_0x3012('0x1d')](function(_0x5b49a3){return _0x5b49a3;});}return null;};}function removeEntity(_0x297b92,_0x100254){return function(_0x1b41bf){if(_0x1b41bf){return _0x1b41bf[_0x3012('0x30')]()[_0x3012('0x1d')](function(){_0x297b92[_0x3012('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b9979,_0x1a0643){return function(_0x59d5d9){if(!_0x59d5d9){_0x4b9979['sendStatus'](0x194);}return _0x59d5d9;};}function handleError(_0x212c51,_0x35cc8a){_0x35cc8a=_0x35cc8a||0x1f4;return function(_0x87d86f){logger['error'](_0x87d86f['stack']);if(_0x87d86f[_0x3012('0x31')]){delete _0x87d86f[_0x3012('0x31')];}_0x212c51[_0x3012('0x28')](_0x35cc8a)[_0x3012('0x32')](_0x87d86f);};}exports[_0x3012('0x33')]=function(_0x3e3962,_0x2f8e0a){var _0x2aa3ea={},_0x42c46b={},_0x4c5ebf={'count':0x0,'rows':[]};var _0x41ae61=_[_0x3012('0x34')](db[_0x3012('0x35')]['rawAttributes'],function(_0x3fd408){return{'name':_0x3fd408[_0x3012('0x36')],'type':_0x3fd408[_0x3012('0x37')][_0x3012('0x38')]};});_0x42c46b['model']=_[_0x3012('0x34')](_0x41ae61,'name');_0x42c46b[_0x3012('0x39')]=_[_0x3012('0x3a')](_0x3e3962['query']);_0x42c46b[_0x3012('0x3b')]=_['intersection'](_0x42c46b[_0x3012('0x3c')],_0x42c46b[_0x3012('0x39')]);_0x2aa3ea['attributes']=_[_0x3012('0x3d')](_0x42c46b['model'],qs[_0x3012('0x3e')](_0x3e3962['query']['fields']));_0x2aa3ea[_0x3012('0x3f')]=_0x2aa3ea['attributes']['length']?_0x2aa3ea[_0x3012('0x3f')]:_0x42c46b[_0x3012('0x3c')];if(!_0x3e3962['query'][_0x3012('0x40')](_0x3012('0x41'))){_0x2aa3ea['limit']=qs['limit'](_0x3e3962[_0x3012('0x39')][_0x3012('0x2b')]);_0x2aa3ea[_0x3012('0x2a')]=qs[_0x3012('0x2a')](_0x3e3962[_0x3012('0x39')]['offset']);}_0x2aa3ea[_0x3012('0x42')]=qs[_0x3012('0x43')](_0x3e3962[_0x3012('0x39')][_0x3012('0x43')]);_0x2aa3ea[_0x3012('0x44')]=qs[_0x3012('0x3b')](_[_0x3012('0x45')](_0x3e3962[_0x3012('0x39')],_0x42c46b[_0x3012('0x3b')]),_0x41ae61);if(_0x3e3962['query'][_0x3012('0x46')]){_0x2aa3ea[_0x3012('0x44')]=_[_0x3012('0x47')](_0x2aa3ea[_0x3012('0x44')],{'$or':_[_0x3012('0x34')](_0x41ae61,function(_0x49da04){if(_0x49da04[_0x3012('0x37')]!==_0x3012('0x48')){var _0x175fd1={};_0x175fd1[_0x49da04[_0x3012('0x31')]]={'$like':'%'+_0x3e3962['query'][_0x3012('0x46')]+'%'};return _0x175fd1;}})});}_0x2aa3ea=_['merge']({},_0x2aa3ea,_0x3e3962[_0x3012('0x49')]);var _0x19cae7={'where':_0x2aa3ea[_0x3012('0x44')]};return db[_0x3012('0x35')][_0x3012('0x29')](_0x19cae7)[_0x3012('0x1d')](function(_0x22e687){_0x4c5ebf[_0x3012('0x29')]=_0x22e687;if(_0x3e3962[_0x3012('0x39')][_0x3012('0x4a')]){_0x2aa3ea['include']=[{'all':!![]}];}return db[_0x3012('0x35')][_0x3012('0x4b')](_0x2aa3ea);})[_0x3012('0x1d')](function(_0x399a1d){_0x4c5ebf[_0x3012('0x4c')]=_0x399a1d;return _0x4c5ebf;})[_0x3012('0x1d')](respondWithFilteredResult(_0x2f8e0a,_0x2aa3ea))[_0x3012('0x26')](handleError(_0x2f8e0a,null));};exports[_0x3012('0x4d')]=function(_0x4c8f1f,_0x634630){var _0x4d1cbf={'raw':![],'where':{'id':_0x4c8f1f[_0x3012('0x4e')]['id']}},_0x48f413={};_0x48f413[_0x3012('0x3c')]=_[_0x3012('0x3a')](db[_0x3012('0x35')]['rawAttributes']);_0x48f413[_0x3012('0x39')]=_[_0x3012('0x3a')](_0x4c8f1f[_0x3012('0x39')]);_0x48f413[_0x3012('0x3b')]=_[_0x3012('0x3d')](_0x48f413['model'],_0x48f413[_0x3012('0x39')]);_0x4d1cbf[_0x3012('0x3f')]=_['intersection'](_0x48f413[_0x3012('0x3c')],qs['fields'](_0x4c8f1f[_0x3012('0x39')]['fields']));_0x4d1cbf[_0x3012('0x3f')]=_0x4d1cbf[_0x3012('0x3f')][_0x3012('0x4f')]?_0x4d1cbf[_0x3012('0x3f')]:_0x48f413[_0x3012('0x3c')];if(_0x4c8f1f[_0x3012('0x39')][_0x3012('0x4a')]){_0x4d1cbf[_0x3012('0x50')]=[{'all':!![]}];}_0x4d1cbf=_[_0x3012('0x47')]({},_0x4d1cbf,_0x4c8f1f[_0x3012('0x49')]);return db[_0x3012('0x35')][_0x3012('0x51')](_0x4d1cbf)[_0x3012('0x1d')](handleEntityNotFound(_0x634630,null))['then'](respondWithResult(_0x634630,null))[_0x3012('0x26')](handleError(_0x634630,null));};exports['create']=function(_0x206c68,_0x2ca2b4){return db['Dynamics365Configuration']['create'](_0x206c68[_0x3012('0x52')],{})['then'](respondWithResult(_0x2ca2b4,0xc9))[_0x3012('0x26')](handleError(_0x2ca2b4,null));};exports[_0x3012('0x2f')]=function(_0x23ec73,_0x33b477){if(_0x23ec73['body']['id']){delete _0x23ec73['body']['id'];}return db[_0x3012('0x35')]['find']({'where':{'id':_0x23ec73[_0x3012('0x4e')]['id']}})[_0x3012('0x1d')](handleEntityNotFound(_0x33b477,null))[_0x3012('0x1d')](saveUpdates(_0x23ec73[_0x3012('0x52')],null))[_0x3012('0x1d')](respondWithResult(_0x33b477,null))[_0x3012('0x26')](handleError(_0x33b477,null));};exports[_0x3012('0x30')]=function(_0x24386f,_0x473c05){return db[_0x3012('0x35')][_0x3012('0x51')]({'where':{'id':_0x24386f[_0x3012('0x4e')]['id']}})['then'](handleEntityNotFound(_0x473c05,null))[_0x3012('0x1d')](removeEntity(_0x473c05,null))[_0x3012('0x26')](handleError(_0x473c05,null));};exports[_0x3012('0x53')]=function(_0x2c36b7,_0x2e73dc,_0x4955d9){var _0x1b514f={};var _0x571eab={};var _0x1fdd54;var _0x57b530;return db['Dynamics365Configuration'][_0x3012('0x54')]({'where':{'id':_0x2c36b7[_0x3012('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e73dc,null))[_0x3012('0x1d')](function(_0x3d5e33){if(_0x3d5e33){_0x1fdd54=_0x3d5e33;_0x571eab[_0x3012('0x3c')]=_['keys'](db[_0x3012('0x55')][_0x3012('0x56')]);_0x571eab['query']=_[_0x3012('0x3a')](_0x2c36b7['query']);_0x571eab[_0x3012('0x3b')]=_['intersection'](_0x571eab[_0x3012('0x3c')],_0x571eab['query']);_0x1b514f[_0x3012('0x3f')]=_[_0x3012('0x3d')](_0x571eab['model'],qs[_0x3012('0x3e')](_0x2c36b7[_0x3012('0x39')][_0x3012('0x3e')]));_0x1b514f[_0x3012('0x3f')]=_0x1b514f[_0x3012('0x3f')][_0x3012('0x4f')]?_0x1b514f[_0x3012('0x3f')]:_0x571eab[_0x3012('0x3c')];_0x1b514f[_0x3012('0x42')]=qs[_0x3012('0x43')](_0x2c36b7[_0x3012('0x39')][_0x3012('0x43')]);_0x1b514f[_0x3012('0x44')]=qs[_0x3012('0x3b')](_[_0x3012('0x45')](_0x2c36b7[_0x3012('0x39')],_0x571eab[_0x3012('0x3b')]));if(_0x2c36b7[_0x3012('0x39')]['filter']){_0x1b514f[_0x3012('0x44')]=_[_0x3012('0x47')](_0x1b514f[_0x3012('0x44')],{'$or':_['map'](_0x1b514f[_0x3012('0x3f')],function(_0x580ea5){var _0x172dd4={};_0x172dd4[_0x580ea5]={'$like':'%'+_0x2c36b7['query'][_0x3012('0x46')]+'%'};return _0x172dd4;})});}_0x1b514f=_['merge']({},_0x1b514f,_0x2c36b7[_0x3012('0x49')]);return _0x1fdd54['getFields'](_0x1b514f);}})[_0x3012('0x1d')](function(_0x1f8769){if(_0x1f8769){_0x57b530=_0x1f8769[_0x3012('0x4f')];if(!_0x2c36b7[_0x3012('0x39')][_0x3012('0x40')](_0x3012('0x41'))){_0x1b514f[_0x3012('0x2b')]=qs[_0x3012('0x2b')](_0x2c36b7['query']['limit']);_0x1b514f[_0x3012('0x2a')]=qs[_0x3012('0x2a')](_0x2c36b7[_0x3012('0x39')]['offset']);}return _0x1fdd54[_0x3012('0x53')](_0x1b514f);}})[_0x3012('0x1d')](function(_0x5d5c05){if(_0x5d5c05){return _0x5d5c05?{'count':_0x57b530,'rows':_0x5d5c05}:null;}})[_0x3012('0x1d')](respondWithResult(_0x2e73dc,null))['catch'](handleError(_0x2e73dc,null));};exports[_0x3012('0x57')]=function(_0x4f223a,_0x1f068d,_0x586d3c){var _0x5703a3={};var _0x5f3c4d={};var _0x1e258d;var _0x58d216;return db[_0x3012('0x35')][_0x3012('0x54')]({'where':{'id':_0x4f223a[_0x3012('0x4e')]['id']}})[_0x3012('0x1d')](handleEntityNotFound(_0x1f068d,null))[_0x3012('0x1d')](function(_0x880a45){if(_0x880a45){_0x1e258d=_0x880a45;_0x5f3c4d['model']=_[_0x3012('0x3a')](db[_0x3012('0x55')][_0x3012('0x56')]);_0x5f3c4d[_0x3012('0x39')]=_[_0x3012('0x3a')](_0x4f223a[_0x3012('0x39')]);_0x5f3c4d[_0x3012('0x3b')]=_['intersection'](_0x5f3c4d['model'],_0x5f3c4d['query']);_0x5703a3[_0x3012('0x3f')]=_[_0x3012('0x3d')](_0x5f3c4d[_0x3012('0x3c')],qs[_0x3012('0x3e')](_0x4f223a[_0x3012('0x39')][_0x3012('0x3e')]));_0x5703a3[_0x3012('0x3f')]=_0x5703a3[_0x3012('0x3f')][_0x3012('0x4f')]?_0x5703a3[_0x3012('0x3f')]:_0x5f3c4d['model'];_0x5703a3[_0x3012('0x42')]=qs['sort'](_0x4f223a[_0x3012('0x39')][_0x3012('0x43')]);_0x5703a3[_0x3012('0x44')]=qs['filters'](_['pick'](_0x4f223a['query'],_0x5f3c4d[_0x3012('0x3b')]));if(_0x4f223a[_0x3012('0x39')][_0x3012('0x46')]){_0x5703a3[_0x3012('0x44')]=_[_0x3012('0x47')](_0x5703a3[_0x3012('0x44')],{'$or':_['map'](_0x5703a3[_0x3012('0x3f')],function(_0x5ea8e9){var _0x464762={};_0x464762[_0x5ea8e9]={'$like':'%'+_0x4f223a[_0x3012('0x39')][_0x3012('0x46')]+'%'};return _0x464762;})});}_0x5703a3=_[_0x3012('0x47')]({},_0x5703a3,_0x4f223a[_0x3012('0x49')]);return _0x1e258d['getSubjects'](_0x5703a3);}})[_0x3012('0x1d')](function(_0x42415b){if(_0x42415b){_0x58d216=_0x42415b[_0x3012('0x4f')];if(!_0x4f223a[_0x3012('0x39')][_0x3012('0x40')](_0x3012('0x41'))){_0x5703a3[_0x3012('0x2b')]=qs[_0x3012('0x2b')](_0x4f223a[_0x3012('0x39')][_0x3012('0x2b')]);_0x5703a3[_0x3012('0x2a')]=qs[_0x3012('0x2a')](_0x4f223a[_0x3012('0x39')][_0x3012('0x2a')]);}return _0x1e258d[_0x3012('0x57')](_0x5703a3);}})[_0x3012('0x1d')](function(_0x76e9e9){if(_0x76e9e9){return _0x76e9e9?{'count':_0x58d216,'rows':_0x76e9e9}:null;}})[_0x3012('0x1d')](respondWithResult(_0x1f068d,null))[_0x3012('0x26')](handleError(_0x1f068d,null));};exports[_0x3012('0x58')]=function(_0x6d53b3,_0x4d38d9,_0x4627c4){var _0x2f19e2={};var _0xba8453={};var _0x51d0e2;var _0x480d94;return db[_0x3012('0x35')][_0x3012('0x54')]({'where':{'id':_0x6d53b3['params']['id']}})[_0x3012('0x1d')](handleEntityNotFound(_0x4d38d9,null))[_0x3012('0x1d')](function(_0x28f8b8){if(_0x28f8b8){_0x51d0e2=_0x28f8b8;_0xba8453[_0x3012('0x3c')]=_[_0x3012('0x3a')](db[_0x3012('0x55')][_0x3012('0x56')]);_0xba8453['query']=_[_0x3012('0x3a')](_0x6d53b3[_0x3012('0x39')]);_0xba8453['filters']=_[_0x3012('0x3d')](_0xba8453['model'],_0xba8453[_0x3012('0x39')]);_0x2f19e2[_0x3012('0x3f')]=_[_0x3012('0x3d')](_0xba8453[_0x3012('0x3c')],qs[_0x3012('0x3e')](_0x6d53b3[_0x3012('0x39')][_0x3012('0x3e')]));_0x2f19e2[_0x3012('0x3f')]=_0x2f19e2[_0x3012('0x3f')][_0x3012('0x4f')]?_0x2f19e2['attributes']:_0xba8453[_0x3012('0x3c')];_0x2f19e2[_0x3012('0x42')]=qs[_0x3012('0x43')](_0x6d53b3[_0x3012('0x39')][_0x3012('0x43')]);_0x2f19e2[_0x3012('0x44')]=qs[_0x3012('0x3b')](_[_0x3012('0x45')](_0x6d53b3[_0x3012('0x39')],_0xba8453[_0x3012('0x3b')]));if(_0x6d53b3['query'][_0x3012('0x46')]){_0x2f19e2['where']=_[_0x3012('0x47')](_0x2f19e2[_0x3012('0x44')],{'$or':_[_0x3012('0x34')](_0x2f19e2[_0x3012('0x3f')],function(_0x55654f){var _0x423fce={};_0x423fce[_0x55654f]={'$like':'%'+_0x6d53b3[_0x3012('0x39')]['filter']+'%'};return _0x423fce;})});}_0x2f19e2=_[_0x3012('0x47')]({},_0x2f19e2,_0x6d53b3[_0x3012('0x49')]);return _0x51d0e2[_0x3012('0x58')](_0x2f19e2);}})['then'](function(_0x2f6152){if(_0x2f6152){_0x480d94=_0x2f6152['length'];if(!_0x6d53b3[_0x3012('0x39')][_0x3012('0x40')](_0x3012('0x41'))){_0x2f19e2[_0x3012('0x2b')]=qs['limit'](_0x6d53b3[_0x3012('0x39')][_0x3012('0x2b')]);_0x2f19e2[_0x3012('0x2a')]=qs[_0x3012('0x2a')](_0x6d53b3[_0x3012('0x39')][_0x3012('0x2a')]);}return _0x51d0e2['getDescriptions'](_0x2f19e2);}})[_0x3012('0x1d')](function(_0x1e7484){if(_0x1e7484){return _0x1e7484?{'count':_0x480d94,'rows':_0x1e7484}:null;}})[_0x3012('0x1d')](respondWithResult(_0x4d38d9,null))[_0x3012('0x26')](handleError(_0x4d38d9,null));}; \ No newline at end of file +var _0x7f0b=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x43bc5e,_0x230803){var _0x2aed64=function(_0x1a123d){while(--_0x1a123d){_0x43bc5e['push'](_0x43bc5e['shift']());}};_0x2aed64(++_0x230803);}(_0x7f0b,0xab));var _0xb7f0=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x7f0b[_0xe66cf2];return _0x2d84e7;};'use strict';var pdf=require(_0xb7f0('0x0'));var emlformat=require(_0xb7f0('0x1'));var rimraf=require(_0xb7f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7f0('0x3'));var rp=require('request-promise');var moment=require(_0xb7f0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7f0('0x5'));var util=require(_0xb7f0('0x6'));var path=require(_0xb7f0('0x7'));var sox=require(_0xb7f0('0x8'));var csv=require('to-csv');var ejs=require(_0xb7f0('0x9'));var fs=require('fs');var _=require(_0xb7f0('0xa'));var squel=require(_0xb7f0('0xb'));var crypto=require(_0xb7f0('0xc'));var jsforce=require(_0xb7f0('0xd'));var deskjs=require(_0xb7f0('0xe'));var toCsv=require(_0xb7f0('0xf'));var querystring=require(_0xb7f0('0x10'));var Papa=require(_0xb7f0('0x11'));var Redis=require(_0xb7f0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb7f0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7f0('0x14'));var logger=require(_0xb7f0('0x15'))(_0xb7f0('0x16'));var utils=require(_0xb7f0('0x17'));var config=require(_0xb7f0('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb7f0('0x19'));var client=jayson['client'][_0xb7f0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2518e4,_0x3fad23,_0x18fb53){if(_0x18fb53){var _0x446525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x446525[_0xb7f0('0x1b')](_0x3fad23)){return _0x2518e4;}else{throw new db[(_0xb7f0('0x1c'))]['ValidationError'](_0xb7f0('0x1d'));}}else{return _0x2518e4;}}function respondWithRpcPromise(_0x52e864,_0x1dcfc2,_0x257efc,_0x487805){return new BPromise(function(_0x1fc2b5,_0x558e85){var _0x2cfefc=_0x487805||client;return _0x2cfefc[_0xb7f0('0x1e')](_0x52e864,_0x257efc)[_0xb7f0('0x1f')](function(_0x3601a1){logger[_0xb7f0('0x20')](_0xb7f0('0x21'),_0x1dcfc2,_0xb7f0('0x22'));logger[_0xb7f0('0x23')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1dcfc2,_0xb7f0('0x22'),JSON[_0xb7f0('0x24')](_0x3601a1));if(_0x3601a1['error']){if(_0x3601a1[_0xb7f0('0x25')]['code']===0x1f4){logger['error'](_0xb7f0('0x21'),_0x1dcfc2,_0x3601a1[_0xb7f0('0x25')][_0xb7f0('0x26')]);return _0x558e85(_0x3601a1[_0xb7f0('0x25')][_0xb7f0('0x26')]);}logger[_0xb7f0('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1dcfc2,_0x3601a1[_0xb7f0('0x25')][_0xb7f0('0x26')]);return _0x1fc2b5(_0x3601a1[_0xb7f0('0x25')]['message']);}else{logger[_0xb7f0('0x20')](_0xb7f0('0x21'),_0x1dcfc2,_0xb7f0('0x22'));_0x1fc2b5(_0x3601a1[_0xb7f0('0x27')]['message']);}})[_0xb7f0('0x28')](function(_0x4a8040){logger[_0xb7f0('0x25')](_0xb7f0('0x21'),_0x1dcfc2,_0x4a8040);_0x558e85(_0x4a8040);});});}function respondWithStatusCode(_0x36939c,_0x87a4ed){_0x87a4ed=_0x87a4ed||0xcc;return function(_0x281777){if(_0x281777){return _0x36939c[_0xb7f0('0x29')](_0x87a4ed);}return _0x36939c[_0xb7f0('0x2a')](_0x87a4ed)[_0xb7f0('0x2b')]();};}function respondWithResult(_0xb5c910,_0x4b2ef1){_0x4b2ef1=_0x4b2ef1||0xc8;return function(_0x2f4f28){if(_0x2f4f28){return _0xb5c910[_0xb7f0('0x2a')](_0x4b2ef1)[_0xb7f0('0x2c')](_0x2f4f28);}};}function respondWithFilteredResult(_0x59d0be,_0x5e0bf3){return function(_0x527b01){if(_0x527b01){var _0x4c561f=_0x527b01[_0xb7f0('0x2d')],_0x7af8f4=_0x5e0bf3[_0xb7f0('0x2e')],_0x133a60=_0x5e0bf3[_0xb7f0('0x2e')]+_0x5e0bf3[_0xb7f0('0x2f')],_0x90a2e2;if(_0x133a60>=_0x4c561f){_0x133a60=_0x4c561f;_0x90a2e2=0xc8;}else{_0x90a2e2=0xce;}_0x59d0be['status'](_0x90a2e2);return _0x59d0be['set'](_0xb7f0('0x30'),_0x7af8f4+'-'+_0x133a60+'/'+_0x4c561f)[_0xb7f0('0x2c')](_0x527b01);}return null;};}function patchUpdates(_0x4e898c){return function(_0x476284){try{jsonpatch[_0xb7f0('0x31')](_0x476284,_0x4e898c,!![]);}catch(_0x4532a4){return BPromise['reject'](_0x4532a4);}return _0x476284[_0xb7f0('0x32')]();};}function saveUpdates(_0x70a432,_0x3b7390){return function(_0x33f368){if(_0x33f368){return _0x33f368[_0xb7f0('0x33')](_0x70a432)[_0xb7f0('0x1f')](function(_0x46a21e){return _0x46a21e;});}return null;};}function removeEntity(_0x4dfcb1,_0x2d4a25){return function(_0x398819){if(_0x398819){return _0x398819[_0xb7f0('0x34')]()[_0xb7f0('0x1f')](function(){_0x4dfcb1[_0xb7f0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9a4e,_0x110a97){return function(_0x1ace9f){if(!_0x1ace9f){_0x5e9a4e[_0xb7f0('0x29')](0x194);}return _0x1ace9f;};}function handleError(_0x3eabce,_0x984540){_0x984540=_0x984540||0x1f4;return function(_0x4383a0){logger[_0xb7f0('0x25')](_0x4383a0[_0xb7f0('0x35')]);if(_0x4383a0[_0xb7f0('0x36')]){delete _0x4383a0['name'];}_0x3eabce[_0xb7f0('0x2a')](_0x984540)['send'](_0x4383a0);};}exports[_0xb7f0('0x37')]=function(_0x528c78,_0x45e46b){var _0x1a12af={},_0xdf52a0={},_0x4b6495={'count':0x0,'rows':[]};var _0x315db7=_[_0xb7f0('0x38')](db[_0xb7f0('0x39')][_0xb7f0('0x3a')],function(_0x36e701){return{'name':_0x36e701[_0xb7f0('0x3b')],'type':_0x36e701[_0xb7f0('0x3c')][_0xb7f0('0x3d')]};});_0xdf52a0['model']=_[_0xb7f0('0x38')](_0x315db7,_0xb7f0('0x36'));_0xdf52a0[_0xb7f0('0x3e')]=_[_0xb7f0('0x3f')](_0x528c78[_0xb7f0('0x3e')]);_0xdf52a0[_0xb7f0('0x40')]=_[_0xb7f0('0x41')](_0xdf52a0[_0xb7f0('0x42')],_0xdf52a0['query']);_0x1a12af[_0xb7f0('0x43')]=_['intersection'](_0xdf52a0[_0xb7f0('0x42')],qs[_0xb7f0('0x44')](_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x44')]));_0x1a12af[_0xb7f0('0x43')]=_0x1a12af[_0xb7f0('0x43')][_0xb7f0('0x45')]?_0x1a12af['attributes']:_0xdf52a0[_0xb7f0('0x42')];if(!_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x46')](_0xb7f0('0x47'))){_0x1a12af[_0xb7f0('0x2f')]=qs[_0xb7f0('0x2f')](_0x528c78['query'][_0xb7f0('0x2f')]);_0x1a12af['offset']=qs['offset'](_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x2e')]);}_0x1a12af[_0xb7f0('0x48')]=qs[_0xb7f0('0x49')](_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x49')]);_0x1a12af['where']=qs['filters'](_[_0xb7f0('0x4a')](_0x528c78[_0xb7f0('0x3e')],_0xdf52a0[_0xb7f0('0x40')]),_0x315db7);if(_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x4b')]){_0x1a12af[_0xb7f0('0x4c')]=_[_0xb7f0('0x4d')](_0x1a12af[_0xb7f0('0x4c')],{'$or':_[_0xb7f0('0x38')](_0x315db7,function(_0x1093df){if(_0x1093df[_0xb7f0('0x3c')]!==_0xb7f0('0x4e')){var _0x5955a3={};_0x5955a3[_0x1093df['name']]={'$like':'%'+_0x528c78['query']['filter']+'%'};return _0x5955a3;}})});}_0x1a12af=_[_0xb7f0('0x4d')]({},_0x1a12af,_0x528c78['options']);var _0x2f0558={'where':_0x1a12af[_0xb7f0('0x4c')]};return db[_0xb7f0('0x39')][_0xb7f0('0x2d')](_0x2f0558)[_0xb7f0('0x1f')](function(_0x19d921){_0x4b6495[_0xb7f0('0x2d')]=_0x19d921;if(_0x528c78[_0xb7f0('0x3e')][_0xb7f0('0x4f')]){_0x1a12af['include']=[{'all':!![]}];}return db[_0xb7f0('0x39')][_0xb7f0('0x50')](_0x1a12af);})['then'](function(_0x4474cc){_0x4b6495[_0xb7f0('0x51')]=_0x4474cc;return _0x4b6495;})[_0xb7f0('0x1f')](respondWithFilteredResult(_0x45e46b,_0x1a12af))[_0xb7f0('0x28')](handleError(_0x45e46b,null));};exports[_0xb7f0('0x52')]=function(_0x50b12f,_0x205015){var _0x2e8871={'raw':![],'where':{'id':_0x50b12f[_0xb7f0('0x53')]['id']}},_0x4ccdfd={};_0x4ccdfd[_0xb7f0('0x42')]=_['keys'](db[_0xb7f0('0x39')][_0xb7f0('0x3a')]);_0x4ccdfd[_0xb7f0('0x3e')]=_['keys'](_0x50b12f['query']);_0x4ccdfd[_0xb7f0('0x40')]=_[_0xb7f0('0x41')](_0x4ccdfd[_0xb7f0('0x42')],_0x4ccdfd[_0xb7f0('0x3e')]);_0x2e8871[_0xb7f0('0x43')]=_[_0xb7f0('0x41')](_0x4ccdfd['model'],qs[_0xb7f0('0x44')](_0x50b12f[_0xb7f0('0x3e')][_0xb7f0('0x44')]));_0x2e8871['attributes']=_0x2e8871['attributes'][_0xb7f0('0x45')]?_0x2e8871[_0xb7f0('0x43')]:_0x4ccdfd['model'];if(_0x50b12f[_0xb7f0('0x3e')][_0xb7f0('0x4f')]){_0x2e8871[_0xb7f0('0x54')]=[{'all':!![]}];}_0x2e8871=_[_0xb7f0('0x4d')]({},_0x2e8871,_0x50b12f[_0xb7f0('0x55')]);return db[_0xb7f0('0x39')][_0xb7f0('0x56')](_0x2e8871)['then'](handleEntityNotFound(_0x205015,null))[_0xb7f0('0x1f')](respondWithResult(_0x205015,null))['catch'](handleError(_0x205015,null));};exports[_0xb7f0('0x57')]=function(_0x322eca,_0x9b84d0){return db[_0xb7f0('0x39')][_0xb7f0('0x57')](_0x322eca[_0xb7f0('0x58')],{})[_0xb7f0('0x1f')](respondWithResult(_0x9b84d0,0xc9))['catch'](handleError(_0x9b84d0,null));};exports[_0xb7f0('0x33')]=function(_0x4f7575,_0x537f97){if(_0x4f7575['body']['id']){delete _0x4f7575[_0xb7f0('0x58')]['id'];}return db[_0xb7f0('0x39')][_0xb7f0('0x56')]({'where':{'id':_0x4f7575[_0xb7f0('0x53')]['id']}})[_0xb7f0('0x1f')](handleEntityNotFound(_0x537f97,null))[_0xb7f0('0x1f')](saveUpdates(_0x4f7575[_0xb7f0('0x58')],null))[_0xb7f0('0x1f')](respondWithResult(_0x537f97,null))[_0xb7f0('0x28')](handleError(_0x537f97,null));};exports[_0xb7f0('0x34')]=function(_0x594d03,_0x5d888a){return db[_0xb7f0('0x39')][_0xb7f0('0x56')]({'where':{'id':_0x594d03[_0xb7f0('0x53')]['id']}})[_0xb7f0('0x1f')](handleEntityNotFound(_0x5d888a,null))[_0xb7f0('0x1f')](removeEntity(_0x5d888a,null))['catch'](handleError(_0x5d888a,null));};exports[_0xb7f0('0x59')]=function(_0x124150,_0x34c2a2,_0x1a9a45){var _0x53dcb8={};var _0x677b7d={};var _0x53c39c;var _0x4f14f9;return db[_0xb7f0('0x39')][_0xb7f0('0x5a')]({'where':{'id':_0x124150[_0xb7f0('0x53')]['id']}})[_0xb7f0('0x1f')](handleEntityNotFound(_0x34c2a2,null))[_0xb7f0('0x1f')](function(_0x34ade9){if(_0x34ade9){_0x53c39c=_0x34ade9;_0x677b7d['model']=_[_0xb7f0('0x3f')](db[_0xb7f0('0x5b')][_0xb7f0('0x3a')]);_0x677b7d[_0xb7f0('0x3e')]=_['keys'](_0x124150[_0xb7f0('0x3e')]);_0x677b7d[_0xb7f0('0x40')]=_[_0xb7f0('0x41')](_0x677b7d[_0xb7f0('0x42')],_0x677b7d['query']);_0x53dcb8[_0xb7f0('0x43')]=_[_0xb7f0('0x41')](_0x677b7d[_0xb7f0('0x42')],qs['fields'](_0x124150[_0xb7f0('0x3e')]['fields']));_0x53dcb8[_0xb7f0('0x43')]=_0x53dcb8[_0xb7f0('0x43')][_0xb7f0('0x45')]?_0x53dcb8[_0xb7f0('0x43')]:_0x677b7d['model'];_0x53dcb8[_0xb7f0('0x48')]=qs[_0xb7f0('0x49')](_0x124150[_0xb7f0('0x3e')][_0xb7f0('0x49')]);_0x53dcb8['where']=qs[_0xb7f0('0x40')](_[_0xb7f0('0x4a')](_0x124150[_0xb7f0('0x3e')],_0x677b7d[_0xb7f0('0x40')]));if(_0x124150[_0xb7f0('0x3e')]['filter']){_0x53dcb8[_0xb7f0('0x4c')]=_[_0xb7f0('0x4d')](_0x53dcb8[_0xb7f0('0x4c')],{'$or':_['map'](_0x53dcb8[_0xb7f0('0x43')],function(_0x3ff80b){var _0x55d23d={};_0x55d23d[_0x3ff80b]={'$like':'%'+_0x124150[_0xb7f0('0x3e')][_0xb7f0('0x4b')]+'%'};return _0x55d23d;})});}_0x53dcb8=_[_0xb7f0('0x4d')]({},_0x53dcb8,_0x124150['options']);return _0x53c39c['getFields'](_0x53dcb8);}})['then'](function(_0x9595d4){if(_0x9595d4){_0x4f14f9=_0x9595d4['length'];if(!_0x124150['query']['hasOwnProperty'](_0xb7f0('0x47'))){_0x53dcb8[_0xb7f0('0x2f')]=qs[_0xb7f0('0x2f')](_0x124150[_0xb7f0('0x3e')][_0xb7f0('0x2f')]);_0x53dcb8[_0xb7f0('0x2e')]=qs[_0xb7f0('0x2e')](_0x124150['query']['offset']);}return _0x53c39c[_0xb7f0('0x59')](_0x53dcb8);}})[_0xb7f0('0x1f')](function(_0x233071){if(_0x233071){return _0x233071?{'count':_0x4f14f9,'rows':_0x233071}:null;}})[_0xb7f0('0x1f')](respondWithResult(_0x34c2a2,null))[_0xb7f0('0x28')](handleError(_0x34c2a2,null));};exports[_0xb7f0('0x5c')]=function(_0x280693,_0x135ccb,_0x35d107){var _0x3abcbc={};var _0x12d624={};var _0x12829d;var _0x5bdafd;return db['Dynamics365Configuration'][_0xb7f0('0x5a')]({'where':{'id':_0x280693[_0xb7f0('0x53')]['id']}})[_0xb7f0('0x1f')](handleEntityNotFound(_0x135ccb,null))[_0xb7f0('0x1f')](function(_0x1d5fe2){if(_0x1d5fe2){_0x12829d=_0x1d5fe2;_0x12d624['model']=_[_0xb7f0('0x3f')](db['Dynamics365Field'][_0xb7f0('0x3a')]);_0x12d624['query']=_[_0xb7f0('0x3f')](_0x280693['query']);_0x12d624[_0xb7f0('0x40')]=_[_0xb7f0('0x41')](_0x12d624['model'],_0x12d624[_0xb7f0('0x3e')]);_0x3abcbc[_0xb7f0('0x43')]=_[_0xb7f0('0x41')](_0x12d624['model'],qs[_0xb7f0('0x44')](_0x280693[_0xb7f0('0x3e')]['fields']));_0x3abcbc[_0xb7f0('0x43')]=_0x3abcbc[_0xb7f0('0x43')]['length']?_0x3abcbc[_0xb7f0('0x43')]:_0x12d624['model'];_0x3abcbc[_0xb7f0('0x48')]=qs[_0xb7f0('0x49')](_0x280693[_0xb7f0('0x3e')]['sort']);_0x3abcbc[_0xb7f0('0x4c')]=qs[_0xb7f0('0x40')](_['pick'](_0x280693[_0xb7f0('0x3e')],_0x12d624[_0xb7f0('0x40')]));if(_0x280693[_0xb7f0('0x3e')][_0xb7f0('0x4b')]){_0x3abcbc[_0xb7f0('0x4c')]=_[_0xb7f0('0x4d')](_0x3abcbc[_0xb7f0('0x4c')],{'$or':_[_0xb7f0('0x38')](_0x3abcbc['attributes'],function(_0x5d3bd9){var _0x2deb2c={};_0x2deb2c[_0x5d3bd9]={'$like':'%'+_0x280693[_0xb7f0('0x3e')]['filter']+'%'};return _0x2deb2c;})});}_0x3abcbc=_['merge']({},_0x3abcbc,_0x280693[_0xb7f0('0x55')]);return _0x12829d[_0xb7f0('0x5c')](_0x3abcbc);}})[_0xb7f0('0x1f')](function(_0x33d07d){if(_0x33d07d){_0x5bdafd=_0x33d07d[_0xb7f0('0x45')];if(!_0x280693[_0xb7f0('0x3e')]['hasOwnProperty'](_0xb7f0('0x47'))){_0x3abcbc['limit']=qs['limit'](_0x280693[_0xb7f0('0x3e')][_0xb7f0('0x2f')]);_0x3abcbc[_0xb7f0('0x2e')]=qs['offset'](_0x280693[_0xb7f0('0x3e')]['offset']);}return _0x12829d[_0xb7f0('0x5c')](_0x3abcbc);}})[_0xb7f0('0x1f')](function(_0x280234){if(_0x280234){return _0x280234?{'count':_0x5bdafd,'rows':_0x280234}:null;}})[_0xb7f0('0x1f')](respondWithResult(_0x135ccb,null))[_0xb7f0('0x28')](handleError(_0x135ccb,null));};exports[_0xb7f0('0x5d')]=function(_0x39e2c0,_0x19e78d,_0x47ebdf){var _0x395690={};var _0x106881={};var _0x5abd22;var _0x390320;return db[_0xb7f0('0x39')]['findOne']({'where':{'id':_0x39e2c0['params']['id']}})[_0xb7f0('0x1f')](handleEntityNotFound(_0x19e78d,null))['then'](function(_0x2dc6c5){if(_0x2dc6c5){_0x5abd22=_0x2dc6c5;_0x106881['model']=_[_0xb7f0('0x3f')](db['Dynamics365Field'][_0xb7f0('0x3a')]);_0x106881[_0xb7f0('0x3e')]=_[_0xb7f0('0x3f')](_0x39e2c0['query']);_0x106881[_0xb7f0('0x40')]=_[_0xb7f0('0x41')](_0x106881[_0xb7f0('0x42')],_0x106881[_0xb7f0('0x3e')]);_0x395690[_0xb7f0('0x43')]=_[_0xb7f0('0x41')](_0x106881[_0xb7f0('0x42')],qs[_0xb7f0('0x44')](_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x44')]));_0x395690['attributes']=_0x395690['attributes'][_0xb7f0('0x45')]?_0x395690['attributes']:_0x106881[_0xb7f0('0x42')];_0x395690[_0xb7f0('0x48')]=qs[_0xb7f0('0x49')](_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x49')]);_0x395690['where']=qs[_0xb7f0('0x40')](_[_0xb7f0('0x4a')](_0x39e2c0[_0xb7f0('0x3e')],_0x106881[_0xb7f0('0x40')]));if(_0x39e2c0[_0xb7f0('0x3e')]['filter']){_0x395690[_0xb7f0('0x4c')]=_[_0xb7f0('0x4d')](_0x395690[_0xb7f0('0x4c')],{'$or':_[_0xb7f0('0x38')](_0x395690[_0xb7f0('0x43')],function(_0x255201){var _0x282467={};_0x282467[_0x255201]={'$like':'%'+_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x4b')]+'%'};return _0x282467;})});}_0x395690=_['merge']({},_0x395690,_0x39e2c0[_0xb7f0('0x55')]);return _0x5abd22[_0xb7f0('0x5d')](_0x395690);}})[_0xb7f0('0x1f')](function(_0x1420f1){if(_0x1420f1){_0x390320=_0x1420f1[_0xb7f0('0x45')];if(!_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x46')]('nolimit')){_0x395690[_0xb7f0('0x2f')]=qs[_0xb7f0('0x2f')](_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x2f')]);_0x395690['offset']=qs[_0xb7f0('0x2e')](_0x39e2c0[_0xb7f0('0x3e')][_0xb7f0('0x2e')]);}return _0x5abd22[_0xb7f0('0x5d')](_0x395690);}})[_0xb7f0('0x1f')](function(_0x231f0f){if(_0x231f0f){return _0x231f0f?{'count':_0x390320,'rows':_0x231f0f}:null;}})[_0xb7f0('0x1f')](respondWithResult(_0x19e78d,null))['catch'](handleError(_0x19e78d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b49c4d2..38cd5ae 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 _0x7741=['bluebird','request-promise','path','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash','util','../../config/logger','moment'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x7741,0xe2));var _0x1774=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7741[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x1774('0x0'));var util=require(_0x1774('0x1'));var logger=require(_0x1774('0x2'))('api');var moment=require(_0x1774('0x3'));var BPromise=require(_0x1774('0x4'));var rp=require(_0x1774('0x5'));var fs=require('fs');var path=require(_0x1774('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1774('0x7'));module[_0x1774('0x8')]=function(_0x4cad25,_0x27183b){return _0x4cad25['define']('Dynamics365Configuration',attributes,{'tableName':_0x1774('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12a7=['exports','Dynamics365Configuration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x4344a2,_0x4798ee){var _0x3dc2cb=function(_0x1a127d){while(--_0x1a127d){_0x4344a2['push'](_0x4344a2['shift']());}};_0x3dc2cb(++_0x4798ee);}(_0x12a7,0x10a));var _0x712a=function(_0x31e8d2,_0x9b57b8){_0x31e8d2=_0x31e8d2-0x0;var _0x59f335=_0x12a7[_0x31e8d2];return _0x59f335;};'use strict';var _=require(_0x712a('0x0'));var util=require(_0x712a('0x1'));var logger=require(_0x712a('0x2'))('api');var moment=require(_0x712a('0x3'));var BPromise=require(_0x712a('0x4'));var rp=require(_0x712a('0x5'));var fs=require('fs');var path=require(_0x712a('0x6'));var rimraf=require(_0x712a('0x7'));var config=require(_0x712a('0x8'));var attributes=require(_0x712a('0x9'));module[_0x712a('0xa')]=function(_0x47a6f8,_0x421c02){return _0x47a6f8['define'](_0x712a('0xb'),attributes,{'tableName':'int_dynamics365_configurations','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 7697d3c..25b2a5d 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 _0x9228=['stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x428f96,_0x308b86){var _0xbf969=function(_0x3c1aa1){while(--_0x3c1aa1){_0x428f96['push'](_0x428f96['shift']());}};_0xbf969(++_0x308b86);}(_0x9228,0x197));var _0x8922=function(_0x259fca,_0x53360c){_0x259fca=_0x259fca-0x0;var _0x387fc5=_0x9228[_0x259fca];return _0x387fc5;};'use strict';var _=require(_0x8922('0x0'));var util=require('util');var moment=require(_0x8922('0x1'));var BPromise=require(_0x8922('0x2'));var rs=require(_0x8922('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8922('0x4'))['db'];var utils=require(_0x8922('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8922('0x6'));var jayson=require(_0x8922('0x7'));var client=jayson[_0x8922('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54b1ef,_0x1f40be,_0x285d30){return new BPromise(function(_0x1810ad,_0x4bd260){return client[_0x8922('0x9')](_0x54b1ef,_0x285d30)[_0x8922('0xa')](function(_0x25338d){logger[_0x8922('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1f40be,'request\x20sent');logger['debug'](_0x8922('0xc'),_0x1f40be,'request\x20sent',JSON[_0x8922('0xd')](_0x25338d));if(_0x25338d[_0x8922('0xe')]){if(_0x25338d[_0x8922('0xe')][_0x8922('0xf')]===0x1f4){logger['error'](_0x8922('0x10'),_0x1f40be,_0x25338d[_0x8922('0xe')][_0x8922('0x11')]);return _0x4bd260(_0x25338d[_0x8922('0xe')][_0x8922('0x11')]);}logger[_0x8922('0xe')](_0x8922('0x10'),_0x1f40be,_0x25338d[_0x8922('0xe')][_0x8922('0x11')]);return _0x1810ad(_0x25338d[_0x8922('0xe')][_0x8922('0x11')]);}else{logger[_0x8922('0xb')](_0x8922('0x10'),_0x1f40be,_0x8922('0x12'));_0x1810ad(_0x25338d[_0x8922('0x13')][_0x8922('0x11')]);}})[_0x8922('0x14')](function(_0x1044ca){logger[_0x8922('0xe')](_0x8922('0x10'),_0x1f40be,_0x1044ca);_0x4bd260(_0x1044ca);});});} \ No newline at end of file +var _0x586e=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x18b86d,_0x45e41d){var _0x5b9f9d=function(_0x514005){while(--_0x514005){_0x18b86d['push'](_0x18b86d['shift']());}};_0x5b9f9d(++_0x45e41d);}(_0x586e,0xc0));var _0xe586=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x586e[_0x57fa33];return _0x12e724;};'use strict';var _=require(_0xe586('0x0'));var util=require(_0xe586('0x1'));var moment=require('moment');var BPromise=require(_0xe586('0x2'));var rs=require(_0xe586('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe586('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe586('0x5'))(_0xe586('0x6'));var config=require('../../config/environment');var jayson=require(_0xe586('0x7'));var client=jayson[_0xe586('0x8')][_0xe586('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x436ce1,_0x242246,_0x46fe4e){return new BPromise(function(_0x595283,_0x3ad6bf){return client[_0xe586('0xa')](_0x436ce1,_0x46fe4e)[_0xe586('0xb')](function(_0x197093){logger[_0xe586('0xc')](_0xe586('0xd'),_0x242246,'request\x20sent');logger[_0xe586('0xe')](_0xe586('0xf'),_0x242246,_0xe586('0x10'),JSON['stringify'](_0x197093));if(_0x197093['error']){if(_0x197093[_0xe586('0x11')]['code']===0x1f4){logger[_0xe586('0x11')](_0xe586('0xd'),_0x242246,_0x197093[_0xe586('0x11')]['message']);return _0x3ad6bf(_0x197093[_0xe586('0x11')][_0xe586('0x12')]);}logger[_0xe586('0x11')](_0xe586('0xd'),_0x242246,_0x197093[_0xe586('0x11')][_0xe586('0x12')]);return _0x595283(_0x197093[_0xe586('0x11')][_0xe586('0x12')]);}else{logger[_0xe586('0xc')](_0xe586('0xd'),_0x242246,_0xe586('0x10'));_0x595283(_0x197093[_0xe586('0x13')][_0xe586('0x12')]);}})[_0xe586('0x14')](function(_0x463e3f){logger[_0xe586('0x11')](_0xe586('0xd'),_0x242246,_0x463e3f);_0x3ad6bf(_0x463e3f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 76723f3..8e2daae 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 _0xb43b=['get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x2344e7,_0xf75c3e){var _0x2ff6a3=function(_0x54f0ef){while(--_0x54f0ef){_0x2344e7['push'](_0x2344e7['shift']());}};_0x2ff6a3(++_0xf75c3e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x56ac98,_0xffc04b){_0x56ac98=_0x56ac98-0x0;var _0x36be26=_0xb43b[_0x56ac98];return _0x36be26;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/:id',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x9')](),controller[_0xbb43('0xc')]);router['put'](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller['update']);router[_0xbb43('0xe')](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file +var _0xfd28=['index','/:id','post','create','update','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2b865a,_0x43bb93){var _0x555414=function(_0x25ded4){while(--_0x25ded4){_0x2b865a['push'](_0x2b865a['shift']());}};_0x555414(++_0x43bb93);}(_0xfd28,0x148));var _0x8fd2=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xfd28[_0x104e21];return _0x605b37;};'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('./intDynamics365Field.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8fd2('0xa')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0xb')]);router['put'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['delete'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index da6bd0c..f203a90 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 _0x2dfb=['sequelize','exports','string','customVariable','keyValue','ENUM','variable','STRING','BOOLEAN'];(function(_0x1df187,_0x261cc8){var _0x4dbcf6=function(_0x21b78e){while(--_0x21b78e){_0x1df187['push'](_0x1df187['shift']());}};_0x4dbcf6(++_0x261cc8);}(_0x2dfb,0x10e));var _0xb2df=function(_0x20c8bb,_0x2238b4){_0x20c8bb=_0x20c8bb-0x0;var _0x33cf0e=_0x2dfb[_0x20c8bb];return _0x33cf0e;};'use strict';var Sequelize=require(_0xb2df('0x0'));module[_0xb2df('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb2df('0x2'),'variable',_0xb2df('0x3'),_0xb2df('0x4')),'defaultValue':_0xb2df('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb2df('0x5')]('string',_0xb2df('0x6'),_0xb2df('0x3'))},'keyContent':{'type':Sequelize[_0xb2df('0x7')]},'idField':{'type':Sequelize[_0xb2df('0x7')]},'nameField':{'type':Sequelize[_0xb2df('0x7')]},'customField':{'type':Sequelize[_0xb2df('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb2df('0x7')]}}; \ No newline at end of file +var _0x46ee=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x4921fd,_0x45b894){var _0x5812e5=function(_0x360c7d){while(--_0x360c7d){_0x4921fd['push'](_0x4921fd['shift']());}};_0x5812e5(++_0x45b894);}(_0x46ee,0x6b));var _0xe46e=function(_0x21c1f1,_0x314640){_0x21c1f1=_0x21c1f1-0x0;var _0x18591=_0x46ee[_0x21c1f1];return _0x18591;};'use strict';var Sequelize=require(_0xe46e('0x0'));module[_0xe46e('0x1')]={'type':{'type':Sequelize[_0xe46e('0x2')](_0xe46e('0x3'),_0xe46e('0x4'),_0xe46e('0x5'),_0xe46e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe46e('0x3'),_0xe46e('0x4'),_0xe46e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe46e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe46e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe46e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9088929..b0030b4 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 _0x6b07=['rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','json','apply','reject','save','update','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format'];(function(_0x3c0731,_0xe7cf5e){var _0x487ea7=function(_0xc3dbb4){while(--_0xc3dbb4){_0x3c0731['push'](_0x3c0731['shift']());}};_0x487ea7(++_0xe7cf5e);}(_0x6b07,0x1a8));var _0x76b0=function(_0x2f203e,_0x25c82e){_0x2f203e=_0x2f203e-0x0;var _0xe3a8a8=_0x6b07[_0x2f203e];return _0xe3a8a8;};'use strict';var pdf=require(_0x76b0('0x0'));var emlformat=require(_0x76b0('0x1'));var rimraf=require(_0x76b0('0x2'));var zipdir=require(_0x76b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76b0('0x4'));var moment=require('moment');var BPromise=require(_0x76b0('0x5'));var Mustache=require(_0x76b0('0x6'));var util=require(_0x76b0('0x7'));var path=require('path');var sox=require(_0x76b0('0x8'));var csv=require(_0x76b0('0x9'));var ejs=require(_0x76b0('0xa'));var fs=require('fs');var _=require(_0x76b0('0xb'));var squel=require(_0x76b0('0xc'));var crypto=require(_0x76b0('0xd'));var jsforce=require(_0x76b0('0xe'));var deskjs=require(_0x76b0('0xf'));var toCsv=require(_0x76b0('0x9'));var querystring=require('querystring');var Papa=require(_0x76b0('0x10'));var Redis=require('ioredis');var authService=require(_0x76b0('0x11'));var qs=require(_0x76b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76b0('0x13'));var logger=require('../../config/logger')(_0x76b0('0x14'));var utils=require(_0x76b0('0x15'));var config=require(_0x76b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5848a3,_0x569273){_0x569273=_0x569273||0xcc;return function(_0x37615a){if(_0x37615a){return _0x5848a3[_0x76b0('0x17')](_0x569273);}return _0x5848a3['status'](_0x569273)['end']();};}function respondWithResult(_0x2e1c71,_0x364ddf){_0x364ddf=_0x364ddf||0xc8;return function(_0x1ea151){if(_0x1ea151){return _0x2e1c71[_0x76b0('0x18')](_0x364ddf)['json'](_0x1ea151);}};}function respondWithFilteredResult(_0x1d7846,_0x190725){return function(_0x22a454){if(_0x22a454){var _0x193e94=_0x22a454[_0x76b0('0x19')],_0x1a1b4c=_0x190725['offset'],_0x427cb6=_0x190725[_0x76b0('0x1a')]+_0x190725['limit'],_0x1e5f45;if(_0x427cb6>=_0x193e94){_0x427cb6=_0x193e94;_0x1e5f45=0xc8;}else{_0x1e5f45=0xce;}_0x1d7846[_0x76b0('0x18')](_0x1e5f45);return _0x1d7846[_0x76b0('0x1b')]('Content-Range',_0x1a1b4c+'-'+_0x427cb6+'/'+_0x193e94)[_0x76b0('0x1c')](_0x22a454);}return null;};}function patchUpdates(_0x41a14a){return function(_0x563722){try{jsonpatch[_0x76b0('0x1d')](_0x563722,_0x41a14a,!![]);}catch(_0xf04369){return BPromise[_0x76b0('0x1e')](_0xf04369);}return _0x563722[_0x76b0('0x1f')]();};}function saveUpdates(_0x120f66,_0x5708c0){return function(_0x21fe58){if(_0x21fe58){return _0x21fe58[_0x76b0('0x20')](_0x120f66)['then'](function(_0x13ad5b){return _0x13ad5b;});}return null;};}function removeEntity(_0x1e0936,_0x83882){return function(_0x463d1d){if(_0x463d1d){return _0x463d1d[_0x76b0('0x21')]()['then'](function(){_0x1e0936[_0x76b0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a4329,_0xff96ab){return function(_0x27b8a1){if(!_0x27b8a1){_0x1a4329[_0x76b0('0x17')](0x194);}return _0x27b8a1;};}function handleError(_0x135e0e,_0x37b506){_0x37b506=_0x37b506||0x1f4;return function(_0x302f6e){logger[_0x76b0('0x22')](_0x302f6e['stack']);if(_0x302f6e[_0x76b0('0x23')]){delete _0x302f6e[_0x76b0('0x23')];}_0x135e0e[_0x76b0('0x18')](_0x37b506)[_0x76b0('0x24')](_0x302f6e);};}exports[_0x76b0('0x25')]=function(_0xabbd3f,_0x1da5a7){var _0x2775e4={},_0x989a77={},_0x59000c={'count':0x0,'rows':[]};var _0x5f2478=_[_0x76b0('0x26')](db[_0x76b0('0x27')][_0x76b0('0x28')],function(_0xf7f3ed){return{'name':_0xf7f3ed[_0x76b0('0x29')],'type':_0xf7f3ed['type'][_0x76b0('0x2a')]};});_0x989a77[_0x76b0('0x2b')]=_[_0x76b0('0x26')](_0x5f2478,_0x76b0('0x23'));_0x989a77[_0x76b0('0x2c')]=_[_0x76b0('0x2d')](_0xabbd3f[_0x76b0('0x2c')]);_0x989a77[_0x76b0('0x2e')]=_[_0x76b0('0x2f')](_0x989a77[_0x76b0('0x2b')],_0x989a77['query']);_0x2775e4[_0x76b0('0x30')]=_[_0x76b0('0x2f')](_0x989a77['model'],qs[_0x76b0('0x31')](_0xabbd3f[_0x76b0('0x2c')][_0x76b0('0x31')]));_0x2775e4['attributes']=_0x2775e4['attributes']['length']?_0x2775e4[_0x76b0('0x30')]:_0x989a77['model'];if(!_0xabbd3f['query'][_0x76b0('0x32')](_0x76b0('0x33'))){_0x2775e4[_0x76b0('0x34')]=qs['limit'](_0xabbd3f[_0x76b0('0x2c')]['limit']);_0x2775e4[_0x76b0('0x1a')]=qs[_0x76b0('0x1a')](_0xabbd3f[_0x76b0('0x2c')]['offset']);}_0x2775e4[_0x76b0('0x35')]=qs[_0x76b0('0x36')](_0xabbd3f[_0x76b0('0x2c')][_0x76b0('0x36')]);_0x2775e4[_0x76b0('0x37')]=qs[_0x76b0('0x2e')](_[_0x76b0('0x38')](_0xabbd3f['query'],_0x989a77['filters']),_0x5f2478);if(_0xabbd3f['query']['filter']){_0x2775e4[_0x76b0('0x37')]=_[_0x76b0('0x39')](_0x2775e4[_0x76b0('0x37')],{'$or':_[_0x76b0('0x26')](_0x5f2478,function(_0x25efdc){if(_0x25efdc[_0x76b0('0x3a')]!=='VIRTUAL'){var _0x278c8b={};_0x278c8b[_0x25efdc['name']]={'$like':'%'+_0xabbd3f[_0x76b0('0x2c')]['filter']+'%'};return _0x278c8b;}})});}_0x2775e4=_['merge']({},_0x2775e4,_0xabbd3f[_0x76b0('0x3b')]);var _0x3c5f37={'where':_0x2775e4[_0x76b0('0x37')]};return db[_0x76b0('0x27')][_0x76b0('0x19')](_0x3c5f37)[_0x76b0('0x3c')](function(_0x296367){_0x59000c[_0x76b0('0x19')]=_0x296367;if(_0xabbd3f['query'][_0x76b0('0x3d')]){_0x2775e4[_0x76b0('0x3e')]=[{'all':!![]}];}return db[_0x76b0('0x27')][_0x76b0('0x3f')](_0x2775e4);})['then'](function(_0x5d33cf){_0x59000c[_0x76b0('0x40')]=_0x5d33cf;return _0x59000c;})[_0x76b0('0x3c')](respondWithFilteredResult(_0x1da5a7,_0x2775e4))[_0x76b0('0x41')](handleError(_0x1da5a7,null));};exports[_0x76b0('0x42')]=function(_0x7e212d,_0xcfebe1){var _0x2bd25d={'raw':!![],'where':{'id':_0x7e212d[_0x76b0('0x43')]['id']}},_0x476ea8={};_0x476ea8['model']=_[_0x76b0('0x2d')](db['Dynamics365Field'][_0x76b0('0x28')]);_0x476ea8[_0x76b0('0x2c')]=_['keys'](_0x7e212d[_0x76b0('0x2c')]);_0x476ea8['filters']=_[_0x76b0('0x2f')](_0x476ea8[_0x76b0('0x2b')],_0x476ea8[_0x76b0('0x2c')]);_0x2bd25d[_0x76b0('0x30')]=_[_0x76b0('0x2f')](_0x476ea8[_0x76b0('0x2b')],qs[_0x76b0('0x31')](_0x7e212d[_0x76b0('0x2c')]['fields']));_0x2bd25d['attributes']=_0x2bd25d[_0x76b0('0x30')]['length']?_0x2bd25d[_0x76b0('0x30')]:_0x476ea8['model'];if(_0x7e212d[_0x76b0('0x2c')]['includeAll']){_0x2bd25d[_0x76b0('0x3e')]=[{'all':!![]}];}_0x2bd25d=_['merge']({},_0x2bd25d,_0x7e212d[_0x76b0('0x3b')]);return db[_0x76b0('0x27')][_0x76b0('0x44')](_0x2bd25d)['then'](handleEntityNotFound(_0xcfebe1,null))[_0x76b0('0x3c')](respondWithResult(_0xcfebe1,null))[_0x76b0('0x41')](handleError(_0xcfebe1,null));};exports[_0x76b0('0x45')]=function(_0x45391b,_0x2169d9){return db[_0x76b0('0x27')]['create'](_0x45391b[_0x76b0('0x46')],{})[_0x76b0('0x3c')](respondWithResult(_0x2169d9,0xc9))[_0x76b0('0x41')](handleError(_0x2169d9,null));};exports['update']=function(_0x192f23,_0x4a9c7e){if(_0x192f23[_0x76b0('0x46')]['id']){delete _0x192f23['body']['id'];}return db['Dynamics365Field'][_0x76b0('0x44')]({'where':{'id':_0x192f23[_0x76b0('0x43')]['id']}})[_0x76b0('0x3c')](handleEntityNotFound(_0x4a9c7e,null))[_0x76b0('0x3c')](saveUpdates(_0x192f23[_0x76b0('0x46')],null))['then'](respondWithResult(_0x4a9c7e,null))[_0x76b0('0x41')](handleError(_0x4a9c7e,null));};exports[_0x76b0('0x21')]=function(_0x4d0c7f,_0x37de8b){return db['Dynamics365Field']['find']({'where':{'id':_0x4d0c7f[_0x76b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x37de8b,null))[_0x76b0('0x3c')](removeEntity(_0x37de8b,null))[_0x76b0('0x41')](handleError(_0x37de8b,null));}; \ No newline at end of file +var _0xcdc8=['rows','catch','show','params','includeAll','merge','find','create','body','update','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','then','error','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcdc8,0x1a9));var _0x8cdc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xcdc8[_0x543084];return _0x306a57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cdc('0x2'));var moment=require(_0x8cdc('0x3'));var BPromise=require(_0x8cdc('0x4'));var Mustache=require('mustache');var util=require(_0x8cdc('0x5'));var path=require(_0x8cdc('0x6'));var sox=require(_0x8cdc('0x7'));var csv=require(_0x8cdc('0x8'));var ejs=require(_0x8cdc('0x9'));var fs=require('fs');var _=require(_0x8cdc('0xa'));var squel=require('squel');var crypto=require(_0x8cdc('0xb'));var jsforce=require(_0x8cdc('0xc'));var deskjs=require(_0x8cdc('0xd'));var toCsv=require(_0x8cdc('0x8'));var querystring=require('querystring');var Papa=require(_0x8cdc('0xe'));var Redis=require(_0x8cdc('0xf'));var authService=require(_0x8cdc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8cdc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cdc('0x12'));var utils=require(_0x8cdc('0x13'));var config=require(_0x8cdc('0x14'));var db=require(_0x8cdc('0x15'))['db'];function respondWithStatusCode(_0x4a9532,_0x39e0c4){_0x39e0c4=_0x39e0c4||0xcc;return function(_0x5c6ef5){if(_0x5c6ef5){return _0x4a9532[_0x8cdc('0x16')](_0x39e0c4);}return _0x4a9532[_0x8cdc('0x17')](_0x39e0c4)[_0x8cdc('0x18')]();};}function respondWithResult(_0x3b8f37,_0x535c38){_0x535c38=_0x535c38||0xc8;return function(_0x59261b){if(_0x59261b){return _0x3b8f37['status'](_0x535c38)[_0x8cdc('0x19')](_0x59261b);}};}function respondWithFilteredResult(_0xeec547,_0x3e1b28){return function(_0x251f52){if(_0x251f52){var _0x5c3926=_0x251f52[_0x8cdc('0x1a')],_0x5cbd98=_0x3e1b28[_0x8cdc('0x1b')],_0x4adb6d=_0x3e1b28[_0x8cdc('0x1b')]+_0x3e1b28[_0x8cdc('0x1c')],_0x30ffe9;if(_0x4adb6d>=_0x5c3926){_0x4adb6d=_0x5c3926;_0x30ffe9=0xc8;}else{_0x30ffe9=0xce;}_0xeec547[_0x8cdc('0x17')](_0x30ffe9);return _0xeec547[_0x8cdc('0x1d')]('Content-Range',_0x5cbd98+'-'+_0x4adb6d+'/'+_0x5c3926)[_0x8cdc('0x19')](_0x251f52);}return null;};}function patchUpdates(_0x166deb){return function(_0x56fb9a){try{jsonpatch[_0x8cdc('0x1e')](_0x56fb9a,_0x166deb,!![]);}catch(_0x52f397){return BPromise['reject'](_0x52f397);}return _0x56fb9a['save']();};}function saveUpdates(_0x21ca2a,_0x10ef90){return function(_0x3dea43){if(_0x3dea43){return _0x3dea43['update'](_0x21ca2a)[_0x8cdc('0x1f')](function(_0x1e066e){return _0x1e066e;});}return null;};}function removeEntity(_0x25c5be,_0x4a1715){return function(_0x5edbcb){if(_0x5edbcb){return _0x5edbcb['destroy']()[_0x8cdc('0x1f')](function(){_0x25c5be[_0x8cdc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4e79c,_0x36a3bf){return function(_0x43ed33){if(!_0x43ed33){_0xe4e79c[_0x8cdc('0x16')](0x194);}return _0x43ed33;};}function handleError(_0x19b149,_0x489952){_0x489952=_0x489952||0x1f4;return function(_0x4ce0b9){logger[_0x8cdc('0x20')](_0x4ce0b9[_0x8cdc('0x21')]);if(_0x4ce0b9[_0x8cdc('0x22')]){delete _0x4ce0b9[_0x8cdc('0x22')];}_0x19b149[_0x8cdc('0x17')](_0x489952)[_0x8cdc('0x23')](_0x4ce0b9);};}exports['index']=function(_0x2b750c,_0x365299){var _0x11aad7={},_0xfc9ff4={},_0x120a0e={'count':0x0,'rows':[]};var _0x43f28f=_['map'](db[_0x8cdc('0x24')][_0x8cdc('0x25')],function(_0x4f896c){return{'name':_0x4f896c[_0x8cdc('0x26')],'type':_0x4f896c[_0x8cdc('0x27')][_0x8cdc('0x28')]};});_0xfc9ff4[_0x8cdc('0x29')]=_[_0x8cdc('0x2a')](_0x43f28f,_0x8cdc('0x22'));_0xfc9ff4['query']=_[_0x8cdc('0x2b')](_0x2b750c['query']);_0xfc9ff4[_0x8cdc('0x2c')]=_[_0x8cdc('0x2d')](_0xfc9ff4[_0x8cdc('0x29')],_0xfc9ff4[_0x8cdc('0x2e')]);_0x11aad7['attributes']=_[_0x8cdc('0x2d')](_0xfc9ff4[_0x8cdc('0x29')],qs[_0x8cdc('0x2f')](_0x2b750c[_0x8cdc('0x2e')][_0x8cdc('0x2f')]));_0x11aad7[_0x8cdc('0x30')]=_0x11aad7[_0x8cdc('0x30')][_0x8cdc('0x31')]?_0x11aad7[_0x8cdc('0x30')]:_0xfc9ff4[_0x8cdc('0x29')];if(!_0x2b750c[_0x8cdc('0x2e')][_0x8cdc('0x32')](_0x8cdc('0x33'))){_0x11aad7['limit']=qs[_0x8cdc('0x1c')](_0x2b750c['query'][_0x8cdc('0x1c')]);_0x11aad7[_0x8cdc('0x1b')]=qs['offset'](_0x2b750c['query']['offset']);}_0x11aad7[_0x8cdc('0x34')]=qs['sort'](_0x2b750c[_0x8cdc('0x2e')]['sort']);_0x11aad7[_0x8cdc('0x35')]=qs[_0x8cdc('0x2c')](_[_0x8cdc('0x36')](_0x2b750c[_0x8cdc('0x2e')],_0xfc9ff4['filters']),_0x43f28f);if(_0x2b750c[_0x8cdc('0x2e')][_0x8cdc('0x37')]){_0x11aad7[_0x8cdc('0x35')]=_['merge'](_0x11aad7['where'],{'$or':_['map'](_0x43f28f,function(_0x195a8d){if(_0x195a8d[_0x8cdc('0x27')]!==_0x8cdc('0x38')){var _0x3dd48f={};_0x3dd48f[_0x195a8d[_0x8cdc('0x22')]]={'$like':'%'+_0x2b750c[_0x8cdc('0x2e')][_0x8cdc('0x37')]+'%'};return _0x3dd48f;}})});}_0x11aad7=_['merge']({},_0x11aad7,_0x2b750c[_0x8cdc('0x39')]);var _0x374689={'where':_0x11aad7[_0x8cdc('0x35')]};return db[_0x8cdc('0x24')]['count'](_0x374689)[_0x8cdc('0x1f')](function(_0x45a512){_0x120a0e[_0x8cdc('0x1a')]=_0x45a512;if(_0x2b750c[_0x8cdc('0x2e')]['includeAll']){_0x11aad7['include']=[{'all':!![]}];}return db[_0x8cdc('0x24')]['findAll'](_0x11aad7);})[_0x8cdc('0x1f')](function(_0x2d2edc){_0x120a0e[_0x8cdc('0x3a')]=_0x2d2edc;return _0x120a0e;})[_0x8cdc('0x1f')](respondWithFilteredResult(_0x365299,_0x11aad7))[_0x8cdc('0x3b')](handleError(_0x365299,null));};exports[_0x8cdc('0x3c')]=function(_0x4d6570,_0x2d8157){var _0x5347bd={'raw':!![],'where':{'id':_0x4d6570[_0x8cdc('0x3d')]['id']}},_0x4d34a8={};_0x4d34a8[_0x8cdc('0x29')]=_[_0x8cdc('0x2b')](db['Dynamics365Field']['rawAttributes']);_0x4d34a8[_0x8cdc('0x2e')]=_['keys'](_0x4d6570[_0x8cdc('0x2e')]);_0x4d34a8[_0x8cdc('0x2c')]=_[_0x8cdc('0x2d')](_0x4d34a8['model'],_0x4d34a8['query']);_0x5347bd['attributes']=_[_0x8cdc('0x2d')](_0x4d34a8['model'],qs['fields'](_0x4d6570['query']['fields']));_0x5347bd['attributes']=_0x5347bd[_0x8cdc('0x30')][_0x8cdc('0x31')]?_0x5347bd[_0x8cdc('0x30')]:_0x4d34a8[_0x8cdc('0x29')];if(_0x4d6570[_0x8cdc('0x2e')][_0x8cdc('0x3e')]){_0x5347bd['include']=[{'all':!![]}];}_0x5347bd=_[_0x8cdc('0x3f')]({},_0x5347bd,_0x4d6570[_0x8cdc('0x39')]);return db[_0x8cdc('0x24')][_0x8cdc('0x40')](_0x5347bd)[_0x8cdc('0x1f')](handleEntityNotFound(_0x2d8157,null))['then'](respondWithResult(_0x2d8157,null))[_0x8cdc('0x3b')](handleError(_0x2d8157,null));};exports['create']=function(_0x41b6b9,_0x1680fd){return db[_0x8cdc('0x24')][_0x8cdc('0x41')](_0x41b6b9[_0x8cdc('0x42')],{})[_0x8cdc('0x1f')](respondWithResult(_0x1680fd,0xc9))['catch'](handleError(_0x1680fd,null));};exports[_0x8cdc('0x43')]=function(_0x46f0a1,_0x2b5d76){if(_0x46f0a1[_0x8cdc('0x42')]['id']){delete _0x46f0a1['body']['id'];}return db[_0x8cdc('0x24')][_0x8cdc('0x40')]({'where':{'id':_0x46f0a1['params']['id']}})[_0x8cdc('0x1f')](handleEntityNotFound(_0x2b5d76,null))['then'](saveUpdates(_0x46f0a1[_0x8cdc('0x42')],null))[_0x8cdc('0x1f')](respondWithResult(_0x2b5d76,null))[_0x8cdc('0x3b')](handleError(_0x2b5d76,null));};exports[_0x8cdc('0x44')]=function(_0x4d518f,_0x107a1c){return db['Dynamics365Field'][_0x8cdc('0x40')]({'where':{'id':_0x4d518f[_0x8cdc('0x3d')]['id']}})[_0x8cdc('0x1f')](handleEntityNotFound(_0x107a1c,null))[_0x8cdc('0x1f')](removeEntity(_0x107a1c,null))['catch'](handleError(_0x107a1c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ebe35ea..03890e2 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 _0x126b=['path','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','moment','request-promise'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x126b,0x1a0));var _0xb126=function(_0x3dad48,_0x2dc6c6){_0x3dad48=_0x3dad48-0x0;var _0x2f299f=_0x126b[_0x3dad48];return _0x2f299f;};'use strict';var _=require(_0xb126('0x0'));var util=require('util');var logger=require(_0xb126('0x1'))('api');var moment=require(_0xb126('0x2'));var BPromise=require('bluebird');var rp=require(_0xb126('0x3'));var fs=require('fs');var path=require(_0xb126('0x4'));var rimraf=require('rimraf');var config=require(_0xb126('0x5'));var attributes=require(_0xb126('0x6'));module[_0xb126('0x7')]=function(_0x5a7566,_0x41c40f){return _0x5a7566['define']('Dynamics365Field',attributes,{'tableName':_0xb126('0x8'),'paranoid':![],'indexes':[{'name':_0xb126('0x9'),'fields':[_0xb126('0xa'),_0xb126('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad84=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x30cc6b,_0x21c742){var _0x3900f1=function(_0x3cccce){while(--_0x3cccce){_0x30cc6b['push'](_0x30cc6b['shift']());}};_0x3900f1(++_0x21c742);}(_0xad84,0x172));var _0x4ad8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xad84[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4ad8('0x0'));var util=require(_0x4ad8('0x1'));var logger=require(_0x4ad8('0x2'))(_0x4ad8('0x3'));var moment=require(_0x4ad8('0x4'));var BPromise=require(_0x4ad8('0x5'));var rp=require(_0x4ad8('0x6'));var fs=require('fs');var path=require(_0x4ad8('0x7'));var rimraf=require(_0x4ad8('0x8'));var config=require('../../config/environment');var attributes=require(_0x4ad8('0x9'));module['exports']=function(_0x4c22a2,_0x392a1c){return _0x4c22a2[_0x4ad8('0xa')](_0x4ad8('0xb'),attributes,{'tableName':_0x4ad8('0xc'),'paranoid':![],'indexes':[{'name':_0x4ad8('0xd'),'fields':[_0x4ad8('0xe'),_0x4ad8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index dd10bef..60c8ca0 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 _0xb470=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message'];(function(_0x352358,_0x30736f){var _0x23e5c6=function(_0x18c155){while(--_0x18c155){_0x352358['push'](_0x352358['shift']());}};_0x23e5c6(++_0x30736f);}(_0xb470,0x75));var _0x0b47=function(_0x26eebf,_0x58ccc8){_0x26eebf=_0x26eebf-0x0;var _0x98dc4c=_0xb470[_0x26eebf];return _0x98dc4c;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var BPromise=require(_0x0b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b47('0x4'));var db=require(_0x0b47('0x5'))['db'];var utils=require(_0x0b47('0x6'));var logger=require('../../config/logger')(_0x0b47('0x7'));var config=require(_0x0b47('0x8'));var jayson=require(_0x0b47('0x9'));var client=jayson[_0x0b47('0xa')][_0x0b47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d960,_0x201ab2,_0x37eb18){return new BPromise(function(_0x4bfebf,_0x56543c){return client['request'](_0x23d960,_0x37eb18)['then'](function(_0x38523d){logger[_0x0b47('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x201ab2,_0x0b47('0xd'));logger[_0x0b47('0xe')](_0x0b47('0xf'),_0x201ab2,_0x0b47('0xd'),JSON[_0x0b47('0x10')](_0x38523d));if(_0x38523d[_0x0b47('0x11')]){if(_0x38523d[_0x0b47('0x11')][_0x0b47('0x12')]===0x1f4){logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error']['message']);return _0x56543c(_0x38523d[_0x0b47('0x11')]['message']);}logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error'][_0x0b47('0x14')]);return _0x4bfebf(_0x38523d[_0x0b47('0x11')][_0x0b47('0x14')]);}else{logger[_0x0b47('0xc')](_0x0b47('0x13'),_0x201ab2,_0x0b47('0xd'));_0x4bfebf(_0x38523d[_0x0b47('0x15')][_0x0b47('0x14')]);}})[_0x0b47('0x16')](function(_0x1da847){logger['error'](_0x0b47('0x13'),_0x201ab2,_0x1da847);_0x56543c(_0x1da847);});});} \ No newline at end of file +var _0xaf1b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x181369,_0x561f38){_0x181369=_0x181369-0x0;var _0x439559=_0xaf1b[_0x181369];return _0x439559;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var moment=require(_0xbaf1('0x2'));var BPromise=require(_0xbaf1('0x3'));var rs=require(_0xbaf1('0x4'));var fs=require('fs');var Redis=require(_0xbaf1('0x5'));var db=require(_0xbaf1('0x6'))['db'];var utils=require(_0xbaf1('0x7'));var logger=require(_0xbaf1('0x8'))(_0xbaf1('0x9'));var config=require(_0xbaf1('0xa'));var jayson=require(_0xbaf1('0xb'));var client=jayson[_0xbaf1('0xc')][_0xbaf1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x548a29,_0x2e05b5,_0x5f337d){return new BPromise(function(_0x16a74d,_0x4eeec4){return client[_0xbaf1('0xe')](_0x548a29,_0x5f337d)[_0xbaf1('0xf')](function(_0x41a0ba){logger['info'](_0xbaf1('0x10'),_0x2e05b5,_0xbaf1('0x11'));logger['debug'](_0xbaf1('0x12'),_0x2e05b5,'request\x20sent',JSON[_0xbaf1('0x13')](_0x41a0ba));if(_0x41a0ba[_0xbaf1('0x14')]){if(_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x15')]===0x1f4){logger[_0xbaf1('0x14')](_0xbaf1('0x10'),_0x2e05b5,_0x41a0ba['error']['message']);return _0x4eeec4(_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x16')]);}logger[_0xbaf1('0x14')](_0xbaf1('0x10'),_0x2e05b5,_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x16')]);return _0x16a74d(_0x41a0ba[_0xbaf1('0x14')]['message']);}else{logger[_0xbaf1('0x17')](_0xbaf1('0x10'),_0x2e05b5,_0xbaf1('0x11'));_0x16a74d(_0x41a0ba[_0xbaf1('0x18')][_0xbaf1('0x16')]);}})[_0xbaf1('0x19')](function(_0x199252){logger[_0xbaf1('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x2e05b5,_0x199252);_0x4eeec4(_0x199252);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f0d6873..0b677b2 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 _0x83bb=['/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x1b941a,_0x5df292){var _0x335598=function(_0x1aef86){while(--_0x1aef86){_0x1b941a['push'](_0x1b941a['shift']());}};_0x335598(++_0x5df292);}(_0x83bb,0xc6));var _0xb83b=function(_0x12da64,_0x5dfa9f){_0x12da64=_0x12da64-0x0;var _0x4c520a=_0x83bb[_0x12da64];return _0x4c520a;};'use strict';var multer=require(_0xb83b('0x0'));var util=require(_0xb83b('0x1'));var path=require(_0xb83b('0x2'));var timeout=require(_0xb83b('0x3'));var express=require('express');var router=express[_0xb83b('0x4')]();var auth=require(_0xb83b('0x5'));var interaction=require(_0xb83b('0x6'));var config=require('../../config/environment');var controller=require(_0xb83b('0x7'));router[_0xb83b('0x8')]('/',auth[_0xb83b('0x9')](),controller['index']);router[_0xb83b('0x8')](_0xb83b('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb83b('0xb'),auth['isAuthenticated'](),controller[_0xb83b('0xc')]);router['get']('/:id/fields',auth[_0xb83b('0x9')](),controller['getFields']);router[_0xb83b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb83b('0xd')]('/:id/configurations',auth[_0xb83b('0x9')](),controller[_0xb83b('0xe')]);router[_0xb83b('0xf')]('/:id',auth[_0xb83b('0x9')](),controller[_0xb83b('0x10')]);router[_0xb83b('0x11')](_0xb83b('0xa'),auth[_0xb83b('0x9')](),controller['destroy']);module[_0xb83b('0x12')]=router; \ No newline at end of file +var _0xff9f=['./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1603e2,_0x3e4662){var _0x80fb02=function(_0x4f5854){while(--_0x4f5854){_0x1603e2['push'](_0x1603e2['shift']());}};_0x80fb02(++_0x3e4662);}(_0xff9f,0x120));var _0xfff9=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0xff9f[_0xb1174e];return _0x285bac;};'use strict';var multer=require(_0xfff9('0x0'));var util=require(_0xfff9('0x1'));var path=require('path');var timeout=require(_0xfff9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xfff9('0x3'));var interaction=require(_0xfff9('0x4'));var config=require(_0xfff9('0x5'));var controller=require(_0xfff9('0x6'));router[_0xfff9('0x7')]('/',auth['isAuthenticated'](),controller[_0xfff9('0x8')]);router[_0xfff9('0x7')](_0xfff9('0x9'),auth[_0xfff9('0xa')](),controller[_0xfff9('0xb')]);router[_0xfff9('0x7')](_0xfff9('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xfff9('0xd'),auth[_0xfff9('0xa')](),controller[_0xfff9('0xe')]);router[_0xfff9('0xf')]('/',auth[_0xfff9('0xa')](),controller[_0xfff9('0x10')]);router[_0xfff9('0xf')](_0xfff9('0xc'),auth[_0xfff9('0xa')](),controller['addConfiguration']);router[_0xfff9('0x11')]('/:id',auth[_0xfff9('0xa')](),controller[_0xfff9('0x12')]);router[_0xfff9('0x13')](_0xfff9('0x9'),auth[_0xfff9('0xa')](),controller['destroy']);module[_0xfff9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 316b82d..9bcfc89 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 _0x9e6d=['remoteUri','sequelize','STRING'];(function(_0x286a30,_0x35af81){var _0x4a44ae=function(_0x4fd260){while(--_0x4fd260){_0x286a30['push'](_0x286a30['shift']());}};_0x4a44ae(++_0x35af81);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x820016,_0xfa64c2){_0x820016=_0x820016-0x0;var _0x5cc9c7=_0x9e6d[_0x820016];return _0x5cc9c7;};'use strict';var Sequelize=require(_0xd9e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9e6('0x1')]},'description':{'type':Sequelize[_0xd9e6('0x1')]},'username':{'type':Sequelize[_0xd9e6('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xd9e6('0x1')]},'remoteUri':{'type':Sequelize[_0xd9e6('0x1')],'unique':_0xd9e6('0x2')},'serverUrl':{'type':Sequelize[_0xd9e6('0x1')]}}; \ No newline at end of file +var _0xa329=['STRING','username','sequelize','exports'];(function(_0x15c19a,_0xd4667b){var _0x3290d9=function(_0x1c533d){while(--_0x1c533d){_0x15c19a['push'](_0x15c19a['shift']());}};_0x3290d9(++_0xd4667b);}(_0xa329,0x162));var _0x9a32=function(_0x7440e0,_0x42d9b8){_0x7440e0=_0x7440e0-0x0;var _0x33ee99=_0xa329[_0x7440e0];return _0x33ee99;};'use strict';var Sequelize=require(_0x9a32('0x0'));module[_0x9a32('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9a32('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9a32('0x3')},'apiKey':{'type':Sequelize[_0x9a32('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x9a32('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f08787f..4114077 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 _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x56a28a,_0x12b812){var _0x2f0161=function(_0x39c580){while(--_0x39c580){_0x56a28a['push'](_0x56a28a['shift']());}};_0x2f0161(++_0x12b812);}(_0xe14b,0x93));var _0xbe14=function(_0x478e34,_0x4960b4){_0x478e34=_0x478e34-0x0;var _0x2d96f0=_0xe14b[_0x478e34];return _0x2d96f0;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file +var _0xabce=['%s/%s','api/v2/ticket_fields','base64','requester','agent','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','FreshdeskAccount','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','getSubjects','channel','getDescriptions','type','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','substring','GET','format'];(function(_0x326018,_0x2fba05){var _0x1d7ccf=function(_0x5e12df){while(--_0x5e12df){_0x326018['push'](_0x326018['shift']());}};_0x1d7ccf(++_0x2fba05);}(_0xabce,0x103));var _0xeabc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xabce[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];var integrations=require(_0xeabc('0x19'));var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53df9c,_0x235c2d,_0x1319f3){if(_0x1319f3){var _0x3251c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3251c6['test'](_0x235c2d)){return _0x53df9c;}else{throw new db['Sequelize'][(_0xeabc('0x1d'))](_0xeabc('0x1e'));}}else{return _0x53df9c;}}function respondWithRpcPromise(_0x326bac,_0x53d5cb,_0xf913d7,_0x638976){return new BPromise(function(_0x49f2d8,_0x53fe28){var _0x10fa8e=_0x638976||client;return _0x10fa8e['request'](_0x326bac,_0xf913d7)[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x53d5cb,_0xeabc('0x22'),JSON['stringify'](_0x1b64b9));if(_0x1b64b9[_0xeabc('0x25')]){if(_0x1b64b9['error'][_0xeabc('0x26')]===0x1f4){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x53fe28(_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);}logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x49f2d8(_0x1b64b9[_0xeabc('0x25')]['message']);}else{logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));_0x49f2d8(_0x1b64b9[_0xeabc('0x28')]['message']);}})[_0xeabc('0x29')](function(_0x480440){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x480440);_0x53fe28(_0x480440);});});}function respondWithStatusCode(_0x811f0d,_0x12acbd){_0x12acbd=_0x12acbd||0xcc;return function(_0x269621){if(_0x269621){return _0x811f0d[_0xeabc('0x2a')](_0x12acbd);}return _0x811f0d[_0xeabc('0x2b')](_0x12acbd)[_0xeabc('0x2c')]();};}function respondWithResult(_0x131722,_0x4c2693){_0x4c2693=_0x4c2693||0xc8;return function(_0x5b2934){if(_0x5b2934){return _0x131722[_0xeabc('0x2b')](_0x4c2693)['json'](_0x5b2934);}};}function respondWithFilteredResult(_0x3c1b5b,_0x2b342c){return function(_0x48fb52){if(_0x48fb52){var _0x2163e6=_0x48fb52[_0xeabc('0x2d')],_0x38572d=_0x2b342c[_0xeabc('0x2e')],_0x2b568f=_0x2b342c[_0xeabc('0x2e')]+_0x2b342c[_0xeabc('0x2f')],_0x2f8633;if(_0x2b568f>=_0x2163e6){_0x2b568f=_0x2163e6;_0x2f8633=0xc8;}else{_0x2f8633=0xce;}_0x3c1b5b[_0xeabc('0x2b')](_0x2f8633);return _0x3c1b5b['set'](_0xeabc('0x30'),_0x38572d+'-'+_0x2b568f+'/'+_0x2163e6)['json'](_0x48fb52);}return null;};}function patchUpdates(_0x2f03e8){return function(_0x2d027e){try{jsonpatch[_0xeabc('0x31')](_0x2d027e,_0x2f03e8,!![]);}catch(_0x3c606a){return BPromise[_0xeabc('0x32')](_0x3c606a);}return _0x2d027e[_0xeabc('0x33')]();};}function saveUpdates(_0x61c0af,_0x545d7f){return function(_0x78510a){if(_0x78510a){return _0x78510a[_0xeabc('0x34')](_0x61c0af)[_0xeabc('0x1f')](function(_0x4918e2){return _0x4918e2;});}return null;};}function removeEntity(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(_0x4492fd){return _0x4492fd['destroy']()[_0xeabc('0x1f')](function(){_0x1e74ca[_0xeabc('0x2b')](0xcc)[_0xeabc('0x2c')]();});}};}function handleEntityNotFound(_0x521091,_0xf98c7c){return function(_0x286203){if(!_0x286203){_0x521091['sendStatus'](0x194);}return _0x286203;};}function handleError(_0x50cca2,_0x254568){_0x254568=_0x254568||0x1f4;return function(_0x3829a9){logger['error'](_0x3829a9[_0xeabc('0x35')]);if(_0x3829a9[_0xeabc('0x36')]){delete _0x3829a9[_0xeabc('0x36')];}_0x50cca2[_0xeabc('0x2b')](_0x254568)[_0xeabc('0x37')](_0x3829a9);};}exports['index']=function(_0x353e48,_0x5b61fa){var _0x31ee7a={},_0x2bda29={},_0x311291={'count':0x0,'rows':[]};var _0x5b52c4=_['map'](db[_0xeabc('0x38')]['rawAttributes'],function(_0x113d5a){return{'name':_0x113d5a['fieldName'],'type':_0x113d5a['type']['key']};});_0x2bda29['model']=_[_0xeabc('0x39')](_0x5b52c4,'name');_0x2bda29[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x353e48['query']);_0x2bda29[_0xeabc('0x3c')]=_['intersection'](_0x2bda29[_0xeabc('0x3d')],_0x2bda29['query']);_0x31ee7a[_0xeabc('0x3e')]=_[_0xeabc('0x3f')](_0x2bda29[_0xeabc('0x3d')],qs['fields'](_0x353e48['query']['fields']));_0x31ee7a[_0xeabc('0x3e')]=_0x31ee7a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x31ee7a['attributes']:_0x2bda29['model'];if(!_0x353e48[_0xeabc('0x3a')][_0xeabc('0x41')]('nolimit')){_0x31ee7a[_0xeabc('0x2f')]=qs['limit'](_0x353e48[_0xeabc('0x3a')]['limit']);_0x31ee7a['offset']=qs['offset'](_0x353e48[_0xeabc('0x3a')][_0xeabc('0x2e')]);}_0x31ee7a[_0xeabc('0x42')]=qs[_0xeabc('0x43')](_0x353e48['query'][_0xeabc('0x43')]);_0x31ee7a['where']=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x353e48[_0xeabc('0x3a')],_0x2bda29[_0xeabc('0x3c')]),_0x5b52c4);if(_0x353e48[_0xeabc('0x3a')]['filter']){_0x31ee7a['where']=_[_0xeabc('0x45')](_0x31ee7a['where'],{'$or':_[_0xeabc('0x39')](_0x5b52c4,function(_0x2cdf59){if(_0x2cdf59['type']!==_0xeabc('0x46')){var _0x2b3c28={};_0x2b3c28[_0x2cdf59[_0xeabc('0x36')]]={'$like':'%'+_0x353e48[_0xeabc('0x3a')][_0xeabc('0x47')]+'%'};return _0x2b3c28;}})});}_0x31ee7a=_[_0xeabc('0x45')]({},_0x31ee7a,_0x353e48[_0xeabc('0x48')]);var _0x4b2fb6={'where':_0x31ee7a[_0xeabc('0x49')]};return db[_0xeabc('0x38')][_0xeabc('0x2d')](_0x4b2fb6)[_0xeabc('0x1f')](function(_0x271f8c){_0x311291[_0xeabc('0x2d')]=_0x271f8c;if(_0x353e48[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x31ee7a[_0xeabc('0x4b')]=[{'all':!![]}];}return db[_0xeabc('0x38')]['findAll'](_0x31ee7a);})[_0xeabc('0x1f')](function(_0x2e6efb){_0x311291[_0xeabc('0x4c')]=_0x2e6efb;return _0x311291;})[_0xeabc('0x1f')](respondWithFilteredResult(_0x5b61fa,_0x31ee7a))[_0xeabc('0x29')](handleError(_0x5b61fa,null));};exports[_0xeabc('0x4d')]=function(_0x268d95,_0x48df43){var _0x766743={'raw':![],'where':{'id':_0x268d95[_0xeabc('0x4e')]['id']}},_0x32e09b={};_0x32e09b[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db['FreshdeskAccount'][_0xeabc('0x4f')]);_0x32e09b[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x268d95[_0xeabc('0x3a')]);_0x32e09b['filters']=_[_0xeabc('0x3f')](_0x32e09b[_0xeabc('0x3d')],_0x32e09b['query']);_0x766743[_0xeabc('0x3e')]=_['intersection'](_0x32e09b[_0xeabc('0x3d')],qs['fields'](_0x268d95[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x766743[_0xeabc('0x3e')]=_0x766743[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x766743[_0xeabc('0x3e')]:_0x32e09b[_0xeabc('0x3d')];if(_0x268d95[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x766743[_0xeabc('0x4b')]=[{'all':!![]}];}_0x766743=_['merge']({},_0x766743,_0x268d95[_0xeabc('0x48')]);return db[_0xeabc('0x38')][_0xeabc('0x51')](_0x766743)[_0xeabc('0x1f')](handleEntityNotFound(_0x48df43,null))['then'](respondWithResult(_0x48df43,null))[_0xeabc('0x29')](handleError(_0x48df43,null));};exports[_0xeabc('0x52')]=function(_0x10d56f,_0x21f972){return db['FreshdeskAccount'][_0xeabc('0x52')](_0x10d56f[_0xeabc('0x53')],{})[_0xeabc('0x1f')](respondWithResult(_0x21f972,0xc9))[_0xeabc('0x29')](handleError(_0x21f972,null));};exports[_0xeabc('0x34')]=function(_0x3b5e94,_0x14c322){if(_0x3b5e94[_0xeabc('0x53')]['id']){delete _0x3b5e94[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0x3b5e94['params']['id']}})['then'](handleEntityNotFound(_0x14c322,null))['then'](saveUpdates(_0x3b5e94[_0xeabc('0x53')],null))[_0xeabc('0x1f')](respondWithResult(_0x14c322,null))[_0xeabc('0x29')](handleError(_0x14c322,null));};exports[_0xeabc('0x54')]=function(_0xe89728,_0x2f78f3){return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0xe89728[_0xeabc('0x4e')]['id']}})[_0xeabc('0x1f')](handleEntityNotFound(_0x2f78f3,null))[_0xeabc('0x1f')](removeEntity(_0x2f78f3,null))[_0xeabc('0x29')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x55')]=function(_0x1750e9,_0x25c728,_0x5820ca){var _0x5b8370={};var _0x180e62={};var _0x340520;var _0x2c0894;return db['FreshdeskAccount'][_0xeabc('0x56')]({'where':{'id':_0x1750e9['params']['id']}})['then'](handleEntityNotFound(_0x25c728,null))[_0xeabc('0x1f')](function(_0x1fca99){if(_0x1fca99){_0x340520=_0x1fca99;_0x180e62[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db[_0xeabc('0x57')][_0xeabc('0x4f')]);_0x180e62['query']=_[_0xeabc('0x3b')](_0x1750e9[_0xeabc('0x3a')]);_0x180e62[_0xeabc('0x3c')]=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],_0x180e62[_0xeabc('0x3a')]);_0x5b8370['attributes']=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],qs[_0xeabc('0x50')](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x5b8370[_0xeabc('0x3e')]=_0x5b8370[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x5b8370[_0xeabc('0x3e')]:_0x180e62['model'];_0x5b8370[_0xeabc('0x42')]=qs['sort'](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x5b8370[_0xeabc('0x49')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x1750e9[_0xeabc('0x3a')],_0x180e62[_0xeabc('0x3c')]));if(_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x47')]){_0x5b8370[_0xeabc('0x49')]=_['merge'](_0x5b8370[_0xeabc('0x49')],{'$or':_[_0xeabc('0x39')](_0x5b8370[_0xeabc('0x3e')],function(_0x41cad5){var _0x5b4430={};_0x5b4430[_0x41cad5]={'$like':'%'+_0x1750e9[_0xeabc('0x3a')]['filter']+'%'};return _0x5b4430;})});}_0x5b8370=_['merge']({},_0x5b8370,_0x1750e9[_0xeabc('0x48')]);return _0x340520[_0xeabc('0x55')](_0x5b8370);}})[_0xeabc('0x1f')](function(_0x1c91e4){if(_0x1c91e4){_0x2c0894=_0x1c91e4['length'];if(!_0x1750e9['query'][_0xeabc('0x41')]('nolimit')){_0x5b8370['limit']=qs[_0xeabc('0x2f')](_0x1750e9['query']['limit']);_0x5b8370[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x1750e9['query']['offset']);}return _0x340520[_0xeabc('0x55')](_0x5b8370);}})['then'](function(_0x238e2d){if(_0x238e2d){return _0x238e2d?{'count':_0x2c0894,'rows':_0x238e2d}:null;}})[_0xeabc('0x1f')](respondWithResult(_0x25c728,null))['catch'](handleError(_0x25c728,null));};exports['addConfiguration']=function(_0x24365a,_0x74f5ac,_0xd86ea7){if(_0x24365a[_0xeabc('0x53')]['id']){delete _0x24365a[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24365a[_0xeabc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f5ac,null))[_0xeabc('0x1f')](function(_0x5086c6){if(_0x5086c6){_0x24365a[_0xeabc('0x53')]['AccountId']=_0x5086c6['id'];_0x24365a[_0xeabc('0x53')]['Subjects']=integrations[_0xeabc('0x58')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')]['type']);_0x24365a[_0xeabc('0x53')]['Descriptions']=integrations[_0xeabc('0x5a')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')][_0xeabc('0x5b')]);return db['FreshdeskConfiguration'][_0xeabc('0x52')](_0x24365a[_0xeabc('0x53')],{'include':[{'model':db[_0xeabc('0x5c')],'as':_0xeabc('0x5d')},{'model':db['FreshdeskField'],'as':_0xeabc('0x5e')}]});}return null;})[_0xeabc('0x1f')](respondWithResult(_0x74f5ac,null))[_0xeabc('0x29')](handleError(_0x74f5ac,null));};exports[_0xeabc('0x5f')]=function(_0x5bacbb,_0xb9b460,_0x368cd4){var _0x287f88='';return db[_0xeabc('0x38')]['findOne']({'where':{'id':_0x5bacbb['params']['id']},'attributes':['id',_0xeabc('0x60'),'apiKey']})['then'](handleEntityNotFound(_0xb9b460,null))[_0xeabc('0x1f')](function(_0x460f07){if(_0x460f07){_0x287f88=_0x460f07[_0xeabc('0x60')];var _0x49679d=_0x287f88[_0xeabc('0x61')](-0x1);if(_0x49679d==='/'){_0x287f88=_0x287f88[_0xeabc('0x62')](0x0,_0x287f88['lastIndexOf'](_0x49679d));}return rp({'method':_0xeabc('0x63'),'uri':util[_0xeabc('0x64')](_0xeabc('0x65'),_0x287f88,_0xeabc('0x66')),'headers':{'Authorization':util[_0xeabc('0x64')]('Basic\x20%s',new Buffer(util[_0xeabc('0x64')]('%s:X',_0x460f07['apiKey']))['toString'](_0xeabc('0x67')))},'json':!![]});}})[_0xeabc('0x1f')](function(_0x1b6e9e){if(_0x1b6e9e){var _0x4424ce=[_0xeabc('0x68'),'subject',_0xeabc('0x69'),'description',_0xeabc('0x2b'),_0xeabc('0x6a'),'group',_0xeabc('0x6b'),'ticket_type','group',_0xeabc('0x6c')];_[_0xeabc('0x6d')](_0x1b6e9e,function(_0x439a48){return _0x4424ce[_0xeabc('0x6e')](_0x439a48[_0xeabc('0x36')])||!_0x439a48['default']&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x6f')&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x70');});return{'count':_0x1b6e9e[_0xeabc('0x40')],'rows':_[_0xeabc('0x39')](_0x1b6e9e,function(_0x2d05b4){return{'id':_0x2d05b4[_0xeabc('0x36')],'name':_0x2d05b4[_0xeabc('0x71')],'custom':!_0x2d05b4[_0xeabc('0x72')],'options':_0x2d05b4['choices']?_[_0xeabc('0x39')](_0x2d05b4[_0xeabc('0x73')],function(_0xba29f){return{'name':_['capitalize'](_0xba29f),'value':_0xba29f};}):[]};})};}})['then'](respondWithResult(_0xb9b460,null))[_0xeabc('0x29')](function(_0x273ca5){var _0xe90200=_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?0x1f4:_0x273ca5['statusCode']||0x1f4;logger[_0xeabc('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xe90200,JSON[_0xeabc('0x75')](_0x273ca5));delete _0x273ca5[_0xeabc('0x36')];if(_0xe90200===0x191){_0xe90200=0x190;}_0xb9b460['status'](_0xe90200)[_0xeabc('0x37')](_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?{'message':_0xeabc('0x76'),'statusCode':_0x273ca5[_0xeabc('0x77')]}:_0x273ca5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e468ac5..381968d 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 _0x0e84=['request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1f9744,_0x54a947){var _0x5aba67=function(_0x14dade){while(--_0x14dade){_0x1f9744['push'](_0x1f9744['shift']());}};_0x5aba67(++_0x54a947);}(_0x0e84,0x10f));var _0x40e8=function(_0x611ba1,_0x145b7c){_0x611ba1=_0x611ba1-0x0;var _0x3d4dcc=_0x0e84[_0x611ba1];return _0x3d4dcc;};'use strict';var _=require(_0x40e8('0x0'));var util=require('util');var logger=require(_0x40e8('0x1'))(_0x40e8('0x2'));var moment=require(_0x40e8('0x3'));var BPromise=require(_0x40e8('0x4'));var rp=require(_0x40e8('0x5'));var fs=require('fs');var path=require(_0x40e8('0x6'));var rimraf=require('rimraf');var config=require(_0x40e8('0x7'));var attributes=require(_0x40e8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x40e8('0x9')]=function(_0x306d17,_0x1c1aec){return _0x306d17[_0x40e8('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x40e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc589=['moment','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','api'];(function(_0x4e6be0,_0x5472ff){var _0x3a3b95=function(_0x15bdef){while(--_0x15bdef){_0x4e6be0['push'](_0x4e6be0['shift']());}};_0x3a3b95(++_0x5472ff);}(_0xc589,0x11c));var _0x9c58=function(_0x650734,_0x5f2974){_0x650734=_0x650734-0x0;var _0x1ce2e9=_0xc589[_0x650734];return _0x1ce2e9;};'use strict';var _=require(_0x9c58('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9c58('0x1'));var moment=require(_0x9c58('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c58('0x3'));var rimraf=require('rimraf');var config=require(_0x9c58('0x4'));var attributes=require(_0x9c58('0x5'));var integrations=require(_0x9c58('0x6'));module[_0x9c58('0x7')]=function(_0x542dfb,_0x2bb5b0){return _0x542dfb[_0x9c58('0x8')](_0x9c58('0x9'),attributes,{'tableName':_0x9c58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 79cb213..a93289e 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 _0xacbf=['FreshdeskAccount','findAll','options','where','limit','map','include','model','attributes','ShowFreshdeskAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount'];(function(_0x5e1bc7,_0x5d61a5){var _0x314441=function(_0x532aa3){while(--_0x532aa3){_0x5e1bc7['push'](_0x5e1bc7['shift']());}};_0x314441(++_0x5d61a5);}(_0xacbf,0x78));var _0xfacb=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0xacbf[_0xce2ee4];return _0x3fd000;};'use strict';var _=require(_0xfacb('0x0'));var util=require(_0xfacb('0x1'));var moment=require('moment');var BPromise=require(_0xfacb('0x2'));var rs=require(_0xfacb('0x3'));var fs=require('fs');var Redis=require(_0xfacb('0x4'));var db=require(_0xfacb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfacb('0x6'))(_0xfacb('0x7'));var config=require(_0xfacb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfacb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fbe5f,_0x5277bc,_0x3bc59f){return new BPromise(function(_0x2ff379,_0x1af21f){return client[_0xfacb('0xa')](_0x2fbe5f,_0x3bc59f)[_0xfacb('0xb')](function(_0x481a10){logger['info'](_0xfacb('0xc'),_0x5277bc,_0xfacb('0xd'));logger[_0xfacb('0xe')](_0xfacb('0xf'),_0x5277bc,_0xfacb('0xd'),JSON[_0xfacb('0x10')](_0x481a10));if(_0x481a10[_0xfacb('0x11')]){if(_0x481a10[_0xfacb('0x11')][_0xfacb('0x12')]===0x1f4){logger['error'](_0xfacb('0xc'),_0x5277bc,_0x481a10[_0xfacb('0x11')][_0xfacb('0x13')]);return _0x1af21f(_0x481a10[_0xfacb('0x11')][_0xfacb('0x13')]);}logger['error'](_0xfacb('0xc'),_0x5277bc,_0x481a10[_0xfacb('0x11')][_0xfacb('0x13')]);return _0x2ff379(_0x481a10[_0xfacb('0x11')][_0xfacb('0x13')]);}else{logger[_0xfacb('0x14')](_0xfacb('0xc'),_0x5277bc,_0xfacb('0xd'));_0x2ff379(_0x481a10[_0xfacb('0x15')]['message']);}})[_0xfacb('0x16')](function(_0x3ee208){logger[_0xfacb('0x11')](_0xfacb('0xc'),_0x5277bc,_0x3ee208);_0x1af21f(_0x3ee208);});});}exports[_0xfacb('0x17')]=function(_0x651d9d){var _0xb780e6=this;return new Promise(function(_0x4b2ba2,_0xf64c52){return db[_0xfacb('0x18')][_0xfacb('0x19')]({'raw':_0x651d9d[_0xfacb('0x1a')]?_0x651d9d[_0xfacb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x651d9d[_0xfacb('0x1a')]?_0x651d9d[_0xfacb('0x1a')][_0xfacb('0x1b')]||null:null,'attributes':_0x651d9d[_0xfacb('0x1a')]?_0x651d9d[_0xfacb('0x1a')]['attributes']||null:null,'limit':_0x651d9d[_0xfacb('0x1a')]?_0x651d9d[_0xfacb('0x1a')][_0xfacb('0x1c')]||null:null,'include':_0x651d9d['options']?_0x651d9d['options']['include']?_[_0xfacb('0x1d')](_0x651d9d[_0xfacb('0x1a')][_0xfacb('0x1e')],function(_0x1b6c2e){return{'model':db[_0x1b6c2e['model']],'as':_0x1b6c2e['as'],'attributes':_0x1b6c2e['attributes'],'include':_0x1b6c2e['include']?_['map'](_0x1b6c2e['include'],function(_0x243260){return{'model':db[_0x243260[_0xfacb('0x1f')]],'as':_0x243260['as'],'attributes':_0x243260[_0xfacb('0x20')],'include':_0x243260[_0xfacb('0x1e')]?_[_0xfacb('0x1d')](_0x243260[_0xfacb('0x1e')],function(_0x1b647a){return{'model':db[_0x1b647a[_0xfacb('0x1f')]],'as':_0x1b647a['as'],'attributes':_0x1b647a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d91d4){logger[_0xfacb('0x14')](_0xfacb('0x17'),_0x651d9d);logger['debug'](_0xfacb('0x17'),_0x651d9d,JSON[_0xfacb('0x10')](_0x2d91d4));_0x4b2ba2(_0x2d91d4);})[_0xfacb('0x16')](function(_0x4d12d6){logger['error'](_0xfacb('0x17'),_0x4d12d6[_0xfacb('0x13')],_0x651d9d);_0xf64c52(_0xb780e6[_0xfacb('0x11')](0x1f4,_0x4d12d6['message']));});});};exports[_0xfacb('0x21')]=function(_0x482012){var _0x4c71d1=this;return new Promise(function(_0x252c87,_0x37711c){return db[_0xfacb('0x18')][_0xfacb('0x22')]({'raw':_0x482012['options']?_0x482012[_0xfacb('0x1a')][_0xfacb('0x23')]===undefined?!![]:![]:!![],'where':_0x482012[_0xfacb('0x1a')]?_0x482012[_0xfacb('0x1a')][_0xfacb('0x1b')]||null:null,'attributes':_0x482012[_0xfacb('0x1a')]?_0x482012[_0xfacb('0x1a')][_0xfacb('0x20')]||null:null,'include':_0x482012[_0xfacb('0x1a')]?_0x482012[_0xfacb('0x1a')][_0xfacb('0x1e')]?_[_0xfacb('0x1d')](_0x482012[_0xfacb('0x1a')][_0xfacb('0x1e')],function(_0x243fb5){return{'model':db[_0x243fb5[_0xfacb('0x1f')]],'as':_0x243fb5['as'],'attributes':_0x243fb5['attributes'],'include':_0x243fb5['include']?_['map'](_0x243fb5[_0xfacb('0x1e')],function(_0x8cc29d){return{'model':db[_0x8cc29d[_0xfacb('0x1f')]],'as':_0x8cc29d['as'],'attributes':_0x8cc29d['attributes'],'include':_0x8cc29d['include']?_['map'](_0x8cc29d[_0xfacb('0x1e')],function(_0x171d58){return{'model':db[_0x171d58[_0xfacb('0x1f')]],'as':_0x171d58['as'],'attributes':_0x171d58[_0xfacb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfacb('0xb')](function(_0x45b773){logger[_0xfacb('0x14')](_0xfacb('0x21'),_0x482012);logger[_0xfacb('0xe')]('ShowFreshdeskAccount',_0x482012,JSON[_0xfacb('0x10')](_0x45b773));_0x252c87(_0x45b773);})[_0xfacb('0x16')](function(_0x1e046a){logger[_0xfacb('0x11')](_0xfacb('0x21'),_0x1e046a[_0xfacb('0x13')],_0x482012);_0x37711c(_0x4c71d1[_0xfacb('0x11')](0x1f4,_0x1e046a['message']));});});}; \ No newline at end of file +var _0x902e=['info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','findAll','options','raw','where','include','model','attributes','map','debug','catch','ShowFreshdeskAccount','FreshdeskAccount','find','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2690aa,_0x8ed922){var _0x307fea=function(_0x4f877b){while(--_0x4f877b){_0x2690aa['push'](_0x2690aa['shift']());}};_0x307fea(++_0x8ed922);}(_0x902e,0x1d0));var _0xe902=function(_0x9b2ad2,_0x1a9ff9){_0x9b2ad2=_0x9b2ad2-0x0;var _0x4c5bcc=_0x902e[_0x9b2ad2];return _0x4c5bcc;};'use strict';var _=require(_0xe902('0x0'));var util=require(_0xe902('0x1'));var moment=require(_0xe902('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe902('0x3'))['db'];var utils=require(_0xe902('0x4'));var logger=require(_0xe902('0x5'))(_0xe902('0x6'));var config=require('../../config/environment');var jayson=require(_0xe902('0x7'));var client=jayson[_0xe902('0x8')][_0xe902('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c53aa,_0xdf6ff,_0x27ae67){return new BPromise(function(_0x255542,_0x45dd14){return client[_0xe902('0xa')](_0x1c53aa,_0x27ae67)[_0xe902('0xb')](function(_0x584845){logger[_0xe902('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0xdf6ff,'request\x20sent');logger['debug'](_0xe902('0xd'),_0xdf6ff,'request\x20sent',JSON['stringify'](_0x584845));if(_0x584845[_0xe902('0xe')]){if(_0x584845[_0xe902('0xe')][_0xe902('0xf')]===0x1f4){logger[_0xe902('0xe')](_0xe902('0x10'),_0xdf6ff,_0x584845[_0xe902('0xe')]['message']);return _0x45dd14(_0x584845[_0xe902('0xe')][_0xe902('0x11')]);}logger[_0xe902('0xe')](_0xe902('0x10'),_0xdf6ff,_0x584845[_0xe902('0xe')][_0xe902('0x11')]);return _0x255542(_0x584845[_0xe902('0xe')][_0xe902('0x11')]);}else{logger[_0xe902('0xc')](_0xe902('0x10'),_0xdf6ff,'request\x20sent');_0x255542(_0x584845[_0xe902('0x12')][_0xe902('0x11')]);}})['catch'](function(_0x12181b){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xdf6ff,_0x12181b);_0x45dd14(_0x12181b);});});}exports[_0xe902('0x13')]=function(_0x21cf70){var _0x55ed59=this;return new Promise(function(_0x1fbde9,_0x5a9256){return db['FreshdeskAccount'][_0xe902('0x14')]({'raw':_0x21cf70[_0xe902('0x15')]?_0x21cf70['options'][_0xe902('0x16')]===undefined?!![]:![]:!![],'where':_0x21cf70[_0xe902('0x15')]?_0x21cf70['options'][_0xe902('0x17')]||null:null,'attributes':_0x21cf70[_0xe902('0x15')]?_0x21cf70['options']['attributes']||null:null,'limit':_0x21cf70[_0xe902('0x15')]?_0x21cf70[_0xe902('0x15')]['limit']||null:null,'include':_0x21cf70[_0xe902('0x15')]?_0x21cf70[_0xe902('0x15')][_0xe902('0x18')]?_['map'](_0x21cf70[_0xe902('0x15')]['include'],function(_0x52bcb7){return{'model':db[_0x52bcb7[_0xe902('0x19')]],'as':_0x52bcb7['as'],'attributes':_0x52bcb7[_0xe902('0x1a')],'include':_0x52bcb7[_0xe902('0x18')]?_[_0xe902('0x1b')](_0x52bcb7[_0xe902('0x18')],function(_0x10114a){return{'model':db[_0x10114a[_0xe902('0x19')]],'as':_0x10114a['as'],'attributes':_0x10114a[_0xe902('0x1a')],'include':_0x10114a[_0xe902('0x18')]?_[_0xe902('0x1b')](_0x10114a[_0xe902('0x18')],function(_0x46c84f){return{'model':db[_0x46c84f[_0xe902('0x19')]],'as':_0x46c84f['as'],'attributes':_0x46c84f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe902('0xb')](function(_0x4c9ad3){logger[_0xe902('0xc')]('GetFreshdeskAccount',_0x21cf70);logger[_0xe902('0x1c')](_0xe902('0x13'),_0x21cf70,JSON['stringify'](_0x4c9ad3));_0x1fbde9(_0x4c9ad3);})[_0xe902('0x1d')](function(_0x412def){logger[_0xe902('0xe')](_0xe902('0x13'),_0x412def[_0xe902('0x11')],_0x21cf70);_0x5a9256(_0x55ed59[_0xe902('0xe')](0x1f4,_0x412def['message']));});});};exports[_0xe902('0x1e')]=function(_0x36d516){var _0x3e64f5=this;return new Promise(function(_0x58940e,_0x3b90bd){return db[_0xe902('0x1f')][_0xe902('0x20')]({'raw':_0x36d516[_0xe902('0x15')]?_0x36d516[_0xe902('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x36d516[_0xe902('0x15')]?_0x36d516[_0xe902('0x15')][_0xe902('0x17')]||null:null,'attributes':_0x36d516['options']?_0x36d516['options'][_0xe902('0x1a')]||null:null,'include':_0x36d516['options']?_0x36d516[_0xe902('0x15')][_0xe902('0x18')]?_[_0xe902('0x1b')](_0x36d516[_0xe902('0x15')][_0xe902('0x18')],function(_0x111b56){return{'model':db[_0x111b56[_0xe902('0x19')]],'as':_0x111b56['as'],'attributes':_0x111b56[_0xe902('0x1a')],'include':_0x111b56['include']?_[_0xe902('0x1b')](_0x111b56[_0xe902('0x18')],function(_0x413b35){return{'model':db[_0x413b35[_0xe902('0x19')]],'as':_0x413b35['as'],'attributes':_0x413b35['attributes'],'include':_0x413b35[_0xe902('0x18')]?_[_0xe902('0x1b')](_0x413b35['include'],function(_0x4f9e06){return{'model':db[_0x4f9e06[_0xe902('0x19')]],'as':_0x4f9e06['as'],'attributes':_0x4f9e06['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x567259){logger['info']('ShowFreshdeskAccount',_0x36d516);logger[_0xe902('0x1c')](_0xe902('0x1e'),_0x36d516,JSON[_0xe902('0x21')](_0x567259));_0x58940e(_0x567259);})[_0xe902('0x1d')](function(_0xc03168){logger[_0xe902('0xe')](_0xe902('0x1e'),_0xc03168[_0xe902('0x11')],_0x36d516);_0x3b90bd(_0x3e64f5['error'](0x1f4,_0xc03168[_0xe902('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index db87976..3fe6d6f 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 _0x6ed2=['index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x2a1b7d,_0x343761){var _0xc63df8=function(_0x1328a6){while(--_0x1328a6){_0x2a1b7d['push'](_0x2a1b7d['shift']());}};_0xc63df8(++_0x343761);}(_0x6ed2,0x123));var _0x26ed=function(_0x5e9efd,_0x4945ce){_0x5e9efd=_0x5e9efd-0x0;var _0x1bf6ac=_0x6ed2[_0x5e9efd];return _0x1bf6ac;};'use strict';var multer=require(_0x26ed('0x0'));var util=require(_0x26ed('0x1'));var path=require('path');var timeout=require(_0x26ed('0x2'));var express=require(_0x26ed('0x3'));var router=express[_0x26ed('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26ed('0x5'));var controller=require(_0x26ed('0x6'));router[_0x26ed('0x7')]('/',auth[_0x26ed('0x8')](),controller[_0x26ed('0x9')]);router[_0x26ed('0x7')](_0x26ed('0xa'),auth['isAuthenticated'](),controller[_0x26ed('0xb')]);router[_0x26ed('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x26ed('0xc')]);router[_0x26ed('0x7')](_0x26ed('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x26ed('0x7')](_0x26ed('0xe'),auth[_0x26ed('0x8')](),controller['getDescriptions']);router[_0x26ed('0x7')]('/:id/tags',auth[_0x26ed('0x8')](),controller[_0x26ed('0xf')]);router[_0x26ed('0x10')]('/',auth[_0x26ed('0x8')](),controller[_0x26ed('0x11')]);router[_0x26ed('0x10')](_0x26ed('0x12'),auth[_0x26ed('0x8')](),controller[_0x26ed('0x13')]);router[_0x26ed('0x14')](_0x26ed('0xa'),auth[_0x26ed('0x8')](),controller[_0x26ed('0x15')]);router[_0x26ed('0x16')](_0x26ed('0xa'),auth['isAuthenticated'](),controller[_0x26ed('0x17')]);module[_0x26ed('0x18')]=router; \ No newline at end of file +var _0x6386=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4c2e2f,_0x4f61a3){var _0x444db6=function(_0x543321){while(--_0x543321){_0x4c2e2f['push'](_0x4c2e2f['shift']());}};_0x444db6(++_0x4f61a3);}(_0x6386,0x93));var _0x6638=function(_0x3f571c,_0x40a28d){_0x3f571c=_0x3f571c-0x0;var _0x20b90f=_0x6386[_0x3f571c];return _0x20b90f;};'use strict';var multer=require('multer');var util=require(_0x6638('0x0'));var path=require(_0x6638('0x1'));var timeout=require(_0x6638('0x2'));var express=require('express');var router=express[_0x6638('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6638('0x4'));var config=require(_0x6638('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x6638('0x6')]('/',auth[_0x6638('0x7')](),controller[_0x6638('0x8')]);router[_0x6638('0x6')](_0x6638('0x9'),auth[_0x6638('0x7')](),controller['show']);router['get'](_0x6638('0xa'),auth[_0x6638('0x7')](),controller[_0x6638('0xb')]);router[_0x6638('0x6')](_0x6638('0xc'),auth[_0x6638('0x7')](),controller[_0x6638('0xd')]);router['get'](_0x6638('0xe'),auth[_0x6638('0x7')](),controller[_0x6638('0xf')]);router[_0x6638('0x6')](_0x6638('0x10'),auth[_0x6638('0x7')](),controller[_0x6638('0x11')]);router['post']('/',auth[_0x6638('0x7')](),controller['create']);router[_0x6638('0x12')](_0x6638('0x10'),auth[_0x6638('0x7')](),controller[_0x6638('0x13')]);router[_0x6638('0x14')](_0x6638('0x9'),auth[_0x6638('0x7')](),controller[_0x6638('0x15')]);router[_0x6638('0x16')](_0x6638('0x9'),auth[_0x6638('0x7')](),controller[_0x6638('0x17')]);module[_0x6638('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 34762c3..d8f6f33 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 _0xaed7=['exports','STRING','sequelize'];(function(_0x236607,_0x37f8e9){var _0x1a4b1e=function(_0x3b24ce){while(--_0x3b24ce){_0x236607['push'](_0x236607['shift']());}};_0x1a4b1e(++_0x37f8e9);}(_0xaed7,0x14f));var _0x7aed=function(_0x35dd1a,_0x4a52e2){_0x35dd1a=_0x35dd1a-0x0;var _0x1a74b8=_0xaed7[_0x35dd1a];return _0x1a74b8;};'use strict';var Sequelize=require(_0x7aed('0x0'));module[_0x7aed('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7aed('0x2')]}}; \ No newline at end of file +var _0x7992=['STRING','sequelize','exports'];(function(_0x2dfe3f,_0x524425){var _0x5ad8d0=function(_0x561e41){while(--_0x561e41){_0x2dfe3f['push'](_0x2dfe3f['shift']());}};_0x5ad8d0(++_0x524425);}(_0x7992,0x103));var _0x2799=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x7992[_0x1f7413];return _0x2d2775;};'use strict';var Sequelize=require(_0x2799('0x0'));module[_0x2799('0x1')]={'name':{'type':Sequelize[_0x2799('0x2')]},'description':{'type':Sequelize[_0x2799('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 78aa7cb..0faae94 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 _0xef72=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','status','json','offset','limit','set','Content-Range','apply','reject','update','end','sendStatus','stack','name','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','rawAttributes','find','create','body','params','getFields','findOne','FreshdeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','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','request\x20sent'];(function(_0x447d80,_0x3afd7f){var _0x8484d0=function(_0x51c33d){while(--_0x51c33d){_0x447d80['push'](_0x447d80['shift']());}};_0x8484d0(++_0x3afd7f);}(_0xef72,0xf8));var _0x2ef7=function(_0x5f311a,_0x4b3248){_0x5f311a=_0x5f311a-0x0;var _0x8fa17=_0xef72[_0x5f311a];return _0x8fa17;};'use strict';var pdf=require(_0x2ef7('0x0'));var emlformat=require(_0x2ef7('0x1'));var rimraf=require(_0x2ef7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ef7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2ef7('0x4'));var util=require(_0x2ef7('0x5'));var path=require(_0x2ef7('0x6'));var sox=require('sox');var csv=require(_0x2ef7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ef7('0x8'));var squel=require(_0x2ef7('0x9'));var crypto=require(_0x2ef7('0xa'));var jsforce=require(_0x2ef7('0xb'));var deskjs=require(_0x2ef7('0xc'));var toCsv=require(_0x2ef7('0x7'));var querystring=require('querystring');var Papa=require(_0x2ef7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2ef7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ef7('0xf'))(_0x2ef7('0x10'));var utils=require(_0x2ef7('0x11'));var config=require(_0x2ef7('0x12'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x2ef7('0x13')][_0x2ef7('0x14')]({'port':0x232a});function checkPasswordPattern(_0x253a63,_0x19ee81,_0x538aed){if(_0x538aed){var _0x7dac95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7dac95[_0x2ef7('0x15')](_0x19ee81)){return _0x253a63;}else{throw new db[(_0x2ef7('0x16'))]['ValidationError'](_0x2ef7('0x17'));}}else{return _0x253a63;}}function respondWithRpcPromise(_0x2750bc,_0x2f4751,_0x1bdf13,_0x59e4f6){return new BPromise(function(_0x1e4e7a,_0xb8b9e8){var _0x20bc17=_0x59e4f6||client;return _0x20bc17[_0x2ef7('0x18')](_0x2750bc,_0x1bdf13)[_0x2ef7('0x19')](function(_0x5d253b){logger[_0x2ef7('0x1a')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2f4751,_0x2ef7('0x1b'));logger[_0x2ef7('0x1c')](_0x2ef7('0x1d'),_0x2f4751,_0x2ef7('0x1b'),JSON[_0x2ef7('0x1e')](_0x5d253b));if(_0x5d253b[_0x2ef7('0x1f')]){if(_0x5d253b[_0x2ef7('0x1f')][_0x2ef7('0x20')]===0x1f4){logger['error'](_0x2ef7('0x21'),_0x2f4751,_0x5d253b[_0x2ef7('0x1f')][_0x2ef7('0x22')]);return _0xb8b9e8(_0x5d253b[_0x2ef7('0x1f')][_0x2ef7('0x22')]);}logger['error'](_0x2ef7('0x21'),_0x2f4751,_0x5d253b['error'][_0x2ef7('0x22')]);return _0x1e4e7a(_0x5d253b[_0x2ef7('0x1f')]['message']);}else{logger[_0x2ef7('0x1a')](_0x2ef7('0x21'),_0x2f4751,_0x2ef7('0x1b'));_0x1e4e7a(_0x5d253b['result'][_0x2ef7('0x22')]);}})[_0x2ef7('0x23')](function(_0x317a81){logger[_0x2ef7('0x1f')](_0x2ef7('0x21'),_0x2f4751,_0x317a81);_0xb8b9e8(_0x317a81);});});}function respondWithStatusCode(_0x554bd1,_0x4fd466){_0x4fd466=_0x4fd466||0xcc;return function(_0x18c40a){if(_0x18c40a){return _0x554bd1['sendStatus'](_0x4fd466);}return _0x554bd1[_0x2ef7('0x24')](_0x4fd466)['end']();};}function respondWithResult(_0x4ed136,_0x993447){_0x993447=_0x993447||0xc8;return function(_0x224ebd){if(_0x224ebd){return _0x4ed136[_0x2ef7('0x24')](_0x993447)[_0x2ef7('0x25')](_0x224ebd);}};}function respondWithFilteredResult(_0x21b791,_0x1d63b2){return function(_0x59b531){if(_0x59b531){var _0x2750a9=_0x59b531['count'],_0x1008b7=_0x1d63b2[_0x2ef7('0x26')],_0xb7356c=_0x1d63b2[_0x2ef7('0x26')]+_0x1d63b2[_0x2ef7('0x27')],_0x1f6575;if(_0xb7356c>=_0x2750a9){_0xb7356c=_0x2750a9;_0x1f6575=0xc8;}else{_0x1f6575=0xce;}_0x21b791[_0x2ef7('0x24')](_0x1f6575);return _0x21b791[_0x2ef7('0x28')](_0x2ef7('0x29'),_0x1008b7+'-'+_0xb7356c+'/'+_0x2750a9)[_0x2ef7('0x25')](_0x59b531);}return null;};}function patchUpdates(_0x1f7c35){return function(_0x3211b4){try{jsonpatch[_0x2ef7('0x2a')](_0x3211b4,_0x1f7c35,!![]);}catch(_0x19f8f0){return BPromise[_0x2ef7('0x2b')](_0x19f8f0);}return _0x3211b4['save']();};}function saveUpdates(_0x13a673,_0x12057e){return function(_0x4d1a5c){if(_0x4d1a5c){return _0x4d1a5c[_0x2ef7('0x2c')](_0x13a673)[_0x2ef7('0x19')](function(_0x167c69){return _0x167c69;});}return null;};}function removeEntity(_0x521cc7,_0x3d39a8){return function(_0x30c07e){if(_0x30c07e){return _0x30c07e['destroy']()[_0x2ef7('0x19')](function(){_0x521cc7[_0x2ef7('0x24')](0xcc)[_0x2ef7('0x2d')]();});}};}function handleEntityNotFound(_0x37b9ef,_0xf7ec5d){return function(_0x3de6fe){if(!_0x3de6fe){_0x37b9ef[_0x2ef7('0x2e')](0x194);}return _0x3de6fe;};}function handleError(_0x131066,_0x7af64c){_0x7af64c=_0x7af64c||0x1f4;return function(_0x3eb446){logger[_0x2ef7('0x1f')](_0x3eb446[_0x2ef7('0x2f')]);if(_0x3eb446[_0x2ef7('0x30')]){delete _0x3eb446[_0x2ef7('0x30')];}_0x131066['status'](_0x7af64c)['send'](_0x3eb446);};}exports[_0x2ef7('0x31')]=function(_0x1dc9a2,_0x4b5561){var _0x2e7979={},_0x458cbe={},_0x5a02f4={'count':0x0,'rows':[]};var _0x3a8dc9=_[_0x2ef7('0x32')](db[_0x2ef7('0x33')]['rawAttributes'],function(_0x4a557f){return{'name':_0x4a557f[_0x2ef7('0x34')],'type':_0x4a557f[_0x2ef7('0x35')][_0x2ef7('0x36')]};});_0x458cbe[_0x2ef7('0x37')]=_['map'](_0x3a8dc9,_0x2ef7('0x30'));_0x458cbe[_0x2ef7('0x38')]=_[_0x2ef7('0x39')](_0x1dc9a2[_0x2ef7('0x38')]);_0x458cbe[_0x2ef7('0x3a')]=_['intersection'](_0x458cbe[_0x2ef7('0x37')],_0x458cbe['query']);_0x2e7979['attributes']=_[_0x2ef7('0x3b')](_0x458cbe[_0x2ef7('0x37')],qs[_0x2ef7('0x3c')](_0x1dc9a2[_0x2ef7('0x38')][_0x2ef7('0x3c')]));_0x2e7979['attributes']=_0x2e7979[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x2e7979[_0x2ef7('0x3d')]:_0x458cbe[_0x2ef7('0x37')];if(!_0x1dc9a2[_0x2ef7('0x38')][_0x2ef7('0x3f')](_0x2ef7('0x40'))){_0x2e7979['limit']=qs[_0x2ef7('0x27')](_0x1dc9a2[_0x2ef7('0x38')]['limit']);_0x2e7979[_0x2ef7('0x26')]=qs['offset'](_0x1dc9a2['query'][_0x2ef7('0x26')]);}_0x2e7979['order']=qs[_0x2ef7('0x41')](_0x1dc9a2[_0x2ef7('0x38')][_0x2ef7('0x41')]);_0x2e7979[_0x2ef7('0x42')]=qs[_0x2ef7('0x3a')](_['pick'](_0x1dc9a2['query'],_0x458cbe[_0x2ef7('0x3a')]),_0x3a8dc9);if(_0x1dc9a2[_0x2ef7('0x38')][_0x2ef7('0x43')]){_0x2e7979['where']=_[_0x2ef7('0x44')](_0x2e7979[_0x2ef7('0x42')],{'$or':_[_0x2ef7('0x32')](_0x3a8dc9,function(_0x2e8449){if(_0x2e8449[_0x2ef7('0x35')]!==_0x2ef7('0x45')){var _0x1b9d1d={};_0x1b9d1d[_0x2e8449[_0x2ef7('0x30')]]={'$like':'%'+_0x1dc9a2['query'][_0x2ef7('0x43')]+'%'};return _0x1b9d1d;}})});}_0x2e7979=_['merge']({},_0x2e7979,_0x1dc9a2[_0x2ef7('0x46')]);var _0x18a553={'where':_0x2e7979[_0x2ef7('0x42')]};return db[_0x2ef7('0x33')][_0x2ef7('0x47')](_0x18a553)['then'](function(_0x50b542){_0x5a02f4['count']=_0x50b542;if(_0x1dc9a2['query'][_0x2ef7('0x48')]){_0x2e7979[_0x2ef7('0x49')]=[{'all':!![]}];}return db[_0x2ef7('0x33')]['findAll'](_0x2e7979);})[_0x2ef7('0x19')](function(_0x2289d6){_0x5a02f4[_0x2ef7('0x4a')]=_0x2289d6;return _0x5a02f4;})[_0x2ef7('0x19')](respondWithFilteredResult(_0x4b5561,_0x2e7979))[_0x2ef7('0x23')](handleError(_0x4b5561,null));};exports[_0x2ef7('0x4b')]=function(_0x40743b,_0x27c5c5){var _0x18e385={'raw':![],'where':{'id':_0x40743b['params']['id']}},_0x1d07c3={};_0x1d07c3[_0x2ef7('0x37')]=_[_0x2ef7('0x39')](db['FreshdeskConfiguration'][_0x2ef7('0x4c')]);_0x1d07c3[_0x2ef7('0x38')]=_['keys'](_0x40743b['query']);_0x1d07c3[_0x2ef7('0x3a')]=_[_0x2ef7('0x3b')](_0x1d07c3[_0x2ef7('0x37')],_0x1d07c3[_0x2ef7('0x38')]);_0x18e385[_0x2ef7('0x3d')]=_[_0x2ef7('0x3b')](_0x1d07c3['model'],qs[_0x2ef7('0x3c')](_0x40743b[_0x2ef7('0x38')][_0x2ef7('0x3c')]));_0x18e385[_0x2ef7('0x3d')]=_0x18e385[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x18e385[_0x2ef7('0x3d')]:_0x1d07c3[_0x2ef7('0x37')];if(_0x40743b[_0x2ef7('0x38')][_0x2ef7('0x48')]){_0x18e385[_0x2ef7('0x49')]=[{'all':!![]}];}_0x18e385=_[_0x2ef7('0x44')]({},_0x18e385,_0x40743b[_0x2ef7('0x46')]);return db[_0x2ef7('0x33')][_0x2ef7('0x4d')](_0x18e385)['then'](handleEntityNotFound(_0x27c5c5,null))['then'](respondWithResult(_0x27c5c5,null))[_0x2ef7('0x23')](handleError(_0x27c5c5,null));};exports['create']=function(_0x222763,_0x5dd15c){return db[_0x2ef7('0x33')][_0x2ef7('0x4e')](_0x222763['body'],{})['then'](respondWithResult(_0x5dd15c,0xc9))[_0x2ef7('0x23')](handleError(_0x5dd15c,null));};exports[_0x2ef7('0x2c')]=function(_0x314a09,_0x39220a){if(_0x314a09[_0x2ef7('0x4f')]['id']){delete _0x314a09[_0x2ef7('0x4f')]['id'];}return db[_0x2ef7('0x33')][_0x2ef7('0x4d')]({'where':{'id':_0x314a09[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x39220a,null))[_0x2ef7('0x19')](saveUpdates(_0x314a09[_0x2ef7('0x4f')],null))['then'](respondWithResult(_0x39220a,null))[_0x2ef7('0x23')](handleError(_0x39220a,null));};exports['destroy']=function(_0x4b2b03,_0x260293){return db[_0x2ef7('0x33')][_0x2ef7('0x4d')]({'where':{'id':_0x4b2b03[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x260293,null))[_0x2ef7('0x19')](removeEntity(_0x260293,null))[_0x2ef7('0x23')](handleError(_0x260293,null));};exports[_0x2ef7('0x51')]=function(_0x2e2113,_0x5bc258,_0x2c1a06){var _0x2e4e05={};var _0x493887={};var _0x42d372;var _0xeddcc6;return db[_0x2ef7('0x33')][_0x2ef7('0x52')]({'where':{'id':_0x2e2113[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x5bc258,null))['then'](function(_0x16f2e8){if(_0x16f2e8){_0x42d372=_0x16f2e8;_0x493887[_0x2ef7('0x37')]=_[_0x2ef7('0x39')](db[_0x2ef7('0x53')]['rawAttributes']);_0x493887[_0x2ef7('0x38')]=_[_0x2ef7('0x39')](_0x2e2113[_0x2ef7('0x38')]);_0x493887[_0x2ef7('0x3a')]=_[_0x2ef7('0x3b')](_0x493887['model'],_0x493887['query']);_0x2e4e05[_0x2ef7('0x3d')]=_[_0x2ef7('0x3b')](_0x493887[_0x2ef7('0x37')],qs[_0x2ef7('0x3c')](_0x2e2113[_0x2ef7('0x38')][_0x2ef7('0x3c')]));_0x2e4e05[_0x2ef7('0x3d')]=_0x2e4e05[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x2e4e05[_0x2ef7('0x3d')]:_0x493887[_0x2ef7('0x37')];_0x2e4e05[_0x2ef7('0x54')]=qs[_0x2ef7('0x41')](_0x2e2113[_0x2ef7('0x38')][_0x2ef7('0x41')]);_0x2e4e05[_0x2ef7('0x42')]=qs[_0x2ef7('0x3a')](_[_0x2ef7('0x55')](_0x2e2113['query'],_0x493887[_0x2ef7('0x3a')]));if(_0x2e2113['query'][_0x2ef7('0x43')]){_0x2e4e05['where']=_[_0x2ef7('0x44')](_0x2e4e05[_0x2ef7('0x42')],{'$or':_[_0x2ef7('0x32')](_0x2e4e05[_0x2ef7('0x3d')],function(_0x59358d){var _0x1eb794={};_0x1eb794[_0x59358d]={'$like':'%'+_0x2e2113[_0x2ef7('0x38')][_0x2ef7('0x43')]+'%'};return _0x1eb794;})});}_0x2e4e05=_['merge']({},_0x2e4e05,_0x2e2113[_0x2ef7('0x46')]);return _0x42d372[_0x2ef7('0x51')](_0x2e4e05);}})['then'](function(_0x4f8b8d){if(_0x4f8b8d){_0xeddcc6=_0x4f8b8d[_0x2ef7('0x3e')];if(!_0x2e2113[_0x2ef7('0x38')][_0x2ef7('0x3f')](_0x2ef7('0x40'))){_0x2e4e05['limit']=qs[_0x2ef7('0x27')](_0x2e2113[_0x2ef7('0x38')][_0x2ef7('0x27')]);_0x2e4e05[_0x2ef7('0x26')]=qs[_0x2ef7('0x26')](_0x2e2113[_0x2ef7('0x38')]['offset']);}return _0x42d372['getFields'](_0x2e4e05);}})['then'](function(_0x46a8b9){if(_0x46a8b9){return _0x46a8b9?{'count':_0xeddcc6,'rows':_0x46a8b9}:null;}})[_0x2ef7('0x19')](respondWithResult(_0x5bc258,null))[_0x2ef7('0x23')](handleError(_0x5bc258,null));};exports[_0x2ef7('0x56')]=function(_0x2467d4,_0x3efdd5,_0xa7c83f){var _0x5066d1={};var _0x305410={};var _0x4e96b2;var _0x785420;return db['FreshdeskConfiguration'][_0x2ef7('0x52')]({'where':{'id':_0x2467d4[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x3efdd5,null))[_0x2ef7('0x19')](function(_0x329cc9){if(_0x329cc9){_0x4e96b2=_0x329cc9;_0x305410[_0x2ef7('0x37')]=_[_0x2ef7('0x39')](db[_0x2ef7('0x53')][_0x2ef7('0x4c')]);_0x305410[_0x2ef7('0x38')]=_[_0x2ef7('0x39')](_0x2467d4[_0x2ef7('0x38')]);_0x305410['filters']=_[_0x2ef7('0x3b')](_0x305410[_0x2ef7('0x37')],_0x305410[_0x2ef7('0x38')]);_0x5066d1[_0x2ef7('0x3d')]=_[_0x2ef7('0x3b')](_0x305410['model'],qs[_0x2ef7('0x3c')](_0x2467d4[_0x2ef7('0x38')]['fields']));_0x5066d1['attributes']=_0x5066d1[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x5066d1[_0x2ef7('0x3d')]:_0x305410['model'];_0x5066d1[_0x2ef7('0x54')]=qs[_0x2ef7('0x41')](_0x2467d4[_0x2ef7('0x38')][_0x2ef7('0x41')]);_0x5066d1[_0x2ef7('0x42')]=qs['filters'](_['pick'](_0x2467d4[_0x2ef7('0x38')],_0x305410[_0x2ef7('0x3a')]));if(_0x2467d4[_0x2ef7('0x38')]['filter']){_0x5066d1['where']=_[_0x2ef7('0x44')](_0x5066d1[_0x2ef7('0x42')],{'$or':_[_0x2ef7('0x32')](_0x5066d1[_0x2ef7('0x3d')],function(_0x2a9729){var _0x3e44f2={};_0x3e44f2[_0x2a9729]={'$like':'%'+_0x2467d4[_0x2ef7('0x38')][_0x2ef7('0x43')]+'%'};return _0x3e44f2;})});}_0x5066d1=_[_0x2ef7('0x44')]({},_0x5066d1,_0x2467d4['options']);return _0x4e96b2[_0x2ef7('0x56')](_0x5066d1);}})[_0x2ef7('0x19')](function(_0x517a75){if(_0x517a75){_0x785420=_0x517a75[_0x2ef7('0x3e')];if(!_0x2467d4[_0x2ef7('0x38')]['hasOwnProperty'](_0x2ef7('0x40'))){_0x5066d1['limit']=qs[_0x2ef7('0x27')](_0x2467d4[_0x2ef7('0x38')][_0x2ef7('0x27')]);_0x5066d1[_0x2ef7('0x26')]=qs[_0x2ef7('0x26')](_0x2467d4[_0x2ef7('0x38')][_0x2ef7('0x26')]);}return _0x4e96b2[_0x2ef7('0x56')](_0x5066d1);}})[_0x2ef7('0x19')](function(_0x530ded){if(_0x530ded){return _0x530ded?{'count':_0x785420,'rows':_0x530ded}:null;}})[_0x2ef7('0x19')](respondWithResult(_0x3efdd5,null))[_0x2ef7('0x23')](handleError(_0x3efdd5,null));};exports[_0x2ef7('0x57')]=function(_0x2dfd27,_0xc3efb8,_0x1e5693){var _0x2985a0={};var _0x59d6bc={};var _0x3f08ae;var _0x35febe;return db[_0x2ef7('0x33')]['findOne']({'where':{'id':_0x2dfd27[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0xc3efb8,null))[_0x2ef7('0x19')](function(_0xa13f6e){if(_0xa13f6e){_0x3f08ae=_0xa13f6e;_0x59d6bc[_0x2ef7('0x37')]=_['keys'](db[_0x2ef7('0x53')][_0x2ef7('0x4c')]);_0x59d6bc['query']=_[_0x2ef7('0x39')](_0x2dfd27[_0x2ef7('0x38')]);_0x59d6bc[_0x2ef7('0x3a')]=_[_0x2ef7('0x3b')](_0x59d6bc[_0x2ef7('0x37')],_0x59d6bc['query']);_0x2985a0['attributes']=_[_0x2ef7('0x3b')](_0x59d6bc[_0x2ef7('0x37')],qs[_0x2ef7('0x3c')](_0x2dfd27[_0x2ef7('0x38')][_0x2ef7('0x3c')]));_0x2985a0[_0x2ef7('0x3d')]=_0x2985a0[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x2985a0[_0x2ef7('0x3d')]:_0x59d6bc[_0x2ef7('0x37')];_0x2985a0['order']=qs[_0x2ef7('0x41')](_0x2dfd27[_0x2ef7('0x38')]['sort']);_0x2985a0['where']=qs[_0x2ef7('0x3a')](_[_0x2ef7('0x55')](_0x2dfd27[_0x2ef7('0x38')],_0x59d6bc['filters']));if(_0x2dfd27['query'][_0x2ef7('0x43')]){_0x2985a0[_0x2ef7('0x42')]=_['merge'](_0x2985a0[_0x2ef7('0x42')],{'$or':_['map'](_0x2985a0[_0x2ef7('0x3d')],function(_0x2c2172){var _0x9f05fb={};_0x9f05fb[_0x2c2172]={'$like':'%'+_0x2dfd27[_0x2ef7('0x38')][_0x2ef7('0x43')]+'%'};return _0x9f05fb;})});}_0x2985a0=_[_0x2ef7('0x44')]({},_0x2985a0,_0x2dfd27[_0x2ef7('0x46')]);return _0x3f08ae[_0x2ef7('0x57')](_0x2985a0);}})[_0x2ef7('0x19')](function(_0x3ce4be){if(_0x3ce4be){_0x35febe=_0x3ce4be[_0x2ef7('0x3e')];if(!_0x2dfd27[_0x2ef7('0x38')][_0x2ef7('0x3f')]('nolimit')){_0x2985a0[_0x2ef7('0x27')]=qs[_0x2ef7('0x27')](_0x2dfd27[_0x2ef7('0x38')][_0x2ef7('0x27')]);_0x2985a0[_0x2ef7('0x26')]=qs[_0x2ef7('0x26')](_0x2dfd27[_0x2ef7('0x38')]['offset']);}return _0x3f08ae['getDescriptions'](_0x2985a0);}})[_0x2ef7('0x19')](function(_0x3f38f2){if(_0x3f38f2){return _0x3f38f2?{'count':_0x35febe,'rows':_0x3f38f2}:null;}})[_0x2ef7('0x19')](respondWithResult(_0xc3efb8,null))[_0x2ef7('0x23')](handleError(_0xc3efb8,null));};exports[_0x2ef7('0x58')]=function(_0xa87ead,_0x1adb42,_0x3bcb0f){var _0x22455e={};var _0x1b042f={};var _0x1a9988;var _0x54c912;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xa87ead['params']['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x1adb42,null))[_0x2ef7('0x19')](function(_0x3a0101){if(_0x3a0101){_0x1a9988=_0x3a0101;_0x1b042f[_0x2ef7('0x37')]=_['keys'](db[_0x2ef7('0x59')][_0x2ef7('0x4c')]);_0x1b042f[_0x2ef7('0x38')]=_[_0x2ef7('0x39')](_0xa87ead['query']);_0x1b042f[_0x2ef7('0x3a')]=_[_0x2ef7('0x3b')](_0x1b042f[_0x2ef7('0x37')],_0x1b042f[_0x2ef7('0x38')]);_0x22455e[_0x2ef7('0x3d')]=_['intersection'](_0x1b042f[_0x2ef7('0x37')],qs['fields'](_0xa87ead[_0x2ef7('0x38')][_0x2ef7('0x3c')]));_0x22455e[_0x2ef7('0x3d')]=_0x22455e[_0x2ef7('0x3d')][_0x2ef7('0x3e')]?_0x22455e['attributes']:_0x1b042f[_0x2ef7('0x37')];_0x22455e[_0x2ef7('0x54')]=qs[_0x2ef7('0x41')](_0xa87ead['query'][_0x2ef7('0x41')]);_0x22455e['where']=qs['filters'](_[_0x2ef7('0x55')](_0xa87ead[_0x2ef7('0x38')],_0x1b042f[_0x2ef7('0x3a')]));if(_0xa87ead[_0x2ef7('0x38')][_0x2ef7('0x43')]){_0x22455e[_0x2ef7('0x42')]=_['merge'](_0x22455e[_0x2ef7('0x42')],{'$or':_[_0x2ef7('0x32')](_0x22455e[_0x2ef7('0x3d')],function(_0x13306e){var _0x1b7b25={};_0x1b7b25[_0x13306e]={'$like':'%'+_0xa87ead[_0x2ef7('0x38')][_0x2ef7('0x43')]+'%'};return _0x1b7b25;})});}_0x22455e=_[_0x2ef7('0x44')]({},_0x22455e,_0xa87ead[_0x2ef7('0x46')]);return _0x1a9988[_0x2ef7('0x58')](_0x22455e);}})[_0x2ef7('0x19')](function(_0x16193f){if(_0x16193f){_0x54c912=_0x16193f[_0x2ef7('0x3e')];if(!_0xa87ead[_0x2ef7('0x38')][_0x2ef7('0x3f')](_0x2ef7('0x40'))){_0x22455e['limit']=qs[_0x2ef7('0x27')](_0xa87ead[_0x2ef7('0x38')]['limit']);_0x22455e[_0x2ef7('0x26')]=qs[_0x2ef7('0x26')](_0xa87ead[_0x2ef7('0x38')][_0x2ef7('0x26')]);}return _0x1a9988['getTags'](_0x22455e);}})[_0x2ef7('0x19')](function(_0x110a71){if(_0x110a71){return _0x110a71?{'count':_0x54c912,'rows':_0x110a71}:null;}})['then'](respondWithResult(_0x1adb42,null))['catch'](handleError(_0x1adb42,null));};exports[_0x2ef7('0x5a')]=function(_0x1320b1,_0x9d0eea,_0x2c4a5a){if(_0x1320b1[_0x2ef7('0x4f')]['id']){delete _0x1320b1['body']['id'];}return db[_0x2ef7('0x33')][_0x2ef7('0x52')]({'where':{'id':_0x1320b1[_0x2ef7('0x50')]['id']}})[_0x2ef7('0x19')](handleEntityNotFound(_0x9d0eea,null))[_0x2ef7('0x19')](function(_0xdb7344){if(_0xdb7344){return _0xdb7344[_0x2ef7('0x5a')](_0x1320b1[_0x2ef7('0x4f')][_0x2ef7('0x5b')]||[]);}return null;})[_0x2ef7('0x19')](respondWithResult(_0x9d0eea,null))[_0x2ef7('0x23')](handleError(_0x9d0eea,null));}; \ No newline at end of file +var _0xa676=['catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','name','index','map','rawAttributes','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xa676,0x15b));var _0x6a67=function(_0x1fef2b,_0x424ea9){_0x1fef2b=_0x1fef2b-0x0;var _0x4a8fcf=_0xa676[_0x1fef2b];return _0x4a8fcf;};'use strict';var pdf=require(_0x6a67('0x0'));var emlformat=require(_0x6a67('0x1'));var rimraf=require(_0x6a67('0x2'));var zipdir=require(_0x6a67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a67('0x4'));var moment=require('moment');var BPromise=require(_0x6a67('0x5'));var Mustache=require(_0x6a67('0x6'));var util=require(_0x6a67('0x7'));var path=require(_0x6a67('0x8'));var sox=require(_0x6a67('0x9'));var csv=require(_0x6a67('0xa'));var ejs=require(_0x6a67('0xb'));var fs=require('fs');var _=require(_0x6a67('0xc'));var squel=require(_0x6a67('0xd'));var crypto=require(_0x6a67('0xe'));var jsforce=require(_0x6a67('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a67('0x10'));var Papa=require(_0x6a67('0x11'));var Redis=require('ioredis');var authService=require(_0x6a67('0x12'));var qs=require(_0x6a67('0x13'));var as=require(_0x6a67('0x14'));var hardwareService=require(_0x6a67('0x15'));var logger=require(_0x6a67('0x16'))(_0x6a67('0x17'));var utils=require('../../config/utils');var config=require(_0x6a67('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6a67('0x19'));var client=jayson['client'][_0x6a67('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3d0512,_0x58b685,_0x264f9b){if(_0x264f9b){var _0x593a07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x593a07[_0x6a67('0x1b')](_0x58b685)){return _0x3d0512;}else{throw new db[(_0x6a67('0x1c'))][(_0x6a67('0x1d'))](_0x6a67('0x1e'));}}else{return _0x3d0512;}}function respondWithRpcPromise(_0x34ba1e,_0x4faaa1,_0x14e4a1,_0x4b26ea){return new BPromise(function(_0x386232,_0x21cf2e){var _0x1b1076=_0x4b26ea||client;return _0x1b1076[_0x6a67('0x1f')](_0x34ba1e,_0x14e4a1)[_0x6a67('0x20')](function(_0x23806a){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4faaa1,_0x6a67('0x21'));logger['debug'](_0x6a67('0x22'),_0x4faaa1,_0x6a67('0x21'),JSON[_0x6a67('0x23')](_0x23806a));if(_0x23806a[_0x6a67('0x24')]){if(_0x23806a['error'][_0x6a67('0x25')]===0x1f4){logger[_0x6a67('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4faaa1,_0x23806a[_0x6a67('0x24')][_0x6a67('0x26')]);return _0x21cf2e(_0x23806a['error'][_0x6a67('0x26')]);}logger['error'](_0x6a67('0x27'),_0x4faaa1,_0x23806a[_0x6a67('0x24')][_0x6a67('0x26')]);return _0x386232(_0x23806a[_0x6a67('0x24')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4faaa1,_0x6a67('0x21'));_0x386232(_0x23806a[_0x6a67('0x28')][_0x6a67('0x26')]);}})[_0x6a67('0x29')](function(_0x17f246){logger[_0x6a67('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4faaa1,_0x17f246);_0x21cf2e(_0x17f246);});});}function respondWithStatusCode(_0x65173a,_0x6f1ef3){_0x6f1ef3=_0x6f1ef3||0xcc;return function(_0x118266){if(_0x118266){return _0x65173a[_0x6a67('0x2a')](_0x6f1ef3);}return _0x65173a[_0x6a67('0x2b')](_0x6f1ef3)['end']();};}function respondWithResult(_0x1260e4,_0x5762bd){_0x5762bd=_0x5762bd||0xc8;return function(_0x1b71e6){if(_0x1b71e6){return _0x1260e4[_0x6a67('0x2b')](_0x5762bd)[_0x6a67('0x2c')](_0x1b71e6);}};}function respondWithFilteredResult(_0xd39e95,_0x54a06d){return function(_0x424291){if(_0x424291){var _0x4e43b2=_0x424291[_0x6a67('0x2d')],_0x273f32=_0x54a06d['offset'],_0x26adc3=_0x54a06d[_0x6a67('0x2e')]+_0x54a06d[_0x6a67('0x2f')],_0x3a3d54;if(_0x26adc3>=_0x4e43b2){_0x26adc3=_0x4e43b2;_0x3a3d54=0xc8;}else{_0x3a3d54=0xce;}_0xd39e95[_0x6a67('0x2b')](_0x3a3d54);return _0xd39e95[_0x6a67('0x30')](_0x6a67('0x31'),_0x273f32+'-'+_0x26adc3+'/'+_0x4e43b2)[_0x6a67('0x2c')](_0x424291);}return null;};}function patchUpdates(_0x48bef1){return function(_0x20488a){try{jsonpatch['apply'](_0x20488a,_0x48bef1,!![]);}catch(_0x15e407){return BPromise[_0x6a67('0x32')](_0x15e407);}return _0x20488a[_0x6a67('0x33')]();};}function saveUpdates(_0x485cfa,_0x52161b){return function(_0x3cdf0c){if(_0x3cdf0c){return _0x3cdf0c[_0x6a67('0x34')](_0x485cfa)[_0x6a67('0x20')](function(_0x4dca77){return _0x4dca77;});}return null;};}function removeEntity(_0x12f8d1,_0xfe78a8){return function(_0xb3c675){if(_0xb3c675){return _0xb3c675[_0x6a67('0x35')]()[_0x6a67('0x20')](function(){_0x12f8d1['status'](0xcc)[_0x6a67('0x36')]();});}};}function handleEntityNotFound(_0x2a06c1,_0xadaf25){return function(_0xb9af2b){if(!_0xb9af2b){_0x2a06c1[_0x6a67('0x2a')](0x194);}return _0xb9af2b;};}function handleError(_0x435810,_0x178828){_0x178828=_0x178828||0x1f4;return function(_0x21c845){logger[_0x6a67('0x24')](_0x21c845['stack']);if(_0x21c845['name']){delete _0x21c845[_0x6a67('0x37')];}_0x435810[_0x6a67('0x2b')](_0x178828)['send'](_0x21c845);};}exports[_0x6a67('0x38')]=function(_0x461144,_0x5bc4cd){var _0x218e82={},_0x1f1927={},_0x3fa15e={'count':0x0,'rows':[]};var _0x4e3f46=_[_0x6a67('0x39')](db['FreshdeskConfiguration'][_0x6a67('0x3a')],function(_0x73de38){return{'name':_0x73de38['fieldName'],'type':_0x73de38[_0x6a67('0x3b')][_0x6a67('0x3c')]};});_0x1f1927['model']=_[_0x6a67('0x39')](_0x4e3f46,_0x6a67('0x37'));_0x1f1927['query']=_[_0x6a67('0x3d')](_0x461144[_0x6a67('0x3e')]);_0x1f1927['filters']=_['intersection'](_0x1f1927[_0x6a67('0x3f')],_0x1f1927['query']);_0x218e82['attributes']=_[_0x6a67('0x40')](_0x1f1927[_0x6a67('0x3f')],qs['fields'](_0x461144[_0x6a67('0x3e')][_0x6a67('0x41')]));_0x218e82[_0x6a67('0x42')]=_0x218e82['attributes'][_0x6a67('0x43')]?_0x218e82[_0x6a67('0x42')]:_0x1f1927[_0x6a67('0x3f')];if(!_0x461144[_0x6a67('0x3e')][_0x6a67('0x44')](_0x6a67('0x45'))){_0x218e82[_0x6a67('0x2f')]=qs[_0x6a67('0x2f')](_0x461144[_0x6a67('0x3e')][_0x6a67('0x2f')]);_0x218e82[_0x6a67('0x2e')]=qs[_0x6a67('0x2e')](_0x461144[_0x6a67('0x3e')][_0x6a67('0x2e')]);}_0x218e82[_0x6a67('0x46')]=qs[_0x6a67('0x47')](_0x461144[_0x6a67('0x3e')][_0x6a67('0x47')]);_0x218e82[_0x6a67('0x48')]=qs[_0x6a67('0x49')](_[_0x6a67('0x4a')](_0x461144[_0x6a67('0x3e')],_0x1f1927['filters']),_0x4e3f46);if(_0x461144['query'][_0x6a67('0x4b')]){_0x218e82['where']=_[_0x6a67('0x4c')](_0x218e82[_0x6a67('0x48')],{'$or':_[_0x6a67('0x39')](_0x4e3f46,function(_0x2eaa0d){if(_0x2eaa0d['type']!==_0x6a67('0x4d')){var _0x4a4c5c={};_0x4a4c5c[_0x2eaa0d[_0x6a67('0x37')]]={'$like':'%'+_0x461144[_0x6a67('0x3e')]['filter']+'%'};return _0x4a4c5c;}})});}_0x218e82=_[_0x6a67('0x4c')]({},_0x218e82,_0x461144[_0x6a67('0x4e')]);var _0x264286={'where':_0x218e82[_0x6a67('0x48')]};return db[_0x6a67('0x4f')][_0x6a67('0x2d')](_0x264286)[_0x6a67('0x20')](function(_0x2ed5d4){_0x3fa15e[_0x6a67('0x2d')]=_0x2ed5d4;if(_0x461144['query'][_0x6a67('0x50')]){_0x218e82[_0x6a67('0x51')]=[{'all':!![]}];}return db[_0x6a67('0x4f')][_0x6a67('0x52')](_0x218e82);})[_0x6a67('0x20')](function(_0x593d35){_0x3fa15e[_0x6a67('0x53')]=_0x593d35;return _0x3fa15e;})[_0x6a67('0x20')](respondWithFilteredResult(_0x5bc4cd,_0x218e82))[_0x6a67('0x29')](handleError(_0x5bc4cd,null));};exports[_0x6a67('0x54')]=function(_0x2e4405,_0x135362){var _0x20884d={'raw':![],'where':{'id':_0x2e4405[_0x6a67('0x55')]['id']}},_0x40ee28={};_0x40ee28['model']=_[_0x6a67('0x3d')](db[_0x6a67('0x4f')][_0x6a67('0x3a')]);_0x40ee28[_0x6a67('0x3e')]=_[_0x6a67('0x3d')](_0x2e4405[_0x6a67('0x3e')]);_0x40ee28[_0x6a67('0x49')]=_[_0x6a67('0x40')](_0x40ee28[_0x6a67('0x3f')],_0x40ee28['query']);_0x20884d[_0x6a67('0x42')]=_[_0x6a67('0x40')](_0x40ee28['model'],qs[_0x6a67('0x41')](_0x2e4405['query']['fields']));_0x20884d[_0x6a67('0x42')]=_0x20884d[_0x6a67('0x42')]['length']?_0x20884d[_0x6a67('0x42')]:_0x40ee28[_0x6a67('0x3f')];if(_0x2e4405[_0x6a67('0x3e')][_0x6a67('0x50')]){_0x20884d[_0x6a67('0x51')]=[{'all':!![]}];}_0x20884d=_['merge']({},_0x20884d,_0x2e4405['options']);return db[_0x6a67('0x4f')][_0x6a67('0x56')](_0x20884d)[_0x6a67('0x20')](handleEntityNotFound(_0x135362,null))[_0x6a67('0x20')](respondWithResult(_0x135362,null))[_0x6a67('0x29')](handleError(_0x135362,null));};exports[_0x6a67('0x57')]=function(_0x2a09d7,_0x54a0f7){return db[_0x6a67('0x4f')][_0x6a67('0x57')](_0x2a09d7[_0x6a67('0x58')],{})[_0x6a67('0x20')](respondWithResult(_0x54a0f7,0xc9))['catch'](handleError(_0x54a0f7,null));};exports[_0x6a67('0x34')]=function(_0x410a2a,_0x416cd3){if(_0x410a2a[_0x6a67('0x58')]['id']){delete _0x410a2a[_0x6a67('0x58')]['id'];}return db[_0x6a67('0x4f')][_0x6a67('0x56')]({'where':{'id':_0x410a2a[_0x6a67('0x55')]['id']}})['then'](handleEntityNotFound(_0x416cd3,null))[_0x6a67('0x20')](saveUpdates(_0x410a2a['body'],null))['then'](respondWithResult(_0x416cd3,null))[_0x6a67('0x29')](handleError(_0x416cd3,null));};exports[_0x6a67('0x35')]=function(_0x1ee0f5,_0x1951a0){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1ee0f5[_0x6a67('0x55')]['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x1951a0,null))[_0x6a67('0x20')](removeEntity(_0x1951a0,null))[_0x6a67('0x29')](handleError(_0x1951a0,null));};exports[_0x6a67('0x59')]=function(_0x5de3c2,_0x2e541b,_0x2e9bdf){var _0x572f40={};var _0x17542a={};var _0xbe2e38;var _0xd13213;return db[_0x6a67('0x4f')][_0x6a67('0x5a')]({'where':{'id':_0x5de3c2[_0x6a67('0x55')]['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x2e541b,null))[_0x6a67('0x20')](function(_0x49b5e6){if(_0x49b5e6){_0xbe2e38=_0x49b5e6;_0x17542a[_0x6a67('0x3f')]=_['keys'](db[_0x6a67('0x5b')][_0x6a67('0x3a')]);_0x17542a[_0x6a67('0x3e')]=_[_0x6a67('0x3d')](_0x5de3c2[_0x6a67('0x3e')]);_0x17542a[_0x6a67('0x49')]=_[_0x6a67('0x40')](_0x17542a['model'],_0x17542a['query']);_0x572f40[_0x6a67('0x42')]=_[_0x6a67('0x40')](_0x17542a[_0x6a67('0x3f')],qs[_0x6a67('0x41')](_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x41')]));_0x572f40[_0x6a67('0x42')]=_0x572f40[_0x6a67('0x42')][_0x6a67('0x43')]?_0x572f40[_0x6a67('0x42')]:_0x17542a[_0x6a67('0x3f')];_0x572f40[_0x6a67('0x46')]=qs[_0x6a67('0x47')](_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x47')]);_0x572f40[_0x6a67('0x48')]=qs[_0x6a67('0x49')](_['pick'](_0x5de3c2[_0x6a67('0x3e')],_0x17542a[_0x6a67('0x49')]));if(_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x4b')]){_0x572f40[_0x6a67('0x48')]=_[_0x6a67('0x4c')](_0x572f40['where'],{'$or':_[_0x6a67('0x39')](_0x572f40['attributes'],function(_0x52d51c){var _0xd95cf5={};_0xd95cf5[_0x52d51c]={'$like':'%'+_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x4b')]+'%'};return _0xd95cf5;})});}_0x572f40=_['merge']({},_0x572f40,_0x5de3c2[_0x6a67('0x4e')]);return _0xbe2e38[_0x6a67('0x59')](_0x572f40);}})[_0x6a67('0x20')](function(_0x327126){if(_0x327126){_0xd13213=_0x327126[_0x6a67('0x43')];if(!_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x44')](_0x6a67('0x45'))){_0x572f40[_0x6a67('0x2f')]=qs['limit'](_0x5de3c2['query'][_0x6a67('0x2f')]);_0x572f40[_0x6a67('0x2e')]=qs[_0x6a67('0x2e')](_0x5de3c2[_0x6a67('0x3e')][_0x6a67('0x2e')]);}return _0xbe2e38[_0x6a67('0x59')](_0x572f40);}})[_0x6a67('0x20')](function(_0x441234){if(_0x441234){return _0x441234?{'count':_0xd13213,'rows':_0x441234}:null;}})['then'](respondWithResult(_0x2e541b,null))['catch'](handleError(_0x2e541b,null));};exports[_0x6a67('0x5c')]=function(_0x54caf4,_0x461240,_0x59e73e){var _0x240e39={};var _0x16c669={};var _0x114e08;var _0x106484;return db['FreshdeskConfiguration'][_0x6a67('0x5a')]({'where':{'id':_0x54caf4['params']['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x461240,null))[_0x6a67('0x20')](function(_0x11475b){if(_0x11475b){_0x114e08=_0x11475b;_0x16c669[_0x6a67('0x3f')]=_[_0x6a67('0x3d')](db[_0x6a67('0x5b')][_0x6a67('0x3a')]);_0x16c669[_0x6a67('0x3e')]=_[_0x6a67('0x3d')](_0x54caf4[_0x6a67('0x3e')]);_0x16c669['filters']=_[_0x6a67('0x40')](_0x16c669[_0x6a67('0x3f')],_0x16c669[_0x6a67('0x3e')]);_0x240e39[_0x6a67('0x42')]=_[_0x6a67('0x40')](_0x16c669[_0x6a67('0x3f')],qs['fields'](_0x54caf4[_0x6a67('0x3e')][_0x6a67('0x41')]));_0x240e39[_0x6a67('0x42')]=_0x240e39[_0x6a67('0x42')][_0x6a67('0x43')]?_0x240e39['attributes']:_0x16c669[_0x6a67('0x3f')];_0x240e39[_0x6a67('0x46')]=qs['sort'](_0x54caf4[_0x6a67('0x3e')]['sort']);_0x240e39[_0x6a67('0x48')]=qs[_0x6a67('0x49')](_[_0x6a67('0x4a')](_0x54caf4[_0x6a67('0x3e')],_0x16c669['filters']));if(_0x54caf4[_0x6a67('0x3e')][_0x6a67('0x4b')]){_0x240e39[_0x6a67('0x48')]=_[_0x6a67('0x4c')](_0x240e39[_0x6a67('0x48')],{'$or':_[_0x6a67('0x39')](_0x240e39[_0x6a67('0x42')],function(_0x196ba4){var _0x559662={};_0x559662[_0x196ba4]={'$like':'%'+_0x54caf4[_0x6a67('0x3e')][_0x6a67('0x4b')]+'%'};return _0x559662;})});}_0x240e39=_[_0x6a67('0x4c')]({},_0x240e39,_0x54caf4['options']);return _0x114e08[_0x6a67('0x5c')](_0x240e39);}})[_0x6a67('0x20')](function(_0x1602fb){if(_0x1602fb){_0x106484=_0x1602fb[_0x6a67('0x43')];if(!_0x54caf4[_0x6a67('0x3e')][_0x6a67('0x44')](_0x6a67('0x45'))){_0x240e39['limit']=qs[_0x6a67('0x2f')](_0x54caf4['query'][_0x6a67('0x2f')]);_0x240e39[_0x6a67('0x2e')]=qs[_0x6a67('0x2e')](_0x54caf4[_0x6a67('0x3e')][_0x6a67('0x2e')]);}return _0x114e08[_0x6a67('0x5c')](_0x240e39);}})['then'](function(_0x11a7bf){if(_0x11a7bf){return _0x11a7bf?{'count':_0x106484,'rows':_0x11a7bf}:null;}})[_0x6a67('0x20')](respondWithResult(_0x461240,null))['catch'](handleError(_0x461240,null));};exports[_0x6a67('0x5d')]=function(_0x5e4c82,_0x26f922,_0xf6a145){var _0x126e72={};var _0x284304={};var _0x46d8ee;var _0x2fcadf;return db[_0x6a67('0x4f')][_0x6a67('0x5a')]({'where':{'id':_0x5e4c82[_0x6a67('0x55')]['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x26f922,null))[_0x6a67('0x20')](function(_0x3edede){if(_0x3edede){_0x46d8ee=_0x3edede;_0x284304[_0x6a67('0x3f')]=_['keys'](db[_0x6a67('0x5b')]['rawAttributes']);_0x284304['query']=_[_0x6a67('0x3d')](_0x5e4c82[_0x6a67('0x3e')]);_0x284304[_0x6a67('0x49')]=_[_0x6a67('0x40')](_0x284304['model'],_0x284304[_0x6a67('0x3e')]);_0x126e72['attributes']=_[_0x6a67('0x40')](_0x284304[_0x6a67('0x3f')],qs['fields'](_0x5e4c82[_0x6a67('0x3e')][_0x6a67('0x41')]));_0x126e72[_0x6a67('0x42')]=_0x126e72[_0x6a67('0x42')][_0x6a67('0x43')]?_0x126e72[_0x6a67('0x42')]:_0x284304['model'];_0x126e72[_0x6a67('0x46')]=qs[_0x6a67('0x47')](_0x5e4c82[_0x6a67('0x3e')][_0x6a67('0x47')]);_0x126e72[_0x6a67('0x48')]=qs[_0x6a67('0x49')](_[_0x6a67('0x4a')](_0x5e4c82['query'],_0x284304[_0x6a67('0x49')]));if(_0x5e4c82[_0x6a67('0x3e')]['filter']){_0x126e72['where']=_[_0x6a67('0x4c')](_0x126e72[_0x6a67('0x48')],{'$or':_['map'](_0x126e72[_0x6a67('0x42')],function(_0x2ced30){var _0x212346={};_0x212346[_0x2ced30]={'$like':'%'+_0x5e4c82['query']['filter']+'%'};return _0x212346;})});}_0x126e72=_[_0x6a67('0x4c')]({},_0x126e72,_0x5e4c82['options']);return _0x46d8ee[_0x6a67('0x5d')](_0x126e72);}})['then'](function(_0x5ca8f8){if(_0x5ca8f8){_0x2fcadf=_0x5ca8f8[_0x6a67('0x43')];if(!_0x5e4c82[_0x6a67('0x3e')][_0x6a67('0x44')](_0x6a67('0x45'))){_0x126e72[_0x6a67('0x2f')]=qs['limit'](_0x5e4c82[_0x6a67('0x3e')][_0x6a67('0x2f')]);_0x126e72[_0x6a67('0x2e')]=qs[_0x6a67('0x2e')](_0x5e4c82['query'][_0x6a67('0x2e')]);}return _0x46d8ee['getDescriptions'](_0x126e72);}})[_0x6a67('0x20')](function(_0x3e8f69){if(_0x3e8f69){return _0x3e8f69?{'count':_0x2fcadf,'rows':_0x3e8f69}:null;}})[_0x6a67('0x20')](respondWithResult(_0x26f922,null))[_0x6a67('0x29')](handleError(_0x26f922,null));};exports[_0x6a67('0x5e')]=function(_0x4c346d,_0x56ef62,_0x407341){var _0x586cb5={};var _0x39fff7={};var _0x53539f;var _0x74a049;return db[_0x6a67('0x4f')][_0x6a67('0x5a')]({'where':{'id':_0x4c346d[_0x6a67('0x55')]['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x56ef62,null))[_0x6a67('0x20')](function(_0x1d6493){if(_0x1d6493){_0x53539f=_0x1d6493;_0x39fff7['model']=_[_0x6a67('0x3d')](db[_0x6a67('0x5f')][_0x6a67('0x3a')]);_0x39fff7[_0x6a67('0x3e')]=_[_0x6a67('0x3d')](_0x4c346d['query']);_0x39fff7['filters']=_[_0x6a67('0x40')](_0x39fff7[_0x6a67('0x3f')],_0x39fff7[_0x6a67('0x3e')]);_0x586cb5[_0x6a67('0x42')]=_[_0x6a67('0x40')](_0x39fff7[_0x6a67('0x3f')],qs[_0x6a67('0x41')](_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x41')]));_0x586cb5[_0x6a67('0x42')]=_0x586cb5[_0x6a67('0x42')][_0x6a67('0x43')]?_0x586cb5['attributes']:_0x39fff7[_0x6a67('0x3f')];_0x586cb5[_0x6a67('0x46')]=qs['sort'](_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x47')]);_0x586cb5[_0x6a67('0x48')]=qs[_0x6a67('0x49')](_[_0x6a67('0x4a')](_0x4c346d[_0x6a67('0x3e')],_0x39fff7[_0x6a67('0x49')]));if(_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x4b')]){_0x586cb5[_0x6a67('0x48')]=_[_0x6a67('0x4c')](_0x586cb5['where'],{'$or':_['map'](_0x586cb5[_0x6a67('0x42')],function(_0x3e421a){var _0x38697a={};_0x38697a[_0x3e421a]={'$like':'%'+_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x4b')]+'%'};return _0x38697a;})});}_0x586cb5=_[_0x6a67('0x4c')]({},_0x586cb5,_0x4c346d['options']);return _0x53539f[_0x6a67('0x5e')](_0x586cb5);}})['then'](function(_0x142e35){if(_0x142e35){_0x74a049=_0x142e35[_0x6a67('0x43')];if(!_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x44')](_0x6a67('0x45'))){_0x586cb5[_0x6a67('0x2f')]=qs[_0x6a67('0x2f')](_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x2f')]);_0x586cb5['offset']=qs['offset'](_0x4c346d[_0x6a67('0x3e')][_0x6a67('0x2e')]);}return _0x53539f[_0x6a67('0x5e')](_0x586cb5);}})[_0x6a67('0x20')](function(_0x1d6c21){if(_0x1d6c21){return _0x1d6c21?{'count':_0x74a049,'rows':_0x1d6c21}:null;}})[_0x6a67('0x20')](respondWithResult(_0x56ef62,null))[_0x6a67('0x29')](handleError(_0x56ef62,null));};exports[_0x6a67('0x60')]=function(_0x94127e,_0x23c665,_0x546f7d){if(_0x94127e[_0x6a67('0x58')]['id']){delete _0x94127e[_0x6a67('0x58')]['id'];}return db[_0x6a67('0x4f')][_0x6a67('0x5a')]({'where':{'id':_0x94127e[_0x6a67('0x55')]['id']}})[_0x6a67('0x20')](handleEntityNotFound(_0x23c665,null))[_0x6a67('0x20')](function(_0x5a5ecd){if(_0x5a5ecd){return _0x5a5ecd[_0x6a67('0x60')](_0x94127e[_0x6a67('0x58')]['ids']||[]);}return null;})[_0x6a67('0x20')](respondWithResult(_0x23c665,null))['catch'](handleError(_0x23c665,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 48491b7..6579008 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 _0xe14b=['bluebird','path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment'];(function(_0x3ebb0a,_0x13ce1d){var _0x100712=function(_0x50dea6){while(--_0x50dea6){_0x3ebb0a['push'](_0x3ebb0a['shift']());}};_0x100712(++_0x13ce1d);}(_0xe14b,0x93));var _0xbe14=function(_0x1475e0,_0x16f54a){_0x1475e0=_0x1475e0-0x0;var _0x4bf083=_0xe14b[_0x1475e0];return _0x4bf083;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x182f10,_0x1f3710){var _0xacfd69=function(_0x5dbc23){while(--_0x5dbc23){_0x182f10['push'](_0x182f10['shift']());}};_0xacfd69(++_0x1f3710);}(_0x5fc3,0xa8));var _0x35fc=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x5fc3[_0x35485a];return _0x5148e6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5220bb8..f702c07 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 _0x3da6=['randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2a41a9,_0x4b598e){var _0x19c87d=function(_0x1a859d){while(--_0x1a859d){_0x2a41a9['push'](_0x2a41a9['shift']());}};_0x19c87d(++_0x4b598e);}(_0x3da6,0x172));var _0x63da=function(_0x2c7c6a,_0x292ecf){_0x2c7c6a=_0x2c7c6a-0x0;var _0x2c4e43=_0x3da6[_0x2c7c6a];return _0x2c4e43;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require(_0x63da('0x2'));var BPromise=require(_0x63da('0x3'));var rs=require(_0x63da('0x4'));var fs=require('fs');var Redis=require(_0x63da('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x63da('0x6'))('rpc');var config=require(_0x63da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63da('0x8')][_0x63da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e4d,_0x5a9ef9,_0x44f110){return new BPromise(function(_0x3188dd,_0x388e0f){return client[_0x63da('0xa')](_0x126e4d,_0x44f110)[_0x63da('0xb')](function(_0x40225e){logger[_0x63da('0xc')](_0x63da('0xd'),_0x5a9ef9,_0x63da('0xe'));logger[_0x63da('0xf')](_0x63da('0x10'),_0x5a9ef9,_0x63da('0xe'),JSON['stringify'](_0x40225e));if(_0x40225e[_0x63da('0x11')]){if(_0x40225e[_0x63da('0x11')][_0x63da('0x12')]===0x1f4){logger[_0x63da('0x11')](_0x63da('0xd'),_0x5a9ef9,_0x40225e[_0x63da('0x11')]['message']);return _0x388e0f(_0x40225e['error'][_0x63da('0x13')]);}logger[_0x63da('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a9ef9,_0x40225e[_0x63da('0x11')][_0x63da('0x13')]);return _0x3188dd(_0x40225e[_0x63da('0x11')][_0x63da('0x13')]);}else{logger[_0x63da('0xc')](_0x63da('0xd'),_0x5a9ef9,_0x63da('0xe'));_0x3188dd(_0x40225e[_0x63da('0x14')]['message']);}})[_0x63da('0x15')](function(_0x44a896){logger[_0x63da('0x11')](_0x63da('0xd'),_0x5a9ef9,_0x44a896);_0x388e0f(_0x44a896);});});} \ No newline at end of file +var _0x58a5=['client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x58a5,0x107));var _0x558a=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0x58a5[_0x318256];return _0xb1e352;};'use strict';var _=require(_0x558a('0x0'));var util=require(_0x558a('0x1'));var moment=require(_0x558a('0x2'));var BPromise=require(_0x558a('0x3'));var rs=require(_0x558a('0x4'));var fs=require('fs');var Redis=require(_0x558a('0x5'));var db=require(_0x558a('0x6'))['db'];var utils=require(_0x558a('0x7'));var logger=require(_0x558a('0x8'))(_0x558a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x558a('0xa')][_0x558a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x520061,_0x4dbe12,_0x25d27b){return new BPromise(function(_0x4874f2,_0x1163cd){return client[_0x558a('0xc')](_0x520061,_0x25d27b)[_0x558a('0xd')](function(_0x82e409){logger[_0x558a('0xe')](_0x558a('0xf'),_0x4dbe12,_0x558a('0x10'));logger[_0x558a('0x11')](_0x558a('0x12'),_0x4dbe12,_0x558a('0x10'),JSON['stringify'](_0x82e409));if(_0x82e409['error']){if(_0x82e409[_0x558a('0x13')]['code']===0x1f4){logger[_0x558a('0x13')](_0x558a('0xf'),_0x4dbe12,_0x82e409[_0x558a('0x13')][_0x558a('0x14')]);return _0x1163cd(_0x82e409[_0x558a('0x13')][_0x558a('0x14')]);}logger[_0x558a('0x13')](_0x558a('0xf'),_0x4dbe12,_0x82e409[_0x558a('0x13')][_0x558a('0x14')]);return _0x4874f2(_0x82e409[_0x558a('0x13')]['message']);}else{logger[_0x558a('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4dbe12,'request\x20sent');_0x4874f2(_0x82e409['result']['message']);}})['catch'](function(_0x4b0124){logger[_0x558a('0x13')](_0x558a('0xf'),_0x4dbe12,_0x4b0124);_0x1163cd(_0x4b0124);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index be315f8..cd58781 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xedd9,0xfc));var _0x9edd=function(_0xe5de3f,_0xfcafba){_0xe5de3f=_0xe5de3f-0x0;var _0x30a535=_0xedd9[_0xe5de3f];return _0x30a535;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _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(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xedd9,0xfc));var _0x9edd=function(_0x2ae1a7,_0x272349){_0x2ae1a7=_0x2ae1a7-0x0;var _0x51f436=_0xedd9[_0x2ae1a7];return _0x51f436;};'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 cddc4d0..ca1c2e1 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 _0x70e9=['STRING','exports','ENUM','variable','customVariable','string'];(function(_0x1f9faf,_0x227808){var _0x13ab2c=function(_0x3c709f){while(--_0x3c709f){_0x1f9faf['push'](_0x1f9faf['shift']());}};_0x13ab2c(++_0x227808);}(_0x70e9,0x193));var _0x970e=function(_0x584ab7,_0x579ca8){_0x584ab7=_0x584ab7-0x0;var _0x2402eb=_0x70e9[_0x584ab7];return _0x2402eb;};'use strict';var Sequelize=require('sequelize');module[_0x970e('0x0')]={'type':{'type':Sequelize[_0x970e('0x1')]('string',_0x970e('0x2'),_0x970e('0x3'),'keyValue'),'defaultValue':_0x970e('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x970e('0x5')]},'keyType':{'type':Sequelize[_0x970e('0x1')](_0x970e('0x4'),_0x970e('0x2'),_0x970e('0x3'))},'keyContent':{'type':Sequelize[_0x970e('0x5')]},'idField':{'type':Sequelize[_0x970e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x970e('0x5')]}}; \ No newline at end of file +var _0x49fe=['sequelize','exports','ENUM','customVariable','string','STRING','variable','BOOLEAN'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x49fe,0x100));var _0xe49f=function(_0x11b1b4,_0x3c6aef){_0x11b1b4=_0x11b1b4-0x0;var _0x20084a=_0x49fe[_0x11b1b4];return _0x20084a;};'use strict';var Sequelize=require(_0xe49f('0x0'));module[_0xe49f('0x1')]={'type':{'type':Sequelize[_0xe49f('0x2')]('string','variable',_0xe49f('0x3'),'keyValue'),'defaultValue':_0xe49f('0x4')},'content':{'type':Sequelize[_0xe49f('0x5')]},'key':{'type':Sequelize[_0xe49f('0x5')]},'keyType':{'type':Sequelize[_0xe49f('0x2')]('string',_0xe49f('0x6'),_0xe49f('0x3'))},'keyContent':{'type':Sequelize[_0xe49f('0x5')]},'idField':{'type':Sequelize[_0xe49f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe49f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe49f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a84bcd4..47210ea 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 _0x50ca=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','html-pdf','eml-format','rimraf','moment','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','apply','save','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge'];(function(_0xefd3ad,_0x3edb88){var _0x281308=function(_0x5190fd){while(--_0x5190fd){_0xefd3ad['push'](_0xefd3ad['shift']());}};_0x281308(++_0x3edb88);}(_0x50ca,0x1aa));var _0xa50c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x50ca[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xa50c('0x0'));var emlformat=require(_0xa50c('0x1'));var rimraf=require(_0xa50c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa50c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa50c('0x4'));var util=require('util');var path=require(_0xa50c('0x5'));var sox=require('sox');var csv=require(_0xa50c('0x6'));var ejs=require(_0xa50c('0x7'));var fs=require('fs');var _=require(_0xa50c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa50c('0x9'));var deskjs=require(_0xa50c('0xa'));var toCsv=require(_0xa50c('0x6'));var querystring=require(_0xa50c('0xb'));var Papa=require(_0xa50c('0xc'));var Redis=require(_0xa50c('0xd'));var authService=require(_0xa50c('0xe'));var qs=require(_0xa50c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa50c('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa50c('0x11'));var config=require(_0xa50c('0x12'));var db=require(_0xa50c('0x13'))['db'];function respondWithStatusCode(_0x31adf4,_0x590146){_0x590146=_0x590146||0xcc;return function(_0x1532ca){if(_0x1532ca){return _0x31adf4[_0xa50c('0x14')](_0x590146);}return _0x31adf4[_0xa50c('0x15')](_0x590146)[_0xa50c('0x16')]();};}function respondWithResult(_0x506f77,_0x1367a9){_0x1367a9=_0x1367a9||0xc8;return function(_0x53c7c9){if(_0x53c7c9){return _0x506f77[_0xa50c('0x15')](_0x1367a9)[_0xa50c('0x17')](_0x53c7c9);}};}function respondWithFilteredResult(_0x4eb291,_0x244dcc){return function(_0x4bebfa){if(_0x4bebfa){var _0x3cf523=_0x4bebfa[_0xa50c('0x18')],_0x1b6676=_0x244dcc['offset'],_0x45357a=_0x244dcc['offset']+_0x244dcc[_0xa50c('0x19')],_0x5b9d1a;if(_0x45357a>=_0x3cf523){_0x45357a=_0x3cf523;_0x5b9d1a=0xc8;}else{_0x5b9d1a=0xce;}_0x4eb291[_0xa50c('0x15')](_0x5b9d1a);return _0x4eb291['set']('Content-Range',_0x1b6676+'-'+_0x45357a+'/'+_0x3cf523)['json'](_0x4bebfa);}return null;};}function patchUpdates(_0x32b4c5){return function(_0x2cdf4b){try{jsonpatch[_0xa50c('0x1a')](_0x2cdf4b,_0x32b4c5,!![]);}catch(_0x4ab15e){return BPromise['reject'](_0x4ab15e);}return _0x2cdf4b[_0xa50c('0x1b')]();};}function saveUpdates(_0xc5693f,_0x7877e6){return function(_0x4f7380){if(_0x4f7380){return _0x4f7380['update'](_0xc5693f)['then'](function(_0x450d51){return _0x450d51;});}return null;};}function removeEntity(_0x20de3f,_0x30f004){return function(_0xb3bce1){if(_0xb3bce1){return _0xb3bce1[_0xa50c('0x1c')]()[_0xa50c('0x1d')](function(){_0x20de3f[_0xa50c('0x15')](0xcc)[_0xa50c('0x16')]();});}};}function handleEntityNotFound(_0x166e39,_0x222327){return function(_0x24d0b2){if(!_0x24d0b2){_0x166e39[_0xa50c('0x14')](0x194);}return _0x24d0b2;};}function handleError(_0x3afc34,_0x40cf65){_0x40cf65=_0x40cf65||0x1f4;return function(_0x385fa9){logger[_0xa50c('0x1e')](_0x385fa9[_0xa50c('0x1f')]);if(_0x385fa9[_0xa50c('0x20')]){delete _0x385fa9[_0xa50c('0x20')];}_0x3afc34[_0xa50c('0x15')](_0x40cf65)[_0xa50c('0x21')](_0x385fa9);};}exports[_0xa50c('0x22')]=function(_0x1dbc1d,_0x17ea75){var _0x30ee4f={},_0x1eb4f8={},_0x3ee1ff={'count':0x0,'rows':[]};var _0x562919=_[_0xa50c('0x23')](db[_0xa50c('0x24')][_0xa50c('0x25')],function(_0x3ea56d){return{'name':_0x3ea56d[_0xa50c('0x26')],'type':_0x3ea56d[_0xa50c('0x27')][_0xa50c('0x28')]};});_0x1eb4f8[_0xa50c('0x29')]=_[_0xa50c('0x23')](_0x562919,_0xa50c('0x20'));_0x1eb4f8[_0xa50c('0x2a')]=_[_0xa50c('0x2b')](_0x1dbc1d['query']);_0x1eb4f8[_0xa50c('0x2c')]=_[_0xa50c('0x2d')](_0x1eb4f8[_0xa50c('0x29')],_0x1eb4f8[_0xa50c('0x2a')]);_0x30ee4f[_0xa50c('0x2e')]=_[_0xa50c('0x2d')](_0x1eb4f8[_0xa50c('0x29')],qs[_0xa50c('0x2f')](_0x1dbc1d[_0xa50c('0x2a')]['fields']));_0x30ee4f['attributes']=_0x30ee4f[_0xa50c('0x2e')][_0xa50c('0x30')]?_0x30ee4f[_0xa50c('0x2e')]:_0x1eb4f8['model'];if(!_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x31')]('nolimit')){_0x30ee4f[_0xa50c('0x19')]=qs[_0xa50c('0x19')](_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x19')]);_0x30ee4f[_0xa50c('0x32')]=qs[_0xa50c('0x32')](_0x1dbc1d[_0xa50c('0x2a')]['offset']);}_0x30ee4f[_0xa50c('0x33')]=qs[_0xa50c('0x34')](_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x34')]);_0x30ee4f['where']=qs[_0xa50c('0x2c')](_[_0xa50c('0x35')](_0x1dbc1d['query'],_0x1eb4f8[_0xa50c('0x2c')]),_0x562919);if(_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x36')]){_0x30ee4f[_0xa50c('0x37')]=_[_0xa50c('0x38')](_0x30ee4f[_0xa50c('0x37')],{'$or':_[_0xa50c('0x23')](_0x562919,function(_0x2ad1af){if(_0x2ad1af[_0xa50c('0x27')]!==_0xa50c('0x39')){var _0x1bb226={};_0x1bb226[_0x2ad1af['name']]={'$like':'%'+_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x36')]+'%'};return _0x1bb226;}})});}_0x30ee4f=_['merge']({},_0x30ee4f,_0x1dbc1d[_0xa50c('0x3a')]);var _0x494c42={'where':_0x30ee4f['where']};return db['FreshdeskField']['count'](_0x494c42)[_0xa50c('0x1d')](function(_0x590e7b){_0x3ee1ff[_0xa50c('0x18')]=_0x590e7b;if(_0x1dbc1d[_0xa50c('0x2a')][_0xa50c('0x3b')]){_0x30ee4f[_0xa50c('0x3c')]=[{'all':!![]}];}return db[_0xa50c('0x24')][_0xa50c('0x3d')](_0x30ee4f);})['then'](function(_0x1c6fd9){_0x3ee1ff['rows']=_0x1c6fd9;return _0x3ee1ff;})[_0xa50c('0x1d')](respondWithFilteredResult(_0x17ea75,_0x30ee4f))[_0xa50c('0x3e')](handleError(_0x17ea75,null));};exports[_0xa50c('0x3f')]=function(_0x2be088,_0x3ffcb8){var _0x435193={'raw':!![],'where':{'id':_0x2be088[_0xa50c('0x40')]['id']}},_0x318b18={};_0x318b18[_0xa50c('0x29')]=_[_0xa50c('0x2b')](db['FreshdeskField'][_0xa50c('0x25')]);_0x318b18['query']=_['keys'](_0x2be088['query']);_0x318b18[_0xa50c('0x2c')]=_[_0xa50c('0x2d')](_0x318b18[_0xa50c('0x29')],_0x318b18['query']);_0x435193[_0xa50c('0x2e')]=_[_0xa50c('0x2d')](_0x318b18['model'],qs[_0xa50c('0x2f')](_0x2be088['query']['fields']));_0x435193[_0xa50c('0x2e')]=_0x435193[_0xa50c('0x2e')]['length']?_0x435193[_0xa50c('0x2e')]:_0x318b18[_0xa50c('0x29')];if(_0x2be088[_0xa50c('0x2a')]['includeAll']){_0x435193['include']=[{'all':!![]}];}_0x435193=_[_0xa50c('0x38')]({},_0x435193,_0x2be088['options']);return db[_0xa50c('0x24')][_0xa50c('0x41')](_0x435193)[_0xa50c('0x1d')](handleEntityNotFound(_0x3ffcb8,null))[_0xa50c('0x1d')](respondWithResult(_0x3ffcb8,null))[_0xa50c('0x3e')](handleError(_0x3ffcb8,null));};exports[_0xa50c('0x42')]=function(_0x48c5d2,_0x3bbede){return db[_0xa50c('0x24')][_0xa50c('0x42')](_0x48c5d2['body'],{})[_0xa50c('0x1d')](respondWithResult(_0x3bbede,0xc9))[_0xa50c('0x3e')](handleError(_0x3bbede,null));};exports[_0xa50c('0x43')]=function(_0x434d74,_0x9c4296){if(_0x434d74[_0xa50c('0x44')]['id']){delete _0x434d74[_0xa50c('0x44')]['id'];}return db[_0xa50c('0x24')][_0xa50c('0x41')]({'where':{'id':_0x434d74[_0xa50c('0x40')]['id']}})['then'](handleEntityNotFound(_0x9c4296,null))['then'](saveUpdates(_0x434d74[_0xa50c('0x44')],null))[_0xa50c('0x1d')](respondWithResult(_0x9c4296,null))[_0xa50c('0x3e')](handleError(_0x9c4296,null));};exports['destroy']=function(_0x4fbd4b,_0x264632){return db['FreshdeskField'][_0xa50c('0x41')]({'where':{'id':_0x4fbd4b[_0xa50c('0x40')]['id']}})[_0xa50c('0x1d')](handleEntityNotFound(_0x264632,null))[_0xa50c('0x1d')](removeEntity(_0x264632,null))['catch'](handleError(_0x264632,null));}; \ No newline at end of file +var _0xcae8=['then','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','params','includeAll','catch','create','update','body','find','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xcae8,0x128));var _0x8cae=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0xcae8[_0x3f2228];return _0x285ae4;};'use strict';var pdf=require(_0x8cae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8cae('0x1'));var rp=require(_0x8cae('0x2'));var moment=require(_0x8cae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8cae('0x4'));var util=require(_0x8cae('0x5'));var path=require(_0x8cae('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8cae('0x7'));var fs=require('fs');var _=require(_0x8cae('0x8'));var squel=require(_0x8cae('0x9'));var crypto=require(_0x8cae('0xa'));var jsforce=require(_0x8cae('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cae('0xc'));var Papa=require(_0x8cae('0xd'));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(_0x8cae('0xe'))(_0x8cae('0xf'));var utils=require('../../config/utils');var config=require(_0x8cae('0x10'));var db=require(_0x8cae('0x11'))['db'];function respondWithStatusCode(_0x17edda,_0x2a997f){_0x2a997f=_0x2a997f||0xcc;return function(_0x4a97c2){if(_0x4a97c2){return _0x17edda[_0x8cae('0x12')](_0x2a997f);}return _0x17edda[_0x8cae('0x13')](_0x2a997f)[_0x8cae('0x14')]();};}function respondWithResult(_0x7b5d9a,_0x2d2b8b){_0x2d2b8b=_0x2d2b8b||0xc8;return function(_0x18f3c4){if(_0x18f3c4){return _0x7b5d9a[_0x8cae('0x13')](_0x2d2b8b)[_0x8cae('0x15')](_0x18f3c4);}};}function respondWithFilteredResult(_0x5f1bfc,_0x19809e){return function(_0x3d98ca){if(_0x3d98ca){var _0x3f1662=_0x3d98ca[_0x8cae('0x16')],_0x3959fc=_0x19809e['offset'],_0x39b828=_0x19809e[_0x8cae('0x17')]+_0x19809e['limit'],_0x3ffbb1;if(_0x39b828>=_0x3f1662){_0x39b828=_0x3f1662;_0x3ffbb1=0xc8;}else{_0x3ffbb1=0xce;}_0x5f1bfc['status'](_0x3ffbb1);return _0x5f1bfc[_0x8cae('0x18')]('Content-Range',_0x3959fc+'-'+_0x39b828+'/'+_0x3f1662)[_0x8cae('0x15')](_0x3d98ca);}return null;};}function patchUpdates(_0x229513){return function(_0x204308){try{jsonpatch[_0x8cae('0x19')](_0x204308,_0x229513,!![]);}catch(_0x556a89){return BPromise[_0x8cae('0x1a')](_0x556a89);}return _0x204308[_0x8cae('0x1b')]();};}function saveUpdates(_0x18ce90,_0x1b6c42){return function(_0x50db67){if(_0x50db67){return _0x50db67['update'](_0x18ce90)['then'](function(_0x229c9a){return _0x229c9a;});}return null;};}function removeEntity(_0x53b48f,_0xeb2513){return function(_0x2f654d){if(_0x2f654d){return _0x2f654d[_0x8cae('0x1c')]()[_0x8cae('0x1d')](function(){_0x53b48f[_0x8cae('0x13')](0xcc)[_0x8cae('0x14')]();});}};}function handleEntityNotFound(_0x52f525,_0x7f0f46){return function(_0x331431){if(!_0x331431){_0x52f525[_0x8cae('0x12')](0x194);}return _0x331431;};}function handleError(_0x2c98c8,_0x2819e3){_0x2819e3=_0x2819e3||0x1f4;return function(_0x5dcb20){logger[_0x8cae('0x1e')](_0x5dcb20[_0x8cae('0x1f')]);if(_0x5dcb20['name']){delete _0x5dcb20[_0x8cae('0x20')];}_0x2c98c8[_0x8cae('0x13')](_0x2819e3)['send'](_0x5dcb20);};}exports['index']=function(_0x23a3a0,_0x46fcb8){var _0xc4980a={},_0x289c79={},_0x3575be={'count':0x0,'rows':[]};var _0x54d60c=_[_0x8cae('0x21')](db[_0x8cae('0x22')][_0x8cae('0x23')],function(_0xe35208){return{'name':_0xe35208[_0x8cae('0x24')],'type':_0xe35208[_0x8cae('0x25')][_0x8cae('0x26')]};});_0x289c79['model']=_[_0x8cae('0x21')](_0x54d60c,_0x8cae('0x20'));_0x289c79['query']=_[_0x8cae('0x27')](_0x23a3a0[_0x8cae('0x28')]);_0x289c79[_0x8cae('0x29')]=_[_0x8cae('0x2a')](_0x289c79['model'],_0x289c79[_0x8cae('0x28')]);_0xc4980a[_0x8cae('0x2b')]=_[_0x8cae('0x2a')](_0x289c79['model'],qs[_0x8cae('0x2c')](_0x23a3a0['query'][_0x8cae('0x2c')]));_0xc4980a['attributes']=_0xc4980a[_0x8cae('0x2b')][_0x8cae('0x2d')]?_0xc4980a[_0x8cae('0x2b')]:_0x289c79[_0x8cae('0x2e')];if(!_0x23a3a0[_0x8cae('0x28')]['hasOwnProperty'](_0x8cae('0x2f'))){_0xc4980a[_0x8cae('0x30')]=qs[_0x8cae('0x30')](_0x23a3a0[_0x8cae('0x28')][_0x8cae('0x30')]);_0xc4980a[_0x8cae('0x17')]=qs[_0x8cae('0x17')](_0x23a3a0[_0x8cae('0x28')][_0x8cae('0x17')]);}_0xc4980a[_0x8cae('0x31')]=qs['sort'](_0x23a3a0[_0x8cae('0x28')][_0x8cae('0x32')]);_0xc4980a[_0x8cae('0x33')]=qs[_0x8cae('0x29')](_[_0x8cae('0x34')](_0x23a3a0['query'],_0x289c79[_0x8cae('0x29')]),_0x54d60c);if(_0x23a3a0['query']['filter']){_0xc4980a[_0x8cae('0x33')]=_['merge'](_0xc4980a['where'],{'$or':_[_0x8cae('0x21')](_0x54d60c,function(_0x2c52c4){if(_0x2c52c4['type']!==_0x8cae('0x35')){var _0x14435e={};_0x14435e[_0x2c52c4[_0x8cae('0x20')]]={'$like':'%'+_0x23a3a0[_0x8cae('0x28')][_0x8cae('0x36')]+'%'};return _0x14435e;}})});}_0xc4980a=_[_0x8cae('0x37')]({},_0xc4980a,_0x23a3a0['options']);var _0x3d8641={'where':_0xc4980a[_0x8cae('0x33')]};return db[_0x8cae('0x22')][_0x8cae('0x16')](_0x3d8641)[_0x8cae('0x1d')](function(_0x840877){_0x3575be[_0x8cae('0x16')]=_0x840877;if(_0x23a3a0[_0x8cae('0x28')]['includeAll']){_0xc4980a[_0x8cae('0x38')]=[{'all':!![]}];}return db[_0x8cae('0x22')][_0x8cae('0x39')](_0xc4980a);})[_0x8cae('0x1d')](function(_0x1306e5){_0x3575be['rows']=_0x1306e5;return _0x3575be;})[_0x8cae('0x1d')](respondWithFilteredResult(_0x46fcb8,_0xc4980a))['catch'](handleError(_0x46fcb8,null));};exports['show']=function(_0xde2a14,_0x1bf9fc){var _0x4b9055={'raw':!![],'where':{'id':_0xde2a14[_0x8cae('0x3a')]['id']}},_0x1d8466={};_0x1d8466[_0x8cae('0x2e')]=_[_0x8cae('0x27')](db[_0x8cae('0x22')][_0x8cae('0x23')]);_0x1d8466[_0x8cae('0x28')]=_[_0x8cae('0x27')](_0xde2a14[_0x8cae('0x28')]);_0x1d8466[_0x8cae('0x29')]=_[_0x8cae('0x2a')](_0x1d8466[_0x8cae('0x2e')],_0x1d8466[_0x8cae('0x28')]);_0x4b9055['attributes']=_['intersection'](_0x1d8466[_0x8cae('0x2e')],qs[_0x8cae('0x2c')](_0xde2a14[_0x8cae('0x28')]['fields']));_0x4b9055['attributes']=_0x4b9055[_0x8cae('0x2b')][_0x8cae('0x2d')]?_0x4b9055[_0x8cae('0x2b')]:_0x1d8466[_0x8cae('0x2e')];if(_0xde2a14['query'][_0x8cae('0x3b')]){_0x4b9055['include']=[{'all':!![]}];}_0x4b9055=_[_0x8cae('0x37')]({},_0x4b9055,_0xde2a14['options']);return db[_0x8cae('0x22')]['find'](_0x4b9055)[_0x8cae('0x1d')](handleEntityNotFound(_0x1bf9fc,null))['then'](respondWithResult(_0x1bf9fc,null))[_0x8cae('0x3c')](handleError(_0x1bf9fc,null));};exports[_0x8cae('0x3d')]=function(_0x31bc70,_0x1ef90e){return db[_0x8cae('0x22')][_0x8cae('0x3d')](_0x31bc70['body'],{})[_0x8cae('0x1d')](respondWithResult(_0x1ef90e,0xc9))[_0x8cae('0x3c')](handleError(_0x1ef90e,null));};exports[_0x8cae('0x3e')]=function(_0x275552,_0x55934b){if(_0x275552['body']['id']){delete _0x275552[_0x8cae('0x3f')]['id'];}return db[_0x8cae('0x22')][_0x8cae('0x40')]({'where':{'id':_0x275552[_0x8cae('0x3a')]['id']}})[_0x8cae('0x1d')](handleEntityNotFound(_0x55934b,null))[_0x8cae('0x1d')](saveUpdates(_0x275552[_0x8cae('0x3f')],null))[_0x8cae('0x1d')](respondWithResult(_0x55934b,null))[_0x8cae('0x3c')](handleError(_0x55934b,null));};exports[_0x8cae('0x1c')]=function(_0x18784,_0x1b261a){return db[_0x8cae('0x22')]['find']({'where':{'id':_0x18784[_0x8cae('0x3a')]['id']}})[_0x8cae('0x1d')](handleEntityNotFound(_0x1b261a,null))['then'](removeEntity(_0x1b261a,null))[_0x8cae('0x3c')](handleError(_0x1b261a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0e96e7f..566c091 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 _0xffa2=['FieldId','lodash','util','../../config/logger','moment','request-promise','rimraf','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x56cfae,_0x34684c){var _0x1f8c80=function(_0x8e6c7b){while(--_0x8e6c7b){_0x56cfae['push'](_0x56cfae['shift']());}};_0x1f8c80(++_0x34684c);}(_0xffa2,0xb5));var _0x2ffa=function(_0x395496,_0x5d102e){_0x395496=_0x395496-0x0;var _0x5cdd98=_0xffa2[_0x395496];return _0x5cdd98;};'use strict';var _=require(_0x2ffa('0x0'));var util=require(_0x2ffa('0x1'));var logger=require(_0x2ffa('0x2'))('api');var moment=require(_0x2ffa('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ffa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ffa('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0xb687a,_0x1375f9){return _0xb687a['define']('FreshdeskField',attributes,{'tableName':_0x2ffa('0x6'),'paranoid':![],'indexes':[{'name':_0x2ffa('0x7'),'fields':['idField',_0x2ffa('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2da=['api','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','idField','FieldId','lodash','util','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe2da,0x8c));var _0xae2d=function(_0xf1dd0f,_0x3198f3){_0xf1dd0f=_0xf1dd0f-0x0;var _0x1122e2=_0xe2da[_0xf1dd0f];return _0x1122e2;};'use strict';var _=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var logger=require(_0xae2d('0x2'))(_0xae2d('0x3'));var moment=require('moment');var BPromise=require(_0xae2d('0x4'));var rp=require(_0xae2d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae2d('0x6'));var config=require('../../config/environment');var attributes=require(_0xae2d('0x7'));module[_0xae2d('0x8')]=function(_0xc8de1c,_0x3cc2e5){return _0xc8de1c['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xae2d('0x9'),_0xae2d('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 0dec44f..846182b 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a355a,_0x27a94c){var _0x1e37da=function(_0x2a4f14){while(--_0x2a4f14){_0x3a355a['push'](_0x3a355a['shift']());}};_0x1e37da(++_0x27a94c);}(_0xb10b,0x12a));var _0xbb10=function(_0x56a347,_0x54d322){_0x56a347=_0x56a347-0x0;var _0x2745f7=_0xb10b[_0x56a347];return _0x2745f7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5a18c9,_0x55ba8c){var _0x2b34f4=function(_0x3ec37d){while(--_0x3ec37d){_0x5a18c9['push'](_0x5a18c9['shift']());}};_0x2b34f4(++_0x55ba8c);}(_0xb10b,0x12a));var _0xbb10=function(_0x144049,_0x4e6ccf){_0x144049=_0x144049-0x0;var _0x517caa=_0xb10b[_0x144049];return _0x517caa;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 92eab00..fc80faf 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 _0x2250=['getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','/:id','/:id/configurations','isAuthenticated'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0x2250,0x17e));var _0x0225=function(_0xeb54bb,_0x2d8002){_0xeb54bb=_0xeb54bb-0x0;var _0x4d430f=_0x2250[_0xeb54bb];return _0x4d430f;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require('path');var timeout=require(_0x0225('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0225('0x3'));var config=require(_0x0225('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0x0225('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0225('0x6'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0225('0x7'),auth[_0x0225('0x8')](),controller[_0x0225('0x9')]);router[_0x0225('0x5')](_0x0225('0xa'),auth[_0x0225('0x8')](),controller[_0x0225('0xb')]);router[_0x0225('0xc')]('/',auth[_0x0225('0x8')](),controller['create']);router[_0x0225('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0225('0xd')]);router[_0x0225('0xe')]('/:id',auth[_0x0225('0x8')](),controller[_0x0225('0xf')]);router['delete'](_0x0225('0x6'),auth[_0x0225('0x8')](),controller['destroy']);module[_0x0225('0x10')]=router; \ No newline at end of file +var _0x9932=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy'];(function(_0x433fc0,_0x3e3711){var _0x3956bb=function(_0x232b9d){while(--_0x232b9d){_0x433fc0['push'](_0x433fc0['shift']());}};_0x3956bb(++_0x3e3711);}(_0x9932,0x1a3));var _0x2993=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x9932[_0xa3c06b];return _0x33aa1d;};'use strict';var multer=require(_0x2993('0x0'));var util=require('util');var path=require(_0x2993('0x1'));var timeout=require(_0x2993('0x2'));var express=require('express');var router=express[_0x2993('0x3')]();var auth=require(_0x2993('0x4'));var interaction=require(_0x2993('0x5'));var config=require(_0x2993('0x6'));var controller=require(_0x2993('0x7'));router[_0x2993('0x8')]('/',auth[_0x2993('0x9')](),controller[_0x2993('0xa')]);router[_0x2993('0x8')](_0x2993('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2993('0x8')](_0x2993('0xc'),auth[_0x2993('0x9')](),controller[_0x2993('0xd')]);router[_0x2993('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2993('0xe')]);router[_0x2993('0xf')]('/',auth[_0x2993('0x9')](),controller[_0x2993('0x10')]);router[_0x2993('0xf')](_0x2993('0xc'),auth[_0x2993('0x9')](),controller[_0x2993('0x11')]);router[_0x2993('0x12')](_0x2993('0xb'),auth[_0x2993('0x9')](),controller[_0x2993('0x13')]);router['delete'](_0x2993('0xb'),auth[_0x2993('0x9')](),controller[_0x2993('0x14')]);module[_0x2993('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3ccd276..bf2f415 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 _0x75dc=['remoteUri','sequelize','exports','username','STRING'];(function(_0x2ce38b,_0x29cb69){var _0x7f9db=function(_0x33b613){while(--_0x33b613){_0x2ce38b['push'](_0x2ce38b['shift']());}};_0x7f9db(++_0x29cb69);}(_0x75dc,0x1d7));var _0xc75d=function(_0x40e00e,_0xe3ddfa){_0x40e00e=_0x40e00e-0x0;var _0x1050de=_0x75dc[_0x40e00e];return _0x1050de;};'use strict';var Sequelize=require(_0xc75d('0x0'));module[_0xc75d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xc75d('0x2')},'apiKey':{'type':Sequelize[_0xc75d('0x3')]},'remoteUri':{'type':Sequelize[_0xc75d('0x3')],'unique':_0xc75d('0x4')},'serverUrl':{'type':Sequelize[_0xc75d('0x3')]}}; \ No newline at end of file +var _0x6b47=['remoteUri','exports','STRING','username'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x6b47,0xe9));var _0x76b4=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x6b47[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module[_0x76b4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x76b4('0x1')]},'username':{'type':Sequelize[_0x76b4('0x1')],'unique':_0x76b4('0x2')},'apiKey':{'type':Sequelize[_0x76b4('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x76b4('0x3')},'serverUrl':{'type':Sequelize[_0x76b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 9375682..6a6038a 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 _0x01d5=['jayson/promise','client','http','test','Sequelize','ValidationError','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','set','Content-Range','then','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','show','include','options','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration'];(function(_0x1ab245,_0x569c57){var _0x400e6b=function(_0x45f2a3){while(--_0x45f2a3){_0x1ab245['push'](_0x1ab245['shift']());}};_0x400e6b(++_0x569c57);}(_0x01d5,0x13f));var _0x501d=function(_0x5bd475,_0x3f7ba4){_0x5bd475=_0x5bd475-0x0;var _0x1ef782=_0x01d5[_0x5bd475];return _0x1ef782;};'use strict';var pdf=require(_0x501d('0x0'));var emlformat=require(_0x501d('0x1'));var rimraf=require(_0x501d('0x2'));var zipdir=require(_0x501d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x501d('0x4'));var moment=require(_0x501d('0x5'));var BPromise=require(_0x501d('0x6'));var Mustache=require(_0x501d('0x7'));var util=require(_0x501d('0x8'));var path=require('path');var sox=require(_0x501d('0x9'));var csv=require(_0x501d('0xa'));var ejs=require(_0x501d('0xb'));var fs=require('fs');var _=require(_0x501d('0xc'));var squel=require(_0x501d('0xd'));var crypto=require(_0x501d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x501d('0xf'));var toCsv=require(_0x501d('0xa'));var querystring=require('querystring');var Papa=require(_0x501d('0x10'));var Redis=require('ioredis');var authService=require(_0x501d('0x11'));var qs=require(_0x501d('0x12'));var as=require(_0x501d('0x13'));var hardwareService=require(_0x501d('0x14'));var logger=require(_0x501d('0x15'))(_0x501d('0x16'));var utils=require('../../config/utils');var config=require(_0x501d('0x17'));var db=require(_0x501d('0x18'))['db'];var integrations=require(_0x501d('0x19'));var jayson=require(_0x501d('0x1a'));var client=jayson[_0x501d('0x1b')][_0x501d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x507e89,_0x21d0a8,_0x49bafc){if(_0x49bafc){var _0x5b1304=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b1304[_0x501d('0x1d')](_0x21d0a8)){return _0x507e89;}else{throw new db[(_0x501d('0x1e'))][(_0x501d('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 _0x507e89;}}function respondWithRpcPromise(_0x44e939,_0x363164,_0x5b6260,_0x30f8c2){return new BPromise(function(_0x282658,_0x200ac6){var _0x3d475f=_0x30f8c2||client;return _0x3d475f[_0x501d('0x20')](_0x44e939,_0x5b6260)['then'](function(_0x2dc830){logger[_0x501d('0x21')](_0x501d('0x22'),_0x363164,_0x501d('0x23'));logger[_0x501d('0x24')](_0x501d('0x25'),_0x363164,_0x501d('0x23'),JSON[_0x501d('0x26')](_0x2dc830));if(_0x2dc830[_0x501d('0x27')]){if(_0x2dc830['error']['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x363164,_0x2dc830[_0x501d('0x27')][_0x501d('0x28')]);return _0x200ac6(_0x2dc830[_0x501d('0x27')][_0x501d('0x28')]);}logger[_0x501d('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x363164,_0x2dc830['error'][_0x501d('0x28')]);return _0x282658(_0x2dc830[_0x501d('0x27')]['message']);}else{logger[_0x501d('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x363164,_0x501d('0x23'));_0x282658(_0x2dc830['result'][_0x501d('0x28')]);}})[_0x501d('0x29')](function(_0x589fbd){logger[_0x501d('0x27')](_0x501d('0x22'),_0x363164,_0x589fbd);_0x200ac6(_0x589fbd);});});}function respondWithStatusCode(_0x362256,_0x369d51){_0x369d51=_0x369d51||0xcc;return function(_0xc27aec){if(_0xc27aec){return _0x362256[_0x501d('0x2a')](_0x369d51);}return _0x362256['status'](_0x369d51)['end']();};}function respondWithResult(_0x1830df,_0x1596fc){_0x1596fc=_0x1596fc||0xc8;return function(_0x34a44d){if(_0x34a44d){return _0x1830df[_0x501d('0x2b')](_0x1596fc)[_0x501d('0x2c')](_0x34a44d);}};}function respondWithFilteredResult(_0x551d9c,_0x2df1b0){return function(_0x5aa0e3){if(_0x5aa0e3){var _0x5aa943=_0x5aa0e3[_0x501d('0x2d')],_0x47c31c=_0x2df1b0[_0x501d('0x2e')],_0x3e88e9=_0x2df1b0[_0x501d('0x2e')]+_0x2df1b0['limit'],_0x339f3f;if(_0x3e88e9>=_0x5aa943){_0x3e88e9=_0x5aa943;_0x339f3f=0xc8;}else{_0x339f3f=0xce;}_0x551d9c[_0x501d('0x2b')](_0x339f3f);return _0x551d9c[_0x501d('0x2f')](_0x501d('0x30'),_0x47c31c+'-'+_0x3e88e9+'/'+_0x5aa943)['json'](_0x5aa0e3);}return null;};}function patchUpdates(_0x239fa8){return function(_0x4e20b3){try{jsonpatch['apply'](_0x4e20b3,_0x239fa8,!![]);}catch(_0x39121e){return BPromise['reject'](_0x39121e);}return _0x4e20b3['save']();};}function saveUpdates(_0x620ad1,_0x107504){return function(_0x39552b){if(_0x39552b){return _0x39552b['update'](_0x620ad1)[_0x501d('0x31')](function(_0x5a142d){return _0x5a142d;});}return null;};}function removeEntity(_0x463e94,_0x4f0ccb){return function(_0x927908){if(_0x927908){return _0x927908[_0x501d('0x32')]()[_0x501d('0x31')](function(){_0x463e94[_0x501d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x60dec6,_0x1ec2d1){return function(_0xe80985){if(!_0xe80985){_0x60dec6[_0x501d('0x2a')](0x194);}return _0xe80985;};}function handleError(_0x4947ba,_0x465819){_0x465819=_0x465819||0x1f4;return function(_0x39a484){logger[_0x501d('0x27')](_0x39a484[_0x501d('0x33')]);if(_0x39a484[_0x501d('0x34')]){delete _0x39a484[_0x501d('0x34')];}_0x4947ba[_0x501d('0x2b')](_0x465819)[_0x501d('0x35')](_0x39a484);};}exports[_0x501d('0x36')]=function(_0x642df3,_0x47f6a7){var _0x267d80={},_0x3c6345={},_0x1a3edd={'count':0x0,'rows':[]};var _0x51ba2e=_[_0x501d('0x37')](db[_0x501d('0x38')][_0x501d('0x39')],function(_0x54bc94){return{'name':_0x54bc94['fieldName'],'type':_0x54bc94[_0x501d('0x3a')][_0x501d('0x3b')]};});_0x3c6345[_0x501d('0x3c')]=_[_0x501d('0x37')](_0x51ba2e,_0x501d('0x34'));_0x3c6345[_0x501d('0x3d')]=_[_0x501d('0x3e')](_0x642df3[_0x501d('0x3d')]);_0x3c6345['filters']=_['intersection'](_0x3c6345['model'],_0x3c6345['query']);_0x267d80[_0x501d('0x3f')]=_[_0x501d('0x40')](_0x3c6345[_0x501d('0x3c')],qs['fields'](_0x642df3[_0x501d('0x3d')][_0x501d('0x41')]));_0x267d80[_0x501d('0x3f')]=_0x267d80['attributes'][_0x501d('0x42')]?_0x267d80[_0x501d('0x3f')]:_0x3c6345[_0x501d('0x3c')];if(!_0x642df3[_0x501d('0x3d')][_0x501d('0x43')]('nolimit')){_0x267d80[_0x501d('0x44')]=qs[_0x501d('0x44')](_0x642df3['query'][_0x501d('0x44')]);_0x267d80[_0x501d('0x2e')]=qs[_0x501d('0x2e')](_0x642df3[_0x501d('0x3d')][_0x501d('0x2e')]);}_0x267d80[_0x501d('0x45')]=qs[_0x501d('0x46')](_0x642df3['query'][_0x501d('0x46')]);_0x267d80[_0x501d('0x47')]=qs[_0x501d('0x48')](_['pick'](_0x642df3[_0x501d('0x3d')],_0x3c6345[_0x501d('0x48')]),_0x51ba2e);if(_0x642df3[_0x501d('0x3d')][_0x501d('0x49')]){_0x267d80[_0x501d('0x47')]=_[_0x501d('0x4a')](_0x267d80['where'],{'$or':_[_0x501d('0x37')](_0x51ba2e,function(_0xd5103){if(_0xd5103[_0x501d('0x3a')]!==_0x501d('0x4b')){var _0x5f36cb={};_0x5f36cb[_0xd5103[_0x501d('0x34')]]={'$like':'%'+_0x642df3[_0x501d('0x3d')][_0x501d('0x49')]+'%'};return _0x5f36cb;}})});}_0x267d80=_['merge']({},_0x267d80,_0x642df3['options']);var _0x41ee56={'where':_0x267d80['where']};return db['FreshsalesAccount'][_0x501d('0x2d')](_0x41ee56)['then'](function(_0x5251bf){_0x1a3edd['count']=_0x5251bf;if(_0x642df3['query']['includeAll']){_0x267d80['include']=[{'all':!![]}];}return db[_0x501d('0x38')][_0x501d('0x4c')](_0x267d80);})[_0x501d('0x31')](function(_0x25901f){_0x1a3edd[_0x501d('0x4d')]=_0x25901f;return _0x1a3edd;})[_0x501d('0x31')](respondWithFilteredResult(_0x47f6a7,_0x267d80))['catch'](handleError(_0x47f6a7,null));};exports[_0x501d('0x4e')]=function(_0x486ecd,_0x542b41){var _0x452d77={'raw':![],'where':{'id':_0x486ecd['params']['id']}},_0x4b563f={};_0x4b563f[_0x501d('0x3c')]=_[_0x501d('0x3e')](db[_0x501d('0x38')]['rawAttributes']);_0x4b563f[_0x501d('0x3d')]=_[_0x501d('0x3e')](_0x486ecd[_0x501d('0x3d')]);_0x4b563f[_0x501d('0x48')]=_[_0x501d('0x40')](_0x4b563f['model'],_0x4b563f[_0x501d('0x3d')]);_0x452d77[_0x501d('0x3f')]=_[_0x501d('0x40')](_0x4b563f[_0x501d('0x3c')],qs[_0x501d('0x41')](_0x486ecd[_0x501d('0x3d')][_0x501d('0x41')]));_0x452d77['attributes']=_0x452d77['attributes'][_0x501d('0x42')]?_0x452d77[_0x501d('0x3f')]:_0x4b563f[_0x501d('0x3c')];if(_0x486ecd['query']['includeAll']){_0x452d77[_0x501d('0x4f')]=[{'all':!![]}];}_0x452d77=_['merge']({},_0x452d77,_0x486ecd[_0x501d('0x50')]);return db[_0x501d('0x38')][_0x501d('0x51')](_0x452d77)['then'](handleEntityNotFound(_0x542b41,null))['then'](respondWithResult(_0x542b41,null))[_0x501d('0x29')](handleError(_0x542b41,null));};exports[_0x501d('0x52')]=function(_0x4150af,_0xc721a4){return db[_0x501d('0x38')][_0x501d('0x52')](_0x4150af[_0x501d('0x53')],{})[_0x501d('0x31')](respondWithResult(_0xc721a4,0xc9))[_0x501d('0x29')](handleError(_0xc721a4,null));};exports[_0x501d('0x54')]=function(_0x57bee8,_0x596299){if(_0x57bee8[_0x501d('0x53')]['id']){delete _0x57bee8[_0x501d('0x53')]['id'];}return db['FreshsalesAccount'][_0x501d('0x51')]({'where':{'id':_0x57bee8[_0x501d('0x55')]['id']}})[_0x501d('0x31')](handleEntityNotFound(_0x596299,null))[_0x501d('0x31')](saveUpdates(_0x57bee8['body'],null))[_0x501d('0x31')](respondWithResult(_0x596299,null))['catch'](handleError(_0x596299,null));};exports[_0x501d('0x32')]=function(_0x5b0e18,_0x21492c){return db[_0x501d('0x38')][_0x501d('0x51')]({'where':{'id':_0x5b0e18['params']['id']}})[_0x501d('0x31')](handleEntityNotFound(_0x21492c,null))[_0x501d('0x31')](removeEntity(_0x21492c,null))['catch'](handleError(_0x21492c,null));};exports[_0x501d('0x56')]=function(_0x28b066,_0x1f5ada,_0x4a4ae5){var _0x200fdf={};var _0x374799={};var _0x3e6fc0;var _0x40050f;return db[_0x501d('0x38')][_0x501d('0x57')]({'where':{'id':_0x28b066['params']['id']}})['then'](handleEntityNotFound(_0x1f5ada,null))[_0x501d('0x31')](function(_0x45a878){if(_0x45a878){_0x3e6fc0=_0x45a878;_0x374799[_0x501d('0x3c')]=_[_0x501d('0x3e')](db[_0x501d('0x58')][_0x501d('0x39')]);_0x374799[_0x501d('0x3d')]=_[_0x501d('0x3e')](_0x28b066[_0x501d('0x3d')]);_0x374799[_0x501d('0x48')]=_[_0x501d('0x40')](_0x374799['model'],_0x374799['query']);_0x200fdf[_0x501d('0x3f')]=_[_0x501d('0x40')](_0x374799[_0x501d('0x3c')],qs['fields'](_0x28b066[_0x501d('0x3d')][_0x501d('0x41')]));_0x200fdf[_0x501d('0x3f')]=_0x200fdf[_0x501d('0x3f')][_0x501d('0x42')]?_0x200fdf[_0x501d('0x3f')]:_0x374799[_0x501d('0x3c')];_0x200fdf[_0x501d('0x45')]=qs[_0x501d('0x46')](_0x28b066[_0x501d('0x3d')]['sort']);_0x200fdf[_0x501d('0x47')]=qs[_0x501d('0x48')](_[_0x501d('0x59')](_0x28b066[_0x501d('0x3d')],_0x374799[_0x501d('0x48')]));if(_0x28b066[_0x501d('0x3d')][_0x501d('0x49')]){_0x200fdf[_0x501d('0x47')]=_[_0x501d('0x4a')](_0x200fdf[_0x501d('0x47')],{'$or':_[_0x501d('0x37')](_0x200fdf[_0x501d('0x3f')],function(_0x2e7bc1){var _0x3d28b9={};_0x3d28b9[_0x2e7bc1]={'$like':'%'+_0x28b066[_0x501d('0x3d')]['filter']+'%'};return _0x3d28b9;})});}_0x200fdf=_[_0x501d('0x4a')]({},_0x200fdf,_0x28b066[_0x501d('0x50')]);return _0x3e6fc0[_0x501d('0x56')](_0x200fdf);}})[_0x501d('0x31')](function(_0x10b4e4){if(_0x10b4e4){_0x40050f=_0x10b4e4[_0x501d('0x42')];if(!_0x28b066['query']['hasOwnProperty'](_0x501d('0x5a'))){_0x200fdf[_0x501d('0x44')]=qs[_0x501d('0x44')](_0x28b066[_0x501d('0x3d')][_0x501d('0x44')]);_0x200fdf['offset']=qs[_0x501d('0x2e')](_0x28b066[_0x501d('0x3d')][_0x501d('0x2e')]);}return _0x3e6fc0[_0x501d('0x56')](_0x200fdf);}})[_0x501d('0x31')](function(_0x9abde3){if(_0x9abde3){return _0x9abde3?{'count':_0x40050f,'rows':_0x9abde3}:null;}})['then'](respondWithResult(_0x1f5ada,null))['catch'](handleError(_0x1f5ada,null));};exports['addConfiguration']=function(_0x21be72,_0x48696a,_0x45a45f){if(_0x21be72[_0x501d('0x53')]['id']){delete _0x21be72['body']['id'];}return db['FreshsalesAccount'][_0x501d('0x57')]({'where':{'id':_0x21be72[_0x501d('0x55')]['id']}})[_0x501d('0x31')](handleEntityNotFound(_0x48696a,null))[_0x501d('0x31')](function(_0x377244){if(_0x377244){_0x21be72['body'][_0x501d('0x5b')]=_0x377244['id'];_0x21be72['body'][_0x501d('0x5c')]=integrations[_0x501d('0x5d')](_0x21be72[_0x501d('0x53')][_0x501d('0x5e')],_0x21be72[_0x501d('0x53')][_0x501d('0x3a')]);_0x21be72[_0x501d('0x53')][_0x501d('0x5f')]=integrations[_0x501d('0x60')](_0x21be72[_0x501d('0x53')]['channel'],_0x21be72['body']['type']);return db['FreshsalesConfiguration'][_0x501d('0x52')](_0x21be72[_0x501d('0x53')],{'include':[{'model':db[_0x501d('0x61')],'as':_0x501d('0x5c')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x501d('0x31')](respondWithResult(_0x48696a,null))[_0x501d('0x29')](handleError(_0x48696a,null));};exports[_0x501d('0x62')]=function(_0x312388,_0x1527ee,_0x55fc9d){var _0x53f164='';var _0x3c0834='';return db[_0x501d('0x38')][_0x501d('0x57')]({'where':{'id':_0x312388[_0x501d('0x55')]['id']},'attributes':['id','username',_0x501d('0x63'),_0x501d('0x64')]})[_0x501d('0x31')](handleEntityNotFound(_0x1527ee,null))['then'](function(_0x16f2ab){if(_0x16f2ab){_0x3c0834=_0x16f2ab[_0x501d('0x65')];_0x53f164=_0x16f2ab['remoteUri'];var _0x1649e4=_0x16f2ab[_0x501d('0x63')][_0x501d('0x66')](-0x1);if(_0x1649e4==='/'){_0x53f164=_0x53f164[_0x501d('0x67')](0x0,_0x53f164[_0x501d('0x68')](_0x1649e4));}return rp({'method':_0x501d('0x69'),'uri':util[_0x501d('0x6a')](_0x501d('0x6b'),_0x53f164,_0x501d('0x6c')),'headers':{'Authorization':_0x501d('0x6d')+_0x16f2ab[_0x501d('0x64')]},'json':!![]});}})[_0x501d('0x31')](function(_0xb085f8){if(_0xb085f8){var _0x437061=_0xb085f8['users'];var _0x57b6f2=![];var _0x3222ce=null;for(_0x3222ce=0x0;_0x3222ce<_0x437061[_0x501d('0x42')];_0x3222ce++){if(_0x437061[_0x3222ce][_0x501d('0x6e')]===_0x3c0834){_0x57b6f2=!![];}}if(_0x57b6f2){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x501d('0x6f')});}}})[_0x501d('0x31')](respondWithResult(_0x1527ee,null))['catch'](function(_0x48063e){var _0x5e8f6f=_0x312388[_0x501d('0x3d')][_0x501d('0x1d')]?0x1f4:_0x48063e[_0x501d('0x70')]||0x1f4;logger[_0x501d('0x27')](_0x501d('0x71'),_0x501d('0x62'),_0x5e8f6f,JSON[_0x501d('0x26')](_0x48063e));delete _0x48063e[_0x501d('0x34')];if(_0x5e8f6f===0x191){_0x5e8f6f=0x190;}_0x1527ee[_0x501d('0x2b')](_0x5e8f6f)[_0x501d('0x35')](_0x312388['query']['test']?{'message':_0x501d('0x72'),'statusCode':_0x48063e[_0x501d('0x70')]}:_0x48063e);});}; \ No newline at end of file +var _0xb701=['body','update','getConfigurations','FreshsalesConfiguration','sort','options','addConfiguration','AccountId','Descriptions','getDescriptions','channel','Subjects','getFields','findOne','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create'];(function(_0x5b4e34,_0x20551e){var _0x3ca50d=function(_0x4f3f2c){while(--_0x4f3f2c){_0x5b4e34['push'](_0x5b4e34['shift']());}};_0x3ca50d(++_0x20551e);}(_0xb701,0x16d));var _0x1b70=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb701[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x1b70('0x0'));var emlformat=require(_0x1b70('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b70('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b70('0x3'));var Mustache=require(_0x1b70('0x4'));var util=require(_0x1b70('0x5'));var path=require(_0x1b70('0x6'));var sox=require(_0x1b70('0x7'));var csv=require('to-csv');var ejs=require(_0x1b70('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1b70('0x9'));var jsforce=require(_0x1b70('0xa'));var deskjs=require(_0x1b70('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1b70('0xc'));var Papa=require(_0x1b70('0xd'));var Redis=require(_0x1b70('0xe'));var authService=require(_0x1b70('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1b70('0x10'));var hardwareService=require(_0x1b70('0x11'));var logger=require('../../config/logger')(_0x1b70('0x12'));var utils=require(_0x1b70('0x13'));var config=require(_0x1b70('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1b70('0x15'));var jayson=require(_0x1b70('0x16'));var client=jayson[_0x1b70('0x17')][_0x1b70('0x18')]({'port':0x232a});function checkPasswordPattern(_0x266100,_0x58ce0a,_0x472dc8){if(_0x472dc8){var _0x7551b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7551b9[_0x1b70('0x19')](_0x58ce0a)){return _0x266100;}else{throw new db[(_0x1b70('0x1a'))][(_0x1b70('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 _0x266100;}}function respondWithRpcPromise(_0x15c37f,_0x2490dd,_0x2bd600,_0x5f5a32){return new BPromise(function(_0x3d43f9,_0x4d3f30){var _0x4e54bc=_0x5f5a32||client;return _0x4e54bc[_0x1b70('0x1c')](_0x15c37f,_0x2bd600)[_0x1b70('0x1d')](function(_0x1c2e47){logger[_0x1b70('0x1e')](_0x1b70('0x1f'),_0x2490dd,_0x1b70('0x20'));logger['debug'](_0x1b70('0x21'),_0x2490dd,_0x1b70('0x20'),JSON['stringify'](_0x1c2e47));if(_0x1c2e47[_0x1b70('0x22')]){if(_0x1c2e47[_0x1b70('0x22')][_0x1b70('0x23')]===0x1f4){logger[_0x1b70('0x22')](_0x1b70('0x1f'),_0x2490dd,_0x1c2e47['error']['message']);return _0x4d3f30(_0x1c2e47['error'][_0x1b70('0x24')]);}logger['error'](_0x1b70('0x1f'),_0x2490dd,_0x1c2e47['error'][_0x1b70('0x24')]);return _0x3d43f9(_0x1c2e47['error'][_0x1b70('0x24')]);}else{logger[_0x1b70('0x1e')](_0x1b70('0x1f'),_0x2490dd,'request\x20sent');_0x3d43f9(_0x1c2e47[_0x1b70('0x25')][_0x1b70('0x24')]);}})['catch'](function(_0x9d5fd5){logger['error'](_0x1b70('0x1f'),_0x2490dd,_0x9d5fd5);_0x4d3f30(_0x9d5fd5);});});}function respondWithStatusCode(_0x4006f8,_0x56ffcf){_0x56ffcf=_0x56ffcf||0xcc;return function(_0x5bf1d0){if(_0x5bf1d0){return _0x4006f8[_0x1b70('0x26')](_0x56ffcf);}return _0x4006f8['status'](_0x56ffcf)['end']();};}function respondWithResult(_0x41bf5d,_0x5ed3d){_0x5ed3d=_0x5ed3d||0xc8;return function(_0x3297d9){if(_0x3297d9){return _0x41bf5d[_0x1b70('0x27')](_0x5ed3d)[_0x1b70('0x28')](_0x3297d9);}};}function respondWithFilteredResult(_0x9636ba,_0x4c781a){return function(_0x4d5251){if(_0x4d5251){var _0x3e5ca9=_0x4d5251[_0x1b70('0x29')],_0x14c209=_0x4c781a[_0x1b70('0x2a')],_0x3d4dba=_0x4c781a[_0x1b70('0x2a')]+_0x4c781a[_0x1b70('0x2b')],_0x4648c6;if(_0x3d4dba>=_0x3e5ca9){_0x3d4dba=_0x3e5ca9;_0x4648c6=0xc8;}else{_0x4648c6=0xce;}_0x9636ba[_0x1b70('0x27')](_0x4648c6);return _0x9636ba['set'](_0x1b70('0x2c'),_0x14c209+'-'+_0x3d4dba+'/'+_0x3e5ca9)['json'](_0x4d5251);}return null;};}function patchUpdates(_0x366994){return function(_0x2acba0){try{jsonpatch[_0x1b70('0x2d')](_0x2acba0,_0x366994,!![]);}catch(_0x147083){return BPromise[_0x1b70('0x2e')](_0x147083);}return _0x2acba0[_0x1b70('0x2f')]();};}function saveUpdates(_0x269ef5,_0x16ad28){return function(_0x560fc6){if(_0x560fc6){return _0x560fc6['update'](_0x269ef5)['then'](function(_0x41d800){return _0x41d800;});}return null;};}function removeEntity(_0x5c188c,_0x379f73){return function(_0xafb439){if(_0xafb439){return _0xafb439[_0x1b70('0x30')]()[_0x1b70('0x1d')](function(){_0x5c188c[_0x1b70('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bba0a,_0x1aee8a){return function(_0x51081b){if(!_0x51081b){_0x2bba0a[_0x1b70('0x26')](0x194);}return _0x51081b;};}function handleError(_0x5418e5,_0x57d226){_0x57d226=_0x57d226||0x1f4;return function(_0x5b20e8){logger[_0x1b70('0x22')](_0x5b20e8[_0x1b70('0x31')]);if(_0x5b20e8['name']){delete _0x5b20e8[_0x1b70('0x32')];}_0x5418e5[_0x1b70('0x27')](_0x57d226)[_0x1b70('0x33')](_0x5b20e8);};}exports[_0x1b70('0x34')]=function(_0x4f90c1,_0x2d40ff){var _0x420e23={},_0x11ec08={},_0x1df04b={'count':0x0,'rows':[]};var _0x41fa8e=_[_0x1b70('0x35')](db[_0x1b70('0x36')][_0x1b70('0x37')],function(_0x973691){return{'name':_0x973691[_0x1b70('0x38')],'type':_0x973691[_0x1b70('0x39')][_0x1b70('0x3a')]};});_0x11ec08[_0x1b70('0x3b')]=_['map'](_0x41fa8e,_0x1b70('0x32'));_0x11ec08[_0x1b70('0x3c')]=_[_0x1b70('0x3d')](_0x4f90c1[_0x1b70('0x3c')]);_0x11ec08[_0x1b70('0x3e')]=_['intersection'](_0x11ec08['model'],_0x11ec08[_0x1b70('0x3c')]);_0x420e23[_0x1b70('0x3f')]=_['intersection'](_0x11ec08[_0x1b70('0x3b')],qs[_0x1b70('0x40')](_0x4f90c1[_0x1b70('0x3c')][_0x1b70('0x40')]));_0x420e23['attributes']=_0x420e23[_0x1b70('0x3f')]['length']?_0x420e23[_0x1b70('0x3f')]:_0x11ec08[_0x1b70('0x3b')];if(!_0x4f90c1[_0x1b70('0x3c')][_0x1b70('0x41')](_0x1b70('0x42'))){_0x420e23['limit']=qs[_0x1b70('0x2b')](_0x4f90c1['query'][_0x1b70('0x2b')]);_0x420e23[_0x1b70('0x2a')]=qs[_0x1b70('0x2a')](_0x4f90c1[_0x1b70('0x3c')][_0x1b70('0x2a')]);}_0x420e23[_0x1b70('0x43')]=qs['sort'](_0x4f90c1['query']['sort']);_0x420e23[_0x1b70('0x44')]=qs[_0x1b70('0x3e')](_[_0x1b70('0x45')](_0x4f90c1[_0x1b70('0x3c')],_0x11ec08[_0x1b70('0x3e')]),_0x41fa8e);if(_0x4f90c1[_0x1b70('0x3c')][_0x1b70('0x46')]){_0x420e23[_0x1b70('0x44')]=_['merge'](_0x420e23[_0x1b70('0x44')],{'$or':_[_0x1b70('0x35')](_0x41fa8e,function(_0x17755d){if(_0x17755d['type']!=='VIRTUAL'){var _0x19bafc={};_0x19bafc[_0x17755d[_0x1b70('0x32')]]={'$like':'%'+_0x4f90c1[_0x1b70('0x3c')][_0x1b70('0x46')]+'%'};return _0x19bafc;}})});}_0x420e23=_[_0x1b70('0x47')]({},_0x420e23,_0x4f90c1['options']);var _0x3ff3c={'where':_0x420e23[_0x1b70('0x44')]};return db[_0x1b70('0x36')][_0x1b70('0x29')](_0x3ff3c)[_0x1b70('0x1d')](function(_0x36940d){_0x1df04b['count']=_0x36940d;if(_0x4f90c1[_0x1b70('0x3c')]['includeAll']){_0x420e23[_0x1b70('0x48')]=[{'all':!![]}];}return db[_0x1b70('0x36')][_0x1b70('0x49')](_0x420e23);})[_0x1b70('0x1d')](function(_0x4caecc){_0x1df04b[_0x1b70('0x4a')]=_0x4caecc;return _0x1df04b;})[_0x1b70('0x1d')](respondWithFilteredResult(_0x2d40ff,_0x420e23))[_0x1b70('0x4b')](handleError(_0x2d40ff,null));};exports[_0x1b70('0x4c')]=function(_0xe4bf93,_0x1bbc5e){var _0x5027b1={'raw':![],'where':{'id':_0xe4bf93[_0x1b70('0x4d')]['id']}},_0xaa06c6={};_0xaa06c6[_0x1b70('0x3b')]=_['keys'](db[_0x1b70('0x36')][_0x1b70('0x37')]);_0xaa06c6['query']=_[_0x1b70('0x3d')](_0xe4bf93['query']);_0xaa06c6[_0x1b70('0x3e')]=_['intersection'](_0xaa06c6[_0x1b70('0x3b')],_0xaa06c6[_0x1b70('0x3c')]);_0x5027b1['attributes']=_[_0x1b70('0x4e')](_0xaa06c6[_0x1b70('0x3b')],qs['fields'](_0xe4bf93['query'][_0x1b70('0x40')]));_0x5027b1['attributes']=_0x5027b1[_0x1b70('0x3f')][_0x1b70('0x4f')]?_0x5027b1[_0x1b70('0x3f')]:_0xaa06c6['model'];if(_0xe4bf93[_0x1b70('0x3c')][_0x1b70('0x50')]){_0x5027b1[_0x1b70('0x48')]=[{'all':!![]}];}_0x5027b1=_[_0x1b70('0x47')]({},_0x5027b1,_0xe4bf93['options']);return db[_0x1b70('0x36')][_0x1b70('0x51')](_0x5027b1)[_0x1b70('0x1d')](handleEntityNotFound(_0x1bbc5e,null))[_0x1b70('0x1d')](respondWithResult(_0x1bbc5e,null))[_0x1b70('0x4b')](handleError(_0x1bbc5e,null));};exports['create']=function(_0x4b317a,_0x17f503){return db[_0x1b70('0x36')][_0x1b70('0x52')](_0x4b317a[_0x1b70('0x53')],{})[_0x1b70('0x1d')](respondWithResult(_0x17f503,0xc9))[_0x1b70('0x4b')](handleError(_0x17f503,null));};exports[_0x1b70('0x54')]=function(_0x247d5e,_0x29f999){if(_0x247d5e[_0x1b70('0x53')]['id']){delete _0x247d5e['body']['id'];}return db['FreshsalesAccount'][_0x1b70('0x51')]({'where':{'id':_0x247d5e[_0x1b70('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29f999,null))['then'](saveUpdates(_0x247d5e[_0x1b70('0x53')],null))[_0x1b70('0x1d')](respondWithResult(_0x29f999,null))['catch'](handleError(_0x29f999,null));};exports['destroy']=function(_0xa67ed4,_0xd94045){return db['FreshsalesAccount'][_0x1b70('0x51')]({'where':{'id':_0xa67ed4[_0x1b70('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd94045,null))[_0x1b70('0x1d')](removeEntity(_0xd94045,null))[_0x1b70('0x4b')](handleError(_0xd94045,null));};exports[_0x1b70('0x55')]=function(_0x5cb4ab,_0x3b6445,_0x279cfb){var _0x3a4bb7={};var _0x38abe4={};var _0x5399c4;var _0x2b153d;return db[_0x1b70('0x36')]['findOne']({'where':{'id':_0x5cb4ab[_0x1b70('0x4d')]['id']}})[_0x1b70('0x1d')](handleEntityNotFound(_0x3b6445,null))[_0x1b70('0x1d')](function(_0x2d862a){if(_0x2d862a){_0x5399c4=_0x2d862a;_0x38abe4[_0x1b70('0x3b')]=_[_0x1b70('0x3d')](db[_0x1b70('0x56')][_0x1b70('0x37')]);_0x38abe4['query']=_[_0x1b70('0x3d')](_0x5cb4ab[_0x1b70('0x3c')]);_0x38abe4['filters']=_[_0x1b70('0x4e')](_0x38abe4['model'],_0x38abe4[_0x1b70('0x3c')]);_0x3a4bb7[_0x1b70('0x3f')]=_[_0x1b70('0x4e')](_0x38abe4['model'],qs[_0x1b70('0x40')](_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x40')]));_0x3a4bb7[_0x1b70('0x3f')]=_0x3a4bb7[_0x1b70('0x3f')][_0x1b70('0x4f')]?_0x3a4bb7[_0x1b70('0x3f')]:_0x38abe4[_0x1b70('0x3b')];_0x3a4bb7[_0x1b70('0x43')]=qs[_0x1b70('0x57')](_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x57')]);_0x3a4bb7[_0x1b70('0x44')]=qs['filters'](_[_0x1b70('0x45')](_0x5cb4ab[_0x1b70('0x3c')],_0x38abe4[_0x1b70('0x3e')]));if(_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x46')]){_0x3a4bb7['where']=_['merge'](_0x3a4bb7[_0x1b70('0x44')],{'$or':_[_0x1b70('0x35')](_0x3a4bb7[_0x1b70('0x3f')],function(_0x4648ad){var _0x75d35d={};_0x75d35d[_0x4648ad]={'$like':'%'+_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x46')]+'%'};return _0x75d35d;})});}_0x3a4bb7=_[_0x1b70('0x47')]({},_0x3a4bb7,_0x5cb4ab[_0x1b70('0x58')]);return _0x5399c4[_0x1b70('0x55')](_0x3a4bb7);}})['then'](function(_0x543a52){if(_0x543a52){_0x2b153d=_0x543a52[_0x1b70('0x4f')];if(!_0x5cb4ab['query']['hasOwnProperty']('nolimit')){_0x3a4bb7[_0x1b70('0x2b')]=qs[_0x1b70('0x2b')](_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x2b')]);_0x3a4bb7['offset']=qs[_0x1b70('0x2a')](_0x5cb4ab[_0x1b70('0x3c')][_0x1b70('0x2a')]);}return _0x5399c4[_0x1b70('0x55')](_0x3a4bb7);}})[_0x1b70('0x1d')](function(_0x37a0cf){if(_0x37a0cf){return _0x37a0cf?{'count':_0x2b153d,'rows':_0x37a0cf}:null;}})[_0x1b70('0x1d')](respondWithResult(_0x3b6445,null))[_0x1b70('0x4b')](handleError(_0x3b6445,null));};exports[_0x1b70('0x59')]=function(_0x3024ea,_0x4936e5,_0x2e55c0){if(_0x3024ea[_0x1b70('0x53')]['id']){delete _0x3024ea[_0x1b70('0x53')]['id'];}return db[_0x1b70('0x36')]['findOne']({'where':{'id':_0x3024ea[_0x1b70('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4936e5,null))['then'](function(_0x1f1cfd){if(_0x1f1cfd){_0x3024ea[_0x1b70('0x53')][_0x1b70('0x5a')]=_0x1f1cfd['id'];_0x3024ea[_0x1b70('0x53')]['Subjects']=integrations['getSubjects'](_0x3024ea[_0x1b70('0x53')]['channel'],_0x3024ea[_0x1b70('0x53')][_0x1b70('0x39')]);_0x3024ea['body'][_0x1b70('0x5b')]=integrations[_0x1b70('0x5c')](_0x3024ea[_0x1b70('0x53')][_0x1b70('0x5d')],_0x3024ea['body'][_0x1b70('0x39')]);return db['FreshsalesConfiguration'][_0x1b70('0x52')](_0x3024ea[_0x1b70('0x53')],{'include':[{'model':db['FreshsalesField'],'as':_0x1b70('0x5e')},{'model':db['FreshsalesField'],'as':_0x1b70('0x5b')}]});}return null;})['then'](respondWithResult(_0x4936e5,null))[_0x1b70('0x4b')](handleError(_0x4936e5,null));};exports[_0x1b70('0x5f')]=function(_0x4fc05a,_0x3d3ca6,_0x5c81d5){var _0x342240='';var _0xd7bfcc='';return db['FreshsalesAccount'][_0x1b70('0x60')]({'where':{'id':_0x4fc05a[_0x1b70('0x4d')]['id']},'attributes':['id','username',_0x1b70('0x61'),_0x1b70('0x62')]})[_0x1b70('0x1d')](handleEntityNotFound(_0x3d3ca6,null))[_0x1b70('0x1d')](function(_0x538707){if(_0x538707){_0xd7bfcc=_0x538707[_0x1b70('0x63')];_0x342240=_0x538707[_0x1b70('0x61')];var _0x511eca=_0x538707[_0x1b70('0x61')][_0x1b70('0x64')](-0x1);if(_0x511eca==='/'){_0x342240=_0x342240[_0x1b70('0x65')](0x0,_0x342240[_0x1b70('0x66')](_0x511eca));}return rp({'method':_0x1b70('0x67'),'uri':util[_0x1b70('0x68')]('%s%s',_0x342240,_0x1b70('0x69')),'headers':{'Authorization':'Token\x20token='+_0x538707['apiKey']},'json':!![]});}})['then'](function(_0x4309dc){if(_0x4309dc){var _0x44b205=_0x4309dc['users'];var _0x707c37=![];var _0x490407=null;for(_0x490407=0x0;_0x490407<_0x44b205[_0x1b70('0x4f')];_0x490407++){if(_0x44b205[_0x490407][_0x1b70('0x6a')]===_0xd7bfcc){_0x707c37=!![];}}if(_0x707c37){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1b70('0x6b')});}}})[_0x1b70('0x1d')](respondWithResult(_0x3d3ca6,null))[_0x1b70('0x4b')](function(_0x4dddef){var _0x3f9b02=_0x4fc05a[_0x1b70('0x3c')]['test']?0x1f4:_0x4dddef[_0x1b70('0x6c')]||0x1f4;logger[_0x1b70('0x22')](_0x1b70('0x6d'),'getFields',_0x3f9b02,JSON[_0x1b70('0x6e')](_0x4dddef));delete _0x4dddef[_0x1b70('0x32')];if(_0x3f9b02===0x191){_0x3f9b02=0x190;}_0x3d3ca6['status'](_0x3f9b02)[_0x1b70('0x33')](_0x4fc05a[_0x1b70('0x3c')][_0x1b70('0x19')]?{'message':_0x1b70('0x6f'),'statusCode':_0x4dddef[_0x1b70('0x6c')]}:_0x4dddef);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index d552355..7f15985 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 _0x5089=['util','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x5089,0x1bb));var _0x9508=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x5089[_0x1e399a];return _0x539897;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x9508('0x8'));module[_0x9508('0x9')]=function(_0x257318,_0x4ab3c6){return _0x257318[_0x9508('0xa')](_0x9508('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount'];(function(_0x3790eb,_0x3b7833){var _0x52b1d9=function(_0x339502){while(--_0x339502){_0x3790eb['push'](_0x3790eb['shift']());}};_0x52b1d9(++_0x3b7833);}(_0xda55,0x6d));var _0x5da5=function(_0x34ac64,_0x23f246){_0x34ac64=_0x34ac64-0x0;var _0xae8ae9=_0xda55[_0x34ac64];return _0xae8ae9;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5da5('0x8')]=function(_0x58e7b3,_0x2fd877){return _0x58e7b3[_0x5da5('0x9')](_0x5da5('0xa'),attributes,{'tableName':_0x5da5('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 30f1b94..ae3d489 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 _0x22b4=['then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','GetFreshsalesAccount','find','where','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x22b4,0x8b));var _0x422b=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x22b4[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var moment=require(_0x422b('0x2'));var BPromise=require(_0x422b('0x3'));var rs=require(_0x422b('0x4'));var fs=require('fs');var Redis=require(_0x422b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x422b('0x6'));var logger=require(_0x422b('0x7'))('rpc');var config=require(_0x422b('0x8'));var jayson=require(_0x422b('0x9'));var client=jayson[_0x422b('0xa')][_0x422b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x115622,_0x170011,_0x48bdd2){return new BPromise(function(_0x5932a3,_0x4e6253){return client[_0x422b('0xc')](_0x115622,_0x48bdd2)[_0x422b('0xd')](function(_0x1c9adc){logger[_0x422b('0xe')](_0x422b('0xf'),_0x170011,_0x422b('0x10'));logger['debug'](_0x422b('0x11'),_0x170011,_0x422b('0x10'),JSON[_0x422b('0x12')](_0x1c9adc));if(_0x1c9adc[_0x422b('0x13')]){if(_0x1c9adc[_0x422b('0x13')][_0x422b('0x14')]===0x1f4){logger[_0x422b('0x13')](_0x422b('0xf'),_0x170011,_0x1c9adc['error']['message']);return _0x4e6253(_0x1c9adc[_0x422b('0x13')][_0x422b('0x15')]);}logger[_0x422b('0x13')](_0x422b('0xf'),_0x170011,_0x1c9adc[_0x422b('0x13')][_0x422b('0x15')]);return _0x5932a3(_0x1c9adc[_0x422b('0x13')][_0x422b('0x15')]);}else{logger['info'](_0x422b('0xf'),_0x170011,'request\x20sent');_0x5932a3(_0x1c9adc[_0x422b('0x16')][_0x422b('0x15')]);}})[_0x422b('0x17')](function(_0x2718e3){logger[_0x422b('0x13')](_0x422b('0xf'),_0x170011,_0x2718e3);_0x4e6253(_0x2718e3);});});}exports['GetFreshsalesAccount']=function(_0x338cf4){var _0x29bef6=this;return new Promise(function(_0x1fdb00,_0x4f05ac){return db[_0x422b('0x18')][_0x422b('0x19')]({'raw':_0x338cf4[_0x422b('0x1a')]?_0x338cf4[_0x422b('0x1a')][_0x422b('0x1b')]===undefined?!![]:![]:!![],'where':_0x338cf4[_0x422b('0x1a')]?_0x338cf4[_0x422b('0x1a')]['where']||null:null,'attributes':_0x338cf4[_0x422b('0x1a')]?_0x338cf4['options']['attributes']||null:null,'limit':_0x338cf4[_0x422b('0x1a')]?_0x338cf4['options'][_0x422b('0x1c')]||null:null,'include':_0x338cf4['options']?_0x338cf4[_0x422b('0x1a')][_0x422b('0x1d')]?_[_0x422b('0x1e')](_0x338cf4['options'][_0x422b('0x1d')],function(_0x21fb07){return{'model':db[_0x21fb07[_0x422b('0x1f')]],'as':_0x21fb07['as'],'attributes':_0x21fb07[_0x422b('0x20')],'include':_0x21fb07[_0x422b('0x1d')]?_[_0x422b('0x1e')](_0x21fb07[_0x422b('0x1d')],function(_0x1f7d44){return{'model':db[_0x1f7d44[_0x422b('0x1f')]],'as':_0x1f7d44['as'],'attributes':_0x1f7d44[_0x422b('0x20')],'include':_0x1f7d44[_0x422b('0x1d')]?_['map'](_0x1f7d44[_0x422b('0x1d')],function(_0x3d85ec){return{'model':db[_0x3d85ec[_0x422b('0x1f')]],'as':_0x3d85ec['as'],'attributes':_0x3d85ec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e645){logger[_0x422b('0xe')](_0x422b('0x21'),_0x338cf4);logger['debug'](_0x422b('0x21'),_0x338cf4,JSON[_0x422b('0x12')](_0x49e645));_0x1fdb00(_0x49e645);})[_0x422b('0x17')](function(_0x24b86b){logger[_0x422b('0x13')](_0x422b('0x21'),_0x24b86b[_0x422b('0x15')],_0x338cf4);_0x4f05ac(_0x29bef6[_0x422b('0x13')](0x1f4,_0x24b86b['message']));});});};exports['ShowFreshsalesAccount']=function(_0xb8eaaa){var _0x429cff=this;return new Promise(function(_0x1a73c6,_0x58d571){return db[_0x422b('0x18')][_0x422b('0x22')]({'raw':_0xb8eaaa['options']?_0xb8eaaa[_0x422b('0x1a')][_0x422b('0x1b')]===undefined?!![]:![]:!![],'where':_0xb8eaaa[_0x422b('0x1a')]?_0xb8eaaa[_0x422b('0x1a')][_0x422b('0x23')]||null:null,'attributes':_0xb8eaaa[_0x422b('0x1a')]?_0xb8eaaa[_0x422b('0x1a')][_0x422b('0x20')]||null:null,'include':_0xb8eaaa[_0x422b('0x1a')]?_0xb8eaaa[_0x422b('0x1a')][_0x422b('0x1d')]?_[_0x422b('0x1e')](_0xb8eaaa['options'][_0x422b('0x1d')],function(_0x39c1ed){return{'model':db[_0x39c1ed['model']],'as':_0x39c1ed['as'],'attributes':_0x39c1ed[_0x422b('0x20')],'include':_0x39c1ed[_0x422b('0x1d')]?_[_0x422b('0x1e')](_0x39c1ed[_0x422b('0x1d')],function(_0x1a39ba){return{'model':db[_0x1a39ba[_0x422b('0x1f')]],'as':_0x1a39ba['as'],'attributes':_0x1a39ba[_0x422b('0x20')],'include':_0x1a39ba[_0x422b('0x1d')]?_[_0x422b('0x1e')](_0x1a39ba[_0x422b('0x1d')],function(_0x4e4477){return{'model':db[_0x4e4477[_0x422b('0x1f')]],'as':_0x4e4477['as'],'attributes':_0x4e4477[_0x422b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x422b('0xd')](function(_0x1e3576){logger[_0x422b('0xe')](_0x422b('0x24'),_0xb8eaaa);logger[_0x422b('0x25')](_0x422b('0x24'),_0xb8eaaa,JSON[_0x422b('0x12')](_0x1e3576));_0x1a73c6(_0x1e3576);})[_0x422b('0x17')](function(_0x5e511b){logger[_0x422b('0x13')](_0x422b('0x24'),_0x5e511b[_0x422b('0x15')],_0xb8eaaa);_0x58d571(_0x429cff[_0x422b('0x13')](0x1f4,_0x5e511b[_0x422b('0x15')]));});});}; \ No newline at end of file +var _0x4c4a=['then','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0xfdfc8a,_0x33eea6){var _0x31b639=function(_0x37f9d5){while(--_0x37f9d5){_0xfdfc8a['push'](_0xfdfc8a['shift']());}};_0x31b639(++_0x33eea6);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x161a67,_0x143e88){_0x161a67=_0x161a67-0x0;var _0x54c10f=_0x4c4a[_0x161a67];return _0x54c10f;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var moment=require(_0xa4c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4c4('0x3'));var fs=require('fs');var Redis=require(_0xa4c4('0x4'));var db=require(_0xa4c4('0x5'))['db'];var utils=require(_0xa4c4('0x6'));var logger=require('../../config/logger')(_0xa4c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4c4('0x8'));var client=jayson[_0xa4c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557596,_0x11b498,_0x553525){return new BPromise(function(_0x27b877,_0x118d89){return client[_0xa4c4('0xa')](_0x557596,_0x553525)['then'](function(_0x5ec64c){logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x11b498,'request\x20sent',JSON[_0xa4c4('0x10')](_0x5ec64c));if(_0x5ec64c['error']){if(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x12')]===0x1f4){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x118d89(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}logger[_0xa4c4('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x27b877(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}else{logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));_0x27b877(_0x5ec64c['result'][_0xa4c4('0x13')]);}})[_0xa4c4('0x14')](function(_0x4b2f2d){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x4b2f2d);_0x118d89(_0x4b2f2d);});});}exports[_0xa4c4('0x15')]=function(_0x5f5ef){var _0x3f2fce=this;return new Promise(function(_0x40661e,_0x3674b1){return db[_0xa4c4('0x16')][_0xa4c4('0x17')]({'raw':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x19')]===undefined?!![]:![]:!![],'where':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1a')]||null:null,'attributes':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1b')]||null:null,'limit':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef['options']['limit']||null:null,'include':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1c')],function(_0x5f1215){return{'model':db[_0x5f1215['model']],'as':_0x5f1215['as'],'attributes':_0x5f1215['attributes'],'include':_0x5f1215[_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x5f1215[_0xa4c4('0x1c')],function(_0x50bb08){return{'model':db[_0x50bb08[_0xa4c4('0x1e')]],'as':_0x50bb08['as'],'attributes':_0x50bb08[_0xa4c4('0x1b')],'include':_0x50bb08[_0xa4c4('0x1c')]?_['map'](_0x50bb08[_0xa4c4('0x1c')],function(_0xfa33ec){return{'model':db[_0xfa33ec[_0xa4c4('0x1e')]],'as':_0xfa33ec['as'],'attributes':_0xfa33ec[_0xa4c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa4c4('0x1f')](function(_0x51d5fa){logger[_0xa4c4('0xb')](_0xa4c4('0x15'),_0x5f5ef);logger[_0xa4c4('0xe')](_0xa4c4('0x15'),_0x5f5ef,JSON[_0xa4c4('0x10')](_0x51d5fa));_0x40661e(_0x51d5fa);})['catch'](function(_0x32af71){logger['error']('GetFreshsalesAccount',_0x32af71['message'],_0x5f5ef);_0x3674b1(_0x3f2fce['error'](0x1f4,_0x32af71[_0xa4c4('0x13')]));});});};exports[_0xa4c4('0x20')]=function(_0x2456f6){var _0x26d239=this;return new Promise(function(_0x136b30,_0x4f126b){return db['FreshsalesAccount']['find']({'raw':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['where']||null:null,'attributes':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['attributes']||null:null,'include':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')][_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x2456f6[_0xa4c4('0x18')][_0xa4c4('0x1c')],function(_0x4ec09f){return{'model':db[_0x4ec09f[_0xa4c4('0x1e')]],'as':_0x4ec09f['as'],'attributes':_0x4ec09f[_0xa4c4('0x1b')],'include':_0x4ec09f[_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x4ec09f[_0xa4c4('0x1c')],function(_0x33c218){return{'model':db[_0x33c218[_0xa4c4('0x1e')]],'as':_0x33c218['as'],'attributes':_0x33c218[_0xa4c4('0x1b')],'include':_0x33c218['include']?_[_0xa4c4('0x1d')](_0x33c218['include'],function(_0x1afcce){return{'model':db[_0x1afcce[_0xa4c4('0x1e')]],'as':_0x1afcce['as'],'attributes':_0x1afcce['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4c4('0x1f')](function(_0x2a4dfa){logger[_0xa4c4('0xb')](_0xa4c4('0x20'),_0x2456f6);logger[_0xa4c4('0xe')](_0xa4c4('0x20'),_0x2456f6,JSON['stringify'](_0x2a4dfa));_0x136b30(_0x2a4dfa);})[_0xa4c4('0x14')](function(_0x2be4e1){logger['error'](_0xa4c4('0x20'),_0x2be4e1[_0xa4c4('0x13')],_0x2456f6);_0x4f126b(_0x26d239[_0xa4c4('0x11')](0x1f4,_0x2be4e1[_0xa4c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4489cf4..613f794 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 _0x9bcf=['express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get','show','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','delete','multer','util','path','connect-timeout'];(function(_0x406909,_0x580e30){var _0x3ad095=function(_0x5e0cfd){while(--_0x5e0cfd){_0x406909['push'](_0x406909['shift']());}};_0x3ad095(++_0x580e30);}(_0x9bcf,0x1b5));var _0xf9bc=function(_0xdba1fc,_0x147e78){_0xdba1fc=_0xdba1fc-0x0;var _0x4f82a9=_0x9bcf[_0xdba1fc];return _0x4f82a9;};'use strict';var multer=require(_0xf9bc('0x0'));var util=require(_0xf9bc('0x1'));var path=require(_0xf9bc('0x2'));var timeout=require(_0xf9bc('0x3'));var express=require(_0xf9bc('0x4'));var router=express[_0xf9bc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf9bc('0x6'));var config=require(_0xf9bc('0x7'));var controller=require(_0xf9bc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf9bc('0x9')]);router[_0xf9bc('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf9bc('0xb')]);router[_0xf9bc('0xa')](_0xf9bc('0xc'),auth[_0xf9bc('0xd')](),controller[_0xf9bc('0xe')]);router['get'](_0xf9bc('0xf'),auth[_0xf9bc('0xd')](),controller[_0xf9bc('0x10')]);router[_0xf9bc('0xa')](_0xf9bc('0x11'),auth[_0xf9bc('0xd')](),controller['getFields']);router['post']('/',auth[_0xf9bc('0xd')](),controller[_0xf9bc('0x12')]);router[_0xf9bc('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf9bc('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x26ee=['get','index','show','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','post','put','update','destroy','exports','multer','util','path','express','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x26ee,0x150));var _0xe26e=function(_0x555ae1,_0x330014){_0x555ae1=_0x555ae1-0x0;var _0x454064=_0x26ee[_0x555ae1];return _0x454064;};'use strict';var multer=require(_0xe26e('0x0'));var util=require(_0xe26e('0x1'));var path=require(_0xe26e('0x2'));var timeout=require('connect-timeout');var express=require(_0xe26e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe26e('0x4'));var controller=require(_0xe26e('0x5'));router[_0xe26e('0x6')]('/',auth['isAuthenticated'](),controller[_0xe26e('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe26e('0x8')]);router[_0xe26e('0x6')](_0xe26e('0x9'),auth[_0xe26e('0xa')](),controller[_0xe26e('0xb')]);router[_0xe26e('0x6')](_0xe26e('0xc'),auth[_0xe26e('0xa')](),controller['getDescriptions']);router[_0xe26e('0x6')](_0xe26e('0xd'),auth[_0xe26e('0xa')](),controller['getFields']);router[_0xe26e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe26e('0xf')]('/:id',auth[_0xe26e('0xa')](),controller[_0xe26e('0x10')]);router['delete']('/:id',auth[_0xe26e('0xa')](),controller[_0xe26e('0x11')]);module[_0xe26e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1800363..f797f32 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 _0x185a=['exports','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x185a,0x1d1));var _0xa185=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x185a[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xa185('0x0'));module[_0xa185('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96cb=['STRING','sequelize','exports'];(function(_0x451277,_0x4465c4){var _0x28c9da=function(_0x100b16){while(--_0x100b16){_0x451277['push'](_0x451277['shift']());}};_0x28c9da(++_0x4465c4);}(_0x96cb,0x124));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb96c('0x0'));module[_0xb96c('0x1')]={'name':{'type':Sequelize[_0xb96c('0x2')]},'description':{'type':Sequelize[_0xb96c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 86cb376..e147ed4 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 _0xc298=['query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','rawAttributes','include','create','body','update','find','params','getSubjects','FreshsalesField','order','getDescriptions','findOne','getFields','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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~!@#$%^&-_=+[{]}.','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','destroy','stack','send','map','FreshsalesConfiguration','fieldName','type','key','model','name'];(function(_0x4c8de1,_0x50a3b7){var _0x1202f6=function(_0x141fb9){while(--_0x141fb9){_0x4c8de1['push'](_0x4c8de1['shift']());}};_0x1202f6(++_0x50a3b7);}(_0xc298,0xdb));var _0x8c29=function(_0x286baa,_0x448746){_0x286baa=_0x286baa-0x0;var _0x34ea2c=_0xc298[_0x286baa];return _0x34ea2c;};'use strict';var pdf=require(_0x8c29('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c29('0x1'));var zipdir=require(_0x8c29('0x2'));var jsonpatch=require(_0x8c29('0x3'));var rp=require(_0x8c29('0x4'));var moment=require(_0x8c29('0x5'));var BPromise=require(_0x8c29('0x6'));var Mustache=require(_0x8c29('0x7'));var util=require('util');var path=require(_0x8c29('0x8'));var sox=require(_0x8c29('0x9'));var csv=require(_0x8c29('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c29('0xb'));var squel=require('squel');var crypto=require(_0x8c29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c29('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c29('0xe'));var Redis=require(_0x8c29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c29('0x10'));var hardwareService=require(_0x8c29('0x11'));var logger=require(_0x8c29('0x12'))(_0x8c29('0x13'));var utils=require(_0x8c29('0x14'));var config=require(_0x8c29('0x15'));var db=require(_0x8c29('0x16'))['db'];var jayson=require(_0x8c29('0x17'));var client=jayson[_0x8c29('0x18')][_0x8c29('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3bea20,_0x38e6fb,_0x5f2574){if(_0x5f2574){var _0x3b9273=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b9273['test'](_0x38e6fb)){return _0x3bea20;}else{throw new db['Sequelize'][(_0x8c29('0x1a'))](_0x8c29('0x1b'));}}else{return _0x3bea20;}}function respondWithRpcPromise(_0x1bff0e,_0x3a192b,_0x457959,_0x53cddd){return new BPromise(function(_0x1be1d6,_0x190023){var _0x1a7794=_0x53cddd||client;return _0x1a7794['request'](_0x1bff0e,_0x457959)[_0x8c29('0x1c')](function(_0x580d4c){logger['info'](_0x8c29('0x1d'),_0x3a192b,'request\x20sent');logger[_0x8c29('0x1e')](_0x8c29('0x1f'),_0x3a192b,'request\x20sent',JSON[_0x8c29('0x20')](_0x580d4c));if(_0x580d4c['error']){if(_0x580d4c[_0x8c29('0x21')][_0x8c29('0x22')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a192b,_0x580d4c[_0x8c29('0x21')][_0x8c29('0x23')]);return _0x190023(_0x580d4c[_0x8c29('0x21')][_0x8c29('0x23')]);}logger['error'](_0x8c29('0x1d'),_0x3a192b,_0x580d4c['error'][_0x8c29('0x23')]);return _0x1be1d6(_0x580d4c['error'][_0x8c29('0x23')]);}else{logger[_0x8c29('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a192b,_0x8c29('0x25'));_0x1be1d6(_0x580d4c[_0x8c29('0x26')][_0x8c29('0x23')]);}})['catch'](function(_0x276f4d){logger[_0x8c29('0x21')](_0x8c29('0x1d'),_0x3a192b,_0x276f4d);_0x190023(_0x276f4d);});});}function respondWithStatusCode(_0x11f01e,_0x472a12){_0x472a12=_0x472a12||0xcc;return function(_0x77ddac){if(_0x77ddac){return _0x11f01e[_0x8c29('0x27')](_0x472a12);}return _0x11f01e['status'](_0x472a12)[_0x8c29('0x28')]();};}function respondWithResult(_0xb79857,_0x27dac8){_0x27dac8=_0x27dac8||0xc8;return function(_0x4583c9){if(_0x4583c9){return _0xb79857[_0x8c29('0x29')](_0x27dac8)['json'](_0x4583c9);}};}function respondWithFilteredResult(_0x3fe214,_0x3040f2){return function(_0x70e4d0){if(_0x70e4d0){var _0x5a63d3=_0x70e4d0[_0x8c29('0x2a')],_0x234b37=_0x3040f2[_0x8c29('0x2b')],_0x56c591=_0x3040f2[_0x8c29('0x2b')]+_0x3040f2[_0x8c29('0x2c')],_0x18973c;if(_0x56c591>=_0x5a63d3){_0x56c591=_0x5a63d3;_0x18973c=0xc8;}else{_0x18973c=0xce;}_0x3fe214[_0x8c29('0x29')](_0x18973c);return _0x3fe214[_0x8c29('0x2d')](_0x8c29('0x2e'),_0x234b37+'-'+_0x56c591+'/'+_0x5a63d3)[_0x8c29('0x2f')](_0x70e4d0);}return null;};}function patchUpdates(_0x193b28){return function(_0x43375c){try{jsonpatch[_0x8c29('0x30')](_0x43375c,_0x193b28,!![]);}catch(_0x5907cc){return BPromise[_0x8c29('0x31')](_0x5907cc);}return _0x43375c['save']();};}function saveUpdates(_0x47fa0e,_0x2b2bdb){return function(_0xebd792){if(_0xebd792){return _0xebd792['update'](_0x47fa0e)[_0x8c29('0x1c')](function(_0x11e2b7){return _0x11e2b7;});}return null;};}function removeEntity(_0x124d76,_0x8e703c){return function(_0xbc8ad2){if(_0xbc8ad2){return _0xbc8ad2[_0x8c29('0x32')]()[_0x8c29('0x1c')](function(){_0x124d76[_0x8c29('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c004,_0x32acff){return function(_0x7feac8){if(!_0x7feac8){_0x4c004[_0x8c29('0x27')](0x194);}return _0x7feac8;};}function handleError(_0xd504e5,_0x435dd6){_0x435dd6=_0x435dd6||0x1f4;return function(_0x57395c){logger[_0x8c29('0x21')](_0x57395c[_0x8c29('0x33')]);if(_0x57395c['name']){delete _0x57395c['name'];}_0xd504e5['status'](_0x435dd6)[_0x8c29('0x34')](_0x57395c);};}exports['index']=function(_0x1b352b,_0xdb4b8a){var _0x32dca0={},_0x4e6b8b={},_0x1188ee={'count':0x0,'rows':[]};var _0x562fab=_[_0x8c29('0x35')](db[_0x8c29('0x36')]['rawAttributes'],function(_0x1e0bd9){return{'name':_0x1e0bd9[_0x8c29('0x37')],'type':_0x1e0bd9[_0x8c29('0x38')][_0x8c29('0x39')]};});_0x4e6b8b[_0x8c29('0x3a')]=_[_0x8c29('0x35')](_0x562fab,_0x8c29('0x3b'));_0x4e6b8b[_0x8c29('0x3c')]=_['keys'](_0x1b352b[_0x8c29('0x3c')]);_0x4e6b8b['filters']=_['intersection'](_0x4e6b8b[_0x8c29('0x3a')],_0x4e6b8b['query']);_0x32dca0[_0x8c29('0x3d')]=_[_0x8c29('0x3e')](_0x4e6b8b[_0x8c29('0x3a')],qs['fields'](_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x3f')]));_0x32dca0['attributes']=_0x32dca0[_0x8c29('0x3d')][_0x8c29('0x40')]?_0x32dca0[_0x8c29('0x3d')]:_0x4e6b8b['model'];if(!_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x41')](_0x8c29('0x42'))){_0x32dca0[_0x8c29('0x2c')]=qs[_0x8c29('0x2c')](_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x2c')]);_0x32dca0[_0x8c29('0x2b')]=qs[_0x8c29('0x2b')](_0x1b352b['query'][_0x8c29('0x2b')]);}_0x32dca0['order']=qs[_0x8c29('0x43')](_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x43')]);_0x32dca0[_0x8c29('0x44')]=qs['filters'](_[_0x8c29('0x45')](_0x1b352b['query'],_0x4e6b8b[_0x8c29('0x46')]),_0x562fab);if(_0x1b352b['query'][_0x8c29('0x47')]){_0x32dca0[_0x8c29('0x44')]=_[_0x8c29('0x48')](_0x32dca0[_0x8c29('0x44')],{'$or':_[_0x8c29('0x35')](_0x562fab,function(_0x3824f5){if(_0x3824f5['type']!==_0x8c29('0x49')){var _0x5447a0={};_0x5447a0[_0x3824f5[_0x8c29('0x3b')]]={'$like':'%'+_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x47')]+'%'};return _0x5447a0;}})});}_0x32dca0=_['merge']({},_0x32dca0,_0x1b352b[_0x8c29('0x4a')]);var _0x4723fa={'where':_0x32dca0['where']};return db['FreshsalesConfiguration'][_0x8c29('0x2a')](_0x4723fa)[_0x8c29('0x1c')](function(_0x393ddf){_0x1188ee[_0x8c29('0x2a')]=_0x393ddf;if(_0x1b352b[_0x8c29('0x3c')][_0x8c29('0x4b')]){_0x32dca0['include']=[{'all':!![]}];}return db[_0x8c29('0x36')]['findAll'](_0x32dca0);})[_0x8c29('0x1c')](function(_0x1489a1){_0x1188ee[_0x8c29('0x4c')]=_0x1489a1;return _0x1188ee;})['then'](respondWithFilteredResult(_0xdb4b8a,_0x32dca0))[_0x8c29('0x4d')](handleError(_0xdb4b8a,null));};exports[_0x8c29('0x4e')]=function(_0x35c20c,_0x43680d){var _0x4a2124={'raw':![],'where':{'id':_0x35c20c['params']['id']}},_0x2ada9b={};_0x2ada9b['model']=_[_0x8c29('0x4f')](db['FreshsalesConfiguration'][_0x8c29('0x50')]);_0x2ada9b[_0x8c29('0x3c')]=_[_0x8c29('0x4f')](_0x35c20c[_0x8c29('0x3c')]);_0x2ada9b['filters']=_[_0x8c29('0x3e')](_0x2ada9b[_0x8c29('0x3a')],_0x2ada9b[_0x8c29('0x3c')]);_0x4a2124[_0x8c29('0x3d')]=_[_0x8c29('0x3e')](_0x2ada9b['model'],qs[_0x8c29('0x3f')](_0x35c20c[_0x8c29('0x3c')][_0x8c29('0x3f')]));_0x4a2124[_0x8c29('0x3d')]=_0x4a2124[_0x8c29('0x3d')][_0x8c29('0x40')]?_0x4a2124[_0x8c29('0x3d')]:_0x2ada9b[_0x8c29('0x3a')];if(_0x35c20c[_0x8c29('0x3c')][_0x8c29('0x4b')]){_0x4a2124[_0x8c29('0x51')]=[{'all':!![]}];}_0x4a2124=_[_0x8c29('0x48')]({},_0x4a2124,_0x35c20c[_0x8c29('0x4a')]);return db[_0x8c29('0x36')]['find'](_0x4a2124)[_0x8c29('0x1c')](handleEntityNotFound(_0x43680d,null))[_0x8c29('0x1c')](respondWithResult(_0x43680d,null))[_0x8c29('0x4d')](handleError(_0x43680d,null));};exports[_0x8c29('0x52')]=function(_0x10a501,_0x26f9c3){return db[_0x8c29('0x36')][_0x8c29('0x52')](_0x10a501[_0x8c29('0x53')],{})['then'](respondWithResult(_0x26f9c3,0xc9))[_0x8c29('0x4d')](handleError(_0x26f9c3,null));};exports[_0x8c29('0x54')]=function(_0x42d4c5,_0x250784){if(_0x42d4c5[_0x8c29('0x53')]['id']){delete _0x42d4c5[_0x8c29('0x53')]['id'];}return db[_0x8c29('0x36')][_0x8c29('0x55')]({'where':{'id':_0x42d4c5[_0x8c29('0x56')]['id']}})[_0x8c29('0x1c')](handleEntityNotFound(_0x250784,null))[_0x8c29('0x1c')](saveUpdates(_0x42d4c5['body'],null))[_0x8c29('0x1c')](respondWithResult(_0x250784,null))[_0x8c29('0x4d')](handleError(_0x250784,null));};exports[_0x8c29('0x32')]=function(_0x256d1b,_0x1cbc52){return db[_0x8c29('0x36')][_0x8c29('0x55')]({'where':{'id':_0x256d1b[_0x8c29('0x56')]['id']}})[_0x8c29('0x1c')](handleEntityNotFound(_0x1cbc52,null))[_0x8c29('0x1c')](removeEntity(_0x1cbc52,null))[_0x8c29('0x4d')](handleError(_0x1cbc52,null));};exports[_0x8c29('0x57')]=function(_0x1e80e1,_0x352164,_0x3f704a){var _0x3982ec={};var _0x51e0c5={};var _0x26bd7b;var _0x2cf81f;return db[_0x8c29('0x36')]['findOne']({'where':{'id':_0x1e80e1['params']['id']}})['then'](handleEntityNotFound(_0x352164,null))[_0x8c29('0x1c')](function(_0x3012e6){if(_0x3012e6){_0x26bd7b=_0x3012e6;_0x51e0c5[_0x8c29('0x3a')]=_[_0x8c29('0x4f')](db[_0x8c29('0x58')][_0x8c29('0x50')]);_0x51e0c5[_0x8c29('0x3c')]=_[_0x8c29('0x4f')](_0x1e80e1[_0x8c29('0x3c')]);_0x51e0c5['filters']=_[_0x8c29('0x3e')](_0x51e0c5[_0x8c29('0x3a')],_0x51e0c5['query']);_0x3982ec[_0x8c29('0x3d')]=_[_0x8c29('0x3e')](_0x51e0c5[_0x8c29('0x3a')],qs['fields'](_0x1e80e1['query'][_0x8c29('0x3f')]));_0x3982ec['attributes']=_0x3982ec[_0x8c29('0x3d')][_0x8c29('0x40')]?_0x3982ec[_0x8c29('0x3d')]:_0x51e0c5[_0x8c29('0x3a')];_0x3982ec[_0x8c29('0x59')]=qs[_0x8c29('0x43')](_0x1e80e1['query'][_0x8c29('0x43')]);_0x3982ec[_0x8c29('0x44')]=qs[_0x8c29('0x46')](_['pick'](_0x1e80e1[_0x8c29('0x3c')],_0x51e0c5[_0x8c29('0x46')]));if(_0x1e80e1[_0x8c29('0x3c')][_0x8c29('0x47')]){_0x3982ec['where']=_[_0x8c29('0x48')](_0x3982ec['where'],{'$or':_[_0x8c29('0x35')](_0x3982ec[_0x8c29('0x3d')],function(_0x24e896){var _0x343901={};_0x343901[_0x24e896]={'$like':'%'+_0x1e80e1[_0x8c29('0x3c')][_0x8c29('0x47')]+'%'};return _0x343901;})});}_0x3982ec=_[_0x8c29('0x48')]({},_0x3982ec,_0x1e80e1[_0x8c29('0x4a')]);return _0x26bd7b['getSubjects'](_0x3982ec);}})[_0x8c29('0x1c')](function(_0x4be3f5){if(_0x4be3f5){_0x2cf81f=_0x4be3f5['length'];if(!_0x1e80e1['query'][_0x8c29('0x41')](_0x8c29('0x42'))){_0x3982ec[_0x8c29('0x2c')]=qs[_0x8c29('0x2c')](_0x1e80e1['query']['limit']);_0x3982ec[_0x8c29('0x2b')]=qs[_0x8c29('0x2b')](_0x1e80e1[_0x8c29('0x3c')][_0x8c29('0x2b')]);}return _0x26bd7b[_0x8c29('0x57')](_0x3982ec);}})[_0x8c29('0x1c')](function(_0x1474ef){if(_0x1474ef){return _0x1474ef?{'count':_0x2cf81f,'rows':_0x1474ef}:null;}})[_0x8c29('0x1c')](respondWithResult(_0x352164,null))[_0x8c29('0x4d')](handleError(_0x352164,null));};exports[_0x8c29('0x5a')]=function(_0xdb92e,_0x4900c5,_0x506167){var _0x562b64={};var _0x2b97e9={};var _0x28db65;var _0x16cdac;return db[_0x8c29('0x36')][_0x8c29('0x5b')]({'where':{'id':_0xdb92e['params']['id']}})[_0x8c29('0x1c')](handleEntityNotFound(_0x4900c5,null))[_0x8c29('0x1c')](function(_0x42a716){if(_0x42a716){_0x28db65=_0x42a716;_0x2b97e9[_0x8c29('0x3a')]=_[_0x8c29('0x4f')](db['FreshsalesField'][_0x8c29('0x50')]);_0x2b97e9[_0x8c29('0x3c')]=_[_0x8c29('0x4f')](_0xdb92e[_0x8c29('0x3c')]);_0x2b97e9['filters']=_[_0x8c29('0x3e')](_0x2b97e9[_0x8c29('0x3a')],_0x2b97e9['query']);_0x562b64['attributes']=_[_0x8c29('0x3e')](_0x2b97e9[_0x8c29('0x3a')],qs['fields'](_0xdb92e['query'][_0x8c29('0x3f')]));_0x562b64[_0x8c29('0x3d')]=_0x562b64[_0x8c29('0x3d')][_0x8c29('0x40')]?_0x562b64[_0x8c29('0x3d')]:_0x2b97e9[_0x8c29('0x3a')];_0x562b64['order']=qs[_0x8c29('0x43')](_0xdb92e['query']['sort']);_0x562b64[_0x8c29('0x44')]=qs[_0x8c29('0x46')](_[_0x8c29('0x45')](_0xdb92e[_0x8c29('0x3c')],_0x2b97e9[_0x8c29('0x46')]));if(_0xdb92e['query'][_0x8c29('0x47')]){_0x562b64[_0x8c29('0x44')]=_['merge'](_0x562b64[_0x8c29('0x44')],{'$or':_['map'](_0x562b64['attributes'],function(_0x2e1e3d){var _0x413444={};_0x413444[_0x2e1e3d]={'$like':'%'+_0xdb92e[_0x8c29('0x3c')][_0x8c29('0x47')]+'%'};return _0x413444;})});}_0x562b64=_[_0x8c29('0x48')]({},_0x562b64,_0xdb92e[_0x8c29('0x4a')]);return _0x28db65[_0x8c29('0x5a')](_0x562b64);}})[_0x8c29('0x1c')](function(_0x5b281f){if(_0x5b281f){_0x16cdac=_0x5b281f[_0x8c29('0x40')];if(!_0xdb92e[_0x8c29('0x3c')][_0x8c29('0x41')]('nolimit')){_0x562b64['limit']=qs['limit'](_0xdb92e[_0x8c29('0x3c')][_0x8c29('0x2c')]);_0x562b64['offset']=qs[_0x8c29('0x2b')](_0xdb92e['query'][_0x8c29('0x2b')]);}return _0x28db65[_0x8c29('0x5a')](_0x562b64);}})[_0x8c29('0x1c')](function(_0x2e0541){if(_0x2e0541){return _0x2e0541?{'count':_0x16cdac,'rows':_0x2e0541}:null;}})[_0x8c29('0x1c')](respondWithResult(_0x4900c5,null))[_0x8c29('0x4d')](handleError(_0x4900c5,null));};exports[_0x8c29('0x5c')]=function(_0x26612b,_0x19e929,_0x4030ce){var _0x33bd42={};var _0x3177a0={};var _0x3155d8;var _0x18e34a;return db[_0x8c29('0x36')][_0x8c29('0x5b')]({'where':{'id':_0x26612b[_0x8c29('0x56')]['id']}})[_0x8c29('0x1c')](handleEntityNotFound(_0x19e929,null))['then'](function(_0x4e7fe1){if(_0x4e7fe1){_0x3155d8=_0x4e7fe1;_0x3177a0[_0x8c29('0x3a')]=_['keys'](db[_0x8c29('0x58')][_0x8c29('0x50')]);_0x3177a0[_0x8c29('0x3c')]=_[_0x8c29('0x4f')](_0x26612b['query']);_0x3177a0['filters']=_[_0x8c29('0x3e')](_0x3177a0[_0x8c29('0x3a')],_0x3177a0[_0x8c29('0x3c')]);_0x33bd42['attributes']=_[_0x8c29('0x3e')](_0x3177a0[_0x8c29('0x3a')],qs[_0x8c29('0x3f')](_0x26612b[_0x8c29('0x3c')]['fields']));_0x33bd42[_0x8c29('0x3d')]=_0x33bd42[_0x8c29('0x3d')][_0x8c29('0x40')]?_0x33bd42[_0x8c29('0x3d')]:_0x3177a0['model'];_0x33bd42[_0x8c29('0x59')]=qs['sort'](_0x26612b['query'][_0x8c29('0x43')]);_0x33bd42[_0x8c29('0x44')]=qs['filters'](_['pick'](_0x26612b[_0x8c29('0x3c')],_0x3177a0[_0x8c29('0x46')]));if(_0x26612b['query']['filter']){_0x33bd42[_0x8c29('0x44')]=_[_0x8c29('0x48')](_0x33bd42['where'],{'$or':_[_0x8c29('0x35')](_0x33bd42[_0x8c29('0x3d')],function(_0x4bc102){var _0x584e0e={};_0x584e0e[_0x4bc102]={'$like':'%'+_0x26612b[_0x8c29('0x3c')][_0x8c29('0x47')]+'%'};return _0x584e0e;})});}_0x33bd42=_[_0x8c29('0x48')]({},_0x33bd42,_0x26612b[_0x8c29('0x4a')]);return _0x3155d8[_0x8c29('0x5c')](_0x33bd42);}})[_0x8c29('0x1c')](function(_0x556d76){if(_0x556d76){_0x18e34a=_0x556d76[_0x8c29('0x40')];if(!_0x26612b['query']['hasOwnProperty'](_0x8c29('0x42'))){_0x33bd42[_0x8c29('0x2c')]=qs[_0x8c29('0x2c')](_0x26612b[_0x8c29('0x3c')][_0x8c29('0x2c')]);_0x33bd42[_0x8c29('0x2b')]=qs[_0x8c29('0x2b')](_0x26612b[_0x8c29('0x3c')]['offset']);}return _0x3155d8[_0x8c29('0x5c')](_0x33bd42);}})[_0x8c29('0x1c')](function(_0x443373){if(_0x443373){return _0x443373?{'count':_0x18e34a,'rows':_0x443373}:null;}})[_0x8c29('0x1c')](respondWithResult(_0x19e929,null))[_0x8c29('0x4d')](handleError(_0x19e929,null));}; \ No newline at end of file +var _0x0795=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','VIRTUAL','where','FreshsalesConfiguration','includeAll','include','findAll','rows','show','params','keys','options','create','body','find','getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x5ce004,_0x3084c2){var _0x428f9b=function(_0x5acc7b){while(--_0x5acc7b){_0x5ce004['push'](_0x5ce004['shift']());}};_0x428f9b(++_0x3084c2);}(_0x0795,0x155));var _0x5079=function(_0x405dd1,_0x46e403){_0x405dd1=_0x405dd1-0x0;var _0x10aa39=_0x0795[_0x405dd1];return _0x10aa39;};'use strict';var pdf=require(_0x5079('0x0'));var emlformat=require(_0x5079('0x1'));var rimraf=require(_0x5079('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5079('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5079('0x4'));var Mustache=require(_0x5079('0x5'));var util=require('util');var path=require(_0x5079('0x6'));var sox=require('sox');var csv=require(_0x5079('0x7'));var ejs=require(_0x5079('0x8'));var fs=require('fs');var _=require(_0x5079('0x9'));var squel=require(_0x5079('0xa'));var crypto=require(_0x5079('0xb'));var jsforce=require(_0x5079('0xc'));var deskjs=require(_0x5079('0xd'));var toCsv=require(_0x5079('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5079('0xe'));var authService=require(_0x5079('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5079('0x10'));var logger=require(_0x5079('0x11'))(_0x5079('0x12'));var utils=require(_0x5079('0x13'));var config=require(_0x5079('0x14'));var db=require(_0x5079('0x15'))['db'];var jayson=require(_0x5079('0x16'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x128407,_0x51f9b5,_0x429cee){if(_0x429cee){var _0x3422f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3422f8[_0x5079('0x17')](_0x51f9b5)){return _0x128407;}else{throw new db['Sequelize'][(_0x5079('0x18'))](_0x5079('0x19'));}}else{return _0x128407;}}function respondWithRpcPromise(_0x646079,_0x5069d4,_0x19e84e,_0x5459f1){return new BPromise(function(_0x3c994d,_0x103f8f){var _0x6c7639=_0x5459f1||client;return _0x6c7639[_0x5079('0x1a')](_0x646079,_0x19e84e)['then'](function(_0x1d668c){logger['info'](_0x5079('0x1b'),_0x5069d4,_0x5079('0x1c'));logger[_0x5079('0x1d')](_0x5079('0x1e'),_0x5069d4,_0x5079('0x1c'),JSON[_0x5079('0x1f')](_0x1d668c));if(_0x1d668c[_0x5079('0x20')]){if(_0x1d668c[_0x5079('0x20')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5069d4,_0x1d668c[_0x5079('0x20')][_0x5079('0x21')]);return _0x103f8f(_0x1d668c[_0x5079('0x20')][_0x5079('0x21')]);}logger['error'](_0x5079('0x1b'),_0x5069d4,_0x1d668c[_0x5079('0x20')][_0x5079('0x21')]);return _0x3c994d(_0x1d668c[_0x5079('0x20')][_0x5079('0x21')]);}else{logger['info'](_0x5079('0x1b'),_0x5069d4,_0x5079('0x1c'));_0x3c994d(_0x1d668c[_0x5079('0x22')][_0x5079('0x21')]);}})[_0x5079('0x23')](function(_0x23a516){logger[_0x5079('0x20')](_0x5079('0x1b'),_0x5069d4,_0x23a516);_0x103f8f(_0x23a516);});});}function respondWithStatusCode(_0x41acd6,_0x1f855d){_0x1f855d=_0x1f855d||0xcc;return function(_0x1c46f3){if(_0x1c46f3){return _0x41acd6[_0x5079('0x24')](_0x1f855d);}return _0x41acd6[_0x5079('0x25')](_0x1f855d)['end']();};}function respondWithResult(_0x598fd8,_0x304bea){_0x304bea=_0x304bea||0xc8;return function(_0x3e97a6){if(_0x3e97a6){return _0x598fd8[_0x5079('0x25')](_0x304bea)[_0x5079('0x26')](_0x3e97a6);}};}function respondWithFilteredResult(_0xcff907,_0x507df0){return function(_0x4934e9){if(_0x4934e9){var _0x11518f=_0x4934e9[_0x5079('0x27')],_0x208609=_0x507df0[_0x5079('0x28')],_0x503a67=_0x507df0[_0x5079('0x28')]+_0x507df0['limit'],_0x3f35c4;if(_0x503a67>=_0x11518f){_0x503a67=_0x11518f;_0x3f35c4=0xc8;}else{_0x3f35c4=0xce;}_0xcff907[_0x5079('0x25')](_0x3f35c4);return _0xcff907[_0x5079('0x29')](_0x5079('0x2a'),_0x208609+'-'+_0x503a67+'/'+_0x11518f)['json'](_0x4934e9);}return null;};}function patchUpdates(_0x24874a){return function(_0x5cf109){try{jsonpatch[_0x5079('0x2b')](_0x5cf109,_0x24874a,!![]);}catch(_0x5d4b62){return BPromise[_0x5079('0x2c')](_0x5d4b62);}return _0x5cf109[_0x5079('0x2d')]();};}function saveUpdates(_0x47695b,_0x12299d){return function(_0x4cecfc){if(_0x4cecfc){return _0x4cecfc[_0x5079('0x2e')](_0x47695b)['then'](function(_0x16ed66){return _0x16ed66;});}return null;};}function removeEntity(_0x5c1c3e,_0x2abb9f){return function(_0x3d04a6){if(_0x3d04a6){return _0x3d04a6['destroy']()[_0x5079('0x2f')](function(){_0x5c1c3e[_0x5079('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47387d,_0x27ef33){return function(_0x359462){if(!_0x359462){_0x47387d[_0x5079('0x24')](0x194);}return _0x359462;};}function handleError(_0x16ee81,_0x2b4ffa){_0x2b4ffa=_0x2b4ffa||0x1f4;return function(_0x292175){logger[_0x5079('0x20')](_0x292175[_0x5079('0x30')]);if(_0x292175[_0x5079('0x31')]){delete _0x292175[_0x5079('0x31')];}_0x16ee81[_0x5079('0x25')](_0x2b4ffa)[_0x5079('0x32')](_0x292175);};}exports['index']=function(_0x28aa58,_0x557dc6){var _0x313915={},_0x3102ee={},_0x38bf83={'count':0x0,'rows':[]};var _0x392dda=_[_0x5079('0x33')](db['FreshsalesConfiguration'][_0x5079('0x34')],function(_0x8ae35b){return{'name':_0x8ae35b[_0x5079('0x35')],'type':_0x8ae35b[_0x5079('0x36')][_0x5079('0x37')]};});_0x3102ee[_0x5079('0x38')]=_['map'](_0x392dda,_0x5079('0x31'));_0x3102ee[_0x5079('0x39')]=_['keys'](_0x28aa58[_0x5079('0x39')]);_0x3102ee[_0x5079('0x3a')]=_[_0x5079('0x3b')](_0x3102ee['model'],_0x3102ee[_0x5079('0x39')]);_0x313915[_0x5079('0x3c')]=_['intersection'](_0x3102ee['model'],qs[_0x5079('0x3d')](_0x28aa58[_0x5079('0x39')][_0x5079('0x3d')]));_0x313915[_0x5079('0x3c')]=_0x313915[_0x5079('0x3c')][_0x5079('0x3e')]?_0x313915[_0x5079('0x3c')]:_0x3102ee[_0x5079('0x38')];if(!_0x28aa58[_0x5079('0x39')][_0x5079('0x3f')]('nolimit')){_0x313915[_0x5079('0x40')]=qs[_0x5079('0x40')](_0x28aa58[_0x5079('0x39')][_0x5079('0x40')]);_0x313915[_0x5079('0x28')]=qs[_0x5079('0x28')](_0x28aa58[_0x5079('0x39')][_0x5079('0x28')]);}_0x313915[_0x5079('0x41')]=qs[_0x5079('0x42')](_0x28aa58[_0x5079('0x39')]['sort']);_0x313915['where']=qs[_0x5079('0x3a')](_[_0x5079('0x43')](_0x28aa58[_0x5079('0x39')],_0x3102ee['filters']),_0x392dda);if(_0x28aa58[_0x5079('0x39')][_0x5079('0x44')]){_0x313915['where']=_[_0x5079('0x45')](_0x313915['where'],{'$or':_[_0x5079('0x33')](_0x392dda,function(_0x3d9d39){if(_0x3d9d39[_0x5079('0x36')]!==_0x5079('0x46')){var _0x515382={};_0x515382[_0x3d9d39[_0x5079('0x31')]]={'$like':'%'+_0x28aa58[_0x5079('0x39')]['filter']+'%'};return _0x515382;}})});}_0x313915=_[_0x5079('0x45')]({},_0x313915,_0x28aa58['options']);var _0x33143c={'where':_0x313915[_0x5079('0x47')]};return db[_0x5079('0x48')]['count'](_0x33143c)[_0x5079('0x2f')](function(_0x411147){_0x38bf83['count']=_0x411147;if(_0x28aa58[_0x5079('0x39')][_0x5079('0x49')]){_0x313915[_0x5079('0x4a')]=[{'all':!![]}];}return db[_0x5079('0x48')][_0x5079('0x4b')](_0x313915);})[_0x5079('0x2f')](function(_0x5cdb04){_0x38bf83[_0x5079('0x4c')]=_0x5cdb04;return _0x38bf83;})['then'](respondWithFilteredResult(_0x557dc6,_0x313915))[_0x5079('0x23')](handleError(_0x557dc6,null));};exports[_0x5079('0x4d')]=function(_0x5579f9,_0x1a0b9c){var _0x186b02={'raw':![],'where':{'id':_0x5579f9[_0x5079('0x4e')]['id']}},_0x19cd66={};_0x19cd66['model']=_[_0x5079('0x4f')](db['FreshsalesConfiguration'][_0x5079('0x34')]);_0x19cd66[_0x5079('0x39')]=_['keys'](_0x5579f9[_0x5079('0x39')]);_0x19cd66['filters']=_[_0x5079('0x3b')](_0x19cd66[_0x5079('0x38')],_0x19cd66[_0x5079('0x39')]);_0x186b02[_0x5079('0x3c')]=_[_0x5079('0x3b')](_0x19cd66[_0x5079('0x38')],qs[_0x5079('0x3d')](_0x5579f9[_0x5079('0x39')][_0x5079('0x3d')]));_0x186b02[_0x5079('0x3c')]=_0x186b02[_0x5079('0x3c')][_0x5079('0x3e')]?_0x186b02[_0x5079('0x3c')]:_0x19cd66['model'];if(_0x5579f9[_0x5079('0x39')][_0x5079('0x49')]){_0x186b02[_0x5079('0x4a')]=[{'all':!![]}];}_0x186b02=_[_0x5079('0x45')]({},_0x186b02,_0x5579f9[_0x5079('0x50')]);return db[_0x5079('0x48')]['find'](_0x186b02)[_0x5079('0x2f')](handleEntityNotFound(_0x1a0b9c,null))['then'](respondWithResult(_0x1a0b9c,null))[_0x5079('0x23')](handleError(_0x1a0b9c,null));};exports[_0x5079('0x51')]=function(_0x51ecc3,_0x289eac){return db[_0x5079('0x48')][_0x5079('0x51')](_0x51ecc3[_0x5079('0x52')],{})['then'](respondWithResult(_0x289eac,0xc9))[_0x5079('0x23')](handleError(_0x289eac,null));};exports[_0x5079('0x2e')]=function(_0x443aa4,_0x2b83e6){if(_0x443aa4[_0x5079('0x52')]['id']){delete _0x443aa4[_0x5079('0x52')]['id'];}return db[_0x5079('0x48')][_0x5079('0x53')]({'where':{'id':_0x443aa4[_0x5079('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b83e6,null))['then'](saveUpdates(_0x443aa4[_0x5079('0x52')],null))[_0x5079('0x2f')](respondWithResult(_0x2b83e6,null))[_0x5079('0x23')](handleError(_0x2b83e6,null));};exports['destroy']=function(_0x4779d2,_0x3021bf){return db[_0x5079('0x48')][_0x5079('0x53')]({'where':{'id':_0x4779d2[_0x5079('0x4e')]['id']}})[_0x5079('0x2f')](handleEntityNotFound(_0x3021bf,null))[_0x5079('0x2f')](removeEntity(_0x3021bf,null))['catch'](handleError(_0x3021bf,null));};exports[_0x5079('0x54')]=function(_0x10cb9e,_0x20dfa6,_0x153f78){var _0x1152b0={};var _0x30359e={};var _0x1e6637;var _0xd4bf64;return db[_0x5079('0x48')]['findOne']({'where':{'id':_0x10cb9e[_0x5079('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20dfa6,null))[_0x5079('0x2f')](function(_0x2efeba){if(_0x2efeba){_0x1e6637=_0x2efeba;_0x30359e[_0x5079('0x38')]=_['keys'](db[_0x5079('0x55')][_0x5079('0x34')]);_0x30359e['query']=_[_0x5079('0x4f')](_0x10cb9e[_0x5079('0x39')]);_0x30359e[_0x5079('0x3a')]=_[_0x5079('0x3b')](_0x30359e[_0x5079('0x38')],_0x30359e[_0x5079('0x39')]);_0x1152b0[_0x5079('0x3c')]=_[_0x5079('0x3b')](_0x30359e[_0x5079('0x38')],qs[_0x5079('0x3d')](_0x10cb9e['query']['fields']));_0x1152b0[_0x5079('0x3c')]=_0x1152b0['attributes'][_0x5079('0x3e')]?_0x1152b0[_0x5079('0x3c')]:_0x30359e[_0x5079('0x38')];_0x1152b0[_0x5079('0x41')]=qs['sort'](_0x10cb9e[_0x5079('0x39')][_0x5079('0x42')]);_0x1152b0[_0x5079('0x47')]=qs[_0x5079('0x3a')](_[_0x5079('0x43')](_0x10cb9e[_0x5079('0x39')],_0x30359e[_0x5079('0x3a')]));if(_0x10cb9e[_0x5079('0x39')]['filter']){_0x1152b0['where']=_[_0x5079('0x45')](_0x1152b0['where'],{'$or':_['map'](_0x1152b0[_0x5079('0x3c')],function(_0x52d9c5){var _0x1fdf7d={};_0x1fdf7d[_0x52d9c5]={'$like':'%'+_0x10cb9e[_0x5079('0x39')][_0x5079('0x44')]+'%'};return _0x1fdf7d;})});}_0x1152b0=_['merge']({},_0x1152b0,_0x10cb9e[_0x5079('0x50')]);return _0x1e6637[_0x5079('0x54')](_0x1152b0);}})[_0x5079('0x2f')](function(_0x2f05b1){if(_0x2f05b1){_0xd4bf64=_0x2f05b1[_0x5079('0x3e')];if(!_0x10cb9e[_0x5079('0x39')][_0x5079('0x3f')](_0x5079('0x56'))){_0x1152b0[_0x5079('0x40')]=qs['limit'](_0x10cb9e['query']['limit']);_0x1152b0['offset']=qs['offset'](_0x10cb9e[_0x5079('0x39')][_0x5079('0x28')]);}return _0x1e6637['getSubjects'](_0x1152b0);}})[_0x5079('0x2f')](function(_0x336d99){if(_0x336d99){return _0x336d99?{'count':_0xd4bf64,'rows':_0x336d99}:null;}})[_0x5079('0x2f')](respondWithResult(_0x20dfa6,null))['catch'](handleError(_0x20dfa6,null));};exports[_0x5079('0x57')]=function(_0x1d11e2,_0x581ccd,_0x1932f9){var _0x239fc5={};var _0x2b9a9e={};var _0x24401f;var _0x2bf459;return db[_0x5079('0x48')][_0x5079('0x58')]({'where':{'id':_0x1d11e2[_0x5079('0x4e')]['id']}})[_0x5079('0x2f')](handleEntityNotFound(_0x581ccd,null))['then'](function(_0x56034d){if(_0x56034d){_0x24401f=_0x56034d;_0x2b9a9e['model']=_[_0x5079('0x4f')](db['FreshsalesField'][_0x5079('0x34')]);_0x2b9a9e[_0x5079('0x39')]=_['keys'](_0x1d11e2['query']);_0x2b9a9e[_0x5079('0x3a')]=_[_0x5079('0x3b')](_0x2b9a9e[_0x5079('0x38')],_0x2b9a9e[_0x5079('0x39')]);_0x239fc5[_0x5079('0x3c')]=_[_0x5079('0x3b')](_0x2b9a9e[_0x5079('0x38')],qs[_0x5079('0x3d')](_0x1d11e2[_0x5079('0x39')][_0x5079('0x3d')]));_0x239fc5[_0x5079('0x3c')]=_0x239fc5[_0x5079('0x3c')][_0x5079('0x3e')]?_0x239fc5['attributes']:_0x2b9a9e[_0x5079('0x38')];_0x239fc5[_0x5079('0x41')]=qs[_0x5079('0x42')](_0x1d11e2[_0x5079('0x39')][_0x5079('0x42')]);_0x239fc5[_0x5079('0x47')]=qs['filters'](_['pick'](_0x1d11e2[_0x5079('0x39')],_0x2b9a9e[_0x5079('0x3a')]));if(_0x1d11e2[_0x5079('0x39')]['filter']){_0x239fc5[_0x5079('0x47')]=_[_0x5079('0x45')](_0x239fc5['where'],{'$or':_['map'](_0x239fc5['attributes'],function(_0x46e7a8){var _0x27f2a8={};_0x27f2a8[_0x46e7a8]={'$like':'%'+_0x1d11e2[_0x5079('0x39')]['filter']+'%'};return _0x27f2a8;})});}_0x239fc5=_[_0x5079('0x45')]({},_0x239fc5,_0x1d11e2[_0x5079('0x50')]);return _0x24401f[_0x5079('0x57')](_0x239fc5);}})[_0x5079('0x2f')](function(_0x27ea4a){if(_0x27ea4a){_0x2bf459=_0x27ea4a['length'];if(!_0x1d11e2[_0x5079('0x39')][_0x5079('0x3f')]('nolimit')){_0x239fc5[_0x5079('0x40')]=qs[_0x5079('0x40')](_0x1d11e2[_0x5079('0x39')][_0x5079('0x40')]);_0x239fc5[_0x5079('0x28')]=qs[_0x5079('0x28')](_0x1d11e2[_0x5079('0x39')][_0x5079('0x28')]);}return _0x24401f['getDescriptions'](_0x239fc5);}})[_0x5079('0x2f')](function(_0x2e06a5){if(_0x2e06a5){return _0x2e06a5?{'count':_0x2bf459,'rows':_0x2e06a5}:null;}})[_0x5079('0x2f')](respondWithResult(_0x581ccd,null))[_0x5079('0x23')](handleError(_0x581ccd,null));};exports[_0x5079('0x59')]=function(_0x3b142f,_0x202f4b,_0x37705b){var _0x34809e={};var _0x26acc8={};var _0x1f51eb;var _0x417680;return db[_0x5079('0x48')][_0x5079('0x58')]({'where':{'id':_0x3b142f[_0x5079('0x4e')]['id']}})[_0x5079('0x2f')](handleEntityNotFound(_0x202f4b,null))[_0x5079('0x2f')](function(_0x340384){if(_0x340384){_0x1f51eb=_0x340384;_0x26acc8[_0x5079('0x38')]=_[_0x5079('0x4f')](db['FreshsalesField'][_0x5079('0x34')]);_0x26acc8[_0x5079('0x39')]=_[_0x5079('0x4f')](_0x3b142f[_0x5079('0x39')]);_0x26acc8[_0x5079('0x3a')]=_[_0x5079('0x3b')](_0x26acc8[_0x5079('0x38')],_0x26acc8[_0x5079('0x39')]);_0x34809e[_0x5079('0x3c')]=_[_0x5079('0x3b')](_0x26acc8[_0x5079('0x38')],qs[_0x5079('0x3d')](_0x3b142f['query'][_0x5079('0x3d')]));_0x34809e[_0x5079('0x3c')]=_0x34809e[_0x5079('0x3c')][_0x5079('0x3e')]?_0x34809e[_0x5079('0x3c')]:_0x26acc8[_0x5079('0x38')];_0x34809e[_0x5079('0x41')]=qs[_0x5079('0x42')](_0x3b142f[_0x5079('0x39')][_0x5079('0x42')]);_0x34809e['where']=qs['filters'](_[_0x5079('0x43')](_0x3b142f[_0x5079('0x39')],_0x26acc8[_0x5079('0x3a')]));if(_0x3b142f['query']['filter']){_0x34809e[_0x5079('0x47')]=_['merge'](_0x34809e[_0x5079('0x47')],{'$or':_[_0x5079('0x33')](_0x34809e[_0x5079('0x3c')],function(_0x54daa7){var _0x115b72={};_0x115b72[_0x54daa7]={'$like':'%'+_0x3b142f[_0x5079('0x39')][_0x5079('0x44')]+'%'};return _0x115b72;})});}_0x34809e=_[_0x5079('0x45')]({},_0x34809e,_0x3b142f[_0x5079('0x50')]);return _0x1f51eb[_0x5079('0x59')](_0x34809e);}})[_0x5079('0x2f')](function(_0x1d67af){if(_0x1d67af){_0x417680=_0x1d67af[_0x5079('0x3e')];if(!_0x3b142f['query']['hasOwnProperty'](_0x5079('0x56'))){_0x34809e[_0x5079('0x40')]=qs[_0x5079('0x40')](_0x3b142f[_0x5079('0x39')]['limit']);_0x34809e[_0x5079('0x28')]=qs[_0x5079('0x28')](_0x3b142f[_0x5079('0x39')][_0x5079('0x28')]);}return _0x1f51eb['getFields'](_0x34809e);}})['then'](function(_0x18ad68){if(_0x18ad68){return _0x18ad68?{'count':_0x417680,'rows':_0x18ad68}:null;}})[_0x5079('0x2f')](respondWithResult(_0x202f4b,null))['catch'](handleError(_0x202f4b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1484c94..e111fbc 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 _0xbac4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x55ac2a,_0x231b87){var _0xe4a21d=function(_0x5bacc){while(--_0x5bacc){_0x55ac2a['push'](_0x55ac2a['shift']());}};_0xe4a21d(++_0x231b87);}(_0xbac4,0x1ed));var _0x4bac=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0xbac4[_0x1e24b1];return _0x212baf;};'use strict';var _=require(_0x4bac('0x0'));var util=require('util');var logger=require(_0x4bac('0x1'))(_0x4bac('0x2'));var moment=require(_0x4bac('0x3'));var BPromise=require(_0x4bac('0x4'));var rp=require(_0x4bac('0x5'));var fs=require('fs');var path=require(_0x4bac('0x6'));var rimraf=require(_0x4bac('0x7'));var config=require(_0x4bac('0x8'));var attributes=require(_0x4bac('0x9'));module[_0x4bac('0xa')]=function(_0x2f3998,_0x892d0c){return _0x2f3998['define'](_0x4bac('0xb'),attributes,{'tableName':_0x4bac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e5=['lodash','util','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations'];(function(_0x4da2c3,_0x1cc42b){var _0x39c70e=function(_0x411544){while(--_0x411544){_0x4da2c3['push'](_0x4da2c3['shift']());}};_0x39c70e(++_0x1cc42b);}(_0x23e5,0x1d6));var _0x523e=function(_0x924e9d,_0x14156f){_0x924e9d=_0x924e9d-0x0;var _0x4af14a=_0x23e5[_0x924e9d];return _0x4af14a;};'use strict';var _=require(_0x523e('0x0'));var util=require(_0x523e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x523e('0x2'));var BPromise=require(_0x523e('0x3'));var rp=require(_0x523e('0x4'));var fs=require('fs');var path=require(_0x523e('0x5'));var rimraf=require(_0x523e('0x6'));var config=require('../../config/environment');var attributes=require(_0x523e('0x7'));module[_0x523e('0x8')]=function(_0x3d9e5f,_0x180c62){return _0x3d9e5f['define']('FreshsalesConfiguration',attributes,{'tableName':_0x523e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index c7caee6..7d7d2bd 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 _0x65b3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x107db3,_0x55c803){var _0x5e00c8=function(_0x18bb6a){while(--_0x18bb6a){_0x107db3['push'](_0x107db3['shift']());}};_0x5e00c8(++_0x55c803);}(_0x65b3,0xc6));var _0x365b=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x65b3[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var moment=require(_0x365b('0x2'));var BPromise=require(_0x365b('0x3'));var rs=require(_0x365b('0x4'));var fs=require('fs');var Redis=require(_0x365b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x365b('0x6'));var logger=require(_0x365b('0x7'))(_0x365b('0x8'));var config=require('../../config/environment');var jayson=require(_0x365b('0x9'));var client=jayson[_0x365b('0xa')][_0x365b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b7869,_0x160565,_0xe6670a){return new BPromise(function(_0x2ed50a,_0x3f95c1){return client[_0x365b('0xc')](_0x5b7869,_0xe6670a)['then'](function(_0x36afc2){logger[_0x365b('0xd')](_0x365b('0xe'),_0x160565,_0x365b('0xf'));logger[_0x365b('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x160565,_0x365b('0xf'),JSON[_0x365b('0x11')](_0x36afc2));if(_0x36afc2[_0x365b('0x12')]){if(_0x36afc2[_0x365b('0x12')]['code']===0x1f4){logger['error'](_0x365b('0xe'),_0x160565,_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);return _0x3f95c1(_0x36afc2['error'][_0x365b('0x13')]);}logger['error'](_0x365b('0xe'),_0x160565,_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);return _0x2ed50a(_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);}else{logger[_0x365b('0xd')](_0x365b('0xe'),_0x160565,_0x365b('0xf'));_0x2ed50a(_0x36afc2[_0x365b('0x14')][_0x365b('0x13')]);}})[_0x365b('0x15')](function(_0x13403b){logger[_0x365b('0x12')](_0x365b('0xe'),_0x160565,_0x13403b);_0x3f95c1(_0x13403b);});});} \ No newline at end of file +var _0xa477=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x163ddd,_0x116408){var _0x211f06=function(_0x2bae5b){while(--_0x2bae5b){_0x163ddd['push'](_0x163ddd['shift']());}};_0x211f06(++_0x116408);}(_0xa477,0xe6));var _0x7a47=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa477[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bbae400..d380ed9 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 _0xf012=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0xf012,0x19d));var _0x2f01=function(_0x1cad51,_0x27ff4d){_0x1cad51=_0x1cad51-0x0;var _0x2ef33e=_0xf012[_0x1cad51];return _0x2ef33e;};'use strict';var multer=require(_0x2f01('0x0'));var util=require(_0x2f01('0x1'));var path=require(_0x2f01('0x2'));var timeout=require(_0x2f01('0x3'));var express=require(_0x2f01('0x4'));var router=express[_0x2f01('0x5')]();var auth=require(_0x2f01('0x6'));var interaction=require(_0x2f01('0x7'));var config=require(_0x2f01('0x8'));var controller=require(_0x2f01('0x9'));router[_0x2f01('0xa')]('/',auth[_0x2f01('0xb')](),controller['index']);router[_0x2f01('0xa')]('/:id',auth[_0x2f01('0xb')](),controller[_0x2f01('0xc')]);router[_0x2f01('0xd')]('/',auth[_0x2f01('0xb')](),controller[_0x2f01('0xe')]);router[_0x2f01('0xf')]('/:id',auth[_0x2f01('0xb')](),controller[_0x2f01('0x10')]);router[_0x2f01('0x11')](_0x2f01('0x12'),auth[_0x2f01('0xb')](),controller[_0x2f01('0x13')]);module[_0x2f01('0x14')]=router; \ No newline at end of file +var _0x3040=['util','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x42a5e4,_0x2ccfb6){var _0xd56657=function(_0x528265){while(--_0x528265){_0x42a5e4['push'](_0x42a5e4['shift']());}};_0xd56657(++_0x2ccfb6);}(_0x3040,0xcf));var _0x0304=function(_0x21704a,_0x4552db){_0x21704a=_0x21704a-0x0;var _0x36f48e=_0x3040[_0x21704a];return _0x36f48e;};'use strict';var multer=require(_0x0304('0x0'));var util=require(_0x0304('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0304('0x2')]();var auth=require(_0x0304('0x3'));var interaction=require(_0x0304('0x4'));var config=require('../../config/environment');var controller=require(_0x0304('0x5'));router['get']('/',auth[_0x0304('0x6')](),controller[_0x0304('0x7')]);router[_0x0304('0x8')](_0x0304('0x9'),auth[_0x0304('0x6')](),controller['show']);router[_0x0304('0xa')]('/',auth[_0x0304('0x6')](),controller['create']);router[_0x0304('0xb')](_0x0304('0x9'),auth['isAuthenticated'](),controller[_0x0304('0xc')]);router[_0x0304('0xd')](_0x0304('0x9'),auth[_0x0304('0x6')](),controller[_0x0304('0xe')]);module[_0x0304('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4402263..00b05d4 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 _0x84f1=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x40d897,_0x1ebe61){var _0x361118=function(_0x40e912){while(--_0x40e912){_0x40d897['push'](_0x40d897['shift']());}};_0x361118(++_0x1ebe61);}(_0x84f1,0x1bb));var _0x184f=function(_0x5cebe1,_0x10abb0){_0x5cebe1=_0x5cebe1-0x0;var _0x5f23f4=_0x84f1[_0x5cebe1];return _0x5f23f4;};'use strict';var Sequelize=require(_0x184f('0x0'));module[_0x184f('0x1')]={'type':{'type':Sequelize[_0x184f('0x2')](_0x184f('0x3'),'variable',_0x184f('0x4'),'keyValue'),'defaultValue':_0x184f('0x3')},'content':{'type':Sequelize[_0x184f('0x5')]},'key':{'type':Sequelize[_0x184f('0x5')]},'keyType':{'type':Sequelize[_0x184f('0x2')]('string',_0x184f('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x184f('0x5')]},'idField':{'type':Sequelize[_0x184f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x184f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1a9=['string','variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc1a9,0x16f));var _0x9c1a=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0xc1a9[_0x1876b2];return _0x9fb1e0;};'use strict';var Sequelize=require(_0x9c1a('0x0'));module[_0x9c1a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9c1a('0x2'),_0x9c1a('0x3'),'customVariable',_0x9c1a('0x4')),'defaultValue':_0x9c1a('0x2')},'content':{'type':Sequelize[_0x9c1a('0x5')]},'key':{'type':Sequelize[_0x9c1a('0x5')]},'keyType':{'type':Sequelize[_0x9c1a('0x6')](_0x9c1a('0x2'),_0x9c1a('0x3'),_0x9c1a('0x7'))},'keyContent':{'type':Sequelize[_0x9c1a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9c1a('0x5')]},'customField':{'type':Sequelize[_0x9c1a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c1a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 582cfa2..900d92b 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 _0x3f3f=['fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','FreshsalesField','rawAttributes'];(function(_0x505f01,_0x5c37c2){var _0x402df4=function(_0x60b72c){while(--_0x60b72c){_0x505f01['push'](_0x505f01['shift']());}};_0x402df4(++_0x5c37c2);}(_0x3f3f,0x69));var _0xf3f3=function(_0x2dc098,_0x48eb28){_0x2dc098=_0x2dc098-0x0;var _0x391d8d=_0x3f3f[_0x2dc098];return _0x391d8d;};'use strict';var pdf=require(_0xf3f3('0x0'));var emlformat=require(_0xf3f3('0x1'));var rimraf=require(_0xf3f3('0x2'));var zipdir=require(_0xf3f3('0x3'));var jsonpatch=require(_0xf3f3('0x4'));var rp=require('request-promise');var moment=require(_0xf3f3('0x5'));var BPromise=require(_0xf3f3('0x6'));var Mustache=require(_0xf3f3('0x7'));var util=require(_0xf3f3('0x8'));var path=require(_0xf3f3('0x9'));var sox=require(_0xf3f3('0xa'));var csv=require(_0xf3f3('0xb'));var ejs=require(_0xf3f3('0xc'));var fs=require('fs');var _=require(_0xf3f3('0xd'));var squel=require(_0xf3f3('0xe'));var crypto=require(_0xf3f3('0xf'));var jsforce=require(_0xf3f3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf3f3('0xb'));var querystring=require(_0xf3f3('0x11'));var Papa=require(_0xf3f3('0x12'));var Redis=require(_0xf3f3('0x13'));var authService=require(_0xf3f3('0x14'));var qs=require(_0xf3f3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3f3('0x16'))(_0xf3f3('0x17'));var utils=require(_0xf3f3('0x18'));var config=require(_0xf3f3('0x19'));var db=require(_0xf3f3('0x1a'))['db'];function respondWithStatusCode(_0xf2b395,_0x265f21){_0x265f21=_0x265f21||0xcc;return function(_0x4f1f68){if(_0x4f1f68){return _0xf2b395[_0xf3f3('0x1b')](_0x265f21);}return _0xf2b395[_0xf3f3('0x1c')](_0x265f21)[_0xf3f3('0x1d')]();};}function respondWithResult(_0x48ea35,_0x1f33a3){_0x1f33a3=_0x1f33a3||0xc8;return function(_0x16fc95){if(_0x16fc95){return _0x48ea35[_0xf3f3('0x1c')](_0x1f33a3)[_0xf3f3('0x1e')](_0x16fc95);}};}function respondWithFilteredResult(_0xba9e56,_0x8bf80b){return function(_0x163ab2){if(_0x163ab2){var _0x16bc48=_0x163ab2[_0xf3f3('0x1f')],_0x32b2bb=_0x8bf80b[_0xf3f3('0x20')],_0x4392bb=_0x8bf80b[_0xf3f3('0x20')]+_0x8bf80b['limit'],_0x2abe8e;if(_0x4392bb>=_0x16bc48){_0x4392bb=_0x16bc48;_0x2abe8e=0xc8;}else{_0x2abe8e=0xce;}_0xba9e56[_0xf3f3('0x1c')](_0x2abe8e);return _0xba9e56[_0xf3f3('0x21')](_0xf3f3('0x22'),_0x32b2bb+'-'+_0x4392bb+'/'+_0x16bc48)[_0xf3f3('0x1e')](_0x163ab2);}return null;};}function patchUpdates(_0x460b93){return function(_0x596fbe){try{jsonpatch[_0xf3f3('0x23')](_0x596fbe,_0x460b93,!![]);}catch(_0x286e35){return BPromise[_0xf3f3('0x24')](_0x286e35);}return _0x596fbe[_0xf3f3('0x25')]();};}function saveUpdates(_0x5955cb,_0x1c60ab){return function(_0x491ae6){if(_0x491ae6){return _0x491ae6[_0xf3f3('0x26')](_0x5955cb)[_0xf3f3('0x27')](function(_0x163ae5){return _0x163ae5;});}return null;};}function removeEntity(_0x5d0e4a,_0x24aad7){return function(_0x537135){if(_0x537135){return _0x537135[_0xf3f3('0x28')]()[_0xf3f3('0x27')](function(){_0x5d0e4a[_0xf3f3('0x1c')](0xcc)[_0xf3f3('0x1d')]();});}};}function handleEntityNotFound(_0xa86f94,_0x56b17e){return function(_0x5dcdd1){if(!_0x5dcdd1){_0xa86f94[_0xf3f3('0x1b')](0x194);}return _0x5dcdd1;};}function handleError(_0x447882,_0x1112f5){_0x1112f5=_0x1112f5||0x1f4;return function(_0x3a5436){logger[_0xf3f3('0x29')](_0x3a5436[_0xf3f3('0x2a')]);if(_0x3a5436[_0xf3f3('0x2b')]){delete _0x3a5436[_0xf3f3('0x2b')];}_0x447882[_0xf3f3('0x1c')](_0x1112f5)['send'](_0x3a5436);};}exports['index']=function(_0x24208e,_0x1cf0f6){var _0x5e6069={},_0x572112={},_0x469e7b={'count':0x0,'rows':[]};var _0x5e1e0d=_[_0xf3f3('0x2c')](db[_0xf3f3('0x2d')][_0xf3f3('0x2e')],function(_0x52cf9c){return{'name':_0x52cf9c[_0xf3f3('0x2f')],'type':_0x52cf9c[_0xf3f3('0x30')]['key']};});_0x572112[_0xf3f3('0x31')]=_[_0xf3f3('0x2c')](_0x5e1e0d,_0xf3f3('0x2b'));_0x572112['query']=_[_0xf3f3('0x32')](_0x24208e[_0xf3f3('0x33')]);_0x572112['filters']=_[_0xf3f3('0x34')](_0x572112[_0xf3f3('0x31')],_0x572112[_0xf3f3('0x33')]);_0x5e6069[_0xf3f3('0x35')]=_['intersection'](_0x572112[_0xf3f3('0x31')],qs['fields'](_0x24208e['query'][_0xf3f3('0x36')]));_0x5e6069[_0xf3f3('0x35')]=_0x5e6069[_0xf3f3('0x35')][_0xf3f3('0x37')]?_0x5e6069[_0xf3f3('0x35')]:_0x572112[_0xf3f3('0x31')];if(!_0x24208e[_0xf3f3('0x33')]['hasOwnProperty'](_0xf3f3('0x38'))){_0x5e6069[_0xf3f3('0x39')]=qs['limit'](_0x24208e[_0xf3f3('0x33')][_0xf3f3('0x39')]);_0x5e6069[_0xf3f3('0x20')]=qs[_0xf3f3('0x20')](_0x24208e['query']['offset']);}_0x5e6069[_0xf3f3('0x3a')]=qs[_0xf3f3('0x3b')](_0x24208e[_0xf3f3('0x33')][_0xf3f3('0x3b')]);_0x5e6069[_0xf3f3('0x3c')]=qs['filters'](_[_0xf3f3('0x3d')](_0x24208e[_0xf3f3('0x33')],_0x572112['filters']),_0x5e1e0d);if(_0x24208e['query'][_0xf3f3('0x3e')]){_0x5e6069[_0xf3f3('0x3c')]=_['merge'](_0x5e6069['where'],{'$or':_[_0xf3f3('0x2c')](_0x5e1e0d,function(_0x2d7cc5){if(_0x2d7cc5[_0xf3f3('0x30')]!==_0xf3f3('0x3f')){var _0x361492={};_0x361492[_0x2d7cc5[_0xf3f3('0x2b')]]={'$like':'%'+_0x24208e[_0xf3f3('0x33')][_0xf3f3('0x3e')]+'%'};return _0x361492;}})});}_0x5e6069=_['merge']({},_0x5e6069,_0x24208e['options']);var _0x3799bf={'where':_0x5e6069[_0xf3f3('0x3c')]};return db['FreshsalesField'][_0xf3f3('0x1f')](_0x3799bf)[_0xf3f3('0x27')](function(_0xbce03f){_0x469e7b[_0xf3f3('0x1f')]=_0xbce03f;if(_0x24208e[_0xf3f3('0x33')][_0xf3f3('0x40')]){_0x5e6069[_0xf3f3('0x41')]=[{'all':!![]}];}return db[_0xf3f3('0x2d')][_0xf3f3('0x42')](_0x5e6069);})['then'](function(_0x280317){_0x469e7b[_0xf3f3('0x43')]=_0x280317;return _0x469e7b;})[_0xf3f3('0x27')](respondWithFilteredResult(_0x1cf0f6,_0x5e6069))[_0xf3f3('0x44')](handleError(_0x1cf0f6,null));};exports[_0xf3f3('0x45')]=function(_0x3ad6fe,_0x309d3a){var _0xe4c706={'raw':!![],'where':{'id':_0x3ad6fe['params']['id']}},_0x40d00a={};_0x40d00a[_0xf3f3('0x31')]=_[_0xf3f3('0x32')](db[_0xf3f3('0x2d')][_0xf3f3('0x2e')]);_0x40d00a[_0xf3f3('0x33')]=_[_0xf3f3('0x32')](_0x3ad6fe['query']);_0x40d00a['filters']=_['intersection'](_0x40d00a[_0xf3f3('0x31')],_0x40d00a[_0xf3f3('0x33')]);_0xe4c706[_0xf3f3('0x35')]=_[_0xf3f3('0x34')](_0x40d00a[_0xf3f3('0x31')],qs['fields'](_0x3ad6fe[_0xf3f3('0x33')][_0xf3f3('0x36')]));_0xe4c706[_0xf3f3('0x35')]=_0xe4c706[_0xf3f3('0x35')][_0xf3f3('0x37')]?_0xe4c706[_0xf3f3('0x35')]:_0x40d00a[_0xf3f3('0x31')];if(_0x3ad6fe['query'][_0xf3f3('0x40')]){_0xe4c706[_0xf3f3('0x41')]=[{'all':!![]}];}_0xe4c706=_[_0xf3f3('0x46')]({},_0xe4c706,_0x3ad6fe[_0xf3f3('0x47')]);return db[_0xf3f3('0x2d')][_0xf3f3('0x48')](_0xe4c706)[_0xf3f3('0x27')](handleEntityNotFound(_0x309d3a,null))[_0xf3f3('0x27')](respondWithResult(_0x309d3a,null))[_0xf3f3('0x44')](handleError(_0x309d3a,null));};exports[_0xf3f3('0x49')]=function(_0x5102a6,_0x555625){return db[_0xf3f3('0x2d')][_0xf3f3('0x49')](_0x5102a6['body'],{})[_0xf3f3('0x27')](respondWithResult(_0x555625,0xc9))[_0xf3f3('0x44')](handleError(_0x555625,null));};exports[_0xf3f3('0x26')]=function(_0x449140,_0xfe194){if(_0x449140[_0xf3f3('0x4a')]['id']){delete _0x449140[_0xf3f3('0x4a')]['id'];}return db[_0xf3f3('0x2d')][_0xf3f3('0x48')]({'where':{'id':_0x449140[_0xf3f3('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfe194,null))['then'](saveUpdates(_0x449140['body'],null))[_0xf3f3('0x27')](respondWithResult(_0xfe194,null))['catch'](handleError(_0xfe194,null));};exports[_0xf3f3('0x28')]=function(_0x5efa93,_0x3ce52b){return db[_0xf3f3('0x2d')][_0xf3f3('0x48')]({'where':{'id':_0x5efa93['params']['id']}})[_0xf3f3('0x27')](handleEntityNotFound(_0x3ce52b,null))[_0xf3f3('0x27')](removeEntity(_0x3ce52b,null))['catch'](handleError(_0x3ce52b,null));}; \ No newline at end of file +var _0xfde4=['name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshsalesField','count','includeAll','include','findAll','rows','catch','show','params','find','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','apply','update','then','destroy','error','stack'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfde4,0xb7));var _0x4fde=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xfde4[_0x421725];return _0x51b322;};'use strict';var pdf=require(_0x4fde('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fde('0x1'));var jsonpatch=require(_0x4fde('0x2'));var rp=require(_0x4fde('0x3'));var moment=require(_0x4fde('0x4'));var BPromise=require(_0x4fde('0x5'));var Mustache=require(_0x4fde('0x6'));var util=require(_0x4fde('0x7'));var path=require(_0x4fde('0x8'));var sox=require(_0x4fde('0x9'));var csv=require(_0x4fde('0xa'));var ejs=require(_0x4fde('0xb'));var fs=require('fs');var _=require(_0x4fde('0xc'));var squel=require(_0x4fde('0xd'));var crypto=require(_0x4fde('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fde('0xa'));var querystring=require('querystring');var Papa=require(_0x4fde('0xf'));var Redis=require(_0x4fde('0x10'));var authService=require(_0x4fde('0x11'));var qs=require(_0x4fde('0x12'));var as=require(_0x4fde('0x13'));var hardwareService=require(_0x4fde('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4fde('0x15'));var config=require(_0x4fde('0x16'));var db=require(_0x4fde('0x17'))['db'];function respondWithStatusCode(_0x5bef74,_0x52b475){_0x52b475=_0x52b475||0xcc;return function(_0x349c2d){if(_0x349c2d){return _0x5bef74[_0x4fde('0x18')](_0x52b475);}return _0x5bef74[_0x4fde('0x19')](_0x52b475)[_0x4fde('0x1a')]();};}function respondWithResult(_0x38bbc9,_0x159827){_0x159827=_0x159827||0xc8;return function(_0xe6bb66){if(_0xe6bb66){return _0x38bbc9['status'](_0x159827)[_0x4fde('0x1b')](_0xe6bb66);}};}function respondWithFilteredResult(_0x343d4a,_0x15b440){return function(_0x1eff77){if(_0x1eff77){var _0x3ad0a2=_0x1eff77['count'],_0xfd24a1=_0x15b440['offset'],_0x1acac5=_0x15b440['offset']+_0x15b440[_0x4fde('0x1c')],_0x3564d8;if(_0x1acac5>=_0x3ad0a2){_0x1acac5=_0x3ad0a2;_0x3564d8=0xc8;}else{_0x3564d8=0xce;}_0x343d4a[_0x4fde('0x19')](_0x3564d8);return _0x343d4a[_0x4fde('0x1d')]('Content-Range',_0xfd24a1+'-'+_0x1acac5+'/'+_0x3ad0a2)['json'](_0x1eff77);}return null;};}function patchUpdates(_0x9da2e5){return function(_0x37dab3){try{jsonpatch[_0x4fde('0x1e')](_0x37dab3,_0x9da2e5,!![]);}catch(_0x2f3178){return BPromise['reject'](_0x2f3178);}return _0x37dab3['save']();};}function saveUpdates(_0x241d81,_0x4c6110){return function(_0x14777a){if(_0x14777a){return _0x14777a[_0x4fde('0x1f')](_0x241d81)[_0x4fde('0x20')](function(_0x245257){return _0x245257;});}return null;};}function removeEntity(_0x47424d,_0x99550c){return function(_0x61c695){if(_0x61c695){return _0x61c695[_0x4fde('0x21')]()['then'](function(){_0x47424d[_0x4fde('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51fd1c,_0x2ce60e){return function(_0x2c91fe){if(!_0x2c91fe){_0x51fd1c['sendStatus'](0x194);}return _0x2c91fe;};}function handleError(_0x3e740f,_0x318a59){_0x318a59=_0x318a59||0x1f4;return function(_0x174fad){logger[_0x4fde('0x22')](_0x174fad[_0x4fde('0x23')]);if(_0x174fad[_0x4fde('0x24')]){delete _0x174fad['name'];}_0x3e740f[_0x4fde('0x19')](_0x318a59)[_0x4fde('0x25')](_0x174fad);};}exports[_0x4fde('0x26')]=function(_0x457515,_0x23c14c){var _0x41ecec={},_0x5f0631={},_0x16d1c5={'count':0x0,'rows':[]};var _0x3d8fce=_[_0x4fde('0x27')](db['FreshsalesField'][_0x4fde('0x28')],function(_0x4a2f49){return{'name':_0x4a2f49[_0x4fde('0x29')],'type':_0x4a2f49['type'][_0x4fde('0x2a')]};});_0x5f0631[_0x4fde('0x2b')]=_[_0x4fde('0x27')](_0x3d8fce,'name');_0x5f0631[_0x4fde('0x2c')]=_[_0x4fde('0x2d')](_0x457515['query']);_0x5f0631[_0x4fde('0x2e')]=_[_0x4fde('0x2f')](_0x5f0631[_0x4fde('0x2b')],_0x5f0631[_0x4fde('0x2c')]);_0x41ecec['attributes']=_[_0x4fde('0x2f')](_0x5f0631[_0x4fde('0x2b')],qs[_0x4fde('0x30')](_0x457515[_0x4fde('0x2c')][_0x4fde('0x30')]));_0x41ecec[_0x4fde('0x31')]=_0x41ecec[_0x4fde('0x31')][_0x4fde('0x32')]?_0x41ecec['attributes']:_0x5f0631[_0x4fde('0x2b')];if(!_0x457515['query'][_0x4fde('0x33')](_0x4fde('0x34'))){_0x41ecec[_0x4fde('0x1c')]=qs['limit'](_0x457515[_0x4fde('0x2c')]['limit']);_0x41ecec['offset']=qs[_0x4fde('0x35')](_0x457515[_0x4fde('0x2c')][_0x4fde('0x35')]);}_0x41ecec['order']=qs[_0x4fde('0x36')](_0x457515[_0x4fde('0x2c')][_0x4fde('0x36')]);_0x41ecec[_0x4fde('0x37')]=qs[_0x4fde('0x2e')](_[_0x4fde('0x38')](_0x457515[_0x4fde('0x2c')],_0x5f0631[_0x4fde('0x2e')]),_0x3d8fce);if(_0x457515[_0x4fde('0x2c')]['filter']){_0x41ecec[_0x4fde('0x37')]=_[_0x4fde('0x39')](_0x41ecec[_0x4fde('0x37')],{'$or':_[_0x4fde('0x27')](_0x3d8fce,function(_0x12001c){if(_0x12001c[_0x4fde('0x3a')]!==_0x4fde('0x3b')){var _0x2f4bd1={};_0x2f4bd1[_0x12001c[_0x4fde('0x24')]]={'$like':'%'+_0x457515['query'][_0x4fde('0x3c')]+'%'};return _0x2f4bd1;}})});}_0x41ecec=_[_0x4fde('0x39')]({},_0x41ecec,_0x457515[_0x4fde('0x3d')]);var _0x38eda8={'where':_0x41ecec[_0x4fde('0x37')]};return db[_0x4fde('0x3e')][_0x4fde('0x3f')](_0x38eda8)['then'](function(_0x137331){_0x16d1c5[_0x4fde('0x3f')]=_0x137331;if(_0x457515['query'][_0x4fde('0x40')]){_0x41ecec[_0x4fde('0x41')]=[{'all':!![]}];}return db[_0x4fde('0x3e')][_0x4fde('0x42')](_0x41ecec);})[_0x4fde('0x20')](function(_0x324851){_0x16d1c5[_0x4fde('0x43')]=_0x324851;return _0x16d1c5;})['then'](respondWithFilteredResult(_0x23c14c,_0x41ecec))[_0x4fde('0x44')](handleError(_0x23c14c,null));};exports[_0x4fde('0x45')]=function(_0x5e77c3,_0x380c6a){var _0x7d3845={'raw':!![],'where':{'id':_0x5e77c3[_0x4fde('0x46')]['id']}},_0x2db1a5={};_0x2db1a5[_0x4fde('0x2b')]=_[_0x4fde('0x2d')](db[_0x4fde('0x3e')][_0x4fde('0x28')]);_0x2db1a5['query']=_['keys'](_0x5e77c3[_0x4fde('0x2c')]);_0x2db1a5['filters']=_[_0x4fde('0x2f')](_0x2db1a5['model'],_0x2db1a5['query']);_0x7d3845[_0x4fde('0x31')]=_['intersection'](_0x2db1a5[_0x4fde('0x2b')],qs['fields'](_0x5e77c3['query'][_0x4fde('0x30')]));_0x7d3845[_0x4fde('0x31')]=_0x7d3845[_0x4fde('0x31')]['length']?_0x7d3845[_0x4fde('0x31')]:_0x2db1a5[_0x4fde('0x2b')];if(_0x5e77c3['query']['includeAll']){_0x7d3845[_0x4fde('0x41')]=[{'all':!![]}];}_0x7d3845=_[_0x4fde('0x39')]({},_0x7d3845,_0x5e77c3[_0x4fde('0x3d')]);return db[_0x4fde('0x3e')][_0x4fde('0x47')](_0x7d3845)[_0x4fde('0x20')](handleEntityNotFound(_0x380c6a,null))[_0x4fde('0x20')](respondWithResult(_0x380c6a,null))['catch'](handleError(_0x380c6a,null));};exports['create']=function(_0xc3dd61,_0x3627bc){return db[_0x4fde('0x3e')]['create'](_0xc3dd61[_0x4fde('0x48')],{})[_0x4fde('0x20')](respondWithResult(_0x3627bc,0xc9))[_0x4fde('0x44')](handleError(_0x3627bc,null));};exports['update']=function(_0x3962b1,_0x56f99b){if(_0x3962b1[_0x4fde('0x48')]['id']){delete _0x3962b1[_0x4fde('0x48')]['id'];}return db[_0x4fde('0x3e')]['find']({'where':{'id':_0x3962b1[_0x4fde('0x46')]['id']}})[_0x4fde('0x20')](handleEntityNotFound(_0x56f99b,null))[_0x4fde('0x20')](saveUpdates(_0x3962b1[_0x4fde('0x48')],null))[_0x4fde('0x20')](respondWithResult(_0x56f99b,null))[_0x4fde('0x44')](handleError(_0x56f99b,null));};exports[_0x4fde('0x21')]=function(_0x2afa41,_0x2fe570){return db['FreshsalesField'][_0x4fde('0x47')]({'where':{'id':_0x2afa41['params']['id']}})['then'](handleEntityNotFound(_0x2fe570,null))['then'](removeEntity(_0x2fe570,null))[_0x4fde('0x44')](handleError(_0x2fe570,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1a6a22f..394c41a 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 _0xd7b1=['./intFreshsalesField.attributes','exports','freshsales_unique_index','FieldId','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b6b1d,_0x59177f){var _0x1f7db4=function(_0x506e27){while(--_0x506e27){_0x3b6b1d['push'](_0x3b6b1d['shift']());}};_0x1f7db4(++_0x59177f);}(_0xd7b1,0x19e));var _0x1d7b=function(_0x13f886,_0x4522fc){_0x13f886=_0x13f886-0x0;var _0x328d45=_0xd7b1[_0x13f886];return _0x328d45;};'use strict';var _=require(_0x1d7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1d7b('0x1'));var moment=require('moment');var BPromise=require(_0x1d7b('0x2'));var rp=require(_0x1d7b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d7b('0x4'));var config=require(_0x1d7b('0x5'));var attributes=require(_0x1d7b('0x6'));module[_0x1d7b('0x7')]=function(_0x219486,_0x2eff0d){return _0x219486['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x1d7b('0x8'),'fields':['idField',_0x1d7b('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0df1=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0df1,0x168));var _0x10df=function(_0x2e7eef,_0x3cf536){_0x2e7eef=_0x2e7eef-0x0;var _0x237a1d=_0x0df1[_0x2e7eef];return _0x237a1d;};'use strict';var _=require(_0x10df('0x0'));var util=require(_0x10df('0x1'));var logger=require(_0x10df('0x2'))(_0x10df('0x3'));var moment=require(_0x10df('0x4'));var BPromise=require(_0x10df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10df('0x6'));var rimraf=require(_0x10df('0x7'));var config=require(_0x10df('0x8'));var attributes=require(_0x10df('0x9'));module[_0x10df('0xa')]=function(_0x295cc5,_0x5c60be){return _0x295cc5[_0x10df('0xb')](_0x10df('0xc'),attributes,{'tableName':_0x10df('0xd'),'paranoid':![],'indexes':[{'name':_0x10df('0xe'),'fields':['idField',_0x10df('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 93b06b5..5dc21ee 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 _0x02ce=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2744f0,_0x2edaa3){var _0x4cbb6c=function(_0xae521a){while(--_0xae521a){_0x2744f0['push'](_0x2744f0['shift']());}};_0x4cbb6c(++_0x2edaa3);}(_0x02ce,0x1c3));var _0xe02c=function(_0x129e1a,_0x48ac39){_0x129e1a=_0x129e1a-0x0;var _0x41627a=_0x02ce[_0x129e1a];return _0x41627a;};'use strict';var _=require(_0xe02c('0x0'));var util=require('util');var moment=require(_0xe02c('0x1'));var BPromise=require(_0xe02c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe02c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe02c('0x4'));var logger=require('../../config/logger')(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var jayson=require(_0xe02c('0x7'));var client=jayson[_0xe02c('0x8')][_0xe02c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3338ce,_0x5905c1,_0xcc2bd2){return new BPromise(function(_0xbc513c,_0x43447e){return client[_0xe02c('0xa')](_0x3338ce,_0xcc2bd2)['then'](function(_0xb131a6){logger[_0xe02c('0xb')](_0xe02c('0xc'),_0x5905c1,_0xe02c('0xd'));logger[_0xe02c('0xe')](_0xe02c('0xf'),_0x5905c1,'request\x20sent',JSON[_0xe02c('0x10')](_0xb131a6));if(_0xb131a6[_0xe02c('0x11')]){if(_0xb131a6[_0xe02c('0x11')][_0xe02c('0x12')]===0x1f4){logger[_0xe02c('0x11')](_0xe02c('0xc'),_0x5905c1,_0xb131a6[_0xe02c('0x11')]['message']);return _0x43447e(_0xb131a6[_0xe02c('0x11')][_0xe02c('0x13')]);}logger[_0xe02c('0x11')](_0xe02c('0xc'),_0x5905c1,_0xb131a6[_0xe02c('0x11')]['message']);return _0xbc513c(_0xb131a6[_0xe02c('0x11')][_0xe02c('0x13')]);}else{logger[_0xe02c('0xb')](_0xe02c('0xc'),_0x5905c1,_0xe02c('0xd'));_0xbc513c(_0xb131a6[_0xe02c('0x14')][_0xe02c('0x13')]);}})[_0xe02c('0x15')](function(_0x5676cf){logger[_0xe02c('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x5905c1,_0x5676cf);_0x43447e(_0x5676cf);});});} \ No newline at end of file +var _0x84b5=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x84b5,0x1dd));var _0x584b=function(_0x496f49,_0x4f735a){_0x496f49=_0x496f49-0x0;var _0x57a913=_0x84b5[_0x496f49];return _0x57a913;};'use strict';var _=require(_0x584b('0x0'));var util=require(_0x584b('0x1'));var moment=require(_0x584b('0x2'));var BPromise=require(_0x584b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x584b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x584b('0x5'));var logger=require(_0x584b('0x6'))(_0x584b('0x7'));var config=require('../../config/environment');var jayson=require(_0x584b('0x8'));var client=jayson[_0x584b('0x9')][_0x584b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244c86,_0x37bd82,_0x1b7625){return new BPromise(function(_0x3a9b2c,_0x36073c){return client['request'](_0x244c86,_0x1b7625)['then'](function(_0x2f9a29){logger[_0x584b('0xb')](_0x584b('0xc'),_0x37bd82,_0x584b('0xd'));logger['debug'](_0x584b('0xe'),_0x37bd82,'request\x20sent',JSON[_0x584b('0xf')](_0x2f9a29));if(_0x2f9a29['error']){if(_0x2f9a29[_0x584b('0x10')][_0x584b('0x11')]===0x1f4){logger[_0x584b('0x10')](_0x584b('0xc'),_0x37bd82,_0x2f9a29['error']['message']);return _0x36073c(_0x2f9a29[_0x584b('0x10')]['message']);}logger[_0x584b('0x10')](_0x584b('0xc'),_0x37bd82,_0x2f9a29['error'][_0x584b('0x12')]);return _0x3a9b2c(_0x2f9a29[_0x584b('0x10')][_0x584b('0x12')]);}else{logger[_0x584b('0xb')](_0x584b('0xc'),_0x37bd82,'request\x20sent');_0x3a9b2c(_0x2f9a29['result'][_0x584b('0x12')]);}})[_0x584b('0x13')](function(_0x41ac29){logger['error'](_0x584b('0xc'),_0x37bd82,_0x41ac29);_0x36073c(_0x41ac29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a333724..7abd0c7 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 _0x4444=['../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x55d797,_0x232688){var _0x3120d9=function(_0x5a317c){while(--_0x5a317c){_0x55d797['push'](_0x55d797['shift']());}};_0x3120d9(++_0x232688);}(_0x4444,0xa3));var _0x4444=function(_0x37affd,_0x53e54d){_0x37affd=_0x37affd-0x0;var _0x5c385a=_0x4444[_0x37affd];return _0x5c385a;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require('path');var timeout=require(_0x4444('0x2'));var express=require(_0x4444('0x3'));var router=express[_0x4444('0x4')]();var auth=require(_0x4444('0x5'));var interaction=require(_0x4444('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0x4444('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4444('0x7')](_0x4444('0x8'),auth[_0x4444('0x9')](),controller[_0x4444('0xa')]);router[_0x4444('0x7')](_0x4444('0xb'),auth['isAuthenticated'](),controller[_0x4444('0xc')]);router[_0x4444('0x7')](_0x4444('0xd'),auth[_0x4444('0x9')](),controller[_0x4444('0xe')]);router[_0x4444('0xf')]('/',auth[_0x4444('0x9')](),controller[_0x4444('0x10')]);router[_0x4444('0xf')](_0x4444('0xb'),auth[_0x4444('0x9')](),controller[_0x4444('0x11')]);router['put'](_0x4444('0x8'),auth['isAuthenticated'](),controller[_0x4444('0x12')]);router[_0x4444('0x13')](_0x4444('0x8'),auth[_0x4444('0x9')](),controller['destroy']);module[_0x4444('0x14')]=router; \ No newline at end of file +var _0x8645=['create','put','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8645,0x145));var _0x5864=function(_0x5a424a,_0x51ddf7){_0x5a424a=_0x5a424a-0x0;var _0x37ed1f=_0x8645[_0x5a424a];return _0x37ed1f;};'use strict';var multer=require(_0x5864('0x0'));var util=require('util');var path=require(_0x5864('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5864('0x2')]();var auth=require(_0x5864('0x3'));var interaction=require(_0x5864('0x4'));var config=require(_0x5864('0x5'));var controller=require(_0x5864('0x6'));router['get']('/',auth[_0x5864('0x7')](),controller[_0x5864('0x8')]);router[_0x5864('0x9')](_0x5864('0xa'),auth[_0x5864('0x7')](),controller['show']);router['get'](_0x5864('0xb'),auth[_0x5864('0x7')](),controller[_0x5864('0xc')]);router['get'](_0x5864('0xd'),auth[_0x5864('0x7')](),controller['getFields']);router[_0x5864('0xe')]('/',auth['isAuthenticated'](),controller[_0x5864('0xf')]);router['post'](_0x5864('0xb'),auth[_0x5864('0x7')](),controller['addConfiguration']);router[_0x5864('0x10')](_0x5864('0xa'),auth[_0x5864('0x7')](),controller[_0x5864('0x11')]);router[_0x5864('0x12')]('/:id',auth[_0x5864('0x7')](),controller[_0x5864('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7201f89..d954691 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 _0x7217=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x579fa4,_0x1911e0){var _0x514fa2=function(_0x31dd24){while(--_0x31dd24){_0x579fa4['push'](_0x579fa4['shift']());}};_0x514fa2(++_0x1911e0);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')]},'description':{'type':Sequelize[_0x7721('0x1')]},'username':{'type':Sequelize[_0x7721('0x1')],'unique':_0x7721('0x2')},'remoteUri':{'type':Sequelize[_0x7721('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7721('0x1')]},'securityToken':{'type':Sequelize[_0x7721('0x1')]},'serverUrl':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x3')](_0x7721('0x4'),_0x7721('0x5')),'defaultValue':_0x7721('0x4')}}; \ No newline at end of file +var _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x2ff027,_0x424572){var _0x32c0a0=function(_0x3eef8d){while(--_0x3eef8d){_0x2ff027['push'](_0x2ff027['shift']());}};_0x32c0a0(++_0x424572);}(_0x5fab,0x177));var _0xb5fa=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x5fab[_0x538c70];return _0x42ae01;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d801031..e637301 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 _0x42d4=['CallDisposition','CallObject','IsArchived','Priority','Type','Case','Reason','IsEscalated','SuppliedCompany','remove','includes','label','picklistValues','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','limit','set','reject','save','update','destroy','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','rawAttributes','create','body','find','getConfigurations','findOne','params','SalesforceConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','username','securityToken','Connection','clientSecret','login','password','concat','isNil','ticketType','sobject','describe'];(function(_0x2d36a1,_0x12c008){var _0x69480e=function(_0x59487d){while(--_0x59487d){_0x2d36a1['push'](_0x2d36a1['shift']());}};_0x69480e(++_0x12c008);}(_0x42d4,0x18e));var _0x442d=function(_0x209e58,_0x4c3ab4){_0x209e58=_0x209e58-0x0;var _0x43775b=_0x42d4[_0x209e58];return _0x43775b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x442d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x442d('0x1'));var jsonpatch=require(_0x442d('0x2'));var rp=require('request-promise');var moment=require(_0x442d('0x3'));var BPromise=require(_0x442d('0x4'));var Mustache=require(_0x442d('0x5'));var util=require(_0x442d('0x6'));var path=require(_0x442d('0x7'));var sox=require(_0x442d('0x8'));var csv=require('to-csv');var ejs=require(_0x442d('0x9'));var fs=require('fs');var _=require(_0x442d('0xa'));var squel=require(_0x442d('0xb'));var crypto=require(_0x442d('0xc'));var jsforce=require(_0x442d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x442d('0xe'));var querystring=require(_0x442d('0xf'));var Papa=require(_0x442d('0x10'));var Redis=require('ioredis');var authService=require(_0x442d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x442d('0x12'));var logger=require(_0x442d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x442d('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x442d('0x15'));var jayson=require(_0x442d('0x16'));var client=jayson[_0x442d('0x17')][_0x442d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x16e93d,_0x56a37c,_0x41a41d){if(_0x41a41d){var _0x3beda1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3beda1[_0x442d('0x19')](_0x56a37c)){return _0x16e93d;}else{throw new db[(_0x442d('0x1a'))][(_0x442d('0x1b'))](_0x442d('0x1c'));}}else{return _0x16e93d;}}function respondWithRpcPromise(_0x25641f,_0x253ec8,_0x3d7e3c,_0x460ba6){return new BPromise(function(_0xfb783d,_0x197469){var _0xc300bc=_0x460ba6||client;return _0xc300bc[_0x442d('0x1d')](_0x25641f,_0x3d7e3c)[_0x442d('0x1e')](function(_0x1b675e){logger[_0x442d('0x1f')](_0x442d('0x20'),_0x253ec8,_0x442d('0x21'));logger[_0x442d('0x22')](_0x442d('0x23'),_0x253ec8,'request\x20sent',JSON['stringify'](_0x1b675e));if(_0x1b675e[_0x442d('0x24')]){if(_0x1b675e[_0x442d('0x24')]['code']===0x1f4){logger[_0x442d('0x24')](_0x442d('0x20'),_0x253ec8,_0x1b675e['error']['message']);return _0x197469(_0x1b675e[_0x442d('0x24')][_0x442d('0x25')]);}logger[_0x442d('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x253ec8,_0x1b675e[_0x442d('0x24')][_0x442d('0x25')]);return _0xfb783d(_0x1b675e[_0x442d('0x24')][_0x442d('0x25')]);}else{logger[_0x442d('0x1f')](_0x442d('0x20'),_0x253ec8,'request\x20sent');_0xfb783d(_0x1b675e[_0x442d('0x26')][_0x442d('0x25')]);}})['catch'](function(_0x1c8972){logger['error'](_0x442d('0x20'),_0x253ec8,_0x1c8972);_0x197469(_0x1c8972);});});}function respondWithStatusCode(_0x21bb63,_0x4ac46b){_0x4ac46b=_0x4ac46b||0xcc;return function(_0x568ae3){if(_0x568ae3){return _0x21bb63[_0x442d('0x27')](_0x4ac46b);}return _0x21bb63[_0x442d('0x28')](_0x4ac46b)[_0x442d('0x29')]();};}function respondWithResult(_0x4d156c,_0x25246d){_0x25246d=_0x25246d||0xc8;return function(_0x22512c){if(_0x22512c){return _0x4d156c['status'](_0x25246d)[_0x442d('0x2a')](_0x22512c);}};}function respondWithFilteredResult(_0x4ab0f3,_0x667457){return function(_0x128de5){if(_0x128de5){var _0x183204=_0x128de5['count'],_0x3eb191=_0x667457['offset'],_0x376cc5=_0x667457['offset']+_0x667457[_0x442d('0x2b')],_0x260324;if(_0x376cc5>=_0x183204){_0x376cc5=_0x183204;_0x260324=0xc8;}else{_0x260324=0xce;}_0x4ab0f3[_0x442d('0x28')](_0x260324);return _0x4ab0f3[_0x442d('0x2c')]('Content-Range',_0x3eb191+'-'+_0x376cc5+'/'+_0x183204)['json'](_0x128de5);}return null;};}function patchUpdates(_0xae508e){return function(_0x7e69e7){try{jsonpatch['apply'](_0x7e69e7,_0xae508e,!![]);}catch(_0x2a794e){return BPromise[_0x442d('0x2d')](_0x2a794e);}return _0x7e69e7[_0x442d('0x2e')]();};}function saveUpdates(_0x4dcb2a,_0x541216){return function(_0x1dd526){if(_0x1dd526){return _0x1dd526[_0x442d('0x2f')](_0x4dcb2a)['then'](function(_0x3b68e5){return _0x3b68e5;});}return null;};}function removeEntity(_0x881c88,_0x2722bf){return function(_0xb632f1){if(_0xb632f1){return _0xb632f1[_0x442d('0x30')]()[_0x442d('0x1e')](function(){_0x881c88[_0x442d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a3f0,_0x42e22e){return function(_0x153ebe){if(!_0x153ebe){_0x49a3f0[_0x442d('0x27')](0x194);}return _0x153ebe;};}function handleError(_0x40bb13,_0x76d888){_0x76d888=_0x76d888||0x1f4;return function(_0x7739f9){logger[_0x442d('0x24')](_0x7739f9[_0x442d('0x31')]);if(_0x7739f9[_0x442d('0x32')]){delete _0x7739f9[_0x442d('0x32')];}_0x40bb13[_0x442d('0x28')](_0x76d888)[_0x442d('0x33')](_0x7739f9);};}exports[_0x442d('0x34')]=function(_0x3bb9fe,_0x5a8145){var _0x3bb2c6={},_0x527b1a={},_0x3e035f={'count':0x0,'rows':[]};var _0x3e3ebe=_[_0x442d('0x35')](db[_0x442d('0x36')]['rawAttributes'],function(_0x5d46d1){return{'name':_0x5d46d1[_0x442d('0x37')],'type':_0x5d46d1[_0x442d('0x38')][_0x442d('0x39')]};});_0x527b1a[_0x442d('0x3a')]=_[_0x442d('0x35')](_0x3e3ebe,_0x442d('0x32'));_0x527b1a[_0x442d('0x3b')]=_[_0x442d('0x3c')](_0x3bb9fe[_0x442d('0x3b')]);_0x527b1a[_0x442d('0x3d')]=_['intersection'](_0x527b1a['model'],_0x527b1a[_0x442d('0x3b')]);_0x3bb2c6[_0x442d('0x3e')]=_[_0x442d('0x3f')](_0x527b1a[_0x442d('0x3a')],qs['fields'](_0x3bb9fe['query'][_0x442d('0x40')]));_0x3bb2c6[_0x442d('0x3e')]=_0x3bb2c6[_0x442d('0x3e')][_0x442d('0x41')]?_0x3bb2c6['attributes']:_0x527b1a[_0x442d('0x3a')];if(!_0x3bb9fe[_0x442d('0x3b')]['hasOwnProperty'](_0x442d('0x42'))){_0x3bb2c6[_0x442d('0x2b')]=qs['limit'](_0x3bb9fe[_0x442d('0x3b')][_0x442d('0x2b')]);_0x3bb2c6['offset']=qs['offset'](_0x3bb9fe[_0x442d('0x3b')][_0x442d('0x43')]);}_0x3bb2c6[_0x442d('0x44')]=qs[_0x442d('0x45')](_0x3bb9fe[_0x442d('0x3b')][_0x442d('0x45')]);_0x3bb2c6[_0x442d('0x46')]=qs['filters'](_[_0x442d('0x47')](_0x3bb9fe[_0x442d('0x3b')],_0x527b1a[_0x442d('0x3d')]),_0x3e3ebe);if(_0x3bb9fe['query'][_0x442d('0x48')]){_0x3bb2c6[_0x442d('0x46')]=_[_0x442d('0x49')](_0x3bb2c6['where'],{'$or':_[_0x442d('0x35')](_0x3e3ebe,function(_0xf07108){if(_0xf07108[_0x442d('0x38')]!==_0x442d('0x4a')){var _0x3365c0={};_0x3365c0[_0xf07108[_0x442d('0x32')]]={'$like':'%'+_0x3bb9fe[_0x442d('0x3b')][_0x442d('0x48')]+'%'};return _0x3365c0;}})});}_0x3bb2c6=_[_0x442d('0x49')]({},_0x3bb2c6,_0x3bb9fe[_0x442d('0x4b')]);var _0x248cb0={'where':_0x3bb2c6[_0x442d('0x46')]};return db[_0x442d('0x36')][_0x442d('0x4c')](_0x248cb0)['then'](function(_0x5439a5){_0x3e035f['count']=_0x5439a5;if(_0x3bb9fe[_0x442d('0x3b')]['includeAll']){_0x3bb2c6['include']=[{'all':!![]}];}return db[_0x442d('0x36')][_0x442d('0x4d')](_0x3bb2c6);})[_0x442d('0x1e')](function(_0x2d865e){_0x3e035f[_0x442d('0x4e')]=_0x2d865e;return _0x3e035f;})[_0x442d('0x1e')](respondWithFilteredResult(_0x5a8145,_0x3bb2c6))[_0x442d('0x4f')](handleError(_0x5a8145,null));};exports[_0x442d('0x50')]=function(_0xd97d98,_0xb7bfcf){var _0x4ff946={'raw':![],'where':{'id':_0xd97d98['params']['id']}},_0x20ee94={};_0x20ee94[_0x442d('0x3a')]=_[_0x442d('0x3c')](db[_0x442d('0x36')][_0x442d('0x51')]);_0x20ee94['query']=_[_0x442d('0x3c')](_0xd97d98['query']);_0x20ee94['filters']=_[_0x442d('0x3f')](_0x20ee94[_0x442d('0x3a')],_0x20ee94['query']);_0x4ff946['attributes']=_[_0x442d('0x3f')](_0x20ee94[_0x442d('0x3a')],qs[_0x442d('0x40')](_0xd97d98[_0x442d('0x3b')]['fields']));_0x4ff946[_0x442d('0x3e')]=_0x4ff946[_0x442d('0x3e')][_0x442d('0x41')]?_0x4ff946['attributes']:_0x20ee94['model'];if(_0xd97d98['query']['includeAll']){_0x4ff946['include']=[{'all':!![]}];}_0x4ff946=_[_0x442d('0x49')]({},_0x4ff946,_0xd97d98[_0x442d('0x4b')]);return db[_0x442d('0x36')]['find'](_0x4ff946)[_0x442d('0x1e')](handleEntityNotFound(_0xb7bfcf,null))['then'](respondWithResult(_0xb7bfcf,null))['catch'](handleError(_0xb7bfcf,null));};exports[_0x442d('0x52')]=function(_0x191fd5,_0x29ffbd){return db[_0x442d('0x36')][_0x442d('0x52')](_0x191fd5['body'],{})[_0x442d('0x1e')](respondWithResult(_0x29ffbd,0xc9))['catch'](handleError(_0x29ffbd,null));};exports[_0x442d('0x2f')]=function(_0x4b9b0f,_0xe7fd0d){if(_0x4b9b0f[_0x442d('0x53')]['id']){delete _0x4b9b0f[_0x442d('0x53')]['id'];}return db[_0x442d('0x36')][_0x442d('0x54')]({'where':{'id':_0x4b9b0f['params']['id']}})['then'](handleEntityNotFound(_0xe7fd0d,null))[_0x442d('0x1e')](saveUpdates(_0x4b9b0f[_0x442d('0x53')],null))[_0x442d('0x1e')](respondWithResult(_0xe7fd0d,null))['catch'](handleError(_0xe7fd0d,null));};exports[_0x442d('0x30')]=function(_0x47ff80,_0x3d4d3b){return db[_0x442d('0x36')][_0x442d('0x54')]({'where':{'id':_0x47ff80['params']['id']}})[_0x442d('0x1e')](handleEntityNotFound(_0x3d4d3b,null))['then'](removeEntity(_0x3d4d3b,null))['catch'](handleError(_0x3d4d3b,null));};exports[_0x442d('0x55')]=function(_0x31e35a,_0x438422,_0x2d1567){var _0x160aaf={};var _0x36c691={};var _0x4b3ef0;var _0x4b6208;return db[_0x442d('0x36')][_0x442d('0x56')]({'where':{'id':_0x31e35a[_0x442d('0x57')]['id']}})['then'](handleEntityNotFound(_0x438422,null))['then'](function(_0x36808f){if(_0x36808f){_0x4b3ef0=_0x36808f;_0x36c691[_0x442d('0x3a')]=_['keys'](db[_0x442d('0x58')]['rawAttributes']);_0x36c691[_0x442d('0x3b')]=_[_0x442d('0x3c')](_0x31e35a[_0x442d('0x3b')]);_0x36c691[_0x442d('0x3d')]=_[_0x442d('0x3f')](_0x36c691[_0x442d('0x3a')],_0x36c691[_0x442d('0x3b')]);_0x160aaf['attributes']=_['intersection'](_0x36c691['model'],qs[_0x442d('0x40')](_0x31e35a[_0x442d('0x3b')]['fields']));_0x160aaf[_0x442d('0x3e')]=_0x160aaf[_0x442d('0x3e')][_0x442d('0x41')]?_0x160aaf['attributes']:_0x36c691['model'];_0x160aaf[_0x442d('0x44')]=qs[_0x442d('0x45')](_0x31e35a[_0x442d('0x3b')][_0x442d('0x45')]);_0x160aaf[_0x442d('0x46')]=qs[_0x442d('0x3d')](_[_0x442d('0x47')](_0x31e35a['query'],_0x36c691[_0x442d('0x3d')]));if(_0x31e35a[_0x442d('0x3b')]['filter']){_0x160aaf['where']=_[_0x442d('0x49')](_0x160aaf[_0x442d('0x46')],{'$or':_[_0x442d('0x35')](_0x160aaf['attributes'],function(_0x5444bc){var _0x40b5cb={};_0x40b5cb[_0x5444bc]={'$like':'%'+_0x31e35a[_0x442d('0x3b')][_0x442d('0x48')]+'%'};return _0x40b5cb;})});}_0x160aaf=_[_0x442d('0x49')]({},_0x160aaf,_0x31e35a[_0x442d('0x4b')]);return _0x4b3ef0[_0x442d('0x55')](_0x160aaf);}})[_0x442d('0x1e')](function(_0x599182){if(_0x599182){_0x4b6208=_0x599182['length'];if(!_0x31e35a[_0x442d('0x3b')][_0x442d('0x59')](_0x442d('0x42'))){_0x160aaf['limit']=qs[_0x442d('0x2b')](_0x31e35a['query'][_0x442d('0x2b')]);_0x160aaf[_0x442d('0x43')]=qs[_0x442d('0x43')](_0x31e35a[_0x442d('0x3b')][_0x442d('0x43')]);}return _0x4b3ef0['getConfigurations'](_0x160aaf);}})[_0x442d('0x1e')](function(_0x17d2e2){if(_0x17d2e2){return _0x17d2e2?{'count':_0x4b6208,'rows':_0x17d2e2}:null;}})[_0x442d('0x1e')](respondWithResult(_0x438422,null))[_0x442d('0x4f')](handleError(_0x438422,null));};exports[_0x442d('0x5a')]=function(_0x805cad,_0x58b7fc,_0x4bda65){if(_0x805cad[_0x442d('0x53')]['id']){delete _0x805cad[_0x442d('0x53')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x805cad[_0x442d('0x57')]['id']}})['then'](handleEntityNotFound(_0x58b7fc,null))[_0x442d('0x1e')](function(_0x56de62){if(_0x56de62){_0x805cad[_0x442d('0x53')]['AccountId']=_0x56de62['id'];_0x805cad[_0x442d('0x53')][_0x442d('0x5b')]=integrations[_0x442d('0x5c')](_0x805cad[_0x442d('0x53')][_0x442d('0x5d')],_0x805cad[_0x442d('0x53')][_0x442d('0x38')]);_0x805cad[_0x442d('0x53')][_0x442d('0x5e')]=integrations[_0x442d('0x5f')](_0x805cad[_0x442d('0x53')][_0x442d('0x5d')],_0x805cad['body'][_0x442d('0x38')]);return db['SalesforceConfiguration'][_0x442d('0x52')](_0x805cad[_0x442d('0x53')],{'include':[{'model':db[_0x442d('0x60')],'as':_0x442d('0x5b')},{'model':db[_0x442d('0x60')],'as':_0x442d('0x5e')}]});}return null;})[_0x442d('0x1e')](respondWithResult(_0x58b7fc,null))[_0x442d('0x4f')](handleError(_0x58b7fc,null));};exports['getFields']=function(_0x45a2b3,_0x66ea16,_0x5e756a){var _0x46ed53;var _0x16a0cc='';var _0x25c63a=_0x442d('0x61');return db['SalesforceAccount']['findOne']({'where':{'id':_0x45a2b3['params']['id']},'attributes':['id',_0x442d('0x62'),'clientId','clientSecret',_0x442d('0x63'),'password',_0x442d('0x64')]})[_0x442d('0x1e')](handleEntityNotFound(_0x66ea16,null))['then'](function(_0xed39eb){if(_0xed39eb){_0x16a0cc=_0xed39eb[_0x442d('0x62')];var _0x223f59=_0x16a0cc['slice'](-0x1);if(_0x223f59==='/'){_0x16a0cc=_0x16a0cc['substring'](0x0,_0x16a0cc['lastIndexOf'](_0x223f59));}_0x46ed53=new jsforce[(_0x442d('0x65'))]({'oauth2':{'loginUrl':_0x16a0cc,'clientId':_0xed39eb['clientId'],'clientSecret':_0xed39eb[_0x442d('0x66')]}});return _0x46ed53[_0x442d('0x67')](_0xed39eb['username'],_0xed39eb[_0x442d('0x68')][_0x442d('0x69')](_0xed39eb[_0x442d('0x64')]));}})[_0x442d('0x1e')](function(_0x2c7328){if(_0x2c7328){if(!_[_0x442d('0x6a')](_0x45a2b3[_0x442d('0x3b')][_0x442d('0x6b')])){_0x25c63a=_0x45a2b3[_0x442d('0x3b')]['ticketType'];}return _0x46ed53[_0x442d('0x6c')](_0x25c63a)[_0x442d('0x6d')]();}})['then'](function(_0x10f793){var _0x5734f2=[_0x442d('0x6e'),'CallDurationInSeconds',_0x442d('0x6f'),'CallType',_0x442d('0x70'),_0x442d('0x71'),'Status',_0x442d('0x72')];if(!_[_0x442d('0x6a')](_0x45a2b3['query'][_0x442d('0x6b')])&&_0x45a2b3[_0x442d('0x3b')][_0x442d('0x6b')]===_0x442d('0x73')){_0x5734f2=[_0x442d('0x72'),'Origin',_0x442d('0x74'),'Status',_0x442d('0x71'),_0x442d('0x75'),'SuppliedName',_0x442d('0x76')];}if(_0x10f793){_[_0x442d('0x77')](_0x10f793[_0x442d('0x40')],function(_0x476e3b){return _0x476e3b['custom']===![]&&!_0x5734f2[_0x442d('0x78')](_0x476e3b['name']);});return{'count':_0x10f793['fields'][_0x442d('0x41')],'rows':_[_0x442d('0x35')](_0x10f793[_0x442d('0x40')],function(_0xa9f1bc){return{'id':_0xa9f1bc['name'],'name':_0xa9f1bc[_0x442d('0x79')],'custom':_0xa9f1bc['custom'],'options':_0xa9f1bc[_0x442d('0x7a')][_0x442d('0x41')]>0x0?_[_0x442d('0x35')](_0xa9f1bc['picklistValues'],function(_0x58a556){return{'name':_0x58a556['label'],'value':_0x58a556['value']};}):_0xa9f1bc[_0x442d('0x38')]=='boolean'?[{'name':'True','value':'true'},{'name':_0x442d('0x7b'),'value':'false'}]:[]};})};}})[_0x442d('0x1e')](respondWithResult(_0x66ea16,null))[_0x442d('0x4f')](function(_0x2f9bf2){var _0x1b3cc9=_0x45a2b3[_0x442d('0x3b')][_0x442d('0x19')]?0x1f4:_0x2f9bf2[_0x442d('0x7c')]||0x1f4;logger[_0x442d('0x24')](_0x442d('0x7d'),_0x442d('0x7e'),_0x1b3cc9,JSON['stringify'](_0x2f9bf2));delete _0x2f9bf2[_0x442d('0x32')];if(_0x1b3cc9===0x191){_0x1b3cc9=0x190;}_0x66ea16[_0x442d('0x28')](_0x1b3cc9)[_0x442d('0x33')](_0x45a2b3[_0x442d('0x3b')][_0x442d('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x2f9bf2['statusCode']}:_0x2f9bf2);});}; \ No newline at end of file +var _0x503a=['ValidationError','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','destroy','stack','name','send','index','SalesforceAccount','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','login','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','Type','Case','Origin','Status','Priority','SuppliedName','SuppliedCompany','remove','custom','picklistValues','label','value','true','False','false','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','Sequelize'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x503a,0x69));var _0xa503=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x503a[_0x56fe98];return _0x212f4f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa503('0x0'));var zipdir=require(_0xa503('0x1'));var jsonpatch=require(_0xa503('0x2'));var rp=require(_0xa503('0x3'));var moment=require(_0xa503('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa503('0x5'));var util=require(_0xa503('0x6'));var path=require('path');var sox=require(_0xa503('0x7'));var csv=require(_0xa503('0x8'));var ejs=require(_0xa503('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa503('0xa'));var crypto=require(_0xa503('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa503('0xc'));var Redis=require(_0xa503('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa503('0xe'));var hardwareService=require(_0xa503('0xf'));var logger=require(_0xa503('0x10'))(_0xa503('0x11'));var utils=require(_0xa503('0x12'));var config=require(_0xa503('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xa503('0x14')][_0xa503('0x15')]({'port':0x232a});function checkPasswordPattern(_0x5dd57d,_0x8ca512,_0x14178a){if(_0x14178a){var _0x27cf46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27cf46['test'](_0x8ca512)){return _0x5dd57d;}else{throw new db[(_0xa503('0x16'))][(_0xa503('0x17'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5dd57d;}}function respondWithRpcPromise(_0x4c8163,_0x578851,_0x2b2935,_0x1a10da){return new BPromise(function(_0x29bd7c,_0x58b457){var _0x15a0a1=_0x1a10da||client;return _0x15a0a1['request'](_0x4c8163,_0x2b2935)[_0xa503('0x18')](function(_0x314423){logger[_0xa503('0x19')](_0xa503('0x1a'),_0x578851,_0xa503('0x1b'));logger[_0xa503('0x1c')](_0xa503('0x1d'),_0x578851,_0xa503('0x1b'),JSON[_0xa503('0x1e')](_0x314423));if(_0x314423[_0xa503('0x1f')]){if(_0x314423[_0xa503('0x1f')][_0xa503('0x20')]===0x1f4){logger[_0xa503('0x1f')](_0xa503('0x1a'),_0x578851,_0x314423[_0xa503('0x1f')][_0xa503('0x21')]);return _0x58b457(_0x314423[_0xa503('0x1f')]['message']);}logger['error'](_0xa503('0x1a'),_0x578851,_0x314423['error'][_0xa503('0x21')]);return _0x29bd7c(_0x314423['error'][_0xa503('0x21')]);}else{logger[_0xa503('0x19')](_0xa503('0x1a'),_0x578851,_0xa503('0x1b'));_0x29bd7c(_0x314423[_0xa503('0x22')]['message']);}})[_0xa503('0x23')](function(_0x1c6c4e){logger[_0xa503('0x1f')](_0xa503('0x1a'),_0x578851,_0x1c6c4e);_0x58b457(_0x1c6c4e);});});}function respondWithStatusCode(_0x25dc0a,_0x26da93){_0x26da93=_0x26da93||0xcc;return function(_0x2ed708){if(_0x2ed708){return _0x25dc0a[_0xa503('0x24')](_0x26da93);}return _0x25dc0a[_0xa503('0x25')](_0x26da93)[_0xa503('0x26')]();};}function respondWithResult(_0x3ae527,_0x3a63be){_0x3a63be=_0x3a63be||0xc8;return function(_0x5e6559){if(_0x5e6559){return _0x3ae527[_0xa503('0x25')](_0x3a63be)[_0xa503('0x27')](_0x5e6559);}};}function respondWithFilteredResult(_0xf835aa,_0x4dbb67){return function(_0x283fc0){if(_0x283fc0){var _0x15c93a=_0x283fc0[_0xa503('0x28')],_0x1cb870=_0x4dbb67[_0xa503('0x29')],_0x2fe1ee=_0x4dbb67[_0xa503('0x29')]+_0x4dbb67['limit'],_0x4fbc5f;if(_0x2fe1ee>=_0x15c93a){_0x2fe1ee=_0x15c93a;_0x4fbc5f=0xc8;}else{_0x4fbc5f=0xce;}_0xf835aa[_0xa503('0x25')](_0x4fbc5f);return _0xf835aa[_0xa503('0x2a')](_0xa503('0x2b'),_0x1cb870+'-'+_0x2fe1ee+'/'+_0x15c93a)[_0xa503('0x27')](_0x283fc0);}return null;};}function patchUpdates(_0x924c83){return function(_0x2fe13e){try{jsonpatch['apply'](_0x2fe13e,_0x924c83,!![]);}catch(_0x1f50b2){return BPromise[_0xa503('0x2c')](_0x1f50b2);}return _0x2fe13e['save']();};}function saveUpdates(_0x414dc7,_0x4c3968){return function(_0x39ccc4){if(_0x39ccc4){return _0x39ccc4[_0xa503('0x2d')](_0x414dc7)[_0xa503('0x18')](function(_0x5aeb27){return _0x5aeb27;});}return null;};}function removeEntity(_0x5d0325,_0x15fb4c){return function(_0x207ebe){if(_0x207ebe){return _0x207ebe[_0xa503('0x2e')]()['then'](function(){_0x5d0325[_0xa503('0x25')](0xcc)[_0xa503('0x26')]();});}};}function handleEntityNotFound(_0x4b0a16,_0x5722fd){return function(_0x3612f4){if(!_0x3612f4){_0x4b0a16[_0xa503('0x24')](0x194);}return _0x3612f4;};}function handleError(_0xfefe0f,_0x5c5516){_0x5c5516=_0x5c5516||0x1f4;return function(_0x2f31c4){logger['error'](_0x2f31c4[_0xa503('0x2f')]);if(_0x2f31c4[_0xa503('0x30')]){delete _0x2f31c4[_0xa503('0x30')];}_0xfefe0f[_0xa503('0x25')](_0x5c5516)[_0xa503('0x31')](_0x2f31c4);};}exports[_0xa503('0x32')]=function(_0x3dc1d1,_0x54b945){var _0x3e0068={},_0x158b9b={},_0x508776={'count':0x0,'rows':[]};var _0x5e1b29=_['map'](db[_0xa503('0x33')]['rawAttributes'],function(_0x4f666a){return{'name':_0x4f666a[_0xa503('0x34')],'type':_0x4f666a[_0xa503('0x35')]['key']};});_0x158b9b[_0xa503('0x36')]=_[_0xa503('0x37')](_0x5e1b29,_0xa503('0x30'));_0x158b9b['query']=_[_0xa503('0x38')](_0x3dc1d1['query']);_0x158b9b[_0xa503('0x39')]=_[_0xa503('0x3a')](_0x158b9b['model'],_0x158b9b[_0xa503('0x3b')]);_0x3e0068[_0xa503('0x3c')]=_[_0xa503('0x3a')](_0x158b9b[_0xa503('0x36')],qs[_0xa503('0x3d')](_0x3dc1d1[_0xa503('0x3b')][_0xa503('0x3d')]));_0x3e0068[_0xa503('0x3c')]=_0x3e0068[_0xa503('0x3c')][_0xa503('0x3e')]?_0x3e0068[_0xa503('0x3c')]:_0x158b9b[_0xa503('0x36')];if(!_0x3dc1d1[_0xa503('0x3b')][_0xa503('0x3f')](_0xa503('0x40'))){_0x3e0068[_0xa503('0x41')]=qs[_0xa503('0x41')](_0x3dc1d1['query']['limit']);_0x3e0068[_0xa503('0x29')]=qs['offset'](_0x3dc1d1[_0xa503('0x3b')]['offset']);}_0x3e0068[_0xa503('0x42')]=qs[_0xa503('0x43')](_0x3dc1d1[_0xa503('0x3b')][_0xa503('0x43')]);_0x3e0068[_0xa503('0x44')]=qs['filters'](_['pick'](_0x3dc1d1[_0xa503('0x3b')],_0x158b9b[_0xa503('0x39')]),_0x5e1b29);if(_0x3dc1d1[_0xa503('0x3b')][_0xa503('0x45')]){_0x3e0068[_0xa503('0x44')]=_['merge'](_0x3e0068[_0xa503('0x44')],{'$or':_['map'](_0x5e1b29,function(_0x1df706){if(_0x1df706[_0xa503('0x35')]!==_0xa503('0x46')){var _0x3587ba={};_0x3587ba[_0x1df706[_0xa503('0x30')]]={'$like':'%'+_0x3dc1d1['query'][_0xa503('0x45')]+'%'};return _0x3587ba;}})});}_0x3e0068=_[_0xa503('0x47')]({},_0x3e0068,_0x3dc1d1[_0xa503('0x48')]);var _0x59cf30={'where':_0x3e0068[_0xa503('0x44')]};return db['SalesforceAccount']['count'](_0x59cf30)['then'](function(_0x1c73e7){_0x508776[_0xa503('0x28')]=_0x1c73e7;if(_0x3dc1d1[_0xa503('0x3b')]['includeAll']){_0x3e0068[_0xa503('0x49')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xa503('0x4a')](_0x3e0068);})['then'](function(_0x1b4593){_0x508776['rows']=_0x1b4593;return _0x508776;})[_0xa503('0x18')](respondWithFilteredResult(_0x54b945,_0x3e0068))['catch'](handleError(_0x54b945,null));};exports['show']=function(_0x56ab1e,_0x55e36e){var _0x4f4719={'raw':![],'where':{'id':_0x56ab1e[_0xa503('0x4b')]['id']}},_0x19ceda={};_0x19ceda[_0xa503('0x36')]=_[_0xa503('0x38')](db['SalesforceAccount'][_0xa503('0x4c')]);_0x19ceda['query']=_[_0xa503('0x38')](_0x56ab1e[_0xa503('0x3b')]);_0x19ceda[_0xa503('0x39')]=_[_0xa503('0x3a')](_0x19ceda[_0xa503('0x36')],_0x19ceda[_0xa503('0x3b')]);_0x4f4719[_0xa503('0x3c')]=_['intersection'](_0x19ceda[_0xa503('0x36')],qs['fields'](_0x56ab1e[_0xa503('0x3b')][_0xa503('0x3d')]));_0x4f4719[_0xa503('0x3c')]=_0x4f4719[_0xa503('0x3c')][_0xa503('0x3e')]?_0x4f4719['attributes']:_0x19ceda['model'];if(_0x56ab1e[_0xa503('0x3b')][_0xa503('0x4d')]){_0x4f4719[_0xa503('0x49')]=[{'all':!![]}];}_0x4f4719=_[_0xa503('0x47')]({},_0x4f4719,_0x56ab1e['options']);return db[_0xa503('0x33')][_0xa503('0x4e')](_0x4f4719)[_0xa503('0x18')](handleEntityNotFound(_0x55e36e,null))[_0xa503('0x18')](respondWithResult(_0x55e36e,null))[_0xa503('0x23')](handleError(_0x55e36e,null));};exports[_0xa503('0x4f')]=function(_0x2bf0fe,_0x424793){return db[_0xa503('0x33')][_0xa503('0x4f')](_0x2bf0fe[_0xa503('0x50')],{})[_0xa503('0x18')](respondWithResult(_0x424793,0xc9))[_0xa503('0x23')](handleError(_0x424793,null));};exports[_0xa503('0x2d')]=function(_0x18f52b,_0x28131c){if(_0x18f52b[_0xa503('0x50')]['id']){delete _0x18f52b[_0xa503('0x50')]['id'];}return db[_0xa503('0x33')][_0xa503('0x4e')]({'where':{'id':_0x18f52b[_0xa503('0x4b')]['id']}})[_0xa503('0x18')](handleEntityNotFound(_0x28131c,null))['then'](saveUpdates(_0x18f52b[_0xa503('0x50')],null))[_0xa503('0x18')](respondWithResult(_0x28131c,null))['catch'](handleError(_0x28131c,null));};exports[_0xa503('0x2e')]=function(_0x81ed6c,_0xeeb006){return db[_0xa503('0x33')][_0xa503('0x4e')]({'where':{'id':_0x81ed6c[_0xa503('0x4b')]['id']}})[_0xa503('0x18')](handleEntityNotFound(_0xeeb006,null))['then'](removeEntity(_0xeeb006,null))['catch'](handleError(_0xeeb006,null));};exports[_0xa503('0x51')]=function(_0x4c4728,_0x4855c0,_0xde5ac4){var _0x321558={};var _0x29e7e4={};var _0x368467;var _0x1c8929;return db['SalesforceAccount'][_0xa503('0x52')]({'where':{'id':_0x4c4728[_0xa503('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4855c0,null))[_0xa503('0x18')](function(_0x5b22ae){if(_0x5b22ae){_0x368467=_0x5b22ae;_0x29e7e4[_0xa503('0x36')]=_[_0xa503('0x38')](db[_0xa503('0x53')][_0xa503('0x4c')]);_0x29e7e4['query']=_[_0xa503('0x38')](_0x4c4728['query']);_0x29e7e4['filters']=_[_0xa503('0x3a')](_0x29e7e4[_0xa503('0x36')],_0x29e7e4[_0xa503('0x3b')]);_0x321558[_0xa503('0x3c')]=_['intersection'](_0x29e7e4[_0xa503('0x36')],qs[_0xa503('0x3d')](_0x4c4728[_0xa503('0x3b')][_0xa503('0x3d')]));_0x321558['attributes']=_0x321558[_0xa503('0x3c')][_0xa503('0x3e')]?_0x321558[_0xa503('0x3c')]:_0x29e7e4['model'];_0x321558[_0xa503('0x42')]=qs['sort'](_0x4c4728['query'][_0xa503('0x43')]);_0x321558['where']=qs[_0xa503('0x39')](_[_0xa503('0x54')](_0x4c4728[_0xa503('0x3b')],_0x29e7e4['filters']));if(_0x4c4728[_0xa503('0x3b')][_0xa503('0x45')]){_0x321558[_0xa503('0x44')]=_[_0xa503('0x47')](_0x321558[_0xa503('0x44')],{'$or':_[_0xa503('0x37')](_0x321558['attributes'],function(_0x216c21){var _0xbaf7a7={};_0xbaf7a7[_0x216c21]={'$like':'%'+_0x4c4728[_0xa503('0x3b')][_0xa503('0x45')]+'%'};return _0xbaf7a7;})});}_0x321558=_[_0xa503('0x47')]({},_0x321558,_0x4c4728['options']);return _0x368467[_0xa503('0x51')](_0x321558);}})[_0xa503('0x18')](function(_0x11e4b9){if(_0x11e4b9){_0x1c8929=_0x11e4b9[_0xa503('0x3e')];if(!_0x4c4728[_0xa503('0x3b')][_0xa503('0x3f')](_0xa503('0x40'))){_0x321558[_0xa503('0x41')]=qs['limit'](_0x4c4728[_0xa503('0x3b')]['limit']);_0x321558['offset']=qs[_0xa503('0x29')](_0x4c4728['query']['offset']);}return _0x368467['getConfigurations'](_0x321558);}})[_0xa503('0x18')](function(_0x3de23b){if(_0x3de23b){return _0x3de23b?{'count':_0x1c8929,'rows':_0x3de23b}:null;}})['then'](respondWithResult(_0x4855c0,null))[_0xa503('0x23')](handleError(_0x4855c0,null));};exports[_0xa503('0x55')]=function(_0x543dc9,_0x2b5043,_0x275503){if(_0x543dc9['body']['id']){delete _0x543dc9[_0xa503('0x50')]['id'];}return db['SalesforceAccount'][_0xa503('0x52')]({'where':{'id':_0x543dc9[_0xa503('0x4b')]['id']}})[_0xa503('0x18')](handleEntityNotFound(_0x2b5043,null))['then'](function(_0x1147b7){if(_0x1147b7){_0x543dc9[_0xa503('0x50')][_0xa503('0x56')]=_0x1147b7['id'];_0x543dc9[_0xa503('0x50')][_0xa503('0x57')]=integrations[_0xa503('0x58')](_0x543dc9[_0xa503('0x50')][_0xa503('0x59')],_0x543dc9[_0xa503('0x50')][_0xa503('0x35')]);_0x543dc9[_0xa503('0x50')][_0xa503('0x5a')]=integrations['getDescriptions'](_0x543dc9[_0xa503('0x50')][_0xa503('0x59')],_0x543dc9[_0xa503('0x50')][_0xa503('0x35')]);return db[_0xa503('0x53')][_0xa503('0x4f')](_0x543dc9[_0xa503('0x50')],{'include':[{'model':db[_0xa503('0x5b')],'as':_0xa503('0x57')},{'model':db[_0xa503('0x5b')],'as':_0xa503('0x5a')}]});}return null;})[_0xa503('0x18')](respondWithResult(_0x2b5043,null))[_0xa503('0x23')](handleError(_0x2b5043,null));};exports[_0xa503('0x5c')]=function(_0x3ce44e,_0x138888,_0x215977){var _0x1d8387;var _0x135a89='';var _0x2735be='Task';return db['SalesforceAccount'][_0xa503('0x52')]({'where':{'id':_0x3ce44e[_0xa503('0x4b')]['id']},'attributes':['id',_0xa503('0x5d'),_0xa503('0x5e'),'clientSecret',_0xa503('0x5f'),_0xa503('0x60'),_0xa503('0x61')]})[_0xa503('0x18')](handleEntityNotFound(_0x138888,null))['then'](function(_0x564918){if(_0x564918){_0x135a89=_0x564918[_0xa503('0x5d')];var _0x1a6088=_0x135a89['slice'](-0x1);if(_0x1a6088==='/'){_0x135a89=_0x135a89[_0xa503('0x62')](0x0,_0x135a89[_0xa503('0x63')](_0x1a6088));}_0x1d8387=new jsforce[(_0xa503('0x64'))]({'oauth2':{'loginUrl':_0x135a89,'clientId':_0x564918[_0xa503('0x5e')],'clientSecret':_0x564918[_0xa503('0x65')]}});return _0x1d8387[_0xa503('0x66')](_0x564918[_0xa503('0x5f')],_0x564918[_0xa503('0x60')]['concat'](_0x564918['securityToken']));}})[_0xa503('0x18')](function(_0x31cb38){if(_0x31cb38){if(!_[_0xa503('0x67')](_0x3ce44e['query'][_0xa503('0x68')])){_0x2735be=_0x3ce44e[_0xa503('0x3b')][_0xa503('0x68')];}return _0x1d8387[_0xa503('0x69')](_0x2735be)['describe']();}})[_0xa503('0x18')](function(_0x434fb1){var _0x347d58=[_0xa503('0x6a'),_0xa503('0x6b'),_0xa503('0x6c'),_0xa503('0x6d'),'IsArchived','Priority','Status',_0xa503('0x6e')];if(!_['isNil'](_0x3ce44e['query'][_0xa503('0x68')])&&_0x3ce44e[_0xa503('0x3b')][_0xa503('0x68')]===_0xa503('0x6f')){_0x347d58=[_0xa503('0x6e'),_0xa503('0x70'),'Reason',_0xa503('0x71'),_0xa503('0x72'),'IsEscalated',_0xa503('0x73'),_0xa503('0x74')];}if(_0x434fb1){_[_0xa503('0x75')](_0x434fb1['fields'],function(_0xab1fae){return _0xab1fae[_0xa503('0x76')]===![]&&!_0x347d58['includes'](_0xab1fae[_0xa503('0x30')]);});return{'count':_0x434fb1['fields'][_0xa503('0x3e')],'rows':_[_0xa503('0x37')](_0x434fb1[_0xa503('0x3d')],function(_0x14292){return{'id':_0x14292['name'],'name':_0x14292['label'],'custom':_0x14292['custom'],'options':_0x14292[_0xa503('0x77')][_0xa503('0x3e')]>0x0?_[_0xa503('0x37')](_0x14292[_0xa503('0x77')],function(_0x307f71){return{'name':_0x307f71[_0xa503('0x78')],'value':_0x307f71[_0xa503('0x79')]};}):_0x14292[_0xa503('0x35')]=='boolean'?[{'name':'True','value':_0xa503('0x7a')},{'name':_0xa503('0x7b'),'value':_0xa503('0x7c')}]:[]};})};}})[_0xa503('0x18')](respondWithResult(_0x138888,null))['catch'](function(_0x1a85c4){var _0x5ac678=_0x3ce44e[_0xa503('0x3b')][_0xa503('0x7d')]?0x1f4:_0x1a85c4[_0xa503('0x7e')]||0x1f4;logger[_0xa503('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xa503('0x5c'),_0x5ac678,JSON['stringify'](_0x1a85c4));delete _0x1a85c4[_0xa503('0x30')];if(_0x5ac678===0x191){_0x5ac678=0x190;}_0x138888[_0xa503('0x25')](_0x5ac678)[_0xa503('0x31')](_0x3ce44e['query']['test']?{'message':_0xa503('0x7f'),'statusCode':_0x1a85c4[_0xa503('0x7e')]}:_0x1a85c4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fdf0bb3..18011f5 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 _0x99a8=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x41b615,_0x4de4fc){var _0x51f162=function(_0x5c7d9c){while(--_0x5c7d9c){_0x41b615['push'](_0x41b615['shift']());}};_0x51f162(++_0x4de4fc);}(_0x99a8,0x74));var _0x899a=function(_0x36644f,_0x19738d){_0x36644f=_0x36644f-0x0;var _0x8de2f6=_0x99a8[_0x36644f];return _0x8de2f6;};'use strict';var _=require(_0x899a('0x0'));var util=require(_0x899a('0x1'));var logger=require(_0x899a('0x2'))(_0x899a('0x3'));var moment=require(_0x899a('0x4'));var BPromise=require(_0x899a('0x5'));var rp=require(_0x899a('0x6'));var fs=require('fs');var path=require(_0x899a('0x7'));var rimraf=require('rimraf');var config=require(_0x899a('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x899a('0x9')]=function(_0x7da9f7,_0x354eb5){return _0x7da9f7[_0x899a('0xa')](_0x899a('0xb'),attributes,{'tableName':_0x899a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2836=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x2e9987,_0x35d8b4){var _0x32c498=function(_0x5f05f7){while(--_0x5f05f7){_0x2e9987['push'](_0x2e9987['shift']());}};_0x32c498(++_0x35d8b4);}(_0x2836,0x1d9));var _0x6283=function(_0x13ccca,_0x261b32){_0x13ccca=_0x13ccca-0x0;var _0x41ae8f=_0x2836[_0x13ccca];return _0x41ae8f;};'use strict';var _=require(_0x6283('0x0'));var util=require(_0x6283('0x1'));var logger=require('../../config/logger')(_0x6283('0x2'));var moment=require(_0x6283('0x3'));var BPromise=require(_0x6283('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6283('0x5'));var rimraf=require(_0x6283('0x6'));var config=require(_0x6283('0x7'));var attributes=require(_0x6283('0x8'));var integrations=require(_0x6283('0x9'));module[_0x6283('0xa')]=function(_0x4078c7,_0x4c1343){return _0x4078c7[_0x6283('0xb')](_0x6283('0xc'),attributes,{'tableName':_0x6283('0xd'),'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 6a449ed..6e95113 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 _0xc788=['request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x15ddc2,_0x2e3d49){var _0x3dd0a4=function(_0x3a1993){while(--_0x3a1993){_0x15ddc2['push'](_0x15ddc2['shift']());}};_0x3dd0a4(++_0x2e3d49);}(_0xc788,0xc4));var _0x8c78=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0xc788[_0x4c9cc4];return _0x4384fb;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['SalesforceAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file +var _0xf290=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','findAll','options','raw','where','map','include','model','attributes','stringify','SalesforceAccount','ShowSalesforceAccount','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf290,0xde));var _0x0f29=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xf290[_0x224f65];return _0x3f921c;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['SalesforceAccount'][_0x0f29('0x15')]({'raw':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x17')]===undefined?!![]:![]:!![],'where':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x18')]||null:null,'attributes':_0x5d72a5['options']?_0x5d72a5[_0x0f29('0x16')]['attributes']||null:null,'limit':_0x5d72a5['options']?_0x5d72a5['options']['limit']||null:null,'include':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')]['include']?_[_0x0f29('0x19')](_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x1a')],function(_0x3402dc){return{'model':db[_0x3402dc[_0x0f29('0x1b')]],'as':_0x3402dc['as'],'attributes':_0x3402dc['attributes'],'include':_0x3402dc[_0x0f29('0x1a')]?_['map'](_0x3402dc[_0x0f29('0x1a')],function(_0x26f46f){return{'model':db[_0x26f46f[_0x0f29('0x1b')]],'as':_0x26f46f['as'],'attributes':_0x26f46f[_0x0f29('0x1c')],'include':_0x26f46f['include']?_[_0x0f29('0x19')](_0x26f46f['include'],function(_0x58b201){return{'model':db[_0x58b201[_0x0f29('0x1b')]],'as':_0x58b201['as'],'attributes':_0x58b201['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57dcc7){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger[_0x0f29('0xe')]('GetSalesforceAccount',_0x5d72a5,JSON[_0x0f29('0x1d')](_0x57dcc7));_0x4ca5e8(_0x57dcc7);})[_0x0f29('0x13')](function(_0x274c9d){logger['error']('GetSalesforceAccount',_0x274c9d[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994['error'](0x1f4,_0x274c9d[_0x0f29('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x526364){var _0x7b10f=this;return new Promise(function(_0x409b19,_0xf59431){return db[_0x0f29('0x1e')]['find']({'raw':_0x526364['options']?_0x526364[_0x0f29('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x526364['options']?_0x526364[_0x0f29('0x16')]['where']||null:null,'attributes':_0x526364[_0x0f29('0x16')]?_0x526364['options']['attributes']||null:null,'include':_0x526364[_0x0f29('0x16')]?_0x526364[_0x0f29('0x16')][_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x526364[_0x0f29('0x16')]['include'],function(_0x426a3e){return{'model':db[_0x426a3e['model']],'as':_0x426a3e['as'],'attributes':_0x426a3e[_0x0f29('0x1c')],'include':_0x426a3e[_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x426a3e[_0x0f29('0x1a')],function(_0x4852a5){return{'model':db[_0x4852a5[_0x0f29('0x1b')]],'as':_0x4852a5['as'],'attributes':_0x4852a5[_0x0f29('0x1c')],'include':_0x4852a5['include']?_[_0x0f29('0x19')](_0x4852a5[_0x0f29('0x1a')],function(_0x5e40ac){return{'model':db[_0x5e40ac['model']],'as':_0x5e40ac['as'],'attributes':_0x5e40ac[_0x0f29('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f29('0xa')](function(_0x3691d4){logger[_0x0f29('0xb')](_0x0f29('0x1f'),_0x526364);logger[_0x0f29('0xe')]('ShowSalesforceAccount',_0x526364,JSON[_0x0f29('0x1d')](_0x3691d4));_0x409b19(_0x3691d4);})['catch'](function(_0x331dc7){logger['error'](_0x0f29('0x1f'),_0x331dc7[_0x0f29('0x12')],_0x526364);_0xf59431(_0x7b10f[_0x0f29('0x10')](0x1f4,_0x331dc7['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f7ecaa5..754c212 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 _0x69c2=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id','update','delete','destroy','exports'];(function(_0x10d341,_0x57ff35){var _0xddc36d=function(_0x1c24f0){while(--_0x1c24f0){_0x10d341['push'](_0x10d341['shift']());}};_0xddc36d(++_0x57ff35);}(_0x69c2,0x187));var _0x269c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x69c2[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x269c('0x0'));var util=require(_0x269c('0x1'));var path=require(_0x269c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x269c('0x3')]();var auth=require(_0x269c('0x4'));var interaction=require(_0x269c('0x5'));var config=require(_0x269c('0x6'));var controller=require(_0x269c('0x7'));router['get']('/',auth[_0x269c('0x8')](),controller['index']);router['get']('/:id',auth[_0x269c('0x8')](),controller[_0x269c('0x9')]);router[_0x269c('0xa')](_0x269c('0xb'),auth[_0x269c('0x8')](),controller[_0x269c('0xc')]);router[_0x269c('0xa')](_0x269c('0xd'),auth[_0x269c('0x8')](),controller[_0x269c('0xe')]);router[_0x269c('0xa')](_0x269c('0xf'),auth['isAuthenticated'](),controller[_0x269c('0x10')]);router[_0x269c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x269c('0x12'),auth[_0x269c('0x8')](),controller[_0x269c('0x13')]);router[_0x269c('0x14')](_0x269c('0x12'),auth[_0x269c('0x8')](),controller[_0x269c('0x15')]);module[_0x269c('0x16')]=router; \ No newline at end of file +var _0xcf6f=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','/:id/descriptions'];(function(_0x41f3c9,_0x322ad9){var _0x3fd476=function(_0x2d8648){while(--_0x2d8648){_0x41f3c9['push'](_0x41f3c9['shift']());}};_0x3fd476(++_0x322ad9);}(_0xcf6f,0x1d4));var _0xfcf6=function(_0x20fc22,_0x4b8a15){_0x20fc22=_0x20fc22-0x0;var _0x4b7056=_0xcf6f[_0x20fc22];return _0x4b7056;};'use strict';var multer=require('multer');var util=require(_0xfcf6('0x0'));var path=require(_0xfcf6('0x1'));var timeout=require(_0xfcf6('0x2'));var express=require(_0xfcf6('0x3'));var router=express[_0xfcf6('0x4')]();var auth=require(_0xfcf6('0x5'));var interaction=require(_0xfcf6('0x6'));var config=require(_0xfcf6('0x7'));var controller=require(_0xfcf6('0x8'));router[_0xfcf6('0x9')]('/',auth[_0xfcf6('0xa')](),controller[_0xfcf6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfcf6('0x9')](_0xfcf6('0xc'),auth[_0xfcf6('0xa')](),controller['getFields']);router['get'](_0xfcf6('0xd'),auth[_0xfcf6('0xa')](),controller['getSubjects']);router[_0xfcf6('0x9')](_0xfcf6('0xe'),auth[_0xfcf6('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xfcf6('0xa')](),controller[_0xfcf6('0xf')]);router[_0xfcf6('0x10')]('/:id',auth[_0xfcf6('0xa')](),controller[_0xfcf6('0x11')]);router[_0xfcf6('0x12')]('/:id',auth[_0xfcf6('0xa')](),controller[_0xfcf6('0x13')]);module[_0xfcf6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 92fac0e..62442c0 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 _0xcd28=['exports','Task','Case','ENUM','contact_lead','lead','nothing','sequelize'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xcd28,0x17f));var _0x8cd2=function(_0x39cc57,_0x447477){_0x39cc57=_0x39cc57-0x0;var _0xdda7a0=_0xcd28[_0x39cc57];return _0xdda7a0;};'use strict';var Sequelize=require(_0x8cd2('0x0'));module[_0x8cd2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x8cd2('0x2'),_0x8cd2('0x3')),'defaultValue':_0x8cd2('0x2')},'moduleSearch':{'type':Sequelize[_0x8cd2('0x4')](_0x8cd2('0x5'),'contact',_0x8cd2('0x6')),'defaultValue':_0x8cd2('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x8cd2('0x7'),'contact','lead'),'defaultValue':_0x8cd2('0x6')}}; \ No newline at end of file +var _0x109b=['contact','lead','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x109b,0x125));var _0xb109=function(_0x5f5420,_0x34c3b5){_0x5f5420=_0x5f5420-0x0;var _0x38f3e9=_0x109b[_0x5f5420];return _0x38f3e9;};'use strict';var Sequelize=require(_0xb109('0x0'));module[_0xb109('0x1')]={'name':{'type':Sequelize[_0xb109('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xb109('0x3')](_0xb109('0x4'),_0xb109('0x5')),'defaultValue':_0xb109('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xb109('0x6'),_0xb109('0x7'),_0xb109('0x8')),'defaultValue':_0xb109('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0xb109('0x9'),_0xb109('0x7'),_0xb109('0x8')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 83bbed1..72babd6 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 _0x8343=['limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','update','findOne','SalesforceField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','set','Content-Range','reject','destroy','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8343,0xd7));var _0x3834=function(_0xfa0abc,_0x447aa1){_0xfa0abc=_0xfa0abc-0x0;var _0x26ab48=_0x8343[_0xfa0abc];return _0x26ab48;};'use strict';var pdf=require(_0x3834('0x0'));var emlformat=require(_0x3834('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3834('0x2'));var rp=require(_0x3834('0x3'));var moment=require('moment');var BPromise=require(_0x3834('0x4'));var Mustache=require(_0x3834('0x5'));var util=require('util');var path=require(_0x3834('0x6'));var sox=require(_0x3834('0x7'));var csv=require('to-csv');var ejs=require(_0x3834('0x8'));var fs=require('fs');var _=require(_0x3834('0x9'));var squel=require(_0x3834('0xa'));var crypto=require(_0x3834('0xb'));var jsforce=require(_0x3834('0xc'));var deskjs=require(_0x3834('0xd'));var toCsv=require(_0x3834('0xe'));var querystring=require(_0x3834('0xf'));var Papa=require(_0x3834('0x10'));var Redis=require(_0x3834('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3834('0x12'));var as=require(_0x3834('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3834('0x14'))(_0x3834('0x15'));var utils=require(_0x3834('0x16'));var config=require(_0x3834('0x17'));var db=require(_0x3834('0x18'))['db'];var jayson=require(_0x3834('0x19'));var client=jayson[_0x3834('0x1a')][_0x3834('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xf56a16,_0x274b69,_0xc5e699){if(_0xc5e699){var _0x3da837=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3da837[_0x3834('0x1c')](_0x274b69)){return _0xf56a16;}else{throw new db[(_0x3834('0x1d'))][(_0x3834('0x1e'))](_0x3834('0x1f'));}}else{return _0xf56a16;}}function respondWithRpcPromise(_0x58a17e,_0xb5a0c8,_0x227af2,_0x50da6e){return new BPromise(function(_0x113771,_0x55af8e){var _0x2e3691=_0x50da6e||client;return _0x2e3691['request'](_0x58a17e,_0x227af2)[_0x3834('0x20')](function(_0x3ec1b5){logger[_0x3834('0x21')](_0x3834('0x22'),_0xb5a0c8,_0x3834('0x23'));logger['debug'](_0x3834('0x24'),_0xb5a0c8,'request\x20sent',JSON['stringify'](_0x3ec1b5));if(_0x3ec1b5[_0x3834('0x25')]){if(_0x3ec1b5['error'][_0x3834('0x26')]===0x1f4){logger['error'](_0x3834('0x22'),_0xb5a0c8,_0x3ec1b5[_0x3834('0x25')]['message']);return _0x55af8e(_0x3ec1b5['error']['message']);}logger[_0x3834('0x25')](_0x3834('0x22'),_0xb5a0c8,_0x3ec1b5[_0x3834('0x25')]['message']);return _0x113771(_0x3ec1b5['error'][_0x3834('0x27')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xb5a0c8,_0x3834('0x23'));_0x113771(_0x3ec1b5[_0x3834('0x28')][_0x3834('0x27')]);}})[_0x3834('0x29')](function(_0x40f100){logger[_0x3834('0x25')]('SalesforceConfiguration,\x20%s,\x20%s',_0xb5a0c8,_0x40f100);_0x55af8e(_0x40f100);});});}function respondWithStatusCode(_0x196253,_0x16d9e1){_0x16d9e1=_0x16d9e1||0xcc;return function(_0x452d14){if(_0x452d14){return _0x196253[_0x3834('0x2a')](_0x16d9e1);}return _0x196253[_0x3834('0x2b')](_0x16d9e1)[_0x3834('0x2c')]();};}function respondWithResult(_0x59fc68,_0x2a8391){_0x2a8391=_0x2a8391||0xc8;return function(_0x3b88ba){if(_0x3b88ba){return _0x59fc68[_0x3834('0x2b')](_0x2a8391)[_0x3834('0x2d')](_0x3b88ba);}};}function respondWithFilteredResult(_0x1eca4d,_0x3e5d40){return function(_0x15173a){if(_0x15173a){var _0x361833=_0x15173a['count'],_0xcabdb3=_0x3e5d40['offset'],_0x2c5b24=_0x3e5d40['offset']+_0x3e5d40['limit'],_0x1fc1fa;if(_0x2c5b24>=_0x361833){_0x2c5b24=_0x361833;_0x1fc1fa=0xc8;}else{_0x1fc1fa=0xce;}_0x1eca4d[_0x3834('0x2b')](_0x1fc1fa);return _0x1eca4d[_0x3834('0x2e')](_0x3834('0x2f'),_0xcabdb3+'-'+_0x2c5b24+'/'+_0x361833)[_0x3834('0x2d')](_0x15173a);}return null;};}function patchUpdates(_0x1b568b){return function(_0x398a2a){try{jsonpatch['apply'](_0x398a2a,_0x1b568b,!![]);}catch(_0x5cfad1){return BPromise[_0x3834('0x30')](_0x5cfad1);}return _0x398a2a['save']();};}function saveUpdates(_0x23aa50,_0x55eb50){return function(_0x56cec8){if(_0x56cec8){return _0x56cec8['update'](_0x23aa50)[_0x3834('0x20')](function(_0x4aa2fc){return _0x4aa2fc;});}return null;};}function removeEntity(_0xcca1bb,_0x291e72){return function(_0x127abc){if(_0x127abc){return _0x127abc[_0x3834('0x31')]()[_0x3834('0x20')](function(){_0xcca1bb[_0x3834('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393cd2,_0x4780b0){return function(_0x505452){if(!_0x505452){_0x393cd2[_0x3834('0x2a')](0x194);}return _0x505452;};}function handleError(_0x257f26,_0xbb47dc){_0xbb47dc=_0xbb47dc||0x1f4;return function(_0xe56be8){logger[_0x3834('0x25')](_0xe56be8['stack']);if(_0xe56be8[_0x3834('0x32')]){delete _0xe56be8[_0x3834('0x32')];}_0x257f26[_0x3834('0x2b')](_0xbb47dc)[_0x3834('0x33')](_0xe56be8);};}exports[_0x3834('0x34')]=function(_0x22d07c,_0x2e0b9a){var _0x118171={},_0x3c8601={},_0x22cf61={'count':0x0,'rows':[]};var _0x4c6da6=_[_0x3834('0x35')](db[_0x3834('0x36')][_0x3834('0x37')],function(_0x5ed874){return{'name':_0x5ed874[_0x3834('0x38')],'type':_0x5ed874[_0x3834('0x39')][_0x3834('0x3a')]};});_0x3c8601[_0x3834('0x3b')]=_['map'](_0x4c6da6,'name');_0x3c8601[_0x3834('0x3c')]=_[_0x3834('0x3d')](_0x22d07c['query']);_0x3c8601['filters']=_[_0x3834('0x3e')](_0x3c8601[_0x3834('0x3b')],_0x3c8601[_0x3834('0x3c')]);_0x118171[_0x3834('0x3f')]=_[_0x3834('0x3e')](_0x3c8601[_0x3834('0x3b')],qs[_0x3834('0x40')](_0x22d07c[_0x3834('0x3c')][_0x3834('0x40')]));_0x118171['attributes']=_0x118171['attributes']['length']?_0x118171[_0x3834('0x3f')]:_0x3c8601[_0x3834('0x3b')];if(!_0x22d07c['query'][_0x3834('0x41')](_0x3834('0x42'))){_0x118171['limit']=qs[_0x3834('0x43')](_0x22d07c['query']['limit']);_0x118171['offset']=qs[_0x3834('0x44')](_0x22d07c[_0x3834('0x3c')][_0x3834('0x44')]);}_0x118171[_0x3834('0x45')]=qs['sort'](_0x22d07c['query'][_0x3834('0x46')]);_0x118171[_0x3834('0x47')]=qs[_0x3834('0x48')](_[_0x3834('0x49')](_0x22d07c['query'],_0x3c8601['filters']),_0x4c6da6);if(_0x22d07c[_0x3834('0x3c')][_0x3834('0x4a')]){_0x118171[_0x3834('0x47')]=_[_0x3834('0x4b')](_0x118171[_0x3834('0x47')],{'$or':_['map'](_0x4c6da6,function(_0x3ad8c9){if(_0x3ad8c9['type']!==_0x3834('0x4c')){var _0x157ec7={};_0x157ec7[_0x3ad8c9[_0x3834('0x32')]]={'$like':'%'+_0x22d07c[_0x3834('0x3c')][_0x3834('0x4a')]+'%'};return _0x157ec7;}})});}_0x118171=_[_0x3834('0x4b')]({},_0x118171,_0x22d07c[_0x3834('0x4d')]);var _0x5eb8d6={'where':_0x118171[_0x3834('0x47')]};return db[_0x3834('0x36')]['count'](_0x5eb8d6)[_0x3834('0x20')](function(_0x30ef04){_0x22cf61['count']=_0x30ef04;if(_0x22d07c[_0x3834('0x3c')][_0x3834('0x4e')]){_0x118171[_0x3834('0x4f')]=[{'all':!![]}];}return db[_0x3834('0x36')][_0x3834('0x50')](_0x118171);})[_0x3834('0x20')](function(_0x1a0f3a){_0x22cf61[_0x3834('0x51')]=_0x1a0f3a;return _0x22cf61;})[_0x3834('0x20')](respondWithFilteredResult(_0x2e0b9a,_0x118171))['catch'](handleError(_0x2e0b9a,null));};exports[_0x3834('0x52')]=function(_0x5f0d21,_0x14da38){var _0x3bd2e7={'raw':![],'where':{'id':_0x5f0d21[_0x3834('0x53')]['id']}},_0x5ea9eb={};_0x5ea9eb['model']=_['keys'](db['SalesforceConfiguration'][_0x3834('0x37')]);_0x5ea9eb[_0x3834('0x3c')]=_[_0x3834('0x3d')](_0x5f0d21[_0x3834('0x3c')]);_0x5ea9eb[_0x3834('0x48')]=_[_0x3834('0x3e')](_0x5ea9eb[_0x3834('0x3b')],_0x5ea9eb[_0x3834('0x3c')]);_0x3bd2e7[_0x3834('0x3f')]=_['intersection'](_0x5ea9eb[_0x3834('0x3b')],qs['fields'](_0x5f0d21['query'][_0x3834('0x40')]));_0x3bd2e7[_0x3834('0x3f')]=_0x3bd2e7[_0x3834('0x3f')][_0x3834('0x54')]?_0x3bd2e7[_0x3834('0x3f')]:_0x5ea9eb[_0x3834('0x3b')];if(_0x5f0d21[_0x3834('0x3c')][_0x3834('0x4e')]){_0x3bd2e7['include']=[{'all':!![]}];}_0x3bd2e7=_[_0x3834('0x4b')]({},_0x3bd2e7,_0x5f0d21['options']);return db[_0x3834('0x36')][_0x3834('0x55')](_0x3bd2e7)[_0x3834('0x20')](handleEntityNotFound(_0x14da38,null))[_0x3834('0x20')](respondWithResult(_0x14da38,null))[_0x3834('0x29')](handleError(_0x14da38,null));};exports[_0x3834('0x56')]=function(_0xf00e45,_0x3cbe19){return db[_0x3834('0x36')][_0x3834('0x56')](_0xf00e45[_0x3834('0x57')],{})[_0x3834('0x20')](respondWithResult(_0x3cbe19,0xc9))[_0x3834('0x29')](handleError(_0x3cbe19,null));};exports[_0x3834('0x58')]=function(_0x2e2cfa,_0x36d989){if(_0x2e2cfa[_0x3834('0x57')]['id']){delete _0x2e2cfa[_0x3834('0x57')]['id'];}return db[_0x3834('0x36')][_0x3834('0x55')]({'where':{'id':_0x2e2cfa[_0x3834('0x53')]['id']}})[_0x3834('0x20')](handleEntityNotFound(_0x36d989,null))['then'](saveUpdates(_0x2e2cfa['body'],null))[_0x3834('0x20')](respondWithResult(_0x36d989,null))[_0x3834('0x29')](handleError(_0x36d989,null));};exports[_0x3834('0x31')]=function(_0x2cd156,_0x1f89c7){return db['SalesforceConfiguration'][_0x3834('0x55')]({'where':{'id':_0x2cd156['params']['id']}})[_0x3834('0x20')](handleEntityNotFound(_0x1f89c7,null))[_0x3834('0x20')](removeEntity(_0x1f89c7,null))[_0x3834('0x29')](handleError(_0x1f89c7,null));};exports['getFields']=function(_0x4e3865,_0x3cc2a3,_0x342cdd){var _0x324db7={};var _0x3e2e80={};var _0x389a2b;var _0x192172;return db[_0x3834('0x36')][_0x3834('0x59')]({'where':{'id':_0x4e3865[_0x3834('0x53')]['id']}})[_0x3834('0x20')](handleEntityNotFound(_0x3cc2a3,null))[_0x3834('0x20')](function(_0x117bda){if(_0x117bda){_0x389a2b=_0x117bda;_0x3e2e80['model']=_['keys'](db[_0x3834('0x5a')]['rawAttributes']);_0x3e2e80['query']=_['keys'](_0x4e3865[_0x3834('0x3c')]);_0x3e2e80['filters']=_[_0x3834('0x3e')](_0x3e2e80['model'],_0x3e2e80[_0x3834('0x3c')]);_0x324db7[_0x3834('0x3f')]=_['intersection'](_0x3e2e80[_0x3834('0x3b')],qs['fields'](_0x4e3865[_0x3834('0x3c')][_0x3834('0x40')]));_0x324db7[_0x3834('0x3f')]=_0x324db7['attributes'][_0x3834('0x54')]?_0x324db7[_0x3834('0x3f')]:_0x3e2e80[_0x3834('0x3b')];_0x324db7[_0x3834('0x45')]=qs['sort'](_0x4e3865[_0x3834('0x3c')][_0x3834('0x46')]);_0x324db7['where']=qs['filters'](_[_0x3834('0x49')](_0x4e3865['query'],_0x3e2e80[_0x3834('0x48')]));if(_0x4e3865[_0x3834('0x3c')]['filter']){_0x324db7[_0x3834('0x47')]=_[_0x3834('0x4b')](_0x324db7['where'],{'$or':_[_0x3834('0x35')](_0x324db7[_0x3834('0x3f')],function(_0xeca0b1){var _0x52175b={};_0x52175b[_0xeca0b1]={'$like':'%'+_0x4e3865[_0x3834('0x3c')][_0x3834('0x4a')]+'%'};return _0x52175b;})});}_0x324db7=_['merge']({},_0x324db7,_0x4e3865[_0x3834('0x4d')]);return _0x389a2b[_0x3834('0x5b')](_0x324db7);}})[_0x3834('0x20')](function(_0x1fdec8){if(_0x1fdec8){_0x192172=_0x1fdec8[_0x3834('0x54')];if(!_0x4e3865[_0x3834('0x3c')][_0x3834('0x41')](_0x3834('0x42'))){_0x324db7[_0x3834('0x43')]=qs[_0x3834('0x43')](_0x4e3865[_0x3834('0x3c')]['limit']);_0x324db7['offset']=qs['offset'](_0x4e3865[_0x3834('0x3c')][_0x3834('0x44')]);}return _0x389a2b['getFields'](_0x324db7);}})['then'](function(_0x1a1875){if(_0x1a1875){return _0x1a1875?{'count':_0x192172,'rows':_0x1a1875}:null;}})[_0x3834('0x20')](respondWithResult(_0x3cc2a3,null))['catch'](handleError(_0x3cc2a3,null));};exports[_0x3834('0x5c')]=function(_0x1966c1,_0x2b58d6,_0xef8548){var _0x19db98={};var _0x526332={};var _0x15d4de;var _0x4fb509;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1966c1['params']['id']}})['then'](handleEntityNotFound(_0x2b58d6,null))['then'](function(_0x535c4c){if(_0x535c4c){_0x15d4de=_0x535c4c;_0x526332[_0x3834('0x3b')]=_[_0x3834('0x3d')](db[_0x3834('0x5a')][_0x3834('0x37')]);_0x526332[_0x3834('0x3c')]=_['keys'](_0x1966c1['query']);_0x526332[_0x3834('0x48')]=_[_0x3834('0x3e')](_0x526332['model'],_0x526332[_0x3834('0x3c')]);_0x19db98[_0x3834('0x3f')]=_[_0x3834('0x3e')](_0x526332[_0x3834('0x3b')],qs[_0x3834('0x40')](_0x1966c1[_0x3834('0x3c')][_0x3834('0x40')]));_0x19db98['attributes']=_0x19db98[_0x3834('0x3f')][_0x3834('0x54')]?_0x19db98[_0x3834('0x3f')]:_0x526332['model'];_0x19db98['order']=qs['sort'](_0x1966c1[_0x3834('0x3c')]['sort']);_0x19db98['where']=qs[_0x3834('0x48')](_[_0x3834('0x49')](_0x1966c1[_0x3834('0x3c')],_0x526332[_0x3834('0x48')]));if(_0x1966c1[_0x3834('0x3c')][_0x3834('0x4a')]){_0x19db98['where']=_['merge'](_0x19db98[_0x3834('0x47')],{'$or':_[_0x3834('0x35')](_0x19db98['attributes'],function(_0x3951e8){var _0x106a31={};_0x106a31[_0x3951e8]={'$like':'%'+_0x1966c1[_0x3834('0x3c')][_0x3834('0x4a')]+'%'};return _0x106a31;})});}_0x19db98=_[_0x3834('0x4b')]({},_0x19db98,_0x1966c1[_0x3834('0x4d')]);return _0x15d4de[_0x3834('0x5c')](_0x19db98);}})[_0x3834('0x20')](function(_0x3e4f16){if(_0x3e4f16){_0x4fb509=_0x3e4f16[_0x3834('0x54')];if(!_0x1966c1[_0x3834('0x3c')][_0x3834('0x41')](_0x3834('0x42'))){_0x19db98[_0x3834('0x43')]=qs[_0x3834('0x43')](_0x1966c1[_0x3834('0x3c')][_0x3834('0x43')]);_0x19db98[_0x3834('0x44')]=qs['offset'](_0x1966c1[_0x3834('0x3c')][_0x3834('0x44')]);}return _0x15d4de[_0x3834('0x5c')](_0x19db98);}})[_0x3834('0x20')](function(_0xcba007){if(_0xcba007){return _0xcba007?{'count':_0x4fb509,'rows':_0xcba007}:null;}})[_0x3834('0x20')](respondWithResult(_0x2b58d6,null))['catch'](handleError(_0x2b58d6,null));};exports[_0x3834('0x5d')]=function(_0x23d5fa,_0x4f90eb,_0x488da7){var _0x5deeeb={};var _0x2a51d1={};var _0xd41184;var _0x362269;return db[_0x3834('0x36')][_0x3834('0x59')]({'where':{'id':_0x23d5fa[_0x3834('0x53')]['id']}})[_0x3834('0x20')](handleEntityNotFound(_0x4f90eb,null))[_0x3834('0x20')](function(_0xd12142){if(_0xd12142){_0xd41184=_0xd12142;_0x2a51d1[_0x3834('0x3b')]=_[_0x3834('0x3d')](db[_0x3834('0x5a')][_0x3834('0x37')]);_0x2a51d1['query']=_[_0x3834('0x3d')](_0x23d5fa['query']);_0x2a51d1[_0x3834('0x48')]=_[_0x3834('0x3e')](_0x2a51d1[_0x3834('0x3b')],_0x2a51d1[_0x3834('0x3c')]);_0x5deeeb['attributes']=_[_0x3834('0x3e')](_0x2a51d1['model'],qs[_0x3834('0x40')](_0x23d5fa['query']['fields']));_0x5deeeb[_0x3834('0x3f')]=_0x5deeeb['attributes']['length']?_0x5deeeb[_0x3834('0x3f')]:_0x2a51d1['model'];_0x5deeeb[_0x3834('0x45')]=qs['sort'](_0x23d5fa[_0x3834('0x3c')][_0x3834('0x46')]);_0x5deeeb[_0x3834('0x47')]=qs[_0x3834('0x48')](_['pick'](_0x23d5fa[_0x3834('0x3c')],_0x2a51d1['filters']));if(_0x23d5fa[_0x3834('0x3c')]['filter']){_0x5deeeb[_0x3834('0x47')]=_[_0x3834('0x4b')](_0x5deeeb[_0x3834('0x47')],{'$or':_[_0x3834('0x35')](_0x5deeeb[_0x3834('0x3f')],function(_0x4be631){var _0x5c88e3={};_0x5c88e3[_0x4be631]={'$like':'%'+_0x23d5fa[_0x3834('0x3c')]['filter']+'%'};return _0x5c88e3;})});}_0x5deeeb=_[_0x3834('0x4b')]({},_0x5deeeb,_0x23d5fa[_0x3834('0x4d')]);return _0xd41184['getDescriptions'](_0x5deeeb);}})[_0x3834('0x20')](function(_0x3e190e){if(_0x3e190e){_0x362269=_0x3e190e['length'];if(!_0x23d5fa[_0x3834('0x3c')][_0x3834('0x41')](_0x3834('0x42'))){_0x5deeeb['limit']=qs[_0x3834('0x43')](_0x23d5fa[_0x3834('0x3c')][_0x3834('0x43')]);_0x5deeeb[_0x3834('0x44')]=qs[_0x3834('0x44')](_0x23d5fa[_0x3834('0x3c')][_0x3834('0x44')]);}return _0xd41184[_0x3834('0x5d')](_0x5deeeb);}})[_0x3834('0x20')](function(_0x500e6b){if(_0x500e6b){return _0x500e6b?{'count':_0x362269,'rows':_0x500e6b}:null;}})[_0x3834('0x20')](respondWithResult(_0x4f90eb,null))['catch'](handleError(_0x4f90eb,null));}; \ No newline at end of file +var _0x7bb0=['../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','apply','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','sort','where','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','rows','show','intersection','find','create','body','params','getFields','findOne','length','order','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','SalesforceField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x5c23cc,_0x3bac85){var _0x1add2d=function(_0x349672){while(--_0x349672){_0x5c23cc['push'](_0x5c23cc['shift']());}};_0x1add2d(++_0x3bac85);}(_0x7bb0,0xa7));var _0x07bb=function(_0x4d13b6,_0x2ff98e){_0x4d13b6=_0x4d13b6-0x0;var _0x410f82=_0x7bb0[_0x4d13b6];return _0x410f82;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07bb('0x0'));var rimraf=require(_0x07bb('0x1'));var zipdir=require(_0x07bb('0x2'));var jsonpatch=require(_0x07bb('0x3'));var rp=require(_0x07bb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x07bb('0x5'));var util=require('util');var path=require(_0x07bb('0x6'));var sox=require(_0x07bb('0x7'));var csv=require(_0x07bb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07bb('0x9'));var squel=require(_0x07bb('0xa'));var crypto=require(_0x07bb('0xb'));var jsforce=require(_0x07bb('0xc'));var deskjs=require(_0x07bb('0xd'));var toCsv=require(_0x07bb('0x8'));var querystring=require(_0x07bb('0xe'));var Papa=require(_0x07bb('0xf'));var Redis=require(_0x07bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07bb('0x11'));var as=require(_0x07bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07bb('0x13'))('api');var utils=require(_0x07bb('0x14'));var config=require(_0x07bb('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x07bb('0x16'));var client=jayson[_0x07bb('0x17')][_0x07bb('0x18')]({'port':0x232a});function checkPasswordPattern(_0x507106,_0x389f45,_0x26ef66){if(_0x26ef66){var _0x547958=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x547958[_0x07bb('0x19')](_0x389f45)){return _0x507106;}else{throw new db[(_0x07bb('0x1a'))][(_0x07bb('0x1b'))](_0x07bb('0x1c'));}}else{return _0x507106;}}function respondWithRpcPromise(_0x19bd0c,_0x54064c,_0x32892a,_0x209a4f){return new BPromise(function(_0x380453,_0x31b96e){var _0x274fd4=_0x209a4f||client;return _0x274fd4[_0x07bb('0x1d')](_0x19bd0c,_0x32892a)[_0x07bb('0x1e')](function(_0x52e821){logger[_0x07bb('0x1f')](_0x07bb('0x20'),_0x54064c,_0x07bb('0x21'));logger[_0x07bb('0x22')](_0x07bb('0x23'),_0x54064c,_0x07bb('0x21'),JSON[_0x07bb('0x24')](_0x52e821));if(_0x52e821[_0x07bb('0x25')]){if(_0x52e821[_0x07bb('0x25')][_0x07bb('0x26')]===0x1f4){logger[_0x07bb('0x25')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54064c,_0x52e821['error'][_0x07bb('0x27')]);return _0x31b96e(_0x52e821[_0x07bb('0x25')]['message']);}logger[_0x07bb('0x25')](_0x07bb('0x20'),_0x54064c,_0x52e821[_0x07bb('0x25')][_0x07bb('0x27')]);return _0x380453(_0x52e821[_0x07bb('0x25')][_0x07bb('0x27')]);}else{logger[_0x07bb('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54064c,_0x07bb('0x21'));_0x380453(_0x52e821[_0x07bb('0x28')]['message']);}})[_0x07bb('0x29')](function(_0x1ac08a){logger[_0x07bb('0x25')](_0x07bb('0x20'),_0x54064c,_0x1ac08a);_0x31b96e(_0x1ac08a);});});}function respondWithStatusCode(_0x32c065,_0x53523f){_0x53523f=_0x53523f||0xcc;return function(_0x2fd7e2){if(_0x2fd7e2){return _0x32c065['sendStatus'](_0x53523f);}return _0x32c065[_0x07bb('0x2a')](_0x53523f)[_0x07bb('0x2b')]();};}function respondWithResult(_0x31c26b,_0x13eaf8){_0x13eaf8=_0x13eaf8||0xc8;return function(_0x84385b){if(_0x84385b){return _0x31c26b[_0x07bb('0x2a')](_0x13eaf8)[_0x07bb('0x2c')](_0x84385b);}};}function respondWithFilteredResult(_0x5da638,_0x1a1882){return function(_0x285792){if(_0x285792){var _0x5f1883=_0x285792[_0x07bb('0x2d')],_0x29053b=_0x1a1882[_0x07bb('0x2e')],_0x100174=_0x1a1882[_0x07bb('0x2e')]+_0x1a1882[_0x07bb('0x2f')],_0x36a0fe;if(_0x100174>=_0x5f1883){_0x100174=_0x5f1883;_0x36a0fe=0xc8;}else{_0x36a0fe=0xce;}_0x5da638['status'](_0x36a0fe);return _0x5da638[_0x07bb('0x30')]('Content-Range',_0x29053b+'-'+_0x100174+'/'+_0x5f1883)[_0x07bb('0x2c')](_0x285792);}return null;};}function patchUpdates(_0x1cf970){return function(_0x36716c){try{jsonpatch[_0x07bb('0x31')](_0x36716c,_0x1cf970,!![]);}catch(_0x52374d){return BPromise['reject'](_0x52374d);}return _0x36716c[_0x07bb('0x32')]();};}function saveUpdates(_0x2f5040,_0x46ef9a){return function(_0x5daa60){if(_0x5daa60){return _0x5daa60[_0x07bb('0x33')](_0x2f5040)[_0x07bb('0x1e')](function(_0x2e24c4){return _0x2e24c4;});}return null;};}function removeEntity(_0x50b4d3,_0x6d857a){return function(_0x5b932f){if(_0x5b932f){return _0x5b932f[_0x07bb('0x34')]()[_0x07bb('0x1e')](function(){_0x50b4d3[_0x07bb('0x2a')](0xcc)[_0x07bb('0x2b')]();});}};}function handleEntityNotFound(_0x3082c4,_0x5cc071){return function(_0xee5038){if(!_0xee5038){_0x3082c4[_0x07bb('0x35')](0x194);}return _0xee5038;};}function handleError(_0x4dd7fd,_0x305f93){_0x305f93=_0x305f93||0x1f4;return function(_0x2a1657){logger[_0x07bb('0x25')](_0x2a1657[_0x07bb('0x36')]);if(_0x2a1657['name']){delete _0x2a1657[_0x07bb('0x37')];}_0x4dd7fd[_0x07bb('0x2a')](_0x305f93)[_0x07bb('0x38')](_0x2a1657);};}exports[_0x07bb('0x39')]=function(_0x30a340,_0x573714){var _0x51c103={},_0x231f4b={},_0x1989e4={'count':0x0,'rows':[]};var _0x4083ef=_[_0x07bb('0x3a')](db['SalesforceConfiguration'][_0x07bb('0x3b')],function(_0x14980e){return{'name':_0x14980e['fieldName'],'type':_0x14980e[_0x07bb('0x3c')][_0x07bb('0x3d')]};});_0x231f4b[_0x07bb('0x3e')]=_[_0x07bb('0x3a')](_0x4083ef,_0x07bb('0x37'));_0x231f4b[_0x07bb('0x3f')]=_[_0x07bb('0x40')](_0x30a340[_0x07bb('0x3f')]);_0x231f4b[_0x07bb('0x41')]=_['intersection'](_0x231f4b[_0x07bb('0x3e')],_0x231f4b['query']);_0x51c103[_0x07bb('0x42')]=_['intersection'](_0x231f4b['model'],qs[_0x07bb('0x43')](_0x30a340[_0x07bb('0x3f')]['fields']));_0x51c103['attributes']=_0x51c103[_0x07bb('0x42')]['length']?_0x51c103['attributes']:_0x231f4b['model'];if(!_0x30a340['query']['hasOwnProperty']('nolimit')){_0x51c103[_0x07bb('0x2f')]=qs['limit'](_0x30a340[_0x07bb('0x3f')][_0x07bb('0x2f')]);_0x51c103[_0x07bb('0x2e')]=qs[_0x07bb('0x2e')](_0x30a340[_0x07bb('0x3f')][_0x07bb('0x2e')]);}_0x51c103['order']=qs['sort'](_0x30a340[_0x07bb('0x3f')][_0x07bb('0x44')]);_0x51c103[_0x07bb('0x45')]=qs[_0x07bb('0x41')](_['pick'](_0x30a340['query'],_0x231f4b[_0x07bb('0x41')]),_0x4083ef);if(_0x30a340[_0x07bb('0x3f')][_0x07bb('0x46')]){_0x51c103['where']=_[_0x07bb('0x47')](_0x51c103[_0x07bb('0x45')],{'$or':_[_0x07bb('0x3a')](_0x4083ef,function(_0x2b57b4){if(_0x2b57b4[_0x07bb('0x3c')]!==_0x07bb('0x48')){var _0x378a9b={};_0x378a9b[_0x2b57b4[_0x07bb('0x37')]]={'$like':'%'+_0x30a340[_0x07bb('0x3f')][_0x07bb('0x46')]+'%'};return _0x378a9b;}})});}_0x51c103=_[_0x07bb('0x47')]({},_0x51c103,_0x30a340[_0x07bb('0x49')]);var _0x1a1711={'where':_0x51c103[_0x07bb('0x45')]};return db[_0x07bb('0x4a')][_0x07bb('0x2d')](_0x1a1711)[_0x07bb('0x1e')](function(_0x29cc17){_0x1989e4[_0x07bb('0x2d')]=_0x29cc17;if(_0x30a340[_0x07bb('0x3f')][_0x07bb('0x4b')]){_0x51c103[_0x07bb('0x4c')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x51c103);})[_0x07bb('0x1e')](function(_0x4121fb){_0x1989e4[_0x07bb('0x4d')]=_0x4121fb;return _0x1989e4;})['then'](respondWithFilteredResult(_0x573714,_0x51c103))[_0x07bb('0x29')](handleError(_0x573714,null));};exports[_0x07bb('0x4e')]=function(_0x142575,_0x1f1b12){var _0x54d173={'raw':![],'where':{'id':_0x142575['params']['id']}},_0x390bf1={};_0x390bf1[_0x07bb('0x3e')]=_[_0x07bb('0x40')](db[_0x07bb('0x4a')][_0x07bb('0x3b')]);_0x390bf1[_0x07bb('0x3f')]=_[_0x07bb('0x40')](_0x142575['query']);_0x390bf1['filters']=_[_0x07bb('0x4f')](_0x390bf1[_0x07bb('0x3e')],_0x390bf1[_0x07bb('0x3f')]);_0x54d173[_0x07bb('0x42')]=_[_0x07bb('0x4f')](_0x390bf1[_0x07bb('0x3e')],qs[_0x07bb('0x43')](_0x142575['query']['fields']));_0x54d173[_0x07bb('0x42')]=_0x54d173[_0x07bb('0x42')]['length']?_0x54d173['attributes']:_0x390bf1[_0x07bb('0x3e')];if(_0x142575[_0x07bb('0x3f')][_0x07bb('0x4b')]){_0x54d173[_0x07bb('0x4c')]=[{'all':!![]}];}_0x54d173=_[_0x07bb('0x47')]({},_0x54d173,_0x142575['options']);return db[_0x07bb('0x4a')][_0x07bb('0x50')](_0x54d173)['then'](handleEntityNotFound(_0x1f1b12,null))[_0x07bb('0x1e')](respondWithResult(_0x1f1b12,null))[_0x07bb('0x29')](handleError(_0x1f1b12,null));};exports['create']=function(_0x19901d,_0x35eaf8){return db[_0x07bb('0x4a')][_0x07bb('0x51')](_0x19901d[_0x07bb('0x52')],{})[_0x07bb('0x1e')](respondWithResult(_0x35eaf8,0xc9))[_0x07bb('0x29')](handleError(_0x35eaf8,null));};exports[_0x07bb('0x33')]=function(_0x434830,_0x49d292){if(_0x434830[_0x07bb('0x52')]['id']){delete _0x434830[_0x07bb('0x52')]['id'];}return db[_0x07bb('0x4a')][_0x07bb('0x50')]({'where':{'id':_0x434830['params']['id']}})[_0x07bb('0x1e')](handleEntityNotFound(_0x49d292,null))[_0x07bb('0x1e')](saveUpdates(_0x434830[_0x07bb('0x52')],null))['then'](respondWithResult(_0x49d292,null))['catch'](handleError(_0x49d292,null));};exports[_0x07bb('0x34')]=function(_0x3fe31b,_0x1e20b7){return db[_0x07bb('0x4a')][_0x07bb('0x50')]({'where':{'id':_0x3fe31b[_0x07bb('0x53')]['id']}})[_0x07bb('0x1e')](handleEntityNotFound(_0x1e20b7,null))['then'](removeEntity(_0x1e20b7,null))[_0x07bb('0x29')](handleError(_0x1e20b7,null));};exports[_0x07bb('0x54')]=function(_0x29bef2,_0x81b62d,_0x4dedf3){var _0x7f1331={};var _0x1c7001={};var _0x29d198;var _0x85b12f;return db['SalesforceConfiguration'][_0x07bb('0x55')]({'where':{'id':_0x29bef2[_0x07bb('0x53')]['id']}})[_0x07bb('0x1e')](handleEntityNotFound(_0x81b62d,null))[_0x07bb('0x1e')](function(_0x1aee02){if(_0x1aee02){_0x29d198=_0x1aee02;_0x1c7001[_0x07bb('0x3e')]=_[_0x07bb('0x40')](db['SalesforceField']['rawAttributes']);_0x1c7001[_0x07bb('0x3f')]=_['keys'](_0x29bef2['query']);_0x1c7001[_0x07bb('0x41')]=_[_0x07bb('0x4f')](_0x1c7001[_0x07bb('0x3e')],_0x1c7001[_0x07bb('0x3f')]);_0x7f1331[_0x07bb('0x42')]=_[_0x07bb('0x4f')](_0x1c7001[_0x07bb('0x3e')],qs[_0x07bb('0x43')](_0x29bef2[_0x07bb('0x3f')][_0x07bb('0x43')]));_0x7f1331['attributes']=_0x7f1331[_0x07bb('0x42')][_0x07bb('0x56')]?_0x7f1331[_0x07bb('0x42')]:_0x1c7001['model'];_0x7f1331[_0x07bb('0x57')]=qs[_0x07bb('0x44')](_0x29bef2[_0x07bb('0x3f')]['sort']);_0x7f1331[_0x07bb('0x45')]=qs['filters'](_[_0x07bb('0x58')](_0x29bef2['query'],_0x1c7001[_0x07bb('0x41')]));if(_0x29bef2['query'][_0x07bb('0x46')]){_0x7f1331[_0x07bb('0x45')]=_[_0x07bb('0x47')](_0x7f1331[_0x07bb('0x45')],{'$or':_['map'](_0x7f1331['attributes'],function(_0x345618){var _0x4b9b4d={};_0x4b9b4d[_0x345618]={'$like':'%'+_0x29bef2[_0x07bb('0x3f')][_0x07bb('0x46')]+'%'};return _0x4b9b4d;})});}_0x7f1331=_[_0x07bb('0x47')]({},_0x7f1331,_0x29bef2[_0x07bb('0x49')]);return _0x29d198['getFields'](_0x7f1331);}})[_0x07bb('0x1e')](function(_0x314f44){if(_0x314f44){_0x85b12f=_0x314f44[_0x07bb('0x56')];if(!_0x29bef2[_0x07bb('0x3f')][_0x07bb('0x59')](_0x07bb('0x5a'))){_0x7f1331[_0x07bb('0x2f')]=qs[_0x07bb('0x2f')](_0x29bef2[_0x07bb('0x3f')][_0x07bb('0x2f')]);_0x7f1331['offset']=qs['offset'](_0x29bef2[_0x07bb('0x3f')][_0x07bb('0x2e')]);}return _0x29d198[_0x07bb('0x54')](_0x7f1331);}})[_0x07bb('0x1e')](function(_0x4ab9a7){if(_0x4ab9a7){return _0x4ab9a7?{'count':_0x85b12f,'rows':_0x4ab9a7}:null;}})[_0x07bb('0x1e')](respondWithResult(_0x81b62d,null))[_0x07bb('0x29')](handleError(_0x81b62d,null));};exports['getSubjects']=function(_0x185423,_0x52212a,_0xb9226a){var _0x53026c={};var _0x4062af={};var _0x5468a0;var _0x415c1a;return db[_0x07bb('0x4a')][_0x07bb('0x55')]({'where':{'id':_0x185423[_0x07bb('0x53')]['id']}})[_0x07bb('0x1e')](handleEntityNotFound(_0x52212a,null))[_0x07bb('0x1e')](function(_0x3cab95){if(_0x3cab95){_0x5468a0=_0x3cab95;_0x4062af[_0x07bb('0x3e')]=_[_0x07bb('0x40')](db['SalesforceField'][_0x07bb('0x3b')]);_0x4062af[_0x07bb('0x3f')]=_[_0x07bb('0x40')](_0x185423[_0x07bb('0x3f')]);_0x4062af[_0x07bb('0x41')]=_[_0x07bb('0x4f')](_0x4062af[_0x07bb('0x3e')],_0x4062af[_0x07bb('0x3f')]);_0x53026c['attributes']=_[_0x07bb('0x4f')](_0x4062af[_0x07bb('0x3e')],qs[_0x07bb('0x43')](_0x185423[_0x07bb('0x3f')]['fields']));_0x53026c[_0x07bb('0x42')]=_0x53026c[_0x07bb('0x42')][_0x07bb('0x56')]?_0x53026c['attributes']:_0x4062af['model'];_0x53026c[_0x07bb('0x57')]=qs[_0x07bb('0x44')](_0x185423[_0x07bb('0x3f')]['sort']);_0x53026c[_0x07bb('0x45')]=qs[_0x07bb('0x41')](_['pick'](_0x185423[_0x07bb('0x3f')],_0x4062af['filters']));if(_0x185423[_0x07bb('0x3f')]['filter']){_0x53026c[_0x07bb('0x45')]=_[_0x07bb('0x47')](_0x53026c[_0x07bb('0x45')],{'$or':_[_0x07bb('0x3a')](_0x53026c[_0x07bb('0x42')],function(_0x483766){var _0x1ac871={};_0x1ac871[_0x483766]={'$like':'%'+_0x185423[_0x07bb('0x3f')]['filter']+'%'};return _0x1ac871;})});}_0x53026c=_[_0x07bb('0x47')]({},_0x53026c,_0x185423[_0x07bb('0x49')]);return _0x5468a0[_0x07bb('0x5b')](_0x53026c);}})[_0x07bb('0x1e')](function(_0x4e62da){if(_0x4e62da){_0x415c1a=_0x4e62da['length'];if(!_0x185423[_0x07bb('0x3f')][_0x07bb('0x59')]('nolimit')){_0x53026c['limit']=qs[_0x07bb('0x2f')](_0x185423[_0x07bb('0x3f')][_0x07bb('0x2f')]);_0x53026c[_0x07bb('0x2e')]=qs[_0x07bb('0x2e')](_0x185423[_0x07bb('0x3f')]['offset']);}return _0x5468a0[_0x07bb('0x5b')](_0x53026c);}})[_0x07bb('0x1e')](function(_0x3ca96f){if(_0x3ca96f){return _0x3ca96f?{'count':_0x415c1a,'rows':_0x3ca96f}:null;}})[_0x07bb('0x1e')](respondWithResult(_0x52212a,null))[_0x07bb('0x29')](handleError(_0x52212a,null));};exports[_0x07bb('0x5c')]=function(_0x483d3a,_0x14b9e3,_0x1566b4){var _0x32c925={};var _0x5c9e6f={};var _0x225cda;var _0x512e99;return db[_0x07bb('0x4a')][_0x07bb('0x55')]({'where':{'id':_0x483d3a[_0x07bb('0x53')]['id']}})[_0x07bb('0x1e')](handleEntityNotFound(_0x14b9e3,null))[_0x07bb('0x1e')](function(_0x3b1691){if(_0x3b1691){_0x225cda=_0x3b1691;_0x5c9e6f['model']=_[_0x07bb('0x40')](db[_0x07bb('0x5d')]['rawAttributes']);_0x5c9e6f[_0x07bb('0x3f')]=_[_0x07bb('0x40')](_0x483d3a['query']);_0x5c9e6f[_0x07bb('0x41')]=_[_0x07bb('0x4f')](_0x5c9e6f['model'],_0x5c9e6f[_0x07bb('0x3f')]);_0x32c925[_0x07bb('0x42')]=_[_0x07bb('0x4f')](_0x5c9e6f[_0x07bb('0x3e')],qs[_0x07bb('0x43')](_0x483d3a[_0x07bb('0x3f')][_0x07bb('0x43')]));_0x32c925[_0x07bb('0x42')]=_0x32c925[_0x07bb('0x42')][_0x07bb('0x56')]?_0x32c925[_0x07bb('0x42')]:_0x5c9e6f[_0x07bb('0x3e')];_0x32c925[_0x07bb('0x57')]=qs[_0x07bb('0x44')](_0x483d3a[_0x07bb('0x3f')][_0x07bb('0x44')]);_0x32c925[_0x07bb('0x45')]=qs[_0x07bb('0x41')](_[_0x07bb('0x58')](_0x483d3a[_0x07bb('0x3f')],_0x5c9e6f[_0x07bb('0x41')]));if(_0x483d3a[_0x07bb('0x3f')][_0x07bb('0x46')]){_0x32c925['where']=_[_0x07bb('0x47')](_0x32c925[_0x07bb('0x45')],{'$or':_[_0x07bb('0x3a')](_0x32c925['attributes'],function(_0x18fd2c){var _0x3bd133={};_0x3bd133[_0x18fd2c]={'$like':'%'+_0x483d3a[_0x07bb('0x3f')][_0x07bb('0x46')]+'%'};return _0x3bd133;})});}_0x32c925=_['merge']({},_0x32c925,_0x483d3a[_0x07bb('0x49')]);return _0x225cda[_0x07bb('0x5c')](_0x32c925);}})[_0x07bb('0x1e')](function(_0x1779d2){if(_0x1779d2){_0x512e99=_0x1779d2['length'];if(!_0x483d3a['query'][_0x07bb('0x59')](_0x07bb('0x5a'))){_0x32c925[_0x07bb('0x2f')]=qs[_0x07bb('0x2f')](_0x483d3a['query']['limit']);_0x32c925[_0x07bb('0x2e')]=qs[_0x07bb('0x2e')](_0x483d3a['query'][_0x07bb('0x2e')]);}return _0x225cda['getDescriptions'](_0x32c925);}})['then'](function(_0x3a22c3){if(_0x3a22c3){return _0x3a22c3?{'count':_0x512e99,'rows':_0x3a22c3}:null;}})['then'](respondWithResult(_0x14b9e3,null))[_0x07bb('0x29')](handleError(_0x14b9e3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8463b64..4808d65 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 _0x62aa=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x4c4ff8,_0xfc84b){var _0x1b5a94=function(_0x4dd7b3){while(--_0x4dd7b3){_0x4c4ff8['push'](_0x4c4ff8['shift']());}};_0x1b5a94(++_0xfc84b);}(_0x62aa,0x90));var _0xa62a=function(_0x5006fc,_0x2eebea){_0x5006fc=_0x5006fc-0x0;var _0x19c9d2=_0x62aa[_0x5006fc];return _0x19c9d2;};'use strict';var _=require(_0xa62a('0x0'));var util=require('util');var logger=require(_0xa62a('0x1'))(_0xa62a('0x2'));var moment=require('moment');var BPromise=require(_0xa62a('0x3'));var rp=require(_0xa62a('0x4'));var fs=require('fs');var path=require(_0xa62a('0x5'));var rimraf=require(_0xa62a('0x6'));var config=require(_0xa62a('0x7'));var attributes=require(_0xa62a('0x8'));module[_0xa62a('0x9')]=function(_0x416cbd,_0xa98c4c){return _0x416cbd[_0xa62a('0xa')](_0xa62a('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee36=['exports','SalesforceConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x50f3c6,_0x192e1e){var _0x192bc9=function(_0x3d65d7){while(--_0x3d65d7){_0x50f3c6['push'](_0x50f3c6['shift']());}};_0x192bc9(++_0x192e1e);}(_0xee36,0x7b));var _0x6ee3=function(_0x259e71,_0x178636){_0x259e71=_0x259e71-0x0;var _0x4cde6f=_0xee36[_0x259e71];return _0x4cde6f;};'use strict';var _=require(_0x6ee3('0x0'));var util=require(_0x6ee3('0x1'));var logger=require('../../config/logger')(_0x6ee3('0x2'));var moment=require(_0x6ee3('0x3'));var BPromise=require(_0x6ee3('0x4'));var rp=require(_0x6ee3('0x5'));var fs=require('fs');var path=require(_0x6ee3('0x6'));var rimraf=require(_0x6ee3('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ee3('0x8'));module[_0x6ee3('0x9')]=function(_0x35ede7,_0x115a2d){return _0x35ede7['define'](_0x6ee3('0xa'),attributes,{'tableName':'int_salesforce_configurations','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 1009e2a..6a52c6e 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 _0x9408=['http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9408,0x12c));var _0x8940=function(_0x3ff860,_0x2be9f7){_0x3ff860=_0x3ff860-0x0;var _0x181391=_0x9408[_0x3ff860];return _0x181391;};'use strict';var _=require(_0x8940('0x0'));var util=require(_0x8940('0x1'));var moment=require(_0x8940('0x2'));var BPromise=require(_0x8940('0x3'));var rs=require(_0x8940('0x4'));var fs=require('fs');var Redis=require(_0x8940('0x5'));var db=require(_0x8940('0x6'))['db'];var utils=require(_0x8940('0x7'));var logger=require(_0x8940('0x8'))(_0x8940('0x9'));var config=require('../../config/environment');var jayson=require(_0x8940('0xa'));var client=jayson[_0x8940('0xb')][_0x8940('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39db08,_0x423e78,_0x390bcd){return new BPromise(function(_0x3354a5,_0x1f2e3f){return client[_0x8940('0xd')](_0x39db08,_0x390bcd)['then'](function(_0x2c62a4){logger[_0x8940('0xe')](_0x8940('0xf'),_0x423e78,_0x8940('0x10'));logger[_0x8940('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x423e78,'request\x20sent',JSON[_0x8940('0x12')](_0x2c62a4));if(_0x2c62a4[_0x8940('0x13')]){if(_0x2c62a4['error'][_0x8940('0x14')]===0x1f4){logger[_0x8940('0x13')](_0x8940('0xf'),_0x423e78,_0x2c62a4[_0x8940('0x13')][_0x8940('0x15')]);return _0x1f2e3f(_0x2c62a4['error']['message']);}logger[_0x8940('0x13')](_0x8940('0xf'),_0x423e78,_0x2c62a4[_0x8940('0x13')][_0x8940('0x15')]);return _0x3354a5(_0x2c62a4[_0x8940('0x13')][_0x8940('0x15')]);}else{logger[_0x8940('0xe')](_0x8940('0xf'),_0x423e78,'request\x20sent');_0x3354a5(_0x2c62a4[_0x8940('0x16')][_0x8940('0x15')]);}})[_0x8940('0x17')](function(_0x39a98c){logger[_0x8940('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x423e78,_0x39a98c);_0x1f2e3f(_0x39a98c);});});} \ No newline at end of file +var _0xff4d=['../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x1b2099,_0x4a3d50){var _0x25f363=function(_0x283937){while(--_0x283937){_0x1b2099['push'](_0x1b2099['shift']());}};_0x25f363(++_0x4a3d50);}(_0xff4d,0xc1));var _0xdff4=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0xff4d[_0x37f212];return _0x57ba32;};'use strict';var _=require(_0xdff4('0x0'));var util=require(_0xdff4('0x1'));var moment=require('moment');var BPromise=require(_0xdff4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdff4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdff4('0x4'))('rpc');var config=require(_0xdff4('0x5'));var jayson=require(_0xdff4('0x6'));var client=jayson['client'][_0xdff4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x540814,_0x57d279,_0x58afda){return new BPromise(function(_0x32a5da,_0x374d0b){return client[_0xdff4('0x8')](_0x540814,_0x58afda)[_0xdff4('0x9')](function(_0x488fbd){logger[_0xdff4('0xa')](_0xdff4('0xb'),_0x57d279,_0xdff4('0xc'));logger['debug'](_0xdff4('0xd'),_0x57d279,_0xdff4('0xc'),JSON['stringify'](_0x488fbd));if(_0x488fbd[_0xdff4('0xe')]){if(_0x488fbd[_0xdff4('0xe')][_0xdff4('0xf')]===0x1f4){logger[_0xdff4('0xe')](_0xdff4('0xb'),_0x57d279,_0x488fbd['error'][_0xdff4('0x10')]);return _0x374d0b(_0x488fbd[_0xdff4('0xe')][_0xdff4('0x10')]);}logger[_0xdff4('0xe')](_0xdff4('0xb'),_0x57d279,_0x488fbd['error'][_0xdff4('0x10')]);return _0x32a5da(_0x488fbd[_0xdff4('0xe')]['message']);}else{logger[_0xdff4('0xa')](_0xdff4('0xb'),_0x57d279,_0xdff4('0xc'));_0x32a5da(_0x488fbd['result'][_0xdff4('0x10')]);}})[_0xdff4('0x11')](function(_0x268453){logger[_0xdff4('0xe')](_0xdff4('0xb'),_0x57d279,_0x268453);_0x374d0b(_0x268453);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index cb4cb42..06f2917 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x1eaf5e,_0x333d16){var _0x409fa2=function(_0x57f633){while(--_0x57f633){_0x1eaf5e['push'](_0x1eaf5e['shift']());}};_0x409fa2(++_0x333d16);}(_0x524e,0x15e));var _0xe524=function(_0x48e086,_0xfc6f11){_0x48e086=_0x48e086-0x0;var _0x380234=_0x524e[_0x48e086];return _0x380234;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x8ace=['index','show','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x5f5f7f,_0x2077f3){var _0x35782a=function(_0x3db13a){while(--_0x3db13a){_0x5f5f7f['push'](_0x5f5f7f['shift']());}};_0x35782a(++_0x2077f3);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x2fb8d3,_0x2ec153){_0x2fb8d3=_0x2fb8d3-0x0;var _0x278bec=_0x8ace[_0x2fb8d3];return _0x278bec;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/:id',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe8ac('0xe')]);router['put'](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller['destroy']);module[_0xe8ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 875d49f..8e939a0 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 _0x80d9=['keyValue','customVariable','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x1d02d8,_0x35cf9d){var _0x3c1ed5=function(_0x559c29){while(--_0x559c29){_0x1d02d8['push'](_0x1d02d8['shift']());}};_0x3c1ed5(++_0x35cf9d);}(_0x80d9,0xc3));var _0x980d=function(_0x41368d,_0x13d7dd){_0x41368d=_0x41368d-0x0;var _0x158a9e=_0x80d9[_0x41368d];return _0x158a9e;};'use strict';var Sequelize=require(_0x980d('0x0'));module[_0x980d('0x1')]={'type':{'type':Sequelize[_0x980d('0x2')](_0x980d('0x3'),_0x980d('0x4'),'customVariable',_0x980d('0x5')),'defaultValue':_0x980d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x980d('0x2')](_0x980d('0x3'),_0x980d('0x4'),_0x980d('0x6'))},'keyContent':{'type':Sequelize[_0x980d('0x7')]},'idField':{'type':Sequelize[_0x980d('0x7')]},'variableName':{'type':Sequelize[_0x980d('0x7')]}}; \ No newline at end of file +var _0xff32=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0xb9fd42,_0xf504ac){var _0x127671=function(_0x48f0b9){while(--_0x48f0b9){_0xb9fd42['push'](_0xb9fd42['shift']());}};_0x127671(++_0xf504ac);}(_0xff32,0x1e2));var _0x2ff3=function(_0x24a48a,_0x3843a5){_0x24a48a=_0x24a48a-0x0;var _0x2f9b60=_0xff32[_0x24a48a];return _0x2f9b60;};'use strict';var Sequelize=require('sequelize');module[_0x2ff3('0x0')]={'type':{'type':Sequelize[_0x2ff3('0x1')](_0x2ff3('0x2'),_0x2ff3('0x3'),_0x2ff3('0x4'),_0x2ff3('0x5')),'defaultValue':_0x2ff3('0x2')},'content':{'type':Sequelize[_0x2ff3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2ff3('0x1')](_0x2ff3('0x2'),_0x2ff3('0x3'),_0x2ff3('0x4'))},'keyContent':{'type':Sequelize[_0x2ff3('0x6')]},'idField':{'type':Sequelize[_0x2ff3('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ab988ee..e08bf26 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 _0x11f6=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','SalesforceField','includeAll','findAll','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x549cac,_0x26f28c){var _0x2e375e=function(_0xbe280b){while(--_0xbe280b){_0x549cac['push'](_0x549cac['shift']());}};_0x2e375e(++_0x26f28c);}(_0x11f6,0x78));var _0x611f=function(_0x1b766d,_0x466c05){_0x1b766d=_0x1b766d-0x0;var _0x572823=_0x11f6[_0x1b766d];return _0x572823;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x611f('0x0'));var zipdir=require(_0x611f('0x1'));var jsonpatch=require(_0x611f('0x2'));var rp=require(_0x611f('0x3'));var moment=require(_0x611f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x611f('0x5'));var util=require(_0x611f('0x6'));var path=require(_0x611f('0x7'));var sox=require(_0x611f('0x8'));var csv=require(_0x611f('0x9'));var ejs=require(_0x611f('0xa'));var fs=require('fs');var _=require(_0x611f('0xb'));var squel=require(_0x611f('0xc'));var crypto=require(_0x611f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x611f('0x9'));var querystring=require(_0x611f('0xe'));var Papa=require(_0x611f('0xf'));var Redis=require(_0x611f('0x10'));var authService=require(_0x611f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x611f('0x12'));var hardwareService=require(_0x611f('0x13'));var logger=require(_0x611f('0x14'))(_0x611f('0x15'));var utils=require(_0x611f('0x16'));var config=require('../../config/environment');var db=require(_0x611f('0x17'))['db'];function respondWithStatusCode(_0x420ec8,_0x547a1e){_0x547a1e=_0x547a1e||0xcc;return function(_0x2779de){if(_0x2779de){return _0x420ec8[_0x611f('0x18')](_0x547a1e);}return _0x420ec8['status'](_0x547a1e)['end']();};}function respondWithResult(_0x5317e7,_0x22757a){_0x22757a=_0x22757a||0xc8;return function(_0x261646){if(_0x261646){return _0x5317e7[_0x611f('0x19')](_0x22757a)[_0x611f('0x1a')](_0x261646);}};}function respondWithFilteredResult(_0x4de9ac,_0x3d98c6){return function(_0x290a11){if(_0x290a11){var _0x271c77=_0x290a11[_0x611f('0x1b')],_0x2933d6=_0x3d98c6[_0x611f('0x1c')],_0x3496e9=_0x3d98c6['offset']+_0x3d98c6[_0x611f('0x1d')],_0xe5370e;if(_0x3496e9>=_0x271c77){_0x3496e9=_0x271c77;_0xe5370e=0xc8;}else{_0xe5370e=0xce;}_0x4de9ac[_0x611f('0x19')](_0xe5370e);return _0x4de9ac['set']('Content-Range',_0x2933d6+'-'+_0x3496e9+'/'+_0x271c77)[_0x611f('0x1a')](_0x290a11);}return null;};}function patchUpdates(_0x332ce2){return function(_0xed8585){try{jsonpatch['apply'](_0xed8585,_0x332ce2,!![]);}catch(_0x466826){return BPromise['reject'](_0x466826);}return _0xed8585['save']();};}function saveUpdates(_0x55d7e1,_0x16cb3e){return function(_0x4ef8c6){if(_0x4ef8c6){return _0x4ef8c6[_0x611f('0x1e')](_0x55d7e1)[_0x611f('0x1f')](function(_0x1522d8){return _0x1522d8;});}return null;};}function removeEntity(_0x31bc43,_0x130f21){return function(_0x3bf986){if(_0x3bf986){return _0x3bf986[_0x611f('0x20')]()['then'](function(){_0x31bc43[_0x611f('0x19')](0xcc)[_0x611f('0x21')]();});}};}function handleEntityNotFound(_0x39f254,_0x98a902){return function(_0xd9b7f9){if(!_0xd9b7f9){_0x39f254[_0x611f('0x18')](0x194);}return _0xd9b7f9;};}function handleError(_0x363633,_0x405fe0){_0x405fe0=_0x405fe0||0x1f4;return function(_0x5e6ed1){logger[_0x611f('0x22')](_0x5e6ed1[_0x611f('0x23')]);if(_0x5e6ed1[_0x611f('0x24')]){delete _0x5e6ed1[_0x611f('0x24')];}_0x363633[_0x611f('0x19')](_0x405fe0)[_0x611f('0x25')](_0x5e6ed1);};}exports[_0x611f('0x26')]=function(_0x3bfdd6,_0x584e04){var _0x26c48f={},_0x443cb2={},_0x59acec={'count':0x0,'rows':[]};var _0x2423ab=_[_0x611f('0x27')](db['SalesforceField'][_0x611f('0x28')],function(_0x172aaf){return{'name':_0x172aaf['fieldName'],'type':_0x172aaf[_0x611f('0x29')]['key']};});_0x443cb2[_0x611f('0x2a')]=_[_0x611f('0x27')](_0x2423ab,_0x611f('0x24'));_0x443cb2[_0x611f('0x2b')]=_[_0x611f('0x2c')](_0x3bfdd6[_0x611f('0x2b')]);_0x443cb2['filters']=_[_0x611f('0x2d')](_0x443cb2['model'],_0x443cb2['query']);_0x26c48f['attributes']=_[_0x611f('0x2d')](_0x443cb2['model'],qs[_0x611f('0x2e')](_0x3bfdd6['query']['fields']));_0x26c48f[_0x611f('0x2f')]=_0x26c48f[_0x611f('0x2f')][_0x611f('0x30')]?_0x26c48f[_0x611f('0x2f')]:_0x443cb2[_0x611f('0x2a')];if(!_0x3bfdd6[_0x611f('0x2b')][_0x611f('0x31')](_0x611f('0x32'))){_0x26c48f[_0x611f('0x1d')]=qs['limit'](_0x3bfdd6['query'][_0x611f('0x1d')]);_0x26c48f[_0x611f('0x1c')]=qs[_0x611f('0x1c')](_0x3bfdd6[_0x611f('0x2b')][_0x611f('0x1c')]);}_0x26c48f[_0x611f('0x33')]=qs[_0x611f('0x34')](_0x3bfdd6[_0x611f('0x2b')][_0x611f('0x34')]);_0x26c48f['where']=qs['filters'](_['pick'](_0x3bfdd6[_0x611f('0x2b')],_0x443cb2[_0x611f('0x35')]),_0x2423ab);if(_0x3bfdd6[_0x611f('0x2b')]['filter']){_0x26c48f[_0x611f('0x36')]=_[_0x611f('0x37')](_0x26c48f[_0x611f('0x36')],{'$or':_[_0x611f('0x27')](_0x2423ab,function(_0x21f1e8){if(_0x21f1e8[_0x611f('0x29')]!==_0x611f('0x38')){var _0x29a9c4={};_0x29a9c4[_0x21f1e8[_0x611f('0x24')]]={'$like':'%'+_0x3bfdd6[_0x611f('0x2b')]['filter']+'%'};return _0x29a9c4;}})});}_0x26c48f=_[_0x611f('0x37')]({},_0x26c48f,_0x3bfdd6[_0x611f('0x39')]);var _0x381673={'where':_0x26c48f[_0x611f('0x36')]};return db[_0x611f('0x3a')][_0x611f('0x1b')](_0x381673)[_0x611f('0x1f')](function(_0x1d1a0e){_0x59acec[_0x611f('0x1b')]=_0x1d1a0e;if(_0x3bfdd6[_0x611f('0x2b')][_0x611f('0x3b')]){_0x26c48f['include']=[{'all':!![]}];}return db[_0x611f('0x3a')][_0x611f('0x3c')](_0x26c48f);})['then'](function(_0x11d5c4){_0x59acec['rows']=_0x11d5c4;return _0x59acec;})[_0x611f('0x1f')](respondWithFilteredResult(_0x584e04,_0x26c48f))[_0x611f('0x3d')](handleError(_0x584e04,null));};exports[_0x611f('0x3e')]=function(_0x19041e,_0x3ea0c0){var _0x334984={'raw':!![],'where':{'id':_0x19041e[_0x611f('0x3f')]['id']}},_0x5df865={};_0x5df865['model']=_[_0x611f('0x2c')](db[_0x611f('0x3a')]['rawAttributes']);_0x5df865[_0x611f('0x2b')]=_[_0x611f('0x2c')](_0x19041e[_0x611f('0x2b')]);_0x5df865[_0x611f('0x35')]=_[_0x611f('0x2d')](_0x5df865[_0x611f('0x2a')],_0x5df865[_0x611f('0x2b')]);_0x334984[_0x611f('0x2f')]=_[_0x611f('0x2d')](_0x5df865['model'],qs[_0x611f('0x2e')](_0x19041e[_0x611f('0x2b')][_0x611f('0x2e')]));_0x334984[_0x611f('0x2f')]=_0x334984[_0x611f('0x2f')]['length']?_0x334984[_0x611f('0x2f')]:_0x5df865[_0x611f('0x2a')];if(_0x19041e['query'][_0x611f('0x3b')]){_0x334984[_0x611f('0x40')]=[{'all':!![]}];}_0x334984=_['merge']({},_0x334984,_0x19041e[_0x611f('0x39')]);return db[_0x611f('0x3a')][_0x611f('0x41')](_0x334984)['then'](handleEntityNotFound(_0x3ea0c0,null))[_0x611f('0x1f')](respondWithResult(_0x3ea0c0,null))['catch'](handleError(_0x3ea0c0,null));};exports[_0x611f('0x42')]=function(_0x272500,_0x228500){return db[_0x611f('0x3a')]['create'](_0x272500['body'],{})[_0x611f('0x1f')](respondWithResult(_0x228500,0xc9))[_0x611f('0x3d')](handleError(_0x228500,null));};exports[_0x611f('0x1e')]=function(_0x544aea,_0x3b59e5){if(_0x544aea[_0x611f('0x43')]['id']){delete _0x544aea[_0x611f('0x43')]['id'];}return db[_0x611f('0x3a')][_0x611f('0x41')]({'where':{'id':_0x544aea['params']['id']}})[_0x611f('0x1f')](handleEntityNotFound(_0x3b59e5,null))[_0x611f('0x1f')](saveUpdates(_0x544aea['body'],null))['then'](respondWithResult(_0x3b59e5,null))[_0x611f('0x3d')](handleError(_0x3b59e5,null));};exports['destroy']=function(_0x155d36,_0x426723){return db['SalesforceField'][_0x611f('0x41')]({'where':{'id':_0x155d36[_0x611f('0x3f')]['id']}})[_0x611f('0x1f')](handleEntityNotFound(_0x426723,null))[_0x611f('0x1f')](removeEntity(_0x426723,null))['catch'](handleError(_0x426723,null));}; \ No newline at end of file +var _0x9c3d=['apply','reject','save','update','destroy','then','sendStatus','error','stack','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','count','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','offset','limit','set','Content-Range','json'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x9c3d,0xb6));var _0xd9c3=function(_0x3fd165,_0x5e2e2f){_0x3fd165=_0x3fd165-0x0;var _0x50f970=_0x9c3d[_0x3fd165];return _0x50f970;};'use strict';var pdf=require(_0xd9c3('0x0'));var emlformat=require(_0xd9c3('0x1'));var rimraf=require(_0xd9c3('0x2'));var zipdir=require(_0xd9c3('0x3'));var jsonpatch=require(_0xd9c3('0x4'));var rp=require(_0xd9c3('0x5'));var moment=require(_0xd9c3('0x6'));var BPromise=require(_0xd9c3('0x7'));var Mustache=require(_0xd9c3('0x8'));var util=require('util');var path=require(_0xd9c3('0x9'));var sox=require(_0xd9c3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9c3('0xb'));var jsforce=require(_0xd9c3('0xc'));var deskjs=require(_0xd9c3('0xd'));var toCsv=require(_0xd9c3('0xe'));var querystring=require(_0xd9c3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd9c3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9c3('0x12'))(_0xd9c3('0x13'));var utils=require('../../config/utils');var config=require(_0xd9c3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184d82,_0x5d74bd){_0x5d74bd=_0x5d74bd||0xcc;return function(_0x22bd4a){if(_0x22bd4a){return _0x184d82['sendStatus'](_0x5d74bd);}return _0x184d82[_0xd9c3('0x15')](_0x5d74bd)[_0xd9c3('0x16')]();};}function respondWithResult(_0x565133,_0x3dfc3e){_0x3dfc3e=_0x3dfc3e||0xc8;return function(_0x1f990f){if(_0x1f990f){return _0x565133[_0xd9c3('0x15')](_0x3dfc3e)['json'](_0x1f990f);}};}function respondWithFilteredResult(_0x3e7502,_0x10a92d){return function(_0x517228){if(_0x517228){var _0x5a9376=_0x517228['count'],_0xffe8be=_0x10a92d[_0xd9c3('0x17')],_0x371c04=_0x10a92d[_0xd9c3('0x17')]+_0x10a92d[_0xd9c3('0x18')],_0x3138ea;if(_0x371c04>=_0x5a9376){_0x371c04=_0x5a9376;_0x3138ea=0xc8;}else{_0x3138ea=0xce;}_0x3e7502[_0xd9c3('0x15')](_0x3138ea);return _0x3e7502[_0xd9c3('0x19')](_0xd9c3('0x1a'),_0xffe8be+'-'+_0x371c04+'/'+_0x5a9376)[_0xd9c3('0x1b')](_0x517228);}return null;};}function patchUpdates(_0x5a6815){return function(_0x7d46ea){try{jsonpatch[_0xd9c3('0x1c')](_0x7d46ea,_0x5a6815,!![]);}catch(_0x42d1de){return BPromise[_0xd9c3('0x1d')](_0x42d1de);}return _0x7d46ea[_0xd9c3('0x1e')]();};}function saveUpdates(_0xa6db1f,_0x5f1c39){return function(_0x61f757){if(_0x61f757){return _0x61f757[_0xd9c3('0x1f')](_0xa6db1f)['then'](function(_0x325c23){return _0x325c23;});}return null;};}function removeEntity(_0x55fd5d,_0x1489be){return function(_0x1d2be8){if(_0x1d2be8){return _0x1d2be8[_0xd9c3('0x20')]()[_0xd9c3('0x21')](function(){_0x55fd5d['status'](0xcc)[_0xd9c3('0x16')]();});}};}function handleEntityNotFound(_0x270e41,_0x1c4146){return function(_0x3d5a62){if(!_0x3d5a62){_0x270e41[_0xd9c3('0x22')](0x194);}return _0x3d5a62;};}function handleError(_0x4eadf0,_0x2be0ba){_0x2be0ba=_0x2be0ba||0x1f4;return function(_0x4ca8ff){logger[_0xd9c3('0x23')](_0x4ca8ff[_0xd9c3('0x24')]);if(_0x4ca8ff['name']){delete _0x4ca8ff['name'];}_0x4eadf0[_0xd9c3('0x15')](_0x2be0ba)['send'](_0x4ca8ff);};}exports[_0xd9c3('0x25')]=function(_0x3a055b,_0x439f6a){var _0x10cdc4={},_0x35bc65={},_0x2fbb43={'count':0x0,'rows':[]};var _0x2212f0=_[_0xd9c3('0x26')](db[_0xd9c3('0x27')][_0xd9c3('0x28')],function(_0x1adc91){return{'name':_0x1adc91[_0xd9c3('0x29')],'type':_0x1adc91[_0xd9c3('0x2a')][_0xd9c3('0x2b')]};});_0x35bc65[_0xd9c3('0x2c')]=_['map'](_0x2212f0,_0xd9c3('0x2d'));_0x35bc65['query']=_[_0xd9c3('0x2e')](_0x3a055b[_0xd9c3('0x2f')]);_0x35bc65[_0xd9c3('0x30')]=_[_0xd9c3('0x31')](_0x35bc65[_0xd9c3('0x2c')],_0x35bc65['query']);_0x10cdc4[_0xd9c3('0x32')]=_['intersection'](_0x35bc65[_0xd9c3('0x2c')],qs['fields'](_0x3a055b[_0xd9c3('0x2f')][_0xd9c3('0x33')]));_0x10cdc4[_0xd9c3('0x32')]=_0x10cdc4[_0xd9c3('0x32')][_0xd9c3('0x34')]?_0x10cdc4[_0xd9c3('0x32')]:_0x35bc65[_0xd9c3('0x2c')];if(!_0x3a055b[_0xd9c3('0x2f')]['hasOwnProperty'](_0xd9c3('0x35'))){_0x10cdc4['limit']=qs[_0xd9c3('0x18')](_0x3a055b['query']['limit']);_0x10cdc4[_0xd9c3('0x17')]=qs[_0xd9c3('0x17')](_0x3a055b[_0xd9c3('0x2f')][_0xd9c3('0x17')]);}_0x10cdc4['order']=qs[_0xd9c3('0x36')](_0x3a055b['query'][_0xd9c3('0x36')]);_0x10cdc4[_0xd9c3('0x37')]=qs[_0xd9c3('0x30')](_[_0xd9c3('0x38')](_0x3a055b[_0xd9c3('0x2f')],_0x35bc65[_0xd9c3('0x30')]),_0x2212f0);if(_0x3a055b[_0xd9c3('0x2f')]['filter']){_0x10cdc4[_0xd9c3('0x37')]=_[_0xd9c3('0x39')](_0x10cdc4[_0xd9c3('0x37')],{'$or':_['map'](_0x2212f0,function(_0x4e7705){if(_0x4e7705['type']!==_0xd9c3('0x3a')){var _0x558eb4={};_0x558eb4[_0x4e7705[_0xd9c3('0x2d')]]={'$like':'%'+_0x3a055b[_0xd9c3('0x2f')]['filter']+'%'};return _0x558eb4;}})});}_0x10cdc4=_['merge']({},_0x10cdc4,_0x3a055b[_0xd9c3('0x3b')]);var _0x555433={'where':_0x10cdc4[_0xd9c3('0x37')]};return db['SalesforceField']['count'](_0x555433)['then'](function(_0x197035){_0x2fbb43[_0xd9c3('0x3c')]=_0x197035;if(_0x3a055b[_0xd9c3('0x2f')]['includeAll']){_0x10cdc4['include']=[{'all':!![]}];}return db[_0xd9c3('0x27')]['findAll'](_0x10cdc4);})[_0xd9c3('0x21')](function(_0x45e3b9){_0x2fbb43[_0xd9c3('0x3d')]=_0x45e3b9;return _0x2fbb43;})[_0xd9c3('0x21')](respondWithFilteredResult(_0x439f6a,_0x10cdc4))[_0xd9c3('0x3e')](handleError(_0x439f6a,null));};exports[_0xd9c3('0x3f')]=function(_0x5075b9,_0x84ec91){var _0x17c4cb={'raw':!![],'where':{'id':_0x5075b9[_0xd9c3('0x40')]['id']}},_0x1170a3={};_0x1170a3['model']=_[_0xd9c3('0x2e')](db[_0xd9c3('0x27')][_0xd9c3('0x28')]);_0x1170a3[_0xd9c3('0x2f')]=_[_0xd9c3('0x2e')](_0x5075b9[_0xd9c3('0x2f')]);_0x1170a3['filters']=_['intersection'](_0x1170a3['model'],_0x1170a3[_0xd9c3('0x2f')]);_0x17c4cb[_0xd9c3('0x32')]=_[_0xd9c3('0x31')](_0x1170a3['model'],qs[_0xd9c3('0x33')](_0x5075b9['query'][_0xd9c3('0x33')]));_0x17c4cb[_0xd9c3('0x32')]=_0x17c4cb[_0xd9c3('0x32')][_0xd9c3('0x34')]?_0x17c4cb['attributes']:_0x1170a3[_0xd9c3('0x2c')];if(_0x5075b9[_0xd9c3('0x2f')][_0xd9c3('0x41')]){_0x17c4cb[_0xd9c3('0x42')]=[{'all':!![]}];}_0x17c4cb=_[_0xd9c3('0x39')]({},_0x17c4cb,_0x5075b9[_0xd9c3('0x3b')]);return db[_0xd9c3('0x27')][_0xd9c3('0x43')](_0x17c4cb)[_0xd9c3('0x21')](handleEntityNotFound(_0x84ec91,null))[_0xd9c3('0x21')](respondWithResult(_0x84ec91,null))['catch'](handleError(_0x84ec91,null));};exports['create']=function(_0x29c046,_0x487568){return db[_0xd9c3('0x27')][_0xd9c3('0x44')](_0x29c046[_0xd9c3('0x45')],{})[_0xd9c3('0x21')](respondWithResult(_0x487568,0xc9))[_0xd9c3('0x3e')](handleError(_0x487568,null));};exports[_0xd9c3('0x1f')]=function(_0x55d5b7,_0x177732){if(_0x55d5b7[_0xd9c3('0x45')]['id']){delete _0x55d5b7[_0xd9c3('0x45')]['id'];}return db[_0xd9c3('0x27')][_0xd9c3('0x43')]({'where':{'id':_0x55d5b7[_0xd9c3('0x40')]['id']}})[_0xd9c3('0x21')](handleEntityNotFound(_0x177732,null))[_0xd9c3('0x21')](saveUpdates(_0x55d5b7[_0xd9c3('0x45')],null))[_0xd9c3('0x21')](respondWithResult(_0x177732,null))[_0xd9c3('0x3e')](handleError(_0x177732,null));};exports[_0xd9c3('0x20')]=function(_0x13249a,_0x4ad8e9){return db[_0xd9c3('0x27')][_0xd9c3('0x43')]({'where':{'id':_0x13249a['params']['id']}})[_0xd9c3('0x21')](handleEntityNotFound(_0x4ad8e9,null))[_0xd9c3('0x21')](removeEntity(_0x4ad8e9,null))[_0xd9c3('0x3e')](handleError(_0x4ad8e9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index aa927d1..802ac10 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 _0x3098=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3098,0xc3));var _0x8309=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x3098[_0x595bd1];return _0xd0344f;};'use strict';var _=require('lodash');var util=require(_0x8309('0x0'));var logger=require(_0x8309('0x1'))('api');var moment=require(_0x8309('0x2'));var BPromise=require(_0x8309('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8309('0x4'));var config=require(_0x8309('0x5'));var attributes=require(_0x8309('0x6'));module['exports']=function(_0x2df53d,_0x4270f6){return _0x2df53d[_0x8309('0x7')](_0x8309('0x8'),attributes,{'tableName':_0x8309('0x9'),'paranoid':![],'indexes':[{'name':_0x8309('0xa'),'fields':[_0x8309('0xb'),_0x8309('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9488=['exports','define','SalesforceField','salesforce_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x9488,0x1c5));var _0x8948=function(_0x376dfe,_0x492403){_0x376dfe=_0x376dfe-0x0;var _0x25b98c=_0x9488[_0x376dfe];return _0x25b98c;};'use strict';var _=require('lodash');var util=require(_0x8948('0x0'));var logger=require(_0x8948('0x1'))('api');var moment=require(_0x8948('0x2'));var BPromise=require(_0x8948('0x3'));var rp=require(_0x8948('0x4'));var fs=require('fs');var path=require(_0x8948('0x5'));var rimraf=require(_0x8948('0x6'));var config=require(_0x8948('0x7'));var attributes=require(_0x8948('0x8'));module[_0x8948('0x9')]=function(_0x6f75c,_0x3176a5){return _0x6f75c[_0x8948('0xa')](_0x8948('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x8948('0xc'),'fields':[_0x8948('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 991f964..50be1d6 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a6b2c,_0x3392de){var _0x27deef=function(_0x48f48a){while(--_0x48f48a){_0x4a6b2c['push'](_0x4a6b2c['shift']());}};_0x27deef(++_0x3392de);}(_0xe706,0xa3));var _0x6e70=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xe706[_0x1c9c24];return _0x349c69;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x1d81e9,_0x2065aa){var _0x2bbc33=function(_0x56c6b2){while(--_0x56c6b2){_0x1d81e9['push'](_0x1d81e9['shift']());}};_0x2bbc33(++_0x2065aa);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1b46d2,_0x1211b1){_0x1b46d2=_0x1b46d2-0x0;var _0x1608ea=_0x9ffd[_0x1b46d2];return _0x1608ea;};'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']('SalesforceField,\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')]('SalesforceField,\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')]('SalesforceField,\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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f1df19a..e3d6476 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 _0x2b67=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy'];(function(_0x402d6b,_0x1f8c7f){var _0x3c2631=function(_0x2aaff2){while(--_0x2aaff2){_0x402d6b['push'](_0x402d6b['shift']());}};_0x3c2631(++_0x1f8c7f);}(_0x2b67,0xf3));var _0x72b6=function(_0x293e45,_0x18d760){_0x293e45=_0x293e45-0x0;var _0x1ede91=_0x2b67[_0x293e45];return _0x1ede91;};'use strict';var multer=require(_0x72b6('0x0'));var util=require(_0x72b6('0x1'));var path=require(_0x72b6('0x2'));var timeout=require(_0x72b6('0x3'));var express=require(_0x72b6('0x4'));var router=express[_0x72b6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x72b6('0x6'));var config=require('../../config/environment');var controller=require(_0x72b6('0x7'));router[_0x72b6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x72b6('0x9'),auth[_0x72b6('0xa')](),controller[_0x72b6('0xb')]);router[_0x72b6('0x8')](_0x72b6('0xc'),auth['isAuthenticated'](),controller[_0x72b6('0xd')]);router[_0x72b6('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x72b6('0xe')]);router[_0x72b6('0xf')]('/',auth[_0x72b6('0xa')](),controller[_0x72b6('0x10')]);router[_0x72b6('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x72b6('0x11')](_0x72b6('0x9'),auth[_0x72b6('0xa')](),controller[_0x72b6('0x12')]);router[_0x72b6('0x13')](_0x72b6('0x9'),auth[_0x72b6('0xa')](),controller[_0x72b6('0x14')]);module[_0x72b6('0x15')]=router; \ No newline at end of file +var _0x9b67=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b67,0xf6));var _0x79b6=function(_0x15cbda,_0x2c3973){_0x15cbda=_0x15cbda-0x0;var _0x15fb0f=_0x9b67[_0x15cbda];return _0x15fb0f;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var auth=require(_0x79b6('0x5'));var interaction=require(_0x79b6('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x79b6('0x7')]('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x9')]);router[_0x79b6('0x7')](_0x79b6('0xa'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xb')]);router['get'](_0x79b6('0xc'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xd')]);router[_0x79b6('0x7')](_0x79b6('0xe'),auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')]('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x11')]);router['post']('/:id/configurations',auth[_0x79b6('0x8')](),controller[_0x79b6('0x12')]);router[_0x79b6('0x13')]('/:id',auth[_0x79b6('0x8')](),controller[_0x79b6('0x14')]);router[_0x79b6('0x15')](_0x79b6('0xa'),auth[_0x79b6('0x8')](),controller[_0x79b6('0x16')]);module[_0x79b6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index bb38908..e44791e 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 _0xe135=['username','sequelize','exports','STRING'];(function(_0x2870ae,_0x49a081){var _0x19a548=function(_0x1f69d2){while(--_0x1f69d2){_0x2870ae['push'](_0x2870ae['shift']());}};_0x19a548(++_0x49a081);}(_0xe135,0x131));var _0x5e13=function(_0x4eb517,_0x385479){_0x4eb517=_0x4eb517-0x0;var _0x30e9ed=_0xe135[_0x4eb517];return _0x30e9ed;};'use strict';var Sequelize=require(_0x5e13('0x0'));module[_0x5e13('0x1')]={'name':{'type':Sequelize[_0x5e13('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5e13('0x2')],'unique':_0x5e13('0x3')},'password':{'type':Sequelize[_0x5e13('0x2')]},'email':{'type':Sequelize[_0x5e13('0x2')]},'remoteUri':{'type':Sequelize[_0x5e13('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x5e13('0x2')]}}; \ No newline at end of file +var _0xb854=['username','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb854,0x1b1));var _0x4b85=function(_0x4eb42d,_0x195d5c){_0x4eb42d=_0x4eb42d-0x0;var _0x46c92c=_0xb854[_0x4eb42d];return _0x46c92c;};'use strict';var Sequelize=require(_0x4b85('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b85('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4b85('0x1')],'unique':_0x4b85('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4b85('0x1')]},'remoteUri':{'type':Sequelize[_0x4b85('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4b85('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 027c5cd..14940e4 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 _0xe00b=['create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','parent','caused_by','upon_reject','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','closed_at','delivery_plan','impact','active','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/table/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','value','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','ServicenowAccount','include','findAll','show','params','includeAll','options','find'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xe00b,0x13a));var _0xbe00=function(_0x3bdc5f,_0x3107ca){_0x3bdc5f=_0x3bdc5f-0x0;var _0x1634ec=_0xe00b[_0x3bdc5f];return _0x1634ec;};'use strict';var pdf=require(_0xbe00('0x0'));var emlformat=require(_0xbe00('0x1'));var rimraf=require(_0xbe00('0x2'));var zipdir=require(_0xbe00('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe00('0x4'));var moment=require(_0xbe00('0x5'));var BPromise=require(_0xbe00('0x6'));var Mustache=require(_0xbe00('0x7'));var util=require(_0xbe00('0x8'));var path=require(_0xbe00('0x9'));var sox=require(_0xbe00('0xa'));var csv=require('to-csv');var ejs=require(_0xbe00('0xb'));var fs=require('fs');var _=require(_0xbe00('0xc'));var squel=require(_0xbe00('0xd'));var crypto=require(_0xbe00('0xe'));var jsforce=require(_0xbe00('0xf'));var deskjs=require(_0xbe00('0x10'));var toCsv=require(_0xbe00('0x11'));var querystring=require(_0xbe00('0x12'));var Papa=require(_0xbe00('0x13'));var Redis=require(_0xbe00('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbe00('0x15'));var as=require(_0xbe00('0x16'));var hardwareService=require(_0xbe00('0x17'));var logger=require('../../config/logger')(_0xbe00('0x18'));var utils=require(_0xbe00('0x19'));var config=require(_0xbe00('0x1a'));var db=require(_0xbe00('0x1b'))['db'];var integrations=require(_0xbe00('0x1c'));var jayson=require(_0xbe00('0x1d'));var client=jayson[_0xbe00('0x1e')][_0xbe00('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x2a7e59,_0x3628ed,_0x3ff357){if(_0x3ff357){var _0x105d1b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x105d1b[_0xbe00('0x20')](_0x3628ed)){return _0x2a7e59;}else{throw new db[(_0xbe00('0x21'))]['ValidationError'](_0xbe00('0x22'));}}else{return _0x2a7e59;}}function respondWithRpcPromise(_0x2eda11,_0x462e8d,_0x5729fe,_0x596d65){return new BPromise(function(_0x514de2,_0x573d56){var _0x3f742b=_0x596d65||client;return _0x3f742b[_0xbe00('0x23')](_0x2eda11,_0x5729fe)[_0xbe00('0x24')](function(_0x2e8da7){logger[_0xbe00('0x25')](_0xbe00('0x26'),_0x462e8d,_0xbe00('0x27'));logger[_0xbe00('0x28')](_0xbe00('0x29'),_0x462e8d,_0xbe00('0x27'),JSON[_0xbe00('0x2a')](_0x2e8da7));if(_0x2e8da7[_0xbe00('0x2b')]){if(_0x2e8da7[_0xbe00('0x2b')][_0xbe00('0x2c')]===0x1f4){logger[_0xbe00('0x2b')](_0xbe00('0x26'),_0x462e8d,_0x2e8da7[_0xbe00('0x2b')][_0xbe00('0x2d')]);return _0x573d56(_0x2e8da7[_0xbe00('0x2b')][_0xbe00('0x2d')]);}logger[_0xbe00('0x2b')]('ServicenowAccount,\x20%s,\x20%s',_0x462e8d,_0x2e8da7[_0xbe00('0x2b')][_0xbe00('0x2d')]);return _0x514de2(_0x2e8da7[_0xbe00('0x2b')]['message']);}else{logger[_0xbe00('0x25')](_0xbe00('0x26'),_0x462e8d,_0xbe00('0x27'));_0x514de2(_0x2e8da7[_0xbe00('0x2e')][_0xbe00('0x2d')]);}})[_0xbe00('0x2f')](function(_0x105860){logger[_0xbe00('0x2b')]('ServicenowAccount,\x20%s,\x20%s',_0x462e8d,_0x105860);_0x573d56(_0x105860);});});}function respondWithStatusCode(_0x2c32cb,_0x25bea3){_0x25bea3=_0x25bea3||0xcc;return function(_0x3aa0dd){if(_0x3aa0dd){return _0x2c32cb[_0xbe00('0x30')](_0x25bea3);}return _0x2c32cb['status'](_0x25bea3)[_0xbe00('0x31')]();};}function respondWithResult(_0x3ace2d,_0x1cb1b7){_0x1cb1b7=_0x1cb1b7||0xc8;return function(_0x1d32b2){if(_0x1d32b2){return _0x3ace2d['status'](_0x1cb1b7)[_0xbe00('0x32')](_0x1d32b2);}};}function respondWithFilteredResult(_0x27ccc3,_0x280936){return function(_0x20f006){if(_0x20f006){var _0x334a46=_0x20f006[_0xbe00('0x33')],_0x136ed6=_0x280936[_0xbe00('0x34')],_0x364098=_0x280936[_0xbe00('0x34')]+_0x280936[_0xbe00('0x35')],_0x30f1b4;if(_0x364098>=_0x334a46){_0x364098=_0x334a46;_0x30f1b4=0xc8;}else{_0x30f1b4=0xce;}_0x27ccc3['status'](_0x30f1b4);return _0x27ccc3[_0xbe00('0x36')](_0xbe00('0x37'),_0x136ed6+'-'+_0x364098+'/'+_0x334a46)[_0xbe00('0x32')](_0x20f006);}return null;};}function patchUpdates(_0x2e0ba1){return function(_0x4db555){try{jsonpatch[_0xbe00('0x38')](_0x4db555,_0x2e0ba1,!![]);}catch(_0x576da6){return BPromise[_0xbe00('0x39')](_0x576da6);}return _0x4db555[_0xbe00('0x3a')]();};}function saveUpdates(_0x4f5dae,_0x38b2c9){return function(_0x3a6f28){if(_0x3a6f28){return _0x3a6f28['update'](_0x4f5dae)[_0xbe00('0x24')](function(_0x2b00f4){return _0x2b00f4;});}return null;};}function removeEntity(_0x5ef896,_0x45e6a8){return function(_0x4b8dbb){if(_0x4b8dbb){return _0x4b8dbb[_0xbe00('0x3b')]()[_0xbe00('0x24')](function(){_0x5ef896[_0xbe00('0x3c')](0xcc)[_0xbe00('0x31')]();});}};}function handleEntityNotFound(_0x3ae4c7,_0x351c9c){return function(_0x1b21c7){if(!_0x1b21c7){_0x3ae4c7[_0xbe00('0x30')](0x194);}return _0x1b21c7;};}function handleError(_0x25cd37,_0x26c1ec){_0x26c1ec=_0x26c1ec||0x1f4;return function(_0x209248){logger['error'](_0x209248[_0xbe00('0x3d')]);if(_0x209248[_0xbe00('0x3e')]){delete _0x209248[_0xbe00('0x3e')];}_0x25cd37[_0xbe00('0x3c')](_0x26c1ec)[_0xbe00('0x3f')](_0x209248);};}exports[_0xbe00('0x40')]=function(_0x2b77b9,_0x3dfe0e){var _0x3eb21c={},_0x243a67={},_0x1e112a={'count':0x0,'rows':[]};var _0x257cfa=_[_0xbe00('0x41')](db['ServicenowAccount'][_0xbe00('0x42')],function(_0x389633){return{'name':_0x389633[_0xbe00('0x43')],'type':_0x389633['type']['key']};});_0x243a67[_0xbe00('0x44')]=_[_0xbe00('0x41')](_0x257cfa,_0xbe00('0x3e'));_0x243a67[_0xbe00('0x45')]=_[_0xbe00('0x46')](_0x2b77b9[_0xbe00('0x45')]);_0x243a67[_0xbe00('0x47')]=_[_0xbe00('0x48')](_0x243a67['model'],_0x243a67[_0xbe00('0x45')]);_0x3eb21c['attributes']=_[_0xbe00('0x48')](_0x243a67['model'],qs[_0xbe00('0x49')](_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x49')]));_0x3eb21c[_0xbe00('0x4a')]=_0x3eb21c[_0xbe00('0x4a')][_0xbe00('0x4b')]?_0x3eb21c['attributes']:_0x243a67[_0xbe00('0x44')];if(!_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x4c')](_0xbe00('0x4d'))){_0x3eb21c[_0xbe00('0x35')]=qs[_0xbe00('0x35')](_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x35')]);_0x3eb21c[_0xbe00('0x34')]=qs[_0xbe00('0x34')](_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x34')]);}_0x3eb21c[_0xbe00('0x4e')]=qs[_0xbe00('0x4f')](_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x4f')]);_0x3eb21c['where']=qs[_0xbe00('0x47')](_[_0xbe00('0x50')](_0x2b77b9[_0xbe00('0x45')],_0x243a67['filters']),_0x257cfa);if(_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x51')]){_0x3eb21c[_0xbe00('0x52')]=_['merge'](_0x3eb21c['where'],{'$or':_['map'](_0x257cfa,function(_0x1f389b){if(_0x1f389b[_0xbe00('0x53')]!==_0xbe00('0x54')){var _0x201bd8={};_0x201bd8[_0x1f389b['name']]={'$like':'%'+_0x2b77b9[_0xbe00('0x45')][_0xbe00('0x51')]+'%'};return _0x201bd8;}})});}_0x3eb21c=_[_0xbe00('0x55')]({},_0x3eb21c,_0x2b77b9['options']);var _0x506f7e={'where':_0x3eb21c['where']};return db[_0xbe00('0x56')]['count'](_0x506f7e)[_0xbe00('0x24')](function(_0x488803){_0x1e112a['count']=_0x488803;if(_0x2b77b9['query']['includeAll']){_0x3eb21c[_0xbe00('0x57')]=[{'all':!![]}];}return db[_0xbe00('0x56')][_0xbe00('0x58')](_0x3eb21c);})[_0xbe00('0x24')](function(_0x38c150){_0x1e112a['rows']=_0x38c150;return _0x1e112a;})[_0xbe00('0x24')](respondWithFilteredResult(_0x3dfe0e,_0x3eb21c))[_0xbe00('0x2f')](handleError(_0x3dfe0e,null));};exports[_0xbe00('0x59')]=function(_0x4e5772,_0x41641f){var _0x232190={'raw':![],'where':{'id':_0x4e5772[_0xbe00('0x5a')]['id']}},_0x4b6d25={};_0x4b6d25[_0xbe00('0x44')]=_[_0xbe00('0x46')](db[_0xbe00('0x56')][_0xbe00('0x42')]);_0x4b6d25[_0xbe00('0x45')]=_[_0xbe00('0x46')](_0x4e5772['query']);_0x4b6d25[_0xbe00('0x47')]=_['intersection'](_0x4b6d25[_0xbe00('0x44')],_0x4b6d25[_0xbe00('0x45')]);_0x232190[_0xbe00('0x4a')]=_[_0xbe00('0x48')](_0x4b6d25[_0xbe00('0x44')],qs['fields'](_0x4e5772['query'][_0xbe00('0x49')]));_0x232190[_0xbe00('0x4a')]=_0x232190['attributes'][_0xbe00('0x4b')]?_0x232190[_0xbe00('0x4a')]:_0x4b6d25[_0xbe00('0x44')];if(_0x4e5772[_0xbe00('0x45')][_0xbe00('0x5b')]){_0x232190['include']=[{'all':!![]}];}_0x232190=_['merge']({},_0x232190,_0x4e5772[_0xbe00('0x5c')]);return db[_0xbe00('0x56')][_0xbe00('0x5d')](_0x232190)['then'](handleEntityNotFound(_0x41641f,null))['then'](respondWithResult(_0x41641f,null))[_0xbe00('0x2f')](handleError(_0x41641f,null));};exports[_0xbe00('0x5e')]=function(_0x433acd,_0x4bc04e){return db['ServicenowAccount']['create'](_0x433acd[_0xbe00('0x5f')],{})[_0xbe00('0x24')](respondWithResult(_0x4bc04e,0xc9))['catch'](handleError(_0x4bc04e,null));};exports['update']=function(_0x143038,_0x46049a){if(_0x143038[_0xbe00('0x5f')]['id']){delete _0x143038[_0xbe00('0x5f')]['id'];}return db['ServicenowAccount'][_0xbe00('0x5d')]({'where':{'id':_0x143038[_0xbe00('0x5a')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x46049a,null))[_0xbe00('0x24')](saveUpdates(_0x143038['body'],null))[_0xbe00('0x24')](respondWithResult(_0x46049a,null))[_0xbe00('0x2f')](handleError(_0x46049a,null));};exports[_0xbe00('0x3b')]=function(_0x1dca68,_0x2cddd9){return db['ServicenowAccount'][_0xbe00('0x5d')]({'where':{'id':_0x1dca68[_0xbe00('0x5a')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x2cddd9,null))[_0xbe00('0x24')](removeEntity(_0x2cddd9,null))['catch'](handleError(_0x2cddd9,null));};exports[_0xbe00('0x60')]=function(_0x3058d3,_0x2bc36c,_0x438896){var _0x462dff={};var _0x465822={};var _0x3bfda0;var _0x2a00eb;return db[_0xbe00('0x56')][_0xbe00('0x61')]({'where':{'id':_0x3058d3[_0xbe00('0x5a')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x2bc36c,null))[_0xbe00('0x24')](function(_0x25e9be){if(_0x25e9be){_0x3bfda0=_0x25e9be;_0x465822[_0xbe00('0x44')]=_[_0xbe00('0x46')](db[_0xbe00('0x62')][_0xbe00('0x42')]);_0x465822['query']=_[_0xbe00('0x46')](_0x3058d3['query']);_0x465822[_0xbe00('0x47')]=_[_0xbe00('0x48')](_0x465822['model'],_0x465822[_0xbe00('0x45')]);_0x462dff[_0xbe00('0x4a')]=_[_0xbe00('0x48')](_0x465822[_0xbe00('0x44')],qs[_0xbe00('0x49')](_0x3058d3[_0xbe00('0x45')][_0xbe00('0x49')]));_0x462dff[_0xbe00('0x4a')]=_0x462dff[_0xbe00('0x4a')][_0xbe00('0x4b')]?_0x462dff[_0xbe00('0x4a')]:_0x465822['model'];_0x462dff['order']=qs['sort'](_0x3058d3[_0xbe00('0x45')][_0xbe00('0x4f')]);_0x462dff[_0xbe00('0x52')]=qs[_0xbe00('0x47')](_[_0xbe00('0x50')](_0x3058d3[_0xbe00('0x45')],_0x465822[_0xbe00('0x47')]));if(_0x3058d3['query'][_0xbe00('0x51')]){_0x462dff['where']=_[_0xbe00('0x55')](_0x462dff['where'],{'$or':_['map'](_0x462dff[_0xbe00('0x4a')],function(_0x4ba8f7){var _0x361d01={};_0x361d01[_0x4ba8f7]={'$like':'%'+_0x3058d3[_0xbe00('0x45')][_0xbe00('0x51')]+'%'};return _0x361d01;})});}_0x462dff=_[_0xbe00('0x55')]({},_0x462dff,_0x3058d3['options']);return _0x3bfda0[_0xbe00('0x60')](_0x462dff);}})[_0xbe00('0x24')](function(_0xa1c066){if(_0xa1c066){_0x2a00eb=_0xa1c066[_0xbe00('0x4b')];if(!_0x3058d3[_0xbe00('0x45')]['hasOwnProperty']('nolimit')){_0x462dff[_0xbe00('0x35')]=qs[_0xbe00('0x35')](_0x3058d3['query'][_0xbe00('0x35')]);_0x462dff[_0xbe00('0x34')]=qs[_0xbe00('0x34')](_0x3058d3[_0xbe00('0x45')][_0xbe00('0x34')]);}return _0x3bfda0[_0xbe00('0x60')](_0x462dff);}})['then'](function(_0x465bf3){if(_0x465bf3){return _0x465bf3?{'count':_0x2a00eb,'rows':_0x465bf3}:null;}})[_0xbe00('0x24')](respondWithResult(_0x2bc36c,null))['catch'](handleError(_0x2bc36c,null));};exports[_0xbe00('0x63')]=function(_0x21b7bd,_0x491a81,_0x5b07dd){if(_0x21b7bd[_0xbe00('0x5f')]['id']){delete _0x21b7bd[_0xbe00('0x5f')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x21b7bd[_0xbe00('0x5a')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x491a81,null))['then'](function(_0x254491){if(_0x254491){_0x21b7bd[_0xbe00('0x5f')][_0xbe00('0x64')]=_0x254491['id'];_0x21b7bd[_0xbe00('0x5f')][_0xbe00('0x65')]=integrations[_0xbe00('0x66')](_0x21b7bd['body']['channel'],_0x21b7bd[_0xbe00('0x5f')][_0xbe00('0x53')]);_0x21b7bd[_0xbe00('0x5f')][_0xbe00('0x67')]=integrations[_0xbe00('0x68')](_0x21b7bd['body'][_0xbe00('0x69')],_0x21b7bd[_0xbe00('0x5f')][_0xbe00('0x53')]);return db[_0xbe00('0x62')][_0xbe00('0x5e')](_0x21b7bd[_0xbe00('0x5f')],{'include':[{'model':db[_0xbe00('0x6a')],'as':_0xbe00('0x65')},{'model':db['ServicenowField'],'as':_0xbe00('0x67')}]});}return null;})['then'](respondWithResult(_0x491a81,null))[_0xbe00('0x2f')](handleError(_0x491a81,null));};exports[_0xbe00('0x6b')]=function(_0x37e796,_0x36c764,_0x3c937a){var _0x5d93a2=[_0xbe00('0x6c'),_0xbe00('0x6d'),'knowledge',_0xbe00('0x6e'),_0xbe00('0x6f'),_0xbe00('0x70'),'incident_state','severity','category'];var _0xf1aa2a=[_0xbe00('0x71'),'made_sla',_0xbe00('0x72'),'watch_list',_0xbe00('0x73'),'sys_updated_on',_0xbe00('0x74'),_0xbe00('0x6d'),'approval_history','number',_0xbe00('0x75'),_0xbe00('0x76'),_0xbe00('0x77'),_0xbe00('0x78'),_0xbe00('0x79'),_0xbe00('0x7a'),'state',_0xbe00('0x7b'),_0xbe00('0x7c'),_0xbe00('0x4e'),'calendar_stc',_0xbe00('0x7d'),'cmdb_ci',_0xbe00('0x7e'),_0xbe00('0x7f'),_0xbe00('0x80'),'work_notes_list',_0xbe00('0x81'),_0xbe00('0x82'),'sys_domain_path',_0xbe00('0x83'),_0xbe00('0x84'),_0xbe00('0x85'),_0xbe00('0x86'),_0xbe00('0x87'),_0xbe00('0x88'),_0xbe00('0x89'),_0xbe00('0x8a'),'resolved_at',_0xbe00('0x8b'),_0xbe00('0x8c'),_0xbe00('0x6e'),'work_notes',_0xbe00('0x8d'),_0xbe00('0x6f'),'correlation_display',_0xbe00('0x8e'),'work_start',_0xbe00('0x8f'),_0xbe00('0x90'),_0xbe00('0x91'),_0xbe00('0x92'),_0xbe00('0x93'),_0xbe00('0x70'),_0xbe00('0x94'),'close_notes',_0xbe00('0x95'),_0xbe00('0x96'),_0xbe00('0x97'),_0xbe00('0x98'),_0xbe00('0x99'),'reopened_by',_0xbe00('0x9a'),_0xbe00('0x9b'),_0xbe00('0x9c'),_0xbe00('0x9d'),'reassignment_count',_0xbe00('0x9e'),_0xbe00('0x9f'),_0xbe00('0xa0'),_0xbe00('0xa1'),_0xbe00('0xa2'),_0xbe00('0xa3'),_0xbe00('0xa4'),_0xbe00('0xa5'),'sys_mod_count',_0xbe00('0xa6'),'sys_tags',_0xbe00('0xa7'),_0xbe00('0xa8'),_0xbe00('0xa9'),_0xbe00('0xaa'),_0xbe00('0xab')];var _0x1c6739='';var _0x39363c='';var _0x141e88=[];var _0x3cee0a='';var _0x3f94c3='';var _0x1f5dbc=[];var _0x457c2b='';var _0x2b987e='';var _0x277f27={};var _0x1bef88='';return db[_0xbe00('0x56')][_0xbe00('0x61')]({'where':{'id':_0x37e796[_0xbe00('0x5a')]['id']},'attributes':['id',_0xbe00('0xac'),_0xbe00('0xad'),_0xbe00('0xae'),_0xbe00('0xaf'),_0xbe00('0xb0')]})['then'](handleEntityNotFound(_0x36c764,null))[_0xbe00('0x24')](function(_0x4f6573){if(_0x4f6573){_0x1bef88=_0x4f6573['remoteUri'];var _0x12342f=_0x1bef88[_0xbe00('0xb1')](-0x1);if(_0x12342f==='/'){_0x1bef88=_0x1bef88[_0xbe00('0xb2')](0x0,_0x1bef88['lastIndexOf'](_0x12342f));}_0x2b987e=util[_0xbe00('0xb3')]('%s/api/now/doc/table/schema/',_0x1bef88);_0x457c2b=util[_0xbe00('0xb3')](_0xbe00('0xb4'),_0x1bef88);_0x277f27={'user':_0x4f6573[_0xbe00('0xac')],'pass':_0x4f6573[_0xbe00('0xad')]};var _0x3c8037={'method':'GET','uri':_0x2b987e+_0xbe00('0xb5'),'auth':_0x277f27,'json':!![]};return rp(_0x3c8037);}})[_0xbe00('0x24')](function(_0x3bd3f9){if(_0x3bd3f9[_0xbe00('0x2e')][_0xbe00('0x4b')]>0x0){_0x1c6739=_0x3bd3f9[_0xbe00('0x2e')];}console[_0xbe00('0xb6')](_0xbe00('0xb7'),_0x1c6739);_0x1f5dbc=[];_0x39363c=Object[_0xbe00('0xb8')]([],_0x1c6739);_[_0xbe00('0xb9')](_0x39363c,function(_0x36dcb6){return!_0x5d93a2['includes'](_0x36dcb6[_0xbe00('0x3e')]);});_0x39363c[_0xbe00('0xba')](function(_0x57d9e5){var _0x36469f=createFieldObject(_0x457c2b,_0x277f27,_0x57d9e5[_0xbe00('0xbb')],_0x57d9e5[_0xbe00('0x3e')],_0x57d9e5[_0xbe00('0xbc')],![]);_0x1f5dbc[_0xbe00('0xbd')](_0x36469f);});return Promise[_0xbe00('0xbe')](_0x1f5dbc);})[_0xbe00('0x24')](function(_0x121b2f){_0x141e88=_0x121b2f;_0x3cee0a=Object['assign']([],_0x1c6739);console[_0xbe00('0xb6')](_0xbe00('0xbf'),_0x1c6739);_[_0xbe00('0xb9')](_0x3cee0a,function(_0x308993){return _0xf1aa2a[_0xbe00('0xc0')](_0x308993[_0xbe00('0x3e')]);});console[_0xbe00('0xb6')](_0xbe00('0xc1'),_0x3cee0a);_0x1f5dbc=[];_0x3cee0a[_0xbe00('0xba')](function(_0x13a43b){var _0xd3bc0f=createFieldObject(_0x457c2b,_0x277f27,_0x13a43b[_0xbe00('0xbb')],_0x13a43b['name'],_0x13a43b[_0xbe00('0xbc')],!![]);_0x1f5dbc[_0xbe00('0xbd')](_0xd3bc0f);});return Promise[_0xbe00('0xbe')](_0x1f5dbc);})[_0xbe00('0x24')](function(_0x49f6f8){_0x3f94c3=_0x49f6f8;var _0x202781=_0x141e88[_0xbe00('0xc2')](_0x3f94c3);return{'count':_0x202781['length'],'rows':_0x202781};})[_0xbe00('0x24')](respondWithResult(_0x36c764,null))[_0xbe00('0x2f')](function(_0x5c9f14){console['log'](_0xbe00('0xc3')+_0x5c9f14);var _0x541266=_0x37e796['query'][_0xbe00('0x20')]?0x1f4:_0x5c9f14[_0xbe00('0xc4')]||0x1f4;logger[_0xbe00('0x2b')](_0x5c9f14[_0xbe00('0x3d')]);delete _0x5c9f14[_0xbe00('0x3e')];if(_0x541266===0x191){_0x541266=0x190;}_0x36c764[_0xbe00('0x3c')](_0x541266)[_0xbe00('0x3f')](_0x37e796[_0xbe00('0x45')]['test']?{'message':_0xbe00('0xc5'),'statusCode':_0x5c9f14['statusCode']}:_0x5c9f14);});};function createFieldObject(_0x38a79b,_0x1e3326,_0xcba4df,_0x4ff5fa,_0x43c011,_0x3f7ec1){return new Promise(function(_0x65b10e,_0x20e331){var _0x4302ba={'id':_0x4ff5fa,'name':_0x43c011,'custom':_0x3f7ec1};if(_0xcba4df===_0xbe00('0xc6')){_0x4302ba[_0xbe00('0x5c')]=[{'name':'True','value':_0xbe00('0xc7')},{'name':_0xbe00('0xc8'),'value':_0xbe00('0xc9')}];_0x65b10e(_0x4302ba);}else{var _0x34d03a={'method':_0xbe00('0xca'),'uri':_0x38a79b+'sys_choice?sysparm_query=name=incident^element='+_0x4ff5fa,'auth':_0x1e3326,'json':!![]};return rp(_0x34d03a)['then'](function(_0x58ae65){var _0x3fbfa0=[];if(_0x58ae65[_0xbe00('0x2e')][_0xbe00('0x4b')]>0x0){_0x58ae65[_0xbe00('0x2e')][_0xbe00('0xba')](function(_0x5e34d8){if(_0x5e34d8['inactive']==='false'){var _0x5187a6={'name':_0x5e34d8[_0xbe00('0xbc')],'value':_0x5e34d8[_0xbe00('0xcb')]};_0x3fbfa0[_0xbe00('0xbd')](_0x5187a6);}});}_0x4302ba[_0xbe00('0x5c')]=_0x3fbfa0;if(_0x4302ba[_0xbe00('0x5c')][_0xbe00('0x4b')]>0x0){_0x65b10e(_0x4302ba);}else{if(_0x3f7ec1==![]){_0x65b10e();}else{_0x65b10e(_0x4302ba);}}});}});} \ No newline at end of file +var _0xb048=['debug','stringify','error','code','message','info','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','email','serverUrl','slice','substring','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','concat','ServiceNow\x20error:\x20','statusCode','stack','Wrong\x20credentials','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x212960,_0x520f14){var _0x4f5a8a=function(_0x5e40c5){while(--_0x5e40c5){_0x212960['push'](_0x212960['shift']());}};_0x4f5a8a(++_0x520f14);}(_0xb048,0x163));var _0x8b04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb048[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8b04('0x0'));var emlformat=require(_0x8b04('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b04('0x2'));var rp=require(_0x8b04('0x3'));var moment=require(_0x8b04('0x4'));var BPromise=require(_0x8b04('0x5'));var Mustache=require(_0x8b04('0x6'));var util=require('util');var path=require(_0x8b04('0x7'));var sox=require(_0x8b04('0x8'));var csv=require(_0x8b04('0x9'));var ejs=require(_0x8b04('0xa'));var fs=require('fs');var _=require(_0x8b04('0xb'));var squel=require('squel');var crypto=require(_0x8b04('0xc'));var jsforce=require(_0x8b04('0xd'));var deskjs=require(_0x8b04('0xe'));var toCsv=require(_0x8b04('0x9'));var querystring=require(_0x8b04('0xf'));var Papa=require(_0x8b04('0x10'));var Redis=require(_0x8b04('0x11'));var authService=require(_0x8b04('0x12'));var qs=require(_0x8b04('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b04('0x14'));var logger=require('../../config/logger')(_0x8b04('0x15'));var utils=require(_0x8b04('0x16'));var config=require(_0x8b04('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8b04('0x18'));var client=jayson[_0x8b04('0x19')][_0x8b04('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x193d1d,_0x26aac2,_0x2587ea){if(_0x2587ea){var _0x2c48df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c48df['test'](_0x26aac2)){return _0x193d1d;}else{throw new db[(_0x8b04('0x1b'))][(_0x8b04('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 _0x193d1d;}}function respondWithRpcPromise(_0x1a3348,_0x190397,_0x215ce6,_0x4fd26e){return new BPromise(function(_0x25ff96,_0x2c2ed5){var _0x24c541=_0x4fd26e||client;return _0x24c541[_0x8b04('0x1d')](_0x1a3348,_0x215ce6)[_0x8b04('0x1e')](function(_0x326d09){logger['info'](_0x8b04('0x1f'),_0x190397,_0x8b04('0x20'));logger[_0x8b04('0x21')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x190397,_0x8b04('0x20'),JSON[_0x8b04('0x22')](_0x326d09));if(_0x326d09[_0x8b04('0x23')]){if(_0x326d09['error'][_0x8b04('0x24')]===0x1f4){logger['error'](_0x8b04('0x1f'),_0x190397,_0x326d09[_0x8b04('0x23')][_0x8b04('0x25')]);return _0x2c2ed5(_0x326d09[_0x8b04('0x23')][_0x8b04('0x25')]);}logger['error'](_0x8b04('0x1f'),_0x190397,_0x326d09[_0x8b04('0x23')][_0x8b04('0x25')]);return _0x25ff96(_0x326d09[_0x8b04('0x23')][_0x8b04('0x25')]);}else{logger[_0x8b04('0x26')](_0x8b04('0x1f'),_0x190397,'request\x20sent');_0x25ff96(_0x326d09['result'][_0x8b04('0x25')]);}})[_0x8b04('0x27')](function(_0x55af1d){logger[_0x8b04('0x23')](_0x8b04('0x1f'),_0x190397,_0x55af1d);_0x2c2ed5(_0x55af1d);});});}function respondWithStatusCode(_0x9ccca8,_0x2487dc){_0x2487dc=_0x2487dc||0xcc;return function(_0x1b694a){if(_0x1b694a){return _0x9ccca8[_0x8b04('0x28')](_0x2487dc);}return _0x9ccca8['status'](_0x2487dc)[_0x8b04('0x29')]();};}function respondWithResult(_0x3d577f,_0x4d0a19){_0x4d0a19=_0x4d0a19||0xc8;return function(_0x4de9e1){if(_0x4de9e1){return _0x3d577f[_0x8b04('0x2a')](_0x4d0a19)['json'](_0x4de9e1);}};}function respondWithFilteredResult(_0x1e8522,_0x3454f8){return function(_0x58168){if(_0x58168){var _0x52d9d2=_0x58168['count'],_0x864275=_0x3454f8[_0x8b04('0x2b')],_0x336914=_0x3454f8[_0x8b04('0x2b')]+_0x3454f8[_0x8b04('0x2c')],_0xbd2387;if(_0x336914>=_0x52d9d2){_0x336914=_0x52d9d2;_0xbd2387=0xc8;}else{_0xbd2387=0xce;}_0x1e8522[_0x8b04('0x2a')](_0xbd2387);return _0x1e8522[_0x8b04('0x2d')](_0x8b04('0x2e'),_0x864275+'-'+_0x336914+'/'+_0x52d9d2)[_0x8b04('0x2f')](_0x58168);}return null;};}function patchUpdates(_0x21d871){return function(_0x1d0801){try{jsonpatch[_0x8b04('0x30')](_0x1d0801,_0x21d871,!![]);}catch(_0x481d89){return BPromise[_0x8b04('0x31')](_0x481d89);}return _0x1d0801[_0x8b04('0x32')]();};}function saveUpdates(_0x423cf5,_0x4768bf){return function(_0x5ece30){if(_0x5ece30){return _0x5ece30[_0x8b04('0x33')](_0x423cf5)[_0x8b04('0x1e')](function(_0x900198){return _0x900198;});}return null;};}function removeEntity(_0x577646,_0x58b324){return function(_0x1c6805){if(_0x1c6805){return _0x1c6805[_0x8b04('0x34')]()[_0x8b04('0x1e')](function(){_0x577646['status'](0xcc)[_0x8b04('0x29')]();});}};}function handleEntityNotFound(_0x559e23,_0x4b560d){return function(_0x358b8d){if(!_0x358b8d){_0x559e23[_0x8b04('0x28')](0x194);}return _0x358b8d;};}function handleError(_0x158e11,_0x25c69e){_0x25c69e=_0x25c69e||0x1f4;return function(_0x2be6da){logger[_0x8b04('0x23')](_0x2be6da['stack']);if(_0x2be6da[_0x8b04('0x35')]){delete _0x2be6da[_0x8b04('0x35')];}_0x158e11['status'](_0x25c69e)['send'](_0x2be6da);};}exports[_0x8b04('0x36')]=function(_0x4353a7,_0x3c9a9e){var _0xef6fdb={},_0x493b72={},_0x1d2db4={'count':0x0,'rows':[]};var _0x4c46aa=_['map'](db[_0x8b04('0x37')][_0x8b04('0x38')],function(_0x237473){return{'name':_0x237473[_0x8b04('0x39')],'type':_0x237473[_0x8b04('0x3a')][_0x8b04('0x3b')]};});_0x493b72['model']=_[_0x8b04('0x3c')](_0x4c46aa,_0x8b04('0x35'));_0x493b72[_0x8b04('0x3d')]=_[_0x8b04('0x3e')](_0x4353a7['query']);_0x493b72[_0x8b04('0x3f')]=_[_0x8b04('0x40')](_0x493b72[_0x8b04('0x41')],_0x493b72['query']);_0xef6fdb[_0x8b04('0x42')]=_[_0x8b04('0x40')](_0x493b72[_0x8b04('0x41')],qs[_0x8b04('0x43')](_0x4353a7['query'][_0x8b04('0x43')]));_0xef6fdb['attributes']=_0xef6fdb[_0x8b04('0x42')][_0x8b04('0x44')]?_0xef6fdb[_0x8b04('0x42')]:_0x493b72[_0x8b04('0x41')];if(!_0x4353a7['query'][_0x8b04('0x45')]('nolimit')){_0xef6fdb[_0x8b04('0x2c')]=qs['limit'](_0x4353a7['query'][_0x8b04('0x2c')]);_0xef6fdb[_0x8b04('0x2b')]=qs[_0x8b04('0x2b')](_0x4353a7['query'][_0x8b04('0x2b')]);}_0xef6fdb[_0x8b04('0x46')]=qs[_0x8b04('0x47')](_0x4353a7[_0x8b04('0x3d')][_0x8b04('0x47')]);_0xef6fdb[_0x8b04('0x48')]=qs[_0x8b04('0x3f')](_[_0x8b04('0x49')](_0x4353a7[_0x8b04('0x3d')],_0x493b72['filters']),_0x4c46aa);if(_0x4353a7['query'][_0x8b04('0x4a')]){_0xef6fdb[_0x8b04('0x48')]=_[_0x8b04('0x4b')](_0xef6fdb['where'],{'$or':_[_0x8b04('0x3c')](_0x4c46aa,function(_0x395ea1){if(_0x395ea1[_0x8b04('0x3a')]!=='VIRTUAL'){var _0x5a7a5b={};_0x5a7a5b[_0x395ea1[_0x8b04('0x35')]]={'$like':'%'+_0x4353a7[_0x8b04('0x3d')]['filter']+'%'};return _0x5a7a5b;}})});}_0xef6fdb=_[_0x8b04('0x4b')]({},_0xef6fdb,_0x4353a7[_0x8b04('0x4c')]);var _0x44300d={'where':_0xef6fdb['where']};return db[_0x8b04('0x37')][_0x8b04('0x4d')](_0x44300d)['then'](function(_0x1f6118){_0x1d2db4[_0x8b04('0x4d')]=_0x1f6118;if(_0x4353a7['query']['includeAll']){_0xef6fdb[_0x8b04('0x4e')]=[{'all':!![]}];}return db[_0x8b04('0x37')][_0x8b04('0x4f')](_0xef6fdb);})['then'](function(_0x4fd299){_0x1d2db4[_0x8b04('0x50')]=_0x4fd299;return _0x1d2db4;})[_0x8b04('0x1e')](respondWithFilteredResult(_0x3c9a9e,_0xef6fdb))['catch'](handleError(_0x3c9a9e,null));};exports[_0x8b04('0x51')]=function(_0x4dec81,_0x3a8c74){var _0x2ad857={'raw':![],'where':{'id':_0x4dec81[_0x8b04('0x52')]['id']}},_0x48932c={};_0x48932c['model']=_[_0x8b04('0x3e')](db['ServicenowAccount'][_0x8b04('0x38')]);_0x48932c[_0x8b04('0x3d')]=_['keys'](_0x4dec81['query']);_0x48932c[_0x8b04('0x3f')]=_[_0x8b04('0x40')](_0x48932c['model'],_0x48932c['query']);_0x2ad857['attributes']=_['intersection'](_0x48932c[_0x8b04('0x41')],qs[_0x8b04('0x43')](_0x4dec81[_0x8b04('0x3d')][_0x8b04('0x43')]));_0x2ad857[_0x8b04('0x42')]=_0x2ad857[_0x8b04('0x42')][_0x8b04('0x44')]?_0x2ad857[_0x8b04('0x42')]:_0x48932c[_0x8b04('0x41')];if(_0x4dec81[_0x8b04('0x3d')][_0x8b04('0x53')]){_0x2ad857[_0x8b04('0x4e')]=[{'all':!![]}];}_0x2ad857=_[_0x8b04('0x4b')]({},_0x2ad857,_0x4dec81['options']);return db[_0x8b04('0x37')][_0x8b04('0x54')](_0x2ad857)[_0x8b04('0x1e')](handleEntityNotFound(_0x3a8c74,null))[_0x8b04('0x1e')](respondWithResult(_0x3a8c74,null))[_0x8b04('0x27')](handleError(_0x3a8c74,null));};exports[_0x8b04('0x55')]=function(_0x5ca48c,_0x518568){return db['ServicenowAccount'][_0x8b04('0x55')](_0x5ca48c[_0x8b04('0x56')],{})[_0x8b04('0x1e')](respondWithResult(_0x518568,0xc9))['catch'](handleError(_0x518568,null));};exports[_0x8b04('0x33')]=function(_0x1c2023,_0x4156c0){if(_0x1c2023['body']['id']){delete _0x1c2023[_0x8b04('0x56')]['id'];}return db[_0x8b04('0x37')]['find']({'where':{'id':_0x1c2023['params']['id']}})[_0x8b04('0x1e')](handleEntityNotFound(_0x4156c0,null))[_0x8b04('0x1e')](saveUpdates(_0x1c2023[_0x8b04('0x56')],null))['then'](respondWithResult(_0x4156c0,null))[_0x8b04('0x27')](handleError(_0x4156c0,null));};exports['destroy']=function(_0x555590,_0x2f7b51){return db['ServicenowAccount'][_0x8b04('0x54')]({'where':{'id':_0x555590[_0x8b04('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f7b51,null))[_0x8b04('0x1e')](removeEntity(_0x2f7b51,null))[_0x8b04('0x27')](handleError(_0x2f7b51,null));};exports[_0x8b04('0x57')]=function(_0x40aa52,_0x3128d2,_0x21f794){var _0x10bac9={};var _0x1ce5f8={};var _0x4e6bf5;var _0x575d94;return db[_0x8b04('0x37')][_0x8b04('0x58')]({'where':{'id':_0x40aa52[_0x8b04('0x52')]['id']}})[_0x8b04('0x1e')](handleEntityNotFound(_0x3128d2,null))[_0x8b04('0x1e')](function(_0x37005a){if(_0x37005a){_0x4e6bf5=_0x37005a;_0x1ce5f8[_0x8b04('0x41')]=_[_0x8b04('0x3e')](db['ServicenowConfiguration']['rawAttributes']);_0x1ce5f8[_0x8b04('0x3d')]=_[_0x8b04('0x3e')](_0x40aa52[_0x8b04('0x3d')]);_0x1ce5f8['filters']=_[_0x8b04('0x40')](_0x1ce5f8[_0x8b04('0x41')],_0x1ce5f8[_0x8b04('0x3d')]);_0x10bac9[_0x8b04('0x42')]=_['intersection'](_0x1ce5f8[_0x8b04('0x41')],qs[_0x8b04('0x43')](_0x40aa52[_0x8b04('0x3d')]['fields']));_0x10bac9[_0x8b04('0x42')]=_0x10bac9['attributes'][_0x8b04('0x44')]?_0x10bac9[_0x8b04('0x42')]:_0x1ce5f8['model'];_0x10bac9[_0x8b04('0x46')]=qs['sort'](_0x40aa52[_0x8b04('0x3d')][_0x8b04('0x47')]);_0x10bac9[_0x8b04('0x48')]=qs[_0x8b04('0x3f')](_[_0x8b04('0x49')](_0x40aa52['query'],_0x1ce5f8[_0x8b04('0x3f')]));if(_0x40aa52['query'][_0x8b04('0x4a')]){_0x10bac9[_0x8b04('0x48')]=_[_0x8b04('0x4b')](_0x10bac9['where'],{'$or':_[_0x8b04('0x3c')](_0x10bac9[_0x8b04('0x42')],function(_0x101d60){var _0x5a6f56={};_0x5a6f56[_0x101d60]={'$like':'%'+_0x40aa52[_0x8b04('0x3d')][_0x8b04('0x4a')]+'%'};return _0x5a6f56;})});}_0x10bac9=_[_0x8b04('0x4b')]({},_0x10bac9,_0x40aa52[_0x8b04('0x4c')]);return _0x4e6bf5['getConfigurations'](_0x10bac9);}})[_0x8b04('0x1e')](function(_0x1b4786){if(_0x1b4786){_0x575d94=_0x1b4786[_0x8b04('0x44')];if(!_0x40aa52['query'][_0x8b04('0x45')](_0x8b04('0x59'))){_0x10bac9[_0x8b04('0x2c')]=qs['limit'](_0x40aa52[_0x8b04('0x3d')][_0x8b04('0x2c')]);_0x10bac9[_0x8b04('0x2b')]=qs[_0x8b04('0x2b')](_0x40aa52[_0x8b04('0x3d')][_0x8b04('0x2b')]);}return _0x4e6bf5[_0x8b04('0x57')](_0x10bac9);}})[_0x8b04('0x1e')](function(_0x9fdf4a){if(_0x9fdf4a){return _0x9fdf4a?{'count':_0x575d94,'rows':_0x9fdf4a}:null;}})[_0x8b04('0x1e')](respondWithResult(_0x3128d2,null))[_0x8b04('0x27')](handleError(_0x3128d2,null));};exports[_0x8b04('0x5a')]=function(_0x1052f8,_0x497026,_0x194786){if(_0x1052f8[_0x8b04('0x56')]['id']){delete _0x1052f8['body']['id'];}return db['ServicenowAccount'][_0x8b04('0x58')]({'where':{'id':_0x1052f8['params']['id']}})[_0x8b04('0x1e')](handleEntityNotFound(_0x497026,null))['then'](function(_0x31bcdf){if(_0x31bcdf){_0x1052f8[_0x8b04('0x56')][_0x8b04('0x5b')]=_0x31bcdf['id'];_0x1052f8['body'][_0x8b04('0x5c')]=integrations[_0x8b04('0x5d')](_0x1052f8[_0x8b04('0x56')][_0x8b04('0x5e')],_0x1052f8['body'][_0x8b04('0x3a')]);_0x1052f8['body'][_0x8b04('0x5f')]=integrations[_0x8b04('0x60')](_0x1052f8[_0x8b04('0x56')][_0x8b04('0x5e')],_0x1052f8['body']['type']);return db['ServicenowConfiguration'][_0x8b04('0x55')](_0x1052f8[_0x8b04('0x56')],{'include':[{'model':db['ServicenowField'],'as':_0x8b04('0x5c')},{'model':db['ServicenowField'],'as':_0x8b04('0x5f')}]});}return null;})[_0x8b04('0x1e')](respondWithResult(_0x497026,null))[_0x8b04('0x27')](handleError(_0x497026,null));};exports[_0x8b04('0x61')]=function(_0x68f725,_0x1b1117,_0x404c32){var _0x529d22=[_0x8b04('0x62'),_0x8b04('0x63'),_0x8b04('0x64'),'subcategory',_0x8b04('0x65'),_0x8b04('0x66'),_0x8b04('0x67'),_0x8b04('0x68'),_0x8b04('0x69')];var _0x47465f=[_0x8b04('0x6a'),_0x8b04('0x62'),'caused_by',_0x8b04('0x6b'),_0x8b04('0x6c'),_0x8b04('0x6d'),'child_incidents','hold_reason',_0x8b04('0x6e'),_0x8b04('0x6f'),_0x8b04('0x70'),_0x8b04('0x71'),_0x8b04('0x72'),'user_input',_0x8b04('0x73'),'sys_domain',_0x8b04('0x74'),'sys_created_by','knowledge',_0x8b04('0x46'),_0x8b04('0x75'),_0x8b04('0x76'),_0x8b04('0x77'),'delivery_plan',_0x8b04('0x78'),_0x8b04('0x79'),_0x8b04('0x7a'),_0x8b04('0x7b'),_0x8b04('0x7c'),'sys_domain_path',_0x8b04('0x7d'),_0x8b04('0x7e'),_0x8b04('0x7f'),_0x8b04('0x80'),_0x8b04('0x81'),_0x8b04('0x82'),_0x8b04('0x83'),_0x8b04('0x84'),'resolved_at',_0x8b04('0x85'),_0x8b04('0x86'),'subcategory',_0x8b04('0x87'),_0x8b04('0x88'),_0x8b04('0x65'),_0x8b04('0x89'),'delivery_task','work_start','assignment_group',_0x8b04('0x8a'),_0x8b04('0x8b'),_0x8b04('0x8c'),_0x8b04('0x8d'),'notify',_0x8b04('0x8e'),_0x8b04('0x8f'),_0x8b04('0x90'),_0x8b04('0x91'),_0x8b04('0x92'),_0x8b04('0x93'),'contact_type',_0x8b04('0x94'),'incident_state',_0x8b04('0x95'),_0x8b04('0x96'),'company',_0x8b04('0x97'),_0x8b04('0x98'),'assigned_to',_0x8b04('0x68'),_0x8b04('0x99'),_0x8b04('0x9a'),_0x8b04('0x9b'),_0x8b04('0x9c'),_0x8b04('0x9d'),_0x8b04('0x9e'),_0x8b04('0x9f'),_0x8b04('0xa0'),'escalation',_0x8b04('0xa1'),_0x8b04('0xa2'),_0x8b04('0xa3'),'category'];var _0x431a32='';var _0x3d6c6f='';var _0x3b2d2e=[];var _0x3c4f38='';var _0x56e918='';var _0x318c39=[];var _0x295697='';var _0x2e4675='';var _0xc22376={};var _0x1103ff='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x68f725['params']['id']},'attributes':['id','username','password',_0x8b04('0xa4'),'remoteUri',_0x8b04('0xa5')]})[_0x8b04('0x1e')](handleEntityNotFound(_0x1b1117,null))[_0x8b04('0x1e')](function(_0x1af0ee){if(_0x1af0ee){_0x1103ff=_0x1af0ee['remoteUri'];var _0x1f2b6c=_0x1103ff[_0x8b04('0xa6')](-0x1);if(_0x1f2b6c==='/'){_0x1103ff=_0x1103ff[_0x8b04('0xa7')](0x0,_0x1103ff[_0x8b04('0xa8')](_0x1f2b6c));}_0x2e4675=util['format']('%s/api/now/doc/table/schema/',_0x1103ff);_0x295697=util[_0x8b04('0xa9')]('%s/api/now/table/',_0x1103ff);_0xc22376={'user':_0x1af0ee['username'],'pass':_0x1af0ee[_0x8b04('0xaa')]};var _0xe3638e={'method':_0x8b04('0xab'),'uri':_0x2e4675+_0x8b04('0xac'),'auth':_0xc22376,'json':!![]};return rp(_0xe3638e);}})[_0x8b04('0x1e')](function(_0x12505e){if(_0x12505e[_0x8b04('0xad')]['length']>0x0){_0x431a32=_0x12505e[_0x8b04('0xad')];}console[_0x8b04('0xae')](_0x8b04('0xaf'),_0x431a32);_0x318c39=[];_0x3d6c6f=Object['assign']([],_0x431a32);_[_0x8b04('0xb0')](_0x3d6c6f,function(_0x5762ab){return!_0x529d22[_0x8b04('0xb1')](_0x5762ab[_0x8b04('0x35')]);});_0x3d6c6f[_0x8b04('0xb2')](function(_0x46670d){var _0x3aa3e4=createFieldObject(_0x295697,_0xc22376,_0x46670d[_0x8b04('0xb3')],_0x46670d[_0x8b04('0x35')],_0x46670d[_0x8b04('0xb4')],![]);_0x318c39['push'](_0x3aa3e4);});return Promise[_0x8b04('0xb5')](_0x318c39);})[_0x8b04('0x1e')](function(_0x24e852){_0x3b2d2e=_0x24e852;_0x3c4f38=Object['assign']([],_0x431a32);console[_0x8b04('0xae')](_0x8b04('0xb6'),_0x431a32);_[_0x8b04('0xb0')](_0x3c4f38,function(_0x32502a){return _0x47465f['includes'](_0x32502a[_0x8b04('0x35')]);});console[_0x8b04('0xae')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3c4f38);_0x318c39=[];_0x3c4f38[_0x8b04('0xb2')](function(_0x10aa01){var _0xc396a=createFieldObject(_0x295697,_0xc22376,_0x10aa01[_0x8b04('0xb3')],_0x10aa01[_0x8b04('0x35')],_0x10aa01[_0x8b04('0xb4')],!![]);_0x318c39[_0x8b04('0xb7')](_0xc396a);});return Promise[_0x8b04('0xb5')](_0x318c39);})[_0x8b04('0x1e')](function(_0x29fa71){_0x56e918=_0x29fa71;var _0x3c6b0f=_0x3b2d2e[_0x8b04('0xb8')](_0x56e918);return{'count':_0x3c6b0f[_0x8b04('0x44')],'rows':_0x3c6b0f};})['then'](respondWithResult(_0x1b1117,null))[_0x8b04('0x27')](function(_0xe4a4d4){console[_0x8b04('0xae')](_0x8b04('0xb9')+_0xe4a4d4);var _0x4cc02d=_0x68f725['query']['test']?0x1f4:_0xe4a4d4[_0x8b04('0xba')]||0x1f4;logger[_0x8b04('0x23')](_0xe4a4d4[_0x8b04('0xbb')]);delete _0xe4a4d4[_0x8b04('0x35')];if(_0x4cc02d===0x191){_0x4cc02d=0x190;}_0x1b1117['status'](_0x4cc02d)['send'](_0x68f725['query']['test']?{'message':_0x8b04('0xbc'),'statusCode':_0xe4a4d4[_0x8b04('0xba')]}:_0xe4a4d4);});};function createFieldObject(_0x21c2cf,_0x134ca1,_0x5a8587,_0x53ecbd,_0x5e6589,_0x2fa17b){return new Promise(function(_0x12ac17,_0x1d8812){var _0x8295f={'id':_0x53ecbd,'name':_0x5e6589,'custom':_0x2fa17b};if(_0x5a8587==='boolean'){_0x8295f[_0x8b04('0x4c')]=[{'name':_0x8b04('0xbd'),'value':_0x8b04('0xbe')},{'name':_0x8b04('0xbf'),'value':'false'}];_0x12ac17(_0x8295f);}else{var _0x49516c={'method':_0x8b04('0xab'),'uri':_0x21c2cf+_0x8b04('0xc0')+_0x53ecbd,'auth':_0x134ca1,'json':!![]};return rp(_0x49516c)[_0x8b04('0x1e')](function(_0x17d73a){var _0x3e5638=[];if(_0x17d73a[_0x8b04('0xad')]['length']>0x0){_0x17d73a[_0x8b04('0xad')][_0x8b04('0xb2')](function(_0x1f44fb){if(_0x1f44fb['inactive']===_0x8b04('0xc1')){var _0x104da2={'name':_0x1f44fb[_0x8b04('0xb4')],'value':_0x1f44fb['value']};_0x3e5638[_0x8b04('0xb7')](_0x104da2);}});}_0x8295f[_0x8b04('0x4c')]=_0x3e5638;if(_0x8295f[_0x8b04('0x4c')]['length']>0x0){_0x12ac17(_0x8295f);}else{if(_0x2fa17b==![]){_0x12ac17();}else{_0x12ac17(_0x8295f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 011df35..c9e7b82 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 _0xf19a=['./intServicenowAccount.attributes','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xf19a,0xab));var _0xaf19=function(_0x42aabd,_0x217ade){_0x42aabd=_0x42aabd-0x0;var _0x2e83fb=_0xf19a[_0x42aabd];return _0x2e83fb;};'use strict';var _=require(_0xaf19('0x0'));var util=require(_0xaf19('0x1'));var logger=require(_0xaf19('0x2'))(_0xaf19('0x3'));var moment=require(_0xaf19('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf19('0x5'));var fs=require('fs');var path=require(_0xaf19('0x6'));var rimraf=require(_0xaf19('0x7'));var config=require(_0xaf19('0x8'));var attributes=require(_0xaf19('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3f6fc5,_0xe05615){return _0x3f6fc5[_0xaf19('0xa')]('ServicenowAccount',attributes,{'tableName':_0xaf19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf12f=['../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x340297,_0x477e98){var _0x2894f8=function(_0x328144){while(--_0x328144){_0x340297['push'](_0x340297['shift']());}};_0x2894f8(++_0x477e98);}(_0xf12f,0x179));var _0xff12=function(_0x420c7b,_0x100789){_0x420c7b=_0x420c7b-0x0;var _0x3038f3=_0xf12f[_0x420c7b];return _0x3038f3;};'use strict';var _=require(_0xff12('0x0'));var util=require(_0xff12('0x1'));var logger=require('../../config/logger')(_0xff12('0x2'));var moment=require(_0xff12('0x3'));var BPromise=require(_0xff12('0x4'));var rp=require(_0xff12('0x5'));var fs=require('fs');var path=require(_0xff12('0x6'));var rimraf=require('rimraf');var config=require(_0xff12('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xff12('0x8'));module['exports']=function(_0x354cf1,_0x489651){return _0x354cf1['define'](_0xff12('0x9'),attributes,{'tableName':_0xff12('0xa'),'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 722799f..61868c2 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 _0x876e=['ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','include','map','model','find','where','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x876e,0x16c));var _0xe876=function(_0x45e07c,_0x157e6c){_0x45e07c=_0x45e07c-0x0;var _0x141ec5=_0x876e[_0x45e07c];return _0x141ec5;};'use strict';var _=require(_0xe876('0x0'));var util=require('util');var moment=require(_0xe876('0x1'));var BPromise=require(_0xe876('0x2'));var rs=require(_0xe876('0x3'));var fs=require('fs');var Redis=require(_0xe876('0x4'));var db=require(_0xe876('0x5'))['db'];var utils=require(_0xe876('0x6'));var logger=require(_0xe876('0x7'))(_0xe876('0x8'));var config=require(_0xe876('0x9'));var jayson=require(_0xe876('0xa'));var client=jayson[_0xe876('0xb')][_0xe876('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x197447,_0x74a548,_0x13ef78){return new BPromise(function(_0x43c6e8,_0x16fa2e){return client[_0xe876('0xd')](_0x197447,_0x13ef78)[_0xe876('0xe')](function(_0xb2db9d){logger[_0xe876('0xf')](_0xe876('0x10'),_0x74a548,'request\x20sent');logger[_0xe876('0x11')](_0xe876('0x12'),_0x74a548,_0xe876('0x13'),JSON[_0xe876('0x14')](_0xb2db9d));if(_0xb2db9d['error']){if(_0xb2db9d[_0xe876('0x15')][_0xe876('0x16')]===0x1f4){logger[_0xe876('0x15')](_0xe876('0x10'),_0x74a548,_0xb2db9d['error']['message']);return _0x16fa2e(_0xb2db9d[_0xe876('0x15')][_0xe876('0x17')]);}logger[_0xe876('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x74a548,_0xb2db9d[_0xe876('0x15')][_0xe876('0x17')]);return _0x43c6e8(_0xb2db9d[_0xe876('0x15')][_0xe876('0x17')]);}else{logger[_0xe876('0xf')](_0xe876('0x10'),_0x74a548,'request\x20sent');_0x43c6e8(_0xb2db9d[_0xe876('0x18')][_0xe876('0x17')]);}})[_0xe876('0x19')](function(_0x248e10){logger[_0xe876('0x15')](_0xe876('0x10'),_0x74a548,_0x248e10);_0x16fa2e(_0x248e10);});});}exports[_0xe876('0x1a')]=function(_0x142dcd){var _0x16caf2=this;return new Promise(function(_0x2dfcad,_0x89dbff){return db[_0xe876('0x1b')][_0xe876('0x1c')]({'raw':_0x142dcd[_0xe876('0x1d')]?_0x142dcd[_0xe876('0x1d')][_0xe876('0x1e')]===undefined?!![]:![]:!![],'where':_0x142dcd[_0xe876('0x1d')]?_0x142dcd[_0xe876('0x1d')]['where']||null:null,'attributes':_0x142dcd[_0xe876('0x1d')]?_0x142dcd[_0xe876('0x1d')][_0xe876('0x1f')]||null:null,'limit':_0x142dcd[_0xe876('0x1d')]?_0x142dcd['options']['limit']||null:null,'include':_0x142dcd[_0xe876('0x1d')]?_0x142dcd[_0xe876('0x1d')][_0xe876('0x20')]?_[_0xe876('0x21')](_0x142dcd[_0xe876('0x1d')]['include'],function(_0x46322d){return{'model':db[_0x46322d[_0xe876('0x22')]],'as':_0x46322d['as'],'attributes':_0x46322d['attributes'],'include':_0x46322d[_0xe876('0x20')]?_['map'](_0x46322d[_0xe876('0x20')],function(_0x34760a){return{'model':db[_0x34760a[_0xe876('0x22')]],'as':_0x34760a['as'],'attributes':_0x34760a[_0xe876('0x1f')],'include':_0x34760a[_0xe876('0x20')]?_[_0xe876('0x21')](_0x34760a[_0xe876('0x20')],function(_0x4db3e7){return{'model':db[_0x4db3e7[_0xe876('0x22')]],'as':_0x4db3e7['as'],'attributes':_0x4db3e7[_0xe876('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe876('0xe')](function(_0x541cdb){logger[_0xe876('0xf')](_0xe876('0x1a'),_0x142dcd);logger[_0xe876('0x11')](_0xe876('0x1a'),_0x142dcd,JSON[_0xe876('0x14')](_0x541cdb));_0x2dfcad(_0x541cdb);})[_0xe876('0x19')](function(_0x4461ca){logger[_0xe876('0x15')](_0xe876('0x1a'),_0x4461ca[_0xe876('0x17')],_0x142dcd);_0x89dbff(_0x16caf2[_0xe876('0x15')](0x1f4,_0x4461ca['message']));});});};exports['ShowServicenowAccount']=function(_0x31cf8e){var _0x3e6e05=this;return new Promise(function(_0x275ceb,_0x56e754){return db[_0xe876('0x1b')][_0xe876('0x23')]({'raw':_0x31cf8e[_0xe876('0x1d')]?_0x31cf8e['options'][_0xe876('0x1e')]===undefined?!![]:![]:!![],'where':_0x31cf8e[_0xe876('0x1d')]?_0x31cf8e[_0xe876('0x1d')][_0xe876('0x24')]||null:null,'attributes':_0x31cf8e[_0xe876('0x1d')]?_0x31cf8e[_0xe876('0x1d')][_0xe876('0x1f')]||null:null,'include':_0x31cf8e[_0xe876('0x1d')]?_0x31cf8e[_0xe876('0x1d')][_0xe876('0x20')]?_['map'](_0x31cf8e[_0xe876('0x1d')][_0xe876('0x20')],function(_0x1d7b08){return{'model':db[_0x1d7b08[_0xe876('0x22')]],'as':_0x1d7b08['as'],'attributes':_0x1d7b08['attributes'],'include':_0x1d7b08['include']?_[_0xe876('0x21')](_0x1d7b08['include'],function(_0x58cf25){return{'model':db[_0x58cf25[_0xe876('0x22')]],'as':_0x58cf25['as'],'attributes':_0x58cf25[_0xe876('0x1f')],'include':_0x58cf25[_0xe876('0x20')]?_[_0xe876('0x21')](_0x58cf25[_0xe876('0x20')],function(_0x4c5d00){return{'model':db[_0x4c5d00[_0xe876('0x22')]],'as':_0x4c5d00['as'],'attributes':_0x4c5d00['attributes']};}):[]};}):[]};}):[]:[]})[_0xe876('0xe')](function(_0x4df132){logger[_0xe876('0xf')]('ShowServicenowAccount',_0x31cf8e);logger[_0xe876('0x11')](_0xe876('0x25'),_0x31cf8e,JSON['stringify'](_0x4df132));_0x275ceb(_0x4df132);})[_0xe876('0x19')](function(_0x37af6c){logger[_0xe876('0x15')]('ShowServicenowAccount',_0x37af6c[_0xe876('0x17')],_0x31cf8e);_0x56e754(_0x3e6e05[_0xe876('0x15')](0x1f4,_0x37af6c['message']));});});}; \ No newline at end of file +var _0x103b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include','map','model','GetServicenowAccount','debug','ShowServicenowAccount','where','lodash','util','moment'];(function(_0x50659a,_0x3102c6){var _0x4d7ef8=function(_0xc6f461){while(--_0xc6f461){_0x50659a['push'](_0x50659a['shift']());}};_0x4d7ef8(++_0x3102c6);}(_0x103b,0xcf));var _0xb103=function(_0x19e7a6,_0x4c8752){_0x19e7a6=_0x19e7a6-0x0;var _0xbd61fe=_0x103b[_0x19e7a6];return _0xbd61fe;};'use strict';var _=require(_0xb103('0x0'));var util=require(_0xb103('0x1'));var moment=require(_0xb103('0x2'));var BPromise=require(_0xb103('0x3'));var rs=require(_0xb103('0x4'));var fs=require('fs');var Redis=require(_0xb103('0x5'));var db=require(_0xb103('0x6'))['db'];var utils=require(_0xb103('0x7'));var logger=require(_0xb103('0x8'))(_0xb103('0x9'));var config=require(_0xb103('0xa'));var jayson=require(_0xb103('0xb'));var client=jayson['client'][_0xb103('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12fc63,_0x3cf1da,_0x5e04e6){return new BPromise(function(_0x49f3d2,_0x5d9a75){return client['request'](_0x12fc63,_0x5e04e6)[_0xb103('0xd')](function(_0x258a15){logger[_0xb103('0xe')](_0xb103('0xf'),_0x3cf1da,_0xb103('0x10'));logger['debug'](_0xb103('0x11'),_0x3cf1da,_0xb103('0x10'),JSON[_0xb103('0x12')](_0x258a15));if(_0x258a15[_0xb103('0x13')]){if(_0x258a15[_0xb103('0x13')][_0xb103('0x14')]===0x1f4){logger[_0xb103('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x3cf1da,_0x258a15['error'][_0xb103('0x15')]);return _0x5d9a75(_0x258a15['error'][_0xb103('0x15')]);}logger[_0xb103('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x3cf1da,_0x258a15[_0xb103('0x13')][_0xb103('0x15')]);return _0x49f3d2(_0x258a15[_0xb103('0x13')][_0xb103('0x15')]);}else{logger[_0xb103('0xe')](_0xb103('0xf'),_0x3cf1da,_0xb103('0x10'));_0x49f3d2(_0x258a15[_0xb103('0x16')]['message']);}})[_0xb103('0x17')](function(_0x8879ea){logger[_0xb103('0x13')](_0xb103('0xf'),_0x3cf1da,_0x8879ea);_0x5d9a75(_0x8879ea);});});}exports['GetServicenowAccount']=function(_0x376733){var _0x3cd3fe=this;return new Promise(function(_0x2f16bf,_0x4378ad){return db['ServicenowAccount'][_0xb103('0x18')]({'raw':_0x376733[_0xb103('0x19')]?_0x376733[_0xb103('0x19')][_0xb103('0x1a')]===undefined?!![]:![]:!![],'where':_0x376733[_0xb103('0x19')]?_0x376733[_0xb103('0x19')]['where']||null:null,'attributes':_0x376733[_0xb103('0x19')]?_0x376733['options'][_0xb103('0x1b')]||null:null,'limit':_0x376733[_0xb103('0x19')]?_0x376733['options']['limit']||null:null,'include':_0x376733[_0xb103('0x19')]?_0x376733[_0xb103('0x19')][_0xb103('0x1c')]?_[_0xb103('0x1d')](_0x376733[_0xb103('0x19')][_0xb103('0x1c')],function(_0x2de793){return{'model':db[_0x2de793[_0xb103('0x1e')]],'as':_0x2de793['as'],'attributes':_0x2de793[_0xb103('0x1b')],'include':_0x2de793[_0xb103('0x1c')]?_['map'](_0x2de793[_0xb103('0x1c')],function(_0x5dc43f){return{'model':db[_0x5dc43f[_0xb103('0x1e')]],'as':_0x5dc43f['as'],'attributes':_0x5dc43f[_0xb103('0x1b')],'include':_0x5dc43f['include']?_['map'](_0x5dc43f[_0xb103('0x1c')],function(_0x413633){return{'model':db[_0x413633[_0xb103('0x1e')]],'as':_0x413633['as'],'attributes':_0x413633[_0xb103('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb103('0xd')](function(_0x370002){logger[_0xb103('0xe')](_0xb103('0x1f'),_0x376733);logger[_0xb103('0x20')](_0xb103('0x1f'),_0x376733,JSON[_0xb103('0x12')](_0x370002));_0x2f16bf(_0x370002);})['catch'](function(_0x46c448){logger[_0xb103('0x13')](_0xb103('0x1f'),_0x46c448[_0xb103('0x15')],_0x376733);_0x4378ad(_0x3cd3fe[_0xb103('0x13')](0x1f4,_0x46c448['message']));});});};exports[_0xb103('0x21')]=function(_0x2e1b8b){var _0x330ce3=this;return new Promise(function(_0x6f2238,_0x5cfb25){return db['ServicenowAccount']['find']({'raw':_0x2e1b8b[_0xb103('0x19')]?_0x2e1b8b[_0xb103('0x19')][_0xb103('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e1b8b[_0xb103('0x19')]?_0x2e1b8b[_0xb103('0x19')][_0xb103('0x22')]||null:null,'attributes':_0x2e1b8b[_0xb103('0x19')]?_0x2e1b8b[_0xb103('0x19')]['attributes']||null:null,'include':_0x2e1b8b[_0xb103('0x19')]?_0x2e1b8b['options'][_0xb103('0x1c')]?_['map'](_0x2e1b8b[_0xb103('0x19')][_0xb103('0x1c')],function(_0x1e4c60){return{'model':db[_0x1e4c60[_0xb103('0x1e')]],'as':_0x1e4c60['as'],'attributes':_0x1e4c60['attributes'],'include':_0x1e4c60[_0xb103('0x1c')]?_[_0xb103('0x1d')](_0x1e4c60[_0xb103('0x1c')],function(_0x543f9b){return{'model':db[_0x543f9b['model']],'as':_0x543f9b['as'],'attributes':_0x543f9b['attributes'],'include':_0x543f9b[_0xb103('0x1c')]?_['map'](_0x543f9b['include'],function(_0x2ecd5d){return{'model':db[_0x2ecd5d['model']],'as':_0x2ecd5d['as'],'attributes':_0x2ecd5d[_0xb103('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb103('0xd')](function(_0x27391f){logger[_0xb103('0xe')]('ShowServicenowAccount',_0x2e1b8b);logger[_0xb103('0x20')](_0xb103('0x21'),_0x2e1b8b,JSON[_0xb103('0x12')](_0x27391f));_0x6f2238(_0x27391f);})[_0xb103('0x17')](function(_0x266f77){logger[_0xb103('0x13')](_0xb103('0x21'),_0x266f77['message'],_0x2e1b8b);_0x5cfb25(_0x330ce3[_0xb103('0x13')](0x1f4,_0x266f77['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d0ef202..352387a 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 _0x555e=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intServicenowConfiguration.controller','get','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','post','create','put','/:id','update'];(function(_0x44baba,_0xd3bb25){var _0x32e415=function(_0xb07acd){while(--_0xb07acd){_0x44baba['push'](_0x44baba['shift']());}};_0x32e415(++_0xd3bb25);}(_0x555e,0xb2));var _0xe555=function(_0x1a921c,_0x530418){_0x1a921c=_0x1a921c-0x0;var _0x4b0690=_0x555e[_0x1a921c];return _0x4b0690;};'use strict';var multer=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var path=require(_0xe555('0x2'));var timeout=require(_0xe555('0x3'));var express=require('express');var router=express[_0xe555('0x4')]();var auth=require(_0xe555('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe555('0x6'));router[_0xe555('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe555('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe555('0x8')]);router[_0xe555('0x7')](_0xe555('0x9'),auth['isAuthenticated'](),controller[_0xe555('0xa')]);router[_0xe555('0x7')](_0xe555('0xb'),auth[_0xe555('0xc')](),controller[_0xe555('0xd')]);router['get'](_0xe555('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe555('0xf')]('/',auth[_0xe555('0xc')](),controller[_0xe555('0x10')]);router[_0xe555('0x11')](_0xe555('0x12'),auth[_0xe555('0xc')](),controller[_0xe555('0x13')]);router['delete']('/:id',auth[_0xe555('0xc')](),controller[_0xe555('0x14')]);module[_0xe555('0x15')]=router; \ No newline at end of file +var _0xf6bf=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x357a01,_0x1e57d0){var _0x252c1f=function(_0x53c71f){while(--_0x53c71f){_0x357a01['push'](_0x357a01['shift']());}};_0x252c1f(++_0x1e57d0);}(_0xf6bf,0x1b0));var _0xff6b=function(_0x1aaf8b,_0x151258){_0x1aaf8b=_0x1aaf8b-0x0;var _0x315c53=_0xf6bf[_0x1aaf8b];return _0x315c53;};'use strict';var multer=require(_0xff6b('0x0'));var util=require('util');var path=require(_0xff6b('0x1'));var timeout=require(_0xff6b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xff6b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff6b('0x4'));router[_0xff6b('0x5')]('/',auth[_0xff6b('0x6')](),controller[_0xff6b('0x7')]);router[_0xff6b('0x5')]('/:id',auth[_0xff6b('0x6')](),controller[_0xff6b('0x8')]);router[_0xff6b('0x5')](_0xff6b('0x9'),auth['isAuthenticated'](),controller[_0xff6b('0xa')]);router[_0xff6b('0x5')](_0xff6b('0xb'),auth[_0xff6b('0x6')](),controller[_0xff6b('0xc')]);router['get'](_0xff6b('0xd'),auth[_0xff6b('0x6')](),controller[_0xff6b('0xe')]);router[_0xff6b('0xf')]('/',auth[_0xff6b('0x6')](),controller['create']);router['put'](_0xff6b('0x10'),auth[_0xff6b('0x6')](),controller[_0xff6b('0x11')]);router['delete'](_0xff6b('0x10'),auth['isAuthenticated'](),controller[_0xff6b('0x12')]);module[_0xff6b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2c79e29..baa32bd 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 _0x5f8b=['sequelize','exports','STRING'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x5f8b,0x105));var _0xb5f8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x5f8b[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0xb5f8('0x0'));module[_0xb5f8('0x1')]={'name':{'type':Sequelize[_0xb5f8('0x2')]},'description':{'type':Sequelize[_0xb5f8('0x2')]}}; \ No newline at end of file +var _0x9f48=['sequelize','exports','STRING'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x9f48,0xe7));var _0x89f4=function(_0x4d1118,_0x3e8586){_0x4d1118=_0x4d1118-0x0;var _0x88edb=_0x9f48[_0x4d1118];return _0x88edb;};'use strict';var Sequelize=require(_0x89f4('0x0'));module[_0x89f4('0x1')]={'name':{'type':Sequelize[_0x89f4('0x2')]},'description':{'type':Sequelize[_0x89f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9dc1ba8..ce5b1e6 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 _0x6cb4=['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','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','ServicenowConfiguration','options','body','find','findOne','ServicenowField','length','map','hasOwnProperty','getFields','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','jayson/promise','client'];(function(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x6cb4,0xff));var _0x46cb=function(_0x8c42ff,_0x2b1732){_0x8c42ff=_0x8c42ff-0x0;var _0xe4945b=_0x6cb4[_0x8c42ff];return _0xe4945b;};'use strict';var pdf=require(_0x46cb('0x0'));var emlformat=require(_0x46cb('0x1'));var rimraf=require(_0x46cb('0x2'));var zipdir=require(_0x46cb('0x3'));var jsonpatch=require(_0x46cb('0x4'));var rp=require(_0x46cb('0x5'));var moment=require(_0x46cb('0x6'));var BPromise=require(_0x46cb('0x7'));var Mustache=require(_0x46cb('0x8'));var util=require('util');var path=require(_0x46cb('0x9'));var sox=require('sox');var csv=require(_0x46cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0xa'));var querystring=require('querystring');var Papa=require(_0x46cb('0x10'));var Redis=require(_0x46cb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x12'));var as=require(_0x46cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x14'))(_0x46cb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x46cb('0x16'));var client=jayson[_0x46cb('0x17')][_0x46cb('0x18')]({'port':0x232a});function checkPasswordPattern(_0xf22158,_0x553440,_0x8497cd){if(_0x8497cd){var _0x2ad351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ad351[_0x46cb('0x19')](_0x553440)){return _0xf22158;}else{throw new db[(_0x46cb('0x1a'))][(_0x46cb('0x1b'))](_0x46cb('0x1c'));}}else{return _0xf22158;}}function respondWithRpcPromise(_0x3d2557,_0x3c396b,_0x37d368,_0x41e398){return new BPromise(function(_0x136215,_0x5cdb4b){var _0x3da031=_0x41e398||client;return _0x3da031['request'](_0x3d2557,_0x37d368)[_0x46cb('0x1d')](function(_0x4ab22b){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3c396b,_0x46cb('0x1e'));logger[_0x46cb('0x1f')](_0x46cb('0x20'),_0x3c396b,_0x46cb('0x1e'),JSON[_0x46cb('0x21')](_0x4ab22b));if(_0x4ab22b[_0x46cb('0x22')]){if(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x23')]===0x1f4){logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);return _0x5cdb4b(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);}logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);return _0x136215(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);}else{logger[_0x46cb('0x26')](_0x46cb('0x24'),_0x3c396b,_0x46cb('0x1e'));_0x136215(_0x4ab22b[_0x46cb('0x27')][_0x46cb('0x25')]);}})['catch'](function(_0x4d663e){logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4d663e);_0x5cdb4b(_0x4d663e);});});}function respondWithStatusCode(_0x2711ac,_0xe078a8){_0xe078a8=_0xe078a8||0xcc;return function(_0x6e6d9){if(_0x6e6d9){return _0x2711ac['sendStatus'](_0xe078a8);}return _0x2711ac[_0x46cb('0x28')](_0xe078a8)['end']();};}function respondWithResult(_0x495886,_0x544465){_0x544465=_0x544465||0xc8;return function(_0x180ce1){if(_0x180ce1){return _0x495886[_0x46cb('0x28')](_0x544465)[_0x46cb('0x29')](_0x180ce1);}};}function respondWithFilteredResult(_0xc1efd3,_0x7cd177){return function(_0x33218b){if(_0x33218b){var _0x378dc7=_0x33218b[_0x46cb('0x2a')],_0x8c65b2=_0x7cd177['offset'],_0x2b846a=_0x7cd177[_0x46cb('0x2b')]+_0x7cd177[_0x46cb('0x2c')],_0x12e01e;if(_0x2b846a>=_0x378dc7){_0x2b846a=_0x378dc7;_0x12e01e=0xc8;}else{_0x12e01e=0xce;}_0xc1efd3['status'](_0x12e01e);return _0xc1efd3['set'](_0x46cb('0x2d'),_0x8c65b2+'-'+_0x2b846a+'/'+_0x378dc7)['json'](_0x33218b);}return null;};}function patchUpdates(_0x27c22d){return function(_0x6f7953){try{jsonpatch[_0x46cb('0x2e')](_0x6f7953,_0x27c22d,!![]);}catch(_0xd96713){return BPromise[_0x46cb('0x2f')](_0xd96713);}return _0x6f7953[_0x46cb('0x30')]();};}function saveUpdates(_0x5dc551,_0x2e2d36){return function(_0x49ffc5){if(_0x49ffc5){return _0x49ffc5[_0x46cb('0x31')](_0x5dc551)[_0x46cb('0x1d')](function(_0x5cd048){return _0x5cd048;});}return null;};}function removeEntity(_0x46489f,_0x3f0eb4){return function(_0x2cc99d){if(_0x2cc99d){return _0x2cc99d[_0x46cb('0x32')]()[_0x46cb('0x1d')](function(){_0x46489f['status'](0xcc)[_0x46cb('0x33')]();});}};}function handleEntityNotFound(_0x49f80a,_0x46485c){return function(_0x414aef){if(!_0x414aef){_0x49f80a[_0x46cb('0x34')](0x194);}return _0x414aef;};}function handleError(_0x50000e,_0x17eb01){_0x17eb01=_0x17eb01||0x1f4;return function(_0x4290c){logger['error'](_0x4290c[_0x46cb('0x35')]);if(_0x4290c[_0x46cb('0x36')]){delete _0x4290c[_0x46cb('0x36')];}_0x50000e[_0x46cb('0x28')](_0x17eb01)[_0x46cb('0x37')](_0x4290c);};}exports[_0x46cb('0x38')]=function(_0x244084,_0x3dabed){var _0x19e0ad={},_0xe4504e={},_0xba5e93={'count':0x0,'rows':[]};var _0x4f0fb6=_['map'](db['ServicenowConfiguration'][_0x46cb('0x39')],function(_0xf8aaec){return{'name':_0xf8aaec[_0x46cb('0x3a')],'type':_0xf8aaec[_0x46cb('0x3b')][_0x46cb('0x3c')]};});_0xe4504e[_0x46cb('0x3d')]=_['map'](_0x4f0fb6,_0x46cb('0x36'));_0xe4504e['query']=_['keys'](_0x244084[_0x46cb('0x3e')]);_0xe4504e['filters']=_['intersection'](_0xe4504e[_0x46cb('0x3d')],_0xe4504e['query']);_0x19e0ad['attributes']=_[_0x46cb('0x3f')](_0xe4504e[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x244084[_0x46cb('0x3e')][_0x46cb('0x40')]));_0x19e0ad[_0x46cb('0x41')]=_0x19e0ad[_0x46cb('0x41')]['length']?_0x19e0ad[_0x46cb('0x41')]:_0xe4504e['model'];if(!_0x244084[_0x46cb('0x3e')]['hasOwnProperty'](_0x46cb('0x42'))){_0x19e0ad[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x244084['query'][_0x46cb('0x2c')]);_0x19e0ad[_0x46cb('0x2b')]=qs['offset'](_0x244084[_0x46cb('0x3e')][_0x46cb('0x2b')]);}_0x19e0ad[_0x46cb('0x43')]=qs[_0x46cb('0x44')](_0x244084[_0x46cb('0x3e')]['sort']);_0x19e0ad['where']=qs[_0x46cb('0x45')](_['pick'](_0x244084[_0x46cb('0x3e')],_0xe4504e[_0x46cb('0x45')]),_0x4f0fb6);if(_0x244084['query'][_0x46cb('0x46')]){_0x19e0ad[_0x46cb('0x47')]=_[_0x46cb('0x48')](_0x19e0ad['where'],{'$or':_['map'](_0x4f0fb6,function(_0x5cbdad){if(_0x5cbdad['type']!==_0x46cb('0x49')){var _0x23dd2e={};_0x23dd2e[_0x5cbdad[_0x46cb('0x36')]]={'$like':'%'+_0x244084[_0x46cb('0x3e')][_0x46cb('0x46')]+'%'};return _0x23dd2e;}})});}_0x19e0ad=_['merge']({},_0x19e0ad,_0x244084['options']);var _0x2908fb={'where':_0x19e0ad[_0x46cb('0x47')]};return db['ServicenowConfiguration'][_0x46cb('0x2a')](_0x2908fb)[_0x46cb('0x1d')](function(_0x12f31e){_0xba5e93[_0x46cb('0x2a')]=_0x12f31e;if(_0x244084[_0x46cb('0x3e')][_0x46cb('0x4a')]){_0x19e0ad[_0x46cb('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x19e0ad);})[_0x46cb('0x1d')](function(_0x52ed52){_0xba5e93[_0x46cb('0x4c')]=_0x52ed52;return _0xba5e93;})[_0x46cb('0x1d')](respondWithFilteredResult(_0x3dabed,_0x19e0ad))[_0x46cb('0x4d')](handleError(_0x3dabed,null));};exports['show']=function(_0x37163b,_0x5c1665){var _0x5c02c9={'raw':![],'where':{'id':_0x37163b[_0x46cb('0x4e')]['id']}},_0x16c500={};_0x16c500[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x50')][_0x46cb('0x39')]);_0x16c500[_0x46cb('0x3e')]=_['keys'](_0x37163b['query']);_0x16c500[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x16c500['model'],_0x16c500[_0x46cb('0x3e')]);_0x5c02c9[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0x16c500[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x37163b['query'][_0x46cb('0x40')]));_0x5c02c9[_0x46cb('0x41')]=_0x5c02c9[_0x46cb('0x41')]['length']?_0x5c02c9[_0x46cb('0x41')]:_0x16c500['model'];if(_0x37163b['query'][_0x46cb('0x4a')]){_0x5c02c9[_0x46cb('0x4b')]=[{'all':!![]}];}_0x5c02c9=_[_0x46cb('0x48')]({},_0x5c02c9,_0x37163b[_0x46cb('0x51')]);return db[_0x46cb('0x50')]['find'](_0x5c02c9)[_0x46cb('0x1d')](handleEntityNotFound(_0x5c1665,null))[_0x46cb('0x1d')](respondWithResult(_0x5c1665,null))['catch'](handleError(_0x5c1665,null));};exports['create']=function(_0x1230db,_0xfccf57){return db[_0x46cb('0x50')]['create'](_0x1230db[_0x46cb('0x52')],{})[_0x46cb('0x1d')](respondWithResult(_0xfccf57,0xc9))[_0x46cb('0x4d')](handleError(_0xfccf57,null));};exports[_0x46cb('0x31')]=function(_0x46407d,_0x3f415d){if(_0x46407d[_0x46cb('0x52')]['id']){delete _0x46407d[_0x46cb('0x52')]['id'];}return db[_0x46cb('0x50')]['find']({'where':{'id':_0x46407d[_0x46cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f415d,null))[_0x46cb('0x1d')](saveUpdates(_0x46407d[_0x46cb('0x52')],null))[_0x46cb('0x1d')](respondWithResult(_0x3f415d,null))[_0x46cb('0x4d')](handleError(_0x3f415d,null));};exports['destroy']=function(_0x67fb77,_0x13d25f){return db[_0x46cb('0x50')][_0x46cb('0x53')]({'where':{'id':_0x67fb77[_0x46cb('0x4e')]['id']}})[_0x46cb('0x1d')](handleEntityNotFound(_0x13d25f,null))[_0x46cb('0x1d')](removeEntity(_0x13d25f,null))[_0x46cb('0x4d')](handleError(_0x13d25f,null));};exports['getFields']=function(_0x4a0606,_0x5a4b11,_0x50626e){var _0x429189={};var _0xdb582b={};var _0x5e08f0;var _0x429b39;return db[_0x46cb('0x50')][_0x46cb('0x54')]({'where':{'id':_0x4a0606['params']['id']}})['then'](handleEntityNotFound(_0x5a4b11,null))[_0x46cb('0x1d')](function(_0x57acfc){if(_0x57acfc){_0x5e08f0=_0x57acfc;_0xdb582b[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x55')][_0x46cb('0x39')]);_0xdb582b[_0x46cb('0x3e')]=_[_0x46cb('0x4f')](_0x4a0606[_0x46cb('0x3e')]);_0xdb582b[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0xdb582b[_0x46cb('0x3d')],_0xdb582b[_0x46cb('0x3e')]);_0x429189[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0xdb582b['model'],qs[_0x46cb('0x40')](_0x4a0606['query'][_0x46cb('0x40')]));_0x429189[_0x46cb('0x41')]=_0x429189[_0x46cb('0x41')][_0x46cb('0x56')]?_0x429189[_0x46cb('0x41')]:_0xdb582b[_0x46cb('0x3d')];_0x429189[_0x46cb('0x43')]=qs['sort'](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x44')]);_0x429189[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_['pick'](_0x4a0606[_0x46cb('0x3e')],_0xdb582b[_0x46cb('0x45')]));if(_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x46')]){_0x429189[_0x46cb('0x47')]=_['merge'](_0x429189[_0x46cb('0x47')],{'$or':_[_0x46cb('0x57')](_0x429189[_0x46cb('0x41')],function(_0x2625e4){var _0x38b4a6={};_0x38b4a6[_0x2625e4]={'$like':'%'+_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x46')]+'%'};return _0x38b4a6;})});}_0x429189=_[_0x46cb('0x48')]({},_0x429189,_0x4a0606['options']);return _0x5e08f0['getFields'](_0x429189);}})['then'](function(_0x2bab19){if(_0x2bab19){_0x429b39=_0x2bab19[_0x46cb('0x56')];if(!_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x58')](_0x46cb('0x42'))){_0x429189[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x2c')]);_0x429189[_0x46cb('0x2b')]=qs[_0x46cb('0x2b')](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x2b')]);}return _0x5e08f0[_0x46cb('0x59')](_0x429189);}})['then'](function(_0x2e23e4){if(_0x2e23e4){return _0x2e23e4?{'count':_0x429b39,'rows':_0x2e23e4}:null;}})['then'](respondWithResult(_0x5a4b11,null))[_0x46cb('0x4d')](handleError(_0x5a4b11,null));};exports['getSubjects']=function(_0x424e49,_0x3a2aec,_0x2bb425){var _0x3a8b96={};var _0x585e10={};var _0xa7d3ab;var _0x243565;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x424e49[_0x46cb('0x4e')]['id']}})[_0x46cb('0x1d')](handleEntityNotFound(_0x3a2aec,null))[_0x46cb('0x1d')](function(_0x14f580){if(_0x14f580){_0xa7d3ab=_0x14f580;_0x585e10[_0x46cb('0x3d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x585e10[_0x46cb('0x3e')]=_[_0x46cb('0x4f')](_0x424e49[_0x46cb('0x3e')]);_0x585e10[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x585e10[_0x46cb('0x3d')],_0x585e10[_0x46cb('0x3e')]);_0x3a8b96[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0x585e10[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x424e49['query'][_0x46cb('0x40')]));_0x3a8b96[_0x46cb('0x41')]=_0x3a8b96[_0x46cb('0x41')][_0x46cb('0x56')]?_0x3a8b96['attributes']:_0x585e10[_0x46cb('0x3d')];_0x3a8b96[_0x46cb('0x43')]=qs[_0x46cb('0x44')](_0x424e49[_0x46cb('0x3e')]['sort']);_0x3a8b96[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_[_0x46cb('0x5a')](_0x424e49[_0x46cb('0x3e')],_0x585e10['filters']));if(_0x424e49['query']['filter']){_0x3a8b96[_0x46cb('0x47')]=_['merge'](_0x3a8b96[_0x46cb('0x47')],{'$or':_['map'](_0x3a8b96[_0x46cb('0x41')],function(_0x36a82b){var _0x29566a={};_0x29566a[_0x36a82b]={'$like':'%'+_0x424e49[_0x46cb('0x3e')]['filter']+'%'};return _0x29566a;})});}_0x3a8b96=_[_0x46cb('0x48')]({},_0x3a8b96,_0x424e49[_0x46cb('0x51')]);return _0xa7d3ab[_0x46cb('0x5b')](_0x3a8b96);}})[_0x46cb('0x1d')](function(_0x5747da){if(_0x5747da){_0x243565=_0x5747da['length'];if(!_0x424e49[_0x46cb('0x3e')][_0x46cb('0x58')](_0x46cb('0x42'))){_0x3a8b96[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x424e49[_0x46cb('0x3e')]['limit']);_0x3a8b96['offset']=qs[_0x46cb('0x2b')](_0x424e49[_0x46cb('0x3e')]['offset']);}return _0xa7d3ab[_0x46cb('0x5b')](_0x3a8b96);}})[_0x46cb('0x1d')](function(_0x20c41d){if(_0x20c41d){return _0x20c41d?{'count':_0x243565,'rows':_0x20c41d}:null;}})[_0x46cb('0x1d')](respondWithResult(_0x3a2aec,null))[_0x46cb('0x4d')](handleError(_0x3a2aec,null));};exports[_0x46cb('0x5c')]=function(_0x1aa6f4,_0x50c575,_0x21a9ca){var _0x1264f3={};var _0x392d6d={};var _0x1641b0;var _0x2a09de;return db[_0x46cb('0x50')][_0x46cb('0x54')]({'where':{'id':_0x1aa6f4[_0x46cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x50c575,null))['then'](function(_0x3cb612){if(_0x3cb612){_0x1641b0=_0x3cb612;_0x392d6d[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x55')]['rawAttributes']);_0x392d6d[_0x46cb('0x3e')]=_['keys'](_0x1aa6f4['query']);_0x392d6d[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x392d6d[_0x46cb('0x3d')],_0x392d6d[_0x46cb('0x3e')]);_0x1264f3['attributes']=_[_0x46cb('0x3f')](_0x392d6d['model'],qs[_0x46cb('0x40')](_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x40')]));_0x1264f3[_0x46cb('0x41')]=_0x1264f3[_0x46cb('0x41')][_0x46cb('0x56')]?_0x1264f3['attributes']:_0x392d6d['model'];_0x1264f3[_0x46cb('0x43')]=qs['sort'](_0x1aa6f4[_0x46cb('0x3e')]['sort']);_0x1264f3[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_[_0x46cb('0x5a')](_0x1aa6f4['query'],_0x392d6d[_0x46cb('0x45')]));if(_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x46')]){_0x1264f3[_0x46cb('0x47')]=_[_0x46cb('0x48')](_0x1264f3[_0x46cb('0x47')],{'$or':_[_0x46cb('0x57')](_0x1264f3[_0x46cb('0x41')],function(_0x3eadbd){var _0xe82f10={};_0xe82f10[_0x3eadbd]={'$like':'%'+_0x1aa6f4['query']['filter']+'%'};return _0xe82f10;})});}_0x1264f3=_[_0x46cb('0x48')]({},_0x1264f3,_0x1aa6f4[_0x46cb('0x51')]);return _0x1641b0['getDescriptions'](_0x1264f3);}})[_0x46cb('0x1d')](function(_0x4a529b){if(_0x4a529b){_0x2a09de=_0x4a529b['length'];if(!_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x58')]('nolimit')){_0x1264f3[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x2c')]);_0x1264f3[_0x46cb('0x2b')]=qs[_0x46cb('0x2b')](_0x1aa6f4['query'][_0x46cb('0x2b')]);}return _0x1641b0[_0x46cb('0x5c')](_0x1264f3);}})[_0x46cb('0x1d')](function(_0x368063){if(_0x368063){return _0x368063?{'count':_0x2a09de,'rows':_0x368063}:null;}})[_0x46cb('0x1d')](respondWithResult(_0x50c575,null))[_0x46cb('0x4d')](handleError(_0x50c575,null));}; \ No newline at end of file +var _0xd64b=['includeAll','options','find','create','body','destroy','getFields','ServicenowField','findOne','merge','getSubjects','nolimit','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','Sequelize','ValidationError','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','stack','send','index','map','ServicenowConfiguration','fieldName','key','name','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','include','findAll','rows','show','params','rawAttributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0x2d7484,_0x1b8083){_0x2d7484=_0x2d7484-0x0;var _0x8d13bc=_0xd64b[_0x2d7484];return _0x8d13bc;};'use strict';var pdf=require(_0xbd64('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd64('0x2'));var rp=require(_0xbd64('0x3'));var moment=require(_0xbd64('0x4'));var BPromise=require(_0xbd64('0x5'));var Mustache=require(_0xbd64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd64('0x7'));var fs=require('fs');var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var db=require(_0xbd64('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbd64('0x16')][_0xbd64('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3a941c,_0x2183e2,_0x367824){if(_0x367824){var _0x27438c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27438c[_0xbd64('0x18')](_0x2183e2)){return _0x3a941c;}else{throw new db[(_0xbd64('0x19'))][(_0xbd64('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 _0x3a941c;}}function respondWithRpcPromise(_0x2d1159,_0x13e7a4,_0x3ff550,_0x32fd34){return new BPromise(function(_0x29fc16,_0x49a914){var _0x352e6b=_0x32fd34||client;return _0x352e6b['request'](_0x2d1159,_0x3ff550)[_0xbd64('0x1b')](function(_0x1432a6){logger[_0xbd64('0x1c')](_0xbd64('0x1d'),_0x13e7a4,_0xbd64('0x1e'));logger[_0xbd64('0x1f')](_0xbd64('0x20'),_0x13e7a4,_0xbd64('0x1e'),JSON['stringify'](_0x1432a6));if(_0x1432a6[_0xbd64('0x21')]){if(_0x1432a6[_0xbd64('0x21')]['code']===0x1f4){logger['error'](_0xbd64('0x1d'),_0x13e7a4,_0x1432a6[_0xbd64('0x21')][_0xbd64('0x22')]);return _0x49a914(_0x1432a6[_0xbd64('0x21')][_0xbd64('0x22')]);}logger[_0xbd64('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13e7a4,_0x1432a6['error'][_0xbd64('0x22')]);return _0x29fc16(_0x1432a6[_0xbd64('0x21')][_0xbd64('0x22')]);}else{logger[_0xbd64('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13e7a4,'request\x20sent');_0x29fc16(_0x1432a6[_0xbd64('0x23')]['message']);}})[_0xbd64('0x24')](function(_0x5b356b){logger[_0xbd64('0x21')](_0xbd64('0x1d'),_0x13e7a4,_0x5b356b);_0x49a914(_0x5b356b);});});}function respondWithStatusCode(_0x3d12a0,_0x2d0993){_0x2d0993=_0x2d0993||0xcc;return function(_0x5ae417){if(_0x5ae417){return _0x3d12a0[_0xbd64('0x25')](_0x2d0993);}return _0x3d12a0[_0xbd64('0x26')](_0x2d0993)[_0xbd64('0x27')]();};}function respondWithResult(_0x2a44d0,_0x4d1563){_0x4d1563=_0x4d1563||0xc8;return function(_0x4e8719){if(_0x4e8719){return _0x2a44d0[_0xbd64('0x26')](_0x4d1563)['json'](_0x4e8719);}};}function respondWithFilteredResult(_0x53fe58,_0xfa918){return function(_0x5aacdd){if(_0x5aacdd){var _0x3cf5b7=_0x5aacdd[_0xbd64('0x28')],_0x5300e8=_0xfa918[_0xbd64('0x29')],_0x28199c=_0xfa918[_0xbd64('0x29')]+_0xfa918[_0xbd64('0x2a')],_0x5d8c35;if(_0x28199c>=_0x3cf5b7){_0x28199c=_0x3cf5b7;_0x5d8c35=0xc8;}else{_0x5d8c35=0xce;}_0x53fe58[_0xbd64('0x26')](_0x5d8c35);return _0x53fe58[_0xbd64('0x2b')]('Content-Range',_0x5300e8+'-'+_0x28199c+'/'+_0x3cf5b7)[_0xbd64('0x2c')](_0x5aacdd);}return null;};}function patchUpdates(_0xe876c9){return function(_0xc44280){try{jsonpatch[_0xbd64('0x2d')](_0xc44280,_0xe876c9,!![]);}catch(_0x14b2ad){return BPromise[_0xbd64('0x2e')](_0x14b2ad);}return _0xc44280['save']();};}function saveUpdates(_0x4c5961,_0x1e4593){return function(_0x576604){if(_0x576604){return _0x576604[_0xbd64('0x2f')](_0x4c5961)[_0xbd64('0x1b')](function(_0x54459f){return _0x54459f;});}return null;};}function removeEntity(_0x5cadde,_0x1c9c76){return function(_0x4e1834){if(_0x4e1834){return _0x4e1834['destroy']()[_0xbd64('0x1b')](function(){_0x5cadde[_0xbd64('0x26')](0xcc)[_0xbd64('0x27')]();});}};}function handleEntityNotFound(_0x50c58e,_0x231c37){return function(_0x569cb6){if(!_0x569cb6){_0x50c58e[_0xbd64('0x25')](0x194);}return _0x569cb6;};}function handleError(_0x1950e8,_0x11d4ea){_0x11d4ea=_0x11d4ea||0x1f4;return function(_0x243588){logger[_0xbd64('0x21')](_0x243588[_0xbd64('0x30')]);if(_0x243588['name']){delete _0x243588['name'];}_0x1950e8[_0xbd64('0x26')](_0x11d4ea)[_0xbd64('0x31')](_0x243588);};}exports[_0xbd64('0x32')]=function(_0xc5d971,_0x5cf522){var _0x3b245e={},_0x54784f={},_0x5a74a9={'count':0x0,'rows':[]};var _0x1db1fa=_[_0xbd64('0x33')](db[_0xbd64('0x34')]['rawAttributes'],function(_0x5afe9b){return{'name':_0x5afe9b[_0xbd64('0x35')],'type':_0x5afe9b['type'][_0xbd64('0x36')]};});_0x54784f['model']=_[_0xbd64('0x33')](_0x1db1fa,_0xbd64('0x37'));_0x54784f['query']=_[_0xbd64('0x38')](_0xc5d971['query']);_0x54784f['filters']=_[_0xbd64('0x39')](_0x54784f[_0xbd64('0x3a')],_0x54784f[_0xbd64('0x3b')]);_0x3b245e['attributes']=_['intersection'](_0x54784f['model'],qs[_0xbd64('0x3c')](_0xc5d971[_0xbd64('0x3b')]['fields']));_0x3b245e[_0xbd64('0x3d')]=_0x3b245e[_0xbd64('0x3d')][_0xbd64('0x3e')]?_0x3b245e[_0xbd64('0x3d')]:_0x54784f['model'];if(!_0xc5d971['query'][_0xbd64('0x3f')]('nolimit')){_0x3b245e['limit']=qs[_0xbd64('0x2a')](_0xc5d971[_0xbd64('0x3b')][_0xbd64('0x2a')]);_0x3b245e[_0xbd64('0x29')]=qs[_0xbd64('0x29')](_0xc5d971[_0xbd64('0x3b')][_0xbd64('0x29')]);}_0x3b245e[_0xbd64('0x40')]=qs['sort'](_0xc5d971[_0xbd64('0x3b')][_0xbd64('0x41')]);_0x3b245e['where']=qs[_0xbd64('0x42')](_[_0xbd64('0x43')](_0xc5d971[_0xbd64('0x3b')],_0x54784f[_0xbd64('0x42')]),_0x1db1fa);if(_0xc5d971[_0xbd64('0x3b')][_0xbd64('0x44')]){_0x3b245e[_0xbd64('0x45')]=_['merge'](_0x3b245e[_0xbd64('0x45')],{'$or':_['map'](_0x1db1fa,function(_0x18a652){if(_0x18a652['type']!==_0xbd64('0x46')){var _0xe6f9f8={};_0xe6f9f8[_0x18a652[_0xbd64('0x37')]]={'$like':'%'+_0xc5d971['query'][_0xbd64('0x44')]+'%'};return _0xe6f9f8;}})});}_0x3b245e=_['merge']({},_0x3b245e,_0xc5d971['options']);var _0x553fa0={'where':_0x3b245e[_0xbd64('0x45')]};return db[_0xbd64('0x34')][_0xbd64('0x28')](_0x553fa0)[_0xbd64('0x1b')](function(_0x168409){_0x5a74a9[_0xbd64('0x28')]=_0x168409;if(_0xc5d971[_0xbd64('0x3b')]['includeAll']){_0x3b245e[_0xbd64('0x47')]=[{'all':!![]}];}return db[_0xbd64('0x34')][_0xbd64('0x48')](_0x3b245e);})['then'](function(_0x105bee){_0x5a74a9[_0xbd64('0x49')]=_0x105bee;return _0x5a74a9;})[_0xbd64('0x1b')](respondWithFilteredResult(_0x5cf522,_0x3b245e))[_0xbd64('0x24')](handleError(_0x5cf522,null));};exports[_0xbd64('0x4a')]=function(_0x5a6b5e,_0x283699){var _0x1a9ec8={'raw':![],'where':{'id':_0x5a6b5e[_0xbd64('0x4b')]['id']}},_0x2a8011={};_0x2a8011['model']=_['keys'](db[_0xbd64('0x34')][_0xbd64('0x4c')]);_0x2a8011[_0xbd64('0x3b')]=_[_0xbd64('0x38')](_0x5a6b5e[_0xbd64('0x3b')]);_0x2a8011[_0xbd64('0x42')]=_[_0xbd64('0x39')](_0x2a8011[_0xbd64('0x3a')],_0x2a8011[_0xbd64('0x3b')]);_0x1a9ec8[_0xbd64('0x3d')]=_[_0xbd64('0x39')](_0x2a8011[_0xbd64('0x3a')],qs[_0xbd64('0x3c')](_0x5a6b5e[_0xbd64('0x3b')][_0xbd64('0x3c')]));_0x1a9ec8['attributes']=_0x1a9ec8[_0xbd64('0x3d')]['length']?_0x1a9ec8['attributes']:_0x2a8011['model'];if(_0x5a6b5e['query'][_0xbd64('0x4d')]){_0x1a9ec8[_0xbd64('0x47')]=[{'all':!![]}];}_0x1a9ec8=_['merge']({},_0x1a9ec8,_0x5a6b5e[_0xbd64('0x4e')]);return db[_0xbd64('0x34')][_0xbd64('0x4f')](_0x1a9ec8)['then'](handleEntityNotFound(_0x283699,null))[_0xbd64('0x1b')](respondWithResult(_0x283699,null))[_0xbd64('0x24')](handleError(_0x283699,null));};exports[_0xbd64('0x50')]=function(_0x1db94c,_0x2436c1){return db[_0xbd64('0x34')]['create'](_0x1db94c['body'],{})['then'](respondWithResult(_0x2436c1,0xc9))[_0xbd64('0x24')](handleError(_0x2436c1,null));};exports[_0xbd64('0x2f')]=function(_0x3548fe,_0x958272){if(_0x3548fe['body']['id']){delete _0x3548fe[_0xbd64('0x51')]['id'];}return db[_0xbd64('0x34')][_0xbd64('0x4f')]({'where':{'id':_0x3548fe[_0xbd64('0x4b')]['id']}})[_0xbd64('0x1b')](handleEntityNotFound(_0x958272,null))[_0xbd64('0x1b')](saveUpdates(_0x3548fe['body'],null))[_0xbd64('0x1b')](respondWithResult(_0x958272,null))[_0xbd64('0x24')](handleError(_0x958272,null));};exports[_0xbd64('0x52')]=function(_0x1fe3e5,_0x465661){return db[_0xbd64('0x34')][_0xbd64('0x4f')]({'where':{'id':_0x1fe3e5[_0xbd64('0x4b')]['id']}})[_0xbd64('0x1b')](handleEntityNotFound(_0x465661,null))[_0xbd64('0x1b')](removeEntity(_0x465661,null))[_0xbd64('0x24')](handleError(_0x465661,null));};exports[_0xbd64('0x53')]=function(_0x4a1e21,_0x56c7d9,_0x29c90a){var _0x2bcf68={};var _0x5ab7b3={};var _0x550f5f;var _0x46fa0d;return db[_0xbd64('0x34')]['findOne']({'where':{'id':_0x4a1e21[_0xbd64('0x4b')]['id']}})[_0xbd64('0x1b')](handleEntityNotFound(_0x56c7d9,null))[_0xbd64('0x1b')](function(_0x3b592e){if(_0x3b592e){_0x550f5f=_0x3b592e;_0x5ab7b3[_0xbd64('0x3a')]=_[_0xbd64('0x38')](db[_0xbd64('0x54')][_0xbd64('0x4c')]);_0x5ab7b3[_0xbd64('0x3b')]=_['keys'](_0x4a1e21[_0xbd64('0x3b')]);_0x5ab7b3[_0xbd64('0x42')]=_[_0xbd64('0x39')](_0x5ab7b3['model'],_0x5ab7b3[_0xbd64('0x3b')]);_0x2bcf68[_0xbd64('0x3d')]=_['intersection'](_0x5ab7b3[_0xbd64('0x3a')],qs[_0xbd64('0x3c')](_0x4a1e21[_0xbd64('0x3b')][_0xbd64('0x3c')]));_0x2bcf68[_0xbd64('0x3d')]=_0x2bcf68[_0xbd64('0x3d')]['length']?_0x2bcf68[_0xbd64('0x3d')]:_0x5ab7b3[_0xbd64('0x3a')];_0x2bcf68[_0xbd64('0x40')]=qs[_0xbd64('0x41')](_0x4a1e21['query'][_0xbd64('0x41')]);_0x2bcf68[_0xbd64('0x45')]=qs['filters'](_[_0xbd64('0x43')](_0x4a1e21['query'],_0x5ab7b3[_0xbd64('0x42')]));if(_0x4a1e21[_0xbd64('0x3b')][_0xbd64('0x44')]){_0x2bcf68[_0xbd64('0x45')]=_['merge'](_0x2bcf68[_0xbd64('0x45')],{'$or':_[_0xbd64('0x33')](_0x2bcf68[_0xbd64('0x3d')],function(_0x23925c){var _0x463a60={};_0x463a60[_0x23925c]={'$like':'%'+_0x4a1e21[_0xbd64('0x3b')]['filter']+'%'};return _0x463a60;})});}_0x2bcf68=_['merge']({},_0x2bcf68,_0x4a1e21['options']);return _0x550f5f[_0xbd64('0x53')](_0x2bcf68);}})[_0xbd64('0x1b')](function(_0x182dcd){if(_0x182dcd){_0x46fa0d=_0x182dcd[_0xbd64('0x3e')];if(!_0x4a1e21[_0xbd64('0x3b')][_0xbd64('0x3f')]('nolimit')){_0x2bcf68[_0xbd64('0x2a')]=qs[_0xbd64('0x2a')](_0x4a1e21[_0xbd64('0x3b')][_0xbd64('0x2a')]);_0x2bcf68[_0xbd64('0x29')]=qs[_0xbd64('0x29')](_0x4a1e21[_0xbd64('0x3b')][_0xbd64('0x29')]);}return _0x550f5f[_0xbd64('0x53')](_0x2bcf68);}})[_0xbd64('0x1b')](function(_0x32e611){if(_0x32e611){return _0x32e611?{'count':_0x46fa0d,'rows':_0x32e611}:null;}})[_0xbd64('0x1b')](respondWithResult(_0x56c7d9,null))['catch'](handleError(_0x56c7d9,null));};exports['getSubjects']=function(_0x7e5c1c,_0x363da8,_0x2ec631){var _0x4fc352={};var _0x9b99b3={};var _0x4fccd9;var _0x18bad6;return db[_0xbd64('0x34')][_0xbd64('0x55')]({'where':{'id':_0x7e5c1c[_0xbd64('0x4b')]['id']}})['then'](handleEntityNotFound(_0x363da8,null))[_0xbd64('0x1b')](function(_0x5714a6){if(_0x5714a6){_0x4fccd9=_0x5714a6;_0x9b99b3[_0xbd64('0x3a')]=_[_0xbd64('0x38')](db[_0xbd64('0x54')][_0xbd64('0x4c')]);_0x9b99b3[_0xbd64('0x3b')]=_['keys'](_0x7e5c1c[_0xbd64('0x3b')]);_0x9b99b3[_0xbd64('0x42')]=_['intersection'](_0x9b99b3[_0xbd64('0x3a')],_0x9b99b3[_0xbd64('0x3b')]);_0x4fc352[_0xbd64('0x3d')]=_[_0xbd64('0x39')](_0x9b99b3['model'],qs[_0xbd64('0x3c')](_0x7e5c1c['query'][_0xbd64('0x3c')]));_0x4fc352[_0xbd64('0x3d')]=_0x4fc352[_0xbd64('0x3d')]['length']?_0x4fc352['attributes']:_0x9b99b3['model'];_0x4fc352['order']=qs[_0xbd64('0x41')](_0x7e5c1c[_0xbd64('0x3b')][_0xbd64('0x41')]);_0x4fc352[_0xbd64('0x45')]=qs[_0xbd64('0x42')](_['pick'](_0x7e5c1c[_0xbd64('0x3b')],_0x9b99b3[_0xbd64('0x42')]));if(_0x7e5c1c[_0xbd64('0x3b')][_0xbd64('0x44')]){_0x4fc352[_0xbd64('0x45')]=_['merge'](_0x4fc352[_0xbd64('0x45')],{'$or':_[_0xbd64('0x33')](_0x4fc352[_0xbd64('0x3d')],function(_0x808467){var _0x5875da={};_0x5875da[_0x808467]={'$like':'%'+_0x7e5c1c['query'][_0xbd64('0x44')]+'%'};return _0x5875da;})});}_0x4fc352=_[_0xbd64('0x56')]({},_0x4fc352,_0x7e5c1c[_0xbd64('0x4e')]);return _0x4fccd9[_0xbd64('0x57')](_0x4fc352);}})[_0xbd64('0x1b')](function(_0x39990a){if(_0x39990a){_0x18bad6=_0x39990a[_0xbd64('0x3e')];if(!_0x7e5c1c[_0xbd64('0x3b')]['hasOwnProperty'](_0xbd64('0x58'))){_0x4fc352['limit']=qs[_0xbd64('0x2a')](_0x7e5c1c[_0xbd64('0x3b')][_0xbd64('0x2a')]);_0x4fc352['offset']=qs[_0xbd64('0x29')](_0x7e5c1c['query']['offset']);}return _0x4fccd9[_0xbd64('0x57')](_0x4fc352);}})[_0xbd64('0x1b')](function(_0x448254){if(_0x448254){return _0x448254?{'count':_0x18bad6,'rows':_0x448254}:null;}})['then'](respondWithResult(_0x363da8,null))[_0xbd64('0x24')](handleError(_0x363da8,null));};exports[_0xbd64('0x59')]=function(_0x8150bb,_0x35cf6a,_0x5ae7cf){var _0x17a4c4={};var _0x152a5e={};var _0x355b87;var _0x1964f9;return db[_0xbd64('0x34')][_0xbd64('0x55')]({'where':{'id':_0x8150bb[_0xbd64('0x4b')]['id']}})[_0xbd64('0x1b')](handleEntityNotFound(_0x35cf6a,null))[_0xbd64('0x1b')](function(_0x39a803){if(_0x39a803){_0x355b87=_0x39a803;_0x152a5e[_0xbd64('0x3a')]=_[_0xbd64('0x38')](db[_0xbd64('0x54')][_0xbd64('0x4c')]);_0x152a5e['query']=_['keys'](_0x8150bb[_0xbd64('0x3b')]);_0x152a5e[_0xbd64('0x42')]=_[_0xbd64('0x39')](_0x152a5e['model'],_0x152a5e[_0xbd64('0x3b')]);_0x17a4c4['attributes']=_[_0xbd64('0x39')](_0x152a5e[_0xbd64('0x3a')],qs[_0xbd64('0x3c')](_0x8150bb[_0xbd64('0x3b')]['fields']));_0x17a4c4[_0xbd64('0x3d')]=_0x17a4c4[_0xbd64('0x3d')]['length']?_0x17a4c4[_0xbd64('0x3d')]:_0x152a5e['model'];_0x17a4c4[_0xbd64('0x40')]=qs[_0xbd64('0x41')](_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x41')]);_0x17a4c4[_0xbd64('0x45')]=qs[_0xbd64('0x42')](_['pick'](_0x8150bb[_0xbd64('0x3b')],_0x152a5e['filters']));if(_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x44')]){_0x17a4c4['where']=_[_0xbd64('0x56')](_0x17a4c4['where'],{'$or':_[_0xbd64('0x33')](_0x17a4c4[_0xbd64('0x3d')],function(_0x3ba513){var _0x4bf21a={};_0x4bf21a[_0x3ba513]={'$like':'%'+_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x44')]+'%'};return _0x4bf21a;})});}_0x17a4c4=_[_0xbd64('0x56')]({},_0x17a4c4,_0x8150bb[_0xbd64('0x4e')]);return _0x355b87[_0xbd64('0x59')](_0x17a4c4);}})['then'](function(_0x58efa2){if(_0x58efa2){_0x1964f9=_0x58efa2[_0xbd64('0x3e')];if(!_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x3f')](_0xbd64('0x58'))){_0x17a4c4[_0xbd64('0x2a')]=qs[_0xbd64('0x2a')](_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x2a')]);_0x17a4c4[_0xbd64('0x29')]=qs[_0xbd64('0x29')](_0x8150bb[_0xbd64('0x3b')][_0xbd64('0x29')]);}return _0x355b87[_0xbd64('0x59')](_0x17a4c4);}})['then'](function(_0x3220d9){if(_0x3220d9){return _0x3220d9?{'count':_0x1964f9,'rows':_0x3220d9}:null;}})[_0xbd64('0x1b')](respondWithResult(_0x35cf6a,null))['catch'](handleError(_0x35cf6a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b139589..e86334e 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 _0xf93d=['define','ServicenowConfiguration','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0xf93d,0x66));var _0xdf93=function(_0x58c2f2,_0x4cb6a2){_0x58c2f2=_0x58c2f2-0x0;var _0x34963e=_0xf93d[_0x58c2f2];return _0x34963e;};'use strict';var _=require(_0xdf93('0x0'));var util=require('util');var logger=require(_0xdf93('0x1'))('api');var moment=require(_0xdf93('0x2'));var BPromise=require(_0xdf93('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf93('0x4'));var rimraf=require(_0xdf93('0x5'));var config=require(_0xdf93('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xdf93('0x7')]=function(_0x550bd0,_0x1c6993){return _0x550bd0[_0xdf93('0x8')](_0xdf93('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd63e=['request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c3fde,_0x29edda){var _0x415fa7=function(_0x17b834){while(--_0x17b834){_0x4c3fde['push'](_0x4c3fde['shift']());}};_0x415fa7(++_0x29edda);}(_0xd63e,0xaf));var _0xed63=function(_0x2ad01a,_0x5b2b17){_0x2ad01a=_0x2ad01a-0x0;var _0x128057=_0xd63e[_0x2ad01a];return _0x128057;};'use strict';var _=require(_0xed63('0x0'));var util=require(_0xed63('0x1'));var logger=require(_0xed63('0x2'))('api');var moment=require(_0xed63('0x3'));var BPromise=require(_0xed63('0x4'));var rp=require(_0xed63('0x5'));var fs=require('fs');var path=require(_0xed63('0x6'));var rimraf=require('rimraf');var config=require(_0xed63('0x7'));var attributes=require(_0xed63('0x8'));module['exports']=function(_0x2b7b57,_0x516b45){return _0x2b7b57[_0xed63('0x9')](_0xed63('0xa'),attributes,{'tableName':_0xed63('0xb'),'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 d359fcc..b78457f 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 _0xab11=['info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','client','http','then'];(function(_0x374499,_0x6c157c){var _0x42f5ff=function(_0xcfe9a7){while(--_0xcfe9a7){_0x374499['push'](_0x374499['shift']());}};_0x42f5ff(++_0x6c157c);}(_0xab11,0x109));var _0x1ab1=function(_0x5d220b,_0x48d9ec){_0x5d220b=_0x5d220b-0x0;var _0x252226=_0xab11[_0x5d220b];return _0x252226;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ab1('0x0'));var BPromise=require(_0x1ab1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ab1('0x2'));var db=require(_0x1ab1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ab1('0x4')][_0x1ab1('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x507246,_0x52775b,_0x76686){return new BPromise(function(_0x34d905,_0xf5c881){return client['request'](_0x507246,_0x76686)[_0x1ab1('0x6')](function(_0x24f27b){logger[_0x1ab1('0x7')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52775b,_0x1ab1('0x8'));logger[_0x1ab1('0x9')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x52775b,_0x1ab1('0x8'),JSON[_0x1ab1('0xa')](_0x24f27b));if(_0x24f27b['error']){if(_0x24f27b[_0x1ab1('0xb')][_0x1ab1('0xc')]===0x1f4){logger['error'](_0x1ab1('0xd'),_0x52775b,_0x24f27b['error'][_0x1ab1('0xe')]);return _0xf5c881(_0x24f27b[_0x1ab1('0xb')][_0x1ab1('0xe')]);}logger[_0x1ab1('0xb')](_0x1ab1('0xd'),_0x52775b,_0x24f27b[_0x1ab1('0xb')][_0x1ab1('0xe')]);return _0x34d905(_0x24f27b[_0x1ab1('0xb')][_0x1ab1('0xe')]);}else{logger[_0x1ab1('0x7')](_0x1ab1('0xd'),_0x52775b,_0x1ab1('0x8'));_0x34d905(_0x24f27b[_0x1ab1('0xf')][_0x1ab1('0xe')]);}})[_0x1ab1('0x10')](function(_0x24cdd6){logger[_0x1ab1('0xb')](_0x1ab1('0xd'),_0x52775b,_0x24cdd6);_0xf5c881(_0x24cdd6);});});} \ No newline at end of file +var _0x70c2=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x70c2,0x15e));var _0x270c=function(_0x31edae,_0x26b6f0){_0x31edae=_0x31edae-0x0;var _0x12e448=_0x70c2[_0x31edae];return _0x12e448;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x270c('0x0'));var db=require(_0x270c('0x1'))['db'];var utils=require(_0x270c('0x2'));var logger=require(_0x270c('0x3'))('rpc');var config=require(_0x270c('0x4'));var jayson=require(_0x270c('0x5'));var client=jayson[_0x270c('0x6')][_0x270c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x236581,_0xa4ff2d,_0x37806c){return new BPromise(function(_0x30e33e,_0x55d645){return client[_0x270c('0x8')](_0x236581,_0x37806c)[_0x270c('0x9')](function(_0x233eb9){logger[_0x270c('0xa')](_0x270c('0xb'),_0xa4ff2d,_0x270c('0xc'));logger['debug'](_0x270c('0xd'),_0xa4ff2d,_0x270c('0xc'),JSON[_0x270c('0xe')](_0x233eb9));if(_0x233eb9[_0x270c('0xf')]){if(_0x233eb9[_0x270c('0xf')][_0x270c('0x10')]===0x1f4){logger[_0x270c('0xf')](_0x270c('0xb'),_0xa4ff2d,_0x233eb9[_0x270c('0xf')][_0x270c('0x11')]);return _0x55d645(_0x233eb9[_0x270c('0xf')][_0x270c('0x11')]);}logger[_0x270c('0xf')](_0x270c('0xb'),_0xa4ff2d,_0x233eb9[_0x270c('0xf')][_0x270c('0x11')]);return _0x30e33e(_0x233eb9[_0x270c('0xf')][_0x270c('0x11')]);}else{logger[_0x270c('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0xa4ff2d,'request\x20sent');_0x30e33e(_0x233eb9['result'][_0x270c('0x11')]);}})['catch'](function(_0x2bf030){logger[_0x270c('0xf')](_0x270c('0xb'),_0xa4ff2d,_0x2bf030);_0x55d645(_0x2bf030);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 269561c..0a281cf 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 _0x70dd=['Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x70dd,0x7a));var _0xd70d=function(_0x10cc87,_0x287db3){_0x10cc87=_0x10cc87-0x0;var _0x2ed1d1=_0x70dd[_0x10cc87];return _0x2ed1d1;};'use strict';var multer=require('multer');var util=require(_0xd70d('0x0'));var path=require(_0xd70d('0x1'));var timeout=require(_0xd70d('0x2'));var express=require(_0xd70d('0x3'));var router=express[_0xd70d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd70d('0x5'));var config=require(_0xd70d('0x6'));var controller=require(_0xd70d('0x7'));router['get']('/',auth[_0xd70d('0x8')](),controller['index']);router[_0xd70d('0x9')](_0xd70d('0xa'),auth[_0xd70d('0x8')](),controller['show']);router[_0xd70d('0xb')]('/',auth[_0xd70d('0x8')](),controller[_0xd70d('0xc')]);router[_0xd70d('0xd')](_0xd70d('0xa'),auth[_0xd70d('0x8')](),controller[_0xd70d('0xe')]);router[_0xd70d('0xf')](_0xd70d('0xa'),auth[_0xd70d('0x8')](),controller[_0xd70d('0x10')]);module[_0xd70d('0x11')]=router; \ No newline at end of file +var _0x3908=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x3908,0x75));var _0x8390=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x3908[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x8390('0x0'));var util=require(_0x8390('0x1'));var path=require(_0x8390('0x2'));var timeout=require('connect-timeout');var express=require(_0x8390('0x3'));var router=express[_0x8390('0x4')]();var auth=require(_0x8390('0x5'));var interaction=require(_0x8390('0x6'));var config=require(_0x8390('0x7'));var controller=require(_0x8390('0x8'));router[_0x8390('0x9')]('/',auth[_0x8390('0xa')](),controller[_0x8390('0xb')]);router[_0x8390('0x9')](_0x8390('0xc'),auth[_0x8390('0xa')](),controller['show']);router[_0x8390('0xd')]('/',auth[_0x8390('0xa')](),controller[_0x8390('0xe')]);router[_0x8390('0xf')](_0x8390('0xc'),auth[_0x8390('0xa')](),controller[_0x8390('0x10')]);router[_0x8390('0x11')](_0x8390('0xc'),auth[_0x8390('0xa')](),controller[_0x8390('0x12')]);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 e61e9fb..315b79e 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 _0xd0d5=['variable','STRING','BOOLEAN','customVariable','keyValue','string','ENUM'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x372135,_0x27f9a3){_0x372135=_0x372135-0x0;var _0x525508=_0xd0d5[_0x372135];return _0x525508;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x5d0d('0x0'),_0x5d0d('0x1')),'defaultValue':_0x5d0d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5d0d('0x3')](_0x5d0d('0x2'),_0x5d0d('0x4'),_0x5d0d('0x0'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5d0d('0x5')]},'nameField':{'type':Sequelize[_0x5d0d('0x5')]},'customField':{'type':Sequelize[_0x5d0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d0d('0x5')]}}; \ No newline at end of file +var _0x4711=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x42b949,_0x5ef2cd){var _0x1bd737=function(_0x5d9af2){while(--_0x5d9af2){_0x42b949['push'](_0x42b949['shift']());}};_0x1bd737(++_0x5ef2cd);}(_0x4711,0x10c));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1471('0x0'));module[_0x1471('0x1')]={'type':{'type':Sequelize[_0x1471('0x2')](_0x1471('0x3'),_0x1471('0x4'),_0x1471('0x5'),_0x1471('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1471('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1471('0x2')](_0x1471('0x3'),_0x1471('0x4'),_0x1471('0x5'))},'keyContent':{'type':Sequelize[_0x1471('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1471('0x7')]},'customField':{'type':Sequelize[_0x1471('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1471('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 8947c76..035184a 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(_0x6e57fc,_0x484568){var _0x309bea=function(_0x107b0b){while(--_0x107b0b){_0x6e57fc['push'](_0x6e57fc['shift']());}};_0x309bea(++_0x484568);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x5b54de,_0x4a0432){var _0x4d8131=function(_0xbe8424){while(--_0xbe8424){_0x5b54de['push'](_0x5b54de['shift']());}};_0x4d8131(++_0x4a0432);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 33da498..4285f9f 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 _0xc1e6=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x31ec9a,_0x55d7c1){var _0x27af32=function(_0x2f2341){while(--_0x2f2341){_0x31ec9a['push'](_0x31ec9a['shift']());}};_0x27af32(++_0x55d7c1);}(_0xc1e6,0x1c7));var _0x6c1e=function(_0x44f000,_0x4fcb9f){_0x44f000=_0x44f000-0x0;var _0xa7ffd1=_0xc1e6[_0x44f000];return _0xa7ffd1;};'use strict';var _=require(_0x6c1e('0x0'));var util=require(_0x6c1e('0x1'));var logger=require(_0x6c1e('0x2'))(_0x6c1e('0x3'));var moment=require(_0x6c1e('0x4'));var BPromise=require(_0x6c1e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c1e('0x6'));var rimraf=require(_0x6c1e('0x7'));var config=require(_0x6c1e('0x8'));var attributes=require(_0x6c1e('0x9'));module['exports']=function(_0x5af549,_0x230400){return _0x5af549['define'](_0x6c1e('0xa'),attributes,{'tableName':_0x6c1e('0xb'),'paranoid':![],'indexes':[{'name':_0x6c1e('0xc'),'fields':[_0x6c1e('0xd'),_0x6c1e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5da=['lodash','../../config/logger','api','bluebird','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','FieldId'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0xb5da,0x17c));var _0xab5d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb5da[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xab5d('0x0'));var util=require('util');var logger=require(_0xab5d('0x1'))(_0xab5d('0x2'));var moment=require('moment');var BPromise=require(_0xab5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab5d('0x4'));var rimraf=require(_0xab5d('0x5'));var config=require('../../config/environment');var attributes=require(_0xab5d('0x6'));module[_0xab5d('0x7')]=function(_0x20f317,_0x17a3ba){return _0x20f317['define'](_0xab5d('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xab5d('0x9')],'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 c1ccd39..2881ef7 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 _0x4960=['debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','http','request','then','info','request\x20sent'];(function(_0x575446,_0x1a13fa){var _0x2fb644=function(_0x2770b4){while(--_0x2770b4){_0x575446['push'](_0x575446['shift']());}};_0x2fb644(++_0x1a13fa);}(_0x4960,0xce));var _0x0496=function(_0x519b2a,_0x438e7e){_0x519b2a=_0x519b2a-0x0;var _0x14b120=_0x4960[_0x519b2a];return _0x14b120;};'use strict';var _=require(_0x0496('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0496('0x1'));var rs=require(_0x0496('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0496('0x3'))['db'];var utils=require(_0x0496('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0496('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x186ab1,_0x51a214,_0x1b7a89){return new BPromise(function(_0x5cae94,_0x5c0ad){return client[_0x0496('0x6')](_0x186ab1,_0x1b7a89)[_0x0496('0x7')](function(_0x3fe6c5){logger[_0x0496('0x8')]('ServicenowField,\x20%s,\x20%s',_0x51a214,_0x0496('0x9'));logger[_0x0496('0xa')](_0x0496('0xb'),_0x51a214,_0x0496('0x9'),JSON['stringify'](_0x3fe6c5));if(_0x3fe6c5[_0x0496('0xc')]){if(_0x3fe6c5[_0x0496('0xc')][_0x0496('0xd')]===0x1f4){logger['error'](_0x0496('0xe'),_0x51a214,_0x3fe6c5[_0x0496('0xc')]['message']);return _0x5c0ad(_0x3fe6c5[_0x0496('0xc')]['message']);}logger[_0x0496('0xc')](_0x0496('0xe'),_0x51a214,_0x3fe6c5[_0x0496('0xc')][_0x0496('0xf')]);return _0x5cae94(_0x3fe6c5[_0x0496('0xc')][_0x0496('0xf')]);}else{logger['info'](_0x0496('0xe'),_0x51a214,'request\x20sent');_0x5cae94(_0x3fe6c5[_0x0496('0x10')][_0x0496('0xf')]);}})[_0x0496('0x11')](function(_0x32f15d){logger['error']('ServicenowField,\x20%s,\x20%s',_0x51a214,_0x32f15d);_0x5c0ad(_0x32f15d);});});} \ No newline at end of file +var _0xf4d7=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x1b1c25,_0x5d6398){var _0x1d6e20=function(_0x114079){while(--_0x114079){_0x1b1c25['push'](_0x1b1c25['shift']());}};_0x1d6e20(++_0x5d6398);}(_0xf4d7,0xc6));var _0x7f4d=function(_0x4f33ff,_0xd0cb0f){_0x4f33ff=_0x4f33ff-0x0;var _0x25b114=_0xf4d7[_0x4f33ff];return _0x25b114;};'use strict';var _=require(_0x7f4d('0x0'));var util=require(_0x7f4d('0x1'));var moment=require('moment');var BPromise=require(_0x7f4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f4d('0x3'));var db=require(_0x7f4d('0x4'))['db'];var utils=require(_0x7f4d('0x5'));var logger=require(_0x7f4d('0x6'))('rpc');var config=require(_0x7f4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f4d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300556,_0x5f4902,_0x301fad){return new BPromise(function(_0x11c3a0,_0x4d6f03){return client[_0x7f4d('0x9')](_0x300556,_0x301fad)[_0x7f4d('0xa')](function(_0x1ff65c){logger[_0x7f4d('0xb')](_0x7f4d('0xc'),_0x5f4902,_0x7f4d('0xd'));logger[_0x7f4d('0xe')](_0x7f4d('0xf'),_0x5f4902,_0x7f4d('0xd'),JSON[_0x7f4d('0x10')](_0x1ff65c));if(_0x1ff65c[_0x7f4d('0x11')]){if(_0x1ff65c[_0x7f4d('0x11')][_0x7f4d('0x12')]===0x1f4){logger[_0x7f4d('0x11')](_0x7f4d('0xc'),_0x5f4902,_0x1ff65c[_0x7f4d('0x11')]['message']);return _0x4d6f03(_0x1ff65c[_0x7f4d('0x11')][_0x7f4d('0x13')]);}logger[_0x7f4d('0x11')](_0x7f4d('0xc'),_0x5f4902,_0x1ff65c[_0x7f4d('0x11')][_0x7f4d('0x13')]);return _0x11c3a0(_0x1ff65c['error'][_0x7f4d('0x13')]);}else{logger[_0x7f4d('0xb')](_0x7f4d('0xc'),_0x5f4902,_0x7f4d('0xd'));_0x11c3a0(_0x1ff65c['result']['message']);}})[_0x7f4d('0x14')](function(_0x301411){logger[_0x7f4d('0x11')](_0x7f4d('0xc'),_0x5f4902,_0x301411);_0x4d6f03(_0x301411);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 613e3da..25b8b16 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 _0xd0e3=['../../config/environment','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xd0e3,0xec));var _0x3d0e=function(_0x800485,_0x4f8d66){_0x800485=_0x800485-0x0;var _0xb8befd=_0xd0e3[_0x800485];return _0xb8befd;};'use strict';var multer=require(_0x3d0e('0x0'));var util=require(_0x3d0e('0x1'));var path=require('path');var timeout=require(_0x3d0e('0x2'));var express=require(_0x3d0e('0x3'));var router=express[_0x3d0e('0x4')]();var auth=require(_0x3d0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d0e('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x3d0e('0x7')]('/',auth['isAuthenticated'](),controller[_0x3d0e('0x8')]);router[_0x3d0e('0x7')](_0x3d0e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3d0e('0x7')]('/:id/configurations',auth[_0x3d0e('0xa')](),controller[_0x3d0e('0xb')]);router[_0x3d0e('0x7')](_0x3d0e('0xc'),auth['isAuthenticated'](),controller[_0x3d0e('0xd')]);router[_0x3d0e('0xe')]('/',auth[_0x3d0e('0xa')](),controller[_0x3d0e('0xf')]);router[_0x3d0e('0xe')](_0x3d0e('0x10'),auth[_0x3d0e('0xa')](),controller[_0x3d0e('0x11')]);router[_0x3d0e('0x12')](_0x3d0e('0x9'),auth[_0x3d0e('0xa')](),controller[_0x3d0e('0x13')]);router[_0x3d0e('0x14')](_0x3d0e('0x9'),auth['isAuthenticated'](),controller[_0x3d0e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7bd9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','index','get','show','/:id/configurations','isAuthenticated','getConfigurations','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x19f582,_0x1a4334){var _0x257ca7=function(_0xecba30){while(--_0xecba30){_0x19f582['push'](_0x19f582['shift']());}};_0x257ca7(++_0x1a4334);}(_0x7bd9,0x163));var _0x97bd=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7bd9[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x97bd('0x0'));var util=require(_0x97bd('0x1'));var path=require(_0x97bd('0x2'));var timeout=require(_0x97bd('0x3'));var express=require(_0x97bd('0x4'));var router=express[_0x97bd('0x5')]();var auth=require(_0x97bd('0x6'));var interaction=require(_0x97bd('0x7'));var config=require(_0x97bd('0x8'));var controller=require(_0x97bd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x97bd('0xa')]);router[_0x97bd('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x97bd('0xc')]);router[_0x97bd('0xb')](_0x97bd('0xd'),auth[_0x97bd('0xe')](),controller[_0x97bd('0xf')]);router['get']('/:id/fields',auth[_0x97bd('0xe')](),controller['getFields']);router[_0x97bd('0x10')]('/',auth['isAuthenticated'](),controller[_0x97bd('0x11')]);router[_0x97bd('0x10')](_0x97bd('0xd'),auth[_0x97bd('0xe')](),controller[_0x97bd('0x12')]);router['put'](_0x97bd('0x13'),auth[_0x97bd('0xe')](),controller[_0x97bd('0x14')]);router[_0x97bd('0x15')](_0x97bd('0x13'),auth['isAuthenticated'](),controller[_0x97bd('0x16')]);module[_0x97bd('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 6aa1204..f75cfa7 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 _0x27f9=['sequelize','exports','STRING','username','remoteUri'];(function(_0x36c3b2,_0x22bd06){var _0x165e17=function(_0x5a05c9){while(--_0x5a05c9){_0x36c3b2['push'](_0x36c3b2['shift']());}};_0x165e17(++_0x22bd06);}(_0x27f9,0x73));var _0x927f=function(_0x56d4d4,_0x52ac5a){_0x56d4d4=_0x56d4d4-0x0;var _0x14bb48=_0x27f9[_0x56d4d4];return _0x14bb48;};'use strict';var Sequelize=require(_0x927f('0x0'));module[_0x927f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x927f('0x2')]},'username':{'type':Sequelize[_0x927f('0x2')],'unique':_0x927f('0x3')},'password':{'type':Sequelize[_0x927f('0x2')]},'remoteUri':{'type':Sequelize[_0x927f('0x2')],'unique':_0x927f('0x4')},'serverUrl':{'type':Sequelize[_0x927f('0x2')]}}; \ No newline at end of file +var _0x1d64=['remoteUri','sequelize','exports','STRING'];(function(_0x159fde,_0x37205a){var _0x15da1a=function(_0x5b33fd){while(--_0x5b33fd){_0x159fde['push'](_0x159fde['shift']());}};_0x15da1a(++_0x37205a);}(_0x1d64,0x1cd));var _0x41d6=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x1d64[_0x31dde9];return _0x1fbf2d;};'use strict';var Sequelize=require(_0x41d6('0x0'));module[_0x41d6('0x1')]={'name':{'type':Sequelize[_0x41d6('0x2')]},'description':{'type':Sequelize[_0x41d6('0x2')]},'username':{'type':Sequelize[_0x41d6('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x41d6('0x2')]},'remoteUri':{'type':Sequelize[_0x41d6('0x2')],'unique':_0x41d6('0x3')},'serverUrl':{'type':Sequelize[_0x41d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 6a24f6e..0b0fabd 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 _0x11b9=['statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','create','body','find','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','endsWith','values','value'];(function(_0x22f5e1,_0x378e3e){var _0xe7bb07=function(_0x1ca888){while(--_0x1ca888){_0x22f5e1['push'](_0x22f5e1['shift']());}};_0xe7bb07(++_0x378e3e);}(_0x11b9,0x183));var _0x911b=function(_0x29a400,_0x211631){_0x29a400=_0x29a400-0x0;var _0x390c7a=_0x11b9[_0x29a400];return _0x390c7a;};'use strict';var pdf=require(_0x911b('0x0'));var emlformat=require(_0x911b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x911b('0x2'));var jsonpatch=require(_0x911b('0x3'));var rp=require(_0x911b('0x4'));var moment=require('moment');var BPromise=require(_0x911b('0x5'));var Mustache=require(_0x911b('0x6'));var util=require(_0x911b('0x7'));var path=require(_0x911b('0x8'));var sox=require(_0x911b('0x9'));var csv=require(_0x911b('0xa'));var ejs=require(_0x911b('0xb'));var fs=require('fs');var _=require(_0x911b('0xc'));var squel=require('squel');var crypto=require(_0x911b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x911b('0xe'));var toCsv=require(_0x911b('0xa'));var querystring=require('querystring');var Papa=require(_0x911b('0xf'));var Redis=require(_0x911b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x911b('0x11'));var as=require(_0x911b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x911b('0x13'));var utils=require(_0x911b('0x14'));var config=require(_0x911b('0x15'));var db=require(_0x911b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x911b('0x17')][_0x911b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x15a17d,_0x4c1504,_0x2cabed){if(_0x2cabed){var _0xa7e56c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa7e56c[_0x911b('0x19')](_0x4c1504)){return _0x15a17d;}else{throw new db['Sequelize'][(_0x911b('0x1a'))](_0x911b('0x1b'));}}else{return _0x15a17d;}}function respondWithRpcPromise(_0xaf9e16,_0xa1d254,_0x1c2111,_0x5ef5d9){return new BPromise(function(_0x4f9c62,_0x5322fa){var _0x523c69=_0x5ef5d9||client;return _0x523c69[_0x911b('0x1c')](_0xaf9e16,_0x1c2111)[_0x911b('0x1d')](function(_0x182254){logger[_0x911b('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0xa1d254,_0x911b('0x1f'));logger['debug'](_0x911b('0x20'),_0xa1d254,'request\x20sent',JSON[_0x911b('0x21')](_0x182254));if(_0x182254[_0x911b('0x22')]){if(_0x182254[_0x911b('0x22')][_0x911b('0x23')]===0x1f4){logger[_0x911b('0x22')](_0x911b('0x24'),_0xa1d254,_0x182254[_0x911b('0x22')][_0x911b('0x25')]);return _0x5322fa(_0x182254[_0x911b('0x22')][_0x911b('0x25')]);}logger[_0x911b('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0xa1d254,_0x182254[_0x911b('0x22')][_0x911b('0x25')]);return _0x4f9c62(_0x182254[_0x911b('0x22')][_0x911b('0x25')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xa1d254,_0x911b('0x1f'));_0x4f9c62(_0x182254[_0x911b('0x26')][_0x911b('0x25')]);}})['catch'](function(_0x3b3596){logger[_0x911b('0x22')](_0x911b('0x24'),_0xa1d254,_0x3b3596);_0x5322fa(_0x3b3596);});});}function respondWithStatusCode(_0x5f4cf3,_0x2576d5){_0x2576d5=_0x2576d5||0xcc;return function(_0x4400fb){if(_0x4400fb){return _0x5f4cf3[_0x911b('0x27')](_0x2576d5);}return _0x5f4cf3[_0x911b('0x28')](_0x2576d5)[_0x911b('0x29')]();};}function respondWithResult(_0x10d956,_0x585623){_0x585623=_0x585623||0xc8;return function(_0x25414d){if(_0x25414d){return _0x10d956[_0x911b('0x28')](_0x585623)[_0x911b('0x2a')](_0x25414d);}};}function respondWithFilteredResult(_0x461a8,_0x4d9975){return function(_0x527d51){if(_0x527d51){var _0xca9a7=_0x527d51['count'],_0x12917=_0x4d9975[_0x911b('0x2b')],_0x1aa9b7=_0x4d9975['offset']+_0x4d9975[_0x911b('0x2c')],_0xcd3429;if(_0x1aa9b7>=_0xca9a7){_0x1aa9b7=_0xca9a7;_0xcd3429=0xc8;}else{_0xcd3429=0xce;}_0x461a8[_0x911b('0x28')](_0xcd3429);return _0x461a8[_0x911b('0x2d')]('Content-Range',_0x12917+'-'+_0x1aa9b7+'/'+_0xca9a7)['json'](_0x527d51);}return null;};}function patchUpdates(_0x42201f){return function(_0x567710){try{jsonpatch[_0x911b('0x2e')](_0x567710,_0x42201f,!![]);}catch(_0x20d029){return BPromise[_0x911b('0x2f')](_0x20d029);}return _0x567710[_0x911b('0x30')]();};}function saveUpdates(_0x3eff9d,_0xfcdca9){return function(_0x1215e7){if(_0x1215e7){return _0x1215e7[_0x911b('0x31')](_0x3eff9d)[_0x911b('0x1d')](function(_0x306455){return _0x306455;});}return null;};}function removeEntity(_0x58f24c,_0xb85f0c){return function(_0x367d0f){if(_0x367d0f){return _0x367d0f[_0x911b('0x32')]()[_0x911b('0x1d')](function(){_0x58f24c[_0x911b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f730,_0x3495de){return function(_0x415c6c){if(!_0x415c6c){_0x41f730[_0x911b('0x27')](0x194);}return _0x415c6c;};}function handleError(_0x5aadb6,_0xc6f83d){_0xc6f83d=_0xc6f83d||0x1f4;return function(_0x55cdc8){logger[_0x911b('0x22')](_0x55cdc8[_0x911b('0x33')]);if(_0x55cdc8[_0x911b('0x34')]){delete _0x55cdc8[_0x911b('0x34')];}_0x5aadb6['status'](_0xc6f83d)[_0x911b('0x35')](_0x55cdc8);};}exports['index']=function(_0x166076,_0x529ade){var _0x1fd400={},_0x47296b={},_0x5cd109={'count':0x0,'rows':[]};var _0x3a3f73=_[_0x911b('0x36')](db[_0x911b('0x37')][_0x911b('0x38')],function(_0xdad40c){return{'name':_0xdad40c[_0x911b('0x39')],'type':_0xdad40c['type']['key']};});_0x47296b[_0x911b('0x3a')]=_[_0x911b('0x36')](_0x3a3f73,'name');_0x47296b['query']=_['keys'](_0x166076[_0x911b('0x3b')]);_0x47296b['filters']=_[_0x911b('0x3c')](_0x47296b[_0x911b('0x3a')],_0x47296b[_0x911b('0x3b')]);_0x1fd400[_0x911b('0x3d')]=_[_0x911b('0x3c')](_0x47296b['model'],qs[_0x911b('0x3e')](_0x166076['query'][_0x911b('0x3e')]));_0x1fd400['attributes']=_0x1fd400[_0x911b('0x3d')][_0x911b('0x3f')]?_0x1fd400[_0x911b('0x3d')]:_0x47296b[_0x911b('0x3a')];if(!_0x166076[_0x911b('0x3b')][_0x911b('0x40')](_0x911b('0x41'))){_0x1fd400[_0x911b('0x2c')]=qs[_0x911b('0x2c')](_0x166076[_0x911b('0x3b')][_0x911b('0x2c')]);_0x1fd400[_0x911b('0x2b')]=qs['offset'](_0x166076['query']['offset']);}_0x1fd400[_0x911b('0x42')]=qs[_0x911b('0x43')](_0x166076[_0x911b('0x3b')][_0x911b('0x43')]);_0x1fd400[_0x911b('0x44')]=qs[_0x911b('0x45')](_[_0x911b('0x46')](_0x166076['query'],_0x47296b[_0x911b('0x45')]),_0x3a3f73);if(_0x166076[_0x911b('0x3b')][_0x911b('0x47')]){_0x1fd400[_0x911b('0x44')]=_[_0x911b('0x48')](_0x1fd400[_0x911b('0x44')],{'$or':_[_0x911b('0x36')](_0x3a3f73,function(_0x42c170){if(_0x42c170[_0x911b('0x49')]!==_0x911b('0x4a')){var _0x43513c={};_0x43513c[_0x42c170[_0x911b('0x34')]]={'$like':'%'+_0x166076[_0x911b('0x3b')][_0x911b('0x47')]+'%'};return _0x43513c;}})});}_0x1fd400=_[_0x911b('0x48')]({},_0x1fd400,_0x166076[_0x911b('0x4b')]);var _0x5335e9={'where':_0x1fd400[_0x911b('0x44')]};return db['SugarcrmAccount'][_0x911b('0x4c')](_0x5335e9)[_0x911b('0x1d')](function(_0x37525f){_0x5cd109[_0x911b('0x4c')]=_0x37525f;if(_0x166076[_0x911b('0x3b')][_0x911b('0x4d')]){_0x1fd400[_0x911b('0x4e')]=[{'all':!![]}];}return db[_0x911b('0x37')]['findAll'](_0x1fd400);})[_0x911b('0x1d')](function(_0x3d587a){_0x5cd109[_0x911b('0x4f')]=_0x3d587a;return _0x5cd109;})['then'](respondWithFilteredResult(_0x529ade,_0x1fd400))[_0x911b('0x50')](handleError(_0x529ade,null));};exports[_0x911b('0x51')]=function(_0x1e0a56,_0x37022f){var _0x4e75ea={'raw':![],'where':{'id':_0x1e0a56['params']['id']}},_0x5f062d={};_0x5f062d[_0x911b('0x3a')]=_[_0x911b('0x52')](db[_0x911b('0x37')][_0x911b('0x38')]);_0x5f062d['query']=_[_0x911b('0x52')](_0x1e0a56['query']);_0x5f062d['filters']=_[_0x911b('0x3c')](_0x5f062d['model'],_0x5f062d[_0x911b('0x3b')]);_0x4e75ea[_0x911b('0x3d')]=_['intersection'](_0x5f062d[_0x911b('0x3a')],qs['fields'](_0x1e0a56['query'][_0x911b('0x3e')]));_0x4e75ea[_0x911b('0x3d')]=_0x4e75ea[_0x911b('0x3d')][_0x911b('0x3f')]?_0x4e75ea['attributes']:_0x5f062d['model'];if(_0x1e0a56[_0x911b('0x3b')][_0x911b('0x4d')]){_0x4e75ea[_0x911b('0x4e')]=[{'all':!![]}];}_0x4e75ea=_[_0x911b('0x48')]({},_0x4e75ea,_0x1e0a56[_0x911b('0x4b')]);return db['SugarcrmAccount']['find'](_0x4e75ea)[_0x911b('0x1d')](handleEntityNotFound(_0x37022f,null))['then'](respondWithResult(_0x37022f,null))[_0x911b('0x50')](handleError(_0x37022f,null));};exports[_0x911b('0x53')]=function(_0x514a19,_0x2d05d6){return db[_0x911b('0x37')][_0x911b('0x53')](_0x514a19[_0x911b('0x54')],{})[_0x911b('0x1d')](respondWithResult(_0x2d05d6,0xc9))[_0x911b('0x50')](handleError(_0x2d05d6,null));};exports[_0x911b('0x31')]=function(_0x15849c,_0x1aca8e){if(_0x15849c['body']['id']){delete _0x15849c[_0x911b('0x54')]['id'];}return db[_0x911b('0x37')][_0x911b('0x55')]({'where':{'id':_0x15849c[_0x911b('0x56')]['id']}})[_0x911b('0x1d')](handleEntityNotFound(_0x1aca8e,null))['then'](saveUpdates(_0x15849c['body'],null))[_0x911b('0x1d')](respondWithResult(_0x1aca8e,null))[_0x911b('0x50')](handleError(_0x1aca8e,null));};exports['destroy']=function(_0x4d61b4,_0x102e0f){return db[_0x911b('0x37')][_0x911b('0x55')]({'where':{'id':_0x4d61b4['params']['id']}})[_0x911b('0x1d')](handleEntityNotFound(_0x102e0f,null))[_0x911b('0x1d')](removeEntity(_0x102e0f,null))[_0x911b('0x50')](handleError(_0x102e0f,null));};exports[_0x911b('0x57')]=function(_0x72408b,_0x2afc59,_0x364f95){var _0x42b616={};var _0x551fc7={};var _0x1b20f1;var _0x5c656d;return db['SugarcrmAccount'][_0x911b('0x58')]({'where':{'id':_0x72408b[_0x911b('0x56')]['id']}})[_0x911b('0x1d')](handleEntityNotFound(_0x2afc59,null))[_0x911b('0x1d')](function(_0x33aefb){if(_0x33aefb){_0x1b20f1=_0x33aefb;_0x551fc7[_0x911b('0x3a')]=_[_0x911b('0x52')](db['SugarcrmConfiguration'][_0x911b('0x38')]);_0x551fc7[_0x911b('0x3b')]=_['keys'](_0x72408b[_0x911b('0x3b')]);_0x551fc7[_0x911b('0x45')]=_[_0x911b('0x3c')](_0x551fc7[_0x911b('0x3a')],_0x551fc7['query']);_0x42b616[_0x911b('0x3d')]=_[_0x911b('0x3c')](_0x551fc7[_0x911b('0x3a')],qs['fields'](_0x72408b[_0x911b('0x3b')][_0x911b('0x3e')]));_0x42b616[_0x911b('0x3d')]=_0x42b616[_0x911b('0x3d')][_0x911b('0x3f')]?_0x42b616['attributes']:_0x551fc7[_0x911b('0x3a')];_0x42b616['order']=qs[_0x911b('0x43')](_0x72408b[_0x911b('0x3b')][_0x911b('0x43')]);_0x42b616[_0x911b('0x44')]=qs[_0x911b('0x45')](_['pick'](_0x72408b[_0x911b('0x3b')],_0x551fc7[_0x911b('0x45')]));if(_0x72408b['query'][_0x911b('0x47')]){_0x42b616['where']=_[_0x911b('0x48')](_0x42b616[_0x911b('0x44')],{'$or':_['map'](_0x42b616['attributes'],function(_0x30ab58){var _0x28393b={};_0x28393b[_0x30ab58]={'$like':'%'+_0x72408b[_0x911b('0x3b')]['filter']+'%'};return _0x28393b;})});}_0x42b616=_[_0x911b('0x48')]({},_0x42b616,_0x72408b[_0x911b('0x4b')]);return _0x1b20f1[_0x911b('0x57')](_0x42b616);}})[_0x911b('0x1d')](function(_0x30823a){if(_0x30823a){_0x5c656d=_0x30823a[_0x911b('0x3f')];if(!_0x72408b['query'][_0x911b('0x40')]('nolimit')){_0x42b616[_0x911b('0x2c')]=qs[_0x911b('0x2c')](_0x72408b[_0x911b('0x3b')][_0x911b('0x2c')]);_0x42b616[_0x911b('0x2b')]=qs[_0x911b('0x2b')](_0x72408b['query'][_0x911b('0x2b')]);}return _0x1b20f1['getConfigurations'](_0x42b616);}})[_0x911b('0x1d')](function(_0x4291f4){if(_0x4291f4){return _0x4291f4?{'count':_0x5c656d,'rows':_0x4291f4}:null;}})[_0x911b('0x1d')](respondWithResult(_0x2afc59,null))[_0x911b('0x50')](handleError(_0x2afc59,null));};exports[_0x911b('0x59')]=function(_0x26daa7,_0x725f10,_0x25d5fd){if(_0x26daa7[_0x911b('0x54')]['id']){delete _0x26daa7[_0x911b('0x54')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x26daa7[_0x911b('0x56')]['id']}})[_0x911b('0x1d')](handleEntityNotFound(_0x725f10,null))[_0x911b('0x1d')](function(_0x42ddbc){if(_0x42ddbc){_0x26daa7[_0x911b('0x54')][_0x911b('0x5a')]=_0x42ddbc['id'];_0x26daa7[_0x911b('0x54')][_0x911b('0x5b')]=integrations['getSubjects'](_0x26daa7['body'][_0x911b('0x5c')],_0x26daa7[_0x911b('0x54')][_0x911b('0x49')]);_0x26daa7[_0x911b('0x54')][_0x911b('0x5d')]=integrations[_0x911b('0x5e')](_0x26daa7[_0x911b('0x54')][_0x911b('0x5c')],_0x26daa7[_0x911b('0x54')][_0x911b('0x49')]);return db['SugarcrmConfiguration'][_0x911b('0x53')](_0x26daa7[_0x911b('0x54')],{'include':[{'model':db['SugarcrmField'],'as':_0x911b('0x5b')},{'model':db[_0x911b('0x5f')],'as':'Descriptions'}]});}return null;})[_0x911b('0x1d')](respondWithResult(_0x725f10,null))[_0x911b('0x50')](handleError(_0x725f10,null));};exports[_0x911b('0x60')]=function(_0x2dc7d2,_0x7bbd47,_0x32cb9a){var _0x58527a='';var _0x37e006=['id','name',_0x911b('0x61'),_0x911b('0x62'),_0x911b('0x63'),_0x911b('0x64'),'duration_hours','duration_minutes',_0x911b('0x65'),_0x911b('0x66'),_0x911b('0x67'),_0x911b('0x68')];return db[_0x911b('0x37')][_0x911b('0x58')]({'where':{'id':_0x2dc7d2['params']['id']},'attributes':['id',_0x911b('0x69'),_0x911b('0x6a'),_0x911b('0x6b')]})[_0x911b('0x1d')](handleEntityNotFound(_0x7bbd47,null))[_0x911b('0x1d')](function(_0x9e3276){if(_0x9e3276){_0x58527a=_0x9e3276[_0x911b('0x6b')];var _0x18ab7d=_0x58527a[_0x911b('0x6c')](-0x1);if(_0x18ab7d==='/'){_0x58527a=_0x58527a[_0x911b('0x6d')](0x0,_0x58527a[_0x911b('0x6e')](_0x18ab7d));}return rp({'method':_0x911b('0x6f'),'uri':util[_0x911b('0x70')](_0x911b('0x71'),_0x58527a,_0x911b('0x72')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x911b('0x73'),'rest_data':JSON[_0x911b('0x21')]({'user_auth':{'user_name':_0x9e3276[_0x911b('0x69')],'password':_0x9e3276[_0x911b('0x6a')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x911b('0x1d')](function(_0x4c03d7){if(_0x4c03d7&&_0x4c03d7[_0x911b('0x34')]!==_0x911b('0x74')&&_0x4c03d7[_0x911b('0x34')]!==_0x911b('0x75')){return rp({'method':_0x911b('0x6f'),'uri':util[_0x911b('0x70')](_0x911b('0x71'),_0x58527a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x911b('0x73'),'response_type':_0x911b('0x73'),'rest_data':JSON[_0x911b('0x21')]({'session':_0x4c03d7['id'],'module_name':_0x911b('0x76')})}})[_0x911b('0x1d')](function(_0x2580dd){if(_0x2580dd){var _0x5aec8c=_['values'](_0x2580dd[_0x911b('0x77')]);_[_0x911b('0x78')](_0x5aec8c,function(_0x34afc0){return _0x37e006[_0x911b('0x79')](_0x34afc0[_0x911b('0x34')]);});return{'count':_0x5aec8c[_0x911b('0x3f')],'rows':_[_0x911b('0x36')](_0x5aec8c,function(_0x3f5d99){return{'id':_0x3f5d99[_0x911b('0x34')],'name':_0x3f5d99['label'],'custom':_[_0x911b('0x7a')](_0x3f5d99[_0x911b('0x34')],'_c')?!![]:![],'options':_0x3f5d99[_0x911b('0x4b')]?_[_0x911b('0x36')](_[_0x911b('0x7b')](_0x3f5d99['options']),function(_0x3b7d90){return{'name':_0x3b7d90[_0x911b('0x7c')],'value':_0x3b7d90[_0x911b('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x7bbd47,null))[_0x911b('0x50')](function(_0x125abb){var _0x2ad0d0=_0x2dc7d2['query'][_0x911b('0x19')]?0x1f4:_0x125abb[_0x911b('0x7d')]||0x1f4;logger[_0x911b('0x22')](_0x911b('0x7e'),_0x911b('0x60'),_0x2ad0d0,JSON[_0x911b('0x21')](_0x125abb));delete _0x125abb[_0x911b('0x34')];if(_0x2ad0d0===0x191){_0x2ad0d0=0x190;}_0x7bbd47[_0x911b('0x28')](_0x2ad0d0)[_0x911b('0x35')](_0x2dc7d2['query'][_0x911b('0x19')]?{'message':_0x911b('0x7f'),'statusCode':_0x125abb['statusCode']}:_0x125abb);});}else{var _0x4459bf=0x1f4;_0x7bbd47[_0x911b('0x28')](_0x4459bf)[_0x911b('0x35')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xd416=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','SugarcrmAccount','rows','show','params','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','remoteUri','POST','format','%s%s','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','Calls','values','remove','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x531a5b,_0x53c411){var _0x16502a=function(_0x16cdb3){while(--_0x16cdb3){_0x531a5b['push'](_0x531a5b['shift']());}};_0x16502a(++_0x53c411);}(_0xd416,0x170));var _0x6d41=function(_0xce27ad,_0x48fc4c){_0xce27ad=_0xce27ad-0x0;var _0x45845e=_0xd416[_0xce27ad];return _0x45845e;};'use strict';var pdf=require(_0x6d41('0x0'));var emlformat=require(_0x6d41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6d41('0x2'));var jsonpatch=require(_0x6d41('0x3'));var rp=require(_0x6d41('0x4'));var moment=require(_0x6d41('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d41('0x6'));var util=require('util');var path=require(_0x6d41('0x7'));var sox=require(_0x6d41('0x8'));var csv=require('to-csv');var ejs=require(_0x6d41('0x9'));var fs=require('fs');var _=require(_0x6d41('0xa'));var squel=require(_0x6d41('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d41('0xc'));var deskjs=require(_0x6d41('0xd'));var toCsv=require(_0x6d41('0xe'));var querystring=require(_0x6d41('0xf'));var Papa=require(_0x6d41('0x10'));var Redis=require(_0x6d41('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6d41('0x12'));var as=require(_0x6d41('0x13'));var hardwareService=require(_0x6d41('0x14'));var logger=require(_0x6d41('0x15'))('api');var utils=require(_0x6d41('0x16'));var config=require(_0x6d41('0x17'));var db=require(_0x6d41('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6d41('0x19')][_0x6d41('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2689c9,_0xfb1d49,_0x57da4a){if(_0x57da4a){var _0x5b78cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b78cc[_0x6d41('0x1b')](_0xfb1d49)){return _0x2689c9;}else{throw new db[(_0x6d41('0x1c'))][(_0x6d41('0x1d'))](_0x6d41('0x1e'));}}else{return _0x2689c9;}}function respondWithRpcPromise(_0x51a248,_0x381cff,_0x4933b7,_0x5dd2c7){return new BPromise(function(_0x4e8619,_0x1d5db2){var _0x58d4ca=_0x5dd2c7||client;return _0x58d4ca[_0x6d41('0x1f')](_0x51a248,_0x4933b7)[_0x6d41('0x20')](function(_0x39085e){logger[_0x6d41('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x381cff,_0x6d41('0x22'));logger[_0x6d41('0x23')](_0x6d41('0x24'),_0x381cff,_0x6d41('0x22'),JSON[_0x6d41('0x25')](_0x39085e));if(_0x39085e['error']){if(_0x39085e[_0x6d41('0x26')]['code']===0x1f4){logger['error'](_0x6d41('0x27'),_0x381cff,_0x39085e['error']['message']);return _0x1d5db2(_0x39085e['error'][_0x6d41('0x28')]);}logger[_0x6d41('0x26')](_0x6d41('0x27'),_0x381cff,_0x39085e[_0x6d41('0x26')][_0x6d41('0x28')]);return _0x4e8619(_0x39085e[_0x6d41('0x26')][_0x6d41('0x28')]);}else{logger['info'](_0x6d41('0x27'),_0x381cff,_0x6d41('0x22'));_0x4e8619(_0x39085e[_0x6d41('0x29')][_0x6d41('0x28')]);}})[_0x6d41('0x2a')](function(_0x24ca81){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x381cff,_0x24ca81);_0x1d5db2(_0x24ca81);});});}function respondWithStatusCode(_0x3f731a,_0x5415cf){_0x5415cf=_0x5415cf||0xcc;return function(_0x10d909){if(_0x10d909){return _0x3f731a[_0x6d41('0x2b')](_0x5415cf);}return _0x3f731a[_0x6d41('0x2c')](_0x5415cf)[_0x6d41('0x2d')]();};}function respondWithResult(_0x32db43,_0xfd72e6){_0xfd72e6=_0xfd72e6||0xc8;return function(_0x47d74a){if(_0x47d74a){return _0x32db43[_0x6d41('0x2c')](_0xfd72e6)['json'](_0x47d74a);}};}function respondWithFilteredResult(_0x3cc5ae,_0x1cd087){return function(_0x3d6e8e){if(_0x3d6e8e){var _0x416e4a=_0x3d6e8e[_0x6d41('0x2e')],_0x316a68=_0x1cd087[_0x6d41('0x2f')],_0x20f15b=_0x1cd087[_0x6d41('0x2f')]+_0x1cd087[_0x6d41('0x30')],_0x44a498;if(_0x20f15b>=_0x416e4a){_0x20f15b=_0x416e4a;_0x44a498=0xc8;}else{_0x44a498=0xce;}_0x3cc5ae[_0x6d41('0x2c')](_0x44a498);return _0x3cc5ae['set'](_0x6d41('0x31'),_0x316a68+'-'+_0x20f15b+'/'+_0x416e4a)[_0x6d41('0x32')](_0x3d6e8e);}return null;};}function patchUpdates(_0x39db9d){return function(_0x319e42){try{jsonpatch[_0x6d41('0x33')](_0x319e42,_0x39db9d,!![]);}catch(_0x2982de){return BPromise[_0x6d41('0x34')](_0x2982de);}return _0x319e42[_0x6d41('0x35')]();};}function saveUpdates(_0xd0392a,_0x3052b3){return function(_0x3cc152){if(_0x3cc152){return _0x3cc152[_0x6d41('0x36')](_0xd0392a)[_0x6d41('0x20')](function(_0x41dd35){return _0x41dd35;});}return null;};}function removeEntity(_0x35a389,_0x4b6b54){return function(_0x4c4136){if(_0x4c4136){return _0x4c4136[_0x6d41('0x37')]()[_0x6d41('0x20')](function(){_0x35a389[_0x6d41('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db02f,_0x69a335){return function(_0x9a0327){if(!_0x9a0327){_0x2db02f[_0x6d41('0x2b')](0x194);}return _0x9a0327;};}function handleError(_0x3b950a,_0x11da93){_0x11da93=_0x11da93||0x1f4;return function(_0xea54cf){logger[_0x6d41('0x26')](_0xea54cf[_0x6d41('0x38')]);if(_0xea54cf['name']){delete _0xea54cf[_0x6d41('0x39')];}_0x3b950a['status'](_0x11da93)[_0x6d41('0x3a')](_0xea54cf);};}exports['index']=function(_0x3bc885,_0x5a6bbd){var _0x17a7bd={},_0x4ae59f={},_0x27eef8={'count':0x0,'rows':[]};var _0x4978d9=_[_0x6d41('0x3b')](db['SugarcrmAccount'][_0x6d41('0x3c')],function(_0x283825){return{'name':_0x283825[_0x6d41('0x3d')],'type':_0x283825[_0x6d41('0x3e')][_0x6d41('0x3f')]};});_0x4ae59f['model']=_[_0x6d41('0x3b')](_0x4978d9,_0x6d41('0x39'));_0x4ae59f['query']=_[_0x6d41('0x40')](_0x3bc885[_0x6d41('0x41')]);_0x4ae59f[_0x6d41('0x42')]=_[_0x6d41('0x43')](_0x4ae59f[_0x6d41('0x44')],_0x4ae59f[_0x6d41('0x41')]);_0x17a7bd['attributes']=_[_0x6d41('0x43')](_0x4ae59f['model'],qs[_0x6d41('0x45')](_0x3bc885['query']['fields']));_0x17a7bd[_0x6d41('0x46')]=_0x17a7bd[_0x6d41('0x46')][_0x6d41('0x47')]?_0x17a7bd['attributes']:_0x4ae59f[_0x6d41('0x44')];if(!_0x3bc885[_0x6d41('0x41')]['hasOwnProperty'](_0x6d41('0x48'))){_0x17a7bd[_0x6d41('0x30')]=qs['limit'](_0x3bc885['query'][_0x6d41('0x30')]);_0x17a7bd[_0x6d41('0x2f')]=qs[_0x6d41('0x2f')](_0x3bc885[_0x6d41('0x41')]['offset']);}_0x17a7bd[_0x6d41('0x49')]=qs[_0x6d41('0x4a')](_0x3bc885[_0x6d41('0x41')][_0x6d41('0x4a')]);_0x17a7bd[_0x6d41('0x4b')]=qs[_0x6d41('0x42')](_[_0x6d41('0x4c')](_0x3bc885[_0x6d41('0x41')],_0x4ae59f['filters']),_0x4978d9);if(_0x3bc885[_0x6d41('0x41')][_0x6d41('0x4d')]){_0x17a7bd[_0x6d41('0x4b')]=_[_0x6d41('0x4e')](_0x17a7bd['where'],{'$or':_[_0x6d41('0x3b')](_0x4978d9,function(_0x38b2aa){if(_0x38b2aa[_0x6d41('0x3e')]!=='VIRTUAL'){var _0x263a92={};_0x263a92[_0x38b2aa[_0x6d41('0x39')]]={'$like':'%'+_0x3bc885['query'][_0x6d41('0x4d')]+'%'};return _0x263a92;}})});}_0x17a7bd=_[_0x6d41('0x4e')]({},_0x17a7bd,_0x3bc885[_0x6d41('0x4f')]);var _0x383f06={'where':_0x17a7bd[_0x6d41('0x4b')]};return db['SugarcrmAccount'][_0x6d41('0x2e')](_0x383f06)['then'](function(_0x229135){_0x27eef8[_0x6d41('0x2e')]=_0x229135;if(_0x3bc885[_0x6d41('0x41')][_0x6d41('0x50')]){_0x17a7bd['include']=[{'all':!![]}];}return db[_0x6d41('0x51')]['findAll'](_0x17a7bd);})[_0x6d41('0x20')](function(_0x48d03f){_0x27eef8[_0x6d41('0x52')]=_0x48d03f;return _0x27eef8;})[_0x6d41('0x20')](respondWithFilteredResult(_0x5a6bbd,_0x17a7bd))[_0x6d41('0x2a')](handleError(_0x5a6bbd,null));};exports[_0x6d41('0x53')]=function(_0xef59b0,_0x3f01fd){var _0x546cfa={'raw':![],'where':{'id':_0xef59b0[_0x6d41('0x54')]['id']}},_0x1f1964={};_0x1f1964[_0x6d41('0x44')]=_[_0x6d41('0x40')](db[_0x6d41('0x51')][_0x6d41('0x3c')]);_0x1f1964[_0x6d41('0x41')]=_[_0x6d41('0x40')](_0xef59b0[_0x6d41('0x41')]);_0x1f1964[_0x6d41('0x42')]=_[_0x6d41('0x43')](_0x1f1964[_0x6d41('0x44')],_0x1f1964['query']);_0x546cfa[_0x6d41('0x46')]=_[_0x6d41('0x43')](_0x1f1964['model'],qs['fields'](_0xef59b0[_0x6d41('0x41')][_0x6d41('0x45')]));_0x546cfa[_0x6d41('0x46')]=_0x546cfa[_0x6d41('0x46')][_0x6d41('0x47')]?_0x546cfa['attributes']:_0x1f1964[_0x6d41('0x44')];if(_0xef59b0[_0x6d41('0x41')]['includeAll']){_0x546cfa[_0x6d41('0x55')]=[{'all':!![]}];}_0x546cfa=_[_0x6d41('0x4e')]({},_0x546cfa,_0xef59b0[_0x6d41('0x4f')]);return db['SugarcrmAccount'][_0x6d41('0x56')](_0x546cfa)[_0x6d41('0x20')](handleEntityNotFound(_0x3f01fd,null))[_0x6d41('0x20')](respondWithResult(_0x3f01fd,null))['catch'](handleError(_0x3f01fd,null));};exports[_0x6d41('0x57')]=function(_0x321079,_0x5b7bde){return db[_0x6d41('0x51')][_0x6d41('0x57')](_0x321079[_0x6d41('0x58')],{})[_0x6d41('0x20')](respondWithResult(_0x5b7bde,0xc9))['catch'](handleError(_0x5b7bde,null));};exports[_0x6d41('0x36')]=function(_0x98786c,_0x30b532){if(_0x98786c[_0x6d41('0x58')]['id']){delete _0x98786c[_0x6d41('0x58')]['id'];}return db[_0x6d41('0x51')][_0x6d41('0x56')]({'where':{'id':_0x98786c['params']['id']}})[_0x6d41('0x20')](handleEntityNotFound(_0x30b532,null))[_0x6d41('0x20')](saveUpdates(_0x98786c[_0x6d41('0x58')],null))[_0x6d41('0x20')](respondWithResult(_0x30b532,null))[_0x6d41('0x2a')](handleError(_0x30b532,null));};exports[_0x6d41('0x37')]=function(_0x9f41a4,_0x1d4b64){return db[_0x6d41('0x51')][_0x6d41('0x56')]({'where':{'id':_0x9f41a4[_0x6d41('0x54')]['id']}})[_0x6d41('0x20')](handleEntityNotFound(_0x1d4b64,null))['then'](removeEntity(_0x1d4b64,null))[_0x6d41('0x2a')](handleError(_0x1d4b64,null));};exports[_0x6d41('0x59')]=function(_0x2ab4ec,_0x2ebfc2,_0x35a301){var _0x267d4a={};var _0x259db2={};var _0x46ccbc;var _0x1c8cfe;return db[_0x6d41('0x51')][_0x6d41('0x5a')]({'where':{'id':_0x2ab4ec['params']['id']}})[_0x6d41('0x20')](handleEntityNotFound(_0x2ebfc2,null))[_0x6d41('0x20')](function(_0x5c6598){if(_0x5c6598){_0x46ccbc=_0x5c6598;_0x259db2[_0x6d41('0x44')]=_['keys'](db['SugarcrmConfiguration'][_0x6d41('0x3c')]);_0x259db2[_0x6d41('0x41')]=_[_0x6d41('0x40')](_0x2ab4ec[_0x6d41('0x41')]);_0x259db2[_0x6d41('0x42')]=_[_0x6d41('0x43')](_0x259db2['model'],_0x259db2[_0x6d41('0x41')]);_0x267d4a[_0x6d41('0x46')]=_[_0x6d41('0x43')](_0x259db2[_0x6d41('0x44')],qs[_0x6d41('0x45')](_0x2ab4ec[_0x6d41('0x41')][_0x6d41('0x45')]));_0x267d4a[_0x6d41('0x46')]=_0x267d4a[_0x6d41('0x46')][_0x6d41('0x47')]?_0x267d4a[_0x6d41('0x46')]:_0x259db2['model'];_0x267d4a[_0x6d41('0x49')]=qs[_0x6d41('0x4a')](_0x2ab4ec[_0x6d41('0x41')][_0x6d41('0x4a')]);_0x267d4a[_0x6d41('0x4b')]=qs[_0x6d41('0x42')](_[_0x6d41('0x4c')](_0x2ab4ec[_0x6d41('0x41')],_0x259db2[_0x6d41('0x42')]));if(_0x2ab4ec[_0x6d41('0x41')][_0x6d41('0x4d')]){_0x267d4a['where']=_[_0x6d41('0x4e')](_0x267d4a[_0x6d41('0x4b')],{'$or':_[_0x6d41('0x3b')](_0x267d4a['attributes'],function(_0x22b1cd){var _0x29f5a0={};_0x29f5a0[_0x22b1cd]={'$like':'%'+_0x2ab4ec[_0x6d41('0x41')][_0x6d41('0x4d')]+'%'};return _0x29f5a0;})});}_0x267d4a=_[_0x6d41('0x4e')]({},_0x267d4a,_0x2ab4ec['options']);return _0x46ccbc[_0x6d41('0x59')](_0x267d4a);}})[_0x6d41('0x20')](function(_0x5a9e54){if(_0x5a9e54){_0x1c8cfe=_0x5a9e54['length'];if(!_0x2ab4ec[_0x6d41('0x41')]['hasOwnProperty'](_0x6d41('0x48'))){_0x267d4a[_0x6d41('0x30')]=qs[_0x6d41('0x30')](_0x2ab4ec[_0x6d41('0x41')][_0x6d41('0x30')]);_0x267d4a['offset']=qs[_0x6d41('0x2f')](_0x2ab4ec['query'][_0x6d41('0x2f')]);}return _0x46ccbc['getConfigurations'](_0x267d4a);}})[_0x6d41('0x20')](function(_0x4fb3dd){if(_0x4fb3dd){return _0x4fb3dd?{'count':_0x1c8cfe,'rows':_0x4fb3dd}:null;}})[_0x6d41('0x20')](respondWithResult(_0x2ebfc2,null))[_0x6d41('0x2a')](handleError(_0x2ebfc2,null));};exports[_0x6d41('0x5b')]=function(_0x93ec8,_0x74e272,_0x53bf9b){if(_0x93ec8[_0x6d41('0x58')]['id']){delete _0x93ec8[_0x6d41('0x58')]['id'];}return db[_0x6d41('0x51')]['findOne']({'where':{'id':_0x93ec8[_0x6d41('0x54')]['id']}})['then'](handleEntityNotFound(_0x74e272,null))[_0x6d41('0x20')](function(_0x35ef47){if(_0x35ef47){_0x93ec8[_0x6d41('0x58')][_0x6d41('0x5c')]=_0x35ef47['id'];_0x93ec8[_0x6d41('0x58')][_0x6d41('0x5d')]=integrations[_0x6d41('0x5e')](_0x93ec8[_0x6d41('0x58')][_0x6d41('0x5f')],_0x93ec8[_0x6d41('0x58')][_0x6d41('0x3e')]);_0x93ec8[_0x6d41('0x58')][_0x6d41('0x60')]=integrations[_0x6d41('0x61')](_0x93ec8[_0x6d41('0x58')][_0x6d41('0x5f')],_0x93ec8[_0x6d41('0x58')][_0x6d41('0x3e')]);return db[_0x6d41('0x62')][_0x6d41('0x57')](_0x93ec8['body'],{'include':[{'model':db[_0x6d41('0x63')],'as':_0x6d41('0x5d')},{'model':db[_0x6d41('0x63')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x74e272,null))[_0x6d41('0x2a')](handleError(_0x74e272,null));};exports[_0x6d41('0x64')]=function(_0x1ce211,_0x18ec28,_0x41bf6f){var _0x576283='';var _0x1b281e=['id','name',_0x6d41('0x65'),'created_by',_0x6d41('0x66'),_0x6d41('0x67'),_0x6d41('0x68'),_0x6d41('0x69'),'parent_id',_0x6d41('0x6a'),_0x6d41('0x6b'),_0x6d41('0x6c')];return db[_0x6d41('0x51')][_0x6d41('0x5a')]({'where':{'id':_0x1ce211[_0x6d41('0x54')]['id']},'attributes':['id','username','password',_0x6d41('0x6d')]})[_0x6d41('0x20')](handleEntityNotFound(_0x18ec28,null))[_0x6d41('0x20')](function(_0x7ea2f1){if(_0x7ea2f1){_0x576283=_0x7ea2f1['remoteUri'];var _0x4c17c3=_0x576283['slice'](-0x1);if(_0x4c17c3==='/'){_0x576283=_0x576283['substring'](0x0,_0x576283['lastIndexOf'](_0x4c17c3));}return rp({'method':_0x6d41('0x6e'),'uri':util[_0x6d41('0x6f')](_0x6d41('0x70'),_0x576283,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6d41('0x71'),'input_type':'JSON','response_type':_0x6d41('0x72'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x7ea2f1[_0x6d41('0x73')],'password':_0x7ea2f1['password'],'encryption':_0x6d41('0x74')},'application':_0x6d41('0x75')})}});}})['then'](function(_0x5ae4f6){if(_0x5ae4f6&&_0x5ae4f6[_0x6d41('0x39')]!=='Invalid\x20Login'&&_0x5ae4f6[_0x6d41('0x39')]!==_0x6d41('0x76')){return rp({'method':_0x6d41('0x6e'),'uri':util[_0x6d41('0x6f')]('%s%s',_0x576283,_0x6d41('0x77')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6d41('0x72'),'response_type':_0x6d41('0x72'),'rest_data':JSON['stringify']({'session':_0x5ae4f6['id'],'module_name':_0x6d41('0x78')})}})[_0x6d41('0x20')](function(_0x3e69ee){if(_0x3e69ee){var _0x527e14=_[_0x6d41('0x79')](_0x3e69ee['module_fields']);_[_0x6d41('0x7a')](_0x527e14,function(_0x281796){return _0x1b281e['includes'](_0x281796[_0x6d41('0x39')]);});return{'count':_0x527e14[_0x6d41('0x47')],'rows':_[_0x6d41('0x3b')](_0x527e14,function(_0x2840de){return{'id':_0x2840de[_0x6d41('0x39')],'name':_0x2840de[_0x6d41('0x7b')],'custom':_[_0x6d41('0x7c')](_0x2840de[_0x6d41('0x39')],'_c')?!![]:![],'options':_0x2840de[_0x6d41('0x4f')]?_[_0x6d41('0x3b')](_['values'](_0x2840de[_0x6d41('0x4f')]),function(_0x55161f){return{'name':_0x55161f[_0x6d41('0x7d')],'value':_0x55161f[_0x6d41('0x39')]};}):[]};})};}})[_0x6d41('0x20')](respondWithResult(_0x18ec28,null))[_0x6d41('0x2a')](function(_0x25710d){var _0x2304b2=_0x1ce211[_0x6d41('0x41')][_0x6d41('0x1b')]?0x1f4:_0x25710d[_0x6d41('0x7e')]||0x1f4;logger[_0x6d41('0x26')](_0x6d41('0x7f'),'getFields',_0x2304b2,JSON[_0x6d41('0x25')](_0x25710d));delete _0x25710d[_0x6d41('0x39')];if(_0x2304b2===0x191){_0x2304b2=0x190;}_0x18ec28[_0x6d41('0x2c')](_0x2304b2)[_0x6d41('0x3a')](_0x1ce211[_0x6d41('0x41')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x25710d['statusCode']}:_0x25710d);});}else{var _0x10a2f5=0x1f4;_0x18ec28[_0x6d41('0x2c')](_0x10a2f5)[_0x6d41('0x3a')]({'message':_0x6d41('0x80'),'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 00b2049..8e631ef 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 _0xa2a8=['bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x431818,_0x62c47d){var _0x4cc06b=function(_0x39582c){while(--_0x39582c){_0x431818['push'](_0x431818['shift']());}};_0x4cc06b(++_0x62c47d);}(_0xa2a8,0x13f));var _0x8a2a=function(_0x72a6a8,_0x376d9f){_0x72a6a8=_0x72a6a8-0x0;var _0x215ae7=_0xa2a8[_0x72a6a8];return _0x215ae7;};'use strict';var _=require(_0x8a2a('0x0'));var util=require(_0x8a2a('0x1'));var logger=require(_0x8a2a('0x2'))(_0x8a2a('0x3'));var moment=require(_0x8a2a('0x4'));var BPromise=require(_0x8a2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2a('0x6'));var rimraf=require('rimraf');var config=require(_0x8a2a('0x7'));var attributes=require(_0x8a2a('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8a2a('0x9')]=function(_0x2c6862,_0xb4ae24){return _0x2c6862[_0x8a2a('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x8a2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x057d=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3ad4e7,_0x318c37){var _0x3780cb=function(_0xedaa32){while(--_0xedaa32){_0x3ad4e7['push'](_0x3ad4e7['shift']());}};_0x3780cb(++_0x318c37);}(_0x057d,0x109));var _0xd057=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x057d[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xd057('0x0'));var util=require('util');var logger=require(_0xd057('0x1'))(_0xd057('0x2'));var moment=require(_0xd057('0x3'));var BPromise=require(_0xd057('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd057('0x5'));var rimraf=require(_0xd057('0x6'));var config=require(_0xd057('0x7'));var attributes=require(_0xd057('0x8'));var integrations=require(_0xd057('0x9'));module['exports']=function(_0x2edb09,_0x57a64d){return _0x2edb09[_0xd057('0xa')](_0xd057('0xb'),attributes,{'tableName':_0xd057('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 fbda8f2..161d731 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 _0x7b14=['request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x7b14,0x1a1));var _0x47b1=function(_0x6bf8eb,_0x485e5b){_0x6bf8eb=_0x6bf8eb-0x0;var _0x3fe7c1=_0x7b14[_0x6bf8eb];return _0x3fe7c1;};'use strict';var _=require(_0x47b1('0x0'));var util=require('util');var moment=require(_0x47b1('0x1'));var BPromise=require(_0x47b1('0x2'));var rs=require(_0x47b1('0x3'));var fs=require('fs');var Redis=require(_0x47b1('0x4'));var db=require(_0x47b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x47b1('0x6'));var config=require(_0x47b1('0x7'));var jayson=require(_0x47b1('0x8'));var client=jayson[_0x47b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51e6d,_0x293c0b,_0x37eb3f){return new BPromise(function(_0x492618,_0xd0897){return client[_0x47b1('0xa')](_0x51e6d,_0x37eb3f)[_0x47b1('0xb')](function(_0x513e8e){logger[_0x47b1('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c0b,'request\x20sent');logger[_0x47b1('0xd')](_0x47b1('0xe'),_0x293c0b,_0x47b1('0xf'),JSON[_0x47b1('0x10')](_0x513e8e));if(_0x513e8e[_0x47b1('0x11')]){if(_0x513e8e[_0x47b1('0x11')][_0x47b1('0x12')]===0x1f4){logger[_0x47b1('0x11')](_0x47b1('0x13'),_0x293c0b,_0x513e8e['error']['message']);return _0xd0897(_0x513e8e[_0x47b1('0x11')][_0x47b1('0x14')]);}logger[_0x47b1('0x11')](_0x47b1('0x13'),_0x293c0b,_0x513e8e[_0x47b1('0x11')][_0x47b1('0x14')]);return _0x492618(_0x513e8e['error']['message']);}else{logger[_0x47b1('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c0b,_0x47b1('0xf'));_0x492618(_0x513e8e[_0x47b1('0x15')][_0x47b1('0x14')]);}})['catch'](function(_0x2cc448){logger[_0x47b1('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c0b,_0x2cc448);_0xd0897(_0x2cc448);});});}exports['GetSugarcrmAccount']=function(_0x1779b5){var _0x2ff98b=this;return new Promise(function(_0x3243e1,_0x218d47){return db[_0x47b1('0x16')][_0x47b1('0x17')]({'raw':_0x1779b5[_0x47b1('0x18')]?_0x1779b5[_0x47b1('0x18')][_0x47b1('0x19')]===undefined?!![]:![]:!![],'where':_0x1779b5[_0x47b1('0x18')]?_0x1779b5[_0x47b1('0x18')][_0x47b1('0x1a')]||null:null,'attributes':_0x1779b5['options']?_0x1779b5[_0x47b1('0x18')][_0x47b1('0x1b')]||null:null,'limit':_0x1779b5['options']?_0x1779b5[_0x47b1('0x18')][_0x47b1('0x1c')]||null:null,'include':_0x1779b5[_0x47b1('0x18')]?_0x1779b5['options']['include']?_[_0x47b1('0x1d')](_0x1779b5['options'][_0x47b1('0x1e')],function(_0x4e4769){return{'model':db[_0x4e4769[_0x47b1('0x1f')]],'as':_0x4e4769['as'],'attributes':_0x4e4769['attributes'],'include':_0x4e4769[_0x47b1('0x1e')]?_[_0x47b1('0x1d')](_0x4e4769[_0x47b1('0x1e')],function(_0x3835c1){return{'model':db[_0x3835c1[_0x47b1('0x1f')]],'as':_0x3835c1['as'],'attributes':_0x3835c1[_0x47b1('0x1b')],'include':_0x3835c1[_0x47b1('0x1e')]?_[_0x47b1('0x1d')](_0x3835c1[_0x47b1('0x1e')],function(_0x4ff0b6){return{'model':db[_0x4ff0b6[_0x47b1('0x1f')]],'as':_0x4ff0b6['as'],'attributes':_0x4ff0b6['attributes']};}):[]};}):[]};}):[]:[]})[_0x47b1('0xb')](function(_0x508930){logger[_0x47b1('0xc')](_0x47b1('0x20'),_0x1779b5);logger[_0x47b1('0xd')](_0x47b1('0x20'),_0x1779b5,JSON[_0x47b1('0x10')](_0x508930));_0x3243e1(_0x508930);})[_0x47b1('0x21')](function(_0x721c8a){logger[_0x47b1('0x11')](_0x47b1('0x20'),_0x721c8a[_0x47b1('0x14')],_0x1779b5);_0x218d47(_0x2ff98b['error'](0x1f4,_0x721c8a[_0x47b1('0x14')]));});});};exports[_0x47b1('0x22')]=function(_0x1b18e2){var _0x16428f=this;return new Promise(function(_0x4dd05e,_0x448057){return db[_0x47b1('0x16')][_0x47b1('0x23')]({'raw':_0x1b18e2[_0x47b1('0x18')]?_0x1b18e2[_0x47b1('0x18')][_0x47b1('0x19')]===undefined?!![]:![]:!![],'where':_0x1b18e2['options']?_0x1b18e2[_0x47b1('0x18')]['where']||null:null,'attributes':_0x1b18e2[_0x47b1('0x18')]?_0x1b18e2[_0x47b1('0x18')][_0x47b1('0x1b')]||null:null,'include':_0x1b18e2[_0x47b1('0x18')]?_0x1b18e2['options'][_0x47b1('0x1e')]?_[_0x47b1('0x1d')](_0x1b18e2[_0x47b1('0x18')][_0x47b1('0x1e')],function(_0x4fa47b){return{'model':db[_0x4fa47b[_0x47b1('0x1f')]],'as':_0x4fa47b['as'],'attributes':_0x4fa47b[_0x47b1('0x1b')],'include':_0x4fa47b[_0x47b1('0x1e')]?_[_0x47b1('0x1d')](_0x4fa47b[_0x47b1('0x1e')],function(_0x360752){return{'model':db[_0x360752['model']],'as':_0x360752['as'],'attributes':_0x360752[_0x47b1('0x1b')],'include':_0x360752[_0x47b1('0x1e')]?_['map'](_0x360752[_0x47b1('0x1e')],function(_0x2852df){return{'model':db[_0x2852df[_0x47b1('0x1f')]],'as':_0x2852df['as'],'attributes':_0x2852df['attributes']};}):[]};}):[]};}):[]:[]})[_0x47b1('0xb')](function(_0xbe6747){logger[_0x47b1('0xc')]('ShowSugarcrmAccount',_0x1b18e2);logger[_0x47b1('0xd')](_0x47b1('0x22'),_0x1b18e2,JSON[_0x47b1('0x10')](_0xbe6747));_0x4dd05e(_0xbe6747);})[_0x47b1('0x21')](function(_0x356991){logger[_0x47b1('0x11')](_0x47b1('0x22'),_0x356991[_0x47b1('0x14')],_0x1b18e2);_0x448057(_0x16428f[_0x47b1('0x11')](0x1f4,_0x356991['message']));});});}; \ No newline at end of file +var _0xcd77=['find','raw','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','debug','ShowSugarcrmAccount'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0xcd77,0x65));var _0x7cd7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcd77[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x7cd7('0x0'));var util=require(_0x7cd7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7cd7('0x2'));var fs=require('fs');var Redis=require(_0x7cd7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cd7('0x4'));var logger=require(_0x7cd7('0x5'))(_0x7cd7('0x6'));var config=require(_0x7cd7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7cd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2763f3,_0x2617db,_0x23f5ab){return new BPromise(function(_0x1fe6f7,_0x37d2bf){return client[_0x7cd7('0x9')](_0x2763f3,_0x23f5ab)[_0x7cd7('0xa')](function(_0x242c74){logger['info'](_0x7cd7('0xb'),_0x2617db,_0x7cd7('0xc'));logger['debug'](_0x7cd7('0xd'),_0x2617db,'request\x20sent',JSON[_0x7cd7('0xe')](_0x242c74));if(_0x242c74['error']){if(_0x242c74[_0x7cd7('0xf')]['code']===0x1f4){logger['error'](_0x7cd7('0xb'),_0x2617db,_0x242c74[_0x7cd7('0xf')][_0x7cd7('0x10')]);return _0x37d2bf(_0x242c74[_0x7cd7('0xf')][_0x7cd7('0x10')]);}logger['error'](_0x7cd7('0xb'),_0x2617db,_0x242c74[_0x7cd7('0xf')]['message']);return _0x1fe6f7(_0x242c74['error'][_0x7cd7('0x10')]);}else{logger[_0x7cd7('0x11')](_0x7cd7('0xb'),_0x2617db,_0x7cd7('0xc'));_0x1fe6f7(_0x242c74['result'][_0x7cd7('0x10')]);}})[_0x7cd7('0x12')](function(_0xeaaa29){logger[_0x7cd7('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2617db,_0xeaaa29);_0x37d2bf(_0xeaaa29);});});}exports[_0x7cd7('0x13')]=function(_0x1cb4f0){var _0x575db2=this;return new Promise(function(_0x39b317,_0x2d3438){return db[_0x7cd7('0x14')][_0x7cd7('0x15')]({'raw':_0x1cb4f0[_0x7cd7('0x16')]?_0x1cb4f0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cb4f0[_0x7cd7('0x16')]?_0x1cb4f0['options'][_0x7cd7('0x17')]||null:null,'attributes':_0x1cb4f0[_0x7cd7('0x16')]?_0x1cb4f0[_0x7cd7('0x16')]['attributes']||null:null,'limit':_0x1cb4f0[_0x7cd7('0x16')]?_0x1cb4f0[_0x7cd7('0x16')][_0x7cd7('0x18')]||null:null,'include':_0x1cb4f0[_0x7cd7('0x16')]?_0x1cb4f0[_0x7cd7('0x16')][_0x7cd7('0x19')]?_[_0x7cd7('0x1a')](_0x1cb4f0[_0x7cd7('0x16')][_0x7cd7('0x19')],function(_0xbbdbbc){return{'model':db[_0xbbdbbc[_0x7cd7('0x1b')]],'as':_0xbbdbbc['as'],'attributes':_0xbbdbbc[_0x7cd7('0x1c')],'include':_0xbbdbbc[_0x7cd7('0x19')]?_[_0x7cd7('0x1a')](_0xbbdbbc[_0x7cd7('0x19')],function(_0x145701){return{'model':db[_0x145701['model']],'as':_0x145701['as'],'attributes':_0x145701[_0x7cd7('0x1c')],'include':_0x145701[_0x7cd7('0x19')]?_['map'](_0x145701[_0x7cd7('0x19')],function(_0xa63196){return{'model':db[_0xa63196[_0x7cd7('0x1b')]],'as':_0xa63196['as'],'attributes':_0xa63196['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cd7('0xa')](function(_0x376802){logger[_0x7cd7('0x11')](_0x7cd7('0x13'),_0x1cb4f0);logger[_0x7cd7('0x1d')](_0x7cd7('0x13'),_0x1cb4f0,JSON[_0x7cd7('0xe')](_0x376802));_0x39b317(_0x376802);})['catch'](function(_0x288d7f){logger[_0x7cd7('0xf')](_0x7cd7('0x13'),_0x288d7f[_0x7cd7('0x10')],_0x1cb4f0);_0x2d3438(_0x575db2[_0x7cd7('0xf')](0x1f4,_0x288d7f[_0x7cd7('0x10')]));});});};exports[_0x7cd7('0x1e')]=function(_0x496fb6){var _0xae12e9=this;return new Promise(function(_0x29fbed,_0x368fcb){return db['SugarcrmAccount'][_0x7cd7('0x1f')]({'raw':_0x496fb6[_0x7cd7('0x16')]?_0x496fb6[_0x7cd7('0x16')][_0x7cd7('0x20')]===undefined?!![]:![]:!![],'where':_0x496fb6[_0x7cd7('0x16')]?_0x496fb6[_0x7cd7('0x16')]['where']||null:null,'attributes':_0x496fb6[_0x7cd7('0x16')]?_0x496fb6['options'][_0x7cd7('0x1c')]||null:null,'include':_0x496fb6[_0x7cd7('0x16')]?_0x496fb6[_0x7cd7('0x16')][_0x7cd7('0x19')]?_[_0x7cd7('0x1a')](_0x496fb6[_0x7cd7('0x16')]['include'],function(_0xddd2e6){return{'model':db[_0xddd2e6[_0x7cd7('0x1b')]],'as':_0xddd2e6['as'],'attributes':_0xddd2e6[_0x7cd7('0x1c')],'include':_0xddd2e6[_0x7cd7('0x19')]?_['map'](_0xddd2e6[_0x7cd7('0x19')],function(_0x22dcbd){return{'model':db[_0x22dcbd[_0x7cd7('0x1b')]],'as':_0x22dcbd['as'],'attributes':_0x22dcbd['attributes'],'include':_0x22dcbd[_0x7cd7('0x19')]?_[_0x7cd7('0x1a')](_0x22dcbd[_0x7cd7('0x19')],function(_0x33afed){return{'model':db[_0x33afed[_0x7cd7('0x1b')]],'as':_0x33afed['as'],'attributes':_0x33afed['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cd7('0xa')](function(_0x12c1dc){logger['info'](_0x7cd7('0x1e'),_0x496fb6);logger['debug'](_0x7cd7('0x1e'),_0x496fb6,JSON[_0x7cd7('0xe')](_0x12c1dc));_0x29fbed(_0x12c1dc);})['catch'](function(_0x687cba){logger[_0x7cd7('0xf')](_0x7cd7('0x1e'),_0x687cba[_0x7cd7('0x10')],_0x496fb6);_0x368fcb(_0xae12e9['error'](0x1f4,_0x687cba['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index dfaad8d..087800e 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 _0x98aa=['../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98aa,0x9d));var _0xa98a=function(_0x1aaeb5,_0x48d8ed){_0x1aaeb5=_0x1aaeb5-0x0;var _0x54451a=_0x98aa[_0x1aaeb5];return _0x54451a;};'use strict';var multer=require(_0xa98a('0x0'));var util=require(_0xa98a('0x1'));var path=require(_0xa98a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa98a('0x3')]();var auth=require(_0xa98a('0x4'));var interaction=require(_0xa98a('0x5'));var config=require('../../config/environment');var controller=require(_0xa98a('0x6'));router[_0xa98a('0x7')]('/',auth['isAuthenticated'](),controller[_0xa98a('0x8')]);router[_0xa98a('0x7')](_0xa98a('0x9'),auth[_0xa98a('0xa')](),controller[_0xa98a('0xb')]);router[_0xa98a('0x7')](_0xa98a('0xc'),auth['isAuthenticated'](),controller[_0xa98a('0xd')]);router[_0xa98a('0x7')](_0xa98a('0xe'),auth[_0xa98a('0xa')](),controller[_0xa98a('0xf')]);router[_0xa98a('0x7')]('/:id/descriptions',auth[_0xa98a('0xa')](),controller[_0xa98a('0x10')]);router[_0xa98a('0x11')]('/',auth[_0xa98a('0xa')](),controller[_0xa98a('0x12')]);router[_0xa98a('0x13')]('/:id',auth[_0xa98a('0xa')](),controller['update']);router[_0xa98a('0x14')](_0xa98a('0x9'),auth[_0xa98a('0xa')](),controller[_0xa98a('0x15')]);module[_0xa98a('0x16')]=router; \ No newline at end of file +var _0xff08=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xff08,0x16b));var _0x8ff0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xff08[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x8ff0('0x0'));var util=require(_0x8ff0('0x1'));var path=require(_0x8ff0('0x2'));var timeout=require(_0x8ff0('0x3'));var express=require(_0x8ff0('0x4'));var router=express[_0x8ff0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ff0('0x6'));var config=require(_0x8ff0('0x7'));var controller=require(_0x8ff0('0x8'));router[_0x8ff0('0x9')]('/',auth[_0x8ff0('0xa')](),controller['index']);router[_0x8ff0('0x9')](_0x8ff0('0xb'),auth[_0x8ff0('0xa')](),controller[_0x8ff0('0xc')]);router[_0x8ff0('0x9')](_0x8ff0('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x8ff0('0x9')](_0x8ff0('0xe'),auth[_0x8ff0('0xa')](),controller[_0x8ff0('0xf')]);router['get'](_0x8ff0('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8ff0('0x11')]('/',auth[_0x8ff0('0xa')](),controller[_0x8ff0('0x12')]);router['put'](_0x8ff0('0xb'),auth['isAuthenticated'](),controller[_0x8ff0('0x13')]);router['delete']('/:id',auth[_0x8ff0('0xa')](),controller[_0x8ff0('0x14')]);module[_0x8ff0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6259b46..3f7da23 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 _0x0b59=['sequelize'];(function(_0x28a157,_0x13f5ad){var _0x5bee14=function(_0x16e745){while(--_0x16e745){_0x28a157['push'](_0x28a157['shift']());}};_0x5bee14(++_0x13f5ad);}(_0x0b59,0x1f3));var _0x90b5=function(_0x31dd80,_0x3b6cce){_0x31dd80=_0x31dd80-0x0;var _0x5a303b=_0x0b59[_0x31dd80];return _0x5a303b;};'use strict';var Sequelize=require(_0x90b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ffb=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ffb,0x138));var _0xb0ff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ffb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xb0ff('0x0')]={'name':{'type':Sequelize[_0xb0ff('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b315f74..f7da7a2 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 _0x8d83=['findAll','rows','show','params','options','find','create','body','update','SugarcrmField','getFields','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','http','test','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','includeAll','include'];(function(_0x4ce49d,_0x520b4a){var _0x5e44c0=function(_0x1ebce1){while(--_0x1ebce1){_0x4ce49d['push'](_0x4ce49d['shift']());}};_0x5e44c0(++_0x520b4a);}(_0x8d83,0x11d));var _0x38d8=function(_0x3a787d,_0x47a75a){_0x3a787d=_0x3a787d-0x0;var _0x5e8d5b=_0x8d83[_0x3a787d];return _0x5e8d5b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x38d8('0x0'));var rimraf=require(_0x38d8('0x1'));var zipdir=require(_0x38d8('0x2'));var jsonpatch=require(_0x38d8('0x3'));var rp=require(_0x38d8('0x4'));var moment=require('moment');var BPromise=require(_0x38d8('0x5'));var Mustache=require(_0x38d8('0x6'));var util=require(_0x38d8('0x7'));var path=require(_0x38d8('0x8'));var sox=require('sox');var csv=require(_0x38d8('0x9'));var ejs=require(_0x38d8('0xa'));var fs=require('fs');var _=require(_0x38d8('0xb'));var squel=require(_0x38d8('0xc'));var crypto=require(_0x38d8('0xd'));var jsforce=require(_0x38d8('0xe'));var deskjs=require(_0x38d8('0xf'));var toCsv=require(_0x38d8('0x9'));var querystring=require(_0x38d8('0x10'));var Papa=require(_0x38d8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x38d8('0x12'));var as=require(_0x38d8('0x13'));var hardwareService=require(_0x38d8('0x14'));var logger=require('../../config/logger')(_0x38d8('0x15'));var utils=require('../../config/utils');var config=require(_0x38d8('0x16'));var db=require(_0x38d8('0x17'))['db'];var jayson=require(_0x38d8('0x18'));var client=jayson['client'][_0x38d8('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3891fb,_0x13df61,_0x19b9fb){if(_0x19b9fb){var _0x3b19a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b19a9[_0x38d8('0x1a')](_0x13df61)){return _0x3891fb;}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 _0x3891fb;}}function respondWithRpcPromise(_0x29dec8,_0x1f2483,_0x19f8c7,_0x1cd32d){return new BPromise(function(_0x4d4d9c,_0x1c5947){var _0xb37b2=_0x1cd32d||client;return _0xb37b2['request'](_0x29dec8,_0x19f8c7)['then'](function(_0x50ecc1){logger[_0x38d8('0x1b')](_0x38d8('0x1c'),_0x1f2483,_0x38d8('0x1d'));logger[_0x38d8('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1f2483,_0x38d8('0x1d'),JSON[_0x38d8('0x1f')](_0x50ecc1));if(_0x50ecc1[_0x38d8('0x20')]){if(_0x50ecc1[_0x38d8('0x20')][_0x38d8('0x21')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f2483,_0x50ecc1[_0x38d8('0x20')][_0x38d8('0x22')]);return _0x1c5947(_0x50ecc1['error']['message']);}logger[_0x38d8('0x20')](_0x38d8('0x1c'),_0x1f2483,_0x50ecc1[_0x38d8('0x20')][_0x38d8('0x22')]);return _0x4d4d9c(_0x50ecc1[_0x38d8('0x20')][_0x38d8('0x22')]);}else{logger[_0x38d8('0x1b')](_0x38d8('0x1c'),_0x1f2483,_0x38d8('0x1d'));_0x4d4d9c(_0x50ecc1['result']['message']);}})[_0x38d8('0x23')](function(_0x11d9eb){logger[_0x38d8('0x20')](_0x38d8('0x1c'),_0x1f2483,_0x11d9eb);_0x1c5947(_0x11d9eb);});});}function respondWithStatusCode(_0x51dbf6,_0x5f077d){_0x5f077d=_0x5f077d||0xcc;return function(_0xd8213){if(_0xd8213){return _0x51dbf6[_0x38d8('0x24')](_0x5f077d);}return _0x51dbf6[_0x38d8('0x25')](_0x5f077d)[_0x38d8('0x26')]();};}function respondWithResult(_0x374a6c,_0x5be3be){_0x5be3be=_0x5be3be||0xc8;return function(_0x1e7796){if(_0x1e7796){return _0x374a6c[_0x38d8('0x25')](_0x5be3be)['json'](_0x1e7796);}};}function respondWithFilteredResult(_0x3b6e66,_0x280755){return function(_0x4ef59e){if(_0x4ef59e){var _0x1a8dbe=_0x4ef59e[_0x38d8('0x27')],_0x5153c0=_0x280755[_0x38d8('0x28')],_0x1b6fe6=_0x280755['offset']+_0x280755[_0x38d8('0x29')],_0x27face;if(_0x1b6fe6>=_0x1a8dbe){_0x1b6fe6=_0x1a8dbe;_0x27face=0xc8;}else{_0x27face=0xce;}_0x3b6e66[_0x38d8('0x25')](_0x27face);return _0x3b6e66[_0x38d8('0x2a')](_0x38d8('0x2b'),_0x5153c0+'-'+_0x1b6fe6+'/'+_0x1a8dbe)['json'](_0x4ef59e);}return null;};}function patchUpdates(_0x2519f6){return function(_0x3ae81a){try{jsonpatch[_0x38d8('0x2c')](_0x3ae81a,_0x2519f6,!![]);}catch(_0x3dc407){return BPromise[_0x38d8('0x2d')](_0x3dc407);}return _0x3ae81a['save']();};}function saveUpdates(_0x4daa76,_0x5eb627){return function(_0x3bcb58){if(_0x3bcb58){return _0x3bcb58['update'](_0x4daa76)[_0x38d8('0x2e')](function(_0x1d9644){return _0x1d9644;});}return null;};}function removeEntity(_0x158827,_0x1dd7a5){return function(_0xbee18e){if(_0xbee18e){return _0xbee18e[_0x38d8('0x2f')]()[_0x38d8('0x2e')](function(){_0x158827[_0x38d8('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc53602,_0x23ee44){return function(_0x2a41ba){if(!_0x2a41ba){_0xc53602[_0x38d8('0x24')](0x194);}return _0x2a41ba;};}function handleError(_0x1e49ec,_0x98c0e6){_0x98c0e6=_0x98c0e6||0x1f4;return function(_0x1ca372){logger[_0x38d8('0x20')](_0x1ca372[_0x38d8('0x30')]);if(_0x1ca372['name']){delete _0x1ca372['name'];}_0x1e49ec['status'](_0x98c0e6)[_0x38d8('0x31')](_0x1ca372);};}exports[_0x38d8('0x32')]=function(_0x507b97,_0x2d9d43){var _0x551f6b={},_0x1f13a2={},_0x21d3f5={'count':0x0,'rows':[]};var _0x4b29ac=_[_0x38d8('0x33')](db[_0x38d8('0x34')][_0x38d8('0x35')],function(_0x147465){return{'name':_0x147465[_0x38d8('0x36')],'type':_0x147465[_0x38d8('0x37')][_0x38d8('0x38')]};});_0x1f13a2['model']=_[_0x38d8('0x33')](_0x4b29ac,_0x38d8('0x39'));_0x1f13a2[_0x38d8('0x3a')]=_[_0x38d8('0x3b')](_0x507b97[_0x38d8('0x3a')]);_0x1f13a2[_0x38d8('0x3c')]=_[_0x38d8('0x3d')](_0x1f13a2[_0x38d8('0x3e')],_0x1f13a2[_0x38d8('0x3a')]);_0x551f6b[_0x38d8('0x3f')]=_[_0x38d8('0x3d')](_0x1f13a2['model'],qs[_0x38d8('0x40')](_0x507b97[_0x38d8('0x3a')]['fields']));_0x551f6b[_0x38d8('0x3f')]=_0x551f6b[_0x38d8('0x3f')][_0x38d8('0x41')]?_0x551f6b['attributes']:_0x1f13a2[_0x38d8('0x3e')];if(!_0x507b97[_0x38d8('0x3a')][_0x38d8('0x42')]('nolimit')){_0x551f6b[_0x38d8('0x29')]=qs['limit'](_0x507b97[_0x38d8('0x3a')][_0x38d8('0x29')]);_0x551f6b['offset']=qs[_0x38d8('0x28')](_0x507b97['query'][_0x38d8('0x28')]);}_0x551f6b[_0x38d8('0x43')]=qs[_0x38d8('0x44')](_0x507b97[_0x38d8('0x3a')][_0x38d8('0x44')]);_0x551f6b['where']=qs[_0x38d8('0x3c')](_[_0x38d8('0x45')](_0x507b97[_0x38d8('0x3a')],_0x1f13a2['filters']),_0x4b29ac);if(_0x507b97[_0x38d8('0x3a')][_0x38d8('0x46')]){_0x551f6b['where']=_[_0x38d8('0x47')](_0x551f6b[_0x38d8('0x48')],{'$or':_['map'](_0x4b29ac,function(_0x195532){if(_0x195532[_0x38d8('0x37')]!=='VIRTUAL'){var _0x48f1d5={};_0x48f1d5[_0x195532[_0x38d8('0x39')]]={'$like':'%'+_0x507b97[_0x38d8('0x3a')][_0x38d8('0x46')]+'%'};return _0x48f1d5;}})});}_0x551f6b=_[_0x38d8('0x47')]({},_0x551f6b,_0x507b97['options']);var _0xa75c4={'where':_0x551f6b[_0x38d8('0x48')]};return db[_0x38d8('0x34')][_0x38d8('0x27')](_0xa75c4)[_0x38d8('0x2e')](function(_0x29d7ae){_0x21d3f5[_0x38d8('0x27')]=_0x29d7ae;if(_0x507b97[_0x38d8('0x3a')][_0x38d8('0x49')]){_0x551f6b[_0x38d8('0x4a')]=[{'all':!![]}];}return db[_0x38d8('0x34')][_0x38d8('0x4b')](_0x551f6b);})[_0x38d8('0x2e')](function(_0x5277ea){_0x21d3f5[_0x38d8('0x4c')]=_0x5277ea;return _0x21d3f5;})['then'](respondWithFilteredResult(_0x2d9d43,_0x551f6b))[_0x38d8('0x23')](handleError(_0x2d9d43,null));};exports[_0x38d8('0x4d')]=function(_0x3d8b42,_0x82ca8a){var _0x52f8e7={'raw':![],'where':{'id':_0x3d8b42[_0x38d8('0x4e')]['id']}},_0x563719={};_0x563719['model']=_['keys'](db[_0x38d8('0x34')][_0x38d8('0x35')]);_0x563719[_0x38d8('0x3a')]=_[_0x38d8('0x3b')](_0x3d8b42[_0x38d8('0x3a')]);_0x563719[_0x38d8('0x3c')]=_[_0x38d8('0x3d')](_0x563719[_0x38d8('0x3e')],_0x563719[_0x38d8('0x3a')]);_0x52f8e7[_0x38d8('0x3f')]=_[_0x38d8('0x3d')](_0x563719[_0x38d8('0x3e')],qs[_0x38d8('0x40')](_0x3d8b42[_0x38d8('0x3a')][_0x38d8('0x40')]));_0x52f8e7['attributes']=_0x52f8e7[_0x38d8('0x3f')]['length']?_0x52f8e7[_0x38d8('0x3f')]:_0x563719[_0x38d8('0x3e')];if(_0x3d8b42[_0x38d8('0x3a')][_0x38d8('0x49')]){_0x52f8e7[_0x38d8('0x4a')]=[{'all':!![]}];}_0x52f8e7=_['merge']({},_0x52f8e7,_0x3d8b42[_0x38d8('0x4f')]);return db[_0x38d8('0x34')][_0x38d8('0x50')](_0x52f8e7)[_0x38d8('0x2e')](handleEntityNotFound(_0x82ca8a,null))[_0x38d8('0x2e')](respondWithResult(_0x82ca8a,null))[_0x38d8('0x23')](handleError(_0x82ca8a,null));};exports[_0x38d8('0x51')]=function(_0x3a884d,_0x4d95d2){return db[_0x38d8('0x34')]['create'](_0x3a884d[_0x38d8('0x52')],{})[_0x38d8('0x2e')](respondWithResult(_0x4d95d2,0xc9))[_0x38d8('0x23')](handleError(_0x4d95d2,null));};exports[_0x38d8('0x53')]=function(_0x5ad8ed,_0x2480c8){if(_0x5ad8ed[_0x38d8('0x52')]['id']){delete _0x5ad8ed['body']['id'];}return db[_0x38d8('0x34')][_0x38d8('0x50')]({'where':{'id':_0x5ad8ed[_0x38d8('0x4e')]['id']}})[_0x38d8('0x2e')](handleEntityNotFound(_0x2480c8,null))[_0x38d8('0x2e')](saveUpdates(_0x5ad8ed[_0x38d8('0x52')],null))[_0x38d8('0x2e')](respondWithResult(_0x2480c8,null))[_0x38d8('0x23')](handleError(_0x2480c8,null));};exports[_0x38d8('0x2f')]=function(_0x317947,_0x46715d){return db['SugarcrmConfiguration'][_0x38d8('0x50')]({'where':{'id':_0x317947[_0x38d8('0x4e')]['id']}})[_0x38d8('0x2e')](handleEntityNotFound(_0x46715d,null))['then'](removeEntity(_0x46715d,null))[_0x38d8('0x23')](handleError(_0x46715d,null));};exports['getFields']=function(_0x2af632,_0x18a0c0,_0x527561){var _0x314898={};var _0x3bb59d={};var _0x3e9828;var _0x456dc2;return db[_0x38d8('0x34')]['findOne']({'where':{'id':_0x2af632['params']['id']}})[_0x38d8('0x2e')](handleEntityNotFound(_0x18a0c0,null))[_0x38d8('0x2e')](function(_0x2ab893){if(_0x2ab893){_0x3e9828=_0x2ab893;_0x3bb59d[_0x38d8('0x3e')]=_[_0x38d8('0x3b')](db[_0x38d8('0x54')][_0x38d8('0x35')]);_0x3bb59d['query']=_[_0x38d8('0x3b')](_0x2af632[_0x38d8('0x3a')]);_0x3bb59d['filters']=_['intersection'](_0x3bb59d[_0x38d8('0x3e')],_0x3bb59d[_0x38d8('0x3a')]);_0x314898[_0x38d8('0x3f')]=_[_0x38d8('0x3d')](_0x3bb59d['model'],qs[_0x38d8('0x40')](_0x2af632[_0x38d8('0x3a')][_0x38d8('0x40')]));_0x314898[_0x38d8('0x3f')]=_0x314898[_0x38d8('0x3f')][_0x38d8('0x41')]?_0x314898[_0x38d8('0x3f')]:_0x3bb59d['model'];_0x314898[_0x38d8('0x43')]=qs[_0x38d8('0x44')](_0x2af632['query'][_0x38d8('0x44')]);_0x314898[_0x38d8('0x48')]=qs[_0x38d8('0x3c')](_['pick'](_0x2af632[_0x38d8('0x3a')],_0x3bb59d['filters']));if(_0x2af632['query']['filter']){_0x314898[_0x38d8('0x48')]=_[_0x38d8('0x47')](_0x314898['where'],{'$or':_['map'](_0x314898[_0x38d8('0x3f')],function(_0xd2b13f){var _0x7a46ad={};_0x7a46ad[_0xd2b13f]={'$like':'%'+_0x2af632[_0x38d8('0x3a')][_0x38d8('0x46')]+'%'};return _0x7a46ad;})});}_0x314898=_[_0x38d8('0x47')]({},_0x314898,_0x2af632['options']);return _0x3e9828[_0x38d8('0x55')](_0x314898);}})[_0x38d8('0x2e')](function(_0x2fa21f){if(_0x2fa21f){_0x456dc2=_0x2fa21f[_0x38d8('0x41')];if(!_0x2af632[_0x38d8('0x3a')][_0x38d8('0x42')](_0x38d8('0x56'))){_0x314898['limit']=qs[_0x38d8('0x29')](_0x2af632[_0x38d8('0x3a')][_0x38d8('0x29')]);_0x314898[_0x38d8('0x28')]=qs['offset'](_0x2af632[_0x38d8('0x3a')][_0x38d8('0x28')]);}return _0x3e9828['getFields'](_0x314898);}})['then'](function(_0x53a681){if(_0x53a681){return _0x53a681?{'count':_0x456dc2,'rows':_0x53a681}:null;}})[_0x38d8('0x2e')](respondWithResult(_0x18a0c0,null))[_0x38d8('0x23')](handleError(_0x18a0c0,null));};exports['getSubjects']=function(_0x56ecb1,_0x3e5875,_0xee339d){var _0x4df5b3={};var _0x1c8415={};var _0x4b10ed;var _0x103b5b;return db['SugarcrmConfiguration'][_0x38d8('0x57')]({'where':{'id':_0x56ecb1[_0x38d8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e5875,null))[_0x38d8('0x2e')](function(_0x59135e){if(_0x59135e){_0x4b10ed=_0x59135e;_0x1c8415['model']=_[_0x38d8('0x3b')](db[_0x38d8('0x54')][_0x38d8('0x35')]);_0x1c8415[_0x38d8('0x3a')]=_[_0x38d8('0x3b')](_0x56ecb1[_0x38d8('0x3a')]);_0x1c8415['filters']=_['intersection'](_0x1c8415['model'],_0x1c8415[_0x38d8('0x3a')]);_0x4df5b3[_0x38d8('0x3f')]=_[_0x38d8('0x3d')](_0x1c8415[_0x38d8('0x3e')],qs['fields'](_0x56ecb1[_0x38d8('0x3a')][_0x38d8('0x40')]));_0x4df5b3[_0x38d8('0x3f')]=_0x4df5b3[_0x38d8('0x3f')][_0x38d8('0x41')]?_0x4df5b3[_0x38d8('0x3f')]:_0x1c8415[_0x38d8('0x3e')];_0x4df5b3[_0x38d8('0x43')]=qs['sort'](_0x56ecb1['query']['sort']);_0x4df5b3['where']=qs[_0x38d8('0x3c')](_[_0x38d8('0x45')](_0x56ecb1[_0x38d8('0x3a')],_0x1c8415[_0x38d8('0x3c')]));if(_0x56ecb1[_0x38d8('0x3a')]['filter']){_0x4df5b3[_0x38d8('0x48')]=_[_0x38d8('0x47')](_0x4df5b3[_0x38d8('0x48')],{'$or':_['map'](_0x4df5b3[_0x38d8('0x3f')],function(_0x4e0291){var _0x56f1a6={};_0x56f1a6[_0x4e0291]={'$like':'%'+_0x56ecb1[_0x38d8('0x3a')][_0x38d8('0x46')]+'%'};return _0x56f1a6;})});}_0x4df5b3=_[_0x38d8('0x47')]({},_0x4df5b3,_0x56ecb1[_0x38d8('0x4f')]);return _0x4b10ed[_0x38d8('0x58')](_0x4df5b3);}})[_0x38d8('0x2e')](function(_0x3a9ea4){if(_0x3a9ea4){_0x103b5b=_0x3a9ea4[_0x38d8('0x41')];if(!_0x56ecb1[_0x38d8('0x3a')][_0x38d8('0x42')](_0x38d8('0x56'))){_0x4df5b3[_0x38d8('0x29')]=qs[_0x38d8('0x29')](_0x56ecb1[_0x38d8('0x3a')][_0x38d8('0x29')]);_0x4df5b3['offset']=qs['offset'](_0x56ecb1['query'][_0x38d8('0x28')]);}return _0x4b10ed['getSubjects'](_0x4df5b3);}})[_0x38d8('0x2e')](function(_0x26956a){if(_0x26956a){return _0x26956a?{'count':_0x103b5b,'rows':_0x26956a}:null;}})[_0x38d8('0x2e')](respondWithResult(_0x3e5875,null))[_0x38d8('0x23')](handleError(_0x3e5875,null));};exports[_0x38d8('0x59')]=function(_0x6eee38,_0x210be6,_0x5ef7f4){var _0x10364f={};var _0x5251dc={};var _0x4f4e83;var _0x1e0eb0;return db[_0x38d8('0x34')]['findOne']({'where':{'id':_0x6eee38[_0x38d8('0x4e')]['id']}})[_0x38d8('0x2e')](handleEntityNotFound(_0x210be6,null))['then'](function(_0x25b55d){if(_0x25b55d){_0x4f4e83=_0x25b55d;_0x5251dc[_0x38d8('0x3e')]=_[_0x38d8('0x3b')](db[_0x38d8('0x54')]['rawAttributes']);_0x5251dc[_0x38d8('0x3a')]=_['keys'](_0x6eee38[_0x38d8('0x3a')]);_0x5251dc[_0x38d8('0x3c')]=_[_0x38d8('0x3d')](_0x5251dc[_0x38d8('0x3e')],_0x5251dc['query']);_0x10364f[_0x38d8('0x3f')]=_['intersection'](_0x5251dc[_0x38d8('0x3e')],qs[_0x38d8('0x40')](_0x6eee38['query'][_0x38d8('0x40')]));_0x10364f[_0x38d8('0x3f')]=_0x10364f[_0x38d8('0x3f')][_0x38d8('0x41')]?_0x10364f[_0x38d8('0x3f')]:_0x5251dc[_0x38d8('0x3e')];_0x10364f['order']=qs[_0x38d8('0x44')](_0x6eee38[_0x38d8('0x3a')][_0x38d8('0x44')]);_0x10364f[_0x38d8('0x48')]=qs[_0x38d8('0x3c')](_[_0x38d8('0x45')](_0x6eee38['query'],_0x5251dc[_0x38d8('0x3c')]));if(_0x6eee38[_0x38d8('0x3a')][_0x38d8('0x46')]){_0x10364f[_0x38d8('0x48')]=_['merge'](_0x10364f[_0x38d8('0x48')],{'$or':_[_0x38d8('0x33')](_0x10364f[_0x38d8('0x3f')],function(_0x1d65e2){var _0x88d0c5={};_0x88d0c5[_0x1d65e2]={'$like':'%'+_0x6eee38[_0x38d8('0x3a')][_0x38d8('0x46')]+'%'};return _0x88d0c5;})});}_0x10364f=_[_0x38d8('0x47')]({},_0x10364f,_0x6eee38[_0x38d8('0x4f')]);return _0x4f4e83['getDescriptions'](_0x10364f);}})[_0x38d8('0x2e')](function(_0x19de0c){if(_0x19de0c){_0x1e0eb0=_0x19de0c[_0x38d8('0x41')];if(!_0x6eee38['query'][_0x38d8('0x42')](_0x38d8('0x56'))){_0x10364f['limit']=qs['limit'](_0x6eee38[_0x38d8('0x3a')][_0x38d8('0x29')]);_0x10364f['offset']=qs[_0x38d8('0x28')](_0x6eee38[_0x38d8('0x3a')][_0x38d8('0x28')]);}return _0x4f4e83[_0x38d8('0x59')](_0x10364f);}})[_0x38d8('0x2e')](function(_0x368001){if(_0x368001){return _0x368001?{'count':_0x1e0eb0,'rows':_0x368001}:null;}})[_0x38d8('0x2e')](respondWithResult(_0x210be6,null))[_0x38d8('0x23')](handleError(_0x210be6,null));}; \ No newline at end of file +var _0xd717=['filter','options','SugarcrmConfiguration','includeAll','include','findAll','show','params','fields','body','find','SugarcrmField','getFields','getSubjects','findOne','getDescriptions','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','limit','set','update','destroy','then','sendStatus','stack','name','send','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL'];(function(_0xd24392,_0x2c7588){var _0x52a979=function(_0x12f897){while(--_0x12f897){_0xd24392['push'](_0xd24392['shift']());}};_0x52a979(++_0x2c7588);}(_0xd717,0x122));var _0x7d71=function(_0x4527e0,_0x2544c1){_0x4527e0=_0x4527e0-0x0;var _0x256081=_0xd717[_0x4527e0];return _0x256081;};'use strict';var pdf=require(_0x7d71('0x0'));var emlformat=require(_0x7d71('0x1'));var rimraf=require(_0x7d71('0x2'));var zipdir=require(_0x7d71('0x3'));var jsonpatch=require(_0x7d71('0x4'));var rp=require(_0x7d71('0x5'));var moment=require(_0x7d71('0x6'));var BPromise=require(_0x7d71('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d71('0x8'));var sox=require('sox');var csv=require(_0x7d71('0x9'));var ejs=require(_0x7d71('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7d71('0xb'));var crypto=require(_0x7d71('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d71('0xd'));var toCsv=require(_0x7d71('0x9'));var querystring=require(_0x7d71('0xe'));var Papa=require(_0x7d71('0xf'));var Redis=require(_0x7d71('0x10'));var authService=require(_0x7d71('0x11'));var qs=require(_0x7d71('0x12'));var as=require(_0x7d71('0x13'));var hardwareService=require(_0x7d71('0x14'));var logger=require(_0x7d71('0x15'))(_0x7d71('0x16'));var utils=require(_0x7d71('0x17'));var config=require(_0x7d71('0x18'));var db=require(_0x7d71('0x19'))['db'];var jayson=require(_0x7d71('0x1a'));var client=jayson[_0x7d71('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x3e9f93,_0xd08d47,_0x29728c){if(_0x29728c){var _0x3eab59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3eab59[_0x7d71('0x1c')](_0xd08d47)){return _0x3e9f93;}else{throw new db[(_0x7d71('0x1d'))][(_0x7d71('0x1e'))](_0x7d71('0x1f'));}}else{return _0x3e9f93;}}function respondWithRpcPromise(_0x431bd5,_0x1ae627,_0x4959a9,_0x4f16ab){return new BPromise(function(_0x514d9e,_0x1d845d){var _0x129085=_0x4f16ab||client;return _0x129085[_0x7d71('0x20')](_0x431bd5,_0x4959a9)['then'](function(_0x50ea69){logger[_0x7d71('0x21')](_0x7d71('0x22'),_0x1ae627,'request\x20sent');logger[_0x7d71('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1ae627,_0x7d71('0x24'),JSON['stringify'](_0x50ea69));if(_0x50ea69[_0x7d71('0x25')]){if(_0x50ea69[_0x7d71('0x25')][_0x7d71('0x26')]===0x1f4){logger[_0x7d71('0x25')](_0x7d71('0x22'),_0x1ae627,_0x50ea69[_0x7d71('0x25')]['message']);return _0x1d845d(_0x50ea69['error']['message']);}logger[_0x7d71('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1ae627,_0x50ea69[_0x7d71('0x25')][_0x7d71('0x27')]);return _0x514d9e(_0x50ea69['error'][_0x7d71('0x27')]);}else{logger[_0x7d71('0x21')](_0x7d71('0x22'),_0x1ae627,_0x7d71('0x24'));_0x514d9e(_0x50ea69[_0x7d71('0x28')]['message']);}})[_0x7d71('0x29')](function(_0x4fb2e6){logger['error'](_0x7d71('0x22'),_0x1ae627,_0x4fb2e6);_0x1d845d(_0x4fb2e6);});});}function respondWithStatusCode(_0x494cdc,_0x392f43){_0x392f43=_0x392f43||0xcc;return function(_0x1b9536){if(_0x1b9536){return _0x494cdc['sendStatus'](_0x392f43);}return _0x494cdc[_0x7d71('0x2a')](_0x392f43)[_0x7d71('0x2b')]();};}function respondWithResult(_0x36ae87,_0x1b48fb){_0x1b48fb=_0x1b48fb||0xc8;return function(_0x2b5c68){if(_0x2b5c68){return _0x36ae87['status'](_0x1b48fb)[_0x7d71('0x2c')](_0x2b5c68);}};}function respondWithFilteredResult(_0x412859,_0x10fbe9){return function(_0x1cca77){if(_0x1cca77){var _0x32fb4a=_0x1cca77[_0x7d71('0x2d')],_0x35988b=_0x10fbe9[_0x7d71('0x2e')],_0x52fa53=_0x10fbe9[_0x7d71('0x2e')]+_0x10fbe9[_0x7d71('0x2f')],_0x577fb0;if(_0x52fa53>=_0x32fb4a){_0x52fa53=_0x32fb4a;_0x577fb0=0xc8;}else{_0x577fb0=0xce;}_0x412859[_0x7d71('0x2a')](_0x577fb0);return _0x412859[_0x7d71('0x30')]('Content-Range',_0x35988b+'-'+_0x52fa53+'/'+_0x32fb4a)[_0x7d71('0x2c')](_0x1cca77);}return null;};}function patchUpdates(_0x48212b){return function(_0x1cf3cc){try{jsonpatch['apply'](_0x1cf3cc,_0x48212b,!![]);}catch(_0x19ba3a){return BPromise['reject'](_0x19ba3a);}return _0x1cf3cc['save']();};}function saveUpdates(_0x200631,_0x2c3df2){return function(_0x3f1b66){if(_0x3f1b66){return _0x3f1b66[_0x7d71('0x31')](_0x200631)['then'](function(_0x26592d){return _0x26592d;});}return null;};}function removeEntity(_0x3aab96,_0xf72d31){return function(_0x287fcf){if(_0x287fcf){return _0x287fcf[_0x7d71('0x32')]()[_0x7d71('0x33')](function(){_0x3aab96[_0x7d71('0x2a')](0xcc)[_0x7d71('0x2b')]();});}};}function handleEntityNotFound(_0x5445d7,_0x4d8f5e){return function(_0x59f6ca){if(!_0x59f6ca){_0x5445d7[_0x7d71('0x34')](0x194);}return _0x59f6ca;};}function handleError(_0x29d4b6,_0x2277cf){_0x2277cf=_0x2277cf||0x1f4;return function(_0x25fe5a){logger[_0x7d71('0x25')](_0x25fe5a[_0x7d71('0x35')]);if(_0x25fe5a[_0x7d71('0x36')]){delete _0x25fe5a[_0x7d71('0x36')];}_0x29d4b6['status'](_0x2277cf)[_0x7d71('0x37')](_0x25fe5a);};}exports['index']=function(_0x199863,_0x145e7e){var _0x242e39={},_0x41022b={},_0xfb9931={'count':0x0,'rows':[]};var _0x5ab771=_['map'](db['SugarcrmConfiguration'][_0x7d71('0x38')],function(_0x3018a4){return{'name':_0x3018a4[_0x7d71('0x39')],'type':_0x3018a4[_0x7d71('0x3a')]['key']};});_0x41022b[_0x7d71('0x3b')]=_[_0x7d71('0x3c')](_0x5ab771,_0x7d71('0x36'));_0x41022b['query']=_[_0x7d71('0x3d')](_0x199863[_0x7d71('0x3e')]);_0x41022b['filters']=_[_0x7d71('0x3f')](_0x41022b[_0x7d71('0x3b')],_0x41022b['query']);_0x242e39[_0x7d71('0x40')]=_[_0x7d71('0x3f')](_0x41022b[_0x7d71('0x3b')],qs['fields'](_0x199863[_0x7d71('0x3e')]['fields']));_0x242e39[_0x7d71('0x40')]=_0x242e39[_0x7d71('0x40')][_0x7d71('0x41')]?_0x242e39[_0x7d71('0x40')]:_0x41022b[_0x7d71('0x3b')];if(!_0x199863[_0x7d71('0x3e')][_0x7d71('0x42')](_0x7d71('0x43'))){_0x242e39['limit']=qs[_0x7d71('0x2f')](_0x199863[_0x7d71('0x3e')][_0x7d71('0x2f')]);_0x242e39[_0x7d71('0x2e')]=qs[_0x7d71('0x2e')](_0x199863[_0x7d71('0x3e')][_0x7d71('0x2e')]);}_0x242e39['order']=qs[_0x7d71('0x44')](_0x199863[_0x7d71('0x3e')]['sort']);_0x242e39['where']=qs[_0x7d71('0x45')](_[_0x7d71('0x46')](_0x199863[_0x7d71('0x3e')],_0x41022b['filters']),_0x5ab771);if(_0x199863['query']['filter']){_0x242e39[_0x7d71('0x47')]=_[_0x7d71('0x48')](_0x242e39[_0x7d71('0x47')],{'$or':_[_0x7d71('0x3c')](_0x5ab771,function(_0x106944){if(_0x106944[_0x7d71('0x3a')]!==_0x7d71('0x49')){var _0xc471ee={};_0xc471ee[_0x106944[_0x7d71('0x36')]]={'$like':'%'+_0x199863[_0x7d71('0x3e')][_0x7d71('0x4a')]+'%'};return _0xc471ee;}})});}_0x242e39=_[_0x7d71('0x48')]({},_0x242e39,_0x199863[_0x7d71('0x4b')]);var _0x50ff24={'where':_0x242e39[_0x7d71('0x47')]};return db[_0x7d71('0x4c')]['count'](_0x50ff24)['then'](function(_0x5b2127){_0xfb9931[_0x7d71('0x2d')]=_0x5b2127;if(_0x199863[_0x7d71('0x3e')][_0x7d71('0x4d')]){_0x242e39[_0x7d71('0x4e')]=[{'all':!![]}];}return db[_0x7d71('0x4c')][_0x7d71('0x4f')](_0x242e39);})['then'](function(_0x55570e){_0xfb9931['rows']=_0x55570e;return _0xfb9931;})['then'](respondWithFilteredResult(_0x145e7e,_0x242e39))[_0x7d71('0x29')](handleError(_0x145e7e,null));};exports[_0x7d71('0x50')]=function(_0x4ca190,_0x100e54){var _0x346a49={'raw':![],'where':{'id':_0x4ca190[_0x7d71('0x51')]['id']}},_0x42cd06={};_0x42cd06[_0x7d71('0x3b')]=_[_0x7d71('0x3d')](db['SugarcrmConfiguration']['rawAttributes']);_0x42cd06['query']=_[_0x7d71('0x3d')](_0x4ca190[_0x7d71('0x3e')]);_0x42cd06[_0x7d71('0x45')]=_[_0x7d71('0x3f')](_0x42cd06[_0x7d71('0x3b')],_0x42cd06[_0x7d71('0x3e')]);_0x346a49[_0x7d71('0x40')]=_[_0x7d71('0x3f')](_0x42cd06[_0x7d71('0x3b')],qs[_0x7d71('0x52')](_0x4ca190[_0x7d71('0x3e')][_0x7d71('0x52')]));_0x346a49[_0x7d71('0x40')]=_0x346a49[_0x7d71('0x40')][_0x7d71('0x41')]?_0x346a49[_0x7d71('0x40')]:_0x42cd06[_0x7d71('0x3b')];if(_0x4ca190[_0x7d71('0x3e')]['includeAll']){_0x346a49[_0x7d71('0x4e')]=[{'all':!![]}];}_0x346a49=_[_0x7d71('0x48')]({},_0x346a49,_0x4ca190[_0x7d71('0x4b')]);return db[_0x7d71('0x4c')]['find'](_0x346a49)[_0x7d71('0x33')](handleEntityNotFound(_0x100e54,null))['then'](respondWithResult(_0x100e54,null))[_0x7d71('0x29')](handleError(_0x100e54,null));};exports['create']=function(_0x1f9d1c,_0x96030e){return db[_0x7d71('0x4c')]['create'](_0x1f9d1c[_0x7d71('0x53')],{})[_0x7d71('0x33')](respondWithResult(_0x96030e,0xc9))[_0x7d71('0x29')](handleError(_0x96030e,null));};exports['update']=function(_0x2cfc6e,_0x296ae5){if(_0x2cfc6e['body']['id']){delete _0x2cfc6e['body']['id'];}return db['SugarcrmConfiguration'][_0x7d71('0x54')]({'where':{'id':_0x2cfc6e[_0x7d71('0x51')]['id']}})[_0x7d71('0x33')](handleEntityNotFound(_0x296ae5,null))['then'](saveUpdates(_0x2cfc6e[_0x7d71('0x53')],null))[_0x7d71('0x33')](respondWithResult(_0x296ae5,null))['catch'](handleError(_0x296ae5,null));};exports['destroy']=function(_0xf8397e,_0x5aec08){return db[_0x7d71('0x4c')]['find']({'where':{'id':_0xf8397e[_0x7d71('0x51')]['id']}})[_0x7d71('0x33')](handleEntityNotFound(_0x5aec08,null))[_0x7d71('0x33')](removeEntity(_0x5aec08,null))['catch'](handleError(_0x5aec08,null));};exports['getFields']=function(_0x5066a0,_0x134ddc,_0x4671fd){var _0x293fe5={};var _0x2affcf={};var _0x2dd135;var _0x25b1cd;return db[_0x7d71('0x4c')]['findOne']({'where':{'id':_0x5066a0[_0x7d71('0x51')]['id']}})[_0x7d71('0x33')](handleEntityNotFound(_0x134ddc,null))[_0x7d71('0x33')](function(_0x1ed800){if(_0x1ed800){_0x2dd135=_0x1ed800;_0x2affcf[_0x7d71('0x3b')]=_[_0x7d71('0x3d')](db[_0x7d71('0x55')][_0x7d71('0x38')]);_0x2affcf['query']=_[_0x7d71('0x3d')](_0x5066a0[_0x7d71('0x3e')]);_0x2affcf[_0x7d71('0x45')]=_['intersection'](_0x2affcf[_0x7d71('0x3b')],_0x2affcf[_0x7d71('0x3e')]);_0x293fe5[_0x7d71('0x40')]=_[_0x7d71('0x3f')](_0x2affcf[_0x7d71('0x3b')],qs['fields'](_0x5066a0[_0x7d71('0x3e')][_0x7d71('0x52')]));_0x293fe5['attributes']=_0x293fe5[_0x7d71('0x40')]['length']?_0x293fe5['attributes']:_0x2affcf[_0x7d71('0x3b')];_0x293fe5['order']=qs['sort'](_0x5066a0['query'][_0x7d71('0x44')]);_0x293fe5['where']=qs['filters'](_['pick'](_0x5066a0[_0x7d71('0x3e')],_0x2affcf[_0x7d71('0x45')]));if(_0x5066a0['query']['filter']){_0x293fe5[_0x7d71('0x47')]=_['merge'](_0x293fe5['where'],{'$or':_[_0x7d71('0x3c')](_0x293fe5[_0x7d71('0x40')],function(_0x11e0fa){var _0x31caa6={};_0x31caa6[_0x11e0fa]={'$like':'%'+_0x5066a0[_0x7d71('0x3e')][_0x7d71('0x4a')]+'%'};return _0x31caa6;})});}_0x293fe5=_[_0x7d71('0x48')]({},_0x293fe5,_0x5066a0[_0x7d71('0x4b')]);return _0x2dd135[_0x7d71('0x56')](_0x293fe5);}})[_0x7d71('0x33')](function(_0xb18435){if(_0xb18435){_0x25b1cd=_0xb18435['length'];if(!_0x5066a0['query'][_0x7d71('0x42')]('nolimit')){_0x293fe5[_0x7d71('0x2f')]=qs[_0x7d71('0x2f')](_0x5066a0[_0x7d71('0x3e')][_0x7d71('0x2f')]);_0x293fe5[_0x7d71('0x2e')]=qs['offset'](_0x5066a0[_0x7d71('0x3e')][_0x7d71('0x2e')]);}return _0x2dd135[_0x7d71('0x56')](_0x293fe5);}})[_0x7d71('0x33')](function(_0x604b6f){if(_0x604b6f){return _0x604b6f?{'count':_0x25b1cd,'rows':_0x604b6f}:null;}})[_0x7d71('0x33')](respondWithResult(_0x134ddc,null))[_0x7d71('0x29')](handleError(_0x134ddc,null));};exports[_0x7d71('0x57')]=function(_0x55938e,_0x1ff7e4,_0x4da6a5){var _0x2a561a={};var _0xbe2f3a={};var _0x29cbe8;var _0x59cf2a;return db[_0x7d71('0x4c')][_0x7d71('0x58')]({'where':{'id':_0x55938e[_0x7d71('0x51')]['id']}})['then'](handleEntityNotFound(_0x1ff7e4,null))[_0x7d71('0x33')](function(_0xb9edb9){if(_0xb9edb9){_0x29cbe8=_0xb9edb9;_0xbe2f3a['model']=_[_0x7d71('0x3d')](db[_0x7d71('0x55')]['rawAttributes']);_0xbe2f3a[_0x7d71('0x3e')]=_[_0x7d71('0x3d')](_0x55938e[_0x7d71('0x3e')]);_0xbe2f3a[_0x7d71('0x45')]=_['intersection'](_0xbe2f3a[_0x7d71('0x3b')],_0xbe2f3a[_0x7d71('0x3e')]);_0x2a561a[_0x7d71('0x40')]=_[_0x7d71('0x3f')](_0xbe2f3a[_0x7d71('0x3b')],qs[_0x7d71('0x52')](_0x55938e[_0x7d71('0x3e')][_0x7d71('0x52')]));_0x2a561a[_0x7d71('0x40')]=_0x2a561a[_0x7d71('0x40')]['length']?_0x2a561a[_0x7d71('0x40')]:_0xbe2f3a[_0x7d71('0x3b')];_0x2a561a['order']=qs['sort'](_0x55938e['query'][_0x7d71('0x44')]);_0x2a561a['where']=qs[_0x7d71('0x45')](_[_0x7d71('0x46')](_0x55938e[_0x7d71('0x3e')],_0xbe2f3a[_0x7d71('0x45')]));if(_0x55938e[_0x7d71('0x3e')]['filter']){_0x2a561a[_0x7d71('0x47')]=_[_0x7d71('0x48')](_0x2a561a['where'],{'$or':_['map'](_0x2a561a[_0x7d71('0x40')],function(_0x19c102){var _0x183e69={};_0x183e69[_0x19c102]={'$like':'%'+_0x55938e['query'][_0x7d71('0x4a')]+'%'};return _0x183e69;})});}_0x2a561a=_[_0x7d71('0x48')]({},_0x2a561a,_0x55938e['options']);return _0x29cbe8[_0x7d71('0x57')](_0x2a561a);}})[_0x7d71('0x33')](function(_0x113aed){if(_0x113aed){_0x59cf2a=_0x113aed[_0x7d71('0x41')];if(!_0x55938e[_0x7d71('0x3e')][_0x7d71('0x42')](_0x7d71('0x43'))){_0x2a561a[_0x7d71('0x2f')]=qs[_0x7d71('0x2f')](_0x55938e[_0x7d71('0x3e')][_0x7d71('0x2f')]);_0x2a561a[_0x7d71('0x2e')]=qs[_0x7d71('0x2e')](_0x55938e['query'][_0x7d71('0x2e')]);}return _0x29cbe8[_0x7d71('0x57')](_0x2a561a);}})[_0x7d71('0x33')](function(_0x4362d2){if(_0x4362d2){return _0x4362d2?{'count':_0x59cf2a,'rows':_0x4362d2}:null;}})[_0x7d71('0x33')](respondWithResult(_0x1ff7e4,null))[_0x7d71('0x29')](handleError(_0x1ff7e4,null));};exports[_0x7d71('0x59')]=function(_0x2c02b2,_0x5ef32f,_0x22025c){var _0x4d924f={};var _0x73fbc0={};var _0x20eb0d;var _0x19b74f;return db[_0x7d71('0x4c')][_0x7d71('0x58')]({'where':{'id':_0x2c02b2[_0x7d71('0x51')]['id']}})[_0x7d71('0x33')](handleEntityNotFound(_0x5ef32f,null))[_0x7d71('0x33')](function(_0x208b5c){if(_0x208b5c){_0x20eb0d=_0x208b5c;_0x73fbc0[_0x7d71('0x3b')]=_[_0x7d71('0x3d')](db[_0x7d71('0x55')]['rawAttributes']);_0x73fbc0[_0x7d71('0x3e')]=_[_0x7d71('0x3d')](_0x2c02b2['query']);_0x73fbc0[_0x7d71('0x45')]=_['intersection'](_0x73fbc0[_0x7d71('0x3b')],_0x73fbc0[_0x7d71('0x3e')]);_0x4d924f['attributes']=_[_0x7d71('0x3f')](_0x73fbc0[_0x7d71('0x3b')],qs[_0x7d71('0x52')](_0x2c02b2[_0x7d71('0x3e')][_0x7d71('0x52')]));_0x4d924f[_0x7d71('0x40')]=_0x4d924f[_0x7d71('0x40')]['length']?_0x4d924f[_0x7d71('0x40')]:_0x73fbc0[_0x7d71('0x3b')];_0x4d924f[_0x7d71('0x5a')]=qs[_0x7d71('0x44')](_0x2c02b2[_0x7d71('0x3e')]['sort']);_0x4d924f[_0x7d71('0x47')]=qs['filters'](_['pick'](_0x2c02b2[_0x7d71('0x3e')],_0x73fbc0['filters']));if(_0x2c02b2[_0x7d71('0x3e')][_0x7d71('0x4a')]){_0x4d924f[_0x7d71('0x47')]=_[_0x7d71('0x48')](_0x4d924f[_0x7d71('0x47')],{'$or':_[_0x7d71('0x3c')](_0x4d924f[_0x7d71('0x40')],function(_0x32188f){var _0xa4adc2={};_0xa4adc2[_0x32188f]={'$like':'%'+_0x2c02b2[_0x7d71('0x3e')][_0x7d71('0x4a')]+'%'};return _0xa4adc2;})});}_0x4d924f=_[_0x7d71('0x48')]({},_0x4d924f,_0x2c02b2[_0x7d71('0x4b')]);return _0x20eb0d['getDescriptions'](_0x4d924f);}})['then'](function(_0x48e9a2){if(_0x48e9a2){_0x19b74f=_0x48e9a2['length'];if(!_0x2c02b2[_0x7d71('0x3e')]['hasOwnProperty'](_0x7d71('0x43'))){_0x4d924f['limit']=qs[_0x7d71('0x2f')](_0x2c02b2[_0x7d71('0x3e')][_0x7d71('0x2f')]);_0x4d924f[_0x7d71('0x2e')]=qs[_0x7d71('0x2e')](_0x2c02b2[_0x7d71('0x3e')][_0x7d71('0x2e')]);}return _0x20eb0d[_0x7d71('0x59')](_0x4d924f);}})[_0x7d71('0x33')](function(_0x283dd4){if(_0x283dd4){return _0x283dd4?{'count':_0x19b74f,'rows':_0x283dd4}:null;}})[_0x7d71('0x33')](respondWithResult(_0x5ef32f,null))[_0x7d71('0x29')](handleError(_0x5ef32f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ec67b04..4f1afed 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 _0xd8a7=['exports','define','SugarcrmConfiguration','util','api','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x4a1862,_0x3eea0c){var _0x5706e5=function(_0x1663a1){while(--_0x1663a1){_0x4a1862['push'](_0x4a1862['shift']());}};_0x5706e5(++_0x3eea0c);}(_0xd8a7,0xc9));var _0x7d8a=function(_0x2be723,_0x52f231){_0x2be723=_0x2be723-0x0;var _0xd46ae9=_0xd8a7[_0x2be723];return _0xd46ae9;};'use strict';var _=require('lodash');var util=require(_0x7d8a('0x0'));var logger=require('../../config/logger')(_0x7d8a('0x1'));var moment=require('moment');var BPromise=require(_0x7d8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d8a('0x3'));var config=require(_0x7d8a('0x4'));var attributes=require(_0x7d8a('0x5'));module[_0x7d8a('0x6')]=function(_0x684cfa,_0x110a85){return _0x684cfa[_0x7d8a('0x7')](_0x7d8a('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x636c=['path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c2dbb,_0x4e5e46){var _0x13608b=function(_0x4b373e){while(--_0x4b373e){_0x5c2dbb['push'](_0x5c2dbb['shift']());}};_0x13608b(++_0x4e5e46);}(_0x636c,0x14f));var _0xc636=function(_0x4d2360,_0x237ef9){_0x4d2360=_0x4d2360-0x0;var _0x1b1b8e=_0x636c[_0x4d2360];return _0x1b1b8e;};'use strict';var _=require('lodash');var util=require(_0xc636('0x0'));var logger=require(_0xc636('0x1'))(_0xc636('0x2'));var moment=require(_0xc636('0x3'));var BPromise=require(_0xc636('0x4'));var rp=require(_0xc636('0x5'));var fs=require('fs');var path=require(_0xc636('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc636('0x7'));module[_0xc636('0x8')]=function(_0x287c26,_0x4e9edf){return _0x287c26[_0xc636('0x9')](_0xc636('0xa'),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 9bfcb54..06377dd 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 _0x9b27=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3389e1,_0x444b4e){var _0x25313f=function(_0x1c0784){while(--_0x1c0784){_0x3389e1['push'](_0x3389e1['shift']());}};_0x25313f(++_0x444b4e);}(_0x9b27,0xb7));var _0x79b2=function(_0x36bdfc,_0x3c67f1){_0x36bdfc=_0x36bdfc-0x0;var _0x22a5be=_0x9b27[_0x36bdfc];return _0x22a5be;};'use strict';var _=require('lodash');var util=require(_0x79b2('0x0'));var moment=require(_0x79b2('0x1'));var BPromise=require('bluebird');var rs=require(_0x79b2('0x2'));var fs=require('fs');var Redis=require(_0x79b2('0x3'));var db=require(_0x79b2('0x4'))['db'];var utils=require(_0x79b2('0x5'));var logger=require(_0x79b2('0x6'))(_0x79b2('0x7'));var config=require(_0x79b2('0x8'));var jayson=require(_0x79b2('0x9'));var client=jayson[_0x79b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48cc42,_0x1787a3,_0x19a679){return new BPromise(function(_0x413578,_0x526c28){return client['request'](_0x48cc42,_0x19a679)[_0x79b2('0xb')](function(_0x4d8793){logger[_0x79b2('0xc')](_0x79b2('0xd'),_0x1787a3,_0x79b2('0xe'));logger[_0x79b2('0xf')](_0x79b2('0x10'),_0x1787a3,_0x79b2('0xe'),JSON[_0x79b2('0x11')](_0x4d8793));if(_0x4d8793[_0x79b2('0x12')]){if(_0x4d8793[_0x79b2('0x12')][_0x79b2('0x13')]===0x1f4){logger[_0x79b2('0x12')](_0x79b2('0xd'),_0x1787a3,_0x4d8793[_0x79b2('0x12')][_0x79b2('0x14')]);return _0x526c28(_0x4d8793[_0x79b2('0x12')][_0x79b2('0x14')]);}logger[_0x79b2('0x12')](_0x79b2('0xd'),_0x1787a3,_0x4d8793[_0x79b2('0x12')][_0x79b2('0x14')]);return _0x413578(_0x4d8793['error']['message']);}else{logger[_0x79b2('0xc')](_0x79b2('0xd'),_0x1787a3,_0x79b2('0xe'));_0x413578(_0x4d8793[_0x79b2('0x15')][_0x79b2('0x14')]);}})[_0x79b2('0x16')](function(_0x85a72f){logger['error'](_0x79b2('0xd'),_0x1787a3,_0x85a72f);_0x526c28(_0x85a72f);});});} \ No newline at end of file +var _0xf529=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf529,0x118));var _0x9f52=function(_0x524ba7,_0x296615){_0x524ba7=_0x524ba7-0x0;var _0x1eb1bf=_0xf529[_0x524ba7];return _0x1eb1bf;};'use strict';var _=require(_0x9f52('0x0'));var util=require('util');var moment=require(_0x9f52('0x1'));var BPromise=require(_0x9f52('0x2'));var rs=require(_0x9f52('0x3'));var fs=require('fs');var Redis=require(_0x9f52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f52('0x5'));var logger=require(_0x9f52('0x6'))(_0x9f52('0x7'));var config=require('../../config/environment');var jayson=require(_0x9f52('0x8'));var client=jayson[_0x9f52('0x9')][_0x9f52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c596b,_0x48e337,_0x430261){return new BPromise(function(_0x4632f9,_0x19bc14){return client[_0x9f52('0xb')](_0x8c596b,_0x430261)['then'](function(_0x39c440){logger['info'](_0x9f52('0xc'),_0x48e337,_0x9f52('0xd'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x48e337,_0x9f52('0xd'),JSON['stringify'](_0x39c440));if(_0x39c440[_0x9f52('0xe')]){if(_0x39c440[_0x9f52('0xe')][_0x9f52('0xf')]===0x1f4){logger['error'](_0x9f52('0xc'),_0x48e337,_0x39c440[_0x9f52('0xe')][_0x9f52('0x10')]);return _0x19bc14(_0x39c440[_0x9f52('0xe')][_0x9f52('0x10')]);}logger[_0x9f52('0xe')](_0x9f52('0xc'),_0x48e337,_0x39c440[_0x9f52('0xe')][_0x9f52('0x10')]);return _0x4632f9(_0x39c440[_0x9f52('0xe')][_0x9f52('0x10')]);}else{logger[_0x9f52('0x11')](_0x9f52('0xc'),_0x48e337,_0x9f52('0xd'));_0x4632f9(_0x39c440['result'][_0x9f52('0x10')]);}})[_0x9f52('0x12')](function(_0x2e7eba){logger[_0x9f52('0xe')](_0x9f52('0xc'),_0x48e337,_0x2e7eba);_0x19bc14(_0x2e7eba);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1215fed..da4ae62 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 _0xd2de=['./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x260ba6,_0x3c2ba9){var _0x3ba39f=function(_0x4186b0){while(--_0x4186b0){_0x260ba6['push'](_0x260ba6['shift']());}};_0x3ba39f(++_0x3c2ba9);}(_0xd2de,0x197));var _0xed2d=function(_0x308177,_0x5ec658){_0x308177=_0x308177-0x0;var _0x52d71f=_0xd2de[_0x308177];return _0x52d71f;};'use strict';var multer=require(_0xed2d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed2d('0x1'));var express=require(_0xed2d('0x2'));var router=express[_0xed2d('0x3')]();var auth=require(_0xed2d('0x4'));var interaction=require(_0xed2d('0x5'));var config=require(_0xed2d('0x6'));var controller=require(_0xed2d('0x7'));router[_0xed2d('0x8')]('/',auth[_0xed2d('0x9')](),controller[_0xed2d('0xa')]);router['get']('/:id',auth[_0xed2d('0x9')](),controller[_0xed2d('0xb')]);router[_0xed2d('0xc')]('/',auth['isAuthenticated'](),controller[_0xed2d('0xd')]);router[_0xed2d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xed2d('0xf')]);router[_0xed2d('0x10')]('/:id',auth[_0xed2d('0x9')](),controller[_0xed2d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xac79=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path'];(function(_0x46f096,_0x20fd4b){var _0x33199c=function(_0x466b59){while(--_0x466b59){_0x46f096['push'](_0x46f096['shift']());}};_0x33199c(++_0x20fd4b);}(_0xac79,0x153));var _0x9ac7=function(_0x3a62d5,_0x32862c){_0x3a62d5=_0x3a62d5-0x0;var _0x4a9f4f=_0xac79[_0x3a62d5];return _0x4a9f4f;};'use strict';var multer=require(_0x9ac7('0x0'));var util=require(_0x9ac7('0x1'));var path=require(_0x9ac7('0x2'));var timeout=require(_0x9ac7('0x3'));var express=require(_0x9ac7('0x4'));var router=express[_0x9ac7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ac7('0x6'));var config=require(_0x9ac7('0x7'));var controller=require(_0x9ac7('0x8'));router[_0x9ac7('0x9')]('/',auth[_0x9ac7('0xa')](),controller[_0x9ac7('0xb')]);router[_0x9ac7('0x9')](_0x9ac7('0xc'),auth[_0x9ac7('0xa')](),controller[_0x9ac7('0xd')]);router[_0x9ac7('0xe')]('/',auth[_0x9ac7('0xa')](),controller['create']);router[_0x9ac7('0xf')](_0x9ac7('0xc'),auth['isAuthenticated'](),controller[_0x9ac7('0x10')]);router[_0x9ac7('0x11')](_0x9ac7('0xc'),auth[_0x9ac7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index db0c601..642a1ee 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 _0xab5b=['customVariable','BOOLEAN','sequelize','exports','string','variable','STRING','ENUM'];(function(_0x58a33b,_0x4e7e2b){var _0xeac1c4=function(_0x3b5e49){while(--_0x3b5e49){_0x58a33b['push'](_0x58a33b['shift']());}};_0xeac1c4(++_0x4e7e2b);}(_0xab5b,0x11a));var _0xbab5=function(_0x5f2874,_0x240395){_0x5f2874=_0x5f2874-0x0;var _0x1ae96e=_0xab5b[_0x5f2874];return _0x1ae96e;};'use strict';var Sequelize=require(_0xbab5('0x0'));module[_0xbab5('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbab5('0x2'),_0xbab5('0x3'),'customVariable','keyValue'),'defaultValue':_0xbab5('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbab5('0x4')]},'keyType':{'type':Sequelize[_0xbab5('0x5')](_0xbab5('0x2'),_0xbab5('0x3'),_0xbab5('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbab5('0x4')]},'nameField':{'type':Sequelize[_0xbab5('0x4')]},'customField':{'type':Sequelize[_0xbab5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbab5('0x4')]}}; \ No newline at end of file +var _0x4e00=['string','variable','STRING','ENUM','customVariable','BOOLEAN','exports'];(function(_0x272d4e,_0x4adf01){var _0x17863a=function(_0x1e7829){while(--_0x1e7829){_0x272d4e['push'](_0x272d4e['shift']());}};_0x17863a(++_0x4adf01);}(_0x4e00,0xa0));var _0x04e0=function(_0x4728db,_0x213cc4){_0x4728db=_0x4728db-0x0;var _0x2a28e9=_0x4e00[_0x4728db];return _0x2a28e9;};'use strict';var Sequelize=require('sequelize');module[_0x04e0('0x0')]={'type':{'type':Sequelize['ENUM'](_0x04e0('0x1'),_0x04e0('0x2'),'customVariable','keyValue'),'defaultValue':_0x04e0('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x04e0('0x3')]},'keyType':{'type':Sequelize[_0x04e0('0x4')](_0x04e0('0x1'),_0x04e0('0x2'),_0x04e0('0x5'))},'keyContent':{'type':Sequelize[_0x04e0('0x3')]},'idField':{'type':Sequelize[_0x04e0('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x04e0('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04e0('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4a45aa9..91febd3 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 _0xa992=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','error','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xa992,0x7f));var _0x2a99=function(_0x429fb1,_0x45f0ee){_0x429fb1=_0x429fb1-0x0;var _0x652bf8=_0xa992[_0x429fb1];return _0x652bf8;};'use strict';var pdf=require(_0x2a99('0x0'));var emlformat=require(_0x2a99('0x1'));var rimraf=require(_0x2a99('0x2'));var zipdir=require(_0x2a99('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a99('0x4'));var moment=require('moment');var BPromise=require(_0x2a99('0x5'));var Mustache=require(_0x2a99('0x6'));var util=require(_0x2a99('0x7'));var path=require('path');var sox=require(_0x2a99('0x8'));var csv=require(_0x2a99('0x9'));var ejs=require(_0x2a99('0xa'));var fs=require('fs');var _=require(_0x2a99('0xb'));var squel=require(_0x2a99('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a99('0xd'));var deskjs=require(_0x2a99('0xe'));var toCsv=require(_0x2a99('0x9'));var querystring=require(_0x2a99('0xf'));var Papa=require(_0x2a99('0x10'));var Redis=require(_0x2a99('0x11'));var authService=require(_0x2a99('0x12'));var qs=require(_0x2a99('0x13'));var as=require(_0x2a99('0x14'));var hardwareService=require(_0x2a99('0x15'));var logger=require(_0x2a99('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2a99('0x17'))['db'];function respondWithStatusCode(_0x1c76f8,_0x2fe770){_0x2fe770=_0x2fe770||0xcc;return function(_0xe72346){if(_0xe72346){return _0x1c76f8[_0x2a99('0x18')](_0x2fe770);}return _0x1c76f8[_0x2a99('0x19')](_0x2fe770)[_0x2a99('0x1a')]();};}function respondWithResult(_0x10ae8e,_0xc0d298){_0xc0d298=_0xc0d298||0xc8;return function(_0x15cd19){if(_0x15cd19){return _0x10ae8e[_0x2a99('0x19')](_0xc0d298)[_0x2a99('0x1b')](_0x15cd19);}};}function respondWithFilteredResult(_0x1958d9,_0x917548){return function(_0x31f4eb){if(_0x31f4eb){var _0x5e1938=_0x31f4eb[_0x2a99('0x1c')],_0x75a5bd=_0x917548[_0x2a99('0x1d')],_0x3aeb54=_0x917548['offset']+_0x917548['limit'],_0x4e8413;if(_0x3aeb54>=_0x5e1938){_0x3aeb54=_0x5e1938;_0x4e8413=0xc8;}else{_0x4e8413=0xce;}_0x1958d9[_0x2a99('0x19')](_0x4e8413);return _0x1958d9[_0x2a99('0x1e')](_0x2a99('0x1f'),_0x75a5bd+'-'+_0x3aeb54+'/'+_0x5e1938)['json'](_0x31f4eb);}return null;};}function patchUpdates(_0x1d6b72){return function(_0x3d1c16){try{jsonpatch['apply'](_0x3d1c16,_0x1d6b72,!![]);}catch(_0x2fe047){return BPromise['reject'](_0x2fe047);}return _0x3d1c16[_0x2a99('0x20')]();};}function saveUpdates(_0x52a152,_0x5cb1b9){return function(_0x42786c){if(_0x42786c){return _0x42786c[_0x2a99('0x21')](_0x52a152)[_0x2a99('0x22')](function(_0x5169d8){return _0x5169d8;});}return null;};}function removeEntity(_0xd2a8ad,_0x54c7ad){return function(_0x4c7ca0){if(_0x4c7ca0){return _0x4c7ca0[_0x2a99('0x23')]()['then'](function(){_0xd2a8ad[_0x2a99('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x331850,_0x7f9bcf){return function(_0x4fbe4e){if(!_0x4fbe4e){_0x331850[_0x2a99('0x18')](0x194);}return _0x4fbe4e;};}function handleError(_0x1d5712,_0x3328f0){_0x3328f0=_0x3328f0||0x1f4;return function(_0x550870){logger[_0x2a99('0x24')](_0x550870['stack']);if(_0x550870[_0x2a99('0x25')]){delete _0x550870[_0x2a99('0x25')];}_0x1d5712['status'](_0x3328f0)['send'](_0x550870);};}exports['index']=function(_0x2d714e,_0x1079cb){var _0x45740f={},_0x589f99={},_0x2ffb00={'count':0x0,'rows':[]};var _0x36e51a=_['map'](db[_0x2a99('0x26')][_0x2a99('0x27')],function(_0x36a687){return{'name':_0x36a687[_0x2a99('0x28')],'type':_0x36a687[_0x2a99('0x29')][_0x2a99('0x2a')]};});_0x589f99[_0x2a99('0x2b')]=_[_0x2a99('0x2c')](_0x36e51a,_0x2a99('0x25'));_0x589f99[_0x2a99('0x2d')]=_[_0x2a99('0x2e')](_0x2d714e[_0x2a99('0x2d')]);_0x589f99['filters']=_[_0x2a99('0x2f')](_0x589f99[_0x2a99('0x2b')],_0x589f99[_0x2a99('0x2d')]);_0x45740f[_0x2a99('0x30')]=_[_0x2a99('0x2f')](_0x589f99['model'],qs[_0x2a99('0x31')](_0x2d714e[_0x2a99('0x2d')][_0x2a99('0x31')]));_0x45740f[_0x2a99('0x30')]=_0x45740f[_0x2a99('0x30')][_0x2a99('0x32')]?_0x45740f['attributes']:_0x589f99[_0x2a99('0x2b')];if(!_0x2d714e[_0x2a99('0x2d')][_0x2a99('0x33')](_0x2a99('0x34'))){_0x45740f[_0x2a99('0x35')]=qs[_0x2a99('0x35')](_0x2d714e['query']['limit']);_0x45740f[_0x2a99('0x1d')]=qs[_0x2a99('0x1d')](_0x2d714e[_0x2a99('0x2d')][_0x2a99('0x1d')]);}_0x45740f[_0x2a99('0x36')]=qs[_0x2a99('0x37')](_0x2d714e[_0x2a99('0x2d')]['sort']);_0x45740f[_0x2a99('0x38')]=qs[_0x2a99('0x39')](_[_0x2a99('0x3a')](_0x2d714e[_0x2a99('0x2d')],_0x589f99[_0x2a99('0x39')]),_0x36e51a);if(_0x2d714e['query'][_0x2a99('0x3b')]){_0x45740f[_0x2a99('0x38')]=_[_0x2a99('0x3c')](_0x45740f[_0x2a99('0x38')],{'$or':_[_0x2a99('0x2c')](_0x36e51a,function(_0x315ee8){if(_0x315ee8[_0x2a99('0x29')]!=='VIRTUAL'){var _0x174217={};_0x174217[_0x315ee8['name']]={'$like':'%'+_0x2d714e[_0x2a99('0x2d')]['filter']+'%'};return _0x174217;}})});}_0x45740f=_['merge']({},_0x45740f,_0x2d714e[_0x2a99('0x3d')]);var _0x3ce135={'where':_0x45740f[_0x2a99('0x38')]};return db[_0x2a99('0x26')][_0x2a99('0x1c')](_0x3ce135)[_0x2a99('0x22')](function(_0x23b77d){_0x2ffb00[_0x2a99('0x1c')]=_0x23b77d;if(_0x2d714e['query'][_0x2a99('0x3e')]){_0x45740f[_0x2a99('0x3f')]=[{'all':!![]}];}return db[_0x2a99('0x26')]['findAll'](_0x45740f);})[_0x2a99('0x22')](function(_0x28176f){_0x2ffb00[_0x2a99('0x40')]=_0x28176f;return _0x2ffb00;})[_0x2a99('0x22')](respondWithFilteredResult(_0x1079cb,_0x45740f))[_0x2a99('0x41')](handleError(_0x1079cb,null));};exports[_0x2a99('0x42')]=function(_0x48dae2,_0x3c060b){var _0x459fb0={'raw':!![],'where':{'id':_0x48dae2[_0x2a99('0x43')]['id']}},_0x25fd2d={};_0x25fd2d[_0x2a99('0x2b')]=_[_0x2a99('0x2e')](db[_0x2a99('0x26')]['rawAttributes']);_0x25fd2d['query']=_[_0x2a99('0x2e')](_0x48dae2[_0x2a99('0x2d')]);_0x25fd2d[_0x2a99('0x39')]=_['intersection'](_0x25fd2d[_0x2a99('0x2b')],_0x25fd2d[_0x2a99('0x2d')]);_0x459fb0[_0x2a99('0x30')]=_['intersection'](_0x25fd2d[_0x2a99('0x2b')],qs['fields'](_0x48dae2[_0x2a99('0x2d')][_0x2a99('0x31')]));_0x459fb0['attributes']=_0x459fb0[_0x2a99('0x30')][_0x2a99('0x32')]?_0x459fb0[_0x2a99('0x30')]:_0x25fd2d['model'];if(_0x48dae2[_0x2a99('0x2d')][_0x2a99('0x3e')]){_0x459fb0[_0x2a99('0x3f')]=[{'all':!![]}];}_0x459fb0=_[_0x2a99('0x3c')]({},_0x459fb0,_0x48dae2[_0x2a99('0x3d')]);return db[_0x2a99('0x26')][_0x2a99('0x44')](_0x459fb0)[_0x2a99('0x22')](handleEntityNotFound(_0x3c060b,null))[_0x2a99('0x22')](respondWithResult(_0x3c060b,null))[_0x2a99('0x41')](handleError(_0x3c060b,null));};exports['create']=function(_0x22c8fc,_0x5395ba){return db[_0x2a99('0x26')][_0x2a99('0x45')](_0x22c8fc['body'],{})[_0x2a99('0x22')](respondWithResult(_0x5395ba,0xc9))['catch'](handleError(_0x5395ba,null));};exports[_0x2a99('0x21')]=function(_0x1158a9,_0xfd0377){if(_0x1158a9[_0x2a99('0x46')]['id']){delete _0x1158a9[_0x2a99('0x46')]['id'];}return db['SugarcrmField'][_0x2a99('0x44')]({'where':{'id':_0x1158a9[_0x2a99('0x43')]['id']}})[_0x2a99('0x22')](handleEntityNotFound(_0xfd0377,null))['then'](saveUpdates(_0x1158a9[_0x2a99('0x46')],null))['then'](respondWithResult(_0xfd0377,null))['catch'](handleError(_0xfd0377,null));};exports[_0x2a99('0x23')]=function(_0x31a6b0,_0x2e24c0){return db[_0x2a99('0x26')][_0x2a99('0x44')]({'where':{'id':_0x31a6b0[_0x2a99('0x43')]['id']}})[_0x2a99('0x22')](handleEntityNotFound(_0x2e24c0,null))[_0x2a99('0x22')](removeEntity(_0x2e24c0,null))[_0x2a99('0x41')](handleError(_0x2e24c0,null));}; \ No newline at end of file +var _0x3937=['create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','includeAll','include','findAll','rows','catch','params','length','options','find'];(function(_0x5d8ace,_0x111a34){var _0xd2034e=function(_0x4924d0){while(--_0x4924d0){_0x5d8ace['push'](_0x5d8ace['shift']());}};_0xd2034e(++_0x111a34);}(_0x3937,0xd1));var _0x7393=function(_0xe1fb9a,_0x988c2b){_0xe1fb9a=_0xe1fb9a-0x0;var _0x397fee=_0x3937[_0xe1fb9a];return _0x397fee;};'use strict';var pdf=require(_0x7393('0x0'));var emlformat=require(_0x7393('0x1'));var rimraf=require(_0x7393('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7393('0x3'));var rp=require(_0x7393('0x4'));var moment=require(_0x7393('0x5'));var BPromise=require(_0x7393('0x6'));var Mustache=require('mustache');var util=require(_0x7393('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7393('0x8'));var ejs=require(_0x7393('0x9'));var fs=require('fs');var _=require(_0x7393('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7393('0xb'));var deskjs=require(_0x7393('0xc'));var toCsv=require(_0x7393('0x8'));var querystring=require(_0x7393('0xd'));var Papa=require(_0x7393('0xe'));var Redis=require(_0x7393('0xf'));var authService=require(_0x7393('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7393('0x11'));var logger=require(_0x7393('0x12'))('api');var utils=require(_0x7393('0x13'));var config=require(_0x7393('0x14'));var db=require(_0x7393('0x15'))['db'];function respondWithStatusCode(_0x1d8a06,_0x284063){_0x284063=_0x284063||0xcc;return function(_0x1f36fa){if(_0x1f36fa){return _0x1d8a06[_0x7393('0x16')](_0x284063);}return _0x1d8a06[_0x7393('0x17')](_0x284063)[_0x7393('0x18')]();};}function respondWithResult(_0x1b05b1,_0x7aa8d3){_0x7aa8d3=_0x7aa8d3||0xc8;return function(_0xc16a95){if(_0xc16a95){return _0x1b05b1['status'](_0x7aa8d3)['json'](_0xc16a95);}};}function respondWithFilteredResult(_0x3deeaf,_0x46ca54){return function(_0x1954c0){if(_0x1954c0){var _0x2c032f=_0x1954c0[_0x7393('0x19')],_0x352e85=_0x46ca54[_0x7393('0x1a')],_0x5a5fcc=_0x46ca54[_0x7393('0x1a')]+_0x46ca54[_0x7393('0x1b')],_0x1123f8;if(_0x5a5fcc>=_0x2c032f){_0x5a5fcc=_0x2c032f;_0x1123f8=0xc8;}else{_0x1123f8=0xce;}_0x3deeaf[_0x7393('0x17')](_0x1123f8);return _0x3deeaf['set'](_0x7393('0x1c'),_0x352e85+'-'+_0x5a5fcc+'/'+_0x2c032f)['json'](_0x1954c0);}return null;};}function patchUpdates(_0xea12d7){return function(_0x246df9){try{jsonpatch[_0x7393('0x1d')](_0x246df9,_0xea12d7,!![]);}catch(_0x58b5ff){return BPromise['reject'](_0x58b5ff);}return _0x246df9[_0x7393('0x1e')]();};}function saveUpdates(_0x45b22c,_0x147d4f){return function(_0x571709){if(_0x571709){return _0x571709[_0x7393('0x1f')](_0x45b22c)[_0x7393('0x20')](function(_0x494436){return _0x494436;});}return null;};}function removeEntity(_0x133eb4,_0x1ea2ee){return function(_0x3c00b1){if(_0x3c00b1){return _0x3c00b1[_0x7393('0x21')]()[_0x7393('0x20')](function(){_0x133eb4[_0x7393('0x17')](0xcc)[_0x7393('0x18')]();});}};}function handleEntityNotFound(_0x1db05b,_0x289d13){return function(_0x38166b){if(!_0x38166b){_0x1db05b[_0x7393('0x16')](0x194);}return _0x38166b;};}function handleError(_0x3e71c4,_0x57b333){_0x57b333=_0x57b333||0x1f4;return function(_0x4303c6){logger[_0x7393('0x22')](_0x4303c6[_0x7393('0x23')]);if(_0x4303c6[_0x7393('0x24')]){delete _0x4303c6[_0x7393('0x24')];}_0x3e71c4['status'](_0x57b333)[_0x7393('0x25')](_0x4303c6);};}exports[_0x7393('0x26')]=function(_0x30828d,_0x2790d8){var _0x572096={},_0x56bae7={},_0x8a4c94={'count':0x0,'rows':[]};var _0x34dc98=_['map'](db[_0x7393('0x27')][_0x7393('0x28')],function(_0x5aa5ac){return{'name':_0x5aa5ac['fieldName'],'type':_0x5aa5ac[_0x7393('0x29')][_0x7393('0x2a')]};});_0x56bae7[_0x7393('0x2b')]=_[_0x7393('0x2c')](_0x34dc98,_0x7393('0x24'));_0x56bae7[_0x7393('0x2d')]=_[_0x7393('0x2e')](_0x30828d[_0x7393('0x2d')]);_0x56bae7['filters']=_['intersection'](_0x56bae7['model'],_0x56bae7['query']);_0x572096['attributes']=_[_0x7393('0x2f')](_0x56bae7[_0x7393('0x2b')],qs[_0x7393('0x30')](_0x30828d[_0x7393('0x2d')][_0x7393('0x30')]));_0x572096[_0x7393('0x31')]=_0x572096[_0x7393('0x31')]['length']?_0x572096['attributes']:_0x56bae7[_0x7393('0x2b')];if(!_0x30828d[_0x7393('0x2d')][_0x7393('0x32')](_0x7393('0x33'))){_0x572096[_0x7393('0x1b')]=qs[_0x7393('0x1b')](_0x30828d['query'][_0x7393('0x1b')]);_0x572096[_0x7393('0x1a')]=qs[_0x7393('0x1a')](_0x30828d['query'][_0x7393('0x1a')]);}_0x572096[_0x7393('0x34')]=qs[_0x7393('0x35')](_0x30828d[_0x7393('0x2d')][_0x7393('0x35')]);_0x572096['where']=qs[_0x7393('0x36')](_[_0x7393('0x37')](_0x30828d['query'],_0x56bae7[_0x7393('0x36')]),_0x34dc98);if(_0x30828d[_0x7393('0x2d')]['filter']){_0x572096[_0x7393('0x38')]=_[_0x7393('0x39')](_0x572096[_0x7393('0x38')],{'$or':_[_0x7393('0x2c')](_0x34dc98,function(_0x7d8b5b){if(_0x7d8b5b[_0x7393('0x29')]!=='VIRTUAL'){var _0x19a3fd={};_0x19a3fd[_0x7d8b5b[_0x7393('0x24')]]={'$like':'%'+_0x30828d['query']['filter']+'%'};return _0x19a3fd;}})});}_0x572096=_[_0x7393('0x39')]({},_0x572096,_0x30828d['options']);var _0xf97788={'where':_0x572096['where']};return db[_0x7393('0x27')][_0x7393('0x19')](_0xf97788)[_0x7393('0x20')](function(_0x1165e0){_0x8a4c94[_0x7393('0x19')]=_0x1165e0;if(_0x30828d['query'][_0x7393('0x3a')]){_0x572096[_0x7393('0x3b')]=[{'all':!![]}];}return db['SugarcrmField'][_0x7393('0x3c')](_0x572096);})[_0x7393('0x20')](function(_0x3c6e17){_0x8a4c94[_0x7393('0x3d')]=_0x3c6e17;return _0x8a4c94;})[_0x7393('0x20')](respondWithFilteredResult(_0x2790d8,_0x572096))[_0x7393('0x3e')](handleError(_0x2790d8,null));};exports['show']=function(_0x3c12db,_0x75ae52){var _0x28bae1={'raw':!![],'where':{'id':_0x3c12db[_0x7393('0x3f')]['id']}},_0xe2eae3={};_0xe2eae3[_0x7393('0x2b')]=_[_0x7393('0x2e')](db[_0x7393('0x27')][_0x7393('0x28')]);_0xe2eae3[_0x7393('0x2d')]=_[_0x7393('0x2e')](_0x3c12db['query']);_0xe2eae3['filters']=_[_0x7393('0x2f')](_0xe2eae3[_0x7393('0x2b')],_0xe2eae3[_0x7393('0x2d')]);_0x28bae1[_0x7393('0x31')]=_[_0x7393('0x2f')](_0xe2eae3[_0x7393('0x2b')],qs['fields'](_0x3c12db[_0x7393('0x2d')][_0x7393('0x30')]));_0x28bae1['attributes']=_0x28bae1[_0x7393('0x31')][_0x7393('0x40')]?_0x28bae1['attributes']:_0xe2eae3[_0x7393('0x2b')];if(_0x3c12db['query']['includeAll']){_0x28bae1[_0x7393('0x3b')]=[{'all':!![]}];}_0x28bae1=_[_0x7393('0x39')]({},_0x28bae1,_0x3c12db[_0x7393('0x41')]);return db[_0x7393('0x27')][_0x7393('0x42')](_0x28bae1)['then'](handleEntityNotFound(_0x75ae52,null))[_0x7393('0x20')](respondWithResult(_0x75ae52,null))[_0x7393('0x3e')](handleError(_0x75ae52,null));};exports[_0x7393('0x43')]=function(_0x58447e,_0x4dc691){return db[_0x7393('0x27')][_0x7393('0x43')](_0x58447e[_0x7393('0x44')],{})['then'](respondWithResult(_0x4dc691,0xc9))[_0x7393('0x3e')](handleError(_0x4dc691,null));};exports[_0x7393('0x1f')]=function(_0x57cea8,_0x1df939){if(_0x57cea8[_0x7393('0x44')]['id']){delete _0x57cea8[_0x7393('0x44')]['id'];}return db['SugarcrmField'][_0x7393('0x42')]({'where':{'id':_0x57cea8[_0x7393('0x3f')]['id']}})[_0x7393('0x20')](handleEntityNotFound(_0x1df939,null))[_0x7393('0x20')](saveUpdates(_0x57cea8[_0x7393('0x44')],null))[_0x7393('0x20')](respondWithResult(_0x1df939,null))[_0x7393('0x3e')](handleError(_0x1df939,null));};exports[_0x7393('0x21')]=function(_0x249161,_0x26fad7){return db[_0x7393('0x27')][_0x7393('0x42')]({'where':{'id':_0x249161[_0x7393('0x3f')]['id']}})[_0x7393('0x20')](handleEntityNotFound(_0x26fad7,null))[_0x7393('0x20')](removeEntity(_0x26fad7,null))[_0x7393('0x3e')](handleError(_0x26fad7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 540b478..44f0c06 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 _0x9e84=['idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','SugarcrmField','sugarcrm_unique_index'];(function(_0x30df75,_0x4fc699){var _0x2244e2=function(_0x1f2385){while(--_0x1f2385){_0x30df75['push'](_0x30df75['shift']());}};_0x2244e2(++_0x4fc699);}(_0x9e84,0x84));var _0x49e8=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x9e84[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x49e8('0x0'));var util=require(_0x49e8('0x1'));var logger=require(_0x49e8('0x2'))(_0x49e8('0x3'));var moment=require(_0x49e8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49e8('0x5'));var rimraf=require(_0x49e8('0x6'));var config=require(_0x49e8('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x36e92d,_0x436f94){return _0x36e92d[_0x49e8('0x8')](_0x49e8('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x49e8('0xa'),'fields':[_0x49e8('0xb'),_0x49e8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x578d=['./intSugarcrmField.attributes','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1e7a85,_0x19a495){var _0x12bc35=function(_0x116582){while(--_0x116582){_0x1e7a85['push'](_0x1e7a85['shift']());}};_0x12bc35(++_0x19a495);}(_0x578d,0x72));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd578('0x0'));var logger=require(_0xd578('0x1'))('api');var moment=require(_0xd578('0x2'));var BPromise=require(_0xd578('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd578('0x4'));var rimraf=require(_0xd578('0x5'));var config=require('../../config/environment');var attributes=require(_0xd578('0x6'));module['exports']=function(_0x3320ef,_0x287e9a){return _0x3320ef[_0xd578('0x7')]('SugarcrmField',attributes,{'tableName':_0xd578('0x8'),'paranoid':![],'indexes':[{'name':_0xd578('0x9'),'fields':[_0xd578('0xa'),_0xd578('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 c92cb70..5e74ff4 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x228e32,_0x52e407){var _0x2b0236=function(_0x4da4e1){while(--_0x4da4e1){_0x228e32['push'](_0x228e32['shift']());}};_0x2b0236(++_0x52e407);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0x5eb8[_0x3328b4];return _0x530143;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x15cc64,_0x5c4420){var _0x5596d5=function(_0x21077c){while(--_0x21077c){_0x15cc64['push'](_0x15cc64['shift']());}};_0x5596d5(++_0x5c4420);}(_0x5eb8,0xb0));var _0x85eb=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0x5eb8[_0xd46333];return _0x336108;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a00abe6..3d5a49d 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 _0x29b2=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x47c418,_0x1e3182){var _0x83159=function(_0x3df040){while(--_0x3df040){_0x47c418['push'](_0x47c418['shift']());}};_0x83159(++_0x1e3182);}(_0x29b2,0x1bf));var _0x229b=function(_0x2dec11,_0x55511a){_0x2dec11=_0x2dec11-0x0;var _0x1d8d5f=_0x29b2[_0x2dec11];return _0x1d8d5f;};'use strict';var multer=require(_0x229b('0x0'));var util=require(_0x229b('0x1'));var path=require(_0x229b('0x2'));var timeout=require('connect-timeout');var express=require(_0x229b('0x3'));var router=express['Router']();var auth=require(_0x229b('0x4'));var interaction=require(_0x229b('0x5'));var config=require(_0x229b('0x6'));var controller=require(_0x229b('0x7'));router['get']('/',auth[_0x229b('0x8')](),controller[_0x229b('0x9')]);router[_0x229b('0xa')](_0x229b('0xb'),auth[_0x229b('0x8')](),controller[_0x229b('0xc')]);router[_0x229b('0xa')](_0x229b('0xd'),auth[_0x229b('0x8')](),controller[_0x229b('0xe')]);router[_0x229b('0xa')](_0x229b('0xf'),auth[_0x229b('0x8')](),controller[_0x229b('0x10')]);router[_0x229b('0x11')]('/',auth[_0x229b('0x8')](),controller['create']);router[_0x229b('0x11')](_0x229b('0xd'),auth[_0x229b('0x8')](),controller['addConfiguration']);router[_0x229b('0x12')]('/:id',auth[_0x229b('0x8')](),controller[_0x229b('0x13')]);router[_0x229b('0x14')](_0x229b('0xb'),auth[_0x229b('0x8')](),controller[_0x229b('0x15')]);module[_0x229b('0x16')]=router; \ No newline at end of file +var _0x5f73=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f73,0x1bb));var _0x35f7=function(_0xe55037,_0x57b685){_0xe55037=_0xe55037-0x0;var _0x290cff=_0x5f73[_0xe55037];return _0x290cff;};'use strict';var multer=require(_0x35f7('0x0'));var util=require('util');var path=require(_0x35f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x35f7('0x2'));var router=express[_0x35f7('0x3')]();var auth=require(_0x35f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x35f7('0x5'));var controller=require(_0x35f7('0x6'));router[_0x35f7('0x7')]('/',auth[_0x35f7('0x8')](),controller[_0x35f7('0x9')]);router[_0x35f7('0x7')](_0x35f7('0xa'),auth[_0x35f7('0x8')](),controller[_0x35f7('0xb')]);router[_0x35f7('0x7')](_0x35f7('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x35f7('0xd')]);router[_0x35f7('0xe')]('/',auth[_0x35f7('0x8')](),controller[_0x35f7('0xf')]);router[_0x35f7('0xe')](_0x35f7('0xc'),auth[_0x35f7('0x8')](),controller[_0x35f7('0x10')]);router[_0x35f7('0x11')](_0x35f7('0xa'),auth[_0x35f7('0x8')](),controller[_0x35f7('0x12')]);router[_0x35f7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x35f7('0x14')]);module[_0x35f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 882fbbd..b065555 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 _0x3ff6=['HelpDesk','exports','STRING'];(function(_0x2a51e1,_0x266b99){var _0x177b74=function(_0x660da6){while(--_0x660da6){_0x2a51e1['push'](_0x2a51e1['shift']());}};_0x177b74(++_0x266b99);}(_0x3ff6,0xb2));var _0x63ff=function(_0x5a59de,_0x47ff3a){_0x5a59de=_0x5a59de-0x0;var _0xcfc24e=_0x3ff6[_0x5a59de];return _0xcfc24e;};'use strict';var Sequelize=require('sequelize');module[_0x63ff('0x0')]={'name':{'type':Sequelize[_0x63ff('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x63ff('0x1')]},'username':{'type':Sequelize[_0x63ff('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x63ff('0x1')],'allowNull':![],'defaultValue':_0x63ff('0x2')},'remoteUri':{'type':Sequelize[_0x63ff('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x63ff('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6bb0=['sequelize','STRING','HelpDesk'];(function(_0x39fa62,_0x507f28){var _0x448f08=function(_0x3aa712){while(--_0x3aa712){_0x39fa62['push'](_0x39fa62['shift']());}};_0x448f08(++_0x507f28);}(_0x6bb0,0x141));var _0x06bb=function(_0x2fb175,_0x530dae){_0x2fb175=_0x2fb175-0x0;var _0x25e827=_0x6bb0[_0x2fb175];return _0x25e827;};'use strict';var Sequelize=require(_0x06bb('0x0'));module['exports']={'name':{'type':Sequelize[_0x06bb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x06bb('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x06bb('0x1')],'allowNull':![],'defaultValue':_0x06bb('0x2')},'remoteUri':{'type':Sequelize[_0x06bb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x06bb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c3f0822..b004b11 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 _0x2b69=['end','json','offset','limit','set','Content-Range','reject','save','update','then','stack','name','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','params','length','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','describe','autogenerated','owner','remove','includes','editable','label','startsWith','picklist','picklistValues','value','log','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b69,0x150));var _0x92b6=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x2b69[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0x92b6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92b6('0x1'));var zipdir=require(_0x92b6('0x2'));var jsonpatch=require(_0x92b6('0x3'));var rp=require(_0x92b6('0x4'));var moment=require(_0x92b6('0x5'));var BPromise=require(_0x92b6('0x6'));var Mustache=require('mustache');var util=require(_0x92b6('0x7'));var path=require('path');var sox=require(_0x92b6('0x8'));var csv=require(_0x92b6('0x9'));var ejs=require(_0x92b6('0xa'));var fs=require('fs');var _=require(_0x92b6('0xb'));var squel=require(_0x92b6('0xc'));var crypto=require(_0x92b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92b6('0xe'));var toCsv=require(_0x92b6('0x9'));var querystring=require(_0x92b6('0xf'));var Papa=require(_0x92b6('0x10'));var Redis=require('ioredis');var authService=require(_0x92b6('0x11'));var qs=require(_0x92b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92b6('0x13'));var logger=require('../../config/logger')(_0x92b6('0x14'));var utils=require(_0x92b6('0x15'));var config=require(_0x92b6('0x16'));var db=require(_0x92b6('0x17'))['db'];var integrations=require(_0x92b6('0x18'));var jayson=require(_0x92b6('0x19'));var client=jayson['client'][_0x92b6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2e6afe,_0x2ffc1c,_0x5cc331){if(_0x5cc331){var _0x3609e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3609e7[_0x92b6('0x1b')](_0x2ffc1c)){return _0x2e6afe;}else{throw new db['Sequelize'][(_0x92b6('0x1c'))](_0x92b6('0x1d'));}}else{return _0x2e6afe;}}function respondWithRpcPromise(_0x34eac1,_0x10756a,_0x22b473,_0x236f25){return new BPromise(function(_0x184390,_0x1cdc4a){var _0x5185fa=_0x236f25||client;return _0x5185fa[_0x92b6('0x1e')](_0x34eac1,_0x22b473)['then'](function(_0x440f18){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x10756a,_0x92b6('0x1f'));logger[_0x92b6('0x20')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x10756a,_0x92b6('0x1f'),JSON[_0x92b6('0x21')](_0x440f18));if(_0x440f18[_0x92b6('0x22')]){if(_0x440f18['error'][_0x92b6('0x23')]===0x1f4){logger[_0x92b6('0x22')](_0x92b6('0x24'),_0x10756a,_0x440f18['error'][_0x92b6('0x25')]);return _0x1cdc4a(_0x440f18[_0x92b6('0x22')][_0x92b6('0x25')]);}logger[_0x92b6('0x22')](_0x92b6('0x24'),_0x10756a,_0x440f18[_0x92b6('0x22')][_0x92b6('0x25')]);return _0x184390(_0x440f18[_0x92b6('0x22')][_0x92b6('0x25')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x10756a,_0x92b6('0x1f'));_0x184390(_0x440f18[_0x92b6('0x26')][_0x92b6('0x25')]);}})[_0x92b6('0x27')](function(_0xe69baf){logger['error'](_0x92b6('0x24'),_0x10756a,_0xe69baf);_0x1cdc4a(_0xe69baf);});});}function respondWithStatusCode(_0x227d86,_0x5f4dd){_0x5f4dd=_0x5f4dd||0xcc;return function(_0x3b3ba6){if(_0x3b3ba6){return _0x227d86[_0x92b6('0x28')](_0x5f4dd);}return _0x227d86[_0x92b6('0x29')](_0x5f4dd)[_0x92b6('0x2a')]();};}function respondWithResult(_0x2602d4,_0x2b9f67){_0x2b9f67=_0x2b9f67||0xc8;return function(_0x5ef36f){if(_0x5ef36f){return _0x2602d4[_0x92b6('0x29')](_0x2b9f67)[_0x92b6('0x2b')](_0x5ef36f);}};}function respondWithFilteredResult(_0x546fca,_0x1cd177){return function(_0x1c5bbd){if(_0x1c5bbd){var _0x448139=_0x1c5bbd['count'],_0x5e4944=_0x1cd177[_0x92b6('0x2c')],_0x341a5d=_0x1cd177['offset']+_0x1cd177[_0x92b6('0x2d')],_0x4c144a;if(_0x341a5d>=_0x448139){_0x341a5d=_0x448139;_0x4c144a=0xc8;}else{_0x4c144a=0xce;}_0x546fca[_0x92b6('0x29')](_0x4c144a);return _0x546fca[_0x92b6('0x2e')](_0x92b6('0x2f'),_0x5e4944+'-'+_0x341a5d+'/'+_0x448139)['json'](_0x1c5bbd);}return null;};}function patchUpdates(_0x4f4251){return function(_0x167168){try{jsonpatch['apply'](_0x167168,_0x4f4251,!![]);}catch(_0x38446e){return BPromise[_0x92b6('0x30')](_0x38446e);}return _0x167168[_0x92b6('0x31')]();};}function saveUpdates(_0x58fb15,_0x3cc37e){return function(_0x26e229){if(_0x26e229){return _0x26e229[_0x92b6('0x32')](_0x58fb15)[_0x92b6('0x33')](function(_0x5bcbc5){return _0x5bcbc5;});}return null;};}function removeEntity(_0x113863,_0x1b99b0){return function(_0x3664f2){if(_0x3664f2){return _0x3664f2['destroy']()['then'](function(){_0x113863[_0x92b6('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ad8b5,_0x3c341d){return function(_0x1adf63){if(!_0x1adf63){_0x1ad8b5[_0x92b6('0x28')](0x194);}return _0x1adf63;};}function handleError(_0x2c3291,_0x3e7d34){_0x3e7d34=_0x3e7d34||0x1f4;return function(_0x5efb13){logger['error'](_0x5efb13[_0x92b6('0x34')]);if(_0x5efb13[_0x92b6('0x35')]){delete _0x5efb13[_0x92b6('0x35')];}_0x2c3291[_0x92b6('0x29')](_0x3e7d34)['send'](_0x5efb13);};}exports['index']=function(_0x53364f,_0x3bdfd3){var _0x16093={},_0x1c6146={},_0x32878c={'count':0x0,'rows':[]};var _0x1d0a8b=_['map'](db[_0x92b6('0x36')][_0x92b6('0x37')],function(_0x14fd5b){return{'name':_0x14fd5b[_0x92b6('0x38')],'type':_0x14fd5b[_0x92b6('0x39')][_0x92b6('0x3a')]};});_0x1c6146[_0x92b6('0x3b')]=_[_0x92b6('0x3c')](_0x1d0a8b,_0x92b6('0x35'));_0x1c6146[_0x92b6('0x3d')]=_[_0x92b6('0x3e')](_0x53364f['query']);_0x1c6146['filters']=_[_0x92b6('0x3f')](_0x1c6146[_0x92b6('0x3b')],_0x1c6146['query']);_0x16093[_0x92b6('0x40')]=_[_0x92b6('0x3f')](_0x1c6146[_0x92b6('0x3b')],qs[_0x92b6('0x41')](_0x53364f[_0x92b6('0x3d')][_0x92b6('0x41')]));_0x16093[_0x92b6('0x40')]=_0x16093[_0x92b6('0x40')]['length']?_0x16093[_0x92b6('0x40')]:_0x1c6146[_0x92b6('0x3b')];if(!_0x53364f[_0x92b6('0x3d')][_0x92b6('0x42')](_0x92b6('0x43'))){_0x16093[_0x92b6('0x2d')]=qs[_0x92b6('0x2d')](_0x53364f[_0x92b6('0x3d')]['limit']);_0x16093[_0x92b6('0x2c')]=qs['offset'](_0x53364f['query']['offset']);}_0x16093[_0x92b6('0x44')]=qs[_0x92b6('0x45')](_0x53364f['query'][_0x92b6('0x45')]);_0x16093[_0x92b6('0x46')]=qs['filters'](_[_0x92b6('0x47')](_0x53364f[_0x92b6('0x3d')],_0x1c6146[_0x92b6('0x48')]),_0x1d0a8b);if(_0x53364f[_0x92b6('0x3d')][_0x92b6('0x49')]){_0x16093[_0x92b6('0x46')]=_[_0x92b6('0x4a')](_0x16093['where'],{'$or':_[_0x92b6('0x3c')](_0x1d0a8b,function(_0x508d22){if(_0x508d22[_0x92b6('0x39')]!==_0x92b6('0x4b')){var _0x278f30={};_0x278f30[_0x508d22[_0x92b6('0x35')]]={'$like':'%'+_0x53364f['query'][_0x92b6('0x49')]+'%'};return _0x278f30;}})});}_0x16093=_[_0x92b6('0x4a')]({},_0x16093,_0x53364f[_0x92b6('0x4c')]);var _0x348b2d={'where':_0x16093[_0x92b6('0x46')]};return db[_0x92b6('0x36')][_0x92b6('0x4d')](_0x348b2d)['then'](function(_0x198d6e){_0x32878c['count']=_0x198d6e;if(_0x53364f[_0x92b6('0x3d')][_0x92b6('0x4e')]){_0x16093[_0x92b6('0x4f')]=[{'all':!![]}];}return db[_0x92b6('0x36')][_0x92b6('0x50')](_0x16093);})['then'](function(_0x37f120){_0x32878c['rows']=_0x37f120;return _0x32878c;})[_0x92b6('0x33')](respondWithFilteredResult(_0x3bdfd3,_0x16093))[_0x92b6('0x27')](handleError(_0x3bdfd3,null));};exports['show']=function(_0x10327c,_0x527507){var _0xaad381={'raw':![],'where':{'id':_0x10327c[_0x92b6('0x51')]['id']}},_0x2d9a09={};_0x2d9a09[_0x92b6('0x3b')]=_['keys'](db['VtigerAccount'][_0x92b6('0x37')]);_0x2d9a09['query']=_[_0x92b6('0x3e')](_0x10327c[_0x92b6('0x3d')]);_0x2d9a09[_0x92b6('0x48')]=_[_0x92b6('0x3f')](_0x2d9a09[_0x92b6('0x3b')],_0x2d9a09['query']);_0xaad381[_0x92b6('0x40')]=_[_0x92b6('0x3f')](_0x2d9a09[_0x92b6('0x3b')],qs[_0x92b6('0x41')](_0x10327c[_0x92b6('0x3d')][_0x92b6('0x41')]));_0xaad381[_0x92b6('0x40')]=_0xaad381[_0x92b6('0x40')][_0x92b6('0x52')]?_0xaad381['attributes']:_0x2d9a09[_0x92b6('0x3b')];if(_0x10327c[_0x92b6('0x3d')][_0x92b6('0x4e')]){_0xaad381[_0x92b6('0x4f')]=[{'all':!![]}];}_0xaad381=_['merge']({},_0xaad381,_0x10327c[_0x92b6('0x4c')]);return db[_0x92b6('0x36')][_0x92b6('0x53')](_0xaad381)[_0x92b6('0x33')](handleEntityNotFound(_0x527507,null))['then'](respondWithResult(_0x527507,null))[_0x92b6('0x27')](handleError(_0x527507,null));};exports[_0x92b6('0x54')]=function(_0x5f2bc7,_0x1a5ecb){return db[_0x92b6('0x36')][_0x92b6('0x54')](_0x5f2bc7[_0x92b6('0x55')],{})[_0x92b6('0x33')](respondWithResult(_0x1a5ecb,0xc9))[_0x92b6('0x27')](handleError(_0x1a5ecb,null));};exports[_0x92b6('0x32')]=function(_0x2deb0b,_0x6b6f65){if(_0x2deb0b[_0x92b6('0x55')]['id']){delete _0x2deb0b['body']['id'];}return db[_0x92b6('0x36')][_0x92b6('0x53')]({'where':{'id':_0x2deb0b[_0x92b6('0x51')]['id']}})[_0x92b6('0x33')](handleEntityNotFound(_0x6b6f65,null))[_0x92b6('0x33')](saveUpdates(_0x2deb0b['body'],null))[_0x92b6('0x33')](respondWithResult(_0x6b6f65,null))[_0x92b6('0x27')](handleError(_0x6b6f65,null));};exports[_0x92b6('0x56')]=function(_0x169fe0,_0x42c2ce){return db['VtigerAccount'][_0x92b6('0x53')]({'where':{'id':_0x169fe0['params']['id']}})[_0x92b6('0x33')](handleEntityNotFound(_0x42c2ce,null))[_0x92b6('0x33')](removeEntity(_0x42c2ce,null))['catch'](handleError(_0x42c2ce,null));};exports[_0x92b6('0x57')]=function(_0x5d951e,_0x313eef,_0x3b0145){var _0x3bddaf={};var _0x1bce60={};var _0x342126;var _0x2e080b;return db[_0x92b6('0x36')][_0x92b6('0x58')]({'where':{'id':_0x5d951e['params']['id']}})[_0x92b6('0x33')](handleEntityNotFound(_0x313eef,null))[_0x92b6('0x33')](function(_0x385534){if(_0x385534){_0x342126=_0x385534;_0x1bce60[_0x92b6('0x3b')]=_['keys'](db['VtigerConfiguration'][_0x92b6('0x37')]);_0x1bce60[_0x92b6('0x3d')]=_['keys'](_0x5d951e[_0x92b6('0x3d')]);_0x1bce60['filters']=_[_0x92b6('0x3f')](_0x1bce60[_0x92b6('0x3b')],_0x1bce60['query']);_0x3bddaf[_0x92b6('0x40')]=_[_0x92b6('0x3f')](_0x1bce60[_0x92b6('0x3b')],qs[_0x92b6('0x41')](_0x5d951e[_0x92b6('0x3d')][_0x92b6('0x41')]));_0x3bddaf[_0x92b6('0x40')]=_0x3bddaf['attributes'][_0x92b6('0x52')]?_0x3bddaf['attributes']:_0x1bce60['model'];_0x3bddaf[_0x92b6('0x44')]=qs['sort'](_0x5d951e['query']['sort']);_0x3bddaf[_0x92b6('0x46')]=qs[_0x92b6('0x48')](_[_0x92b6('0x47')](_0x5d951e['query'],_0x1bce60[_0x92b6('0x48')]));if(_0x5d951e['query']['filter']){_0x3bddaf[_0x92b6('0x46')]=_[_0x92b6('0x4a')](_0x3bddaf[_0x92b6('0x46')],{'$or':_[_0x92b6('0x3c')](_0x3bddaf[_0x92b6('0x40')],function(_0x327545){var _0x1250c3={};_0x1250c3[_0x327545]={'$like':'%'+_0x5d951e[_0x92b6('0x3d')][_0x92b6('0x49')]+'%'};return _0x1250c3;})});}_0x3bddaf=_['merge']({},_0x3bddaf,_0x5d951e[_0x92b6('0x4c')]);return _0x342126[_0x92b6('0x57')](_0x3bddaf);}})['then'](function(_0x2ec3b0){if(_0x2ec3b0){_0x2e080b=_0x2ec3b0[_0x92b6('0x52')];if(!_0x5d951e[_0x92b6('0x3d')][_0x92b6('0x42')](_0x92b6('0x43'))){_0x3bddaf[_0x92b6('0x2d')]=qs[_0x92b6('0x2d')](_0x5d951e[_0x92b6('0x3d')]['limit']);_0x3bddaf[_0x92b6('0x2c')]=qs[_0x92b6('0x2c')](_0x5d951e[_0x92b6('0x3d')][_0x92b6('0x2c')]);}return _0x342126['getConfigurations'](_0x3bddaf);}})[_0x92b6('0x33')](function(_0x54c4b4){if(_0x54c4b4){return _0x54c4b4?{'count':_0x2e080b,'rows':_0x54c4b4}:null;}})[_0x92b6('0x33')](respondWithResult(_0x313eef,null))['catch'](handleError(_0x313eef,null));};exports[_0x92b6('0x59')]=function(_0x4fcd49,_0x3e245c,_0x5cd985){if(_0x4fcd49[_0x92b6('0x55')]['id']){delete _0x4fcd49['body']['id'];}return db['VtigerAccount'][_0x92b6('0x58')]({'where':{'id':_0x4fcd49[_0x92b6('0x51')]['id']}})[_0x92b6('0x33')](handleEntityNotFound(_0x3e245c,null))[_0x92b6('0x33')](function(_0x54c602){if(_0x54c602){_0x4fcd49[_0x92b6('0x55')][_0x92b6('0x5a')]=_0x54c602['id'];_0x4fcd49[_0x92b6('0x55')][_0x92b6('0x5b')]=integrations[_0x92b6('0x5c')](_0x4fcd49[_0x92b6('0x55')]['channel'],_0x4fcd49[_0x92b6('0x55')][_0x92b6('0x39')]);_0x4fcd49[_0x92b6('0x55')][_0x92b6('0x5d')]=integrations[_0x92b6('0x5e')](_0x4fcd49[_0x92b6('0x55')][_0x92b6('0x5f')],_0x4fcd49['body']['type']);return db[_0x92b6('0x60')][_0x92b6('0x54')](_0x4fcd49['body'],{'include':[{'model':db[_0x92b6('0x61')],'as':'Subjects'},{'model':db[_0x92b6('0x61')],'as':_0x92b6('0x5d')}]});}return null;})[_0x92b6('0x33')](respondWithResult(_0x3e245c,null))[_0x92b6('0x27')](handleError(_0x3e245c,null));};var md5=require(_0x92b6('0x62'));exports[_0x92b6('0x63')]=function(_0x21a72f,_0x297b89,_0x4e910b){var _0x38390f=null;var _0x19e180=null;var _0x1218d4=null;var _0x27cf74=null;var _0x32bacf='';return db[_0x92b6('0x36')][_0x92b6('0x58')]({'where':{'id':_0x21a72f['params']['id']},'attributes':['id',_0x92b6('0x35'),_0x92b6('0x64'),'description',_0x92b6('0x65'),_0x92b6('0x66'),'serverUrl',_0x92b6('0x67')]})[_0x92b6('0x33')](handleEntityNotFound(_0x297b89,null))[_0x92b6('0x33')](function(_0x270d08){if(_0x270d08){_0x38390f=_0x270d08[_0x92b6('0x64')];_0x19e180=_0x270d08[_0x92b6('0x67')];_0x1218d4=_0x270d08[_0x92b6('0x65')];_0x32bacf=_0x270d08[_0x92b6('0x66')];var _0x3ce619=_0x32bacf['slice'](-0x1);if(_0x3ce619==='/'){_0x32bacf=_0x32bacf['substring'](0x0,_0x32bacf[_0x92b6('0x68')](_0x3ce619));}_0x27cf74=util[_0x92b6('0x69')](_0x92b6('0x6a'),_0x32bacf);var _0x56a0c5={'method':_0x92b6('0x6b'),'uri':_0x27cf74,'qs':{'operation':'getchallenge','username':_0x270d08[_0x92b6('0x64')]},'json':!![]};return rp(_0x56a0c5);}})['then'](function(_0x219260){if(_0x219260[_0x92b6('0x6c')]){var _0x4badc4={'method':_0x92b6('0x6d'),'uri':_0x27cf74,'form':{'operation':_0x92b6('0x6e'),'username':_0x38390f,'accessKey':md5(_0x219260[_0x92b6('0x26')]['token']+_0x19e180)},'json':!![]};return rp(_0x4badc4);}})[_0x92b6('0x33')](function(_0x1df17f){if(_0x1df17f[_0x92b6('0x6c')]){var _0x56a060={'method':_0x92b6('0x6b'),'uri':_0x27cf74,'qs':{'operation':_0x92b6('0x6f'),'username':_0x38390f,'sessionName':_0x1df17f[_0x92b6('0x26')]['sessionName'],'elementType':_0x1218d4},'json':!![]};return rp(_0x56a060);}})[_0x92b6('0x33')](function(_0x3cb434){if(_0x3cb434[_0x92b6('0x6c')]){var _0x8bd735=[_0x92b6('0x70'),'reference',_0x92b6('0x71')];_[_0x92b6('0x72')](_0x3cb434[_0x92b6('0x26')][_0x92b6('0x41')],function(_0x349840){return _0x8bd735[_0x92b6('0x73')](_0x349840[_0x92b6('0x39')][_0x92b6('0x35')]);});_[_0x92b6('0x72')](_0x3cb434['result'][_0x92b6('0x41')],function(_0x59bc5f){return _0x59bc5f[_0x92b6('0x74')]==='false';});return{'count':_0x3cb434['result'][_0x92b6('0x41')][_0x92b6('0x52')],'rows':_[_0x92b6('0x3c')](_0x3cb434[_0x92b6('0x26')]['fields'],function(_0x1c742b){return{'id':_0x1c742b[_0x92b6('0x35')],'name':_0x1c742b[_0x92b6('0x75')],'custom':_[_0x92b6('0x76')](_0x1c742b['name'],'cf_')?!![]:![],'options':_0x1c742b[_0x92b6('0x39')][_0x92b6('0x35')]===_0x92b6('0x77')&&_0x1c742b[_0x92b6('0x39')][_0x92b6('0x78')][_0x92b6('0x52')]>0x0?_[_0x92b6('0x3c')](_0x1c742b['type'][_0x92b6('0x78')],function(_0x593e57){return{'name':_0x593e57[_0x92b6('0x75')],'value':_0x593e57[_0x92b6('0x79')]};}):[]};})};}})[_0x92b6('0x33')](respondWithResult(_0x297b89,null))[_0x92b6('0x27')](function(_0x592be4){console[_0x92b6('0x7a')]('vTiger\x20error:\x20'+_0x592be4);var _0x2dcd58=_0x21a72f['query']['test']?0x1f4:_0x592be4['statusCode']||0x1f4;logger[_0x92b6('0x22')](_0x92b6('0x7b'),'getFields',_0x2dcd58,JSON['stringify'](_0x592be4));delete _0x592be4[_0x92b6('0x35')];if(_0x2dcd58===0x191){_0x2dcd58=0x190;}_0x297b89[_0x92b6('0x29')](_0x2dcd58)[_0x92b6('0x7c')](_0x21a72f[_0x92b6('0x3d')][_0x92b6('0x1b')]?{'message':_0x92b6('0x7d'),'statusCode':_0x592be4['statusCode']}:_0x592be4);});}; \ No newline at end of file +var _0x4758=['success','token','describe','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','jayson/promise','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','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','update','body','find','getConfigurations','findOne','keys','VtigerConfiguration','length','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','format','%s/webservice.php','getchallenge'];(function(_0x2c8f6c,_0x3bb8d7){var _0x24c438=function(_0xb5b2e){while(--_0xb5b2e){_0x2c8f6c['push'](_0x2c8f6c['shift']());}};_0x24c438(++_0x3bb8d7);}(_0x4758,0x114));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x8475('0x0'));var emlformat=require(_0x8475('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8475('0x2'));var rp=require(_0x8475('0x3'));var moment=require(_0x8475('0x4'));var BPromise=require(_0x8475('0x5'));var Mustache=require(_0x8475('0x6'));var util=require(_0x8475('0x7'));var path=require('path');var sox=require(_0x8475('0x8'));var csv=require(_0x8475('0x9'));var ejs=require(_0x8475('0xa'));var fs=require('fs');var _=require(_0x8475('0xb'));var squel=require('squel');var crypto=require(_0x8475('0xc'));var jsforce=require(_0x8475('0xd'));var deskjs=require(_0x8475('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8475('0xf'));var Papa=require(_0x8475('0x10'));var Redis=require(_0x8475('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8475('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8475('0x13'));var utils=require(_0x8475('0x14'));var config=require(_0x8475('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8475('0x16'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x88d0c8,_0x328e74,_0x1e7192){if(_0x1e7192){var _0x34326e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34326e['test'](_0x328e74)){return _0x88d0c8;}else{throw new db[(_0x8475('0x17'))]['ValidationError'](_0x8475('0x18'));}}else{return _0x88d0c8;}}function respondWithRpcPromise(_0x1a31d9,_0xf9cb24,_0x14d550,_0x3f5af3){return new BPromise(function(_0x5e8da4,_0x3179e3){var _0x22c1dc=_0x3f5af3||client;return _0x22c1dc[_0x8475('0x19')](_0x1a31d9,_0x14d550)['then'](function(_0xf7b359){logger['info']('VtigerAccount,\x20%s,\x20%s',_0xf9cb24,_0x8475('0x1a'));logger[_0x8475('0x1b')](_0x8475('0x1c'),_0xf9cb24,'request\x20sent',JSON['stringify'](_0xf7b359));if(_0xf7b359[_0x8475('0x1d')]){if(_0xf7b359['error']['code']===0x1f4){logger[_0x8475('0x1d')](_0x8475('0x1e'),_0xf9cb24,_0xf7b359[_0x8475('0x1d')][_0x8475('0x1f')]);return _0x3179e3(_0xf7b359[_0x8475('0x1d')][_0x8475('0x1f')]);}logger[_0x8475('0x1d')](_0x8475('0x1e'),_0xf9cb24,_0xf7b359[_0x8475('0x1d')]['message']);return _0x5e8da4(_0xf7b359[_0x8475('0x1d')][_0x8475('0x1f')]);}else{logger[_0x8475('0x20')](_0x8475('0x1e'),_0xf9cb24,_0x8475('0x1a'));_0x5e8da4(_0xf7b359[_0x8475('0x21')]['message']);}})[_0x8475('0x22')](function(_0x19526e){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xf9cb24,_0x19526e);_0x3179e3(_0x19526e);});});}function respondWithStatusCode(_0xfe20f6,_0x16192f){_0x16192f=_0x16192f||0xcc;return function(_0x532c4a){if(_0x532c4a){return _0xfe20f6['sendStatus'](_0x16192f);}return _0xfe20f6[_0x8475('0x23')](_0x16192f)[_0x8475('0x24')]();};}function respondWithResult(_0x37b4b8,_0x3f0705){_0x3f0705=_0x3f0705||0xc8;return function(_0xd9b460){if(_0xd9b460){return _0x37b4b8[_0x8475('0x23')](_0x3f0705)[_0x8475('0x25')](_0xd9b460);}};}function respondWithFilteredResult(_0x3398a9,_0x531aa9){return function(_0x36becb){if(_0x36becb){var _0x4a106d=_0x36becb[_0x8475('0x26')],_0x57dd93=_0x531aa9['offset'],_0x304228=_0x531aa9[_0x8475('0x27')]+_0x531aa9[_0x8475('0x28')],_0x14037f;if(_0x304228>=_0x4a106d){_0x304228=_0x4a106d;_0x14037f=0xc8;}else{_0x14037f=0xce;}_0x3398a9[_0x8475('0x23')](_0x14037f);return _0x3398a9['set'](_0x8475('0x29'),_0x57dd93+'-'+_0x304228+'/'+_0x4a106d)[_0x8475('0x25')](_0x36becb);}return null;};}function patchUpdates(_0x311dde){return function(_0x1e7629){try{jsonpatch['apply'](_0x1e7629,_0x311dde,!![]);}catch(_0xe51443){return BPromise[_0x8475('0x2a')](_0xe51443);}return _0x1e7629[_0x8475('0x2b')]();};}function saveUpdates(_0x581272,_0x580928){return function(_0x556190){if(_0x556190){return _0x556190['update'](_0x581272)[_0x8475('0x2c')](function(_0x320787){return _0x320787;});}return null;};}function removeEntity(_0x378714,_0x2af046){return function(_0x328c32){if(_0x328c32){return _0x328c32[_0x8475('0x2d')]()[_0x8475('0x2c')](function(){_0x378714[_0x8475('0x23')](0xcc)[_0x8475('0x24')]();});}};}function handleEntityNotFound(_0x361823,_0x2f5a28){return function(_0x3e2c79){if(!_0x3e2c79){_0x361823['sendStatus'](0x194);}return _0x3e2c79;};}function handleError(_0x571206,_0x2c53ff){_0x2c53ff=_0x2c53ff||0x1f4;return function(_0x5462ba){logger[_0x8475('0x1d')](_0x5462ba[_0x8475('0x2e')]);if(_0x5462ba['name']){delete _0x5462ba[_0x8475('0x2f')];}_0x571206[_0x8475('0x23')](_0x2c53ff)[_0x8475('0x30')](_0x5462ba);};}exports[_0x8475('0x31')]=function(_0x3da858,_0x5101c){var _0x58e300={},_0x45b129={},_0x469323={'count':0x0,'rows':[]};var _0x1d2554=_['map'](db[_0x8475('0x32')][_0x8475('0x33')],function(_0x17d51c){return{'name':_0x17d51c[_0x8475('0x34')],'type':_0x17d51c[_0x8475('0x35')][_0x8475('0x36')]};});_0x45b129['model']=_[_0x8475('0x37')](_0x1d2554,_0x8475('0x2f'));_0x45b129[_0x8475('0x38')]=_['keys'](_0x3da858[_0x8475('0x38')]);_0x45b129[_0x8475('0x39')]=_[_0x8475('0x3a')](_0x45b129[_0x8475('0x3b')],_0x45b129['query']);_0x58e300['attributes']=_['intersection'](_0x45b129['model'],qs['fields'](_0x3da858['query'][_0x8475('0x3c')]));_0x58e300[_0x8475('0x3d')]=_0x58e300['attributes']['length']?_0x58e300[_0x8475('0x3d')]:_0x45b129[_0x8475('0x3b')];if(!_0x3da858[_0x8475('0x38')][_0x8475('0x3e')](_0x8475('0x3f'))){_0x58e300[_0x8475('0x28')]=qs[_0x8475('0x28')](_0x3da858[_0x8475('0x38')][_0x8475('0x28')]);_0x58e300[_0x8475('0x27')]=qs[_0x8475('0x27')](_0x3da858[_0x8475('0x38')][_0x8475('0x27')]);}_0x58e300[_0x8475('0x40')]=qs[_0x8475('0x41')](_0x3da858[_0x8475('0x38')]['sort']);_0x58e300[_0x8475('0x42')]=qs['filters'](_['pick'](_0x3da858['query'],_0x45b129[_0x8475('0x39')]),_0x1d2554);if(_0x3da858[_0x8475('0x38')][_0x8475('0x43')]){_0x58e300[_0x8475('0x42')]=_[_0x8475('0x44')](_0x58e300[_0x8475('0x42')],{'$or':_[_0x8475('0x37')](_0x1d2554,function(_0x2582d2){if(_0x2582d2['type']!==_0x8475('0x45')){var _0x3f3ebc={};_0x3f3ebc[_0x2582d2[_0x8475('0x2f')]]={'$like':'%'+_0x3da858[_0x8475('0x38')][_0x8475('0x43')]+'%'};return _0x3f3ebc;}})});}_0x58e300=_['merge']({},_0x58e300,_0x3da858['options']);var _0x3909c9={'where':_0x58e300[_0x8475('0x42')]};return db[_0x8475('0x32')][_0x8475('0x26')](_0x3909c9)[_0x8475('0x2c')](function(_0x3de4c9){_0x469323[_0x8475('0x26')]=_0x3de4c9;if(_0x3da858['query'][_0x8475('0x46')]){_0x58e300[_0x8475('0x47')]=[{'all':!![]}];}return db[_0x8475('0x32')][_0x8475('0x48')](_0x58e300);})[_0x8475('0x2c')](function(_0x3aa51a){_0x469323[_0x8475('0x49')]=_0x3aa51a;return _0x469323;})[_0x8475('0x2c')](respondWithFilteredResult(_0x5101c,_0x58e300))[_0x8475('0x22')](handleError(_0x5101c,null));};exports[_0x8475('0x4a')]=function(_0x42c0eb,_0xf2dbf1){var _0x30dd63={'raw':![],'where':{'id':_0x42c0eb[_0x8475('0x4b')]['id']}},_0x4a6660={};_0x4a6660[_0x8475('0x3b')]=_['keys'](db['VtigerAccount']['rawAttributes']);_0x4a6660['query']=_['keys'](_0x42c0eb[_0x8475('0x38')]);_0x4a6660[_0x8475('0x39')]=_['intersection'](_0x4a6660['model'],_0x4a6660['query']);_0x30dd63['attributes']=_[_0x8475('0x3a')](_0x4a6660[_0x8475('0x3b')],qs['fields'](_0x42c0eb[_0x8475('0x38')][_0x8475('0x3c')]));_0x30dd63[_0x8475('0x3d')]=_0x30dd63[_0x8475('0x3d')]['length']?_0x30dd63[_0x8475('0x3d')]:_0x4a6660[_0x8475('0x3b')];if(_0x42c0eb['query'][_0x8475('0x46')]){_0x30dd63[_0x8475('0x47')]=[{'all':!![]}];}_0x30dd63=_[_0x8475('0x44')]({},_0x30dd63,_0x42c0eb[_0x8475('0x4c')]);return db[_0x8475('0x32')]['find'](_0x30dd63)[_0x8475('0x2c')](handleEntityNotFound(_0xf2dbf1,null))[_0x8475('0x2c')](respondWithResult(_0xf2dbf1,null))[_0x8475('0x22')](handleError(_0xf2dbf1,null));};exports[_0x8475('0x4d')]=function(_0x2dd812,_0x3ad3ab){return db[_0x8475('0x32')][_0x8475('0x4d')](_0x2dd812['body'],{})[_0x8475('0x2c')](respondWithResult(_0x3ad3ab,0xc9))[_0x8475('0x22')](handleError(_0x3ad3ab,null));};exports[_0x8475('0x4e')]=function(_0x509b4c,_0x8069e4){if(_0x509b4c[_0x8475('0x4f')]['id']){delete _0x509b4c[_0x8475('0x4f')]['id'];}return db['VtigerAccount'][_0x8475('0x50')]({'where':{'id':_0x509b4c[_0x8475('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8069e4,null))[_0x8475('0x2c')](saveUpdates(_0x509b4c[_0x8475('0x4f')],null))[_0x8475('0x2c')](respondWithResult(_0x8069e4,null))[_0x8475('0x22')](handleError(_0x8069e4,null));};exports[_0x8475('0x2d')]=function(_0xd3da10,_0x469172){return db[_0x8475('0x32')][_0x8475('0x50')]({'where':{'id':_0xd3da10[_0x8475('0x4b')]['id']}})[_0x8475('0x2c')](handleEntityNotFound(_0x469172,null))['then'](removeEntity(_0x469172,null))[_0x8475('0x22')](handleError(_0x469172,null));};exports[_0x8475('0x51')]=function(_0x20971f,_0x2c3281,_0x550342){var _0x590a24={};var _0x5969bb={};var _0xce58d5;var _0x34dd25;return db[_0x8475('0x32')][_0x8475('0x52')]({'where':{'id':_0x20971f['params']['id']}})[_0x8475('0x2c')](handleEntityNotFound(_0x2c3281,null))[_0x8475('0x2c')](function(_0x168ce4){if(_0x168ce4){_0xce58d5=_0x168ce4;_0x5969bb[_0x8475('0x3b')]=_[_0x8475('0x53')](db[_0x8475('0x54')][_0x8475('0x33')]);_0x5969bb[_0x8475('0x38')]=_[_0x8475('0x53')](_0x20971f[_0x8475('0x38')]);_0x5969bb[_0x8475('0x39')]=_[_0x8475('0x3a')](_0x5969bb[_0x8475('0x3b')],_0x5969bb[_0x8475('0x38')]);_0x590a24[_0x8475('0x3d')]=_[_0x8475('0x3a')](_0x5969bb[_0x8475('0x3b')],qs['fields'](_0x20971f[_0x8475('0x38')][_0x8475('0x3c')]));_0x590a24[_0x8475('0x3d')]=_0x590a24[_0x8475('0x3d')][_0x8475('0x55')]?_0x590a24[_0x8475('0x3d')]:_0x5969bb[_0x8475('0x3b')];_0x590a24['order']=qs[_0x8475('0x41')](_0x20971f[_0x8475('0x38')][_0x8475('0x41')]);_0x590a24['where']=qs[_0x8475('0x39')](_[_0x8475('0x56')](_0x20971f[_0x8475('0x38')],_0x5969bb['filters']));if(_0x20971f[_0x8475('0x38')]['filter']){_0x590a24[_0x8475('0x42')]=_[_0x8475('0x44')](_0x590a24[_0x8475('0x42')],{'$or':_[_0x8475('0x37')](_0x590a24[_0x8475('0x3d')],function(_0x29f6e8){var _0x589f37={};_0x589f37[_0x29f6e8]={'$like':'%'+_0x20971f[_0x8475('0x38')]['filter']+'%'};return _0x589f37;})});}_0x590a24=_['merge']({},_0x590a24,_0x20971f[_0x8475('0x4c')]);return _0xce58d5[_0x8475('0x51')](_0x590a24);}})[_0x8475('0x2c')](function(_0xaf41ba){if(_0xaf41ba){_0x34dd25=_0xaf41ba[_0x8475('0x55')];if(!_0x20971f[_0x8475('0x38')][_0x8475('0x3e')]('nolimit')){_0x590a24[_0x8475('0x28')]=qs[_0x8475('0x28')](_0x20971f[_0x8475('0x38')][_0x8475('0x28')]);_0x590a24[_0x8475('0x27')]=qs[_0x8475('0x27')](_0x20971f[_0x8475('0x38')][_0x8475('0x27')]);}return _0xce58d5[_0x8475('0x51')](_0x590a24);}})['then'](function(_0x501ec9){if(_0x501ec9){return _0x501ec9?{'count':_0x34dd25,'rows':_0x501ec9}:null;}})['then'](respondWithResult(_0x2c3281,null))[_0x8475('0x22')](handleError(_0x2c3281,null));};exports[_0x8475('0x57')]=function(_0x2e3928,_0x19f8b1,_0xfebaf2){if(_0x2e3928[_0x8475('0x4f')]['id']){delete _0x2e3928[_0x8475('0x4f')]['id'];}return db[_0x8475('0x32')][_0x8475('0x52')]({'where':{'id':_0x2e3928['params']['id']}})[_0x8475('0x2c')](handleEntityNotFound(_0x19f8b1,null))['then'](function(_0xfe2d9c){if(_0xfe2d9c){_0x2e3928[_0x8475('0x4f')]['AccountId']=_0xfe2d9c['id'];_0x2e3928[_0x8475('0x4f')][_0x8475('0x58')]=integrations[_0x8475('0x59')](_0x2e3928[_0x8475('0x4f')][_0x8475('0x5a')],_0x2e3928[_0x8475('0x4f')][_0x8475('0x35')]);_0x2e3928[_0x8475('0x4f')][_0x8475('0x5b')]=integrations['getDescriptions'](_0x2e3928[_0x8475('0x4f')][_0x8475('0x5a')],_0x2e3928[_0x8475('0x4f')][_0x8475('0x35')]);return db[_0x8475('0x54')]['create'](_0x2e3928[_0x8475('0x4f')],{'include':[{'model':db[_0x8475('0x5c')],'as':'Subjects'},{'model':db[_0x8475('0x5c')],'as':'Descriptions'}]});}return null;})[_0x8475('0x2c')](respondWithResult(_0x19f8b1,null))[_0x8475('0x22')](handleError(_0x19f8b1,null));};var md5=require(_0x8475('0x5d'));exports[_0x8475('0x5e')]=function(_0x583a8e,_0x4241de,_0x4d5278){var _0x43632a=null;var _0xb0e75=null;var _0x3100da=null;var _0x58e40e=null;var _0x2601bd='';return db[_0x8475('0x32')][_0x8475('0x52')]({'where':{'id':_0x583a8e[_0x8475('0x4b')]['id']},'attributes':['id',_0x8475('0x2f'),_0x8475('0x5f'),_0x8475('0x60'),_0x8475('0x61'),_0x8475('0x62'),'serverUrl',_0x8475('0x63')]})[_0x8475('0x2c')](handleEntityNotFound(_0x4241de,null))[_0x8475('0x2c')](function(_0x866022){if(_0x866022){_0x43632a=_0x866022[_0x8475('0x5f')];_0xb0e75=_0x866022['accessKey'];_0x3100da=_0x866022[_0x8475('0x61')];_0x2601bd=_0x866022['remoteUri'];var _0x525e43=_0x2601bd[_0x8475('0x64')](-0x1);if(_0x525e43==='/'){_0x2601bd=_0x2601bd[_0x8475('0x65')](0x0,_0x2601bd['lastIndexOf'](_0x525e43));}_0x58e40e=util[_0x8475('0x66')](_0x8475('0x67'),_0x2601bd);var _0x4fe467={'method':'GET','uri':_0x58e40e,'qs':{'operation':_0x8475('0x68'),'username':_0x866022[_0x8475('0x5f')]},'json':!![]};return rp(_0x4fe467);}})[_0x8475('0x2c')](function(_0x8d2a7c){if(_0x8d2a7c[_0x8475('0x69')]){var _0x382cb5={'method':'POST','uri':_0x58e40e,'form':{'operation':'login','username':_0x43632a,'accessKey':md5(_0x8d2a7c['result'][_0x8475('0x6a')]+_0xb0e75)},'json':!![]};return rp(_0x382cb5);}})[_0x8475('0x2c')](function(_0x39e7ab){if(_0x39e7ab['success']){var _0x3db94a={'method':'GET','uri':_0x58e40e,'qs':{'operation':_0x8475('0x6b'),'username':_0x43632a,'sessionName':_0x39e7ab[_0x8475('0x21')][_0x8475('0x6c')],'elementType':_0x3100da},'json':!![]};return rp(_0x3db94a);}})[_0x8475('0x2c')](function(_0x2c8ac2){if(_0x2c8ac2[_0x8475('0x69')]){var _0x54c8d3=['autogenerated',_0x8475('0x6d'),_0x8475('0x6e')];_[_0x8475('0x6f')](_0x2c8ac2[_0x8475('0x21')]['fields'],function(_0x497ffe){return _0x54c8d3[_0x8475('0x70')](_0x497ffe[_0x8475('0x35')]['name']);});_['remove'](_0x2c8ac2[_0x8475('0x21')]['fields'],function(_0x1493fe){return _0x1493fe[_0x8475('0x71')]===_0x8475('0x72');});return{'count':_0x2c8ac2[_0x8475('0x21')]['fields'][_0x8475('0x55')],'rows':_[_0x8475('0x37')](_0x2c8ac2[_0x8475('0x21')][_0x8475('0x3c')],function(_0x4e21d){return{'id':_0x4e21d[_0x8475('0x2f')],'name':_0x4e21d[_0x8475('0x73')],'custom':_[_0x8475('0x74')](_0x4e21d['name'],_0x8475('0x75'))?!![]:![],'options':_0x4e21d[_0x8475('0x35')][_0x8475('0x2f')]===_0x8475('0x76')&&_0x4e21d['type'][_0x8475('0x77')][_0x8475('0x55')]>0x0?_[_0x8475('0x37')](_0x4e21d[_0x8475('0x35')][_0x8475('0x77')],function(_0x156fe7){return{'name':_0x156fe7[_0x8475('0x73')],'value':_0x156fe7[_0x8475('0x78')]};}):[]};})};}})['then'](respondWithResult(_0x4241de,null))[_0x8475('0x22')](function(_0x57b386){console['log'](_0x8475('0x79')+_0x57b386);var _0x5870e3=_0x583a8e[_0x8475('0x38')][_0x8475('0x7a')]?0x1f4:_0x57b386[_0x8475('0x7b')]||0x1f4;logger['error'](_0x8475('0x7c'),_0x8475('0x5e'),_0x5870e3,JSON[_0x8475('0x7d')](_0x57b386));delete _0x57b386[_0x8475('0x2f')];if(_0x5870e3===0x191){_0x5870e3=0x190;}_0x4241de[_0x8475('0x23')](_0x5870e3)[_0x8475('0x30')](_0x583a8e['query']['test']?{'message':_0x8475('0x7e'),'statusCode':_0x57b386[_0x8475('0x7b')]}:_0x57b386);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 67e2b67..b9d8129 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 _0x6dfa=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../components/integrations/configuration','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6dfa,0x7b));var _0xa6df=function(_0xdb1622,_0x1192db){_0xdb1622=_0xdb1622-0x0;var _0x1ed1ba=_0x6dfa[_0xdb1622];return _0x1ed1ba;};'use strict';var _=require(_0xa6df('0x0'));var util=require(_0xa6df('0x1'));var logger=require(_0xa6df('0x2'))(_0xa6df('0x3'));var moment=require(_0xa6df('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6df('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa6df('0x7'));module[_0xa6df('0x8')]=function(_0x3299a2,_0x4721a5){return _0x3299a2[_0xa6df('0x9')](_0xa6df('0xa'),attributes,{'tableName':_0xa6df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe991=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2c32fb,_0x45b9a8){var _0x1f2836=function(_0x277504){while(--_0x277504){_0x2c32fb['push'](_0x2c32fb['shift']());}};_0x1f2836(++_0x45b9a8);}(_0xe991,0x92));var _0x1e99=function(_0x5760e8,_0x293b29){_0x5760e8=_0x5760e8-0x0;var _0x122e50=_0xe991[_0x5760e8];return _0x122e50;};'use strict';var _=require(_0x1e99('0x0'));var util=require(_0x1e99('0x1'));var logger=require('../../config/logger')(_0x1e99('0x2'));var moment=require(_0x1e99('0x3'));var BPromise=require(_0x1e99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e99('0x5'));var rimraf=require(_0x1e99('0x6'));var config=require(_0x1e99('0x7'));var attributes=require(_0x1e99('0x8'));var integrations=require(_0x1e99('0x9'));module[_0x1e99('0xa')]=function(_0xa56a31,_0x2ec4c9){return _0xa56a31[_0x1e99('0xb')](_0x1e99('0xc'),attributes,{'tableName':_0x1e99('0xd'),'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 39bee6a..1f84ca7 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 _0xd46e=['limit','include','model','map','VtigerAccount','where','then','ShowVtigerAccount','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVtigerAccount','findAll','options','raw','attributes'];(function(_0x23de7c,_0x54a7ec){var _0x1eff23=function(_0x59ab0e){while(--_0x59ab0e){_0x23de7c['push'](_0x23de7c['shift']());}};_0x1eff23(++_0x54a7ec);}(_0xd46e,0xc2));var _0xed46=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd46e[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0xed46('0x0'));var moment=require('moment');var BPromise=require(_0xed46('0x1'));var rs=require(_0xed46('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed46('0x3'))['db'];var utils=require(_0xed46('0x4'));var logger=require('../../config/logger')(_0xed46('0x5'));var config=require(_0xed46('0x6'));var jayson=require(_0xed46('0x7'));var client=jayson['client'][_0xed46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52ecf6,_0x24d1b0,_0x763e64){return new BPromise(function(_0x36cd78,_0x4d933){return client['request'](_0x52ecf6,_0x763e64)['then'](function(_0x11dda4){logger['info'](_0xed46('0x9'),_0x24d1b0,_0xed46('0xa'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x24d1b0,_0xed46('0xa'),JSON[_0xed46('0xb')](_0x11dda4));if(_0x11dda4[_0xed46('0xc')]){if(_0x11dda4[_0xed46('0xc')][_0xed46('0xd')]===0x1f4){logger[_0xed46('0xc')](_0xed46('0x9'),_0x24d1b0,_0x11dda4[_0xed46('0xc')][_0xed46('0xe')]);return _0x4d933(_0x11dda4['error'][_0xed46('0xe')]);}logger[_0xed46('0xc')](_0xed46('0x9'),_0x24d1b0,_0x11dda4[_0xed46('0xc')][_0xed46('0xe')]);return _0x36cd78(_0x11dda4['error'][_0xed46('0xe')]);}else{logger[_0xed46('0xf')](_0xed46('0x9'),_0x24d1b0,_0xed46('0xa'));_0x36cd78(_0x11dda4[_0xed46('0x10')]['message']);}})[_0xed46('0x11')](function(_0x34312e){logger[_0xed46('0xc')](_0xed46('0x9'),_0x24d1b0,_0x34312e);_0x4d933(_0x34312e);});});}exports[_0xed46('0x12')]=function(_0x2cd336){var _0x2750f7=this;return new Promise(function(_0x189066,_0x5c691d){return db['VtigerAccount'][_0xed46('0x13')]({'raw':_0x2cd336[_0xed46('0x14')]?_0x2cd336['options'][_0xed46('0x15')]===undefined?!![]:![]:!![],'where':_0x2cd336[_0xed46('0x14')]?_0x2cd336[_0xed46('0x14')]['where']||null:null,'attributes':_0x2cd336[_0xed46('0x14')]?_0x2cd336['options'][_0xed46('0x16')]||null:null,'limit':_0x2cd336[_0xed46('0x14')]?_0x2cd336[_0xed46('0x14')][_0xed46('0x17')]||null:null,'include':_0x2cd336['options']?_0x2cd336[_0xed46('0x14')][_0xed46('0x18')]?_['map'](_0x2cd336[_0xed46('0x14')][_0xed46('0x18')],function(_0x16a6e9){return{'model':db[_0x16a6e9[_0xed46('0x19')]],'as':_0x16a6e9['as'],'attributes':_0x16a6e9[_0xed46('0x16')],'include':_0x16a6e9[_0xed46('0x18')]?_[_0xed46('0x1a')](_0x16a6e9[_0xed46('0x18')],function(_0x3d80f8){return{'model':db[_0x3d80f8[_0xed46('0x19')]],'as':_0x3d80f8['as'],'attributes':_0x3d80f8[_0xed46('0x16')],'include':_0x3d80f8[_0xed46('0x18')]?_[_0xed46('0x1a')](_0x3d80f8[_0xed46('0x18')],function(_0x5c3d5b){return{'model':db[_0x5c3d5b['model']],'as':_0x5c3d5b['as'],'attributes':_0x5c3d5b[_0xed46('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9824){logger['info'](_0xed46('0x12'),_0x2cd336);logger['debug'](_0xed46('0x12'),_0x2cd336,JSON[_0xed46('0xb')](_0x5b9824));_0x189066(_0x5b9824);})[_0xed46('0x11')](function(_0x3ca8e5){logger['error'](_0xed46('0x12'),_0x3ca8e5[_0xed46('0xe')],_0x2cd336);_0x5c691d(_0x2750f7['error'](0x1f4,_0x3ca8e5[_0xed46('0xe')]));});});};exports['ShowVtigerAccount']=function(_0x4072c5){var _0x55845c=this;return new Promise(function(_0xe63ce6,_0x26d58b){return db[_0xed46('0x1b')]['find']({'raw':_0x4072c5[_0xed46('0x14')]?_0x4072c5[_0xed46('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4072c5['options']?_0x4072c5['options'][_0xed46('0x1c')]||null:null,'attributes':_0x4072c5[_0xed46('0x14')]?_0x4072c5['options'][_0xed46('0x16')]||null:null,'include':_0x4072c5[_0xed46('0x14')]?_0x4072c5[_0xed46('0x14')][_0xed46('0x18')]?_[_0xed46('0x1a')](_0x4072c5[_0xed46('0x14')]['include'],function(_0x14e31f){return{'model':db[_0x14e31f[_0xed46('0x19')]],'as':_0x14e31f['as'],'attributes':_0x14e31f[_0xed46('0x16')],'include':_0x14e31f[_0xed46('0x18')]?_[_0xed46('0x1a')](_0x14e31f[_0xed46('0x18')],function(_0x968641){return{'model':db[_0x968641[_0xed46('0x19')]],'as':_0x968641['as'],'attributes':_0x968641[_0xed46('0x16')],'include':_0x968641[_0xed46('0x18')]?_['map'](_0x968641[_0xed46('0x18')],function(_0x412e37){return{'model':db[_0x412e37[_0xed46('0x19')]],'as':_0x412e37['as'],'attributes':_0x412e37[_0xed46('0x16')]};}):[]};}):[]};}):[]:[]})[_0xed46('0x1d')](function(_0x5ee2d1){logger[_0xed46('0xf')](_0xed46('0x1e'),_0x4072c5);logger['debug']('ShowVtigerAccount',_0x4072c5,JSON[_0xed46('0xb')](_0x5ee2d1));_0xe63ce6(_0x5ee2d1);})['catch'](function(_0x2e69b2){logger[_0xed46('0xc')](_0xed46('0x1e'),_0x2e69b2[_0xed46('0xe')],_0x4072c5);_0x26d58b(_0x55845c[_0xed46('0xc')](0x1f4,_0x2e69b2[_0xed46('0xe')]));});});}; \ No newline at end of file +var _0xe882=['then','catch','ShowVtigerAccount','find','raw','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','limit','include','map','model','attributes'];(function(_0x5638b6,_0x17c055){var _0x8f9df6=function(_0xb6c4f9){while(--_0xb6c4f9){_0x5638b6['push'](_0x5638b6['shift']());}};_0x8f9df6(++_0x17c055);}(_0xe882,0x9f));var _0x2e88=function(_0x240fec,_0x37d6bc){_0x240fec=_0x240fec-0x0;var _0x4777b0=_0xe882[_0x240fec];return _0x4777b0;};'use strict';var _=require(_0x2e88('0x0'));var util=require(_0x2e88('0x1'));var moment=require(_0x2e88('0x2'));var BPromise=require(_0x2e88('0x3'));var rs=require(_0x2e88('0x4'));var fs=require('fs');var Redis=require(_0x2e88('0x5'));var db=require(_0x2e88('0x6'))['db'];var utils=require(_0x2e88('0x7'));var logger=require(_0x2e88('0x8'))('rpc');var config=require(_0x2e88('0x9'));var jayson=require(_0x2e88('0xa'));var client=jayson[_0x2e88('0xb')][_0x2e88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc995f,_0x36c66d,_0x37c05a){return new BPromise(function(_0x2a2efe,_0x1f24fe){return client[_0x2e88('0xd')](_0xc995f,_0x37c05a)['then'](function(_0x18e67c){logger[_0x2e88('0xe')](_0x2e88('0xf'),_0x36c66d,'request\x20sent');logger[_0x2e88('0x10')](_0x2e88('0x11'),_0x36c66d,_0x2e88('0x12'),JSON['stringify'](_0x18e67c));if(_0x18e67c['error']){if(_0x18e67c[_0x2e88('0x13')][_0x2e88('0x14')]===0x1f4){logger[_0x2e88('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x36c66d,_0x18e67c[_0x2e88('0x13')][_0x2e88('0x15')]);return _0x1f24fe(_0x18e67c[_0x2e88('0x13')][_0x2e88('0x15')]);}logger[_0x2e88('0x13')](_0x2e88('0xf'),_0x36c66d,_0x18e67c[_0x2e88('0x13')][_0x2e88('0x15')]);return _0x2a2efe(_0x18e67c['error']['message']);}else{logger[_0x2e88('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x36c66d,_0x2e88('0x12'));_0x2a2efe(_0x18e67c['result']['message']);}})['catch'](function(_0x42530d){logger[_0x2e88('0x13')](_0x2e88('0xf'),_0x36c66d,_0x42530d);_0x1f24fe(_0x42530d);});});}exports[_0x2e88('0x16')]=function(_0x478f8d){var _0x1a5327=this;return new Promise(function(_0x1d9d3d,_0x56e722){return db[_0x2e88('0x17')][_0x2e88('0x18')]({'raw':_0x478f8d[_0x2e88('0x19')]?_0x478f8d['options']['raw']===undefined?!![]:![]:!![],'where':_0x478f8d['options']?_0x478f8d[_0x2e88('0x19')]['where']||null:null,'attributes':_0x478f8d['options']?_0x478f8d[_0x2e88('0x19')]['attributes']||null:null,'limit':_0x478f8d[_0x2e88('0x19')]?_0x478f8d[_0x2e88('0x19')][_0x2e88('0x1a')]||null:null,'include':_0x478f8d['options']?_0x478f8d['options'][_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x478f8d[_0x2e88('0x19')]['include'],function(_0x2517c4){return{'model':db[_0x2517c4[_0x2e88('0x1d')]],'as':_0x2517c4['as'],'attributes':_0x2517c4[_0x2e88('0x1e')],'include':_0x2517c4[_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x2517c4[_0x2e88('0x1b')],function(_0x44ad99){return{'model':db[_0x44ad99[_0x2e88('0x1d')]],'as':_0x44ad99['as'],'attributes':_0x44ad99[_0x2e88('0x1e')],'include':_0x44ad99[_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x44ad99[_0x2e88('0x1b')],function(_0x390115){return{'model':db[_0x390115[_0x2e88('0x1d')]],'as':_0x390115['as'],'attributes':_0x390115[_0x2e88('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2e88('0x1f')](function(_0x3da415){logger['info'](_0x2e88('0x16'),_0x478f8d);logger['debug']('GetVtigerAccount',_0x478f8d,JSON['stringify'](_0x3da415));_0x1d9d3d(_0x3da415);})[_0x2e88('0x20')](function(_0x563ab5){logger[_0x2e88('0x13')](_0x2e88('0x16'),_0x563ab5[_0x2e88('0x15')],_0x478f8d);_0x56e722(_0x1a5327[_0x2e88('0x13')](0x1f4,_0x563ab5[_0x2e88('0x15')]));});});};exports[_0x2e88('0x21')]=function(_0x3cd7c2){var _0x5d0b51=this;return new Promise(function(_0x29bfd3,_0x19214e){return db[_0x2e88('0x17')][_0x2e88('0x22')]({'raw':_0x3cd7c2['options']?_0x3cd7c2['options'][_0x2e88('0x23')]===undefined?!![]:![]:!![],'where':_0x3cd7c2[_0x2e88('0x19')]?_0x3cd7c2[_0x2e88('0x19')][_0x2e88('0x24')]||null:null,'attributes':_0x3cd7c2[_0x2e88('0x19')]?_0x3cd7c2['options'][_0x2e88('0x1e')]||null:null,'include':_0x3cd7c2['options']?_0x3cd7c2['options'][_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x3cd7c2[_0x2e88('0x19')][_0x2e88('0x1b')],function(_0x1347b9){return{'model':db[_0x1347b9['model']],'as':_0x1347b9['as'],'attributes':_0x1347b9[_0x2e88('0x1e')],'include':_0x1347b9[_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x1347b9[_0x2e88('0x1b')],function(_0x49e605){return{'model':db[_0x49e605[_0x2e88('0x1d')]],'as':_0x49e605['as'],'attributes':_0x49e605[_0x2e88('0x1e')],'include':_0x49e605[_0x2e88('0x1b')]?_[_0x2e88('0x1c')](_0x49e605['include'],function(_0x50d32f){return{'model':db[_0x50d32f[_0x2e88('0x1d')]],'as':_0x50d32f['as'],'attributes':_0x50d32f[_0x2e88('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2e88('0x1f')](function(_0x4d45d8){logger[_0x2e88('0xe')]('ShowVtigerAccount',_0x3cd7c2);logger[_0x2e88('0x10')](_0x2e88('0x21'),_0x3cd7c2,JSON[_0x2e88('0x25')](_0x4d45d8));_0x29bfd3(_0x4d45d8);})['catch'](function(_0x44aa1f){logger[_0x2e88('0x13')]('ShowVtigerAccount',_0x44aa1f[_0x2e88('0x15')],_0x3cd7c2);_0x19214e(_0x5d0b51[_0x2e88('0x13')](0x1f4,_0x44aa1f[_0x2e88('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2c66cfc..84dbe13 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(_0x42d1f8,_0x22e529){var _0x40d234=function(_0xd59b57){while(--_0xd59b57){_0x42d1f8['push'](_0x42d1f8['shift']());}};_0x40d234(++_0x22e529);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/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 _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(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f9224d6..2f5d1f5 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 _0x6dc6=['exports','STRING','sequelize'];(function(_0x54af99,_0x72ba93){var _0x1edec3=function(_0x51d21e){while(--_0x51d21e){_0x54af99['push'](_0x54af99['shift']());}};_0x1edec3(++_0x72ba93);}(_0x6dc6,0xe3));var _0x66dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6dc6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x66dc('0x0'));module[_0x66dc('0x1')]={'name':{'type':Sequelize[_0x66dc('0x2')]},'description':{'type':Sequelize[_0x66dc('0x2')]}}; \ No newline at end of file +var _0x5f68=['exports','STRING','sequelize'];(function(_0x32d5ad,_0x548e93){var _0x47df3e=function(_0x4777d7){while(--_0x4777d7){_0x32d5ad['push'](_0x32d5ad['shift']());}};_0x47df3e(++_0x548e93);}(_0x5f68,0x18b));var _0x85f6=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x5f68[_0x3c40f4];return _0x1209d;};'use strict';var Sequelize=require(_0x85f6('0x0'));module[_0x85f6('0x1')]={'name':{'type':Sequelize[_0x85f6('0x2')]},'description':{'type':Sequelize[_0x85f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8d18d87..becd373 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 _0x77b4=['find','create','body','update','params','getFields','VtigerField','order','getSubjects','findOne','getDescriptions','html-pdf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','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','VtigerConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','count','offset','json','reject','end','sendStatus','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','keys','rawAttributes','includeAll','options'];(function(_0x3757b9,_0x46e5a6){var _0x45b91e=function(_0x3a2144){while(--_0x3a2144){_0x3757b9['push'](_0x3757b9['shift']());}};_0x45b91e(++_0x46e5a6);}(_0x77b4,0x1e1));var _0x477b=function(_0x4052f0,_0x3fefee){_0x4052f0=_0x4052f0-0x0;var _0x4469ea=_0x77b4[_0x4052f0];return _0x4469ea;};'use strict';var pdf=require(_0x477b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x477b('0x1'));var jsonpatch=require(_0x477b('0x2'));var rp=require('request-promise');var moment=require(_0x477b('0x3'));var BPromise=require(_0x477b('0x4'));var Mustache=require('mustache');var util=require(_0x477b('0x5'));var path=require(_0x477b('0x6'));var sox=require(_0x477b('0x7'));var csv=require(_0x477b('0x8'));var ejs=require(_0x477b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x477b('0xa'));var crypto=require(_0x477b('0xb'));var jsforce=require(_0x477b('0xc'));var deskjs=require(_0x477b('0xd'));var toCsv=require(_0x477b('0x8'));var querystring=require(_0x477b('0xe'));var Papa=require(_0x477b('0xf'));var Redis=require(_0x477b('0x10'));var authService=require(_0x477b('0x11'));var qs=require(_0x477b('0x12'));var as=require(_0x477b('0x13'));var hardwareService=require(_0x477b('0x14'));var logger=require(_0x477b('0x15'))(_0x477b('0x16'));var utils=require(_0x477b('0x17'));var config=require(_0x477b('0x18'));var db=require(_0x477b('0x19'))['db'];var jayson=require(_0x477b('0x1a'));var client=jayson['client'][_0x477b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4cf5d4,_0x518224,_0x4c1d4f){if(_0x4c1d4f){var _0x503f0b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x503f0b[_0x477b('0x1c')](_0x518224)){return _0x4cf5d4;}else{throw new db['Sequelize'][(_0x477b('0x1d'))](_0x477b('0x1e'));}}else{return _0x4cf5d4;}}function respondWithRpcPromise(_0x2e4149,_0x143f05,_0x215947,_0x48646e){return new BPromise(function(_0x382345,_0x883f2b){var _0x324d0f=_0x48646e||client;return _0x324d0f[_0x477b('0x1f')](_0x2e4149,_0x215947)[_0x477b('0x20')](function(_0x4b2a74){logger[_0x477b('0x21')](_0x477b('0x22'),_0x143f05,'request\x20sent');logger[_0x477b('0x23')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x143f05,'request\x20sent',JSON[_0x477b('0x24')](_0x4b2a74));if(_0x4b2a74[_0x477b('0x25')]){if(_0x4b2a74[_0x477b('0x25')][_0x477b('0x26')]===0x1f4){logger[_0x477b('0x25')](_0x477b('0x22'),_0x143f05,_0x4b2a74['error'][_0x477b('0x27')]);return _0x883f2b(_0x4b2a74[_0x477b('0x25')][_0x477b('0x27')]);}logger[_0x477b('0x25')](_0x477b('0x22'),_0x143f05,_0x4b2a74[_0x477b('0x25')]['message']);return _0x382345(_0x4b2a74['error'][_0x477b('0x27')]);}else{logger[_0x477b('0x21')](_0x477b('0x22'),_0x143f05,_0x477b('0x28'));_0x382345(_0x4b2a74[_0x477b('0x29')]['message']);}})[_0x477b('0x2a')](function(_0x1f885a){logger[_0x477b('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0x143f05,_0x1f885a);_0x883f2b(_0x1f885a);});});}function respondWithStatusCode(_0x12b179,_0x3b4f9d){_0x3b4f9d=_0x3b4f9d||0xcc;return function(_0x4fdcf9){if(_0x4fdcf9){return _0x12b179['sendStatus'](_0x3b4f9d);}return _0x12b179['status'](_0x3b4f9d)['end']();};}function respondWithResult(_0x59bb75,_0x4dc43e){_0x4dc43e=_0x4dc43e||0xc8;return function(_0x2adf55){if(_0x2adf55){return _0x59bb75[_0x477b('0x2b')](_0x4dc43e)['json'](_0x2adf55);}};}function respondWithFilteredResult(_0x524e15,_0x4eac35){return function(_0x1f2aa5){if(_0x1f2aa5){var _0x26a4ad=_0x1f2aa5[_0x477b('0x2c')],_0x421124=_0x4eac35[_0x477b('0x2d')],_0x58c7b2=_0x4eac35['offset']+_0x4eac35['limit'],_0x57a54c;if(_0x58c7b2>=_0x26a4ad){_0x58c7b2=_0x26a4ad;_0x57a54c=0xc8;}else{_0x57a54c=0xce;}_0x524e15[_0x477b('0x2b')](_0x57a54c);return _0x524e15['set']('Content-Range',_0x421124+'-'+_0x58c7b2+'/'+_0x26a4ad)[_0x477b('0x2e')](_0x1f2aa5);}return null;};}function patchUpdates(_0x8b4383){return function(_0x3c0975){try{jsonpatch['apply'](_0x3c0975,_0x8b4383,!![]);}catch(_0x5f34ef){return BPromise[_0x477b('0x2f')](_0x5f34ef);}return _0x3c0975['save']();};}function saveUpdates(_0x2e2590,_0x4f8507){return function(_0x43305a){if(_0x43305a){return _0x43305a['update'](_0x2e2590)[_0x477b('0x20')](function(_0x2b178c){return _0x2b178c;});}return null;};}function removeEntity(_0x1ae5cf,_0x3f96ec){return function(_0x133104){if(_0x133104){return _0x133104['destroy']()['then'](function(){_0x1ae5cf['status'](0xcc)[_0x477b('0x30')]();});}};}function handleEntityNotFound(_0x5cebf8,_0xfc34c7){return function(_0x535d0e){if(!_0x535d0e){_0x5cebf8[_0x477b('0x31')](0x194);}return _0x535d0e;};}function handleError(_0x5c1bcf,_0x49376d){_0x49376d=_0x49376d||0x1f4;return function(_0x450e7b){logger['error'](_0x450e7b[_0x477b('0x32')]);if(_0x450e7b[_0x477b('0x33')]){delete _0x450e7b['name'];}_0x5c1bcf[_0x477b('0x2b')](_0x49376d)[_0x477b('0x34')](_0x450e7b);};}exports[_0x477b('0x35')]=function(_0x5ae86f,_0x41430e){var _0x594382={},_0x327fec={},_0x4a2719={'count':0x0,'rows':[]};var _0x23ec72=_[_0x477b('0x36')](db[_0x477b('0x37')]['rawAttributes'],function(_0x3b95d8){return{'name':_0x3b95d8[_0x477b('0x38')],'type':_0x3b95d8[_0x477b('0x39')][_0x477b('0x3a')]};});_0x327fec[_0x477b('0x3b')]=_[_0x477b('0x36')](_0x23ec72,'name');_0x327fec['query']=_['keys'](_0x5ae86f[_0x477b('0x3c')]);_0x327fec[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x327fec['model'],_0x327fec[_0x477b('0x3c')]);_0x594382['attributes']=_[_0x477b('0x3e')](_0x327fec['model'],qs[_0x477b('0x3f')](_0x5ae86f[_0x477b('0x3c')][_0x477b('0x3f')]));_0x594382[_0x477b('0x40')]=_0x594382[_0x477b('0x40')][_0x477b('0x41')]?_0x594382['attributes']:_0x327fec[_0x477b('0x3b')];if(!_0x5ae86f[_0x477b('0x3c')][_0x477b('0x42')](_0x477b('0x43'))){_0x594382[_0x477b('0x44')]=qs['limit'](_0x5ae86f[_0x477b('0x3c')][_0x477b('0x44')]);_0x594382[_0x477b('0x2d')]=qs[_0x477b('0x2d')](_0x5ae86f['query'][_0x477b('0x2d')]);}_0x594382['order']=qs[_0x477b('0x45')](_0x5ae86f['query'][_0x477b('0x45')]);_0x594382[_0x477b('0x46')]=qs[_0x477b('0x3d')](_[_0x477b('0x47')](_0x5ae86f[_0x477b('0x3c')],_0x327fec[_0x477b('0x3d')]),_0x23ec72);if(_0x5ae86f[_0x477b('0x3c')][_0x477b('0x48')]){_0x594382[_0x477b('0x46')]=_[_0x477b('0x49')](_0x594382[_0x477b('0x46')],{'$or':_[_0x477b('0x36')](_0x23ec72,function(_0x297bcf){if(_0x297bcf['type']!==_0x477b('0x4a')){var _0x3bd256={};_0x3bd256[_0x297bcf[_0x477b('0x33')]]={'$like':'%'+_0x5ae86f['query'][_0x477b('0x48')]+'%'};return _0x3bd256;}})});}_0x594382=_[_0x477b('0x49')]({},_0x594382,_0x5ae86f['options']);var _0x42e372={'where':_0x594382['where']};return db[_0x477b('0x37')][_0x477b('0x2c')](_0x42e372)['then'](function(_0x1e8116){_0x4a2719[_0x477b('0x2c')]=_0x1e8116;if(_0x5ae86f['query']['includeAll']){_0x594382[_0x477b('0x4b')]=[{'all':!![]}];}return db[_0x477b('0x37')][_0x477b('0x4c')](_0x594382);})[_0x477b('0x20')](function(_0x44b642){_0x4a2719[_0x477b('0x4d')]=_0x44b642;return _0x4a2719;})[_0x477b('0x20')](respondWithFilteredResult(_0x41430e,_0x594382))[_0x477b('0x2a')](handleError(_0x41430e,null));};exports[_0x477b('0x4e')]=function(_0xa3aac2,_0x3dac46){var _0x3353cc={'raw':![],'where':{'id':_0xa3aac2['params']['id']}},_0x129832={};_0x129832[_0x477b('0x3b')]=_[_0x477b('0x4f')](db['VtigerConfiguration'][_0x477b('0x50')]);_0x129832['query']=_['keys'](_0xa3aac2[_0x477b('0x3c')]);_0x129832[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x129832['model'],_0x129832[_0x477b('0x3c')]);_0x3353cc['attributes']=_[_0x477b('0x3e')](_0x129832[_0x477b('0x3b')],qs[_0x477b('0x3f')](_0xa3aac2[_0x477b('0x3c')]['fields']));_0x3353cc[_0x477b('0x40')]=_0x3353cc[_0x477b('0x40')][_0x477b('0x41')]?_0x3353cc[_0x477b('0x40')]:_0x129832[_0x477b('0x3b')];if(_0xa3aac2[_0x477b('0x3c')][_0x477b('0x51')]){_0x3353cc['include']=[{'all':!![]}];}_0x3353cc=_[_0x477b('0x49')]({},_0x3353cc,_0xa3aac2[_0x477b('0x52')]);return db['VtigerConfiguration'][_0x477b('0x53')](_0x3353cc)['then'](handleEntityNotFound(_0x3dac46,null))['then'](respondWithResult(_0x3dac46,null))[_0x477b('0x2a')](handleError(_0x3dac46,null));};exports[_0x477b('0x54')]=function(_0x569e73,_0x36595e){return db[_0x477b('0x37')][_0x477b('0x54')](_0x569e73[_0x477b('0x55')],{})[_0x477b('0x20')](respondWithResult(_0x36595e,0xc9))['catch'](handleError(_0x36595e,null));};exports[_0x477b('0x56')]=function(_0xbdc32f,_0x5ba98f){if(_0xbdc32f[_0x477b('0x55')]['id']){delete _0xbdc32f['body']['id'];}return db[_0x477b('0x37')]['find']({'where':{'id':_0xbdc32f[_0x477b('0x57')]['id']}})[_0x477b('0x20')](handleEntityNotFound(_0x5ba98f,null))[_0x477b('0x20')](saveUpdates(_0xbdc32f[_0x477b('0x55')],null))[_0x477b('0x20')](respondWithResult(_0x5ba98f,null))[_0x477b('0x2a')](handleError(_0x5ba98f,null));};exports['destroy']=function(_0x367187,_0x2046ff){return db[_0x477b('0x37')][_0x477b('0x53')]({'where':{'id':_0x367187['params']['id']}})['then'](handleEntityNotFound(_0x2046ff,null))[_0x477b('0x20')](removeEntity(_0x2046ff,null))['catch'](handleError(_0x2046ff,null));};exports[_0x477b('0x58')]=function(_0x5389db,_0x315f2c,_0x31e3a2){var _0x2137fe={};var _0x56b46b={};var _0x3022c1;var _0x467d79;return db[_0x477b('0x37')]['findOne']({'where':{'id':_0x5389db[_0x477b('0x57')]['id']}})[_0x477b('0x20')](handleEntityNotFound(_0x315f2c,null))[_0x477b('0x20')](function(_0x3f78d8){if(_0x3f78d8){_0x3022c1=_0x3f78d8;_0x56b46b[_0x477b('0x3b')]=_[_0x477b('0x4f')](db[_0x477b('0x59')][_0x477b('0x50')]);_0x56b46b['query']=_[_0x477b('0x4f')](_0x5389db[_0x477b('0x3c')]);_0x56b46b[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x56b46b[_0x477b('0x3b')],_0x56b46b[_0x477b('0x3c')]);_0x2137fe['attributes']=_[_0x477b('0x3e')](_0x56b46b[_0x477b('0x3b')],qs[_0x477b('0x3f')](_0x5389db['query']['fields']));_0x2137fe[_0x477b('0x40')]=_0x2137fe[_0x477b('0x40')][_0x477b('0x41')]?_0x2137fe['attributes']:_0x56b46b[_0x477b('0x3b')];_0x2137fe[_0x477b('0x5a')]=qs[_0x477b('0x45')](_0x5389db[_0x477b('0x3c')][_0x477b('0x45')]);_0x2137fe[_0x477b('0x46')]=qs[_0x477b('0x3d')](_[_0x477b('0x47')](_0x5389db[_0x477b('0x3c')],_0x56b46b[_0x477b('0x3d')]));if(_0x5389db[_0x477b('0x3c')]['filter']){_0x2137fe[_0x477b('0x46')]=_[_0x477b('0x49')](_0x2137fe[_0x477b('0x46')],{'$or':_[_0x477b('0x36')](_0x2137fe[_0x477b('0x40')],function(_0x368bcd){var _0x1c3dca={};_0x1c3dca[_0x368bcd]={'$like':'%'+_0x5389db['query'][_0x477b('0x48')]+'%'};return _0x1c3dca;})});}_0x2137fe=_[_0x477b('0x49')]({},_0x2137fe,_0x5389db[_0x477b('0x52')]);return _0x3022c1[_0x477b('0x58')](_0x2137fe);}})[_0x477b('0x20')](function(_0x51064f){if(_0x51064f){_0x467d79=_0x51064f[_0x477b('0x41')];if(!_0x5389db[_0x477b('0x3c')]['hasOwnProperty'](_0x477b('0x43'))){_0x2137fe[_0x477b('0x44')]=qs[_0x477b('0x44')](_0x5389db[_0x477b('0x3c')][_0x477b('0x44')]);_0x2137fe[_0x477b('0x2d')]=qs[_0x477b('0x2d')](_0x5389db[_0x477b('0x3c')][_0x477b('0x2d')]);}return _0x3022c1[_0x477b('0x58')](_0x2137fe);}})[_0x477b('0x20')](function(_0x4aba6a){if(_0x4aba6a){return _0x4aba6a?{'count':_0x467d79,'rows':_0x4aba6a}:null;}})['then'](respondWithResult(_0x315f2c,null))[_0x477b('0x2a')](handleError(_0x315f2c,null));};exports[_0x477b('0x5b')]=function(_0x3ed1aa,_0x565aa4,_0x3af3e9){var _0x7b9153={};var _0x2d03b0={};var _0x20e1c3;var _0x442da9;return db['VtigerConfiguration'][_0x477b('0x5c')]({'where':{'id':_0x3ed1aa[_0x477b('0x57')]['id']}})[_0x477b('0x20')](handleEntityNotFound(_0x565aa4,null))[_0x477b('0x20')](function(_0x4940d5){if(_0x4940d5){_0x20e1c3=_0x4940d5;_0x2d03b0[_0x477b('0x3b')]=_[_0x477b('0x4f')](db[_0x477b('0x59')][_0x477b('0x50')]);_0x2d03b0[_0x477b('0x3c')]=_['keys'](_0x3ed1aa[_0x477b('0x3c')]);_0x2d03b0[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x2d03b0['model'],_0x2d03b0[_0x477b('0x3c')]);_0x7b9153['attributes']=_[_0x477b('0x3e')](_0x2d03b0[_0x477b('0x3b')],qs['fields'](_0x3ed1aa['query']['fields']));_0x7b9153['attributes']=_0x7b9153[_0x477b('0x40')][_0x477b('0x41')]?_0x7b9153[_0x477b('0x40')]:_0x2d03b0[_0x477b('0x3b')];_0x7b9153[_0x477b('0x5a')]=qs['sort'](_0x3ed1aa['query']['sort']);_0x7b9153[_0x477b('0x46')]=qs['filters'](_[_0x477b('0x47')](_0x3ed1aa['query'],_0x2d03b0[_0x477b('0x3d')]));if(_0x3ed1aa[_0x477b('0x3c')][_0x477b('0x48')]){_0x7b9153[_0x477b('0x46')]=_[_0x477b('0x49')](_0x7b9153['where'],{'$or':_['map'](_0x7b9153[_0x477b('0x40')],function(_0x802f01){var _0x3a1ef1={};_0x3a1ef1[_0x802f01]={'$like':'%'+_0x3ed1aa[_0x477b('0x3c')][_0x477b('0x48')]+'%'};return _0x3a1ef1;})});}_0x7b9153=_['merge']({},_0x7b9153,_0x3ed1aa['options']);return _0x20e1c3['getSubjects'](_0x7b9153);}})[_0x477b('0x20')](function(_0x25bbb2){if(_0x25bbb2){_0x442da9=_0x25bbb2['length'];if(!_0x3ed1aa['query'][_0x477b('0x42')](_0x477b('0x43'))){_0x7b9153['limit']=qs['limit'](_0x3ed1aa['query'][_0x477b('0x44')]);_0x7b9153[_0x477b('0x2d')]=qs[_0x477b('0x2d')](_0x3ed1aa[_0x477b('0x3c')][_0x477b('0x2d')]);}return _0x20e1c3[_0x477b('0x5b')](_0x7b9153);}})[_0x477b('0x20')](function(_0x4057bd){if(_0x4057bd){return _0x4057bd?{'count':_0x442da9,'rows':_0x4057bd}:null;}})[_0x477b('0x20')](respondWithResult(_0x565aa4,null))[_0x477b('0x2a')](handleError(_0x565aa4,null));};exports[_0x477b('0x5d')]=function(_0x14f688,_0x600a,_0x2c45b1){var _0x3461e6={};var _0x69a311={};var _0x56949c;var _0x3b0b43;return db[_0x477b('0x37')][_0x477b('0x5c')]({'where':{'id':_0x14f688[_0x477b('0x57')]['id']}})['then'](handleEntityNotFound(_0x600a,null))[_0x477b('0x20')](function(_0x147462){if(_0x147462){_0x56949c=_0x147462;_0x69a311[_0x477b('0x3b')]=_[_0x477b('0x4f')](db[_0x477b('0x59')][_0x477b('0x50')]);_0x69a311[_0x477b('0x3c')]=_[_0x477b('0x4f')](_0x14f688[_0x477b('0x3c')]);_0x69a311['filters']=_[_0x477b('0x3e')](_0x69a311[_0x477b('0x3b')],_0x69a311[_0x477b('0x3c')]);_0x3461e6[_0x477b('0x40')]=_[_0x477b('0x3e')](_0x69a311[_0x477b('0x3b')],qs[_0x477b('0x3f')](_0x14f688[_0x477b('0x3c')]['fields']));_0x3461e6['attributes']=_0x3461e6[_0x477b('0x40')]['length']?_0x3461e6[_0x477b('0x40')]:_0x69a311[_0x477b('0x3b')];_0x3461e6[_0x477b('0x5a')]=qs[_0x477b('0x45')](_0x14f688[_0x477b('0x3c')][_0x477b('0x45')]);_0x3461e6[_0x477b('0x46')]=qs[_0x477b('0x3d')](_[_0x477b('0x47')](_0x14f688[_0x477b('0x3c')],_0x69a311[_0x477b('0x3d')]));if(_0x14f688[_0x477b('0x3c')][_0x477b('0x48')]){_0x3461e6['where']=_[_0x477b('0x49')](_0x3461e6[_0x477b('0x46')],{'$or':_[_0x477b('0x36')](_0x3461e6[_0x477b('0x40')],function(_0x44d63a){var _0xd2d8fd={};_0xd2d8fd[_0x44d63a]={'$like':'%'+_0x14f688['query'][_0x477b('0x48')]+'%'};return _0xd2d8fd;})});}_0x3461e6=_['merge']({},_0x3461e6,_0x14f688[_0x477b('0x52')]);return _0x56949c[_0x477b('0x5d')](_0x3461e6);}})[_0x477b('0x20')](function(_0x2fc658){if(_0x2fc658){_0x3b0b43=_0x2fc658[_0x477b('0x41')];if(!_0x14f688[_0x477b('0x3c')][_0x477b('0x42')](_0x477b('0x43'))){_0x3461e6[_0x477b('0x44')]=qs[_0x477b('0x44')](_0x14f688[_0x477b('0x3c')]['limit']);_0x3461e6[_0x477b('0x2d')]=qs[_0x477b('0x2d')](_0x14f688[_0x477b('0x3c')][_0x477b('0x2d')]);}return _0x56949c[_0x477b('0x5d')](_0x3461e6);}})[_0x477b('0x20')](function(_0x576fe2){if(_0x576fe2){return _0x576fe2?{'count':_0x3b0b43,'rows':_0x576fe2}:null;}})[_0x477b('0x20')](respondWithResult(_0x600a,null))[_0x477b('0x2a')](handleError(_0x600a,null));}; \ No newline at end of file +var _0x04ea=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','params','rawAttributes','length','includeAll','find','create','body','update','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','destroy','stack','name','index','map','VtigerConfiguration','fieldName','type'];(function(_0x21b246,_0x304cda){var _0x17d390=function(_0x221563){while(--_0x221563){_0x21b246['push'](_0x21b246['shift']());}};_0x17d390(++_0x304cda);}(_0x04ea,0xe1));var _0xa04e=function(_0x1e3c2f,_0x53b8d1){_0x1e3c2f=_0x1e3c2f-0x0;var _0x40ac24=_0x04ea[_0x1e3c2f];return _0x40ac24;};'use strict';var pdf=require(_0xa04e('0x0'));var emlformat=require(_0xa04e('0x1'));var rimraf=require(_0xa04e('0x2'));var zipdir=require(_0xa04e('0x3'));var jsonpatch=require(_0xa04e('0x4'));var rp=require(_0xa04e('0x5'));var moment=require(_0xa04e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa04e('0x7'));var util=require(_0xa04e('0x8'));var path=require(_0xa04e('0x9'));var sox=require(_0xa04e('0xa'));var csv=require(_0xa04e('0xb'));var ejs=require(_0xa04e('0xc'));var fs=require('fs');var _=require(_0xa04e('0xd'));var squel=require(_0xa04e('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa04e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa04e('0x10'));var Redis=require(_0xa04e('0x11'));var authService=require(_0xa04e('0x12'));var qs=require(_0xa04e('0x13'));var as=require(_0xa04e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa04e('0x15'))('api');var utils=require(_0xa04e('0x16'));var config=require(_0xa04e('0x17'));var db=require(_0xa04e('0x18'))['db'];var jayson=require(_0xa04e('0x19'));var client=jayson[_0xa04e('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x11520f,_0x19f205,_0x21a83f){if(_0x21a83f){var _0x312780=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x312780[_0xa04e('0x1b')](_0x19f205)){return _0x11520f;}else{throw new db[(_0xa04e('0x1c'))][(_0xa04e('0x1d'))](_0xa04e('0x1e'));}}else{return _0x11520f;}}function respondWithRpcPromise(_0x22f423,_0x3f0edf,_0x1afdaf,_0x3b05af){return new BPromise(function(_0x395077,_0xc2d811){var _0x1787d7=_0x3b05af||client;return _0x1787d7[_0xa04e('0x1f')](_0x22f423,_0x1afdaf)[_0xa04e('0x20')](function(_0x4b0142){logger['info'](_0xa04e('0x21'),_0x3f0edf,_0xa04e('0x22'));logger[_0xa04e('0x23')](_0xa04e('0x24'),_0x3f0edf,_0xa04e('0x22'),JSON[_0xa04e('0x25')](_0x4b0142));if(_0x4b0142['error']){if(_0x4b0142[_0xa04e('0x26')][_0xa04e('0x27')]===0x1f4){logger['error'](_0xa04e('0x21'),_0x3f0edf,_0x4b0142[_0xa04e('0x26')][_0xa04e('0x28')]);return _0xc2d811(_0x4b0142['error'][_0xa04e('0x28')]);}logger[_0xa04e('0x26')](_0xa04e('0x21'),_0x3f0edf,_0x4b0142[_0xa04e('0x26')][_0xa04e('0x28')]);return _0x395077(_0x4b0142['error']['message']);}else{logger[_0xa04e('0x29')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0edf,_0xa04e('0x22'));_0x395077(_0x4b0142[_0xa04e('0x2a')][_0xa04e('0x28')]);}})[_0xa04e('0x2b')](function(_0x7d93a2){logger[_0xa04e('0x26')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0edf,_0x7d93a2);_0xc2d811(_0x7d93a2);});});}function respondWithStatusCode(_0x5150fc,_0x4296d6){_0x4296d6=_0x4296d6||0xcc;return function(_0x1fb86a){if(_0x1fb86a){return _0x5150fc[_0xa04e('0x2c')](_0x4296d6);}return _0x5150fc[_0xa04e('0x2d')](_0x4296d6)[_0xa04e('0x2e')]();};}function respondWithResult(_0x3452f4,_0xdc78e){_0xdc78e=_0xdc78e||0xc8;return function(_0x279f26){if(_0x279f26){return _0x3452f4[_0xa04e('0x2d')](_0xdc78e)['json'](_0x279f26);}};}function respondWithFilteredResult(_0x24552b,_0x193a1e){return function(_0x43c50e){if(_0x43c50e){var _0x5ba409=_0x43c50e[_0xa04e('0x2f')],_0x1803cd=_0x193a1e[_0xa04e('0x30')],_0x23d45c=_0x193a1e[_0xa04e('0x30')]+_0x193a1e[_0xa04e('0x31')],_0xf179ea;if(_0x23d45c>=_0x5ba409){_0x23d45c=_0x5ba409;_0xf179ea=0xc8;}else{_0xf179ea=0xce;}_0x24552b[_0xa04e('0x2d')](_0xf179ea);return _0x24552b[_0xa04e('0x32')]('Content-Range',_0x1803cd+'-'+_0x23d45c+'/'+_0x5ba409)[_0xa04e('0x33')](_0x43c50e);}return null;};}function patchUpdates(_0x36fa91){return function(_0x261bd9){try{jsonpatch[_0xa04e('0x34')](_0x261bd9,_0x36fa91,!![]);}catch(_0x2683ba){return BPromise[_0xa04e('0x35')](_0x2683ba);}return _0x261bd9[_0xa04e('0x36')]();};}function saveUpdates(_0x5761fa,_0x559a05){return function(_0x340816){if(_0x340816){return _0x340816['update'](_0x5761fa)[_0xa04e('0x20')](function(_0x400c7c){return _0x400c7c;});}return null;};}function removeEntity(_0x199a5b,_0xb11031){return function(_0x58a3bb){if(_0x58a3bb){return _0x58a3bb[_0xa04e('0x37')]()['then'](function(){_0x199a5b[_0xa04e('0x2d')](0xcc)[_0xa04e('0x2e')]();});}};}function handleEntityNotFound(_0x486f60,_0x4f2a51){return function(_0x36a75e){if(!_0x36a75e){_0x486f60[_0xa04e('0x2c')](0x194);}return _0x36a75e;};}function handleError(_0x583561,_0x49248d){_0x49248d=_0x49248d||0x1f4;return function(_0x5f69e){logger[_0xa04e('0x26')](_0x5f69e[_0xa04e('0x38')]);if(_0x5f69e[_0xa04e('0x39')]){delete _0x5f69e['name'];}_0x583561[_0xa04e('0x2d')](_0x49248d)['send'](_0x5f69e);};}exports[_0xa04e('0x3a')]=function(_0x1a5510,_0x1f504a){var _0x58dd68={},_0x4dbb1c={},_0x633928={'count':0x0,'rows':[]};var _0x136691=_[_0xa04e('0x3b')](db[_0xa04e('0x3c')]['rawAttributes'],function(_0x183267){return{'name':_0x183267[_0xa04e('0x3d')],'type':_0x183267[_0xa04e('0x3e')][_0xa04e('0x3f')]};});_0x4dbb1c[_0xa04e('0x40')]=_[_0xa04e('0x3b')](_0x136691,_0xa04e('0x39'));_0x4dbb1c[_0xa04e('0x41')]=_[_0xa04e('0x42')](_0x1a5510[_0xa04e('0x41')]);_0x4dbb1c[_0xa04e('0x43')]=_[_0xa04e('0x44')](_0x4dbb1c[_0xa04e('0x40')],_0x4dbb1c['query']);_0x58dd68['attributes']=_[_0xa04e('0x44')](_0x4dbb1c[_0xa04e('0x40')],qs['fields'](_0x1a5510[_0xa04e('0x41')][_0xa04e('0x45')]));_0x58dd68[_0xa04e('0x46')]=_0x58dd68[_0xa04e('0x46')]['length']?_0x58dd68[_0xa04e('0x46')]:_0x4dbb1c['model'];if(!_0x1a5510[_0xa04e('0x41')][_0xa04e('0x47')](_0xa04e('0x48'))){_0x58dd68[_0xa04e('0x31')]=qs[_0xa04e('0x31')](_0x1a5510['query'][_0xa04e('0x31')]);_0x58dd68[_0xa04e('0x30')]=qs[_0xa04e('0x30')](_0x1a5510['query'][_0xa04e('0x30')]);}_0x58dd68['order']=qs[_0xa04e('0x49')](_0x1a5510['query'][_0xa04e('0x49')]);_0x58dd68['where']=qs[_0xa04e('0x43')](_[_0xa04e('0x4a')](_0x1a5510['query'],_0x4dbb1c['filters']),_0x136691);if(_0x1a5510[_0xa04e('0x41')][_0xa04e('0x4b')]){_0x58dd68[_0xa04e('0x4c')]=_[_0xa04e('0x4d')](_0x58dd68['where'],{'$or':_[_0xa04e('0x3b')](_0x136691,function(_0x26b7f8){if(_0x26b7f8[_0xa04e('0x3e')]!==_0xa04e('0x4e')){var _0x21ebed={};_0x21ebed[_0x26b7f8['name']]={'$like':'%'+_0x1a5510['query'][_0xa04e('0x4b')]+'%'};return _0x21ebed;}})});}_0x58dd68=_[_0xa04e('0x4d')]({},_0x58dd68,_0x1a5510[_0xa04e('0x4f')]);var _0x53321a={'where':_0x58dd68[_0xa04e('0x4c')]};return db[_0xa04e('0x3c')][_0xa04e('0x2f')](_0x53321a)['then'](function(_0x7a6c03){_0x633928['count']=_0x7a6c03;if(_0x1a5510['query']['includeAll']){_0x58dd68[_0xa04e('0x50')]=[{'all':!![]}];}return db[_0xa04e('0x3c')][_0xa04e('0x51')](_0x58dd68);})[_0xa04e('0x20')](function(_0x179f93){_0x633928['rows']=_0x179f93;return _0x633928;})[_0xa04e('0x20')](respondWithFilteredResult(_0x1f504a,_0x58dd68))[_0xa04e('0x2b')](handleError(_0x1f504a,null));};exports['show']=function(_0x2570e8,_0x52e897){var _0x1359f8={'raw':![],'where':{'id':_0x2570e8[_0xa04e('0x52')]['id']}},_0xb86644={};_0xb86644[_0xa04e('0x40')]=_[_0xa04e('0x42')](db[_0xa04e('0x3c')][_0xa04e('0x53')]);_0xb86644['query']=_[_0xa04e('0x42')](_0x2570e8['query']);_0xb86644[_0xa04e('0x43')]=_[_0xa04e('0x44')](_0xb86644['model'],_0xb86644[_0xa04e('0x41')]);_0x1359f8[_0xa04e('0x46')]=_[_0xa04e('0x44')](_0xb86644['model'],qs['fields'](_0x2570e8[_0xa04e('0x41')][_0xa04e('0x45')]));_0x1359f8[_0xa04e('0x46')]=_0x1359f8[_0xa04e('0x46')][_0xa04e('0x54')]?_0x1359f8[_0xa04e('0x46')]:_0xb86644[_0xa04e('0x40')];if(_0x2570e8['query'][_0xa04e('0x55')]){_0x1359f8['include']=[{'all':!![]}];}_0x1359f8=_[_0xa04e('0x4d')]({},_0x1359f8,_0x2570e8['options']);return db['VtigerConfiguration'][_0xa04e('0x56')](_0x1359f8)[_0xa04e('0x20')](handleEntityNotFound(_0x52e897,null))[_0xa04e('0x20')](respondWithResult(_0x52e897,null))['catch'](handleError(_0x52e897,null));};exports[_0xa04e('0x57')]=function(_0x2291c0,_0x4a3c05){return db[_0xa04e('0x3c')]['create'](_0x2291c0[_0xa04e('0x58')],{})[_0xa04e('0x20')](respondWithResult(_0x4a3c05,0xc9))[_0xa04e('0x2b')](handleError(_0x4a3c05,null));};exports[_0xa04e('0x59')]=function(_0x4ca125,_0x50dc19){if(_0x4ca125[_0xa04e('0x58')]['id']){delete _0x4ca125[_0xa04e('0x58')]['id'];}return db[_0xa04e('0x3c')][_0xa04e('0x56')]({'where':{'id':_0x4ca125[_0xa04e('0x52')]['id']}})['then'](handleEntityNotFound(_0x50dc19,null))['then'](saveUpdates(_0x4ca125[_0xa04e('0x58')],null))[_0xa04e('0x20')](respondWithResult(_0x50dc19,null))[_0xa04e('0x2b')](handleError(_0x50dc19,null));};exports[_0xa04e('0x37')]=function(_0x261e09,_0x51b6bd){return db[_0xa04e('0x3c')][_0xa04e('0x56')]({'where':{'id':_0x261e09[_0xa04e('0x52')]['id']}})[_0xa04e('0x20')](handleEntityNotFound(_0x51b6bd,null))[_0xa04e('0x20')](removeEntity(_0x51b6bd,null))[_0xa04e('0x2b')](handleError(_0x51b6bd,null));};exports['getFields']=function(_0x4e8e4b,_0x41ad6b,_0x569f3f){var _0x33e445={};var _0x1ebefc={};var _0x2d5597;var _0x1e405a;return db[_0xa04e('0x3c')][_0xa04e('0x5a')]({'where':{'id':_0x4e8e4b['params']['id']}})[_0xa04e('0x20')](handleEntityNotFound(_0x41ad6b,null))['then'](function(_0x547ff2){if(_0x547ff2){_0x2d5597=_0x547ff2;_0x1ebefc[_0xa04e('0x40')]=_['keys'](db[_0xa04e('0x5b')][_0xa04e('0x53')]);_0x1ebefc[_0xa04e('0x41')]=_['keys'](_0x4e8e4b[_0xa04e('0x41')]);_0x1ebefc[_0xa04e('0x43')]=_[_0xa04e('0x44')](_0x1ebefc[_0xa04e('0x40')],_0x1ebefc[_0xa04e('0x41')]);_0x33e445[_0xa04e('0x46')]=_['intersection'](_0x1ebefc[_0xa04e('0x40')],qs['fields'](_0x4e8e4b['query'][_0xa04e('0x45')]));_0x33e445[_0xa04e('0x46')]=_0x33e445[_0xa04e('0x46')]['length']?_0x33e445['attributes']:_0x1ebefc[_0xa04e('0x40')];_0x33e445[_0xa04e('0x5c')]=qs[_0xa04e('0x49')](_0x4e8e4b[_0xa04e('0x41')][_0xa04e('0x49')]);_0x33e445[_0xa04e('0x4c')]=qs[_0xa04e('0x43')](_['pick'](_0x4e8e4b['query'],_0x1ebefc['filters']));if(_0x4e8e4b['query'][_0xa04e('0x4b')]){_0x33e445[_0xa04e('0x4c')]=_[_0xa04e('0x4d')](_0x33e445['where'],{'$or':_[_0xa04e('0x3b')](_0x33e445['attributes'],function(_0x50fef7){var _0x45362b={};_0x45362b[_0x50fef7]={'$like':'%'+_0x4e8e4b[_0xa04e('0x41')][_0xa04e('0x4b')]+'%'};return _0x45362b;})});}_0x33e445=_['merge']({},_0x33e445,_0x4e8e4b[_0xa04e('0x4f')]);return _0x2d5597[_0xa04e('0x5d')](_0x33e445);}})[_0xa04e('0x20')](function(_0x198267){if(_0x198267){_0x1e405a=_0x198267[_0xa04e('0x54')];if(!_0x4e8e4b[_0xa04e('0x41')][_0xa04e('0x47')](_0xa04e('0x48'))){_0x33e445[_0xa04e('0x31')]=qs[_0xa04e('0x31')](_0x4e8e4b['query'][_0xa04e('0x31')]);_0x33e445[_0xa04e('0x30')]=qs[_0xa04e('0x30')](_0x4e8e4b[_0xa04e('0x41')]['offset']);}return _0x2d5597['getFields'](_0x33e445);}})['then'](function(_0x882194){if(_0x882194){return _0x882194?{'count':_0x1e405a,'rows':_0x882194}:null;}})[_0xa04e('0x20')](respondWithResult(_0x41ad6b,null))[_0xa04e('0x2b')](handleError(_0x41ad6b,null));};exports[_0xa04e('0x5e')]=function(_0x43f59c,_0x23a7ce,_0x6530f9){var _0xb63dcf={};var _0x233b84={};var _0x440ef8;var _0x22182a;return db[_0xa04e('0x3c')][_0xa04e('0x5a')]({'where':{'id':_0x43f59c[_0xa04e('0x52')]['id']}})[_0xa04e('0x20')](handleEntityNotFound(_0x23a7ce,null))[_0xa04e('0x20')](function(_0x2d6297){if(_0x2d6297){_0x440ef8=_0x2d6297;_0x233b84['model']=_[_0xa04e('0x42')](db[_0xa04e('0x5b')][_0xa04e('0x53')]);_0x233b84['query']=_[_0xa04e('0x42')](_0x43f59c[_0xa04e('0x41')]);_0x233b84['filters']=_[_0xa04e('0x44')](_0x233b84[_0xa04e('0x40')],_0x233b84['query']);_0xb63dcf[_0xa04e('0x46')]=_['intersection'](_0x233b84[_0xa04e('0x40')],qs['fields'](_0x43f59c[_0xa04e('0x41')][_0xa04e('0x45')]));_0xb63dcf[_0xa04e('0x46')]=_0xb63dcf[_0xa04e('0x46')][_0xa04e('0x54')]?_0xb63dcf[_0xa04e('0x46')]:_0x233b84['model'];_0xb63dcf[_0xa04e('0x5c')]=qs['sort'](_0x43f59c['query'][_0xa04e('0x49')]);_0xb63dcf[_0xa04e('0x4c')]=qs[_0xa04e('0x43')](_['pick'](_0x43f59c[_0xa04e('0x41')],_0x233b84[_0xa04e('0x43')]));if(_0x43f59c[_0xa04e('0x41')][_0xa04e('0x4b')]){_0xb63dcf['where']=_['merge'](_0xb63dcf[_0xa04e('0x4c')],{'$or':_[_0xa04e('0x3b')](_0xb63dcf[_0xa04e('0x46')],function(_0x4d6407){var _0x5dcf34={};_0x5dcf34[_0x4d6407]={'$like':'%'+_0x43f59c[_0xa04e('0x41')][_0xa04e('0x4b')]+'%'};return _0x5dcf34;})});}_0xb63dcf=_[_0xa04e('0x4d')]({},_0xb63dcf,_0x43f59c['options']);return _0x440ef8[_0xa04e('0x5e')](_0xb63dcf);}})['then'](function(_0x26cef4){if(_0x26cef4){_0x22182a=_0x26cef4['length'];if(!_0x43f59c['query'][_0xa04e('0x47')]('nolimit')){_0xb63dcf[_0xa04e('0x31')]=qs[_0xa04e('0x31')](_0x43f59c[_0xa04e('0x41')]['limit']);_0xb63dcf[_0xa04e('0x30')]=qs['offset'](_0x43f59c[_0xa04e('0x41')][_0xa04e('0x30')]);}return _0x440ef8['getSubjects'](_0xb63dcf);}})[_0xa04e('0x20')](function(_0x4275e2){if(_0x4275e2){return _0x4275e2?{'count':_0x22182a,'rows':_0x4275e2}:null;}})[_0xa04e('0x20')](respondWithResult(_0x23a7ce,null))[_0xa04e('0x2b')](handleError(_0x23a7ce,null));};exports['getDescriptions']=function(_0x1773a0,_0x3b73ad,_0x17e4d3){var _0x3632af={};var _0x3d6936={};var _0x43ff57;var _0x48bb96;return db[_0xa04e('0x3c')][_0xa04e('0x5a')]({'where':{'id':_0x1773a0[_0xa04e('0x52')]['id']}})[_0xa04e('0x20')](handleEntityNotFound(_0x3b73ad,null))[_0xa04e('0x20')](function(_0xd572ab){if(_0xd572ab){_0x43ff57=_0xd572ab;_0x3d6936['model']=_[_0xa04e('0x42')](db[_0xa04e('0x5b')][_0xa04e('0x53')]);_0x3d6936[_0xa04e('0x41')]=_[_0xa04e('0x42')](_0x1773a0[_0xa04e('0x41')]);_0x3d6936[_0xa04e('0x43')]=_[_0xa04e('0x44')](_0x3d6936[_0xa04e('0x40')],_0x3d6936[_0xa04e('0x41')]);_0x3632af[_0xa04e('0x46')]=_[_0xa04e('0x44')](_0x3d6936[_0xa04e('0x40')],qs[_0xa04e('0x45')](_0x1773a0['query'][_0xa04e('0x45')]));_0x3632af['attributes']=_0x3632af[_0xa04e('0x46')][_0xa04e('0x54')]?_0x3632af['attributes']:_0x3d6936[_0xa04e('0x40')];_0x3632af[_0xa04e('0x5c')]=qs[_0xa04e('0x49')](_0x1773a0[_0xa04e('0x41')][_0xa04e('0x49')]);_0x3632af['where']=qs[_0xa04e('0x43')](_[_0xa04e('0x4a')](_0x1773a0[_0xa04e('0x41')],_0x3d6936[_0xa04e('0x43')]));if(_0x1773a0[_0xa04e('0x41')][_0xa04e('0x4b')]){_0x3632af['where']=_[_0xa04e('0x4d')](_0x3632af[_0xa04e('0x4c')],{'$or':_[_0xa04e('0x3b')](_0x3632af[_0xa04e('0x46')],function(_0x516330){var _0x4a068b={};_0x4a068b[_0x516330]={'$like':'%'+_0x1773a0[_0xa04e('0x41')][_0xa04e('0x4b')]+'%'};return _0x4a068b;})});}_0x3632af=_[_0xa04e('0x4d')]({},_0x3632af,_0x1773a0[_0xa04e('0x4f')]);return _0x43ff57[_0xa04e('0x5f')](_0x3632af);}})[_0xa04e('0x20')](function(_0x5694d9){if(_0x5694d9){_0x48bb96=_0x5694d9[_0xa04e('0x54')];if(!_0x1773a0['query']['hasOwnProperty']('nolimit')){_0x3632af[_0xa04e('0x31')]=qs[_0xa04e('0x31')](_0x1773a0[_0xa04e('0x41')][_0xa04e('0x31')]);_0x3632af[_0xa04e('0x30')]=qs['offset'](_0x1773a0[_0xa04e('0x41')][_0xa04e('0x30')]);}return _0x43ff57[_0xa04e('0x5f')](_0x3632af);}})[_0xa04e('0x20')](function(_0x245371){if(_0x245371){return _0x245371?{'count':_0x48bb96,'rows':_0x245371}:null;}})[_0xa04e('0x20')](respondWithResult(_0x3b73ad,null))['catch'](handleError(_0x3b73ad,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8b9b0f4..b6bf0ff 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 _0x9e1e=['int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','./intVtigerConfiguration.attributes','define'];(function(_0x2ead15,_0x33f310){var _0x29ec41=function(_0x5ca2a2){while(--_0x5ca2a2){_0x2ead15['push'](_0x2ead15['shift']());}};_0x29ec41(++_0x33f310);}(_0x9e1e,0x191));var _0xe9e1=function(_0x2f833a,_0x5c0f24){_0x2f833a=_0x2f833a-0x0;var _0x496633=_0x9e1e[_0x2f833a];return _0x496633;};'use strict';var _=require('lodash');var util=require(_0xe9e1('0x0'));var logger=require(_0xe9e1('0x1'))(_0xe9e1('0x2'));var moment=require(_0xe9e1('0x3'));var BPromise=require(_0xe9e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9e1('0x5'));var rimraf=require(_0xe9e1('0x6'));var config=require('../../config/environment');var attributes=require(_0xe9e1('0x7'));module['exports']=function(_0x19b17b,_0x24ba0d){return _0x19b17b[_0xe9e1('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xe9e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf36=['define','VtigerConfiguration','lodash','util','../../config/logger','api','moment','path','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x2dc66a,_0x4fa475){var _0x1c2c2d=function(_0x473bd3){while(--_0x473bd3){_0x2dc66a['push'](_0x2dc66a['shift']());}};_0x1c2c2d(++_0x4fa475);}(_0xbf36,0x12b));var _0x6bf3=function(_0x5c8881,_0x5de3bf){_0x5c8881=_0x5c8881-0x0;var _0x265456=_0xbf36[_0x5c8881];return _0x265456;};'use strict';var _=require(_0x6bf3('0x0'));var util=require(_0x6bf3('0x1'));var logger=require(_0x6bf3('0x2'))(_0x6bf3('0x3'));var moment=require(_0x6bf3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bf3('0x5'));var rimraf=require('rimraf');var config=require(_0x6bf3('0x6'));var attributes=require(_0x6bf3('0x7'));module[_0x6bf3('0x8')]=function(_0x3fb57e,_0x2e5132){return _0x3fb57e[_0x6bf3('0x9')](_0x6bf3('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 8e70dc1..662a06e 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 _0xd6b7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x38d1a7,_0x32c9a7){var _0xf98d7b=function(_0x40c432){while(--_0x40c432){_0x38d1a7['push'](_0x38d1a7['shift']());}};_0xf98d7b(++_0x32c9a7);}(_0xd6b7,0xf9));var _0x7d6b=function(_0x6696b0,_0x512ec4){_0x6696b0=_0x6696b0-0x0;var _0x4c15ec=_0xd6b7[_0x6696b0];return _0x4c15ec;};'use strict';var _=require('lodash');var util=require(_0x7d6b('0x0'));var moment=require(_0x7d6b('0x1'));var BPromise=require(_0x7d6b('0x2'));var rs=require(_0x7d6b('0x3'));var fs=require('fs');var Redis=require(_0x7d6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d6b('0x5'));var logger=require(_0x7d6b('0x6'))(_0x7d6b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x69d2a8,_0x5d59fb,_0x3c902b){return new BPromise(function(_0x497322,_0x37d30b){return client[_0x7d6b('0x9')](_0x69d2a8,_0x3c902b)['then'](function(_0x4930ad){logger[_0x7d6b('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x5d59fb,_0x7d6b('0xb'));logger[_0x7d6b('0xc')](_0x7d6b('0xd'),_0x5d59fb,_0x7d6b('0xb'),JSON[_0x7d6b('0xe')](_0x4930ad));if(_0x4930ad['error']){if(_0x4930ad[_0x7d6b('0xf')][_0x7d6b('0x10')]===0x1f4){logger['error'](_0x7d6b('0x11'),_0x5d59fb,_0x4930ad[_0x7d6b('0xf')][_0x7d6b('0x12')]);return _0x37d30b(_0x4930ad[_0x7d6b('0xf')]['message']);}logger['error'](_0x7d6b('0x11'),_0x5d59fb,_0x4930ad[_0x7d6b('0xf')]['message']);return _0x497322(_0x4930ad[_0x7d6b('0xf')][_0x7d6b('0x12')]);}else{logger['info'](_0x7d6b('0x11'),_0x5d59fb,'request\x20sent');_0x497322(_0x4930ad[_0x7d6b('0x13')]['message']);}})[_0x7d6b('0x14')](function(_0x303e67){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x5d59fb,_0x303e67);_0x37d30b(_0x303e67);});});} \ No newline at end of file +var _0x2d61=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x1eac2f,_0x2f8f4f){var _0x2ad2ac=function(_0x3c52ec){while(--_0x3c52ec){_0x1eac2f['push'](_0x1eac2f['shift']());}};_0x2ad2ac(++_0x2f8f4f);}(_0x2d61,0x106));var _0x12d6=function(_0x27ce7a,_0x53970c){_0x27ce7a=_0x27ce7a-0x0;var _0x580fac=_0x2d61[_0x27ce7a];return _0x580fac;};'use strict';var _=require(_0x12d6('0x0'));var util=require(_0x12d6('0x1'));var moment=require(_0x12d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x12d6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12d6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12d6('0x5'))(_0x12d6('0x6'));var config=require(_0x12d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12d6('0x8')][_0x12d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ee9bc,_0x105d58,_0x175786){return new BPromise(function(_0x299448,_0x5974fb){return client[_0x12d6('0xa')](_0x5ee9bc,_0x175786)[_0x12d6('0xb')](function(_0x47c8bb){logger[_0x12d6('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x105d58,_0x12d6('0xd'));logger[_0x12d6('0xe')](_0x12d6('0xf'),_0x105d58,_0x12d6('0xd'),JSON[_0x12d6('0x10')](_0x47c8bb));if(_0x47c8bb[_0x12d6('0x11')]){if(_0x47c8bb[_0x12d6('0x11')][_0x12d6('0x12')]===0x1f4){logger['error'](_0x12d6('0x13'),_0x105d58,_0x47c8bb[_0x12d6('0x11')]['message']);return _0x5974fb(_0x47c8bb['error'][_0x12d6('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x105d58,_0x47c8bb[_0x12d6('0x11')]['message']);return _0x299448(_0x47c8bb[_0x12d6('0x11')][_0x12d6('0x14')]);}else{logger[_0x12d6('0xc')](_0x12d6('0x13'),_0x105d58,_0x12d6('0xd'));_0x299448(_0x47c8bb[_0x12d6('0x15')][_0x12d6('0x14')]);}})['catch'](function(_0x3d300d){logger[_0x12d6('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x105d58,_0x3d300d);_0x5974fb(_0x3d300d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5fe7d5f..5d25938 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 _0x6489=['Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6489,0x10b));var _0x9648=function(_0x2c0162,_0x12a4c9){_0x2c0162=_0x2c0162-0x0;var _0x2fb489=_0x6489[_0x2c0162];return _0x2fb489;};'use strict';var multer=require(_0x9648('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9648('0x1'));var express=require(_0x9648('0x2'));var router=express[_0x9648('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9648('0x4'));var config=require(_0x9648('0x5'));var controller=require(_0x9648('0x6'));router['get']('/',auth[_0x9648('0x7')](),controller[_0x9648('0x8')]);router[_0x9648('0x9')](_0x9648('0xa'),auth[_0x9648('0x7')](),controller[_0x9648('0xb')]);router[_0x9648('0xc')]('/',auth[_0x9648('0x7')](),controller[_0x9648('0xd')]);router['put'](_0x9648('0xa'),auth[_0x9648('0x7')](),controller[_0x9648('0xe')]);router[_0x9648('0xf')](_0x9648('0xa'),auth[_0x9648('0x7')](),controller[_0x9648('0x10')]);module[_0x9648('0x11')]=router; \ No newline at end of file +var _0xe7b3=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4b10f0,_0x25c95d){var _0x455af5=function(_0x57526b){while(--_0x57526b){_0x4b10f0['push'](_0x4b10f0['shift']());}};_0x455af5(++_0x25c95d);}(_0xe7b3,0x9e));var _0x3e7b=function(_0x292438,_0x2a4577){_0x292438=_0x292438-0x0;var _0x3d6408=_0xe7b3[_0x292438];return _0x3d6408;};'use strict';var multer=require(_0x3e7b('0x0'));var util=require(_0x3e7b('0x1'));var path=require(_0x3e7b('0x2'));var timeout=require(_0x3e7b('0x3'));var express=require(_0x3e7b('0x4'));var router=express['Router']();var auth=require(_0x3e7b('0x5'));var interaction=require(_0x3e7b('0x6'));var config=require(_0x3e7b('0x7'));var controller=require(_0x3e7b('0x8'));router['get']('/',auth[_0x3e7b('0x9')](),controller[_0x3e7b('0xa')]);router['get'](_0x3e7b('0xb'),auth[_0x3e7b('0x9')](),controller[_0x3e7b('0xc')]);router[_0x3e7b('0xd')]('/',auth[_0x3e7b('0x9')](),controller['create']);router[_0x3e7b('0xe')](_0x3e7b('0xb'),auth[_0x3e7b('0x9')](),controller[_0x3e7b('0xf')]);router[_0x3e7b('0x10')](_0x3e7b('0xb'),auth['isAuthenticated'](),controller[_0x3e7b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3ea5eaf..049caba 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 _0xbb05=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x1e0d24,_0x48ca54){_0x1e0d24=_0x1e0d24-0x0;var _0x525664=_0xbb05[_0x1e0d24];return _0x525664;};'use strict';var Sequelize=require(_0x5bb0('0x0'));module[_0x5bb0('0x1')]={'type':{'type':Sequelize[_0x5bb0('0x2')]('string',_0x5bb0('0x3'),_0x5bb0('0x4'),_0x5bb0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5bb0('0x6')]},'keyType':{'type':Sequelize[_0x5bb0('0x2')]('string','variable',_0x5bb0('0x4'))},'keyContent':{'type':Sequelize[_0x5bb0('0x6')]},'idField':{'type':Sequelize[_0x5bb0('0x6')]},'nameField':{'type':Sequelize[_0x5bb0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cc7=['variable','BOOLEAN','sequelize','exports','ENUM','keyValue','string','STRING'];(function(_0x17d7e7,_0x1445cb){var _0x40e647=function(_0xc393e4){while(--_0xc393e4){_0x17d7e7['push'](_0x17d7e7['shift']());}};_0x40e647(++_0x1445cb);}(_0x1cc7,0x15a));var _0x71cc=function(_0x417b3b,_0xf34f89){_0x417b3b=_0x417b3b-0x0;var _0x27a468=_0x1cc7[_0x417b3b];return _0x27a468;};'use strict';var Sequelize=require(_0x71cc('0x0'));module[_0x71cc('0x1')]={'type':{'type':Sequelize[_0x71cc('0x2')]('string','variable','customVariable',_0x71cc('0x3')),'defaultValue':_0x71cc('0x4')},'content':{'type':Sequelize[_0x71cc('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x71cc('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x71cc('0x5')]},'idField':{'type':Sequelize[_0x71cc('0x5')]},'nameField':{'type':Sequelize[_0x71cc('0x5')]},'customField':{'type':Sequelize[_0x71cc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x71cc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ec1dce0..3c9a520 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 _0xda11=['model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','VtigerField','rawAttributes','fieldName','key'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xda11,0x185));var _0x1da1=function(_0x232ffb,_0x5b5eff){_0x232ffb=_0x232ffb-0x0;var _0x45b8c5=_0xda11[_0x232ffb];return _0x45b8c5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1da1('0x0'));var zipdir=require(_0x1da1('0x1'));var jsonpatch=require(_0x1da1('0x2'));var rp=require(_0x1da1('0x3'));var moment=require('moment');var BPromise=require(_0x1da1('0x4'));var Mustache=require(_0x1da1('0x5'));var util=require('util');var path=require(_0x1da1('0x6'));var sox=require(_0x1da1('0x7'));var csv=require(_0x1da1('0x8'));var ejs=require(_0x1da1('0x9'));var fs=require('fs');var _=require(_0x1da1('0xa'));var squel=require('squel');var crypto=require(_0x1da1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1da1('0x8'));var querystring=require(_0x1da1('0xc'));var Papa=require(_0x1da1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1da1('0xe'));var as=require(_0x1da1('0xf'));var hardwareService=require(_0x1da1('0x10'));var logger=require(_0x1da1('0x11'))(_0x1da1('0x12'));var utils=require(_0x1da1('0x13'));var config=require(_0x1da1('0x14'));var db=require(_0x1da1('0x15'))['db'];function respondWithStatusCode(_0x5b9ed5,_0x71cfbc){_0x71cfbc=_0x71cfbc||0xcc;return function(_0x51be15){if(_0x51be15){return _0x5b9ed5[_0x1da1('0x16')](_0x71cfbc);}return _0x5b9ed5[_0x1da1('0x17')](_0x71cfbc)['end']();};}function respondWithResult(_0xaf391,_0x1c68a6){_0x1c68a6=_0x1c68a6||0xc8;return function(_0x3f68db){if(_0x3f68db){return _0xaf391[_0x1da1('0x17')](_0x1c68a6)[_0x1da1('0x18')](_0x3f68db);}};}function respondWithFilteredResult(_0x48e5d6,_0x16701f){return function(_0x1d4131){if(_0x1d4131){var _0x751b35=_0x1d4131[_0x1da1('0x19')],_0x2ade8c=_0x16701f[_0x1da1('0x1a')],_0x54a303=_0x16701f[_0x1da1('0x1a')]+_0x16701f['limit'],_0x531bf4;if(_0x54a303>=_0x751b35){_0x54a303=_0x751b35;_0x531bf4=0xc8;}else{_0x531bf4=0xce;}_0x48e5d6[_0x1da1('0x17')](_0x531bf4);return _0x48e5d6[_0x1da1('0x1b')](_0x1da1('0x1c'),_0x2ade8c+'-'+_0x54a303+'/'+_0x751b35)['json'](_0x1d4131);}return null;};}function patchUpdates(_0xfb6fda){return function(_0x6f4314){try{jsonpatch[_0x1da1('0x1d')](_0x6f4314,_0xfb6fda,!![]);}catch(_0x1d3660){return BPromise[_0x1da1('0x1e')](_0x1d3660);}return _0x6f4314['save']();};}function saveUpdates(_0x1f60ca,_0x5255e9){return function(_0x392c02){if(_0x392c02){return _0x392c02[_0x1da1('0x1f')](_0x1f60ca)[_0x1da1('0x20')](function(_0x2932ca){return _0x2932ca;});}return null;};}function removeEntity(_0xf39b8b,_0x8dd36e){return function(_0xbcbbac){if(_0xbcbbac){return _0xbcbbac[_0x1da1('0x21')]()[_0x1da1('0x20')](function(){_0xf39b8b[_0x1da1('0x17')](0xcc)[_0x1da1('0x22')]();});}};}function handleEntityNotFound(_0x4c20e4,_0xab1e33){return function(_0x2fd286){if(!_0x2fd286){_0x4c20e4[_0x1da1('0x16')](0x194);}return _0x2fd286;};}function handleError(_0x30ffff,_0x25c845){_0x25c845=_0x25c845||0x1f4;return function(_0x5bbf3e){logger['error'](_0x5bbf3e[_0x1da1('0x23')]);if(_0x5bbf3e['name']){delete _0x5bbf3e[_0x1da1('0x24')];}_0x30ffff[_0x1da1('0x17')](_0x25c845)[_0x1da1('0x25')](_0x5bbf3e);};}exports[_0x1da1('0x26')]=function(_0x48f2ee,_0x53edfa){var _0x5098a1={},_0x324607={},_0x3c0dc6={'count':0x0,'rows':[]};var _0x133238=_['map'](db[_0x1da1('0x27')][_0x1da1('0x28')],function(_0x2ed175){return{'name':_0x2ed175[_0x1da1('0x29')],'type':_0x2ed175['type'][_0x1da1('0x2a')]};});_0x324607[_0x1da1('0x2b')]=_[_0x1da1('0x2c')](_0x133238,_0x1da1('0x24'));_0x324607[_0x1da1('0x2d')]=_['keys'](_0x48f2ee[_0x1da1('0x2d')]);_0x324607[_0x1da1('0x2e')]=_[_0x1da1('0x2f')](_0x324607['model'],_0x324607[_0x1da1('0x2d')]);_0x5098a1[_0x1da1('0x30')]=_[_0x1da1('0x2f')](_0x324607['model'],qs[_0x1da1('0x31')](_0x48f2ee[_0x1da1('0x2d')][_0x1da1('0x31')]));_0x5098a1[_0x1da1('0x30')]=_0x5098a1['attributes'][_0x1da1('0x32')]?_0x5098a1[_0x1da1('0x30')]:_0x324607['model'];if(!_0x48f2ee[_0x1da1('0x2d')][_0x1da1('0x33')]('nolimit')){_0x5098a1[_0x1da1('0x34')]=qs[_0x1da1('0x34')](_0x48f2ee[_0x1da1('0x2d')][_0x1da1('0x34')]);_0x5098a1[_0x1da1('0x1a')]=qs[_0x1da1('0x1a')](_0x48f2ee[_0x1da1('0x2d')]['offset']);}_0x5098a1[_0x1da1('0x35')]=qs[_0x1da1('0x36')](_0x48f2ee[_0x1da1('0x2d')]['sort']);_0x5098a1[_0x1da1('0x37')]=qs['filters'](_['pick'](_0x48f2ee[_0x1da1('0x2d')],_0x324607['filters']),_0x133238);if(_0x48f2ee[_0x1da1('0x2d')]['filter']){_0x5098a1[_0x1da1('0x37')]=_[_0x1da1('0x38')](_0x5098a1[_0x1da1('0x37')],{'$or':_[_0x1da1('0x2c')](_0x133238,function(_0x5e8bf1){if(_0x5e8bf1[_0x1da1('0x39')]!==_0x1da1('0x3a')){var _0x33659b={};_0x33659b[_0x5e8bf1[_0x1da1('0x24')]]={'$like':'%'+_0x48f2ee['query'][_0x1da1('0x3b')]+'%'};return _0x33659b;}})});}_0x5098a1=_[_0x1da1('0x38')]({},_0x5098a1,_0x48f2ee[_0x1da1('0x3c')]);var _0x54dad2={'where':_0x5098a1[_0x1da1('0x37')]};return db[_0x1da1('0x27')]['count'](_0x54dad2)[_0x1da1('0x20')](function(_0x21acd2){_0x3c0dc6['count']=_0x21acd2;if(_0x48f2ee[_0x1da1('0x2d')][_0x1da1('0x3d')]){_0x5098a1['include']=[{'all':!![]}];}return db[_0x1da1('0x27')][_0x1da1('0x3e')](_0x5098a1);})[_0x1da1('0x20')](function(_0x2332cf){_0x3c0dc6[_0x1da1('0x3f')]=_0x2332cf;return _0x3c0dc6;})[_0x1da1('0x20')](respondWithFilteredResult(_0x53edfa,_0x5098a1))[_0x1da1('0x40')](handleError(_0x53edfa,null));};exports[_0x1da1('0x41')]=function(_0x3f64b9,_0x504f58){var _0x5cd29c={'raw':!![],'where':{'id':_0x3f64b9['params']['id']}},_0x33e95e={};_0x33e95e[_0x1da1('0x2b')]=_[_0x1da1('0x42')](db[_0x1da1('0x27')][_0x1da1('0x28')]);_0x33e95e[_0x1da1('0x2d')]=_[_0x1da1('0x42')](_0x3f64b9[_0x1da1('0x2d')]);_0x33e95e[_0x1da1('0x2e')]=_[_0x1da1('0x2f')](_0x33e95e[_0x1da1('0x2b')],_0x33e95e[_0x1da1('0x2d')]);_0x5cd29c[_0x1da1('0x30')]=_[_0x1da1('0x2f')](_0x33e95e[_0x1da1('0x2b')],qs[_0x1da1('0x31')](_0x3f64b9['query']['fields']));_0x5cd29c[_0x1da1('0x30')]=_0x5cd29c['attributes'][_0x1da1('0x32')]?_0x5cd29c[_0x1da1('0x30')]:_0x33e95e[_0x1da1('0x2b')];if(_0x3f64b9['query']['includeAll']){_0x5cd29c[_0x1da1('0x43')]=[{'all':!![]}];}_0x5cd29c=_['merge']({},_0x5cd29c,_0x3f64b9[_0x1da1('0x3c')]);return db[_0x1da1('0x27')][_0x1da1('0x44')](_0x5cd29c)[_0x1da1('0x20')](handleEntityNotFound(_0x504f58,null))[_0x1da1('0x20')](respondWithResult(_0x504f58,null))[_0x1da1('0x40')](handleError(_0x504f58,null));};exports[_0x1da1('0x45')]=function(_0x5ade7f,_0x3ede81){return db[_0x1da1('0x27')][_0x1da1('0x45')](_0x5ade7f[_0x1da1('0x46')],{})['then'](respondWithResult(_0x3ede81,0xc9))['catch'](handleError(_0x3ede81,null));};exports[_0x1da1('0x1f')]=function(_0xf0d37d,_0x25a993){if(_0xf0d37d['body']['id']){delete _0xf0d37d[_0x1da1('0x46')]['id'];}return db[_0x1da1('0x27')]['find']({'where':{'id':_0xf0d37d[_0x1da1('0x47')]['id']}})[_0x1da1('0x20')](handleEntityNotFound(_0x25a993,null))[_0x1da1('0x20')](saveUpdates(_0xf0d37d[_0x1da1('0x46')],null))['then'](respondWithResult(_0x25a993,null))[_0x1da1('0x40')](handleError(_0x25a993,null));};exports['destroy']=function(_0x2a5325,_0x343739){return db['VtigerField'][_0x1da1('0x44')]({'where':{'id':_0x2a5325['params']['id']}})['then'](handleEntityNotFound(_0x343739,null))[_0x1da1('0x20')](removeEntity(_0x343739,null))[_0x1da1('0x40')](handleError(_0x343739,null));}; \ No newline at end of file +var _0x005f=['options','find','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','catch','params'];(function(_0x5413a7,_0x440330){var _0x462093=function(_0x239314){while(--_0x239314){_0x5413a7['push'](_0x5413a7['shift']());}};_0x462093(++_0x440330);}(_0x005f,0x161));var _0xf005=function(_0x1b86a2,_0x442de2){_0x1b86a2=_0x1b86a2-0x0;var _0x53926e=_0x005f[_0x1b86a2];return _0x53926e;};'use strict';var pdf=require(_0xf005('0x0'));var emlformat=require(_0xf005('0x1'));var rimraf=require(_0xf005('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf005('0x3'));var rp=require('request-promise');var moment=require(_0xf005('0x4'));var BPromise=require(_0xf005('0x5'));var Mustache=require(_0xf005('0x6'));var util=require(_0xf005('0x7'));var path=require(_0xf005('0x8'));var sox=require(_0xf005('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf005('0xa'));var squel=require(_0xf005('0xb'));var crypto=require(_0xf005('0xc'));var jsforce=require(_0xf005('0xd'));var deskjs=require(_0xf005('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf005('0xf'));var Papa=require(_0xf005('0x10'));var Redis=require('ioredis');var authService=require(_0xf005('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf005('0x12'))(_0xf005('0x13'));var utils=require(_0xf005('0x14'));var config=require(_0xf005('0x15'));var db=require(_0xf005('0x16'))['db'];function respondWithStatusCode(_0x5b8872,_0x41e7aa){_0x41e7aa=_0x41e7aa||0xcc;return function(_0x5b9ded){if(_0x5b9ded){return _0x5b8872[_0xf005('0x17')](_0x41e7aa);}return _0x5b8872[_0xf005('0x18')](_0x41e7aa)[_0xf005('0x19')]();};}function respondWithResult(_0x4de1b0,_0x51909d){_0x51909d=_0x51909d||0xc8;return function(_0x23422f){if(_0x23422f){return _0x4de1b0[_0xf005('0x18')](_0x51909d)[_0xf005('0x1a')](_0x23422f);}};}function respondWithFilteredResult(_0xf02e4d,_0x4141f1){return function(_0x3403df){if(_0x3403df){var _0x30200a=_0x3403df['count'],_0x15a3ad=_0x4141f1[_0xf005('0x1b')],_0x524b49=_0x4141f1[_0xf005('0x1b')]+_0x4141f1['limit'],_0x5e4a5a;if(_0x524b49>=_0x30200a){_0x524b49=_0x30200a;_0x5e4a5a=0xc8;}else{_0x5e4a5a=0xce;}_0xf02e4d[_0xf005('0x18')](_0x5e4a5a);return _0xf02e4d[_0xf005('0x1c')](_0xf005('0x1d'),_0x15a3ad+'-'+_0x524b49+'/'+_0x30200a)[_0xf005('0x1a')](_0x3403df);}return null;};}function patchUpdates(_0x5337cc){return function(_0x1dd2f4){try{jsonpatch[_0xf005('0x1e')](_0x1dd2f4,_0x5337cc,!![]);}catch(_0x4abcd2){return BPromise[_0xf005('0x1f')](_0x4abcd2);}return _0x1dd2f4[_0xf005('0x20')]();};}function saveUpdates(_0x501fca,_0x48293e){return function(_0x43ebba){if(_0x43ebba){return _0x43ebba[_0xf005('0x21')](_0x501fca)[_0xf005('0x22')](function(_0x169cb9){return _0x169cb9;});}return null;};}function removeEntity(_0x9dadbc,_0xdfc3f4){return function(_0x5edc69){if(_0x5edc69){return _0x5edc69[_0xf005('0x23')]()['then'](function(){_0x9dadbc[_0xf005('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259c41,_0x5842a8){return function(_0x156560){if(!_0x156560){_0x259c41[_0xf005('0x17')](0x194);}return _0x156560;};}function handleError(_0x17844b,_0xe64ba2){_0xe64ba2=_0xe64ba2||0x1f4;return function(_0x1a3508){logger[_0xf005('0x24')](_0x1a3508['stack']);if(_0x1a3508[_0xf005('0x25')]){delete _0x1a3508[_0xf005('0x25')];}_0x17844b[_0xf005('0x18')](_0xe64ba2)[_0xf005('0x26')](_0x1a3508);};}exports[_0xf005('0x27')]=function(_0x50554a,_0x27fb2a){var _0x557b68={},_0x54f0f7={},_0x479e54={'count':0x0,'rows':[]};var _0x4ae155=_[_0xf005('0x28')](db[_0xf005('0x29')][_0xf005('0x2a')],function(_0xd888be){return{'name':_0xd888be[_0xf005('0x2b')],'type':_0xd888be[_0xf005('0x2c')][_0xf005('0x2d')]};});_0x54f0f7[_0xf005('0x2e')]=_[_0xf005('0x28')](_0x4ae155,'name');_0x54f0f7[_0xf005('0x2f')]=_[_0xf005('0x30')](_0x50554a['query']);_0x54f0f7[_0xf005('0x31')]=_[_0xf005('0x32')](_0x54f0f7['model'],_0x54f0f7['query']);_0x557b68[_0xf005('0x33')]=_[_0xf005('0x32')](_0x54f0f7['model'],qs[_0xf005('0x34')](_0x50554a[_0xf005('0x2f')][_0xf005('0x34')]));_0x557b68[_0xf005('0x33')]=_0x557b68[_0xf005('0x33')]['length']?_0x557b68[_0xf005('0x33')]:_0x54f0f7[_0xf005('0x2e')];if(!_0x50554a[_0xf005('0x2f')][_0xf005('0x35')](_0xf005('0x36'))){_0x557b68[_0xf005('0x37')]=qs['limit'](_0x50554a[_0xf005('0x2f')][_0xf005('0x37')]);_0x557b68[_0xf005('0x1b')]=qs['offset'](_0x50554a['query'][_0xf005('0x1b')]);}_0x557b68[_0xf005('0x38')]=qs[_0xf005('0x39')](_0x50554a[_0xf005('0x2f')][_0xf005('0x39')]);_0x557b68['where']=qs[_0xf005('0x31')](_[_0xf005('0x3a')](_0x50554a[_0xf005('0x2f')],_0x54f0f7[_0xf005('0x31')]),_0x4ae155);if(_0x50554a['query'][_0xf005('0x3b')]){_0x557b68[_0xf005('0x3c')]=_[_0xf005('0x3d')](_0x557b68[_0xf005('0x3c')],{'$or':_['map'](_0x4ae155,function(_0x91b2ad){if(_0x91b2ad[_0xf005('0x2c')]!==_0xf005('0x3e')){var _0x596537={};_0x596537[_0x91b2ad[_0xf005('0x25')]]={'$like':'%'+_0x50554a[_0xf005('0x2f')][_0xf005('0x3b')]+'%'};return _0x596537;}})});}_0x557b68=_[_0xf005('0x3d')]({},_0x557b68,_0x50554a['options']);var _0x433be4={'where':_0x557b68[_0xf005('0x3c')]};return db['VtigerField'][_0xf005('0x3f')](_0x433be4)[_0xf005('0x22')](function(_0xbec659){_0x479e54[_0xf005('0x3f')]=_0xbec659;if(_0x50554a[_0xf005('0x2f')]['includeAll']){_0x557b68[_0xf005('0x40')]=[{'all':!![]}];}return db[_0xf005('0x29')]['findAll'](_0x557b68);})['then'](function(_0x2171cf){_0x479e54['rows']=_0x2171cf;return _0x479e54;})[_0xf005('0x22')](respondWithFilteredResult(_0x27fb2a,_0x557b68))[_0xf005('0x41')](handleError(_0x27fb2a,null));};exports['show']=function(_0x3cdaab,_0x118ff5){var _0x1a6e04={'raw':!![],'where':{'id':_0x3cdaab[_0xf005('0x42')]['id']}},_0x24c0f9={};_0x24c0f9[_0xf005('0x2e')]=_[_0xf005('0x30')](db['VtigerField'][_0xf005('0x2a')]);_0x24c0f9[_0xf005('0x2f')]=_['keys'](_0x3cdaab[_0xf005('0x2f')]);_0x24c0f9[_0xf005('0x31')]=_['intersection'](_0x24c0f9[_0xf005('0x2e')],_0x24c0f9[_0xf005('0x2f')]);_0x1a6e04[_0xf005('0x33')]=_[_0xf005('0x32')](_0x24c0f9[_0xf005('0x2e')],qs[_0xf005('0x34')](_0x3cdaab[_0xf005('0x2f')]['fields']));_0x1a6e04['attributes']=_0x1a6e04[_0xf005('0x33')]['length']?_0x1a6e04['attributes']:_0x24c0f9[_0xf005('0x2e')];if(_0x3cdaab[_0xf005('0x2f')]['includeAll']){_0x1a6e04[_0xf005('0x40')]=[{'all':!![]}];}_0x1a6e04=_[_0xf005('0x3d')]({},_0x1a6e04,_0x3cdaab[_0xf005('0x43')]);return db[_0xf005('0x29')][_0xf005('0x44')](_0x1a6e04)[_0xf005('0x22')](handleEntityNotFound(_0x118ff5,null))['then'](respondWithResult(_0x118ff5,null))['catch'](handleError(_0x118ff5,null));};exports['create']=function(_0x17dc0c,_0x238cee){return db['VtigerField']['create'](_0x17dc0c['body'],{})[_0xf005('0x22')](respondWithResult(_0x238cee,0xc9))[_0xf005('0x41')](handleError(_0x238cee,null));};exports['update']=function(_0x3d1285,_0x3c9629){if(_0x3d1285[_0xf005('0x45')]['id']){delete _0x3d1285[_0xf005('0x45')]['id'];}return db[_0xf005('0x29')][_0xf005('0x44')]({'where':{'id':_0x3d1285[_0xf005('0x42')]['id']}})[_0xf005('0x22')](handleEntityNotFound(_0x3c9629,null))[_0xf005('0x22')](saveUpdates(_0x3d1285['body'],null))['then'](respondWithResult(_0x3c9629,null))[_0xf005('0x41')](handleError(_0x3c9629,null));};exports[_0xf005('0x23')]=function(_0x14b573,_0x16abd9){return db['VtigerField'][_0xf005('0x44')]({'where':{'id':_0x14b573[_0xf005('0x42')]['id']}})['then'](handleEntityNotFound(_0x16abd9,null))[_0xf005('0x22')](removeEntity(_0x16abd9,null))[_0xf005('0x41')](handleError(_0x16abd9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b53fb00..d58ebdc 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(_0x895ade,_0x28d300){var _0x11d63e=function(_0x2c9986){while(--_0x2c9986){_0x895ade['push'](_0x895ade['shift']());}};_0x11d63e(++_0x28d300);}(_0xedd9,0xfc));var _0x9edd=function(_0x8b44b8,_0x136724){_0x8b44b8=_0x8b44b8-0x0;var _0x5f0181=_0xedd9[_0x8b44b8];return _0x5f0181;};'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 _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0x9bde,0xe1));var _0xe9bd=function(_0x105d62,_0x23342f){_0x105d62=_0x105d62-0x0;var _0xa2a862=_0x9bde[_0x105d62];return _0xa2a862;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[{'name':_0xe9bd('0xc'),'fields':[_0xe9bd('0xd'),_0xe9bd('0xe')],'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 ecdbaae..018e727 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 _0x7df3=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4a2089,_0xcf3082){var _0x31c79e=function(_0xc4501f){while(--_0xc4501f){_0x4a2089['push'](_0x4a2089['shift']());}};_0x31c79e(++_0xcf3082);}(_0x7df3,0x1cc));var _0x37df=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7df3[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var moment=require('moment');var BPromise=require(_0x37df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x37df('0x4'));var logger=require('../../config/logger')(_0x37df('0x5'));var config=require(_0x37df('0x6'));var jayson=require(_0x37df('0x7'));var client=jayson[_0x37df('0x8')][_0x37df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x773cbe,_0x579adf,_0x56eca4){return new BPromise(function(_0x559bb3,_0x2d9c06){return client[_0x37df('0xa')](_0x773cbe,_0x56eca4)[_0x37df('0xb')](function(_0x22b79a){logger['info'](_0x37df('0xc'),_0x579adf,_0x37df('0xd'));logger[_0x37df('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x579adf,_0x37df('0xd'),JSON[_0x37df('0xf')](_0x22b79a));if(_0x22b79a[_0x37df('0x10')]){if(_0x22b79a['error'][_0x37df('0x11')]===0x1f4){logger[_0x37df('0x10')](_0x37df('0xc'),_0x579adf,_0x22b79a[_0x37df('0x10')][_0x37df('0x12')]);return _0x2d9c06(_0x22b79a['error'][_0x37df('0x12')]);}logger[_0x37df('0x10')](_0x37df('0xc'),_0x579adf,_0x22b79a['error'][_0x37df('0x12')]);return _0x559bb3(_0x22b79a[_0x37df('0x10')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x579adf,_0x37df('0xd'));_0x559bb3(_0x22b79a[_0x37df('0x13')][_0x37df('0x12')]);}})[_0x37df('0x14')](function(_0x2495ea){logger[_0x37df('0x10')](_0x37df('0xc'),_0x579adf,_0x2495ea);_0x2d9c06(_0x2495ea);});});} \ No newline at end of file +var _0x4fad=['info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x181cf9,_0x58a083){var _0x215c3c=function(_0x4dd7ad){while(--_0x4dd7ad){_0x181cf9['push'](_0x181cf9['shift']());}};_0x215c3c(++_0x58a083);}(_0x4fad,0xcb));var _0xd4fa=function(_0x541f43,_0x4a46bb){_0x541f43=_0x541f43-0x0;var _0x3291cc=_0x4fad[_0x541f43];return _0x3291cc;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('VtigerField,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('VtigerField,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 654f5b4..bdb087f 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 _0xf440=['destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0xf440,0x1a6));var _0x0f44=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf440[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x0f44('0x0'));var util=require('util');var path=require(_0x0f44('0x1'));var timeout=require(_0x0f44('0x2'));var express=require(_0x0f44('0x3'));var router=express[_0x0f44('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f44('0x5'));var controller=require(_0x0f44('0x6'));router[_0x0f44('0x7')]('/',auth[_0x0f44('0x8')](),controller['index']);router[_0x0f44('0x7')](_0x0f44('0x9'),auth[_0x0f44('0x8')](),controller['show']);router['get'](_0x0f44('0xa'),auth[_0x0f44('0x8')](),controller[_0x0f44('0xb')]);router['get'](_0x0f44('0xc'),auth['isAuthenticated'](),controller[_0x0f44('0xd')]);router['post']('/',auth[_0x0f44('0x8')](),controller[_0x0f44('0xe')]);router[_0x0f44('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0f44('0x10')]('/:id',auth[_0x0f44('0x8')](),controller[_0x0f44('0x11')]);router[_0x0f44('0x12')](_0x0f44('0x9'),auth[_0x0f44('0x8')](),controller[_0x0f44('0x13')]);module[_0x0f44('0x14')]=router; \ No newline at end of file +var _0xfb5b=['post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields'];(function(_0x3ef129,_0xac668a){var _0x5520e9=function(_0x302fc7){while(--_0x302fc7){_0x3ef129['push'](_0x3ef129['shift']());}};_0x5520e9(++_0xac668a);}(_0xfb5b,0x166));var _0xbfb5=function(_0x5deee9,_0xf7bae7){_0x5deee9=_0x5deee9-0x0;var _0x1d84e0=_0xfb5b[_0x5deee9];return _0x1d84e0;};'use strict';var multer=require(_0xbfb5('0x0'));var util=require(_0xbfb5('0x1'));var path=require(_0xbfb5('0x2'));var timeout=require(_0xbfb5('0x3'));var express=require(_0xbfb5('0x4'));var router=express[_0xbfb5('0x5')]();var auth=require(_0xbfb5('0x6'));var interaction=require(_0xbfb5('0x7'));var config=require(_0xbfb5('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xbfb5('0x9')]('/',auth[_0xbfb5('0xa')](),controller[_0xbfb5('0xb')]);router['get'](_0xbfb5('0xc'),auth['isAuthenticated'](),controller[_0xbfb5('0xd')]);router[_0xbfb5('0x9')](_0xbfb5('0xe'),auth[_0xbfb5('0xa')](),controller['getConfigurations']);router['get'](_0xbfb5('0xf'),auth[_0xbfb5('0xa')](),controller['getFields']);router[_0xbfb5('0x10')]('/',auth[_0xbfb5('0xa')](),controller['create']);router[_0xbfb5('0x10')](_0xbfb5('0xe'),auth[_0xbfb5('0xa')](),controller[_0xbfb5('0x11')]);router[_0xbfb5('0x12')](_0xbfb5('0xc'),auth[_0xbfb5('0xa')](),controller['update']);router[_0xbfb5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbfb5('0x14')]);module[_0xbfb5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 19fb305..a10c41c 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 _0xfc72=['integrationTab','exports','STRING','ENUM','newTab'];(function(_0x2be1e0,_0xe572dd){var _0x365b83=function(_0x5c6770){while(--_0x5c6770){_0x2be1e0['push'](_0x2be1e0['shift']());}};_0x365b83(++_0xe572dd);}(_0xfc72,0x1eb));var _0x2fc7=function(_0x40f310,_0x33f8ba){_0x40f310=_0x40f310-0x0;var _0x414b2d=_0xfc72[_0x40f310];return _0x414b2d;};'use strict';var Sequelize=require('sequelize');module[_0x2fc7('0x0')]={'name':{'type':Sequelize[_0x2fc7('0x1')]},'description':{'type':Sequelize[_0x2fc7('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x2fc7('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2fc7('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x2fc7('0x2')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2fc7('0x2')]('integrationTab',_0x2fc7('0x3')),'defaultValue':_0x2fc7('0x4')}}; \ No newline at end of file +var _0x054a=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0xb3bb49,_0x1b3484){var _0x3afc25=function(_0x4be11a){while(--_0x4be11a){_0xb3bb49['push'](_0xb3bb49['shift']());}};_0x3afc25(++_0x1b3484);}(_0x054a,0xd2));var _0xa054=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x054a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa054('0x0'));module[_0xa054('0x1')]={'name':{'type':Sequelize[_0xa054('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa054('0x2')],'unique':_0xa054('0x3')},'password':{'type':Sequelize[_0xa054('0x2')]},'token':{'type':Sequelize[_0xa054('0x2')]},'remoteUri':{'type':Sequelize[_0xa054('0x2')],'unique':_0xa054('0x4')},'authType':{'type':Sequelize[_0xa054('0x5')](_0xa054('0x6'),_0xa054('0x7')),'defaultValue':_0xa054('0x6')},'serverUrl':{'type':Sequelize[_0xa054('0x2')]},'type':{'type':Sequelize[_0xa054('0x5')](_0xa054('0x8'),_0xa054('0x9')),'defaultValue':_0xa054('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 52ef8d7..8af7649 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 _0x28ae=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','ZendeskAccount','findAll','rows','show','include','options','create','body','params','find','getConfigurations','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','%s/%s','ticket_fields','authType','headers','format','%s:%s','base64','toString','ValidationError','subject','group','assignee','remove','includes','position','title','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','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'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x28ae,0x6e));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe28a('0x0'));var emlformat=require(_0xe28a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe28a('0x2'));var jsonpatch=require(_0xe28a('0x3'));var rp=require('request-promise');var moment=require(_0xe28a('0x4'));var BPromise=require(_0xe28a('0x5'));var Mustache=require(_0xe28a('0x6'));var util=require(_0xe28a('0x7'));var path=require(_0xe28a('0x8'));var sox=require('sox');var csv=require(_0xe28a('0x9'));var ejs=require(_0xe28a('0xa'));var fs=require('fs');var _=require(_0xe28a('0xb'));var squel=require('squel');var crypto=require(_0xe28a('0xc'));var jsforce=require(_0xe28a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe28a('0xe'));var Papa=require(_0xe28a('0xf'));var Redis=require(_0xe28a('0x10'));var authService=require(_0xe28a('0x11'));var qs=require(_0xe28a('0x12'));var as=require(_0xe28a('0x13'));var hardwareService=require(_0xe28a('0x14'));var logger=require('../../config/logger')(_0xe28a('0x15'));var utils=require('../../config/utils');var config=require(_0xe28a('0x16'));var db=require(_0xe28a('0x17'))['db'];var integrations=require(_0xe28a('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xe28a('0x19')][_0xe28a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3c685c,_0x380785,_0x339bf4){if(_0x339bf4){var _0x21dd7d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21dd7d[_0xe28a('0x1b')](_0x380785)){return _0x3c685c;}else{throw new db[(_0xe28a('0x1c'))]['ValidationError'](_0xe28a('0x1d'));}}else{return _0x3c685c;}}function respondWithRpcPromise(_0x2c17c4,_0x2f9c7b,_0x4a0edc,_0x40aa20){return new BPromise(function(_0x4f20dd,_0x53e006){var _0x5502bc=_0x40aa20||client;return _0x5502bc[_0xe28a('0x1e')](_0x2c17c4,_0x4a0edc)[_0xe28a('0x1f')](function(_0x1eea34){logger[_0xe28a('0x20')](_0xe28a('0x21'),_0x2f9c7b,_0xe28a('0x22'));logger[_0xe28a('0x23')](_0xe28a('0x24'),_0x2f9c7b,_0xe28a('0x22'),JSON['stringify'](_0x1eea34));if(_0x1eea34[_0xe28a('0x25')]){if(_0x1eea34['error']['code']===0x1f4){logger[_0xe28a('0x25')](_0xe28a('0x21'),_0x2f9c7b,_0x1eea34['error']['message']);return _0x53e006(_0x1eea34[_0xe28a('0x25')][_0xe28a('0x26')]);}logger[_0xe28a('0x25')](_0xe28a('0x21'),_0x2f9c7b,_0x1eea34[_0xe28a('0x25')][_0xe28a('0x26')]);return _0x4f20dd(_0x1eea34['error']['message']);}else{logger[_0xe28a('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x2f9c7b,'request\x20sent');_0x4f20dd(_0x1eea34[_0xe28a('0x27')][_0xe28a('0x26')]);}})[_0xe28a('0x28')](function(_0xd3038c){logger[_0xe28a('0x25')](_0xe28a('0x21'),_0x2f9c7b,_0xd3038c);_0x53e006(_0xd3038c);});});}function respondWithStatusCode(_0x8a2eb,_0x390181){_0x390181=_0x390181||0xcc;return function(_0x166b64){if(_0x166b64){return _0x8a2eb['sendStatus'](_0x390181);}return _0x8a2eb[_0xe28a('0x29')](_0x390181)[_0xe28a('0x2a')]();};}function respondWithResult(_0x64e4b9,_0x225b53){_0x225b53=_0x225b53||0xc8;return function(_0x2c10a3){if(_0x2c10a3){return _0x64e4b9['status'](_0x225b53)[_0xe28a('0x2b')](_0x2c10a3);}};}function respondWithFilteredResult(_0x41a01d,_0x38e736){return function(_0x4c760c){if(_0x4c760c){var _0x1edd42=_0x4c760c[_0xe28a('0x2c')],_0x409bd6=_0x38e736['offset'],_0x15e3a7=_0x38e736[_0xe28a('0x2d')]+_0x38e736[_0xe28a('0x2e')],_0x403fc0;if(_0x15e3a7>=_0x1edd42){_0x15e3a7=_0x1edd42;_0x403fc0=0xc8;}else{_0x403fc0=0xce;}_0x41a01d[_0xe28a('0x29')](_0x403fc0);return _0x41a01d[_0xe28a('0x2f')](_0xe28a('0x30'),_0x409bd6+'-'+_0x15e3a7+'/'+_0x1edd42)['json'](_0x4c760c);}return null;};}function patchUpdates(_0x393949){return function(_0x3c063d){try{jsonpatch[_0xe28a('0x31')](_0x3c063d,_0x393949,!![]);}catch(_0x273e4b){return BPromise['reject'](_0x273e4b);}return _0x3c063d['save']();};}function saveUpdates(_0x48168c,_0x5647d9){return function(_0x23ed68){if(_0x23ed68){return _0x23ed68[_0xe28a('0x32')](_0x48168c)[_0xe28a('0x1f')](function(_0x37e3ff){return _0x37e3ff;});}return null;};}function removeEntity(_0x5ebd70,_0x4b0693){return function(_0x144c45){if(_0x144c45){return _0x144c45[_0xe28a('0x33')]()[_0xe28a('0x1f')](function(){_0x5ebd70[_0xe28a('0x29')](0xcc)[_0xe28a('0x2a')]();});}};}function handleEntityNotFound(_0xfb7e24,_0x5115e2){return function(_0x477075){if(!_0x477075){_0xfb7e24[_0xe28a('0x34')](0x194);}return _0x477075;};}function handleError(_0x4201ee,_0x52f872){_0x52f872=_0x52f872||0x1f4;return function(_0x4bf396){logger['error'](_0x4bf396[_0xe28a('0x35')]);if(_0x4bf396[_0xe28a('0x36')]){delete _0x4bf396['name'];}_0x4201ee[_0xe28a('0x29')](_0x52f872)[_0xe28a('0x37')](_0x4bf396);};}exports['index']=function(_0x32ac4d,_0x182b6c){var _0x403b74={},_0x28b5b4={},_0x3e0f22={'count':0x0,'rows':[]};var _0x2d0f19=_[_0xe28a('0x38')](db['ZendeskAccount'][_0xe28a('0x39')],function(_0x5cead7){return{'name':_0x5cead7[_0xe28a('0x3a')],'type':_0x5cead7[_0xe28a('0x3b')][_0xe28a('0x3c')]};});_0x28b5b4[_0xe28a('0x3d')]=_[_0xe28a('0x38')](_0x2d0f19,_0xe28a('0x36'));_0x28b5b4[_0xe28a('0x3e')]=_[_0xe28a('0x3f')](_0x32ac4d['query']);_0x28b5b4[_0xe28a('0x40')]=_[_0xe28a('0x41')](_0x28b5b4[_0xe28a('0x3d')],_0x28b5b4[_0xe28a('0x3e')]);_0x403b74[_0xe28a('0x42')]=_[_0xe28a('0x41')](_0x28b5b4[_0xe28a('0x3d')],qs['fields'](_0x32ac4d['query'][_0xe28a('0x43')]));_0x403b74['attributes']=_0x403b74[_0xe28a('0x42')][_0xe28a('0x44')]?_0x403b74['attributes']:_0x28b5b4['model'];if(!_0x32ac4d[_0xe28a('0x3e')][_0xe28a('0x45')](_0xe28a('0x46'))){_0x403b74[_0xe28a('0x2e')]=qs[_0xe28a('0x2e')](_0x32ac4d[_0xe28a('0x3e')]['limit']);_0x403b74[_0xe28a('0x2d')]=qs['offset'](_0x32ac4d['query']['offset']);}_0x403b74[_0xe28a('0x47')]=qs[_0xe28a('0x48')](_0x32ac4d[_0xe28a('0x3e')][_0xe28a('0x48')]);_0x403b74[_0xe28a('0x49')]=qs[_0xe28a('0x40')](_[_0xe28a('0x4a')](_0x32ac4d[_0xe28a('0x3e')],_0x28b5b4[_0xe28a('0x40')]),_0x2d0f19);if(_0x32ac4d[_0xe28a('0x3e')][_0xe28a('0x4b')]){_0x403b74[_0xe28a('0x49')]=_[_0xe28a('0x4c')](_0x403b74[_0xe28a('0x49')],{'$or':_['map'](_0x2d0f19,function(_0x4016e1){if(_0x4016e1[_0xe28a('0x3b')]!==_0xe28a('0x4d')){var _0x3ad3a3={};_0x3ad3a3[_0x4016e1[_0xe28a('0x36')]]={'$like':'%'+_0x32ac4d['query'][_0xe28a('0x4b')]+'%'};return _0x3ad3a3;}})});}_0x403b74=_[_0xe28a('0x4c')]({},_0x403b74,_0x32ac4d['options']);var _0x351e60={'where':_0x403b74[_0xe28a('0x49')]};return db['ZendeskAccount'][_0xe28a('0x2c')](_0x351e60)['then'](function(_0x1065c7){_0x3e0f22['count']=_0x1065c7;if(_0x32ac4d[_0xe28a('0x3e')][_0xe28a('0x4e')]){_0x403b74['include']=[{'all':!![]}];}return db[_0xe28a('0x4f')][_0xe28a('0x50')](_0x403b74);})['then'](function(_0x7f0680){_0x3e0f22[_0xe28a('0x51')]=_0x7f0680;return _0x3e0f22;})['then'](respondWithFilteredResult(_0x182b6c,_0x403b74))['catch'](handleError(_0x182b6c,null));};exports[_0xe28a('0x52')]=function(_0xeebb9f,_0x3b2477){var _0xc6e83f={'raw':![],'where':{'id':_0xeebb9f['params']['id']}},_0x257a34={};_0x257a34[_0xe28a('0x3d')]=_[_0xe28a('0x3f')](db[_0xe28a('0x4f')]['rawAttributes']);_0x257a34[_0xe28a('0x3e')]=_[_0xe28a('0x3f')](_0xeebb9f['query']);_0x257a34[_0xe28a('0x40')]=_[_0xe28a('0x41')](_0x257a34[_0xe28a('0x3d')],_0x257a34[_0xe28a('0x3e')]);_0xc6e83f[_0xe28a('0x42')]=_[_0xe28a('0x41')](_0x257a34['model'],qs[_0xe28a('0x43')](_0xeebb9f[_0xe28a('0x3e')]['fields']));_0xc6e83f[_0xe28a('0x42')]=_0xc6e83f[_0xe28a('0x42')][_0xe28a('0x44')]?_0xc6e83f[_0xe28a('0x42')]:_0x257a34[_0xe28a('0x3d')];if(_0xeebb9f[_0xe28a('0x3e')]['includeAll']){_0xc6e83f[_0xe28a('0x53')]=[{'all':!![]}];}_0xc6e83f=_['merge']({},_0xc6e83f,_0xeebb9f[_0xe28a('0x54')]);return db[_0xe28a('0x4f')]['find'](_0xc6e83f)['then'](handleEntityNotFound(_0x3b2477,null))[_0xe28a('0x1f')](respondWithResult(_0x3b2477,null))[_0xe28a('0x28')](handleError(_0x3b2477,null));};exports[_0xe28a('0x55')]=function(_0x238b48,_0x5977a5){return db[_0xe28a('0x4f')]['create'](_0x238b48[_0xe28a('0x56')],{})['then'](respondWithResult(_0x5977a5,0xc9))['catch'](handleError(_0x5977a5,null));};exports[_0xe28a('0x32')]=function(_0x3b99b5,_0xf53bc2){if(_0x3b99b5[_0xe28a('0x56')]['id']){delete _0x3b99b5[_0xe28a('0x56')]['id'];}return db[_0xe28a('0x4f')]['find']({'where':{'id':_0x3b99b5[_0xe28a('0x57')]['id']}})[_0xe28a('0x1f')](handleEntityNotFound(_0xf53bc2,null))['then'](saveUpdates(_0x3b99b5['body'],null))[_0xe28a('0x1f')](respondWithResult(_0xf53bc2,null))[_0xe28a('0x28')](handleError(_0xf53bc2,null));};exports['destroy']=function(_0x5d6d5b,_0x275f7a){return db[_0xe28a('0x4f')][_0xe28a('0x58')]({'where':{'id':_0x5d6d5b['params']['id']}})[_0xe28a('0x1f')](handleEntityNotFound(_0x275f7a,null))[_0xe28a('0x1f')](removeEntity(_0x275f7a,null))[_0xe28a('0x28')](handleError(_0x275f7a,null));};exports[_0xe28a('0x59')]=function(_0x1d3162,_0x4c476e,_0x34ba09){var _0x58b04a={};var _0xe8c002={};var _0x1d9194;var _0x2c0826;return db[_0xe28a('0x4f')]['findOne']({'where':{'id':_0x1d3162[_0xe28a('0x57')]['id']}})[_0xe28a('0x1f')](handleEntityNotFound(_0x4c476e,null))[_0xe28a('0x1f')](function(_0x16dd5b){if(_0x16dd5b){_0x1d9194=_0x16dd5b;_0xe8c002['model']=_[_0xe28a('0x3f')](db[_0xe28a('0x5a')][_0xe28a('0x39')]);_0xe8c002[_0xe28a('0x3e')]=_[_0xe28a('0x3f')](_0x1d3162['query']);_0xe8c002['filters']=_[_0xe28a('0x41')](_0xe8c002[_0xe28a('0x3d')],_0xe8c002[_0xe28a('0x3e')]);_0x58b04a[_0xe28a('0x42')]=_['intersection'](_0xe8c002[_0xe28a('0x3d')],qs[_0xe28a('0x43')](_0x1d3162[_0xe28a('0x3e')][_0xe28a('0x43')]));_0x58b04a[_0xe28a('0x42')]=_0x58b04a[_0xe28a('0x42')]['length']?_0x58b04a['attributes']:_0xe8c002['model'];_0x58b04a[_0xe28a('0x47')]=qs['sort'](_0x1d3162[_0xe28a('0x3e')]['sort']);_0x58b04a[_0xe28a('0x49')]=qs[_0xe28a('0x40')](_['pick'](_0x1d3162['query'],_0xe8c002[_0xe28a('0x40')]));if(_0x1d3162[_0xe28a('0x3e')]['filter']){_0x58b04a[_0xe28a('0x49')]=_[_0xe28a('0x4c')](_0x58b04a[_0xe28a('0x49')],{'$or':_[_0xe28a('0x38')](_0x58b04a[_0xe28a('0x42')],function(_0x3c50be){var _0x3193f0={};_0x3193f0[_0x3c50be]={'$like':'%'+_0x1d3162[_0xe28a('0x3e')][_0xe28a('0x4b')]+'%'};return _0x3193f0;})});}_0x58b04a=_[_0xe28a('0x4c')]({},_0x58b04a,_0x1d3162['options']);return _0x1d9194[_0xe28a('0x59')](_0x58b04a);}})[_0xe28a('0x1f')](function(_0x5e7e9e){if(_0x5e7e9e){_0x2c0826=_0x5e7e9e['length'];if(!_0x1d3162['query'][_0xe28a('0x45')](_0xe28a('0x46'))){_0x58b04a[_0xe28a('0x2e')]=qs[_0xe28a('0x2e')](_0x1d3162[_0xe28a('0x3e')][_0xe28a('0x2e')]);_0x58b04a['offset']=qs[_0xe28a('0x2d')](_0x1d3162[_0xe28a('0x3e')][_0xe28a('0x2d')]);}return _0x1d9194[_0xe28a('0x59')](_0x58b04a);}})[_0xe28a('0x1f')](function(_0x20b59a){if(_0x20b59a){return _0x20b59a?{'count':_0x2c0826,'rows':_0x20b59a}:null;}})[_0xe28a('0x1f')](respondWithResult(_0x4c476e,null))[_0xe28a('0x28')](handleError(_0x4c476e,null));};exports[_0xe28a('0x5b')]=function(_0x13102f,_0x36c6ba,_0x240bef){if(_0x13102f[_0xe28a('0x56')]['id']){delete _0x13102f['body']['id'];}return db[_0xe28a('0x4f')]['findOne']({'where':{'id':_0x13102f[_0xe28a('0x57')]['id']}})[_0xe28a('0x1f')](handleEntityNotFound(_0x36c6ba,null))[_0xe28a('0x1f')](function(_0x342bf2){if(_0x342bf2){_0x13102f['body'][_0xe28a('0x5c')]=_0x342bf2['id'];_0x13102f['body']['Subjects']=integrations[_0xe28a('0x5d')](_0x13102f[_0xe28a('0x56')][_0xe28a('0x5e')],_0x13102f[_0xe28a('0x56')]['type']);_0x13102f[_0xe28a('0x56')][_0xe28a('0x5f')]=integrations[_0xe28a('0x60')](_0x13102f[_0xe28a('0x56')][_0xe28a('0x5e')],_0x13102f['body']['type']);return db[_0xe28a('0x5a')][_0xe28a('0x55')](_0x13102f[_0xe28a('0x56')],{'include':[{'model':db[_0xe28a('0x61')],'as':_0xe28a('0x62')},{'model':db[_0xe28a('0x61')],'as':_0xe28a('0x5f')}]});}return null;})['then'](respondWithResult(_0x36c6ba,null))[_0xe28a('0x28')](handleError(_0x36c6ba,null));};exports[_0xe28a('0x63')]=function(_0x1a3185,_0x2840b5,_0x30f1dc){var _0x40bfd8='';return db[_0xe28a('0x4f')][_0xe28a('0x64')]({'where':{'id':_0x1a3185[_0xe28a('0x57')]['id']},'attributes':['id',_0xe28a('0x65'),_0xe28a('0x66'),_0xe28a('0x67'),'authType','remoteUri']})[_0xe28a('0x1f')](handleEntityNotFound(_0x2840b5,null))[_0xe28a('0x1f')](function(_0x3d931b){if(_0x3d931b){_0x40bfd8=_0x3d931b[_0xe28a('0x68')];var _0x44422f=_0x40bfd8[_0xe28a('0x69')](-0x1);if(_0x44422f==='/'){_0x40bfd8=_0x40bfd8[_0xe28a('0x6a')](0x0,_0x40bfd8['lastIndexOf'](_0x44422f));}var _0x971876={'method':_0xe28a('0x6b'),'uri':util['format'](_0xe28a('0x6c'),_0x40bfd8,_0xe28a('0x6d')),'json':!![]};switch(_0x3d931b[_0xe28a('0x6e')]){case _0xe28a('0x66'):_0x971876[_0xe28a('0x6f')]={'Authorization':util[_0xe28a('0x70')]('Basic\x20%s',new Buffer(util['format'](_0xe28a('0x71'),_0x3d931b[_0xe28a('0x65')],_0x3d931b[_0xe28a('0x66')]))['toString'](_0xe28a('0x72')))};break;case _0xe28a('0x67'):_0x971876[_0xe28a('0x6f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe28a('0x70')]('%s/token:%s',_0x3d931b['username'],_0x3d931b[_0xe28a('0x67')]))[_0xe28a('0x73')](_0xe28a('0x72')))};break;default:throw new db['Sequelize'][(_0xe28a('0x74'))]('Unknown\x20authentication\x20type');}return rp(_0x971876);}})[_0xe28a('0x1f')](function(_0x489ce3){if(_0x489ce3){var _0xe0914b=[_0xe28a('0x75'),'description',_0xe28a('0x76'),_0xe28a('0x77')];_[_0xe28a('0x78')](_0x489ce3[_0xe28a('0x6d')],function(_0x30dcdc){return _0xe0914b[_0xe28a('0x79')](_0x30dcdc[_0xe28a('0x3b')]);});return{'count':_0x489ce3['ticket_fields']['length'],'rows':_[_0xe28a('0x38')](_0x489ce3['ticket_fields'],function(_0x496ae0){return{'id':_0x496ae0['id'],'name':_0x496ae0[_0xe28a('0x7a')]>0x7?_0x496ae0[_0xe28a('0x7b')]:_0x496ae0[_0xe28a('0x3b')],'custom':_0x496ae0[_0xe28a('0x7a')]>0x7?!![]:![],'options':_0x496ae0['system_field_options']?_0x496ae0['system_field_options']:_0x496ae0[_0xe28a('0x7c')]?_0x496ae0[_0xe28a('0x7c')]:[]};})};}})[_0xe28a('0x1f')](respondWithResult(_0x2840b5,null))[_0xe28a('0x28')](function(_0x3300db){var _0x39e941=_0x1a3185['query']['test']?0x1f4:_0x3300db[_0xe28a('0x7d')]||0x1f4;logger['error'](_0xe28a('0x7e'),'getFields',_0x39e941,JSON[_0xe28a('0x7f')](_0x3300db));delete _0x3300db[_0xe28a('0x36')];if(_0x39e941===0x191){_0x39e941=0x190;}_0x2840b5[_0xe28a('0x29')](_0x39e941)[_0xe28a('0x37')](_0x1a3185['query']['test']?{'message':_0xe28a('0x80'),'statusCode':_0x3300db['statusCode']}:_0x3300db);});}; \ No newline at end of file +var _0x2be4=['ZendeskAccount,\x20%s,\x20%s','message','info','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','params','catch','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','password','toString','base64','token','headers','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','title','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x26e312,_0x4c0fed){var _0x3d73ce=function(_0x41e646){while(--_0x41e646){_0x26e312['push'](_0x26e312['shift']());}};_0x3d73ce(++_0x4c0fed);}(_0x2be4,0xdc));var _0x42be=function(_0x5991ef,_0x61a000){_0x5991ef=_0x5991ef-0x0;var _0x42e9db=_0x2be4[_0x5991ef];return _0x42e9db;};'use strict';var pdf=require(_0x42be('0x0'));var emlformat=require(_0x42be('0x1'));var rimraf=require(_0x42be('0x2'));var zipdir=require(_0x42be('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42be('0x4'));var moment=require(_0x42be('0x5'));var BPromise=require(_0x42be('0x6'));var Mustache=require('mustache');var util=require(_0x42be('0x7'));var path=require(_0x42be('0x8'));var sox=require(_0x42be('0x9'));var csv=require('to-csv');var ejs=require(_0x42be('0xa'));var fs=require('fs');var _=require(_0x42be('0xb'));var squel=require('squel');var crypto=require(_0x42be('0xc'));var jsforce=require(_0x42be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x42be('0xe'));var querystring=require(_0x42be('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x42be('0x11'));var hardwareService=require(_0x42be('0x12'));var logger=require(_0x42be('0x13'))('api');var utils=require(_0x42be('0x14'));var config=require(_0x42be('0x15'));var db=require(_0x42be('0x16'))['db'];var integrations=require(_0x42be('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x42be('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x188690,_0x10a018,_0x58f4f9){if(_0x58f4f9){var _0x2f4398=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f4398[_0x42be('0x19')](_0x10a018)){return _0x188690;}else{throw new db[(_0x42be('0x1a'))][(_0x42be('0x1b'))](_0x42be('0x1c'));}}else{return _0x188690;}}function respondWithRpcPromise(_0x5a207d,_0x462854,_0x1723c7,_0x3a7322){return new BPromise(function(_0x390ec2,_0x58dc40){var _0x1d211b=_0x3a7322||client;return _0x1d211b[_0x42be('0x1d')](_0x5a207d,_0x1723c7)[_0x42be('0x1e')](function(_0x29e327){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x462854,_0x42be('0x1f'));logger['debug'](_0x42be('0x20'),_0x462854,_0x42be('0x1f'),JSON['stringify'](_0x29e327));if(_0x29e327[_0x42be('0x21')]){if(_0x29e327[_0x42be('0x21')]['code']===0x1f4){logger[_0x42be('0x21')](_0x42be('0x22'),_0x462854,_0x29e327['error'][_0x42be('0x23')]);return _0x58dc40(_0x29e327['error'][_0x42be('0x23')]);}logger['error'](_0x42be('0x22'),_0x462854,_0x29e327[_0x42be('0x21')][_0x42be('0x23')]);return _0x390ec2(_0x29e327[_0x42be('0x21')][_0x42be('0x23')]);}else{logger[_0x42be('0x24')](_0x42be('0x22'),_0x462854,_0x42be('0x1f'));_0x390ec2(_0x29e327['result'][_0x42be('0x23')]);}})['catch'](function(_0x3b4d24){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x462854,_0x3b4d24);_0x58dc40(_0x3b4d24);});});}function respondWithStatusCode(_0xa053d5,_0x2d6a23){_0x2d6a23=_0x2d6a23||0xcc;return function(_0x5cea79){if(_0x5cea79){return _0xa053d5[_0x42be('0x25')](_0x2d6a23);}return _0xa053d5[_0x42be('0x26')](_0x2d6a23)['end']();};}function respondWithResult(_0x2507e8,_0xfb9382){_0xfb9382=_0xfb9382||0xc8;return function(_0x3a7351){if(_0x3a7351){return _0x2507e8[_0x42be('0x26')](_0xfb9382)[_0x42be('0x27')](_0x3a7351);}};}function respondWithFilteredResult(_0x456269,_0x1c3ec2){return function(_0x5245cf){if(_0x5245cf){var _0xfbe830=_0x5245cf[_0x42be('0x28')],_0x2b4ef5=_0x1c3ec2['offset'],_0x3d7bf8=_0x1c3ec2['offset']+_0x1c3ec2[_0x42be('0x29')],_0x4226dc;if(_0x3d7bf8>=_0xfbe830){_0x3d7bf8=_0xfbe830;_0x4226dc=0xc8;}else{_0x4226dc=0xce;}_0x456269[_0x42be('0x26')](_0x4226dc);return _0x456269[_0x42be('0x2a')](_0x42be('0x2b'),_0x2b4ef5+'-'+_0x3d7bf8+'/'+_0xfbe830)[_0x42be('0x27')](_0x5245cf);}return null;};}function patchUpdates(_0x3b9932){return function(_0x170146){try{jsonpatch[_0x42be('0x2c')](_0x170146,_0x3b9932,!![]);}catch(_0x529f82){return BPromise[_0x42be('0x2d')](_0x529f82);}return _0x170146[_0x42be('0x2e')]();};}function saveUpdates(_0x650646,_0x353d0d){return function(_0x3dfa64){if(_0x3dfa64){return _0x3dfa64[_0x42be('0x2f')](_0x650646)['then'](function(_0x3436ce){return _0x3436ce;});}return null;};}function removeEntity(_0x130fa5,_0xc5046c){return function(_0x4fbdf3){if(_0x4fbdf3){return _0x4fbdf3[_0x42be('0x30')]()[_0x42be('0x1e')](function(){_0x130fa5[_0x42be('0x26')](0xcc)[_0x42be('0x31')]();});}};}function handleEntityNotFound(_0x530d2f,_0x4a3a49){return function(_0x59b637){if(!_0x59b637){_0x530d2f['sendStatus'](0x194);}return _0x59b637;};}function handleError(_0x394a51,_0x2565b6){_0x2565b6=_0x2565b6||0x1f4;return function(_0x29050f){logger[_0x42be('0x21')](_0x29050f[_0x42be('0x32')]);if(_0x29050f[_0x42be('0x33')]){delete _0x29050f[_0x42be('0x33')];}_0x394a51[_0x42be('0x26')](_0x2565b6)[_0x42be('0x34')](_0x29050f);};}exports[_0x42be('0x35')]=function(_0x402d7c,_0x24735a){var _0x51178e={},_0x9b685={},_0x347c1c={'count':0x0,'rows':[]};var _0x1e65a0=_[_0x42be('0x36')](db[_0x42be('0x37')][_0x42be('0x38')],function(_0x39c9b7){return{'name':_0x39c9b7[_0x42be('0x39')],'type':_0x39c9b7['type'][_0x42be('0x3a')]};});_0x9b685['model']=_[_0x42be('0x36')](_0x1e65a0,'name');_0x9b685[_0x42be('0x3b')]=_[_0x42be('0x3c')](_0x402d7c[_0x42be('0x3b')]);_0x9b685[_0x42be('0x3d')]=_['intersection'](_0x9b685[_0x42be('0x3e')],_0x9b685[_0x42be('0x3b')]);_0x51178e[_0x42be('0x3f')]=_[_0x42be('0x40')](_0x9b685[_0x42be('0x3e')],qs[_0x42be('0x41')](_0x402d7c[_0x42be('0x3b')][_0x42be('0x41')]));_0x51178e[_0x42be('0x3f')]=_0x51178e[_0x42be('0x3f')][_0x42be('0x42')]?_0x51178e[_0x42be('0x3f')]:_0x9b685[_0x42be('0x3e')];if(!_0x402d7c[_0x42be('0x3b')][_0x42be('0x43')](_0x42be('0x44'))){_0x51178e[_0x42be('0x29')]=qs['limit'](_0x402d7c[_0x42be('0x3b')][_0x42be('0x29')]);_0x51178e[_0x42be('0x45')]=qs[_0x42be('0x45')](_0x402d7c['query']['offset']);}_0x51178e[_0x42be('0x46')]=qs[_0x42be('0x47')](_0x402d7c['query'][_0x42be('0x47')]);_0x51178e[_0x42be('0x48')]=qs[_0x42be('0x3d')](_[_0x42be('0x49')](_0x402d7c[_0x42be('0x3b')],_0x9b685[_0x42be('0x3d')]),_0x1e65a0);if(_0x402d7c[_0x42be('0x3b')][_0x42be('0x4a')]){_0x51178e[_0x42be('0x48')]=_[_0x42be('0x4b')](_0x51178e[_0x42be('0x48')],{'$or':_[_0x42be('0x36')](_0x1e65a0,function(_0x2545a2){if(_0x2545a2[_0x42be('0x4c')]!==_0x42be('0x4d')){var _0x5c3ee4={};_0x5c3ee4[_0x2545a2[_0x42be('0x33')]]={'$like':'%'+_0x402d7c[_0x42be('0x3b')]['filter']+'%'};return _0x5c3ee4;}})});}_0x51178e=_[_0x42be('0x4b')]({},_0x51178e,_0x402d7c['options']);var _0x158517={'where':_0x51178e[_0x42be('0x48')]};return db[_0x42be('0x37')][_0x42be('0x28')](_0x158517)[_0x42be('0x1e')](function(_0x4d8417){_0x347c1c['count']=_0x4d8417;if(_0x402d7c['query'][_0x42be('0x4e')]){_0x51178e[_0x42be('0x4f')]=[{'all':!![]}];}return db[_0x42be('0x37')][_0x42be('0x50')](_0x51178e);})[_0x42be('0x1e')](function(_0x644d30){_0x347c1c[_0x42be('0x51')]=_0x644d30;return _0x347c1c;})[_0x42be('0x1e')](respondWithFilteredResult(_0x24735a,_0x51178e))['catch'](handleError(_0x24735a,null));};exports[_0x42be('0x52')]=function(_0x6f58db,_0x3d9896){var _0x4db57b={'raw':![],'where':{'id':_0x6f58db['params']['id']}},_0x5eacd1={};_0x5eacd1[_0x42be('0x3e')]=_[_0x42be('0x3c')](db[_0x42be('0x37')]['rawAttributes']);_0x5eacd1[_0x42be('0x3b')]=_[_0x42be('0x3c')](_0x6f58db[_0x42be('0x3b')]);_0x5eacd1[_0x42be('0x3d')]=_['intersection'](_0x5eacd1['model'],_0x5eacd1['query']);_0x4db57b['attributes']=_[_0x42be('0x40')](_0x5eacd1['model'],qs[_0x42be('0x41')](_0x6f58db[_0x42be('0x3b')]['fields']));_0x4db57b[_0x42be('0x3f')]=_0x4db57b[_0x42be('0x3f')][_0x42be('0x42')]?_0x4db57b[_0x42be('0x3f')]:_0x5eacd1[_0x42be('0x3e')];if(_0x6f58db['query']['includeAll']){_0x4db57b[_0x42be('0x4f')]=[{'all':!![]}];}_0x4db57b=_['merge']({},_0x4db57b,_0x6f58db[_0x42be('0x53')]);return db['ZendeskAccount'][_0x42be('0x54')](_0x4db57b)[_0x42be('0x1e')](handleEntityNotFound(_0x3d9896,null))[_0x42be('0x1e')](respondWithResult(_0x3d9896,null))['catch'](handleError(_0x3d9896,null));};exports[_0x42be('0x55')]=function(_0x593355,_0x471cc4){return db['ZendeskAccount'][_0x42be('0x55')](_0x593355[_0x42be('0x56')],{})['then'](respondWithResult(_0x471cc4,0xc9))['catch'](handleError(_0x471cc4,null));};exports[_0x42be('0x2f')]=function(_0x13da32,_0x5a32fe){if(_0x13da32[_0x42be('0x56')]['id']){delete _0x13da32['body']['id'];}return db[_0x42be('0x37')]['find']({'where':{'id':_0x13da32[_0x42be('0x57')]['id']}})[_0x42be('0x1e')](handleEntityNotFound(_0x5a32fe,null))[_0x42be('0x1e')](saveUpdates(_0x13da32[_0x42be('0x56')],null))[_0x42be('0x1e')](respondWithResult(_0x5a32fe,null))['catch'](handleError(_0x5a32fe,null));};exports[_0x42be('0x30')]=function(_0x274f40,_0x31dfb1){return db[_0x42be('0x37')][_0x42be('0x54')]({'where':{'id':_0x274f40[_0x42be('0x57')]['id']}})['then'](handleEntityNotFound(_0x31dfb1,null))[_0x42be('0x1e')](removeEntity(_0x31dfb1,null))[_0x42be('0x58')](handleError(_0x31dfb1,null));};exports[_0x42be('0x59')]=function(_0x5e1c55,_0x54e3cd,_0x3989ca){var _0x443424={};var _0x463047={};var _0x2f63e0;var _0x5ae053;return db[_0x42be('0x37')][_0x42be('0x5a')]({'where':{'id':_0x5e1c55['params']['id']}})[_0x42be('0x1e')](handleEntityNotFound(_0x54e3cd,null))['then'](function(_0x53c564){if(_0x53c564){_0x2f63e0=_0x53c564;_0x463047[_0x42be('0x3e')]=_[_0x42be('0x3c')](db[_0x42be('0x5b')][_0x42be('0x38')]);_0x463047[_0x42be('0x3b')]=_[_0x42be('0x3c')](_0x5e1c55[_0x42be('0x3b')]);_0x463047['filters']=_[_0x42be('0x40')](_0x463047['model'],_0x463047[_0x42be('0x3b')]);_0x443424[_0x42be('0x3f')]=_['intersection'](_0x463047[_0x42be('0x3e')],qs[_0x42be('0x41')](_0x5e1c55[_0x42be('0x3b')][_0x42be('0x41')]));_0x443424[_0x42be('0x3f')]=_0x443424[_0x42be('0x3f')][_0x42be('0x42')]?_0x443424[_0x42be('0x3f')]:_0x463047[_0x42be('0x3e')];_0x443424[_0x42be('0x46')]=qs[_0x42be('0x47')](_0x5e1c55[_0x42be('0x3b')][_0x42be('0x47')]);_0x443424[_0x42be('0x48')]=qs[_0x42be('0x3d')](_['pick'](_0x5e1c55[_0x42be('0x3b')],_0x463047[_0x42be('0x3d')]));if(_0x5e1c55[_0x42be('0x3b')]['filter']){_0x443424[_0x42be('0x48')]=_[_0x42be('0x4b')](_0x443424[_0x42be('0x48')],{'$or':_['map'](_0x443424[_0x42be('0x3f')],function(_0x14057c){var _0x2ec231={};_0x2ec231[_0x14057c]={'$like':'%'+_0x5e1c55[_0x42be('0x3b')][_0x42be('0x4a')]+'%'};return _0x2ec231;})});}_0x443424=_[_0x42be('0x4b')]({},_0x443424,_0x5e1c55['options']);return _0x2f63e0['getConfigurations'](_0x443424);}})['then'](function(_0x77cb6c){if(_0x77cb6c){_0x5ae053=_0x77cb6c[_0x42be('0x42')];if(!_0x5e1c55[_0x42be('0x3b')][_0x42be('0x43')](_0x42be('0x44'))){_0x443424[_0x42be('0x29')]=qs[_0x42be('0x29')](_0x5e1c55[_0x42be('0x3b')]['limit']);_0x443424[_0x42be('0x45')]=qs['offset'](_0x5e1c55[_0x42be('0x3b')][_0x42be('0x45')]);}return _0x2f63e0[_0x42be('0x59')](_0x443424);}})['then'](function(_0x422c8a){if(_0x422c8a){return _0x422c8a?{'count':_0x5ae053,'rows':_0x422c8a}:null;}})['then'](respondWithResult(_0x54e3cd,null))[_0x42be('0x58')](handleError(_0x54e3cd,null));};exports[_0x42be('0x5c')]=function(_0x377d32,_0x2ab399,_0x57cf77){if(_0x377d32[_0x42be('0x56')]['id']){delete _0x377d32[_0x42be('0x56')]['id'];}return db[_0x42be('0x37')][_0x42be('0x5a')]({'where':{'id':_0x377d32[_0x42be('0x57')]['id']}})[_0x42be('0x1e')](handleEntityNotFound(_0x2ab399,null))[_0x42be('0x1e')](function(_0x27e815){if(_0x27e815){_0x377d32[_0x42be('0x56')]['AccountId']=_0x27e815['id'];_0x377d32[_0x42be('0x56')][_0x42be('0x5d')]=integrations[_0x42be('0x5e')](_0x377d32[_0x42be('0x56')][_0x42be('0x5f')],_0x377d32[_0x42be('0x56')][_0x42be('0x4c')]);_0x377d32[_0x42be('0x56')][_0x42be('0x60')]=integrations[_0x42be('0x61')](_0x377d32[_0x42be('0x56')][_0x42be('0x5f')],_0x377d32[_0x42be('0x56')][_0x42be('0x4c')]);return db[_0x42be('0x5b')][_0x42be('0x55')](_0x377d32[_0x42be('0x56')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x42be('0x62')],'as':_0x42be('0x60')}]});}return null;})[_0x42be('0x1e')](respondWithResult(_0x2ab399,null))[_0x42be('0x58')](handleError(_0x2ab399,null));};exports[_0x42be('0x63')]=function(_0x472daf,_0x386e0e,_0x30e192){var _0x1baf9b='';return db[_0x42be('0x37')][_0x42be('0x5a')]({'where':{'id':_0x472daf[_0x42be('0x57')]['id']},'attributes':['id',_0x42be('0x64'),'password','token','authType',_0x42be('0x65')]})[_0x42be('0x1e')](handleEntityNotFound(_0x386e0e,null))[_0x42be('0x1e')](function(_0x20c204){if(_0x20c204){_0x1baf9b=_0x20c204[_0x42be('0x65')];var _0x2ac7a9=_0x1baf9b[_0x42be('0x66')](-0x1);if(_0x2ac7a9==='/'){_0x1baf9b=_0x1baf9b[_0x42be('0x67')](0x0,_0x1baf9b[_0x42be('0x68')](_0x2ac7a9));}var _0x5785e9={'method':_0x42be('0x69'),'uri':util[_0x42be('0x6a')](_0x42be('0x6b'),_0x1baf9b,'ticket_fields'),'json':!![]};switch(_0x20c204['authType']){case'password':_0x5785e9['headers']={'Authorization':util[_0x42be('0x6a')](_0x42be('0x6c'),new Buffer(util[_0x42be('0x6a')]('%s:%s',_0x20c204['username'],_0x20c204[_0x42be('0x6d')]))[_0x42be('0x6e')](_0x42be('0x6f')))};break;case _0x42be('0x70'):_0x5785e9[_0x42be('0x71')]={'Authorization':util[_0x42be('0x6a')](_0x42be('0x6c'),new Buffer(util[_0x42be('0x6a')]('%s/token:%s',_0x20c204[_0x42be('0x64')],_0x20c204[_0x42be('0x70')]))['toString'](_0x42be('0x6f')))};break;default:throw new db['Sequelize'][(_0x42be('0x1b'))](_0x42be('0x72'));}return rp(_0x5785e9);}})[_0x42be('0x1e')](function(_0x3a1571){if(_0x3a1571){var _0x5c8c36=[_0x42be('0x73'),_0x42be('0x74'),_0x42be('0x75'),_0x42be('0x76')];_['remove'](_0x3a1571[_0x42be('0x77')],function(_0x1cd462){return _0x5c8c36['includes'](_0x1cd462['type']);});return{'count':_0x3a1571['ticket_fields']['length'],'rows':_[_0x42be('0x36')](_0x3a1571['ticket_fields'],function(_0x48ce67){return{'id':_0x48ce67['id'],'name':_0x48ce67['position']>0x7?_0x48ce67[_0x42be('0x78')]:_0x48ce67['type'],'custom':_0x48ce67[_0x42be('0x79')]>0x7?!![]:![],'options':_0x48ce67[_0x42be('0x7a')]?_0x48ce67[_0x42be('0x7a')]:_0x48ce67[_0x42be('0x7b')]?_0x48ce67[_0x42be('0x7b')]:[]};})};}})[_0x42be('0x1e')](respondWithResult(_0x386e0e,null))[_0x42be('0x58')](function(_0x37ecf0){var _0x2929d4=_0x472daf[_0x42be('0x3b')]['test']?0x1f4:_0x37ecf0['statusCode']||0x1f4;logger[_0x42be('0x21')](_0x42be('0x7c'),_0x42be('0x63'),_0x2929d4,JSON[_0x42be('0x7d')](_0x37ecf0));delete _0x37ecf0[_0x42be('0x33')];if(_0x2929d4===0x191){_0x2929d4=0x190;}_0x386e0e[_0x42be('0x26')](_0x2929d4)[_0x42be('0x34')](_0x472daf[_0x42be('0x3b')]['test']?{'message':_0x42be('0x7e'),'statusCode':_0x37ecf0['statusCode']}:_0x37ecf0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7a2b740..bf9e458 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 _0x4c64=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4df90c,_0x439adb){var _0x1d3c78=function(_0x4da472){while(--_0x4da472){_0x4df90c['push'](_0x4df90c['shift']());}};_0x1d3c78(++_0x439adb);}(_0x4c64,0x83));var _0x44c6=function(_0xf0bcbf,_0x196298){_0xf0bcbf=_0xf0bcbf-0x0;var _0x3ab487=_0x4c64[_0xf0bcbf];return _0x3ab487;};'use strict';var _=require(_0x44c6('0x0'));var util=require(_0x44c6('0x1'));var logger=require(_0x44c6('0x2'))(_0x44c6('0x3'));var moment=require(_0x44c6('0x4'));var BPromise=require(_0x44c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44c6('0x6'));var rimraf=require(_0x44c6('0x7'));var config=require(_0x44c6('0x8'));var attributes=require(_0x44c6('0x9'));var integrations=require(_0x44c6('0xa'));module[_0x44c6('0xb')]=function(_0x2aca99,_0x3103af){return _0x2aca99[_0x44c6('0xc')]('ZendeskAccount',attributes,{'tableName':_0x44c6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf892=['api','moment','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger'];(function(_0x4887ef,_0xf947c1){var _0x44dd61=function(_0x22e6e9){while(--_0x22e6e9){_0x4887ef['push'](_0x4887ef['shift']());}};_0x44dd61(++_0xf947c1);}(_0xf892,0x136));var _0x2f89=function(_0x248be0,_0x189220){_0x248be0=_0x248be0-0x0;var _0x2cafb0=_0xf892[_0x248be0];return _0x2cafb0;};'use strict';var _=require('lodash');var util=require(_0x2f89('0x0'));var logger=require(_0x2f89('0x1'))(_0x2f89('0x2'));var moment=require(_0x2f89('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f89('0x4'));var config=require(_0x2f89('0x5'));var attributes=require(_0x2f89('0x6'));var integrations=require(_0x2f89('0x7'));module[_0x2f89('0x8')]=function(_0xea0ab9,_0x397422){return _0xea0ab9[_0x2f89('0x9')](_0x2f89('0xa'),attributes,{'tableName':_0x2f89('0xb'),'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 7f83d94..900c095 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e518d,_0x32a45d){var _0x458ff2=function(_0xc96c49){while(--_0xc96c49){_0x4e518d['push'](_0x4e518d['shift']());}};_0x458ff2(++_0x32a45d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _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(_0x5cfb96,_0x9803c5){var _0x2ed36c=function(_0x2c6145){while(--_0x2c6145){_0x5cfb96['push'](_0x5cfb96['shift']());}};_0x2ed36c(++_0x9803c5);}(_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 diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b7a1bcb..072707b 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 _0x19c9=['getFields','getSubjects','getTags','create','post','/:id/tags','/:id','delete','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/fields'];(function(_0x4d150a,_0x25f904){var _0x885bd4=function(_0x552a7d){while(--_0x552a7d){_0x4d150a['push'](_0x4d150a['shift']());}};_0x885bd4(++_0x25f904);}(_0x19c9,0x122));var _0x919c=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x19c9[_0x1abb09];return _0xea1c07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x919c('0x0'));var timeout=require(_0x919c('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x919c('0x2'));var interaction=require(_0x919c('0x3'));var config=require(_0x919c('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0x919c('0x5')]('/',auth['isAuthenticated'](),controller[_0x919c('0x6')]);router[_0x919c('0x5')]('/:id',auth[_0x919c('0x7')](),controller[_0x919c('0x8')]);router['get'](_0x919c('0x9'),auth[_0x919c('0x7')](),controller[_0x919c('0xa')]);router['get']('/:id/subjects',auth[_0x919c('0x7')](),controller[_0x919c('0xb')]);router[_0x919c('0x5')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x919c('0x5')]('/:id/tags',auth['isAuthenticated'](),controller[_0x919c('0xc')]);router['post']('/',auth[_0x919c('0x7')](),controller[_0x919c('0xd')]);router[_0x919c('0xe')](_0x919c('0xf'),auth[_0x919c('0x7')](),controller['setTags']);router['put'](_0x919c('0x10'),auth[_0x919c('0x7')](),controller['update']);router[_0x919c('0x11')]('/:id',auth[_0x919c('0x7')](),controller[_0x919c('0x12')]);module[_0x919c('0x13')]=router; \ No newline at end of file +var _0xefe9=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','/:id/tags','setTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe9,0x93));var _0x9efe=function(_0x5b99a7,_0x329e45){_0x5b99a7=_0x5b99a7-0x0;var _0x2ac75b=_0xefe9[_0x5b99a7];return _0x2ac75b;};'use strict';var multer=require(_0x9efe('0x0'));var util=require(_0x9efe('0x1'));var path=require(_0x9efe('0x2'));var timeout=require(_0x9efe('0x3'));var express=require(_0x9efe('0x4'));var router=express[_0x9efe('0x5')]();var auth=require(_0x9efe('0x6'));var interaction=require(_0x9efe('0x7'));var config=require(_0x9efe('0x8'));var controller=require('./intZendeskConfiguration.controller');router[_0x9efe('0x9')]('/',auth['isAuthenticated'](),controller[_0x9efe('0xa')]);router['get']('/:id',auth[_0x9efe('0xb')](),controller[_0x9efe('0xc')]);router[_0x9efe('0x9')](_0x9efe('0xd'),auth[_0x9efe('0xb')](),controller[_0x9efe('0xe')]);router['get'](_0x9efe('0xf'),auth[_0x9efe('0xb')](),controller['getSubjects']);router[_0x9efe('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9efe('0x10')]);router[_0x9efe('0x9')]('/:id/tags',auth[_0x9efe('0xb')](),controller['getTags']);router['post']('/',auth[_0x9efe('0xb')](),controller[_0x9efe('0x11')]);router['post'](_0x9efe('0x12'),auth['isAuthenticated'](),controller[_0x9efe('0x13')]);router[_0x9efe('0x14')](_0x9efe('0x15'),auth[_0x9efe('0xb')](),controller['update']);router['delete'](_0x9efe('0x15'),auth[_0x9efe('0xb')](),controller[_0x9efe('0x16')]);module[_0x9efe('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 86e7e44..9495863 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 _0xcb2d=['exports','STRING','sequelize'];(function(_0x558457,_0x3331d2){var _0xfdd682=function(_0x238e0c){while(--_0x238e0c){_0x558457['push'](_0x558457['shift']());}};_0xfdd682(++_0x3331d2);}(_0xcb2d,0x83));var _0xdcb2=function(_0xc7ab26,_0x1a3d9d){_0xc7ab26=_0xc7ab26-0x0;var _0x528b19=_0xcb2d[_0xc7ab26];return _0x528b19;};'use strict';var Sequelize=require(_0xdcb2('0x0'));module[_0xdcb2('0x1')]={'name':{'type':Sequelize[_0xdcb2('0x2')]},'description':{'type':Sequelize[_0xdcb2('0x2')]}}; \ No newline at end of file +var _0x8f99=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f99,0x15f));var _0x98f9=function(_0x41fe7d,_0x22013a){_0x41fe7d=_0x41fe7d-0x0;var _0x1e45b1=_0x8f99[_0x41fe7d];return _0x1e45b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x98f9('0x0')]},'description':{'type':Sequelize[_0x98f9('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2c4c673..750d2a6 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 _0x9687=['util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','create','body','find','getFields','ZendeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1eef5c,_0x400c64){var _0x246777=function(_0x1d57b9){while(--_0x1d57b9){_0x1eef5c['push'](_0x1eef5c['shift']());}};_0x246777(++_0x400c64);}(_0x9687,0x1c9));var _0x7968=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9687[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x7968('0x0'));var emlformat=require(_0x7968('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7968('0x2'));var jsonpatch=require(_0x7968('0x3'));var rp=require(_0x7968('0x4'));var moment=require(_0x7968('0x5'));var BPromise=require(_0x7968('0x6'));var Mustache=require(_0x7968('0x7'));var util=require(_0x7968('0x8'));var path=require(_0x7968('0x9'));var sox=require(_0x7968('0xa'));var csv=require(_0x7968('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7968('0xc'));var squel=require(_0x7968('0xd'));var crypto=require('crypto');var jsforce=require(_0x7968('0xe'));var deskjs=require(_0x7968('0xf'));var toCsv=require(_0x7968('0xb'));var querystring=require(_0x7968('0x10'));var Papa=require(_0x7968('0x11'));var Redis=require(_0x7968('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7968('0x13'));var as=require(_0x7968('0x14'));var hardwareService=require(_0x7968('0x15'));var logger=require(_0x7968('0x16'))(_0x7968('0x17'));var utils=require('../../config/utils');var config=require(_0x7968('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x7968('0x19')][_0x7968('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x27fb23,_0x590632,_0x3fb673){if(_0x3fb673){var _0x5a9533=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a9533[_0x7968('0x1b')](_0x590632)){return _0x27fb23;}else{throw new db[(_0x7968('0x1c'))]['ValidationError'](_0x7968('0x1d'));}}else{return _0x27fb23;}}function respondWithRpcPromise(_0x37c36e,_0x47c917,_0x57f512,_0x466d59){return new BPromise(function(_0x55a983,_0x35449d){var _0x5ec467=_0x466d59||client;return _0x5ec467['request'](_0x37c36e,_0x57f512)[_0x7968('0x1e')](function(_0x2a84ba){logger[_0x7968('0x1f')](_0x7968('0x20'),_0x47c917,_0x7968('0x21'));logger[_0x7968('0x22')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x47c917,_0x7968('0x21'),JSON[_0x7968('0x23')](_0x2a84ba));if(_0x2a84ba[_0x7968('0x24')]){if(_0x2a84ba['error'][_0x7968('0x25')]===0x1f4){logger[_0x7968('0x24')](_0x7968('0x20'),_0x47c917,_0x2a84ba[_0x7968('0x24')][_0x7968('0x26')]);return _0x35449d(_0x2a84ba['error'][_0x7968('0x26')]);}logger[_0x7968('0x24')](_0x7968('0x20'),_0x47c917,_0x2a84ba['error']['message']);return _0x55a983(_0x2a84ba[_0x7968('0x24')][_0x7968('0x26')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x47c917,_0x7968('0x21'));_0x55a983(_0x2a84ba['result'][_0x7968('0x26')]);}})[_0x7968('0x27')](function(_0x397704){logger[_0x7968('0x24')](_0x7968('0x20'),_0x47c917,_0x397704);_0x35449d(_0x397704);});});}function respondWithStatusCode(_0x2e5438,_0x33cc6c){_0x33cc6c=_0x33cc6c||0xcc;return function(_0x5f353c){if(_0x5f353c){return _0x2e5438[_0x7968('0x28')](_0x33cc6c);}return _0x2e5438[_0x7968('0x29')](_0x33cc6c)[_0x7968('0x2a')]();};}function respondWithResult(_0x4bbcb0,_0x596dc1){_0x596dc1=_0x596dc1||0xc8;return function(_0x42597d){if(_0x42597d){return _0x4bbcb0[_0x7968('0x29')](_0x596dc1)[_0x7968('0x2b')](_0x42597d);}};}function respondWithFilteredResult(_0xf1427d,_0x5234ce){return function(_0x1e2112){if(_0x1e2112){var _0x17c045=_0x1e2112['count'],_0x5453f9=_0x5234ce[_0x7968('0x2c')],_0xab4cda=_0x5234ce[_0x7968('0x2c')]+_0x5234ce[_0x7968('0x2d')],_0x55e662;if(_0xab4cda>=_0x17c045){_0xab4cda=_0x17c045;_0x55e662=0xc8;}else{_0x55e662=0xce;}_0xf1427d[_0x7968('0x29')](_0x55e662);return _0xf1427d['set']('Content-Range',_0x5453f9+'-'+_0xab4cda+'/'+_0x17c045)[_0x7968('0x2b')](_0x1e2112);}return null;};}function patchUpdates(_0x2fc841){return function(_0x306c49){try{jsonpatch[_0x7968('0x2e')](_0x306c49,_0x2fc841,!![]);}catch(_0x4d740c){return BPromise[_0x7968('0x2f')](_0x4d740c);}return _0x306c49[_0x7968('0x30')]();};}function saveUpdates(_0x2ef662,_0xa61b70){return function(_0x2f797d){if(_0x2f797d){return _0x2f797d[_0x7968('0x31')](_0x2ef662)['then'](function(_0x15eafb){return _0x15eafb;});}return null;};}function removeEntity(_0xa2a63f,_0x3f6de4){return function(_0x54cf2d){if(_0x54cf2d){return _0x54cf2d[_0x7968('0x32')]()[_0x7968('0x1e')](function(){_0xa2a63f[_0x7968('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba826,_0x18d764){return function(_0x783a0e){if(!_0x783a0e){_0x1ba826[_0x7968('0x28')](0x194);}return _0x783a0e;};}function handleError(_0x393584,_0x248c7e){_0x248c7e=_0x248c7e||0x1f4;return function(_0x38b666){logger['error'](_0x38b666[_0x7968('0x33')]);if(_0x38b666['name']){delete _0x38b666[_0x7968('0x34')];}_0x393584['status'](_0x248c7e)[_0x7968('0x35')](_0x38b666);};}exports['index']=function(_0x5bc5a7,_0x11a4f4){var _0x4969c0={},_0x3adc63={},_0x49c54f={'count':0x0,'rows':[]};var _0x48d97f=_[_0x7968('0x36')](db[_0x7968('0x37')][_0x7968('0x38')],function(_0x3141f6){return{'name':_0x3141f6[_0x7968('0x39')],'type':_0x3141f6[_0x7968('0x3a')]['key']};});_0x3adc63[_0x7968('0x3b')]=_['map'](_0x48d97f,_0x7968('0x34'));_0x3adc63[_0x7968('0x3c')]=_[_0x7968('0x3d')](_0x5bc5a7['query']);_0x3adc63[_0x7968('0x3e')]=_[_0x7968('0x3f')](_0x3adc63[_0x7968('0x3b')],_0x3adc63[_0x7968('0x3c')]);_0x4969c0[_0x7968('0x40')]=_[_0x7968('0x3f')](_0x3adc63[_0x7968('0x3b')],qs[_0x7968('0x41')](_0x5bc5a7['query']['fields']));_0x4969c0['attributes']=_0x4969c0[_0x7968('0x40')][_0x7968('0x42')]?_0x4969c0['attributes']:_0x3adc63['model'];if(!_0x5bc5a7[_0x7968('0x3c')]['hasOwnProperty'](_0x7968('0x43'))){_0x4969c0[_0x7968('0x2d')]=qs[_0x7968('0x2d')](_0x5bc5a7['query'][_0x7968('0x2d')]);_0x4969c0['offset']=qs[_0x7968('0x2c')](_0x5bc5a7['query'][_0x7968('0x2c')]);}_0x4969c0['order']=qs[_0x7968('0x44')](_0x5bc5a7[_0x7968('0x3c')][_0x7968('0x44')]);_0x4969c0[_0x7968('0x45')]=qs[_0x7968('0x3e')](_[_0x7968('0x46')](_0x5bc5a7[_0x7968('0x3c')],_0x3adc63['filters']),_0x48d97f);if(_0x5bc5a7[_0x7968('0x3c')][_0x7968('0x47')]){_0x4969c0[_0x7968('0x45')]=_[_0x7968('0x48')](_0x4969c0[_0x7968('0x45')],{'$or':_['map'](_0x48d97f,function(_0x3f1aa6){if(_0x3f1aa6[_0x7968('0x3a')]!=='VIRTUAL'){var _0x4045e9={};_0x4045e9[_0x3f1aa6[_0x7968('0x34')]]={'$like':'%'+_0x5bc5a7['query'][_0x7968('0x47')]+'%'};return _0x4045e9;}})});}_0x4969c0=_[_0x7968('0x48')]({},_0x4969c0,_0x5bc5a7[_0x7968('0x49')]);var _0x24c047={'where':_0x4969c0[_0x7968('0x45')]};return db[_0x7968('0x37')]['count'](_0x24c047)[_0x7968('0x1e')](function(_0x2b6072){_0x49c54f[_0x7968('0x4a')]=_0x2b6072;if(_0x5bc5a7[_0x7968('0x3c')][_0x7968('0x4b')]){_0x4969c0[_0x7968('0x4c')]=[{'all':!![]}];}return db[_0x7968('0x37')]['findAll'](_0x4969c0);})['then'](function(_0x2d3295){_0x49c54f[_0x7968('0x4d')]=_0x2d3295;return _0x49c54f;})[_0x7968('0x1e')](respondWithFilteredResult(_0x11a4f4,_0x4969c0))[_0x7968('0x27')](handleError(_0x11a4f4,null));};exports[_0x7968('0x4e')]=function(_0x242723,_0x472bac){var _0x21b2ba={'raw':![],'where':{'id':_0x242723[_0x7968('0x4f')]['id']}},_0x3fde27={};_0x3fde27[_0x7968('0x3b')]=_[_0x7968('0x3d')](db[_0x7968('0x37')]['rawAttributes']);_0x3fde27[_0x7968('0x3c')]=_['keys'](_0x242723[_0x7968('0x3c')]);_0x3fde27[_0x7968('0x3e')]=_[_0x7968('0x3f')](_0x3fde27[_0x7968('0x3b')],_0x3fde27[_0x7968('0x3c')]);_0x21b2ba[_0x7968('0x40')]=_[_0x7968('0x3f')](_0x3fde27['model'],qs[_0x7968('0x41')](_0x242723['query'][_0x7968('0x41')]));_0x21b2ba['attributes']=_0x21b2ba['attributes'][_0x7968('0x42')]?_0x21b2ba[_0x7968('0x40')]:_0x3fde27['model'];if(_0x242723[_0x7968('0x3c')][_0x7968('0x4b')]){_0x21b2ba[_0x7968('0x4c')]=[{'all':!![]}];}_0x21b2ba=_['merge']({},_0x21b2ba,_0x242723[_0x7968('0x49')]);return db[_0x7968('0x37')]['find'](_0x21b2ba)[_0x7968('0x1e')](handleEntityNotFound(_0x472bac,null))[_0x7968('0x1e')](respondWithResult(_0x472bac,null))[_0x7968('0x27')](handleError(_0x472bac,null));};exports[_0x7968('0x50')]=function(_0x4359ee,_0x593604){return db[_0x7968('0x37')][_0x7968('0x50')](_0x4359ee[_0x7968('0x51')],{})[_0x7968('0x1e')](respondWithResult(_0x593604,0xc9))[_0x7968('0x27')](handleError(_0x593604,null));};exports['update']=function(_0xa801a7,_0x14ca9c){if(_0xa801a7[_0x7968('0x51')]['id']){delete _0xa801a7[_0x7968('0x51')]['id'];}return db[_0x7968('0x37')]['find']({'where':{'id':_0xa801a7[_0x7968('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14ca9c,null))[_0x7968('0x1e')](saveUpdates(_0xa801a7[_0x7968('0x51')],null))[_0x7968('0x1e')](respondWithResult(_0x14ca9c,null))[_0x7968('0x27')](handleError(_0x14ca9c,null));};exports['destroy']=function(_0x288763,_0x11d160){return db[_0x7968('0x37')][_0x7968('0x52')]({'where':{'id':_0x288763['params']['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x11d160,null))[_0x7968('0x1e')](removeEntity(_0x11d160,null))[_0x7968('0x27')](handleError(_0x11d160,null));};exports[_0x7968('0x53')]=function(_0x4a507e,_0x42461b,_0x493772){var _0x3d2cc4={};var _0x21c247={};var _0x5be60b;var _0x2d36f9;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4a507e[_0x7968('0x4f')]['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x42461b,null))[_0x7968('0x1e')](function(_0xa6d9d2){if(_0xa6d9d2){_0x5be60b=_0xa6d9d2;_0x21c247[_0x7968('0x3b')]=_[_0x7968('0x3d')](db[_0x7968('0x54')]['rawAttributes']);_0x21c247['query']=_['keys'](_0x4a507e[_0x7968('0x3c')]);_0x21c247[_0x7968('0x3e')]=_['intersection'](_0x21c247[_0x7968('0x3b')],_0x21c247[_0x7968('0x3c')]);_0x3d2cc4[_0x7968('0x40')]=_['intersection'](_0x21c247[_0x7968('0x3b')],qs['fields'](_0x4a507e[_0x7968('0x3c')][_0x7968('0x41')]));_0x3d2cc4[_0x7968('0x40')]=_0x3d2cc4[_0x7968('0x40')]['length']?_0x3d2cc4['attributes']:_0x21c247['model'];_0x3d2cc4[_0x7968('0x55')]=qs[_0x7968('0x44')](_0x4a507e[_0x7968('0x3c')][_0x7968('0x44')]);_0x3d2cc4[_0x7968('0x45')]=qs[_0x7968('0x3e')](_[_0x7968('0x46')](_0x4a507e[_0x7968('0x3c')],_0x21c247['filters']));if(_0x4a507e['query']['filter']){_0x3d2cc4[_0x7968('0x45')]=_['merge'](_0x3d2cc4['where'],{'$or':_['map'](_0x3d2cc4['attributes'],function(_0x2a656f){var _0x3766d0={};_0x3766d0[_0x2a656f]={'$like':'%'+_0x4a507e[_0x7968('0x3c')][_0x7968('0x47')]+'%'};return _0x3766d0;})});}_0x3d2cc4=_[_0x7968('0x48')]({},_0x3d2cc4,_0x4a507e[_0x7968('0x49')]);return _0x5be60b['getFields'](_0x3d2cc4);}})[_0x7968('0x1e')](function(_0xa4f807){if(_0xa4f807){_0x2d36f9=_0xa4f807[_0x7968('0x42')];if(!_0x4a507e[_0x7968('0x3c')][_0x7968('0x56')](_0x7968('0x43'))){_0x3d2cc4['limit']=qs['limit'](_0x4a507e['query'][_0x7968('0x2d')]);_0x3d2cc4['offset']=qs[_0x7968('0x2c')](_0x4a507e[_0x7968('0x3c')][_0x7968('0x2c')]);}return _0x5be60b[_0x7968('0x53')](_0x3d2cc4);}})['then'](function(_0x428fa8){if(_0x428fa8){return _0x428fa8?{'count':_0x2d36f9,'rows':_0x428fa8}:null;}})[_0x7968('0x1e')](respondWithResult(_0x42461b,null))[_0x7968('0x27')](handleError(_0x42461b,null));};exports[_0x7968('0x57')]=function(_0x52466a,_0x57cf5a,_0x459f6a){var _0x13c130={};var _0xe6d1b1={};var _0x4fba7b;var _0x2668f3;return db['ZendeskConfiguration'][_0x7968('0x58')]({'where':{'id':_0x52466a[_0x7968('0x4f')]['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x57cf5a,null))['then'](function(_0x4548ba){if(_0x4548ba){_0x4fba7b=_0x4548ba;_0xe6d1b1[_0x7968('0x3b')]=_[_0x7968('0x3d')](db['ZendeskField'][_0x7968('0x38')]);_0xe6d1b1['query']=_['keys'](_0x52466a[_0x7968('0x3c')]);_0xe6d1b1[_0x7968('0x3e')]=_[_0x7968('0x3f')](_0xe6d1b1[_0x7968('0x3b')],_0xe6d1b1[_0x7968('0x3c')]);_0x13c130[_0x7968('0x40')]=_[_0x7968('0x3f')](_0xe6d1b1['model'],qs[_0x7968('0x41')](_0x52466a[_0x7968('0x3c')][_0x7968('0x41')]));_0x13c130[_0x7968('0x40')]=_0x13c130[_0x7968('0x40')][_0x7968('0x42')]?_0x13c130[_0x7968('0x40')]:_0xe6d1b1[_0x7968('0x3b')];_0x13c130[_0x7968('0x55')]=qs[_0x7968('0x44')](_0x52466a['query'][_0x7968('0x44')]);_0x13c130['where']=qs['filters'](_[_0x7968('0x46')](_0x52466a[_0x7968('0x3c')],_0xe6d1b1[_0x7968('0x3e')]));if(_0x52466a[_0x7968('0x3c')][_0x7968('0x47')]){_0x13c130[_0x7968('0x45')]=_[_0x7968('0x48')](_0x13c130[_0x7968('0x45')],{'$or':_['map'](_0x13c130['attributes'],function(_0x30e0e4){var _0x2a248c={};_0x2a248c[_0x30e0e4]={'$like':'%'+_0x52466a[_0x7968('0x3c')][_0x7968('0x47')]+'%'};return _0x2a248c;})});}_0x13c130=_['merge']({},_0x13c130,_0x52466a[_0x7968('0x49')]);return _0x4fba7b['getSubjects'](_0x13c130);}})[_0x7968('0x1e')](function(_0x395c04){if(_0x395c04){_0x2668f3=_0x395c04['length'];if(!_0x52466a['query'][_0x7968('0x56')](_0x7968('0x43'))){_0x13c130[_0x7968('0x2d')]=qs['limit'](_0x52466a[_0x7968('0x3c')][_0x7968('0x2d')]);_0x13c130['offset']=qs[_0x7968('0x2c')](_0x52466a[_0x7968('0x3c')][_0x7968('0x2c')]);}return _0x4fba7b[_0x7968('0x57')](_0x13c130);}})['then'](function(_0xcaf063){if(_0xcaf063){return _0xcaf063?{'count':_0x2668f3,'rows':_0xcaf063}:null;}})[_0x7968('0x1e')](respondWithResult(_0x57cf5a,null))[_0x7968('0x27')](handleError(_0x57cf5a,null));};exports[_0x7968('0x59')]=function(_0x458416,_0x597bd4,_0x536add){var _0x1cb527={};var _0x158d10={};var _0x6c06cf;var _0x5ca607;return db['ZendeskConfiguration'][_0x7968('0x58')]({'where':{'id':_0x458416[_0x7968('0x4f')]['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x597bd4,null))['then'](function(_0x12f674){if(_0x12f674){_0x6c06cf=_0x12f674;_0x158d10[_0x7968('0x3b')]=_[_0x7968('0x3d')](db[_0x7968('0x54')]['rawAttributes']);_0x158d10['query']=_[_0x7968('0x3d')](_0x458416[_0x7968('0x3c')]);_0x158d10[_0x7968('0x3e')]=_['intersection'](_0x158d10[_0x7968('0x3b')],_0x158d10['query']);_0x1cb527[_0x7968('0x40')]=_[_0x7968('0x3f')](_0x158d10[_0x7968('0x3b')],qs[_0x7968('0x41')](_0x458416[_0x7968('0x3c')][_0x7968('0x41')]));_0x1cb527[_0x7968('0x40')]=_0x1cb527[_0x7968('0x40')]['length']?_0x1cb527[_0x7968('0x40')]:_0x158d10['model'];_0x1cb527[_0x7968('0x55')]=qs[_0x7968('0x44')](_0x458416[_0x7968('0x3c')][_0x7968('0x44')]);_0x1cb527[_0x7968('0x45')]=qs[_0x7968('0x3e')](_[_0x7968('0x46')](_0x458416[_0x7968('0x3c')],_0x158d10['filters']));if(_0x458416[_0x7968('0x3c')][_0x7968('0x47')]){_0x1cb527[_0x7968('0x45')]=_[_0x7968('0x48')](_0x1cb527['where'],{'$or':_[_0x7968('0x36')](_0x1cb527[_0x7968('0x40')],function(_0x297308){var _0x982d91={};_0x982d91[_0x297308]={'$like':'%'+_0x458416[_0x7968('0x3c')][_0x7968('0x47')]+'%'};return _0x982d91;})});}_0x1cb527=_[_0x7968('0x48')]({},_0x1cb527,_0x458416[_0x7968('0x49')]);return _0x6c06cf[_0x7968('0x59')](_0x1cb527);}})['then'](function(_0x5effe3){if(_0x5effe3){_0x5ca607=_0x5effe3[_0x7968('0x42')];if(!_0x458416[_0x7968('0x3c')]['hasOwnProperty']('nolimit')){_0x1cb527['limit']=qs[_0x7968('0x2d')](_0x458416[_0x7968('0x3c')][_0x7968('0x2d')]);_0x1cb527[_0x7968('0x2c')]=qs[_0x7968('0x2c')](_0x458416[_0x7968('0x3c')]['offset']);}return _0x6c06cf[_0x7968('0x59')](_0x1cb527);}})[_0x7968('0x1e')](function(_0x256050){if(_0x256050){return _0x256050?{'count':_0x5ca607,'rows':_0x256050}:null;}})['then'](respondWithResult(_0x597bd4,null))['catch'](handleError(_0x597bd4,null));};exports[_0x7968('0x5a')]=function(_0xf64110,_0x288996,_0x26709d){var _0x39462d={};var _0x429dc1={};var _0x5c3c9d;var _0x1beb8e;return db[_0x7968('0x37')][_0x7968('0x58')]({'where':{'id':_0xf64110[_0x7968('0x4f')]['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x288996,null))[_0x7968('0x1e')](function(_0x2032f7){if(_0x2032f7){_0x5c3c9d=_0x2032f7;_0x429dc1['model']=_['keys'](db['Tag'][_0x7968('0x38')]);_0x429dc1[_0x7968('0x3c')]=_[_0x7968('0x3d')](_0xf64110[_0x7968('0x3c')]);_0x429dc1[_0x7968('0x3e')]=_[_0x7968('0x3f')](_0x429dc1['model'],_0x429dc1['query']);_0x39462d['attributes']=_[_0x7968('0x3f')](_0x429dc1[_0x7968('0x3b')],qs[_0x7968('0x41')](_0xf64110[_0x7968('0x3c')][_0x7968('0x41')]));_0x39462d[_0x7968('0x40')]=_0x39462d[_0x7968('0x40')][_0x7968('0x42')]?_0x39462d[_0x7968('0x40')]:_0x429dc1[_0x7968('0x3b')];_0x39462d['order']=qs['sort'](_0xf64110[_0x7968('0x3c')][_0x7968('0x44')]);_0x39462d['where']=qs[_0x7968('0x3e')](_[_0x7968('0x46')](_0xf64110['query'],_0x429dc1[_0x7968('0x3e')]));if(_0xf64110[_0x7968('0x3c')]['filter']){_0x39462d[_0x7968('0x45')]=_['merge'](_0x39462d['where'],{'$or':_[_0x7968('0x36')](_0x39462d[_0x7968('0x40')],function(_0x56777a){var _0x1f62cf={};_0x1f62cf[_0x56777a]={'$like':'%'+_0xf64110[_0x7968('0x3c')][_0x7968('0x47')]+'%'};return _0x1f62cf;})});}_0x39462d=_[_0x7968('0x48')]({},_0x39462d,_0xf64110[_0x7968('0x49')]);return _0x5c3c9d['getTags'](_0x39462d);}})[_0x7968('0x1e')](function(_0xaa867d){if(_0xaa867d){_0x1beb8e=_0xaa867d['length'];if(!_0xf64110[_0x7968('0x3c')][_0x7968('0x56')]('nolimit')){_0x39462d['limit']=qs[_0x7968('0x2d')](_0xf64110[_0x7968('0x3c')][_0x7968('0x2d')]);_0x39462d[_0x7968('0x2c')]=qs[_0x7968('0x2c')](_0xf64110[_0x7968('0x3c')][_0x7968('0x2c')]);}return _0x5c3c9d[_0x7968('0x5a')](_0x39462d);}})['then'](function(_0x128906){if(_0x128906){return _0x128906?{'count':_0x1beb8e,'rows':_0x128906}:null;}})[_0x7968('0x1e')](respondWithResult(_0x288996,null))[_0x7968('0x27')](handleError(_0x288996,null));};exports[_0x7968('0x5b')]=function(_0x5a2af0,_0x3cd3ec,_0x4c2195){if(_0x5a2af0[_0x7968('0x51')]['id']){delete _0x5a2af0[_0x7968('0x51')]['id'];}return db[_0x7968('0x37')]['findOne']({'where':{'id':_0x5a2af0[_0x7968('0x4f')]['id']}})[_0x7968('0x1e')](handleEntityNotFound(_0x3cd3ec,null))[_0x7968('0x1e')](function(_0x1ed42e){if(_0x1ed42e){return _0x1ed42e[_0x7968('0x5b')](_0x5a2af0[_0x7968('0x51')][_0x7968('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x3cd3ec,null))[_0x7968('0x27')](handleError(_0x3cd3ec,null));}; \ No newline at end of file +var _0x9c6b=['querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','count','includeAll','ZendeskConfiguration','findAll','rows','show','rawAttributes','include','merge','find','create','body','params','getFields','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5eae11,_0x26f7a4){var _0x454f86=function(_0x3a2fde){while(--_0x3a2fde){_0x5eae11['push'](_0x5eae11['shift']());}};_0x454f86(++_0x26f7a4);}(_0x9c6b,0x174));var _0xb9c6=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x9c6b[_0x4ab3fb];return _0x34fe1e;};'use strict';var pdf=require(_0xb9c6('0x0'));var emlformat=require(_0xb9c6('0x1'));var rimraf=require(_0xb9c6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9c6('0x3'));var rp=require('request-promise');var moment=require(_0xb9c6('0x4'));var BPromise=require(_0xb9c6('0x5'));var Mustache=require(_0xb9c6('0x6'));var util=require('util');var path=require(_0xb9c6('0x7'));var sox=require(_0xb9c6('0x8'));var csv=require(_0xb9c6('0x9'));var ejs=require(_0xb9c6('0xa'));var fs=require('fs');var _=require(_0xb9c6('0xb'));var squel=require(_0xb9c6('0xc'));var crypto=require(_0xb9c6('0xd'));var jsforce=require(_0xb9c6('0xe'));var deskjs=require(_0xb9c6('0xf'));var toCsv=require(_0xb9c6('0x9'));var querystring=require(_0xb9c6('0x10'));var Papa=require(_0xb9c6('0x11'));var Redis=require(_0xb9c6('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9c6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb9c6('0x14'));var config=require('../../config/environment');var db=require(_0xb9c6('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb9c6('0x16')]({'port':0x232a});function checkPasswordPattern(_0x184b59,_0x2dea5b,_0x48dfa7){if(_0x48dfa7){var _0xc0d609=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc0d609[_0xb9c6('0x17')](_0x2dea5b)){return _0x184b59;}else{throw new db[(_0xb9c6('0x18'))][(_0xb9c6('0x19'))](_0xb9c6('0x1a'));}}else{return _0x184b59;}}function respondWithRpcPromise(_0x3e42b1,_0x3e448b,_0x52edc2,_0x2bcaca){return new BPromise(function(_0x10e3c6,_0x4e9258){var _0x4506ab=_0x2bcaca||client;return _0x4506ab[_0xb9c6('0x1b')](_0x3e42b1,_0x52edc2)['then'](function(_0x13a4a1){logger[_0xb9c6('0x1c')](_0xb9c6('0x1d'),_0x3e448b,_0xb9c6('0x1e'));logger['debug'](_0xb9c6('0x1f'),_0x3e448b,_0xb9c6('0x1e'),JSON[_0xb9c6('0x20')](_0x13a4a1));if(_0x13a4a1['error']){if(_0x13a4a1[_0xb9c6('0x21')][_0xb9c6('0x22')]===0x1f4){logger[_0xb9c6('0x21')](_0xb9c6('0x1d'),_0x3e448b,_0x13a4a1[_0xb9c6('0x21')][_0xb9c6('0x23')]);return _0x4e9258(_0x13a4a1['error'][_0xb9c6('0x23')]);}logger[_0xb9c6('0x21')](_0xb9c6('0x1d'),_0x3e448b,_0x13a4a1[_0xb9c6('0x21')][_0xb9c6('0x23')]);return _0x10e3c6(_0x13a4a1[_0xb9c6('0x21')][_0xb9c6('0x23')]);}else{logger[_0xb9c6('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3e448b,'request\x20sent');_0x10e3c6(_0x13a4a1[_0xb9c6('0x24')][_0xb9c6('0x23')]);}})[_0xb9c6('0x25')](function(_0x29374c){logger[_0xb9c6('0x21')](_0xb9c6('0x1d'),_0x3e448b,_0x29374c);_0x4e9258(_0x29374c);});});}function respondWithStatusCode(_0x193de2,_0x443b31){_0x443b31=_0x443b31||0xcc;return function(_0x10d745){if(_0x10d745){return _0x193de2['sendStatus'](_0x443b31);}return _0x193de2[_0xb9c6('0x26')](_0x443b31)[_0xb9c6('0x27')]();};}function respondWithResult(_0x402f06,_0x2113de){_0x2113de=_0x2113de||0xc8;return function(_0x3af73e){if(_0x3af73e){return _0x402f06[_0xb9c6('0x26')](_0x2113de)[_0xb9c6('0x28')](_0x3af73e);}};}function respondWithFilteredResult(_0x254273,_0x189d59){return function(_0x2fe33d){if(_0x2fe33d){var _0x56cf01=_0x2fe33d['count'],_0x393560=_0x189d59[_0xb9c6('0x29')],_0x2da57e=_0x189d59[_0xb9c6('0x29')]+_0x189d59['limit'],_0x1d04e4;if(_0x2da57e>=_0x56cf01){_0x2da57e=_0x56cf01;_0x1d04e4=0xc8;}else{_0x1d04e4=0xce;}_0x254273['status'](_0x1d04e4);return _0x254273[_0xb9c6('0x2a')](_0xb9c6('0x2b'),_0x393560+'-'+_0x2da57e+'/'+_0x56cf01)[_0xb9c6('0x28')](_0x2fe33d);}return null;};}function patchUpdates(_0x4ad409){return function(_0x443560){try{jsonpatch[_0xb9c6('0x2c')](_0x443560,_0x4ad409,!![]);}catch(_0x59578f){return BPromise[_0xb9c6('0x2d')](_0x59578f);}return _0x443560[_0xb9c6('0x2e')]();};}function saveUpdates(_0x26346e,_0x36a5fe){return function(_0x358e31){if(_0x358e31){return _0x358e31[_0xb9c6('0x2f')](_0x26346e)[_0xb9c6('0x30')](function(_0x16d0e2){return _0x16d0e2;});}return null;};}function removeEntity(_0x2a3047,_0x566a0b){return function(_0x5eed5c){if(_0x5eed5c){return _0x5eed5c[_0xb9c6('0x31')]()[_0xb9c6('0x30')](function(){_0x2a3047[_0xb9c6('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473445,_0x1062a5){return function(_0x7ffa27){if(!_0x7ffa27){_0x473445[_0xb9c6('0x32')](0x194);}return _0x7ffa27;};}function handleError(_0x1576c2,_0x332618){_0x332618=_0x332618||0x1f4;return function(_0x23fc50){logger[_0xb9c6('0x21')](_0x23fc50[_0xb9c6('0x33')]);if(_0x23fc50[_0xb9c6('0x34')]){delete _0x23fc50[_0xb9c6('0x34')];}_0x1576c2[_0xb9c6('0x26')](_0x332618)[_0xb9c6('0x35')](_0x23fc50);};}exports[_0xb9c6('0x36')]=function(_0x448c52,_0x4da026){var _0x2859f0={},_0x59575c={},_0x1bbae9={'count':0x0,'rows':[]};var _0x1c4e57=_[_0xb9c6('0x37')](db['ZendeskConfiguration']['rawAttributes'],function(_0x1951cb){return{'name':_0x1951cb['fieldName'],'type':_0x1951cb[_0xb9c6('0x38')][_0xb9c6('0x39')]};});_0x59575c[_0xb9c6('0x3a')]=_['map'](_0x1c4e57,'name');_0x59575c[_0xb9c6('0x3b')]=_[_0xb9c6('0x3c')](_0x448c52[_0xb9c6('0x3b')]);_0x59575c[_0xb9c6('0x3d')]=_[_0xb9c6('0x3e')](_0x59575c[_0xb9c6('0x3a')],_0x59575c[_0xb9c6('0x3b')]);_0x2859f0['attributes']=_[_0xb9c6('0x3e')](_0x59575c[_0xb9c6('0x3a')],qs[_0xb9c6('0x3f')](_0x448c52['query'][_0xb9c6('0x3f')]));_0x2859f0['attributes']=_0x2859f0[_0xb9c6('0x40')][_0xb9c6('0x41')]?_0x2859f0[_0xb9c6('0x40')]:_0x59575c['model'];if(!_0x448c52[_0xb9c6('0x3b')][_0xb9c6('0x42')](_0xb9c6('0x43'))){_0x2859f0[_0xb9c6('0x44')]=qs[_0xb9c6('0x44')](_0x448c52[_0xb9c6('0x3b')][_0xb9c6('0x44')]);_0x2859f0['offset']=qs[_0xb9c6('0x29')](_0x448c52['query'][_0xb9c6('0x29')]);}_0x2859f0[_0xb9c6('0x45')]=qs['sort'](_0x448c52[_0xb9c6('0x3b')][_0xb9c6('0x46')]);_0x2859f0[_0xb9c6('0x47')]=qs[_0xb9c6('0x3d')](_[_0xb9c6('0x48')](_0x448c52[_0xb9c6('0x3b')],_0x59575c['filters']),_0x1c4e57);if(_0x448c52['query'][_0xb9c6('0x49')]){_0x2859f0[_0xb9c6('0x47')]=_['merge'](_0x2859f0[_0xb9c6('0x47')],{'$or':_['map'](_0x1c4e57,function(_0xdab62d){if(_0xdab62d[_0xb9c6('0x38')]!=='VIRTUAL'){var _0x64db28={};_0x64db28[_0xdab62d['name']]={'$like':'%'+_0x448c52[_0xb9c6('0x3b')][_0xb9c6('0x49')]+'%'};return _0x64db28;}})});}_0x2859f0=_['merge']({},_0x2859f0,_0x448c52[_0xb9c6('0x4a')]);var _0x18e0ca={'where':_0x2859f0['where']};return db['ZendeskConfiguration'][_0xb9c6('0x4b')](_0x18e0ca)[_0xb9c6('0x30')](function(_0x58c3bb){_0x1bbae9[_0xb9c6('0x4b')]=_0x58c3bb;if(_0x448c52[_0xb9c6('0x3b')][_0xb9c6('0x4c')]){_0x2859f0['include']=[{'all':!![]}];}return db[_0xb9c6('0x4d')][_0xb9c6('0x4e')](_0x2859f0);})[_0xb9c6('0x30')](function(_0x33d0e0){_0x1bbae9[_0xb9c6('0x4f')]=_0x33d0e0;return _0x1bbae9;})[_0xb9c6('0x30')](respondWithFilteredResult(_0x4da026,_0x2859f0))['catch'](handleError(_0x4da026,null));};exports[_0xb9c6('0x50')]=function(_0x46733f,_0x3ebbcc){var _0x42e594={'raw':![],'where':{'id':_0x46733f['params']['id']}},_0x4996f3={};_0x4996f3[_0xb9c6('0x3a')]=_[_0xb9c6('0x3c')](db['ZendeskConfiguration'][_0xb9c6('0x51')]);_0x4996f3['query']=_[_0xb9c6('0x3c')](_0x46733f[_0xb9c6('0x3b')]);_0x4996f3['filters']=_[_0xb9c6('0x3e')](_0x4996f3['model'],_0x4996f3[_0xb9c6('0x3b')]);_0x42e594[_0xb9c6('0x40')]=_[_0xb9c6('0x3e')](_0x4996f3[_0xb9c6('0x3a')],qs['fields'](_0x46733f['query'][_0xb9c6('0x3f')]));_0x42e594[_0xb9c6('0x40')]=_0x42e594[_0xb9c6('0x40')][_0xb9c6('0x41')]?_0x42e594[_0xb9c6('0x40')]:_0x4996f3[_0xb9c6('0x3a')];if(_0x46733f[_0xb9c6('0x3b')][_0xb9c6('0x4c')]){_0x42e594[_0xb9c6('0x52')]=[{'all':!![]}];}_0x42e594=_[_0xb9c6('0x53')]({},_0x42e594,_0x46733f[_0xb9c6('0x4a')]);return db[_0xb9c6('0x4d')][_0xb9c6('0x54')](_0x42e594)[_0xb9c6('0x30')](handleEntityNotFound(_0x3ebbcc,null))[_0xb9c6('0x30')](respondWithResult(_0x3ebbcc,null))[_0xb9c6('0x25')](handleError(_0x3ebbcc,null));};exports[_0xb9c6('0x55')]=function(_0x569ddd,_0x24f24b){return db[_0xb9c6('0x4d')][_0xb9c6('0x55')](_0x569ddd['body'],{})[_0xb9c6('0x30')](respondWithResult(_0x24f24b,0xc9))[_0xb9c6('0x25')](handleError(_0x24f24b,null));};exports[_0xb9c6('0x2f')]=function(_0x268a7f,_0x5f0691){if(_0x268a7f[_0xb9c6('0x56')]['id']){delete _0x268a7f['body']['id'];}return db[_0xb9c6('0x4d')][_0xb9c6('0x54')]({'where':{'id':_0x268a7f[_0xb9c6('0x57')]['id']}})[_0xb9c6('0x30')](handleEntityNotFound(_0x5f0691,null))[_0xb9c6('0x30')](saveUpdates(_0x268a7f[_0xb9c6('0x56')],null))[_0xb9c6('0x30')](respondWithResult(_0x5f0691,null))[_0xb9c6('0x25')](handleError(_0x5f0691,null));};exports['destroy']=function(_0x13fc50,_0x1b55bc){return db['ZendeskConfiguration'][_0xb9c6('0x54')]({'where':{'id':_0x13fc50[_0xb9c6('0x57')]['id']}})[_0xb9c6('0x30')](handleEntityNotFound(_0x1b55bc,null))[_0xb9c6('0x30')](removeEntity(_0x1b55bc,null))[_0xb9c6('0x25')](handleError(_0x1b55bc,null));};exports[_0xb9c6('0x58')]=function(_0x2718ab,_0x5bd5c4,_0x202112){var _0x49f56d={};var _0x5759e5={};var _0x12e1aa;var _0x3b13e6;return db[_0xb9c6('0x4d')]['findOne']({'where':{'id':_0x2718ab[_0xb9c6('0x57')]['id']}})['then'](handleEntityNotFound(_0x5bd5c4,null))[_0xb9c6('0x30')](function(_0x536f1f){if(_0x536f1f){_0x12e1aa=_0x536f1f;_0x5759e5['model']=_['keys'](db['ZendeskField'][_0xb9c6('0x51')]);_0x5759e5[_0xb9c6('0x3b')]=_[_0xb9c6('0x3c')](_0x2718ab[_0xb9c6('0x3b')]);_0x5759e5['filters']=_[_0xb9c6('0x3e')](_0x5759e5[_0xb9c6('0x3a')],_0x5759e5[_0xb9c6('0x3b')]);_0x49f56d[_0xb9c6('0x40')]=_[_0xb9c6('0x3e')](_0x5759e5[_0xb9c6('0x3a')],qs[_0xb9c6('0x3f')](_0x2718ab[_0xb9c6('0x3b')]['fields']));_0x49f56d[_0xb9c6('0x40')]=_0x49f56d[_0xb9c6('0x40')][_0xb9c6('0x41')]?_0x49f56d[_0xb9c6('0x40')]:_0x5759e5[_0xb9c6('0x3a')];_0x49f56d[_0xb9c6('0x45')]=qs[_0xb9c6('0x46')](_0x2718ab[_0xb9c6('0x3b')]['sort']);_0x49f56d[_0xb9c6('0x47')]=qs[_0xb9c6('0x3d')](_['pick'](_0x2718ab[_0xb9c6('0x3b')],_0x5759e5[_0xb9c6('0x3d')]));if(_0x2718ab['query'][_0xb9c6('0x49')]){_0x49f56d[_0xb9c6('0x47')]=_[_0xb9c6('0x53')](_0x49f56d[_0xb9c6('0x47')],{'$or':_[_0xb9c6('0x37')](_0x49f56d[_0xb9c6('0x40')],function(_0x1ab568){var _0x50c041={};_0x50c041[_0x1ab568]={'$like':'%'+_0x2718ab['query']['filter']+'%'};return _0x50c041;})});}_0x49f56d=_[_0xb9c6('0x53')]({},_0x49f56d,_0x2718ab[_0xb9c6('0x4a')]);return _0x12e1aa[_0xb9c6('0x58')](_0x49f56d);}})[_0xb9c6('0x30')](function(_0x18867f){if(_0x18867f){_0x3b13e6=_0x18867f['length'];if(!_0x2718ab['query'][_0xb9c6('0x42')]('nolimit')){_0x49f56d[_0xb9c6('0x44')]=qs[_0xb9c6('0x44')](_0x2718ab[_0xb9c6('0x3b')]['limit']);_0x49f56d[_0xb9c6('0x29')]=qs[_0xb9c6('0x29')](_0x2718ab[_0xb9c6('0x3b')][_0xb9c6('0x29')]);}return _0x12e1aa[_0xb9c6('0x58')](_0x49f56d);}})[_0xb9c6('0x30')](function(_0x5b4ff8){if(_0x5b4ff8){return _0x5b4ff8?{'count':_0x3b13e6,'rows':_0x5b4ff8}:null;}})[_0xb9c6('0x30')](respondWithResult(_0x5bd5c4,null))[_0xb9c6('0x25')](handleError(_0x5bd5c4,null));};exports[_0xb9c6('0x59')]=function(_0x48f34d,_0x45f624,_0x2c3b5b){var _0x12f65d={};var _0x131603={};var _0x2167fb;var _0x2190fb;return db[_0xb9c6('0x4d')][_0xb9c6('0x5a')]({'where':{'id':_0x48f34d['params']['id']}})['then'](handleEntityNotFound(_0x45f624,null))[_0xb9c6('0x30')](function(_0x4a50ac){if(_0x4a50ac){_0x2167fb=_0x4a50ac;_0x131603[_0xb9c6('0x3a')]=_[_0xb9c6('0x3c')](db[_0xb9c6('0x5b')][_0xb9c6('0x51')]);_0x131603[_0xb9c6('0x3b')]=_[_0xb9c6('0x3c')](_0x48f34d[_0xb9c6('0x3b')]);_0x131603[_0xb9c6('0x3d')]=_[_0xb9c6('0x3e')](_0x131603['model'],_0x131603['query']);_0x12f65d[_0xb9c6('0x40')]=_[_0xb9c6('0x3e')](_0x131603[_0xb9c6('0x3a')],qs[_0xb9c6('0x3f')](_0x48f34d[_0xb9c6('0x3b')]['fields']));_0x12f65d['attributes']=_0x12f65d['attributes'][_0xb9c6('0x41')]?_0x12f65d[_0xb9c6('0x40')]:_0x131603[_0xb9c6('0x3a')];_0x12f65d[_0xb9c6('0x45')]=qs[_0xb9c6('0x46')](_0x48f34d[_0xb9c6('0x3b')][_0xb9c6('0x46')]);_0x12f65d[_0xb9c6('0x47')]=qs[_0xb9c6('0x3d')](_[_0xb9c6('0x48')](_0x48f34d['query'],_0x131603[_0xb9c6('0x3d')]));if(_0x48f34d[_0xb9c6('0x3b')][_0xb9c6('0x49')]){_0x12f65d['where']=_[_0xb9c6('0x53')](_0x12f65d[_0xb9c6('0x47')],{'$or':_['map'](_0x12f65d['attributes'],function(_0x40f550){var _0x453f9c={};_0x453f9c[_0x40f550]={'$like':'%'+_0x48f34d[_0xb9c6('0x3b')][_0xb9c6('0x49')]+'%'};return _0x453f9c;})});}_0x12f65d=_[_0xb9c6('0x53')]({},_0x12f65d,_0x48f34d[_0xb9c6('0x4a')]);return _0x2167fb[_0xb9c6('0x59')](_0x12f65d);}})[_0xb9c6('0x30')](function(_0x52373b){if(_0x52373b){_0x2190fb=_0x52373b[_0xb9c6('0x41')];if(!_0x48f34d[_0xb9c6('0x3b')]['hasOwnProperty'](_0xb9c6('0x43'))){_0x12f65d['limit']=qs[_0xb9c6('0x44')](_0x48f34d[_0xb9c6('0x3b')][_0xb9c6('0x44')]);_0x12f65d[_0xb9c6('0x29')]=qs['offset'](_0x48f34d[_0xb9c6('0x3b')][_0xb9c6('0x29')]);}return _0x2167fb[_0xb9c6('0x59')](_0x12f65d);}})[_0xb9c6('0x30')](function(_0x2ac4cb){if(_0x2ac4cb){return _0x2ac4cb?{'count':_0x2190fb,'rows':_0x2ac4cb}:null;}})[_0xb9c6('0x30')](respondWithResult(_0x45f624,null))['catch'](handleError(_0x45f624,null));};exports['getDescriptions']=function(_0xbf4066,_0x5f453e,_0x2533a8){var _0xe3d3c5={};var _0x250c73={};var _0x1b43cc;var _0x3139ac;return db['ZendeskConfiguration'][_0xb9c6('0x5a')]({'where':{'id':_0xbf4066[_0xb9c6('0x57')]['id']}})[_0xb9c6('0x30')](handleEntityNotFound(_0x5f453e,null))[_0xb9c6('0x30')](function(_0x2c198){if(_0x2c198){_0x1b43cc=_0x2c198;_0x250c73['model']=_[_0xb9c6('0x3c')](db['ZendeskField'][_0xb9c6('0x51')]);_0x250c73[_0xb9c6('0x3b')]=_[_0xb9c6('0x3c')](_0xbf4066['query']);_0x250c73[_0xb9c6('0x3d')]=_[_0xb9c6('0x3e')](_0x250c73[_0xb9c6('0x3a')],_0x250c73[_0xb9c6('0x3b')]);_0xe3d3c5[_0xb9c6('0x40')]=_[_0xb9c6('0x3e')](_0x250c73[_0xb9c6('0x3a')],qs[_0xb9c6('0x3f')](_0xbf4066[_0xb9c6('0x3b')][_0xb9c6('0x3f')]));_0xe3d3c5[_0xb9c6('0x40')]=_0xe3d3c5[_0xb9c6('0x40')][_0xb9c6('0x41')]?_0xe3d3c5[_0xb9c6('0x40')]:_0x250c73[_0xb9c6('0x3a')];_0xe3d3c5[_0xb9c6('0x45')]=qs[_0xb9c6('0x46')](_0xbf4066['query']['sort']);_0xe3d3c5[_0xb9c6('0x47')]=qs['filters'](_[_0xb9c6('0x48')](_0xbf4066['query'],_0x250c73[_0xb9c6('0x3d')]));if(_0xbf4066[_0xb9c6('0x3b')][_0xb9c6('0x49')]){_0xe3d3c5[_0xb9c6('0x47')]=_[_0xb9c6('0x53')](_0xe3d3c5[_0xb9c6('0x47')],{'$or':_[_0xb9c6('0x37')](_0xe3d3c5[_0xb9c6('0x40')],function(_0x50a8bd){var _0x48eac7={};_0x48eac7[_0x50a8bd]={'$like':'%'+_0xbf4066[_0xb9c6('0x3b')][_0xb9c6('0x49')]+'%'};return _0x48eac7;})});}_0xe3d3c5=_[_0xb9c6('0x53')]({},_0xe3d3c5,_0xbf4066[_0xb9c6('0x4a')]);return _0x1b43cc[_0xb9c6('0x5c')](_0xe3d3c5);}})[_0xb9c6('0x30')](function(_0x12272a){if(_0x12272a){_0x3139ac=_0x12272a[_0xb9c6('0x41')];if(!_0xbf4066[_0xb9c6('0x3b')]['hasOwnProperty'](_0xb9c6('0x43'))){_0xe3d3c5[_0xb9c6('0x44')]=qs[_0xb9c6('0x44')](_0xbf4066[_0xb9c6('0x3b')]['limit']);_0xe3d3c5['offset']=qs[_0xb9c6('0x29')](_0xbf4066[_0xb9c6('0x3b')][_0xb9c6('0x29')]);}return _0x1b43cc[_0xb9c6('0x5c')](_0xe3d3c5);}})[_0xb9c6('0x30')](function(_0x56d2de){if(_0x56d2de){return _0x56d2de?{'count':_0x3139ac,'rows':_0x56d2de}:null;}})[_0xb9c6('0x30')](respondWithResult(_0x5f453e,null))[_0xb9c6('0x25')](handleError(_0x5f453e,null));};exports[_0xb9c6('0x5d')]=function(_0x203d10,_0x81097f,_0x3c590d){var _0x3a5ab3={};var _0x274d77={};var _0x237a89;var _0x8eebe9;return db[_0xb9c6('0x4d')][_0xb9c6('0x5a')]({'where':{'id':_0x203d10[_0xb9c6('0x57')]['id']}})['then'](handleEntityNotFound(_0x81097f,null))[_0xb9c6('0x30')](function(_0x212060){if(_0x212060){_0x237a89=_0x212060;_0x274d77['model']=_[_0xb9c6('0x3c')](db[_0xb9c6('0x5e')]['rawAttributes']);_0x274d77['query']=_[_0xb9c6('0x3c')](_0x203d10['query']);_0x274d77[_0xb9c6('0x3d')]=_[_0xb9c6('0x3e')](_0x274d77[_0xb9c6('0x3a')],_0x274d77[_0xb9c6('0x3b')]);_0x3a5ab3[_0xb9c6('0x40')]=_[_0xb9c6('0x3e')](_0x274d77[_0xb9c6('0x3a')],qs['fields'](_0x203d10['query']['fields']));_0x3a5ab3[_0xb9c6('0x40')]=_0x3a5ab3[_0xb9c6('0x40')][_0xb9c6('0x41')]?_0x3a5ab3['attributes']:_0x274d77['model'];_0x3a5ab3[_0xb9c6('0x45')]=qs[_0xb9c6('0x46')](_0x203d10[_0xb9c6('0x3b')][_0xb9c6('0x46')]);_0x3a5ab3['where']=qs[_0xb9c6('0x3d')](_[_0xb9c6('0x48')](_0x203d10[_0xb9c6('0x3b')],_0x274d77[_0xb9c6('0x3d')]));if(_0x203d10['query'][_0xb9c6('0x49')]){_0x3a5ab3['where']=_['merge'](_0x3a5ab3[_0xb9c6('0x47')],{'$or':_[_0xb9c6('0x37')](_0x3a5ab3[_0xb9c6('0x40')],function(_0x1a2dad){var _0x6b1a4e={};_0x6b1a4e[_0x1a2dad]={'$like':'%'+_0x203d10['query']['filter']+'%'};return _0x6b1a4e;})});}_0x3a5ab3=_[_0xb9c6('0x53')]({},_0x3a5ab3,_0x203d10['options']);return _0x237a89[_0xb9c6('0x5d')](_0x3a5ab3);}})[_0xb9c6('0x30')](function(_0xa1b620){if(_0xa1b620){_0x8eebe9=_0xa1b620[_0xb9c6('0x41')];if(!_0x203d10['query'][_0xb9c6('0x42')](_0xb9c6('0x43'))){_0x3a5ab3[_0xb9c6('0x44')]=qs[_0xb9c6('0x44')](_0x203d10[_0xb9c6('0x3b')][_0xb9c6('0x44')]);_0x3a5ab3[_0xb9c6('0x29')]=qs[_0xb9c6('0x29')](_0x203d10[_0xb9c6('0x3b')][_0xb9c6('0x29')]);}return _0x237a89[_0xb9c6('0x5d')](_0x3a5ab3);}})[_0xb9c6('0x30')](function(_0x1950cd){if(_0x1950cd){return _0x1950cd?{'count':_0x8eebe9,'rows':_0x1950cd}:null;}})[_0xb9c6('0x30')](respondWithResult(_0x81097f,null))[_0xb9c6('0x25')](handleError(_0x81097f,null));};exports[_0xb9c6('0x5f')]=function(_0x482652,_0x502fe6,_0x2eba89){if(_0x482652[_0xb9c6('0x56')]['id']){delete _0x482652[_0xb9c6('0x56')]['id'];}return db[_0xb9c6('0x4d')][_0xb9c6('0x5a')]({'where':{'id':_0x482652['params']['id']}})[_0xb9c6('0x30')](handleEntityNotFound(_0x502fe6,null))[_0xb9c6('0x30')](function(_0x436ee9){if(_0x436ee9){return _0x436ee9[_0xb9c6('0x5f')](_0x482652[_0xb9c6('0x56')][_0xb9c6('0x60')]||[]);}return null;})[_0xb9c6('0x30')](respondWithResult(_0x502fe6,null))['catch'](handleError(_0x502fe6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b694895..54bc8e0 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 _0x9b57=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b57,0x1d9));var _0x79b5=function(_0x4403ff,_0x5aebc4){_0x4403ff=_0x4403ff-0x0;var _0x4d49dc=_0x9b57[_0x4403ff];return _0x4d49dc;};'use strict';var _=require('lodash');var util=require(_0x79b5('0x0'));var logger=require(_0x79b5('0x1'))(_0x79b5('0x2'));var moment=require(_0x79b5('0x3'));var BPromise=require(_0x79b5('0x4'));var rp=require(_0x79b5('0x5'));var fs=require('fs');var path=require(_0x79b5('0x6'));var rimraf=require(_0x79b5('0x7'));var config=require(_0x79b5('0x8'));var attributes=require(_0x79b5('0x9'));module[_0x79b5('0xa')]=function(_0xd747dd,_0x4d0c60){return _0xd747dd['define']('ZendeskConfiguration',attributes,{'tableName':_0x79b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x822f=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','bluebird','request-promise'];(function(_0x2f70d6,_0x3453fa){var _0x139b8b=function(_0x38fc46){while(--_0x38fc46){_0x2f70d6['push'](_0x2f70d6['shift']());}};_0x139b8b(++_0x3453fa);}(_0x822f,0x150));var _0xf822=function(_0x53a8e1,_0x553d43){_0x53a8e1=_0x53a8e1-0x0;var _0x3090be=_0x822f[_0x53a8e1];return _0x3090be;};'use strict';var _=require(_0xf822('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf822('0x1'));var moment=require(_0xf822('0x2'));var BPromise=require(_0xf822('0x3'));var rp=require(_0xf822('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf822('0x5'));var config=require(_0xf822('0x6'));var attributes=require(_0xf822('0x7'));module[_0xf822('0x8')]=function(_0x5cb9bc,_0x4e4cde){return _0x5cb9bc['define'](_0xf822('0x9'),attributes,{'tableName':_0xf822('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4345b7f..7f41643 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 _0xaf68=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x20d713,_0x955578){var _0xc4f054=function(_0x93dec6){while(--_0x93dec6){_0x20d713['push'](_0x20d713['shift']());}};_0xc4f054(++_0x955578);}(_0xaf68,0x85));var _0x8af6=function(_0x4f8246,_0x5b2a73){_0x4f8246=_0x4f8246-0x0;var _0x10c332=_0xaf68[_0x4f8246];return _0x10c332;};'use strict';var _=require(_0x8af6('0x0'));var util=require(_0x8af6('0x1'));var moment=require(_0x8af6('0x2'));var BPromise=require(_0x8af6('0x3'));var rs=require(_0x8af6('0x4'));var fs=require('fs');var Redis=require(_0x8af6('0x5'));var db=require(_0x8af6('0x6'))['db'];var utils=require(_0x8af6('0x7'));var logger=require(_0x8af6('0x8'))('rpc');var config=require(_0x8af6('0x9'));var jayson=require(_0x8af6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dad88,_0x5382d8,_0x537c51){return new BPromise(function(_0x1b8041,_0x31f9d8){return client['request'](_0x5dad88,_0x537c51)['then'](function(_0x5b442b){logger[_0x8af6('0xb')](_0x8af6('0xc'),_0x5382d8,_0x8af6('0xd'));logger[_0x8af6('0xe')](_0x8af6('0xf'),_0x5382d8,_0x8af6('0xd'),JSON['stringify'](_0x5b442b));if(_0x5b442b[_0x8af6('0x10')]){if(_0x5b442b[_0x8af6('0x10')][_0x8af6('0x11')]===0x1f4){logger[_0x8af6('0x10')](_0x8af6('0xc'),_0x5382d8,_0x5b442b[_0x8af6('0x10')][_0x8af6('0x12')]);return _0x31f9d8(_0x5b442b[_0x8af6('0x10')][_0x8af6('0x12')]);}logger['error'](_0x8af6('0xc'),_0x5382d8,_0x5b442b[_0x8af6('0x10')]['message']);return _0x1b8041(_0x5b442b['error']['message']);}else{logger[_0x8af6('0xb')](_0x8af6('0xc'),_0x5382d8,_0x8af6('0xd'));_0x1b8041(_0x5b442b[_0x8af6('0x13')][_0x8af6('0x12')]);}})[_0x8af6('0x14')](function(_0xfd2ffc){logger[_0x8af6('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5382d8,_0xfd2ffc);_0x31f9d8(_0xfd2ffc);});});} \ No newline at end of file +var _0x5d71=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x5d71,0xc3));var _0x15d7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5d71[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x15d7('0x0'));var moment=require(_0x15d7('0x1'));var BPromise=require(_0x15d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15d7('0x3'));var db=require(_0x15d7('0x4'))['db'];var utils=require(_0x15d7('0x5'));var logger=require(_0x15d7('0x6'))(_0x15d7('0x7'));var config=require(_0x15d7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x15d7('0x9')][_0x15d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46110c,_0x40b0ea,_0x15a5fb){return new BPromise(function(_0x5ce135,_0x327a3b){return client[_0x15d7('0xb')](_0x46110c,_0x15a5fb)[_0x15d7('0xc')](function(_0x4601c2){logger[_0x15d7('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x40b0ea,_0x15d7('0xe'));logger[_0x15d7('0xf')](_0x15d7('0x10'),_0x40b0ea,_0x15d7('0xe'),JSON[_0x15d7('0x11')](_0x4601c2));if(_0x4601c2[_0x15d7('0x12')]){if(_0x4601c2[_0x15d7('0x12')]['code']===0x1f4){logger['error'](_0x15d7('0x13'),_0x40b0ea,_0x4601c2[_0x15d7('0x12')][_0x15d7('0x14')]);return _0x327a3b(_0x4601c2[_0x15d7('0x12')][_0x15d7('0x14')]);}logger[_0x15d7('0x12')](_0x15d7('0x13'),_0x40b0ea,_0x4601c2[_0x15d7('0x12')][_0x15d7('0x14')]);return _0x5ce135(_0x4601c2['error'][_0x15d7('0x14')]);}else{logger[_0x15d7('0xd')](_0x15d7('0x13'),_0x40b0ea,_0x15d7('0xe'));_0x5ce135(_0x4601c2['result'][_0x15d7('0x14')]);}})[_0x15d7('0x15')](function(_0x3f0fed){logger[_0x15d7('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x40b0ea,_0x3f0fed);_0x327a3b(_0x3f0fed);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f511076..1b8c599 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 _0xe1df=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x299042,_0x2492c5){var _0x3b1658=function(_0x2acd76){while(--_0x2acd76){_0x299042['push'](_0x299042['shift']());}};_0x3b1658(++_0x2492c5);}(_0xe1df,0x120));var _0xfe1d=function(_0x5326a7,_0x4cdf72){_0x5326a7=_0x5326a7-0x0;var _0x5ce3dc=_0xe1df[_0x5326a7];return _0x5ce3dc;};'use strict';var multer=require(_0xfe1d('0x0'));var util=require(_0xfe1d('0x1'));var path=require(_0xfe1d('0x2'));var timeout=require(_0xfe1d('0x3'));var express=require(_0xfe1d('0x4'));var router=express[_0xfe1d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe1d('0x6'));var controller=require(_0xfe1d('0x7'));router[_0xfe1d('0x8')]('/',auth[_0xfe1d('0x9')](),controller[_0xfe1d('0xa')]);router['get'](_0xfe1d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfe1d('0xc')]('/',auth[_0xfe1d('0x9')](),controller[_0xfe1d('0xd')]);router[_0xfe1d('0xe')](_0xfe1d('0xb'),auth[_0xfe1d('0x9')](),controller[_0xfe1d('0xf')]);router[_0xfe1d('0x10')](_0xfe1d('0xb'),auth['isAuthenticated'](),controller[_0xfe1d('0x11')]);module[_0xfe1d('0x12')]=router; \ No newline at end of file +var _0xff2e=['create','put','delete','/:id','destroy','path','Router','../../components/auth/service','get','isAuthenticated','index','show','post'];(function(_0x34c93e,_0x124c97){var _0x299503=function(_0x3087f9){while(--_0x3087f9){_0x34c93e['push'](_0x34c93e['shift']());}};_0x299503(++_0x124c97);}(_0xff2e,0x198));var _0xeff2=function(_0x4a4296,_0xa6fc6a){_0x4a4296=_0x4a4296-0x0;var _0x5a9e26=_0xff2e[_0x4a4296];return _0x5a9e26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeff2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeff2('0x1')]();var auth=require(_0xeff2('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xeff2('0x3')]('/',auth[_0xeff2('0x4')](),controller[_0xeff2('0x5')]);router[_0xeff2('0x3')]('/:id',auth[_0xeff2('0x4')](),controller[_0xeff2('0x6')]);router[_0xeff2('0x7')]('/',auth[_0xeff2('0x4')](),controller[_0xeff2('0x8')]);router[_0xeff2('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeff2('0xa')](_0xeff2('0xb'),auth['isAuthenticated'](),controller[_0xeff2('0xc')]);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 94ff931..ea0876d 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 _0xb56f=['string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x30eac7,_0x390fed){var _0xf0c378=function(_0x2a0a35){while(--_0x2a0a35){_0x30eac7['push'](_0x30eac7['shift']());}};_0xf0c378(++_0x390fed);}(_0xb56f,0x113));var _0xfb56=function(_0x75e736,_0x7e6502){_0x75e736=_0x75e736-0x0;var _0x2e7c97=_0xb56f[_0x75e736];return _0x2e7c97;};'use strict';var Sequelize=require(_0xfb56('0x0'));module[_0xfb56('0x1')]={'type':{'type':Sequelize[_0xfb56('0x2')]('string',_0xfb56('0x3'),_0xfb56('0x4'),'keyValue'),'defaultValue':_0xfb56('0x5')},'content':{'type':Sequelize[_0xfb56('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfb56('0x2')](_0xfb56('0x5'),_0xfb56('0x3'),_0xfb56('0x4'))},'keyContent':{'type':Sequelize[_0xfb56('0x6')]},'idField':{'type':Sequelize[_0xfb56('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb56('0x6')]}}; \ No newline at end of file +var _0x5da1=['variable','customVariable','STRING','ENUM','BOOLEAN','string'];(function(_0xbfa740,_0x44467d){var _0x558fd1=function(_0x2fdb6e){while(--_0x2fdb6e){_0xbfa740['push'](_0xbfa740['shift']());}};_0x558fd1(++_0x44467d);}(_0x5da1,0xbf));var _0x15da=function(_0x3cc23b,_0x48c057){_0x3cc23b=_0x3cc23b-0x0;var _0x343689=_0x5da1[_0x3cc23b];return _0x343689;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x15da('0x0'),_0x15da('0x1'),_0x15da('0x2'),'keyValue'),'defaultValue':_0x15da('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x15da('0x3')]},'keyType':{'type':Sequelize[_0x15da('0x4')]('string',_0x15da('0x1'),_0x15da('0x2'))},'keyContent':{'type':Sequelize[_0x15da('0x3')]},'idField':{'type':Sequelize[_0x15da('0x3')]},'nameField':{'type':Sequelize[_0x15da('0x3')]},'customField':{'type':Sequelize[_0x15da('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15da('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6f7ef2c..a5721a7 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 _0xf555=['model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','then','destroy','error','stack','name','send','index','map','ZendeskField','fieldName','type','key'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xf555,0x1c6));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5f55('0x0'));var emlformat=require(_0x5f55('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f55('0x2'));var jsonpatch=require(_0x5f55('0x3'));var rp=require(_0x5f55('0x4'));var moment=require('moment');var BPromise=require(_0x5f55('0x5'));var Mustache=require('mustache');var util=require(_0x5f55('0x6'));var path=require(_0x5f55('0x7'));var sox=require(_0x5f55('0x8'));var csv=require(_0x5f55('0x9'));var ejs=require(_0x5f55('0xa'));var fs=require('fs');var _=require(_0x5f55('0xb'));var squel=require(_0x5f55('0xc'));var crypto=require(_0x5f55('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f55('0xe'));var toCsv=require(_0x5f55('0x9'));var querystring=require(_0x5f55('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5f55('0x10'));var qs=require(_0x5f55('0x11'));var as=require(_0x5f55('0x12'));var hardwareService=require(_0x5f55('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5f55('0x14'));var config=require(_0x5f55('0x15'));var db=require(_0x5f55('0x16'))['db'];function respondWithStatusCode(_0xec200c,_0x538448){_0x538448=_0x538448||0xcc;return function(_0x499426){if(_0x499426){return _0xec200c[_0x5f55('0x17')](_0x538448);}return _0xec200c[_0x5f55('0x18')](_0x538448)[_0x5f55('0x19')]();};}function respondWithResult(_0xb62e90,_0xb29da8){_0xb29da8=_0xb29da8||0xc8;return function(_0x19027a){if(_0x19027a){return _0xb62e90['status'](_0xb29da8)[_0x5f55('0x1a')](_0x19027a);}};}function respondWithFilteredResult(_0x798533,_0x4df103){return function(_0x48753c){if(_0x48753c){var _0x225bb3=_0x48753c[_0x5f55('0x1b')],_0x4857cd=_0x4df103[_0x5f55('0x1c')],_0x2ceb3e=_0x4df103[_0x5f55('0x1c')]+_0x4df103[_0x5f55('0x1d')],_0x48d474;if(_0x2ceb3e>=_0x225bb3){_0x2ceb3e=_0x225bb3;_0x48d474=0xc8;}else{_0x48d474=0xce;}_0x798533[_0x5f55('0x18')](_0x48d474);return _0x798533['set']('Content-Range',_0x4857cd+'-'+_0x2ceb3e+'/'+_0x225bb3)[_0x5f55('0x1a')](_0x48753c);}return null;};}function patchUpdates(_0x44c697){return function(_0x229423){try{jsonpatch['apply'](_0x229423,_0x44c697,!![]);}catch(_0x17839d){return BPromise[_0x5f55('0x1e')](_0x17839d);}return _0x229423['save']();};}function saveUpdates(_0x198fc0,_0x56f27f){return function(_0x4582a2){if(_0x4582a2){return _0x4582a2['update'](_0x198fc0)[_0x5f55('0x1f')](function(_0x21cbdf){return _0x21cbdf;});}return null;};}function removeEntity(_0x502e16,_0x47371a){return function(_0x275f14){if(_0x275f14){return _0x275f14[_0x5f55('0x20')]()['then'](function(){_0x502e16[_0x5f55('0x18')](0xcc)[_0x5f55('0x19')]();});}};}function handleEntityNotFound(_0x4aa1ad,_0x59c251){return function(_0x1b682c){if(!_0x1b682c){_0x4aa1ad[_0x5f55('0x17')](0x194);}return _0x1b682c;};}function handleError(_0x257f88,_0x3ad857){_0x3ad857=_0x3ad857||0x1f4;return function(_0x58daa1){logger[_0x5f55('0x21')](_0x58daa1[_0x5f55('0x22')]);if(_0x58daa1[_0x5f55('0x23')]){delete _0x58daa1[_0x5f55('0x23')];}_0x257f88[_0x5f55('0x18')](_0x3ad857)[_0x5f55('0x24')](_0x58daa1);};}exports[_0x5f55('0x25')]=function(_0x2f84c5,_0x157d73){var _0x964ef7={},_0x4b92ba={},_0x2bbed4={'count':0x0,'rows':[]};var _0x367f0f=_[_0x5f55('0x26')](db[_0x5f55('0x27')]['rawAttributes'],function(_0xc8d0ea){return{'name':_0xc8d0ea[_0x5f55('0x28')],'type':_0xc8d0ea[_0x5f55('0x29')][_0x5f55('0x2a')]};});_0x4b92ba[_0x5f55('0x2b')]=_[_0x5f55('0x26')](_0x367f0f,_0x5f55('0x23'));_0x4b92ba[_0x5f55('0x2c')]=_['keys'](_0x2f84c5[_0x5f55('0x2c')]);_0x4b92ba['filters']=_[_0x5f55('0x2d')](_0x4b92ba[_0x5f55('0x2b')],_0x4b92ba['query']);_0x964ef7['attributes']=_['intersection'](_0x4b92ba[_0x5f55('0x2b')],qs[_0x5f55('0x2e')](_0x2f84c5[_0x5f55('0x2c')][_0x5f55('0x2e')]));_0x964ef7[_0x5f55('0x2f')]=_0x964ef7[_0x5f55('0x2f')]['length']?_0x964ef7[_0x5f55('0x2f')]:_0x4b92ba[_0x5f55('0x2b')];if(!_0x2f84c5[_0x5f55('0x2c')]['hasOwnProperty'](_0x5f55('0x30'))){_0x964ef7['limit']=qs[_0x5f55('0x1d')](_0x2f84c5['query'][_0x5f55('0x1d')]);_0x964ef7[_0x5f55('0x1c')]=qs[_0x5f55('0x1c')](_0x2f84c5[_0x5f55('0x2c')][_0x5f55('0x1c')]);}_0x964ef7[_0x5f55('0x31')]=qs[_0x5f55('0x32')](_0x2f84c5[_0x5f55('0x2c')][_0x5f55('0x32')]);_0x964ef7[_0x5f55('0x33')]=qs[_0x5f55('0x34')](_[_0x5f55('0x35')](_0x2f84c5[_0x5f55('0x2c')],_0x4b92ba[_0x5f55('0x34')]),_0x367f0f);if(_0x2f84c5[_0x5f55('0x2c')]['filter']){_0x964ef7[_0x5f55('0x33')]=_[_0x5f55('0x36')](_0x964ef7[_0x5f55('0x33')],{'$or':_[_0x5f55('0x26')](_0x367f0f,function(_0x3759a4){if(_0x3759a4[_0x5f55('0x29')]!==_0x5f55('0x37')){var _0x1f6071={};_0x1f6071[_0x3759a4[_0x5f55('0x23')]]={'$like':'%'+_0x2f84c5[_0x5f55('0x2c')][_0x5f55('0x38')]+'%'};return _0x1f6071;}})});}_0x964ef7=_[_0x5f55('0x36')]({},_0x964ef7,_0x2f84c5[_0x5f55('0x39')]);var _0x5d03b0={'where':_0x964ef7[_0x5f55('0x33')]};return db[_0x5f55('0x27')]['count'](_0x5d03b0)[_0x5f55('0x1f')](function(_0x33d298){_0x2bbed4[_0x5f55('0x1b')]=_0x33d298;if(_0x2f84c5[_0x5f55('0x2c')]['includeAll']){_0x964ef7[_0x5f55('0x3a')]=[{'all':!![]}];}return db[_0x5f55('0x27')][_0x5f55('0x3b')](_0x964ef7);})[_0x5f55('0x1f')](function(_0x30f2c1){_0x2bbed4[_0x5f55('0x3c')]=_0x30f2c1;return _0x2bbed4;})[_0x5f55('0x1f')](respondWithFilteredResult(_0x157d73,_0x964ef7))['catch'](handleError(_0x157d73,null));};exports[_0x5f55('0x3d')]=function(_0x1c8f51,_0x5e20c9){var _0x278567={'raw':!![],'where':{'id':_0x1c8f51[_0x5f55('0x3e')]['id']}},_0x78f2={};_0x78f2['model']=_[_0x5f55('0x3f')](db[_0x5f55('0x27')][_0x5f55('0x40')]);_0x78f2['query']=_['keys'](_0x1c8f51[_0x5f55('0x2c')]);_0x78f2[_0x5f55('0x34')]=_[_0x5f55('0x2d')](_0x78f2[_0x5f55('0x2b')],_0x78f2[_0x5f55('0x2c')]);_0x278567[_0x5f55('0x2f')]=_[_0x5f55('0x2d')](_0x78f2[_0x5f55('0x2b')],qs[_0x5f55('0x2e')](_0x1c8f51[_0x5f55('0x2c')][_0x5f55('0x2e')]));_0x278567[_0x5f55('0x2f')]=_0x278567[_0x5f55('0x2f')]['length']?_0x278567[_0x5f55('0x2f')]:_0x78f2[_0x5f55('0x2b')];if(_0x1c8f51[_0x5f55('0x2c')][_0x5f55('0x41')]){_0x278567[_0x5f55('0x3a')]=[{'all':!![]}];}_0x278567=_['merge']({},_0x278567,_0x1c8f51[_0x5f55('0x39')]);return db['ZendeskField'][_0x5f55('0x42')](_0x278567)['then'](handleEntityNotFound(_0x5e20c9,null))[_0x5f55('0x1f')](respondWithResult(_0x5e20c9,null))[_0x5f55('0x43')](handleError(_0x5e20c9,null));};exports[_0x5f55('0x44')]=function(_0x3dec84,_0x17a43f){return db[_0x5f55('0x27')]['create'](_0x3dec84[_0x5f55('0x45')],{})[_0x5f55('0x1f')](respondWithResult(_0x17a43f,0xc9))[_0x5f55('0x43')](handleError(_0x17a43f,null));};exports[_0x5f55('0x46')]=function(_0x4da767,_0x56e2ed){if(_0x4da767[_0x5f55('0x45')]['id']){delete _0x4da767['body']['id'];}return db[_0x5f55('0x27')][_0x5f55('0x42')]({'where':{'id':_0x4da767[_0x5f55('0x3e')]['id']}})[_0x5f55('0x1f')](handleEntityNotFound(_0x56e2ed,null))[_0x5f55('0x1f')](saveUpdates(_0x4da767['body'],null))[_0x5f55('0x1f')](respondWithResult(_0x56e2ed,null))['catch'](handleError(_0x56e2ed,null));};exports['destroy']=function(_0xbde29d,_0xee81b6){return db[_0x5f55('0x27')]['find']({'where':{'id':_0xbde29d[_0x5f55('0x3e')]['id']}})[_0x5f55('0x1f')](handleEntityNotFound(_0xee81b6,null))[_0x5f55('0x1f')](removeEntity(_0xee81b6,null))['catch'](handleError(_0xee81b6,null));}; \ No newline at end of file +var _0x5a73=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','update','then','destroy','sendStatus','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','intersection','include','options','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4ea04b,_0x16d00f){var _0x1c9a5c=function(_0x55791c){while(--_0x55791c){_0x4ea04b['push'](_0x4ea04b['shift']());}};_0x1c9a5c(++_0x16d00f);}(_0x5a73,0xbd));var _0x35a7=function(_0x4e2e5a,_0x19cafa){_0x4e2e5a=_0x4e2e5a-0x0;var _0x4e7543=_0x5a73[_0x4e2e5a];return _0x4e7543;};'use strict';var pdf=require(_0x35a7('0x0'));var emlformat=require(_0x35a7('0x1'));var rimraf=require(_0x35a7('0x2'));var zipdir=require(_0x35a7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35a7('0x4'));var moment=require(_0x35a7('0x5'));var BPromise=require(_0x35a7('0x6'));var Mustache=require(_0x35a7('0x7'));var util=require('util');var path=require(_0x35a7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35a7('0x9'));var squel=require(_0x35a7('0xa'));var crypto=require(_0x35a7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35a7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35a7('0xd'));var Papa=require('papaparse');var Redis=require(_0x35a7('0xe'));var authService=require(_0x35a7('0xf'));var qs=require(_0x35a7('0x10'));var as=require(_0x35a7('0x11'));var hardwareService=require(_0x35a7('0x12'));var logger=require(_0x35a7('0x13'))(_0x35a7('0x14'));var utils=require(_0x35a7('0x15'));var config=require(_0x35a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f08d,_0x283d0f){_0x283d0f=_0x283d0f||0xcc;return function(_0x1d6b3a){if(_0x1d6b3a){return _0x23f08d['sendStatus'](_0x283d0f);}return _0x23f08d[_0x35a7('0x17')](_0x283d0f)['end']();};}function respondWithResult(_0x21a882,_0x19d293){_0x19d293=_0x19d293||0xc8;return function(_0xaac321){if(_0xaac321){return _0x21a882[_0x35a7('0x17')](_0x19d293)[_0x35a7('0x18')](_0xaac321);}};}function respondWithFilteredResult(_0x20636f,_0x15a1ac){return function(_0x4e2d03){if(_0x4e2d03){var _0x460c66=_0x4e2d03[_0x35a7('0x19')],_0x37ad27=_0x15a1ac[_0x35a7('0x1a')],_0x5d0570=_0x15a1ac[_0x35a7('0x1a')]+_0x15a1ac[_0x35a7('0x1b')],_0x4b9893;if(_0x5d0570>=_0x460c66){_0x5d0570=_0x460c66;_0x4b9893=0xc8;}else{_0x4b9893=0xce;}_0x20636f['status'](_0x4b9893);return _0x20636f[_0x35a7('0x1c')]('Content-Range',_0x37ad27+'-'+_0x5d0570+'/'+_0x460c66)['json'](_0x4e2d03);}return null;};}function patchUpdates(_0x4a8ac4){return function(_0xb43df5){try{jsonpatch['apply'](_0xb43df5,_0x4a8ac4,!![]);}catch(_0x161cce){return BPromise['reject'](_0x161cce);}return _0xb43df5['save']();};}function saveUpdates(_0x3adbfe,_0x613cd9){return function(_0x22d0b0){if(_0x22d0b0){return _0x22d0b0[_0x35a7('0x1d')](_0x3adbfe)[_0x35a7('0x1e')](function(_0x518cf3){return _0x518cf3;});}return null;};}function removeEntity(_0x5f3a2e,_0x20f7d4){return function(_0x4de388){if(_0x4de388){return _0x4de388[_0x35a7('0x1f')]()[_0x35a7('0x1e')](function(){_0x5f3a2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5969fb,_0x2d0ca5){return function(_0x46a231){if(!_0x46a231){_0x5969fb[_0x35a7('0x20')](0x194);}return _0x46a231;};}function handleError(_0x58cd07,_0x591027){_0x591027=_0x591027||0x1f4;return function(_0x2706e8){logger[_0x35a7('0x21')](_0x2706e8['stack']);if(_0x2706e8[_0x35a7('0x22')]){delete _0x2706e8[_0x35a7('0x22')];}_0x58cd07[_0x35a7('0x17')](_0x591027)[_0x35a7('0x23')](_0x2706e8);};}exports[_0x35a7('0x24')]=function(_0x1437f8,_0x478001){var _0x2aa5b8={},_0x543000={},_0x2af69f={'count':0x0,'rows':[]};var _0x1cc727=_[_0x35a7('0x25')](db[_0x35a7('0x26')][_0x35a7('0x27')],function(_0x53fe3f){return{'name':_0x53fe3f[_0x35a7('0x28')],'type':_0x53fe3f[_0x35a7('0x29')][_0x35a7('0x2a')]};});_0x543000[_0x35a7('0x2b')]=_[_0x35a7('0x25')](_0x1cc727,_0x35a7('0x22'));_0x543000[_0x35a7('0x2c')]=_[_0x35a7('0x2d')](_0x1437f8[_0x35a7('0x2c')]);_0x543000[_0x35a7('0x2e')]=_['intersection'](_0x543000[_0x35a7('0x2b')],_0x543000[_0x35a7('0x2c')]);_0x2aa5b8['attributes']=_['intersection'](_0x543000['model'],qs[_0x35a7('0x2f')](_0x1437f8[_0x35a7('0x2c')][_0x35a7('0x2f')]));_0x2aa5b8['attributes']=_0x2aa5b8[_0x35a7('0x30')][_0x35a7('0x31')]?_0x2aa5b8['attributes']:_0x543000[_0x35a7('0x2b')];if(!_0x1437f8[_0x35a7('0x2c')][_0x35a7('0x32')](_0x35a7('0x33'))){_0x2aa5b8[_0x35a7('0x1b')]=qs['limit'](_0x1437f8[_0x35a7('0x2c')]['limit']);_0x2aa5b8[_0x35a7('0x1a')]=qs['offset'](_0x1437f8['query'][_0x35a7('0x1a')]);}_0x2aa5b8['order']=qs[_0x35a7('0x34')](_0x1437f8[_0x35a7('0x2c')][_0x35a7('0x34')]);_0x2aa5b8[_0x35a7('0x35')]=qs[_0x35a7('0x2e')](_[_0x35a7('0x36')](_0x1437f8[_0x35a7('0x2c')],_0x543000[_0x35a7('0x2e')]),_0x1cc727);if(_0x1437f8[_0x35a7('0x2c')][_0x35a7('0x37')]){_0x2aa5b8['where']=_[_0x35a7('0x38')](_0x2aa5b8['where'],{'$or':_['map'](_0x1cc727,function(_0x24b321){if(_0x24b321['type']!==_0x35a7('0x39')){var _0x1e8288={};_0x1e8288[_0x24b321[_0x35a7('0x22')]]={'$like':'%'+_0x1437f8[_0x35a7('0x2c')][_0x35a7('0x37')]+'%'};return _0x1e8288;}})});}_0x2aa5b8=_[_0x35a7('0x38')]({},_0x2aa5b8,_0x1437f8['options']);var _0x195d03={'where':_0x2aa5b8[_0x35a7('0x35')]};return db['ZendeskField'][_0x35a7('0x19')](_0x195d03)[_0x35a7('0x1e')](function(_0x4c762d){_0x2af69f[_0x35a7('0x19')]=_0x4c762d;if(_0x1437f8[_0x35a7('0x2c')]['includeAll']){_0x2aa5b8['include']=[{'all':!![]}];}return db[_0x35a7('0x26')][_0x35a7('0x3a')](_0x2aa5b8);})[_0x35a7('0x1e')](function(_0x834844){_0x2af69f[_0x35a7('0x3b')]=_0x834844;return _0x2af69f;})[_0x35a7('0x1e')](respondWithFilteredResult(_0x478001,_0x2aa5b8))['catch'](handleError(_0x478001,null));};exports[_0x35a7('0x3c')]=function(_0x5ed81d,_0x5c99d4){var _0xfa98e7={'raw':!![],'where':{'id':_0x5ed81d['params']['id']}},_0x4aac8b={};_0x4aac8b[_0x35a7('0x2b')]=_['keys'](db[_0x35a7('0x26')][_0x35a7('0x27')]);_0x4aac8b[_0x35a7('0x2c')]=_[_0x35a7('0x2d')](_0x5ed81d[_0x35a7('0x2c')]);_0x4aac8b[_0x35a7('0x2e')]=_[_0x35a7('0x3d')](_0x4aac8b['model'],_0x4aac8b[_0x35a7('0x2c')]);_0xfa98e7[_0x35a7('0x30')]=_[_0x35a7('0x3d')](_0x4aac8b['model'],qs['fields'](_0x5ed81d['query'][_0x35a7('0x2f')]));_0xfa98e7[_0x35a7('0x30')]=_0xfa98e7[_0x35a7('0x30')][_0x35a7('0x31')]?_0xfa98e7[_0x35a7('0x30')]:_0x4aac8b[_0x35a7('0x2b')];if(_0x5ed81d['query']['includeAll']){_0xfa98e7[_0x35a7('0x3e')]=[{'all':!![]}];}_0xfa98e7=_['merge']({},_0xfa98e7,_0x5ed81d[_0x35a7('0x3f')]);return db[_0x35a7('0x26')][_0x35a7('0x40')](_0xfa98e7)[_0x35a7('0x1e')](handleEntityNotFound(_0x5c99d4,null))[_0x35a7('0x1e')](respondWithResult(_0x5c99d4,null))[_0x35a7('0x41')](handleError(_0x5c99d4,null));};exports[_0x35a7('0x42')]=function(_0x3c389b,_0x89e9a0){return db[_0x35a7('0x26')][_0x35a7('0x42')](_0x3c389b[_0x35a7('0x43')],{})[_0x35a7('0x1e')](respondWithResult(_0x89e9a0,0xc9))['catch'](handleError(_0x89e9a0,null));};exports['update']=function(_0x1a9ceb,_0x46a210){if(_0x1a9ceb['body']['id']){delete _0x1a9ceb[_0x35a7('0x43')]['id'];}return db[_0x35a7('0x26')][_0x35a7('0x40')]({'where':{'id':_0x1a9ceb[_0x35a7('0x44')]['id']}})[_0x35a7('0x1e')](handleEntityNotFound(_0x46a210,null))[_0x35a7('0x1e')](saveUpdates(_0x1a9ceb[_0x35a7('0x43')],null))['then'](respondWithResult(_0x46a210,null))[_0x35a7('0x41')](handleError(_0x46a210,null));};exports[_0x35a7('0x1f')]=function(_0x3a32aa,_0xe8608d){return db[_0x35a7('0x26')][_0x35a7('0x40')]({'where':{'id':_0x3a32aa['params']['id']}})['then'](handleEntityNotFound(_0xe8608d,null))[_0x35a7('0x1e')](removeEntity(_0xe8608d,null))['catch'](handleError(_0xe8608d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c5e8c9a..75c226b 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 _0x1c7c=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x106124,_0x978fe2){var _0x257985=function(_0x469d53){while(--_0x469d53){_0x106124['push'](_0x106124['shift']());}};_0x257985(++_0x978fe2);}(_0x1c7c,0x164));var _0xc1c7=function(_0x304a83,_0x4690ab){_0x304a83=_0x304a83-0x0;var _0x3db33b=_0x1c7c[_0x304a83];return _0x3db33b;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require(_0xc1c7('0x2'))(_0xc1c7('0x3'));var moment=require('moment');var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var attributes=require(_0xc1c7('0x8'));module[_0xc1c7('0x9')]=function(_0x364dde,_0x1f3e21){return _0x364dde[_0xc1c7('0xa')](_0xc1c7('0xb'),attributes,{'tableName':_0xc1c7('0xc'),'paranoid':![],'indexes':[{'name':_0xc1c7('0xd'),'fields':[_0xc1c7('0xe'),_0xc1c7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x823c=['api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','FieldId','lodash','../../config/logger'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0x823c,0x143));var _0xc823=function(_0x37eef8,_0x520479){_0x37eef8=_0x37eef8-0x0;var _0x2b29aa=_0x823c[_0x37eef8];return _0x2b29aa;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var logger=require(_0xc823('0x1'))(_0xc823('0x2'));var moment=require(_0xc823('0x3'));var BPromise=require(_0xc823('0x4'));var rp=require(_0xc823('0x5'));var fs=require('fs');var path=require(_0xc823('0x6'));var rimraf=require('rimraf');var config=require(_0xc823('0x7'));var attributes=require(_0xc823('0x8'));module[_0xc823('0x9')]=function(_0x42e0c0,_0x380607){return _0x42e0c0['define'](_0xc823('0xa'),attributes,{'tableName':_0xc823('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc823('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 c94c342..f329c85 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 _0xf45c=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','error'];(function(_0x16662b,_0xaffc92){var _0x60ccec=function(_0x9cb80){while(--_0x9cb80){_0x16662b['push'](_0x16662b['shift']());}};_0x60ccec(++_0xaffc92);}(_0xf45c,0x68));var _0xcf45=function(_0xea0b40,_0x266fa9){_0xea0b40=_0xea0b40-0x0;var _0x54361f=_0xf45c[_0xea0b40];return _0x54361f;};'use strict';var _=require(_0xcf45('0x0'));var util=require(_0xcf45('0x1'));var moment=require(_0xcf45('0x2'));var BPromise=require(_0xcf45('0x3'));var rs=require(_0xcf45('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcf45('0x5'))(_0xcf45('0x6'));var config=require(_0xcf45('0x7'));var jayson=require(_0xcf45('0x8'));var client=jayson[_0xcf45('0x9')][_0xcf45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48de73,_0x574300,_0x5df5cb){return new BPromise(function(_0x4a73fd,_0x43b6c9){return client[_0xcf45('0xb')](_0x48de73,_0x5df5cb)[_0xcf45('0xc')](function(_0x3cd2a3){logger['info'](_0xcf45('0xd'),_0x574300,_0xcf45('0xe'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x574300,_0xcf45('0xe'),JSON['stringify'](_0x3cd2a3));if(_0x3cd2a3[_0xcf45('0xf')]){if(_0x3cd2a3[_0xcf45('0xf')][_0xcf45('0x10')]===0x1f4){logger[_0xcf45('0xf')]('ZendeskField,\x20%s,\x20%s',_0x574300,_0x3cd2a3[_0xcf45('0xf')][_0xcf45('0x11')]);return _0x43b6c9(_0x3cd2a3[_0xcf45('0xf')][_0xcf45('0x11')]);}logger['error'](_0xcf45('0xd'),_0x574300,_0x3cd2a3['error'][_0xcf45('0x11')]);return _0x4a73fd(_0x3cd2a3['error']['message']);}else{logger[_0xcf45('0x12')]('ZendeskField,\x20%s,\x20%s',_0x574300,_0xcf45('0xe'));_0x4a73fd(_0x3cd2a3[_0xcf45('0x13')][_0xcf45('0x11')]);}})['catch'](function(_0x258eea){logger[_0xcf45('0xf')](_0xcf45('0xd'),_0x574300,_0x258eea);_0x43b6c9(_0x258eea);});});} \ No newline at end of file +var _0xb0e5=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util'];(function(_0x5885a3,_0x19fe00){var _0x51cedd=function(_0x38b9df){while(--_0x38b9df){_0x5885a3['push'](_0x5885a3['shift']());}};_0x51cedd(++_0x19fe00);}(_0xb0e5,0xbe));var _0x5b0e=function(_0x8ae5f9,_0x49ff8c){_0x8ae5f9=_0x8ae5f9-0x0;var _0x181054=_0xb0e5[_0x8ae5f9];return _0x181054;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var moment=require(_0x5b0e('0x2'));var BPromise=require(_0x5b0e('0x3'));var rs=require(_0x5b0e('0x4'));var fs=require('fs');var Redis=require(_0x5b0e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b0e('0x6'));var logger=require(_0x5b0e('0x7'))(_0x5b0e('0x8'));var config=require(_0x5b0e('0x9'));var jayson=require(_0x5b0e('0xa'));var client=jayson[_0x5b0e('0xb')][_0x5b0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x357819,_0x37e87d,_0x56d690){return new BPromise(function(_0x35038e,_0x2af57f){return client[_0x5b0e('0xd')](_0x357819,_0x56d690)[_0x5b0e('0xe')](function(_0x18175d){logger['info'](_0x5b0e('0xf'),_0x37e87d,_0x5b0e('0x10'));logger[_0x5b0e('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x37e87d,'request\x20sent',JSON['stringify'](_0x18175d));if(_0x18175d[_0x5b0e('0x12')]){if(_0x18175d['error'][_0x5b0e('0x13')]===0x1f4){logger['error'](_0x5b0e('0xf'),_0x37e87d,_0x18175d[_0x5b0e('0x12')]['message']);return _0x2af57f(_0x18175d[_0x5b0e('0x12')][_0x5b0e('0x14')]);}logger[_0x5b0e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x37e87d,_0x18175d[_0x5b0e('0x12')][_0x5b0e('0x14')]);return _0x35038e(_0x18175d[_0x5b0e('0x12')][_0x5b0e('0x14')]);}else{logger[_0x5b0e('0x15')](_0x5b0e('0xf'),_0x37e87d,_0x5b0e('0x10'));_0x35038e(_0x18175d[_0x5b0e('0x16')][_0x5b0e('0x14')]);}})[_0x5b0e('0x17')](function(_0x48ca68){logger[_0x5b0e('0x12')](_0x5b0e('0xf'),_0x37e87d,_0x48ca68);_0x2af57f(_0x48ca68);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fd79c5f..21e1966 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 _0x2ee9=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5881d8,_0xaea45e){var _0x196deb=function(_0x2d958f){while(--_0x2d958f){_0x5881d8['push'](_0x5881d8['shift']());}};_0x196deb(++_0xaea45e);}(_0x2ee9,0xa3));var _0x92ee=function(_0x2a8a06,_0x2a39de){_0x2a8a06=_0x2a8a06-0x0;var _0x382a78=_0x2ee9[_0x2a8a06];return _0x382a78;};'use strict';var multer=require(_0x92ee('0x0'));var util=require('util');var path=require(_0x92ee('0x1'));var timeout=require(_0x92ee('0x2'));var express=require('express');var router=express[_0x92ee('0x3')]();var auth=require(_0x92ee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x92ee('0x5'));var controller=require(_0x92ee('0x6'));router[_0x92ee('0x7')]('/',auth[_0x92ee('0x8')](),controller['index']);router[_0x92ee('0x7')]('/:id',auth[_0x92ee('0x8')](),controller['show']);router[_0x92ee('0x7')]('/:id/configurations',auth[_0x92ee('0x8')](),controller[_0x92ee('0x9')]);router[_0x92ee('0x7')](_0x92ee('0xa'),auth[_0x92ee('0x8')](),controller[_0x92ee('0xb')]);router[_0x92ee('0xc')]('/',auth[_0x92ee('0x8')](),controller[_0x92ee('0xd')]);router[_0x92ee('0xc')]('/:id/configurations',auth[_0x92ee('0x8')](),controller[_0x92ee('0xe')]);router[_0x92ee('0xf')](_0x92ee('0x10'),auth[_0x92ee('0x8')](),controller[_0x92ee('0x11')]);router[_0x92ee('0x12')]('/:id',auth[_0x92ee('0x8')](),controller[_0x92ee('0x13')]);module[_0x92ee('0x14')]=router; \ No newline at end of file +var _0x77ef=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77ef,0x1a3));var _0xf77e=function(_0x5ea6de,_0x4b7a58){_0x5ea6de=_0x5ea6de-0x0;var _0x53468a=_0x77ef[_0x5ea6de];return _0x53468a;};'use strict';var multer=require(_0xf77e('0x0'));var util=require('util');var path=require(_0xf77e('0x1'));var timeout=require(_0xf77e('0x2'));var express=require('express');var router=express[_0xf77e('0x3')]();var auth=require(_0xf77e('0x4'));var interaction=require(_0xf77e('0x5'));var config=require(_0xf77e('0x6'));var controller=require('./intZohoAccount.controller');router[_0xf77e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf77e('0x7')]('/:id',auth[_0xf77e('0x8')](),controller[_0xf77e('0x9')]);router[_0xf77e('0x7')](_0xf77e('0xa'),auth[_0xf77e('0x8')](),controller[_0xf77e('0xb')]);router[_0xf77e('0x7')](_0xf77e('0xc'),auth[_0xf77e('0x8')](),controller[_0xf77e('0xd')]);router[_0xf77e('0xe')]('/',auth[_0xf77e('0x8')](),controller[_0xf77e('0xf')]);router[_0xf77e('0xe')](_0xf77e('0xa'),auth[_0xf77e('0x8')](),controller['addConfiguration']);router[_0xf77e('0x10')](_0xf77e('0x11'),auth[_0xf77e('0x8')](),controller[_0xf77e('0x12')]);router[_0xf77e('0x13')]('/:id',auth[_0xf77e('0x8')](),controller[_0xf77e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e45b883..1c28090 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 _0xe681=['STRING','sequelize'];(function(_0x26aee4,_0x530ead){var _0x2e1048=function(_0x2e92db){while(--_0x2e92db){_0x26aee4['push'](_0x26aee4['shift']());}};_0x2e1048(++_0x530ead);}(_0xe681,0x1a7));var _0x1e68=function(_0x110aaf,_0x328adf){_0x110aaf=_0x110aaf-0x0;var _0x190728=_0xe681[_0x110aaf];return _0x190728;};'use strict';var Sequelize=require(_0x1e68('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e68('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1e68('0x1')]},'zone':{'type':Sequelize[_0x1e68('0x1')]},'clientId':{'type':Sequelize[_0x1e68('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1e68('0x1')]},'code':{'type':Sequelize[_0x1e68('0x1')]},'refreshToken':{'type':Sequelize[_0x1e68('0x1')]}}; \ No newline at end of file +var _0x094d=['STRING','exports'];(function(_0x2f3acb,_0x25ccd7){var _0x33492f=function(_0x3e1b51){while(--_0x3e1b51){_0x2f3acb['push'](_0x2f3acb['shift']());}};_0x33492f(++_0x25ccd7);}(_0x094d,0x147));var _0xd094=function(_0x1e22d9,_0x25ae8f){_0x1e22d9=_0x1e22d9-0x0;var _0x5d15bf=_0x094d[_0x1e22d9];return _0x5d15bf;};'use strict';var Sequelize=require('sequelize');module[_0xd094('0x0')]={'name':{'type':Sequelize[_0xd094('0x1')]},'description':{'type':Sequelize[_0xd094('0x1')]},'host':{'type':Sequelize[_0xd094('0x1')]},'zone':{'type':Sequelize[_0xd094('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd094('0x1')]},'serverUrl':{'type':Sequelize[_0xd094('0x1')]},'code':{'type':Sequelize[_0xd094('0x1')]},'refreshToken':{'type':Sequelize[_0xd094('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index fb59bd9..5db32dd 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 _0x8899=['substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','end','stack','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','name','options','includeAll','rows','params','keys','length','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refresh_token','access_token','getFields','host','clientSecret','code','refreshToken','zoho.eu','com','serverUrl','slice'];(function(_0x2fc4ad,_0x1a1c97){var _0x18280e=function(_0x2a8a7e){while(--_0x2a8a7e){_0x2fc4ad['push'](_0x2fc4ad['shift']());}};_0x18280e(++_0x1a1c97);}(_0x8899,0x1b9));var _0x9889=function(_0x21bef6,_0x4a643c){_0x21bef6=_0x21bef6-0x0;var _0x31bb74=_0x8899[_0x21bef6];return _0x31bb74;};'use strict';var pdf=require(_0x9889('0x0'));var emlformat=require(_0x9889('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9889('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9889('0x3'));var moment=require(_0x9889('0x4'));var BPromise=require(_0x9889('0x5'));var Mustache=require(_0x9889('0x6'));var util=require(_0x9889('0x7'));var path=require('path');var sox=require(_0x9889('0x8'));var csv=require(_0x9889('0x9'));var ejs=require(_0x9889('0xa'));var fs=require('fs');var _=require(_0x9889('0xb'));var squel=require('squel');var crypto=require(_0x9889('0xc'));var jsforce=require(_0x9889('0xd'));var deskjs=require(_0x9889('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9889('0xf'));var Papa=require(_0x9889('0x10'));var Redis=require(_0x9889('0x11'));var authService=require(_0x9889('0x12'));var qs=require(_0x9889('0x13'));var as=require(_0x9889('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9889('0x15'))(_0x9889('0x16'));var utils=require('../../config/utils');var config=require(_0x9889('0x17'));var db=require(_0x9889('0x18'))['db'];var integrations=require(_0x9889('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x9889('0x1a')][_0x9889('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x950840,_0x795451,_0x406eea){if(_0x406eea){var _0x2959ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2959ba[_0x9889('0x1c')](_0x795451)){return _0x950840;}else{throw new db['Sequelize'][(_0x9889('0x1d'))](_0x9889('0x1e'));}}else{return _0x950840;}}function respondWithRpcPromise(_0x2a529f,_0x385705,_0x30b05f,_0x2f86ed){return new BPromise(function(_0x398196,_0x53cba1){var _0x4717e9=_0x2f86ed||client;return _0x4717e9[_0x9889('0x1f')](_0x2a529f,_0x30b05f)[_0x9889('0x20')](function(_0x2aad83){logger['info'](_0x9889('0x21'),_0x385705,_0x9889('0x22'));logger['debug'](_0x9889('0x23'),_0x385705,_0x9889('0x22'),JSON[_0x9889('0x24')](_0x2aad83));if(_0x2aad83[_0x9889('0x25')]){if(_0x2aad83[_0x9889('0x25')]['code']===0x1f4){logger['error'](_0x9889('0x21'),_0x385705,_0x2aad83['error'][_0x9889('0x26')]);return _0x53cba1(_0x2aad83[_0x9889('0x25')]['message']);}logger['error'](_0x9889('0x21'),_0x385705,_0x2aad83[_0x9889('0x25')][_0x9889('0x26')]);return _0x398196(_0x2aad83[_0x9889('0x25')][_0x9889('0x26')]);}else{logger[_0x9889('0x27')](_0x9889('0x21'),_0x385705,'request\x20sent');_0x398196(_0x2aad83['result']['message']);}})[_0x9889('0x28')](function(_0x158a20){logger[_0x9889('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x385705,_0x158a20);_0x53cba1(_0x158a20);});});}function respondWithStatusCode(_0x3984d4,_0x245704){_0x245704=_0x245704||0xcc;return function(_0x52c87d){if(_0x52c87d){return _0x3984d4[_0x9889('0x29')](_0x245704);}return _0x3984d4[_0x9889('0x2a')](_0x245704)['end']();};}function respondWithResult(_0x9825e1,_0x49feb9){_0x49feb9=_0x49feb9||0xc8;return function(_0x5a3b6e){if(_0x5a3b6e){return _0x9825e1[_0x9889('0x2a')](_0x49feb9)[_0x9889('0x2b')](_0x5a3b6e);}};}function respondWithFilteredResult(_0x2ccbb0,_0xfe96f1){return function(_0x2564e1){if(_0x2564e1){var _0x36a051=_0x2564e1[_0x9889('0x2c')],_0xa9d43e=_0xfe96f1[_0x9889('0x2d')],_0x58ad4f=_0xfe96f1[_0x9889('0x2d')]+_0xfe96f1[_0x9889('0x2e')],_0x239d9f;if(_0x58ad4f>=_0x36a051){_0x58ad4f=_0x36a051;_0x239d9f=0xc8;}else{_0x239d9f=0xce;}_0x2ccbb0[_0x9889('0x2a')](_0x239d9f);return _0x2ccbb0[_0x9889('0x2f')](_0x9889('0x30'),_0xa9d43e+'-'+_0x58ad4f+'/'+_0x36a051)['json'](_0x2564e1);}return null;};}function patchUpdates(_0x569a2c){return function(_0x4821b5){try{jsonpatch['apply'](_0x4821b5,_0x569a2c,!![]);}catch(_0x377ce3){return BPromise[_0x9889('0x31')](_0x377ce3);}return _0x4821b5[_0x9889('0x32')]();};}function saveUpdates(_0x14457d,_0x1e220c){return function(_0x52ef33){if(_0x52ef33){return _0x52ef33[_0x9889('0x33')](_0x14457d)['then'](function(_0x12dd41){return _0x12dd41;});}return null;};}function removeEntity(_0x49cf4b,_0x70591){return function(_0x3f5978){if(_0x3f5978){return _0x3f5978['destroy']()['then'](function(){_0x49cf4b['status'](0xcc)[_0x9889('0x34')]();});}};}function handleEntityNotFound(_0x193bb0,_0x865676){return function(_0x594eba){if(!_0x594eba){_0x193bb0['sendStatus'](0x194);}return _0x594eba;};}function handleError(_0x5d72c6,_0x3db718){_0x3db718=_0x3db718||0x1f4;return function(_0x628a79){logger['error'](_0x628a79[_0x9889('0x35')]);if(_0x628a79['name']){delete _0x628a79['name'];}_0x5d72c6[_0x9889('0x2a')](_0x3db718)[_0x9889('0x36')](_0x628a79);};}exports[_0x9889('0x37')]=function(_0xec26e8,_0x43ccb0){var _0x45481b={},_0x49fd17={},_0x42aa58={'count':0x0,'rows':[]};var _0x3b2c11=_[_0x9889('0x38')](db[_0x9889('0x39')][_0x9889('0x3a')],function(_0x46ff3a){return{'name':_0x46ff3a[_0x9889('0x3b')],'type':_0x46ff3a[_0x9889('0x3c')][_0x9889('0x3d')]};});_0x49fd17[_0x9889('0x3e')]=_[_0x9889('0x38')](_0x3b2c11,'name');_0x49fd17[_0x9889('0x3f')]=_['keys'](_0xec26e8['query']);_0x49fd17['filters']=_[_0x9889('0x40')](_0x49fd17[_0x9889('0x3e')],_0x49fd17[_0x9889('0x3f')]);_0x45481b[_0x9889('0x41')]=_[_0x9889('0x40')](_0x49fd17[_0x9889('0x3e')],qs[_0x9889('0x42')](_0xec26e8[_0x9889('0x3f')][_0x9889('0x42')]));_0x45481b[_0x9889('0x41')]=_0x45481b[_0x9889('0x41')]['length']?_0x45481b[_0x9889('0x41')]:_0x49fd17['model'];if(!_0xec26e8['query'][_0x9889('0x43')](_0x9889('0x44'))){_0x45481b[_0x9889('0x2e')]=qs[_0x9889('0x2e')](_0xec26e8[_0x9889('0x3f')]['limit']);_0x45481b['offset']=qs['offset'](_0xec26e8['query'][_0x9889('0x2d')]);}_0x45481b[_0x9889('0x45')]=qs[_0x9889('0x46')](_0xec26e8[_0x9889('0x3f')]['sort']);_0x45481b[_0x9889('0x47')]=qs[_0x9889('0x48')](_['pick'](_0xec26e8[_0x9889('0x3f')],_0x49fd17[_0x9889('0x48')]),_0x3b2c11);if(_0xec26e8[_0x9889('0x3f')][_0x9889('0x49')]){_0x45481b[_0x9889('0x47')]=_[_0x9889('0x4a')](_0x45481b[_0x9889('0x47')],{'$or':_[_0x9889('0x38')](_0x3b2c11,function(_0x9856bb){if(_0x9856bb[_0x9889('0x3c')]!==_0x9889('0x4b')){var _0x563c5d={};_0x563c5d[_0x9856bb[_0x9889('0x4c')]]={'$like':'%'+_0xec26e8[_0x9889('0x3f')][_0x9889('0x49')]+'%'};return _0x563c5d;}})});}_0x45481b=_[_0x9889('0x4a')]({},_0x45481b,_0xec26e8[_0x9889('0x4d')]);var _0x4e282b={'where':_0x45481b[_0x9889('0x47')]};return db[_0x9889('0x39')][_0x9889('0x2c')](_0x4e282b)[_0x9889('0x20')](function(_0x34bc68){_0x42aa58[_0x9889('0x2c')]=_0x34bc68;if(_0xec26e8[_0x9889('0x3f')][_0x9889('0x4e')]){_0x45481b['include']=[{'all':!![]}];}return db[_0x9889('0x39')]['findAll'](_0x45481b);})[_0x9889('0x20')](function(_0x1ff67c){_0x42aa58[_0x9889('0x4f')]=_0x1ff67c;return _0x42aa58;})[_0x9889('0x20')](respondWithFilteredResult(_0x43ccb0,_0x45481b))[_0x9889('0x28')](handleError(_0x43ccb0,null));};exports['show']=function(_0x19dbaa,_0x2c5d56){var _0x40f666={'raw':![],'where':{'id':_0x19dbaa[_0x9889('0x50')]['id']}},_0x3fea47={};_0x3fea47[_0x9889('0x3e')]=_[_0x9889('0x51')](db[_0x9889('0x39')][_0x9889('0x3a')]);_0x3fea47['query']=_[_0x9889('0x51')](_0x19dbaa[_0x9889('0x3f')]);_0x3fea47[_0x9889('0x48')]=_[_0x9889('0x40')](_0x3fea47[_0x9889('0x3e')],_0x3fea47[_0x9889('0x3f')]);_0x40f666[_0x9889('0x41')]=_[_0x9889('0x40')](_0x3fea47['model'],qs[_0x9889('0x42')](_0x19dbaa[_0x9889('0x3f')][_0x9889('0x42')]));_0x40f666['attributes']=_0x40f666['attributes'][_0x9889('0x52')]?_0x40f666[_0x9889('0x41')]:_0x3fea47[_0x9889('0x3e')];if(_0x19dbaa[_0x9889('0x3f')][_0x9889('0x4e')]){_0x40f666['include']=[{'all':!![]}];}_0x40f666=_[_0x9889('0x4a')]({},_0x40f666,_0x19dbaa[_0x9889('0x4d')]);return db[_0x9889('0x39')][_0x9889('0x53')](_0x40f666)[_0x9889('0x20')](handleEntityNotFound(_0x2c5d56,null))['then'](respondWithResult(_0x2c5d56,null))['catch'](handleError(_0x2c5d56,null));};exports['create']=function(_0x348c2d,_0xc703b4){return db[_0x9889('0x39')][_0x9889('0x54')](_0x348c2d[_0x9889('0x55')],{})[_0x9889('0x20')](respondWithResult(_0xc703b4,0xc9))[_0x9889('0x28')](handleError(_0xc703b4,null));};exports[_0x9889('0x33')]=function(_0x303eec,_0x5a7d5c){if(_0x303eec[_0x9889('0x55')]['id']){delete _0x303eec[_0x9889('0x55')]['id'];}return db['ZohoAccount'][_0x9889('0x53')]({'where':{'id':_0x303eec['params']['id']}})[_0x9889('0x20')](handleEntityNotFound(_0x5a7d5c,null))[_0x9889('0x20')](saveUpdates(_0x303eec[_0x9889('0x55')],null))[_0x9889('0x20')](respondWithResult(_0x5a7d5c,null))[_0x9889('0x28')](handleError(_0x5a7d5c,null));};exports[_0x9889('0x56')]=function(_0x27e15f,_0x47dfc5){return db[_0x9889('0x39')][_0x9889('0x53')]({'where':{'id':_0x27e15f[_0x9889('0x50')]['id']}})['then'](handleEntityNotFound(_0x47dfc5,null))[_0x9889('0x20')](removeEntity(_0x47dfc5,null))['catch'](handleError(_0x47dfc5,null));};exports[_0x9889('0x57')]=function(_0x477077,_0x45a5d1,_0x4d1f8e){var _0xee3360={};var _0x18093d={};var _0x32f375;var _0x3d621f;return db[_0x9889('0x39')][_0x9889('0x58')]({'where':{'id':_0x477077['params']['id']}})[_0x9889('0x20')](handleEntityNotFound(_0x45a5d1,null))[_0x9889('0x20')](function(_0x21da0e){if(_0x21da0e){_0x32f375=_0x21da0e;_0x18093d['model']=_['keys'](db[_0x9889('0x59')][_0x9889('0x3a')]);_0x18093d['query']=_[_0x9889('0x51')](_0x477077['query']);_0x18093d[_0x9889('0x48')]=_[_0x9889('0x40')](_0x18093d['model'],_0x18093d[_0x9889('0x3f')]);_0xee3360['attributes']=_[_0x9889('0x40')](_0x18093d[_0x9889('0x3e')],qs[_0x9889('0x42')](_0x477077[_0x9889('0x3f')][_0x9889('0x42')]));_0xee3360['attributes']=_0xee3360[_0x9889('0x41')][_0x9889('0x52')]?_0xee3360['attributes']:_0x18093d[_0x9889('0x3e')];_0xee3360[_0x9889('0x45')]=qs['sort'](_0x477077['query']['sort']);_0xee3360[_0x9889('0x47')]=qs[_0x9889('0x48')](_[_0x9889('0x5a')](_0x477077[_0x9889('0x3f')],_0x18093d[_0x9889('0x48')]));if(_0x477077['query'][_0x9889('0x49')]){_0xee3360['where']=_[_0x9889('0x4a')](_0xee3360[_0x9889('0x47')],{'$or':_[_0x9889('0x38')](_0xee3360[_0x9889('0x41')],function(_0x49cfec){var _0x39c63c={};_0x39c63c[_0x49cfec]={'$like':'%'+_0x477077[_0x9889('0x3f')][_0x9889('0x49')]+'%'};return _0x39c63c;})});}_0xee3360=_[_0x9889('0x4a')]({},_0xee3360,_0x477077[_0x9889('0x4d')]);return _0x32f375['getConfigurations'](_0xee3360);}})[_0x9889('0x20')](function(_0x381754){if(_0x381754){_0x3d621f=_0x381754[_0x9889('0x52')];if(!_0x477077[_0x9889('0x3f')][_0x9889('0x43')](_0x9889('0x44'))){_0xee3360[_0x9889('0x2e')]=qs[_0x9889('0x2e')](_0x477077[_0x9889('0x3f')]['limit']);_0xee3360['offset']=qs[_0x9889('0x2d')](_0x477077[_0x9889('0x3f')][_0x9889('0x2d')]);}return _0x32f375[_0x9889('0x57')](_0xee3360);}})[_0x9889('0x20')](function(_0x32a4cb){if(_0x32a4cb){return _0x32a4cb?{'count':_0x3d621f,'rows':_0x32a4cb}:null;}})[_0x9889('0x20')](respondWithResult(_0x45a5d1,null))['catch'](handleError(_0x45a5d1,null));};exports[_0x9889('0x5b')]=function(_0x24b18b,_0x356e63,_0x43921f){if(_0x24b18b[_0x9889('0x55')]['id']){delete _0x24b18b[_0x9889('0x55')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x24b18b[_0x9889('0x50')]['id']}})[_0x9889('0x20')](handleEntityNotFound(_0x356e63,null))[_0x9889('0x20')](function(_0x2af97f){if(_0x2af97f){_0x24b18b['body']['AccountId']=_0x2af97f['id'];_0x24b18b[_0x9889('0x55')][_0x9889('0x5c')]=integrations[_0x9889('0x5d')](_0x24b18b[_0x9889('0x55')]['channel'],_0x24b18b[_0x9889('0x55')][_0x9889('0x3c')]);_0x24b18b['body']['Descriptions']=integrations['getDescriptions'](_0x24b18b[_0x9889('0x55')][_0x9889('0x5e')],_0x24b18b[_0x9889('0x55')][_0x9889('0x3c')]);return db[_0x9889('0x59')][_0x9889('0x54')](_0x24b18b[_0x9889('0x55')],{'include':[{'model':db[_0x9889('0x5f')],'as':_0x9889('0x5c')},{'model':db['ZohoField'],'as':_0x9889('0x60')}]});}return null;})[_0x9889('0x20')](respondWithResult(_0x356e63,null))[_0x9889('0x28')](handleError(_0x356e63,null));};function getAccessToken(_0x32846c){return new Promise(function(_0x23c5db,_0x4e3556){var _0x3ffd3d;switch(_0x32846c[_0x9889('0x61')]){case'US':_0x3ffd3d=_0x9889('0x62');break;case'AU':_0x3ffd3d=_0x9889('0x63');break;case'EU':_0x3ffd3d='https://accounts.zoho.eu';break;case'IN':_0x3ffd3d=_0x9889('0x64');break;case'CN':_0x3ffd3d=_0x9889('0x65');break;default:_0x3ffd3d=_0x9889('0x66');break;}var _0x2f4387={'method':_0x9889('0x67'),'uri':_0x3ffd3d+'/oauth/v2/token','qs':{'refresh_token':_0x32846c['refreshToken'],'client_id':_0x32846c['clientId'],'client_secret':_0x32846c['clientSecret'],'grant_type':_0x9889('0x68')},'json':!![]};return rp(_0x2f4387)['then'](function(_0x11cf56){if(_0x11cf56[_0x9889('0x69')]){_0x23c5db(_0x11cf56['access_token']);}else{_0x4e3556('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x9889('0x28')](function(_0x2b6d9f){_0x4e3556(_0x2b6d9f);});});}exports[_0x9889('0x6a')]=function(_0x189eb4,_0x284b8a,_0x1ec6f3){var _0x338841,_0xcc030c,_0x448f59,_0x310602,_0x5d436f;return db[_0x9889('0x39')][_0x9889('0x58')]({'where':{'id':_0x189eb4[_0x9889('0x50')]['id']},'attributes':['id',_0x9889('0x6b'),_0x9889('0x61'),'clientId',_0x9889('0x6c'),'serverUrl',_0x9889('0x6d'),_0x9889('0x6e')]})[_0x9889('0x20')](handleEntityNotFound(_0x284b8a,null))['then'](function(_0x515348){_0x5d436f=_0x515348;_0x338841=_0x5d436f[_0x9889('0x6b')];_0xcc030c=_0x338841===_0x9889('0x6f')?'eu':_0x9889('0x70');_0x448f59=_0x5d436f[_0x9889('0x71')];var _0x12740e=_0x448f59[_0x9889('0x72')](-0x1);if(_0x12740e==='/'||_0x12740e==='\x5c'||_0x12740e===':'){_0x448f59=_0x448f59[_0x9889('0x73')](0x0,_0x448f59[_0x9889('0x74')](_0x12740e));}if(!_0x5d436f[_0x9889('0x6e')]){throw new Error(_0x9889('0x75'));}return getAccessToken(_0x5d436f);})[_0x9889('0x20')](function(_0x335068){if(_0x335068){return rp({'method':_0x9889('0x76'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0xcc030c),'qs':{'module':'Calls'},'headers':{'Authorization':_0x9889('0x77')+_0x335068},'json':!![]});}})[_0x9889('0x20')](function(_0x14f8f7){if(_0x14f8f7){if(_0x14f8f7[_0x9889('0x78')]&&_0x14f8f7['response'][_0x9889('0x25')]){throw new Error(_0x14f8f7[_0x9889('0x78')][_0x9889('0x25')][_0x9889('0x26')]);}var _0x4866f7=[];var _0x4c4f5f=[];var _0x24e0b9=[_0x9889('0x79'),_0x9889('0x7a'),_0x9889('0x7b'),'WhoId',_0x9889('0x7c'),_0x9889('0x7d'),_0x9889('0x7e'),_0x9889('0x7f')];_0x4c4f5f=_[_0x9889('0x80')](_0x14f8f7[_0x9889('0x42')],function(_0x2d451b){return _0x24e0b9[_0x9889('0x81')](_0x2d451b['api_name']);});for(var _0x42e951=0x0;_0x42e951<_0x4c4f5f[_0x9889('0x52')];_0x42e951++){if(_0x4c4f5f[_0x42e951][_0x9889('0x82')]===![]){_0x4866f7['push']({'id':_0x4c4f5f[_0x42e951]['id'],'name':_0x4c4f5f[_0x42e951][_0x9889('0x83')],'custom':_0x4c4f5f[_0x42e951][_0x9889('0x84')],'options':_0x4c4f5f[_0x42e951][_0x9889('0x85')]===_0x9889('0x86')&&_0x4c4f5f[_0x42e951][_0x9889('0x87')][_0x9889('0x52')]>-0x1?_[_0x9889('0x38')](_0x4c4f5f[_0x42e951]['pick_list_values'],function(_0x2c0566){return{'name':_0x2c0566,'value':_0x2c0566};}):[]});}}return{'count':_0x4866f7[_0x9889('0x52')],'rows':_0x4866f7};}else{return{'count':0x0,'rows':[]};}})[_0x9889('0x20')](respondWithResult(_0x284b8a,null))['catch'](function(_0x36b7de){var _0x2eb281=_0x189eb4['query'][_0x9889('0x1c')]?0x1f4:_0x36b7de[_0x9889('0x88')]||0x1f4;logger['error'](_0x9889('0x89'),_0x9889('0x6a'),_0x2eb281,JSON[_0x9889('0x24')](_0x36b7de));delete _0x36b7de[_0x9889('0x4c')];if(_0x2eb281===0x191){_0x2eb281=0x190;}_0x284b8a[_0x9889('0x2a')](_0x2eb281)[_0x9889('0x36')](_0x189eb4[_0x9889('0x3f')][_0x9889('0x1c')]?{'message':_0x9889('0x8a'),'statusCode':_0x36b7de[_0x9889('0x88')]}:_0x36b7de);});}; \ No newline at end of file +var _0x85e9=['refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','host','zoho.eu','com','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','Content-Range','apply','save','destroy','stack','name','index','map','ZohoAccount','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','show','includeAll','options','find','create','body','update','params','getConfigurations','findOne','ZohoConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','type','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST'];(function(_0x14aecd,_0xa312c0){var _0x316125=function(_0x1d73c5){while(--_0x1d73c5){_0x14aecd['push'](_0x14aecd['shift']());}};_0x316125(++_0xa312c0);}(_0x85e9,0xaf));var _0x985e=function(_0x1050a5,_0x1aa84b){_0x1050a5=_0x1050a5-0x0;var _0x19b066=_0x85e9[_0x1050a5];return _0x19b066;};'use strict';var pdf=require(_0x985e('0x0'));var emlformat=require(_0x985e('0x1'));var rimraf=require(_0x985e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x985e('0x3'));var moment=require(_0x985e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x985e('0x5'));var path=require(_0x985e('0x6'));var sox=require('sox');var csv=require(_0x985e('0x7'));var ejs=require(_0x985e('0x8'));var fs=require('fs');var _=require(_0x985e('0x9'));var squel=require(_0x985e('0xa'));var crypto=require(_0x985e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x985e('0xc'));var toCsv=require(_0x985e('0x7'));var querystring=require(_0x985e('0xd'));var Papa=require(_0x985e('0xe'));var Redis=require(_0x985e('0xf'));var authService=require(_0x985e('0x10'));var qs=require(_0x985e('0x11'));var as=require(_0x985e('0x12'));var hardwareService=require(_0x985e('0x13'));var logger=require(_0x985e('0x14'))('api');var utils=require(_0x985e('0x15'));var config=require('../../config/environment');var db=require(_0x985e('0x16'))['db'];var integrations=require(_0x985e('0x17'));var jayson=require(_0x985e('0x18'));var client=jayson[_0x985e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x269a1d,_0xfc77dc,_0xdb8cbf){if(_0xdb8cbf){var _0x5b80de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b80de[_0x985e('0x1a')](_0xfc77dc)){return _0x269a1d;}else{throw new db['Sequelize'][(_0x985e('0x1b'))](_0x985e('0x1c'));}}else{return _0x269a1d;}}function respondWithRpcPromise(_0xec3fa8,_0x5f24c,_0x5d4103,_0x43d27c){return new BPromise(function(_0x102a69,_0x2c1825){var _0x176e81=_0x43d27c||client;return _0x176e81[_0x985e('0x1d')](_0xec3fa8,_0x5d4103)[_0x985e('0x1e')](function(_0x37b669){logger[_0x985e('0x1f')](_0x985e('0x20'),_0x5f24c,_0x985e('0x21'));logger[_0x985e('0x22')](_0x985e('0x23'),_0x5f24c,'request\x20sent',JSON[_0x985e('0x24')](_0x37b669));if(_0x37b669[_0x985e('0x25')]){if(_0x37b669['error'][_0x985e('0x26')]===0x1f4){logger[_0x985e('0x25')](_0x985e('0x20'),_0x5f24c,_0x37b669[_0x985e('0x25')]['message']);return _0x2c1825(_0x37b669[_0x985e('0x25')][_0x985e('0x27')]);}logger[_0x985e('0x25')](_0x985e('0x20'),_0x5f24c,_0x37b669[_0x985e('0x25')][_0x985e('0x27')]);return _0x102a69(_0x37b669['error'][_0x985e('0x27')]);}else{logger[_0x985e('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x5f24c,'request\x20sent');_0x102a69(_0x37b669[_0x985e('0x28')][_0x985e('0x27')]);}})[_0x985e('0x29')](function(_0x129fb9){logger[_0x985e('0x25')](_0x985e('0x20'),_0x5f24c,_0x129fb9);_0x2c1825(_0x129fb9);});});}function respondWithStatusCode(_0x1234c5,_0x30270a){_0x30270a=_0x30270a||0xcc;return function(_0x296fef){if(_0x296fef){return _0x1234c5[_0x985e('0x2a')](_0x30270a);}return _0x1234c5[_0x985e('0x2b')](_0x30270a)[_0x985e('0x2c')]();};}function respondWithResult(_0x2edc5c,_0x52a7f8){_0x52a7f8=_0x52a7f8||0xc8;return function(_0x22f2ca){if(_0x22f2ca){return _0x2edc5c[_0x985e('0x2b')](_0x52a7f8)[_0x985e('0x2d')](_0x22f2ca);}};}function respondWithFilteredResult(_0x1d4e53,_0x52653e){return function(_0x3752e2){if(_0x3752e2){var _0x3382da=_0x3752e2['count'],_0x1e7eac=_0x52653e['offset'],_0x5a35e0=_0x52653e['offset']+_0x52653e['limit'],_0x1f97a6;if(_0x5a35e0>=_0x3382da){_0x5a35e0=_0x3382da;_0x1f97a6=0xc8;}else{_0x1f97a6=0xce;}_0x1d4e53[_0x985e('0x2b')](_0x1f97a6);return _0x1d4e53['set'](_0x985e('0x2e'),_0x1e7eac+'-'+_0x5a35e0+'/'+_0x3382da)['json'](_0x3752e2);}return null;};}function patchUpdates(_0x538eef){return function(_0x207bde){try{jsonpatch[_0x985e('0x2f')](_0x207bde,_0x538eef,!![]);}catch(_0x482946){return BPromise['reject'](_0x482946);}return _0x207bde[_0x985e('0x30')]();};}function saveUpdates(_0x31b2fa,_0x5596e8){return function(_0xb26a9a){if(_0xb26a9a){return _0xb26a9a['update'](_0x31b2fa)[_0x985e('0x1e')](function(_0x2a4a56){return _0x2a4a56;});}return null;};}function removeEntity(_0x308f98,_0x593a6a){return function(_0x556414){if(_0x556414){return _0x556414[_0x985e('0x31')]()['then'](function(){_0x308f98[_0x985e('0x2b')](0xcc)[_0x985e('0x2c')]();});}};}function handleEntityNotFound(_0xc91788,_0x3d20e2){return function(_0x17e6b9){if(!_0x17e6b9){_0xc91788[_0x985e('0x2a')](0x194);}return _0x17e6b9;};}function handleError(_0x35194e,_0x51046b){_0x51046b=_0x51046b||0x1f4;return function(_0x48c0f5){logger[_0x985e('0x25')](_0x48c0f5[_0x985e('0x32')]);if(_0x48c0f5[_0x985e('0x33')]){delete _0x48c0f5[_0x985e('0x33')];}_0x35194e[_0x985e('0x2b')](_0x51046b)['send'](_0x48c0f5);};}exports[_0x985e('0x34')]=function(_0x3bd249,_0x5c5d8b){var _0x3d235d={},_0x80ce83={},_0xaf3a97={'count':0x0,'rows':[]};var _0x5221e7=_[_0x985e('0x35')](db[_0x985e('0x36')][_0x985e('0x37')],function(_0x1fe99e){return{'name':_0x1fe99e['fieldName'],'type':_0x1fe99e['type'][_0x985e('0x38')]};});_0x80ce83['model']=_[_0x985e('0x35')](_0x5221e7,_0x985e('0x33'));_0x80ce83['query']=_[_0x985e('0x39')](_0x3bd249[_0x985e('0x3a')]);_0x80ce83[_0x985e('0x3b')]=_[_0x985e('0x3c')](_0x80ce83[_0x985e('0x3d')],_0x80ce83[_0x985e('0x3a')]);_0x3d235d[_0x985e('0x3e')]=_[_0x985e('0x3c')](_0x80ce83[_0x985e('0x3d')],qs[_0x985e('0x3f')](_0x3bd249['query'][_0x985e('0x3f')]));_0x3d235d['attributes']=_0x3d235d[_0x985e('0x3e')][_0x985e('0x40')]?_0x3d235d[_0x985e('0x3e')]:_0x80ce83[_0x985e('0x3d')];if(!_0x3bd249[_0x985e('0x3a')][_0x985e('0x41')](_0x985e('0x42'))){_0x3d235d[_0x985e('0x43')]=qs[_0x985e('0x43')](_0x3bd249[_0x985e('0x3a')]['limit']);_0x3d235d[_0x985e('0x44')]=qs[_0x985e('0x44')](_0x3bd249[_0x985e('0x3a')][_0x985e('0x44')]);}_0x3d235d['order']=qs[_0x985e('0x45')](_0x3bd249[_0x985e('0x3a')][_0x985e('0x45')]);_0x3d235d['where']=qs[_0x985e('0x3b')](_[_0x985e('0x46')](_0x3bd249[_0x985e('0x3a')],_0x80ce83['filters']),_0x5221e7);if(_0x3bd249[_0x985e('0x3a')][_0x985e('0x47')]){_0x3d235d[_0x985e('0x48')]=_['merge'](_0x3d235d[_0x985e('0x48')],{'$or':_[_0x985e('0x35')](_0x5221e7,function(_0x406ae9){if(_0x406ae9['type']!==_0x985e('0x49')){var _0x4cf349={};_0x4cf349[_0x406ae9[_0x985e('0x33')]]={'$like':'%'+_0x3bd249[_0x985e('0x3a')][_0x985e('0x47')]+'%'};return _0x4cf349;}})});}_0x3d235d=_[_0x985e('0x4a')]({},_0x3d235d,_0x3bd249['options']);var _0xdf9360={'where':_0x3d235d['where']};return db[_0x985e('0x36')][_0x985e('0x4b')](_0xdf9360)[_0x985e('0x1e')](function(_0x3a8b76){_0xaf3a97[_0x985e('0x4b')]=_0x3a8b76;if(_0x3bd249[_0x985e('0x3a')]['includeAll']){_0x3d235d[_0x985e('0x4c')]=[{'all':!![]}];}return db['ZohoAccount'][_0x985e('0x4d')](_0x3d235d);})[_0x985e('0x1e')](function(_0x58e6c0){_0xaf3a97[_0x985e('0x4e')]=_0x58e6c0;return _0xaf3a97;})[_0x985e('0x1e')](respondWithFilteredResult(_0x5c5d8b,_0x3d235d))[_0x985e('0x29')](handleError(_0x5c5d8b,null));};exports[_0x985e('0x4f')]=function(_0x163700,_0x20f307){var _0x1dc0de={'raw':![],'where':{'id':_0x163700['params']['id']}},_0x1d3ab4={};_0x1d3ab4[_0x985e('0x3d')]=_[_0x985e('0x39')](db[_0x985e('0x36')][_0x985e('0x37')]);_0x1d3ab4[_0x985e('0x3a')]=_[_0x985e('0x39')](_0x163700['query']);_0x1d3ab4['filters']=_['intersection'](_0x1d3ab4['model'],_0x1d3ab4[_0x985e('0x3a')]);_0x1dc0de[_0x985e('0x3e')]=_[_0x985e('0x3c')](_0x1d3ab4['model'],qs['fields'](_0x163700[_0x985e('0x3a')]['fields']));_0x1dc0de[_0x985e('0x3e')]=_0x1dc0de[_0x985e('0x3e')][_0x985e('0x40')]?_0x1dc0de[_0x985e('0x3e')]:_0x1d3ab4[_0x985e('0x3d')];if(_0x163700[_0x985e('0x3a')][_0x985e('0x50')]){_0x1dc0de['include']=[{'all':!![]}];}_0x1dc0de=_[_0x985e('0x4a')]({},_0x1dc0de,_0x163700[_0x985e('0x51')]);return db[_0x985e('0x36')][_0x985e('0x52')](_0x1dc0de)[_0x985e('0x1e')](handleEntityNotFound(_0x20f307,null))[_0x985e('0x1e')](respondWithResult(_0x20f307,null))['catch'](handleError(_0x20f307,null));};exports[_0x985e('0x53')]=function(_0x5c7bbf,_0x37b3d3){return db[_0x985e('0x36')]['create'](_0x5c7bbf[_0x985e('0x54')],{})[_0x985e('0x1e')](respondWithResult(_0x37b3d3,0xc9))[_0x985e('0x29')](handleError(_0x37b3d3,null));};exports[_0x985e('0x55')]=function(_0x5c57da,_0x58b1b5){if(_0x5c57da[_0x985e('0x54')]['id']){delete _0x5c57da['body']['id'];}return db[_0x985e('0x36')][_0x985e('0x52')]({'where':{'id':_0x5c57da[_0x985e('0x56')]['id']}})[_0x985e('0x1e')](handleEntityNotFound(_0x58b1b5,null))[_0x985e('0x1e')](saveUpdates(_0x5c57da['body'],null))['then'](respondWithResult(_0x58b1b5,null))[_0x985e('0x29')](handleError(_0x58b1b5,null));};exports['destroy']=function(_0x48c0d3,_0x2e3712){return db[_0x985e('0x36')]['find']({'where':{'id':_0x48c0d3[_0x985e('0x56')]['id']}})['then'](handleEntityNotFound(_0x2e3712,null))[_0x985e('0x1e')](removeEntity(_0x2e3712,null))[_0x985e('0x29')](handleError(_0x2e3712,null));};exports[_0x985e('0x57')]=function(_0x10e7d0,_0xb67884,_0x3797f6){var _0x15cc95={};var _0x2f9f25={};var _0x36103e;var _0x30c2e4;return db[_0x985e('0x36')][_0x985e('0x58')]({'where':{'id':_0x10e7d0[_0x985e('0x56')]['id']}})[_0x985e('0x1e')](handleEntityNotFound(_0xb67884,null))[_0x985e('0x1e')](function(_0x203c43){if(_0x203c43){_0x36103e=_0x203c43;_0x2f9f25[_0x985e('0x3d')]=_[_0x985e('0x39')](db[_0x985e('0x59')][_0x985e('0x37')]);_0x2f9f25['query']=_[_0x985e('0x39')](_0x10e7d0[_0x985e('0x3a')]);_0x2f9f25[_0x985e('0x3b')]=_[_0x985e('0x3c')](_0x2f9f25[_0x985e('0x3d')],_0x2f9f25[_0x985e('0x3a')]);_0x15cc95[_0x985e('0x3e')]=_[_0x985e('0x3c')](_0x2f9f25[_0x985e('0x3d')],qs[_0x985e('0x3f')](_0x10e7d0[_0x985e('0x3a')][_0x985e('0x3f')]));_0x15cc95['attributes']=_0x15cc95[_0x985e('0x3e')][_0x985e('0x40')]?_0x15cc95[_0x985e('0x3e')]:_0x2f9f25[_0x985e('0x3d')];_0x15cc95['order']=qs[_0x985e('0x45')](_0x10e7d0[_0x985e('0x3a')][_0x985e('0x45')]);_0x15cc95['where']=qs[_0x985e('0x3b')](_['pick'](_0x10e7d0[_0x985e('0x3a')],_0x2f9f25[_0x985e('0x3b')]));if(_0x10e7d0['query'][_0x985e('0x47')]){_0x15cc95[_0x985e('0x48')]=_[_0x985e('0x4a')](_0x15cc95[_0x985e('0x48')],{'$or':_[_0x985e('0x35')](_0x15cc95[_0x985e('0x3e')],function(_0x15be84){var _0x4e4ba1={};_0x4e4ba1[_0x15be84]={'$like':'%'+_0x10e7d0[_0x985e('0x3a')][_0x985e('0x47')]+'%'};return _0x4e4ba1;})});}_0x15cc95=_[_0x985e('0x4a')]({},_0x15cc95,_0x10e7d0['options']);return _0x36103e[_0x985e('0x57')](_0x15cc95);}})[_0x985e('0x1e')](function(_0x494fb7){if(_0x494fb7){_0x30c2e4=_0x494fb7[_0x985e('0x40')];if(!_0x10e7d0[_0x985e('0x3a')][_0x985e('0x41')](_0x985e('0x42'))){_0x15cc95[_0x985e('0x43')]=qs[_0x985e('0x43')](_0x10e7d0[_0x985e('0x3a')][_0x985e('0x43')]);_0x15cc95[_0x985e('0x44')]=qs[_0x985e('0x44')](_0x10e7d0['query'][_0x985e('0x44')]);}return _0x36103e[_0x985e('0x57')](_0x15cc95);}})[_0x985e('0x1e')](function(_0x2e8023){if(_0x2e8023){return _0x2e8023?{'count':_0x30c2e4,'rows':_0x2e8023}:null;}})['then'](respondWithResult(_0xb67884,null))[_0x985e('0x29')](handleError(_0xb67884,null));};exports['addConfiguration']=function(_0x45611c,_0x267d4b,_0x2413e4){if(_0x45611c['body']['id']){delete _0x45611c[_0x985e('0x54')]['id'];}return db[_0x985e('0x36')][_0x985e('0x58')]({'where':{'id':_0x45611c[_0x985e('0x56')]['id']}})['then'](handleEntityNotFound(_0x267d4b,null))[_0x985e('0x1e')](function(_0x288dc4){if(_0x288dc4){_0x45611c['body'][_0x985e('0x5a')]=_0x288dc4['id'];_0x45611c['body'][_0x985e('0x5b')]=integrations[_0x985e('0x5c')](_0x45611c[_0x985e('0x54')]['channel'],_0x45611c[_0x985e('0x54')]['type']);_0x45611c[_0x985e('0x54')][_0x985e('0x5d')]=integrations[_0x985e('0x5e')](_0x45611c[_0x985e('0x54')][_0x985e('0x5f')],_0x45611c[_0x985e('0x54')][_0x985e('0x60')]);return db[_0x985e('0x59')][_0x985e('0x53')](_0x45611c[_0x985e('0x54')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x985e('0x61')],'as':_0x985e('0x5d')}]});}return null;})[_0x985e('0x1e')](respondWithResult(_0x267d4b,null))['catch'](handleError(_0x267d4b,null));};function getAccessToken(_0x4f14ff){return new Promise(function(_0x403d07,_0x297136){var _0x1cf51b;switch(_0x4f14ff[_0x985e('0x62')]){case'US':_0x1cf51b='https://accounts.zoho.com';break;case'AU':_0x1cf51b=_0x985e('0x63');break;case'EU':_0x1cf51b=_0x985e('0x64');break;case'IN':_0x1cf51b=_0x985e('0x65');break;case'CN':_0x1cf51b='https://accounts.zoho.com.cn';break;default:_0x1cf51b=_0x985e('0x64');break;}var _0xd8e01f={'method':_0x985e('0x66'),'uri':_0x1cf51b+'/oauth/v2/token','qs':{'refresh_token':_0x4f14ff[_0x985e('0x67')],'client_id':_0x4f14ff['clientId'],'client_secret':_0x4f14ff[_0x985e('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xd8e01f)[_0x985e('0x1e')](function(_0x58c15e){if(_0x58c15e[_0x985e('0x69')]){_0x403d07(_0x58c15e['access_token']);}else{_0x297136(_0x985e('0x6a'));}})[_0x985e('0x29')](function(_0x4768ad){_0x297136(_0x4768ad);});});}exports[_0x985e('0x6b')]=function(_0x4c6c96,_0x16c6b1,_0x5bf881){var _0x3cf87c,_0x534f63,_0xc221bf,_0x4af226,_0x6a9313;return db[_0x985e('0x36')]['findOne']({'where':{'id':_0x4c6c96[_0x985e('0x56')]['id']},'attributes':['id','host',_0x985e('0x62'),_0x985e('0x6c'),'clientSecret','serverUrl',_0x985e('0x26'),'refreshToken']})['then'](handleEntityNotFound(_0x16c6b1,null))[_0x985e('0x1e')](function(_0x14ff5b){_0x6a9313=_0x14ff5b;_0x3cf87c=_0x6a9313[_0x985e('0x6d')];_0x534f63=_0x3cf87c===_0x985e('0x6e')?'eu':_0x985e('0x6f');_0xc221bf=_0x6a9313['serverUrl'];var _0x3917d9=_0xc221bf[_0x985e('0x70')](-0x1);if(_0x3917d9==='/'||_0x3917d9==='\x5c'||_0x3917d9===':'){_0xc221bf=_0xc221bf[_0x985e('0x71')](0x0,_0xc221bf[_0x985e('0x72')](_0x3917d9));}if(!_0x6a9313['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x6a9313);})[_0x985e('0x1e')](function(_0x12458e){if(_0x12458e){return rp({'method':_0x985e('0x73'),'uri':util['format'](_0x985e('0x74'),_0x534f63),'qs':{'module':_0x985e('0x75')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12458e},'json':!![]});}})[_0x985e('0x1e')](function(_0x3b2b76){if(_0x3b2b76){if(_0x3b2b76['response']&&_0x3b2b76[_0x985e('0x76')][_0x985e('0x25')]){throw new Error(_0x3b2b76[_0x985e('0x76')][_0x985e('0x25')][_0x985e('0x27')]);}var _0x325422=[];var _0x58972b=[];var _0x294ec9=[_0x985e('0x77'),_0x985e('0x78'),_0x985e('0x79'),'WhoId',_0x985e('0x7a'),_0x985e('0x7b'),_0x985e('0x7c'),_0x985e('0x7d')];_0x58972b=_[_0x985e('0x7e')](_0x3b2b76[_0x985e('0x3f')],function(_0x12cb55){return _0x294ec9[_0x985e('0x7f')](_0x12cb55[_0x985e('0x80')]);});for(var _0x4328ba=0x0;_0x4328ba<_0x58972b[_0x985e('0x40')];_0x4328ba++){if(_0x58972b[_0x4328ba][_0x985e('0x81')]===![]){_0x325422[_0x985e('0x82')]({'id':_0x58972b[_0x4328ba]['id'],'name':_0x58972b[_0x4328ba][_0x985e('0x83')],'custom':_0x58972b[_0x4328ba]['custom_field'],'options':_0x58972b[_0x4328ba][_0x985e('0x84')]===_0x985e('0x85')&&_0x58972b[_0x4328ba][_0x985e('0x86')][_0x985e('0x40')]>-0x1?_[_0x985e('0x35')](_0x58972b[_0x4328ba][_0x985e('0x86')],function(_0x549033){return{'name':_0x549033,'value':_0x549033};}):[]});}}return{'count':_0x325422[_0x985e('0x40')],'rows':_0x325422};}else{return{'count':0x0,'rows':[]};}})[_0x985e('0x1e')](respondWithResult(_0x16c6b1,null))[_0x985e('0x29')](function(_0x41da43){var _0x401f05=_0x4c6c96[_0x985e('0x3a')][_0x985e('0x1a')]?0x1f4:_0x41da43[_0x985e('0x87')]||0x1f4;logger[_0x985e('0x25')](_0x985e('0x88'),'getFields',_0x401f05,JSON[_0x985e('0x24')](_0x41da43));delete _0x41da43[_0x985e('0x33')];if(_0x401f05===0x191){_0x401f05=0x190;}_0x16c6b1['status'](_0x401f05)[_0x985e('0x89')](_0x4c6c96[_0x985e('0x3a')][_0x985e('0x1a')]?{'message':_0x985e('0x8a'),'statusCode':_0x41da43['statusCode']}:_0x41da43);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ba3661f..e7d6ad0 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 _0xe6e4=['catch','clientSecret','slice','lastIndexOf','https://accounts.zoho.eu','authorization_code','lodash','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','host','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','serverUrl','code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect'];(function(_0x12ac74,_0x41c6ee){var _0x17ea2a=function(_0x1ad963){while(--_0x1ad963){_0x12ac74['push'](_0x12ac74['shift']());}};_0x17ea2a(++_0x41c6ee);}(_0xe6e4,0x180));var _0x4e6e=function(_0x13e4d6,_0x4d647f){_0x13e4d6=_0x13e4d6-0x0;var _0x395c06=_0xe6e4[_0x13e4d6];return _0x395c06;};'use strict';var _=require(_0x4e6e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rp=require(_0x4e6e('0x4'));var fs=require('fs');var path=require(_0x4e6e('0x5'));var rimraf=require('rimraf');var config=require(_0x4e6e('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x4e6e('0x7'));module[_0x4e6e('0x8')]=function(_0x5cce3c,_0x2de157){return _0x5cce3c[_0x4e6e('0x9')](_0x4e6e('0xa'),attributes,{'tableName':_0x4e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x14465b,_0x51a776,_0x5d666b){if(_0x14465b[_0x4e6e('0xc')]('zone')||_0x14465b[_0x4e6e('0xc')]('serverUrl')||_0x14465b[_0x4e6e('0xc')](_0x4e6e('0xd'))||_0x14465b[_0x4e6e('0xc')]('clientSecret')||_0x14465b[_0x4e6e('0xc')]('code')||_0x14465b[_0x4e6e('0xc')](_0x4e6e('0xe'))){var _0x4c65ec,_0x1b288d;_0x4c65ec=_0x14465b['serverUrl'];var _0x1ffae3=_0x4c65ec['slice'](-0x1);if(_0x1ffae3==='/'||_0x1ffae3==='\x5c'||_0x1ffae3===':'){_0x4c65ec=_0x4c65ec[_0x4e6e('0xf')](0x0,_0x4c65ec['lastIndexOf'](_0x1ffae3));}switch(_0x14465b[_0x4e6e('0x10')]){case'US':_0x1b288d=_0x4e6e('0x11');break;case'AU':_0x1b288d=_0x4e6e('0x12');break;case'IN':_0x1b288d=_0x4e6e('0x13');break;case'CN':_0x1b288d=_0x4e6e('0x14');break;default:_0x1b288d='https://accounts.zoho.eu';break;}var _0x52610f={'method':_0x4e6e('0x15'),'uri':_0x1b288d+_0x4e6e('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x14465b[_0x4e6e('0xd')],'client_secret':_0x14465b['clientSecret'],'redirect_uri':_0x14465b[_0x4e6e('0x17')],'code':_0x14465b[_0x4e6e('0x18')]},'headers':{'Content-Type':_0x4e6e('0x19')}};return rp(_0x52610f)['then'](function(_0x225df2){var _0x3286b4=JSON[_0x4e6e('0x1a')](_0x225df2);if(_0x3286b4['refresh_token']){_0x14465b[_0x4e6e('0x1b')]=_0x3286b4[_0x4e6e('0x1c')];logger[_0x4e6e('0x1d')](util[_0x4e6e('0x1e')](_0x4e6e('0x1f'),_0x14465b['name'],_0x14465b['id']));}else{logger[_0x4e6e('0x20')](util['format'](_0x4e6e('0x21'),_0x14465b[_0x4e6e('0x22')],_0x14465b['id']),util[_0x4e6e('0x23')](_0x3286b4,{'showHidden':![],'depth':null}));}return _0x5d666b(null,_0x51a776);})[_0x4e6e('0x24')](function(_0x2a5c40){logger[_0x4e6e('0x20')](util[_0x4e6e('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14465b[_0x4e6e('0x22')],_0x14465b['id']),util[_0x4e6e('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5d666b(_0x2a5c40);});}else{return _0x5d666b(null,_0x51a776);}},'beforeUpdate':function(_0x36f13e,_0x504a59,_0x29e230){if(_0x36f13e['changed'](_0x4e6e('0x10'))||_0x36f13e['changed'](_0x4e6e('0x17'))||_0x36f13e['changed'](_0x4e6e('0xd'))||_0x36f13e['changed'](_0x4e6e('0x25'))||_0x36f13e['changed']('code')||_0x36f13e[_0x4e6e('0xc')](_0x4e6e('0xe'))){var _0x1290c4,_0x5a7db3;_0x1290c4=_0x36f13e[_0x4e6e('0x17')];var _0x1fcdf4=_0x1290c4[_0x4e6e('0x26')](-0x1);if(_0x1fcdf4==='/'||_0x1fcdf4==='\x5c'||_0x1fcdf4===':'){_0x1290c4=_0x1290c4[_0x4e6e('0xf')](0x0,_0x1290c4[_0x4e6e('0x27')](_0x1fcdf4));}switch(_0x36f13e['zone']){case'US':_0x5a7db3=_0x4e6e('0x11');break;case'AU':_0x5a7db3=_0x4e6e('0x12');break;case'IN':_0x5a7db3=_0x4e6e('0x13');break;case'CN':_0x5a7db3=_0x4e6e('0x14');break;default:_0x5a7db3=_0x4e6e('0x28');break;}var _0x202591={'method':_0x4e6e('0x15'),'uri':_0x5a7db3+'/oauth/v2/token','form':{'grant_type':_0x4e6e('0x29'),'client_id':_0x36f13e['clientId'],'client_secret':_0x36f13e[_0x4e6e('0x25')],'redirect_uri':_0x36f13e['serverUrl'],'code':_0x36f13e[_0x4e6e('0x18')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x202591)['then'](function(_0x28e021){var _0x3494a1=JSON[_0x4e6e('0x1a')](_0x28e021);if(_0x3494a1[_0x4e6e('0x1c')]){_0x36f13e[_0x4e6e('0x1b')]=_0x3494a1[_0x4e6e('0x1c')];logger[_0x4e6e('0x1d')](util[_0x4e6e('0x1e')](_0x4e6e('0x1f'),_0x36f13e[_0x4e6e('0x22')],_0x36f13e['id']));}else{logger['error'](util[_0x4e6e('0x1e')](_0x4e6e('0x21'),_0x36f13e[_0x4e6e('0x22')],_0x36f13e['id']),util[_0x4e6e('0x23')](_0x3494a1,{'showHidden':![],'depth':null}));}return _0x29e230(null,_0x504a59);})[_0x4e6e('0x24')](function(_0x5a1b2a){logger[_0x4e6e('0x20')](util[_0x4e6e('0x1e')](_0x4e6e('0x21'),_0x36f13e[_0x4e6e('0x22')],_0x36f13e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x29e230(_0x5a1b2a);});}else{return _0x29e230(null,_0x504a59);}}}});}; \ No newline at end of file +var _0x0863=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','lastIndexOf','parse','format','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0863,0x1e6));var _0x3086=function(_0x2ca6d0,_0x5093e2){_0x2ca6d0=_0x2ca6d0-0x0;var _0x48952a=_0x0863[_0x2ca6d0];return _0x48952a;};'use strict';var _=require(_0x3086('0x0'));var util=require(_0x3086('0x1'));var logger=require(_0x3086('0x2'))(_0x3086('0x3'));var moment=require(_0x3086('0x4'));var BPromise=require(_0x3086('0x5'));var rp=require(_0x3086('0x6'));var fs=require('fs');var path=require(_0x3086('0x7'));var rimraf=require(_0x3086('0x8'));var config=require('../../config/environment');var attributes=require(_0x3086('0x9'));var integrations=require(_0x3086('0xa'));module[_0x3086('0xb')]=function(_0x2247f8,_0x5004f7){return _0x2247f8[_0x3086('0xc')]('ZohoAccount',attributes,{'tableName':_0x3086('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4797b2,_0x20a5e6,_0x369975){if(_0x4797b2['changed'](_0x3086('0xe'))||_0x4797b2[_0x3086('0xf')](_0x3086('0x10'))||_0x4797b2[_0x3086('0xf')](_0x3086('0x11'))||_0x4797b2[_0x3086('0xf')](_0x3086('0x12'))||_0x4797b2[_0x3086('0xf')](_0x3086('0x13'))||_0x4797b2['changed'](_0x3086('0x14'))){var _0x2a1bce,_0x1494f2;_0x2a1bce=_0x4797b2[_0x3086('0x10')];var _0x496141=_0x2a1bce['slice'](-0x1);if(_0x496141==='/'||_0x496141==='\x5c'||_0x496141===':'){_0x2a1bce=_0x2a1bce[_0x3086('0x15')](0x0,_0x2a1bce['lastIndexOf'](_0x496141));}switch(_0x4797b2[_0x3086('0xe')]){case'US':_0x1494f2=_0x3086('0x16');break;case'AU':_0x1494f2=_0x3086('0x17');break;case'IN':_0x1494f2=_0x3086('0x18');break;case'CN':_0x1494f2=_0x3086('0x19');break;default:_0x1494f2=_0x3086('0x1a');break;}var _0x352d0f={'method':_0x3086('0x1b'),'uri':_0x1494f2+_0x3086('0x1c'),'form':{'grant_type':_0x3086('0x1d'),'client_id':_0x4797b2[_0x3086('0x11')],'client_secret':_0x4797b2['clientSecret'],'redirect_uri':_0x4797b2[_0x3086('0x10')],'code':_0x4797b2[_0x3086('0x13')]},'headers':{'Content-Type':_0x3086('0x1e')}};return rp(_0x352d0f)[_0x3086('0x1f')](function(_0x202936){var _0x344213=JSON['parse'](_0x202936);if(_0x344213[_0x3086('0x20')]){_0x4797b2[_0x3086('0x21')]=_0x344213['refresh_token'];logger[_0x3086('0x22')](util['format'](_0x3086('0x23'),_0x4797b2[_0x3086('0x24')],_0x4797b2['id']));}else{logger[_0x3086('0x25')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4797b2[_0x3086('0x24')],_0x4797b2['id']),util[_0x3086('0x26')](_0x344213,{'showHidden':![],'depth':null}));}return _0x369975(null,_0x20a5e6);})['catch'](function(_0x102fa6){logger[_0x3086('0x25')](util['format'](_0x3086('0x27'),_0x4797b2[_0x3086('0x24')],_0x4797b2['id']),util[_0x3086('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x369975(_0x102fa6);});}else{return _0x369975(null,_0x20a5e6);}},'beforeUpdate':function(_0x465aa4,_0x268790,_0x17b197){if(_0x465aa4['changed'](_0x3086('0xe'))||_0x465aa4[_0x3086('0xf')](_0x3086('0x10'))||_0x465aa4[_0x3086('0xf')](_0x3086('0x11'))||_0x465aa4[_0x3086('0xf')](_0x3086('0x12'))||_0x465aa4[_0x3086('0xf')](_0x3086('0x13'))||_0x465aa4[_0x3086('0xf')](_0x3086('0x14'))){var _0x2de9c6,_0x38ca4c;_0x2de9c6=_0x465aa4['serverUrl'];var _0x326e20=_0x2de9c6[_0x3086('0x28')](-0x1);if(_0x326e20==='/'||_0x326e20==='\x5c'||_0x326e20===':'){_0x2de9c6=_0x2de9c6[_0x3086('0x15')](0x0,_0x2de9c6[_0x3086('0x29')](_0x326e20));}switch(_0x465aa4[_0x3086('0xe')]){case'US':_0x38ca4c='https://accounts.zoho.com';break;case'AU':_0x38ca4c='https://accounts.zoho.com.au';break;case'IN':_0x38ca4c='https://accounts.zoho.in';break;case'CN':_0x38ca4c=_0x3086('0x19');break;default:_0x38ca4c='https://accounts.zoho.eu';break;}var _0x26a090={'method':_0x3086('0x1b'),'uri':_0x38ca4c+'/oauth/v2/token','form':{'grant_type':_0x3086('0x1d'),'client_id':_0x465aa4[_0x3086('0x11')],'client_secret':_0x465aa4[_0x3086('0x12')],'redirect_uri':_0x465aa4['serverUrl'],'code':_0x465aa4['code']},'headers':{'Content-Type':_0x3086('0x1e')}};return rp(_0x26a090)[_0x3086('0x1f')](function(_0x1e5b7f){var _0x2ad9d2=JSON[_0x3086('0x2a')](_0x1e5b7f);if(_0x2ad9d2[_0x3086('0x20')]){_0x465aa4['refreshToken']=_0x2ad9d2[_0x3086('0x20')];logger[_0x3086('0x22')](util[_0x3086('0x2b')](_0x3086('0x23'),_0x465aa4[_0x3086('0x24')],_0x465aa4['id']));}else{logger[_0x3086('0x25')](util[_0x3086('0x2b')](_0x3086('0x27'),_0x465aa4[_0x3086('0x24')],_0x465aa4['id']),util[_0x3086('0x26')](_0x2ad9d2,{'showHidden':![],'depth':null}));}return _0x17b197(null,_0x268790);})[_0x3086('0x2c')](function(_0x54091e){logger[_0x3086('0x25')](util[_0x3086('0x2b')](_0x3086('0x27'),_0x465aa4[_0x3086('0x24')],_0x465aa4['id']),util[_0x3086('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x17b197(_0x54091e);});}else{return _0x17b197(null,_0x268790);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index deb2060..f9e6208 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 _0x445e=['code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','attributes','model','stringify','ShowZohoAccount','raw','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error'];(function(_0x5bf19e,_0x18e9ad){var _0x8304bb=function(_0x23071b){while(--_0x23071b){_0x5bf19e['push'](_0x5bf19e['shift']());}};_0x8304bb(++_0x18e9ad);}(_0x445e,0x1d1));var _0xe445=function(_0x3cdb33,_0xff5c5c){_0x3cdb33=_0x3cdb33-0x0;var _0x4fdf7c=_0x445e[_0x3cdb33];return _0x4fdf7c;};'use strict';var _=require(_0xe445('0x0'));var util=require(_0xe445('0x1'));var moment=require(_0xe445('0x2'));var BPromise=require(_0xe445('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe445('0x4'));var logger=require('../../config/logger')(_0xe445('0x5'));var config=require(_0xe445('0x6'));var jayson=require(_0xe445('0x7'));var client=jayson[_0xe445('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26c8ec,_0x2917bf,_0x3b80bc){return new BPromise(function(_0x83c743,_0x3f3da1){return client[_0xe445('0x9')](_0x26c8ec,_0x3b80bc)[_0xe445('0xa')](function(_0x4ca413){logger[_0xe445('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2917bf,_0xe445('0xc'));logger[_0xe445('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2917bf,_0xe445('0xc'),JSON['stringify'](_0x4ca413));if(_0x4ca413[_0xe445('0xe')]){if(_0x4ca413[_0xe445('0xe')][_0xe445('0xf')]===0x1f4){logger['error'](_0xe445('0x10'),_0x2917bf,_0x4ca413['error'][_0xe445('0x11')]);return _0x3f3da1(_0x4ca413[_0xe445('0xe')][_0xe445('0x11')]);}logger[_0xe445('0xe')](_0xe445('0x10'),_0x2917bf,_0x4ca413[_0xe445('0xe')][_0xe445('0x11')]);return _0x83c743(_0x4ca413[_0xe445('0xe')]['message']);}else{logger[_0xe445('0xb')](_0xe445('0x10'),_0x2917bf,_0xe445('0xc'));_0x83c743(_0x4ca413['result'][_0xe445('0x11')]);}})[_0xe445('0x12')](function(_0x2b5dd4){logger[_0xe445('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2917bf,_0x2b5dd4);_0x3f3da1(_0x2b5dd4);});});}exports[_0xe445('0x13')]=function(_0x32a8dc){var _0x21c925=this;return new Promise(function(_0x2d55ea,_0xc4ef49){return db[_0xe445('0x14')][_0xe445('0x15')]({'raw':_0x32a8dc['options']?_0x32a8dc[_0xe445('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x32a8dc[_0xe445('0x16')]?_0x32a8dc[_0xe445('0x16')][_0xe445('0x17')]||null:null,'attributes':_0x32a8dc[_0xe445('0x16')]?_0x32a8dc[_0xe445('0x16')]['attributes']||null:null,'limit':_0x32a8dc[_0xe445('0x16')]?_0x32a8dc[_0xe445('0x16')][_0xe445('0x18')]||null:null,'include':_0x32a8dc[_0xe445('0x16')]?_0x32a8dc['options'][_0xe445('0x19')]?_[_0xe445('0x1a')](_0x32a8dc['options'][_0xe445('0x19')],function(_0x1beab8){return{'model':db[_0x1beab8['model']],'as':_0x1beab8['as'],'attributes':_0x1beab8[_0xe445('0x1b')],'include':_0x1beab8[_0xe445('0x19')]?_[_0xe445('0x1a')](_0x1beab8['include'],function(_0x250f22){return{'model':db[_0x250f22[_0xe445('0x1c')]],'as':_0x250f22['as'],'attributes':_0x250f22[_0xe445('0x1b')],'include':_0x250f22['include']?_[_0xe445('0x1a')](_0x250f22[_0xe445('0x19')],function(_0x1e59b8){return{'model':db[_0x1e59b8[_0xe445('0x1c')]],'as':_0x1e59b8['as'],'attributes':_0x1e59b8[_0xe445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe445('0xa')](function(_0xbcd066){logger['info'](_0xe445('0x13'),_0x32a8dc);logger[_0xe445('0xd')](_0xe445('0x13'),_0x32a8dc,JSON[_0xe445('0x1d')](_0xbcd066));_0x2d55ea(_0xbcd066);})['catch'](function(_0x367980){logger[_0xe445('0xe')](_0xe445('0x13'),_0x367980[_0xe445('0x11')],_0x32a8dc);_0xc4ef49(_0x21c925[_0xe445('0xe')](0x1f4,_0x367980[_0xe445('0x11')]));});});};exports[_0xe445('0x1e')]=function(_0x29c69c){var _0x2e7087=this;return new Promise(function(_0x3da0b4,_0x2dcbac){return db[_0xe445('0x14')]['find']({'raw':_0x29c69c[_0xe445('0x16')]?_0x29c69c[_0xe445('0x16')][_0xe445('0x1f')]===undefined?!![]:![]:!![],'where':_0x29c69c[_0xe445('0x16')]?_0x29c69c[_0xe445('0x16')]['where']||null:null,'attributes':_0x29c69c[_0xe445('0x16')]?_0x29c69c[_0xe445('0x16')]['attributes']||null:null,'include':_0x29c69c[_0xe445('0x16')]?_0x29c69c[_0xe445('0x16')][_0xe445('0x19')]?_[_0xe445('0x1a')](_0x29c69c[_0xe445('0x16')][_0xe445('0x19')],function(_0x26877a){return{'model':db[_0x26877a['model']],'as':_0x26877a['as'],'attributes':_0x26877a[_0xe445('0x1b')],'include':_0x26877a[_0xe445('0x19')]?_[_0xe445('0x1a')](_0x26877a[_0xe445('0x19')],function(_0x23f027){return{'model':db[_0x23f027[_0xe445('0x1c')]],'as':_0x23f027['as'],'attributes':_0x23f027[_0xe445('0x1b')],'include':_0x23f027[_0xe445('0x19')]?_[_0xe445('0x1a')](_0x23f027['include'],function(_0x25c56f){return{'model':db[_0x25c56f[_0xe445('0x1c')]],'as':_0x25c56f['as'],'attributes':_0x25c56f[_0xe445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe445('0xa')](function(_0x23b009){logger['info']('ShowZohoAccount',_0x29c69c);logger['debug'](_0xe445('0x1e'),_0x29c69c,JSON['stringify'](_0x23b009));_0x3da0b4(_0x23b009);})[_0xe445('0x12')](function(_0x2a01f9){logger[_0xe445('0xe')]('ShowZohoAccount',_0x2a01f9[_0xe445('0x11')],_0x29c69c);_0x2dcbac(_0x2e7087['error'](0x1f4,_0x2a01f9[_0xe445('0x11')]));});});}; \ No newline at end of file +var _0x652e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZohoAccount','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','lodash','moment','bluebird','ioredis'];(function(_0x5a1864,_0x2cd8e2){var _0x2b3370=function(_0x119ed5){while(--_0x119ed5){_0x5a1864['push'](_0x5a1864['shift']());}};_0x2b3370(++_0x2cd8e2);}(_0x652e,0xc8));var _0xe652=function(_0x16fe8f,_0xbe83f6){_0x16fe8f=_0x16fe8f-0x0;var _0x4e6a05=_0x652e[_0x16fe8f];return _0x4e6a05;};'use strict';var _=require(_0xe652('0x0'));var util=require('util');var moment=require(_0xe652('0x1'));var BPromise=require(_0xe652('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe652('0x3'));var db=require(_0xe652('0x4'))['db'];var utils=require(_0xe652('0x5'));var logger=require(_0xe652('0x6'))(_0xe652('0x7'));var config=require(_0xe652('0x8'));var jayson=require(_0xe652('0x9'));var client=jayson[_0xe652('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2149ba,_0x57513f,_0x33b189){return new BPromise(function(_0x4c35f4,_0x332b07){return client['request'](_0x2149ba,_0x33b189)[_0xe652('0xb')](function(_0x370199){logger[_0xe652('0xc')](_0xe652('0xd'),_0x57513f,_0xe652('0xe'));logger[_0xe652('0xf')](_0xe652('0x10'),_0x57513f,_0xe652('0xe'),JSON[_0xe652('0x11')](_0x370199));if(_0x370199[_0xe652('0x12')]){if(_0x370199[_0xe652('0x12')]['code']===0x1f4){logger[_0xe652('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x57513f,_0x370199[_0xe652('0x12')]['message']);return _0x332b07(_0x370199[_0xe652('0x12')][_0xe652('0x13')]);}logger[_0xe652('0x12')](_0xe652('0xd'),_0x57513f,_0x370199[_0xe652('0x12')][_0xe652('0x13')]);return _0x4c35f4(_0x370199[_0xe652('0x12')][_0xe652('0x13')]);}else{logger['info'](_0xe652('0xd'),_0x57513f,_0xe652('0xe'));_0x4c35f4(_0x370199[_0xe652('0x14')][_0xe652('0x13')]);}})[_0xe652('0x15')](function(_0xacd626){logger['error'](_0xe652('0xd'),_0x57513f,_0xacd626);_0x332b07(_0xacd626);});});}exports['GetZohoAccount']=function(_0x3e7778){var _0x1ada85=this;return new Promise(function(_0x4ea040,_0x1cecec){return db[_0xe652('0x16')]['findAll']({'raw':_0x3e7778[_0xe652('0x17')]?_0x3e7778[_0xe652('0x17')][_0xe652('0x18')]===undefined?!![]:![]:!![],'where':_0x3e7778['options']?_0x3e7778[_0xe652('0x17')][_0xe652('0x19')]||null:null,'attributes':_0x3e7778[_0xe652('0x17')]?_0x3e7778[_0xe652('0x17')][_0xe652('0x1a')]||null:null,'limit':_0x3e7778[_0xe652('0x17')]?_0x3e7778[_0xe652('0x17')][_0xe652('0x1b')]||null:null,'include':_0x3e7778[_0xe652('0x17')]?_0x3e7778[_0xe652('0x17')][_0xe652('0x1c')]?_['map'](_0x3e7778[_0xe652('0x17')][_0xe652('0x1c')],function(_0xb5d89b){return{'model':db[_0xb5d89b[_0xe652('0x1d')]],'as':_0xb5d89b['as'],'attributes':_0xb5d89b[_0xe652('0x1a')],'include':_0xb5d89b[_0xe652('0x1c')]?_[_0xe652('0x1e')](_0xb5d89b[_0xe652('0x1c')],function(_0x4ef434){return{'model':db[_0x4ef434[_0xe652('0x1d')]],'as':_0x4ef434['as'],'attributes':_0x4ef434[_0xe652('0x1a')],'include':_0x4ef434[_0xe652('0x1c')]?_[_0xe652('0x1e')](_0x4ef434[_0xe652('0x1c')],function(_0x2bb42c){return{'model':db[_0x2bb42c[_0xe652('0x1d')]],'as':_0x2bb42c['as'],'attributes':_0x2bb42c[_0xe652('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f9376){logger['info'](_0xe652('0x1f'),_0x3e7778);logger['debug'](_0xe652('0x1f'),_0x3e7778,JSON[_0xe652('0x11')](_0x5f9376));_0x4ea040(_0x5f9376);})[_0xe652('0x15')](function(_0x778c6d){logger[_0xe652('0x12')]('GetZohoAccount',_0x778c6d['message'],_0x3e7778);_0x1cecec(_0x1ada85[_0xe652('0x12')](0x1f4,_0x778c6d[_0xe652('0x13')]));});});};exports[_0xe652('0x20')]=function(_0x364bdb){var _0x267d87=this;return new Promise(function(_0x68e002,_0x1d536c){return db['ZohoAccount'][_0xe652('0x21')]({'raw':_0x364bdb[_0xe652('0x17')]?_0x364bdb[_0xe652('0x17')][_0xe652('0x18')]===undefined?!![]:![]:!![],'where':_0x364bdb[_0xe652('0x17')]?_0x364bdb[_0xe652('0x17')][_0xe652('0x19')]||null:null,'attributes':_0x364bdb['options']?_0x364bdb[_0xe652('0x17')][_0xe652('0x1a')]||null:null,'include':_0x364bdb[_0xe652('0x17')]?_0x364bdb[_0xe652('0x17')][_0xe652('0x1c')]?_['map'](_0x364bdb[_0xe652('0x17')][_0xe652('0x1c')],function(_0x210ffa){return{'model':db[_0x210ffa['model']],'as':_0x210ffa['as'],'attributes':_0x210ffa['attributes'],'include':_0x210ffa[_0xe652('0x1c')]?_[_0xe652('0x1e')](_0x210ffa['include'],function(_0x4c362b){return{'model':db[_0x4c362b[_0xe652('0x1d')]],'as':_0x4c362b['as'],'attributes':_0x4c362b[_0xe652('0x1a')],'include':_0x4c362b[_0xe652('0x1c')]?_[_0xe652('0x1e')](_0x4c362b[_0xe652('0x1c')],function(_0x5498aa){return{'model':db[_0x5498aa[_0xe652('0x1d')]],'as':_0x5498aa['as'],'attributes':_0x5498aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xe652('0xb')](function(_0x415c61){logger[_0xe652('0xc')](_0xe652('0x20'),_0x364bdb);logger[_0xe652('0xf')]('ShowZohoAccount',_0x364bdb,JSON[_0xe652('0x11')](_0x415c61));_0x68e002(_0x415c61);})['catch'](function(_0x31bb90){logger[_0xe652('0x12')]('ShowZohoAccount',_0x31bb90['message'],_0x364bdb);_0x1d536c(_0x267d87[_0xe652('0x12')](0x1f4,_0x31bb90[_0xe652('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7c3994f..cda6564 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 _0xc686=['post','put','update','destroy','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x4e937a,_0x10d5fd){var _0x454400=function(_0x559eaa){while(--_0x559eaa){_0x4e937a['push'](_0x4e937a['shift']());}};_0x454400(++_0x10d5fd);}(_0xc686,0x148));var _0x6c68=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc686[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c68('0x0'));var timeout=require('connect-timeout');var express=require(_0x6c68('0x1'));var router=express['Router']();var auth=require(_0x6c68('0x2'));var interaction=require(_0x6c68('0x3'));var config=require(_0x6c68('0x4'));var controller=require(_0x6c68('0x5'));router[_0x6c68('0x6')]('/',auth[_0x6c68('0x7')](),controller[_0x6c68('0x8')]);router[_0x6c68('0x6')](_0x6c68('0x9'),auth[_0x6c68('0x7')](),controller[_0x6c68('0xa')]);router[_0x6c68('0x6')]('/:id/fields',auth[_0x6c68('0x7')](),controller[_0x6c68('0xb')]);router['get'](_0x6c68('0xc'),auth['isAuthenticated'](),controller[_0x6c68('0xd')]);router[_0x6c68('0x6')]('/:id/descriptions',auth[_0x6c68('0x7')](),controller['getDescriptions']);router[_0x6c68('0xe')]('/',auth[_0x6c68('0x7')](),controller['create']);router[_0x6c68('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6c68('0x10')]);router['delete'](_0x6c68('0x9'),auth[_0x6c68('0x7')](),controller[_0x6c68('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3d15=['getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','show','getFields','/:id/descriptions'];(function(_0x7f33f9,_0x4fed83){var _0x308c7e=function(_0x418d9b){while(--_0x418d9b){_0x7f33f9['push'](_0x7f33f9['shift']());}};_0x308c7e(++_0x4fed83);}(_0x3d15,0x127));var _0x53d1=function(_0x52121e,_0x4e7ac8){_0x52121e=_0x52121e-0x0;var _0x2d7778=_0x3d15[_0x52121e];return _0x2d7778;};'use strict';var multer=require('multer');var util=require(_0x53d1('0x0'));var path=require(_0x53d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x53d1('0x2'));var router=express[_0x53d1('0x3')]();var auth=require(_0x53d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53d1('0x5'));var controller=require(_0x53d1('0x6'));router[_0x53d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x53d1('0x8')]);router[_0x53d1('0x7')]('/:id',auth[_0x53d1('0x9')](),controller[_0x53d1('0xa')]);router[_0x53d1('0x7')]('/:id/fields',auth[_0x53d1('0x9')](),controller[_0x53d1('0xb')]);router['get']('/:id/subjects',auth[_0x53d1('0x9')](),controller['getSubjects']);router[_0x53d1('0x7')](_0x53d1('0xc'),auth[_0x53d1('0x9')](),controller[_0x53d1('0xd')]);router[_0x53d1('0xe')]('/',auth[_0x53d1('0x9')](),controller[_0x53d1('0xf')]);router[_0x53d1('0x10')]('/:id',auth[_0x53d1('0x9')](),controller[_0x53d1('0x11')]);router[_0x53d1('0x12')](_0x53d1('0x13'),auth[_0x53d1('0x9')](),controller[_0x53d1('0x14')]);module[_0x53d1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a0812af..6c974bb 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 _0xb117=['exports','STRING','ENUM','contact','contact_lead','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb117,0x14f));var _0x7b11=function(_0x1e5691,_0x6058fe){_0x1e5691=_0x1e5691-0x0;var _0x7f5d42=_0xb117[_0x1e5691];return _0x7f5d42;};'use strict';var Sequelize=require(_0x7b11('0x0'));module[_0x7b11('0x1')]={'name':{'type':Sequelize[_0x7b11('0x2')]},'moduleCreate':{'type':Sequelize[_0x7b11('0x3')]('lead',_0x7b11('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x7b11('0x3')](_0x7b11('0x5'),_0x7b11('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x7b11('0x2')]}}; \ No newline at end of file +var _0x3428=['exports','ENUM','contact','lead','contact_lead'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3428,0xd7));var _0x8342=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3428[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0x8342('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x8342('0x1')]('lead',_0x8342('0x2'),'nothing'),'defaultValue':_0x8342('0x3')},'moduleSearch':{'type':Sequelize[_0x8342('0x1')](_0x8342('0x4'),'contact','lead'),'defaultValue':_0x8342('0x4')},'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 99daeb9..f665a48 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 _0xaabe=['bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','client','http','test','Sequelize','ValidationError','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','fields','create','body','find','getFields','findOne','ZohoField','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x372400,_0xdaeb10){var _0x4cd28c=function(_0x497d1f){while(--_0x497d1f){_0x372400['push'](_0x372400['shift']());}};_0x4cd28c(++_0xdaeb10);}(_0xaabe,0x118));var _0xeaab=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xaabe[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0xeaab('0x0'));var emlformat=require(_0xeaab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeaab('0x2'));var jsonpatch=require(_0xeaab('0x3'));var rp=require('request-promise');var moment=require(_0xeaab('0x4'));var BPromise=require(_0xeaab('0x5'));var Mustache=require(_0xeaab('0x6'));var util=require(_0xeaab('0x7'));var path=require(_0xeaab('0x8'));var sox=require(_0xeaab('0x9'));var csv=require(_0xeaab('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xeaab('0xb'));var crypto=require(_0xeaab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeaab('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeaab('0xe'));var Papa=require(_0xeaab('0xf'));var Redis=require(_0xeaab('0x10'));var authService=require(_0xeaab('0x11'));var qs=require(_0xeaab('0x12'));var as=require(_0xeaab('0x13'));var hardwareService=require(_0xeaab('0x14'));var logger=require('../../config/logger')(_0xeaab('0x15'));var utils=require(_0xeaab('0x16'));var config=require(_0xeaab('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xeaab('0x18')][_0xeaab('0x19')]({'port':0x232a});function checkPasswordPattern(_0xa45c97,_0x483dd1,_0x5d64ca){if(_0x5d64ca){var _0x2e79fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e79fd[_0xeaab('0x1a')](_0x483dd1)){return _0xa45c97;}else{throw new db[(_0xeaab('0x1b'))][(_0xeaab('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 _0xa45c97;}}function respondWithRpcPromise(_0x2767d6,_0x1efd51,_0xe1f7,_0x55da2e){return new BPromise(function(_0x5b600b,_0x24b6e3){var _0x12ce11=_0x55da2e||client;return _0x12ce11[_0xeaab('0x1d')](_0x2767d6,_0xe1f7)['then'](function(_0x33cdde){logger[_0xeaab('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x1efd51,_0xeaab('0x1f'));logger[_0xeaab('0x20')](_0xeaab('0x21'),_0x1efd51,_0xeaab('0x1f'),JSON[_0xeaab('0x22')](_0x33cdde));if(_0x33cdde[_0xeaab('0x23')]){if(_0x33cdde['error']['code']===0x1f4){logger[_0xeaab('0x23')](_0xeaab('0x24'),_0x1efd51,_0x33cdde[_0xeaab('0x23')][_0xeaab('0x25')]);return _0x24b6e3(_0x33cdde[_0xeaab('0x23')][_0xeaab('0x25')]);}logger['error'](_0xeaab('0x24'),_0x1efd51,_0x33cdde[_0xeaab('0x23')][_0xeaab('0x25')]);return _0x5b600b(_0x33cdde[_0xeaab('0x23')]['message']);}else{logger[_0xeaab('0x1e')](_0xeaab('0x24'),_0x1efd51,_0xeaab('0x1f'));_0x5b600b(_0x33cdde[_0xeaab('0x26')][_0xeaab('0x25')]);}})[_0xeaab('0x27')](function(_0x3d79b3){logger[_0xeaab('0x23')](_0xeaab('0x24'),_0x1efd51,_0x3d79b3);_0x24b6e3(_0x3d79b3);});});}function respondWithStatusCode(_0x8d5233,_0x167306){_0x167306=_0x167306||0xcc;return function(_0x3e4c59){if(_0x3e4c59){return _0x8d5233[_0xeaab('0x28')](_0x167306);}return _0x8d5233[_0xeaab('0x29')](_0x167306)[_0xeaab('0x2a')]();};}function respondWithResult(_0x2868fa,_0x285ce6){_0x285ce6=_0x285ce6||0xc8;return function(_0xff88b){if(_0xff88b){return _0x2868fa[_0xeaab('0x29')](_0x285ce6)[_0xeaab('0x2b')](_0xff88b);}};}function respondWithFilteredResult(_0x1d423d,_0x483574){return function(_0x3c544c){if(_0x3c544c){var _0x413423=_0x3c544c[_0xeaab('0x2c')],_0x303c9c=_0x483574[_0xeaab('0x2d')],_0x447382=_0x483574[_0xeaab('0x2d')]+_0x483574[_0xeaab('0x2e')],_0x3094cc;if(_0x447382>=_0x413423){_0x447382=_0x413423;_0x3094cc=0xc8;}else{_0x3094cc=0xce;}_0x1d423d[_0xeaab('0x29')](_0x3094cc);return _0x1d423d[_0xeaab('0x2f')](_0xeaab('0x30'),_0x303c9c+'-'+_0x447382+'/'+_0x413423)[_0xeaab('0x2b')](_0x3c544c);}return null;};}function patchUpdates(_0x28f8b0){return function(_0x1d9b80){try{jsonpatch[_0xeaab('0x31')](_0x1d9b80,_0x28f8b0,!![]);}catch(_0x3b3824){return BPromise[_0xeaab('0x32')](_0x3b3824);}return _0x1d9b80[_0xeaab('0x33')]();};}function saveUpdates(_0x1b9488,_0x3e38ba){return function(_0x488081){if(_0x488081){return _0x488081[_0xeaab('0x34')](_0x1b9488)[_0xeaab('0x35')](function(_0x27fa90){return _0x27fa90;});}return null;};}function removeEntity(_0x3c97f8,_0x41eaba){return function(_0xb33d60){if(_0xb33d60){return _0xb33d60[_0xeaab('0x36')]()[_0xeaab('0x35')](function(){_0x3c97f8[_0xeaab('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x322faa,_0x5334b0){return function(_0x2fbee0){if(!_0x2fbee0){_0x322faa[_0xeaab('0x28')](0x194);}return _0x2fbee0;};}function handleError(_0x5592b8,_0x5a64e3){_0x5a64e3=_0x5a64e3||0x1f4;return function(_0x2d193b){logger['error'](_0x2d193b[_0xeaab('0x37')]);if(_0x2d193b['name']){delete _0x2d193b[_0xeaab('0x38')];}_0x5592b8[_0xeaab('0x29')](_0x5a64e3)[_0xeaab('0x39')](_0x2d193b);};}exports[_0xeaab('0x3a')]=function(_0x306bb2,_0x5a9b6d){var _0x560fdc={},_0x34867={},_0x342d22={'count':0x0,'rows':[]};var _0x5703f4=_[_0xeaab('0x3b')](db[_0xeaab('0x3c')][_0xeaab('0x3d')],function(_0x86d2c){return{'name':_0x86d2c[_0xeaab('0x3e')],'type':_0x86d2c[_0xeaab('0x3f')]['key']};});_0x34867['model']=_[_0xeaab('0x3b')](_0x5703f4,_0xeaab('0x38'));_0x34867[_0xeaab('0x40')]=_[_0xeaab('0x41')](_0x306bb2['query']);_0x34867[_0xeaab('0x42')]=_[_0xeaab('0x43')](_0x34867[_0xeaab('0x44')],_0x34867[_0xeaab('0x40')]);_0x560fdc[_0xeaab('0x45')]=_[_0xeaab('0x43')](_0x34867[_0xeaab('0x44')],qs['fields'](_0x306bb2[_0xeaab('0x40')]['fields']));_0x560fdc[_0xeaab('0x45')]=_0x560fdc[_0xeaab('0x45')][_0xeaab('0x46')]?_0x560fdc[_0xeaab('0x45')]:_0x34867[_0xeaab('0x44')];if(!_0x306bb2[_0xeaab('0x40')]['hasOwnProperty']('nolimit')){_0x560fdc[_0xeaab('0x2e')]=qs['limit'](_0x306bb2['query'][_0xeaab('0x2e')]);_0x560fdc['offset']=qs[_0xeaab('0x2d')](_0x306bb2[_0xeaab('0x40')][_0xeaab('0x2d')]);}_0x560fdc[_0xeaab('0x47')]=qs[_0xeaab('0x48')](_0x306bb2[_0xeaab('0x40')]['sort']);_0x560fdc[_0xeaab('0x49')]=qs[_0xeaab('0x42')](_[_0xeaab('0x4a')](_0x306bb2[_0xeaab('0x40')],_0x34867[_0xeaab('0x42')]),_0x5703f4);if(_0x306bb2[_0xeaab('0x40')][_0xeaab('0x4b')]){_0x560fdc[_0xeaab('0x49')]=_[_0xeaab('0x4c')](_0x560fdc[_0xeaab('0x49')],{'$or':_[_0xeaab('0x3b')](_0x5703f4,function(_0x3290a5){if(_0x3290a5[_0xeaab('0x3f')]!==_0xeaab('0x4d')){var _0x4fc671={};_0x4fc671[_0x3290a5[_0xeaab('0x38')]]={'$like':'%'+_0x306bb2[_0xeaab('0x40')][_0xeaab('0x4b')]+'%'};return _0x4fc671;}})});}_0x560fdc=_['merge']({},_0x560fdc,_0x306bb2[_0xeaab('0x4e')]);var _0x3131bb={'where':_0x560fdc[_0xeaab('0x49')]};return db['ZohoConfiguration'][_0xeaab('0x2c')](_0x3131bb)['then'](function(_0x460c65){_0x342d22['count']=_0x460c65;if(_0x306bb2[_0xeaab('0x40')][_0xeaab('0x4f')]){_0x560fdc[_0xeaab('0x50')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xeaab('0x51')](_0x560fdc);})[_0xeaab('0x35')](function(_0x2c15e2){_0x342d22['rows']=_0x2c15e2;return _0x342d22;})[_0xeaab('0x35')](respondWithFilteredResult(_0x5a9b6d,_0x560fdc))[_0xeaab('0x27')](handleError(_0x5a9b6d,null));};exports[_0xeaab('0x52')]=function(_0x253356,_0xe24f98){var _0x5b1704={'raw':![],'where':{'id':_0x253356[_0xeaab('0x53')]['id']}},_0x287c59={};_0x287c59[_0xeaab('0x44')]=_[_0xeaab('0x41')](db[_0xeaab('0x3c')][_0xeaab('0x3d')]);_0x287c59[_0xeaab('0x40')]=_[_0xeaab('0x41')](_0x253356[_0xeaab('0x40')]);_0x287c59['filters']=_['intersection'](_0x287c59[_0xeaab('0x44')],_0x287c59[_0xeaab('0x40')]);_0x5b1704[_0xeaab('0x45')]=_[_0xeaab('0x43')](_0x287c59[_0xeaab('0x44')],qs[_0xeaab('0x54')](_0x253356[_0xeaab('0x40')][_0xeaab('0x54')]));_0x5b1704[_0xeaab('0x45')]=_0x5b1704['attributes'][_0xeaab('0x46')]?_0x5b1704[_0xeaab('0x45')]:_0x287c59[_0xeaab('0x44')];if(_0x253356[_0xeaab('0x40')][_0xeaab('0x4f')]){_0x5b1704[_0xeaab('0x50')]=[{'all':!![]}];}_0x5b1704=_['merge']({},_0x5b1704,_0x253356[_0xeaab('0x4e')]);return db['ZohoConfiguration']['find'](_0x5b1704)[_0xeaab('0x35')](handleEntityNotFound(_0xe24f98,null))['then'](respondWithResult(_0xe24f98,null))[_0xeaab('0x27')](handleError(_0xe24f98,null));};exports[_0xeaab('0x55')]=function(_0x1e85e1,_0x4b9f92){return db['ZohoConfiguration'][_0xeaab('0x55')](_0x1e85e1[_0xeaab('0x56')],{})[_0xeaab('0x35')](respondWithResult(_0x4b9f92,0xc9))[_0xeaab('0x27')](handleError(_0x4b9f92,null));};exports[_0xeaab('0x34')]=function(_0xc29a62,_0x3e603a){if(_0xc29a62[_0xeaab('0x56')]['id']){delete _0xc29a62[_0xeaab('0x56')]['id'];}return db[_0xeaab('0x3c')][_0xeaab('0x57')]({'where':{'id':_0xc29a62[_0xeaab('0x53')]['id']}})[_0xeaab('0x35')](handleEntityNotFound(_0x3e603a,null))['then'](saveUpdates(_0xc29a62[_0xeaab('0x56')],null))[_0xeaab('0x35')](respondWithResult(_0x3e603a,null))[_0xeaab('0x27')](handleError(_0x3e603a,null));};exports['destroy']=function(_0x25d544,_0xcbeefc){return db[_0xeaab('0x3c')]['find']({'where':{'id':_0x25d544[_0xeaab('0x53')]['id']}})[_0xeaab('0x35')](handleEntityNotFound(_0xcbeefc,null))[_0xeaab('0x35')](removeEntity(_0xcbeefc,null))[_0xeaab('0x27')](handleError(_0xcbeefc,null));};exports[_0xeaab('0x58')]=function(_0x1f841f,_0x493bea,_0x9c6a2b){var _0x3a4e20={};var _0x84ecee={};var _0x4a3106;var _0x120f97;return db[_0xeaab('0x3c')][_0xeaab('0x59')]({'where':{'id':_0x1f841f[_0xeaab('0x53')]['id']}})['then'](handleEntityNotFound(_0x493bea,null))[_0xeaab('0x35')](function(_0x148a4a){if(_0x148a4a){_0x4a3106=_0x148a4a;_0x84ecee[_0xeaab('0x44')]=_[_0xeaab('0x41')](db[_0xeaab('0x5a')][_0xeaab('0x3d')]);_0x84ecee[_0xeaab('0x40')]=_[_0xeaab('0x41')](_0x1f841f[_0xeaab('0x40')]);_0x84ecee[_0xeaab('0x42')]=_[_0xeaab('0x43')](_0x84ecee['model'],_0x84ecee[_0xeaab('0x40')]);_0x3a4e20[_0xeaab('0x45')]=_['intersection'](_0x84ecee[_0xeaab('0x44')],qs[_0xeaab('0x54')](_0x1f841f[_0xeaab('0x40')]['fields']));_0x3a4e20[_0xeaab('0x45')]=_0x3a4e20[_0xeaab('0x45')]['length']?_0x3a4e20[_0xeaab('0x45')]:_0x84ecee[_0xeaab('0x44')];_0x3a4e20[_0xeaab('0x47')]=qs[_0xeaab('0x48')](_0x1f841f[_0xeaab('0x40')][_0xeaab('0x48')]);_0x3a4e20[_0xeaab('0x49')]=qs[_0xeaab('0x42')](_[_0xeaab('0x4a')](_0x1f841f['query'],_0x84ecee[_0xeaab('0x42')]));if(_0x1f841f[_0xeaab('0x40')]['filter']){_0x3a4e20[_0xeaab('0x49')]=_[_0xeaab('0x4c')](_0x3a4e20[_0xeaab('0x49')],{'$or':_[_0xeaab('0x3b')](_0x3a4e20[_0xeaab('0x45')],function(_0x202ecb){var _0x2fdd2e={};_0x2fdd2e[_0x202ecb]={'$like':'%'+_0x1f841f['query'][_0xeaab('0x4b')]+'%'};return _0x2fdd2e;})});}_0x3a4e20=_[_0xeaab('0x4c')]({},_0x3a4e20,_0x1f841f['options']);return _0x4a3106[_0xeaab('0x58')](_0x3a4e20);}})['then'](function(_0x21c008){if(_0x21c008){_0x120f97=_0x21c008[_0xeaab('0x46')];if(!_0x1f841f[_0xeaab('0x40')][_0xeaab('0x5b')](_0xeaab('0x5c'))){_0x3a4e20[_0xeaab('0x2e')]=qs[_0xeaab('0x2e')](_0x1f841f[_0xeaab('0x40')]['limit']);_0x3a4e20['offset']=qs[_0xeaab('0x2d')](_0x1f841f[_0xeaab('0x40')]['offset']);}return _0x4a3106[_0xeaab('0x58')](_0x3a4e20);}})[_0xeaab('0x35')](function(_0x1d4a31){if(_0x1d4a31){return _0x1d4a31?{'count':_0x120f97,'rows':_0x1d4a31}:null;}})['then'](respondWithResult(_0x493bea,null))['catch'](handleError(_0x493bea,null));};exports[_0xeaab('0x5d')]=function(_0x5c2cba,_0x3cbbd8,_0x4a0965){var _0x30c400={};var _0x1f233b={};var _0x58b2d3;var _0xfbb8f9;return db[_0xeaab('0x3c')][_0xeaab('0x59')]({'where':{'id':_0x5c2cba['params']['id']}})[_0xeaab('0x35')](handleEntityNotFound(_0x3cbbd8,null))[_0xeaab('0x35')](function(_0xd32b8c){if(_0xd32b8c){_0x58b2d3=_0xd32b8c;_0x1f233b['model']=_[_0xeaab('0x41')](db['ZohoField'][_0xeaab('0x3d')]);_0x1f233b[_0xeaab('0x40')]=_[_0xeaab('0x41')](_0x5c2cba[_0xeaab('0x40')]);_0x1f233b['filters']=_[_0xeaab('0x43')](_0x1f233b[_0xeaab('0x44')],_0x1f233b[_0xeaab('0x40')]);_0x30c400['attributes']=_[_0xeaab('0x43')](_0x1f233b[_0xeaab('0x44')],qs[_0xeaab('0x54')](_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x54')]));_0x30c400[_0xeaab('0x45')]=_0x30c400[_0xeaab('0x45')]['length']?_0x30c400[_0xeaab('0x45')]:_0x1f233b[_0xeaab('0x44')];_0x30c400[_0xeaab('0x47')]=qs[_0xeaab('0x48')](_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x48')]);_0x30c400[_0xeaab('0x49')]=qs[_0xeaab('0x42')](_[_0xeaab('0x4a')](_0x5c2cba[_0xeaab('0x40')],_0x1f233b[_0xeaab('0x42')]));if(_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x4b')]){_0x30c400[_0xeaab('0x49')]=_[_0xeaab('0x4c')](_0x30c400[_0xeaab('0x49')],{'$or':_[_0xeaab('0x3b')](_0x30c400[_0xeaab('0x45')],function(_0x54c392){var _0x462f4e={};_0x462f4e[_0x54c392]={'$like':'%'+_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x4b')]+'%'};return _0x462f4e;})});}_0x30c400=_[_0xeaab('0x4c')]({},_0x30c400,_0x5c2cba[_0xeaab('0x4e')]);return _0x58b2d3[_0xeaab('0x5d')](_0x30c400);}})[_0xeaab('0x35')](function(_0x350e00){if(_0x350e00){_0xfbb8f9=_0x350e00[_0xeaab('0x46')];if(!_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x5b')](_0xeaab('0x5c'))){_0x30c400['limit']=qs[_0xeaab('0x2e')](_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x2e')]);_0x30c400[_0xeaab('0x2d')]=qs[_0xeaab('0x2d')](_0x5c2cba[_0xeaab('0x40')][_0xeaab('0x2d')]);}return _0x58b2d3[_0xeaab('0x5d')](_0x30c400);}})[_0xeaab('0x35')](function(_0x449f50){if(_0x449f50){return _0x449f50?{'count':_0xfbb8f9,'rows':_0x449f50}:null;}})[_0xeaab('0x35')](respondWithResult(_0x3cbbd8,null))['catch'](handleError(_0x3cbbd8,null));};exports[_0xeaab('0x5e')]=function(_0x57a355,_0x2ab897,_0x38c0aa){var _0x26643a={};var _0x2238ba={};var _0x46fbaa;var _0x4c2878;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x57a355[_0xeaab('0x53')]['id']}})[_0xeaab('0x35')](handleEntityNotFound(_0x2ab897,null))[_0xeaab('0x35')](function(_0x428111){if(_0x428111){_0x46fbaa=_0x428111;_0x2238ba[_0xeaab('0x44')]=_['keys'](db[_0xeaab('0x5a')][_0xeaab('0x3d')]);_0x2238ba[_0xeaab('0x40')]=_[_0xeaab('0x41')](_0x57a355[_0xeaab('0x40')]);_0x2238ba[_0xeaab('0x42')]=_[_0xeaab('0x43')](_0x2238ba[_0xeaab('0x44')],_0x2238ba['query']);_0x26643a[_0xeaab('0x45')]=_[_0xeaab('0x43')](_0x2238ba[_0xeaab('0x44')],qs[_0xeaab('0x54')](_0x57a355['query'][_0xeaab('0x54')]));_0x26643a['attributes']=_0x26643a['attributes'][_0xeaab('0x46')]?_0x26643a[_0xeaab('0x45')]:_0x2238ba[_0xeaab('0x44')];_0x26643a['order']=qs[_0xeaab('0x48')](_0x57a355[_0xeaab('0x40')][_0xeaab('0x48')]);_0x26643a[_0xeaab('0x49')]=qs['filters'](_[_0xeaab('0x4a')](_0x57a355[_0xeaab('0x40')],_0x2238ba['filters']));if(_0x57a355[_0xeaab('0x40')]['filter']){_0x26643a[_0xeaab('0x49')]=_[_0xeaab('0x4c')](_0x26643a[_0xeaab('0x49')],{'$or':_['map'](_0x26643a['attributes'],function(_0x128882){var _0x49c4f6={};_0x49c4f6[_0x128882]={'$like':'%'+_0x57a355['query'][_0xeaab('0x4b')]+'%'};return _0x49c4f6;})});}_0x26643a=_[_0xeaab('0x4c')]({},_0x26643a,_0x57a355[_0xeaab('0x4e')]);return _0x46fbaa[_0xeaab('0x5e')](_0x26643a);}})['then'](function(_0x5f4339){if(_0x5f4339){_0x4c2878=_0x5f4339[_0xeaab('0x46')];if(!_0x57a355[_0xeaab('0x40')][_0xeaab('0x5b')](_0xeaab('0x5c'))){_0x26643a['limit']=qs[_0xeaab('0x2e')](_0x57a355[_0xeaab('0x40')][_0xeaab('0x2e')]);_0x26643a['offset']=qs[_0xeaab('0x2d')](_0x57a355['query']['offset']);}return _0x46fbaa[_0xeaab('0x5e')](_0x26643a);}})[_0xeaab('0x35')](function(_0x1c027d){if(_0x1c027d){return _0x1c027d?{'count':_0x4c2878,'rows':_0x1c027d}:null;}})[_0xeaab('0x35')](respondWithResult(_0x2ab897,null))[_0xeaab('0x27')](handleError(_0x2ab897,null));}; \ No newline at end of file +var _0x0443=['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','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','create','body','getFields','ZohoField','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0443,0x1ab));var _0x3044=function(_0x3fec36,_0x3870d9){_0x3fec36=_0x3fec36-0x0;var _0xc9d244=_0x0443[_0x3fec36];return _0xc9d244;};'use strict';var pdf=require(_0x3044('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3044('0x1'));var zipdir=require(_0x3044('0x2'));var jsonpatch=require(_0x3044('0x3'));var rp=require(_0x3044('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3044('0x5'));var util=require('util');var path=require(_0x3044('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3044('0x7'));var fs=require('fs');var _=require(_0x3044('0x8'));var squel=require(_0x3044('0x9'));var crypto=require(_0x3044('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3044('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3044('0xc'));var Papa=require(_0x3044('0xd'));var Redis=require(_0x3044('0xe'));var authService=require(_0x3044('0xf'));var qs=require(_0x3044('0x10'));var as=require(_0x3044('0x11'));var hardwareService=require(_0x3044('0x12'));var logger=require('../../config/logger')(_0x3044('0x13'));var utils=require(_0x3044('0x14'));var config=require(_0x3044('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3044('0x16'));var client=jayson[_0x3044('0x17')][_0x3044('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3555bb,_0x54947d,_0x5d1314){if(_0x5d1314){var _0x214d42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x214d42[_0x3044('0x19')](_0x54947d)){return _0x3555bb;}else{throw new db['Sequelize'][(_0x3044('0x1a'))](_0x3044('0x1b'));}}else{return _0x3555bb;}}function respondWithRpcPromise(_0x3165e0,_0x4e6d9c,_0x241470,_0x1450a9){return new BPromise(function(_0xdcb041,_0x3c6c74){var _0x376b64=_0x1450a9||client;return _0x376b64[_0x3044('0x1c')](_0x3165e0,_0x241470)[_0x3044('0x1d')](function(_0x40ad3d){logger[_0x3044('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x4e6d9c,_0x3044('0x1f'));logger[_0x3044('0x20')](_0x3044('0x21'),_0x4e6d9c,_0x3044('0x1f'),JSON[_0x3044('0x22')](_0x40ad3d));if(_0x40ad3d['error']){if(_0x40ad3d[_0x3044('0x23')][_0x3044('0x24')]===0x1f4){logger[_0x3044('0x23')](_0x3044('0x25'),_0x4e6d9c,_0x40ad3d[_0x3044('0x23')][_0x3044('0x26')]);return _0x3c6c74(_0x40ad3d[_0x3044('0x23')][_0x3044('0x26')]);}logger['error'](_0x3044('0x25'),_0x4e6d9c,_0x40ad3d[_0x3044('0x23')][_0x3044('0x26')]);return _0xdcb041(_0x40ad3d[_0x3044('0x23')]['message']);}else{logger[_0x3044('0x1e')](_0x3044('0x25'),_0x4e6d9c,_0x3044('0x1f'));_0xdcb041(_0x40ad3d[_0x3044('0x27')][_0x3044('0x26')]);}})[_0x3044('0x28')](function(_0x38c2fb){logger[_0x3044('0x23')](_0x3044('0x25'),_0x4e6d9c,_0x38c2fb);_0x3c6c74(_0x38c2fb);});});}function respondWithStatusCode(_0x3548ad,_0x507f9a){_0x507f9a=_0x507f9a||0xcc;return function(_0x4874fa){if(_0x4874fa){return _0x3548ad[_0x3044('0x29')](_0x507f9a);}return _0x3548ad['status'](_0x507f9a)[_0x3044('0x2a')]();};}function respondWithResult(_0x59c4b9,_0x59282c){_0x59282c=_0x59282c||0xc8;return function(_0x579cba){if(_0x579cba){return _0x59c4b9[_0x3044('0x2b')](_0x59282c)[_0x3044('0x2c')](_0x579cba);}};}function respondWithFilteredResult(_0x554eb8,_0x2f2507){return function(_0x2cdeb0){if(_0x2cdeb0){var _0x55713c=_0x2cdeb0['count'],_0x57344d=_0x2f2507['offset'],_0x30b8ca=_0x2f2507[_0x3044('0x2d')]+_0x2f2507[_0x3044('0x2e')],_0x22cee8;if(_0x30b8ca>=_0x55713c){_0x30b8ca=_0x55713c;_0x22cee8=0xc8;}else{_0x22cee8=0xce;}_0x554eb8[_0x3044('0x2b')](_0x22cee8);return _0x554eb8[_0x3044('0x2f')](_0x3044('0x30'),_0x57344d+'-'+_0x30b8ca+'/'+_0x55713c)[_0x3044('0x2c')](_0x2cdeb0);}return null;};}function patchUpdates(_0x23b706){return function(_0x1dc136){try{jsonpatch[_0x3044('0x31')](_0x1dc136,_0x23b706,!![]);}catch(_0x3a4ee6){return BPromise[_0x3044('0x32')](_0x3a4ee6);}return _0x1dc136['save']();};}function saveUpdates(_0xbece79,_0x3736e2){return function(_0x411f76){if(_0x411f76){return _0x411f76[_0x3044('0x33')](_0xbece79)[_0x3044('0x1d')](function(_0x550470){return _0x550470;});}return null;};}function removeEntity(_0x40b97f,_0x4e21b1){return function(_0x58648e){if(_0x58648e){return _0x58648e[_0x3044('0x34')]()[_0x3044('0x1d')](function(){_0x40b97f[_0x3044('0x2b')](0xcc)[_0x3044('0x2a')]();});}};}function handleEntityNotFound(_0x33478d,_0x277795){return function(_0x5991fb){if(!_0x5991fb){_0x33478d[_0x3044('0x29')](0x194);}return _0x5991fb;};}function handleError(_0x24c095,_0xe069e2){_0xe069e2=_0xe069e2||0x1f4;return function(_0x251900){logger[_0x3044('0x23')](_0x251900[_0x3044('0x35')]);if(_0x251900['name']){delete _0x251900[_0x3044('0x36')];}_0x24c095[_0x3044('0x2b')](_0xe069e2)['send'](_0x251900);};}exports['index']=function(_0x33875e,_0x43e7ed){var _0x5764cd={},_0x556d13={},_0x219528={'count':0x0,'rows':[]};var _0x406f63=_[_0x3044('0x37')](db['ZohoConfiguration'][_0x3044('0x38')],function(_0x1f3ddc){return{'name':_0x1f3ddc[_0x3044('0x39')],'type':_0x1f3ddc['type'][_0x3044('0x3a')]};});_0x556d13[_0x3044('0x3b')]=_['map'](_0x406f63,'name');_0x556d13[_0x3044('0x3c')]=_[_0x3044('0x3d')](_0x33875e['query']);_0x556d13[_0x3044('0x3e')]=_['intersection'](_0x556d13['model'],_0x556d13['query']);_0x5764cd['attributes']=_['intersection'](_0x556d13['model'],qs[_0x3044('0x3f')](_0x33875e[_0x3044('0x3c')][_0x3044('0x3f')]));_0x5764cd['attributes']=_0x5764cd[_0x3044('0x40')][_0x3044('0x41')]?_0x5764cd[_0x3044('0x40')]:_0x556d13[_0x3044('0x3b')];if(!_0x33875e[_0x3044('0x3c')]['hasOwnProperty'](_0x3044('0x42'))){_0x5764cd[_0x3044('0x2e')]=qs[_0x3044('0x2e')](_0x33875e['query'][_0x3044('0x2e')]);_0x5764cd[_0x3044('0x2d')]=qs['offset'](_0x33875e[_0x3044('0x3c')][_0x3044('0x2d')]);}_0x5764cd[_0x3044('0x43')]=qs[_0x3044('0x44')](_0x33875e['query']['sort']);_0x5764cd[_0x3044('0x45')]=qs[_0x3044('0x3e')](_['pick'](_0x33875e[_0x3044('0x3c')],_0x556d13['filters']),_0x406f63);if(_0x33875e[_0x3044('0x3c')][_0x3044('0x46')]){_0x5764cd['where']=_[_0x3044('0x47')](_0x5764cd['where'],{'$or':_[_0x3044('0x37')](_0x406f63,function(_0x27439f){if(_0x27439f['type']!=='VIRTUAL'){var _0xe1da87={};_0xe1da87[_0x27439f['name']]={'$like':'%'+_0x33875e['query'][_0x3044('0x46')]+'%'};return _0xe1da87;}})});}_0x5764cd=_[_0x3044('0x47')]({},_0x5764cd,_0x33875e[_0x3044('0x48')]);var _0x376a24={'where':_0x5764cd['where']};return db[_0x3044('0x49')]['count'](_0x376a24)[_0x3044('0x1d')](function(_0x34a7d0){_0x219528[_0x3044('0x4a')]=_0x34a7d0;if(_0x33875e[_0x3044('0x3c')][_0x3044('0x4b')]){_0x5764cd[_0x3044('0x4c')]=[{'all':!![]}];}return db[_0x3044('0x49')][_0x3044('0x4d')](_0x5764cd);})[_0x3044('0x1d')](function(_0x1b55fa){_0x219528[_0x3044('0x4e')]=_0x1b55fa;return _0x219528;})[_0x3044('0x1d')](respondWithFilteredResult(_0x43e7ed,_0x5764cd))[_0x3044('0x28')](handleError(_0x43e7ed,null));};exports['show']=function(_0x5781df,_0x307849){var _0x2deaaf={'raw':![],'where':{'id':_0x5781df[_0x3044('0x4f')]['id']}},_0x12411d={};_0x12411d[_0x3044('0x3b')]=_[_0x3044('0x3d')](db[_0x3044('0x49')][_0x3044('0x38')]);_0x12411d[_0x3044('0x3c')]=_[_0x3044('0x3d')](_0x5781df[_0x3044('0x3c')]);_0x12411d[_0x3044('0x3e')]=_[_0x3044('0x50')](_0x12411d[_0x3044('0x3b')],_0x12411d[_0x3044('0x3c')]);_0x2deaaf[_0x3044('0x40')]=_[_0x3044('0x50')](_0x12411d['model'],qs['fields'](_0x5781df[_0x3044('0x3c')][_0x3044('0x3f')]));_0x2deaaf[_0x3044('0x40')]=_0x2deaaf[_0x3044('0x40')][_0x3044('0x41')]?_0x2deaaf['attributes']:_0x12411d[_0x3044('0x3b')];if(_0x5781df[_0x3044('0x3c')][_0x3044('0x4b')]){_0x2deaaf[_0x3044('0x4c')]=[{'all':!![]}];}_0x2deaaf=_[_0x3044('0x47')]({},_0x2deaaf,_0x5781df[_0x3044('0x48')]);return db[_0x3044('0x49')]['find'](_0x2deaaf)[_0x3044('0x1d')](handleEntityNotFound(_0x307849,null))['then'](respondWithResult(_0x307849,null))[_0x3044('0x28')](handleError(_0x307849,null));};exports[_0x3044('0x51')]=function(_0x3974c9,_0x6de1a4){return db['ZohoConfiguration']['create'](_0x3974c9[_0x3044('0x52')],{})[_0x3044('0x1d')](respondWithResult(_0x6de1a4,0xc9))[_0x3044('0x28')](handleError(_0x6de1a4,null));};exports[_0x3044('0x33')]=function(_0x4da215,_0x401d97){if(_0x4da215[_0x3044('0x52')]['id']){delete _0x4da215[_0x3044('0x52')]['id'];}return db[_0x3044('0x49')]['find']({'where':{'id':_0x4da215[_0x3044('0x4f')]['id']}})[_0x3044('0x1d')](handleEntityNotFound(_0x401d97,null))['then'](saveUpdates(_0x4da215[_0x3044('0x52')],null))[_0x3044('0x1d')](respondWithResult(_0x401d97,null))[_0x3044('0x28')](handleError(_0x401d97,null));};exports[_0x3044('0x34')]=function(_0x1746cc,_0xab1400){return db[_0x3044('0x49')]['find']({'where':{'id':_0x1746cc[_0x3044('0x4f')]['id']}})[_0x3044('0x1d')](handleEntityNotFound(_0xab1400,null))['then'](removeEntity(_0xab1400,null))[_0x3044('0x28')](handleError(_0xab1400,null));};exports[_0x3044('0x53')]=function(_0x657272,_0x1aa999,_0x434655){var _0x29c5ad={};var _0x20fff8={};var _0xf5d378;var _0x596ed8;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x657272[_0x3044('0x4f')]['id']}})[_0x3044('0x1d')](handleEntityNotFound(_0x1aa999,null))[_0x3044('0x1d')](function(_0x480006){if(_0x480006){_0xf5d378=_0x480006;_0x20fff8[_0x3044('0x3b')]=_[_0x3044('0x3d')](db[_0x3044('0x54')][_0x3044('0x38')]);_0x20fff8[_0x3044('0x3c')]=_[_0x3044('0x3d')](_0x657272[_0x3044('0x3c')]);_0x20fff8[_0x3044('0x3e')]=_[_0x3044('0x50')](_0x20fff8[_0x3044('0x3b')],_0x20fff8[_0x3044('0x3c')]);_0x29c5ad['attributes']=_[_0x3044('0x50')](_0x20fff8[_0x3044('0x3b')],qs[_0x3044('0x3f')](_0x657272[_0x3044('0x3c')][_0x3044('0x3f')]));_0x29c5ad[_0x3044('0x40')]=_0x29c5ad['attributes'][_0x3044('0x41')]?_0x29c5ad[_0x3044('0x40')]:_0x20fff8['model'];_0x29c5ad[_0x3044('0x43')]=qs['sort'](_0x657272[_0x3044('0x3c')][_0x3044('0x44')]);_0x29c5ad[_0x3044('0x45')]=qs['filters'](_[_0x3044('0x55')](_0x657272[_0x3044('0x3c')],_0x20fff8[_0x3044('0x3e')]));if(_0x657272['query']['filter']){_0x29c5ad[_0x3044('0x45')]=_[_0x3044('0x47')](_0x29c5ad[_0x3044('0x45')],{'$or':_[_0x3044('0x37')](_0x29c5ad['attributes'],function(_0x13ceb8){var _0x1a3486={};_0x1a3486[_0x13ceb8]={'$like':'%'+_0x657272[_0x3044('0x3c')][_0x3044('0x46')]+'%'};return _0x1a3486;})});}_0x29c5ad=_[_0x3044('0x47')]({},_0x29c5ad,_0x657272[_0x3044('0x48')]);return _0xf5d378['getFields'](_0x29c5ad);}})[_0x3044('0x1d')](function(_0x595935){if(_0x595935){_0x596ed8=_0x595935['length'];if(!_0x657272['query'][_0x3044('0x56')](_0x3044('0x42'))){_0x29c5ad[_0x3044('0x2e')]=qs[_0x3044('0x2e')](_0x657272['query'][_0x3044('0x2e')]);_0x29c5ad[_0x3044('0x2d')]=qs[_0x3044('0x2d')](_0x657272[_0x3044('0x3c')][_0x3044('0x2d')]);}return _0xf5d378[_0x3044('0x53')](_0x29c5ad);}})[_0x3044('0x1d')](function(_0x37ba0b){if(_0x37ba0b){return _0x37ba0b?{'count':_0x596ed8,'rows':_0x37ba0b}:null;}})[_0x3044('0x1d')](respondWithResult(_0x1aa999,null))[_0x3044('0x28')](handleError(_0x1aa999,null));};exports[_0x3044('0x57')]=function(_0x2df44e,_0x410968,_0x3437e0){var _0x2760b5={};var _0x28f239={};var _0x1f67c9;var _0x106fbf;return db['ZohoConfiguration'][_0x3044('0x58')]({'where':{'id':_0x2df44e[_0x3044('0x4f')]['id']}})[_0x3044('0x1d')](handleEntityNotFound(_0x410968,null))[_0x3044('0x1d')](function(_0x2d9cbb){if(_0x2d9cbb){_0x1f67c9=_0x2d9cbb;_0x28f239[_0x3044('0x3b')]=_['keys'](db[_0x3044('0x54')]['rawAttributes']);_0x28f239['query']=_[_0x3044('0x3d')](_0x2df44e['query']);_0x28f239[_0x3044('0x3e')]=_[_0x3044('0x50')](_0x28f239[_0x3044('0x3b')],_0x28f239[_0x3044('0x3c')]);_0x2760b5[_0x3044('0x40')]=_[_0x3044('0x50')](_0x28f239[_0x3044('0x3b')],qs[_0x3044('0x3f')](_0x2df44e[_0x3044('0x3c')][_0x3044('0x3f')]));_0x2760b5[_0x3044('0x40')]=_0x2760b5[_0x3044('0x40')]['length']?_0x2760b5[_0x3044('0x40')]:_0x28f239[_0x3044('0x3b')];_0x2760b5['order']=qs['sort'](_0x2df44e[_0x3044('0x3c')]['sort']);_0x2760b5['where']=qs[_0x3044('0x3e')](_[_0x3044('0x55')](_0x2df44e['query'],_0x28f239[_0x3044('0x3e')]));if(_0x2df44e[_0x3044('0x3c')][_0x3044('0x46')]){_0x2760b5['where']=_['merge'](_0x2760b5[_0x3044('0x45')],{'$or':_['map'](_0x2760b5[_0x3044('0x40')],function(_0x2c4071){var _0x2748cf={};_0x2748cf[_0x2c4071]={'$like':'%'+_0x2df44e['query'][_0x3044('0x46')]+'%'};return _0x2748cf;})});}_0x2760b5=_['merge']({},_0x2760b5,_0x2df44e[_0x3044('0x48')]);return _0x1f67c9[_0x3044('0x57')](_0x2760b5);}})[_0x3044('0x1d')](function(_0x3ca57a){if(_0x3ca57a){_0x106fbf=_0x3ca57a[_0x3044('0x41')];if(!_0x2df44e['query'][_0x3044('0x56')](_0x3044('0x42'))){_0x2760b5[_0x3044('0x2e')]=qs['limit'](_0x2df44e[_0x3044('0x3c')]['limit']);_0x2760b5['offset']=qs['offset'](_0x2df44e[_0x3044('0x3c')][_0x3044('0x2d')]);}return _0x1f67c9['getSubjects'](_0x2760b5);}})[_0x3044('0x1d')](function(_0x43e20f){if(_0x43e20f){return _0x43e20f?{'count':_0x106fbf,'rows':_0x43e20f}:null;}})[_0x3044('0x1d')](respondWithResult(_0x410968,null))[_0x3044('0x28')](handleError(_0x410968,null));};exports[_0x3044('0x59')]=function(_0x5f27b7,_0x5857dc,_0x33788a){var _0x4a5fb4={};var _0x7260e1={};var _0x3d993c;var _0x2c0255;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5f27b7[_0x3044('0x4f')]['id']}})[_0x3044('0x1d')](handleEntityNotFound(_0x5857dc,null))[_0x3044('0x1d')](function(_0x574be6){if(_0x574be6){_0x3d993c=_0x574be6;_0x7260e1['model']=_[_0x3044('0x3d')](db[_0x3044('0x54')][_0x3044('0x38')]);_0x7260e1[_0x3044('0x3c')]=_[_0x3044('0x3d')](_0x5f27b7[_0x3044('0x3c')]);_0x7260e1[_0x3044('0x3e')]=_[_0x3044('0x50')](_0x7260e1[_0x3044('0x3b')],_0x7260e1['query']);_0x4a5fb4[_0x3044('0x40')]=_['intersection'](_0x7260e1[_0x3044('0x3b')],qs[_0x3044('0x3f')](_0x5f27b7['query'][_0x3044('0x3f')]));_0x4a5fb4[_0x3044('0x40')]=_0x4a5fb4['attributes'][_0x3044('0x41')]?_0x4a5fb4[_0x3044('0x40')]:_0x7260e1[_0x3044('0x3b')];_0x4a5fb4[_0x3044('0x43')]=qs[_0x3044('0x44')](_0x5f27b7['query']['sort']);_0x4a5fb4[_0x3044('0x45')]=qs['filters'](_[_0x3044('0x55')](_0x5f27b7[_0x3044('0x3c')],_0x7260e1[_0x3044('0x3e')]));if(_0x5f27b7['query'][_0x3044('0x46')]){_0x4a5fb4[_0x3044('0x45')]=_[_0x3044('0x47')](_0x4a5fb4[_0x3044('0x45')],{'$or':_[_0x3044('0x37')](_0x4a5fb4[_0x3044('0x40')],function(_0x4c0ee4){var _0x25d348={};_0x25d348[_0x4c0ee4]={'$like':'%'+_0x5f27b7[_0x3044('0x3c')][_0x3044('0x46')]+'%'};return _0x25d348;})});}_0x4a5fb4=_[_0x3044('0x47')]({},_0x4a5fb4,_0x5f27b7[_0x3044('0x48')]);return _0x3d993c[_0x3044('0x59')](_0x4a5fb4);}})[_0x3044('0x1d')](function(_0x21106c){if(_0x21106c){_0x2c0255=_0x21106c[_0x3044('0x41')];if(!_0x5f27b7[_0x3044('0x3c')][_0x3044('0x56')]('nolimit')){_0x4a5fb4[_0x3044('0x2e')]=qs[_0x3044('0x2e')](_0x5f27b7[_0x3044('0x3c')][_0x3044('0x2e')]);_0x4a5fb4[_0x3044('0x2d')]=qs[_0x3044('0x2d')](_0x5f27b7[_0x3044('0x3c')][_0x3044('0x2d')]);}return _0x3d993c['getDescriptions'](_0x4a5fb4);}})[_0x3044('0x1d')](function(_0x40c2ff){if(_0x40c2ff){return _0x40c2ff?{'count':_0x2c0255,'rows':_0x40c2ff}:null;}})[_0x3044('0x1d')](respondWithResult(_0x5857dc,null))[_0x3044('0x28')](handleError(_0x5857dc,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c1ea392..566a483 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 _0x29d2=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x4b1f58,_0x256140){var _0x578479=function(_0x84405){while(--_0x84405){_0x4b1f58['push'](_0x4b1f58['shift']());}};_0x578479(++_0x256140);}(_0x29d2,0x88));var _0x229d=function(_0x1e5708,_0xe301d6){_0x1e5708=_0x1e5708-0x0;var _0x2d0bed=_0x29d2[_0x1e5708];return _0x2d0bed;};'use strict';var _=require(_0x229d('0x0'));var util=require(_0x229d('0x1'));var logger=require(_0x229d('0x2'))(_0x229d('0x3'));var moment=require('moment');var BPromise=require(_0x229d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x229d('0x5'));var rimraf=require('rimraf');var config=require(_0x229d('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x229d('0x7')]=function(_0x46869b,_0x213930){return _0x46869b[_0x229d('0x8')](_0x229d('0x9'),attributes,{'tableName':_0x229d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf674=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43da17,_0xc03c2a){var _0x1e8d97=function(_0x27755b){while(--_0x27755b){_0x43da17['push'](_0x43da17['shift']());}};_0x1e8d97(++_0xc03c2a);}(_0xf674,0x190));var _0x4f67=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xf674[_0x5235dd];return _0x13059d;};'use strict';var _=require('lodash');var util=require(_0x4f67('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4f67('0x1'));var BPromise=require(_0x4f67('0x2'));var rp=require(_0x4f67('0x3'));var fs=require('fs');var path=require(_0x4f67('0x4'));var rimraf=require(_0x4f67('0x5'));var config=require(_0x4f67('0x6'));var attributes=require(_0x4f67('0x7'));module[_0x4f67('0x8')]=function(_0x28c706,_0x4c2a8d){return _0x28c706[_0x4f67('0x9')](_0x4f67('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e09b0d3..e350dd4 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 _0xaae6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','moment','bluebird'];(function(_0x518352,_0x43bb0e){var _0x17d5e5=function(_0x2ac672){while(--_0x2ac672){_0x518352['push'](_0x518352['shift']());}};_0x17d5e5(++_0x43bb0e);}(_0xaae6,0x17a));var _0x6aae=function(_0x366f83,_0x291008){_0x366f83=_0x366f83-0x0;var _0x588082=_0xaae6[_0x366f83];return _0x588082;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6aae('0x0'));var BPromise=require(_0x6aae('0x1'));var rs=require(_0x6aae('0x2'));var fs=require('fs');var Redis=require(_0x6aae('0x3'));var db=require(_0x6aae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6aae('0x5'))(_0x6aae('0x6'));var config=require(_0x6aae('0x7'));var jayson=require(_0x6aae('0x8'));var client=jayson[_0x6aae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x488a07,_0x506f0a,_0x170b57){return new BPromise(function(_0x264ebf,_0x39a773){return client[_0x6aae('0xa')](_0x488a07,_0x170b57)[_0x6aae('0xb')](function(_0x1dd5cf){logger['info'](_0x6aae('0xc'),_0x506f0a,_0x6aae('0xd'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x506f0a,_0x6aae('0xd'),JSON[_0x6aae('0xe')](_0x1dd5cf));if(_0x1dd5cf['error']){if(_0x1dd5cf[_0x6aae('0xf')]['code']===0x1f4){logger[_0x6aae('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x506f0a,_0x1dd5cf[_0x6aae('0xf')]['message']);return _0x39a773(_0x1dd5cf[_0x6aae('0xf')]['message']);}logger[_0x6aae('0xf')](_0x6aae('0xc'),_0x506f0a,_0x1dd5cf['error'][_0x6aae('0x10')]);return _0x264ebf(_0x1dd5cf[_0x6aae('0xf')][_0x6aae('0x10')]);}else{logger[_0x6aae('0x11')](_0x6aae('0xc'),_0x506f0a,_0x6aae('0xd'));_0x264ebf(_0x1dd5cf['result']['message']);}})[_0x6aae('0x12')](function(_0x458cb9){logger[_0x6aae('0xf')](_0x6aae('0xc'),_0x506f0a,_0x458cb9);_0x39a773(_0x458cb9);});});} \ No newline at end of file +var _0x8a16=['info','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5d6b41,_0x3d1c8f){var _0x1c2dd6=function(_0x48d601){while(--_0x48d601){_0x5d6b41['push'](_0x5d6b41['shift']());}};_0x1c2dd6(++_0x3d1c8f);}(_0x8a16,0x1d6));var _0x68a1=function(_0x1a45e1,_0x24c984){_0x1a45e1=_0x1a45e1-0x0;var _0x4d82d3=_0x8a16[_0x1a45e1];return _0x4d82d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x68a1('0x0'));var BPromise=require('bluebird');var rs=require(_0x68a1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68a1('0x2'))['db'];var utils=require(_0x68a1('0x3'));var logger=require(_0x68a1('0x4'))(_0x68a1('0x5'));var config=require(_0x68a1('0x6'));var jayson=require(_0x68a1('0x7'));var client=jayson[_0x68a1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59fc56,_0x137601,_0x1f690c){return new BPromise(function(_0x1dbe62,_0x2c94a5){return client[_0x68a1('0x9')](_0x59fc56,_0x1f690c)['then'](function(_0x14ec6f){logger[_0x68a1('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x137601,_0x68a1('0xb'));logger[_0x68a1('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x137601,'request\x20sent',JSON[_0x68a1('0xd')](_0x14ec6f));if(_0x14ec6f['error']){if(_0x14ec6f[_0x68a1('0xe')][_0x68a1('0xf')]===0x1f4){logger['error'](_0x68a1('0x10'),_0x137601,_0x14ec6f['error'][_0x68a1('0x11')]);return _0x2c94a5(_0x14ec6f['error'][_0x68a1('0x11')]);}logger[_0x68a1('0xe')](_0x68a1('0x10'),_0x137601,_0x14ec6f['error'][_0x68a1('0x11')]);return _0x1dbe62(_0x14ec6f[_0x68a1('0xe')][_0x68a1('0x11')]);}else{logger[_0x68a1('0xa')](_0x68a1('0x10'),_0x137601,_0x68a1('0xb'));_0x1dbe62(_0x14ec6f[_0x68a1('0x12')][_0x68a1('0x11')]);}})[_0x68a1('0x13')](function(_0x2a54ae){logger[_0x68a1('0xe')](_0x68a1('0x10'),_0x137601,_0x2a54ae);_0x2c94a5(_0x2a54ae);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5f8b6fa..1cc071d 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 _0x4888=['../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5eae08,_0x32f45d){var _0xed5ff9=function(_0x41b7a8){while(--_0x41b7a8){_0x5eae08['push'](_0x5eae08['shift']());}};_0xed5ff9(++_0x32f45d);}(_0x4888,0x198));var _0x8488=function(_0x2b6124,_0x4d25f2){_0x2b6124=_0x2b6124-0x0;var _0x44c3f4=_0x4888[_0x2b6124];return _0x44c3f4;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var auth=require(_0x8488('0x5'));var interaction=require(_0x8488('0x6'));var config=require('../../config/environment');var controller=require(_0x8488('0x7'));router[_0x8488('0x8')]('/',auth[_0x8488('0x9')](),controller[_0x8488('0xa')]);router[_0x8488('0x8')](_0x8488('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8488('0xc')]);router[_0x8488('0xd')]('/:id',auth[_0x8488('0x9')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')](_0x8488('0xb'),auth['isAuthenticated'](),controller[_0x8488('0x10')]);module[_0x8488('0x11')]=router; \ No newline at end of file +var _0xfef3=['/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xfef3,0x118));var _0x3fef=function(_0x4fe0e5,_0x4ace15){_0x4fe0e5=_0x4fe0e5-0x0;var _0x1490e9=_0xfef3[_0x4fe0e5];return _0x1490e9;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fef('0x4'));var config=require(_0x3fef('0x5'));var controller=require('./intZohoField.controller');router[_0x3fef('0x6')]('/',auth[_0x3fef('0x7')](),controller['index']);router[_0x3fef('0x6')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0x9')]);router[_0x3fef('0xa')]('/',auth[_0x3fef('0x7')](),controller[_0x3fef('0xb')]);router[_0x3fef('0xc')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller['destroy']);module[_0x3fef('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1c8094f..7144ae3 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 _0x7bbd=['exports','ENUM','string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x3fddaf,_0x3c4813){var _0xce8c0e=function(_0x410a91){while(--_0x410a91){_0x3fddaf['push'](_0x3fddaf['shift']());}};_0xce8c0e(++_0x3c4813);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x1ee107,_0x47e157){_0x1ee107=_0x1ee107-0x0;var _0x4e3e0c=_0x7bbd[_0x1ee107];return _0x4e3e0c;};'use strict';var Sequelize=require(_0xd7bb('0x0'));module[_0xd7bb('0x1')]={'type':{'type':Sequelize[_0xd7bb('0x2')](_0xd7bb('0x3'),'variable','customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd7bb('0x4')]},'key':{'type':Sequelize[_0xd7bb('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xd7bb('0x3'),_0xd7bb('0x5'),_0xd7bb('0x6'))},'keyContent':{'type':Sequelize[_0xd7bb('0x4')]},'idField':{'type':Sequelize[_0xd7bb('0x4')]},'nameField':{'type':Sequelize[_0xd7bb('0x4')]},'customField':{'type':Sequelize[_0xd7bb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7bb('0x4')]}}; \ No newline at end of file +var _0xae53=['STRING','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0x106f71,_0x1d281a){var _0x551e8f=function(_0x58a1e7){while(--_0x58a1e7){_0x106f71['push'](_0x106f71['shift']());}};_0x551e8f(++_0x1d281a);}(_0xae53,0x16e));var _0x3ae5=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xae53[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x3ae5('0x0'));module['exports']={'type':{'type':Sequelize[_0x3ae5('0x1')](_0x3ae5('0x2'),_0x3ae5('0x3'),'customVariable',_0x3ae5('0x4')),'defaultValue':_0x3ae5('0x2')},'content':{'type':Sequelize[_0x3ae5('0x5')]},'key':{'type':Sequelize[_0x3ae5('0x5')]},'keyType':{'type':Sequelize[_0x3ae5('0x1')]('string',_0x3ae5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3ae5('0x5')]},'idField':{'type':Sequelize[_0x3ae5('0x5')]},'nameField':{'type':Sequelize[_0x3ae5('0x5')]},'customField':{'type':Sequelize[_0x3ae5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ae5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ea8abcd..b05e67c 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(_0x154009,_0x54f6b0){var _0x599565=function(_0x586782){while(--_0x586782){_0x154009['push'](_0x154009['shift']());}};_0x599565(++_0x54f6b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x7fa526,_0x576af5){var _0x2233d2=function(_0x28f03a){while(--_0x28f03a){_0x7fa526['push'](_0x7fa526['shift']());}};_0x2233d2(++_0x576af5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 738a04c..20be1a8 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 _0x2730=['ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x217776,_0x412235){var _0x57992d=function(_0x2ec09a){while(--_0x2ec09a){_0x217776['push'](_0x217776['shift']());}};_0x57992d(++_0x412235);}(_0x2730,0x130));var _0x0273=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2730[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0273('0x0'));var util=require(_0x0273('0x1'));var logger=require(_0x0273('0x2'))(_0x0273('0x3'));var moment=require(_0x0273('0x4'));var BPromise=require('bluebird');var rp=require(_0x0273('0x5'));var fs=require('fs');var path=require(_0x0273('0x6'));var rimraf=require(_0x0273('0x7'));var config=require(_0x0273('0x8'));var attributes=require(_0x0273('0x9'));module[_0x0273('0xa')]=function(_0x1d4906,_0xc80c5){return _0x1d4906['define'](_0x0273('0xb'),attributes,{'tableName':_0x0273('0xc'),'paranoid':![],'indexes':[{'name':_0x0273('0xd'),'fields':['idField',_0x0273('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd320=['path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x11dbaa,_0x276b31){var _0x3a409a=function(_0x1bb836){while(--_0x1bb836){_0x11dbaa['push'](_0x11dbaa['shift']());}};_0x3a409a(++_0x276b31);}(_0xd320,0xbf));var _0x0d32=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0xd320[_0x3818c0];return _0x55ec33;};'use strict';var _=require(_0x0d32('0x0'));var util=require(_0x0d32('0x1'));var logger=require(_0x0d32('0x2'))(_0x0d32('0x3'));var moment=require(_0x0d32('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d32('0x5'));var rimraf=require(_0x0d32('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d32('0x7'));module[_0x0d32('0x8')]=function(_0x552dd0,_0x1263ba){return _0x552dd0['define'](_0x0d32('0x9'),attributes,{'tableName':_0x0d32('0xa'),'paranoid':![],'indexes':[{'name':_0x0d32('0xb'),'fields':[_0x0d32('0xc'),_0x0d32('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 3e14fc4..97fed4c 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5bdb17,_0x51d0f7){var _0x2b8eae=function(_0x498bf6){while(--_0x498bf6){_0x5bdb17['push'](_0x5bdb17['shift']());}};_0x2b8eae(++_0x51d0f7);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xc62d1a,_0x1d7947){var _0x4bf0b1=function(_0x34a79d){while(--_0x34a79d){_0xc62d1a['push'](_0xc62d1a['shift']());}};_0x4bf0b1(++_0x1d7947);}(_0x17ba,0xab));var _0xa17b=function(_0x4316d3,_0x1f4495){_0x4316d3=_0x4316d3-0x0;var _0x8ec97b=_0x17ba[_0x4316d3];return _0x8ec97b;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('ZohoField,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('ZohoField,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 59d5fd7..1f6fa2e 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 _0xb20c=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x19f8f9,_0x6caa7a){var _0x2f917b=function(_0x366a04){while(--_0x366a04){_0x19f8f9['push'](_0x19f8f9['shift']());}};_0x2f917b(++_0x6caa7a);}(_0xb20c,0x199));var _0xcb20=function(_0x299db1,_0x47e28b){_0x299db1=_0x299db1-0x0;var _0x2bfdaa=_0xb20c[_0x299db1];return _0x2bfdaa;};'use strict';var multer=require(_0xcb20('0x0'));var util=require(_0xcb20('0x1'));var path=require('path');var timeout=require(_0xcb20('0x2'));var express=require(_0xcb20('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcb20('0x4'));var config=require(_0xcb20('0x5'));module[_0xcb20('0x6')]=router; \ No newline at end of file +var _0xed6c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0x82d9d,_0x29cddb){var _0x185dfc=function(_0x12a2dc){while(--_0x12a2dc){_0x82d9d['push'](_0x82d9d['shift']());}};_0x185dfc(++_0x29cddb);}(_0xed6c,0xd4));var _0xced6=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xed6c[_0x31991b];return _0x307304;};'use strict';var multer=require(_0xced6('0x0'));var util=require(_0xced6('0x1'));var path=require(_0xced6('0x2'));var timeout=require('connect-timeout');var express=require(_0xced6('0x3'));var router=express[_0xced6('0x4')]();var auth=require(_0xced6('0x5'));var interaction=require(_0xced6('0x6'));var config=require(_0xced6('0x7'));module[_0xced6('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c83660f..53bbfd2 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 _0x23eb=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x1c7a5a,_0x321891){var _0x44d857=function(_0x424279){while(--_0x424279){_0x1c7a5a['push'](_0x1c7a5a['shift']());}};_0x44d857(++_0x321891);}(_0x23eb,0x104));var _0xb23e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x23eb[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xb23e('0x0'));module[_0xb23e('0x1')]={'name':{'type':Sequelize[_0xb23e('0x2')],'allowNull':![],'unique':_0xb23e('0x3')},'version':{'type':Sequelize[_0xb23e('0x2')],'allowNull':![],'unique':_0xb23e('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb23e('0x4')},'filename':{'type':Sequelize[_0xb23e('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb23e('0x2')]},'size':{'type':Sequelize[_0xb23e('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb23e('0x2')]},'logo':{'type':Sequelize[_0xb23e('0x2')]},'state':{'type':Sequelize[_0xb23e('0x2')],'unique':_0xb23e('0x6')},'description':{'type':Sequelize[_0xb23e('0x2')]},'title':{'type':Sequelize[_0xb23e('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xb23e('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8f8c=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f8c,0x10c));var _0xc8f8=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8f8c[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0xc8f8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xc8f8('0x1')],'allowNull':![],'unique':_0xc8f8('0x2')},'main':{'type':Sequelize[_0xc8f8('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xc8f8('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc8f8('0x1')]},'size':{'type':Sequelize[_0xc8f8('0x3')]},'active':{'type':Sequelize[_0xc8f8('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xc8f8('0x1')]},'logo':{'type':Sequelize[_0xc8f8('0x1')]},'state':{'type':Sequelize[_0xc8f8('0x1')],'unique':_0xc8f8('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f8('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 40f7105..b5adfdd 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 _0x97a5=['index','Integration','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','update','then','destroy','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97a5,0x179));var _0x597a=function(_0x4a5356,_0x20f134){_0x4a5356=_0x4a5356-0x0;var _0x4beb93=_0x97a5[_0x4a5356];return _0x4beb93;};'use strict';var pdf=require(_0x597a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x597a('0x1'));var jsonpatch=require(_0x597a('0x2'));var rp=require(_0x597a('0x3'));var moment=require(_0x597a('0x4'));var BPromise=require(_0x597a('0x5'));var Mustache=require(_0x597a('0x6'));var util=require(_0x597a('0x7'));var path=require(_0x597a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x597a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x597a('0xa'));var crypto=require('crypto');var jsforce=require(_0x597a('0xb'));var deskjs=require(_0x597a('0xc'));var toCsv=require(_0x597a('0xd'));var querystring=require('querystring');var Papa=require(_0x597a('0xe'));var Redis=require(_0x597a('0xf'));var authService=require(_0x597a('0x10'));var qs=require(_0x597a('0x11'));var as=require(_0x597a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x597a('0x13'))(_0x597a('0x14'));var utils=require(_0x597a('0x15'));var config=require('../../config/environment');var db=require(_0x597a('0x16'))['db'];function respondWithStatusCode(_0x8efe7b,_0x3c1106){_0x3c1106=_0x3c1106||0xcc;return function(_0x4cc8d9){if(_0x4cc8d9){return _0x8efe7b[_0x597a('0x17')](_0x3c1106);}return _0x8efe7b[_0x597a('0x18')](_0x3c1106)[_0x597a('0x19')]();};}function respondWithResult(_0x1ceb94,_0x54d8f7){_0x54d8f7=_0x54d8f7||0xc8;return function(_0x5f3128){if(_0x5f3128){return _0x1ceb94[_0x597a('0x18')](_0x54d8f7)[_0x597a('0x1a')](_0x5f3128);}};}function respondWithFilteredResult(_0x3dbeeb,_0x1d0f33){return function(_0x596814){if(_0x596814){var _0x37fcdc=_0x596814['count'],_0x4791ca=_0x1d0f33['offset'],_0x165fcf=_0x1d0f33[_0x597a('0x1b')]+_0x1d0f33[_0x597a('0x1c')],_0x3f3df6;if(_0x165fcf>=_0x37fcdc){_0x165fcf=_0x37fcdc;_0x3f3df6=0xc8;}else{_0x3f3df6=0xce;}_0x3dbeeb[_0x597a('0x18')](_0x3f3df6);return _0x3dbeeb['set']('Content-Range',_0x4791ca+'-'+_0x165fcf+'/'+_0x37fcdc)['json'](_0x596814);}return null;};}function patchUpdates(_0x4263c6){return function(_0x289d9e){try{jsonpatch[_0x597a('0x1d')](_0x289d9e,_0x4263c6,!![]);}catch(_0x41b730){return BPromise['reject'](_0x41b730);}return _0x289d9e['save']();};}function saveUpdates(_0x47bad4,_0x15a7bf){return function(_0x280d89){if(_0x280d89){return _0x280d89[_0x597a('0x1e')](_0x47bad4)[_0x597a('0x1f')](function(_0x470ecd){return _0x470ecd;});}return null;};}function removeEntity(_0x32efbf,_0x4fe18c){return function(_0x3513f4){if(_0x3513f4){return _0x3513f4[_0x597a('0x20')]()[_0x597a('0x1f')](function(){_0x32efbf[_0x597a('0x18')](0xcc)[_0x597a('0x19')]();});}};}function handleEntityNotFound(_0x415a56,_0x592dbf){return function(_0x9e6547){if(!_0x9e6547){_0x415a56[_0x597a('0x17')](0x194);}return _0x9e6547;};}function handleError(_0x1e7db7,_0x5afd78){_0x5afd78=_0x5afd78||0x1f4;return function(_0x36cecf){logger[_0x597a('0x21')](_0x36cecf[_0x597a('0x22')]);if(_0x36cecf[_0x597a('0x23')]){delete _0x36cecf[_0x597a('0x23')];}_0x1e7db7[_0x597a('0x18')](_0x5afd78)[_0x597a('0x24')](_0x36cecf);};}exports[_0x597a('0x25')]=function(_0x595cac,_0x45269d){var _0x4dcc53={},_0x37526d={},_0x5d0c82={'count':0x0,'rows':[]};var _0x1050ee=_['map'](db[_0x597a('0x26')][_0x597a('0x27')],function(_0x3636b1){return{'name':_0x3636b1[_0x597a('0x28')],'type':_0x3636b1[_0x597a('0x29')]['key']};});_0x37526d['model']=_[_0x597a('0x2a')](_0x1050ee,_0x597a('0x23'));_0x37526d[_0x597a('0x2b')]=_[_0x597a('0x2c')](_0x595cac[_0x597a('0x2b')]);_0x37526d[_0x597a('0x2d')]=_[_0x597a('0x2e')](_0x37526d['model'],_0x37526d[_0x597a('0x2b')]);_0x4dcc53['attributes']=_[_0x597a('0x2e')](_0x37526d[_0x597a('0x2f')],qs[_0x597a('0x30')](_0x595cac[_0x597a('0x2b')][_0x597a('0x30')]));_0x4dcc53[_0x597a('0x31')]=_0x4dcc53[_0x597a('0x31')][_0x597a('0x32')]?_0x4dcc53['attributes']:_0x37526d[_0x597a('0x2f')];if(!_0x595cac[_0x597a('0x2b')][_0x597a('0x33')]('nolimit')){_0x4dcc53[_0x597a('0x1c')]=qs['limit'](_0x595cac['query']['limit']);_0x4dcc53[_0x597a('0x1b')]=qs[_0x597a('0x1b')](_0x595cac[_0x597a('0x2b')]['offset']);}_0x4dcc53[_0x597a('0x34')]=qs[_0x597a('0x35')](_0x595cac[_0x597a('0x2b')][_0x597a('0x35')]);_0x4dcc53[_0x597a('0x36')]=qs[_0x597a('0x2d')](_[_0x597a('0x37')](_0x595cac[_0x597a('0x2b')],_0x37526d[_0x597a('0x2d')]),_0x1050ee);if(_0x595cac[_0x597a('0x2b')][_0x597a('0x38')]){_0x4dcc53[_0x597a('0x36')]=_[_0x597a('0x39')](_0x4dcc53[_0x597a('0x36')],{'$or':_[_0x597a('0x2a')](_0x1050ee,function(_0xfb820a){if(_0xfb820a[_0x597a('0x29')]!==_0x597a('0x3a')){var _0x4f0f12={};_0x4f0f12[_0xfb820a[_0x597a('0x23')]]={'$like':'%'+_0x595cac[_0x597a('0x2b')]['filter']+'%'};return _0x4f0f12;}})});}_0x4dcc53=_[_0x597a('0x39')]({},_0x4dcc53,_0x595cac[_0x597a('0x3b')]);var _0x3b8312={'where':_0x4dcc53[_0x597a('0x36')]};return db[_0x597a('0x26')][_0x597a('0x3c')](_0x3b8312)[_0x597a('0x1f')](function(_0x5a33ae){_0x5d0c82['count']=_0x5a33ae;if(_0x595cac[_0x597a('0x2b')][_0x597a('0x3d')]){_0x4dcc53[_0x597a('0x3e')]=[{'all':!![]}];}return db[_0x597a('0x26')]['findAll'](_0x4dcc53);})[_0x597a('0x1f')](function(_0x370867){_0x5d0c82[_0x597a('0x3f')]=_0x370867;return _0x5d0c82;})['then'](respondWithFilteredResult(_0x45269d,_0x4dcc53))[_0x597a('0x40')](handleError(_0x45269d,null));};exports['show']=function(_0x12d796,_0x34f3c5){var _0x362e76={'raw':![],'where':{'id':_0x12d796[_0x597a('0x41')]['id']}},_0x428ab0={};_0x428ab0[_0x597a('0x2f')]=_['keys'](db['Integration']['rawAttributes']);_0x428ab0['query']=_[_0x597a('0x2c')](_0x12d796[_0x597a('0x2b')]);_0x428ab0[_0x597a('0x2d')]=_[_0x597a('0x2e')](_0x428ab0[_0x597a('0x2f')],_0x428ab0[_0x597a('0x2b')]);_0x362e76[_0x597a('0x31')]=_[_0x597a('0x2e')](_0x428ab0[_0x597a('0x2f')],qs[_0x597a('0x30')](_0x12d796[_0x597a('0x2b')][_0x597a('0x30')]));_0x362e76[_0x597a('0x31')]=_0x362e76[_0x597a('0x31')]['length']?_0x362e76['attributes']:_0x428ab0[_0x597a('0x2f')];if(_0x12d796['query'][_0x597a('0x3d')]){_0x362e76['include']=[{'all':!![]}];}_0x362e76=_[_0x597a('0x39')]({},_0x362e76,_0x12d796[_0x597a('0x3b')]);return db[_0x597a('0x26')][_0x597a('0x42')](_0x362e76)[_0x597a('0x1f')](handleEntityNotFound(_0x34f3c5,null))[_0x597a('0x1f')](respondWithResult(_0x34f3c5,null))['catch'](handleError(_0x34f3c5,null));};exports[_0x597a('0x43')]=function(_0x599f90,_0x1b0e7b){return db[_0x597a('0x26')][_0x597a('0x43')](_0x599f90[_0x597a('0x44')],{})[_0x597a('0x1f')](respondWithResult(_0x1b0e7b,0xc9))[_0x597a('0x40')](handleError(_0x1b0e7b,null));};exports['update']=function(_0xd5bf7,_0xa1a106){if(_0xd5bf7[_0x597a('0x44')]['id']){delete _0xd5bf7['body']['id'];}return db[_0x597a('0x26')][_0x597a('0x42')]({'where':{'id':_0xd5bf7['params']['id']}})['then'](handleEntityNotFound(_0xa1a106,null))[_0x597a('0x1f')](saveUpdates(_0xd5bf7[_0x597a('0x44')],null))[_0x597a('0x1f')](respondWithResult(_0xa1a106,null))['catch'](handleError(_0xa1a106,null));};exports[_0x597a('0x20')]=function(_0x5db75f,_0x568c6e){return db[_0x597a('0x26')][_0x597a('0x42')]({'where':{'id':_0x5db75f[_0x597a('0x41')]['id']}})['then'](handleEntityNotFound(_0x568c6e,null))[_0x597a('0x1f')](removeEntity(_0x568c6e,null))[_0x597a('0x40')](handleError(_0x568c6e,null));}; \ No newline at end of file +var _0xf8dc=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','error','name','send','Integration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','then','findAll','rows','catch','params','rawAttributes','includeAll','merge','options','find','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x38fae0,_0x27639e){var _0x689312=function(_0x7ffff3){while(--_0x7ffff3){_0x38fae0['push'](_0x38fae0['shift']());}};_0x689312(++_0x27639e);}(_0xf8dc,0x74));var _0xcf8d=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xf8dc[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf8d('0x0'));var rimraf=require(_0xcf8d('0x1'));var zipdir=require(_0xcf8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf8d('0x3'));var moment=require(_0xcf8d('0x4'));var BPromise=require(_0xcf8d('0x5'));var Mustache=require(_0xcf8d('0x6'));var util=require(_0xcf8d('0x7'));var path=require(_0xcf8d('0x8'));var sox=require(_0xcf8d('0x9'));var csv=require(_0xcf8d('0xa'));var ejs=require(_0xcf8d('0xb'));var fs=require('fs');var _=require(_0xcf8d('0xc'));var squel=require(_0xcf8d('0xd'));var crypto=require(_0xcf8d('0xe'));var jsforce=require(_0xcf8d('0xf'));var deskjs=require(_0xcf8d('0x10'));var toCsv=require(_0xcf8d('0xa'));var querystring=require(_0xcf8d('0x11'));var Papa=require(_0xcf8d('0x12'));var Redis=require(_0xcf8d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcf8d('0x14'));var as=require(_0xcf8d('0x15'));var hardwareService=require(_0xcf8d('0x16'));var logger=require(_0xcf8d('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcf8d('0x18'))['db'];function respondWithStatusCode(_0x39af2c,_0x1b6e9d){_0x1b6e9d=_0x1b6e9d||0xcc;return function(_0x1628b6){if(_0x1628b6){return _0x39af2c[_0xcf8d('0x19')](_0x1b6e9d);}return _0x39af2c[_0xcf8d('0x1a')](_0x1b6e9d)[_0xcf8d('0x1b')]();};}function respondWithResult(_0x445747,_0x40a546){_0x40a546=_0x40a546||0xc8;return function(_0x35cfc6){if(_0x35cfc6){return _0x445747[_0xcf8d('0x1a')](_0x40a546)[_0xcf8d('0x1c')](_0x35cfc6);}};}function respondWithFilteredResult(_0x5a3d0b,_0x27997e){return function(_0x357564){if(_0x357564){var _0x28ef6b=_0x357564[_0xcf8d('0x1d')],_0x270c31=_0x27997e[_0xcf8d('0x1e')],_0x2ee0e6=_0x27997e[_0xcf8d('0x1e')]+_0x27997e[_0xcf8d('0x1f')],_0x4d0650;if(_0x2ee0e6>=_0x28ef6b){_0x2ee0e6=_0x28ef6b;_0x4d0650=0xc8;}else{_0x4d0650=0xce;}_0x5a3d0b[_0xcf8d('0x1a')](_0x4d0650);return _0x5a3d0b[_0xcf8d('0x20')]('Content-Range',_0x270c31+'-'+_0x2ee0e6+'/'+_0x28ef6b)[_0xcf8d('0x1c')](_0x357564);}return null;};}function patchUpdates(_0x3e06fb){return function(_0x158408){try{jsonpatch[_0xcf8d('0x21')](_0x158408,_0x3e06fb,!![]);}catch(_0x19aa95){return BPromise[_0xcf8d('0x22')](_0x19aa95);}return _0x158408['save']();};}function saveUpdates(_0x515dfb,_0x5b683a){return function(_0xe8ac03){if(_0xe8ac03){return _0xe8ac03[_0xcf8d('0x23')](_0x515dfb)['then'](function(_0x26f8f4){return _0x26f8f4;});}return null;};}function removeEntity(_0x552314,_0xb1e35){return function(_0x247de2){if(_0x247de2){return _0x247de2['destroy']()['then'](function(){_0x552314[_0xcf8d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5029d9,_0x58cfac){return function(_0x15aba5){if(!_0x15aba5){_0x5029d9['sendStatus'](0x194);}return _0x15aba5;};}function handleError(_0x231250,_0xde7061){_0xde7061=_0xde7061||0x1f4;return function(_0x426fc2){logger[_0xcf8d('0x24')](_0x426fc2['stack']);if(_0x426fc2[_0xcf8d('0x25')]){delete _0x426fc2[_0xcf8d('0x25')];}_0x231250[_0xcf8d('0x1a')](_0xde7061)[_0xcf8d('0x26')](_0x426fc2);};}exports['index']=function(_0x163d88,_0xc96a00){var _0x282655={},_0x4088ac={},_0x521094={'count':0x0,'rows':[]};var _0x219554=_['map'](db[_0xcf8d('0x27')]['rawAttributes'],function(_0x21a609){return{'name':_0x21a609[_0xcf8d('0x28')],'type':_0x21a609[_0xcf8d('0x29')][_0xcf8d('0x2a')]};});_0x4088ac[_0xcf8d('0x2b')]=_[_0xcf8d('0x2c')](_0x219554,'name');_0x4088ac[_0xcf8d('0x2d')]=_[_0xcf8d('0x2e')](_0x163d88[_0xcf8d('0x2d')]);_0x4088ac[_0xcf8d('0x2f')]=_[_0xcf8d('0x30')](_0x4088ac[_0xcf8d('0x2b')],_0x4088ac[_0xcf8d('0x2d')]);_0x282655['attributes']=_[_0xcf8d('0x30')](_0x4088ac[_0xcf8d('0x2b')],qs[_0xcf8d('0x31')](_0x163d88[_0xcf8d('0x2d')]['fields']));_0x282655[_0xcf8d('0x32')]=_0x282655[_0xcf8d('0x32')][_0xcf8d('0x33')]?_0x282655[_0xcf8d('0x32')]:_0x4088ac[_0xcf8d('0x2b')];if(!_0x163d88[_0xcf8d('0x2d')][_0xcf8d('0x34')](_0xcf8d('0x35'))){_0x282655['limit']=qs[_0xcf8d('0x1f')](_0x163d88['query'][_0xcf8d('0x1f')]);_0x282655[_0xcf8d('0x1e')]=qs['offset'](_0x163d88['query'][_0xcf8d('0x1e')]);}_0x282655[_0xcf8d('0x36')]=qs['sort'](_0x163d88[_0xcf8d('0x2d')][_0xcf8d('0x37')]);_0x282655['where']=qs[_0xcf8d('0x2f')](_['pick'](_0x163d88['query'],_0x4088ac[_0xcf8d('0x2f')]),_0x219554);if(_0x163d88[_0xcf8d('0x2d')]['filter']){_0x282655[_0xcf8d('0x38')]=_['merge'](_0x282655[_0xcf8d('0x38')],{'$or':_[_0xcf8d('0x2c')](_0x219554,function(_0x4bb8b5){if(_0x4bb8b5['type']!==_0xcf8d('0x39')){var _0x28776b={};_0x28776b[_0x4bb8b5[_0xcf8d('0x25')]]={'$like':'%'+_0x163d88[_0xcf8d('0x2d')]['filter']+'%'};return _0x28776b;}})});}_0x282655=_['merge']({},_0x282655,_0x163d88['options']);var _0x44ed22={'where':_0x282655[_0xcf8d('0x38')]};return db[_0xcf8d('0x27')][_0xcf8d('0x1d')](_0x44ed22)[_0xcf8d('0x3a')](function(_0x44c53a){_0x521094[_0xcf8d('0x1d')]=_0x44c53a;if(_0x163d88[_0xcf8d('0x2d')]['includeAll']){_0x282655['include']=[{'all':!![]}];}return db[_0xcf8d('0x27')][_0xcf8d('0x3b')](_0x282655);})['then'](function(_0x16d73b){_0x521094[_0xcf8d('0x3c')]=_0x16d73b;return _0x521094;})['then'](respondWithFilteredResult(_0xc96a00,_0x282655))[_0xcf8d('0x3d')](handleError(_0xc96a00,null));};exports['show']=function(_0x2b06c1,_0x8e1666){var _0x787f33={'raw':![],'where':{'id':_0x2b06c1[_0xcf8d('0x3e')]['id']}},_0x183725={};_0x183725[_0xcf8d('0x2b')]=_[_0xcf8d('0x2e')](db[_0xcf8d('0x27')][_0xcf8d('0x3f')]);_0x183725[_0xcf8d('0x2d')]=_[_0xcf8d('0x2e')](_0x2b06c1[_0xcf8d('0x2d')]);_0x183725[_0xcf8d('0x2f')]=_['intersection'](_0x183725[_0xcf8d('0x2b')],_0x183725[_0xcf8d('0x2d')]);_0x787f33[_0xcf8d('0x32')]=_[_0xcf8d('0x30')](_0x183725[_0xcf8d('0x2b')],qs[_0xcf8d('0x31')](_0x2b06c1[_0xcf8d('0x2d')][_0xcf8d('0x31')]));_0x787f33[_0xcf8d('0x32')]=_0x787f33[_0xcf8d('0x32')]['length']?_0x787f33[_0xcf8d('0x32')]:_0x183725[_0xcf8d('0x2b')];if(_0x2b06c1[_0xcf8d('0x2d')][_0xcf8d('0x40')]){_0x787f33['include']=[{'all':!![]}];}_0x787f33=_[_0xcf8d('0x41')]({},_0x787f33,_0x2b06c1[_0xcf8d('0x42')]);return db[_0xcf8d('0x27')][_0xcf8d('0x43')](_0x787f33)[_0xcf8d('0x3a')](handleEntityNotFound(_0x8e1666,null))['then'](respondWithResult(_0x8e1666,null))[_0xcf8d('0x3d')](handleError(_0x8e1666,null));};exports['create']=function(_0x559800,_0x27f4d8){return db[_0xcf8d('0x27')]['create'](_0x559800[_0xcf8d('0x44')],{})['then'](respondWithResult(_0x27f4d8,0xc9))[_0xcf8d('0x3d')](handleError(_0x27f4d8,null));};exports['update']=function(_0x30e351,_0x1bce38){if(_0x30e351[_0xcf8d('0x44')]['id']){delete _0x30e351[_0xcf8d('0x44')]['id'];}return db[_0xcf8d('0x27')][_0xcf8d('0x43')]({'where':{'id':_0x30e351[_0xcf8d('0x3e')]['id']}})[_0xcf8d('0x3a')](handleEntityNotFound(_0x1bce38,null))[_0xcf8d('0x3a')](saveUpdates(_0x30e351[_0xcf8d('0x44')],null))[_0xcf8d('0x3a')](respondWithResult(_0x1bce38,null))[_0xcf8d('0x3d')](handleError(_0x1bce38,null));};exports[_0xcf8d('0x45')]=function(_0x465d9b,_0x45a9b0){return db[_0xcf8d('0x27')][_0xcf8d('0x43')]({'where':{'id':_0x465d9b[_0xcf8d('0x3e')]['id']}})[_0xcf8d('0x3a')](handleEntityNotFound(_0x45a9b0,null))[_0xcf8d('0x3a')](removeEntity(_0x45a9b0,null))[_0xcf8d('0x3d')](handleError(_0x45a9b0,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1a2a12f..e339fe5 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 _0x5cdf=['./integration.attributes','exports','define','Integration','api','moment','request-promise','path','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5cdf,0x148));var _0xf5cd=function(_0x4c4352,_0x10affa){_0x4c4352=_0x4c4352-0x0;var _0x3b1c59=_0x5cdf[_0x4c4352];return _0x3b1c59;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf5cd('0x0'));var moment=require(_0xf5cd('0x1'));var BPromise=require('bluebird');var rp=require(_0xf5cd('0x2'));var fs=require('fs');var path=require(_0xf5cd('0x3'));var rimraf=require('rimraf');var config=require(_0xf5cd('0x4'));var attributes=require(_0xf5cd('0x5'));module[_0xf5cd('0x6')]=function(_0x1f8fb6,_0x554a86){return _0x1f8fb6[_0xf5cd('0x7')](_0xf5cd('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x753e=['define','integrations','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x753e,0x115));var _0xe753=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x753e[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xe753('0x0'));var util=require('util');var logger=require(_0xe753('0x1'))(_0xe753('0x2'));var moment=require('moment');var BPromise=require(_0xe753('0x3'));var rp=require(_0xe753('0x4'));var fs=require('fs');var path=require(_0xe753('0x5'));var rimraf=require('rimraf');var config=require(_0xe753('0x6'));var attributes=require(_0xe753('0x7'));module[_0xe753('0x8')]=function(_0x5b1c72,_0x189aa6){return _0x5b1c72[_0xe753('0x9')]('Integration',attributes,{'tableName':_0xe753('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 49f6a83..1a5f493 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 _0xf4e5=['../../config/environment','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x13a219,_0x25acd3){var _0x50e371=function(_0x187aea){while(--_0x187aea){_0x13a219['push'](_0x13a219['shift']());}};_0x50e371(++_0x25acd3);}(_0xf4e5,0xd4));var _0x5f4e=function(_0xe5d6ce,_0x3c8461){_0xe5d6ce=_0xe5d6ce-0x0;var _0x3af3ba=_0xf4e5[_0xe5d6ce];return _0x3af3ba;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var moment=require(_0x5f4e('0x2'));var BPromise=require(_0x5f4e('0x3'));var rs=require(_0x5f4e('0x4'));var fs=require('fs');var Redis=require(_0x5f4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4e('0x6'))(_0x5f4e('0x7'));var config=require(_0x5f4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f4e('0x9')][_0x5f4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3307df,_0xbb7fcc,_0x29199a){return new BPromise(function(_0x223ef1,_0x627bd9){return client[_0x5f4e('0xb')](_0x3307df,_0x29199a)[_0x5f4e('0xc')](function(_0x50767b){logger['info'](_0x5f4e('0xd'),_0xbb7fcc,_0x5f4e('0xe'));logger[_0x5f4e('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0xbb7fcc,_0x5f4e('0xe'),JSON[_0x5f4e('0x10')](_0x50767b));if(_0x50767b[_0x5f4e('0x11')]){if(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x12')]===0x1f4){logger[_0x5f4e('0x11')](_0x5f4e('0xd'),_0xbb7fcc,_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);return _0x627bd9(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);}logger['error'](_0x5f4e('0xd'),_0xbb7fcc,_0x50767b[_0x5f4e('0x11')]['message']);return _0x223ef1(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);}else{logger[_0x5f4e('0x14')]('Integration,\x20%s,\x20%s',_0xbb7fcc,_0x5f4e('0xe'));_0x223ef1(_0x50767b[_0x5f4e('0x15')][_0x5f4e('0x13')]);}})['catch'](function(_0x1e62e5){logger[_0x5f4e('0x11')]('Integration,\x20%s,\x20%s',_0xbb7fcc,_0x1e62e5);_0x627bd9(_0x1e62e5);});});} \ No newline at end of file +var _0xb71d=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x508d86,_0x4f30f8){var _0x30cc8e=function(_0x3bbe4b){while(--_0x3bbe4b){_0x508d86['push'](_0x508d86['shift']());}};_0x30cc8e(++_0x4f30f8);}(_0xb71d,0xc0));var _0xdb71=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb71d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));var BPromise=require(_0xdb71('0x3'));var rs=require(_0xdb71('0x4'));var fs=require('fs');var Redis=require(_0xdb71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb71('0x6'));var logger=require(_0xdb71('0x7'))(_0xdb71('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512f8,_0x4d142c,_0x5070bc){return new BPromise(function(_0x28bbfc,_0x5e3b43){return client[_0xdb71('0xa')](_0x4512f8,_0x5070bc)[_0xdb71('0xb')](function(_0x5826db){logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,_0xdb71('0xe'));logger[_0xdb71('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x4d142c,_0xdb71('0xe'),JSON['stringify'](_0x5826db));if(_0x5826db[_0xdb71('0x10')]){if(_0x5826db[_0xdb71('0x10')][_0xdb71('0x11')]===0x1f4){logger[_0xdb71('0x10')]('Integration,\x20%s,\x20%s',_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x5e3b43(_0x5826db[_0xdb71('0x10')]['message']);}logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x28bbfc(_0x5826db[_0xdb71('0x10')][_0xdb71('0x12')]);}else{logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,'request\x20sent');_0x28bbfc(_0x5826db['result'][_0xdb71('0x12')]);}})['catch'](function(_0x1b5315){logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x1b5315);_0x5e3b43(_0x1b5315);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 595c9d0..0f1de9c 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 _0xa810=['get','index','/describe','isAuthenticated','describe','show','post','/:id','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xa810,0x101));var _0x0a81=function(_0x470d22,_0x1b6a4f){_0x470d22=_0x470d22-0x0;var _0x3cc44d=_0xa810[_0x470d22];return _0x3cc44d;};'use strict';var multer=require(_0x0a81('0x0'));var util=require('util');var path=require(_0x0a81('0x1'));var timeout=require(_0x0a81('0x2'));var express=require(_0x0a81('0x3'));var router=express[_0x0a81('0x4')]();var auth=require(_0x0a81('0x5'));var interaction=require(_0x0a81('0x6'));var config=require(_0x0a81('0x7'));var controller=require(_0x0a81('0x8'));router[_0x0a81('0x9')]('/',auth['isAuthenticated'](),controller[_0x0a81('0xa')]);router[_0x0a81('0x9')](_0x0a81('0xb'),auth[_0x0a81('0xc')](),controller[_0x0a81('0xd')]);router[_0x0a81('0x9')]('/:id',auth[_0x0a81('0xc')](),controller[_0x0a81('0xe')]);router[_0x0a81('0xf')]('/',auth[_0x0a81('0xc')](),controller['create']);router['put'](_0x0a81('0x10'),auth[_0x0a81('0xc')](),controller[_0x0a81('0x11')]);router['delete'](_0x0a81('0x10'),auth['isAuthenticated'](),controller[_0x0a81('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1d3a=['./integrationReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e64d4,_0xe5c4b1){var _0x123a24=function(_0x136abe){while(--_0x136abe){_0x1e64d4['push'](_0x1e64d4['shift']());}};_0x123a24(++_0xe5c4b1);}(_0x1d3a,0xa2));var _0xa1d3=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x1d3a[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xa1d3('0x0'));var util=require(_0xa1d3('0x1'));var path=require(_0xa1d3('0x2'));var timeout=require(_0xa1d3('0x3'));var express=require(_0xa1d3('0x4'));var router=express[_0xa1d3('0x5')]();var auth=require(_0xa1d3('0x6'));var interaction=require(_0xa1d3('0x7'));var config=require(_0xa1d3('0x8'));var controller=require(_0xa1d3('0x9'));router[_0xa1d3('0xa')]('/',auth[_0xa1d3('0xb')](),controller['index']);router['get'](_0xa1d3('0xc'),auth[_0xa1d3('0xb')](),controller['describe']);router['get'](_0xa1d3('0xd'),auth['isAuthenticated'](),controller[_0xa1d3('0xe')]);router[_0xa1d3('0xf')]('/',auth[_0xa1d3('0xb')](),controller[_0xa1d3('0x10')]);router['put'](_0xa1d3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa1d3('0x11')](_0xa1d3('0xd'),auth[_0xa1d3('0xb')](),controller[_0xa1d3('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 73d24f3..b3f88a6 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 _0x9e42=['DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x9e42,0x104));var _0x29e4=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x9e42[_0xcfeda9];return _0x4826c7;};'use strict';var Sequelize=require(_0x29e4('0x0'));module[_0x29e4('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x29e4('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x29e4('0x2')]},'integrationId':{'type':Sequelize[_0x29e4('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x29e4('0x2')]},'calleridname':{'type':Sequelize[_0x29e4('0x2')]},'queue':{'type':Sequelize[_0x29e4('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x29e4('0x2')]},'agentcalledAt':{'type':Sequelize[_0x29e4('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x29e4('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x29e4('0x4')]},'talktime':{'type':Sequelize[_0x29e4('0x3')]},'agentacw':{'type':Sequelize[_0x29e4('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x29e4('0x3')]},'reason':{'type':Sequelize[_0x29e4('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x29e4('0x4')]},'agentdump':{'type':Sequelize[_0x29e4('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x29e4('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x29e4('0x3')]},'channelstatedesc':{'type':Sequelize[_0x29e4('0x2')]},'connectedlinenum':{'type':Sequelize[_0x29e4('0x2')]},'connectedlinename':{'type':Sequelize[_0x29e4('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x29e4('0x2')]},'exten':{'type':Sequelize[_0x29e4('0x2')]},'priority':{'type':Sequelize[_0x29e4('0x2')]},'destchannel':{'type':Sequelize[_0x29e4('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x29e4('0x2')]},'destcalleridnum':{'type':Sequelize[_0x29e4('0x2')]},'destcalleridname':{'type':Sequelize[_0x29e4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x29e4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x29e4('0x2')]},'destlanguage':{'type':Sequelize[_0x29e4('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29e4('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x29e4('0x2')]},'destuniqueid':{'type':Sequelize[_0x29e4('0x2')]},'messageId':{'type':Sequelize[_0x29e4('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x29e4('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x29e4('0x2')]},'attachment':{'type':Sequelize[_0x29e4('0x6')]},'html':{'type':Sequelize[_0x29e4('0x6')]},'text':{'type':Sequelize[_0x29e4('0x6')]},'status':{'type':Sequelize[_0x29e4('0x7')](_0x29e4('0x8'),'SENDING',_0x29e4('0x9'),_0x29e4('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x29e4('0x2')]},'appdata':{'type':Sequelize[_0x29e4('0x2')]},'projectId':{'type':Sequelize[_0x29e4('0x3')]}}; \ No newline at end of file +var _0x58c1=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER'];(function(_0x1fcd03,_0x5074b7){var _0x5518b7=function(_0x36ded6){while(--_0x36ded6){_0x1fcd03['push'](_0x1fcd03['shift']());}};_0x5518b7(++_0x5074b7);}(_0x58c1,0xef));var _0x158c=function(_0x330b1c,_0x1595ed){_0x330b1c=_0x330b1c-0x0;var _0x2f8f57=_0x58c1[_0x330b1c];return _0x2f8f57;};'use strict';var Sequelize=require('sequelize');module[_0x158c('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x158c('0x1')]},'exitStatus':{'type':Sequelize[_0x158c('0x1')]},'ticketId':{'type':Sequelize[_0x158c('0x1')]},'integrationId':{'type':Sequelize[_0x158c('0x2')]},'contacts':{'type':Sequelize[_0x158c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x158c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x158c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x158c('0x2')]},'agentcomplete':{'type':Sequelize[_0x158c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x158c('0x3')]},'talktime':{'type':Sequelize[_0x158c('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x158c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x158c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x158c('0x3')]},'agentdump':{'type':Sequelize[_0x158c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x158c('0x3')]},'lastevent':{'type':Sequelize[_0x158c('0x1')]},'channel':{'type':Sequelize[_0x158c('0x1')]},'channelstate':{'type':Sequelize[_0x158c('0x2')]},'channelstatedesc':{'type':Sequelize[_0x158c('0x1')]},'connectedlinenum':{'type':Sequelize[_0x158c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x158c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x158c('0x1')]},'exten':{'type':Sequelize[_0x158c('0x1')]},'priority':{'type':Sequelize[_0x158c('0x1')]},'destchannel':{'type':Sequelize[_0x158c('0x1')]},'destchannelstate':{'type':Sequelize[_0x158c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x158c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x158c('0x1')]},'destcalleridname':{'type':Sequelize[_0x158c('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x158c('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x158c('0x1')]},'destcontext':{'type':Sequelize[_0x158c('0x1')]},'destexten':{'type':Sequelize[_0x158c('0x1')]},'destpriority':{'type':Sequelize[_0x158c('0x1')]},'destuniqueid':{'type':Sequelize[_0x158c('0x1')]},'messageId':{'type':Sequelize[_0x158c('0x1')]},'inReplyTo':{'type':Sequelize[_0x158c('0x1')]},'subject':{'type':Sequelize[_0x158c('0x1')]},'from':{'type':Sequelize[_0x158c('0x1')]},'to':{'type':Sequelize[_0x158c('0x1')]},'cc':{'type':Sequelize[_0x158c('0x1')]},'attachment':{'type':Sequelize[_0x158c('0x5')]},'html':{'type':Sequelize[_0x158c('0x5')]},'text':{'type':Sequelize[_0x158c('0x5')]},'status':{'type':Sequelize[_0x158c('0x6')](_0x158c('0x7'),_0x158c('0x8'),_0x158c('0x9'),_0x158c('0xa'))},'url':{'type':Sequelize[_0x158c('0x1')]},'app':{'type':Sequelize[_0x158c('0x1')]},'appdata':{'type':Sequelize[_0x158c('0x1')]},'projectId':{'type':Sequelize[_0x158c('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ed6c165..572e346 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 _0x0a6d=['find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','reject','update','then','end','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','intersection','includeAll'];(function(_0x47330a,_0x4405b7){var _0xb39ff8=function(_0x179202){while(--_0x179202){_0x47330a['push'](_0x47330a['shift']());}};_0xb39ff8(++_0x4405b7);}(_0x0a6d,0x141));var _0xd0a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a6d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd0a6('0x0'));var emlformat=require(_0xd0a6('0x1'));var rimraf=require(_0xd0a6('0x2'));var zipdir=require(_0xd0a6('0x3'));var jsonpatch=require(_0xd0a6('0x4'));var rp=require(_0xd0a6('0x5'));var moment=require(_0xd0a6('0x6'));var BPromise=require(_0xd0a6('0x7'));var Mustache=require(_0xd0a6('0x8'));var util=require(_0xd0a6('0x9'));var path=require('path');var sox=require(_0xd0a6('0xa'));var csv=require(_0xd0a6('0xb'));var ejs=require(_0xd0a6('0xc'));var fs=require('fs');var _=require(_0xd0a6('0xd'));var squel=require(_0xd0a6('0xe'));var crypto=require(_0xd0a6('0xf'));var jsforce=require(_0xd0a6('0x10'));var deskjs=require(_0xd0a6('0x11'));var toCsv=require(_0xd0a6('0xb'));var querystring=require('querystring');var Papa=require(_0xd0a6('0x12'));var Redis=require('ioredis');var authService=require(_0xd0a6('0x13'));var qs=require(_0xd0a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0a6('0x15'));var logger=require(_0xd0a6('0x16'))(_0xd0a6('0x17'));var utils=require(_0xd0a6('0x18'));var config=require(_0xd0a6('0x19'));var db=require(_0xd0a6('0x1a'))['db'];function respondWithStatusCode(_0x2990f5,_0x1c3758){_0x1c3758=_0x1c3758||0xcc;return function(_0x2c940b){if(_0x2c940b){return _0x2990f5['sendStatus'](_0x1c3758);}return _0x2990f5[_0xd0a6('0x1b')](_0x1c3758)['end']();};}function respondWithResult(_0x9f3f1e,_0x50bcd4){_0x50bcd4=_0x50bcd4||0xc8;return function(_0x17f8aa){if(_0x17f8aa){return _0x9f3f1e[_0xd0a6('0x1b')](_0x50bcd4)[_0xd0a6('0x1c')](_0x17f8aa);}};}function respondWithFilteredResult(_0x38bb51,_0x438dd9){return function(_0x13148a){if(_0x13148a){var _0x330b40=_0x13148a[_0xd0a6('0x1d')],_0x34057c=_0x438dd9[_0xd0a6('0x1e')],_0x382e40=_0x438dd9[_0xd0a6('0x1e')]+_0x438dd9['limit'],_0x61144f;if(_0x382e40>=_0x330b40){_0x382e40=_0x330b40;_0x61144f=0xc8;}else{_0x61144f=0xce;}_0x38bb51[_0xd0a6('0x1b')](_0x61144f);return _0x38bb51[_0xd0a6('0x1f')](_0xd0a6('0x20'),_0x34057c+'-'+_0x382e40+'/'+_0x330b40)[_0xd0a6('0x1c')](_0x13148a);}return null;};}function patchUpdates(_0x4bf151){return function(_0x22c290){try{jsonpatch['apply'](_0x22c290,_0x4bf151,!![]);}catch(_0x43eb8b){return BPromise[_0xd0a6('0x21')](_0x43eb8b);}return _0x22c290['save']();};}function saveUpdates(_0x2c3376,_0x11b965){return function(_0x4f5507){if(_0x4f5507){return _0x4f5507[_0xd0a6('0x22')](_0x2c3376)[_0xd0a6('0x23')](function(_0x46d302){return _0x46d302;});}return null;};}function removeEntity(_0x5c606b,_0x117968){return function(_0x2f3216){if(_0x2f3216){return _0x2f3216['destroy']()[_0xd0a6('0x23')](function(){_0x5c606b['status'](0xcc)[_0xd0a6('0x24')]();});}};}function handleEntityNotFound(_0x591b5b,_0x21b79f){return function(_0x95fef7){if(!_0x95fef7){_0x591b5b[_0xd0a6('0x25')](0x194);}return _0x95fef7;};}function handleError(_0x4bac0a,_0x364900){_0x364900=_0x364900||0x1f4;return function(_0x224342){logger[_0xd0a6('0x26')](_0x224342[_0xd0a6('0x27')]);if(_0x224342[_0xd0a6('0x28')]){delete _0x224342[_0xd0a6('0x28')];}_0x4bac0a[_0xd0a6('0x1b')](_0x364900)[_0xd0a6('0x29')](_0x224342);};}exports[_0xd0a6('0x2a')]=function(_0x360066,_0x4699a5){var _0x1eef0a={},_0x207b7f={},_0x13796f={'count':0x0,'rows':[]};var _0x3502f0=_[_0xd0a6('0x2b')](db[_0xd0a6('0x2c')][_0xd0a6('0x2d')],function(_0x4676c2){return{'name':_0x4676c2[_0xd0a6('0x2e')],'type':_0x4676c2[_0xd0a6('0x2f')][_0xd0a6('0x30')]};});_0x207b7f[_0xd0a6('0x31')]=_[_0xd0a6('0x2b')](_0x3502f0,_0xd0a6('0x28'));_0x207b7f[_0xd0a6('0x32')]=_['keys'](_0x360066[_0xd0a6('0x32')]);_0x207b7f[_0xd0a6('0x33')]=_['intersection'](_0x207b7f[_0xd0a6('0x31')],_0x207b7f[_0xd0a6('0x32')]);_0x1eef0a[_0xd0a6('0x34')]=_['intersection'](_0x207b7f[_0xd0a6('0x31')],qs[_0xd0a6('0x35')](_0x360066['query'][_0xd0a6('0x35')]));_0x1eef0a['attributes']=_0x1eef0a[_0xd0a6('0x34')][_0xd0a6('0x36')]?_0x1eef0a[_0xd0a6('0x34')]:_0x207b7f[_0xd0a6('0x31')];if(!_0x360066[_0xd0a6('0x32')][_0xd0a6('0x37')](_0xd0a6('0x38'))){_0x1eef0a[_0xd0a6('0x39')]=qs[_0xd0a6('0x39')](_0x360066[_0xd0a6('0x32')][_0xd0a6('0x39')]);_0x1eef0a[_0xd0a6('0x1e')]=qs[_0xd0a6('0x1e')](_0x360066[_0xd0a6('0x32')][_0xd0a6('0x1e')]);}_0x1eef0a[_0xd0a6('0x3a')]=qs[_0xd0a6('0x3b')](_0x360066[_0xd0a6('0x32')][_0xd0a6('0x3b')]);_0x1eef0a[_0xd0a6('0x3c')]=qs[_0xd0a6('0x33')](_['pick'](_0x360066[_0xd0a6('0x32')],_0x207b7f[_0xd0a6('0x33')]),_0x3502f0);if(_0x360066[_0xd0a6('0x32')][_0xd0a6('0x3d')]){_0x1eef0a[_0xd0a6('0x3c')]=_[_0xd0a6('0x3e')](_0x1eef0a[_0xd0a6('0x3c')],{'$or':_['map'](_0x3502f0,function(_0xc17eb2){if(_0xc17eb2[_0xd0a6('0x2f')]!==_0xd0a6('0x3f')){var _0x4be934={};_0x4be934[_0xc17eb2[_0xd0a6('0x28')]]={'$like':'%'+_0x360066['query']['filter']+'%'};return _0x4be934;}})});}_0x1eef0a=_[_0xd0a6('0x3e')]({},_0x1eef0a,_0x360066[_0xd0a6('0x40')]);var _0x48abe5={'where':_0x1eef0a[_0xd0a6('0x3c')]};return db[_0xd0a6('0x2c')]['count'](_0x48abe5)[_0xd0a6('0x23')](function(_0x210a18){_0x13796f[_0xd0a6('0x1d')]=_0x210a18;if(_0x360066[_0xd0a6('0x32')]['includeAll']){_0x1eef0a[_0xd0a6('0x41')]=[{'all':!![]}];}return db[_0xd0a6('0x2c')][_0xd0a6('0x42')](_0x1eef0a);})[_0xd0a6('0x23')](function(_0x301b27){_0x13796f[_0xd0a6('0x43')]=_0x301b27;return _0x13796f;})[_0xd0a6('0x23')](respondWithFilteredResult(_0x4699a5,_0x1eef0a))[_0xd0a6('0x44')](handleError(_0x4699a5,null));};exports[_0xd0a6('0x45')]=function(_0x2c95be,_0x5ac62d){var _0x33d662={'raw':![],'where':{'id':_0x2c95be[_0xd0a6('0x46')]['id']}},_0x501303={};_0x501303[_0xd0a6('0x31')]=_[_0xd0a6('0x47')](db[_0xd0a6('0x2c')][_0xd0a6('0x2d')]);_0x501303[_0xd0a6('0x32')]=_[_0xd0a6('0x47')](_0x2c95be[_0xd0a6('0x32')]);_0x501303[_0xd0a6('0x33')]=_[_0xd0a6('0x48')](_0x501303[_0xd0a6('0x31')],_0x501303[_0xd0a6('0x32')]);_0x33d662[_0xd0a6('0x34')]=_[_0xd0a6('0x48')](_0x501303['model'],qs[_0xd0a6('0x35')](_0x2c95be[_0xd0a6('0x32')]['fields']));_0x33d662[_0xd0a6('0x34')]=_0x33d662[_0xd0a6('0x34')][_0xd0a6('0x36')]?_0x33d662['attributes']:_0x501303[_0xd0a6('0x31')];if(_0x2c95be['query'][_0xd0a6('0x49')]){_0x33d662[_0xd0a6('0x41')]=[{'all':!![]}];}_0x33d662=_[_0xd0a6('0x3e')]({},_0x33d662,_0x2c95be[_0xd0a6('0x40')]);return db[_0xd0a6('0x2c')][_0xd0a6('0x4a')](_0x33d662)['then'](handleEntityNotFound(_0x5ac62d,null))[_0xd0a6('0x23')](respondWithResult(_0x5ac62d,null))['catch'](handleError(_0x5ac62d,null));};exports[_0xd0a6('0x4b')]=function(_0x4c64c3,_0x3f49de){return db[_0xd0a6('0x2c')][_0xd0a6('0x4b')](_0x4c64c3[_0xd0a6('0x4c')],{})[_0xd0a6('0x23')](respondWithResult(_0x3f49de,0xc9))[_0xd0a6('0x44')](handleError(_0x3f49de,null));};exports[_0xd0a6('0x22')]=function(_0x267330,_0x1ea576){if(_0x267330[_0xd0a6('0x4c')]['id']){delete _0x267330[_0xd0a6('0x4c')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x267330[_0xd0a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ea576,null))[_0xd0a6('0x23')](saveUpdates(_0x267330[_0xd0a6('0x4c')],null))['then'](respondWithResult(_0x1ea576,null))[_0xd0a6('0x44')](handleError(_0x1ea576,null));};exports[_0xd0a6('0x4d')]=function(_0x12a665,_0x1b70ce){return db[_0xd0a6('0x2c')][_0xd0a6('0x4a')]({'where':{'id':_0x12a665[_0xd0a6('0x46')]['id']}})[_0xd0a6('0x23')](handleEntityNotFound(_0x1b70ce,null))[_0xd0a6('0x23')](removeEntity(_0x1b70ce,null))[_0xd0a6('0x44')](handleError(_0x1b70ce,null));};exports[_0xd0a6('0x4e')]=function(_0x5e0ef9,_0x293c37){return db[_0xd0a6('0x2c')][_0xd0a6('0x4e')]()[_0xd0a6('0x23')](respondWithResult(_0x293c37,null))['catch'](handleError(_0x293c37,null));}; \ No newline at end of file +var _0xb0e8=['describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','reject','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body'];(function(_0x2ad632,_0x134994){var _0x418653=function(_0x1066bd){while(--_0x1066bd){_0x2ad632['push'](_0x2ad632['shift']());}};_0x418653(++_0x134994);}(_0xb0e8,0xd0));var _0x8b0e=function(_0x4d9403,_0x33c5f0){_0x4d9403=_0x4d9403-0x0;var _0x5eef11=_0xb0e8[_0x4d9403];return _0x5eef11;};'use strict';var pdf=require(_0x8b0e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b0e('0x2'));var rp=require(_0x8b0e('0x3'));var moment=require(_0x8b0e('0x4'));var BPromise=require(_0x8b0e('0x5'));var Mustache=require(_0x8b0e('0x6'));var util=require('util');var path=require(_0x8b0e('0x7'));var sox=require(_0x8b0e('0x8'));var csv=require('to-csv');var ejs=require(_0x8b0e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b0e('0xa'));var crypto=require(_0x8b0e('0xb'));var jsforce=require(_0x8b0e('0xc'));var deskjs=require(_0x8b0e('0xd'));var toCsv=require(_0x8b0e('0xe'));var querystring=require(_0x8b0e('0xf'));var Papa=require(_0x8b0e('0x10'));var Redis=require('ioredis');var authService=require(_0x8b0e('0x11'));var qs=require(_0x8b0e('0x12'));var as=require(_0x8b0e('0x13'));var hardwareService=require(_0x8b0e('0x14'));var logger=require(_0x8b0e('0x15'))(_0x8b0e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8b0e('0x17'))['db'];function respondWithStatusCode(_0xbdc9ad,_0x5c1333){_0x5c1333=_0x5c1333||0xcc;return function(_0x378bee){if(_0x378bee){return _0xbdc9ad[_0x8b0e('0x18')](_0x5c1333);}return _0xbdc9ad[_0x8b0e('0x19')](_0x5c1333)[_0x8b0e('0x1a')]();};}function respondWithResult(_0x3f2727,_0x20f8df){_0x20f8df=_0x20f8df||0xc8;return function(_0x39267d){if(_0x39267d){return _0x3f2727[_0x8b0e('0x19')](_0x20f8df)['json'](_0x39267d);}};}function respondWithFilteredResult(_0xb6b624,_0x4b49d5){return function(_0x50b14e){if(_0x50b14e){var _0x42200d=_0x50b14e[_0x8b0e('0x1b')],_0x54598a=_0x4b49d5[_0x8b0e('0x1c')],_0xf9f1e2=_0x4b49d5['offset']+_0x4b49d5[_0x8b0e('0x1d')],_0x1d894a;if(_0xf9f1e2>=_0x42200d){_0xf9f1e2=_0x42200d;_0x1d894a=0xc8;}else{_0x1d894a=0xce;}_0xb6b624[_0x8b0e('0x19')](_0x1d894a);return _0xb6b624['set'](_0x8b0e('0x1e'),_0x54598a+'-'+_0xf9f1e2+'/'+_0x42200d)['json'](_0x50b14e);}return null;};}function patchUpdates(_0x452681){return function(_0x41c41f){try{jsonpatch['apply'](_0x41c41f,_0x452681,!![]);}catch(_0x569d01){return BPromise[_0x8b0e('0x1f')](_0x569d01);}return _0x41c41f['save']();};}function saveUpdates(_0x5224fb,_0x589ee4){return function(_0x3f83ff){if(_0x3f83ff){return _0x3f83ff[_0x8b0e('0x20')](_0x5224fb)[_0x8b0e('0x21')](function(_0x513dbf){return _0x513dbf;});}return null;};}function removeEntity(_0x1aaab5,_0x39ec81){return function(_0x56feab){if(_0x56feab){return _0x56feab[_0x8b0e('0x22')]()[_0x8b0e('0x21')](function(){_0x1aaab5['status'](0xcc)[_0x8b0e('0x1a')]();});}};}function handleEntityNotFound(_0x5a673c,_0x5c3151){return function(_0x5be2ff){if(!_0x5be2ff){_0x5a673c[_0x8b0e('0x18')](0x194);}return _0x5be2ff;};}function handleError(_0x3a5af4,_0x397e64){_0x397e64=_0x397e64||0x1f4;return function(_0x560e75){logger[_0x8b0e('0x23')](_0x560e75['stack']);if(_0x560e75[_0x8b0e('0x24')]){delete _0x560e75[_0x8b0e('0x24')];}_0x3a5af4[_0x8b0e('0x19')](_0x397e64)[_0x8b0e('0x25')](_0x560e75);};}exports[_0x8b0e('0x26')]=function(_0x4d1566,_0x126c87){var _0x2ab3c8={},_0x4df3a1={},_0x265400={'count':0x0,'rows':[]};var _0x2bbf90=_[_0x8b0e('0x27')](db[_0x8b0e('0x28')][_0x8b0e('0x29')],function(_0x59bee9){return{'name':_0x59bee9[_0x8b0e('0x2a')],'type':_0x59bee9[_0x8b0e('0x2b')][_0x8b0e('0x2c')]};});_0x4df3a1[_0x8b0e('0x2d')]=_[_0x8b0e('0x27')](_0x2bbf90,_0x8b0e('0x24'));_0x4df3a1[_0x8b0e('0x2e')]=_[_0x8b0e('0x2f')](_0x4d1566[_0x8b0e('0x2e')]);_0x4df3a1['filters']=_[_0x8b0e('0x30')](_0x4df3a1[_0x8b0e('0x2d')],_0x4df3a1['query']);_0x2ab3c8[_0x8b0e('0x31')]=_['intersection'](_0x4df3a1[_0x8b0e('0x2d')],qs[_0x8b0e('0x32')](_0x4d1566[_0x8b0e('0x2e')][_0x8b0e('0x32')]));_0x2ab3c8[_0x8b0e('0x31')]=_0x2ab3c8[_0x8b0e('0x31')]['length']?_0x2ab3c8[_0x8b0e('0x31')]:_0x4df3a1[_0x8b0e('0x2d')];if(!_0x4d1566[_0x8b0e('0x2e')]['hasOwnProperty']('nolimit')){_0x2ab3c8['limit']=qs['limit'](_0x4d1566[_0x8b0e('0x2e')]['limit']);_0x2ab3c8['offset']=qs['offset'](_0x4d1566[_0x8b0e('0x2e')][_0x8b0e('0x1c')]);}_0x2ab3c8['order']=qs[_0x8b0e('0x33')](_0x4d1566[_0x8b0e('0x2e')][_0x8b0e('0x33')]);_0x2ab3c8[_0x8b0e('0x34')]=qs[_0x8b0e('0x35')](_[_0x8b0e('0x36')](_0x4d1566[_0x8b0e('0x2e')],_0x4df3a1[_0x8b0e('0x35')]),_0x2bbf90);if(_0x4d1566[_0x8b0e('0x2e')][_0x8b0e('0x37')]){_0x2ab3c8[_0x8b0e('0x34')]=_['merge'](_0x2ab3c8[_0x8b0e('0x34')],{'$or':_[_0x8b0e('0x27')](_0x2bbf90,function(_0x2717f9){if(_0x2717f9['type']!==_0x8b0e('0x38')){var _0x1bc637={};_0x1bc637[_0x2717f9[_0x8b0e('0x24')]]={'$like':'%'+_0x4d1566['query']['filter']+'%'};return _0x1bc637;}})});}_0x2ab3c8=_[_0x8b0e('0x39')]({},_0x2ab3c8,_0x4d1566[_0x8b0e('0x3a')]);var _0x43033d={'where':_0x2ab3c8['where']};return db['IntegrationReport']['count'](_0x43033d)[_0x8b0e('0x21')](function(_0x2b8fa5){_0x265400[_0x8b0e('0x1b')]=_0x2b8fa5;if(_0x4d1566[_0x8b0e('0x2e')][_0x8b0e('0x3b')]){_0x2ab3c8[_0x8b0e('0x3c')]=[{'all':!![]}];}return db[_0x8b0e('0x28')][_0x8b0e('0x3d')](_0x2ab3c8);})['then'](function(_0x4681d2){_0x265400['rows']=_0x4681d2;return _0x265400;})['then'](respondWithFilteredResult(_0x126c87,_0x2ab3c8))[_0x8b0e('0x3e')](handleError(_0x126c87,null));};exports[_0x8b0e('0x3f')]=function(_0x67c008,_0xd6da46){var _0x107680={'raw':![],'where':{'id':_0x67c008[_0x8b0e('0x40')]['id']}},_0x2e794e={};_0x2e794e['model']=_[_0x8b0e('0x2f')](db['IntegrationReport'][_0x8b0e('0x29')]);_0x2e794e[_0x8b0e('0x2e')]=_[_0x8b0e('0x2f')](_0x67c008[_0x8b0e('0x2e')]);_0x2e794e['filters']=_['intersection'](_0x2e794e[_0x8b0e('0x2d')],_0x2e794e[_0x8b0e('0x2e')]);_0x107680['attributes']=_['intersection'](_0x2e794e[_0x8b0e('0x2d')],qs[_0x8b0e('0x32')](_0x67c008['query'][_0x8b0e('0x32')]));_0x107680[_0x8b0e('0x31')]=_0x107680[_0x8b0e('0x31')]['length']?_0x107680[_0x8b0e('0x31')]:_0x2e794e[_0x8b0e('0x2d')];if(_0x67c008['query']['includeAll']){_0x107680[_0x8b0e('0x3c')]=[{'all':!![]}];}_0x107680=_[_0x8b0e('0x39')]({},_0x107680,_0x67c008['options']);return db[_0x8b0e('0x28')][_0x8b0e('0x41')](_0x107680)['then'](handleEntityNotFound(_0xd6da46,null))[_0x8b0e('0x21')](respondWithResult(_0xd6da46,null))[_0x8b0e('0x3e')](handleError(_0xd6da46,null));};exports[_0x8b0e('0x42')]=function(_0x577304,_0x3fab0a){return db[_0x8b0e('0x28')][_0x8b0e('0x42')](_0x577304[_0x8b0e('0x43')],{})[_0x8b0e('0x21')](respondWithResult(_0x3fab0a,0xc9))[_0x8b0e('0x3e')](handleError(_0x3fab0a,null));};exports[_0x8b0e('0x20')]=function(_0x535260,_0x14b0cc){if(_0x535260[_0x8b0e('0x43')]['id']){delete _0x535260[_0x8b0e('0x43')]['id'];}return db[_0x8b0e('0x28')]['find']({'where':{'id':_0x535260[_0x8b0e('0x40')]['id']}})['then'](handleEntityNotFound(_0x14b0cc,null))[_0x8b0e('0x21')](saveUpdates(_0x535260[_0x8b0e('0x43')],null))[_0x8b0e('0x21')](respondWithResult(_0x14b0cc,null))[_0x8b0e('0x3e')](handleError(_0x14b0cc,null));};exports['destroy']=function(_0x577da3,_0x5eaa75){return db[_0x8b0e('0x28')]['find']({'where':{'id':_0x577da3[_0x8b0e('0x40')]['id']}})[_0x8b0e('0x21')](handleEntityNotFound(_0x5eaa75,null))[_0x8b0e('0x21')](removeEntity(_0x5eaa75,null))[_0x8b0e('0x3e')](handleError(_0x5eaa75,null));};exports[_0x8b0e('0x44')]=function(_0x2d6160,_0x2b5f39){return db['IntegrationReport'][_0x8b0e('0x44')]()[_0x8b0e('0x21')](respondWithResult(_0x2b5f39,null))[_0x8b0e('0x3e')](handleError(_0x2b5f39,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3916088..8b9ff58 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 _0x1540=['api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','report_integration','util'];(function(_0x2fe835,_0x4f9c5c){var _0x72f1d4=function(_0x375b0e){while(--_0x375b0e){_0x2fe835['push'](_0x2fe835['shift']());}};_0x72f1d4(++_0x4f9c5c);}(_0x1540,0x1f3));var _0x0154=function(_0x25580d,_0x2a1ca6){_0x25580d=_0x25580d-0x0;var _0x4ce226=_0x1540[_0x25580d];return _0x4ce226;};'use strict';var _=require('lodash');var util=require(_0x0154('0x0'));var logger=require('../../config/logger')(_0x0154('0x1'));var moment=require('moment');var BPromise=require(_0x0154('0x2'));var rp=require(_0x0154('0x3'));var fs=require('fs');var path=require(_0x0154('0x4'));var rimraf=require(_0x0154('0x5'));var config=require(_0x0154('0x6'));var attributes=require(_0x0154('0x7'));module['exports']=function(_0x53c7ab,_0x2f8793){return _0x53c7ab[_0x0154('0x8')]('IntegrationReport',attributes,{'tableName':_0x0154('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1c7=['request-promise','path','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x243487,_0x331490){var _0x1b789d=function(_0x5ae48d){while(--_0x5ae48d){_0x243487['push'](_0x243487['shift']());}};_0x1b789d(++_0x331490);}(_0xf1c7,0x1d1));var _0x7f1c=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xf1c7[_0x1fd675];return _0x16b554;};'use strict';var _=require(_0x7f1c('0x0'));var util=require(_0x7f1c('0x1'));var logger=require(_0x7f1c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f1c('0x3'));var fs=require('fs');var path=require(_0x7f1c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x7f1c('0x5')]=function(_0x37063b,_0x2fd871){return _0x37063b[_0x7f1c('0x6')](_0x7f1c('0x7'),attributes,{'tableName':_0x7f1c('0x8'),'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 515b423..2c29862 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x14a0,0x8e));var _0x014a=function(_0x49450f,_0x18f8c6){_0x49450f=_0x49450f-0x0;var _0x545c57=_0x14a0[_0x49450f];return _0x545c57;};'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']('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('IntegrationReport,\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')]('IntegrationReport,\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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xaaf1d2,_0x2de59f){var _0x57f52d=function(_0x5ccdfa){while(--_0x5ccdfa){_0xaaf1d2['push'](_0xaaf1d2['shift']());}};_0x57f52d(++_0x2de59f);}(_0xb10b,0x12a));var _0xbb10=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0xb10b[_0x400f2a];return _0x3dd8d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6a8345d..2282f50 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x540f12,_0x252108){var _0x214a77=function(_0x375f82){while(--_0x375f82){_0x540f12['push'](_0x540f12['shift']());}};_0x214a77(++_0x252108);}(_0x008c,0x188));var _0xc008=function(_0x4e05d8,_0xab2ee9){_0x4e05d8=_0x4e05d8-0x0;var _0x356a48=_0x008c[_0x4e05d8];return _0x356a48;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fc0bf38..42f3883 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 _0xd9f8=['exports','STRING','sequelize'];(function(_0x5bfc59,_0x179f75){var _0x59b8c0=function(_0x10c824){while(--_0x10c824){_0x5bfc59['push'](_0x5bfc59['shift']());}};_0x59b8c0(++_0x179f75);}(_0xd9f8,0xa4));var _0x8d9f=function(_0x21ac60,_0x18efe2){_0x21ac60=_0x21ac60-0x0;var _0x589f39=_0xd9f8[_0x21ac60];return _0x589f39;};'use strict';var Sequelize=require(_0x8d9f('0x0'));module[_0x8d9f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8d9f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x01be=['exports','STRING','sequelize'];(function(_0x4d9603,_0x39e1f3){var _0x587c61=function(_0x3d7af1){while(--_0x3d7af1){_0x4d9603['push'](_0x4d9603['shift']());}};_0x587c61(++_0x39e1f3);}(_0x01be,0x1d3));var _0xe01b=function(_0x529664,_0x2d365b){_0x529664=_0x529664-0x0;var _0x3d1b4=_0x01be[_0x529664];return _0x3d1b4;};'use strict';var Sequelize=require(_0xe01b('0x0'));module[_0xe01b('0x1')]={'name':{'type':Sequelize[_0xe01b('0x2')]},'description':{'type':Sequelize[_0xe01b('0x2')]},'interval':{'type':Sequelize[_0xe01b('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c6a61a9..c93ea16 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 _0xe318=['../../config/logger','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Intervals','error','stack','name','index','Interval','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','map','addIntervals','sequelize','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x32d385,_0x3b4df2){var _0x5efbdc=function(_0x368bb6){while(--_0x368bb6){_0x32d385['push'](_0x32d385['shift']());}};_0x5efbdc(++_0x3b4df2);}(_0xe318,0x1ab));var _0x8e31=function(_0x3aec2d,_0x4b6940){_0x3aec2d=_0x3aec2d-0x0;var _0xbef9f3=_0xe318[_0x3aec2d];return _0xbef9f3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8e31('0x0'));var zipdir=require(_0x8e31('0x1'));var jsonpatch=require(_0x8e31('0x2'));var rp=require(_0x8e31('0x3'));var moment=require(_0x8e31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8e31('0x5'));var util=require(_0x8e31('0x6'));var path=require('path');var sox=require(_0x8e31('0x7'));var csv=require(_0x8e31('0x8'));var ejs=require(_0x8e31('0x9'));var fs=require('fs');var _=require(_0x8e31('0xa'));var squel=require('squel');var crypto=require(_0x8e31('0xb'));var jsforce=require(_0x8e31('0xc'));var deskjs=require(_0x8e31('0xd'));var toCsv=require(_0x8e31('0x8'));var querystring=require(_0x8e31('0xe'));var Papa=require(_0x8e31('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8e31('0x10'));var as=require(_0x8e31('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e31('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8e31('0x13'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x115640,_0x4d0053){_0x4d0053=_0x4d0053||0xcc;return function(_0x372fac){if(_0x372fac){return _0x115640[_0x8e31('0x14')](_0x4d0053);}return _0x115640['status'](_0x4d0053)['end']();};}function respondWithResult(_0x18a7c3,_0x6b9409){_0x6b9409=_0x6b9409||0xc8;return function(_0x9ee220){if(_0x9ee220){return _0x18a7c3[_0x8e31('0x15')](_0x6b9409)[_0x8e31('0x16')](_0x9ee220);}};}function respondWithFilteredResult(_0xd84388,_0x3df227){return function(_0x10d79d){if(_0x10d79d){var _0x17cd2a=_0x10d79d[_0x8e31('0x17')],_0x20e82e=_0x3df227[_0x8e31('0x18')],_0x147f31=_0x3df227[_0x8e31('0x18')]+_0x3df227[_0x8e31('0x19')],_0x51129c;if(_0x147f31>=_0x17cd2a){_0x147f31=_0x17cd2a;_0x51129c=0xc8;}else{_0x51129c=0xce;}_0xd84388[_0x8e31('0x15')](_0x51129c);return _0xd84388[_0x8e31('0x1a')](_0x8e31('0x1b'),_0x20e82e+'-'+_0x147f31+'/'+_0x17cd2a)[_0x8e31('0x16')](_0x10d79d);}return null;};}function patchUpdates(_0x54c866){return function(_0x4917a7){try{jsonpatch[_0x8e31('0x1c')](_0x4917a7,_0x54c866,!![]);}catch(_0x358555){return BPromise[_0x8e31('0x1d')](_0x358555);}return _0x4917a7['save']();};}function saveUpdates(_0x44e9cd,_0x3e4350){return function(_0x23da79){if(_0x23da79){return _0x23da79[_0x8e31('0x1e')](_0x44e9cd)['then'](function(_0x519dd8){return _0x519dd8;});}return null;};}function removeEntity(_0x3b345a,_0x3559cd){return function(_0x2dd132){if(_0x2dd132){return _0x2dd132[_0x8e31('0x1f')]()[_0x8e31('0x20')](function(){var _0x50a61d=_0x2dd132[_0x8e31('0x21')]({'plain':!![]});var _0x50af9=_0x8e31('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x50af9,'resourceId':_0x50a61d['id']}})[_0x8e31('0x20')](function(){return _0x2dd132;});})[_0x8e31('0x20')](function(){_0x3b345a[_0x8e31('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1179e9,_0x2374cd){return function(_0x33b0f1){if(!_0x33b0f1){_0x1179e9['sendStatus'](0x194);}return _0x33b0f1;};}function handleError(_0x427bb1,_0x70cf2c){_0x70cf2c=_0x70cf2c||0x1f4;return function(_0x5043e8){logger[_0x8e31('0x23')](_0x5043e8[_0x8e31('0x24')]);if(_0x5043e8[_0x8e31('0x25')]){delete _0x5043e8['name'];}_0x427bb1['status'](_0x70cf2c)['send'](_0x5043e8);};}exports[_0x8e31('0x26')]=function(_0x2eda7a,_0x234ffd){var _0x32c2c1={},_0x448825={},_0x2faab5={'count':0x0,'rows':[]};var _0x409167=_['map'](db[_0x8e31('0x27')]['rawAttributes'],function(_0x3b9a60){return{'name':_0x3b9a60[_0x8e31('0x28')],'type':_0x3b9a60[_0x8e31('0x29')][_0x8e31('0x2a')]};});_0x448825['model']=_['map'](_0x409167,_0x8e31('0x25'));_0x448825[_0x8e31('0x2b')]=_[_0x8e31('0x2c')](_0x2eda7a[_0x8e31('0x2b')]);_0x448825[_0x8e31('0x2d')]=_[_0x8e31('0x2e')](_0x448825[_0x8e31('0x2f')],_0x448825['query']);_0x32c2c1[_0x8e31('0x30')]=_['intersection'](_0x448825[_0x8e31('0x2f')],qs[_0x8e31('0x31')](_0x2eda7a['query'][_0x8e31('0x31')]));_0x32c2c1['attributes']=_0x32c2c1[_0x8e31('0x30')][_0x8e31('0x32')]?_0x32c2c1['attributes']:_0x448825[_0x8e31('0x2f')];if(!_0x2eda7a[_0x8e31('0x2b')][_0x8e31('0x33')](_0x8e31('0x34'))){_0x32c2c1[_0x8e31('0x19')]=qs['limit'](_0x2eda7a[_0x8e31('0x2b')]['limit']);_0x32c2c1[_0x8e31('0x18')]=qs['offset'](_0x2eda7a[_0x8e31('0x2b')][_0x8e31('0x18')]);}_0x32c2c1[_0x8e31('0x35')]=qs[_0x8e31('0x36')](_0x2eda7a[_0x8e31('0x2b')]['sort']);_0x32c2c1['where']=qs['filters'](_[_0x8e31('0x37')](_0x2eda7a[_0x8e31('0x2b')],_0x448825[_0x8e31('0x2d')]),_0x409167);if(_0x2eda7a[_0x8e31('0x2b')][_0x8e31('0x38')]){_0x32c2c1[_0x8e31('0x39')]=_['merge'](_0x32c2c1[_0x8e31('0x39')],{'$or':_['map'](_0x409167,function(_0x9ed13a){if(_0x9ed13a[_0x8e31('0x29')]!==_0x8e31('0x3a')){var _0x595809={};_0x595809[_0x9ed13a[_0x8e31('0x25')]]={'$like':'%'+_0x2eda7a['query'][_0x8e31('0x38')]+'%'};return _0x595809;}})});}_0x32c2c1=_[_0x8e31('0x3b')]({},_0x32c2c1,_0x2eda7a[_0x8e31('0x3c')]);var _0x460da9={'where':_0x32c2c1[_0x8e31('0x39')]};return db[_0x8e31('0x27')][_0x8e31('0x17')](_0x460da9)['then'](function(_0x428793){_0x2faab5[_0x8e31('0x17')]=_0x428793;if(_0x2eda7a['query'][_0x8e31('0x3d')]){_0x32c2c1['include']=[{'all':!![]}];}return db[_0x8e31('0x27')][_0x8e31('0x3e')](_0x32c2c1);})[_0x8e31('0x20')](function(_0x19a524){_0x2faab5[_0x8e31('0x3f')]=_0x19a524;return _0x2faab5;})[_0x8e31('0x20')](respondWithFilteredResult(_0x234ffd,_0x32c2c1))[_0x8e31('0x40')](handleError(_0x234ffd,null));};exports[_0x8e31('0x41')]=function(_0x188d15,_0x49668a){var _0xdad6c1={'raw':!![],'where':{'id':_0x188d15['params']['id']}},_0x5af22e={};_0x5af22e[_0x8e31('0x2f')]=_[_0x8e31('0x2c')](db[_0x8e31('0x27')][_0x8e31('0x42')]);_0x5af22e['query']=_[_0x8e31('0x2c')](_0x188d15[_0x8e31('0x2b')]);_0x5af22e[_0x8e31('0x2d')]=_[_0x8e31('0x2e')](_0x5af22e['model'],_0x5af22e[_0x8e31('0x2b')]);_0xdad6c1[_0x8e31('0x30')]=_['intersection'](_0x5af22e[_0x8e31('0x2f')],qs[_0x8e31('0x31')](_0x188d15[_0x8e31('0x2b')]['fields']));_0xdad6c1['attributes']=_0xdad6c1['attributes'][_0x8e31('0x32')]?_0xdad6c1[_0x8e31('0x30')]:_0x5af22e[_0x8e31('0x2f')];if(_0x188d15[_0x8e31('0x2b')][_0x8e31('0x3d')]){_0xdad6c1[_0x8e31('0x43')]=[{'all':!![]}];}_0xdad6c1=_[_0x8e31('0x3b')]({},_0xdad6c1,_0x188d15[_0x8e31('0x3c')]);return db[_0x8e31('0x27')][_0x8e31('0x44')](_0xdad6c1)['then'](handleEntityNotFound(_0x49668a,null))['then'](respondWithResult(_0x49668a,null))[_0x8e31('0x40')](handleError(_0x49668a,null));};exports[_0x8e31('0x45')]=function(_0x420d51,_0x5570bb){return db[_0x8e31('0x27')][_0x8e31('0x45')](_0x420d51[_0x8e31('0x46')],{})[_0x8e31('0x20')](function(_0x3108eb){var _0x3e3e95=_0x420d51[_0x8e31('0x47')]['get']({'plain':!![]});if(!_0x3e3e95)throw new Error(_0x8e31('0x48'));if(_0x3e3e95[_0x8e31('0x49')]===_0x8e31('0x47')){var _0x5a97ba=_0x3108eb[_0x8e31('0x21')]({'plain':!![]});var _0x7af090=_0x8e31('0x22');return db[_0x8e31('0x4a')][_0x8e31('0x44')]({'where':{'name':_0x7af090,'userProfileId':_0x3e3e95[_0x8e31('0x4b')]},'raw':!![]})[_0x8e31('0x20')](function(_0x4bfae6){if(_0x4bfae6&&_0x4bfae6[_0x8e31('0x4c')]===0x0){return db[_0x8e31('0x4d')]['create']({'name':_0x5a97ba[_0x8e31('0x25')],'resourceId':_0x5a97ba['id'],'type':_0x4bfae6[_0x8e31('0x25')],'sectionId':_0x4bfae6['id']},{})[_0x8e31('0x20')](function(){return _0x3108eb;});}else{return _0x3108eb;}})[_0x8e31('0x40')](function(_0x2dd0af){logger[_0x8e31('0x23')](_0x8e31('0x4e'),_0x2dd0af);throw _0x2dd0af;});}return _0x3108eb;})[_0x8e31('0x20')](respondWithResult(_0x5570bb,0xc9))[_0x8e31('0x40')](handleError(_0x5570bb,null));};exports[_0x8e31('0x1e')]=function(_0x2d80e0,_0x26f0a7){if(_0x2d80e0[_0x8e31('0x46')]['id']){delete _0x2d80e0[_0x8e31('0x46')]['id'];}return db[_0x8e31('0x27')]['find']({'where':{'id':_0x2d80e0[_0x8e31('0x4f')]['id']}})[_0x8e31('0x20')](handleEntityNotFound(_0x26f0a7,null))[_0x8e31('0x20')](saveUpdates(_0x2d80e0['body'],null))[_0x8e31('0x20')](respondWithResult(_0x26f0a7,null))[_0x8e31('0x40')](handleError(_0x26f0a7,null));};exports[_0x8e31('0x1f')]=function(_0xbd5b2a,_0x131718){return db['Interval'][_0x8e31('0x44')]({'where':{'id':_0xbd5b2a[_0x8e31('0x4f')]['id']}})[_0x8e31('0x20')](handleEntityNotFound(_0x131718,null))[_0x8e31('0x20')](removeEntity(_0x131718,null))[_0x8e31('0x40')](handleError(_0x131718,null));};exports[_0x8e31('0x50')]=function(_0x10348b,_0x2786e2,_0x520cd8){if(_0x10348b[_0x8e31('0x46')]['id']){delete _0x10348b[_0x8e31('0x46')]['id'];}return db[_0x8e31('0x27')][_0x8e31('0x44')]({'where':{'id':_0x10348b[_0x8e31('0x4f')]['id']}})[_0x8e31('0x20')](handleEntityNotFound(_0x2786e2,null))[_0x8e31('0x20')](function(_0x4c1ba0){if(_0x4c1ba0){_0x10348b[_0x8e31('0x46')]['IntervalId']=_0x4c1ba0['id'];return db[_0x8e31('0x27')][_0x8e31('0x45')](_0x10348b[_0x8e31('0x46')]);}})[_0x8e31('0x20')](respondWithResult(_0x2786e2,null))[_0x8e31('0x40')](handleError(_0x2786e2,null));};exports[_0x8e31('0x51')]=function(_0x134a80,_0x321aac,_0x83fe62){var _0x339753={};var _0x10a8d1={};var _0x39ebca;var _0x7f3447;return db[_0x8e31('0x27')][_0x8e31('0x52')]({'where':{'id':_0x134a80[_0x8e31('0x4f')]['id']}})[_0x8e31('0x20')](handleEntityNotFound(_0x321aac,null))[_0x8e31('0x20')](function(_0x229cde){if(_0x229cde){_0x39ebca=_0x229cde;_0x10a8d1[_0x8e31('0x2f')]=_[_0x8e31('0x2c')](db[_0x8e31('0x27')][_0x8e31('0x42')]);_0x10a8d1[_0x8e31('0x2b')]=_['keys'](_0x134a80[_0x8e31('0x2b')]);_0x10a8d1['filters']=_[_0x8e31('0x2e')](_0x10a8d1[_0x8e31('0x2f')],_0x10a8d1[_0x8e31('0x2b')]);_0x339753[_0x8e31('0x30')]=_[_0x8e31('0x2e')](_0x10a8d1[_0x8e31('0x2f')],qs[_0x8e31('0x31')](_0x134a80[_0x8e31('0x2b')][_0x8e31('0x31')]));_0x339753['attributes']=_0x339753[_0x8e31('0x30')][_0x8e31('0x32')]?_0x339753[_0x8e31('0x30')]:_0x10a8d1[_0x8e31('0x2f')];_0x339753[_0x8e31('0x35')]=qs[_0x8e31('0x36')](_0x134a80[_0x8e31('0x2b')][_0x8e31('0x36')]);_0x339753[_0x8e31('0x39')]=qs[_0x8e31('0x2d')](_[_0x8e31('0x37')](_0x134a80['query'],_0x10a8d1[_0x8e31('0x2d')]));if(_0x134a80[_0x8e31('0x2b')]['filter']){_0x339753[_0x8e31('0x39')]=_[_0x8e31('0x3b')](_0x339753[_0x8e31('0x39')],{'$or':_[_0x8e31('0x53')](_0x339753[_0x8e31('0x30')],function(_0x3b7dfe){var _0x2e32f7={};_0x2e32f7[_0x3b7dfe]={'$like':'%'+_0x134a80[_0x8e31('0x2b')]['filter']+'%'};return _0x2e32f7;})});}_0x339753=_[_0x8e31('0x3b')]({},_0x339753,_0x134a80[_0x8e31('0x3c')]);return _0x39ebca[_0x8e31('0x51')](_0x339753);}})[_0x8e31('0x20')](function(_0x4d066c){if(_0x4d066c){_0x7f3447=_0x4d066c['length'];if(!_0x134a80[_0x8e31('0x2b')][_0x8e31('0x33')](_0x8e31('0x34'))){_0x339753[_0x8e31('0x19')]=qs['limit'](_0x134a80[_0x8e31('0x2b')][_0x8e31('0x19')]);_0x339753[_0x8e31('0x18')]=qs[_0x8e31('0x18')](_0x134a80[_0x8e31('0x2b')][_0x8e31('0x18')]);}return _0x39ebca[_0x8e31('0x51')](_0x339753);}})[_0x8e31('0x20')](function(_0x3157ac){if(_0x3157ac){return _0x3157ac?{'count':_0x7f3447,'rows':_0x3157ac}:null;}})[_0x8e31('0x20')](respondWithResult(_0x321aac,null))[_0x8e31('0x40')](handleError(_0x321aac,null));};exports[_0x8e31('0x54')]=function(_0x29c786,_0x55d827,_0x2bcb9b){return db[_0x8e31('0x27')][_0x8e31('0x52')]({'where':{'id':_0x29c786[_0x8e31('0x4f')]['id']}})['then'](handleEntityNotFound(_0x55d827,null))[_0x8e31('0x20')](function(_0x5325cd){if(_0x5325cd){return db[_0x8e31('0x55')][_0x8e31('0x56')](function(_0x39d979){return db['Interval'][_0x8e31('0x1f')]({'where':{'IntervalId':_0x29c786[_0x8e31('0x4f')]['id']},'transaction':_0x39d979})[_0x8e31('0x20')](function(_0x43afd2){var _0xa75a10=_[_0x8e31('0x53')](_0x29c786[_0x8e31('0x46')],function(_0x20911b){delete _0x20911b['id'];_0x20911b[_0x8e31('0x57')]=_0x29c786['params']['id'];return _0x20911b;});return db['Interval'][_0x8e31('0x58')](_0xa75a10,{'transaction':_0x39d979});});})['then'](function(){return db['Interval'][_0x8e31('0x3e')]({'where':{'IntervalId':_0x29c786['params']['id']}});});}})[_0x8e31('0x20')](respondWithResult(_0x55d827,null))[_0x8e31('0x40')](handleError(_0x55d827,null));}; \ No newline at end of file +var _0x0c0f=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addInterval','getIntervals','findOne','addIntervals','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','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','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','Interval','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','role','user','UserProfileSection'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x0c0f,0x11a));var _0xf0c0=function(_0x1ae59c,_0x7b8339){_0x1ae59c=_0x1ae59c-0x0;var _0x176aae=_0x0c0f[_0x1ae59c];return _0x176aae;};'use strict';var pdf=require(_0xf0c0('0x0'));var emlformat=require(_0xf0c0('0x1'));var rimraf=require(_0xf0c0('0x2'));var zipdir=require(_0xf0c0('0x3'));var jsonpatch=require(_0xf0c0('0x4'));var rp=require(_0xf0c0('0x5'));var moment=require('moment');var BPromise=require(_0xf0c0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf0c0('0x7'));var sox=require(_0xf0c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf0c0('0x9'));var crypto=require('crypto');var jsforce=require(_0xf0c0('0xa'));var deskjs=require(_0xf0c0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf0c0('0xc'));var Papa=require(_0xf0c0('0xd'));var Redis=require(_0xf0c0('0xe'));var authService=require(_0xf0c0('0xf'));var qs=require(_0xf0c0('0x10'));var as=require(_0xf0c0('0x11'));var hardwareService=require(_0xf0c0('0x12'));var logger=require(_0xf0c0('0x13'))(_0xf0c0('0x14'));var utils=require(_0xf0c0('0x15'));var config=require(_0xf0c0('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0xf0c0('0x17'));function respondWithStatusCode(_0x550876,_0x2ce789){_0x2ce789=_0x2ce789||0xcc;return function(_0x146c3f){if(_0x146c3f){return _0x550876[_0xf0c0('0x18')](_0x2ce789);}return _0x550876[_0xf0c0('0x19')](_0x2ce789)[_0xf0c0('0x1a')]();};}function respondWithResult(_0x4d89ba,_0xa9e350){_0xa9e350=_0xa9e350||0xc8;return function(_0x37a3d7){if(_0x37a3d7){return _0x4d89ba['status'](_0xa9e350)[_0xf0c0('0x1b')](_0x37a3d7);}};}function respondWithFilteredResult(_0x5ea395,_0x4d03dc){return function(_0x3c3538){if(_0x3c3538){var _0x310cd5=_0x3c3538[_0xf0c0('0x1c')],_0x3f21e3=_0x4d03dc['offset'],_0x49de75=_0x4d03dc[_0xf0c0('0x1d')]+_0x4d03dc[_0xf0c0('0x1e')],_0x5e09dd;if(_0x49de75>=_0x310cd5){_0x49de75=_0x310cd5;_0x5e09dd=0xc8;}else{_0x5e09dd=0xce;}_0x5ea395['status'](_0x5e09dd);return _0x5ea395[_0xf0c0('0x1f')]('Content-Range',_0x3f21e3+'-'+_0x49de75+'/'+_0x310cd5)[_0xf0c0('0x1b')](_0x3c3538);}return null;};}function patchUpdates(_0x3e6e93){return function(_0x15b40a){try{jsonpatch[_0xf0c0('0x20')](_0x15b40a,_0x3e6e93,!![]);}catch(_0x546d51){return BPromise[_0xf0c0('0x21')](_0x546d51);}return _0x15b40a[_0xf0c0('0x22')]();};}function saveUpdates(_0x737ab2,_0x58659c){return function(_0x5ce35b){if(_0x5ce35b){return _0x5ce35b['update'](_0x737ab2)[_0xf0c0('0x23')](function(_0x3191b1){return _0x3191b1;});}return null;};}function removeEntity(_0x55164e,_0xb8c03b){return function(_0x179570){if(_0x179570){return _0x179570[_0xf0c0('0x24')]()[_0xf0c0('0x23')](function(){var _0xa08d8=_0x179570[_0xf0c0('0x25')]({'plain':!![]});var _0x12cdb9=_0xf0c0('0x26');return db[_0xf0c0('0x27')][_0xf0c0('0x24')]({'where':{'type':_0x12cdb9,'resourceId':_0xa08d8['id']}})['then'](function(){return _0x179570;});})[_0xf0c0('0x23')](function(){_0x55164e['status'](0xcc)[_0xf0c0('0x1a')]();});}};}function handleEntityNotFound(_0x2e48ba,_0x508ef6){return function(_0x54f762){if(!_0x54f762){_0x2e48ba[_0xf0c0('0x18')](0x194);}return _0x54f762;};}function handleError(_0x283667,_0x1cfb06){_0x1cfb06=_0x1cfb06||0x1f4;return function(_0x47d309){logger[_0xf0c0('0x28')](_0x47d309[_0xf0c0('0x29')]);if(_0x47d309['name']){delete _0x47d309[_0xf0c0('0x2a')];}_0x283667[_0xf0c0('0x19')](_0x1cfb06)['send'](_0x47d309);};}exports[_0xf0c0('0x2b')]=function(_0x54beba,_0x5bd8bc){var _0x150cb6={},_0x55145b={},_0x3ba02e={'count':0x0,'rows':[]};var _0x2eb15e=_[_0xf0c0('0x2c')](db[_0xf0c0('0x2d')][_0xf0c0('0x2e')],function(_0x237d73){return{'name':_0x237d73['fieldName'],'type':_0x237d73[_0xf0c0('0x2f')][_0xf0c0('0x30')]};});_0x55145b[_0xf0c0('0x31')]=_[_0xf0c0('0x2c')](_0x2eb15e,_0xf0c0('0x2a'));_0x55145b[_0xf0c0('0x32')]=_[_0xf0c0('0x33')](_0x54beba[_0xf0c0('0x32')]);_0x55145b['filters']=_[_0xf0c0('0x34')](_0x55145b[_0xf0c0('0x31')],_0x55145b[_0xf0c0('0x32')]);_0x150cb6[_0xf0c0('0x35')]=_['intersection'](_0x55145b[_0xf0c0('0x31')],qs[_0xf0c0('0x36')](_0x54beba[_0xf0c0('0x32')]['fields']));_0x150cb6[_0xf0c0('0x35')]=_0x150cb6[_0xf0c0('0x35')][_0xf0c0('0x37')]?_0x150cb6[_0xf0c0('0x35')]:_0x55145b[_0xf0c0('0x31')];if(!_0x54beba[_0xf0c0('0x32')][_0xf0c0('0x38')](_0xf0c0('0x39'))){_0x150cb6[_0xf0c0('0x1e')]=qs[_0xf0c0('0x1e')](_0x54beba[_0xf0c0('0x32')][_0xf0c0('0x1e')]);_0x150cb6['offset']=qs[_0xf0c0('0x1d')](_0x54beba[_0xf0c0('0x32')][_0xf0c0('0x1d')]);}_0x150cb6[_0xf0c0('0x3a')]=qs[_0xf0c0('0x3b')](_0x54beba[_0xf0c0('0x32')][_0xf0c0('0x3b')]);_0x150cb6[_0xf0c0('0x3c')]=qs[_0xf0c0('0x3d')](_[_0xf0c0('0x3e')](_0x54beba[_0xf0c0('0x32')],_0x55145b['filters']),_0x2eb15e);if(_0x54beba[_0xf0c0('0x32')]['filter']){_0x150cb6['where']=_[_0xf0c0('0x3f')](_0x150cb6[_0xf0c0('0x3c')],{'$or':_[_0xf0c0('0x2c')](_0x2eb15e,function(_0x537216){if(_0x537216[_0xf0c0('0x2f')]!==_0xf0c0('0x40')){var _0x334ad0={};_0x334ad0[_0x537216[_0xf0c0('0x2a')]]={'$like':'%'+_0x54beba['query'][_0xf0c0('0x41')]+'%'};return _0x334ad0;}})});}_0x150cb6=_['merge']({},_0x150cb6,_0x54beba['options']);var _0xf68166={'where':_0x150cb6[_0xf0c0('0x3c')]};return db[_0xf0c0('0x2d')][_0xf0c0('0x1c')](_0xf68166)[_0xf0c0('0x23')](function(_0x476aef){_0x3ba02e[_0xf0c0('0x1c')]=_0x476aef;if(_0x54beba['query'][_0xf0c0('0x42')]){_0x150cb6[_0xf0c0('0x43')]=[{'all':!![]}];}return db[_0xf0c0('0x2d')][_0xf0c0('0x44')](_0x150cb6);})[_0xf0c0('0x23')](function(_0x1e2224){_0x3ba02e[_0xf0c0('0x45')]=_0x1e2224;return _0x3ba02e;})[_0xf0c0('0x23')](respondWithFilteredResult(_0x5bd8bc,_0x150cb6))[_0xf0c0('0x46')](handleError(_0x5bd8bc,null));};exports[_0xf0c0('0x47')]=function(_0x5d9ac0,_0x4d2f11){var _0x2d84ce={'raw':!![],'where':{'id':_0x5d9ac0['params']['id']}},_0x5cc431={};_0x5cc431[_0xf0c0('0x31')]=_[_0xf0c0('0x33')](db[_0xf0c0('0x2d')][_0xf0c0('0x2e')]);_0x5cc431[_0xf0c0('0x32')]=_['keys'](_0x5d9ac0[_0xf0c0('0x32')]);_0x5cc431[_0xf0c0('0x3d')]=_['intersection'](_0x5cc431[_0xf0c0('0x31')],_0x5cc431['query']);_0x2d84ce[_0xf0c0('0x35')]=_['intersection'](_0x5cc431['model'],qs[_0xf0c0('0x36')](_0x5d9ac0[_0xf0c0('0x32')][_0xf0c0('0x36')]));_0x2d84ce['attributes']=_0x2d84ce['attributes'][_0xf0c0('0x37')]?_0x2d84ce['attributes']:_0x5cc431[_0xf0c0('0x31')];if(_0x5d9ac0['query']['includeAll']){_0x2d84ce['include']=[{'all':!![]}];}_0x2d84ce=_[_0xf0c0('0x3f')]({},_0x2d84ce,_0x5d9ac0[_0xf0c0('0x48')]);return db['Interval'][_0xf0c0('0x49')](_0x2d84ce)['then'](handleEntityNotFound(_0x4d2f11,null))[_0xf0c0('0x23')](respondWithResult(_0x4d2f11,null))[_0xf0c0('0x46')](handleError(_0x4d2f11,null));};exports['create']=function(_0x338939,_0x1dc521){return db['Interval'][_0xf0c0('0x4a')](_0x338939['body'],{})['then'](function(_0x228c36){var _0x1f9444=_0x338939['user'][_0xf0c0('0x25')]({'plain':!![]});if(!_0x1f9444)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f9444[_0xf0c0('0x4b')]===_0xf0c0('0x4c')){var _0x471927=_0x228c36[_0xf0c0('0x25')]({'plain':!![]});var _0x1648df=_0xf0c0('0x26');return db[_0xf0c0('0x4d')][_0xf0c0('0x49')]({'where':{'name':_0x1648df,'userProfileId':_0x1f9444[_0xf0c0('0x4e')]},'raw':!![]})[_0xf0c0('0x23')](function(_0x337ac4){if(_0x337ac4&&_0x337ac4['autoAssociation']===0x0){return db[_0xf0c0('0x27')][_0xf0c0('0x4a')]({'name':_0x471927[_0xf0c0('0x2a')],'resourceId':_0x471927['id'],'type':_0x337ac4[_0xf0c0('0x2a')],'sectionId':_0x337ac4['id']},{})[_0xf0c0('0x23')](function(){return _0x228c36;});}else{return _0x228c36;}})['catch'](function(_0xeb4532){logger[_0xf0c0('0x28')](_0xf0c0('0x4f'),_0xeb4532);throw _0xeb4532;});}return _0x228c36;})[_0xf0c0('0x23')](respondWithResult(_0x1dc521,0xc9))[_0xf0c0('0x46')](handleError(_0x1dc521,null));};exports[_0xf0c0('0x50')]=function(_0x4ce1b4,_0x2cd2fc){if(_0x4ce1b4[_0xf0c0('0x51')]['id']){delete _0x4ce1b4['body']['id'];}return db[_0xf0c0('0x2d')][_0xf0c0('0x49')]({'where':{'id':_0x4ce1b4['params']['id']}})[_0xf0c0('0x23')](handleEntityNotFound(_0x2cd2fc,null))[_0xf0c0('0x23')](saveUpdates(_0x4ce1b4['body'],null))[_0xf0c0('0x23')](respondWithResult(_0x2cd2fc,null))[_0xf0c0('0x46')](handleError(_0x2cd2fc,null));};exports['destroy']=function(_0x59892c,_0x5154df){return db[_0xf0c0('0x2d')][_0xf0c0('0x49')]({'where':{'id':_0x59892c[_0xf0c0('0x52')]['id']}})[_0xf0c0('0x23')](handleEntityNotFound(_0x5154df,null))[_0xf0c0('0x23')](removeEntity(_0x5154df,null))['catch'](handleError(_0x5154df,null));};exports[_0xf0c0('0x53')]=function(_0x2e6cf5,_0x33fd54,_0x443555){if(_0x2e6cf5[_0xf0c0('0x51')]['id']){delete _0x2e6cf5['body']['id'];}return db[_0xf0c0('0x2d')][_0xf0c0('0x49')]({'where':{'id':_0x2e6cf5[_0xf0c0('0x52')]['id']}})['then'](handleEntityNotFound(_0x33fd54,null))[_0xf0c0('0x23')](function(_0x23fcb0){if(_0x23fcb0){_0x2e6cf5[_0xf0c0('0x51')]['IntervalId']=_0x23fcb0['id'];return db[_0xf0c0('0x2d')]['create'](_0x2e6cf5[_0xf0c0('0x51')]);}})['then'](respondWithResult(_0x33fd54,null))[_0xf0c0('0x46')](handleError(_0x33fd54,null));};exports[_0xf0c0('0x54')]=function(_0x42443d,_0x4ae27f,_0x488b7d){var _0x3cffcf={};var _0x4ec0d2={};var _0x4bc26e;var _0x481870;return db['Interval'][_0xf0c0('0x55')]({'where':{'id':_0x42443d[_0xf0c0('0x52')]['id']}})[_0xf0c0('0x23')](handleEntityNotFound(_0x4ae27f,null))[_0xf0c0('0x23')](function(_0x798e82){if(_0x798e82){_0x4bc26e=_0x798e82;_0x4ec0d2[_0xf0c0('0x31')]=_['keys'](db[_0xf0c0('0x2d')]['rawAttributes']);_0x4ec0d2['query']=_[_0xf0c0('0x33')](_0x42443d[_0xf0c0('0x32')]);_0x4ec0d2['filters']=_[_0xf0c0('0x34')](_0x4ec0d2[_0xf0c0('0x31')],_0x4ec0d2[_0xf0c0('0x32')]);_0x3cffcf[_0xf0c0('0x35')]=_[_0xf0c0('0x34')](_0x4ec0d2['model'],qs[_0xf0c0('0x36')](_0x42443d[_0xf0c0('0x32')][_0xf0c0('0x36')]));_0x3cffcf[_0xf0c0('0x35')]=_0x3cffcf[_0xf0c0('0x35')][_0xf0c0('0x37')]?_0x3cffcf[_0xf0c0('0x35')]:_0x4ec0d2[_0xf0c0('0x31')];_0x3cffcf[_0xf0c0('0x3a')]=qs[_0xf0c0('0x3b')](_0x42443d[_0xf0c0('0x32')][_0xf0c0('0x3b')]);_0x3cffcf[_0xf0c0('0x3c')]=qs['filters'](_[_0xf0c0('0x3e')](_0x42443d[_0xf0c0('0x32')],_0x4ec0d2[_0xf0c0('0x3d')]));if(_0x42443d[_0xf0c0('0x32')][_0xf0c0('0x41')]){_0x3cffcf[_0xf0c0('0x3c')]=_['merge'](_0x3cffcf[_0xf0c0('0x3c')],{'$or':_['map'](_0x3cffcf[_0xf0c0('0x35')],function(_0x407299){var _0x27584d={};_0x27584d[_0x407299]={'$like':'%'+_0x42443d[_0xf0c0('0x32')]['filter']+'%'};return _0x27584d;})});}_0x3cffcf=_[_0xf0c0('0x3f')]({},_0x3cffcf,_0x42443d[_0xf0c0('0x48')]);return _0x4bc26e[_0xf0c0('0x54')](_0x3cffcf);}})['then'](function(_0x4916d3){if(_0x4916d3){_0x481870=_0x4916d3[_0xf0c0('0x37')];if(!_0x42443d[_0xf0c0('0x32')][_0xf0c0('0x38')]('nolimit')){_0x3cffcf[_0xf0c0('0x1e')]=qs[_0xf0c0('0x1e')](_0x42443d['query'][_0xf0c0('0x1e')]);_0x3cffcf['offset']=qs[_0xf0c0('0x1d')](_0x42443d[_0xf0c0('0x32')][_0xf0c0('0x1d')]);}return _0x4bc26e['getIntervals'](_0x3cffcf);}})[_0xf0c0('0x23')](function(_0x472d0c){if(_0x472d0c){return _0x472d0c?{'count':_0x481870,'rows':_0x472d0c}:null;}})[_0xf0c0('0x23')](respondWithResult(_0x4ae27f,null))[_0xf0c0('0x46')](handleError(_0x4ae27f,null));};exports[_0xf0c0('0x56')]=function(_0xfbed7b,_0x4d01f5,_0x1d289f){return db[_0xf0c0('0x2d')][_0xf0c0('0x55')]({'where':{'id':_0xfbed7b[_0xf0c0('0x52')]['id']}})[_0xf0c0('0x23')](handleEntityNotFound(_0x4d01f5,null))[_0xf0c0('0x23')](function(_0x509b04){if(_0x509b04){return db[_0xf0c0('0x57')]['transaction'](function(_0x3de059){return db['Interval'][_0xf0c0('0x24')]({'where':{'IntervalId':_0xfbed7b[_0xf0c0('0x52')]['id']},'transaction':_0x3de059})[_0xf0c0('0x23')](function(_0x371fe8){var _0x2e5617=_[_0xf0c0('0x2c')](_0xfbed7b[_0xf0c0('0x51')],function(_0x40ca17){delete _0x40ca17['id'];_0x40ca17[_0xf0c0('0x58')]=_0xfbed7b[_0xf0c0('0x52')]['id'];return _0x40ca17;});return db['Interval'][_0xf0c0('0x59')](_0x2e5617,{'transaction':_0x3de059});});})['then'](function(){return db['Interval'][_0xf0c0('0x44')]({'where':{'IntervalId':_0xfbed7b[_0xf0c0('0x52')]['id']}});});}})['then'](respondWithResult(_0x4d01f5,null))['catch'](handleError(_0x4d01f5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0b77937..d43c2b5 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 _0x8aa7=['tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8aa7,0xb6));var _0x78aa=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x8aa7[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var fs=require('fs');var path=require(_0x78aa('0x6'));var rimraf=require('rimraf');var config=require(_0x78aa('0x7'));var attributes=require(_0x78aa('0x8'));var extensions=require(_0x78aa('0x9'));module[_0x78aa('0xa')]=function(_0x2d17c2,_0x369ee7){return _0x2d17c2[_0x78aa('0xb')](_0x78aa('0xc'),attributes,{'tableName':_0x78aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x460488,_0x1da0ad){extensions[_0x78aa('0xe')](_0x2d17c2,_0x460488);},'afterBulkCreate':function(_0x45d377,_0x41e196,_0x357ab1){_0x357ab1();extensions[_0x78aa('0xe')](_0x2d17c2,_0x45d377[0x0]);},'afterUpdate':function(_0x3df85c,_0x3b7690){extensions[_0x78aa('0xe')](_0x2d17c2,_0x3df85c);},'afterDestroy':function(_0x522c95,_0x57855b){extensions[_0x78aa('0xe')](_0x2d17c2,_0x522c95);}}});}; \ No newline at end of file +var _0xbf82=['bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','../../config/logger','moment'];(function(_0x4e51ca,_0x16d1cf){var _0x46d403=function(_0x1adc0f){while(--_0x1adc0f){_0x4e51ca['push'](_0x4e51ca['shift']());}};_0x46d403(++_0x16d1cf);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x5cf3b9,_0x153316){_0x5cf3b9=_0x5cf3b9-0x0;var _0x3c13e3=_0xbf82[_0x5cf3b9];return _0x3c13e3;};'use strict';var _=require(_0x2bf8('0x0'));var util=require('util');var logger=require(_0x2bf8('0x1'))('api');var moment=require(_0x2bf8('0x2'));var BPromise=require(_0x2bf8('0x3'));var rp=require(_0x2bf8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2bf8('0x5'));var attributes=require(_0x2bf8('0x6'));var extensions=require(_0x2bf8('0x7'));module[_0x2bf8('0x8')]=function(_0x19d402,_0x5a3818){return _0x19d402['define'](_0x2bf8('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x130e6d,_0x386c2d){extensions[_0x2bf8('0xa')](_0x19d402,_0x130e6d);},'afterBulkCreate':function(_0x596d31,_0x2b7a76,_0x415db1){_0x415db1();extensions[_0x2bf8('0xa')](_0x19d402,_0x596d31[0x0]);},'afterUpdate':function(_0x35b1aa,_0x2002e3){extensions[_0x2bf8('0xa')](_0x19d402,_0x35b1aa);},'afterDestroy':function(_0x14e105,_0x2d49b8){extensions[_0x2bf8('0xa')](_0x19d402,_0x14e105);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4dcd986..accc63a 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 _0xd194=['Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetInterval','Interval','findAll','options','where','limit','map','include','model','attributes','catch','ShowInterval','find','raw','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x41289a,_0x4ec2b0){var _0x7e87b8=function(_0xe90c5f){while(--_0xe90c5f){_0x41289a['push'](_0x41289a['shift']());}};_0x7e87b8(++_0x4ec2b0);}(_0xd194,0x1a3));var _0x4d19=function(_0x4cef09,_0x5c4c67){_0x4cef09=_0x4cef09-0x0;var _0x83d8e5=_0xd194[_0x4cef09];return _0x83d8e5;};'use strict';var _=require('lodash');var util=require(_0x4d19('0x0'));var moment=require(_0x4d19('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d19('0x2'));var fs=require('fs');var Redis=require(_0x4d19('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d19('0x4'))(_0x4d19('0x5'));var config=require(_0x4d19('0x6'));var jayson=require(_0x4d19('0x7'));var client=jayson[_0x4d19('0x8')][_0x4d19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38b90f,_0x38c868,_0x437b09){return new BPromise(function(_0x2ca492,_0x5aed58){return client[_0x4d19('0xa')](_0x38b90f,_0x437b09)[_0x4d19('0xb')](function(_0x3f3ca8){logger[_0x4d19('0xc')](_0x4d19('0xd'),_0x38c868,_0x4d19('0xe'));logger[_0x4d19('0xf')](_0x4d19('0x10'),_0x38c868,'request\x20sent',JSON[_0x4d19('0x11')](_0x3f3ca8));if(_0x3f3ca8[_0x4d19('0x12')]){if(_0x3f3ca8[_0x4d19('0x12')][_0x4d19('0x13')]===0x1f4){logger[_0x4d19('0x12')](_0x4d19('0xd'),_0x38c868,_0x3f3ca8[_0x4d19('0x12')][_0x4d19('0x14')]);return _0x5aed58(_0x3f3ca8['error'][_0x4d19('0x14')]);}logger[_0x4d19('0x12')](_0x4d19('0xd'),_0x38c868,_0x3f3ca8['error'][_0x4d19('0x14')]);return _0x2ca492(_0x3f3ca8[_0x4d19('0x12')][_0x4d19('0x14')]);}else{logger['info'](_0x4d19('0xd'),_0x38c868,'request\x20sent');_0x2ca492(_0x3f3ca8[_0x4d19('0x15')][_0x4d19('0x14')]);}})['catch'](function(_0x125e04){logger[_0x4d19('0x12')](_0x4d19('0xd'),_0x38c868,_0x125e04);_0x5aed58(_0x125e04);});});}exports[_0x4d19('0x16')]=function(_0x3f4734){var _0x241774=this;return new Promise(function(_0x3c4b04,_0x301c82){return db[_0x4d19('0x17')][_0x4d19('0x18')]({'raw':_0x3f4734[_0x4d19('0x19')]?_0x3f4734[_0x4d19('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4734[_0x4d19('0x19')]?_0x3f4734[_0x4d19('0x19')][_0x4d19('0x1a')]||null:null,'attributes':_0x3f4734[_0x4d19('0x19')]?_0x3f4734[_0x4d19('0x19')]['attributes']||null:null,'limit':_0x3f4734[_0x4d19('0x19')]?_0x3f4734[_0x4d19('0x19')][_0x4d19('0x1b')]||null:null,'include':_0x3f4734[_0x4d19('0x19')]?_0x3f4734[_0x4d19('0x19')]['include']?_[_0x4d19('0x1c')](_0x3f4734[_0x4d19('0x19')][_0x4d19('0x1d')],function(_0x52cc3b){return{'model':db[_0x52cc3b[_0x4d19('0x1e')]],'as':_0x52cc3b['as'],'attributes':_0x52cc3b['attributes'],'include':_0x52cc3b[_0x4d19('0x1d')]?_[_0x4d19('0x1c')](_0x52cc3b[_0x4d19('0x1d')],function(_0x1c0a1a){return{'model':db[_0x1c0a1a[_0x4d19('0x1e')]],'as':_0x1c0a1a['as'],'attributes':_0x1c0a1a[_0x4d19('0x1f')],'include':_0x1c0a1a['include']?_[_0x4d19('0x1c')](_0x1c0a1a[_0x4d19('0x1d')],function(_0x4d4fa0){return{'model':db[_0x4d4fa0[_0x4d19('0x1e')]],'as':_0x4d4fa0['as'],'attributes':_0x4d4fa0[_0x4d19('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4d19('0xb')](function(_0x5a8a54){logger['info'](_0x4d19('0x16'),_0x3f4734);logger[_0x4d19('0xf')](_0x4d19('0x16'),_0x3f4734,JSON['stringify'](_0x5a8a54));_0x3c4b04(_0x5a8a54);})[_0x4d19('0x20')](function(_0x5097c4){logger['error'](_0x4d19('0x16'),_0x5097c4[_0x4d19('0x14')],_0x3f4734);_0x301c82(_0x241774[_0x4d19('0x12')](0x1f4,_0x5097c4[_0x4d19('0x14')]));});});};exports[_0x4d19('0x21')]=function(_0x2a8559){var _0x2c63ca=this;return new Promise(function(_0x5814a1,_0xf3f041){return db[_0x4d19('0x17')][_0x4d19('0x22')]({'raw':_0x2a8559[_0x4d19('0x19')]?_0x2a8559[_0x4d19('0x19')][_0x4d19('0x23')]===undefined?!![]:![]:!![],'where':_0x2a8559[_0x4d19('0x19')]?_0x2a8559['options'][_0x4d19('0x1a')]||null:null,'attributes':_0x2a8559[_0x4d19('0x19')]?_0x2a8559[_0x4d19('0x19')][_0x4d19('0x1f')]||null:null,'include':_0x2a8559[_0x4d19('0x19')]?_0x2a8559['options'][_0x4d19('0x1d')]?_['map'](_0x2a8559[_0x4d19('0x19')]['include'],function(_0x399ba0){return{'model':db[_0x399ba0[_0x4d19('0x1e')]],'as':_0x399ba0['as'],'attributes':_0x399ba0['attributes'],'include':_0x399ba0[_0x4d19('0x1d')]?_['map'](_0x399ba0[_0x4d19('0x1d')],function(_0x1d7c76){return{'model':db[_0x1d7c76['model']],'as':_0x1d7c76['as'],'attributes':_0x1d7c76[_0x4d19('0x1f')],'include':_0x1d7c76[_0x4d19('0x1d')]?_['map'](_0x1d7c76['include'],function(_0x31e70c){return{'model':db[_0x31e70c[_0x4d19('0x1e')]],'as':_0x31e70c['as'],'attributes':_0x31e70c[_0x4d19('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4d19('0xb')](function(_0x10204d){logger['info']('ShowInterval',_0x2a8559);logger[_0x4d19('0xf')](_0x4d19('0x21'),_0x2a8559,JSON[_0x4d19('0x11')](_0x10204d));_0x5814a1(_0x10204d);})[_0x4d19('0x20')](function(_0x449ba0){logger[_0x4d19('0x12')](_0x4d19('0x21'),_0x449ba0[_0x4d19('0x14')],_0x2a8559);_0xf3f041(_0x2c63ca[_0x4d19('0x12')](0x1f4,_0x449ba0[_0x4d19('0x14')]));});});}; \ No newline at end of file +var _0x5100=['http','request','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','GetInterval','Interval','find','ShowInterval','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1cd186,_0x39eae0){var _0x5a2ad3=function(_0x4723d4){while(--_0x4723d4){_0x1cd186['push'](_0x1cd186['shift']());}};_0x5a2ad3(++_0x39eae0);}(_0x5100,0x181));var _0x0510=function(_0xdedf24,_0x178f8d){_0xdedf24=_0xdedf24-0x0;var _0x209ca4=_0x5100[_0xdedf24];return _0x209ca4;};'use strict';var _=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var moment=require('moment');var BPromise=require(_0x0510('0x2'));var rs=require(_0x0510('0x3'));var fs=require('fs');var Redis=require(_0x0510('0x4'));var db=require(_0x0510('0x5'))['db'];var utils=require(_0x0510('0x6'));var logger=require(_0x0510('0x7'))(_0x0510('0x8'));var config=require(_0x0510('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0510('0xa')][_0x0510('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaac054,_0x2fbf46,_0x414de2){return new BPromise(function(_0x246fe1,_0x4827ee){return client[_0x0510('0xc')](_0xaac054,_0x414de2)['then'](function(_0x1987ac){logger[_0x0510('0xd')](_0x0510('0xe'),_0x2fbf46,_0x0510('0xf'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x2fbf46,'request\x20sent',JSON[_0x0510('0x10')](_0x1987ac));if(_0x1987ac['error']){if(_0x1987ac[_0x0510('0x11')][_0x0510('0x12')]===0x1f4){logger['error'](_0x0510('0xe'),_0x2fbf46,_0x1987ac[_0x0510('0x11')][_0x0510('0x13')]);return _0x4827ee(_0x1987ac[_0x0510('0x11')]['message']);}logger[_0x0510('0x11')](_0x0510('0xe'),_0x2fbf46,_0x1987ac['error'][_0x0510('0x13')]);return _0x246fe1(_0x1987ac[_0x0510('0x11')]['message']);}else{logger[_0x0510('0xd')](_0x0510('0xe'),_0x2fbf46,_0x0510('0xf'));_0x246fe1(_0x1987ac['result'][_0x0510('0x13')]);}})[_0x0510('0x14')](function(_0x46486d){logger[_0x0510('0x11')](_0x0510('0xe'),_0x2fbf46,_0x46486d);_0x4827ee(_0x46486d);});});}exports['GetInterval']=function(_0x446dee){var _0x1eddb0=this;return new Promise(function(_0x13aebd,_0x4b51ea){return db['Interval'][_0x0510('0x15')]({'raw':_0x446dee['options']?_0x446dee[_0x0510('0x16')][_0x0510('0x17')]===undefined?!![]:![]:!![],'where':_0x446dee['options']?_0x446dee['options'][_0x0510('0x18')]||null:null,'attributes':_0x446dee['options']?_0x446dee[_0x0510('0x16')][_0x0510('0x19')]||null:null,'limit':_0x446dee['options']?_0x446dee['options'][_0x0510('0x1a')]||null:null,'include':_0x446dee['options']?_0x446dee[_0x0510('0x16')][_0x0510('0x1b')]?_[_0x0510('0x1c')](_0x446dee['options'][_0x0510('0x1b')],function(_0x57f58e){return{'model':db[_0x57f58e['model']],'as':_0x57f58e['as'],'attributes':_0x57f58e[_0x0510('0x19')],'include':_0x57f58e[_0x0510('0x1b')]?_[_0x0510('0x1c')](_0x57f58e['include'],function(_0x18e026){return{'model':db[_0x18e026['model']],'as':_0x18e026['as'],'attributes':_0x18e026['attributes'],'include':_0x18e026[_0x0510('0x1b')]?_[_0x0510('0x1c')](_0x18e026['include'],function(_0x3eba22){return{'model':db[_0x3eba22[_0x0510('0x1d')]],'as':_0x3eba22['as'],'attributes':_0x3eba22[_0x0510('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0510('0x1e')](function(_0x4c580d){logger[_0x0510('0xd')]('GetInterval',_0x446dee);logger[_0x0510('0x1f')](_0x0510('0x20'),_0x446dee,JSON[_0x0510('0x10')](_0x4c580d));_0x13aebd(_0x4c580d);})['catch'](function(_0x267175){logger[_0x0510('0x11')](_0x0510('0x20'),_0x267175[_0x0510('0x13')],_0x446dee);_0x4b51ea(_0x1eddb0[_0x0510('0x11')](0x1f4,_0x267175[_0x0510('0x13')]));});});};exports['ShowInterval']=function(_0x4e8006){var _0x2f9114=this;return new Promise(function(_0x457da4,_0x57cf03){return db[_0x0510('0x21')][_0x0510('0x22')]({'raw':_0x4e8006[_0x0510('0x16')]?_0x4e8006[_0x0510('0x16')][_0x0510('0x17')]===undefined?!![]:![]:!![],'where':_0x4e8006[_0x0510('0x16')]?_0x4e8006[_0x0510('0x16')][_0x0510('0x18')]||null:null,'attributes':_0x4e8006['options']?_0x4e8006[_0x0510('0x16')]['attributes']||null:null,'include':_0x4e8006['options']?_0x4e8006[_0x0510('0x16')][_0x0510('0x1b')]?_[_0x0510('0x1c')](_0x4e8006['options'][_0x0510('0x1b')],function(_0x6d0f75){return{'model':db[_0x6d0f75['model']],'as':_0x6d0f75['as'],'attributes':_0x6d0f75[_0x0510('0x19')],'include':_0x6d0f75['include']?_['map'](_0x6d0f75['include'],function(_0x43c184){return{'model':db[_0x43c184['model']],'as':_0x43c184['as'],'attributes':_0x43c184[_0x0510('0x19')],'include':_0x43c184[_0x0510('0x1b')]?_['map'](_0x43c184[_0x0510('0x1b')],function(_0x59f332){return{'model':db[_0x59f332[_0x0510('0x1d')]],'as':_0x59f332['as'],'attributes':_0x59f332['attributes']};}):[]};}):[]};}):[]:[]})[_0x0510('0x1e')](function(_0x34de88){logger[_0x0510('0xd')](_0x0510('0x23'),_0x4e8006);logger[_0x0510('0x1f')](_0x0510('0x23'),_0x4e8006,JSON['stringify'](_0x34de88));_0x457da4(_0x34de88);})[_0x0510('0x14')](function(_0x242001){logger[_0x0510('0x11')]('ShowInterval',_0x242001['message'],_0x4e8006);_0x57cf03(_0x2f9114[_0x0510('0x11')](0x1f4,_0x242001[_0x0510('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index df8917d..2b7ce1a 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 _0x556a=['post','isAuthenticated','send','exports','../../components/auth/service'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x556a,0x14e));var _0xa556=function(_0x4ee7fd,_0x95f420){_0x4ee7fd=_0x4ee7fd-0x0;var _0xe318c5=_0x556a[_0x4ee7fd];return _0xe318c5;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa556('0x0'));var controller=require('./jira.controller');router[_0xa556('0x1')]('/',auth[_0xa556('0x2')](),controller[_0xa556('0x3')]);module[_0xa556('0x4')]=router; \ No newline at end of file +var _0x6f46=['send','exports','express','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x2135a8,_0x2d5706){var _0x3dd593=function(_0x3c4c5d){while(--_0x3c4c5d){_0x2135a8['push'](_0x2135a8['shift']());}};_0x3dd593(++_0x2d5706);}(_0x6f46,0xb8));var _0x66f4=function(_0x306236,_0x5e017d){_0x306236=_0x306236-0x0;var _0x5be028=_0x6f46[_0x306236];return _0x5be028;};'use strict';var express=require(_0x66f4('0x0'));var router=express['Router']();var auth=require(_0x66f4('0x1'));var controller=require(_0x66f4('0x2'));router[_0x66f4('0x3')]('/',auth[_0x66f4('0x4')](),controller[_0x66f4('0x5')]);module[_0x66f4('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7871031..520d2e8 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 _0xb17e=['write','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','support','key','Report','\x20from\x20','description','Bug','customfield_11500','fields','oldToken','customfield_11502','customfield_11503','name','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','setEncoding','utf8','end','status','json','parse','error','api.jira'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb17e,0x10a));var _0xeb17=function(_0x3ba037,_0x690059){_0x3ba037=_0x3ba037-0x0;var _0x19ab9d=_0xb17e[_0x3ba037];return _0x19ab9d;};'use strict';var BPromise=require(_0xeb17('0x0'));var https=require(_0xeb17('0x1'));var logger=require('../../config/logger')(_0xeb17('0x2'));var USERNAME=_0xeb17('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5bfa21,_0x54a728){var _0x1fde05={'fields':{'project':{'key':_0x5bfa21[_0xeb17('0x4')]||'MOTGUI'},'summary':(_0x5bfa21['summary']||_0xeb17('0x5'))+_0xeb17('0x6')+_0x5bfa21['ip'],'description':_0x5bfa21[_0xeb17('0x7')]||JSON['stringify'](_0x5bfa21),'issuetype':{'name':_0x5bfa21['issuetype']||_0xeb17('0x8')}}};_0x1fde05['fields'][_0xeb17('0x9')]=_0x5bfa21['email'];_0x1fde05[_0xeb17('0xa')]['customfield_11501']=_0x5bfa21[_0xeb17('0xb')];_0x1fde05[_0xeb17('0xa')][_0xeb17('0xc')]=_0x5bfa21['newToken'];_0x1fde05[_0xeb17('0xa')][_0xeb17('0xd')]=_0x5bfa21[_0xeb17('0xe')];_0x1fde05[_0xeb17('0xa')]['customfield_11504']=_0x5bfa21['reason'];_0x1fde05[_0xeb17('0xa')]['customfield_10102']=_0x5bfa21['ip'];var _0x178594={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xeb17('0xf'),'method':_0xeb17('0x10'),'timeout':0x4e20,'headers':{'Content-Type':_0xeb17('0x11'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xeb17('0x12')](_0xeb17('0x13'))}};var _0x2237ac=JSON[_0xeb17('0x14')](_0x1fde05);var _0x6c4262=https[_0xeb17('0x15')](_0x178594,function(_0x20449f){_0x20449f[_0xeb17('0x16')](_0xeb17('0x17'));var _0x28f0e5='';_0x20449f['on']('data',function(_0x4f4bb7){_0x28f0e5+=_0x4f4bb7;});_0x20449f['on'](_0xeb17('0x18'),function(){if(_0x54a728){return _0x54a728[_0xeb17('0x19')](_0x20449f['statusCode'])[_0xeb17('0x1a')](JSON[_0xeb17('0x1b')](_0x28f0e5));}});});_0x6c4262['on'](_0xeb17('0x1c'),function(_0x456d70){if(_0x54a728){return _0x54a728[_0xeb17('0x19')](0x1f4)[_0xeb17('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xeb17('0x1d')}]});}});_0x6c4262[_0xeb17('0x1e')](_0x2237ac);_0x6c4262['end']();}exports['openIssue']=openIssue;exports[_0xeb17('0x1f')]=function(_0x210093,_0x706ad9){_0x210093[_0xeb17('0x20')]['ip']=_0x210093['headers'][_0xeb17('0x21')]||_0x210093['connection'][_0xeb17('0x22')]||_0x210093[_0xeb17('0x23')]['remoteAddress']||_0x210093[_0xeb17('0x24')][_0xeb17('0x23')][_0xeb17('0x22')];return openIssue(_0x210093[_0xeb17('0x20')],_0x706ad9);}; \ No newline at end of file +var _0x2536=['customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','x-forwarded-for','remoteAddress','socket','connection','body','https','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email'];(function(_0x18acd4,_0x4ad139){var _0x27b2c3=function(_0x283339){while(--_0x283339){_0x18acd4['push'](_0x18acd4['shift']());}};_0x27b2c3(++_0x4ad139);}(_0x2536,0xc4));var _0x6253=function(_0x219dff,_0x2a6e38){_0x219dff=_0x219dff-0x0;var _0x1a163d=_0x2536[_0x219dff];return _0x1a163d;};'use strict';var BPromise=require('bluebird');var https=require(_0x6253('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0x6253('0x1');var PASSWORD=_0x6253('0x2');function openIssue(_0x2f4071,_0x4df1e8){var _0x3d801e={'fields':{'project':{'key':_0x2f4071['key']||_0x6253('0x3')},'summary':(_0x2f4071[_0x6253('0x4')]||_0x6253('0x5'))+_0x6253('0x6')+_0x2f4071['ip'],'description':_0x2f4071[_0x6253('0x7')]||JSON[_0x6253('0x8')](_0x2f4071),'issuetype':{'name':_0x2f4071[_0x6253('0x9')]||_0x6253('0xa')}}};_0x3d801e[_0x6253('0xb')][_0x6253('0xc')]=_0x2f4071[_0x6253('0xd')];_0x3d801e[_0x6253('0xb')][_0x6253('0xe')]=_0x2f4071['oldToken'];_0x3d801e[_0x6253('0xb')][_0x6253('0xf')]=_0x2f4071[_0x6253('0x10')];_0x3d801e['fields'][_0x6253('0x11')]=_0x2f4071[_0x6253('0x12')];_0x3d801e[_0x6253('0xb')][_0x6253('0x13')]=_0x2f4071[_0x6253('0x14')];_0x3d801e['fields'][_0x6253('0x15')]=_0x2f4071['ip'];var _0x3c6b44={'host':_0x6253('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6253('0x17')](_0x6253('0x18'))}};var _0x3d7a7c=JSON[_0x6253('0x8')](_0x3d801e);var _0x3259b7=https['request'](_0x3c6b44,function(_0x368778){_0x368778[_0x6253('0x19')](_0x6253('0x1a'));var _0x38c7bb='';_0x368778['on'](_0x6253('0x1b'),function(_0x2cdb8b){_0x38c7bb+=_0x2cdb8b;});_0x368778['on'](_0x6253('0x1c'),function(){if(_0x4df1e8){return _0x4df1e8[_0x6253('0x1d')](_0x368778[_0x6253('0x1e')])[_0x6253('0x1f')](JSON['parse'](_0x38c7bb));}});});_0x3259b7['on']('error',function(_0x2ac00f){if(_0x4df1e8){return _0x4df1e8[_0x6253('0x1d')](0x1f4)['json']({'errors':[{'message':_0x6253('0x20'),'type':_0x6253('0x21')}]});}});_0x3259b7[_0x6253('0x22')](_0x3d7a7c);_0x3259b7[_0x6253('0x1c')]();}exports[_0x6253('0x23')]=openIssue;exports[_0x6253('0x24')]=function(_0x40f128,_0x31bc3f){_0x40f128['body']['ip']=_0x40f128['headers'][_0x6253('0x25')]||_0x40f128['connection'][_0x6253('0x26')]||_0x40f128[_0x6253('0x27')][_0x6253('0x26')]||_0x40f128[_0x6253('0x28')][_0x6253('0x27')][_0x6253('0x26')];return openIssue(_0x40f128[_0x6253('0x29')],_0x31bc3f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0d5d6d0..079a5af 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 _0x26ed=['show','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x1f4511,_0x2cb089){var _0x141939=function(_0xab2c24){while(--_0xab2c24){_0x1f4511['push'](_0x1f4511['shift']());}};_0x141939(++_0x2cb089);}(_0x26ed,0x15e));var _0xd26e=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x26ed[_0x2a4fe2];return _0x225c4a;};'use strict';var multer=require(_0xd26e('0x0'));var util=require(_0xd26e('0x1'));var path=require(_0xd26e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd26e('0x3'));var router=express[_0xd26e('0x4')]();var auth=require(_0xd26e('0x5'));var interaction=require(_0xd26e('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xd26e('0x7')](),controller['index']);router[_0xd26e('0x8')](_0xd26e('0x9'),auth[_0xd26e('0x7')](),controller['describe']);router[_0xd26e('0x8')]('/:id',auth[_0xd26e('0x7')](),controller[_0xd26e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd26e('0xb')]);router[_0xd26e('0xc')](_0xd26e('0xd'),auth['isAuthenticated'](),controller[_0xd26e('0xe')]);router[_0xd26e('0xf')](_0xd26e('0xd'),auth[_0xd26e('0x7')](),controller[_0xd26e('0x10')]);module[_0xd26e('0x11')]=router; \ No newline at end of file +var _0x65ab=['get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x34bab7,_0xedfc66){var _0x8319f7=function(_0x31e9e5){while(--_0x31e9e5){_0x34bab7['push'](_0x34bab7['shift']());}};_0x8319f7(++_0xedfc66);}(_0x65ab,0x1d6));var _0xb65a=function(_0x288845,_0x2d813a){_0x288845=_0x288845-0x0;var _0x3a213c=_0x65ab[_0x288845];return _0x3a213c;};'use strict';var multer=require(_0xb65a('0x0'));var util=require('util');var path=require(_0xb65a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb65a('0x2')]();var auth=require(_0xb65a('0x3'));var interaction=require(_0xb65a('0x4'));var config=require('../../config/environment');var controller=require(_0xb65a('0x5'));router[_0xb65a('0x6')]('/',auth[_0xb65a('0x7')](),controller['index']);router[_0xb65a('0x6')](_0xb65a('0x8'),auth['isAuthenticated'](),controller[_0xb65a('0x9')]);router[_0xb65a('0x6')](_0xb65a('0xa'),auth[_0xb65a('0x7')](),controller[_0xb65a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb65a('0xc')](_0xb65a('0xa'),auth[_0xb65a('0x7')](),controller[_0xb65a('0xd')]);router[_0xb65a('0xe')](_0xb65a('0xa'),auth[_0xb65a('0x7')](),controller[_0xb65a('0xf')]);module[_0xb65a('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index caa963d..2518234 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 _0x854b=['sequelize','exports','STRING','TEXT'];(function(_0x1361ba,_0x3fc2bf){var _0x5e7768=function(_0x3a6b9d){while(--_0x3a6b9d){_0x1361ba['push'](_0x1361ba['shift']());}};_0x5e7768(++_0x3fc2bf);}(_0x854b,0x19c));var _0xb854=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x854b[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xb854('0x0'));module[_0xb854('0x1')]={'question':{'type':Sequelize[_0xb854('0x2')]},'answer':{'type':Sequelize[_0xb854('0x3')]('long')},'membername':{'type':Sequelize[_0xb854('0x2')]},'projectname':{'type':Sequelize[_0xb854('0x2')]},'queue':{'type':Sequelize[_0xb854('0x2')]},'uniqueid':{'type':Sequelize[_0xb854('0x2')]},'calleridname':{'type':Sequelize[_0xb854('0x2')]},'calleridnum':{'type':Sequelize[_0xb854('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3aeb=['TEXT','long','sequelize','exports','STRING'];(function(_0x16fdc7,_0x332914){var _0x4443e7=function(_0x4a16ba){while(--_0x4a16ba){_0x16fdc7['push'](_0x16fdc7['shift']());}};_0x4443e7(++_0x332914);}(_0x3aeb,0x16f));var _0xb3ae=function(_0x31da36,_0x2d9a3f){_0x31da36=_0x31da36-0x0;var _0x3a3351=_0x3aeb[_0x31da36];return _0x3a3351;};'use strict';var Sequelize=require(_0xb3ae('0x0'));module[_0xb3ae('0x1')]={'question':{'type':Sequelize[_0xb3ae('0x2')]},'answer':{'type':Sequelize[_0xb3ae('0x3')](_0xb3ae('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb3ae('0x2')]},'calleridnum':{'type':Sequelize[_0xb3ae('0x2')]},'questionId':{'type':Sequelize[_0xb3ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 0f71126..dbc0312 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 _0x4966=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','intersection','length','find','catch','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0xdb0a69,_0x561e4a){var _0x4abd32=function(_0x52a11c){while(--_0x52a11c){_0xdb0a69['push'](_0xdb0a69['shift']());}};_0x4abd32(++_0x561e4a);}(_0x4966,0x112));var _0x6496=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x4966[_0x3cf053];return _0x3b55a0;};'use strict';var pdf=require(_0x6496('0x0'));var emlformat=require(_0x6496('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6496('0x2'));var rp=require(_0x6496('0x3'));var moment=require(_0x6496('0x4'));var BPromise=require(_0x6496('0x5'));var Mustache=require('mustache');var util=require(_0x6496('0x6'));var path=require('path');var sox=require(_0x6496('0x7'));var csv=require(_0x6496('0x8'));var ejs=require(_0x6496('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6496('0xa'));var toCsv=require(_0x6496('0x8'));var querystring=require(_0x6496('0xb'));var Papa=require('papaparse');var Redis=require(_0x6496('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6496('0xd'));var as=require(_0x6496('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6496('0xf'));var utils=require(_0x6496('0x10'));var config=require(_0x6496('0x11'));var db=require(_0x6496('0x12'))['db'];function respondWithStatusCode(_0xe12ee8,_0x14728a){_0x14728a=_0x14728a||0xcc;return function(_0x3a0c3b){if(_0x3a0c3b){return _0xe12ee8['sendStatus'](_0x14728a);}return _0xe12ee8['status'](_0x14728a)[_0x6496('0x13')]();};}function respondWithResult(_0x48050a,_0x4f215e){_0x4f215e=_0x4f215e||0xc8;return function(_0x233fa4){if(_0x233fa4){return _0x48050a['status'](_0x4f215e)[_0x6496('0x14')](_0x233fa4);}};}function respondWithFilteredResult(_0x129898,_0x302846){return function(_0x2ec92f){if(_0x2ec92f){var _0x1d7e16=_0x2ec92f[_0x6496('0x15')],_0x47fdef=_0x302846['offset'],_0x4293bf=_0x302846[_0x6496('0x16')]+_0x302846[_0x6496('0x17')],_0xecb08c;if(_0x4293bf>=_0x1d7e16){_0x4293bf=_0x1d7e16;_0xecb08c=0xc8;}else{_0xecb08c=0xce;}_0x129898[_0x6496('0x18')](_0xecb08c);return _0x129898['set'](_0x6496('0x19'),_0x47fdef+'-'+_0x4293bf+'/'+_0x1d7e16)['json'](_0x2ec92f);}return null;};}function patchUpdates(_0x43ef29){return function(_0xd56cf8){try{jsonpatch[_0x6496('0x1a')](_0xd56cf8,_0x43ef29,!![]);}catch(_0x105189){return BPromise['reject'](_0x105189);}return _0xd56cf8[_0x6496('0x1b')]();};}function saveUpdates(_0x45a9fb,_0x18b5bb){return function(_0x34d868){if(_0x34d868){return _0x34d868[_0x6496('0x1c')](_0x45a9fb)['then'](function(_0x16e4e1){return _0x16e4e1;});}return null;};}function removeEntity(_0x1f5ba1,_0x12d718){return function(_0x473a2b){if(_0x473a2b){return _0x473a2b['destroy']()[_0x6496('0x1d')](function(){_0x1f5ba1[_0x6496('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b65ca,_0x925f76){return function(_0x533d8e){if(!_0x533d8e){_0x5b65ca[_0x6496('0x1e')](0x194);}return _0x533d8e;};}function handleError(_0x13f10d,_0x7548e){_0x7548e=_0x7548e||0x1f4;return function(_0x4c5c54){logger[_0x6496('0x1f')](_0x4c5c54[_0x6496('0x20')]);if(_0x4c5c54[_0x6496('0x21')]){delete _0x4c5c54[_0x6496('0x21')];}_0x13f10d[_0x6496('0x18')](_0x7548e)[_0x6496('0x22')](_0x4c5c54);};}exports[_0x6496('0x23')]=function(_0x755df0,_0x1d118e){var _0x2ca599={},_0x1cb959={},_0x32b6d7={'count':0x0,'rows':[]};var _0x56674c=_[_0x6496('0x24')](db[_0x6496('0x25')][_0x6496('0x26')],function(_0x2775e6){return{'name':_0x2775e6[_0x6496('0x27')],'type':_0x2775e6[_0x6496('0x28')][_0x6496('0x29')]};});_0x1cb959[_0x6496('0x2a')]=_[_0x6496('0x24')](_0x56674c,'name');_0x1cb959[_0x6496('0x2b')]=_['keys'](_0x755df0[_0x6496('0x2b')]);_0x1cb959[_0x6496('0x2c')]=_['intersection'](_0x1cb959[_0x6496('0x2a')],_0x1cb959[_0x6496('0x2b')]);_0x2ca599['attributes']=_['intersection'](_0x1cb959[_0x6496('0x2a')],qs[_0x6496('0x2d')](_0x755df0[_0x6496('0x2b')]['fields']));_0x2ca599[_0x6496('0x2e')]=_0x2ca599[_0x6496('0x2e')]['length']?_0x2ca599[_0x6496('0x2e')]:_0x1cb959['model'];if(!_0x755df0[_0x6496('0x2b')][_0x6496('0x2f')](_0x6496('0x30'))){_0x2ca599[_0x6496('0x17')]=qs[_0x6496('0x17')](_0x755df0[_0x6496('0x2b')][_0x6496('0x17')]);_0x2ca599[_0x6496('0x16')]=qs[_0x6496('0x16')](_0x755df0[_0x6496('0x2b')]['offset']);}_0x2ca599[_0x6496('0x31')]=qs[_0x6496('0x32')](_0x755df0[_0x6496('0x2b')][_0x6496('0x32')]);_0x2ca599[_0x6496('0x33')]=qs['filters'](_[_0x6496('0x34')](_0x755df0[_0x6496('0x2b')],_0x1cb959[_0x6496('0x2c')]),_0x56674c);if(_0x755df0['query'][_0x6496('0x35')]){_0x2ca599['where']=_[_0x6496('0x36')](_0x2ca599[_0x6496('0x33')],{'$or':_[_0x6496('0x24')](_0x56674c,function(_0x3bb3e0){if(_0x3bb3e0[_0x6496('0x28')]!==_0x6496('0x37')){var _0x2f3ba1={};_0x2f3ba1[_0x3bb3e0[_0x6496('0x21')]]={'$like':'%'+_0x755df0['query'][_0x6496('0x35')]+'%'};return _0x2f3ba1;}})});}_0x2ca599=_[_0x6496('0x36')]({},_0x2ca599,_0x755df0[_0x6496('0x38')]);var _0x4fe050={'where':_0x2ca599[_0x6496('0x33')]};return db[_0x6496('0x25')][_0x6496('0x15')](_0x4fe050)['then'](function(_0x2c9f33){_0x32b6d7[_0x6496('0x15')]=_0x2c9f33;if(_0x755df0['query'][_0x6496('0x39')]){_0x2ca599[_0x6496('0x3a')]=[{'all':!![]}];}return db[_0x6496('0x25')][_0x6496('0x3b')](_0x2ca599);})['then'](function(_0xbb228c){_0x32b6d7[_0x6496('0x3c')]=_0xbb228c;return _0x32b6d7;})[_0x6496('0x1d')](respondWithFilteredResult(_0x1d118e,_0x2ca599))['catch'](handleError(_0x1d118e,null));};exports[_0x6496('0x3d')]=function(_0x14043f,_0x466985){var _0x53bd57={'raw':!![],'where':{'id':_0x14043f['params']['id']}},_0x52653f={};_0x52653f[_0x6496('0x2a')]=_['keys'](db[_0x6496('0x25')][_0x6496('0x26')]);_0x52653f[_0x6496('0x2b')]=_[_0x6496('0x3e')](_0x14043f['query']);_0x52653f[_0x6496('0x2c')]=_[_0x6496('0x3f')](_0x52653f[_0x6496('0x2a')],_0x52653f['query']);_0x53bd57['attributes']=_[_0x6496('0x3f')](_0x52653f[_0x6496('0x2a')],qs[_0x6496('0x2d')](_0x14043f[_0x6496('0x2b')][_0x6496('0x2d')]));_0x53bd57['attributes']=_0x53bd57[_0x6496('0x2e')][_0x6496('0x40')]?_0x53bd57['attributes']:_0x52653f[_0x6496('0x2a')];if(_0x14043f[_0x6496('0x2b')][_0x6496('0x39')]){_0x53bd57[_0x6496('0x3a')]=[{'all':!![]}];}_0x53bd57=_[_0x6496('0x36')]({},_0x53bd57,_0x14043f['options']);return db['JscriptyAnswerReport'][_0x6496('0x41')](_0x53bd57)[_0x6496('0x1d')](handleEntityNotFound(_0x466985,null))[_0x6496('0x1d')](respondWithResult(_0x466985,null))[_0x6496('0x42')](handleError(_0x466985,null));};exports['create']=function(_0x23456d,_0x452b3a){return db['JscriptyAnswerReport']['create'](_0x23456d[_0x6496('0x43')],{})[_0x6496('0x1d')](respondWithResult(_0x452b3a,0xc9))['catch'](handleError(_0x452b3a,null));};exports[_0x6496('0x1c')]=function(_0x1ad974,_0x4961de){if(_0x1ad974[_0x6496('0x43')]['id']){delete _0x1ad974[_0x6496('0x43')]['id'];}return db[_0x6496('0x25')][_0x6496('0x41')]({'where':{'id':_0x1ad974[_0x6496('0x44')]['id']}})[_0x6496('0x1d')](handleEntityNotFound(_0x4961de,null))[_0x6496('0x1d')](saveUpdates(_0x1ad974[_0x6496('0x43')],null))[_0x6496('0x1d')](respondWithResult(_0x4961de,null))[_0x6496('0x42')](handleError(_0x4961de,null));};exports[_0x6496('0x45')]=function(_0x4e39cb,_0x2045be){return db['JscriptyAnswerReport'][_0x6496('0x41')]({'where':{'id':_0x4e39cb[_0x6496('0x44')]['id']}})[_0x6496('0x1d')](handleEntityNotFound(_0x2045be,null))[_0x6496('0x1d')](removeEntity(_0x2045be,null))[_0x6496('0x42')](handleError(_0x2045be,null));};exports[_0x6496('0x46')]=function(_0x1195f9,_0xb6afec){return db[_0x6496('0x25')][_0x6496('0x46')]()['then'](respondWithResult(_0xb6afec,null))['catch'](handleError(_0xb6afec,null));}; \ No newline at end of file +var _0x5e8f=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5e8f,0x12e));var _0xf5e8=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x5e8f[_0x397f37];return _0x31cae6;};'use strict';var pdf=require(_0xf5e8('0x0'));var emlformat=require(_0xf5e8('0x1'));var rimraf=require(_0xf5e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5e8('0x3'));var rp=require(_0xf5e8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5e8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf5e8('0x6'));var csv=require('to-csv');var ejs=require(_0xf5e8('0x7'));var fs=require('fs');var _=require(_0xf5e8('0x8'));var squel=require(_0xf5e8('0x9'));var crypto=require(_0xf5e8('0xa'));var jsforce=require(_0xf5e8('0xb'));var deskjs=require(_0xf5e8('0xc'));var toCsv=require(_0xf5e8('0xd'));var querystring=require(_0xf5e8('0xe'));var Papa=require('papaparse');var Redis=require(_0xf5e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf5e8('0x10'));var as=require(_0xf5e8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5e8('0x12'));var utils=require(_0xf5e8('0x13'));var config=require(_0xf5e8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6d0653,_0x1b622c){_0x1b622c=_0x1b622c||0xcc;return function(_0x5c5be4){if(_0x5c5be4){return _0x6d0653['sendStatus'](_0x1b622c);}return _0x6d0653['status'](_0x1b622c)['end']();};}function respondWithResult(_0x3f2b36,_0x182a8a){_0x182a8a=_0x182a8a||0xc8;return function(_0x17a02f){if(_0x17a02f){return _0x3f2b36[_0xf5e8('0x15')](_0x182a8a)['json'](_0x17a02f);}};}function respondWithFilteredResult(_0x5c5a38,_0x5f562e){return function(_0x48effa){if(_0x48effa){var _0x4eb75b=_0x48effa[_0xf5e8('0x16')],_0x3d2be7=_0x5f562e[_0xf5e8('0x17')],_0x282891=_0x5f562e[_0xf5e8('0x17')]+_0x5f562e[_0xf5e8('0x18')],_0x11a537;if(_0x282891>=_0x4eb75b){_0x282891=_0x4eb75b;_0x11a537=0xc8;}else{_0x11a537=0xce;}_0x5c5a38[_0xf5e8('0x15')](_0x11a537);return _0x5c5a38[_0xf5e8('0x19')](_0xf5e8('0x1a'),_0x3d2be7+'-'+_0x282891+'/'+_0x4eb75b)['json'](_0x48effa);}return null;};}function patchUpdates(_0x5958db){return function(_0x47448d){try{jsonpatch['apply'](_0x47448d,_0x5958db,!![]);}catch(_0x148389){return BPromise[_0xf5e8('0x1b')](_0x148389);}return _0x47448d['save']();};}function saveUpdates(_0x3927d4,_0x691c09){return function(_0x3e0cf8){if(_0x3e0cf8){return _0x3e0cf8[_0xf5e8('0x1c')](_0x3927d4)[_0xf5e8('0x1d')](function(_0x14248c){return _0x14248c;});}return null;};}function removeEntity(_0xaa0300,_0x15085a){return function(_0xd9ae7b){if(_0xd9ae7b){return _0xd9ae7b[_0xf5e8('0x1e')]()[_0xf5e8('0x1d')](function(){_0xaa0300[_0xf5e8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a223,_0x3d7715){return function(_0x2312b8){if(!_0x2312b8){_0x17a223[_0xf5e8('0x1f')](0x194);}return _0x2312b8;};}function handleError(_0x1e0cd6,_0xf71f3b){_0xf71f3b=_0xf71f3b||0x1f4;return function(_0x424233){logger[_0xf5e8('0x20')](_0x424233[_0xf5e8('0x21')]);if(_0x424233[_0xf5e8('0x22')]){delete _0x424233[_0xf5e8('0x22')];}_0x1e0cd6['status'](_0xf71f3b)[_0xf5e8('0x23')](_0x424233);};}exports[_0xf5e8('0x24')]=function(_0x41a836,_0x1cd988){var _0x5b1b85={},_0x245066={},_0x50b29e={'count':0x0,'rows':[]};var _0x59f7f9=_[_0xf5e8('0x25')](db[_0xf5e8('0x26')][_0xf5e8('0x27')],function(_0x199454){return{'name':_0x199454['fieldName'],'type':_0x199454[_0xf5e8('0x28')][_0xf5e8('0x29')]};});_0x245066[_0xf5e8('0x2a')]=_[_0xf5e8('0x25')](_0x59f7f9,_0xf5e8('0x22'));_0x245066[_0xf5e8('0x2b')]=_['keys'](_0x41a836[_0xf5e8('0x2b')]);_0x245066[_0xf5e8('0x2c')]=_[_0xf5e8('0x2d')](_0x245066['model'],_0x245066[_0xf5e8('0x2b')]);_0x5b1b85[_0xf5e8('0x2e')]=_[_0xf5e8('0x2d')](_0x245066['model'],qs[_0xf5e8('0x2f')](_0x41a836[_0xf5e8('0x2b')]['fields']));_0x5b1b85[_0xf5e8('0x2e')]=_0x5b1b85[_0xf5e8('0x2e')][_0xf5e8('0x30')]?_0x5b1b85[_0xf5e8('0x2e')]:_0x245066[_0xf5e8('0x2a')];if(!_0x41a836['query'][_0xf5e8('0x31')](_0xf5e8('0x32'))){_0x5b1b85[_0xf5e8('0x18')]=qs['limit'](_0x41a836['query']['limit']);_0x5b1b85[_0xf5e8('0x17')]=qs[_0xf5e8('0x17')](_0x41a836[_0xf5e8('0x2b')][_0xf5e8('0x17')]);}_0x5b1b85['order']=qs[_0xf5e8('0x33')](_0x41a836[_0xf5e8('0x2b')][_0xf5e8('0x33')]);_0x5b1b85[_0xf5e8('0x34')]=qs['filters'](_[_0xf5e8('0x35')](_0x41a836[_0xf5e8('0x2b')],_0x245066[_0xf5e8('0x2c')]),_0x59f7f9);if(_0x41a836['query'][_0xf5e8('0x36')]){_0x5b1b85[_0xf5e8('0x34')]=_['merge'](_0x5b1b85[_0xf5e8('0x34')],{'$or':_[_0xf5e8('0x25')](_0x59f7f9,function(_0x1c712d){if(_0x1c712d['type']!==_0xf5e8('0x37')){var _0x33a64a={};_0x33a64a[_0x1c712d[_0xf5e8('0x22')]]={'$like':'%'+_0x41a836['query'][_0xf5e8('0x36')]+'%'};return _0x33a64a;}})});}_0x5b1b85=_[_0xf5e8('0x38')]({},_0x5b1b85,_0x41a836[_0xf5e8('0x39')]);var _0x7ba031={'where':_0x5b1b85['where']};return db['JscriptyAnswerReport'][_0xf5e8('0x16')](_0x7ba031)[_0xf5e8('0x1d')](function(_0x279433){_0x50b29e[_0xf5e8('0x16')]=_0x279433;if(_0x41a836[_0xf5e8('0x2b')]['includeAll']){_0x5b1b85[_0xf5e8('0x3a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xf5e8('0x3b')](_0x5b1b85);})[_0xf5e8('0x1d')](function(_0x59aa55){_0x50b29e['rows']=_0x59aa55;return _0x50b29e;})['then'](respondWithFilteredResult(_0x1cd988,_0x5b1b85))[_0xf5e8('0x3c')](handleError(_0x1cd988,null));};exports[_0xf5e8('0x3d')]=function(_0x27fdb6,_0x3738f7){var _0x243cd8={'raw':!![],'where':{'id':_0x27fdb6[_0xf5e8('0x3e')]['id']}},_0x1d85ea={};_0x1d85ea[_0xf5e8('0x2a')]=_['keys'](db[_0xf5e8('0x26')][_0xf5e8('0x27')]);_0x1d85ea['query']=_[_0xf5e8('0x3f')](_0x27fdb6[_0xf5e8('0x2b')]);_0x1d85ea['filters']=_['intersection'](_0x1d85ea[_0xf5e8('0x2a')],_0x1d85ea[_0xf5e8('0x2b')]);_0x243cd8[_0xf5e8('0x2e')]=_[_0xf5e8('0x2d')](_0x1d85ea['model'],qs['fields'](_0x27fdb6[_0xf5e8('0x2b')][_0xf5e8('0x2f')]));_0x243cd8['attributes']=_0x243cd8[_0xf5e8('0x2e')]['length']?_0x243cd8[_0xf5e8('0x2e')]:_0x1d85ea[_0xf5e8('0x2a')];if(_0x27fdb6[_0xf5e8('0x2b')][_0xf5e8('0x40')]){_0x243cd8[_0xf5e8('0x3a')]=[{'all':!![]}];}_0x243cd8=_[_0xf5e8('0x38')]({},_0x243cd8,_0x27fdb6[_0xf5e8('0x39')]);return db[_0xf5e8('0x26')][_0xf5e8('0x41')](_0x243cd8)[_0xf5e8('0x1d')](handleEntityNotFound(_0x3738f7,null))[_0xf5e8('0x1d')](respondWithResult(_0x3738f7,null))[_0xf5e8('0x3c')](handleError(_0x3738f7,null));};exports[_0xf5e8('0x42')]=function(_0xb85a7,_0x344537){return db[_0xf5e8('0x26')][_0xf5e8('0x42')](_0xb85a7[_0xf5e8('0x43')],{})['then'](respondWithResult(_0x344537,0xc9))['catch'](handleError(_0x344537,null));};exports['update']=function(_0x5e0e98,_0x5c5693){if(_0x5e0e98[_0xf5e8('0x43')]['id']){delete _0x5e0e98[_0xf5e8('0x43')]['id'];}return db[_0xf5e8('0x26')][_0xf5e8('0x41')]({'where':{'id':_0x5e0e98['params']['id']}})['then'](handleEntityNotFound(_0x5c5693,null))['then'](saveUpdates(_0x5e0e98[_0xf5e8('0x43')],null))[_0xf5e8('0x1d')](respondWithResult(_0x5c5693,null))[_0xf5e8('0x3c')](handleError(_0x5c5693,null));};exports[_0xf5e8('0x1e')]=function(_0x1444ea,_0x1670d4){return db[_0xf5e8('0x26')][_0xf5e8('0x41')]({'where':{'id':_0x1444ea[_0xf5e8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1670d4,null))[_0xf5e8('0x1d')](removeEntity(_0x1670d4,null))[_0xf5e8('0x3c')](handleError(_0x1670d4,null));};exports[_0xf5e8('0x44')]=function(_0x565b1b,_0x46c8e2){return db[_0xf5e8('0x26')]['describe']()[_0xf5e8('0x1d')](respondWithResult(_0x46c8e2,null))[_0xf5e8('0x3c')](handleError(_0x46c8e2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2d291f5..0777c1b 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 _0x95e9=['moment','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x95e9,0x152));var _0x995e=function(_0x19ccea,_0x5056b2){_0x19ccea=_0x19ccea-0x0;var _0x149dd4=_0x95e9[_0x19ccea];return _0x149dd4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x995e('0x0'))(_0x995e('0x1'));var moment=require(_0x995e('0x2'));var BPromise=require(_0x995e('0x3'));var rp=require(_0x995e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x995e('0x5'));module[_0x995e('0x6')]=function(_0x5182dd,_0x41bd0e){return _0x5182dd[_0x995e('0x7')](_0x995e('0x8'),attributes,{'tableName':_0x995e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8611=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x3c3b9e,_0x245f4f){var _0x1ec8fa=function(_0xf14cc9){while(--_0xf14cc9){_0x3c3b9e['push'](_0x3c3b9e['shift']());}};_0x1ec8fa(++_0x245f4f);}(_0x8611,0x107));var _0x1861=function(_0x5d4ccb,_0x424223){_0x5d4ccb=_0x5d4ccb-0x0;var _0x27b153=_0x8611[_0x5d4ccb];return _0x27b153;};'use strict';var _=require(_0x1861('0x0'));var util=require(_0x1861('0x1'));var logger=require('../../config/logger')(_0x1861('0x2'));var moment=require(_0x1861('0x3'));var BPromise=require(_0x1861('0x4'));var rp=require(_0x1861('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1861('0x6'));var config=require(_0x1861('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x1861('0x8')]=function(_0x318cba,_0x59c69d){return _0x318cba['define'](_0x1861('0x9'),attributes,{'tableName':_0x1861('0xa'),'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 01f1e0f..6b0fe15 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 _0xd936=['jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd936,0xde));var _0x6d93=function(_0x4d1298,_0x5cc665){_0x4d1298=_0x4d1298-0x0;var _0xb3a7c8=_0xd936[_0x4d1298];return _0xb3a7c8;};'use strict';var _=require(_0x6d93('0x0'));var util=require('util');var moment=require(_0x6d93('0x1'));var BPromise=require(_0x6d93('0x2'));var rs=require(_0x6d93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d93('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d93('0x5'));var jayson=require(_0x6d93('0x6'));var client=jayson[_0x6d93('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc452,_0x5f0366,_0x28b001){return new BPromise(function(_0x233537,_0x25ef32){return client[_0x6d93('0x8')](_0x5bc452,_0x28b001)[_0x6d93('0x9')](function(_0x403436){logger[_0x6d93('0xa')](_0x6d93('0xb'),_0x5f0366,_0x6d93('0xc'));logger[_0x6d93('0xd')](_0x6d93('0xe'),_0x5f0366,_0x6d93('0xc'),JSON[_0x6d93('0xf')](_0x403436));if(_0x403436[_0x6d93('0x10')]){if(_0x403436[_0x6d93('0x10')]['code']===0x1f4){logger[_0x6d93('0x10')](_0x6d93('0xb'),_0x5f0366,_0x403436[_0x6d93('0x10')]['message']);return _0x25ef32(_0x403436[_0x6d93('0x10')][_0x6d93('0x11')]);}logger[_0x6d93('0x10')](_0x6d93('0xb'),_0x5f0366,_0x403436[_0x6d93('0x10')][_0x6d93('0x11')]);return _0x233537(_0x403436[_0x6d93('0x10')][_0x6d93('0x11')]);}else{logger[_0x6d93('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5f0366,_0x6d93('0xc'));_0x233537(_0x403436[_0x6d93('0x12')][_0x6d93('0x11')]);}})['catch'](function(_0xbd0ee5){logger[_0x6d93('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5f0366,_0xbd0ee5);_0x25ef32(_0xbd0ee5);});});} \ No newline at end of file +var _0xbcc2=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x144175,_0x1c27a3){var _0x5d3ba9=function(_0x5a7e1f){while(--_0x5a7e1f){_0x144175['push'](_0x144175['shift']());}};_0x5d3ba9(++_0x1c27a3);}(_0xbcc2,0x6e));var _0x2bcc=function(_0xed67c,_0x5879cb){_0xed67c=_0xed67c-0x0;var _0x2dff8c=_0xbcc2[_0xed67c];return _0x2dff8c;};'use strict';var _=require(_0x2bcc('0x0'));var util=require(_0x2bcc('0x1'));var moment=require(_0x2bcc('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bcc('0x3'));var fs=require('fs');var Redis=require(_0x2bcc('0x4'));var db=require(_0x2bcc('0x5'))['db'];var utils=require(_0x2bcc('0x6'));var logger=require(_0x2bcc('0x7'))(_0x2bcc('0x8'));var config=require(_0x2bcc('0x9'));var jayson=require(_0x2bcc('0xa'));var client=jayson[_0x2bcc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa76afa,_0x3765a9,_0x2ce7ff){return new BPromise(function(_0x90a807,_0x114773){return client[_0x2bcc('0xc')](_0xa76afa,_0x2ce7ff)[_0x2bcc('0xd')](function(_0x2d6003){logger[_0x2bcc('0xe')](_0x2bcc('0xf'),_0x3765a9,'request\x20sent');logger['debug'](_0x2bcc('0x10'),_0x3765a9,_0x2bcc('0x11'),JSON['stringify'](_0x2d6003));if(_0x2d6003[_0x2bcc('0x12')]){if(_0x2d6003[_0x2bcc('0x12')]['code']===0x1f4){logger[_0x2bcc('0x12')](_0x2bcc('0xf'),_0x3765a9,_0x2d6003[_0x2bcc('0x12')][_0x2bcc('0x13')]);return _0x114773(_0x2d6003[_0x2bcc('0x12')][_0x2bcc('0x13')]);}logger[_0x2bcc('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3765a9,_0x2d6003[_0x2bcc('0x12')][_0x2bcc('0x13')]);return _0x90a807(_0x2d6003[_0x2bcc('0x12')][_0x2bcc('0x13')]);}else{logger[_0x2bcc('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3765a9,'request\x20sent');_0x90a807(_0x2d6003[_0x2bcc('0x14')][_0x2bcc('0x13')]);}})[_0x2bcc('0x15')](function(_0x3508ad){logger['error'](_0x2bcc('0xf'),_0x3765a9,_0x3508ad);_0x114773(_0x3508ad);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d6a3fb9..6321f3d 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 _0xf9a9=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','update','delete'];(function(_0x52b408,_0x22fe7e){var _0x403deb=function(_0x13defa){while(--_0x13defa){_0x52b408['push'](_0x52b408['shift']());}};_0x403deb(++_0x22fe7e);}(_0xf9a9,0xfe));var _0x9f9a=function(_0x4dc15f,_0x4930af){_0x4dc15f=_0x4dc15f-0x0;var _0x303455=_0xf9a9[_0x4dc15f];return _0x303455;};'use strict';var multer=require(_0x9f9a('0x0'));var util=require(_0x9f9a('0x1'));var path=require(_0x9f9a('0x2'));var timeout=require(_0x9f9a('0x3'));var express=require(_0x9f9a('0x4'));var router=express['Router']();var auth=require(_0x9f9a('0x5'));var interaction=require(_0x9f9a('0x6'));var config=require(_0x9f9a('0x7'));var controller=require(_0x9f9a('0x8'));router[_0x9f9a('0x9')]('/',auth[_0x9f9a('0xa')](),controller[_0x9f9a('0xb')]);router[_0x9f9a('0x9')](_0x9f9a('0xc'),auth['isAuthenticated'](),controller[_0x9f9a('0xd')]);router['get'](_0x9f9a('0xe'),auth['isAuthenticated'](),controller[_0x9f9a('0xf')]);router[_0x9f9a('0x9')]('/:id/answers',auth['isAuthenticated'](),controller[_0x9f9a('0x10')]);router['get'](_0x9f9a('0x11'),auth[_0x9f9a('0xa')](),timeout(_0x9f9a('0x12')),controller[_0x9f9a('0x13')]);router['post']('/',auth[_0x9f9a('0xa')](),controller[_0x9f9a('0x14')]);router[_0x9f9a('0x15')](_0x9f9a('0x16'),auth[_0x9f9a('0xa')](),controller[_0x9f9a('0x17')]);router['put'](_0x9f9a('0xc'),auth[_0x9f9a('0xa')](),controller[_0x9f9a('0x18')]);router[_0x9f9a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x9f9a('0x1a')]);module[_0x9f9a('0x1b')]=router; \ No newline at end of file +var _0x20fa=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy'];(function(_0x5bfaa7,_0x404773){var _0xe1b1a3=function(_0x20a344){while(--_0x20a344){_0x5bfaa7['push'](_0x5bfaa7['shift']());}};_0xe1b1a3(++_0x404773);}(_0x20fa,0xea));var _0xa20f=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x20fa[_0x4314d7];return _0x5c599b;};'use strict';var multer=require(_0xa20f('0x0'));var util=require(_0xa20f('0x1'));var path=require('path');var timeout=require(_0xa20f('0x2'));var express=require(_0xa20f('0x3'));var router=express[_0xa20f('0x4')]();var auth=require(_0xa20f('0x5'));var interaction=require(_0xa20f('0x6'));var config=require(_0xa20f('0x7'));var controller=require(_0xa20f('0x8'));router['get']('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0xa')]);router[_0xa20f('0xb')](_0xa20f('0xc'),auth[_0xa20f('0x9')](),controller['show']);router[_0xa20f('0xb')](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller[_0xa20f('0xe')]);router[_0xa20f('0xb')](_0xa20f('0xf'),auth[_0xa20f('0x9')](),controller['getAnswers']);router[_0xa20f('0xb')](_0xa20f('0x10'),auth['isAuthenticated'](),timeout(_0xa20f('0x11')),controller[_0xa20f('0x12')]);router[_0xa20f('0x13')]('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0x14')]);router[_0xa20f('0x13')]('/:id/clone',auth[_0xa20f('0x9')](),controller[_0xa20f('0x15')]);router[_0xa20f('0x16')](_0xa20f('0xc'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x17')]);router[_0xa20f('0x18')](_0xa20f('0xc'),auth['isAuthenticated'](),controller[_0xa20f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0632b53..9861222 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 _0x49b5=['formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','lodash','util','exports','STRING','long','setDataValue'];(function(_0x35f763,_0x143fd9){var _0x38f46f=function(_0x49a321){while(--_0x49a321){_0x35f763['push'](_0x35f763['shift']());}};_0x38f46f(++_0x143fd9);}(_0x49b5,0x6a));var _0x549b=function(_0x4c94d0,_0x32f238){_0x4c94d0=_0x4c94d0-0x0;var _0x19f79b=_0x49b5[_0x4c94d0];return _0x19f79b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x549b('0x0'));var util=require(_0x549b('0x1'));module[_0x549b('0x2')]={'name':{'type':Sequelize[_0x549b('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x549b('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x549b('0x4')),'set':function(_0x1abdc2){if(_['isObjectLike'](_0x1abdc2)){this[_0x549b('0x5')](_0x549b('0x6'),JSON['stringify'](_0x1abdc2));}else if(_[_0x549b('0x7')](_0x1abdc2)){this[_0x549b('0x5')](_0x549b('0x6'),_0x1abdc2);}else{this[_0x549b('0x5')](_0x549b('0x6'),util[_0x549b('0x8')](_0x549b('0x9'),this[_0x549b('0xa')](_0x549b('0xb'))||'',this[_0x549b('0xa')](_0x549b('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x549b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xc1b3=['format','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','isObjectLike','formData','stringify','setDataValue'];(function(_0x1a0a8f,_0x345aa3){var _0x61cb1=function(_0x3be50f){while(--_0x3be50f){_0x1a0a8f['push'](_0x1a0a8f['shift']());}};_0x61cb1(++_0x345aa3);}(_0xc1b3,0x7b));var _0x3c1b=function(_0x30e8e6,_0xde138f){_0x30e8e6=_0x30e8e6-0x0;var _0x2eb7c7=_0xc1b3[_0x30e8e6];return _0x2eb7c7;};'use strict';var Sequelize=require(_0x3c1b('0x0'));var _=require(_0x3c1b('0x1'));var util=require(_0x3c1b('0x2'));module[_0x3c1b('0x3')]={'name':{'type':Sequelize[_0x3c1b('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x3d5e5e){if(_[_0x3c1b('0x5')](_0x3d5e5e)){this['setDataValue'](_0x3c1b('0x6'),JSON[_0x3c1b('0x7')](_0x3d5e5e));}else if(_['isString'](_0x3d5e5e)){this[_0x3c1b('0x8')]('formData',_0x3d5e5e);}else{this[_0x3c1b('0x8')]('formData',util[_0x3c1b('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x3c1b('0xa')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3c1b('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3c1b('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 58cedf3..ac8f227 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 _0xcc0e=['JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','set','Content-Range','apply','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','autoAssociation','update','getSessions','findOne'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcc0e,0x178));var _0xecc0=function(_0x7f9e63,_0x2aab08){_0x7f9e63=_0x7f9e63-0x0;var _0x361f7b=_0xcc0e[_0x7f9e63];return _0x361f7b;};'use strict';var pdf=require(_0xecc0('0x0'));var emlformat=require(_0xecc0('0x1'));var rimraf=require(_0xecc0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecc0('0x3'));var rp=require(_0xecc0('0x4'));var moment=require('moment');var BPromise=require(_0xecc0('0x5'));var Mustache=require('mustache');var util=require(_0xecc0('0x6'));var path=require('path');var sox=require(_0xecc0('0x7'));var csv=require(_0xecc0('0x8'));var ejs=require(_0xecc0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xecc0('0xa'));var crypto=require('crypto');var jsforce=require(_0xecc0('0xb'));var deskjs=require(_0xecc0('0xc'));var toCsv=require(_0xecc0('0x8'));var querystring=require(_0xecc0('0xd'));var Papa=require(_0xecc0('0xe'));var Redis=require(_0xecc0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xecc0('0x10'));var as=require(_0xecc0('0x11'));var hardwareService=require(_0xecc0('0x12'));var logger=require(_0xecc0('0x13'))(_0xecc0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ff669,_0xaf0e2b){_0xaf0e2b=_0xaf0e2b||0xcc;return function(_0xd9a824){if(_0xd9a824){return _0x6ff669[_0xecc0('0x15')](_0xaf0e2b);}return _0x6ff669[_0xecc0('0x16')](_0xaf0e2b)[_0xecc0('0x17')]();};}function respondWithResult(_0x590ac6,_0x4cd90d){_0x4cd90d=_0x4cd90d||0xc8;return function(_0x5b67a1){if(_0x5b67a1){return _0x590ac6[_0xecc0('0x16')](_0x4cd90d)[_0xecc0('0x18')](_0x5b67a1);}};}function respondWithFilteredResult(_0x31d146,_0x236ae6){return function(_0x41805e){if(_0x41805e){var _0x1d084d=_0x41805e['count'],_0x5dcb2c=_0x236ae6[_0xecc0('0x19')],_0x32c31c=_0x236ae6[_0xecc0('0x19')]+_0x236ae6['limit'],_0x54ebc1;if(_0x32c31c>=_0x1d084d){_0x32c31c=_0x1d084d;_0x54ebc1=0xc8;}else{_0x54ebc1=0xce;}_0x31d146[_0xecc0('0x16')](_0x54ebc1);return _0x31d146[_0xecc0('0x1a')](_0xecc0('0x1b'),_0x5dcb2c+'-'+_0x32c31c+'/'+_0x1d084d)[_0xecc0('0x18')](_0x41805e);}return null;};}function patchUpdates(_0x32584d){return function(_0x19b0e8){try{jsonpatch[_0xecc0('0x1c')](_0x19b0e8,_0x32584d,!![]);}catch(_0x296b74){return BPromise['reject'](_0x296b74);}return _0x19b0e8['save']();};}function saveUpdates(_0x1d60b9,_0x570267){return function(_0x43f195){if(_0x43f195){return _0x43f195['update'](_0x1d60b9)[_0xecc0('0x1d')](function(_0x10b13a){return _0x10b13a;});}return null;};}function removeEntity(_0x4bb3ac,_0x5962ed){return function(_0x416702){if(_0x416702){return _0x416702[_0xecc0('0x1e')]()['then'](function(){var _0x25ebbb=_0x416702[_0xecc0('0x1f')]({'plain':!![]});var _0x235647='Projects';return db[_0xecc0('0x20')][_0xecc0('0x1e')]({'where':{'type':_0x235647,'resourceId':_0x25ebbb['id']}})[_0xecc0('0x1d')](function(){return _0x416702;});})[_0xecc0('0x1d')](function(){_0x4bb3ac[_0xecc0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c169d,_0x2ebdfe){return function(_0x402bd8){if(!_0x402bd8){_0x2c169d['sendStatus'](0x194);}return _0x402bd8;};}function handleError(_0x104aaa,_0x47940f){_0x47940f=_0x47940f||0x1f4;return function(_0x328804){logger[_0xecc0('0x21')](_0x328804[_0xecc0('0x22')]);if(_0x328804[_0xecc0('0x23')]){delete _0x328804[_0xecc0('0x23')];}_0x104aaa['status'](_0x47940f)[_0xecc0('0x24')](_0x328804);};}exports[_0xecc0('0x25')]=function(_0x213c76,_0x103a82){var _0x86bcd3={},_0x2644c9={},_0x42e15d={'count':0x0,'rows':[]};var _0x4d880e=_[_0xecc0('0x26')](db[_0xecc0('0x27')][_0xecc0('0x28')],function(_0x22fa6f){return{'name':_0x22fa6f[_0xecc0('0x29')],'type':_0x22fa6f[_0xecc0('0x2a')]['key']};});_0x2644c9[_0xecc0('0x2b')]=_[_0xecc0('0x26')](_0x4d880e,_0xecc0('0x23'));_0x2644c9[_0xecc0('0x2c')]=_[_0xecc0('0x2d')](_0x213c76[_0xecc0('0x2c')]);_0x2644c9[_0xecc0('0x2e')]=_[_0xecc0('0x2f')](_0x2644c9['model'],_0x2644c9['query']);_0x86bcd3[_0xecc0('0x30')]=_[_0xecc0('0x2f')](_0x2644c9['model'],qs['fields'](_0x213c76[_0xecc0('0x2c')][_0xecc0('0x31')]));_0x86bcd3[_0xecc0('0x30')]=_0x86bcd3[_0xecc0('0x30')][_0xecc0('0x32')]?_0x86bcd3['attributes']:_0x2644c9['model'];if(!_0x213c76[_0xecc0('0x2c')][_0xecc0('0x33')]('nolimit')){_0x86bcd3[_0xecc0('0x34')]=qs[_0xecc0('0x34')](_0x213c76[_0xecc0('0x2c')][_0xecc0('0x34')]);_0x86bcd3[_0xecc0('0x19')]=qs[_0xecc0('0x19')](_0x213c76[_0xecc0('0x2c')]['offset']);}_0x86bcd3[_0xecc0('0x35')]=qs[_0xecc0('0x36')](_0x213c76['query'][_0xecc0('0x36')]);_0x86bcd3[_0xecc0('0x37')]=qs[_0xecc0('0x2e')](_[_0xecc0('0x38')](_0x213c76[_0xecc0('0x2c')],_0x2644c9[_0xecc0('0x2e')]),_0x4d880e);if(_0x213c76[_0xecc0('0x2c')][_0xecc0('0x39')]){_0x86bcd3['where']=_[_0xecc0('0x3a')](_0x86bcd3[_0xecc0('0x37')],{'$or':_[_0xecc0('0x26')](_0x4d880e,function(_0x35a019){if(_0x35a019['type']!==_0xecc0('0x3b')){var _0x1879fb={};_0x1879fb[_0x35a019[_0xecc0('0x23')]]={'$like':'%'+_0x213c76[_0xecc0('0x2c')][_0xecc0('0x39')]+'%'};return _0x1879fb;}})});}_0x86bcd3=_[_0xecc0('0x3a')]({},_0x86bcd3,_0x213c76[_0xecc0('0x3c')]);var _0x407ba7={'where':_0x86bcd3[_0xecc0('0x37')]};return db[_0xecc0('0x27')][_0xecc0('0x3d')](_0x407ba7)[_0xecc0('0x1d')](function(_0x1b6621){_0x42e15d[_0xecc0('0x3d')]=_0x1b6621;if(_0x213c76[_0xecc0('0x2c')][_0xecc0('0x3e')]){_0x86bcd3['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xecc0('0x3f')](_0x86bcd3);})['then'](function(_0x36307a){_0x42e15d[_0xecc0('0x40')]=_0x36307a;return _0x42e15d;})['then'](respondWithFilteredResult(_0x103a82,_0x86bcd3))[_0xecc0('0x41')](handleError(_0x103a82,null));};exports['show']=function(_0x1c1747,_0x5a015a){var _0x257df0={'raw':![],'where':{'id':_0x1c1747[_0xecc0('0x42')]['id']}},_0x2610ae={};_0x2610ae[_0xecc0('0x2b')]=_[_0xecc0('0x2d')](db['JscriptyProject'][_0xecc0('0x28')]);_0x2610ae['query']=_['keys'](_0x1c1747[_0xecc0('0x2c')]);_0x2610ae[_0xecc0('0x2e')]=_[_0xecc0('0x2f')](_0x2610ae[_0xecc0('0x2b')],_0x2610ae[_0xecc0('0x2c')]);_0x257df0[_0xecc0('0x30')]=_[_0xecc0('0x2f')](_0x2610ae[_0xecc0('0x2b')],qs[_0xecc0('0x31')](_0x1c1747['query']['fields']));_0x257df0[_0xecc0('0x30')]=_0x257df0[_0xecc0('0x30')][_0xecc0('0x32')]?_0x257df0[_0xecc0('0x30')]:_0x2610ae[_0xecc0('0x2b')];if(_0x1c1747[_0xecc0('0x2c')][_0xecc0('0x3e')]){_0x257df0[_0xecc0('0x43')]=[{'all':!![]}];}_0x257df0=_[_0xecc0('0x3a')]({},_0x257df0,_0x1c1747[_0xecc0('0x3c')]);return db[_0xecc0('0x27')]['find'](_0x257df0)[_0xecc0('0x1d')](handleEntityNotFound(_0x5a015a,null))[_0xecc0('0x1d')](respondWithResult(_0x5a015a,null))[_0xecc0('0x41')](handleError(_0x5a015a,null));};exports[_0xecc0('0x44')]=function(_0x1cb10e,_0x60faad){return db[_0xecc0('0x27')][_0xecc0('0x44')](_0x1cb10e[_0xecc0('0x45')],{})[_0xecc0('0x1d')](function(_0x577e9e){var _0x56010e=_0x1cb10e[_0xecc0('0x46')][_0xecc0('0x1f')]({'plain':!![]});if(!_0x56010e)throw new Error(_0xecc0('0x47'));if(_0x56010e[_0xecc0('0x48')]===_0xecc0('0x46')){var _0x47590d=_0x577e9e[_0xecc0('0x1f')]({'plain':!![]});var _0x2dd344=_0xecc0('0x49');return db[_0xecc0('0x4a')][_0xecc0('0x4b')]({'where':{'name':_0x2dd344,'userProfileId':_0x56010e[_0xecc0('0x4c')]},'raw':!![]})['then'](function(_0x1d7267){if(_0x1d7267&&_0x1d7267['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x47590d[_0xecc0('0x23')],'resourceId':_0x47590d['id'],'type':_0x1d7267[_0xecc0('0x23')],'sectionId':_0x1d7267['id']},{})[_0xecc0('0x1d')](function(){return _0x577e9e;});}else{return _0x577e9e;}})['catch'](function(_0x5e7974){logger[_0xecc0('0x21')](_0xecc0('0x4d'),_0x5e7974);throw _0x5e7974;});}return _0x577e9e;})[_0xecc0('0x1d')](respondWithResult(_0x60faad,0xc9))[_0xecc0('0x41')](handleError(_0x60faad,null));};exports['clone']=function(_0x38274c,_0x2cbb30){var _0x590d11={'where':{'id':_0x38274c['params']['id']}},_0xe07a6c={};_0xe07a6c[_0xecc0('0x2b')]=_[_0xecc0('0x2d')](db[_0xecc0('0x27')][_0xecc0('0x28')]);_0x590d11[_0xecc0('0x30')]=_[_0xecc0('0x2f')](_0xe07a6c[_0xecc0('0x2b')],qs['fields'](_0x38274c['query'][_0xecc0('0x31')]));_0x590d11[_0xecc0('0x30')]=_0x590d11[_0xecc0('0x30')][_0xecc0('0x32')]?_0x590d11['attributes']:_0xe07a6c['model'];if(_0x38274c[_0xecc0('0x2c')][_0xecc0('0x3e')]){_0x590d11[_0xecc0('0x43')]=[{'all':!![]}];}_0x590d11=_[_0xecc0('0x3a')]({},_0x590d11,_0x38274c[_0xecc0('0x3c')]);return db['JscriptyProject'][_0xecc0('0x4b')](_0x590d11)['then'](handleEntityNotFound(_0x2cbb30,null))['then'](function(_0x398cbf){if(_0x398cbf){var _0x355632=_0x398cbf['get']({'plain':!![]});_0x355632=qs[_0xecc0('0x4e')](_0x355632,['id','createdAt',_0xecc0('0x4f')]);_0x38274c[_0xecc0('0x45')]=_[_0xecc0('0x4e')](_0x38274c[_0xecc0('0x45')],['id','createdAt',_0xecc0('0x4f')]);return db[_0xecc0('0x27')]['create'](_[_0xecc0('0x3a')](_0x355632,_0x38274c[_0xecc0('0x45')]),{'include':_0x38274c[_0xecc0('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0xecc0('0x1d')](function(_0x532086){var _0x4d8995=_0x38274c[_0xecc0('0x46')][_0xecc0('0x1f')]({'plain':!![]});if(!_0x4d8995)throw new Error(_0xecc0('0x47'));if(_0x4d8995[_0xecc0('0x48')]==='user'){var _0x44a2b7=_0x532086[_0xecc0('0x1f')]({'plain':!![]});var _0x43cda5=_0xecc0('0x49');return db['UserProfileSection'][_0xecc0('0x4b')]({'where':{'name':_0x43cda5,'userProfileId':_0x4d8995['userProfileId']},'raw':!![]})[_0xecc0('0x1d')](function(_0x459326){if(_0x459326&&_0x459326[_0xecc0('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x44a2b7['name'],'resourceId':_0x44a2b7['id'],'type':_0x459326['name'],'sectionId':_0x459326['id']},{})[_0xecc0('0x1d')](function(){return _0x532086;});}else{return _0x532086;}})[_0xecc0('0x41')](function(_0x22dd58){logger[_0xecc0('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22dd58);throw _0x22dd58;});}return _0x532086;});}})[_0xecc0('0x1d')](respondWithResult(_0x2cbb30,0xc9))[_0xecc0('0x41')](handleError(_0x2cbb30,null));};exports[_0xecc0('0x51')]=function(_0x25e600,_0x214122){if(_0x25e600[_0xecc0('0x45')]['id']){delete _0x25e600[_0xecc0('0x45')]['id'];}return db[_0xecc0('0x27')][_0xecc0('0x4b')]({'where':{'id':_0x25e600['params']['id']}})['then'](handleEntityNotFound(_0x214122,null))['then'](saveUpdates(_0x25e600['body'],null))[_0xecc0('0x1d')](respondWithResult(_0x214122,null))[_0xecc0('0x41')](handleError(_0x214122,null));};exports['destroy']=function(_0x2a0f58,_0x1efdb6){return db['JscriptyProject'][_0xecc0('0x4b')]({'where':{'id':_0x2a0f58['params']['id']}})[_0xecc0('0x1d')](handleEntityNotFound(_0x1efdb6,null))[_0xecc0('0x1d')](removeEntity(_0x1efdb6,null))[_0xecc0('0x41')](handleError(_0x1efdb6,null));};exports[_0xecc0('0x52')]=function(_0x2b29ef,_0x3710e8,_0x228f52){var _0xed1961={'raw':!![],'where':{}};var _0x5eebfd={};var _0x4c3a9c={'count':0x0,'rows':[]};return db[_0xecc0('0x27')][_0xecc0('0x53')]({'where':{'id':_0x2b29ef[_0xecc0('0x42')]['id']}})[_0xecc0('0x1d')](handleEntityNotFound(_0x3710e8,null))[_0xecc0('0x1d')](function(_0x1c40a8){if(_0x1c40a8){_0x5eebfd[_0xecc0('0x2b')]=_[_0xecc0('0x2d')](db[_0xecc0('0x54')]['rawAttributes']);_0x5eebfd[_0xecc0('0x2c')]=_['keys'](_0x2b29ef[_0xecc0('0x2c')]);_0x5eebfd[_0xecc0('0x2e')]=_[_0xecc0('0x2f')](_0x5eebfd['model'],_0x5eebfd[_0xecc0('0x2c')]);_0xed1961[_0xecc0('0x30')]=_[_0xecc0('0x2f')](_0x5eebfd[_0xecc0('0x2b')],qs[_0xecc0('0x31')](_0x2b29ef[_0xecc0('0x2c')][_0xecc0('0x31')]));_0xed1961[_0xecc0('0x30')]=_0xed1961[_0xecc0('0x30')][_0xecc0('0x32')]?_0xed1961[_0xecc0('0x30')]:_0x5eebfd[_0xecc0('0x2b')];if(!_0x2b29ef[_0xecc0('0x2c')]['hasOwnProperty'](_0xecc0('0x55'))){_0xed1961['limit']=qs[_0xecc0('0x34')](_0x2b29ef[_0xecc0('0x2c')][_0xecc0('0x34')]);_0xed1961['offset']=qs[_0xecc0('0x19')](_0x2b29ef[_0xecc0('0x2c')][_0xecc0('0x19')]);}_0xed1961['order']=qs[_0xecc0('0x36')](_0x2b29ef[_0xecc0('0x2c')][_0xecc0('0x36')]);_0xed1961[_0xecc0('0x37')]=qs[_0xecc0('0x2e')](_[_0xecc0('0x38')](_0x2b29ef['query'],_0x5eebfd[_0xecc0('0x2e')]));_0xed1961[_0xecc0('0x37')][_0xecc0('0x56')]=_0x1c40a8['id'];if(_0x2b29ef[_0xecc0('0x2c')]['filter']){_0xed1961['where']=_[_0xecc0('0x3a')](_0xed1961[_0xecc0('0x37')],{'$or':_['map'](_0xed1961['attributes'],function(_0x270866){var _0x56696b={};_0x56696b[_0x270866]={'$like':'%'+_0x2b29ef['query']['filter']+'%'};return _0x56696b;})});}_0xed1961=_['merge']({},_0xed1961,_0x2b29ef['options']);return db[_0xecc0('0x54')][_0xecc0('0x3d')]({'where':_0xed1961['where']})[_0xecc0('0x1d')](function(_0x165962){_0x4c3a9c['count']=_0x165962;if(_0x2b29ef[_0xecc0('0x2c')][_0xecc0('0x3e')]){_0xed1961[_0xecc0('0x43')]=[{'all':!![]}];}return db[_0xecc0('0x54')]['findAll'](_0xed1961);})[_0xecc0('0x1d')](function(_0x3ce60f){_0x4c3a9c[_0xecc0('0x40')]=_0x3ce60f;return _0x4c3a9c;});}})[_0xecc0('0x1d')](respondWithFilteredResult(_0x3710e8,_0xed1961))[_0xecc0('0x41')](handleError(_0x3710e8,null));};exports[_0xecc0('0x57')]=function(_0x146a2c,_0xf49e3f,_0x39571f){var _0x5a41b0={'raw':!![],'where':{}};var _0x59c65f={};var _0x1d7a82={'count':0x0,'rows':[]};return db[_0xecc0('0x27')][_0xecc0('0x53')]({'where':{'id':_0x146a2c['params']['id']}})[_0xecc0('0x1d')](handleEntityNotFound(_0xf49e3f,null))[_0xecc0('0x1d')](function(_0x2a96ab){if(_0x2a96ab){_0x59c65f['model']=_[_0xecc0('0x2d')](db['JscriptyAnswerReport'][_0xecc0('0x28')]);_0x59c65f[_0xecc0('0x2c')]=_[_0xecc0('0x2d')](_0x146a2c[_0xecc0('0x2c')]);_0x59c65f[_0xecc0('0x2e')]=_[_0xecc0('0x2f')](_0x59c65f[_0xecc0('0x2b')],_0x59c65f[_0xecc0('0x2c')]);_0x5a41b0['attributes']=_[_0xecc0('0x2f')](_0x59c65f[_0xecc0('0x2b')],qs[_0xecc0('0x31')](_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x31')]));_0x5a41b0[_0xecc0('0x30')]=_0x5a41b0[_0xecc0('0x30')]['length']?_0x5a41b0[_0xecc0('0x30')]:_0x59c65f[_0xecc0('0x2b')];if(!_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x33')](_0xecc0('0x55'))){_0x5a41b0[_0xecc0('0x34')]=qs['limit'](_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x34')]);_0x5a41b0['offset']=qs[_0xecc0('0x19')](_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x19')]);}_0x5a41b0[_0xecc0('0x35')]=qs[_0xecc0('0x36')](_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x36')]);_0x5a41b0[_0xecc0('0x37')]=qs[_0xecc0('0x2e')](_[_0xecc0('0x38')](_0x146a2c[_0xecc0('0x2c')],_0x59c65f['filters']));_0x5a41b0['where'][_0xecc0('0x56')]=_0x2a96ab['id'];if(_0x146a2c[_0xecc0('0x2c')]['filter']){_0x5a41b0[_0xecc0('0x37')]=_['merge'](_0x5a41b0[_0xecc0('0x37')],{'$or':_[_0xecc0('0x26')](_0x5a41b0['attributes'],function(_0x540940){var _0x23aceb={};_0x23aceb[_0x540940]={'$like':'%'+_0x146a2c['query'][_0xecc0('0x39')]+'%'};return _0x23aceb;})});}_0x5a41b0=_[_0xecc0('0x3a')]({},_0x5a41b0,_0x146a2c['options']);return db['JscriptyAnswerReport'][_0xecc0('0x3d')]({'where':_0x5a41b0[_0xecc0('0x37')]})['then'](function(_0x3437d3){_0x1d7a82[_0xecc0('0x3d')]=_0x3437d3;if(_0x146a2c[_0xecc0('0x2c')][_0xecc0('0x3e')]){_0x5a41b0['include']=[{'all':!![]}];}return db[_0xecc0('0x58')]['findAll'](_0x5a41b0);})['then'](function(_0x4f5f2d){_0x1d7a82[_0xecc0('0x40')]=_0x4f5f2d;return _0x1d7a82;});}})[_0xecc0('0x1d')](respondWithFilteredResult(_0xf49e3f,_0x5a41b0))[_0xecc0('0x41')](handleError(_0xf49e3f,null));};function char(_0x613a54){return _0xecc0('0x59')===typeof _0x613a54?String['fromCharCode'][_0xecc0('0x1c')](null,arguments):_0x613a54;}function needsEncapsulation(_0x557269){return!!_0x557269&&(_0x557269[_0xecc0('0x5a')]()['indexOf'](char(0xd))>=0x0||_0x557269['toString']()[_0xecc0('0x5b')](char(0xa))>=0x0||_0x557269[_0xecc0('0x5a')]()['indexOf'](char(0x2c))>=0x0||_0x557269['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4af946){var _0x104419=char(0x22),_0x245804='\x5c'+char(0x22),_0x5e413a=_0x4af946[_0xecc0('0x5a')]()[_0xecc0('0x5c')](new RegExp(_0x104419,'g'),_0x245804);return _0x104419+_0x5e413a+_0x104419;}exports[_0xecc0('0x5d')]=function(_0x4b651f,_0x173076,_0x5d9d42){var _0x39b937,_0x29935f;var _0x36a1d8={'where':{'ProjectId':_0x4b651f[_0xecc0('0x42')]['id']}};if(_0x4b651f[_0xecc0('0x2c')][_0xecc0('0x5e')]){_0x36a1d8[_0xecc0('0x37')]['starttime']=JSON[_0xecc0('0x5f')](_0x4b651f['query'][_0xecc0('0x5e')]);}return db[_0xecc0('0x54')][_0xecc0('0x3f')](_0x36a1d8)[_0xecc0('0x1d')](handleEntityNotFound(_0x173076,null))[_0xecc0('0x1d')](function(_0x51ddf4){if(_0x51ddf4){_0x39b937=_0x51ddf4;return db[_0xecc0('0x60')][_0xecc0('0x3f')]({'where':{'SessionId':{'$in':_[_0xecc0('0x26')](_0x39b937,'id')},'ProjectId':_0x4b651f[_0xecc0('0x42')]['id']},'order':_0xecc0('0x61')});}})[_0xecc0('0x1d')](handleEntityNotFound(_0x173076,null))['then'](function(_0x4ca4cd){if(_0x4ca4cd){_0x29935f=_0x4ca4cd;var _0x218c58={};for(var _0x49d766=0x0,_0x6741e8=_0x29935f[_0xecc0('0x32')];_0x49d766<_0x6741e8;_0x49d766++){if(!_0x218c58['hasOwnProperty'](_0x29935f[_0x49d766][_0xecc0('0x62')])){_0x218c58[_0x29935f[_0x49d766][_0xecc0('0x62')]]=needsEncapsulation(_0x29935f[_0x49d766]['question'])?encapsulate(_0x29935f[_0x49d766][_0xecc0('0x63')]):_0x29935f[_0x49d766][_0xecc0('0x63')];}}var _0x1a4982=[],_0x394b2a={};for(var _0x35e208=0x0,_0x97fabe=_0x39b937['length'];_0x35e208<_0x97fabe;_0x35e208++){_0x394b2a={'ProjectId':_0x4b651f[_0xecc0('0x42')]['id'],'SessionId':_0x39b937[_0x35e208]['id'],'StartTime':moment(_0x39b937[_0x35e208][_0xecc0('0x64')])[_0xecc0('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2a8db9=0x0,_0x202b4c=_0x29935f[_0xecc0('0x32')];_0x2a8db9<_0x202b4c;_0x2a8db9++){if(_0x29935f[_0x2a8db9][_0xecc0('0x66')]==_0x39b937[_0x35e208]['id']&&_0x218c58['hasOwnProperty'](_0x29935f[_0x2a8db9][_0xecc0('0x62')])){_0x394b2a[_0x218c58[_0x29935f[_0x2a8db9]['questionId']]]=_0x29935f[_0x2a8db9][_0xecc0('0x67')];}}for(var _0x5823c9 in _0x218c58){if(!_0x394b2a[_0xecc0('0x33')](_0x218c58[_0x5823c9])){_0x394b2a[_0x218c58[_0x5823c9]]=null;}}_0x1a4982[_0xecc0('0x68')](_0x394b2a);}return _0x1a4982;}})[_0xecc0('0x1d')](function(_0x38d2ee){if(!_[_0xecc0('0x69')](_0x38d2ee)){var _0x2e9c41=toCsv(_0x38d2ee);var _0x346e19=Date['now']();fs[_0xecc0('0x6a')](util['format'](_0xecc0('0x6b'),_0x4b651f[_0xecc0('0x42')]['id'],_0x346e19),_0x2e9c41);_0x173076[_0xecc0('0x6c')](_0xecc0('0x6d'),_0xecc0('0x6e')+util[_0xecc0('0x65')](_0xecc0('0x6f'),_0x4b651f['params']['id'],_0x346e19));_0x173076[_0xecc0('0x6c')](_0xecc0('0x70'),_0xecc0('0x71'));return _0x173076[_0xecc0('0x72')](util['format'](_0xecc0('0x6b'),_0x4b651f[_0xecc0('0x42')]['id'],_0x346e19));}else{return _0x173076[_0xecc0('0x15')](0xcc);}})['catch'](handleError(_0x173076,null));}; \ No newline at end of file +var _0xa2bc=['fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','JscriptyProject','include','findAll','catch','show','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','options','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','nolimit','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','index','map','rawAttributes'];(function(_0xd3530a,_0x5882b0){var _0x3a86e6=function(_0x33991f){while(--_0x33991f){_0xd3530a['push'](_0xd3530a['shift']());}};_0x3a86e6(++_0x5882b0);}(_0xa2bc,0xbb));var _0xca2b=function(_0x249fc2,_0x52c16b){_0x249fc2=_0x249fc2-0x0;var _0x4c1320=_0xa2bc[_0x249fc2];return _0x4c1320;};'use strict';var pdf=require(_0xca2b('0x0'));var emlformat=require(_0xca2b('0x1'));var rimraf=require(_0xca2b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca2b('0x3'));var rp=require(_0xca2b('0x4'));var moment=require(_0xca2b('0x5'));var BPromise=require(_0xca2b('0x6'));var Mustache=require(_0xca2b('0x7'));var util=require(_0xca2b('0x8'));var path=require('path');var sox=require(_0xca2b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xca2b('0xa'));var squel=require(_0xca2b('0xb'));var crypto=require(_0xca2b('0xc'));var jsforce=require(_0xca2b('0xd'));var deskjs=require(_0xca2b('0xe'));var toCsv=require(_0xca2b('0xf'));var querystring=require(_0xca2b('0x10'));var Papa=require('papaparse');var Redis=require(_0xca2b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca2b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca2b('0x13'))(_0xca2b('0x14'));var utils=require(_0xca2b('0x15'));var config=require(_0xca2b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a7ebf,_0x248612){_0x248612=_0x248612||0xcc;return function(_0x2693d4){if(_0x2693d4){return _0x5a7ebf[_0xca2b('0x17')](_0x248612);}return _0x5a7ebf[_0xca2b('0x18')](_0x248612)[_0xca2b('0x19')]();};}function respondWithResult(_0x37f3e6,_0x8ad80c){_0x8ad80c=_0x8ad80c||0xc8;return function(_0x2f31da){if(_0x2f31da){return _0x37f3e6[_0xca2b('0x18')](_0x8ad80c)['json'](_0x2f31da);}};}function respondWithFilteredResult(_0x18f4ea,_0x322b79){return function(_0x3ecd95){if(_0x3ecd95){var _0x5cbf4b=_0x3ecd95[_0xca2b('0x1a')],_0x4beb70=_0x322b79['offset'],_0x158586=_0x322b79[_0xca2b('0x1b')]+_0x322b79[_0xca2b('0x1c')],_0x16d057;if(_0x158586>=_0x5cbf4b){_0x158586=_0x5cbf4b;_0x16d057=0xc8;}else{_0x16d057=0xce;}_0x18f4ea[_0xca2b('0x18')](_0x16d057);return _0x18f4ea[_0xca2b('0x1d')]('Content-Range',_0x4beb70+'-'+_0x158586+'/'+_0x5cbf4b)['json'](_0x3ecd95);}return null;};}function patchUpdates(_0x21b624){return function(_0x3e7bc5){try{jsonpatch['apply'](_0x3e7bc5,_0x21b624,!![]);}catch(_0x6bc173){return BPromise[_0xca2b('0x1e')](_0x6bc173);}return _0x3e7bc5[_0xca2b('0x1f')]();};}function saveUpdates(_0x457336,_0x4fc0ab){return function(_0x309d06){if(_0x309d06){return _0x309d06[_0xca2b('0x20')](_0x457336)[_0xca2b('0x21')](function(_0x1dc59f){return _0x1dc59f;});}return null;};}function removeEntity(_0x324b83,_0x36f095){return function(_0x155d48){if(_0x155d48){return _0x155d48[_0xca2b('0x22')]()[_0xca2b('0x21')](function(){var _0x45995d=_0x155d48['get']({'plain':!![]});var _0x746d36=_0xca2b('0x23');return db[_0xca2b('0x24')][_0xca2b('0x22')]({'where':{'type':_0x746d36,'resourceId':_0x45995d['id']}})[_0xca2b('0x21')](function(){return _0x155d48;});})['then'](function(){_0x324b83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21905a,_0x216da9){return function(_0x2c7dd){if(!_0x2c7dd){_0x21905a['sendStatus'](0x194);}return _0x2c7dd;};}function handleError(_0x236a0c,_0x247d1a){_0x247d1a=_0x247d1a||0x1f4;return function(_0xe877ff){logger[_0xca2b('0x25')](_0xe877ff[_0xca2b('0x26')]);if(_0xe877ff[_0xca2b('0x27')]){delete _0xe877ff[_0xca2b('0x27')];}_0x236a0c[_0xca2b('0x18')](_0x247d1a)['send'](_0xe877ff);};}exports[_0xca2b('0x28')]=function(_0x306dfa,_0x5c3b77){var _0x712107={},_0x3c7c17={},_0x10868c={'count':0x0,'rows':[]};var _0x5bca15=_[_0xca2b('0x29')](db['JscriptyProject'][_0xca2b('0x2a')],function(_0x81f382){return{'name':_0x81f382[_0xca2b('0x2b')],'type':_0x81f382[_0xca2b('0x2c')][_0xca2b('0x2d')]};});_0x3c7c17['model']=_[_0xca2b('0x29')](_0x5bca15,_0xca2b('0x27'));_0x3c7c17['query']=_[_0xca2b('0x2e')](_0x306dfa[_0xca2b('0x2f')]);_0x3c7c17[_0xca2b('0x30')]=_['intersection'](_0x3c7c17[_0xca2b('0x31')],_0x3c7c17[_0xca2b('0x2f')]);_0x712107[_0xca2b('0x32')]=_[_0xca2b('0x33')](_0x3c7c17[_0xca2b('0x31')],qs[_0xca2b('0x34')](_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x34')]));_0x712107[_0xca2b('0x32')]=_0x712107[_0xca2b('0x32')][_0xca2b('0x35')]?_0x712107[_0xca2b('0x32')]:_0x3c7c17['model'];if(!_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x36')]('nolimit')){_0x712107[_0xca2b('0x1c')]=qs[_0xca2b('0x1c')](_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x1c')]);_0x712107[_0xca2b('0x1b')]=qs['offset'](_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x1b')]);}_0x712107['order']=qs[_0xca2b('0x37')](_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x37')]);_0x712107['where']=qs[_0xca2b('0x30')](_['pick'](_0x306dfa[_0xca2b('0x2f')],_0x3c7c17[_0xca2b('0x30')]),_0x5bca15);if(_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x38')]){_0x712107[_0xca2b('0x39')]=_[_0xca2b('0x3a')](_0x712107[_0xca2b('0x39')],{'$or':_[_0xca2b('0x29')](_0x5bca15,function(_0x5c664c){if(_0x5c664c[_0xca2b('0x2c')]!==_0xca2b('0x3b')){var _0x5ef3d7={};_0x5ef3d7[_0x5c664c[_0xca2b('0x27')]]={'$like':'%'+_0x306dfa[_0xca2b('0x2f')][_0xca2b('0x38')]+'%'};return _0x5ef3d7;}})});}_0x712107=_[_0xca2b('0x3a')]({},_0x712107,_0x306dfa['options']);var _0x7f1900={'where':_0x712107[_0xca2b('0x39')]};return db[_0xca2b('0x3c')][_0xca2b('0x1a')](_0x7f1900)['then'](function(_0x442174){_0x10868c[_0xca2b('0x1a')]=_0x442174;if(_0x306dfa[_0xca2b('0x2f')]['includeAll']){_0x712107[_0xca2b('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0xca2b('0x3e')](_0x712107);})[_0xca2b('0x21')](function(_0x4edfae){_0x10868c['rows']=_0x4edfae;return _0x10868c;})[_0xca2b('0x21')](respondWithFilteredResult(_0x5c3b77,_0x712107))[_0xca2b('0x3f')](handleError(_0x5c3b77,null));};exports[_0xca2b('0x40')]=function(_0xb2beec,_0x1334d0){var _0x8472e4={'raw':![],'where':{'id':_0xb2beec['params']['id']}},_0x354244={};_0x354244[_0xca2b('0x31')]=_[_0xca2b('0x2e')](db[_0xca2b('0x3c')][_0xca2b('0x2a')]);_0x354244[_0xca2b('0x2f')]=_[_0xca2b('0x2e')](_0xb2beec[_0xca2b('0x2f')]);_0x354244[_0xca2b('0x30')]=_[_0xca2b('0x33')](_0x354244[_0xca2b('0x31')],_0x354244[_0xca2b('0x2f')]);_0x8472e4[_0xca2b('0x32')]=_['intersection'](_0x354244[_0xca2b('0x31')],qs[_0xca2b('0x34')](_0xb2beec[_0xca2b('0x2f')][_0xca2b('0x34')]));_0x8472e4[_0xca2b('0x32')]=_0x8472e4[_0xca2b('0x32')]['length']?_0x8472e4[_0xca2b('0x32')]:_0x354244[_0xca2b('0x31')];if(_0xb2beec[_0xca2b('0x2f')]['includeAll']){_0x8472e4[_0xca2b('0x3d')]=[{'all':!![]}];}_0x8472e4=_['merge']({},_0x8472e4,_0xb2beec['options']);return db[_0xca2b('0x3c')][_0xca2b('0x41')](_0x8472e4)[_0xca2b('0x21')](handleEntityNotFound(_0x1334d0,null))['then'](respondWithResult(_0x1334d0,null))[_0xca2b('0x3f')](handleError(_0x1334d0,null));};exports['create']=function(_0x2589f1,_0x48ee25){return db[_0xca2b('0x3c')]['create'](_0x2589f1[_0xca2b('0x42')],{})['then'](function(_0x4d9f15){var _0x50b3d6=_0x2589f1['user'][_0xca2b('0x43')]({'plain':!![]});if(!_0x50b3d6)throw new Error(_0xca2b('0x44'));if(_0x50b3d6[_0xca2b('0x45')]===_0xca2b('0x46')){var _0x1da1bf=_0x4d9f15[_0xca2b('0x43')]({'plain':!![]});var _0x99f621=_0xca2b('0x23');return db[_0xca2b('0x47')][_0xca2b('0x41')]({'where':{'name':_0x99f621,'userProfileId':_0x50b3d6[_0xca2b('0x48')]},'raw':!![]})[_0xca2b('0x21')](function(_0x45d8f7){if(_0x45d8f7&&_0x45d8f7[_0xca2b('0x49')]===0x0){return db[_0xca2b('0x24')][_0xca2b('0x4a')]({'name':_0x1da1bf[_0xca2b('0x27')],'resourceId':_0x1da1bf['id'],'type':_0x45d8f7[_0xca2b('0x27')],'sectionId':_0x45d8f7['id']},{})[_0xca2b('0x21')](function(){return _0x4d9f15;});}else{return _0x4d9f15;}})[_0xca2b('0x3f')](function(_0x257d39){logger[_0xca2b('0x25')](_0xca2b('0x4b'),_0x257d39);throw _0x257d39;});}return _0x4d9f15;})[_0xca2b('0x21')](respondWithResult(_0x48ee25,0xc9))['catch'](handleError(_0x48ee25,null));};exports[_0xca2b('0x4c')]=function(_0x49bb4a,_0x4ee3ed){var _0x15eab3={'where':{'id':_0x49bb4a[_0xca2b('0x4d')]['id']}},_0x46aeda={};_0x46aeda[_0xca2b('0x31')]=_[_0xca2b('0x2e')](db[_0xca2b('0x3c')]['rawAttributes']);_0x15eab3[_0xca2b('0x32')]=_[_0xca2b('0x33')](_0x46aeda[_0xca2b('0x31')],qs[_0xca2b('0x34')](_0x49bb4a[_0xca2b('0x2f')][_0xca2b('0x34')]));_0x15eab3[_0xca2b('0x32')]=_0x15eab3[_0xca2b('0x32')][_0xca2b('0x35')]?_0x15eab3[_0xca2b('0x32')]:_0x46aeda[_0xca2b('0x31')];if(_0x49bb4a[_0xca2b('0x2f')][_0xca2b('0x4e')]){_0x15eab3[_0xca2b('0x3d')]=[{'all':!![]}];}_0x15eab3=_['merge']({},_0x15eab3,_0x49bb4a[_0xca2b('0x4f')]);return db[_0xca2b('0x3c')][_0xca2b('0x41')](_0x15eab3)[_0xca2b('0x21')](handleEntityNotFound(_0x4ee3ed,null))[_0xca2b('0x21')](function(_0x351a93){if(_0x351a93){var _0x36f094=_0x351a93[_0xca2b('0x43')]({'plain':!![]});_0x36f094=qs[_0xca2b('0x50')](_0x36f094,['id',_0xca2b('0x51'),'updatedAt']);_0x49bb4a[_0xca2b('0x42')]=_[_0xca2b('0x50')](_0x49bb4a[_0xca2b('0x42')],['id',_0xca2b('0x51'),_0xca2b('0x52')]);return db[_0xca2b('0x3c')]['create'](_[_0xca2b('0x3a')](_0x36f094,_0x49bb4a[_0xca2b('0x42')]),{'include':_0x49bb4a[_0xca2b('0x2f')][_0xca2b('0x4e')]?[{'all':!![]}]:undefined})[_0xca2b('0x21')](function(_0x47e77c){var _0x3c47b0=_0x49bb4a[_0xca2b('0x46')][_0xca2b('0x43')]({'plain':!![]});if(!_0x3c47b0)throw new Error(_0xca2b('0x44'));if(_0x3c47b0[_0xca2b('0x45')]===_0xca2b('0x46')){var _0xa45ca8=_0x47e77c['get']({'plain':!![]});var _0x21df43=_0xca2b('0x23');return db[_0xca2b('0x47')][_0xca2b('0x41')]({'where':{'name':_0x21df43,'userProfileId':_0x3c47b0[_0xca2b('0x48')]},'raw':!![]})[_0xca2b('0x21')](function(_0x609261){if(_0x609261&&_0x609261[_0xca2b('0x49')]===0x0){return db['UserProfileResource'][_0xca2b('0x4a')]({'name':_0xa45ca8['name'],'resourceId':_0xa45ca8['id'],'type':_0x609261[_0xca2b('0x27')],'sectionId':_0x609261['id']},{})[_0xca2b('0x21')](function(){return _0x47e77c;});}else{return _0x47e77c;}})[_0xca2b('0x3f')](function(_0x5dbddc){logger[_0xca2b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dbddc);throw _0x5dbddc;});}return _0x47e77c;});}})[_0xca2b('0x21')](respondWithResult(_0x4ee3ed,0xc9))[_0xca2b('0x3f')](handleError(_0x4ee3ed,null));};exports[_0xca2b('0x20')]=function(_0x5b1652,_0x287558){if(_0x5b1652[_0xca2b('0x42')]['id']){delete _0x5b1652[_0xca2b('0x42')]['id'];}return db[_0xca2b('0x3c')]['find']({'where':{'id':_0x5b1652[_0xca2b('0x4d')]['id']}})[_0xca2b('0x21')](handleEntityNotFound(_0x287558,null))[_0xca2b('0x21')](saveUpdates(_0x5b1652[_0xca2b('0x42')],null))[_0xca2b('0x21')](respondWithResult(_0x287558,null))[_0xca2b('0x3f')](handleError(_0x287558,null));};exports[_0xca2b('0x22')]=function(_0x14d083,_0x54c6b5){return db[_0xca2b('0x3c')][_0xca2b('0x41')]({'where':{'id':_0x14d083[_0xca2b('0x4d')]['id']}})[_0xca2b('0x21')](handleEntityNotFound(_0x54c6b5,null))[_0xca2b('0x21')](removeEntity(_0x54c6b5,null))[_0xca2b('0x3f')](handleError(_0x54c6b5,null));};exports[_0xca2b('0x53')]=function(_0x52992e,_0x1d4ec7,_0x1542d8){var _0x594151={'raw':!![],'where':{}};var _0x3a2f46={};var _0x38cfa8={'count':0x0,'rows':[]};return db[_0xca2b('0x3c')][_0xca2b('0x54')]({'where':{'id':_0x52992e['params']['id']}})[_0xca2b('0x21')](handleEntityNotFound(_0x1d4ec7,null))[_0xca2b('0x21')](function(_0x36a9cc){if(_0x36a9cc){_0x3a2f46['model']=_['keys'](db[_0xca2b('0x55')][_0xca2b('0x2a')]);_0x3a2f46[_0xca2b('0x2f')]=_[_0xca2b('0x2e')](_0x52992e['query']);_0x3a2f46[_0xca2b('0x30')]=_['intersection'](_0x3a2f46[_0xca2b('0x31')],_0x3a2f46[_0xca2b('0x2f')]);_0x594151[_0xca2b('0x32')]=_[_0xca2b('0x33')](_0x3a2f46['model'],qs[_0xca2b('0x34')](_0x52992e[_0xca2b('0x2f')][_0xca2b('0x34')]));_0x594151[_0xca2b('0x32')]=_0x594151['attributes'][_0xca2b('0x35')]?_0x594151[_0xca2b('0x32')]:_0x3a2f46[_0xca2b('0x31')];if(!_0x52992e[_0xca2b('0x2f')][_0xca2b('0x36')](_0xca2b('0x56'))){_0x594151[_0xca2b('0x1c')]=qs['limit'](_0x52992e['query'][_0xca2b('0x1c')]);_0x594151['offset']=qs[_0xca2b('0x1b')](_0x52992e[_0xca2b('0x2f')][_0xca2b('0x1b')]);}_0x594151['order']=qs['sort'](_0x52992e[_0xca2b('0x2f')]['sort']);_0x594151['where']=qs['filters'](_[_0xca2b('0x57')](_0x52992e[_0xca2b('0x2f')],_0x3a2f46['filters']));_0x594151[_0xca2b('0x39')][_0xca2b('0x58')]=_0x36a9cc['id'];if(_0x52992e['query'][_0xca2b('0x38')]){_0x594151[_0xca2b('0x39')]=_[_0xca2b('0x3a')](_0x594151[_0xca2b('0x39')],{'$or':_[_0xca2b('0x29')](_0x594151['attributes'],function(_0x59ef1e){var _0x41a543={};_0x41a543[_0x59ef1e]={'$like':'%'+_0x52992e[_0xca2b('0x2f')][_0xca2b('0x38')]+'%'};return _0x41a543;})});}_0x594151=_['merge']({},_0x594151,_0x52992e['options']);return db[_0xca2b('0x55')][_0xca2b('0x1a')]({'where':_0x594151['where']})[_0xca2b('0x21')](function(_0x145900){_0x38cfa8[_0xca2b('0x1a')]=_0x145900;if(_0x52992e['query'][_0xca2b('0x4e')]){_0x594151[_0xca2b('0x3d')]=[{'all':!![]}];}return db[_0xca2b('0x55')][_0xca2b('0x3e')](_0x594151);})['then'](function(_0x3d6ef1){_0x38cfa8[_0xca2b('0x59')]=_0x3d6ef1;return _0x38cfa8;});}})[_0xca2b('0x21')](respondWithFilteredResult(_0x1d4ec7,_0x594151))[_0xca2b('0x3f')](handleError(_0x1d4ec7,null));};exports[_0xca2b('0x5a')]=function(_0xf4307b,_0x38cfb2,_0x4c44e7){var _0x2d139d={'raw':!![],'where':{}};var _0x29aa53={};var _0x2641b8={'count':0x0,'rows':[]};return db[_0xca2b('0x3c')]['findOne']({'where':{'id':_0xf4307b[_0xca2b('0x4d')]['id']}})[_0xca2b('0x21')](handleEntityNotFound(_0x38cfb2,null))[_0xca2b('0x21')](function(_0x57a2d5){if(_0x57a2d5){_0x29aa53['model']=_[_0xca2b('0x2e')](db[_0xca2b('0x5b')][_0xca2b('0x2a')]);_0x29aa53['query']=_[_0xca2b('0x2e')](_0xf4307b[_0xca2b('0x2f')]);_0x29aa53[_0xca2b('0x30')]=_[_0xca2b('0x33')](_0x29aa53['model'],_0x29aa53[_0xca2b('0x2f')]);_0x2d139d[_0xca2b('0x32')]=_[_0xca2b('0x33')](_0x29aa53[_0xca2b('0x31')],qs['fields'](_0xf4307b[_0xca2b('0x2f')][_0xca2b('0x34')]));_0x2d139d[_0xca2b('0x32')]=_0x2d139d[_0xca2b('0x32')]['length']?_0x2d139d[_0xca2b('0x32')]:_0x29aa53[_0xca2b('0x31')];if(!_0xf4307b[_0xca2b('0x2f')][_0xca2b('0x36')](_0xca2b('0x56'))){_0x2d139d[_0xca2b('0x1c')]=qs[_0xca2b('0x1c')](_0xf4307b['query'][_0xca2b('0x1c')]);_0x2d139d[_0xca2b('0x1b')]=qs[_0xca2b('0x1b')](_0xf4307b[_0xca2b('0x2f')][_0xca2b('0x1b')]);}_0x2d139d['order']=qs[_0xca2b('0x37')](_0xf4307b[_0xca2b('0x2f')][_0xca2b('0x37')]);_0x2d139d[_0xca2b('0x39')]=qs['filters'](_[_0xca2b('0x57')](_0xf4307b[_0xca2b('0x2f')],_0x29aa53[_0xca2b('0x30')]));_0x2d139d[_0xca2b('0x39')]['ProjectId']=_0x57a2d5['id'];if(_0xf4307b[_0xca2b('0x2f')][_0xca2b('0x38')]){_0x2d139d[_0xca2b('0x39')]=_[_0xca2b('0x3a')](_0x2d139d[_0xca2b('0x39')],{'$or':_[_0xca2b('0x29')](_0x2d139d[_0xca2b('0x32')],function(_0x1188ad){var _0x38142c={};_0x38142c[_0x1188ad]={'$like':'%'+_0xf4307b[_0xca2b('0x2f')]['filter']+'%'};return _0x38142c;})});}_0x2d139d=_[_0xca2b('0x3a')]({},_0x2d139d,_0xf4307b['options']);return db[_0xca2b('0x5b')][_0xca2b('0x1a')]({'where':_0x2d139d[_0xca2b('0x39')]})[_0xca2b('0x21')](function(_0x21abf5){_0x2641b8[_0xca2b('0x1a')]=_0x21abf5;if(_0xf4307b[_0xca2b('0x2f')]['includeAll']){_0x2d139d['include']=[{'all':!![]}];}return db[_0xca2b('0x5b')]['findAll'](_0x2d139d);})[_0xca2b('0x21')](function(_0x221f1b){_0x2641b8[_0xca2b('0x59')]=_0x221f1b;return _0x2641b8;});}})[_0xca2b('0x21')](respondWithFilteredResult(_0x38cfb2,_0x2d139d))[_0xca2b('0x3f')](handleError(_0x38cfb2,null));};function char(_0x5951fb){return'number'===typeof _0x5951fb?String[_0xca2b('0x5c')]['apply'](null,arguments):_0x5951fb;}function needsEncapsulation(_0x4037c7){return!!_0x4037c7&&(_0x4037c7[_0xca2b('0x5d')]()[_0xca2b('0x5e')](char(0xd))>=0x0||_0x4037c7[_0xca2b('0x5d')]()[_0xca2b('0x5e')](char(0xa))>=0x0||_0x4037c7[_0xca2b('0x5d')]()[_0xca2b('0x5e')](char(0x2c))>=0x0||_0x4037c7[_0xca2b('0x5d')]()[_0xca2b('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x521abe){var _0x2d270d=char(0x22),_0x8443db='\x5c'+char(0x22),_0x4a0ed7=_0x521abe[_0xca2b('0x5d')]()[_0xca2b('0x5f')](new RegExp(_0x2d270d,'g'),_0x8443db);return _0x2d270d+_0x4a0ed7+_0x2d270d;}exports[_0xca2b('0x60')]=function(_0x9294bb,_0x405e14,_0x56b9a8){var _0x455c2f,_0x3629cb;var _0x6fb303={'where':{'ProjectId':_0x9294bb[_0xca2b('0x4d')]['id']}};if(_0x9294bb[_0xca2b('0x2f')][_0xca2b('0x61')]){_0x6fb303['where']['starttime']=JSON[_0xca2b('0x62')](_0x9294bb[_0xca2b('0x2f')][_0xca2b('0x61')]);}return db[_0xca2b('0x55')][_0xca2b('0x3e')](_0x6fb303)['then'](handleEntityNotFound(_0x405e14,null))[_0xca2b('0x21')](function(_0x3c5535){if(_0x3c5535){_0x455c2f=_0x3c5535;return db[_0xca2b('0x63')][_0xca2b('0x3e')]({'where':{'SessionId':{'$in':_[_0xca2b('0x29')](_0x455c2f,'id')},'ProjectId':_0x9294bb[_0xca2b('0x4d')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x405e14,null))[_0xca2b('0x21')](function(_0x3ecd54){if(_0x3ecd54){_0x3629cb=_0x3ecd54;var _0x5bfc00={};for(var _0x33084f=0x0,_0x412656=_0x3629cb[_0xca2b('0x35')];_0x33084f<_0x412656;_0x33084f++){if(!_0x5bfc00['hasOwnProperty'](_0x3629cb[_0x33084f][_0xca2b('0x64')])){_0x5bfc00[_0x3629cb[_0x33084f][_0xca2b('0x64')]]=needsEncapsulation(_0x3629cb[_0x33084f][_0xca2b('0x65')])?encapsulate(_0x3629cb[_0x33084f][_0xca2b('0x65')]):_0x3629cb[_0x33084f][_0xca2b('0x65')];}}var _0x23f357=[],_0x5834ce={};for(var _0x3f06d3=0x0,_0x196ac2=_0x455c2f[_0xca2b('0x35')];_0x3f06d3<_0x196ac2;_0x3f06d3++){_0x5834ce={'ProjectId':_0x9294bb[_0xca2b('0x4d')]['id'],'SessionId':_0x455c2f[_0x3f06d3]['id'],'StartTime':moment(_0x455c2f[_0x3f06d3]['starttime'])[_0xca2b('0x66')](_0xca2b('0x67'))};for(var _0x13b95d=0x0,_0x317534=_0x3629cb['length'];_0x13b95d<_0x317534;_0x13b95d++){if(_0x3629cb[_0x13b95d][_0xca2b('0x68')]==_0x455c2f[_0x3f06d3]['id']&&_0x5bfc00[_0xca2b('0x36')](_0x3629cb[_0x13b95d]['questionId'])){_0x5834ce[_0x5bfc00[_0x3629cb[_0x13b95d][_0xca2b('0x64')]]]=_0x3629cb[_0x13b95d][_0xca2b('0x69')];}}for(var _0x52793d in _0x5bfc00){if(!_0x5834ce[_0xca2b('0x36')](_0x5bfc00[_0x52793d])){_0x5834ce[_0x5bfc00[_0x52793d]]=null;}}_0x23f357['push'](_0x5834ce);}return _0x23f357;}})[_0xca2b('0x21')](function(_0x4ae7ad){if(!_[_0xca2b('0x6a')](_0x4ae7ad)){var _0x188ca0=toCsv(_0x4ae7ad);var _0x4ca462=Date[_0xca2b('0x6b')]();fs['writeFileSync'](util[_0xca2b('0x66')](_0xca2b('0x6c'),_0x9294bb[_0xca2b('0x4d')]['id'],_0x4ca462),_0x188ca0);_0x405e14['setHeader'](_0xca2b('0x6d'),_0xca2b('0x6e')+util[_0xca2b('0x66')](_0xca2b('0x6f'),_0x9294bb['params']['id'],_0x4ca462));_0x405e14[_0xca2b('0x70')](_0xca2b('0x71'),_0xca2b('0x72'));return _0x405e14['download'](util[_0xca2b('0x66')](_0xca2b('0x6c'),_0x9294bb['params']['id'],_0x4ca462));}else{return _0x405e14['sendStatus'](0xcc);}})['catch'](handleError(_0x405e14,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 985c640..bfa4fe4 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 _0xbd32=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x213740,_0x2cae86){var _0x357cd9=function(_0x2b6581){while(--_0x2b6581){_0x213740['push'](_0x213740['shift']());}};_0x357cd9(++_0x2cae86);}(_0xbd32,0xdc));var _0x2bd3=function(_0x458c69,_0xb5f56){_0x458c69=_0x458c69-0x0;var _0x2e11eb=_0xbd32[_0x458c69];return _0x2e11eb;};'use strict';var _=require(_0x2bd3('0x0'));var util=require(_0x2bd3('0x1'));var logger=require(_0x2bd3('0x2'))(_0x2bd3('0x3'));var moment=require(_0x2bd3('0x4'));var BPromise=require(_0x2bd3('0x5'));var rp=require(_0x2bd3('0x6'));var fs=require('fs');var path=require(_0x2bd3('0x7'));var rimraf=require(_0x2bd3('0x8'));var config=require(_0x2bd3('0x9'));var attributes=require(_0x2bd3('0xa'));module[_0x2bd3('0xb')]=function(_0x1dd9d7,_0x418641){return _0x1dd9d7['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065c=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x1b8bc6,_0x4672de){var _0x17b6bd=function(_0x2ab866){while(--_0x2ab866){_0x1b8bc6['push'](_0x1b8bc6['shift']());}};_0x17b6bd(++_0x4672de);}(_0x065c,0x16e));var _0xc065=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x065c[_0x81e39d];return _0x548fbb;};'use strict';var _=require(_0xc065('0x0'));var util=require(_0xc065('0x1'));var logger=require(_0xc065('0x2'))(_0xc065('0x3'));var moment=require('moment');var BPromise=require(_0xc065('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc065('0x5'));var rimraf=require(_0xc065('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xc065('0x7')]=function(_0xb40e69,_0x1a5f5f){return _0xb40e69[_0xc065('0x8')](_0xc065('0x9'),attributes,{'tableName':_0xc065('0xa'),'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 113bad5..20d2248 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 _0xd714=['client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0xd714,0xed));var _0x4d71=function(_0x37a0ab,_0x34b900){_0x37a0ab=_0x37a0ab-0x0;var _0x13ca1d=_0xd714[_0x37a0ab];return _0x13ca1d;};'use strict';var _=require('lodash');var util=require(_0x4d71('0x0'));var moment=require(_0x4d71('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d71('0x2'));var fs=require('fs');var Redis=require(_0x4d71('0x3'));var db=require(_0x4d71('0x4'))['db'];var utils=require(_0x4d71('0x5'));var logger=require(_0x4d71('0x6'))(_0x4d71('0x7'));var config=require(_0x4d71('0x8'));var jayson=require(_0x4d71('0x9'));var client=jayson[_0x4d71('0xa')][_0x4d71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15ef40,_0x5c456b,_0x18eb14){return new BPromise(function(_0xf4254f,_0x11071e){return client['request'](_0x15ef40,_0x18eb14)[_0x4d71('0xc')](function(_0x2b02c0){logger[_0x4d71('0xd')](_0x4d71('0xe'),_0x5c456b,_0x4d71('0xf'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x5c456b,_0x4d71('0xf'),JSON[_0x4d71('0x10')](_0x2b02c0));if(_0x2b02c0['error']){if(_0x2b02c0['error']['code']===0x1f4){logger[_0x4d71('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x5c456b,_0x2b02c0['error'][_0x4d71('0x12')]);return _0x11071e(_0x2b02c0['error'][_0x4d71('0x12')]);}logger[_0x4d71('0x11')](_0x4d71('0xe'),_0x5c456b,_0x2b02c0[_0x4d71('0x11')]['message']);return _0xf4254f(_0x2b02c0[_0x4d71('0x11')][_0x4d71('0x12')]);}else{logger[_0x4d71('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x5c456b,_0x4d71('0xf'));_0xf4254f(_0x2b02c0['result']['message']);}})['catch'](function(_0x308844){logger[_0x4d71('0x11')](_0x4d71('0xe'),_0x5c456b,_0x308844);_0x11071e(_0x308844);});});} \ No newline at end of file +var _0xad42=['client','request\x20sent','debug','error','code','message','info','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c6b4f,_0x4e5731){var _0x125ea6=function(_0x19f070){while(--_0x19f070){_0x3c6b4f['push'](_0x3c6b4f['shift']());}};_0x125ea6(++_0x4e5731);}(_0xad42,0x1a1));var _0x2ad4=function(_0x5c0767,_0x1c43e8){_0x5c0767=_0x5c0767-0x0;var _0x28786f=_0xad42[_0x5c0767];return _0x28786f;};'use strict';var _=require(_0x2ad4('0x0'));var util=require(_0x2ad4('0x1'));var moment=require(_0x2ad4('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(_0x2ad4('0x3'));var logger=require(_0x2ad4('0x4'))(_0x2ad4('0x5'));var config=require(_0x2ad4('0x6'));var jayson=require(_0x2ad4('0x7'));var client=jayson[_0x2ad4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5d02,_0x40dcbf,_0x42604f){return new BPromise(function(_0x44f2fc,_0x4c2442){return client['request'](_0x4a5d02,_0x42604f)['then'](function(_0x394c51){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x40dcbf,_0x2ad4('0x9'));logger[_0x2ad4('0xa')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x40dcbf,_0x2ad4('0x9'),JSON['stringify'](_0x394c51));if(_0x394c51[_0x2ad4('0xb')]){if(_0x394c51[_0x2ad4('0xb')][_0x2ad4('0xc')]===0x1f4){logger[_0x2ad4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x40dcbf,_0x394c51[_0x2ad4('0xb')]['message']);return _0x4c2442(_0x394c51[_0x2ad4('0xb')][_0x2ad4('0xd')]);}logger[_0x2ad4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x40dcbf,_0x394c51[_0x2ad4('0xb')]['message']);return _0x44f2fc(_0x394c51[_0x2ad4('0xb')][_0x2ad4('0xd')]);}else{logger[_0x2ad4('0xe')](_0x2ad4('0xf'),_0x40dcbf,_0x2ad4('0x9'));_0x44f2fc(_0x394c51['result']['message']);}})[_0x2ad4('0x10')](function(_0x312276){logger[_0x2ad4('0xb')](_0x2ad4('0xf'),_0x40dcbf,_0x312276);_0x4c2442(_0x312276);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 500a482..0e09410 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 _0xede4=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x794207,_0x54a989){var _0x4ee1c9=function(_0x136ea4){while(--_0x136ea4){_0x794207['push'](_0x794207['shift']());}};_0x4ee1c9(++_0x54a989);}(_0xede4,0x11a));var _0x4ede=function(_0x7a4038,_0x5bb396){_0x7a4038=_0x7a4038-0x0;var _0xcd0117=_0xede4[_0x7a4038];return _0xcd0117;};'use strict';var multer=require(_0x4ede('0x0'));var util=require(_0x4ede('0x1'));var path=require(_0x4ede('0x2'));var timeout=require(_0x4ede('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4ede('0x4'));var config=require(_0x4ede('0x5'));var controller=require(_0x4ede('0x6'));router[_0x4ede('0x7')]('/',auth[_0x4ede('0x8')](),controller[_0x4ede('0x9')]);router[_0x4ede('0x7')](_0x4ede('0xa'),auth[_0x4ede('0x8')](),controller[_0x4ede('0xb')]);router[_0x4ede('0x7')](_0x4ede('0xc'),auth['isAuthenticated'](),controller[_0x4ede('0xd')]);router[_0x4ede('0xe')]('/',auth[_0x4ede('0x8')](),controller[_0x4ede('0xf')]);router[_0x4ede('0x10')]('/:id',auth[_0x4ede('0x8')](),controller['update']);router[_0x4ede('0x11')](_0x4ede('0xc'),auth[_0x4ede('0x8')](),controller[_0x4ede('0x12')]);module[_0x4ede('0x13')]=router; \ No newline at end of file +var _0xfaef=['../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xc1b1f0,_0x4d6e2c){var _0x362d34=function(_0x37d448){while(--_0x37d448){_0xc1b1f0['push'](_0xc1b1f0['shift']());}};_0x362d34(++_0x4d6e2c);}(_0xfaef,0x72));var _0xffae=function(_0x3b2307,_0x3e6f11){_0x3b2307=_0x3b2307-0x0;var _0x31e742=_0xfaef[_0x3b2307];return _0x31e742;};'use strict';var multer=require(_0xffae('0x0'));var util=require(_0xffae('0x1'));var path=require(_0xffae('0x2'));var timeout=require(_0xffae('0x3'));var express=require(_0xffae('0x4'));var router=express[_0xffae('0x5')]();var auth=require(_0xffae('0x6'));var interaction=require(_0xffae('0x7'));var config=require('../../config/environment');var controller=require(_0xffae('0x8'));router[_0xffae('0x9')]('/',auth[_0xffae('0xa')](),controller['index']);router['get'](_0xffae('0xb'),auth[_0xffae('0xa')](),controller['describe']);router[_0xffae('0x9')](_0xffae('0xc'),auth[_0xffae('0xa')](),controller[_0xffae('0xd')]);router[_0xffae('0xe')]('/',auth[_0xffae('0xa')](),controller[_0xffae('0xf')]);router[_0xffae('0x10')](_0xffae('0xc'),auth[_0xffae('0xa')](),controller[_0xffae('0x11')]);router['delete'](_0xffae('0xc'),auth[_0xffae('0xa')](),controller[_0xffae('0x12')]);module[_0xffae('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 05c8df7..04e90cc 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 _0xcdb3=['exports','STRING','long','sequelize'];(function(_0x2d0da3,_0x2395ef){var _0x2308e1=function(_0x3c99db){while(--_0x3c99db){_0x2d0da3['push'](_0x2d0da3['shift']());}};_0x2308e1(++_0x2395ef);}(_0xcdb3,0x12f));var _0x3cdb=function(_0x5cc676,_0x36da4a){_0x5cc676=_0x5cc676-0x0;var _0x3c780e=_0xcdb3[_0x5cc676];return _0x3c780e;};'use strict';var Sequelize=require(_0x3cdb('0x0'));module[_0x3cdb('0x1')]={'question':{'type':Sequelize[_0x3cdb('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x3cdb('0x3'))},'membername':{'type':Sequelize[_0x3cdb('0x2')]},'projectname':{'type':Sequelize[_0x3cdb('0x2')]},'queue':{'type':Sequelize[_0x3cdb('0x2')]},'uniqueid':{'type':Sequelize[_0x3cdb('0x2')]},'calleridname':{'type':Sequelize[_0x3cdb('0x2')]},'calleridnum':{'type':Sequelize[_0x3cdb('0x2')]},'questionId':{'type':Sequelize[_0x3cdb('0x2')]}}; \ No newline at end of file +var _0x4496=['TEXT','exports','STRING'];(function(_0x2e87f0,_0x434dc9){var _0x136ccd=function(_0x4e2d23){while(--_0x4e2d23){_0x2e87f0['push'](_0x2e87f0['shift']());}};_0x136ccd(++_0x434dc9);}(_0x4496,0xf7));var _0x6449=function(_0x4a6411,_0x2a02e0){_0x4a6411=_0x4a6411-0x0;var _0x15e96c=_0x4496[_0x4a6411];return _0x15e96c;};'use strict';var Sequelize=require('sequelize');module[_0x6449('0x0')]={'question':{'type':Sequelize[_0x6449('0x1')]},'answer':{'type':Sequelize[_0x6449('0x2')]('long')},'membername':{'type':Sequelize[_0x6449('0x1')]},'projectname':{'type':Sequelize[_0x6449('0x1')]},'queue':{'type':Sequelize[_0x6449('0x1')]},'uniqueid':{'type':Sequelize[_0x6449('0x1')]},'calleridname':{'type':Sequelize[_0x6449('0x1')]},'calleridnum':{'type':Sequelize[_0x6449('0x1')]},'questionId':{'type':Sequelize[_0x6449('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index c423ea2..0149ffd 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 _0xa0df=['set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x42183e,_0x3b3353){var _0x4c1315=function(_0x6af846){while(--_0x6af846){_0x42183e['push'](_0x42183e['shift']());}};_0x4c1315(++_0x3b3353);}(_0xa0df,0x143));var _0xfa0d=function(_0x24d137,_0x859e9e){_0x24d137=_0x24d137-0x0;var _0x12e4bf=_0xa0df[_0x24d137];return _0x12e4bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa0d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa0d('0x2'));var moment=require(_0xfa0d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfa0d('0x4'));var util=require(_0xfa0d('0x5'));var path=require(_0xfa0d('0x6'));var sox=require(_0xfa0d('0x7'));var csv=require('to-csv');var ejs=require(_0xfa0d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfa0d('0x9'));var crypto=require(_0xfa0d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfa0d('0xb'));var Papa=require(_0xfa0d('0xc'));var Redis=require(_0xfa0d('0xd'));var authService=require(_0xfa0d('0xe'));var qs=require(_0xfa0d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa0d('0x10'));var logger=require(_0xfa0d('0x11'))(_0xfa0d('0x12'));var utils=require(_0xfa0d('0x13'));var config=require(_0xfa0d('0x14'));var db=require(_0xfa0d('0x15'))['db'];function respondWithStatusCode(_0x3462f8,_0x20566d){_0x20566d=_0x20566d||0xcc;return function(_0x37bab6){if(_0x37bab6){return _0x3462f8[_0xfa0d('0x16')](_0x20566d);}return _0x3462f8[_0xfa0d('0x17')](_0x20566d)[_0xfa0d('0x18')]();};}function respondWithResult(_0x46123f,_0x1e1634){_0x1e1634=_0x1e1634||0xc8;return function(_0x2a4042){if(_0x2a4042){return _0x46123f['status'](_0x1e1634)['json'](_0x2a4042);}};}function respondWithFilteredResult(_0x33248c,_0x349c6d){return function(_0x142626){if(_0x142626){var _0x4386da=_0x142626[_0xfa0d('0x19')],_0x469b7e=_0x349c6d[_0xfa0d('0x1a')],_0x3486fe=_0x349c6d[_0xfa0d('0x1a')]+_0x349c6d['limit'],_0x152b12;if(_0x3486fe>=_0x4386da){_0x3486fe=_0x4386da;_0x152b12=0xc8;}else{_0x152b12=0xce;}_0x33248c[_0xfa0d('0x17')](_0x152b12);return _0x33248c[_0xfa0d('0x1b')](_0xfa0d('0x1c'),_0x469b7e+'-'+_0x3486fe+'/'+_0x4386da)[_0xfa0d('0x1d')](_0x142626);}return null;};}function patchUpdates(_0x56cc2c){return function(_0x39127f){try{jsonpatch[_0xfa0d('0x1e')](_0x39127f,_0x56cc2c,!![]);}catch(_0x1afaae){return BPromise[_0xfa0d('0x1f')](_0x1afaae);}return _0x39127f['save']();};}function saveUpdates(_0x767b08,_0x3f724f){return function(_0x5234c9){if(_0x5234c9){return _0x5234c9['update'](_0x767b08)['then'](function(_0x222d54){return _0x222d54;});}return null;};}function removeEntity(_0x3b93cd,_0xdca788){return function(_0x9759fb){if(_0x9759fb){return _0x9759fb[_0xfa0d('0x20')]()[_0xfa0d('0x21')](function(){_0x3b93cd[_0xfa0d('0x17')](0xcc)[_0xfa0d('0x18')]();});}};}function handleEntityNotFound(_0x277865,_0x3e26dd){return function(_0xdc8fee){if(!_0xdc8fee){_0x277865[_0xfa0d('0x16')](0x194);}return _0xdc8fee;};}function handleError(_0xe442db,_0x1d89b9){_0x1d89b9=_0x1d89b9||0x1f4;return function(_0x1d4de8){logger[_0xfa0d('0x22')](_0x1d4de8[_0xfa0d('0x23')]);if(_0x1d4de8[_0xfa0d('0x24')]){delete _0x1d4de8[_0xfa0d('0x24')];}_0xe442db[_0xfa0d('0x17')](_0x1d89b9)[_0xfa0d('0x25')](_0x1d4de8);};}exports[_0xfa0d('0x26')]=function(_0x495d69,_0x2d2a75){var _0xb5be32={},_0x125dd6={},_0x2c968f={'count':0x0,'rows':[]};var _0x23c9d2=_[_0xfa0d('0x27')](db[_0xfa0d('0x28')][_0xfa0d('0x29')],function(_0x1ad265){return{'name':_0x1ad265[_0xfa0d('0x2a')],'type':_0x1ad265[_0xfa0d('0x2b')]['key']};});_0x125dd6[_0xfa0d('0x2c')]=_[_0xfa0d('0x27')](_0x23c9d2,_0xfa0d('0x24'));_0x125dd6[_0xfa0d('0x2d')]=_[_0xfa0d('0x2e')](_0x495d69[_0xfa0d('0x2d')]);_0x125dd6[_0xfa0d('0x2f')]=_[_0xfa0d('0x30')](_0x125dd6[_0xfa0d('0x2c')],_0x125dd6[_0xfa0d('0x2d')]);_0xb5be32[_0xfa0d('0x31')]=_[_0xfa0d('0x30')](_0x125dd6['model'],qs[_0xfa0d('0x32')](_0x495d69[_0xfa0d('0x2d')][_0xfa0d('0x32')]));_0xb5be32['attributes']=_0xb5be32['attributes'][_0xfa0d('0x33')]?_0xb5be32[_0xfa0d('0x31')]:_0x125dd6['model'];if(!_0x495d69[_0xfa0d('0x2d')]['hasOwnProperty'](_0xfa0d('0x34'))){_0xb5be32['limit']=qs['limit'](_0x495d69['query']['limit']);_0xb5be32['offset']=qs[_0xfa0d('0x1a')](_0x495d69[_0xfa0d('0x2d')][_0xfa0d('0x1a')]);}_0xb5be32[_0xfa0d('0x35')]=qs['sort'](_0x495d69['query'][_0xfa0d('0x36')]);_0xb5be32[_0xfa0d('0x37')]=qs[_0xfa0d('0x2f')](_['pick'](_0x495d69[_0xfa0d('0x2d')],_0x125dd6[_0xfa0d('0x2f')]),_0x23c9d2);if(_0x495d69[_0xfa0d('0x2d')][_0xfa0d('0x38')]){_0xb5be32['where']=_[_0xfa0d('0x39')](_0xb5be32[_0xfa0d('0x37')],{'$or':_[_0xfa0d('0x27')](_0x23c9d2,function(_0x2aa511){if(_0x2aa511[_0xfa0d('0x2b')]!==_0xfa0d('0x3a')){var _0x2355fc={};_0x2355fc[_0x2aa511[_0xfa0d('0x24')]]={'$like':'%'+_0x495d69['query'][_0xfa0d('0x38')]+'%'};return _0x2355fc;}})});}_0xb5be32=_[_0xfa0d('0x39')]({},_0xb5be32,_0x495d69[_0xfa0d('0x3b')]);var _0x7db683={'where':_0xb5be32[_0xfa0d('0x37')]};return db[_0xfa0d('0x28')][_0xfa0d('0x19')](_0x7db683)[_0xfa0d('0x21')](function(_0x144001){_0x2c968f[_0xfa0d('0x19')]=_0x144001;if(_0x495d69['query'][_0xfa0d('0x3c')]){_0xb5be32[_0xfa0d('0x3d')]=[{'all':!![]}];}return db[_0xfa0d('0x28')][_0xfa0d('0x3e')](_0xb5be32);})[_0xfa0d('0x21')](function(_0x2cba7d){_0x2c968f['rows']=_0x2cba7d;return _0x2c968f;})[_0xfa0d('0x21')](respondWithFilteredResult(_0x2d2a75,_0xb5be32))[_0xfa0d('0x3f')](handleError(_0x2d2a75,null));};exports[_0xfa0d('0x40')]=function(_0x35f71b,_0x3babe0){var _0x2dc37f={'raw':!![],'where':{'id':_0x35f71b[_0xfa0d('0x41')]['id']}},_0x4e04d4={};_0x4e04d4[_0xfa0d('0x2c')]=_['keys'](db[_0xfa0d('0x28')][_0xfa0d('0x29')]);_0x4e04d4[_0xfa0d('0x2d')]=_[_0xfa0d('0x2e')](_0x35f71b['query']);_0x4e04d4[_0xfa0d('0x2f')]=_[_0xfa0d('0x30')](_0x4e04d4['model'],_0x4e04d4[_0xfa0d('0x2d')]);_0x2dc37f[_0xfa0d('0x31')]=_[_0xfa0d('0x30')](_0x4e04d4[_0xfa0d('0x2c')],qs[_0xfa0d('0x32')](_0x35f71b[_0xfa0d('0x2d')]['fields']));_0x2dc37f[_0xfa0d('0x31')]=_0x2dc37f[_0xfa0d('0x31')][_0xfa0d('0x33')]?_0x2dc37f[_0xfa0d('0x31')]:_0x4e04d4[_0xfa0d('0x2c')];if(_0x35f71b[_0xfa0d('0x2d')]['includeAll']){_0x2dc37f[_0xfa0d('0x3d')]=[{'all':!![]}];}_0x2dc37f=_[_0xfa0d('0x39')]({},_0x2dc37f,_0x35f71b[_0xfa0d('0x3b')]);return db[_0xfa0d('0x28')][_0xfa0d('0x42')](_0x2dc37f)[_0xfa0d('0x21')](handleEntityNotFound(_0x3babe0,null))[_0xfa0d('0x21')](respondWithResult(_0x3babe0,null))[_0xfa0d('0x3f')](handleError(_0x3babe0,null));};exports['create']=function(_0x3208b0,_0x563f1d){return db[_0xfa0d('0x28')][_0xfa0d('0x43')](_0x3208b0['body'],{})['then'](respondWithResult(_0x563f1d,0xc9))[_0xfa0d('0x3f')](handleError(_0x563f1d,null));};exports[_0xfa0d('0x44')]=function(_0x3f819f,_0x1bd136){if(_0x3f819f[_0xfa0d('0x45')]['id']){delete _0x3f819f[_0xfa0d('0x45')]['id'];}return db[_0xfa0d('0x28')][_0xfa0d('0x42')]({'where':{'id':_0x3f819f[_0xfa0d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1bd136,null))[_0xfa0d('0x21')](saveUpdates(_0x3f819f['body'],null))[_0xfa0d('0x21')](respondWithResult(_0x1bd136,null))[_0xfa0d('0x3f')](handleError(_0x1bd136,null));};exports[_0xfa0d('0x20')]=function(_0x292240,_0x30498b){return db[_0xfa0d('0x28')][_0xfa0d('0x42')]({'where':{'id':_0x292240[_0xfa0d('0x41')]['id']}})[_0xfa0d('0x21')](handleEntityNotFound(_0x30498b,null))[_0xfa0d('0x21')](removeEntity(_0x30498b,null))['catch'](handleError(_0x30498b,null));};exports['describe']=function(_0x5eb346,_0x57fd5a){return db[_0xfa0d('0x28')]['describe']()[_0xfa0d('0x21')](respondWithResult(_0x57fd5a,null))[_0xfa0d('0x3f')](handleError(_0x57fd5a,null));}; \ No newline at end of file +var _0x9739=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','findAll','catch','show','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4f1fa8,_0x5dce43){var _0x401d68=function(_0x3a5a54){while(--_0x3a5a54){_0x4f1fa8['push'](_0x4f1fa8['shift']());}};_0x401d68(++_0x5dce43);}(_0x9739,0x150));var _0x9973=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0x9739[_0x628eee];return _0x447718;};'use strict';var pdf=require(_0x9973('0x0'));var emlformat=require(_0x9973('0x1'));var rimraf=require(_0x9973('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9973('0x3'));var rp=require(_0x9973('0x4'));var moment=require(_0x9973('0x5'));var BPromise=require(_0x9973('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9973('0x7'));var sox=require(_0x9973('0x8'));var csv=require(_0x9973('0x9'));var ejs=require(_0x9973('0xa'));var fs=require('fs');var _=require(_0x9973('0xb'));var squel=require(_0x9973('0xc'));var crypto=require('crypto');var jsforce=require(_0x9973('0xd'));var deskjs=require(_0x9973('0xe'));var toCsv=require(_0x9973('0x9'));var querystring=require(_0x9973('0xf'));var Papa=require(_0x9973('0x10'));var Redis=require('ioredis');var authService=require(_0x9973('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9973('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9973('0x13'));var utils=require(_0x9973('0x14'));var config=require('../../config/environment');var db=require(_0x9973('0x15'))['db'];function respondWithStatusCode(_0x4c4f3e,_0x525b21){_0x525b21=_0x525b21||0xcc;return function(_0x5ce4e9){if(_0x5ce4e9){return _0x4c4f3e[_0x9973('0x16')](_0x525b21);}return _0x4c4f3e[_0x9973('0x17')](_0x525b21)[_0x9973('0x18')]();};}function respondWithResult(_0x4aceb1,_0x575250){_0x575250=_0x575250||0xc8;return function(_0x402bf3){if(_0x402bf3){return _0x4aceb1[_0x9973('0x17')](_0x575250)[_0x9973('0x19')](_0x402bf3);}};}function respondWithFilteredResult(_0x1162d2,_0x1cb542){return function(_0xb6841a){if(_0xb6841a){var _0x3292c5=_0xb6841a[_0x9973('0x1a')],_0x55c3c1=_0x1cb542['offset'],_0x24be91=_0x1cb542['offset']+_0x1cb542[_0x9973('0x1b')],_0x5e9b89;if(_0x24be91>=_0x3292c5){_0x24be91=_0x3292c5;_0x5e9b89=0xc8;}else{_0x5e9b89=0xce;}_0x1162d2[_0x9973('0x17')](_0x5e9b89);return _0x1162d2['set'](_0x9973('0x1c'),_0x55c3c1+'-'+_0x24be91+'/'+_0x3292c5)[_0x9973('0x19')](_0xb6841a);}return null;};}function patchUpdates(_0x4d8876){return function(_0x44a297){try{jsonpatch['apply'](_0x44a297,_0x4d8876,!![]);}catch(_0xd3be3e){return BPromise[_0x9973('0x1d')](_0xd3be3e);}return _0x44a297[_0x9973('0x1e')]();};}function saveUpdates(_0x3a2a4c,_0x19766b){return function(_0x5bf298){if(_0x5bf298){return _0x5bf298[_0x9973('0x1f')](_0x3a2a4c)[_0x9973('0x20')](function(_0x49a28b){return _0x49a28b;});}return null;};}function removeEntity(_0x25489d,_0x5eb122){return function(_0x3a8b39){if(_0x3a8b39){return _0x3a8b39[_0x9973('0x21')]()[_0x9973('0x20')](function(){_0x25489d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e6577,_0x5c882b){return function(_0x4975ed){if(!_0x4975ed){_0x3e6577['sendStatus'](0x194);}return _0x4975ed;};}function handleError(_0x374aac,_0x4721ba){_0x4721ba=_0x4721ba||0x1f4;return function(_0x1f1a89){logger[_0x9973('0x22')](_0x1f1a89[_0x9973('0x23')]);if(_0x1f1a89[_0x9973('0x24')]){delete _0x1f1a89[_0x9973('0x24')];}_0x374aac[_0x9973('0x17')](_0x4721ba)['send'](_0x1f1a89);};}exports['index']=function(_0x12c2be,_0x548e24){var _0x395b47={},_0x48fef0={},_0x12388e={'count':0x0,'rows':[]};var _0x495b0c=_[_0x9973('0x25')](db['JscriptyQuestionReport'][_0x9973('0x26')],function(_0x2e5ae4){return{'name':_0x2e5ae4[_0x9973('0x27')],'type':_0x2e5ae4[_0x9973('0x28')]['key']};});_0x48fef0[_0x9973('0x29')]=_[_0x9973('0x25')](_0x495b0c,_0x9973('0x24'));_0x48fef0[_0x9973('0x2a')]=_[_0x9973('0x2b')](_0x12c2be[_0x9973('0x2a')]);_0x48fef0[_0x9973('0x2c')]=_['intersection'](_0x48fef0['model'],_0x48fef0['query']);_0x395b47[_0x9973('0x2d')]=_[_0x9973('0x2e')](_0x48fef0[_0x9973('0x29')],qs[_0x9973('0x2f')](_0x12c2be[_0x9973('0x2a')][_0x9973('0x2f')]));_0x395b47[_0x9973('0x2d')]=_0x395b47[_0x9973('0x2d')][_0x9973('0x30')]?_0x395b47['attributes']:_0x48fef0['model'];if(!_0x12c2be[_0x9973('0x2a')][_0x9973('0x31')](_0x9973('0x32'))){_0x395b47[_0x9973('0x1b')]=qs['limit'](_0x12c2be[_0x9973('0x2a')][_0x9973('0x1b')]);_0x395b47[_0x9973('0x33')]=qs[_0x9973('0x33')](_0x12c2be[_0x9973('0x2a')][_0x9973('0x33')]);}_0x395b47[_0x9973('0x34')]=qs[_0x9973('0x35')](_0x12c2be[_0x9973('0x2a')]['sort']);_0x395b47[_0x9973('0x36')]=qs[_0x9973('0x2c')](_[_0x9973('0x37')](_0x12c2be[_0x9973('0x2a')],_0x48fef0['filters']),_0x495b0c);if(_0x12c2be['query'][_0x9973('0x38')]){_0x395b47[_0x9973('0x36')]=_[_0x9973('0x39')](_0x395b47[_0x9973('0x36')],{'$or':_[_0x9973('0x25')](_0x495b0c,function(_0x14f43e){if(_0x14f43e['type']!==_0x9973('0x3a')){var _0x3dd241={};_0x3dd241[_0x14f43e[_0x9973('0x24')]]={'$like':'%'+_0x12c2be[_0x9973('0x2a')][_0x9973('0x38')]+'%'};return _0x3dd241;}})});}_0x395b47=_[_0x9973('0x39')]({},_0x395b47,_0x12c2be[_0x9973('0x3b')]);var _0x523575={'where':_0x395b47[_0x9973('0x36')]};return db[_0x9973('0x3c')][_0x9973('0x1a')](_0x523575)[_0x9973('0x20')](function(_0x226d9f){_0x12388e['count']=_0x226d9f;if(_0x12c2be['query'][_0x9973('0x3d')]){_0x395b47['include']=[{'all':!![]}];}return db[_0x9973('0x3c')][_0x9973('0x3e')](_0x395b47);})[_0x9973('0x20')](function(_0x55a280){_0x12388e['rows']=_0x55a280;return _0x12388e;})[_0x9973('0x20')](respondWithFilteredResult(_0x548e24,_0x395b47))[_0x9973('0x3f')](handleError(_0x548e24,null));};exports[_0x9973('0x40')]=function(_0x169c49,_0x5911b1){var _0x289a3e={'raw':!![],'where':{'id':_0x169c49[_0x9973('0x41')]['id']}},_0x1f63e1={};_0x1f63e1['model']=_['keys'](db[_0x9973('0x3c')][_0x9973('0x26')]);_0x1f63e1[_0x9973('0x2a')]=_[_0x9973('0x2b')](_0x169c49['query']);_0x1f63e1['filters']=_['intersection'](_0x1f63e1[_0x9973('0x29')],_0x1f63e1[_0x9973('0x2a')]);_0x289a3e[_0x9973('0x2d')]=_[_0x9973('0x2e')](_0x1f63e1[_0x9973('0x29')],qs[_0x9973('0x2f')](_0x169c49['query'][_0x9973('0x2f')]));_0x289a3e[_0x9973('0x2d')]=_0x289a3e['attributes'][_0x9973('0x30')]?_0x289a3e[_0x9973('0x2d')]:_0x1f63e1[_0x9973('0x29')];if(_0x169c49[_0x9973('0x2a')]['includeAll']){_0x289a3e[_0x9973('0x42')]=[{'all':!![]}];}_0x289a3e=_[_0x9973('0x39')]({},_0x289a3e,_0x169c49['options']);return db['JscriptyQuestionReport']['find'](_0x289a3e)['then'](handleEntityNotFound(_0x5911b1,null))[_0x9973('0x20')](respondWithResult(_0x5911b1,null))[_0x9973('0x3f')](handleError(_0x5911b1,null));};exports[_0x9973('0x43')]=function(_0x235d0d,_0x425650){return db['JscriptyQuestionReport'][_0x9973('0x43')](_0x235d0d['body'],{})[_0x9973('0x20')](respondWithResult(_0x425650,0xc9))[_0x9973('0x3f')](handleError(_0x425650,null));};exports[_0x9973('0x1f')]=function(_0x343a28,_0x4777dc){if(_0x343a28['body']['id']){delete _0x343a28[_0x9973('0x44')]['id'];}return db[_0x9973('0x3c')][_0x9973('0x45')]({'where':{'id':_0x343a28[_0x9973('0x41')]['id']}})[_0x9973('0x20')](handleEntityNotFound(_0x4777dc,null))[_0x9973('0x20')](saveUpdates(_0x343a28['body'],null))[_0x9973('0x20')](respondWithResult(_0x4777dc,null))[_0x9973('0x3f')](handleError(_0x4777dc,null));};exports['destroy']=function(_0x35a832,_0x3d6097){return db[_0x9973('0x3c')][_0x9973('0x45')]({'where':{'id':_0x35a832[_0x9973('0x41')]['id']}})[_0x9973('0x20')](handleEntityNotFound(_0x3d6097,null))[_0x9973('0x20')](removeEntity(_0x3d6097,null))[_0x9973('0x3f')](handleError(_0x3d6097,null));};exports[_0x9973('0x46')]=function(_0x54f9d7,_0x5f149a){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x5f149a,null))[_0x9973('0x3f')](handleError(_0x5f149a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 004cb85..55894ed 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 _0x8d0c=['api','moment','bluebird','path','rimraf','../../config/environment','JscriptyQuestionReport','util','../../config/logger'];(function(_0x1c0608,_0xe9986){var _0x5c4e6d=function(_0x133362){while(--_0x133362){_0x1c0608['push'](_0x1c0608['shift']());}};_0x5c4e6d(++_0xe9986);}(_0x8d0c,0xa0));var _0xc8d0=function(_0x57f12b,_0x59d089){_0x57f12b=_0x57f12b-0x0;var _0x595c5c=_0x8d0c[_0x57f12b];return _0x595c5c;};'use strict';var _=require('lodash');var util=require(_0xc8d0('0x0'));var logger=require(_0xc8d0('0x1'))(_0xc8d0('0x2'));var moment=require(_0xc8d0('0x3'));var BPromise=require(_0xc8d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8d0('0x5'));var rimraf=require(_0xc8d0('0x6'));var config=require(_0xc8d0('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x3bf046,_0x5bc67f){return _0x3bf046['define'](_0xc8d0('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe1=['moment','request-promise','path','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xfbe1,0x1dd));var _0x1fbe=function(_0x8c053e,_0x1c3113){_0x8c053e=_0x8c053e-0x0;var _0x48a92f=_0xfbe1[_0x8c053e];return _0x48a92f;};'use strict';var _=require(_0x1fbe('0x0'));var util=require(_0x1fbe('0x1'));var logger=require(_0x1fbe('0x2'))('api');var moment=require(_0x1fbe('0x3'));var BPromise=require('bluebird');var rp=require(_0x1fbe('0x4'));var fs=require('fs');var path=require(_0x1fbe('0x5'));var rimraf=require('rimraf');var config=require(_0x1fbe('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x3864d7,_0xb7cc57){return _0x3864d7[_0x1fbe('0x7')](_0x1fbe('0x8'),attributes,{'tableName':_0x1fbe('0x9'),'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 114124a..0bdd4df 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 _0x3a00=['rpc','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x597e38,_0x551ac2){var _0x5305d2=function(_0x47dc5e){while(--_0x47dc5e){_0x597e38['push'](_0x597e38['shift']());}};_0x5305d2(++_0x551ac2);}(_0x3a00,0x1f3));var _0x03a0=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0x3a00[_0x24618a];return _0x2e3d64;};'use strict';var _=require('lodash');var util=require(_0x03a0('0x0'));var moment=require(_0x03a0('0x1'));var BPromise=require('bluebird');var rs=require(_0x03a0('0x2'));var fs=require('fs');var Redis=require(_0x03a0('0x3'));var db=require(_0x03a0('0x4'))['db'];var utils=require(_0x03a0('0x5'));var logger=require(_0x03a0('0x6'))(_0x03a0('0x7'));var config=require(_0x03a0('0x8'));var jayson=require(_0x03a0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x385585,_0x15e14a,_0x57aa16){return new BPromise(function(_0x36c86e,_0x43468a){return client[_0x03a0('0xa')](_0x385585,_0x57aa16)[_0x03a0('0xb')](function(_0x7deacd){logger[_0x03a0('0xc')](_0x03a0('0xd'),_0x15e14a,_0x03a0('0xe'));logger[_0x03a0('0xf')](_0x03a0('0x10'),_0x15e14a,_0x03a0('0xe'),JSON[_0x03a0('0x11')](_0x7deacd));if(_0x7deacd[_0x03a0('0x12')]){if(_0x7deacd[_0x03a0('0x12')][_0x03a0('0x13')]===0x1f4){logger['error'](_0x03a0('0xd'),_0x15e14a,_0x7deacd[_0x03a0('0x12')][_0x03a0('0x14')]);return _0x43468a(_0x7deacd[_0x03a0('0x12')][_0x03a0('0x14')]);}logger[_0x03a0('0x12')](_0x03a0('0xd'),_0x15e14a,_0x7deacd[_0x03a0('0x12')][_0x03a0('0x14')]);return _0x36c86e(_0x7deacd[_0x03a0('0x12')][_0x03a0('0x14')]);}else{logger[_0x03a0('0xc')](_0x03a0('0xd'),_0x15e14a,_0x03a0('0xe'));_0x36c86e(_0x7deacd['result'][_0x03a0('0x14')]);}})[_0x03a0('0x15')](function(_0x49b692){logger['error'](_0x03a0('0xd'),_0x15e14a,_0x49b692);_0x43468a(_0x49b692);});});} \ No newline at end of file +var _0xd3f4=['ioredis','../../config/utils','rpc','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0x46ae87,_0x4bd053){var _0x303fcc=function(_0xf522b9){while(--_0xf522b9){_0x46ae87['push'](_0x46ae87['shift']());}};_0x303fcc(++_0x4bd053);}(_0xd3f4,0x6e));var _0x4d3f=function(_0x41a6c7,_0x3b3707){_0x41a6c7=_0x41a6c7-0x0;var _0x95e8=_0xd3f4[_0x41a6c7];return _0x95e8;};'use strict';var _=require(_0x4d3f('0x0'));var util=require(_0x4d3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d3f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d3f('0x3'));var logger=require('../../config/logger')(_0x4d3f('0x4'));var config=require('../../config/environment');var jayson=require(_0x4d3f('0x5'));var client=jayson['client'][_0x4d3f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc5f95e,_0x222afa,_0x5f184a){return new BPromise(function(_0x2b69b8,_0x2b4c64){return client[_0x4d3f('0x7')](_0xc5f95e,_0x5f184a)[_0x4d3f('0x8')](function(_0x1b065f){logger['info'](_0x4d3f('0x9'),_0x222afa,_0x4d3f('0xa'));logger[_0x4d3f('0xb')](_0x4d3f('0xc'),_0x222afa,_0x4d3f('0xa'),JSON['stringify'](_0x1b065f));if(_0x1b065f['error']){if(_0x1b065f[_0x4d3f('0xd')]['code']===0x1f4){logger[_0x4d3f('0xd')](_0x4d3f('0x9'),_0x222afa,_0x1b065f[_0x4d3f('0xd')][_0x4d3f('0xe')]);return _0x2b4c64(_0x1b065f[_0x4d3f('0xd')][_0x4d3f('0xe')]);}logger[_0x4d3f('0xd')](_0x4d3f('0x9'),_0x222afa,_0x1b065f[_0x4d3f('0xd')][_0x4d3f('0xe')]);return _0x2b69b8(_0x1b065f['error'][_0x4d3f('0xe')]);}else{logger['info'](_0x4d3f('0x9'),_0x222afa,_0x4d3f('0xa'));_0x2b69b8(_0x1b065f[_0x4d3f('0xf')][_0x4d3f('0xe')]);}})['catch'](function(_0x8d4722){logger[_0x4d3f('0xd')](_0x4d3f('0x9'),_0x222afa,_0x8d4722);_0x2b4c64(_0x8d4722);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a7e2b77..d3fb611 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 _0x31af=['./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','put','update','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x5b1834,_0x26defc){var _0x374d72=function(_0xa1f2c9){while(--_0xa1f2c9){_0x5b1834['push'](_0x5b1834['shift']());}};_0x374d72(++_0x26defc);}(_0x31af,0xde));var _0xf31a=function(_0x21555b,_0x561755){_0x21555b=_0x21555b-0x0;var _0x259eb4=_0x31af[_0x21555b];return _0x259eb4;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf31a('0x4'));var config=require(_0xf31a('0x5'));var controller=require(_0xf31a('0x6'));router[_0xf31a('0x7')]('/',auth['isAuthenticated'](),controller[_0xf31a('0x8')]);router[_0xf31a('0x7')](_0xf31a('0x9'),auth[_0xf31a('0xa')](),controller['describe']);router[_0xf31a('0x7')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xc')]);router['get'](_0xf31a('0xd'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xe')]);router[_0xf31a('0xf')]('/',auth[_0xf31a('0xa')](),controller['create']);router[_0xf31a('0x10')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0x11')]);router['delete'](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller['destroy']);module[_0xf31a('0x12')]=router; \ No newline at end of file +var _0xf987=['../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2a0bc2,_0x33f79b){var _0x840555=function(_0x1171d3){while(--_0x1171d3){_0x2a0bc2['push'](_0x2a0bc2['shift']());}};_0x840555(++_0x33f79b);}(_0xf987,0x18a));var _0x7f98=function(_0x5c87c2,_0x409a60){_0x5c87c2=_0x5c87c2-0x0;var _0x3efe07=_0xf987[_0x5c87c2];return _0x3efe07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var auth=require(_0x7f98('0x3'));var interaction=require(_0x7f98('0x4'));var config=require(_0x7f98('0x5'));var controller=require(_0x7f98('0x6'));router[_0x7f98('0x7')]('/',auth[_0x7f98('0x8')](),controller[_0x7f98('0x9')]);router[_0x7f98('0x7')](_0x7f98('0xa'),auth[_0x7f98('0x8')](),controller[_0x7f98('0xb')]);router['get'](_0x7f98('0xc'),auth[_0x7f98('0x8')](),controller[_0x7f98('0xd')]);router[_0x7f98('0x7')](_0x7f98('0xe'),auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth[_0x7f98('0x8')](),controller['update']);router[_0x7f98('0x12')]('/:id',auth[_0x7f98('0x8')](),controller[_0x7f98('0x13')]);module[_0x7f98('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 72f8335..078936c 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 _0x095d=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','starttime','setDataValue'];(function(_0x3a2e8c,_0x4001d3){var _0x588177=function(_0x2dbc02){while(--_0x2dbc02){_0x3a2e8c['push'](_0x3a2e8c['shift']());}};_0x588177(++_0x4001d3);}(_0x095d,0x95));var _0xd095=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x095d[_0x1529a3];return _0x1a0d4b;};'use strict';var moment=require('moment');var Sequelize=require(_0xd095('0x0'));module[_0xd095('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2a7d63){this['setDataValue'](_0xd095('0x2'),_0x2a7d63);this[_0xd095('0x3')](_0xd095('0x4'),moment()[_0xd095('0x5')](_0xd095('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xd095('0x7')]},'projectname':{'type':Sequelize[_0xd095('0x7')]},'queue':{'type':Sequelize[_0xd095('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd095('0x7')]},'calleridnum':{'type':Sequelize[_0xd095('0x7')]},'completed':{'type':Sequelize[_0xd095('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x11b8=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x14a160,_0x3d4a0c){var _0x384fab=function(_0x561e98){while(--_0x561e98){_0x14a160['push'](_0x14a160['shift']());}};_0x384fab(++_0x3d4a0c);}(_0x11b8,0x104));var _0x811b=function(_0x225074,_0x1abb16){_0x225074=_0x225074-0x0;var _0x3fb50c=_0x11b8[_0x225074];return _0x3fb50c;};'use strict';var moment=require(_0x811b('0x0'));var Sequelize=require(_0x811b('0x1'));module[_0x811b('0x2')]={'starttime':{'type':Sequelize[_0x811b('0x3')],'set':function(_0x29db1d){this[_0x811b('0x4')](_0x811b('0x5'),_0x29db1d);this['setDataValue'](_0x811b('0x6'),moment()[_0x811b('0x7')](_0x811b('0x8')));}},'endtime':{'type':Sequelize[_0x811b('0x3')]},'membername':{'type':Sequelize[_0x811b('0x9')]},'projectname':{'type':Sequelize[_0x811b('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x811b('0x9')]},'calleridnum':{'type':Sequelize[_0x811b('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index eb1b5ae..77203a2 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 _0x0958=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','JscriptySessionReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','merge','create','body','catch','find','describe','findOne','hasOwnProperty','SessionId','JscriptyQuestionReport','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x13a165,_0x422c34){var _0x47b00a=function(_0x2a81af){while(--_0x2a81af){_0x13a165['push'](_0x13a165['shift']());}};_0x47b00a(++_0x422c34);}(_0x0958,0x13a));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x8095('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8095('0x1'));var zipdir=require(_0x8095('0x2'));var jsonpatch=require(_0x8095('0x3'));var rp=require('request-promise');var moment=require(_0x8095('0x4'));var BPromise=require(_0x8095('0x5'));var Mustache=require(_0x8095('0x6'));var util=require(_0x8095('0x7'));var path=require(_0x8095('0x8'));var sox=require(_0x8095('0x9'));var csv=require(_0x8095('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8095('0xb'));var squel=require(_0x8095('0xc'));var crypto=require(_0x8095('0xd'));var jsforce=require(_0x8095('0xe'));var deskjs=require(_0x8095('0xf'));var toCsv=require(_0x8095('0xa'));var querystring=require(_0x8095('0x10'));var Papa=require(_0x8095('0x11'));var Redis=require(_0x8095('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8095('0x13'));var as=require(_0x8095('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8095('0x15'))(_0x8095('0x16'));var utils=require(_0x8095('0x17'));var config=require(_0x8095('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472cc8,_0x4e99c3){_0x4e99c3=_0x4e99c3||0xcc;return function(_0x51f8ac){if(_0x51f8ac){return _0x472cc8[_0x8095('0x19')](_0x4e99c3);}return _0x472cc8['status'](_0x4e99c3)['end']();};}function respondWithResult(_0x1012cd,_0x10f2d9){_0x10f2d9=_0x10f2d9||0xc8;return function(_0x4c160e){if(_0x4c160e){return _0x1012cd[_0x8095('0x1a')](_0x10f2d9)['json'](_0x4c160e);}};}function respondWithFilteredResult(_0x1093d6,_0x49b5d8){return function(_0x644731){if(_0x644731){var _0x4331bc=_0x644731[_0x8095('0x1b')],_0x944e05=_0x49b5d8[_0x8095('0x1c')],_0x20dc07=_0x49b5d8[_0x8095('0x1c')]+_0x49b5d8['limit'],_0x8f2a9;if(_0x20dc07>=_0x4331bc){_0x20dc07=_0x4331bc;_0x8f2a9=0xc8;}else{_0x8f2a9=0xce;}_0x1093d6[_0x8095('0x1a')](_0x8f2a9);return _0x1093d6[_0x8095('0x1d')](_0x8095('0x1e'),_0x944e05+'-'+_0x20dc07+'/'+_0x4331bc)[_0x8095('0x1f')](_0x644731);}return null;};}function patchUpdates(_0x19477c){return function(_0x2aba09){try{jsonpatch[_0x8095('0x20')](_0x2aba09,_0x19477c,!![]);}catch(_0x2d87cc){return BPromise['reject'](_0x2d87cc);}return _0x2aba09[_0x8095('0x21')]();};}function saveUpdates(_0x38cedb,_0x4e030d){return function(_0x49e42c){if(_0x49e42c){return _0x49e42c[_0x8095('0x22')](_0x38cedb)[_0x8095('0x23')](function(_0x14a819){return _0x14a819;});}return null;};}function removeEntity(_0x454edd,_0x792da9){return function(_0x233c07){if(_0x233c07){return _0x233c07[_0x8095('0x24')]()[_0x8095('0x23')](function(){_0x454edd[_0x8095('0x1a')](0xcc)[_0x8095('0x25')]();});}};}function handleEntityNotFound(_0x1026ef,_0x32e216){return function(_0x41e1e3){if(!_0x41e1e3){_0x1026ef[_0x8095('0x19')](0x194);}return _0x41e1e3;};}function handleError(_0x4eba31,_0x6c39c1){_0x6c39c1=_0x6c39c1||0x1f4;return function(_0x37fe24){logger[_0x8095('0x26')](_0x37fe24[_0x8095('0x27')]);if(_0x37fe24[_0x8095('0x28')]){delete _0x37fe24[_0x8095('0x28')];}_0x4eba31[_0x8095('0x1a')](_0x6c39c1)[_0x8095('0x29')](_0x37fe24);};}exports[_0x8095('0x2a')]=function(_0x152b75,_0x1b6e7a){var _0x2e6d6b={},_0x48203a={},_0x143876={'count':0x0,'rows':[]};var _0x1f1b10=_['map'](db[_0x8095('0x2b')]['rawAttributes'],function(_0x2edb72){return{'name':_0x2edb72[_0x8095('0x2c')],'type':_0x2edb72[_0x8095('0x2d')][_0x8095('0x2e')]};});_0x48203a['model']=_[_0x8095('0x2f')](_0x1f1b10,_0x8095('0x28'));_0x48203a[_0x8095('0x30')]=_[_0x8095('0x31')](_0x152b75[_0x8095('0x30')]);_0x48203a[_0x8095('0x32')]=_[_0x8095('0x33')](_0x48203a[_0x8095('0x34')],_0x48203a[_0x8095('0x30')]);_0x2e6d6b[_0x8095('0x35')]=_[_0x8095('0x33')](_0x48203a['model'],qs[_0x8095('0x36')](_0x152b75[_0x8095('0x30')][_0x8095('0x36')]));_0x2e6d6b[_0x8095('0x35')]=_0x2e6d6b['attributes'][_0x8095('0x37')]?_0x2e6d6b['attributes']:_0x48203a[_0x8095('0x34')];if(!_0x152b75[_0x8095('0x30')]['hasOwnProperty'](_0x8095('0x38'))){_0x2e6d6b['limit']=qs[_0x8095('0x39')](_0x152b75[_0x8095('0x30')][_0x8095('0x39')]);_0x2e6d6b[_0x8095('0x1c')]=qs['offset'](_0x152b75[_0x8095('0x30')]['offset']);}_0x2e6d6b[_0x8095('0x3a')]=qs[_0x8095('0x3b')](_0x152b75[_0x8095('0x30')]['sort']);_0x2e6d6b[_0x8095('0x3c')]=qs['filters'](_[_0x8095('0x3d')](_0x152b75[_0x8095('0x30')],_0x48203a[_0x8095('0x32')]),_0x1f1b10);if(_0x152b75[_0x8095('0x30')][_0x8095('0x3e')]){_0x2e6d6b[_0x8095('0x3c')]=_['merge'](_0x2e6d6b[_0x8095('0x3c')],{'$or':_[_0x8095('0x2f')](_0x1f1b10,function(_0x4c443b){if(_0x4c443b['type']!==_0x8095('0x3f')){var _0x277957={};_0x277957[_0x4c443b[_0x8095('0x28')]]={'$like':'%'+_0x152b75[_0x8095('0x30')][_0x8095('0x3e')]+'%'};return _0x277957;}})});}_0x2e6d6b=_['merge']({},_0x2e6d6b,_0x152b75[_0x8095('0x40')]);var _0x127e60={'where':_0x2e6d6b[_0x8095('0x3c')]};return db[_0x8095('0x2b')]['count'](_0x127e60)['then'](function(_0x3b4b6f){_0x143876[_0x8095('0x1b')]=_0x3b4b6f;if(_0x152b75['query'][_0x8095('0x41')]){_0x2e6d6b[_0x8095('0x42')]=[{'all':!![]}];}return db[_0x8095('0x2b')][_0x8095('0x43')](_0x2e6d6b);})[_0x8095('0x23')](function(_0x36b88e){_0x143876[_0x8095('0x44')]=_0x36b88e;return _0x143876;})[_0x8095('0x23')](respondWithFilteredResult(_0x1b6e7a,_0x2e6d6b))['catch'](handleError(_0x1b6e7a,null));};exports[_0x8095('0x45')]=function(_0x4eb805,_0x33b4bf){var _0x32bce9={'raw':!![],'where':{'id':_0x4eb805[_0x8095('0x46')]['id']}},_0x26b083={};_0x26b083[_0x8095('0x34')]=_[_0x8095('0x31')](db[_0x8095('0x2b')][_0x8095('0x47')]);_0x26b083['query']=_[_0x8095('0x31')](_0x4eb805[_0x8095('0x30')]);_0x26b083[_0x8095('0x32')]=_[_0x8095('0x33')](_0x26b083[_0x8095('0x34')],_0x26b083[_0x8095('0x30')]);_0x32bce9['attributes']=_[_0x8095('0x33')](_0x26b083[_0x8095('0x34')],qs[_0x8095('0x36')](_0x4eb805['query'][_0x8095('0x36')]));_0x32bce9[_0x8095('0x35')]=_0x32bce9[_0x8095('0x35')]['length']?_0x32bce9[_0x8095('0x35')]:_0x26b083[_0x8095('0x34')];if(_0x4eb805[_0x8095('0x30')]['includeAll']){_0x32bce9[_0x8095('0x42')]=[{'all':!![]}];}_0x32bce9=_[_0x8095('0x48')]({},_0x32bce9,_0x4eb805[_0x8095('0x40')]);return db['JscriptySessionReport']['find'](_0x32bce9)['then'](handleEntityNotFound(_0x33b4bf,null))[_0x8095('0x23')](respondWithResult(_0x33b4bf,null))['catch'](handleError(_0x33b4bf,null));};exports[_0x8095('0x49')]=function(_0x3d0d3e,_0x3eefff){return db[_0x8095('0x2b')][_0x8095('0x49')](_0x3d0d3e[_0x8095('0x4a')],{})[_0x8095('0x23')](respondWithResult(_0x3eefff,0xc9))[_0x8095('0x4b')](handleError(_0x3eefff,null));};exports[_0x8095('0x22')]=function(_0x503ec4,_0x379953){if(_0x503ec4[_0x8095('0x4a')]['id']){delete _0x503ec4['body']['id'];}return db['JscriptySessionReport'][_0x8095('0x4c')]({'where':{'id':_0x503ec4[_0x8095('0x46')]['id']}})[_0x8095('0x23')](handleEntityNotFound(_0x379953,null))[_0x8095('0x23')](saveUpdates(_0x503ec4[_0x8095('0x4a')],null))['then'](respondWithResult(_0x379953,null))[_0x8095('0x4b')](handleError(_0x379953,null));};exports['destroy']=function(_0x4fe3bc,_0x18fd16){return db['JscriptySessionReport'][_0x8095('0x4c')]({'where':{'id':_0x4fe3bc[_0x8095('0x46')]['id']}})[_0x8095('0x23')](handleEntityNotFound(_0x18fd16,null))[_0x8095('0x23')](removeEntity(_0x18fd16,null))[_0x8095('0x4b')](handleError(_0x18fd16,null));};exports[_0x8095('0x4d')]=function(_0x31eaf4,_0x4fc781){return db[_0x8095('0x2b')][_0x8095('0x4d')]()['then'](respondWithResult(_0x4fc781,null))[_0x8095('0x4b')](handleError(_0x4fc781,null));};exports['getQuestions']=function(_0x4ab1c1,_0x4635ba,_0x27be06){var _0x2eda89={'raw':!![],'where':{}};var _0x55ad3f={};var _0x5d42bb={'count':0x0,'rows':[]};return db[_0x8095('0x2b')][_0x8095('0x4e')]({'where':{'id':_0x4ab1c1[_0x8095('0x46')]['id']}})[_0x8095('0x23')](handleEntityNotFound(_0x4635ba,null))[_0x8095('0x23')](function(_0x2c23a8){if(_0x2c23a8){_0x55ad3f[_0x8095('0x34')]=_[_0x8095('0x31')](db['JscriptyQuestionReport'][_0x8095('0x47')]);_0x55ad3f[_0x8095('0x30')]=_[_0x8095('0x31')](_0x4ab1c1[_0x8095('0x30')]);_0x55ad3f[_0x8095('0x32')]=_[_0x8095('0x33')](_0x55ad3f[_0x8095('0x34')],_0x55ad3f[_0x8095('0x30')]);_0x2eda89['attributes']=_[_0x8095('0x33')](_0x55ad3f[_0x8095('0x34')],qs[_0x8095('0x36')](_0x4ab1c1['query'][_0x8095('0x36')]));_0x2eda89[_0x8095('0x35')]=_0x2eda89[_0x8095('0x35')][_0x8095('0x37')]?_0x2eda89[_0x8095('0x35')]:_0x55ad3f[_0x8095('0x34')];if(!_0x4ab1c1[_0x8095('0x30')][_0x8095('0x4f')](_0x8095('0x38'))){_0x2eda89[_0x8095('0x39')]=qs[_0x8095('0x39')](_0x4ab1c1[_0x8095('0x30')]['limit']);_0x2eda89[_0x8095('0x1c')]=qs[_0x8095('0x1c')](_0x4ab1c1['query'][_0x8095('0x1c')]);}_0x2eda89[_0x8095('0x3a')]=qs[_0x8095('0x3b')](_0x4ab1c1[_0x8095('0x30')][_0x8095('0x3b')]);_0x2eda89[_0x8095('0x3c')]=qs['filters'](_[_0x8095('0x3d')](_0x4ab1c1[_0x8095('0x30')],_0x55ad3f[_0x8095('0x32')]));_0x2eda89['where'][_0x8095('0x50')]=_0x2c23a8['id'];if(_0x4ab1c1[_0x8095('0x30')][_0x8095('0x3e')]){_0x2eda89['where']=_[_0x8095('0x48')](_0x2eda89[_0x8095('0x3c')],{'$or':_['map'](_0x2eda89[_0x8095('0x35')],function(_0x4d4e77){var _0x11a9ce={};_0x11a9ce[_0x4d4e77]={'$like':'%'+_0x4ab1c1[_0x8095('0x30')][_0x8095('0x3e')]+'%'};return _0x11a9ce;})});}_0x2eda89=_[_0x8095('0x48')]({},_0x2eda89,_0x4ab1c1['options']);return db[_0x8095('0x51')][_0x8095('0x1b')]({'where':_0x2eda89['where']})[_0x8095('0x23')](function(_0x5381cc){_0x5d42bb[_0x8095('0x1b')]=_0x5381cc;if(_0x4ab1c1[_0x8095('0x30')]['includeAll']){_0x2eda89[_0x8095('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x2eda89);})[_0x8095('0x23')](function(_0x5f21c1){_0x5d42bb[_0x8095('0x44')]=_0x5f21c1;return _0x5d42bb;});}})[_0x8095('0x23')](respondWithFilteredResult(_0x4635ba,_0x2eda89))['catch'](handleError(_0x4635ba,null));}; \ No newline at end of file +var _0x79d8=['reject','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','JscriptySessionReport','includeAll','rows','params','include','find','catch','create','body','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x12e1a9,_0x4d9394){var _0x533996=function(_0x2f72fb){while(--_0x2f72fb){_0x12e1a9['push'](_0x12e1a9['shift']());}};_0x533996(++_0x4d9394);}(_0x79d8,0xc5));var _0x879d=function(_0x1903e3,_0xec6383){_0x1903e3=_0x1903e3-0x0;var _0x57cea4=_0x79d8[_0x1903e3];return _0x57cea4;};'use strict';var pdf=require(_0x879d('0x0'));var emlformat=require(_0x879d('0x1'));var rimraf=require(_0x879d('0x2'));var zipdir=require(_0x879d('0x3'));var jsonpatch=require(_0x879d('0x4'));var rp=require(_0x879d('0x5'));var moment=require(_0x879d('0x6'));var BPromise=require(_0x879d('0x7'));var Mustache=require('mustache');var util=require(_0x879d('0x8'));var path=require(_0x879d('0x9'));var sox=require(_0x879d('0xa'));var csv=require(_0x879d('0xb'));var ejs=require(_0x879d('0xc'));var fs=require('fs');var _=require(_0x879d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x879d('0xe'));var deskjs=require(_0x879d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x879d('0x10'));var Papa=require(_0x879d('0x11'));var Redis=require('ioredis');var authService=require(_0x879d('0x12'));var qs=require(_0x879d('0x13'));var as=require(_0x879d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x879d('0x15'))(_0x879d('0x16'));var utils=require('../../config/utils');var config=require(_0x879d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x510c54,_0xb09d23){_0xb09d23=_0xb09d23||0xcc;return function(_0x28ca45){if(_0x28ca45){return _0x510c54[_0x879d('0x18')](_0xb09d23);}return _0x510c54[_0x879d('0x19')](_0xb09d23)[_0x879d('0x1a')]();};}function respondWithResult(_0x2607cd,_0x552450){_0x552450=_0x552450||0xc8;return function(_0xb03769){if(_0xb03769){return _0x2607cd['status'](_0x552450)[_0x879d('0x1b')](_0xb03769);}};}function respondWithFilteredResult(_0x12848b,_0x5bb7aa){return function(_0x4865f3){if(_0x4865f3){var _0x505e42=_0x4865f3[_0x879d('0x1c')],_0x248763=_0x5bb7aa[_0x879d('0x1d')],_0x36509d=_0x5bb7aa[_0x879d('0x1d')]+_0x5bb7aa[_0x879d('0x1e')],_0x4cc28d;if(_0x36509d>=_0x505e42){_0x36509d=_0x505e42;_0x4cc28d=0xc8;}else{_0x4cc28d=0xce;}_0x12848b[_0x879d('0x19')](_0x4cc28d);return _0x12848b[_0x879d('0x1f')](_0x879d('0x20'),_0x248763+'-'+_0x36509d+'/'+_0x505e42)[_0x879d('0x1b')](_0x4865f3);}return null;};}function patchUpdates(_0x24a344){return function(_0x19af2d){try{jsonpatch[_0x879d('0x21')](_0x19af2d,_0x24a344,!![]);}catch(_0xf1e3fc){return BPromise[_0x879d('0x22')](_0xf1e3fc);}return _0x19af2d['save']();};}function saveUpdates(_0x72475f,_0x4dcec8){return function(_0x4d3bc5){if(_0x4d3bc5){return _0x4d3bc5[_0x879d('0x23')](_0x72475f)[_0x879d('0x24')](function(_0x507aaa){return _0x507aaa;});}return null;};}function removeEntity(_0x12bef4,_0x593e7e){return function(_0x18a145){if(_0x18a145){return _0x18a145[_0x879d('0x25')]()[_0x879d('0x24')](function(){_0x12bef4['status'](0xcc)[_0x879d('0x1a')]();});}};}function handleEntityNotFound(_0x376e51,_0x4a8897){return function(_0x18f4e0){if(!_0x18f4e0){_0x376e51[_0x879d('0x18')](0x194);}return _0x18f4e0;};}function handleError(_0x35f417,_0x2c127a){_0x2c127a=_0x2c127a||0x1f4;return function(_0x38bc57){logger[_0x879d('0x26')](_0x38bc57[_0x879d('0x27')]);if(_0x38bc57[_0x879d('0x28')]){delete _0x38bc57[_0x879d('0x28')];}_0x35f417['status'](_0x2c127a)['send'](_0x38bc57);};}exports['index']=function(_0x1105b3,_0x524257){var _0x13169b={},_0x1d8a9f={},_0x5b2361={'count':0x0,'rows':[]};var _0x39e6e1=_[_0x879d('0x29')](db['JscriptySessionReport'][_0x879d('0x2a')],function(_0x41bda7){return{'name':_0x41bda7[_0x879d('0x2b')],'type':_0x41bda7[_0x879d('0x2c')][_0x879d('0x2d')]};});_0x1d8a9f[_0x879d('0x2e')]=_[_0x879d('0x29')](_0x39e6e1,_0x879d('0x28'));_0x1d8a9f[_0x879d('0x2f')]=_[_0x879d('0x30')](_0x1105b3['query']);_0x1d8a9f[_0x879d('0x31')]=_['intersection'](_0x1d8a9f['model'],_0x1d8a9f[_0x879d('0x2f')]);_0x13169b[_0x879d('0x32')]=_[_0x879d('0x33')](_0x1d8a9f[_0x879d('0x2e')],qs[_0x879d('0x34')](_0x1105b3[_0x879d('0x2f')][_0x879d('0x34')]));_0x13169b[_0x879d('0x32')]=_0x13169b['attributes'][_0x879d('0x35')]?_0x13169b[_0x879d('0x32')]:_0x1d8a9f['model'];if(!_0x1105b3[_0x879d('0x2f')]['hasOwnProperty'](_0x879d('0x36'))){_0x13169b[_0x879d('0x1e')]=qs['limit'](_0x1105b3['query']['limit']);_0x13169b[_0x879d('0x1d')]=qs[_0x879d('0x1d')](_0x1105b3['query'][_0x879d('0x1d')]);}_0x13169b[_0x879d('0x37')]=qs['sort'](_0x1105b3[_0x879d('0x2f')][_0x879d('0x38')]);_0x13169b[_0x879d('0x39')]=qs['filters'](_['pick'](_0x1105b3[_0x879d('0x2f')],_0x1d8a9f[_0x879d('0x31')]),_0x39e6e1);if(_0x1105b3[_0x879d('0x2f')][_0x879d('0x3a')]){_0x13169b[_0x879d('0x39')]=_[_0x879d('0x3b')](_0x13169b[_0x879d('0x39')],{'$or':_['map'](_0x39e6e1,function(_0x255179){if(_0x255179[_0x879d('0x2c')]!=='VIRTUAL'){var _0x1d9725={};_0x1d9725[_0x255179[_0x879d('0x28')]]={'$like':'%'+_0x1105b3[_0x879d('0x2f')][_0x879d('0x3a')]+'%'};return _0x1d9725;}})});}_0x13169b=_['merge']({},_0x13169b,_0x1105b3[_0x879d('0x3c')]);var _0x358e90={'where':_0x13169b['where']};return db[_0x879d('0x3d')][_0x879d('0x1c')](_0x358e90)[_0x879d('0x24')](function(_0x11c49a){_0x5b2361['count']=_0x11c49a;if(_0x1105b3['query'][_0x879d('0x3e')]){_0x13169b['include']=[{'all':!![]}];}return db[_0x879d('0x3d')]['findAll'](_0x13169b);})['then'](function(_0x42eccf){_0x5b2361[_0x879d('0x3f')]=_0x42eccf;return _0x5b2361;})[_0x879d('0x24')](respondWithFilteredResult(_0x524257,_0x13169b))['catch'](handleError(_0x524257,null));};exports['show']=function(_0x5a9fd6,_0x555790){var _0x2610df={'raw':!![],'where':{'id':_0x5a9fd6[_0x879d('0x40')]['id']}},_0xc10599={};_0xc10599[_0x879d('0x2e')]=_[_0x879d('0x30')](db[_0x879d('0x3d')][_0x879d('0x2a')]);_0xc10599[_0x879d('0x2f')]=_[_0x879d('0x30')](_0x5a9fd6[_0x879d('0x2f')]);_0xc10599[_0x879d('0x31')]=_[_0x879d('0x33')](_0xc10599[_0x879d('0x2e')],_0xc10599['query']);_0x2610df['attributes']=_[_0x879d('0x33')](_0xc10599['model'],qs[_0x879d('0x34')](_0x5a9fd6['query'][_0x879d('0x34')]));_0x2610df[_0x879d('0x32')]=_0x2610df[_0x879d('0x32')][_0x879d('0x35')]?_0x2610df[_0x879d('0x32')]:_0xc10599[_0x879d('0x2e')];if(_0x5a9fd6[_0x879d('0x2f')][_0x879d('0x3e')]){_0x2610df[_0x879d('0x41')]=[{'all':!![]}];}_0x2610df=_['merge']({},_0x2610df,_0x5a9fd6[_0x879d('0x3c')]);return db['JscriptySessionReport'][_0x879d('0x42')](_0x2610df)[_0x879d('0x24')](handleEntityNotFound(_0x555790,null))[_0x879d('0x24')](respondWithResult(_0x555790,null))[_0x879d('0x43')](handleError(_0x555790,null));};exports['create']=function(_0x303b14,_0x27dd90){return db[_0x879d('0x3d')][_0x879d('0x44')](_0x303b14[_0x879d('0x45')],{})[_0x879d('0x24')](respondWithResult(_0x27dd90,0xc9))[_0x879d('0x43')](handleError(_0x27dd90,null));};exports[_0x879d('0x23')]=function(_0x67fce8,_0x2af031){if(_0x67fce8[_0x879d('0x45')]['id']){delete _0x67fce8[_0x879d('0x45')]['id'];}return db[_0x879d('0x3d')]['find']({'where':{'id':_0x67fce8[_0x879d('0x40')]['id']}})[_0x879d('0x24')](handleEntityNotFound(_0x2af031,null))[_0x879d('0x24')](saveUpdates(_0x67fce8[_0x879d('0x45')],null))[_0x879d('0x24')](respondWithResult(_0x2af031,null))[_0x879d('0x43')](handleError(_0x2af031,null));};exports[_0x879d('0x25')]=function(_0x2e9a7a,_0x23dde8){return db[_0x879d('0x3d')]['find']({'where':{'id':_0x2e9a7a[_0x879d('0x40')]['id']}})[_0x879d('0x24')](handleEntityNotFound(_0x23dde8,null))[_0x879d('0x24')](removeEntity(_0x23dde8,null))['catch'](handleError(_0x23dde8,null));};exports[_0x879d('0x46')]=function(_0x3a2a6e,_0x329968){return db[_0x879d('0x3d')][_0x879d('0x46')]()['then'](respondWithResult(_0x329968,null))[_0x879d('0x43')](handleError(_0x329968,null));};exports[_0x879d('0x47')]=function(_0x190e59,_0x52775f,_0x1487c1){var _0x8f0dc6={'raw':!![],'where':{}};var _0x1e3f59={};var _0xa7a984={'count':0x0,'rows':[]};return db[_0x879d('0x3d')][_0x879d('0x48')]({'where':{'id':_0x190e59['params']['id']}})[_0x879d('0x24')](handleEntityNotFound(_0x52775f,null))[_0x879d('0x24')](function(_0x3fc5f5){if(_0x3fc5f5){_0x1e3f59[_0x879d('0x2e')]=_[_0x879d('0x30')](db['JscriptyQuestionReport'][_0x879d('0x2a')]);_0x1e3f59['query']=_[_0x879d('0x30')](_0x190e59[_0x879d('0x2f')]);_0x1e3f59[_0x879d('0x31')]=_[_0x879d('0x33')](_0x1e3f59['model'],_0x1e3f59[_0x879d('0x2f')]);_0x8f0dc6[_0x879d('0x32')]=_[_0x879d('0x33')](_0x1e3f59[_0x879d('0x2e')],qs[_0x879d('0x34')](_0x190e59[_0x879d('0x2f')]['fields']));_0x8f0dc6[_0x879d('0x32')]=_0x8f0dc6[_0x879d('0x32')][_0x879d('0x35')]?_0x8f0dc6['attributes']:_0x1e3f59['model'];if(!_0x190e59[_0x879d('0x2f')]['hasOwnProperty']('nolimit')){_0x8f0dc6[_0x879d('0x1e')]=qs[_0x879d('0x1e')](_0x190e59[_0x879d('0x2f')]['limit']);_0x8f0dc6[_0x879d('0x1d')]=qs[_0x879d('0x1d')](_0x190e59[_0x879d('0x2f')][_0x879d('0x1d')]);}_0x8f0dc6[_0x879d('0x37')]=qs[_0x879d('0x38')](_0x190e59[_0x879d('0x2f')][_0x879d('0x38')]);_0x8f0dc6[_0x879d('0x39')]=qs[_0x879d('0x31')](_[_0x879d('0x49')](_0x190e59[_0x879d('0x2f')],_0x1e3f59[_0x879d('0x31')]));_0x8f0dc6[_0x879d('0x39')][_0x879d('0x4a')]=_0x3fc5f5['id'];if(_0x190e59[_0x879d('0x2f')][_0x879d('0x3a')]){_0x8f0dc6[_0x879d('0x39')]=_[_0x879d('0x3b')](_0x8f0dc6[_0x879d('0x39')],{'$or':_[_0x879d('0x29')](_0x8f0dc6[_0x879d('0x32')],function(_0x39a9b8){var _0x33f0fa={};_0x33f0fa[_0x39a9b8]={'$like':'%'+_0x190e59['query'][_0x879d('0x3a')]+'%'};return _0x33f0fa;})});}_0x8f0dc6=_['merge']({},_0x8f0dc6,_0x190e59['options']);return db['JscriptyQuestionReport'][_0x879d('0x1c')]({'where':_0x8f0dc6['where']})[_0x879d('0x24')](function(_0x5a8872){_0xa7a984[_0x879d('0x1c')]=_0x5a8872;if(_0x190e59[_0x879d('0x2f')]['includeAll']){_0x8f0dc6[_0x879d('0x41')]=[{'all':!![]}];}return db[_0x879d('0x4b')][_0x879d('0x4c')](_0x8f0dc6);})['then'](function(_0x1ca650){_0xa7a984['rows']=_0x1ca650;return _0xa7a984;});}})[_0x879d('0x24')](respondWithFilteredResult(_0x52775f,_0x8f0dc6))['catch'](handleError(_0x52775f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 283789d..a8d175b 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 _0x0120=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ace=['api','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger'];(function(_0x39b20d,_0x4b5500){var _0x49fa0e=function(_0x232fd0){while(--_0x232fd0){_0x39b20d['push'](_0x39b20d['shift']());}};_0x49fa0e(++_0x4b5500);}(_0x2ace,0x17e));var _0xe2ac=function(_0x3ed091,_0x3491d4){_0x3ed091=_0x3ed091-0x0;var _0x49f07c=_0x2ace[_0x3ed091];return _0x49f07c;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'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 67fbcca..b917f4a 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 _0x4f73=['stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x4f73,0x10f));var _0x34f7=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x4f73[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var moment=require(_0x34f7('0x2'));var BPromise=require(_0x34f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34f7('0x5'));var logger=require('../../config/logger')(_0x34f7('0x6'));var config=require(_0x34f7('0x7'));var jayson=require(_0x34f7('0x8'));var client=jayson[_0x34f7('0x9')][_0x34f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b02ca,_0x576be8,_0x39e1e8){return new BPromise(function(_0x3b0938,_0x29031d){return client[_0x34f7('0xb')](_0x5b02ca,_0x39e1e8)[_0x34f7('0xc')](function(_0x2fabed){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x576be8,_0x34f7('0xd'));logger['debug'](_0x34f7('0xe'),_0x576be8,_0x34f7('0xd'),JSON[_0x34f7('0xf')](_0x2fabed));if(_0x2fabed[_0x34f7('0x10')]){if(_0x2fabed[_0x34f7('0x10')][_0x34f7('0x11')]===0x1f4){logger[_0x34f7('0x10')](_0x34f7('0x12'),_0x576be8,_0x2fabed['error'][_0x34f7('0x13')]);return _0x29031d(_0x2fabed[_0x34f7('0x10')]['message']);}logger[_0x34f7('0x10')](_0x34f7('0x12'),_0x576be8,_0x2fabed[_0x34f7('0x10')][_0x34f7('0x13')]);return _0x3b0938(_0x2fabed[_0x34f7('0x10')]['message']);}else{logger[_0x34f7('0x14')](_0x34f7('0x12'),_0x576be8,_0x34f7('0xd'));_0x3b0938(_0x2fabed[_0x34f7('0x15')][_0x34f7('0x13')]);}})['catch'](function(_0x3460b4){logger[_0x34f7('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x576be8,_0x3460b4);_0x29031d(_0x3460b4);});});} \ No newline at end of file +var _0x7cba=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x4e2fc1,_0x1bcff0){var _0x30acb2=function(_0x2e0901){while(--_0x2e0901){_0x4e2fc1['push'](_0x4e2fc1['shift']());}};_0x30acb2(++_0x1bcff0);}(_0x7cba,0x1ca));var _0xa7cb=function(_0x27fa55,_0x41caab){_0x27fa55=_0x27fa55-0x0;var _0x48d7fa=_0x7cba[_0x27fa55];return _0x48d7fa;};'use strict';var _=require(_0xa7cb('0x0'));var util=require(_0xa7cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7cb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7cb('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa7cb('0x4')][_0xa7cb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5cad2,_0x2b2b6b,_0x563ff3){return new BPromise(function(_0x43870e,_0x55ed7a){return client[_0xa7cb('0x6')](_0x5cad2,_0x563ff3)[_0xa7cb('0x7')](function(_0x28a66e){logger[_0xa7cb('0x8')](_0xa7cb('0x9'),_0x2b2b6b,_0xa7cb('0xa'));logger['debug'](_0xa7cb('0xb'),_0x2b2b6b,_0xa7cb('0xa'),JSON[_0xa7cb('0xc')](_0x28a66e));if(_0x28a66e[_0xa7cb('0xd')]){if(_0x28a66e[_0xa7cb('0xd')][_0xa7cb('0xe')]===0x1f4){logger[_0xa7cb('0xd')](_0xa7cb('0x9'),_0x2b2b6b,_0x28a66e[_0xa7cb('0xd')][_0xa7cb('0xf')]);return _0x55ed7a(_0x28a66e[_0xa7cb('0xd')][_0xa7cb('0xf')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2b2b6b,_0x28a66e[_0xa7cb('0xd')][_0xa7cb('0xf')]);return _0x43870e(_0x28a66e[_0xa7cb('0xd')][_0xa7cb('0xf')]);}else{logger[_0xa7cb('0x8')](_0xa7cb('0x9'),_0x2b2b6b,_0xa7cb('0xa'));_0x43870e(_0x28a66e[_0xa7cb('0x10')][_0xa7cb('0xf')]);}})[_0xa7cb('0x11')](function(_0x5959ca){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2b2b6b,_0x5959ca);_0x55ed7a(_0x5959ca);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c8c75bf..a4ec0b4 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 _0xc146=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','exports','multer','util'];(function(_0x366e51,_0x3a0178){var _0x4e23e3=function(_0x7ecebe){while(--_0x7ecebe){_0x366e51['push'](_0x366e51['shift']());}};_0x4e23e3(++_0x3a0178);}(_0xc146,0x6e));var _0x6c14=function(_0xb111c8,_0xc5f21b){_0xb111c8=_0xb111c8-0x0;var _0x14fe55=_0xc146[_0xb111c8];return _0x14fe55;};'use strict';var multer=require(_0x6c14('0x0'));var util=require(_0x6c14('0x1'));var path=require(_0x6c14('0x2'));var timeout=require(_0x6c14('0x3'));var express=require(_0x6c14('0x4'));var router=express[_0x6c14('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c14('0x6'));var config=require(_0x6c14('0x7'));var controller=require(_0x6c14('0x8'));router['get']('/',controller[_0x6c14('0x9')]);router[_0x6c14('0xa')](_0x6c14('0xb'),auth[_0x6c14('0xc')](),controller['update']);module[_0x6c14('0xd')]=router; \ No newline at end of file +var _0xbcf8=['get','index','isAuthenticated','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller'];(function(_0xfb52ae,_0xc603c2){var _0x2f5d89=function(_0x179652){while(--_0x179652){_0xfb52ae['push'](_0xfb52ae['shift']());}};_0x2f5d89(++_0xc603c2);}(_0xbcf8,0xa0));var _0x8bcf=function(_0x41e86c,_0x5a01d6){_0x41e86c=_0x41e86c-0x0;var _0x380566=_0xbcf8[_0x41e86c];return _0x380566;};'use strict';var multer=require(_0x8bcf('0x0'));var util=require(_0x8bcf('0x1'));var path=require('path');var timeout=require(_0x8bcf('0x2'));var express=require(_0x8bcf('0x3'));var router=express[_0x8bcf('0x4')]();var auth=require(_0x8bcf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8bcf('0x6'));var controller=require(_0x8bcf('0x7'));router[_0x8bcf('0x8')]('/',controller[_0x8bcf('0x9')]);router['put']('/:id',auth[_0x8bcf('0xa')](),controller[_0x8bcf('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 13595db..fc338b5 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 _0x326f=['STRING','INTEGER','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x326f,0xd1));var _0xf326=function(_0xb0acf2,_0x2d662e){_0xb0acf2=_0xb0acf2-0x0;var _0x4c0e7c=_0x326f[_0xb0acf2];return _0x4c0e7c;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x187d=['TEXT','STRING','INTEGER','sequelize'];(function(_0x46f48d,_0x216569){var _0x33d178=function(_0x240e27){while(--_0x240e27){_0x46f48d['push'](_0x46f48d['shift']());}};_0x33d178(++_0x216569);}(_0x187d,0x93));var _0xd187=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x187d[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'license':{'type':Sequelize[_0xd187('0x1')]},'data1':{'type':Sequelize[_0xd187('0x2')]},'data2':{'type':Sequelize[_0xd187('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd187('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 c39af75..cdab800 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 _0x0dc7=['../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','License','params','checkLicense','key','body','html-pdf','eml-format','zip-dir','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../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','then','destroy','end','sendStatus','error','stack','name','send'];(function(_0x3828d0,_0x1636ed){var _0x11b120=function(_0xb49358){while(--_0xb49358){_0x3828d0['push'](_0x3828d0['shift']());}};_0x11b120(++_0x1636ed);}(_0x0dc7,0x182));var _0x70dc=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x0dc7[_0x3e8cae];return _0x45c4d6;};'use strict';var pdf=require(_0x70dc('0x0'));var emlformat=require(_0x70dc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x70dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x70dc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x70dc('0x5'));var csv=require('to-csv');var ejs=require(_0x70dc('0x6'));var fs=require('fs');var _=require(_0x70dc('0x7'));var squel=require(_0x70dc('0x8'));var crypto=require(_0x70dc('0x9'));var jsforce=require(_0x70dc('0xa'));var deskjs=require(_0x70dc('0xb'));var toCsv=require(_0x70dc('0xc'));var querystring=require(_0x70dc('0xd'));var Papa=require(_0x70dc('0xe'));var Redis=require(_0x70dc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70dc('0x10'));var hardwareService=require(_0x70dc('0x11'));var logger=require(_0x70dc('0x12'))(_0x70dc('0x13'));var utils=require(_0x70dc('0x14'));var config=require(_0x70dc('0x15'));var db=require(_0x70dc('0x16'))['db'];function respondWithStatusCode(_0x210aaa,_0x7c6ea8){_0x7c6ea8=_0x7c6ea8||0xcc;return function(_0x42e4e0){if(_0x42e4e0){return _0x210aaa['sendStatus'](_0x7c6ea8);}return _0x210aaa[_0x70dc('0x17')](_0x7c6ea8)['end']();};}function respondWithResult(_0x1be9c8,_0x2ee1d7){_0x2ee1d7=_0x2ee1d7||0xc8;return function(_0x4c3e6e){if(_0x4c3e6e){return _0x1be9c8[_0x70dc('0x17')](_0x2ee1d7)[_0x70dc('0x18')](_0x4c3e6e);}};}function respondWithFilteredResult(_0x285300,_0x46d3e7){return function(_0x43b037){if(_0x43b037){var _0x8efba8=_0x43b037[_0x70dc('0x19')],_0xbfe289=_0x46d3e7[_0x70dc('0x1a')],_0x51f9e4=_0x46d3e7['offset']+_0x46d3e7[_0x70dc('0x1b')],_0x17992a;if(_0x51f9e4>=_0x8efba8){_0x51f9e4=_0x8efba8;_0x17992a=0xc8;}else{_0x17992a=0xce;}_0x285300[_0x70dc('0x17')](_0x17992a);return _0x285300[_0x70dc('0x1c')](_0x70dc('0x1d'),_0xbfe289+'-'+_0x51f9e4+'/'+_0x8efba8)['json'](_0x43b037);}return null;};}function patchUpdates(_0x54f150){return function(_0x46e26a){try{jsonpatch[_0x70dc('0x1e')](_0x46e26a,_0x54f150,!![]);}catch(_0x17fecb){return BPromise[_0x70dc('0x1f')](_0x17fecb);}return _0x46e26a[_0x70dc('0x20')]();};}function saveUpdates(_0x4065e2,_0x136309){return function(_0x5769bc){if(_0x5769bc){return _0x5769bc['update'](_0x4065e2)[_0x70dc('0x21')](function(_0x1fb21f){return _0x1fb21f;});}return null;};}function removeEntity(_0x45962b,_0x4d9ef8){return function(_0x3a479a){if(_0x3a479a){return _0x3a479a[_0x70dc('0x22')]()[_0x70dc('0x21')](function(){_0x45962b[_0x70dc('0x17')](0xcc)[_0x70dc('0x23')]();});}};}function handleEntityNotFound(_0xc7f2f2,_0x4ee57e){return function(_0x107e05){if(!_0x107e05){_0xc7f2f2[_0x70dc('0x24')](0x194);}return _0x107e05;};}function handleError(_0x2dd825,_0x522c39){_0x522c39=_0x522c39||0x1f4;return function(_0x472885){logger[_0x70dc('0x25')](_0x472885[_0x70dc('0x26')]);if(_0x472885[_0x70dc('0x27')]){delete _0x472885[_0x70dc('0x27')];}_0x2dd825[_0x70dc('0x17')](_0x522c39)[_0x70dc('0x28')](_0x472885);};}var utilLicense=require(_0x70dc('0x29'));exports['index']=function(_0x2c3e4a,_0x323429){var _0x56cbe7={'raw':!![],'where':{'id':0x1}},_0x9ef3f0={};_0x9ef3f0[_0x70dc('0x2a')]=_[_0x70dc('0x2b')](db['License'][_0x70dc('0x2c')]);_0x9ef3f0[_0x70dc('0x2d')]=_['keys'](_0x2c3e4a[_0x70dc('0x2d')]);_0x9ef3f0[_0x70dc('0x2e')]=_[_0x70dc('0x2f')](_0x9ef3f0[_0x70dc('0x2a')],_0x9ef3f0['query']);_0x56cbe7[_0x70dc('0x30')]=_[_0x70dc('0x2f')](_0x9ef3f0[_0x70dc('0x2a')],qs[_0x70dc('0x31')](_0x2c3e4a[_0x70dc('0x2d')]['fields']));_0x56cbe7[_0x70dc('0x30')]=_0x56cbe7[_0x70dc('0x30')][_0x70dc('0x32')]?_0x56cbe7[_0x70dc('0x30')]:_0x9ef3f0['model'];_0x56cbe7=_[_0x70dc('0x33')]({},_0x56cbe7,_0x2c3e4a[_0x70dc('0x34')]);return utilLicense[_0x70dc('0x35')](_0x56cbe7)[_0x70dc('0x21')](respondWithResult(_0x323429,null))[_0x70dc('0x36')](handleError(_0x323429,null));};exports[_0x70dc('0x37')]=function(_0x49cd5e,_0xed5ad1){if(_0x49cd5e['body']['id']){delete _0x49cd5e['body']['id'];}return db[_0x70dc('0x38')]['find']({'where':{'id':_0x49cd5e[_0x70dc('0x39')]['id']}})[_0x70dc('0x21')](handleEntityNotFound(_0xed5ad1,null))[_0x70dc('0x21')](function(_0x29f11c){var _0x557b81=_0x29f11c['get']({'plain':!![]});return utilLicense[_0x70dc('0x3a')](_0x557b81,_0x49cd5e['body'][_0x70dc('0x3b')]);})['then'](function(_0x419c15){if(!_0x419c15['demo']){return saveUpdates(_0x49cd5e[_0x70dc('0x3c')],null);}return _0x419c15;})[_0x70dc('0x21')](respondWithResult(_0xed5ad1,null))['catch'](handleError(_0xed5ad1,null));}; \ No newline at end of file +var _0xf2e4=['../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','params','checkLicense','key','demo','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','stack','name','send'];(function(_0x2d1e4c,_0xc214dc){var _0x3ec8dd=function(_0x406fb1){while(--_0x406fb1){_0x2d1e4c['push'](_0x2d1e4c['shift']());}};_0x3ec8dd(++_0xc214dc);}(_0xf2e4,0x8f));var _0x4f2e=function(_0x4fbbb3,_0x2f33ea){_0x4fbbb3=_0x4fbbb3-0x0;var _0x1bdc5e=_0xf2e4[_0x4fbbb3];return _0x1bdc5e;};'use strict';var pdf=require(_0x4f2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f2e('0x1'));var zipdir=require(_0x4f2e('0x2'));var jsonpatch=require(_0x4f2e('0x3'));var rp=require('request-promise');var moment=require(_0x4f2e('0x4'));var BPromise=require(_0x4f2e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f2e('0x6'));var sox=require(_0x4f2e('0x7'));var csv=require(_0x4f2e('0x8'));var ejs=require(_0x4f2e('0x9'));var fs=require('fs');var _=require(_0x4f2e('0xa'));var squel=require('squel');var crypto=require(_0x4f2e('0xb'));var jsforce=require(_0x4f2e('0xc'));var deskjs=require(_0x4f2e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f2e('0xe'));var authService=require(_0x4f2e('0xf'));var qs=require(_0x4f2e('0x10'));var as=require(_0x4f2e('0x11'));var hardwareService=require(_0x4f2e('0x12'));var logger=require('../../config/logger')(_0x4f2e('0x13'));var utils=require(_0x4f2e('0x14'));var config=require(_0x4f2e('0x15'));var db=require(_0x4f2e('0x16'))['db'];function respondWithStatusCode(_0x6761f6,_0x3adb4a){_0x3adb4a=_0x3adb4a||0xcc;return function(_0x4ee5af){if(_0x4ee5af){return _0x6761f6[_0x4f2e('0x17')](_0x3adb4a);}return _0x6761f6[_0x4f2e('0x18')](_0x3adb4a)['end']();};}function respondWithResult(_0x140785,_0x290252){_0x290252=_0x290252||0xc8;return function(_0x1a5ac2){if(_0x1a5ac2){return _0x140785[_0x4f2e('0x18')](_0x290252)['json'](_0x1a5ac2);}};}function respondWithFilteredResult(_0x365ae7,_0x4258c8){return function(_0x139733){if(_0x139733){var _0x18ba58=_0x139733[_0x4f2e('0x19')],_0x1cdcf2=_0x4258c8['offset'],_0x3d7a3f=_0x4258c8[_0x4f2e('0x1a')]+_0x4258c8[_0x4f2e('0x1b')],_0x5e8062;if(_0x3d7a3f>=_0x18ba58){_0x3d7a3f=_0x18ba58;_0x5e8062=0xc8;}else{_0x5e8062=0xce;}_0x365ae7[_0x4f2e('0x18')](_0x5e8062);return _0x365ae7[_0x4f2e('0x1c')]('Content-Range',_0x1cdcf2+'-'+_0x3d7a3f+'/'+_0x18ba58)[_0x4f2e('0x1d')](_0x139733);}return null;};}function patchUpdates(_0xde0b74){return function(_0x2f0a9a){try{jsonpatch[_0x4f2e('0x1e')](_0x2f0a9a,_0xde0b74,!![]);}catch(_0x37493c){return BPromise[_0x4f2e('0x1f')](_0x37493c);}return _0x2f0a9a[_0x4f2e('0x20')]();};}function saveUpdates(_0xa7a026,_0x1f10cc){return function(_0x5c0be7){if(_0x5c0be7){return _0x5c0be7[_0x4f2e('0x21')](_0xa7a026)[_0x4f2e('0x22')](function(_0x5147e2){return _0x5147e2;});}return null;};}function removeEntity(_0x1ed01d,_0x15a106){return function(_0x57a4fa){if(_0x57a4fa){return _0x57a4fa[_0x4f2e('0x23')]()[_0x4f2e('0x22')](function(){_0x1ed01d[_0x4f2e('0x18')](0xcc)[_0x4f2e('0x24')]();});}};}function handleEntityNotFound(_0x120281,_0x5e2f17){return function(_0x1d5d4f){if(!_0x1d5d4f){_0x120281[_0x4f2e('0x17')](0x194);}return _0x1d5d4f;};}function handleError(_0x511e02,_0x11d99b){_0x11d99b=_0x11d99b||0x1f4;return function(_0x4ddff7){logger['error'](_0x4ddff7[_0x4f2e('0x25')]);if(_0x4ddff7[_0x4f2e('0x26')]){delete _0x4ddff7['name'];}_0x511e02['status'](_0x11d99b)[_0x4f2e('0x27')](_0x4ddff7);};}var utilLicense=require(_0x4f2e('0x28'));exports[_0x4f2e('0x29')]=function(_0x2ab764,_0x471e9a){var _0x101194={'raw':!![],'where':{'id':0x1}},_0x4958a3={};_0x4958a3[_0x4f2e('0x2a')]=_[_0x4f2e('0x2b')](db[_0x4f2e('0x2c')][_0x4f2e('0x2d')]);_0x4958a3[_0x4f2e('0x2e')]=_[_0x4f2e('0x2b')](_0x2ab764['query']);_0x4958a3[_0x4f2e('0x2f')]=_[_0x4f2e('0x30')](_0x4958a3[_0x4f2e('0x2a')],_0x4958a3[_0x4f2e('0x2e')]);_0x101194[_0x4f2e('0x31')]=_[_0x4f2e('0x30')](_0x4958a3['model'],qs[_0x4f2e('0x32')](_0x2ab764[_0x4f2e('0x2e')]['fields']));_0x101194[_0x4f2e('0x31')]=_0x101194[_0x4f2e('0x31')][_0x4f2e('0x33')]?_0x101194[_0x4f2e('0x31')]:_0x4958a3[_0x4f2e('0x2a')];_0x101194=_[_0x4f2e('0x34')]({},_0x101194,_0x2ab764[_0x4f2e('0x35')]);return utilLicense[_0x4f2e('0x36')](_0x101194)[_0x4f2e('0x22')](respondWithResult(_0x471e9a,null))[_0x4f2e('0x37')](handleError(_0x471e9a,null));};exports['update']=function(_0x5363e8,_0x3515bf){if(_0x5363e8[_0x4f2e('0x38')]['id']){delete _0x5363e8[_0x4f2e('0x38')]['id'];}return db['License']['find']({'where':{'id':_0x5363e8[_0x4f2e('0x39')]['id']}})[_0x4f2e('0x22')](handleEntityNotFound(_0x3515bf,null))[_0x4f2e('0x22')](function(_0x90acd9){var _0x17a3e6=_0x90acd9['get']({'plain':!![]});return utilLicense[_0x4f2e('0x3a')](_0x17a3e6,_0x5363e8[_0x4f2e('0x38')][_0x4f2e('0x3b')]);})[_0x4f2e('0x22')](function(_0x4ede9e){if(!_0x4ede9e[_0x4f2e('0x3c')]){return saveUpdates(_0x5363e8[_0x4f2e('0x38')],null);}return _0x4ede9e;})[_0x4f2e('0x22')](respondWithResult(_0x3515bf,null))['catch'](handleError(_0x3515bf,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c7361ed..d4061f2 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 _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x5b00e8,_0x3bc2d4){var _0x2441dd=function(_0x55c38d){while(--_0x55c38d){_0x5b00e8['push'](_0x5b00e8['shift']());}};_0x2441dd(++_0x3bc2d4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17c931,_0x20bb99){_0x17c931=_0x17c931-0x0;var _0x5b54ad=_0x5f2f[_0x17c931];return _0x5b54ad;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x3a3477,_0x497031){var _0x3bc2c2=function(_0x53104a){while(--_0x53104a){_0x3a3477['push'](_0x3a3477['shift']());}};_0x3bc2c2(++_0x497031);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1aea05,_0x1ac65c){_0x1aea05=_0x1aea05-0x0;var _0x33a8af=_0x5f2f[_0x1aea05];return _0x33a8af;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','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 0c6698b..59396cb 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 _0x3f19=['License,\x20%s,\x20%s','message','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x3f19,0xc0));var _0x93f1=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x3f19[_0x146be0];return _0x1bcc25;};'use strict';var _=require(_0x93f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93f1('0x2'))['db'];var utils=require(_0x93f1('0x3'));var logger=require(_0x93f1('0x4'))(_0x93f1('0x5'));var config=require('../../config/environment');var jayson=require(_0x93f1('0x6'));var client=jayson[_0x93f1('0x7')][_0x93f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x425c6f,_0x171bf6,_0xdaa92){return new BPromise(function(_0x5d7374,_0x1874da){return client[_0x93f1('0x9')](_0x425c6f,_0xdaa92)[_0x93f1('0xa')](function(_0x240758){logger[_0x93f1('0xb')]('License,\x20%s,\x20%s',_0x171bf6,_0x93f1('0xc'));logger[_0x93f1('0xd')](_0x93f1('0xe'),_0x171bf6,_0x93f1('0xc'),JSON[_0x93f1('0xf')](_0x240758));if(_0x240758[_0x93f1('0x10')]){if(_0x240758[_0x93f1('0x10')][_0x93f1('0x11')]===0x1f4){logger[_0x93f1('0x10')](_0x93f1('0x12'),_0x171bf6,_0x240758['error'][_0x93f1('0x13')]);return _0x1874da(_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);}logger[_0x93f1('0x10')]('License,\x20%s,\x20%s',_0x171bf6,_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);return _0x5d7374(_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);}else{logger[_0x93f1('0xb')](_0x93f1('0x12'),_0x171bf6,_0x93f1('0xc'));_0x5d7374(_0x240758['result'][_0x93f1('0x13')]);}})[_0x93f1('0x14')](function(_0x3e3afa){logger[_0x93f1('0x10')](_0x93f1('0x12'),_0x171bf6,_0x3e3afa);_0x1874da(_0x3e3afa);});});} \ No newline at end of file +var _0xc3b0=['License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xc3b0,0x166));var _0x0c3b=function(_0x2dada9,_0x3205c6){_0x2dada9=_0x2dada9-0x0;var _0x31a20f=_0xc3b0[_0x2dada9];return _0x31a20f;};'use strict';var _=require(_0x0c3b('0x0'));var util=require(_0x0c3b('0x1'));var moment=require(_0x0c3b('0x2'));var BPromise=require(_0x0c3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c3b('0x4'))['db'];var utils=require(_0x0c3b('0x5'));var logger=require('../../config/logger')(_0x0c3b('0x6'));var config=require(_0x0c3b('0x7'));var jayson=require(_0x0c3b('0x8'));var client=jayson['client'][_0x0c3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e2305,_0x8e628a,_0x4e7c4f){return new BPromise(function(_0x5c4e3a,_0x4b38b5){return client[_0x0c3b('0xa')](_0x3e2305,_0x4e7c4f)[_0x0c3b('0xb')](function(_0x4414f9){logger[_0x0c3b('0xc')](_0x0c3b('0xd'),_0x8e628a,_0x0c3b('0xe'));logger[_0x0c3b('0xf')](_0x0c3b('0x10'),_0x8e628a,_0x0c3b('0xe'),JSON[_0x0c3b('0x11')](_0x4414f9));if(_0x4414f9[_0x0c3b('0x12')]){if(_0x4414f9[_0x0c3b('0x12')]['code']===0x1f4){logger[_0x0c3b('0x12')]('License,\x20%s,\x20%s',_0x8e628a,_0x4414f9[_0x0c3b('0x12')]['message']);return _0x4b38b5(_0x4414f9[_0x0c3b('0x12')][_0x0c3b('0x13')]);}logger[_0x0c3b('0x12')](_0x0c3b('0xd'),_0x8e628a,_0x4414f9[_0x0c3b('0x12')][_0x0c3b('0x13')]);return _0x5c4e3a(_0x4414f9['error'][_0x0c3b('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x8e628a,_0x0c3b('0xe'));_0x5c4e3a(_0x4414f9[_0x0c3b('0x14')][_0x0c3b('0x13')]);}})[_0x0c3b('0x15')](function(_0x34d425){logger['error']('License,\x20%s,\x20%s',_0x8e628a,_0x34d425);_0x4b38b5(_0x34d425);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8ad529e..65a826c 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 _0x6e17=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe'];(function(_0x5afe35,_0x281af5){var _0x3cd1ca=function(_0x5ec418){while(--_0x5ec418){_0x5afe35['push'](_0x5afe35['shift']());}};_0x3cd1ca(++_0x281af5);}(_0x6e17,0x11c));var _0x76e1=function(_0x10d2cd,_0x48316f){_0x10d2cd=_0x10d2cd-0x0;var _0x59594f=_0x6e17[_0x10d2cd];return _0x59594f;};'use strict';var multer=require(_0x76e1('0x0'));var util=require(_0x76e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x76e1('0x2'));var router=express['Router']();var auth=require(_0x76e1('0x3'));var interaction=require(_0x76e1('0x4'));var config=require(_0x76e1('0x5'));var controller=require(_0x76e1('0x6'));router[_0x76e1('0x7')]('/',auth[_0x76e1('0x8')](),controller['index']);router[_0x76e1('0x7')](_0x76e1('0x9'),auth[_0x76e1('0x8')](),controller['describe']);router[_0x76e1('0x7')](_0x76e1('0xa'),auth[_0x76e1('0x8')](),controller[_0x76e1('0xb')]);router[_0x76e1('0x7')](_0x76e1('0xc'),auth['isAuthenticated'](),controller[_0x76e1('0xd')]);router[_0x76e1('0x7')](_0x76e1('0xe'),auth[_0x76e1('0x8')](),controller['getAnswers']);router[_0x76e1('0x7')](_0x76e1('0xf'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x10')]);router['get'](_0x76e1('0x11'),auth['isAuthenticated'](),controller[_0x76e1('0x12')]);router['get'](_0x76e1('0x13'),auth['isAuthenticated'](),controller[_0x76e1('0x14')]);router[_0x76e1('0x7')](_0x76e1('0x15'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x16')]);router[_0x76e1('0x7')]('/:id/messages',auth[_0x76e1('0x8')](),controller['getMessages']);router[_0x76e1('0x7')]('/:id/verify',auth[_0x76e1('0x8')](),controller[_0x76e1('0x17')]);router[_0x76e1('0x7')](_0x76e1('0x18'),auth['isAuthenticated'](),controller[_0x76e1('0x19')]);router[_0x76e1('0x1a')](_0x76e1('0xc'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x1b')]);router['post'](_0x76e1('0xe'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x1c')]);router['post']('/',auth[_0x76e1('0x8')](),controller[_0x76e1('0x1d')]);router[_0x76e1('0x1a')](_0x76e1('0xf'),auth['isAuthenticated'](),controller[_0x76e1('0x1e')]);router['post'](_0x76e1('0x11'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x1f')]);router[_0x76e1('0x1a')]('/:id/interactions',auth[_0x76e1('0x8')](),controller[_0x76e1('0x20')]);router[_0x76e1('0x1a')](_0x76e1('0x15'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x21')]);router[_0x76e1('0x1a')]('/:id/send',auth[_0x76e1('0x8')](),controller['send']);router[_0x76e1('0x1a')](_0x76e1('0x18'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x22')]);router['put'](_0x76e1('0xa'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x23')]);router[_0x76e1('0x24')](_0x76e1('0xc'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x25')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x76e1('0x24')](_0x76e1('0xf'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x26')]);router[_0x76e1('0x24')]('/:id/out_servers',auth[_0x76e1('0x8')](),controller[_0x76e1('0x27')]);router[_0x76e1('0x24')](_0x76e1('0xa'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x28')]);router[_0x76e1('0x24')](_0x76e1('0x18'),auth[_0x76e1('0x8')](),controller[_0x76e1('0x29')]);module['exports']=router; \ No newline at end of file +var _0x4169=['/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','addImap','addSmtp','/:id/interactions','addInteraction','/:id/send','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','Router','../../components/auth/service','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x4169,0x17b));var _0x9416=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4169[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9416('0x0')]();var auth=require(_0x9416('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9416('0x2'));router['get']('/',auth[_0x9416('0x3')](),controller[_0x9416('0x4')]);router[_0x9416('0x5')](_0x9416('0x6'),auth['isAuthenticated'](),controller[_0x9416('0x7')]);router[_0x9416('0x5')](_0x9416('0x8'),auth[_0x9416('0x3')](),controller['show']);router[_0x9416('0x5')]('/:id/dispositions',auth[_0x9416('0x3')](),controller[_0x9416('0x9')]);router['get'](_0x9416('0xa'),auth['isAuthenticated'](),controller[_0x9416('0xb')]);router[_0x9416('0x5')](_0x9416('0xc'),auth['isAuthenticated'](),controller['getImap']);router[_0x9416('0x5')](_0x9416('0xd'),auth['isAuthenticated'](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0x9416('0x3')](),controller[_0x9416('0xe')]);router['get'](_0x9416('0xf'),auth[_0x9416('0x3')](),controller[_0x9416('0x10')]);router['get'](_0x9416('0x11'),auth[_0x9416('0x3')](),controller[_0x9416('0x12')]);router[_0x9416('0x5')](_0x9416('0x13'),auth['isAuthenticated'](),controller[_0x9416('0x14')]);router[_0x9416('0x5')](_0x9416('0x15'),auth[_0x9416('0x3')](),controller[_0x9416('0x16')]);router['post'](_0x9416('0x17'),auth[_0x9416('0x3')](),controller[_0x9416('0x18')]);router[_0x9416('0x19')](_0x9416('0xa'),auth[_0x9416('0x3')](),controller[_0x9416('0x1a')]);router[_0x9416('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9416('0x19')](_0x9416('0xc'),auth[_0x9416('0x3')](),controller[_0x9416('0x1b')]);router['post'](_0x9416('0xd'),auth[_0x9416('0x3')](),controller[_0x9416('0x1c')]);router[_0x9416('0x19')](_0x9416('0x1d'),auth[_0x9416('0x3')](),controller[_0x9416('0x1e')]);router['post'](_0x9416('0xf'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9416('0x19')](_0x9416('0x1f'),auth[_0x9416('0x3')](),controller['send']);router[_0x9416('0x19')](_0x9416('0x15'),auth[_0x9416('0x3')](),controller['addAgents']);router[_0x9416('0x20')](_0x9416('0x8'),auth[_0x9416('0x3')](),controller[_0x9416('0x21')]);router[_0x9416('0x22')](_0x9416('0x17'),auth[_0x9416('0x3')](),controller[_0x9416('0x23')]);router[_0x9416('0x22')](_0x9416('0xa'),auth[_0x9416('0x3')](),controller['removeAnswers']);router['delete'](_0x9416('0xc'),auth[_0x9416('0x3')](),controller[_0x9416('0x24')]);router['delete']('/:id/out_servers',auth[_0x9416('0x3')](),controller[_0x9416('0x25')]);router['delete']('/:id',auth[_0x9416('0x3')](),controller['destroy']);router[_0x9416('0x22')]('/:id/users',auth[_0x9416('0x3')](),controller[_0x9416('0x26')]);module[_0x9416('0x27')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f1a9741..a647e32 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 _0x3514=['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','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x49afa2,_0x2ed632){var _0x4c77a0=function(_0xdfdc88){while(--_0xdfdc88){_0x49afa2['push'](_0x49afa2['shift']());}};_0x4c77a0(++_0x2ed632);}(_0x3514,0x1b1));var _0x4351=function(_0x308fdc,_0x431a69){_0x308fdc=_0x308fdc-0x0;var _0xaf632e=_0x3514[_0x308fdc];return _0xaf632e;};'use strict';var Sequelize=require(_0x4351('0x0'));module[_0x4351('0x1')]={'description':{'type':Sequelize[_0x4351('0x2')]},'name':{'type':Sequelize[_0x4351('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4351('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4351('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4351('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x4351('0x4')]},'markAsUnread':{'type':Sequelize[_0x4351('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4351('0x2')],'allowNull':![],'defaultValue':_0x4351('0x5')},'fontSize':{'type':Sequelize[_0x4351('0x6')](0x2)[_0x4351('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4351('0x4')],'defaultValue':function(){return _0x4351('0x8');}},'notificationSound':{'type':Sequelize[_0x4351('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4351('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4351('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4351('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4351('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4351('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x4351('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x4351('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5709c9){if(!_0x5709c9)this[_0x4351('0xa')]('mandatoryDispositionPauseId',null);this[_0x4351('0xa')]('mandatoryDisposition',_0x5709c9);}}}; \ No newline at end of file +var _0x0bbb=['exports','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0x0bbb,0xc6));var _0xb0bb=function(_0x48baec,_0x5e0d23){_0x48baec=_0x48baec-0x0;var _0x32cee3=_0x0bbb[_0x48baec];return _0x32cee3;};'use strict';var Sequelize=require('sequelize');module[_0xb0bb('0x0')]={'description':{'type':Sequelize[_0xb0bb('0x1')]},'name':{'type':Sequelize[_0xb0bb('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xb0bb('0x3')](0x2)[_0xb0bb('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb0bb('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb0bb('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0bb('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0bb('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb0bb('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xb0bb('0x2')],'defaultValue':![],'comment':_0xb0bb('0x7'),'set':function(_0x184417){if(!_0x184417)this[_0xb0bb('0x8')]('mandatoryDispositionPauseId',null);this[_0xb0bb('0x8')]('mandatoryDisposition',_0x184417);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4a43000..af76aa6 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 _0xd329=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','get','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','ids','findOne','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','basename','secure','auth','SendMail','sendMail','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xd329,0xa0));var _0x9d32=function(_0x5def94,_0x4a7172){_0x5def94=_0x5def94-0x0;var _0x29f63d=_0xd329[_0x5def94];return _0x29f63d;};'use strict';var pdf=require(_0x9d32('0x0'));var emlformat=require(_0x9d32('0x1'));var rimraf=require(_0x9d32('0x2'));var zipdir=require(_0x9d32('0x3'));var jsonpatch=require(_0x9d32('0x4'));var rp=require('request-promise');var moment=require(_0x9d32('0x5'));var BPromise=require(_0x9d32('0x6'));var Mustache=require(_0x9d32('0x7'));var util=require('util');var path=require(_0x9d32('0x8'));var sox=require(_0x9d32('0x9'));var csv=require(_0x9d32('0xa'));var ejs=require(_0x9d32('0xb'));var fs=require('fs');var _=require(_0x9d32('0xc'));var squel=require(_0x9d32('0xd'));var crypto=require(_0x9d32('0xe'));var jsforce=require(_0x9d32('0xf'));var deskjs=require(_0x9d32('0x10'));var toCsv=require(_0x9d32('0xa'));var querystring=require('querystring');var Papa=require(_0x9d32('0x11'));var Redis=require('ioredis');var authService=require(_0x9d32('0x12'));var qs=require(_0x9d32('0x13'));var as=require(_0x9d32('0x14'));var hardwareService=require(_0x9d32('0x15'));var logger=require('../../config/logger')(_0x9d32('0x16'));var utils=require(_0x9d32('0x17'));var config=require(_0x9d32('0x18'));var db=require(_0x9d32('0x19'))['db'];config['redis']=_[_0x9d32('0x1a')](config[_0x9d32('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d32('0x1c'))(new Redis(config['redis']));require(_0x9d32('0x1d'))[_0x9d32('0x1e')](socket);var jayson=require(_0x9d32('0x1f'));var client=jayson[_0x9d32('0x20')][_0x9d32('0x21')]({'port':0x232b});function checkPasswordPattern(_0x5e7881,_0x179eb6,_0x2cc6db){if(_0x2cc6db){var _0x2ba625=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ba625[_0x9d32('0x22')](_0x179eb6)){return _0x5e7881;}else{throw new db[(_0x9d32('0x23'))][(_0x9d32('0x24'))](_0x9d32('0x25'));}}else{return _0x5e7881;}}function respondWithRpcPromise(_0x5e3140,_0x9ad78,_0xed0a01,_0x445167){return new BPromise(function(_0x36811a,_0x4fb26f){var _0x22f3f6=_0x445167||client;return _0x22f3f6['request'](_0x5e3140,_0xed0a01)[_0x9d32('0x26')](function(_0x35d36d){logger[_0x9d32('0x27')](_0x9d32('0x28'),_0x9ad78,_0x9d32('0x29'));logger[_0x9d32('0x2a')](_0x9d32('0x2b'),_0x9ad78,_0x9d32('0x29'),JSON[_0x9d32('0x2c')](_0x35d36d));if(_0x35d36d['error']){if(_0x35d36d[_0x9d32('0x2d')]['code']===0x1f4){logger['error'](_0x9d32('0x28'),_0x9ad78,_0x35d36d[_0x9d32('0x2d')][_0x9d32('0x2e')]);return _0x4fb26f(_0x35d36d[_0x9d32('0x2d')]['message']);}logger[_0x9d32('0x2d')](_0x9d32('0x28'),_0x9ad78,_0x35d36d[_0x9d32('0x2d')]['message']);return _0x36811a(_0x35d36d[_0x9d32('0x2d')][_0x9d32('0x2e')]);}else{logger[_0x9d32('0x27')]('MailAccount,\x20%s,\x20%s',_0x9ad78,_0x9d32('0x29'));_0x36811a(_0x35d36d[_0x9d32('0x2f')][_0x9d32('0x2e')]);}})[_0x9d32('0x30')](function(_0x469f1e){logger[_0x9d32('0x2d')](_0x9d32('0x28'),_0x9ad78,_0x469f1e);_0x4fb26f(_0x469f1e);});});}function respondWithStatusCode(_0x2094b3,_0x581bca){_0x581bca=_0x581bca||0xcc;return function(_0x187c27){if(_0x187c27){return _0x2094b3[_0x9d32('0x31')](_0x581bca);}return _0x2094b3[_0x9d32('0x32')](_0x581bca)[_0x9d32('0x33')]();};}function respondWithResult(_0x411c09,_0x387d97){_0x387d97=_0x387d97||0xc8;return function(_0x54c184){if(_0x54c184){return _0x411c09[_0x9d32('0x32')](_0x387d97)[_0x9d32('0x34')](_0x54c184);}};}function respondWithFilteredResult(_0x38d8ee,_0x3b8377){return function(_0x3fcee1){if(_0x3fcee1){var _0x5501ec=_0x3fcee1[_0x9d32('0x35')],_0x46e736=_0x3b8377[_0x9d32('0x36')],_0x335339=_0x3b8377[_0x9d32('0x36')]+_0x3b8377[_0x9d32('0x37')],_0x12e119;if(_0x335339>=_0x5501ec){_0x335339=_0x5501ec;_0x12e119=0xc8;}else{_0x12e119=0xce;}_0x38d8ee[_0x9d32('0x32')](_0x12e119);return _0x38d8ee[_0x9d32('0x38')]('Content-Range',_0x46e736+'-'+_0x335339+'/'+_0x5501ec)['json'](_0x3fcee1);}return null;};}function patchUpdates(_0x294635){return function(_0x5e3c6c){try{jsonpatch[_0x9d32('0x39')](_0x5e3c6c,_0x294635,!![]);}catch(_0x5551da){return BPromise['reject'](_0x5551da);}return _0x5e3c6c['save']();};}function saveUpdates(_0x5e5328,_0x3164ac){return function(_0x48204b){if(_0x48204b){return _0x48204b[_0x9d32('0x3a')](_0x5e5328)[_0x9d32('0x26')](function(_0xec50e6){return _0xec50e6;});}return null;};}function removeEntity(_0x3f1141,_0x5b22db){return function(_0x414945){if(_0x414945){return _0x414945[_0x9d32('0x3b')]()[_0x9d32('0x26')](function(){var _0x165940=_0x414945[_0x9d32('0x3c')]({'plain':!![]});var _0x2ddc4d='MailAccounts';return db[_0x9d32('0x3d')][_0x9d32('0x3b')]({'where':{'type':_0x2ddc4d,'resourceId':_0x165940['id']}})[_0x9d32('0x26')](function(){return _0x414945;});})['then'](function(){_0x3f1141['status'](0xcc)[_0x9d32('0x33')]();});}};}function handleEntityNotFound(_0x349c88,_0x436ee7){return function(_0x405c7b){if(!_0x405c7b){_0x349c88[_0x9d32('0x31')](0x194);}return _0x405c7b;};}function handleError(_0x4f2920,_0x4d1a24){_0x4d1a24=_0x4d1a24||0x1f4;return function(_0x15bd95){logger[_0x9d32('0x2d')](_0x15bd95[_0x9d32('0x3e')]);if(_0x15bd95[_0x9d32('0x3f')]){delete _0x15bd95[_0x9d32('0x3f')];}_0x4f2920[_0x9d32('0x32')](_0x4d1a24)[_0x9d32('0x40')](_0x15bd95);};}exports['index']=function(_0x360264,_0x2a2ac8){var _0x1e6ff4={'include':[{'model':db[_0x9d32('0x41')],'as':_0x9d32('0x42')},{'model':db[_0x9d32('0x43')],'as':_0x9d32('0x44')},{'model':db[_0x9d32('0x45')],'as':_0x9d32('0x46')}]},_0x3fd981={},_0x59ae50={'count':0x0,'rows':[]};var _0x1b3dac=_['map'](db[_0x9d32('0x47')]['rawAttributes'],function(_0x2b3c41){return{'name':_0x2b3c41[_0x9d32('0x48')],'type':_0x2b3c41[_0x9d32('0x49')]['key']};});_0x3fd981[_0x9d32('0x4a')]=_[_0x9d32('0x4b')](_0x1b3dac,'name');_0x3fd981[_0x9d32('0x4c')]=_[_0x9d32('0x4d')](_0x360264['query']);_0x3fd981[_0x9d32('0x4e')]=_[_0x9d32('0x4f')](_0x3fd981['model'],_0x3fd981[_0x9d32('0x4c')]);_0x1e6ff4[_0x9d32('0x50')]=_[_0x9d32('0x4f')](_0x3fd981[_0x9d32('0x4a')],qs['fields'](_0x360264['query'][_0x9d32('0x51')]));_0x1e6ff4['attributes']=_0x1e6ff4[_0x9d32('0x50')][_0x9d32('0x52')]?_0x1e6ff4[_0x9d32('0x50')]:_0x3fd981[_0x9d32('0x4a')];if(!_0x360264[_0x9d32('0x4c')][_0x9d32('0x53')](_0x9d32('0x54'))){_0x1e6ff4[_0x9d32('0x37')]=qs[_0x9d32('0x37')](_0x360264['query'][_0x9d32('0x37')]);_0x1e6ff4[_0x9d32('0x36')]=qs[_0x9d32('0x36')](_0x360264[_0x9d32('0x4c')][_0x9d32('0x36')]);}_0x1e6ff4[_0x9d32('0x55')]=qs[_0x9d32('0x56')](_0x360264[_0x9d32('0x4c')][_0x9d32('0x56')]);_0x1e6ff4[_0x9d32('0x57')]=qs[_0x9d32('0x4e')](_[_0x9d32('0x58')](_0x360264[_0x9d32('0x4c')],_0x3fd981[_0x9d32('0x4e')]),_0x1b3dac);if(_0x360264[_0x9d32('0x4c')][_0x9d32('0x59')]){_0x1e6ff4[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x1e6ff4[_0x9d32('0x57')],{'$or':_['map'](_0x1b3dac,function(_0x394fa1){if(_0x394fa1[_0x9d32('0x49')]!==_0x9d32('0x5b')){var _0x4734c6={};_0x4734c6[_0x394fa1[_0x9d32('0x3f')]]={'$like':'%'+_0x360264[_0x9d32('0x4c')][_0x9d32('0x59')]+'%'};return _0x4734c6;}})});}_0x1e6ff4=_[_0x9d32('0x5a')]({},_0x1e6ff4,_0x360264[_0x9d32('0x5c')]);var _0x50e66a={'where':_0x1e6ff4['where']};return db['MailAccount'][_0x9d32('0x35')](_0x50e66a)['then'](function(_0xb03d3a){_0x59ae50[_0x9d32('0x35')]=_0xb03d3a;if(_0x360264[_0x9d32('0x4c')]['includeAll']){_0x1e6ff4[_0x9d32('0x5d')]=[{'all':!![]}];}return db[_0x9d32('0x47')][_0x9d32('0x5e')](_0x1e6ff4);})[_0x9d32('0x26')](function(_0x24ce97){_0x59ae50[_0x9d32('0x5f')]=_0x24ce97;return _0x59ae50;})[_0x9d32('0x26')](respondWithFilteredResult(_0x2a2ac8,_0x1e6ff4))[_0x9d32('0x30')](handleError(_0x2a2ac8,null));};exports[_0x9d32('0x60')]=function(_0x9ee102,_0x5446bc){var _0x4ba5b9={'raw':![],'where':{'id':_0x9ee102[_0x9d32('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9d32('0x42')},{'model':db[_0x9d32('0x43')],'as':'Smtp'},{'model':db[_0x9d32('0x45')],'as':_0x9d32('0x46')}]},_0x3650b4={};_0x3650b4[_0x9d32('0x4a')]=_[_0x9d32('0x4d')](db[_0x9d32('0x47')][_0x9d32('0x62')]);_0x3650b4[_0x9d32('0x4c')]=_['keys'](_0x9ee102[_0x9d32('0x4c')]);_0x3650b4['filters']=_[_0x9d32('0x4f')](_0x3650b4[_0x9d32('0x4a')],_0x3650b4['query']);_0x4ba5b9[_0x9d32('0x50')]=_[_0x9d32('0x4f')](_0x3650b4['model'],qs[_0x9d32('0x51')](_0x9ee102[_0x9d32('0x4c')][_0x9d32('0x51')]));_0x4ba5b9[_0x9d32('0x50')]=_0x4ba5b9[_0x9d32('0x50')][_0x9d32('0x52')]?_0x4ba5b9[_0x9d32('0x50')]:_0x3650b4['model'];if(_0x9ee102['query'][_0x9d32('0x63')]){_0x4ba5b9[_0x9d32('0x5d')]=[{'all':!![]}];}_0x4ba5b9=_[_0x9d32('0x5a')]({},_0x4ba5b9,_0x9ee102[_0x9d32('0x5c')]);return db['MailAccount'][_0x9d32('0x64')](_0x4ba5b9)['then'](handleEntityNotFound(_0x5446bc,null))[_0x9d32('0x26')](respondWithResult(_0x5446bc,null))['catch'](handleError(_0x5446bc,null));};exports[_0x9d32('0x3a')]=function(_0x36a61b,_0x5288d0){if(_0x36a61b[_0x9d32('0x65')]['id']){delete _0x36a61b[_0x9d32('0x65')]['id'];}return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0x36a61b['params']['id']},'include':[{'model':db[_0x9d32('0x41')],'as':_0x9d32('0x42')},{'model':db[_0x9d32('0x43')],'as':_0x9d32('0x44')},{'model':db[_0x9d32('0x45')],'as':_0x9d32('0x46')}]})['then'](handleEntityNotFound(_0x5288d0,null))['then'](saveUpdates(_0x36a61b[_0x9d32('0x65')],null))[_0x9d32('0x26')](function(_0x5e7f4f){if(_0x5e7f4f&&_0x36a61b[_0x9d32('0x65')][_0x9d32('0x42')]){return db[_0x9d32('0x41')][_0x9d32('0x3a')](_0x36a61b['body'][_0x9d32('0x42')],{'where':{'MailAccountId':_0x5e7f4f['id']}})['then'](function(){return _0x5e7f4f;});}return _0x5e7f4f;})[_0x9d32('0x26')](function(_0xed79a3){if(_0xed79a3&&_0x36a61b[_0x9d32('0x65')][_0x9d32('0x44')]){return db[_0x9d32('0x43')][_0x9d32('0x3a')](_0x36a61b[_0x9d32('0x65')][_0x9d32('0x44')],{'where':{'MailAccountId':_0xed79a3['id']}})['then'](function(){return _0xed79a3;});}return _0xed79a3;})[_0x9d32('0x26')](respondWithResult(_0x5288d0,null))[_0x9d32('0x30')](handleError(_0x5288d0,null));};exports['describe']=function(_0x20d79d,_0x542cf5){return db[_0x9d32('0x47')][_0x9d32('0x66')]()[_0x9d32('0x26')](respondWithResult(_0x542cf5,null))[_0x9d32('0x30')](handleError(_0x542cf5,null));};exports[_0x9d32('0x67')]=function(_0x2f46a0,_0x3ff2c9,_0x349cdb){if(_0x2f46a0['body']['id']){delete _0x2f46a0[_0x9d32('0x65')]['id'];}return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0x2f46a0['params']['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x3ff2c9,null))[_0x9d32('0x26')](function(_0x165af7){if(_0x165af7){_0x2f46a0['body'][_0x9d32('0x68')]=_0x165af7['id'];return db[_0x9d32('0x69')][_0x9d32('0x6a')](_0x2f46a0[_0x9d32('0x65')]);}})[_0x9d32('0x26')](respondWithResult(_0x3ff2c9,null))['catch'](handleError(_0x3ff2c9,null));};exports[_0x9d32('0x6b')]=function(_0x45415e,_0x5b17cb,_0x28111f){var _0x523302={'raw':![],'where':{}};var _0x2d6334={};var _0x3e2018={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x45415e[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x5b17cb,null))[_0x9d32('0x26')](function(_0x114e33){if(_0x114e33){_0x2d6334[_0x9d32('0x4a')]=_[_0x9d32('0x4d')](db[_0x9d32('0x69')][_0x9d32('0x62')]);_0x2d6334[_0x9d32('0x4c')]=_[_0x9d32('0x4d')](_0x45415e[_0x9d32('0x4c')]);_0x2d6334['filters']=_['intersection'](_0x2d6334[_0x9d32('0x4a')],_0x2d6334['query']);_0x523302[_0x9d32('0x50')]=_[_0x9d32('0x4f')](_0x2d6334['model'],qs[_0x9d32('0x51')](_0x45415e[_0x9d32('0x4c')][_0x9d32('0x51')]));_0x523302['attributes']=_0x523302['attributes'][_0x9d32('0x52')]?_0x523302['attributes']:_0x2d6334[_0x9d32('0x4a')];if(!_0x45415e[_0x9d32('0x4c')][_0x9d32('0x53')]('nolimit')){_0x523302['limit']=qs[_0x9d32('0x37')](_0x45415e[_0x9d32('0x4c')][_0x9d32('0x37')]);_0x523302[_0x9d32('0x36')]=qs[_0x9d32('0x36')](_0x45415e[_0x9d32('0x4c')][_0x9d32('0x36')]);}_0x523302[_0x9d32('0x55')]=qs[_0x9d32('0x56')](_0x45415e[_0x9d32('0x4c')][_0x9d32('0x56')]);_0x523302[_0x9d32('0x57')]=qs[_0x9d32('0x4e')](_[_0x9d32('0x58')](_0x45415e[_0x9d32('0x4c')],_0x2d6334[_0x9d32('0x4e')]));_0x523302[_0x9d32('0x57')][_0x9d32('0x68')]=_0x114e33['id'];if(_0x45415e[_0x9d32('0x4c')]['filter']){_0x523302[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x523302['where'],{'$or':_[_0x9d32('0x4b')](_0x523302[_0x9d32('0x50')],function(_0x1a5cc7){var _0x1d929b={};_0x1d929b[_0x1a5cc7]={'$like':'%'+_0x45415e[_0x9d32('0x4c')]['filter']+'%'};return _0x1d929b;})});}_0x523302=_[_0x9d32('0x5a')]({},_0x523302,_0x45415e['options']);return db[_0x9d32('0x69')][_0x9d32('0x35')]({'where':_0x523302[_0x9d32('0x57')]})[_0x9d32('0x26')](function(_0x1e0475){_0x3e2018[_0x9d32('0x35')]=_0x1e0475;if(_0x45415e[_0x9d32('0x4c')][_0x9d32('0x63')]){_0x523302['include']=[{'all':!![]}];}return db[_0x9d32('0x69')][_0x9d32('0x5e')](_0x523302);})[_0x9d32('0x26')](function(_0x2b5809){_0x3e2018['rows']=_0x2b5809;return _0x3e2018;});}})[_0x9d32('0x26')](respondWithFilteredResult(_0x5b17cb,_0x523302))[_0x9d32('0x30')](handleError(_0x5b17cb,null));};exports['removeDispositions']=function(_0x3a4409,_0x1277f9,_0x2a4313){return db['MailAccount'][_0x9d32('0x64')]({'where':{'id':_0x3a4409[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x1277f9,null))[_0x9d32('0x26')](function(_0x28845d){if(_0x28845d){return _0x28845d['removeDispositions'](_0x3a4409[_0x9d32('0x4c')][_0x9d32('0x6c')]);}})[_0x9d32('0x26')](respondWithStatusCode(_0x1277f9,null))[_0x9d32('0x30')](handleError(_0x1277f9,null));};exports['addAnswer']=function(_0x3ff76b,_0x3bbb06,_0x13430a){if(_0x3ff76b[_0x9d32('0x65')]['id']){delete _0x3ff76b[_0x9d32('0x65')]['id'];}return db[_0x9d32('0x47')]['find']({'where':{'id':_0x3ff76b['params']['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x3bbb06,null))[_0x9d32('0x26')](function(_0x219df1){if(_0x219df1){_0x3ff76b[_0x9d32('0x65')][_0x9d32('0x68')]=_0x219df1['id'];return db['CannedAnswer'][_0x9d32('0x6a')](_0x3ff76b[_0x9d32('0x65')]);}})[_0x9d32('0x26')](respondWithResult(_0x3bbb06,null))['catch'](handleError(_0x3bbb06,null));};exports['getAnswers']=function(_0x3735d2,_0x3f85d6,_0x3c3217){var _0xf315a3={'raw':![],'where':{}};var _0x57a40c={};var _0xb7acf2={'count':0x0,'rows':[]};return db['MailAccount'][_0x9d32('0x6d')]({'where':{'id':_0x3735d2[_0x9d32('0x61')]['id']}})['then'](handleEntityNotFound(_0x3f85d6,null))[_0x9d32('0x26')](function(_0x238531){if(_0x238531){_0x57a40c['model']=_[_0x9d32('0x4d')](db[_0x9d32('0x6e')][_0x9d32('0x62')]);_0x57a40c[_0x9d32('0x4c')]=_[_0x9d32('0x4d')](_0x3735d2[_0x9d32('0x4c')]);_0x57a40c[_0x9d32('0x4e')]=_[_0x9d32('0x4f')](_0x57a40c['model'],_0x57a40c[_0x9d32('0x4c')]);_0xf315a3['attributes']=_['intersection'](_0x57a40c['model'],qs[_0x9d32('0x51')](_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x51')]));_0xf315a3[_0x9d32('0x50')]=_0xf315a3['attributes']['length']?_0xf315a3[_0x9d32('0x50')]:_0x57a40c[_0x9d32('0x4a')];if(!_0x3735d2['query'][_0x9d32('0x53')](_0x9d32('0x54'))){_0xf315a3['limit']=qs[_0x9d32('0x37')](_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x37')]);_0xf315a3['offset']=qs[_0x9d32('0x36')](_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x36')]);}_0xf315a3['order']=qs[_0x9d32('0x56')](_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x56')]);_0xf315a3[_0x9d32('0x57')]=qs[_0x9d32('0x4e')](_[_0x9d32('0x58')](_0x3735d2[_0x9d32('0x4c')],_0x57a40c[_0x9d32('0x4e')]));_0xf315a3[_0x9d32('0x57')][_0x9d32('0x68')]=_0x238531['id'];if(_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x59')]){_0xf315a3[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0xf315a3[_0x9d32('0x57')],{'$or':_[_0x9d32('0x4b')](_0xf315a3[_0x9d32('0x50')],function(_0x25c201){var _0x4c5261={};_0x4c5261[_0x25c201]={'$like':'%'+_0x3735d2[_0x9d32('0x4c')][_0x9d32('0x59')]+'%'};return _0x4c5261;})});}_0xf315a3=_[_0x9d32('0x5a')]({},_0xf315a3,_0x3735d2[_0x9d32('0x5c')]);return db[_0x9d32('0x6e')]['count']({'where':_0xf315a3[_0x9d32('0x57')]})[_0x9d32('0x26')](function(_0x3fd664){_0xb7acf2[_0x9d32('0x35')]=_0x3fd664;if(_0x3735d2['query'][_0x9d32('0x63')]){_0xf315a3[_0x9d32('0x5d')]=[{'all':!![]}];}return db[_0x9d32('0x6e')]['findAll'](_0xf315a3);})[_0x9d32('0x26')](function(_0x306c7f){_0xb7acf2[_0x9d32('0x5f')]=_0x306c7f;return _0xb7acf2;});}})[_0x9d32('0x26')](respondWithFilteredResult(_0x3f85d6,_0xf315a3))[_0x9d32('0x30')](handleError(_0x3f85d6,null));};exports['removeAnswers']=function(_0x4d916d,_0x983edb,_0x51b391){return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0x4d916d['params']['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x983edb,null))[_0x9d32('0x26')](function(_0x2b0a3f){if(_0x2b0a3f){return _0x2b0a3f[_0x9d32('0x6f')](_0x4d916d['query'][_0x9d32('0x6c')]);}})[_0x9d32('0x26')](respondWithStatusCode(_0x983edb,null))['catch'](handleError(_0x983edb,null));};exports['create']=function(_0x1dddc2,_0x32362a){var _0x49ae09={'name':_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x3f')],'key':_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x70')],'email':_0x1dddc2['body'][_0x9d32('0x71')],'ListId':_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x72')],'active':!_[_0x9d32('0x73')](_0x1dddc2[_0x9d32('0x65')]['active'])?_0x1dddc2['body'][_0x9d32('0x74')]:!![],'description':_0x1dddc2['body'][_0x9d32('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x9d32('0x73')](_0x1dddc2[_0x9d32('0x65')]['cservice'])){if(_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x76')]){_0x49ae09[_0x9d32('0x42')]['user']=_0x49ae09[_0x9d32('0x44')][_0x9d32('0x77')]=_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x78')];_0x49ae09['Imap'][_0x9d32('0x79')]=_0x49ae09[_0x9d32('0x44')][_0x9d32('0x7a')]=_0x1dddc2[_0x9d32('0x65')]['cpassword'];}else{_0x49ae09[_0x9d32('0x42')][_0x9d32('0x7b')]=_0x49ae09[_0x9d32('0x44')][_0x9d32('0x7b')]=![];}_0x49ae09[_0x9d32('0x42')][_0x9d32('0x7c')]=_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x42')][_0x9d32('0x7c')];_0x49ae09[_0x9d32('0x42')][_0x9d32('0x7d')]=_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x42')][_0x9d32('0x7d')];_0x49ae09['Smtp'][_0x9d32('0x7c')]=_0x1dddc2['body'][_0x9d32('0x44')][_0x9d32('0x7c')];_0x49ae09[_0x9d32('0x44')][_0x9d32('0x7d')]=_0x1dddc2['body'][_0x9d32('0x44')]['port'];}else{_0x49ae09[_0x9d32('0x42')][_0x9d32('0x7e')]=_0x49ae09['Smtp'][_0x9d32('0x7e')]=_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x7f')];_0x49ae09[_0x9d32('0x42')][_0x9d32('0x77')]=_0x49ae09['Smtp']['user']=_0x1dddc2['body'][_0x9d32('0x78')];_0x49ae09[_0x9d32('0x42')][_0x9d32('0x79')]=_0x49ae09[_0x9d32('0x44')][_0x9d32('0x7a')]=_0x1dddc2[_0x9d32('0x65')][_0x9d32('0x80')];}return db[_0x9d32('0x47')]['create'](_0x49ae09,{'include':[{'model':db[_0x9d32('0x43')],'as':_0x9d32('0x44')},{'model':db[_0x9d32('0x41')],'as':_0x9d32('0x42')}]})[_0x9d32('0x26')](function(_0x26d9af){var _0x3e4194=_0x1dddc2['user'][_0x9d32('0x3c')]({'plain':!![]});if(!_0x3e4194)throw new Error(_0x9d32('0x81'));if(_0x3e4194[_0x9d32('0x82')]===_0x9d32('0x77')){var _0x1db348=_0x26d9af[_0x9d32('0x3c')]({'plain':!![]});return db[_0x9d32('0x83')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x3e4194[_0x9d32('0x84')]},'raw':!![]})[_0x9d32('0x26')](function(_0x703aa){if(_0x703aa&&_0x703aa[_0x9d32('0x85')]===0x0){return db[_0x9d32('0x3d')][_0x9d32('0x6a')]({'name':_0x1db348[_0x9d32('0x3f')],'resourceId':_0x1db348['id'],'type':_0x703aa[_0x9d32('0x3f')],'sectionId':_0x703aa['id']},{})[_0x9d32('0x26')](function(){return _0x26d9af;});}else{return _0x26d9af;}})['catch'](function(_0x33b589){logger[_0x9d32('0x2d')](_0x9d32('0x86'),_0x33b589);throw _0x33b589;});}return _0x26d9af;})[_0x9d32('0x26')](respondWithResult(_0x32362a,0xc9))[_0x9d32('0x30')](handleError(_0x32362a,null));};exports[_0x9d32('0x87')]=function(_0x3fede1,_0x52f285,_0x526177){return db['MailAccount']['findOne']({'where':{'id':_0x3fede1[_0x9d32('0x61')]['id']}})['then'](handleEntityNotFound(_0x52f285,null))[_0x9d32('0x26')](function(_0x25b683){if(_0x25b683){return _0x25b683[_0x9d32('0x87')]();}return null;})[_0x9d32('0x26')](respondWithResult(_0x52f285,null))[_0x9d32('0x30')](handleError(_0x52f285,null));};exports[_0x9d32('0x88')]=function(_0x3b4890,_0x641ab,_0x43c715){if(_0x3b4890[_0x9d32('0x65')]['id']){delete _0x3b4890[_0x9d32('0x65')]['id'];}return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0x3b4890[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x641ab,null))['then'](function(_0x21d762){if(_0x21d762){_0x3b4890[_0x9d32('0x65')][_0x9d32('0x68')]=_0x21d762['id'];return db[_0x9d32('0x41')][_0x9d32('0x6a')](_0x3b4890['body']);}})[_0x9d32('0x26')](respondWithResult(_0x641ab,null))[_0x9d32('0x30')](handleError(_0x641ab,null));};exports[_0x9d32('0x89')]=function(_0x49b8ed,_0x23c027,_0x1ded5c){return db['MailAccount'][_0x9d32('0x6d')]({'where':{'id':_0x49b8ed[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x23c027,null))[_0x9d32('0x26')](function(_0x80aa98){if(_0x80aa98){return _0x80aa98['setImap'](null);}return null;})[_0x9d32('0x26')](respondWithStatusCode(_0x23c027,null))[_0x9d32('0x30')](handleError(_0x23c027,null));};exports['getSmtp']=function(_0x2a1433,_0x382fbc,_0x3718aa){return db[_0x9d32('0x47')][_0x9d32('0x6d')]({'where':{'id':_0x2a1433[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x382fbc,null))[_0x9d32('0x26')](function(_0x6ceba5){if(_0x6ceba5){return _0x6ceba5[_0x9d32('0x8a')]();}return null;})[_0x9d32('0x26')](respondWithResult(_0x382fbc,null))[_0x9d32('0x30')](handleError(_0x382fbc,null));};exports['addSmtp']=function(_0x5cdba4,_0x284504,_0x12d741){if(_0x5cdba4['body']['id']){delete _0x5cdba4[_0x9d32('0x65')]['id'];}return db[_0x9d32('0x47')]['find']({'where':{'id':_0x5cdba4[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x284504,null))['then'](function(_0x125238){if(_0x125238){_0x5cdba4[_0x9d32('0x65')]['MailAccountId']=_0x125238['id'];return db[_0x9d32('0x43')][_0x9d32('0x6a')](_0x5cdba4[_0x9d32('0x65')]);}})['then'](respondWithResult(_0x284504,null))[_0x9d32('0x30')](handleError(_0x284504,null));};exports[_0x9d32('0x8b')]=function(_0x3ef1d0,_0x52455e,_0x1fd8a3){return db['MailAccount'][_0x9d32('0x6d')]({'where':{'id':_0x3ef1d0['params']['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x52455e,null))['then'](function(_0x24f6af){if(_0x24f6af){return _0x24f6af[_0x9d32('0x8c')](null);}return null;})['then'](respondWithStatusCode(_0x52455e,null))[_0x9d32('0x30')](handleError(_0x52455e,null));};exports[_0x9d32('0x8d')]=function(_0x2886d2,_0x164735,_0xb1d9b9){return db[_0x9d32('0x8e')][_0x9d32('0x64')]({'where':{'id':_0x2886d2['params']['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x164735,null))[_0x9d32('0x26')](function(_0x6651dc){if(_0x6651dc){return _0x6651dc[_0x9d32('0x8d')](_0x2886d2[_0x9d32('0x65')][_0x9d32('0x6c')],_[_0x9d32('0x8f')](_0x2886d2[_0x9d32('0x65')],[_0x9d32('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x164735,null))[_0x9d32('0x30')](handleError(_0x164735,null));};exports[_0x9d32('0x90')]=function(_0x467125,_0x2d3d45,_0x50599){var _0x4dd28e={'raw':![],'where':{}};var _0x3a44ab={};var _0x1c1ba7={'count':0x0,'rows':[]};return db[_0x9d32('0x47')]['findOne']({'where':{'id':_0x467125[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x2d3d45,null))[_0x9d32('0x26')](function(_0x12e85c){if(_0x12e85c){_0x3a44ab['model']=_[_0x9d32('0x4d')](db[_0x9d32('0x8e')][_0x9d32('0x62')]);_0x3a44ab[_0x9d32('0x4c')]=_[_0x9d32('0x4d')](_0x467125['query']);_0x3a44ab[_0x9d32('0x4e')]=_['intersection'](_0x3a44ab[_0x9d32('0x4a')],_0x3a44ab[_0x9d32('0x4c')]);_0x4dd28e['attributes']=_[_0x9d32('0x4f')](_0x3a44ab[_0x9d32('0x4a')],qs['fields'](_0x467125[_0x9d32('0x4c')][_0x9d32('0x51')]));_0x4dd28e[_0x9d32('0x50')]=_0x4dd28e[_0x9d32('0x50')][_0x9d32('0x52')]?_0x4dd28e['attributes']:_0x3a44ab[_0x9d32('0x4a')];if(!_0x467125['query'][_0x9d32('0x53')](_0x9d32('0x54'))){_0x4dd28e['limit']=qs[_0x9d32('0x37')](_0x467125[_0x9d32('0x4c')]['limit']);_0x4dd28e['offset']=qs[_0x9d32('0x36')](_0x467125[_0x9d32('0x4c')][_0x9d32('0x36')]);}_0x4dd28e[_0x9d32('0x55')]=qs[_0x9d32('0x56')](_0x467125[_0x9d32('0x4c')][_0x9d32('0x56')]);_0x4dd28e[_0x9d32('0x57')]=qs['filters'](_[_0x9d32('0x58')](_0x467125[_0x9d32('0x4c')],_0x3a44ab[_0x9d32('0x4e')]));_0x4dd28e['where'][_0x9d32('0x68')]=_0x12e85c['id'];if(_0x467125[_0x9d32('0x4c')][_0x9d32('0x59')]){_0x4dd28e[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x4dd28e[_0x9d32('0x57')],{'$or':_[_0x9d32('0x4b')](_0x4dd28e[_0x9d32('0x50')],function(_0x3b80af){var _0x49ad2a={};_0x49ad2a[_0x3b80af]={'$like':'%'+_0x467125['query'][_0x9d32('0x59')]+'%'};return _0x49ad2a;})});}_0x4dd28e=_[_0x9d32('0x5a')]({},_0x4dd28e,_0x467125[_0x9d32('0x5c')]);return db[_0x9d32('0x8e')][_0x9d32('0x35')]({'where':_0x4dd28e[_0x9d32('0x57')]})[_0x9d32('0x26')](function(_0x39d2cb){_0x1c1ba7['count']=_0x39d2cb;if(_0x467125[_0x9d32('0x4c')][_0x9d32('0x63')]){_0x4dd28e['include']=[{'model':db[_0x9d32('0x91')],'as':_0x9d32('0x92'),'required':![]},{'model':db[_0x9d32('0x93')],'as':_0x9d32('0x94'),'attributes':[_0x9d32('0x3f'),_0x9d32('0x95'),_0x9d32('0x96')],'required':![]},{'model':db[_0x9d32('0x97')],'as':_0x9d32('0x98'),'attributes':['id',_0x9d32('0x3f'),_0x9d32('0x99')],'where':_0x467125[_0x9d32('0x4c')]['tag']?{'id':_0x467125['query']['tag']}:undefined,'required':_0x467125[_0x9d32('0x4c')][_0x9d32('0x9a')]?!![]:![]}];}return db['MailInteraction'][_0x9d32('0x5e')](_0x4dd28e);})[_0x9d32('0x26')](function(_0xb13703){_0x1c1ba7[_0x9d32('0x5f')]=_0xb13703;return _0x1c1ba7;});}})[_0x9d32('0x26')](respondWithFilteredResult(_0x2d3d45,_0x4dd28e))[_0x9d32('0x30')](handleError(_0x2d3d45,null));};exports[_0x9d32('0x9b')]=function(_0x24c13e,_0x1643d6,_0x1f7847){return db[_0x9d32('0x47')][_0x9d32('0x6d')]({'where':{'id':_0x24c13e[_0x9d32('0x61')]['id']}})['then'](handleEntityNotFound(_0x1643d6,null))[_0x9d32('0x26')](function(_0x337bf9){if(_0x337bf9){return db[_0x9d32('0x9c')][_0x9d32('0x9d')](function(_0x282824){return db[_0x9d32('0x9e')][_0x9d32('0x3b')]({'where':{'MailAccountId':_0x24c13e[_0x9d32('0x61')]['id']},'transaction':_0x282824})[_0x9d32('0x26')](function(_0x443302){var _0x1130d5=_[_0x9d32('0x4b')](_0x24c13e[_0x9d32('0x65')],function(_0x905432){_0x905432[_0x9d32('0x68')]=_0x24c13e[_0x9d32('0x61')]['id'];return _0x905432;});return db[_0x9d32('0x9e')][_0x9d32('0x9f')](_0x1130d5,{'transaction':_0x282824});});})[_0x9d32('0x26')](function(){return db[_0x9d32('0x9e')][_0x9d32('0xa0')]({'where':{'MailAccountId':_0x24c13e[_0x9d32('0x61')]['id']},'order':_0x9d32('0xa1')});});}})['then'](respondWithResult(_0x1643d6,null))[_0x9d32('0x30')](handleError(_0x1643d6,null));};exports[_0x9d32('0xa2')]=function(_0x48be74,_0x636d06,_0x40c405){var _0x318600={};var _0x51cc00={};var _0x147316;var _0x9ef578;return db[_0x9d32('0x47')][_0x9d32('0x6d')]({'where':{'id':_0x48be74[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x636d06,null))[_0x9d32('0x26')](function(_0x28cba2){if(_0x28cba2){_0x147316=_0x28cba2;_0x51cc00[_0x9d32('0x4a')]=_[_0x9d32('0x4d')](db[_0x9d32('0x9e')][_0x9d32('0x62')]);_0x51cc00[_0x9d32('0x4c')]=_['keys'](_0x48be74[_0x9d32('0x4c')]);_0x51cc00['filters']=_[_0x9d32('0x4f')](_0x51cc00['model'],_0x51cc00[_0x9d32('0x4c')]);_0x318600[_0x9d32('0x50')]=_['intersection'](_0x51cc00['model'],qs['fields'](_0x48be74[_0x9d32('0x4c')][_0x9d32('0x51')]));_0x318600['attributes']=_0x318600[_0x9d32('0x50')][_0x9d32('0x52')]?_0x318600[_0x9d32('0x50')]:_0x51cc00['model'];_0x318600[_0x9d32('0x55')]=qs[_0x9d32('0x56')](_0x48be74['query'][_0x9d32('0x56')]);_0x318600[_0x9d32('0x57')]=qs[_0x9d32('0x4e')](_[_0x9d32('0x58')](_0x48be74[_0x9d32('0x4c')],_0x51cc00[_0x9d32('0x4e')]));if(_0x48be74[_0x9d32('0x4c')][_0x9d32('0x59')]){_0x318600[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x318600[_0x9d32('0x57')],{'$or':_['map'](_0x318600[_0x9d32('0x50')],function(_0x571a7f){var _0x51bfab={};_0x51bfab[_0x571a7f]={'$like':'%'+_0x48be74[_0x9d32('0x4c')]['filter']+'%'};return _0x51bfab;})});}_0x318600=_[_0x9d32('0x5a')]({},_0x318600,_0x48be74[_0x9d32('0x5c')]);return _0x147316[_0x9d32('0xa2')](_0x318600);}})[_0x9d32('0x26')](function(_0x36227b){if(_0x36227b){_0x9ef578=_0x36227b[_0x9d32('0x52')];if(!_0x48be74[_0x9d32('0x4c')][_0x9d32('0x53')]('nolimit')){_0x318600['limit']=qs['limit'](_0x48be74[_0x9d32('0x4c')][_0x9d32('0x37')]);_0x318600[_0x9d32('0x36')]=qs['offset'](_0x48be74['query'][_0x9d32('0x36')]);}return _0x147316[_0x9d32('0xa2')](_0x318600);}})[_0x9d32('0x26')](function(_0x48645c){if(_0x48645c){return _0x48645c?{'count':_0x9ef578,'rows':_0x48645c}:null;}})['then'](respondWithResult(_0x636d06,null))[_0x9d32('0x30')](handleError(_0x636d06,null));};exports['getMessages']=function(_0x4ccfaf,_0x169098,_0x19c1de){var _0x15c9eb={'raw':!![],'where':{}};var _0x43b54f={};var _0xfd5a8a={'count':0x0,'rows':[]};return db[_0x9d32('0x47')]['findOne']({'where':{'id':_0x4ccfaf[_0x9d32('0x61')]['id']}})['then'](handleEntityNotFound(_0x169098,null))['then'](function(_0x70ceef){if(_0x70ceef){_0x43b54f['model']=_[_0x9d32('0x4d')](db[_0x9d32('0xa3')][_0x9d32('0x62')]);_0x43b54f[_0x9d32('0x4c')]=_[_0x9d32('0x4d')](_0x4ccfaf[_0x9d32('0x4c')]);_0x43b54f['filters']=_[_0x9d32('0x4f')](_0x43b54f[_0x9d32('0x4a')],_0x43b54f['query']);_0x15c9eb[_0x9d32('0x50')]=_['intersection'](_0x43b54f[_0x9d32('0x4a')],qs[_0x9d32('0x51')](_0x4ccfaf[_0x9d32('0x4c')]['fields']));_0x15c9eb[_0x9d32('0x50')]=_0x15c9eb[_0x9d32('0x50')][_0x9d32('0x52')]?_0x15c9eb[_0x9d32('0x50')]:_0x43b54f[_0x9d32('0x4a')];if(!_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0x53')](_0x9d32('0x54'))){_0x15c9eb[_0x9d32('0x37')]=qs['limit'](_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0x37')]);_0x15c9eb['offset']=qs[_0x9d32('0x36')](_0x4ccfaf['query']['offset']);}_0x15c9eb[_0x9d32('0x55')]=qs[_0x9d32('0x56')](_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0x56')]);_0x15c9eb[_0x9d32('0x57')]=qs[_0x9d32('0x4e')](_['pick'](_0x4ccfaf[_0x9d32('0x4c')],_0x43b54f[_0x9d32('0x4e')]));_0x15c9eb[_0x9d32('0x57')]['MailAccountId']=_0x70ceef['id'];if(_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0x59')]){_0x15c9eb['where']=_[_0x9d32('0x5a')](_0x15c9eb[_0x9d32('0x57')],{'$or':_[_0x9d32('0x4b')](_0x15c9eb[_0x9d32('0x50')],function(_0x3e79ff){var _0x3aa50f={};_0x3aa50f[_0x3e79ff]={'$like':'%'+_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0x59')]+'%'};return _0x3aa50f;})});}if(_0x4ccfaf[_0x9d32('0x4c')][_0x9d32('0xa4')]){var _0x329174=_0x4ccfaf[_0x9d32('0x4c')]['$gte'][_0x9d32('0xa5')](',');var _0x5e8171={};_0x5e8171[_0x329174[0x0]]={'$gte':moment(_0x329174[0x1])['format'](_0x9d32('0xa6'))};_0x15c9eb[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x15c9eb[_0x9d32('0x57')],_0x5e8171);}_0x15c9eb=_[_0x9d32('0x5a')]({},_0x15c9eb,_0x4ccfaf[_0x9d32('0x5c')]);return db[_0x9d32('0xa3')][_0x9d32('0x35')]({'where':_0x15c9eb['where']})[_0x9d32('0x26')](function(_0x4a4e37){_0xfd5a8a['count']=_0x4a4e37;if(_0x4ccfaf['query']['includeAll']){_0x15c9eb[_0x9d32('0x5d')]=[{'all':!![]}];}return db[_0x9d32('0xa3')]['findAll'](_0x15c9eb);})['then'](function(_0x3240c6){_0xfd5a8a[_0x9d32('0x5f')]=_0x3240c6;return _0xfd5a8a;});}})[_0x9d32('0x26')](respondWithFilteredResult(_0x169098,_0x15c9eb))[_0x9d32('0x30')](handleError(_0x169098,null));};exports['send']=function(_0xb60dc9,_0x362685,_0x35d391){var _0x3220bb,_0x4e55f8={},_0x41cc6a;if(_0xb60dc9['body']['to']){_0x41cc6a=_0xb60dc9[_0x9d32('0x65')]['to'][_0x9d32('0xa5')](',')[0x0];}return db['MailAccount'][_0x9d32('0x64')]({'where':{'id':_0xb60dc9[_0x9d32('0x61')]['id']},'include':[{'model':db[_0x9d32('0xa7')],'as':_0x9d32('0xa8'),'include':[{'model':db[_0x9d32('0x91')],'as':_0x9d32('0xa9'),'where':{'email':_0x41cc6a},'limit':0x1,'order':[[_0x9d32('0xaa'),_0x9d32('0xab')]]}]},{'model':db[_0x9d32('0x43')],'as':_0x9d32('0x44'),'raw':!![]}]})[_0x9d32('0x26')](handleEntityNotFound(_0x362685,null))[_0x9d32('0x26')](function(_0x1556e2){if(_0x1556e2){_0x3220bb=_0x1556e2;if(_0x1556e2['Smtp']){if(_[_0x9d32('0x73')](_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xac')])){_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xac')]=util[_0x9d32('0xad')](_0x9d32('0xae'),_0x1556e2['name'],_0x1556e2[_0x9d32('0x71')]||_0x1556e2['Smtp'][_0x9d32('0x77')]);}if(_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xaf')]&&_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xaf')][_0x9d32('0x52')]){for(var _0x191226=0x0;_0x191226<_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xaf')][_0x9d32('0x52')];_0x191226+=0x1){_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xaf')][_0x191226]={'filename':_0xb60dc9['body'][_0x9d32('0xaf')][_0x191226][_0x9d32('0x3f')],'path':path[_0x9d32('0xb0')](config[_0x9d32('0xb1')],'server/files/attachments',_0xb60dc9[_0x9d32('0x65')]['attachments'][_0x191226][_0x9d32('0xb2')])};}}var _0x4ef47d={'tls':{'rejectUnauthorized':![]}};if(_[_0x9d32('0x73')](_0x1556e2[_0x9d32('0x44')][_0x9d32('0x7e')])){if(_0x1556e2[_0x9d32('0x44')]['authentication']){_0x4ef47d['auth']={'user':_0x1556e2[_0x9d32('0x44')][_0x9d32('0x77')],'pass':_0x1556e2[_0x9d32('0x44')][_0x9d32('0x7a')]};}_0x4ef47d[_0x9d32('0x7c')]=_0x1556e2[_0x9d32('0x44')][_0x9d32('0x7c')];_0x4ef47d[_0x9d32('0x7d')]=_0x1556e2['Smtp'][_0x9d32('0x7d')];_0x4ef47d['secure']=_0x1556e2[_0x9d32('0x44')][_0x9d32('0xb3')];}else{_0x4ef47d[_0x9d32('0x7e')]=_0x1556e2[_0x9d32('0x44')][_0x9d32('0x7e')];_0x4ef47d[_0x9d32('0xb4')]={'user':_0x1556e2[_0x9d32('0x44')][_0x9d32('0x77')],'pass':_0x1556e2[_0x9d32('0x44')][_0x9d32('0x7a')]};}return respondWithRpcPromise(_0x9d32('0xb5'),_0x9d32('0xb6'),{'account':_0x4ef47d,'message':_0xb60dc9[_0x9d32('0x65')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x4c7e54){if(_0x4c7e54){_0x4e55f8=_0x4c7e54;if(_0x3220bb[_0x9d32('0xa8')]){if(_0x3220bb['List'][_0x9d32('0xa9')][_0x9d32('0x52')]){return _0x3220bb[_0x9d32('0xa8')][_0x9d32('0xa9')][0x0];}else{return db[_0x9d32('0x91')][_0x9d32('0x6a')](_['defaults'](_0xb60dc9[_0x9d32('0x65')],{'firstName':_0xb60dc9[_0x9d32('0x65')]['to'],'email':_0xb60dc9[_0x9d32('0x65')]['to'],'phone':_0xb60dc9['body']['to'],'ListId':_0x3220bb[_0x9d32('0x72')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x9d32('0x26')](function(_0x1f6557){if(_0x1f6557){var _0x4cfe0f={'UserId':_0xb60dc9['user']['id'],'ContactId':_0x1f6557['id'],'MailAccountId':_0x3220bb['id'],'inReplyTo':_0x4e55f8['messageId'],'to':_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xac')],'cc':_0xb60dc9[_0x9d32('0x65')]['cc'],'subject':_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xb7')],'attach':_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xb8')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9d32('0xad')](_0x9d32('0xa6')),'lastMsgDirection':_0x9d32('0xb9'),'lastMsgBody':_0xb60dc9[_0x9d32('0x65')]['body'],'Messages':[_['merge'](_0xb60dc9[_0x9d32('0x65')],{'messageId':_0x4e55f8['messageId'],'sentAt':moment()[_0x9d32('0xad')](_0x9d32('0xa6')),'read':!![],'MailAccountId':_0x3220bb['id'],'UserId':_0xb60dc9[_0x9d32('0x77')]['id'],'ContactId':_0x1f6557['id']})]};if(_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xba')]){_0x4cfe0f=_['merge'](_0x4cfe0f,_0xb60dc9[_0x9d32('0x65')][_0x9d32('0xba')]);}return db[_0x9d32('0x8e')][_0x9d32('0x6a')](_0x4cfe0f,{'include':[{'model':db['MailMessage'],'as':_0x9d32('0xbb')}]});}})[_0x9d32('0x26')](respondWithResult(_0x362685,null))['catch'](handleError(_0x362685,null));};exports[_0x9d32('0xbc')]=function(_0xfc4d94,_0xbc498b,_0x196cda){return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0xfc4d94[_0x9d32('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x9d32('0x26')](handleEntityNotFound(_0xbc498b,null))[_0x9d32('0x26')](function(_0x57c26f){if(_0x57c26f&&_0x57c26f[_0x9d32('0x44')]){var _0x1de45c={'id':_0x57c26f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x57c26f[_0x9d32('0x44')][_0x9d32('0x7e')]){_0x1de45c['service']=_0x57c26f[_0x9d32('0x44')][_0x9d32('0x7e')];}else{_0x1de45c[_0x9d32('0x7c')]=_0x57c26f[_0x9d32('0x44')][_0x9d32('0x7c')];_0x1de45c[_0x9d32('0x7d')]=_0x57c26f['Smtp'][_0x9d32('0x7d')];_0x1de45c[_0x9d32('0xb3')]=_0x57c26f['Smtp'][_0x9d32('0xb3')];}if(_0x57c26f[_0x9d32('0x44')][_0x9d32('0x7b')]){_0x1de45c[_0x9d32('0xb4')]={'user':_0x57c26f[_0x9d32('0x44')]['user'],'pass':_0x57c26f[_0x9d32('0x44')][_0x9d32('0x7a')]};}return respondWithRpcPromise(_0x9d32('0xbd'),_0x9d32('0xbc'),{'account':_0x1de45c});}})['then'](respondWithResult(_0xbc498b,null))[_0x9d32('0x30')](handleError(_0xbc498b,null));};exports[_0x9d32('0x3b')]=function(_0xef3a84,_0x9e5852){return db[_0x9d32('0x47')]['find']({'where':{'id':_0xef3a84['params']['id']}})['then'](handleEntityNotFound(_0x9e5852,null))['then'](function(_0x268a4c){if(_0x268a4c&&_0x268a4c['service']){throw new db[(_0x9d32('0x23'))][(_0x9d32('0x24'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x268a4c;})[_0x9d32('0x26')](removeEntity(_0x9e5852,null))['catch'](handleError(_0x9e5852,null));};exports[_0x9d32('0xbe')]=function(_0x31b92d,_0x5e8554,_0x3b87b3){return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0x31b92d[_0x9d32('0x61')]['id']}})['then'](handleEntityNotFound(_0x5e8554,null))[_0x9d32('0x26')](function(_0x205089){if(_0x205089){return _0x205089['addAgents'](_0x31b92d[_0x9d32('0x65')][_0x9d32('0x6c')],_['omit'](_0x31b92d['body'],[_0x9d32('0x6c'),'id'])||{})['spread'](function(_0x2a85e8){for(var _0x1398a8=0x0;_0x1398a8<_0x31b92d[_0x9d32('0x65')][_0x9d32('0x6c')]['length'];_0x1398a8+=0x1){socket[_0x9d32('0xbf')](_0x9d32('0xc0'),{'UserId':_0x31b92d[_0x9d32('0x65')]['ids'][_0x1398a8],'MailAccountId':_0x31b92d[_0x9d32('0x61')]['id']});}return _0x2a85e8;});}})[_0x9d32('0x26')](respondWithResult(_0x5e8554,null))[_0x9d32('0x30')](handleError(_0x5e8554,null));};exports['removeAgents']=function(_0xee76a0,_0x571fb2,_0x40f2ef){return db[_0x9d32('0x47')][_0x9d32('0x64')]({'where':{'id':_0xee76a0[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x571fb2,null))['then'](function(_0x350abb){if(_0x350abb){return _0x350abb[_0x9d32('0xc1')](_0xee76a0[_0x9d32('0x4c')]['ids'])[_0x9d32('0x26')](function(){if(_[_0x9d32('0xc2')](_0xee76a0[_0x9d32('0x4c')][_0x9d32('0x6c')])){for(var _0x5d35ef=0x0;_0x5d35ef<_0xee76a0[_0x9d32('0x4c')][_0x9d32('0x6c')][_0x9d32('0x52')];_0x5d35ef+=0x1){socket[_0x9d32('0xbf')](_0x9d32('0xc3'),{'UserId':Number(_0xee76a0['query']['ids'][_0x5d35ef]),'MailAccountId':Number(_0xee76a0[_0x9d32('0x61')]['id'])});}}else{socket[_0x9d32('0xbf')](_0x9d32('0xc3'),{'UserId':Number(_0xee76a0[_0x9d32('0x4c')][_0x9d32('0x6c')]),'MailAccountId':Number(_0xee76a0['params']['id'])});}});}})[_0x9d32('0x26')](respondWithStatusCode(_0x571fb2,null))[_0x9d32('0x30')](handleError(_0x571fb2,null));};exports[_0x9d32('0xc4')]=function(_0xa518a3,_0x21abf5,_0x47c652){var _0x35ec97={};var _0x2d2a8b={};var _0x4c2267;var _0x55a9d6;return db[_0x9d32('0x47')]['findOne']({'where':{'id':_0xa518a3[_0x9d32('0x61')]['id']}})[_0x9d32('0x26')](handleEntityNotFound(_0x21abf5,null))[_0x9d32('0x26')](function(_0x49445a){if(_0x49445a){_0x4c2267=_0x49445a;_0x2d2a8b[_0x9d32('0x4a')]=_[_0x9d32('0x4d')](db[_0x9d32('0x93')][_0x9d32('0x62')]);_0x2d2a8b['query']=_[_0x9d32('0x4d')](_0xa518a3[_0x9d32('0x4c')]);_0x2d2a8b[_0x9d32('0x4e')]=_[_0x9d32('0x4f')](_0x2d2a8b[_0x9d32('0x4a')],_0x2d2a8b['query']);_0x35ec97[_0x9d32('0x50')]=_[_0x9d32('0x4f')](_0x2d2a8b['model'],qs['fields'](_0xa518a3['query']['fields']));_0x35ec97[_0x9d32('0x50')]=_0x35ec97[_0x9d32('0x50')]['length']?_0x35ec97['attributes']:_0x2d2a8b[_0x9d32('0x4a')];_0x35ec97[_0x9d32('0x55')]=qs['sort'](_0xa518a3['query']['sort']);_0x35ec97['where']=qs[_0x9d32('0x4e')](_[_0x9d32('0x58')](_0xa518a3['query'],_0x2d2a8b['filters']));if(_0xa518a3[_0x9d32('0x4c')][_0x9d32('0x59')]){_0x35ec97[_0x9d32('0x57')]=_[_0x9d32('0x5a')](_0x35ec97[_0x9d32('0x57')],{'$or':_[_0x9d32('0x4b')](_0x35ec97[_0x9d32('0x50')],function(_0x2b3faa){var _0x320666={};_0x320666[_0x2b3faa]={'$like':'%'+_0xa518a3['query'][_0x9d32('0x59')]+'%'};return _0x320666;})});}_0x35ec97=_[_0x9d32('0x5a')]({},_0x35ec97,_0xa518a3[_0x9d32('0x5c')]);return _0x4c2267['getAgents'](_0x35ec97);}})[_0x9d32('0x26')](function(_0x2cbd8d){if(_0x2cbd8d){_0x55a9d6=_0x2cbd8d[_0x9d32('0x52')];if(!_0xa518a3[_0x9d32('0x4c')][_0x9d32('0x53')](_0x9d32('0x54'))){_0x35ec97[_0x9d32('0x37')]=qs[_0x9d32('0x37')](_0xa518a3[_0x9d32('0x4c')][_0x9d32('0x37')]);_0x35ec97[_0x9d32('0x36')]=qs[_0x9d32('0x36')](_0xa518a3[_0x9d32('0x4c')][_0x9d32('0x36')]);}return _0x4c2267['getAgents'](_0x35ec97);}})[_0x9d32('0x26')](function(_0x32303b){if(_0x32303b){return _0x32303b?{'count':_0x55a9d6,'rows':_0x32303b}:null;}})[_0x9d32('0x26')](respondWithResult(_0x21abf5,null))['catch'](handleError(_0x21abf5,null));}; \ No newline at end of file +var _0xb396=['email','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','host','port','service','role','get','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','findAll','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','ListId','messageId','attach','out','Interaction','Messages','verifySmtp','authentication','VerifySmtp','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','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','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','UserProfileResource','name','send','index','MailServerIn','Smtp','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','MailAccount','catch','show','params','MailServerOut','rawAttributes','length','include','find','body','Imap','describe','addDisposition','Disposition','getDispositions','findOne','MailAccountId','rows','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','removeAnswers'];(function(_0xef4a61,_0x57e16b){var _0x5417ce=function(_0x356c28){while(--_0x356c28){_0xef4a61['push'](_0xef4a61['shift']());}};_0x5417ce(++_0x57e16b);}(_0xb396,0x114));var _0x6b39=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb396[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x6b39('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b39('0x1'));var zipdir=require(_0x6b39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b39('0x4'));var util=require(_0x6b39('0x5'));var path=require(_0x6b39('0x6'));var sox=require(_0x6b39('0x7'));var csv=require(_0x6b39('0x8'));var ejs=require(_0x6b39('0x9'));var fs=require('fs');var _=require(_0x6b39('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6b39('0xb'));var toCsv=require(_0x6b39('0x8'));var querystring=require(_0x6b39('0xc'));var Papa=require('papaparse');var Redis=require(_0x6b39('0xd'));var authService=require(_0x6b39('0xe'));var qs=require(_0x6b39('0xf'));var as=require(_0x6b39('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b39('0x11'))(_0x6b39('0x12'));var utils=require(_0x6b39('0x13'));var config=require('../../config/environment');var db=require(_0x6b39('0x14'))['db'];config[_0x6b39('0x15')]=_[_0x6b39('0x16')](config[_0x6b39('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b39('0x17'))(new Redis(config[_0x6b39('0x15')]));require(_0x6b39('0x18'))[_0x6b39('0x19')](socket);var jayson=require(_0x6b39('0x1a'));var client=jayson['client'][_0x6b39('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x5e5d27,_0x4dca1c,_0xaa067){if(_0xaa067){var _0x307f58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x307f58[_0x6b39('0x1c')](_0x4dca1c)){return _0x5e5d27;}else{throw new db[(_0x6b39('0x1d'))][(_0x6b39('0x1e'))](_0x6b39('0x1f'));}}else{return _0x5e5d27;}}function respondWithRpcPromise(_0x1154fe,_0x556a16,_0x48475e,_0x15fa21){return new BPromise(function(_0x559d85,_0x416da4){var _0x40e4c9=_0x15fa21||client;return _0x40e4c9['request'](_0x1154fe,_0x48475e)[_0x6b39('0x20')](function(_0x1d3fe0){logger['info'](_0x6b39('0x21'),_0x556a16,'request\x20sent');logger[_0x6b39('0x22')](_0x6b39('0x23'),_0x556a16,'request\x20sent',JSON[_0x6b39('0x24')](_0x1d3fe0));if(_0x1d3fe0[_0x6b39('0x25')]){if(_0x1d3fe0[_0x6b39('0x25')][_0x6b39('0x26')]===0x1f4){logger[_0x6b39('0x25')](_0x6b39('0x21'),_0x556a16,_0x1d3fe0[_0x6b39('0x25')][_0x6b39('0x27')]);return _0x416da4(_0x1d3fe0[_0x6b39('0x25')]['message']);}logger['error'](_0x6b39('0x21'),_0x556a16,_0x1d3fe0['error'][_0x6b39('0x27')]);return _0x559d85(_0x1d3fe0[_0x6b39('0x25')][_0x6b39('0x27')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x556a16,'request\x20sent');_0x559d85(_0x1d3fe0['result'][_0x6b39('0x27')]);}})['catch'](function(_0x1f60e0){logger[_0x6b39('0x25')](_0x6b39('0x21'),_0x556a16,_0x1f60e0);_0x416da4(_0x1f60e0);});});}function respondWithStatusCode(_0x5a1e39,_0x1d4de8){_0x1d4de8=_0x1d4de8||0xcc;return function(_0x1887a5){if(_0x1887a5){return _0x5a1e39[_0x6b39('0x28')](_0x1d4de8);}return _0x5a1e39['status'](_0x1d4de8)[_0x6b39('0x29')]();};}function respondWithResult(_0x5a38e2,_0xc9faee){_0xc9faee=_0xc9faee||0xc8;return function(_0x27c883){if(_0x27c883){return _0x5a38e2['status'](_0xc9faee)[_0x6b39('0x2a')](_0x27c883);}};}function respondWithFilteredResult(_0x10e9d0,_0x4d7e41){return function(_0x3d5b1f){if(_0x3d5b1f){var _0x3476e4=_0x3d5b1f[_0x6b39('0x2b')],_0x7041cc=_0x4d7e41[_0x6b39('0x2c')],_0x13f843=_0x4d7e41[_0x6b39('0x2c')]+_0x4d7e41[_0x6b39('0x2d')],_0x38dd61;if(_0x13f843>=_0x3476e4){_0x13f843=_0x3476e4;_0x38dd61=0xc8;}else{_0x38dd61=0xce;}_0x10e9d0[_0x6b39('0x2e')](_0x38dd61);return _0x10e9d0[_0x6b39('0x2f')](_0x6b39('0x30'),_0x7041cc+'-'+_0x13f843+'/'+_0x3476e4)['json'](_0x3d5b1f);}return null;};}function patchUpdates(_0x775386){return function(_0x4ce368){try{jsonpatch['apply'](_0x4ce368,_0x775386,!![]);}catch(_0x7be1e0){return BPromise['reject'](_0x7be1e0);}return _0x4ce368[_0x6b39('0x31')]();};}function saveUpdates(_0x2862dd,_0x2189fa){return function(_0x2d737d){if(_0x2d737d){return _0x2d737d[_0x6b39('0x32')](_0x2862dd)[_0x6b39('0x20')](function(_0x56c54d){return _0x56c54d;});}return null;};}function removeEntity(_0x5d8faf,_0x14d788){return function(_0x4448e0){if(_0x4448e0){return _0x4448e0[_0x6b39('0x33')]()[_0x6b39('0x20')](function(){var _0xa0de17=_0x4448e0['get']({'plain':!![]});var _0xa0f07a='MailAccounts';return db[_0x6b39('0x34')][_0x6b39('0x33')]({'where':{'type':_0xa0f07a,'resourceId':_0xa0de17['id']}})['then'](function(){return _0x4448e0;});})[_0x6b39('0x20')](function(){_0x5d8faf[_0x6b39('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e136e,_0x3a9b36){return function(_0x418cc1){if(!_0x418cc1){_0x5e136e['sendStatus'](0x194);}return _0x418cc1;};}function handleError(_0x5679bf,_0x3f8860){_0x3f8860=_0x3f8860||0x1f4;return function(_0x145dbe){logger[_0x6b39('0x25')](_0x145dbe['stack']);if(_0x145dbe[_0x6b39('0x35')]){delete _0x145dbe[_0x6b39('0x35')];}_0x5679bf['status'](_0x3f8860)[_0x6b39('0x36')](_0x145dbe);};}exports[_0x6b39('0x37')]=function(_0x724757,_0x1819f1){var _0x5e29ca={'include':[{'model':db[_0x6b39('0x38')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x6b39('0x39')},{'model':db[_0x6b39('0x3a')],'as':_0x6b39('0x3b')}]},_0x54cd22={},_0x40375d={'count':0x0,'rows':[]};var _0x10349f=_[_0x6b39('0x3c')](db['MailAccount']['rawAttributes'],function(_0x5d4487){return{'name':_0x5d4487[_0x6b39('0x3d')],'type':_0x5d4487[_0x6b39('0x3e')][_0x6b39('0x3f')]};});_0x54cd22[_0x6b39('0x40')]=_[_0x6b39('0x3c')](_0x10349f,_0x6b39('0x35'));_0x54cd22['query']=_[_0x6b39('0x41')](_0x724757['query']);_0x54cd22['filters']=_[_0x6b39('0x42')](_0x54cd22[_0x6b39('0x40')],_0x54cd22[_0x6b39('0x43')]);_0x5e29ca[_0x6b39('0x44')]=_['intersection'](_0x54cd22['model'],qs[_0x6b39('0x45')](_0x724757[_0x6b39('0x43')][_0x6b39('0x45')]));_0x5e29ca[_0x6b39('0x44')]=_0x5e29ca['attributes']['length']?_0x5e29ca[_0x6b39('0x44')]:_0x54cd22[_0x6b39('0x40')];if(!_0x724757[_0x6b39('0x43')][_0x6b39('0x46')](_0x6b39('0x47'))){_0x5e29ca[_0x6b39('0x2d')]=qs[_0x6b39('0x2d')](_0x724757[_0x6b39('0x43')]['limit']);_0x5e29ca['offset']=qs[_0x6b39('0x2c')](_0x724757[_0x6b39('0x43')]['offset']);}_0x5e29ca[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x724757[_0x6b39('0x43')][_0x6b39('0x49')]);_0x5e29ca[_0x6b39('0x4a')]=qs['filters'](_[_0x6b39('0x4b')](_0x724757[_0x6b39('0x43')],_0x54cd22[_0x6b39('0x4c')]),_0x10349f);if(_0x724757['query'][_0x6b39('0x4d')]){_0x5e29ca[_0x6b39('0x4a')]=_[_0x6b39('0x4e')](_0x5e29ca[_0x6b39('0x4a')],{'$or':_[_0x6b39('0x3c')](_0x10349f,function(_0x582f3f){if(_0x582f3f[_0x6b39('0x3e')]!==_0x6b39('0x4f')){var _0x581768={};_0x581768[_0x582f3f[_0x6b39('0x35')]]={'$like':'%'+_0x724757[_0x6b39('0x43')][_0x6b39('0x4d')]+'%'};return _0x581768;}})});}_0x5e29ca=_['merge']({},_0x5e29ca,_0x724757[_0x6b39('0x50')]);var _0x5bd9a1={'where':_0x5e29ca['where']};return db['MailAccount'][_0x6b39('0x2b')](_0x5bd9a1)[_0x6b39('0x20')](function(_0x5706f3){_0x40375d[_0x6b39('0x2b')]=_0x5706f3;if(_0x724757[_0x6b39('0x43')][_0x6b39('0x51')]){_0x5e29ca['include']=[{'all':!![]}];}return db[_0x6b39('0x52')]['findAll'](_0x5e29ca);})[_0x6b39('0x20')](function(_0x1d61a5){_0x40375d['rows']=_0x1d61a5;return _0x40375d;})['then'](respondWithFilteredResult(_0x1819f1,_0x5e29ca))[_0x6b39('0x53')](handleError(_0x1819f1,null));};exports[_0x6b39('0x54')]=function(_0x22fda2,_0x32bc7e){var _0x43ae52={'raw':![],'where':{'id':_0x22fda2[_0x6b39('0x55')]['id']},'include':[{'model':db[_0x6b39('0x38')],'as':'Imap'},{'model':db[_0x6b39('0x56')],'as':'Smtp'},{'model':db[_0x6b39('0x3a')],'as':_0x6b39('0x3b')}]},_0x13dc86={};_0x13dc86[_0x6b39('0x40')]=_[_0x6b39('0x41')](db[_0x6b39('0x52')][_0x6b39('0x57')]);_0x13dc86[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x22fda2[_0x6b39('0x43')]);_0x13dc86['filters']=_[_0x6b39('0x42')](_0x13dc86[_0x6b39('0x40')],_0x13dc86[_0x6b39('0x43')]);_0x43ae52[_0x6b39('0x44')]=_['intersection'](_0x13dc86[_0x6b39('0x40')],qs[_0x6b39('0x45')](_0x22fda2[_0x6b39('0x43')][_0x6b39('0x45')]));_0x43ae52[_0x6b39('0x44')]=_0x43ae52[_0x6b39('0x44')][_0x6b39('0x58')]?_0x43ae52[_0x6b39('0x44')]:_0x13dc86[_0x6b39('0x40')];if(_0x22fda2[_0x6b39('0x43')]['includeAll']){_0x43ae52[_0x6b39('0x59')]=[{'all':!![]}];}_0x43ae52=_[_0x6b39('0x4e')]({},_0x43ae52,_0x22fda2['options']);return db['MailAccount'][_0x6b39('0x5a')](_0x43ae52)[_0x6b39('0x20')](handleEntityNotFound(_0x32bc7e,null))[_0x6b39('0x20')](respondWithResult(_0x32bc7e,null))[_0x6b39('0x53')](handleError(_0x32bc7e,null));};exports['update']=function(_0x21b945,_0x340cb8){if(_0x21b945[_0x6b39('0x5b')]['id']){delete _0x21b945[_0x6b39('0x5b')]['id'];}return db[_0x6b39('0x52')]['find']({'where':{'id':_0x21b945['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x6b39('0x3b')}]})['then'](handleEntityNotFound(_0x340cb8,null))[_0x6b39('0x20')](saveUpdates(_0x21b945[_0x6b39('0x5b')],null))['then'](function(_0x4ad6d2){if(_0x4ad6d2&&_0x21b945[_0x6b39('0x5b')][_0x6b39('0x5c')]){return db['MailServerIn']['update'](_0x21b945[_0x6b39('0x5b')][_0x6b39('0x5c')],{'where':{'MailAccountId':_0x4ad6d2['id']}})[_0x6b39('0x20')](function(){return _0x4ad6d2;});}return _0x4ad6d2;})[_0x6b39('0x20')](function(_0x52f1af){if(_0x52f1af&&_0x21b945['body']['Smtp']){return db[_0x6b39('0x56')][_0x6b39('0x32')](_0x21b945['body'][_0x6b39('0x39')],{'where':{'MailAccountId':_0x52f1af['id']}})[_0x6b39('0x20')](function(){return _0x52f1af;});}return _0x52f1af;})[_0x6b39('0x20')](respondWithResult(_0x340cb8,null))[_0x6b39('0x53')](handleError(_0x340cb8,null));};exports['describe']=function(_0x92a741,_0x35481b){return db[_0x6b39('0x52')][_0x6b39('0x5d')]()['then'](respondWithResult(_0x35481b,null))['catch'](handleError(_0x35481b,null));};exports[_0x6b39('0x5e')]=function(_0x352386,_0x548c1e,_0x14962a){if(_0x352386[_0x6b39('0x5b')]['id']){delete _0x352386[_0x6b39('0x5b')]['id'];}return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x352386[_0x6b39('0x55')]['id']}})['then'](handleEntityNotFound(_0x548c1e,null))[_0x6b39('0x20')](function(_0x27d85f){if(_0x27d85f){_0x352386[_0x6b39('0x5b')]['MailAccountId']=_0x27d85f['id'];return db[_0x6b39('0x5f')]['create'](_0x352386['body']);}})['then'](respondWithResult(_0x548c1e,null))[_0x6b39('0x53')](handleError(_0x548c1e,null));};exports[_0x6b39('0x60')]=function(_0x1c9a1a,_0x2674cb,_0x54d59f){var _0x400296={'raw':![],'where':{}};var _0x50f413={};var _0x3c3d58={'count':0x0,'rows':[]};return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x1c9a1a[_0x6b39('0x55')]['id']}})['then'](handleEntityNotFound(_0x2674cb,null))['then'](function(_0x3305f6){if(_0x3305f6){_0x50f413[_0x6b39('0x40')]=_[_0x6b39('0x41')](db[_0x6b39('0x5f')][_0x6b39('0x57')]);_0x50f413[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x1c9a1a[_0x6b39('0x43')]);_0x50f413['filters']=_[_0x6b39('0x42')](_0x50f413['model'],_0x50f413['query']);_0x400296[_0x6b39('0x44')]=_['intersection'](_0x50f413[_0x6b39('0x40')],qs['fields'](_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x45')]));_0x400296[_0x6b39('0x44')]=_0x400296['attributes']['length']?_0x400296[_0x6b39('0x44')]:_0x50f413[_0x6b39('0x40')];if(!_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x46')](_0x6b39('0x47'))){_0x400296[_0x6b39('0x2d')]=qs['limit'](_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x400296['offset']=qs[_0x6b39('0x2c')](_0x1c9a1a[_0x6b39('0x43')]['offset']);}_0x400296[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x1c9a1a['query']['sort']);_0x400296['where']=qs[_0x6b39('0x4c')](_[_0x6b39('0x4b')](_0x1c9a1a['query'],_0x50f413[_0x6b39('0x4c')]));_0x400296[_0x6b39('0x4a')][_0x6b39('0x62')]=_0x3305f6['id'];if(_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x4d')]){_0x400296[_0x6b39('0x4a')]=_[_0x6b39('0x4e')](_0x400296[_0x6b39('0x4a')],{'$or':_['map'](_0x400296[_0x6b39('0x44')],function(_0x47278b){var _0x3796b7={};_0x3796b7[_0x47278b]={'$like':'%'+_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x4d')]+'%'};return _0x3796b7;})});}_0x400296=_[_0x6b39('0x4e')]({},_0x400296,_0x1c9a1a[_0x6b39('0x50')]);return db['Disposition'][_0x6b39('0x2b')]({'where':_0x400296['where']})[_0x6b39('0x20')](function(_0x3be38f){_0x3c3d58[_0x6b39('0x2b')]=_0x3be38f;if(_0x1c9a1a[_0x6b39('0x43')][_0x6b39('0x51')]){_0x400296[_0x6b39('0x59')]=[{'all':!![]}];}return db[_0x6b39('0x5f')]['findAll'](_0x400296);})['then'](function(_0x384a60){_0x3c3d58[_0x6b39('0x63')]=_0x384a60;return _0x3c3d58;});}})[_0x6b39('0x20')](respondWithFilteredResult(_0x2674cb,_0x400296))[_0x6b39('0x53')](handleError(_0x2674cb,null));};exports[_0x6b39('0x64')]=function(_0x3513e8,_0x49540c,_0x1ad415){return db['MailAccount'][_0x6b39('0x5a')]({'where':{'id':_0x3513e8[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x49540c,null))[_0x6b39('0x20')](function(_0x4ac82b){if(_0x4ac82b){return _0x4ac82b['removeDispositions'](_0x3513e8[_0x6b39('0x43')]['ids']);}})[_0x6b39('0x20')](respondWithStatusCode(_0x49540c,null))[_0x6b39('0x53')](handleError(_0x49540c,null));};exports[_0x6b39('0x65')]=function(_0x10728a,_0x1eefc4,_0x2e429f){if(_0x10728a[_0x6b39('0x5b')]['id']){delete _0x10728a[_0x6b39('0x5b')]['id'];}return db['MailAccount'][_0x6b39('0x5a')]({'where':{'id':_0x10728a[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x1eefc4,null))['then'](function(_0x57a18d){if(_0x57a18d){_0x10728a[_0x6b39('0x5b')]['MailAccountId']=_0x57a18d['id'];return db[_0x6b39('0x66')][_0x6b39('0x67')](_0x10728a[_0x6b39('0x5b')]);}})[_0x6b39('0x20')](respondWithResult(_0x1eefc4,null))['catch'](handleError(_0x1eefc4,null));};exports[_0x6b39('0x68')]=function(_0x254be1,_0x20e40d,_0x1eb89b){var _0x4f1444={'raw':![],'where':{}};var _0x16e2bd={};var _0x11b3a5={'count':0x0,'rows':[]};return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x254be1[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x20e40d,null))['then'](function(_0x1b3328){if(_0x1b3328){_0x16e2bd[_0x6b39('0x40')]=_['keys'](db[_0x6b39('0x66')][_0x6b39('0x57')]);_0x16e2bd['query']=_['keys'](_0x254be1[_0x6b39('0x43')]);_0x16e2bd[_0x6b39('0x4c')]=_[_0x6b39('0x42')](_0x16e2bd[_0x6b39('0x40')],_0x16e2bd[_0x6b39('0x43')]);_0x4f1444[_0x6b39('0x44')]=_[_0x6b39('0x42')](_0x16e2bd[_0x6b39('0x40')],qs[_0x6b39('0x45')](_0x254be1['query'][_0x6b39('0x45')]));_0x4f1444['attributes']=_0x4f1444['attributes'][_0x6b39('0x58')]?_0x4f1444[_0x6b39('0x44')]:_0x16e2bd[_0x6b39('0x40')];if(!_0x254be1['query'][_0x6b39('0x46')](_0x6b39('0x47'))){_0x4f1444['limit']=qs[_0x6b39('0x2d')](_0x254be1[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x4f1444[_0x6b39('0x2c')]=qs[_0x6b39('0x2c')](_0x254be1['query'][_0x6b39('0x2c')]);}_0x4f1444[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x254be1[_0x6b39('0x43')][_0x6b39('0x49')]);_0x4f1444[_0x6b39('0x4a')]=qs['filters'](_['pick'](_0x254be1[_0x6b39('0x43')],_0x16e2bd[_0x6b39('0x4c')]));_0x4f1444[_0x6b39('0x4a')][_0x6b39('0x62')]=_0x1b3328['id'];if(_0x254be1[_0x6b39('0x43')][_0x6b39('0x4d')]){_0x4f1444[_0x6b39('0x4a')]=_['merge'](_0x4f1444[_0x6b39('0x4a')],{'$or':_[_0x6b39('0x3c')](_0x4f1444[_0x6b39('0x44')],function(_0x49a19c){var _0x6387c1={};_0x6387c1[_0x49a19c]={'$like':'%'+_0x254be1['query']['filter']+'%'};return _0x6387c1;})});}_0x4f1444=_[_0x6b39('0x4e')]({},_0x4f1444,_0x254be1[_0x6b39('0x50')]);return db['CannedAnswer']['count']({'where':_0x4f1444[_0x6b39('0x4a')]})[_0x6b39('0x20')](function(_0x5e3efd){_0x11b3a5[_0x6b39('0x2b')]=_0x5e3efd;if(_0x254be1[_0x6b39('0x43')]['includeAll']){_0x4f1444['include']=[{'all':!![]}];}return db[_0x6b39('0x66')]['findAll'](_0x4f1444);})['then'](function(_0x5157d5){_0x11b3a5[_0x6b39('0x63')]=_0x5157d5;return _0x11b3a5;});}})[_0x6b39('0x20')](respondWithFilteredResult(_0x20e40d,_0x4f1444))['catch'](handleError(_0x20e40d,null));};exports[_0x6b39('0x69')]=function(_0x1f2301,_0x57d4c1,_0x564fe3){return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x1f2301[_0x6b39('0x55')]['id']}})['then'](handleEntityNotFound(_0x57d4c1,null))[_0x6b39('0x20')](function(_0x4354b1){if(_0x4354b1){return _0x4354b1[_0x6b39('0x69')](_0x1f2301[_0x6b39('0x43')]['ids']);}})[_0x6b39('0x20')](respondWithStatusCode(_0x57d4c1,null))[_0x6b39('0x53')](handleError(_0x57d4c1,null));};exports[_0x6b39('0x67')]=function(_0x424934,_0x165b01){var _0x3819ee={'name':_0x424934['body']['name'],'key':_0x424934[_0x6b39('0x5b')][_0x6b39('0x3f')],'email':_0x424934[_0x6b39('0x5b')][_0x6b39('0x6a')],'ListId':_0x424934[_0x6b39('0x5b')]['ListId'],'active':!_[_0x6b39('0x6b')](_0x424934[_0x6b39('0x5b')][_0x6b39('0x6c')])?_0x424934[_0x6b39('0x5b')][_0x6b39('0x6c')]:!![],'description':_0x424934['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x6b39('0x6b')](_0x424934[_0x6b39('0x5b')][_0x6b39('0x6d')])){if(_0x424934[_0x6b39('0x5b')][_0x6b39('0x6e')]){_0x3819ee['Imap'][_0x6b39('0x6f')]=_0x3819ee[_0x6b39('0x39')]['user']=_0x424934[_0x6b39('0x5b')][_0x6b39('0x70')];_0x3819ee[_0x6b39('0x5c')][_0x6b39('0x71')]=_0x3819ee['Smtp'][_0x6b39('0x72')]=_0x424934[_0x6b39('0x5b')][_0x6b39('0x73')];}else{_0x3819ee[_0x6b39('0x5c')]['authentication']=_0x3819ee[_0x6b39('0x39')]['authentication']=![];}_0x3819ee['Imap'][_0x6b39('0x74')]=_0x424934[_0x6b39('0x5b')][_0x6b39('0x5c')][_0x6b39('0x74')];_0x3819ee['Imap']['port']=_0x424934[_0x6b39('0x5b')][_0x6b39('0x5c')][_0x6b39('0x75')];_0x3819ee[_0x6b39('0x39')][_0x6b39('0x74')]=_0x424934[_0x6b39('0x5b')][_0x6b39('0x39')][_0x6b39('0x74')];_0x3819ee[_0x6b39('0x39')]['port']=_0x424934[_0x6b39('0x5b')][_0x6b39('0x39')][_0x6b39('0x75')];}else{_0x3819ee[_0x6b39('0x5c')]['service']=_0x3819ee[_0x6b39('0x39')][_0x6b39('0x76')]=_0x424934['body']['cservice'];_0x3819ee[_0x6b39('0x5c')][_0x6b39('0x6f')]=_0x3819ee[_0x6b39('0x39')][_0x6b39('0x6f')]=_0x424934[_0x6b39('0x5b')][_0x6b39('0x70')];_0x3819ee['Imap'][_0x6b39('0x71')]=_0x3819ee['Smtp'][_0x6b39('0x72')]=_0x424934[_0x6b39('0x5b')]['cpassword'];}return db[_0x6b39('0x52')]['create'](_0x3819ee,{'include':[{'model':db[_0x6b39('0x56')],'as':_0x6b39('0x39')},{'model':db[_0x6b39('0x38')],'as':'Imap'}]})['then'](function(_0x37dd1d){var _0x417616=_0x424934['user']['get']({'plain':!![]});if(!_0x417616)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x417616[_0x6b39('0x77')]===_0x6b39('0x6f')){var _0x5b09b2=_0x37dd1d[_0x6b39('0x78')]({'plain':!![]});return db[_0x6b39('0x79')][_0x6b39('0x5a')]({'where':{'name':_0x6b39('0x7a'),'userProfileId':_0x417616[_0x6b39('0x7b')]},'raw':!![]})[_0x6b39('0x20')](function(_0x449747){if(_0x449747&&_0x449747[_0x6b39('0x7c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b09b2[_0x6b39('0x35')],'resourceId':_0x5b09b2['id'],'type':_0x449747[_0x6b39('0x35')],'sectionId':_0x449747['id']},{})[_0x6b39('0x20')](function(){return _0x37dd1d;});}else{return _0x37dd1d;}})[_0x6b39('0x53')](function(_0x5aeb1e){logger[_0x6b39('0x25')](_0x6b39('0x7d'),_0x5aeb1e);throw _0x5aeb1e;});}return _0x37dd1d;})[_0x6b39('0x20')](respondWithResult(_0x165b01,0xc9))['catch'](handleError(_0x165b01,null));};exports[_0x6b39('0x7e')]=function(_0x15ee9a,_0x346eed,_0x1e7eeb){return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x15ee9a[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x346eed,null))['then'](function(_0x4ff8a2){if(_0x4ff8a2){return _0x4ff8a2[_0x6b39('0x7e')]();}return null;})[_0x6b39('0x20')](respondWithResult(_0x346eed,null))[_0x6b39('0x53')](handleError(_0x346eed,null));};exports[_0x6b39('0x7f')]=function(_0x5b5854,_0xdf8ee3,_0xac9a13){if(_0x5b5854['body']['id']){delete _0x5b5854[_0x6b39('0x5b')]['id'];}return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x5b5854['params']['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0xdf8ee3,null))[_0x6b39('0x20')](function(_0x291fca){if(_0x291fca){_0x5b5854['body'][_0x6b39('0x62')]=_0x291fca['id'];return db[_0x6b39('0x38')][_0x6b39('0x67')](_0x5b5854[_0x6b39('0x5b')]);}})[_0x6b39('0x20')](respondWithResult(_0xdf8ee3,null))[_0x6b39('0x53')](handleError(_0xdf8ee3,null));};exports[_0x6b39('0x80')]=function(_0x19c255,_0x3bfe6f,_0x34c0f6){return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x19c255[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x3bfe6f,null))[_0x6b39('0x20')](function(_0x18ba8a){if(_0x18ba8a){return _0x18ba8a[_0x6b39('0x81')](null);}return null;})[_0x6b39('0x20')](respondWithStatusCode(_0x3bfe6f,null))[_0x6b39('0x53')](handleError(_0x3bfe6f,null));};exports[_0x6b39('0x82')]=function(_0x32f133,_0x351ee8,_0x2c1ef4){return db[_0x6b39('0x52')]['findOne']({'where':{'id':_0x32f133[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x351ee8,null))[_0x6b39('0x20')](function(_0x1fb60c){if(_0x1fb60c){return _0x1fb60c[_0x6b39('0x82')]();}return null;})['then'](respondWithResult(_0x351ee8,null))[_0x6b39('0x53')](handleError(_0x351ee8,null));};exports[_0x6b39('0x83')]=function(_0x126bfc,_0x458481,_0x5e952b){if(_0x126bfc['body']['id']){delete _0x126bfc[_0x6b39('0x5b')]['id'];}return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x126bfc[_0x6b39('0x55')]['id']}})['then'](handleEntityNotFound(_0x458481,null))[_0x6b39('0x20')](function(_0x5aa981){if(_0x5aa981){_0x126bfc[_0x6b39('0x5b')]['MailAccountId']=_0x5aa981['id'];return db['MailServerOut'][_0x6b39('0x67')](_0x126bfc[_0x6b39('0x5b')]);}})[_0x6b39('0x20')](respondWithResult(_0x458481,null))['catch'](handleError(_0x458481,null));};exports[_0x6b39('0x84')]=function(_0x13cc4c,_0x55e3d1,_0x47e681){return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x13cc4c[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x55e3d1,null))[_0x6b39('0x20')](function(_0xb8282f){if(_0xb8282f){return _0xb8282f['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x55e3d1,null))[_0x6b39('0x53')](handleError(_0x55e3d1,null));};exports[_0x6b39('0x85')]=function(_0x2a193b,_0x423607,_0x3877c4){return db[_0x6b39('0x86')][_0x6b39('0x5a')]({'where':{'id':_0x2a193b[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x423607,null))[_0x6b39('0x20')](function(_0x51b1cf){if(_0x51b1cf){return _0x51b1cf[_0x6b39('0x85')](_0x2a193b[_0x6b39('0x5b')][_0x6b39('0x87')],_[_0x6b39('0x88')](_0x2a193b['body'],[_0x6b39('0x87'),'id'])||{});}})[_0x6b39('0x20')](respondWithResult(_0x423607,null))[_0x6b39('0x53')](handleError(_0x423607,null));};exports[_0x6b39('0x89')]=function(_0x312ee7,_0x21c5dc,_0x2c12a3){var _0x2d7741={'raw':![],'where':{}};var _0x1f4863={};var _0x2ae39b={'count':0x0,'rows':[]};return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x312ee7[_0x6b39('0x55')]['id']}})['then'](handleEntityNotFound(_0x21c5dc,null))[_0x6b39('0x20')](function(_0x230bfe){if(_0x230bfe){_0x1f4863[_0x6b39('0x40')]=_[_0x6b39('0x41')](db[_0x6b39('0x86')]['rawAttributes']);_0x1f4863[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x312ee7[_0x6b39('0x43')]);_0x1f4863[_0x6b39('0x4c')]=_[_0x6b39('0x42')](_0x1f4863['model'],_0x1f4863[_0x6b39('0x43')]);_0x2d7741[_0x6b39('0x44')]=_[_0x6b39('0x42')](_0x1f4863['model'],qs['fields'](_0x312ee7[_0x6b39('0x43')][_0x6b39('0x45')]));_0x2d7741['attributes']=_0x2d7741[_0x6b39('0x44')][_0x6b39('0x58')]?_0x2d7741[_0x6b39('0x44')]:_0x1f4863['model'];if(!_0x312ee7[_0x6b39('0x43')][_0x6b39('0x46')](_0x6b39('0x47'))){_0x2d7741[_0x6b39('0x2d')]=qs[_0x6b39('0x2d')](_0x312ee7[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x2d7741[_0x6b39('0x2c')]=qs[_0x6b39('0x2c')](_0x312ee7[_0x6b39('0x43')]['offset']);}_0x2d7741[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x312ee7['query'][_0x6b39('0x49')]);_0x2d7741[_0x6b39('0x4a')]=qs[_0x6b39('0x4c')](_[_0x6b39('0x4b')](_0x312ee7[_0x6b39('0x43')],_0x1f4863[_0x6b39('0x4c')]));_0x2d7741['where']['MailAccountId']=_0x230bfe['id'];if(_0x312ee7[_0x6b39('0x43')][_0x6b39('0x4d')]){_0x2d7741[_0x6b39('0x4a')]=_[_0x6b39('0x4e')](_0x2d7741[_0x6b39('0x4a')],{'$or':_[_0x6b39('0x3c')](_0x2d7741['attributes'],function(_0x1cc572){var _0x27a8d0={};_0x27a8d0[_0x1cc572]={'$like':'%'+_0x312ee7[_0x6b39('0x43')][_0x6b39('0x4d')]+'%'};return _0x27a8d0;})});}_0x2d7741=_[_0x6b39('0x4e')]({},_0x2d7741,_0x312ee7[_0x6b39('0x50')]);return db['MailInteraction']['count']({'where':_0x2d7741[_0x6b39('0x4a')]})[_0x6b39('0x20')](function(_0x2d15b8){_0x2ae39b[_0x6b39('0x2b')]=_0x2d15b8;if(_0x312ee7['query'][_0x6b39('0x51')]){_0x2d7741['include']=[{'model':db[_0x6b39('0x8a')],'as':_0x6b39('0x8b'),'required':![]},{'model':db[_0x6b39('0x8c')],'as':_0x6b39('0x8d'),'attributes':['name',_0x6b39('0x8e'),'internal'],'required':![]},{'model':db[_0x6b39('0x8f')],'as':_0x6b39('0x90'),'attributes':['id','name','color'],'where':_0x312ee7[_0x6b39('0x43')]['tag']?{'id':_0x312ee7['query'][_0x6b39('0x91')]}:undefined,'required':_0x312ee7['query']['tag']?!![]:![]}];}return db[_0x6b39('0x86')][_0x6b39('0x92')](_0x2d7741);})[_0x6b39('0x20')](function(_0x3b3727){_0x2ae39b[_0x6b39('0x63')]=_0x3b3727;return _0x2ae39b;});}})['then'](respondWithFilteredResult(_0x21c5dc,_0x2d7741))[_0x6b39('0x53')](handleError(_0x21c5dc,null));};exports['addApplications']=function(_0x1d5298,_0x45681c,_0x106ca0){return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x1d5298[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x45681c,null))[_0x6b39('0x20')](function(_0x42b8e0){if(_0x42b8e0){return db[_0x6b39('0x93')][_0x6b39('0x94')](function(_0x305261){return db[_0x6b39('0x95')][_0x6b39('0x33')]({'where':{'MailAccountId':_0x1d5298[_0x6b39('0x55')]['id']},'transaction':_0x305261})['then'](function(_0x16721a){var _0x574771=_['map'](_0x1d5298['body'],function(_0x564686){_0x564686[_0x6b39('0x62')]=_0x1d5298[_0x6b39('0x55')]['id'];return _0x564686;});return db[_0x6b39('0x95')]['bulkCreate'](_0x574771,{'transaction':_0x305261});});})[_0x6b39('0x20')](function(){return db[_0x6b39('0x95')][_0x6b39('0x96')]({'where':{'MailAccountId':_0x1d5298[_0x6b39('0x55')]['id']},'order':_0x6b39('0x97')});});}})[_0x6b39('0x20')](respondWithResult(_0x45681c,null))[_0x6b39('0x53')](handleError(_0x45681c,null));};exports[_0x6b39('0x98')]=function(_0x3befb5,_0x1fc9b0,_0x4733c8){var _0x31e048={};var _0x367e8e={};var _0x22139f;var _0x4f4ed4;return db['MailAccount'][_0x6b39('0x61')]({'where':{'id':_0x3befb5['params']['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x1fc9b0,null))[_0x6b39('0x20')](function(_0x1ca16b){if(_0x1ca16b){_0x22139f=_0x1ca16b;_0x367e8e[_0x6b39('0x40')]=_['keys'](db[_0x6b39('0x95')]['rawAttributes']);_0x367e8e[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x3befb5['query']);_0x367e8e[_0x6b39('0x4c')]=_[_0x6b39('0x42')](_0x367e8e['model'],_0x367e8e['query']);_0x31e048[_0x6b39('0x44')]=_['intersection'](_0x367e8e['model'],qs['fields'](_0x3befb5[_0x6b39('0x43')][_0x6b39('0x45')]));_0x31e048[_0x6b39('0x44')]=_0x31e048['attributes'][_0x6b39('0x58')]?_0x31e048[_0x6b39('0x44')]:_0x367e8e['model'];_0x31e048['order']=qs['sort'](_0x3befb5[_0x6b39('0x43')][_0x6b39('0x49')]);_0x31e048[_0x6b39('0x4a')]=qs[_0x6b39('0x4c')](_[_0x6b39('0x4b')](_0x3befb5[_0x6b39('0x43')],_0x367e8e[_0x6b39('0x4c')]));if(_0x3befb5[_0x6b39('0x43')]['filter']){_0x31e048[_0x6b39('0x4a')]=_[_0x6b39('0x4e')](_0x31e048['where'],{'$or':_[_0x6b39('0x3c')](_0x31e048['attributes'],function(_0x1e8860){var _0x4a3355={};_0x4a3355[_0x1e8860]={'$like':'%'+_0x3befb5[_0x6b39('0x43')][_0x6b39('0x4d')]+'%'};return _0x4a3355;})});}_0x31e048=_[_0x6b39('0x4e')]({},_0x31e048,_0x3befb5[_0x6b39('0x50')]);return _0x22139f[_0x6b39('0x98')](_0x31e048);}})['then'](function(_0x30b6b0){if(_0x30b6b0){_0x4f4ed4=_0x30b6b0['length'];if(!_0x3befb5[_0x6b39('0x43')]['hasOwnProperty'](_0x6b39('0x47'))){_0x31e048[_0x6b39('0x2d')]=qs['limit'](_0x3befb5[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x31e048[_0x6b39('0x2c')]=qs[_0x6b39('0x2c')](_0x3befb5[_0x6b39('0x43')][_0x6b39('0x2c')]);}return _0x22139f['getApplications'](_0x31e048);}})[_0x6b39('0x20')](function(_0x2910a3){if(_0x2910a3){return _0x2910a3?{'count':_0x4f4ed4,'rows':_0x2910a3}:null;}})[_0x6b39('0x20')](respondWithResult(_0x1fc9b0,null))[_0x6b39('0x53')](handleError(_0x1fc9b0,null));};exports['getMessages']=function(_0x3d1b59,_0x4b3c4d,_0x316c65){var _0x2d1c4c={'raw':!![],'where':{}};var _0x1e1b3b={};var _0x91393={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3d1b59['params']['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x4b3c4d,null))[_0x6b39('0x20')](function(_0x492990){if(_0x492990){_0x1e1b3b[_0x6b39('0x40')]=_[_0x6b39('0x41')](db[_0x6b39('0x99')]['rawAttributes']);_0x1e1b3b[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x3d1b59[_0x6b39('0x43')]);_0x1e1b3b[_0x6b39('0x4c')]=_['intersection'](_0x1e1b3b[_0x6b39('0x40')],_0x1e1b3b[_0x6b39('0x43')]);_0x2d1c4c[_0x6b39('0x44')]=_[_0x6b39('0x42')](_0x1e1b3b[_0x6b39('0x40')],qs['fields'](_0x3d1b59[_0x6b39('0x43')][_0x6b39('0x45')]));_0x2d1c4c[_0x6b39('0x44')]=_0x2d1c4c[_0x6b39('0x44')][_0x6b39('0x58')]?_0x2d1c4c[_0x6b39('0x44')]:_0x1e1b3b[_0x6b39('0x40')];if(!_0x3d1b59['query'][_0x6b39('0x46')](_0x6b39('0x47'))){_0x2d1c4c[_0x6b39('0x2d')]=qs['limit'](_0x3d1b59[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x2d1c4c[_0x6b39('0x2c')]=qs[_0x6b39('0x2c')](_0x3d1b59['query'][_0x6b39('0x2c')]);}_0x2d1c4c[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x3d1b59[_0x6b39('0x43')][_0x6b39('0x49')]);_0x2d1c4c['where']=qs['filters'](_[_0x6b39('0x4b')](_0x3d1b59['query'],_0x1e1b3b[_0x6b39('0x4c')]));_0x2d1c4c[_0x6b39('0x4a')]['MailAccountId']=_0x492990['id'];if(_0x3d1b59['query'][_0x6b39('0x4d')]){_0x2d1c4c['where']=_[_0x6b39('0x4e')](_0x2d1c4c['where'],{'$or':_['map'](_0x2d1c4c[_0x6b39('0x44')],function(_0x27c88b){var _0x21a0f5={};_0x21a0f5[_0x27c88b]={'$like':'%'+_0x3d1b59['query'][_0x6b39('0x4d')]+'%'};return _0x21a0f5;})});}if(_0x3d1b59[_0x6b39('0x43')]['$gte']){var _0xe4f8e2=_0x3d1b59['query']['$gte'][_0x6b39('0x9a')](',');var _0x48ccda={};_0x48ccda[_0xe4f8e2[0x0]]={'$gte':moment(_0xe4f8e2[0x1])[_0x6b39('0x9b')](_0x6b39('0x9c'))};_0x2d1c4c['where']=_[_0x6b39('0x4e')](_0x2d1c4c[_0x6b39('0x4a')],_0x48ccda);}_0x2d1c4c=_['merge']({},_0x2d1c4c,_0x3d1b59[_0x6b39('0x50')]);return db['MailMessage'][_0x6b39('0x2b')]({'where':_0x2d1c4c[_0x6b39('0x4a')]})[_0x6b39('0x20')](function(_0x362b4f){_0x91393['count']=_0x362b4f;if(_0x3d1b59[_0x6b39('0x43')][_0x6b39('0x51')]){_0x2d1c4c['include']=[{'all':!![]}];}return db[_0x6b39('0x99')][_0x6b39('0x92')](_0x2d1c4c);})[_0x6b39('0x20')](function(_0xe8e056){_0x91393[_0x6b39('0x63')]=_0xe8e056;return _0x91393;});}})[_0x6b39('0x20')](respondWithFilteredResult(_0x4b3c4d,_0x2d1c4c))[_0x6b39('0x53')](handleError(_0x4b3c4d,null));};exports['send']=function(_0x2ad617,_0x2684cc,_0x5db8d5){var _0x55a4f0,_0x19628b={},_0x1377bc;if(_0x2ad617[_0x6b39('0x5b')]['to']){_0x1377bc=_0x2ad617[_0x6b39('0x5b')]['to']['split'](',')[0x0];}return db[_0x6b39('0x52')]['find']({'where':{'id':_0x2ad617['params']['id']},'include':[{'model':db[_0x6b39('0x9d')],'as':_0x6b39('0x9e'),'include':[{'model':db[_0x6b39('0x8a')],'as':_0x6b39('0x9f'),'where':{'email':_0x1377bc},'limit':0x1,'order':[[_0x6b39('0xa0'),_0x6b39('0xa1')]]}]},{'model':db[_0x6b39('0x56')],'as':_0x6b39('0x39'),'raw':!![]}]})[_0x6b39('0x20')](handleEntityNotFound(_0x2684cc,null))[_0x6b39('0x20')](function(_0x44f835){if(_0x44f835){_0x55a4f0=_0x44f835;if(_0x44f835['Smtp']){if(_['isNil'](_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa2')])){_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa2')]=util['format'](_0x6b39('0xa3'),_0x44f835[_0x6b39('0x35')],_0x44f835[_0x6b39('0x6a')]||_0x44f835[_0x6b39('0x39')][_0x6b39('0x6f')]);}if(_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa4')]&&_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa4')][_0x6b39('0x58')]){for(var _0x4a77fa=0x0;_0x4a77fa<_0x2ad617[_0x6b39('0x5b')]['attachments']['length'];_0x4a77fa+=0x1){_0x2ad617['body']['attachments'][_0x4a77fa]={'filename':_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa4')][_0x4a77fa][_0x6b39('0x35')],'path':path[_0x6b39('0xa5')](config[_0x6b39('0xa6')],_0x6b39('0xa7'),_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xa4')][_0x4a77fa][_0x6b39('0xa8')])};}}var _0x35d5e8={'tls':{'rejectUnauthorized':![]}};if(_[_0x6b39('0x6b')](_0x44f835[_0x6b39('0x39')]['service'])){if(_0x44f835[_0x6b39('0x39')]['authentication']){_0x35d5e8[_0x6b39('0xa9')]={'user':_0x44f835[_0x6b39('0x39')][_0x6b39('0x6f')],'pass':_0x44f835[_0x6b39('0x39')][_0x6b39('0x72')]};}_0x35d5e8[_0x6b39('0x74')]=_0x44f835[_0x6b39('0x39')][_0x6b39('0x74')];_0x35d5e8[_0x6b39('0x75')]=_0x44f835[_0x6b39('0x39')][_0x6b39('0x75')];_0x35d5e8['secure']=_0x44f835['Smtp'][_0x6b39('0xaa')];}else{_0x35d5e8[_0x6b39('0x76')]=_0x44f835['Smtp'][_0x6b39('0x76')];_0x35d5e8[_0x6b39('0xa9')]={'user':_0x44f835[_0x6b39('0x39')][_0x6b39('0x6f')],'pass':_0x44f835[_0x6b39('0x39')]['pass']};}return respondWithRpcPromise(_0x6b39('0xab'),_0x6b39('0xac'),{'account':_0x35d5e8,'message':_0x2ad617[_0x6b39('0x5b')]});}else{throw new Error(_0x6b39('0xad'));}}})[_0x6b39('0x20')](function(_0x590c0f){if(_0x590c0f){_0x19628b=_0x590c0f;if(_0x55a4f0[_0x6b39('0x9e')]){if(_0x55a4f0[_0x6b39('0x9e')][_0x6b39('0x9f')][_0x6b39('0x58')]){return _0x55a4f0['List'][_0x6b39('0x9f')][0x0];}else{return db[_0x6b39('0x8a')][_0x6b39('0x67')](_[_0x6b39('0x16')](_0x2ad617[_0x6b39('0x5b')],{'firstName':_0x2ad617[_0x6b39('0x5b')]['to'],'email':_0x2ad617[_0x6b39('0x5b')]['to'],'phone':_0x2ad617[_0x6b39('0x5b')]['to'],'ListId':_0x55a4f0[_0x6b39('0xae')]}));}}else{throw new Error(_0x6b39('0xad'));}}})[_0x6b39('0x20')](function(_0x54ad4b){if(_0x54ad4b){var _0x3494b3={'UserId':_0x2ad617[_0x6b39('0x6f')]['id'],'ContactId':_0x54ad4b['id'],'MailAccountId':_0x55a4f0['id'],'inReplyTo':_0x19628b[_0x6b39('0xaf')],'to':_0x2ad617[_0x6b39('0x5b')]['from'],'cc':_0x2ad617[_0x6b39('0x5b')]['cc'],'subject':_0x2ad617['body']['subject'],'attach':_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xb0')],'firstMsgDirection':_0x6b39('0xb1'),'lastMsgAt':moment()[_0x6b39('0x9b')](_0x6b39('0x9c')),'lastMsgDirection':'out','lastMsgBody':_0x2ad617[_0x6b39('0x5b')]['body'],'Messages':[_[_0x6b39('0x4e')](_0x2ad617[_0x6b39('0x5b')],{'messageId':_0x19628b[_0x6b39('0xaf')],'sentAt':moment()['format'](_0x6b39('0x9c')),'read':!![],'MailAccountId':_0x55a4f0['id'],'UserId':_0x2ad617[_0x6b39('0x6f')]['id'],'ContactId':_0x54ad4b['id']})]};if(_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xb2')]){_0x3494b3=_['merge'](_0x3494b3,_0x2ad617[_0x6b39('0x5b')][_0x6b39('0xb2')]);}return db[_0x6b39('0x86')]['create'](_0x3494b3,{'include':[{'model':db[_0x6b39('0x99')],'as':_0x6b39('0xb3')}]});}})[_0x6b39('0x20')](respondWithResult(_0x2684cc,null))[_0x6b39('0x53')](handleError(_0x2684cc,null));};exports[_0x6b39('0xb4')]=function(_0x48301e,_0x45f199,_0x3aa33f){return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x48301e[_0x6b39('0x55')]['id']},'include':[{'model':db[_0x6b39('0x56')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x45f199,null))['then'](function(_0x15df67){if(_0x15df67&&_0x15df67[_0x6b39('0x39')]){var _0x56744d={'id':_0x15df67['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15df67[_0x6b39('0x39')][_0x6b39('0x76')]){_0x56744d[_0x6b39('0x76')]=_0x15df67['Smtp'][_0x6b39('0x76')];}else{_0x56744d[_0x6b39('0x74')]=_0x15df67['Smtp'][_0x6b39('0x74')];_0x56744d[_0x6b39('0x75')]=_0x15df67[_0x6b39('0x39')][_0x6b39('0x75')];_0x56744d[_0x6b39('0xaa')]=_0x15df67['Smtp']['secure'];}if(_0x15df67['Smtp'][_0x6b39('0xb5')]){_0x56744d[_0x6b39('0xa9')]={'user':_0x15df67[_0x6b39('0x39')][_0x6b39('0x6f')],'pass':_0x15df67[_0x6b39('0x39')][_0x6b39('0x72')]};}return respondWithRpcPromise(_0x6b39('0xb6'),'verifySmtp',{'account':_0x56744d});}})[_0x6b39('0x20')](respondWithResult(_0x45f199,null))[_0x6b39('0x53')](handleError(_0x45f199,null));};exports[_0x6b39('0x33')]=function(_0x29e974,_0x593c4e){return db['MailAccount']['find']({'where':{'id':_0x29e974[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x593c4e,null))[_0x6b39('0x20')](function(_0x38f795){if(_0x38f795&&_0x38f795[_0x6b39('0x76')]){throw new db[(_0x6b39('0x1d'))][(_0x6b39('0x1e'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x38f795;})[_0x6b39('0x20')](removeEntity(_0x593c4e,null))['catch'](handleError(_0x593c4e,null));};exports[_0x6b39('0xb7')]=function(_0x4991c4,_0x4ebec5,_0x2b1c20){return db[_0x6b39('0x52')]['find']({'where':{'id':_0x4991c4[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x4ebec5,null))['then'](function(_0xeb412b){if(_0xeb412b){return _0xeb412b['addAgents'](_0x4991c4['body'][_0x6b39('0x87')],_[_0x6b39('0x88')](_0x4991c4[_0x6b39('0x5b')],['ids','id'])||{})[_0x6b39('0xb8')](function(_0x9259d0){for(var _0x33fe26=0x0;_0x33fe26<_0x4991c4[_0x6b39('0x5b')][_0x6b39('0x87')][_0x6b39('0x58')];_0x33fe26+=0x1){socket['emit'](_0x6b39('0xb9'),{'UserId':_0x4991c4[_0x6b39('0x5b')][_0x6b39('0x87')][_0x33fe26],'MailAccountId':_0x4991c4['params']['id']});}return _0x9259d0;});}})['then'](respondWithResult(_0x4ebec5,null))[_0x6b39('0x53')](handleError(_0x4ebec5,null));};exports[_0x6b39('0xba')]=function(_0x565127,_0x2d1a96,_0x59c36d){return db[_0x6b39('0x52')][_0x6b39('0x5a')]({'where':{'id':_0x565127['params']['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x2d1a96,null))['then'](function(_0xd1bf7b){if(_0xd1bf7b){return _0xd1bf7b[_0x6b39('0xba')](_0x565127[_0x6b39('0x43')][_0x6b39('0x87')])[_0x6b39('0x20')](function(){if(_[_0x6b39('0xbb')](_0x565127[_0x6b39('0x43')][_0x6b39('0x87')])){for(var _0x34c65a=0x0;_0x34c65a<_0x565127[_0x6b39('0x43')]['ids']['length'];_0x34c65a+=0x1){socket[_0x6b39('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x565127['query'][_0x6b39('0x87')][_0x34c65a]),'MailAccountId':Number(_0x565127[_0x6b39('0x55')]['id'])});}}else{socket[_0x6b39('0xbc')](_0x6b39('0xbd'),{'UserId':Number(_0x565127[_0x6b39('0x43')][_0x6b39('0x87')]),'MailAccountId':Number(_0x565127[_0x6b39('0x55')]['id'])});}});}})[_0x6b39('0x20')](respondWithStatusCode(_0x2d1a96,null))[_0x6b39('0x53')](handleError(_0x2d1a96,null));};exports[_0x6b39('0xbe')]=function(_0x4a69ad,_0x4dc113,_0x4a2409){var _0x1c81b1={};var _0x15e75e={};var _0x41e25a;var _0x5844c7;return db[_0x6b39('0x52')][_0x6b39('0x61')]({'where':{'id':_0x4a69ad[_0x6b39('0x55')]['id']}})[_0x6b39('0x20')](handleEntityNotFound(_0x4dc113,null))[_0x6b39('0x20')](function(_0x261519){if(_0x261519){_0x41e25a=_0x261519;_0x15e75e[_0x6b39('0x40')]=_[_0x6b39('0x41')](db['User'][_0x6b39('0x57')]);_0x15e75e[_0x6b39('0x43')]=_[_0x6b39('0x41')](_0x4a69ad['query']);_0x15e75e[_0x6b39('0x4c')]=_['intersection'](_0x15e75e[_0x6b39('0x40')],_0x15e75e[_0x6b39('0x43')]);_0x1c81b1[_0x6b39('0x44')]=_[_0x6b39('0x42')](_0x15e75e['model'],qs[_0x6b39('0x45')](_0x4a69ad['query'][_0x6b39('0x45')]));_0x1c81b1['attributes']=_0x1c81b1[_0x6b39('0x44')][_0x6b39('0x58')]?_0x1c81b1[_0x6b39('0x44')]:_0x15e75e[_0x6b39('0x40')];_0x1c81b1[_0x6b39('0x48')]=qs[_0x6b39('0x49')](_0x4a69ad[_0x6b39('0x43')][_0x6b39('0x49')]);_0x1c81b1['where']=qs[_0x6b39('0x4c')](_[_0x6b39('0x4b')](_0x4a69ad['query'],_0x15e75e[_0x6b39('0x4c')]));if(_0x4a69ad[_0x6b39('0x43')][_0x6b39('0x4d')]){_0x1c81b1[_0x6b39('0x4a')]=_['merge'](_0x1c81b1[_0x6b39('0x4a')],{'$or':_['map'](_0x1c81b1['attributes'],function(_0xb5eb58){var _0x4c94f9={};_0x4c94f9[_0xb5eb58]={'$like':'%'+_0x4a69ad['query'][_0x6b39('0x4d')]+'%'};return _0x4c94f9;})});}_0x1c81b1=_[_0x6b39('0x4e')]({},_0x1c81b1,_0x4a69ad['options']);return _0x41e25a[_0x6b39('0xbe')](_0x1c81b1);}})['then'](function(_0x52d37e){if(_0x52d37e){_0x5844c7=_0x52d37e[_0x6b39('0x58')];if(!_0x4a69ad[_0x6b39('0x43')][_0x6b39('0x46')](_0x6b39('0x47'))){_0x1c81b1['limit']=qs[_0x6b39('0x2d')](_0x4a69ad[_0x6b39('0x43')][_0x6b39('0x2d')]);_0x1c81b1[_0x6b39('0x2c')]=qs['offset'](_0x4a69ad[_0x6b39('0x43')][_0x6b39('0x2c')]);}return _0x41e25a['getAgents'](_0x1c81b1);}})[_0x6b39('0x20')](function(_0x184f2b){if(_0x184f2b){return _0x184f2b?{'count':_0x5844c7,'rows':_0x184f2b}:null;}})[_0x6b39('0x20')](respondWithResult(_0x4dc113,null))['catch'](handleError(_0x4dc113,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ea93c17..6313c17 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 _0x1570=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0x35be9b,_0x19b5f2){var _0x101b09=function(_0xf87f57){while(--_0xf87f57){_0x35be9b['push'](_0x35be9b['shift']());}};_0x101b09(++_0x19b5f2);}(_0x1570,0x18a));var _0x0157=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x1570[_0x2160a9];return _0xa88cf7;};'use strict';var EventEmitter=require(_0x0157('0x0'));var MailAccount=require(_0x0157('0x1'))['db'][_0x0157('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0157('0x3')](0x0);var events={'afterCreate':_0x0157('0x4'),'afterUpdate':'update','afterDestroy':_0x0157('0x5')};function emitEvent(_0x236ebd){return function(_0x566762,_0x5803c8,_0x151231){MailAccountEvents[_0x0157('0x6')](_0x236ebd+':'+_0x566762['id'],_0x566762);MailAccountEvents[_0x0157('0x6')](_0x236ebd,_0x566762);_0x151231(null);};}for(var e in events){if(events[_0x0157('0x7')](e)){var event=events[e];MailAccount[_0x0157('0x8')](e,emitEvent(event));}}module[_0x0157('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x5619=['hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x220200,_0x1f7c9f){var _0x3b9e17=function(_0x1213c0){while(--_0x1213c0){_0x220200['push'](_0x220200['shift']());}};_0x3b9e17(++_0x1f7c9f);}(_0x5619,0x160));var _0x9561=function(_0x300430,_0x14e11b){_0x300430=_0x300430-0x0;var _0x4c9466=_0x5619[_0x300430];return _0x4c9466;};'use strict';var EventEmitter=require(_0x9561('0x0'));var MailAccount=require(_0x9561('0x1'))['db'][_0x9561('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9561('0x3')](0x0);var events={'afterCreate':_0x9561('0x4'),'afterUpdate':_0x9561('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c5e4e){return function(_0x1f142d,_0x41e1ea,_0x2c0f80){MailAccountEvents[_0x9561('0x6')](_0x2c5e4e+':'+_0x1f142d['id'],_0x1f142d);MailAccountEvents[_0x9561('0x6')](_0x2c5e4e,_0x1f142d);_0x2c0f80(null);};}for(var e in events){if(events[_0x9561('0x7')](e)){var event=events[e];MailAccount[_0x9561('0x8')](e,emitEvent(event));}}module[_0x9561('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b1e8a34..16f59a9 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 _0x441a=['../../config/logger','api','bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util'];(function(_0x48869d,_0x188358){var _0x3aea1b=function(_0xde4977){while(--_0xde4977){_0x48869d['push'](_0x48869d['shift']());}};_0x3aea1b(++_0x188358);}(_0x441a,0xdb));var _0xa441=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x441a[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0xa441('0x0'));var util=require(_0xa441('0x1'));var logger=require(_0xa441('0x2'))(_0xa441('0x3'));var moment=require('moment');var BPromise=require(_0xa441('0x4'));var rp=require(_0xa441('0x5'));var fs=require('fs');var path=require(_0xa441('0x6'));var rimraf=require(_0xa441('0x7'));var config=require('../../config/environment');var attributes=require(_0xa441('0x8'));module[_0xa441('0x9')]=function(_0x54ac42,_0x4c73bd){return _0x54ac42[_0xa441('0xa')](_0xa441('0xb'),attributes,{'tableName':_0xa441('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ce=['bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','define','mail_accounts','lodash','moment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x24ce,0x130));var _0xe24c=function(_0x59fa31,_0x3ead85){_0x59fa31=_0x59fa31-0x0;var _0x56b181=_0x24ce[_0x59fa31];return _0x56b181;};'use strict';var _=require(_0xe24c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe24c('0x1'));var BPromise=require(_0xe24c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe24c('0x3'));var rimraf=require(_0xe24c('0x4'));var config=require(_0xe24c('0x5'));var attributes=require(_0xe24c('0x6'));module['exports']=function(_0x40274a,_0x1609b3){return _0x40274a[_0xe24c('0x7')]('MailAccount',attributes,{'tableName':_0xe24c('0x8'),'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 46d3345..1e70705 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 _0x2e54=['then','catch','ShowMailAccount','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','priority','asc','push','length','autoclose','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','spread','update','interaction','created','contact','originCc','bcc','Attachment','UserId','unshift','agent','name','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2e54,0x1dd));var _0x42e5=function(_0x37c4e3,_0x3cb7ac){_0x37c4e3=_0x37c4e3-0x0;var _0xef665d=_0x2e54[_0x37c4e3];return _0xef665d;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232c});config['redis']=_[_0x42e5('0xb')](config['redis'],{'host':_0x42e5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42e5('0xd')]));require(_0x42e5('0xe'))[_0x42e5('0xf')](socket);function respondWithRpcPromise(_0x15f9f1,_0x206bf3,_0x1e5d2d){return new BPromise(function(_0xe1ab4b,_0x2fa2f0){return client[_0x42e5('0x10')](_0x15f9f1,_0x1e5d2d)['then'](function(_0x456298){logger[_0x42e5('0x11')]('MailAccount,\x20%s,\x20%s',_0x206bf3,_0x42e5('0x12'));logger[_0x42e5('0x13')](_0x42e5('0x14'),_0x206bf3,_0x42e5('0x12'),JSON[_0x42e5('0x15')](_0x456298));if(_0x456298[_0x42e5('0x16')]){if(_0x456298[_0x42e5('0x16')][_0x42e5('0x17')]===0x1f4){logger[_0x42e5('0x16')](_0x42e5('0x18'),_0x206bf3,_0x456298['error'][_0x42e5('0x19')]);return _0x2fa2f0(_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);}logger[_0x42e5('0x16')](_0x42e5('0x18'),_0x206bf3,_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);return _0xe1ab4b(_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);}else{logger[_0x42e5('0x11')](_0x42e5('0x18'),_0x206bf3,_0x42e5('0x12'));_0xe1ab4b(_0x456298[_0x42e5('0x1a')][_0x42e5('0x19')]);}})['catch'](function(_0x1460c0){logger['error']('MailAccount,\x20%s,\x20%s',_0x206bf3,_0x1460c0);_0x2fa2f0(_0x1460c0);});});}exports[_0x42e5('0x1b')]=function(_0x499f77){var _0x5a1de2=this;return new Promise(function(_0x41a823,_0x39a3e2){return db[_0x42e5('0x1c')][_0x42e5('0x1d')]({'raw':_0x499f77[_0x42e5('0x1e')]?_0x499f77[_0x42e5('0x1e')][_0x42e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x499f77['options']?_0x499f77['options'][_0x42e5('0x20')]||null:null,'attributes':_0x499f77['options']?_0x499f77[_0x42e5('0x1e')][_0x42e5('0x21')]||null:null,'limit':_0x499f77[_0x42e5('0x1e')]?_0x499f77[_0x42e5('0x1e')][_0x42e5('0x22')]||null:null,'include':_0x499f77['options']?_0x499f77[_0x42e5('0x1e')][_0x42e5('0x23')]?_[_0x42e5('0x24')](_0x499f77[_0x42e5('0x1e')][_0x42e5('0x23')],function(_0x4f52b2){return{'model':db[_0x4f52b2['model']],'as':_0x4f52b2['as'],'attributes':_0x4f52b2[_0x42e5('0x21')],'include':_0x4f52b2['include']?_['map'](_0x4f52b2[_0x42e5('0x23')],function(_0x5b1727){return{'model':db[_0x5b1727[_0x42e5('0x25')]],'as':_0x5b1727['as'],'attributes':_0x5b1727[_0x42e5('0x21')],'include':_0x5b1727[_0x42e5('0x23')]?_[_0x42e5('0x24')](_0x5b1727[_0x42e5('0x23')],function(_0x2f1edc){return{'model':db[_0x2f1edc['model']],'as':_0x2f1edc['as'],'attributes':_0x2f1edc[_0x42e5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0x26')](function(_0x39f763){logger[_0x42e5('0x11')](_0x42e5('0x1b'),_0x499f77);logger[_0x42e5('0x13')](_0x42e5('0x1b'),_0x499f77,JSON[_0x42e5('0x15')](_0x39f763));_0x41a823(_0x39f763);})[_0x42e5('0x27')](function(_0x2ba9ef){logger[_0x42e5('0x16')](_0x42e5('0x1b'),_0x2ba9ef[_0x42e5('0x19')],_0x499f77);_0x39a3e2(_0x5a1de2['error'](0x1f4,_0x2ba9ef[_0x42e5('0x19')]));});});};exports[_0x42e5('0x28')]=function(_0x14c8fd){var _0x156e73=this;return new Promise(function(_0x5bdc87,_0x539254){return db[_0x42e5('0x1c')]['find']({'raw':_0x14c8fd[_0x42e5('0x1e')]?_0x14c8fd['options'][_0x42e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x14c8fd[_0x42e5('0x1e')]?_0x14c8fd[_0x42e5('0x1e')]['where']||null:null,'attributes':_0x14c8fd[_0x42e5('0x1e')]?_0x14c8fd[_0x42e5('0x1e')]['attributes']||null:null,'include':_0x14c8fd[_0x42e5('0x1e')]?_0x14c8fd['options'][_0x42e5('0x23')]?_[_0x42e5('0x24')](_0x14c8fd[_0x42e5('0x1e')][_0x42e5('0x23')],function(_0x3c12c6){return{'model':db[_0x3c12c6[_0x42e5('0x25')]],'as':_0x3c12c6['as'],'attributes':_0x3c12c6[_0x42e5('0x21')],'include':_0x3c12c6['include']?_['map'](_0x3c12c6[_0x42e5('0x23')],function(_0xd41feb){return{'model':db[_0xd41feb[_0x42e5('0x25')]],'as':_0xd41feb['as'],'attributes':_0xd41feb['attributes'],'include':_0xd41feb['include']?_['map'](_0xd41feb['include'],function(_0x245cda){return{'model':db[_0x245cda[_0x42e5('0x25')]],'as':_0x245cda['as'],'attributes':_0x245cda[_0x42e5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0x26')](function(_0x2be00e){logger[_0x42e5('0x11')](_0x42e5('0x28'),_0x14c8fd);logger[_0x42e5('0x13')]('ShowMailAccount',_0x14c8fd,JSON[_0x42e5('0x15')](_0x2be00e));_0x5bdc87(_0x2be00e);})['catch'](function(_0x470338){logger[_0x42e5('0x16')](_0x42e5('0x28'),_0x470338[_0x42e5('0x19')],_0x14c8fd);_0x539254(_0x156e73[_0x42e5('0x16')](0x1f4,_0x470338[_0x42e5('0x19')]));});});};exports[_0x42e5('0x29')]=function(_0x5ab9b8){var _0x20f372=this;return new Promise(function(_0x356ff6,_0x5362c8){var _0x2875c6={'body':_0x5ab9b8['body'],'channel':'mail'};var _0x4d948a=_[_0x42e5('0x2a')](_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')]),[_0x42e5('0x2e'),_0x42e5('0x2f'),_0x42e5('0x30'),'ListId']);var _0x1baebf=![];if(_0x5ab9b8[_0x42e5('0x31')]['id']){delete _0x5ab9b8['body']['id'];}if(_[_0x42e5('0x32')](_0x5ab9b8[_0x42e5('0x31')]['from'])){return _0x5362c8(_0x20f372[_0x42e5('0x16')](0x1f4,_0x42e5('0x33')));}if(_[_0x42e5('0x32')](_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x31')])||_0x5ab9b8['body'][_0x42e5('0x31')]===''){return _0x5362c8(_0x20f372[_0x42e5('0x16')](0x1f4,_0x42e5('0x34')));}if(_[_0x42e5('0x32')](_0x5ab9b8['body'][_0x42e5('0x35')])){return _0x5362c8(_0x20f372[_0x42e5('0x16')](0x1f4,_0x42e5('0x36')+_0x4d948a));}if(!_[_0x42e5('0x37')](_0x4d948a,_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x35')])){return _0x5362c8(_0x20f372[_0x42e5('0x16')](0x1f4,_0x42e5('0x38')+_0x4d948a));}var _0x54c75b={};_0x54c75b[_0x5ab9b8[_0x42e5('0x31')]['mapKey']]=_0x5ab9b8['body'][_0x42e5('0x39')];return db[_0x42e5('0x1c')][_0x42e5('0x3a')]({'where':{'id':_0x5ab9b8[_0x42e5('0x3b')]['id']},'include':[{'model':db[_0x42e5('0x3c')],'as':_0x42e5('0x3d'),'include':[{'model':db[_0x42e5('0x2c')],'as':'Contacts','where':_0x54c75b,'limit':0x1,'order':[[_0x42e5('0x2f'),_0x42e5('0x3e')]]}]},{'model':db[_0x42e5('0x3f')],'as':_0x42e5('0x40')},{'model':db[_0x42e5('0x41')],'as':_0x42e5('0x42')}]})[_0x42e5('0x26')](function(_0x736e5){if(_0x736e5&&_0x736e5['List']){var _0x1311bf=_0x736e5[_0x42e5('0x43')]({'plain':!![]});_0x2875c6[_0x42e5('0x3b')]=_[_0x42e5('0x44')](_0x1311bf,[_0x42e5('0x40'),_0x42e5('0x3d')]);_0x2875c6[_0x42e5('0x45')]=_0x1311bf[_0x42e5('0x40')];_0x2875c6[_0x42e5('0x46')]=_0x1311bf['List'];_0x2875c6[_0x42e5('0x45')]=_['orderBy'](_0x2875c6[_0x42e5('0x45')],[_0x42e5('0x47')],[_0x42e5('0x48')]);if(_0x2875c6['account']&&_0x2875c6['account']['autoclose']){_0x2875c6[_0x42e5('0x45')][_0x42e5('0x49')]({'id':0x0,'priority':_0x2875c6[_0x42e5('0x45')][_0x42e5('0x4a')]+0x1,'app':'close','appdata':_0x42e5('0x4b'),'interval':_0x42e5('0x4c')});}if(_0x2875c6[_0x42e5('0x3b')]['Applications']){delete _0x2875c6[_0x42e5('0x3b')]['Applications'];}if(_0x2875c6[_0x42e5('0x3b')][_0x42e5('0x3d')]){delete _0x2875c6['account'][_0x42e5('0x3d')];}if(_0x1311bf[_0x42e5('0x3d')][_0x42e5('0x4d')][_0x42e5('0x4a')]){return _0x1311bf[_0x42e5('0x3d')][_0x42e5('0x4d')][0x0];}var _0x41c1dc=_[_0x42e5('0xb')](_0x5ab9b8[_0x42e5('0x31')],{'firstName':_0x5ab9b8[_0x42e5('0x31')]['from'],'ListId':_0x1311bf[_0x42e5('0x4e')]});_0x41c1dc[_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x35')]]=_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x39')];return db['CmContact'][_0x42e5('0x4f')](_0x41c1dc);}else{throw new Error(_0x42e5('0x50'));}})[_0x42e5('0x26')](function(_0x106a4d){_0x2875c6['contact']=_0x106a4d;if(_0x106a4d){if(!_0x5ab9b8['body']['message'][_0x42e5('0x51')]){_0x5ab9b8[_0x42e5('0x31')]['message'][_0x42e5('0x51')]=rs[_0x42e5('0x52')]()+'\x20'+_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x39')];}var _0x4361cb={'ContactId':_0x106a4d['id'],'MailAccountId':_0x5ab9b8[_0x42e5('0x3b')]['id'],'inReplyTo':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['messageId'],'to':_0x5ab9b8[_0x42e5('0x31')]['message'][_0x42e5('0x39')],'cc':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['cc'],'subject':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x53')],'attach':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x54')],'lastMsgAt':moment()[_0x42e5('0x55')](_0x42e5('0x56')),'lastMsgDirection':'in','lastMsgBody':_0x5ab9b8['body'][_0x42e5('0x31')]};return db['MailInteraction'][_0x42e5('0x3a')]({'where':{'closed':![],'MailAccountId':_0x5ab9b8['account']['id']},'include':[{'model':db[_0x42e5('0x57')],'as':_0x42e5('0x58'),'attributes':['messageId'],'where':{'messageId':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['inReplyTo']}}]})[_0x42e5('0x26')](function(_0x9b93a9){if(_0x9b93a9){return[_0x9b93a9,![]];}return db['MailInteraction'][_0x42e5('0x4f')](_0x4361cb)[_0x42e5('0x26')](function(_0x390a1b){return[_0x390a1b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x42e5('0x59')](function(_0x3cdc61,_0x124207){if(_0x3cdc61){_0x1baebf=_0x124207;if(!_0x124207){return _0x3cdc61[_0x42e5('0x5a')]({'inReplyTo':_0x5ab9b8['body'][_0x42e5('0x19')]['messageId'],'to':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x39')],'cc':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['cc'],'subject':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['subject'],'attach':_0x3cdc61[_0x42e5('0x54')]?_0x3cdc61[_0x42e5('0x54')]:_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x54')],'substatus':null,'substatusAt':moment()[_0x42e5('0x55')](_0x42e5('0x56')),'lastMsgAt':moment()[_0x42e5('0x55')](_0x42e5('0x56')),'lastMsgDirection':'in','lastMsgBody':_0x5ab9b8['body'][_0x42e5('0x31')]});}else{return _0x3cdc61;}}})[_0x42e5('0x26')](function(_0x2af01f){_0x2875c6[_0x42e5('0x5b')]=_0x2af01f['get']({'plain':!![]});_0x2875c6[_0x42e5('0x5b')][_0x42e5('0x5c')]=_0x1baebf;return db[_0x42e5('0x57')][_0x42e5('0x4f')]({'body':_0x5ab9b8['body']['body'],'MailAccountId':_0x5ab9b8['account']['id'],'MailInteractionId':_0x2af01f['id'],'direction':'in','ContactId':_0x2875c6[_0x42e5('0x5d')]['id'],'messageId':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x51')],'from':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x39')],'to':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['to'],'cc':_0x5ab9b8['body'][_0x42e5('0x19')]['cc'],'subject':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x53')],'attach':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')][_0x42e5('0x54')],'Attachments':_0x5ab9b8[_0x42e5('0x31')]['message']['attachments'],'originTo':_0x5ab9b8[_0x42e5('0x31')][_0x42e5('0x19')]['originTo'],'originCc':_0x5ab9b8['body']['message'][_0x42e5('0x5e')],'bcc':_0x5ab9b8[_0x42e5('0x31')]['message'][_0x42e5('0x5f')]},{'include':[{'model':db[_0x42e5('0x60')],'as':'Attachments'}]});})[_0x42e5('0x26')](function(_0x14e1ee){_0x2875c6['message']=_0x14e1ee;if(_0x2875c6[_0x42e5('0x5b')]['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x2875c6[_0x42e5('0x5b')][_0x42e5('0x61')]}})['then'](function(_0x1be0ce){if(_0x1be0ce){_0x2875c6[_0x42e5('0x45')][_0x42e5('0x62')]({'id':0x0,'priority':0x0,'app':_0x42e5('0x63'),'appdata':_0x1be0ce[_0x42e5('0x64')]+','+(_0x2875c6[_0x42e5('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x42e5('0x4c')});}return respondWithRpcPromise(_0x42e5('0x65'),'startRouting',_0x2875c6);});}return respondWithRpcPromise('Start',_0x42e5('0x66'),_0x2875c6);})[_0x42e5('0x26')](function(_0x2dbba9){_0x356ff6(_0x2dbba9);})[_0x42e5('0x27')](function(_0x1e2fa7){_0x5362c8(_0x20f372[_0x42e5('0x16')](0x1f4,_0x1e2fa7[_0x42e5('0x19')]));});});}; \ No newline at end of file +var _0x1a5c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','model','find','raw','where','map','ShowMailAccount','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','List','DESC','Applications','Smtp','then','get','account','omit','list','applications','orderBy','asc','autoclose','length','*,*,*,*','ListId','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','inReplyTo','Contact\x20not\x20found','update','interaction','created','MailMessage','attachments','originTo','bcc','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting'];(function(_0x2c5f29,_0x4fe25d){var _0x180f50=function(_0x4fe62c){while(--_0x4fe62c){_0x2c5f29['push'](_0x2c5f29['shift']());}};_0x180f50(++_0x4fe25d);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x1a5c[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xc1a5('0x0'));var util=require(_0xc1a5('0x1'));var moment=require(_0xc1a5('0x2'));var BPromise=require(_0xc1a5('0x3'));var rs=require(_0xc1a5('0x4'));var fs=require('fs');var Redis=require(_0xc1a5('0x5'));var db=require(_0xc1a5('0x6'))['db'];var utils=require(_0xc1a5('0x7'));var logger=require(_0xc1a5('0x8'))(_0xc1a5('0x9'));var config=require('../../config/environment');var jayson=require(_0xc1a5('0xa'));var client=jayson[_0xc1a5('0xb')][_0xc1a5('0xc')]({'port':0x232c});config[_0xc1a5('0xd')]=_[_0xc1a5('0xe')](config[_0xc1a5('0xd')],{'host':_0xc1a5('0xf'),'port':0x18eb});var socket=require(_0xc1a5('0x10'))(new Redis(config['redis']));require(_0xc1a5('0x11'))[_0xc1a5('0x12')](socket);function respondWithRpcPromise(_0x4cba0b,_0x176448,_0x481ba4){return new BPromise(function(_0x536121,_0x399129){return client[_0xc1a5('0x13')](_0x4cba0b,_0x481ba4)['then'](function(_0x14ac4a){logger[_0xc1a5('0x14')](_0xc1a5('0x15'),_0x176448,_0xc1a5('0x16'));logger[_0xc1a5('0x17')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x176448,_0xc1a5('0x16'),JSON[_0xc1a5('0x18')](_0x14ac4a));if(_0x14ac4a[_0xc1a5('0x19')]){if(_0x14ac4a[_0xc1a5('0x19')][_0xc1a5('0x1a')]===0x1f4){logger[_0xc1a5('0x19')](_0xc1a5('0x15'),_0x176448,_0x14ac4a[_0xc1a5('0x19')][_0xc1a5('0x1b')]);return _0x399129(_0x14ac4a['error']['message']);}logger[_0xc1a5('0x19')](_0xc1a5('0x15'),_0x176448,_0x14ac4a[_0xc1a5('0x19')]['message']);return _0x536121(_0x14ac4a[_0xc1a5('0x19')][_0xc1a5('0x1b')]);}else{logger[_0xc1a5('0x14')]('MailAccount,\x20%s,\x20%s',_0x176448,_0xc1a5('0x16'));_0x536121(_0x14ac4a['result'][_0xc1a5('0x1b')]);}})[_0xc1a5('0x1c')](function(_0x367191){logger[_0xc1a5('0x19')](_0xc1a5('0x15'),_0x176448,_0x367191);_0x399129(_0x367191);});});}exports[_0xc1a5('0x1d')]=function(_0x307e5c){var _0x4591df=this;return new Promise(function(_0x347b10,_0x1f327c){return db[_0xc1a5('0x1e')][_0xc1a5('0x1f')]({'raw':_0x307e5c[_0xc1a5('0x20')]?_0x307e5c[_0xc1a5('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x307e5c[_0xc1a5('0x20')]?_0x307e5c[_0xc1a5('0x20')]['where']||null:null,'attributes':_0x307e5c[_0xc1a5('0x20')]?_0x307e5c[_0xc1a5('0x20')][_0xc1a5('0x21')]||null:null,'limit':_0x307e5c[_0xc1a5('0x20')]?_0x307e5c[_0xc1a5('0x20')][_0xc1a5('0x22')]||null:null,'include':_0x307e5c[_0xc1a5('0x20')]?_0x307e5c[_0xc1a5('0x20')]['include']?_['map'](_0x307e5c[_0xc1a5('0x20')][_0xc1a5('0x23')],function(_0x2d3a61){return{'model':db[_0x2d3a61['model']],'as':_0x2d3a61['as'],'attributes':_0x2d3a61[_0xc1a5('0x21')],'include':_0x2d3a61['include']?_['map'](_0x2d3a61[_0xc1a5('0x23')],function(_0x41f861){return{'model':db[_0x41f861[_0xc1a5('0x24')]],'as':_0x41f861['as'],'attributes':_0x41f861[_0xc1a5('0x21')],'include':_0x41f861['include']?_['map'](_0x41f861['include'],function(_0x1fa511){return{'model':db[_0x1fa511['model']],'as':_0x1fa511['as'],'attributes':_0x1fa511[_0xc1a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bef7a){logger[_0xc1a5('0x14')](_0xc1a5('0x1d'),_0x307e5c);logger[_0xc1a5('0x17')]('GetMailAccount',_0x307e5c,JSON['stringify'](_0x2bef7a));_0x347b10(_0x2bef7a);})[_0xc1a5('0x1c')](function(_0x5e50a7){logger[_0xc1a5('0x19')](_0xc1a5('0x1d'),_0x5e50a7[_0xc1a5('0x1b')],_0x307e5c);_0x1f327c(_0x4591df[_0xc1a5('0x19')](0x1f4,_0x5e50a7['message']));});});};exports['ShowMailAccount']=function(_0x293adc){var _0x1cf149=this;return new Promise(function(_0x34e61b,_0x40cace){return db[_0xc1a5('0x1e')][_0xc1a5('0x25')]({'raw':_0x293adc[_0xc1a5('0x20')]?_0x293adc[_0xc1a5('0x20')][_0xc1a5('0x26')]===undefined?!![]:![]:!![],'where':_0x293adc[_0xc1a5('0x20')]?_0x293adc[_0xc1a5('0x20')][_0xc1a5('0x27')]||null:null,'attributes':_0x293adc[_0xc1a5('0x20')]?_0x293adc[_0xc1a5('0x20')]['attributes']||null:null,'include':_0x293adc[_0xc1a5('0x20')]?_0x293adc[_0xc1a5('0x20')][_0xc1a5('0x23')]?_[_0xc1a5('0x28')](_0x293adc[_0xc1a5('0x20')][_0xc1a5('0x23')],function(_0x47cc25){return{'model':db[_0x47cc25[_0xc1a5('0x24')]],'as':_0x47cc25['as'],'attributes':_0x47cc25[_0xc1a5('0x21')],'include':_0x47cc25[_0xc1a5('0x23')]?_[_0xc1a5('0x28')](_0x47cc25['include'],function(_0x26f609){return{'model':db[_0x26f609[_0xc1a5('0x24')]],'as':_0x26f609['as'],'attributes':_0x26f609[_0xc1a5('0x21')],'include':_0x26f609['include']?_['map'](_0x26f609[_0xc1a5('0x23')],function(_0x2feaea){return{'model':db[_0x2feaea['model']],'as':_0x2feaea['as'],'attributes':_0x2feaea[_0xc1a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59be41){logger[_0xc1a5('0x14')](_0xc1a5('0x29'),_0x293adc);logger[_0xc1a5('0x17')](_0xc1a5('0x29'),_0x293adc,JSON[_0xc1a5('0x18')](_0x59be41));_0x34e61b(_0x59be41);})['catch'](function(_0x2d98a3){logger[_0xc1a5('0x19')](_0xc1a5('0x29'),_0x2d98a3[_0xc1a5('0x1b')],_0x293adc);_0x40cace(_0x1cf149['error'](0x1f4,_0x2d98a3[_0xc1a5('0x1b')]));});});};exports[_0xc1a5('0x2a')]=function(_0x777914){var _0x40fa26=this;return new Promise(function(_0x46180a,_0xd37c8d){var _0x18914c={'body':_0x777914['body'],'channel':'mail'};var _0x21c3ac=_[_0xc1a5('0x2b')](_[_0xc1a5('0x2c')](db[_0xc1a5('0x2d')][_0xc1a5('0x2e')]),[_0xc1a5('0x2f'),_0xc1a5('0x30'),_0xc1a5('0x31'),'ListId']);var _0x5bb9e5=![];if(_0x777914['body']['id']){delete _0x777914['body']['id'];}if(_[_0xc1a5('0x32')](_0x777914[_0xc1a5('0x33')][_0xc1a5('0x34')])){return _0xd37c8d(_0x40fa26['error'](0x1f4,_0xc1a5('0x35')));}if(_['isNil'](_0x777914['body']['body'])||_0x777914[_0xc1a5('0x33')][_0xc1a5('0x33')]===''){return _0xd37c8d(_0x40fa26[_0xc1a5('0x19')](0x1f4,_0xc1a5('0x36')));}if(_[_0xc1a5('0x32')](_0x777914[_0xc1a5('0x33')]['mapKey'])){return _0xd37c8d(_0x40fa26[_0xc1a5('0x19')](0x1f4,_0xc1a5('0x37')+_0x21c3ac));}if(!_[_0xc1a5('0x38')](_0x21c3ac,_0x777914[_0xc1a5('0x33')][_0xc1a5('0x39')])){return _0xd37c8d(_0x40fa26[_0xc1a5('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21c3ac));}var _0x330141={};_0x330141[_0x777914[_0xc1a5('0x33')][_0xc1a5('0x39')]]=_0x777914[_0xc1a5('0x33')]['from'];return db['MailAccount'][_0xc1a5('0x25')]({'where':{'id':_0x777914['account']['id']},'include':[{'model':db['CmList'],'as':_0xc1a5('0x3a'),'include':[{'model':db[_0xc1a5('0x2d')],'as':'Contacts','where':_0x330141,'limit':0x1,'order':[[_0xc1a5('0x30'),_0xc1a5('0x3b')]]}]},{'model':db['MailApplication'],'as':_0xc1a5('0x3c')},{'model':db['MailServerOut'],'as':_0xc1a5('0x3d')}]})[_0xc1a5('0x3e')](function(_0x5738e2){if(_0x5738e2&&_0x5738e2[_0xc1a5('0x3a')]){var _0x2d9425=_0x5738e2[_0xc1a5('0x3f')]({'plain':!![]});_0x18914c[_0xc1a5('0x40')]=_[_0xc1a5('0x41')](_0x2d9425,[_0xc1a5('0x3c'),_0xc1a5('0x3a')]);_0x18914c['applications']=_0x2d9425[_0xc1a5('0x3c')];_0x18914c[_0xc1a5('0x42')]=_0x2d9425[_0xc1a5('0x3a')];_0x18914c[_0xc1a5('0x43')]=_[_0xc1a5('0x44')](_0x18914c[_0xc1a5('0x43')],['priority'],[_0xc1a5('0x45')]);if(_0x18914c[_0xc1a5('0x40')]&&_0x18914c['account'][_0xc1a5('0x46')]){_0x18914c[_0xc1a5('0x43')]['push']({'id':0x0,'priority':_0x18914c[_0xc1a5('0x43')][_0xc1a5('0x47')]+0x1,'app':'close','appdata':_0xc1a5('0x46'),'interval':_0xc1a5('0x48')});}if(_0x18914c[_0xc1a5('0x40')][_0xc1a5('0x3c')]){delete _0x18914c[_0xc1a5('0x40')][_0xc1a5('0x3c')];}if(_0x18914c[_0xc1a5('0x40')]['List']){delete _0x18914c[_0xc1a5('0x40')][_0xc1a5('0x3a')];}if(_0x2d9425[_0xc1a5('0x3a')]['Contacts'][_0xc1a5('0x47')]){return _0x2d9425[_0xc1a5('0x3a')]['Contacts'][0x0];}var _0x5bac8=_[_0xc1a5('0xe')](_0x777914['body'],{'firstName':_0x777914[_0xc1a5('0x33')]['from'],'ListId':_0x2d9425[_0xc1a5('0x49')]});_0x5bac8[_0x777914[_0xc1a5('0x33')][_0xc1a5('0x39')]]=_0x777914[_0xc1a5('0x33')][_0xc1a5('0x34')];return db[_0xc1a5('0x2d')][_0xc1a5('0x4a')](_0x5bac8);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x5e99a0){_0x18914c[_0xc1a5('0x4b')]=_0x5e99a0;if(_0x5e99a0){if(!_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')]['messageId']){_0x777914[_0xc1a5('0x33')]['message']['messageId']=rs['generate']()+'\x20'+_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x34')];}var _0x20f6fc={'ContactId':_0x5e99a0['id'],'MailAccountId':_0x777914[_0xc1a5('0x40')]['id'],'inReplyTo':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4c')],'to':_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x34')],'cc':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')]['cc'],'subject':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4d')],'attach':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4e')],'lastMsgAt':moment()[_0xc1a5('0x4f')](_0xc1a5('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x777914['body'][_0xc1a5('0x33')]};return db['MailInteraction'][_0xc1a5('0x25')]({'where':{'closed':![],'MailAccountId':_0x777914['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xc1a5('0x4c')],'where':{'messageId':_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x51')]}}]})[_0xc1a5('0x3e')](function(_0x3fe0e5){if(_0x3fe0e5){return[_0x3fe0e5,![]];}return db['MailInteraction'][_0xc1a5('0x4a')](_0x20f6fc)[_0xc1a5('0x3e')](function(_0x3c6b41){return[_0x3c6b41,!![]];});});}else{throw new Error(_0xc1a5('0x52'));}})['spread'](function(_0x475f28,_0x494cad){if(_0x475f28){_0x5bb9e5=_0x494cad;if(!_0x494cad){return _0x475f28[_0xc1a5('0x53')]({'inReplyTo':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4c')],'to':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x34')],'cc':_0x777914['body'][_0xc1a5('0x1b')]['cc'],'subject':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4d')],'attach':_0x475f28[_0xc1a5('0x4e')]?_0x475f28[_0xc1a5('0x4e')]:_0x777914[_0xc1a5('0x33')]['message'][_0xc1a5('0x4e')],'substatus':null,'substatusAt':moment()[_0xc1a5('0x4f')](_0xc1a5('0x50')),'lastMsgAt':moment()[_0xc1a5('0x4f')](_0xc1a5('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x33')]});}else{return _0x475f28;}}})[_0xc1a5('0x3e')](function(_0x1354a8){_0x18914c[_0xc1a5('0x54')]=_0x1354a8[_0xc1a5('0x3f')]({'plain':!![]});_0x18914c[_0xc1a5('0x54')][_0xc1a5('0x55')]=_0x5bb9e5;return db[_0xc1a5('0x56')][_0xc1a5('0x4a')]({'body':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x33')],'MailAccountId':_0x777914[_0xc1a5('0x40')]['id'],'MailInteractionId':_0x1354a8['id'],'direction':'in','ContactId':_0x18914c[_0xc1a5('0x4b')]['id'],'messageId':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4c')],'from':_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x34')],'to':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')]['to'],'cc':_0x777914['body'][_0xc1a5('0x1b')]['cc'],'subject':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4d')],'attach':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')][_0xc1a5('0x4e')],'Attachments':_0x777914[_0xc1a5('0x33')]['message'][_0xc1a5('0x57')],'originTo':_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x58')],'originCc':_0x777914[_0xc1a5('0x33')][_0xc1a5('0x1b')]['originCc'],'bcc':_0x777914['body'][_0xc1a5('0x1b')][_0xc1a5('0x59')]},{'include':[{'model':db[_0xc1a5('0x5a')],'as':_0xc1a5('0x5b')}]});})['then'](function(_0x447e69){_0x18914c[_0xc1a5('0x1b')]=_0x447e69;if(_0x18914c['interaction']['UserId']){return db[_0xc1a5('0x5c')]['find']({'attributes':['id',_0xc1a5('0x5d')],'where':{'id':_0x18914c[_0xc1a5('0x54')][_0xc1a5('0x5e')]}})[_0xc1a5('0x3e')](function(_0x2e755e){if(_0x2e755e){_0x18914c[_0xc1a5('0x43')][_0xc1a5('0x5f')]({'id':0x0,'priority':0x0,'app':_0xc1a5('0x60'),'appdata':_0x2e755e[_0xc1a5('0x5d')]+','+(_0x18914c['account'][_0xc1a5('0x61')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc1a5('0x62'),_0xc1a5('0x63'),_0x18914c);});}return respondWithRpcPromise(_0xc1a5('0x62'),'startRouting',_0x18914c);})[_0xc1a5('0x3e')](function(_0x5f3f72){_0x46180a(_0x5f3f72);})[_0xc1a5('0x1c')](function(_0x36c05c){_0xd37c8d(_0x40fa26[_0xc1a5('0x19')](0x1f4,_0x36c05c[_0xc1a5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index d079e6a..bada104 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 _0xbd10=['./mailAccount.events','save','remove','removeListener','register','length','mailAccount:'];(function(_0x4233a2,_0x478e28){var _0x1c420e=function(_0x10b59e){while(--_0x10b59e){_0x4233a2['push'](_0x4233a2['shift']());}};_0x1c420e(++_0x478e28);}(_0xbd10,0x85));var _0x0bd1=function(_0x1088f9,_0x48d7ca){_0x1088f9=_0x1088f9-0x0;var _0x5181f9=_0xbd10[_0x1088f9];return _0x5181f9;};'use strict';var MailAccountEvents=require(_0x0bd1('0x0'));var events=[_0x0bd1('0x1'),_0x0bd1('0x2'),'update'];function createListener(_0x35277d,_0x3088a0){return function(_0x1b5946){_0x3088a0['emit'](_0x35277d,_0x1b5946);};}function removeListener(_0xa7c705,_0xbcdd68){return function(){MailAccountEvents[_0x0bd1('0x3')](_0xa7c705,_0xbcdd68);};}exports[_0x0bd1('0x4')]=function(_0x453508){for(var _0x46c432=0x0,_0x4c129c=events[_0x0bd1('0x5')];_0x46c432<_0x4c129c;_0x46c432++){var _0x4dbb43=events[_0x46c432];var _0x639350=createListener(_0x0bd1('0x6')+_0x4dbb43,_0x453508);MailAccountEvents['on'](_0x4dbb43,_0x639350);}}; \ No newline at end of file +var _0xbeea=['length','mailAccount:','./mailAccount.events','remove','update','removeListener','register'];(function(_0x44e3a7,_0x5a40cd){var _0xfccd2a=function(_0x50e021){while(--_0x50e021){_0x44e3a7['push'](_0x44e3a7['shift']());}};_0xfccd2a(++_0x5a40cd);}(_0xbeea,0xb1));var _0xabee=function(_0xe0ba86,_0x5872bf){_0xe0ba86=_0xe0ba86-0x0;var _0x7f4cb2=_0xbeea[_0xe0ba86];return _0x7f4cb2;};'use strict';var MailAccountEvents=require(_0xabee('0x0'));var events=['save',_0xabee('0x1'),_0xabee('0x2')];function createListener(_0x35ca8b,_0x48a420){return function(_0x972e88){_0x48a420['emit'](_0x35ca8b,_0x972e88);};}function removeListener(_0x58afa7,_0x33571e){return function(){MailAccountEvents[_0xabee('0x3')](_0x58afa7,_0x33571e);};}exports[_0xabee('0x4')]=function(_0x1ea258){for(var _0x58c9ef=0x0,_0x5bb218=events[_0xabee('0x5')];_0x58c9ef<_0x5bb218;_0x58c9ef++){var _0x401ff1=events[_0x58c9ef];var _0x4a2999=createListener(_0xabee('0x6')+_0x401ff1,_0x1ea258);MailAccountEvents['on'](_0x401ff1,_0x4a2999);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6f52cf0..4a4b6cb 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 _0x4522=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','path','connect-timeout','express','../../components/auth/service'];(function(_0x177b56,_0xf790ca){var _0x434738=function(_0x19a013){while(--_0x19a013){_0x177b56['push'](_0x177b56['shift']());}};_0x434738(++_0xf790ca);}(_0x4522,0x1a0));var _0x2452=function(_0x464075,_0x2263c6){_0x464075=_0x464075-0x0;var _0x162d12=_0x4522[_0x464075];return _0x162d12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var auth=require(_0x2452('0x3'));var interaction=require(_0x2452('0x4'));var config=require(_0x2452('0x5'));var controller=require(_0x2452('0x6'));router[_0x2452('0x7')](_0x2452('0x8'),auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0xb')](_0x2452('0x8'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0xd')](_0x2452('0x8'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb9a7=['Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','util'];(function(_0x36494a,_0x3b4ad6){var _0x1f4695=function(_0x1a90e6){while(--_0x1a90e6){_0x36494a['push'](_0x36494a['shift']());}};_0x1f4695(++_0x3b4ad6);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb9a7[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b9a('0x2'));var config=require(_0x7b9a('0x3'));var controller=require(_0x7b9a('0x4'));router[_0x7b9a('0x5')](_0x7b9a('0x6'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x9')](_0x7b9a('0x6'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xa')](_0x7b9a('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index de67447..860bfed 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 _0x05c8=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x38bb1c,_0x3a470d){var _0x57a8af=function(_0x2b5703){while(--_0x2b5703){_0x38bb1c['push'](_0x38bb1c['shift']());}};_0x57a8af(++_0x3a470d);}(_0x05c8,0x68));var _0x805c=function(_0x584d4a,_0x11782b){_0x584d4a=_0x584d4a-0x0;var _0x527d4b=_0x05c8[_0x584d4a];return _0x527d4b;};'use strict';var Sequelize=require('sequelize');module[_0x805c('0x0')]={'priority':{'type':Sequelize[_0x805c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x805c('0x2')],'allowNull':![],'defaultValue':_0x805c('0x3')},'appdata':{'type':Sequelize[_0x805c('0x4')]()},'description':{'type':Sequelize[_0x805c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb19d=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x8962d6,_0x503ed6){var _0x566f25=function(_0x56b0f0){while(--_0x56b0f0){_0x8962d6['push'](_0x8962d6['shift']());}};_0x566f25(++_0x503ed6);}(_0xb19d,0x156));var _0xdb19=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xb19d[_0x5db313];return _0x36d503;};'use strict';var Sequelize=require(_0xdb19('0x0'));module[_0xdb19('0x1')]={'priority':{'type':Sequelize[_0xdb19('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb19('0x3')},'appdata':{'type':Sequelize[_0xdb19('0x4')]()},'description':{'type':Sequelize[_0xdb19('0x5')]},'interval':{'type':Sequelize[_0xdb19('0x5')],'defaultValue':_0xdb19('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b6696a0..c43fdae 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 _0x61e1=['show','model','MailApplication','rawAttributes','query','keys','filters','attributes','fields','length','includeAll','include','options','find','update','body','params','destroy','catch','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','then','sendStatus','error','name','send'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x61e1,0x19b));var _0x161e=function(_0x547b22,_0x494539){_0x547b22=_0x547b22-0x0;var _0x277710=_0x61e1[_0x547b22];return _0x277710;};'use strict';var pdf=require(_0x161e('0x0'));var emlformat=require(_0x161e('0x1'));var rimraf=require(_0x161e('0x2'));var zipdir=require(_0x161e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x161e('0x4'));var BPromise=require(_0x161e('0x5'));var Mustache=require(_0x161e('0x6'));var util=require(_0x161e('0x7'));var path=require(_0x161e('0x8'));var sox=require('sox');var csv=require(_0x161e('0x9'));var ejs=require(_0x161e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x161e('0xb'));var crypto=require(_0x161e('0xc'));var jsforce=require(_0x161e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x161e('0xe'));var Papa=require(_0x161e('0xf'));var Redis=require(_0x161e('0x10'));var authService=require(_0x161e('0x11'));var qs=require(_0x161e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x161e('0x13'))(_0x161e('0x14'));var utils=require(_0x161e('0x15'));var config=require('../../config/environment');var db=require(_0x161e('0x16'))['db'];function respondWithStatusCode(_0x3f5ce4,_0x5abbf6){_0x5abbf6=_0x5abbf6||0xcc;return function(_0x472d2d){if(_0x472d2d){return _0x3f5ce4['sendStatus'](_0x5abbf6);}return _0x3f5ce4[_0x161e('0x17')](_0x5abbf6)[_0x161e('0x18')]();};}function respondWithResult(_0x200512,_0x420df1){_0x420df1=_0x420df1||0xc8;return function(_0x47d7f0){if(_0x47d7f0){return _0x200512['status'](_0x420df1)[_0x161e('0x19')](_0x47d7f0);}};}function respondWithFilteredResult(_0x393d9c,_0x28aeb2){return function(_0x2e37fc){if(_0x2e37fc){var _0x48c834=_0x2e37fc[_0x161e('0x1a')],_0x25f7c5=_0x28aeb2['offset'],_0xe42e45=_0x28aeb2[_0x161e('0x1b')]+_0x28aeb2['limit'],_0x2f23c3;if(_0xe42e45>=_0x48c834){_0xe42e45=_0x48c834;_0x2f23c3=0xc8;}else{_0x2f23c3=0xce;}_0x393d9c[_0x161e('0x17')](_0x2f23c3);return _0x393d9c[_0x161e('0x1c')](_0x161e('0x1d'),_0x25f7c5+'-'+_0xe42e45+'/'+_0x48c834)[_0x161e('0x19')](_0x2e37fc);}return null;};}function patchUpdates(_0x33dd06){return function(_0x1637cd){try{jsonpatch[_0x161e('0x1e')](_0x1637cd,_0x33dd06,!![]);}catch(_0x2aa1d5){return BPromise[_0x161e('0x1f')](_0x2aa1d5);}return _0x1637cd['save']();};}function saveUpdates(_0x35b4a3,_0x205fa7){return function(_0x2b11d1){if(_0x2b11d1){return _0x2b11d1['update'](_0x35b4a3)[_0x161e('0x20')](function(_0x56a381){return _0x56a381;});}return null;};}function removeEntity(_0x5e8e5d,_0x2b31b6){return function(_0x8976c8){if(_0x8976c8){return _0x8976c8['destroy']()[_0x161e('0x20')](function(){_0x5e8e5d[_0x161e('0x17')](0xcc)[_0x161e('0x18')]();});}};}function handleEntityNotFound(_0x4595f0,_0x42816f){return function(_0x2ba259){if(!_0x2ba259){_0x4595f0[_0x161e('0x21')](0x194);}return _0x2ba259;};}function handleError(_0x3acb57,_0x36c8ce){_0x36c8ce=_0x36c8ce||0x1f4;return function(_0xf0e016){logger[_0x161e('0x22')](_0xf0e016['stack']);if(_0xf0e016[_0x161e('0x23')]){delete _0xf0e016['name'];}_0x3acb57[_0x161e('0x17')](_0x36c8ce)[_0x161e('0x24')](_0xf0e016);};}exports[_0x161e('0x25')]=function(_0x4b500d,_0xee84bf){var _0x4e37c7={'raw':!![],'where':{'id':_0x4b500d['params']['id']}},_0x3220e2={};_0x3220e2[_0x161e('0x26')]=_['keys'](db[_0x161e('0x27')][_0x161e('0x28')]);_0x3220e2[_0x161e('0x29')]=_[_0x161e('0x2a')](_0x4b500d[_0x161e('0x29')]);_0x3220e2[_0x161e('0x2b')]=_['intersection'](_0x3220e2['model'],_0x3220e2[_0x161e('0x29')]);_0x4e37c7[_0x161e('0x2c')]=_['intersection'](_0x3220e2[_0x161e('0x26')],qs[_0x161e('0x2d')](_0x4b500d['query'][_0x161e('0x2d')]));_0x4e37c7[_0x161e('0x2c')]=_0x4e37c7[_0x161e('0x2c')][_0x161e('0x2e')]?_0x4e37c7[_0x161e('0x2c')]:_0x3220e2[_0x161e('0x26')];if(_0x4b500d[_0x161e('0x29')][_0x161e('0x2f')]){_0x4e37c7[_0x161e('0x30')]=[{'all':!![]}];}_0x4e37c7=_['merge']({},_0x4e37c7,_0x4b500d[_0x161e('0x31')]);return db['MailApplication'][_0x161e('0x32')](_0x4e37c7)['then'](handleEntityNotFound(_0xee84bf,null))[_0x161e('0x20')](respondWithResult(_0xee84bf,null))['catch'](handleError(_0xee84bf,null));};exports[_0x161e('0x33')]=function(_0xfcf8dc,_0x2e59db){if(_0xfcf8dc[_0x161e('0x34')]['id']){delete _0xfcf8dc[_0x161e('0x34')]['id'];}return db['MailApplication'][_0x161e('0x32')]({'where':{'id':_0xfcf8dc[_0x161e('0x35')]['id']}})[_0x161e('0x20')](handleEntityNotFound(_0x2e59db,null))[_0x161e('0x20')](saveUpdates(_0xfcf8dc[_0x161e('0x34')],null))[_0x161e('0x20')](respondWithResult(_0x2e59db,null))['catch'](handleError(_0x2e59db,null));};exports[_0x161e('0x36')]=function(_0x25cee2,_0x1867bc){return db[_0x161e('0x27')][_0x161e('0x32')]({'where':{'id':_0x25cee2[_0x161e('0x35')]['id']}})[_0x161e('0x20')](handleEntityNotFound(_0x1867bc,null))[_0x161e('0x20')](removeEntity(_0x1867bc,null))[_0x161e('0x37')](handleError(_0x1867bc,null));}; \ No newline at end of file +var _0xae53=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','include','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xae53,0x16e));var _0x3ae5=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xae53[_0x45d3f0];return _0x314b79;};'use strict';var pdf=require(_0x3ae5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ae5('0x1'));var zipdir=require(_0x3ae5('0x2'));var jsonpatch=require(_0x3ae5('0x3'));var rp=require('request-promise');var moment=require(_0x3ae5('0x4'));var BPromise=require(_0x3ae5('0x5'));var Mustache=require(_0x3ae5('0x6'));var util=require(_0x3ae5('0x7'));var path=require(_0x3ae5('0x8'));var sox=require('sox');var csv=require(_0x3ae5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ae5('0xa'));var squel=require(_0x3ae5('0xb'));var crypto=require(_0x3ae5('0xc'));var jsforce=require(_0x3ae5('0xd'));var deskjs=require(_0x3ae5('0xe'));var toCsv=require(_0x3ae5('0x9'));var querystring=require(_0x3ae5('0xf'));var Papa=require(_0x3ae5('0x10'));var Redis=require('ioredis');var authService=require(_0x3ae5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ae5('0x12'));var hardwareService=require(_0x3ae5('0x13'));var logger=require(_0x3ae5('0x14'))(_0x3ae5('0x15'));var utils=require(_0x3ae5('0x16'));var config=require('../../config/environment');var db=require(_0x3ae5('0x17'))['db'];function respondWithStatusCode(_0x2000ac,_0x426238){_0x426238=_0x426238||0xcc;return function(_0x562556){if(_0x562556){return _0x2000ac['sendStatus'](_0x426238);}return _0x2000ac[_0x3ae5('0x18')](_0x426238)['end']();};}function respondWithResult(_0x8627d8,_0x28c265){_0x28c265=_0x28c265||0xc8;return function(_0x3b9122){if(_0x3b9122){return _0x8627d8[_0x3ae5('0x18')](_0x28c265)[_0x3ae5('0x19')](_0x3b9122);}};}function respondWithFilteredResult(_0x5d2564,_0x216c62){return function(_0x2a32a3){if(_0x2a32a3){var _0xae4ddd=_0x2a32a3[_0x3ae5('0x1a')],_0x52d14d=_0x216c62[_0x3ae5('0x1b')],_0x521a29=_0x216c62[_0x3ae5('0x1b')]+_0x216c62[_0x3ae5('0x1c')],_0x47608d;if(_0x521a29>=_0xae4ddd){_0x521a29=_0xae4ddd;_0x47608d=0xc8;}else{_0x47608d=0xce;}_0x5d2564[_0x3ae5('0x18')](_0x47608d);return _0x5d2564[_0x3ae5('0x1d')]('Content-Range',_0x52d14d+'-'+_0x521a29+'/'+_0xae4ddd)['json'](_0x2a32a3);}return null;};}function patchUpdates(_0x4a19e6){return function(_0x150ff1){try{jsonpatch[_0x3ae5('0x1e')](_0x150ff1,_0x4a19e6,!![]);}catch(_0x13266b){return BPromise[_0x3ae5('0x1f')](_0x13266b);}return _0x150ff1[_0x3ae5('0x20')]();};}function saveUpdates(_0x211dff,_0x1ae5e1){return function(_0x533971){if(_0x533971){return _0x533971[_0x3ae5('0x21')](_0x211dff)[_0x3ae5('0x22')](function(_0x34b02d){return _0x34b02d;});}return null;};}function removeEntity(_0x38d401,_0x36f089){return function(_0x22cf05){if(_0x22cf05){return _0x22cf05['destroy']()['then'](function(){_0x38d401[_0x3ae5('0x18')](0xcc)[_0x3ae5('0x23')]();});}};}function handleEntityNotFound(_0x32da8c,_0x2242cc){return function(_0x31a8bf){if(!_0x31a8bf){_0x32da8c[_0x3ae5('0x24')](0x194);}return _0x31a8bf;};}function handleError(_0x58f50d,_0x9bffa3){_0x9bffa3=_0x9bffa3||0x1f4;return function(_0x4a17d8){logger['error'](_0x4a17d8[_0x3ae5('0x25')]);if(_0x4a17d8[_0x3ae5('0x26')]){delete _0x4a17d8[_0x3ae5('0x26')];}_0x58f50d['status'](_0x9bffa3)[_0x3ae5('0x27')](_0x4a17d8);};}exports[_0x3ae5('0x28')]=function(_0x368159,_0x2ba130){var _0x24c2b2={'raw':!![],'where':{'id':_0x368159[_0x3ae5('0x29')]['id']}},_0x5dc6a1={};_0x5dc6a1[_0x3ae5('0x2a')]=_[_0x3ae5('0x2b')](db[_0x3ae5('0x2c')][_0x3ae5('0x2d')]);_0x5dc6a1[_0x3ae5('0x2e')]=_[_0x3ae5('0x2b')](_0x368159['query']);_0x5dc6a1[_0x3ae5('0x2f')]=_[_0x3ae5('0x30')](_0x5dc6a1[_0x3ae5('0x2a')],_0x5dc6a1['query']);_0x24c2b2[_0x3ae5('0x31')]=_[_0x3ae5('0x30')](_0x5dc6a1[_0x3ae5('0x2a')],qs[_0x3ae5('0x32')](_0x368159[_0x3ae5('0x2e')][_0x3ae5('0x32')]));_0x24c2b2[_0x3ae5('0x31')]=_0x24c2b2[_0x3ae5('0x31')]['length']?_0x24c2b2[_0x3ae5('0x31')]:_0x5dc6a1[_0x3ae5('0x2a')];if(_0x368159[_0x3ae5('0x2e')]['includeAll']){_0x24c2b2[_0x3ae5('0x33')]=[{'all':!![]}];}_0x24c2b2=_['merge']({},_0x24c2b2,_0x368159['options']);return db['MailApplication'][_0x3ae5('0x34')](_0x24c2b2)[_0x3ae5('0x22')](handleEntityNotFound(_0x2ba130,null))[_0x3ae5('0x22')](respondWithResult(_0x2ba130,null))[_0x3ae5('0x35')](handleError(_0x2ba130,null));};exports['update']=function(_0x5cd937,_0x3de961){if(_0x5cd937['body']['id']){delete _0x5cd937[_0x3ae5('0x36')]['id'];}return db[_0x3ae5('0x2c')][_0x3ae5('0x34')]({'where':{'id':_0x5cd937['params']['id']}})[_0x3ae5('0x22')](handleEntityNotFound(_0x3de961,null))[_0x3ae5('0x22')](saveUpdates(_0x5cd937['body'],null))['then'](respondWithResult(_0x3de961,null))[_0x3ae5('0x35')](handleError(_0x3de961,null));};exports['destroy']=function(_0x424743,_0x457e8d){return db[_0x3ae5('0x2c')][_0x3ae5('0x34')]({'where':{'id':_0x424743[_0x3ae5('0x29')]['id']}})[_0x3ae5('0x22')](handleEntityNotFound(_0x457e8d,null))[_0x3ae5('0x22')](removeEntity(_0x457e8d,null))[_0x3ae5('0x35')](handleError(_0x457e8d,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 939f933..0a7e560 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 _0xa024=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xa024,0xba));var _0x4a02=function(_0x492547,_0x11da89){_0x492547=_0x492547-0x0;var _0x444c65=_0xa024[_0x492547];return _0x444c65;};'use strict';var _=require(_0x4a02('0x0'));var util=require(_0x4a02('0x1'));var logger=require(_0x4a02('0x2'))(_0x4a02('0x3'));var moment=require(_0x4a02('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a02('0x5'));var fs=require('fs');var path=require(_0x4a02('0x6'));var rimraf=require(_0x4a02('0x7'));var config=require(_0x4a02('0x8'));var attributes=require(_0x4a02('0x9'));module[_0x4a02('0xa')]=function(_0x2a242d,_0x10ef0b){return _0x2a242d[_0x4a02('0xb')](_0x4a02('0xc'),attributes,{'tableName':_0x4a02('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a02('0xe'),'collate':_0x4a02('0xf')});}; \ No newline at end of file +var _0x59b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5d60de,_0x4d0921){var _0x3bdc84=function(_0x1da18d){while(--_0x1da18d){_0x5d60de['push'](_0x5d60de['shift']());}};_0x3bdc84(++_0x4d0921);}(_0x59b1,0x1cb));var _0x159b=function(_0x107b58,_0x38c2f7){_0x107b58=_0x107b58-0x0;var _0x18e990=_0x59b1[_0x107b58];return _0x18e990;};'use strict';var _=require(_0x159b('0x0'));var util=require(_0x159b('0x1'));var logger=require(_0x159b('0x2'))(_0x159b('0x3'));var moment=require(_0x159b('0x4'));var BPromise=require(_0x159b('0x5'));var rp=require(_0x159b('0x6'));var fs=require('fs');var path=require(_0x159b('0x7'));var rimraf=require(_0x159b('0x8'));var config=require(_0x159b('0x9'));var attributes=require(_0x159b('0xa'));module[_0x159b('0xb')]=function(_0x115bdc,_0x2bd465){return _0x115bdc[_0x159b('0xc')](_0x159b('0xd'),attributes,{'tableName':_0x159b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x159b('0xf'),'collate':_0x159b('0x10')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8d28805..cdb9656 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 _0x6f6e=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','lodash','moment'];(function(_0x3e256e,_0x117678){var _0x440eef=function(_0xef2f0a){while(--_0xef2f0a){_0x3e256e['push'](_0x3e256e['shift']());}};_0x440eef(++_0x117678);}(_0x6f6e,0xee));var _0xe6f6=function(_0x161c0b,_0x22a73f){_0x161c0b=_0x161c0b-0x0;var _0x29bcab=_0x6f6e[_0x161c0b];return _0x29bcab;};'use strict';var _=require(_0xe6f6('0x0'));var util=require('util');var moment=require(_0xe6f6('0x1'));var BPromise=require(_0xe6f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6f6('0x3'))['db'];var utils=require(_0xe6f6('0x4'));var logger=require(_0xe6f6('0x5'))(_0xe6f6('0x6'));var config=require(_0xe6f6('0x7'));var jayson=require(_0xe6f6('0x8'));var client=jayson['client'][_0xe6f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x448817,_0x2fde83,_0x36a758){return new BPromise(function(_0x418ba4,_0x1bef0f){return client[_0xe6f6('0xa')](_0x448817,_0x36a758)[_0xe6f6('0xb')](function(_0x2a37a3){logger[_0xe6f6('0xc')](_0xe6f6('0xd'),_0x2fde83,_0xe6f6('0xe'));logger[_0xe6f6('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2fde83,_0xe6f6('0xe'),JSON[_0xe6f6('0x10')](_0x2a37a3));if(_0x2a37a3[_0xe6f6('0x11')]){if(_0x2a37a3[_0xe6f6('0x11')][_0xe6f6('0x12')]===0x1f4){logger['error'](_0xe6f6('0xd'),_0x2fde83,_0x2a37a3[_0xe6f6('0x11')][_0xe6f6('0x13')]);return _0x1bef0f(_0x2a37a3[_0xe6f6('0x11')][_0xe6f6('0x13')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x2fde83,_0x2a37a3[_0xe6f6('0x11')]['message']);return _0x418ba4(_0x2a37a3['error'][_0xe6f6('0x13')]);}else{logger[_0xe6f6('0xc')](_0xe6f6('0xd'),_0x2fde83,_0xe6f6('0xe'));_0x418ba4(_0x2a37a3[_0xe6f6('0x14')][_0xe6f6('0x13')]);}})[_0xe6f6('0x15')](function(_0x1e31e6){logger[_0xe6f6('0x11')]('MailApplication,\x20%s,\x20%s',_0x2fde83,_0x1e31e6);_0x1bef0f(_0x1e31e6);});});}exports[_0xe6f6('0x16')]=function(_0x53f132){var _0x50e758=this;return new Promise(function(_0x3275f2,_0x3bfa9c){return db['MailApplication'][_0xe6f6('0x17')](_0x53f132[_0xe6f6('0x18')],{'raw':_0x53f132[_0xe6f6('0x19')]?_0x53f132[_0xe6f6('0x19')][_0xe6f6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f132['options']?_0x53f132[_0xe6f6('0x19')][_0xe6f6('0x1b')]||null:null,'attributes':_0x53f132[_0xe6f6('0x19')]?_0x53f132[_0xe6f6('0x19')][_0xe6f6('0x1c')]||null:null,'limit':_0x53f132[_0xe6f6('0x19')]?_0x53f132['options'][_0xe6f6('0x1d')]||null:null})['then'](function(_0x430fa6){logger[_0xe6f6('0xc')](_0xe6f6('0x16'),_0x53f132);logger[_0xe6f6('0xf')](_0xe6f6('0x16'),_0x53f132,JSON[_0xe6f6('0x10')](_0x430fa6));_0x3275f2(_0x430fa6);})[_0xe6f6('0x15')](function(_0x546810){logger[_0xe6f6('0x11')]('UpdateMailApplication',_0x546810[_0xe6f6('0x13')],_0x53f132);_0x3bfa9c(_0x50e758[_0xe6f6('0x11')](0x1f4,_0x546810[_0xe6f6('0x13')]));});});}; \ No newline at end of file +var _0x29f8=['client','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x25ad16,_0x3a8f1c){var _0x5fe72d=function(_0x428858){while(--_0x428858){_0x25ad16['push'](_0x25ad16['shift']());}};_0x5fe72d(++_0x3a8f1c);}(_0x29f8,0x196));var _0x829f=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x29f8[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x829f('0x0'));var BPromise=require(_0x829f('0x1'));var rs=require(_0x829f('0x2'));var fs=require('fs');var Redis=require(_0x829f('0x3'));var db=require(_0x829f('0x4'))['db'];var utils=require(_0x829f('0x5'));var logger=require(_0x829f('0x6'))(_0x829f('0x7'));var config=require(_0x829f('0x8'));var jayson=require(_0x829f('0x9'));var client=jayson[_0x829f('0xa')][_0x829f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1737c3,_0x125123,_0x8f4b2b){return new BPromise(function(_0x48fafc,_0x387e5a){return client[_0x829f('0xc')](_0x1737c3,_0x8f4b2b)[_0x829f('0xd')](function(_0x1b5ac2){logger['info'](_0x829f('0xe'),_0x125123,'request\x20sent');logger[_0x829f('0xf')](_0x829f('0x10'),_0x125123,_0x829f('0x11'),JSON[_0x829f('0x12')](_0x1b5ac2));if(_0x1b5ac2['error']){if(_0x1b5ac2['error']['code']===0x1f4){logger[_0x829f('0x13')]('MailApplication,\x20%s,\x20%s',_0x125123,_0x1b5ac2[_0x829f('0x13')]['message']);return _0x387e5a(_0x1b5ac2[_0x829f('0x13')][_0x829f('0x14')]);}logger['error'](_0x829f('0xe'),_0x125123,_0x1b5ac2[_0x829f('0x13')][_0x829f('0x14')]);return _0x48fafc(_0x1b5ac2['error'][_0x829f('0x14')]);}else{logger[_0x829f('0x15')](_0x829f('0xe'),_0x125123,'request\x20sent');_0x48fafc(_0x1b5ac2[_0x829f('0x16')]['message']);}})[_0x829f('0x17')](function(_0xf27126){logger[_0x829f('0x13')](_0x829f('0xe'),_0x125123,_0xf27126);_0x387e5a(_0xf27126);});});}exports[_0x829f('0x18')]=function(_0x3fbefb){var _0x13d219=this;return new Promise(function(_0x5ef74d,_0x5e1cd6){return db[_0x829f('0x19')]['update'](_0x3fbefb[_0x829f('0x1a')],{'raw':_0x3fbefb[_0x829f('0x1b')]?_0x3fbefb[_0x829f('0x1b')][_0x829f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fbefb[_0x829f('0x1b')]?_0x3fbefb[_0x829f('0x1b')][_0x829f('0x1d')]||null:null,'attributes':_0x3fbefb[_0x829f('0x1b')]?_0x3fbefb[_0x829f('0x1b')][_0x829f('0x1e')]||null:null,'limit':_0x3fbefb[_0x829f('0x1b')]?_0x3fbefb[_0x829f('0x1b')][_0x829f('0x1f')]||null:null})[_0x829f('0xd')](function(_0x2529ee){logger[_0x829f('0x15')]('UpdateMailApplication',_0x3fbefb);logger[_0x829f('0xf')](_0x829f('0x18'),_0x3fbefb,JSON[_0x829f('0x12')](_0x2529ee));_0x5ef74d(_0x2529ee);})[_0x829f('0x17')](function(_0xfa252e){logger[_0x829f('0x13')](_0x829f('0x18'),_0xfa252e['message'],_0x3fbefb);_0x5e1cd6(_0x13d219[_0x829f('0x13')](0x1f4,_0xfa252e[_0x829f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3136d59..c1447ab 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 _0xd056=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','post','create','addMessage','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x334f64,_0x1e0b74){var _0x2de374=function(_0x4b9c28){while(--_0x4b9c28){_0x334f64['push'](_0x334f64['shift']());}};_0x2de374(++_0x1e0b74);}(_0xd056,0x13f));var _0x6d05=function(_0x2ba5c8,_0x11691b){_0x2ba5c8=_0x2ba5c8-0x0;var _0x556c72=_0xd056[_0x2ba5c8];return _0x556c72;};'use strict';var multer=require(_0x6d05('0x0'));var util=require(_0x6d05('0x1'));var path=require('path');var timeout=require(_0x6d05('0x2'));var express=require(_0x6d05('0x3'));var router=express[_0x6d05('0x4')]();var auth=require(_0x6d05('0x5'));var interaction=require(_0x6d05('0x6'));var config=require(_0x6d05('0x7'));var controller=require(_0x6d05('0x8'));router[_0x6d05('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d05('0xa')]);router[_0x6d05('0x9')](_0x6d05('0xb'),auth['isAuthenticated'](),controller[_0x6d05('0xc')]);router[_0x6d05('0x9')](_0x6d05('0xd'),auth[_0x6d05('0xe')](),controller['show']);router[_0x6d05('0x9')](_0x6d05('0xf'),auth['isAuthenticated'](),controller[_0x6d05('0x10')]);router[_0x6d05('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x6d05('0x11')]('/',auth[_0x6d05('0xe')](),controller[_0x6d05('0x12')]);router[_0x6d05('0x11')](_0x6d05('0xf'),auth[_0x6d05('0xe')](),controller[_0x6d05('0x13')]);router[_0x6d05('0x11')]('/:id/tags',auth[_0x6d05('0xe')](),interaction['tracked'](_0x6d05('0x14'),_0x6d05('0x15')),controller[_0x6d05('0x16')]);router[_0x6d05('0x17')](_0x6d05('0xd'),auth[_0x6d05('0xe')](),interaction[_0x6d05('0x18')]('mail',_0x6d05('0x19')),controller[_0x6d05('0x1a')]);router[_0x6d05('0x1b')](_0x6d05('0xd'),auth[_0x6d05('0xe')](),interaction[_0x6d05('0x18')](_0x6d05('0x14'),_0x6d05('0x1c')),controller[_0x6d05('0x1d')]);router[_0x6d05('0x1b')]('/:id/tags',auth[_0x6d05('0xe')](),controller[_0x6d05('0x1e')]);module[_0x6d05('0x1f')]=router; \ No newline at end of file +var _0xd43e=['addTags','update','mailinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','mail'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xd43e,0x88));var _0xed43=function(_0x366e52,_0x258810){_0x366e52=_0x366e52-0x0;var _0x2e285f=_0xd43e[_0x366e52];return _0x2e285f;};'use strict';var multer=require(_0xed43('0x0'));var util=require('util');var path=require(_0xed43('0x1'));var timeout=require(_0xed43('0x2'));var express=require(_0xed43('0x3'));var router=express[_0xed43('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed43('0x5'));var controller=require(_0xed43('0x6'));router[_0xed43('0x7')]('/',auth[_0xed43('0x8')](),controller['index']);router[_0xed43('0x7')](_0xed43('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xed43('0xa'),auth[_0xed43('0x8')](),controller[_0xed43('0xb')]);router[_0xed43('0x7')](_0xed43('0xc'),auth['isAuthenticated'](),controller[_0xed43('0xd')]);router[_0xed43('0x7')]('/:id/download',auth[_0xed43('0x8')](),controller[_0xed43('0xe')]);router[_0xed43('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xed43('0xf')](_0xed43('0xc'),auth['isAuthenticated'](),controller[_0xed43('0x10')]);router[_0xed43('0xf')](_0xed43('0x11'),auth[_0xed43('0x8')](),interaction[_0xed43('0x12')](_0xed43('0x13'),'mailinteraction:addtags'),controller[_0xed43('0x14')]);router['put'](_0xed43('0xa'),auth['isAuthenticated'](),interaction[_0xed43('0x12')]('mail','mailinteraction:update'),controller[_0xed43('0x15')]);router['delete'](_0xed43('0xa'),auth[_0xed43('0x8')](),interaction[_0xed43('0x12')]('mail',_0xed43('0x16')),controller[_0xed43('0x17')]);router['delete']('/:id/tags',auth[_0xed43('0x8')](),controller[_0xed43('0x18')]);module[_0xed43('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 783f6a6..1d549e4 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 _0xa5ef=['BOOLEAN','ENUM','out','sequelize','DATE','STRING','TEXT','long'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa5ef,0xeb));var _0xfa5e=function(_0x56ed51,_0x5acddc){_0x56ed51=_0x56ed51-0x0;var _0x521784=_0xa5ef[_0x56ed51];return _0x521784;};'use strict';var Sequelize=require(_0xfa5e('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfa5e('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xfa5e('0x2')](0x1fe)},'to':{'type':Sequelize[_0xfa5e('0x2')]},'cc':{'type':Sequelize[_0xfa5e('0x3')](_0xfa5e('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xfa5e('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfa5e('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xfa5e('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xfa5e('0x6')]('in',_0xfa5e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfa5e('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xfa5e('0x6')]('in',_0xfa5e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xfa5e('0x4'))},'lastMsgText':{'type':Sequelize[_0xfa5e('0x3')]('long')}}; \ No newline at end of file +var _0xc6d1=['STRING','TEXT','ENUM','out','long','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x5462c8,_0x26fd80){var _0x131eb7=function(_0x1ae407){while(--_0x1ae407){_0x5462c8['push'](_0x5462c8['shift']());}};_0x131eb7(++_0x26fd80);}(_0xc6d1,0x1db));var _0x1c6d=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc6d1[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x1c6d('0x0'));var iconv=require(_0x1c6d('0x1'));module[_0x1c6d('0x2')]={'closed':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1c6d('0x4')]},'disposition':{'type':Sequelize[_0x1c6d('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1c6d('0x5')](0x1fe)},'to':{'type':Sequelize[_0x1c6d('0x5')]},'cc':{'type':Sequelize[_0x1c6d('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1c6d('0x4')]},'substatus':{'type':Sequelize[_0x1c6d('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1c6d('0x7')]('in',_0x1c6d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1c6d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1c6d('0x7')]('in',_0x1c6d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x1c6d('0x9'))},'lastMsgText':{'type':Sequelize[_0x1c6d('0x6')](_0x1c6d('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3b55377..adcc0d1 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(_0x469198,_0x278e37){var _0x385543=function(_0x5c46bd){while(--_0x5c46bd){_0x469198['push'](_0x469198['shift']());}};_0x385543(++_0x278e37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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(_0xd62415,_0x390415){var _0x41ea45=function(_0x10499c){while(--_0x10499c){_0xd62415['push'](_0xd62415['shift']());}};_0x41ea45(++_0x390415);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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 de71894..e113333 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 _0x33f2=['update','remove','getUsers','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x3ea8a3,_0x292689){var _0x20c946=function(_0x4cab2a){while(--_0x4cab2a){_0x3ea8a3['push'](_0x3ea8a3['shift']());}};_0x20c946(++_0x292689);}(_0x33f2,0x9d));var _0x233f=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x33f2[_0x5de214];return _0x4df627;};'use strict';var EventEmitter=require(_0x233f('0x0'));var MailInteraction=require(_0x233f('0x1'))['db'][_0x233f('0x2')];var MailMessage=require(_0x233f('0x1'))['db'][_0x233f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x233f('0x4'),'afterUpdate':_0x233f('0x5'),'afterDestroy':_0x233f('0x6')};function emitEvent(_0x2f38ac){return function(_0x3cbfd0,_0x178f06,_0x342d7c){_0x3cbfd0[_0x233f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x257693){_0x3cbfd0[_0x233f('0x8')](_0x233f('0x9'),_0x257693[_0x233f('0xa')](function(_0x3404f3){return{'id':_0x3404f3['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3cbfd0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x233f('0xb')](function(_0x540f64){_0x3cbfd0[_0x233f('0x8')]('unreadMessages',_0x540f64[_0x233f('0xc')]);MailInteractionEvents[_0x233f('0xd')](_0x2f38ac+':'+_0x3cbfd0['id'],_0x3cbfd0);MailInteractionEvents[_0x233f('0xd')](_0x2f38ac,_0x3cbfd0);_0x342d7c(null);})[_0x233f('0xe')](_0x342d7c(null));};}for(var e in events){if(events[_0x233f('0xf')](e)){var event=events[e];MailInteraction[_0x233f('0x10')](e,emitEvent(event));}}module[_0x233f('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xd817=['Users','findAll','setDataValue','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','then'];(function(_0x122dc0,_0x22beab){var _0x225c58=function(_0x1cfb6f){while(--_0x1cfb6f){_0x122dc0['push'](_0x122dc0['shift']());}};_0x225c58(++_0x22beab);}(_0xd817,0x106));var _0x7d81=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0xd817[_0x473b41];return _0x4e521d;};'use strict';var EventEmitter=require(_0x7d81('0x0'));var MailInteraction=require(_0x7d81('0x1'))['db'][_0x7d81('0x2')];var MailMessage=require(_0x7d81('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7d81('0x3')](0x0);var events={'afterCreate':_0x7d81('0x4'),'afterUpdate':_0x7d81('0x5'),'afterDestroy':'remove'};function emitEvent(_0x49675a){return function(_0x2bd608,_0x43d266,_0x3f244a){_0x2bd608[_0x7d81('0x6')]({'attributes':['id'],'raw':!![]})[_0x7d81('0x7')](function(_0x210f9f){_0x2bd608['setDataValue'](_0x7d81('0x8'),_0x210f9f['map'](function(_0x2ed568){return{'id':_0x2ed568['id']};}));return MailMessage[_0x7d81('0x9')]({'where':{'MailInteractionId':_0x2bd608['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x49b4b1){_0x2bd608[_0x7d81('0xa')]('unreadMessages',_0x49b4b1['length']);MailInteractionEvents[_0x7d81('0xb')](_0x49675a+':'+_0x2bd608['id'],_0x2bd608);MailInteractionEvents[_0x7d81('0xb')](_0x49675a,_0x2bd608);_0x3f244a(null);})[_0x7d81('0xc')](_0x3f244a(null));};}for(var e in events){if(events[_0x7d81('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x7d81('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 27b26f8..9ccabc5 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(_0x563b67,_0x535203){var _0x341392=function(_0x5757fd){while(--_0x5757fd){_0x563b67['push'](_0x563b67['shift']());}};_0x341392(++_0x535203);}(_0x34e8,0x12c));var _0x834e=function(_0x3957af,_0x2c57b3){_0x3957af=_0x3957af-0x0;var _0x50a0ea=_0x34e8[_0x3957af];return _0x50a0ea;};'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 _0x9c44=['MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','get','update','then','catch','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','./mailInteraction.attributes','define'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x49c4('0xa'),'to'],'type':_0x49c4('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d13fb,_0x4487ca,_0x4c7d3a){if(_0x1d13fb['substatus']){_0x1d13fb[_0x49c4('0xc')]=moment()[_0x49c4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1d13fb[_0x49c4('0xe')]){_0x1d13fb[_0x49c4('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c7d3a(null,_0x4487ca);},'beforeUpdate':function(_0x1d19bf,_0x6d1b08,_0x5487cd){if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0x11'))){_0x1d19bf['substatusAt']=_0x1d19bf[_0x49c4('0x11')]?moment()[_0x49c4('0xd')](_0x49c4('0x12')):null;}if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0xe'))){_0x1d19bf[_0x49c4('0xf')]=moment()[_0x49c4('0xd')](_0x49c4('0x12'));_0x1d19bf['substatus']=null;_0x1d19bf[_0x49c4('0xc')]=null;}_0x5487cd(null,_0x1d19bf);},'afterUpdate':function(_0x141003,_0x13a2db,_0x81e831){var _0x2abc78=_0xc1278f['models'];var _0x44e607=_0x141003[_0x49c4('0x13')]({'plain':!![]});if(_0x44e607['closed']){return _0x2abc78['MailMessage'][_0x49c4('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x44e607['id']}})[_0x49c4('0x15')](function(){_0x81e831();})[_0x49c4('0x16')](function(_0x59f29b){_0x81e831(_0x59f29b);});}else{_0x81e831();}}},'charset':_0x49c4('0x17'),'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 182923c..26f134f 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 _0x3b75=['catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3fd803,_0x54b635){var _0x349302=function(_0x1d2974){while(--_0x1d2974){_0x3fd803['push'](_0x3fd803['shift']());}};_0x349302(++_0x54b635);}(_0x3b75,0xdc));var _0x53b7=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x3b75[_0x49c653];return _0x31e169;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var moment=require(_0x53b7('0x2'));var BPromise=require(_0x53b7('0x3'));var rs=require(_0x53b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53b7('0x6'))('rpc');var config=require(_0x53b7('0x7'));var jayson=require(_0x53b7('0x8'));var client=jayson[_0x53b7('0x9')][_0x53b7('0xa')]({'port':0x232a});config[_0x53b7('0xb')]=_['defaults'](config[_0x53b7('0xb')],{'host':_0x53b7('0xc'),'port':0x18eb});var socket=require(_0x53b7('0xd'))(new Redis(config['redis']));require(_0x53b7('0xe'))['register'](socket);function respondWithRpcPromise(_0x3a107a,_0x3b358e,_0x2fa631){return new BPromise(function(_0x3dae32,_0x39d51b){return client['request'](_0x3a107a,_0x2fa631)[_0x53b7('0xf')](function(_0x340aba){logger[_0x53b7('0x10')](_0x53b7('0x11'),_0x3b358e,_0x53b7('0x12'));logger[_0x53b7('0x13')](_0x53b7('0x14'),_0x3b358e,_0x53b7('0x12'),JSON[_0x53b7('0x15')](_0x340aba));if(_0x340aba['error']){if(_0x340aba[_0x53b7('0x16')][_0x53b7('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3b358e,_0x340aba['error'][_0x53b7('0x18')]);return _0x39d51b(_0x340aba[_0x53b7('0x16')][_0x53b7('0x18')]);}logger['error'](_0x53b7('0x11'),_0x3b358e,_0x340aba[_0x53b7('0x16')][_0x53b7('0x18')]);return _0x3dae32(_0x340aba[_0x53b7('0x16')][_0x53b7('0x18')]);}else{logger[_0x53b7('0x10')]('MailInteraction,\x20%s,\x20%s',_0x3b358e,'request\x20sent');_0x3dae32(_0x340aba[_0x53b7('0x19')][_0x53b7('0x18')]);}})[_0x53b7('0x1a')](function(_0x1c5817){logger[_0x53b7('0x16')](_0x53b7('0x11'),_0x3b358e,_0x1c5817);_0x39d51b(_0x1c5817);});});}exports[_0x53b7('0x1b')]=function(_0x13c90a){var _0x15852e=this;return new Promise(function(_0x5c346a,_0x3b8187){return db[_0x53b7('0x1c')][_0x53b7('0x1d')](_0x13c90a[_0x53b7('0x1e')],{'raw':_0x13c90a[_0x53b7('0x1f')]?_0x13c90a[_0x53b7('0x1f')][_0x53b7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13c90a[_0x53b7('0x1f')]?_0x13c90a[_0x53b7('0x1f')][_0x53b7('0x21')]||null:null,'attributes':_0x13c90a[_0x53b7('0x1f')]?_0x13c90a[_0x53b7('0x1f')]['attributes']||null:null,'limit':_0x13c90a[_0x53b7('0x1f')]?_0x13c90a['options'][_0x53b7('0x22')]||null:null})[_0x53b7('0xf')](function(_0x51ff47){logger['info'](_0x53b7('0x1b'),_0x13c90a);logger[_0x53b7('0x13')](_0x53b7('0x1b'),_0x13c90a,JSON[_0x53b7('0x15')](_0x51ff47));_0x5c346a(_0x51ff47);})['catch'](function(_0x2f0319){logger[_0x53b7('0x16')](_0x53b7('0x1b'),_0x2f0319[_0x53b7('0x18')],_0x13c90a);_0x3b8187(_0x15852e[_0x53b7('0x16')](0x1f4,_0x2f0319[_0x53b7('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x13ff22){return new Promise(function(_0x3c27ab,_0x319bd3){return db[_0x53b7('0x1c')][_0x53b7('0x23')]({'where':_0x13ff22[_0x53b7('0x1f')]?_0x13ff22[_0x53b7('0x1f')][_0x53b7('0x21')]||null:null})[_0x53b7('0xf')](function(_0x2054b5){if(_0x2054b5){return _0x2054b5[_0x53b7('0x24')](_0x13ff22[_0x53b7('0x1e')][_0x53b7('0x25')],_[_0x53b7('0x26')](_0x13ff22['body'],[_0x53b7('0x25'),'id'])||{});}})[_0x53b7('0x27')](function(_0x5460ed){logger[_0x53b7('0x10')](_0x53b7('0x28'),_0x13ff22);logger[_0x53b7('0x13')](_0x53b7('0x28'),_0x13ff22,JSON[_0x53b7('0x15')](_0x5460ed));_0x3c27ab(_0x5460ed);})['catch'](function(_0x78ba3d){logger[_0x53b7('0x16')](_0x53b7('0x28'),_0x78ba3d[_0x53b7('0x18')],_0x13ff22);_0x319bd3(_this[_0x53b7('0x16')](0x1f4,_0x78ba3d['message']));});});}; \ No newline at end of file +var _0x19c3=['client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc8e766,_0x2bd682){var _0x103677=function(_0x5a6667){while(--_0x5a6667){_0xc8e766['push'](_0xc8e766['shift']());}};_0x103677(++_0x2bd682);}(_0x19c3,0xf9));var _0x319c=function(_0x12ade3,_0x512bcf){_0x12ade3=_0x12ade3-0x0;var _0x5c4123=_0x19c3[_0x12ade3];return _0x5c4123;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var moment=require(_0x319c('0x1'));var BPromise=require(_0x319c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x319c('0x3'));var db=require(_0x319c('0x4'))['db'];var utils=require(_0x319c('0x5'));var logger=require(_0x319c('0x6'))(_0x319c('0x7'));var config=require(_0x319c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x319c('0x9')]['http']({'port':0x232a});config[_0x319c('0xa')]=_[_0x319c('0xb')](config[_0x319c('0xa')],{'host':_0x319c('0xc'),'port':0x18eb});var socket=require(_0x319c('0xd'))(new Redis(config['redis']));require(_0x319c('0xe'))[_0x319c('0xf')](socket);function respondWithRpcPromise(_0x3491c3,_0x462c4c,_0x475438){return new BPromise(function(_0x3cb3ff,_0x4911e3){return client[_0x319c('0x10')](_0x3491c3,_0x475438)['then'](function(_0x3aa327){logger[_0x319c('0x11')](_0x319c('0x12'),_0x462c4c,_0x319c('0x13'));logger[_0x319c('0x14')](_0x319c('0x15'),_0x462c4c,_0x319c('0x13'),JSON['stringify'](_0x3aa327));if(_0x3aa327['error']){if(_0x3aa327[_0x319c('0x16')][_0x319c('0x17')]===0x1f4){logger['error'](_0x319c('0x12'),_0x462c4c,_0x3aa327[_0x319c('0x16')][_0x319c('0x18')]);return _0x4911e3(_0x3aa327[_0x319c('0x16')][_0x319c('0x18')]);}logger[_0x319c('0x16')](_0x319c('0x12'),_0x462c4c,_0x3aa327['error']['message']);return _0x3cb3ff(_0x3aa327[_0x319c('0x16')][_0x319c('0x18')]);}else{logger['info'](_0x319c('0x12'),_0x462c4c,'request\x20sent');_0x3cb3ff(_0x3aa327[_0x319c('0x19')][_0x319c('0x18')]);}})[_0x319c('0x1a')](function(_0x347081){logger[_0x319c('0x16')](_0x319c('0x12'),_0x462c4c,_0x347081);_0x4911e3(_0x347081);});});}exports[_0x319c('0x1b')]=function(_0x4f96c8){var _0x2fb973=this;return new Promise(function(_0x32936f,_0x5bd273){return db['MailInteraction'][_0x319c('0x1c')](_0x4f96c8[_0x319c('0x1d')],{'raw':_0x4f96c8[_0x319c('0x1e')]?_0x4f96c8['options'][_0x319c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f96c8[_0x319c('0x1e')]?_0x4f96c8[_0x319c('0x1e')][_0x319c('0x20')]||null:null,'attributes':_0x4f96c8[_0x319c('0x1e')]?_0x4f96c8['options'][_0x319c('0x21')]||null:null,'limit':_0x4f96c8[_0x319c('0x1e')]?_0x4f96c8[_0x319c('0x1e')][_0x319c('0x22')]||null:null})[_0x319c('0x23')](function(_0x4a8ee8){logger[_0x319c('0x11')]('UpdateMailInteraction',_0x4f96c8);logger[_0x319c('0x14')](_0x319c('0x1b'),_0x4f96c8,JSON['stringify'](_0x4a8ee8));_0x32936f(_0x4a8ee8);})[_0x319c('0x1a')](function(_0x5d93b9){logger[_0x319c('0x16')](_0x319c('0x1b'),_0x5d93b9[_0x319c('0x18')],_0x4f96c8);_0x5bd273(_0x2fb973[_0x319c('0x16')](0x1f4,_0x5d93b9[_0x319c('0x18')]));});});};exports[_0x319c('0x24')]=function(_0x23ecdc){return new Promise(function(_0x259e80,_0x363362){return db[_0x319c('0x25')][_0x319c('0x26')]({'where':_0x23ecdc[_0x319c('0x1e')]?_0x23ecdc[_0x319c('0x1e')][_0x319c('0x20')]||null:null})[_0x319c('0x23')](function(_0x1990b4){if(_0x1990b4){return _0x1990b4[_0x319c('0x27')](_0x23ecdc[_0x319c('0x1d')][_0x319c('0x28')],_['omit'](_0x23ecdc[_0x319c('0x1d')],[_0x319c('0x28'),'id'])||{});}})[_0x319c('0x29')](function(_0x3fefeb){logger['info'](_0x319c('0x2a'),_0x23ecdc);logger[_0x319c('0x14')](_0x319c('0x2a'),_0x23ecdc,JSON['stringify'](_0x3fefeb));_0x259e80(_0x3fefeb);})[_0x319c('0x1a')](function(_0x4f2624){logger[_0x319c('0x16')]('AddTags',_0x4f2624[_0x319c('0x18')],_0x23ecdc);_0x363362(_this[_0x319c('0x16')](0x1f4,_0x4f2624[_0x319c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f8b2f16..8acf913 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 _0xd78d=['removeListener','mailInteraction:','./mailInteraction.events','remove','emit'];(function(_0x13ee10,_0xfb608a){var _0x30eeb9=function(_0xacf044){while(--_0xacf044){_0x13ee10['push'](_0x13ee10['shift']());}};_0x30eeb9(++_0xfb608a);}(_0xd78d,0xb6));var _0xdd78=function(_0x2a6cf8,_0x31f69c){_0x2a6cf8=_0x2a6cf8-0x0;var _0x2cd74f=_0xd78d[_0x2a6cf8];return _0x2cd74f;};'use strict';var MailInteractionEvents=require(_0xdd78('0x0'));var events=['save',_0xdd78('0x1'),'update'];function createListener(_0x1b0100,_0x1d5b57){return function(_0x493d8e){_0x1d5b57[_0xdd78('0x2')](_0x1b0100,_0x493d8e);};}function removeListener(_0x423a68,_0x7d099c){return function(){MailInteractionEvents[_0xdd78('0x3')](_0x423a68,_0x7d099c);};}exports['register']=function(_0x281e92){for(var _0xa2b363=0x0,_0x1cec25=events['length'];_0xa2b363<_0x1cec25;_0xa2b363++){var _0x1f5e4f=events[_0xa2b363];var _0x4ee4b0=createListener(_0xdd78('0x4')+_0x1f5e4f,_0x281e92);MailInteractionEvents['on'](_0x1f5e4f,_0x4ee4b0);}}; \ No newline at end of file +var _0x70ee=['register','mailInteraction:','./mailInteraction.events','save','emit','removeListener'];(function(_0x17a692,_0x3fd932){var _0x216441=function(_0x1cc46a){while(--_0x1cc46a){_0x17a692['push'](_0x17a692['shift']());}};_0x216441(++_0x3fd932);}(_0x70ee,0x188));var _0xe70e=function(_0x7bc4a8,_0x19022a){_0x7bc4a8=_0x7bc4a8-0x0;var _0x4a13e9=_0x70ee[_0x7bc4a8];return _0x4a13e9;};'use strict';var MailInteractionEvents=require(_0xe70e('0x0'));var events=[_0xe70e('0x1'),'remove','update'];function createListener(_0x5e93f6,_0x8b165c){return function(_0x5e34ef){_0x8b165c[_0xe70e('0x2')](_0x5e93f6,_0x5e34ef);};}function removeListener(_0x45b5ef,_0x2e639c){return function(){MailInteractionEvents[_0xe70e('0x3')](_0x45b5ef,_0x2e639c);};}exports[_0xe70e('0x4')]=function(_0x2b9468){for(var _0x1e6ee9=0x0,_0x2f326b=events['length'];_0x1e6ee9<_0x2f326b;_0x1e6ee9++){var _0x470b59=events[_0x1e6ee9];var _0x276121=createListener(_0xe70e('0x5')+_0x470b59,_0x2b9468);MailInteractionEvents['on'](_0x470b59,_0x276121);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1f534fe..7cc16e2 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 _0x9f62=['./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../config/environment'];(function(_0x5b36ac,_0x4767aa){var _0x512bc2=function(_0x312285){while(--_0x312285){_0x5b36ac['push'](_0x5b36ac['shift']());}};_0x512bc2(++_0x4767aa);}(_0x9f62,0x154));var _0x29f6=function(_0x5e9b23,_0x85b48f){_0x5e9b23=_0x5e9b23-0x0;var _0x16832b=_0x9f62[_0x5e9b23];return _0x16832b;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['download']);router['post']('/',auth[_0x29f6('0x7')](),interaction[_0x29f6('0xb')]('mail',_0x29f6('0xc')),controller[_0x29f6('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xf'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x10')]);router[_0x29f6('0xe')](_0x29f6('0x11'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x12')]);router[_0x29f6('0x13')](_0x29f6('0x14'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x15')]);module[_0x29f6('0x16')]=router; \ No newline at end of file +var _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x43924b,_0x20ceee){var _0x3dfff6=function(_0xaa7087){while(--_0xaa7087){_0x43924b['push'](_0x43924b['shift']());}};_0x3dfff6(++_0x20ceee);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x109098,_0x3ea6cc){_0x109098=_0x109098-0x0;var _0x1538be=_0x9c5a[_0x109098];return _0x1538be;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/download',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa9c5('0xe')](_0xa9c5('0xf'),_0xa9c5('0x10')),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x12')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x12')](_0xa9c5('0x14'),auth['isAuthenticated'](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x12')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x19')]);module[_0xa9c5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c94c084..9fcb871 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 _0xd7d5=['exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','sequelize','lodash'];(function(_0x53cc16,_0x1c0870){var _0x282f65=function(_0x279934){while(--_0x279934){_0x53cc16['push'](_0x53cc16['shift']());}};_0x282f65(++_0x1c0870);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x1df20c,_0x49a898){_0x1df20c=_0x1df20c-0x0;var _0x462c1e=_0xd7d5[_0x1df20c];return _0x462c1e;};'use strict';var Sequelize=require(_0x5d7d('0x0'));var _=require(_0x5d7d('0x1'));module[_0x5d7d('0x2')]={'body':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d7d('0x6')]('in','out'),'defaultValue':_0x5d7d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5d7d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5d7d('0x8')]},'to':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4'))},'cc':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4'))},'bcc':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4'))},'subject':{'type':Sequelize[_0x5d7d('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5d7d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5d7d('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5d7d('0xb')]},'originTo':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4'))},'originCc':{'type':Sequelize[_0x5d7d('0x3')](_0x5d7d('0x4'))}}; \ No newline at end of file +var _0x1eba=['DATE','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING'];(function(_0xdc2c0a,_0x176bd0){var _0x70051f=function(_0x2202bf){while(--_0x2202bf){_0xdc2c0a['push'](_0xdc2c0a['shift']());}};_0x70051f(++_0x176bd0);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x1eba[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xa1eb('0x0'));var _=require(_0xa1eb('0x1'));module[_0xa1eb('0x2')]={'body':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xa1eb('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa1eb('0x6')]('in',_0xa1eb('0x7')),'defaultValue':_0xa1eb('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa1eb('0x8')](0x1fe)},'from':{'type':Sequelize[_0xa1eb('0x8')]},'to':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4'))},'cc':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4'))},'bcc':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xa1eb('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa1eb('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xa1eb('0x3')]('long')},'originCc':{'type':Sequelize[_0xa1eb('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e49c282..39445ab 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 _0x37c5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','stringify','code','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','MailMessage','include','findAll','show','params','includeAll','options','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','pass','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteractionId','update','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','../../config/logger','mail-interactions','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','log','err','eml-format','rimraf'];(function(_0x3e7ee7,_0x592256){var _0x1c2959=function(_0x466ad9){while(--_0x466ad9){_0x3e7ee7['push'](_0x3e7ee7['shift']());}};_0x1c2959(++_0x592256);}(_0x37c5,0xa7));var _0x537c=function(_0x2606ed,_0x49633d){_0x2606ed=_0x2606ed-0x0;var _0x47f45b=_0x37c5[_0x2606ed];return _0x47f45b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x537c('0x0'));var rimraf=require(_0x537c('0x1'));var zipdir=require(_0x537c('0x2'));var jsonpatch=require(_0x537c('0x3'));var rp=require(_0x537c('0x4'));var moment=require(_0x537c('0x5'));var BPromise=require(_0x537c('0x6'));var Mustache=require(_0x537c('0x7'));var util=require(_0x537c('0x8'));var path=require(_0x537c('0x9'));var sox=require('sox');var csv=require(_0x537c('0xa'));var ejs=require(_0x537c('0xb'));var fs=require('fs');var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0xa'));var querystring=require('querystring');var Papa=require(_0x537c('0x10'));var Redis=require(_0x537c('0x11'));var authService=require(_0x537c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x537c('0x14'));var utils=require('../../config/utils');var config=require(_0x537c('0x15'));var db=require(_0x537c('0x16'))['db'];config[_0x537c('0x17')]=_[_0x537c('0x18')](config[_0x537c('0x17')],{'host':_0x537c('0x19'),'port':0x18eb});var socket=require(_0x537c('0x1a'))(new Redis(config[_0x537c('0x17')]));require(_0x537c('0x1b'))['register'](socket);var jayson=require(_0x537c('0x1c'));var client=jayson[_0x537c('0x1d')][_0x537c('0x1e')]({'port':0x232c});var client9003=jayson[_0x537c('0x1d')][_0x537c('0x1e')]({'port':0x232b});var client9002=jayson[_0x537c('0x1d')][_0x537c('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3776c3,_0x445763,_0x5bd4c9){if(_0x5bd4c9){var _0x3ae729=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ae729['test'](_0x445763)){return _0x3776c3;}else{throw new db['Sequelize'][(_0x537c('0x1f'))](_0x537c('0x20'));}}else{return _0x3776c3;}}function respondWithRpcPromise(_0x2a890e,_0x5f3776,_0x28b410,_0x229ffd){return new BPromise(function(_0x581cbc,_0x5ca4d5){var _0xc83ece=_0x229ffd||client;return _0xc83ece['request'](_0x2a890e,_0x28b410)['then'](function(_0x2307c7){logger[_0x537c('0x21')]('MailMessage,\x20%s,\x20%s',_0x5f3776,_0x537c('0x22'));logger[_0x537c('0x23')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f3776,'request\x20sent',JSON[_0x537c('0x24')](_0x2307c7));if(_0x2307c7['error']){if(_0x2307c7['error'][_0x537c('0x25')]===0x1f4){logger[_0x537c('0x26')](_0x537c('0x27'),_0x5f3776,_0x2307c7[_0x537c('0x26')][_0x537c('0x28')]);return _0x5ca4d5(_0x2307c7[_0x537c('0x26')]['message']);}logger[_0x537c('0x26')](_0x537c('0x27'),_0x5f3776,_0x2307c7[_0x537c('0x26')][_0x537c('0x28')]);return _0x581cbc(_0x2307c7[_0x537c('0x26')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x5f3776,_0x537c('0x22'));_0x581cbc(_0x2307c7[_0x537c('0x29')]['message']);}})[_0x537c('0x2a')](function(_0x351792){logger[_0x537c('0x26')]('MailMessage,\x20%s,\x20%s',_0x5f3776,_0x351792);_0x5ca4d5(_0x351792);});});}function respondWithStatusCode(_0x5b2be1,_0x14c93a){_0x14c93a=_0x14c93a||0xcc;return function(_0x44cc94){if(_0x44cc94){return _0x5b2be1[_0x537c('0x2b')](_0x14c93a);}return _0x5b2be1[_0x537c('0x2c')](_0x14c93a)[_0x537c('0x2d')]();};}function respondWithResult(_0x5ca8f6,_0x22f82e){_0x22f82e=_0x22f82e||0xc8;return function(_0xb3795f){if(_0xb3795f){return _0x5ca8f6['status'](_0x22f82e)['json'](_0xb3795f);}};}function respondWithFilteredResult(_0x50788a,_0x49138c){return function(_0x254996){if(_0x254996){var _0x433968=_0x254996[_0x537c('0x2e')],_0x3aa9d6=_0x49138c[_0x537c('0x2f')],_0x5379e5=_0x49138c['offset']+_0x49138c[_0x537c('0x30')],_0x931d86;if(_0x5379e5>=_0x433968){_0x5379e5=_0x433968;_0x931d86=0xc8;}else{_0x931d86=0xce;}_0x50788a[_0x537c('0x2c')](_0x931d86);return _0x50788a[_0x537c('0x31')]('Content-Range',_0x3aa9d6+'-'+_0x5379e5+'/'+_0x433968)['json'](_0x254996);}return null;};}function patchUpdates(_0x235927){return function(_0x3fa447){try{jsonpatch[_0x537c('0x32')](_0x3fa447,_0x235927,!![]);}catch(_0x27b251){return BPromise[_0x537c('0x33')](_0x27b251);}return _0x3fa447[_0x537c('0x34')]();};}function saveUpdates(_0x40cc06,_0xed36b2){return function(_0x5bad11){if(_0x5bad11){return _0x5bad11['update'](_0x40cc06)[_0x537c('0x35')](function(_0x46263d){return _0x46263d;});}return null;};}function removeEntity(_0x4c8233,_0x36d769){return function(_0xf7a818){if(_0xf7a818){return _0xf7a818[_0x537c('0x36')]()[_0x537c('0x35')](function(){_0x4c8233[_0x537c('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dea3c,_0x50ffd0){return function(_0x596396){if(!_0x596396){_0x3dea3c['sendStatus'](0x194);}return _0x596396;};}function handleError(_0x5cea88,_0x18195d){_0x18195d=_0x18195d||0x1f4;return function(_0x2258b9){logger[_0x537c('0x26')](_0x2258b9[_0x537c('0x37')]);if(_0x2258b9[_0x537c('0x38')]){delete _0x2258b9[_0x537c('0x38')];}_0x5cea88[_0x537c('0x2c')](_0x18195d)[_0x537c('0x39')](_0x2258b9);};}exports[_0x537c('0x3a')]=function(_0x1d69e4,_0x2f3dc0){var _0x2dcbca={},_0x28b222={},_0x1e452d={'count':0x0,'rows':[]};var _0x5494d3=_[_0x537c('0x3b')](db['MailMessage'][_0x537c('0x3c')],function(_0x2e7fb7){return{'name':_0x2e7fb7['fieldName'],'type':_0x2e7fb7[_0x537c('0x3d')][_0x537c('0x3e')]};});_0x28b222[_0x537c('0x3f')]=_[_0x537c('0x3b')](_0x5494d3,'name');_0x28b222[_0x537c('0x40')]=_[_0x537c('0x41')](_0x1d69e4[_0x537c('0x40')]);_0x28b222['filters']=_[_0x537c('0x42')](_0x28b222[_0x537c('0x3f')],_0x28b222[_0x537c('0x40')]);_0x2dcbca[_0x537c('0x43')]=_[_0x537c('0x42')](_0x28b222[_0x537c('0x3f')],qs['fields'](_0x1d69e4[_0x537c('0x40')][_0x537c('0x44')]));_0x2dcbca[_0x537c('0x43')]=_0x2dcbca[_0x537c('0x43')][_0x537c('0x45')]?_0x2dcbca[_0x537c('0x43')]:_0x28b222[_0x537c('0x3f')];if(!_0x1d69e4['query'][_0x537c('0x46')]('nolimit')){_0x2dcbca[_0x537c('0x30')]=qs[_0x537c('0x30')](_0x1d69e4[_0x537c('0x40')][_0x537c('0x30')]);_0x2dcbca[_0x537c('0x2f')]=qs['offset'](_0x1d69e4['query'][_0x537c('0x2f')]);}_0x2dcbca[_0x537c('0x47')]=qs[_0x537c('0x48')](_0x1d69e4[_0x537c('0x40')][_0x537c('0x48')]);_0x2dcbca[_0x537c('0x49')]=qs['filters'](_[_0x537c('0x4a')](_0x1d69e4[_0x537c('0x40')],_0x28b222[_0x537c('0x4b')]),_0x5494d3);if(_0x1d69e4[_0x537c('0x40')][_0x537c('0x4c')]){_0x2dcbca[_0x537c('0x49')]=_[_0x537c('0x4d')](_0x2dcbca[_0x537c('0x49')],{'$or':_[_0x537c('0x3b')](_0x5494d3,function(_0xc0c632){if(_0xc0c632[_0x537c('0x3d')]!==_0x537c('0x4e')){var _0x1747cc={};_0x1747cc[_0xc0c632[_0x537c('0x38')]]={'$like':'%'+_0x1d69e4['query'][_0x537c('0x4c')]+'%'};return _0x1747cc;}})});}_0x2dcbca=_[_0x537c('0x4d')]({},_0x2dcbca,_0x1d69e4['options']);var _0x2ddc3f={'where':_0x2dcbca[_0x537c('0x49')]};return db[_0x537c('0x4f')]['count'](_0x2ddc3f)[_0x537c('0x35')](function(_0x2b8c8a){_0x1e452d[_0x537c('0x2e')]=_0x2b8c8a;if(_0x1d69e4[_0x537c('0x40')]['includeAll']){_0x2dcbca[_0x537c('0x50')]=[{'all':!![]}];}return db[_0x537c('0x4f')][_0x537c('0x51')](_0x2dcbca);})['then'](function(_0x28f359){_0x1e452d['rows']=_0x28f359;return _0x1e452d;})[_0x537c('0x35')](respondWithFilteredResult(_0x2f3dc0,_0x2dcbca))[_0x537c('0x2a')](handleError(_0x2f3dc0,null));};exports[_0x537c('0x52')]=function(_0x185093,_0x10fc58){var _0x25f216={'raw':!![],'where':{'id':_0x185093[_0x537c('0x53')]['id']}},_0x420f12={};_0x420f12[_0x537c('0x3f')]=_[_0x537c('0x41')](db['MailMessage']['rawAttributes']);_0x420f12[_0x537c('0x40')]=_[_0x537c('0x41')](_0x185093[_0x537c('0x40')]);_0x420f12[_0x537c('0x4b')]=_[_0x537c('0x42')](_0x420f12[_0x537c('0x3f')],_0x420f12[_0x537c('0x40')]);_0x25f216['attributes']=_['intersection'](_0x420f12[_0x537c('0x3f')],qs[_0x537c('0x44')](_0x185093[_0x537c('0x40')]['fields']));_0x25f216['attributes']=_0x25f216[_0x537c('0x43')]['length']?_0x25f216[_0x537c('0x43')]:_0x420f12[_0x537c('0x3f')];if(_0x185093[_0x537c('0x40')][_0x537c('0x54')]){_0x25f216[_0x537c('0x50')]=[{'all':!![]}];}_0x25f216=_[_0x537c('0x4d')]({},_0x25f216,_0x185093[_0x537c('0x55')]);return db[_0x537c('0x4f')][_0x537c('0x56')](_0x25f216)[_0x537c('0x35')](handleEntityNotFound(_0x10fc58,null))[_0x537c('0x35')](respondWithResult(_0x10fc58,null))[_0x537c('0x2a')](handleError(_0x10fc58,null));};exports['update']=function(_0x83dc0c,_0x4af27f){if(_0x83dc0c['body']['id']){delete _0x83dc0c['body']['id'];}return db[_0x537c('0x4f')][_0x537c('0x56')]({'where':{'id':_0x83dc0c[_0x537c('0x53')]['id']}})['then'](handleEntityNotFound(_0x4af27f,null))[_0x537c('0x35')](saveUpdates(_0x83dc0c[_0x537c('0x57')],null))[_0x537c('0x35')](respondWithResult(_0x4af27f,null))[_0x537c('0x2a')](handleError(_0x4af27f,null));};exports[_0x537c('0x36')]=function(_0x51750f,_0xe46ae1){return db[_0x537c('0x4f')][_0x537c('0x56')]({'where':{'id':_0x51750f['params']['id']}})['then'](handleEntityNotFound(_0xe46ae1,null))['then'](removeEntity(_0xe46ae1,null))[_0x537c('0x2a')](handleError(_0xe46ae1,null));};exports[_0x537c('0x58')]=function(_0x528935,_0x3dded5){return db[_0x537c('0x4f')][_0x537c('0x58')]()[_0x537c('0x35')](respondWithResult(_0x3dded5,null))[_0x537c('0x2a')](handleError(_0x3dded5,null));};exports[_0x537c('0x59')]=function(_0x4701cd,_0x40557a){return db[_0x537c('0x4f')]['create'](_0x4701cd[_0x537c('0x57')])[_0x537c('0x35')](function(_0xa16827){if(_0xa16827){if(_0xa16827['direction']===_0x537c('0x5a')&&!_0xa16827[_0x537c('0x5b')]){var _0x40ccf8,_0x54e3fd,_0x2f1849;if(_0x4701cd['body']['to']){_0x54e3fd=_0x4701cd['body']['to'][_0x537c('0x5c')](',')[0x0];}return db[_0x537c('0x5d')]['findOne']({'where':{'id':_0xa16827[_0x537c('0x5e')]},'include':[{'model':db[_0x537c('0x5f')],'as':_0x537c('0x60'),'include':[{'model':db[_0x537c('0x61')],'as':'Contacts','where':{'email':_0x54e3fd},'limit':0x1,'order':[[_0x537c('0x62'),_0x537c('0x63')]]}]},{'model':db[_0x537c('0x64')],'as':_0x537c('0x65'),'raw':!![]}]})[_0x537c('0x35')](function(_0x2f7cfa){_0x40ccf8=_0x2f7cfa;if(_0x40ccf8&&_0x40ccf8[_0x537c('0x65')]){var _0x11bbaf={'tls':{'rejectUnauthorized':![]}};if(_[_0x537c('0x66')](_0x40ccf8[_0x537c('0x65')][_0x537c('0x67')])){_0x11bbaf[_0x537c('0x68')]=_0x40ccf8[_0x537c('0x65')][_0x537c('0x68')];_0x11bbaf[_0x537c('0x69')]=_0x40ccf8[_0x537c('0x65')][_0x537c('0x69')];_0x11bbaf['secure']=_0x40ccf8[_0x537c('0x65')][_0x537c('0x6a')];if(_0x40ccf8[_0x537c('0x65')][_0x537c('0x6b')]){_0x11bbaf['auth']={'user':_0x40ccf8[_0x537c('0x65')][_0x537c('0x6c')],'pass':_0x40ccf8[_0x537c('0x65')][_0x537c('0x6d')]};}}else{_0x11bbaf['service']=_0x40ccf8[_0x537c('0x65')][_0x537c('0x67')];_0x11bbaf['auth']={'user':_0x40ccf8[_0x537c('0x65')][_0x537c('0x6c')],'pass':_0x40ccf8[_0x537c('0x65')]['pass']};_0x11bbaf[_0x537c('0x6a')]=_0x40ccf8[_0x537c('0x65')][_0x537c('0x6a')];}if(_0x4701cd[_0x537c('0x57')][_0x537c('0x6e')]&&_0x4701cd[_0x537c('0x57')][_0x537c('0x6e')][_0x537c('0x45')]){for(var _0x32a7b1=0x0;_0x32a7b1<_0x4701cd[_0x537c('0x57')][_0x537c('0x6e')]['length'];_0x32a7b1+=0x1){_0x4701cd[_0x537c('0x57')][_0x537c('0x6e')][_0x32a7b1]={'filename':_0x4701cd['body'][_0x537c('0x6e')][_0x32a7b1]['name'],'path':path[_0x537c('0x6f')](config[_0x537c('0x70')],_0x537c('0x71'),_0x4701cd[_0x537c('0x57')][_0x537c('0x6e')][_0x32a7b1][_0x537c('0x72')])};}}_0x2f1849={'account':_0x11bbaf,'message':_0x4701cd[_0x537c('0x57')]};return;}})[_0x537c('0x35')](function(){if(_0x40ccf8[_0x537c('0x60')]){if(_0x40ccf8[_0x537c('0x60')]['Contacts']['length']){return _0x40ccf8[_0x537c('0x60')][_0x537c('0x73')][0x0];}else{return db[_0x537c('0x61')][_0x537c('0x59')](_[_0x537c('0x18')](_0x4701cd[_0x537c('0x57')],{'firstName':_0x4701cd['body']['to'],'email':_0x4701cd[_0x537c('0x57')]['to'],'phone':_0x4701cd[_0x537c('0x57')]['to'],'ListId':_0x40ccf8[_0x537c('0x74')]}));}}else{throw new Error(_0x537c('0x75'));}})[_0x537c('0x35')](function(){if(_0x2f1849){return respondWithRpcPromise(_0x537c('0x76'),'sendMail',_0x2f1849,client9003)[_0x537c('0x35')](function(_0x42660b){return _0xa16827['update']({'read':!![],'messageId':_0x42660b[_0x537c('0x77')],'sentAt':moment()[_0x537c('0x78')](_0x537c('0x79'))});})[_0x537c('0x2a')](function(_0x1d485a){logger['error']('%s',JSON[_0x537c('0x24')](_0x1d485a));return _0xa16827;});}return _0xa16827;});}return _0xa16827;}})[_0x537c('0x35')](respondWithResult(_0x40557a,0xc9))[_0x537c('0x2a')](handleError(_0x40557a,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x537c('0x7a')]=function(_0x47e950,_0x5bf909,_0x523994){var _0x3afc6e={'channel':_0x537c('0x7b')};if(_0x47e950['body']['id']){delete _0x47e950[_0x537c('0x57')]['id'];}_0x47e950[_0x537c('0x57')][_0x537c('0x7c')]=!![];_0x47e950[_0x537c('0x57')][_0x537c('0x7d')]=moment()[_0x537c('0x78')](_0x537c('0x79'));_0x47e950[_0x537c('0x57')][_0x537c('0x7e')]=_0x47e950[_0x537c('0x57')][_0x537c('0x7e')]||_0x47e950['user']['id'];return db[_0x537c('0x4f')]['find']({'where':{'id':_0x47e950[_0x537c('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x537c('0x61')],'as':'Contact'}]})[_0x537c('0x35')](handleEntityNotFound(_0x5bf909,null))[_0x537c('0x35')](saveUpdates(_0x47e950[_0x537c('0x57')],null))[_0x537c('0x35')](function(_0x2f1764){if(_0x2f1764){_0x3afc6e[_0x537c('0x28')]=_0x2f1764[_0x537c('0x7f')]({'plain':!![]});return db['MailInteraction'][_0x537c('0x56')]({'where':{'id':_0x2f1764[_0x537c('0x80')]}});}return null;})[_0x537c('0x35')](handleEntityNotFound(_0x5bf909,null))[_0x537c('0x35')](function(_0x4df0ff){if(_0x4df0ff){return _0x4df0ff[_0x537c('0x81')]({'UserId':_0x47e950[_0x537c('0x57')][_0x537c('0x7e')],'read1stAt':_[_0x537c('0x66')](_0x4df0ff['read1stAt'])?moment()['format'](_0x537c('0x79')):undefined});}return null;})[_0x537c('0x35')](function(_0x4f4737){if(_0x4f4737){_0x3afc6e[_0x537c('0x82')]=_0x4f4737['get']({'plain':!![]});interaction_log[_0x537c('0x21')](_0x537c('0x83'),_0x47e950[_0x537c('0x6c')]['id'],_0x47e950[_0x537c('0x6c')][_0x537c('0x38')],_0x47e950[_0x537c('0x6c')][_0x537c('0x84')],_0x3afc6e[_0x537c('0x82')]['id'],_0x47e950[_0x537c('0x57')]?JSON[_0x537c('0x24')](_0x47e950[_0x537c('0x57')]):_0x537c('0x85'));return respondWithRpcPromise('AcceptMessage',_0x537c('0x86'),_0x3afc6e);}return null;})[_0x537c('0x35')](function(_0xebd8a4){if(_0xebd8a4){if(_0x47e950[_0x537c('0x57')][_0x537c('0x87')]){_0x3afc6e[_0x537c('0x28')][_0x537c('0x88')]=util[_0x537c('0x78')](_0x537c('0x89'),_0x47e950[_0x537c('0x6c')][_0x537c('0x38')]);_0x3afc6e['message'][_0x537c('0x8a')]=_0x3afc6e[_0x537c('0x8a')];_0x3afc6e[_0x537c('0x28')]['event']=_0x537c('0x7a');return respondWithRpcPromise('EventManager',_0x537c('0x8b'),{'event':_0x537c('0x8c'),'message':_0x3afc6e[_0x537c('0x28')]},client9002)[_0x537c('0x35')](function(){return _0x3afc6e;});}return _0x3afc6e;}return null;})[_0x537c('0x35')](respondWithResult(_0x5bf909,null))[_0x537c('0x2a')](handleError(_0x5bf909,null));};var interaction_log=require(_0x537c('0x8d'))(_0x537c('0x8e'));exports['reject']=function(_0x2a65d2,_0x363026,_0x5c716a){var _0xf8d059={'agent':{},'channel':_0x537c('0x7b')};if(_0x2a65d2[_0x537c('0x57')]['id']){delete _0x2a65d2[_0x537c('0x57')]['id'];}_0x2a65d2[_0x537c('0x57')][_0x537c('0x7e')]=_0x2a65d2['body'][_0x537c('0x7e')]||_0x2a65d2[_0x537c('0x6c')]['id'];_0xf8d059[_0x537c('0x8f')]['id']=_0x2a65d2[_0x537c('0x57')][_0x537c('0x7e')];return db['MailMessage'][_0x537c('0x56')]({'where':{'id':_0x2a65d2[_0x537c('0x53')]['id'],'UserId':null}})[_0x537c('0x35')](handleEntityNotFound(_0x363026,null))[_0x537c('0x35')](function(_0x2c872d){if(_0x2c872d){_0xf8d059['message']=_0x2c872d[_0x537c('0x7f')]({'plain':!![]});return db[_0x537c('0x90')][_0x537c('0x56')]({'where':{'id':_0x2c872d[_0x537c('0x80')]}});}return null;})[_0x537c('0x35')](handleEntityNotFound(_0x363026,null))[_0x537c('0x35')](function(_0x5ecb7b){if(_0x5ecb7b){_0xf8d059[_0x537c('0x82')]=_0x5ecb7b[_0x537c('0x7f')]({'plain':!![]});interaction_log[_0x537c('0x21')](_0x537c('0x91'),_0x2a65d2[_0x537c('0x6c')]['id'],_0x2a65d2[_0x537c('0x6c')]['name'],_0x2a65d2[_0x537c('0x6c')][_0x537c('0x84')],_0xf8d059[_0x537c('0x82')]['id'],_0x2a65d2['body']?JSON[_0x537c('0x24')](_0x2a65d2[_0x537c('0x57')]):_0x537c('0x85'));return respondWithRpcPromise(_0x537c('0x92'),_0x537c('0x93'),_0xf8d059);}return null;})[_0x537c('0x35')](function(_0x3d2096){if(_0x3d2096){_0x3d2096[_0x537c('0x28')][_0x537c('0x88')]=util[_0x537c('0x78')](_0x537c('0x89'),_0x2a65d2[_0x537c('0x6c')][_0x537c('0x38')]);_0x3d2096[_0x537c('0x28')][_0x537c('0x8a')]=_0xf8d059[_0x537c('0x8a')];_0x3d2096['message'][_0x537c('0x94')]='reject';respondWithRpcPromise(_0x537c('0x8b'),_0x537c('0x8b'),{'event':'rejectmessage','message':_0x3d2096[_0x537c('0x28')]},client9002);return _0xf8d059;}return null;})[_0x537c('0x35')](respondWithResult(_0x363026,null))[_0x537c('0x2a')](handleError(_0x363026,null));};exports[_0x537c('0x95')]=function(_0x8623e0,_0x235a77){var _0x705c72=moment()[_0x537c('0x96')]()[_0x537c('0x97')]();var _0x350bc0=path['join'](config[_0x537c('0x70')],_0x537c('0x98'),_0x537c('0x99'),'tmp');var _0x3a7f9d=path[_0x537c('0x6f')](config['root'],_0x537c('0x98'),'files',_0x537c('0x6e'));var _0x10a12e=util[_0x537c('0x78')](_0x537c('0x9a'),_0x705c72);return db[_0x537c('0x4f')]['find']({'where':{'id':_0x8623e0[_0x537c('0x53')]['id']},'attributes':['id',_0x537c('0x57'),_0x537c('0x9b'),'to','cc',_0x537c('0x9c'),_0x537c('0x9d'),'createdAt'],'include':_0x8623e0[_0x537c('0x40')]['attachments']?[{'model':db[_0x537c('0x9e')],'as':_0x537c('0x9f')}]:undefined})[_0x537c('0x35')](handleEntityNotFound(_0x235a77,null))['then'](function(_0x5deca6){if(_0x5deca6){var _0x3d898b=_0x5deca6;var _0x19863f={'from':_0x3d898b['from'],'to':_0x3d898b['to'],'subject':_0x3d898b[_0x537c('0x9d')],'html':_0x3d898b['body'],'headers':{'Date':moment(_0x3d898b['createdAt'])[_0x537c('0x78')](_0x537c('0xa0'))},'attachments':[]};if(_0x5deca6['cc']){_0x19863f['headers']['Cc']=_0x5deca6['cc'];}if(_0x5deca6[_0x537c('0x9c')]){_0x19863f[_0x537c('0xa1')][_0x537c('0xa2')]=_0x5deca6[_0x537c('0x9c')];}return new BPromise(function(_0x6cc395,_0x2bda06){if(_0x5deca6[_0x537c('0x9f')]){for(var _0x1a9e00=0x0;_0x1a9e00<_0x5deca6['Attachments'][_0x537c('0x45')];_0x1a9e00++){var _0xaae2f8=_0x5deca6[_0x537c('0x9f')][_0x1a9e00];var _0x236159=path[_0x537c('0x6f')](_0x3a7f9d,_0xaae2f8[_0x537c('0x72')]);if(fs[_0x537c('0xa3')](_0x236159)){_0x19863f[_0x537c('0x6e')][_0x537c('0xa4')]({'name':_0xaae2f8['name'],'contentType':_0xaae2f8[_0x537c('0x3d')],'data':fs[_0x537c('0xa5')](_0x236159)});}}}emlformat['build'](_0x19863f,function(_0x523ddf,_0x98f5aa){if(_0x523ddf)return _0x2bda06(_0x523ddf);fs[_0x537c('0xa6')](path['join'](_0x350bc0,_0x10a12e),_0x98f5aa);return _0x6cc395(_0x98f5aa);});});}})[_0x537c('0x35')](function(_0x10aeb0){if(_0x10aeb0){return _0x235a77[_0x537c('0x95')](path[_0x537c('0x6f')](_0x350bc0,_0x10a12e),_0x10a12e,function(_0x139c83){if(_0x139c83){console[_0x537c('0xa7')](_0x537c('0xa8'),_0x139c83);}else{fs['unlinkSync'](path[_0x537c('0x6f')](_0x350bc0,_0x10a12e));}});}})[_0x537c('0x2a')](handleError(_0x235a77,null));}; \ No newline at end of file +var _0x2830=['map','MailMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','then','includeAll','include','findAll','rows','show','params','length','find','update','body','describe','create','out','secret','MailAccount','findOne','MailAccountId','CmList','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','CmContact','Contact','get','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','download','unix','files','server','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.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','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2830,0x117));var _0x0283=function(_0x24ab46,_0xe92e42){_0x24ab46=_0x24ab46-0x0;var _0x3fa5a2=_0x2830[_0x24ab46];return _0x3fa5a2;};'use strict';var pdf=require(_0x0283('0x0'));var emlformat=require(_0x0283('0x1'));var rimraf=require(_0x0283('0x2'));var zipdir=require(_0x0283('0x3'));var jsonpatch=require(_0x0283('0x4'));var rp=require(_0x0283('0x5'));var moment=require(_0x0283('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0283('0x7'));var util=require('util');var path=require(_0x0283('0x8'));var sox=require(_0x0283('0x9'));var csv=require(_0x0283('0xa'));var ejs=require(_0x0283('0xb'));var fs=require('fs');var _=require(_0x0283('0xc'));var squel=require(_0x0283('0xd'));var crypto=require(_0x0283('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0283('0xf'));var toCsv=require(_0x0283('0xa'));var querystring=require(_0x0283('0x10'));var Papa=require(_0x0283('0x11'));var Redis=require(_0x0283('0x12'));var authService=require(_0x0283('0x13'));var qs=require(_0x0283('0x14'));var as=require(_0x0283('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0283('0x16'))(_0x0283('0x17'));var utils=require(_0x0283('0x18'));var config=require(_0x0283('0x19'));var db=require(_0x0283('0x1a'))['db'];config[_0x0283('0x1b')]=_[_0x0283('0x1c')](config['redis'],{'host':_0x0283('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0283('0x1e'))[_0x0283('0x1f')](socket);var jayson=require(_0x0283('0x20'));var client=jayson[_0x0283('0x21')][_0x0283('0x22')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0x0283('0x22')]({'port':0x232a});function checkPasswordPattern(_0x414d92,_0x1ab85e,_0x2453f4){if(_0x2453f4){var _0x2a801b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a801b[_0x0283('0x23')](_0x1ab85e)){return _0x414d92;}else{throw new db[(_0x0283('0x24'))][(_0x0283('0x25'))](_0x0283('0x26'));}}else{return _0x414d92;}}function respondWithRpcPromise(_0x26f1c5,_0x138ad9,_0x518c85,_0x3bbb8c){return new BPromise(function(_0x1c26e9,_0x15ea95){var _0x475acc=_0x3bbb8c||client;return _0x475acc[_0x0283('0x27')](_0x26f1c5,_0x518c85)['then'](function(_0x225975){logger[_0x0283('0x28')](_0x0283('0x29'),_0x138ad9,_0x0283('0x2a'));logger[_0x0283('0x2b')](_0x0283('0x2c'),_0x138ad9,_0x0283('0x2a'),JSON[_0x0283('0x2d')](_0x225975));if(_0x225975['error']){if(_0x225975[_0x0283('0x2e')][_0x0283('0x2f')]===0x1f4){logger['error'](_0x0283('0x29'),_0x138ad9,_0x225975[_0x0283('0x2e')][_0x0283('0x30')]);return _0x15ea95(_0x225975[_0x0283('0x2e')][_0x0283('0x30')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x138ad9,_0x225975[_0x0283('0x2e')][_0x0283('0x30')]);return _0x1c26e9(_0x225975[_0x0283('0x2e')][_0x0283('0x30')]);}else{logger[_0x0283('0x28')](_0x0283('0x29'),_0x138ad9,'request\x20sent');_0x1c26e9(_0x225975[_0x0283('0x31')][_0x0283('0x30')]);}})[_0x0283('0x32')](function(_0x2c508b){logger['error'](_0x0283('0x29'),_0x138ad9,_0x2c508b);_0x15ea95(_0x2c508b);});});}function respondWithStatusCode(_0x115283,_0x1317fe){_0x1317fe=_0x1317fe||0xcc;return function(_0x5953e5){if(_0x5953e5){return _0x115283[_0x0283('0x33')](_0x1317fe);}return _0x115283[_0x0283('0x34')](_0x1317fe)[_0x0283('0x35')]();};}function respondWithResult(_0x41fc7e,_0x584bc2){_0x584bc2=_0x584bc2||0xc8;return function(_0x5743ce){if(_0x5743ce){return _0x41fc7e[_0x0283('0x34')](_0x584bc2)[_0x0283('0x36')](_0x5743ce);}};}function respondWithFilteredResult(_0x45de1f,_0xcc53b2){return function(_0x52df28){if(_0x52df28){var _0x1758fd=_0x52df28[_0x0283('0x37')],_0x4d616a=_0xcc53b2[_0x0283('0x38')],_0x4ce58e=_0xcc53b2[_0x0283('0x38')]+_0xcc53b2[_0x0283('0x39')],_0x1ac992;if(_0x4ce58e>=_0x1758fd){_0x4ce58e=_0x1758fd;_0x1ac992=0xc8;}else{_0x1ac992=0xce;}_0x45de1f[_0x0283('0x34')](_0x1ac992);return _0x45de1f[_0x0283('0x3a')](_0x0283('0x3b'),_0x4d616a+'-'+_0x4ce58e+'/'+_0x1758fd)['json'](_0x52df28);}return null;};}function patchUpdates(_0x55fdf9){return function(_0x9e8fd){try{jsonpatch[_0x0283('0x3c')](_0x9e8fd,_0x55fdf9,!![]);}catch(_0x3dfd67){return BPromise[_0x0283('0x3d')](_0x3dfd67);}return _0x9e8fd[_0x0283('0x3e')]();};}function saveUpdates(_0xc269db,_0x46b67e){return function(_0x4264c3){if(_0x4264c3){return _0x4264c3['update'](_0xc269db)['then'](function(_0x2e733a){return _0x2e733a;});}return null;};}function removeEntity(_0x16bd57,_0x670bcc){return function(_0x505e75){if(_0x505e75){return _0x505e75[_0x0283('0x3f')]()['then'](function(){_0x16bd57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x280ad0,_0x4e9437){return function(_0x5a97a0){if(!_0x5a97a0){_0x280ad0[_0x0283('0x33')](0x194);}return _0x5a97a0;};}function handleError(_0x4cc7b6,_0x875a5d){_0x875a5d=_0x875a5d||0x1f4;return function(_0x3c49c5){logger[_0x0283('0x2e')](_0x3c49c5[_0x0283('0x40')]);if(_0x3c49c5[_0x0283('0x41')]){delete _0x3c49c5[_0x0283('0x41')];}_0x4cc7b6[_0x0283('0x34')](_0x875a5d)[_0x0283('0x42')](_0x3c49c5);};}exports['index']=function(_0x4392e7,_0x3e396f){var _0x5c4f49={},_0x1ea3d9={},_0x3afc24={'count':0x0,'rows':[]};var _0x278ded=_[_0x0283('0x43')](db[_0x0283('0x44')][_0x0283('0x45')],function(_0x358a6b){return{'name':_0x358a6b[_0x0283('0x46')],'type':_0x358a6b['type']['key']};});_0x1ea3d9[_0x0283('0x47')]=_[_0x0283('0x43')](_0x278ded,_0x0283('0x41'));_0x1ea3d9[_0x0283('0x48')]=_[_0x0283('0x49')](_0x4392e7[_0x0283('0x48')]);_0x1ea3d9[_0x0283('0x4a')]=_[_0x0283('0x4b')](_0x1ea3d9['model'],_0x1ea3d9['query']);_0x5c4f49[_0x0283('0x4c')]=_['intersection'](_0x1ea3d9['model'],qs[_0x0283('0x4d')](_0x4392e7[_0x0283('0x48')][_0x0283('0x4d')]));_0x5c4f49['attributes']=_0x5c4f49[_0x0283('0x4c')]['length']?_0x5c4f49[_0x0283('0x4c')]:_0x1ea3d9['model'];if(!_0x4392e7[_0x0283('0x48')][_0x0283('0x4e')](_0x0283('0x4f'))){_0x5c4f49[_0x0283('0x39')]=qs['limit'](_0x4392e7[_0x0283('0x48')][_0x0283('0x39')]);_0x5c4f49[_0x0283('0x38')]=qs[_0x0283('0x38')](_0x4392e7['query'][_0x0283('0x38')]);}_0x5c4f49[_0x0283('0x50')]=qs['sort'](_0x4392e7['query'][_0x0283('0x51')]);_0x5c4f49['where']=qs[_0x0283('0x4a')](_['pick'](_0x4392e7[_0x0283('0x48')],_0x1ea3d9[_0x0283('0x4a')]),_0x278ded);if(_0x4392e7[_0x0283('0x48')][_0x0283('0x52')]){_0x5c4f49[_0x0283('0x53')]=_[_0x0283('0x54')](_0x5c4f49[_0x0283('0x53')],{'$or':_[_0x0283('0x43')](_0x278ded,function(_0x4713c5){if(_0x4713c5[_0x0283('0x55')]!=='VIRTUAL'){var _0x3baa6a={};_0x3baa6a[_0x4713c5['name']]={'$like':'%'+_0x4392e7[_0x0283('0x48')][_0x0283('0x52')]+'%'};return _0x3baa6a;}})});}_0x5c4f49=_['merge']({},_0x5c4f49,_0x4392e7[_0x0283('0x56')]);var _0x15c3eb={'where':_0x5c4f49[_0x0283('0x53')]};return db[_0x0283('0x44')][_0x0283('0x37')](_0x15c3eb)[_0x0283('0x57')](function(_0x23e5c6){_0x3afc24['count']=_0x23e5c6;if(_0x4392e7['query'][_0x0283('0x58')]){_0x5c4f49[_0x0283('0x59')]=[{'all':!![]}];}return db[_0x0283('0x44')][_0x0283('0x5a')](_0x5c4f49);})['then'](function(_0x13a08c){_0x3afc24[_0x0283('0x5b')]=_0x13a08c;return _0x3afc24;})[_0x0283('0x57')](respondWithFilteredResult(_0x3e396f,_0x5c4f49))[_0x0283('0x32')](handleError(_0x3e396f,null));};exports[_0x0283('0x5c')]=function(_0x1c4940,_0x5a020a){var _0x1c470c={'raw':!![],'where':{'id':_0x1c4940[_0x0283('0x5d')]['id']}},_0x44c59b={};_0x44c59b['model']=_[_0x0283('0x49')](db[_0x0283('0x44')][_0x0283('0x45')]);_0x44c59b[_0x0283('0x48')]=_['keys'](_0x1c4940[_0x0283('0x48')]);_0x44c59b[_0x0283('0x4a')]=_['intersection'](_0x44c59b['model'],_0x44c59b[_0x0283('0x48')]);_0x1c470c[_0x0283('0x4c')]=_['intersection'](_0x44c59b['model'],qs[_0x0283('0x4d')](_0x1c4940['query'][_0x0283('0x4d')]));_0x1c470c[_0x0283('0x4c')]=_0x1c470c[_0x0283('0x4c')][_0x0283('0x5e')]?_0x1c470c[_0x0283('0x4c')]:_0x44c59b[_0x0283('0x47')];if(_0x1c4940[_0x0283('0x48')]['includeAll']){_0x1c470c[_0x0283('0x59')]=[{'all':!![]}];}_0x1c470c=_[_0x0283('0x54')]({},_0x1c470c,_0x1c4940[_0x0283('0x56')]);return db['MailMessage'][_0x0283('0x5f')](_0x1c470c)[_0x0283('0x57')](handleEntityNotFound(_0x5a020a,null))[_0x0283('0x57')](respondWithResult(_0x5a020a,null))[_0x0283('0x32')](handleError(_0x5a020a,null));};exports[_0x0283('0x60')]=function(_0x3d704c,_0x594894){if(_0x3d704c[_0x0283('0x61')]['id']){delete _0x3d704c['body']['id'];}return db[_0x0283('0x44')][_0x0283('0x5f')]({'where':{'id':_0x3d704c[_0x0283('0x5d')]['id']}})[_0x0283('0x57')](handleEntityNotFound(_0x594894,null))[_0x0283('0x57')](saveUpdates(_0x3d704c[_0x0283('0x61')],null))['then'](respondWithResult(_0x594894,null))[_0x0283('0x32')](handleError(_0x594894,null));};exports[_0x0283('0x3f')]=function(_0x450bb5,_0x41dbde){return db[_0x0283('0x44')][_0x0283('0x5f')]({'where':{'id':_0x450bb5[_0x0283('0x5d')]['id']}})[_0x0283('0x57')](handleEntityNotFound(_0x41dbde,null))[_0x0283('0x57')](removeEntity(_0x41dbde,null))[_0x0283('0x32')](handleError(_0x41dbde,null));};exports['describe']=function(_0x364051,_0x302bcc){return db[_0x0283('0x44')][_0x0283('0x62')]()['then'](respondWithResult(_0x302bcc,null))[_0x0283('0x32')](handleError(_0x302bcc,null));};exports[_0x0283('0x63')]=function(_0x36495f,_0x532cf7){return db[_0x0283('0x44')][_0x0283('0x63')](_0x36495f[_0x0283('0x61')])[_0x0283('0x57')](function(_0x302efc){if(_0x302efc){if(_0x302efc['direction']===_0x0283('0x64')&&!_0x302efc[_0x0283('0x65')]){var _0x204bcb,_0xa9a43c,_0x4732a2;if(_0x36495f[_0x0283('0x61')]['to']){_0xa9a43c=_0x36495f[_0x0283('0x61')]['to']['split'](',')[0x0];}return db[_0x0283('0x66')][_0x0283('0x67')]({'where':{'id':_0x302efc[_0x0283('0x68')]},'include':[{'model':db[_0x0283('0x69')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0283('0x6a'),'where':{'email':_0xa9a43c},'limit':0x1,'order':[['updatedAt',_0x0283('0x6b')]]}]},{'model':db[_0x0283('0x6c')],'as':_0x0283('0x6d'),'raw':!![]}]})[_0x0283('0x57')](function(_0xd4be36){_0x204bcb=_0xd4be36;if(_0x204bcb&&_0x204bcb[_0x0283('0x6d')]){var _0x5306da={'tls':{'rejectUnauthorized':![]}};if(_[_0x0283('0x6e')](_0x204bcb[_0x0283('0x6d')][_0x0283('0x6f')])){_0x5306da[_0x0283('0x70')]=_0x204bcb[_0x0283('0x6d')][_0x0283('0x70')];_0x5306da[_0x0283('0x71')]=_0x204bcb[_0x0283('0x6d')]['port'];_0x5306da[_0x0283('0x72')]=_0x204bcb[_0x0283('0x6d')][_0x0283('0x72')];if(_0x204bcb[_0x0283('0x6d')][_0x0283('0x73')]){_0x5306da[_0x0283('0x74')]={'user':_0x204bcb[_0x0283('0x6d')]['user'],'pass':_0x204bcb[_0x0283('0x6d')][_0x0283('0x75')]};}}else{_0x5306da[_0x0283('0x6f')]=_0x204bcb['Smtp']['service'];_0x5306da['auth']={'user':_0x204bcb[_0x0283('0x6d')][_0x0283('0x76')],'pass':_0x204bcb[_0x0283('0x6d')][_0x0283('0x75')]};_0x5306da[_0x0283('0x72')]=_0x204bcb['Smtp'][_0x0283('0x72')];}if(_0x36495f[_0x0283('0x61')][_0x0283('0x77')]&&_0x36495f[_0x0283('0x61')]['attachments'][_0x0283('0x5e')]){for(var _0x53cfe6=0x0;_0x53cfe6<_0x36495f[_0x0283('0x61')][_0x0283('0x77')][_0x0283('0x5e')];_0x53cfe6+=0x1){_0x36495f[_0x0283('0x61')][_0x0283('0x77')][_0x53cfe6]={'filename':_0x36495f['body'][_0x0283('0x77')][_0x53cfe6][_0x0283('0x41')],'path':path[_0x0283('0x78')](config[_0x0283('0x79')],'server/files/attachments',_0x36495f['body'][_0x0283('0x77')][_0x53cfe6][_0x0283('0x7a')])};}}_0x4732a2={'account':_0x5306da,'message':_0x36495f[_0x0283('0x61')]};return;}})[_0x0283('0x57')](function(){if(_0x204bcb['List']){if(_0x204bcb[_0x0283('0x7b')][_0x0283('0x6a')][_0x0283('0x5e')]){return _0x204bcb[_0x0283('0x7b')][_0x0283('0x6a')][0x0];}else{return db['CmContact'][_0x0283('0x63')](_[_0x0283('0x1c')](_0x36495f[_0x0283('0x61')],{'firstName':_0x36495f[_0x0283('0x61')]['to'],'email':_0x36495f[_0x0283('0x61')]['to'],'phone':_0x36495f[_0x0283('0x61')]['to'],'ListId':_0x204bcb[_0x0283('0x7c')]}));}}else{throw new Error(_0x0283('0x7d'));}})[_0x0283('0x57')](function(){if(_0x4732a2){return respondWithRpcPromise(_0x0283('0x7e'),_0x0283('0x7f'),_0x4732a2,client9003)['then'](function(_0x1894a4){return _0x302efc[_0x0283('0x60')]({'read':!![],'messageId':_0x1894a4[_0x0283('0x80')],'sentAt':moment()[_0x0283('0x81')](_0x0283('0x82'))});})[_0x0283('0x32')](function(_0x5835f9){logger[_0x0283('0x2e')]('%s',JSON[_0x0283('0x2d')](_0x5835f9));return _0x302efc;});}return _0x302efc;});}return _0x302efc;}})[_0x0283('0x57')](respondWithResult(_0x532cf7,0xc9))[_0x0283('0x32')](handleError(_0x532cf7,null));};var interaction_log=require(_0x0283('0x16'))('mail-interactions');exports[_0x0283('0x83')]=function(_0x45d9dd,_0x7dac38,_0x1c1f9c){var _0x3e839d={'channel':'mail'};if(_0x45d9dd[_0x0283('0x61')]['id']){delete _0x45d9dd[_0x0283('0x61')]['id'];}_0x45d9dd['body'][_0x0283('0x84')]=!![];_0x45d9dd['body'][_0x0283('0x85')]=moment()[_0x0283('0x81')](_0x0283('0x82'));_0x45d9dd[_0x0283('0x61')][_0x0283('0x86')]=_0x45d9dd[_0x0283('0x61')]['UserId']||_0x45d9dd[_0x0283('0x76')]['id'];return db[_0x0283('0x44')][_0x0283('0x5f')]({'where':{'id':_0x45d9dd[_0x0283('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0x0283('0x87')],'as':_0x0283('0x88')}]})[_0x0283('0x57')](handleEntityNotFound(_0x7dac38,null))[_0x0283('0x57')](saveUpdates(_0x45d9dd[_0x0283('0x61')],null))['then'](function(_0x184ecd){if(_0x184ecd){_0x3e839d[_0x0283('0x30')]=_0x184ecd[_0x0283('0x89')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x184ecd[_0x0283('0x8a')]}});}return null;})[_0x0283('0x57')](handleEntityNotFound(_0x7dac38,null))[_0x0283('0x57')](function(_0x2081e1){if(_0x2081e1){return _0x2081e1[_0x0283('0x60')]({'UserId':_0x45d9dd[_0x0283('0x61')][_0x0283('0x86')],'read1stAt':_[_0x0283('0x6e')](_0x2081e1[_0x0283('0x8b')])?moment()[_0x0283('0x81')](_0x0283('0x82')):undefined});}return null;})[_0x0283('0x57')](function(_0x46faf5){if(_0x46faf5){_0x3e839d['interaction']=_0x46faf5[_0x0283('0x89')]({'plain':!![]});interaction_log['info'](_0x0283('0x8c'),_0x45d9dd[_0x0283('0x76')]['id'],_0x45d9dd[_0x0283('0x76')]['name'],_0x45d9dd[_0x0283('0x76')]['role'],_0x3e839d[_0x0283('0x8d')]['id'],_0x45d9dd['body']?JSON[_0x0283('0x2d')](_0x45d9dd['body']):_0x0283('0x8e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3e839d);}return null;})['then'](function(_0x5371d9){if(_0x5371d9){if(_0x45d9dd[_0x0283('0x61')]['manual']){_0x3e839d['message'][_0x0283('0x8f')]=util[_0x0283('0x81')](_0x0283('0x90'),_0x45d9dd[_0x0283('0x76')][_0x0283('0x41')]);_0x3e839d[_0x0283('0x30')]['channel']=_0x3e839d[_0x0283('0x91')];_0x3e839d[_0x0283('0x30')][_0x0283('0x92')]='accept';return respondWithRpcPromise(_0x0283('0x93'),_0x0283('0x93'),{'event':_0x0283('0x94'),'message':_0x3e839d['message']},client9002)[_0x0283('0x57')](function(){return _0x3e839d;});}return _0x3e839d;}return null;})[_0x0283('0x57')](respondWithResult(_0x7dac38,null))['catch'](handleError(_0x7dac38,null));};var interaction_log=require(_0x0283('0x16'))(_0x0283('0x95'));exports[_0x0283('0x3d')]=function(_0x884264,_0x2a6efa,_0x4586a3){var _0x129b28={'agent':{},'channel':_0x0283('0x96')};if(_0x884264[_0x0283('0x61')]['id']){delete _0x884264[_0x0283('0x61')]['id'];}_0x884264[_0x0283('0x61')]['UserId']=_0x884264[_0x0283('0x61')]['UserId']||_0x884264[_0x0283('0x76')]['id'];_0x129b28['agent']['id']=_0x884264[_0x0283('0x61')][_0x0283('0x86')];return db[_0x0283('0x44')]['find']({'where':{'id':_0x884264[_0x0283('0x5d')]['id'],'UserId':null}})[_0x0283('0x57')](handleEntityNotFound(_0x2a6efa,null))[_0x0283('0x57')](function(_0x1b9f4f){if(_0x1b9f4f){_0x129b28['message']=_0x1b9f4f['get']({'plain':!![]});return db['MailInteraction'][_0x0283('0x5f')]({'where':{'id':_0x1b9f4f[_0x0283('0x8a')]}});}return null;})[_0x0283('0x57')](handleEntityNotFound(_0x2a6efa,null))[_0x0283('0x57')](function(_0x15ffd7){if(_0x15ffd7){_0x129b28['interaction']=_0x15ffd7[_0x0283('0x89')]({'plain':!![]});interaction_log['info'](_0x0283('0x97'),_0x884264[_0x0283('0x76')]['id'],_0x884264[_0x0283('0x76')][_0x0283('0x41')],_0x884264[_0x0283('0x76')][_0x0283('0x98')],_0x129b28['interaction']['id'],_0x884264[_0x0283('0x61')]?JSON[_0x0283('0x2d')](_0x884264['body']):'null');return respondWithRpcPromise(_0x0283('0x99'),_0x0283('0x9a'),_0x129b28);}return null;})['then'](function(_0x42c9c2){if(_0x42c9c2){_0x42c9c2['message'][_0x0283('0x8f')]=util[_0x0283('0x81')]('SIP/%s',_0x884264[_0x0283('0x76')]['name']);_0x42c9c2[_0x0283('0x30')][_0x0283('0x91')]=_0x129b28[_0x0283('0x91')];_0x42c9c2[_0x0283('0x30')][_0x0283('0x92')]='reject';respondWithRpcPromise(_0x0283('0x93'),_0x0283('0x93'),{'event':_0x0283('0x9b'),'message':_0x42c9c2['message']},client9002);return _0x129b28;}return null;})[_0x0283('0x57')](respondWithResult(_0x2a6efa,null))[_0x0283('0x32')](handleError(_0x2a6efa,null));};exports[_0x0283('0x9c')]=function(_0x3311c4,_0x4d3f1b){var _0x5afe09=moment()[_0x0283('0x9d')]()['toString']();var _0x4b2ea7=path[_0x0283('0x78')](config['root'],'server',_0x0283('0x9e'),'tmp');var _0x5c948b=path[_0x0283('0x78')](config['root'],_0x0283('0x9f'),_0x0283('0x9e'),_0x0283('0x77'));var _0x4a6f9b=util[_0x0283('0x81')]('message-%s.eml',_0x5afe09);return db[_0x0283('0x44')][_0x0283('0x5f')]({'where':{'id':_0x3311c4[_0x0283('0x5d')]['id']},'attributes':['id',_0x0283('0x61'),'from','to','cc',_0x0283('0xa0'),_0x0283('0xa1'),_0x0283('0xa2')],'include':_0x3311c4[_0x0283('0x48')]['attachments']?[{'model':db['Attachment'],'as':_0x0283('0xa3')}]:undefined})[_0x0283('0x57')](handleEntityNotFound(_0x4d3f1b,null))[_0x0283('0x57')](function(_0x3e015b){if(_0x3e015b){var _0x1d6e35=_0x3e015b;var _0x280915={'from':_0x1d6e35['from'],'to':_0x1d6e35['to'],'subject':_0x1d6e35[_0x0283('0xa1')],'html':_0x1d6e35[_0x0283('0x61')],'headers':{'Date':moment(_0x1d6e35[_0x0283('0xa2')])[_0x0283('0x81')](_0x0283('0xa4'))},'attachments':[]};if(_0x3e015b['cc']){_0x280915[_0x0283('0xa5')]['Cc']=_0x3e015b['cc'];}if(_0x3e015b[_0x0283('0xa0')]){_0x280915[_0x0283('0xa5')][_0x0283('0xa6')]=_0x3e015b[_0x0283('0xa0')];}return new BPromise(function(_0x339c7c,_0x4c7aeb){if(_0x3e015b[_0x0283('0xa3')]){for(var _0x4438d6=0x0;_0x4438d6<_0x3e015b['Attachments']['length'];_0x4438d6++){var _0x56790f=_0x3e015b[_0x0283('0xa3')][_0x4438d6];var _0x3fcddc=path[_0x0283('0x78')](_0x5c948b,_0x56790f[_0x0283('0x7a')]);if(fs['existsSync'](_0x3fcddc)){_0x280915['attachments'][_0x0283('0xa7')]({'name':_0x56790f['name'],'contentType':_0x56790f[_0x0283('0x55')],'data':fs[_0x0283('0xa8')](_0x3fcddc)});}}}emlformat['build'](_0x280915,function(_0x211afd,_0x5877c5){if(_0x211afd)return _0x4c7aeb(_0x211afd);fs[_0x0283('0xa9')](path[_0x0283('0x78')](_0x4b2ea7,_0x4a6f9b),_0x5877c5);return _0x339c7c(_0x5877c5);});});}})['then'](function(_0x37d353){if(_0x37d353){return _0x4d3f1b[_0x0283('0x9c')](path['join'](_0x4b2ea7,_0x4a6f9b),_0x4a6f9b,function(_0x149257){if(_0x149257){console[_0x0283('0xaa')](_0x0283('0xab'),_0x149257);}else{fs[_0x0283('0xac')](path[_0x0283('0x78')](_0x4b2ea7,_0x4a6f9b));}});}})[_0x0283('0x32')](handleError(_0x4d3f1b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3396d17..68b310f 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 _0x6436=['hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6436,0x19c));var _0x6643=function(_0x35856b,_0x514529){_0x35856b=_0x35856b-0x0;var _0xd6884=_0x6436[_0x35856b];return _0xd6884;};'use strict';var EventEmitter=require(_0x6643('0x0'));var MailMessage=require(_0x6643('0x1'))['db'][_0x6643('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6643('0x3')](0x0);var events={'afterCreate':_0x6643('0x4'),'afterUpdate':_0x6643('0x5'),'afterDestroy':_0x6643('0x6')};function emitEvent(_0x37ac3e){return function(_0x5b234a,_0x3b01c5,_0x2153fe){MailMessageEvents['emit'](_0x37ac3e+':'+_0x5b234a['id'],_0x5b234a);MailMessageEvents[_0x6643('0x7')](_0x37ac3e,_0x5b234a);_0x2153fe(null);};}for(var e in events){if(events[_0x6643('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x6643('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xae39=['../../mysqldb','MailMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x1de0b9,_0xc6f046){var _0x18edae=function(_0x2d3ad1){while(--_0x2d3ad1){_0x1de0b9['push'](_0x1de0b9['shift']());}};_0x18edae(++_0xc6f046);}(_0xae39,0x13a));var _0x9ae3=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xae39[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require(_0x9ae3('0x0'));var MailMessage=require(_0x9ae3('0x1'))['db'][_0x9ae3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9ae3('0x3')](0x0);var events={'afterCreate':_0x9ae3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2491c6){return function(_0xd287b3,_0x2c6e3b,_0x23babf){MailMessageEvents[_0x9ae3('0x5')](_0x2491c6+':'+_0xd287b3['id'],_0xd287b3);MailMessageEvents[_0x9ae3('0x5')](_0x2491c6,_0xd287b3);_0x23babf(null);};}for(var e in events){if(events[_0x9ae3('0x6')](e)){var event=events[e];MailMessage[_0x9ae3('0x7')](e,emitEvent(event));}}module[_0x9ae3('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c1c2c50..e9121f7 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 _0x54b9=['request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x4b7953,_0x238740){var _0x33beec=function(_0x5bae94){while(--_0x5bae94){_0x4b7953['push'](_0x4b7953['shift']());}};_0x33beec(++_0x238740);}(_0x54b9,0x17c));var _0x954b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x54b9[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x954b('0x0'));var logger=require(_0x954b('0x1'))('api');var moment=require(_0x954b('0x2'));var BPromise=require(_0x954b('0x3'));var rp=require(_0x954b('0x4'));var htmlToText=require(_0x954b('0x5'));var fs=require('fs');var path=require(_0x954b('0x6'));var rimraf=require(_0x954b('0x7'));var config=require(_0x954b('0x8'));var attributes=require(_0x954b('0x9'));module['exports']=function(_0x505b83,_0x92b013){return _0x505b83[_0x954b('0xa')](_0x954b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x954b('0xc'),'fields':['messageId']},{'name':_0x954b('0xd'),'fields':[_0x954b('0xe'),_0x954b('0xf')],'type':_0x954b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2621e1,_0x463b72,_0x21a7eb){if(_0x2621e1[_0x954b('0x11')]){_0x2621e1[_0x954b('0xe')]=htmlToText['fromString'](_0x2621e1[_0x954b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x21a7eb(null,_0x463b72);},'afterCreate':function(_0x322034,_0x53b992,_0x155b83){var _0x5b19db=_0x505b83[_0x954b('0x12')];var _0x2ad4d8=_0x322034['get']({'plain':!![]});if(_0x2ad4d8[_0x954b('0x13')][_0x954b('0x14')]()==='in'||_0x2ad4d8[_0x954b('0x13')][_0x954b('0x14')]()==='out'&&!_0x2ad4d8[_0x954b('0x15')]&&!_[_0x954b('0x16')](_0x2ad4d8['UserId'])){_0x5b19db[_0x954b('0x17')][_0x954b('0x18')]({'where':{'id':_0x2ad4d8[_0x954b('0x19')]}})[_0x954b('0x1a')](function(_0x4b443e){if(_0x4b443e){_0x4b443e[_0x954b('0x1b')]({'lastMsgAt':_0x2ad4d8[_0x954b('0x1c')],'lastMsgDirection':_0x2ad4d8[_0x954b('0x13')][_0x954b('0x14')](),'lastMsgBody':_0x2ad4d8[_0x954b('0x11')]});}})[_0x954b('0x1d')](function(_0x4b04c3){console['error'](_0x4b04c3);});}_0x155b83();}},'charset':_0x954b('0x1e'),'collate':_0x954b('0x1f')});}; \ No newline at end of file +var _0x3d3e=['models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body'];(function(_0x31bafb,_0x470ec3){var _0x49d839=function(_0x5cfb40){while(--_0x5cfb40){_0x31bafb['push'](_0x31bafb['shift']());}};_0x49d839(++_0x470ec3);}(_0x3d3e,0x186));var _0xe3d3=function(_0x4b732a,_0x5e7c3c){_0x4b732a=_0x4b732a-0x0;var _0x216636=_0x3d3e[_0x4b732a];return _0x216636;};'use strict';var _=require(_0xe3d3('0x0'));var util=require('util');var logger=require(_0xe3d3('0x1'))(_0xe3d3('0x2'));var moment=require(_0xe3d3('0x3'));var BPromise=require(_0xe3d3('0x4'));var rp=require(_0xe3d3('0x5'));var htmlToText=require(_0xe3d3('0x6'));var fs=require('fs');var path=require(_0xe3d3('0x7'));var rimraf=require(_0xe3d3('0x8'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xe3d3('0x9')]=function(_0x3c59c0,_0x56895e){return _0x3c59c0[_0xe3d3('0xa')](_0xe3d3('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe3d3('0xc'),'fields':['messageId']},{'name':_0xe3d3('0xd'),'fields':[_0xe3d3('0xe'),_0xe3d3('0xf')],'type':_0xe3d3('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31cfe6,_0x309bd6,_0x590b1a){if(_0x31cfe6[_0xe3d3('0x11')]){_0x31cfe6[_0xe3d3('0xe')]=htmlToText['fromString'](_0x31cfe6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x590b1a(null,_0x309bd6);},'afterCreate':function(_0x1e1574,_0x4a2c0b,_0x539c2a){var _0x50ebf4=_0x3c59c0[_0xe3d3('0x12')];var _0x273262=_0x1e1574[_0xe3d3('0x13')]({'plain':!![]});if(_0x273262[_0xe3d3('0x14')]['toLowerCase']()==='in'||_0x273262[_0xe3d3('0x14')][_0xe3d3('0x15')]()===_0xe3d3('0x16')&&!_0x273262[_0xe3d3('0x17')]&&!_[_0xe3d3('0x18')](_0x273262['UserId'])){_0x50ebf4[_0xe3d3('0x19')][_0xe3d3('0x1a')]({'where':{'id':_0x273262[_0xe3d3('0x1b')]}})[_0xe3d3('0x1c')](function(_0x354dde){if(_0x354dde){_0x354dde[_0xe3d3('0x1d')]({'lastMsgAt':_0x273262[_0xe3d3('0x1e')],'lastMsgDirection':_0x273262['direction'][_0xe3d3('0x15')](),'lastMsgBody':_0x273262[_0xe3d3('0x11')]});}})[_0xe3d3('0x1f')](function(_0x138918){console['error'](_0x138918);});}_0x539c2a();}},'charset':_0xe3d3('0x20'),'collate':_0xe3d3('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e77249b..34ccc70 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 _0xbe52=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','debug','lodash','util','moment','bluebird'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xbe52,0x164));var _0x2be5=function(_0x358f4d,_0x110071){_0x358f4d=_0x358f4d-0x0;var _0xd6b732=_0xbe52[_0x358f4d];return _0xd6b732;};'use strict';var _=require(_0x2be5('0x0'));var util=require(_0x2be5('0x1'));var moment=require(_0x2be5('0x2'));var BPromise=require(_0x2be5('0x3'));var rs=require(_0x2be5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2be5('0x5'))['db'];var utils=require(_0x2be5('0x6'));var logger=require(_0x2be5('0x7'))(_0x2be5('0x8'));var config=require(_0x2be5('0x9'));var jayson=require(_0x2be5('0xa'));var client=jayson[_0x2be5('0xb')][_0x2be5('0xc')]({'port':0x232a});config[_0x2be5('0xd')]=_[_0x2be5('0xe')](config[_0x2be5('0xd')],{'host':_0x2be5('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2be5('0xd')]));require(_0x2be5('0x10'))[_0x2be5('0x11')](socket);function respondWithRpcPromise(_0x4ae600,_0x3f2b8f,_0x51515f){return new BPromise(function(_0x4c71ad,_0x3d4219){return client[_0x2be5('0x12')](_0x4ae600,_0x51515f)[_0x2be5('0x13')](function(_0xcb0182){logger['info'](_0x2be5('0x14'),_0x3f2b8f,_0x2be5('0x15'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3f2b8f,_0x2be5('0x15'),JSON[_0x2be5('0x16')](_0xcb0182));if(_0xcb0182['error']){if(_0xcb0182[_0x2be5('0x17')][_0x2be5('0x18')]===0x1f4){logger[_0x2be5('0x17')](_0x2be5('0x14'),_0x3f2b8f,_0xcb0182[_0x2be5('0x17')][_0x2be5('0x19')]);return _0x3d4219(_0xcb0182['error']['message']);}logger[_0x2be5('0x17')]('MailMessage,\x20%s,\x20%s',_0x3f2b8f,_0xcb0182[_0x2be5('0x17')]['message']);return _0x4c71ad(_0xcb0182[_0x2be5('0x17')][_0x2be5('0x19')]);}else{logger[_0x2be5('0x1a')]('MailMessage,\x20%s,\x20%s',_0x3f2b8f,_0x2be5('0x15'));_0x4c71ad(_0xcb0182[_0x2be5('0x1b')]['message']);}})[_0x2be5('0x1c')](function(_0x434f30){logger[_0x2be5('0x17')](_0x2be5('0x14'),_0x3f2b8f,_0x434f30);_0x3d4219(_0x434f30);});});}exports[_0x2be5('0x1d')]=function(_0x22d7c2){var _0x1044fb=this;return new Promise(function(_0x53749d,_0x514223){return db[_0x2be5('0x1e')][_0x2be5('0x1f')](_0x22d7c2[_0x2be5('0x20')],{'raw':_0x22d7c2[_0x2be5('0x21')]?_0x22d7c2['options'][_0x2be5('0x22')]===undefined?!![]:![]:!![]})[_0x2be5('0x13')](function(_0x2bbe9f){logger[_0x2be5('0x1a')](_0x2be5('0x1d'),_0x22d7c2);logger[_0x2be5('0x23')](_0x2be5('0x1d'),_0x22d7c2,JSON[_0x2be5('0x16')](_0x2bbe9f));_0x53749d(_0x2bbe9f);})[_0x2be5('0x1c')](function(_0x3e63ab){logger['error'](_0x2be5('0x1d'),_0x3e63ab[_0x2be5('0x19')],_0x22d7c2);_0x514223(_0x1044fb[_0x2be5('0x17')](0x1f4,_0x3e63ab['message']));});});}; \ No newline at end of file +var _0x1419=['request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','MailMessage','create','options','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0x1419,0x127));var _0x9141=function(_0x5a6a05,_0x48e5ba){_0x5a6a05=_0x5a6a05-0x0;var _0x5f457a=_0x1419[_0x5a6a05];return _0x5f457a;};'use strict';var _=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var moment=require(_0x9141('0x2'));var BPromise=require(_0x9141('0x3'));var rs=require(_0x9141('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9141('0x5'));var logger=require(_0x9141('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9141('0x7'));var client=jayson[_0x9141('0x8')][_0x9141('0x9')]({'port':0x232a});config[_0x9141('0xa')]=_[_0x9141('0xb')](config[_0x9141('0xa')],{'host':_0x9141('0xc'),'port':0x18eb});var socket=require(_0x9141('0xd'))(new Redis(config[_0x9141('0xa')]));require(_0x9141('0xe'))['register'](socket);function respondWithRpcPromise(_0xb3ee2e,_0x406153,_0x30ce0b){return new BPromise(function(_0x1de00d,_0x2d35e3){return client[_0x9141('0xf')](_0xb3ee2e,_0x30ce0b)[_0x9141('0x10')](function(_0x1847c4){logger[_0x9141('0x11')](_0x9141('0x12'),_0x406153,'request\x20sent');logger[_0x9141('0x13')](_0x9141('0x14'),_0x406153,_0x9141('0x15'),JSON[_0x9141('0x16')](_0x1847c4));if(_0x1847c4[_0x9141('0x17')]){if(_0x1847c4[_0x9141('0x17')]['code']===0x1f4){logger['error'](_0x9141('0x12'),_0x406153,_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);return _0x2d35e3(_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);}logger[_0x9141('0x17')](_0x9141('0x12'),_0x406153,_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);return _0x1de00d(_0x1847c4['error'][_0x9141('0x18')]);}else{logger[_0x9141('0x11')]('MailMessage,\x20%s,\x20%s',_0x406153,'request\x20sent');_0x1de00d(_0x1847c4[_0x9141('0x19')]['message']);}})['catch'](function(_0x4e5a9c){logger['error'](_0x9141('0x12'),_0x406153,_0x4e5a9c);_0x2d35e3(_0x4e5a9c);});});}exports['CreateMailMessage']=function(_0x493b8c){var _0x13e3e4=this;return new Promise(function(_0x4ef5c2,_0x165967){return db[_0x9141('0x1a')][_0x9141('0x1b')](_0x493b8c['body'],{'raw':_0x493b8c[_0x9141('0x1c')]?_0x493b8c['options']['raw']===undefined?!![]:![]:!![]})[_0x9141('0x10')](function(_0x3234ce){logger[_0x9141('0x11')](_0x9141('0x1d'),_0x493b8c);logger[_0x9141('0x13')](_0x9141('0x1d'),_0x493b8c,JSON[_0x9141('0x16')](_0x3234ce));_0x4ef5c2(_0x3234ce);})[_0x9141('0x1e')](function(_0x3fa7a3){logger[_0x9141('0x17')](_0x9141('0x1d'),_0x3fa7a3[_0x9141('0x18')],_0x493b8c);_0x165967(_0x13e3e4[_0x9141('0x17')](0x1f4,_0x3fa7a3[_0x9141('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 91b8cab..7c81b3e 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 _0xa63a=['mailMessage:','save','update','emit','register','length'];(function(_0x458f1e,_0x3f861e){var _0x416bfd=function(_0x4f29d1){while(--_0x4f29d1){_0x458f1e['push'](_0x458f1e['shift']());}};_0x416bfd(++_0x3f861e);}(_0xa63a,0xa9));var _0xaa63=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xa63a[_0x281e5e];return _0x5a22d2;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xaa63('0x0'),'remove',_0xaa63('0x1')];function createListener(_0x3ca960,_0x3e2e22){return function(_0x3bb03f){_0x3e2e22[_0xaa63('0x2')](_0x3ca960,_0x3bb03f);};}function removeListener(_0x6feaab,_0x147d30){return function(){MailMessageEvents['removeListener'](_0x6feaab,_0x147d30);};}exports[_0xaa63('0x3')]=function(_0x2ec2be){for(var _0x2ab942=0x0,_0x812704=events[_0xaa63('0x4')];_0x2ab942<_0x812704;_0x2ab942++){var _0x5cafb2=events[_0x2ab942];var _0x4b39f9=createListener(_0xaa63('0x5')+_0x5cafb2,_0x2ec2be);MailMessageEvents['on'](_0x5cafb2,_0x4b39f9);}}; \ No newline at end of file +var _0x1217=['mailMessage:','./mailMessage.events','save','update','emit','removeListener','register','length'];(function(_0x259925,_0x14a244){var _0x5183b0=function(_0x517e97){while(--_0x517e97){_0x259925['push'](_0x259925['shift']());}};_0x5183b0(++_0x14a244);}(_0x1217,0xb1));var _0x7121=function(_0x2e0f11,_0x247f28){_0x2e0f11=_0x2e0f11-0x0;var _0x34b484=_0x1217[_0x2e0f11];return _0x34b484;};'use strict';var MailMessageEvents=require(_0x7121('0x0'));var events=[_0x7121('0x1'),'remove',_0x7121('0x2')];function createListener(_0x4d9352,_0x7b4442){return function(_0x580cdc){_0x7b4442[_0x7121('0x3')](_0x4d9352,_0x580cdc);};}function removeListener(_0xb66b9e,_0x3086af){return function(){MailMessageEvents[_0x7121('0x4')](_0xb66b9e,_0x3086af);};}exports[_0x7121('0x5')]=function(_0xeee4bb){for(var _0x5e5359=0x0,_0x390060=events[_0x7121('0x6')];_0x5e5359<_0x390060;_0x5e5359++){var _0x2352b9=events[_0x5e5359];var _0x2d3c00=createListener(_0x7121('0x7')+_0x2352b9,_0xeee4bb);MailMessageEvents['on'](_0x2352b9,_0x2d3c00);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3d8830c..7672468 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 _0xd10c=['removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete'];(function(_0x342754,_0x555cef){var _0x3d74b2=function(_0x2fc202){while(--_0x2fc202){_0x342754['push'](_0x342754['shift']());}};_0x3d74b2(++_0x555cef);}(_0xd10c,0x77));var _0xcd10=function(_0x1a61e6,_0x24e726){_0x1a61e6=_0x1a61e6-0x0;var _0x354c91=_0xd10c[_0x1a61e6];return _0x354c91;};'use strict';var multer=require(_0xcd10('0x0'));var util=require(_0xcd10('0x1'));var path=require('path');var timeout=require(_0xcd10('0x2'));var express=require(_0xcd10('0x3'));var router=express[_0xcd10('0x4')]();var auth=require(_0xcd10('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd10('0x6'));var controller=require(_0xcd10('0x7'));router[_0xcd10('0x8')]('/',auth[_0xcd10('0x9')](),controller[_0xcd10('0xa')]);router[_0xcd10('0x8')](_0xcd10('0xb'),auth[_0xcd10('0x9')](),controller[_0xcd10('0xc')]);router[_0xcd10('0x8')](_0xcd10('0xd'),auth[_0xcd10('0x9')](),controller['show']);router[_0xcd10('0x8')](_0xcd10('0xe'),auth[_0xcd10('0x9')](),controller[_0xcd10('0xf')]);router[_0xcd10('0x8')](_0xcd10('0x10'),auth[_0xcd10('0x9')](),controller['getTeams']);router[_0xcd10('0x8')]('/:id/users',auth[_0xcd10('0x9')](),controller[_0xcd10('0x11')]);router[_0xcd10('0x12')]('/',auth[_0xcd10('0x9')](),controller[_0xcd10('0x13')]);router['post'](_0xcd10('0x10'),auth[_0xcd10('0x9')](),controller[_0xcd10('0x14')]);router['post']('/:id/users',auth[_0xcd10('0x9')](),controller[_0xcd10('0x15')]);router[_0xcd10('0x16')](_0xcd10('0xd'),auth['isAuthenticated'](),controller[_0xcd10('0x17')]);router['delete'](_0xcd10('0xd'),auth[_0xcd10('0x9')](),controller[_0xcd10('0x18')]);router[_0xcd10('0x19')](_0xcd10('0x10'),auth['isAuthenticated'](),controller[_0xcd10('0x1a')]);router[_0xcd10('0x19')]('/:id/users',auth[_0xcd10('0x9')](),controller[_0xcd10('0x1b')]);module[_0xcd10('0x1c')]=router; \ No newline at end of file +var _0x84ff=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x84ff,0x1a5));var _0xf84f=function(_0x4a15a5,_0x610c82){_0x4a15a5=_0x4a15a5-0x0;var _0x5b7f71=_0x84ff[_0x4a15a5];return _0x5b7f71;};'use strict';var multer=require(_0xf84f('0x0'));var util=require(_0xf84f('0x1'));var path=require(_0xf84f('0x2'));var timeout=require('connect-timeout');var express=require(_0xf84f('0x3'));var router=express[_0xf84f('0x4')]();var auth=require(_0xf84f('0x5'));var interaction=require(_0xf84f('0x6'));var config=require(_0xf84f('0x7'));var controller=require('./mailQueue.controller');router[_0xf84f('0x8')]('/',auth['isAuthenticated'](),controller[_0xf84f('0x9')]);router[_0xf84f('0x8')](_0xf84f('0xa'),auth['isAuthenticated'](),controller[_0xf84f('0xb')]);router['get']('/:id',auth[_0xf84f('0xc')](),controller[_0xf84f('0xd')]);router[_0xf84f('0x8')](_0xf84f('0xe'),auth[_0xf84f('0xc')](),controller[_0xf84f('0xf')]);router[_0xf84f('0x8')](_0xf84f('0x10'),auth[_0xf84f('0xc')](),controller[_0xf84f('0x11')]);router[_0xf84f('0x8')](_0xf84f('0x12'),auth['isAuthenticated'](),controller[_0xf84f('0x13')]);router[_0xf84f('0x14')]('/',auth['isAuthenticated'](),controller[_0xf84f('0x15')]);router[_0xf84f('0x14')](_0xf84f('0x10'),auth[_0xf84f('0xc')](),controller[_0xf84f('0x16')]);router[_0xf84f('0x14')](_0xf84f('0x12'),auth[_0xf84f('0xc')](),controller['addAgents']);router[_0xf84f('0x17')](_0xf84f('0x18'),auth[_0xf84f('0xc')](),controller[_0xf84f('0x19')]);router['delete'](_0xf84f('0x18'),auth[_0xf84f('0xc')](),controller['destroy']);router[_0xf84f('0x1a')](_0xf84f('0x10'),auth['isAuthenticated'](),controller[_0xf84f('0x1b')]);router[_0xf84f('0x1a')](_0xf84f('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xf84f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ed8a971..cf18f54 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 _0x4c0c=['beepall','sequelize','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c0c,0xef));var _0xc4c0=function(_0x348475,_0x8b8b4e){_0x348475=_0x348475-0x0;var _0x39d1b2=_0x4c0c[_0x348475];return _0x39d1b2;};'use strict';var Sequelize=require(_0xc4c0('0x0'));module[_0xc4c0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc4c0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc4c0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc4c0('0x4')](_0xc4c0('0x5'),_0xc4c0('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x4c50=['STRING','name','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x897e0c,_0xf33eef){var _0x5edebf=function(_0x58babd){while(--_0x58babd){_0x897e0c['push'](_0x897e0c['shift']());}};_0x5edebf(++_0xf33eef);}(_0x4c50,0x10f));var _0x04c5=function(_0x191c3f,_0x30cc46){_0x191c3f=_0x191c3f-0x0;var _0xd83e90=_0x4c50[_0x191c3f];return _0xd83e90;};'use strict';var Sequelize=require(_0x04c5('0x0'));module[_0x04c5('0x1')]={'name':{'type':Sequelize[_0x04c5('0x2')],'unique':_0x04c5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x04c5('0x2')]},'timeout':{'type':Sequelize[_0x04c5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x04c5('0x5')]('rrmemory','beepall',_0x04c5('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a4de360..026c76a 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 _0x6422=['save','destroy','then','get','MailQueues','UserProfileResource','name','map','MailQueue','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','length','find','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','rawAttributes','sort','MailQueueId','options','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','addTeams','Agents','online','transaction','each','UserMailQueue','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','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','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6422,0x64));var _0x2642=function(_0x31567e,_0x26c7d6){_0x31567e=_0x31567e-0x0;var _0x267b32=_0x6422[_0x31567e];return _0x267b32;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2642('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2642('0x1'));var rp=require('request-promise');var moment=require(_0x2642('0x2'));var BPromise=require(_0x2642('0x3'));var Mustache=require(_0x2642('0x4'));var util=require(_0x2642('0x5'));var path=require(_0x2642('0x6'));var sox=require(_0x2642('0x7'));var csv=require(_0x2642('0x8'));var ejs=require(_0x2642('0x9'));var fs=require('fs');var _=require(_0x2642('0xa'));var squel=require(_0x2642('0xb'));var crypto=require(_0x2642('0xc'));var jsforce=require(_0x2642('0xd'));var deskjs=require(_0x2642('0xe'));var toCsv=require(_0x2642('0x8'));var querystring=require(_0x2642('0xf'));var Papa=require(_0x2642('0x10'));var Redis=require(_0x2642('0x11'));var authService=require(_0x2642('0x12'));var qs=require(_0x2642('0x13'));var as=require(_0x2642('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2642('0x15'))(_0x2642('0x16'));var utils=require(_0x2642('0x17'));var config=require(_0x2642('0x18'));var db=require(_0x2642('0x19'))['db'];config[_0x2642('0x1a')]=_[_0x2642('0x1b')](config[_0x2642('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2642('0x1c'))(new Redis(config[_0x2642('0x1a')]));require(_0x2642('0x1d'))[_0x2642('0x1e')](socket);function respondWithStatusCode(_0x332752,_0x1be219){_0x1be219=_0x1be219||0xcc;return function(_0xdf370){if(_0xdf370){return _0x332752[_0x2642('0x1f')](_0x1be219);}return _0x332752[_0x2642('0x20')](_0x1be219)[_0x2642('0x21')]();};}function respondWithResult(_0x447e26,_0x57b192){_0x57b192=_0x57b192||0xc8;return function(_0x1b6a4d){if(_0x1b6a4d){return _0x447e26[_0x2642('0x20')](_0x57b192)['json'](_0x1b6a4d);}};}function respondWithFilteredResult(_0x1a28db,_0x5a6849){return function(_0x290580){if(_0x290580){var _0x2883df=_0x290580[_0x2642('0x22')],_0x42ca71=_0x5a6849[_0x2642('0x23')],_0x46746e=_0x5a6849['offset']+_0x5a6849['limit'],_0x306f2b;if(_0x46746e>=_0x2883df){_0x46746e=_0x2883df;_0x306f2b=0xc8;}else{_0x306f2b=0xce;}_0x1a28db[_0x2642('0x20')](_0x306f2b);return _0x1a28db[_0x2642('0x24')](_0x2642('0x25'),_0x42ca71+'-'+_0x46746e+'/'+_0x2883df)['json'](_0x290580);}return null;};}function patchUpdates(_0x797a4b){return function(_0x219a01){try{jsonpatch['apply'](_0x219a01,_0x797a4b,!![]);}catch(_0xcfbfe5){return BPromise[_0x2642('0x26')](_0xcfbfe5);}return _0x219a01[_0x2642('0x27')]();};}function saveUpdates(_0x5e17b4,_0x5bbd35){return function(_0x13d902){if(_0x13d902){return _0x13d902['update'](_0x5e17b4)['then'](function(_0x2835ea){return _0x2835ea;});}return null;};}function removeEntity(_0x1fdd53,_0x1b64c7){return function(_0x492fb9){if(_0x492fb9){return _0x492fb9[_0x2642('0x28')]()[_0x2642('0x29')](function(){var _0x2239ba=_0x492fb9[_0x2642('0x2a')]({'plain':!![]});var _0x72a7ed=_0x2642('0x2b');return db[_0x2642('0x2c')]['destroy']({'where':{'type':_0x72a7ed,'resourceId':_0x2239ba['id']}})[_0x2642('0x29')](function(){return _0x492fb9;});})[_0x2642('0x29')](function(){_0x1fdd53[_0x2642('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd707d2,_0x116018){return function(_0x4a33f6){if(!_0x4a33f6){_0xd707d2[_0x2642('0x1f')](0x194);}return _0x4a33f6;};}function handleError(_0x25e795,_0x224972){_0x224972=_0x224972||0x1f4;return function(_0x1d19ac){logger['error'](_0x1d19ac['stack']);if(_0x1d19ac[_0x2642('0x2d')]){delete _0x1d19ac['name'];}_0x25e795[_0x2642('0x20')](_0x224972)['send'](_0x1d19ac);};}exports['index']=function(_0x3b3c6e,_0x59b3fe){var _0x540268={},_0x23af62={},_0x4544b0={'count':0x0,'rows':[]};var _0x49bbb1=_[_0x2642('0x2e')](db[_0x2642('0x2f')]['rawAttributes'],function(_0xa59d3f){return{'name':_0xa59d3f['fieldName'],'type':_0xa59d3f[_0x2642('0x30')][_0x2642('0x31')]};});_0x23af62[_0x2642('0x32')]=_[_0x2642('0x2e')](_0x49bbb1,_0x2642('0x2d'));_0x23af62[_0x2642('0x33')]=_[_0x2642('0x34')](_0x3b3c6e[_0x2642('0x33')]);_0x23af62[_0x2642('0x35')]=_[_0x2642('0x36')](_0x23af62['model'],_0x23af62[_0x2642('0x33')]);_0x540268[_0x2642('0x37')]=_['intersection'](_0x23af62[_0x2642('0x32')],qs[_0x2642('0x38')](_0x3b3c6e[_0x2642('0x33')][_0x2642('0x38')]));_0x540268[_0x2642('0x37')]=_0x540268[_0x2642('0x37')]['length']?_0x540268[_0x2642('0x37')]:_0x23af62[_0x2642('0x32')];if(!_0x3b3c6e[_0x2642('0x33')][_0x2642('0x39')](_0x2642('0x3a'))){_0x540268[_0x2642('0x3b')]=qs[_0x2642('0x3b')](_0x3b3c6e[_0x2642('0x33')][_0x2642('0x3b')]);_0x540268[_0x2642('0x23')]=qs[_0x2642('0x23')](_0x3b3c6e['query']['offset']);}_0x540268[_0x2642('0x3c')]=qs['sort'](_0x3b3c6e['query']['sort']);_0x540268['where']=qs[_0x2642('0x35')](_[_0x2642('0x3d')](_0x3b3c6e[_0x2642('0x33')],_0x23af62['filters']),_0x49bbb1);if(_0x3b3c6e[_0x2642('0x33')][_0x2642('0x3e')]){_0x540268[_0x2642('0x3f')]=_[_0x2642('0x40')](_0x540268[_0x2642('0x3f')],{'$or':_[_0x2642('0x2e')](_0x49bbb1,function(_0x279a14){if(_0x279a14[_0x2642('0x30')]!==_0x2642('0x41')){var _0x3be7fd={};_0x3be7fd[_0x279a14[_0x2642('0x2d')]]={'$like':'%'+_0x3b3c6e[_0x2642('0x33')]['filter']+'%'};return _0x3be7fd;}})});}_0x540268=_[_0x2642('0x40')]({},_0x540268,_0x3b3c6e['options']);var _0x5b174f={'where':_0x540268['where']};return db[_0x2642('0x2f')]['count'](_0x5b174f)['then'](function(_0x44b50b){_0x4544b0[_0x2642('0x22')]=_0x44b50b;if(_0x3b3c6e[_0x2642('0x33')][_0x2642('0x42')]){_0x540268[_0x2642('0x43')]=[{'all':!![]}];}return db[_0x2642('0x2f')][_0x2642('0x44')](_0x540268);})[_0x2642('0x29')](function(_0x4240e0){_0x4544b0['rows']=_0x4240e0;return _0x4544b0;})[_0x2642('0x29')](respondWithFilteredResult(_0x59b3fe,_0x540268))[_0x2642('0x45')](handleError(_0x59b3fe,null));};exports['show']=function(_0x125a0c,_0x55baaa){var _0x389c72={'raw':!![],'where':{'id':_0x125a0c['params']['id']}},_0x309305={};_0x309305[_0x2642('0x32')]=_[_0x2642('0x34')](db[_0x2642('0x2f')]['rawAttributes']);_0x309305[_0x2642('0x33')]=_[_0x2642('0x34')](_0x125a0c[_0x2642('0x33')]);_0x309305[_0x2642('0x35')]=_[_0x2642('0x36')](_0x309305[_0x2642('0x32')],_0x309305['query']);_0x389c72[_0x2642('0x37')]=_['intersection'](_0x309305['model'],qs['fields'](_0x125a0c['query']['fields']));_0x389c72['attributes']=_0x389c72[_0x2642('0x37')][_0x2642('0x46')]?_0x389c72[_0x2642('0x37')]:_0x309305[_0x2642('0x32')];if(_0x125a0c[_0x2642('0x33')]['includeAll']){_0x389c72[_0x2642('0x43')]=[{'all':!![]}];}_0x389c72=_[_0x2642('0x40')]({},_0x389c72,_0x125a0c['options']);return db[_0x2642('0x2f')][_0x2642('0x47')](_0x389c72)['then'](handleEntityNotFound(_0x55baaa,null))[_0x2642('0x29')](respondWithResult(_0x55baaa,null))[_0x2642('0x45')](handleError(_0x55baaa,null));};exports['create']=function(_0x4d226a,_0x52f980){return db[_0x2642('0x2f')][_0x2642('0x48')](_0x4d226a[_0x2642('0x49')],{})[_0x2642('0x29')](function(_0x2c96ac){var _0x2d9aca=_0x4d226a['user']['get']({'plain':!![]});if(!_0x2d9aca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9aca[_0x2642('0x4a')]===_0x2642('0x4b')){var _0x163952=_0x2c96ac[_0x2642('0x2a')]({'plain':!![]});var _0x5ea5c7=_0x2642('0x2b');return db['UserProfileSection'][_0x2642('0x47')]({'where':{'name':_0x5ea5c7,'userProfileId':_0x2d9aca[_0x2642('0x4c')]},'raw':!![]})[_0x2642('0x29')](function(_0x2e86ff){if(_0x2e86ff&&_0x2e86ff[_0x2642('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x163952['name'],'resourceId':_0x163952['id'],'type':_0x2e86ff[_0x2642('0x2d')],'sectionId':_0x2e86ff['id']},{})['then'](function(){return _0x2c96ac;});}else{return _0x2c96ac;}})['catch'](function(_0x1cf2ce){logger['error'](_0x2642('0x4e'),_0x1cf2ce);throw _0x1cf2ce;});}return _0x2c96ac;})[_0x2642('0x29')](respondWithResult(_0x52f980,0xc9))[_0x2642('0x45')](handleError(_0x52f980,null));};exports[_0x2642('0x4f')]=function(_0x1ca3b2,_0xbad75b){if(_0x1ca3b2[_0x2642('0x49')]['id']){delete _0x1ca3b2[_0x2642('0x49')]['id'];}return db[_0x2642('0x2f')][_0x2642('0x47')]({'where':{'id':_0x1ca3b2['params']['id']}})[_0x2642('0x29')](handleEntityNotFound(_0xbad75b,null))['then'](saveUpdates(_0x1ca3b2[_0x2642('0x49')],null))[_0x2642('0x29')](respondWithResult(_0xbad75b,null))[_0x2642('0x45')](handleError(_0xbad75b,null));};exports[_0x2642('0x28')]=function(_0x2bc332,_0xbc15ad){return db['MailQueue']['find']({'where':{'id':_0x2bc332[_0x2642('0x50')]['id']}})['then'](handleEntityNotFound(_0xbc15ad,null))[_0x2642('0x29')](removeEntity(_0xbc15ad,null))['catch'](handleError(_0xbc15ad,null));};exports[_0x2642('0x51')]=function(_0x397596,_0x205177){return db[_0x2642('0x2f')][_0x2642('0x51')]()['then'](respondWithResult(_0x205177,null))[_0x2642('0x45')](handleError(_0x205177,null));};exports[_0x2642('0x52')]=function(_0x45a232,_0x4781b9,_0x5260b3){var _0x315b9d={'raw':!![],'where':{}},_0x40c4d4={},_0x49eca2;return db[_0x2642('0x2f')][_0x2642('0x53')]({'where':{'id':_0x45a232['params']['id']}})[_0x2642('0x29')](handleEntityNotFound(_0x4781b9,null))[_0x2642('0x29')](function(_0x54f3f4){if(_0x54f3f4){_0x49eca2=_0x54f3f4[_0x2642('0x2a')]({'plain':!![]});_0x40c4d4[_0x2642('0x32')]=_[_0x2642('0x34')](db['UserMailQueue'][_0x2642('0x54')]);_0x40c4d4['query']=_[_0x2642('0x34')](_0x45a232[_0x2642('0x33')]);_0x40c4d4[_0x2642('0x35')]=_[_0x2642('0x36')](_0x40c4d4[_0x2642('0x32')],_0x40c4d4[_0x2642('0x33')]);_0x315b9d[_0x2642('0x37')]=_['intersection'](_0x40c4d4[_0x2642('0x32')],qs[_0x2642('0x38')](_0x45a232[_0x2642('0x33')][_0x2642('0x38')]));_0x315b9d[_0x2642('0x37')]=_0x315b9d['attributes'][_0x2642('0x46')]?_0x315b9d['attributes']:_0x40c4d4[_0x2642('0x32')];if(!_0x45a232['query'][_0x2642('0x39')](_0x2642('0x3a'))){_0x315b9d['limit']=qs[_0x2642('0x3b')](_0x45a232[_0x2642('0x33')]['limit']);_0x315b9d['offset']=qs[_0x2642('0x23')](_0x45a232[_0x2642('0x33')][_0x2642('0x23')]);}_0x315b9d[_0x2642('0x3c')]=qs['sort'](_0x45a232[_0x2642('0x33')][_0x2642('0x55')]);_0x315b9d[_0x2642('0x3f')]=qs[_0x2642('0x35')](_[_0x2642('0x3d')](_0x45a232['query'],_0x40c4d4[_0x2642('0x35')]));_0x315b9d['where'][_0x2642('0x56')]=_0x54f3f4['id'];if(_0x45a232[_0x2642('0x33')][_0x2642('0x3e')]){_0x315b9d[_0x2642('0x3f')]=_[_0x2642('0x40')](_0x315b9d[_0x2642('0x3f')],{'$or':_['map'](_0x315b9d[_0x2642('0x37')],function(_0x45a826){var _0x472685={};_0x472685[_0x45a826]={'$like':'%'+_0x45a232[_0x2642('0x33')][_0x2642('0x3e')]+'%'};return _0x472685;})});}_0x315b9d=_[_0x2642('0x40')]({},_0x315b9d,_0x45a232[_0x2642('0x57')]);return db['UserMailQueue'][_0x2642('0x44')](_0x315b9d);}})[_0x2642('0x29')](function(_0x515637){if(_0x515637){return db[_0x2642('0x58')][_0x2642('0x59')]({'where':{'id':_[_0x2642('0x2e')](_0x515637,_0x2642('0x5a')),'role':_0x2642('0x5b')},'attributes':['id',_0x2642('0x2d'),_0x2642('0x5c'),_0x2642('0x5d'),_0x2642('0x5e')]});}})[_0x2642('0x29')](function(_0x32c6cc){if(_0x32c6cc){return{'count':_0x32c6cc['count'],'rows':_[_0x2642('0x2e')](_0x32c6cc[_0x2642('0x5f')],function(_0x4e0ba5){return{'membername':_0x4e0ba5['name'],'UserId':_0x4e0ba5['id'],'queue_name':_0x49eca2[_0x2642('0x2d')],'MailQueueId':_0x49eca2['id'],'interface':util[_0x2642('0x60')](_0x2642('0x61'),_0x2642('0x62'),_0x4e0ba5['name']),'penalty':0x0,'paused':_0x4e0ba5['mailPause'],'createdAt':_0x4e0ba5[_0x2642('0x5e')],'updatedAt':_0x4e0ba5[_0x2642('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2642('0x29')](respondWithFilteredResult(_0x4781b9,_0x315b9d))['catch'](handleError(_0x4781b9,null));};exports['getTeams']=function(_0x3348b2,_0x695cb3,_0x5becbb){var _0x289bce={};var _0x2cb82c={};var _0x536e21;var _0x114e53;return db[_0x2642('0x2f')][_0x2642('0x53')]({'where':{'id':_0x3348b2['params']['id']}})['then'](handleEntityNotFound(_0x695cb3,null))[_0x2642('0x29')](function(_0x3c7d34){if(_0x3c7d34){_0x536e21=_0x3c7d34;_0x2cb82c[_0x2642('0x32')]=_['keys'](db[_0x2642('0x63')][_0x2642('0x54')]);_0x2cb82c[_0x2642('0x33')]=_['keys'](_0x3348b2['query']);_0x2cb82c[_0x2642('0x35')]=_[_0x2642('0x36')](_0x2cb82c[_0x2642('0x32')],_0x2cb82c['query']);_0x289bce[_0x2642('0x37')]=_[_0x2642('0x36')](_0x2cb82c[_0x2642('0x32')],qs[_0x2642('0x38')](_0x3348b2['query'][_0x2642('0x38')]));_0x289bce[_0x2642('0x37')]=_0x289bce['attributes'][_0x2642('0x46')]?_0x289bce[_0x2642('0x37')]:_0x2cb82c[_0x2642('0x32')];_0x289bce['order']=qs[_0x2642('0x55')](_0x3348b2['query']['sort']);_0x289bce[_0x2642('0x3f')]=qs[_0x2642('0x35')](_[_0x2642('0x3d')](_0x3348b2[_0x2642('0x33')],_0x2cb82c[_0x2642('0x35')]));if(_0x3348b2[_0x2642('0x33')][_0x2642('0x3e')]){_0x289bce['where']=_[_0x2642('0x40')](_0x289bce['where'],{'$or':_['map'](_0x289bce[_0x2642('0x37')],function(_0x23fde3){var _0x1c5479={};_0x1c5479[_0x23fde3]={'$like':'%'+_0x3348b2[_0x2642('0x33')][_0x2642('0x3e')]+'%'};return _0x1c5479;})});}_0x289bce=_['merge']({},_0x289bce,_0x3348b2[_0x2642('0x57')]);return _0x536e21['getTeams'](_0x289bce);}})[_0x2642('0x29')](function(_0x25792d){if(_0x25792d){_0x114e53=_0x25792d[_0x2642('0x46')];if(!_0x3348b2[_0x2642('0x33')][_0x2642('0x39')]('nolimit')){_0x289bce[_0x2642('0x3b')]=qs[_0x2642('0x3b')](_0x3348b2[_0x2642('0x33')][_0x2642('0x3b')]);_0x289bce[_0x2642('0x23')]=qs[_0x2642('0x23')](_0x3348b2[_0x2642('0x33')]['offset']);}return _0x536e21['getTeams'](_0x289bce);}})[_0x2642('0x29')](function(_0x28320b){if(_0x28320b){return _0x28320b?{'count':_0x114e53,'rows':_0x28320b}:null;}})[_0x2642('0x29')](respondWithResult(_0x695cb3,null))['catch'](handleError(_0x695cb3,null));};exports[_0x2642('0x64')]=function(_0x391772,_0x1b9b31,_0x1b9b71){var _0x1f493a=_0x391772[_0x2642('0x49')]['ids'];return db[_0x2642('0x63')][_0x2642('0x44')]({'where':{'id':_0x1f493a},'attributes':['id'],'include':[{'model':db[_0x2642('0x58')],'as':_0x2642('0x65'),'attributes':['id',_0x2642('0x2d'),_0x2642('0x66'),'voicePause','interface'],'raw':!![]}]})[_0x2642('0x29')](function(_0x912d37){if(_0x912d37){var _0x9a9f7=_['flatMap'](_0x912d37,function(_0x21b511){var _0x2dae3b=_0x21b511[_0x2642('0x2a')]({'plain':!![]});return _0x2dae3b[_0x2642('0x65')];});return db[_0x2642('0x2f')][_0x2642('0x47')]({'where':{'id':_0x391772[_0x2642('0x50')]['id']}})[_0x2642('0x29')](function(_0x2527d6){return db['sequelize'][_0x2642('0x67')](function(_0x522fff){return _0x2527d6[_0x2642('0x64')](_0x1f493a,{'transaction':_0x522fff})[_0x2642('0x29')](function(){return BPromise[_0x2642('0x68')](_0x9a9f7,function(_0x2ca7b1){return db[_0x2642('0x69')][_0x2642('0x6a')]({'where':{'UserId':_0x2ca7b1['id'],'MailQueueId':_0x391772[_0x2642('0x50')]['id']},'transaction':_0x522fff});});})[_0x2642('0x29')](function(){_0x9a9f7[_0x2642('0x6b')](function(_0x564981){socket['emit'](_0x2642('0x6c'),{'UserId':_0x564981['id'],'MailQueueId':_0x2527d6['id']});});});});});}})[_0x2642('0x29')](respondWithStatusCode(_0x1b9b31,null))[_0x2642('0x45')](handleError(_0x1b9b31,null));};exports[_0x2642('0x6d')]=function(_0xb23a1f,_0x40692a,_0x449dfc){return db[_0x2642('0x63')]['findAll']({'where':{'id':_0xb23a1f[_0x2642('0x33')][_0x2642('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x2642('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2642('0x29')](handleEntityNotFound(_0x40692a,null))[_0x2642('0x29')](function(_0x394645){var _0x8e081a=_[_0x2642('0x2e')](_0x394645,'id');var _0x16bce4=[];var _0x54fd9f=[];var _0x4c82e0=squel[_0x2642('0x6f')]();_0x4c82e0[_0x2642('0x70')](_0x2642('0x71'))[_0x2642('0x72')](_0x2642('0x73'),'tq')['join'](_0x2642('0x74'),'ut',_0x2642('0x75'))[_0x2642('0x3f')](_0x2642('0x76'),_0xb23a1f['params']['id']);for(var _0x4ce0ab=0x0;_0x4ce0ab<_0x394645['length'];_0x4ce0ab+=0x1){let _0x2151d4=_0x394645[_0x4ce0ab];for(var _0x59fa05=0x0;_0x59fa05<_0x2151d4[_0x2642('0x65')][_0x2642('0x46')];_0x59fa05+=0x1){let _0x4bb905=_0x2151d4[_0x2642('0x65')][_0x59fa05];var _0x2e1087=_0x4c82e0[_0x2642('0x77')]();_0x2e1087[_0x2642('0x3f')](_0x2642('0x78'),_0x4bb905['id']);_0x54fd9f[_0x2642('0x79')](db[_0x2642('0x7a')]['query'](_0x2e1087['toString'](),{'type':db[_0x2642('0x7a')]['QueryTypes'][_0x2642('0x7b')]})[_0x2642('0x29')](function(_0x3e0689){if(_0x3e0689[_0x2642('0x46')]===0x1){return _0x4bb905['id'];}else{var _0x1093a4=_['every'](_[_0x2642('0x2e')](_0x3e0689,_0x2642('0x7c')),function(_0x3c597a){return _[_0x2642('0x7d')](_0x8e081a,_0x3c597a);});if(_0x1093a4){return _0x4bb905['id'];}}}));}}return BPromise[_0x2642('0x7e')](_0x54fd9f)[_0x2642('0x29')](function(_0x19bf91){_0x16bce4=_(_0x16bce4)[_0x2642('0x7f')](_0x19bf91)[_0x2642('0x80')]()[_0x2642('0x81')]();return db[_0x2642('0x2f')][_0x2642('0x47')]({'where':{'id':_0xb23a1f['params']['id']}})[_0x2642('0x29')](function(_0x3f4f18){return db[_0x2642('0x7a')][_0x2642('0x67')](function(_0x2e2a0e){return _0x3f4f18[_0x2642('0x6d')](_0xb23a1f[_0x2642('0x33')][_0x2642('0x6e')],{'transaction':_0x2e2a0e})[_0x2642('0x29')](function(){if(!_[_0x2642('0x82')](_0x16bce4)){return _0x3f4f18[_0x2642('0x83')](_0x16bce4,{'transaction':_0x2e2a0e});}})[_0x2642('0x29')](function(){_0x16bce4['forEach'](function(_0x106d13){socket[_0x2642('0x84')](_0x2642('0x85'),{'UserId':_0x106d13,'MailQueueId':_0x3f4f18['id']});});});});});});})[_0x2642('0x29')](respondWithStatusCode(_0x40692a,null))[_0x2642('0x45')](handleError(_0x40692a,null));};exports['addAgents']=function(_0x19542c,_0xa49e96,_0x33b8b2){return db[_0x2642('0x2f')][_0x2642('0x47')]({'where':{'id':_0x19542c[_0x2642('0x50')]['id']}})[_0x2642('0x29')](handleEntityNotFound(_0xa49e96,null))[_0x2642('0x29')](function(_0x387fd4){if(_0x387fd4){return _0x387fd4[_0x2642('0x86')](_0x19542c['body'][_0x2642('0x6e')],_[_0x2642('0x87')](_0x19542c['body'],[_0x2642('0x6e'),'id'])||{})[_0x2642('0x88')](function(_0x26a2f8){for(var _0x39cf19=0x0;_0x39cf19<_0x19542c[_0x2642('0x49')]['ids'][_0x2642('0x46')];_0x39cf19+=0x1){socket[_0x2642('0x84')](_0x2642('0x6c'),{'UserId':_0x19542c['body'][_0x2642('0x6e')][_0x39cf19],'MailQueueId':_0x19542c[_0x2642('0x50')]['id']});}return _0x26a2f8;});}})[_0x2642('0x29')](respondWithResult(_0xa49e96,null))['catch'](handleError(_0xa49e96,null));};exports[_0x2642('0x83')]=function(_0x27951f,_0x16871c,_0x425f52){return db['MailQueue'][_0x2642('0x47')]({'where':{'id':_0x27951f[_0x2642('0x50')]['id']}})[_0x2642('0x29')](handleEntityNotFound(_0x16871c,null))[_0x2642('0x29')](function(_0x4cf80c){if(_0x4cf80c){return _0x4cf80c['removeAgents'](_0x27951f[_0x2642('0x33')][_0x2642('0x6e')])['then'](function(){if(_[_0x2642('0x89')](_0x27951f[_0x2642('0x33')]['ids'])){for(var _0xfc5cf7=0x0;_0xfc5cf7<_0x27951f[_0x2642('0x33')][_0x2642('0x6e')][_0x2642('0x46')];_0xfc5cf7+=0x1){socket[_0x2642('0x84')](_0x2642('0x85'),{'UserId':Number(_0x27951f[_0x2642('0x33')][_0x2642('0x6e')][_0xfc5cf7]),'MailQueueId':Number(_0x27951f[_0x2642('0x50')]['id'])});}}else{socket[_0x2642('0x84')](_0x2642('0x85'),{'UserId':Number(_0x27951f[_0x2642('0x33')]['ids']),'MailQueueId':Number(_0x27951f[_0x2642('0x50')]['id'])});}});}})[_0x2642('0x29')](respondWithStatusCode(_0x16871c,null))['catch'](handleError(_0x16871c,null));};exports[_0x2642('0x8a')]=function(_0x3be152,_0x4f32d3,_0x5687ed){var _0x1c39ec={};var _0xa4857c={};var _0x155928;var _0xdfabcf;return db[_0x2642('0x2f')][_0x2642('0x53')]({'where':{'id':_0x3be152['params']['id']}})[_0x2642('0x29')](handleEntityNotFound(_0x4f32d3,null))[_0x2642('0x29')](function(_0x341765){if(_0x341765){_0x155928=_0x341765;_0xa4857c[_0x2642('0x32')]=_[_0x2642('0x34')](db['User'][_0x2642('0x54')]);_0xa4857c[_0x2642('0x33')]=_[_0x2642('0x34')](_0x3be152[_0x2642('0x33')]);_0xa4857c[_0x2642('0x35')]=_[_0x2642('0x36')](_0xa4857c[_0x2642('0x32')],_0xa4857c[_0x2642('0x33')]);_0x1c39ec[_0x2642('0x37')]=_[_0x2642('0x36')](_0xa4857c[_0x2642('0x32')],qs['fields'](_0x3be152[_0x2642('0x33')][_0x2642('0x38')]));_0x1c39ec['attributes']=_0x1c39ec[_0x2642('0x37')][_0x2642('0x46')]?_0x1c39ec[_0x2642('0x37')]:_0xa4857c[_0x2642('0x32')];_0x1c39ec[_0x2642('0x3c')]=qs[_0x2642('0x55')](_0x3be152[_0x2642('0x33')][_0x2642('0x55')]);_0x1c39ec[_0x2642('0x3f')]=qs[_0x2642('0x35')](_['pick'](_0x3be152[_0x2642('0x33')],_0xa4857c[_0x2642('0x35')]));if(_0x3be152['query'][_0x2642('0x3e')]){_0x1c39ec[_0x2642('0x3f')]=_[_0x2642('0x40')](_0x1c39ec['where'],{'$or':_[_0x2642('0x2e')](_0x1c39ec['attributes'],function(_0x45c5ed){var _0x417913={};_0x417913[_0x45c5ed]={'$like':'%'+_0x3be152['query'][_0x2642('0x3e')]+'%'};return _0x417913;})});}_0x1c39ec=_[_0x2642('0x40')]({},_0x1c39ec,_0x3be152[_0x2642('0x57')]);return _0x155928[_0x2642('0x8a')](_0x1c39ec);}})[_0x2642('0x29')](function(_0x35489b){if(_0x35489b){_0xdfabcf=_0x35489b[_0x2642('0x46')];if(!_0x3be152[_0x2642('0x33')]['hasOwnProperty'](_0x2642('0x3a'))){_0x1c39ec['limit']=qs[_0x2642('0x3b')](_0x3be152[_0x2642('0x33')][_0x2642('0x3b')]);_0x1c39ec['offset']=qs['offset'](_0x3be152[_0x2642('0x33')][_0x2642('0x23')]);}return _0x155928[_0x2642('0x8a')](_0x1c39ec);}})[_0x2642('0x29')](function(_0x2550af){if(_0x2550af){return _0x2550af?{'count':_0xdfabcf,'rows':_0x2550af}:null;}})['then'](respondWithResult(_0x4f32d3,null))[_0x2642('0x45')](handleError(_0x4f32d3,null));}; \ No newline at end of file +var _0x0e6d=['select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','getAgents','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','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','MailQueues','error','name','map','MailQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams'];(function(_0x4fb336,_0x1e96b7){var _0x199ecc=function(_0x4cacc2){while(--_0x4cacc2){_0x4fb336['push'](_0x4fb336['shift']());}};_0x199ecc(++_0x1e96b7);}(_0x0e6d,0xa9));var _0xd0e6=function(_0x4c49c0,_0x4adb76){_0x4c49c0=_0x4c49c0-0x0;var _0x596b70=_0x0e6d[_0x4c49c0];return _0x596b70;};'use strict';var pdf=require(_0xd0e6('0x0'));var emlformat=require(_0xd0e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd0e6('0x2'));var jsonpatch=require(_0xd0e6('0x3'));var rp=require(_0xd0e6('0x4'));var moment=require(_0xd0e6('0x5'));var BPromise=require(_0xd0e6('0x6'));var Mustache=require(_0xd0e6('0x7'));var util=require(_0xd0e6('0x8'));var path=require(_0xd0e6('0x9'));var sox=require(_0xd0e6('0xa'));var csv=require(_0xd0e6('0xb'));var ejs=require(_0xd0e6('0xc'));var fs=require('fs');var _=require(_0xd0e6('0xd'));var squel=require(_0xd0e6('0xe'));var crypto=require(_0xd0e6('0xf'));var jsforce=require(_0xd0e6('0x10'));var deskjs=require(_0xd0e6('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd0e6('0x12'));var Papa=require('papaparse');var Redis=require(_0xd0e6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd0e6('0x14'));var hardwareService=require(_0xd0e6('0x15'));var logger=require(_0xd0e6('0x16'))('api');var utils=require(_0xd0e6('0x17'));var config=require(_0xd0e6('0x18'));var db=require(_0xd0e6('0x19'))['db'];config[_0xd0e6('0x1a')]=_[_0xd0e6('0x1b')](config[_0xd0e6('0x1a')],{'host':_0xd0e6('0x1c'),'port':0x18eb});var socket=require(_0xd0e6('0x1d'))(new Redis(config[_0xd0e6('0x1a')]));require(_0xd0e6('0x1e'))[_0xd0e6('0x1f')](socket);function respondWithStatusCode(_0x531fdb,_0x19968d){_0x19968d=_0x19968d||0xcc;return function(_0x7361b2){if(_0x7361b2){return _0x531fdb[_0xd0e6('0x20')](_0x19968d);}return _0x531fdb[_0xd0e6('0x21')](_0x19968d)[_0xd0e6('0x22')]();};}function respondWithResult(_0x49eb16,_0x52fe4a){_0x52fe4a=_0x52fe4a||0xc8;return function(_0x1936c4){if(_0x1936c4){return _0x49eb16[_0xd0e6('0x21')](_0x52fe4a)[_0xd0e6('0x23')](_0x1936c4);}};}function respondWithFilteredResult(_0x3b9a74,_0x16dda5){return function(_0x5c93a1){if(_0x5c93a1){var _0x52b212=_0x5c93a1['count'],_0x30554e=_0x16dda5[_0xd0e6('0x24')],_0x59cd93=_0x16dda5[_0xd0e6('0x24')]+_0x16dda5[_0xd0e6('0x25')],_0x42f3d2;if(_0x59cd93>=_0x52b212){_0x59cd93=_0x52b212;_0x42f3d2=0xc8;}else{_0x42f3d2=0xce;}_0x3b9a74[_0xd0e6('0x21')](_0x42f3d2);return _0x3b9a74[_0xd0e6('0x26')](_0xd0e6('0x27'),_0x30554e+'-'+_0x59cd93+'/'+_0x52b212)[_0xd0e6('0x23')](_0x5c93a1);}return null;};}function patchUpdates(_0x57a05e){return function(_0x2ea2f0){try{jsonpatch[_0xd0e6('0x28')](_0x2ea2f0,_0x57a05e,!![]);}catch(_0x3b0edf){return BPromise[_0xd0e6('0x29')](_0x3b0edf);}return _0x2ea2f0['save']();};}function saveUpdates(_0x32903f,_0x53eff8){return function(_0x515d76){if(_0x515d76){return _0x515d76[_0xd0e6('0x2a')](_0x32903f)[_0xd0e6('0x2b')](function(_0x8c545f){return _0x8c545f;});}return null;};}function removeEntity(_0x224216,_0x422131){return function(_0x36beef){if(_0x36beef){return _0x36beef[_0xd0e6('0x2c')]()[_0xd0e6('0x2b')](function(){var _0x3fcb94=_0x36beef['get']({'plain':!![]});var _0x49f3e3=_0xd0e6('0x2d');return db['UserProfileResource'][_0xd0e6('0x2c')]({'where':{'type':_0x49f3e3,'resourceId':_0x3fcb94['id']}})[_0xd0e6('0x2b')](function(){return _0x36beef;});})['then'](function(){_0x224216['status'](0xcc)[_0xd0e6('0x22')]();});}};}function handleEntityNotFound(_0x136c84,_0x5dba3b){return function(_0x48b290){if(!_0x48b290){_0x136c84[_0xd0e6('0x20')](0x194);}return _0x48b290;};}function handleError(_0x254e84,_0x2a4a43){_0x2a4a43=_0x2a4a43||0x1f4;return function(_0x498bcc){logger[_0xd0e6('0x2e')](_0x498bcc['stack']);if(_0x498bcc['name']){delete _0x498bcc[_0xd0e6('0x2f')];}_0x254e84[_0xd0e6('0x21')](_0x2a4a43)['send'](_0x498bcc);};}exports['index']=function(_0x3a54e0,_0x45b424){var _0x14dd47={},_0x4e26ae={},_0x525815={'count':0x0,'rows':[]};var _0xb3c446=_[_0xd0e6('0x30')](db[_0xd0e6('0x31')][_0xd0e6('0x32')],function(_0xa92fe4){return{'name':_0xa92fe4[_0xd0e6('0x33')],'type':_0xa92fe4[_0xd0e6('0x34')]['key']};});_0x4e26ae[_0xd0e6('0x35')]=_[_0xd0e6('0x30')](_0xb3c446,_0xd0e6('0x2f'));_0x4e26ae['query']=_[_0xd0e6('0x36')](_0x3a54e0[_0xd0e6('0x37')]);_0x4e26ae[_0xd0e6('0x38')]=_['intersection'](_0x4e26ae[_0xd0e6('0x35')],_0x4e26ae[_0xd0e6('0x37')]);_0x14dd47[_0xd0e6('0x39')]=_[_0xd0e6('0x3a')](_0x4e26ae[_0xd0e6('0x35')],qs[_0xd0e6('0x3b')](_0x3a54e0[_0xd0e6('0x37')][_0xd0e6('0x3b')]));_0x14dd47[_0xd0e6('0x39')]=_0x14dd47[_0xd0e6('0x39')][_0xd0e6('0x3c')]?_0x14dd47['attributes']:_0x4e26ae[_0xd0e6('0x35')];if(!_0x3a54e0[_0xd0e6('0x37')][_0xd0e6('0x3d')](_0xd0e6('0x3e'))){_0x14dd47[_0xd0e6('0x25')]=qs[_0xd0e6('0x25')](_0x3a54e0[_0xd0e6('0x37')][_0xd0e6('0x25')]);_0x14dd47[_0xd0e6('0x24')]=qs[_0xd0e6('0x24')](_0x3a54e0[_0xd0e6('0x37')][_0xd0e6('0x24')]);}_0x14dd47[_0xd0e6('0x3f')]=qs[_0xd0e6('0x40')](_0x3a54e0[_0xd0e6('0x37')][_0xd0e6('0x40')]);_0x14dd47['where']=qs[_0xd0e6('0x38')](_[_0xd0e6('0x41')](_0x3a54e0[_0xd0e6('0x37')],_0x4e26ae[_0xd0e6('0x38')]),_0xb3c446);if(_0x3a54e0['query']['filter']){_0x14dd47[_0xd0e6('0x42')]=_[_0xd0e6('0x43')](_0x14dd47[_0xd0e6('0x42')],{'$or':_[_0xd0e6('0x30')](_0xb3c446,function(_0x1ecd9a){if(_0x1ecd9a[_0xd0e6('0x34')]!=='VIRTUAL'){var _0x5d6b65={};_0x5d6b65[_0x1ecd9a[_0xd0e6('0x2f')]]={'$like':'%'+_0x3a54e0['query'][_0xd0e6('0x44')]+'%'};return _0x5d6b65;}})});}_0x14dd47=_[_0xd0e6('0x43')]({},_0x14dd47,_0x3a54e0[_0xd0e6('0x45')]);var _0x15e10e={'where':_0x14dd47[_0xd0e6('0x42')]};return db['MailQueue'][_0xd0e6('0x46')](_0x15e10e)[_0xd0e6('0x2b')](function(_0x2efb71){_0x525815['count']=_0x2efb71;if(_0x3a54e0[_0xd0e6('0x37')]['includeAll']){_0x14dd47[_0xd0e6('0x47')]=[{'all':!![]}];}return db[_0xd0e6('0x31')][_0xd0e6('0x48')](_0x14dd47);})[_0xd0e6('0x2b')](function(_0xf088ce){_0x525815[_0xd0e6('0x49')]=_0xf088ce;return _0x525815;})[_0xd0e6('0x2b')](respondWithFilteredResult(_0x45b424,_0x14dd47))[_0xd0e6('0x4a')](handleError(_0x45b424,null));};exports[_0xd0e6('0x4b')]=function(_0x1b2252,_0x11d7eb){var _0x40d5fa={'raw':!![],'where':{'id':_0x1b2252['params']['id']}},_0x3aad21={};_0x3aad21[_0xd0e6('0x35')]=_['keys'](db[_0xd0e6('0x31')]['rawAttributes']);_0x3aad21[_0xd0e6('0x37')]=_[_0xd0e6('0x36')](_0x1b2252['query']);_0x3aad21[_0xd0e6('0x38')]=_[_0xd0e6('0x3a')](_0x3aad21[_0xd0e6('0x35')],_0x3aad21[_0xd0e6('0x37')]);_0x40d5fa[_0xd0e6('0x39')]=_[_0xd0e6('0x3a')](_0x3aad21['model'],qs[_0xd0e6('0x3b')](_0x1b2252[_0xd0e6('0x37')][_0xd0e6('0x3b')]));_0x40d5fa[_0xd0e6('0x39')]=_0x40d5fa[_0xd0e6('0x39')][_0xd0e6('0x3c')]?_0x40d5fa[_0xd0e6('0x39')]:_0x3aad21['model'];if(_0x1b2252[_0xd0e6('0x37')][_0xd0e6('0x4c')]){_0x40d5fa[_0xd0e6('0x47')]=[{'all':!![]}];}_0x40d5fa=_[_0xd0e6('0x43')]({},_0x40d5fa,_0x1b2252[_0xd0e6('0x45')]);return db[_0xd0e6('0x31')][_0xd0e6('0x4d')](_0x40d5fa)[_0xd0e6('0x2b')](handleEntityNotFound(_0x11d7eb,null))['then'](respondWithResult(_0x11d7eb,null))[_0xd0e6('0x4a')](handleError(_0x11d7eb,null));};exports[_0xd0e6('0x4e')]=function(_0x5095ef,_0x3f9566){return db[_0xd0e6('0x31')][_0xd0e6('0x4e')](_0x5095ef[_0xd0e6('0x4f')],{})[_0xd0e6('0x2b')](function(_0x401f60){var _0x46abb3=_0x5095ef['user'][_0xd0e6('0x50')]({'plain':!![]});if(!_0x46abb3)throw new Error(_0xd0e6('0x51'));if(_0x46abb3[_0xd0e6('0x52')]==='user'){var _0x5aac83=_0x401f60[_0xd0e6('0x50')]({'plain':!![]});var _0x239c6d=_0xd0e6('0x2d');return db[_0xd0e6('0x53')][_0xd0e6('0x4d')]({'where':{'name':_0x239c6d,'userProfileId':_0x46abb3[_0xd0e6('0x54')]},'raw':!![]})[_0xd0e6('0x2b')](function(_0x451ab1){if(_0x451ab1&&_0x451ab1[_0xd0e6('0x55')]===0x0){return db[_0xd0e6('0x56')]['create']({'name':_0x5aac83[_0xd0e6('0x2f')],'resourceId':_0x5aac83['id'],'type':_0x451ab1[_0xd0e6('0x2f')],'sectionId':_0x451ab1['id']},{})['then'](function(){return _0x401f60;});}else{return _0x401f60;}})[_0xd0e6('0x4a')](function(_0x16f63a){logger[_0xd0e6('0x2e')](_0xd0e6('0x57'),_0x16f63a);throw _0x16f63a;});}return _0x401f60;})[_0xd0e6('0x2b')](respondWithResult(_0x3f9566,0xc9))[_0xd0e6('0x4a')](handleError(_0x3f9566,null));};exports[_0xd0e6('0x2a')]=function(_0x2d91a1,_0x4d9a9b){if(_0x2d91a1[_0xd0e6('0x4f')]['id']){delete _0x2d91a1[_0xd0e6('0x4f')]['id'];}return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x2d91a1[_0xd0e6('0x58')]['id']}})[_0xd0e6('0x2b')](handleEntityNotFound(_0x4d9a9b,null))[_0xd0e6('0x2b')](saveUpdates(_0x2d91a1[_0xd0e6('0x4f')],null))[_0xd0e6('0x2b')](respondWithResult(_0x4d9a9b,null))['catch'](handleError(_0x4d9a9b,null));};exports['destroy']=function(_0x3e79f,_0x34ce97){return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x3e79f['params']['id']}})['then'](handleEntityNotFound(_0x34ce97,null))[_0xd0e6('0x2b')](removeEntity(_0x34ce97,null))['catch'](handleError(_0x34ce97,null));};exports[_0xd0e6('0x59')]=function(_0x4eef73,_0x2334c2){return db[_0xd0e6('0x31')][_0xd0e6('0x59')]()['then'](respondWithResult(_0x2334c2,null))[_0xd0e6('0x4a')](handleError(_0x2334c2,null));};exports[_0xd0e6('0x5a')]=function(_0x19663f,_0x1ede65,_0x2e198a){var _0x559283={'raw':!![],'where':{}},_0x52882f={},_0x50caad;return db[_0xd0e6('0x31')][_0xd0e6('0x5b')]({'where':{'id':_0x19663f['params']['id']}})[_0xd0e6('0x2b')](handleEntityNotFound(_0x1ede65,null))[_0xd0e6('0x2b')](function(_0x3c03ee){if(_0x3c03ee){_0x50caad=_0x3c03ee['get']({'plain':!![]});_0x52882f[_0xd0e6('0x35')]=_[_0xd0e6('0x36')](db[_0xd0e6('0x5c')]['rawAttributes']);_0x52882f['query']=_['keys'](_0x19663f[_0xd0e6('0x37')]);_0x52882f[_0xd0e6('0x38')]=_[_0xd0e6('0x3a')](_0x52882f[_0xd0e6('0x35')],_0x52882f[_0xd0e6('0x37')]);_0x559283['attributes']=_[_0xd0e6('0x3a')](_0x52882f[_0xd0e6('0x35')],qs['fields'](_0x19663f[_0xd0e6('0x37')][_0xd0e6('0x3b')]));_0x559283[_0xd0e6('0x39')]=_0x559283[_0xd0e6('0x39')][_0xd0e6('0x3c')]?_0x559283[_0xd0e6('0x39')]:_0x52882f['model'];if(!_0x19663f[_0xd0e6('0x37')][_0xd0e6('0x3d')](_0xd0e6('0x3e'))){_0x559283[_0xd0e6('0x25')]=qs[_0xd0e6('0x25')](_0x19663f[_0xd0e6('0x37')][_0xd0e6('0x25')]);_0x559283[_0xd0e6('0x24')]=qs[_0xd0e6('0x24')](_0x19663f[_0xd0e6('0x37')]['offset']);}_0x559283['order']=qs['sort'](_0x19663f['query'][_0xd0e6('0x40')]);_0x559283['where']=qs[_0xd0e6('0x38')](_[_0xd0e6('0x41')](_0x19663f[_0xd0e6('0x37')],_0x52882f[_0xd0e6('0x38')]));_0x559283[_0xd0e6('0x42')][_0xd0e6('0x5d')]=_0x3c03ee['id'];if(_0x19663f[_0xd0e6('0x37')]['filter']){_0x559283[_0xd0e6('0x42')]=_[_0xd0e6('0x43')](_0x559283[_0xd0e6('0x42')],{'$or':_[_0xd0e6('0x30')](_0x559283['attributes'],function(_0x2d7c71){var _0xd6157c={};_0xd6157c[_0x2d7c71]={'$like':'%'+_0x19663f[_0xd0e6('0x37')][_0xd0e6('0x44')]+'%'};return _0xd6157c;})});}_0x559283=_['merge']({},_0x559283,_0x19663f[_0xd0e6('0x45')]);return db[_0xd0e6('0x5c')][_0xd0e6('0x48')](_0x559283);}})['then'](function(_0x1efc6f){if(_0x1efc6f){return db[_0xd0e6('0x5e')][_0xd0e6('0x5f')]({'where':{'id':_[_0xd0e6('0x30')](_0x1efc6f,_0xd0e6('0x60')),'role':_0xd0e6('0x61')},'attributes':['id',_0xd0e6('0x2f'),_0xd0e6('0x62'),_0xd0e6('0x63'),'createdAt']});}})[_0xd0e6('0x2b')](function(_0x1636b9){if(_0x1636b9){return{'count':_0x1636b9[_0xd0e6('0x46')],'rows':_[_0xd0e6('0x30')](_0x1636b9['rows'],function(_0xcb03dc){return{'membername':_0xcb03dc[_0xd0e6('0x2f')],'UserId':_0xcb03dc['id'],'queue_name':_0x50caad[_0xd0e6('0x2f')],'MailQueueId':_0x50caad['id'],'interface':util['format'](_0xd0e6('0x64'),_0xd0e6('0x65'),_0xcb03dc[_0xd0e6('0x2f')]),'penalty':0x0,'paused':_0xcb03dc[_0xd0e6('0x62')],'createdAt':_0xcb03dc['createdAt'],'updatedAt':_0xcb03dc[_0xd0e6('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd0e6('0x2b')](respondWithFilteredResult(_0x1ede65,_0x559283))[_0xd0e6('0x4a')](handleError(_0x1ede65,null));};exports['getTeams']=function(_0x1cfc7c,_0x4f720c,_0x44617a){var _0x54f6b8={};var _0x1090c3={};var _0x4bc8df;var _0x4517b1;return db['MailQueue'][_0xd0e6('0x5b')]({'where':{'id':_0x1cfc7c[_0xd0e6('0x58')]['id']}})[_0xd0e6('0x2b')](handleEntityNotFound(_0x4f720c,null))['then'](function(_0x424c2a){if(_0x424c2a){_0x4bc8df=_0x424c2a;_0x1090c3[_0xd0e6('0x35')]=_[_0xd0e6('0x36')](db[_0xd0e6('0x66')][_0xd0e6('0x32')]);_0x1090c3[_0xd0e6('0x37')]=_[_0xd0e6('0x36')](_0x1cfc7c[_0xd0e6('0x37')]);_0x1090c3[_0xd0e6('0x38')]=_['intersection'](_0x1090c3[_0xd0e6('0x35')],_0x1090c3['query']);_0x54f6b8[_0xd0e6('0x39')]=_[_0xd0e6('0x3a')](_0x1090c3['model'],qs[_0xd0e6('0x3b')](_0x1cfc7c[_0xd0e6('0x37')][_0xd0e6('0x3b')]));_0x54f6b8[_0xd0e6('0x39')]=_0x54f6b8[_0xd0e6('0x39')][_0xd0e6('0x3c')]?_0x54f6b8[_0xd0e6('0x39')]:_0x1090c3[_0xd0e6('0x35')];_0x54f6b8[_0xd0e6('0x3f')]=qs['sort'](_0x1cfc7c['query'][_0xd0e6('0x40')]);_0x54f6b8[_0xd0e6('0x42')]=qs[_0xd0e6('0x38')](_[_0xd0e6('0x41')](_0x1cfc7c[_0xd0e6('0x37')],_0x1090c3[_0xd0e6('0x38')]));if(_0x1cfc7c[_0xd0e6('0x37')][_0xd0e6('0x44')]){_0x54f6b8[_0xd0e6('0x42')]=_[_0xd0e6('0x43')](_0x54f6b8[_0xd0e6('0x42')],{'$or':_[_0xd0e6('0x30')](_0x54f6b8[_0xd0e6('0x39')],function(_0x13cea0){var _0x32d11f={};_0x32d11f[_0x13cea0]={'$like':'%'+_0x1cfc7c[_0xd0e6('0x37')][_0xd0e6('0x44')]+'%'};return _0x32d11f;})});}_0x54f6b8=_[_0xd0e6('0x43')]({},_0x54f6b8,_0x1cfc7c[_0xd0e6('0x45')]);return _0x4bc8df[_0xd0e6('0x67')](_0x54f6b8);}})['then'](function(_0x4c78f4){if(_0x4c78f4){_0x4517b1=_0x4c78f4['length'];if(!_0x1cfc7c['query'][_0xd0e6('0x3d')](_0xd0e6('0x3e'))){_0x54f6b8[_0xd0e6('0x25')]=qs[_0xd0e6('0x25')](_0x1cfc7c['query']['limit']);_0x54f6b8[_0xd0e6('0x24')]=qs['offset'](_0x1cfc7c[_0xd0e6('0x37')][_0xd0e6('0x24')]);}return _0x4bc8df[_0xd0e6('0x67')](_0x54f6b8);}})[_0xd0e6('0x2b')](function(_0x3413b8){if(_0x3413b8){return _0x3413b8?{'count':_0x4517b1,'rows':_0x3413b8}:null;}})[_0xd0e6('0x2b')](respondWithResult(_0x4f720c,null))[_0xd0e6('0x4a')](handleError(_0x4f720c,null));};exports[_0xd0e6('0x68')]=function(_0x163cb4,_0x16691d,_0x29dba6){var _0x45d7a2=_0x163cb4[_0xd0e6('0x4f')][_0xd0e6('0x69')];return db[_0xd0e6('0x66')]['findAll']({'where':{'id':_0x45d7a2},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd0e6('0x6a'),'attributes':['id','name',_0xd0e6('0x6b'),_0xd0e6('0x6c'),'interface'],'raw':!![]}]})[_0xd0e6('0x2b')](function(_0x15f0c3){if(_0x15f0c3){var _0x4b1948=_[_0xd0e6('0x6d')](_0x15f0c3,function(_0x5bed4d){var _0x5b47a7=_0x5bed4d['get']({'plain':!![]});return _0x5b47a7['Agents'];});return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x163cb4[_0xd0e6('0x58')]['id']}})['then'](function(_0x1f734a){return db[_0xd0e6('0x6e')]['transaction'](function(_0x3c3822){return _0x1f734a[_0xd0e6('0x68')](_0x45d7a2,{'transaction':_0x3c3822})['then'](function(){return BPromise[_0xd0e6('0x6f')](_0x4b1948,function(_0x1f7804){return db[_0xd0e6('0x5c')][_0xd0e6('0x70')]({'where':{'UserId':_0x1f7804['id'],'MailQueueId':_0x163cb4[_0xd0e6('0x58')]['id']},'transaction':_0x3c3822});});})['then'](function(){_0x4b1948[_0xd0e6('0x71')](function(_0x3759bc){socket[_0xd0e6('0x72')](_0xd0e6('0x73'),{'UserId':_0x3759bc['id'],'MailQueueId':_0x1f734a['id']});});});});});}})[_0xd0e6('0x2b')](respondWithStatusCode(_0x16691d,null))[_0xd0e6('0x4a')](handleError(_0x16691d,null));};exports[_0xd0e6('0x74')]=function(_0x4530c3,_0x1f2f80,_0x1ef518){return db[_0xd0e6('0x66')][_0xd0e6('0x48')]({'where':{'id':_0x4530c3['query'][_0xd0e6('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd0e6('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f2f80,null))[_0xd0e6('0x2b')](function(_0x5651fa){var _0x2733ea=_[_0xd0e6('0x30')](_0x5651fa,'id');var _0x276a77=[];var _0x1c2f06=[];var _0x568114=squel[_0xd0e6('0x75')]();_0x568114[_0xd0e6('0x76')](_0xd0e6('0x77'))[_0xd0e6('0x78')](_0xd0e6('0x79'),'tq')[_0xd0e6('0x7a')](_0xd0e6('0x7b'),'ut',_0xd0e6('0x7c'))['where'](_0xd0e6('0x7d'),_0x4530c3[_0xd0e6('0x58')]['id']);for(var _0x31204e=0x0;_0x31204e<_0x5651fa[_0xd0e6('0x3c')];_0x31204e+=0x1){let _0x46ab30=_0x5651fa[_0x31204e];for(var _0x216b12=0x0;_0x216b12<_0x46ab30[_0xd0e6('0x6a')]['length'];_0x216b12+=0x1){let _0x22a16b=_0x46ab30[_0xd0e6('0x6a')][_0x216b12];var _0x4baea5=_0x568114[_0xd0e6('0x7e')]();_0x4baea5[_0xd0e6('0x42')](_0xd0e6('0x7f'),_0x22a16b['id']);_0x1c2f06[_0xd0e6('0x80')](db[_0xd0e6('0x6e')][_0xd0e6('0x37')](_0x4baea5[_0xd0e6('0x81')](),{'type':db[_0xd0e6('0x6e')][_0xd0e6('0x82')]['SELECT']})[_0xd0e6('0x2b')](function(_0x3646db){if(_0x3646db[_0xd0e6('0x3c')]===0x1){return _0x22a16b['id'];}else{var _0x1c6b99=_['every'](_[_0xd0e6('0x30')](_0x3646db,_0xd0e6('0x83')),function(_0x4aa34b){return _['includes'](_0x2733ea,_0x4aa34b);});if(_0x1c6b99){return _0x22a16b['id'];}}}));}}return BPromise[_0xd0e6('0x84')](_0x1c2f06)[_0xd0e6('0x2b')](function(_0xa29e1b){_0x276a77=_(_0x276a77)[_0xd0e6('0x85')](_0xa29e1b)[_0xd0e6('0x86')]()[_0xd0e6('0x87')]();return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x4530c3[_0xd0e6('0x58')]['id']}})[_0xd0e6('0x2b')](function(_0x367157){return db[_0xd0e6('0x6e')][_0xd0e6('0x88')](function(_0x4e0fe4){return _0x367157['removeTeams'](_0x4530c3[_0xd0e6('0x37')][_0xd0e6('0x69')],{'transaction':_0x4e0fe4})['then'](function(){if(!_[_0xd0e6('0x89')](_0x276a77)){return _0x367157[_0xd0e6('0x8a')](_0x276a77,{'transaction':_0x4e0fe4});}})[_0xd0e6('0x2b')](function(){_0x276a77[_0xd0e6('0x71')](function(_0x111e69){socket[_0xd0e6('0x72')](_0xd0e6('0x8b'),{'UserId':_0x111e69,'MailQueueId':_0x367157['id']});});});});});});})['then'](respondWithStatusCode(_0x1f2f80,null))[_0xd0e6('0x4a')](handleError(_0x1f2f80,null));};exports[_0xd0e6('0x8c')]=function(_0x4731a7,_0xfeb45,_0x4616c6){return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x4731a7[_0xd0e6('0x58')]['id']}})[_0xd0e6('0x2b')](handleEntityNotFound(_0xfeb45,null))[_0xd0e6('0x2b')](function(_0x3e1e41){if(_0x3e1e41){return _0x3e1e41[_0xd0e6('0x8c')](_0x4731a7[_0xd0e6('0x4f')][_0xd0e6('0x69')],_[_0xd0e6('0x8d')](_0x4731a7[_0xd0e6('0x4f')],['ids','id'])||{})['spread'](function(_0x4a3807){for(var _0x2e0a85=0x0;_0x2e0a85<_0x4731a7[_0xd0e6('0x4f')]['ids'][_0xd0e6('0x3c')];_0x2e0a85+=0x1){socket[_0xd0e6('0x72')](_0xd0e6('0x73'),{'UserId':_0x4731a7[_0xd0e6('0x4f')][_0xd0e6('0x69')][_0x2e0a85],'MailQueueId':_0x4731a7['params']['id']});}return _0x4a3807;});}})['then'](respondWithResult(_0xfeb45,null))[_0xd0e6('0x4a')](handleError(_0xfeb45,null));};exports[_0xd0e6('0x8a')]=function(_0x4eb51d,_0x462009,_0x4cd15c){return db[_0xd0e6('0x31')][_0xd0e6('0x4d')]({'where':{'id':_0x4eb51d[_0xd0e6('0x58')]['id']}})['then'](handleEntityNotFound(_0x462009,null))['then'](function(_0x357c51){if(_0x357c51){return _0x357c51[_0xd0e6('0x8a')](_0x4eb51d[_0xd0e6('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x4eb51d[_0xd0e6('0x37')][_0xd0e6('0x69')])){for(var _0x3999ea=0x0;_0x3999ea<_0x4eb51d[_0xd0e6('0x37')][_0xd0e6('0x69')][_0xd0e6('0x3c')];_0x3999ea+=0x1){socket['emit'](_0xd0e6('0x8b'),{'UserId':Number(_0x4eb51d[_0xd0e6('0x37')][_0xd0e6('0x69')][_0x3999ea]),'MailQueueId':Number(_0x4eb51d[_0xd0e6('0x58')]['id'])});}}else{socket['emit'](_0xd0e6('0x8b'),{'UserId':Number(_0x4eb51d['query'][_0xd0e6('0x69')]),'MailQueueId':Number(_0x4eb51d[_0xd0e6('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x462009,null))['catch'](handleError(_0x462009,null));};exports[_0xd0e6('0x8e')]=function(_0x596c87,_0xe9c4ec,_0x1ddb53){var _0x489ae0={};var _0x1391ad={};var _0x55acd8;var _0x5dbcbb;return db[_0xd0e6('0x31')]['findOne']({'where':{'id':_0x596c87['params']['id']}})[_0xd0e6('0x2b')](handleEntityNotFound(_0xe9c4ec,null))[_0xd0e6('0x2b')](function(_0xc573c0){if(_0xc573c0){_0x55acd8=_0xc573c0;_0x1391ad[_0xd0e6('0x35')]=_[_0xd0e6('0x36')](db['User'][_0xd0e6('0x32')]);_0x1391ad['query']=_[_0xd0e6('0x36')](_0x596c87[_0xd0e6('0x37')]);_0x1391ad[_0xd0e6('0x38')]=_[_0xd0e6('0x3a')](_0x1391ad[_0xd0e6('0x35')],_0x1391ad[_0xd0e6('0x37')]);_0x489ae0['attributes']=_[_0xd0e6('0x3a')](_0x1391ad[_0xd0e6('0x35')],qs[_0xd0e6('0x3b')](_0x596c87[_0xd0e6('0x37')][_0xd0e6('0x3b')]));_0x489ae0[_0xd0e6('0x39')]=_0x489ae0[_0xd0e6('0x39')][_0xd0e6('0x3c')]?_0x489ae0[_0xd0e6('0x39')]:_0x1391ad[_0xd0e6('0x35')];_0x489ae0['order']=qs[_0xd0e6('0x40')](_0x596c87['query']['sort']);_0x489ae0[_0xd0e6('0x42')]=qs[_0xd0e6('0x38')](_[_0xd0e6('0x41')](_0x596c87[_0xd0e6('0x37')],_0x1391ad['filters']));if(_0x596c87[_0xd0e6('0x37')]['filter']){_0x489ae0[_0xd0e6('0x42')]=_['merge'](_0x489ae0[_0xd0e6('0x42')],{'$or':_[_0xd0e6('0x30')](_0x489ae0[_0xd0e6('0x39')],function(_0x48447f){var _0x4c0f30={};_0x4c0f30[_0x48447f]={'$like':'%'+_0x596c87[_0xd0e6('0x37')][_0xd0e6('0x44')]+'%'};return _0x4c0f30;})});}_0x489ae0=_['merge']({},_0x489ae0,_0x596c87[_0xd0e6('0x45')]);return _0x55acd8['getAgents'](_0x489ae0);}})[_0xd0e6('0x2b')](function(_0x5a115a){if(_0x5a115a){_0x5dbcbb=_0x5a115a[_0xd0e6('0x3c')];if(!_0x596c87['query']['hasOwnProperty'](_0xd0e6('0x3e'))){_0x489ae0[_0xd0e6('0x25')]=qs[_0xd0e6('0x25')](_0x596c87['query']['limit']);_0x489ae0['offset']=qs[_0xd0e6('0x24')](_0x596c87[_0xd0e6('0x37')][_0xd0e6('0x24')]);}return _0x55acd8[_0xd0e6('0x8e')](_0x489ae0);}})[_0xd0e6('0x2b')](function(_0xcd3a8e){if(_0xcd3a8e){return _0xcd3a8e?{'count':_0x5dbcbb,'rows':_0xcd3a8e}:null;}})[_0xd0e6('0x2b')](respondWithResult(_0xe9c4ec,null))[_0xd0e6('0x4a')](handleError(_0xe9c4ec,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ffc78b2..d3965d1 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 _0x7675=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x582f1b,_0x46f748){var _0x4df03f=function(_0x423715){while(--_0x423715){_0x582f1b['push'](_0x582f1b['shift']());}};_0x4df03f(++_0x46f748);}(_0x7675,0x176));var _0x5767=function(_0x1d73b0,_0x5381de){_0x1d73b0=_0x1d73b0-0x0;var _0xe0617e=_0x7675[_0x1d73b0];return _0xe0617e;};'use strict';var EventEmitter=require(_0x5767('0x0'));var MailQueue=require(_0x5767('0x1'))['db'][_0x5767('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5767('0x3')](0x0);var events={'afterCreate':_0x5767('0x4'),'afterUpdate':'update','afterDestroy':_0x5767('0x5')};function emitEvent(_0x1e1dd4){return function(_0x310cf5,_0x60d7c,_0x228edc){MailQueueEvents[_0x5767('0x6')](_0x1e1dd4+':'+_0x310cf5['id'],_0x310cf5);MailQueueEvents[_0x5767('0x6')](_0x1e1dd4,_0x310cf5);_0x228edc(null);};}for(var e in events){if(events[_0x5767('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x5767('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xe38b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x207d01,_0x1785af){var _0x857cf0=function(_0xd1a480){while(--_0xd1a480){_0x207d01['push'](_0x207d01['shift']());}};_0x857cf0(++_0x1785af);}(_0xe38b,0xd6));var _0xbe38=function(_0x57b214,_0x43adc0){_0x57b214=_0x57b214-0x0;var _0x4aaedd=_0xe38b[_0x57b214];return _0x4aaedd;};'use strict';var EventEmitter=require(_0xbe38('0x0'));var MailQueue=require(_0xbe38('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbe38('0x2')](0x0);var events={'afterCreate':_0xbe38('0x3'),'afterUpdate':'update','afterDestroy':_0xbe38('0x4')};function emitEvent(_0x16499b){return function(_0x1076ce,_0x56c05b,_0xdd50e8){MailQueueEvents[_0xbe38('0x5')](_0x16499b+':'+_0x1076ce['id'],_0x1076ce);MailQueueEvents[_0xbe38('0x5')](_0x16499b,_0x1076ce);_0xdd50e8(null);};}for(var e in events){if(events[_0xbe38('0x6')](e)){var event=events[e];MailQueue[_0xbe38('0x7')](e,emitEvent(event));}}module[_0xbe38('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 680f3b2..7408eb2 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 _0x969f=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x282acd,_0x3f65e5){var _0x5e4470=function(_0x2161dc){while(--_0x2161dc){_0x282acd['push'](_0x282acd['shift']());}};_0x5e4470(++_0x3f65e5);}(_0x969f,0xfc));var _0xf969=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x969f[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var logger=require('../../config/logger')(_0xf969('0x2'));var moment=require(_0xf969('0x3'));var BPromise=require(_0xf969('0x4'));var rp=require(_0xf969('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf969('0x6'));var config=require(_0xf969('0x7'));var attributes=require(_0xf969('0x8'));module[_0xf969('0x9')]=function(_0x598524,_0x187802){return _0x598524[_0xf969('0xa')](_0xf969('0xb'),attributes,{'tableName':_0xf969('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe1=['mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','MailQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fe1,0x175));var _0x14fe=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4fe1[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x14fe('0x0'));var util=require(_0x14fe('0x1'));var logger=require(_0x14fe('0x2'))('api');var moment=require(_0x14fe('0x3'));var BPromise=require(_0x14fe('0x4'));var rp=require(_0x14fe('0x5'));var fs=require('fs');var path=require(_0x14fe('0x6'));var rimraf=require(_0x14fe('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x14fe('0x8')]=function(_0x3d0cad,_0x4f2f98){return _0x3d0cad[_0x14fe('0x9')](_0x14fe('0xa'),attributes,{'tableName':_0x14fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a15f4f3..56f3980 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 _0x59ab=['result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','stringify','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x88f8ca,_0x1e419a){var _0x46f4b1=function(_0x5a21a1){while(--_0x5a21a1){_0x88f8ca['push'](_0x88f8ca['shift']());}};_0x46f4b1(++_0x1e419a);}(_0x59ab,0x1e5));var _0xb59a=function(_0x450c4e,_0x909468){_0x450c4e=_0x450c4e-0x0;var _0x59e9de=_0x59ab[_0x450c4e];return _0x59e9de;};'use strict';var _=require(_0xb59a('0x0'));var util=require('util');var moment=require(_0xb59a('0x1'));var BPromise=require(_0xb59a('0x2'));var rs=require(_0xb59a('0x3'));var fs=require('fs');var Redis=require(_0xb59a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb59a('0x5'))('rpc');var config=require(_0xb59a('0x6'));var jayson=require(_0xb59a('0x7'));var client=jayson[_0xb59a('0x8')]['http']({'port':0x232a});config[_0xb59a('0x9')]=_[_0xb59a('0xa')](config[_0xb59a('0x9')],{'host':_0xb59a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb59a('0x9')]));require('./mailQueue.socket')[_0xb59a('0xc')](socket);function respondWithRpcPromise(_0x27355d,_0x27fb48,_0x338ef4){return new BPromise(function(_0x1bed49,_0x450bc9){return client[_0xb59a('0xd')](_0x27355d,_0x338ef4)[_0xb59a('0xe')](function(_0x5472e3){logger[_0xb59a('0xf')](_0xb59a('0x10'),_0x27fb48,'request\x20sent');logger['debug'](_0xb59a('0x11'),_0x27fb48,_0xb59a('0x12'),JSON['stringify'](_0x5472e3));if(_0x5472e3['error']){if(_0x5472e3[_0xb59a('0x13')][_0xb59a('0x14')]===0x1f4){logger[_0xb59a('0x13')](_0xb59a('0x10'),_0x27fb48,_0x5472e3[_0xb59a('0x13')][_0xb59a('0x15')]);return _0x450bc9(_0x5472e3[_0xb59a('0x13')]['message']);}logger[_0xb59a('0x13')](_0xb59a('0x10'),_0x27fb48,_0x5472e3['error'][_0xb59a('0x15')]);return _0x1bed49(_0x5472e3[_0xb59a('0x13')][_0xb59a('0x15')]);}else{logger[_0xb59a('0xf')](_0xb59a('0x10'),_0x27fb48,_0xb59a('0x12'));_0x1bed49(_0x5472e3[_0xb59a('0x16')][_0xb59a('0x15')]);}})[_0xb59a('0x17')](function(_0x50d5dd){logger['error'](_0xb59a('0x10'),_0x27fb48,_0x50d5dd);_0x450bc9(_0x50d5dd);});});}exports[_0xb59a('0x18')]=function(_0x20cadc){var _0x3c6416=this;return new Promise(function(_0x4879b1,_0x5aeed8){return db[_0xb59a('0x19')][_0xb59a('0x1a')]({'raw':_0x20cadc[_0xb59a('0x1b')]?_0x20cadc[_0xb59a('0x1b')][_0xb59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x20cadc[_0xb59a('0x1b')]?_0x20cadc[_0xb59a('0x1b')][_0xb59a('0x1d')]||null:null,'attributes':_0x20cadc['options']?_0x20cadc[_0xb59a('0x1b')][_0xb59a('0x1e')]||null:null,'limit':_0x20cadc[_0xb59a('0x1b')]?_0x20cadc[_0xb59a('0x1b')][_0xb59a('0x1f')]||null:null,'include':_0x20cadc['options']?_0x20cadc[_0xb59a('0x1b')]['include']?_[_0xb59a('0x20')](_0x20cadc[_0xb59a('0x1b')][_0xb59a('0x21')],function(_0x479ba4){return{'model':db[_0x479ba4[_0xb59a('0x22')]],'as':_0x479ba4['as'],'attributes':_0x479ba4[_0xb59a('0x1e')],'include':_0x479ba4[_0xb59a('0x21')]?_['map'](_0x479ba4[_0xb59a('0x21')],function(_0x5ee47b){return{'model':db[_0x5ee47b['model']],'as':_0x5ee47b['as'],'attributes':_0x5ee47b[_0xb59a('0x1e')],'include':_0x5ee47b[_0xb59a('0x21')]?_[_0xb59a('0x20')](_0x5ee47b[_0xb59a('0x21')],function(_0x252c56){return{'model':db[_0x252c56[_0xb59a('0x22')]],'as':_0x252c56['as'],'attributes':_0x252c56[_0xb59a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb59a('0xe')](function(_0x1c3831){logger['info']('GetMailQueue',_0x20cadc);logger[_0xb59a('0x23')](_0xb59a('0x18'),_0x20cadc,JSON[_0xb59a('0x24')](_0x1c3831));_0x4879b1(_0x1c3831);})[_0xb59a('0x17')](function(_0x42ae75){logger[_0xb59a('0x13')](_0xb59a('0x18'),_0x42ae75[_0xb59a('0x15')],_0x20cadc);_0x5aeed8(_0x3c6416['error'](0x1f4,_0x42ae75[_0xb59a('0x15')]));});});};exports[_0xb59a('0x25')]=function(_0x1883ca){var _0x1b8320=this;return new Promise(function(_0x2cbe1c,_0x267f70){return db[_0xb59a('0x19')][_0xb59a('0x26')]({'raw':_0x1883ca[_0xb59a('0x1b')]?_0x1883ca[_0xb59a('0x1b')][_0xb59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1883ca[_0xb59a('0x1b')]?_0x1883ca[_0xb59a('0x1b')]['where']||null:null,'attributes':_0x1883ca[_0xb59a('0x1b')]?_0x1883ca['options']['attributes']||null:null,'include':_0x1883ca[_0xb59a('0x1b')]?_0x1883ca[_0xb59a('0x1b')]['include']?_['map'](_0x1883ca[_0xb59a('0x1b')][_0xb59a('0x21')],function(_0x29dd64){return{'model':db[_0x29dd64['model']],'as':_0x29dd64['as'],'attributes':_0x29dd64['attributes'],'include':_0x29dd64[_0xb59a('0x21')]?_[_0xb59a('0x20')](_0x29dd64[_0xb59a('0x21')],function(_0x3ec9fc){return{'model':db[_0x3ec9fc[_0xb59a('0x22')]],'as':_0x3ec9fc['as'],'attributes':_0x3ec9fc[_0xb59a('0x1e')],'include':_0x3ec9fc[_0xb59a('0x21')]?_[_0xb59a('0x20')](_0x3ec9fc[_0xb59a('0x21')],function(_0x19645c){return{'model':db[_0x19645c[_0xb59a('0x22')]],'as':_0x19645c['as'],'attributes':_0x19645c[_0xb59a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54ce18){logger[_0xb59a('0xf')](_0xb59a('0x25'),_0x1883ca);logger[_0xb59a('0x23')](_0xb59a('0x25'),_0x1883ca,JSON[_0xb59a('0x24')](_0x54ce18));_0x2cbe1c(_0x54ce18);})[_0xb59a('0x17')](function(_0x5bcda5){logger[_0xb59a('0x13')]('ShowMailQueue',_0x5bcda5['message'],_0x1883ca);_0x267f70(_0x1b8320[_0xb59a('0x13')](0x1f4,_0x5bcda5[_0xb59a('0x15')]));});});}; \ No newline at end of file +var _0x77d7=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowMailQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','info'];(function(_0x111861,_0x457a10){var _0x3e2e01=function(_0x2fa185){while(--_0x2fa185){_0x111861['push'](_0x111861['shift']());}};_0x3e2e01(++_0x457a10);}(_0x77d7,0x98));var _0x777d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x77d7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x777d('0x0'));var util=require(_0x777d('0x1'));var moment=require(_0x777d('0x2'));var BPromise=require(_0x777d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x777d('0x4'))['db'];var utils=require(_0x777d('0x5'));var logger=require(_0x777d('0x6'))(_0x777d('0x7'));var config=require(_0x777d('0x8'));var jayson=require(_0x777d('0x9'));var client=jayson[_0x777d('0xa')][_0x777d('0xb')]({'port':0x232a});config['redis']=_[_0x777d('0xc')](config['redis'],{'host':_0x777d('0xd'),'port':0x18eb});var socket=require(_0x777d('0xe'))(new Redis(config[_0x777d('0xf')]));require(_0x777d('0x10'))[_0x777d('0x11')](socket);function respondWithRpcPromise(_0x54fc14,_0x5100cc,_0x2ebb5a){return new BPromise(function(_0x5f233d,_0x14ee76){return client[_0x777d('0x12')](_0x54fc14,_0x2ebb5a)['then'](function(_0x38b160){logger[_0x777d('0x13')](_0x777d('0x14'),_0x5100cc,_0x777d('0x15'));logger[_0x777d('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5100cc,_0x777d('0x15'),JSON[_0x777d('0x17')](_0x38b160));if(_0x38b160[_0x777d('0x18')]){if(_0x38b160['error'][_0x777d('0x19')]===0x1f4){logger['error'](_0x777d('0x14'),_0x5100cc,_0x38b160[_0x777d('0x18')][_0x777d('0x1a')]);return _0x14ee76(_0x38b160[_0x777d('0x18')][_0x777d('0x1a')]);}logger['error'](_0x777d('0x14'),_0x5100cc,_0x38b160[_0x777d('0x18')][_0x777d('0x1a')]);return _0x5f233d(_0x38b160[_0x777d('0x18')]['message']);}else{logger['info'](_0x777d('0x14'),_0x5100cc,_0x777d('0x15'));_0x5f233d(_0x38b160[_0x777d('0x1b')][_0x777d('0x1a')]);}})[_0x777d('0x1c')](function(_0x4fc52e){logger[_0x777d('0x18')](_0x777d('0x14'),_0x5100cc,_0x4fc52e);_0x14ee76(_0x4fc52e);});});}exports[_0x777d('0x1d')]=function(_0x37c010){var _0x23c9b5=this;return new Promise(function(_0x1fb667,_0x385812){return db[_0x777d('0x1e')][_0x777d('0x1f')]({'raw':_0x37c010['options']?_0x37c010[_0x777d('0x20')][_0x777d('0x21')]===undefined?!![]:![]:!![],'where':_0x37c010['options']?_0x37c010['options'][_0x777d('0x22')]||null:null,'attributes':_0x37c010[_0x777d('0x20')]?_0x37c010[_0x777d('0x20')]['attributes']||null:null,'limit':_0x37c010[_0x777d('0x20')]?_0x37c010[_0x777d('0x20')][_0x777d('0x23')]||null:null,'include':_0x37c010[_0x777d('0x20')]?_0x37c010[_0x777d('0x20')][_0x777d('0x24')]?_[_0x777d('0x25')](_0x37c010['options'][_0x777d('0x24')],function(_0x3f667b){return{'model':db[_0x3f667b[_0x777d('0x26')]],'as':_0x3f667b['as'],'attributes':_0x3f667b[_0x777d('0x27')],'include':_0x3f667b[_0x777d('0x24')]?_[_0x777d('0x25')](_0x3f667b[_0x777d('0x24')],function(_0x48f371){return{'model':db[_0x48f371[_0x777d('0x26')]],'as':_0x48f371['as'],'attributes':_0x48f371[_0x777d('0x27')],'include':_0x48f371[_0x777d('0x24')]?_[_0x777d('0x25')](_0x48f371[_0x777d('0x24')],function(_0x40009c){return{'model':db[_0x40009c['model']],'as':_0x40009c['as'],'attributes':_0x40009c[_0x777d('0x27')]};}):[]};}):[]};}):[]:[]})[_0x777d('0x28')](function(_0x3e4b3f){logger[_0x777d('0x13')]('GetMailQueue',_0x37c010);logger[_0x777d('0x16')]('GetMailQueue',_0x37c010,JSON[_0x777d('0x17')](_0x3e4b3f));_0x1fb667(_0x3e4b3f);})['catch'](function(_0x2422fa){logger[_0x777d('0x18')](_0x777d('0x1d'),_0x2422fa[_0x777d('0x1a')],_0x37c010);_0x385812(_0x23c9b5[_0x777d('0x18')](0x1f4,_0x2422fa['message']));});});};exports[_0x777d('0x29')]=function(_0x321aed){var _0x2cfc8e=this;return new Promise(function(_0x208f2f,_0xdc5d8d){return db['MailQueue'][_0x777d('0x2a')]({'raw':_0x321aed[_0x777d('0x20')]?_0x321aed['options'][_0x777d('0x21')]===undefined?!![]:![]:!![],'where':_0x321aed[_0x777d('0x20')]?_0x321aed['options'][_0x777d('0x22')]||null:null,'attributes':_0x321aed[_0x777d('0x20')]?_0x321aed[_0x777d('0x20')][_0x777d('0x27')]||null:null,'include':_0x321aed[_0x777d('0x20')]?_0x321aed[_0x777d('0x20')]['include']?_[_0x777d('0x25')](_0x321aed[_0x777d('0x20')][_0x777d('0x24')],function(_0x35f1d4){return{'model':db[_0x35f1d4[_0x777d('0x26')]],'as':_0x35f1d4['as'],'attributes':_0x35f1d4[_0x777d('0x27')],'include':_0x35f1d4[_0x777d('0x24')]?_[_0x777d('0x25')](_0x35f1d4[_0x777d('0x24')],function(_0x2edef2){return{'model':db[_0x2edef2[_0x777d('0x26')]],'as':_0x2edef2['as'],'attributes':_0x2edef2['attributes'],'include':_0x2edef2[_0x777d('0x24')]?_['map'](_0x2edef2[_0x777d('0x24')],function(_0x171726){return{'model':db[_0x171726[_0x777d('0x26')]],'as':_0x171726['as'],'attributes':_0x171726[_0x777d('0x27')]};}):[]};}):[]};}):[]:[]})[_0x777d('0x28')](function(_0x22e1aa){logger[_0x777d('0x13')]('ShowMailQueue',_0x321aed);logger[_0x777d('0x16')](_0x777d('0x29'),_0x321aed,JSON[_0x777d('0x17')](_0x22e1aa));_0x208f2f(_0x22e1aa);})[_0x777d('0x1c')](function(_0xcf36b2){logger[_0x777d('0x18')](_0x777d('0x29'),_0xcf36b2[_0x777d('0x1a')],_0x321aed);_0xdc5d8d(_0x2cfc8e[_0x777d('0x18')](0x1f4,_0xcf36b2[_0x777d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9d66862..5a29dda 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 _0xc5a0=['mailQueue:','remove','update','emit','removeListener','register'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc5a0,0x97));var _0x0c5a=function(_0x2a730c,_0x44a51e){_0x2a730c=_0x2a730c-0x0;var _0x42a011=_0xc5a0[_0x2a730c];return _0x42a011;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x0c5a('0x0'),_0x0c5a('0x1')];function createListener(_0x264c2d,_0x2ee249){return function(_0x5e2e7e){_0x2ee249[_0x0c5a('0x2')](_0x264c2d,_0x5e2e7e);};}function removeListener(_0x1ac989,_0x4012f6){return function(){MailQueueEvents[_0x0c5a('0x3')](_0x1ac989,_0x4012f6);};}exports[_0x0c5a('0x4')]=function(_0x29f25a){for(var _0x307248=0x0,_0x5a34e3=events['length'];_0x307248<_0x5a34e3;_0x307248++){var _0x22dad3=events[_0x307248];var _0xa30606=createListener(_0x0c5a('0x5')+_0x22dad3,_0x29f25a);MailQueueEvents['on'](_0x22dad3,_0xa30606);}}; \ No newline at end of file +var _0x4761=['register','length','mailQueue:','save','remove','update','emit','removeListener'];(function(_0x55bd6a,_0x20aa73){var _0x4d50a4=function(_0x58f995){while(--_0x58f995){_0x55bd6a['push'](_0x55bd6a['shift']());}};_0x4d50a4(++_0x20aa73);}(_0x4761,0x18b));var _0x1476=function(_0x300da6,_0x534433){_0x300da6=_0x300da6-0x0;var _0x2c1d6a=_0x4761[_0x300da6];return _0x2c1d6a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1476('0x0'),_0x1476('0x1'),_0x1476('0x2')];function createListener(_0x41079b,_0x17712c){return function(_0x51dc16){_0x17712c[_0x1476('0x3')](_0x41079b,_0x51dc16);};}function removeListener(_0x542616,_0x3b4d6b){return function(){MailQueueEvents[_0x1476('0x4')](_0x542616,_0x3b4d6b);};}exports[_0x1476('0x5')]=function(_0x19140d){for(var _0x2a2fdb=0x0,_0x1b2e08=events[_0x1476('0x6')];_0x2a2fdb<_0x1b2e08;_0x2a2fdb++){var _0x4a533f=events[_0x2a2fdb];var _0x3f77ef=createListener(_0x1476('0x7')+_0x4a533f,_0x19140d);MailQueueEvents['on'](_0x4a533f,_0x3f77ef);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8e0b0a5..bca9a8f 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 _0x072a=['./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../config/environment'];(function(_0x21bee8,_0x9b7b4c){var _0x100532=function(_0x2b90e3){while(--_0x2b90e3){_0x21bee8['push'](_0x21bee8['shift']());}};_0x100532(++_0x9b7b4c);}(_0x072a,0xcb));var _0xa072=function(_0x8ff5df,_0x297928){_0x8ff5df=_0x8ff5df-0x0;var _0x87f4f7=_0x072a[_0x8ff5df];return _0x87f4f7;};'use strict';var multer=require(_0xa072('0x0'));var util=require(_0xa072('0x1'));var path=require(_0xa072('0x2'));var timeout=require('connect-timeout');var express=require(_0xa072('0x3'));var router=express[_0xa072('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa072('0x5'));var controller=require(_0xa072('0x6'));router[_0xa072('0x7')]('/',auth['isAuthenticated'](),controller[_0xa072('0x8')]);router[_0xa072('0x7')](_0xa072('0x9'),auth[_0xa072('0xa')](),controller[_0xa072('0xb')]);router['get'](_0xa072('0xc'),auth[_0xa072('0xa')](),controller[_0xa072('0xd')]);router[_0xa072('0xe')]('/',auth['isAuthenticated'](),controller[_0xa072('0xf')]);router[_0xa072('0x10')]('/:id',auth[_0xa072('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa072('0x11')]);module[_0xa072('0x12')]=router; \ No newline at end of file +var _0x41a9=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','delete'];(function(_0x3a304f,_0x220955){var _0x386889=function(_0xf991){while(--_0xf991){_0x3a304f['push'](_0x3a304f['shift']());}};_0x386889(++_0x220955);}(_0x41a9,0x1a0));var _0x941a=function(_0x231830,_0x42b340){_0x231830=_0x231830-0x0;var _0x3b2b51=_0x41a9[_0x231830];return _0x3b2b51;};'use strict';var multer=require(_0x941a('0x0'));var util=require(_0x941a('0x1'));var path=require(_0x941a('0x2'));var timeout=require(_0x941a('0x3'));var express=require(_0x941a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x941a('0x5'));var config=require(_0x941a('0x6'));var controller=require(_0x941a('0x7'));router[_0x941a('0x8')]('/',auth[_0x941a('0x9')](),controller[_0x941a('0xa')]);router[_0x941a('0x8')](_0x941a('0xb'),auth[_0x941a('0x9')](),controller['describe']);router[_0x941a('0x8')](_0x941a('0xc'),auth[_0x941a('0x9')](),controller['show']);router[_0x941a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x941a('0xe')](_0x941a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x941a('0xf')](_0x941a('0xc'),auth[_0x941a('0x9')](),controller[_0x941a('0x10')]);module[_0x941a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a87f592..d05d2a6 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 _0x1e00=['sequelize','STRING','DATE'];(function(_0x157260,_0x2aad92){var _0x26379c=function(_0x1c92c2){while(--_0x1c92c2){_0x157260['push'](_0x157260['shift']());}};_0x26379c(++_0x2aad92);}(_0x1e00,0x14d));var _0x01e0=function(_0x411cfd,_0x2008c6){_0x411cfd=_0x411cfd-0x0;var _0x413760=_0x1e00[_0x411cfd];return _0x413760;};'use strict';var moment=require('moment');var Sequelize=require(_0x01e0('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x01e0('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x01e0('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdeb6=['STRING','DATE','sequelize'];(function(_0x1c9f89,_0x11ab65){var _0x75b03e=function(_0x252545){while(--_0x252545){_0x1c9f89['push'](_0x1c9f89['shift']());}};_0x75b03e(++_0x11ab65);}(_0xdeb6,0x1d6));var _0x6deb=function(_0x77b525,_0xd4dc1e){_0x77b525=_0x77b525-0x0;var _0xa83673=_0xdeb6[_0x77b525];return _0xa83673;};'use strict';var moment=require('moment');var Sequelize=require(_0x6deb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6deb('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6deb('0x2')]},'leaveAt':{'type':Sequelize[_0x6deb('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6deb('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6826944..1601ffb 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 _0x510e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','keys','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x510e,0x1ed));var _0xe510=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x510e[_0x2261ce];return _0x524640;};'use strict';var pdf=require(_0xe510('0x0'));var emlformat=require(_0xe510('0x1'));var rimraf=require(_0xe510('0x2'));var zipdir=require(_0xe510('0x3'));var jsonpatch=require(_0xe510('0x4'));var rp=require(_0xe510('0x5'));var moment=require(_0xe510('0x6'));var BPromise=require(_0xe510('0x7'));var Mustache=require(_0xe510('0x8'));var util=require('util');var path=require(_0xe510('0x9'));var sox=require(_0xe510('0xa'));var csv=require(_0xe510('0xb'));var ejs=require(_0xe510('0xc'));var fs=require('fs');var _=require(_0xe510('0xd'));var squel=require(_0xe510('0xe'));var crypto=require(_0xe510('0xf'));var jsforce=require(_0xe510('0x10'));var deskjs=require(_0xe510('0x11'));var toCsv=require(_0xe510('0xb'));var querystring=require(_0xe510('0x12'));var Papa=require(_0xe510('0x13'));var Redis=require(_0xe510('0x14'));var authService=require(_0xe510('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe510('0x16'));var hardwareService=require(_0xe510('0x17'));var logger=require(_0xe510('0x18'))(_0xe510('0x19'));var utils=require(_0xe510('0x1a'));var config=require(_0xe510('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a24a,_0x2168b2){_0x2168b2=_0x2168b2||0xcc;return function(_0x55ee64){if(_0x55ee64){return _0x30a24a[_0xe510('0x1c')](_0x2168b2);}return _0x30a24a[_0xe510('0x1d')](_0x2168b2)[_0xe510('0x1e')]();};}function respondWithResult(_0xed4536,_0x351376){_0x351376=_0x351376||0xc8;return function(_0x1b399f){if(_0x1b399f){return _0xed4536[_0xe510('0x1d')](_0x351376)[_0xe510('0x1f')](_0x1b399f);}};}function respondWithFilteredResult(_0x1ebbdd,_0x538d55){return function(_0x8150a7){if(_0x8150a7){var _0x52feea=_0x8150a7[_0xe510('0x20')],_0x574ce5=_0x538d55[_0xe510('0x21')],_0x62948d=_0x538d55[_0xe510('0x21')]+_0x538d55[_0xe510('0x22')],_0x43b191;if(_0x62948d>=_0x52feea){_0x62948d=_0x52feea;_0x43b191=0xc8;}else{_0x43b191=0xce;}_0x1ebbdd[_0xe510('0x1d')](_0x43b191);return _0x1ebbdd[_0xe510('0x23')]('Content-Range',_0x574ce5+'-'+_0x62948d+'/'+_0x52feea)[_0xe510('0x1f')](_0x8150a7);}return null;};}function patchUpdates(_0x421de0){return function(_0x12ac7c){try{jsonpatch[_0xe510('0x24')](_0x12ac7c,_0x421de0,!![]);}catch(_0x3177d6){return BPromise[_0xe510('0x25')](_0x3177d6);}return _0x12ac7c[_0xe510('0x26')]();};}function saveUpdates(_0x55222e,_0xd3237){return function(_0x212e3e){if(_0x212e3e){return _0x212e3e['update'](_0x55222e)[_0xe510('0x27')](function(_0x3a6a0f){return _0x3a6a0f;});}return null;};}function removeEntity(_0x557ca6,_0x25b523){return function(_0x460d28){if(_0x460d28){return _0x460d28['destroy']()[_0xe510('0x27')](function(){_0x557ca6[_0xe510('0x1d')](0xcc)[_0xe510('0x1e')]();});}};}function handleEntityNotFound(_0x2ea51b,_0xc6ffae){return function(_0x4c034f){if(!_0x4c034f){_0x2ea51b[_0xe510('0x1c')](0x194);}return _0x4c034f;};}function handleError(_0x49da46,_0x5afeee){_0x5afeee=_0x5afeee||0x1f4;return function(_0x5544af){logger[_0xe510('0x28')](_0x5544af[_0xe510('0x29')]);if(_0x5544af['name']){delete _0x5544af[_0xe510('0x2a')];}_0x49da46['status'](_0x5afeee)[_0xe510('0x2b')](_0x5544af);};}exports[_0xe510('0x2c')]=function(_0x179323,_0x35fa1a){var _0x1cd9c4={},_0xb260e0={},_0x20eae8={'count':0x0,'rows':[]};var _0x31f728=_[_0xe510('0x2d')](db[_0xe510('0x2e')][_0xe510('0x2f')],function(_0x5dcdb3){return{'name':_0x5dcdb3[_0xe510('0x30')],'type':_0x5dcdb3[_0xe510('0x31')]['key']};});_0xb260e0['model']=_[_0xe510('0x2d')](_0x31f728,_0xe510('0x2a'));_0xb260e0['query']=_[_0xe510('0x32')](_0x179323[_0xe510('0x33')]);_0xb260e0[_0xe510('0x34')]=_[_0xe510('0x35')](_0xb260e0[_0xe510('0x36')],_0xb260e0['query']);_0x1cd9c4[_0xe510('0x37')]=_[_0xe510('0x35')](_0xb260e0[_0xe510('0x36')],qs[_0xe510('0x38')](_0x179323[_0xe510('0x33')][_0xe510('0x38')]));_0x1cd9c4[_0xe510('0x37')]=_0x1cd9c4[_0xe510('0x37')][_0xe510('0x39')]?_0x1cd9c4[_0xe510('0x37')]:_0xb260e0['model'];if(!_0x179323[_0xe510('0x33')][_0xe510('0x3a')](_0xe510('0x3b'))){_0x1cd9c4[_0xe510('0x22')]=qs[_0xe510('0x22')](_0x179323[_0xe510('0x33')][_0xe510('0x22')]);_0x1cd9c4[_0xe510('0x21')]=qs[_0xe510('0x21')](_0x179323[_0xe510('0x33')][_0xe510('0x21')]);}_0x1cd9c4[_0xe510('0x3c')]=qs[_0xe510('0x3d')](_0x179323[_0xe510('0x33')][_0xe510('0x3d')]);_0x1cd9c4[_0xe510('0x3e')]=qs[_0xe510('0x34')](_['pick'](_0x179323[_0xe510('0x33')],_0xb260e0[_0xe510('0x34')]),_0x31f728);if(_0x179323['query'][_0xe510('0x3f')]){_0x1cd9c4[_0xe510('0x3e')]=_['merge'](_0x1cd9c4['where'],{'$or':_[_0xe510('0x2d')](_0x31f728,function(_0x20bcf3){if(_0x20bcf3[_0xe510('0x31')]!==_0xe510('0x40')){var _0x4f3e36={};_0x4f3e36[_0x20bcf3[_0xe510('0x2a')]]={'$like':'%'+_0x179323['query'][_0xe510('0x3f')]+'%'};return _0x4f3e36;}})});}_0x1cd9c4=_[_0xe510('0x41')]({},_0x1cd9c4,_0x179323[_0xe510('0x42')]);var _0x55cff5={'where':_0x1cd9c4[_0xe510('0x3e')]};return db[_0xe510('0x2e')][_0xe510('0x20')](_0x55cff5)[_0xe510('0x27')](function(_0x5e6509){_0x20eae8[_0xe510('0x20')]=_0x5e6509;if(_0x179323[_0xe510('0x33')][_0xe510('0x43')]){_0x1cd9c4[_0xe510('0x44')]=[{'all':!![]}];}return db[_0xe510('0x2e')][_0xe510('0x45')](_0x1cd9c4);})[_0xe510('0x27')](function(_0x1b7f79){_0x20eae8[_0xe510('0x46')]=_0x1b7f79;return _0x20eae8;})[_0xe510('0x27')](respondWithFilteredResult(_0x35fa1a,_0x1cd9c4))[_0xe510('0x47')](handleError(_0x35fa1a,null));};exports[_0xe510('0x48')]=function(_0x186a23,_0x349b54){var _0x5a92f4={'raw':!![],'where':{'id':_0x186a23['params']['id']}},_0x520ea7={};_0x520ea7[_0xe510('0x36')]=_[_0xe510('0x32')](db[_0xe510('0x2e')][_0xe510('0x2f')]);_0x520ea7['query']=_['keys'](_0x186a23[_0xe510('0x33')]);_0x520ea7[_0xe510('0x34')]=_['intersection'](_0x520ea7[_0xe510('0x36')],_0x520ea7[_0xe510('0x33')]);_0x5a92f4['attributes']=_[_0xe510('0x35')](_0x520ea7[_0xe510('0x36')],qs[_0xe510('0x38')](_0x186a23[_0xe510('0x33')]['fields']));_0x5a92f4[_0xe510('0x37')]=_0x5a92f4[_0xe510('0x37')][_0xe510('0x39')]?_0x5a92f4['attributes']:_0x520ea7[_0xe510('0x36')];if(_0x186a23[_0xe510('0x33')]['includeAll']){_0x5a92f4[_0xe510('0x44')]=[{'all':!![]}];}_0x5a92f4=_[_0xe510('0x41')]({},_0x5a92f4,_0x186a23[_0xe510('0x42')]);return db['MailQueueReport'][_0xe510('0x49')](_0x5a92f4)['then'](handleEntityNotFound(_0x349b54,null))[_0xe510('0x27')](respondWithResult(_0x349b54,null))[_0xe510('0x47')](handleError(_0x349b54,null));};exports[_0xe510('0x4a')]=function(_0x2ced62,_0x4e02e0){return db[_0xe510('0x2e')]['create'](_0x2ced62[_0xe510('0x4b')],{})['then'](respondWithResult(_0x4e02e0,0xc9))['catch'](handleError(_0x4e02e0,null));};exports['update']=function(_0x684d19,_0x4edca0){if(_0x684d19['body']['id']){delete _0x684d19['body']['id'];}return db[_0xe510('0x2e')][_0xe510('0x49')]({'where':{'id':_0x684d19[_0xe510('0x4c')]['id']}})[_0xe510('0x27')](handleEntityNotFound(_0x4edca0,null))['then'](saveUpdates(_0x684d19[_0xe510('0x4b')],null))[_0xe510('0x27')](respondWithResult(_0x4edca0,null))[_0xe510('0x47')](handleError(_0x4edca0,null));};exports[_0xe510('0x4d')]=function(_0x533917,_0x4a9b95){return db['MailQueueReport'][_0xe510('0x49')]({'where':{'id':_0x533917[_0xe510('0x4c')]['id']}})[_0xe510('0x27')](handleEntityNotFound(_0x4a9b95,null))[_0xe510('0x27')](removeEntity(_0x4a9b95,null))[_0xe510('0x47')](handleError(_0x4a9b95,null));};exports['describe']=function(_0xb61723,_0x4ba8a6){return db[_0xe510('0x2e')]['describe']()['then'](respondWithResult(_0x4ba8a6,null))[_0xe510('0x47')](handleError(_0x4ba8a6,null));}; \ No newline at end of file +var _0x3572=['../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','MailQueueReport','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x3572,0x15b));var _0x2357=function(_0xbb3d33,_0x516cad){_0xbb3d33=_0xbb3d33-0x0;var _0x73a1b2=_0x3572[_0xbb3d33];return _0x73a1b2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2357('0x0'));var zipdir=require(_0x2357('0x1'));var jsonpatch=require(_0x2357('0x2'));var rp=require('request-promise');var moment=require(_0x2357('0x3'));var BPromise=require(_0x2357('0x4'));var Mustache=require('mustache');var util=require(_0x2357('0x5'));var path=require(_0x2357('0x6'));var sox=require(_0x2357('0x7'));var csv=require(_0x2357('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2357('0x9'));var squel=require(_0x2357('0xa'));var crypto=require(_0x2357('0xb'));var jsforce=require(_0x2357('0xc'));var deskjs=require(_0x2357('0xd'));var toCsv=require(_0x2357('0x8'));var querystring=require('querystring');var Papa=require(_0x2357('0xe'));var Redis=require('ioredis');var authService=require(_0x2357('0xf'));var qs=require(_0x2357('0x10'));var as=require(_0x2357('0x11'));var hardwareService=require(_0x2357('0x12'));var logger=require(_0x2357('0x13'))(_0x2357('0x14'));var utils=require(_0x2357('0x15'));var config=require(_0x2357('0x16'));var db=require(_0x2357('0x17'))['db'];function respondWithStatusCode(_0x4d3cdb,_0x188f36){_0x188f36=_0x188f36||0xcc;return function(_0xbcf69f){if(_0xbcf69f){return _0x4d3cdb[_0x2357('0x18')](_0x188f36);}return _0x4d3cdb[_0x2357('0x19')](_0x188f36)['end']();};}function respondWithResult(_0x33a5dc,_0x56c051){_0x56c051=_0x56c051||0xc8;return function(_0x207a89){if(_0x207a89){return _0x33a5dc[_0x2357('0x19')](_0x56c051)[_0x2357('0x1a')](_0x207a89);}};}function respondWithFilteredResult(_0xa39d9d,_0x4695cd){return function(_0x5d6cf4){if(_0x5d6cf4){var _0x509aa2=_0x5d6cf4['count'],_0x589a20=_0x4695cd[_0x2357('0x1b')],_0x74c21=_0x4695cd[_0x2357('0x1b')]+_0x4695cd[_0x2357('0x1c')],_0x27ac71;if(_0x74c21>=_0x509aa2){_0x74c21=_0x509aa2;_0x27ac71=0xc8;}else{_0x27ac71=0xce;}_0xa39d9d[_0x2357('0x19')](_0x27ac71);return _0xa39d9d[_0x2357('0x1d')](_0x2357('0x1e'),_0x589a20+'-'+_0x74c21+'/'+_0x509aa2)[_0x2357('0x1a')](_0x5d6cf4);}return null;};}function patchUpdates(_0x3c6be9){return function(_0x5413f6){try{jsonpatch[_0x2357('0x1f')](_0x5413f6,_0x3c6be9,!![]);}catch(_0x39bb57){return BPromise[_0x2357('0x20')](_0x39bb57);}return _0x5413f6[_0x2357('0x21')]();};}function saveUpdates(_0x600fb4,_0x4d5b2a){return function(_0x3ae643){if(_0x3ae643){return _0x3ae643[_0x2357('0x22')](_0x600fb4)['then'](function(_0x18418d){return _0x18418d;});}return null;};}function removeEntity(_0x57c839,_0x3c4a35){return function(_0x56bf37){if(_0x56bf37){return _0x56bf37[_0x2357('0x23')]()[_0x2357('0x24')](function(){_0x57c839[_0x2357('0x19')](0xcc)[_0x2357('0x25')]();});}};}function handleEntityNotFound(_0x4a0627,_0x35eae1){return function(_0x2f10ab){if(!_0x2f10ab){_0x4a0627[_0x2357('0x18')](0x194);}return _0x2f10ab;};}function handleError(_0x3d8717,_0x4e2da8){_0x4e2da8=_0x4e2da8||0x1f4;return function(_0x2c752a){logger[_0x2357('0x26')](_0x2c752a['stack']);if(_0x2c752a[_0x2357('0x27')]){delete _0x2c752a[_0x2357('0x27')];}_0x3d8717[_0x2357('0x19')](_0x4e2da8)[_0x2357('0x28')](_0x2c752a);};}exports[_0x2357('0x29')]=function(_0x98cd40,_0x165c65){var _0x477975={},_0x5ee83c={},_0x29a8ee={'count':0x0,'rows':[]};var _0x2b81d2=_[_0x2357('0x2a')](db[_0x2357('0x2b')][_0x2357('0x2c')],function(_0x4fadf3){return{'name':_0x4fadf3['fieldName'],'type':_0x4fadf3[_0x2357('0x2d')]['key']};});_0x5ee83c['model']=_[_0x2357('0x2a')](_0x2b81d2,_0x2357('0x27'));_0x5ee83c[_0x2357('0x2e')]=_['keys'](_0x98cd40['query']);_0x5ee83c[_0x2357('0x2f')]=_[_0x2357('0x30')](_0x5ee83c[_0x2357('0x31')],_0x5ee83c[_0x2357('0x2e')]);_0x477975[_0x2357('0x32')]=_[_0x2357('0x30')](_0x5ee83c['model'],qs['fields'](_0x98cd40[_0x2357('0x2e')][_0x2357('0x33')]));_0x477975[_0x2357('0x32')]=_0x477975['attributes'][_0x2357('0x34')]?_0x477975[_0x2357('0x32')]:_0x5ee83c[_0x2357('0x31')];if(!_0x98cd40[_0x2357('0x2e')][_0x2357('0x35')](_0x2357('0x36'))){_0x477975['limit']=qs[_0x2357('0x1c')](_0x98cd40[_0x2357('0x2e')][_0x2357('0x1c')]);_0x477975[_0x2357('0x1b')]=qs[_0x2357('0x1b')](_0x98cd40['query'][_0x2357('0x1b')]);}_0x477975[_0x2357('0x37')]=qs[_0x2357('0x38')](_0x98cd40[_0x2357('0x2e')][_0x2357('0x38')]);_0x477975['where']=qs[_0x2357('0x2f')](_[_0x2357('0x39')](_0x98cd40[_0x2357('0x2e')],_0x5ee83c[_0x2357('0x2f')]),_0x2b81d2);if(_0x98cd40[_0x2357('0x2e')][_0x2357('0x3a')]){_0x477975[_0x2357('0x3b')]=_[_0x2357('0x3c')](_0x477975[_0x2357('0x3b')],{'$or':_[_0x2357('0x2a')](_0x2b81d2,function(_0x9e6343){if(_0x9e6343[_0x2357('0x2d')]!=='VIRTUAL'){var _0x2a7ba1={};_0x2a7ba1[_0x9e6343[_0x2357('0x27')]]={'$like':'%'+_0x98cd40[_0x2357('0x2e')][_0x2357('0x3a')]+'%'};return _0x2a7ba1;}})});}_0x477975=_[_0x2357('0x3c')]({},_0x477975,_0x98cd40[_0x2357('0x3d')]);var _0x4eef2f={'where':_0x477975['where']};return db[_0x2357('0x2b')][_0x2357('0x3e')](_0x4eef2f)[_0x2357('0x24')](function(_0x1773e5){_0x29a8ee['count']=_0x1773e5;if(_0x98cd40['query'][_0x2357('0x3f')]){_0x477975[_0x2357('0x40')]=[{'all':!![]}];}return db[_0x2357('0x2b')][_0x2357('0x41')](_0x477975);})[_0x2357('0x24')](function(_0x113027){_0x29a8ee['rows']=_0x113027;return _0x29a8ee;})[_0x2357('0x24')](respondWithFilteredResult(_0x165c65,_0x477975))[_0x2357('0x42')](handleError(_0x165c65,null));};exports[_0x2357('0x43')]=function(_0x4545e5,_0x3f828d){var _0x136b1b={'raw':!![],'where':{'id':_0x4545e5[_0x2357('0x44')]['id']}},_0x9a9699={};_0x9a9699[_0x2357('0x31')]=_['keys'](db[_0x2357('0x2b')][_0x2357('0x2c')]);_0x9a9699[_0x2357('0x2e')]=_[_0x2357('0x45')](_0x4545e5['query']);_0x9a9699[_0x2357('0x2f')]=_[_0x2357('0x30')](_0x9a9699['model'],_0x9a9699[_0x2357('0x2e')]);_0x136b1b[_0x2357('0x32')]=_[_0x2357('0x30')](_0x9a9699[_0x2357('0x31')],qs[_0x2357('0x33')](_0x4545e5[_0x2357('0x2e')]['fields']));_0x136b1b[_0x2357('0x32')]=_0x136b1b['attributes'][_0x2357('0x34')]?_0x136b1b[_0x2357('0x32')]:_0x9a9699[_0x2357('0x31')];if(_0x4545e5[_0x2357('0x2e')][_0x2357('0x3f')]){_0x136b1b[_0x2357('0x40')]=[{'all':!![]}];}_0x136b1b=_[_0x2357('0x3c')]({},_0x136b1b,_0x4545e5[_0x2357('0x3d')]);return db['MailQueueReport'][_0x2357('0x46')](_0x136b1b)[_0x2357('0x24')](handleEntityNotFound(_0x3f828d,null))['then'](respondWithResult(_0x3f828d,null))[_0x2357('0x42')](handleError(_0x3f828d,null));};exports[_0x2357('0x47')]=function(_0x18e946,_0x3bab12){return db[_0x2357('0x2b')]['create'](_0x18e946['body'],{})['then'](respondWithResult(_0x3bab12,0xc9))['catch'](handleError(_0x3bab12,null));};exports['update']=function(_0x2218e8,_0x53546e){if(_0x2218e8[_0x2357('0x48')]['id']){delete _0x2218e8[_0x2357('0x48')]['id'];}return db[_0x2357('0x2b')][_0x2357('0x46')]({'where':{'id':_0x2218e8[_0x2357('0x44')]['id']}})['then'](handleEntityNotFound(_0x53546e,null))[_0x2357('0x24')](saveUpdates(_0x2218e8[_0x2357('0x48')],null))['then'](respondWithResult(_0x53546e,null))[_0x2357('0x42')](handleError(_0x53546e,null));};exports[_0x2357('0x23')]=function(_0x169539,_0x297140){return db[_0x2357('0x2b')][_0x2357('0x46')]({'where':{'id':_0x169539[_0x2357('0x44')]['id']}})[_0x2357('0x24')](handleEntityNotFound(_0x297140,null))[_0x2357('0x24')](removeEntity(_0x297140,null))[_0x2357('0x42')](handleError(_0x297140,null));};exports[_0x2357('0x49')]=function(_0x3dc85b,_0xf828af){return db[_0x2357('0x2b')][_0x2357('0x49')]()[_0x2357('0x24')](respondWithResult(_0xf828af,null))[_0x2357('0x42')](handleError(_0xf828af,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c5f57df..8580098 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 _0x86c0=['path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x391be4,_0x4ee119){var _0x1f911b=function(_0x3972f3){while(--_0x3972f3){_0x391be4['push'](_0x391be4['shift']());}};_0x1f911b(++_0x4ee119);}(_0x86c0,0x133));var _0x086c=function(_0x952fa4,_0x1fbd55){_0x952fa4=_0x952fa4-0x0;var _0x3a8313=_0x86c0[_0x952fa4];return _0x3a8313;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var logger=require(_0x086c('0x1'))(_0x086c('0x2'));var moment=require(_0x086c('0x3'));var BPromise=require(_0x086c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x086c('0x5'));var rimraf=require(_0x086c('0x6'));var config=require(_0x086c('0x7'));var attributes=require(_0x086c('0x8'));module['exports']=function(_0x3c681a,_0x19e58d){return _0x3c681a[_0x086c('0x9')](_0x086c('0xa'),attributes,{'tableName':_0x086c('0xb'),'paranoid':![],'indexes':[{'name':_0x086c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x161a=['../../config/logger','api','bluebird','path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x3f9639,_0x157af1){var _0x154570=function(_0x183e9d){while(--_0x183e9d){_0x3f9639['push'](_0x3f9639['shift']());}};_0x154570(++_0x157af1);}(_0x161a,0x140));var _0xa161=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x161a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa161('0x0'))(_0xa161('0x1'));var moment=require('moment');var BPromise=require(_0xa161('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa161('0x3'));var rimraf=require(_0xa161('0x4'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xa161('0x5')]=function(_0x1705ab,_0x12d54c){return _0x1705ab[_0xa161('0x6')](_0xa161('0x7'),attributes,{'tableName':_0xa161('0x8'),'paranoid':![],'indexes':[{'name':_0xa161('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ac46d43..936f00b 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 _0x5496=['limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes'];(function(_0x2b293c,_0x59dd55){var _0x2b3c79=function(_0x1ad463){while(--_0x1ad463){_0x2b293c['push'](_0x2b293c['shift']());}};_0x2b3c79(++_0x59dd55);}(_0x5496,0x175));var _0x6549=function(_0x467a20,_0x4563cb){_0x467a20=_0x467a20-0x0;var _0x24e066=_0x5496[_0x467a20];return _0x24e066;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['MailQueueReport'][_0x6549('0x16')](_0x53b12b[_0x6549('0x17')],{'raw':_0x53b12b[_0x6549('0x18')]?_0x53b12b[_0x6549('0x18')][_0x6549('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x228117){logger['info'](_0x6549('0x15'),_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x228117));_0x26a212(_0x228117);})[_0x6549('0x14')](function(_0x12d547){logger[_0x6549('0x10')](_0x6549('0x15'),_0x12d547[_0x6549('0x12')],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x12d547[_0x6549('0x12')]));});});};exports[_0x6549('0x1a')]=function(_0x23c0ba){var _0x5eeacd=this;return new Promise(function(_0x30404e,_0x1bc8db){return db['MailQueueReport'][_0x6549('0x1b')](_0x23c0ba[_0x6549('0x17')],{'raw':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba['options'][_0x6549('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba[_0x6549('0x18')][_0x6549('0x1c')]||null:null,'attributes':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba[_0x6549('0x18')][_0x6549('0x1d')]||null:null,'limit':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba['options'][_0x6549('0x1e')]||null:null})[_0x6549('0xa')](function(_0x17fdfb){logger['info'](_0x6549('0x1a'),_0x23c0ba);logger['debug']('UpdateMailQueueReport',_0x23c0ba,JSON['stringify'](_0x17fdfb));_0x30404e(_0x17fdfb);})[_0x6549('0x14')](function(_0x219a96){logger['error'](_0x6549('0x1a'),_0x219a96[_0x6549('0x12')],_0x23c0ba);_0x1bc8db(_0x5eeacd[_0x6549('0x10')](0x1f4,_0x219a96[_0x6549('0x12')]));});});}; \ No newline at end of file +var _0xfdbd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','UpdateMailQueueReport','update','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1ec4c5,_0x2bc91a){var _0x5dd4cb=function(_0x1e7452){while(--_0x1e7452){_0x1ec4c5['push'](_0x1ec4c5['shift']());}};_0x5dd4cb(++_0x2bc91a);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xfdbd[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x489f19,_0x556dc0,_0x590b5d){return new BPromise(function(_0x188508,_0xf72a24){return client['request'](_0x489f19,_0x590b5d)[_0xdfdb('0xc')](function(_0x444c19){logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));logger[_0xdfdb('0x10')](_0xdfdb('0x11'),_0x556dc0,'request\x20sent',JSON[_0xdfdb('0x12')](_0x444c19));if(_0x444c19[_0xdfdb('0x13')]){if(_0x444c19['error'][_0xdfdb('0x14')]===0x1f4){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);return _0xf72a24(_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);}logger[_0xdfdb('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x556dc0,_0x444c19['error'][_0xdfdb('0x15')]);return _0x188508(_0x444c19['error'][_0xdfdb('0x15')]);}else{logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));_0x188508(_0x444c19[_0xdfdb('0x16')][_0xdfdb('0x15')]);}})['catch'](function(_0x4fd3d5){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x4fd3d5);_0xf72a24(_0x4fd3d5);});});}exports[_0xdfdb('0x17')]=function(_0x55ab5a){var _0x3eb100=this;return new Promise(function(_0xb677b1,_0x467653){return db[_0xdfdb('0x18')][_0xdfdb('0x19')](_0x55ab5a[_0xdfdb('0x1a')],{'raw':_0x55ab5a[_0xdfdb('0x1b')]?_0x55ab5a[_0xdfdb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdfdb('0xc')](function(_0xb7417c){logger[_0xdfdb('0xd')]('CreateMailQueueReport',_0x55ab5a);logger[_0xdfdb('0x10')](_0xdfdb('0x17'),_0x55ab5a,JSON[_0xdfdb('0x12')](_0xb7417c));_0xb677b1(_0xb7417c);})['catch'](function(_0x280e53){logger[_0xdfdb('0x13')](_0xdfdb('0x17'),_0x280e53['message'],_0x55ab5a);_0x467653(_0x3eb100[_0xdfdb('0x13')](0x1f4,_0x280e53['message']));});});};exports[_0xdfdb('0x1c')]=function(_0x145350){var _0x1fa2f3=this;return new Promise(function(_0x2a560c,_0x4f69cf){return db[_0xdfdb('0x18')][_0xdfdb('0x1d')](_0x145350[_0xdfdb('0x1a')],{'raw':_0x145350[_0xdfdb('0x1b')]?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145350['options']?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x1f')]||null:null,'attributes':_0x145350[_0xdfdb('0x1b')]?_0x145350['options'][_0xdfdb('0x20')]||null:null,'limit':_0x145350['options']?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x21')]||null:null})[_0xdfdb('0xc')](function(_0x513fa0){logger['info'](_0xdfdb('0x1c'),_0x145350);logger[_0xdfdb('0x10')](_0xdfdb('0x1c'),_0x145350,JSON[_0xdfdb('0x12')](_0x513fa0));_0x2a560c(_0x513fa0);})[_0xdfdb('0x22')](function(_0x165f72){logger['error'](_0xdfdb('0x1c'),_0x165f72[_0xdfdb('0x15')],_0x145350);_0x4f69cf(_0x1fa2f3[_0xdfdb('0x13')](0x1f4,_0x165f72[_0xdfdb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0f8833d..50832eb 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 _0xc689=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8ee37d,_0xb3e121){var _0x49ad1b=function(_0xf0551f){while(--_0xf0551f){_0x8ee37d['push'](_0x8ee37d['shift']());}};_0x49ad1b(++_0xb3e121);}(_0xc689,0x6a));var _0x9c68=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0xc689[_0x3d9176];return _0x12adc5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c68('0x0'));var timeout=require(_0x9c68('0x1'));var express=require(_0x9c68('0x2'));var router=express[_0x9c68('0x3')]();var auth=require(_0x9c68('0x4'));var interaction=require(_0x9c68('0x5'));var config=require('../../config/environment');module[_0x9c68('0x6')]=router; \ No newline at end of file +var _0xf20a=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x56859c,_0x3a57cb){var _0x25b479=function(_0x17c921){while(--_0x17c921){_0x56859c['push'](_0x56859c['shift']());}};_0x25b479(++_0x3a57cb);}(_0xf20a,0x1b8));var _0xaf20=function(_0x5730f8,_0x127cd8){_0x5730f8=_0x5730f8-0x0;var _0x279f09=_0xf20a[_0x5730f8];return _0x279f09;};'use strict';var multer=require(_0xaf20('0x0'));var util=require(_0xaf20('0x1'));var path=require(_0xaf20('0x2'));var timeout=require(_0xaf20('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xaf20('0x4'));var interaction=require(_0xaf20('0x5'));var config=require(_0xaf20('0x6'));module[_0xaf20('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 63dacd2..a00caaa 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 _0x47ac=['STRING','username','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0xeaba4b,_0x1eab4b){var _0x32f4fd=function(_0x43ec5b){while(--_0x43ec5b){_0xeaba4b['push'](_0xeaba4b['shift']());}};_0x32f4fd(++_0x1eab4b);}(_0x47ac,0xfa));var _0xc47a=function(_0x2e8ddb,_0x40f3d7){_0x2e8ddb=_0x2e8ddb-0x0;var _0x7327c9=_0x47ac[_0x2e8ddb];return _0x7327c9;};'use strict';var Sequelize=require(_0xc47a('0x0'));module[_0xc47a('0x1')]={'description':{'type':Sequelize[_0xc47a('0x2')]},'host':{'type':Sequelize[_0xc47a('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xc47a('0x2')],'unique':_0xc47a('0x3')},'password':{'type':Sequelize[_0xc47a('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xc47a('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc47a('0x2')],'defaultValue':_0xc47a('0x5')},'connTimeout':{'type':Sequelize[_0xc47a('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc47a('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc47a('0x2')]}}; \ No newline at end of file +var _0x75c2=['INTEGER','STRING','BOOLEAN','username','INBOX'];(function(_0x20425d,_0xde8a03){var _0x504ce9=function(_0x108c00){while(--_0x108c00){_0x20425d['push'](_0x20425d['shift']());}};_0x504ce9(++_0xde8a03);}(_0x75c2,0x196));var _0x275c=function(_0x4737b9,_0xda6545){_0x4737b9=_0x4737b9-0x0;var _0x22a941=_0x75c2[_0x4737b9];return _0x22a941;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x275c('0x0')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x275c('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x275c('0x0')],'unique':_0x275c('0x2')},'password':{'type':Sequelize[_0x275c('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x275c('0x0')],'defaultValue':_0x275c('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x275c('0x4')],'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 0b1dfda..ece0d5a 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 _0x4006=['path','../../config/environment','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment'];(function(_0x7f533c,_0x1d5bb5){var _0x1dd258=function(_0x26a74a){while(--_0x26a74a){_0x7f533c['push'](_0x7f533c['shift']());}};_0x1dd258(++_0x1d5bb5);}(_0x4006,0x1c7));var _0x6400=function(_0x1a7c0e,_0x3739da){_0x1a7c0e=_0x1a7c0e-0x0;var _0x5c811e=_0x4006[_0x1a7c0e];return _0x5c811e;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var logger=require(_0x6400('0x1'))(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6400('0x4'));var rimraf=require('rimraf');var config=require(_0x6400('0x5'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2dbd03,_0x599e6f){return _0x2dbd03[_0x6400('0x6')](_0x6400('0x7'),attributes,{'tableName':_0x6400('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe7=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x581f8e,_0x5617cb){var _0x18aec=function(_0x4536c7){while(--_0x4536c7){_0x581f8e['push'](_0x581f8e['shift']());}};_0x18aec(++_0x5617cb);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x279876,_0x31e6ac){_0x279876=_0x279876-0x0;var _0x190e08=_0xdfe7[_0x279876];return _0x190e08;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var logger=require(_0x7dfe('0x1'))('api');var moment=require(_0x7dfe('0x2'));var BPromise=require(_0x7dfe('0x3'));var rp=require(_0x7dfe('0x4'));var fs=require('fs');var path=require(_0x7dfe('0x5'));var rimraf=require('rimraf');var config=require(_0x7dfe('0x6'));var attributes=require(_0x7dfe('0x7'));module['exports']=function(_0x262561,_0x3d8220){return _0x262561[_0x7dfe('0x8')](_0x7dfe('0x9'),attributes,{'tableName':'mail_servers_in','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 fbc0185..ba2b3ca 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 _0x7083=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','MailServerIn,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','MailServerIn','findAll','options','where','attributes','limit','include','model','map','GetMailServerIn','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0x7083,0x11a));var _0x3708=function(_0x3512d0,_0x4e15c6){_0x3512d0=_0x3512d0-0x0;var _0x54e6e9=_0x7083[_0x3512d0];return _0x54e6e9;};'use strict';var _=require(_0x3708('0x0'));var util=require(_0x3708('0x1'));var moment=require(_0x3708('0x2'));var BPromise=require(_0x3708('0x3'));var rs=require(_0x3708('0x4'));var fs=require('fs');var Redis=require(_0x3708('0x5'));var db=require(_0x3708('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3708('0x7'))(_0x3708('0x8'));var config=require(_0x3708('0x9'));var jayson=require(_0x3708('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x124be8,_0x345969,_0x1c074e){return new BPromise(function(_0x381ac6,_0x4d0223){return client['request'](_0x124be8,_0x1c074e)[_0x3708('0xb')](function(_0x27b639){logger['info'](_0x3708('0xc'),_0x345969,_0x3708('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x345969,_0x3708('0xd'),JSON['stringify'](_0x27b639));if(_0x27b639['error']){if(_0x27b639['error'][_0x3708('0xe')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x345969,_0x27b639[_0x3708('0xf')][_0x3708('0x10')]);return _0x4d0223(_0x27b639[_0x3708('0xf')][_0x3708('0x10')]);}logger[_0x3708('0xf')](_0x3708('0xc'),_0x345969,_0x27b639[_0x3708('0xf')][_0x3708('0x10')]);return _0x381ac6(_0x27b639[_0x3708('0xf')][_0x3708('0x10')]);}else{logger[_0x3708('0x11')]('MailServerIn,\x20%s,\x20%s',_0x345969,'request\x20sent');_0x381ac6(_0x27b639[_0x3708('0x12')]['message']);}})[_0x3708('0x13')](function(_0x2e4758){logger[_0x3708('0xf')]('MailServerIn,\x20%s,\x20%s',_0x345969,_0x2e4758);_0x4d0223(_0x2e4758);});});}exports['GetMailServerIn']=function(_0x112d4b){var _0x1326c8=this;return new Promise(function(_0x2fa16,_0x579ee0){return db[_0x3708('0x14')][_0x3708('0x15')]({'raw':_0x112d4b['options']?_0x112d4b['options']['raw']===undefined?!![]:![]:!![],'where':_0x112d4b[_0x3708('0x16')]?_0x112d4b[_0x3708('0x16')][_0x3708('0x17')]||null:null,'attributes':_0x112d4b[_0x3708('0x16')]?_0x112d4b[_0x3708('0x16')][_0x3708('0x18')]||null:null,'limit':_0x112d4b[_0x3708('0x16')]?_0x112d4b[_0x3708('0x16')][_0x3708('0x19')]||null:null,'include':_0x112d4b[_0x3708('0x16')]?_0x112d4b[_0x3708('0x16')][_0x3708('0x1a')]?_['map'](_0x112d4b[_0x3708('0x16')][_0x3708('0x1a')],function(_0x9f2043){return{'model':db[_0x9f2043[_0x3708('0x1b')]],'as':_0x9f2043['as'],'attributes':_0x9f2043[_0x3708('0x18')],'include':_0x9f2043['include']?_['map'](_0x9f2043[_0x3708('0x1a')],function(_0x2566de){return{'model':db[_0x2566de[_0x3708('0x1b')]],'as':_0x2566de['as'],'attributes':_0x2566de[_0x3708('0x18')],'include':_0x2566de[_0x3708('0x1a')]?_[_0x3708('0x1c')](_0x2566de['include'],function(_0xf32a73){return{'model':db[_0xf32a73[_0x3708('0x1b')]],'as':_0xf32a73['as'],'attributes':_0xf32a73[_0x3708('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3708('0xb')](function(_0x305e60){logger[_0x3708('0x11')](_0x3708('0x1d'),_0x112d4b);logger[_0x3708('0x1e')]('GetMailServerIn',_0x112d4b,JSON[_0x3708('0x1f')](_0x305e60));_0x2fa16(_0x305e60);})[_0x3708('0x13')](function(_0x32a31d){logger[_0x3708('0xf')](_0x3708('0x1d'),_0x32a31d[_0x3708('0x10')],_0x112d4b);_0x579ee0(_0x1326c8[_0x3708('0xf')](0x1f4,_0x32a31d[_0x3708('0x10')]));});});}; \ No newline at end of file +var _0x2cf5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetMailServerIn','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','lodash','util'];(function(_0x10531f,_0x2a7370){var _0x42cc88=function(_0x1e60c8){while(--_0x1e60c8){_0x10531f['push'](_0x10531f['shift']());}};_0x42cc88(++_0x2a7370);}(_0x2cf5,0xb8));var _0x52cf=function(_0x33277c,_0xff20eb){_0x33277c=_0x33277c-0x0;var _0x198adb=_0x2cf5[_0x33277c];return _0x198adb;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require(_0x52cf('0x3'));var fs=require('fs');var Redis=require(_0x52cf('0x4'));var db=require(_0x52cf('0x5'))['db'];var utils=require(_0x52cf('0x6'));var logger=require(_0x52cf('0x7'))(_0x52cf('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x52cf('0x9')][_0x52cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197684,_0x317634,_0x29c285){return new BPromise(function(_0x2bf002,_0x4191bb){return client[_0x52cf('0xb')](_0x197684,_0x29c285)[_0x52cf('0xc')](function(_0x26a24a){logger[_0x52cf('0xd')](_0x52cf('0xe'),_0x317634,_0x52cf('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x317634,'request\x20sent',JSON['stringify'](_0x26a24a));if(_0x26a24a[_0x52cf('0x10')]){if(_0x26a24a['error'][_0x52cf('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x317634,_0x26a24a['error']['message']);return _0x4191bb(_0x26a24a[_0x52cf('0x10')]['message']);}logger[_0x52cf('0x10')](_0x52cf('0xe'),_0x317634,_0x26a24a['error'][_0x52cf('0x12')]);return _0x2bf002(_0x26a24a['error'][_0x52cf('0x12')]);}else{logger[_0x52cf('0xd')](_0x52cf('0xe'),_0x317634,'request\x20sent');_0x2bf002(_0x26a24a['result'][_0x52cf('0x12')]);}})[_0x52cf('0x13')](function(_0x31524f){logger['error']('MailServerIn,\x20%s,\x20%s',_0x317634,_0x31524f);_0x4191bb(_0x31524f);});});}exports[_0x52cf('0x14')]=function(_0x3e1588){var _0x11a6d6=this;return new Promise(function(_0x4019a1,_0x18de9a){return db['MailServerIn'][_0x52cf('0x15')]({'raw':_0x3e1588['options']?_0x3e1588[_0x52cf('0x16')][_0x52cf('0x17')]===undefined?!![]:![]:!![],'where':_0x3e1588[_0x52cf('0x16')]?_0x3e1588['options']['where']||null:null,'attributes':_0x3e1588['options']?_0x3e1588[_0x52cf('0x16')][_0x52cf('0x18')]||null:null,'limit':_0x3e1588[_0x52cf('0x16')]?_0x3e1588['options'][_0x52cf('0x19')]||null:null,'include':_0x3e1588[_0x52cf('0x16')]?_0x3e1588[_0x52cf('0x16')][_0x52cf('0x1a')]?_['map'](_0x3e1588[_0x52cf('0x16')][_0x52cf('0x1a')],function(_0x40ce1b){return{'model':db[_0x40ce1b[_0x52cf('0x1b')]],'as':_0x40ce1b['as'],'attributes':_0x40ce1b[_0x52cf('0x18')],'include':_0x40ce1b[_0x52cf('0x1a')]?_['map'](_0x40ce1b['include'],function(_0x231cb6){return{'model':db[_0x231cb6[_0x52cf('0x1b')]],'as':_0x231cb6['as'],'attributes':_0x231cb6[_0x52cf('0x18')],'include':_0x231cb6[_0x52cf('0x1a')]?_[_0x52cf('0x1c')](_0x231cb6[_0x52cf('0x1a')],function(_0x2c03ea){return{'model':db[_0x2c03ea[_0x52cf('0x1b')]],'as':_0x2c03ea['as'],'attributes':_0x2c03ea[_0x52cf('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4479b1){logger[_0x52cf('0xd')]('GetMailServerIn',_0x3e1588);logger[_0x52cf('0x1d')]('GetMailServerIn',_0x3e1588,JSON[_0x52cf('0x1e')](_0x4479b1));_0x4019a1(_0x4479b1);})[_0x52cf('0x13')](function(_0x1ad194){logger[_0x52cf('0x10')](_0x52cf('0x14'),_0x1ad194['message'],_0x3e1588);_0x18de9a(_0x11a6d6[_0x52cf('0x10')](0x1f4,_0x1ad194[_0x52cf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9516e1b..dc2fb29 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 _0xd7a4=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','get','isAuthenticated','show','create','put','/:id'];(function(_0x1ccf3d,_0x461209){var _0x5345c1=function(_0x55c638){while(--_0x55c638){_0x1ccf3d['push'](_0x1ccf3d['shift']());}};_0x5345c1(++_0x461209);}(_0xd7a4,0xd4));var _0x4d7a=function(_0x45dbd0,_0x9be786){_0x45dbd0=_0x45dbd0-0x0;var _0x228a03=_0xd7a4[_0x45dbd0];return _0x228a03;};'use strict';var multer=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var path=require(_0x4d7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d7a('0x3'));var router=express[_0x4d7a('0x4')]();var auth=require(_0x4d7a('0x5'));var interaction=require(_0x4d7a('0x6'));var config=require(_0x4d7a('0x7'));var controller=require(_0x4d7a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4d7a('0x9')]);router[_0x4d7a('0xa')]('/:id',auth[_0x4d7a('0xb')](),controller[_0x4d7a('0xc')]);router['post']('/',auth[_0x4d7a('0xb')](),controller[_0x4d7a('0xd')]);router[_0x4d7a('0xe')](_0x4d7a('0xf'),auth[_0x4d7a('0xb')](),controller['update']);router[_0x4d7a('0x10')](_0x4d7a('0xf'),auth['isAuthenticated'](),controller[_0x4d7a('0x11')]);module[_0x4d7a('0x12')]=router; \ No newline at end of file +var _0xeee5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','show','post','update','delete','exports','multer','util','path','express'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0xeee5,0xf8));var _0x5eee=function(_0x3a53b4,_0x36d8e4){_0x3a53b4=_0x3a53b4-0x0;var _0x531720=_0xeee5[_0x3a53b4];return _0x531720;};'use strict';var multer=require(_0x5eee('0x0'));var util=require(_0x5eee('0x1'));var path=require(_0x5eee('0x2'));var timeout=require('connect-timeout');var express=require(_0x5eee('0x3'));var router=express[_0x5eee('0x4')]();var auth=require(_0x5eee('0x5'));var interaction=require(_0x5eee('0x6'));var config=require(_0x5eee('0x7'));var controller=require(_0x5eee('0x8'));router['get']('/',auth[_0x5eee('0x9')](),controller[_0x5eee('0xa')]);router[_0x5eee('0xb')](_0x5eee('0xc'),auth[_0x5eee('0x9')](),controller[_0x5eee('0xd')]);router[_0x5eee('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5eee('0xc'),auth['isAuthenticated'](),controller[_0x5eee('0xf')]);router[_0x5eee('0x10')](_0x5eee('0xc'),auth[_0x5eee('0x9')](),controller['destroy']);module[_0x5eee('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 2ec1ce0..c86b199 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 _0x39d2=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39d2,0xf5));var _0x239d=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x39d2[_0x4c2f30];return _0xb8854d;};'use strict';var Sequelize=require(_0x239d('0x0'));module['exports']={'description':{'type':Sequelize[_0x239d('0x1')]},'host':{'type':Sequelize[_0x239d('0x1')]},'user':{'type':Sequelize[_0x239d('0x1')]},'pass':{'type':Sequelize[_0x239d('0x1')]},'port':{'type':Sequelize[_0x239d('0x2')]},'secure':{'type':Sequelize[_0x239d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x239d('0x1')]},'authentication':{'type':Sequelize[_0x239d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c75=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x5448cb,_0x1ab653){var _0x4c44d3=function(_0x41c363){while(--_0x41c363){_0x5448cb['push'](_0x5448cb['shift']());}};_0x4c44d3(++_0x1ab653);}(_0x0c75,0x6a));var _0x50c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c75[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x50c7('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x50c7('0x1')]},'user':{'type':Sequelize[_0x50c7('0x1')]},'pass':{'type':Sequelize[_0x50c7('0x1')]},'port':{'type':Sequelize[_0x50c7('0x2')]},'secure':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x50c7('0x1')]},'authentication':{'type':Sequelize[_0x50c7('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 adc70dc..7afa4e4 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 _0x6da1=['map','VIRTUAL','options','MailServerOut','includeAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','fieldName','type','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x19cb0f,_0x48c633){var _0x2485bb=function(_0xadfea8){while(--_0xadfea8){_0x19cb0f['push'](_0x19cb0f['shift']());}};_0x2485bb(++_0x48c633);}(_0x6da1,0x1b8));var _0x16da=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x6da1[_0x35b18a];return _0x4db1bd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16da('0x1'));var jsonpatch=require(_0x16da('0x2'));var rp=require(_0x16da('0x3'));var moment=require('moment');var BPromise=require(_0x16da('0x4'));var Mustache=require(_0x16da('0x5'));var util=require('util');var path=require(_0x16da('0x6'));var sox=require(_0x16da('0x7'));var csv=require(_0x16da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x16da('0x9'));var crypto=require(_0x16da('0xa'));var jsforce=require(_0x16da('0xb'));var deskjs=require(_0x16da('0xc'));var toCsv=require('to-csv');var querystring=require(_0x16da('0xd'));var Papa=require('papaparse');var Redis=require(_0x16da('0xe'));var authService=require(_0x16da('0xf'));var qs=require(_0x16da('0x10'));var as=require(_0x16da('0x11'));var hardwareService=require(_0x16da('0x12'));var logger=require(_0x16da('0x13'))(_0x16da('0x14'));var utils=require(_0x16da('0x15'));var config=require(_0x16da('0x16'));var db=require(_0x16da('0x17'))['db'];function respondWithStatusCode(_0x7c6e17,_0x489baf){_0x489baf=_0x489baf||0xcc;return function(_0x5bec0f){if(_0x5bec0f){return _0x7c6e17['sendStatus'](_0x489baf);}return _0x7c6e17[_0x16da('0x18')](_0x489baf)[_0x16da('0x19')]();};}function respondWithResult(_0x1225ff,_0x484b63){_0x484b63=_0x484b63||0xc8;return function(_0x44a96c){if(_0x44a96c){return _0x1225ff[_0x16da('0x18')](_0x484b63)[_0x16da('0x1a')](_0x44a96c);}};}function respondWithFilteredResult(_0x542d91,_0x4205af){return function(_0x24a5f6){if(_0x24a5f6){var _0x469178=_0x24a5f6[_0x16da('0x1b')],_0x35f6c8=_0x4205af[_0x16da('0x1c')],_0x54ce5b=_0x4205af[_0x16da('0x1c')]+_0x4205af[_0x16da('0x1d')],_0x24aad9;if(_0x54ce5b>=_0x469178){_0x54ce5b=_0x469178;_0x24aad9=0xc8;}else{_0x24aad9=0xce;}_0x542d91[_0x16da('0x18')](_0x24aad9);return _0x542d91[_0x16da('0x1e')](_0x16da('0x1f'),_0x35f6c8+'-'+_0x54ce5b+'/'+_0x469178)[_0x16da('0x1a')](_0x24a5f6);}return null;};}function patchUpdates(_0x29f984){return function(_0x22df22){try{jsonpatch[_0x16da('0x20')](_0x22df22,_0x29f984,!![]);}catch(_0x5f3035){return BPromise[_0x16da('0x21')](_0x5f3035);}return _0x22df22[_0x16da('0x22')]();};}function saveUpdates(_0x3ea075,_0x931671){return function(_0x335698){if(_0x335698){return _0x335698[_0x16da('0x23')](_0x3ea075)['then'](function(_0x51353c){return _0x51353c;});}return null;};}function removeEntity(_0x3ea222,_0x2bd7e2){return function(_0x2d606e){if(_0x2d606e){return _0x2d606e['destroy']()[_0x16da('0x24')](function(){_0x3ea222[_0x16da('0x18')](0xcc)[_0x16da('0x19')]();});}};}function handleEntityNotFound(_0x2ea133,_0x345fc7){return function(_0xae2a6e){if(!_0xae2a6e){_0x2ea133[_0x16da('0x25')](0x194);}return _0xae2a6e;};}function handleError(_0x5c27c2,_0x4a5a6c){_0x4a5a6c=_0x4a5a6c||0x1f4;return function(_0x5a81){logger[_0x16da('0x26')](_0x5a81['stack']);if(_0x5a81[_0x16da('0x27')]){delete _0x5a81[_0x16da('0x27')];}_0x5c27c2[_0x16da('0x18')](_0x4a5a6c)['send'](_0x5a81);};}exports[_0x16da('0x28')]=function(_0x540194,_0x5da6bc){var _0x896e3e={},_0x22f1d8={},_0x565774={'count':0x0,'rows':[]};var _0x1a33d5=_['map'](db['MailServerOut']['rawAttributes'],function(_0x45c6c3){return{'name':_0x45c6c3[_0x16da('0x29')],'type':_0x45c6c3[_0x16da('0x2a')]['key']};});_0x22f1d8[_0x16da('0x2b')]=_['map'](_0x1a33d5,_0x16da('0x27'));_0x22f1d8['query']=_[_0x16da('0x2c')](_0x540194['query']);_0x22f1d8['filters']=_['intersection'](_0x22f1d8[_0x16da('0x2b')],_0x22f1d8[_0x16da('0x2d')]);_0x896e3e[_0x16da('0x2e')]=_['intersection'](_0x22f1d8[_0x16da('0x2b')],qs[_0x16da('0x2f')](_0x540194[_0x16da('0x2d')][_0x16da('0x2f')]));_0x896e3e[_0x16da('0x2e')]=_0x896e3e[_0x16da('0x2e')][_0x16da('0x30')]?_0x896e3e['attributes']:_0x22f1d8[_0x16da('0x2b')];if(!_0x540194[_0x16da('0x2d')][_0x16da('0x31')](_0x16da('0x32'))){_0x896e3e[_0x16da('0x1d')]=qs[_0x16da('0x1d')](_0x540194[_0x16da('0x2d')][_0x16da('0x1d')]);_0x896e3e['offset']=qs[_0x16da('0x1c')](_0x540194['query'][_0x16da('0x1c')]);}_0x896e3e['order']=qs['sort'](_0x540194[_0x16da('0x2d')][_0x16da('0x33')]);_0x896e3e[_0x16da('0x34')]=qs[_0x16da('0x35')](_[_0x16da('0x36')](_0x540194[_0x16da('0x2d')],_0x22f1d8[_0x16da('0x35')]),_0x1a33d5);if(_0x540194[_0x16da('0x2d')][_0x16da('0x37')]){_0x896e3e['where']=_[_0x16da('0x38')](_0x896e3e[_0x16da('0x34')],{'$or':_[_0x16da('0x39')](_0x1a33d5,function(_0x297cd0){if(_0x297cd0['type']!==_0x16da('0x3a')){var _0x47251a={};_0x47251a[_0x297cd0[_0x16da('0x27')]]={'$like':'%'+_0x540194[_0x16da('0x2d')][_0x16da('0x37')]+'%'};return _0x47251a;}})});}_0x896e3e=_['merge']({},_0x896e3e,_0x540194[_0x16da('0x3b')]);var _0x462b43={'where':_0x896e3e[_0x16da('0x34')]};return db[_0x16da('0x3c')][_0x16da('0x1b')](_0x462b43)[_0x16da('0x24')](function(_0x26a5f4){_0x565774[_0x16da('0x1b')]=_0x26a5f4;if(_0x540194[_0x16da('0x2d')][_0x16da('0x3d')]){_0x896e3e['include']=[{'all':!![]}];}return db[_0x16da('0x3c')]['findAll'](_0x896e3e);})[_0x16da('0x24')](function(_0x5c4d2d){_0x565774[_0x16da('0x3e')]=_0x5c4d2d;return _0x565774;})['then'](respondWithFilteredResult(_0x5da6bc,_0x896e3e))[_0x16da('0x3f')](handleError(_0x5da6bc,null));};exports[_0x16da('0x40')]=function(_0x54fe14,_0x4b5858){var _0x1e6467={'raw':!![],'where':{'id':_0x54fe14[_0x16da('0x41')]['id']}},_0x57487c={};_0x57487c[_0x16da('0x2b')]=_['keys'](db[_0x16da('0x3c')][_0x16da('0x42')]);_0x57487c[_0x16da('0x2d')]=_[_0x16da('0x2c')](_0x54fe14[_0x16da('0x2d')]);_0x57487c[_0x16da('0x35')]=_[_0x16da('0x43')](_0x57487c[_0x16da('0x2b')],_0x57487c[_0x16da('0x2d')]);_0x1e6467[_0x16da('0x2e')]=_[_0x16da('0x43')](_0x57487c['model'],qs[_0x16da('0x2f')](_0x54fe14[_0x16da('0x2d')]['fields']));_0x1e6467['attributes']=_0x1e6467[_0x16da('0x2e')][_0x16da('0x30')]?_0x1e6467[_0x16da('0x2e')]:_0x57487c[_0x16da('0x2b')];if(_0x54fe14[_0x16da('0x2d')]['includeAll']){_0x1e6467['include']=[{'all':!![]}];}_0x1e6467=_[_0x16da('0x38')]({},_0x1e6467,_0x54fe14['options']);return db[_0x16da('0x3c')][_0x16da('0x44')](_0x1e6467)[_0x16da('0x24')](handleEntityNotFound(_0x4b5858,null))[_0x16da('0x24')](respondWithResult(_0x4b5858,null))['catch'](handleError(_0x4b5858,null));};exports[_0x16da('0x45')]=function(_0x1ec1ae,_0x5cfd27){return db['MailServerOut'][_0x16da('0x45')](_0x1ec1ae[_0x16da('0x46')],{})[_0x16da('0x24')](respondWithResult(_0x5cfd27,0xc9))[_0x16da('0x3f')](handleError(_0x5cfd27,null));};exports[_0x16da('0x23')]=function(_0xdfcad7,_0x381827){if(_0xdfcad7[_0x16da('0x46')]['id']){delete _0xdfcad7[_0x16da('0x46')]['id'];}return db[_0x16da('0x3c')]['find']({'where':{'id':_0xdfcad7[_0x16da('0x41')]['id']}})[_0x16da('0x24')](handleEntityNotFound(_0x381827,null))[_0x16da('0x24')](saveUpdates(_0xdfcad7[_0x16da('0x46')],null))[_0x16da('0x24')](respondWithResult(_0x381827,null))[_0x16da('0x3f')](handleError(_0x381827,null));};exports['destroy']=function(_0x57744f,_0x712f39){return db[_0x16da('0x3c')][_0x16da('0x44')]({'where':{'id':_0x57744f[_0x16da('0x41')]['id']}})[_0x16da('0x24')](handleEntityNotFound(_0x712f39,null))[_0x16da('0x24')](removeEntity(_0x712f39,null))[_0x16da('0x3f')](handleError(_0x712f39,null));}; \ No newline at end of file +var _0xf263=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','Content-Range','json','apply','update','then','destroy','end','error','name','map','MailServerOut','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xf263,0x149));var _0x3f26=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf263[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x3f26('0x0'));var emlformat=require(_0x3f26('0x1'));var rimraf=require(_0x3f26('0x2'));var zipdir=require(_0x3f26('0x3'));var jsonpatch=require(_0x3f26('0x4'));var rp=require('request-promise');var moment=require(_0x3f26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f26('0x6'));var util=require(_0x3f26('0x7'));var path=require(_0x3f26('0x8'));var sox=require(_0x3f26('0x9'));var csv=require('to-csv');var ejs=require(_0x3f26('0xa'));var fs=require('fs');var _=require(_0x3f26('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f26('0xc'));var deskjs=require(_0x3f26('0xd'));var toCsv=require(_0x3f26('0xe'));var querystring=require('querystring');var Papa=require(_0x3f26('0xf'));var Redis=require(_0x3f26('0x10'));var authService=require(_0x3f26('0x11'));var qs=require(_0x3f26('0x12'));var as=require(_0x3f26('0x13'));var hardwareService=require(_0x3f26('0x14'));var logger=require(_0x3f26('0x15'))(_0x3f26('0x16'));var utils=require(_0x3f26('0x17'));var config=require(_0x3f26('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab0ef,_0x258b7f){_0x258b7f=_0x258b7f||0xcc;return function(_0x1ad495){if(_0x1ad495){return _0x5ab0ef[_0x3f26('0x19')](_0x258b7f);}return _0x5ab0ef[_0x3f26('0x1a')](_0x258b7f)['end']();};}function respondWithResult(_0x1802e4,_0x227655){_0x227655=_0x227655||0xc8;return function(_0x3f69c0){if(_0x3f69c0){return _0x1802e4[_0x3f26('0x1a')](_0x227655)['json'](_0x3f69c0);}};}function respondWithFilteredResult(_0x3d18ae,_0x1ce98c){return function(_0x37ee5c){if(_0x37ee5c){var _0x414672=_0x37ee5c[_0x3f26('0x1b')],_0x577ca3=_0x1ce98c[_0x3f26('0x1c')],_0x96bd2d=_0x1ce98c[_0x3f26('0x1c')]+_0x1ce98c['limit'],_0x2b9cd9;if(_0x96bd2d>=_0x414672){_0x96bd2d=_0x414672;_0x2b9cd9=0xc8;}else{_0x2b9cd9=0xce;}_0x3d18ae['status'](_0x2b9cd9);return _0x3d18ae['set'](_0x3f26('0x1d'),_0x577ca3+'-'+_0x96bd2d+'/'+_0x414672)[_0x3f26('0x1e')](_0x37ee5c);}return null;};}function patchUpdates(_0x54e79b){return function(_0x346461){try{jsonpatch[_0x3f26('0x1f')](_0x346461,_0x54e79b,!![]);}catch(_0x53b245){return BPromise['reject'](_0x53b245);}return _0x346461['save']();};}function saveUpdates(_0x3080f2,_0x20fe9c){return function(_0x4a8fcf){if(_0x4a8fcf){return _0x4a8fcf[_0x3f26('0x20')](_0x3080f2)[_0x3f26('0x21')](function(_0x172a07){return _0x172a07;});}return null;};}function removeEntity(_0x191a22,_0x254638){return function(_0x5a228f){if(_0x5a228f){return _0x5a228f[_0x3f26('0x22')]()[_0x3f26('0x21')](function(){_0x191a22[_0x3f26('0x1a')](0xcc)[_0x3f26('0x23')]();});}};}function handleEntityNotFound(_0x230400,_0x8d9aa1){return function(_0x272d05){if(!_0x272d05){_0x230400[_0x3f26('0x19')](0x194);}return _0x272d05;};}function handleError(_0x335584,_0xd5d467){_0xd5d467=_0xd5d467||0x1f4;return function(_0x12a0df){logger[_0x3f26('0x24')](_0x12a0df['stack']);if(_0x12a0df[_0x3f26('0x25')]){delete _0x12a0df[_0x3f26('0x25')];}_0x335584[_0x3f26('0x1a')](_0xd5d467)['send'](_0x12a0df);};}exports['index']=function(_0x16effb,_0x1eab9c){var _0x279057={},_0x2e48b2={},_0x1880d8={'count':0x0,'rows':[]};var _0x379001=_[_0x3f26('0x26')](db[_0x3f26('0x27')][_0x3f26('0x28')],function(_0x2bbf11){return{'name':_0x2bbf11['fieldName'],'type':_0x2bbf11[_0x3f26('0x29')][_0x3f26('0x2a')]};});_0x2e48b2[_0x3f26('0x2b')]=_['map'](_0x379001,'name');_0x2e48b2['query']=_[_0x3f26('0x2c')](_0x16effb[_0x3f26('0x2d')]);_0x2e48b2[_0x3f26('0x2e')]=_['intersection'](_0x2e48b2[_0x3f26('0x2b')],_0x2e48b2['query']);_0x279057[_0x3f26('0x2f')]=_[_0x3f26('0x30')](_0x2e48b2[_0x3f26('0x2b')],qs['fields'](_0x16effb[_0x3f26('0x2d')]['fields']));_0x279057[_0x3f26('0x2f')]=_0x279057[_0x3f26('0x2f')]['length']?_0x279057[_0x3f26('0x2f')]:_0x2e48b2[_0x3f26('0x2b')];if(!_0x16effb[_0x3f26('0x2d')][_0x3f26('0x31')]('nolimit')){_0x279057[_0x3f26('0x32')]=qs[_0x3f26('0x32')](_0x16effb[_0x3f26('0x2d')][_0x3f26('0x32')]);_0x279057[_0x3f26('0x1c')]=qs[_0x3f26('0x1c')](_0x16effb[_0x3f26('0x2d')]['offset']);}_0x279057[_0x3f26('0x33')]=qs[_0x3f26('0x34')](_0x16effb['query']['sort']);_0x279057[_0x3f26('0x35')]=qs['filters'](_[_0x3f26('0x36')](_0x16effb[_0x3f26('0x2d')],_0x2e48b2[_0x3f26('0x2e')]),_0x379001);if(_0x16effb['query'][_0x3f26('0x37')]){_0x279057[_0x3f26('0x35')]=_['merge'](_0x279057[_0x3f26('0x35')],{'$or':_[_0x3f26('0x26')](_0x379001,function(_0x3da11f){if(_0x3da11f[_0x3f26('0x29')]!==_0x3f26('0x38')){var _0x15106d={};_0x15106d[_0x3da11f[_0x3f26('0x25')]]={'$like':'%'+_0x16effb[_0x3f26('0x2d')][_0x3f26('0x37')]+'%'};return _0x15106d;}})});}_0x279057=_[_0x3f26('0x39')]({},_0x279057,_0x16effb[_0x3f26('0x3a')]);var _0x29212b={'where':_0x279057[_0x3f26('0x35')]};return db[_0x3f26('0x27')][_0x3f26('0x1b')](_0x29212b)['then'](function(_0x5edd7b){_0x1880d8[_0x3f26('0x1b')]=_0x5edd7b;if(_0x16effb[_0x3f26('0x2d')][_0x3f26('0x3b')]){_0x279057[_0x3f26('0x3c')]=[{'all':!![]}];}return db[_0x3f26('0x27')][_0x3f26('0x3d')](_0x279057);})[_0x3f26('0x21')](function(_0x3d1050){_0x1880d8[_0x3f26('0x3e')]=_0x3d1050;return _0x1880d8;})[_0x3f26('0x21')](respondWithFilteredResult(_0x1eab9c,_0x279057))[_0x3f26('0x3f')](handleError(_0x1eab9c,null));};exports[_0x3f26('0x40')]=function(_0x3b33a3,_0x38c07e){var _0x5161dc={'raw':!![],'where':{'id':_0x3b33a3[_0x3f26('0x41')]['id']}},_0x3bb322={};_0x3bb322[_0x3f26('0x2b')]=_[_0x3f26('0x2c')](db[_0x3f26('0x27')][_0x3f26('0x28')]);_0x3bb322[_0x3f26('0x2d')]=_['keys'](_0x3b33a3['query']);_0x3bb322['filters']=_['intersection'](_0x3bb322[_0x3f26('0x2b')],_0x3bb322['query']);_0x5161dc[_0x3f26('0x2f')]=_[_0x3f26('0x30')](_0x3bb322['model'],qs['fields'](_0x3b33a3[_0x3f26('0x2d')]['fields']));_0x5161dc[_0x3f26('0x2f')]=_0x5161dc[_0x3f26('0x2f')]['length']?_0x5161dc[_0x3f26('0x2f')]:_0x3bb322['model'];if(_0x3b33a3[_0x3f26('0x2d')][_0x3f26('0x3b')]){_0x5161dc['include']=[{'all':!![]}];}_0x5161dc=_[_0x3f26('0x39')]({},_0x5161dc,_0x3b33a3[_0x3f26('0x3a')]);return db[_0x3f26('0x27')]['find'](_0x5161dc)[_0x3f26('0x21')](handleEntityNotFound(_0x38c07e,null))[_0x3f26('0x21')](respondWithResult(_0x38c07e,null))[_0x3f26('0x3f')](handleError(_0x38c07e,null));};exports[_0x3f26('0x42')]=function(_0x129d4a,_0x7ead3){return db[_0x3f26('0x27')]['create'](_0x129d4a[_0x3f26('0x43')],{})[_0x3f26('0x21')](respondWithResult(_0x7ead3,0xc9))['catch'](handleError(_0x7ead3,null));};exports[_0x3f26('0x20')]=function(_0x3131d4,_0x39701c){if(_0x3131d4['body']['id']){delete _0x3131d4[_0x3f26('0x43')]['id'];}return db[_0x3f26('0x27')][_0x3f26('0x44')]({'where':{'id':_0x3131d4[_0x3f26('0x41')]['id']}})[_0x3f26('0x21')](handleEntityNotFound(_0x39701c,null))['then'](saveUpdates(_0x3131d4[_0x3f26('0x43')],null))[_0x3f26('0x21')](respondWithResult(_0x39701c,null))[_0x3f26('0x3f')](handleError(_0x39701c,null));};exports[_0x3f26('0x22')]=function(_0x493769,_0x2feabf){return db[_0x3f26('0x27')][_0x3f26('0x44')]({'where':{'id':_0x493769[_0x3f26('0x41')]['id']}})[_0x3f26('0x21')](handleEntityNotFound(_0x2feabf,null))[_0x3f26('0x21')](removeEntity(_0x2feabf,null))[_0x3f26('0x3f')](handleError(_0x2feabf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 61fd50b..bc535cf 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 _0x7d97=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','api','moment','bluebird'];(function(_0x477a6d,_0x11a908){var _0x41361e=function(_0x53f79b){while(--_0x53f79b){_0x477a6d['push'](_0x477a6d['shift']());}};_0x41361e(++_0x11a908);}(_0x7d97,0x1a2));var _0x77d9=function(_0x2e3e06,_0x57c7d2){_0x2e3e06=_0x2e3e06-0x0;var _0x22fbd6=_0x7d97[_0x2e3e06];return _0x22fbd6;};'use strict';var _=require(_0x77d9('0x0'));var util=require(_0x77d9('0x1'));var logger=require('../../config/logger')(_0x77d9('0x2'));var moment=require(_0x77d9('0x3'));var BPromise=require(_0x77d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77d9('0x5'));module[_0x77d9('0x6')]=function(_0x5e6745,_0x507004){return _0x5e6745[_0x77d9('0x7')](_0x77d9('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bfc=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','MailServerOut','mail_servers_out'];(function(_0x1b3b2e,_0x1c5916){var _0x2fb4b2=function(_0x2fc114){while(--_0x2fc114){_0x1b3b2e['push'](_0x1b3b2e['shift']());}};_0x2fb4b2(++_0x1c5916);}(_0x0bfc,0x84));var _0xc0bf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0bfc[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xc0bf('0x0'));var logger=require(_0xc0bf('0x1'))(_0xc0bf('0x2'));var moment=require(_0xc0bf('0x3'));var BPromise=require(_0xc0bf('0x4'));var rp=require(_0xc0bf('0x5'));var fs=require('fs');var path=require(_0xc0bf('0x6'));var rimraf=require('rimraf');var config=require(_0xc0bf('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xc0bf('0x8')]=function(_0x26c235,_0x315bec){return _0x26c235['define'](_0xc0bf('0x9'),attributes,{'tableName':_0xc0bf('0xa'),'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 db3ecbe..fba7c2a 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 _0x7ee7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x185774,_0x58faf4){var _0x5cc850=function(_0x58438d){while(--_0x58438d){_0x185774['push'](_0x185774['shift']());}};_0x5cc850(++_0x58faf4);}(_0x7ee7,0xd2));var _0x77ee=function(_0x5cc450,_0xbc6fa8){_0x5cc450=_0x5cc450-0x0;var _0x781ec6=_0x7ee7[_0x5cc450];return _0x781ec6;};'use strict';var _=require(_0x77ee('0x0'));var util=require(_0x77ee('0x1'));var moment=require(_0x77ee('0x2'));var BPromise=require(_0x77ee('0x3'));var rs=require(_0x77ee('0x4'));var fs=require('fs');var Redis=require(_0x77ee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x77ee('0x6'));var logger=require('../../config/logger')(_0x77ee('0x7'));var config=require(_0x77ee('0x8'));var jayson=require(_0x77ee('0x9'));var client=jayson[_0x77ee('0xa')][_0x77ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274a65,_0x2dbf33,_0x483193){return new BPromise(function(_0x2a26cc,_0x39a8da){return client['request'](_0x274a65,_0x483193)[_0x77ee('0xc')](function(_0x441fd5){logger[_0x77ee('0xd')](_0x77ee('0xe'),_0x2dbf33,_0x77ee('0xf'));logger['debug'](_0x77ee('0x10'),_0x2dbf33,'request\x20sent',JSON[_0x77ee('0x11')](_0x441fd5));if(_0x441fd5[_0x77ee('0x12')]){if(_0x441fd5[_0x77ee('0x12')][_0x77ee('0x13')]===0x1f4){logger['error'](_0x77ee('0xe'),_0x2dbf33,_0x441fd5[_0x77ee('0x12')][_0x77ee('0x14')]);return _0x39a8da(_0x441fd5[_0x77ee('0x12')]['message']);}logger[_0x77ee('0x12')](_0x77ee('0xe'),_0x2dbf33,_0x441fd5[_0x77ee('0x12')]['message']);return _0x2a26cc(_0x441fd5[_0x77ee('0x12')]['message']);}else{logger[_0x77ee('0xd')]('MailServerOut,\x20%s,\x20%s',_0x2dbf33,_0x77ee('0xf'));_0x2a26cc(_0x441fd5[_0x77ee('0x15')][_0x77ee('0x14')]);}})[_0x77ee('0x16')](function(_0x3792e2){logger[_0x77ee('0x12')](_0x77ee('0xe'),_0x2dbf33,_0x3792e2);_0x39a8da(_0x3792e2);});});} \ No newline at end of file +var _0x9ccb=['request\x20sent','stringify','error','code','message','MailServerOut,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','debug'];(function(_0x340a46,_0x19d230){var _0x585e67=function(_0x230bd0){while(--_0x230bd0){_0x340a46['push'](_0x340a46['shift']());}};_0x585e67(++_0x19d230);}(_0x9ccb,0x105));var _0xb9cc=function(_0x2cdfa7,_0x34eeb6){_0x2cdfa7=_0x2cdfa7-0x0;var _0x23a81a=_0x9ccb[_0x2cdfa7];return _0x23a81a;};'use strict';var _=require(_0xb9cc('0x0'));var util=require('util');var moment=require(_0xb9cc('0x1'));var BPromise=require(_0xb9cc('0x2'));var rs=require(_0xb9cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb9cc('0x4'));var logger=require(_0xb9cc('0x5'))(_0xb9cc('0x6'));var config=require(_0xb9cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9cc('0x8')][_0xb9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe99bc6,_0x7f5c98,_0x9d3184){return new BPromise(function(_0x5db7e7,_0x2c0c61){return client[_0xb9cc('0xa')](_0xe99bc6,_0x9d3184)['then'](function(_0x2da3ea){logger['info']('MailServerOut,\x20%s,\x20%s',_0x7f5c98,'request\x20sent');logger[_0xb9cc('0xb')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x7f5c98,_0xb9cc('0xc'),JSON[_0xb9cc('0xd')](_0x2da3ea));if(_0x2da3ea[_0xb9cc('0xe')]){if(_0x2da3ea[_0xb9cc('0xe')][_0xb9cc('0xf')]===0x1f4){logger[_0xb9cc('0xe')]('MailServerOut,\x20%s,\x20%s',_0x7f5c98,_0x2da3ea[_0xb9cc('0xe')][_0xb9cc('0x10')]);return _0x2c0c61(_0x2da3ea[_0xb9cc('0xe')][_0xb9cc('0x10')]);}logger[_0xb9cc('0xe')](_0xb9cc('0x11'),_0x7f5c98,_0x2da3ea[_0xb9cc('0xe')]['message']);return _0x5db7e7(_0x2da3ea[_0xb9cc('0xe')]['message']);}else{logger[_0xb9cc('0x12')](_0xb9cc('0x11'),_0x7f5c98,_0xb9cc('0xc'));_0x5db7e7(_0x2da3ea[_0xb9cc('0x13')]['message']);}})[_0xb9cc('0x14')](function(_0x5028d0){logger[_0xb9cc('0xe')]('MailServerOut,\x20%s,\x20%s',_0x7f5c98,_0x5028d0);_0x2c0c61(_0x5028d0);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e977775..d3ac841 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 _0xb3db=['create','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5224cf,_0x1ff5dc){var _0x1e2286=function(_0x20b0cd){while(--_0x20b0cd){_0x5224cf['push'](_0x5224cf['shift']());}};_0x1e2286(++_0x1ff5dc);}(_0xb3db,0x159));var _0xbb3d=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0xb3db[_0x4f1da5];return _0xe972a8;};'use strict';var multer=require('multer');var util=require(_0xbb3d('0x0'));var path=require(_0xbb3d('0x1'));var timeout=require(_0xbb3d('0x2'));var express=require(_0xbb3d('0x3'));var router=express[_0xbb3d('0x4')]();var auth=require(_0xbb3d('0x5'));var interaction=require(_0xbb3d('0x6'));var config=require('../../config/environment');var controller=require(_0xbb3d('0x7'));router[_0xbb3d('0x8')]('/',auth[_0xbb3d('0x9')](),controller[_0xbb3d('0xa')]);router[_0xbb3d('0x8')](_0xbb3d('0xb'),auth[_0xbb3d('0x9')](),controller[_0xbb3d('0xc')]);router[_0xbb3d('0x8')](_0xbb3d('0xd'),auth[_0xbb3d('0x9')](),controller[_0xbb3d('0xe')]);router['post']('/',auth[_0xbb3d('0x9')](),controller[_0xbb3d('0xf')]);router['put']('/:id',auth[_0xbb3d('0x9')](),controller['update']);router[_0xbb3d('0x10')](_0xbb3d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xbb3d('0x11')]=router; \ No newline at end of file +var _0x529a=['../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x44f7ec,_0x441e0d){var _0x3898fa=function(_0x1ae46a){while(--_0x1ae46a){_0x44f7ec['push'](_0x44f7ec['shift']());}};_0x3898fa(++_0x441e0d);}(_0x529a,0x164));var _0xa529=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x529a[_0x179e11];return _0x549f04;};'use strict';var multer=require(_0xa529('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa529('0x1'));var express=require(_0xa529('0x2'));var router=express[_0xa529('0x3')]();var auth=require(_0xa529('0x4'));var interaction=require(_0xa529('0x5'));var config=require('../../config/environment');var controller=require(_0xa529('0x6'));router[_0xa529('0x7')]('/',auth[_0xa529('0x8')](),controller['index']);router[_0xa529('0x7')]('/describe',auth[_0xa529('0x8')](),controller[_0xa529('0x9')]);router[_0xa529('0x7')](_0xa529('0xa'),auth['isAuthenticated'](),controller[_0xa529('0xb')]);router[_0xa529('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa529('0xd')](_0xa529('0xa'),auth[_0xa529('0x8')](),controller[_0xa529('0xe')]);router[_0xa529('0xf')](_0xa529('0xa'),auth[_0xa529('0x8')](),controller[_0xa529('0x10')]);module[_0xa529('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b66b3a5..f6c0605 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 _0x3af5=['exports','name','STRING','sequelize'];(function(_0x29488a,_0x4c1b16){var _0x3947b4=function(_0x10f1c9){while(--_0x10f1c9){_0x29488a['push'](_0x29488a['shift']());}};_0x3947b4(++_0x4c1b16);}(_0x3af5,0x1d3));var _0x53af=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x3af5[_0x3de873];return _0x380b8c;};'use strict';var Sequelize=require(_0x53af('0x0'));module[_0x53af('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x53af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x53af('0x3')]}}; \ No newline at end of file +var _0xbc7a=['exports','STRING','sequelize'];(function(_0xa6da12,_0x328742){var _0x1e0fba=function(_0xf20778){while(--_0xf20778){_0xa6da12['push'](_0xa6da12['shift']());}};_0x1e0fba(++_0x328742);}(_0xbc7a,0xa4));var _0xabc7=function(_0x5cee98,_0x281ed9){_0x5cee98=_0x5cee98-0x0;var _0x44420b=_0xbc7a[_0x5cee98];return _0x44420b;};'use strict';var Sequelize=require(_0xabc7('0x0'));module[_0xabc7('0x1')]={'name':{'type':Sequelize[_0xabc7('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabc7('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 28baa69..40398cc 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 _0xbd7e=['limit','status','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset'];(function(_0x4ad7fd,_0x2db6d8){var _0xcc5b0a=function(_0x4fa041){while(--_0x4fa041){_0x4ad7fd['push'](_0x4ad7fd['shift']());}};_0xcc5b0a(++_0x2db6d8);}(_0xbd7e,0x1b5));var _0xebd7=function(_0x35f5a5,_0x3f8a65){_0x35f5a5=_0x35f5a5-0x0;var _0x143dce=_0xbd7e[_0x35f5a5];return _0x143dce;};'use strict';var pdf=require(_0xebd7('0x0'));var emlformat=require(_0xebd7('0x1'));var rimraf=require(_0xebd7('0x2'));var zipdir=require(_0xebd7('0x3'));var jsonpatch=require(_0xebd7('0x4'));var rp=require(_0xebd7('0x5'));var moment=require(_0xebd7('0x6'));var BPromise=require(_0xebd7('0x7'));var Mustache=require(_0xebd7('0x8'));var util=require(_0xebd7('0x9'));var path=require(_0xebd7('0xa'));var sox=require(_0xebd7('0xb'));var csv=require(_0xebd7('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebd7('0xd'));var squel=require(_0xebd7('0xe'));var crypto=require(_0xebd7('0xf'));var jsforce=require(_0xebd7('0x10'));var deskjs=require(_0xebd7('0x11'));var toCsv=require(_0xebd7('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xebd7('0x12'));var qs=require(_0xebd7('0x13'));var as=require(_0xebd7('0x14'));var hardwareService=require(_0xebd7('0x15'));var logger=require(_0xebd7('0x16'))(_0xebd7('0x17'));var utils=require(_0xebd7('0x18'));var config=require(_0xebd7('0x19'));var db=require(_0xebd7('0x1a'))['db'];function respondWithStatusCode(_0x170758,_0xa6b351){_0xa6b351=_0xa6b351||0xcc;return function(_0x34b7ea){if(_0x34b7ea){return _0x170758[_0xebd7('0x1b')](_0xa6b351);}return _0x170758['status'](_0xa6b351)[_0xebd7('0x1c')]();};}function respondWithResult(_0x1db9dc,_0x1931ff){_0x1931ff=_0x1931ff||0xc8;return function(_0xec977){if(_0xec977){return _0x1db9dc['status'](_0x1931ff)['json'](_0xec977);}};}function respondWithFilteredResult(_0x313aff,_0x45de3e){return function(_0x8571b6){if(_0x8571b6){var _0x577ec8=_0x8571b6[_0xebd7('0x1d')],_0x8dfb70=_0x45de3e[_0xebd7('0x1e')],_0x572d8f=_0x45de3e[_0xebd7('0x1e')]+_0x45de3e[_0xebd7('0x1f')],_0xf5cd86;if(_0x572d8f>=_0x577ec8){_0x572d8f=_0x577ec8;_0xf5cd86=0xc8;}else{_0xf5cd86=0xce;}_0x313aff[_0xebd7('0x20')](_0xf5cd86);return _0x313aff['set'](_0xebd7('0x21'),_0x8dfb70+'-'+_0x572d8f+'/'+_0x577ec8)[_0xebd7('0x22')](_0x8571b6);}return null;};}function patchUpdates(_0x4b698f){return function(_0x573ab4){try{jsonpatch[_0xebd7('0x23')](_0x573ab4,_0x4b698f,!![]);}catch(_0xdae23f){return BPromise[_0xebd7('0x24')](_0xdae23f);}return _0x573ab4[_0xebd7('0x25')]();};}function saveUpdates(_0x3ea7ef,_0x4cb959){return function(_0xbdd68){if(_0xbdd68){return _0xbdd68[_0xebd7('0x26')](_0x3ea7ef)[_0xebd7('0x27')](function(_0xc1e9f5){return _0xc1e9f5;});}return null;};}function removeEntity(_0x3c82a3,_0x20309a){return function(_0x170628){if(_0x170628){return _0x170628[_0xebd7('0x28')]()['then'](function(){_0x3c82a3['status'](0xcc)[_0xebd7('0x1c')]();});}};}function handleEntityNotFound(_0x145b29,_0x3e131e){return function(_0x361bf4){if(!_0x361bf4){_0x145b29['sendStatus'](0x194);}return _0x361bf4;};}function handleError(_0x59adfb,_0x471bf3){_0x471bf3=_0x471bf3||0x1f4;return function(_0x1c92db){logger[_0xebd7('0x29')](_0x1c92db[_0xebd7('0x2a')]);if(_0x1c92db[_0xebd7('0x2b')]){delete _0x1c92db[_0xebd7('0x2b')];}_0x59adfb[_0xebd7('0x20')](_0x471bf3)[_0xebd7('0x2c')](_0x1c92db);};}exports[_0xebd7('0x2d')]=function(_0x48f244,_0x534987){var _0x2a4d94={},_0x52f124={},_0x4e68d8={'count':0x0,'rows':[]};var _0x4361d0=_[_0xebd7('0x2e')](db[_0xebd7('0x2f')][_0xebd7('0x30')],function(_0x31bbdc){return{'name':_0x31bbdc[_0xebd7('0x31')],'type':_0x31bbdc[_0xebd7('0x32')]['key']};});_0x52f124[_0xebd7('0x33')]=_[_0xebd7('0x2e')](_0x4361d0,_0xebd7('0x2b'));_0x52f124[_0xebd7('0x34')]=_[_0xebd7('0x35')](_0x48f244[_0xebd7('0x34')]);_0x52f124[_0xebd7('0x36')]=_[_0xebd7('0x37')](_0x52f124['model'],_0x52f124[_0xebd7('0x34')]);_0x2a4d94['attributes']=_['intersection'](_0x52f124[_0xebd7('0x33')],qs[_0xebd7('0x38')](_0x48f244[_0xebd7('0x34')]['fields']));_0x2a4d94[_0xebd7('0x39')]=_0x2a4d94[_0xebd7('0x39')]['length']?_0x2a4d94[_0xebd7('0x39')]:_0x52f124[_0xebd7('0x33')];if(!_0x48f244['query'][_0xebd7('0x3a')](_0xebd7('0x3b'))){_0x2a4d94['limit']=qs['limit'](_0x48f244[_0xebd7('0x34')]['limit']);_0x2a4d94[_0xebd7('0x1e')]=qs[_0xebd7('0x1e')](_0x48f244[_0xebd7('0x34')][_0xebd7('0x1e')]);}_0x2a4d94[_0xebd7('0x3c')]=qs[_0xebd7('0x3d')](_0x48f244[_0xebd7('0x34')]['sort']);_0x2a4d94[_0xebd7('0x3e')]=qs[_0xebd7('0x36')](_[_0xebd7('0x3f')](_0x48f244[_0xebd7('0x34')],_0x52f124[_0xebd7('0x36')]),_0x4361d0);if(_0x48f244['query'][_0xebd7('0x40')]){_0x2a4d94[_0xebd7('0x3e')]=_['merge'](_0x2a4d94[_0xebd7('0x3e')],{'$or':_[_0xebd7('0x2e')](_0x4361d0,function(_0x2935de){if(_0x2935de[_0xebd7('0x32')]!==_0xebd7('0x41')){var _0x4c4d13={};_0x4c4d13[_0x2935de['name']]={'$like':'%'+_0x48f244['query'][_0xebd7('0x40')]+'%'};return _0x4c4d13;}})});}_0x2a4d94=_[_0xebd7('0x42')]({},_0x2a4d94,_0x48f244[_0xebd7('0x43')]);var _0x148ccc={'where':_0x2a4d94['where']};return db[_0xebd7('0x2f')]['count'](_0x148ccc)['then'](function(_0x34d7b0){_0x4e68d8[_0xebd7('0x1d')]=_0x34d7b0;if(_0x48f244[_0xebd7('0x34')][_0xebd7('0x44')]){_0x2a4d94['include']=[{'all':!![]}];}return db[_0xebd7('0x2f')]['findAll'](_0x2a4d94);})[_0xebd7('0x27')](function(_0x4786ae){_0x4e68d8['rows']=_0x4786ae;return _0x4e68d8;})[_0xebd7('0x27')](respondWithFilteredResult(_0x534987,_0x2a4d94))[_0xebd7('0x45')](handleError(_0x534987,null));};exports[_0xebd7('0x46')]=function(_0x45671f,_0x296432){var _0x5800df={'raw':!![],'where':{'id':_0x45671f[_0xebd7('0x47')]['id']}},_0x5dae03={};_0x5dae03['model']=_[_0xebd7('0x35')](db[_0xebd7('0x2f')][_0xebd7('0x30')]);_0x5dae03['query']=_[_0xebd7('0x35')](_0x45671f['query']);_0x5dae03[_0xebd7('0x36')]=_['intersection'](_0x5dae03[_0xebd7('0x33')],_0x5dae03[_0xebd7('0x34')]);_0x5800df[_0xebd7('0x39')]=_[_0xebd7('0x37')](_0x5dae03[_0xebd7('0x33')],qs[_0xebd7('0x38')](_0x45671f[_0xebd7('0x34')][_0xebd7('0x38')]));_0x5800df['attributes']=_0x5800df[_0xebd7('0x39')][_0xebd7('0x48')]?_0x5800df[_0xebd7('0x39')]:_0x5dae03[_0xebd7('0x33')];if(_0x45671f[_0xebd7('0x34')]['includeAll']){_0x5800df[_0xebd7('0x49')]=[{'all':!![]}];}_0x5800df=_['merge']({},_0x5800df,_0x45671f[_0xebd7('0x43')]);return db['MailSubstatus'][_0xebd7('0x4a')](_0x5800df)['then'](handleEntityNotFound(_0x296432,null))['then'](respondWithResult(_0x296432,null))[_0xebd7('0x45')](handleError(_0x296432,null));};exports[_0xebd7('0x4b')]=function(_0x1de1bc,_0x488064){return db['MailSubstatus']['create'](_0x1de1bc[_0xebd7('0x4c')],{})[_0xebd7('0x27')](respondWithResult(_0x488064,0xc9))[_0xebd7('0x45')](handleError(_0x488064,null));};exports['update']=function(_0x295150,_0x50eddf){if(_0x295150[_0xebd7('0x4c')]['id']){delete _0x295150[_0xebd7('0x4c')]['id'];}return db[_0xebd7('0x2f')][_0xebd7('0x4a')]({'where':{'id':_0x295150[_0xebd7('0x47')]['id']}})[_0xebd7('0x27')](handleEntityNotFound(_0x50eddf,null))[_0xebd7('0x27')](saveUpdates(_0x295150[_0xebd7('0x4c')],null))[_0xebd7('0x27')](respondWithResult(_0x50eddf,null))[_0xebd7('0x45')](handleError(_0x50eddf,null));};exports[_0xebd7('0x28')]=function(_0x30bd56,_0x1c718e){return db[_0xebd7('0x2f')][_0xebd7('0x4a')]({'where':{'id':_0x30bd56[_0xebd7('0x47')]['id']}})[_0xebd7('0x27')](handleEntityNotFound(_0x1c718e,null))[_0xebd7('0x27')](removeEntity(_0x1c718e,null))[_0xebd7('0x45')](handleError(_0x1c718e,null));};exports[_0xebd7('0x4d')]=function(_0x1ef716,_0x173f92){return db[_0xebd7('0x2f')]['describe']()[_0xebd7('0x27')](respondWithResult(_0x173f92,null))[_0xebd7('0x45')](handleError(_0x173f92,null));}; \ No newline at end of file +var _0xa46c=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','destroy','html-pdf','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','error','name','send','map','MailSubstatus'];(function(_0x82dbbb,_0x109b5f){var _0x1ab3e8=function(_0x10bc4e){while(--_0x10bc4e){_0x82dbbb['push'](_0x82dbbb['shift']());}};_0x1ab3e8(++_0x109b5f);}(_0xa46c,0xb1));var _0xca46=function(_0x551ace,_0x2091b6){_0x551ace=_0x551ace-0x0;var _0x5ec3d9=_0xa46c[_0x551ace];return _0x5ec3d9;};'use strict';var pdf=require(_0xca46('0x0'));var emlformat=require(_0xca46('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xca46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca46('0x3'));var moment=require('moment');var BPromise=require(_0xca46('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xca46('0x5'));var sox=require(_0xca46('0x6'));var csv=require(_0xca46('0x7'));var ejs=require(_0xca46('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca46('0x9'));var crypto=require(_0xca46('0xa'));var jsforce=require(_0xca46('0xb'));var deskjs=require(_0xca46('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca46('0xd'));var Redis=require(_0xca46('0xe'));var authService=require(_0xca46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xca46('0x10'));var hardwareService=require(_0xca46('0x11'));var logger=require(_0xca46('0x12'))(_0xca46('0x13'));var utils=require(_0xca46('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d66f0,_0x2dfe0d){_0x2dfe0d=_0x2dfe0d||0xcc;return function(_0x3f5130){if(_0x3f5130){return _0x1d66f0[_0xca46('0x15')](_0x2dfe0d);}return _0x1d66f0['status'](_0x2dfe0d)[_0xca46('0x16')]();};}function respondWithResult(_0x584fb0,_0x1c9148){_0x1c9148=_0x1c9148||0xc8;return function(_0x3f0cff){if(_0x3f0cff){return _0x584fb0['status'](_0x1c9148)[_0xca46('0x17')](_0x3f0cff);}};}function respondWithFilteredResult(_0x3f8652,_0x134dc3){return function(_0x343f76){if(_0x343f76){var _0x1a9b6f=_0x343f76[_0xca46('0x18')],_0x1c91a2=_0x134dc3['offset'],_0x47433e=_0x134dc3[_0xca46('0x19')]+_0x134dc3[_0xca46('0x1a')],_0x1b26fd;if(_0x47433e>=_0x1a9b6f){_0x47433e=_0x1a9b6f;_0x1b26fd=0xc8;}else{_0x1b26fd=0xce;}_0x3f8652[_0xca46('0x1b')](_0x1b26fd);return _0x3f8652[_0xca46('0x1c')](_0xca46('0x1d'),_0x1c91a2+'-'+_0x47433e+'/'+_0x1a9b6f)[_0xca46('0x17')](_0x343f76);}return null;};}function patchUpdates(_0x416c84){return function(_0x4495e0){try{jsonpatch[_0xca46('0x1e')](_0x4495e0,_0x416c84,!![]);}catch(_0x5cdec8){return BPromise[_0xca46('0x1f')](_0x5cdec8);}return _0x4495e0[_0xca46('0x20')]();};}function saveUpdates(_0x145c57,_0x44e748){return function(_0x3fc74b){if(_0x3fc74b){return _0x3fc74b[_0xca46('0x21')](_0x145c57)['then'](function(_0x2d02f5){return _0x2d02f5;});}return null;};}function removeEntity(_0x2097ce,_0x320a9e){return function(_0x13229e){if(_0x13229e){return _0x13229e['destroy']()['then'](function(){_0x2097ce['status'](0xcc)[_0xca46('0x16')]();});}};}function handleEntityNotFound(_0x315568,_0x60c8dc){return function(_0x5715dc){if(!_0x5715dc){_0x315568[_0xca46('0x15')](0x194);}return _0x5715dc;};}function handleError(_0x2004db,_0x5ebc8e){_0x5ebc8e=_0x5ebc8e||0x1f4;return function(_0xd3d768){logger[_0xca46('0x22')](_0xd3d768['stack']);if(_0xd3d768[_0xca46('0x23')]){delete _0xd3d768[_0xca46('0x23')];}_0x2004db['status'](_0x5ebc8e)[_0xca46('0x24')](_0xd3d768);};}exports['index']=function(_0xbd588b,_0x4d7fe){var _0x7cad2b={},_0x9b13ed={},_0x238201={'count':0x0,'rows':[]};var _0x221998=_[_0xca46('0x25')](db[_0xca46('0x26')][_0xca46('0x27')],function(_0x3b0a4b){return{'name':_0x3b0a4b[_0xca46('0x28')],'type':_0x3b0a4b[_0xca46('0x29')][_0xca46('0x2a')]};});_0x9b13ed[_0xca46('0x2b')]=_[_0xca46('0x25')](_0x221998,_0xca46('0x23'));_0x9b13ed[_0xca46('0x2c')]=_['keys'](_0xbd588b['query']);_0x9b13ed[_0xca46('0x2d')]=_[_0xca46('0x2e')](_0x9b13ed[_0xca46('0x2b')],_0x9b13ed[_0xca46('0x2c')]);_0x7cad2b[_0xca46('0x2f')]=_[_0xca46('0x2e')](_0x9b13ed['model'],qs[_0xca46('0x30')](_0xbd588b['query'][_0xca46('0x30')]));_0x7cad2b['attributes']=_0x7cad2b[_0xca46('0x2f')]['length']?_0x7cad2b[_0xca46('0x2f')]:_0x9b13ed['model'];if(!_0xbd588b[_0xca46('0x2c')]['hasOwnProperty'](_0xca46('0x31'))){_0x7cad2b[_0xca46('0x1a')]=qs[_0xca46('0x1a')](_0xbd588b['query'][_0xca46('0x1a')]);_0x7cad2b[_0xca46('0x19')]=qs[_0xca46('0x19')](_0xbd588b['query'][_0xca46('0x19')]);}_0x7cad2b[_0xca46('0x32')]=qs[_0xca46('0x33')](_0xbd588b[_0xca46('0x2c')][_0xca46('0x33')]);_0x7cad2b[_0xca46('0x34')]=qs[_0xca46('0x2d')](_[_0xca46('0x35')](_0xbd588b[_0xca46('0x2c')],_0x9b13ed[_0xca46('0x2d')]),_0x221998);if(_0xbd588b['query'][_0xca46('0x36')]){_0x7cad2b[_0xca46('0x34')]=_[_0xca46('0x37')](_0x7cad2b[_0xca46('0x34')],{'$or':_[_0xca46('0x25')](_0x221998,function(_0x1eeb7e){if(_0x1eeb7e[_0xca46('0x29')]!==_0xca46('0x38')){var _0x1bfd0d={};_0x1bfd0d[_0x1eeb7e[_0xca46('0x23')]]={'$like':'%'+_0xbd588b['query'][_0xca46('0x36')]+'%'};return _0x1bfd0d;}})});}_0x7cad2b=_[_0xca46('0x37')]({},_0x7cad2b,_0xbd588b['options']);var _0xea61f8={'where':_0x7cad2b[_0xca46('0x34')]};return db[_0xca46('0x26')][_0xca46('0x18')](_0xea61f8)[_0xca46('0x39')](function(_0x2b8c49){_0x238201[_0xca46('0x18')]=_0x2b8c49;if(_0xbd588b[_0xca46('0x2c')][_0xca46('0x3a')]){_0x7cad2b[_0xca46('0x3b')]=[{'all':!![]}];}return db[_0xca46('0x26')][_0xca46('0x3c')](_0x7cad2b);})['then'](function(_0x119744){_0x238201[_0xca46('0x3d')]=_0x119744;return _0x238201;})[_0xca46('0x39')](respondWithFilteredResult(_0x4d7fe,_0x7cad2b))[_0xca46('0x3e')](handleError(_0x4d7fe,null));};exports[_0xca46('0x3f')]=function(_0x39b61f,_0x47302c){var _0x33b1dd={'raw':!![],'where':{'id':_0x39b61f['params']['id']}},_0x4428b8={};_0x4428b8[_0xca46('0x2b')]=_[_0xca46('0x40')](db[_0xca46('0x26')]['rawAttributes']);_0x4428b8[_0xca46('0x2c')]=_[_0xca46('0x40')](_0x39b61f['query']);_0x4428b8[_0xca46('0x2d')]=_[_0xca46('0x2e')](_0x4428b8['model'],_0x4428b8[_0xca46('0x2c')]);_0x33b1dd['attributes']=_['intersection'](_0x4428b8[_0xca46('0x2b')],qs[_0xca46('0x30')](_0x39b61f[_0xca46('0x2c')][_0xca46('0x30')]));_0x33b1dd['attributes']=_0x33b1dd[_0xca46('0x2f')][_0xca46('0x41')]?_0x33b1dd[_0xca46('0x2f')]:_0x4428b8[_0xca46('0x2b')];if(_0x39b61f[_0xca46('0x2c')][_0xca46('0x3a')]){_0x33b1dd['include']=[{'all':!![]}];}_0x33b1dd=_['merge']({},_0x33b1dd,_0x39b61f[_0xca46('0x42')]);return db['MailSubstatus'][_0xca46('0x43')](_0x33b1dd)['then'](handleEntityNotFound(_0x47302c,null))[_0xca46('0x39')](respondWithResult(_0x47302c,null))['catch'](handleError(_0x47302c,null));};exports[_0xca46('0x44')]=function(_0x3b8daf,_0x572c28){return db[_0xca46('0x26')][_0xca46('0x44')](_0x3b8daf[_0xca46('0x45')],{})[_0xca46('0x39')](respondWithResult(_0x572c28,0xc9))['catch'](handleError(_0x572c28,null));};exports[_0xca46('0x21')]=function(_0x24887f,_0x17f4dd){if(_0x24887f[_0xca46('0x45')]['id']){delete _0x24887f[_0xca46('0x45')]['id'];}return db['MailSubstatus'][_0xca46('0x43')]({'where':{'id':_0x24887f[_0xca46('0x46')]['id']}})[_0xca46('0x39')](handleEntityNotFound(_0x17f4dd,null))['then'](saveUpdates(_0x24887f[_0xca46('0x45')],null))[_0xca46('0x39')](respondWithResult(_0x17f4dd,null))[_0xca46('0x3e')](handleError(_0x17f4dd,null));};exports[_0xca46('0x47')]=function(_0x1991f0,_0x5d0512){return db[_0xca46('0x26')]['find']({'where':{'id':_0x1991f0[_0xca46('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d0512,null))[_0xca46('0x39')](removeEntity(_0x5d0512,null))[_0xca46('0x3e')](handleError(_0x5d0512,null));};exports['describe']=function(_0x139f08,_0x5a3307){return db[_0xca46('0x26')]['describe']()['then'](respondWithResult(_0x5a3307,null))['catch'](handleError(_0x5a3307,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 33550e6..6af69c2 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 _0x49aa=['moment','bluebird','request-promise','path','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api'];(function(_0x338c25,_0x3cc179){var _0x563988=function(_0x58b32d){while(--_0x58b32d){_0x338c25['push'](_0x338c25['shift']());}};_0x563988(++_0x3cc179);}(_0x49aa,0x71));var _0xa49a=function(_0x140dec,_0x475631){_0x140dec=_0x140dec-0x0;var _0xe924c5=_0x49aa[_0x140dec];return _0xe924c5;};'use strict';var _=require(_0xa49a('0x0'));var util=require(_0xa49a('0x1'));var logger=require(_0xa49a('0x2'))(_0xa49a('0x3'));var moment=require(_0xa49a('0x4'));var BPromise=require(_0xa49a('0x5'));var rp=require(_0xa49a('0x6'));var fs=require('fs');var path=require(_0xa49a('0x7'));var rimraf=require('rimraf');var config=require(_0xa49a('0x8'));var attributes=require(_0xa49a('0x9'));module['exports']=function(_0x2ad7ad,_0x545dba){return _0x2ad7ad[_0xa49a('0xa')](_0xa49a('0xb'),attributes,{'tableName':_0xa49a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd263=['../../config/environment','exports','define','MailSubstatus','mail_substatuses','api','moment','bluebird','request-promise'];(function(_0x149478,_0x380771){var _0x2bcd4d=function(_0x3fa152){while(--_0x3fa152){_0x149478['push'](_0x149478['shift']());}};_0x2bcd4d(++_0x380771);}(_0xd263,0x83));var _0x3d26=function(_0x1521e0,_0x29fd64){_0x1521e0=_0x1521e0-0x0;var _0x356cdb=_0xd263[_0x1521e0];return _0x356cdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3d26('0x0'));var moment=require(_0x3d26('0x1'));var BPromise=require(_0x3d26('0x2'));var rp=require(_0x3d26('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d26('0x4'));var attributes=require('./mailSubstatus.attributes');module[_0x3d26('0x5')]=function(_0x407589,_0x4b7516){return _0x407589[_0x3d26('0x6')](_0x3d26('0x7'),attributes,{'tableName':_0x3d26('0x8'),'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 c38d392..33a2a7a 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 _0x1339=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x50847d,_0xfb3ea8){var _0x5dcb55=function(_0x2ca4c8){while(--_0x2ca4c8){_0x50847d['push'](_0x50847d['shift']());}};_0x5dcb55(++_0xfb3ea8);}(_0x1339,0x1ed));var _0x9133=function(_0x3cd220,_0x11b35f){_0x3cd220=_0x3cd220-0x0;var _0x561ee6=_0x1339[_0x3cd220];return _0x561ee6;};'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')]('MailSubstatus,\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);});});} \ No newline at end of file +var _0x91a7=['message','MailSubstatus,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x26a2b3,_0x57a5b0){var _0x57a0a4=function(_0x624329){while(--_0x624329){_0x26a2b3['push'](_0x26a2b3['shift']());}};_0x57a0a4(++_0x57a5b0);}(_0x91a7,0xe7));var _0x791a=function(_0x14ac39,_0x46a70f){_0x14ac39=_0x14ac39-0x0;var _0x149e0f=_0x91a7[_0x14ac39];return _0x149e0f;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index eb167ae..7d8dd09 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 _0xbdf7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x59e1d8,_0x1de8ad){var _0x1dc900=function(_0x2d7072){while(--_0x2d7072){_0x59e1d8['push'](_0x59e1d8['shift']());}};_0x1dc900(++_0x1de8ad);}(_0xbdf7,0x18b));var _0x7bdf=function(_0x4fe9eb,_0x522eed){_0x4fe9eb=_0x4fe9eb-0x0;var _0x44e7ac=_0xbdf7[_0x4fe9eb];return _0x44e7ac;};'use strict';var multer=require(_0x7bdf('0x0'));var util=require('util');var path=require(_0x7bdf('0x1'));var timeout=require(_0x7bdf('0x2'));var express=require(_0x7bdf('0x3'));var router=express[_0x7bdf('0x4')]();var auth=require(_0x7bdf('0x5'));var interaction=require(_0x7bdf('0x6'));var config=require(_0x7bdf('0x7'));var controller=require(_0x7bdf('0x8'));router[_0x7bdf('0x9')]('/',auth[_0x7bdf('0xa')](),controller[_0x7bdf('0xb')]);router['get'](_0x7bdf('0xc'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0xd')]);router[_0x7bdf('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7bdf('0xe')]('/',auth['isAuthenticated'](),controller[_0x7bdf('0xf')]);router['put'](_0x7bdf('0x10'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x11')]);router['delete'](_0x7bdf('0x10'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x12')]);module[_0x7bdf('0x13')]=router; \ No newline at end of file +var _0x1a42=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0xff93c2,_0x50e769){var _0x138ebe=function(_0xa00d5d){while(--_0xa00d5d){_0xff93c2['push'](_0xff93c2['shift']());}};_0x138ebe(++_0x50e769);}(_0x1a42,0x6c));var _0x21a4=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x1a42[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x21a4('0x0'));var util=require(_0x21a4('0x1'));var path=require(_0x21a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x21a4('0x3'));var router=express[_0x21a4('0x4')]();var auth=require(_0x21a4('0x5'));var interaction=require(_0x21a4('0x6'));var config=require(_0x21a4('0x7'));var controller=require(_0x21a4('0x8'));router['get']('/',auth[_0x21a4('0x9')](),controller['index']);router[_0x21a4('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x21a4('0xb'),auth[_0x21a4('0x9')](),controller[_0x21a4('0xc')]);router[_0x21a4('0xd')]('/',auth['isAuthenticated'](),controller[_0x21a4('0xe')]);router[_0x21a4('0xf')](_0x21a4('0xb'),auth[_0x21a4('0x9')](),controller['update']);router[_0x21a4('0x10')]('/:id',auth[_0x21a4('0x9')](),controller[_0x21a4('0x11')]);module[_0x21a4('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 fc97868..10a714e 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 _0xfd85=['moment','sequelize','STRING','account','agent','queue','DATE','NOW'];(function(_0x53b90f,_0x427673){var _0x337f68=function(_0x599ea2){while(--_0x599ea2){_0x53b90f['push'](_0x53b90f['shift']());}};_0x337f68(++_0x427673);}(_0xfd85,0x108));var _0x5fd8=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xfd85[_0x243217];return _0x478029;};'use strict';var moment=require(_0x5fd8('0x0'));var Sequelize=require(_0x5fd8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5fd8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5fd8('0x3'),_0x5fd8('0x4'),_0x5fd8('0x5')),'allowNull':![],'defaultValue':_0x5fd8('0x5')},'transferredAt':{'type':Sequelize[_0x5fd8('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5fd8('0x7')]}}; \ No newline at end of file +var _0xf31e=['STRING','ENUM','account','agent','queue','moment','sequelize','exports'];(function(_0x3d069e,_0x1d2ffa){var _0x40ec66=function(_0x50c861){while(--_0x50c861){_0x3d069e['push'](_0x3d069e['shift']());}};_0x40ec66(++_0x1d2ffa);}(_0xf31e,0x12d));var _0xef31=function(_0x1b10fb,_0x1fb3af){_0x1b10fb=_0x1b10fb-0x0;var _0x8574b1=_0xf31e[_0x1b10fb];return _0x8574b1;};'use strict';var moment=require(_0xef31('0x0'));var Sequelize=require(_0xef31('0x1'));module[_0xef31('0x2')]={'uniqueid':{'type':Sequelize[_0xef31('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xef31('0x4')](_0xef31('0x5'),_0xef31('0x6'),_0xef31('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c095169..9412beb 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 _0xa6fb=['limit','set','apply','reject','save','destroy','then','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xa6fb,0x75));var _0xba6f=function(_0x31904f,_0x4e78a3){_0x31904f=_0x31904f-0x0;var _0x19b069=_0xa6fb[_0x31904f];return _0x19b069;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba6f('0x0'));var rimraf=require(_0xba6f('0x1'));var zipdir=require(_0xba6f('0x2'));var jsonpatch=require(_0xba6f('0x3'));var rp=require(_0xba6f('0x4'));var moment=require(_0xba6f('0x5'));var BPromise=require(_0xba6f('0x6'));var Mustache=require('mustache');var util=require(_0xba6f('0x7'));var path=require(_0xba6f('0x8'));var sox=require(_0xba6f('0x9'));var csv=require(_0xba6f('0xa'));var ejs=require(_0xba6f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xba6f('0xc'));var jsforce=require(_0xba6f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba6f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba6f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xba6f('0xf'));var as=require(_0xba6f('0x10'));var hardwareService=require(_0xba6f('0x11'));var logger=require('../../config/logger')(_0xba6f('0x12'));var utils=require(_0xba6f('0x13'));var config=require(_0xba6f('0x14'));var db=require(_0xba6f('0x15'))['db'];function respondWithStatusCode(_0x21cbaf,_0x398efe){_0x398efe=_0x398efe||0xcc;return function(_0x4f8483){if(_0x4f8483){return _0x21cbaf[_0xba6f('0x16')](_0x398efe);}return _0x21cbaf[_0xba6f('0x17')](_0x398efe)[_0xba6f('0x18')]();};}function respondWithResult(_0x15b9a2,_0x4ff9e){_0x4ff9e=_0x4ff9e||0xc8;return function(_0x46e510){if(_0x46e510){return _0x15b9a2[_0xba6f('0x17')](_0x4ff9e)[_0xba6f('0x19')](_0x46e510);}};}function respondWithFilteredResult(_0x224157,_0x1d30fa){return function(_0x1d9f23){if(_0x1d9f23){var _0x158746=_0x1d9f23[_0xba6f('0x1a')],_0xb0f519=_0x1d30fa['offset'],_0x51168e=_0x1d30fa['offset']+_0x1d30fa[_0xba6f('0x1b')],_0x1fa362;if(_0x51168e>=_0x158746){_0x51168e=_0x158746;_0x1fa362=0xc8;}else{_0x1fa362=0xce;}_0x224157[_0xba6f('0x17')](_0x1fa362);return _0x224157[_0xba6f('0x1c')]('Content-Range',_0xb0f519+'-'+_0x51168e+'/'+_0x158746)['json'](_0x1d9f23);}return null;};}function patchUpdates(_0x4a7214){return function(_0x524f2e){try{jsonpatch[_0xba6f('0x1d')](_0x524f2e,_0x4a7214,!![]);}catch(_0x43b281){return BPromise[_0xba6f('0x1e')](_0x43b281);}return _0x524f2e[_0xba6f('0x1f')]();};}function saveUpdates(_0x240a4d,_0x40227f){return function(_0x4bcd87){if(_0x4bcd87){return _0x4bcd87['update'](_0x240a4d)['then'](function(_0x3c9447){return _0x3c9447;});}return null;};}function removeEntity(_0x1acdb3,_0x4b2b50){return function(_0x15a1a9){if(_0x15a1a9){return _0x15a1a9[_0xba6f('0x20')]()[_0xba6f('0x21')](function(){_0x1acdb3[_0xba6f('0x17')](0xcc)[_0xba6f('0x18')]();});}};}function handleEntityNotFound(_0x4f558e,_0x35840f){return function(_0x2879b4){if(!_0x2879b4){_0x4f558e[_0xba6f('0x16')](0x194);}return _0x2879b4;};}function handleError(_0x474a59,_0x2c3136){_0x2c3136=_0x2c3136||0x1f4;return function(_0x27cb89){logger['error'](_0x27cb89[_0xba6f('0x22')]);if(_0x27cb89[_0xba6f('0x23')]){delete _0x27cb89[_0xba6f('0x23')];}_0x474a59[_0xba6f('0x17')](_0x2c3136)['send'](_0x27cb89);};}exports[_0xba6f('0x24')]=function(_0x34c078,_0x5f4bc6){var _0x587586={},_0x23fccd={},_0x55f776={'count':0x0,'rows':[]};var _0x40ad50=_[_0xba6f('0x25')](db[_0xba6f('0x26')][_0xba6f('0x27')],function(_0x5d58aa){return{'name':_0x5d58aa[_0xba6f('0x28')],'type':_0x5d58aa[_0xba6f('0x29')][_0xba6f('0x2a')]};});_0x23fccd[_0xba6f('0x2b')]=_[_0xba6f('0x25')](_0x40ad50,_0xba6f('0x23'));_0x23fccd[_0xba6f('0x2c')]=_[_0xba6f('0x2d')](_0x34c078[_0xba6f('0x2c')]);_0x23fccd['filters']=_[_0xba6f('0x2e')](_0x23fccd[_0xba6f('0x2b')],_0x23fccd['query']);_0x587586[_0xba6f('0x2f')]=_[_0xba6f('0x2e')](_0x23fccd[_0xba6f('0x2b')],qs[_0xba6f('0x30')](_0x34c078['query']['fields']));_0x587586['attributes']=_0x587586['attributes'][_0xba6f('0x31')]?_0x587586[_0xba6f('0x2f')]:_0x23fccd[_0xba6f('0x2b')];if(!_0x34c078[_0xba6f('0x2c')][_0xba6f('0x32')](_0xba6f('0x33'))){_0x587586[_0xba6f('0x1b')]=qs['limit'](_0x34c078[_0xba6f('0x2c')][_0xba6f('0x1b')]);_0x587586[_0xba6f('0x34')]=qs[_0xba6f('0x34')](_0x34c078[_0xba6f('0x2c')][_0xba6f('0x34')]);}_0x587586[_0xba6f('0x35')]=qs[_0xba6f('0x36')](_0x34c078['query']['sort']);_0x587586[_0xba6f('0x37')]=qs[_0xba6f('0x38')](_[_0xba6f('0x39')](_0x34c078[_0xba6f('0x2c')],_0x23fccd[_0xba6f('0x38')]),_0x40ad50);if(_0x34c078[_0xba6f('0x2c')][_0xba6f('0x3a')]){_0x587586[_0xba6f('0x37')]=_[_0xba6f('0x3b')](_0x587586[_0xba6f('0x37')],{'$or':_['map'](_0x40ad50,function(_0x210efe){if(_0x210efe[_0xba6f('0x29')]!=='VIRTUAL'){var _0x1b02e1={};_0x1b02e1[_0x210efe[_0xba6f('0x23')]]={'$like':'%'+_0x34c078[_0xba6f('0x2c')]['filter']+'%'};return _0x1b02e1;}})});}_0x587586=_[_0xba6f('0x3b')]({},_0x587586,_0x34c078[_0xba6f('0x3c')]);var _0x2d0d36={'where':_0x587586[_0xba6f('0x37')]};return db[_0xba6f('0x26')]['count'](_0x2d0d36)[_0xba6f('0x21')](function(_0x29e53a){_0x55f776[_0xba6f('0x1a')]=_0x29e53a;if(_0x34c078[_0xba6f('0x2c')][_0xba6f('0x3d')]){_0x587586[_0xba6f('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0xba6f('0x3f')](_0x587586);})[_0xba6f('0x21')](function(_0x4d3dc4){_0x55f776[_0xba6f('0x40')]=_0x4d3dc4;return _0x55f776;})['then'](respondWithFilteredResult(_0x5f4bc6,_0x587586))[_0xba6f('0x41')](handleError(_0x5f4bc6,null));};exports[_0xba6f('0x42')]=function(_0x43f30f,_0x2ec90a){var _0x5d152e={'raw':!![],'where':{'id':_0x43f30f[_0xba6f('0x43')]['id']}},_0x4da442={};_0x4da442[_0xba6f('0x2b')]=_[_0xba6f('0x2d')](db[_0xba6f('0x26')][_0xba6f('0x27')]);_0x4da442['query']=_['keys'](_0x43f30f[_0xba6f('0x2c')]);_0x4da442[_0xba6f('0x38')]=_[_0xba6f('0x2e')](_0x4da442[_0xba6f('0x2b')],_0x4da442[_0xba6f('0x2c')]);_0x5d152e[_0xba6f('0x2f')]=_[_0xba6f('0x2e')](_0x4da442[_0xba6f('0x2b')],qs[_0xba6f('0x30')](_0x43f30f[_0xba6f('0x2c')][_0xba6f('0x30')]));_0x5d152e[_0xba6f('0x2f')]=_0x5d152e[_0xba6f('0x2f')][_0xba6f('0x31')]?_0x5d152e[_0xba6f('0x2f')]:_0x4da442[_0xba6f('0x2b')];if(_0x43f30f[_0xba6f('0x2c')][_0xba6f('0x3d')]){_0x5d152e[_0xba6f('0x3e')]=[{'all':!![]}];}_0x5d152e=_[_0xba6f('0x3b')]({},_0x5d152e,_0x43f30f[_0xba6f('0x3c')]);return db[_0xba6f('0x26')][_0xba6f('0x44')](_0x5d152e)[_0xba6f('0x21')](handleEntityNotFound(_0x2ec90a,null))[_0xba6f('0x21')](respondWithResult(_0x2ec90a,null))['catch'](handleError(_0x2ec90a,null));};exports[_0xba6f('0x45')]=function(_0x4e6d02,_0x284356){return db[_0xba6f('0x26')][_0xba6f('0x45')](_0x4e6d02[_0xba6f('0x46')],{})[_0xba6f('0x21')](respondWithResult(_0x284356,0xc9))[_0xba6f('0x41')](handleError(_0x284356,null));};exports['update']=function(_0x5ef7df,_0x574e76){if(_0x5ef7df[_0xba6f('0x46')]['id']){delete _0x5ef7df[_0xba6f('0x46')]['id'];}return db[_0xba6f('0x26')]['find']({'where':{'id':_0x5ef7df[_0xba6f('0x43')]['id']}})[_0xba6f('0x21')](handleEntityNotFound(_0x574e76,null))[_0xba6f('0x21')](saveUpdates(_0x5ef7df[_0xba6f('0x46')],null))[_0xba6f('0x21')](respondWithResult(_0x574e76,null))[_0xba6f('0x41')](handleError(_0x574e76,null));};exports['destroy']=function(_0x112b4b,_0x1a01e8){return db[_0xba6f('0x26')][_0xba6f('0x44')]({'where':{'id':_0x112b4b[_0xba6f('0x43')]['id']}})[_0xba6f('0x21')](handleEntityNotFound(_0x1a01e8,null))[_0xba6f('0x21')](removeEntity(_0x1a01e8,null))[_0xba6f('0x41')](handleError(_0x1a01e8,null));};exports[_0xba6f('0x47')]=function(_0x221624,_0x43b50){return db[_0xba6f('0x26')]['describe']()[_0xba6f('0x21')](respondWithResult(_0x43b50,null))[_0xba6f('0x41')](handleError(_0x43b50,null));}; \ No newline at end of file +var _0x0bc9=['show','rawAttributes','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','index','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','MailTransferReport','includeAll','include','findAll','rows'];(function(_0x24d4ed,_0x4c8ae0){var _0x5ae119=function(_0x5c5578){while(--_0x5c5578){_0x24d4ed['push'](_0x24d4ed['shift']());}};_0x5ae119(++_0x4c8ae0);}(_0x0bc9,0x17a));var _0x90bc=function(_0x37e388,_0x47c860){_0x37e388=_0x37e388-0x0;var _0x3e9238=_0x0bc9[_0x37e388];return _0x3e9238;};'use strict';var pdf=require(_0x90bc('0x0'));var emlformat=require(_0x90bc('0x1'));var rimraf=require(_0x90bc('0x2'));var zipdir=require(_0x90bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90bc('0x4'));var moment=require(_0x90bc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90bc('0x6'));var path=require(_0x90bc('0x7'));var sox=require(_0x90bc('0x8'));var csv=require(_0x90bc('0x9'));var ejs=require(_0x90bc('0xa'));var fs=require('fs');var _=require(_0x90bc('0xb'));var squel=require(_0x90bc('0xc'));var crypto=require(_0x90bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x90bc('0xe'));var toCsv=require(_0x90bc('0x9'));var querystring=require('querystring');var Papa=require(_0x90bc('0xf'));var Redis=require(_0x90bc('0x10'));var authService=require(_0x90bc('0x11'));var qs=require(_0x90bc('0x12'));var as=require(_0x90bc('0x13'));var hardwareService=require(_0x90bc('0x14'));var logger=require(_0x90bc('0x15'))(_0x90bc('0x16'));var utils=require(_0x90bc('0x17'));var config=require(_0x90bc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2845d5,_0x53dbc3){_0x53dbc3=_0x53dbc3||0xcc;return function(_0x24d321){if(_0x24d321){return _0x2845d5[_0x90bc('0x19')](_0x53dbc3);}return _0x2845d5[_0x90bc('0x1a')](_0x53dbc3)[_0x90bc('0x1b')]();};}function respondWithResult(_0x550cc8,_0x3eed58){_0x3eed58=_0x3eed58||0xc8;return function(_0x2255a0){if(_0x2255a0){return _0x550cc8[_0x90bc('0x1a')](_0x3eed58)[_0x90bc('0x1c')](_0x2255a0);}};}function respondWithFilteredResult(_0x158814,_0x40a792){return function(_0xf6aa80){if(_0xf6aa80){var _0x3b7f31=_0xf6aa80[_0x90bc('0x1d')],_0x1927e1=_0x40a792[_0x90bc('0x1e')],_0x413aa3=_0x40a792['offset']+_0x40a792[_0x90bc('0x1f')],_0xee8928;if(_0x413aa3>=_0x3b7f31){_0x413aa3=_0x3b7f31;_0xee8928=0xc8;}else{_0xee8928=0xce;}_0x158814[_0x90bc('0x1a')](_0xee8928);return _0x158814[_0x90bc('0x20')](_0x90bc('0x21'),_0x1927e1+'-'+_0x413aa3+'/'+_0x3b7f31)[_0x90bc('0x1c')](_0xf6aa80);}return null;};}function patchUpdates(_0x4754ed){return function(_0x2c5322){try{jsonpatch[_0x90bc('0x22')](_0x2c5322,_0x4754ed,!![]);}catch(_0x203686){return BPromise[_0x90bc('0x23')](_0x203686);}return _0x2c5322['save']();};}function saveUpdates(_0x5e4ca2,_0x35e20c){return function(_0x1756ef){if(_0x1756ef){return _0x1756ef[_0x90bc('0x24')](_0x5e4ca2)['then'](function(_0x3543b0){return _0x3543b0;});}return null;};}function removeEntity(_0x408d3d,_0x3e32b4){return function(_0x6b7024){if(_0x6b7024){return _0x6b7024[_0x90bc('0x25')]()[_0x90bc('0x26')](function(){_0x408d3d[_0x90bc('0x1a')](0xcc)[_0x90bc('0x1b')]();});}};}function handleEntityNotFound(_0x2b9380,_0x5cb63b){return function(_0x35817c){if(!_0x35817c){_0x2b9380[_0x90bc('0x19')](0x194);}return _0x35817c;};}function handleError(_0x2fdbf4,_0x3ea900){_0x3ea900=_0x3ea900||0x1f4;return function(_0x8077aa){logger[_0x90bc('0x27')](_0x8077aa[_0x90bc('0x28')]);if(_0x8077aa['name']){delete _0x8077aa['name'];}_0x2fdbf4[_0x90bc('0x1a')](_0x3ea900)['send'](_0x8077aa);};}exports[_0x90bc('0x29')]=function(_0x263074,_0x175831){var _0xc96e95={},_0x3d81a5={},_0x5c97ae={'count':0x0,'rows':[]};var _0x297f68=_[_0x90bc('0x2a')](db['MailTransferReport']['rawAttributes'],function(_0x5ead48){return{'name':_0x5ead48['fieldName'],'type':_0x5ead48[_0x90bc('0x2b')][_0x90bc('0x2c')]};});_0x3d81a5[_0x90bc('0x2d')]=_[_0x90bc('0x2a')](_0x297f68,_0x90bc('0x2e'));_0x3d81a5[_0x90bc('0x2f')]=_[_0x90bc('0x30')](_0x263074[_0x90bc('0x2f')]);_0x3d81a5[_0x90bc('0x31')]=_[_0x90bc('0x32')](_0x3d81a5[_0x90bc('0x2d')],_0x3d81a5[_0x90bc('0x2f')]);_0xc96e95[_0x90bc('0x33')]=_[_0x90bc('0x32')](_0x3d81a5[_0x90bc('0x2d')],qs[_0x90bc('0x34')](_0x263074[_0x90bc('0x2f')][_0x90bc('0x34')]));_0xc96e95[_0x90bc('0x33')]=_0xc96e95[_0x90bc('0x33')][_0x90bc('0x35')]?_0xc96e95['attributes']:_0x3d81a5[_0x90bc('0x2d')];if(!_0x263074[_0x90bc('0x2f')][_0x90bc('0x36')]('nolimit')){_0xc96e95[_0x90bc('0x1f')]=qs[_0x90bc('0x1f')](_0x263074[_0x90bc('0x2f')][_0x90bc('0x1f')]);_0xc96e95[_0x90bc('0x1e')]=qs[_0x90bc('0x1e')](_0x263074[_0x90bc('0x2f')]['offset']);}_0xc96e95[_0x90bc('0x37')]=qs[_0x90bc('0x38')](_0x263074['query']['sort']);_0xc96e95[_0x90bc('0x39')]=qs[_0x90bc('0x31')](_['pick'](_0x263074['query'],_0x3d81a5['filters']),_0x297f68);if(_0x263074[_0x90bc('0x2f')]['filter']){_0xc96e95['where']=_[_0x90bc('0x3a')](_0xc96e95[_0x90bc('0x39')],{'$or':_[_0x90bc('0x2a')](_0x297f68,function(_0x5bbb73){if(_0x5bbb73['type']!=='VIRTUAL'){var _0x26ee9e={};_0x26ee9e[_0x5bbb73[_0x90bc('0x2e')]]={'$like':'%'+_0x263074[_0x90bc('0x2f')][_0x90bc('0x3b')]+'%'};return _0x26ee9e;}})});}_0xc96e95=_['merge']({},_0xc96e95,_0x263074[_0x90bc('0x3c')]);var _0x1915b0={'where':_0xc96e95[_0x90bc('0x39')]};return db[_0x90bc('0x3d')]['count'](_0x1915b0)[_0x90bc('0x26')](function(_0x588fe1){_0x5c97ae[_0x90bc('0x1d')]=_0x588fe1;if(_0x263074[_0x90bc('0x2f')][_0x90bc('0x3e')]){_0xc96e95[_0x90bc('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x90bc('0x40')](_0xc96e95);})[_0x90bc('0x26')](function(_0x3cc266){_0x5c97ae[_0x90bc('0x41')]=_0x3cc266;return _0x5c97ae;})[_0x90bc('0x26')](respondWithFilteredResult(_0x175831,_0xc96e95))['catch'](handleError(_0x175831,null));};exports[_0x90bc('0x42')]=function(_0xc502a6,_0x50eaa4){var _0xfb2e9c={'raw':!![],'where':{'id':_0xc502a6['params']['id']}},_0x22cac3={};_0x22cac3[_0x90bc('0x2d')]=_[_0x90bc('0x30')](db[_0x90bc('0x3d')][_0x90bc('0x43')]);_0x22cac3['query']=_[_0x90bc('0x30')](_0xc502a6[_0x90bc('0x2f')]);_0x22cac3['filters']=_[_0x90bc('0x32')](_0x22cac3['model'],_0x22cac3[_0x90bc('0x2f')]);_0xfb2e9c[_0x90bc('0x33')]=_[_0x90bc('0x32')](_0x22cac3[_0x90bc('0x2d')],qs['fields'](_0xc502a6[_0x90bc('0x2f')][_0x90bc('0x34')]));_0xfb2e9c[_0x90bc('0x33')]=_0xfb2e9c['attributes'][_0x90bc('0x35')]?_0xfb2e9c[_0x90bc('0x33')]:_0x22cac3[_0x90bc('0x2d')];if(_0xc502a6[_0x90bc('0x2f')]['includeAll']){_0xfb2e9c['include']=[{'all':!![]}];}_0xfb2e9c=_['merge']({},_0xfb2e9c,_0xc502a6[_0x90bc('0x3c')]);return db['MailTransferReport'][_0x90bc('0x44')](_0xfb2e9c)[_0x90bc('0x26')](handleEntityNotFound(_0x50eaa4,null))[_0x90bc('0x26')](respondWithResult(_0x50eaa4,null))[_0x90bc('0x45')](handleError(_0x50eaa4,null));};exports[_0x90bc('0x46')]=function(_0x8316ba,_0x42de0f){return db[_0x90bc('0x3d')][_0x90bc('0x46')](_0x8316ba[_0x90bc('0x47')],{})['then'](respondWithResult(_0x42de0f,0xc9))[_0x90bc('0x45')](handleError(_0x42de0f,null));};exports[_0x90bc('0x24')]=function(_0x555887,_0x1ff233){if(_0x555887['body']['id']){delete _0x555887[_0x90bc('0x47')]['id'];}return db['MailTransferReport'][_0x90bc('0x44')]({'where':{'id':_0x555887['params']['id']}})[_0x90bc('0x26')](handleEntityNotFound(_0x1ff233,null))[_0x90bc('0x26')](saveUpdates(_0x555887[_0x90bc('0x47')],null))['then'](respondWithResult(_0x1ff233,null))[_0x90bc('0x45')](handleError(_0x1ff233,null));};exports['destroy']=function(_0x10bb47,_0x59edad){return db[_0x90bc('0x3d')][_0x90bc('0x44')]({'where':{'id':_0x10bb47[_0x90bc('0x48')]['id']}})[_0x90bc('0x26')](handleEntityNotFound(_0x59edad,null))[_0x90bc('0x26')](removeEntity(_0x59edad,null))[_0x90bc('0x45')](handleError(_0x59edad,null));};exports[_0x90bc('0x49')]=function(_0x43554a,_0x15b251){return db['MailTransferReport'][_0x90bc('0x49')]()[_0x90bc('0x26')](respondWithResult(_0x15b251,null))[_0x90bc('0x45')](handleError(_0x15b251,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0ed31ce..35f89be 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 _0xc12c=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x4edd17,_0x40f57a){var _0x413811=function(_0x2d42ef){while(--_0x2d42ef){_0x4edd17['push'](_0x4edd17['shift']());}};_0x413811(++_0x40f57a);}(_0xc12c,0xd1));var _0xcc12=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xc12c[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xcc12('0x0'));var util=require(_0xcc12('0x1'));var logger=require(_0xcc12('0x2'))(_0xcc12('0x3'));var moment=require(_0xcc12('0x4'));var BPromise=require(_0xcc12('0x5'));var rp=require(_0xcc12('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc12('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc12('0x8'));module[_0xcc12('0x9')]=function(_0x346632,_0x15f6b5){return _0x346632[_0xcc12('0xa')](_0xcc12('0xb'),attributes,{'tableName':_0xcc12('0xc'),'paranoid':![],'indexes':[{'name':_0xcc12('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7eb=['report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','MailTransferReport'];(function(_0x101675,_0x252cf6){var _0x1c3cf4=function(_0x242b6c){while(--_0x242b6c){_0x101675['push'](_0x101675['shift']());}};_0x1c3cf4(++_0x252cf6);}(_0xf7eb,0x1a4));var _0xbf7e=function(_0x4a4ec7,_0x5ddfb6){_0x4a4ec7=_0x4a4ec7-0x0;var _0x2620b5=_0xf7eb[_0x4a4ec7];return _0x2620b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf7e('0x0'))(_0xbf7e('0x1'));var moment=require(_0xbf7e('0x2'));var BPromise=require(_0xbf7e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf7e('0x4'));var rimraf=require('rimraf');var config=require(_0xbf7e('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0xbf7e('0x6')]=function(_0x502311,_0x53fe2f){return _0x502311[_0xbf7e('0x7')](_0xbf7e('0x8'),attributes,{'tableName':_0xbf7e('0x9'),'paranoid':![],'indexes':[{'name':_0xbf7e('0xa'),'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 b4c12b4..f91e54e 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 _0x67fa=['http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67fa,0x11d));var _0xa67f=function(_0x55caa2,_0x12579f){_0x55caa2=_0x55caa2-0x0;var _0x3d5834=_0x67fa[_0x55caa2];return _0x3d5834;};'use strict';var _=require(_0xa67f('0x0'));var util=require(_0xa67f('0x1'));var moment=require(_0xa67f('0x2'));var BPromise=require(_0xa67f('0x3'));var rs=require(_0xa67f('0x4'));var fs=require('fs');var Redis=require(_0xa67f('0x5'));var db=require(_0xa67f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa67f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa67f('0x8')][_0xa67f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c6b77,_0x252984,_0x108281){return new BPromise(function(_0xbbc2a0,_0x26a64d){return client['request'](_0x4c6b77,_0x108281)[_0xa67f('0xa')](function(_0x10d2ef){logger[_0xa67f('0xb')](_0xa67f('0xc'),_0x252984,_0xa67f('0xd'));logger[_0xa67f('0xe')](_0xa67f('0xf'),_0x252984,'request\x20sent',JSON['stringify'](_0x10d2ef));if(_0x10d2ef[_0xa67f('0x10')]){if(_0x10d2ef[_0xa67f('0x10')][_0xa67f('0x11')]===0x1f4){logger[_0xa67f('0x10')](_0xa67f('0xc'),_0x252984,_0x10d2ef[_0xa67f('0x10')]['message']);return _0x26a64d(_0x10d2ef[_0xa67f('0x10')][_0xa67f('0x12')]);}logger[_0xa67f('0x10')](_0xa67f('0xc'),_0x252984,_0x10d2ef[_0xa67f('0x10')][_0xa67f('0x12')]);return _0xbbc2a0(_0x10d2ef['error']['message']);}else{logger[_0xa67f('0xb')](_0xa67f('0xc'),_0x252984,_0xa67f('0xd'));_0xbbc2a0(_0x10d2ef[_0xa67f('0x13')][_0xa67f('0x12')]);}})[_0xa67f('0x14')](function(_0x48b4e0){logger[_0xa67f('0x10')](_0xa67f('0xc'),_0x252984,_0x48b4e0);_0x26a64d(_0x48b4e0);});});} \ No newline at end of file +var _0xc114=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0xc114,0x74));var _0x4c11=function(_0x4c7d63,_0x4b1bd7){_0x4c7d63=_0x4c7d63-0x0;var _0x593b8d=_0xc114[_0x4c7d63];return _0x593b8d;};'use strict';var _=require(_0x4c11('0x0'));var util=require(_0x4c11('0x1'));var moment=require(_0x4c11('0x2'));var BPromise=require(_0x4c11('0x3'));var rs=require(_0x4c11('0x4'));var fs=require('fs');var Redis=require(_0x4c11('0x5'));var db=require(_0x4c11('0x6'))['db'];var utils=require(_0x4c11('0x7'));var logger=require(_0x4c11('0x8'))(_0x4c11('0x9'));var config=require(_0x4c11('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4c11('0xb')][_0x4c11('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6631ce,_0x2afe48,_0x6eae73){return new BPromise(function(_0x357525,_0x18a15e){return client[_0x4c11('0xd')](_0x6631ce,_0x6eae73)['then'](function(_0x2263dc){logger[_0x4c11('0xe')](_0x4c11('0xf'),_0x2afe48,_0x4c11('0x10'));logger['debug'](_0x4c11('0x11'),_0x2afe48,_0x4c11('0x10'),JSON[_0x4c11('0x12')](_0x2263dc));if(_0x2263dc[_0x4c11('0x13')]){if(_0x2263dc[_0x4c11('0x13')][_0x4c11('0x14')]===0x1f4){logger[_0x4c11('0x13')](_0x4c11('0xf'),_0x2afe48,_0x2263dc[_0x4c11('0x13')][_0x4c11('0x15')]);return _0x18a15e(_0x2263dc[_0x4c11('0x13')][_0x4c11('0x15')]);}logger[_0x4c11('0x13')](_0x4c11('0xf'),_0x2afe48,_0x2263dc['error'][_0x4c11('0x15')]);return _0x357525(_0x2263dc[_0x4c11('0x13')][_0x4c11('0x15')]);}else{logger[_0x4c11('0xe')](_0x4c11('0xf'),_0x2afe48,'request\x20sent');_0x357525(_0x2263dc[_0x4c11('0x16')]['message']);}})[_0x4c11('0x17')](function(_0x5df895){logger[_0x4c11('0x13')](_0x4c11('0xf'),_0x2afe48,_0x5df895);_0x18a15e(_0x5df895);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5028e1a..4c2d0fc 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 _0x941b=['./memberReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put','update','delete','/:id','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13d878,_0x3ac33){var _0x4f9280=function(_0x3e59e4){while(--_0x3e59e4){_0x13d878['push'](_0x13d878['shift']());}};_0x4f9280(++_0x3ac33);}(_0x941b,0x175));var _0xb941=function(_0xfacf7d,_0xdb0ef6){_0xfacf7d=_0xfacf7d-0x0;var _0x2a8cd1=_0x941b[_0xfacf7d];return _0x2a8cd1;};'use strict';var multer=require(_0xb941('0x0'));var util=require(_0xb941('0x1'));var path=require(_0xb941('0x2'));var timeout=require('connect-timeout');var express=require(_0xb941('0x3'));var router=express['Router']();var auth=require(_0xb941('0x4'));var interaction=require(_0xb941('0x5'));var config=require(_0xb941('0x6'));var controller=require(_0xb941('0x7'));router['get']('/',auth[_0xb941('0x8')](),controller[_0xb941('0x9')]);router['get'](_0xb941('0xa'),auth[_0xb941('0x8')](),controller[_0xb941('0xb')]);router[_0xb941('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb941('0xd')]);router[_0xb941('0xe')]('/',auth[_0xb941('0x8')](),controller[_0xb941('0xf')]);router[_0xb941('0x10')]('/:id',auth[_0xb941('0x8')](),controller[_0xb941('0x11')]);router[_0xb941('0x12')](_0xb941('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8109=['describe','/:id','show','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x52d8b9,_0xe54454){var _0x126b5b=function(_0x43d8c8){while(--_0x43d8c8){_0x52d8b9['push'](_0x52d8b9['shift']());}};_0x126b5b(++_0xe54454);}(_0x8109,0x112));var _0x9810=function(_0x5c5cf6,_0x1cafb4){_0x5c5cf6=_0x5c5cf6-0x0;var _0x2a4f91=_0x8109[_0x5c5cf6];return _0x2a4f91;};'use strict';var multer=require('multer');var util=require(_0x9810('0x0'));var path=require(_0x9810('0x1'));var timeout=require('connect-timeout');var express=require(_0x9810('0x2'));var router=express[_0x9810('0x3')]();var auth=require(_0x9810('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9810('0x5'));var controller=require(_0x9810('0x6'));router[_0x9810('0x7')]('/',auth['isAuthenticated'](),controller[_0x9810('0x8')]);router[_0x9810('0x7')](_0x9810('0x9'),auth[_0x9810('0xa')](),controller[_0x9810('0xb')]);router[_0x9810('0x7')](_0x9810('0xc'),auth[_0x9810('0xa')](),controller[_0x9810('0xd')]);router['post']('/',auth[_0x9810('0xa')](),controller[_0x9810('0xe')]);router[_0x9810('0xf')](_0x9810('0xc'),auth[_0x9810('0xa')](),controller[_0x9810('0x10')]);router[_0x9810('0x11')]('/:id',auth[_0x9810('0xa')](),controller['destroy']);module[_0x9810('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 50f9151..6865dff 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 _0x68f9=['talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x68f9,0x6f));var _0x968f=function(_0x4302ec,_0x2d89bc){_0x4302ec=_0x4302ec-0x0;var _0x30df37=_0x68f9[_0x4302ec];return _0x30df37;};'use strict';var Sequelize=require(_0x968f('0x0'));var moment=require(_0x968f('0x1'));module[_0x968f('0x2')]={'channel':{'type':Sequelize[_0x968f('0x3')]},'membername':{'type':Sequelize[_0x968f('0x3')]},'interface':{'type':Sequelize[_0x968f('0x3')]},'type':{'type':Sequelize[_0x968f('0x3')],'defaultValue':_0x968f('0x4'),'comment':_0x968f('0x5')},'duration':{'type':Sequelize[_0x968f('0x6')]},'enterAt':{'type':Sequelize[_0x968f('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1b4f07){var _0x3bc05e=moment(_0x1b4f07);var _0x28ae11=moment(this[_0x968f('0x8')](_0x968f('0x9')));var _0x471e6f=_0x3bc05e[_0x968f('0xa')](_0x28ae11,_0x968f('0xb'));this[_0x968f('0xc')]('exitAt',_0x1b4f07);this[_0x968f('0xc')](_0x968f('0xd'),_0x471e6f||null);}},'data1':{'type':Sequelize[_0x968f('0x3')],'comment':_0x968f('0xe')},'data2':{'type':Sequelize[_0x968f('0x3')],'comment':_0x968f('0xf')},'data3':{'type':Sequelize[_0x968f('0x3')],'comment':_0x968f('0x10')},'data4':{'type':Sequelize[_0x968f('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x968f('0x3')],'comment':_0x968f('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x968f('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb538=['talk:[start]','talk:[dial\x20string]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb538,0x1c2));var _0x8b53=function(_0x57b2b8,_0x32db60){_0x57b2b8=_0x57b2b8-0x0;var _0x2ac488=_0xb538[_0x57b2b8];return _0x2ac488;};'use strict';var Sequelize=require(_0x8b53('0x0'));var moment=require('moment');module[_0x8b53('0x1')]={'channel':{'type':Sequelize[_0x8b53('0x2')]},'membername':{'type':Sequelize[_0x8b53('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8b53('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x8b53('0x3')},'duration':{'type':Sequelize[_0x8b53('0x4')]},'enterAt':{'type':Sequelize[_0x8b53('0x5')]},'exitAt':{'type':Sequelize[_0x8b53('0x5')],'set':function(_0x296265){var _0x13c4e0=moment(_0x296265);var _0x2380b6=moment(this[_0x8b53('0x6')](_0x8b53('0x7')));var _0x4b8a26=_0x13c4e0[_0x8b53('0x8')](_0x2380b6,_0x8b53('0x9'));this[_0x8b53('0xa')](_0x8b53('0xb'),_0x296265);this['setDataValue'](_0x8b53('0xc'),_0x4b8a26||null);}},'data1':{'type':Sequelize[_0x8b53('0x2')],'comment':_0x8b53('0xd')},'data2':{'type':Sequelize[_0x8b53('0x2')],'comment':_0x8b53('0xe')},'data3':{'type':Sequelize[_0x8b53('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x8b53('0x2')],'comment':_0x8b53('0xf')},'data5':{'type':Sequelize[_0x8b53('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x8b53('0x4')]},'uniqueid':{'type':Sequelize[_0x8b53('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d70e7f0..982dc4b 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 _0xbaed=['../../config/utils','../../mysqldb','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','status','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','MemberReport','findAll','rows','show','params','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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'];(function(_0x35d2d6,_0x14e944){var _0x1637d5=function(_0x327b04){while(--_0x327b04){_0x35d2d6['push'](_0x35d2d6['shift']());}};_0x1637d5(++_0x14e944);}(_0xbaed,0xcd));var _0xdbae=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xbaed[_0x55c1f0];return _0x1530fa;};'use strict';var pdf=require(_0xdbae('0x0'));var emlformat=require(_0xdbae('0x1'));var rimraf=require(_0xdbae('0x2'));var zipdir=require(_0xdbae('0x3'));var jsonpatch=require(_0xdbae('0x4'));var rp=require('request-promise');var moment=require(_0xdbae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbae('0x6'));var util=require('util');var path=require(_0xdbae('0x7'));var sox=require(_0xdbae('0x8'));var csv=require(_0xdbae('0x9'));var ejs=require(_0xdbae('0xa'));var fs=require('fs');var _=require(_0xdbae('0xb'));var squel=require(_0xdbae('0xc'));var crypto=require('crypto');var jsforce=require(_0xdbae('0xd'));var deskjs=require(_0xdbae('0xe'));var toCsv=require(_0xdbae('0x9'));var querystring=require(_0xdbae('0xf'));var Papa=require(_0xdbae('0x10'));var Redis=require(_0xdbae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdbae('0x12'));var as=require(_0xdbae('0x13'));var hardwareService=require(_0xdbae('0x14'));var logger=require(_0xdbae('0x15'))(_0xdbae('0x16'));var utils=require(_0xdbae('0x17'));var config=require('../../config/environment');var db=require(_0xdbae('0x18'))['db'];function respondWithStatusCode(_0x3510c9,_0x45c9a9){_0x45c9a9=_0x45c9a9||0xcc;return function(_0x413c27){if(_0x413c27){return _0x3510c9['sendStatus'](_0x45c9a9);}return _0x3510c9['status'](_0x45c9a9)[_0xdbae('0x19')]();};}function respondWithResult(_0x30406a,_0x5eb5b6){_0x5eb5b6=_0x5eb5b6||0xc8;return function(_0x52937b){if(_0x52937b){return _0x30406a['status'](_0x5eb5b6)[_0xdbae('0x1a')](_0x52937b);}};}function respondWithFilteredResult(_0x2f19d8,_0xa03425){return function(_0x958da5){if(_0x958da5){var _0x1663b1=_0x958da5[_0xdbae('0x1b')],_0x6642a3=_0xa03425['offset'],_0x39781e=_0xa03425[_0xdbae('0x1c')]+_0xa03425[_0xdbae('0x1d')],_0x3b7625;if(_0x39781e>=_0x1663b1){_0x39781e=_0x1663b1;_0x3b7625=0xc8;}else{_0x3b7625=0xce;}_0x2f19d8['status'](_0x3b7625);return _0x2f19d8[_0xdbae('0x1e')](_0xdbae('0x1f'),_0x6642a3+'-'+_0x39781e+'/'+_0x1663b1)['json'](_0x958da5);}return null;};}function patchUpdates(_0x4c48a2){return function(_0x1318dc){try{jsonpatch[_0xdbae('0x20')](_0x1318dc,_0x4c48a2,!![]);}catch(_0x9d4aac){return BPromise['reject'](_0x9d4aac);}return _0x1318dc[_0xdbae('0x21')]();};}function saveUpdates(_0x31766f,_0x5129c4){return function(_0x49fc8f){if(_0x49fc8f){return _0x49fc8f[_0xdbae('0x22')](_0x31766f)[_0xdbae('0x23')](function(_0x565bd6){return _0x565bd6;});}return null;};}function removeEntity(_0x5336b4,_0x3e1470){return function(_0x4bb01c){if(_0x4bb01c){return _0x4bb01c[_0xdbae('0x24')]()[_0xdbae('0x23')](function(){_0x5336b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x79e683,_0x4441f6){return function(_0x402832){if(!_0x402832){_0x79e683['sendStatus'](0x194);}return _0x402832;};}function handleError(_0x59ba8f,_0x1b6074){_0x1b6074=_0x1b6074||0x1f4;return function(_0x162e69){logger[_0xdbae('0x25')](_0x162e69[_0xdbae('0x26')]);if(_0x162e69['name']){delete _0x162e69[_0xdbae('0x27')];}_0x59ba8f[_0xdbae('0x28')](_0x1b6074)[_0xdbae('0x29')](_0x162e69);};}exports['index']=function(_0x20f90d,_0x3054c2){var _0x3f233e={},_0x305917={},_0x2d9a0b={'count':0x0,'rows':[]};var _0x3bc79e=_[_0xdbae('0x2a')](db['MemberReport'][_0xdbae('0x2b')],function(_0x506340){return{'name':_0x506340[_0xdbae('0x2c')],'type':_0x506340['type'][_0xdbae('0x2d')]};});_0x305917['model']=_[_0xdbae('0x2a')](_0x3bc79e,_0xdbae('0x27'));_0x305917[_0xdbae('0x2e')]=_[_0xdbae('0x2f')](_0x20f90d[_0xdbae('0x2e')]);_0x305917[_0xdbae('0x30')]=_[_0xdbae('0x31')](_0x305917['model'],_0x305917[_0xdbae('0x2e')]);_0x3f233e[_0xdbae('0x32')]=_[_0xdbae('0x31')](_0x305917[_0xdbae('0x33')],qs[_0xdbae('0x34')](_0x20f90d[_0xdbae('0x2e')][_0xdbae('0x34')]));_0x3f233e[_0xdbae('0x32')]=_0x3f233e[_0xdbae('0x32')][_0xdbae('0x35')]?_0x3f233e[_0xdbae('0x32')]:_0x305917['model'];if(!_0x20f90d[_0xdbae('0x2e')][_0xdbae('0x36')](_0xdbae('0x37'))){_0x3f233e[_0xdbae('0x1d')]=qs[_0xdbae('0x1d')](_0x20f90d[_0xdbae('0x2e')]['limit']);_0x3f233e['offset']=qs[_0xdbae('0x1c')](_0x20f90d[_0xdbae('0x2e')][_0xdbae('0x1c')]);}_0x3f233e[_0xdbae('0x38')]=qs['sort'](_0x20f90d[_0xdbae('0x2e')][_0xdbae('0x39')]);_0x3f233e['where']=qs['filters'](_[_0xdbae('0x3a')](_0x20f90d['query'],_0x305917[_0xdbae('0x30')]),_0x3bc79e);if(_0x20f90d[_0xdbae('0x2e')]['filter']){_0x3f233e[_0xdbae('0x3b')]=_[_0xdbae('0x3c')](_0x3f233e[_0xdbae('0x3b')],{'$or':_[_0xdbae('0x2a')](_0x3bc79e,function(_0x5532f5){if(_0x5532f5[_0xdbae('0x3d')]!==_0xdbae('0x3e')){var _0x760c03={};_0x760c03[_0x5532f5[_0xdbae('0x27')]]={'$like':'%'+_0x20f90d[_0xdbae('0x2e')][_0xdbae('0x3f')]+'%'};return _0x760c03;}})});}_0x3f233e=_['merge']({},_0x3f233e,_0x20f90d[_0xdbae('0x40')]);var _0x2a1138={'where':_0x3f233e[_0xdbae('0x3b')]};return db[_0xdbae('0x41')][_0xdbae('0x1b')](_0x2a1138)[_0xdbae('0x23')](function(_0x5e63f6){_0x2d9a0b[_0xdbae('0x1b')]=_0x5e63f6;if(_0x20f90d[_0xdbae('0x2e')]['includeAll']){_0x3f233e['include']=[{'all':!![]}];}return db[_0xdbae('0x41')][_0xdbae('0x42')](_0x3f233e);})[_0xdbae('0x23')](function(_0x77e303){_0x2d9a0b[_0xdbae('0x43')]=_0x77e303;return _0x2d9a0b;})[_0xdbae('0x23')](respondWithFilteredResult(_0x3054c2,_0x3f233e))['catch'](handleError(_0x3054c2,null));};exports[_0xdbae('0x44')]=function(_0x47401e,_0x3d07b4){var _0x3a430b={'raw':!![],'where':{'id':_0x47401e[_0xdbae('0x45')]['id']}},_0x38714b={};_0x38714b[_0xdbae('0x33')]=_[_0xdbae('0x2f')](db[_0xdbae('0x41')]['rawAttributes']);_0x38714b[_0xdbae('0x2e')]=_['keys'](_0x47401e['query']);_0x38714b[_0xdbae('0x30')]=_[_0xdbae('0x31')](_0x38714b[_0xdbae('0x33')],_0x38714b[_0xdbae('0x2e')]);_0x3a430b[_0xdbae('0x32')]=_[_0xdbae('0x31')](_0x38714b[_0xdbae('0x33')],qs[_0xdbae('0x34')](_0x47401e[_0xdbae('0x2e')][_0xdbae('0x34')]));_0x3a430b[_0xdbae('0x32')]=_0x3a430b[_0xdbae('0x32')][_0xdbae('0x35')]?_0x3a430b[_0xdbae('0x32')]:_0x38714b[_0xdbae('0x33')];if(_0x47401e['query'][_0xdbae('0x46')]){_0x3a430b['include']=[{'all':!![]}];}_0x3a430b=_[_0xdbae('0x3c')]({},_0x3a430b,_0x47401e[_0xdbae('0x40')]);return db[_0xdbae('0x41')][_0xdbae('0x47')](_0x3a430b)[_0xdbae('0x23')](handleEntityNotFound(_0x3d07b4,null))['then'](respondWithResult(_0x3d07b4,null))[_0xdbae('0x48')](handleError(_0x3d07b4,null));};exports[_0xdbae('0x49')]=function(_0x577598,_0x52fe1e){return db[_0xdbae('0x41')][_0xdbae('0x49')](_0x577598['body'],{})[_0xdbae('0x23')](respondWithResult(_0x52fe1e,0xc9))[_0xdbae('0x48')](handleError(_0x52fe1e,null));};exports['update']=function(_0x41920c,_0x325c33){if(_0x41920c[_0xdbae('0x4a')]['id']){delete _0x41920c['body']['id'];}return db[_0xdbae('0x41')][_0xdbae('0x47')]({'where':{'id':_0x41920c[_0xdbae('0x45')]['id']}})[_0xdbae('0x23')](handleEntityNotFound(_0x325c33,null))[_0xdbae('0x23')](saveUpdates(_0x41920c[_0xdbae('0x4a')],null))[_0xdbae('0x23')](respondWithResult(_0x325c33,null))[_0xdbae('0x48')](handleError(_0x325c33,null));};exports[_0xdbae('0x24')]=function(_0x2c565a,_0x53762b){return db[_0xdbae('0x41')][_0xdbae('0x47')]({'where':{'id':_0x2c565a[_0xdbae('0x45')]['id']}})['then'](handleEntityNotFound(_0x53762b,null))[_0xdbae('0x23')](removeEntity(_0x53762b,null))[_0xdbae('0x48')](handleError(_0x53762b,null));};exports[_0xdbae('0x4b')]=function(_0x94bc83,_0x223cd3){return db[_0xdbae('0x41')]['describe']()[_0xdbae('0x23')](respondWithResult(_0x223cd3,null))[_0xdbae('0x48')](handleError(_0x223cd3,null));}; \ No newline at end of file +var _0x26d2=['end','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x26d2,0x14a));var _0x226d=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x26d2[_0x30bd4d];return _0x306915;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x226d('0x0'));var rimraf=require(_0x226d('0x1'));var zipdir=require(_0x226d('0x2'));var jsonpatch=require(_0x226d('0x3'));var rp=require(_0x226d('0x4'));var moment=require(_0x226d('0x5'));var BPromise=require(_0x226d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x226d('0x7'));var csv=require('to-csv');var ejs=require(_0x226d('0x8'));var fs=require('fs');var _=require(_0x226d('0x9'));var squel=require(_0x226d('0xa'));var crypto=require(_0x226d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x226d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x226d('0xd'));var Papa=require(_0x226d('0xe'));var Redis=require('ioredis');var authService=require(_0x226d('0xf'));var qs=require(_0x226d('0x10'));var as=require(_0x226d('0x11'));var hardwareService=require(_0x226d('0x12'));var logger=require(_0x226d('0x13'))(_0x226d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x226d('0x15'))['db'];function respondWithStatusCode(_0xcfa07b,_0x1d3a64){_0x1d3a64=_0x1d3a64||0xcc;return function(_0x1ec3ca){if(_0x1ec3ca){return _0xcfa07b[_0x226d('0x16')](_0x1d3a64);}return _0xcfa07b[_0x226d('0x17')](_0x1d3a64)['end']();};}function respondWithResult(_0x4b53b7,_0x6e6ed1){_0x6e6ed1=_0x6e6ed1||0xc8;return function(_0x186570){if(_0x186570){return _0x4b53b7[_0x226d('0x17')](_0x6e6ed1)['json'](_0x186570);}};}function respondWithFilteredResult(_0x5df204,_0xe0b93e){return function(_0x50cb62){if(_0x50cb62){var _0x49b794=_0x50cb62[_0x226d('0x18')],_0xd217b6=_0xe0b93e[_0x226d('0x19')],_0x1cabd6=_0xe0b93e[_0x226d('0x19')]+_0xe0b93e[_0x226d('0x1a')],_0x2ee8bd;if(_0x1cabd6>=_0x49b794){_0x1cabd6=_0x49b794;_0x2ee8bd=0xc8;}else{_0x2ee8bd=0xce;}_0x5df204[_0x226d('0x17')](_0x2ee8bd);return _0x5df204[_0x226d('0x1b')](_0x226d('0x1c'),_0xd217b6+'-'+_0x1cabd6+'/'+_0x49b794)[_0x226d('0x1d')](_0x50cb62);}return null;};}function patchUpdates(_0x28eb9a){return function(_0x4f8a30){try{jsonpatch[_0x226d('0x1e')](_0x4f8a30,_0x28eb9a,!![]);}catch(_0x22b47a){return BPromise[_0x226d('0x1f')](_0x22b47a);}return _0x4f8a30[_0x226d('0x20')]();};}function saveUpdates(_0x10990b,_0x38a942){return function(_0x1d45e7){if(_0x1d45e7){return _0x1d45e7[_0x226d('0x21')](_0x10990b)[_0x226d('0x22')](function(_0x2d7922){return _0x2d7922;});}return null;};}function removeEntity(_0x2a8dfa,_0x321512){return function(_0x49c2f5){if(_0x49c2f5){return _0x49c2f5['destroy']()['then'](function(){_0x2a8dfa[_0x226d('0x17')](0xcc)[_0x226d('0x23')]();});}};}function handleEntityNotFound(_0x2a37b8,_0x1d9516){return function(_0x5be507){if(!_0x5be507){_0x2a37b8[_0x226d('0x16')](0x194);}return _0x5be507;};}function handleError(_0x567637,_0x3b9750){_0x3b9750=_0x3b9750||0x1f4;return function(_0x515e09){logger['error'](_0x515e09['stack']);if(_0x515e09['name']){delete _0x515e09[_0x226d('0x24')];}_0x567637[_0x226d('0x17')](_0x3b9750)[_0x226d('0x25')](_0x515e09);};}exports[_0x226d('0x26')]=function(_0x3e68b4,_0x50747c){var _0x4e98de={},_0x1578dd={},_0x201246={'count':0x0,'rows':[]};var _0x333e04=_[_0x226d('0x27')](db[_0x226d('0x28')][_0x226d('0x29')],function(_0x2371f6){return{'name':_0x2371f6[_0x226d('0x2a')],'type':_0x2371f6['type'][_0x226d('0x2b')]};});_0x1578dd[_0x226d('0x2c')]=_[_0x226d('0x27')](_0x333e04,_0x226d('0x24'));_0x1578dd[_0x226d('0x2d')]=_['keys'](_0x3e68b4[_0x226d('0x2d')]);_0x1578dd[_0x226d('0x2e')]=_['intersection'](_0x1578dd[_0x226d('0x2c')],_0x1578dd[_0x226d('0x2d')]);_0x4e98de['attributes']=_['intersection'](_0x1578dd['model'],qs[_0x226d('0x2f')](_0x3e68b4[_0x226d('0x2d')][_0x226d('0x2f')]));_0x4e98de[_0x226d('0x30')]=_0x4e98de[_0x226d('0x30')][_0x226d('0x31')]?_0x4e98de[_0x226d('0x30')]:_0x1578dd['model'];if(!_0x3e68b4[_0x226d('0x2d')][_0x226d('0x32')](_0x226d('0x33'))){_0x4e98de[_0x226d('0x1a')]=qs['limit'](_0x3e68b4['query'][_0x226d('0x1a')]);_0x4e98de[_0x226d('0x19')]=qs[_0x226d('0x19')](_0x3e68b4[_0x226d('0x2d')][_0x226d('0x19')]);}_0x4e98de[_0x226d('0x34')]=qs['sort'](_0x3e68b4[_0x226d('0x2d')][_0x226d('0x35')]);_0x4e98de[_0x226d('0x36')]=qs['filters'](_[_0x226d('0x37')](_0x3e68b4['query'],_0x1578dd['filters']),_0x333e04);if(_0x3e68b4['query'][_0x226d('0x38')]){_0x4e98de[_0x226d('0x36')]=_[_0x226d('0x39')](_0x4e98de[_0x226d('0x36')],{'$or':_[_0x226d('0x27')](_0x333e04,function(_0x5b2edb){if(_0x5b2edb[_0x226d('0x3a')]!==_0x226d('0x3b')){var _0x138dae={};_0x138dae[_0x5b2edb[_0x226d('0x24')]]={'$like':'%'+_0x3e68b4[_0x226d('0x2d')][_0x226d('0x38')]+'%'};return _0x138dae;}})});}_0x4e98de=_[_0x226d('0x39')]({},_0x4e98de,_0x3e68b4[_0x226d('0x3c')]);var _0x1fd869={'where':_0x4e98de['where']};return db['MemberReport'][_0x226d('0x18')](_0x1fd869)[_0x226d('0x22')](function(_0x2ef911){_0x201246[_0x226d('0x18')]=_0x2ef911;if(_0x3e68b4[_0x226d('0x2d')][_0x226d('0x3d')]){_0x4e98de[_0x226d('0x3e')]=[{'all':!![]}];}return db[_0x226d('0x28')][_0x226d('0x3f')](_0x4e98de);})[_0x226d('0x22')](function(_0x4a9215){_0x201246[_0x226d('0x40')]=_0x4a9215;return _0x201246;})[_0x226d('0x22')](respondWithFilteredResult(_0x50747c,_0x4e98de))[_0x226d('0x41')](handleError(_0x50747c,null));};exports[_0x226d('0x42')]=function(_0x7ce15c,_0x1a1385){var _0x4e9b7d={'raw':!![],'where':{'id':_0x7ce15c[_0x226d('0x43')]['id']}},_0x104adf={};_0x104adf['model']=_['keys'](db[_0x226d('0x28')]['rawAttributes']);_0x104adf[_0x226d('0x2d')]=_['keys'](_0x7ce15c[_0x226d('0x2d')]);_0x104adf[_0x226d('0x2e')]=_[_0x226d('0x44')](_0x104adf[_0x226d('0x2c')],_0x104adf[_0x226d('0x2d')]);_0x4e9b7d[_0x226d('0x30')]=_[_0x226d('0x44')](_0x104adf[_0x226d('0x2c')],qs[_0x226d('0x2f')](_0x7ce15c[_0x226d('0x2d')]['fields']));_0x4e9b7d['attributes']=_0x4e9b7d[_0x226d('0x30')][_0x226d('0x31')]?_0x4e9b7d['attributes']:_0x104adf[_0x226d('0x2c')];if(_0x7ce15c[_0x226d('0x2d')][_0x226d('0x3d')]){_0x4e9b7d['include']=[{'all':!![]}];}_0x4e9b7d=_[_0x226d('0x39')]({},_0x4e9b7d,_0x7ce15c['options']);return db['MemberReport'][_0x226d('0x45')](_0x4e9b7d)[_0x226d('0x22')](handleEntityNotFound(_0x1a1385,null))['then'](respondWithResult(_0x1a1385,null))[_0x226d('0x41')](handleError(_0x1a1385,null));};exports['create']=function(_0x409df9,_0x18d73e){return db['MemberReport']['create'](_0x409df9[_0x226d('0x46')],{})[_0x226d('0x22')](respondWithResult(_0x18d73e,0xc9))[_0x226d('0x41')](handleError(_0x18d73e,null));};exports[_0x226d('0x21')]=function(_0xa57497,_0x528e1e){if(_0xa57497['body']['id']){delete _0xa57497[_0x226d('0x46')]['id'];}return db['MemberReport'][_0x226d('0x45')]({'where':{'id':_0xa57497[_0x226d('0x43')]['id']}})[_0x226d('0x22')](handleEntityNotFound(_0x528e1e,null))[_0x226d('0x22')](saveUpdates(_0xa57497[_0x226d('0x46')],null))[_0x226d('0x22')](respondWithResult(_0x528e1e,null))[_0x226d('0x41')](handleError(_0x528e1e,null));};exports[_0x226d('0x47')]=function(_0x213dc3,_0xd7edf1){return db['MemberReport'][_0x226d('0x45')]({'where':{'id':_0x213dc3[_0x226d('0x43')]['id']}})[_0x226d('0x22')](handleEntityNotFound(_0xd7edf1,null))['then'](removeEntity(_0xd7edf1,null))[_0x226d('0x41')](handleError(_0xd7edf1,null));};exports[_0x226d('0x48')]=function(_0x26283d,_0x2dea8e){return db['MemberReport'][_0x226d('0x48')]()[_0x226d('0x22')](respondWithResult(_0x2dea8e,null))['catch'](handleError(_0x2dea8e,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index fe0fa48..1ee6a9a 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 _0x4bc3=['membername','interface','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','membername_interface'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0x4bc3,0x16e));var _0x34bc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4bc3[_0x565ed7];return _0x183ad7;};'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'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x34bc('0xb'),'fields':[_0x34bc('0xc'),_0x34bc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['util','../../config/logger','bluebird','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface','lodash'];(function(_0x140da7,_0x1277f0){var _0x36c218=function(_0x355b7){while(--_0x355b7){_0x140da7['push'](_0x140da7['shift']());}};_0x36c218(++_0x1277f0);}(_0xb458,0x103));var _0x8b45=function(_0x5c9955,_0x23144f){_0x5c9955=_0x5c9955-0x0;var _0x584229=_0xb458[_0x5c9955];return _0x584229;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':_0x8b45('0xb'),'fields':['membername',_0x8b45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b6578d1..c444cb8 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 _0x0030=['info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','model','map','stringify','CreateMemberReport','MemberReport','create','update','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0030,0x12b));var _0x0003=function(_0x4af71d,_0x5bd657){_0x4af71d=_0x4af71d-0x0;var _0x53fd54=_0x0030[_0x4af71d];return _0x53fd54;};'use strict';var _=require(_0x0003('0x0'));var util=require(_0x0003('0x1'));var moment=require(_0x0003('0x2'));var BPromise=require(_0x0003('0x3'));var rs=require(_0x0003('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0003('0x5'))['db'];var utils=require(_0x0003('0x6'));var logger=require(_0x0003('0x7'))('rpc');var config=require(_0x0003('0x8'));var jayson=require(_0x0003('0x9'));var client=jayson[_0x0003('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10dac9,_0x74ad9b,_0x160865){return new BPromise(function(_0x2a498d,_0x21b491){return client[_0x0003('0xb')](_0x10dac9,_0x160865)[_0x0003('0xc')](function(_0x3d0333){logger[_0x0003('0xd')]('MemberReport,\x20%s,\x20%s',_0x74ad9b,_0x0003('0xe'));logger[_0x0003('0xf')](_0x0003('0x10'),_0x74ad9b,_0x0003('0xe'),JSON['stringify'](_0x3d0333));if(_0x3d0333[_0x0003('0x11')]){if(_0x3d0333['error'][_0x0003('0x12')]===0x1f4){logger[_0x0003('0x11')](_0x0003('0x13'),_0x74ad9b,_0x3d0333['error'][_0x0003('0x14')]);return _0x21b491(_0x3d0333[_0x0003('0x11')]['message']);}logger[_0x0003('0x11')](_0x0003('0x13'),_0x74ad9b,_0x3d0333[_0x0003('0x11')][_0x0003('0x14')]);return _0x2a498d(_0x3d0333[_0x0003('0x11')][_0x0003('0x14')]);}else{logger[_0x0003('0xd')]('MemberReport,\x20%s,\x20%s',_0x74ad9b,_0x0003('0xe'));_0x2a498d(_0x3d0333['result'][_0x0003('0x14')]);}})[_0x0003('0x15')](function(_0x1a0153){logger[_0x0003('0x11')](_0x0003('0x13'),_0x74ad9b,_0x1a0153);_0x21b491(_0x1a0153);});});}exports[_0x0003('0x16')]=function(_0x354dd3){var _0xccf2c6=this;return new Promise(function(_0x12588b,_0x4cb87d){return db['MemberReport'][_0x0003('0x17')]({'raw':_0x354dd3['options']?_0x354dd3[_0x0003('0x18')][_0x0003('0x19')]===undefined?!![]:![]:!![],'where':_0x354dd3[_0x0003('0x18')]?_0x354dd3[_0x0003('0x18')][_0x0003('0x1a')]||null:null,'attributes':_0x354dd3[_0x0003('0x18')]?_0x354dd3['options'][_0x0003('0x1b')]||null:null,'limit':_0x354dd3[_0x0003('0x18')]?_0x354dd3[_0x0003('0x18')][_0x0003('0x1c')]||null:null,'include':_0x354dd3[_0x0003('0x18')]?_0x354dd3['options']['include']?_['map'](_0x354dd3['options'][_0x0003('0x1d')],function(_0x4ff4fc){return{'model':db[_0x4ff4fc[_0x0003('0x1e')]],'as':_0x4ff4fc['as'],'attributes':_0x4ff4fc[_0x0003('0x1b')],'include':_0x4ff4fc[_0x0003('0x1d')]?_[_0x0003('0x1f')](_0x4ff4fc[_0x0003('0x1d')],function(_0x50e37b){return{'model':db[_0x50e37b['model']],'as':_0x50e37b['as'],'attributes':_0x50e37b[_0x0003('0x1b')],'include':_0x50e37b[_0x0003('0x1d')]?_['map'](_0x50e37b[_0x0003('0x1d')],function(_0x2e4a6a){return{'model':db[_0x2e4a6a[_0x0003('0x1e')]],'as':_0x2e4a6a['as'],'attributes':_0x2e4a6a[_0x0003('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0003('0xc')](function(_0x28380d){logger['info'](_0x0003('0x16'),_0x354dd3);logger[_0x0003('0xf')](_0x0003('0x16'),_0x354dd3,JSON[_0x0003('0x20')](_0x28380d));_0x12588b(_0x28380d);})[_0x0003('0x15')](function(_0x36995d){logger[_0x0003('0x11')](_0x0003('0x16'),_0x36995d[_0x0003('0x14')],_0x354dd3);_0x4cb87d(_0xccf2c6[_0x0003('0x11')](0x1f4,_0x36995d[_0x0003('0x14')]));});});};exports[_0x0003('0x21')]=function(_0x206c8b){var _0x615e7a=this;return new Promise(function(_0x253d1c,_0x551964){return db[_0x0003('0x22')][_0x0003('0x23')](_0x206c8b['body'],{'raw':_0x206c8b[_0x0003('0x18')]?_0x206c8b[_0x0003('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0003('0xc')](function(_0xaa068){logger['info'](_0x0003('0x21'),_0x206c8b);logger['debug'](_0x0003('0x21'),_0x206c8b,JSON[_0x0003('0x20')](_0xaa068));_0x253d1c(_0xaa068);})[_0x0003('0x15')](function(_0x21e75b){logger[_0x0003('0x11')](_0x0003('0x21'),_0x21e75b[_0x0003('0x14')],_0x206c8b);_0x551964(_0x615e7a[_0x0003('0x11')](0x1f4,_0x21e75b[_0x0003('0x14')]));});});};exports['UpdateMemberReport']=function(_0x3f1892){var _0x3e62d3=this;return new Promise(function(_0x3feddc,_0x23e7a8){return db[_0x0003('0x22')][_0x0003('0x24')](_0x3f1892[_0x0003('0x25')],{'raw':_0x3f1892[_0x0003('0x18')]?_0x3f1892[_0x0003('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f1892[_0x0003('0x18')]?_0x3f1892[_0x0003('0x18')][_0x0003('0x1a')]||null:null,'attributes':_0x3f1892[_0x0003('0x18')]?_0x3f1892[_0x0003('0x18')][_0x0003('0x1b')]||null:null,'limit':_0x3f1892[_0x0003('0x18')]?_0x3f1892[_0x0003('0x18')][_0x0003('0x1c')]||null:null})[_0x0003('0xc')](function(_0x5759c1){logger[_0x0003('0xd')](_0x0003('0x26'),_0x3f1892);logger[_0x0003('0xf')](_0x0003('0x26'),_0x3f1892,JSON[_0x0003('0x20')](_0x5759c1));_0x3feddc(_0x5759c1);})[_0x0003('0x15')](function(_0x3d4148){logger[_0x0003('0x11')](_0x0003('0x26'),_0x3d4148[_0x0003('0x14')],_0x3f1892);_0x23e7a8(_0x3e62d3[_0x0003('0x11')](0x1f4,_0x3d4148[_0x0003('0x14')]));});});}; \ No newline at end of file +var _0x4532=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','create','UpdateMemberReport','lodash','util'];(function(_0x3369e9,_0x78d2be){var _0x39ed71=function(_0xbee0c8){while(--_0xbee0c8){_0x3369e9['push'](_0x3369e9['shift']());}};_0x39ed71(++_0x78d2be);}(_0x4532,0xfa));var _0x2453=function(_0x3e82fb,_0x30bb6f){_0x3e82fb=_0x3e82fb-0x0;var _0x2f5208=_0x4532[_0x3e82fb];return _0x2f5208;};'use strict';var _=require(_0x2453('0x0'));var util=require(_0x2453('0x1'));var moment=require(_0x2453('0x2'));var BPromise=require(_0x2453('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2453('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2453('0x5'));var logger=require(_0x2453('0x6'))(_0x2453('0x7'));var config=require('../../config/environment');var jayson=require(_0x2453('0x8'));var client=jayson['client'][_0x2453('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x253d73,_0x300a0f,_0xd3c321){return new BPromise(function(_0x131672,_0x554741){return client[_0x2453('0xa')](_0x253d73,_0xd3c321)[_0x2453('0xb')](function(_0x12d860){logger[_0x2453('0xc')](_0x2453('0xd'),_0x300a0f,'request\x20sent');logger[_0x2453('0xe')](_0x2453('0xf'),_0x300a0f,_0x2453('0x10'),JSON['stringify'](_0x12d860));if(_0x12d860[_0x2453('0x11')]){if(_0x12d860[_0x2453('0x11')][_0x2453('0x12')]===0x1f4){logger[_0x2453('0x11')](_0x2453('0xd'),_0x300a0f,_0x12d860[_0x2453('0x11')][_0x2453('0x13')]);return _0x554741(_0x12d860[_0x2453('0x11')][_0x2453('0x13')]);}logger[_0x2453('0x11')]('MemberReport,\x20%s,\x20%s',_0x300a0f,_0x12d860[_0x2453('0x11')][_0x2453('0x13')]);return _0x131672(_0x12d860[_0x2453('0x11')][_0x2453('0x13')]);}else{logger[_0x2453('0xc')](_0x2453('0xd'),_0x300a0f,_0x2453('0x10'));_0x131672(_0x12d860[_0x2453('0x14')][_0x2453('0x13')]);}})[_0x2453('0x15')](function(_0x4e3b63){logger['error'](_0x2453('0xd'),_0x300a0f,_0x4e3b63);_0x554741(_0x4e3b63);});});}exports[_0x2453('0x16')]=function(_0x3b8e3e){var _0x4c5c96=this;return new Promise(function(_0x2fefe4,_0x24143d){return db[_0x2453('0x17')]['findAll']({'raw':_0x3b8e3e['options']?_0x3b8e3e[_0x2453('0x18')][_0x2453('0x19')]===undefined?!![]:![]:!![],'where':_0x3b8e3e['options']?_0x3b8e3e[_0x2453('0x18')][_0x2453('0x1a')]||null:null,'attributes':_0x3b8e3e[_0x2453('0x18')]?_0x3b8e3e[_0x2453('0x18')][_0x2453('0x1b')]||null:null,'limit':_0x3b8e3e[_0x2453('0x18')]?_0x3b8e3e[_0x2453('0x18')][_0x2453('0x1c')]||null:null,'include':_0x3b8e3e[_0x2453('0x18')]?_0x3b8e3e[_0x2453('0x18')][_0x2453('0x1d')]?_[_0x2453('0x1e')](_0x3b8e3e[_0x2453('0x18')][_0x2453('0x1d')],function(_0x15bf91){return{'model':db[_0x15bf91[_0x2453('0x1f')]],'as':_0x15bf91['as'],'attributes':_0x15bf91[_0x2453('0x1b')],'include':_0x15bf91[_0x2453('0x1d')]?_[_0x2453('0x1e')](_0x15bf91[_0x2453('0x1d')],function(_0x3304c8){return{'model':db[_0x3304c8[_0x2453('0x1f')]],'as':_0x3304c8['as'],'attributes':_0x3304c8[_0x2453('0x1b')],'include':_0x3304c8[_0x2453('0x1d')]?_[_0x2453('0x1e')](_0x3304c8['include'],function(_0x2af30e){return{'model':db[_0x2af30e[_0x2453('0x1f')]],'as':_0x2af30e['as'],'attributes':_0x2af30e[_0x2453('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b8fca){logger[_0x2453('0xc')](_0x2453('0x16'),_0x3b8e3e);logger[_0x2453('0xe')](_0x2453('0x16'),_0x3b8e3e,JSON[_0x2453('0x20')](_0x5b8fca));_0x2fefe4(_0x5b8fca);})[_0x2453('0x15')](function(_0x541209){logger[_0x2453('0x11')]('GetMemberReport',_0x541209['message'],_0x3b8e3e);_0x24143d(_0x4c5c96[_0x2453('0x11')](0x1f4,_0x541209[_0x2453('0x13')]));});});};exports[_0x2453('0x21')]=function(_0x17f191){var _0x27f3c8=this;return new Promise(function(_0x508eb9,_0xea7faa){return db[_0x2453('0x17')][_0x2453('0x22')](_0x17f191['body'],{'raw':_0x17f191[_0x2453('0x18')]?_0x17f191['options']['raw']===undefined?!![]:![]:!![]})[_0x2453('0xb')](function(_0x19a8a7){logger[_0x2453('0xc')]('CreateMemberReport',_0x17f191);logger[_0x2453('0xe')](_0x2453('0x21'),_0x17f191,JSON[_0x2453('0x20')](_0x19a8a7));_0x508eb9(_0x19a8a7);})[_0x2453('0x15')](function(_0x3bbdf7){logger['error'](_0x2453('0x21'),_0x3bbdf7['message'],_0x17f191);_0xea7faa(_0x27f3c8[_0x2453('0x11')](0x1f4,_0x3bbdf7[_0x2453('0x13')]));});});};exports['UpdateMemberReport']=function(_0x1566c1){var _0x49092f=this;return new Promise(function(_0xda8c70,_0x2b2a52){return db['MemberReport']['update'](_0x1566c1['body'],{'raw':_0x1566c1['options']?_0x1566c1[_0x2453('0x18')][_0x2453('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1566c1[_0x2453('0x18')]?_0x1566c1[_0x2453('0x18')][_0x2453('0x1a')]||null:null,'attributes':_0x1566c1[_0x2453('0x18')]?_0x1566c1[_0x2453('0x18')]['attributes']||null:null,'limit':_0x1566c1['options']?_0x1566c1['options'][_0x2453('0x1c')]||null:null})[_0x2453('0xb')](function(_0x3f8193){logger[_0x2453('0xc')](_0x2453('0x23'),_0x1566c1);logger[_0x2453('0xe')](_0x2453('0x23'),_0x1566c1,JSON[_0x2453('0x20')](_0x3f8193));_0xda8c70(_0x3f8193);})['catch'](function(_0x1cd7ee){logger['error'](_0x2453('0x23'),_0x1cd7ee[_0x2453('0x13')],_0x1566c1);_0x2b2a52(_0x49092f[_0x2453('0x11')](0x1f4,_0x1cd7ee[_0x2453('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 606d10c..4d73a0f 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 _0x4024=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./migration.controller'];(function(_0x1d1fa0,_0x37ebcd){var _0x2dc2c7=function(_0x594e7b){while(--_0x594e7b){_0x1d1fa0['push'](_0x1d1fa0['shift']());}};_0x2dc2c7(++_0x37ebcd);}(_0x4024,0x89));var _0x4402=function(_0x41c43a,_0x4ccaf4){_0x41c43a=_0x41c43a-0x0;var _0x50c6f8=_0x4024[_0x41c43a];return _0x50c6f8;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',controller['index']);module[_0x4402('0x7')]=router; \ No newline at end of file +var _0x9348=['../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9348,0x10d));var _0x8934=function(_0x3ab0f3,_0x3a890b){_0x3ab0f3=_0x3ab0f3-0x0;var _0x1f4232=_0x9348[_0x3ab0f3];return _0x1f4232;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var auth=require(_0x8934('0x5'));var interaction=require(_0x8934('0x6'));var config=require('../../config/environment');var controller=require(_0x8934('0x7'));router[_0x8934('0x8')]('/',controller[_0x8934('0x9')]);module[_0x8934('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7374e5d..b20f9f7 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 _0xece4=['version','STRING'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0xece4,0x1c3));var _0x4ece=function(_0x427adf,_0x3fdb99){_0x427adf=_0x427adf-0x0;var _0x1aa50b=_0xece4[_0x427adf];return _0x1aa50b;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x4ece('0x0')],'unique':_0x4ece('0x1')}}; \ No newline at end of file +var _0x0de0=['sequelize','STRING','version'];(function(_0x92589b,_0x39fae3){var _0x27e5a9=function(_0x26ffcc){while(--_0x26ffcc){_0x92589b['push'](_0x92589b['shift']());}};_0x27e5a9(++_0x39fae3);}(_0x0de0,0x13b));var _0x00de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x00de('0x0'));module['exports']={'version':{'type':Sequelize[_0x00de('0x1')],'unique':_0x00de('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9a818c4..5e411c1 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 _0xf3cd=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','Migration','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x67ca4d,_0x17a135){var _0x184c92=function(_0x3c59d9){while(--_0x3c59d9){_0x67ca4d['push'](_0x67ca4d['shift']());}};_0x184c92(++_0x17a135);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xff8595,_0x39341d){_0xff8595=_0xff8595-0x0;var _0x31e49e=_0xf3cd[_0xff8595];return _0x31e49e;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var db=require(_0xdf3c('0x19'))['db'];function respondWithStatusCode(_0x5e8925,_0x1d483c){_0x1d483c=_0x1d483c||0xcc;return function(_0x166ae5){if(_0x166ae5){return _0x5e8925[_0xdf3c('0x1a')](_0x1d483c);}return _0x5e8925[_0xdf3c('0x1b')](_0x1d483c)['end']();};}function respondWithResult(_0x2ae4ad,_0x461079){_0x461079=_0x461079||0xc8;return function(_0x13ea5f){if(_0x13ea5f){return _0x2ae4ad['status'](_0x461079)[_0xdf3c('0x1c')](_0x13ea5f);}};}function respondWithFilteredResult(_0x38b01d,_0x173041){return function(_0x4274fd){if(_0x4274fd){var _0x21e587=_0x4274fd[_0xdf3c('0x1d')],_0x1a7a5a=_0x173041[_0xdf3c('0x1e')],_0x305ea5=_0x173041['offset']+_0x173041[_0xdf3c('0x1f')],_0x92008b;if(_0x305ea5>=_0x21e587){_0x305ea5=_0x21e587;_0x92008b=0xc8;}else{_0x92008b=0xce;}_0x38b01d[_0xdf3c('0x1b')](_0x92008b);return _0x38b01d[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x1a7a5a+'-'+_0x305ea5+'/'+_0x21e587)[_0xdf3c('0x1c')](_0x4274fd);}return null;};}function patchUpdates(_0x113b56){return function(_0x16b02b){try{jsonpatch[_0xdf3c('0x22')](_0x16b02b,_0x113b56,!![]);}catch(_0x426f3a){return BPromise[_0xdf3c('0x23')](_0x426f3a);}return _0x16b02b[_0xdf3c('0x24')]();};}function saveUpdates(_0x3d14cc,_0x25487c){return function(_0x5d2390){if(_0x5d2390){return _0x5d2390['update'](_0x3d14cc)[_0xdf3c('0x25')](function(_0x583ce4){return _0x583ce4;});}return null;};}function removeEntity(_0x15776c,_0x40e7ec){return function(_0x36552e){if(_0x36552e){return _0x36552e[_0xdf3c('0x26')]()[_0xdf3c('0x25')](function(){_0x15776c[_0xdf3c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a164,_0x213d75){return function(_0x13e3ca){if(!_0x13e3ca){_0x22a164[_0xdf3c('0x1a')](0x194);}return _0x13e3ca;};}function handleError(_0x40032a,_0x3b5371){_0x3b5371=_0x3b5371||0x1f4;return function(_0xef54cb){logger[_0xdf3c('0x27')](_0xef54cb[_0xdf3c('0x28')]);if(_0xef54cb[_0xdf3c('0x29')]){delete _0xef54cb['name'];}_0x40032a[_0xdf3c('0x1b')](_0x3b5371)[_0xdf3c('0x2a')](_0xef54cb);};}exports['index']=function(_0xdc8962,_0x59659e){var _0x4eaced={},_0x508be9={},_0x14aac9={'count':0x0,'rows':[]};var _0x186bba=_['map'](db['Migration'][_0xdf3c('0x2b')],function(_0x1f2ce4){return{'name':_0x1f2ce4[_0xdf3c('0x2c')],'type':_0x1f2ce4[_0xdf3c('0x2d')]['key']};});_0x508be9[_0xdf3c('0x2e')]=_[_0xdf3c('0x2f')](_0x186bba,'name');_0x508be9['query']=_[_0xdf3c('0x30')](_0xdc8962[_0xdf3c('0x31')]);_0x508be9[_0xdf3c('0x32')]=_['intersection'](_0x508be9[_0xdf3c('0x2e')],_0x508be9[_0xdf3c('0x31')]);_0x4eaced[_0xdf3c('0x33')]=_[_0xdf3c('0x34')](_0x508be9['model'],qs[_0xdf3c('0x35')](_0xdc8962[_0xdf3c('0x31')]['fields']));_0x4eaced[_0xdf3c('0x33')]=_0x4eaced[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x4eaced[_0xdf3c('0x33')]:_0x508be9['model'];if(!_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x37')](_0xdf3c('0x38'))){_0x4eaced[_0xdf3c('0x1f')]=qs['limit'](_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x1f')]);_0x4eaced['offset']=qs['offset'](_0xdc8962[_0xdf3c('0x31')]['offset']);}_0x4eaced[_0xdf3c('0x39')]=qs['sort'](_0xdc8962['query']['sort']);_0x4eaced[_0xdf3c('0x3a')]=qs[_0xdf3c('0x32')](_[_0xdf3c('0x3b')](_0xdc8962[_0xdf3c('0x31')],_0x508be9['filters']),_0x186bba);if(_0xdc8962['query'][_0xdf3c('0x3c')]){_0x4eaced['where']=_[_0xdf3c('0x3d')](_0x4eaced[_0xdf3c('0x3a')],{'$or':_[_0xdf3c('0x2f')](_0x186bba,function(_0xcdd731){if(_0xcdd731[_0xdf3c('0x2d')]!==_0xdf3c('0x3e')){var _0x1c7335={};_0x1c7335[_0xcdd731[_0xdf3c('0x29')]]={'$like':'%'+_0xdc8962[_0xdf3c('0x31')]['filter']+'%'};return _0x1c7335;}})});}_0x4eaced=_[_0xdf3c('0x3d')]({},_0x4eaced,_0xdc8962['options']);var _0x5c1471={'where':_0x4eaced[_0xdf3c('0x3a')]};return db['Migration'][_0xdf3c('0x1d')](_0x5c1471)['then'](function(_0x2a94c3){_0x14aac9[_0xdf3c('0x1d')]=_0x2a94c3;if(_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x3f')]){_0x4eaced[_0xdf3c('0x40')]=[{'all':!![]}];}return db[_0xdf3c('0x41')][_0xdf3c('0x42')](_0x4eaced);})[_0xdf3c('0x25')](function(_0x3cf131){_0x14aac9[_0xdf3c('0x43')]=_0x3cf131;return _0x14aac9;})[_0xdf3c('0x25')](respondWithFilteredResult(_0x59659e,_0x4eaced))[_0xdf3c('0x44')](handleError(_0x59659e,null));}; \ No newline at end of file +var _0x00bb=['html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','error','stack','map','Migration','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){_0x56c189['status'](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(!_0x3ab3cc){_0x2896d1[_0xb00b('0x14')](0x194);}return _0x3ab3cc;};}function handleError(_0x5568bb,_0x44efe5){_0x44efe5=_0x44efe5||0x1f4;return function(_0x243fdb){logger[_0xb00b('0x1f')](_0x243fdb[_0xb00b('0x20')]);if(_0x243fdb['name']){delete _0x243fdb['name'];}_0x5568bb[_0xb00b('0x15')](_0x44efe5)['send'](_0x243fdb);};}exports['index']=function(_0x4a635e,_0x16ac55){var _0x73b6b0={},_0x2592cf={},_0x3825af={'count':0x0,'rows':[]};var _0x1f14fa=_[_0xb00b('0x21')](db[_0xb00b('0x22')]['rawAttributes'],function(_0x22c22d){return{'name':_0x22c22d['fieldName'],'type':_0x22c22d[_0xb00b('0x23')][_0xb00b('0x24')]};});_0x2592cf[_0xb00b('0x25')]=_['map'](_0x1f14fa,_0xb00b('0x26'));_0x2592cf[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x4a635e[_0xb00b('0x27')]);_0x2592cf[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_0x2592cf[_0xb00b('0x25')],_0x2592cf[_0xb00b('0x27')]);_0x73b6b0[_0xb00b('0x2b')]=_['intersection'](_0x2592cf[_0xb00b('0x25')],qs[_0xb00b('0x2c')](_0x4a635e['query'][_0xb00b('0x2c')]));_0x73b6b0[_0xb00b('0x2b')]=_0x73b6b0['attributes'][_0xb00b('0x2d')]?_0x73b6b0['attributes']:_0x2592cf[_0xb00b('0x25')];if(!_0x4a635e[_0xb00b('0x27')][_0xb00b('0x2e')](_0xb00b('0x2f'))){_0x73b6b0[_0xb00b('0x30')]=qs[_0xb00b('0x30')](_0x4a635e[_0xb00b('0x27')]['limit']);_0x73b6b0['offset']=qs['offset'](_0x4a635e[_0xb00b('0x27')][_0xb00b('0x19')]);}_0x73b6b0[_0xb00b('0x31')]=qs[_0xb00b('0x32')](_0x4a635e['query'][_0xb00b('0x32')]);_0x73b6b0[_0xb00b('0x33')]=qs[_0xb00b('0x29')](_[_0xb00b('0x34')](_0x4a635e[_0xb00b('0x27')],_0x2592cf[_0xb00b('0x29')]),_0x1f14fa);if(_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]){_0x73b6b0['where']=_['merge'](_0x73b6b0[_0xb00b('0x33')],{'$or':_['map'](_0x1f14fa,function(_0x1c8258){if(_0x1c8258[_0xb00b('0x23')]!==_0xb00b('0x36')){var _0x45ca74={};_0x45ca74[_0x1c8258[_0xb00b('0x26')]]={'$like':'%'+_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]+'%'};return _0x45ca74;}})});}_0x73b6b0=_['merge']({},_0x73b6b0,_0x4a635e[_0xb00b('0x37')]);var _0x25578e={'where':_0x73b6b0[_0xb00b('0x33')]};return db[_0xb00b('0x22')][_0xb00b('0x18')](_0x25578e)[_0xb00b('0x1d')](function(_0x59fb00){_0x3825af[_0xb00b('0x18')]=_0x59fb00;if(_0x4a635e[_0xb00b('0x27')]['includeAll']){_0x73b6b0[_0xb00b('0x38')]=[{'all':!![]}];}return db[_0xb00b('0x22')][_0xb00b('0x39')](_0x73b6b0);})[_0xb00b('0x1d')](function(_0x2954e8){_0x3825af['rows']=_0x2954e8;return _0x3825af;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x16ac55,_0x73b6b0))[_0xb00b('0x3a')](handleError(_0x16ac55,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 62c49b7..0cfb24f 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 _0x6732=['define','Migration','migrations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2673('0x0'));var util=require(_0x2673('0x1'));var logger=require(_0x2673('0x2'))(_0x2673('0x3'));var moment=require('moment');var BPromise=require(_0x2673('0x4'));var rp=require(_0x2673('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2673('0x6'));var config=require(_0x2673('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x90d6e5,_0x2ec408){return _0x90d6e5[_0x2673('0x8')](_0x2673('0x9'),attributes,{'tableName':_0x2673('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define','migrations','lodash','../../config/logger','api'];(function(_0x3dac18,_0x4040a2){var _0x179bb8=function(_0x267c3c){while(--_0x267c3c){_0x3dac18['push'](_0x3dac18['shift']());}};_0x179bb8(++_0x4040a2);}(_0x83d3,0x159));var _0x383d=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x83d3[_0x5093e9];return _0x4c9a22;};'use strict';var _=require(_0x383d('0x0'));var util=require('util');var logger=require(_0x383d('0x1'))(_0x383d('0x2'));var moment=require(_0x383d('0x3'));var BPromise=require(_0x383d('0x4'));var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require('rimraf');var config=require(_0x383d('0x7'));var attributes=require(_0x383d('0x8'));module[_0x383d('0x9')]=function(_0x2e8c09,_0x34b12c){return _0x2e8c09[_0x383d('0xa')]('Migration',attributes,{'tableName':_0x383d('0xb'),'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 be37e33..3a3c888 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 _0x4a41=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','result','catch'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4a41,0x1b8));var _0x14a4=function(_0x524ef1,_0x1ad9df){_0x524ef1=_0x524ef1-0x0;var _0xed988=_0x4a41[_0x524ef1];return _0xed988;};'use strict';var _=require(_0x14a4('0x0'));var util=require(_0x14a4('0x1'));var moment=require(_0x14a4('0x2'));var BPromise=require(_0x14a4('0x3'));var rs=require(_0x14a4('0x4'));var fs=require('fs');var Redis=require(_0x14a4('0x5'));var db=require(_0x14a4('0x6'))['db'];var utils=require(_0x14a4('0x7'));var logger=require(_0x14a4('0x8'))(_0x14a4('0x9'));var config=require('../../config/environment');var jayson=require(_0x14a4('0xa'));var client=jayson['client'][_0x14a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aa79b,_0x5e5e33,_0x339b8a){return new BPromise(function(_0x23f6b6,_0x4c3eb2){return client['request'](_0x3aa79b,_0x339b8a)[_0x14a4('0xc')](function(_0x145e68){logger[_0x14a4('0xd')]('Migration,\x20%s,\x20%s',_0x5e5e33,_0x14a4('0xe'));logger['debug'](_0x14a4('0xf'),_0x5e5e33,_0x14a4('0xe'),JSON['stringify'](_0x145e68));if(_0x145e68['error']){if(_0x145e68[_0x14a4('0x10')][_0x14a4('0x11')]===0x1f4){logger[_0x14a4('0x10')]('Migration,\x20%s,\x20%s',_0x5e5e33,_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);return _0x4c3eb2(_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);}logger[_0x14a4('0x10')](_0x14a4('0x13'),_0x5e5e33,_0x145e68['error'][_0x14a4('0x12')]);return _0x23f6b6(_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);}else{logger[_0x14a4('0xd')](_0x14a4('0x13'),_0x5e5e33,_0x14a4('0xe'));_0x23f6b6(_0x145e68[_0x14a4('0x14')][_0x14a4('0x12')]);}})[_0x14a4('0x15')](function(_0x194af9){logger[_0x14a4('0x10')](_0x14a4('0x13'),_0x5e5e33,_0x194af9);_0x4c3eb2(_0x194af9);});});} \ No newline at end of file +var _0xc97a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38cb44,_0x2cfb6a){var _0x2d08ab=function(_0xd5dfcd){while(--_0xd5dfcd){_0x38cb44['push'](_0x38cb44['shift']());}};_0x2d08ab(++_0x2cfb6a);}(_0xc97a,0x1d9));var _0xac97=function(_0x2f3c67,_0x3afd02){_0x2f3c67=_0x2f3c67-0x0;var _0x7481dd=_0xc97a[_0x2f3c67];return _0x7481dd;};'use strict';var _=require(_0xac97('0x0'));var util=require(_0xac97('0x1'));var moment=require(_0xac97('0x2'));var BPromise=require('bluebird');var rs=require(_0xac97('0x3'));var fs=require('fs');var Redis=require(_0xac97('0x4'));var db=require(_0xac97('0x5'))['db'];var utils=require(_0xac97('0x6'));var logger=require(_0xac97('0x7'))('rpc');var config=require(_0xac97('0x8'));var jayson=require(_0xac97('0x9'));var client=jayson[_0xac97('0xa')][_0xac97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbbf070,_0x5758c5,_0xb4a18d){return new BPromise(function(_0x3587f5,_0x3266f1){return client[_0xac97('0xc')](_0xbbf070,_0xb4a18d)[_0xac97('0xd')](function(_0x18bc3e){logger['info'](_0xac97('0xe'),_0x5758c5,_0xac97('0xf'));logger[_0xac97('0x10')](_0xac97('0x11'),_0x5758c5,_0xac97('0xf'),JSON[_0xac97('0x12')](_0x18bc3e));if(_0x18bc3e[_0xac97('0x13')]){if(_0x18bc3e[_0xac97('0x13')][_0xac97('0x14')]===0x1f4){logger[_0xac97('0x13')]('Migration,\x20%s,\x20%s',_0x5758c5,_0x18bc3e[_0xac97('0x13')][_0xac97('0x15')]);return _0x3266f1(_0x18bc3e[_0xac97('0x13')]['message']);}logger[_0xac97('0x13')](_0xac97('0xe'),_0x5758c5,_0x18bc3e['error'][_0xac97('0x15')]);return _0x3587f5(_0x18bc3e['error'][_0xac97('0x15')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x5758c5,_0xac97('0xf'));_0x3587f5(_0x18bc3e[_0xac97('0x16')][_0xac97('0x15')]);}})[_0xac97('0x17')](function(_0x32e1ea){logger[_0xac97('0x13')]('Migration,\x20%s,\x20%s',_0x5758c5,_0x32e1ea);_0x3266f1(_0x32e1ea);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f096fb0..9ca0f52 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 _0xd7ca=['show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x28e262,_0x53a917){var _0x404ec4=function(_0x296459){while(--_0x296459){_0x28e262['push'](_0x28e262['shift']());}};_0x404ec4(++_0x53a917);}(_0xd7ca,0xfd));var _0xad7c=function(_0x27de72,_0x58fbf9){_0x27de72=_0x27de72-0x0;var _0x23c312=_0xd7ca[_0x27de72];return _0x23c312;};'use strict';var multer=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var path=require(_0xad7c('0x2'));var timeout=require(_0xad7c('0x3'));var express=require(_0xad7c('0x4'));var router=express[_0xad7c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xad7c('0x6'));var config=require(_0xad7c('0x7'));var controller=require(_0xad7c('0x8'));router[_0xad7c('0x9')]('/',auth[_0xad7c('0xa')](),controller[_0xad7c('0xb')]);router[_0xad7c('0x9')](_0xad7c('0xc'),auth[_0xad7c('0xa')](),controller[_0xad7c('0xd')]);router['post']('/',auth[_0xad7c('0xa')](),controller[_0xad7c('0xe')]);router[_0xad7c('0xf')](_0xad7c('0xc'),auth[_0xad7c('0xa')](),controller[_0xad7c('0x10')]);router['delete'](_0xad7c('0xc'),auth['isAuthenticated'](),controller[_0xad7c('0x11')]);module[_0xad7c('0x12')]=router; \ No newline at end of file +var _0x4b66=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5579d1,_0x13d147){var _0x505828=function(_0xcaf7c2){while(--_0xcaf7c2){_0x5579d1['push'](_0x5579d1['shift']());}};_0x505828(++_0x13d147);}(_0x4b66,0x1dc));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x64b6('0x0'));var util=require(_0x64b6('0x1'));var path=require(_0x64b6('0x2'));var timeout=require(_0x64b6('0x3'));var express=require(_0x64b6('0x4'));var router=express[_0x64b6('0x5')]();var auth=require(_0x64b6('0x6'));var interaction=require(_0x64b6('0x7'));var config=require(_0x64b6('0x8'));var controller=require(_0x64b6('0x9'));router[_0x64b6('0xa')]('/',auth[_0x64b6('0xb')](),controller[_0x64b6('0xc')]);router[_0x64b6('0xa')](_0x64b6('0xd'),auth['isAuthenticated'](),controller[_0x64b6('0xe')]);router[_0x64b6('0xf')]('/',auth[_0x64b6('0xb')](),controller[_0x64b6('0x10')]);router['put'](_0x64b6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x64b6('0x11')](_0x64b6('0xd'),auth[_0x64b6('0xb')](),controller[_0x64b6('0x12')]);module[_0x64b6('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2242ee3..8baf021 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(_0x5e4346,_0x52d04a){var _0x8624ec=function(_0x3d1d17){while(--_0x3d1d17){_0x5e4346['push'](_0x5e4346['shift']());}};_0x8624ec(++_0x52d04a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5cfdb0,_0x54d262){var _0x4a9bf3=function(_0x17220a){while(--_0x17220a){_0x5cfdb0['push'](_0x5cfdb0['shift']());}};_0x4a9bf3(++_0x54d262);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 8148682..b28d50d 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 _0xb575=['Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','includeAll','include','Network','findAll','rows','params','keys','length','options','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN','server/files/templates/stun_multiple.ejs','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','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~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','debug'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb575,0xb6));var _0x5b57=function(_0x1cacb2,_0x54a397){_0x1cacb2=_0x1cacb2-0x0;var _0x2f7992=_0xb575[_0x1cacb2];return _0x2f7992;};'use strict';var pdf=require(_0x5b57('0x0'));var emlformat=require(_0x5b57('0x1'));var rimraf=require(_0x5b57('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b57('0x3'));var rp=require(_0x5b57('0x4'));var moment=require(_0x5b57('0x5'));var BPromise=require(_0x5b57('0x6'));var Mustache=require(_0x5b57('0x7'));var util=require(_0x5b57('0x8'));var path=require(_0x5b57('0x9'));var sox=require(_0x5b57('0xa'));var csv=require(_0x5b57('0xb'));var ejs=require(_0x5b57('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5b57('0xd'));var jsforce=require(_0x5b57('0xe'));var deskjs=require(_0x5b57('0xf'));var toCsv=require(_0x5b57('0xb'));var querystring=require(_0x5b57('0x10'));var Papa=require(_0x5b57('0x11'));var Redis=require(_0x5b57('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5b57('0x13'));var hardwareService=require(_0x5b57('0x14'));var logger=require('../../config/logger')(_0x5b57('0x15'));var utils=require('../../config/utils');var config=require(_0x5b57('0x16'));var db=require(_0x5b57('0x17'))['db'];var jayson=require(_0x5b57('0x18'));var client=jayson['client'][_0x5b57('0x19')]({'port':0x232a});function checkPasswordPattern(_0x999cb6,_0x32cab5,_0x27bd1b){if(_0x27bd1b){var _0x5230dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5230dc[_0x5b57('0x1a')](_0x32cab5)){return _0x999cb6;}else{throw new db['Sequelize']['ValidationError'](_0x5b57('0x1b'));}}else{return _0x999cb6;}}function respondWithRpcPromise(_0x3f1c75,_0x2eaf58,_0x5a40b8,_0x24487c){return new BPromise(function(_0x54fc6c,_0x43b462){var _0x504efc=_0x24487c||client;return _0x504efc['request'](_0x3f1c75,_0x5a40b8)[_0x5b57('0x1c')](function(_0x2ddbbc){logger[_0x5b57('0x1d')](_0x5b57('0x1e'),_0x2eaf58,'request\x20sent');logger[_0x5b57('0x1f')](_0x5b57('0x20'),_0x2eaf58,_0x5b57('0x21'),JSON[_0x5b57('0x22')](_0x2ddbbc));if(_0x2ddbbc['error']){if(_0x2ddbbc[_0x5b57('0x23')][_0x5b57('0x24')]===0x1f4){logger[_0x5b57('0x23')](_0x5b57('0x1e'),_0x2eaf58,_0x2ddbbc[_0x5b57('0x23')][_0x5b57('0x25')]);return _0x43b462(_0x2ddbbc[_0x5b57('0x23')][_0x5b57('0x25')]);}logger[_0x5b57('0x23')](_0x5b57('0x1e'),_0x2eaf58,_0x2ddbbc[_0x5b57('0x23')][_0x5b57('0x25')]);return _0x54fc6c(_0x2ddbbc[_0x5b57('0x23')]['message']);}else{logger[_0x5b57('0x1d')](_0x5b57('0x1e'),_0x2eaf58,_0x5b57('0x21'));_0x54fc6c(_0x2ddbbc[_0x5b57('0x26')][_0x5b57('0x25')]);}})[_0x5b57('0x27')](function(_0x455a05){logger[_0x5b57('0x23')](_0x5b57('0x1e'),_0x2eaf58,_0x455a05);_0x43b462(_0x455a05);});});}function respondWithStatusCode(_0x52910c,_0x402595){_0x402595=_0x402595||0xcc;return function(_0x577688){if(_0x577688){return _0x52910c[_0x5b57('0x28')](_0x402595);}return _0x52910c['status'](_0x402595)[_0x5b57('0x29')]();};}function respondWithResult(_0x3b455,_0x12b807){_0x12b807=_0x12b807||0xc8;return function(_0x4f5196){if(_0x4f5196){return _0x3b455[_0x5b57('0x2a')](_0x12b807)[_0x5b57('0x2b')](_0x4f5196);}};}function respondWithFilteredResult(_0x464da6,_0x3900ac){return function(_0x1682eb){if(_0x1682eb){var _0x5b4f8c=_0x1682eb[_0x5b57('0x2c')],_0x4639d1=_0x3900ac[_0x5b57('0x2d')],_0x2d6266=_0x3900ac[_0x5b57('0x2d')]+_0x3900ac[_0x5b57('0x2e')],_0x346557;if(_0x2d6266>=_0x5b4f8c){_0x2d6266=_0x5b4f8c;_0x346557=0xc8;}else{_0x346557=0xce;}_0x464da6[_0x5b57('0x2a')](_0x346557);return _0x464da6[_0x5b57('0x2f')](_0x5b57('0x30'),_0x4639d1+'-'+_0x2d6266+'/'+_0x5b4f8c)[_0x5b57('0x2b')](_0x1682eb);}return null;};}function patchUpdates(_0x3caca6){return function(_0x144061){try{jsonpatch['apply'](_0x144061,_0x3caca6,!![]);}catch(_0x5212d0){return BPromise[_0x5b57('0x31')](_0x5212d0);}return _0x144061[_0x5b57('0x32')]();};}function saveUpdates(_0x2c922f,_0x262e55){return function(_0x3802c5){if(_0x3802c5){return _0x3802c5['update'](_0x2c922f)['then'](function(_0x2d30fd){return _0x2d30fd;});}return null;};}function removeEntity(_0x149beb,_0x210167){return function(_0x263d4a){if(_0x263d4a){return _0x263d4a[_0x5b57('0x33')]()[_0x5b57('0x1c')](function(){_0x149beb[_0x5b57('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c66a9,_0x24ebcc){return function(_0x35857e){if(!_0x35857e){_0x2c66a9['sendStatus'](0x194);}return _0x35857e;};}function handleError(_0xf3adb9,_0x486ae7){_0x486ae7=_0x486ae7||0x1f4;return function(_0x1b2730){logger[_0x5b57('0x23')](_0x1b2730['stack']);if(_0x1b2730[_0x5b57('0x34')]){delete _0x1b2730[_0x5b57('0x34')];}_0xf3adb9[_0x5b57('0x2a')](_0x486ae7)[_0x5b57('0x35')](_0x1b2730);};}exports['index']=function(_0x35b4d3,_0x5136c3){var _0x306533={},_0x17d23b={},_0x5ef469={'count':0x0,'rows':[]};var _0x17a8a4=_[_0x5b57('0x36')](db['Network'][_0x5b57('0x37')],function(_0xed849a){return{'name':_0xed849a[_0x5b57('0x38')],'type':_0xed849a[_0x5b57('0x39')][_0x5b57('0x3a')]};});_0x17d23b[_0x5b57('0x3b')]=_[_0x5b57('0x36')](_0x17a8a4,_0x5b57('0x34'));_0x17d23b['query']=_['keys'](_0x35b4d3[_0x5b57('0x3c')]);_0x17d23b[_0x5b57('0x3d')]=_['intersection'](_0x17d23b[_0x5b57('0x3b')],_0x17d23b[_0x5b57('0x3c')]);_0x306533['attributes']=_[_0x5b57('0x3e')](_0x17d23b[_0x5b57('0x3b')],qs['fields'](_0x35b4d3[_0x5b57('0x3c')][_0x5b57('0x3f')]));_0x306533[_0x5b57('0x40')]=_0x306533[_0x5b57('0x40')]['length']?_0x306533[_0x5b57('0x40')]:_0x17d23b[_0x5b57('0x3b')];if(!_0x35b4d3[_0x5b57('0x3c')][_0x5b57('0x41')](_0x5b57('0x42'))){_0x306533['limit']=qs[_0x5b57('0x2e')](_0x35b4d3[_0x5b57('0x3c')]['limit']);_0x306533[_0x5b57('0x2d')]=qs[_0x5b57('0x2d')](_0x35b4d3[_0x5b57('0x3c')][_0x5b57('0x2d')]);}_0x306533[_0x5b57('0x43')]=qs[_0x5b57('0x44')](_0x35b4d3['query']['sort']);_0x306533['where']=qs['filters'](_[_0x5b57('0x45')](_0x35b4d3[_0x5b57('0x3c')],_0x17d23b['filters']),_0x17a8a4);if(_0x35b4d3[_0x5b57('0x3c')]['filter']){_0x306533[_0x5b57('0x46')]=_[_0x5b57('0x47')](_0x306533[_0x5b57('0x46')],{'$or':_[_0x5b57('0x36')](_0x17a8a4,function(_0xf6bdf3){if(_0xf6bdf3[_0x5b57('0x39')]!=='VIRTUAL'){var _0x2e11c4={};_0x2e11c4[_0xf6bdf3['name']]={'$like':'%'+_0x35b4d3[_0x5b57('0x3c')]['filter']+'%'};return _0x2e11c4;}})});}_0x306533=_[_0x5b57('0x47')]({},_0x306533,_0x35b4d3['options']);var _0x4e55a5={'where':_0x306533['where']};return db['Network'][_0x5b57('0x2c')](_0x4e55a5)[_0x5b57('0x1c')](function(_0xad02a0){_0x5ef469[_0x5b57('0x2c')]=_0xad02a0;if(_0x35b4d3[_0x5b57('0x3c')][_0x5b57('0x48')]){_0x306533[_0x5b57('0x49')]=[{'all':!![]}];}return db[_0x5b57('0x4a')][_0x5b57('0x4b')](_0x306533);})[_0x5b57('0x1c')](function(_0x10cfcd){_0x5ef469[_0x5b57('0x4c')]=_0x10cfcd;return _0x5ef469;})[_0x5b57('0x1c')](respondWithFilteredResult(_0x5136c3,_0x306533))[_0x5b57('0x27')](handleError(_0x5136c3,null));};exports['show']=function(_0x1013f6,_0x42780d){var _0x535eb2={'raw':!![],'where':{'id':_0x1013f6[_0x5b57('0x4d')]['id']}},_0x3bbd45={};_0x3bbd45['model']=_[_0x5b57('0x4e')](db['Network']['rawAttributes']);_0x3bbd45[_0x5b57('0x3c')]=_[_0x5b57('0x4e')](_0x1013f6[_0x5b57('0x3c')]);_0x3bbd45[_0x5b57('0x3d')]=_['intersection'](_0x3bbd45[_0x5b57('0x3b')],_0x3bbd45['query']);_0x535eb2[_0x5b57('0x40')]=_['intersection'](_0x3bbd45[_0x5b57('0x3b')],qs[_0x5b57('0x3f')](_0x1013f6['query']['fields']));_0x535eb2[_0x5b57('0x40')]=_0x535eb2[_0x5b57('0x40')][_0x5b57('0x4f')]?_0x535eb2['attributes']:_0x3bbd45[_0x5b57('0x3b')];if(_0x1013f6['query'][_0x5b57('0x48')]){_0x535eb2['include']=[{'all':!![]}];}_0x535eb2=_[_0x5b57('0x47')]({},_0x535eb2,_0x1013f6[_0x5b57('0x50')]);return db[_0x5b57('0x4a')][_0x5b57('0x51')](_0x535eb2)[_0x5b57('0x1c')](handleEntityNotFound(_0x42780d,null))[_0x5b57('0x1c')](respondWithResult(_0x42780d,null))[_0x5b57('0x27')](handleError(_0x42780d,null));};exports[_0x5b57('0x52')]=function(_0x1026b6,_0x54cdec,_0x57bcee){var _0x773649;return db[_0x5b57('0x53')][_0x5b57('0x54')](function(_0x5c5c0e){return db[_0x5b57('0x4a')][_0x5b57('0x52')](_0x1026b6[_0x5b57('0x55')],{'raw':!![]})[_0x5b57('0x1c')](function(_0x480697){_0x773649=_0x480697;return db['Network'][_0x5b57('0x4b')]({'where':{'type':_0x1026b6[_0x5b57('0x55')][_0x5b57('0x39')]},'raw':!![]});})[_0x5b57('0x1c')](function(_0x22ae73){if(_0x773649[_0x5b57('0x39')][_0x5b57('0x56')]()=='STUN'){var _0x23e0af=fs[_0x5b57('0x57')](path[_0x5b57('0x58')](config[_0x5b57('0x59')],'server/files/templates/stun_multiple.ejs'),_0x5b57('0x5a'));var _0x429d76=ejs[_0x5b57('0x5b')](_0x23e0af,{'networks':_0x22ae73||[]});fs[_0x5b57('0x5c')](_0x5b57('0x5d'),_0x429d76);return respondWithRpcPromise(_0x5b57('0x5e'),_0x5b57('0x52'),{'module':_0x5b57('0x5f')});}else if(_0x773649[_0x5b57('0x39')][_0x5b57('0x56')]()==_0x5b57('0x60')){var _0x22445c=fs['readFileSync'](path[_0x5b57('0x58')](config[_0x5b57('0x59')],_0x5b57('0x61')),'utf8');var _0x5dc3e7=ejs[_0x5b57('0x5b')](_0x22445c,{'networks':_0x22ae73||[]});fs['writeFileSync'](_0x5b57('0x62'),_0x5dc3e7);return respondWithRpcPromise(_0x5b57('0x5e'),_0x5b57('0x52'),{'module':_0x5b57('0x5f')});}else{var _0xced688=fs[_0x5b57('0x57')](path['join'](config[_0x5b57('0x59')],_0x5b57('0x63')),_0x5b57('0x5a'));var _0x1d097b=ejs[_0x5b57('0x5b')](_0xced688,{'networks':_0x22ae73||[]});fs[_0x5b57('0x5c')](util[_0x5b57('0x64')](_0x5b57('0x65'),_0x1026b6[_0x5b57('0x55')]['type'][_0x5b57('0x66')]()),_0x1d097b);return respondWithRpcPromise('Reload',_0x5b57('0x52'),{'module':_0x5b57('0x67')});}return null;})['then'](function(){return _0x773649;});})[_0x5b57('0x1c')](respondWithResult(_0x54cdec,0xc9))[_0x5b57('0x27')](handleError(_0x54cdec,null));};exports['update']=function(_0x38aca8,_0x1a8b10,_0x3578a3){var _0x256435;return db[_0x5b57('0x53')][_0x5b57('0x54')](function(_0x2d27e2){return db[_0x5b57('0x4a')]['find']({'where':{'id':_0x38aca8[_0x5b57('0x4d')]['id']}})[_0x5b57('0x1c')](handleEntityNotFound(_0x1a8b10,null))['then'](saveUpdates(_0x38aca8[_0x5b57('0x55')],null))[_0x5b57('0x1c')](function(_0xb45642){if(_0xb45642){_0x256435=_0xb45642;return db['Network'][_0x5b57('0x4b')]({'where':{'type':_0x256435[_0x5b57('0x39')]},'raw':!![]});}return null;})[_0x5b57('0x1c')](function(_0x2eca3d){if(_0x256435['type'][_0x5b57('0x56')]()==_0x5b57('0x68')){var _0x1f076a=fs['readFileSync'](path[_0x5b57('0x58')](config[_0x5b57('0x59')],_0x5b57('0x69')),_0x5b57('0x5a'));var _0x5f0aa9=ejs[_0x5b57('0x5b')](_0x1f076a,{'networks':_0x2eca3d||[]});fs[_0x5b57('0x5c')](_0x5b57('0x5d'),_0x5f0aa9);return respondWithRpcPromise('Reload',_0x5b57('0x6a'),{'module':_0x5b57('0x5f')});}else if(_0x256435[_0x5b57('0x39')][_0x5b57('0x56')]()==_0x5b57('0x60')){var _0x4c90c6=fs['readFileSync'](path['join'](config[_0x5b57('0x59')],'server/files/templates/turn_multiple.ejs'),_0x5b57('0x5a'));var _0xc8b9f8=ejs['render'](_0x4c90c6,{'networks':_0x2eca3d||[]});fs[_0x5b57('0x5c')]('/etc/asterisk/turn_xcally.conf',_0xc8b9f8);return respondWithRpcPromise(_0x5b57('0x5e'),'update',{'module':'res_stun_monitor.so'});}else{var _0x4137c2=fs['readFileSync'](path[_0x5b57('0x58')](config[_0x5b57('0x59')],_0x5b57('0x63')),_0x5b57('0x5a'));var _0x356cdd=ejs['render'](_0x4137c2,{'networks':_0x2eca3d||[]});fs[_0x5b57('0x5c')](util[_0x5b57('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x38aca8[_0x5b57('0x55')][_0x5b57('0x39')][_0x5b57('0x66')]()),_0x356cdd);return respondWithRpcPromise('Reload',_0x5b57('0x6a'),{'module':_0x5b57('0x67')});}return null;})[_0x5b57('0x1c')](function(_0x305dfe){if(_0x305dfe){return _0x256435;}return null;});})[_0x5b57('0x1c')](respondWithResult(_0x1a8b10,null))[_0x5b57('0x27')](handleError(_0x1a8b10,null));};exports[_0x5b57('0x33')]=function(_0x3fa292,_0x37f3ac,_0x5b986d){var _0x2c2253;return db[_0x5b57('0x4a')][_0x5b57('0x51')]({'where':{'id':_0x3fa292['params']['id']}})[_0x5b57('0x1c')](function(_0x454f21){_0x2c2253=_0x454f21;return _0x454f21;})[_0x5b57('0x1c')](handleEntityNotFound(_0x37f3ac,null))[_0x5b57('0x1c')](removeEntity(_0x37f3ac,null))[_0x5b57('0x1c')](function(){if(_0x2c2253){return db[_0x5b57('0x4a')][_0x5b57('0x4b')]({'where':{'type':_0x2c2253['type']},'raw':!![]});}})['then'](function(_0x3aa002){if(_0x2c2253[_0x5b57('0x39')]['toUpperCase']()=='STUN'){var _0x221d73=fs[_0x5b57('0x57')](path[_0x5b57('0x58')](config[_0x5b57('0x59')],_0x5b57('0x69')),_0x5b57('0x5a'));var _0x2fc6de=ejs[_0x5b57('0x5b')](_0x221d73,{'networks':_0x3aa002||[]});fs[_0x5b57('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x2fc6de);return respondWithRpcPromise(_0x5b57('0x5e'),_0x5b57('0x33'),{'module':_0x5b57('0x5f')});}else if(_0x2c2253['type'][_0x5b57('0x56')]()==_0x5b57('0x60')){var _0x554b21=fs[_0x5b57('0x57')](path[_0x5b57('0x58')](config[_0x5b57('0x59')],_0x5b57('0x61')),_0x5b57('0x5a'));var _0x35309a=ejs[_0x5b57('0x5b')](_0x554b21,{'networks':_0x3aa002||[]});fs['writeFileSync'](_0x5b57('0x62'),_0x35309a);return respondWithRpcPromise('Reload',_0x5b57('0x33'),{'module':_0x5b57('0x5f')});}else{var _0x2d29e9=fs[_0x5b57('0x57')](path[_0x5b57('0x58')](config[_0x5b57('0x59')],'server/files/templates/network.ejs'),'utf8');var _0xfdc5b7=ejs[_0x5b57('0x5b')](_0x2d29e9,{'networks':_0x3aa002||[]});fs[_0x5b57('0x5c')](util[_0x5b57('0x64')](_0x5b57('0x65'),_0x3fa292[_0x5b57('0x55')]['type'][_0x5b57('0x66')]()),_0xfdc5b7);return respondWithRpcPromise(_0x5b57('0x5e'),_0x5b57('0x33'),{'module':_0x5b57('0x67')});}return null;})[_0x5b57('0x27')](handleError(_0x37f3ac,null));}; \ No newline at end of file +var _0xb6f5=['readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','utf8','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','name','send','Network','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','sequelize','transaction','body','STUN'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb6f5,0x160));var _0x5b6f=function(_0x3db7ac,_0x4b9b9c){_0x3db7ac=_0x3db7ac-0x0;var _0x390337=_0xb6f5[_0x3db7ac];return _0x390337;};'use strict';var pdf=require(_0x5b6f('0x0'));var emlformat=require(_0x5b6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b6f('0x2'));var rp=require(_0x5b6f('0x3'));var moment=require(_0x5b6f('0x4'));var BPromise=require(_0x5b6f('0x5'));var Mustache=require(_0x5b6f('0x6'));var util=require(_0x5b6f('0x7'));var path=require('path');var sox=require(_0x5b6f('0x8'));var csv=require(_0x5b6f('0x9'));var ejs=require(_0x5b6f('0xa'));var fs=require('fs');var _=require(_0x5b6f('0xb'));var squel=require(_0x5b6f('0xc'));var crypto=require(_0x5b6f('0xd'));var jsforce=require(_0x5b6f('0xe'));var deskjs=require(_0x5b6f('0xf'));var toCsv=require(_0x5b6f('0x9'));var querystring=require(_0x5b6f('0x10'));var Papa=require(_0x5b6f('0x11'));var Redis=require(_0x5b6f('0x12'));var authService=require(_0x5b6f('0x13'));var qs=require(_0x5b6f('0x14'));var as=require(_0x5b6f('0x15'));var hardwareService=require(_0x5b6f('0x16'));var logger=require(_0x5b6f('0x17'))(_0x5b6f('0x18'));var utils=require('../../config/utils');var config=require(_0x5b6f('0x19'));var db=require(_0x5b6f('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f68bf,_0x4a7dfe,_0x3fa309){if(_0x3fa309){var _0x593a53=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x593a53[_0x5b6f('0x1b')](_0x4a7dfe)){return _0x2f68bf;}else{throw new db[(_0x5b6f('0x1c'))][(_0x5b6f('0x1d'))](_0x5b6f('0x1e'));}}else{return _0x2f68bf;}}function respondWithRpcPromise(_0x321f3c,_0x28bef6,_0x197a47,_0x1964a6){return new BPromise(function(_0x6d9f7f,_0xf3fd95){var _0x118de3=_0x1964a6||client;return _0x118de3['request'](_0x321f3c,_0x197a47)[_0x5b6f('0x1f')](function(_0x494817){logger[_0x5b6f('0x20')](_0x5b6f('0x21'),_0x28bef6,_0x5b6f('0x22'));logger[_0x5b6f('0x23')]('Network,\x20%s,\x20%s,\x20%s',_0x28bef6,'request\x20sent',JSON[_0x5b6f('0x24')](_0x494817));if(_0x494817[_0x5b6f('0x25')]){if(_0x494817[_0x5b6f('0x25')][_0x5b6f('0x26')]===0x1f4){logger[_0x5b6f('0x25')](_0x5b6f('0x21'),_0x28bef6,_0x494817[_0x5b6f('0x25')][_0x5b6f('0x27')]);return _0xf3fd95(_0x494817['error'][_0x5b6f('0x27')]);}logger[_0x5b6f('0x25')](_0x5b6f('0x21'),_0x28bef6,_0x494817[_0x5b6f('0x25')][_0x5b6f('0x27')]);return _0x6d9f7f(_0x494817[_0x5b6f('0x25')]['message']);}else{logger[_0x5b6f('0x20')](_0x5b6f('0x21'),_0x28bef6,_0x5b6f('0x22'));_0x6d9f7f(_0x494817[_0x5b6f('0x28')][_0x5b6f('0x27')]);}})[_0x5b6f('0x29')](function(_0x28e699){logger[_0x5b6f('0x25')](_0x5b6f('0x21'),_0x28bef6,_0x28e699);_0xf3fd95(_0x28e699);});});}function respondWithStatusCode(_0x56a7e4,_0x58e7b9){_0x58e7b9=_0x58e7b9||0xcc;return function(_0x1c0a6b){if(_0x1c0a6b){return _0x56a7e4[_0x5b6f('0x2a')](_0x58e7b9);}return _0x56a7e4['status'](_0x58e7b9)[_0x5b6f('0x2b')]();};}function respondWithResult(_0x2c85b3,_0x119db1){_0x119db1=_0x119db1||0xc8;return function(_0x162483){if(_0x162483){return _0x2c85b3[_0x5b6f('0x2c')](_0x119db1)[_0x5b6f('0x2d')](_0x162483);}};}function respondWithFilteredResult(_0x5e4ef2,_0x384f4f){return function(_0x259c9a){if(_0x259c9a){var _0x24f32a=_0x259c9a[_0x5b6f('0x2e')],_0x418e52=_0x384f4f[_0x5b6f('0x2f')],_0x271c74=_0x384f4f[_0x5b6f('0x2f')]+_0x384f4f[_0x5b6f('0x30')],_0x13ff7a;if(_0x271c74>=_0x24f32a){_0x271c74=_0x24f32a;_0x13ff7a=0xc8;}else{_0x13ff7a=0xce;}_0x5e4ef2[_0x5b6f('0x2c')](_0x13ff7a);return _0x5e4ef2[_0x5b6f('0x31')](_0x5b6f('0x32'),_0x418e52+'-'+_0x271c74+'/'+_0x24f32a)[_0x5b6f('0x2d')](_0x259c9a);}return null;};}function patchUpdates(_0x1a57ad){return function(_0x10b0ba){try{jsonpatch['apply'](_0x10b0ba,_0x1a57ad,!![]);}catch(_0x4def2d){return BPromise['reject'](_0x4def2d);}return _0x10b0ba[_0x5b6f('0x33')]();};}function saveUpdates(_0x16143c,_0x4f92a6){return function(_0x478b3f){if(_0x478b3f){return _0x478b3f[_0x5b6f('0x34')](_0x16143c)[_0x5b6f('0x1f')](function(_0x5737c2){return _0x5737c2;});}return null;};}function removeEntity(_0x280d59,_0x48df02){return function(_0x238d78){if(_0x238d78){return _0x238d78[_0x5b6f('0x35')]()[_0x5b6f('0x1f')](function(){_0x280d59[_0x5b6f('0x2c')](0xcc)[_0x5b6f('0x2b')]();});}};}function handleEntityNotFound(_0x2d829f,_0x5a6adc){return function(_0x544584){if(!_0x544584){_0x2d829f[_0x5b6f('0x2a')](0x194);}return _0x544584;};}function handleError(_0x5495b0,_0x5b0b21){_0x5b0b21=_0x5b0b21||0x1f4;return function(_0x49fa5d){logger[_0x5b6f('0x25')](_0x49fa5d['stack']);if(_0x49fa5d[_0x5b6f('0x36')]){delete _0x49fa5d[_0x5b6f('0x36')];}_0x5495b0[_0x5b6f('0x2c')](_0x5b0b21)[_0x5b6f('0x37')](_0x49fa5d);};}exports['index']=function(_0x244a1a,_0x20725a){var _0x445bbc={},_0x420e41={},_0x12bfaa={'count':0x0,'rows':[]};var _0x85cee5=_['map'](db[_0x5b6f('0x38')][_0x5b6f('0x39')],function(_0x5e8f7f){return{'name':_0x5e8f7f[_0x5b6f('0x3a')],'type':_0x5e8f7f[_0x5b6f('0x3b')][_0x5b6f('0x3c')]};});_0x420e41['model']=_[_0x5b6f('0x3d')](_0x85cee5,'name');_0x420e41[_0x5b6f('0x3e')]=_[_0x5b6f('0x3f')](_0x244a1a[_0x5b6f('0x3e')]);_0x420e41[_0x5b6f('0x40')]=_[_0x5b6f('0x41')](_0x420e41[_0x5b6f('0x42')],_0x420e41[_0x5b6f('0x3e')]);_0x445bbc[_0x5b6f('0x43')]=_[_0x5b6f('0x41')](_0x420e41[_0x5b6f('0x42')],qs['fields'](_0x244a1a['query'][_0x5b6f('0x44')]));_0x445bbc[_0x5b6f('0x43')]=_0x445bbc[_0x5b6f('0x43')][_0x5b6f('0x45')]?_0x445bbc[_0x5b6f('0x43')]:_0x420e41['model'];if(!_0x244a1a['query'][_0x5b6f('0x46')](_0x5b6f('0x47'))){_0x445bbc[_0x5b6f('0x30')]=qs[_0x5b6f('0x30')](_0x244a1a[_0x5b6f('0x3e')][_0x5b6f('0x30')]);_0x445bbc['offset']=qs[_0x5b6f('0x2f')](_0x244a1a[_0x5b6f('0x3e')]['offset']);}_0x445bbc[_0x5b6f('0x48')]=qs[_0x5b6f('0x49')](_0x244a1a[_0x5b6f('0x3e')]['sort']);_0x445bbc[_0x5b6f('0x4a')]=qs[_0x5b6f('0x40')](_[_0x5b6f('0x4b')](_0x244a1a[_0x5b6f('0x3e')],_0x420e41['filters']),_0x85cee5);if(_0x244a1a[_0x5b6f('0x3e')][_0x5b6f('0x4c')]){_0x445bbc[_0x5b6f('0x4a')]=_[_0x5b6f('0x4d')](_0x445bbc[_0x5b6f('0x4a')],{'$or':_[_0x5b6f('0x3d')](_0x85cee5,function(_0x53c3b6){if(_0x53c3b6[_0x5b6f('0x3b')]!==_0x5b6f('0x4e')){var _0x2c4289={};_0x2c4289[_0x53c3b6[_0x5b6f('0x36')]]={'$like':'%'+_0x244a1a[_0x5b6f('0x3e')]['filter']+'%'};return _0x2c4289;}})});}_0x445bbc=_[_0x5b6f('0x4d')]({},_0x445bbc,_0x244a1a['options']);var _0x2db8ce={'where':_0x445bbc[_0x5b6f('0x4a')]};return db[_0x5b6f('0x38')][_0x5b6f('0x2e')](_0x2db8ce)[_0x5b6f('0x1f')](function(_0x588f65){_0x12bfaa[_0x5b6f('0x2e')]=_0x588f65;if(_0x244a1a[_0x5b6f('0x3e')][_0x5b6f('0x4f')]){_0x445bbc[_0x5b6f('0x50')]=[{'all':!![]}];}return db['Network'][_0x5b6f('0x51')](_0x445bbc);})[_0x5b6f('0x1f')](function(_0x256bd7){_0x12bfaa[_0x5b6f('0x52')]=_0x256bd7;return _0x12bfaa;})[_0x5b6f('0x1f')](respondWithFilteredResult(_0x20725a,_0x445bbc))[_0x5b6f('0x29')](handleError(_0x20725a,null));};exports[_0x5b6f('0x53')]=function(_0x3a357c,_0x1d48ba){var _0x475d37={'raw':!![],'where':{'id':_0x3a357c[_0x5b6f('0x54')]['id']}},_0x4281d2={};_0x4281d2[_0x5b6f('0x42')]=_[_0x5b6f('0x3f')](db['Network']['rawAttributes']);_0x4281d2[_0x5b6f('0x3e')]=_['keys'](_0x3a357c[_0x5b6f('0x3e')]);_0x4281d2['filters']=_['intersection'](_0x4281d2['model'],_0x4281d2[_0x5b6f('0x3e')]);_0x475d37[_0x5b6f('0x43')]=_['intersection'](_0x4281d2[_0x5b6f('0x42')],qs[_0x5b6f('0x44')](_0x3a357c[_0x5b6f('0x3e')][_0x5b6f('0x44')]));_0x475d37[_0x5b6f('0x43')]=_0x475d37[_0x5b6f('0x43')][_0x5b6f('0x45')]?_0x475d37[_0x5b6f('0x43')]:_0x4281d2[_0x5b6f('0x42')];if(_0x3a357c[_0x5b6f('0x3e')]['includeAll']){_0x475d37[_0x5b6f('0x50')]=[{'all':!![]}];}_0x475d37=_['merge']({},_0x475d37,_0x3a357c[_0x5b6f('0x55')]);return db[_0x5b6f('0x38')][_0x5b6f('0x56')](_0x475d37)['then'](handleEntityNotFound(_0x1d48ba,null))[_0x5b6f('0x1f')](respondWithResult(_0x1d48ba,null))[_0x5b6f('0x29')](handleError(_0x1d48ba,null));};exports[_0x5b6f('0x57')]=function(_0x178342,_0x544d75,_0x2664b9){var _0x3cff1e;return db[_0x5b6f('0x58')][_0x5b6f('0x59')](function(_0x2a2a4e){return db[_0x5b6f('0x38')][_0x5b6f('0x57')](_0x178342[_0x5b6f('0x5a')],{'raw':!![]})[_0x5b6f('0x1f')](function(_0x196599){_0x3cff1e=_0x196599;return db[_0x5b6f('0x38')][_0x5b6f('0x51')]({'where':{'type':_0x178342[_0x5b6f('0x5a')][_0x5b6f('0x3b')]},'raw':!![]});})[_0x5b6f('0x1f')](function(_0x41a57a){if(_0x3cff1e[_0x5b6f('0x3b')]['toUpperCase']()==_0x5b6f('0x5b')){var _0x509215=fs[_0x5b6f('0x5c')](path[_0x5b6f('0x5d')](config[_0x5b6f('0x5e')],_0x5b6f('0x5f')),'utf8');var _0x3f2f52=ejs[_0x5b6f('0x60')](_0x509215,{'networks':_0x41a57a||[]});fs[_0x5b6f('0x61')](_0x5b6f('0x62'),_0x3f2f52);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x57'),{'module':_0x5b6f('0x64')});}else if(_0x3cff1e['type'][_0x5b6f('0x65')]()==_0x5b6f('0x66')){var _0x548880=fs[_0x5b6f('0x5c')](path[_0x5b6f('0x5d')](config[_0x5b6f('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x5b6f('0x67'));var _0x14dc2d=ejs[_0x5b6f('0x60')](_0x548880,{'networks':_0x41a57a||[]});fs[_0x5b6f('0x61')](_0x5b6f('0x68'),_0x14dc2d);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x57'),{'module':'res_stun_monitor.so'});}else{var _0x3a3cce=fs['readFileSync'](path[_0x5b6f('0x5d')](config[_0x5b6f('0x5e')],'server/files/templates/network.ejs'),_0x5b6f('0x67'));var _0x233684=ejs['render'](_0x3a3cce,{'networks':_0x41a57a||[]});fs[_0x5b6f('0x61')](util[_0x5b6f('0x69')](_0x5b6f('0x6a'),_0x178342[_0x5b6f('0x5a')][_0x5b6f('0x3b')][_0x5b6f('0x6b')]()),_0x233684);return respondWithRpcPromise(_0x5b6f('0x63'),'create',{'module':_0x5b6f('0x6c')});}return null;})['then'](function(){return _0x3cff1e;});})['then'](respondWithResult(_0x544d75,0xc9))[_0x5b6f('0x29')](handleError(_0x544d75,null));};exports[_0x5b6f('0x34')]=function(_0x5bb6b9,_0x35afd8,_0x39c47c){var _0x2edf75;return db['sequelize'][_0x5b6f('0x59')](function(_0x52c95e){return db['Network'][_0x5b6f('0x56')]({'where':{'id':_0x5bb6b9[_0x5b6f('0x54')]['id']}})['then'](handleEntityNotFound(_0x35afd8,null))['then'](saveUpdates(_0x5bb6b9[_0x5b6f('0x5a')],null))[_0x5b6f('0x1f')](function(_0x53af73){if(_0x53af73){_0x2edf75=_0x53af73;return db['Network']['findAll']({'where':{'type':_0x2edf75[_0x5b6f('0x3b')]},'raw':!![]});}return null;})[_0x5b6f('0x1f')](function(_0x578334){if(_0x2edf75['type']['toUpperCase']()==_0x5b6f('0x5b')){var _0x315518=fs['readFileSync'](path['join'](config['root'],_0x5b6f('0x5f')),'utf8');var _0x53024b=ejs['render'](_0x315518,{'networks':_0x578334||[]});fs['writeFileSync'](_0x5b6f('0x62'),_0x53024b);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x34'),{'module':_0x5b6f('0x64')});}else if(_0x2edf75[_0x5b6f('0x3b')][_0x5b6f('0x65')]()==_0x5b6f('0x66')){var _0x1a1818=fs[_0x5b6f('0x5c')](path[_0x5b6f('0x5d')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4926de=ejs['render'](_0x1a1818,{'networks':_0x578334||[]});fs['writeFileSync'](_0x5b6f('0x68'),_0x4926de);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x2b0f0e=fs[_0x5b6f('0x5c')](path[_0x5b6f('0x5d')](config[_0x5b6f('0x5e')],'server/files/templates/network.ejs'),'utf8');var _0xb85f0a=ejs['render'](_0x2b0f0e,{'networks':_0x578334||[]});fs[_0x5b6f('0x61')](util[_0x5b6f('0x69')](_0x5b6f('0x6a'),_0x5bb6b9[_0x5b6f('0x5a')]['type'][_0x5b6f('0x6b')]()),_0xb85f0a);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x34'),{'module':_0x5b6f('0x6c')});}return null;})[_0x5b6f('0x1f')](function(_0x5ec6d5){if(_0x5ec6d5){return _0x2edf75;}return null;});})[_0x5b6f('0x1f')](respondWithResult(_0x35afd8,null))[_0x5b6f('0x29')](handleError(_0x35afd8,null));};exports[_0x5b6f('0x35')]=function(_0x5a5fc7,_0x34b918,_0x2850d1){var _0x1f1c32;return db[_0x5b6f('0x38')][_0x5b6f('0x56')]({'where':{'id':_0x5a5fc7[_0x5b6f('0x54')]['id']}})[_0x5b6f('0x1f')](function(_0x59d995){_0x1f1c32=_0x59d995;return _0x59d995;})[_0x5b6f('0x1f')](handleEntityNotFound(_0x34b918,null))[_0x5b6f('0x1f')](removeEntity(_0x34b918,null))[_0x5b6f('0x1f')](function(){if(_0x1f1c32){return db['Network']['findAll']({'where':{'type':_0x1f1c32[_0x5b6f('0x3b')]},'raw':!![]});}})['then'](function(_0x5ef911){if(_0x1f1c32[_0x5b6f('0x3b')][_0x5b6f('0x65')]()==_0x5b6f('0x5b')){var _0x4df670=fs[_0x5b6f('0x5c')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x5b6f('0x67'));var _0x3a66f9=ejs[_0x5b6f('0x60')](_0x4df670,{'networks':_0x5ef911||[]});fs['writeFileSync'](_0x5b6f('0x62'),_0x3a66f9);return respondWithRpcPromise('Reload',_0x5b6f('0x35'),{'module':_0x5b6f('0x64')});}else if(_0x1f1c32[_0x5b6f('0x3b')]['toUpperCase']()==_0x5b6f('0x66')){var _0x81c5df=fs['readFileSync'](path['join'](config[_0x5b6f('0x5e')],_0x5b6f('0x6d')),_0x5b6f('0x67'));var _0xb7e739=ejs[_0x5b6f('0x60')](_0x81c5df,{'networks':_0x5ef911||[]});fs['writeFileSync'](_0x5b6f('0x68'),_0xb7e739);return respondWithRpcPromise('Reload',_0x5b6f('0x35'),{'module':_0x5b6f('0x64')});}else{var _0x4af38d=fs[_0x5b6f('0x5c')](path[_0x5b6f('0x5d')](config[_0x5b6f('0x5e')],_0x5b6f('0x6e')),_0x5b6f('0x67'));var _0x31a623=ejs['render'](_0x4af38d,{'networks':_0x5ef911||[]});fs[_0x5b6f('0x61')](util[_0x5b6f('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x5a5fc7[_0x5b6f('0x5a')][_0x5b6f('0x3b')]['toLowerCase']()),_0x31a623);return respondWithRpcPromise(_0x5b6f('0x63'),_0x5b6f('0x35'),{'module':_0x5b6f('0x6c')});}return null;})[_0x5b6f('0x29')](handleError(_0x34b918,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 990a4a3..998cb46 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 _0x5c12=['./network.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x337124,_0x5c6e00){var _0x5d5801=function(_0x43244d){while(--_0x43244d){_0x337124['push'](_0x337124['shift']());}};_0x5d5801(++_0x5c6e00);}(_0x5c12,0x188));var _0x25c1=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x5c12[_0x3815c2];return _0x271f88;};'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')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c12=['./network.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18f6e4,_0x422944){var _0x4af22c=function(_0xe6ac2b){while(--_0xe6ac2b){_0x18f6e4['push'](_0x18f6e4['shift']());}};_0x4af22c(++_0x422944);}(_0x5c12,0x188));var _0x25c1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x5c12[_0x11c573];return _0x6b72de;};'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')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ea2f239..abb20e4 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 _0x62fb=['Network,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e1e83,_0x1c8c86){var _0x49a572=function(_0x5c2b95){while(--_0x5c2b95){_0x1e1e83['push'](_0x1e1e83['shift']());}};_0x49a572(++_0x1c8c86);}(_0x62fb,0x1f3));var _0xb62f=function(_0x485c25,_0x2beffc){_0x485c25=_0x485c25-0x0;var _0xffd88d=_0x62fb[_0x485c25];return _0xffd88d;};'use strict';var _=require('lodash');var util=require(_0xb62f('0x0'));var moment=require(_0xb62f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb62f('0x2'));var db=require(_0xb62f('0x3'))['db'];var utils=require(_0xb62f('0x4'));var logger=require(_0xb62f('0x5'))(_0xb62f('0x6'));var config=require(_0xb62f('0x7'));var jayson=require(_0xb62f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9e8cd2,_0x1b7bf2,_0x4e3c33){return new BPromise(function(_0x342384,_0x351cc9){return client[_0xb62f('0x9')](_0x9e8cd2,_0x4e3c33)['then'](function(_0x288023){logger[_0xb62f('0xa')](_0xb62f('0xb'),_0x1b7bf2,_0xb62f('0xc'));logger[_0xb62f('0xd')](_0xb62f('0xe'),_0x1b7bf2,_0xb62f('0xc'),JSON['stringify'](_0x288023));if(_0x288023[_0xb62f('0xf')]){if(_0x288023['error'][_0xb62f('0x10')]===0x1f4){logger[_0xb62f('0xf')]('Network,\x20%s,\x20%s',_0x1b7bf2,_0x288023['error'][_0xb62f('0x11')]);return _0x351cc9(_0x288023['error'][_0xb62f('0x11')]);}logger[_0xb62f('0xf')](_0xb62f('0xb'),_0x1b7bf2,_0x288023[_0xb62f('0xf')][_0xb62f('0x11')]);return _0x342384(_0x288023[_0xb62f('0xf')][_0xb62f('0x11')]);}else{logger[_0xb62f('0xa')]('Network,\x20%s,\x20%s',_0x1b7bf2,_0xb62f('0xc'));_0x342384(_0x288023[_0xb62f('0x12')]['message']);}})['catch'](function(_0x26d75d){logger['error']('Network,\x20%s,\x20%s',_0x1b7bf2,_0x26d75d);_0x351cc9(_0x26d75d);});});} \ No newline at end of file +var _0xe932=['info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x188bfe,_0x2517cc){var _0x1a9efa=function(_0x361964){while(--_0x361964){_0x188bfe['push'](_0x188bfe['shift']());}};_0x1a9efa(++_0x2517cc);}(_0xe932,0xb3));var _0x2e93=function(_0x18f3cb,_0x599477){_0x18f3cb=_0x18f3cb-0x0;var _0x273d11=_0xe932[_0x18f3cb];return _0x273d11;};'use strict';var _=require(_0x2e93('0x0'));var util=require(_0x2e93('0x1'));var moment=require(_0x2e93('0x2'));var BPromise=require(_0x2e93('0x3'));var rs=require(_0x2e93('0x4'));var fs=require('fs');var Redis=require(_0x2e93('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e93('0x6'))('rpc');var config=require(_0x2e93('0x7'));var jayson=require(_0x2e93('0x8'));var client=jayson[_0x2e93('0x9')][_0x2e93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x297abf,_0x28a3ff,_0x16f038){return new BPromise(function(_0x4de3bd,_0x288191){return client[_0x2e93('0xb')](_0x297abf,_0x16f038)['then'](function(_0xe2b4be){logger['info'](_0x2e93('0xc'),_0x28a3ff,'request\x20sent');logger[_0x2e93('0xd')](_0x2e93('0xe'),_0x28a3ff,'request\x20sent',JSON[_0x2e93('0xf')](_0xe2b4be));if(_0xe2b4be[_0x2e93('0x10')]){if(_0xe2b4be['error'][_0x2e93('0x11')]===0x1f4){logger[_0x2e93('0x10')](_0x2e93('0xc'),_0x28a3ff,_0xe2b4be[_0x2e93('0x10')][_0x2e93('0x12')]);return _0x288191(_0xe2b4be[_0x2e93('0x10')]['message']);}logger[_0x2e93('0x10')](_0x2e93('0xc'),_0x28a3ff,_0xe2b4be['error'][_0x2e93('0x12')]);return _0x4de3bd(_0xe2b4be[_0x2e93('0x10')][_0x2e93('0x12')]);}else{logger[_0x2e93('0x13')](_0x2e93('0xc'),_0x28a3ff,_0x2e93('0x14'));_0x4de3bd(_0xe2b4be[_0x2e93('0x15')][_0x2e93('0x12')]);}})['catch'](function(_0xec8899){logger[_0x2e93('0x10')]('Network,\x20%s,\x20%s',_0x28a3ff,_0xec8899);_0x288191(_0xec8899);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index af15dfd..4f7a2d4 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 _0x6611=['../../config/environment','./notification.controller','post','isAuthenticated','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e52bf,_0x4cfa32){var _0x2fdc63=function(_0x243d06){while(--_0x243d06){_0x1e52bf['push'](_0x1e52bf['shift']());}};_0x2fdc63(++_0x4cfa32);}(_0x6611,0x71));var _0x1661=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6611[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x1661('0x0'));var util=require(_0x1661('0x1'));var path=require('path');var timeout=require(_0x1661('0x2'));var express=require(_0x1661('0x3'));var router=express[_0x1661('0x4')]();var auth=require(_0x1661('0x5'));var interaction=require(_0x1661('0x6'));var config=require(_0x1661('0x7'));var controller=require(_0x1661('0x8'));router[_0x1661('0x9')]('/',auth[_0x1661('0xa')](),controller['sendNotification']);module[_0x1661('0xb')]=router; \ No newline at end of file +var _0xdc3a=['isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xdc3a,0x121));var _0xadc3=function(_0x1cd135,_0x1821e4){_0x1cd135=_0x1cd135-0x0;var _0x4e3eec=_0xdc3a[_0x1cd135];return _0x4e3eec;};'use strict';var multer=require(_0xadc3('0x0'));var util=require(_0xadc3('0x1'));var path=require(_0xadc3('0x2'));var timeout=require(_0xadc3('0x3'));var express=require(_0xadc3('0x4'));var router=express[_0xadc3('0x5')]();var auth=require(_0xadc3('0x6'));var interaction=require(_0xadc3('0x7'));var config=require(_0xadc3('0x8'));var controller=require('./notification.controller');router[_0xadc3('0x9')]('/',auth[_0xadc3('0xa')](),controller[_0xadc3('0xb')]);module[_0xadc3('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index ff34567..0b5b66f 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 _0xb018=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x2ec409,_0x3c9c99){var _0x4cd510=function(_0x37ef4a){while(--_0x37ef4a){_0x2ec409['push'](_0x2ec409['shift']());}};_0x4cd510(++_0x3c9c99);}(_0xb018,0x1b1));var _0x8b01=function(_0x166730,_0x3e6e39){_0x166730=_0x166730-0x0;var _0x4f80d4=_0xb018[_0x166730];return _0x4f80d4;};'use strict';var Sequelize=require(_0x8b01('0x0'));module[_0x8b01('0x1')]={'body':{'type':Sequelize[_0x8b01('0x2')]},'senderName':{'type':Sequelize[_0x8b01('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x8b01('0x3')]},'beep':{'type':Sequelize[_0x8b01('0x4')]}}; \ No newline at end of file +var _0x809a=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x809a,0x108));var _0xa809=function(_0x1ea712,_0x297a6f){_0x1ea712=_0x1ea712-0x0;var _0x188dee=_0x809a[_0x1ea712];return _0x188dee;};'use strict';var Sequelize=require(_0xa809('0x0'));module[_0xa809('0x1')]={'body':{'type':Sequelize[_0xa809('0x2')]},'senderName':{'type':Sequelize[_0xa809('0x3')]},'recipientsId':{'type':Sequelize[_0xa809('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa809('0x3')]},'beep':{'type':Sequelize[_0xa809('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index f32c760..2fde2de 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 _0x20df=['hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','senderName','fullname','recipientsDescription','beep','SenderId','user','recipientsId','sortBy','join','transaction','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','ids','queue','push','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','sendNotification','body'];(function(_0x2f7764,_0x173615){var _0x376475=function(_0x20149e){while(--_0x20149e){_0x2f7764['push'](_0x2f7764['shift']());}};_0x376475(++_0x173615);}(_0x20df,0xf5));var _0xf20d=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x20df[_0x2d364e];return _0x1b9312;};'use strict';var pdf=require(_0xf20d('0x0'));var emlformat=require(_0xf20d('0x1'));var rimraf=require(_0xf20d('0x2'));var zipdir=require(_0xf20d('0x3'));var jsonpatch=require(_0xf20d('0x4'));var rp=require(_0xf20d('0x5'));var moment=require(_0xf20d('0x6'));var BPromise=require(_0xf20d('0x7'));var Mustache=require('mustache');var util=require(_0xf20d('0x8'));var path=require(_0xf20d('0x9'));var sox=require(_0xf20d('0xa'));var csv=require(_0xf20d('0xb'));var ejs=require(_0xf20d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf20d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf20d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf20d('0xf'));var Papa=require(_0xf20d('0x10'));var Redis=require(_0xf20d('0x11'));var authService=require(_0xf20d('0x12'));var qs=require(_0xf20d('0x13'));var as=require(_0xf20d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf20d('0x15'))(_0xf20d('0x16'));var utils=require(_0xf20d('0x17'));var config=require(_0xf20d('0x18'));var db=require('../../mysqldb')['db'];config[_0xf20d('0x19')]=_['defaults'](config['redis'],{'host':_0xf20d('0x1a'),'port':0x18eb});var socket=require(_0xf20d('0x1b'))(new Redis(config[_0xf20d('0x19')]));require('./notification.socket')[_0xf20d('0x1c')](socket);function respondWithStatusCode(_0x2cb752,_0x35daf8){_0x35daf8=_0x35daf8||0xcc;return function(_0x356778){if(_0x356778){return _0x2cb752[_0xf20d('0x1d')](_0x35daf8);}return _0x2cb752['status'](_0x35daf8)[_0xf20d('0x1e')]();};}function respondWithResult(_0x1d0f33,_0x1c3d8c){_0x1c3d8c=_0x1c3d8c||0xc8;return function(_0x2d6aa3){if(_0x2d6aa3){return _0x1d0f33[_0xf20d('0x1f')](_0x1c3d8c)['json'](_0x2d6aa3);}};}function respondWithFilteredResult(_0x2fb586,_0x399f6b){return function(_0x37ed5f){if(_0x37ed5f){var _0x1756ac=_0x37ed5f[_0xf20d('0x20')],_0x204e72=_0x399f6b[_0xf20d('0x21')],_0x475f7e=_0x399f6b[_0xf20d('0x21')]+_0x399f6b[_0xf20d('0x22')],_0x2da63c;if(_0x475f7e>=_0x1756ac){_0x475f7e=_0x1756ac;_0x2da63c=0xc8;}else{_0x2da63c=0xce;}_0x2fb586[_0xf20d('0x1f')](_0x2da63c);return _0x2fb586['set'](_0xf20d('0x23'),_0x204e72+'-'+_0x475f7e+'/'+_0x1756ac)['json'](_0x37ed5f);}return null;};}function patchUpdates(_0x10f998){return function(_0x21e5c6){try{jsonpatch['apply'](_0x21e5c6,_0x10f998,!![]);}catch(_0x2640e1){return BPromise[_0xf20d('0x24')](_0x2640e1);}return _0x21e5c6['save']();};}function saveUpdates(_0x5750ea,_0x50bc66){return function(_0x5d7594){if(_0x5d7594){return _0x5d7594[_0xf20d('0x25')](_0x5750ea)[_0xf20d('0x26')](function(_0x41f45e){return _0x41f45e;});}return null;};}function removeEntity(_0x4373d4,_0x1b2939){return function(_0x399b54){if(_0x399b54){return _0x399b54[_0xf20d('0x27')]()['then'](function(){_0x4373d4[_0xf20d('0x1f')](0xcc)[_0xf20d('0x1e')]();});}};}function handleEntityNotFound(_0xc9f3d2,_0x33b535){return function(_0x1b33c0){if(!_0x1b33c0){_0xc9f3d2[_0xf20d('0x1d')](0x194);}return _0x1b33c0;};}function handleError(_0x5dfb72,_0x44b1c1){_0x44b1c1=_0x44b1c1||0x1f4;return function(_0x4c507f){logger[_0xf20d('0x28')](_0x4c507f[_0xf20d('0x29')]);if(_0x4c507f[_0xf20d('0x2a')]){delete _0x4c507f[_0xf20d('0x2a')];}_0x5dfb72[_0xf20d('0x1f')](_0x44b1c1)[_0xf20d('0x2b')](_0x4c507f);};}exports[_0xf20d('0x2c')]=function(_0x2bc71b,_0x2a7962,_0x12fe31){if(!_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x2e')]('text')&&!_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x2e')](_0xf20d('0x2f'))){throw new db[(_0xf20d('0x30'))][(_0xf20d('0x31'))](_0xf20d('0x32'));}else{if(_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x2e')](_0xf20d('0x2f'))&&!_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x2e')](_0xf20d('0x33'))){throw new db[(_0xf20d('0x30'))][(_0xf20d('0x31'))](_0xf20d('0x34'));}if(!_0x2bc71b['body'][_0xf20d('0x2e')](_0xf20d('0x35'))){throw new db[(_0xf20d('0x30'))]['ValidationError'](_0xf20d('0x36'));}else{try{var _0x5a3bc8=JSON[_0xf20d('0x37')](_0x2bc71b['body'][_0xf20d('0x35')]);}catch(_0x1c7796){logger['error'](_0x1c7796);throw new db['Sequelize'][(_0xf20d('0x31'))](_0xf20d('0x38'));}var _0x306312=['chatqueue',_0xf20d('0x39'),_0xf20d('0x3a'),'openchannelqueue',_0xf20d('0x3b'),_0xf20d('0x3c'),_0xf20d('0x3d'),'team','user'];if(_[_0xf20d('0x3e')](_0x5a3bc8,function(_0x574dfb){return!_[_0xf20d('0x3f')](_0x306312,_0x574dfb[_0xf20d('0x40')]['toLowerCase']());})){throw new db[(_0xf20d('0x30'))][(_0xf20d('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x334bce={};_0x334bce[_0xf20d('0x41')]=_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x2e')](_0xf20d('0x41'))?_0x2bc71b[_0xf20d('0x2d')]['senderName']:_0x2bc71b['user'][_0xf20d('0x42')];_0x334bce[_0xf20d('0x43')]=_['isEmpty'](_0x2bc71b[_0xf20d('0x2d')]['recipientsDescription'])?null:_0x2bc71b[_0xf20d('0x2d')]['recipientsDescription'];_0x334bce['beep']=_0x2bc71b[_0xf20d('0x2d')][_0xf20d('0x44')]||![];_0x334bce[_0xf20d('0x45')]=_0x2bc71b[_0xf20d('0x46')]['id'];return getContent(_0x2bc71b[_0xf20d('0x2d')])[_0xf20d('0x26')](function(_0x4ab3b1){_0x334bce[_0xf20d('0x2d')]=_0x4ab3b1;return getRecipients(_0x5a3bc8);})[_0xf20d('0x26')](function(_0x542820){_0x334bce[_0xf20d('0x47')]=_[_0xf20d('0x48')](_0x542820)[_0xf20d('0x49')](',');return db['sequelize'][_0xf20d('0x4a')](function(_0xfabf3f){return db['Notification'][_0xf20d('0x4b')](_0x334bce,{'raw':!![],'transaction':_0xfabf3f})['then'](function(_0x2fb236){var _0x71f7ab={'sender':_0x334bce['senderName'],'description':_0x334bce['recipientsDescription'],'content':_0x334bce[_0xf20d('0x2d')],'beep':_0x334bce['beep']};_0x542820[_0xf20d('0x4c')](function(_0x322bbf){_0x71f7ab[_0xf20d('0x4d')]=_0x322bbf;socket[_0xf20d('0x4e')](_0xf20d('0x4f'),_0x71f7ab);});return _0x2fb236;});});})[_0xf20d('0x26')](respondWithResult(_0x2a7962,0xc9))[_0xf20d('0x50')](handleError(_0x2a7962,null));};function getContent(_0x5c699f){return new BPromise(function(_0x4ce3ff,_0x30037a){if(_0x5c699f[_0xf20d('0x51')]){_0x4ce3ff(_0x5c699f[_0xf20d('0x51')]);return;}return db[_0xf20d('0x52')][_0xf20d('0x53')]({'attributes':[_0xf20d('0x54')],'where':{'id':_0x5c699f[_0xf20d('0x2f')]},'raw':!![]})[_0xf20d('0x26')](function(_0x19c97d){if(!_0x19c97d)throw new db['Sequelize'][(_0xf20d('0x31'))](_0xf20d('0x55'));var _0x22400e=Mustache[_0xf20d('0x56')](_0x19c97d[_0xf20d('0x54')],_0x5c699f[_0xf20d('0x33')]);_0x4ce3ff(_0x22400e);})[_0xf20d('0x50')](function(_0x3a4f7b){_0x30037a(_0x3a4f7b);});});}function getRecipients(_0x3aba5e){return new BPromise(function(_0x32803f,_0x1495be){var _0x106a57=[];var _0x3dab7b=[];_0x3aba5e[_0xf20d('0x4c')](function(_0x5b784c){var _0x2bbecd=_[_0xf20d('0x57')](_0x5b784c[_0xf20d('0x40')][_0xf20d('0x58')]());if(_0x2bbecd===_0xf20d('0x59')){_0x106a57=_['union'](_0x106a57,_0x5b784c[_0xf20d('0x5a')]);}else{if(_['includes'](_0x2bbecd,_0xf20d('0x5b')))_0x2bbecd=_0x2bbecd['replace'](_0xf20d('0x5b'),'Queue');_0x5b784c[_0xf20d('0x5a')]['forEach'](function(_0x3fc39c){_0x3dab7b[_0xf20d('0x5c')](getAgents(_0x2bbecd,_0x3fc39c));});}});return BPromise['all'](_0x3dab7b)[_0xf20d('0x26')](function(_0xca1e47){_0x106a57=_[_0xf20d('0x5d')](_0x106a57,_[_0xf20d('0x5e')](_0xca1e47));_0x32803f(_0x106a57);})[_0xf20d('0x50')](function(_0x20318d){_0x1495be(_0x20318d);});});}function getAgents(_0x33afc4,_0x3e33dc){return new BPromise(function(_0x563a72,_0x3f7f2a){return db[_0x33afc4][_0xf20d('0x53')]({'where':{'id':_0x3e33dc}})[_0xf20d('0x26')](function(_0x496ced){return _0x496ced[_0xf20d('0x5f')]({'attributes':['id'],'raw':!![]})[_0xf20d('0x26')](function(_0x5d9414){var _0x47c0aa=_[_0xf20d('0x60')](_0x5d9414,'id');_0x563a72(_0x47c0aa);});})['catch'](function(_0x1def6c){_0x3f7f2a(_0x1def6c);});});} \ No newline at end of file +var _0x5f61=['mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','ValidationError','faxqueue','mailqueue','smsqueue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId','join','transaction','Notification','forEach','recipient','emit','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','queue','replace','Queue','ids','push','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x40f6e3,_0x17073a){var _0x146eb4=function(_0x443377){while(--_0x443377){_0x40f6e3['push'](_0x40f6e3['shift']());}};_0x146eb4(++_0x17073a);}(_0x5f61,0xa7));var _0x15f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f61[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x15f6('0x0'));var emlformat=require(_0x15f6('0x1'));var rimraf=require(_0x15f6('0x2'));var zipdir=require(_0x15f6('0x3'));var jsonpatch=require(_0x15f6('0x4'));var rp=require(_0x15f6('0x5'));var moment=require('moment');var BPromise=require(_0x15f6('0x6'));var Mustache=require(_0x15f6('0x7'));var util=require(_0x15f6('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x15f6('0x9'));var ejs=require(_0x15f6('0xa'));var fs=require('fs');var _=require(_0x15f6('0xb'));var squel=require('squel');var crypto=require(_0x15f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x15f6('0xe'));var Papa=require('papaparse');var Redis=require(_0x15f6('0xf'));var authService=require(_0x15f6('0x10'));var qs=require(_0x15f6('0x11'));var as=require(_0x15f6('0x12'));var hardwareService=require(_0x15f6('0x13'));var logger=require(_0x15f6('0x14'))(_0x15f6('0x15'));var utils=require(_0x15f6('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x15f6('0x17')]=_[_0x15f6('0x18')](config[_0x15f6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x15f6('0x19'))(new Redis(config['redis']));require(_0x15f6('0x1a'))[_0x15f6('0x1b')](socket);function respondWithStatusCode(_0x1bf34c,_0x3eba64){_0x3eba64=_0x3eba64||0xcc;return function(_0x1723d0){if(_0x1723d0){return _0x1bf34c[_0x15f6('0x1c')](_0x3eba64);}return _0x1bf34c[_0x15f6('0x1d')](_0x3eba64)[_0x15f6('0x1e')]();};}function respondWithResult(_0x4b5d66,_0x406ae6){_0x406ae6=_0x406ae6||0xc8;return function(_0x14c750){if(_0x14c750){return _0x4b5d66['status'](_0x406ae6)['json'](_0x14c750);}};}function respondWithFilteredResult(_0x4dbba9,_0x37e65f){return function(_0x399cc8){if(_0x399cc8){var _0x2d5dd7=_0x399cc8[_0x15f6('0x1f')],_0x4770dd=_0x37e65f[_0x15f6('0x20')],_0x1f8ed3=_0x37e65f[_0x15f6('0x20')]+_0x37e65f[_0x15f6('0x21')],_0x2f61cb;if(_0x1f8ed3>=_0x2d5dd7){_0x1f8ed3=_0x2d5dd7;_0x2f61cb=0xc8;}else{_0x2f61cb=0xce;}_0x4dbba9[_0x15f6('0x1d')](_0x2f61cb);return _0x4dbba9[_0x15f6('0x22')](_0x15f6('0x23'),_0x4770dd+'-'+_0x1f8ed3+'/'+_0x2d5dd7)[_0x15f6('0x24')](_0x399cc8);}return null;};}function patchUpdates(_0x413556){return function(_0x274ef5){try{jsonpatch[_0x15f6('0x25')](_0x274ef5,_0x413556,!![]);}catch(_0x3d9069){return BPromise['reject'](_0x3d9069);}return _0x274ef5['save']();};}function saveUpdates(_0x3a0a4b,_0x31755f){return function(_0x5a7394){if(_0x5a7394){return _0x5a7394[_0x15f6('0x26')](_0x3a0a4b)[_0x15f6('0x27')](function(_0x51f6c0){return _0x51f6c0;});}return null;};}function removeEntity(_0x3e9ee8,_0x484206){return function(_0x11d28e){if(_0x11d28e){return _0x11d28e[_0x15f6('0x28')]()[_0x15f6('0x27')](function(){_0x3e9ee8[_0x15f6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229586,_0xc6fba7){return function(_0x1430ac){if(!_0x1430ac){_0x229586[_0x15f6('0x1c')](0x194);}return _0x1430ac;};}function handleError(_0x297233,_0x1134c0){_0x1134c0=_0x1134c0||0x1f4;return function(_0x432146){logger[_0x15f6('0x29')](_0x432146[_0x15f6('0x2a')]);if(_0x432146['name']){delete _0x432146[_0x15f6('0x2b')];}_0x297233[_0x15f6('0x1d')](_0x1134c0)[_0x15f6('0x2c')](_0x432146);};}exports[_0x15f6('0x2d')]=function(_0x9de652,_0x20c965,_0x52f1fd){if(!_0x9de652['body'][_0x15f6('0x2e')](_0x15f6('0x2f'))&&!_0x9de652[_0x15f6('0x30')][_0x15f6('0x2e')](_0x15f6('0x31'))){throw new db[(_0x15f6('0x32'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x9de652[_0x15f6('0x30')][_0x15f6('0x2e')](_0x15f6('0x31'))&&!_0x9de652[_0x15f6('0x30')][_0x15f6('0x2e')](_0x15f6('0x33'))){throw new db[(_0x15f6('0x32'))]['ValidationError'](_0x15f6('0x34'));}if(!_0x9de652[_0x15f6('0x30')]['hasOwnProperty']('recipients')){throw new db[(_0x15f6('0x32'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x23f7b1=JSON[_0x15f6('0x35')](_0x9de652['body'][_0x15f6('0x36')]);}catch(_0xac67dc){logger[_0x15f6('0x29')](_0xac67dc);throw new db[(_0x15f6('0x32'))][(_0x15f6('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x451600=['chatqueue',_0x15f6('0x38'),_0x15f6('0x39'),'openchannelqueue',_0x15f6('0x3a'),'voicequeue',_0x15f6('0x3b'),'team','user'];if(_[_0x15f6('0x3c')](_0x23f7b1,function(_0x1714ed){return!_[_0x15f6('0x3d')](_0x451600,_0x1714ed[_0x15f6('0x3e')][_0x15f6('0x3f')]());})){throw new db[(_0x15f6('0x32'))][(_0x15f6('0x37'))](_0x15f6('0x40'));}}}var _0x3a6ad1={};_0x3a6ad1['senderName']=_0x9de652['body'][_0x15f6('0x2e')](_0x15f6('0x41'))?_0x9de652[_0x15f6('0x30')][_0x15f6('0x41')]:_0x9de652[_0x15f6('0x42')]['fullname'];_0x3a6ad1[_0x15f6('0x43')]=_['isEmpty'](_0x9de652['body'][_0x15f6('0x43')])?null:_0x9de652[_0x15f6('0x30')][_0x15f6('0x43')];_0x3a6ad1[_0x15f6('0x44')]=_0x9de652[_0x15f6('0x30')][_0x15f6('0x44')]||![];_0x3a6ad1[_0x15f6('0x45')]=_0x9de652['user']['id'];return getContent(_0x9de652['body'])['then'](function(_0x86861){_0x3a6ad1[_0x15f6('0x30')]=_0x86861;return getRecipients(_0x23f7b1);})[_0x15f6('0x27')](function(_0x36ea87){_0x3a6ad1['recipientsId']=_['sortBy'](_0x36ea87)[_0x15f6('0x46')](',');return db['sequelize'][_0x15f6('0x47')](function(_0x2169f8){return db[_0x15f6('0x48')]['create'](_0x3a6ad1,{'raw':!![],'transaction':_0x2169f8})[_0x15f6('0x27')](function(_0x523aa0){var _0x530f95={'sender':_0x3a6ad1[_0x15f6('0x41')],'description':_0x3a6ad1[_0x15f6('0x43')],'content':_0x3a6ad1[_0x15f6('0x30')],'beep':_0x3a6ad1['beep']};_0x36ea87[_0x15f6('0x49')](function(_0x417861){_0x530f95[_0x15f6('0x4a')]=_0x417861;socket[_0x15f6('0x4b')]('notification:send',_0x530f95);});return _0x523aa0;});});})[_0x15f6('0x27')](respondWithResult(_0x20c965,0xc9))[_0x15f6('0x4c')](handleError(_0x20c965,null));};function getContent(_0x3a2bea){return new BPromise(function(_0x1e0daf,_0x7f63ac){if(_0x3a2bea['text']){_0x1e0daf(_0x3a2bea[_0x15f6('0x2f')]);return;}return db['Template']['findOne']({'attributes':[_0x15f6('0x4d')],'where':{'id':_0x3a2bea['TemplateId']},'raw':!![]})[_0x15f6('0x27')](function(_0x22bb5b){if(!_0x22bb5b)throw new db[(_0x15f6('0x32'))][(_0x15f6('0x37'))](_0x15f6('0x4e'));var _0x3bf131=Mustache[_0x15f6('0x4f')](_0x22bb5b[_0x15f6('0x4d')],_0x3a2bea[_0x15f6('0x33')]);_0x1e0daf(_0x3bf131);})[_0x15f6('0x4c')](function(_0x114d58){_0x7f63ac(_0x114d58);});});}function getRecipients(_0x36d84d){return new BPromise(function(_0x1c87fb,_0x2265e9){var _0x193714=[];var _0xf1c346=[];_0x36d84d['forEach'](function(_0x4e6d8c){var _0x49bb26=_['startCase'](_0x4e6d8c[_0x15f6('0x3e')][_0x15f6('0x3f')]());if(_0x49bb26==='User'){_0x193714=_[_0x15f6('0x50')](_0x193714,_0x4e6d8c['ids']);}else{if(_[_0x15f6('0x3d')](_0x49bb26,_0x15f6('0x51')))_0x49bb26=_0x49bb26[_0x15f6('0x52')](_0x15f6('0x51'),_0x15f6('0x53'));_0x4e6d8c[_0x15f6('0x54')]['forEach'](function(_0x4ef91b){_0xf1c346[_0x15f6('0x55')](getAgents(_0x49bb26,_0x4ef91b));});}});return BPromise['all'](_0xf1c346)[_0x15f6('0x27')](function(_0x46f687){_0x193714=_[_0x15f6('0x50')](_0x193714,_['flatten'](_0x46f687));_0x1c87fb(_0x193714);})[_0x15f6('0x4c')](function(_0x2eea5e){_0x2265e9(_0x2eea5e);});});}function getAgents(_0x491480,_0x4655cb){return new BPromise(function(_0x4108e3,_0x56c3a9){return db[_0x491480][_0x15f6('0x56')]({'where':{'id':_0x4655cb}})['then'](function(_0x3cc6f7){return _0x3cc6f7['getAgents']({'attributes':['id'],'raw':!![]})[_0x15f6('0x27')](function(_0x9da89a){var _0x2b37c5=_['map'](_0x9da89a,'id');_0x4108e3(_0x2b37c5);});})[_0x15f6('0x4c')](function(_0x344515){_0x56c3a9(_0x344515);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 44774b4..142c83b 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x31f346,_0x1f8066){var _0x3ba637=function(_0x4e5b65){while(--_0x4e5b65){_0x31f346['push'](_0x31f346['shift']());}};_0x3ba637(++_0x1f8066);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x253cbf,_0x3d20b8){var _0xde8646=function(_0x1bd048){while(--_0x1bd048){_0x253cbf['push'](_0x253cbf['shift']());}};_0xde8646(++_0x3d20b8);}(_0xdb28,0x106));var _0x8db2=function(_0x645813,_0x14e1e8){_0x645813=_0x645813-0x0;var _0x23e673=_0xdb28[_0x645813];return _0x23e673;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 82b221d..82737dd 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 _0xd4a2=['path','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd4a2,0x173));var _0x2d4a=function(_0x255907,_0x43fdca){_0x255907=_0x255907-0x0;var _0x4e69f7=_0xd4a2[_0x255907];return _0x4e69f7;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d4a('0x9'),'collate':_0x2d4a('0xa')});}; \ No newline at end of file +var _0x3266=['notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./notification.attributes','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3266,0x6a));var _0x6326=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x3266[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('Notification',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6326('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 5aed51b..7d1c3cc 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 _0x4b72=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','Notification,\x20%s,\x20%s','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b72,0xd4));var _0x24b7=function(_0x2f6ee1,_0x238cc9){_0x2f6ee1=_0x2f6ee1-0x0;var _0xdcf61b=_0x4b72[_0x2f6ee1];return _0xdcf61b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x24b7('0x0'));var fs=require('fs');var Redis=require(_0x24b7('0x1'));var db=require(_0x24b7('0x2'))['db'];var utils=require(_0x24b7('0x3'));var logger=require('../../config/logger')(_0x24b7('0x4'));var config=require(_0x24b7('0x5'));var jayson=require(_0x24b7('0x6'));var client=jayson[_0x24b7('0x7')][_0x24b7('0x8')]({'port':0x232a});config['redis']=_[_0x24b7('0x9')](config[_0x24b7('0xa')],{'host':_0x24b7('0xb'),'port':0x18eb});var socket=require(_0x24b7('0xc'))(new Redis(config[_0x24b7('0xa')]));require(_0x24b7('0xd'))[_0x24b7('0xe')](socket);function respondWithRpcPromise(_0x4957dc,_0x53b609,_0x3e224){return new BPromise(function(_0x14fc28,_0x1263a5){return client[_0x24b7('0xf')](_0x4957dc,_0x3e224)[_0x24b7('0x10')](function(_0x2e6dfd){logger[_0x24b7('0x11')]('Notification,\x20%s,\x20%s',_0x53b609,_0x24b7('0x12'));logger[_0x24b7('0x13')](_0x24b7('0x14'),_0x53b609,_0x24b7('0x12'),JSON[_0x24b7('0x15')](_0x2e6dfd));if(_0x2e6dfd[_0x24b7('0x16')]){if(_0x2e6dfd[_0x24b7('0x16')][_0x24b7('0x17')]===0x1f4){logger[_0x24b7('0x16')](_0x24b7('0x18'),_0x53b609,_0x2e6dfd[_0x24b7('0x16')][_0x24b7('0x19')]);return _0x1263a5(_0x2e6dfd[_0x24b7('0x16')][_0x24b7('0x19')]);}logger[_0x24b7('0x16')](_0x24b7('0x18'),_0x53b609,_0x2e6dfd[_0x24b7('0x16')][_0x24b7('0x19')]);return _0x14fc28(_0x2e6dfd[_0x24b7('0x16')][_0x24b7('0x19')]);}else{logger[_0x24b7('0x11')](_0x24b7('0x18'),_0x53b609,_0x24b7('0x12'));_0x14fc28(_0x2e6dfd['result']['message']);}})[_0x24b7('0x1a')](function(_0x3a63f0){logger[_0x24b7('0x16')]('Notification,\x20%s,\x20%s',_0x53b609,_0x3a63f0);_0x1263a5(_0x3a63f0);});});} \ No newline at end of file +var _0x9266=['debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./notification.socket','register','request','then','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x2c1a96,_0x91beb7){var _0x4f0a6f=function(_0x5a447a){while(--_0x5a447a){_0x2c1a96['push'](_0x2c1a96['shift']());}};_0x4f0a6f(++_0x91beb7);}(_0x9266,0x19d));var _0x6926=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x9266[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require('lodash');var util=require(_0x6926('0x0'));var moment=require(_0x6926('0x1'));var BPromise=require(_0x6926('0x2'));var rs=require(_0x6926('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6926('0x4'))['db'];var utils=require(_0x6926('0x5'));var logger=require(_0x6926('0x6'))(_0x6926('0x7'));var config=require(_0x6926('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6926('0x9')][_0x6926('0xa')]({'port':0x232a});config[_0x6926('0xb')]=_['defaults'](config[_0x6926('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6926('0xc'))(new Redis(config['redis']));require(_0x6926('0xd'))[_0x6926('0xe')](socket);function respondWithRpcPromise(_0x2f8618,_0x514916,_0x264281){return new BPromise(function(_0x98d1ef,_0x253fdf){return client[_0x6926('0xf')](_0x2f8618,_0x264281)[_0x6926('0x10')](function(_0x459c3f){logger['info'](_0x6926('0x11'),_0x514916,_0x6926('0x12'));logger[_0x6926('0x13')](_0x6926('0x14'),_0x514916,'request\x20sent',JSON[_0x6926('0x15')](_0x459c3f));if(_0x459c3f[_0x6926('0x16')]){if(_0x459c3f[_0x6926('0x16')][_0x6926('0x17')]===0x1f4){logger[_0x6926('0x16')](_0x6926('0x11'),_0x514916,_0x459c3f[_0x6926('0x16')][_0x6926('0x18')]);return _0x253fdf(_0x459c3f[_0x6926('0x16')][_0x6926('0x18')]);}logger['error'](_0x6926('0x11'),_0x514916,_0x459c3f[_0x6926('0x16')][_0x6926('0x18')]);return _0x98d1ef(_0x459c3f['error'][_0x6926('0x18')]);}else{logger[_0x6926('0x19')](_0x6926('0x11'),_0x514916,_0x6926('0x12'));_0x98d1ef(_0x459c3f[_0x6926('0x1a')][_0x6926('0x18')]);}})['catch'](function(_0x14f5b8){logger['error'](_0x6926('0x11'),_0x514916,_0x14f5b8);_0x253fdf(_0x14f5b8);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 997d2b1..3fa9196 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 _0x6312=['notification:','save','remove','update','emit','removeListener','register','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6312,0xc9));var _0x2631=function(_0x3424dc,_0xdc20f4){_0x3424dc=_0x3424dc-0x0;var _0x17a223=_0x6312[_0x3424dc];return _0x17a223;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x2631('0x0'),_0x2631('0x1'),_0x2631('0x2')];function createListener(_0x27886c,_0x94b83f){return function(_0x56867c){_0x94b83f[_0x2631('0x3')](_0x27886c,_0x56867c);};}function removeListener(_0x3eced1,_0x2ccbc4){return function(){NotificationEvents[_0x2631('0x4')](_0x3eced1,_0x2ccbc4);};}exports[_0x2631('0x5')]=function(_0x4ed507){for(var _0x586aac=0x0,_0x43d2b5=events[_0x2631('0x6')];_0x586aac<_0x43d2b5;_0x586aac++){var _0x3ef305=events[_0x586aac];var _0x4a2fb8=createListener(_0x2631('0x7')+_0x3ef305,_0x4ed507);NotificationEvents['on'](_0x3ef305,_0x4a2fb8);}}; \ No newline at end of file +var _0x265f=['./notification.events','save','update','removeListener','length','notification:'];(function(_0x147b2a,_0x1fb37f){var _0x26e867=function(_0x2d29b6){while(--_0x2d29b6){_0x147b2a['push'](_0x147b2a['shift']());}};_0x26e867(++_0x1fb37f);}(_0x265f,0x198));var _0xf265=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0x265f[_0x409fb8];return _0x278270;};'use strict';var NotificationEvents=require(_0xf265('0x0'));var events=[_0xf265('0x1'),'remove',_0xf265('0x2')];function createListener(_0x409263,_0x42d317){return function(_0x91a67f){_0x42d317['emit'](_0x409263,_0x91a67f);};}function removeListener(_0x573161,_0x12227d){return function(){NotificationEvents[_0xf265('0x3')](_0x573161,_0x12227d);};}exports['register']=function(_0x41d0c3){for(var _0x33941d=0x0,_0x136c53=events[_0xf265('0x4')];_0x33941d<_0x136c53;_0x33941d++){var _0x5e9c62=events[_0x33941d];var _0x1ca4b5=createListener(_0xf265('0x5')+_0x5e9c62,_0x41d0c3);NotificationEvents['on'](_0x5e9c62,_0x1ca4b5);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7873446..62f6229 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 _0x389e=['./openchannelAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','post','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x27a793,_0xfc53dd){var _0x57e29c=function(_0x49255e){while(--_0x49255e){_0x27a793['push'](_0x27a793['shift']());}};_0x57e29c(++_0xfc53dd);}(_0x389e,0x122));var _0xe389=function(_0x6c31b7,_0x3d1226){_0x6c31b7=_0x6c31b7-0x0;var _0x16a386=_0x389e[_0x6c31b7];return _0x16a386;};'use strict';var multer=require(_0xe389('0x0'));var util=require(_0xe389('0x1'));var path=require(_0xe389('0x2'));var timeout=require(_0xe389('0x3'));var express=require('express');var router=express[_0xe389('0x4')]();var auth=require(_0xe389('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe389('0x6'));var controller=require(_0xe389('0x7'));router[_0xe389('0x8')]('/',auth[_0xe389('0x9')](),controller[_0xe389('0xa')]);router[_0xe389('0x8')]('/describe',auth[_0xe389('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe389('0xb')]);router[_0xe389('0x8')](_0xe389('0xc'),auth[_0xe389('0x9')](),controller['getDispositions']);router[_0xe389('0x8')]('/:id/canned_answers',auth[_0xe389('0x9')](),controller['getAnswers']);router['get'](_0xe389('0xd'),auth['isAuthenticated'](),controller[_0xe389('0xe')]);router[_0xe389('0x8')](_0xe389('0xf'),auth['isAuthenticated'](),controller[_0xe389('0x10')]);router[_0xe389('0x8')]('/:id/users',auth[_0xe389('0x9')](),controller['getAgents']);router[_0xe389('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe389('0x11')](_0xe389('0xc'),auth[_0xe389('0x9')](),controller['addDisposition']);router['post'](_0xe389('0x12'),auth['isAuthenticated'](),controller[_0xe389('0x13')]);router[_0xe389('0x11')](_0xe389('0x14'),controller[_0xe389('0x15')]);router['post'](_0xe389('0xd'),auth[_0xe389('0x9')](),controller[_0xe389('0x16')]);router['post'](_0xe389('0x17'),auth[_0xe389('0x9')](),controller[_0xe389('0x18')]);router[_0xe389('0x11')](_0xe389('0x19'),auth['isAuthenticated'](),controller[_0xe389('0x1a')]);router['put'](_0xe389('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0xe389('0x1c')](_0xe389('0x1b'),auth[_0xe389('0x9')](),controller[_0xe389('0x1d')]);router[_0xe389('0x1c')](_0xe389('0xc'),auth[_0xe389('0x9')](),controller[_0xe389('0x1e')]);router[_0xe389('0x1c')](_0xe389('0x12'),auth[_0xe389('0x9')](),controller[_0xe389('0x1f')]);router[_0xe389('0x1c')](_0xe389('0x17'),auth['isAuthenticated'](),controller[_0xe389('0x20')]);module['exports']=router; \ No newline at end of file +var _0xe51a=['Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','send','put','update','destroy','delete','removeDispositions','removeAnswers','path','connect-timeout','express'];(function(_0x1d1d20,_0x340a81){var _0x4038d7=function(_0x1a3810){while(--_0x1a3810){_0x1d1d20['push'](_0x1d1d20['shift']());}};_0x4038d7(++_0x340a81);}(_0xe51a,0x14a));var _0xae51=function(_0x4ac015,_0x6c5037){_0x4ac015=_0x4ac015-0x0;var _0x990a01=_0xe51a[_0x4ac015];return _0x990a01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae51('0x0'));var timeout=require(_0xae51('0x1'));var express=require(_0xae51('0x2'));var router=express[_0xae51('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xae51('0x4'));var config=require(_0xae51('0x5'));var controller=require(_0xae51('0x6'));router[_0xae51('0x7')]('/',auth['isAuthenticated'](),controller[_0xae51('0x8')]);router[_0xae51('0x7')](_0xae51('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xae51('0x7')](_0xae51('0xa'),auth[_0xae51('0xb')](),controller[_0xae51('0xc')]);router['get'](_0xae51('0xd'),auth[_0xae51('0xb')](),controller['getDispositions']);router[_0xae51('0x7')]('/:id/canned_answers',auth[_0xae51('0xb')](),controller[_0xae51('0xe')]);router[_0xae51('0x7')](_0xae51('0xf'),auth[_0xae51('0xb')](),controller[_0xae51('0x10')]);router[_0xae51('0x7')](_0xae51('0x11'),auth[_0xae51('0xb')](),controller[_0xae51('0x12')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xae51('0x13')]);router[_0xae51('0x14')]('/',auth[_0xae51('0xb')](),controller[_0xae51('0x15')]);router['post'](_0xae51('0xd'),auth[_0xae51('0xb')](),controller[_0xae51('0x16')]);router[_0xae51('0x14')](_0xae51('0x17'),auth[_0xae51('0xb')](),controller[_0xae51('0x18')]);router[_0xae51('0x14')](_0xae51('0x19'),controller[_0xae51('0x1a')]);router['post'](_0xae51('0xf'),auth[_0xae51('0xb')](),controller[_0xae51('0x1b')]);router[_0xae51('0x14')](_0xae51('0x1c'),auth[_0xae51('0xb')](),controller[_0xae51('0x1d')]);router[_0xae51('0x14')]('/:id/send',auth[_0xae51('0xb')](),controller[_0xae51('0x1e')]);router[_0xae51('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0xae51('0x20')]);router['delete'](_0xae51('0xa'),auth[_0xae51('0xb')](),controller[_0xae51('0x21')]);router[_0xae51('0x22')](_0xae51('0xd'),auth[_0xae51('0xb')](),controller[_0xae51('0x23')]);router[_0xae51('0x22')](_0xae51('0x17'),auth['isAuthenticated'](),controller[_0xae51('0x24')]);router[_0xae51('0x22')](_0xae51('0x1c'),auth[_0xae51('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 867d2d0..ff6aa11 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 _0xe312=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','TEXT'];(function(_0x181a26,_0x37982c){var _0x4f7014=function(_0x45b796){while(--_0x45b796){_0x181a26['push'](_0x181a26['shift']());}};_0x4f7014(++_0x37982c);}(_0xe312,0xbd));var _0x2e31=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xe312[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x2e31('0x0'));var rs=require(_0x2e31('0x1'));module[_0x2e31('0x2')]={'name':{'type':Sequelize[_0x2e31('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2e31('0x3')]},'token':{'type':Sequelize[_0x2e31('0x3')],'defaultValue':function(){return rs[_0x2e31('0x4')]();}},'replyUri':{'type':Sequelize[_0x2e31('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2e31('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2e31('0x5')],'defaultValue':function(){return _0x2e31('0x6');}},'notificationSound':{'type':Sequelize[_0x2e31('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e31('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2e31('0x3')]},'queueTransfer':{'type':Sequelize[_0x2e31('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e31('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2e31('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2e31('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2e31('0xa'),'set':function(_0x215f4e){if(!_0x215f4e)this[_0x2e31('0xb')](_0x2e31('0xc'),null);this[_0x2e31('0xb')]('mandatoryDisposition',_0x215f4e);}}}; \ No newline at end of file +var _0x9f04=['mandatoryDisposition','sequelize','randomstring','exports','STRING','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x41e73e,_0x4c6df5){var _0x4185b3=function(_0x337b42){while(--_0x337b42){_0x41e73e['push'](_0x41e73e['shift']());}};_0x4185b3(++_0x4c6df5);}(_0x9f04,0x19b));var _0x49f0=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x9f04[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require(_0x49f0('0x0'));var rs=require(_0x49f0('0x1'));module[_0x49f0('0x2')]={'name':{'type':Sequelize[_0x49f0('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x49f0('0x3')]},'token':{'type':Sequelize[_0x49f0('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x49f0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x49f0('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49f0('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x49f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x49f0('0x3')]},'queueTransfer':{'type':Sequelize[_0x49f0('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49f0('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49f0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x49f0('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x49f0('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50fcbd){if(!_0x50fcbd)this[_0x49f0('0x8')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x49f0('0x9'),_0x50fcbd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 03317bb..aa24783 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 _0x89d7=['findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','tag','addAgents','emit','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','push','html-pdf','eml-format','zip-dir','request-promise','moment','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','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','Sequelize','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','sendStatus','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','hasOwnProperty','map','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','no\x20available\x20attributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','CmList','CmContact','Contacts','DESC','account','applications','List','orderBy','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x89d7,0x185));var _0x789d=function(_0x46a14f,_0x46ca40){_0x46a14f=_0x46a14f-0x0;var _0x4e26f9=_0x89d7[_0x46a14f];return _0x4e26f9;};'use strict';var pdf=require(_0x789d('0x0'));var emlformat=require(_0x789d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x789d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x789d('0x3'));var moment=require(_0x789d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x789d('0x5'));var path=require(_0x789d('0x6'));var sox=require(_0x789d('0x7'));var csv=require(_0x789d('0x8'));var ejs=require(_0x789d('0x9'));var fs=require('fs');var _=require(_0x789d('0xa'));var squel=require(_0x789d('0xb'));var crypto=require(_0x789d('0xc'));var jsforce=require(_0x789d('0xd'));var deskjs=require(_0x789d('0xe'));var toCsv=require(_0x789d('0x8'));var querystring=require(_0x789d('0xf'));var Papa=require(_0x789d('0x10'));var Redis=require(_0x789d('0x11'));var authService=require(_0x789d('0x12'));var qs=require(_0x789d('0x13'));var as=require(_0x789d('0x14'));var hardwareService=require(_0x789d('0x15'));var logger=require(_0x789d('0x16'))(_0x789d('0x17'));var utils=require(_0x789d('0x18'));var config=require('../../config/environment');var db=require(_0x789d('0x19'))['db'];config[_0x789d('0x1a')]=_[_0x789d('0x1b')](config[_0x789d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x789d('0x1c'))(new Redis(config[_0x789d('0x1a')]));require('./openchannelAccount.socket')[_0x789d('0x1d')](socket);var jayson=require(_0x789d('0x1e'));var client=jayson['client'][_0x789d('0x1f')]({'port':0x232c});var client9002=jayson[_0x789d('0x20')][_0x789d('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x29d18a,_0x340058,_0x5b8e84){if(_0x5b8e84){var _0x1618e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1618e6['test'](_0x340058)){return _0x29d18a;}else{throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x29d18a;}}function respondWithRpcPromise(_0x208094,_0x3814ad,_0x421be0,_0x11f5d8){return new BPromise(function(_0x6020d0,_0x222cd1){var _0x38a41e=_0x11f5d8||client;return _0x38a41e[_0x789d('0x23')](_0x208094,_0x421be0)[_0x789d('0x24')](function(_0x2c6f30){logger[_0x789d('0x25')](_0x789d('0x26'),_0x3814ad,_0x789d('0x27'));logger[_0x789d('0x28')](_0x789d('0x29'),_0x3814ad,_0x789d('0x27'),JSON['stringify'](_0x2c6f30));if(_0x2c6f30[_0x789d('0x2a')]){if(_0x2c6f30[_0x789d('0x2a')][_0x789d('0x2b')]===0x1f4){logger[_0x789d('0x2a')](_0x789d('0x26'),_0x3814ad,_0x2c6f30[_0x789d('0x2a')]['message']);return _0x222cd1(_0x2c6f30[_0x789d('0x2a')][_0x789d('0x2c')]);}logger['error'](_0x789d('0x26'),_0x3814ad,_0x2c6f30['error'][_0x789d('0x2c')]);return _0x6020d0(_0x2c6f30['error'][_0x789d('0x2c')]);}else{logger[_0x789d('0x25')](_0x789d('0x26'),_0x3814ad,_0x789d('0x27'));_0x6020d0(_0x2c6f30[_0x789d('0x2d')][_0x789d('0x2c')]);}})[_0x789d('0x2e')](function(_0x2e1eeb){logger[_0x789d('0x2a')](_0x789d('0x26'),_0x3814ad,_0x2e1eeb);_0x222cd1(_0x2e1eeb);});});}function respondWithStatusCode(_0x2cf44b,_0x14bdd2){_0x14bdd2=_0x14bdd2||0xcc;return function(_0x4489bf){if(_0x4489bf){return _0x2cf44b['sendStatus'](_0x14bdd2);}return _0x2cf44b['status'](_0x14bdd2)[_0x789d('0x2f')]();};}function respondWithResult(_0x804f71,_0x4b96db){_0x4b96db=_0x4b96db||0xc8;return function(_0x5c1ad8){if(_0x5c1ad8){return _0x804f71['status'](_0x4b96db)[_0x789d('0x30')](_0x5c1ad8);}};}function respondWithFilteredResult(_0x4d41b5,_0x46de70){return function(_0xcfdf3e){if(_0xcfdf3e){var _0x196072=_0xcfdf3e[_0x789d('0x31')],_0x8bc843=_0x46de70[_0x789d('0x32')],_0x25045d=_0x46de70['offset']+_0x46de70[_0x789d('0x33')],_0x342ac3;if(_0x25045d>=_0x196072){_0x25045d=_0x196072;_0x342ac3=0xc8;}else{_0x342ac3=0xce;}_0x4d41b5[_0x789d('0x34')](_0x342ac3);return _0x4d41b5[_0x789d('0x35')](_0x789d('0x36'),_0x8bc843+'-'+_0x25045d+'/'+_0x196072)[_0x789d('0x30')](_0xcfdf3e);}return null;};}function patchUpdates(_0x6671c2){return function(_0x4a0194){try{jsonpatch[_0x789d('0x37')](_0x4a0194,_0x6671c2,!![]);}catch(_0x218671){return BPromise[_0x789d('0x38')](_0x218671);}return _0x4a0194[_0x789d('0x39')]();};}function saveUpdates(_0x5f5816,_0x3ecd01){return function(_0x327b97){if(_0x327b97){return _0x327b97[_0x789d('0x3a')](_0x5f5816)[_0x789d('0x24')](function(_0x59e41f){return _0x59e41f;});}return null;};}function removeEntity(_0x46a4fe,_0x2937c8){return function(_0x254cc2){if(_0x254cc2){return _0x254cc2[_0x789d('0x3b')]()['then'](function(){var _0x1a4b29=_0x254cc2['get']({'plain':!![]});var _0x197033='OpenchannelAccounts';return db[_0x789d('0x3c')][_0x789d('0x3b')]({'where':{'type':_0x197033,'resourceId':_0x1a4b29['id']}})[_0x789d('0x24')](function(){return _0x254cc2;});})[_0x789d('0x24')](function(){_0x46a4fe[_0x789d('0x34')](0xcc)[_0x789d('0x2f')]();});}};}function handleEntityNotFound(_0x4e4ca9,_0x5186fc){return function(_0x4b37ec){if(!_0x4b37ec){_0x4e4ca9[_0x789d('0x3d')](0x194);}return _0x4b37ec;};}function handleError(_0x4e2836,_0x567abe){_0x567abe=_0x567abe||0x1f4;return function(_0x221d8a){logger[_0x789d('0x2a')](_0x221d8a['stack']);if(_0x221d8a['name']){delete _0x221d8a[_0x789d('0x3e')];}_0x4e2836['status'](_0x567abe)[_0x789d('0x3f')](_0x221d8a);};}exports[_0x789d('0x40')]=function(_0x1c0608,_0x367f72){var _0x237d88={'include':[{'model':db['Pause'],'as':_0x789d('0x41')}]},_0x38606={},_0x3e3834={'count':0x0,'rows':[]};var _0x3befb1=_['map'](db[_0x789d('0x42')][_0x789d('0x43')],function(_0x1914a2){return{'name':_0x1914a2['fieldName'],'type':_0x1914a2[_0x789d('0x44')][_0x789d('0x45')]};});_0x38606[_0x789d('0x46')]=_['map'](_0x3befb1,_0x789d('0x3e'));_0x38606[_0x789d('0x47')]=_[_0x789d('0x48')](_0x1c0608[_0x789d('0x47')]);_0x38606[_0x789d('0x49')]=_[_0x789d('0x4a')](_0x38606[_0x789d('0x46')],_0x38606[_0x789d('0x47')]);_0x237d88['attributes']=_[_0x789d('0x4a')](_0x38606[_0x789d('0x46')],qs[_0x789d('0x4b')](_0x1c0608[_0x789d('0x47')][_0x789d('0x4b')]));_0x237d88['attributes']=_0x237d88['attributes']['length']?_0x237d88[_0x789d('0x4c')]:_0x38606['model'];if(!_0x1c0608[_0x789d('0x47')]['hasOwnProperty'](_0x789d('0x4d'))){_0x237d88[_0x789d('0x33')]=qs[_0x789d('0x33')](_0x1c0608[_0x789d('0x47')]['limit']);_0x237d88[_0x789d('0x32')]=qs[_0x789d('0x32')](_0x1c0608['query'][_0x789d('0x32')]);}_0x237d88[_0x789d('0x4e')]=qs[_0x789d('0x4f')](_0x1c0608[_0x789d('0x47')]['sort']);_0x237d88[_0x789d('0x50')]=qs[_0x789d('0x49')](_[_0x789d('0x51')](_0x1c0608['query'],_0x38606['filters']),_0x3befb1);if(_0x1c0608[_0x789d('0x47')][_0x789d('0x52')]){_0x237d88[_0x789d('0x50')]=_[_0x789d('0x53')](_0x237d88[_0x789d('0x50')],{'$or':_['map'](_0x3befb1,function(_0x49991b){if(_0x49991b['type']!==_0x789d('0x54')){var _0x4950e0={};_0x4950e0[_0x49991b[_0x789d('0x3e')]]={'$like':'%'+_0x1c0608[_0x789d('0x47')]['filter']+'%'};return _0x4950e0;}})});}_0x237d88=_[_0x789d('0x53')]({},_0x237d88,_0x1c0608[_0x789d('0x55')]);var _0x4aae56={'where':_0x237d88[_0x789d('0x50')]};return db[_0x789d('0x42')]['count'](_0x4aae56)['then'](function(_0x10f7d0){_0x3e3834['count']=_0x10f7d0;if(_0x1c0608[_0x789d('0x47')][_0x789d('0x56')]){_0x237d88[_0x789d('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x789d('0x58')](_0x237d88);})['then'](function(_0xf17f7e){_0x3e3834[_0x789d('0x59')]=_0xf17f7e;return _0x3e3834;})[_0x789d('0x24')](respondWithFilteredResult(_0x367f72,_0x237d88))[_0x789d('0x2e')](handleError(_0x367f72,null));};exports[_0x789d('0x5a')]=function(_0x12e2bc,_0x2d7b76){var _0x32ee3c={'raw':![],'where':{'id':_0x12e2bc[_0x789d('0x5b')]['id']},'include':[{'model':db[_0x789d('0x5c')],'as':_0x789d('0x41')}]},_0x29e6c3={};_0x29e6c3[_0x789d('0x46')]=_[_0x789d('0x48')](db[_0x789d('0x42')][_0x789d('0x43')]);_0x29e6c3[_0x789d('0x47')]=_['keys'](_0x12e2bc[_0x789d('0x47')]);_0x29e6c3['filters']=_[_0x789d('0x4a')](_0x29e6c3[_0x789d('0x46')],_0x29e6c3[_0x789d('0x47')]);_0x32ee3c[_0x789d('0x4c')]=_[_0x789d('0x4a')](_0x29e6c3[_0x789d('0x46')],qs[_0x789d('0x4b')](_0x12e2bc[_0x789d('0x47')][_0x789d('0x4b')]));_0x32ee3c[_0x789d('0x4c')]=_0x32ee3c['attributes'][_0x789d('0x5d')]?_0x32ee3c[_0x789d('0x4c')]:_0x29e6c3['model'];if(_0x12e2bc[_0x789d('0x47')][_0x789d('0x56')]){_0x32ee3c[_0x789d('0x57')]=[{'all':!![]}];}_0x32ee3c=_[_0x789d('0x53')]({},_0x32ee3c,_0x12e2bc['options']);return db['OpenchannelAccount'][_0x789d('0x5e')](_0x32ee3c)[_0x789d('0x24')](handleEntityNotFound(_0x2d7b76,null))[_0x789d('0x24')](respondWithResult(_0x2d7b76,null))[_0x789d('0x2e')](handleError(_0x2d7b76,null));};exports[_0x789d('0x5f')]=function(_0x17c56a,_0x24ed4a){return db[_0x789d('0x42')][_0x789d('0x5f')](_0x17c56a['body'],{})[_0x789d('0x24')](function(_0x39dbf0){var _0x2bc199=_0x17c56a[_0x789d('0x60')][_0x789d('0x61')]({'plain':!![]});if(!_0x2bc199)throw new Error(_0x789d('0x62'));if(_0x2bc199[_0x789d('0x63')]===_0x789d('0x60')){var _0x3e43d1=_0x39dbf0[_0x789d('0x61')]({'plain':!![]});var _0x261c6f=_0x789d('0x64');return db[_0x789d('0x65')]['find']({'where':{'name':_0x261c6f,'userProfileId':_0x2bc199['userProfileId']},'raw':!![]})[_0x789d('0x24')](function(_0xae45bf){if(_0xae45bf&&_0xae45bf['autoAssociation']===0x0){return db[_0x789d('0x3c')][_0x789d('0x5f')]({'name':_0x3e43d1[_0x789d('0x3e')],'resourceId':_0x3e43d1['id'],'type':_0xae45bf['name'],'sectionId':_0xae45bf['id']},{})[_0x789d('0x24')](function(){return _0x39dbf0;});}else{return _0x39dbf0;}})[_0x789d('0x2e')](function(_0xb549ae){logger[_0x789d('0x2a')](_0x789d('0x66'),_0xb549ae);throw _0xb549ae;});}return _0x39dbf0;})['then'](respondWithResult(_0x24ed4a,0xc9))[_0x789d('0x2e')](handleError(_0x24ed4a,null));};exports['update']=function(_0x2b8efb,_0x257209){if(_0x2b8efb['body']['id']){delete _0x2b8efb[_0x789d('0x67')]['id'];}return db[_0x789d('0x42')]['find']({'where':{'id':_0x2b8efb[_0x789d('0x5b')]['id']},'include':[{'model':db[_0x789d('0x5c')],'as':_0x789d('0x41')}]})['then'](handleEntityNotFound(_0x257209,null))[_0x789d('0x24')](saveUpdates(_0x2b8efb[_0x789d('0x67')],null))['then'](respondWithResult(_0x257209,null))[_0x789d('0x2e')](handleError(_0x257209,null));};exports[_0x789d('0x3b')]=function(_0x31db67,_0x548aac){return db[_0x789d('0x42')][_0x789d('0x5e')]({'where':{'id':_0x31db67[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x548aac,null))[_0x789d('0x24')](removeEntity(_0x548aac,null))[_0x789d('0x2e')](handleError(_0x548aac,null));};exports[_0x789d('0x68')]=function(_0x486b3a,_0x65807d){return db[_0x789d('0x42')][_0x789d('0x68')]()['then'](respondWithResult(_0x65807d,null))[_0x789d('0x2e')](handleError(_0x65807d,null));};exports[_0x789d('0x69')]=function(_0x46fe4b,_0x2b236e,_0x5440a2){if(_0x46fe4b[_0x789d('0x67')]['id']){delete _0x46fe4b['body']['id'];}return db[_0x789d('0x42')]['find']({'where':{'id':_0x46fe4b[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x2b236e,null))[_0x789d('0x24')](function(_0x809e8a){if(_0x809e8a){_0x46fe4b[_0x789d('0x67')][_0x789d('0x6a')]=_0x809e8a['id'];return db[_0x789d('0x6b')][_0x789d('0x5f')](_0x46fe4b['body']);}})[_0x789d('0x24')](respondWithResult(_0x2b236e,null))[_0x789d('0x2e')](handleError(_0x2b236e,null));};exports[_0x789d('0x6c')]=function(_0xaf0dbf,_0x432e5c,_0x459cab){var _0x3af384={'raw':![],'where':{}};var _0x240ece={};var _0x8a1591={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xaf0dbf[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x432e5c,null))[_0x789d('0x24')](function(_0x2e0542){if(_0x2e0542){_0x240ece[_0x789d('0x46')]=_['keys'](db[_0x789d('0x6b')][_0x789d('0x43')]);_0x240ece[_0x789d('0x47')]=_[_0x789d('0x48')](_0xaf0dbf[_0x789d('0x47')]);_0x240ece[_0x789d('0x49')]=_['intersection'](_0x240ece['model'],_0x240ece['query']);_0x3af384[_0x789d('0x4c')]=_[_0x789d('0x4a')](_0x240ece[_0x789d('0x46')],qs['fields'](_0xaf0dbf['query'][_0x789d('0x4b')]));_0x3af384[_0x789d('0x4c')]=_0x3af384[_0x789d('0x4c')][_0x789d('0x5d')]?_0x3af384[_0x789d('0x4c')]:_0x240ece[_0x789d('0x46')];if(!_0xaf0dbf[_0x789d('0x47')][_0x789d('0x6d')](_0x789d('0x4d'))){_0x3af384['limit']=qs[_0x789d('0x33')](_0xaf0dbf['query'][_0x789d('0x33')]);_0x3af384[_0x789d('0x32')]=qs[_0x789d('0x32')](_0xaf0dbf['query'][_0x789d('0x32')]);}_0x3af384['order']=qs[_0x789d('0x4f')](_0xaf0dbf['query'][_0x789d('0x4f')]);_0x3af384[_0x789d('0x50')]=qs[_0x789d('0x49')](_[_0x789d('0x51')](_0xaf0dbf[_0x789d('0x47')],_0x240ece[_0x789d('0x49')]));_0x3af384[_0x789d('0x50')]['OpenchannelAccountId']=_0x2e0542['id'];if(_0xaf0dbf[_0x789d('0x47')][_0x789d('0x52')]){_0x3af384[_0x789d('0x50')]=_[_0x789d('0x53')](_0x3af384['where'],{'$or':_[_0x789d('0x6e')](_0x3af384['attributes'],function(_0x1ef831){var _0x1d8705={};_0x1d8705[_0x1ef831]={'$like':'%'+_0xaf0dbf[_0x789d('0x47')]['filter']+'%'};return _0x1d8705;})});}_0x3af384=_[_0x789d('0x53')]({},_0x3af384,_0xaf0dbf['options']);return db['Disposition'][_0x789d('0x31')]({'where':_0x3af384[_0x789d('0x50')]})[_0x789d('0x24')](function(_0x144f81){_0x8a1591[_0x789d('0x31')]=_0x144f81;if(_0xaf0dbf[_0x789d('0x47')][_0x789d('0x56')]){_0x3af384[_0x789d('0x57')]=[{'all':!![]}];}return db[_0x789d('0x6b')]['findAll'](_0x3af384);})[_0x789d('0x24')](function(_0x3b9ee9){_0x8a1591[_0x789d('0x59')]=_0x3b9ee9;return _0x8a1591;});}})[_0x789d('0x24')](respondWithFilteredResult(_0x432e5c,_0x3af384))[_0x789d('0x2e')](handleError(_0x432e5c,null));};exports[_0x789d('0x6f')]=function(_0x39aa20,_0x373197,_0x4846c9){return db[_0x789d('0x42')][_0x789d('0x5e')]({'where':{'id':_0x39aa20[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x373197,null))['then'](function(_0xc83e15){if(_0xc83e15){return _0xc83e15[_0x789d('0x6f')](_0x39aa20[_0x789d('0x47')][_0x789d('0x70')]);}})[_0x789d('0x24')](respondWithStatusCode(_0x373197,null))[_0x789d('0x2e')](handleError(_0x373197,null));};exports[_0x789d('0x71')]=function(_0x2e7b91,_0x57c7fe,_0x251589){if(_0x2e7b91[_0x789d('0x67')]['id']){delete _0x2e7b91[_0x789d('0x67')]['id'];}return db[_0x789d('0x42')]['find']({'where':{'id':_0x2e7b91[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x57c7fe,null))['then'](function(_0x466e73){if(_0x466e73){_0x2e7b91[_0x789d('0x67')][_0x789d('0x72')]=_0x466e73['id'];return db[_0x789d('0x73')][_0x789d('0x5f')](_0x2e7b91[_0x789d('0x67')]);}})[_0x789d('0x24')](respondWithResult(_0x57c7fe,null))[_0x789d('0x2e')](handleError(_0x57c7fe,null));};exports[_0x789d('0x74')]=function(_0x58b230,_0x3eb85b,_0x4eee74){var _0x4e7354={'raw':![],'where':{}};var _0x39efa={};var _0x117f23={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x789d('0x75')]({'where':{'id':_0x58b230[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x3eb85b,null))[_0x789d('0x24')](function(_0x33d275){if(_0x33d275){_0x39efa['model']=_[_0x789d('0x48')](db[_0x789d('0x73')]['rawAttributes']);_0x39efa['query']=_[_0x789d('0x48')](_0x58b230['query']);_0x39efa[_0x789d('0x49')]=_[_0x789d('0x4a')](_0x39efa[_0x789d('0x46')],_0x39efa[_0x789d('0x47')]);_0x4e7354[_0x789d('0x4c')]=_[_0x789d('0x4a')](_0x39efa[_0x789d('0x46')],qs[_0x789d('0x4b')](_0x58b230[_0x789d('0x47')][_0x789d('0x4b')]));_0x4e7354['attributes']=_0x4e7354[_0x789d('0x4c')][_0x789d('0x5d')]?_0x4e7354['attributes']:_0x39efa[_0x789d('0x46')];if(!_0x58b230[_0x789d('0x47')][_0x789d('0x6d')](_0x789d('0x4d'))){_0x4e7354[_0x789d('0x33')]=qs[_0x789d('0x33')](_0x58b230['query'][_0x789d('0x33')]);_0x4e7354[_0x789d('0x32')]=qs[_0x789d('0x32')](_0x58b230['query'][_0x789d('0x32')]);}_0x4e7354[_0x789d('0x4e')]=qs[_0x789d('0x4f')](_0x58b230[_0x789d('0x47')][_0x789d('0x4f')]);_0x4e7354['where']=qs[_0x789d('0x49')](_[_0x789d('0x51')](_0x58b230['query'],_0x39efa[_0x789d('0x49')]));_0x4e7354[_0x789d('0x50')][_0x789d('0x72')]=_0x33d275['id'];if(_0x58b230['query']['filter']){_0x4e7354[_0x789d('0x50')]=_['merge'](_0x4e7354[_0x789d('0x50')],{'$or':_[_0x789d('0x6e')](_0x4e7354['attributes'],function(_0x1a9a0e){var _0x1d89ff={};_0x1d89ff[_0x1a9a0e]={'$like':'%'+_0x58b230[_0x789d('0x47')][_0x789d('0x52')]+'%'};return _0x1d89ff;})});}_0x4e7354=_[_0x789d('0x53')]({},_0x4e7354,_0x58b230['options']);return db[_0x789d('0x73')][_0x789d('0x31')]({'where':_0x4e7354[_0x789d('0x50')]})[_0x789d('0x24')](function(_0x37f2a1){_0x117f23[_0x789d('0x31')]=_0x37f2a1;if(_0x58b230[_0x789d('0x47')][_0x789d('0x56')]){_0x4e7354[_0x789d('0x57')]=[{'all':!![]}];}return db[_0x789d('0x73')]['findAll'](_0x4e7354);})[_0x789d('0x24')](function(_0x504a9a){_0x117f23[_0x789d('0x59')]=_0x504a9a;return _0x117f23;});}})[_0x789d('0x24')](respondWithFilteredResult(_0x3eb85b,_0x4e7354))['catch'](handleError(_0x3eb85b,null));};exports[_0x789d('0x76')]=function(_0x89860f,_0x1e7eb8,_0x2297db){return db[_0x789d('0x42')]['find']({'where':{'id':_0x89860f[_0x789d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e7eb8,null))['then'](function(_0x41c9de){if(_0x41c9de){return _0x41c9de[_0x789d('0x76')](_0x89860f[_0x789d('0x47')]['ids']);}})[_0x789d('0x24')](respondWithStatusCode(_0x1e7eb8,null))[_0x789d('0x2e')](handleError(_0x1e7eb8,null));};exports[_0x789d('0x77')]=function(_0x65ad9,_0x452891,_0x38ca11){var _0x2aa9b9={'body':_0x65ad9[_0x789d('0x67')],'channel':_0x789d('0x78')};var _0x2c79d3=[];var _0x15350a=[];var _0x22e1b1={};var _0x5bb690=![];return db['CmContact'][_0x789d('0x68')]()[_0x789d('0x24')](function(_0x43910c){if(!_0x43910c){throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))](_0x789d('0x79'));}_0x2c79d3=_['difference'](_[_0x789d('0x48')](_0x43910c),[_0x789d('0x7a'),_0x789d('0x7b')]);_0x15350a=_['difference'](_[_0x789d('0x48')](_0x43910c),['createdAt',_0x789d('0x7b'),'CompanyId',_0x789d('0x7c')]);if(_0x65ad9['body']['id']){delete _0x65ad9[_0x789d('0x67')]['id'];}if(_[_0x789d('0x7d')](_0x65ad9[_0x789d('0x67')][_0x789d('0x7e')])){throw new db['Sequelize']['ValidationError'](_0x789d('0x7f'));}if(_[_0x789d('0x7d')](_0x65ad9[_0x789d('0x67')][_0x789d('0x67')])||_0x65ad9[_0x789d('0x67')][_0x789d('0x67')]===''){throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x65ad9['body'][_0x789d('0x80')])){throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15350a);}if(!_['includes'](_0x15350a,_0x65ad9[_0x789d('0x67')][_0x789d('0x80')])){throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15350a);}_0x22e1b1[_0x65ad9['body'][_0x789d('0x80')]]=_0x65ad9['body'][_0x789d('0x7e')];})['then'](function(){return db[_0x789d('0x42')][_0x789d('0x5e')]({'where':{'id':_0x65ad9[_0x789d('0x5b')]['id']},'include':[{'model':db[_0x789d('0x81')],'as':'List','include':[{'model':db[_0x789d('0x82')],'as':_0x789d('0x83'),'where':_0x22e1b1,'limit':0x1,'order':[['updatedAt',_0x789d('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x452891,null))['then'](function(_0x294720){if(_0x294720&&_0x294720['List']){_0x2aa9b9[_0x789d('0x85')]=_0x294720;_0x2aa9b9[_0x789d('0x86')]=_0x294720['Applications'];_0x2aa9b9['list']=_0x294720[_0x789d('0x87')];_0x2aa9b9[_0x789d('0x86')]=_[_0x789d('0x88')](_0x2aa9b9[_0x789d('0x86')],[_0x789d('0x89')],[_0x789d('0x8a')]);if(_0x2aa9b9['account']['Applications']){delete _0x2aa9b9[_0x789d('0x85')]['Applications'];}if(_0x2aa9b9['account']['List']&&_0x2aa9b9['account'][_0x789d('0x87')]['Contacts']['length']){return _0x2aa9b9[_0x789d('0x85')][_0x789d('0x87')][_0x789d('0x83')][0x0];}var _0x257b13=_[_0x789d('0x1b')](_0x65ad9[_0x789d('0x67')],{'firstName':_0x65ad9['body'][_0x789d('0x7e')],'ListId':_0x294720[_0x789d('0x7c')]});_0x257b13[_0x65ad9['body'][_0x789d('0x80')]]=_0x65ad9[_0x789d('0x67')]['from'];return db[_0x789d('0x82')][_0x789d('0x5f')](_0x257b13,{'fields':_0x2c79d3,'raw':!![]});}})[_0x789d('0x24')](handleEntityNotFound(_0x452891,null))[_0x789d('0x24')](function(_0x388939){_0x2aa9b9['contact']=_0x388939;if(_0x388939){var _0x26421c={'ContactId':_0x388939['id'],'OpenchannelAccountId':_0x65ad9[_0x789d('0x5b')]['id'],'from':(_0x388939[_0x789d('0x8b')]||'')+'\x20'+(_0x388939[_0x789d('0x8c')]||'')};var _0x26dcd0={'OpenchannelAccountId':_0x65ad9[_0x789d('0x5b')]['id'],'closed':![]};if(_0x65ad9['body'][_0x789d('0x8d')]){_0x26dcd0[_0x789d('0x8d')]=_0x65ad9[_0x789d('0x67')][_0x789d('0x8d')];return db[_0x789d('0x8e')]['find']({'where':_0x26dcd0})['then'](function(_0xb60d26){if(_0xb60d26){return[_0xb60d26,![]];}_0x26421c['threadId']=_0x65ad9[_0x789d('0x67')]['threadId'];_0x26421c[_0x789d('0x8f')]=_0x65ad9[_0x789d('0x67')]['externalUrl'];return db['OpenchannelInteraction'][_0x789d('0x5f')](_0x26421c)[_0x789d('0x24')](function(_0x407206){return[_0x407206,!![]];});});}else{_0x26dcd0[_0x789d('0x8d')]=null;}_0x26dcd0[_0x789d('0x90')]=_0x388939['id'];return db[_0x789d('0x8e')][_0x789d('0x5e')]({'where':_0x26dcd0})[_0x789d('0x24')](function(_0x244417){if(_0x244417){return[_0x244417,![]];}return db['OpenchannelInteraction']['create'](_0x26421c)[_0x789d('0x24')](function(_0x4cc4e2){return[_0x4cc4e2,!![]];});});}})[_0x789d('0x91')](function(_0x54dee1,_0x4b7815){if(_0x54dee1){_0x5bb690=_0x4b7815;if(!_0x4b7815){var _0x217959={'from':(_0x2aa9b9[_0x789d('0x92')][_0x789d('0x8b')]||'')+'\x20'+(_0x2aa9b9[_0x789d('0x92')][_0x789d('0x8c')]||'')};if(_0x65ad9[_0x789d('0x67')]['threadId']&&_0x65ad9['body'][_0x789d('0x93')]&&_0x65ad9[_0x789d('0x67')][_0x789d('0x8d')]!=_0x65ad9['body']['messageId']){_0x217959[_0x789d('0x8d')]=_0x65ad9[_0x789d('0x67')][_0x789d('0x93')];}return _0x54dee1[_0x789d('0x3a')](_0x217959);}else{return _0x54dee1;}}})[_0x789d('0x24')](function(_0x37105c){_0x2aa9b9[_0x789d('0x94')]=_0x37105c['get']({'plain':!![]});_0x2aa9b9[_0x789d('0x94')][_0x789d('0x95')]=_0x5bb690;if(_0x2aa9b9['interaction'][_0x789d('0x95')]){if(_0x2aa9b9[_0x789d('0x85')]['autoclose']){_0x2aa9b9[_0x789d('0x86')]['push']({'id':0x0,'priority':_0x2aa9b9[_0x789d('0x86')]['length']+0x1,'app':_0x789d('0x96'),'appdata':_0x789d('0x97'),'interval':_0x789d('0x98')});}}return db[_0x789d('0x99')]['create']({'body':_0x65ad9[_0x789d('0x67')][_0x789d('0x67')],'OpenchannelAccountId':_0x65ad9[_0x789d('0x5b')]['id'],'OpenchannelInteractionId':_0x37105c['id'],'direction':'in','ContactId':_0x2aa9b9['contact']['id'],'AttachmentId':_0x65ad9[_0x789d('0x67')][_0x789d('0x9a')]});})['then'](function(_0x34ca19){_0x2aa9b9[_0x789d('0x2c')]=_0x34ca19;if(_0x2aa9b9[_0x789d('0x94')][_0x789d('0x9b')]){return db[_0x789d('0x9c')][_0x789d('0x5e')]({'attributes':['id',_0x789d('0x3e')],'where':{'id':_0x2aa9b9[_0x789d('0x94')][_0x789d('0x9b')]}})['then'](function(_0x3b9621){if(_0x3b9621){_0x2aa9b9[_0x789d('0x86')][_0x789d('0x9d')]({'id':0x0,'priority':0x0,'app':_0x789d('0x9e'),'appdata':_0x3b9621[_0x789d('0x3e')]+','+(_0x2aa9b9[_0x789d('0x85')][_0x789d('0x9f')]||0xa),'interval':_0x789d('0x98')});_0x2aa9b9[_0x789d('0xa0')]=![];}return respondWithRpcPromise(_0x789d('0xa1'),'startRouting',_0x2aa9b9);});}return respondWithRpcPromise(_0x789d('0xa1'),_0x789d('0xa2'),_0x2aa9b9);})[_0x789d('0x24')](function(_0x361370){respondWithRpcPromise('EventManager',_0x789d('0xa3'),{'event':_0x789d('0x77'),'message':_0x361370},client9002);return _0x361370;})[_0x789d('0x24')](respondWithResult(_0x452891,null))[_0x789d('0x2e')](handleError(_0x452891,null));};exports[_0x789d('0xa4')]=function(_0xff4816,_0x43494d,_0x3084cd){return db['OpenchannelAccount'][_0x789d('0x75')]({'where':{'id':_0xff4816[_0x789d('0x5b')]['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x43494d,null))[_0x789d('0x24')](function(_0x227979){if(_0x227979){return db[_0x789d('0xa5')][_0x789d('0xa6')](function(_0x342140){return db['OpenchannelApplication'][_0x789d('0x3b')]({'where':{'OpenchannelAccountId':_0xff4816[_0x789d('0x5b')]['id']},'transaction':_0x342140})[_0x789d('0x24')](function(_0x409ff3){var _0x34cd0f=_[_0x789d('0x6e')](_0xff4816[_0x789d('0x67')],function(_0x2d0789){_0x2d0789[_0x789d('0x72')]=_0xff4816[_0x789d('0x5b')]['id'];return _0x2d0789;});return db[_0x789d('0xa7')][_0x789d('0xa8')](_0x34cd0f,{'transaction':_0x342140});});})['then'](function(){return db[_0x789d('0xa7')][_0x789d('0xa9')]({'where':{'OpenchannelAccountId':_0xff4816['params']['id']},'order':_0x789d('0x89')});});}})[_0x789d('0x24')](respondWithResult(_0x43494d,null))[_0x789d('0x2e')](handleError(_0x43494d,null));};exports[_0x789d('0xaa')]=function(_0xd184de,_0x598cd4,_0x5c7d99){var _0x33075b={};var _0x4c49c1={};var _0x209612;var _0x5cb271;return db['OpenchannelAccount']['findOne']({'where':{'id':_0xd184de['params']['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x598cd4,null))[_0x789d('0x24')](function(_0x28964b){if(_0x28964b){_0x209612=_0x28964b;_0x4c49c1[_0x789d('0x46')]=_[_0x789d('0x48')](db[_0x789d('0xa7')][_0x789d('0x43')]);_0x4c49c1['query']=_[_0x789d('0x48')](_0xd184de['query']);_0x4c49c1[_0x789d('0x49')]=_['intersection'](_0x4c49c1[_0x789d('0x46')],_0x4c49c1[_0x789d('0x47')]);_0x33075b[_0x789d('0x4c')]=_[_0x789d('0x4a')](_0x4c49c1['model'],qs[_0x789d('0x4b')](_0xd184de['query'][_0x789d('0x4b')]));_0x33075b[_0x789d('0x4c')]=_0x33075b[_0x789d('0x4c')][_0x789d('0x5d')]?_0x33075b[_0x789d('0x4c')]:_0x4c49c1[_0x789d('0x46')];_0x33075b[_0x789d('0x4e')]=qs[_0x789d('0x4f')](_0xd184de[_0x789d('0x47')][_0x789d('0x4f')]);_0x33075b[_0x789d('0x50')]=qs[_0x789d('0x49')](_[_0x789d('0x51')](_0xd184de[_0x789d('0x47')],_0x4c49c1['filters']));if(_0xd184de[_0x789d('0x47')][_0x789d('0x52')]){_0x33075b[_0x789d('0x50')]=_['merge'](_0x33075b['where'],{'$or':_[_0x789d('0x6e')](_0x33075b[_0x789d('0x4c')],function(_0x4b5ce7){var _0x45c48d={};_0x45c48d[_0x4b5ce7]={'$like':'%'+_0xd184de[_0x789d('0x47')]['filter']+'%'};return _0x45c48d;})});}_0x33075b=_[_0x789d('0x53')]({},_0x33075b,_0xd184de[_0x789d('0x55')]);return _0x209612[_0x789d('0xaa')](_0x33075b);}})['then'](function(_0x57c295){if(_0x57c295){_0x5cb271=_0x57c295[_0x789d('0x5d')];if(!_0xd184de[_0x789d('0x47')][_0x789d('0x6d')](_0x789d('0x4d'))){_0x33075b[_0x789d('0x33')]=qs[_0x789d('0x33')](_0xd184de[_0x789d('0x47')][_0x789d('0x33')]);_0x33075b[_0x789d('0x32')]=qs[_0x789d('0x32')](_0xd184de[_0x789d('0x47')][_0x789d('0x32')]);}return _0x209612[_0x789d('0xaa')](_0x33075b);}})[_0x789d('0x24')](function(_0x941f3f){if(_0x941f3f){return _0x941f3f?{'count':_0x5cb271,'rows':_0x941f3f}:null;}})[_0x789d('0x24')](respondWithResult(_0x598cd4,null))[_0x789d('0x2e')](handleError(_0x598cd4,null));};exports[_0x789d('0xab')]=function(_0x9c41c0,_0x465dbd,_0x4cbd67){var _0x211a37={'raw':![],'where':{}};var _0x65fac2={};var _0x3b932f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x789d('0x75')]({'where':{'id':_0x9c41c0[_0x789d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x465dbd,null))[_0x789d('0x24')](function(_0x2b70f7){if(_0x2b70f7){_0x65fac2[_0x789d('0x46')]=_[_0x789d('0x48')](db['OpenchannelInteraction'][_0x789d('0x43')]);_0x65fac2[_0x789d('0x47')]=_[_0x789d('0x48')](_0x9c41c0[_0x789d('0x47')]);_0x65fac2['filters']=_[_0x789d('0x4a')](_0x65fac2[_0x789d('0x46')],_0x65fac2[_0x789d('0x47')]);_0x211a37['attributes']=_[_0x789d('0x4a')](_0x65fac2[_0x789d('0x46')],qs[_0x789d('0x4b')](_0x9c41c0['query']['fields']));_0x211a37['attributes']=_0x211a37['attributes'][_0x789d('0x5d')]?_0x211a37[_0x789d('0x4c')]:_0x65fac2[_0x789d('0x46')];if(!_0x9c41c0['query'][_0x789d('0x6d')](_0x789d('0x4d'))){_0x211a37[_0x789d('0x33')]=qs[_0x789d('0x33')](_0x9c41c0[_0x789d('0x47')][_0x789d('0x33')]);_0x211a37[_0x789d('0x32')]=qs[_0x789d('0x32')](_0x9c41c0['query'][_0x789d('0x32')]);}_0x211a37[_0x789d('0x4e')]=qs[_0x789d('0x4f')](_0x9c41c0[_0x789d('0x47')][_0x789d('0x4f')]);_0x211a37[_0x789d('0x50')]=qs[_0x789d('0x49')](_['pick'](_0x9c41c0[_0x789d('0x47')],_0x65fac2['filters']));_0x211a37['where'][_0x789d('0x72')]=_0x2b70f7['id'];if(_0x9c41c0[_0x789d('0x47')][_0x789d('0x52')]){_0x211a37['where']=_[_0x789d('0x53')](_0x211a37[_0x789d('0x50')],{'$or':_[_0x789d('0x6e')](_0x211a37[_0x789d('0x4c')],function(_0x22d198){var _0x838de3={};_0x838de3[_0x22d198]={'$like':'%'+_0x9c41c0[_0x789d('0x47')][_0x789d('0x52')]+'%'};return _0x838de3;})});}_0x211a37=_[_0x789d('0x53')]({},_0x211a37,_0x9c41c0[_0x789d('0x55')]);return db[_0x789d('0x8e')][_0x789d('0x31')]({'where':_0x211a37['where']})['then'](function(_0x302aad){_0x3b932f['count']=_0x302aad;if(_0x9c41c0['query']['includeAll']){_0x211a37[_0x789d('0x57')]=[{'model':db[_0x789d('0x82')],'as':'Contact','required':![]},{'model':db[_0x789d('0x9c')],'as':_0x789d('0xac'),'attributes':[_0x789d('0x3e'),_0x789d('0xad'),_0x789d('0xae')],'required':![]},{'model':db[_0x789d('0xaf')],'as':'Tags','attributes':['id',_0x789d('0x3e'),'color'],'where':_0x9c41c0[_0x789d('0x47')][_0x789d('0xb0')]?{'id':_0x9c41c0[_0x789d('0x47')][_0x789d('0xb0')]}:undefined,'required':_0x9c41c0[_0x789d('0x47')][_0x789d('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x789d('0x58')](_0x211a37);})[_0x789d('0x24')](function(_0x496685){_0x3b932f[_0x789d('0x59')]=_0x496685;return _0x3b932f;});}})['then'](respondWithFilteredResult(_0x465dbd,_0x211a37))[_0x789d('0x2e')](handleError(_0x465dbd,null));};exports['addAgents']=function(_0x1aca38,_0x1f431c,_0x216f23){return db[_0x789d('0x42')]['find']({'where':{'id':_0x1aca38['params']['id']}})['then'](handleEntityNotFound(_0x1f431c,null))[_0x789d('0x24')](function(_0x30af78){if(_0x30af78){return _0x30af78[_0x789d('0xb1')](_0x1aca38[_0x789d('0x67')][_0x789d('0x70')],_['omit'](_0x1aca38['body'],['ids','id'])||{})[_0x789d('0x91')](function(_0x1ea147){for(var _0x530aae=0x0;_0x530aae<_0x1aca38[_0x789d('0x67')][_0x789d('0x70')][_0x789d('0x5d')];_0x530aae+=0x1){socket[_0x789d('0xb2')]('userOpenchannelAccount:save',{'UserId':_0x1aca38[_0x789d('0x67')]['ids'][_0x530aae],'OpenchannelAccountId':_0x1aca38[_0x789d('0x5b')]['id']});}return _0x1ea147;});}})[_0x789d('0x24')](respondWithResult(_0x1f431c,null))[_0x789d('0x2e')](handleError(_0x1f431c,null));};exports[_0x789d('0xb3')]=function(_0x496bef,_0x28a4ba,_0x5ad974){return db[_0x789d('0x42')]['find']({'where':{'id':_0x496bef['params']['id']}})[_0x789d('0x24')](handleEntityNotFound(_0x28a4ba,null))[_0x789d('0x24')](function(_0x18644a){if(_0x18644a){return _0x18644a[_0x789d('0xb3')](_0x496bef[_0x789d('0x47')]['ids'])[_0x789d('0x24')](function(){if(_['isArray'](_0x496bef[_0x789d('0x47')][_0x789d('0x70')])){for(var _0x1e5115=0x0;_0x1e5115<_0x496bef[_0x789d('0x47')][_0x789d('0x70')][_0x789d('0x5d')];_0x1e5115+=0x1){socket[_0x789d('0xb2')](_0x789d('0xb4'),{'UserId':Number(_0x496bef[_0x789d('0x47')]['ids'][_0x1e5115]),'OpenchannelAccountId':Number(_0x496bef[_0x789d('0x5b')]['id'])});}}else{socket['emit'](_0x789d('0xb4'),{'UserId':Number(_0x496bef[_0x789d('0x47')][_0x789d('0x70')]),'OpenchannelAccountId':Number(_0x496bef[_0x789d('0x5b')]['id'])});}});}})[_0x789d('0x24')](respondWithStatusCode(_0x28a4ba,null))[_0x789d('0x2e')](handleError(_0x28a4ba,null));};exports[_0x789d('0xb5')]=function(_0xeafda2,_0x147126,_0x8c4dc7){var _0xd8e338={};var _0x45e943={};var _0x81a476;var _0x53f246;return db[_0x789d('0x42')][_0x789d('0x75')]({'where':{'id':_0xeafda2[_0x789d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x147126,null))[_0x789d('0x24')](function(_0x37ac24){if(_0x37ac24){_0x81a476=_0x37ac24;_0x45e943['model']=_[_0x789d('0x48')](db[_0x789d('0x9c')][_0x789d('0x43')]);_0x45e943['query']=_[_0x789d('0x48')](_0xeafda2[_0x789d('0x47')]);_0x45e943[_0x789d('0x49')]=_[_0x789d('0x4a')](_0x45e943[_0x789d('0x46')],_0x45e943[_0x789d('0x47')]);_0xd8e338[_0x789d('0x4c')]=_[_0x789d('0x4a')](_0x45e943[_0x789d('0x46')],qs[_0x789d('0x4b')](_0xeafda2[_0x789d('0x47')]['fields']));_0xd8e338[_0x789d('0x4c')]=_0xd8e338['attributes'][_0x789d('0x5d')]?_0xd8e338['attributes']:_0x45e943[_0x789d('0x46')];_0xd8e338[_0x789d('0x4e')]=qs[_0x789d('0x4f')](_0xeafda2['query'][_0x789d('0x4f')]);_0xd8e338[_0x789d('0x50')]=qs[_0x789d('0x49')](_[_0x789d('0x51')](_0xeafda2[_0x789d('0x47')],_0x45e943[_0x789d('0x49')]));if(_0xeafda2[_0x789d('0x47')][_0x789d('0x52')]){_0xd8e338[_0x789d('0x50')]=_[_0x789d('0x53')](_0xd8e338[_0x789d('0x50')],{'$or':_[_0x789d('0x6e')](_0xd8e338['attributes'],function(_0x502e34){var _0x4ca34b={};_0x4ca34b[_0x502e34]={'$like':'%'+_0xeafda2[_0x789d('0x47')][_0x789d('0x52')]+'%'};return _0x4ca34b;})});}_0xd8e338=_[_0x789d('0x53')]({},_0xd8e338,_0xeafda2[_0x789d('0x55')]);return _0x81a476[_0x789d('0xb5')](_0xd8e338);}})['then'](function(_0x38b7a4){if(_0x38b7a4){_0x53f246=_0x38b7a4[_0x789d('0x5d')];if(!_0xeafda2[_0x789d('0x47')][_0x789d('0x6d')]('nolimit')){_0xd8e338[_0x789d('0x33')]=qs[_0x789d('0x33')](_0xeafda2[_0x789d('0x47')][_0x789d('0x33')]);_0xd8e338[_0x789d('0x32')]=qs[_0x789d('0x32')](_0xeafda2[_0x789d('0x47')][_0x789d('0x32')]);}return _0x81a476['getAgents'](_0xd8e338);}})['then'](function(_0x2cdaac){if(_0x2cdaac){return _0x2cdaac?{'count':_0x53f246,'rows':_0x2cdaac}:null;}})[_0x789d('0x24')](respondWithResult(_0x147126,null))[_0x789d('0x2e')](handleError(_0x147126,null));};exports[_0x789d('0x3f')]=function(_0x20ff17,_0xf257cb,_0x363ced){var _0x46209f,_0x5f5688,_0x4a2448;if(_['isNil'](_0x20ff17[_0x789d('0x67')]['body'])||_0x20ff17[_0x789d('0x67')][_0x789d('0x67')]===''){throw new db[(_0x789d('0x21'))][(_0x789d('0x22'))](_0x789d('0xb6'));}if(_[_0x789d('0x7d')](_0x20ff17['body']['to'])){}_0x46209f=_0x20ff17[_0x789d('0x67')]['to'];return db['OpenchannelAccount'][_0x789d('0x75')]({'where':{'id':_0x20ff17[_0x789d('0x5b')]['id']}})['then'](handleEntityNotFound(_0xf257cb,null))['then'](function(_0x20e248){if(_0x20e248){return db[_0x789d('0x42')][_0x789d('0x5e')]({'where':{'id':_0x20e248['id']},'include':[{'model':db[_0x789d('0x81')],'as':_0x789d('0x87'),'include':[{'model':db[_0x789d('0x82')],'as':_0x789d('0x83'),'where':{[_0x20e248['mapKey']]:_0x46209f},'limit':0x1,'order':[[_0x789d('0x7b'),_0x789d('0x84')]]}]}]})[_0x789d('0x24')](handleEntityNotFound(_0xf257cb,null))['then'](function(_0xd71265){if(_0xd71265&&_0xd71265[_0x789d('0x87')]){_0x5f5688=_0xd71265[_0x789d('0x61')]({'plain':!![]});if(_0x5f5688[_0x789d('0x87')]&&_0x5f5688['List'][_0x789d('0x83')]['length']){return _0x5f5688[_0x789d('0x87')][_0x789d('0x83')][0x0];}return db['CmContact'][_0x789d('0x5f')](_[_0x789d('0x1b')](_0x20ff17[_0x789d('0x67')],{'firstName':_0x46209f,[_0xd71265[_0x789d('0x80')]]:_0x46209f,'phone':_0x46209f,'ListId':_0x5f5688[_0x789d('0x7c')]}));}})[_0x789d('0x24')](handleEntityNotFound(_0xf257cb,null))[_0x789d('0x24')](function(_0x199590){if(_0x199590){_0x4a2448=_0x199590;return db[_0x789d('0x8e')][_0x789d('0x5e')]({'where':{'ContactId':_0x4a2448['id'],'closed':![],'OpenchannelAccountId':_0x5f5688['id']}})[_0x789d('0x24')](function(_0x282b47){if(_0x282b47){return[_0x282b47,![]];}return db['OpenchannelInteraction'][_0x789d('0x5f')]({'UserId':_0x20ff17[_0x789d('0x60')]['id'],'ContactId':_0x4a2448['id'],'OpenchannelAccountId':_0x5f5688['id'],'lastMsgDirection':'out','Messages':[_[_0x789d('0x53')](_0x20ff17[_0x789d('0x67')],{'read':![],'body':_0x20ff17[_0x789d('0x67')][_0x789d('0x67')],'OpenchannelAccountId':_0x5f5688['id'],'UserId':_0x20ff17[_0x789d('0x60')]['id'],'ContactId':_0x4a2448['id']})]},{'include':[{'model':db[_0x789d('0x99')],'as':_0x789d('0xb7')}]})[_0x789d('0x24')](function(_0x57b84c){return[_0x57b84c,!![]];});});}})[_0x789d('0x91')](function(_0x551309,_0xde2fed){if(_0xde2fed){return _0x551309;}return db[_0x789d('0x99')][_0x789d('0x5f')](_[_0x789d('0x53')](_0x20ff17['body'],{'read':![],'body':_0x20ff17[_0x789d('0x67')][_0x789d('0x67')],'OpenchannelAccountId':_0x5f5688['id'],'OpenchannelInteractionId':_0x551309['id'],'UserId':_0x20ff17[_0x789d('0x60')]['id'],'ContactId':_0x4a2448['id']}))[_0x789d('0x24')](function(_0x47b5fa){_0x551309[_0x789d('0xb8')]['Messages']=[];_0x551309[_0x789d('0xb8')]['Messages'][_0x789d('0xb9')](_0x47b5fa[_0x789d('0xb8')]);return _0x551309;});});}})[_0x789d('0x24')](respondWithResult(_0xf257cb,null))['catch'](handleError(_0xf257cb,null));}; \ No newline at end of file +var _0x6912=['sort','pick','filter','where','VIRTUAL','count','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','mandatoryDispositionPause','keys','merge','options','find','body','user','autoAssociation','create','params','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','order','OpenchannelAccountId','notify','openchannel','CmContact','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2a3b96,_0x56f08a){var _0x5514c6=function(_0x529dd9){while(--_0x529dd9){_0x2a3b96['push'](_0x2a3b96['shift']());}};_0x5514c6(++_0x56f08a);}(_0x6912,0x1db));var _0x2691=function(_0xef042b,_0x4a7539){_0xef042b=_0xef042b-0x0;var _0x199c10=_0x6912[_0xef042b];return _0x199c10;};'use strict';var pdf=require(_0x2691('0x0'));var emlformat=require(_0x2691('0x1'));var rimraf=require(_0x2691('0x2'));var zipdir=require(_0x2691('0x3'));var jsonpatch=require(_0x2691('0x4'));var rp=require(_0x2691('0x5'));var moment=require(_0x2691('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2691('0x7'));var util=require(_0x2691('0x8'));var path=require(_0x2691('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2691('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2691('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2691('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2691('0xd'));var Papa=require('papaparse');var Redis=require(_0x2691('0xe'));var authService=require(_0x2691('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2691('0x10'));var hardwareService=require(_0x2691('0x11'));var logger=require(_0x2691('0x12'))(_0x2691('0x13'));var utils=require(_0x2691('0x14'));var config=require(_0x2691('0x15'));var db=require(_0x2691('0x16'))['db'];config[_0x2691('0x17')]=_[_0x2691('0x18')](config['redis'],{'host':_0x2691('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2691('0x17')]));require('./openchannelAccount.socket')[_0x2691('0x1a')](socket);var jayson=require(_0x2691('0x1b'));var client=jayson['client'][_0x2691('0x1c')]({'port':0x232c});var client9002=jayson[_0x2691('0x1d')][_0x2691('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x289875,_0x15b0fb,_0x273e3f){if(_0x273e3f){var _0x3c47db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c47db['test'](_0x15b0fb)){return _0x289875;}else{throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))](_0x2691('0x20'));}}else{return _0x289875;}}function respondWithRpcPromise(_0x4fb4db,_0x449ccf,_0x42cad8,_0x5dae9f){return new BPromise(function(_0x161b6d,_0x5b2625){var _0x1174e5=_0x5dae9f||client;return _0x1174e5[_0x2691('0x21')](_0x4fb4db,_0x42cad8)[_0x2691('0x22')](function(_0x370482){logger['info'](_0x2691('0x23'),_0x449ccf,_0x2691('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x449ccf,_0x2691('0x24'),JSON[_0x2691('0x25')](_0x370482));if(_0x370482[_0x2691('0x26')]){if(_0x370482[_0x2691('0x26')]['code']===0x1f4){logger[_0x2691('0x26')](_0x2691('0x23'),_0x449ccf,_0x370482[_0x2691('0x26')][_0x2691('0x27')]);return _0x5b2625(_0x370482[_0x2691('0x26')]['message']);}logger[_0x2691('0x26')](_0x2691('0x23'),_0x449ccf,_0x370482['error'][_0x2691('0x27')]);return _0x161b6d(_0x370482['error'][_0x2691('0x27')]);}else{logger[_0x2691('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x449ccf,_0x2691('0x24'));_0x161b6d(_0x370482[_0x2691('0x29')]['message']);}})['catch'](function(_0x4e248e){logger[_0x2691('0x26')](_0x2691('0x23'),_0x449ccf,_0x4e248e);_0x5b2625(_0x4e248e);});});}function respondWithStatusCode(_0x204e88,_0x4128de){_0x4128de=_0x4128de||0xcc;return function(_0x5b2485){if(_0x5b2485){return _0x204e88[_0x2691('0x2a')](_0x4128de);}return _0x204e88[_0x2691('0x2b')](_0x4128de)[_0x2691('0x2c')]();};}function respondWithResult(_0x2c5747,_0x3b6783){_0x3b6783=_0x3b6783||0xc8;return function(_0x2d5158){if(_0x2d5158){return _0x2c5747[_0x2691('0x2b')](_0x3b6783)[_0x2691('0x2d')](_0x2d5158);}};}function respondWithFilteredResult(_0x7ddff,_0x43489a){return function(_0x5b055a){if(_0x5b055a){var _0x400c8d=_0x5b055a['count'],_0x5cfebf=_0x43489a[_0x2691('0x2e')],_0x4bcbff=_0x43489a[_0x2691('0x2e')]+_0x43489a[_0x2691('0x2f')],_0x4aa452;if(_0x4bcbff>=_0x400c8d){_0x4bcbff=_0x400c8d;_0x4aa452=0xc8;}else{_0x4aa452=0xce;}_0x7ddff[_0x2691('0x2b')](_0x4aa452);return _0x7ddff[_0x2691('0x30')](_0x2691('0x31'),_0x5cfebf+'-'+_0x4bcbff+'/'+_0x400c8d)['json'](_0x5b055a);}return null;};}function patchUpdates(_0x340f0e){return function(_0x3be735){try{jsonpatch[_0x2691('0x32')](_0x3be735,_0x340f0e,!![]);}catch(_0x68fe2f){return BPromise[_0x2691('0x33')](_0x68fe2f);}return _0x3be735['save']();};}function saveUpdates(_0x1d31ec,_0x37700f){return function(_0x37d626){if(_0x37d626){return _0x37d626[_0x2691('0x34')](_0x1d31ec)[_0x2691('0x22')](function(_0x43a862){return _0x43a862;});}return null;};}function removeEntity(_0x27bacc,_0x277748){return function(_0x9d3e75){if(_0x9d3e75){return _0x9d3e75[_0x2691('0x35')]()['then'](function(){var _0x1af448=_0x9d3e75[_0x2691('0x36')]({'plain':!![]});var _0x175d34=_0x2691('0x37');return db[_0x2691('0x38')][_0x2691('0x35')]({'where':{'type':_0x175d34,'resourceId':_0x1af448['id']}})[_0x2691('0x22')](function(){return _0x9d3e75;});})[_0x2691('0x22')](function(){_0x27bacc[_0x2691('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10386d,_0x5bc0dd){return function(_0xdfb333){if(!_0xdfb333){_0x10386d[_0x2691('0x2a')](0x194);}return _0xdfb333;};}function handleError(_0x4d47d0,_0x2c867b){_0x2c867b=_0x2c867b||0x1f4;return function(_0x45d60d){logger[_0x2691('0x26')](_0x45d60d[_0x2691('0x39')]);if(_0x45d60d['name']){delete _0x45d60d[_0x2691('0x3a')];}_0x4d47d0[_0x2691('0x2b')](_0x2c867b)[_0x2691('0x3b')](_0x45d60d);};}exports['index']=function(_0x5b5836,_0x2418e2){var _0x197532={'include':[{'model':db[_0x2691('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5cf76f={},_0x164d80={'count':0x0,'rows':[]};var _0x48ce76=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x453a63){return{'name':_0x453a63[_0x2691('0x3d')],'type':_0x453a63[_0x2691('0x3e')][_0x2691('0x3f')]};});_0x5cf76f[_0x2691('0x40')]=_[_0x2691('0x41')](_0x48ce76,'name');_0x5cf76f[_0x2691('0x42')]=_['keys'](_0x5b5836[_0x2691('0x42')]);_0x5cf76f[_0x2691('0x43')]=_[_0x2691('0x44')](_0x5cf76f[_0x2691('0x40')],_0x5cf76f['query']);_0x197532[_0x2691('0x45')]=_[_0x2691('0x44')](_0x5cf76f[_0x2691('0x40')],qs[_0x2691('0x46')](_0x5b5836[_0x2691('0x42')][_0x2691('0x46')]));_0x197532[_0x2691('0x45')]=_0x197532[_0x2691('0x45')][_0x2691('0x47')]?_0x197532[_0x2691('0x45')]:_0x5cf76f[_0x2691('0x40')];if(!_0x5b5836[_0x2691('0x42')][_0x2691('0x48')](_0x2691('0x49'))){_0x197532[_0x2691('0x2f')]=qs[_0x2691('0x2f')](_0x5b5836[_0x2691('0x42')][_0x2691('0x2f')]);_0x197532[_0x2691('0x2e')]=qs[_0x2691('0x2e')](_0x5b5836[_0x2691('0x42')]['offset']);}_0x197532['order']=qs[_0x2691('0x4a')](_0x5b5836[_0x2691('0x42')]['sort']);_0x197532['where']=qs['filters'](_[_0x2691('0x4b')](_0x5b5836['query'],_0x5cf76f[_0x2691('0x43')]),_0x48ce76);if(_0x5b5836[_0x2691('0x42')][_0x2691('0x4c')]){_0x197532[_0x2691('0x4d')]=_['merge'](_0x197532['where'],{'$or':_[_0x2691('0x41')](_0x48ce76,function(_0x1ead12){if(_0x1ead12[_0x2691('0x3e')]!==_0x2691('0x4e')){var _0x3a9a6c={};_0x3a9a6c[_0x1ead12[_0x2691('0x3a')]]={'$like':'%'+_0x5b5836[_0x2691('0x42')][_0x2691('0x4c')]+'%'};return _0x3a9a6c;}})});}_0x197532=_['merge']({},_0x197532,_0x5b5836['options']);var _0x31605e={'where':_0x197532[_0x2691('0x4d')]};return db['OpenchannelAccount'][_0x2691('0x4f')](_0x31605e)[_0x2691('0x22')](function(_0x3b330d){_0x164d80['count']=_0x3b330d;if(_0x5b5836[_0x2691('0x42')][_0x2691('0x50')]){_0x197532[_0x2691('0x51')]=[{'all':!![]}];}return db[_0x2691('0x52')][_0x2691('0x53')](_0x197532);})[_0x2691('0x22')](function(_0x543534){_0x164d80[_0x2691('0x54')]=_0x543534;return _0x164d80;})['then'](respondWithFilteredResult(_0x2418e2,_0x197532))[_0x2691('0x55')](handleError(_0x2418e2,null));};exports[_0x2691('0x56')]=function(_0x14257c,_0x120b3f){var _0x37c38d={'raw':![],'where':{'id':_0x14257c['params']['id']},'include':[{'model':db['Pause'],'as':_0x2691('0x57')}]},_0x51e9a4={};_0x51e9a4[_0x2691('0x40')]=_['keys'](db['OpenchannelAccount']['rawAttributes']);_0x51e9a4[_0x2691('0x42')]=_[_0x2691('0x58')](_0x14257c['query']);_0x51e9a4[_0x2691('0x43')]=_[_0x2691('0x44')](_0x51e9a4[_0x2691('0x40')],_0x51e9a4[_0x2691('0x42')]);_0x37c38d[_0x2691('0x45')]=_[_0x2691('0x44')](_0x51e9a4[_0x2691('0x40')],qs[_0x2691('0x46')](_0x14257c[_0x2691('0x42')][_0x2691('0x46')]));_0x37c38d[_0x2691('0x45')]=_0x37c38d[_0x2691('0x45')][_0x2691('0x47')]?_0x37c38d['attributes']:_0x51e9a4['model'];if(_0x14257c['query'][_0x2691('0x50')]){_0x37c38d[_0x2691('0x51')]=[{'all':!![]}];}_0x37c38d=_[_0x2691('0x59')]({},_0x37c38d,_0x14257c[_0x2691('0x5a')]);return db[_0x2691('0x52')][_0x2691('0x5b')](_0x37c38d)[_0x2691('0x22')](handleEntityNotFound(_0x120b3f,null))[_0x2691('0x22')](respondWithResult(_0x120b3f,null))[_0x2691('0x55')](handleError(_0x120b3f,null));};exports['create']=function(_0x5e95f1,_0x2ec73e){return db[_0x2691('0x52')]['create'](_0x5e95f1[_0x2691('0x5c')],{})[_0x2691('0x22')](function(_0x4172e0){var _0x3320c2=_0x5e95f1[_0x2691('0x5d')][_0x2691('0x36')]({'plain':!![]});if(!_0x3320c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3320c2['role']===_0x2691('0x5d')){var _0x361642=_0x4172e0['get']({'plain':!![]});var _0x76148b=_0x2691('0x37');return db['UserProfileSection'][_0x2691('0x5b')]({'where':{'name':_0x76148b,'userProfileId':_0x3320c2['userProfileId']},'raw':!![]})[_0x2691('0x22')](function(_0x1479d4){if(_0x1479d4&&_0x1479d4[_0x2691('0x5e')]===0x0){return db['UserProfileResource'][_0x2691('0x5f')]({'name':_0x361642['name'],'resourceId':_0x361642['id'],'type':_0x1479d4[_0x2691('0x3a')],'sectionId':_0x1479d4['id']},{})[_0x2691('0x22')](function(){return _0x4172e0;});}else{return _0x4172e0;}})[_0x2691('0x55')](function(_0x6a160a){logger[_0x2691('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6a160a);throw _0x6a160a;});}return _0x4172e0;})[_0x2691('0x22')](respondWithResult(_0x2ec73e,0xc9))[_0x2691('0x55')](handleError(_0x2ec73e,null));};exports[_0x2691('0x34')]=function(_0x41de02,_0x25d362){if(_0x41de02['body']['id']){delete _0x41de02[_0x2691('0x5c')]['id'];}return db[_0x2691('0x52')][_0x2691('0x5b')]({'where':{'id':_0x41de02[_0x2691('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x2691('0x57')}]})[_0x2691('0x22')](handleEntityNotFound(_0x25d362,null))['then'](saveUpdates(_0x41de02[_0x2691('0x5c')],null))[_0x2691('0x22')](respondWithResult(_0x25d362,null))['catch'](handleError(_0x25d362,null));};exports['destroy']=function(_0x343010,_0x1e7124){return db['OpenchannelAccount'][_0x2691('0x5b')]({'where':{'id':_0x343010[_0x2691('0x60')]['id']}})['then'](handleEntityNotFound(_0x1e7124,null))[_0x2691('0x22')](removeEntity(_0x1e7124,null))['catch'](handleError(_0x1e7124,null));};exports[_0x2691('0x61')]=function(_0x200dae,_0x3b4a84){return db[_0x2691('0x52')][_0x2691('0x61')]()['then'](respondWithResult(_0x3b4a84,null))[_0x2691('0x55')](handleError(_0x3b4a84,null));};exports[_0x2691('0x62')]=function(_0x815697,_0xc69f7f,_0x2abcf6){if(_0x815697[_0x2691('0x5c')]['id']){delete _0x815697['body']['id'];}return db['OpenchannelAccount'][_0x2691('0x5b')]({'where':{'id':_0x815697[_0x2691('0x60')]['id']}})['then'](handleEntityNotFound(_0xc69f7f,null))[_0x2691('0x22')](function(_0x2b4966){if(_0x2b4966){_0x815697[_0x2691('0x5c')][_0x2691('0x63')]=_0x2b4966['id'];return db[_0x2691('0x64')]['create'](_0x815697[_0x2691('0x5c')]);}})[_0x2691('0x22')](respondWithResult(_0xc69f7f,null))[_0x2691('0x55')](handleError(_0xc69f7f,null));};exports[_0x2691('0x65')]=function(_0x5710b9,_0x204f2e,_0x59e600){var _0x21e944={'raw':![],'where':{}};var _0x43ad91={};var _0x1950ad={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2691('0x66')]({'where':{'id':_0x5710b9['params']['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x204f2e,null))['then'](function(_0x41437f){if(_0x41437f){_0x43ad91['model']=_[_0x2691('0x58')](db[_0x2691('0x64')]['rawAttributes']);_0x43ad91[_0x2691('0x42')]=_[_0x2691('0x58')](_0x5710b9['query']);_0x43ad91[_0x2691('0x43')]=_[_0x2691('0x44')](_0x43ad91[_0x2691('0x40')],_0x43ad91['query']);_0x21e944[_0x2691('0x45')]=_[_0x2691('0x44')](_0x43ad91['model'],qs[_0x2691('0x46')](_0x5710b9[_0x2691('0x42')]['fields']));_0x21e944[_0x2691('0x45')]=_0x21e944[_0x2691('0x45')][_0x2691('0x47')]?_0x21e944['attributes']:_0x43ad91[_0x2691('0x40')];if(!_0x5710b9['query']['hasOwnProperty'](_0x2691('0x49'))){_0x21e944['limit']=qs[_0x2691('0x2f')](_0x5710b9[_0x2691('0x42')]['limit']);_0x21e944[_0x2691('0x2e')]=qs['offset'](_0x5710b9[_0x2691('0x42')][_0x2691('0x2e')]);}_0x21e944['order']=qs[_0x2691('0x4a')](_0x5710b9[_0x2691('0x42')][_0x2691('0x4a')]);_0x21e944[_0x2691('0x4d')]=qs[_0x2691('0x43')](_[_0x2691('0x4b')](_0x5710b9[_0x2691('0x42')],_0x43ad91[_0x2691('0x43')]));_0x21e944[_0x2691('0x4d')]['OpenchannelAccountId']=_0x41437f['id'];if(_0x5710b9['query'][_0x2691('0x4c')]){_0x21e944[_0x2691('0x4d')]=_['merge'](_0x21e944[_0x2691('0x4d')],{'$or':_[_0x2691('0x41')](_0x21e944[_0x2691('0x45')],function(_0x472a60){var _0xb2ff8d={};_0xb2ff8d[_0x472a60]={'$like':'%'+_0x5710b9['query'][_0x2691('0x4c')]+'%'};return _0xb2ff8d;})});}_0x21e944=_['merge']({},_0x21e944,_0x5710b9[_0x2691('0x5a')]);return db[_0x2691('0x64')][_0x2691('0x4f')]({'where':_0x21e944['where']})['then'](function(_0x2a2400){_0x1950ad[_0x2691('0x4f')]=_0x2a2400;if(_0x5710b9[_0x2691('0x42')][_0x2691('0x50')]){_0x21e944[_0x2691('0x51')]=[{'all':!![]}];}return db[_0x2691('0x64')][_0x2691('0x53')](_0x21e944);})[_0x2691('0x22')](function(_0x592bd3){_0x1950ad['rows']=_0x592bd3;return _0x1950ad;});}})['then'](respondWithFilteredResult(_0x204f2e,_0x21e944))['catch'](handleError(_0x204f2e,null));};exports['removeDispositions']=function(_0x3f3af6,_0x88b9d9,_0x574015){return db[_0x2691('0x52')][_0x2691('0x5b')]({'where':{'id':_0x3f3af6[_0x2691('0x60')]['id']}})['then'](handleEntityNotFound(_0x88b9d9,null))[_0x2691('0x22')](function(_0x58228e){if(_0x58228e){return _0x58228e[_0x2691('0x67')](_0x3f3af6[_0x2691('0x42')][_0x2691('0x68')]);}})['then'](respondWithStatusCode(_0x88b9d9,null))['catch'](handleError(_0x88b9d9,null));};exports[_0x2691('0x69')]=function(_0x261c42,_0x5d1313,_0x23e072){if(_0x261c42[_0x2691('0x5c')]['id']){delete _0x261c42[_0x2691('0x5c')]['id'];}return db[_0x2691('0x52')][_0x2691('0x5b')]({'where':{'id':_0x261c42['params']['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x5d1313,null))[_0x2691('0x22')](function(_0x13ce48){if(_0x13ce48){_0x261c42['body']['OpenchannelAccountId']=_0x13ce48['id'];return db[_0x2691('0x6a')][_0x2691('0x5f')](_0x261c42[_0x2691('0x5c')]);}})[_0x2691('0x22')](respondWithResult(_0x5d1313,null))[_0x2691('0x55')](handleError(_0x5d1313,null));};exports[_0x2691('0x6b')]=function(_0x4a5af2,_0x574d36,_0x107b62){var _0x5330d9={'raw':![],'where':{}};var _0x5af876={};var _0x3f3101={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2691('0x66')]({'where':{'id':_0x4a5af2['params']['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x574d36,null))['then'](function(_0xe04f14){if(_0xe04f14){_0x5af876[_0x2691('0x40')]=_[_0x2691('0x58')](db[_0x2691('0x6a')][_0x2691('0x6c')]);_0x5af876[_0x2691('0x42')]=_['keys'](_0x4a5af2['query']);_0x5af876[_0x2691('0x43')]=_[_0x2691('0x44')](_0x5af876[_0x2691('0x40')],_0x5af876[_0x2691('0x42')]);_0x5330d9[_0x2691('0x45')]=_[_0x2691('0x44')](_0x5af876[_0x2691('0x40')],qs[_0x2691('0x46')](_0x4a5af2['query']['fields']));_0x5330d9[_0x2691('0x45')]=_0x5330d9['attributes'][_0x2691('0x47')]?_0x5330d9[_0x2691('0x45')]:_0x5af876[_0x2691('0x40')];if(!_0x4a5af2[_0x2691('0x42')][_0x2691('0x48')](_0x2691('0x49'))){_0x5330d9[_0x2691('0x2f')]=qs[_0x2691('0x2f')](_0x4a5af2[_0x2691('0x42')][_0x2691('0x2f')]);_0x5330d9['offset']=qs[_0x2691('0x2e')](_0x4a5af2[_0x2691('0x42')][_0x2691('0x2e')]);}_0x5330d9[_0x2691('0x6d')]=qs[_0x2691('0x4a')](_0x4a5af2[_0x2691('0x42')][_0x2691('0x4a')]);_0x5330d9[_0x2691('0x4d')]=qs[_0x2691('0x43')](_[_0x2691('0x4b')](_0x4a5af2[_0x2691('0x42')],_0x5af876['filters']));_0x5330d9['where'][_0x2691('0x6e')]=_0xe04f14['id'];if(_0x4a5af2[_0x2691('0x42')][_0x2691('0x4c')]){_0x5330d9['where']=_[_0x2691('0x59')](_0x5330d9[_0x2691('0x4d')],{'$or':_[_0x2691('0x41')](_0x5330d9[_0x2691('0x45')],function(_0x1a2fa0){var _0x2046af={};_0x2046af[_0x1a2fa0]={'$like':'%'+_0x4a5af2[_0x2691('0x42')][_0x2691('0x4c')]+'%'};return _0x2046af;})});}_0x5330d9=_[_0x2691('0x59')]({},_0x5330d9,_0x4a5af2[_0x2691('0x5a')]);return db['CannedAnswer'][_0x2691('0x4f')]({'where':_0x5330d9['where']})[_0x2691('0x22')](function(_0x5b1839){_0x3f3101['count']=_0x5b1839;if(_0x4a5af2['query'][_0x2691('0x50')]){_0x5330d9[_0x2691('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2691('0x53')](_0x5330d9);})[_0x2691('0x22')](function(_0x16ca61){_0x3f3101[_0x2691('0x54')]=_0x16ca61;return _0x3f3101;});}})[_0x2691('0x22')](respondWithFilteredResult(_0x574d36,_0x5330d9))[_0x2691('0x55')](handleError(_0x574d36,null));};exports['removeAnswers']=function(_0xccba58,_0x1da023,_0x5000cb){return db['OpenchannelAccount']['find']({'where':{'id':_0xccba58['params']['id']}})['then'](handleEntityNotFound(_0x1da023,null))[_0x2691('0x22')](function(_0x121880){if(_0x121880){return _0x121880['removeAnswers'](_0xccba58[_0x2691('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x1da023,null))[_0x2691('0x55')](handleError(_0x1da023,null));};exports[_0x2691('0x6f')]=function(_0x4efd81,_0x23cc21,_0x948424){var _0x25c6d1={'body':_0x4efd81[_0x2691('0x5c')],'channel':_0x2691('0x70')};var _0x35df2f=[];var _0x14c953=[];var _0x90f081={};var _0x3070c2=![];return db[_0x2691('0x71')][_0x2691('0x61')]()[_0x2691('0x22')](function(_0x5657b8){if(!_0x5657b8){throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))](_0x2691('0x72'));}_0x35df2f=_['difference'](_[_0x2691('0x58')](_0x5657b8),[_0x2691('0x73'),_0x2691('0x74')]);_0x14c953=_['difference'](_[_0x2691('0x58')](_0x5657b8),[_0x2691('0x73'),_0x2691('0x74'),_0x2691('0x75'),_0x2691('0x76')]);if(_0x4efd81[_0x2691('0x5c')]['id']){delete _0x4efd81[_0x2691('0x5c')]['id'];}if(_[_0x2691('0x77')](_0x4efd81['body'][_0x2691('0x78')])){throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))](_0x2691('0x79'));}if(_['isNil'](_0x4efd81[_0x2691('0x5c')][_0x2691('0x5c')])||_0x4efd81[_0x2691('0x5c')][_0x2691('0x5c')]===''){throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))](_0x2691('0x7a'));}if(_[_0x2691('0x77')](_0x4efd81[_0x2691('0x5c')][_0x2691('0x7b')])){throw new db['Sequelize'][(_0x2691('0x1f'))](_0x2691('0x7c')+_0x14c953);}if(!_['includes'](_0x14c953,_0x4efd81[_0x2691('0x5c')][_0x2691('0x7b')])){throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14c953);}_0x90f081[_0x4efd81[_0x2691('0x5c')][_0x2691('0x7b')]]=_0x4efd81[_0x2691('0x5c')][_0x2691('0x78')];})['then'](function(){return db[_0x2691('0x52')][_0x2691('0x5b')]({'where':{'id':_0x4efd81[_0x2691('0x60')]['id']},'include':[{'model':db[_0x2691('0x7d')],'as':_0x2691('0x7e'),'include':[{'model':db[_0x2691('0x71')],'as':_0x2691('0x7f'),'where':_0x90f081,'limit':0x1,'order':[[_0x2691('0x74'),'DESC']]}]},{'model':db[_0x2691('0x80')],'as':_0x2691('0x81')}]});})[_0x2691('0x22')](handleEntityNotFound(_0x23cc21,null))[_0x2691('0x22')](function(_0x732bf5){if(_0x732bf5&&_0x732bf5['List']){_0x25c6d1[_0x2691('0x82')]=_0x732bf5;_0x25c6d1[_0x2691('0x83')]=_0x732bf5[_0x2691('0x81')];_0x25c6d1[_0x2691('0x84')]=_0x732bf5[_0x2691('0x7e')];_0x25c6d1[_0x2691('0x83')]=_['orderBy'](_0x25c6d1[_0x2691('0x83')],[_0x2691('0x85')],['asc']);if(_0x25c6d1[_0x2691('0x82')]['Applications']){delete _0x25c6d1[_0x2691('0x82')][_0x2691('0x81')];}if(_0x25c6d1[_0x2691('0x82')][_0x2691('0x7e')]&&_0x25c6d1[_0x2691('0x82')]['List'][_0x2691('0x7f')][_0x2691('0x47')]){return _0x25c6d1[_0x2691('0x82')][_0x2691('0x7e')]['Contacts'][0x0];}var _0x186140=_[_0x2691('0x18')](_0x4efd81[_0x2691('0x5c')],{'firstName':_0x4efd81[_0x2691('0x5c')][_0x2691('0x78')],'ListId':_0x732bf5[_0x2691('0x76')]});_0x186140[_0x4efd81[_0x2691('0x5c')][_0x2691('0x7b')]]=_0x4efd81[_0x2691('0x5c')][_0x2691('0x78')];return db['CmContact'][_0x2691('0x5f')](_0x186140,{'fields':_0x35df2f,'raw':!![]});}})[_0x2691('0x22')](handleEntityNotFound(_0x23cc21,null))['then'](function(_0x334bb0){_0x25c6d1[_0x2691('0x86')]=_0x334bb0;if(_0x334bb0){var _0x8b9a02={'ContactId':_0x334bb0['id'],'OpenchannelAccountId':_0x4efd81[_0x2691('0x60')]['id'],'from':(_0x334bb0[_0x2691('0x87')]||'')+'\x20'+(_0x334bb0[_0x2691('0x88')]||'')};var _0x1a4388={'OpenchannelAccountId':_0x4efd81['params']['id'],'closed':![]};if(_0x4efd81[_0x2691('0x5c')][_0x2691('0x89')]){_0x1a4388[_0x2691('0x89')]=_0x4efd81[_0x2691('0x5c')][_0x2691('0x89')];return db[_0x2691('0x8a')][_0x2691('0x5b')]({'where':_0x1a4388})[_0x2691('0x22')](function(_0x5fa2c7){if(_0x5fa2c7){return[_0x5fa2c7,![]];}_0x8b9a02[_0x2691('0x89')]=_0x4efd81[_0x2691('0x5c')][_0x2691('0x89')];_0x8b9a02['externalUrl']=_0x4efd81[_0x2691('0x5c')][_0x2691('0x8b')];return db['OpenchannelInteraction'][_0x2691('0x5f')](_0x8b9a02)[_0x2691('0x22')](function(_0x1016fb){return[_0x1016fb,!![]];});});}else{_0x1a4388[_0x2691('0x89')]=null;}_0x1a4388[_0x2691('0x8c')]=_0x334bb0['id'];return db['OpenchannelInteraction'][_0x2691('0x5b')]({'where':_0x1a4388})['then'](function(_0x21f6e1){if(_0x21f6e1){return[_0x21f6e1,![]];}return db[_0x2691('0x8a')][_0x2691('0x5f')](_0x8b9a02)[_0x2691('0x22')](function(_0x92900f){return[_0x92900f,!![]];});});}})[_0x2691('0x8d')](function(_0x43b90f,_0x5bd779){if(_0x43b90f){_0x3070c2=_0x5bd779;if(!_0x5bd779){var _0x2d2a1b={'from':(_0x25c6d1[_0x2691('0x86')][_0x2691('0x87')]||'')+'\x20'+(_0x25c6d1['contact']['lastName']||'')};if(_0x4efd81['body'][_0x2691('0x89')]&&_0x4efd81[_0x2691('0x5c')][_0x2691('0x8e')]&&_0x4efd81[_0x2691('0x5c')]['threadId']!=_0x4efd81['body'][_0x2691('0x8e')]){_0x2d2a1b['threadId']=_0x4efd81[_0x2691('0x5c')][_0x2691('0x8e')];}return _0x43b90f[_0x2691('0x34')](_0x2d2a1b);}else{return _0x43b90f;}}})[_0x2691('0x22')](function(_0x10eb92){_0x25c6d1[_0x2691('0x8f')]=_0x10eb92[_0x2691('0x36')]({'plain':!![]});_0x25c6d1[_0x2691('0x8f')][_0x2691('0x90')]=_0x3070c2;if(_0x25c6d1[_0x2691('0x8f')][_0x2691('0x90')]){if(_0x25c6d1[_0x2691('0x82')]['autoclose']){_0x25c6d1[_0x2691('0x83')][_0x2691('0x91')]({'id':0x0,'priority':_0x25c6d1[_0x2691('0x83')]['length']+0x1,'app':'close','appdata':_0x2691('0x92'),'interval':_0x2691('0x93')});}}return db['OpenchannelMessage'][_0x2691('0x5f')]({'body':_0x4efd81['body'][_0x2691('0x5c')],'OpenchannelAccountId':_0x4efd81['params']['id'],'OpenchannelInteractionId':_0x10eb92['id'],'direction':'in','ContactId':_0x25c6d1[_0x2691('0x86')]['id'],'AttachmentId':_0x4efd81[_0x2691('0x5c')][_0x2691('0x94')]});})['then'](function(_0x29a807){_0x25c6d1[_0x2691('0x27')]=_0x29a807;if(_0x25c6d1[_0x2691('0x8f')][_0x2691('0x95')]){return db[_0x2691('0x96')][_0x2691('0x5b')]({'attributes':['id',_0x2691('0x3a')],'where':{'id':_0x25c6d1[_0x2691('0x8f')]['UserId']}})['then'](function(_0x2a9126){if(_0x2a9126){_0x25c6d1[_0x2691('0x83')][_0x2691('0x97')]({'id':0x0,'priority':0x0,'app':_0x2691('0x98'),'appdata':_0x2a9126[_0x2691('0x3a')]+','+(_0x25c6d1['account'][_0x2691('0x99')]||0xa),'interval':_0x2691('0x93')});_0x25c6d1[_0x2691('0x9a')]=![];}return respondWithRpcPromise('Start',_0x2691('0x9b'),_0x25c6d1);});}return respondWithRpcPromise('Start',_0x2691('0x9b'),_0x25c6d1);})[_0x2691('0x22')](function(_0x17ef8f){respondWithRpcPromise(_0x2691('0x9c'),_0x2691('0x9c'),{'event':_0x2691('0x6f'),'message':_0x17ef8f},client9002);return _0x17ef8f;})[_0x2691('0x22')](respondWithResult(_0x23cc21,null))[_0x2691('0x55')](handleError(_0x23cc21,null));};exports[_0x2691('0x9d')]=function(_0xb14bc6,_0x52ca28,_0x16a1a2){return db[_0x2691('0x52')][_0x2691('0x66')]({'where':{'id':_0xb14bc6['params']['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x52ca28,null))[_0x2691('0x22')](function(_0x5ad558){if(_0x5ad558){return db[_0x2691('0x9e')][_0x2691('0x9f')](function(_0x204999){return db[_0x2691('0x80')][_0x2691('0x35')]({'where':{'OpenchannelAccountId':_0xb14bc6['params']['id']},'transaction':_0x204999})[_0x2691('0x22')](function(_0xf8ba02){var _0x1e544a=_['map'](_0xb14bc6[_0x2691('0x5c')],function(_0x22d962){_0x22d962['OpenchannelAccountId']=_0xb14bc6[_0x2691('0x60')]['id'];return _0x22d962;});return db[_0x2691('0x80')][_0x2691('0xa0')](_0x1e544a,{'transaction':_0x204999});});})[_0x2691('0x22')](function(){return db['OpenchannelApplication'][_0x2691('0xa1')]({'where':{'OpenchannelAccountId':_0xb14bc6[_0x2691('0x60')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x52ca28,null))[_0x2691('0x55')](handleError(_0x52ca28,null));};exports[_0x2691('0xa2')]=function(_0x5c2e60,_0x4f3ff8,_0x2270f7){var _0x530ddf={};var _0x19a3ae={};var _0x28b27d;var _0x17b5eb;return db[_0x2691('0x52')][_0x2691('0x66')]({'where':{'id':_0x5c2e60['params']['id']}})['then'](handleEntityNotFound(_0x4f3ff8,null))[_0x2691('0x22')](function(_0x5cfaa9){if(_0x5cfaa9){_0x28b27d=_0x5cfaa9;_0x19a3ae['model']=_['keys'](db[_0x2691('0x80')][_0x2691('0x6c')]);_0x19a3ae[_0x2691('0x42')]=_[_0x2691('0x58')](_0x5c2e60[_0x2691('0x42')]);_0x19a3ae[_0x2691('0x43')]=_[_0x2691('0x44')](_0x19a3ae[_0x2691('0x40')],_0x19a3ae[_0x2691('0x42')]);_0x530ddf[_0x2691('0x45')]=_[_0x2691('0x44')](_0x19a3ae[_0x2691('0x40')],qs[_0x2691('0x46')](_0x5c2e60['query'][_0x2691('0x46')]));_0x530ddf['attributes']=_0x530ddf['attributes'][_0x2691('0x47')]?_0x530ddf[_0x2691('0x45')]:_0x19a3ae['model'];_0x530ddf[_0x2691('0x6d')]=qs[_0x2691('0x4a')](_0x5c2e60['query']['sort']);_0x530ddf[_0x2691('0x4d')]=qs[_0x2691('0x43')](_[_0x2691('0x4b')](_0x5c2e60[_0x2691('0x42')],_0x19a3ae[_0x2691('0x43')]));if(_0x5c2e60['query'][_0x2691('0x4c')]){_0x530ddf[_0x2691('0x4d')]=_[_0x2691('0x59')](_0x530ddf[_0x2691('0x4d')],{'$or':_[_0x2691('0x41')](_0x530ddf['attributes'],function(_0x3a7123){var _0x332df7={};_0x332df7[_0x3a7123]={'$like':'%'+_0x5c2e60[_0x2691('0x42')][_0x2691('0x4c')]+'%'};return _0x332df7;})});}_0x530ddf=_[_0x2691('0x59')]({},_0x530ddf,_0x5c2e60['options']);return _0x28b27d[_0x2691('0xa2')](_0x530ddf);}})[_0x2691('0x22')](function(_0x3756ac){if(_0x3756ac){_0x17b5eb=_0x3756ac['length'];if(!_0x5c2e60[_0x2691('0x42')]['hasOwnProperty'](_0x2691('0x49'))){_0x530ddf[_0x2691('0x2f')]=qs[_0x2691('0x2f')](_0x5c2e60[_0x2691('0x42')][_0x2691('0x2f')]);_0x530ddf[_0x2691('0x2e')]=qs[_0x2691('0x2e')](_0x5c2e60[_0x2691('0x42')][_0x2691('0x2e')]);}return _0x28b27d[_0x2691('0xa2')](_0x530ddf);}})[_0x2691('0x22')](function(_0x2956bc){if(_0x2956bc){return _0x2956bc?{'count':_0x17b5eb,'rows':_0x2956bc}:null;}})[_0x2691('0x22')](respondWithResult(_0x4f3ff8,null))[_0x2691('0x55')](handleError(_0x4f3ff8,null));};exports[_0x2691('0xa3')]=function(_0xb33508,_0x15d5ad,_0x57986f){var _0x881c6b={'raw':![],'where':{}};var _0x5afc4d={};var _0x2e0452={'count':0x0,'rows':[]};return db[_0x2691('0x52')]['findOne']({'where':{'id':_0xb33508[_0x2691('0x60')]['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x15d5ad,null))[_0x2691('0x22')](function(_0x1d4995){if(_0x1d4995){_0x5afc4d[_0x2691('0x40')]=_[_0x2691('0x58')](db[_0x2691('0x8a')][_0x2691('0x6c')]);_0x5afc4d[_0x2691('0x42')]=_[_0x2691('0x58')](_0xb33508[_0x2691('0x42')]);_0x5afc4d['filters']=_[_0x2691('0x44')](_0x5afc4d[_0x2691('0x40')],_0x5afc4d['query']);_0x881c6b[_0x2691('0x45')]=_['intersection'](_0x5afc4d[_0x2691('0x40')],qs[_0x2691('0x46')](_0xb33508[_0x2691('0x42')]['fields']));_0x881c6b['attributes']=_0x881c6b[_0x2691('0x45')]['length']?_0x881c6b[_0x2691('0x45')]:_0x5afc4d[_0x2691('0x40')];if(!_0xb33508['query'][_0x2691('0x48')]('nolimit')){_0x881c6b[_0x2691('0x2f')]=qs[_0x2691('0x2f')](_0xb33508[_0x2691('0x42')]['limit']);_0x881c6b['offset']=qs[_0x2691('0x2e')](_0xb33508[_0x2691('0x42')][_0x2691('0x2e')]);}_0x881c6b[_0x2691('0x6d')]=qs[_0x2691('0x4a')](_0xb33508['query'][_0x2691('0x4a')]);_0x881c6b[_0x2691('0x4d')]=qs['filters'](_[_0x2691('0x4b')](_0xb33508[_0x2691('0x42')],_0x5afc4d[_0x2691('0x43')]));_0x881c6b[_0x2691('0x4d')][_0x2691('0x6e')]=_0x1d4995['id'];if(_0xb33508[_0x2691('0x42')]['filter']){_0x881c6b['where']=_[_0x2691('0x59')](_0x881c6b[_0x2691('0x4d')],{'$or':_[_0x2691('0x41')](_0x881c6b[_0x2691('0x45')],function(_0x537f9d){var _0x1bd4f2={};_0x1bd4f2[_0x537f9d]={'$like':'%'+_0xb33508['query'][_0x2691('0x4c')]+'%'};return _0x1bd4f2;})});}_0x881c6b=_[_0x2691('0x59')]({},_0x881c6b,_0xb33508[_0x2691('0x5a')]);return db[_0x2691('0x8a')][_0x2691('0x4f')]({'where':_0x881c6b['where']})[_0x2691('0x22')](function(_0xe9631f){_0x2e0452['count']=_0xe9631f;if(_0xb33508['query'][_0x2691('0x50')]){_0x881c6b[_0x2691('0x51')]=[{'model':db[_0x2691('0x71')],'as':_0x2691('0xa4'),'required':![]},{'model':db[_0x2691('0x96')],'as':_0x2691('0xa5'),'attributes':[_0x2691('0x3a'),_0x2691('0xa6'),_0x2691('0xa7')],'required':![]},{'model':db[_0x2691('0xa8')],'as':_0x2691('0xa9'),'attributes':['id',_0x2691('0x3a'),_0x2691('0xaa')],'where':_0xb33508[_0x2691('0x42')][_0x2691('0xab')]?{'id':_0xb33508[_0x2691('0x42')][_0x2691('0xab')]}:undefined,'required':_0xb33508[_0x2691('0x42')][_0x2691('0xab')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x2691('0x53')](_0x881c6b);})['then'](function(_0x314941){_0x2e0452[_0x2691('0x54')]=_0x314941;return _0x2e0452;});}})[_0x2691('0x22')](respondWithFilteredResult(_0x15d5ad,_0x881c6b))[_0x2691('0x55')](handleError(_0x15d5ad,null));};exports[_0x2691('0xac')]=function(_0x429730,_0x5c4541,_0x3d278e){return db[_0x2691('0x52')]['find']({'where':{'id':_0x429730['params']['id']}})['then'](handleEntityNotFound(_0x5c4541,null))[_0x2691('0x22')](function(_0x403c77){if(_0x403c77){return _0x403c77['addAgents'](_0x429730[_0x2691('0x5c')][_0x2691('0x68')],_[_0x2691('0xad')](_0x429730[_0x2691('0x5c')],['ids','id'])||{})[_0x2691('0x8d')](function(_0x5214d3){for(var _0x210496=0x0;_0x210496<_0x429730[_0x2691('0x5c')]['ids'][_0x2691('0x47')];_0x210496+=0x1){socket['emit'](_0x2691('0xae'),{'UserId':_0x429730[_0x2691('0x5c')][_0x2691('0x68')][_0x210496],'OpenchannelAccountId':_0x429730[_0x2691('0x60')]['id']});}return _0x5214d3;});}})[_0x2691('0x22')](respondWithResult(_0x5c4541,null))[_0x2691('0x55')](handleError(_0x5c4541,null));};exports['removeAgents']=function(_0x29acd8,_0x1fc376,_0x41338d){return db[_0x2691('0x52')][_0x2691('0x5b')]({'where':{'id':_0x29acd8[_0x2691('0x60')]['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x1fc376,null))['then'](function(_0x28a238){if(_0x28a238){return _0x28a238[_0x2691('0xaf')](_0x29acd8[_0x2691('0x42')]['ids'])[_0x2691('0x22')](function(){if(_['isArray'](_0x29acd8[_0x2691('0x42')][_0x2691('0x68')])){for(var _0x3529c7=0x0;_0x3529c7<_0x29acd8[_0x2691('0x42')]['ids'][_0x2691('0x47')];_0x3529c7+=0x1){socket[_0x2691('0xb0')](_0x2691('0xb1'),{'UserId':Number(_0x29acd8[_0x2691('0x42')]['ids'][_0x3529c7]),'OpenchannelAccountId':Number(_0x29acd8[_0x2691('0x60')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x29acd8['query'][_0x2691('0x68')]),'OpenchannelAccountId':Number(_0x29acd8[_0x2691('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fc376,null))['catch'](handleError(_0x1fc376,null));};exports['getAgents']=function(_0xc3cec1,_0xe04c63,_0x23cb22){var _0x1a21af={};var _0x5e61c={};var _0x9ec3f0;var _0x1cbe7e;return db[_0x2691('0x52')][_0x2691('0x66')]({'where':{'id':_0xc3cec1['params']['id']}})[_0x2691('0x22')](handleEntityNotFound(_0xe04c63,null))[_0x2691('0x22')](function(_0x9169aa){if(_0x9169aa){_0x9ec3f0=_0x9169aa;_0x5e61c[_0x2691('0x40')]=_[_0x2691('0x58')](db['User'][_0x2691('0x6c')]);_0x5e61c[_0x2691('0x42')]=_[_0x2691('0x58')](_0xc3cec1[_0x2691('0x42')]);_0x5e61c[_0x2691('0x43')]=_['intersection'](_0x5e61c['model'],_0x5e61c[_0x2691('0x42')]);_0x1a21af['attributes']=_[_0x2691('0x44')](_0x5e61c['model'],qs[_0x2691('0x46')](_0xc3cec1[_0x2691('0x42')][_0x2691('0x46')]));_0x1a21af[_0x2691('0x45')]=_0x1a21af['attributes'][_0x2691('0x47')]?_0x1a21af['attributes']:_0x5e61c[_0x2691('0x40')];_0x1a21af[_0x2691('0x6d')]=qs[_0x2691('0x4a')](_0xc3cec1['query']['sort']);_0x1a21af[_0x2691('0x4d')]=qs[_0x2691('0x43')](_[_0x2691('0x4b')](_0xc3cec1[_0x2691('0x42')],_0x5e61c[_0x2691('0x43')]));if(_0xc3cec1[_0x2691('0x42')][_0x2691('0x4c')]){_0x1a21af['where']=_['merge'](_0x1a21af[_0x2691('0x4d')],{'$or':_[_0x2691('0x41')](_0x1a21af['attributes'],function(_0x1d57da){var _0x391a18={};_0x391a18[_0x1d57da]={'$like':'%'+_0xc3cec1[_0x2691('0x42')][_0x2691('0x4c')]+'%'};return _0x391a18;})});}_0x1a21af=_[_0x2691('0x59')]({},_0x1a21af,_0xc3cec1[_0x2691('0x5a')]);return _0x9ec3f0['getAgents'](_0x1a21af);}})[_0x2691('0x22')](function(_0x2010e0){if(_0x2010e0){_0x1cbe7e=_0x2010e0[_0x2691('0x47')];if(!_0xc3cec1[_0x2691('0x42')][_0x2691('0x48')]('nolimit')){_0x1a21af[_0x2691('0x2f')]=qs['limit'](_0xc3cec1[_0x2691('0x42')][_0x2691('0x2f')]);_0x1a21af[_0x2691('0x2e')]=qs[_0x2691('0x2e')](_0xc3cec1['query'][_0x2691('0x2e')]);}return _0x9ec3f0[_0x2691('0xb2')](_0x1a21af);}})[_0x2691('0x22')](function(_0x138d91){if(_0x138d91){return _0x138d91?{'count':_0x1cbe7e,'rows':_0x138d91}:null;}})[_0x2691('0x22')](respondWithResult(_0xe04c63,null))[_0x2691('0x55')](handleError(_0xe04c63,null));};exports[_0x2691('0x3b')]=function(_0x4e852a,_0x2b1641,_0x33f0d5){var _0x32f1b1,_0x499f06,_0x1af7d8;if(_[_0x2691('0x77')](_0x4e852a[_0x2691('0x5c')][_0x2691('0x5c')])||_0x4e852a['body'][_0x2691('0x5c')]===''){throw new db[(_0x2691('0x1e'))][(_0x2691('0x1f'))](_0x2691('0x7a'));}if(_[_0x2691('0x77')](_0x4e852a[_0x2691('0x5c')]['to'])){}_0x32f1b1=_0x4e852a[_0x2691('0x5c')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4e852a[_0x2691('0x60')]['id']}})[_0x2691('0x22')](handleEntityNotFound(_0x2b1641,null))[_0x2691('0x22')](function(_0x513ac9){if(_0x513ac9){return db['OpenchannelAccount'][_0x2691('0x5b')]({'where':{'id':_0x513ac9['id']},'include':[{'model':db[_0x2691('0x7d')],'as':_0x2691('0x7e'),'include':[{'model':db[_0x2691('0x71')],'as':'Contacts','where':{[_0x513ac9[_0x2691('0x7b')]]:_0x32f1b1},'limit':0x1,'order':[[_0x2691('0x74'),'DESC']]}]}]})[_0x2691('0x22')](handleEntityNotFound(_0x2b1641,null))[_0x2691('0x22')](function(_0x156a5c){if(_0x156a5c&&_0x156a5c[_0x2691('0x7e')]){_0x499f06=_0x156a5c[_0x2691('0x36')]({'plain':!![]});if(_0x499f06[_0x2691('0x7e')]&&_0x499f06[_0x2691('0x7e')][_0x2691('0x7f')][_0x2691('0x47')]){return _0x499f06['List'][_0x2691('0x7f')][0x0];}return db['CmContact'][_0x2691('0x5f')](_['defaults'](_0x4e852a[_0x2691('0x5c')],{'firstName':_0x32f1b1,[_0x156a5c[_0x2691('0x7b')]]:_0x32f1b1,'phone':_0x32f1b1,'ListId':_0x499f06[_0x2691('0x76')]}));}})[_0x2691('0x22')](handleEntityNotFound(_0x2b1641,null))['then'](function(_0x4efdd2){if(_0x4efdd2){_0x1af7d8=_0x4efdd2;return db[_0x2691('0x8a')]['find']({'where':{'ContactId':_0x1af7d8['id'],'closed':![],'OpenchannelAccountId':_0x499f06['id']}})[_0x2691('0x22')](function(_0x1997c0){if(_0x1997c0){return[_0x1997c0,![]];}return db[_0x2691('0x8a')][_0x2691('0x5f')]({'UserId':_0x4e852a[_0x2691('0x5d')]['id'],'ContactId':_0x1af7d8['id'],'OpenchannelAccountId':_0x499f06['id'],'lastMsgDirection':_0x2691('0xb3'),'Messages':[_[_0x2691('0x59')](_0x4e852a['body'],{'read':![],'body':_0x4e852a[_0x2691('0x5c')]['body'],'OpenchannelAccountId':_0x499f06['id'],'UserId':_0x4e852a[_0x2691('0x5d')]['id'],'ContactId':_0x1af7d8['id']})]},{'include':[{'model':db[_0x2691('0xb4')],'as':_0x2691('0xb5')}]})['then'](function(_0x4c88ff){return[_0x4c88ff,!![]];});});}})[_0x2691('0x8d')](function(_0x11ec7a,_0x2062ed){if(_0x2062ed){return _0x11ec7a;}return db[_0x2691('0xb4')][_0x2691('0x5f')](_['merge'](_0x4e852a[_0x2691('0x5c')],{'read':![],'body':_0x4e852a[_0x2691('0x5c')][_0x2691('0x5c')],'OpenchannelAccountId':_0x499f06['id'],'OpenchannelInteractionId':_0x11ec7a['id'],'UserId':_0x4e852a['user']['id'],'ContactId':_0x1af7d8['id']}))['then'](function(_0x3ec487){_0x11ec7a[_0x2691('0xb6')][_0x2691('0xb5')]=[];_0x11ec7a['dataValues'][_0x2691('0xb5')][_0x2691('0x91')](_0x3ec487[_0x2691('0xb6')]);return _0x11ec7a;});});}})['then'](respondWithResult(_0x2b1641,null))[_0x2691('0x55')](handleError(_0x2b1641,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 38bee65..d729c44 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 _0xc729=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x472f8d,_0x4a6784){var _0x2732cb=function(_0x3dfc9c){while(--_0x3dfc9c){_0x472f8d['push'](_0x472f8d['shift']());}};_0x2732cb(++_0x4a6784);}(_0xc729,0xf6));var _0x9c72=function(_0x17eaf0,_0x15c5be){_0x17eaf0=_0x17eaf0-0x0;var _0x366123=_0xc729[_0x17eaf0];return _0x366123;};'use strict';var EventEmitter=require(_0x9c72('0x0'));var OpenchannelAccount=require(_0x9c72('0x1'))['db'][_0x9c72('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9c72('0x3')](0x0);var events={'afterCreate':_0x9c72('0x4'),'afterUpdate':_0x9c72('0x5'),'afterDestroy':_0x9c72('0x6')};function emitEvent(_0x1e2031){return function(_0x1bcb2e,_0x319775,_0x3621f3){OpenchannelAccountEvents[_0x9c72('0x7')](_0x1e2031+':'+_0x1bcb2e['id'],_0x1bcb2e);OpenchannelAccountEvents[_0x9c72('0x7')](_0x1e2031,_0x1bcb2e);_0x3621f3(null);};}for(var e in events){if(events[_0x9c72('0x8')](e)){var event=events[e];OpenchannelAccount[_0x9c72('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xf118=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x21c465,_0x1de5b7){var _0x11b525=function(_0x1adb80){while(--_0x1adb80){_0x21c465['push'](_0x21c465['shift']());}};_0x11b525(++_0x1de5b7);}(_0xf118,0x6f));var _0x8f11=function(_0x4ac5c1,_0x12f4bc){_0x4ac5c1=_0x4ac5c1-0x0;var _0x17c632=_0xf118[_0x4ac5c1];return _0x17c632;};'use strict';var EventEmitter=require(_0x8f11('0x0'));var OpenchannelAccount=require(_0x8f11('0x1'))['db'][_0x8f11('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8f11('0x3')](0x0);var events={'afterCreate':_0x8f11('0x4'),'afterUpdate':_0x8f11('0x5'),'afterDestroy':_0x8f11('0x6')};function emitEvent(_0xe7dd9c){return function(_0x3b8952,_0x49ee84,_0xebe056){OpenchannelAccountEvents[_0x8f11('0x7')](_0xe7dd9c+':'+_0x3b8952['id'],_0x3b8952);OpenchannelAccountEvents[_0x8f11('0x7')](_0xe7dd9c,_0x3b8952);_0xebe056(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x8f11('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ba022f8..4e7a332 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 _0x38ad=['OpenchannelAccount','openchannel_accounts','lodash','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x38ad,0x1e2));var _0xd38a=function(_0x9aac32,_0x4ca635){_0x9aac32=_0x9aac32-0x0;var _0x559233=_0x38ad[_0x9aac32];return _0x559233;};'use strict';var _=require(_0xd38a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd38a('0x1'));var moment=require('moment');var BPromise=require(_0xd38a('0x2'));var rp=require(_0xd38a('0x3'));var fs=require('fs');var path=require(_0xd38a('0x4'));var rimraf=require('rimraf');var config=require(_0xd38a('0x5'));var attributes=require('./openchannelAccount.attributes');module[_0xd38a('0x6')]=function(_0x2a0e29,_0x2a7705){return _0x2a0e29[_0xd38a('0x7')](_0xd38a('0x8'),attributes,{'tableName':_0xd38a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8e2=['define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes'];(function(_0x443fd3,_0x5f4837){var _0x316430=function(_0x58ce22){while(--_0x58ce22){_0x443fd3['push'](_0x443fd3['shift']());}};_0x316430(++_0x5f4837);}(_0xc8e2,0xea));var _0x2c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2c8e('0x0'));var logger=require(_0x2c8e('0x1'))('api');var moment=require(_0x2c8e('0x2'));var BPromise=require('bluebird');var rp=require(_0x2c8e('0x3'));var fs=require('fs');var path=require(_0x2c8e('0x4'));var rimraf=require(_0x2c8e('0x5'));var config=require(_0x2c8e('0x6'));var attributes=require(_0x2c8e('0x7'));module['exports']=function(_0x11379d,_0x4fec61){return _0x11379d[_0x2c8e('0x8')](_0x2c8e('0x9'),attributes,{'tableName':_0x2c8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 7d62372..73f8bc3 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 _0xe7b8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x248c98,_0xb8728e){var _0x1e2f7b=function(_0x3db8a8){while(--_0x3db8a8){_0x248c98['push'](_0x248c98['shift']());}};_0x1e2f7b(++_0xb8728e);}(_0xe7b8,0x144));var _0x8e7b=function(_0x4fe0ed,_0x5d3008){_0x4fe0ed=_0x4fe0ed-0x0;var _0x2c474d=_0xe7b8[_0x4fe0ed];return _0x2c474d;};'use strict';var _=require('lodash');var util=require(_0x8e7b('0x0'));var moment=require(_0x8e7b('0x1'));var BPromise=require(_0x8e7b('0x2'));var rs=require(_0x8e7b('0x3'));var fs=require('fs');var Redis=require(_0x8e7b('0x4'));var db=require(_0x8e7b('0x5'))['db'];var utils=require(_0x8e7b('0x6'));var logger=require(_0x8e7b('0x7'))(_0x8e7b('0x8'));var config=require(_0x8e7b('0x9'));var jayson=require(_0x8e7b('0xa'));var client=jayson[_0x8e7b('0xb')][_0x8e7b('0xc')]({'port':0x232a});config[_0x8e7b('0xd')]=_[_0x8e7b('0xe')](config[_0x8e7b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e7b('0xf'))(new Redis(config[_0x8e7b('0xd')]));require(_0x8e7b('0x10'))[_0x8e7b('0x11')](socket);function respondWithRpcPromise(_0x311a16,_0x3f940f,_0x395cce){return new BPromise(function(_0x136fb9,_0x5d9c7c){return client[_0x8e7b('0x12')](_0x311a16,_0x395cce)[_0x8e7b('0x13')](function(_0x2527f0){logger['info'](_0x8e7b('0x14'),_0x3f940f,'request\x20sent');logger[_0x8e7b('0x15')](_0x8e7b('0x16'),_0x3f940f,'request\x20sent',JSON[_0x8e7b('0x17')](_0x2527f0));if(_0x2527f0[_0x8e7b('0x18')]){if(_0x2527f0[_0x8e7b('0x18')][_0x8e7b('0x19')]===0x1f4){logger[_0x8e7b('0x18')](_0x8e7b('0x14'),_0x3f940f,_0x2527f0[_0x8e7b('0x18')][_0x8e7b('0x1a')]);return _0x5d9c7c(_0x2527f0['error'][_0x8e7b('0x1a')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3f940f,_0x2527f0[_0x8e7b('0x18')][_0x8e7b('0x1a')]);return _0x136fb9(_0x2527f0[_0x8e7b('0x18')]['message']);}else{logger['info'](_0x8e7b('0x14'),_0x3f940f,_0x8e7b('0x1b'));_0x136fb9(_0x2527f0[_0x8e7b('0x1c')][_0x8e7b('0x1a')]);}})[_0x8e7b('0x1d')](function(_0x12b8b5){logger[_0x8e7b('0x18')](_0x8e7b('0x14'),_0x3f940f,_0x12b8b5);_0x5d9c7c(_0x12b8b5);});});} \ No newline at end of file +var _0x4f84=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0xc466dd,_0x452034){var _0x491d85=function(_0x3ad638){while(--_0x3ad638){_0xc466dd['push'](_0xc466dd['shift']());}};_0x491d85(++_0x452034);}(_0x4f84,0x76));var _0x44f8=function(_0x146907,_0x541dcb){_0x146907=_0x146907-0x0;var _0x47e370=_0x4f84[_0x146907];return _0x47e370;};'use strict';var _=require(_0x44f8('0x0'));var util=require(_0x44f8('0x1'));var moment=require(_0x44f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x44f8('0x3'));var fs=require('fs');var Redis=require(_0x44f8('0x4'));var db=require(_0x44f8('0x5'))['db'];var utils=require(_0x44f8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x44f8('0x7'));var jayson=require(_0x44f8('0x8'));var client=jayson[_0x44f8('0x9')]['http']({'port':0x232a});config[_0x44f8('0xa')]=_[_0x44f8('0xb')](config[_0x44f8('0xa')],{'host':_0x44f8('0xc'),'port':0x18eb});var socket=require(_0x44f8('0xd'))(new Redis(config[_0x44f8('0xa')]));require(_0x44f8('0xe'))[_0x44f8('0xf')](socket);function respondWithRpcPromise(_0x4f2779,_0x5ab5b1,_0x4294d2){return new BPromise(function(_0x1bf1c9,_0x25e029){return client[_0x44f8('0x10')](_0x4f2779,_0x4294d2)[_0x44f8('0x11')](function(_0x5c4f1d){logger[_0x44f8('0x12')](_0x44f8('0x13'),_0x5ab5b1,_0x44f8('0x14'));logger['debug'](_0x44f8('0x15'),_0x5ab5b1,_0x44f8('0x14'),JSON[_0x44f8('0x16')](_0x5c4f1d));if(_0x5c4f1d[_0x44f8('0x17')]){if(_0x5c4f1d[_0x44f8('0x17')]['code']===0x1f4){logger['error'](_0x44f8('0x13'),_0x5ab5b1,_0x5c4f1d[_0x44f8('0x17')][_0x44f8('0x18')]);return _0x25e029(_0x5c4f1d[_0x44f8('0x17')][_0x44f8('0x18')]);}logger[_0x44f8('0x17')](_0x44f8('0x13'),_0x5ab5b1,_0x5c4f1d['error'][_0x44f8('0x18')]);return _0x1bf1c9(_0x5c4f1d[_0x44f8('0x17')][_0x44f8('0x18')]);}else{logger[_0x44f8('0x12')](_0x44f8('0x13'),_0x5ab5b1,_0x44f8('0x14'));_0x1bf1c9(_0x5c4f1d['result'][_0x44f8('0x18')]);}})[_0x44f8('0x19')](function(_0x50465f){logger[_0x44f8('0x17')](_0x44f8('0x13'),_0x5ab5b1,_0x50465f);_0x25e029(_0x50465f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6af6bfd..5a72bdd 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 _0x4d86=['register','length','./openchannelAccount.events','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d86,0x128));var _0x64d8=function(_0x5404af,_0x4bc84d){_0x5404af=_0x5404af-0x0;var _0x1846c1=_0x4d86[_0x5404af];return _0x1846c1;};'use strict';var OpenchannelAccountEvents=require(_0x64d8('0x0'));var events=['save',_0x64d8('0x1'),'update'];function createListener(_0x2efe08,_0x3b1f01){return function(_0x352aa2){_0x3b1f01[_0x64d8('0x2')](_0x2efe08,_0x352aa2);};}function removeListener(_0x21dcb7,_0x5c273c){return function(){OpenchannelAccountEvents[_0x64d8('0x3')](_0x21dcb7,_0x5c273c);};}exports[_0x64d8('0x4')]=function(_0x43ed4f){for(var _0x1c2daa=0x0,_0x429836=events[_0x64d8('0x5')];_0x1c2daa<_0x429836;_0x1c2daa++){var _0x3104dd=events[_0x1c2daa];var _0x48d7c3=createListener('openchannelAccount:'+_0x3104dd,_0x43ed4f);OpenchannelAccountEvents['on'](_0x3104dd,_0x48d7c3);}}; \ No newline at end of file +var _0xb72f=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','update','emit'];(function(_0x990dca,_0x2bf1f3){var _0x114a82=function(_0x48634b){while(--_0x48634b){_0x990dca['push'](_0x990dca['shift']());}};_0x114a82(++_0x2bf1f3);}(_0xb72f,0x115));var _0xfb72=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0xb72f[_0x318256];return _0xb1e352;};'use strict';var OpenchannelAccountEvents=require(_0xfb72('0x0'));var events=['save','remove',_0xfb72('0x1')];function createListener(_0x2e883e,_0x10bd15){return function(_0x55ff6c){_0x10bd15[_0xfb72('0x2')](_0x2e883e,_0x55ff6c);};}function removeListener(_0x19f604,_0x403a8f){return function(){OpenchannelAccountEvents[_0xfb72('0x3')](_0x19f604,_0x403a8f);};}exports[_0xfb72('0x4')]=function(_0x418a99){for(var _0x273ef3=0x0,_0x125463=events[_0xfb72('0x5')];_0x273ef3<_0x125463;_0x273ef3++){var _0xe288a9=events[_0x273ef3];var _0x5df19d=createListener(_0xfb72('0x6')+_0xe288a9,_0x418a99);OpenchannelAccountEvents['on'](_0xe288a9,_0x5df19d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0b5901a..e1bd73c 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 _0x6f6e=['/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x6f6e,0x106));var _0xe6f6=function(_0x55a70a,_0x45166b){_0x55a70a=_0x55a70a-0x0;var _0x578c8b=_0x6f6e[_0x55a70a];return _0x578c8b;};'use strict';var multer=require('multer');var util=require(_0xe6f6('0x0'));var path=require(_0xe6f6('0x1'));var timeout=require(_0xe6f6('0x2'));var express=require(_0xe6f6('0x3'));var router=express[_0xe6f6('0x4')]();var auth=require(_0xe6f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe6f6('0x6'));var controller=require(_0xe6f6('0x7'));router[_0xe6f6('0x8')]('/',auth[_0xe6f6('0x9')](),controller['index']);router[_0xe6f6('0x8')](_0xe6f6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe6f6('0xb')]('/',auth[_0xe6f6('0x9')](),controller[_0xe6f6('0xc')]);router['put']('/:id',auth[_0xe6f6('0x9')](),controller[_0xe6f6('0xd')]);router[_0xe6f6('0xe')](_0xe6f6('0xa'),auth['isAuthenticated'](),controller[_0xe6f6('0xf')]);module[_0xe6f6('0x10')]=router; \ No newline at end of file +var _0x76a1=['express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout'];(function(_0x82ed42,_0x14295f){var _0x3d2317=function(_0x2cc526){while(--_0x2cc526){_0x82ed42['push'](_0x82ed42['shift']());}};_0x3d2317(++_0x14295f);}(_0x76a1,0x14d));var _0x176a=function(_0x58f116,_0x423fd7){_0x58f116=_0x58f116-0x0;var _0x2de755=_0x76a1[_0x58f116];return _0x2de755;};'use strict';var multer=require(_0x176a('0x0'));var util=require(_0x176a('0x1'));var path=require('path');var timeout=require(_0x176a('0x2'));var express=require(_0x176a('0x3'));var router=express[_0x176a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x176a('0x5'));var config=require('../../config/environment');var controller=require(_0x176a('0x6'));router[_0x176a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x176a('0x7')]('/:id',auth[_0x176a('0x8')](),controller['show']);router[_0x176a('0x9')]('/',auth[_0x176a('0x8')](),controller[_0x176a('0xa')]);router[_0x176a('0xb')]('/:id',auth[_0x176a('0x8')](),controller[_0x176a('0xc')]);router[_0x176a('0xd')](_0x176a('0xe'),auth[_0x176a('0x8')](),controller[_0x176a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 00d032c..b62aa41 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 _0x3e45=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x4dca20,_0x54277b){var _0x43124a=function(_0x354808){while(--_0x354808){_0x4dca20['push'](_0x4dca20['shift']());}};_0x43124a(++_0x54277b);}(_0x3e45,0x85));var _0x53e4=function(_0x401b2c,_0x56ec09){_0x401b2c=_0x401b2c-0x0;var _0x1800c4=_0x3e45[_0x401b2c];return _0x1800c4;};'use strict';var Sequelize=require(_0x53e4('0x0'));module[_0x53e4('0x1')]={'priority':{'type':Sequelize[_0x53e4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x53e4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x53e4('0x4')]()},'description':{'type':Sequelize[_0x53e4('0x3')]},'interval':{'type':Sequelize[_0x53e4('0x3')],'defaultValue':_0x53e4('0x5')}}; \ No newline at end of file +var _0x3a52=['TEXT','sequelize','INTEGER','STRING','noop'];(function(_0x3b5620,_0x560053){var _0x1cab1d=function(_0x391a92){while(--_0x391a92){_0x3b5620['push'](_0x3b5620['shift']());}};_0x1cab1d(++_0x560053);}(_0x3a52,0x182));var _0x23a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a52[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x23a5('0x0'));module['exports']={'priority':{'type':Sequelize[_0x23a5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x23a5('0x2')],'allowNull':![],'defaultValue':_0x23a5('0x3')},'appdata':{'type':Sequelize[_0x23a5('0x4')]()},'description':{'type':Sequelize[_0x23a5('0x2')]},'interval':{'type':Sequelize[_0x23a5('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2d3135f..e4ec3d3 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 _0x2135=['html-pdf','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy'];(function(_0xa6c74a,_0x318c94){var _0x3b9814=function(_0x3d54a6){while(--_0x3d54a6){_0xa6c74a['push'](_0xa6c74a['shift']());}};_0x3b9814(++_0x318c94);}(_0x2135,0x1aa));var _0x5213=function(_0x40f7e2,_0x24abd5){_0x40f7e2=_0x40f7e2-0x0;var _0x561a51=_0x2135[_0x40f7e2];return _0x561a51;};'use strict';var pdf=require(_0x5213('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5213('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5213('0x2'));var moment=require('moment');var BPromise=require(_0x5213('0x3'));var Mustache=require(_0x5213('0x4'));var util=require('util');var path=require(_0x5213('0x5'));var sox=require('sox');var csv=require(_0x5213('0x6'));var ejs=require(_0x5213('0x7'));var fs=require('fs');var _=require(_0x5213('0x8'));var squel=require('squel');var crypto=require(_0x5213('0x9'));var jsforce=require(_0x5213('0xa'));var deskjs=require(_0x5213('0xb'));var toCsv=require(_0x5213('0x6'));var querystring=require(_0x5213('0xc'));var Papa=require('papaparse');var Redis=require(_0x5213('0xd'));var authService=require(_0x5213('0xe'));var qs=require(_0x5213('0xf'));var as=require(_0x5213('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5213('0x11'));var utils=require(_0x5213('0x12'));var config=require(_0x5213('0x13'));var db=require(_0x5213('0x14'))['db'];function respondWithStatusCode(_0x3ed31b,_0xe4c84b){_0xe4c84b=_0xe4c84b||0xcc;return function(_0x383975){if(_0x383975){return _0x3ed31b[_0x5213('0x15')](_0xe4c84b);}return _0x3ed31b[_0x5213('0x16')](_0xe4c84b)[_0x5213('0x17')]();};}function respondWithResult(_0x1924b4,_0x2baca0){_0x2baca0=_0x2baca0||0xc8;return function(_0x46043a){if(_0x46043a){return _0x1924b4[_0x5213('0x16')](_0x2baca0)[_0x5213('0x18')](_0x46043a);}};}function respondWithFilteredResult(_0x466b94,_0x452f97){return function(_0x5e740f){if(_0x5e740f){var _0x36edc2=_0x5e740f[_0x5213('0x19')],_0x2004d2=_0x452f97[_0x5213('0x1a')],_0x1e55c0=_0x452f97['offset']+_0x452f97[_0x5213('0x1b')],_0x5d8e92;if(_0x1e55c0>=_0x36edc2){_0x1e55c0=_0x36edc2;_0x5d8e92=0xc8;}else{_0x5d8e92=0xce;}_0x466b94['status'](_0x5d8e92);return _0x466b94[_0x5213('0x1c')](_0x5213('0x1d'),_0x2004d2+'-'+_0x1e55c0+'/'+_0x36edc2)[_0x5213('0x18')](_0x5e740f);}return null;};}function patchUpdates(_0x15e4fd){return function(_0x412476){try{jsonpatch[_0x5213('0x1e')](_0x412476,_0x15e4fd,!![]);}catch(_0x2e47f9){return BPromise[_0x5213('0x1f')](_0x2e47f9);}return _0x412476[_0x5213('0x20')]();};}function saveUpdates(_0x229fda,_0x50f673){return function(_0x25e0ac){if(_0x25e0ac){return _0x25e0ac[_0x5213('0x21')](_0x229fda)[_0x5213('0x22')](function(_0xb768eb){return _0xb768eb;});}return null;};}function removeEntity(_0x56ee01,_0x224fbe){return function(_0x176ea3){if(_0x176ea3){return _0x176ea3['destroy']()[_0x5213('0x22')](function(){_0x56ee01['status'](0xcc)[_0x5213('0x17')]();});}};}function handleEntityNotFound(_0x4209d2,_0x5b63ff){return function(_0x3d297c){if(!_0x3d297c){_0x4209d2[_0x5213('0x15')](0x194);}return _0x3d297c;};}function handleError(_0x105ccc,_0x55c3b4){_0x55c3b4=_0x55c3b4||0x1f4;return function(_0x38e316){logger[_0x5213('0x23')](_0x38e316[_0x5213('0x24')]);if(_0x38e316[_0x5213('0x25')]){delete _0x38e316['name'];}_0x105ccc[_0x5213('0x16')](_0x55c3b4)[_0x5213('0x26')](_0x38e316);};}exports[_0x5213('0x27')]=function(_0x16023b,_0x4bafc9){var _0xc7718b={},_0x23fb20={},_0x4eb6aa={'count':0x0,'rows':[]};var _0x3c31cd=_['map'](db[_0x5213('0x28')][_0x5213('0x29')],function(_0x52dfa0){return{'name':_0x52dfa0[_0x5213('0x2a')],'type':_0x52dfa0[_0x5213('0x2b')][_0x5213('0x2c')]};});_0x23fb20[_0x5213('0x2d')]=_[_0x5213('0x2e')](_0x3c31cd,'name');_0x23fb20[_0x5213('0x2f')]=_['keys'](_0x16023b[_0x5213('0x2f')]);_0x23fb20[_0x5213('0x30')]=_[_0x5213('0x31')](_0x23fb20[_0x5213('0x2d')],_0x23fb20[_0x5213('0x2f')]);_0xc7718b[_0x5213('0x32')]=_[_0x5213('0x31')](_0x23fb20['model'],qs[_0x5213('0x33')](_0x16023b[_0x5213('0x2f')][_0x5213('0x33')]));_0xc7718b['attributes']=_0xc7718b[_0x5213('0x32')]['length']?_0xc7718b[_0x5213('0x32')]:_0x23fb20[_0x5213('0x2d')];if(!_0x16023b[_0x5213('0x2f')][_0x5213('0x34')](_0x5213('0x35'))){_0xc7718b['limit']=qs[_0x5213('0x1b')](_0x16023b['query'][_0x5213('0x1b')]);_0xc7718b[_0x5213('0x1a')]=qs['offset'](_0x16023b[_0x5213('0x2f')]['offset']);}_0xc7718b[_0x5213('0x36')]=qs['sort'](_0x16023b['query']['sort']);_0xc7718b[_0x5213('0x37')]=qs['filters'](_[_0x5213('0x38')](_0x16023b['query'],_0x23fb20[_0x5213('0x30')]),_0x3c31cd);if(_0x16023b[_0x5213('0x2f')][_0x5213('0x39')]){_0xc7718b[_0x5213('0x37')]=_[_0x5213('0x3a')](_0xc7718b['where'],{'$or':_[_0x5213('0x2e')](_0x3c31cd,function(_0x33e1f2){if(_0x33e1f2[_0x5213('0x2b')]!==_0x5213('0x3b')){var _0x45e4df={};_0x45e4df[_0x33e1f2[_0x5213('0x25')]]={'$like':'%'+_0x16023b[_0x5213('0x2f')][_0x5213('0x39')]+'%'};return _0x45e4df;}})});}_0xc7718b=_[_0x5213('0x3a')]({},_0xc7718b,_0x16023b[_0x5213('0x3c')]);var _0x54a840={'where':_0xc7718b[_0x5213('0x37')]};return db[_0x5213('0x28')][_0x5213('0x19')](_0x54a840)[_0x5213('0x22')](function(_0x1b532e){_0x4eb6aa[_0x5213('0x19')]=_0x1b532e;if(_0x16023b[_0x5213('0x2f')][_0x5213('0x3d')]){_0xc7718b['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5213('0x3e')](_0xc7718b);})[_0x5213('0x22')](function(_0x219078){_0x4eb6aa[_0x5213('0x3f')]=_0x219078;return _0x4eb6aa;})[_0x5213('0x22')](respondWithFilteredResult(_0x4bafc9,_0xc7718b))[_0x5213('0x40')](handleError(_0x4bafc9,null));};exports[_0x5213('0x41')]=function(_0x30a6f0,_0x4f72e5){var _0x27a008={'raw':!![],'where':{'id':_0x30a6f0[_0x5213('0x42')]['id']}},_0x14c534={};_0x14c534[_0x5213('0x2d')]=_['keys'](db['OpenchannelApplication'][_0x5213('0x29')]);_0x14c534[_0x5213('0x2f')]=_['keys'](_0x30a6f0[_0x5213('0x2f')]);_0x14c534[_0x5213('0x30')]=_[_0x5213('0x31')](_0x14c534['model'],_0x14c534['query']);_0x27a008[_0x5213('0x32')]=_['intersection'](_0x14c534['model'],qs[_0x5213('0x33')](_0x30a6f0[_0x5213('0x2f')][_0x5213('0x33')]));_0x27a008[_0x5213('0x32')]=_0x27a008['attributes']['length']?_0x27a008[_0x5213('0x32')]:_0x14c534[_0x5213('0x2d')];if(_0x30a6f0[_0x5213('0x2f')]['includeAll']){_0x27a008['include']=[{'all':!![]}];}_0x27a008=_[_0x5213('0x3a')]({},_0x27a008,_0x30a6f0[_0x5213('0x3c')]);return db[_0x5213('0x28')][_0x5213('0x43')](_0x27a008)[_0x5213('0x22')](handleEntityNotFound(_0x4f72e5,null))['then'](respondWithResult(_0x4f72e5,null))[_0x5213('0x40')](handleError(_0x4f72e5,null));};exports[_0x5213('0x44')]=function(_0x2e8ed6,_0x199d2a){return db[_0x5213('0x28')][_0x5213('0x44')](_0x2e8ed6['body'],{})['then'](respondWithResult(_0x199d2a,0xc9))[_0x5213('0x40')](handleError(_0x199d2a,null));};exports[_0x5213('0x21')]=function(_0x4534ec,_0x33dc37){if(_0x4534ec['body']['id']){delete _0x4534ec[_0x5213('0x45')]['id'];}return db['OpenchannelApplication'][_0x5213('0x43')]({'where':{'id':_0x4534ec[_0x5213('0x42')]['id']}})['then'](handleEntityNotFound(_0x33dc37,null))[_0x5213('0x22')](saveUpdates(_0x4534ec['body'],null))[_0x5213('0x22')](respondWithResult(_0x33dc37,null))['catch'](handleError(_0x33dc37,null));};exports[_0x5213('0x46')]=function(_0x16cc76,_0x271083){return db[_0x5213('0x28')][_0x5213('0x43')]({'where':{'id':_0x16cc76[_0x5213('0x42')]['id']}})[_0x5213('0x22')](handleEntityNotFound(_0x271083,null))[_0x5213('0x22')](removeEntity(_0x271083,null))[_0x5213('0x40')](handleError(_0x271083,null));}; \ No newline at end of file +var _0x3ab9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','filters','create','body','find','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0xa69b62,_0x46eaf1){var _0x10b454=function(_0x1107d2){while(--_0x1107d2){_0xa69b62['push'](_0xa69b62['shift']());}};_0x10b454(++_0x46eaf1);}(_0x3ab9,0x105));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x93ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93ab('0x1'));var zipdir=require(_0x93ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93ab('0x3'));var moment=require(_0x93ab('0x4'));var BPromise=require(_0x93ab('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x93ab('0x6'));var sox=require(_0x93ab('0x7'));var csv=require(_0x93ab('0x8'));var ejs=require(_0x93ab('0x9'));var fs=require('fs');var _=require(_0x93ab('0xa'));var squel=require(_0x93ab('0xb'));var crypto=require(_0x93ab('0xc'));var jsforce=require(_0x93ab('0xd'));var deskjs=require(_0x93ab('0xe'));var toCsv=require(_0x93ab('0x8'));var querystring=require(_0x93ab('0xf'));var Papa=require(_0x93ab('0x10'));var Redis=require(_0x93ab('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93ab('0x12'));var as=require(_0x93ab('0x13'));var hardwareService=require(_0x93ab('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x93ab('0x15'));var db=require(_0x93ab('0x16'))['db'];function respondWithStatusCode(_0x400ac0,_0x3917a2){_0x3917a2=_0x3917a2||0xcc;return function(_0x38dbb1){if(_0x38dbb1){return _0x400ac0[_0x93ab('0x17')](_0x3917a2);}return _0x400ac0['status'](_0x3917a2)['end']();};}function respondWithResult(_0x5c616b,_0x549ec7){_0x549ec7=_0x549ec7||0xc8;return function(_0x52889e){if(_0x52889e){return _0x5c616b[_0x93ab('0x18')](_0x549ec7)[_0x93ab('0x19')](_0x52889e);}};}function respondWithFilteredResult(_0x2eb8f8,_0x289ed3){return function(_0xd87604){if(_0xd87604){var _0x243c1d=_0xd87604[_0x93ab('0x1a')],_0x45d254=_0x289ed3['offset'],_0x2af1d9=_0x289ed3[_0x93ab('0x1b')]+_0x289ed3[_0x93ab('0x1c')],_0x1da071;if(_0x2af1d9>=_0x243c1d){_0x2af1d9=_0x243c1d;_0x1da071=0xc8;}else{_0x1da071=0xce;}_0x2eb8f8[_0x93ab('0x18')](_0x1da071);return _0x2eb8f8[_0x93ab('0x1d')](_0x93ab('0x1e'),_0x45d254+'-'+_0x2af1d9+'/'+_0x243c1d)['json'](_0xd87604);}return null;};}function patchUpdates(_0x106f11){return function(_0x220812){try{jsonpatch[_0x93ab('0x1f')](_0x220812,_0x106f11,!![]);}catch(_0x4b50fc){return BPromise[_0x93ab('0x20')](_0x4b50fc);}return _0x220812[_0x93ab('0x21')]();};}function saveUpdates(_0x268418,_0xb158c){return function(_0x25725c){if(_0x25725c){return _0x25725c[_0x93ab('0x22')](_0x268418)[_0x93ab('0x23')](function(_0x13b20b){return _0x13b20b;});}return null;};}function removeEntity(_0x48dba3,_0x6359cd){return function(_0x52715a){if(_0x52715a){return _0x52715a['destroy']()[_0x93ab('0x23')](function(){_0x48dba3[_0x93ab('0x18')](0xcc)[_0x93ab('0x24')]();});}};}function handleEntityNotFound(_0x533413,_0x59b557){return function(_0x334a0c){if(!_0x334a0c){_0x533413[_0x93ab('0x17')](0x194);}return _0x334a0c;};}function handleError(_0x31b467,_0x4f7925){_0x4f7925=_0x4f7925||0x1f4;return function(_0x53fd20){logger[_0x93ab('0x25')](_0x53fd20[_0x93ab('0x26')]);if(_0x53fd20['name']){delete _0x53fd20[_0x93ab('0x27')];}_0x31b467[_0x93ab('0x18')](_0x4f7925)['send'](_0x53fd20);};}exports['index']=function(_0x3a8a08,_0x169942){var _0x39fe51={},_0x2828b8={},_0x1ca467={'count':0x0,'rows':[]};var _0xe83b21=_[_0x93ab('0x28')](db[_0x93ab('0x29')][_0x93ab('0x2a')],function(_0x24f0c4){return{'name':_0x24f0c4[_0x93ab('0x2b')],'type':_0x24f0c4[_0x93ab('0x2c')][_0x93ab('0x2d')]};});_0x2828b8['model']=_[_0x93ab('0x28')](_0xe83b21,_0x93ab('0x27'));_0x2828b8[_0x93ab('0x2e')]=_[_0x93ab('0x2f')](_0x3a8a08['query']);_0x2828b8['filters']=_['intersection'](_0x2828b8[_0x93ab('0x30')],_0x2828b8[_0x93ab('0x2e')]);_0x39fe51[_0x93ab('0x31')]=_[_0x93ab('0x32')](_0x2828b8['model'],qs[_0x93ab('0x33')](_0x3a8a08['query'][_0x93ab('0x33')]));_0x39fe51[_0x93ab('0x31')]=_0x39fe51[_0x93ab('0x31')]['length']?_0x39fe51[_0x93ab('0x31')]:_0x2828b8[_0x93ab('0x30')];if(!_0x3a8a08[_0x93ab('0x2e')][_0x93ab('0x34')]('nolimit')){_0x39fe51[_0x93ab('0x1c')]=qs[_0x93ab('0x1c')](_0x3a8a08[_0x93ab('0x2e')][_0x93ab('0x1c')]);_0x39fe51[_0x93ab('0x1b')]=qs[_0x93ab('0x1b')](_0x3a8a08[_0x93ab('0x2e')][_0x93ab('0x1b')]);}_0x39fe51['order']=qs['sort'](_0x3a8a08[_0x93ab('0x2e')]['sort']);_0x39fe51[_0x93ab('0x35')]=qs['filters'](_[_0x93ab('0x36')](_0x3a8a08[_0x93ab('0x2e')],_0x2828b8['filters']),_0xe83b21);if(_0x3a8a08[_0x93ab('0x2e')]['filter']){_0x39fe51['where']=_[_0x93ab('0x37')](_0x39fe51['where'],{'$or':_['map'](_0xe83b21,function(_0x469b9a){if(_0x469b9a['type']!==_0x93ab('0x38')){var _0x1dd9c3={};_0x1dd9c3[_0x469b9a[_0x93ab('0x27')]]={'$like':'%'+_0x3a8a08[_0x93ab('0x2e')][_0x93ab('0x39')]+'%'};return _0x1dd9c3;}})});}_0x39fe51=_[_0x93ab('0x37')]({},_0x39fe51,_0x3a8a08[_0x93ab('0x3a')]);var _0x1aa948={'where':_0x39fe51[_0x93ab('0x35')]};return db[_0x93ab('0x29')]['count'](_0x1aa948)['then'](function(_0x4e8df7){_0x1ca467[_0x93ab('0x1a')]=_0x4e8df7;if(_0x3a8a08[_0x93ab('0x2e')][_0x93ab('0x3b')]){_0x39fe51[_0x93ab('0x3c')]=[{'all':!![]}];}return db[_0x93ab('0x29')][_0x93ab('0x3d')](_0x39fe51);})[_0x93ab('0x23')](function(_0x1e361f){_0x1ca467[_0x93ab('0x3e')]=_0x1e361f;return _0x1ca467;})[_0x93ab('0x23')](respondWithFilteredResult(_0x169942,_0x39fe51))[_0x93ab('0x3f')](handleError(_0x169942,null));};exports[_0x93ab('0x40')]=function(_0x50eb6c,_0x570541){var _0x385190={'raw':!![],'where':{'id':_0x50eb6c['params']['id']}},_0x32846e={};_0x32846e[_0x93ab('0x30')]=_[_0x93ab('0x2f')](db[_0x93ab('0x29')]['rawAttributes']);_0x32846e['query']=_[_0x93ab('0x2f')](_0x50eb6c['query']);_0x32846e[_0x93ab('0x41')]=_[_0x93ab('0x32')](_0x32846e[_0x93ab('0x30')],_0x32846e[_0x93ab('0x2e')]);_0x385190['attributes']=_[_0x93ab('0x32')](_0x32846e[_0x93ab('0x30')],qs[_0x93ab('0x33')](_0x50eb6c[_0x93ab('0x2e')]['fields']));_0x385190[_0x93ab('0x31')]=_0x385190[_0x93ab('0x31')]['length']?_0x385190[_0x93ab('0x31')]:_0x32846e[_0x93ab('0x30')];if(_0x50eb6c[_0x93ab('0x2e')][_0x93ab('0x3b')]){_0x385190[_0x93ab('0x3c')]=[{'all':!![]}];}_0x385190=_['merge']({},_0x385190,_0x50eb6c[_0x93ab('0x3a')]);return db['OpenchannelApplication']['find'](_0x385190)[_0x93ab('0x23')](handleEntityNotFound(_0x570541,null))[_0x93ab('0x23')](respondWithResult(_0x570541,null))[_0x93ab('0x3f')](handleError(_0x570541,null));};exports[_0x93ab('0x42')]=function(_0x597b2a,_0x4958e4){return db[_0x93ab('0x29')][_0x93ab('0x42')](_0x597b2a[_0x93ab('0x43')],{})['then'](respondWithResult(_0x4958e4,0xc9))[_0x93ab('0x3f')](handleError(_0x4958e4,null));};exports[_0x93ab('0x22')]=function(_0x1ee79a,_0x557bb0){if(_0x1ee79a[_0x93ab('0x43')]['id']){delete _0x1ee79a[_0x93ab('0x43')]['id'];}return db[_0x93ab('0x29')][_0x93ab('0x44')]({'where':{'id':_0x1ee79a['params']['id']}})[_0x93ab('0x23')](handleEntityNotFound(_0x557bb0,null))[_0x93ab('0x23')](saveUpdates(_0x1ee79a[_0x93ab('0x43')],null))[_0x93ab('0x23')](respondWithResult(_0x557bb0,null))[_0x93ab('0x3f')](handleError(_0x557bb0,null));};exports['destroy']=function(_0x4c0b44,_0x278108){return db[_0x93ab('0x29')]['find']({'where':{'id':_0x4c0b44[_0x93ab('0x45')]['id']}})[_0x93ab('0x23')](handleEntityNotFound(_0x278108,null))[_0x93ab('0x23')](removeEntity(_0x278108,null))['catch'](handleError(_0x278108,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c7ebbe3..53a2f9f 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 _0x059c=['exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x3012b0,_0x2d145f){var _0x10af8b=function(_0x318d64){while(--_0x318d64){_0x3012b0['push'](_0x3012b0['shift']());}};_0x10af8b(++_0x2d145f);}(_0x059c,0x1ef));var _0xc059=function(_0x1843b3,_0x10995a){_0x1843b3=_0x1843b3-0x0;var _0x3c7de0=_0x059c[_0x1843b3];return _0x3c7de0;};'use strict';var _=require(_0xc059('0x0'));var util=require(_0xc059('0x1'));var logger=require(_0xc059('0x2'))('api');var moment=require(_0xc059('0x3'));var BPromise=require('bluebird');var rp=require(_0xc059('0x4'));var fs=require('fs');var path=require(_0xc059('0x5'));var rimraf=require(_0xc059('0x6'));var config=require(_0xc059('0x7'));var attributes=require(_0xc059('0x8'));module[_0xc059('0x9')]=function(_0x232dc3,_0x3f37c8){return _0x232dc3[_0xc059('0xa')](_0xc059('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc059('0xc'),'collate':_0xc059('0xd')});}; \ No newline at end of file +var _0xb9c6=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xdc10fc,_0x16c6f1){var _0x10b876=function(_0x52e362){while(--_0x52e362){_0xdc10fc['push'](_0xdc10fc['shift']());}};_0x10b876(++_0x16c6f1);}(_0xb9c6,0x1aa));var _0x6b9c=function(_0x50433c,_0x110cfb){_0x50433c=_0x50433c-0x0;var _0x198c76=_0xb9c6[_0x50433c];return _0x198c76;};'use strict';var _=require(_0x6b9c('0x0'));var util=require(_0x6b9c('0x1'));var logger=require(_0x6b9c('0x2'))(_0x6b9c('0x3'));var moment=require('moment');var BPromise=require(_0x6b9c('0x4'));var rp=require(_0x6b9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b9c('0x6'));module[_0x6b9c('0x7')]=function(_0x2f68ff,_0x48e470){return _0x2f68ff[_0x6b9c('0x8')](_0x6b9c('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b9c('0xa'),'collate':_0x6b9c('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0b7bc50..0be171f 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index efc2d4e..37c9a44 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 _0x2917=['addMessage','openchannel','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x14a9a3,_0x499f2f){var _0x22e923=function(_0x5b3c63){while(--_0x5b3c63){_0x14a9a3['push'](_0x14a9a3['shift']());}};_0x22e923(++_0x499f2f);}(_0x2917,0x13f));var _0x7291=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x2917[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var path=require(_0x7291('0x2'));var timeout=require(_0x7291('0x3'));var express=require(_0x7291('0x4'));var router=express[_0x7291('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7291('0x6'));var config=require(_0x7291('0x7'));var controller=require(_0x7291('0x8'));router['get']('/',auth[_0x7291('0x9')](),controller[_0x7291('0xa')]);router[_0x7291('0xb')](_0x7291('0xc'),auth[_0x7291('0x9')](),controller[_0x7291('0xd')]);router[_0x7291('0xb')](_0x7291('0xe'),auth[_0x7291('0x9')](),controller[_0x7291('0xf')]);router[_0x7291('0xb')](_0x7291('0x10'),auth[_0x7291('0x9')](),controller[_0x7291('0x11')]);router[_0x7291('0xb')](_0x7291('0x12'),auth[_0x7291('0x9')](),controller[_0x7291('0x13')]);router[_0x7291('0x14')]('/',auth[_0x7291('0x9')](),controller['create']);router[_0x7291('0x14')](_0x7291('0x10'),auth[_0x7291('0x9')](),controller[_0x7291('0x15')]);router[_0x7291('0x14')]('/:id/tags',auth[_0x7291('0x9')](),interaction['tracked'](_0x7291('0x16'),'openchannelinteraction:addtags'),controller[_0x7291('0x17')]);router[_0x7291('0x18')](_0x7291('0xe'),auth[_0x7291('0x9')](),interaction[_0x7291('0x19')](_0x7291('0x16'),_0x7291('0x1a')),controller[_0x7291('0x1b')]);router[_0x7291('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x7291('0x16'),_0x7291('0x1d')),controller[_0x7291('0x1e')]);router['delete'](_0x7291('0x1f'),auth[_0x7291('0x9')](),controller[_0x7291('0x20')]);module[_0x7291('0x21')]=router; \ No newline at end of file +var _0x379d=['isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0xd4993e,_0x3a1e19){var _0x1c4c71=function(_0x22367f){while(--_0x22367f){_0xd4993e['push'](_0xd4993e['shift']());}};_0x1c4c71(++_0x3a1e19);}(_0x379d,0x16a));var _0xd379=function(_0x52c2a2,_0x1fcb97){_0x52c2a2=_0x52c2a2-0x0;var _0x4b589c=_0x379d[_0x52c2a2];return _0x4b589c;};'use strict';var multer=require(_0xd379('0x0'));var util=require(_0xd379('0x1'));var path=require(_0xd379('0x2'));var timeout=require(_0xd379('0x3'));var express=require(_0xd379('0x4'));var router=express['Router']();var auth=require(_0xd379('0x5'));var interaction=require(_0xd379('0x6'));var config=require(_0xd379('0x7'));var controller=require(_0xd379('0x8'));router[_0xd379('0x9')]('/',auth[_0xd379('0xa')](),controller[_0xd379('0xb')]);router['get'](_0xd379('0xc'),auth[_0xd379('0xa')](),controller['describe']);router[_0xd379('0x9')](_0xd379('0xd'),auth[_0xd379('0xa')](),controller[_0xd379('0xe')]);router['get'](_0xd379('0xf'),auth[_0xd379('0xa')](),controller['getMessages']);router[_0xd379('0x9')](_0xd379('0x10'),auth[_0xd379('0xa')](),controller['download']);router['post']('/',auth[_0xd379('0xa')](),controller['create']);router[_0xd379('0x11')](_0xd379('0xf'),auth[_0xd379('0xa')](),controller[_0xd379('0x12')]);router[_0xd379('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xd379('0x13')](_0xd379('0x14'),_0xd379('0x15')),controller[_0xd379('0x16')]);router[_0xd379('0x17')](_0xd379('0xd'),auth['isAuthenticated'](),interaction[_0xd379('0x13')](_0xd379('0x14'),_0xd379('0x18')),controller['update']);router[_0xd379('0x19')](_0xd379('0xd'),auth['isAuthenticated'](),interaction[_0xd379('0x13')](_0xd379('0x14'),_0xd379('0x1a')),controller[_0xd379('0x1b')]);router[_0xd379('0x19')](_0xd379('0x1c'),auth[_0xd379('0xa')](),controller[_0xd379('0x1d')]);module[_0xd379('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d10dbe6..591b3da 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 _0x000c=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x42820b,_0x503828){var _0x476e73=function(_0x51640a){while(--_0x51640a){_0x42820b['push'](_0x42820b['shift']());}};_0x476e73(++_0x503828);}(_0x000c,0x6d));var _0xc000=function(_0x541811,_0x434a8c){_0x541811=_0x541811-0x0;var _0x230856=_0x000c[_0x541811];return _0x230856;};'use strict';var Sequelize=require(_0xc000('0x0'));module[_0xc000('0x1')]={'closed':{'type':Sequelize[_0xc000('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc000('0x3')]},'disposition':{'type':Sequelize[_0xc000('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc000('0x3')]},'threadId':{'type':Sequelize[_0xc000('0x4')]},'externalUrl':{'type':Sequelize[_0xc000('0x4')]},'lastMsgAt':{'type':Sequelize[_0xc000('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc000('0x5')]('in',_0xc000('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc000('0x4')]}}; \ No newline at end of file +var _0xbdcc=['BOOLEAN','DATE','STRING','out'];(function(_0x5f179f,_0x2fcd9b){var _0x29d5d5=function(_0x217cba){while(--_0x217cba){_0x5f179f['push'](_0x5f179f['shift']());}};_0x29d5d5(++_0x2fcd9b);}(_0xbdcc,0x1b0));var _0xcbdc=function(_0x11dc7c,_0x2c7956){_0x11dc7c=_0x11dc7c-0x0;var _0x43498d=_0xbdcc[_0x11dc7c];return _0x43498d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xcbdc('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcbdc('0x1')]},'disposition':{'type':Sequelize[_0xcbdc('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xcbdc('0x2')]},'externalUrl':{'type':Sequelize[_0xcbdc('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcbdc('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xcbdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7c88436..1b422e2 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 _0x28bf=['Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','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','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','set','Content-Range','reject','save','then','destroy','end','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','limit','offset','where','pick','field','color','from','tools_tags','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','sqlOperator','conditions','find','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','OpenchannelAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','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','Sequelize','QueryTypes','SELECT','clone','unreadMessages','order','isEmpty','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\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','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','sort','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','openchannelInteractionTags:save','download','unix','root','server','tmp','join','files','transcript-%d-%s.zip','fullname','CmContact'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x28bf,0x117));var _0xf28b=function(_0x3a827b,_0x5beb3b){_0x3a827b=_0x3a827b-0x0;var _0x130fb2=_0x28bf[_0x3a827b];return _0x130fb2;};'use strict';var pdf=require(_0xf28b('0x0'));var emlformat=require(_0xf28b('0x1'));var rimraf=require(_0xf28b('0x2'));var zipdir=require(_0xf28b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf28b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf28b('0x5'));var util=require(_0xf28b('0x6'));var path=require(_0xf28b('0x7'));var sox=require(_0xf28b('0x8'));var csv=require(_0xf28b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf28b('0xa'));var squel=require(_0xf28b('0xb'));var crypto=require(_0xf28b('0xc'));var jsforce=require(_0xf28b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf28b('0xe'));var Papa=require(_0xf28b('0xf'));var Redis=require('ioredis');var authService=require(_0xf28b('0x10'));var qs=require(_0xf28b('0x11'));var as=require(_0xf28b('0x12'));var hardwareService=require(_0xf28b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf28b('0x14'));var config=require(_0xf28b('0x15'));var db=require(_0xf28b('0x16'))['db'];config[_0xf28b('0x17')]=_[_0xf28b('0x18')](config[_0xf28b('0x17')],{'host':_0xf28b('0x19'),'port':0x18eb});var socket=require(_0xf28b('0x1a'))(new Redis(config['redis']));require(_0xf28b('0x1b'))[_0xf28b('0x1c')](socket);function respondWithStatusCode(_0xc58a64,_0x2c66f8){_0x2c66f8=_0x2c66f8||0xcc;return function(_0x47e0f3){if(_0x47e0f3){return _0xc58a64[_0xf28b('0x1d')](_0x2c66f8);}return _0xc58a64[_0xf28b('0x1e')](_0x2c66f8)['end']();};}function respondWithResult(_0x44c003,_0x443ca5){_0x443ca5=_0x443ca5||0xc8;return function(_0x18a279){if(_0x18a279){return _0x44c003[_0xf28b('0x1e')](_0x443ca5)[_0xf28b('0x1f')](_0x18a279);}};}function respondWithFilteredResult(_0xb31c22,_0x46b9d4){return function(_0x20eb84){if(_0x20eb84){var _0x4e56c3=_0x20eb84[_0xf28b('0x20')],_0x1315e1=_0x46b9d4['offset'],_0x256cce=_0x46b9d4['offset']+_0x46b9d4['limit'],_0x454a58;if(_0x256cce>=_0x4e56c3){_0x256cce=_0x4e56c3;_0x454a58=0xc8;}else{_0x454a58=0xce;}_0xb31c22[_0xf28b('0x1e')](_0x454a58);return _0xb31c22[_0xf28b('0x21')](_0xf28b('0x22'),_0x1315e1+'-'+_0x256cce+'/'+_0x4e56c3)[_0xf28b('0x1f')](_0x20eb84);}return null;};}function patchUpdates(_0x38dd90){return function(_0x5a5129){try{jsonpatch['apply'](_0x5a5129,_0x38dd90,!![]);}catch(_0x20dc61){return BPromise[_0xf28b('0x23')](_0x20dc61);}return _0x5a5129[_0xf28b('0x24')]();};}function saveUpdates(_0x47da7d,_0x330c34){return function(_0x27d506){if(_0x27d506){return _0x27d506['update'](_0x47da7d)[_0xf28b('0x25')](function(_0xa5afa2){return _0xa5afa2;});}return null;};}function removeEntity(_0x325266,_0x34e706){return function(_0x3d71be){if(_0x3d71be){return _0x3d71be[_0xf28b('0x26')]()[_0xf28b('0x25')](function(){_0x325266[_0xf28b('0x1e')](0xcc)[_0xf28b('0x27')]();});}};}function handleEntityNotFound(_0x58536a,_0x11fad5){return function(_0x414e00){if(!_0x414e00){_0x58536a[_0xf28b('0x1d')](0x194);}return _0x414e00;};}function handleError(_0x204d65,_0x6e5129){_0x6e5129=_0x6e5129||0x1f4;return function(_0x196796){logger['error'](_0x196796[_0xf28b('0x28')]);if(_0x196796[_0xf28b('0x29')]){delete _0x196796[_0xf28b('0x29')];}_0x204d65[_0xf28b('0x1e')](_0x6e5129)[_0xf28b('0x2a')](_0x196796);};}function getInteractionUsers(_0x4a7b8a,_0x1db5d6){return new BPromise(function(_0x3d079e,_0x41bc60){try{if(_0x1db5d6[_0x4a7b8a['id']]){_0x4a7b8a[_0xf28b('0x2b')]=_[_0xf28b('0x2c')](_0x1db5d6[_0x4a7b8a['id']],function(_0x57c074){return{'id':_0x57c074['id'],'fullname':_0x57c074['fullname']};});}}catch(_0x444f28){_0x41bc60(_0x444f28);}_0x3d079e(_0x4a7b8a);});}function getInteractionTags(_0x48d46b,_0x36c8a5){return new BPromise(function(_0x43434f,_0x3e375c){try{if(_0x48d46b[_0xf28b('0x2d')]){_0x48d46b[_0xf28b('0x2e')]=[];_0x48d46b[_0xf28b('0x2d')][_0xf28b('0x2f')](',')[_0xf28b('0x30')](function(_0x3ac200){_0x48d46b[_0xf28b('0x2e')][_0xf28b('0x31')](_0x36c8a5[_0x3ac200]);});}delete _0x48d46b[_0xf28b('0x2d')];}catch(_0x49c9c6){_0x3e375c(_0x49c9c6);}_0x43434f(_0x48d46b);});}function updateOpenchannelInteraction(_0x38b764,_0x6bd416,_0x30cb4e){return new BPromise(function(_0xb7f5d1,_0x1e7184){return getInteractionUsers(_0x38b764,_0x30cb4e)[_0xf28b('0x25')](function(_0x749f9){return getInteractionTags(_0x749f9,_0x6bd416);})[_0xf28b('0x25')](function(_0x3961ba){_0xb7f5d1(_0x3961ba);})[_0xf28b('0x32')](function(_0xd74e6c){_0x1e7184(_0xd74e6c);});});}exports[_0xf28b('0x33')]=function(_0x4a5c50,_0x286066){var _0x34a2cf={},_0x2fd924={},_0x3fc364={'count':0x0,'rows':[]};var _0x5cf18e=_[_0xf28b('0x2c')](db[_0xf28b('0x34')][_0xf28b('0x35')],function(_0x594b23){return{'name':_0x594b23[_0xf28b('0x36')],'type':_0x594b23[_0xf28b('0x37')][_0xf28b('0x38')]};});_0x2fd924['model']=_[_0xf28b('0x2c')](_0x5cf18e,_0xf28b('0x29'));_0x2fd924[_0xf28b('0x39')]=_['keys'](_0x4a5c50['query']);_0x2fd924[_0xf28b('0x3a')]=_[_0xf28b('0x3b')](_0x2fd924[_0xf28b('0x3c')],_0x2fd924[_0xf28b('0x39')]);_0x34a2cf['attributes']=_[_0xf28b('0x3b')](_0x2fd924[_0xf28b('0x3c')],qs[_0xf28b('0x3d')](_0x4a5c50['query'][_0xf28b('0x3d')]));_0x34a2cf[_0xf28b('0x3e')]=_0x34a2cf[_0xf28b('0x3e')][_0xf28b('0x3f')]?_0x34a2cf[_0xf28b('0x3e')]:_0x2fd924[_0xf28b('0x3c')];if(!_0x4a5c50[_0xf28b('0x39')]['hasOwnProperty'](_0xf28b('0x40'))){_0x34a2cf[_0xf28b('0x41')]=qs['limit'](_0x4a5c50[_0xf28b('0x39')]['limit']);_0x34a2cf[_0xf28b('0x42')]=qs[_0xf28b('0x42')](_0x4a5c50['query']['offset']);}_0x34a2cf['order']=qs['sort'](_0x4a5c50[_0xf28b('0x39')]['sort']);_0x34a2cf[_0xf28b('0x43')]=qs[_0xf28b('0x3a')](_[_0xf28b('0x44')](_0x4a5c50[_0xf28b('0x39')],_0x2fd924[_0xf28b('0x3a')]),_0x5cf18e);var _0x308962=[];var _0xff0e9e=squel['select']()[_0xf28b('0x45')]('id')[_0xf28b('0x45')](_0xf28b('0x29'))[_0xf28b('0x45')](_0xf28b('0x46'))[_0xf28b('0x47')](_0xf28b('0x48'));var _0x1e6220=squel[_0xf28b('0x49')]()[_0xf28b('0x45')]('u.id')[_0xf28b('0x45')](_0xf28b('0x4a'))[_0xf28b('0x45')](_0xf28b('0x4b'))['from'](_0xf28b('0x4c'),'ui')['left_join'](_0xf28b('0x4d'),'u',_0xf28b('0x4e'));var _0x58ae68=squel[_0xf28b('0x49')]()[_0xf28b('0x47')](_0xf28b('0x4f'),'i')[_0xf28b('0x50')](_0xf28b('0x51'),'c',_0xf28b('0x52'))[_0xf28b('0x50')](_0xf28b('0x4d'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xf28b('0x53'),'a',_0xf28b('0x54'))[_0xf28b('0x50')]('openchannel_messages','me',_0xf28b('0x55'))[_0xf28b('0x50')](_0xf28b('0x56'),'it',_0xf28b('0x57'))[_0xf28b('0x50')](_0xf28b('0x48'),'t',_0xf28b('0x58'));var _0x480068=squel['expr']();var _0x3e0ea0=[];var _0x35068f=squel['expr']();var _0x27081e;if(_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x59')]){_0x27081e=as['parseSearch'](_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x59')]);var _0x224cf5=_0x27081e[_0xf28b('0x5a')];for(var _0x42b11c=0x0;_0x42b11c<_0x27081e[_0xf28b('0x5b')][_0xf28b('0x3f')];_0x42b11c++){var _0xe3dbda=_0x27081e['conditions'][_0x42b11c];var _0x39cacc='i';var _0x123866=_[_0xf28b('0x5c')](_0x5cf18e,[_0xf28b('0x29'),_0xe3dbda[_0xf28b('0x45')]]);if(!_0x123866){switch(_0xe3dbda[_0xf28b('0x45')]){case'unreadMessages':if(_0xe3dbda[_0xf28b('0x5d')]==0x1){_0x58ae68[_0xf28b('0x5e')]('`'+_0xe3dbda[_0xf28b('0x45')]+'`\x20=\x200');}else{_0x58ae68['having']('`'+_0xe3dbda[_0xf28b('0x45')]+_0xf28b('0x5f'));}break;case'Contact':if(_0xe3dbda[_0xf28b('0x60')]===_0xf28b('0x61')){if(_0xe3dbda[_0xf28b('0x5d')][_0xf28b('0x2f')]('\x20')[_0xf28b('0x3f')]>0x1){_0x480068[_0x224cf5](_0xf28b('0x62'),qs[_0xf28b('0x63')](_0xe3dbda['value']),null);}else{var _0x456252='%'+_0xe3dbda['value']+'%';_0x480068[_0x224cf5](_0xf28b('0x64'),_0x456252,_0x456252,_0x456252);}}else{_0x123866=_[_0xf28b('0x5c')](_0x5cf18e,[_0xf28b('0x29'),_0xf28b('0x65')]);_0xe3dbda[_0xf28b('0x45')]=_0xf28b('0x65');_0x1a55fa=as[_0xf28b('0x66')](_0x39cacc,_0x123866['type'],_0xe3dbda);_0x480068[_0x224cf5](_0x1a55fa[_0xf28b('0x67')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x68')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x27')]);}break;case'Tag':var _0x1fe8bb=_0xe3dbda[_0xf28b('0x5d')]['split'](',')[_0xf28b('0x2c')](function(_0x4ae04f){return Number(_0x4ae04f);});_0x1fe8bb['forEach'](function(_0x477716){_0x35068f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x477716+',%');});_0x3e0ea0=_[_0xf28b('0x69')](_0x3e0ea0,_0x1fe8bb);break;case _0xf28b('0x6a'):if(_0xe3dbda[_0xf28b('0x60')]===_0xf28b('0x61')){_0x480068[_0x224cf5](_0xf28b('0x6b'),'%'+_0xe3dbda[_0xf28b('0x5d')]+'%',null);}else{_0x123866=_[_0xf28b('0x5c')](_0x5cf18e,[_0xf28b('0x29'),_0xf28b('0x6c')]);_0xe3dbda[_0xf28b('0x45')]=_0xf28b('0x6c');_0x1a55fa=as[_0xf28b('0x66')](_0x39cacc,_0x123866[_0xf28b('0x37')],_0xe3dbda);_0x480068[_0x224cf5](_0x1a55fa[_0xf28b('0x67')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x68')],_0x1a55fa[_0xf28b('0x5d')]['end']);}break;case _0xf28b('0x6d'):_0x1a55fa=as[_0xf28b('0x66')]('me',null,_0xe3dbda);_0x480068[_0x224cf5](_0x1a55fa[_0xf28b('0x67')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x68')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x27')]);break;}}else{var _0x1a55fa=as['buildExpression'](_0x39cacc,_0x123866[_0xf28b('0x37')],_0xe3dbda);_0x480068[_0x224cf5](_0x1a55fa['text'],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x68')],_0x1a55fa[_0xf28b('0x5d')][_0xf28b('0x27')]);}}}else{var _0x596586=_(_0x4a5c50['query'])[_0xf28b('0x6e')]()[_0xf28b('0x2c')](function(_0x3ee017){return _[_0xf28b('0x6f')](_0x5cf18e,[_0xf28b('0x29'),_0x3ee017])?_0x3ee017:undefined;})[_0xf28b('0x70')]()['value']();if(!_['isEmpty'](_0x596586)){_0x596586[_0xf28b('0x30')](function(_0x27fb7f){if(_0x27fb7f===_0xf28b('0x71')){_0x58ae68[_0xf28b('0x43')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xf28b('0x72')](_0x4a5c50[_0xf28b('0x39')][_0x27fb7f]));}else if(_0x27fb7f===_0xf28b('0x73')){var _0x3b2323=JSON[_0xf28b('0x74')](_0x4a5c50['query'][_0x27fb7f])[_0xf28b('0x75')];var _0x4c9754=JSON[_0xf28b('0x74')](_0x4a5c50[_0xf28b('0x39')][_0x27fb7f])['$lte'];_0x58ae68[_0xf28b('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3b2323,_0x4c9754);}else{if(_0x4a5c50['query'][_0x27fb7f]===_0xf28b('0x76')){_0x58ae68[_0xf28b('0x43')]('i.'+_0x27fb7f+_0xf28b('0x77'));}else{_0x58ae68[_0xf28b('0x43')]('i.'+_0x27fb7f+'\x20=\x20?',_0x4a5c50[_0xf28b('0x39')][_0x27fb7f]);}}});}if(_0x4a5c50['query'][_0xf28b('0x78')]){if(_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x78')]==0x1){_0x58ae68[_0xf28b('0x5e')](_0xf28b('0x79'));}else{_0x58ae68[_0xf28b('0x5e')](_0xf28b('0x7a'));}}if(_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x7b')]){_0x3e0ea0=_['isArray'](_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x7b')])?_0x4a5c50[_0xf28b('0x39')]['tag']:new Array(_0x4a5c50['query'][_0xf28b('0x7b')]);_0x3e0ea0[_0xf28b('0x30')](function(_0x5c5c00){_0x35068f['or'](_0xf28b('0x7c'),'%,'+_0x5c5c00+',%');});}if(_0x4a5c50['query'][_0xf28b('0x7d')]){var _0x431dd6=_0x4a5c50['query']['filter']['replace']('\x5c','\x5c\x5c')[_0xf28b('0x7e')]('\x27\x27',_0xf28b('0x7f'));if(qs[_0xf28b('0x80')](_0x431dd6)){_0x480068['or'](_0xf28b('0x81'),_0x431dd6+'%');}else{_0x480068['or'](_0xf28b('0x82'),qs[_0xf28b('0x63')](_0x431dd6))['or'](_0xf28b('0x83'),_0x431dd6+'%')['or'](_0xf28b('0x84'),_0x431dd6+'%');}}}_0x58ae68[_0xf28b('0x43')](_0x480068);_0x58ae68[_0xf28b('0x85')]('i.id');var _0x33115a={'type':db[_0xf28b('0x86')][_0xf28b('0x87')][_0xf28b('0x88')],'raw':!![]};var _0x3cea8a=_0x58ae68[_0xf28b('0x89')]();_0x3cea8a['field']('i.id');_0x3cea8a[_0xf28b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf28b('0x8a'));if(_0x34a2cf[_0xf28b('0x8b')]){_0x34a2cf['order']['forEach'](function(_0x11be62){_0x58ae68[_0xf28b('0x8b')]('i.'+_0x11be62[0x0],_0x11be62[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf28b('0x8c')](_0x3e0ea0)){_0x58ae68[_0xf28b('0x5e')](_0x35068f);_0x3cea8a[_0xf28b('0x43')]('t.id\x20IN\x20?',_0x3e0ea0);}BPromise['resolve']()[_0xf28b('0x25')](function(){if(!_0x27081e){if(_0x4a5c50[_0xf28b('0x39')][_0xf28b('0x71')]||_0x4a5c50['query'][_0xf28b('0x8d')])return;_0x3cea8a[_0xf28b('0x43')](_0xf28b('0x8e'));_0x58ae68[_0xf28b('0x43')](_0xf28b('0x8e'));return;}return _0x4a5c50[_0xf28b('0x8f')][_0xf28b('0x90')]({'attributes':['id'],'raw':!![]})[_0xf28b('0x25')](function(_0x3de75c){if(_[_0xf28b('0x8c')](_0x3de75c)){_0x3cea8a[_0xf28b('0x43')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x58ae68[_0xf28b('0x43')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x3cea8a[_0xf28b('0x43')](_0xf28b('0x91'),_[_0xf28b('0x2c')](_0x3de75c,'id'));_0x58ae68[_0xf28b('0x43')](_0xf28b('0x91'),_[_0xf28b('0x2c')](_0x3de75c,'id'));}});})[_0xf28b('0x25')](function(){db[_0xf28b('0x92')][_0xf28b('0x39')](_0x3cea8a[_0xf28b('0x93')](),_0x33115a)[_0xf28b('0x25')](function(_0x43e320){_0x3fc364['count']=_0x43e320[_0xf28b('0x3f')];if(_0x3fc364[_0xf28b('0x20')]===0x0)return[];return db[_0xf28b('0x92')]['query'](_0xff0e9e[_0xf28b('0x93')](),_0x33115a)[_0xf28b('0x25')](function(_0x4a582f){_0x308962=_[_0xf28b('0x94')](_0x4a582f,'id');_0x33115a=_[_0xf28b('0x95')](_0x33115a,{'model':db[_0xf28b('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a5c50[_0xf28b('0x39')]['fields']){_0x34a2cf[_0xf28b('0x3e')][_0xf28b('0x30')](function(_0x436684){_0x58ae68[_0xf28b('0x45')]('i.'+_0x436684);});}else{_0x58ae68[_0xf28b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf28b('0x8a'));_0x58ae68['field'](_0xf28b('0x96'),_0xf28b('0x97'));_0x58ae68[_0xf28b('0x45')](_0xf28b('0x98'),_0xf28b('0x99'));_0x58ae68['field'](_0xf28b('0x9a'));_0x58ae68[_0xf28b('0x45')](_0xf28b('0x9b'),_0xf28b('0x9c'));_0x58ae68['field'](_0xf28b('0x9d'),_0xf28b('0x9e'));_0x58ae68[_0xf28b('0x45')](_0xf28b('0x9f'),_0xf28b('0xa0'));_0x58ae68[_0xf28b('0x45')](_0xf28b('0xa1'),'Contact.phone');_0x58ae68[_0xf28b('0x45')](_0xf28b('0xa2'),'Contact.mobile');_0x58ae68[_0xf28b('0x45')](_0xf28b('0xa3'),_0xf28b('0xa4'));_0x58ae68['field'](_0xf28b('0xa5'),'Owner.fullname');_0x58ae68[_0xf28b('0x45')](_0xf28b('0xa6'),_0xf28b('0xa7'));_0x58ae68[_0xf28b('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf28b('0x2d'));}if(_0x34a2cf[_0xf28b('0x41')])_0x58ae68[_0xf28b('0x41')](_0x34a2cf['limit']);if(_0x34a2cf['offset'])_0x58ae68['offset'](_0x34a2cf[_0xf28b('0x42')]);return db[_0xf28b('0x92')][_0xf28b('0x39')](_0x58ae68[_0xf28b('0x93')](),_0x33115a);})['then'](function(_0x2885d7){_0x1e6220['where'](_0xf28b('0xa8'),_[_0xf28b('0x2c')](_0x2885d7,'id'));return db[_0xf28b('0x92')][_0xf28b('0x39')](_0x1e6220[_0xf28b('0x93')](),_0x33115a)[_0xf28b('0x25')](function(_0x33af87){var _0x3ff6ca=_['groupBy'](_0x33af87,'OpenchannelInteractionId');var _0x2e413d=[];_0x2885d7[_0xf28b('0x30')](function(_0x14359b){_0x2e413d[_0xf28b('0x31')](updateOpenchannelInteraction(_0x14359b,_0x308962,_0x3ff6ca));});return BPromise[_0xf28b('0xa9')](_0x2e413d);});});})[_0xf28b('0x25')](function(_0x477430){_0x3fc364[_0xf28b('0xaa')]=_0x477430;return _0x3fc364;})['then'](respondWithFilteredResult(_0x286066,_0x34a2cf));})[_0xf28b('0x32')](handleError(_0x286066,null));};exports['show']=function(_0x4b48a2,_0x4ffc58){var _0x4482ff={'raw':![],'where':{'id':_0x4b48a2[_0xf28b('0xab')]['id']}},_0x27f8a4={};_0x27f8a4[_0xf28b('0x3c')]=_[_0xf28b('0x6e')](db['OpenchannelInteraction'][_0xf28b('0x35')]);_0x27f8a4[_0xf28b('0x39')]=_[_0xf28b('0x6e')](_0x4b48a2[_0xf28b('0x39')]);_0x27f8a4[_0xf28b('0x3a')]=_[_0xf28b('0x3b')](_0x27f8a4[_0xf28b('0x3c')],_0x27f8a4[_0xf28b('0x39')]);_0x4482ff[_0xf28b('0x3e')]=_['intersection'](_0x27f8a4[_0xf28b('0x3c')],qs[_0xf28b('0x3d')](_0x4b48a2[_0xf28b('0x39')]['fields']));_0x4482ff[_0xf28b('0x3e')]=_0x4482ff[_0xf28b('0x3e')][_0xf28b('0x3f')]?_0x4482ff[_0xf28b('0x3e')]:_0x27f8a4[_0xf28b('0x3c')];if(_0x4b48a2[_0xf28b('0x39')][_0xf28b('0xac')]){_0x4482ff[_0xf28b('0xad')]=[{'all':!![]}];}_0x4482ff=_[_0xf28b('0x95')]({},_0x4482ff,_0x4b48a2[_0xf28b('0xae')]);return db[_0xf28b('0x34')][_0xf28b('0x5c')](_0x4482ff)[_0xf28b('0x25')](handleEntityNotFound(_0x4ffc58,null))[_0xf28b('0x25')](respondWithResult(_0x4ffc58,null))[_0xf28b('0x32')](handleError(_0x4ffc58,null));};exports['create']=function(_0x5d3599,_0x3d4553){return db[_0xf28b('0x34')][_0xf28b('0xaf')](_0x5d3599['body'],{})[_0xf28b('0x25')](respondWithResult(_0x3d4553,0xc9))[_0xf28b('0x32')](handleError(_0x3d4553,null));};exports['update']=function(_0x5c74ac,_0x3cfd67){if(_0x5c74ac['body']['id']){delete _0x5c74ac[_0xf28b('0x6d')]['id'];}return db[_0xf28b('0x34')]['find']({'where':{'id':_0x5c74ac[_0xf28b('0xab')]['id']}})[_0xf28b('0x25')](handleEntityNotFound(_0x3cfd67,null))[_0xf28b('0x25')](saveUpdates(_0x5c74ac[_0xf28b('0x6d')],null))[_0xf28b('0x25')](respondWithResult(_0x3cfd67,null))[_0xf28b('0x32')](handleError(_0x3cfd67,null));};exports['destroy']=function(_0x2ffb48,_0x1ba4fa){return db[_0xf28b('0x34')][_0xf28b('0x5c')]({'where':{'id':_0x2ffb48[_0xf28b('0xab')]['id']}})[_0xf28b('0x25')](handleEntityNotFound(_0x1ba4fa,null))['then'](removeEntity(_0x1ba4fa,null))[_0xf28b('0x32')](handleError(_0x1ba4fa,null));};exports['describe']=function(_0x14ce52,_0x2bbd8c){return db['OpenchannelInteraction'][_0xf28b('0xb0')]()[_0xf28b('0x25')](respondWithResult(_0x2bbd8c,null))[_0xf28b('0x32')](handleError(_0x2bbd8c,null));};exports[_0xf28b('0xb1')]=function(_0x3b7f39,_0x13c762,_0x195536){return db[_0xf28b('0xb2')]['find']({'where':{'id':_0x3b7f39[_0xf28b('0xab')]['id']}})[_0xf28b('0x25')](handleEntityNotFound(_0x13c762,null))[_0xf28b('0x25')](function(_0x3afb00){if(_0x3afb00){return _0x3afb00['addMessage'](_0x3b7f39[_0xf28b('0x6d')][_0xf28b('0xb3')],_[_0xf28b('0xb4')](_0x3b7f39['body'],['ids','id'])||{});}})[_0xf28b('0x25')](respondWithResult(_0x13c762,null))[_0xf28b('0x32')](handleError(_0x13c762,null));};exports[_0xf28b('0xb5')]=function(_0x4b8c8e,_0x256b44,_0x528a2b){var _0x4837ac={'raw':![],'where':{}};var _0x335c55={};var _0x192a3d={'count':0x0,'rows':[]};return db[_0xf28b('0x34')][_0xf28b('0xb6')]({'where':{'id':_0x4b8c8e[_0xf28b('0xab')]['id']}})[_0xf28b('0x25')](handleEntityNotFound(_0x256b44,null))['then'](function(_0x4ac5b5){if(_0x4ac5b5){_0x335c55[_0xf28b('0x3c')]=_['keys'](db[_0xf28b('0xb2')]['rawAttributes']);_0x335c55[_0xf28b('0x39')]=_[_0xf28b('0x6e')](_0x4b8c8e[_0xf28b('0x39')]);_0x335c55[_0xf28b('0x3a')]=_[_0xf28b('0x3b')](_0x335c55['model'],_0x335c55[_0xf28b('0x39')]);_0x4837ac[_0xf28b('0x3e')]=_[_0xf28b('0x3b')](_0x335c55[_0xf28b('0x3c')],qs['fields'](_0x4b8c8e[_0xf28b('0x39')][_0xf28b('0x3d')]));_0x4837ac[_0xf28b('0x3e')]=_0x4837ac[_0xf28b('0x3e')]['length']?_0x4837ac['attributes']:_0x335c55[_0xf28b('0x3c')];if(!_0x4b8c8e[_0xf28b('0x39')]['hasOwnProperty'](_0xf28b('0x40'))){_0x4837ac[_0xf28b('0x41')]=qs['limit'](_0x4b8c8e[_0xf28b('0x39')][_0xf28b('0x41')]);_0x4837ac[_0xf28b('0x42')]=qs[_0xf28b('0x42')](_0x4b8c8e[_0xf28b('0x39')][_0xf28b('0x42')]);}_0x4837ac['order']=qs[_0xf28b('0xb7')](_0x4b8c8e['query'][_0xf28b('0xb7')]);_0x4837ac[_0xf28b('0x43')]=qs['filters'](_[_0xf28b('0x44')](_0x4b8c8e['query'],_0x335c55[_0xf28b('0x3a')]));_0x4837ac['where'][_0xf28b('0xb8')]=_0x4ac5b5['id'];if(_0x4b8c8e[_0xf28b('0x39')][_0xf28b('0x7d')]){_0x4837ac[_0xf28b('0x43')]=_['merge'](_0x4837ac['where'],{'$or':_[_0xf28b('0x2c')](_0x4837ac[_0xf28b('0x3e')],function(_0x22a997){var _0x24cf7e={};_0x24cf7e[_0x22a997]={'$like':'%'+_0x4b8c8e[_0xf28b('0x39')]['filter']+'%'};return _0x24cf7e;})});}if(_0x4b8c8e[_0xf28b('0x39')]['$gte']){var _0x1739f2=_0x4b8c8e['query'][_0xf28b('0x75')][_0xf28b('0x2f')](',');var _0x4a40bc={};_0x4a40bc[_0x1739f2[0x0]]={'$gte':moment(_0x1739f2[0x1])[_0xf28b('0xb9')](_0xf28b('0xba'))};_0x4837ac[_0xf28b('0x43')]=_[_0xf28b('0x95')](_0x4837ac[_0xf28b('0x43')],_0x4a40bc);}_0x4837ac=_[_0xf28b('0x95')]({},_0x4837ac,_0x4b8c8e[_0xf28b('0xae')]);return db['OpenchannelMessage'][_0xf28b('0x20')]({'where':_0x4837ac[_0xf28b('0x43')]})['then'](function(_0x10b993){_0x192a3d[_0xf28b('0x20')]=_0x10b993;if(_0x4b8c8e[_0xf28b('0x39')][_0xf28b('0xac')]){_0x4837ac[_0xf28b('0xad')]=[{'all':!![]}];}return db[_0xf28b('0xb2')][_0xf28b('0xbb')](_0x4837ac);})[_0xf28b('0x25')](function(_0x5c2de0){_0x192a3d[_0xf28b('0xaa')]=_0x5c2de0;return _0x192a3d;});}})[_0xf28b('0x25')](respondWithFilteredResult(_0x256b44,_0x4837ac))['catch'](handleError(_0x256b44,null));};exports[_0xf28b('0xbc')]=function(_0x21c3d9,_0x59c23f,_0x564a33){return db[_0xf28b('0x34')][_0xf28b('0x5c')]({'where':{'id':_0x21c3d9[_0xf28b('0xab')]['id']}})['then'](handleEntityNotFound(_0x59c23f,null))[_0xf28b('0x25')](function(_0x9739b9){if(_0x9739b9){return _0x9739b9[_0xf28b('0xbd')](_0x21c3d9['body'][_0xf28b('0xb3')],_[_0xf28b('0xb4')](_0x21c3d9[_0xf28b('0x6d')],[_0xf28b('0xb3'),'id'])||{})[_0xf28b('0xbe')](function(){return db[_0xf28b('0xbf')]['findAll']({'attributes':['id',_0xf28b('0x29'),'color'],'where':{'id':_0x21c3d9[_0xf28b('0x6d')][_0xf28b('0xb3')]}});})[_0xf28b('0x25')](function(_0x45d864){socket['emit'](_0xf28b('0xc0'),{'id':Number(_0x21c3d9[_0xf28b('0xab')]['id']),'tags':_0x45d864||[]});return{'id':Number(_0x21c3d9[_0xf28b('0xab')]['id']),'tags':_0x45d864||[]};});}})['then'](respondWithResult(_0x59c23f,null))[_0xf28b('0x32')](handleError(_0x59c23f,null));};exports['removeTags']=function(_0x9191a2,_0x18dfcb,_0xb860c7){return db['OpenchannelInteraction'][_0xf28b('0x5c')]({'where':{'id':_0x9191a2[_0xf28b('0xab')]['id']}})['then'](handleEntityNotFound(_0x18dfcb,null))[_0xf28b('0x25')](function(_0x17c5e3){if(_0x17c5e3){return _0x17c5e3['removeTags'](_0x9191a2[_0xf28b('0x39')][_0xf28b('0xb3')]);}})[_0xf28b('0x25')](respondWithStatusCode(_0x18dfcb,null))[_0xf28b('0x32')](handleError(_0x18dfcb,null));};exports[_0xf28b('0xc1')]=function(_0x8bc6bb,_0x308064){var _0x5edc59=moment()[_0xf28b('0xc2')]()[_0xf28b('0x93')]();var _0x332314=path['join'](config[_0xf28b('0xc3')],_0xf28b('0xc4'),'files',_0xf28b('0xc5'));var _0x2bfb9f=path[_0xf28b('0xc6')](config['root'],'server',_0xf28b('0xc7'),'attachments');var _0x4528a3=path['join'](_0x332314,_0x5edc59);var _0x489e4d=util[_0xf28b('0xb9')](_0xf28b('0xc8'),_0x8bc6bb[_0xf28b('0xab')]['id'],_0x5edc59);var _0x1cbc2c=path[_0xf28b('0xc6')](_0x332314,_0x489e4d);var _0x27e199=[];_0x27e199['push']({'model':db['User'],'as':_0xf28b('0x6a'),'attributes':['id',_0xf28b('0xc9')],'raw':!![]});_0x27e199[_0xf28b('0x31')]({'model':db[_0xf28b('0xca')],'as':_0xf28b('0xcb'),'attributes':['id',_0xf28b('0xcc'),_0xf28b('0xcd')],'raw':!![]});if(_0x8bc6bb[_0xf28b('0x39')][_0xf28b('0xce')]){_0x27e199['push']({'model':db[_0xf28b('0xcf')],'as':_0xf28b('0xcf'),'raw':!![]});}var _0x1d48e3=[{'model':db[_0xf28b('0xb2')],'as':_0xf28b('0xd0'),'attributes':['id',_0xf28b('0x6d'),'createdAt',_0xf28b('0xd1'),_0xf28b('0xd2'),_0xf28b('0x78')],'include':_0x27e199}];_0x1d48e3[_0xf28b('0x31')]({'model':db[_0xf28b('0xd3')],'as':_0xf28b('0xd4'),'attributes':['id',_0xf28b('0x29')]});_0x1d48e3['push']({'model':db[_0xf28b('0x6a')],'as':_0xf28b('0xd5'),'attributes':['id','fullname']});return db[_0xf28b('0x34')]['find']({'where':{'id':_0x8bc6bb['params']['id']},'include':_0x1d48e3})[_0xf28b('0x25')](handleEntityNotFound(_0x308064,null))[_0xf28b('0x25')](function(_0x234802){if(_0x234802){var _0x11ee6b=_0x234802['get']({'plain':!![]});fs['mkdirSync'](_0x4528a3);var _0x25484c={'format':'A4','border':_0xf28b('0xd6'),'header':{'height':_0xf28b('0xd7'),'contents':{'first':_0xf28b('0xd8')}},'footer':{'height':_0xf28b('0xd9'),'contents':{'default':util[_0xf28b('0xb9')](_0xf28b('0xda'),util[_0xf28b('0xb9')](_0xf28b('0xdb'),_0xf28b('0xdc'),_0x11ee6b['id']),moment()['format']('YYYY-MM-DD')[_0xf28b('0x93')]())}}};var _0x3bb0ab={'channel':'Openchannel','account':_0x11ee6b['Account'][_0xf28b('0x29')],'agent':_0x11ee6b['Owner']?_0x11ee6b[_0xf28b('0xd5')][_0xf28b('0xc9')]:_0xf28b('0xdd'),'createdAt':moment(_0x11ee6b[_0xf28b('0x73')])[_0xf28b('0xb9')](_0xf28b('0xba'))['toString'](),'closedAt':_0x11ee6b[_0xf28b('0xde')]?moment(_0x11ee6b[_0xf28b('0xdf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf28b('0x93')]():'','disposition':_0x11ee6b[_0xf28b('0xe0')],'visibility':_0x11ee6b['threadId']?_0xf28b('0xe1'):_0xf28b('0xe2'),'messages':_(_0x11ee6b['Messages'])['filter']({'secret':![]})[_0xf28b('0x2c')](function(_0x1cdfe0){if(_0x1cdfe0[_0xf28b('0xcf')]){var _0x3c4855=path[_0xf28b('0xc6')](_0x2bfb9f,_0x1cdfe0['Attachment'][_0xf28b('0xe3')]);if(fs[_0xf28b('0xe4')](_0x3c4855)){fs[_0xf28b('0xe5')](_0x3c4855)[_0xf28b('0xe6')](fs[_0xf28b('0xe7')](path['join'](_0x4528a3,_0x1cdfe0[_0xf28b('0xcf')][_0xf28b('0xe3')])));}}return{'date':moment(_0x1cdfe0['createdAt'])[_0xf28b('0xb9')](_0xf28b('0xba'))['toString'](),'sender':_0x1cdfe0[_0xf28b('0xd1')]===_0xf28b('0xe8')?_0x1cdfe0[_0xf28b('0x6a')]?_0x1cdfe0[_0xf28b('0x6a')][_0xf28b('0xc9')]:_0xf28b('0xe9'):_0x1cdfe0[_0xf28b('0xcb')][_0xf28b('0xcc')]+(_0x1cdfe0[_0xf28b('0xcb')][_0xf28b('0xcd')]?'\x20'+_0x1cdfe0[_0xf28b('0xcb')][_0xf28b('0xcd')]:''),'body':_0x1cdfe0['Attachment']?_0x1cdfe0[_0xf28b('0xcf')][_0xf28b('0xe3')]:_0x1cdfe0[_0xf28b('0x6d')],'direction':_0x1cdfe0['direction']===_0xf28b('0xe8')?'A':'C','secret':_0x1cdfe0[_0xf28b('0xd2')],'read':_0x1cdfe0[_0xf28b('0x78')],'attachment':_0x1cdfe0[_0xf28b('0xcf')]};})[_0xf28b('0x5d')]()};return ejs[_0xf28b('0xea')](path[_0xf28b('0xc6')](config['root'],_0xf28b('0xc4'),_0xf28b('0xeb'),'downloadInteraction.html'),{'interaction':_0x3bb0ab})[_0xf28b('0x25')](function(_0x837846){return new BPromise(function(_0x152dfd,_0x510cac){pdf[_0xf28b('0xaf')](_0x837846,_0x25484c)[_0xf28b('0xec')](path['join'](_0x4528a3,'transcript-'+_0x11ee6b['id']+'-'+_0x5edc59+_0xf28b('0xed')),function(_0x8902e1,_0xe85dd3){if(_0x8902e1)return _0x510cac(_0x8902e1);_0x152dfd(_0xe85dd3);});});})[_0xf28b('0x25')](function(){return new BPromise(function(_0x4faba8,_0x4fd013){zipdir(_0x4528a3,{'saveTo':_0x1cbc2c},function(_0x4c5c46,_0x3d502b){if(_0x4c5c46)return _0x4fd013(_0x4c5c46);return _0x4faba8(_0x3d502b);});})['then'](function(){return new BPromise(function(_0x4c11e5,_0x47f114){rimraf(_0x4528a3,function(_0x2a4399){if(_0x2a4399)_0x47f114(_0x2a4399);return _0x4c11e5();});});})[_0xf28b('0x25')](function(){return _0x308064[_0xf28b('0xc1')](_0x1cbc2c,_0x489e4d,function(_0x4f86da){if(_0x4f86da){console[_0xf28b('0xee')](_0xf28b('0xef'),_0x4f86da);}else{fs[_0xf28b('0xf0')](_0x1cbc2c);}});});});}else{return _0x308064['sendStatus'](0xc8);}})[_0xf28b('0x32')](handleError(_0x308064,null));}; \ No newline at end of file +var _0xdcab=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','set','apply','reject','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','index','map','OpenchannelInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','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','OpenchannelAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','rows','show','params','rawAttributes','includeAll','include','options','create','update','describe','addMessage','OpenchannelMessage','ids','getMessages','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','format','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','out','System','secret','downloadInteraction.html','toFile','.pdf','err','unlinkSync','html-pdf'];(function(_0x593590,_0x341ce3){var _0x5bc40b=function(_0x40350e){while(--_0x40350e){_0x593590['push'](_0x593590['shift']());}};_0x5bc40b(++_0x341ce3);}(_0xdcab,0x1e9));var _0xbdca=function(_0x3cff25,_0x35d174){_0x3cff25=_0x3cff25-0x0;var _0xdd3022=_0xdcab[_0x3cff25];return _0xdd3022;};'use strict';var pdf=require(_0xbdca('0x0'));var emlformat=require(_0xbdca('0x1'));var rimraf=require(_0xbdca('0x2'));var zipdir=require(_0xbdca('0x3'));var jsonpatch=require(_0xbdca('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdca('0x5'));var Mustache=require(_0xbdca('0x6'));var util=require(_0xbdca('0x7'));var path=require(_0xbdca('0x8'));var sox=require(_0xbdca('0x9'));var csv=require(_0xbdca('0xa'));var ejs=require(_0xbdca('0xb'));var fs=require('fs');var _=require(_0xbdca('0xc'));var squel=require(_0xbdca('0xd'));var crypto=require(_0xbdca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbdca('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdca('0x10'));var Papa=require(_0xbdca('0x11'));var Redis=require(_0xbdca('0x12'));var authService=require(_0xbdca('0x13'));var qs=require(_0xbdca('0x14'));var as=require(_0xbdca('0x15'));var hardwareService=require(_0xbdca('0x16'));var logger=require(_0xbdca('0x17'))(_0xbdca('0x18'));var utils=require('../../config/utils');var config=require(_0xbdca('0x19'));var db=require(_0xbdca('0x1a'))['db'];config[_0xbdca('0x1b')]=_[_0xbdca('0x1c')](config['redis'],{'host':_0xbdca('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdca('0x1b')]));require(_0xbdca('0x1e'))[_0xbdca('0x1f')](socket);function respondWithStatusCode(_0x5c4080,_0x5775ef){_0x5775ef=_0x5775ef||0xcc;return function(_0x18c27a){if(_0x18c27a){return _0x5c4080[_0xbdca('0x20')](_0x5775ef);}return _0x5c4080[_0xbdca('0x21')](_0x5775ef)[_0xbdca('0x22')]();};}function respondWithResult(_0x2a24f0,_0x133d8d){_0x133d8d=_0x133d8d||0xc8;return function(_0x5f54f5){if(_0x5f54f5){return _0x2a24f0[_0xbdca('0x21')](_0x133d8d)[_0xbdca('0x23')](_0x5f54f5);}};}function respondWithFilteredResult(_0x244b41,_0x3272ac){return function(_0x5d3623){if(_0x5d3623){var _0xa813fc=_0x5d3623['count'],_0x90d3d=_0x3272ac[_0xbdca('0x24')],_0x1b98cc=_0x3272ac[_0xbdca('0x24')]+_0x3272ac['limit'],_0xb19a6;if(_0x1b98cc>=_0xa813fc){_0x1b98cc=_0xa813fc;_0xb19a6=0xc8;}else{_0xb19a6=0xce;}_0x244b41[_0xbdca('0x21')](_0xb19a6);return _0x244b41[_0xbdca('0x25')]('Content-Range',_0x90d3d+'-'+_0x1b98cc+'/'+_0xa813fc)[_0xbdca('0x23')](_0x5d3623);}return null;};}function patchUpdates(_0x3e7106){return function(_0x1f2e00){try{jsonpatch[_0xbdca('0x26')](_0x1f2e00,_0x3e7106,!![]);}catch(_0x73468d){return BPromise[_0xbdca('0x27')](_0x73468d);}return _0x1f2e00['save']();};}function saveUpdates(_0xc93397,_0x3a870a){return function(_0x4b73b1){if(_0x4b73b1){return _0x4b73b1['update'](_0xc93397)[_0xbdca('0x28')](function(_0x3f581f){return _0x3f581f;});}return null;};}function removeEntity(_0x3fb260,_0x27299c){return function(_0x423b42){if(_0x423b42){return _0x423b42[_0xbdca('0x29')]()[_0xbdca('0x28')](function(){_0x3fb260[_0xbdca('0x21')](0xcc)[_0xbdca('0x22')]();});}};}function handleEntityNotFound(_0x3a647c,_0x309987){return function(_0x5b3a00){if(!_0x5b3a00){_0x3a647c['sendStatus'](0x194);}return _0x5b3a00;};}function handleError(_0x4eecc1,_0x4cdc60){_0x4cdc60=_0x4cdc60||0x1f4;return function(_0x5d6cb8){logger[_0xbdca('0x2a')](_0x5d6cb8[_0xbdca('0x2b')]);if(_0x5d6cb8[_0xbdca('0x2c')]){delete _0x5d6cb8[_0xbdca('0x2c')];}_0x4eecc1[_0xbdca('0x21')](_0x4cdc60)[_0xbdca('0x2d')](_0x5d6cb8);};}function getInteractionUsers(_0x4c495e,_0x356bc7){return new BPromise(function(_0x170948,_0x4cc9c6){try{if(_0x356bc7[_0x4c495e['id']]){_0x4c495e[_0xbdca('0x2e')]=_['map'](_0x356bc7[_0x4c495e['id']],function(_0x3b6675){return{'id':_0x3b6675['id'],'fullname':_0x3b6675[_0xbdca('0x2f')]};});}}catch(_0x22f403){_0x4cc9c6(_0x22f403);}_0x170948(_0x4c495e);});}function getInteractionTags(_0x260273,_0x47dbd2){return new BPromise(function(_0x230f32,_0x1998d8){try{if(_0x260273[_0xbdca('0x30')]){_0x260273[_0xbdca('0x31')]=[];_0x260273[_0xbdca('0x30')][_0xbdca('0x32')](',')['forEach'](function(_0x345829){_0x260273['Tags'][_0xbdca('0x33')](_0x47dbd2[_0x345829]);});}delete _0x260273[_0xbdca('0x30')];}catch(_0x41a482){_0x1998d8(_0x41a482);}_0x230f32(_0x260273);});}function updateOpenchannelInteraction(_0x3d4311,_0x34d66c,_0x253a51){return new BPromise(function(_0x9a7f0e,_0x4c50f9){return getInteractionUsers(_0x3d4311,_0x253a51)['then'](function(_0x55fa52){return getInteractionTags(_0x55fa52,_0x34d66c);})[_0xbdca('0x28')](function(_0xe2b451){_0x9a7f0e(_0xe2b451);})[_0xbdca('0x34')](function(_0x57940a){_0x4c50f9(_0x57940a);});});}exports[_0xbdca('0x35')]=function(_0x41372c,_0x58a8c0){var _0x51648c={},_0x394754={},_0x178803={'count':0x0,'rows':[]};var _0x54d34e=_[_0xbdca('0x36')](db[_0xbdca('0x37')]['rawAttributes'],function(_0x1f54ec){return{'name':_0x1f54ec[_0xbdca('0x38')],'type':_0x1f54ec[_0xbdca('0x39')][_0xbdca('0x3a')]};});_0x394754[_0xbdca('0x3b')]=_[_0xbdca('0x36')](_0x54d34e,'name');_0x394754[_0xbdca('0x3c')]=_[_0xbdca('0x3d')](_0x41372c[_0xbdca('0x3c')]);_0x394754[_0xbdca('0x3e')]=_[_0xbdca('0x3f')](_0x394754['model'],_0x394754[_0xbdca('0x3c')]);_0x51648c[_0xbdca('0x40')]=_[_0xbdca('0x3f')](_0x394754['model'],qs[_0xbdca('0x41')](_0x41372c[_0xbdca('0x3c')][_0xbdca('0x41')]));_0x51648c[_0xbdca('0x40')]=_0x51648c[_0xbdca('0x40')][_0xbdca('0x42')]?_0x51648c[_0xbdca('0x40')]:_0x394754[_0xbdca('0x3b')];if(!_0x41372c[_0xbdca('0x3c')][_0xbdca('0x43')](_0xbdca('0x44'))){_0x51648c['limit']=qs[_0xbdca('0x45')](_0x41372c[_0xbdca('0x3c')][_0xbdca('0x45')]);_0x51648c[_0xbdca('0x24')]=qs[_0xbdca('0x24')](_0x41372c[_0xbdca('0x3c')][_0xbdca('0x24')]);}_0x51648c[_0xbdca('0x46')]=qs[_0xbdca('0x47')](_0x41372c[_0xbdca('0x3c')][_0xbdca('0x47')]);_0x51648c[_0xbdca('0x48')]=qs[_0xbdca('0x3e')](_[_0xbdca('0x49')](_0x41372c[_0xbdca('0x3c')],_0x394754[_0xbdca('0x3e')]),_0x54d34e);var _0x3de505=[];var _0x50c528=squel[_0xbdca('0x4a')]()['field']('id')[_0xbdca('0x4b')](_0xbdca('0x2c'))[_0xbdca('0x4b')](_0xbdca('0x4c'))['from']('tools_tags');var _0x5504e1=squel[_0xbdca('0x4a')]()[_0xbdca('0x4b')]('u.id')['field'](_0xbdca('0x4d'))[_0xbdca('0x4b')](_0xbdca('0x4e'))[_0xbdca('0x4f')](_0xbdca('0x50'),'ui')['left_join'](_0xbdca('0x51'),'u',_0xbdca('0x52'));var _0x23f9ee=squel[_0xbdca('0x4a')]()[_0xbdca('0x4f')](_0xbdca('0x53'),'i')[_0xbdca('0x54')](_0xbdca('0x55'),'c',_0xbdca('0x56'))[_0xbdca('0x54')](_0xbdca('0x51'),'o',_0xbdca('0x57'))[_0xbdca('0x54')](_0xbdca('0x58'),'a',_0xbdca('0x59'))[_0xbdca('0x54')](_0xbdca('0x5a'),'me',_0xbdca('0x5b'))[_0xbdca('0x54')](_0xbdca('0x5c'),'it',_0xbdca('0x5d'))[_0xbdca('0x54')](_0xbdca('0x5e'),'t',_0xbdca('0x5f'));var _0x1e8d25=squel[_0xbdca('0x60')]();var _0x5a0081=[];var _0x49791f=squel[_0xbdca('0x60')]();var _0x167f79;if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x61')]){_0x167f79=as[_0xbdca('0x62')](_0x41372c[_0xbdca('0x3c')][_0xbdca('0x61')]);var _0x21d308=_0x167f79[_0xbdca('0x63')];for(var _0x1492c1=0x0;_0x1492c1<_0x167f79[_0xbdca('0x64')][_0xbdca('0x42')];_0x1492c1++){var _0x241f10=_0x167f79[_0xbdca('0x64')][_0x1492c1];var _0x448648='i';var _0x1db747=_[_0xbdca('0x65')](_0x54d34e,[_0xbdca('0x2c'),_0x241f10['field']]);if(!_0x1db747){switch(_0x241f10['field']){case _0xbdca('0x66'):if(_0x241f10[_0xbdca('0x67')]==0x1){_0x23f9ee[_0xbdca('0x68')]('`'+_0x241f10[_0xbdca('0x4b')]+_0xbdca('0x69'));}else{_0x23f9ee[_0xbdca('0x68')]('`'+_0x241f10[_0xbdca('0x4b')]+'`\x20>\x200');}break;case _0xbdca('0x6a'):if(_0x241f10[_0xbdca('0x6b')]===_0xbdca('0x6c')){if(_0x241f10[_0xbdca('0x67')][_0xbdca('0x32')]('\x20')[_0xbdca('0x42')]>0x1){_0x1e8d25[_0x21d308]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbdca('0x6d')](_0x241f10[_0xbdca('0x67')]),null);}else{var _0x2d0590='%'+_0x241f10['value']+'%';_0x1e8d25[_0x21d308](_0xbdca('0x6e'),_0x2d0590,_0x2d0590,_0x2d0590);}}else{_0x1db747=_['find'](_0x54d34e,[_0xbdca('0x2c'),_0xbdca('0x6f')]);_0x241f10[_0xbdca('0x4b')]=_0xbdca('0x6f');_0x4ab816=as[_0xbdca('0x70')](_0x448648,_0x1db747[_0xbdca('0x39')],_0x241f10);_0x1e8d25[_0x21d308](_0x4ab816[_0xbdca('0x71')],_0x4ab816['value'][_0xbdca('0x72')],_0x4ab816[_0xbdca('0x67')][_0xbdca('0x22')]);}break;case _0xbdca('0x73'):var _0xa419c8=_0x241f10[_0xbdca('0x67')][_0xbdca('0x32')](',')['map'](function(_0x4b41a3){return Number(_0x4b41a3);});_0xa419c8[_0xbdca('0x74')](function(_0x17552b){_0x49791f['or'](_0xbdca('0x75'),'%,'+_0x17552b+',%');});_0x5a0081=_['union'](_0x5a0081,_0xa419c8);break;case _0xbdca('0x76'):if(_0x241f10['operator']===_0xbdca('0x6c')){_0x1e8d25[_0x21d308](_0xbdca('0x77'),'%'+_0x241f10['value']+'%',null);}else{_0x1db747=_[_0xbdca('0x65')](_0x54d34e,[_0xbdca('0x2c'),_0xbdca('0x78')]);_0x241f10[_0xbdca('0x4b')]=_0xbdca('0x78');_0x4ab816=as[_0xbdca('0x70')](_0x448648,_0x1db747[_0xbdca('0x39')],_0x241f10);_0x1e8d25[_0x21d308](_0x4ab816['text'],_0x4ab816[_0xbdca('0x67')][_0xbdca('0x72')],_0x4ab816[_0xbdca('0x67')][_0xbdca('0x22')]);}break;case _0xbdca('0x79'):_0x4ab816=as[_0xbdca('0x70')]('me',null,_0x241f10);_0x1e8d25[_0x21d308](_0x4ab816[_0xbdca('0x71')],_0x4ab816['value'][_0xbdca('0x72')],_0x4ab816[_0xbdca('0x67')]['end']);break;}}else{var _0x4ab816=as['buildExpression'](_0x448648,_0x1db747[_0xbdca('0x39')],_0x241f10);_0x1e8d25[_0x21d308](_0x4ab816[_0xbdca('0x71')],_0x4ab816[_0xbdca('0x67')][_0xbdca('0x72')],_0x4ab816['value'][_0xbdca('0x22')]);}}}else{var _0x28b201=_(_0x41372c[_0xbdca('0x3c')])[_0xbdca('0x3d')]()[_0xbdca('0x36')](function(_0x5b7ffd){return _[_0xbdca('0x7a')](_0x54d34e,[_0xbdca('0x2c'),_0x5b7ffd])?_0x5b7ffd:undefined;})[_0xbdca('0x7b')]()[_0xbdca('0x67')]();if(!_[_0xbdca('0x7c')](_0x28b201)){_0x28b201[_0xbdca('0x74')](function(_0x494389){if(_0x494389===_0xbdca('0x7d')){_0x23f9ee[_0xbdca('0x48')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xbdca('0x7e')](_0x41372c[_0xbdca('0x3c')][_0x494389]));}else if(_0x494389===_0xbdca('0x7f')){var _0x28ceee=JSON[_0xbdca('0x80')](_0x41372c[_0xbdca('0x3c')][_0x494389])[_0xbdca('0x81')];var _0x60c1e9=JSON[_0xbdca('0x80')](_0x41372c[_0xbdca('0x3c')][_0x494389])['$lte'];_0x23f9ee['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x28ceee,_0x60c1e9);}else{if(_0x41372c[_0xbdca('0x3c')][_0x494389]===_0xbdca('0x82')){_0x23f9ee[_0xbdca('0x48')]('i.'+_0x494389+_0xbdca('0x83'));}else{_0x23f9ee['where']('i.'+_0x494389+_0xbdca('0x84'),_0x41372c['query'][_0x494389]);}}});}if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x85')]){if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x85')]==0x1){_0x23f9ee['having'](_0xbdca('0x86'));}else{_0x23f9ee[_0xbdca('0x68')](_0xbdca('0x87'));}}if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x88')]){_0x5a0081=_[_0xbdca('0x89')](_0x41372c['query'][_0xbdca('0x88')])?_0x41372c[_0xbdca('0x3c')][_0xbdca('0x88')]:new Array(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x88')]);_0x5a0081[_0xbdca('0x74')](function(_0x50af8b){_0x49791f['or'](_0xbdca('0x75'),'%,'+_0x50af8b+',%');});}if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x8a')]){var _0x2b9231=_0x41372c[_0xbdca('0x3c')][_0xbdca('0x8a')][_0xbdca('0x8b')]('\x5c','\x5c\x5c')[_0xbdca('0x8b')]('\x27\x27',_0xbdca('0x8c'));if(qs[_0xbdca('0x8d')](_0x2b9231)){_0x1e8d25['or'](_0xbdca('0x8e'),_0x2b9231+'%');}else{_0x1e8d25['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbdca('0x6d')](_0x2b9231))['or'](_0xbdca('0x8f'),_0x2b9231+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2b9231+'%');}}}_0x23f9ee[_0xbdca('0x48')](_0x1e8d25);_0x23f9ee['group']('i.id');var _0x3c798a={'type':db[_0xbdca('0x90')][_0xbdca('0x91')][_0xbdca('0x92')],'raw':!![]};var _0x4b82ad=_0x23f9ee[_0xbdca('0x93')]();_0x4b82ad['field'](_0xbdca('0x94'));_0x4b82ad[_0xbdca('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbdca('0x66'));if(_0x51648c['order']){_0x51648c[_0xbdca('0x46')][_0xbdca('0x74')](function(_0xf37f36){_0x23f9ee[_0xbdca('0x46')]('i.'+_0xf37f36[0x0],_0xf37f36[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbdca('0x7c')](_0x5a0081)){_0x23f9ee[_0xbdca('0x68')](_0x49791f);_0x4b82ad[_0xbdca('0x48')](_0xbdca('0x95'),_0x5a0081);}BPromise[_0xbdca('0x96')]()['then'](function(){if(!_0x167f79){if(_0x41372c[_0xbdca('0x3c')][_0xbdca('0x7d')]||_0x41372c[_0xbdca('0x3c')][_0xbdca('0x97')])return;_0x4b82ad[_0xbdca('0x48')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x23f9ee[_0xbdca('0x48')](_0xbdca('0x98'));return;}return _0x41372c['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xbdca('0x28')](function(_0x252837){if(_[_0xbdca('0x7c')](_0x252837)){_0x4b82ad['where'](_0xbdca('0x99'));_0x23f9ee[_0xbdca('0x48')](_0xbdca('0x99'));}else{_0x4b82ad[_0xbdca('0x48')](_0xbdca('0x9a'),_[_0xbdca('0x36')](_0x252837,'id'));_0x23f9ee[_0xbdca('0x48')](_0xbdca('0x9a'),_[_0xbdca('0x36')](_0x252837,'id'));}});})[_0xbdca('0x28')](function(){db[_0xbdca('0x9b')][_0xbdca('0x3c')](_0x4b82ad[_0xbdca('0x9c')](),_0x3c798a)[_0xbdca('0x28')](function(_0x42d90d){_0x178803['count']=_0x42d90d[_0xbdca('0x42')];if(_0x178803[_0xbdca('0x9d')]===0x0)return[];return db[_0xbdca('0x9b')][_0xbdca('0x3c')](_0x50c528[_0xbdca('0x9c')](),_0x3c798a)[_0xbdca('0x28')](function(_0x5033dc){_0x3de505=_[_0xbdca('0x9e')](_0x5033dc,'id');_0x3c798a=_[_0xbdca('0x9f')](_0x3c798a,{'model':db[_0xbdca('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41372c['query'][_0xbdca('0x41')]){_0x51648c[_0xbdca('0x40')][_0xbdca('0x74')](function(_0x552d81){_0x23f9ee['field']('i.'+_0x552d81);});}else{_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xa0'),_0xbdca('0x66'));_0x23f9ee['field'](_0xbdca('0xa1'),_0xbdca('0xa2'));_0x23f9ee['field'](_0xbdca('0xa3'),_0xbdca('0xa4'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xa5'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xa6'),_0xbdca('0xa7'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xa8'),_0xbdca('0xa9'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xaa'),'Contact.email');_0x23f9ee[_0xbdca('0x4b')]('c.phone',_0xbdca('0xab'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xac'),_0xbdca('0xad'));_0x23f9ee['field']('c.fax',_0xbdca('0xae'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xaf'),_0xbdca('0xb0'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xb1'),_0xbdca('0xb2'));_0x23f9ee[_0xbdca('0x4b')](_0xbdca('0xb3'),_0xbdca('0x30'));}if(_0x51648c[_0xbdca('0x45')])_0x23f9ee[_0xbdca('0x45')](_0x51648c[_0xbdca('0x45')]);if(_0x51648c['offset'])_0x23f9ee[_0xbdca('0x24')](_0x51648c[_0xbdca('0x24')]);return db['sequelize'][_0xbdca('0x3c')](_0x23f9ee[_0xbdca('0x9c')](),_0x3c798a);})[_0xbdca('0x28')](function(_0x296fb6){_0x5504e1[_0xbdca('0x48')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xbdca('0x36')](_0x296fb6,'id'));return db[_0xbdca('0x9b')]['query'](_0x5504e1[_0xbdca('0x9c')](),_0x3c798a)[_0xbdca('0x28')](function(_0x29b23f){var _0x2865aa=_[_0xbdca('0xb4')](_0x29b23f,'OpenchannelInteractionId');var _0x37e0c4=[];_0x296fb6[_0xbdca('0x74')](function(_0x94f99c){_0x37e0c4[_0xbdca('0x33')](updateOpenchannelInteraction(_0x94f99c,_0x3de505,_0x2865aa));});return BPromise['all'](_0x37e0c4);});});})[_0xbdca('0x28')](function(_0x3b584d){_0x178803[_0xbdca('0xb5')]=_0x3b584d;return _0x178803;})[_0xbdca('0x28')](respondWithFilteredResult(_0x58a8c0,_0x51648c));})['catch'](handleError(_0x58a8c0,null));};exports[_0xbdca('0xb6')]=function(_0xc4b49f,_0x211a4b){var _0x2e8f3e={'raw':![],'where':{'id':_0xc4b49f[_0xbdca('0xb7')]['id']}},_0x5658b5={};_0x5658b5[_0xbdca('0x3b')]=_['keys'](db[_0xbdca('0x37')][_0xbdca('0xb8')]);_0x5658b5['query']=_[_0xbdca('0x3d')](_0xc4b49f[_0xbdca('0x3c')]);_0x5658b5[_0xbdca('0x3e')]=_[_0xbdca('0x3f')](_0x5658b5['model'],_0x5658b5[_0xbdca('0x3c')]);_0x2e8f3e[_0xbdca('0x40')]=_[_0xbdca('0x3f')](_0x5658b5['model'],qs['fields'](_0xc4b49f[_0xbdca('0x3c')]['fields']));_0x2e8f3e[_0xbdca('0x40')]=_0x2e8f3e[_0xbdca('0x40')][_0xbdca('0x42')]?_0x2e8f3e['attributes']:_0x5658b5[_0xbdca('0x3b')];if(_0xc4b49f[_0xbdca('0x3c')][_0xbdca('0xb9')]){_0x2e8f3e[_0xbdca('0xba')]=[{'all':!![]}];}_0x2e8f3e=_[_0xbdca('0x9f')]({},_0x2e8f3e,_0xc4b49f[_0xbdca('0xbb')]);return db['OpenchannelInteraction'][_0xbdca('0x65')](_0x2e8f3e)['then'](handleEntityNotFound(_0x211a4b,null))[_0xbdca('0x28')](respondWithResult(_0x211a4b,null))[_0xbdca('0x34')](handleError(_0x211a4b,null));};exports['create']=function(_0x1b9f47,_0x54f955){return db['OpenchannelInteraction'][_0xbdca('0xbc')](_0x1b9f47[_0xbdca('0x79')],{})['then'](respondWithResult(_0x54f955,0xc9))[_0xbdca('0x34')](handleError(_0x54f955,null));};exports[_0xbdca('0xbd')]=function(_0x1006b5,_0x1ab13c){if(_0x1006b5[_0xbdca('0x79')]['id']){delete _0x1006b5[_0xbdca('0x79')]['id'];}return db[_0xbdca('0x37')][_0xbdca('0x65')]({'where':{'id':_0x1006b5[_0xbdca('0xb7')]['id']}})['then'](handleEntityNotFound(_0x1ab13c,null))[_0xbdca('0x28')](saveUpdates(_0x1006b5['body'],null))['then'](respondWithResult(_0x1ab13c,null))[_0xbdca('0x34')](handleError(_0x1ab13c,null));};exports[_0xbdca('0x29')]=function(_0x8532b9,_0x1b75bd){return db[_0xbdca('0x37')][_0xbdca('0x65')]({'where':{'id':_0x8532b9[_0xbdca('0xb7')]['id']}})[_0xbdca('0x28')](handleEntityNotFound(_0x1b75bd,null))['then'](removeEntity(_0x1b75bd,null))[_0xbdca('0x34')](handleError(_0x1b75bd,null));};exports[_0xbdca('0xbe')]=function(_0x33cdd6,_0x435f03){return db[_0xbdca('0x37')]['describe']()[_0xbdca('0x28')](respondWithResult(_0x435f03,null))[_0xbdca('0x34')](handleError(_0x435f03,null));};exports[_0xbdca('0xbf')]=function(_0x48c7fb,_0x320b98,_0x4752e5){return db[_0xbdca('0xc0')][_0xbdca('0x65')]({'where':{'id':_0x48c7fb[_0xbdca('0xb7')]['id']}})[_0xbdca('0x28')](handleEntityNotFound(_0x320b98,null))[_0xbdca('0x28')](function(_0xd37ad9){if(_0xd37ad9){return _0xd37ad9[_0xbdca('0xbf')](_0x48c7fb[_0xbdca('0x79')]['ids'],_['omit'](_0x48c7fb['body'],[_0xbdca('0xc1'),'id'])||{});}})[_0xbdca('0x28')](respondWithResult(_0x320b98,null))[_0xbdca('0x34')](handleError(_0x320b98,null));};exports[_0xbdca('0xc2')]=function(_0x4bf1ed,_0x557f84,_0x11b965){var _0x1544c7={'raw':![],'where':{}};var _0x3b72d4={};var _0xbfa7ad={'count':0x0,'rows':[]};return db[_0xbdca('0x37')]['findOne']({'where':{'id':_0x4bf1ed['params']['id']}})['then'](handleEntityNotFound(_0x557f84,null))[_0xbdca('0x28')](function(_0xfdd4ac){if(_0xfdd4ac){_0x3b72d4[_0xbdca('0x3b')]=_[_0xbdca('0x3d')](db[_0xbdca('0xc0')][_0xbdca('0xb8')]);_0x3b72d4[_0xbdca('0x3c')]=_[_0xbdca('0x3d')](_0x4bf1ed[_0xbdca('0x3c')]);_0x3b72d4[_0xbdca('0x3e')]=_[_0xbdca('0x3f')](_0x3b72d4['model'],_0x3b72d4['query']);_0x1544c7[_0xbdca('0x40')]=_[_0xbdca('0x3f')](_0x3b72d4[_0xbdca('0x3b')],qs[_0xbdca('0x41')](_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x41')]));_0x1544c7[_0xbdca('0x40')]=_0x1544c7[_0xbdca('0x40')][_0xbdca('0x42')]?_0x1544c7['attributes']:_0x3b72d4[_0xbdca('0x3b')];if(!_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x43')](_0xbdca('0x44'))){_0x1544c7['limit']=qs['limit'](_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x45')]);_0x1544c7['offset']=qs[_0xbdca('0x24')](_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x24')]);}_0x1544c7[_0xbdca('0x46')]=qs[_0xbdca('0x47')](_0x4bf1ed['query']['sort']);_0x1544c7[_0xbdca('0x48')]=qs[_0xbdca('0x3e')](_[_0xbdca('0x49')](_0x4bf1ed[_0xbdca('0x3c')],_0x3b72d4[_0xbdca('0x3e')]));_0x1544c7['where'][_0xbdca('0xc3')]=_0xfdd4ac['id'];if(_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x8a')]){_0x1544c7[_0xbdca('0x48')]=_[_0xbdca('0x9f')](_0x1544c7[_0xbdca('0x48')],{'$or':_[_0xbdca('0x36')](_0x1544c7[_0xbdca('0x40')],function(_0x4b05eb){var _0x4259b2={};_0x4259b2[_0x4b05eb]={'$like':'%'+_0x4bf1ed[_0xbdca('0x3c')]['filter']+'%'};return _0x4259b2;})});}if(_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x81')]){var _0x1f9bf2=_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0x81')][_0xbdca('0x32')](',');var _0x58a26d={};_0x58a26d[_0x1f9bf2[0x0]]={'$gte':moment(_0x1f9bf2[0x1])['format'](_0xbdca('0xc4'))};_0x1544c7[_0xbdca('0x48')]=_[_0xbdca('0x9f')](_0x1544c7[_0xbdca('0x48')],_0x58a26d);}_0x1544c7=_['merge']({},_0x1544c7,_0x4bf1ed['options']);return db[_0xbdca('0xc0')][_0xbdca('0x9d')]({'where':_0x1544c7[_0xbdca('0x48')]})['then'](function(_0x17ea2c){_0xbfa7ad[_0xbdca('0x9d')]=_0x17ea2c;if(_0x4bf1ed[_0xbdca('0x3c')][_0xbdca('0xb9')]){_0x1544c7[_0xbdca('0xba')]=[{'all':!![]}];}return db[_0xbdca('0xc0')]['findAll'](_0x1544c7);})[_0xbdca('0x28')](function(_0x6009b3){_0xbfa7ad[_0xbdca('0xb5')]=_0x6009b3;return _0xbfa7ad;});}})['then'](respondWithFilteredResult(_0x557f84,_0x1544c7))[_0xbdca('0x34')](handleError(_0x557f84,null));};exports['addTags']=function(_0x29d3ad,_0x21a410,_0x24a5bf){return db[_0xbdca('0x37')][_0xbdca('0x65')]({'where':{'id':_0x29d3ad['params']['id']}})['then'](handleEntityNotFound(_0x21a410,null))[_0xbdca('0x28')](function(_0x46fd0c){if(_0x46fd0c){return _0x46fd0c[_0xbdca('0xc5')](_0x29d3ad[_0xbdca('0x79')]['ids'],_[_0xbdca('0xc6')](_0x29d3ad[_0xbdca('0x79')],[_0xbdca('0xc1'),'id'])||{})[_0xbdca('0xc7')](function(){return db['Tag'][_0xbdca('0xc8')]({'attributes':['id',_0xbdca('0x2c'),_0xbdca('0x4c')],'where':{'id':_0x29d3ad['body']['ids']}});})['then'](function(_0x2fdb73){socket[_0xbdca('0xc9')](_0xbdca('0xca'),{'id':Number(_0x29d3ad[_0xbdca('0xb7')]['id']),'tags':_0x2fdb73||[]});return{'id':Number(_0x29d3ad[_0xbdca('0xb7')]['id']),'tags':_0x2fdb73||[]};});}})['then'](respondWithResult(_0x21a410,null))['catch'](handleError(_0x21a410,null));};exports[_0xbdca('0xcb')]=function(_0x9b5ee8,_0x37b51e,_0x3abff1){return db['OpenchannelInteraction'][_0xbdca('0x65')]({'where':{'id':_0x9b5ee8[_0xbdca('0xb7')]['id']}})[_0xbdca('0x28')](handleEntityNotFound(_0x37b51e,null))['then'](function(_0x2ec03b){if(_0x2ec03b){return _0x2ec03b[_0xbdca('0xcb')](_0x9b5ee8[_0xbdca('0x3c')][_0xbdca('0xc1')]);}})[_0xbdca('0x28')](respondWithStatusCode(_0x37b51e,null))[_0xbdca('0x34')](handleError(_0x37b51e,null));};exports[_0xbdca('0xcc')]=function(_0x3cf987,_0x40c1ed){var _0x51141a=moment()[_0xbdca('0xcd')]()['toString']();var _0x5abf54=path[_0xbdca('0xce')](config['root'],_0xbdca('0xcf'),_0xbdca('0xd0'),'tmp');var _0x37e4ed=path[_0xbdca('0xce')](config[_0xbdca('0xd1')],_0xbdca('0xcf'),_0xbdca('0xd0'),_0xbdca('0xd2'));var _0x3c0d59=path['join'](_0x5abf54,_0x51141a);var _0x3e40aa=util[_0xbdca('0xd3')](_0xbdca('0xd4'),_0x3cf987[_0xbdca('0xb7')]['id'],_0x51141a);var _0x48965d=path[_0xbdca('0xce')](_0x5abf54,_0x3e40aa);var _0x50870c=[];_0x50870c['push']({'model':db['User'],'as':_0xbdca('0x76'),'attributes':['id',_0xbdca('0x2f')],'raw':!![]});_0x50870c[_0xbdca('0x33')]({'model':db['CmContact'],'as':_0xbdca('0x6a'),'attributes':['id',_0xbdca('0xd5'),_0xbdca('0xd6')],'raw':!![]});if(_0x3cf987[_0xbdca('0x3c')][_0xbdca('0xd2')]){_0x50870c[_0xbdca('0x33')]({'model':db['Attachment'],'as':_0xbdca('0xd7'),'raw':!![]});}var _0x3713f7=[{'model':db[_0xbdca('0xc0')],'as':'Messages','attributes':['id','body',_0xbdca('0x7f'),_0xbdca('0xd8'),'secret',_0xbdca('0x85')],'include':_0x50870c}];_0x3713f7[_0xbdca('0x33')]({'model':db[_0xbdca('0xd9')],'as':_0xbdca('0xda'),'attributes':['id',_0xbdca('0x2c')]});_0x3713f7[_0xbdca('0x33')]({'model':db[_0xbdca('0x76')],'as':_0xbdca('0xdb'),'attributes':['id',_0xbdca('0x2f')]});return db[_0xbdca('0x37')][_0xbdca('0x65')]({'where':{'id':_0x3cf987[_0xbdca('0xb7')]['id']},'include':_0x3713f7})[_0xbdca('0x28')](handleEntityNotFound(_0x40c1ed,null))[_0xbdca('0x28')](function(_0x572004){if(_0x572004){var _0x42d631=_0x572004[_0xbdca('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x3c0d59);var _0x1903e6={'format':'A4','border':_0xbdca('0xdd'),'header':{'height':_0xbdca('0xde'),'contents':{'first':_0xbdca('0xdf')}},'footer':{'height':'30px','contents':{'default':util[_0xbdca('0xd3')](_0xbdca('0xe0'),util[_0xbdca('0xd3')]('%s\x20#%d',_0xbdca('0xe1'),_0x42d631['id']),moment()[_0xbdca('0xd3')](_0xbdca('0xe2'))['toString']())}}};var _0x1f1531={'channel':_0xbdca('0xe1'),'account':_0x42d631[_0xbdca('0xda')][_0xbdca('0x2c')],'agent':_0x42d631['Owner']?_0x42d631[_0xbdca('0xdb')][_0xbdca('0x2f')]:_0xbdca('0xe3'),'createdAt':moment(_0x42d631['createdAt'])[_0xbdca('0xd3')](_0xbdca('0xc4'))[_0xbdca('0x9c')](),'closedAt':_0x42d631['closed']?moment(_0x42d631[_0xbdca('0xe4')])['format'](_0xbdca('0xc4'))['toString']():'','disposition':_0x42d631[_0xbdca('0xe5')],'visibility':_0x42d631[_0xbdca('0xe6')]?_0xbdca('0xe7'):_0xbdca('0xe8'),'messages':_(_0x42d631['Messages'])[_0xbdca('0x8a')]({'secret':![]})[_0xbdca('0x36')](function(_0x4cdcf3){if(_0x4cdcf3['Attachment']){var _0x210d81=path[_0xbdca('0xce')](_0x37e4ed,_0x4cdcf3[_0xbdca('0xd7')]['basename']);if(fs[_0xbdca('0xe9')](_0x210d81)){fs['createReadStream'](_0x210d81)[_0xbdca('0xea')](fs[_0xbdca('0xeb')](path[_0xbdca('0xce')](_0x3c0d59,_0x4cdcf3['Attachment'][_0xbdca('0xec')])));}}return{'date':moment(_0x4cdcf3[_0xbdca('0x7f')])[_0xbdca('0xd3')](_0xbdca('0xc4'))[_0xbdca('0x9c')](),'sender':_0x4cdcf3[_0xbdca('0xd8')]===_0xbdca('0xed')?_0x4cdcf3['User']?_0x4cdcf3['User'][_0xbdca('0x2f')]:_0xbdca('0xee'):_0x4cdcf3[_0xbdca('0x6a')][_0xbdca('0xd5')]+(_0x4cdcf3[_0xbdca('0x6a')]['lastName']?'\x20'+_0x4cdcf3[_0xbdca('0x6a')][_0xbdca('0xd6')]:''),'body':_0x4cdcf3[_0xbdca('0xd7')]?_0x4cdcf3[_0xbdca('0xd7')]['basename']:_0x4cdcf3['body'],'direction':_0x4cdcf3['direction']===_0xbdca('0xed')?'A':'C','secret':_0x4cdcf3[_0xbdca('0xef')],'read':_0x4cdcf3[_0xbdca('0x85')],'attachment':_0x4cdcf3[_0xbdca('0xd7')]};})[_0xbdca('0x67')]()};return ejs['renderFile'](path[_0xbdca('0xce')](config[_0xbdca('0xd1')],_0xbdca('0xcf'),'views',_0xbdca('0xf0')),{'interaction':_0x1f1531})[_0xbdca('0x28')](function(_0x92ba5d){return new BPromise(function(_0x42033e,_0x7b8194){pdf[_0xbdca('0xbc')](_0x92ba5d,_0x1903e6)[_0xbdca('0xf1')](path[_0xbdca('0xce')](_0x3c0d59,'transcript-'+_0x42d631['id']+'-'+_0x51141a+_0xbdca('0xf2')),function(_0x578084,_0x24dca3){if(_0x578084)return _0x7b8194(_0x578084);_0x42033e(_0x24dca3);});});})['then'](function(){return new BPromise(function(_0x13ed22,_0x3e9642){zipdir(_0x3c0d59,{'saveTo':_0x48965d},function(_0x7eabf8,_0x5e988e){if(_0x7eabf8)return _0x3e9642(_0x7eabf8);return _0x13ed22(_0x5e988e);});})['then'](function(){return new BPromise(function(_0x472f6b,_0x59a75e){rimraf(_0x3c0d59,function(_0x2cf3c5){if(_0x2cf3c5)_0x59a75e(_0x2cf3c5);return _0x472f6b();});});})[_0xbdca('0x28')](function(){return _0x40c1ed[_0xbdca('0xcc')](_0x48965d,_0x3e40aa,function(_0x500afe){if(_0x500afe){console['log'](_0xbdca('0xf3'),_0x500afe);}else{fs[_0xbdca('0xf4')](_0x48965d);}});});});}else{return _0x40c1ed['sendStatus'](0xc8);}})['catch'](handleError(_0x40c1ed,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0d9f6ae..ab8f196 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 _0x61c7=['OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x61c7,0xd1));var _0x761c=function(_0x49f3bf,_0x4f7e08){_0x49f3bf=_0x49f3bf-0x0;var _0x5bbca6=_0x61c7[_0x49f3bf];return _0x5bbca6;};'use strict';var EventEmitter=require(_0x761c('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x761c('0x1')];var OpenchannelMessage=require(_0x761c('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x761c('0x3')](0x0);var events={'afterCreate':_0x761c('0x4'),'afterUpdate':_0x761c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46e73c){return function(_0xaf3109,_0x19b7ca,_0x5c18dc){_0xaf3109['getUsers']({'attributes':['id'],'raw':!![]})[_0x761c('0x6')](function(_0x1f33d4){_0xaf3109[_0x761c('0x7')](_0x761c('0x8'),_0x1f33d4['map'](function(_0xd179c6){return{'id':_0xd179c6['id']};}));return OpenchannelMessage[_0x761c('0x9')]({'where':{'OpenchannelInteractionId':_0xaf3109['id'],'direction':'in','read':![]},'raw':!![]});})[_0x761c('0x6')](function(_0x94e52b){_0xaf3109[_0x761c('0x7')](_0x761c('0xa'),_0x94e52b['length']);OpenchannelInteractionEvents[_0x761c('0xb')](_0x46e73c+':'+_0xaf3109['id'],_0xaf3109);OpenchannelInteractionEvents['emit'](_0x46e73c,_0xaf3109);_0x5c18dc(null);})['catch'](_0x5c18dc(null));};}for(var e in events){if(events[_0x761c('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x761c('0xd')](e,emitEvent(event));}}module[_0x761c('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x728b=['OpenchannelInteraction','OpenchannelMessage','save','getUsers','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports'];(function(_0x222971,_0x212965){var _0x1cc675=function(_0x4d58e9){while(--_0x4d58e9){_0x222971['push'](_0x222971['shift']());}};_0x1cc675(++_0x212965);}(_0x728b,0x113));var _0xb728=function(_0x27c3a9,_0x5b6eba){_0x27c3a9=_0x27c3a9-0x0;var _0x3773a0=_0x728b[_0x27c3a9];return _0x3773a0;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xb728('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xb728('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb728('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xed23a5){return function(_0x1d6bbf,_0x1768f2,_0x36cfea){_0x1d6bbf[_0xb728('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x154cdb){_0x1d6bbf[_0xb728('0x4')](_0xb728('0x5'),_0x154cdb['map'](function(_0x3e58c9){return{'id':_0x3e58c9['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1d6bbf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42f311){_0x1d6bbf[_0xb728('0x4')](_0xb728('0x6'),_0x42f311[_0xb728('0x7')]);OpenchannelInteractionEvents[_0xb728('0x8')](_0xed23a5+':'+_0x1d6bbf['id'],_0x1d6bbf);OpenchannelInteractionEvents[_0xb728('0x8')](_0xed23a5,_0x1d6bbf);_0x36cfea(null);})['catch'](_0x36cfea(null));};}for(var e in events){if(events[_0xb728('0x9')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb728('0xa')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0ef3c95..ef9b1ee 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 _0x2bb0=['path','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise'];(function(_0x5c365f,_0x3b40ed){var _0x295e1b=function(_0x226683){while(--_0x226683){_0x5c365f['push'](_0x5c365f['shift']());}};_0x295e1b(++_0x3b40ed);}(_0x2bb0,0xab));var _0x02bb=function(_0x4b1540,_0x4bfe42){_0x4b1540=_0x4b1540-0x0;var _0x3a4706=_0x2bb0[_0x4b1540];return _0x3a4706;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02bb('0x2'));var BPromise=require(_0x02bb('0x3'));var rp=require(_0x02bb('0x4'));var fs=require('fs');var path=require(_0x02bb('0x5'));var rimraf=require('rimraf');var config=require(_0x02bb('0x6'));var attributes=require(_0x02bb('0x7'));module[_0x02bb('0x8')]=function(_0x2fb7b6,_0x358a96){return _0x2fb7b6['define'](_0x02bb('0x9'),attributes,{'tableName':_0x02bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e1542,_0x4d1dc8,_0x1ea8bb){if(_0x5e1542[_0x02bb('0xb')](_0x02bb('0xc'))){_0x5e1542[_0x02bb('0xd')]=moment()[_0x02bb('0xe')](_0x02bb('0xf'));}_0x1ea8bb(null,_0x5e1542);}}});}; \ No newline at end of file +var _0x76ee=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x76ee,0x188));var _0xe76e=function(_0x7fde30,_0x2a120f){_0x7fde30=_0x7fde30-0x0;var _0x5a1cf1=_0x76ee[_0x7fde30];return _0x5a1cf1;};'use strict';var _=require(_0xe76e('0x0'));var util=require(_0xe76e('0x1'));var logger=require(_0xe76e('0x2'))(_0xe76e('0x3'));var moment=require(_0xe76e('0x4'));var BPromise=require(_0xe76e('0x5'));var rp=require(_0xe76e('0x6'));var fs=require('fs');var path=require(_0xe76e('0x7'));var rimraf=require(_0xe76e('0x8'));var config=require(_0xe76e('0x9'));var attributes=require(_0xe76e('0xa'));module['exports']=function(_0x9c131c,_0x2fdabb){return _0x9c131c[_0xe76e('0xb')](_0xe76e('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x72ad2f,_0x1922dd,_0x3504d3){if(_0x72ad2f[_0xe76e('0xd')](_0xe76e('0xe'))){_0x72ad2f[_0xe76e('0xf')]=moment()[_0xe76e('0x10')](_0xe76e('0x11'));}_0x3504d3(null,_0x72ad2f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3953b3c..520b653 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 _0x417f=['localhost','./openchannelInteraction.socket','register','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x33cb45,_0x3b969d){var _0x55d565=function(_0xc22b1f){while(--_0xc22b1f){_0x33cb45['push'](_0x33cb45['shift']());}};_0x55d565(++_0x3b969d);}(_0x417f,0x6f));var _0xf417=function(_0x19752c,_0x3915fb){_0x19752c=_0x19752c-0x0;var _0x4ce5d2=_0x417f[_0x19752c];return _0x4ce5d2;};'use strict';var _=require(_0xf417('0x0'));var util=require(_0xf417('0x1'));var moment=require(_0xf417('0x2'));var BPromise=require(_0xf417('0x3'));var rs=require(_0xf417('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf417('0x5'));var logger=require(_0xf417('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf417('0x7'));var client=jayson[_0xf417('0x8')][_0xf417('0x9')]({'port':0x232a});config[_0xf417('0xa')]=_[_0xf417('0xb')](config[_0xf417('0xa')],{'host':_0xf417('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf417('0xa')]));require(_0xf417('0xd'))[_0xf417('0xe')](socket);function respondWithRpcPromise(_0x4d3ce3,_0x13c473,_0x463d8d){return new BPromise(function(_0x12f266,_0x31e7c4){return client[_0xf417('0xf')](_0x4d3ce3,_0x463d8d)[_0xf417('0x10')](function(_0x5b8546){logger[_0xf417('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x13c473,'request\x20sent');logger[_0xf417('0x12')](_0xf417('0x13'),_0x13c473,'request\x20sent',JSON[_0xf417('0x14')](_0x5b8546));if(_0x5b8546[_0xf417('0x15')]){if(_0x5b8546[_0xf417('0x15')]['code']===0x1f4){logger[_0xf417('0x15')](_0xf417('0x16'),_0x13c473,_0x5b8546[_0xf417('0x15')][_0xf417('0x17')]);return _0x31e7c4(_0x5b8546[_0xf417('0x15')][_0xf417('0x17')]);}logger[_0xf417('0x15')](_0xf417('0x16'),_0x13c473,_0x5b8546[_0xf417('0x15')]['message']);return _0x12f266(_0x5b8546[_0xf417('0x15')][_0xf417('0x17')]);}else{logger['info'](_0xf417('0x16'),_0x13c473,_0xf417('0x18'));_0x12f266(_0x5b8546[_0xf417('0x19')][_0xf417('0x17')]);}})[_0xf417('0x1a')](function(_0x4021fa){logger[_0xf417('0x15')](_0xf417('0x16'),_0x13c473,_0x4021fa);_0x31e7c4(_0x4021fa);});});}exports[_0xf417('0x1b')]=function(_0x2fd152){var _0x2bede1=this;return new Promise(function(_0x6a8d71,_0x27a68d){return db[_0xf417('0x1c')][_0xf417('0x1d')](_0x2fd152[_0xf417('0x1e')],{'raw':_0x2fd152[_0xf417('0x1f')]?_0x2fd152[_0xf417('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd152[_0xf417('0x1f')]?_0x2fd152['options'][_0xf417('0x20')]||null:null,'attributes':_0x2fd152[_0xf417('0x1f')]?_0x2fd152[_0xf417('0x1f')][_0xf417('0x21')]||null:null,'limit':_0x2fd152['options']?_0x2fd152[_0xf417('0x1f')][_0xf417('0x22')]||null:null})['then'](function(_0x3b5228){logger[_0xf417('0x11')](_0xf417('0x1b'),_0x2fd152);logger[_0xf417('0x12')](_0xf417('0x1b'),_0x2fd152,JSON['stringify'](_0x3b5228));_0x6a8d71(_0x3b5228);})[_0xf417('0x1a')](function(_0x13915c){logger[_0xf417('0x15')]('UpdateOpenchannelInteraction',_0x13915c[_0xf417('0x17')],_0x2fd152);_0x27a68d(_0x2bede1[_0xf417('0x15')](0x1f4,_0x13915c[_0xf417('0x17')]));});});};exports[_0xf417('0x23')]=function(_0x2b7ec4){return new Promise(function(_0x43e4f5,_0x1b2acd){return db['OpenchannelInteraction'][_0xf417('0x24')]({'where':_0x2b7ec4['options']?_0x2b7ec4[_0xf417('0x1f')][_0xf417('0x20')]||null:null})[_0xf417('0x10')](function(_0x87585){if(_0x87585){return _0x87585[_0xf417('0x25')](_0x2b7ec4[_0xf417('0x1e')][_0xf417('0x26')],_[_0xf417('0x27')](_0x2b7ec4[_0xf417('0x1e')],['ids','id'])||{});}})['spread'](function(_0x3e9c75){logger[_0xf417('0x11')]('AddTags',_0x2b7ec4);logger[_0xf417('0x12')](_0xf417('0x28'),_0x2b7ec4,JSON['stringify'](_0x3e9c75));_0x43e4f5(_0x3e9c75);})[_0xf417('0x1a')](function(_0xf4b9d2){logger[_0xf417('0x15')](_0xf417('0x28'),_0xf4b9d2[_0xf417('0x17')],_0x2b7ec4);_0x1b2acd(_this[_0xf417('0x15')](0x1f4,_0xf4b9d2['message']));});});}; \ No newline at end of file +var _0x8bd6=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0x8bd6,0x1b1));var _0x68bd=function(_0x3bfe46,_0x34c60c){_0x3bfe46=_0x3bfe46-0x0;var _0x47ff6a=_0x8bd6[_0x3bfe46];return _0x47ff6a;};'use strict';var _=require('lodash');var util=require(_0x68bd('0x0'));var moment=require('moment');var BPromise=require(_0x68bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68bd('0x2'))['db'];var utils=require(_0x68bd('0x3'));var logger=require(_0x68bd('0x4'))(_0x68bd('0x5'));var config=require(_0x68bd('0x6'));var jayson=require(_0x68bd('0x7'));var client=jayson[_0x68bd('0x8')][_0x68bd('0x9')]({'port':0x232a});config[_0x68bd('0xa')]=_[_0x68bd('0xb')](config['redis'],{'host':_0x68bd('0xc'),'port':0x18eb});var socket=require(_0x68bd('0xd'))(new Redis(config[_0x68bd('0xa')]));require(_0x68bd('0xe'))[_0x68bd('0xf')](socket);function respondWithRpcPromise(_0x51a426,_0x18f9fc,_0x368dd6){return new BPromise(function(_0x41bb44,_0x3e75c2){return client[_0x68bd('0x10')](_0x51a426,_0x368dd6)[_0x68bd('0x11')](function(_0x4efbb8){logger[_0x68bd('0x12')](_0x68bd('0x13'),_0x18f9fc,_0x68bd('0x14'));logger[_0x68bd('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x18f9fc,_0x68bd('0x14'),JSON['stringify'](_0x4efbb8));if(_0x4efbb8[_0x68bd('0x16')]){if(_0x4efbb8['error'][_0x68bd('0x17')]===0x1f4){logger[_0x68bd('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x18f9fc,_0x4efbb8[_0x68bd('0x16')]['message']);return _0x3e75c2(_0x4efbb8[_0x68bd('0x16')]['message']);}logger[_0x68bd('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x18f9fc,_0x4efbb8[_0x68bd('0x16')][_0x68bd('0x18')]);return _0x41bb44(_0x4efbb8['error'][_0x68bd('0x18')]);}else{logger[_0x68bd('0x12')](_0x68bd('0x13'),_0x18f9fc,_0x68bd('0x14'));_0x41bb44(_0x4efbb8[_0x68bd('0x19')]['message']);}})[_0x68bd('0x1a')](function(_0x34910c){logger[_0x68bd('0x16')](_0x68bd('0x13'),_0x18f9fc,_0x34910c);_0x3e75c2(_0x34910c);});});}exports[_0x68bd('0x1b')]=function(_0x15fa85){var _0x2d4cfa=this;return new Promise(function(_0x487926,_0xbe5495){return db[_0x68bd('0x1c')]['update'](_0x15fa85[_0x68bd('0x1d')],{'raw':_0x15fa85['options']?_0x15fa85[_0x68bd('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15fa85['options']?_0x15fa85[_0x68bd('0x1e')][_0x68bd('0x1f')]||null:null,'attributes':_0x15fa85[_0x68bd('0x1e')]?_0x15fa85[_0x68bd('0x1e')][_0x68bd('0x20')]||null:null,'limit':_0x15fa85['options']?_0x15fa85['options'][_0x68bd('0x21')]||null:null})[_0x68bd('0x11')](function(_0x317436){logger[_0x68bd('0x12')](_0x68bd('0x1b'),_0x15fa85);logger[_0x68bd('0x15')]('UpdateOpenchannelInteraction',_0x15fa85,JSON['stringify'](_0x317436));_0x487926(_0x317436);})[_0x68bd('0x1a')](function(_0x387306){logger['error'](_0x68bd('0x1b'),_0x387306[_0x68bd('0x18')],_0x15fa85);_0xbe5495(_0x2d4cfa['error'](0x1f4,_0x387306[_0x68bd('0x18')]));});});};exports[_0x68bd('0x22')]=function(_0x46cd9c){return new Promise(function(_0x605a10,_0x5684c2){return db[_0x68bd('0x1c')][_0x68bd('0x23')]({'where':_0x46cd9c[_0x68bd('0x1e')]?_0x46cd9c[_0x68bd('0x1e')][_0x68bd('0x1f')]||null:null})[_0x68bd('0x11')](function(_0x18bb6e){if(_0x18bb6e){return _0x18bb6e[_0x68bd('0x24')](_0x46cd9c[_0x68bd('0x1d')][_0x68bd('0x25')],_[_0x68bd('0x26')](_0x46cd9c[_0x68bd('0x1d')],[_0x68bd('0x25'),'id'])||{});}})['spread'](function(_0x5961ef){logger[_0x68bd('0x12')](_0x68bd('0x27'),_0x46cd9c);logger[_0x68bd('0x15')]('AddTags',_0x46cd9c,JSON['stringify'](_0x5961ef));_0x605a10(_0x5961ef);})[_0x68bd('0x1a')](function(_0x2560f4){logger['error']('AddTags',_0x2560f4['message'],_0x46cd9c);_0x5684c2(_this[_0x68bd('0x16')](0x1f4,_0x2560f4[_0x68bd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3c35456..2bbe857 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 _0x3e9b=['register','length','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x13f4f4,_0x196186){var _0x13dc22=function(_0x3e1488){while(--_0x3e1488){_0x13f4f4['push'](_0x13f4f4['shift']());}};_0x13dc22(++_0x196186);}(_0x3e9b,0x198));var _0xb3e9=function(_0x575109,_0x2dc08a){_0x575109=_0x575109-0x0;var _0x340b53=_0x3e9b[_0x575109];return _0x340b53;};'use strict';var OpenchannelInteractionEvents=require(_0xb3e9('0x0'));var events=[_0xb3e9('0x1'),_0xb3e9('0x2'),_0xb3e9('0x3')];function createListener(_0x4df2fc,_0x803f48){return function(_0x5728a5){_0x803f48[_0xb3e9('0x4')](_0x4df2fc,_0x5728a5);};}function removeListener(_0x14bced,_0x5c7f91){return function(){OpenchannelInteractionEvents['removeListener'](_0x14bced,_0x5c7f91);};}exports[_0xb3e9('0x5')]=function(_0x5c59a3){for(var _0x6ce401=0x0,_0x3ed9ad=events[_0xb3e9('0x6')];_0x6ce401<_0x3ed9ad;_0x6ce401++){var _0x2a5088=events[_0x6ce401];var _0x6cd738=createListener('openchannelInteraction:'+_0x2a5088,_0x5c59a3);OpenchannelInteractionEvents['on'](_0x2a5088,_0x6cd738);}}; \ No newline at end of file +var _0xc4fb=['emit','removeListener','length','./openchannelInteraction.events'];(function(_0x246a10,_0x2636ac){var _0x2ecdaf=function(_0x1459c6){while(--_0x1459c6){_0x246a10['push'](_0x246a10['shift']());}};_0x2ecdaf(++_0x2636ac);}(_0xc4fb,0x187));var _0xbc4f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc4fb[_0x501510];return _0x1e6ee5;};'use strict';var OpenchannelInteractionEvents=require(_0xbc4f('0x0'));var events=['save','remove','update'];function createListener(_0x4ea2eb,_0x34b63c){return function(_0x4cbefa){_0x34b63c[_0xbc4f('0x1')](_0x4ea2eb,_0x4cbefa);};}function removeListener(_0x282c57,_0x4d5bf7){return function(){OpenchannelInteractionEvents[_0xbc4f('0x2')](_0x282c57,_0x4d5bf7);};}exports['register']=function(_0x1374dc){for(var _0x44a4c0=0x0,_0x2d73b4=events[_0xbc4f('0x3')];_0x44a4c0<_0x2d73b4;_0x44a4c0++){var _0x52951d=events[_0x44a4c0];var _0x195f63=createListener('openchannelInteraction:'+_0x52951d,_0x1374dc);OpenchannelInteractionEvents['on'](_0x52951d,_0x195f63);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e9f7da0..000b343 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 _0xa430=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','tracked','openchannel','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa430,0x1e3));var _0x0a43=function(_0x35e378,_0x22df78){_0x35e378=_0x35e378-0x0;var _0x54c45e=_0xa430[_0x35e378];return _0x54c45e;};'use strict';var multer=require(_0x0a43('0x0'));var util=require(_0x0a43('0x1'));var path=require('path');var timeout=require(_0x0a43('0x2'));var express=require(_0x0a43('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0a43('0x4'));var config=require(_0x0a43('0x5'));var controller=require('./openchannelMessage.controller');router[_0x0a43('0x6')]('/',auth['isAuthenticated'](),controller[_0x0a43('0x7')]);router[_0x0a43('0x6')](_0x0a43('0x8'),auth[_0x0a43('0x9')](),controller[_0x0a43('0xa')]);router['get']('/:id',auth[_0x0a43('0x9')](),controller[_0x0a43('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x0a43('0xc')](_0x0a43('0xd'),'openchannelmessage:create'),controller[_0x0a43('0xe')]);router[_0x0a43('0xf')](_0x0a43('0x10'),auth[_0x0a43('0x9')](),controller[_0x0a43('0x11')]);router[_0x0a43('0xf')](_0x0a43('0x12'),auth[_0x0a43('0x9')](),controller[_0x0a43('0x13')]);router['put'](_0x0a43('0x14'),auth[_0x0a43('0x9')](),controller['reject']);router[_0x0a43('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0a43('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3f69=['Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','/describe','isAuthenticated','show','post','tracked','openchannel','create','/:id','update','/:id/accept','accept','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1f2d3a,_0x4c61aa){var _0xbebf9=function(_0x5ee97d){while(--_0x5ee97d){_0x1f2d3a['push'](_0x1f2d3a['shift']());}};_0xbebf9(++_0x4c61aa);}(_0x3f69,0x164));var _0x93f6=function(_0x597e8a,_0x30cfee){_0x597e8a=_0x597e8a-0x0;var _0x570a23=_0x3f69[_0x597e8a];return _0x570a23;};'use strict';var multer=require(_0x93f6('0x0'));var util=require(_0x93f6('0x1'));var path=require(_0x93f6('0x2'));var timeout=require(_0x93f6('0x3'));var express=require('express');var router=express[_0x93f6('0x4')]();var auth=require(_0x93f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93f6('0x6'));var controller=require(_0x93f6('0x7'));router[_0x93f6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x93f6('0x8')](_0x93f6('0x9'),auth[_0x93f6('0xa')](),controller['describe']);router[_0x93f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x93f6('0xb')]);router[_0x93f6('0xc')]('/',auth[_0x93f6('0xa')](),interaction[_0x93f6('0xd')](_0x93f6('0xe'),'openchannelmessage:create'),controller[_0x93f6('0xf')]);router['put'](_0x93f6('0x10'),auth[_0x93f6('0xa')](),controller[_0x93f6('0x11')]);router['put'](_0x93f6('0x12'),auth['isAuthenticated'](),controller[_0x93f6('0x13')]);router[_0x93f6('0x14')]('/:id/reject',auth[_0x93f6('0xa')](),controller['reject']);router[_0x93f6('0x15')](_0x93f6('0x10'),auth['isAuthenticated'](),controller[_0x93f6('0x16')]);module[_0x93f6('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4d06994..a507cfd 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 _0x1b9b=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0xda0d80,_0x59620b){var _0x4d0432=function(_0x216909){while(--_0x216909){_0xda0d80['push'](_0xda0d80['shift']());}};_0x4d0432(++_0x59620b);}(_0x1b9b,0x1cb));var _0xb1b9=function(_0x387d15,_0x1e5f5d){_0x387d15=_0x387d15-0x0;var _0x2cbde0=_0x1b9b[_0x387d15];return _0x2cbde0;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module['exports']={'body':{'type':Sequelize[_0xb1b9('0x1')](_0xb1b9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb1b9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb1b9('0x4')]('in',_0xb1b9('0x5')),'defaultValue':_0xb1b9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb1b9('0x6')]}}; \ No newline at end of file +var _0x5046=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5046,0xd5));var _0x6504=function(_0x329a62,_0x46528c){_0x329a62=_0x329a62-0x0;var _0x5f3be=_0x5046[_0x329a62];return _0x5f3be;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x6504('0x0')](_0x6504('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6504('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6504('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6504('0x3')]('in',_0x6504('0x4')),'defaultValue':_0x6504('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6504('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2dd380a..e822687 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 _0x291c=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','sort','filter','where','merge','options','findAll','rows','show','keys','includeAll','include','find','create','body','params','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','OpenchannelInteraction','isNil','read1stAt','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel'];(function(_0x42b8d4,_0x351ce0){var _0x8e9c3e=function(_0x39cab9){while(--_0x39cab9){_0x42b8d4['push'](_0x42b8d4['shift']());}};_0x8e9c3e(++_0x351ce0);}(_0x291c,0x165));var _0xc291=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x291c[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0xc291('0x0'));var emlformat=require(_0xc291('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc291('0x2'));var jsonpatch=require(_0xc291('0x3'));var rp=require(_0xc291('0x4'));var moment=require(_0xc291('0x5'));var BPromise=require(_0xc291('0x6'));var Mustache=require(_0xc291('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc291('0x8'));var ejs=require(_0xc291('0x9'));var fs=require('fs');var _=require(_0xc291('0xa'));var squel=require(_0xc291('0xb'));var crypto=require(_0xc291('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc291('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc291('0xe'));var Papa=require(_0xc291('0xf'));var Redis=require('ioredis');var authService=require(_0xc291('0x10'));var qs=require(_0xc291('0x11'));var as=require(_0xc291('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc291('0x13'));var utils=require(_0xc291('0x14'));var config=require(_0xc291('0x15'));var db=require(_0xc291('0x16'))['db'];config[_0xc291('0x17')]=_[_0xc291('0x18')](config[_0xc291('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc291('0x19'))(new Redis(config[_0xc291('0x17')]));require(_0xc291('0x1a'))[_0xc291('0x1b')](socket);var jayson=require(_0xc291('0x1c'));var client=jayson[_0xc291('0x1d')][_0xc291('0x1e')]({'port':0x232c});var client9002=jayson[_0xc291('0x1d')][_0xc291('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xd8a4e2,_0x6b4bdc,_0x43f8a0){if(_0x43f8a0){var _0xa4fd2c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa4fd2c['test'](_0x6b4bdc)){return _0xd8a4e2;}else{throw new db[(_0xc291('0x1f'))][(_0xc291('0x20'))](_0xc291('0x21'));}}else{return _0xd8a4e2;}}function respondWithRpcPromise(_0x3f97ad,_0x322210,_0x57d3e0,_0x190251){return new BPromise(function(_0x4d268c,_0x446d76){var _0x348ddb=_0x190251||client;return _0x348ddb[_0xc291('0x22')](_0x3f97ad,_0x57d3e0)[_0xc291('0x23')](function(_0x1062b4){logger['info'](_0xc291('0x24'),_0x322210,_0xc291('0x25'));logger[_0xc291('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x322210,_0xc291('0x25'),JSON[_0xc291('0x27')](_0x1062b4));if(_0x1062b4[_0xc291('0x28')]){if(_0x1062b4[_0xc291('0x28')][_0xc291('0x29')]===0x1f4){logger[_0xc291('0x28')](_0xc291('0x24'),_0x322210,_0x1062b4['error'][_0xc291('0x2a')]);return _0x446d76(_0x1062b4[_0xc291('0x28')][_0xc291('0x2a')]);}logger[_0xc291('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x322210,_0x1062b4[_0xc291('0x28')][_0xc291('0x2a')]);return _0x4d268c(_0x1062b4[_0xc291('0x28')][_0xc291('0x2a')]);}else{logger['info'](_0xc291('0x24'),_0x322210,_0xc291('0x25'));_0x4d268c(_0x1062b4[_0xc291('0x2b')][_0xc291('0x2a')]);}})[_0xc291('0x2c')](function(_0x4bf3b){logger[_0xc291('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x322210,_0x4bf3b);_0x446d76(_0x4bf3b);});});}function respondWithStatusCode(_0x1f5b91,_0x30d5d0){_0x30d5d0=_0x30d5d0||0xcc;return function(_0x1ba06b){if(_0x1ba06b){return _0x1f5b91['sendStatus'](_0x30d5d0);}return _0x1f5b91[_0xc291('0x2d')](_0x30d5d0)[_0xc291('0x2e')]();};}function respondWithResult(_0x308237,_0x2409a5){_0x2409a5=_0x2409a5||0xc8;return function(_0x8561b){if(_0x8561b){return _0x308237[_0xc291('0x2d')](_0x2409a5)[_0xc291('0x2f')](_0x8561b);}};}function respondWithFilteredResult(_0x530ee0,_0x57343b){return function(_0x27b70c){if(_0x27b70c){var _0x2e6dcd=_0x27b70c[_0xc291('0x30')],_0x38fba1=_0x57343b[_0xc291('0x31')],_0x4cf8c6=_0x57343b[_0xc291('0x31')]+_0x57343b[_0xc291('0x32')],_0x594eca;if(_0x4cf8c6>=_0x2e6dcd){_0x4cf8c6=_0x2e6dcd;_0x594eca=0xc8;}else{_0x594eca=0xce;}_0x530ee0[_0xc291('0x2d')](_0x594eca);return _0x530ee0[_0xc291('0x33')](_0xc291('0x34'),_0x38fba1+'-'+_0x4cf8c6+'/'+_0x2e6dcd)[_0xc291('0x2f')](_0x27b70c);}return null;};}function patchUpdates(_0x47e2e3){return function(_0xd435bd){try{jsonpatch[_0xc291('0x35')](_0xd435bd,_0x47e2e3,!![]);}catch(_0xcd0ac2){return BPromise[_0xc291('0x36')](_0xcd0ac2);}return _0xd435bd[_0xc291('0x37')]();};}function saveUpdates(_0x296c71,_0x15e831){return function(_0x662e69){if(_0x662e69){return _0x662e69[_0xc291('0x38')](_0x296c71)[_0xc291('0x23')](function(_0x1f81ab){return _0x1f81ab;});}return null;};}function removeEntity(_0x58aa74,_0x11d901){return function(_0x9efd08){if(_0x9efd08){return _0x9efd08[_0xc291('0x39')]()[_0xc291('0x23')](function(){_0x58aa74[_0xc291('0x2d')](0xcc)[_0xc291('0x2e')]();});}};}function handleEntityNotFound(_0xd0e71a,_0x43ceac){return function(_0x23b670){if(!_0x23b670){_0xd0e71a[_0xc291('0x3a')](0x194);}return _0x23b670;};}function handleError(_0x4549d8,_0x267988){_0x267988=_0x267988||0x1f4;return function(_0x40b791){logger[_0xc291('0x28')](_0x40b791['stack']);if(_0x40b791[_0xc291('0x3b')]){delete _0x40b791[_0xc291('0x3b')];}_0x4549d8[_0xc291('0x2d')](_0x267988)[_0xc291('0x3c')](_0x40b791);};}exports[_0xc291('0x3d')]=function(_0x52cca5,_0x213d2e){var _0x46e2ff={},_0x6b1788={},_0x7e82e6={'count':0x0,'rows':[]};var _0x2f771f=_['map'](db[_0xc291('0x3e')][_0xc291('0x3f')],function(_0x3dfacd){return{'name':_0x3dfacd[_0xc291('0x40')],'type':_0x3dfacd[_0xc291('0x41')]['key']};});_0x6b1788['model']=_[_0xc291('0x42')](_0x2f771f,'name');_0x6b1788['query']=_['keys'](_0x52cca5[_0xc291('0x43')]);_0x6b1788[_0xc291('0x44')]=_[_0xc291('0x45')](_0x6b1788[_0xc291('0x46')],_0x6b1788[_0xc291('0x43')]);_0x46e2ff[_0xc291('0x47')]=_[_0xc291('0x45')](_0x6b1788['model'],qs[_0xc291('0x48')](_0x52cca5[_0xc291('0x43')][_0xc291('0x48')]));_0x46e2ff[_0xc291('0x47')]=_0x46e2ff[_0xc291('0x47')][_0xc291('0x49')]?_0x46e2ff[_0xc291('0x47')]:_0x6b1788[_0xc291('0x46')];if(!_0x52cca5[_0xc291('0x43')]['hasOwnProperty']('nolimit')){_0x46e2ff[_0xc291('0x32')]=qs['limit'](_0x52cca5['query'][_0xc291('0x32')]);_0x46e2ff['offset']=qs[_0xc291('0x31')](_0x52cca5[_0xc291('0x43')]['offset']);}_0x46e2ff['order']=qs[_0xc291('0x4a')](_0x52cca5[_0xc291('0x43')][_0xc291('0x4a')]);_0x46e2ff['where']=qs[_0xc291('0x44')](_['pick'](_0x52cca5[_0xc291('0x43')],_0x6b1788[_0xc291('0x44')]),_0x2f771f);if(_0x52cca5['query'][_0xc291('0x4b')]){_0x46e2ff[_0xc291('0x4c')]=_[_0xc291('0x4d')](_0x46e2ff['where'],{'$or':_[_0xc291('0x42')](_0x2f771f,function(_0x4bf357){if(_0x4bf357['type']!=='VIRTUAL'){var _0x5303b0={};_0x5303b0[_0x4bf357[_0xc291('0x3b')]]={'$like':'%'+_0x52cca5['query']['filter']+'%'};return _0x5303b0;}})});}_0x46e2ff=_[_0xc291('0x4d')]({},_0x46e2ff,_0x52cca5[_0xc291('0x4e')]);var _0x4972ee={'where':_0x46e2ff[_0xc291('0x4c')]};return db['OpenchannelMessage'][_0xc291('0x30')](_0x4972ee)[_0xc291('0x23')](function(_0x438912){_0x7e82e6['count']=_0x438912;if(_0x52cca5[_0xc291('0x43')]['includeAll']){_0x46e2ff['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc291('0x4f')](_0x46e2ff);})[_0xc291('0x23')](function(_0x35fc95){_0x7e82e6[_0xc291('0x50')]=_0x35fc95;return _0x7e82e6;})[_0xc291('0x23')](respondWithFilteredResult(_0x213d2e,_0x46e2ff))[_0xc291('0x2c')](handleError(_0x213d2e,null));};exports[_0xc291('0x51')]=function(_0x188e49,_0x3781c8){var _0x22bceb={'raw':!![],'where':{'id':_0x188e49['params']['id']}},_0x4dfedf={};_0x4dfedf[_0xc291('0x46')]=_[_0xc291('0x52')](db[_0xc291('0x3e')][_0xc291('0x3f')]);_0x4dfedf[_0xc291('0x43')]=_[_0xc291('0x52')](_0x188e49['query']);_0x4dfedf[_0xc291('0x44')]=_[_0xc291('0x45')](_0x4dfedf['model'],_0x4dfedf[_0xc291('0x43')]);_0x22bceb['attributes']=_[_0xc291('0x45')](_0x4dfedf[_0xc291('0x46')],qs[_0xc291('0x48')](_0x188e49['query'][_0xc291('0x48')]));_0x22bceb['attributes']=_0x22bceb['attributes'][_0xc291('0x49')]?_0x22bceb[_0xc291('0x47')]:_0x4dfedf[_0xc291('0x46')];if(_0x188e49[_0xc291('0x43')][_0xc291('0x53')]){_0x22bceb[_0xc291('0x54')]=[{'all':!![]}];}_0x22bceb=_[_0xc291('0x4d')]({},_0x22bceb,_0x188e49[_0xc291('0x4e')]);return db[_0xc291('0x3e')][_0xc291('0x55')](_0x22bceb)[_0xc291('0x23')](handleEntityNotFound(_0x3781c8,null))[_0xc291('0x23')](respondWithResult(_0x3781c8,null))['catch'](handleError(_0x3781c8,null));};exports['create']=function(_0xdda715,_0xc31685){return db[_0xc291('0x3e')][_0xc291('0x56')](_0xdda715[_0xc291('0x57')],{})[_0xc291('0x23')](respondWithResult(_0xc31685,0xc9))[_0xc291('0x2c')](handleError(_0xc31685,null));};exports[_0xc291('0x38')]=function(_0x52b3af,_0x2d40f6){if(_0x52b3af[_0xc291('0x57')]['id']){delete _0x52b3af[_0xc291('0x57')]['id'];}return db[_0xc291('0x3e')][_0xc291('0x55')]({'where':{'id':_0x52b3af['params']['id']}})[_0xc291('0x23')](handleEntityNotFound(_0x2d40f6,null))[_0xc291('0x23')](saveUpdates(_0x52b3af[_0xc291('0x57')],null))['then'](respondWithResult(_0x2d40f6,null))['catch'](handleError(_0x2d40f6,null));};exports['destroy']=function(_0x3f97aa,_0x5b0037){return db['OpenchannelMessage'][_0xc291('0x55')]({'where':{'id':_0x3f97aa[_0xc291('0x58')]['id']}})[_0xc291('0x23')](handleEntityNotFound(_0x5b0037,null))['then'](removeEntity(_0x5b0037,null))[_0xc291('0x2c')](handleError(_0x5b0037,null));};exports[_0xc291('0x59')]=function(_0x2842e6,_0x1322a3){return db[_0xc291('0x3e')][_0xc291('0x59')]()[_0xc291('0x23')](respondWithResult(_0x1322a3,null))[_0xc291('0x2c')](handleError(_0x1322a3,null));};var interaction_log=require(_0xc291('0x5a'))(_0xc291('0x5b'));exports['accept']=function(_0x3dd109,_0x1e671b,_0x58ceeb){var _0x16302d={'channel':_0xc291('0x5c')};if(_0x3dd109[_0xc291('0x57')]['id']){delete _0x3dd109[_0xc291('0x57')]['id'];}_0x3dd109['body'][_0xc291('0x5d')]=!![];_0x3dd109[_0xc291('0x57')][_0xc291('0x5e')]=moment()[_0xc291('0x5f')](_0xc291('0x60'));_0x3dd109[_0xc291('0x57')][_0xc291('0x61')]=_0x3dd109['body'][_0xc291('0x61')]||_0x3dd109['user']['id'];return db['OpenchannelMessage'][_0xc291('0x55')]({'where':{'id':_0x3dd109[_0xc291('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xc291('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1e671b,null))[_0xc291('0x23')](saveUpdates(_0x3dd109[_0xc291('0x57')],null))['then'](function(_0x4fd2ce){if(_0x4fd2ce){_0x16302d[_0xc291('0x2a')]=_0x4fd2ce['get']({'plain':!![]});return db[_0xc291('0x63')][_0xc291('0x55')]({'where':{'id':_0x4fd2ce['OpenchannelInteractionId']}});}return null;})[_0xc291('0x23')](handleEntityNotFound(_0x1e671b,null))[_0xc291('0x23')](function(_0x2a3ee5){if(_0x2a3ee5){return _0x2a3ee5[_0xc291('0x38')]({'UserId':_0x3dd109[_0xc291('0x57')][_0xc291('0x61')],'read1stAt':_[_0xc291('0x64')](_0x2a3ee5[_0xc291('0x65')])?moment()[_0xc291('0x5f')](_0xc291('0x60')):undefined});}return null;})[_0xc291('0x23')](function(_0x367216){if(_0x367216){_0x16302d[_0xc291('0x66')]=_0x367216[_0xc291('0x67')]({'plain':!![]});interaction_log[_0xc291('0x68')](_0xc291('0x69'),_0x3dd109[_0xc291('0x6a')]['id'],_0x3dd109[_0xc291('0x6a')][_0xc291('0x3b')],_0x3dd109[_0xc291('0x6a')][_0xc291('0x6b')],_0x16302d['interaction']['id'],_0x3dd109[_0xc291('0x57')]?JSON[_0xc291('0x27')](_0x3dd109['body']):_0xc291('0x6c'));return respondWithRpcPromise(_0xc291('0x6d'),_0xc291('0x6e'),_0x16302d);}return null;})['then'](function(_0x33a327){if(_0x33a327){if(_0x3dd109[_0xc291('0x57')][_0xc291('0x6f')]){_0x16302d[_0xc291('0x2a')][_0xc291('0x70')]=util[_0xc291('0x5f')](_0xc291('0x71'),_0x3dd109[_0xc291('0x6a')][_0xc291('0x3b')]);_0x16302d['message'][_0xc291('0x72')]=_0x16302d[_0xc291('0x72')];_0x16302d['message'][_0xc291('0x73')]=_0xc291('0x74');return respondWithRpcPromise(_0xc291('0x75'),_0xc291('0x75'),{'event':_0xc291('0x76'),'message':_0x16302d[_0xc291('0x2a')]},client9002)[_0xc291('0x23')](function(){return _0x16302d;});}return _0x16302d;}return null;})['then'](respondWithResult(_0x1e671b,null))[_0xc291('0x2c')](handleError(_0x1e671b,null));};var interaction_log=require(_0xc291('0x5a'))('openchannel-interactions');exports[_0xc291('0x36')]=function(_0x851f4e,_0xae06df,_0x2094db){var _0x2d2d50={'agent':{},'channel':_0xc291('0x5c')};if(_0x851f4e[_0xc291('0x57')]['id']){delete _0x851f4e[_0xc291('0x57')]['id'];}_0x851f4e[_0xc291('0x57')][_0xc291('0x61')]=_0x851f4e[_0xc291('0x57')]['UserId']||_0x851f4e[_0xc291('0x6a')]['id'];_0x2d2d50[_0xc291('0x77')]['id']=_0x851f4e[_0xc291('0x57')][_0xc291('0x61')];return db[_0xc291('0x3e')]['find']({'where':{'id':_0x851f4e[_0xc291('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xae06df,null))[_0xc291('0x23')](function(_0x3d875e){if(_0x3d875e){_0x2d2d50['message']=_0x3d875e[_0xc291('0x67')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc291('0x55')]({'where':{'id':_0x3d875e['OpenchannelInteractionId']}});}return null;})[_0xc291('0x23')](handleEntityNotFound(_0xae06df,null))['then'](function(_0x10afbc){if(_0x10afbc){_0x2d2d50[_0xc291('0x66')]=_0x10afbc[_0xc291('0x67')]({'plain':!![]});interaction_log[_0xc291('0x68')](_0xc291('0x78'),_0x851f4e[_0xc291('0x6a')]['id'],_0x851f4e[_0xc291('0x6a')][_0xc291('0x3b')],_0x851f4e[_0xc291('0x6a')]['role'],_0x2d2d50[_0xc291('0x66')]['id'],_0x851f4e[_0xc291('0x57')]?JSON[_0xc291('0x27')](_0x851f4e['body']):'null');return respondWithRpcPromise(_0xc291('0x79'),'rejectMessage',_0x2d2d50);}return null;})[_0xc291('0x23')](function(_0x40ed4a){if(_0x40ed4a){_0x40ed4a[_0xc291('0x2a')][_0xc291('0x70')]=util[_0xc291('0x5f')](_0xc291('0x71'),_0x851f4e[_0xc291('0x6a')]['name']);_0x40ed4a[_0xc291('0x2a')][_0xc291('0x72')]=_0x2d2d50['channel'];_0x40ed4a[_0xc291('0x2a')][_0xc291('0x73')]=_0xc291('0x36');respondWithRpcPromise(_0xc291('0x75'),_0xc291('0x75'),{'event':_0xc291('0x7a'),'message':_0x40ed4a[_0xc291('0x2a')]},client9002);return _0x2d2d50;}return null;})['then'](respondWithResult(_0xae06df,null))[_0xc291('0x2c')](handleError(_0xae06df,null));}; \ No newline at end of file +var _0x4cea=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','OpenchannelMessage','includeAll','findAll','rows','show','keys','include','find','create','body','params','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','role','RejectMessage','rejectMessage','rejectmessage','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.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','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model'];(function(_0x1657c9,_0x57b6be){var _0x275435=function(_0x12a6c2){while(--_0x12a6c2){_0x1657c9['push'](_0x1657c9['shift']());}};_0x275435(++_0x57b6be);}(_0x4cea,0x193));var _0xa4ce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4cea[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xa4ce('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ce('0x1'));var rp=require(_0xa4ce('0x2'));var moment=require('moment');var BPromise=require(_0xa4ce('0x3'));var Mustache=require(_0xa4ce('0x4'));var util=require(_0xa4ce('0x5'));var path=require('path');var sox=require(_0xa4ce('0x6'));var csv=require(_0xa4ce('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4ce('0x8'));var jsforce=require(_0xa4ce('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xa4ce('0x7'));var querystring=require(_0xa4ce('0xa'));var Papa=require('papaparse');var Redis=require(_0xa4ce('0xb'));var authService=require(_0xa4ce('0xc'));var qs=require(_0xa4ce('0xd'));var as=require(_0xa4ce('0xe'));var hardwareService=require(_0xa4ce('0xf'));var logger=require(_0xa4ce('0x10'))(_0xa4ce('0x11'));var utils=require('../../config/utils');var config=require(_0xa4ce('0x12'));var db=require(_0xa4ce('0x13'))['db'];config[_0xa4ce('0x14')]=_[_0xa4ce('0x15')](config[_0xa4ce('0x14')],{'host':_0xa4ce('0x16'),'port':0x18eb});var socket=require(_0xa4ce('0x17'))(new Redis(config['redis']));require(_0xa4ce('0x18'))[_0xa4ce('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa4ce('0x1a')][_0xa4ce('0x1b')]({'port':0x232c});var client9002=jayson[_0xa4ce('0x1a')][_0xa4ce('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x204440,_0x5e3c03,_0x337514){if(_0x337514){var _0x54a07b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54a07b['test'](_0x5e3c03)){return _0x204440;}else{throw new db[(_0xa4ce('0x1c'))][(_0xa4ce('0x1d'))](_0xa4ce('0x1e'));}}else{return _0x204440;}}function respondWithRpcPromise(_0x51539b,_0x4504bc,_0xe864fa,_0x229c78){return new BPromise(function(_0x257548,_0x51861f){var _0x220818=_0x229c78||client;return _0x220818[_0xa4ce('0x1f')](_0x51539b,_0xe864fa)[_0xa4ce('0x20')](function(_0x3eac4c){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4504bc,_0xa4ce('0x21'));logger['debug'](_0xa4ce('0x22'),_0x4504bc,_0xa4ce('0x21'),JSON['stringify'](_0x3eac4c));if(_0x3eac4c[_0xa4ce('0x23')]){if(_0x3eac4c[_0xa4ce('0x23')]['code']===0x1f4){logger[_0xa4ce('0x23')](_0xa4ce('0x24'),_0x4504bc,_0x3eac4c[_0xa4ce('0x23')]['message']);return _0x51861f(_0x3eac4c[_0xa4ce('0x23')]['message']);}logger[_0xa4ce('0x23')](_0xa4ce('0x24'),_0x4504bc,_0x3eac4c[_0xa4ce('0x23')][_0xa4ce('0x25')]);return _0x257548(_0x3eac4c['error']['message']);}else{logger[_0xa4ce('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4504bc,_0xa4ce('0x21'));_0x257548(_0x3eac4c[_0xa4ce('0x27')]['message']);}})[_0xa4ce('0x28')](function(_0x2cc4cb){logger['error'](_0xa4ce('0x24'),_0x4504bc,_0x2cc4cb);_0x51861f(_0x2cc4cb);});});}function respondWithStatusCode(_0x564720,_0x525965){_0x525965=_0x525965||0xcc;return function(_0x11defa){if(_0x11defa){return _0x564720[_0xa4ce('0x29')](_0x525965);}return _0x564720[_0xa4ce('0x2a')](_0x525965)[_0xa4ce('0x2b')]();};}function respondWithResult(_0x1a2e86,_0x2fdcb2){_0x2fdcb2=_0x2fdcb2||0xc8;return function(_0x13c303){if(_0x13c303){return _0x1a2e86[_0xa4ce('0x2a')](_0x2fdcb2)[_0xa4ce('0x2c')](_0x13c303);}};}function respondWithFilteredResult(_0x1bd021,_0x49cdea){return function(_0x51b088){if(_0x51b088){var _0xc96efd=_0x51b088[_0xa4ce('0x2d')],_0x239a06=_0x49cdea[_0xa4ce('0x2e')],_0x16d01c=_0x49cdea[_0xa4ce('0x2e')]+_0x49cdea[_0xa4ce('0x2f')],_0x3b9f42;if(_0x16d01c>=_0xc96efd){_0x16d01c=_0xc96efd;_0x3b9f42=0xc8;}else{_0x3b9f42=0xce;}_0x1bd021[_0xa4ce('0x2a')](_0x3b9f42);return _0x1bd021['set'](_0xa4ce('0x30'),_0x239a06+'-'+_0x16d01c+'/'+_0xc96efd)['json'](_0x51b088);}return null;};}function patchUpdates(_0x26ee94){return function(_0x675e9c){try{jsonpatch['apply'](_0x675e9c,_0x26ee94,!![]);}catch(_0x58e114){return BPromise['reject'](_0x58e114);}return _0x675e9c[_0xa4ce('0x31')]();};}function saveUpdates(_0x154150,_0x4329f8){return function(_0x2fd1ec){if(_0x2fd1ec){return _0x2fd1ec[_0xa4ce('0x32')](_0x154150)[_0xa4ce('0x20')](function(_0x5def2d){return _0x5def2d;});}return null;};}function removeEntity(_0x563639,_0xc3a97){return function(_0xc242e4){if(_0xc242e4){return _0xc242e4[_0xa4ce('0x33')]()['then'](function(){_0x563639['status'](0xcc)[_0xa4ce('0x2b')]();});}};}function handleEntityNotFound(_0x35aae0,_0x51b773){return function(_0x4df0be){if(!_0x4df0be){_0x35aae0[_0xa4ce('0x29')](0x194);}return _0x4df0be;};}function handleError(_0x415b49,_0x5b0e0f){_0x5b0e0f=_0x5b0e0f||0x1f4;return function(_0xac33da){logger[_0xa4ce('0x23')](_0xac33da[_0xa4ce('0x34')]);if(_0xac33da['name']){delete _0xac33da[_0xa4ce('0x35')];}_0x415b49['status'](_0x5b0e0f)[_0xa4ce('0x36')](_0xac33da);};}exports[_0xa4ce('0x37')]=function(_0x3956e8,_0x2638d1){var _0x1c49ec={},_0x147748={},_0x2e4e18={'count':0x0,'rows':[]};var _0x249beb=_['map'](db['OpenchannelMessage'][_0xa4ce('0x38')],function(_0x3c8fab){return{'name':_0x3c8fab[_0xa4ce('0x39')],'type':_0x3c8fab[_0xa4ce('0x3a')][_0xa4ce('0x3b')]};});_0x147748['model']=_[_0xa4ce('0x3c')](_0x249beb,_0xa4ce('0x35'));_0x147748[_0xa4ce('0x3d')]=_['keys'](_0x3956e8['query']);_0x147748[_0xa4ce('0x3e')]=_[_0xa4ce('0x3f')](_0x147748[_0xa4ce('0x40')],_0x147748[_0xa4ce('0x3d')]);_0x1c49ec['attributes']=_[_0xa4ce('0x3f')](_0x147748[_0xa4ce('0x40')],qs[_0xa4ce('0x41')](_0x3956e8['query'][_0xa4ce('0x41')]));_0x1c49ec[_0xa4ce('0x42')]=_0x1c49ec[_0xa4ce('0x42')][_0xa4ce('0x43')]?_0x1c49ec[_0xa4ce('0x42')]:_0x147748[_0xa4ce('0x40')];if(!_0x3956e8['query'][_0xa4ce('0x44')](_0xa4ce('0x45'))){_0x1c49ec['limit']=qs['limit'](_0x3956e8[_0xa4ce('0x3d')]['limit']);_0x1c49ec[_0xa4ce('0x2e')]=qs[_0xa4ce('0x2e')](_0x3956e8[_0xa4ce('0x3d')]['offset']);}_0x1c49ec['order']=qs[_0xa4ce('0x46')](_0x3956e8[_0xa4ce('0x3d')][_0xa4ce('0x46')]);_0x1c49ec[_0xa4ce('0x47')]=qs[_0xa4ce('0x3e')](_[_0xa4ce('0x48')](_0x3956e8[_0xa4ce('0x3d')],_0x147748['filters']),_0x249beb);if(_0x3956e8[_0xa4ce('0x3d')]['filter']){_0x1c49ec[_0xa4ce('0x47')]=_[_0xa4ce('0x49')](_0x1c49ec[_0xa4ce('0x47')],{'$or':_[_0xa4ce('0x3c')](_0x249beb,function(_0x469f3a){if(_0x469f3a[_0xa4ce('0x3a')]!=='VIRTUAL'){var _0x1e1d99={};_0x1e1d99[_0x469f3a[_0xa4ce('0x35')]]={'$like':'%'+_0x3956e8['query'][_0xa4ce('0x4a')]+'%'};return _0x1e1d99;}})});}_0x1c49ec=_['merge']({},_0x1c49ec,_0x3956e8[_0xa4ce('0x4b')]);var _0x7a0e61={'where':_0x1c49ec[_0xa4ce('0x47')]};return db[_0xa4ce('0x4c')]['count'](_0x7a0e61)[_0xa4ce('0x20')](function(_0x1eaf03){_0x2e4e18[_0xa4ce('0x2d')]=_0x1eaf03;if(_0x3956e8[_0xa4ce('0x3d')][_0xa4ce('0x4d')]){_0x1c49ec['include']=[{'all':!![]}];}return db[_0xa4ce('0x4c')][_0xa4ce('0x4e')](_0x1c49ec);})[_0xa4ce('0x20')](function(_0x462f1b){_0x2e4e18[_0xa4ce('0x4f')]=_0x462f1b;return _0x2e4e18;})['then'](respondWithFilteredResult(_0x2638d1,_0x1c49ec))[_0xa4ce('0x28')](handleError(_0x2638d1,null));};exports[_0xa4ce('0x50')]=function(_0x185d44,_0x1513fc){var _0x10a932={'raw':!![],'where':{'id':_0x185d44['params']['id']}},_0x2bd7aa={};_0x2bd7aa['model']=_['keys'](db['OpenchannelMessage'][_0xa4ce('0x38')]);_0x2bd7aa[_0xa4ce('0x3d')]=_[_0xa4ce('0x51')](_0x185d44[_0xa4ce('0x3d')]);_0x2bd7aa[_0xa4ce('0x3e')]=_[_0xa4ce('0x3f')](_0x2bd7aa[_0xa4ce('0x40')],_0x2bd7aa[_0xa4ce('0x3d')]);_0x10a932[_0xa4ce('0x42')]=_[_0xa4ce('0x3f')](_0x2bd7aa[_0xa4ce('0x40')],qs[_0xa4ce('0x41')](_0x185d44['query']['fields']));_0x10a932[_0xa4ce('0x42')]=_0x10a932[_0xa4ce('0x42')][_0xa4ce('0x43')]?_0x10a932[_0xa4ce('0x42')]:_0x2bd7aa['model'];if(_0x185d44[_0xa4ce('0x3d')]['includeAll']){_0x10a932[_0xa4ce('0x52')]=[{'all':!![]}];}_0x10a932=_[_0xa4ce('0x49')]({},_0x10a932,_0x185d44[_0xa4ce('0x4b')]);return db[_0xa4ce('0x4c')][_0xa4ce('0x53')](_0x10a932)[_0xa4ce('0x20')](handleEntityNotFound(_0x1513fc,null))['then'](respondWithResult(_0x1513fc,null))[_0xa4ce('0x28')](handleError(_0x1513fc,null));};exports['create']=function(_0x4f29e3,_0x62bbf7){return db[_0xa4ce('0x4c')][_0xa4ce('0x54')](_0x4f29e3[_0xa4ce('0x55')],{})['then'](respondWithResult(_0x62bbf7,0xc9))[_0xa4ce('0x28')](handleError(_0x62bbf7,null));};exports[_0xa4ce('0x32')]=function(_0x1adbdf,_0x466d36){if(_0x1adbdf[_0xa4ce('0x55')]['id']){delete _0x1adbdf[_0xa4ce('0x55')]['id'];}return db['OpenchannelMessage'][_0xa4ce('0x53')]({'where':{'id':_0x1adbdf['params']['id']}})[_0xa4ce('0x20')](handleEntityNotFound(_0x466d36,null))[_0xa4ce('0x20')](saveUpdates(_0x1adbdf[_0xa4ce('0x55')],null))[_0xa4ce('0x20')](respondWithResult(_0x466d36,null))[_0xa4ce('0x28')](handleError(_0x466d36,null));};exports[_0xa4ce('0x33')]=function(_0x596639,_0x1fabc7){return db[_0xa4ce('0x4c')][_0xa4ce('0x53')]({'where':{'id':_0x596639[_0xa4ce('0x56')]['id']}})[_0xa4ce('0x20')](handleEntityNotFound(_0x1fabc7,null))['then'](removeEntity(_0x1fabc7,null))[_0xa4ce('0x28')](handleError(_0x1fabc7,null));};exports[_0xa4ce('0x57')]=function(_0x20bc32,_0x3503f2){return db['OpenchannelMessage']['describe']()[_0xa4ce('0x20')](respondWithResult(_0x3503f2,null))[_0xa4ce('0x28')](handleError(_0x3503f2,null));};var interaction_log=require(_0xa4ce('0x10'))(_0xa4ce('0x58'));exports['accept']=function(_0x383725,_0x53ad9f,_0x560f8a){var _0x30bb89={'channel':_0xa4ce('0x59')};if(_0x383725['body']['id']){delete _0x383725[_0xa4ce('0x55')]['id'];}_0x383725[_0xa4ce('0x55')]['read']=!![];_0x383725[_0xa4ce('0x55')][_0xa4ce('0x5a')]=moment()[_0xa4ce('0x5b')](_0xa4ce('0x5c'));_0x383725[_0xa4ce('0x55')]['UserId']=_0x383725['body'][_0xa4ce('0x5d')]||_0x383725[_0xa4ce('0x5e')]['id'];return db[_0xa4ce('0x4c')][_0xa4ce('0x53')]({'where':{'id':_0x383725[_0xa4ce('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa4ce('0x5f')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x53ad9f,null))[_0xa4ce('0x20')](saveUpdates(_0x383725[_0xa4ce('0x55')],null))['then'](function(_0x5e0a13){if(_0x5e0a13){_0x30bb89[_0xa4ce('0x25')]=_0x5e0a13[_0xa4ce('0x60')]({'plain':!![]});return db[_0xa4ce('0x61')][_0xa4ce('0x53')]({'where':{'id':_0x5e0a13[_0xa4ce('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x53ad9f,null))['then'](function(_0x4b9a29){if(_0x4b9a29){return _0x4b9a29[_0xa4ce('0x32')]({'UserId':_0x383725[_0xa4ce('0x55')]['UserId'],'read1stAt':_[_0xa4ce('0x63')](_0x4b9a29[_0xa4ce('0x64')])?moment()[_0xa4ce('0x5b')](_0xa4ce('0x5c')):undefined});}return null;})[_0xa4ce('0x20')](function(_0xa772e9){if(_0xa772e9){_0x30bb89[_0xa4ce('0x65')]=_0xa772e9[_0xa4ce('0x60')]({'plain':!![]});interaction_log[_0xa4ce('0x26')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x383725['user']['id'],_0x383725[_0xa4ce('0x5e')][_0xa4ce('0x35')],_0x383725[_0xa4ce('0x5e')]['role'],_0x30bb89[_0xa4ce('0x65')]['id'],_0x383725[_0xa4ce('0x55')]?JSON[_0xa4ce('0x66')](_0x383725['body']):_0xa4ce('0x67'));return respondWithRpcPromise(_0xa4ce('0x68'),_0xa4ce('0x69'),_0x30bb89);}return null;})['then'](function(_0x30f356){if(_0x30f356){if(_0x383725[_0xa4ce('0x55')][_0xa4ce('0x6a')]){_0x30bb89['message']['interface']=util[_0xa4ce('0x5b')](_0xa4ce('0x6b'),_0x383725['user'][_0xa4ce('0x35')]);_0x30bb89[_0xa4ce('0x25')][_0xa4ce('0x6c')]=_0x30bb89['channel'];_0x30bb89[_0xa4ce('0x25')][_0xa4ce('0x6d')]=_0xa4ce('0x6e');return respondWithRpcPromise(_0xa4ce('0x6f'),'EventManager',{'event':_0xa4ce('0x70'),'message':_0x30bb89['message']},client9002)['then'](function(){return _0x30bb89;});}return _0x30bb89;}return null;})[_0xa4ce('0x20')](respondWithResult(_0x53ad9f,null))[_0xa4ce('0x28')](handleError(_0x53ad9f,null));};var interaction_log=require(_0xa4ce('0x10'))(_0xa4ce('0x58'));exports['reject']=function(_0x5e4f14,_0x21b350,_0x17333e){var _0x38c15b={'agent':{},'channel':_0xa4ce('0x59')};if(_0x5e4f14[_0xa4ce('0x55')]['id']){delete _0x5e4f14[_0xa4ce('0x55')]['id'];}_0x5e4f14[_0xa4ce('0x55')][_0xa4ce('0x5d')]=_0x5e4f14[_0xa4ce('0x55')][_0xa4ce('0x5d')]||_0x5e4f14[_0xa4ce('0x5e')]['id'];_0x38c15b['agent']['id']=_0x5e4f14[_0xa4ce('0x55')][_0xa4ce('0x5d')];return db[_0xa4ce('0x4c')][_0xa4ce('0x53')]({'where':{'id':_0x5e4f14['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x21b350,null))[_0xa4ce('0x20')](function(_0x150b52){if(_0x150b52){_0x38c15b[_0xa4ce('0x25')]=_0x150b52[_0xa4ce('0x60')]({'plain':!![]});return db[_0xa4ce('0x61')][_0xa4ce('0x53')]({'where':{'id':_0x150b52['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x21b350,null))[_0xa4ce('0x20')](function(_0x1ea498){if(_0x1ea498){_0x38c15b[_0xa4ce('0x65')]=_0x1ea498[_0xa4ce('0x60')]({'plain':!![]});interaction_log[_0xa4ce('0x26')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e4f14[_0xa4ce('0x5e')]['id'],_0x5e4f14[_0xa4ce('0x5e')][_0xa4ce('0x35')],_0x5e4f14[_0xa4ce('0x5e')][_0xa4ce('0x71')],_0x38c15b['interaction']['id'],_0x5e4f14[_0xa4ce('0x55')]?JSON[_0xa4ce('0x66')](_0x5e4f14['body']):_0xa4ce('0x67'));return respondWithRpcPromise(_0xa4ce('0x72'),_0xa4ce('0x73'),_0x38c15b);}return null;})[_0xa4ce('0x20')](function(_0x57b470){if(_0x57b470){_0x57b470[_0xa4ce('0x25')]['interface']=util[_0xa4ce('0x5b')](_0xa4ce('0x6b'),_0x5e4f14[_0xa4ce('0x5e')]['name']);_0x57b470[_0xa4ce('0x25')]['channel']=_0x38c15b['channel'];_0x57b470['message'][_0xa4ce('0x6d')]='reject';respondWithRpcPromise(_0xa4ce('0x6f'),_0xa4ce('0x6f'),{'event':_0xa4ce('0x74'),'message':_0x57b470['message']},client9002);return _0x38c15b;}return null;})[_0xa4ce('0x20')](respondWithResult(_0x21b350,null))['catch'](handleError(_0x21b350,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9c252b4..9eada67 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 _0x36c5=['emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x551328,_0x5648d4){var _0x1f1e58=function(_0x230c20){while(--_0x230c20){_0x551328['push'](_0x551328['shift']());}};_0x1f1e58(++_0x5648d4);}(_0x36c5,0x90));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x536c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x536c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x536c('0x2')](0x0);var events={'afterCreate':_0x536c('0x3'),'afterUpdate':_0x536c('0x4'),'afterDestroy':_0x536c('0x5')};function emitEvent(_0x3314d6){return function(_0x3dc0b7,_0x3599b1,_0x10de47){OpenchannelMessageEvents[_0x536c('0x6')](_0x3314d6+':'+_0x3dc0b7['id'],_0x3dc0b7);OpenchannelMessageEvents[_0x536c('0x6')](_0x3314d6,_0x3dc0b7);_0x10de47(null);};}for(var e in events){if(events[_0x536c('0x7')](e)){var event=events[e];OpenchannelMessage[_0x536c('0x8')](e,emitEvent(event));}}module[_0x536c('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5a1f=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x46c57f,_0x5b28a3){var _0x32d171=function(_0x12c6ff){while(--_0x12c6ff){_0x46c57f['push'](_0x46c57f['shift']());}};_0x32d171(++_0x5b28a3);}(_0x5a1f,0x16c));var _0xf5a1=function(_0x3613d2,_0x1c352e){_0x3613d2=_0x3613d2-0x0;var _0x1ab83d=_0x5a1f[_0x3613d2];return _0x1ab83d;};'use strict';var EventEmitter=require(_0xf5a1('0x0'));var OpenchannelMessage=require(_0xf5a1('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf5a1('0x2')](0x0);var events={'afterCreate':_0xf5a1('0x3'),'afterUpdate':_0xf5a1('0x4'),'afterDestroy':_0xf5a1('0x5')};function emitEvent(_0x5b3f54){return function(_0x4043d5,_0x4a1172,_0x2af729){OpenchannelMessageEvents[_0xf5a1('0x6')](_0x5b3f54+':'+_0x4043d5['id'],_0x4043d5);OpenchannelMessageEvents[_0xf5a1('0x6')](_0x5b3f54,_0x4043d5);_0x2af729(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xf5a1('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 0d256fd..b44a38c 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 _0x5645=['toLowerCase','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction'];(function(_0xfaddc9,_0x5c9ad2){var _0x579846=function(_0x44e4ea){while(--_0x44e4ea){_0xfaddc9['push'](_0xfaddc9['shift']());}};_0x579846(++_0x5c9ad2);}(_0x5645,0x19e));var _0x5564=function(_0xc299a5,_0x579d65){_0xc299a5=_0xc299a5-0x0;var _0x13d138=_0x5645[_0xc299a5];return _0x13d138;};'use strict';var _=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var logger=require(_0x5564('0x2'))(_0x5564('0x3'));var moment=require(_0x5564('0x4'));var BPromise=require('bluebird');var rp=require(_0x5564('0x5'));var fs=require('fs');var path=require(_0x5564('0x6'));var rimraf=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var attributes=require(_0x5564('0x9'));module[_0x5564('0xa')]=function(_0x6d7911,_0x196e16){return _0x6d7911[_0x5564('0xb')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x5564('0xc'),'fields':[_0x5564('0xd')],'type':_0x5564('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x180900,_0x2a24ba,_0x4c8226){var _0x1ba45a=_0x6d7911[_0x5564('0xf')];var _0x5ca56f=_0x180900[_0x5564('0x10')]({'plain':!![]});if(_0x5ca56f[_0x5564('0x11')][_0x5564('0x12')]()==='in'||_0x5ca56f[_0x5564('0x11')][_0x5564('0x12')]()===_0x5564('0x13')&&!_0x5ca56f[_0x5564('0x14')]&&!_[_0x5564('0x15')](_0x5ca56f['UserId'])){_0x1ba45a[_0x5564('0x16')]['findOne']({'where':{'id':_0x5ca56f[_0x5564('0x17')]}})[_0x5564('0x18')](function(_0x52cc81){if(_0x52cc81){_0x52cc81[_0x5564('0x19')]({'lastMsgAt':_0x5ca56f[_0x5564('0x1a')],'lastMsgDirection':_0x5ca56f[_0x5564('0x11')][_0x5564('0x12')]()});}})[_0x5564('0x1b')](function(_0xc0764f){console['error'](_0xc0764f);});}if(_0x5ca56f[_0x5564('0x11')]===_0x5564('0x13')&&!_0x5ca56f[_0x5564('0x14')]){var _0x309bda;_0x1ba45a['CmContact'][_0x5564('0x1c')]()[_0x5564('0x18')](function(_0x2f4761){return _0x1ba45a[_0x5564('0x1d')][_0x5564('0x1e')]({'where':{'id':_0x5ca56f[_0x5564('0x1f')]},'include':[{'model':_0x1ba45a[_0x5564('0x16')],'as':_0x5564('0x20'),'where':{'id':_0x5ca56f[_0x5564('0x17')]},'limit':0x1,'include':[{'model':_0x1ba45a[_0x5564('0x21')],'as':_0x5564('0x22'),'attributes':_[_0x5564('0x23')](_0x2f4761)}]}]});})[_0x5564('0x18')](function(_0x524e5b){_0x309bda=_0x524e5b[_0x5564('0x10')]({'plain':!![]});if(_0x309bda&&_0x309bda[_0x5564('0x24')]){logger['info'](_0x5564('0x25'),_0x5564('0x26'),util[_0x5564('0x27')](_0x5564('0x28'),_0x5ca56f['id'],_0x309bda[_0x5564('0x24')]));if(_0x309bda[_0x5564('0x20')]&&_0x309bda['Interactions'][_0x5564('0x29')]){_0x5ca56f[_0x5564('0x2a')]=_[_0x5564('0x2b')](_0x309bda[_0x5564('0x20')][0x0],_0x5564('0x22'));_0x5ca56f[_0x5564('0x22')]=_0x309bda[_0x5564('0x20')][0x0][_0x5564('0x22')];}var _0x2a24ba={'method':_0x5564('0x2c'),'uri':encodeURI(_0x309bda[_0x5564('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2a24ba[_0x5564('0x2d')]){case'GET':_0x2a24ba['qs']=_0x5ca56f;break;case _0x5564('0x2c'):_0x2a24ba[_0x5564('0xd')]=_0x5ca56f;break;}return rp(_0x2a24ba)[_0x5564('0x18')](function(_0x50d02e){logger[_0x5564('0x2e')](_0x5564('0x25'),_0x5564('0x26'),util['format'](_0x5564('0x2f'),_0x5ca56f['id'],_0x309bda[_0x5564('0x24')]));if(_0x50d02e[_0x5564('0xd')][_0x5564('0x30')]&&_0x50d02e[_0x5564('0xd')][_0x5564('0x30')]!=_0x5ca56f['Interaction'][_0x5564('0x30')]){return _0x1ba45a[_0x5564('0x16')][_0x5564('0x19')]({'threadId':_0x50d02e['body'][_0x5564('0x30')]},{'logging':!![],'where':{'id':_0x5ca56f[_0x5564('0x2a')]['id']}});}else{return;}})[_0x5564('0x18')](function(){return _0x180900[_0x5564('0x19')]({'read':!![]});})['catch'](function(_0x235f4c){logger[_0x5564('0x31')](_0x5564('0x25'),'afterCreate',util[_0x5564('0x32')](_0x235f4c,{'showHidden':![],'depth':null}));_0x4c8226();});}else{_0x4c8226();}})[_0x5564('0x33')](function(){_0x4c8226();});}else{_0x4c8226();}}},'charset':_0x5564('0x34'),'collate':_0x5564('0x35')});}; \ No newline at end of file +var _0x5636=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','OpenchannelAccount','Interactions','Contact','keys','then','get','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','omit','replyUri','method','POST'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5636,0x102));var _0x6563=function(_0x536be0,_0x5a921a){_0x536be0=_0x536be0-0x0;var _0x2cc116=_0x5636[_0x536be0];return _0x2cc116;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[{'name':_0x6563('0xb'),'fields':[_0x6563('0xc')],'type':_0x6563('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f1db3,_0x3ccb4e,_0x516d1a){var _0x51fdc2=_0x39792f[_0x6563('0xe')];var _0x129fa3=_0x5f1db3['get']({'plain':!![]});if(_0x129fa3['direction']['toLowerCase']()==='in'||_0x129fa3[_0x6563('0xf')][_0x6563('0x10')]()===_0x6563('0x11')&&!_0x129fa3[_0x6563('0x12')]&&!_[_0x6563('0x13')](_0x129fa3[_0x6563('0x14')])){_0x51fdc2[_0x6563('0x15')][_0x6563('0x16')]({'where':{'id':_0x129fa3[_0x6563('0x17')]}})['then'](function(_0xa0a0b6){if(_0xa0a0b6){_0xa0a0b6['update']({'lastMsgAt':_0x129fa3[_0x6563('0x18')],'lastMsgDirection':_0x129fa3[_0x6563('0xf')][_0x6563('0x10')]()});}})[_0x6563('0x19')](function(_0x5af5d0){console[_0x6563('0x1a')](_0x5af5d0);});}if(_0x129fa3[_0x6563('0xf')]===_0x6563('0x11')&&!_0x129fa3[_0x6563('0x12')]){var _0x4e7282;_0x51fdc2[_0x6563('0x1b')]['describe']()['then'](function(_0x47972a){return _0x51fdc2[_0x6563('0x1c')]['find']({'where':{'id':_0x129fa3['OpenchannelAccountId']},'include':[{'model':_0x51fdc2[_0x6563('0x15')],'as':_0x6563('0x1d'),'where':{'id':_0x129fa3[_0x6563('0x17')]},'limit':0x1,'include':[{'model':_0x51fdc2[_0x6563('0x1b')],'as':_0x6563('0x1e'),'attributes':_[_0x6563('0x1f')](_0x47972a)}]}]});})[_0x6563('0x20')](function(_0x93a45){_0x4e7282=_0x93a45[_0x6563('0x21')]({'plain':!![]});if(_0x4e7282&&_0x4e7282['replyUri']){logger[_0x6563('0x22')](_0x6563('0x23'),_0x6563('0x24'),util['format'](_0x6563('0x25'),_0x129fa3['id'],_0x4e7282['replyUri']));if(_0x4e7282[_0x6563('0x1d')]&&_0x4e7282[_0x6563('0x1d')]['length']){_0x129fa3['Interaction']=_[_0x6563('0x26')](_0x4e7282['Interactions'][0x0],_0x6563('0x1e'));_0x129fa3[_0x6563('0x1e')]=_0x4e7282[_0x6563('0x1d')][0x0]['Contact'];}var _0x3ccb4e={'method':'POST','uri':encodeURI(_0x4e7282[_0x6563('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3ccb4e[_0x6563('0x28')]){case'GET':_0x3ccb4e['qs']=_0x129fa3;break;case _0x6563('0x29'):_0x3ccb4e[_0x6563('0xc')]=_0x129fa3;break;}return rp(_0x3ccb4e)['then'](function(_0x2ddb2b){logger['info'](_0x6563('0x23'),'afterCreate',util['format'](_0x6563('0x2a'),_0x129fa3['id'],_0x4e7282[_0x6563('0x27')]));if(_0x2ddb2b[_0x6563('0xc')][_0x6563('0x2b')]&&_0x2ddb2b[_0x6563('0xc')]['threadId']!=_0x129fa3[_0x6563('0x2c')]['threadId']){return _0x51fdc2['OpenchannelInteraction'][_0x6563('0x2d')]({'threadId':_0x2ddb2b[_0x6563('0xc')][_0x6563('0x2b')]},{'logging':!![],'where':{'id':_0x129fa3[_0x6563('0x2c')]['id']}});}else{return;}})[_0x6563('0x20')](function(){return _0x5f1db3[_0x6563('0x2d')]({'read':!![]});})[_0x6563('0x19')](function(_0x334874){logger[_0x6563('0x1a')](_0x6563('0x23'),'afterCreate',util[_0x6563('0x2e')](_0x334874,{'showHidden':![],'depth':null}));_0x516d1a();});}else{_0x516d1a();}})[_0x6563('0x2f')](function(){_0x516d1a();});}else{_0x516d1a();}}},'charset':_0x6563('0x30'),'collate':_0x6563('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1c20c47..0847a1d 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 _0x8ed7=['rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelMessage.socket','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d9580,_0x14f8ef){var _0x56dcd5=function(_0x449049){while(--_0x449049){_0x2d9580['push'](_0x2d9580['shift']());}};_0x56dcd5(++_0x14f8ef);}(_0x8ed7,0x8b));var _0x78ed=function(_0x161c38,_0x36c4cb){_0x161c38=_0x161c38-0x0;var _0x286c0f=_0x8ed7[_0x161c38];return _0x286c0f;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var moment=require(_0x78ed('0x1'));var BPromise=require(_0x78ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ed('0x3'))['db'];var utils=require(_0x78ed('0x4'));var logger=require(_0x78ed('0x5'))(_0x78ed('0x6'));var config=require(_0x78ed('0x7'));var jayson=require(_0x78ed('0x8'));var client=jayson[_0x78ed('0x9')][_0x78ed('0xa')]({'port':0x232a});config[_0x78ed('0xb')]=_['defaults'](config[_0x78ed('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x78ed('0xc'))(new Redis(config['redis']));require(_0x78ed('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d3b0e,_0x45a58d,_0x3159cf){return new BPromise(function(_0x58f77d,_0x2aeda5){return client[_0x78ed('0xe')](_0x5d3b0e,_0x3159cf)['then'](function(_0x2cac87){logger['info'](_0x78ed('0xf'),_0x45a58d,_0x78ed('0x10'));logger[_0x78ed('0x11')](_0x78ed('0x12'),_0x45a58d,_0x78ed('0x10'),JSON[_0x78ed('0x13')](_0x2cac87));if(_0x2cac87['error']){if(_0x2cac87[_0x78ed('0x14')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x45a58d,_0x2cac87['error']['message']);return _0x2aeda5(_0x2cac87[_0x78ed('0x14')][_0x78ed('0x15')]);}logger[_0x78ed('0x14')](_0x78ed('0xf'),_0x45a58d,_0x2cac87[_0x78ed('0x14')][_0x78ed('0x15')]);return _0x58f77d(_0x2cac87[_0x78ed('0x14')][_0x78ed('0x15')]);}else{logger[_0x78ed('0x16')](_0x78ed('0xf'),_0x45a58d,_0x78ed('0x10'));_0x58f77d(_0x2cac87['result'][_0x78ed('0x15')]);}})[_0x78ed('0x17')](function(_0x480b05){logger['error'](_0x78ed('0xf'),_0x45a58d,_0x480b05);_0x2aeda5(_0x480b05);});});}exports[_0x78ed('0x18')]=function(_0x2e9e1d){var _0x3bb4a9=this;return new Promise(function(_0x334bda,_0x3bd736){return db[_0x78ed('0x19')][_0x78ed('0x1a')](_0x2e9e1d[_0x78ed('0x1b')],{'raw':_0x2e9e1d[_0x78ed('0x1c')]?_0x2e9e1d[_0x78ed('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x425310){logger['info'](_0x78ed('0x18'),_0x2e9e1d);logger['debug'](_0x78ed('0x18'),_0x2e9e1d,JSON['stringify'](_0x425310));_0x334bda(_0x425310);})[_0x78ed('0x17')](function(_0x40463f){logger[_0x78ed('0x14')]('CreateOpenchannelMessage',_0x40463f[_0x78ed('0x15')],_0x2e9e1d);_0x3bd736(_0x3bb4a9['error'](0x1f4,_0x40463f[_0x78ed('0x15')]));});});}; \ No newline at end of file +var _0x9ab8=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x9ab8,0x81));var _0x89ab=function(_0x250e4f,_0x5ce9d5){_0x250e4f=_0x250e4f-0x0;var _0x4c07e7=_0x9ab8[_0x250e4f];return _0x4c07e7;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});config[_0x89ab('0xa')]=_[_0x89ab('0xb')](config[_0x89ab('0xa')],{'host':_0x89ab('0xc'),'port':0x18eb});var socket=require(_0x89ab('0xd'))(new Redis(config[_0x89ab('0xa')]));require(_0x89ab('0xe'))[_0x89ab('0xf')](socket);function respondWithRpcPromise(_0x4c1dcc,_0x539391,_0x4f0d68){return new BPromise(function(_0x551f06,_0x4ef4a8){return client[_0x89ab('0x10')](_0x4c1dcc,_0x4f0d68)[_0x89ab('0x11')](function(_0x6b8ccb){logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));logger[_0x89ab('0x15')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x539391,_0x89ab('0x14'),JSON[_0x89ab('0x16')](_0x6b8ccb));if(_0x6b8ccb[_0x89ab('0x17')]){if(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x18')]===0x1f4){logger['error'](_0x89ab('0x13'),_0x539391,_0x6b8ccb[_0x89ab('0x17')]['message']);return _0x4ef4a8(_0x6b8ccb['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x539391,_0x6b8ccb['error'][_0x89ab('0x19')]);return _0x551f06(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x19')]);}else{logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));_0x551f06(_0x6b8ccb[_0x89ab('0x1a')][_0x89ab('0x19')]);}})[_0x89ab('0x1b')](function(_0x5736f7){logger[_0x89ab('0x17')](_0x89ab('0x13'),_0x539391,_0x5736f7);_0x4ef4a8(_0x5736f7);});});}exports['CreateOpenchannelMessage']=function(_0x515370){var _0x12ebea=this;return new Promise(function(_0x1681dd,_0x58a14c){return db[_0x89ab('0x1c')][_0x89ab('0x1d')](_0x515370[_0x89ab('0x1e')],{'raw':_0x515370[_0x89ab('0x1f')]?_0x515370[_0x89ab('0x1f')][_0x89ab('0x20')]===undefined?!![]:![]:!![]})[_0x89ab('0x11')](function(_0x251a70){logger[_0x89ab('0x12')](_0x89ab('0x21'),_0x515370);logger[_0x89ab('0x15')](_0x89ab('0x21'),_0x515370,JSON[_0x89ab('0x16')](_0x251a70));_0x1681dd(_0x251a70);})[_0x89ab('0x1b')](function(_0x3bbde1){logger[_0x89ab('0x17')]('CreateOpenchannelMessage',_0x3bbde1[_0x89ab('0x19')],_0x515370);_0x58a14c(_0x12ebea['error'](0x1f4,_0x3bbde1[_0x89ab('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 13ca9bb..17ea421 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 _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x1917c7,_0x469ed8){var _0x199b58=function(_0x19748a){while(--_0x19748a){_0x1917c7['push'](_0x1917c7['shift']());}};_0x199b58(++_0x469ed8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xcb91[_0x3b0731];return _0x4204d7;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0xac4a,0x13f));var _0xaac4=function(_0x524fb9,_0x3cd33d){_0x524fb9=_0x524fb9-0x0;var _0x59c6d5=_0xac4a[_0x524fb9];return _0x59c6d5;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0b9d2d0..e22cea5 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 _0x6347=['/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/teams','getTeams','getAgents','post','create','addTeams'];(function(_0x3a239d,_0x59ec66){var _0x3c1924=function(_0x45a771){while(--_0x45a771){_0x3a239d['push'](_0x3a239d['shift']());}};_0x3c1924(++_0x59ec66);}(_0x6347,0x1c9));var _0x7634=function(_0x222523,_0x464a57){_0x222523=_0x222523-0x0;var _0x57765c=_0x6347[_0x222523];return _0x57765c;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require(_0x7634('0x2'));var express=require(_0x7634('0x3'));var router=express[_0x7634('0x4')]();var auth=require(_0x7634('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7634('0x6'));var controller=require('./openchannelQueue.controller');router[_0x7634('0x7')]('/',auth[_0x7634('0x8')](),controller['index']);router['get'](_0x7634('0x9'),auth[_0x7634('0x8')](),controller[_0x7634('0xa')]);router[_0x7634('0x7')](_0x7634('0xb'),auth[_0x7634('0x8')](),controller['show']);router[_0x7634('0x7')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x7634('0x7')](_0x7634('0xc'),auth[_0x7634('0x8')](),controller[_0x7634('0xd')]);router[_0x7634('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x7634('0xe')]);router[_0x7634('0xf')]('/',auth[_0x7634('0x8')](),controller[_0x7634('0x10')]);router[_0x7634('0xf')](_0x7634('0xc'),auth[_0x7634('0x8')](),controller[_0x7634('0x11')]);router['post'](_0x7634('0x12'),auth[_0x7634('0x8')](),controller[_0x7634('0x13')]);router[_0x7634('0x14')]('/:id',auth[_0x7634('0x8')](),controller['update']);router[_0x7634('0x15')](_0x7634('0xb'),auth[_0x7634('0x8')](),controller[_0x7634('0x16')]);router[_0x7634('0x15')](_0x7634('0xc'),auth['isAuthenticated'](),controller[_0x7634('0x17')]);router[_0x7634('0x15')]('/:id/users',auth[_0x7634('0x8')](),controller[_0x7634('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6a88=['get','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x37cf5a,_0xcbf200){var _0x3ef531=function(_0x48aed2){while(--_0x48aed2){_0x37cf5a['push'](_0x37cf5a['shift']());}};_0x3ef531(++_0xcbf200);}(_0x6a88,0xa9));var _0x86a8=function(_0x5f13c7,_0x4b0f7b){_0x5f13c7=_0x5f13c7-0x0;var _0x348082=_0x6a88[_0x5f13c7];return _0x348082;};'use strict';var multer=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var path=require(_0x86a8('0x2'));var timeout=require(_0x86a8('0x3'));var express=require(_0x86a8('0x4'));var router=express[_0x86a8('0x5')]();var auth=require(_0x86a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x86a8('0x7'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x86a8('0x8')](),controller[_0x86a8('0x9')]);router['get'](_0x86a8('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86a8('0xb')](_0x86a8('0xc'),auth['isAuthenticated'](),controller[_0x86a8('0xd')]);router[_0x86a8('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x86a8('0xe')]);router[_0x86a8('0xb')](_0x86a8('0xf'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x10')]);router[_0x86a8('0xb')](_0x86a8('0x11'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x12')]);router[_0x86a8('0x13')]('/',auth['isAuthenticated'](),controller[_0x86a8('0x14')]);router['post']('/:id/teams',auth[_0x86a8('0x8')](),controller[_0x86a8('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x86a8('0x16')]);router[_0x86a8('0x17')]('/:id',auth[_0x86a8('0x8')](),controller[_0x86a8('0x18')]);router[_0x86a8('0x19')](_0x86a8('0xc'),auth['isAuthenticated'](),controller[_0x86a8('0x1a')]);router['delete'](_0x86a8('0xf'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x1b')]);router[_0x86a8('0x19')](_0x86a8('0x11'),auth[_0x86a8('0x8')](),controller[_0x86a8('0x1c')]);module[_0x86a8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9382abd..3d4afce 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 _0xe5af=['beepall','exports','STRING','INTEGER','ENUM'];(function(_0x423644,_0x5d8da7){var _0xc800c5=function(_0xe366c9){while(--_0xe366c9){_0x423644['push'](_0x423644['shift']());}};_0xc800c5(++_0x5d8da7);}(_0xe5af,0x9c));var _0xfe5a=function(_0x59b787,_0x389245){_0x59b787=_0x59b787-0x0;var _0x25db1a=_0xe5af[_0x59b787];return _0x25db1a;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe5a('0x1')]},'timeout':{'type':Sequelize[_0xfe5a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe5a('0x3')]('rrmemory',_0xfe5a('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x5abf=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x5abf,0x72));var _0xf5ab=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5abf[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xf5ab('0x0'));module[_0xf5ab('0x1')]={'name':{'type':Sequelize[_0xf5ab('0x2')],'unique':_0xf5ab('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5ab('0x2')]},'timeout':{'type':Sequelize[_0xf5ab('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5ab('0x5')]('rrmemory',_0xf5ab('0x6'),_0xf5ab('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e89ad6f..bdc125a 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 _0x3361=['value','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelQueue','includeAll','catch','show','params','intersection','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','length','nolimit','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','UserId','agent','openchannelPause','rows','format','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','SELECT','TeamId','includes','all','union','compact'];(function(_0x310d66,_0x2132ba){var _0x11785e=function(_0x971550){while(--_0x971550){_0x310d66['push'](_0x310d66['shift']());}};_0x11785e(++_0x2132ba);}(_0x3361,0x92));var _0x1336=function(_0x3388ff,_0x45311c){_0x3388ff=_0x3388ff-0x0;var _0x298670=_0x3361[_0x3388ff];return _0x298670;};'use strict';var pdf=require(_0x1336('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1336('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1336('0x2'));var rp=require('request-promise');var moment=require(_0x1336('0x3'));var BPromise=require(_0x1336('0x4'));var Mustache=require(_0x1336('0x5'));var util=require(_0x1336('0x6'));var path=require('path');var sox=require(_0x1336('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1336('0x8'));var crypto=require('crypto');var jsforce=require(_0x1336('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1336('0xa'));var querystring=require(_0x1336('0xb'));var Papa=require(_0x1336('0xc'));var Redis=require(_0x1336('0xd'));var authService=require(_0x1336('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1336('0xf'))(_0x1336('0x10'));var utils=require(_0x1336('0x11'));var config=require('../../config/environment');var db=require(_0x1336('0x12'))['db'];config[_0x1336('0x13')]=_[_0x1336('0x14')](config[_0x1336('0x13')],{'host':_0x1336('0x15'),'port':0x18eb});var socket=require(_0x1336('0x16'))(new Redis(config[_0x1336('0x13')]));require('./openchannelQueue.socket')[_0x1336('0x17')](socket);function respondWithStatusCode(_0x16ecf1,_0x1daf1f){_0x1daf1f=_0x1daf1f||0xcc;return function(_0x161d7f){if(_0x161d7f){return _0x16ecf1[_0x1336('0x18')](_0x1daf1f);}return _0x16ecf1[_0x1336('0x19')](_0x1daf1f)[_0x1336('0x1a')]();};}function respondWithResult(_0x590997,_0x391f6f){_0x391f6f=_0x391f6f||0xc8;return function(_0x340e6f){if(_0x340e6f){return _0x590997[_0x1336('0x19')](_0x391f6f)[_0x1336('0x1b')](_0x340e6f);}};}function respondWithFilteredResult(_0x48bc1e,_0x431dcf){return function(_0x371549){if(_0x371549){var _0xe24af1=_0x371549[_0x1336('0x1c')],_0x38ada0=_0x431dcf['offset'],_0x3e9062=_0x431dcf[_0x1336('0x1d')]+_0x431dcf['limit'],_0x217a12;if(_0x3e9062>=_0xe24af1){_0x3e9062=_0xe24af1;_0x217a12=0xc8;}else{_0x217a12=0xce;}_0x48bc1e['status'](_0x217a12);return _0x48bc1e[_0x1336('0x1e')]('Content-Range',_0x38ada0+'-'+_0x3e9062+'/'+_0xe24af1)[_0x1336('0x1b')](_0x371549);}return null;};}function patchUpdates(_0x5c4024){return function(_0x4a6760){try{jsonpatch[_0x1336('0x1f')](_0x4a6760,_0x5c4024,!![]);}catch(_0x19d9f5){return BPromise[_0x1336('0x20')](_0x19d9f5);}return _0x4a6760[_0x1336('0x21')]();};}function saveUpdates(_0x56da4f,_0x45f90e){return function(_0x4f779a){if(_0x4f779a){return _0x4f779a[_0x1336('0x22')](_0x56da4f)[_0x1336('0x23')](function(_0x2be7ce){return _0x2be7ce;});}return null;};}function removeEntity(_0xff34d6,_0x5704e0){return function(_0x4b7875){if(_0x4b7875){return _0x4b7875[_0x1336('0x24')]()['then'](function(){var _0x3b7ab0=_0x4b7875['get']({'plain':!![]});var _0x234cb1=_0x1336('0x25');return db[_0x1336('0x26')][_0x1336('0x24')]({'where':{'type':_0x234cb1,'resourceId':_0x3b7ab0['id']}})['then'](function(){return _0x4b7875;});})['then'](function(){_0xff34d6[_0x1336('0x19')](0xcc)[_0x1336('0x1a')]();});}};}function handleEntityNotFound(_0x1309fb,_0x1024ae){return function(_0x22a897){if(!_0x22a897){_0x1309fb[_0x1336('0x18')](0x194);}return _0x22a897;};}function handleError(_0x3b8b22,_0x3c7039){_0x3c7039=_0x3c7039||0x1f4;return function(_0x57d9ef){logger[_0x1336('0x27')](_0x57d9ef[_0x1336('0x28')]);if(_0x57d9ef[_0x1336('0x29')]){delete _0x57d9ef[_0x1336('0x29')];}_0x3b8b22[_0x1336('0x19')](_0x3c7039)[_0x1336('0x2a')](_0x57d9ef);};}exports[_0x1336('0x2b')]=function(_0x47239f,_0x73dc6c){var _0x2cf611={},_0x52ce41={},_0x49f27e={'count':0x0,'rows':[]};var _0x245e4e=_['map'](db['OpenchannelQueue'][_0x1336('0x2c')],function(_0x248c7a){return{'name':_0x248c7a[_0x1336('0x2d')],'type':_0x248c7a[_0x1336('0x2e')][_0x1336('0x2f')]};});_0x52ce41[_0x1336('0x30')]=_[_0x1336('0x31')](_0x245e4e,_0x1336('0x29'));_0x52ce41[_0x1336('0x32')]=_[_0x1336('0x33')](_0x47239f[_0x1336('0x32')]);_0x52ce41[_0x1336('0x34')]=_['intersection'](_0x52ce41[_0x1336('0x30')],_0x52ce41['query']);_0x2cf611['attributes']=_['intersection'](_0x52ce41[_0x1336('0x30')],qs[_0x1336('0x35')](_0x47239f[_0x1336('0x32')][_0x1336('0x35')]));_0x2cf611[_0x1336('0x36')]=_0x2cf611[_0x1336('0x36')]['length']?_0x2cf611[_0x1336('0x36')]:_0x52ce41[_0x1336('0x30')];if(!_0x47239f[_0x1336('0x32')][_0x1336('0x37')]('nolimit')){_0x2cf611[_0x1336('0x38')]=qs[_0x1336('0x38')](_0x47239f[_0x1336('0x32')]['limit']);_0x2cf611[_0x1336('0x1d')]=qs['offset'](_0x47239f[_0x1336('0x32')][_0x1336('0x1d')]);}_0x2cf611[_0x1336('0x39')]=qs['sort'](_0x47239f['query'][_0x1336('0x3a')]);_0x2cf611[_0x1336('0x3b')]=qs[_0x1336('0x34')](_[_0x1336('0x3c')](_0x47239f['query'],_0x52ce41[_0x1336('0x34')]),_0x245e4e);if(_0x47239f[_0x1336('0x32')]['filter']){_0x2cf611['where']=_[_0x1336('0x3d')](_0x2cf611['where'],{'$or':_[_0x1336('0x31')](_0x245e4e,function(_0xdd1507){if(_0xdd1507[_0x1336('0x2e')]!==_0x1336('0x3e')){var _0x3defd6={};_0x3defd6[_0xdd1507[_0x1336('0x29')]]={'$like':'%'+_0x47239f[_0x1336('0x32')][_0x1336('0x3f')]+'%'};return _0x3defd6;}})});}_0x2cf611=_[_0x1336('0x3d')]({},_0x2cf611,_0x47239f[_0x1336('0x40')]);var _0x24a2da={'where':_0x2cf611['where']};return db[_0x1336('0x41')][_0x1336('0x1c')](_0x24a2da)[_0x1336('0x23')](function(_0x265c1a){_0x49f27e[_0x1336('0x1c')]=_0x265c1a;if(_0x47239f['query'][_0x1336('0x42')]){_0x2cf611['include']=[{'all':!![]}];}return db[_0x1336('0x41')]['findAll'](_0x2cf611);})[_0x1336('0x23')](function(_0x5c7d21){_0x49f27e['rows']=_0x5c7d21;return _0x49f27e;})[_0x1336('0x23')](respondWithFilteredResult(_0x73dc6c,_0x2cf611))[_0x1336('0x43')](handleError(_0x73dc6c,null));};exports[_0x1336('0x44')]=function(_0x14b847,_0x1fe115){var _0x4de8c4={'raw':!![],'where':{'id':_0x14b847[_0x1336('0x45')]['id']}},_0x29a258={};_0x29a258[_0x1336('0x30')]=_['keys'](db[_0x1336('0x41')]['rawAttributes']);_0x29a258[_0x1336('0x32')]=_['keys'](_0x14b847['query']);_0x29a258[_0x1336('0x34')]=_[_0x1336('0x46')](_0x29a258['model'],_0x29a258[_0x1336('0x32')]);_0x4de8c4[_0x1336('0x36')]=_[_0x1336('0x46')](_0x29a258[_0x1336('0x30')],qs[_0x1336('0x35')](_0x14b847[_0x1336('0x32')][_0x1336('0x35')]));_0x4de8c4[_0x1336('0x36')]=_0x4de8c4['attributes']['length']?_0x4de8c4[_0x1336('0x36')]:_0x29a258[_0x1336('0x30')];if(_0x14b847[_0x1336('0x32')][_0x1336('0x42')]){_0x4de8c4[_0x1336('0x47')]=[{'all':!![]}];}_0x4de8c4=_[_0x1336('0x3d')]({},_0x4de8c4,_0x14b847[_0x1336('0x40')]);return db[_0x1336('0x41')]['find'](_0x4de8c4)[_0x1336('0x23')](handleEntityNotFound(_0x1fe115,null))['then'](respondWithResult(_0x1fe115,null))[_0x1336('0x43')](handleError(_0x1fe115,null));};exports[_0x1336('0x48')]=function(_0x1aaee5,_0x2e1d27){return db['OpenchannelQueue'][_0x1336('0x48')](_0x1aaee5[_0x1336('0x49')],{})[_0x1336('0x23')](function(_0x4912b6){var _0x45ac13=_0x1aaee5[_0x1336('0x4a')][_0x1336('0x4b')]({'plain':!![]});if(!_0x45ac13)throw new Error(_0x1336('0x4c'));if(_0x45ac13['role']===_0x1336('0x4a')){var _0x3b9a4e=_0x4912b6[_0x1336('0x4b')]({'plain':!![]});var _0x542159='OpenchannelQueues';return db[_0x1336('0x4d')]['find']({'where':{'name':_0x542159,'userProfileId':_0x45ac13[_0x1336('0x4e')]},'raw':!![]})[_0x1336('0x23')](function(_0xccc9c7){if(_0xccc9c7&&_0xccc9c7[_0x1336('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b9a4e[_0x1336('0x29')],'resourceId':_0x3b9a4e['id'],'type':_0xccc9c7[_0x1336('0x29')],'sectionId':_0xccc9c7['id']},{})[_0x1336('0x23')](function(){return _0x4912b6;});}else{return _0x4912b6;}})[_0x1336('0x43')](function(_0x18389e){logger[_0x1336('0x27')](_0x1336('0x50'),_0x18389e);throw _0x18389e;});}return _0x4912b6;})[_0x1336('0x23')](respondWithResult(_0x2e1d27,0xc9))[_0x1336('0x43')](handleError(_0x2e1d27,null));};exports[_0x1336('0x22')]=function(_0x31ee20,_0x1559b9){if(_0x31ee20[_0x1336('0x49')]['id']){delete _0x31ee20[_0x1336('0x49')]['id'];}return db[_0x1336('0x41')][_0x1336('0x51')]({'where':{'id':_0x31ee20[_0x1336('0x45')]['id']}})[_0x1336('0x23')](handleEntityNotFound(_0x1559b9,null))[_0x1336('0x23')](saveUpdates(_0x31ee20[_0x1336('0x49')],null))[_0x1336('0x23')](respondWithResult(_0x1559b9,null))['catch'](handleError(_0x1559b9,null));};exports[_0x1336('0x24')]=function(_0x804c72,_0x2d4533){return db['OpenchannelQueue']['find']({'where':{'id':_0x804c72[_0x1336('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d4533,null))['then'](removeEntity(_0x2d4533,null))['catch'](handleError(_0x2d4533,null));};exports['describe']=function(_0x175302,_0x134cad){return db[_0x1336('0x41')][_0x1336('0x52')]()[_0x1336('0x23')](respondWithResult(_0x134cad,null))[_0x1336('0x43')](handleError(_0x134cad,null));};exports[_0x1336('0x53')]=function(_0x256c4f,_0x57c8c7,_0x1c7c2b){var _0x458a84={'raw':!![],'where':{}},_0x1f3348={},_0x4adf39;return db[_0x1336('0x41')][_0x1336('0x54')]({'where':{'id':_0x256c4f[_0x1336('0x45')]['id']}})['then'](handleEntityNotFound(_0x57c8c7,null))[_0x1336('0x23')](function(_0xe61bb1){if(_0xe61bb1){_0x4adf39=_0xe61bb1[_0x1336('0x4b')]({'plain':!![]});_0x1f3348[_0x1336('0x30')]=_[_0x1336('0x33')](db['UserOpenchannelQueue'][_0x1336('0x2c')]);_0x1f3348[_0x1336('0x32')]=_['keys'](_0x256c4f['query']);_0x1f3348[_0x1336('0x34')]=_[_0x1336('0x46')](_0x1f3348[_0x1336('0x30')],_0x1f3348[_0x1336('0x32')]);_0x458a84[_0x1336('0x36')]=_[_0x1336('0x46')](_0x1f3348[_0x1336('0x30')],qs[_0x1336('0x35')](_0x256c4f[_0x1336('0x32')][_0x1336('0x35')]));_0x458a84['attributes']=_0x458a84['attributes'][_0x1336('0x55')]?_0x458a84['attributes']:_0x1f3348[_0x1336('0x30')];if(!_0x256c4f['query']['hasOwnProperty'](_0x1336('0x56'))){_0x458a84[_0x1336('0x38')]=qs[_0x1336('0x38')](_0x256c4f[_0x1336('0x32')][_0x1336('0x38')]);_0x458a84[_0x1336('0x1d')]=qs[_0x1336('0x1d')](_0x256c4f[_0x1336('0x32')]['offset']);}_0x458a84['order']=qs[_0x1336('0x3a')](_0x256c4f[_0x1336('0x32')]['sort']);_0x458a84[_0x1336('0x3b')]=qs[_0x1336('0x34')](_['pick'](_0x256c4f['query'],_0x1f3348[_0x1336('0x34')]));_0x458a84[_0x1336('0x3b')][_0x1336('0x57')]=_0xe61bb1['id'];if(_0x256c4f[_0x1336('0x32')][_0x1336('0x3f')]){_0x458a84[_0x1336('0x3b')]=_[_0x1336('0x3d')](_0x458a84['where'],{'$or':_['map'](_0x458a84[_0x1336('0x36')],function(_0x35e531){var _0x1cd696={};_0x1cd696[_0x35e531]={'$like':'%'+_0x256c4f[_0x1336('0x32')][_0x1336('0x3f')]+'%'};return _0x1cd696;})});}_0x458a84=_[_0x1336('0x3d')]({},_0x458a84,_0x256c4f[_0x1336('0x40')]);return db[_0x1336('0x58')][_0x1336('0x59')](_0x458a84);}})[_0x1336('0x23')](function(_0x527041){if(_0x527041){return db[_0x1336('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x527041,_0x1336('0x5b')),'role':_0x1336('0x5c')},'attributes':['id',_0x1336('0x29'),_0x1336('0x5d'),'updatedAt','createdAt']});}})['then'](function(_0x41fd3a){if(_0x41fd3a){return{'count':_0x41fd3a[_0x1336('0x1c')],'rows':_['map'](_0x41fd3a[_0x1336('0x5e')],function(_0x178461){return{'membername':_0x178461[_0x1336('0x29')],'UserId':_0x178461['id'],'queue_name':_0x4adf39[_0x1336('0x29')],'OpenchannelQueueId':_0x4adf39['id'],'interface':util[_0x1336('0x5f')]('%s/%s',_0x1336('0x60'),_0x178461['name']),'penalty':0x0,'paused':_0x178461[_0x1336('0x5d')],'createdAt':_0x178461[_0x1336('0x61')],'updatedAt':_0x178461['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1336('0x23')](respondWithFilteredResult(_0x57c8c7,_0x458a84))['catch'](handleError(_0x57c8c7,null));};exports[_0x1336('0x62')]=function(_0x2e8959,_0x41e80e,_0x408bac){var _0x205c12={};var _0x1f71f8={};var _0x4d31e5;var _0x6262d9;return db['OpenchannelQueue'][_0x1336('0x54')]({'where':{'id':_0x2e8959[_0x1336('0x45')]['id']}})[_0x1336('0x23')](handleEntityNotFound(_0x41e80e,null))['then'](function(_0x4995a4){if(_0x4995a4){_0x4d31e5=_0x4995a4;_0x1f71f8[_0x1336('0x30')]=_[_0x1336('0x33')](db[_0x1336('0x63')][_0x1336('0x2c')]);_0x1f71f8['query']=_[_0x1336('0x33')](_0x2e8959[_0x1336('0x32')]);_0x1f71f8['filters']=_[_0x1336('0x46')](_0x1f71f8['model'],_0x1f71f8[_0x1336('0x32')]);_0x205c12['attributes']=_[_0x1336('0x46')](_0x1f71f8[_0x1336('0x30')],qs[_0x1336('0x35')](_0x2e8959['query'][_0x1336('0x35')]));_0x205c12['attributes']=_0x205c12[_0x1336('0x36')][_0x1336('0x55')]?_0x205c12['attributes']:_0x1f71f8['model'];_0x205c12['order']=qs[_0x1336('0x3a')](_0x2e8959[_0x1336('0x32')][_0x1336('0x3a')]);_0x205c12[_0x1336('0x3b')]=qs[_0x1336('0x34')](_[_0x1336('0x3c')](_0x2e8959['query'],_0x1f71f8[_0x1336('0x34')]));if(_0x2e8959[_0x1336('0x32')]['filter']){_0x205c12['where']=_[_0x1336('0x3d')](_0x205c12[_0x1336('0x3b')],{'$or':_[_0x1336('0x31')](_0x205c12['attributes'],function(_0x14c6e9){var _0x3bceb2={};_0x3bceb2[_0x14c6e9]={'$like':'%'+_0x2e8959[_0x1336('0x32')][_0x1336('0x3f')]+'%'};return _0x3bceb2;})});}_0x205c12=_[_0x1336('0x3d')]({},_0x205c12,_0x2e8959['options']);return _0x4d31e5[_0x1336('0x62')](_0x205c12);}})['then'](function(_0xb60f5c){if(_0xb60f5c){_0x6262d9=_0xb60f5c['length'];if(!_0x2e8959[_0x1336('0x32')][_0x1336('0x37')]('nolimit')){_0x205c12[_0x1336('0x38')]=qs[_0x1336('0x38')](_0x2e8959[_0x1336('0x32')]['limit']);_0x205c12[_0x1336('0x1d')]=qs[_0x1336('0x1d')](_0x2e8959[_0x1336('0x32')][_0x1336('0x1d')]);}return _0x4d31e5[_0x1336('0x62')](_0x205c12);}})[_0x1336('0x23')](function(_0x4463f8){if(_0x4463f8){return _0x4463f8?{'count':_0x6262d9,'rows':_0x4463f8}:null;}})[_0x1336('0x23')](respondWithResult(_0x41e80e,null))[_0x1336('0x43')](handleError(_0x41e80e,null));};exports[_0x1336('0x64')]=function(_0x135d1a,_0x4a160e,_0x13956c){var _0x8cd92a=_0x135d1a[_0x1336('0x49')][_0x1336('0x65')];return db['Team']['findAll']({'where':{'id':_0x8cd92a},'attributes':['id'],'include':[{'model':db[_0x1336('0x5a')],'as':_0x1336('0x66'),'attributes':['id','name','online',_0x1336('0x67'),_0x1336('0x68')],'raw':!![]}]})[_0x1336('0x23')](function(_0x4e1fd7){if(_0x4e1fd7){var _0x5c20cb=_[_0x1336('0x69')](_0x4e1fd7,function(_0x27cd8e){var _0x338682=_0x27cd8e['get']({'plain':!![]});return _0x338682['Agents'];});return db['OpenchannelQueue'][_0x1336('0x51')]({'where':{'id':_0x135d1a[_0x1336('0x45')]['id']}})[_0x1336('0x23')](function(_0xc86f33){return db[_0x1336('0x6a')][_0x1336('0x6b')](function(_0x4041f9){return _0xc86f33[_0x1336('0x64')](_0x8cd92a,{'transaction':_0x4041f9})[_0x1336('0x23')](function(){return BPromise[_0x1336('0x6c')](_0x5c20cb,function(_0x26bc0e){return db[_0x1336('0x58')][_0x1336('0x6d')]({'where':{'UserId':_0x26bc0e['id'],'OpenchannelQueueId':_0x135d1a[_0x1336('0x45')]['id']},'transaction':_0x4041f9});});})[_0x1336('0x23')](function(){_0x5c20cb[_0x1336('0x6e')](function(_0x306133){socket[_0x1336('0x6f')](_0x1336('0x70'),{'UserId':_0x306133['id'],'OpenchannelQueueId':_0xc86f33['id']});});});});});}})['then'](respondWithStatusCode(_0x4a160e,null))[_0x1336('0x43')](handleError(_0x4a160e,null));};exports[_0x1336('0x71')]=function(_0x450ee6,_0x5cdd44,_0x27cedd){return db[_0x1336('0x63')][_0x1336('0x59')]({'where':{'id':_0x450ee6[_0x1336('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1336('0x5a')],'as':_0x1336('0x66'),'attributes':['id'],'raw':!![]}]})[_0x1336('0x23')](handleEntityNotFound(_0x5cdd44,null))[_0x1336('0x23')](function(_0x43e7d9){var _0xafca9=_['map'](_0x43e7d9,'id');var _0x59867c=[];var _0x35a6e5=[];var _0x138e54=squel[_0x1336('0x72')]();_0x138e54[_0x1336('0x73')](_0x1336('0x74'))['from'](_0x1336('0x75'),'tq')[_0x1336('0x76')](_0x1336('0x77'),'ut',_0x1336('0x78'))[_0x1336('0x3b')](_0x1336('0x79'),_0x450ee6['params']['id']);for(var _0x23f7f8=0x0;_0x23f7f8<_0x43e7d9[_0x1336('0x55')];_0x23f7f8+=0x1){let _0x613a4e=_0x43e7d9[_0x23f7f8];for(var _0xdf6631=0x0;_0xdf6631<_0x613a4e[_0x1336('0x66')][_0x1336('0x55')];_0xdf6631+=0x1){let _0xc6e458=_0x613a4e['Agents'][_0xdf6631];var _0x3dbeca=_0x138e54[_0x1336('0x7a')]();_0x3dbeca[_0x1336('0x3b')]('ut.UserId\x20=\x20?',_0xc6e458['id']);_0x35a6e5[_0x1336('0x7b')](db[_0x1336('0x6a')][_0x1336('0x32')](_0x3dbeca['toString'](),{'type':db[_0x1336('0x6a')]['QueryTypes'][_0x1336('0x7c')]})[_0x1336('0x23')](function(_0x329588){if(_0x329588[_0x1336('0x55')]===0x1){return _0xc6e458['id'];}else{var _0x4e0bf1=_['every'](_[_0x1336('0x31')](_0x329588,_0x1336('0x7d')),function(_0x75adf){return _[_0x1336('0x7e')](_0xafca9,_0x75adf);});if(_0x4e0bf1){return _0xc6e458['id'];}}}));}}return BPromise[_0x1336('0x7f')](_0x35a6e5)[_0x1336('0x23')](function(_0x29db9f){_0x59867c=_(_0x59867c)[_0x1336('0x80')](_0x29db9f)[_0x1336('0x81')]()[_0x1336('0x82')]();return db[_0x1336('0x41')][_0x1336('0x51')]({'where':{'id':_0x450ee6['params']['id']}})[_0x1336('0x23')](function(_0x1aa01e){return db[_0x1336('0x6a')][_0x1336('0x6b')](function(_0x346145){return _0x1aa01e[_0x1336('0x71')](_0x450ee6['query'][_0x1336('0x65')],{'transaction':_0x346145})[_0x1336('0x23')](function(){if(!_[_0x1336('0x83')](_0x59867c)){return _0x1aa01e[_0x1336('0x84')](_0x59867c,{'transaction':_0x346145});}})[_0x1336('0x23')](function(){_0x59867c['forEach'](function(_0xe4ff2c){socket[_0x1336('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0xe4ff2c,'OpenchannelQueueId':_0x1aa01e['id']});});});});});});})[_0x1336('0x23')](respondWithStatusCode(_0x5cdd44,null))['catch'](handleError(_0x5cdd44,null));};exports['addAgents']=function(_0x3a352b,_0x1e5717,_0xa8bd54){return db[_0x1336('0x41')][_0x1336('0x51')]({'where':{'id':_0x3a352b[_0x1336('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e5717,null))[_0x1336('0x23')](function(_0x38a316){if(_0x38a316){return _0x38a316[_0x1336('0x85')](_0x3a352b[_0x1336('0x49')][_0x1336('0x65')],_[_0x1336('0x86')](_0x3a352b[_0x1336('0x49')],[_0x1336('0x65'),'id'])||{})[_0x1336('0x87')](function(_0x5d8bca){for(var _0x1ff36a=0x0;_0x1ff36a<_0x3a352b[_0x1336('0x49')][_0x1336('0x65')][_0x1336('0x55')];_0x1ff36a+=0x1){socket[_0x1336('0x6f')](_0x1336('0x70'),{'UserId':_0x3a352b[_0x1336('0x49')][_0x1336('0x65')][_0x1ff36a],'OpenchannelQueueId':_0x3a352b['params']['id']});}return _0x5d8bca;});}})['then'](respondWithResult(_0x1e5717,null))[_0x1336('0x43')](handleError(_0x1e5717,null));};exports[_0x1336('0x84')]=function(_0x34d506,_0x2282f4,_0x46bad7){return db[_0x1336('0x41')][_0x1336('0x51')]({'where':{'id':_0x34d506[_0x1336('0x45')]['id']}})[_0x1336('0x23')](handleEntityNotFound(_0x2282f4,null))[_0x1336('0x23')](function(_0x523608){if(_0x523608){return _0x523608[_0x1336('0x84')](_0x34d506[_0x1336('0x32')][_0x1336('0x65')])['then'](function(){if(_['isArray'](_0x34d506[_0x1336('0x32')][_0x1336('0x65')])){for(var _0x1bbe02=0x0;_0x1bbe02<_0x34d506[_0x1336('0x32')][_0x1336('0x65')]['length'];_0x1bbe02+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x34d506['query']['ids'][_0x1bbe02]),'OpenchannelQueueId':Number(_0x34d506[_0x1336('0x45')]['id'])});}}else{socket['emit'](_0x1336('0x88'),{'UserId':Number(_0x34d506['query'][_0x1336('0x65')]),'OpenchannelQueueId':Number(_0x34d506[_0x1336('0x45')]['id'])});}});}})[_0x1336('0x23')](respondWithStatusCode(_0x2282f4,null))['catch'](handleError(_0x2282f4,null));};exports[_0x1336('0x89')]=function(_0x21bc0a,_0x41224b,_0x2a43c3){var _0x468b58={};var _0x1b0c28={};var _0x24d97d;var _0xdce833;return db[_0x1336('0x41')][_0x1336('0x54')]({'where':{'id':_0x21bc0a[_0x1336('0x45')]['id']}})[_0x1336('0x23')](handleEntityNotFound(_0x41224b,null))['then'](function(_0x332864){if(_0x332864){_0x24d97d=_0x332864;_0x1b0c28['model']=_[_0x1336('0x33')](db[_0x1336('0x5a')]['rawAttributes']);_0x1b0c28[_0x1336('0x32')]=_[_0x1336('0x33')](_0x21bc0a['query']);_0x1b0c28['filters']=_[_0x1336('0x46')](_0x1b0c28[_0x1336('0x30')],_0x1b0c28[_0x1336('0x32')]);_0x468b58['attributes']=_['intersection'](_0x1b0c28[_0x1336('0x30')],qs[_0x1336('0x35')](_0x21bc0a['query'][_0x1336('0x35')]));_0x468b58[_0x1336('0x36')]=_0x468b58[_0x1336('0x36')]['length']?_0x468b58['attributes']:_0x1b0c28[_0x1336('0x30')];_0x468b58[_0x1336('0x39')]=qs[_0x1336('0x3a')](_0x21bc0a[_0x1336('0x32')][_0x1336('0x3a')]);_0x468b58[_0x1336('0x3b')]=qs['filters'](_[_0x1336('0x3c')](_0x21bc0a[_0x1336('0x32')],_0x1b0c28[_0x1336('0x34')]));if(_0x21bc0a[_0x1336('0x32')][_0x1336('0x3f')]){_0x468b58[_0x1336('0x3b')]=_['merge'](_0x468b58[_0x1336('0x3b')],{'$or':_[_0x1336('0x31')](_0x468b58['attributes'],function(_0x3d8e2a){var _0x27dff4={};_0x27dff4[_0x3d8e2a]={'$like':'%'+_0x21bc0a[_0x1336('0x32')][_0x1336('0x3f')]+'%'};return _0x27dff4;})});}_0x468b58=_['merge']({},_0x468b58,_0x21bc0a[_0x1336('0x40')]);return _0x24d97d[_0x1336('0x89')](_0x468b58);}})[_0x1336('0x23')](function(_0x451556){if(_0x451556){_0xdce833=_0x451556[_0x1336('0x55')];if(!_0x21bc0a['query'][_0x1336('0x37')](_0x1336('0x56'))){_0x468b58['limit']=qs[_0x1336('0x38')](_0x21bc0a[_0x1336('0x32')][_0x1336('0x38')]);_0x468b58[_0x1336('0x1d')]=qs[_0x1336('0x1d')](_0x21bc0a[_0x1336('0x32')][_0x1336('0x1d')]);}return _0x24d97d[_0x1336('0x89')](_0x468b58);}})['then'](function(_0x565a74){if(_0x565a74){return _0x565a74?{'count':_0xdce833,'rows':_0x565a74}:null;}})[_0x1336('0x23')](respondWithResult(_0x41224b,null))[_0x1336('0x43')](handleError(_0x41224b,null));}; \ No newline at end of file +var _0x0c08=['removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','apply','reject','then','destroy','get','OpenchannelQueues','UserProfileResource','end','stack','name','map','OpenchannelQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','sort','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','Team','order','getTeams','addTeams','ids','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save'];(function(_0x1f5082,_0x3f878e){var _0x26cf61=function(_0x50ca3a){while(--_0x50ca3a){_0x1f5082['push'](_0x1f5082['shift']());}};_0x26cf61(++_0x3f878e);}(_0x0c08,0xa7));var _0x80c0=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x0c08[_0x4ded65];return _0x5864fb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x80c0('0x0'));var zipdir=require(_0x80c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x80c0('0x2'));var BPromise=require(_0x80c0('0x3'));var Mustache=require(_0x80c0('0x4'));var util=require(_0x80c0('0x5'));var path=require('path');var sox=require(_0x80c0('0x6'));var csv=require('to-csv');var ejs=require(_0x80c0('0x7'));var fs=require('fs');var _=require(_0x80c0('0x8'));var squel=require(_0x80c0('0x9'));var crypto=require('crypto');var jsforce=require(_0x80c0('0xa'));var deskjs=require(_0x80c0('0xb'));var toCsv=require(_0x80c0('0xc'));var querystring=require(_0x80c0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80c0('0xe'));var as=require(_0x80c0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80c0('0x10'));var utils=require('../../config/utils');var config=require(_0x80c0('0x11'));var db=require(_0x80c0('0x12'))['db'];config['redis']=_[_0x80c0('0x13')](config[_0x80c0('0x14')],{'host':_0x80c0('0x15'),'port':0x18eb});var socket=require(_0x80c0('0x16'))(new Redis(config[_0x80c0('0x14')]));require('./openchannelQueue.socket')[_0x80c0('0x17')](socket);function respondWithStatusCode(_0x1939c0,_0x36df13){_0x36df13=_0x36df13||0xcc;return function(_0xb0d7e0){if(_0xb0d7e0){return _0x1939c0[_0x80c0('0x18')](_0x36df13);}return _0x1939c0[_0x80c0('0x19')](_0x36df13)['end']();};}function respondWithResult(_0x3146e4,_0x389a10){_0x389a10=_0x389a10||0xc8;return function(_0x3970bb){if(_0x3970bb){return _0x3146e4[_0x80c0('0x19')](_0x389a10)[_0x80c0('0x1a')](_0x3970bb);}};}function respondWithFilteredResult(_0x1bbc98,_0x473270){return function(_0x283d2a){if(_0x283d2a){var _0x236078=_0x283d2a[_0x80c0('0x1b')],_0x1a8bc1=_0x473270[_0x80c0('0x1c')],_0x1bee8a=_0x473270[_0x80c0('0x1c')]+_0x473270[_0x80c0('0x1d')],_0x367a3d;if(_0x1bee8a>=_0x236078){_0x1bee8a=_0x236078;_0x367a3d=0xc8;}else{_0x367a3d=0xce;}_0x1bbc98['status'](_0x367a3d);return _0x1bbc98['set']('Content-Range',_0x1a8bc1+'-'+_0x1bee8a+'/'+_0x236078)[_0x80c0('0x1a')](_0x283d2a);}return null;};}function patchUpdates(_0x19506b){return function(_0x5efde9){try{jsonpatch[_0x80c0('0x1e')](_0x5efde9,_0x19506b,!![]);}catch(_0x53b258){return BPromise[_0x80c0('0x1f')](_0x53b258);}return _0x5efde9['save']();};}function saveUpdates(_0x297b5e,_0x58e05b){return function(_0x21e102){if(_0x21e102){return _0x21e102['update'](_0x297b5e)[_0x80c0('0x20')](function(_0x3a3081){return _0x3a3081;});}return null;};}function removeEntity(_0x19268f,_0x115ce1){return function(_0x3af7b1){if(_0x3af7b1){return _0x3af7b1[_0x80c0('0x21')]()['then'](function(){var _0xf58861=_0x3af7b1[_0x80c0('0x22')]({'plain':!![]});var _0x15fce1=_0x80c0('0x23');return db[_0x80c0('0x24')]['destroy']({'where':{'type':_0x15fce1,'resourceId':_0xf58861['id']}})[_0x80c0('0x20')](function(){return _0x3af7b1;});})[_0x80c0('0x20')](function(){_0x19268f[_0x80c0('0x19')](0xcc)[_0x80c0('0x25')]();});}};}function handleEntityNotFound(_0x384880,_0x324de3){return function(_0x41d8ec){if(!_0x41d8ec){_0x384880[_0x80c0('0x18')](0x194);}return _0x41d8ec;};}function handleError(_0x849687,_0x5f82b0){_0x5f82b0=_0x5f82b0||0x1f4;return function(_0x61a976){logger['error'](_0x61a976[_0x80c0('0x26')]);if(_0x61a976[_0x80c0('0x27')]){delete _0x61a976['name'];}_0x849687['status'](_0x5f82b0)['send'](_0x61a976);};}exports['index']=function(_0x690694,_0x75427a){var _0x1793bf={},_0x3498ad={},_0x4efbac={'count':0x0,'rows':[]};var _0x536bd3=_[_0x80c0('0x28')](db[_0x80c0('0x29')][_0x80c0('0x2a')],function(_0x38be8b){return{'name':_0x38be8b['fieldName'],'type':_0x38be8b['type'][_0x80c0('0x2b')]};});_0x3498ad[_0x80c0('0x2c')]=_[_0x80c0('0x28')](_0x536bd3,_0x80c0('0x27'));_0x3498ad[_0x80c0('0x2d')]=_[_0x80c0('0x2e')](_0x690694['query']);_0x3498ad[_0x80c0('0x2f')]=_[_0x80c0('0x30')](_0x3498ad['model'],_0x3498ad[_0x80c0('0x2d')]);_0x1793bf[_0x80c0('0x31')]=_[_0x80c0('0x30')](_0x3498ad[_0x80c0('0x2c')],qs['fields'](_0x690694['query'][_0x80c0('0x32')]));_0x1793bf[_0x80c0('0x31')]=_0x1793bf['attributes']['length']?_0x1793bf[_0x80c0('0x31')]:_0x3498ad['model'];if(!_0x690694[_0x80c0('0x2d')][_0x80c0('0x33')](_0x80c0('0x34'))){_0x1793bf[_0x80c0('0x1d')]=qs[_0x80c0('0x1d')](_0x690694['query']['limit']);_0x1793bf[_0x80c0('0x1c')]=qs[_0x80c0('0x1c')](_0x690694[_0x80c0('0x2d')][_0x80c0('0x1c')]);}_0x1793bf['order']=qs['sort'](_0x690694[_0x80c0('0x2d')]['sort']);_0x1793bf[_0x80c0('0x35')]=qs[_0x80c0('0x2f')](_[_0x80c0('0x36')](_0x690694[_0x80c0('0x2d')],_0x3498ad[_0x80c0('0x2f')]),_0x536bd3);if(_0x690694[_0x80c0('0x2d')][_0x80c0('0x37')]){_0x1793bf[_0x80c0('0x35')]=_[_0x80c0('0x38')](_0x1793bf['where'],{'$or':_[_0x80c0('0x28')](_0x536bd3,function(_0x168f30){if(_0x168f30[_0x80c0('0x39')]!==_0x80c0('0x3a')){var _0x174d9e={};_0x174d9e[_0x168f30['name']]={'$like':'%'+_0x690694[_0x80c0('0x2d')]['filter']+'%'};return _0x174d9e;}})});}_0x1793bf=_['merge']({},_0x1793bf,_0x690694[_0x80c0('0x3b')]);var _0x48081d={'where':_0x1793bf[_0x80c0('0x35')]};return db['OpenchannelQueue'][_0x80c0('0x1b')](_0x48081d)[_0x80c0('0x20')](function(_0x5793f6){_0x4efbac[_0x80c0('0x1b')]=_0x5793f6;if(_0x690694['query'][_0x80c0('0x3c')]){_0x1793bf[_0x80c0('0x3d')]=[{'all':!![]}];}return db[_0x80c0('0x29')][_0x80c0('0x3e')](_0x1793bf);})['then'](function(_0x2ab0df){_0x4efbac[_0x80c0('0x3f')]=_0x2ab0df;return _0x4efbac;})[_0x80c0('0x20')](respondWithFilteredResult(_0x75427a,_0x1793bf))[_0x80c0('0x40')](handleError(_0x75427a,null));};exports[_0x80c0('0x41')]=function(_0x3d2591,_0x3fb3e6){var _0x319faf={'raw':!![],'where':{'id':_0x3d2591[_0x80c0('0x42')]['id']}},_0x2905a9={};_0x2905a9[_0x80c0('0x2c')]=_['keys'](db[_0x80c0('0x29')][_0x80c0('0x2a')]);_0x2905a9[_0x80c0('0x2d')]=_[_0x80c0('0x2e')](_0x3d2591[_0x80c0('0x2d')]);_0x2905a9[_0x80c0('0x2f')]=_[_0x80c0('0x30')](_0x2905a9[_0x80c0('0x2c')],_0x2905a9[_0x80c0('0x2d')]);_0x319faf[_0x80c0('0x31')]=_[_0x80c0('0x30')](_0x2905a9[_0x80c0('0x2c')],qs[_0x80c0('0x32')](_0x3d2591[_0x80c0('0x2d')][_0x80c0('0x32')]));_0x319faf[_0x80c0('0x31')]=_0x319faf['attributes'][_0x80c0('0x43')]?_0x319faf[_0x80c0('0x31')]:_0x2905a9['model'];if(_0x3d2591[_0x80c0('0x2d')]['includeAll']){_0x319faf['include']=[{'all':!![]}];}_0x319faf=_[_0x80c0('0x38')]({},_0x319faf,_0x3d2591['options']);return db[_0x80c0('0x29')]['find'](_0x319faf)[_0x80c0('0x20')](handleEntityNotFound(_0x3fb3e6,null))[_0x80c0('0x20')](respondWithResult(_0x3fb3e6,null))[_0x80c0('0x40')](handleError(_0x3fb3e6,null));};exports['create']=function(_0x581738,_0x1e3ea0){return db[_0x80c0('0x29')][_0x80c0('0x44')](_0x581738[_0x80c0('0x45')],{})[_0x80c0('0x20')](function(_0x28d3de){var _0x215868=_0x581738[_0x80c0('0x46')][_0x80c0('0x22')]({'plain':!![]});if(!_0x215868)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x215868[_0x80c0('0x47')]===_0x80c0('0x46')){var _0x30514a=_0x28d3de[_0x80c0('0x22')]({'plain':!![]});var _0x1c36e2=_0x80c0('0x23');return db[_0x80c0('0x48')][_0x80c0('0x49')]({'where':{'name':_0x1c36e2,'userProfileId':_0x215868[_0x80c0('0x4a')]},'raw':!![]})['then'](function(_0x165219){if(_0x165219&&_0x165219[_0x80c0('0x4b')]===0x0){return db['UserProfileResource'][_0x80c0('0x44')]({'name':_0x30514a[_0x80c0('0x27')],'resourceId':_0x30514a['id'],'type':_0x165219[_0x80c0('0x27')],'sectionId':_0x165219['id']},{})[_0x80c0('0x20')](function(){return _0x28d3de;});}else{return _0x28d3de;}})[_0x80c0('0x40')](function(_0x5872f4){logger[_0x80c0('0x4c')](_0x80c0('0x4d'),_0x5872f4);throw _0x5872f4;});}return _0x28d3de;})['then'](respondWithResult(_0x1e3ea0,0xc9))['catch'](handleError(_0x1e3ea0,null));};exports[_0x80c0('0x4e')]=function(_0x20924c,_0x1a9362){if(_0x20924c[_0x80c0('0x45')]['id']){delete _0x20924c[_0x80c0('0x45')]['id'];}return db['OpenchannelQueue'][_0x80c0('0x49')]({'where':{'id':_0x20924c[_0x80c0('0x42')]['id']}})[_0x80c0('0x20')](handleEntityNotFound(_0x1a9362,null))[_0x80c0('0x20')](saveUpdates(_0x20924c[_0x80c0('0x45')],null))['then'](respondWithResult(_0x1a9362,null))[_0x80c0('0x40')](handleError(_0x1a9362,null));};exports['destroy']=function(_0xaf79d5,_0xd947ba){return db[_0x80c0('0x29')]['find']({'where':{'id':_0xaf79d5[_0x80c0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd947ba,null))['then'](removeEntity(_0xd947ba,null))[_0x80c0('0x40')](handleError(_0xd947ba,null));};exports[_0x80c0('0x4f')]=function(_0x544f78,_0x5e1d21){return db[_0x80c0('0x29')]['describe']()[_0x80c0('0x20')](respondWithResult(_0x5e1d21,null))['catch'](handleError(_0x5e1d21,null));};exports[_0x80c0('0x50')]=function(_0x27f87d,_0x25f3a0,_0x563f71){var _0x23e7e6={'raw':!![],'where':{}},_0x241fe9={},_0xac8689;return db[_0x80c0('0x29')][_0x80c0('0x51')]({'where':{'id':_0x27f87d['params']['id']}})['then'](handleEntityNotFound(_0x25f3a0,null))['then'](function(_0x5bbeaf){if(_0x5bbeaf){_0xac8689=_0x5bbeaf[_0x80c0('0x22')]({'plain':!![]});_0x241fe9[_0x80c0('0x2c')]=_[_0x80c0('0x2e')](db[_0x80c0('0x52')][_0x80c0('0x2a')]);_0x241fe9['query']=_[_0x80c0('0x2e')](_0x27f87d[_0x80c0('0x2d')]);_0x241fe9[_0x80c0('0x2f')]=_[_0x80c0('0x30')](_0x241fe9[_0x80c0('0x2c')],_0x241fe9['query']);_0x23e7e6[_0x80c0('0x31')]=_[_0x80c0('0x30')](_0x241fe9[_0x80c0('0x2c')],qs[_0x80c0('0x32')](_0x27f87d[_0x80c0('0x2d')][_0x80c0('0x32')]));_0x23e7e6['attributes']=_0x23e7e6[_0x80c0('0x31')][_0x80c0('0x43')]?_0x23e7e6[_0x80c0('0x31')]:_0x241fe9[_0x80c0('0x2c')];if(!_0x27f87d['query'][_0x80c0('0x33')](_0x80c0('0x34'))){_0x23e7e6['limit']=qs[_0x80c0('0x1d')](_0x27f87d['query']['limit']);_0x23e7e6[_0x80c0('0x1c')]=qs[_0x80c0('0x1c')](_0x27f87d[_0x80c0('0x2d')][_0x80c0('0x1c')]);}_0x23e7e6['order']=qs[_0x80c0('0x53')](_0x27f87d[_0x80c0('0x2d')][_0x80c0('0x53')]);_0x23e7e6['where']=qs[_0x80c0('0x2f')](_[_0x80c0('0x36')](_0x27f87d['query'],_0x241fe9[_0x80c0('0x2f')]));_0x23e7e6['where'][_0x80c0('0x54')]=_0x5bbeaf['id'];if(_0x27f87d[_0x80c0('0x2d')][_0x80c0('0x37')]){_0x23e7e6[_0x80c0('0x35')]=_[_0x80c0('0x38')](_0x23e7e6[_0x80c0('0x35')],{'$or':_[_0x80c0('0x28')](_0x23e7e6[_0x80c0('0x31')],function(_0x3772ae){var _0x2fec19={};_0x2fec19[_0x3772ae]={'$like':'%'+_0x27f87d[_0x80c0('0x2d')]['filter']+'%'};return _0x2fec19;})});}_0x23e7e6=_['merge']({},_0x23e7e6,_0x27f87d[_0x80c0('0x3b')]);return db[_0x80c0('0x52')][_0x80c0('0x3e')](_0x23e7e6);}})[_0x80c0('0x20')](function(_0x286d33){if(_0x286d33){return db['User'][_0x80c0('0x55')]({'where':{'id':_['map'](_0x286d33,_0x80c0('0x56')),'role':_0x80c0('0x57')},'attributes':['id','name',_0x80c0('0x58'),_0x80c0('0x59'),_0x80c0('0x5a')]});}})[_0x80c0('0x20')](function(_0x4cf60b){if(_0x4cf60b){return{'count':_0x4cf60b['count'],'rows':_[_0x80c0('0x28')](_0x4cf60b['rows'],function(_0x330954){return{'membername':_0x330954[_0x80c0('0x27')],'UserId':_0x330954['id'],'queue_name':_0xac8689[_0x80c0('0x27')],'OpenchannelQueueId':_0xac8689['id'],'interface':util[_0x80c0('0x5b')]('%s/%s',_0x80c0('0x5c'),_0x330954[_0x80c0('0x27')]),'penalty':0x0,'paused':_0x330954[_0x80c0('0x58')],'createdAt':_0x330954['createdAt'],'updatedAt':_0x330954[_0x80c0('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25f3a0,_0x23e7e6))[_0x80c0('0x40')](handleError(_0x25f3a0,null));};exports['getTeams']=function(_0x1cdac7,_0x3658fd,_0x59bd46){var _0x30fe9e={};var _0x59aaf6={};var _0x143382;var _0x5adf38;return db[_0x80c0('0x29')][_0x80c0('0x51')]({'where':{'id':_0x1cdac7[_0x80c0('0x42')]['id']}})[_0x80c0('0x20')](handleEntityNotFound(_0x3658fd,null))[_0x80c0('0x20')](function(_0x348066){if(_0x348066){_0x143382=_0x348066;_0x59aaf6[_0x80c0('0x2c')]=_[_0x80c0('0x2e')](db[_0x80c0('0x5d')][_0x80c0('0x2a')]);_0x59aaf6[_0x80c0('0x2d')]=_[_0x80c0('0x2e')](_0x1cdac7['query']);_0x59aaf6['filters']=_['intersection'](_0x59aaf6[_0x80c0('0x2c')],_0x59aaf6[_0x80c0('0x2d')]);_0x30fe9e['attributes']=_[_0x80c0('0x30')](_0x59aaf6[_0x80c0('0x2c')],qs['fields'](_0x1cdac7['query'][_0x80c0('0x32')]));_0x30fe9e[_0x80c0('0x31')]=_0x30fe9e[_0x80c0('0x31')][_0x80c0('0x43')]?_0x30fe9e[_0x80c0('0x31')]:_0x59aaf6[_0x80c0('0x2c')];_0x30fe9e[_0x80c0('0x5e')]=qs[_0x80c0('0x53')](_0x1cdac7[_0x80c0('0x2d')]['sort']);_0x30fe9e[_0x80c0('0x35')]=qs[_0x80c0('0x2f')](_[_0x80c0('0x36')](_0x1cdac7[_0x80c0('0x2d')],_0x59aaf6[_0x80c0('0x2f')]));if(_0x1cdac7['query'][_0x80c0('0x37')]){_0x30fe9e[_0x80c0('0x35')]=_[_0x80c0('0x38')](_0x30fe9e['where'],{'$or':_[_0x80c0('0x28')](_0x30fe9e[_0x80c0('0x31')],function(_0xf0414e){var _0x5de45={};_0x5de45[_0xf0414e]={'$like':'%'+_0x1cdac7[_0x80c0('0x2d')]['filter']+'%'};return _0x5de45;})});}_0x30fe9e=_['merge']({},_0x30fe9e,_0x1cdac7[_0x80c0('0x3b')]);return _0x143382['getTeams'](_0x30fe9e);}})[_0x80c0('0x20')](function(_0x50ec67){if(_0x50ec67){_0x5adf38=_0x50ec67[_0x80c0('0x43')];if(!_0x1cdac7[_0x80c0('0x2d')]['hasOwnProperty'](_0x80c0('0x34'))){_0x30fe9e['limit']=qs[_0x80c0('0x1d')](_0x1cdac7[_0x80c0('0x2d')][_0x80c0('0x1d')]);_0x30fe9e[_0x80c0('0x1c')]=qs[_0x80c0('0x1c')](_0x1cdac7[_0x80c0('0x2d')]['offset']);}return _0x143382[_0x80c0('0x5f')](_0x30fe9e);}})[_0x80c0('0x20')](function(_0x3f3ab8){if(_0x3f3ab8){return _0x3f3ab8?{'count':_0x5adf38,'rows':_0x3f3ab8}:null;}})[_0x80c0('0x20')](respondWithResult(_0x3658fd,null))[_0x80c0('0x40')](handleError(_0x3658fd,null));};exports[_0x80c0('0x60')]=function(_0x344ab1,_0xeeea2,_0x293e31){var _0x3b4f86=_0x344ab1[_0x80c0('0x45')][_0x80c0('0x61')];return db[_0x80c0('0x5d')][_0x80c0('0x3e')]({'where':{'id':_0x3b4f86},'attributes':['id'],'include':[{'model':db[_0x80c0('0x62')],'as':_0x80c0('0x63'),'attributes':['id','name',_0x80c0('0x64'),_0x80c0('0x65'),'interface'],'raw':!![]}]})[_0x80c0('0x20')](function(_0x5118b6){if(_0x5118b6){var _0x3dad4=_[_0x80c0('0x66')](_0x5118b6,function(_0x2b559b){var _0x5192c9=_0x2b559b[_0x80c0('0x22')]({'plain':!![]});return _0x5192c9[_0x80c0('0x63')];});return db[_0x80c0('0x29')][_0x80c0('0x49')]({'where':{'id':_0x344ab1[_0x80c0('0x42')]['id']}})[_0x80c0('0x20')](function(_0x547294){return db['sequelize'][_0x80c0('0x67')](function(_0x265326){return _0x547294['addTeams'](_0x3b4f86,{'transaction':_0x265326})[_0x80c0('0x20')](function(){return BPromise[_0x80c0('0x68')](_0x3dad4,function(_0x4364a0){return db[_0x80c0('0x52')][_0x80c0('0x69')]({'where':{'UserId':_0x4364a0['id'],'OpenchannelQueueId':_0x344ab1[_0x80c0('0x42')]['id']},'transaction':_0x265326});});})[_0x80c0('0x20')](function(){_0x3dad4[_0x80c0('0x6a')](function(_0x2a89b9){socket[_0x80c0('0x6b')](_0x80c0('0x6c'),{'UserId':_0x2a89b9['id'],'OpenchannelQueueId':_0x547294['id']});});});});});}})[_0x80c0('0x20')](respondWithStatusCode(_0xeeea2,null))[_0x80c0('0x40')](handleError(_0xeeea2,null));};exports[_0x80c0('0x6d')]=function(_0x38a82d,_0x1693fa,_0x199b00){return db[_0x80c0('0x5d')]['findAll']({'where':{'id':_0x38a82d[_0x80c0('0x2d')][_0x80c0('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x80c0('0x63'),'attributes':['id'],'raw':!![]}]})[_0x80c0('0x20')](handleEntityNotFound(_0x1693fa,null))['then'](function(_0x4e414e){var _0x135ab2=_['map'](_0x4e414e,'id');var _0x1ac07f=[];var _0x45f867=[];var _0x5a2a1f=squel[_0x80c0('0x6e')]();_0x5a2a1f['field'](_0x80c0('0x6f'))[_0x80c0('0x70')](_0x80c0('0x71'),'tq')[_0x80c0('0x72')](_0x80c0('0x73'),'ut',_0x80c0('0x74'))[_0x80c0('0x35')](_0x80c0('0x75'),_0x38a82d[_0x80c0('0x42')]['id']);for(var _0x36e965=0x0;_0x36e965<_0x4e414e[_0x80c0('0x43')];_0x36e965+=0x1){let _0x13378d=_0x4e414e[_0x36e965];for(var _0x26ca74=0x0;_0x26ca74<_0x13378d[_0x80c0('0x63')][_0x80c0('0x43')];_0x26ca74+=0x1){let _0xb090a5=_0x13378d[_0x80c0('0x63')][_0x26ca74];var _0xd00498=_0x5a2a1f[_0x80c0('0x76')]();_0xd00498[_0x80c0('0x35')](_0x80c0('0x77'),_0xb090a5['id']);_0x45f867[_0x80c0('0x78')](db[_0x80c0('0x79')][_0x80c0('0x2d')](_0xd00498[_0x80c0('0x7a')](),{'type':db[_0x80c0('0x79')][_0x80c0('0x7b')][_0x80c0('0x7c')]})[_0x80c0('0x20')](function(_0x127ec0){if(_0x127ec0[_0x80c0('0x43')]===0x1){return _0xb090a5['id'];}else{var _0x2b1f04=_[_0x80c0('0x7d')](_['map'](_0x127ec0,_0x80c0('0x7e')),function(_0x51bcc3){return _[_0x80c0('0x7f')](_0x135ab2,_0x51bcc3);});if(_0x2b1f04){return _0xb090a5['id'];}}}));}}return BPromise[_0x80c0('0x80')](_0x45f867)[_0x80c0('0x20')](function(_0x106b40){_0x1ac07f=_(_0x1ac07f)[_0x80c0('0x81')](_0x106b40)['compact']()[_0x80c0('0x82')]();return db['OpenchannelQueue'][_0x80c0('0x49')]({'where':{'id':_0x38a82d[_0x80c0('0x42')]['id']}})['then'](function(_0x37fcb0){return db[_0x80c0('0x79')]['transaction'](function(_0x4e731c){return _0x37fcb0[_0x80c0('0x6d')](_0x38a82d['query'][_0x80c0('0x61')],{'transaction':_0x4e731c})[_0x80c0('0x20')](function(){if(!_[_0x80c0('0x83')](_0x1ac07f)){return _0x37fcb0[_0x80c0('0x84')](_0x1ac07f,{'transaction':_0x4e731c});}})[_0x80c0('0x20')](function(){_0x1ac07f[_0x80c0('0x6a')](function(_0x14efd6){socket[_0x80c0('0x6b')]('userOpenchannelQueue:remove',{'UserId':_0x14efd6,'OpenchannelQueueId':_0x37fcb0['id']});});});});});});})[_0x80c0('0x20')](respondWithStatusCode(_0x1693fa,null))[_0x80c0('0x40')](handleError(_0x1693fa,null));};exports[_0x80c0('0x85')]=function(_0x481921,_0xcea78d,_0x118d43){return db[_0x80c0('0x29')][_0x80c0('0x49')]({'where':{'id':_0x481921[_0x80c0('0x42')]['id']}})['then'](handleEntityNotFound(_0xcea78d,null))[_0x80c0('0x20')](function(_0x5874c0){if(_0x5874c0){return _0x5874c0[_0x80c0('0x85')](_0x481921[_0x80c0('0x45')][_0x80c0('0x61')],_[_0x80c0('0x86')](_0x481921['body'],[_0x80c0('0x61'),'id'])||{})[_0x80c0('0x87')](function(_0x1209ba){for(var _0x5f58c6=0x0;_0x5f58c6<_0x481921['body'][_0x80c0('0x61')][_0x80c0('0x43')];_0x5f58c6+=0x1){socket[_0x80c0('0x6b')](_0x80c0('0x6c'),{'UserId':_0x481921[_0x80c0('0x45')]['ids'][_0x5f58c6],'OpenchannelQueueId':_0x481921[_0x80c0('0x42')]['id']});}return _0x1209ba;});}})[_0x80c0('0x20')](respondWithResult(_0xcea78d,null))[_0x80c0('0x40')](handleError(_0xcea78d,null));};exports[_0x80c0('0x84')]=function(_0x59a4d0,_0xb601fc,_0x41788e){return db['OpenchannelQueue']['find']({'where':{'id':_0x59a4d0[_0x80c0('0x42')]['id']}})[_0x80c0('0x20')](handleEntityNotFound(_0xb601fc,null))[_0x80c0('0x20')](function(_0x1889f8){if(_0x1889f8){return _0x1889f8[_0x80c0('0x84')](_0x59a4d0[_0x80c0('0x2d')][_0x80c0('0x61')])[_0x80c0('0x20')](function(){if(_[_0x80c0('0x88')](_0x59a4d0[_0x80c0('0x2d')]['ids'])){for(var _0x4a17a1=0x0;_0x4a17a1<_0x59a4d0[_0x80c0('0x2d')][_0x80c0('0x61')][_0x80c0('0x43')];_0x4a17a1+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x59a4d0[_0x80c0('0x2d')][_0x80c0('0x61')][_0x4a17a1]),'OpenchannelQueueId':Number(_0x59a4d0['params']['id'])});}}else{socket[_0x80c0('0x6b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x59a4d0[_0x80c0('0x2d')][_0x80c0('0x61')]),'OpenchannelQueueId':Number(_0x59a4d0[_0x80c0('0x42')]['id'])});}});}})['then'](respondWithStatusCode(_0xb601fc,null))[_0x80c0('0x40')](handleError(_0xb601fc,null));};exports[_0x80c0('0x89')]=function(_0x10a0cb,_0x1085c3,_0x504b0c){var _0x8d03e6={};var _0x5adf33={};var _0x43f868;var _0xad81;return db[_0x80c0('0x29')][_0x80c0('0x51')]({'where':{'id':_0x10a0cb['params']['id']}})[_0x80c0('0x20')](handleEntityNotFound(_0x1085c3,null))[_0x80c0('0x20')](function(_0x29fb48){if(_0x29fb48){_0x43f868=_0x29fb48;_0x5adf33[_0x80c0('0x2c')]=_[_0x80c0('0x2e')](db[_0x80c0('0x62')][_0x80c0('0x2a')]);_0x5adf33[_0x80c0('0x2d')]=_['keys'](_0x10a0cb[_0x80c0('0x2d')]);_0x5adf33['filters']=_['intersection'](_0x5adf33[_0x80c0('0x2c')],_0x5adf33[_0x80c0('0x2d')]);_0x8d03e6[_0x80c0('0x31')]=_[_0x80c0('0x30')](_0x5adf33[_0x80c0('0x2c')],qs[_0x80c0('0x32')](_0x10a0cb[_0x80c0('0x2d')][_0x80c0('0x32')]));_0x8d03e6['attributes']=_0x8d03e6[_0x80c0('0x31')][_0x80c0('0x43')]?_0x8d03e6[_0x80c0('0x31')]:_0x5adf33[_0x80c0('0x2c')];_0x8d03e6[_0x80c0('0x5e')]=qs[_0x80c0('0x53')](_0x10a0cb['query']['sort']);_0x8d03e6[_0x80c0('0x35')]=qs['filters'](_[_0x80c0('0x36')](_0x10a0cb[_0x80c0('0x2d')],_0x5adf33[_0x80c0('0x2f')]));if(_0x10a0cb[_0x80c0('0x2d')][_0x80c0('0x37')]){_0x8d03e6[_0x80c0('0x35')]=_['merge'](_0x8d03e6['where'],{'$or':_[_0x80c0('0x28')](_0x8d03e6[_0x80c0('0x31')],function(_0xd467fb){var _0xed80a8={};_0xed80a8[_0xd467fb]={'$like':'%'+_0x10a0cb[_0x80c0('0x2d')]['filter']+'%'};return _0xed80a8;})});}_0x8d03e6=_['merge']({},_0x8d03e6,_0x10a0cb['options']);return _0x43f868['getAgents'](_0x8d03e6);}})[_0x80c0('0x20')](function(_0x332b62){if(_0x332b62){_0xad81=_0x332b62[_0x80c0('0x43')];if(!_0x10a0cb[_0x80c0('0x2d')][_0x80c0('0x33')](_0x80c0('0x34'))){_0x8d03e6[_0x80c0('0x1d')]=qs[_0x80c0('0x1d')](_0x10a0cb[_0x80c0('0x2d')][_0x80c0('0x1d')]);_0x8d03e6[_0x80c0('0x1c')]=qs[_0x80c0('0x1c')](_0x10a0cb[_0x80c0('0x2d')][_0x80c0('0x1c')]);}return _0x43f868[_0x80c0('0x89')](_0x8d03e6);}})[_0x80c0('0x20')](function(_0x97524c){if(_0x97524c){return _0x97524c?{'count':_0xad81,'rows':_0x97524c}:null;}})[_0x80c0('0x20')](respondWithResult(_0x1085c3,null))[_0x80c0('0x40')](handleError(_0x1085c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d38eac6..f45ae21 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 _0x842e=['emit','hasOwnProperty','events','../../mysqldb','save','update'];(function(_0x3611c8,_0x5b0a33){var _0x5ae5e4=function(_0xd1e93e){while(--_0xd1e93e){_0x3611c8['push'](_0x3611c8['shift']());}};_0x5ae5e4(++_0x5b0a33);}(_0x842e,0x1ee));var _0xe842=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x842e[_0x323d87];return _0x5e8f74;};'use strict';var EventEmitter=require(_0xe842('0x0'));var OpenchannelQueue=require(_0xe842('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe842('0x2'),'afterUpdate':_0xe842('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5142cf){return function(_0x39d115,_0x50b597,_0x34fda7){OpenchannelQueueEvents['emit'](_0x5142cf+':'+_0x39d115['id'],_0x39d115);OpenchannelQueueEvents[_0xe842('0x4')](_0x5142cf,_0x39d115);_0x34fda7(null);};}for(var e in events){if(events[_0xe842('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xc5b1=['hasOwnProperty','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x50eef1,_0x34449f){var _0x5bf1b1=function(_0x18d07e){while(--_0x18d07e){_0x50eef1['push'](_0x50eef1['shift']());}};_0x5bf1b1(++_0x34449f);}(_0xc5b1,0x12b));var _0x1c5b=function(_0x2ec880,_0x544860){_0x2ec880=_0x2ec880-0x0;var _0x1ef1f0=_0xc5b1[_0x2ec880];return _0x1ef1f0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1c5b('0x0'))['db'][_0x1c5b('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1c5b('0x2')](0x0);var events={'afterCreate':_0x1c5b('0x3'),'afterUpdate':_0x1c5b('0x4'),'afterDestroy':_0x1c5b('0x5')};function emitEvent(_0x1b8883){return function(_0x1211f9,_0x471bb6,_0x6f15d7){OpenchannelQueueEvents['emit'](_0x1b8883+':'+_0x1211f9['id'],_0x1211f9);OpenchannelQueueEvents[_0x1c5b('0x6')](_0x1b8883,_0x1211f9);_0x6f15d7(null);};}for(var e in events){if(events[_0x1c5b('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x1c5b('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 4333ade..c22df2f 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 _0xaf24=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x56574a,_0x230873){var _0x3b9fed=function(_0x482dbc){while(--_0x482dbc){_0x56574a['push'](_0x56574a['shift']());}};_0x3b9fed(++_0x230873);}(_0xaf24,0x1ac));var _0x4af2=function(_0x14e8ea,_0x345ea1){_0x14e8ea=_0x14e8ea-0x0;var _0x40e001=_0xaf24[_0x14e8ea];return _0x40e001;};'use strict';var _=require(_0x4af2('0x0'));var util=require(_0x4af2('0x1'));var logger=require(_0x4af2('0x2'))(_0x4af2('0x3'));var moment=require('moment');var BPromise=require(_0x4af2('0x4'));var rp=require(_0x4af2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4af2('0x6'));var config=require(_0x4af2('0x7'));var attributes=require(_0x4af2('0x8'));module[_0x4af2('0x9')]=function(_0x5185ef,_0x311b5d){return _0x5185ef[_0x4af2('0xa')](_0x4af2('0xb'),attributes,{'tableName':_0x4af2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e7a=['lodash','util','../../config/logger','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x6e7a,0xdc));var _0xa6e7=function(_0x2b9607,_0x3b5e1d){_0x2b9607=_0x2b9607-0x0;var _0x3044eb=_0x6e7a[_0x2b9607];return _0x3044eb;};'use strict';var _=require(_0xa6e7('0x0'));var util=require(_0xa6e7('0x1'));var logger=require(_0xa6e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa6e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6e7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa6e7('0x5'));module[_0xa6e7('0x6')]=function(_0x152abc,_0x5bf033){return _0x152abc[_0xa6e7('0x7')](_0xa6e7('0x8'),attributes,{'tableName':_0xa6e7('0x9'),'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 817e50e..3d95266 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 _0x278e=['request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','findAll','options','raw','limit','include','map','attributes','model','catch','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x278e,0x169));var _0xe278=function(_0x13b04a,_0x49b3fc){_0x13b04a=_0x13b04a-0x0;var _0x5db6c8=_0x278e[_0x13b04a];return _0x5db6c8;};'use strict';var _=require(_0xe278('0x0'));var util=require(_0xe278('0x1'));var moment=require(_0xe278('0x2'));var BPromise=require('bluebird');var rs=require(_0xe278('0x3'));var fs=require('fs');var Redis=require(_0xe278('0x4'));var db=require(_0xe278('0x5'))['db'];var utils=require(_0xe278('0x6'));var logger=require(_0xe278('0x7'))(_0xe278('0x8'));var config=require('../../config/environment');var jayson=require(_0xe278('0x9'));var client=jayson[_0xe278('0xa')][_0xe278('0xb')]({'port':0x232a});config[_0xe278('0xc')]=_[_0xe278('0xd')](config[_0xe278('0xc')],{'host':_0xe278('0xe'),'port':0x18eb});var socket=require(_0xe278('0xf'))(new Redis(config[_0xe278('0xc')]));require(_0xe278('0x10'))['register'](socket);function respondWithRpcPromise(_0x32dc28,_0x3eeaf5,_0x24351b){return new BPromise(function(_0x211f2e,_0x34d97d){return client[_0xe278('0x11')](_0x32dc28,_0x24351b)[_0xe278('0x12')](function(_0x51de88){logger[_0xe278('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x3eeaf5,_0xe278('0x14'));logger[_0xe278('0x15')](_0xe278('0x16'),_0x3eeaf5,_0xe278('0x14'),JSON[_0xe278('0x17')](_0x51de88));if(_0x51de88[_0xe278('0x18')]){if(_0x51de88[_0xe278('0x18')][_0xe278('0x19')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3eeaf5,_0x51de88[_0xe278('0x18')]['message']);return _0x34d97d(_0x51de88[_0xe278('0x18')][_0xe278('0x1a')]);}logger['error'](_0xe278('0x1b'),_0x3eeaf5,_0x51de88[_0xe278('0x18')]['message']);return _0x211f2e(_0x51de88[_0xe278('0x18')]['message']);}else{logger[_0xe278('0x13')](_0xe278('0x1b'),_0x3eeaf5,_0xe278('0x14'));_0x211f2e(_0x51de88[_0xe278('0x1c')]['message']);}})['catch'](function(_0x5ed78c){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3eeaf5,_0x5ed78c);_0x34d97d(_0x5ed78c);});});}exports[_0xe278('0x1d')]=function(_0x84ebf1){var _0x485e75=this;return new Promise(function(_0x21961c,_0x37c39b){return db['OpenchannelQueue'][_0xe278('0x1e')]({'raw':_0x84ebf1[_0xe278('0x1f')]?_0x84ebf1[_0xe278('0x1f')][_0xe278('0x20')]===undefined?!![]:![]:!![],'where':_0x84ebf1[_0xe278('0x1f')]?_0x84ebf1['options']['where']||null:null,'attributes':_0x84ebf1[_0xe278('0x1f')]?_0x84ebf1['options']['attributes']||null:null,'limit':_0x84ebf1[_0xe278('0x1f')]?_0x84ebf1[_0xe278('0x1f')][_0xe278('0x21')]||null:null,'include':_0x84ebf1[_0xe278('0x1f')]?_0x84ebf1[_0xe278('0x1f')][_0xe278('0x22')]?_[_0xe278('0x23')](_0x84ebf1[_0xe278('0x1f')][_0xe278('0x22')],function(_0x430e4e){return{'model':db[_0x430e4e['model']],'as':_0x430e4e['as'],'attributes':_0x430e4e[_0xe278('0x24')],'include':_0x430e4e[_0xe278('0x22')]?_[_0xe278('0x23')](_0x430e4e[_0xe278('0x22')],function(_0x28f213){return{'model':db[_0x28f213[_0xe278('0x25')]],'as':_0x28f213['as'],'attributes':_0x28f213[_0xe278('0x24')],'include':_0x28f213[_0xe278('0x22')]?_[_0xe278('0x23')](_0x28f213[_0xe278('0x22')],function(_0x47f868){return{'model':db[_0x47f868[_0xe278('0x25')]],'as':_0x47f868['as'],'attributes':_0x47f868[_0xe278('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb2ae){logger[_0xe278('0x13')]('GetOpenchannelQueue',_0x84ebf1);logger[_0xe278('0x15')](_0xe278('0x1d'),_0x84ebf1,JSON[_0xe278('0x17')](_0x4bb2ae));_0x21961c(_0x4bb2ae);})[_0xe278('0x26')](function(_0xcd9ff6){logger[_0xe278('0x18')](_0xe278('0x1d'),_0xcd9ff6[_0xe278('0x1a')],_0x84ebf1);_0x37c39b(_0x485e75[_0xe278('0x18')](0x1f4,_0xcd9ff6[_0xe278('0x1a')]));});});};exports[_0xe278('0x27')]=function(_0xa6f5e5){var _0x5bc921=this;return new Promise(function(_0xbd8abf,_0x3f98ad){return db[_0xe278('0x28')][_0xe278('0x29')]({'raw':_0xa6f5e5[_0xe278('0x1f')]?_0xa6f5e5[_0xe278('0x1f')][_0xe278('0x20')]===undefined?!![]:![]:!![],'where':_0xa6f5e5['options']?_0xa6f5e5[_0xe278('0x1f')]['where']||null:null,'attributes':_0xa6f5e5[_0xe278('0x1f')]?_0xa6f5e5['options'][_0xe278('0x24')]||null:null,'include':_0xa6f5e5[_0xe278('0x1f')]?_0xa6f5e5[_0xe278('0x1f')][_0xe278('0x22')]?_['map'](_0xa6f5e5[_0xe278('0x1f')][_0xe278('0x22')],function(_0x4b8a83){return{'model':db[_0x4b8a83[_0xe278('0x25')]],'as':_0x4b8a83['as'],'attributes':_0x4b8a83['attributes'],'include':_0x4b8a83[_0xe278('0x22')]?_[_0xe278('0x23')](_0x4b8a83[_0xe278('0x22')],function(_0x42df02){return{'model':db[_0x42df02[_0xe278('0x25')]],'as':_0x42df02['as'],'attributes':_0x42df02['attributes'],'include':_0x42df02[_0xe278('0x22')]?_[_0xe278('0x23')](_0x42df02['include'],function(_0x1414ef){return{'model':db[_0x1414ef['model']],'as':_0x1414ef['as'],'attributes':_0x1414ef[_0xe278('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe278('0x12')](function(_0x1b4bc6){logger[_0xe278('0x13')](_0xe278('0x27'),_0xa6f5e5);logger[_0xe278('0x15')]('ShowOpenchannelQueue',_0xa6f5e5,JSON[_0xe278('0x17')](_0x1b4bc6));_0xbd8abf(_0x1b4bc6);})[_0xe278('0x26')](function(_0xdb36d5){logger['error']('ShowOpenchannelQueue',_0xdb36d5[_0xe278('0x1a')],_0xa6f5e5);_0x3f98ad(_0x5bc921[_0xe278('0x18')](0x1f4,_0xdb36d5[_0xe278('0x1a')]));});});}; \ No newline at end of file +var _0x6804=['http','redis','localhost','socket.io-emitter','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x152753,_0x5668d8){var _0x58f94f=function(_0x42ecbe){while(--_0x42ecbe){_0x152753['push'](_0x152753['shift']());}};_0x58f94f(++_0x5668d8);}(_0x6804,0x162));var _0x4680=function(_0x1fe52a,_0x25075c){_0x1fe52a=_0x1fe52a-0x0;var _0x24e7e3=_0x6804[_0x1fe52a];return _0x24e7e3;};'use strict';var _=require('lodash');var util=require(_0x4680('0x0'));var moment=require(_0x4680('0x1'));var BPromise=require(_0x4680('0x2'));var rs=require(_0x4680('0x3'));var fs=require('fs');var Redis=require(_0x4680('0x4'));var db=require(_0x4680('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4680('0x6'))('rpc');var config=require(_0x4680('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4680('0x8')][_0x4680('0x9')]({'port':0x232a});config[_0x4680('0xa')]=_['defaults'](config[_0x4680('0xa')],{'host':_0x4680('0xb'),'port':0x18eb});var socket=require(_0x4680('0xc'))(new Redis(config[_0x4680('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2955f7,_0x3c17fb,_0x2369e3){return new BPromise(function(_0x123e10,_0x57d567){return client['request'](_0x2955f7,_0x2369e3)[_0x4680('0xd')](function(_0x49cb1f){logger['info'](_0x4680('0xe'),_0x3c17fb,_0x4680('0xf'));logger[_0x4680('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3c17fb,_0x4680('0xf'),JSON[_0x4680('0x11')](_0x49cb1f));if(_0x49cb1f[_0x4680('0x12')]){if(_0x49cb1f[_0x4680('0x12')]['code']===0x1f4){logger[_0x4680('0x12')](_0x4680('0xe'),_0x3c17fb,_0x49cb1f[_0x4680('0x12')][_0x4680('0x13')]);return _0x57d567(_0x49cb1f[_0x4680('0x12')]['message']);}logger[_0x4680('0x12')](_0x4680('0xe'),_0x3c17fb,_0x49cb1f[_0x4680('0x12')][_0x4680('0x13')]);return _0x123e10(_0x49cb1f[_0x4680('0x12')][_0x4680('0x13')]);}else{logger['info'](_0x4680('0xe'),_0x3c17fb,_0x4680('0xf'));_0x123e10(_0x49cb1f[_0x4680('0x14')]['message']);}})[_0x4680('0x15')](function(_0x4d02d8){logger[_0x4680('0x12')](_0x4680('0xe'),_0x3c17fb,_0x4d02d8);_0x57d567(_0x4d02d8);});});}exports['GetOpenchannelQueue']=function(_0x2dcb3d){var _0x39e768=this;return new Promise(function(_0x28f5fc,_0x4c0518){return db['OpenchannelQueue'][_0x4680('0x16')]({'raw':_0x2dcb3d[_0x4680('0x17')]?_0x2dcb3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dcb3d['options']?_0x2dcb3d['options'][_0x4680('0x18')]||null:null,'attributes':_0x2dcb3d['options']?_0x2dcb3d[_0x4680('0x17')][_0x4680('0x19')]||null:null,'limit':_0x2dcb3d[_0x4680('0x17')]?_0x2dcb3d[_0x4680('0x17')][_0x4680('0x1a')]||null:null,'include':_0x2dcb3d[_0x4680('0x17')]?_0x2dcb3d['options'][_0x4680('0x1b')]?_[_0x4680('0x1c')](_0x2dcb3d['options'][_0x4680('0x1b')],function(_0x434d53){return{'model':db[_0x434d53[_0x4680('0x1d')]],'as':_0x434d53['as'],'attributes':_0x434d53[_0x4680('0x19')],'include':_0x434d53[_0x4680('0x1b')]?_['map'](_0x434d53['include'],function(_0x494cd7){return{'model':db[_0x494cd7[_0x4680('0x1d')]],'as':_0x494cd7['as'],'attributes':_0x494cd7[_0x4680('0x19')],'include':_0x494cd7[_0x4680('0x1b')]?_['map'](_0x494cd7[_0x4680('0x1b')],function(_0x158691){return{'model':db[_0x158691[_0x4680('0x1d')]],'as':_0x158691['as'],'attributes':_0x158691[_0x4680('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4680('0xd')](function(_0x12411e){logger['info'](_0x4680('0x1e'),_0x2dcb3d);logger[_0x4680('0x10')](_0x4680('0x1e'),_0x2dcb3d,JSON[_0x4680('0x11')](_0x12411e));_0x28f5fc(_0x12411e);})[_0x4680('0x15')](function(_0x2806b2){logger['error'](_0x4680('0x1e'),_0x2806b2['message'],_0x2dcb3d);_0x4c0518(_0x39e768[_0x4680('0x12')](0x1f4,_0x2806b2[_0x4680('0x13')]));});});};exports[_0x4680('0x1f')]=function(_0x200d0b){var _0x16f865=this;return new Promise(function(_0x3f0097,_0x229559){return db['OpenchannelQueue']['find']({'raw':_0x200d0b['options']?_0x200d0b[_0x4680('0x17')][_0x4680('0x20')]===undefined?!![]:![]:!![],'where':_0x200d0b[_0x4680('0x17')]?_0x200d0b[_0x4680('0x17')][_0x4680('0x18')]||null:null,'attributes':_0x200d0b[_0x4680('0x17')]?_0x200d0b[_0x4680('0x17')]['attributes']||null:null,'include':_0x200d0b['options']?_0x200d0b['options'][_0x4680('0x1b')]?_[_0x4680('0x1c')](_0x200d0b['options'][_0x4680('0x1b')],function(_0x3ffe1b){return{'model':db[_0x3ffe1b[_0x4680('0x1d')]],'as':_0x3ffe1b['as'],'attributes':_0x3ffe1b['attributes'],'include':_0x3ffe1b[_0x4680('0x1b')]?_[_0x4680('0x1c')](_0x3ffe1b['include'],function(_0x306116){return{'model':db[_0x306116[_0x4680('0x1d')]],'as':_0x306116['as'],'attributes':_0x306116['attributes'],'include':_0x306116[_0x4680('0x1b')]?_[_0x4680('0x1c')](_0x306116[_0x4680('0x1b')],function(_0x1b0dc8){return{'model':db[_0x1b0dc8[_0x4680('0x1d')]],'as':_0x1b0dc8['as'],'attributes':_0x1b0dc8[_0x4680('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c047b){logger['info'](_0x4680('0x1f'),_0x200d0b);logger[_0x4680('0x10')](_0x4680('0x1f'),_0x200d0b,JSON[_0x4680('0x11')](_0x5c047b));_0x3f0097(_0x5c047b);})[_0x4680('0x15')](function(_0x54254b){logger[_0x4680('0x12')](_0x4680('0x1f'),_0x54254b[_0x4680('0x13')],_0x200d0b);_0x229559(_0x16f865['error'](0x1f4,_0x54254b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1f0ead4..b9fc46a 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 _0xaebd=['update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xaebd,0xd5));var _0xdaeb=function(_0x17b460,_0x4bb923){_0x17b460=_0x17b460-0x0;var _0x5e15a7=_0xaebd[_0x17b460];return _0x5e15a7;};'use strict';var OpenchannelQueueEvents=require(_0xdaeb('0x0'));var events=[_0xdaeb('0x1'),_0xdaeb('0x2'),_0xdaeb('0x3')];function createListener(_0x43acba,_0x3b15bd){return function(_0x2280b3){_0x3b15bd[_0xdaeb('0x4')](_0x43acba,_0x2280b3);};}function removeListener(_0x20f6ff,_0x511be9){return function(){OpenchannelQueueEvents[_0xdaeb('0x5')](_0x20f6ff,_0x511be9);};}exports[_0xdaeb('0x6')]=function(_0x15e568){for(var _0x3e9e72=0x0,_0x5651e5=events['length'];_0x3e9e72<_0x5651e5;_0x3e9e72++){var _0x3078a7=events[_0x3e9e72];var _0x4378aa=createListener(_0xdaeb('0x7')+_0x3078a7,_0x15e568);OpenchannelQueueEvents['on'](_0x3078a7,_0x4378aa);}}; \ No newline at end of file +var _0x4d85=['save','update','emit','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x54eaee,_0x157645){var _0x51ff43=function(_0x333547){while(--_0x333547){_0x54eaee['push'](_0x54eaee['shift']());}};_0x51ff43(++_0x157645);}(_0x4d85,0xc5));var _0x54d8=function(_0x497880,_0x430dbc){_0x497880=_0x497880-0x0;var _0x1a3d4b=_0x4d85[_0x497880];return _0x1a3d4b;};'use strict';var OpenchannelQueueEvents=require(_0x54d8('0x0'));var events=[_0x54d8('0x1'),'remove',_0x54d8('0x2')];function createListener(_0x5b0f2d,_0x12aefd){return function(_0x5efece){_0x12aefd[_0x54d8('0x3')](_0x5b0f2d,_0x5efece);};}function removeListener(_0x2cbb47,_0x1460c3){return function(){OpenchannelQueueEvents['removeListener'](_0x2cbb47,_0x1460c3);};}exports[_0x54d8('0x4')]=function(_0x14dc15){for(var _0xf3ad8=0x0,_0x4ef727=events['length'];_0xf3ad8<_0x4ef727;_0xf3ad8++){var _0x2a2529=events[_0xf3ad8];var _0x3fca1f=createListener(_0x54d8('0x5')+_0x2a2529,_0x14dc15);OpenchannelQueueEvents['on'](_0x2a2529,_0x3fca1f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 99b0420..013617d 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 _0xfb7a=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c1492,_0x568460){var _0x31ab98=function(_0x5f333e){while(--_0x5f333e){_0x1c1492['push'](_0x1c1492['shift']());}};_0x31ab98(++_0x568460);}(_0xfb7a,0x98));var _0xafb7=function(_0x306106,_0x7dc50d){_0x306106=_0x306106-0x0;var _0x4d6083=_0xfb7a[_0x306106];return _0x4d6083;};'use strict';var multer=require(_0xafb7('0x0'));var util=require(_0xafb7('0x1'));var path=require('path');var timeout=require(_0xafb7('0x2'));var express=require(_0xafb7('0x3'));var router=express[_0xafb7('0x4')]();var auth=require(_0xafb7('0x5'));var interaction=require(_0xafb7('0x6'));var config=require(_0xafb7('0x7'));var controller=require(_0xafb7('0x8'));router[_0xafb7('0x9')]('/',auth[_0xafb7('0xa')](),controller[_0xafb7('0xb')]);router[_0xafb7('0x9')](_0xafb7('0xc'),auth['isAuthenticated'](),controller[_0xafb7('0xd')]);router[_0xafb7('0x9')](_0xafb7('0xe'),auth[_0xafb7('0xa')](),controller[_0xafb7('0xf')]);router['post']('/',auth[_0xafb7('0xa')](),controller[_0xafb7('0x10')]);router[_0xafb7('0x11')](_0xafb7('0xe'),auth[_0xafb7('0xa')](),controller[_0xafb7('0x12')]);router['delete'](_0xafb7('0xe'),auth[_0xafb7('0xa')](),controller['destroy']);module[_0xafb7('0x13')]=router; \ No newline at end of file +var _0x8461=['./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xd9c85a,_0x4b7bb9){var _0x3380be=function(_0x405ed){while(--_0x405ed){_0xd9c85a['push'](_0xd9c85a['shift']());}};_0x3380be(++_0x4b7bb9);}(_0x8461,0xbe));var _0x1846=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0x8461[_0x4b14bb];return _0x285200;};'use strict';var multer=require(_0x1846('0x0'));var util=require(_0x1846('0x1'));var path=require(_0x1846('0x2'));var timeout=require(_0x1846('0x3'));var express=require(_0x1846('0x4'));var router=express[_0x1846('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1846('0x6'));var config=require(_0x1846('0x7'));var controller=require(_0x1846('0x8'));router[_0x1846('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1846('0x9')]('/describe',auth[_0x1846('0xa')](),controller[_0x1846('0xb')]);router['get'](_0x1846('0xc'),auth['isAuthenticated'](),controller[_0x1846('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1846('0xe')]);router['put'](_0x1846('0xc'),auth['isAuthenticated'](),controller[_0x1846('0xf')]);router['delete'](_0x1846('0xc'),auth[_0x1846('0xa')](),controller[_0x1846('0x10')]);module[_0x1846('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index dd53596..8a89d73 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 _0xa23f=['DATE','moment','exports','STRING'];(function(_0x17a302,_0x3760d5){var _0x364ad9=function(_0x33149b){while(--_0x33149b){_0x17a302['push'](_0x17a302['shift']());}};_0x364ad9(++_0x3760d5);}(_0xa23f,0x12d));var _0xfa23=function(_0x274706,_0x2857e2){_0x274706=_0x274706-0x0;var _0x24bccf=_0xa23f[_0x274706];return _0x24bccf;};'use strict';var moment=require(_0xfa23('0x0'));var Sequelize=require('sequelize');module[_0xfa23('0x1')]={'uniqueid':{'type':Sequelize[_0xfa23('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfa23('0x2')]},'joinAt':{'type':Sequelize[_0xfa23('0x3')]},'leaveAt':{'type':Sequelize[_0xfa23('0x3')]},'acceptAt':{'type':Sequelize[_0xfa23('0x3')]},'exitAt':{'type':Sequelize[_0xfa23('0x3')]},'reason':{'type':Sequelize[_0xfa23('0x2')]}}; \ No newline at end of file +var _0x2994=['STRING','DATE','moment','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2994,0x188));var _0x4299=function(_0x3a3c3d,_0x3b8542){_0x3a3c3d=_0x3a3c3d-0x0;var _0xf3142f=_0x2994[_0x3a3c3d];return _0xf3142f;};'use strict';var moment=require(_0x4299('0x0'));var Sequelize=require(_0x4299('0x1'));module[_0x4299('0x2')]={'uniqueid':{'type':Sequelize[_0x4299('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4299('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4299('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4299('0x4')]},'reason':{'type':Sequelize[_0x4299('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f4024f6..743b24d 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 _0xd2f3=['filter','type','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2f3,0x169));var _0x3d2f=function(_0x55bc7a,_0x2577bc){_0x55bc7a=_0x55bc7a-0x0;var _0x253615=_0xd2f3[_0x55bc7a];return _0x253615;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d2f('0x0'));var rimraf=require(_0x3d2f('0x1'));var zipdir=require(_0x3d2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d2f('0x3'));var moment=require(_0x3d2f('0x4'));var BPromise=require(_0x3d2f('0x5'));var Mustache=require(_0x3d2f('0x6'));var util=require('util');var path=require(_0x3d2f('0x7'));var sox=require(_0x3d2f('0x8'));var csv=require('to-csv');var ejs=require(_0x3d2f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d2f('0xa'));var querystring=require(_0x3d2f('0xb'));var Papa=require('papaparse');var Redis=require(_0x3d2f('0xc'));var authService=require(_0x3d2f('0xd'));var qs=require(_0x3d2f('0xe'));var as=require(_0x3d2f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d2f('0x10'))(_0x3d2f('0x11'));var utils=require(_0x3d2f('0x12'));var config=require(_0x3d2f('0x13'));var db=require(_0x3d2f('0x14'))['db'];function respondWithStatusCode(_0x1c809b,_0x4c284d){_0x4c284d=_0x4c284d||0xcc;return function(_0x220f37){if(_0x220f37){return _0x1c809b[_0x3d2f('0x15')](_0x4c284d);}return _0x1c809b['status'](_0x4c284d)[_0x3d2f('0x16')]();};}function respondWithResult(_0xcd9d04,_0x3372ba){_0x3372ba=_0x3372ba||0xc8;return function(_0x334dee){if(_0x334dee){return _0xcd9d04[_0x3d2f('0x17')](_0x3372ba)[_0x3d2f('0x18')](_0x334dee);}};}function respondWithFilteredResult(_0x147707,_0x4fb426){return function(_0x541dfb){if(_0x541dfb){var _0x3cce6f=_0x541dfb[_0x3d2f('0x19')],_0x3df64e=_0x4fb426[_0x3d2f('0x1a')],_0x199374=_0x4fb426[_0x3d2f('0x1a')]+_0x4fb426[_0x3d2f('0x1b')],_0x1b9f5e;if(_0x199374>=_0x3cce6f){_0x199374=_0x3cce6f;_0x1b9f5e=0xc8;}else{_0x1b9f5e=0xce;}_0x147707[_0x3d2f('0x17')](_0x1b9f5e);return _0x147707['set'](_0x3d2f('0x1c'),_0x3df64e+'-'+_0x199374+'/'+_0x3cce6f)['json'](_0x541dfb);}return null;};}function patchUpdates(_0x4aea39){return function(_0x5e37d6){try{jsonpatch[_0x3d2f('0x1d')](_0x5e37d6,_0x4aea39,!![]);}catch(_0x51ec09){return BPromise[_0x3d2f('0x1e')](_0x51ec09);}return _0x5e37d6[_0x3d2f('0x1f')]();};}function saveUpdates(_0x242f11,_0x434cf2){return function(_0x2bf633){if(_0x2bf633){return _0x2bf633[_0x3d2f('0x20')](_0x242f11)[_0x3d2f('0x21')](function(_0x59dcf1){return _0x59dcf1;});}return null;};}function removeEntity(_0x1c2c9e,_0x5abf9c){return function(_0x4a3f78){if(_0x4a3f78){return _0x4a3f78['destroy']()[_0x3d2f('0x21')](function(){_0x1c2c9e[_0x3d2f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c4af,_0x30214f){return function(_0x3c79e4){if(!_0x3c79e4){_0x36c4af[_0x3d2f('0x15')](0x194);}return _0x3c79e4;};}function handleError(_0x2fc549,_0x18b4a8){_0x18b4a8=_0x18b4a8||0x1f4;return function(_0x2813b4){logger['error'](_0x2813b4[_0x3d2f('0x22')]);if(_0x2813b4[_0x3d2f('0x23')]){delete _0x2813b4[_0x3d2f('0x23')];}_0x2fc549[_0x3d2f('0x17')](_0x18b4a8)[_0x3d2f('0x24')](_0x2813b4);};}exports[_0x3d2f('0x25')]=function(_0x340a69,_0x1a57f4){var _0x3360b9={},_0x497a27={},_0x555609={'count':0x0,'rows':[]};var _0x1bf606=_[_0x3d2f('0x26')](db[_0x3d2f('0x27')][_0x3d2f('0x28')],function(_0x5784a4){return{'name':_0x5784a4['fieldName'],'type':_0x5784a4['type'][_0x3d2f('0x29')]};});_0x497a27[_0x3d2f('0x2a')]=_[_0x3d2f('0x26')](_0x1bf606,_0x3d2f('0x23'));_0x497a27['query']=_['keys'](_0x340a69[_0x3d2f('0x2b')]);_0x497a27[_0x3d2f('0x2c')]=_[_0x3d2f('0x2d')](_0x497a27[_0x3d2f('0x2a')],_0x497a27['query']);_0x3360b9[_0x3d2f('0x2e')]=_[_0x3d2f('0x2d')](_0x497a27[_0x3d2f('0x2a')],qs[_0x3d2f('0x2f')](_0x340a69[_0x3d2f('0x2b')][_0x3d2f('0x2f')]));_0x3360b9[_0x3d2f('0x2e')]=_0x3360b9[_0x3d2f('0x2e')][_0x3d2f('0x30')]?_0x3360b9[_0x3d2f('0x2e')]:_0x497a27[_0x3d2f('0x2a')];if(!_0x340a69[_0x3d2f('0x2b')][_0x3d2f('0x31')]('nolimit')){_0x3360b9[_0x3d2f('0x1b')]=qs[_0x3d2f('0x1b')](_0x340a69[_0x3d2f('0x2b')][_0x3d2f('0x1b')]);_0x3360b9[_0x3d2f('0x1a')]=qs[_0x3d2f('0x1a')](_0x340a69['query'][_0x3d2f('0x1a')]);}_0x3360b9['order']=qs[_0x3d2f('0x32')](_0x340a69['query'][_0x3d2f('0x32')]);_0x3360b9[_0x3d2f('0x33')]=qs[_0x3d2f('0x2c')](_[_0x3d2f('0x34')](_0x340a69[_0x3d2f('0x2b')],_0x497a27[_0x3d2f('0x2c')]),_0x1bf606);if(_0x340a69['query'][_0x3d2f('0x35')]){_0x3360b9[_0x3d2f('0x33')]=_['merge'](_0x3360b9['where'],{'$or':_['map'](_0x1bf606,function(_0x1a849e){if(_0x1a849e[_0x3d2f('0x36')]!=='VIRTUAL'){var _0x3a0f9f={};_0x3a0f9f[_0x1a849e['name']]={'$like':'%'+_0x340a69[_0x3d2f('0x2b')][_0x3d2f('0x35')]+'%'};return _0x3a0f9f;}})});}_0x3360b9=_[_0x3d2f('0x37')]({},_0x3360b9,_0x340a69[_0x3d2f('0x38')]);var _0x59e54d={'where':_0x3360b9[_0x3d2f('0x33')]};return db[_0x3d2f('0x27')][_0x3d2f('0x19')](_0x59e54d)['then'](function(_0x432ac7){_0x555609[_0x3d2f('0x19')]=_0x432ac7;if(_0x340a69['query'][_0x3d2f('0x39')]){_0x3360b9[_0x3d2f('0x3a')]=[{'all':!![]}];}return db[_0x3d2f('0x27')][_0x3d2f('0x3b')](_0x3360b9);})[_0x3d2f('0x21')](function(_0x301118){_0x555609[_0x3d2f('0x3c')]=_0x301118;return _0x555609;})['then'](respondWithFilteredResult(_0x1a57f4,_0x3360b9))['catch'](handleError(_0x1a57f4,null));};exports[_0x3d2f('0x3d')]=function(_0x202bc9,_0x101949){var _0x31d921={'raw':!![],'where':{'id':_0x202bc9[_0x3d2f('0x3e')]['id']}},_0x4ce924={};_0x4ce924[_0x3d2f('0x2a')]=_['keys'](db[_0x3d2f('0x27')]['rawAttributes']);_0x4ce924[_0x3d2f('0x2b')]=_[_0x3d2f('0x3f')](_0x202bc9[_0x3d2f('0x2b')]);_0x4ce924[_0x3d2f('0x2c')]=_[_0x3d2f('0x2d')](_0x4ce924[_0x3d2f('0x2a')],_0x4ce924['query']);_0x31d921[_0x3d2f('0x2e')]=_[_0x3d2f('0x2d')](_0x4ce924[_0x3d2f('0x2a')],qs['fields'](_0x202bc9[_0x3d2f('0x2b')][_0x3d2f('0x2f')]));_0x31d921['attributes']=_0x31d921['attributes']['length']?_0x31d921['attributes']:_0x4ce924[_0x3d2f('0x2a')];if(_0x202bc9['query']['includeAll']){_0x31d921['include']=[{'all':!![]}];}_0x31d921=_[_0x3d2f('0x37')]({},_0x31d921,_0x202bc9[_0x3d2f('0x38')]);return db['OpenchannelQueueReport']['find'](_0x31d921)['then'](handleEntityNotFound(_0x101949,null))[_0x3d2f('0x21')](respondWithResult(_0x101949,null))[_0x3d2f('0x40')](handleError(_0x101949,null));};exports[_0x3d2f('0x41')]=function(_0x154e90,_0x12634e){return db['OpenchannelQueueReport'][_0x3d2f('0x41')](_0x154e90['body'],{})['then'](respondWithResult(_0x12634e,0xc9))[_0x3d2f('0x40')](handleError(_0x12634e,null));};exports['update']=function(_0x241fbe,_0x5bddad){if(_0x241fbe[_0x3d2f('0x42')]['id']){delete _0x241fbe[_0x3d2f('0x42')]['id'];}return db[_0x3d2f('0x27')][_0x3d2f('0x43')]({'where':{'id':_0x241fbe['params']['id']}})[_0x3d2f('0x21')](handleEntityNotFound(_0x5bddad,null))[_0x3d2f('0x21')](saveUpdates(_0x241fbe[_0x3d2f('0x42')],null))[_0x3d2f('0x21')](respondWithResult(_0x5bddad,null))[_0x3d2f('0x40')](handleError(_0x5bddad,null));};exports['destroy']=function(_0x185331,_0x3a1d22){return db[_0x3d2f('0x27')][_0x3d2f('0x43')]({'where':{'id':_0x185331[_0x3d2f('0x3e')]['id']}})[_0x3d2f('0x21')](handleEntityNotFound(_0x3a1d22,null))[_0x3d2f('0x21')](removeEntity(_0x3a1d22,null))['catch'](handleError(_0x3a1d22,null));};exports[_0x3d2f('0x44')]=function(_0x676455,_0x5ad6c5){return db[_0x3d2f('0x27')]['describe']()[_0x3d2f('0x21')](respondWithResult(_0x5ad6c5,null))['catch'](handleError(_0x5ad6c5,null));}; \ No newline at end of file +var _0xf604=['bluebird','path','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/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','filters','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1f3f14,_0x2c859e){var _0x4b7d6e=function(_0x15a99f){while(--_0x15a99f){_0x1f3f14['push'](_0x1f3f14['shift']());}};_0x4b7d6e(++_0x2c859e);}(_0xf604,0x122));var _0x4f60=function(_0x7afb4c,_0x10778f){_0x7afb4c=_0x7afb4c-0x0;var _0x54a1e9=_0xf604[_0x7afb4c];return _0x54a1e9;};'use strict';var pdf=require(_0x4f60('0x0'));var emlformat=require(_0x4f60('0x1'));var rimraf=require(_0x4f60('0x2'));var zipdir=require(_0x4f60('0x3'));var jsonpatch=require(_0x4f60('0x4'));var rp=require('request-promise');var moment=require(_0x4f60('0x5'));var BPromise=require(_0x4f60('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f60('0x7'));var sox=require('sox');var csv=require(_0x4f60('0x8'));var ejs=require(_0x4f60('0x9'));var fs=require('fs');var _=require(_0x4f60('0xa'));var squel=require(_0x4f60('0xb'));var crypto=require(_0x4f60('0xc'));var jsforce=require(_0x4f60('0xd'));var deskjs=require(_0x4f60('0xe'));var toCsv=require(_0x4f60('0x8'));var querystring=require(_0x4f60('0xf'));var Papa=require(_0x4f60('0x10'));var Redis=require('ioredis');var authService=require(_0x4f60('0x11'));var qs=require(_0x4f60('0x12'));var as=require(_0x4f60('0x13'));var hardwareService=require(_0x4f60('0x14'));var logger=require(_0x4f60('0x15'))(_0x4f60('0x16'));var utils=require('../../config/utils');var config=require(_0x4f60('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fd3a4,_0x20ff90){_0x20ff90=_0x20ff90||0xcc;return function(_0x441bad){if(_0x441bad){return _0x2fd3a4[_0x4f60('0x18')](_0x20ff90);}return _0x2fd3a4['status'](_0x20ff90)[_0x4f60('0x19')]();};}function respondWithResult(_0x2533b7,_0x296ad1){_0x296ad1=_0x296ad1||0xc8;return function(_0x40332f){if(_0x40332f){return _0x2533b7[_0x4f60('0x1a')](_0x296ad1)['json'](_0x40332f);}};}function respondWithFilteredResult(_0x537723,_0x38bad1){return function(_0x307e4f){if(_0x307e4f){var _0x58436b=_0x307e4f[_0x4f60('0x1b')],_0x54a98d=_0x38bad1['offset'],_0x3188d2=_0x38bad1[_0x4f60('0x1c')]+_0x38bad1[_0x4f60('0x1d')],_0x2ebb70;if(_0x3188d2>=_0x58436b){_0x3188d2=_0x58436b;_0x2ebb70=0xc8;}else{_0x2ebb70=0xce;}_0x537723[_0x4f60('0x1a')](_0x2ebb70);return _0x537723[_0x4f60('0x1e')](_0x4f60('0x1f'),_0x54a98d+'-'+_0x3188d2+'/'+_0x58436b)[_0x4f60('0x20')](_0x307e4f);}return null;};}function patchUpdates(_0x4e432d){return function(_0x3d8d74){try{jsonpatch[_0x4f60('0x21')](_0x3d8d74,_0x4e432d,!![]);}catch(_0x4ba26d){return BPromise[_0x4f60('0x22')](_0x4ba26d);}return _0x3d8d74['save']();};}function saveUpdates(_0x250ae5,_0x14c57f){return function(_0x3c797d){if(_0x3c797d){return _0x3c797d[_0x4f60('0x23')](_0x250ae5)['then'](function(_0x231721){return _0x231721;});}return null;};}function removeEntity(_0x3af9f6,_0x9a5982){return function(_0x5951c8){if(_0x5951c8){return _0x5951c8['destroy']()[_0x4f60('0x24')](function(){_0x3af9f6[_0x4f60('0x1a')](0xcc)[_0x4f60('0x19')]();});}};}function handleEntityNotFound(_0x36ea2a,_0xa8e2af){return function(_0x42561c){if(!_0x42561c){_0x36ea2a['sendStatus'](0x194);}return _0x42561c;};}function handleError(_0x223304,_0x2f9618){_0x2f9618=_0x2f9618||0x1f4;return function(_0x116b21){logger['error'](_0x116b21[_0x4f60('0x25')]);if(_0x116b21[_0x4f60('0x26')]){delete _0x116b21['name'];}_0x223304['status'](_0x2f9618)[_0x4f60('0x27')](_0x116b21);};}exports[_0x4f60('0x28')]=function(_0x2eea09,_0x29797b){var _0x417bab={},_0x15e028={},_0xbd03d1={'count':0x0,'rows':[]};var _0x3128c7=_[_0x4f60('0x29')](db[_0x4f60('0x2a')][_0x4f60('0x2b')],function(_0x8c25f3){return{'name':_0x8c25f3[_0x4f60('0x2c')],'type':_0x8c25f3[_0x4f60('0x2d')][_0x4f60('0x2e')]};});_0x15e028[_0x4f60('0x2f')]=_[_0x4f60('0x29')](_0x3128c7,_0x4f60('0x26'));_0x15e028[_0x4f60('0x30')]=_[_0x4f60('0x31')](_0x2eea09['query']);_0x15e028['filters']=_['intersection'](_0x15e028[_0x4f60('0x2f')],_0x15e028['query']);_0x417bab[_0x4f60('0x32')]=_[_0x4f60('0x33')](_0x15e028[_0x4f60('0x2f')],qs[_0x4f60('0x34')](_0x2eea09[_0x4f60('0x30')][_0x4f60('0x34')]));_0x417bab[_0x4f60('0x32')]=_0x417bab[_0x4f60('0x32')][_0x4f60('0x35')]?_0x417bab[_0x4f60('0x32')]:_0x15e028[_0x4f60('0x2f')];if(!_0x2eea09['query']['hasOwnProperty'](_0x4f60('0x36'))){_0x417bab['limit']=qs[_0x4f60('0x1d')](_0x2eea09[_0x4f60('0x30')][_0x4f60('0x1d')]);_0x417bab[_0x4f60('0x1c')]=qs[_0x4f60('0x1c')](_0x2eea09['query'][_0x4f60('0x1c')]);}_0x417bab[_0x4f60('0x37')]=qs[_0x4f60('0x38')](_0x2eea09[_0x4f60('0x30')][_0x4f60('0x38')]);_0x417bab[_0x4f60('0x39')]=qs['filters'](_[_0x4f60('0x3a')](_0x2eea09[_0x4f60('0x30')],_0x15e028['filters']),_0x3128c7);if(_0x2eea09[_0x4f60('0x30')]['filter']){_0x417bab['where']=_[_0x4f60('0x3b')](_0x417bab[_0x4f60('0x39')],{'$or':_[_0x4f60('0x29')](_0x3128c7,function(_0x393aaf){if(_0x393aaf['type']!==_0x4f60('0x3c')){var _0x78da8f={};_0x78da8f[_0x393aaf[_0x4f60('0x26')]]={'$like':'%'+_0x2eea09['query']['filter']+'%'};return _0x78da8f;}})});}_0x417bab=_[_0x4f60('0x3b')]({},_0x417bab,_0x2eea09[_0x4f60('0x3d')]);var _0x10a041={'where':_0x417bab[_0x4f60('0x39')]};return db[_0x4f60('0x2a')][_0x4f60('0x1b')](_0x10a041)[_0x4f60('0x24')](function(_0x286fee){_0xbd03d1[_0x4f60('0x1b')]=_0x286fee;if(_0x2eea09['query'][_0x4f60('0x3e')]){_0x417bab[_0x4f60('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x417bab);})[_0x4f60('0x24')](function(_0x3776cd){_0xbd03d1[_0x4f60('0x40')]=_0x3776cd;return _0xbd03d1;})['then'](respondWithFilteredResult(_0x29797b,_0x417bab))['catch'](handleError(_0x29797b,null));};exports[_0x4f60('0x41')]=function(_0x365497,_0xb7aa00){var _0x35ead9={'raw':!![],'where':{'id':_0x365497[_0x4f60('0x42')]['id']}},_0x52061a={};_0x52061a[_0x4f60('0x2f')]=_[_0x4f60('0x31')](db['OpenchannelQueueReport'][_0x4f60('0x2b')]);_0x52061a[_0x4f60('0x30')]=_[_0x4f60('0x31')](_0x365497[_0x4f60('0x30')]);_0x52061a[_0x4f60('0x43')]=_[_0x4f60('0x33')](_0x52061a['model'],_0x52061a[_0x4f60('0x30')]);_0x35ead9[_0x4f60('0x32')]=_[_0x4f60('0x33')](_0x52061a['model'],qs['fields'](_0x365497[_0x4f60('0x30')][_0x4f60('0x34')]));_0x35ead9[_0x4f60('0x32')]=_0x35ead9[_0x4f60('0x32')][_0x4f60('0x35')]?_0x35ead9[_0x4f60('0x32')]:_0x52061a['model'];if(_0x365497[_0x4f60('0x30')][_0x4f60('0x3e')]){_0x35ead9[_0x4f60('0x3f')]=[{'all':!![]}];}_0x35ead9=_[_0x4f60('0x3b')]({},_0x35ead9,_0x365497[_0x4f60('0x3d')]);return db[_0x4f60('0x2a')][_0x4f60('0x44')](_0x35ead9)[_0x4f60('0x24')](handleEntityNotFound(_0xb7aa00,null))[_0x4f60('0x24')](respondWithResult(_0xb7aa00,null))[_0x4f60('0x45')](handleError(_0xb7aa00,null));};exports['create']=function(_0x151c20,_0x4d9c4d){return db['OpenchannelQueueReport'][_0x4f60('0x46')](_0x151c20['body'],{})[_0x4f60('0x24')](respondWithResult(_0x4d9c4d,0xc9))[_0x4f60('0x45')](handleError(_0x4d9c4d,null));};exports[_0x4f60('0x23')]=function(_0x3bee19,_0x3546aa){if(_0x3bee19[_0x4f60('0x47')]['id']){delete _0x3bee19[_0x4f60('0x47')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3bee19[_0x4f60('0x42')]['id']}})[_0x4f60('0x24')](handleEntityNotFound(_0x3546aa,null))[_0x4f60('0x24')](saveUpdates(_0x3bee19[_0x4f60('0x47')],null))['then'](respondWithResult(_0x3546aa,null))[_0x4f60('0x45')](handleError(_0x3546aa,null));};exports[_0x4f60('0x48')]=function(_0x1799bd,_0x3daa66){return db[_0x4f60('0x2a')]['find']({'where':{'id':_0x1799bd[_0x4f60('0x42')]['id']}})[_0x4f60('0x24')](handleEntityNotFound(_0x3daa66,null))[_0x4f60('0x24')](removeEntity(_0x3daa66,null))[_0x4f60('0x45')](handleError(_0x3daa66,null));};exports[_0x4f60('0x49')]=function(_0x5af9c3,_0x497d6b){return db[_0x4f60('0x2a')][_0x4f60('0x49')]()[_0x4f60('0x24')](respondWithResult(_0x497d6b,null))['catch'](handleError(_0x497d6b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 03f8264..325fe7d 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 _0x9339=['OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x1e1d83,_0x87288d){var _0x51cb40=function(_0x5d57d0){while(--_0x5d57d0){_0x1e1d83['push'](_0x1e1d83['shift']());}};_0x51cb40(++_0x87288d);}(_0x9339,0x7b));var _0x9933=function(_0x56a226,_0x2fb531){_0x56a226=_0x56a226-0x0;var _0x15fcfe=_0x9339[_0x56a226];return _0x15fcfe;};'use strict';var _=require(_0x9933('0x0'));var util=require(_0x9933('0x1'));var logger=require(_0x9933('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9933('0x3'));var rp=require(_0x9933('0x4'));var fs=require('fs');var path=require(_0x9933('0x5'));var rimraf=require(_0x9933('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueueReport.attributes');module[_0x9933('0x7')]=function(_0x51fb36,_0x529f78){return _0x51fb36[_0x9933('0x8')](_0x9933('0x9'),attributes,{'tableName':_0x9933('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1777=['exports','report_openchannel_queue','uniqueid','lodash','../../config/logger','api','path','rimraf'];(function(_0x4a1eea,_0x387ec6){var _0x454801=function(_0x2b108d){while(--_0x2b108d){_0x4a1eea['push'](_0x4a1eea['shift']());}};_0x454801(++_0x387ec6);}(_0x1777,0xf3));var _0x7177=function(_0x1e2178,_0x2a6da7){_0x1e2178=_0x1e2178-0x0;var _0x48a78b=_0x1777[_0x1e2178];return _0x48a78b;};'use strict';var _=require(_0x7177('0x0'));var util=require('util');var logger=require(_0x7177('0x1'))(_0x7177('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7177('0x3'));var rimraf=require(_0x7177('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelQueueReport.attributes');module[_0x7177('0x5')]=function(_0x5468ed,_0x5e2f6a){return _0x5468ed['define']('OpenchannelQueueReport',attributes,{'tableName':_0x7177('0x6'),'paranoid':![],'indexes':[{'name':_0x7177('0x7'),'fields':[_0x7177('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9118abc..5875315 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 _0xc9c3=['UpdateOpenchannelQueueReport','raw','where','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','catch'];(function(_0x4785c5,_0x2466cf){var _0x3bdfcd=function(_0x135475){while(--_0x135475){_0x4785c5['push'](_0x4785c5['shift']());}};_0x3bdfcd(++_0x2466cf);}(_0xc9c3,0x96));var _0x3c9c=function(_0x16cdda,_0x453b10){_0x16cdda=_0x16cdda-0x0;var _0x264d17=_0xc9c3[_0x16cdda];return _0x264d17;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9c('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c9c('0x1'));var fs=require('fs');var Redis=require(_0x3c9c('0x2'));var db=require(_0x3c9c('0x3'))['db'];var utils=require(_0x3c9c('0x4'));var logger=require(_0x3c9c('0x5'))(_0x3c9c('0x6'));var config=require(_0x3c9c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2836,_0x3ca0ce,_0xc35e75){return new BPromise(function(_0x2eb946,_0x3e5ccb){return client[_0x3c9c('0x8')](_0x5a2836,_0xc35e75)[_0x3c9c('0x9')](function(_0x302ab7){logger[_0x3c9c('0xa')](_0x3c9c('0xb'),_0x3ca0ce,'request\x20sent');logger[_0x3c9c('0xc')](_0x3c9c('0xd'),_0x3ca0ce,'request\x20sent',JSON[_0x3c9c('0xe')](_0x302ab7));if(_0x302ab7['error']){if(_0x302ab7[_0x3c9c('0xf')][_0x3c9c('0x10')]===0x1f4){logger[_0x3c9c('0xf')](_0x3c9c('0xb'),_0x3ca0ce,_0x302ab7['error']['message']);return _0x3e5ccb(_0x302ab7['error'][_0x3c9c('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ca0ce,_0x302ab7['error'][_0x3c9c('0x11')]);return _0x2eb946(_0x302ab7['error'][_0x3c9c('0x11')]);}else{logger[_0x3c9c('0xa')](_0x3c9c('0xb'),_0x3ca0ce,_0x3c9c('0x12'));_0x2eb946(_0x302ab7['result'][_0x3c9c('0x11')]);}})['catch'](function(_0x558101){logger['error'](_0x3c9c('0xb'),_0x3ca0ce,_0x558101);_0x3e5ccb(_0x558101);});});}exports[_0x3c9c('0x13')]=function(_0x216fd8){var _0x3eee19=this;return new Promise(function(_0x3e63e0,_0x220b23){return db[_0x3c9c('0x14')]['create'](_0x216fd8[_0x3c9c('0x15')],{'raw':_0x216fd8['options']?_0x216fd8[_0x3c9c('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3c9c('0x9')](function(_0x1152d5){logger['info'](_0x3c9c('0x13'),_0x216fd8);logger[_0x3c9c('0xc')](_0x3c9c('0x13'),_0x216fd8,JSON['stringify'](_0x1152d5));_0x3e63e0(_0x1152d5);})[_0x3c9c('0x17')](function(_0x249747){logger[_0x3c9c('0xf')](_0x3c9c('0x13'),_0x249747[_0x3c9c('0x11')],_0x216fd8);_0x220b23(_0x3eee19[_0x3c9c('0xf')](0x1f4,_0x249747[_0x3c9c('0x11')]));});});};exports[_0x3c9c('0x18')]=function(_0x509bf7){var _0x6ed08a=this;return new Promise(function(_0x4d58b9,_0x497145){return db[_0x3c9c('0x14')]['update'](_0x509bf7['body'],{'raw':_0x509bf7[_0x3c9c('0x16')]?_0x509bf7[_0x3c9c('0x16')][_0x3c9c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509bf7[_0x3c9c('0x16')]?_0x509bf7['options'][_0x3c9c('0x1a')]||null:null,'attributes':_0x509bf7[_0x3c9c('0x16')]?_0x509bf7['options'][_0x3c9c('0x1b')]||null:null,'limit':_0x509bf7['options']?_0x509bf7['options'][_0x3c9c('0x1c')]||null:null})[_0x3c9c('0x9')](function(_0x333f2b){logger[_0x3c9c('0xa')](_0x3c9c('0x18'),_0x509bf7);logger['debug'](_0x3c9c('0x18'),_0x509bf7,JSON['stringify'](_0x333f2b));_0x4d58b9(_0x333f2b);})[_0x3c9c('0x17')](function(_0x3a77a5){logger[_0x3c9c('0xf')](_0x3c9c('0x18'),_0x3a77a5['message'],_0x509bf7);_0x497145(_0x6ed08a[_0x3c9c('0xf')](0x1f4,_0x3a77a5[_0x3c9c('0x11')]));});});}; \ No newline at end of file +var _0x8506=['code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','info','stringify','UpdateOpenchannelQueueReport','body','where','attributes','limit','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0x8506,0xe8));var _0x6850=function(_0x5d231a,_0x326835){_0x5d231a=_0x5d231a-0x0;var _0x281a0a=_0x8506[_0x5d231a];return _0x281a0a;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var moment=require('moment');var BPromise=require(_0x6850('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6850('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6850('0x3'));var logger=require(_0x6850('0x4'))(_0x6850('0x5'));var config=require('../../config/environment');var jayson=require(_0x6850('0x6'));var client=jayson[_0x6850('0x7')][_0x6850('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c301f,_0x5858ca,_0x51c0ad){return new BPromise(function(_0x5466ee,_0x117706){return client[_0x6850('0x9')](_0x3c301f,_0x51c0ad)[_0x6850('0xa')](function(_0x589417){logger['info'](_0x6850('0xb'),_0x5858ca,_0x6850('0xc'));logger[_0x6850('0xd')](_0x6850('0xe'),_0x5858ca,_0x6850('0xc'),JSON['stringify'](_0x589417));if(_0x589417[_0x6850('0xf')]){if(_0x589417[_0x6850('0xf')][_0x6850('0x10')]===0x1f4){logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x589417[_0x6850('0xf')]['message']);return _0x117706(_0x589417[_0x6850('0xf')][_0x6850('0x11')]);}logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x589417[_0x6850('0xf')][_0x6850('0x11')]);return _0x5466ee(_0x589417['error'][_0x6850('0x11')]);}else{logger['info'](_0x6850('0xb'),_0x5858ca,_0x6850('0xc'));_0x5466ee(_0x589417[_0x6850('0x12')][_0x6850('0x11')]);}})[_0x6850('0x13')](function(_0x32b9d3){logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x32b9d3);_0x117706(_0x32b9d3);});});}exports[_0x6850('0x14')]=function(_0x441f79){var _0xeff8de=this;return new Promise(function(_0x145dbb,_0x44a5e4){return db[_0x6850('0x15')]['create'](_0x441f79['body'],{'raw':_0x441f79[_0x6850('0x16')]?_0x441f79[_0x6850('0x16')][_0x6850('0x17')]===undefined?!![]:![]:!![]})[_0x6850('0xa')](function(_0x12a15d){logger[_0x6850('0x18')]('CreateOpenchannelQueueReport',_0x441f79);logger[_0x6850('0xd')](_0x6850('0x14'),_0x441f79,JSON[_0x6850('0x19')](_0x12a15d));_0x145dbb(_0x12a15d);})[_0x6850('0x13')](function(_0x2978a1){logger[_0x6850('0xf')](_0x6850('0x14'),_0x2978a1[_0x6850('0x11')],_0x441f79);_0x44a5e4(_0xeff8de[_0x6850('0xf')](0x1f4,_0x2978a1[_0x6850('0x11')]));});});};exports[_0x6850('0x1a')]=function(_0x15ab81){var _0x566eeb=this;return new Promise(function(_0xcb19e2,_0x46a82d){return db[_0x6850('0x15')]['update'](_0x15ab81[_0x6850('0x1b')],{'raw':_0x15ab81['options']?_0x15ab81['options'][_0x6850('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15ab81[_0x6850('0x16')]?_0x15ab81[_0x6850('0x16')][_0x6850('0x1c')]||null:null,'attributes':_0x15ab81['options']?_0x15ab81[_0x6850('0x16')][_0x6850('0x1d')]||null:null,'limit':_0x15ab81['options']?_0x15ab81[_0x6850('0x16')][_0x6850('0x1e')]||null:null})[_0x6850('0xa')](function(_0x97f08f){logger['info'](_0x6850('0x1a'),_0x15ab81);logger[_0x6850('0xd')]('UpdateOpenchannelQueueReport',_0x15ab81,JSON['stringify'](_0x97f08f));_0xcb19e2(_0x97f08f);})[_0x6850('0x13')](function(_0x26c404){logger['error'](_0x6850('0x1a'),_0x26c404[_0x6850('0x11')],_0x15ab81);_0x46a82d(_0x566eeb[_0x6850('0xf')](0x1f4,_0x26c404[_0x6850('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8428f3f..3012ff6 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(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var 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 ca63897..d5a5a08 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 _0x7a34=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x21e771,_0x34912d){var _0x1d2bdc=function(_0x4754a4){while(--_0x4754a4){_0x21e771['push'](_0x21e771['shift']());}};_0x1d2bdc(++_0x34912d);}(_0x7a34,0x11e));var _0x47a3=function(_0xfaa89d,_0x430937){_0xfaa89d=_0xfaa89d-0x0;var _0x2082a3=_0x7a34[_0xfaa89d];return _0x2082a3;};'use strict';var moment=require(_0x47a3('0x0'));var Sequelize=require(_0x47a3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x47a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x47a3('0x3')](_0x47a3('0x4'),_0x47a3('0x5'),_0x47a3('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x47a3('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x47a3('0x8')]}}; \ No newline at end of file +var _0xe1cb=['moment','sequelize','STRING','account','DATE','NOW'];(function(_0x47d798,_0x348b87){var _0x246f98=function(_0x39bb68){while(--_0x39bb68){_0x47d798['push'](_0x47d798['shift']());}};_0x246f98(++_0x348b87);}(_0xe1cb,0xcc));var _0xbe1c=function(_0x2b520b,_0x76d655){_0x2b520b=_0x2b520b-0x0;var _0x35c536=_0xe1cb[_0x2b520b];return _0x35c536;};'use strict';var moment=require(_0xbe1c('0x0'));var Sequelize=require(_0xbe1c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbe1c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbe1c('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbe1c('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xbe1c('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b652ff9..b708a99 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 _0xa3aa=['fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x51cfa1,_0x37adbe){var _0x395490=function(_0x34f127){while(--_0x34f127){_0x51cfa1['push'](_0x51cfa1['shift']());}};_0x395490(++_0x37adbe);}(_0xa3aa,0x192));var _0xaa3a=function(_0x365b81,_0xb52670){_0x365b81=_0x365b81-0x0;var _0x55e094=_0xa3aa[_0x365b81];return _0x55e094;};'use strict';var pdf=require(_0xaa3a('0x0'));var emlformat=require(_0xaa3a('0x1'));var rimraf=require(_0xaa3a('0x2'));var zipdir=require(_0xaa3a('0x3'));var jsonpatch=require(_0xaa3a('0x4'));var rp=require(_0xaa3a('0x5'));var moment=require(_0xaa3a('0x6'));var BPromise=require(_0xaa3a('0x7'));var Mustache=require(_0xaa3a('0x8'));var util=require(_0xaa3a('0x9'));var path=require(_0xaa3a('0xa'));var sox=require(_0xaa3a('0xb'));var csv=require(_0xaa3a('0xc'));var ejs=require(_0xaa3a('0xd'));var fs=require('fs');var _=require(_0xaa3a('0xe'));var squel=require(_0xaa3a('0xf'));var crypto=require(_0xaa3a('0x10'));var jsforce=require(_0xaa3a('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xaa3a('0xc'));var querystring=require(_0xaa3a('0x12'));var Papa=require(_0xaa3a('0x13'));var Redis=require(_0xaa3a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xaa3a('0x15'));var as=require(_0xaa3a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa3a('0x17'))(_0xaa3a('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48588b,_0x5afdd5){_0x5afdd5=_0x5afdd5||0xcc;return function(_0x47b837){if(_0x47b837){return _0x48588b[_0xaa3a('0x19')](_0x5afdd5);}return _0x48588b[_0xaa3a('0x1a')](_0x5afdd5)[_0xaa3a('0x1b')]();};}function respondWithResult(_0x53a4d3,_0x291117){_0x291117=_0x291117||0xc8;return function(_0x566e87){if(_0x566e87){return _0x53a4d3['status'](_0x291117)[_0xaa3a('0x1c')](_0x566e87);}};}function respondWithFilteredResult(_0xb78aeb,_0x797e0f){return function(_0x1c6cde){if(_0x1c6cde){var _0x3bb4a3=_0x1c6cde[_0xaa3a('0x1d')],_0x3629d1=_0x797e0f['offset'],_0x56bdfc=_0x797e0f[_0xaa3a('0x1e')]+_0x797e0f[_0xaa3a('0x1f')],_0x1b568a;if(_0x56bdfc>=_0x3bb4a3){_0x56bdfc=_0x3bb4a3;_0x1b568a=0xc8;}else{_0x1b568a=0xce;}_0xb78aeb[_0xaa3a('0x1a')](_0x1b568a);return _0xb78aeb[_0xaa3a('0x20')](_0xaa3a('0x21'),_0x3629d1+'-'+_0x56bdfc+'/'+_0x3bb4a3)[_0xaa3a('0x1c')](_0x1c6cde);}return null;};}function patchUpdates(_0x53e3f2){return function(_0x13550a){try{jsonpatch[_0xaa3a('0x22')](_0x13550a,_0x53e3f2,!![]);}catch(_0x741e5){return BPromise[_0xaa3a('0x23')](_0x741e5);}return _0x13550a[_0xaa3a('0x24')]();};}function saveUpdates(_0x245a07,_0x21ecff){return function(_0x554bcc){if(_0x554bcc){return _0x554bcc[_0xaa3a('0x25')](_0x245a07)[_0xaa3a('0x26')](function(_0x3f5189){return _0x3f5189;});}return null;};}function removeEntity(_0x4a1719,_0x52d436){return function(_0x15b3b2){if(_0x15b3b2){return _0x15b3b2[_0xaa3a('0x27')]()[_0xaa3a('0x26')](function(){_0x4a1719[_0xaa3a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x421318,_0x51b9d9){return function(_0x1e62b6){if(!_0x1e62b6){_0x421318[_0xaa3a('0x19')](0x194);}return _0x1e62b6;};}function handleError(_0x5c1b6e,_0x29b360){_0x29b360=_0x29b360||0x1f4;return function(_0x47afb6){logger['error'](_0x47afb6['stack']);if(_0x47afb6[_0xaa3a('0x28')]){delete _0x47afb6[_0xaa3a('0x28')];}_0x5c1b6e[_0xaa3a('0x1a')](_0x29b360)[_0xaa3a('0x29')](_0x47afb6);};}exports[_0xaa3a('0x2a')]=function(_0x4c954d,_0x3abfc9){var _0x4c9bd8={},_0x455e8e={},_0xc55d67={'count':0x0,'rows':[]};var _0x4df97e=_[_0xaa3a('0x2b')](db[_0xaa3a('0x2c')][_0xaa3a('0x2d')],function(_0x21df71){return{'name':_0x21df71[_0xaa3a('0x2e')],'type':_0x21df71[_0xaa3a('0x2f')]['key']};});_0x455e8e[_0xaa3a('0x30')]=_[_0xaa3a('0x2b')](_0x4df97e,_0xaa3a('0x28'));_0x455e8e[_0xaa3a('0x31')]=_[_0xaa3a('0x32')](_0x4c954d[_0xaa3a('0x31')]);_0x455e8e[_0xaa3a('0x33')]=_[_0xaa3a('0x34')](_0x455e8e[_0xaa3a('0x30')],_0x455e8e[_0xaa3a('0x31')]);_0x4c9bd8[_0xaa3a('0x35')]=_[_0xaa3a('0x34')](_0x455e8e[_0xaa3a('0x30')],qs[_0xaa3a('0x36')](_0x4c954d[_0xaa3a('0x31')]['fields']));_0x4c9bd8['attributes']=_0x4c9bd8['attributes']['length']?_0x4c9bd8[_0xaa3a('0x35')]:_0x455e8e[_0xaa3a('0x30')];if(!_0x4c954d[_0xaa3a('0x31')][_0xaa3a('0x37')](_0xaa3a('0x38'))){_0x4c9bd8[_0xaa3a('0x1f')]=qs[_0xaa3a('0x1f')](_0x4c954d[_0xaa3a('0x31')][_0xaa3a('0x1f')]);_0x4c9bd8[_0xaa3a('0x1e')]=qs['offset'](_0x4c954d['query'][_0xaa3a('0x1e')]);}_0x4c9bd8[_0xaa3a('0x39')]=qs[_0xaa3a('0x3a')](_0x4c954d[_0xaa3a('0x31')][_0xaa3a('0x3a')]);_0x4c9bd8['where']=qs[_0xaa3a('0x33')](_[_0xaa3a('0x3b')](_0x4c954d[_0xaa3a('0x31')],_0x455e8e[_0xaa3a('0x33')]),_0x4df97e);if(_0x4c954d[_0xaa3a('0x31')][_0xaa3a('0x3c')]){_0x4c9bd8[_0xaa3a('0x3d')]=_[_0xaa3a('0x3e')](_0x4c9bd8['where'],{'$or':_[_0xaa3a('0x2b')](_0x4df97e,function(_0x3993d6){if(_0x3993d6[_0xaa3a('0x2f')]!==_0xaa3a('0x3f')){var _0x3b12d3={};_0x3b12d3[_0x3993d6[_0xaa3a('0x28')]]={'$like':'%'+_0x4c954d['query'][_0xaa3a('0x3c')]+'%'};return _0x3b12d3;}})});}_0x4c9bd8=_[_0xaa3a('0x3e')]({},_0x4c9bd8,_0x4c954d[_0xaa3a('0x40')]);var _0x3b4a37={'where':_0x4c9bd8[_0xaa3a('0x3d')]};return db[_0xaa3a('0x2c')][_0xaa3a('0x1d')](_0x3b4a37)[_0xaa3a('0x26')](function(_0x48396a){_0xc55d67[_0xaa3a('0x1d')]=_0x48396a;if(_0x4c954d['query'][_0xaa3a('0x41')]){_0x4c9bd8[_0xaa3a('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x4c9bd8);})['then'](function(_0x574d01){_0xc55d67[_0xaa3a('0x43')]=_0x574d01;return _0xc55d67;})[_0xaa3a('0x26')](respondWithFilteredResult(_0x3abfc9,_0x4c9bd8))[_0xaa3a('0x44')](handleError(_0x3abfc9,null));};exports[_0xaa3a('0x45')]=function(_0x9588c9,_0x39d8dc){var _0x48b58d={'raw':!![],'where':{'id':_0x9588c9['params']['id']}},_0x2bcc86={};_0x2bcc86[_0xaa3a('0x30')]=_[_0xaa3a('0x32')](db['OpenchannelTransferReport'][_0xaa3a('0x2d')]);_0x2bcc86[_0xaa3a('0x31')]=_['keys'](_0x9588c9[_0xaa3a('0x31')]);_0x2bcc86[_0xaa3a('0x33')]=_[_0xaa3a('0x34')](_0x2bcc86[_0xaa3a('0x30')],_0x2bcc86[_0xaa3a('0x31')]);_0x48b58d[_0xaa3a('0x35')]=_['intersection'](_0x2bcc86[_0xaa3a('0x30')],qs[_0xaa3a('0x36')](_0x9588c9[_0xaa3a('0x31')]['fields']));_0x48b58d[_0xaa3a('0x35')]=_0x48b58d[_0xaa3a('0x35')][_0xaa3a('0x46')]?_0x48b58d[_0xaa3a('0x35')]:_0x2bcc86[_0xaa3a('0x30')];if(_0x9588c9['query'][_0xaa3a('0x41')]){_0x48b58d[_0xaa3a('0x42')]=[{'all':!![]}];}_0x48b58d=_[_0xaa3a('0x3e')]({},_0x48b58d,_0x9588c9[_0xaa3a('0x40')]);return db[_0xaa3a('0x2c')][_0xaa3a('0x47')](_0x48b58d)[_0xaa3a('0x26')](handleEntityNotFound(_0x39d8dc,null))[_0xaa3a('0x26')](respondWithResult(_0x39d8dc,null))[_0xaa3a('0x44')](handleError(_0x39d8dc,null));};exports[_0xaa3a('0x48')]=function(_0x27f066,_0xbfffe1){return db[_0xaa3a('0x2c')][_0xaa3a('0x48')](_0x27f066['body'],{})[_0xaa3a('0x26')](respondWithResult(_0xbfffe1,0xc9))[_0xaa3a('0x44')](handleError(_0xbfffe1,null));};exports[_0xaa3a('0x25')]=function(_0x357de2,_0x29ec6b){if(_0x357de2[_0xaa3a('0x49')]['id']){delete _0x357de2[_0xaa3a('0x49')]['id'];}return db[_0xaa3a('0x2c')][_0xaa3a('0x47')]({'where':{'id':_0x357de2['params']['id']}})[_0xaa3a('0x26')](handleEntityNotFound(_0x29ec6b,null))[_0xaa3a('0x26')](saveUpdates(_0x357de2['body'],null))['then'](respondWithResult(_0x29ec6b,null))[_0xaa3a('0x44')](handleError(_0x29ec6b,null));};exports[_0xaa3a('0x27')]=function(_0x4aa06f,_0x26522d){return db['OpenchannelTransferReport'][_0xaa3a('0x47')]({'where':{'id':_0x4aa06f[_0xaa3a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26522d,null))[_0xaa3a('0x26')](removeEntity(_0x26522d,null))[_0xaa3a('0x44')](handleError(_0x26522d,null));};exports[_0xaa3a('0x4b')]=function(_0x563e16,_0x523a7f){return db['OpenchannelTransferReport'][_0xaa3a('0x4b')]()['then'](respondWithResult(_0x523a7f,null))[_0xaa3a('0x44')](handleError(_0x523a7f,null));}; \ No newline at end of file +var _0x0c82=['rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','apply','reject','save','update','then','destroy','send','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','type','VIRTUAL','merge','options','count','includeAll','include','findAll'];(function(_0x40abfe,_0x2da076){var _0x4e1a22=function(_0x16ae66){while(--_0x16ae66){_0x40abfe['push'](_0x40abfe['shift']());}};_0x4e1a22(++_0x2da076);}(_0x0c82,0x9c));var _0x20c8=function(_0x483d2b,_0x2dd6d1){_0x483d2b=_0x483d2b-0x0;var _0x8d6023=_0x0c82[_0x483d2b];return _0x8d6023;};'use strict';var pdf=require(_0x20c8('0x0'));var emlformat=require(_0x20c8('0x1'));var rimraf=require(_0x20c8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20c8('0x3'));var rp=require(_0x20c8('0x4'));var moment=require(_0x20c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x20c8('0x6'));var util=require(_0x20c8('0x7'));var path=require(_0x20c8('0x8'));var sox=require(_0x20c8('0x9'));var csv=require(_0x20c8('0xa'));var ejs=require(_0x20c8('0xb'));var fs=require('fs');var _=require(_0x20c8('0xc'));var squel=require(_0x20c8('0xd'));var crypto=require(_0x20c8('0xe'));var jsforce=require(_0x20c8('0xf'));var deskjs=require(_0x20c8('0x10'));var toCsv=require(_0x20c8('0xa'));var querystring=require(_0x20c8('0x11'));var Papa=require(_0x20c8('0x12'));var Redis=require(_0x20c8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x20c8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20c8('0x15'));var logger=require(_0x20c8('0x16'))(_0x20c8('0x17'));var utils=require(_0x20c8('0x18'));var config=require(_0x20c8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9a80,_0x5b006a){_0x5b006a=_0x5b006a||0xcc;return function(_0x8110d6){if(_0x8110d6){return _0x3c9a80[_0x20c8('0x1a')](_0x5b006a);}return _0x3c9a80[_0x20c8('0x1b')](_0x5b006a)['end']();};}function respondWithResult(_0x34c70e,_0x391e76){_0x391e76=_0x391e76||0xc8;return function(_0x43a97b){if(_0x43a97b){return _0x34c70e[_0x20c8('0x1b')](_0x391e76)[_0x20c8('0x1c')](_0x43a97b);}};}function respondWithFilteredResult(_0x1cc88e,_0x32daa9){return function(_0x55072d){if(_0x55072d){var _0x28ed56=_0x55072d['count'],_0x3f9465=_0x32daa9['offset'],_0x2b5fd2=_0x32daa9['offset']+_0x32daa9['limit'],_0x2c86bf;if(_0x2b5fd2>=_0x28ed56){_0x2b5fd2=_0x28ed56;_0x2c86bf=0xc8;}else{_0x2c86bf=0xce;}_0x1cc88e['status'](_0x2c86bf);return _0x1cc88e['set']('Content-Range',_0x3f9465+'-'+_0x2b5fd2+'/'+_0x28ed56)[_0x20c8('0x1c')](_0x55072d);}return null;};}function patchUpdates(_0x15160c){return function(_0x469a1f){try{jsonpatch[_0x20c8('0x1d')](_0x469a1f,_0x15160c,!![]);}catch(_0x3bb723){return BPromise[_0x20c8('0x1e')](_0x3bb723);}return _0x469a1f[_0x20c8('0x1f')]();};}function saveUpdates(_0x3c07b7,_0x2c3b34){return function(_0x231204){if(_0x231204){return _0x231204[_0x20c8('0x20')](_0x3c07b7)[_0x20c8('0x21')](function(_0x2713bf){return _0x2713bf;});}return null;};}function removeEntity(_0xa9b31f,_0x314f9c){return function(_0x3ab776){if(_0x3ab776){return _0x3ab776[_0x20c8('0x22')]()[_0x20c8('0x21')](function(){_0xa9b31f[_0x20c8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc619,_0x12b4d5){return function(_0x8dda83){if(!_0x8dda83){_0x1cc619[_0x20c8('0x1a')](0x194);}return _0x8dda83;};}function handleError(_0x4e7d6d,_0x5105c7){_0x5105c7=_0x5105c7||0x1f4;return function(_0x1f65da){logger['error'](_0x1f65da['stack']);if(_0x1f65da['name']){delete _0x1f65da['name'];}_0x4e7d6d['status'](_0x5105c7)[_0x20c8('0x23')](_0x1f65da);};}exports['index']=function(_0x397eff,_0x5b05bd){var _0xd91144={},_0x2cd1a7={},_0x54c244={'count':0x0,'rows':[]};var _0x2f375d=_[_0x20c8('0x24')](db[_0x20c8('0x25')][_0x20c8('0x26')],function(_0x2b3682){return{'name':_0x2b3682[_0x20c8('0x27')],'type':_0x2b3682['type'][_0x20c8('0x28')]};});_0x2cd1a7[_0x20c8('0x29')]=_[_0x20c8('0x24')](_0x2f375d,_0x20c8('0x2a'));_0x2cd1a7[_0x20c8('0x2b')]=_[_0x20c8('0x2c')](_0x397eff[_0x20c8('0x2b')]);_0x2cd1a7[_0x20c8('0x2d')]=_[_0x20c8('0x2e')](_0x2cd1a7[_0x20c8('0x29')],_0x2cd1a7['query']);_0xd91144[_0x20c8('0x2f')]=_[_0x20c8('0x2e')](_0x2cd1a7['model'],qs['fields'](_0x397eff[_0x20c8('0x2b')][_0x20c8('0x30')]));_0xd91144[_0x20c8('0x2f')]=_0xd91144[_0x20c8('0x2f')][_0x20c8('0x31')]?_0xd91144[_0x20c8('0x2f')]:_0x2cd1a7[_0x20c8('0x29')];if(!_0x397eff[_0x20c8('0x2b')][_0x20c8('0x32')](_0x20c8('0x33'))){_0xd91144[_0x20c8('0x34')]=qs[_0x20c8('0x34')](_0x397eff['query'][_0x20c8('0x34')]);_0xd91144[_0x20c8('0x35')]=qs[_0x20c8('0x35')](_0x397eff[_0x20c8('0x2b')][_0x20c8('0x35')]);}_0xd91144[_0x20c8('0x36')]=qs[_0x20c8('0x37')](_0x397eff[_0x20c8('0x2b')][_0x20c8('0x37')]);_0xd91144[_0x20c8('0x38')]=qs[_0x20c8('0x2d')](_[_0x20c8('0x39')](_0x397eff[_0x20c8('0x2b')],_0x2cd1a7[_0x20c8('0x2d')]),_0x2f375d);if(_0x397eff[_0x20c8('0x2b')]['filter']){_0xd91144[_0x20c8('0x38')]=_['merge'](_0xd91144[_0x20c8('0x38')],{'$or':_[_0x20c8('0x24')](_0x2f375d,function(_0xca2db5){if(_0xca2db5[_0x20c8('0x3a')]!==_0x20c8('0x3b')){var _0x2a423e={};_0x2a423e[_0xca2db5['name']]={'$like':'%'+_0x397eff[_0x20c8('0x2b')]['filter']+'%'};return _0x2a423e;}})});}_0xd91144=_[_0x20c8('0x3c')]({},_0xd91144,_0x397eff[_0x20c8('0x3d')]);var _0x46572c={'where':_0xd91144[_0x20c8('0x38')]};return db[_0x20c8('0x25')][_0x20c8('0x3e')](_0x46572c)[_0x20c8('0x21')](function(_0x307b36){_0x54c244['count']=_0x307b36;if(_0x397eff[_0x20c8('0x2b')][_0x20c8('0x3f')]){_0xd91144[_0x20c8('0x40')]=[{'all':!![]}];}return db[_0x20c8('0x25')][_0x20c8('0x41')](_0xd91144);})['then'](function(_0x383d61){_0x54c244[_0x20c8('0x42')]=_0x383d61;return _0x54c244;})[_0x20c8('0x21')](respondWithFilteredResult(_0x5b05bd,_0xd91144))['catch'](handleError(_0x5b05bd,null));};exports[_0x20c8('0x43')]=function(_0x34102f,_0x4c6bdf){var _0x153d37={'raw':!![],'where':{'id':_0x34102f[_0x20c8('0x44')]['id']}},_0xae359f={};_0xae359f['model']=_[_0x20c8('0x2c')](db[_0x20c8('0x25')][_0x20c8('0x26')]);_0xae359f[_0x20c8('0x2b')]=_['keys'](_0x34102f[_0x20c8('0x2b')]);_0xae359f['filters']=_[_0x20c8('0x2e')](_0xae359f[_0x20c8('0x29')],_0xae359f[_0x20c8('0x2b')]);_0x153d37[_0x20c8('0x2f')]=_[_0x20c8('0x2e')](_0xae359f[_0x20c8('0x29')],qs[_0x20c8('0x30')](_0x34102f[_0x20c8('0x2b')]['fields']));_0x153d37[_0x20c8('0x2f')]=_0x153d37['attributes']['length']?_0x153d37[_0x20c8('0x2f')]:_0xae359f[_0x20c8('0x29')];if(_0x34102f[_0x20c8('0x2b')]['includeAll']){_0x153d37[_0x20c8('0x40')]=[{'all':!![]}];}_0x153d37=_['merge']({},_0x153d37,_0x34102f[_0x20c8('0x3d')]);return db[_0x20c8('0x25')][_0x20c8('0x45')](_0x153d37)[_0x20c8('0x21')](handleEntityNotFound(_0x4c6bdf,null))[_0x20c8('0x21')](respondWithResult(_0x4c6bdf,null))[_0x20c8('0x46')](handleError(_0x4c6bdf,null));};exports[_0x20c8('0x47')]=function(_0x353810,_0x5585be){return db[_0x20c8('0x25')][_0x20c8('0x47')](_0x353810[_0x20c8('0x48')],{})[_0x20c8('0x21')](respondWithResult(_0x5585be,0xc9))[_0x20c8('0x46')](handleError(_0x5585be,null));};exports[_0x20c8('0x20')]=function(_0x58e7b1,_0x53eb8e){if(_0x58e7b1[_0x20c8('0x48')]['id']){delete _0x58e7b1['body']['id'];}return db[_0x20c8('0x25')][_0x20c8('0x45')]({'where':{'id':_0x58e7b1[_0x20c8('0x44')]['id']}})[_0x20c8('0x21')](handleEntityNotFound(_0x53eb8e,null))[_0x20c8('0x21')](saveUpdates(_0x58e7b1[_0x20c8('0x48')],null))[_0x20c8('0x21')](respondWithResult(_0x53eb8e,null))[_0x20c8('0x46')](handleError(_0x53eb8e,null));};exports[_0x20c8('0x22')]=function(_0x2ad7f1,_0x345247){return db[_0x20c8('0x25')][_0x20c8('0x45')]({'where':{'id':_0x2ad7f1[_0x20c8('0x44')]['id']}})[_0x20c8('0x21')](handleEntityNotFound(_0x345247,null))[_0x20c8('0x21')](removeEntity(_0x345247,null))[_0x20c8('0x46')](handleError(_0x345247,null));};exports[_0x20c8('0x49')]=function(_0x5210be,_0x25e3ae){return db[_0x20c8('0x25')]['describe']()['then'](respondWithResult(_0x25e3ae,null))[_0x20c8('0x46')](handleError(_0x25e3ae,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d7daea2..e9e2b7c 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 _0x5430=['exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1fc25b,_0x688a93){var _0x387674=function(_0x3b30b8){while(--_0x3b30b8){_0x1fc25b['push'](_0x1fc25b['shift']());}};_0x387674(++_0x688a93);}(_0x5430,0x10c));var _0x0543=function(_0x17730e,_0x12566a){_0x17730e=_0x17730e-0x0;var _0x197089=_0x5430[_0x17730e];return _0x197089;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x0543('0x7')]=function(_0x45b909,_0x9754ba){return _0x45b909[_0x0543('0x8')](_0x0543('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x0543('0xa'),'fields':[_0x0543('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x3c4289,_0x4a20f5){var _0x1ea32a=function(_0x391f09){while(--_0x391f09){_0x3c4289['push'](_0x3c4289['shift']());}};_0x1ea32a(++_0x4a20f5);}(_0x326f,0xd1));var _0xf326=function(_0x2e0326,_0x138bbf){_0x2e0326=_0x2e0326-0x0;var _0x45bf7e=_0x326f[_0x2e0326];return _0x45bf7e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'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 9748a9a..a7e6985 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 _0x6462=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0xde1a06,_0x26f590){var _0x4b2f88=function(_0x2db683){while(--_0x2db683){_0xde1a06['push'](_0xde1a06['shift']());}};_0x4b2f88(++_0x26f590);}(_0x6462,0x11f));var _0x2646=function(_0x37e6cc,_0x213b98){_0x37e6cc=_0x37e6cc-0x0;var _0x50ebd7=_0x6462[_0x37e6cc];return _0x50ebd7;};'use strict';var _=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var moment=require(_0x2646('0x2'));var BPromise=require(_0x2646('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2646('0x4'));var db=require(_0x2646('0x5'))['db'];var utils=require(_0x2646('0x6'));var logger=require(_0x2646('0x7'))(_0x2646('0x8'));var config=require(_0x2646('0x9'));var jayson=require(_0x2646('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9024f4,_0x3cac63,_0x1ed2a1){return new BPromise(function(_0x4cde3e,_0x22796c){return client[_0x2646('0xb')](_0x9024f4,_0x1ed2a1)[_0x2646('0xc')](function(_0x2eda4d){logger[_0x2646('0xd')](_0x2646('0xe'),_0x3cac63,'request\x20sent');logger[_0x2646('0xf')](_0x2646('0x10'),_0x3cac63,'request\x20sent',JSON[_0x2646('0x11')](_0x2eda4d));if(_0x2eda4d['error']){if(_0x2eda4d[_0x2646('0x12')][_0x2646('0x13')]===0x1f4){logger[_0x2646('0x12')](_0x2646('0xe'),_0x3cac63,_0x2eda4d['error'][_0x2646('0x14')]);return _0x22796c(_0x2eda4d['error']['message']);}logger[_0x2646('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3cac63,_0x2eda4d[_0x2646('0x12')][_0x2646('0x14')]);return _0x4cde3e(_0x2eda4d[_0x2646('0x12')]['message']);}else{logger['info'](_0x2646('0xe'),_0x3cac63,_0x2646('0x15'));_0x4cde3e(_0x2eda4d['result']['message']);}})[_0x2646('0x16')](function(_0x29d0e6){logger[_0x2646('0x12')](_0x2646('0xe'),_0x3cac63,_0x29d0e6);_0x22796c(_0x29d0e6);});});} \ No newline at end of file +var _0xbc0e=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0xbc0e,0x104));var _0xebc0=function(_0x53711a,_0x251274){_0x53711a=_0x53711a-0x0;var _0x22a3e6=_0xbc0e[_0x53711a];return _0x22a3e6;};'use strict';var _=require(_0xebc0('0x0'));var util=require(_0xebc0('0x1'));var moment=require('moment');var BPromise=require(_0xebc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebc0('0x3'))['db'];var utils=require(_0xebc0('0x4'));var logger=require(_0xebc0('0x5'))(_0xebc0('0x6'));var config=require(_0xebc0('0x7'));var jayson=require(_0xebc0('0x8'));var client=jayson[_0xebc0('0x9')][_0xebc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29baab,_0x4243ae,_0x559f79){return new BPromise(function(_0x3137f7,_0x3e9684){return client[_0xebc0('0xb')](_0x29baab,_0x559f79)[_0xebc0('0xc')](function(_0x2f3836){logger[_0xebc0('0xd')](_0xebc0('0xe'),_0x4243ae,_0xebc0('0xf'));logger['debug'](_0xebc0('0x10'),_0x4243ae,_0xebc0('0xf'),JSON[_0xebc0('0x11')](_0x2f3836));if(_0x2f3836[_0xebc0('0x12')]){if(_0x2f3836[_0xebc0('0x12')][_0xebc0('0x13')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4243ae,_0x2f3836[_0xebc0('0x12')][_0xebc0('0x14')]);return _0x3e9684(_0x2f3836['error'][_0xebc0('0x14')]);}logger[_0xebc0('0x12')](_0xebc0('0xe'),_0x4243ae,_0x2f3836[_0xebc0('0x12')]['message']);return _0x3137f7(_0x2f3836[_0xebc0('0x12')][_0xebc0('0x14')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4243ae,_0xebc0('0xf'));_0x3137f7(_0x2f3836[_0xebc0('0x15')][_0xebc0('0x14')]);}})[_0xebc0('0x16')](function(_0x5b1e7c){logger[_0xebc0('0x12')](_0xebc0('0xe'),_0x4243ae,_0x5b1e7c);_0x3e9684(_0x5b1e7c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 71f5069..68e5103 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 _0x6d44=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','./pause.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x6d44,0xea));var _0x46d4=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0x6d44[_0x26dda0];return _0x41089c;};'use strict';var multer=require(_0x46d4('0x0'));var util=require(_0x46d4('0x1'));var path=require(_0x46d4('0x2'));var timeout=require(_0x46d4('0x3'));var express=require(_0x46d4('0x4'));var router=express[_0x46d4('0x5')]();var auth=require(_0x46d4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x46d4('0x7'));router[_0x46d4('0x8')]('/',auth[_0x46d4('0x9')](),controller[_0x46d4('0xa')]);router[_0x46d4('0x8')](_0x46d4('0xb'),auth[_0x46d4('0x9')](),controller['show']);router[_0x46d4('0xc')]('/',auth[_0x46d4('0x9')](),controller[_0x46d4('0xd')]);router[_0x46d4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x46d4('0xf')]);router['delete'](_0x46d4('0xb'),auth[_0x46d4('0x9')](),controller[_0x46d4('0x10')]);module[_0x46d4('0x11')]=router; \ No newline at end of file +var _0xd5ca=['index','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xd5ca,0x125));var _0xad5c=function(_0x161a40,_0x149fdc){_0x161a40=_0x161a40-0x0;var _0x15b961=_0xd5ca[_0x161a40];return _0x15b961;};'use strict';var multer=require(_0xad5c('0x0'));var util=require('util');var path=require(_0xad5c('0x1'));var timeout=require(_0xad5c('0x2'));var express=require(_0xad5c('0x3'));var router=express[_0xad5c('0x4')]();var auth=require(_0xad5c('0x5'));var interaction=require(_0xad5c('0x6'));var config=require(_0xad5c('0x7'));var controller=require(_0xad5c('0x8'));router[_0xad5c('0x9')]('/',auth[_0xad5c('0xa')](),controller[_0xad5c('0xb')]);router[_0xad5c('0x9')](_0xad5c('0xc'),auth[_0xad5c('0xa')](),controller[_0xad5c('0xd')]);router['post']('/',auth[_0xad5c('0xa')](),controller[_0xad5c('0xe')]);router['put'](_0xad5c('0xc'),auth[_0xad5c('0xa')](),controller[_0xad5c('0xf')]);router[_0xad5c('0x10')](_0xad5c('0xc'),auth[_0xad5c('0xa')](),controller[_0xad5c('0x11')]);module[_0xad5c('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 19ccb96..b227232 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 _0x337a=['sequelize','STRING','name'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x337a,0x165));var _0xa337=function(_0x400329,_0x56b6e4){_0x400329=_0x400329-0x0;var _0x300398=_0x337a[_0x400329];return _0x300398;};'use strict';var Sequelize=require(_0xa337('0x0'));module['exports']={'name':{'type':Sequelize[_0xa337('0x1')],'unique':_0xa337('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa337('0x1')]}}; \ No newline at end of file +var _0x5600=['exports','STRING','sequelize'];(function(_0x2a2f52,_0x37a983){var _0x1e1816=function(_0x35d531){while(--_0x35d531){_0x2a2f52['push'](_0x2a2f52['shift']());}};_0x1e1816(++_0x37a983);}(_0x5600,0x143));var _0x0560=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x5600[_0x454165];return _0x56db53;};'use strict';var Sequelize=require(_0x0560('0x0'));module[_0x0560('0x1')]={'name':{'type':Sequelize[_0x0560('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0560('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6ab340a..50c0260 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 _0x8f41=['reject','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','Pause','rows','catch','show','params','fields','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','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','apply'];(function(_0x413ba1,_0x4b9538){var _0xdc41ae=function(_0x4fe9d2){while(--_0x4fe9d2){_0x413ba1['push'](_0x413ba1['shift']());}};_0xdc41ae(++_0x4b9538);}(_0x8f41,0x120));var _0x18f4=function(_0x5a2fba,_0x4b63fb){_0x5a2fba=_0x5a2fba-0x0;var _0x219ee4=_0x8f41[_0x5a2fba];return _0x219ee4;};'use strict';var pdf=require(_0x18f4('0x0'));var emlformat=require(_0x18f4('0x1'));var rimraf=require(_0x18f4('0x2'));var zipdir=require(_0x18f4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18f4('0x4'));var moment=require(_0x18f4('0x5'));var BPromise=require(_0x18f4('0x6'));var Mustache=require(_0x18f4('0x7'));var util=require(_0x18f4('0x8'));var path=require('path');var sox=require(_0x18f4('0x9'));var csv=require('to-csv');var ejs=require(_0x18f4('0xa'));var fs=require('fs');var _=require(_0x18f4('0xb'));var squel=require(_0x18f4('0xc'));var crypto=require('crypto');var jsforce=require(_0x18f4('0xd'));var deskjs=require(_0x18f4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18f4('0xf'));var Redis=require(_0x18f4('0x10'));var authService=require(_0x18f4('0x11'));var qs=require(_0x18f4('0x12'));var as=require(_0x18f4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18f4('0x14'))(_0x18f4('0x15'));var utils=require(_0x18f4('0x16'));var config=require(_0x18f4('0x17'));var db=require(_0x18f4('0x18'))['db'];function respondWithStatusCode(_0x356029,_0xcc5052){_0xcc5052=_0xcc5052||0xcc;return function(_0x3b4315){if(_0x3b4315){return _0x356029['sendStatus'](_0xcc5052);}return _0x356029[_0x18f4('0x19')](_0xcc5052)[_0x18f4('0x1a')]();};}function respondWithResult(_0x497c30,_0x46979a){_0x46979a=_0x46979a||0xc8;return function(_0x4f892b){if(_0x4f892b){return _0x497c30[_0x18f4('0x19')](_0x46979a)['json'](_0x4f892b);}};}function respondWithFilteredResult(_0x45ae7b,_0x46009d){return function(_0x1dceb){if(_0x1dceb){var _0x35398a=_0x1dceb[_0x18f4('0x1b')],_0x19eb1f=_0x46009d['offset'],_0x4cf798=_0x46009d[_0x18f4('0x1c')]+_0x46009d[_0x18f4('0x1d')],_0x2f22bb;if(_0x4cf798>=_0x35398a){_0x4cf798=_0x35398a;_0x2f22bb=0xc8;}else{_0x2f22bb=0xce;}_0x45ae7b[_0x18f4('0x19')](_0x2f22bb);return _0x45ae7b['set'](_0x18f4('0x1e'),_0x19eb1f+'-'+_0x4cf798+'/'+_0x35398a)['json'](_0x1dceb);}return null;};}function patchUpdates(_0xc1197e){return function(_0x533714){try{jsonpatch[_0x18f4('0x1f')](_0x533714,_0xc1197e,!![]);}catch(_0x45971e){return BPromise[_0x18f4('0x20')](_0x45971e);}return _0x533714[_0x18f4('0x21')]();};}function saveUpdates(_0x3c28ec,_0xc323d4){return function(_0x48c610){if(_0x48c610){return _0x48c610[_0x18f4('0x22')](_0x3c28ec)[_0x18f4('0x23')](function(_0x38bd81){return _0x38bd81;});}return null;};}function removeEntity(_0x3a5609,_0x541435){return function(_0x3291ce){if(_0x3291ce){return _0x3291ce[_0x18f4('0x24')]()[_0x18f4('0x23')](function(){var _0x33240f=_0x3291ce['get']({'plain':!![]});var _0x2c1c36=_0x18f4('0x25');return db[_0x18f4('0x26')][_0x18f4('0x24')]({'where':{'type':_0x2c1c36,'resourceId':_0x33240f['id']}})[_0x18f4('0x23')](function(){return _0x3291ce;});})['then'](function(){_0x3a5609[_0x18f4('0x19')](0xcc)[_0x18f4('0x1a')]();});}};}function handleEntityNotFound(_0x4a0f92,_0x328bff){return function(_0x2ebd3f){if(!_0x2ebd3f){_0x4a0f92[_0x18f4('0x27')](0x194);}return _0x2ebd3f;};}function handleError(_0x20a3f5,_0x14466f){_0x14466f=_0x14466f||0x1f4;return function(_0x4a03ad){logger['error'](_0x4a03ad[_0x18f4('0x28')]);if(_0x4a03ad[_0x18f4('0x29')]){delete _0x4a03ad['name'];}_0x20a3f5[_0x18f4('0x19')](_0x14466f)[_0x18f4('0x2a')](_0x4a03ad);};}exports[_0x18f4('0x2b')]=function(_0x4fa898,_0x369024){var _0x28b5d7={},_0xf81f4a={},_0x44e501={'count':0x0,'rows':[]};var _0x3417af=_[_0x18f4('0x2c')](db['Pause'][_0x18f4('0x2d')],function(_0x4356aa){return{'name':_0x4356aa['fieldName'],'type':_0x4356aa[_0x18f4('0x2e')][_0x18f4('0x2f')]};});_0xf81f4a[_0x18f4('0x30')]=_[_0x18f4('0x2c')](_0x3417af,'name');_0xf81f4a['query']=_[_0x18f4('0x31')](_0x4fa898[_0x18f4('0x32')]);_0xf81f4a[_0x18f4('0x33')]=_[_0x18f4('0x34')](_0xf81f4a['model'],_0xf81f4a['query']);_0x28b5d7[_0x18f4('0x35')]=_['intersection'](_0xf81f4a[_0x18f4('0x30')],qs['fields'](_0x4fa898[_0x18f4('0x32')]['fields']));_0x28b5d7[_0x18f4('0x35')]=_0x28b5d7[_0x18f4('0x35')]['length']?_0x28b5d7['attributes']:_0xf81f4a[_0x18f4('0x30')];if(!_0x4fa898[_0x18f4('0x32')][_0x18f4('0x36')](_0x18f4('0x37'))){_0x28b5d7['limit']=qs[_0x18f4('0x1d')](_0x4fa898[_0x18f4('0x32')][_0x18f4('0x1d')]);_0x28b5d7[_0x18f4('0x1c')]=qs['offset'](_0x4fa898[_0x18f4('0x32')][_0x18f4('0x1c')]);}_0x28b5d7[_0x18f4('0x38')]=qs['sort'](_0x4fa898['query'][_0x18f4('0x39')]);_0x28b5d7[_0x18f4('0x3a')]=qs['filters'](_['pick'](_0x4fa898['query'],_0xf81f4a[_0x18f4('0x33')]),_0x3417af);if(_0x4fa898[_0x18f4('0x32')][_0x18f4('0x3b')]){_0x28b5d7[_0x18f4('0x3a')]=_[_0x18f4('0x3c')](_0x28b5d7['where'],{'$or':_[_0x18f4('0x2c')](_0x3417af,function(_0x5db6f8){if(_0x5db6f8[_0x18f4('0x2e')]!==_0x18f4('0x3d')){var _0x4980e8={};_0x4980e8[_0x5db6f8[_0x18f4('0x29')]]={'$like':'%'+_0x4fa898[_0x18f4('0x32')]['filter']+'%'};return _0x4980e8;}})});}_0x28b5d7=_['merge']({},_0x28b5d7,_0x4fa898['options']);var _0x51ca8e={'where':_0x28b5d7[_0x18f4('0x3a')]};return db['Pause'][_0x18f4('0x1b')](_0x51ca8e)['then'](function(_0x2c443e){_0x44e501[_0x18f4('0x1b')]=_0x2c443e;if(_0x4fa898['query'][_0x18f4('0x3e')]){_0x28b5d7[_0x18f4('0x3f')]=[{'all':!![]}];}return db[_0x18f4('0x40')]['findAll'](_0x28b5d7);})['then'](function(_0x104806){_0x44e501[_0x18f4('0x41')]=_0x104806;return _0x44e501;})[_0x18f4('0x23')](respondWithFilteredResult(_0x369024,_0x28b5d7))[_0x18f4('0x42')](handleError(_0x369024,null));};exports[_0x18f4('0x43')]=function(_0x22d57a,_0x53aae1){var _0x171310={'raw':!![],'where':{'id':_0x22d57a[_0x18f4('0x44')]['id']}},_0x32a2ba={};_0x32a2ba[_0x18f4('0x30')]=_[_0x18f4('0x31')](db[_0x18f4('0x40')]['rawAttributes']);_0x32a2ba[_0x18f4('0x32')]=_[_0x18f4('0x31')](_0x22d57a[_0x18f4('0x32')]);_0x32a2ba[_0x18f4('0x33')]=_[_0x18f4('0x34')](_0x32a2ba[_0x18f4('0x30')],_0x32a2ba['query']);_0x171310[_0x18f4('0x35')]=_[_0x18f4('0x34')](_0x32a2ba[_0x18f4('0x30')],qs[_0x18f4('0x45')](_0x22d57a[_0x18f4('0x32')]['fields']));_0x171310[_0x18f4('0x35')]=_0x171310[_0x18f4('0x35')]['length']?_0x171310[_0x18f4('0x35')]:_0x32a2ba['model'];if(_0x22d57a[_0x18f4('0x32')][_0x18f4('0x3e')]){_0x171310[_0x18f4('0x3f')]=[{'all':!![]}];}_0x171310=_[_0x18f4('0x3c')]({},_0x171310,_0x22d57a['options']);return db[_0x18f4('0x40')][_0x18f4('0x46')](_0x171310)[_0x18f4('0x23')](handleEntityNotFound(_0x53aae1,null))[_0x18f4('0x23')](respondWithResult(_0x53aae1,null))[_0x18f4('0x42')](handleError(_0x53aae1,null));};exports['create']=function(_0x5d3811,_0x46fc0e){return db[_0x18f4('0x40')][_0x18f4('0x47')](_0x5d3811[_0x18f4('0x48')],{})[_0x18f4('0x23')](function(_0x1340fd){var _0x2f2ec0=_0x5d3811[_0x18f4('0x49')]['get']({'plain':!![]});if(!_0x2f2ec0)throw new Error(_0x18f4('0x4a'));if(_0x2f2ec0[_0x18f4('0x4b')]===_0x18f4('0x49')){var _0x16cbb3=_0x1340fd['get']({'plain':!![]});var _0x25c3a7=_0x18f4('0x25');return db[_0x18f4('0x4c')][_0x18f4('0x46')]({'where':{'name':_0x25c3a7,'userProfileId':_0x2f2ec0[_0x18f4('0x4d')]},'raw':!![]})[_0x18f4('0x23')](function(_0x15fcf8){if(_0x15fcf8&&_0x15fcf8[_0x18f4('0x4e')]===0x0){return db[_0x18f4('0x26')][_0x18f4('0x47')]({'name':_0x16cbb3['name'],'resourceId':_0x16cbb3['id'],'type':_0x15fcf8[_0x18f4('0x29')],'sectionId':_0x15fcf8['id']},{})[_0x18f4('0x23')](function(){return _0x1340fd;});}else{return _0x1340fd;}})['catch'](function(_0x28eb9f){logger['error'](_0x18f4('0x4f'),_0x28eb9f);throw _0x28eb9f;});}return _0x1340fd;})[_0x18f4('0x23')](respondWithResult(_0x46fc0e,0xc9))[_0x18f4('0x42')](handleError(_0x46fc0e,null));};exports['update']=function(_0x4f465e,_0x536b09){if(_0x4f465e[_0x18f4('0x48')]['id']){delete _0x4f465e['body']['id'];}return db[_0x18f4('0x40')][_0x18f4('0x46')]({'where':{'id':_0x4f465e[_0x18f4('0x44')]['id']}})[_0x18f4('0x23')](handleEntityNotFound(_0x536b09,null))[_0x18f4('0x23')](saveUpdates(_0x4f465e[_0x18f4('0x48')],null))[_0x18f4('0x23')](respondWithResult(_0x536b09,null))[_0x18f4('0x42')](handleError(_0x536b09,null));};exports[_0x18f4('0x24')]=function(_0x4f6045,_0x15cca0){return db[_0x18f4('0x40')]['find']({'where':{'id':_0x4f6045[_0x18f4('0x44')]['id']}})[_0x18f4('0x23')](handleEntityNotFound(_0x15cca0,null))[_0x18f4('0x23')](removeEntity(_0x15cca0,null))[_0x18f4('0x42')](handleError(_0x15cca0,null));}; \ No newline at end of file +var _0x311e=['save','update','get','Pauses','UserProfileResource','destroy','error','name','send','index','map','Pause','rawAttributes','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','pick','merge','type','VIRTUAL','filter','where','count','includeAll','findAll','rows','then','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','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','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x4b4889,_0x41cc03){var _0x38aac9=function(_0x514501){while(--_0x514501){_0x4b4889['push'](_0x4b4889['shift']());}};_0x38aac9(++_0x41cc03);}(_0x311e,0x186));var _0xe311=function(_0x32f437,_0x1c9f12){_0x32f437=_0x32f437-0x0;var _0x376b8c=_0x311e[_0x32f437];return _0x376b8c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe311('0x0'));var rimraf=require(_0xe311('0x1'));var zipdir=require(_0xe311('0x2'));var jsonpatch=require(_0xe311('0x3'));var rp=require(_0xe311('0x4'));var moment=require(_0xe311('0x5'));var BPromise=require(_0xe311('0x6'));var Mustache=require('mustache');var util=require(_0xe311('0x7'));var path=require(_0xe311('0x8'));var sox=require('sox');var csv=require(_0xe311('0x9'));var ejs=require(_0xe311('0xa'));var fs=require('fs');var _=require(_0xe311('0xb'));var squel=require(_0xe311('0xc'));var crypto=require(_0xe311('0xd'));var jsforce=require(_0xe311('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe311('0xf'));var Papa=require(_0xe311('0x10'));var Redis=require('ioredis');var authService=require(_0xe311('0x11'));var qs=require(_0xe311('0x12'));var as=require(_0xe311('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe311('0x14'))(_0xe311('0x15'));var utils=require(_0xe311('0x16'));var config=require(_0xe311('0x17'));var db=require(_0xe311('0x18'))['db'];function respondWithStatusCode(_0xa84fce,_0x22a565){_0x22a565=_0x22a565||0xcc;return function(_0x38cf8a){if(_0x38cf8a){return _0xa84fce[_0xe311('0x19')](_0x22a565);}return _0xa84fce[_0xe311('0x1a')](_0x22a565)[_0xe311('0x1b')]();};}function respondWithResult(_0x3dd616,_0x1510e9){_0x1510e9=_0x1510e9||0xc8;return function(_0x26b69d){if(_0x26b69d){return _0x3dd616[_0xe311('0x1a')](_0x1510e9)[_0xe311('0x1c')](_0x26b69d);}};}function respondWithFilteredResult(_0x47a8b4,_0x3bf92d){return function(_0x6baa5a){if(_0x6baa5a){var _0x36d398=_0x6baa5a['count'],_0x41753d=_0x3bf92d[_0xe311('0x1d')],_0x24a35b=_0x3bf92d[_0xe311('0x1d')]+_0x3bf92d[_0xe311('0x1e')],_0x10a3ea;if(_0x24a35b>=_0x36d398){_0x24a35b=_0x36d398;_0x10a3ea=0xc8;}else{_0x10a3ea=0xce;}_0x47a8b4['status'](_0x10a3ea);return _0x47a8b4[_0xe311('0x1f')](_0xe311('0x20'),_0x41753d+'-'+_0x24a35b+'/'+_0x36d398)['json'](_0x6baa5a);}return null;};}function patchUpdates(_0x4e26f0){return function(_0xcabf0c){try{jsonpatch[_0xe311('0x21')](_0xcabf0c,_0x4e26f0,!![]);}catch(_0x5425bf){return BPromise[_0xe311('0x22')](_0x5425bf);}return _0xcabf0c[_0xe311('0x23')]();};}function saveUpdates(_0x7229ff,_0xcd8e84){return function(_0x8d1742){if(_0x8d1742){return _0x8d1742[_0xe311('0x24')](_0x7229ff)['then'](function(_0x48218e){return _0x48218e;});}return null;};}function removeEntity(_0xa2eb7f,_0x5cc5d2){return function(_0x4f26c8){if(_0x4f26c8){return _0x4f26c8['destroy']()['then'](function(){var _0x16edb0=_0x4f26c8[_0xe311('0x25')]({'plain':!![]});var _0x1ad6ce=_0xe311('0x26');return db[_0xe311('0x27')][_0xe311('0x28')]({'where':{'type':_0x1ad6ce,'resourceId':_0x16edb0['id']}})['then'](function(){return _0x4f26c8;});})['then'](function(){_0xa2eb7f[_0xe311('0x1a')](0xcc)[_0xe311('0x1b')]();});}};}function handleEntityNotFound(_0x1cea65,_0xc5edbb){return function(_0x9b7cb4){if(!_0x9b7cb4){_0x1cea65[_0xe311('0x19')](0x194);}return _0x9b7cb4;};}function handleError(_0x57005e,_0x207870){_0x207870=_0x207870||0x1f4;return function(_0x12cdac){logger[_0xe311('0x29')](_0x12cdac['stack']);if(_0x12cdac[_0xe311('0x2a')]){delete _0x12cdac['name'];}_0x57005e[_0xe311('0x1a')](_0x207870)[_0xe311('0x2b')](_0x12cdac);};}exports[_0xe311('0x2c')]=function(_0x58acac,_0x1fca49){var _0x262949={},_0x3382fb={},_0x16982a={'count':0x0,'rows':[]};var _0x398eff=_[_0xe311('0x2d')](db[_0xe311('0x2e')][_0xe311('0x2f')],function(_0x25e580){return{'name':_0x25e580['fieldName'],'type':_0x25e580['type'][_0xe311('0x30')]};});_0x3382fb[_0xe311('0x31')]=_[_0xe311('0x2d')](_0x398eff,_0xe311('0x2a'));_0x3382fb['query']=_[_0xe311('0x32')](_0x58acac['query']);_0x3382fb[_0xe311('0x33')]=_['intersection'](_0x3382fb[_0xe311('0x31')],_0x3382fb['query']);_0x262949[_0xe311('0x34')]=_[_0xe311('0x35')](_0x3382fb['model'],qs[_0xe311('0x36')](_0x58acac[_0xe311('0x37')]['fields']));_0x262949[_0xe311('0x34')]=_0x262949['attributes'][_0xe311('0x38')]?_0x262949[_0xe311('0x34')]:_0x3382fb[_0xe311('0x31')];if(!_0x58acac['query'][_0xe311('0x39')](_0xe311('0x3a'))){_0x262949[_0xe311('0x1e')]=qs['limit'](_0x58acac[_0xe311('0x37')]['limit']);_0x262949[_0xe311('0x1d')]=qs[_0xe311('0x1d')](_0x58acac[_0xe311('0x37')][_0xe311('0x1d')]);}_0x262949[_0xe311('0x3b')]=qs['sort'](_0x58acac[_0xe311('0x37')]['sort']);_0x262949['where']=qs['filters'](_[_0xe311('0x3c')](_0x58acac[_0xe311('0x37')],_0x3382fb[_0xe311('0x33')]),_0x398eff);if(_0x58acac[_0xe311('0x37')]['filter']){_0x262949['where']=_[_0xe311('0x3d')](_0x262949['where'],{'$or':_[_0xe311('0x2d')](_0x398eff,function(_0x596f3e){if(_0x596f3e[_0xe311('0x3e')]!==_0xe311('0x3f')){var _0x41d679={};_0x41d679[_0x596f3e[_0xe311('0x2a')]]={'$like':'%'+_0x58acac[_0xe311('0x37')][_0xe311('0x40')]+'%'};return _0x41d679;}})});}_0x262949=_[_0xe311('0x3d')]({},_0x262949,_0x58acac['options']);var _0xc25c1c={'where':_0x262949[_0xe311('0x41')]};return db['Pause']['count'](_0xc25c1c)['then'](function(_0x8be283){_0x16982a[_0xe311('0x42')]=_0x8be283;if(_0x58acac['query'][_0xe311('0x43')]){_0x262949['include']=[{'all':!![]}];}return db[_0xe311('0x2e')][_0xe311('0x44')](_0x262949);})['then'](function(_0x4abf5d){_0x16982a[_0xe311('0x45')]=_0x4abf5d;return _0x16982a;})[_0xe311('0x46')](respondWithFilteredResult(_0x1fca49,_0x262949))[_0xe311('0x47')](handleError(_0x1fca49,null));};exports[_0xe311('0x48')]=function(_0x8e18fc,_0x533ca0){var _0x40ba1b={'raw':!![],'where':{'id':_0x8e18fc[_0xe311('0x49')]['id']}},_0x206a12={};_0x206a12[_0xe311('0x31')]=_[_0xe311('0x32')](db[_0xe311('0x2e')][_0xe311('0x2f')]);_0x206a12[_0xe311('0x37')]=_[_0xe311('0x32')](_0x8e18fc[_0xe311('0x37')]);_0x206a12[_0xe311('0x33')]=_[_0xe311('0x35')](_0x206a12[_0xe311('0x31')],_0x206a12[_0xe311('0x37')]);_0x40ba1b[_0xe311('0x34')]=_[_0xe311('0x35')](_0x206a12[_0xe311('0x31')],qs[_0xe311('0x36')](_0x8e18fc[_0xe311('0x37')][_0xe311('0x36')]));_0x40ba1b['attributes']=_0x40ba1b[_0xe311('0x34')]['length']?_0x40ba1b[_0xe311('0x34')]:_0x206a12[_0xe311('0x31')];if(_0x8e18fc['query'][_0xe311('0x43')]){_0x40ba1b[_0xe311('0x4a')]=[{'all':!![]}];}_0x40ba1b=_[_0xe311('0x3d')]({},_0x40ba1b,_0x8e18fc[_0xe311('0x4b')]);return db['Pause']['find'](_0x40ba1b)[_0xe311('0x46')](handleEntityNotFound(_0x533ca0,null))['then'](respondWithResult(_0x533ca0,null))[_0xe311('0x47')](handleError(_0x533ca0,null));};exports[_0xe311('0x4c')]=function(_0x49ed51,_0x566014){return db['Pause'][_0xe311('0x4c')](_0x49ed51[_0xe311('0x4d')],{})[_0xe311('0x46')](function(_0x2e5f6b){var _0x400ddf=_0x49ed51[_0xe311('0x4e')][_0xe311('0x25')]({'plain':!![]});if(!_0x400ddf)throw new Error(_0xe311('0x4f'));if(_0x400ddf[_0xe311('0x50')]===_0xe311('0x4e')){var _0x5c198e=_0x2e5f6b[_0xe311('0x25')]({'plain':!![]});var _0x409928=_0xe311('0x26');return db[_0xe311('0x51')][_0xe311('0x52')]({'where':{'name':_0x409928,'userProfileId':_0x400ddf['userProfileId']},'raw':!![]})['then'](function(_0x1b3ad7){if(_0x1b3ad7&&_0x1b3ad7[_0xe311('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c198e[_0xe311('0x2a')],'resourceId':_0x5c198e['id'],'type':_0x1b3ad7[_0xe311('0x2a')],'sectionId':_0x1b3ad7['id']},{})[_0xe311('0x46')](function(){return _0x2e5f6b;});}else{return _0x2e5f6b;}})[_0xe311('0x47')](function(_0x37546e){logger[_0xe311('0x29')](_0xe311('0x54'),_0x37546e);throw _0x37546e;});}return _0x2e5f6b;})[_0xe311('0x46')](respondWithResult(_0x566014,0xc9))['catch'](handleError(_0x566014,null));};exports[_0xe311('0x24')]=function(_0x33a7bd,_0x2d3663){if(_0x33a7bd[_0xe311('0x4d')]['id']){delete _0x33a7bd['body']['id'];}return db[_0xe311('0x2e')][_0xe311('0x52')]({'where':{'id':_0x33a7bd[_0xe311('0x49')]['id']}})[_0xe311('0x46')](handleEntityNotFound(_0x2d3663,null))['then'](saveUpdates(_0x33a7bd['body'],null))[_0xe311('0x46')](respondWithResult(_0x2d3663,null))[_0xe311('0x47')](handleError(_0x2d3663,null));};exports[_0xe311('0x28')]=function(_0x495b25,_0x298de7){return db[_0xe311('0x2e')][_0xe311('0x52')]({'where':{'id':_0x495b25[_0xe311('0x49')]['id']}})[_0xe311('0x46')](handleEntityNotFound(_0x298de7,null))[_0xe311('0x46')](removeEntity(_0x298de7,null))[_0xe311('0x47')](handleError(_0x298de7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 80925d6..3a66297 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 _0x3e69=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses'];(function(_0x2c42ff,_0x553f52){var _0x38605f=function(_0x1a5537){while(--_0x1a5537){_0x2c42ff['push'](_0x2c42ff['shift']());}};_0x38605f(++_0x553f52);}(_0x3e69,0x1c7));var _0x93e6=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x3e69[_0x37a9d7];return _0x1343d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93e6('0x0'))(_0x93e6('0x1'));var moment=require(_0x93e6('0x2'));var BPromise=require(_0x93e6('0x3'));var rp=require(_0x93e6('0x4'));var fs=require('fs');var path=require(_0x93e6('0x5'));var rimraf=require(_0x93e6('0x6'));var config=require(_0x93e6('0x7'));var attributes=require(_0x93e6('0x8'));module[_0x93e6('0x9')]=function(_0x4fa799,_0x557733){return _0x4fa799[_0x93e6('0xa')](_0x93e6('0xb'),attributes,{'tableName':_0x93e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f05=['bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','define','Pause','tools_pauses','lodash','util','api','moment'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x3f05,0x175));var _0x53f0=function(_0x475330,_0xde8222){_0x475330=_0x475330-0x0;var _0x2a2895=_0x3f05[_0x475330];return _0x2a2895;};'use strict';var _=require(_0x53f0('0x0'));var util=require(_0x53f0('0x1'));var logger=require('../../config/logger')(_0x53f0('0x2'));var moment=require(_0x53f0('0x3'));var BPromise=require(_0x53f0('0x4'));var rp=require(_0x53f0('0x5'));var fs=require('fs');var path=require(_0x53f0('0x6'));var rimraf=require(_0x53f0('0x7'));var config=require(_0x53f0('0x8'));var attributes=require(_0x53f0('0x9'));module['exports']=function(_0x4f514f,_0x4ddfbf){return _0x4f514f[_0x53f0('0xa')](_0x53f0('0xb'),attributes,{'tableName':_0x53f0('0xc'),'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 53e9936..77137c2 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 _0x4fdc=['options','raw','where','attributes','include','model','map','then','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowPause','Pause'];(function(_0x374459,_0x49ea0a){var _0x3da4ab=function(_0x1a2f6c){while(--_0x1a2f6c){_0x374459['push'](_0x374459['shift']());}};_0x3da4ab(++_0x49ea0a);}(_0x4fdc,0x84));var _0xc4fd=function(_0x25305c,_0x40f0d0){_0x25305c=_0x25305c-0x0;var _0x57459e=_0x4fdc[_0x25305c];return _0x57459e;};'use strict';var _=require('lodash');var util=require(_0xc4fd('0x0'));var moment=require('moment');var BPromise=require(_0xc4fd('0x1'));var rs=require(_0xc4fd('0x2'));var fs=require('fs');var Redis=require(_0xc4fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4fd('0x4'));var logger=require(_0xc4fd('0x5'))(_0xc4fd('0x6'));var config=require(_0xc4fd('0x7'));var jayson=require(_0xc4fd('0x8'));var client=jayson[_0xc4fd('0x9')][_0xc4fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57502f,_0x473a38,_0x355b9f){return new BPromise(function(_0x4962d7,_0x72b9e3){return client['request'](_0x57502f,_0x355b9f)['then'](function(_0x448be9){logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x473a38,_0xc4fd('0xd'));logger[_0xc4fd('0xe')](_0xc4fd('0xf'),_0x473a38,_0xc4fd('0xd'),JSON[_0xc4fd('0x10')](_0x448be9));if(_0x448be9['error']){if(_0x448be9['error'][_0xc4fd('0x11')]===0x1f4){logger[_0xc4fd('0x12')](_0xc4fd('0xc'),_0x473a38,_0x448be9['error'][_0xc4fd('0x13')]);return _0x72b9e3(_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);}logger[_0xc4fd('0x12')](_0xc4fd('0xc'),_0x473a38,_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);return _0x4962d7(_0x448be9[_0xc4fd('0x12')][_0xc4fd('0x13')]);}else{logger['info'](_0xc4fd('0xc'),_0x473a38,'request\x20sent');_0x4962d7(_0x448be9['result'][_0xc4fd('0x13')]);}})[_0xc4fd('0x14')](function(_0x533217){logger['error'](_0xc4fd('0xc'),_0x473a38,_0x533217);_0x72b9e3(_0x533217);});});}exports[_0xc4fd('0x15')]=function(_0x2bc246){var _0x4137d0=this;return new Promise(function(_0xaf6c46,_0x314206){return db[_0xc4fd('0x16')]['find']({'raw':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x18')]===undefined?!![]:![]:!![],'where':_0x2bc246['options']?_0x2bc246['options'][_0xc4fd('0x19')]||null:null,'attributes':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x1a')]||null:null,'include':_0x2bc246[_0xc4fd('0x17')]?_0x2bc246[_0xc4fd('0x17')]['include']?_['map'](_0x2bc246[_0xc4fd('0x17')][_0xc4fd('0x1b')],function(_0x569ef2){return{'model':db[_0x569ef2[_0xc4fd('0x1c')]],'as':_0x569ef2['as'],'attributes':_0x569ef2[_0xc4fd('0x1a')],'include':_0x569ef2[_0xc4fd('0x1b')]?_[_0xc4fd('0x1d')](_0x569ef2[_0xc4fd('0x1b')],function(_0x19be38){return{'model':db[_0x19be38['model']],'as':_0x19be38['as'],'attributes':_0x19be38[_0xc4fd('0x1a')],'include':_0x19be38[_0xc4fd('0x1b')]?_[_0xc4fd('0x1d')](_0x19be38[_0xc4fd('0x1b')],function(_0xd46ae1){return{'model':db[_0xd46ae1[_0xc4fd('0x1c')]],'as':_0xd46ae1['as'],'attributes':_0xd46ae1[_0xc4fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc4fd('0x1e')](function(_0x1c0810){logger['info']('ShowPause',_0x2bc246);logger[_0xc4fd('0xe')](_0xc4fd('0x15'),_0x2bc246,JSON[_0xc4fd('0x10')](_0x1c0810));_0xaf6c46(_0x1c0810);})[_0xc4fd('0x14')](function(_0x38ac21){logger[_0xc4fd('0x12')]('ShowPause',_0x38ac21[_0xc4fd('0x13')],_0x2bc246);_0x314206(_0x4137d0[_0xc4fd('0x12')](0x1f4,_0x38ac21[_0xc4fd('0x13')]));});});}; \ No newline at end of file +var _0xe868=['request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s'];(function(_0x496116,_0x41264b){var _0x5df691=function(_0x345f2e){while(--_0x345f2e){_0x496116['push'](_0x496116['shift']());}};_0x5df691(++_0x41264b);}(_0xe868,0x75));var _0x8e86=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe868[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8e86('0x0'));var util=require(_0x8e86('0x1'));var moment=require(_0x8e86('0x2'));var BPromise=require(_0x8e86('0x3'));var rs=require(_0x8e86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e86('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e86('0x6'));var config=require(_0x8e86('0x7'));var jayson=require(_0x8e86('0x8'));var client=jayson[_0x8e86('0x9')][_0x8e86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x248bb8,_0x54158c,_0x45cb92){return new BPromise(function(_0x1171d0,_0x442342){return client[_0x8e86('0xb')](_0x248bb8,_0x45cb92)[_0x8e86('0xc')](function(_0x58d9da){logger[_0x8e86('0xd')](_0x8e86('0xe'),_0x54158c,_0x8e86('0xf'));logger[_0x8e86('0x10')](_0x8e86('0x11'),_0x54158c,'request\x20sent',JSON[_0x8e86('0x12')](_0x58d9da));if(_0x58d9da[_0x8e86('0x13')]){if(_0x58d9da[_0x8e86('0x13')][_0x8e86('0x14')]===0x1f4){logger[_0x8e86('0x13')](_0x8e86('0xe'),_0x54158c,_0x58d9da['error'][_0x8e86('0x15')]);return _0x442342(_0x58d9da[_0x8e86('0x13')][_0x8e86('0x15')]);}logger[_0x8e86('0x13')](_0x8e86('0xe'),_0x54158c,_0x58d9da[_0x8e86('0x13')]['message']);return _0x1171d0(_0x58d9da[_0x8e86('0x13')][_0x8e86('0x15')]);}else{logger[_0x8e86('0xd')](_0x8e86('0xe'),_0x54158c,_0x8e86('0xf'));_0x1171d0(_0x58d9da[_0x8e86('0x16')][_0x8e86('0x15')]);}})[_0x8e86('0x17')](function(_0x2ef0ae){logger[_0x8e86('0x13')](_0x8e86('0xe'),_0x54158c,_0x2ef0ae);_0x442342(_0x2ef0ae);});});}exports[_0x8e86('0x18')]=function(_0x4371a5){var _0x2f8df2=this;return new Promise(function(_0x5a135a,_0x56066a){return db['Pause'][_0x8e86('0x19')]({'raw':_0x4371a5['options']?_0x4371a5['options'][_0x8e86('0x1a')]===undefined?!![]:![]:!![],'where':_0x4371a5[_0x8e86('0x1b')]?_0x4371a5[_0x8e86('0x1b')][_0x8e86('0x1c')]||null:null,'attributes':_0x4371a5['options']?_0x4371a5[_0x8e86('0x1b')][_0x8e86('0x1d')]||null:null,'include':_0x4371a5[_0x8e86('0x1b')]?_0x4371a5[_0x8e86('0x1b')][_0x8e86('0x1e')]?_[_0x8e86('0x1f')](_0x4371a5[_0x8e86('0x1b')][_0x8e86('0x1e')],function(_0x5069a9){return{'model':db[_0x5069a9[_0x8e86('0x20')]],'as':_0x5069a9['as'],'attributes':_0x5069a9['attributes'],'include':_0x5069a9['include']?_['map'](_0x5069a9[_0x8e86('0x1e')],function(_0x2342bb){return{'model':db[_0x2342bb[_0x8e86('0x20')]],'as':_0x2342bb['as'],'attributes':_0x2342bb['attributes'],'include':_0x2342bb['include']?_[_0x8e86('0x1f')](_0x2342bb[_0x8e86('0x1e')],function(_0x3b5f8d){return{'model':db[_0x3b5f8d[_0x8e86('0x20')]],'as':_0x3b5f8d['as'],'attributes':_0x3b5f8d[_0x8e86('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e86('0xc')](function(_0x2fbdc1){logger[_0x8e86('0xd')](_0x8e86('0x18'),_0x4371a5);logger[_0x8e86('0x10')](_0x8e86('0x18'),_0x4371a5,JSON[_0x8e86('0x12')](_0x2fbdc1));_0x5a135a(_0x2fbdc1);})[_0x8e86('0x17')](function(_0xec0b57){logger['error'](_0x8e86('0x18'),_0xec0b57[_0x8e86('0x15')],_0x4371a5);_0x56066a(_0x2f8df2[_0x8e86('0x13')](0x1f4,_0xec0b57[_0x8e86('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8e55484..cf59119 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 _0x1ee4=['/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','extname','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index'];(function(_0x334672,_0x42f550){var _0x7cb6dc=function(_0x212934){while(--_0x212934){_0x334672['push'](_0x334672['shift']());}};_0x7cb6dc(++_0x42f550);}(_0x1ee4,0x10e));var _0x41ee=function(_0x2a3405,_0x33235d){_0x2a3405=_0x2a3405-0x0;var _0x333d60=_0x1ee4[_0x2a3405];return _0x333d60;};'use strict';var multer=require(_0x41ee('0x0'));var util=require(_0x41ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x41ee('0x2'));var router=express['Router']();var auth=require(_0x41ee('0x3'));var interaction=require(_0x41ee('0x4'));var config=require(_0x41ee('0x5'));var controller=require(_0x41ee('0x6'));router[_0x41ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x41ee('0x8')]);router['get'](_0x41ee('0x9'),controller[_0x41ee('0xa')]);router[_0x41ee('0x7')](_0x41ee('0xb'),auth['isAuthenticated'](),controller[_0x41ee('0xc')]);router['get'](_0x41ee('0xd'),auth['isAuthenticated'](),controller[_0x41ee('0xe')]);var upload=multer({'storage':multer[_0x41ee('0xf')]({'destination':function(_0x23ccdb,_0x2c9ab9,_0x5103e4){_0x5103e4(null,path[_0x41ee('0x10')](config['root'],_0x41ee('0x11')));},'filename':function(_0x46e5b4,_0x4df038,_0xbe7220){_0x4df038[_0x41ee('0x12')]=_0x4df038[_0x41ee('0x12')][_0x41ee('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xbe7220(null,util['format'](_0x41ee('0x14'),path['basename'](_0x4df038[_0x41ee('0x12')],path[_0x41ee('0x15')](_0x4df038[_0x41ee('0x12')])),Date['now'](),path[_0x41ee('0x15')](_0x4df038[_0x41ee('0x12')])));}})});router[_0x41ee('0x16')]('/',upload[_0x41ee('0x17')](_0x41ee('0x18')),controller[_0x41ee('0x19')]);router[_0x41ee('0x16')](_0x41ee('0x9'),controller[_0x41ee('0x1a')]);router['put'](_0x41ee('0xb'),auth[_0x41ee('0x1b')](),controller[_0x41ee('0x1c')]);router[_0x41ee('0x1d')](_0x41ee('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0x41ee('0x1e')]=router; \ No newline at end of file +var _0x7115=['index','/:id','show','/:id/download','join','server/files/plugins','originalname','replace','basename','extname','now','post','single','upload','/webhook','webhookPost','put','update','exports','multer','util','path','Router','get','isAuthenticated'];(function(_0x5c2bb8,_0x7d5589){var _0x3d7891=function(_0x1dddc9){while(--_0x1dddc9){_0x5c2bb8['push'](_0x5c2bb8['shift']());}};_0x3d7891(++_0x7d5589);}(_0x7115,0x1d5));var _0x5711=function(_0xe89382,_0x3480a4){_0xe89382=_0xe89382-0x0;var _0x28f382=_0x7115[_0xe89382];return _0x28f382;};'use strict';var multer=require(_0x5711('0x0'));var util=require(_0x5711('0x1'));var path=require(_0x5711('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5711('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./plugin.controller');router[_0x5711('0x4')]('/',auth[_0x5711('0x5')](),controller[_0x5711('0x6')]);router[_0x5711('0x4')]('/webhook',controller['webhookGet']);router[_0x5711('0x4')](_0x5711('0x7'),auth['isAuthenticated'](),controller[_0x5711('0x8')]);router[_0x5711('0x4')](_0x5711('0x9'),auth[_0x5711('0x5')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b29ee,_0x8c8669,_0x1921d9){_0x1921d9(null,path[_0x5711('0xa')](config['root'],_0x5711('0xb')));},'filename':function(_0x32e6f2,_0x417bef,_0xe970cb){_0x417bef['originalname']=_0x417bef[_0x5711('0xc')][_0x5711('0xd')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe970cb(null,util['format']('%s-%s%s',path[_0x5711('0xe')](_0x417bef['originalname'],path[_0x5711('0xf')](_0x417bef[_0x5711('0xc')])),Date[_0x5711('0x10')](),path['extname'](_0x417bef[_0x5711('0xc')])));}})});router[_0x5711('0x11')]('/',upload[_0x5711('0x12')]('file'),controller[_0x5711('0x13')]);router[_0x5711('0x11')](_0x5711('0x14'),controller[_0x5711('0x15')]);router[_0x5711('0x16')](_0x5711('0x7'),auth[_0x5711('0x5')](),controller[_0x5711('0x17')]);router['delete'](_0x5711('0x7'),auth[_0x5711('0x5')](),controller['delete']);module[_0x5711('0x18')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 7ce4e27..8707560 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 _0x8982=['exports','STRING','ENUM','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x3fc341,_0x4b3342){var _0x2593ac=function(_0x5c834a){while(--_0x5c834a){_0x3fc341['push'](_0x3fc341['shift']());}};_0x2593ac(++_0x4b3342);}(_0x8982,0x64));var _0x2898=function(_0xaa99fe,_0x358171){_0xaa99fe=_0xaa99fe-0x0;var _0x4bdc46=_0x8982[_0xaa99fe];return _0x4bdc46;};'use strict';var Sequelize=require('sequelize');module[_0x2898('0x0')]={'name':{'type':Sequelize[_0x2898('0x1')]},'type':{'type':Sequelize[_0x2898('0x2')]('html',_0x2898('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x2898('0x4')]},'path':{'type':Sequelize[_0x2898('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2898('0x5')],'defaultValue':0x0,'comment':_0x2898('0x6')},'sidebar':{'type':Sequelize[_0x2898('0x2')]('adminOnly','agentOnly',_0x2898('0x7'),_0x2898('0x8')),'defaultValue':'always','comment':_0x2898('0x9')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x2898('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x2898('0x1')]},'scriptPath':{'type':Sequelize[_0x2898('0x1')]}}; \ No newline at end of file +var _0xe977=['exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x26f949,_0x4986bf){var _0x490159=function(_0x5eaa4a){while(--_0x5eaa4a){_0x26f949['push'](_0x26f949['shift']());}};_0x490159(++_0x4986bf);}(_0xe977,0x9c));var _0x7e97=function(_0x591729,_0x273002){_0x591729=_0x591729-0x0;var _0x1f5b56=_0xe977[_0x591729];return _0x1f5b56;};'use strict';var Sequelize=require('sequelize');module[_0x7e97('0x0')]={'name':{'type':Sequelize[_0x7e97('0x1')]},'type':{'type':Sequelize[_0x7e97('0x2')](_0x7e97('0x3'),'script')},'description':{'type':Sequelize[_0x7e97('0x4')]},'version':{'type':Sequelize[_0x7e97('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x7e97('0x5')},'active':{'type':Sequelize[_0x7e97('0x6')],'defaultValue':0x0,'comment':_0x7e97('0x7')},'sidebar':{'type':Sequelize[_0x7e97('0x2')]('adminOnly',_0x7e97('0x8'),_0x7e97('0x9'),_0x7e97('0xa')),'defaultValue':'always','comment':_0x7e97('0xb')},'icon':{'type':Sequelize[_0x7e97('0x1')]},'adminUrl':{'type':Sequelize[_0x7e97('0x1')]},'agentUrl':{'type':Sequelize[_0x7e97('0x1')]},'scriptName':{'type':Sequelize[_0x7e97('0x1')]},'scriptPath':{'type':Sequelize[_0x7e97('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 74a45d4..ad5354d 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 _0x54e9=['parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','version','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','hostname','%s%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','Plugins','UserProfileResource','sendStatus','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','join','root','server/files/plugins','dirname','attachments/**/*','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','info','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','readFileSync'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x54e9,0x17d));var _0x954e=function(_0x15f3b4,_0x2e3bc0){_0x15f3b4=_0x15f3b4-0x0;var _0x52b23a=_0x54e9[_0x15f3b4];return _0x52b23a;};'use strict';var pdf=require(_0x954e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x954e('0x1'));var zipdir=require(_0x954e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x954e('0x3'));var moment=require(_0x954e('0x4'));var BPromise=require(_0x954e('0x5'));var Mustache=require('mustache');var util=require(_0x954e('0x6'));var path=require(_0x954e('0x7'));var sox=require(_0x954e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x954e('0x9'));var squel=require(_0x954e('0xa'));var crypto=require(_0x954e('0xb'));var jsforce=require(_0x954e('0xc'));var deskjs=require(_0x954e('0xd'));var toCsv=require(_0x954e('0xe'));var querystring=require(_0x954e('0xf'));var Papa=require(_0x954e('0x10'));var extract=require(_0x954e('0x11'));var rimraf=require('rimraf');var archiver=require(_0x954e('0x12'));var Redis=require('ioredis');var authService=require(_0x954e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x954e('0x14'));var hardwareService=require(_0x954e('0x15'));var logger=require('../../config/logger')(_0x954e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x954e('0x17'))['db'];config['redis']=_[_0x954e('0x18')](config[_0x954e('0x19')],{'host':_0x954e('0x1a'),'port':0x18eb});var socket=require(_0x954e('0x1b'))(new Redis(config['redis']));require(_0x954e('0x1c'))[_0x954e('0x1d')](socket);function respondWithStatusCode(_0x4f23ea,_0x32aa53){_0x32aa53=_0x32aa53||0xcc;return function(_0x324c12){if(_0x324c12){return _0x4f23ea['sendStatus'](_0x32aa53);}return _0x4f23ea[_0x954e('0x1e')](_0x32aa53)[_0x954e('0x1f')]();};}function respondWithResult(_0x469304,_0x520443){_0x520443=_0x520443||0xc8;return function(_0x11504b){if(_0x11504b){return _0x469304[_0x954e('0x1e')](_0x520443)[_0x954e('0x20')](_0x11504b);}};}function respondWithFilteredResult(_0x4f5bfe,_0x2f1ac8){return function(_0x1da058){if(_0x1da058){var _0x5174ef=_0x1da058[_0x954e('0x21')],_0x5ad096=_0x2f1ac8[_0x954e('0x22')],_0x20cbbf=_0x2f1ac8[_0x954e('0x22')]+_0x2f1ac8[_0x954e('0x23')],_0x1a913e;if(_0x20cbbf>=_0x5174ef){_0x20cbbf=_0x5174ef;_0x1a913e=0xc8;}else{_0x1a913e=0xce;}_0x4f5bfe[_0x954e('0x1e')](_0x1a913e);return _0x4f5bfe[_0x954e('0x24')](_0x954e('0x25'),_0x5ad096+'-'+_0x20cbbf+'/'+_0x5174ef)[_0x954e('0x20')](_0x1da058);}return null;};}function patchUpdates(_0x5c4ba9){return function(_0x427ccf){try{jsonpatch['apply'](_0x427ccf,_0x5c4ba9,!![]);}catch(_0x1d9deb){return BPromise[_0x954e('0x26')](_0x1d9deb);}return _0x427ccf[_0x954e('0x27')]();};}function saveUpdates(_0x33d8ad,_0x18a46f){return function(_0x147af3){if(_0x147af3){return _0x147af3['update'](_0x33d8ad)[_0x954e('0x28')](function(_0x2dd0fa){return _0x2dd0fa;});}return null;};}function removeEntity(_0x38d72a,_0x5e82c8){return function(_0x1c6d2c){if(_0x1c6d2c){return _0x1c6d2c[_0x954e('0x29')]()[_0x954e('0x28')](function(){var _0x452408=_0x1c6d2c['get']({'plain':!![]});var _0x33e59a=_0x954e('0x2a');return db[_0x954e('0x2b')][_0x954e('0x29')]({'where':{'type':_0x33e59a,'resourceId':_0x452408['id']}})[_0x954e('0x28')](function(){return _0x1c6d2c;});})[_0x954e('0x28')](function(){_0x38d72a[_0x954e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177cf0,_0x2e25a8){return function(_0x2f0151){if(!_0x2f0151){_0x177cf0[_0x954e('0x2c')](0x194);}return _0x2f0151;};}function handleError(_0x3be91e,_0xa027ff){_0xa027ff=_0xa027ff||0x1f4;return function(_0x19a790){logger[_0x954e('0x2d')](_0x19a790['stack']);if(_0x19a790['name']){delete _0x19a790[_0x954e('0x2e')];}_0x3be91e[_0x954e('0x1e')](_0xa027ff)[_0x954e('0x2f')](_0x19a790);};}exports[_0x954e('0x30')]=function(_0x5a0423,_0x1ca9b9){var _0xaa32a7={},_0x1f9042={},_0x3e68a0={'count':0x0,'rows':[]};var _0x3ccc49=_[_0x954e('0x31')](db[_0x954e('0x32')][_0x954e('0x33')],function(_0x3c2f84){return{'name':_0x3c2f84[_0x954e('0x34')],'type':_0x3c2f84[_0x954e('0x35')]['key']};});_0x1f9042['model']=_['map'](_0x3ccc49,'name');_0x1f9042[_0x954e('0x36')]=_['keys'](_0x5a0423[_0x954e('0x36')]);_0x1f9042[_0x954e('0x37')]=_[_0x954e('0x38')](_0x1f9042[_0x954e('0x39')],_0x1f9042[_0x954e('0x36')]);_0xaa32a7[_0x954e('0x3a')]=_[_0x954e('0x38')](_0x1f9042['model'],qs[_0x954e('0x3b')](_0x5a0423[_0x954e('0x36')][_0x954e('0x3b')]));_0xaa32a7[_0x954e('0x3a')]=_0xaa32a7[_0x954e('0x3a')][_0x954e('0x3c')]?_0xaa32a7[_0x954e('0x3a')]:_0x1f9042[_0x954e('0x39')];if(!_0x5a0423[_0x954e('0x36')][_0x954e('0x3d')](_0x954e('0x3e'))){_0xaa32a7[_0x954e('0x23')]=qs['limit'](_0x5a0423[_0x954e('0x36')][_0x954e('0x23')]);_0xaa32a7[_0x954e('0x22')]=qs[_0x954e('0x22')](_0x5a0423['query']['offset']);}_0xaa32a7['order']=qs[_0x954e('0x3f')](_0x5a0423[_0x954e('0x36')][_0x954e('0x3f')]);_0xaa32a7[_0x954e('0x40')]=qs[_0x954e('0x37')](_['pick'](_0x5a0423['query'],_0x1f9042[_0x954e('0x37')]),_0x3ccc49);if(_0x5a0423['query'][_0x954e('0x41')]){_0xaa32a7[_0x954e('0x40')]=_['merge'](_0xaa32a7[_0x954e('0x40')],{'$or':_['map'](_0x3ccc49,function(_0x8f33fa){if(_0x8f33fa[_0x954e('0x35')]!=='VIRTUAL'){var _0x982506={};_0x982506[_0x8f33fa[_0x954e('0x2e')]]={'$like':'%'+_0x5a0423[_0x954e('0x36')][_0x954e('0x41')]+'%'};return _0x982506;}})});}_0xaa32a7=_[_0x954e('0x42')]({},_0xaa32a7,_0x5a0423[_0x954e('0x43')]);var _0x575b65={'where':_0xaa32a7[_0x954e('0x40')]};return db[_0x954e('0x32')][_0x954e('0x21')](_0x575b65)[_0x954e('0x28')](function(_0x3349f6){_0x3e68a0[_0x954e('0x21')]=_0x3349f6;if(_0x5a0423['query'][_0x954e('0x44')]){_0xaa32a7[_0x954e('0x45')]=[{'all':!![]}];}return db[_0x954e('0x32')][_0x954e('0x46')](_0xaa32a7);})[_0x954e('0x28')](function(_0x101304){_0x3e68a0[_0x954e('0x47')]=_0x101304;return _0x3e68a0;})['then'](respondWithFilteredResult(_0x1ca9b9,_0xaa32a7))[_0x954e('0x48')](handleError(_0x1ca9b9,null));};exports['show']=function(_0x455776,_0x18b93d){var _0x3e4f4b={'raw':!![],'where':{'id':_0x455776[_0x954e('0x49')]['id']}},_0x2190f4={};_0x2190f4[_0x954e('0x39')]=_['keys'](db[_0x954e('0x32')][_0x954e('0x33')]);_0x2190f4[_0x954e('0x36')]=_[_0x954e('0x4a')](_0x455776[_0x954e('0x36')]);_0x2190f4[_0x954e('0x37')]=_[_0x954e('0x38')](_0x2190f4[_0x954e('0x39')],_0x2190f4['query']);_0x3e4f4b[_0x954e('0x3a')]=_[_0x954e('0x38')](_0x2190f4['model'],qs[_0x954e('0x3b')](_0x455776['query'][_0x954e('0x3b')]));_0x3e4f4b[_0x954e('0x3a')]=_0x3e4f4b[_0x954e('0x3a')]['length']?_0x3e4f4b[_0x954e('0x3a')]:_0x2190f4['model'];if(_0x455776[_0x954e('0x36')][_0x954e('0x44')]){_0x3e4f4b[_0x954e('0x45')]=[{'all':!![]}];}_0x3e4f4b=_[_0x954e('0x42')]({},_0x3e4f4b,_0x455776[_0x954e('0x43')]);return db['Plugin'][_0x954e('0x4b')](_0x3e4f4b)[_0x954e('0x28')](handleEntityNotFound(_0x18b93d,null))[_0x954e('0x28')](respondWithResult(_0x18b93d,null))[_0x954e('0x48')](handleError(_0x18b93d,null));};exports['download']=function(_0x313f76,_0x52e0f1,_0x37238d){return db[_0x954e('0x32')][_0x954e('0x4b')]({'where':{'id':_0x313f76['params']['id']},'attributes':[_0x954e('0x2e'),_0x954e('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x52e0f1,null))[_0x954e('0x28')](function(_0x5982b6){if(_0x5982b6){var _0x3c6d6c=path['join'](config['root'],'server/files/plugins',util[_0x954e('0x4c')](_0x954e('0x4d'),path[_0x954e('0x4e')](_0x5982b6[_0x954e('0x7')])));var _0x5abff0=fs[_0x954e('0x4f')](_0x3c6d6c);var _0x38ee77=archiver(_0x954e('0x50'),{'zlib':{'level':0x9}});_0x38ee77['on'](_0x954e('0x51'),function(_0x3ad6d5){if(_0x3ad6d5[_0x954e('0x52')]===_0x954e('0x53')){logger[_0x954e('0x2d')](_0x3ad6d5);}else{throw new db['Sequelize']['Error'](_0x954e('0x54'));}});_0x38ee77['on'](_0x954e('0x2d'),function(_0x2d3ce2){throw new db[(_0x954e('0x55'))][(_0x954e('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x38ee77[_0x954e('0x57')](_0x5abff0);_0x38ee77[_0x954e('0x58')](_0x954e('0x59'),{'cwd':path[_0x954e('0x5a')](config[_0x954e('0x5b')],_0x954e('0x5c'),path[_0x954e('0x5d')](_0x5982b6[_0x954e('0x7')])),'ignore':[path[_0x954e('0x5a')](path[_0x954e('0x4e')](_0x5982b6['path']),'node_modules/**/*'),path[_0x954e('0x5a')](path[_0x954e('0x4e')](_0x5982b6['path']),_0x954e('0x5e'))],'nodir':!![]})['finalize']();_0x5abff0['on'](_0x954e('0x5f'),function(){if(!fs[_0x954e('0x60')](_0x3c6d6c)){throw new db[(_0x954e('0x55'))][(_0x954e('0x56'))]('Plugin\x20not\x20found');}return _0x52e0f1[_0x954e('0x61')](_0x3c6d6c,util['format'](_0x954e('0x4d'),path[_0x954e('0x4e')](_0x5982b6['path'])),function(_0x5144e5){if(_0x5144e5){throw new db[(_0x954e('0x55'))][(_0x954e('0x56'))](_0x954e('0x62'));}fs['unlinkSync'](_0x3c6d6c);logger[_0x954e('0x63')]('Download\x20completed');logger[_0x954e('0x63')]('Temporary\x20file\x20removed');});});}return null;})[_0x954e('0x48')](handleError(_0x52e0f1,null));};exports[_0x954e('0x64')]=function(_0x139a04,_0x5e7ed2,_0x3f9f1f){var _0x101abe=path[_0x954e('0x4e')](_0x139a04[_0x954e('0x65')]['filename'],path[_0x954e('0x66')](_0x139a04['file'][_0x954e('0x67')]));var _0x1eacaf=path[_0x954e('0x5a')](config[_0x954e('0x5b')],_0x954e('0x5c'),_0x139a04[_0x954e('0x65')]['filename']);var _0x33b35b=path[_0x954e('0x5a')](config['root'],_0x954e('0x5c'),_0x101abe);logger[_0x954e('0x63')](_0x954e('0x68'),_0x1eacaf);logger[_0x954e('0x63')](_0x954e('0x69'),_0x33b35b);try{fs[_0x954e('0x6a')](_0x1eacaf,parseInt(_0x954e('0x6b'),0x8));extract(_0x1eacaf,{'dir':_0x33b35b},function(_0x4b80c3){if(_0x4b80c3){logger[_0x954e('0x2d')](_0x4b80c3);handleError(_0x4b80c3,!![]);};var _0x349cfb=fs[_0x954e('0x6c')](_0x33b35b);if(_0x349cfb[_0x954e('0x3c')]>0x1){removeReferences(_0x1eacaf,_0x33b35b);logger[_0x954e('0x2d')](_0x954e('0x6d'));return _0x3f9f1f(new Error(_0x954e('0x6d')));}var _0x18f8d3=fs[_0x954e('0x6e')](path['join'](_0x33b35b,_0x349cfb[0x0]));if(_0x18f8d3['isFile']()){removeReferences(_0x1eacaf,_0x33b35b);logger[_0x954e('0x2d')](_0x954e('0x6d'));return _0x3f9f1f(new Error(_0x954e('0x6d')));}if(_0x18f8d3[_0x954e('0x6f')]()){var _0x29c035=fs[_0x954e('0x6c')](path[_0x954e('0x5a')](_0x33b35b,_0x349cfb[0x0]));if(_0x29c035[_0x954e('0x3c')]===0x0){removeReferences(_0x1eacaf,_0x33b35b);logger[_0x954e('0x2d')](_0x954e('0x6d'));return _0x3f9f1f(new Error(_0x954e('0x6d')));}var _0x47d97e=_0x29c035['some'](function(_0x178f58){return _0x178f58===_0x954e('0x70');});if(!_0x47d97e){return _0x3f9f1f(new Error('Plugin\x20manifest\x20missing'));}var _0x44f561=fs[_0x954e('0x71')](path[_0x954e('0x5a')](_0x33b35b,_0x349cfb[0x0],_0x954e('0x70')));var _0xe97e8b=JSON[_0x954e('0x72')](_0x44f561);if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x2e')]){return _0x3f9f1f(new Error(_0x954e('0x74')));}if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x35')]){return _0x3f9f1f(new Error(_0x954e('0x75')));}if('undefined'==typeof _0xe97e8b['version']){return _0x3f9f1f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')]){return _0x3f9f1f(new Error(_0x954e('0x77')));}if(_0xe97e8b[_0x954e('0x35')]===_0x954e('0x78')){if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')]['views']){return _0x3f9f1f(new Error(_0x954e('0x79')));}if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x7b')]&&_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')]['agent']){return _0x3f9f1f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xe97e8b[_0x954e('0x35')]===_0x954e('0x7c')){if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')]['scriptName']){return _0x3f9f1f(new Error(_0x954e('0x7d')));}if(_0x954e('0x73')==typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7e')]){return _0x3f9f1f(new Error(_0x954e('0x7f')));}}else{return _0x3f9f1f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x13379a=_0xe97e8b['name'];var _0x437250=_0xe97e8b['description'];var _0x242a37=_0xe97e8b[_0x954e('0x35')];var _0x86069f=_0xe97e8b['sidebar']?_0xe97e8b[_0x954e('0x80')]:'always';var _0x1c3286=_0xe97e8b[_0x954e('0x81')]?_0xe97e8b['icon']:'icon-apps';var _0x268119='';var _0x1eb406='';var _0x4e8dfe='';var _0x598041='';var _0x3a0e2a=_0xe97e8b[_0x954e('0x82')];if(_0x242a37==='html'){if(_0x954e('0x73')!=typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x7b')]){var _0x3cacec=_0xe97e8b[_0x954e('0x76')]['views'][_0x954e('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x954e('0x83')](_0x3cacec)){_0x268119=path[_0x954e('0x5a')](_0x954e('0x84'),_0x101abe,_0x349cfb[0x0],_0x3cacec);}else{_0x268119=_0x3cacec;}}else{logger[_0x954e('0x63')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x954e('0x73')!=typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x85')]){var _0x5c0290=_0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x954e('0x83')](_0x5c0290)){_0x1eb406=path[_0x954e('0x5a')](_0x954e('0x84'),_0x101abe,_0x349cfb[0x0],_0x5c0290);}else{_0x1eb406=_0x5c0290;}}else{logger[_0x954e('0x63')](_0x954e('0x86'));}}else if(_0x242a37===_0x954e('0x7c')){_0x4e8dfe=_0xe97e8b[_0x954e('0x76')][_0x954e('0x87')];_0x598041=_0xe97e8b[_0x954e('0x76')][_0x954e('0x7e')];if('undefined'!=typeof _0xe97e8b['parameters']['views']){if(_0x954e('0x73')!=typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x7b')]){var _0x3cacec=_0xe97e8b['parameters'][_0x954e('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x954e('0x83')](_0x3cacec)){_0x268119=path[_0x954e('0x5a')]('plugins',_0x101abe,_0x349cfb[0x0],_0x3cacec);}else{_0x268119=_0x3cacec;}}if(_0x954e('0x73')!=typeof _0xe97e8b[_0x954e('0x76')][_0x954e('0x7a')][_0x954e('0x85')]){var _0x5c0290=_0xe97e8b[_0x954e('0x76')]['views'][_0x954e('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x954e('0x83')](_0x5c0290)){_0x1eb406=path[_0x954e('0x5a')](_0x954e('0x84'),_0x101abe,_0x349cfb[0x0],_0x5c0290);}else{_0x1eb406=_0x5c0290;}}}}var _0x52a2b5={'name':_0x13379a,'description':_0x437250,'path':path['join'](_0x101abe,_0x349cfb[0x0]),'type':_0x242a37,'sidebar':_0x86069f,'icon':_0x1c3286,'adminUrl':_0x268119,'agentUrl':_0x1eb406,'scriptName':_0x4e8dfe,'scriptPath':_0x598041,'version':_0x3a0e2a};removeReferences(_0x1eacaf,null);return db['Plugin'][_0x954e('0x88')](_0x52a2b5)[_0x954e('0x28')](function(_0xa98398){var _0x19b9ea={'role':_0x139a04[_0x954e('0x89')]['role'],'userProfileId':_0x139a04['body'][_0x954e('0x8a')]};if(!_0x19b9ea)throw new Error(_0x954e('0x8b'));if(_0x19b9ea[_0x954e('0x8c')]===_0x954e('0x8d')){var _0x1897e8=_0xa98398[_0x954e('0x8e')]({'plain':!![]});return db[_0x954e('0x8f')]['find']({'where':{'name':_0x954e('0x2a'),'userProfileId':_0x19b9ea[_0x954e('0x8a')]},'raw':!![]})[_0x954e('0x28')](function(_0x2538d3){if(_0x2538d3&&_0x2538d3[_0x954e('0x90')]===0x0){return db[_0x954e('0x2b')][_0x954e('0x88')]({'name':_0x1897e8[_0x954e('0x2e')],'resourceId':_0x1897e8['id'],'type':_0x2538d3[_0x954e('0x2e')],'sectionId':_0x2538d3['id']},{})[_0x954e('0x28')](function(){return _0xa98398;});}else{return _0xa98398;}})[_0x954e('0x48')](function(_0x3d03e1){logger[_0x954e('0x2d')](_0x954e('0x91'),_0x3d03e1);throw _0x3d03e1;});}return _0xa98398;})[_0x954e('0x28')](respondWithResult(_0x5e7ed2,null))['catch'](handleError(_0x5e7ed2,null));}});}catch(_0x51efca){_0x5e7ed2[_0x954e('0x1e')](0x1f4)['send'](_0x51efca);}};function removeReferences(_0x5afbf2,_0x1fac20){try{if(_0x5afbf2){fs[_0x954e('0x92')](_0x5afbf2);logger[_0x954e('0x63')]('Zip\x20archive\x20removed');}if(_0x1fac20){rimraf(_0x1fac20,function(){});logger[_0x954e('0x63')](_0x954e('0x93'));}}catch(_0x92f937){logger[_0x954e('0x2d')](_0x92f937);}}exports[_0x954e('0x94')]=function(_0x39cf4a,_0x246ba6,_0x41fab9){return db[_0x954e('0x32')][_0x954e('0x4b')]({'where':{'id':_0x39cf4a[_0x954e('0x49')]['id']}})[_0x954e('0x28')](handleEntityNotFound(_0x246ba6,null))[_0x954e('0x28')](saveUpdates(_0x39cf4a[_0x954e('0x89')],null))[_0x954e('0x28')](respondWithResult(_0x246ba6,null))[_0x954e('0x48')](handleError(_0x246ba6,null));};exports[_0x954e('0x95')]=function(_0x93724f,_0x47d671,_0x41f51c){return db['Plugin']['find']({'where':{'id':_0x93724f[_0x954e('0x49')]['id']}})[_0x954e('0x28')](function(_0x2e58a9){if(_0x2e58a9){return _0x2e58a9[_0x954e('0x29')]();}})[_0x954e('0x28')](function(_0x3abebd){rimraf(path[_0x954e('0x5a')](config['root'],'server/files/plugins',path[_0x954e('0x5d')](_0x3abebd[_0x954e('0x7')])),function(){});return _0x3abebd;})[_0x954e('0x28')](handleEntityNotFound(_0x47d671,null))['then'](respondWithStatusCode(_0x47d671,null))[_0x954e('0x48')](handleError(_0x47d671,null));};exports[_0x954e('0x96')]=function(_0x4f124a,_0x1ab185,_0x1b5fb9){return BPromise[_0x954e('0x97')]()['then'](function(){if(!_0x4f124a['query'][_0x954e('0x7')]){throw new Error(_0x954e('0x98'));}if(!_0x4f124a[_0x954e('0x36')][_0x954e('0x99')]){throw new Error(_0x954e('0x9a'));}var _0x35fd6c=_0x4f124a[_0x954e('0x36')]['hostname']?_0x4f124a[_0x954e('0x36')]['hostname']+':'+_0x4f124a['query']['port']:_0x954e('0x9b')+_0x4f124a[_0x954e('0x36')][_0x954e('0x99')];var _0x1b2c38=_0x4f124a[_0x954e('0x36')][_0x954e('0x20')]?_0x4f124a[_0x954e('0x36')][_0x954e('0x20')]:!![];var _0x370a21=_0x4f124a[_0x954e('0x36')][_0x954e('0x9c')]?_0x4f124a['query'][_0x954e('0x9c')]:null;var _0x4a8af5={'method':_0x4f124a[_0x954e('0x9d')],'uri':util[_0x954e('0x4c')]('%s%s',_0x35fd6c,_0x4f124a[_0x954e('0x36')]['path']),'json':_0x1b2c38,'resolveWithFullResponse':!![],'encoding':_0x370a21,'qs':_0x4f124a[_0x954e('0x36')]};if(_0x4f124a[_0x954e('0x9e')]){_0x4a8af5[_0x954e('0x9e')]=_0x4f124a[_0x954e('0x9e')];if(_0x4a8af5[_0x954e('0x9e')][_0x954e('0x9f')]){delete _0x4a8af5[_0x954e('0x9e')][_0x954e('0x9f')];}}if(_0x4a8af5['headers'][_0x954e('0xa0')]){delete _0x4a8af5[_0x954e('0x9e')][_0x954e('0xa0')];}return rp(_0x4a8af5);})[_0x954e('0x28')](function(_0x4d6f07){if(_0x4d6f07){_0x1ab185[_0x954e('0x24')](_0x4d6f07[_0x954e('0x9e')]);logger['info'](_0x4d6f07['body']);if(_[_0x954e('0xa1')](_0x4f124a[_0x954e('0x36')]['path'],_0x954e('0x61'))&&_0x4d6f07[_0x954e('0xa2')]==0x1f4){return _0x1ab185[_0x954e('0x2c')](_0x4d6f07[_0x954e('0xa2')]);}else{return _0x1ab185[_0x954e('0x1e')](_0x4d6f07[_0x954e('0xa2')])['send'](_0x4d6f07[_0x954e('0x89')]);}}else{return _0x1ab185['sendStatus'](0xc8);}})[_0x954e('0x48')](handleError(_0x1ab185,null));};exports['webhookPost']=function(_0x1715da,_0x94a5d3,_0x14e027){return BPromise[_0x954e('0x97')]()[_0x954e('0x28')](function(){if(!_0x1715da[_0x954e('0x36')][_0x954e('0x7')]){throw new Error(_0x954e('0x98'));}if(!_0x1715da['query'][_0x954e('0x99')]){throw new Error(_0x954e('0x9a'));}var _0x4ba726=_0x1715da[_0x954e('0x36')][_0x954e('0xa3')]?_0x1715da[_0x954e('0x36')][_0x954e('0xa3')]+':'+_0x1715da[_0x954e('0x36')][_0x954e('0x99')]:_0x954e('0x9b')+_0x1715da[_0x954e('0x36')]['port'];var _0x42c7dd=_0x1715da['query']['json']?_0x1715da[_0x954e('0x36')][_0x954e('0x20')]:!![];var _0x49555b=_0x1715da[_0x954e('0x36')]['encoding']?_0x1715da['query'][_0x954e('0x9c')]:null;var _0x5e12e6={'method':_0x1715da['method'],'uri':util[_0x954e('0x4c')](_0x954e('0xa4'),_0x4ba726,_0x1715da[_0x954e('0x36')][_0x954e('0x7')]),'json':_0x42c7dd,'resolveWithFullResponse':!![],'encoding':_0x49555b,'body':_0x1715da[_0x954e('0x89')]};if(_0x1715da[_0x954e('0x9e')]){_0x5e12e6[_0x954e('0x9e')]=_0x1715da['headers'];if(_0x5e12e6['headers'][_0x954e('0x9f')]){delete _0x5e12e6[_0x954e('0x9e')][_0x954e('0x9f')];}}if(_0x5e12e6[_0x954e('0x9e')][_0x954e('0xa0')]){delete _0x5e12e6[_0x954e('0x9e')][_0x954e('0xa0')];}return rp(_0x5e12e6);})[_0x954e('0x28')](function(_0x210d22){if(_0x210d22){_0x94a5d3['set'](_0x210d22[_0x954e('0x9e')]);logger[_0x954e('0x63')](_0x210d22['body']);return _0x94a5d3[_0x954e('0x1e')](_0x210d22[_0x954e('0xa2')])[_0x954e('0x2f')](_0x210d22[_0x954e('0x89')]);}else{return _0x94a5d3[_0x954e('0x2c')](0xc8);}})[_0x954e('0x48')](handleError(_0x94a5d3,null));}; \ No newline at end of file +var _0x77d7=['destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','parse','undefined','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','hostname','http://localhost:','method','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x55e07d,_0x337180){var _0x567b64=function(_0x4421a0){while(--_0x4421a0){_0x55e07d['push'](_0x55e07d['shift']());}};_0x567b64(++_0x337180);}(_0x77d7,0x1d4));var _0x777d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x77d7[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x777d('0x0'));var emlformat=require(_0x777d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x777d('0x2'));var jsonpatch=require(_0x777d('0x3'));var rp=require(_0x777d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x777d('0x5'));var path=require(_0x777d('0x6'));var sox=require('sox');var csv=require(_0x777d('0x7'));var ejs=require(_0x777d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x777d('0x9'));var jsforce=require(_0x777d('0xa'));var deskjs=require(_0x777d('0xb'));var toCsv=require(_0x777d('0x7'));var querystring=require(_0x777d('0xc'));var Papa=require(_0x777d('0xd'));var extract=require(_0x777d('0xe'));var rimraf=require(_0x777d('0xf'));var archiver=require(_0x777d('0x10'));var Redis=require(_0x777d('0x11'));var authService=require(_0x777d('0x12'));var qs=require(_0x777d('0x13'));var as=require(_0x777d('0x14'));var hardwareService=require(_0x777d('0x15'));var logger=require(_0x777d('0x16'))(_0x777d('0x17'));var utils=require('../../config/utils');var config=require(_0x777d('0x18'));var db=require(_0x777d('0x19'))['db'];config[_0x777d('0x1a')]=_['defaults'](config[_0x777d('0x1a')],{'host':_0x777d('0x1b'),'port':0x18eb});var socket=require(_0x777d('0x1c'))(new Redis(config[_0x777d('0x1a')]));require(_0x777d('0x1d'))[_0x777d('0x1e')](socket);function respondWithStatusCode(_0x11018b,_0x4e13b3){_0x4e13b3=_0x4e13b3||0xcc;return function(_0x24497f){if(_0x24497f){return _0x11018b[_0x777d('0x1f')](_0x4e13b3);}return _0x11018b[_0x777d('0x20')](_0x4e13b3)[_0x777d('0x21')]();};}function respondWithResult(_0x23ccf4,_0x5cc426){_0x5cc426=_0x5cc426||0xc8;return function(_0x3746eb){if(_0x3746eb){return _0x23ccf4[_0x777d('0x20')](_0x5cc426)[_0x777d('0x22')](_0x3746eb);}};}function respondWithFilteredResult(_0x3f5410,_0x21e804){return function(_0x7bedeb){if(_0x7bedeb){var _0x4c394a=_0x7bedeb[_0x777d('0x23')],_0x171bda=_0x21e804[_0x777d('0x24')],_0x43a972=_0x21e804[_0x777d('0x24')]+_0x21e804[_0x777d('0x25')],_0x2c93e1;if(_0x43a972>=_0x4c394a){_0x43a972=_0x4c394a;_0x2c93e1=0xc8;}else{_0x2c93e1=0xce;}_0x3f5410[_0x777d('0x20')](_0x2c93e1);return _0x3f5410[_0x777d('0x26')](_0x777d('0x27'),_0x171bda+'-'+_0x43a972+'/'+_0x4c394a)['json'](_0x7bedeb);}return null;};}function patchUpdates(_0x55d6fe){return function(_0x9a5e6b){try{jsonpatch[_0x777d('0x28')](_0x9a5e6b,_0x55d6fe,!![]);}catch(_0x18e691){return BPromise[_0x777d('0x29')](_0x18e691);}return _0x9a5e6b[_0x777d('0x2a')]();};}function saveUpdates(_0x47f83e,_0x22c9fc){return function(_0x22f94d){if(_0x22f94d){return _0x22f94d[_0x777d('0x2b')](_0x47f83e)[_0x777d('0x2c')](function(_0x2a0e7c){return _0x2a0e7c;});}return null;};}function removeEntity(_0x3b7b2a,_0x2a654b){return function(_0x2593b6){if(_0x2593b6){return _0x2593b6[_0x777d('0x2d')]()['then'](function(){var _0x459fa0=_0x2593b6[_0x777d('0x2e')]({'plain':!![]});var _0x4b5556=_0x777d('0x2f');return db[_0x777d('0x30')][_0x777d('0x2d')]({'where':{'type':_0x4b5556,'resourceId':_0x459fa0['id']}})[_0x777d('0x2c')](function(){return _0x2593b6;});})[_0x777d('0x2c')](function(){_0x3b7b2a[_0x777d('0x20')](0xcc)[_0x777d('0x21')]();});}};}function handleEntityNotFound(_0x3a593f,_0x2e8dbb){return function(_0x229475){if(!_0x229475){_0x3a593f[_0x777d('0x1f')](0x194);}return _0x229475;};}function handleError(_0x73230d,_0x27583c){_0x27583c=_0x27583c||0x1f4;return function(_0x1c51cb){logger[_0x777d('0x31')](_0x1c51cb[_0x777d('0x32')]);if(_0x1c51cb[_0x777d('0x33')]){delete _0x1c51cb[_0x777d('0x33')];}_0x73230d[_0x777d('0x20')](_0x27583c)[_0x777d('0x34')](_0x1c51cb);};}exports[_0x777d('0x35')]=function(_0x4f633d,_0x29bb9c){var _0x208c8d={},_0x5c5d91={},_0xc7fa5b={'count':0x0,'rows':[]};var _0x37ca24=_[_0x777d('0x36')](db['Plugin'][_0x777d('0x37')],function(_0x5c24d0){return{'name':_0x5c24d0[_0x777d('0x38')],'type':_0x5c24d0[_0x777d('0x39')]['key']};});_0x5c5d91['model']=_[_0x777d('0x36')](_0x37ca24,_0x777d('0x33'));_0x5c5d91['query']=_[_0x777d('0x3a')](_0x4f633d[_0x777d('0x3b')]);_0x5c5d91[_0x777d('0x3c')]=_[_0x777d('0x3d')](_0x5c5d91[_0x777d('0x3e')],_0x5c5d91[_0x777d('0x3b')]);_0x208c8d[_0x777d('0x3f')]=_[_0x777d('0x3d')](_0x5c5d91[_0x777d('0x3e')],qs[_0x777d('0x40')](_0x4f633d['query'][_0x777d('0x40')]));_0x208c8d[_0x777d('0x3f')]=_0x208c8d[_0x777d('0x3f')][_0x777d('0x41')]?_0x208c8d[_0x777d('0x3f')]:_0x5c5d91[_0x777d('0x3e')];if(!_0x4f633d['query']['hasOwnProperty'](_0x777d('0x42'))){_0x208c8d[_0x777d('0x25')]=qs[_0x777d('0x25')](_0x4f633d['query'][_0x777d('0x25')]);_0x208c8d[_0x777d('0x24')]=qs[_0x777d('0x24')](_0x4f633d[_0x777d('0x3b')][_0x777d('0x24')]);}_0x208c8d[_0x777d('0x43')]=qs[_0x777d('0x44')](_0x4f633d['query']['sort']);_0x208c8d[_0x777d('0x45')]=qs['filters'](_['pick'](_0x4f633d[_0x777d('0x3b')],_0x5c5d91[_0x777d('0x3c')]),_0x37ca24);if(_0x4f633d['query'][_0x777d('0x46')]){_0x208c8d[_0x777d('0x45')]=_[_0x777d('0x47')](_0x208c8d['where'],{'$or':_[_0x777d('0x36')](_0x37ca24,function(_0x6ad933){if(_0x6ad933[_0x777d('0x39')]!==_0x777d('0x48')){var _0x3fdcf8={};_0x3fdcf8[_0x6ad933[_0x777d('0x33')]]={'$like':'%'+_0x4f633d[_0x777d('0x3b')][_0x777d('0x46')]+'%'};return _0x3fdcf8;}})});}_0x208c8d=_[_0x777d('0x47')]({},_0x208c8d,_0x4f633d[_0x777d('0x49')]);var _0x4c0f4f={'where':_0x208c8d[_0x777d('0x45')]};return db[_0x777d('0x4a')][_0x777d('0x23')](_0x4c0f4f)[_0x777d('0x2c')](function(_0x4fe30c){_0xc7fa5b[_0x777d('0x23')]=_0x4fe30c;if(_0x4f633d['query'][_0x777d('0x4b')]){_0x208c8d[_0x777d('0x4c')]=[{'all':!![]}];}return db[_0x777d('0x4a')][_0x777d('0x4d')](_0x208c8d);})[_0x777d('0x2c')](function(_0x2ecdf6){_0xc7fa5b[_0x777d('0x4e')]=_0x2ecdf6;return _0xc7fa5b;})['then'](respondWithFilteredResult(_0x29bb9c,_0x208c8d))[_0x777d('0x4f')](handleError(_0x29bb9c,null));};exports[_0x777d('0x50')]=function(_0x5667e2,_0xa5b191){var _0x4e3837={'raw':!![],'where':{'id':_0x5667e2[_0x777d('0x51')]['id']}},_0x356bac={};_0x356bac[_0x777d('0x3e')]=_[_0x777d('0x3a')](db[_0x777d('0x4a')][_0x777d('0x37')]);_0x356bac[_0x777d('0x3b')]=_[_0x777d('0x3a')](_0x5667e2['query']);_0x356bac[_0x777d('0x3c')]=_[_0x777d('0x3d')](_0x356bac['model'],_0x356bac['query']);_0x4e3837[_0x777d('0x3f')]=_[_0x777d('0x3d')](_0x356bac[_0x777d('0x3e')],qs[_0x777d('0x40')](_0x5667e2[_0x777d('0x3b')]['fields']));_0x4e3837[_0x777d('0x3f')]=_0x4e3837['attributes'][_0x777d('0x41')]?_0x4e3837[_0x777d('0x3f')]:_0x356bac[_0x777d('0x3e')];if(_0x5667e2[_0x777d('0x3b')][_0x777d('0x4b')]){_0x4e3837[_0x777d('0x4c')]=[{'all':!![]}];}_0x4e3837=_[_0x777d('0x47')]({},_0x4e3837,_0x5667e2['options']);return db['Plugin'][_0x777d('0x52')](_0x4e3837)['then'](handleEntityNotFound(_0xa5b191,null))[_0x777d('0x2c')](respondWithResult(_0xa5b191,null))[_0x777d('0x4f')](handleError(_0xa5b191,null));};exports[_0x777d('0x53')]=function(_0x21b2b5,_0x112b68,_0x3b42cd){return db[_0x777d('0x4a')]['find']({'where':{'id':_0x21b2b5[_0x777d('0x51')]['id']},'attributes':[_0x777d('0x33'),'path'],'raw':!![]})[_0x777d('0x2c')](handleEntityNotFound(_0x112b68,null))['then'](function(_0x549e0b){if(_0x549e0b){var _0x5cd8a4=path[_0x777d('0x54')](config[_0x777d('0x55')],'server/files/plugins',util[_0x777d('0x56')](_0x777d('0x57'),path[_0x777d('0x58')](_0x549e0b[_0x777d('0x6')])));var _0xef3c3d=fs['createWriteStream'](_0x5cd8a4);var _0x548832=archiver(_0x777d('0x59'),{'zlib':{'level':0x9}});_0x548832['on'](_0x777d('0x5a'),function(_0x4e48cd){if(_0x4e48cd['code']===_0x777d('0x5b')){logger['error'](_0x4e48cd);}else{throw new db[(_0x777d('0x5c'))][(_0x777d('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x548832['on'](_0x777d('0x31'),function(_0x2991fe){throw new db[(_0x777d('0x5c'))][(_0x777d('0x5d'))](_0x777d('0x5e'));});_0x548832[_0x777d('0x5f')](_0xef3c3d);_0x548832['glob'](_0x777d('0x60'),{'cwd':path[_0x777d('0x54')](config['root'],_0x777d('0x61'),path[_0x777d('0x62')](_0x549e0b[_0x777d('0x6')])),'ignore':[path[_0x777d('0x54')](path[_0x777d('0x58')](_0x549e0b[_0x777d('0x6')]),'node_modules/**/*'),path[_0x777d('0x54')](path['basename'](_0x549e0b[_0x777d('0x6')]),_0x777d('0x63'))],'nodir':!![]})[_0x777d('0x64')]();_0xef3c3d['on'](_0x777d('0x65'),function(){if(!fs[_0x777d('0x66')](_0x5cd8a4)){throw new db['Sequelize']['Error'](_0x777d('0x67'));}return _0x112b68[_0x777d('0x53')](_0x5cd8a4,util['format'](_0x777d('0x57'),path[_0x777d('0x58')](_0x549e0b[_0x777d('0x6')])),function(_0x48facd){if(_0x48facd){throw new db[(_0x777d('0x5c'))][(_0x777d('0x5d'))](_0x777d('0x68'));}fs[_0x777d('0x69')](_0x5cd8a4);logger[_0x777d('0x6a')](_0x777d('0x6b'));logger[_0x777d('0x6a')](_0x777d('0x6c'));});});}return null;})['catch'](handleError(_0x112b68,null));};exports[_0x777d('0x6d')]=function(_0x35ad72,_0x362938,_0x3403ea){var _0x7c4629=path[_0x777d('0x58')](_0x35ad72[_0x777d('0x6e')][_0x777d('0x6f')],path[_0x777d('0x70')](_0x35ad72[_0x777d('0x6e')][_0x777d('0x6f')]));var _0x5ca059=path[_0x777d('0x54')](config[_0x777d('0x55')],_0x777d('0x61'),_0x35ad72[_0x777d('0x6e')][_0x777d('0x6f')]);var _0x569913=path['join'](config[_0x777d('0x55')],_0x777d('0x61'),_0x7c4629);logger[_0x777d('0x6a')](_0x777d('0x71'),_0x5ca059);logger[_0x777d('0x6a')](_0x777d('0x72'),_0x569913);try{fs[_0x777d('0x73')](_0x5ca059,parseInt(_0x777d('0x74'),0x8));extract(_0x5ca059,{'dir':_0x569913},function(_0x451824){if(_0x451824){logger[_0x777d('0x31')](_0x451824);handleError(_0x451824,!![]);};var _0x2d567d=fs[_0x777d('0x75')](_0x569913);if(_0x2d567d[_0x777d('0x41')]>0x1){removeReferences(_0x5ca059,_0x569913);logger[_0x777d('0x31')](_0x777d('0x76'));return _0x3403ea(new Error(_0x777d('0x76')));}var _0x119635=fs['lstatSync'](path['join'](_0x569913,_0x2d567d[0x0]));if(_0x119635['isFile']()){removeReferences(_0x5ca059,_0x569913);logger[_0x777d('0x31')]('Invalid\x20plugin\x20structure');return _0x3403ea(new Error(_0x777d('0x76')));}if(_0x119635[_0x777d('0x77')]()){var _0x36f275=fs[_0x777d('0x75')](path[_0x777d('0x54')](_0x569913,_0x2d567d[0x0]));if(_0x36f275[_0x777d('0x41')]===0x0){removeReferences(_0x5ca059,_0x569913);logger[_0x777d('0x31')]('Invalid\x20plugin\x20structure');return _0x3403ea(new Error(_0x777d('0x76')));}var _0x535cb2=_0x36f275['some'](function(_0x44c2b9){return _0x44c2b9==='manifest.json';});if(!_0x535cb2){return _0x3403ea(new Error('Plugin\x20manifest\x20missing'));}var _0x21231d=fs['readFileSync'](path['join'](_0x569913,_0x2d567d[0x0],_0x777d('0x78')));var _0x4b431f=JSON[_0x777d('0x79')](_0x21231d);if(_0x777d('0x7a')==typeof _0x4b431f[_0x777d('0x33')]){return _0x3403ea(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x4b431f[_0x777d('0x39')]){return _0x3403ea(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x777d('0x7a')==typeof _0x4b431f[_0x777d('0x7b')]){return _0x3403ea(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x777d('0x7a')==typeof _0x4b431f['parameters']){return _0x3403ea(new Error(_0x777d('0x7c')));}if(_0x4b431f['type']===_0x777d('0x7d')){if(_0x777d('0x7a')==typeof _0x4b431f['parameters']['views']){return _0x3403ea(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x777d('0x7a')==typeof _0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')][_0x777d('0x80')]&&_0x777d('0x7a')==typeof _0x4b431f[_0x777d('0x7e')]['views'][_0x777d('0x81')]){return _0x3403ea(new Error(_0x777d('0x82')));}}else if(_0x4b431f[_0x777d('0x39')]===_0x777d('0x83')){if(_0x777d('0x7a')==typeof _0x4b431f[_0x777d('0x7e')][_0x777d('0x84')]){return _0x3403ea(new Error(_0x777d('0x85')));}if('undefined'==typeof _0x4b431f[_0x777d('0x7e')]['scriptPath']){return _0x3403ea(new Error(_0x777d('0x86')));}}else{return _0x3403ea(new Error(_0x777d('0x87')));}var _0x2ac730=_0x4b431f[_0x777d('0x33')];var _0x47ea47=_0x4b431f[_0x777d('0x88')];var _0x49be8a=_0x4b431f[_0x777d('0x39')];var _0x4231b9=_0x4b431f[_0x777d('0x89')]?_0x4b431f[_0x777d('0x89')]:_0x777d('0x8a');var _0x5e6697=_0x4b431f[_0x777d('0x8b')]?_0x4b431f[_0x777d('0x8b')]:_0x777d('0x8c');var _0x46a0a9='';var _0x3783fc='';var _0xf2df2f='';var _0x5e557f='';var _0x6ee36e=_0x4b431f[_0x777d('0x7b')];if(_0x49be8a===_0x777d('0x7d')){if(_0x777d('0x7a')!=typeof _0x4b431f['parameters'][_0x777d('0x7f')]['admin']){var _0xb10354=_0x4b431f['parameters'][_0x777d('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8d')](_0xb10354)){_0x46a0a9=path[_0x777d('0x54')](_0x777d('0x8e'),_0x7c4629,_0x2d567d[0x0],_0xb10354);}else{_0x46a0a9=_0xb10354;}}else{logger['info'](_0x777d('0x8f'));}if('undefined'!=typeof _0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')][_0x777d('0x81')]){var _0x15f4b1=_0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8d')](_0x15f4b1)){_0x3783fc=path['join']('plugins',_0x7c4629,_0x2d567d[0x0],_0x15f4b1);}else{_0x3783fc=_0x15f4b1;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x49be8a==='script'){_0xf2df2f=_0x4b431f['parameters'][_0x777d('0x84')];_0x5e557f=_0x4b431f[_0x777d('0x7e')][_0x777d('0x90')];if(_0x777d('0x7a')!=typeof _0x4b431f[_0x777d('0x7e')]['views']){if(_0x777d('0x7a')!=typeof _0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')][_0x777d('0x80')]){var _0xb10354=_0x4b431f[_0x777d('0x7e')]['views'][_0x777d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8d')](_0xb10354)){_0x46a0a9=path['join'](_0x777d('0x8e'),_0x7c4629,_0x2d567d[0x0],_0xb10354);}else{_0x46a0a9=_0xb10354;}}if(_0x777d('0x7a')!=typeof _0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')][_0x777d('0x81')]){var _0x15f4b1=_0x4b431f[_0x777d('0x7e')][_0x777d('0x7f')][_0x777d('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x777d('0x8d')](_0x15f4b1)){_0x3783fc=path['join'](_0x777d('0x8e'),_0x7c4629,_0x2d567d[0x0],_0x15f4b1);}else{_0x3783fc=_0x15f4b1;}}}}var _0x247e1f={'name':_0x2ac730,'description':_0x47ea47,'path':path[_0x777d('0x54')](_0x7c4629,_0x2d567d[0x0]),'type':_0x49be8a,'sidebar':_0x4231b9,'icon':_0x5e6697,'adminUrl':_0x46a0a9,'agentUrl':_0x3783fc,'scriptName':_0xf2df2f,'scriptPath':_0x5e557f,'version':_0x6ee36e};removeReferences(_0x5ca059,null);return db[_0x777d('0x4a')][_0x777d('0x91')](_0x247e1f)[_0x777d('0x2c')](function(_0x51a74a){var _0x597f17={'role':_0x35ad72['body'][_0x777d('0x92')],'userProfileId':_0x35ad72[_0x777d('0x93')][_0x777d('0x94')]};if(!_0x597f17)throw new Error(_0x777d('0x95'));if(_0x597f17[_0x777d('0x92')]===_0x777d('0x96')){var _0x1e1351=_0x51a74a[_0x777d('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x777d('0x52')]({'where':{'name':_0x777d('0x2f'),'userProfileId':_0x597f17[_0x777d('0x94')]},'raw':!![]})[_0x777d('0x2c')](function(_0x500f79){if(_0x500f79&&_0x500f79[_0x777d('0x97')]===0x0){return db[_0x777d('0x30')][_0x777d('0x91')]({'name':_0x1e1351[_0x777d('0x33')],'resourceId':_0x1e1351['id'],'type':_0x500f79[_0x777d('0x33')],'sectionId':_0x500f79['id']},{})[_0x777d('0x2c')](function(){return _0x51a74a;});}else{return _0x51a74a;}})['catch'](function(_0x1e1c72){logger[_0x777d('0x31')](_0x777d('0x98'),_0x1e1c72);throw _0x1e1c72;});}return _0x51a74a;})[_0x777d('0x2c')](respondWithResult(_0x362938,null))[_0x777d('0x4f')](handleError(_0x362938,null));}});}catch(_0x5ce0c5){_0x362938[_0x777d('0x20')](0x1f4)[_0x777d('0x34')](_0x5ce0c5);}};function removeReferences(_0x284850,_0x38beb2){try{if(_0x284850){fs[_0x777d('0x69')](_0x284850);logger[_0x777d('0x6a')](_0x777d('0x99'));}if(_0x38beb2){rimraf(_0x38beb2,function(){});logger[_0x777d('0x6a')](_0x777d('0x9a'));}}catch(_0x2b6041){logger[_0x777d('0x31')](_0x2b6041);}}exports['update']=function(_0xa5d109,_0x4a3dd1,_0x48f3aa){return db[_0x777d('0x4a')][_0x777d('0x52')]({'where':{'id':_0xa5d109[_0x777d('0x51')]['id']}})[_0x777d('0x2c')](handleEntityNotFound(_0x4a3dd1,null))[_0x777d('0x2c')](saveUpdates(_0xa5d109[_0x777d('0x93')],null))[_0x777d('0x2c')](respondWithResult(_0x4a3dd1,null))[_0x777d('0x4f')](handleError(_0x4a3dd1,null));};exports['delete']=function(_0x169778,_0x966609,_0x2538db){return db[_0x777d('0x4a')]['find']({'where':{'id':_0x169778[_0x777d('0x51')]['id']}})[_0x777d('0x2c')](function(_0x42f4b2){if(_0x42f4b2){return _0x42f4b2[_0x777d('0x2d')]();}})[_0x777d('0x2c')](function(_0x28d7d2){rimraf(path[_0x777d('0x54')](config[_0x777d('0x55')],_0x777d('0x61'),path['dirname'](_0x28d7d2[_0x777d('0x6')])),function(){});return _0x28d7d2;})[_0x777d('0x2c')](handleEntityNotFound(_0x966609,null))[_0x777d('0x2c')](respondWithStatusCode(_0x966609,null))[_0x777d('0x4f')](handleError(_0x966609,null));};exports[_0x777d('0x9b')]=function(_0x129f42,_0x158700,_0x4847ce){return BPromise[_0x777d('0x9c')]()[_0x777d('0x2c')](function(){if(!_0x129f42[_0x777d('0x3b')][_0x777d('0x6')]){throw new Error(_0x777d('0x9d'));}if(!_0x129f42[_0x777d('0x3b')][_0x777d('0x9e')]){throw new Error(_0x777d('0x9f'));}var _0x41a431=_0x129f42[_0x777d('0x3b')]['hostname']?_0x129f42[_0x777d('0x3b')]['hostname']+':'+_0x129f42['query']['port']:'http://localhost:'+_0x129f42[_0x777d('0x3b')][_0x777d('0x9e')];var _0x2311a9=_0x129f42[_0x777d('0x3b')]['json']?_0x129f42[_0x777d('0x3b')][_0x777d('0x22')]:!![];var _0x2dccf3=_0x129f42['query'][_0x777d('0xa0')]?_0x129f42[_0x777d('0x3b')]['encoding']:null;var _0x58d5fb={'method':_0x129f42['method'],'uri':util[_0x777d('0x56')](_0x777d('0xa1'),_0x41a431,_0x129f42['query'][_0x777d('0x6')]),'json':_0x2311a9,'resolveWithFullResponse':!![],'encoding':_0x2dccf3,'qs':_0x129f42['query']};if(_0x129f42[_0x777d('0xa2')]){_0x58d5fb[_0x777d('0xa2')]=_0x129f42['headers'];if(_0x58d5fb['headers'][_0x777d('0xa3')]){delete _0x58d5fb['headers'][_0x777d('0xa3')];}}if(_0x58d5fb['headers'][_0x777d('0xa4')]){delete _0x58d5fb[_0x777d('0xa2')][_0x777d('0xa4')];}return rp(_0x58d5fb);})[_0x777d('0x2c')](function(_0x283337){if(_0x283337){_0x158700[_0x777d('0x26')](_0x283337[_0x777d('0xa2')]);logger[_0x777d('0x6a')](_0x283337[_0x777d('0x93')]);if(_[_0x777d('0xa5')](_0x129f42[_0x777d('0x3b')][_0x777d('0x6')],_0x777d('0x53'))&&_0x283337[_0x777d('0xa6')]==0x1f4){return _0x158700[_0x777d('0x1f')](_0x283337[_0x777d('0xa6')]);}else{return _0x158700['status'](_0x283337['statusCode'])[_0x777d('0x34')](_0x283337[_0x777d('0x93')]);}}else{return _0x158700[_0x777d('0x1f')](0xc8);}})['catch'](handleError(_0x158700,null));};exports[_0x777d('0xa7')]=function(_0x3d1c53,_0x2c37bf,_0x51fd75){return BPromise[_0x777d('0x9c')]()[_0x777d('0x2c')](function(){if(!_0x3d1c53[_0x777d('0x3b')][_0x777d('0x6')]){throw new Error(_0x777d('0x9d'));}if(!_0x3d1c53['query']['port']){throw new Error(_0x777d('0x9f'));}var _0x5640a9=_0x3d1c53[_0x777d('0x3b')][_0x777d('0xa8')]?_0x3d1c53[_0x777d('0x3b')][_0x777d('0xa8')]+':'+_0x3d1c53[_0x777d('0x3b')][_0x777d('0x9e')]:_0x777d('0xa9')+_0x3d1c53[_0x777d('0x3b')][_0x777d('0x9e')];var _0x9eb61a=_0x3d1c53[_0x777d('0x3b')][_0x777d('0x22')]?_0x3d1c53[_0x777d('0x3b')]['json']:!![];var _0x175c85=_0x3d1c53['query'][_0x777d('0xa0')]?_0x3d1c53['query']['encoding']:null;var _0x5e2004={'method':_0x3d1c53[_0x777d('0xaa')],'uri':util['format'](_0x777d('0xa1'),_0x5640a9,_0x3d1c53[_0x777d('0x3b')][_0x777d('0x6')]),'json':_0x9eb61a,'resolveWithFullResponse':!![],'encoding':_0x175c85,'body':_0x3d1c53[_0x777d('0x93')]};if(_0x3d1c53[_0x777d('0xa2')]){_0x5e2004[_0x777d('0xa2')]=_0x3d1c53[_0x777d('0xa2')];if(_0x5e2004[_0x777d('0xa2')][_0x777d('0xa3')]){delete _0x5e2004[_0x777d('0xa2')][_0x777d('0xa3')];}}if(_0x5e2004['headers'][_0x777d('0xa4')]){delete _0x5e2004[_0x777d('0xa2')][_0x777d('0xa4')];}return rp(_0x5e2004);})['then'](function(_0x199ff9){if(_0x199ff9){_0x2c37bf[_0x777d('0x26')](_0x199ff9[_0x777d('0xa2')]);logger[_0x777d('0x6a')](_0x199ff9[_0x777d('0x93')]);return _0x2c37bf[_0x777d('0x20')](_0x199ff9[_0x777d('0xa6')])[_0x777d('0x34')](_0x199ff9[_0x777d('0x93')]);}else{return _0x2c37bf[_0x777d('0x1f')](0xc8);}})[_0x777d('0x4f')](handleError(_0x2c37bf,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d0346d9..1c6a399 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 _0x2542=['exports','events','../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x341dbd,_0x45ad33){var _0x18868f=function(_0x1e7a95){while(--_0x1e7a95){_0x341dbd['push'](_0x341dbd['shift']());}};_0x18868f(++_0x45ad33);}(_0x2542,0x169));var _0x2254=function(_0x354b9c,_0x30df14){_0x354b9c=_0x354b9c-0x0;var _0x5b37a3=_0x2542[_0x354b9c];return _0x5b37a3;};'use strict';var EventEmitter=require(_0x2254('0x0'));var Plugin=require(_0x2254('0x1'))['db'][_0x2254('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x2254('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2254('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4059d1){return function(_0x3b3dcb,_0x27f5c9,_0x456612){PluginEvents[_0x2254('0x5')](_0x4059d1+':'+_0x3b3dcb['id'],_0x3b3dcb);PluginEvents['emit'](_0x4059d1,_0x3b3dcb);_0x456612(null);};}for(var e in events){if(events[_0x2254('0x6')](e)){var event=events[e];Plugin[_0x2254('0x7')](e,emitEvent(event));}}module[_0x2254('0x8')]=PluginEvents; \ No newline at end of file +var _0x57ca=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','save','update','remove','emit'];(function(_0x418034,_0x502ddf){var _0x2cbca1=function(_0x5646d9){while(--_0x5646d9){_0x418034['push'](_0x418034['shift']());}};_0x2cbca1(++_0x502ddf);}(_0x57ca,0x108));var _0xa57c=function(_0x138866,_0x353c34){_0x138866=_0x138866-0x0;var _0x184d58=_0x57ca[_0x138866];return _0x184d58;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa57c('0x0'))['db'][_0xa57c('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa57c('0x2'),'afterUpdate':_0xa57c('0x3'),'afterDestroy':_0xa57c('0x4')};function emitEvent(_0x15e330){return function(_0x1da469,_0x48be2d,_0x40ba22){PluginEvents[_0xa57c('0x5')](_0x15e330+':'+_0x1da469['id'],_0x1da469);PluginEvents[_0xa57c('0x5')](_0x15e330,_0x1da469);_0x40ba22(null);};}for(var e in events){if(events[_0xa57c('0x6')](e)){var event=events[e];Plugin[_0xa57c('0x7')](e,emitEvent(event));}}module[_0xa57c('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 961339d..dc4c33d 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 _0x6bbc=['../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x152ea8,_0x3fb53f){var _0x4c0ebe=function(_0x1c2641){while(--_0x1c2641){_0x152ea8['push'](_0x152ea8['shift']());}};_0x4c0ebe(++_0x3fb53f);}(_0x6bbc,0x6d));var _0xc6bb=function(_0x1968f3,_0x1a6454){_0x1968f3=_0x1968f3-0x0;var _0x1ae894=_0x6bbc[_0x1968f3];return _0x1ae894;};'use strict';var _=require(_0xc6bb('0x0'));var util=require('util');var logger=require(_0xc6bb('0x1'))(_0xc6bb('0x2'));var moment=require(_0xc6bb('0x3'));var BPromise=require(_0xc6bb('0x4'));var rp=require(_0xc6bb('0x5'));var fs=require('fs');var path=require(_0xc6bb('0x6'));var rimraf=require(_0xc6bb('0x7'));var config=require(_0xc6bb('0x8'));var attributes=require(_0xc6bb('0x9'));module[_0xc6bb('0xa')]=function(_0x3197e0,_0x2b9aea){return _0x3197e0['define'](_0xc6bb('0xb'),attributes,{'tableName':_0xc6bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x391f=['util','api','moment','request-promise','path','rimraf','./plugin.attributes','define','plugins','lodash'];(function(_0x12fc0f,_0x3cc710){var _0xa7080a=function(_0x100ca1){while(--_0x100ca1){_0x12fc0f['push'](_0x12fc0f['shift']());}};_0xa7080a(++_0x3cc710);}(_0x391f,0x17b));var _0xf391=function(_0x9d830,_0x298440){_0x9d830=_0x9d830-0x0;var _0x2cab2a=_0x391f[_0x9d830];return _0x2cab2a;};'use strict';var _=require(_0xf391('0x0'));var util=require(_0xf391('0x1'));var logger=require('../../config/logger')(_0xf391('0x2'));var moment=require(_0xf391('0x3'));var BPromise=require('bluebird');var rp=require(_0xf391('0x4'));var fs=require('fs');var path=require(_0xf391('0x5'));var rimraf=require(_0xf391('0x6'));var config=require('../../config/environment');var attributes=require(_0xf391('0x7'));module['exports']=function(_0x3606b6,_0x4ffc9f){return _0x3606b6[_0xf391('0x8')]('Plugin',attributes,{'tableName':_0xf391('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 13f1b5c..f4ffb68 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 _0x37aa=['message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1a5f1b,_0x5bb416){var _0x79ea2f=function(_0x1b6dc9){while(--_0x1b6dc9){_0x1a5f1b['push'](_0x1a5f1b['shift']());}};_0x79ea2f(++_0x5bb416);}(_0x37aa,0xdb));var _0xa37a=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x37aa[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0xa37a('0x0'));var util=require(_0xa37a('0x1'));var moment=require(_0xa37a('0x2'));var BPromise=require(_0xa37a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa37a('0x4'));var db=require(_0xa37a('0x5'))['db'];var utils=require(_0xa37a('0x6'));var logger=require(_0xa37a('0x7'))(_0xa37a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa37a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa37a('0xa')]=_[_0xa37a('0xb')](config[_0xa37a('0xa')],{'host':_0xa37a('0xc'),'port':0x18eb});var socket=require(_0xa37a('0xd'))(new Redis(config[_0xa37a('0xa')]));require(_0xa37a('0xe'))[_0xa37a('0xf')](socket);function respondWithRpcPromise(_0x5666ce,_0x6581c4,_0x5ebf11){return new BPromise(function(_0x51b465,_0x323379){return client[_0xa37a('0x10')](_0x5666ce,_0x5ebf11)[_0xa37a('0x11')](function(_0x33a3bb){logger[_0xa37a('0x12')](_0xa37a('0x13'),_0x6581c4,_0xa37a('0x14'));logger[_0xa37a('0x15')](_0xa37a('0x16'),_0x6581c4,_0xa37a('0x14'),JSON[_0xa37a('0x17')](_0x33a3bb));if(_0x33a3bb[_0xa37a('0x18')]){if(_0x33a3bb[_0xa37a('0x18')][_0xa37a('0x19')]===0x1f4){logger[_0xa37a('0x18')](_0xa37a('0x13'),_0x6581c4,_0x33a3bb['error'][_0xa37a('0x1a')]);return _0x323379(_0x33a3bb[_0xa37a('0x18')][_0xa37a('0x1a')]);}logger[_0xa37a('0x18')](_0xa37a('0x13'),_0x6581c4,_0x33a3bb[_0xa37a('0x18')][_0xa37a('0x1a')]);return _0x51b465(_0x33a3bb[_0xa37a('0x18')]['message']);}else{logger['info'](_0xa37a('0x13'),_0x6581c4,_0xa37a('0x14'));_0x51b465(_0x33a3bb[_0xa37a('0x1b')][_0xa37a('0x1a')]);}})[_0xa37a('0x1c')](function(_0x4487d1){logger[_0xa37a('0x18')](_0xa37a('0x13'),_0x6581c4,_0x4487d1);_0x323379(_0x4487d1);});});}exports[_0xa37a('0x1d')]=function(_0x3926b0){var _0x21a60e=this;return new Promise(function(_0x47ba65,_0xfe51db){return db[_0xa37a('0x1e')][_0xa37a('0x1f')](_0x3926b0[_0xa37a('0x20')],{'raw':_0x3926b0['options']?_0x3926b0[_0xa37a('0x21')][_0xa37a('0x22')]===undefined?!![]:![]:!![]})[_0xa37a('0x11')](function(_0x36f996){logger[_0xa37a('0x12')](_0xa37a('0x1d'),_0x3926b0);logger[_0xa37a('0x15')](_0xa37a('0x1d'),_0x3926b0,JSON[_0xa37a('0x17')](_0x36f996));_0x47ba65(_0x36f996);})[_0xa37a('0x1c')](function(_0x987edc){logger['error'](_0xa37a('0x1d'),_0x987edc[_0xa37a('0x1a')],_0x3926b0);_0xfe51db(_0x21a60e[_0xa37a('0x18')](0x1f4,_0x987edc['message']));});});}; \ No newline at end of file +var _0x75ab=['code','message','catch','CreatePlugin','Plugin','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xa5e22f,_0x5c90ed){var _0x417561=function(_0xd8d76){while(--_0xd8d76){_0xa5e22f['push'](_0xa5e22f['shift']());}};_0x417561(++_0x5c90ed);}(_0x75ab,0x1d7));var _0xb75a=function(_0x5b5fb4,_0x10dc4a){_0x5b5fb4=_0x5b5fb4-0x0;var _0x578a0c=_0x75ab[_0x5b5fb4];return _0x578a0c;};'use strict';var _=require(_0xb75a('0x0'));var util=require(_0xb75a('0x1'));var moment=require(_0xb75a('0x2'));var BPromise=require(_0xb75a('0x3'));var rs=require(_0xb75a('0x4'));var fs=require('fs');var Redis=require(_0xb75a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb75a('0x6'));var logger=require(_0xb75a('0x7'))('rpc');var config=require(_0xb75a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb75a('0x9')][_0xb75a('0xa')]({'port':0x232a});config['redis']=_[_0xb75a('0xb')](config[_0xb75a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb75a('0xd'))(new Redis(config[_0xb75a('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x37d3b6,_0x401f59,_0x15e31d){return new BPromise(function(_0x1746d6,_0x16df74){return client[_0xb75a('0xe')](_0x37d3b6,_0x15e31d)[_0xb75a('0xf')](function(_0x32c87b){logger[_0xb75a('0x10')](_0xb75a('0x11'),_0x401f59,'request\x20sent');logger['debug'](_0xb75a('0x12'),_0x401f59,_0xb75a('0x13'),JSON[_0xb75a('0x14')](_0x32c87b));if(_0x32c87b[_0xb75a('0x15')]){if(_0x32c87b[_0xb75a('0x15')][_0xb75a('0x16')]===0x1f4){logger[_0xb75a('0x15')](_0xb75a('0x11'),_0x401f59,_0x32c87b[_0xb75a('0x15')]['message']);return _0x16df74(_0x32c87b[_0xb75a('0x15')][_0xb75a('0x17')]);}logger[_0xb75a('0x15')](_0xb75a('0x11'),_0x401f59,_0x32c87b[_0xb75a('0x15')][_0xb75a('0x17')]);return _0x1746d6(_0x32c87b['error'][_0xb75a('0x17')]);}else{logger[_0xb75a('0x10')]('Plugin,\x20%s,\x20%s',_0x401f59,_0xb75a('0x13'));_0x1746d6(_0x32c87b['result'][_0xb75a('0x17')]);}})[_0xb75a('0x18')](function(_0x3c1571){logger['error'](_0xb75a('0x11'),_0x401f59,_0x3c1571);_0x16df74(_0x3c1571);});});}exports[_0xb75a('0x19')]=function(_0x230cce){var _0x2726d5=this;return new Promise(function(_0x366e10,_0x3cce0e){return db[_0xb75a('0x1a')]['create'](_0x230cce['body'],{'raw':_0x230cce['options']?_0x230cce[_0xb75a('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37011d){logger[_0xb75a('0x10')](_0xb75a('0x19'),_0x230cce);logger[_0xb75a('0x1c')](_0xb75a('0x19'),_0x230cce,JSON[_0xb75a('0x14')](_0x37011d));_0x366e10(_0x37011d);})['catch'](function(_0x4d11b9){logger[_0xb75a('0x15')](_0xb75a('0x19'),_0x4d11b9[_0xb75a('0x17')],_0x230cce);_0x3cce0e(_0x2726d5[_0xb75a('0x15')](0x1f4,_0x4d11b9[_0xb75a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bbaf7d2..cd5f00a 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 _0xa9ba=['plugin:','save','remove','update','emit'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xa9ba,0x16e));var _0xaa9b=function(_0x210239,_0x35c016){_0x210239=_0x210239-0x0;var _0x29eeeb=_0xa9ba[_0x210239];return _0x29eeeb;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xaa9b('0x0'),_0xaa9b('0x1'),_0xaa9b('0x2')];function createListener(_0x39b665,_0xd77915){return function(_0x5bbb83){_0xd77915[_0xaa9b('0x3')](_0x39b665,_0x5bbb83);};}function removeListener(_0x2e3f65,_0x1a8e61){return function(){PluginEvents['removeListener'](_0x2e3f65,_0x1a8e61);};}exports['register']=function(_0x3776ac){for(var _0x1a919b=0x0,_0xd0d065=events['length'];_0x1a919b<_0xd0d065;_0x1a919b++){var _0x3cc80f=events[_0x1a919b];var _0x18f8fd=createListener(_0xaa9b('0x4')+_0x3cc80f,_0x3776ac);PluginEvents['on'](_0x3cc80f,_0x18f8fd);}}; \ No newline at end of file +var _0xa2bf=['update','emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x4d0b47,_0x52ff0e){var _0x2fd803=function(_0x2d2fec){while(--_0x2d2fec){_0x4d0b47['push'](_0x4d0b47['shift']());}};_0x2fd803(++_0x52ff0e);}(_0xa2bf,0xa8));var _0xfa2b=function(_0x122685,_0x1e5575){_0x122685=_0x122685-0x0;var _0x43a9a2=_0xa2bf[_0x122685];return _0x43a9a2;};'use strict';var PluginEvents=require(_0xfa2b('0x0'));var events=[_0xfa2b('0x1'),_0xfa2b('0x2'),_0xfa2b('0x3')];function createListener(_0x4dddd8,_0x687f72){return function(_0x36224b){_0x687f72[_0xfa2b('0x4')](_0x4dddd8,_0x36224b);};}function removeListener(_0x12f91f,_0x1caf86){return function(){PluginEvents[_0xfa2b('0x5')](_0x12f91f,_0x1caf86);};}exports[_0xfa2b('0x6')]=function(_0x249860){for(var _0x164a9=0x0,_0x11b198=events[_0xfa2b('0x7')];_0x164a9<_0x11b198;_0x164a9++){var _0x396ef2=events[_0x164a9];var _0xfb9e6e=createListener(_0xfa2b('0x8')+_0x396ef2,_0x249860);PluginEvents['on'](_0x396ef2,_0xfb9e6e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c9fc9ad..07e7ba6 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 _0xc5fc=['create','update','delete','destroy','exports','express','Router','./pm2.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5fc,0xc8));var _0xcc5f=function(_0x1b12e7,_0x4659c7){_0x1b12e7=_0x1b12e7-0x0;var _0x23c550=_0xc5fc[_0x1b12e7];return _0x23c550;};'use strict';var express=require(_0xcc5f('0x0'));var router=express[_0xcc5f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xcc5f('0x2'));router['get']('/',auth[_0xcc5f('0x3')](),controller[_0xcc5f('0x4')]);router[_0xcc5f('0x5')](_0xcc5f('0x6'),auth['isAuthenticated'](),controller[_0xcc5f('0x7')]);router['post']('/',auth[_0xcc5f('0x3')](),controller[_0xcc5f('0x8')]);router['put'](_0xcc5f('0x6'),auth[_0xcc5f('0x3')](),controller[_0xcc5f('0x9')]);router[_0xcc5f('0xa')](_0xcc5f('0x6'),auth['isAuthenticated'](),controller[_0xcc5f('0xb')]);module[_0xcc5f('0xc')]=router; \ No newline at end of file +var _0xe7c2=['/:id','post','create','update','delete','destroy','exports','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x330306,_0x4e4dc1){var _0x4eb512=function(_0x5a9c62){while(--_0x5a9c62){_0x330306['push'](_0x330306['shift']());}};_0x4eb512(++_0x4e4dc1);}(_0xe7c2,0x67));var _0x2e7c=function(_0x140ca7,_0x2b0c8d){_0x140ca7=_0x140ca7-0x0;var _0x2aa472=_0xe7c2[_0x140ca7];return _0x2aa472;};'use strict';var express=require('express');var router=express[_0x2e7c('0x0')]();var auth=require(_0x2e7c('0x1'));var controller=require('./pm2.controller');router[_0x2e7c('0x2')]('/',auth[_0x2e7c('0x3')](),controller[_0x2e7c('0x4')]);router[_0x2e7c('0x2')](_0x2e7c('0x5'),auth[_0x2e7c('0x3')](),controller['show']);router[_0x2e7c('0x6')]('/',auth[_0x2e7c('0x3')](),controller[_0x2e7c('0x7')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2e7c('0x8')]);router[_0x2e7c('0x9')](_0x2e7c('0x5'),auth['isAuthenticated'](),controller[_0x2e7c('0xa')]);module[_0x2e7c('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index c3dd2a1..8c8e2e6 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 _0x8d69=['delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','chdir','dump','send','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','destroy'];(function(_0x2561e3,_0x54bfae){var _0x6da30=function(_0x3de592){while(--_0x3de592){_0x2561e3['push'](_0x2561e3['shift']());}};_0x6da30(++_0x54bfae);}(_0x8d69,0x74));var _0x98d6=function(_0x4bbdff,_0x380dab){_0x4bbdff=_0x4bbdff-0x0;var _0x4cf619=_0x8d69[_0x4bbdff];return _0x4cf619;};'use strict';var _=require(_0x98d6('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x98d6('0x1'))(_0x98d6('0x2'));var path=require(_0x98d6('0x3'));var exec=require(_0x98d6('0x4'))[_0x98d6('0x5')];var BPromise=require(_0x98d6('0x6'));function handleEntityNotFound(_0x546e9b,_0x3bd283){return function(_0x17e859){if(!_0x17e859){_0x546e9b[_0x98d6('0x7')](0x194);;}return _0x17e859;};}function respondWithResult(_0x25ec8a,_0x4c14dd){_0x4c14dd=_0x4c14dd||0xc8;return function(_0x41aeb1){if(_0x41aeb1){return _0x25ec8a[_0x98d6('0x8')](_0x4c14dd)[_0x98d6('0x9')](_0x41aeb1);}return null;};}function handleError(_0x2ad86d,_0x101311){_0x101311=_0x101311||0x1f4;return function(_0x38f082){logger['error'](_0x38f082[_0x98d6('0xa')]);if(_0x38f082[_0x98d6('0xb')]){delete _0x38f082[_0x98d6('0xb')];}_0x2ad86d[_0x98d6('0x8')](_0x101311)['send'](_0x38f082);};}function execChildProcess(){return new BPromise(function(_0x486fe1,_0x1bd853){exec(_0x98d6('0xc'),function(_0x1be6b5,_0x28179d,_0x21953b){logger['info'](_0x28179d);logger[_0x98d6('0xd')](_0x21953b);if(_0x1be6b5){logger['error'](_0x1be6b5);return _0x1bd853(_0x1be6b5);}return _0x486fe1(_0x28179d);});});}exports[_0x98d6('0xe')]=function(_0x2609f6,_0x57558f){return pm2['list']()[_0x98d6('0xf')](function(_0x1c853d){if(_0x1c853d){var _0x3fdcc4=_[_0x98d6('0x10')](_0x1c853d,function(_0x55897f){return _0x55897f[_0x98d6('0xb')]===_0x98d6('0x11')||_0x55897f[_0x98d6('0xb')]===_0x98d6('0x12');});return{'rows':_0x3fdcc4,'count':_0x3fdcc4[_0x98d6('0x13')]};}return null;})['then'](respondWithResult(_0x57558f,null))[_0x98d6('0x14')](handleError(_0x57558f,null));};exports[_0x98d6('0x15')]=function(_0x559fb8,_0x14b6c3){return pm2[_0x98d6('0x16')](_0x559fb8[_0x98d6('0x17')]['id'])[_0x98d6('0xf')](respondWithResult(_0x14b6c3,null))[_0x98d6('0xf')](handleEntityNotFound(_0x14b6c3,null))[_0x98d6('0x14')](handleError(_0x14b6c3,null));};exports[_0x98d6('0x18')]=function(_0x905384,_0x5798e6){if(_0x905384[_0x98d6('0x19')][_0x98d6('0xb')]&&_0x905384['body'][_0x98d6('0x1a')]){var _0x2bf1de=path[_0x98d6('0x1b')](__dirname,_0x98d6('0x1c'),_0x905384[_0x98d6('0x19')][_0x98d6('0x1a')]);var _0x4feb3b=process['cwd']();process[_0x98d6('0x1d')](path['dirname'](_0x2bf1de));return execChildProcess()['then'](function(_0x5d607b){process['chdir'](_0x4feb3b);return pm2['start']({'name':_0x905384[_0x98d6('0x19')][_0x98d6('0xb')],'script':_0x2bf1de});})[_0x98d6('0xf')](function(_0x5d472a){pm2[_0x98d6('0x1e')]();return _0x5d472a[0x0];})[_0x98d6('0xf')](respondWithResult(_0x5798e6,0xc9))[_0x98d6('0x14')](handleError(_0x5798e6,null));}else{return _0x5798e6[_0x98d6('0x8')](0x1f4)[_0x98d6('0x1f')]({'message':_0x98d6('0x20')});}};exports['update']=function(_0x595088,_0x41a408){if(_0x595088[_0x98d6('0x19')]['id']){delete _0x595088[_0x98d6('0x19')]['id'];}var _0x2f357a={'online':'restart','stopped':_0x98d6('0x21')};if(_0x2f357a[_0x98d6('0x22')](_0x595088[_0x98d6('0x19')][_0x98d6('0x8')])){return pm2[_0x2f357a[_0x595088[_0x98d6('0x19')][_0x98d6('0x8')]]](_0x595088['params']['id'])[_0x98d6('0xf')](respondWithResult(_0x41a408,0xc8))[_0x98d6('0x14')](handleError(_0x41a408,null));}else{return _0x41a408[_0x98d6('0x8')](0x1f4)[_0x98d6('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x98d6('0x23')]=function(_0x371617,_0xf0a48f){if(_0x371617[_0x98d6('0x19')]['id']){delete _0x371617[_0x98d6('0x19')]['id'];}if(_0x371617[_0x98d6('0x17')]['id']){return pm2[_0x98d6('0x24')](_0x371617['params']['id'])[_0x98d6('0xf')](function(_0x17e7d8){pm2[_0x98d6('0x1e')]();return _0x17e7d8[0x0];})[_0x98d6('0xf')](respondWithResult(_0xf0a48f,null))['catch'](handleError(_0xf0a48f,null));}else{return _0xf0a48f[_0x98d6('0x8')](0x1f4)[_0x98d6('0x1f')]({'message':_0x98d6('0x25')});}}; \ No newline at end of file +var _0xd17b=['json','error','stack','send','info','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','join','../../files/plugins','script','chdir','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd17b,0x128));var _0xbd17=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xd17b[_0x11e05d];return _0x335588;};'use strict';var _=require('lodash');var pm2=require(_0xbd17('0x0'));var logger=require(_0xbd17('0x1'))(_0xbd17('0x2'));var path=require(_0xbd17('0x3'));var exec=require(_0xbd17('0x4'))[_0xbd17('0x5')];var BPromise=require(_0xbd17('0x6'));function handleEntityNotFound(_0x3c5ea0,_0x2fb816){return function(_0x59c919){if(!_0x59c919){_0x3c5ea0['sendStatus'](0x194);;}return _0x59c919;};}function respondWithResult(_0x2cba2c,_0x4046e1){_0x4046e1=_0x4046e1||0xc8;return function(_0x22eb4a){if(_0x22eb4a){return _0x2cba2c[_0xbd17('0x7')](_0x4046e1)[_0xbd17('0x8')](_0x22eb4a);}return null;};}function handleError(_0x1d0868,_0x55a9ef){_0x55a9ef=_0x55a9ef||0x1f4;return function(_0x590ed7){logger[_0xbd17('0x9')](_0x590ed7[_0xbd17('0xa')]);if(_0x590ed7['name']){delete _0x590ed7['name'];}_0x1d0868[_0xbd17('0x7')](_0x55a9ef)[_0xbd17('0xb')](_0x590ed7);};}function execChildProcess(){return new BPromise(function(_0x2783a6,_0x29d27d){exec('npm\x20install',function(_0x15a220,_0x299c85,_0x14e472){logger[_0xbd17('0xc')](_0x299c85);logger[_0xbd17('0xc')](_0x14e472);if(_0x15a220){logger[_0xbd17('0x9')](_0x15a220);return _0x29d27d(_0x15a220);}return _0x2783a6(_0x299c85);});});}exports['index']=function(_0x28bf07,_0x49949e){return pm2[_0xbd17('0xd')]()[_0xbd17('0xe')](function(_0xcf756d){if(_0xcf756d){var _0x18820f=_[_0xbd17('0xf')](_0xcf756d,function(_0xda8e3a){return _0xda8e3a[_0xbd17('0x10')]===_0xbd17('0x11')||_0xda8e3a[_0xbd17('0x10')]===_0xbd17('0x12');});return{'rows':_0x18820f,'count':_0x18820f[_0xbd17('0x13')]};}return null;})[_0xbd17('0xe')](respondWithResult(_0x49949e,null))[_0xbd17('0x14')](handleError(_0x49949e,null));};exports[_0xbd17('0x15')]=function(_0x202e78,_0x9a328f){return pm2[_0xbd17('0x16')](_0x202e78[_0xbd17('0x17')]['id'])[_0xbd17('0xe')](respondWithResult(_0x9a328f,null))[_0xbd17('0xe')](handleEntityNotFound(_0x9a328f,null))[_0xbd17('0x14')](handleError(_0x9a328f,null));};exports['create']=function(_0x13069,_0xf3f907){if(_0x13069['body'][_0xbd17('0x10')]&&_0x13069[_0xbd17('0x18')]['script']){var _0x248804=path[_0xbd17('0x19')](__dirname,_0xbd17('0x1a'),_0x13069['body'][_0xbd17('0x1b')]);var _0x115817=process['cwd']();process[_0xbd17('0x1c')](path['dirname'](_0x248804));return execChildProcess()[_0xbd17('0xe')](function(_0x100b61){process[_0xbd17('0x1c')](_0x115817);return pm2[_0xbd17('0x1d')]({'name':_0x13069[_0xbd17('0x18')]['name'],'script':_0x248804});})[_0xbd17('0xe')](function(_0x64c949){pm2['dump']();return _0x64c949[0x0];})[_0xbd17('0xe')](respondWithResult(_0xf3f907,0xc9))[_0xbd17('0x14')](handleError(_0xf3f907,null));}else{return _0xf3f907[_0xbd17('0x7')](0x1f4)[_0xbd17('0xb')]({'message':_0xbd17('0x1e')});}};exports[_0xbd17('0x1f')]=function(_0x63b136,_0x20bd39){if(_0x63b136[_0xbd17('0x18')]['id']){delete _0x63b136[_0xbd17('0x18')]['id'];}var _0x639e3={'online':'restart','stopped':_0xbd17('0x20')};if(_0x639e3[_0xbd17('0x21')](_0x63b136['body'][_0xbd17('0x7')])){return pm2[_0x639e3[_0x63b136[_0xbd17('0x18')]['status']]](_0x63b136['params']['id'])[_0xbd17('0xe')](respondWithResult(_0x20bd39,0xc8))['catch'](handleError(_0x20bd39,null));}else{return _0x20bd39[_0xbd17('0x7')](0x1f4)[_0xbd17('0xb')]({'message':_0xbd17('0x22')});}};exports['destroy']=function(_0x586573,_0x318e13){if(_0x586573['body']['id']){delete _0x586573[_0xbd17('0x18')]['id'];}if(_0x586573['params']['id']){return pm2[_0xbd17('0x23')](_0x586573['params']['id'])[_0xbd17('0xe')](function(_0x243bdd){pm2[_0xbd17('0x24')]();return _0x243bdd[0x0];})[_0xbd17('0xe')](respondWithResult(_0x318e13,null))[_0xbd17('0x14')](handleError(_0x318e13,null));}else{return _0x318e13['status'](0x1f4)[_0xbd17('0xb')]({'message':_0xbd17('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bfcdfa1..df2fafd 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 _0x9a86=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x571fd6,_0x5223fc){var _0x4d6af6=function(_0xfc2c26){while(--_0xfc2c26){_0x571fd6['push'](_0x571fd6['shift']());}};_0x4d6af6(++_0x5223fc);}(_0x9a86,0x1ce));var _0x69a8=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x9a86[_0x18d631];return _0x50d708;};'use strict';var multer=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var path=require(_0x69a8('0x2'));var timeout=require(_0x69a8('0x3'));var express=require(_0x69a8('0x4'));var router=express[_0x69a8('0x5')]();var auth=require(_0x69a8('0x6'));var interaction=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));module[_0x69a8('0x9')]=router; \ No newline at end of file +var _0x7aef=['../../components/interaction/service','../../config/environment','multer','util','path','express','Router','../../components/auth/service'];(function(_0xf0c083,_0x456368){var _0x585d29=function(_0x4b9467){while(--_0x4b9467){_0xf0c083['push'](_0xf0c083['shift']());}};_0x585d29(++_0x456368);}(_0x7aef,0xe2));var _0xf7ae=function(_0x40f32e,_0x13fc0c){_0x40f32e=_0x40f32e-0x0;var _0x1b87d8=_0x7aef[_0x40f32e];return _0x1b87d8;};'use strict';var multer=require(_0xf7ae('0x0'));var util=require(_0xf7ae('0x1'));var path=require(_0xf7ae('0x2'));var timeout=require('connect-timeout');var express=require(_0xf7ae('0x3'));var router=express[_0xf7ae('0x4')]();var auth=require(_0xf7ae('0x5'));var interaction=require(_0xf7ae('0x6'));var config=require(_0xf7ae('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a14bbd1..ada117d 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 _0xacdd=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x56da17,_0x53ffef){var _0xf1f0c8=function(_0x55a4ae){while(--_0x55a4ae){_0x56da17['push'](_0x56da17['shift']());}};_0xf1f0c8(++_0x53ffef);}(_0xacdd,0xf7));var _0xdacd=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0xacdd[_0x30a457];return _0x2ae5cd;};'use strict';var Sequelize=require(_0xdacd('0x0'));module[_0xdacd('0x1')]={'state':{'type':Sequelize[_0xdacd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdacd('0x3')]},'scheduledat':{'type':Sequelize[_0xdacd('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdacd('0x4')]},'responsetime':{'type':Sequelize[_0xdacd('0x4')]},'ringtime':{'type':Sequelize[_0xdacd('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdacd('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdacd('0x3')]}}; \ No newline at end of file +var _0xb447=['STRING','DATE','INTEGER','exports'];(function(_0x5ed8f5,_0x1458a3){var _0xbd691c=function(_0x3a733c){while(--_0x3a733c){_0x5ed8f5['push'](_0x5ed8f5['shift']());}};_0xbd691c(++_0x1458a3);}(_0xb447,0x1ab));var _0x7b44=function(_0x37cec1,_0x230291){_0x37cec1=_0x37cec1-0x0;var _0x20716a=_0xb447[_0x37cec1];return _0x20716a;};'use strict';var Sequelize=require('sequelize');module[_0x7b44('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7b44('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7b44('0x1')]},'starttime':{'type':Sequelize[_0x7b44('0x2')]},'responsetime':{'type':Sequelize[_0x7b44('0x2')]},'ringtime':{'type':Sequelize[_0x7b44('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x7b44('0x1')]},'membername':{'type':Sequelize[_0x7b44('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6c76939..df50708 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 _0xd1de=['define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x651909,_0x15c6b4){var _0x572299=function(_0x5e8a48){while(--_0x5e8a48){_0x651909['push'](_0x651909['shift']());}};_0x572299(++_0x15c6b4);}(_0xd1de,0x114));var _0xed1d=function(_0x2cc5ab,_0x158ac0){_0x2cc5ab=_0x2cc5ab-0x0;var _0x415e0b=_0xd1de[_0x2cc5ab];return _0x415e0b;};'use strict';var _=require(_0xed1d('0x0'));var util=require('util');var logger=require(_0xed1d('0x1'))(_0xed1d('0x2'));var moment=require(_0xed1d('0x3'));var BPromise=require(_0xed1d('0x4'));var rp=require(_0xed1d('0x5'));var fs=require('fs');var path=require(_0xed1d('0x6'));var rimraf=require(_0xed1d('0x7'));var config=require(_0xed1d('0x8'));var attributes=require(_0xed1d('0x9'));module['exports']=function(_0x472b48,_0x4b2c4f){return _0x472b48[_0xed1d('0xa')](_0xed1d('0xb'),attributes,{'tableName':_0xed1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf954=['exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x871557,_0x21ae05){var _0x24345c=function(_0x364d8f){while(--_0x364d8f){_0x871557['push'](_0x871557['shift']());}};_0x24345c(++_0x21ae05);}(_0xf954,0x149));var _0x4f95=function(_0x249fac,_0x2afcd3){_0x249fac=_0x249fac-0x0;var _0x5f14c4=_0xf954[_0x249fac];return _0x5f14c4;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var logger=require(_0x4f95('0x2'))(_0x4f95('0x3'));var moment=require(_0x4f95('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f95('0x5'));var rimraf=require(_0x4f95('0x6'));var config=require(_0x4f95('0x7'));var attributes=require(_0x4f95('0x8'));module[_0x4f95('0x9')]=function(_0x5a4c93,_0x129921){return _0x5a4c93[_0x4f95('0xa')](_0x4f95('0xb'),attributes,{'tableName':_0x4f95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index e16f7d8..f1201d2 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 _0x7e0f=['jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x222978,_0x3706ee){var _0x2b1818=function(_0x102185){while(--_0x102185){_0x222978['push'](_0x222978['shift']());}};_0x2b1818(++_0x3706ee);}(_0x7e0f,0xc1));var _0xf7e0=function(_0x3dcede,_0x5f30df){_0x3dcede=_0x3dcede-0x0;var _0x3aa385=_0x7e0f[_0x3dcede];return _0x3aa385;};'use strict';var _=require(_0xf7e0('0x0'));var util=require(_0xf7e0('0x1'));var moment=require(_0xf7e0('0x2'));var BPromise=require(_0xf7e0('0x3'));var rs=require(_0xf7e0('0x4'));var fs=require('fs');var Redis=require(_0xf7e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7e0('0x6'));var logger=require(_0xf7e0('0x7'))(_0xf7e0('0x8'));var config=require(_0xf7e0('0x9'));var jayson=require(_0xf7e0('0xa'));var client=jayson[_0xf7e0('0xb')][_0xf7e0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5653a4,_0x6b9553,_0x4ba7f4){return new BPromise(function(_0x56e045,_0x526988){return client['request'](_0x5653a4,_0x4ba7f4)[_0xf7e0('0xd')](function(_0x34851c){logger[_0xf7e0('0xe')](_0xf7e0('0xf'),_0x6b9553,'request\x20sent');logger[_0xf7e0('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x6b9553,_0xf7e0('0x11'),JSON[_0xf7e0('0x12')](_0x34851c));if(_0x34851c[_0xf7e0('0x13')]){if(_0x34851c['error'][_0xf7e0('0x14')]===0x1f4){logger[_0xf7e0('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x6b9553,_0x34851c['error'][_0xf7e0('0x15')]);return _0x526988(_0x34851c['error'][_0xf7e0('0x15')]);}logger[_0xf7e0('0x13')](_0xf7e0('0xf'),_0x6b9553,_0x34851c['error'][_0xf7e0('0x15')]);return _0x56e045(_0x34851c['error']['message']);}else{logger[_0xf7e0('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x6b9553,_0xf7e0('0x11'));_0x56e045(_0x34851c['result']['message']);}})[_0xf7e0('0x16')](function(_0x14bdc2){logger[_0xf7e0('0x13')](_0xf7e0('0xf'),_0x6b9553,_0x14bdc2);_0x526988(_0x14bdc2);});});}exports[_0xf7e0('0x17')]=function(_0x1464c1){var _0x455bde=this;return new Promise(function(_0x4012b2,_0x31e4b9){return db[_0xf7e0('0x18')][_0xf7e0('0x19')](_0x1464c1[_0xf7e0('0x1a')],{'raw':_0x1464c1[_0xf7e0('0x1b')]?_0x1464c1['options'][_0xf7e0('0x1c')]===undefined?!![]:![]:!![]})[_0xf7e0('0xd')](function(_0x5b3c6e){logger[_0xf7e0('0xe')](_0xf7e0('0x17'),_0x1464c1);logger[_0xf7e0('0x10')](_0xf7e0('0x17'),_0x1464c1,JSON[_0xf7e0('0x12')](_0x5b3c6e));_0x4012b2(_0x5b3c6e);})['catch'](function(_0x382894){logger['error'](_0xf7e0('0x17'),_0x382894[_0xf7e0('0x15')],_0x1464c1);_0x31e4b9(_0x455bde[_0xf7e0('0x13')](0x1f4,_0x382894[_0xf7e0('0x15')]));});});}; \ No newline at end of file +var _0x20bb=['then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x4cdd4b,_0x35c694){var _0x322ab5=function(_0x4e6264){while(--_0x4e6264){_0x4cdd4b['push'](_0x4cdd4b['shift']());}};_0x322ab5(++_0x35c694);}(_0x20bb,0x78));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb20b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb20b('0x1'));var fs=require('fs');var Redis=require(_0xb20b('0x2'));var db=require(_0xb20b('0x3'))['db'];var utils=require(_0xb20b('0x4'));var logger=require('../../config/logger')(_0xb20b('0x5'));var config=require(_0xb20b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb20b('0x7')][_0xb20b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d99a,_0x11d478,_0x2ba60c){return new BPromise(function(_0x1a106f,_0x50a0db){return client[_0xb20b('0x9')](_0x31d99a,_0x2ba60c)[_0xb20b('0xa')](function(_0x151db2){logger[_0xb20b('0xb')](_0xb20b('0xc'),_0x11d478,'request\x20sent');logger[_0xb20b('0xd')](_0xb20b('0xe'),_0x11d478,'request\x20sent',JSON[_0xb20b('0xf')](_0x151db2));if(_0x151db2[_0xb20b('0x10')]){if(_0x151db2[_0xb20b('0x10')]['code']===0x1f4){logger[_0xb20b('0x10')](_0xb20b('0xc'),_0x11d478,_0x151db2[_0xb20b('0x10')][_0xb20b('0x11')]);return _0x50a0db(_0x151db2[_0xb20b('0x10')]['message']);}logger[_0xb20b('0x10')](_0xb20b('0xc'),_0x11d478,_0x151db2[_0xb20b('0x10')][_0xb20b('0x11')]);return _0x1a106f(_0x151db2['error'][_0xb20b('0x11')]);}else{logger[_0xb20b('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x11d478,_0xb20b('0x12'));_0x1a106f(_0x151db2[_0xb20b('0x13')][_0xb20b('0x11')]);}})[_0xb20b('0x14')](function(_0x4afa3e){logger['error'](_0xb20b('0xc'),_0x11d478,_0x4afa3e);_0x50a0db(_0x4afa3e);});});}exports[_0xb20b('0x15')]=function(_0x3cf9a6){var _0x7ccd10=this;return new Promise(function(_0x58d776,_0x39affc){return db[_0xb20b('0x16')][_0xb20b('0x17')](_0x3cf9a6['body'],{'raw':_0x3cf9a6[_0xb20b('0x18')]?_0x3cf9a6[_0xb20b('0x18')][_0xb20b('0x19')]===undefined?!![]:![]:!![]})[_0xb20b('0xa')](function(_0x55b123){logger['info'](_0xb20b('0x15'),_0x3cf9a6);logger[_0xb20b('0xd')](_0xb20b('0x15'),_0x3cf9a6,JSON[_0xb20b('0xf')](_0x55b123));_0x58d776(_0x55b123);})[_0xb20b('0x14')](function(_0x303792){logger[_0xb20b('0x10')](_0xb20b('0x15'),_0x303792[_0xb20b('0x11')],_0x3cf9a6);_0x39affc(_0x7ccd10['error'](0x1f4,_0x303792[_0xb20b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1b37b23..912f21c 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 _0xdb2b=['mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues'];(function(_0x1e69ed,_0x26879f){var _0x215adc=function(_0xcd5a96){while(--_0xcd5a96){_0x1e69ed['push'](_0x1e69ed['shift']());}};_0x215adc(++_0x26879f);}(_0xdb2b,0x89));var _0xbdb2=function(_0x487f51,_0x268f8f){_0x487f51=_0x487f51-0x0;var _0xaf1452=_0xdb2b[_0x487f51];return _0xaf1452;};'use strict';var multer=require(_0xbdb2('0x0'));var util=require(_0xbdb2('0x1'));var path=require(_0xbdb2('0x2'));var express=require(_0xbdb2('0x3'));var router=express[_0xbdb2('0x4')]();var auth=require(_0xbdb2('0x5'));var controller=require(_0xbdb2('0x6'));router[_0xbdb2('0x7')](_0xbdb2('0x8'),auth[_0xbdb2('0x9')](),controller['voiceChannels']);router[_0xbdb2('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xbdb2('0x7')](_0xbdb2('0xa'),auth[_0xbdb2('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0xbdb2('0x7')](_0xbdb2('0xb'),auth['isAuthenticated'](),controller[_0xbdb2('0xc')]);router[_0xbdb2('0x7')](_0xbdb2('0xd'),auth[_0xbdb2('0x9')](),controller['chatQueues']);router[_0xbdb2('0x7')](_0xbdb2('0xe'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0xf')]);router[_0xbdb2('0x7')]('/mail/accounts',auth[_0xbdb2('0x9')](),controller['mailAccounts']);router[_0xbdb2('0x7')](_0xbdb2('0x10'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x11')]);router[_0xbdb2('0x7')](_0xbdb2('0x12'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x13')]);router['get'](_0xbdb2('0x14'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xbdb2('0x7')](_0xbdb2('0x15'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x16')]);router[_0xbdb2('0x7')](_0xbdb2('0x17'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x18')]);router[_0xbdb2('0x7')](_0xbdb2('0x19'),auth[_0xbdb2('0x9')](),controller['voiceQueuesChannels']);router[_0xbdb2('0x7')]('/voice/queues/channels/:uniqueid',auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x1a')]);router['get'](_0xbdb2('0x1b'),auth[_0xbdb2('0x9')](),controller['voiceQueuesChannelHangup']);router[_0xbdb2('0x7')](_0xbdb2('0x1c'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x1d')]);router[_0xbdb2('0x7')](_0xbdb2('0x1e'),auth[_0xbdb2('0x9')](),controller['showVoiceQueues']);router[_0xbdb2('0x7')]('/outbound',auth[_0xbdb2('0x9')](),controller['outbound']);router[_0xbdb2('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xbdb2('0x1f')]);router['get'](_0xbdb2('0x20'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x21')]);router[_0xbdb2('0x22')](_0xbdb2('0x23'),auth[_0xbdb2('0x9')](),controller['agentCapacity']);router[_0xbdb2('0x7')](_0xbdb2('0x24'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x25')]);router['get'](_0xbdb2('0x26'),auth['isAuthenticated'](),controller[_0xbdb2('0x27')]);router['get'](_0xbdb2('0x28'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x29')]);router[_0xbdb2('0x7')](_0xbdb2('0x2a'),auth['isAuthenticated'](),controller[_0xbdb2('0x2b')]);router[_0xbdb2('0x7')](_0xbdb2('0x2c'),auth['isAuthenticated'](),controller[_0xbdb2('0x2d')]);router['get'](_0xbdb2('0x2e'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x2f')]);router[_0xbdb2('0x7')](_0xbdb2('0x30'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x31')]);router['get']('/sms/queues/waitinginteractions',auth[_0xbdb2('0x9')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x32')]);router[_0xbdb2('0x7')](_0xbdb2('0x33'),auth[_0xbdb2('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xbdb2('0x34')](_0xbdb2('0x35'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x36')](_0xbdb2('0x37')));router['get'](_0xbdb2('0x38'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x39')]);router[_0xbdb2('0x34')](_0xbdb2('0x3a'),auth['isAuthenticated'](),controller[_0xbdb2('0x36')](_0xbdb2('0x3b')));router[_0xbdb2('0x7')]('/chat/queues/:id',auth[_0xbdb2('0x9')](),controller['showChatQueues']);router[_0xbdb2('0x34')](_0xbdb2('0x3c'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x36')](_0xbdb2('0x3d')));router[_0xbdb2('0x7')](_0xbdb2('0x3e'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xbdb2('0x34')](_0xbdb2('0x3f'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x36')](_0xbdb2('0x40')));router[_0xbdb2('0x7')](_0xbdb2('0x41'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x42')]);router[_0xbdb2('0x34')](_0xbdb2('0x43'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x36')]('sms'));router['post'](_0xbdb2('0x44'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x36')](_0xbdb2('0x45')));router[_0xbdb2('0x7')](_0xbdb2('0x46'),auth[_0xbdb2('0x9')](),controller['showSmsQueues']);router['get'](_0xbdb2('0x47'),auth[_0xbdb2('0x9')](),controller[_0xbdb2('0x48')]);router[_0xbdb2('0x34')](_0xbdb2('0x49'),auth['isAuthenticated'](),controller[_0xbdb2('0x4a')]);module[_0xbdb2('0x4b')]=router; \ No newline at end of file +var _0xf19d=['/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x59effe,_0x12a1d8){var _0x40e2dc=function(_0x4688a5){while(--_0x4688a5){_0x59effe['push'](_0x59effe['shift']());}};_0x40e2dc(++_0x12a1d8);}(_0xf19d,0x14c));var _0xdf19=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xf19d[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var path=require(_0xdf19('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdf19('0x3'));var controller=require(_0xdf19('0x4'));router[_0xdf19('0x5')](_0xdf19('0x6'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x8')]);router[_0xdf19('0x5')](_0xdf19('0x9'),auth[_0xdf19('0x7')](),controller['voiceChannelMixMonitor']);router[_0xdf19('0x5')](_0xdf19('0xa'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0xdf19('0x7')](),controller[_0xdf19('0xb')]);router['get'](_0xdf19('0xc'),auth[_0xdf19('0x7')](),controller['chatQueues']);router[_0xdf19('0x5')](_0xdf19('0xd'),auth[_0xdf19('0x7')](),controller[_0xdf19('0xe')]);router['get'](_0xdf19('0xf'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x10')]);router[_0xdf19('0x5')](_0xdf19('0x11'),auth[_0xdf19('0x7')](),controller['openchannelQueues']);router[_0xdf19('0x5')](_0xdf19('0x12'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x13')]);router['get'](_0xdf19('0x14'),auth[_0xdf19('0x7')](),controller['whatsappQueues']);router[_0xdf19('0x5')](_0xdf19('0x15'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x16')]);router['get'](_0xdf19('0x17'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x18')]);router[_0xdf19('0x5')](_0xdf19('0x19'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x1a')]);router[_0xdf19('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xdf19('0x7')](),controller[_0xdf19('0x1b')]);router[_0xdf19('0x5')](_0xdf19('0x1c'),auth['isAuthenticated'](),controller[_0xdf19('0x1d')]);router[_0xdf19('0x5')](_0xdf19('0x1e'),auth[_0xdf19('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xdf19('0x1f'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x20')]);router[_0xdf19('0x5')](_0xdf19('0x21'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x22')]);router[_0xdf19('0x5')](_0xdf19('0x23'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x24')]);router[_0xdf19('0x5')](_0xdf19('0x25'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x26')]);router[_0xdf19('0x27')](_0xdf19('0x28'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x29')]);router[_0xdf19('0x5')](_0xdf19('0x2a'),auth[_0xdf19('0x7')](),controller['telephones']);router[_0xdf19('0x5')](_0xdf19('0x2b'),auth[_0xdf19('0x7')](),controller['trunks']);router['get'](_0xdf19('0x2c'),auth['isAuthenticated'](),controller['campaigns']);router[_0xdf19('0x5')](_0xdf19('0x2d'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x2e')]);router['get'](_0xdf19('0x2f'),auth['isAuthenticated'](),controller[_0xdf19('0x30')]);router[_0xdf19('0x5')](_0xdf19('0x31'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x32')]);router['get'](_0xdf19('0x33'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x34')]);router[_0xdf19('0x5')]('/sms/queues/waitinginteractions',auth[_0xdf19('0x7')](),controller[_0xdf19('0x35')]);router['get'](_0xdf19('0x36'),auth['isAuthenticated'](),controller[_0xdf19('0x37')]);router[_0xdf19('0x5')](_0xdf19('0x38'),auth['isAuthenticated'](),controller[_0xdf19('0x39')]);router[_0xdf19('0x3a')]('/mail/queues/:id/notify',auth[_0xdf19('0x7')](),controller[_0xdf19('0x3b')](_0xdf19('0x3c')));router[_0xdf19('0x5')](_0xdf19('0x3d'),auth['isAuthenticated'](),controller[_0xdf19('0x3e')]);router[_0xdf19('0x3a')](_0xdf19('0x3f'),auth[_0xdf19('0x7')](),controller['queueNotify'](_0xdf19('0x40')));router[_0xdf19('0x5')]('/chat/queues/:id',auth[_0xdf19('0x7')](),controller[_0xdf19('0x41')]);router['post'](_0xdf19('0x42'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x3b')]('fax'));router[_0xdf19('0x5')](_0xdf19('0x43'),auth['isAuthenticated'](),controller[_0xdf19('0x44')]);router[_0xdf19('0x3a')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xdf19('0x45')));router[_0xdf19('0x5')](_0xdf19('0x46'),auth['isAuthenticated'](),controller[_0xdf19('0x47')]);router[_0xdf19('0x3a')](_0xdf19('0x48'),auth['isAuthenticated'](),controller[_0xdf19('0x3b')]('sms'));router['post'](_0xdf19('0x49'),auth['isAuthenticated'](),controller['queueNotify'](_0xdf19('0x4a')));router[_0xdf19('0x5')](_0xdf19('0x4b'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x4c')]);router[_0xdf19('0x5')](_0xdf19('0x4d'),auth[_0xdf19('0x7')](),controller[_0xdf19('0x4e')]);router[_0xdf19('0x3a')]('/agents/:id/notify',auth[_0xdf19('0x7')](),controller[_0xdf19('0x4f')]);module[_0xdf19('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index be3123b..6548b52 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 _0xc720=['length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','AgentCapacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','Website','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','From','TransferReport','Start','queue','queueTransferTimeout','channel','capitalize','chat','Message','*,*,*,*','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','request','then','error','code','message','catch','status','json','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','MemberReport','findAll','INTERACTION'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xc720,0x118));var _0x0c72=function(_0x5663e4,_0x411379){_0x5663e4=_0x5663e4-0x0;var _0x237d81=_0xc720[_0x5663e4];return _0x237d81;};'use strict';var BPromise=require(_0x0c72('0x0'));var moment=require(_0x0c72('0x1'));var _=require(_0x0c72('0x2'));var util=require('util');var db=require(_0x0c72('0x3'))['db'];var logger=require(_0x0c72('0x4'))('api');var jayson=require(_0x0c72('0x5'));var amiClient=jayson[_0x0c72('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x0c72('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x0c72('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c7068,_0x3ed393,_0x591b79){return new BPromise(function(_0x40d20c,_0x338d9e){var _0x54387d=_0x591b79?_0x591b79:amiClient;return _0x54387d[_0x0c72('0x7')](_0x3c7068,_0x3ed393)[_0x0c72('0x8')](function(_0x3b69a1){if(_0x3b69a1[_0x0c72('0x9')]){if(_0x3b69a1[_0x0c72('0x9')][_0x0c72('0xa')]===0x1f4){return _0x338d9e(_0x3b69a1[_0x0c72('0x9')]['message']);}return _0x40d20c(_0x3b69a1[_0x0c72('0x9')][_0x0c72('0xb')]);}else{_0x40d20c(_0x3b69a1['result']);}})[_0x0c72('0xc')](function(_0x5b9f08){_0x338d9e(_0x5b9f08);});});}function respondWithResult(_0x369d42,_0x30de11){_0x30de11=_0x30de11||0xc8;return function(_0x3bafc2){if(_0x3bafc2){return _0x369d42[_0x0c72('0xd')](_0x30de11)[_0x0c72('0xe')](_0x3bafc2);}return _0x369d42['sendStatus'](0x194);};}function handleError(_0x53b77d,_0xca6d79){_0xca6d79=_0xca6d79||0x1f4;return function(_0x41fe80){logger['error'](_0x41fe80['stack']);if(_0x41fe80[_0x0c72('0xf')]){delete _0x41fe80['name'];}_0x53b77d[_0x0c72('0xd')](_0xca6d79)[_0x0c72('0x10')](_0x41fe80);};}function findById(_0x3d2711){return function(_0x2ec67b){if(!_[_0x0c72('0x11')](_0x3d2711)&&!_[_0x0c72('0x11')](_0x2ec67b)&&!_[_0x0c72('0x11')](_0x2ec67b['rows'])){return _['find'](_0x2ec67b[_0x0c72('0x12')],function(_0x28961f){return _0x28961f['id']==_0x3d2711;});}return null;};}exports[_0x0c72('0x13')]=function(_0x20ec64,_0x66fd20){return respondWithRpcPromise(_0x0c72('0x14'),_0x20ec64[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x66fd20,null))[_0x0c72('0xc')](handleError(_0x66fd20,null));};exports[_0x0c72('0x16')]=function(_0x4565b9,_0x3bf683){return respondWithRpcPromise(_0x0c72('0x17'),_['merge'](_0x4565b9['query'],_0x4565b9[_0x0c72('0x18')]))[_0x0c72('0x8')](respondWithResult(_0x3bf683,null))[_0x0c72('0xc')](handleError(_0x3bf683,null));};exports[_0x0c72('0x19')]=function(_0x3845aa,_0x20b9ad){return respondWithRpcPromise(_0x0c72('0x1a'),_[_0x0c72('0x1b')](_0x3845aa[_0x0c72('0x15')],_0x3845aa['params']))['then'](respondWithResult(_0x20b9ad,null))[_0x0c72('0xc')](handleError(_0x20b9ad,null));};exports[_0x0c72('0x1c')]=function(_0x85ffcc,_0x2429cc){return respondWithRpcPromise(_0x0c72('0x1d'),_0x85ffcc[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x2429cc,null))[_0x0c72('0xc')](handleError(_0x2429cc,null));};exports[_0x0c72('0x1e')]=function(_0x264081,_0x26c166){return respondWithRpcPromise(_0x0c72('0x1d'),_0x264081[_0x0c72('0x15')])['then'](findById(_0x264081['params']['id']))[_0x0c72('0x8')](respondWithResult(_0x26c166,null))[_0x0c72('0xc')](handleError(_0x26c166,null));};exports['voiceQueuesPreview']=function(_0x9a6664,_0x1b1084){return respondWithRpcPromise(_0x0c72('0x1f'),_['merge'](_0x9a6664[_0x0c72('0x15')],_0x9a6664['params']))[_0x0c72('0x8')](respondWithResult(_0x1b1084,null))['catch'](handleError(_0x1b1084,null));};exports[_0x0c72('0x20')]=function(_0x1fb9f8,_0x463922){return respondWithRpcPromise(_0x0c72('0x21'),_0x1fb9f8[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x463922,null))['catch'](handleError(_0x463922,null));};exports['voiceQueuesChannel']=function(_0x27e6e3,_0x57c9fa){return respondWithRpcPromise(_0x0c72('0x22'),_[_0x0c72('0x1b')](_0x27e6e3[_0x0c72('0x15')],_0x27e6e3[_0x0c72('0x18')]))[_0x0c72('0x8')](respondWithResult(_0x57c9fa,null))[_0x0c72('0xc')](handleError(_0x57c9fa,null));};exports['voiceQueuesChannelHangup']=function(_0x54d21c,_0x5bb224){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x0c72('0x1b')](_0x54d21c[_0x0c72('0x15')],_0x54d21c['params']))[_0x0c72('0x8')](respondWithResult(_0x5bb224,null))['catch'](handleError(_0x5bb224,null));};exports[_0x0c72('0x23')]=function(_0x5c2fe2,_0x27855e){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x5c2fe2[_0x0c72('0x15')],_0x5c2fe2[_0x0c72('0x18')]))[_0x0c72('0x8')](respondWithResult(_0x27855e,null))[_0x0c72('0xc')](handleError(_0x27855e,null));};exports[_0x0c72('0x24')]=function(_0x2af422,_0x3f9c26){return respondWithRpcPromise('Outbound',_0x2af422[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x3f9c26,null))[_0x0c72('0xc')](handleError(_0x3f9c26,null));};exports[_0x0c72('0x25')]=function(_0x1bf4e1,_0x162656){return respondWithRpcPromise('OutboundChannels',_0x1bf4e1['query'])['then'](respondWithResult(_0x162656,null))[_0x0c72('0xc')](handleError(_0x162656,null));};exports[_0x0c72('0x26')]=function(_0x15eacf,_0x29cc15){var _0x24f608;return respondWithRpcPromise(_0x0c72('0x27'),_0x15eacf['query'])[_0x0c72('0x8')](function(_0x5e508c){_0x24f608=_0x5e508c;return respondWithRpcPromise(_0x0c72('0x27'),_0x15eacf['query'],routingClient);})[_0x0c72('0x8')](function(_0x37dce4){return _['merge']({},_0x37dce4,_0x24f608);})[_0x0c72('0x8')](respondWithResult(_0x29cc15,null))[_0x0c72('0xc')](handleError(_0x29cc15,null));};exports[_0x0c72('0x28')]=function(_0x447204,_0x5309b5){if(_0x447204[_0x0c72('0x29')]&&_0x447204['body']['interaction']&&_0x447204[_0x0c72('0x2a')]&&_0x447204['user']['name']){for(var _0x317301 in _0x447204['body'][_0x0c72('0x2b')]){if(_0x447204['body'][_0x0c72('0x2b')]['hasOwnProperty'](_0x317301)){db[_0x0c72('0x2c')][_0x0c72('0x2d')]({'where':{'channel':_0x317301,'membername':_0x447204[_0x0c72('0x2a')][_0x0c72('0xf')],'type':_0x0c72('0x2e'),'exitAt':null,'uniqueid':_0x447204[_0x0c72('0x29')][_0x0c72('0x2b')][_0x317301]&&_0x447204[_0x0c72('0x29')][_0x0c72('0x2b')][_0x317301][_0x0c72('0x2f')]?{'$notIn':_0x447204[_0x0c72('0x29')]['interaction'][_0x317301]}:{'$ne':null}}})[_0x0c72('0x8')](function(_0x352c58){var _0x5d82d6=moment()[_0x0c72('0x30')](_0x0c72('0x31'));for(var _0x2d93d8=0x0,_0x1990c0=_0x352c58['length'];_0x2d93d8<_0x1990c0;_0x2d93d8+=0x1){_0x352c58[_0x2d93d8][_0x0c72('0x32')]({'exitAt':_0x5d82d6});}});for(var _0x311d00=0x0;_0x311d00<_0x447204[_0x0c72('0x29')]['interaction'][_0x317301][_0x0c72('0x2f')];_0x311d00+=0x1){db[_0x0c72('0x2c')]['findOrCreate']({'where':{'channel':_0x317301,'membername':_0x447204['user']['name'],'type':_0x0c72('0x2e'),'uniqueid':_0x447204[_0x0c72('0x29')]['interaction'][_0x317301][_0x311d00],'exitAt':null},'defaults':{'channel':_0x317301,'membername':_0x447204[_0x0c72('0x2a')][_0x0c72('0xf')],'interface':_['isNil'](_0x447204[_0x0c72('0x2a')]['interface'])?util['format'](_0x0c72('0x33'),_0x447204[_0x0c72('0x2a')][_0x0c72('0xf')]):_0x447204[_0x0c72('0x2a')][_0x0c72('0x34')],'type':'INTERACTION','enterAt':moment()[_0x0c72('0x30')](_0x0c72('0x31')),'role':_0x0c72('0x35'),'internal':_0x447204[_0x0c72('0x2a')][_0x0c72('0x36')],'uniqueid':_0x447204[_0x0c72('0x29')][_0x0c72('0x2b')][_0x317301][_0x311d00]}});}}}}return respondWithRpcPromise(_0x0c72('0x37'),{'id':_0x447204[_0x0c72('0x18')]['id'],'capacity':_0x447204[_0x0c72('0x29')]['capacity']},routingClient)[_0x0c72('0x8')](respondWithResult(_0x5309b5,null))[_0x0c72('0xc')](handleError(_0x5309b5,null));};exports[_0x0c72('0x38')]=function(_0x14cdbd,_0x3d7f9a){return respondWithRpcPromise('Telephones',_0x14cdbd[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x3d7f9a,null))[_0x0c72('0xc')](handleError(_0x3d7f9a,null));};exports[_0x0c72('0x39')]=function(_0xb9ee6f,_0x1d47a6){return respondWithRpcPromise('Trunks',_0xb9ee6f['query'])['then'](respondWithResult(_0x1d47a6,null))[_0x0c72('0xc')](handleError(_0x1d47a6,null));};exports[_0x0c72('0x3a')]=function(_0x1ea437,_0x1fc074){return respondWithRpcPromise(_0x0c72('0x3b'),_0x1ea437[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x1fc074,null))[_0x0c72('0xc')](handleError(_0x1fc074,null));};exports[_0x0c72('0x3c')]=function(_0x1230f3,_0x365d40){return respondWithRpcPromise(_0x0c72('0x3d'),_0x1230f3[_0x0c72('0x15')],routingClient)['then'](respondWithResult(_0x365d40,null))[_0x0c72('0xc')](handleError(_0x365d40,null));};exports[_0x0c72('0x3e')]=function(_0x7f83bc,_0x42bd99){return respondWithRpcPromise(_0x0c72('0x3d'),_0x7f83bc[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](findById(_0x7f83bc[_0x0c72('0x18')]['id']))[_0x0c72('0x8')](respondWithResult(_0x42bd99,null))['catch'](handleError(_0x42bd99,null));};exports[_0x0c72('0x3f')]=function(_0x1d4404,_0x2b29d0){return respondWithRpcPromise('MailQueues',_0x1d4404[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x2b29d0,null))[_0x0c72('0xc')](handleError(_0x2b29d0,null));};exports[_0x0c72('0x40')]=function(_0x28b7c3,_0x5ea7f3){return respondWithRpcPromise(_0x0c72('0x41'),_0x28b7c3['query'],routingClient)[_0x0c72('0x8')](findById(_0x28b7c3[_0x0c72('0x18')]['id']))[_0x0c72('0x8')](respondWithResult(_0x5ea7f3,null))[_0x0c72('0xc')](handleError(_0x5ea7f3,null));};exports[_0x0c72('0x42')]=function(_0x391d79,_0x510d12){return respondWithRpcPromise(_0x0c72('0x43'),_0x391d79['query'],mailClient)['then'](respondWithResult(_0x510d12,null))[_0x0c72('0xc')](handleError(_0x510d12,null));};exports['openchannelQueues']=function(_0x4f1a29,_0x358371){return respondWithRpcPromise(_0x0c72('0x44'),_0x4f1a29[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x358371,null))[_0x0c72('0xc')](handleError(_0x358371,null));};exports[_0x0c72('0x45')]=function(_0x1a723b,_0x444836){return respondWithRpcPromise('OpenchannelQueues',_0x1a723b[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](findById(_0x1a723b[_0x0c72('0x18')]['id']))[_0x0c72('0x8')](respondWithResult(_0x444836,null))[_0x0c72('0xc')](handleError(_0x444836,null));};exports[_0x0c72('0x46')]=function(_0x32f631,_0x2ea68b){return respondWithRpcPromise(_0x0c72('0x47'),_0x32f631[_0x0c72('0x15')],routingClient)['then'](respondWithResult(_0x2ea68b,null))[_0x0c72('0xc')](handleError(_0x2ea68b,null));};exports['showSmsQueues']=function(_0x1f5386,_0x3c550c){return respondWithRpcPromise(_0x0c72('0x47'),_0x1f5386[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](findById(_0x1f5386['params']['id']))[_0x0c72('0x8')](respondWithResult(_0x3c550c,null))['catch'](handleError(_0x3c550c,null));};exports[_0x0c72('0x48')]=function(_0x437fb4,_0x4f354d){return respondWithRpcPromise('WhatsappQueues',_0x437fb4['query'],routingClient)[_0x0c72('0x8')](respondWithResult(_0x4f354d,null))['catch'](handleError(_0x4f354d,null));};exports[_0x0c72('0x49')]=function(_0x2b3444,_0x200b29){return respondWithRpcPromise(_0x0c72('0x4a'),_0x2b3444['query'],routingClient)[_0x0c72('0x8')](findById(_0x2b3444[_0x0c72('0x18')]['id']))[_0x0c72('0x8')](respondWithResult(_0x200b29,null))['catch'](handleError(_0x200b29,null));};exports[_0x0c72('0x4b')]=function(_0x542d95,_0x1807d1){return respondWithRpcPromise('FaxQueues',_0x542d95[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x1807d1,null))[_0x0c72('0xc')](handleError(_0x1807d1,null));};exports[_0x0c72('0x4c')]=function(_0x20879d,_0x5b49b1){return respondWithRpcPromise(_0x0c72('0x4d'),_0x20879d[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](findById(_0x20879d[_0x0c72('0x18')]['id']))[_0x0c72('0x8')](respondWithResult(_0x5b49b1,null))[_0x0c72('0xc')](handleError(_0x5b49b1,null));};exports[_0x0c72('0x4e')]=function(_0x53ad0a,_0x4e356f){return respondWithRpcPromise(_0x0c72('0x4f'),_0x53ad0a[_0x0c72('0x15')])[_0x0c72('0x8')](respondWithResult(_0x4e356f,null))[_0x0c72('0xc')](handleError(_0x4e356f,null));};exports[_0x0c72('0x50')]=function(_0x52cce5,_0x274750){return respondWithRpcPromise(_0x0c72('0x51'),_0x52cce5[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x274750,null))['catch'](handleError(_0x274750,null));};exports[_0x0c72('0x52')]=function(_0x354992,_0x4fa7d2){return respondWithRpcPromise(_0x0c72('0x53'),_0x354992[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x4fa7d2,null))[_0x0c72('0xc')](handleError(_0x4fa7d2,null));};exports[_0x0c72('0x54')]=function(_0x375e6f,_0x459dec){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x375e6f[_0x0c72('0x15')],routingClient)['then'](respondWithResult(_0x459dec,null))[_0x0c72('0xc')](handleError(_0x459dec,null));};exports[_0x0c72('0x55')]=function(_0x13019c,_0x342523){return respondWithRpcPromise(_0x0c72('0x56'),_0x13019c['query'],routingClient)[_0x0c72('0x8')](respondWithResult(_0x342523,null))[_0x0c72('0xc')](handleError(_0x342523,null));};exports[_0x0c72('0x57')]=function(_0x2e4f54,_0x37c24e){return respondWithRpcPromise(_0x0c72('0x58'),_0x2e4f54[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x37c24e,null))[_0x0c72('0xc')](handleError(_0x37c24e,null));};exports['faxQueuesWaitingInteractions']=function(_0x425eaa,_0x20583b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x425eaa[_0x0c72('0x15')],routingClient)[_0x0c72('0x8')](respondWithResult(_0x20583b,null))[_0x0c72('0xc')](handleError(_0x20583b,null));};exports['queueNotify']=function(_0x2c50d6){return function(_0xcdd95,_0x3cad93){var _0x16f1ed,_0x3c76fc;var _0x2efba1=_['capitalize'](_0x2c50d6);var _0x2edee7=_0x2c50d6==='chat'?_0x0c72('0x59'):'Account';return db[_0x2efba1+_0x0c72('0x5a')][_0x0c72('0x5b')]({'raw':!![],'where':{'id':_0xcdd95['params']['id']}})[_0x0c72('0x8')](function(_0x4e8869){if(_[_0x0c72('0x11')](_0x4e8869)){throw new Error(_0x2efba1+_0x0c72('0x5c'));}_0x16f1ed=_0x4e8869;return db[_0x2efba1+'Message'][_0x0c72('0x5b')]({'where':{'id':_0xcdd95[_0x0c72('0x29')][_0x0c72('0x5d')]},'include':[{'model':db[_0x2efba1+_0x0c72('0x5e')],'as':_0x0c72('0x5e')},{'model':db[_0x2efba1+_0x2edee7],'as':_0x0c72('0x5f')}]});})[_0x0c72('0x8')](function(_0xcd8a0e){if(_['isNil'](_0xcd8a0e)){throw new Error(_0x2efba1+_0x0c72('0x60'));}_0x3c76fc=_0xcd8a0e;return _0xcd8a0e[_0x0c72('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0c72('0x8')](function(){var _0x35a167={'uniqueid':_0x2c50d6+'.'+_0x3c76fc['id']+'.'+_0x3c76fc[_0x0c72('0x5e')]['id'],'FromUserId':_0xcdd95[_0x0c72('0x2a')]['id'],'type':'queue'};_0x35a167[_0x2efba1+_0x0c72('0x62')]=_0x3c76fc['id'];_0x35a167[_0x2efba1+'InteractionId']=_0x3c76fc[_0x0c72('0x5e')]['id'];_0x35a167[_0x0c72('0x63')+_0x2efba1+_0x2edee7+'Id']=_0x3c76fc[_0x0c72('0x5f')]['id'];_0x35a167['To'+_0x2efba1+'QueueId']=_0x16f1ed['id'];return db[_0x2efba1+_0x0c72('0x64')]['create'](_0x35a167);})[_0x0c72('0x8')](function(){return respondWithRpcPromise(_0x0c72('0x65'),{'channel':_0x2c50d6,'interaction':_0x3c76fc['Interaction'],'message':_0x3c76fc,'account':_0x3c76fc[_0x0c72('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0c72('0x66'),'appdata':_0x16f1ed[_0x0c72('0xf')]+','+(_0x3c76fc[_0x0c72('0x5f')][_0x0c72('0x67')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0c72('0x8')](respondWithResult(_0x3cad93,null))['catch'](handleError(_0x3cad93,null));};};exports['agentNotify']=function(_0x55ef4d,_0x549981){var _0x1de2f9,_0x3d3c99;if(_[_0x0c72('0x11')](_0x55ef4d[_0x0c72('0x29')][_0x0c72('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x54920d=_0x55ef4d['body'][_0x0c72('0x68')];var _0x3245ad=_[_0x0c72('0x69')](_0x54920d);var _0x4f7276=_0x54920d===_0x0c72('0x6a')?_0x0c72('0x59'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x55ef4d[_0x0c72('0x18')]['id'],'role':_0x0c72('0x35')}})[_0x0c72('0x8')](function(_0x3fbf95){if(_['isNil'](_0x3fbf95)){throw new Error('Agent\x20not\x20found');}_0x1de2f9=_0x3fbf95;return db[_0x3245ad+_0x0c72('0x6b')][_0x0c72('0x5b')]({'where':{'id':_0x55ef4d[_0x0c72('0x29')]['messageId']},'include':[{'model':db[_0x3245ad+'Interaction'],'as':_0x0c72('0x5e')},{'model':db[_0x3245ad+_0x4f7276],'as':_0x0c72('0x5f')}]});})['then'](function(_0x12bb5f){if(_[_0x0c72('0x11')](_0x12bb5f)){throw new Error(_0x3245ad+_0x0c72('0x60'));}_0x3d3c99=_0x12bb5f;return _0x12bb5f['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4655f9={'uniqueid':_0x54920d+'.'+_0x3d3c99['id']+'.'+_0x3d3c99[_0x0c72('0x5e')]['id'],'FromUserId':_0x55ef4d['user']['id'],'type':_0x0c72('0x66'),'ToUserId':_0x1de2f9['id']};_0x4655f9[_0x3245ad+_0x0c72('0x62')]=_0x3d3c99['id'];_0x4655f9[_0x3245ad+'InteractionId']=_0x3d3c99[_0x0c72('0x5e')]['id'];_0x4655f9['From'+_0x3245ad+_0x4f7276+'Id']=_0x3d3c99[_0x0c72('0x5f')]['id'];return db[_0x3245ad+_0x0c72('0x64')]['create'](_0x4655f9);})[_0x0c72('0x8')](function(){return respondWithRpcPromise(_0x0c72('0x65'),{'channel':_0x54920d,'interaction':_0x3d3c99[_0x0c72('0x5e')],'message':_0x3d3c99,'account':_0x3d3c99[_0x0c72('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1de2f9[_0x0c72('0xf')]+','+(_0x3d3c99[_0x0c72('0x5f')]['agentTransferTimeout']||0x12c),'interval':_0x0c72('0x6c')}]},routingClient);})[_0x0c72('0x8')](respondWithResult(_0x549981,null))['catch'](handleError(_0x549981,null));}; \ No newline at end of file +var _0x09c8=['rows','query','voiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','update','MessageId','InteractionId','Interaction','From','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','client','http','then','error','message','result','status','json','sendStatus','stack','name','isNil'];(function(_0x4cdd2f,_0x2c2eec){var _0x5e0f4=function(_0x2f1a54){while(--_0x2f1a54){_0x4cdd2f['push'](_0x4cdd2f['shift']());}};_0x5e0f4(++_0x2c2eec);}(_0x09c8,0x14a));var _0x809c=function(_0x3ce0e2,_0x3ca132){_0x3ce0e2=_0x3ce0e2-0x0;var _0x36fb36=_0x09c8[_0x3ce0e2];return _0x36fb36;};'use strict';var BPromise=require(_0x809c('0x0'));var moment=require(_0x809c('0x1'));var _=require(_0x809c('0x2'));var util=require('util');var db=require(_0x809c('0x3'))['db'];var logger=require('../../config/logger')(_0x809c('0x4'));var jayson=require(_0x809c('0x5'));var amiClient=jayson[_0x809c('0x6')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x809c('0x7')]({'port':0x232b});var routingClient=jayson[_0x809c('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x220992,_0x3ef919,_0x4d8941){return new BPromise(function(_0x5ccdc2,_0x56a978){var _0x4e4445=_0x4d8941?_0x4d8941:amiClient;return _0x4e4445['request'](_0x220992,_0x3ef919)[_0x809c('0x8')](function(_0x5f59e6){if(_0x5f59e6[_0x809c('0x9')]){if(_0x5f59e6[_0x809c('0x9')]['code']===0x1f4){return _0x56a978(_0x5f59e6[_0x809c('0x9')][_0x809c('0xa')]);}return _0x5ccdc2(_0x5f59e6[_0x809c('0x9')][_0x809c('0xa')]);}else{_0x5ccdc2(_0x5f59e6[_0x809c('0xb')]);}})['catch'](function(_0x4a6b22){_0x56a978(_0x4a6b22);});});}function respondWithResult(_0x147d48,_0x415984){_0x415984=_0x415984||0xc8;return function(_0x20647f){if(_0x20647f){return _0x147d48[_0x809c('0xc')](_0x415984)[_0x809c('0xd')](_0x20647f);}return _0x147d48[_0x809c('0xe')](0x194);};}function handleError(_0x16ff66,_0x319218){_0x319218=_0x319218||0x1f4;return function(_0x5505ce){logger[_0x809c('0x9')](_0x5505ce[_0x809c('0xf')]);if(_0x5505ce['name']){delete _0x5505ce[_0x809c('0x10')];}_0x16ff66[_0x809c('0xc')](_0x319218)['send'](_0x5505ce);};}function findById(_0x4896a5){return function(_0x124ae7){if(!_[_0x809c('0x11')](_0x4896a5)&&!_[_0x809c('0x11')](_0x124ae7)&&!_['isNil'](_0x124ae7[_0x809c('0x12')])){return _['find'](_0x124ae7[_0x809c('0x12')],function(_0x86fc03){return _0x86fc03['id']==_0x4896a5;});}return null;};}exports['voiceChannels']=function(_0x51d0ac,_0x3be611){return respondWithRpcPromise('VoiceChannels',_0x51d0ac[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x3be611,null))['catch'](handleError(_0x3be611,null));};exports[_0x809c('0x14')]=function(_0x3267cd,_0x175cea){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x809c('0x15')](_0x3267cd[_0x809c('0x13')],_0x3267cd[_0x809c('0x16')]))[_0x809c('0x8')](respondWithResult(_0x175cea,null))[_0x809c('0x17')](handleError(_0x175cea,null));};exports[_0x809c('0x18')]=function(_0x4e2bc9,_0x233fdb){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x4e2bc9[_0x809c('0x13')],_0x4e2bc9[_0x809c('0x16')]))['then'](respondWithResult(_0x233fdb,null))[_0x809c('0x17')](handleError(_0x233fdb,null));};exports[_0x809c('0x19')]=function(_0x3d52d4,_0xe0593c){return respondWithRpcPromise(_0x809c('0x1a'),_0x3d52d4[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0xe0593c,null))['catch'](handleError(_0xe0593c,null));};exports['showVoiceQueues']=function(_0x490fc4,_0x25ace3){return respondWithRpcPromise(_0x809c('0x1a'),_0x490fc4[_0x809c('0x13')])['then'](findById(_0x490fc4['params']['id']))[_0x809c('0x8')](respondWithResult(_0x25ace3,null))[_0x809c('0x17')](handleError(_0x25ace3,null));};exports['voiceQueuesPreview']=function(_0x46989e,_0x2eac02){return respondWithRpcPromise(_0x809c('0x1b'),_[_0x809c('0x15')](_0x46989e[_0x809c('0x13')],_0x46989e[_0x809c('0x16')]))[_0x809c('0x8')](respondWithResult(_0x2eac02,null))[_0x809c('0x17')](handleError(_0x2eac02,null));};exports[_0x809c('0x1c')]=function(_0x3e728c,_0x42d178){return respondWithRpcPromise(_0x809c('0x1d'),_0x3e728c[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x42d178,null))['catch'](handleError(_0x42d178,null));};exports[_0x809c('0x1e')]=function(_0x5b9c14,_0x48cfc6){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x809c('0x15')](_0x5b9c14['query'],_0x5b9c14[_0x809c('0x16')]))[_0x809c('0x8')](respondWithResult(_0x48cfc6,null))[_0x809c('0x17')](handleError(_0x48cfc6,null));};exports[_0x809c('0x1f')]=function(_0x438430,_0x2235b9){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x809c('0x15')](_0x438430[_0x809c('0x13')],_0x438430[_0x809c('0x16')]))[_0x809c('0x8')](respondWithResult(_0x2235b9,null))[_0x809c('0x17')](handleError(_0x2235b9,null));};exports[_0x809c('0x20')]=function(_0x487c04,_0x3817bd){return respondWithRpcPromise(_0x809c('0x21'),_[_0x809c('0x15')](_0x487c04[_0x809c('0x13')],_0x487c04['params']))[_0x809c('0x8')](respondWithResult(_0x3817bd,null))[_0x809c('0x17')](handleError(_0x3817bd,null));};exports['outbound']=function(_0x5e7344,_0x52b8e5){return respondWithRpcPromise('Outbound',_0x5e7344[_0x809c('0x13')])['then'](respondWithResult(_0x52b8e5,null))[_0x809c('0x17')](handleError(_0x52b8e5,null));};exports[_0x809c('0x22')]=function(_0x9d5784,_0x3d9ed0){return respondWithRpcPromise('OutboundChannels',_0x9d5784[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x3d9ed0,null))['catch'](handleError(_0x3d9ed0,null));};exports[_0x809c('0x23')]=function(_0x469f6c,_0x4c770){var _0x39cd51;return respondWithRpcPromise('Agents',_0x469f6c[_0x809c('0x13')])[_0x809c('0x8')](function(_0x374a9a){_0x39cd51=_0x374a9a;return respondWithRpcPromise(_0x809c('0x24'),_0x469f6c[_0x809c('0x13')],routingClient);})[_0x809c('0x8')](function(_0x2c1ec6){return _[_0x809c('0x15')]({},_0x2c1ec6,_0x39cd51);})[_0x809c('0x8')](respondWithResult(_0x4c770,null))[_0x809c('0x17')](handleError(_0x4c770,null));};exports[_0x809c('0x25')]=function(_0x2ed503,_0x429126){if(_0x2ed503[_0x809c('0x26')]&&_0x2ed503[_0x809c('0x26')]['interaction']&&_0x2ed503[_0x809c('0x27')]&&_0x2ed503[_0x809c('0x27')][_0x809c('0x10')]){for(var _0x443956 in _0x2ed503[_0x809c('0x26')]['interaction']){if(_0x2ed503['body'][_0x809c('0x28')][_0x809c('0x29')](_0x443956)){db[_0x809c('0x2a')]['findAll']({'where':{'channel':_0x443956,'membername':_0x2ed503['user'][_0x809c('0x10')],'type':_0x809c('0x2b'),'exitAt':null,'uniqueid':_0x2ed503[_0x809c('0x26')][_0x809c('0x28')][_0x443956]&&_0x2ed503[_0x809c('0x26')][_0x809c('0x28')][_0x443956][_0x809c('0x2c')]?{'$notIn':_0x2ed503[_0x809c('0x26')]['interaction'][_0x443956]}:{'$ne':null}}})[_0x809c('0x8')](function(_0xe70225){var _0x3a7ad0=moment()[_0x809c('0x2d')](_0x809c('0x2e'));for(var _0x44ecd1=0x0,_0xa27a7e=_0xe70225[_0x809c('0x2c')];_0x44ecd1<_0xa27a7e;_0x44ecd1+=0x1){_0xe70225[_0x44ecd1][_0x809c('0x2f')]({'exitAt':_0x3a7ad0});}});for(var _0x3fbc6e=0x0;_0x3fbc6e<_0x2ed503[_0x809c('0x26')][_0x809c('0x28')][_0x443956][_0x809c('0x2c')];_0x3fbc6e+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x443956,'membername':_0x2ed503[_0x809c('0x27')][_0x809c('0x10')],'type':_0x809c('0x2b'),'uniqueid':_0x2ed503['body'][_0x809c('0x28')][_0x443956][_0x3fbc6e],'exitAt':null},'defaults':{'channel':_0x443956,'membername':_0x2ed503[_0x809c('0x27')][_0x809c('0x10')],'interface':_['isNil'](_0x2ed503[_0x809c('0x27')]['interface'])?util['format'](_0x809c('0x30'),_0x2ed503[_0x809c('0x27')]['name']):_0x2ed503[_0x809c('0x27')][_0x809c('0x31')],'type':'INTERACTION','enterAt':moment()[_0x809c('0x2d')](_0x809c('0x2e')),'role':'agent','internal':_0x2ed503[_0x809c('0x27')][_0x809c('0x32')],'uniqueid':_0x2ed503[_0x809c('0x26')]['interaction'][_0x443956][_0x3fbc6e]}});}}}}return respondWithRpcPromise(_0x809c('0x33'),{'id':_0x2ed503[_0x809c('0x16')]['id'],'capacity':_0x2ed503[_0x809c('0x26')][_0x809c('0x34')]},routingClient)[_0x809c('0x8')](respondWithResult(_0x429126,null))[_0x809c('0x17')](handleError(_0x429126,null));};exports[_0x809c('0x35')]=function(_0x29fd75,_0x262969){return respondWithRpcPromise(_0x809c('0x36'),_0x29fd75[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x262969,null))[_0x809c('0x17')](handleError(_0x262969,null));};exports[_0x809c('0x37')]=function(_0x5f06ba,_0x5ed3ea){return respondWithRpcPromise(_0x809c('0x38'),_0x5f06ba[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x5ed3ea,null))[_0x809c('0x17')](handleError(_0x5ed3ea,null));};exports['campaigns']=function(_0x3b2df1,_0x3403e7){return respondWithRpcPromise('Campaigns',_0x3b2df1[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x3403e7,null))['catch'](handleError(_0x3403e7,null));};exports[_0x809c('0x39')]=function(_0x23e377,_0x4fbcf5){return respondWithRpcPromise(_0x809c('0x3a'),_0x23e377['query'],routingClient)['then'](respondWithResult(_0x4fbcf5,null))[_0x809c('0x17')](handleError(_0x4fbcf5,null));};exports[_0x809c('0x3b')]=function(_0x2c2e77,_0x97602e){return respondWithRpcPromise(_0x809c('0x3a'),_0x2c2e77[_0x809c('0x13')],routingClient)[_0x809c('0x8')](findById(_0x2c2e77['params']['id']))['then'](respondWithResult(_0x97602e,null))[_0x809c('0x17')](handleError(_0x97602e,null));};exports[_0x809c('0x3c')]=function(_0x383fc9,_0x1af5db){return respondWithRpcPromise('MailQueues',_0x383fc9[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x1af5db,null))[_0x809c('0x17')](handleError(_0x1af5db,null));};exports[_0x809c('0x3d')]=function(_0x44669f,_0x3a8163){return respondWithRpcPromise(_0x809c('0x3e'),_0x44669f[_0x809c('0x13')],routingClient)[_0x809c('0x8')](findById(_0x44669f[_0x809c('0x16')]['id']))[_0x809c('0x8')](respondWithResult(_0x3a8163,null))['catch'](handleError(_0x3a8163,null));};exports[_0x809c('0x3f')]=function(_0x46fade,_0x46a79a){return respondWithRpcPromise(_0x809c('0x40'),_0x46fade[_0x809c('0x13')],mailClient)[_0x809c('0x8')](respondWithResult(_0x46a79a,null))['catch'](handleError(_0x46a79a,null));};exports[_0x809c('0x41')]=function(_0x4e2fec,_0x1e280c){return respondWithRpcPromise(_0x809c('0x42'),_0x4e2fec[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x1e280c,null))[_0x809c('0x17')](handleError(_0x1e280c,null));};exports[_0x809c('0x43')]=function(_0x1eab6a,_0x3c2f04){return respondWithRpcPromise('OpenchannelQueues',_0x1eab6a[_0x809c('0x13')],routingClient)[_0x809c('0x8')](findById(_0x1eab6a[_0x809c('0x16')]['id']))[_0x809c('0x8')](respondWithResult(_0x3c2f04,null))[_0x809c('0x17')](handleError(_0x3c2f04,null));};exports[_0x809c('0x44')]=function(_0x113cae,_0x14555c){return respondWithRpcPromise(_0x809c('0x45'),_0x113cae[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x14555c,null))[_0x809c('0x17')](handleError(_0x14555c,null));};exports[_0x809c('0x46')]=function(_0x41c095,_0x1a1f37){return respondWithRpcPromise('SmsQueues',_0x41c095['query'],routingClient)['then'](findById(_0x41c095['params']['id']))[_0x809c('0x8')](respondWithResult(_0x1a1f37,null))[_0x809c('0x17')](handleError(_0x1a1f37,null));};exports[_0x809c('0x47')]=function(_0x4923a1,_0x139e72){return respondWithRpcPromise(_0x809c('0x48'),_0x4923a1[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x139e72,null))[_0x809c('0x17')](handleError(_0x139e72,null));};exports['showWhatsappQueues']=function(_0x3a0c98,_0xdeefb9){return respondWithRpcPromise(_0x809c('0x48'),_0x3a0c98[_0x809c('0x13')],routingClient)[_0x809c('0x8')](findById(_0x3a0c98[_0x809c('0x16')]['id']))[_0x809c('0x8')](respondWithResult(_0xdeefb9,null))[_0x809c('0x17')](handleError(_0xdeefb9,null));};exports[_0x809c('0x49')]=function(_0x49058c,_0x25c528){return respondWithRpcPromise(_0x809c('0x4a'),_0x49058c['query'],routingClient)[_0x809c('0x8')](respondWithResult(_0x25c528,null))[_0x809c('0x17')](handleError(_0x25c528,null));};exports['showFaxQueues']=function(_0x40672d,_0x33d786){return respondWithRpcPromise(_0x809c('0x4a'),_0x40672d[_0x809c('0x13')],routingClient)[_0x809c('0x8')](findById(_0x40672d[_0x809c('0x16')]['id']))[_0x809c('0x8')](respondWithResult(_0x33d786,null))[_0x809c('0x17')](handleError(_0x33d786,null));};exports[_0x809c('0x4b')]=function(_0x403ddc,_0x523390){return respondWithRpcPromise(_0x809c('0x4c'),_0x403ddc[_0x809c('0x13')])[_0x809c('0x8')](respondWithResult(_0x523390,null))[_0x809c('0x17')](handleError(_0x523390,null));};exports['chatQueuesWaitingInteractions']=function(_0x2acb07,_0x152bec){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2acb07[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x152bec,null))['catch'](handleError(_0x152bec,null));};exports[_0x809c('0x4d')]=function(_0x1ec1ad,_0x983e9c){return respondWithRpcPromise(_0x809c('0x4e'),_0x1ec1ad['query'],routingClient)['then'](respondWithResult(_0x983e9c,null))[_0x809c('0x17')](handleError(_0x983e9c,null));};exports[_0x809c('0x4f')]=function(_0x352d1e,_0x1ab872){return respondWithRpcPromise(_0x809c('0x50'),_0x352d1e[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x1ab872,null))[_0x809c('0x17')](handleError(_0x1ab872,null));};exports[_0x809c('0x51')]=function(_0x66a35c,_0x3303f7){return respondWithRpcPromise(_0x809c('0x52'),_0x66a35c[_0x809c('0x13')],routingClient)['then'](respondWithResult(_0x3303f7,null))['catch'](handleError(_0x3303f7,null));};exports[_0x809c('0x53')]=function(_0x53626b,_0x57ba6f){return respondWithRpcPromise(_0x809c('0x54'),_0x53626b[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x57ba6f,null))[_0x809c('0x17')](handleError(_0x57ba6f,null));};exports[_0x809c('0x55')]=function(_0x5c3498,_0x190ec3){return respondWithRpcPromise(_0x809c('0x56'),_0x5c3498[_0x809c('0x13')],routingClient)[_0x809c('0x8')](respondWithResult(_0x190ec3,null))[_0x809c('0x17')](handleError(_0x190ec3,null));};exports[_0x809c('0x57')]=function(_0x4d9a66){return function(_0x3a7481,_0x5a20f2){var _0x25c504,_0x4fa5cd;var _0x48b4ad=_[_0x809c('0x58')](_0x4d9a66);var _0x1e551f=_0x4d9a66===_0x809c('0x59')?_0x809c('0x5a'):_0x809c('0x5b');return db[_0x48b4ad+_0x809c('0x5c')]['findOne']({'raw':!![],'where':{'id':_0x3a7481[_0x809c('0x16')]['id']}})[_0x809c('0x8')](function(_0x2f5627){if(_[_0x809c('0x11')](_0x2f5627)){throw new Error(_0x48b4ad+_0x809c('0x5d'));}_0x25c504=_0x2f5627;return db[_0x48b4ad+_0x809c('0x5e')][_0x809c('0x5f')]({'where':{'id':_0x3a7481[_0x809c('0x26')][_0x809c('0x60')]},'include':[{'model':db[_0x48b4ad+'Interaction'],'as':'Interaction'},{'model':db[_0x48b4ad+_0x1e551f],'as':_0x809c('0x5b')}]});})[_0x809c('0x8')](function(_0x12053f){if(_[_0x809c('0x11')](_0x12053f)){throw new Error(_0x48b4ad+'\x20Message\x20not\x20found');}_0x4fa5cd=_0x12053f;return _0x12053f[_0x809c('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0x809c('0x8')](function(){var _0x52b6e4={'uniqueid':_0x4d9a66+'.'+_0x4fa5cd['id']+'.'+_0x4fa5cd['Interaction']['id'],'FromUserId':_0x3a7481['user']['id'],'type':'queue'};_0x52b6e4[_0x48b4ad+_0x809c('0x62')]=_0x4fa5cd['id'];_0x52b6e4[_0x48b4ad+_0x809c('0x63')]=_0x4fa5cd[_0x809c('0x64')]['id'];_0x52b6e4[_0x809c('0x65')+_0x48b4ad+_0x1e551f+'Id']=_0x4fa5cd['Account']['id'];_0x52b6e4['To'+_0x48b4ad+'QueueId']=_0x25c504['id'];return db[_0x48b4ad+_0x809c('0x66')][_0x809c('0x67')](_0x52b6e4);})[_0x809c('0x8')](function(){return respondWithRpcPromise(_0x809c('0x68'),{'channel':_0x4d9a66,'interaction':_0x4fa5cd[_0x809c('0x64')],'message':_0x4fa5cd,'account':_0x4fa5cd['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x809c('0x69'),'appdata':_0x25c504[_0x809c('0x10')]+','+(_0x4fa5cd[_0x809c('0x5b')][_0x809c('0x6a')]||0x12c),'interval':_0x809c('0x6b')}]},routingClient);})[_0x809c('0x8')](respondWithResult(_0x5a20f2,null))[_0x809c('0x17')](handleError(_0x5a20f2,null));};};exports[_0x809c('0x6c')]=function(_0x17dd0d,_0x2078df){var _0x43661e,_0x5635c3;if(_['isNil'](_0x17dd0d[_0x809c('0x26')][_0x809c('0x6d')])){throw new Error(_0x809c('0x6e'));}var _0x4eaca2=_0x17dd0d['body'][_0x809c('0x6d')];var _0x19971e=_['capitalize'](_0x4eaca2);var _0x32d3fa=_0x4eaca2===_0x809c('0x59')?_0x809c('0x5a'):'Account';return db[_0x809c('0x6f')][_0x809c('0x5f')]({'raw':!![],'where':{'id':_0x17dd0d[_0x809c('0x16')]['id'],'role':_0x809c('0x70')}})[_0x809c('0x8')](function(_0x481635){if(_[_0x809c('0x11')](_0x481635)){throw new Error(_0x809c('0x71'));}_0x43661e=_0x481635;return db[_0x19971e+'Message'][_0x809c('0x5f')]({'where':{'id':_0x17dd0d[_0x809c('0x26')][_0x809c('0x60')]},'include':[{'model':db[_0x19971e+_0x809c('0x64')],'as':'Interaction'},{'model':db[_0x19971e+_0x32d3fa],'as':'Account'}]});})[_0x809c('0x8')](function(_0x1b3656){if(_[_0x809c('0x11')](_0x1b3656)){throw new Error(_0x19971e+_0x809c('0x72'));}_0x5635c3=_0x1b3656;return _0x1b3656[_0x809c('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0x809c('0x8')](function(){var _0x31e16c={'uniqueid':_0x4eaca2+'.'+_0x5635c3['id']+'.'+_0x5635c3[_0x809c('0x64')]['id'],'FromUserId':_0x17dd0d['user']['id'],'type':'queue','ToUserId':_0x43661e['id']};_0x31e16c[_0x19971e+'MessageId']=_0x5635c3['id'];_0x31e16c[_0x19971e+'InteractionId']=_0x5635c3[_0x809c('0x64')]['id'];_0x31e16c[_0x809c('0x65')+_0x19971e+_0x32d3fa+'Id']=_0x5635c3[_0x809c('0x5b')]['id'];return db[_0x19971e+'TransferReport'][_0x809c('0x67')](_0x31e16c);})['then'](function(){return respondWithRpcPromise(_0x809c('0x68'),{'channel':_0x4eaca2,'interaction':_0x5635c3[_0x809c('0x64')],'message':_0x5635c3,'account':_0x5635c3['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x43661e['name']+','+(_0x5635c3[_0x809c('0x5b')][_0x809c('0x73')]||0x12c),'interval':_0x809c('0x6b')}]},routingClient);})['then'](respondWithResult(_0x2078df,null))[_0x809c('0x17')](handleError(_0x2078df,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f28f650..17dabc1 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 _0x367a=['run','post','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run'];(function(_0x37f9cb,_0x461d17){var _0x158383=function(_0x8a0b15){while(--_0x8a0b15){_0x37f9cb['push'](_0x37f9cb['shift']());}};_0x158383(++_0x461d17);}(_0x367a,0x100));var _0xa367=function(_0x26984a,_0x8cf367){_0x26984a=_0x26984a-0x0;var _0x5b6e80=_0x367a[_0x26984a];return _0x5b6e80;};'use strict';var multer=require('multer');var util=require(_0xa367('0x0'));var path=require(_0xa367('0x1'));var timeout=require(_0xa367('0x2'));var express=require(_0xa367('0x3'));var router=express[_0xa367('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa367('0x5'));var config=require(_0xa367('0x6'));var controller=require(_0xa367('0x7'));router[_0xa367('0x8')]('/',auth[_0xa367('0x9')](),controller[_0xa367('0xa')]);router[_0xa367('0x8')](_0xa367('0xb'),auth['isAuthenticated'](),controller[_0xa367('0xc')]);router['get'](_0xa367('0xd'),auth[_0xa367('0x9')](),controller[_0xa367('0xe')]);router[_0xa367('0xf')]('/',auth[_0xa367('0x9')](),controller['create']);router['put'](_0xa367('0xb'),auth[_0xa367('0x9')](),controller[_0xa367('0x10')]);router[_0xa367('0x11')](_0xa367('0xb'),auth[_0xa367('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x866c=['isAuthenticated','show','/:id/run','run','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./schedule.controller','get'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x866c,0x123));var _0xc866=function(_0x1d7d97,_0x1f6049){_0x1d7d97=_0x1d7d97-0x0;var _0x5e1ff5=_0x866c[_0x1d7d97];return _0x5e1ff5;};'use strict';var multer=require(_0xc866('0x0'));var util=require(_0xc866('0x1'));var path=require(_0xc866('0x2'));var timeout=require(_0xc866('0x3'));var express=require('express');var router=express[_0xc866('0x4')]();var auth=require(_0xc866('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc866('0x6'));var controller=require(_0xc866('0x7'));router[_0xc866('0x8')]('/',auth[_0xc866('0x9')](),controller['index']);router[_0xc866('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc866('0xa')]);router[_0xc866('0x8')](_0xc866('0xb'),auth[_0xc866('0x9')](),controller[_0xc866('0xc')]);router[_0xc866('0xd')]('/',auth[_0xc866('0x9')](),controller[_0xc866('0xe')]);router[_0xc866('0xf')](_0xc866('0x10'),auth[_0xc866('0x9')](),controller[_0xc866('0x11')]);router[_0xc866('0x12')](_0xc866('0x10'),auth[_0xc866('0x9')](),controller[_0xc866('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e8cb312..1cd45aa 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 _0x5162=['pdf','custom','TEXT','BOOLEAN','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','days','hours','minutes','csv'];(function(_0x2d6926,_0x3ae5fe){var _0x2c8c05=function(_0x49d511){while(--_0x49d511){_0x2d6926['push'](_0x2d6926['shift']());}};_0x2c8c05(++_0x3ae5fe);}(_0x5162,0x103));var _0x2516=function(_0x286855,_0x2747ad){_0x286855=_0x286855-0x0;var _0x3644c9=_0x5162[_0x286855];return _0x3644c9;};'use strict';var Sequelize=require(_0x2516('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'defaultValue':_0x2516('0x2')},'startAt':{'type':Sequelize[_0x2516('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2516('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2516('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2516('0x5')](_0x2516('0x6'),'quarters','months','weeks',_0x2516('0x7'),_0x2516('0x8'),_0x2516('0x9')),'allowNull':![],'defaultValue':_0x2516('0x7')},'output':{'type':Sequelize[_0x2516('0x5')](_0x2516('0xa'),_0x2516('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x2516('0xa')},'type':{'type':Sequelize[_0x2516('0x5')](_0x2516('0xc'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2516('0xd')]},'bcc':{'type':Sequelize[_0x2516('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x2516('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae30=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','custom','TEXT'];(function(_0x20187f,_0xbf67c9){var _0x398db5=function(_0x3b7ac2){while(--_0x3b7ac2){_0x20187f['push'](_0x20187f['shift']());}};_0x398db5(++_0xbf67c9);}(_0xae30,0x10a));var _0x0ae3=function(_0x15d763,_0x5d5012){_0x15d763=_0x15d763-0x0;var _0x2d12cc=_0xae30[_0x15d763];return _0x2d12cc;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'name':{'type':Sequelize[_0x0ae3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0ae3('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ae3('0x2')],'allowNull':![],'defaultValue':_0x0ae3('0x4')},'startAt':{'type':Sequelize[_0x0ae3('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0ae3('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0ae3('0x7')](_0x0ae3('0x8'),_0x0ae3('0x9'),_0x0ae3('0xa'),_0x0ae3('0xb'),_0x0ae3('0xc'),_0x0ae3('0xd'),_0x0ae3('0xe')),'allowNull':![],'defaultValue':_0x0ae3('0xc')},'output':{'type':Sequelize[_0x0ae3('0x7')](_0x0ae3('0xf'),_0x0ae3('0x10'),'xlsx'),'allowNull':![],'defaultValue':_0x0ae3('0xf')},'type':{'type':Sequelize[_0x0ae3('0x7')]('custom','default'),'allowNull':![],'defaultValue':_0x0ae3('0x11')},'sendMail':{'type':Sequelize[_0x0ae3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0ae3('0x2')]},'cc':{'type':Sequelize[_0x0ae3('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3cd28df..e2c5040 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 _0xc6dd=['destroy','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','merge','options','count','includeAll','findAll','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xc6dd,0x1ce));var _0xdc6d=function(_0xc5a0e6,_0xf14779){_0xc5a0e6=_0xc5a0e6-0x0;var _0x5807e5=_0xc6dd[_0xc5a0e6];return _0x5807e5;};'use strict';var pdf=require(_0xdc6d('0x0'));var emlformat=require(_0xdc6d('0x1'));var rimraf=require(_0xdc6d('0x2'));var zipdir=require(_0xdc6d('0x3'));var jsonpatch=require(_0xdc6d('0x4'));var rp=require('request-promise');var moment=require(_0xdc6d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc6d('0x6'));var util=require(_0xdc6d('0x7'));var path=require(_0xdc6d('0x8'));var sox=require(_0xdc6d('0x9'));var csv=require(_0xdc6d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc6d('0xb'));var squel=require(_0xdc6d('0xc'));var crypto=require('crypto');var jsforce=require(_0xdc6d('0xd'));var deskjs=require(_0xdc6d('0xe'));var toCsv=require(_0xdc6d('0xa'));var querystring=require(_0xdc6d('0xf'));var Papa=require(_0xdc6d('0x10'));var Redis=require(_0xdc6d('0x11'));var authService=require(_0xdc6d('0x12'));var qs=require(_0xdc6d('0x13'));var as=require(_0xdc6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdc6d('0x15'));var utils=require(_0xdc6d('0x16'));var config=require(_0xdc6d('0x17'));var db=require(_0xdc6d('0x18'))['db'];function respondWithStatusCode(_0x43665a,_0x5efb39){_0x5efb39=_0x5efb39||0xcc;return function(_0x34472c){if(_0x34472c){return _0x43665a[_0xdc6d('0x19')](_0x5efb39);}return _0x43665a[_0xdc6d('0x1a')](_0x5efb39)[_0xdc6d('0x1b')]();};}function respondWithResult(_0x512d95,_0x47dd34){_0x47dd34=_0x47dd34||0xc8;return function(_0x1377d0){if(_0x1377d0){return _0x512d95[_0xdc6d('0x1a')](_0x47dd34)[_0xdc6d('0x1c')](_0x1377d0);}};}function respondWithFilteredResult(_0x25277e,_0x475d3b){return function(_0x130de0){if(_0x130de0){var _0x261357=_0x130de0['count'],_0x48b21d=_0x475d3b[_0xdc6d('0x1d')],_0x4b0e8d=_0x475d3b[_0xdc6d('0x1d')]+_0x475d3b[_0xdc6d('0x1e')],_0x4b6e6a;if(_0x4b0e8d>=_0x261357){_0x4b0e8d=_0x261357;_0x4b6e6a=0xc8;}else{_0x4b6e6a=0xce;}_0x25277e[_0xdc6d('0x1a')](_0x4b6e6a);return _0x25277e[_0xdc6d('0x1f')](_0xdc6d('0x20'),_0x48b21d+'-'+_0x4b0e8d+'/'+_0x261357)[_0xdc6d('0x1c')](_0x130de0);}return null;};}function patchUpdates(_0x5818c1){return function(_0x5a7865){try{jsonpatch['apply'](_0x5a7865,_0x5818c1,!![]);}catch(_0x755dff){return BPromise[_0xdc6d('0x21')](_0x755dff);}return _0x5a7865['save']();};}function saveUpdates(_0x41880a,_0x3b7d46){return function(_0x360b92){if(_0x360b92){return _0x360b92[_0xdc6d('0x22')](_0x41880a)[_0xdc6d('0x23')](function(_0x13e91d){return _0x13e91d;});}return null;};}function removeEntity(_0x4cf42d,_0x2f22cf){return function(_0x5ca497){if(_0x5ca497){return _0x5ca497[_0xdc6d('0x24')]()[_0xdc6d('0x23')](function(){var _0x376e1d=_0x5ca497[_0xdc6d('0x25')]({'plain':!![]});var _0x455b3b=_0xdc6d('0x26');return db[_0xdc6d('0x27')][_0xdc6d('0x24')]({'where':{'type':_0x455b3b,'resourceId':_0x376e1d['id']}})[_0xdc6d('0x23')](function(){return _0x5ca497;});})[_0xdc6d('0x23')](function(){_0x4cf42d[_0xdc6d('0x1a')](0xcc)[_0xdc6d('0x1b')]();});}};}function handleEntityNotFound(_0x57a52f,_0x5cb365){return function(_0x4eecf7){if(!_0x4eecf7){_0x57a52f[_0xdc6d('0x19')](0x194);}return _0x4eecf7;};}function handleError(_0x559046,_0x5323fd){_0x5323fd=_0x5323fd||0x1f4;return function(_0x33e04d){logger[_0xdc6d('0x28')](_0x33e04d[_0xdc6d('0x29')]);if(_0x33e04d[_0xdc6d('0x2a')]){delete _0x33e04d['name'];}_0x559046['status'](_0x5323fd)['send'](_0x33e04d);};}exports[_0xdc6d('0x2b')]=function(_0x1231f5,_0xcbb09d){var _0x58e3db={},_0x187780={},_0x3ba3b3={'count':0x0,'rows':[]};var _0x325bf3=_[_0xdc6d('0x2c')](db[_0xdc6d('0x2d')][_0xdc6d('0x2e')],function(_0x5801f6){return{'name':_0x5801f6[_0xdc6d('0x2f')],'type':_0x5801f6['type']['key']};});_0x187780[_0xdc6d('0x30')]=_['map'](_0x325bf3,_0xdc6d('0x2a'));_0x187780['query']=_[_0xdc6d('0x31')](_0x1231f5[_0xdc6d('0x32')]);_0x187780[_0xdc6d('0x33')]=_[_0xdc6d('0x34')](_0x187780[_0xdc6d('0x30')],_0x187780[_0xdc6d('0x32')]);_0x58e3db[_0xdc6d('0x35')]=_[_0xdc6d('0x34')](_0x187780[_0xdc6d('0x30')],qs[_0xdc6d('0x36')](_0x1231f5[_0xdc6d('0x32')]['fields']));_0x58e3db['attributes']=_0x58e3db[_0xdc6d('0x35')][_0xdc6d('0x37')]?_0x58e3db['attributes']:_0x187780[_0xdc6d('0x30')];if(!_0x1231f5[_0xdc6d('0x32')]['hasOwnProperty'](_0xdc6d('0x38'))){_0x58e3db['limit']=qs[_0xdc6d('0x1e')](_0x1231f5['query'][_0xdc6d('0x1e')]);_0x58e3db[_0xdc6d('0x1d')]=qs[_0xdc6d('0x1d')](_0x1231f5['query'][_0xdc6d('0x1d')]);}_0x58e3db[_0xdc6d('0x39')]=qs[_0xdc6d('0x3a')](_0x1231f5[_0xdc6d('0x32')][_0xdc6d('0x3a')]);_0x58e3db['where']=qs[_0xdc6d('0x33')](_['pick'](_0x1231f5['query'],_0x187780[_0xdc6d('0x33')]),_0x325bf3);if(_0x1231f5[_0xdc6d('0x32')][_0xdc6d('0x3b')]){_0x58e3db[_0xdc6d('0x3c')]=_['merge'](_0x58e3db['where'],{'$or':_[_0xdc6d('0x2c')](_0x325bf3,function(_0x24de63){if(_0x24de63[_0xdc6d('0x3d')]!=='VIRTUAL'){var _0x7a8504={};_0x7a8504[_0x24de63['name']]={'$like':'%'+_0x1231f5[_0xdc6d('0x32')][_0xdc6d('0x3b')]+'%'};return _0x7a8504;}})});}_0x58e3db=_[_0xdc6d('0x3e')]({},_0x58e3db,_0x1231f5[_0xdc6d('0x3f')]);var _0x2d696c={'where':_0x58e3db[_0xdc6d('0x3c')]};return db['Schedule'][_0xdc6d('0x40')](_0x2d696c)[_0xdc6d('0x23')](function(_0x150200){_0x3ba3b3[_0xdc6d('0x40')]=_0x150200;if(_0x1231f5[_0xdc6d('0x32')][_0xdc6d('0x41')]){_0x58e3db['include']=[{'all':!![]}];}return db[_0xdc6d('0x2d')][_0xdc6d('0x42')](_0x58e3db);})['then'](function(_0x8656ef){_0x3ba3b3['rows']=_0x8656ef;return _0x3ba3b3;})[_0xdc6d('0x23')](respondWithFilteredResult(_0xcbb09d,_0x58e3db))[_0xdc6d('0x43')](handleError(_0xcbb09d,null));};exports[_0xdc6d('0x44')]=function(_0x3152ab,_0x53ef0b){var _0x532794={'raw':![],'where':{'id':_0x3152ab['params']['id']}},_0x11732f={};_0x11732f[_0xdc6d('0x30')]=_[_0xdc6d('0x31')](db[_0xdc6d('0x2d')]['rawAttributes']);_0x11732f['query']=_[_0xdc6d('0x31')](_0x3152ab[_0xdc6d('0x32')]);_0x11732f[_0xdc6d('0x33')]=_['intersection'](_0x11732f[_0xdc6d('0x30')],_0x11732f[_0xdc6d('0x32')]);_0x532794[_0xdc6d('0x35')]=_[_0xdc6d('0x34')](_0x11732f['model'],qs[_0xdc6d('0x36')](_0x3152ab[_0xdc6d('0x32')][_0xdc6d('0x36')]));_0x532794[_0xdc6d('0x35')]=_0x532794[_0xdc6d('0x35')][_0xdc6d('0x37')]?_0x532794[_0xdc6d('0x35')]:_0x11732f['model'];if(_0x3152ab['query'][_0xdc6d('0x41')]){_0x532794[_0xdc6d('0x45')]=[{'all':!![]}];}_0x532794=_[_0xdc6d('0x3e')]({},_0x532794,_0x3152ab[_0xdc6d('0x3f')]);return db['Schedule'][_0xdc6d('0x46')](_0x532794)[_0xdc6d('0x23')](handleEntityNotFound(_0x53ef0b,null))[_0xdc6d('0x23')](respondWithResult(_0x53ef0b,null))[_0xdc6d('0x43')](handleError(_0x53ef0b,null));};exports[_0xdc6d('0x47')]=function(_0x39f724,_0x1e23b2){return db[_0xdc6d('0x2d')][_0xdc6d('0x47')](_0x39f724[_0xdc6d('0x48')],{})[_0xdc6d('0x23')](function(_0x5e65c8){var _0x23279c=_0x39f724['user'][_0xdc6d('0x25')]({'plain':!![]});if(!_0x23279c)throw new Error(_0xdc6d('0x49'));if(_0x23279c[_0xdc6d('0x4a')]===_0xdc6d('0x4b')){var _0x1fba0a=_0x5e65c8[_0xdc6d('0x25')]({'plain':!![]});var _0x4ff7d9=_0xdc6d('0x26');return db[_0xdc6d('0x4c')]['find']({'where':{'name':_0x4ff7d9,'userProfileId':_0x23279c[_0xdc6d('0x4d')]},'raw':!![]})[_0xdc6d('0x23')](function(_0x389017){if(_0x389017&&_0x389017[_0xdc6d('0x4e')]===0x0){return db[_0xdc6d('0x27')][_0xdc6d('0x47')]({'name':_0x1fba0a['name'],'resourceId':_0x1fba0a['id'],'type':_0x389017[_0xdc6d('0x2a')],'sectionId':_0x389017['id']},{})[_0xdc6d('0x23')](function(){return _0x5e65c8;});}else{return _0x5e65c8;}})[_0xdc6d('0x43')](function(_0x304ca9){logger[_0xdc6d('0x28')](_0xdc6d('0x4f'),_0x304ca9);throw _0x304ca9;});}return _0x5e65c8;})[_0xdc6d('0x23')](respondWithResult(_0x1e23b2,0xc9))[_0xdc6d('0x43')](handleError(_0x1e23b2,null));};exports['update']=function(_0x325c4a,_0x3c467c){if(_0x325c4a[_0xdc6d('0x48')]['id']){delete _0x325c4a['body']['id'];}return db[_0xdc6d('0x2d')][_0xdc6d('0x46')]({'where':{'id':_0x325c4a[_0xdc6d('0x50')]['id']}})[_0xdc6d('0x23')](handleEntityNotFound(_0x3c467c,null))['then'](saveUpdates(_0x325c4a[_0xdc6d('0x48')],null))[_0xdc6d('0x23')](respondWithResult(_0x3c467c,null))['catch'](handleError(_0x3c467c,null));};exports[_0xdc6d('0x24')]=function(_0x3aac5a,_0x5b916e){return db[_0xdc6d('0x2d')][_0xdc6d('0x46')]({'where':{'id':_0x3aac5a['params']['id']}})[_0xdc6d('0x23')](handleEntityNotFound(_0x5b916e,null))[_0xdc6d('0x23')](removeEntity(_0x5b916e,null))[_0xdc6d('0x43')](handleError(_0x5b916e,null));};exports[_0xdc6d('0x51')]=function(_0x358d73,_0x6e4f8f,_0x4b5d2c){var _0x5ab6e1=require(_0xdc6d('0x52'));return db[_0xdc6d('0x2d')][_0xdc6d('0x46')]({'where':{'id':_0x358d73['params']['id']},'raw':!![]})[_0xdc6d('0x23')](handleEntityNotFound(_0x6e4f8f,null))['then'](function(){_0x5ab6e1[_0xdc6d('0x51')](_0x358d73[_0xdc6d('0x50')]['id']);})[_0xdc6d('0x23')](respondWithStatusCode(_0x6e4f8f,null))[_0xdc6d('0x43')](handleError(_0x6e4f8f,null));}; \ No newline at end of file +var _0x21ce=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Scheduler','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Schedule','findAll','rows','catch','find','create','user','UserProfileSection'];(function(_0x49d527,_0x567d00){var _0x1322e9=function(_0x799753){while(--_0x799753){_0x49d527['push'](_0x49d527['shift']());}};_0x1322e9(++_0x567d00);}(_0x21ce,0x196));var _0xe21c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x21ce[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe21c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe21c('0x1'));var rp=require(_0xe21c('0x2'));var moment=require(_0xe21c('0x3'));var BPromise=require(_0xe21c('0x4'));var Mustache=require(_0xe21c('0x5'));var util=require(_0xe21c('0x6'));var path=require('path');var sox=require(_0xe21c('0x7'));var csv=require(_0xe21c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe21c('0x9'));var squel=require(_0xe21c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe21c('0xb'));var deskjs=require(_0xe21c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe21c('0xd'));var Papa=require(_0xe21c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe21c('0xf'));var as=require(_0xe21c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21c('0x11'))(_0xe21c('0x12'));var utils=require(_0xe21c('0x13'));var config=require(_0xe21c('0x14'));var db=require(_0xe21c('0x15'))['db'];function respondWithStatusCode(_0x2a59c8,_0x199c5f){_0x199c5f=_0x199c5f||0xcc;return function(_0x36aca7){if(_0x36aca7){return _0x2a59c8[_0xe21c('0x16')](_0x199c5f);}return _0x2a59c8['status'](_0x199c5f)[_0xe21c('0x17')]();};}function respondWithResult(_0x4d2fe0,_0x2576ff){_0x2576ff=_0x2576ff||0xc8;return function(_0x33b379){if(_0x33b379){return _0x4d2fe0[_0xe21c('0x18')](_0x2576ff)[_0xe21c('0x19')](_0x33b379);}};}function respondWithFilteredResult(_0x579763,_0x108afb){return function(_0x453146){if(_0x453146){var _0xc5108b=_0x453146[_0xe21c('0x1a')],_0x450df8=_0x108afb[_0xe21c('0x1b')],_0x45bf42=_0x108afb[_0xe21c('0x1b')]+_0x108afb[_0xe21c('0x1c')],_0x56e885;if(_0x45bf42>=_0xc5108b){_0x45bf42=_0xc5108b;_0x56e885=0xc8;}else{_0x56e885=0xce;}_0x579763[_0xe21c('0x18')](_0x56e885);return _0x579763[_0xe21c('0x1d')]('Content-Range',_0x450df8+'-'+_0x45bf42+'/'+_0xc5108b)[_0xe21c('0x19')](_0x453146);}return null;};}function patchUpdates(_0x1b86d7){return function(_0x15144a){try{jsonpatch[_0xe21c('0x1e')](_0x15144a,_0x1b86d7,!![]);}catch(_0x4e8b77){return BPromise[_0xe21c('0x1f')](_0x4e8b77);}return _0x15144a[_0xe21c('0x20')]();};}function saveUpdates(_0x1b34b0,_0x5365ec){return function(_0x27cbdd){if(_0x27cbdd){return _0x27cbdd[_0xe21c('0x21')](_0x1b34b0)['then'](function(_0x287dae){return _0x287dae;});}return null;};}function removeEntity(_0x46bc7d,_0x5b1a03){return function(_0x1559d6){if(_0x1559d6){return _0x1559d6[_0xe21c('0x22')]()[_0xe21c('0x23')](function(){var _0x5913f6=_0x1559d6[_0xe21c('0x24')]({'plain':!![]});var _0x3f4303=_0xe21c('0x25');return db['UserProfileResource'][_0xe21c('0x22')]({'where':{'type':_0x3f4303,'resourceId':_0x5913f6['id']}})[_0xe21c('0x23')](function(){return _0x1559d6;});})[_0xe21c('0x23')](function(){_0x46bc7d[_0xe21c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff5750,_0x4e633c){return function(_0x468b2f){if(!_0x468b2f){_0xff5750[_0xe21c('0x16')](0x194);}return _0x468b2f;};}function handleError(_0x7409ef,_0x2d61dd){_0x2d61dd=_0x2d61dd||0x1f4;return function(_0x5035c0){logger['error'](_0x5035c0[_0xe21c('0x26')]);if(_0x5035c0[_0xe21c('0x27')]){delete _0x5035c0['name'];}_0x7409ef[_0xe21c('0x18')](_0x2d61dd)[_0xe21c('0x28')](_0x5035c0);};}exports[_0xe21c('0x29')]=function(_0x42dd3f,_0x1458c0){var _0x270c92={},_0x43744b={},_0x472340={'count':0x0,'rows':[]};var _0x4c7fee=_[_0xe21c('0x2a')](db['Schedule'][_0xe21c('0x2b')],function(_0x2388e6){return{'name':_0x2388e6['fieldName'],'type':_0x2388e6[_0xe21c('0x2c')][_0xe21c('0x2d')]};});_0x43744b[_0xe21c('0x2e')]=_[_0xe21c('0x2a')](_0x4c7fee,'name');_0x43744b[_0xe21c('0x2f')]=_[_0xe21c('0x30')](_0x42dd3f[_0xe21c('0x2f')]);_0x43744b['filters']=_[_0xe21c('0x31')](_0x43744b[_0xe21c('0x2e')],_0x43744b['query']);_0x270c92[_0xe21c('0x32')]=_[_0xe21c('0x31')](_0x43744b[_0xe21c('0x2e')],qs[_0xe21c('0x33')](_0x42dd3f[_0xe21c('0x2f')][_0xe21c('0x33')]));_0x270c92[_0xe21c('0x32')]=_0x270c92['attributes'][_0xe21c('0x34')]?_0x270c92[_0xe21c('0x32')]:_0x43744b['model'];if(!_0x42dd3f['query'][_0xe21c('0x35')](_0xe21c('0x36'))){_0x270c92[_0xe21c('0x1c')]=qs[_0xe21c('0x1c')](_0x42dd3f[_0xe21c('0x2f')][_0xe21c('0x1c')]);_0x270c92[_0xe21c('0x1b')]=qs[_0xe21c('0x1b')](_0x42dd3f[_0xe21c('0x2f')]['offset']);}_0x270c92[_0xe21c('0x37')]=qs[_0xe21c('0x38')](_0x42dd3f['query']['sort']);_0x270c92[_0xe21c('0x39')]=qs[_0xe21c('0x3a')](_[_0xe21c('0x3b')](_0x42dd3f[_0xe21c('0x2f')],_0x43744b[_0xe21c('0x3a')]),_0x4c7fee);if(_0x42dd3f['query'][_0xe21c('0x3c')]){_0x270c92['where']=_[_0xe21c('0x3d')](_0x270c92[_0xe21c('0x39')],{'$or':_[_0xe21c('0x2a')](_0x4c7fee,function(_0x48474c){if(_0x48474c['type']!==_0xe21c('0x3e')){var _0x4b4af2={};_0x4b4af2[_0x48474c[_0xe21c('0x27')]]={'$like':'%'+_0x42dd3f['query'][_0xe21c('0x3c')]+'%'};return _0x4b4af2;}})});}_0x270c92=_['merge']({},_0x270c92,_0x42dd3f[_0xe21c('0x3f')]);var _0x5cc176={'where':_0x270c92[_0xe21c('0x39')]};return db['Schedule'][_0xe21c('0x1a')](_0x5cc176)['then'](function(_0x42c1e0){_0x472340['count']=_0x42c1e0;if(_0x42dd3f['query'][_0xe21c('0x40')]){_0x270c92[_0xe21c('0x41')]=[{'all':!![]}];}return db[_0xe21c('0x42')][_0xe21c('0x43')](_0x270c92);})[_0xe21c('0x23')](function(_0x4560cb){_0x472340[_0xe21c('0x44')]=_0x4560cb;return _0x472340;})[_0xe21c('0x23')](respondWithFilteredResult(_0x1458c0,_0x270c92))[_0xe21c('0x45')](handleError(_0x1458c0,null));};exports['show']=function(_0x23e193,_0x2ae3d0){var _0x1835ff={'raw':![],'where':{'id':_0x23e193['params']['id']}},_0x311051={};_0x311051[_0xe21c('0x2e')]=_[_0xe21c('0x30')](db['Schedule'][_0xe21c('0x2b')]);_0x311051[_0xe21c('0x2f')]=_[_0xe21c('0x30')](_0x23e193[_0xe21c('0x2f')]);_0x311051[_0xe21c('0x3a')]=_[_0xe21c('0x31')](_0x311051[_0xe21c('0x2e')],_0x311051[_0xe21c('0x2f')]);_0x1835ff[_0xe21c('0x32')]=_[_0xe21c('0x31')](_0x311051['model'],qs[_0xe21c('0x33')](_0x23e193['query'][_0xe21c('0x33')]));_0x1835ff[_0xe21c('0x32')]=_0x1835ff[_0xe21c('0x32')][_0xe21c('0x34')]?_0x1835ff[_0xe21c('0x32')]:_0x311051[_0xe21c('0x2e')];if(_0x23e193[_0xe21c('0x2f')][_0xe21c('0x40')]){_0x1835ff[_0xe21c('0x41')]=[{'all':!![]}];}_0x1835ff=_[_0xe21c('0x3d')]({},_0x1835ff,_0x23e193['options']);return db[_0xe21c('0x42')][_0xe21c('0x46')](_0x1835ff)[_0xe21c('0x23')](handleEntityNotFound(_0x2ae3d0,null))[_0xe21c('0x23')](respondWithResult(_0x2ae3d0,null))[_0xe21c('0x45')](handleError(_0x2ae3d0,null));};exports[_0xe21c('0x47')]=function(_0x59bda0,_0x4fc4e9){return db[_0xe21c('0x42')]['create'](_0x59bda0['body'],{})[_0xe21c('0x23')](function(_0x177b23){var _0x565906=_0x59bda0[_0xe21c('0x48')][_0xe21c('0x24')]({'plain':!![]});if(!_0x565906)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x565906['role']===_0xe21c('0x48')){var _0x59cc51=_0x177b23[_0xe21c('0x24')]({'plain':!![]});var _0x3b1292=_0xe21c('0x25');return db[_0xe21c('0x49')][_0xe21c('0x46')]({'where':{'name':_0x3b1292,'userProfileId':_0x565906['userProfileId']},'raw':!![]})[_0xe21c('0x23')](function(_0x188697){if(_0x188697&&_0x188697[_0xe21c('0x4a')]===0x0){return db[_0xe21c('0x4b')]['create']({'name':_0x59cc51[_0xe21c('0x27')],'resourceId':_0x59cc51['id'],'type':_0x188697[_0xe21c('0x27')],'sectionId':_0x188697['id']},{})[_0xe21c('0x23')](function(){return _0x177b23;});}else{return _0x177b23;}})[_0xe21c('0x45')](function(_0x2b17a0){logger['error'](_0xe21c('0x4c'),_0x2b17a0);throw _0x2b17a0;});}return _0x177b23;})['then'](respondWithResult(_0x4fc4e9,0xc9))['catch'](handleError(_0x4fc4e9,null));};exports[_0xe21c('0x21')]=function(_0x1f1d45,_0x850b7){if(_0x1f1d45['body']['id']){delete _0x1f1d45[_0xe21c('0x4d')]['id'];}return db[_0xe21c('0x42')]['find']({'where':{'id':_0x1f1d45['params']['id']}})[_0xe21c('0x23')](handleEntityNotFound(_0x850b7,null))[_0xe21c('0x23')](saveUpdates(_0x1f1d45[_0xe21c('0x4d')],null))[_0xe21c('0x23')](respondWithResult(_0x850b7,null))[_0xe21c('0x45')](handleError(_0x850b7,null));};exports['destroy']=function(_0x5bb0d0,_0x4b55ca){return db['Schedule'][_0xe21c('0x46')]({'where':{'id':_0x5bb0d0[_0xe21c('0x4e')]['id']}})[_0xe21c('0x23')](handleEntityNotFound(_0x4b55ca,null))[_0xe21c('0x23')](removeEntity(_0x4b55ca,null))['catch'](handleError(_0x4b55ca,null));};exports[_0xe21c('0x4f')]=function(_0x87225d,_0x4704a3,_0x1695d0){var _0x495ffc=require('../../config/schedule');return db['Schedule'][_0xe21c('0x46')]({'where':{'id':_0x87225d[_0xe21c('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4704a3,null))[_0xe21c('0x23')](function(){_0x495ffc['run'](_0x87225d[_0xe21c('0x4e')]['id']);})[_0xe21c('0x23')](respondWithStatusCode(_0x4704a3,null))['catch'](handleError(_0x4704a3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 09797fd..42bd845 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 _0xaae1=['./schedule.attributes','exports','define','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaae1,0x175));var _0x1aae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1aae('0x0'));var logger=require('../../config/logger')(_0x1aae('0x1'));var moment=require('moment');var BPromise=require(_0x1aae('0x2'));var rp=require(_0x1aae('0x3'));var fs=require('fs');var path=require(_0x1aae('0x4'));var rimraf=require(_0x1aae('0x5'));var config=require(_0x1aae('0x6'));var attributes=require(_0x1aae('0x7'));module[_0x1aae('0x8')]=function(_0x2d8c8d,_0x8a3cff){return _0x2d8c8d[_0x1aae('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x855f=['moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api'];(function(_0x4989c5,_0x569c23){var _0x4703fb=function(_0x52d942){while(--_0x52d942){_0x4989c5['push'](_0x4989c5['shift']());}};_0x4703fb(++_0x569c23);}(_0x855f,0x101));var _0xf855=function(_0x12f628,_0x449e13){_0x12f628=_0x12f628-0x0;var _0x147924=_0x855f[_0x12f628];return _0x147924;};'use strict';var _=require('lodash');var util=require(_0xf855('0x0'));var logger=require(_0xf855('0x1'))(_0xf855('0x2'));var moment=require(_0xf855('0x3'));var BPromise=require(_0xf855('0x4'));var rp=require(_0xf855('0x5'));var fs=require('fs');var path=require(_0xf855('0x6'));var rimraf=require('rimraf');var config=require(_0xf855('0x7'));var attributes=require(_0xf855('0x8'));module[_0xf855('0x9')]=function(_0x567263,_0x2deeca){return _0x567263[_0xf855('0xa')](_0xf855('0xb'),attributes,{'tableName':_0xf855('0xc'),'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 b8a04d6..03d9107 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 _0x4130=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x128df7,_0x2e7473){var _0xf4990=function(_0x501142){while(--_0x501142){_0x128df7['push'](_0x128df7['shift']());}};_0xf4990(++_0x2e7473);}(_0x4130,0x67));var _0x0413=function(_0x482803,_0x3e664b){_0x482803=_0x482803-0x0;var _0x59d887=_0x4130[_0x482803];return _0x59d887;};'use strict';var _=require(_0x0413('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0413('0x1'));var rs=require(_0x0413('0x2'));var fs=require('fs');var Redis=require(_0x0413('0x3'));var db=require(_0x0413('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0413('0x5'));var config=require(_0x0413('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0413('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x351693,_0x410397,_0x4dde4){return new BPromise(function(_0x45fd9c,_0x39326a){return client[_0x0413('0x8')](_0x351693,_0x4dde4)[_0x0413('0x9')](function(_0x4539dc){logger['info'](_0x0413('0xa'),_0x410397,_0x0413('0xb'));logger[_0x0413('0xc')](_0x0413('0xd'),_0x410397,_0x0413('0xb'),JSON[_0x0413('0xe')](_0x4539dc));if(_0x4539dc[_0x0413('0xf')]){if(_0x4539dc['error'][_0x0413('0x10')]===0x1f4){logger[_0x0413('0xf')](_0x0413('0xa'),_0x410397,_0x4539dc['error'][_0x0413('0x11')]);return _0x39326a(_0x4539dc[_0x0413('0xf')][_0x0413('0x11')]);}logger[_0x0413('0xf')](_0x0413('0xa'),_0x410397,_0x4539dc[_0x0413('0xf')][_0x0413('0x11')]);return _0x45fd9c(_0x4539dc['error'][_0x0413('0x11')]);}else{logger[_0x0413('0x12')]('Schedule,\x20%s,\x20%s',_0x410397,'request\x20sent');_0x45fd9c(_0x4539dc[_0x0413('0x13')][_0x0413('0x11')]);}})[_0x0413('0x14')](function(_0x1ce208){logger['error'](_0x0413('0xa'),_0x410397,_0x1ce208);_0x39326a(_0x1ce208);});});} \ No newline at end of file +var _0x50ef=['then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1cec1e,_0xdc7e13){var _0x41824e=function(_0x40da4a){while(--_0x40da4a){_0x1cec1e['push'](_0x1cec1e['shift']());}};_0x41824e(++_0xdc7e13);}(_0x50ef,0xac));var _0xf50e=function(_0x3bbc3d,_0x20a25c){_0x3bbc3d=_0x3bbc3d-0x0;var _0x54a8f5=_0x50ef[_0x3bbc3d];return _0x54a8f5;};'use strict';var _=require(_0xf50e('0x0'));var util=require('util');var moment=require(_0xf50e('0x1'));var BPromise=require(_0xf50e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf50e('0x3'));var db=require(_0xf50e('0x4'))['db'];var utils=require(_0xf50e('0x5'));var logger=require(_0xf50e('0x6'))(_0xf50e('0x7'));var config=require(_0xf50e('0x8'));var jayson=require(_0xf50e('0x9'));var client=jayson[_0xf50e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x519463,_0x48b225,_0x3f9af6){return new BPromise(function(_0x34431c,_0x1abfda){return client[_0xf50e('0xb')](_0x519463,_0x3f9af6)[_0xf50e('0xc')](function(_0x48d23b){logger['info'](_0xf50e('0xd'),_0x48b225,_0xf50e('0xe'));logger[_0xf50e('0xf')](_0xf50e('0x10'),_0x48b225,_0xf50e('0xe'),JSON['stringify'](_0x48d23b));if(_0x48d23b['error']){if(_0x48d23b[_0xf50e('0x11')][_0xf50e('0x12')]===0x1f4){logger[_0xf50e('0x11')](_0xf50e('0xd'),_0x48b225,_0x48d23b[_0xf50e('0x11')][_0xf50e('0x13')]);return _0x1abfda(_0x48d23b[_0xf50e('0x11')][_0xf50e('0x13')]);}logger[_0xf50e('0x11')](_0xf50e('0xd'),_0x48b225,_0x48d23b[_0xf50e('0x11')][_0xf50e('0x13')]);return _0x34431c(_0x48d23b['error'][_0xf50e('0x13')]);}else{logger[_0xf50e('0x14')]('Schedule,\x20%s,\x20%s',_0x48b225,_0xf50e('0xe'));_0x34431c(_0x48d23b[_0xf50e('0x15')][_0xf50e('0x13')]);}})[_0xf50e('0x16')](function(_0xcd2d77){logger[_0xf50e('0x11')]('Schedule,\x20%s,\x20%s',_0x48b225,_0xcd2d77);_0x1abfda(_0xcd2d77);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0385a38..2d5cfeb 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 _0x963f=['index','get','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated'];(function(_0x4d98b8,_0x539839){var _0x5e271b=function(_0x280ac6){while(--_0x280ac6){_0x4d98b8['push'](_0x4d98b8['shift']());}};_0x5e271b(++_0x539839);}(_0x963f,0x89));var _0xf963=function(_0x300d33,_0x17dc36){_0x300d33=_0x300d33-0x0;var _0x845616=_0x963f[_0x300d33];return _0x845616;};'use strict';var multer=require('multer');var util=require(_0xf963('0x0'));var path=require(_0xf963('0x1'));var timeout=require(_0xf963('0x2'));var express=require(_0xf963('0x3'));var router=express[_0xf963('0x4')]();var auth=require(_0xf963('0x5'));var interaction=require(_0xf963('0x6'));var config=require(_0xf963('0x7'));var controller=require(_0xf963('0x8'));router['get']('/',auth[_0xf963('0x9')](),controller[_0xf963('0xa')]);router[_0xf963('0xb')]('/describe',auth[_0xf963('0x9')](),controller[_0xf963('0xc')]);router[_0xf963('0xb')](_0xf963('0xd'),auth[_0xf963('0x9')](),controller[_0xf963('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf963('0xf')]('/',auth['isAuthenticated'](),controller[_0xf963('0x10')]);router['put']('/:id',auth[_0xf963('0x9')](),controller[_0xf963('0x11')]);router[_0xf963('0x12')](_0xf963('0xd'),auth['isAuthenticated'](),controller[_0xf963('0x13')]);module[_0xf963('0x14')]=router; \ No newline at end of file +var _0x9a35=['index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x5c1e9e,_0x11dfcb){var _0x3cd546=function(_0x19fc74){while(--_0x19fc74){_0x5c1e9e['push'](_0x5c1e9e['shift']());}};_0x3cd546(++_0x11dfcb);}(_0x9a35,0x173));var _0x59a3=function(_0x1f4acf,_0x4ea06c){_0x1f4acf=_0x1f4acf-0x0;var _0x25ea54=_0x9a35[_0x1f4acf];return _0x25ea54;};'use strict';var multer=require('multer');var util=require(_0x59a3('0x0'));var path=require(_0x59a3('0x1'));var timeout=require(_0x59a3('0x2'));var express=require(_0x59a3('0x3'));var router=express[_0x59a3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x59a3('0x5'));var config=require(_0x59a3('0x6'));var controller=require(_0x59a3('0x7'));router[_0x59a3('0x8')]('/',auth['isAuthenticated'](),controller[_0x59a3('0x9')]);router[_0x59a3('0x8')](_0x59a3('0xa'),auth[_0x59a3('0xb')](),controller[_0x59a3('0xc')]);router[_0x59a3('0x8')](_0x59a3('0xd'),auth[_0x59a3('0xb')](),controller[_0x59a3('0xe')]);router[_0x59a3('0x8')]('/:id/download',auth[_0x59a3('0xb')](),controller['download']);router[_0x59a3('0xf')]('/',auth[_0x59a3('0xb')](),controller[_0x59a3('0x10')]);router['put'](_0x59a3('0xd'),auth[_0x59a3('0xb')](),controller[_0x59a3('0x11')]);router[_0x59a3('0x12')](_0x59a3('0xd'),auth[_0x59a3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a3eb280..00af258 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 _0x7217=['value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x7721('0x0'));var moment=require('moment');var path=require(_0x7721('0x1'));var config=require(_0x7721('0x2'));module[_0x7721('0x3')]={'format':{'type':Sequelize[_0x7721('0x4')],'get':function(){return this[_0x7721('0x5')]('value')?path['extname'](this[_0x7721('0x5')](_0x7721('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x7721('0x7')]},'channel':{'type':Sequelize[_0x7721('0x7')]},'value':{'type':Sequelize[_0x7721('0x7')],'set':function(_0xf7ff37){var _0x18ab6b=_0xf7ff37[_0x7721('0x8')](/\\/g,'/');this[_0x7721('0x9')](_0x7721('0x6'),_0x18ab6b);}},'rating':{'type':Sequelize[_0x7721('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7721('0xa')],'set':function(_0xfa8835){this[_0x7721('0x9')](_0x7721('0xb'),moment()['subtract'](_0xfa8835,'ms'));this[_0x7721('0x9')](_0x7721('0xc'),moment());this[_0x7721('0x9')](_0x7721('0xd'),_0xfa8835);}},'startedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0xb')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('0x10')]();}},'closedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this['getDataValue'](_0x7721('0xc')))[_0x7721('0xf')](_0x7721('0x11'))[_0x7721('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x13')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('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(_0x157615,_0x54e661){var _0x5d8df6=function(_0x1cb062){while(--_0x1cb062){_0x157615['push'](_0x157615['shift']());}};_0x5d8df6(++_0x54e661);}(_0x207c,0x1e8));var _0xc207=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x207c[_0x209fcd];return _0x501d5e;};'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 4240c7a..606c54b 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 _0x89ad=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','duration','createdAt','closedAt','value','find','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','filename','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','ScreenRecording','rawAttributes','type','key','model','map','format','query','keys','filters','fields','attributes','length'];(function(_0x2f258e,_0xf0c788){var _0x343bd9=function(_0x1e9224){while(--_0x1e9224){_0x2f258e['push'](_0x2f258e['shift']());}};_0x343bd9(++_0xf0c788);}(_0x89ad,0x1c8));var _0xd89a=function(_0x4ba271,_0x38c275){_0x4ba271=_0x4ba271-0x0;var _0x5c684b=_0x89ad[_0x4ba271];return _0x5c684b;};'use strict';var pdf=require(_0xd89a('0x0'));var emlformat=require(_0xd89a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd89a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd89a('0x3'));var moment=require('moment');var BPromise=require(_0xd89a('0x4'));var Mustache=require(_0xd89a('0x5'));var util=require(_0xd89a('0x6'));var path=require(_0xd89a('0x7'));var sox=require(_0xd89a('0x8'));var csv=require('to-csv');var ejs=require(_0xd89a('0x9'));var fs=require('fs');var _=require(_0xd89a('0xa'));var squel=require('squel');var crypto=require(_0xd89a('0xb'));var jsforce=require(_0xd89a('0xc'));var deskjs=require(_0xd89a('0xd'));var toCsv=require(_0xd89a('0xe'));var querystring=require(_0xd89a('0xf'));var Papa=require(_0xd89a('0x10'));var Redis=require(_0xd89a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd89a('0x12'));var as=require(_0xd89a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd89a('0x14'))(_0xd89a('0x15'));var utils=require(_0xd89a('0x16'));var config=require(_0xd89a('0x17'));var db=require(_0xd89a('0x18'))['db'];function respondWithStatusCode(_0x1a1600,_0x58e550){_0x58e550=_0x58e550||0xcc;return function(_0x3e0b7f){if(_0x3e0b7f){return _0x1a1600[_0xd89a('0x19')](_0x58e550);}return _0x1a1600[_0xd89a('0x1a')](_0x58e550)[_0xd89a('0x1b')]();};}function respondWithResult(_0x1789d5,_0x565d34){_0x565d34=_0x565d34||0xc8;return function(_0x114114){if(_0x114114){return _0x1789d5[_0xd89a('0x1a')](_0x565d34)[_0xd89a('0x1c')](_0x114114);}};}function respondWithFilteredResult(_0x29b7f8,_0x4f9b96){return function(_0x3e6122){if(_0x3e6122){var _0x2f1794=_0x3e6122['count'],_0x6f359=_0x4f9b96[_0xd89a('0x1d')],_0x3bdc88=_0x4f9b96[_0xd89a('0x1d')]+_0x4f9b96[_0xd89a('0x1e')],_0x194dea;if(_0x3bdc88>=_0x2f1794){_0x3bdc88=_0x2f1794;_0x194dea=0xc8;}else{_0x194dea=0xce;}_0x29b7f8[_0xd89a('0x1a')](_0x194dea);return _0x29b7f8[_0xd89a('0x1f')](_0xd89a('0x20'),_0x6f359+'-'+_0x3bdc88+'/'+_0x2f1794)[_0xd89a('0x1c')](_0x3e6122);}return null;};}function patchUpdates(_0x5b0ce6){return function(_0x144e26){try{jsonpatch[_0xd89a('0x21')](_0x144e26,_0x5b0ce6,!![]);}catch(_0x33da06){return BPromise[_0xd89a('0x22')](_0x33da06);}return _0x144e26[_0xd89a('0x23')]();};}function saveUpdates(_0xf86a1c,_0x32d37b){return function(_0x2965d0){if(_0x2965d0){return _0x2965d0[_0xd89a('0x24')](_0xf86a1c)[_0xd89a('0x25')](function(_0x259b93){return _0x259b93;});}return null;};}function removeEntity(_0x32cbc3,_0x55f742){return function(_0x5c5fd5){if(_0x5c5fd5){return _0x5c5fd5[_0xd89a('0x26')]()['then'](function(){_0x32cbc3[_0xd89a('0x1a')](0xcc)[_0xd89a('0x1b')]();});}};}function handleEntityNotFound(_0x2816c2,_0x285df1){return function(_0x434976){if(!_0x434976){_0x2816c2[_0xd89a('0x19')](0x194);}return _0x434976;};}function handleError(_0x232387,_0x37cd24){_0x37cd24=_0x37cd24||0x1f4;return function(_0x2c551d){logger['error'](_0x2c551d[_0xd89a('0x27')]);if(_0x2c551d[_0xd89a('0x28')]){delete _0x2c551d[_0xd89a('0x28')];}_0x232387[_0xd89a('0x1a')](_0x37cd24)['send'](_0x2c551d);};}exports['index']=function(_0x2cf861,_0x18c0db){var _0x23888f={},_0x59d963={},_0xf9812b={'count':0x0,'rows':[]};var _0x19da5a=_['map'](db[_0xd89a('0x29')][_0xd89a('0x2a')],function(_0x140802){return{'name':_0x140802['fieldName'],'type':_0x140802[_0xd89a('0x2b')][_0xd89a('0x2c')]};});_0x59d963[_0xd89a('0x2d')]=_['differenceBy'](_[_0xd89a('0x2e')](_0x19da5a,_0xd89a('0x28')),[_0xd89a('0x2f')]);_0x59d963[_0xd89a('0x30')]=_[_0xd89a('0x31')](_0x2cf861[_0xd89a('0x30')]);_0x59d963[_0xd89a('0x32')]=_['intersection'](_0x59d963[_0xd89a('0x2d')],_0x59d963[_0xd89a('0x30')]);_0x23888f['attributes']=_['intersection'](_0x59d963['model'],qs['fields'](_0x2cf861[_0xd89a('0x30')][_0xd89a('0x33')]));_0x23888f[_0xd89a('0x34')]=_0x23888f[_0xd89a('0x34')][_0xd89a('0x35')]?_0x23888f[_0xd89a('0x34')]:_0x59d963['model'];if(!_0x2cf861[_0xd89a('0x30')][_0xd89a('0x36')](_0xd89a('0x37'))){_0x23888f[_0xd89a('0x1e')]=qs['limit'](_0x2cf861[_0xd89a('0x30')][_0xd89a('0x1e')]);_0x23888f['offset']=qs[_0xd89a('0x1d')](_0x2cf861[_0xd89a('0x30')]['offset']);}_0x23888f[_0xd89a('0x38')]=qs['sort'](_0x2cf861['query'][_0xd89a('0x39')]);_0x23888f[_0xd89a('0x3a')]=qs[_0xd89a('0x32')](_[_0xd89a('0x3b')](_0x2cf861[_0xd89a('0x30')],_0x59d963[_0xd89a('0x32')]),_0x19da5a);if(_0x2cf861['query']['filter']){_0x23888f[_0xd89a('0x3a')]=_[_0xd89a('0x3c')](_0x23888f[_0xd89a('0x3a')],{'$or':_['map'](_0x19da5a,function(_0x7d9a89){if(_0x7d9a89['type']!==_0xd89a('0x3d')){var _0x2997f5={};_0x2997f5[_0x7d9a89[_0xd89a('0x28')]]={'$like':'%'+_0x2cf861[_0xd89a('0x30')]['filter']+'%'};return _0x2997f5;}})});}_0x23888f=_[_0xd89a('0x3c')]({},_0x23888f,_0x2cf861['options']);var _0x12fe1f={'where':_0x23888f['where']};return db[_0xd89a('0x29')][_0xd89a('0x3e')](_0x12fe1f)[_0xd89a('0x25')](function(_0x1c2f05){_0xf9812b[_0xd89a('0x3e')]=_0x1c2f05;if(_0x2cf861[_0xd89a('0x30')][_0xd89a('0x3f')]){_0x23888f[_0xd89a('0x40')]=[{'all':!![]}];}return db[_0xd89a('0x29')][_0xd89a('0x41')](_0x23888f);})['then'](function(_0x3bca18){_0xf9812b[_0xd89a('0x42')]=_0x3bca18;return _0xf9812b;})[_0xd89a('0x25')](respondWithFilteredResult(_0x18c0db,_0x23888f))[_0xd89a('0x43')](handleError(_0x18c0db,null));};exports[_0xd89a('0x44')]=function(_0x1a9184,_0x882420){var _0x12d2c8={'raw':![],'where':{'id':_0x1a9184[_0xd89a('0x45')]['id']}},_0x2c7da5={};_0x2c7da5[_0xd89a('0x2d')]=_[_0xd89a('0x31')](db[_0xd89a('0x29')]['rawAttributes']);_0x2c7da5[_0xd89a('0x30')]=_[_0xd89a('0x31')](_0x1a9184['query']);_0x2c7da5['filters']=_[_0xd89a('0x46')](_0x2c7da5[_0xd89a('0x2d')],_0x2c7da5[_0xd89a('0x30')]);_0x12d2c8[_0xd89a('0x34')]=_['intersection'](_0x2c7da5[_0xd89a('0x2d')],qs['fields'](_0x1a9184[_0xd89a('0x30')]['fields']));_0x12d2c8[_0xd89a('0x34')]=_0x12d2c8[_0xd89a('0x34')][_0xd89a('0x35')]?_0x12d2c8[_0xd89a('0x34')]:_0x2c7da5['model'];if(_0x1a9184[_0xd89a('0x30')][_0xd89a('0x3f')]){_0x12d2c8[_0xd89a('0x40')]=[{'all':!![]}];}_0x12d2c8=_['merge']({},_0x12d2c8,_0x1a9184['options']);return db[_0xd89a('0x29')]['find'](_0x12d2c8)[_0xd89a('0x25')](handleEntityNotFound(_0x882420,null))[_0xd89a('0x25')](respondWithResult(_0x882420,null))[_0xd89a('0x43')](handleError(_0x882420,null));};exports[_0xd89a('0x47')]=function(_0x547348,_0x28b938){return db[_0xd89a('0x29')]['create'](_0x547348[_0xd89a('0x48')],{})[_0xd89a('0x25')](respondWithResult(_0x28b938,0xc9))[_0xd89a('0x43')](handleError(_0x28b938,null));};exports[_0xd89a('0x24')]=function(_0x977c8d,_0x4ecada){if(_0x977c8d['body']['id']){delete _0x977c8d[_0xd89a('0x48')]['id'];}delete _0x977c8d[_0xd89a('0x48')][_0xd89a('0x49')];delete _0x977c8d[_0xd89a('0x48')][_0xd89a('0x4a')];delete _0x977c8d[_0xd89a('0x48')][_0xd89a('0x4b')];delete _0x977c8d[_0xd89a('0x48')][_0xd89a('0x4c')];return db[_0xd89a('0x29')][_0xd89a('0x4d')]({'where':{'id':_0x977c8d[_0xd89a('0x45')]['id']}})[_0xd89a('0x25')](handleEntityNotFound(_0x4ecada,null))[_0xd89a('0x25')](saveUpdates(_0x977c8d['body'],null))[_0xd89a('0x25')](respondWithResult(_0x4ecada,null))[_0xd89a('0x43')](handleError(_0x4ecada,null));};exports[_0xd89a('0x4e')]=function(_0x5b6840,_0x3240d2){return db[_0xd89a('0x29')][_0xd89a('0x4e')]()[_0xd89a('0x25')](respondWithResult(_0x3240d2,null))[_0xd89a('0x43')](handleError(_0x3240d2,null));};exports[_0xd89a('0x4f')]=function(_0x50c481,_0x263c7f,_0x426d86){var _0xc0b687=require('../../components/encryptor');var _0x4582ad=![];var _0x1aa33b={};if(_0x50c481['query']['type']&&_0x50c481[_0xd89a('0x30')]['type']===_0xd89a('0x50')){_0x1aa33b[_0xd89a('0x50')]=_0x50c481[_0xd89a('0x45')]['id'];}else{_0x1aa33b['id']=_0x50c481['params']['id'];}return db[_0xd89a('0x29')][_0xd89a('0x4d')]({'where':_0x1aa33b,'attributes':['id',_0xd89a('0x4c')],'raw':!![]})[_0xd89a('0x25')](handleEntityNotFound(_0x263c7f,null))['then'](function(_0x448c18){if(_0x448c18){var _0x246bd0=path[_0xd89a('0x51')](config[_0xd89a('0x52')],_0xd89a('0x53'),_0x448c18[_0xd89a('0x4c')]);var _0x4badd1=util[_0xd89a('0x2f')](_0xd89a('0x54'),_0x246bd0);if(fs[_0xd89a('0x55')](_0x4badd1)){_0x4582ad=!![];return _0xc0b687[_0xd89a('0x56')](_0x4badd1,_0x246bd0,config[_0xd89a('0x57')][_0xd89a('0x58')])[_0xd89a('0x25')](function(){return _0x448c18;});}return _0x448c18;}})[_0xd89a('0x25')](function(_0x13ddef){if(_0x13ddef){var _0x18a3bc=path['join'](config[_0xd89a('0x52')],_0xd89a('0x53'),_0x13ddef['value']);if(!fs[_0xd89a('0x55')](_0x18a3bc)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x13ddef[_0xd89a('0x59')]){return _0x263c7f[_0xd89a('0x4f')](_0x18a3bc,_0x13ddef[_0xd89a('0x59')]+path['extname'](_0x18a3bc),function(){if(_0x4582ad){fs[_0xd89a('0x5a')](_0x18a3bc);}});}else{return _0x263c7f[_0xd89a('0x4f')](_0x18a3bc,function(_0x2535ad){if(_0x4582ad){fs['unlink'](_0x18a3bc);}});}}})[_0xd89a('0x43')](function(_0x399563){if(_0x399563[_0xd89a('0x5b')]===_0xd89a('0x5c')){_0x263c7f[_0xd89a('0x1a')](0x194)[_0xd89a('0x5d')](_0xd89a('0x5e'));}else{return handleError(_0x263c7f,null);}});};exports['destroy']=function(_0x14b4be,_0x26c875){return db[_0xd89a('0x29')][_0xd89a('0x4d')]({'where':{'id':_0x14b4be[_0xd89a('0x45')]['id']}})[_0xd89a('0x25')](function(_0x4f2554){if(!_0x4f2554)throw new ReferenceError(_0xd89a('0x5f'));return _0x4f2554;})['then'](function(_0x512b7e){var _0x4a8384=path[_0xd89a('0x51')](config['root'],_0xd89a('0x53'),_0x512b7e[_0xd89a('0x4c')]);logger['info'](_0xd89a('0x60'),_0x4a8384);if(!_[_0xd89a('0x61')](_0x512b7e[_0xd89a('0x4c')])&&fs['existsSync'](_0x4a8384)){logger[_0xd89a('0x62')](_0xd89a('0x63')+_0x4a8384+_0xd89a('0x64'));fs[_0xd89a('0x65')](_0x4a8384);}_0x4a8384=_0x4a8384+'.cypher';if(!_[_0xd89a('0x61')](_0x512b7e['value'])&&fs[_0xd89a('0x55')](_0x4a8384)){logger['info'](_0xd89a('0x63')+_0x4a8384+_0xd89a('0x64'));fs[_0xd89a('0x65')](_0x4a8384);}return _0x512b7e;})['then'](function(_0x5c18d6){if(!_0x5c18d6)throw new InternalError();return _0x5c18d6[_0xd89a('0x26')]();})[_0xd89a('0x25')](function(){_0x26c875[_0xd89a('0x1a')](0xcc)[_0xd89a('0x1b')]();})[_0xd89a('0x43')](handleError(_0x26c875,null));}; \ No newline at end of file +var _0x6ced=['set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','name','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','decryptFile','recording','join','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','rimraf','zip-dir','moment','mustache','util','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x3f118d,_0x2cb9bc){var _0xa01cde=function(_0x1f6d00){while(--_0x1f6d00){_0x3f118d['push'](_0x3f118d['shift']());}};_0xa01cde(++_0x2cb9bc);}(_0x6ced,0x116));var _0xd6ce=function(_0x3f2289,_0x501ac1){_0x3f2289=_0x3f2289-0x0;var _0x382413=_0x6ced[_0x3f2289];return _0x382413;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6ce('0x0'));var zipdir=require(_0xd6ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd6ce('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd6ce('0x3'));var util=require(_0xd6ce('0x4'));var path=require('path');var sox=require(_0xd6ce('0x5'));var csv=require(_0xd6ce('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd6ce('0x7'));var jsforce=require(_0xd6ce('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd6ce('0x6'));var querystring=require(_0xd6ce('0x9'));var Papa=require(_0xd6ce('0xa'));var Redis=require(_0xd6ce('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xd6ce('0xc'));var as=require(_0xd6ce('0xd'));var hardwareService=require(_0xd6ce('0xe'));var logger=require(_0xd6ce('0xf'))('api');var utils=require(_0xd6ce('0x10'));var config=require(_0xd6ce('0x11'));var db=require(_0xd6ce('0x12'))['db'];function respondWithStatusCode(_0x51630f,_0xc4760d){_0xc4760d=_0xc4760d||0xcc;return function(_0x56bcb2){if(_0x56bcb2){return _0x51630f[_0xd6ce('0x13')](_0xc4760d);}return _0x51630f[_0xd6ce('0x14')](_0xc4760d)['end']();};}function respondWithResult(_0x768717,_0x43664b){_0x43664b=_0x43664b||0xc8;return function(_0x141042){if(_0x141042){return _0x768717[_0xd6ce('0x14')](_0x43664b)[_0xd6ce('0x15')](_0x141042);}};}function respondWithFilteredResult(_0x5bf6b9,_0x30fb44){return function(_0x4d32f9){if(_0x4d32f9){var _0x2e0867=_0x4d32f9[_0xd6ce('0x16')],_0x477bcc=_0x30fb44['offset'],_0x5ed244=_0x30fb44[_0xd6ce('0x17')]+_0x30fb44[_0xd6ce('0x18')],_0x25ffc3;if(_0x5ed244>=_0x2e0867){_0x5ed244=_0x2e0867;_0x25ffc3=0xc8;}else{_0x25ffc3=0xce;}_0x5bf6b9[_0xd6ce('0x14')](_0x25ffc3);return _0x5bf6b9[_0xd6ce('0x19')](_0xd6ce('0x1a'),_0x477bcc+'-'+_0x5ed244+'/'+_0x2e0867)['json'](_0x4d32f9);}return null;};}function patchUpdates(_0x49d821){return function(_0x369d4c){try{jsonpatch['apply'](_0x369d4c,_0x49d821,!![]);}catch(_0x2ddc24){return BPromise[_0xd6ce('0x1b')](_0x2ddc24);}return _0x369d4c[_0xd6ce('0x1c')]();};}function saveUpdates(_0x4cedcd,_0x58ca2d){return function(_0x16f392){if(_0x16f392){return _0x16f392[_0xd6ce('0x1d')](_0x4cedcd)[_0xd6ce('0x1e')](function(_0x4b4ac2){return _0x4b4ac2;});}return null;};}function removeEntity(_0x6d8b8c,_0x1e2db3){return function(_0x8fb6ac){if(_0x8fb6ac){return _0x8fb6ac[_0xd6ce('0x1f')]()['then'](function(){_0x6d8b8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10bc3a,_0x83db50){return function(_0x52a20d){if(!_0x52a20d){_0x10bc3a[_0xd6ce('0x13')](0x194);}return _0x52a20d;};}function handleError(_0x24d69b,_0x5afb62){_0x5afb62=_0x5afb62||0x1f4;return function(_0x4fa841){logger[_0xd6ce('0x20')](_0x4fa841[_0xd6ce('0x21')]);if(_0x4fa841['name']){delete _0x4fa841['name'];}_0x24d69b[_0xd6ce('0x14')](_0x5afb62)[_0xd6ce('0x22')](_0x4fa841);};}exports[_0xd6ce('0x23')]=function(_0x28c506,_0x166388){var _0x57b844={},_0x305838={},_0x1e7bcc={'count':0x0,'rows':[]};var _0x47bc68=_[_0xd6ce('0x24')](db[_0xd6ce('0x25')][_0xd6ce('0x26')],function(_0x1c2721){return{'name':_0x1c2721[_0xd6ce('0x27')],'type':_0x1c2721[_0xd6ce('0x28')][_0xd6ce('0x29')]};});_0x305838[_0xd6ce('0x2a')]=_['differenceBy'](_[_0xd6ce('0x24')](_0x47bc68,_0xd6ce('0x2b')),[_0xd6ce('0x2c')]);_0x305838[_0xd6ce('0x2d')]=_[_0xd6ce('0x2e')](_0x28c506[_0xd6ce('0x2d')]);_0x305838[_0xd6ce('0x2f')]=_['intersection'](_0x305838['model'],_0x305838[_0xd6ce('0x2d')]);_0x57b844[_0xd6ce('0x30')]=_['intersection'](_0x305838['model'],qs[_0xd6ce('0x31')](_0x28c506[_0xd6ce('0x2d')][_0xd6ce('0x31')]));_0x57b844[_0xd6ce('0x30')]=_0x57b844[_0xd6ce('0x30')][_0xd6ce('0x32')]?_0x57b844[_0xd6ce('0x30')]:_0x305838[_0xd6ce('0x2a')];if(!_0x28c506['query'][_0xd6ce('0x33')](_0xd6ce('0x34'))){_0x57b844['limit']=qs[_0xd6ce('0x18')](_0x28c506['query'][_0xd6ce('0x18')]);_0x57b844[_0xd6ce('0x17')]=qs[_0xd6ce('0x17')](_0x28c506[_0xd6ce('0x2d')][_0xd6ce('0x17')]);}_0x57b844[_0xd6ce('0x35')]=qs['sort'](_0x28c506['query'][_0xd6ce('0x36')]);_0x57b844['where']=qs['filters'](_[_0xd6ce('0x37')](_0x28c506[_0xd6ce('0x2d')],_0x305838[_0xd6ce('0x2f')]),_0x47bc68);if(_0x28c506[_0xd6ce('0x2d')][_0xd6ce('0x38')]){_0x57b844[_0xd6ce('0x39')]=_['merge'](_0x57b844[_0xd6ce('0x39')],{'$or':_['map'](_0x47bc68,function(_0x46c306){if(_0x46c306[_0xd6ce('0x28')]!==_0xd6ce('0x3a')){var _0x36628a={};_0x36628a[_0x46c306[_0xd6ce('0x2b')]]={'$like':'%'+_0x28c506['query'][_0xd6ce('0x38')]+'%'};return _0x36628a;}})});}_0x57b844=_[_0xd6ce('0x3b')]({},_0x57b844,_0x28c506[_0xd6ce('0x3c')]);var _0x3423cc={'where':_0x57b844[_0xd6ce('0x39')]};return db[_0xd6ce('0x25')]['count'](_0x3423cc)[_0xd6ce('0x1e')](function(_0x3979c7){_0x1e7bcc[_0xd6ce('0x16')]=_0x3979c7;if(_0x28c506[_0xd6ce('0x2d')][_0xd6ce('0x3d')]){_0x57b844[_0xd6ce('0x3e')]=[{'all':!![]}];}return db[_0xd6ce('0x25')][_0xd6ce('0x3f')](_0x57b844);})[_0xd6ce('0x1e')](function(_0x527fa5){_0x1e7bcc[_0xd6ce('0x40')]=_0x527fa5;return _0x1e7bcc;})[_0xd6ce('0x1e')](respondWithFilteredResult(_0x166388,_0x57b844))[_0xd6ce('0x41')](handleError(_0x166388,null));};exports[_0xd6ce('0x42')]=function(_0x9829bf,_0x1e5ea0){var _0x2675ab={'raw':![],'where':{'id':_0x9829bf[_0xd6ce('0x43')]['id']}},_0x1db17d={};_0x1db17d[_0xd6ce('0x2a')]=_[_0xd6ce('0x2e')](db[_0xd6ce('0x25')][_0xd6ce('0x26')]);_0x1db17d[_0xd6ce('0x2d')]=_[_0xd6ce('0x2e')](_0x9829bf[_0xd6ce('0x2d')]);_0x1db17d['filters']=_['intersection'](_0x1db17d[_0xd6ce('0x2a')],_0x1db17d[_0xd6ce('0x2d')]);_0x2675ab['attributes']=_[_0xd6ce('0x44')](_0x1db17d[_0xd6ce('0x2a')],qs[_0xd6ce('0x31')](_0x9829bf[_0xd6ce('0x2d')][_0xd6ce('0x31')]));_0x2675ab[_0xd6ce('0x30')]=_0x2675ab[_0xd6ce('0x30')]['length']?_0x2675ab[_0xd6ce('0x30')]:_0x1db17d[_0xd6ce('0x2a')];if(_0x9829bf[_0xd6ce('0x2d')][_0xd6ce('0x3d')]){_0x2675ab['include']=[{'all':!![]}];}_0x2675ab=_['merge']({},_0x2675ab,_0x9829bf[_0xd6ce('0x3c')]);return db[_0xd6ce('0x25')][_0xd6ce('0x45')](_0x2675ab)[_0xd6ce('0x1e')](handleEntityNotFound(_0x1e5ea0,null))[_0xd6ce('0x1e')](respondWithResult(_0x1e5ea0,null))['catch'](handleError(_0x1e5ea0,null));};exports[_0xd6ce('0x46')]=function(_0x2b24c1,_0x48fd71){return db['ScreenRecording']['create'](_0x2b24c1[_0xd6ce('0x47')],{})[_0xd6ce('0x1e')](respondWithResult(_0x48fd71,0xc9))[_0xd6ce('0x41')](handleError(_0x48fd71,null));};exports[_0xd6ce('0x1d')]=function(_0x3369c4,_0x119e72){if(_0x3369c4[_0xd6ce('0x47')]['id']){delete _0x3369c4[_0xd6ce('0x47')]['id'];}delete _0x3369c4['body']['duration'];delete _0x3369c4['body'][_0xd6ce('0x48')];delete _0x3369c4[_0xd6ce('0x47')][_0xd6ce('0x49')];delete _0x3369c4[_0xd6ce('0x47')][_0xd6ce('0x4a')];return db[_0xd6ce('0x25')][_0xd6ce('0x45')]({'where':{'id':_0x3369c4['params']['id']}})[_0xd6ce('0x1e')](handleEntityNotFound(_0x119e72,null))[_0xd6ce('0x1e')](saveUpdates(_0x3369c4[_0xd6ce('0x47')],null))[_0xd6ce('0x1e')](respondWithResult(_0x119e72,null))[_0xd6ce('0x41')](handleError(_0x119e72,null));};exports[_0xd6ce('0x4b')]=function(_0xd9de7c,_0x1c5903){return db['ScreenRecording'][_0xd6ce('0x4b')]()[_0xd6ce('0x1e')](respondWithResult(_0x1c5903,null))[_0xd6ce('0x41')](handleError(_0x1c5903,null));};exports[_0xd6ce('0x4c')]=function(_0x46148e,_0x5531b8,_0x563481){var _0x364ce3=require(_0xd6ce('0x4d'));var _0x9df78c=![];var _0x5eea5c={};if(_0x46148e[_0xd6ce('0x2d')][_0xd6ce('0x28')]&&_0x46148e['query'][_0xd6ce('0x28')]===_0xd6ce('0x4e')){_0x5eea5c['uniqueid']=_0x46148e[_0xd6ce('0x43')]['id'];}else{_0x5eea5c['id']=_0x46148e[_0xd6ce('0x43')]['id'];}return db[_0xd6ce('0x25')][_0xd6ce('0x45')]({'where':_0x5eea5c,'attributes':['id',_0xd6ce('0x4a')],'raw':!![]})[_0xd6ce('0x1e')](handleEntityNotFound(_0x5531b8,null))[_0xd6ce('0x1e')](function(_0x243a89){if(_0x243a89){var _0x4265a5=path['join'](config[_0xd6ce('0x4f')],'server/files/screen_recordings',_0x243a89[_0xd6ce('0x4a')]);var _0x47da28=util[_0xd6ce('0x2c')](_0xd6ce('0x50'),_0x4265a5);if(fs[_0xd6ce('0x51')](_0x47da28)){_0x9df78c=!![];return _0x364ce3[_0xd6ce('0x52')](_0x47da28,_0x4265a5,config['secrets'][_0xd6ce('0x53')])[_0xd6ce('0x1e')](function(){return _0x243a89;});}return _0x243a89;}})['then'](function(_0x2a7099){if(_0x2a7099){var _0x360c8d=path[_0xd6ce('0x54')](config['root'],_0xd6ce('0x55'),_0x2a7099['value']);if(!fs['existsSync'](_0x360c8d)){throw new db[(_0xd6ce('0x56'))][(_0xd6ce('0x57'))](_0xd6ce('0x58'));}if(_0x2a7099[_0xd6ce('0x59')]){return _0x5531b8[_0xd6ce('0x4c')](_0x360c8d,_0x2a7099['filename']+path[_0xd6ce('0x5a')](_0x360c8d),function(){if(_0x9df78c){fs['unlink'](_0x360c8d);}});}else{return _0x5531b8['download'](_0x360c8d,function(_0x563520){if(_0x9df78c){fs['unlink'](_0x360c8d);}});}}})['catch'](function(_0x4124e2){if(_0x4124e2[_0xd6ce('0x5b')]===_0xd6ce('0x58')){_0x5531b8[_0xd6ce('0x14')](0x194)[_0xd6ce('0x22')](_0xd6ce('0x5c'));}else{return handleError(_0x5531b8,null);}});};exports[_0xd6ce('0x1f')]=function(_0x97d203,_0x35b80a){return db[_0xd6ce('0x25')][_0xd6ce('0x45')]({'where':{'id':_0x97d203[_0xd6ce('0x43')]['id']}})[_0xd6ce('0x1e')](function(_0x1daffd){if(!_0x1daffd)throw new ReferenceError(_0xd6ce('0x5d'));return _0x1daffd;})[_0xd6ce('0x1e')](function(_0x4c0820){var _0x578600=path[_0xd6ce('0x54')](config['root'],_0xd6ce('0x55'),_0x4c0820[_0xd6ce('0x4a')]);logger[_0xd6ce('0x5e')](_0xd6ce('0x5f'),_0x578600);if(!_[_0xd6ce('0x60')](_0x4c0820[_0xd6ce('0x4a')])&&fs[_0xd6ce('0x51')](_0x578600)){logger['info'](_0xd6ce('0x61')+_0x578600+_0xd6ce('0x62'));fs[_0xd6ce('0x63')](_0x578600);}_0x578600=_0x578600+'.cypher';if(!_[_0xd6ce('0x60')](_0x4c0820['value'])&&fs[_0xd6ce('0x51')](_0x578600)){logger[_0xd6ce('0x5e')](_0xd6ce('0x61')+_0x578600+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd6ce('0x63')](_0x578600);}return _0x4c0820;})[_0xd6ce('0x1e')](function(_0x1ab9aa){if(!_0x1ab9aa)throw new InternalError();return _0x1ab9aa[_0xd6ce('0x1f')]();})[_0xd6ce('0x1e')](function(){_0x35b80a[_0xd6ce('0x14')](0xcc)[_0xd6ce('0x64')]();})['catch'](handleError(_0x35b80a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 599cf33..63814a0 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 _0xaa19=['interactionid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings'];(function(_0x3dda9a,_0xa26548){var _0x55c55d=function(_0xfb533c){while(--_0xfb533c){_0x3dda9a['push'](_0x3dda9a['shift']());}};_0x55c55d(++_0xa26548);}(_0xaa19,0x139));var _0x9aa1=function(_0x4c7166,_0x4f9564){_0x4c7166=_0x4c7166-0x0;var _0x1ffd50=_0xaa19[_0x4c7166];return _0x1ffd50;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9aa1('0x0'))(_0x9aa1('0x1'));var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rp=require(_0x9aa1('0x4'));var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x340e5e,_0x22eb17){return _0x340e5e[_0x9aa1('0x8')](_0x9aa1('0x9'),attributes,{'tableName':_0x9aa1('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x9aa1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafa7=['exports','define','ScreenRecording','interactionid','lodash','util','api','bluebird','request-promise','path','./screenRecording.attributes'];(function(_0x3743a7,_0x5988cb){var _0x2f838c=function(_0x465888){while(--_0x465888){_0x3743a7['push'](_0x3743a7['shift']());}};_0x2f838c(++_0x5988cb);}(_0xafa7,0x122));var _0x7afa=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xafa7[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x7afa('0x0'));var util=require(_0x7afa('0x1'));var logger=require('../../config/logger')(_0x7afa('0x2'));var moment=require('moment');var BPromise=require(_0x7afa('0x3'));var rp=require(_0x7afa('0x4'));var fs=require('fs');var path=require(_0x7afa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7afa('0x6'));module[_0x7afa('0x7')]=function(_0x2713c7,_0x27a3ae){return _0x2713c7[_0x7afa('0x8')](_0x7afa('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x7afa('0xa'),'fields':[_0x7afa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 720fa2f..9e2c0be 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(_0x3e0453,_0x2e070d){var _0x140bc2=function(_0x18602e){while(--_0x18602e){_0x3e0453['push'](_0x3e0453['shift']());}};_0x140bc2(++_0x2e070d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x395820,_0x3bbf2b){var _0x2e0555=function(_0x4172c5){while(--_0x4172c5){_0x395820['push'](_0x395820['shift']());}};_0x2e0555(++_0x3bbf2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 dbfb21c..7f040ab 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 _0x4655=['single','file','preferred','favicon','/:id/favicon','addFavicon','put','/:id','isAuthenticated','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','addLogo','logologin'];(function(_0x5e1620,_0x6f37fe){var _0x3caee2=function(_0x3c47a2){while(--_0x3c47a2){_0x5e1620['push'](_0x5e1620['shift']());}};_0x3caee2(++_0x6f37fe);}(_0x4655,0x17b));var _0x5465=function(_0x4678f2,_0x16f437){_0x4678f2=_0x4678f2-0x0;var _0x232fa0=_0x4655[_0x4678f2];return _0x232fa0;};'use strict';var multer=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5465('0x2'));var router=express[_0x5465('0x3')]();var auth=require(_0x5465('0x4'));var interaction=require(_0x5465('0x5'));var config=require(_0x5465('0x6'));var controller=require(_0x5465('0x7'));router[_0x5465('0x8')]('/',auth['isAuthenticated'](),controller[_0x5465('0x9')]);router[_0x5465('0x8')]('/:id',controller[_0x5465('0xa')]);router[_0x5465('0x8')]('/:id/logo',controller[_0x5465('0xb')]);router[_0x5465('0x8')](_0x5465('0xc'),controller[_0x5465('0xd')]);router[_0x5465('0x8')](_0x5465('0xe'),controller[_0x5465('0xf')]);router[_0x5465('0x8')](_0x5465('0x10'),controller[_0x5465('0x11')]);router[_0x5465('0x8')]('/:id/favicon',controller[_0x5465('0x12')]);var upload=multer({'storage':multer[_0x5465('0x13')]({'destination':function(_0x39a2ac,_0x14e35a,_0x22b71b){_0x22b71b(null,path[_0x5465('0x14')](config[_0x5465('0x15')],_0x5465('0x16')));},'filename':function(_0x37cd84,_0x28acaf,_0x45b0e9){_0x45b0e9(null,util[_0x5465('0x17')](_0x5465('0x18'),_0x5465('0x19'),path[_0x5465('0x1a')](_0x28acaf[_0x5465('0x1b')])));}})});router[_0x5465('0x1c')]('/:id/logo',upload['single']('file'),controller[_0x5465('0x1d')]);var upload=multer({'storage':multer[_0x5465('0x13')]({'destination':function(_0x589ed5,_0x3a9ae4,_0x348ad0){_0x348ad0(null,path[_0x5465('0x14')](config[_0x5465('0x15')],'server/files/images/logos/'));},'filename':function(_0x526742,_0x44631e,_0x380635){_0x380635(null,util[_0x5465('0x17')](_0x5465('0x18'),_0x5465('0x1e'),path[_0x5465('0x1a')](_0x44631e[_0x5465('0x1b')])));}})});router[_0x5465('0x1c')](_0x5465('0xc'),upload[_0x5465('0x1f')](_0x5465('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x5465('0x13')]({'destination':function(_0x521490,_0x984012,_0x1fe2e8){_0x1fe2e8(null,path[_0x5465('0x14')](config[_0x5465('0x15')],'server/files/images/logos/'));},'filename':function(_0x1f691d,_0x40c122,_0x10e0a9){_0x10e0a9(null,util[_0x5465('0x17')](_0x5465('0x18'),_0x5465('0x21'),path[_0x5465('0x1a')](_0x40c122[_0x5465('0x1b')])));}})});router['post']('/:id/preferred',upload['single'](_0x5465('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0x5465('0x13')]({'destination':function(_0x3c7319,_0x213d36,_0x311622){_0x311622(null,path[_0x5465('0x14')](config[_0x5465('0x15')],_0x5465('0x16')));},'filename':function(_0x545942,_0x22f55e,_0x4c19a5){_0x4c19a5(null,util[_0x5465('0x17')](_0x5465('0x18'),_0x5465('0x22'),path[_0x5465('0x1a')](_0x22f55e['originalname'])));}})});router[_0x5465('0x1c')](_0x5465('0x23'),upload['single'](_0x5465('0x20')),controller[_0x5465('0x24')]);router[_0x5465('0x25')](_0x5465('0x26'),auth[_0x5465('0x27')](),controller['update']);module[_0x5465('0x28')]=router; \ No newline at end of file +var _0x0214=['preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','format','extname','originalname','post','single','file','addLogo','diskStorage','join','server/files/images/logos/','%s%s','logologin'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x0214,0x10f));var _0x4021=function(_0xa68324,_0x424be1){_0xa68324=_0xa68324-0x0;var _0x19dd73=_0x0214[_0xa68324];return _0x19dd73;};'use strict';var multer=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var path=require(_0x4021('0x2'));var timeout=require(_0x4021('0x3'));var express=require(_0x4021('0x4'));var router=express[_0x4021('0x5')]();var auth=require(_0x4021('0x6'));var interaction=require(_0x4021('0x7'));var config=require(_0x4021('0x8'));var controller=require(_0x4021('0x9'));router[_0x4021('0xa')]('/',auth[_0x4021('0xb')](),controller['index']);router[_0x4021('0xa')](_0x4021('0xc'),controller[_0x4021('0xd')]);router['get'](_0x4021('0xe'),controller[_0x4021('0xf')]);router[_0x4021('0xa')](_0x4021('0x10'),controller[_0x4021('0x11')]);router[_0x4021('0xa')](_0x4021('0x12'),controller[_0x4021('0x13')]);router[_0x4021('0xa')](_0x4021('0x14'),controller[_0x4021('0x15')]);router[_0x4021('0xa')](_0x4021('0x16'),controller[_0x4021('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29dc1f,_0x1d65ac,_0x3ebe8b){_0x3ebe8b(null,path['join'](config[_0x4021('0x18')],'server/files/images/logos/'));},'filename':function(_0x167a25,_0x5eb53a,_0x3d223c){_0x3d223c(null,util[_0x4021('0x19')]('%s%s','logo',path[_0x4021('0x1a')](_0x5eb53a[_0x4021('0x1b')])));}})});router[_0x4021('0x1c')](_0x4021('0xe'),upload[_0x4021('0x1d')](_0x4021('0x1e')),controller[_0x4021('0x1f')]);var upload=multer({'storage':multer[_0x4021('0x20')]({'destination':function(_0x114a8a,_0x396632,_0x203eec){_0x203eec(null,path[_0x4021('0x21')](config[_0x4021('0x18')],_0x4021('0x22')));},'filename':function(_0x593ce2,_0xa26a4d,_0x16f512){_0x16f512(null,util['format'](_0x4021('0x23'),_0x4021('0x24'),path['extname'](_0xa26a4d['originalname'])));}})});router[_0x4021('0x1c')]('/:id/logo_login',upload[_0x4021('0x1d')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4021('0x20')]({'destination':function(_0xc8645d,_0x2bfec2,_0x493fe6){_0x493fe6(null,path[_0x4021('0x21')](config[_0x4021('0x18')],_0x4021('0x22')));},'filename':function(_0x161596,_0x34eb87,_0x4a2a09){_0x4a2a09(null,util[_0x4021('0x19')](_0x4021('0x23'),_0x4021('0x25'),path[_0x4021('0x1a')](_0x34eb87[_0x4021('0x1b')])));}})});router['post']('/:id/preferred',upload[_0x4021('0x1d')](_0x4021('0x1e')),controller[_0x4021('0x26')]);var upload=multer({'storage':multer[_0x4021('0x20')]({'destination':function(_0x1af1a0,_0x2252f7,_0x2ce4ad){_0x2ce4ad(null,path[_0x4021('0x21')](config[_0x4021('0x18')],_0x4021('0x22')));},'filename':function(_0x147e31,_0x37cbca,_0x5778e5){_0x5778e5(null,util[_0x4021('0x19')]('%s%s',_0x4021('0x27'),path[_0x4021('0x1a')](_0x37cbca['originalname'])));}})});router['post'](_0x4021('0x16'),upload['single'](_0x4021('0x1e')),controller[_0x4021('0x28')]);router[_0x4021('0x29')](_0x4021('0xc'),auth['isAuthenticated'](),controller[_0x4021('0x2a')]);module[_0x4021('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 86b66b9..7ac4e7f 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 _0x1c4c=['min_internal','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER'];(function(_0x55f845,_0x399cb0){var _0x3f00c2=function(_0x10038e){while(--_0x10038e){_0x55f845['push'](_0x55f845['shift']());}};_0x3f00c2(++_0x399cb0);}(_0x1c4c,0x96));var _0xc1c4=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0x1c4c[_0x565fed];return _0x3e018f;};'use strict';var Sequelize=require(_0xc1c4('0x0'));module[_0xc1c4('0x1')]={'min_internal':{'type':Sequelize[_0xc1c4('0x2')](0xb),'unique':_0xc1c4('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc1c4('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc1c4('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xc1c4('0x4')},'logo':{'type':Sequelize[_0xc1c4('0x5')]},'defaultLogo':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc1c4('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc1c4('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xc1c4('0x5')]},'turnusername':{'type':Sequelize[_0xc1c4('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xc1c4('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc1c4('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc1c4('0x5')],'defaultValue':_0xc1c4('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc1c4('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc1c4('0x5')],'defaultValue':_0xc1c4('0x8')},'chatTimeout':{'type':Sequelize[_0xc1c4('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc1c4('0x5')]},'defaultPreferred':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc1c4('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xc1c4('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc1c4('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc1c4('0x5')]},'defaultFavicon':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc1c4('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc1c4('0x2')]},'transcribeRegion':{'type':Sequelize[_0xc1c4('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc1c4('0x2')]},'sentimentRegion':{'type':Sequelize[_0xc1c4('0x5')]},'language':{'type':Sequelize[_0xc1c4('0x5')]},'bucket':{'type':Sequelize[_0xc1c4('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xc1c4('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x7bf6=['min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7bf6,0x13d));var _0x67bf=function(_0x2e1101,_0x1128f1){_0x2e1101=_0x2e1101-0x0;var _0x50148d=_0x7bf6[_0x2e1101];return _0x50148d;};'use strict';var Sequelize=require(_0x67bf('0x0'));module[_0x67bf('0x1')]={'min_internal':{'type':Sequelize[_0x67bf('0x2')](0xb),'unique':_0x67bf('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x67bf('0x2')](0xb),'unique':_0x67bf('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x67bf('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x67bf('0x5')},'logo':{'type':Sequelize[_0x67bf('0x6')]},'defaultLogo':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x67bf('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x67bf('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x67bf('0x6')]},'turnaddr':{'type':Sequelize[_0x67bf('0x6')]},'turnusername':{'type':Sequelize[_0x67bf('0x6')]},'turnpassword':{'type':Sequelize[_0x67bf('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x67bf('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x67bf('0x6')],'defaultValue':_0x67bf('0x8')},'enableEmailPreview':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x67bf('0x6')],'defaultValue':_0x67bf('0x9')},'chatTimeout':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x67bf('0x6')]},'defaultPreferred':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x67bf('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x67bf('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x67bf('0x2')]},'transcribeRegion':{'type':Sequelize[_0x67bf('0x6')]},'sentiment':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x67bf('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x67bf('0x6')]},'bucket':{'type':Sequelize[_0x67bf('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x67bf('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 80d214b..467801b 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 _0xfd93=['json','count','offset','limit','set','Content-Range','apply','reject','destroy','send','index','fieldName','type','key','model','map','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','Setting','rows','show','params','rawAttributes','length','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','test','ValidationError','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status'];(function(_0x1c1182,_0x3c9bf1){var _0x5d4b7b=function(_0x1b9da3){while(--_0x1b9da3){_0x1c1182['push'](_0x1c1182['shift']());}};_0x5d4b7b(++_0x3c9bf1);}(_0xfd93,0xc8));var _0x3fd9=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xfd93[_0xd307d9];return _0x209bf8;};'use strict';var pdf=require(_0x3fd9('0x0'));var emlformat=require(_0x3fd9('0x1'));var rimraf=require(_0x3fd9('0x2'));var zipdir=require(_0x3fd9('0x3'));var jsonpatch=require(_0x3fd9('0x4'));var rp=require(_0x3fd9('0x5'));var moment=require('moment');var BPromise=require(_0x3fd9('0x6'));var Mustache=require(_0x3fd9('0x7'));var util=require(_0x3fd9('0x8'));var path=require(_0x3fd9('0x9'));var sox=require(_0x3fd9('0xa'));var csv=require(_0x3fd9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fd9('0xc'));var squel=require(_0x3fd9('0xd'));var crypto=require(_0x3fd9('0xe'));var jsforce=require(_0x3fd9('0xf'));var deskjs=require(_0x3fd9('0x10'));var toCsv=require(_0x3fd9('0xb'));var querystring=require(_0x3fd9('0x11'));var Papa=require(_0x3fd9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fd9('0x13'));var as=require(_0x3fd9('0x14'));var hardwareService=require(_0x3fd9('0x15'));var logger=require(_0x3fd9('0x16'))(_0x3fd9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3fd9('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3fd9('0x19')][_0x3fd9('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x38c2a5,_0x1d08d,_0x13bdea){if(_0x13bdea){var _0x1750bf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1750bf[_0x3fd9('0x1b')](_0x1d08d)){return _0x38c2a5;}else{throw new db['Sequelize'][(_0x3fd9('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 _0x38c2a5;}}function respondWithRpcPromise(_0x847df,_0x2bd2c5,_0x25b1d9,_0x1f5bc5){return new BPromise(function(_0x7f4f28,_0x1552f0){var _0x11a97a=_0x1f5bc5||client;return _0x11a97a[_0x3fd9('0x1d')](_0x847df,_0x25b1d9)[_0x3fd9('0x1e')](function(_0x120986){logger['info'](_0x3fd9('0x1f'),_0x2bd2c5,_0x3fd9('0x20'));logger[_0x3fd9('0x21')](_0x3fd9('0x22'),_0x2bd2c5,'request\x20sent',JSON[_0x3fd9('0x23')](_0x120986));if(_0x120986[_0x3fd9('0x24')]){if(_0x120986[_0x3fd9('0x24')][_0x3fd9('0x25')]===0x1f4){logger[_0x3fd9('0x24')]('Setting,\x20%s,\x20%s',_0x2bd2c5,_0x120986[_0x3fd9('0x24')][_0x3fd9('0x26')]);return _0x1552f0(_0x120986[_0x3fd9('0x24')][_0x3fd9('0x26')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2bd2c5,_0x120986['error']['message']);return _0x7f4f28(_0x120986[_0x3fd9('0x24')][_0x3fd9('0x26')]);}else{logger['info'](_0x3fd9('0x1f'),_0x2bd2c5,_0x3fd9('0x20'));_0x7f4f28(_0x120986[_0x3fd9('0x27')][_0x3fd9('0x26')]);}})[_0x3fd9('0x28')](function(_0x49b12e){logger[_0x3fd9('0x24')]('Setting,\x20%s,\x20%s',_0x2bd2c5,_0x49b12e);_0x1552f0(_0x49b12e);});});}function respondWithStatusCode(_0x25f851,_0x51176f){_0x51176f=_0x51176f||0xcc;return function(_0x3ab07b){if(_0x3ab07b){return _0x25f851[_0x3fd9('0x29')](_0x51176f);}return _0x25f851['status'](_0x51176f)[_0x3fd9('0x2a')]();};}function respondWithResult(_0x52eebb,_0x33ec21){_0x33ec21=_0x33ec21||0xc8;return function(_0x598c30){if(_0x598c30){return _0x52eebb[_0x3fd9('0x2b')](_0x33ec21)[_0x3fd9('0x2c')](_0x598c30);}};}function respondWithFilteredResult(_0x239c2b,_0x3960fd){return function(_0x4ac17f){if(_0x4ac17f){var _0x229768=_0x4ac17f[_0x3fd9('0x2d')],_0x41f975=_0x3960fd['offset'],_0x1c25f9=_0x3960fd[_0x3fd9('0x2e')]+_0x3960fd[_0x3fd9('0x2f')],_0x644acf;if(_0x1c25f9>=_0x229768){_0x1c25f9=_0x229768;_0x644acf=0xc8;}else{_0x644acf=0xce;}_0x239c2b[_0x3fd9('0x2b')](_0x644acf);return _0x239c2b[_0x3fd9('0x30')](_0x3fd9('0x31'),_0x41f975+'-'+_0x1c25f9+'/'+_0x229768)[_0x3fd9('0x2c')](_0x4ac17f);}return null;};}function patchUpdates(_0x5e6004){return function(_0x117a2){try{jsonpatch[_0x3fd9('0x32')](_0x117a2,_0x5e6004,!![]);}catch(_0x499eaf){return BPromise[_0x3fd9('0x33')](_0x499eaf);}return _0x117a2['save']();};}function saveUpdates(_0x44ec6a,_0x33a6f3){return function(_0x8c8737){if(_0x8c8737){return _0x8c8737['update'](_0x44ec6a)[_0x3fd9('0x1e')](function(_0x568cd8){return _0x568cd8;});}return null;};}function removeEntity(_0x27c0c3,_0x57b536){return function(_0x37c0ce){if(_0x37c0ce){return _0x37c0ce[_0x3fd9('0x34')]()[_0x3fd9('0x1e')](function(){_0x27c0c3['status'](0xcc)[_0x3fd9('0x2a')]();});}};}function handleEntityNotFound(_0xd6c298,_0x59e76f){return function(_0x1a1270){if(!_0x1a1270){_0xd6c298[_0x3fd9('0x29')](0x194);}return _0x1a1270;};}function handleError(_0x5ebf9c,_0x302609){_0x302609=_0x302609||0x1f4;return function(_0x276bc0){logger[_0x3fd9('0x24')](_0x276bc0['stack']);if(_0x276bc0['name']){delete _0x276bc0['name'];}_0x5ebf9c[_0x3fd9('0x2b')](_0x302609)[_0x3fd9('0x35')](_0x276bc0);};}exports[_0x3fd9('0x36')]=function(_0x5ef775,_0x48b7fa){var _0x43a5e0={},_0x55a1ea={},_0xefbb2f={'count':0x0,'rows':[]};var _0x4b3354=_['map'](db['Setting']['rawAttributes'],function(_0x3fa03c){return{'name':_0x3fa03c[_0x3fd9('0x37')],'type':_0x3fa03c[_0x3fd9('0x38')][_0x3fd9('0x39')]};});_0x55a1ea[_0x3fd9('0x3a')]=_[_0x3fd9('0x3b')](_0x4b3354,_0x3fd9('0x3c'));_0x55a1ea[_0x3fd9('0x3d')]=_[_0x3fd9('0x3e')](_0x5ef775[_0x3fd9('0x3d')]);_0x55a1ea['filters']=_['intersection'](_0x55a1ea['model'],_0x55a1ea[_0x3fd9('0x3d')]);_0x43a5e0[_0x3fd9('0x3f')]=_[_0x3fd9('0x40')](_0x55a1ea[_0x3fd9('0x3a')],qs[_0x3fd9('0x41')](_0x5ef775[_0x3fd9('0x3d')]['fields']));_0x43a5e0[_0x3fd9('0x3f')]=_0x43a5e0[_0x3fd9('0x3f')]['length']?_0x43a5e0[_0x3fd9('0x3f')]:_0x55a1ea[_0x3fd9('0x3a')];if(!_0x5ef775[_0x3fd9('0x3d')][_0x3fd9('0x42')](_0x3fd9('0x43'))){_0x43a5e0[_0x3fd9('0x2f')]=qs[_0x3fd9('0x2f')](_0x5ef775[_0x3fd9('0x3d')][_0x3fd9('0x2f')]);_0x43a5e0[_0x3fd9('0x2e')]=qs[_0x3fd9('0x2e')](_0x5ef775[_0x3fd9('0x3d')]['offset']);}_0x43a5e0[_0x3fd9('0x44')]=qs[_0x3fd9('0x45')](_0x5ef775[_0x3fd9('0x3d')][_0x3fd9('0x45')]);_0x43a5e0[_0x3fd9('0x46')]=qs['filters'](_['pick'](_0x5ef775[_0x3fd9('0x3d')],_0x55a1ea[_0x3fd9('0x47')]),_0x4b3354);if(_0x5ef775['query'][_0x3fd9('0x48')]){_0x43a5e0[_0x3fd9('0x46')]=_['merge'](_0x43a5e0['where'],{'$or':_[_0x3fd9('0x3b')](_0x4b3354,function(_0x546927){if(_0x546927[_0x3fd9('0x38')]!==_0x3fd9('0x49')){var _0x3d898f={};_0x3d898f[_0x546927[_0x3fd9('0x3c')]]={'$like':'%'+_0x5ef775[_0x3fd9('0x3d')][_0x3fd9('0x48')]+'%'};return _0x3d898f;}})});}_0x43a5e0=_[_0x3fd9('0x4a')]({},_0x43a5e0,_0x5ef775[_0x3fd9('0x4b')]);var _0x2b2f7c={'where':_0x43a5e0['where']};return db['Setting'][_0x3fd9('0x2d')](_0x2b2f7c)['then'](function(_0x2226e1){_0xefbb2f[_0x3fd9('0x2d')]=_0x2226e1;if(_0x5ef775[_0x3fd9('0x3d')]['includeAll']){_0x43a5e0[_0x3fd9('0x4c')]=[{'all':!![]}];}return db[_0x3fd9('0x4d')]['findAll'](_0x43a5e0);})[_0x3fd9('0x1e')](function(_0x2191a1){_0xefbb2f[_0x3fd9('0x4e')]=_0x2191a1;return _0xefbb2f;})[_0x3fd9('0x1e')](respondWithFilteredResult(_0x48b7fa,_0x43a5e0))[_0x3fd9('0x28')](handleError(_0x48b7fa,null));};exports[_0x3fd9('0x4f')]=function(_0x28087d,_0x32f231){var _0x4fda61={'raw':![],'where':{'id':_0x28087d[_0x3fd9('0x50')]['id']}},_0xfd928f={};_0xfd928f[_0x3fd9('0x3a')]=_[_0x3fd9('0x3e')](db['Setting'][_0x3fd9('0x51')]);_0xfd928f['query']=_[_0x3fd9('0x3e')](_0x28087d['query']);_0xfd928f[_0x3fd9('0x47')]=_[_0x3fd9('0x40')](_0xfd928f[_0x3fd9('0x3a')],_0xfd928f['query']);_0x4fda61[_0x3fd9('0x3f')]=_[_0x3fd9('0x40')](_0xfd928f[_0x3fd9('0x3a')],qs['fields'](_0x28087d['query'][_0x3fd9('0x41')]));_0x4fda61[_0x3fd9('0x3f')]=_0x4fda61[_0x3fd9('0x3f')][_0x3fd9('0x52')]?_0x4fda61[_0x3fd9('0x3f')]:_0xfd928f[_0x3fd9('0x3a')];if(_0x28087d[_0x3fd9('0x3d')]['includeAll']){_0x4fda61[_0x3fd9('0x4c')]=[{'all':!![]}];}_0x4fda61=_[_0x3fd9('0x4a')]({},_0x4fda61,_0x28087d['options']);return db[_0x3fd9('0x4d')][_0x3fd9('0x53')](_0x4fda61)[_0x3fd9('0x1e')](handleEntityNotFound(_0x32f231,null))[_0x3fd9('0x1e')](respondWithResult(_0x32f231,null))[_0x3fd9('0x28')](handleError(_0x32f231,null));};exports[_0x3fd9('0x54')]=function(_0xf2c1c3,_0x524230){if(_0xf2c1c3[_0x3fd9('0x55')]['id']){delete _0xf2c1c3[_0x3fd9('0x55')]['id'];}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0xf2c1c3[_0x3fd9('0x50')]['id']}})[_0x3fd9('0x1e')](handleEntityNotFound(_0x524230,null))[_0x3fd9('0x1e')](saveUpdates(_0xf2c1c3[_0x3fd9('0x55')],null))[_0x3fd9('0x1e')](respondWithResult(_0x524230,null))['catch'](handleError(_0x524230,null));};exports[_0x3fd9('0x56')]=function(_0x4f5ff9,_0x405d93,_0x26c8d0){if(_0x4f5ff9['file']&&_0x4f5ff9[_0x3fd9('0x57')][_0x3fd9('0x58')]){_0x4f5ff9[_0x3fd9('0x55')][_0x3fd9('0x59')]=_0x4f5ff9[_0x3fd9('0x57')][_0x3fd9('0x58')];}return db['Setting'][_0x3fd9('0x53')]({'where':{'id':_0x4f5ff9[_0x3fd9('0x50')]['id']}})[_0x3fd9('0x1e')](handleEntityNotFound(_0x405d93,null))[_0x3fd9('0x1e')](saveUpdates(_0x4f5ff9['body'],null))[_0x3fd9('0x1e')](respondWithResult(_0x405d93,null))[_0x3fd9('0x28')](handleError(_0x405d93,null));};exports[_0x3fd9('0x5a')]=function(_0x536560,_0x379903,_0x232240){if(_0x536560['file']&&_0x536560[_0x3fd9('0x57')][_0x3fd9('0x58')]){_0x536560[_0x3fd9('0x55')][_0x3fd9('0x5b')]=_0x536560[_0x3fd9('0x57')][_0x3fd9('0x58')];}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x536560[_0x3fd9('0x50')]['id']}})['then'](handleEntityNotFound(_0x379903,null))[_0x3fd9('0x1e')](saveUpdates(_0x536560[_0x3fd9('0x55')],null))['then'](respondWithResult(_0x379903,null))[_0x3fd9('0x28')](handleError(_0x379903,null));};var utilLicense=require(_0x3fd9('0x5c'));exports[_0x3fd9('0x5d')]=function(_0x31ca17,_0x19ab4b,_0x34bc10){var _0x19f81a=_0x3fd9('0x5e');var _0x5a8e88={'custom':![]};return utilLicense[_0x3fd9('0x5f')]()[_0x3fd9('0x1e')](function(_0x3468bb){if(_0x3468bb){_0x5a8e88=_0x3468bb;}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x31ca17[_0x3fd9('0x50')]['id']},'attributes':[_0x3fd9('0x59'),'loginLogo',_0x3fd9('0x60'),_0x3fd9('0x61'),_0x3fd9('0x62'),'defaultLoginLogo','defaultPreferred',_0x3fd9('0x63')],'raw':!![]});})[_0x3fd9('0x1e')](handleEntityNotFound(_0x19ab4b,null))[_0x3fd9('0x1e')](function(_0x247ab4){if(_0x247ab4){var _0x54b9ca=_0x247ab4[_0x3fd9('0x59')]&&fs[_0x3fd9('0x64')](path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19f81a,_[_0x3fd9('0x67')](_0x247ab4['logo'])))?path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19f81a,_['toLower'](_0x247ab4[_0x3fd9('0x59')])):path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19f81a,_[_0x3fd9('0x67')]('default_logo.svg'));var _0x3a4657=_0x3fd9('0x68')+_['upperFirst'](_0x3fd9('0x59'));if(_0x247ab4[_0x3a4657]||!_0x5a8e88[_0x3fd9('0x69')]){_0x54b9ca=path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19f81a,_[_0x3fd9('0x67')](_0x3fd9('0x6a')));}if(!fs[_0x3fd9('0x64')](_0x54b9ca)){throw new db[(_0x3fd9('0x6b'))]['ValidationError'](_[_0x3fd9('0x6c')](_0x3fd9('0x59'))+_0x3fd9('0x6d'));}return _0x19ab4b[_0x3fd9('0x6e')](_0x54b9ca);}})['catch'](handleError(_0x19ab4b,null));};var utilLicense=require(_0x3fd9('0x5c'));exports[_0x3fd9('0x6f')]=function(_0x23187a,_0x68a9e6,_0x3a05b3){var _0x1c1095='server/files/images/logos';var _0x35d899={'custom':![]};return utilLicense[_0x3fd9('0x5f')]()[_0x3fd9('0x1e')](function(_0x5a01e6){if(_0x5a01e6){_0x35d899=_0x5a01e6;}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x23187a['params']['id']},'attributes':[_0x3fd9('0x59'),'loginLogo',_0x3fd9('0x60'),_0x3fd9('0x61'),'defaultLogo',_0x3fd9('0x70'),_0x3fd9('0x71'),_0x3fd9('0x63')],'raw':!![]});})[_0x3fd9('0x1e')](handleEntityNotFound(_0x68a9e6,null))[_0x3fd9('0x1e')](function(_0x4c860e){if(_0x4c860e){var _0x3ce87d=_0x4c860e[_0x3fd9('0x5b')]&&fs[_0x3fd9('0x64')](path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x1c1095,_[_0x3fd9('0x67')](_0x4c860e[_0x3fd9('0x5b')])))?path['join'](config[_0x3fd9('0x66')],_0x1c1095,_['toLower'](_0x4c860e[_0x3fd9('0x5b')])):path[_0x3fd9('0x65')](config['root'],_0x1c1095,_['toLower']('default_loginLogo.svg'));var _0xb2cdc6=_0x3fd9('0x68')+_['upperFirst'](_0x3fd9('0x5b'));if(_0x4c860e[_0xb2cdc6]||!_0x35d899['custom']){_0x3ce87d=path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x1c1095,_[_0x3fd9('0x67')](_0x3fd9('0x72')));}if(!fs[_0x3fd9('0x64')](_0x3ce87d)){throw new db['Sequelize'][(_0x3fd9('0x1c'))](_[_0x3fd9('0x6c')](_0x3fd9('0x5b'))+_0x3fd9('0x6d'));}return _0x68a9e6['download'](_0x3ce87d);}})[_0x3fd9('0x28')](handleError(_0x68a9e6,null));};exports[_0x3fd9('0x73')]=function(_0x2c2aa7,_0x30073b){return db[_0x3fd9('0x4d')]['find']({'where':{'id':_0x2c2aa7[_0x3fd9('0x50')]['id']},'attributes':[_0x3fd9('0x74')]})[_0x3fd9('0x1e')](respondWithResult(_0x30073b,null))[_0x3fd9('0x28')](handleError(_0x30073b,null));};exports[_0x3fd9('0x75')]=function(_0x2bc0d0,_0x2b4093,_0x32694c){if(_0x2bc0d0[_0x3fd9('0x57')]&&_0x2bc0d0[_0x3fd9('0x57')][_0x3fd9('0x58')]){_0x2bc0d0['body'][_0x3fd9('0x60')]=_0x2bc0d0[_0x3fd9('0x57')]['filename'];}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x2bc0d0[_0x3fd9('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b4093,null))[_0x3fd9('0x1e')](saveUpdates(_0x2bc0d0['body'],null))[_0x3fd9('0x1e')](respondWithResult(_0x2b4093,null))[_0x3fd9('0x28')](handleError(_0x2b4093,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x19c391,_0x27edbc,_0x1bc4f0){var _0x19fcfc=_0x3fd9('0x5e');var _0x5568d8={'custom':![]};return utilLicense[_0x3fd9('0x5f')]()[_0x3fd9('0x1e')](function(_0x41aab4){if(_0x41aab4){_0x5568d8=_0x41aab4;}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x19c391[_0x3fd9('0x50')]['id']},'attributes':[_0x3fd9('0x59'),_0x3fd9('0x5b'),'preferred',_0x3fd9('0x61'),_0x3fd9('0x62'),_0x3fd9('0x70'),_0x3fd9('0x71'),'defaultFavicon'],'raw':!![]});})[_0x3fd9('0x1e')](handleEntityNotFound(_0x27edbc,null))[_0x3fd9('0x1e')](function(_0x24809d){if(_0x24809d){var _0x201920=_0x24809d[_0x3fd9('0x60')]&&fs[_0x3fd9('0x64')](path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19fcfc,_[_0x3fd9('0x67')](_0x24809d[_0x3fd9('0x60')])))?path[_0x3fd9('0x65')](config['root'],_0x19fcfc,_[_0x3fd9('0x67')](_0x24809d[_0x3fd9('0x60')])):path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x19fcfc,_[_0x3fd9('0x67')](_0x3fd9('0x76')));var _0x48aad7=_0x3fd9('0x68')+_[_0x3fd9('0x6c')]('preferred');if(_0x24809d[_0x48aad7]||!_0x5568d8[_0x3fd9('0x69')]||!_0x5568d8[_0x3fd9('0x60')]){_0x201920=path['join'](config[_0x3fd9('0x66')],_0x19fcfc,_['toLower'](_0x3fd9('0x76')));}if(!fs['existsSync'](_0x201920)){throw new db['Sequelize'][(_0x3fd9('0x1c'))](_[_0x3fd9('0x6c')](_0x3fd9('0x60'))+_0x3fd9('0x6d'));}return _0x27edbc[_0x3fd9('0x6e')](_0x201920);}})[_0x3fd9('0x28')](handleError(_0x27edbc,null));};exports[_0x3fd9('0x77')]=function(_0x2484b1,_0x3d26a5,_0x2e072f){if(_0x2484b1[_0x3fd9('0x57')]&&_0x2484b1[_0x3fd9('0x57')][_0x3fd9('0x58')]){_0x2484b1[_0x3fd9('0x55')][_0x3fd9('0x61')]=_0x2484b1[_0x3fd9('0x57')]['filename'];}return db['Setting'][_0x3fd9('0x53')]({'where':{'id':_0x2484b1['params']['id']}})[_0x3fd9('0x1e')](handleEntityNotFound(_0x3d26a5,null))[_0x3fd9('0x1e')](saveUpdates(_0x2484b1[_0x3fd9('0x55')],null))[_0x3fd9('0x1e')](respondWithResult(_0x3d26a5,null))[_0x3fd9('0x28')](handleError(_0x3d26a5,null));};var utilLicense=require(_0x3fd9('0x5c'));exports[_0x3fd9('0x78')]=function(_0x28180c,_0x3df0e6,_0x12c4c5){var _0x2f2317='server/files/images/logos';var _0x3ecc3e={'custom':![]};return utilLicense[_0x3fd9('0x5f')]()['then'](function(_0x47e0a6){if(_0x47e0a6){_0x3ecc3e=_0x47e0a6;}return db[_0x3fd9('0x4d')][_0x3fd9('0x53')]({'where':{'id':_0x28180c[_0x3fd9('0x50')]['id']},'attributes':['logo',_0x3fd9('0x5b'),'preferred',_0x3fd9('0x61'),_0x3fd9('0x62'),_0x3fd9('0x70'),_0x3fd9('0x71'),_0x3fd9('0x63')],'raw':!![]});})[_0x3fd9('0x1e')](handleEntityNotFound(_0x3df0e6,null))[_0x3fd9('0x1e')](function(_0x43b98e){if(_0x43b98e){var _0x3fb265=_0x43b98e[_0x3fd9('0x61')]&&fs[_0x3fd9('0x64')](path['join'](config['root'],_0x2f2317,_['toLower'](_0x43b98e[_0x3fd9('0x61')])))?path[_0x3fd9('0x65')](config['root'],_0x2f2317,_[_0x3fd9('0x67')](_0x43b98e['favicon'])):path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x2f2317,_[_0x3fd9('0x67')](_0x3fd9('0x79')));var _0x2e861d='default'+_[_0x3fd9('0x6c')](_0x3fd9('0x61'));if(_0x43b98e[_0x2e861d]||!_0x3ecc3e[_0x3fd9('0x69')]){_0x3fb265=path[_0x3fd9('0x65')](config[_0x3fd9('0x66')],_0x2f2317,_[_0x3fd9('0x67')](_0x3fd9('0x79')));}if(!fs[_0x3fd9('0x64')](_0x3fb265)){throw new db[(_0x3fd9('0x6b'))][(_0x3fd9('0x1c'))](_['upperFirst']('favicon')+_0x3fd9('0x6d'));}return _0x3df0e6[_0x3fd9('0x6e')](_0x3fb265);}})[_0x3fd9('0x28')](handleError(_0x3df0e6,null));}; \ No newline at end of file +var _0xa4cf=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../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~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','Setting','count','includeAll','include','findAll','rows','show','params','options','find','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','preferred','root','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0xa4cf,0xf4));var _0xfa4c=function(_0x1b02fa,_0x55fe2d){_0x1b02fa=_0x1b02fa-0x0;var _0xecef5c=_0xa4cf[_0x1b02fa];return _0xecef5c;};'use strict';var pdf=require(_0xfa4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfa4c('0x1'));var zipdir=require(_0xfa4c('0x2'));var jsonpatch=require(_0xfa4c('0x3'));var rp=require(_0xfa4c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa4c('0x5'));var util=require(_0xfa4c('0x6'));var path=require('path');var sox=require(_0xfa4c('0x7'));var csv=require('to-csv');var ejs=require(_0xfa4c('0x8'));var fs=require('fs');var _=require(_0xfa4c('0x9'));var squel=require('squel');var crypto=require(_0xfa4c('0xa'));var jsforce=require(_0xfa4c('0xb'));var deskjs=require(_0xfa4c('0xc'));var toCsv=require(_0xfa4c('0xd'));var querystring=require(_0xfa4c('0xe'));var Papa=require(_0xfa4c('0xf'));var Redis=require(_0xfa4c('0x10'));var authService=require(_0xfa4c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa4c('0x12'));var logger=require(_0xfa4c('0x13'))(_0xfa4c('0x14'));var utils=require('../../config/utils');var config=require(_0xfa4c('0x15'));var db=require(_0xfa4c('0x16'))['db'];var jayson=require(_0xfa4c('0x17'));var client=jayson[_0xfa4c('0x18')][_0xfa4c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4e82e6,_0x3b6b7d,_0x1b5b40){if(_0x1b5b40){var _0x1538b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1538b5['test'](_0x3b6b7d)){return _0x4e82e6;}else{throw new db['Sequelize'][(_0xfa4c('0x1a'))](_0xfa4c('0x1b'));}}else{return _0x4e82e6;}}function respondWithRpcPromise(_0x3779f3,_0x4de1c3,_0x536c76,_0x154771){return new BPromise(function(_0x217a30,_0x3aa104){var _0x192c1a=_0x154771||client;return _0x192c1a['request'](_0x3779f3,_0x536c76)[_0xfa4c('0x1c')](function(_0x5e3915){logger[_0xfa4c('0x1d')](_0xfa4c('0x1e'),_0x4de1c3,_0xfa4c('0x1f'));logger[_0xfa4c('0x20')](_0xfa4c('0x21'),_0x4de1c3,_0xfa4c('0x1f'),JSON['stringify'](_0x5e3915));if(_0x5e3915[_0xfa4c('0x22')]){if(_0x5e3915['error']['code']===0x1f4){logger[_0xfa4c('0x22')](_0xfa4c('0x1e'),_0x4de1c3,_0x5e3915[_0xfa4c('0x22')][_0xfa4c('0x23')]);return _0x3aa104(_0x5e3915[_0xfa4c('0x22')]['message']);}logger[_0xfa4c('0x22')](_0xfa4c('0x1e'),_0x4de1c3,_0x5e3915['error'][_0xfa4c('0x23')]);return _0x217a30(_0x5e3915[_0xfa4c('0x22')][_0xfa4c('0x23')]);}else{logger['info'](_0xfa4c('0x1e'),_0x4de1c3,_0xfa4c('0x1f'));_0x217a30(_0x5e3915['result'][_0xfa4c('0x23')]);}})[_0xfa4c('0x24')](function(_0x5025c1){logger[_0xfa4c('0x22')]('Setting,\x20%s,\x20%s',_0x4de1c3,_0x5025c1);_0x3aa104(_0x5025c1);});});}function respondWithStatusCode(_0xd3ee72,_0x456670){_0x456670=_0x456670||0xcc;return function(_0x41af29){if(_0x41af29){return _0xd3ee72['sendStatus'](_0x456670);}return _0xd3ee72[_0xfa4c('0x25')](_0x456670)[_0xfa4c('0x26')]();};}function respondWithResult(_0x2ced9e,_0x267987){_0x267987=_0x267987||0xc8;return function(_0x2197b6){if(_0x2197b6){return _0x2ced9e[_0xfa4c('0x25')](_0x267987)['json'](_0x2197b6);}};}function respondWithFilteredResult(_0x23f3d2,_0x354376){return function(_0x581a12){if(_0x581a12){var _0xd2ef68=_0x581a12['count'],_0x27d218=_0x354376[_0xfa4c('0x27')],_0x1c70e7=_0x354376[_0xfa4c('0x27')]+_0x354376['limit'],_0x5abfd7;if(_0x1c70e7>=_0xd2ef68){_0x1c70e7=_0xd2ef68;_0x5abfd7=0xc8;}else{_0x5abfd7=0xce;}_0x23f3d2[_0xfa4c('0x25')](_0x5abfd7);return _0x23f3d2[_0xfa4c('0x28')](_0xfa4c('0x29'),_0x27d218+'-'+_0x1c70e7+'/'+_0xd2ef68)[_0xfa4c('0x2a')](_0x581a12);}return null;};}function patchUpdates(_0x147c91){return function(_0x18fd0b){try{jsonpatch[_0xfa4c('0x2b')](_0x18fd0b,_0x147c91,!![]);}catch(_0x7e237e){return BPromise[_0xfa4c('0x2c')](_0x7e237e);}return _0x18fd0b[_0xfa4c('0x2d')]();};}function saveUpdates(_0x50465e,_0x11fa80){return function(_0x26a87f){if(_0x26a87f){return _0x26a87f[_0xfa4c('0x2e')](_0x50465e)['then'](function(_0xd051f9){return _0xd051f9;});}return null;};}function removeEntity(_0x50410e,_0x469b97){return function(_0xb254d4){if(_0xb254d4){return _0xb254d4[_0xfa4c('0x2f')]()['then'](function(){_0x50410e[_0xfa4c('0x25')](0xcc)[_0xfa4c('0x26')]();});}};}function handleEntityNotFound(_0x15eeb9,_0x1e3445){return function(_0x47ff92){if(!_0x47ff92){_0x15eeb9[_0xfa4c('0x30')](0x194);}return _0x47ff92;};}function handleError(_0x221588,_0x1d64a8){_0x1d64a8=_0x1d64a8||0x1f4;return function(_0x5e50ff){logger['error'](_0x5e50ff[_0xfa4c('0x31')]);if(_0x5e50ff['name']){delete _0x5e50ff[_0xfa4c('0x32')];}_0x221588[_0xfa4c('0x25')](_0x1d64a8)[_0xfa4c('0x33')](_0x5e50ff);};}exports[_0xfa4c('0x34')]=function(_0x6eb14e,_0xedc7c){var _0x526666={},_0x226101={},_0x19da8a={'count':0x0,'rows':[]};var _0x2c603d=_[_0xfa4c('0x35')](db['Setting'][_0xfa4c('0x36')],function(_0x5a21b4){return{'name':_0x5a21b4[_0xfa4c('0x37')],'type':_0x5a21b4[_0xfa4c('0x38')]['key']};});_0x226101['model']=_[_0xfa4c('0x35')](_0x2c603d,'name');_0x226101[_0xfa4c('0x39')]=_[_0xfa4c('0x3a')](_0x6eb14e['query']);_0x226101['filters']=_['intersection'](_0x226101[_0xfa4c('0x3b')],_0x226101[_0xfa4c('0x39')]);_0x526666[_0xfa4c('0x3c')]=_[_0xfa4c('0x3d')](_0x226101[_0xfa4c('0x3b')],qs[_0xfa4c('0x3e')](_0x6eb14e[_0xfa4c('0x39')]['fields']));_0x526666['attributes']=_0x526666[_0xfa4c('0x3c')][_0xfa4c('0x3f')]?_0x526666['attributes']:_0x226101['model'];if(!_0x6eb14e[_0xfa4c('0x39')][_0xfa4c('0x40')](_0xfa4c('0x41'))){_0x526666['limit']=qs[_0xfa4c('0x42')](_0x6eb14e['query']['limit']);_0x526666[_0xfa4c('0x27')]=qs[_0xfa4c('0x27')](_0x6eb14e['query'][_0xfa4c('0x27')]);}_0x526666[_0xfa4c('0x43')]=qs['sort'](_0x6eb14e[_0xfa4c('0x39')][_0xfa4c('0x44')]);_0x526666[_0xfa4c('0x45')]=qs[_0xfa4c('0x46')](_[_0xfa4c('0x47')](_0x6eb14e[_0xfa4c('0x39')],_0x226101[_0xfa4c('0x46')]),_0x2c603d);if(_0x6eb14e[_0xfa4c('0x39')][_0xfa4c('0x48')]){_0x526666[_0xfa4c('0x45')]=_[_0xfa4c('0x49')](_0x526666['where'],{'$or':_[_0xfa4c('0x35')](_0x2c603d,function(_0x42eb30){if(_0x42eb30[_0xfa4c('0x38')]!=='VIRTUAL'){var _0x299d5f={};_0x299d5f[_0x42eb30[_0xfa4c('0x32')]]={'$like':'%'+_0x6eb14e[_0xfa4c('0x39')][_0xfa4c('0x48')]+'%'};return _0x299d5f;}})});}_0x526666=_['merge']({},_0x526666,_0x6eb14e['options']);var _0x217f32={'where':_0x526666[_0xfa4c('0x45')]};return db[_0xfa4c('0x4a')]['count'](_0x217f32)[_0xfa4c('0x1c')](function(_0x3fe470){_0x19da8a[_0xfa4c('0x4b')]=_0x3fe470;if(_0x6eb14e[_0xfa4c('0x39')][_0xfa4c('0x4c')]){_0x526666[_0xfa4c('0x4d')]=[{'all':!![]}];}return db[_0xfa4c('0x4a')][_0xfa4c('0x4e')](_0x526666);})[_0xfa4c('0x1c')](function(_0x360b6b){_0x19da8a[_0xfa4c('0x4f')]=_0x360b6b;return _0x19da8a;})['then'](respondWithFilteredResult(_0xedc7c,_0x526666))[_0xfa4c('0x24')](handleError(_0xedc7c,null));};exports[_0xfa4c('0x50')]=function(_0x3b3882,_0x1b2efc){var _0x5b7779={'raw':![],'where':{'id':_0x3b3882[_0xfa4c('0x51')]['id']}},_0x5b14a2={};_0x5b14a2[_0xfa4c('0x3b')]=_[_0xfa4c('0x3a')](db[_0xfa4c('0x4a')][_0xfa4c('0x36')]);_0x5b14a2[_0xfa4c('0x39')]=_['keys'](_0x3b3882[_0xfa4c('0x39')]);_0x5b14a2[_0xfa4c('0x46')]=_['intersection'](_0x5b14a2[_0xfa4c('0x3b')],_0x5b14a2[_0xfa4c('0x39')]);_0x5b7779['attributes']=_[_0xfa4c('0x3d')](_0x5b14a2[_0xfa4c('0x3b')],qs[_0xfa4c('0x3e')](_0x3b3882[_0xfa4c('0x39')][_0xfa4c('0x3e')]));_0x5b7779[_0xfa4c('0x3c')]=_0x5b7779['attributes'][_0xfa4c('0x3f')]?_0x5b7779[_0xfa4c('0x3c')]:_0x5b14a2[_0xfa4c('0x3b')];if(_0x3b3882['query'][_0xfa4c('0x4c')]){_0x5b7779['include']=[{'all':!![]}];}_0x5b7779=_[_0xfa4c('0x49')]({},_0x5b7779,_0x3b3882[_0xfa4c('0x52')]);return db[_0xfa4c('0x4a')][_0xfa4c('0x53')](_0x5b7779)[_0xfa4c('0x1c')](handleEntityNotFound(_0x1b2efc,null))[_0xfa4c('0x1c')](respondWithResult(_0x1b2efc,null))['catch'](handleError(_0x1b2efc,null));};exports[_0xfa4c('0x2e')]=function(_0x247364,_0x3dc22b){if(_0x247364[_0xfa4c('0x54')]['id']){delete _0x247364[_0xfa4c('0x54')]['id'];}return db[_0xfa4c('0x4a')]['find']({'where':{'id':_0x247364['params']['id']}})[_0xfa4c('0x1c')](handleEntityNotFound(_0x3dc22b,null))[_0xfa4c('0x1c')](saveUpdates(_0x247364[_0xfa4c('0x54')],null))[_0xfa4c('0x1c')](respondWithResult(_0x3dc22b,null))[_0xfa4c('0x24')](handleError(_0x3dc22b,null));};exports[_0xfa4c('0x55')]=function(_0x25fc95,_0x362f18,_0x1a40bf){if(_0x25fc95['file']&&_0x25fc95[_0xfa4c('0x56')][_0xfa4c('0x57')]){_0x25fc95[_0xfa4c('0x54')]['logo']=_0x25fc95[_0xfa4c('0x56')][_0xfa4c('0x57')];}return db[_0xfa4c('0x4a')][_0xfa4c('0x53')]({'where':{'id':_0x25fc95[_0xfa4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x362f18,null))['then'](saveUpdates(_0x25fc95[_0xfa4c('0x54')],null))[_0xfa4c('0x1c')](respondWithResult(_0x362f18,null))[_0xfa4c('0x24')](handleError(_0x362f18,null));};exports[_0xfa4c('0x58')]=function(_0x107941,_0x4b420d,_0xc18d9){if(_0x107941[_0xfa4c('0x56')]&&_0x107941[_0xfa4c('0x56')][_0xfa4c('0x57')]){_0x107941[_0xfa4c('0x54')][_0xfa4c('0x59')]=_0x107941[_0xfa4c('0x56')]['filename'];}return db[_0xfa4c('0x4a')][_0xfa4c('0x53')]({'where':{'id':_0x107941[_0xfa4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b420d,null))['then'](saveUpdates(_0x107941[_0xfa4c('0x54')],null))[_0xfa4c('0x1c')](respondWithResult(_0x4b420d,null))[_0xfa4c('0x24')](handleError(_0x4b420d,null));};var utilLicense=require(_0xfa4c('0x5a'));exports[_0xfa4c('0x5b')]=function(_0x3a9ac9,_0x369159,_0x4a44db){var _0x4b7cfb=_0xfa4c('0x5c');var _0x47e9b0={'custom':![]};return utilLicense[_0xfa4c('0x5d')]()[_0xfa4c('0x1c')](function(_0x3680f6){if(_0x3680f6){_0x47e9b0=_0x3680f6;}return db[_0xfa4c('0x4a')]['find']({'where':{'id':_0x3a9ac9['params']['id']},'attributes':[_0xfa4c('0x5e'),'loginLogo','preferred',_0xfa4c('0x5f'),'defaultLogo','defaultLoginLogo',_0xfa4c('0x60'),_0xfa4c('0x61')],'raw':!![]});})[_0xfa4c('0x1c')](handleEntityNotFound(_0x369159,null))[_0xfa4c('0x1c')](function(_0x1ea4a9){if(_0x1ea4a9){var _0x1d720d=_0x1ea4a9[_0xfa4c('0x5e')]&&fs[_0xfa4c('0x62')](path[_0xfa4c('0x63')](config['root'],_0x4b7cfb,_[_0xfa4c('0x64')](_0x1ea4a9[_0xfa4c('0x5e')])))?path['join'](config['root'],_0x4b7cfb,_['toLower'](_0x1ea4a9[_0xfa4c('0x5e')])):path[_0xfa4c('0x63')](config['root'],_0x4b7cfb,_[_0xfa4c('0x64')](_0xfa4c('0x65')));var _0x879501=_0xfa4c('0x66')+_[_0xfa4c('0x67')](_0xfa4c('0x5e'));if(_0x1ea4a9[_0x879501]||!_0x47e9b0[_0xfa4c('0x68')]){_0x1d720d=path[_0xfa4c('0x63')](config['root'],_0x4b7cfb,_[_0xfa4c('0x64')](_0xfa4c('0x65')));}if(!fs[_0xfa4c('0x62')](_0x1d720d)){throw new db[(_0xfa4c('0x69'))][(_0xfa4c('0x1a'))](_[_0xfa4c('0x67')](_0xfa4c('0x5e'))+_0xfa4c('0x6a'));}return _0x369159['download'](_0x1d720d);}})[_0xfa4c('0x24')](handleError(_0x369159,null));};var utilLicense=require(_0xfa4c('0x5a'));exports[_0xfa4c('0x6b')]=function(_0xfe40b2,_0x343d7b,_0xf620ab){var _0x524c69='server/files/images/logos';var _0x2024e8={'custom':![]};return utilLicense[_0xfa4c('0x5d')]()['then'](function(_0x5d182a){if(_0x5d182a){_0x2024e8=_0x5d182a;}return db['Setting'][_0xfa4c('0x53')]({'where':{'id':_0xfe40b2[_0xfa4c('0x51')]['id']},'attributes':[_0xfa4c('0x5e'),'loginLogo',_0xfa4c('0x6c'),_0xfa4c('0x5f'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0xfa4c('0x61')],'raw':!![]});})[_0xfa4c('0x1c')](handleEntityNotFound(_0x343d7b,null))[_0xfa4c('0x1c')](function(_0x2d24f0){if(_0x2d24f0){var _0x20c521=_0x2d24f0[_0xfa4c('0x59')]&&fs[_0xfa4c('0x62')](path['join'](config['root'],_0x524c69,_['toLower'](_0x2d24f0[_0xfa4c('0x59')])))?path[_0xfa4c('0x63')](config[_0xfa4c('0x6d')],_0x524c69,_[_0xfa4c('0x64')](_0x2d24f0[_0xfa4c('0x59')])):path[_0xfa4c('0x63')](config[_0xfa4c('0x6d')],_0x524c69,_['toLower'](_0xfa4c('0x6e')));var _0x365382=_0xfa4c('0x66')+_[_0xfa4c('0x67')]('loginLogo');if(_0x2d24f0[_0x365382]||!_0x2024e8[_0xfa4c('0x68')]){_0x20c521=path['join'](config[_0xfa4c('0x6d')],_0x524c69,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x20c521)){throw new db['Sequelize'][(_0xfa4c('0x1a'))](_[_0xfa4c('0x67')](_0xfa4c('0x59'))+_0xfa4c('0x6a'));}return _0x343d7b[_0xfa4c('0x6f')](_0x20c521);}})[_0xfa4c('0x24')](handleError(_0x343d7b,null));};exports[_0xfa4c('0x70')]=function(_0x33ecd3,_0x51fc3d){return db['Setting'][_0xfa4c('0x53')]({'where':{'id':_0x33ecd3['params']['id']},'attributes':[_0xfa4c('0x71')]})[_0xfa4c('0x1c')](respondWithResult(_0x51fc3d,null))['catch'](handleError(_0x51fc3d,null));};exports[_0xfa4c('0x72')]=function(_0x3070c2,_0x15a438,_0x3b0242){if(_0x3070c2['file']&&_0x3070c2[_0xfa4c('0x56')]['filename']){_0x3070c2[_0xfa4c('0x54')][_0xfa4c('0x6c')]=_0x3070c2[_0xfa4c('0x56')][_0xfa4c('0x57')];}return db[_0xfa4c('0x4a')][_0xfa4c('0x53')]({'where':{'id':_0x3070c2[_0xfa4c('0x51')]['id']}})[_0xfa4c('0x1c')](handleEntityNotFound(_0x15a438,null))[_0xfa4c('0x1c')](saveUpdates(_0x3070c2['body'],null))[_0xfa4c('0x1c')](respondWithResult(_0x15a438,null))['catch'](handleError(_0x15a438,null));};var utilLicense=require(_0xfa4c('0x5a'));exports[_0xfa4c('0x73')]=function(_0x155a98,_0x5204d7,_0x41c515){var _0x21e6fc=_0xfa4c('0x5c');var _0x5ec6ee={'custom':![]};return utilLicense[_0xfa4c('0x5d')]()['then'](function(_0x10505b){if(_0x10505b){_0x5ec6ee=_0x10505b;}return db['Setting'][_0xfa4c('0x53')]({'where':{'id':_0x155a98[_0xfa4c('0x51')]['id']},'attributes':['logo',_0xfa4c('0x59'),_0xfa4c('0x6c'),_0xfa4c('0x5f'),_0xfa4c('0x74'),_0xfa4c('0x75'),'defaultPreferred',_0xfa4c('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x5204d7,null))['then'](function(_0x52a3fd){if(_0x52a3fd){var _0x8af7a=_0x52a3fd['preferred']&&fs[_0xfa4c('0x62')](path['join'](config['root'],_0x21e6fc,_['toLower'](_0x52a3fd[_0xfa4c('0x6c')])))?path['join'](config[_0xfa4c('0x6d')],_0x21e6fc,_['toLower'](_0x52a3fd[_0xfa4c('0x6c')])):path['join'](config[_0xfa4c('0x6d')],_0x21e6fc,_['toLower']('default_preferred.png'));var _0x4d4d95='default'+_[_0xfa4c('0x67')](_0xfa4c('0x6c'));if(_0x52a3fd[_0x4d4d95]||!_0x5ec6ee[_0xfa4c('0x68')]||!_0x5ec6ee['preferred']){_0x8af7a=path[_0xfa4c('0x63')](config[_0xfa4c('0x6d')],_0x21e6fc,_[_0xfa4c('0x64')](_0xfa4c('0x76')));}if(!fs[_0xfa4c('0x62')](_0x8af7a)){throw new db['Sequelize'][(_0xfa4c('0x1a'))](_[_0xfa4c('0x67')](_0xfa4c('0x6c'))+_0xfa4c('0x6a'));}return _0x5204d7[_0xfa4c('0x6f')](_0x8af7a);}})['catch'](handleError(_0x5204d7,null));};exports[_0xfa4c('0x77')]=function(_0x4ba00d,_0x2d2884,_0x1cadfb){if(_0x4ba00d[_0xfa4c('0x56')]&&_0x4ba00d['file'][_0xfa4c('0x57')]){_0x4ba00d['body']['favicon']=_0x4ba00d[_0xfa4c('0x56')][_0xfa4c('0x57')];}return db[_0xfa4c('0x4a')][_0xfa4c('0x53')]({'where':{'id':_0x4ba00d[_0xfa4c('0x51')]['id']}})[_0xfa4c('0x1c')](handleEntityNotFound(_0x2d2884,null))['then'](saveUpdates(_0x4ba00d[_0xfa4c('0x54')],null))['then'](respondWithResult(_0x2d2884,null))[_0xfa4c('0x24')](handleError(_0x2d2884,null));};var utilLicense=require(_0xfa4c('0x5a'));exports[_0xfa4c('0x78')]=function(_0x2c5604,_0x2a212b,_0x2c8a46){var _0x393eb7=_0xfa4c('0x5c');var _0x10be13={'custom':![]};return utilLicense['getLicense']()[_0xfa4c('0x1c')](function(_0x575820){if(_0x575820){_0x10be13=_0x575820;}return db[_0xfa4c('0x4a')][_0xfa4c('0x53')]({'where':{'id':_0x2c5604[_0xfa4c('0x51')]['id']},'attributes':[_0xfa4c('0x5e'),_0xfa4c('0x59'),'preferred',_0xfa4c('0x5f'),_0xfa4c('0x74'),_0xfa4c('0x75'),_0xfa4c('0x60'),_0xfa4c('0x61')],'raw':!![]});})[_0xfa4c('0x1c')](handleEntityNotFound(_0x2a212b,null))['then'](function(_0x261e80){if(_0x261e80){var _0x5fd842=_0x261e80[_0xfa4c('0x5f')]&&fs[_0xfa4c('0x62')](path[_0xfa4c('0x63')](config['root'],_0x393eb7,_[_0xfa4c('0x64')](_0x261e80[_0xfa4c('0x5f')])))?path['join'](config[_0xfa4c('0x6d')],_0x393eb7,_[_0xfa4c('0x64')](_0x261e80[_0xfa4c('0x5f')])):path[_0xfa4c('0x63')](config['root'],_0x393eb7,_[_0xfa4c('0x64')]('default_favicon.ico'));var _0x12c952=_0xfa4c('0x66')+_[_0xfa4c('0x67')](_0xfa4c('0x5f'));if(_0x261e80[_0x12c952]||!_0x10be13['custom']){_0x5fd842=path[_0xfa4c('0x63')](config[_0xfa4c('0x6d')],_0x393eb7,_['toLower'](_0xfa4c('0x79')));}if(!fs['existsSync'](_0x5fd842)){throw new db[(_0xfa4c('0x69'))]['ValidationError'](_[_0xfa4c('0x67')](_0xfa4c('0x5f'))+_0xfa4c('0x6a'));}return _0x2a212b[_0xfa4c('0x6f')](_0x5fd842);}})['catch'](handleError(_0x2a212b,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 472cd92..2d853b6 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 _0x4e11=['exports','settings','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2d1748,_0x25bfea){var _0x12ab36=function(_0x512774){while(--_0x512774){_0x2d1748['push'](_0x2d1748['shift']());}};_0x12ab36(++_0x25bfea);}(_0x4e11,0x1e8));var _0x14e1=function(_0x199b64,_0x5d1120){_0x199b64=_0x199b64-0x0;var _0x42b220=_0x4e11[_0x199b64];return _0x42b220;};'use strict';var _=require(_0x14e1('0x0'));var util=require(_0x14e1('0x1'));var logger=require(_0x14e1('0x2'))('api');var moment=require(_0x14e1('0x3'));var BPromise=require(_0x14e1('0x4'));var rp=require(_0x14e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x14e1('0x6'));var attributes=require('./setting.attributes');module[_0x14e1('0x7')]=function(_0x2a177a,_0x12e859){return _0x2a177a['define']('Setting',attributes,{'tableName':_0x14e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c14=['define','Setting','settings','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xbced40,_0x2fa5f0){var _0x230f2e=function(_0xc13c1c){while(--_0xc13c1c){_0xbced40['push'](_0xbced40['shift']());}};_0x230f2e(++_0x2fa5f0);}(_0x8c14,0x85));var _0x48c1=function(_0x43fbe5,_0x1cadd4){_0x43fbe5=_0x43fbe5-0x0;var _0x1ecd68=_0x8c14[_0x43fbe5];return _0x1ecd68;};'use strict';var _=require(_0x48c1('0x0'));var util=require(_0x48c1('0x1'));var logger=require(_0x48c1('0x2'))(_0x48c1('0x3'));var moment=require(_0x48c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48c1('0x5'));var rimraf=require(_0x48c1('0x6'));var config=require(_0x48c1('0x7'));var attributes=require(_0x48c1('0x8'));module[_0x48c1('0x9')]=function(_0x385630,_0x39300d){return _0x385630[_0x48c1('0xa')](_0x48c1('0xb'),attributes,{'tableName':_0x48c1('0xc'),'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 08b383a..c222cf6 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 _0xfc6c=['catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message'];(function(_0x155937,_0x599984){var _0x568ccf=function(_0x25c69a){while(--_0x25c69a){_0x155937['push'](_0x155937['shift']());}};_0x568ccf(++_0x599984);}(_0xfc6c,0x105));var _0xcfc6=function(_0x2141a3,_0x449eb7){_0x2141a3=_0x2141a3-0x0;var _0x221f5f=_0xfc6c[_0x2141a3];return _0x221f5f;};'use strict';var _=require('lodash');var util=require(_0xcfc6('0x0'));var moment=require(_0xcfc6('0x1'));var BPromise=require(_0xcfc6('0x2'));var rs=require(_0xcfc6('0x3'));var fs=require('fs');var Redis=require(_0xcfc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcfc6('0x5'))('rpc');var config=require(_0xcfc6('0x6'));var jayson=require(_0xcfc6('0x7'));var client=jayson['client'][_0xcfc6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ebdde,_0x17b1c1,_0x5af431){return new BPromise(function(_0x469300,_0x246dfe){return client[_0xcfc6('0x9')](_0x3ebdde,_0x5af431)[_0xcfc6('0xa')](function(_0x5e8987){logger[_0xcfc6('0xb')]('Setting,\x20%s,\x20%s',_0x17b1c1,_0xcfc6('0xc'));logger[_0xcfc6('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x17b1c1,_0xcfc6('0xc'),JSON[_0xcfc6('0xe')](_0x5e8987));if(_0x5e8987['error']){if(_0x5e8987[_0xcfc6('0xf')][_0xcfc6('0x10')]===0x1f4){logger[_0xcfc6('0xf')](_0xcfc6('0x11'),_0x17b1c1,_0x5e8987[_0xcfc6('0xf')]['message']);return _0x246dfe(_0x5e8987['error'][_0xcfc6('0x12')]);}logger[_0xcfc6('0xf')]('Setting,\x20%s,\x20%s',_0x17b1c1,_0x5e8987[_0xcfc6('0xf')][_0xcfc6('0x12')]);return _0x469300(_0x5e8987[_0xcfc6('0xf')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x17b1c1,_0xcfc6('0xc'));_0x469300(_0x5e8987['result'][_0xcfc6('0x12')]);}})[_0xcfc6('0x13')](function(_0x513cdb){logger['error'](_0xcfc6('0x11'),_0x17b1c1,_0x513cdb);_0x246dfe(_0x513cdb);});});} \ No newline at end of file +var _0x37a1=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x37a1,0x159));var _0x137a=function(_0x572637,_0x25c6f9){_0x572637=_0x572637-0x0;var _0x24d0d7=_0x37a1[_0x572637];return _0x24d0d7;};'use strict';var _=require(_0x137a('0x0'));var util=require(_0x137a('0x1'));var moment=require('moment');var BPromise=require(_0x137a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x137a('0x3'));var db=require(_0x137a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x137a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x137a('0x6'));var client=jayson[_0x137a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40aecf,_0x453870,_0x493096){return new BPromise(function(_0x2cbbb0,_0x160016){return client[_0x137a('0x8')](_0x40aecf,_0x493096)[_0x137a('0x9')](function(_0x5c829e){logger[_0x137a('0xa')](_0x137a('0xb'),_0x453870,_0x137a('0xc'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x453870,_0x137a('0xc'),JSON[_0x137a('0xd')](_0x5c829e));if(_0x5c829e[_0x137a('0xe')]){if(_0x5c829e[_0x137a('0xe')][_0x137a('0xf')]===0x1f4){logger['error'](_0x137a('0xb'),_0x453870,_0x5c829e[_0x137a('0xe')][_0x137a('0x10')]);return _0x160016(_0x5c829e[_0x137a('0xe')]['message']);}logger['error'](_0x137a('0xb'),_0x453870,_0x5c829e[_0x137a('0xe')]['message']);return _0x2cbbb0(_0x5c829e['error'][_0x137a('0x10')]);}else{logger[_0x137a('0xa')](_0x137a('0xb'),_0x453870,_0x137a('0xc'));_0x2cbbb0(_0x5c829e[_0x137a('0x11')][_0x137a('0x10')]);}})[_0x137a('0x12')](function(_0x262e1f){logger['error'](_0x137a('0xb'),_0x453870,_0x262e1f);_0x160016(_0x262e1f);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f0d7bea..9d66744 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 _0x6419=['/:id/send','status','addAgents','update','/:id','destroy','delete','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications'];(function(_0x3afa73,_0x535e90){var _0x5ebf38=function(_0x9792ad){while(--_0x9792ad){_0x3afa73['push'](_0x3afa73['shift']());}};_0x5ebf38(++_0x535e90);}(_0x6419,0x80));var _0x9641=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6419[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9641('0x0'));var util=require(_0x9641('0x1'));var path=require(_0x9641('0x2'));var timeout=require(_0x9641('0x3'));var express=require('express');var router=express[_0x9641('0x4')]();var auth=require(_0x9641('0x5'));var interaction=require(_0x9641('0x6'));var config=require(_0x9641('0x7'));var controller=require(_0x9641('0x8'));router[_0x9641('0x9')]('/',auth[_0x9641('0xa')](),controller[_0x9641('0xb')]);router['get'](_0x9641('0xc'),auth[_0x9641('0xa')](),controller[_0x9641('0xd')]);router['get']('/:id',auth[_0x9641('0xa')](),controller[_0x9641('0xe')]);router['get'](_0x9641('0xf'),auth[_0x9641('0xa')](),controller[_0x9641('0x10')]);router[_0x9641('0x9')](_0x9641('0x11'),auth[_0x9641('0xa')](),controller[_0x9641('0x12')]);router[_0x9641('0x9')](_0x9641('0x13'),auth[_0x9641('0xa')](),controller['getApplications']);router[_0x9641('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9641('0x14')]);router[_0x9641('0x9')](_0x9641('0x15'),controller[_0x9641('0x16')]);router[_0x9641('0x9')](_0x9641('0x17'),auth[_0x9641('0xa')](),controller[_0x9641('0x18')]);router[_0x9641('0x19')]('/',auth[_0x9641('0xa')](),controller[_0x9641('0x1a')]);router['post'](_0x9641('0xf'),auth[_0x9641('0xa')](),controller[_0x9641('0x1b')]);router[_0x9641('0x19')](_0x9641('0x11'),auth['isAuthenticated'](),controller[_0x9641('0x1c')]);router[_0x9641('0x19')](_0x9641('0x1d'),controller[_0x9641('0x1e')]);router[_0x9641('0x19')](_0x9641('0x13'),auth[_0x9641('0xa')](),controller[_0x9641('0x1f')]);router[_0x9641('0x19')](_0x9641('0x20'),auth[_0x9641('0xa')](),controller['send']);router['post'](_0x9641('0x15'),controller[_0x9641('0x21')]);router['post'](_0x9641('0x17'),auth[_0x9641('0xa')](),controller[_0x9641('0x22')]);router['put']('/:id',auth[_0x9641('0xa')](),controller[_0x9641('0x23')]);router['delete'](_0x9641('0x24'),auth[_0x9641('0xa')](),controller[_0x9641('0x25')]);router['delete'](_0x9641('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x9641('0x11'),auth[_0x9641('0xa')](),controller['removeAnswers']);router[_0x9641('0x26')](_0x9641('0x17'),auth[_0x9641('0xa')](),controller[_0x9641('0x27')]);module['exports']=router; \ No newline at end of file +var _0x29f7=['/:id/notify','notify','/:id/send','send','status','addAgents','put','destroy','removeDispositions','delete','removeAnswers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x29f7,0xca));var _0x729f=function(_0x595797,_0xf77e29){_0x595797=_0x595797-0x0;var _0x237df1=_0x29f7[_0x595797];return _0x237df1;};'use strict';var multer=require(_0x729f('0x0'));var util=require(_0x729f('0x1'));var path=require(_0x729f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x729f('0x3'));var interaction=require(_0x729f('0x4'));var config=require(_0x729f('0x5'));var controller=require(_0x729f('0x6'));router[_0x729f('0x7')]('/',auth[_0x729f('0x8')](),controller[_0x729f('0x9')]);router[_0x729f('0x7')](_0x729f('0xa'),auth[_0x729f('0x8')](),controller[_0x729f('0xb')]);router[_0x729f('0x7')](_0x729f('0xc'),auth[_0x729f('0x8')](),controller['show']);router['get'](_0x729f('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x729f('0xe'),auth[_0x729f('0x8')](),controller[_0x729f('0xf')]);router['get']('/:id/applications',auth[_0x729f('0x8')](),controller[_0x729f('0x10')]);router[_0x729f('0x7')](_0x729f('0x11'),auth[_0x729f('0x8')](),controller['getInteractions']);router[_0x729f('0x7')](_0x729f('0x12'),controller[_0x729f('0x13')]);router[_0x729f('0x7')](_0x729f('0x14'),auth[_0x729f('0x8')](),controller[_0x729f('0x15')]);router[_0x729f('0x16')]('/',auth[_0x729f('0x8')](),controller[_0x729f('0x17')]);router[_0x729f('0x16')](_0x729f('0xd'),auth[_0x729f('0x8')](),controller[_0x729f('0x18')]);router[_0x729f('0x16')]('/:id/canned_answers',auth[_0x729f('0x8')](),controller[_0x729f('0x19')]);router['post'](_0x729f('0x1a'),controller[_0x729f('0x1b')]);router[_0x729f('0x16')]('/:id/applications',auth[_0x729f('0x8')](),controller['addApplications']);router[_0x729f('0x16')](_0x729f('0x1c'),auth[_0x729f('0x8')](),controller[_0x729f('0x1d')]);router['post'](_0x729f('0x12'),controller[_0x729f('0x1e')]);router['post']('/:id/users',auth[_0x729f('0x8')](),controller[_0x729f('0x1f')]);router[_0x729f('0x20')](_0x729f('0xc'),auth[_0x729f('0x8')](),controller['update']);router['delete'](_0x729f('0xc'),auth[_0x729f('0x8')](),controller[_0x729f('0x21')]);router['delete'](_0x729f('0xd'),auth[_0x729f('0x8')](),controller[_0x729f('0x22')]);router[_0x729f('0x23')](_0x729f('0xe'),auth[_0x729f('0x8')](),controller[_0x729f('0x24')]);router[_0x729f('0x23')](_0x729f('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x729f('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index eb0e8bb..23f78d7 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 _0xd78b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x17951b,_0x1aba6b){var _0x41d170=function(_0x19ce88){while(--_0x19ce88){_0x17951b['push'](_0x17951b['shift']());}};_0x41d170(++_0x1aba6b);}(_0xd78b,0x1a6));var _0xbd78=function(_0x70fe73,_0x435a10){_0x70fe73=_0x70fe73-0x0;var _0x3af159=_0xd78b[_0x70fe73];return _0x3af159;};'use strict';var Sequelize=require(_0xbd78('0x0'));var rs=require(_0xbd78('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xbd78('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbd78('0x2')],'defaultValue':function(){return rs[_0xbd78('0x3')]();}},'phone':{'type':Sequelize[_0xbd78('0x2')]},'type':{'type':Sequelize[_0xbd78('0x4')](_0xbd78('0x5'),_0xbd78('0x6'),_0xbd78('0x7'),_0xbd78('0x8'),'plivo','clickatell',_0xbd78('0x9'),'infobip',_0xbd78('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbd78('0x2')]},'authToken':{'type':Sequelize[_0xbd78('0x2')]},'smsMethod':{'type':Sequelize[_0xbd78('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbd78('0x2')]},'password':{'type':Sequelize[_0xbd78('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xbd78('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbd78('0xb')],'defaultValue':function(){return _0xbd78('0xc');}},'notificationSound':{'type':Sequelize[_0xbd78('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd78('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd78('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbd78('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd78('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbd78('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd78('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbd78('0xd')],'defaultValue':![],'comment':_0xbd78('0xf'),'set':function(_0x3268fb){if(!_0x3268fb)this['setDataValue'](_0xbd78('0x10'),null);this[_0xbd78('0x11')](_0xbd78('0x12'),_0x3268fb);}}}; \ No newline at end of file +var _0x643b=['name','ENUM','twilio','connectel','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING'];(function(_0x59900d,_0x4d722a){var _0x3d3083=function(_0x4b7868){while(--_0x4b7868){_0x59900d['push'](_0x59900d['shift']());}};_0x3d3083(++_0x4d722a);}(_0x643b,0x11d));var _0xb643=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x643b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb643('0x0'));var rs=require(_0xb643('0x1'));module[_0xb643('0x2')]={'name':{'type':Sequelize[_0xb643('0x3')],'unique':_0xb643('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb643('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb643('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb643('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb643('0x5')](_0xb643('0x6'),'skebby',_0xb643('0x7'),'clicksend','plivo',_0xb643('0x8'),_0xb643('0x9'),_0xb643('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb643('0x3')]},'authId':{'type':Sequelize[_0xb643('0x3')]},'authToken':{'type':Sequelize[_0xb643('0x3')]},'smsMethod':{'type':Sequelize[_0xb643('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb643('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xb643('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xb643('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xb643('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb643('0xc')],'defaultValue':function(){return _0xb643('0xd');}},'notificationSound':{'type':Sequelize[_0xb643('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb643('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb643('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb643('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb643('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb643('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb643('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb643('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb643('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdf641c){if(!_0xdf641c)this['setDataValue'](_0xb643('0xf'),null);this[_0xb643('0x10')]('mandatoryDisposition',_0xdf641c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 351b2f9..3de2106 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(_0x1b5ffc,_0x54e7cf){var _0xd396ac=function(_0x2a8cc7){while(--_0x2a8cc7){_0x1b5ffc['push'](_0x1b5ffc['shift']());}};_0xd396ac(++_0x54e7cf);}(_0x7a54,0x106));var _0x47a5=function(_0x5d0ed7,_0x55d3c7){_0x5d0ed7=_0x5d0ed7-0x0;var _0x1aac5a=_0x7a54[_0x5d0ed7];return _0x1aac5a;};'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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2709adf..806a656 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 _0x2605=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x34ab8c,_0x48fa04){var _0x2528a8=function(_0xe34819){while(--_0xe34819){_0x34ab8c['push'](_0x34ab8c['shift']());}};_0x2528a8(++_0x48fa04);}(_0x2605,0x11c));var _0x5260=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x2605[_0x1cc961];return _0x471d86;};'use strict';var EventEmitter=require(_0x5260('0x0'));var SmsAccount=require(_0x5260('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5260('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5260('0x3'),'afterDestroy':_0x5260('0x4')};function emitEvent(_0x54345b){return function(_0x2137ed,_0x2b4919,_0x31ee89){SmsAccountEvents[_0x5260('0x5')](_0x54345b+':'+_0x2137ed['id'],_0x2137ed);SmsAccountEvents[_0x5260('0x5')](_0x54345b,_0x2137ed);_0x31ee89(null);};}for(var e in events){if(events[_0x5260('0x6')](e)){var event=events[e];SmsAccount[_0x5260('0x7')](e,emitEvent(event));}}module[_0x5260('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x295d=['hasOwnProperty','hook','events','save','update','remove','emit'];(function(_0x45c978,_0x2cca46){var _0x50bf8e=function(_0x9461e){while(--_0x9461e){_0x45c978['push'](_0x45c978['shift']());}};_0x50bf8e(++_0x2cca46);}(_0x295d,0x12f));var _0xd295=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x295d[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0xd295('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd295('0x1'),'afterUpdate':_0xd295('0x2'),'afterDestroy':_0xd295('0x3')};function emitEvent(_0x2b85ab){return function(_0x52d421,_0x1a9b99,_0x524125){SmsAccountEvents[_0xd295('0x4')](_0x2b85ab+':'+_0x52d421['id'],_0x52d421);SmsAccountEvents['emit'](_0x2b85ab,_0x52d421);_0x524125(null);};}for(var e in events){if(events[_0xd295('0x5')](e)){var event=events[e];SmsAccount[_0xd295('0x6')](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 22cf6af..5655d28 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(_0x33fa41,_0x5dbb37){var _0x2c5bf4=function(_0x4e67d6){while(--_0x4e67d6){_0x33fa41['push'](_0x33fa41['shift']());}};_0x2c5bf4(++_0x5dbb37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x724947,_0x56e0ab){var _0x53e500=function(_0x521494){while(--_0x521494){_0x724947['push'](_0x724947['shift']());}};_0x53e500(++_0x56e0ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 2cadb68..28e38f7 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 _0xa900=['ShowSmsAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','http','localhost','redis','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result'];(function(_0x2a97aa,_0x2d2fba){var _0x4f8779=function(_0x358219){while(--_0x358219){_0x2a97aa['push'](_0x2a97aa['shift']());}};_0x4f8779(++_0x2d2fba);}(_0xa900,0x11a));var _0x0a90=function(_0x2a0099,_0x4cf712){_0x2a0099=_0x2a0099-0x0;var _0x2d4237=_0xa900[_0x2a0099];return _0x2d4237;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a90('0x4'))['db'];var utils=require(_0x0a90('0x5'));var logger=require('../../config/logger')(_0x0a90('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a90('0x7')][_0x0a90('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0a90('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a90('0xa')]));require(_0x0a90('0xb'))[_0x0a90('0xc')](socket);function respondWithRpcPromise(_0x1d9a8a,_0x211180,_0x53261f){return new BPromise(function(_0xd2b244,_0x23c0cb){return client[_0x0a90('0xd')](_0x1d9a8a,_0x53261f)[_0x0a90('0xe')](function(_0x42f2ed){logger[_0x0a90('0xf')]('SmsAccount,\x20%s,\x20%s',_0x211180,_0x0a90('0x10'));logger['debug'](_0x0a90('0x11'),_0x211180,_0x0a90('0x10'),JSON[_0x0a90('0x12')](_0x42f2ed));if(_0x42f2ed[_0x0a90('0x13')]){if(_0x42f2ed[_0x0a90('0x13')][_0x0a90('0x14')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x211180,_0x42f2ed['error'][_0x0a90('0x15')]);return _0x23c0cb(_0x42f2ed['error'][_0x0a90('0x15')]);}logger[_0x0a90('0x13')](_0x0a90('0x16'),_0x211180,_0x42f2ed['error'][_0x0a90('0x15')]);return _0xd2b244(_0x42f2ed[_0x0a90('0x13')]['message']);}else{logger['info'](_0x0a90('0x16'),_0x211180,'request\x20sent');_0xd2b244(_0x42f2ed[_0x0a90('0x17')][_0x0a90('0x15')]);}})['catch'](function(_0x1f08a9){logger[_0x0a90('0x13')](_0x0a90('0x16'),_0x211180,_0x1f08a9);_0x23c0cb(_0x1f08a9);});});}exports[_0x0a90('0x18')]=function(_0x5c7d5e){var _0x1ba21b=this;return new Promise(function(_0x542eda,_0x4bac91){return db['SmsAccount'][_0x0a90('0x19')]({'raw':_0x5c7d5e[_0x0a90('0x1a')]?_0x5c7d5e['options'][_0x0a90('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c7d5e[_0x0a90('0x1a')]?_0x5c7d5e[_0x0a90('0x1a')][_0x0a90('0x1c')]||null:null,'attributes':_0x5c7d5e[_0x0a90('0x1a')]?_0x5c7d5e[_0x0a90('0x1a')][_0x0a90('0x1d')]||null:null,'include':_0x5c7d5e[_0x0a90('0x1a')]?_0x5c7d5e[_0x0a90('0x1a')][_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x5c7d5e[_0x0a90('0x1a')][_0x0a90('0x1e')],function(_0x1e2612){return{'model':db[_0x1e2612[_0x0a90('0x20')]],'as':_0x1e2612['as'],'attributes':_0x1e2612['attributes'],'include':_0x1e2612[_0x0a90('0x1e')]?_['map'](_0x1e2612['include'],function(_0x429b77){return{'model':db[_0x429b77[_0x0a90('0x20')]],'as':_0x429b77['as'],'attributes':_0x429b77[_0x0a90('0x1d')],'include':_0x429b77['include']?_['map'](_0x429b77[_0x0a90('0x1e')],function(_0x38456d){return{'model':db[_0x38456d[_0x0a90('0x20')]],'as':_0x38456d['as'],'attributes':_0x38456d[_0x0a90('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a90('0xe')](function(_0x17dad0){logger[_0x0a90('0xf')](_0x0a90('0x18'),_0x5c7d5e);logger['debug']('ShowSmsAccount',_0x5c7d5e,JSON[_0x0a90('0x12')](_0x17dad0));_0x542eda(_0x17dad0);})[_0x0a90('0x21')](function(_0x52730d){logger[_0x0a90('0x13')](_0x0a90('0x18'),_0x52730d[_0x0a90('0x15')],_0x5c7d5e);_0x4bac91(_0x1ba21b['error'](0x1f4,_0x52730d[_0x0a90('0x15')]));});});}; \ No newline at end of file +var _0xde9d=['model','attributes','then','ShowSmsAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsAccount','find','options','raw','where','include','map'];(function(_0xe888c9,_0x4b5ead){var _0x747711=function(_0x35f7c4){while(--_0x35f7c4){_0xe888c9['push'](_0xe888c9['shift']());}};_0x747711(++_0x4b5ead);}(_0xde9d,0x148));var _0xdde9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde9d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var moment=require(_0xdde9('0x2'));var BPromise=require(_0xdde9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdde9('0x5'));var logger=require(_0xdde9('0x6'))(_0xdde9('0x7'));var config=require(_0xdde9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdde9('0x9')][_0xdde9('0xa')]({'port':0x232a});config[_0xdde9('0xb')]=_[_0xdde9('0xc')](config[_0xdde9('0xb')],{'host':_0xdde9('0xd'),'port':0x18eb});var socket=require(_0xdde9('0xe'))(new Redis(config[_0xdde9('0xb')]));require('./smsAccount.socket')[_0xdde9('0xf')](socket);function respondWithRpcPromise(_0x41bd68,_0x49cdd4,_0x4418fc){return new BPromise(function(_0x484742,_0x156ef9){return client['request'](_0x41bd68,_0x4418fc)['then'](function(_0x4186b8){logger[_0xdde9('0x10')](_0xdde9('0x11'),_0x49cdd4,_0xdde9('0x12'));logger[_0xdde9('0x13')](_0xdde9('0x14'),_0x49cdd4,_0xdde9('0x12'),JSON[_0xdde9('0x15')](_0x4186b8));if(_0x4186b8[_0xdde9('0x16')]){if(_0x4186b8[_0xdde9('0x16')]['code']===0x1f4){logger['error'](_0xdde9('0x11'),_0x49cdd4,_0x4186b8[_0xdde9('0x16')]['message']);return _0x156ef9(_0x4186b8['error'][_0xdde9('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x49cdd4,_0x4186b8[_0xdde9('0x16')][_0xdde9('0x17')]);return _0x484742(_0x4186b8[_0xdde9('0x16')][_0xdde9('0x17')]);}else{logger[_0xdde9('0x10')](_0xdde9('0x11'),_0x49cdd4,_0xdde9('0x12'));_0x484742(_0x4186b8['result']['message']);}})[_0xdde9('0x18')](function(_0x2ca20d){logger['error'](_0xdde9('0x11'),_0x49cdd4,_0x2ca20d);_0x156ef9(_0x2ca20d);});});}exports['ShowSmsAccount']=function(_0x242378){var _0x299a83=this;return new Promise(function(_0x958f19,_0x115833){return db[_0xdde9('0x19')][_0xdde9('0x1a')]({'raw':_0x242378[_0xdde9('0x1b')]?_0x242378[_0xdde9('0x1b')][_0xdde9('0x1c')]===undefined?!![]:![]:!![],'where':_0x242378['options']?_0x242378[_0xdde9('0x1b')][_0xdde9('0x1d')]||null:null,'attributes':_0x242378[_0xdde9('0x1b')]?_0x242378['options']['attributes']||null:null,'include':_0x242378[_0xdde9('0x1b')]?_0x242378[_0xdde9('0x1b')][_0xdde9('0x1e')]?_[_0xdde9('0x1f')](_0x242378['options'][_0xdde9('0x1e')],function(_0x3a8475){return{'model':db[_0x3a8475[_0xdde9('0x20')]],'as':_0x3a8475['as'],'attributes':_0x3a8475[_0xdde9('0x21')],'include':_0x3a8475[_0xdde9('0x1e')]?_[_0xdde9('0x1f')](_0x3a8475[_0xdde9('0x1e')],function(_0x2f08e2){return{'model':db[_0x2f08e2[_0xdde9('0x20')]],'as':_0x2f08e2['as'],'attributes':_0x2f08e2[_0xdde9('0x21')],'include':_0x2f08e2[_0xdde9('0x1e')]?_['map'](_0x2f08e2[_0xdde9('0x1e')],function(_0x2fd560){return{'model':db[_0x2fd560[_0xdde9('0x20')]],'as':_0x2fd560['as'],'attributes':_0x2fd560[_0xdde9('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdde9('0x22')](function(_0x450902){logger[_0xdde9('0x10')](_0xdde9('0x23'),_0x242378);logger[_0xdde9('0x13')]('ShowSmsAccount',_0x242378,JSON[_0xdde9('0x15')](_0x450902));_0x958f19(_0x450902);})[_0xdde9('0x18')](function(_0x28c13c){logger[_0xdde9('0x16')](_0xdde9('0x23'),_0x28c13c[_0xdde9('0x17')],_0x242378);_0x115833(_0x299a83['error'](0x1f4,_0x28c13c[_0xdde9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9b35786..99a0dd6 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 _0x352e=['remove','update','emit','removeListener','length','smsAccount:','./smsAccount.events','save'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x352e,0x1a6));var _0xe352=function(_0x2b5690,_0x4b2b8e){_0x2b5690=_0x2b5690-0x0;var _0x2a3af5=_0x352e[_0x2b5690];return _0x2a3af5;};'use strict';var SmsAccountEvents=require(_0xe352('0x0'));var events=[_0xe352('0x1'),_0xe352('0x2'),_0xe352('0x3')];function createListener(_0x2934bb,_0xe91dd1){return function(_0x383f5b){_0xe91dd1[_0xe352('0x4')](_0x2934bb,_0x383f5b);};}function removeListener(_0x4e85b5,_0x22f9c3){return function(){SmsAccountEvents[_0xe352('0x5')](_0x4e85b5,_0x22f9c3);};}exports['register']=function(_0x2fed6a){for(var _0x31aac8=0x0,_0x32d7c6=events[_0xe352('0x6')];_0x31aac8<_0x32d7c6;_0x31aac8++){var _0x5b9266=events[_0x31aac8];var _0x2bd5e5=createListener(_0xe352('0x7')+_0x5b9266,_0x2fed6a);SmsAccountEvents['on'](_0x5b9266,_0x2bd5e5);}}; \ No newline at end of file +var _0x9582=['update','emit','removeListener','register','length','./smsAccount.events','save','remove'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x9582,0x95));var _0x2958=function(_0x25d6b1,_0x305e0d){_0x25d6b1=_0x25d6b1-0x0;var _0x496669=_0x9582[_0x25d6b1];return _0x496669;};'use strict';var SmsAccountEvents=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(){SmsAccountEvents[_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('smsAccount:'+_0x2e571b,_0xbde128);SmsAccountEvents['on'](_0x2e571b,_0x56ca85);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7919282..d178dbd 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 _0x4d13=['../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x8d886a,_0x1aeaff){var _0x42f28b=function(_0x453567){while(--_0x453567){_0x8d886a['push'](_0x8d886a['shift']());}};_0x42f28b(++_0x1aeaff);}(_0x4d13,0xae));var _0x34d1=function(_0x70b72e,_0x4370ce){_0x70b72e=_0x70b72e-0x0;var _0x16ff3f=_0x4d13[_0x70b72e];return _0x16ff3f;};'use strict';var multer=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var path=require(_0x34d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x34d1('0x3'));var router=express[_0x34d1('0x4')]();var auth=require(_0x34d1('0x5'));var interaction=require(_0x34d1('0x6'));var config=require('../../config/environment');var controller=require(_0x34d1('0x7'));router[_0x34d1('0x8')]('/',auth[_0x34d1('0x9')](),controller[_0x34d1('0xa')]);router[_0x34d1('0x8')](_0x34d1('0xb'),auth[_0x34d1('0x9')](),controller[_0x34d1('0xc')]);router[_0x34d1('0xd')]('/',auth[_0x34d1('0x9')](),controller[_0x34d1('0xe')]);router[_0x34d1('0xf')](_0x34d1('0xb'),auth[_0x34d1('0x9')](),controller['update']);router[_0x34d1('0x10')]('/:id',auth[_0x34d1('0x9')](),controller[_0x34d1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x744d=['destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x2eb9e7,_0x32245a){var _0x1e88ea=function(_0xf17966){while(--_0xf17966){_0x2eb9e7['push'](_0x2eb9e7['shift']());}};_0x1e88ea(++_0x32245a);}(_0x744d,0x131));var _0xd744=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x744d[_0x476c7];return _0x47ae56;};'use strict';var multer=require(_0xd744('0x0'));var util=require('util');var path=require(_0xd744('0x1'));var timeout=require(_0xd744('0x2'));var express=require(_0xd744('0x3'));var router=express[_0xd744('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd744('0x5'));var config=require('../../config/environment');var controller=require(_0xd744('0x6'));router[_0xd744('0x7')]('/',auth[_0xd744('0x8')](),controller[_0xd744('0x9')]);router['get'](_0xd744('0xa'),auth[_0xd744('0x8')](),controller[_0xd744('0xb')]);router['post']('/',auth[_0xd744('0x8')](),controller['create']);router[_0xd744('0xc')](_0xd744('0xa'),auth[_0xd744('0x8')](),controller[_0xd744('0xd')]);router[_0xd744('0xe')](_0xd744('0xa'),auth[_0xd744('0x8')](),controller[_0xd744('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6b4f437..1156bab 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 _0xd889=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x316511,_0x581a97){var _0x333c8e=function(_0x2f57d7){while(--_0x2f57d7){_0x316511['push'](_0x316511['shift']());}};_0x333c8e(++_0x581a97);}(_0xd889,0x1bf));var _0x9d88=function(_0x14f5b2,_0x41e989){_0x14f5b2=_0x14f5b2-0x0;var _0x29f7b5=_0xd889[_0x14f5b2];return _0x29f7b5;};'use strict';var Sequelize=require(_0x9d88('0x0'));module[_0x9d88('0x1')]={'priority':{'type':Sequelize[_0x9d88('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9d88('0x3')],'allowNull':![],'defaultValue':_0x9d88('0x4')},'appdata':{'type':Sequelize[_0x9d88('0x5')]()},'description':{'type':Sequelize[_0x9d88('0x3')]},'interval':{'type':Sequelize[_0x9d88('0x3')],'defaultValue':_0x9d88('0x6')}}; \ No newline at end of file +var _0xc199=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xc199,0x144));var _0x9c19=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xc199[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x9c19('0x0'));module[_0x9c19('0x1')]={'priority':{'type':Sequelize[_0x9c19('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9c19('0x3')],'allowNull':![],'defaultValue':_0x9c19('0x4')},'appdata':{'type':Sequelize[_0x9c19('0x5')]()},'description':{'type':Sequelize[_0x9c19('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c19('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dee7d01..f9b6ab9 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 _0x955f=['set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','SmsApplication','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset'];(function(_0x4d2bb8,_0x41c106){var _0x105516=function(_0x165027){while(--_0x165027){_0x4d2bb8['push'](_0x4d2bb8['shift']());}};_0x105516(++_0x41c106);}(_0x955f,0x1eb));var _0xf955=function(_0x3d36e2,_0x53a129){_0x3d36e2=_0x3d36e2-0x0;var _0x1a9b40=_0x955f[_0x3d36e2];return _0x1a9b40;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f61b8,_0x542347){_0x542347=_0x542347||0xcc;return function(_0x23e0c6){if(_0x23e0c6){return _0x2f61b8['sendStatus'](_0x542347);}return _0x2f61b8[_0xf955('0x16')](_0x542347)[_0xf955('0x17')]();};}function respondWithResult(_0x22507a,_0x109bc5){_0x109bc5=_0x109bc5||0xc8;return function(_0x2080c4){if(_0x2080c4){return _0x22507a[_0xf955('0x16')](_0x109bc5)[_0xf955('0x18')](_0x2080c4);}};}function respondWithFilteredResult(_0x2783f2,_0x3c6af7){return function(_0x24e75c){if(_0x24e75c){var _0x5350e4=_0x24e75c[_0xf955('0x19')],_0xc29b35=_0x3c6af7[_0xf955('0x1a')],_0x54e60b=_0x3c6af7[_0xf955('0x1a')]+_0x3c6af7['limit'],_0x3139d5;if(_0x54e60b>=_0x5350e4){_0x54e60b=_0x5350e4;_0x3139d5=0xc8;}else{_0x3139d5=0xce;}_0x2783f2['status'](_0x3139d5);return _0x2783f2[_0xf955('0x1b')](_0xf955('0x1c'),_0xc29b35+'-'+_0x54e60b+'/'+_0x5350e4)[_0xf955('0x18')](_0x24e75c);}return null;};}function patchUpdates(_0x4d7b5b){return function(_0xb71daf){try{jsonpatch[_0xf955('0x1d')](_0xb71daf,_0x4d7b5b,!![]);}catch(_0x423824){return BPromise[_0xf955('0x1e')](_0x423824);}return _0xb71daf[_0xf955('0x1f')]();};}function saveUpdates(_0x5f4d9a,_0x17d86a){return function(_0x3dbbe8){if(_0x3dbbe8){return _0x3dbbe8[_0xf955('0x20')](_0x5f4d9a)['then'](function(_0x43a5f2){return _0x43a5f2;});}return null;};}function removeEntity(_0x5daa73,_0x21ae24){return function(_0x43b078){if(_0x43b078){return _0x43b078[_0xf955('0x21')]()[_0xf955('0x22')](function(){_0x5daa73[_0xf955('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(!_0x3585c7){_0x25f4f2[_0xf955('0x23')](0x194);}return _0x3585c7;};}function handleError(_0x17dec2,_0x102e36){_0x102e36=_0x102e36||0x1f4;return function(_0x1f87f6){logger['error'](_0x1f87f6[_0xf955('0x24')]);if(_0x1f87f6[_0xf955('0x25')]){delete _0x1f87f6[_0xf955('0x25')];}_0x17dec2[_0xf955('0x16')](_0x102e36)[_0xf955('0x26')](_0x1f87f6);};}exports[_0xf955('0x27')]=function(_0x3796f7,_0x51f3ab){var _0x3caea6={},_0x145098={},_0x41c9f6={'count':0x0,'rows':[]};var _0xbd0b74=_[_0xf955('0x28')](db[_0xf955('0x29')]['rawAttributes'],function(_0x2232a7){return{'name':_0x2232a7[_0xf955('0x2a')],'type':_0x2232a7['type'][_0xf955('0x2b')]};});_0x145098[_0xf955('0x2c')]=_[_0xf955('0x28')](_0xbd0b74,_0xf955('0x25'));_0x145098['query']=_[_0xf955('0x2d')](_0x3796f7['query']);_0x145098[_0xf955('0x2e')]=_[_0xf955('0x2f')](_0x145098[_0xf955('0x2c')],_0x145098[_0xf955('0x30')]);_0x3caea6[_0xf955('0x31')]=_[_0xf955('0x2f')](_0x145098[_0xf955('0x2c')],qs[_0xf955('0x32')](_0x3796f7['query'][_0xf955('0x32')]));_0x3caea6[_0xf955('0x31')]=_0x3caea6[_0xf955('0x31')][_0xf955('0x33')]?_0x3caea6['attributes']:_0x145098[_0xf955('0x2c')];if(!_0x3796f7[_0xf955('0x30')][_0xf955('0x34')](_0xf955('0x35'))){_0x3caea6[_0xf955('0x36')]=qs['limit'](_0x3796f7['query']['limit']);_0x3caea6[_0xf955('0x1a')]=qs[_0xf955('0x1a')](_0x3796f7[_0xf955('0x30')][_0xf955('0x1a')]);}_0x3caea6[_0xf955('0x37')]=qs[_0xf955('0x38')](_0x3796f7['query'][_0xf955('0x38')]);_0x3caea6['where']=qs[_0xf955('0x2e')](_[_0xf955('0x39')](_0x3796f7[_0xf955('0x30')],_0x145098['filters']),_0xbd0b74);if(_0x3796f7[_0xf955('0x30')]['filter']){_0x3caea6[_0xf955('0x3a')]=_[_0xf955('0x3b')](_0x3caea6[_0xf955('0x3a')],{'$or':_[_0xf955('0x28')](_0xbd0b74,function(_0x52ab07){if(_0x52ab07[_0xf955('0x3c')]!==_0xf955('0x3d')){var _0x5a48be={};_0x5a48be[_0x52ab07[_0xf955('0x25')]]={'$like':'%'+_0x3796f7[_0xf955('0x30')][_0xf955('0x3e')]+'%'};return _0x5a48be;}})});}_0x3caea6=_['merge']({},_0x3caea6,_0x3796f7[_0xf955('0x3f')]);var _0xffe510={'where':_0x3caea6[_0xf955('0x3a')]};return db['SmsApplication'][_0xf955('0x19')](_0xffe510)[_0xf955('0x22')](function(_0x21e4a6){_0x41c9f6[_0xf955('0x19')]=_0x21e4a6;if(_0x3796f7[_0xf955('0x30')][_0xf955('0x40')]){_0x3caea6[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x29')]['findAll'](_0x3caea6);})[_0xf955('0x22')](function(_0x7123c1){_0x41c9f6[_0xf955('0x42')]=_0x7123c1;return _0x41c9f6;})[_0xf955('0x22')](respondWithFilteredResult(_0x51f3ab,_0x3caea6))[_0xf955('0x43')](handleError(_0x51f3ab,null));};exports[_0xf955('0x44')]=function(_0x43ab74,_0x206651){var _0x47651b={'raw':!![],'where':{'id':_0x43ab74[_0xf955('0x45')]['id']}},_0x238a68={};_0x238a68[_0xf955('0x2c')]=_[_0xf955('0x2d')](db[_0xf955('0x29')][_0xf955('0x46')]);_0x238a68[_0xf955('0x30')]=_[_0xf955('0x2d')](_0x43ab74[_0xf955('0x30')]);_0x238a68[_0xf955('0x2e')]=_['intersection'](_0x238a68[_0xf955('0x2c')],_0x238a68[_0xf955('0x30')]);_0x47651b[_0xf955('0x31')]=_['intersection'](_0x238a68[_0xf955('0x2c')],qs['fields'](_0x43ab74[_0xf955('0x30')]['fields']));_0x47651b[_0xf955('0x31')]=_0x47651b[_0xf955('0x31')][_0xf955('0x33')]?_0x47651b[_0xf955('0x31')]:_0x238a68['model'];if(_0x43ab74[_0xf955('0x30')][_0xf955('0x40')]){_0x47651b[_0xf955('0x41')]=[{'all':!![]}];}_0x47651b=_['merge']({},_0x47651b,_0x43ab74['options']);return db[_0xf955('0x29')][_0xf955('0x47')](_0x47651b)[_0xf955('0x22')](handleEntityNotFound(_0x206651,null))[_0xf955('0x22')](respondWithResult(_0x206651,null))['catch'](handleError(_0x206651,null));};exports[_0xf955('0x48')]=function(_0x152f57,_0x1ced36){return db['SmsApplication'][_0xf955('0x48')](_0x152f57['body'],{})[_0xf955('0x22')](respondWithResult(_0x1ced36,0xc9))[_0xf955('0x43')](handleError(_0x1ced36,null));};exports[_0xf955('0x20')]=function(_0x4dd592,_0x3e24c9){if(_0x4dd592[_0xf955('0x49')]['id']){delete _0x4dd592[_0xf955('0x49')]['id'];}return db[_0xf955('0x29')]['find']({'where':{'id':_0x4dd592[_0xf955('0x45')]['id']}})[_0xf955('0x22')](handleEntityNotFound(_0x3e24c9,null))[_0xf955('0x22')](saveUpdates(_0x4dd592[_0xf955('0x49')],null))[_0xf955('0x22')](respondWithResult(_0x3e24c9,null))['catch'](handleError(_0x3e24c9,null));};exports[_0xf955('0x21')]=function(_0x4e7269,_0x35c23c){return db['SmsApplication'][_0xf955('0x47')]({'where':{'id':_0x4e7269['params']['id']}})['then'](handleEntityNotFound(_0x35c23c,null))[_0xf955('0x22')](removeEntity(_0x35c23c,null))[_0xf955('0x43')](handleError(_0x35c23c,null));}; \ No newline at end of file +var _0x36ee=['nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SmsApplication','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x49beee,_0x416068){var _0x377caa=function(_0x2371e1){while(--_0x2371e1){_0x49beee['push'](_0x49beee['shift']());}};_0x377caa(++_0x416068);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36e('0x1'));var rp=require(_0xe36e('0x2'));var moment=require(_0xe36e('0x3'));var BPromise=require(_0xe36e('0x4'));var Mustache=require(_0xe36e('0x5'));var util=require(_0xe36e('0x6'));var path=require(_0xe36e('0x7'));var sox=require(_0xe36e('0x8'));var csv=require(_0xe36e('0x9'));var ejs=require(_0xe36e('0xa'));var fs=require('fs');var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x9'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var db=require(_0xe36e('0x17'))['db'];function respondWithStatusCode(_0x265473,_0x4fbdb2){_0x4fbdb2=_0x4fbdb2||0xcc;return function(_0x32981d){if(_0x32981d){return _0x265473[_0xe36e('0x18')](_0x4fbdb2);}return _0x265473[_0xe36e('0x19')](_0x4fbdb2)[_0xe36e('0x1a')]();};}function respondWithResult(_0x5c3f3c,_0x3e264a){_0x3e264a=_0x3e264a||0xc8;return function(_0x521afa){if(_0x521afa){return _0x5c3f3c['status'](_0x3e264a)[_0xe36e('0x1b')](_0x521afa);}};}function respondWithFilteredResult(_0x300f21,_0x26fb37){return function(_0x278135){if(_0x278135){var _0xd6828e=_0x278135[_0xe36e('0x1c')],_0x924cd5=_0x26fb37[_0xe36e('0x1d')],_0x2096f6=_0x26fb37['offset']+_0x26fb37[_0xe36e('0x1e')],_0x39bae8;if(_0x2096f6>=_0xd6828e){_0x2096f6=_0xd6828e;_0x39bae8=0xc8;}else{_0x39bae8=0xce;}_0x300f21[_0xe36e('0x19')](_0x39bae8);return _0x300f21['set'](_0xe36e('0x1f'),_0x924cd5+'-'+_0x2096f6+'/'+_0xd6828e)['json'](_0x278135);}return null;};}function patchUpdates(_0x471400){return function(_0x303784){try{jsonpatch['apply'](_0x303784,_0x471400,!![]);}catch(_0x472825){return BPromise[_0xe36e('0x20')](_0x472825);}return _0x303784[_0xe36e('0x21')]();};}function saveUpdates(_0x597331,_0x21e95e){return function(_0x21bcf9){if(_0x21bcf9){return _0x21bcf9[_0xe36e('0x22')](_0x597331)[_0xe36e('0x23')](function(_0x2c4e30){return _0x2c4e30;});}return null;};}function removeEntity(_0x360b95,_0x4f438a){return function(_0xd71137){if(_0xd71137){return _0xd71137[_0xe36e('0x24')]()[_0xe36e('0x23')](function(){_0x360b95[_0xe36e('0x19')](0xcc)[_0xe36e('0x1a')]();});}};}function handleEntityNotFound(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(!_0x4749a8){_0x53e13a[_0xe36e('0x18')](0x194);}return _0x4749a8;};}function handleError(_0xb0cd85,_0xb32195){_0xb32195=_0xb32195||0x1f4;return function(_0x31c12c){logger[_0xe36e('0x25')](_0x31c12c[_0xe36e('0x26')]);if(_0x31c12c['name']){delete _0x31c12c[_0xe36e('0x27')];}_0xb0cd85[_0xe36e('0x19')](_0xb32195)[_0xe36e('0x28')](_0x31c12c);};}exports[_0xe36e('0x29')]=function(_0x5e58d8,_0x2d757c){var _0x5a3133={},_0xf7b02e={},_0x5993de={'count':0x0,'rows':[]};var _0x19f001=_['map'](db[_0xe36e('0x2a')]['rawAttributes'],function(_0x3b1045){return{'name':_0x3b1045['fieldName'],'type':_0x3b1045['type']['key']};});_0xf7b02e['model']=_[_0xe36e('0x2b')](_0x19f001,_0xe36e('0x27'));_0xf7b02e['query']=_['keys'](_0x5e58d8[_0xe36e('0x2c')]);_0xf7b02e[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xf7b02e[_0xe36e('0x2f')],_0xf7b02e[_0xe36e('0x2c')]);_0x5a3133[_0xe36e('0x30')]=_['intersection'](_0xf7b02e[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x5e58d8['query'][_0xe36e('0x31')]));_0x5a3133[_0xe36e('0x30')]=_0x5a3133[_0xe36e('0x30')][_0xe36e('0x32')]?_0x5a3133[_0xe36e('0x30')]:_0xf7b02e[_0xe36e('0x2f')];if(!_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x33')](_0xe36e('0x34'))){_0x5a3133[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x5e58d8['query'][_0xe36e('0x1e')]);_0x5a3133['offset']=qs['offset'](_0x5e58d8[_0xe36e('0x2c')]['offset']);}_0x5a3133[_0xe36e('0x35')]=qs[_0xe36e('0x36')](_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x36')]);_0x5a3133['where']=qs['filters'](_[_0xe36e('0x37')](_0x5e58d8[_0xe36e('0x2c')],_0xf7b02e[_0xe36e('0x2d')]),_0x19f001);if(_0x5e58d8[_0xe36e('0x2c')]['filter']){_0x5a3133[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x5a3133[_0xe36e('0x38')],{'$or':_['map'](_0x19f001,function(_0x2c58d1){if(_0x2c58d1[_0xe36e('0x3a')]!=='VIRTUAL'){var _0x40cbe5={};_0x40cbe5[_0x2c58d1[_0xe36e('0x27')]]={'$like':'%'+_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x3b')]+'%'};return _0x40cbe5;}})});}_0x5a3133=_[_0xe36e('0x39')]({},_0x5a3133,_0x5e58d8[_0xe36e('0x3c')]);var _0x130edb={'where':_0x5a3133[_0xe36e('0x38')]};return db[_0xe36e('0x2a')][_0xe36e('0x1c')](_0x130edb)[_0xe36e('0x23')](function(_0x39dd9b){_0x5993de[_0xe36e('0x1c')]=_0x39dd9b;if(_0x5e58d8['query'][_0xe36e('0x3d')]){_0x5a3133[_0xe36e('0x3e')]=[{'all':!![]}];}return db[_0xe36e('0x2a')][_0xe36e('0x3f')](_0x5a3133);})[_0xe36e('0x23')](function(_0x4d133b){_0x5993de['rows']=_0x4d133b;return _0x5993de;})[_0xe36e('0x23')](respondWithFilteredResult(_0x2d757c,_0x5a3133))[_0xe36e('0x40')](handleError(_0x2d757c,null));};exports[_0xe36e('0x41')]=function(_0x537e1a,_0x27caff){var _0x34a1ba={'raw':!![],'where':{'id':_0x537e1a[_0xe36e('0x42')]['id']}},_0xff4f63={};_0xff4f63['model']=_[_0xe36e('0x43')](db[_0xe36e('0x2a')]['rawAttributes']);_0xff4f63[_0xe36e('0x2c')]=_['keys'](_0x537e1a[_0xe36e('0x2c')]);_0xff4f63[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],_0xff4f63[_0xe36e('0x2c')]);_0x34a1ba['attributes']=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x31')]));_0x34a1ba[_0xe36e('0x30')]=_0x34a1ba['attributes'][_0xe36e('0x32')]?_0x34a1ba[_0xe36e('0x30')]:_0xff4f63[_0xe36e('0x2f')];if(_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x3d')]){_0x34a1ba['include']=[{'all':!![]}];}_0x34a1ba=_[_0xe36e('0x39')]({},_0x34a1ba,_0x537e1a[_0xe36e('0x3c')]);return db[_0xe36e('0x2a')][_0xe36e('0x44')](_0x34a1ba)[_0xe36e('0x23')](handleEntityNotFound(_0x27caff,null))[_0xe36e('0x23')](respondWithResult(_0x27caff,null))[_0xe36e('0x40')](handleError(_0x27caff,null));};exports[_0xe36e('0x45')]=function(_0x43c2d4,_0x52e744){return db['SmsApplication'][_0xe36e('0x45')](_0x43c2d4['body'],{})[_0xe36e('0x23')](respondWithResult(_0x52e744,0xc9))[_0xe36e('0x40')](handleError(_0x52e744,null));};exports[_0xe36e('0x22')]=function(_0x25aa09,_0x51641c){if(_0x25aa09[_0xe36e('0x46')]['id']){delete _0x25aa09[_0xe36e('0x46')]['id'];}return db['SmsApplication'][_0xe36e('0x44')]({'where':{'id':_0x25aa09[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x51641c,null))[_0xe36e('0x23')](saveUpdates(_0x25aa09[_0xe36e('0x46')],null))[_0xe36e('0x23')](respondWithResult(_0x51641c,null))[_0xe36e('0x40')](handleError(_0x51641c,null));};exports[_0xe36e('0x24')]=function(_0x17555e,_0x3a99aa){return db[_0xe36e('0x2a')][_0xe36e('0x44')]({'where':{'id':_0x17555e[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x3a99aa,null))[_0xe36e('0x23')](removeEntity(_0x3a99aa,null))['catch'](handleError(_0x3a99aa,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e7cec03..750d825 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 _0x21ea=['request-promise','path','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x308567,_0x5086be){var _0x529f70=function(_0x385da6){while(--_0x385da6){_0x308567['push'](_0x308567['shift']());}};_0x529f70(++_0x5086be);}(_0x21ea,0x164));var _0xa21e=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x21ea[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xa21e('0x0'));var util=require('util');var logger=require(_0xa21e('0x1'))(_0xa21e('0x2'));var moment=require(_0xa21e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa21e('0x4'));var fs=require('fs');var path=require(_0xa21e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa21e('0x6'));module[_0xa21e('0x7')]=function(_0x2afc47,_0x5c19a4){return _0x2afc47['define'](_0xa21e('0x8'),attributes,{'tableName':_0xa21e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa21e('0xa'),'collate':_0xa21e('0xb')});}; \ No newline at end of file +var _0x5e02=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','bluebird','request-promise'];(function(_0x5bcbe0,_0x4ccf72){var _0x58851c=function(_0x4bbbf9){while(--_0x4bbbf9){_0x5bcbe0['push'](_0x5bcbe0['shift']());}};_0x58851c(++_0x4ccf72);}(_0x5e02,0x13b));var _0x25e0=function(_0x1ab35d,_0x3f401d){_0x1ab35d=_0x1ab35d-0x0;var _0x133d6d=_0x5e02[_0x1ab35d];return _0x133d6d;};'use strict';var _=require(_0x25e0('0x0'));var util=require(_0x25e0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x25e0('0x2'));var rp=require(_0x25e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25e0('0x4'));var config=require(_0x25e0('0x5'));var attributes=require(_0x25e0('0x6'));module[_0x25e0('0x7')]=function(_0x106671,_0xf645e5){return _0x106671[_0x25e0('0x8')](_0x25e0('0x9'),attributes,{'tableName':_0x25e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 20a807c..ee1bb48 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 _0x5b7f=['../../config/environment','jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3a0602,_0x24d24d){var _0x558bea=function(_0x5ca4a8){while(--_0x5ca4a8){_0x3a0602['push'](_0x3a0602['shift']());}};_0x558bea(++_0x24d24d);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x891a31,_0x4e0198){_0x891a31=_0x891a31-0x0;var _0x3221ed=_0x5b7f[_0x891a31];return _0x3221ed;};'use strict';var _=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var moment=require(_0xf5b7('0x2'));var BPromise=require(_0xf5b7('0x3'));var rs=require(_0xf5b7('0x4'));var fs=require('fs');var Redis=require(_0xf5b7('0x5'));var db=require(_0xf5b7('0x6'))['db'];var utils=require(_0xf5b7('0x7'));var logger=require(_0xf5b7('0x8'))(_0xf5b7('0x9'));var config=require(_0xf5b7('0xa'));var jayson=require(_0xf5b7('0xb'));var client=jayson[_0xf5b7('0xc')][_0xf5b7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d7c78,_0xd69bc,_0x3711ec){return new BPromise(function(_0x426253,_0x556cb0){return client['request'](_0x1d7c78,_0x3711ec)['then'](function(_0x31c6ea){logger[_0xf5b7('0xe')](_0xf5b7('0xf'),_0xd69bc,_0xf5b7('0x10'));logger[_0xf5b7('0x11')](_0xf5b7('0x12'),_0xd69bc,_0xf5b7('0x10'),JSON[_0xf5b7('0x13')](_0x31c6ea));if(_0x31c6ea[_0xf5b7('0x14')]){if(_0x31c6ea[_0xf5b7('0x14')][_0xf5b7('0x15')]===0x1f4){logger[_0xf5b7('0x14')]('SmsApplication,\x20%s,\x20%s',_0xd69bc,_0x31c6ea[_0xf5b7('0x14')][_0xf5b7('0x16')]);return _0x556cb0(_0x31c6ea[_0xf5b7('0x14')][_0xf5b7('0x16')]);}logger[_0xf5b7('0x14')]('SmsApplication,\x20%s,\x20%s',_0xd69bc,_0x31c6ea[_0xf5b7('0x14')]['message']);return _0x426253(_0x31c6ea['error']['message']);}else{logger['info'](_0xf5b7('0xf'),_0xd69bc,_0xf5b7('0x10'));_0x426253(_0x31c6ea[_0xf5b7('0x17')][_0xf5b7('0x16')]);}})[_0xf5b7('0x18')](function(_0x4cac90){logger[_0xf5b7('0x14')](_0xf5b7('0xf'),_0xd69bc,_0x4cac90);_0x556cb0(_0x4cac90);});});} \ No newline at end of file +var _0xe105=['catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','message','SmsApplication,\x20%s,\x20%s'];(function(_0x2c1302,_0x42a6b7){var _0x1385dd=function(_0x179f9c){while(--_0x179f9c){_0x2c1302['push'](_0x2c1302['shift']());}};_0x1385dd(++_0x42a6b7);}(_0xe105,0xef));var _0x5e10=function(_0x43d935,_0x2f3cf7){_0x43d935=_0x43d935-0x0;var _0x3b9a01=_0xe105[_0x43d935];return _0x3b9a01;};'use strict';var _=require(_0x5e10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e10('0x1'));var db=require(_0x5e10('0x2'))['db'];var utils=require(_0x5e10('0x3'));var logger=require(_0x5e10('0x4'))('rpc');var config=require(_0x5e10('0x5'));var jayson=require(_0x5e10('0x6'));var client=jayson['client'][_0x5e10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x508131,_0x59af7d,_0x375cbd){return new BPromise(function(_0x3e8317,_0x5ce6bd){return client['request'](_0x508131,_0x375cbd)[_0x5e10('0x8')](function(_0x2f99b2){logger[_0x5e10('0x9')]('SmsApplication,\x20%s,\x20%s',_0x59af7d,_0x5e10('0xa'));logger[_0x5e10('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x59af7d,_0x5e10('0xa'),JSON[_0x5e10('0xc')](_0x2f99b2));if(_0x2f99b2[_0x5e10('0xd')]){if(_0x2f99b2[_0x5e10('0xd')]['code']===0x1f4){logger[_0x5e10('0xd')]('SmsApplication,\x20%s,\x20%s',_0x59af7d,_0x2f99b2[_0x5e10('0xd')][_0x5e10('0xe')]);return _0x5ce6bd(_0x2f99b2[_0x5e10('0xd')][_0x5e10('0xe')]);}logger[_0x5e10('0xd')](_0x5e10('0xf'),_0x59af7d,_0x2f99b2[_0x5e10('0xd')]['message']);return _0x3e8317(_0x2f99b2[_0x5e10('0xd')][_0x5e10('0xe')]);}else{logger[_0x5e10('0x9')](_0x5e10('0xf'),_0x59af7d,_0x5e10('0xa'));_0x3e8317(_0x2f99b2['result'][_0x5e10('0xe')]);}})[_0x5e10('0x10')](function(_0xcac44a){logger[_0x5e10('0xd')](_0x5e10('0xf'),_0x59af7d,_0xcac44a);_0x5ce6bd(_0xcac44a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7ad5533..5a2b02d 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 _0x500c=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','create','addMessage','post','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x42f7cd,_0x1c47b7){var _0x514f16=function(_0x7426ce){while(--_0x7426ce){_0x42f7cd['push'](_0x42f7cd['shift']());}};_0x514f16(++_0x1c47b7);}(_0x500c,0x188));var _0xc500=function(_0x234f69,_0x2d9872){_0x234f69=_0x234f69-0x0;var _0x13f0cc=_0x500c[_0x234f69];return _0x13f0cc;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require(_0xc500('0x2'));var timeout=require(_0xc500('0x3'));var express=require(_0xc500('0x4'));var router=express[_0xc500('0x5')]();var auth=require(_0xc500('0x6'));var interaction=require(_0xc500('0x7'));var config=require(_0xc500('0x8'));var controller=require(_0xc500('0x9'));router[_0xc500('0xa')]('/',auth[_0xc500('0xb')](),controller[_0xc500('0xc')]);router[_0xc500('0xa')](_0xc500('0xd'),auth['isAuthenticated'](),controller[_0xc500('0xe')]);router['get'](_0xc500('0xf'),auth[_0xc500('0xb')](),controller[_0xc500('0x10')]);router[_0xc500('0xa')](_0xc500('0x11'),auth[_0xc500('0xb')](),controller['getMessages']);router[_0xc500('0xa')]('/:id/download',auth[_0xc500('0xb')](),controller['download']);router['post']('/',auth[_0xc500('0xb')](),controller[_0xc500('0x12')]);router['post'](_0xc500('0x11'),auth[_0xc500('0xb')](),controller[_0xc500('0x13')]);router[_0xc500('0x14')](_0xc500('0x15'),auth[_0xc500('0xb')](),interaction[_0xc500('0x16')](_0xc500('0x17'),'smsinteraction:addtags'),controller[_0xc500('0x18')]);router[_0xc500('0x19')]('/:id',auth[_0xc500('0xb')](),interaction[_0xc500('0x16')](_0xc500('0x17'),_0xc500('0x1a')),controller[_0xc500('0x1b')]);router[_0xc500('0x1c')](_0xc500('0xf'),auth['isAuthenticated'](),interaction[_0xc500('0x16')](_0xc500('0x17'),_0xc500('0x1d')),controller[_0xc500('0x1e')]);router[_0xc500('0x1c')](_0xc500('0x15'),auth[_0xc500('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x2d0b=['smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','create','post','/:id/tags','tracked','sms'];(function(_0x2e847c,_0x57aea7){var _0x13963b=function(_0x3ef05d){while(--_0x3ef05d){_0x2e847c['push'](_0x2e847c['shift']());}};_0x13963b(++_0x57aea7);}(_0x2d0b,0x102));var _0xb2d0=function(_0x43b1f0,_0x316c82){_0x43b1f0=_0x43b1f0-0x0;var _0x2d4148=_0x2d0b[_0x43b1f0];return _0x2d4148;};'use strict';var multer=require('multer');var util=require(_0xb2d0('0x0'));var path=require(_0xb2d0('0x1'));var timeout=require(_0xb2d0('0x2'));var express=require('express');var router=express[_0xb2d0('0x3')]();var auth=require(_0xb2d0('0x4'));var interaction=require(_0xb2d0('0x5'));var config=require(_0xb2d0('0x6'));var controller=require('./smsInteraction.controller');router[_0xb2d0('0x7')]('/',auth['isAuthenticated'](),controller[_0xb2d0('0x8')]);router[_0xb2d0('0x7')](_0xb2d0('0x9'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0xb')]);router[_0xb2d0('0x7')](_0xb2d0('0xc'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0xd')]);router[_0xb2d0('0x7')](_0xb2d0('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb2d0('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xb2d0('0xa')](),controller[_0xb2d0('0x10')]);router[_0xb2d0('0x11')]('/:id/messages',auth[_0xb2d0('0xa')](),controller['addMessage']);router[_0xb2d0('0x11')](_0xb2d0('0x12'),auth[_0xb2d0('0xa')](),interaction[_0xb2d0('0x13')](_0xb2d0('0x14'),_0xb2d0('0x15')),controller[_0xb2d0('0x16')]);router[_0xb2d0('0x17')](_0xb2d0('0xc'),auth[_0xb2d0('0xa')](),interaction[_0xb2d0('0x13')](_0xb2d0('0x14'),_0xb2d0('0x18')),controller[_0xb2d0('0x19')]);router[_0xb2d0('0x1a')]('/:id',auth[_0xb2d0('0xa')](),interaction['tracked'](_0xb2d0('0x14'),_0xb2d0('0x1b')),controller[_0xb2d0('0x1c')]);router[_0xb2d0('0x1a')](_0xb2d0('0x12'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0x1d')]);module[_0xb2d0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2c267bc..16bdfad 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 _0xcb91=['exports','BOOLEAN','DATE','STRING','out'];(function(_0x40947d,_0x28b700){var _0x13291f=function(_0x2d53e6){while(--_0x2d53e6){_0x40947d['push'](_0x40947d['shift']());}};_0x13291f(++_0x28b700);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xcb91[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'closed':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cb9('0x2')]},'disposition':{'type':Sequelize[_0x1cb9('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'read1stAt':{'type':Sequelize[_0x1cb9('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cb9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x45b326,_0x5dfa40){var _0x218592=function(_0x5ec768){while(--_0x5ec768){_0x45b326['push'](_0x45b326['shift']());}};_0x218592(++_0x5dfa40);}(_0xe706,0xa3));var _0x6e70=function(_0x5c9274,_0x4e849b){_0x5c9274=_0x5c9274-0x0;var _0x1ef7d3=_0xe706[_0x5c9274];return _0x1ef7d3;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('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 cba3614..4b57870 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 _0xb58b=['Account','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','field','from','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','compact','isEmpty','SmsAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','SmsInteraction','includeAll','include','merge','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','filter','$gte','format','findAll','addTags','setTags','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','firstName','lastName','direction','secret','SmsAccount'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0xb58b,0x1f1));var _0xbb58=function(_0x170a9a,_0x4fb43f){_0x170a9a=_0x170a9a-0x0;var _0xa99683=_0xb58b[_0x170a9a];return _0xa99683;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb58('0x0'));var rimraf=require(_0xbb58('0x1'));var zipdir=require(_0xbb58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb58('0x3'));var moment=require(_0xbb58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb58('0x5'));var util=require('util');var path=require(_0xbb58('0x6'));var sox=require(_0xbb58('0x7'));var csv=require(_0xbb58('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x8'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var db=require(_0xbb58('0x17'))['db'];config['redis']=_[_0xbb58('0x18')](config[_0xbb58('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb58('0x1a'))(new Redis(config[_0xbb58('0x19')]));require(_0xbb58('0x1b'))[_0xbb58('0x1c')](socket);function respondWithStatusCode(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xcc;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1d')](_0x58245f);}return _0x19ceda['status'](_0x58245f)['end']();};}function respondWithResult(_0x33c20f,_0x445b1f){_0x445b1f=_0x445b1f||0xc8;return function(_0x38d69a){if(_0x38d69a){return _0x33c20f['status'](_0x445b1f)['json'](_0x38d69a);}};}function respondWithFilteredResult(_0x5ac9df,_0x55156e){return function(_0x28637b){if(_0x28637b){var _0x3134ea=_0x28637b[_0xbb58('0x1e')],_0x48f3e0=_0x55156e[_0xbb58('0x1f')],_0xbee66=_0x55156e[_0xbb58('0x1f')]+_0x55156e[_0xbb58('0x20')],_0x497653;if(_0xbee66>=_0x3134ea){_0xbee66=_0x3134ea;_0x497653=0xc8;}else{_0x497653=0xce;}_0x5ac9df[_0xbb58('0x21')](_0x497653);return _0x5ac9df[_0xbb58('0x22')](_0xbb58('0x23'),_0x48f3e0+'-'+_0xbee66+'/'+_0x3134ea)['json'](_0x28637b);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x24')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x25')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x26')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x27')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x28')]()[_0xbb58('0x27')](function(){_0x21964d[_0xbb58('0x21')](0xcc)[_0xbb58('0x29')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x1d')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x2a')](_0x8e9ed9[_0xbb58('0x2b')]);if(_0x8e9ed9[_0xbb58('0x2c')]){delete _0x8e9ed9[_0xbb58('0x2c')];}_0x1be0ae[_0xbb58('0x21')](_0x129094)[_0xbb58('0x2d')](_0x8e9ed9);};}function getInteractionUsers(_0x28b3a3,_0x2a0481){return new BPromise(function(_0x4157c4,_0x3559b6){try{if(_0x2a0481[_0x28b3a3['id']]){_0x28b3a3['Users']=_[_0xbb58('0x2e')](_0x2a0481[_0x28b3a3['id']],function(_0xe46bc1){return{'id':_0xe46bc1['id'],'fullname':_0xe46bc1[_0xbb58('0x2f')]};});}}catch(_0x3c9cee){_0x3559b6(_0x3c9cee);}_0x4157c4(_0x28b3a3);});}function getInteractionTags(_0x3304b9,_0x9d379f){return new BPromise(function(_0x1ba526,_0x643e0e){try{if(_0x3304b9[_0xbb58('0x30')]){_0x3304b9['Tags']=[];_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')](',')[_0xbb58('0x32')](function(_0x3a1e46){_0x3304b9[_0xbb58('0x33')][_0xbb58('0x34')](_0x9d379f[_0x3a1e46]);});}delete _0x3304b9[_0xbb58('0x30')];}catch(_0x2599af){_0x643e0e(_0x2599af);}_0x1ba526(_0x3304b9);});}function updateSmsInteraction(_0x23816c,_0x1cae1c,_0x389187){return new BPromise(function(_0x34583e,_0x2f5967){return getInteractionUsers(_0x23816c,_0x389187)['then'](function(_0x51b69f){return getInteractionTags(_0x51b69f,_0x1cae1c);})['then'](function(_0x1def9f){_0x34583e(_0x1def9f);})[_0xbb58('0x35')](function(_0x1c207b){_0x2f5967(_0x1c207b);});});}exports[_0xbb58('0x36')]=function(_0xb28e63,_0x3333e5){var _0x3093bf={},_0x29137f={},_0x5db313={'count':0x0,'rows':[]};var _0x2fbf90=_[_0xbb58('0x2e')](db['SmsInteraction'][_0xbb58('0x37')],function(_0x4da3ed){return{'name':_0x4da3ed[_0xbb58('0x38')],'type':_0x4da3ed['type'][_0xbb58('0x39')]};});_0x29137f[_0xbb58('0x3a')]=_['map'](_0x2fbf90,_0xbb58('0x2c'));_0x29137f[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0xb28e63[_0xbb58('0x3b')]);_0x29137f[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x29137f[_0xbb58('0x3a')],_0x29137f[_0xbb58('0x3b')]);_0x3093bf['attributes']=_[_0xbb58('0x3e')](_0x29137f[_0xbb58('0x3a')],qs[_0xbb58('0x3f')](_0xb28e63['query']['fields']));_0x3093bf[_0xbb58('0x40')]=_0x3093bf['attributes'][_0xbb58('0x41')]?_0x3093bf[_0xbb58('0x40')]:_0x29137f[_0xbb58('0x3a')];if(!_0xb28e63['query']['hasOwnProperty'](_0xbb58('0x42'))){_0x3093bf[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x20')]);_0x3093bf[_0xbb58('0x1f')]=qs['offset'](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x1f')]);}_0x3093bf[_0xbb58('0x43')]=qs[_0xbb58('0x44')](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x44')]);_0x3093bf['where']=qs[_0xbb58('0x3d')](_['pick'](_0xb28e63[_0xbb58('0x3b')],_0x29137f[_0xbb58('0x3d')]),_0x2fbf90);var _0x29fb1c=[];var _0x45817f=squel['select']()[_0xbb58('0x45')]('id')[_0xbb58('0x45')](_0xbb58('0x2c'))[_0xbb58('0x45')]('color')[_0xbb58('0x46')]('tools_tags');var _0x2ffd8b=squel[_0xbb58('0x47')]()[_0xbb58('0x45')](_0xbb58('0x48'))[_0xbb58('0x45')](_0xbb58('0x49'))[_0xbb58('0x45')](_0xbb58('0x4a'))[_0xbb58('0x46')](_0xbb58('0x4b'),'ui')[_0xbb58('0x4c')](_0xbb58('0x4d'),'u',_0xbb58('0x4e'));var _0x55a1cc=squel[_0xbb58('0x47')]()['from']('sms_interactions','i')[_0xbb58('0x4c')](_0xbb58('0x4f'),'c',_0xbb58('0x50'))[_0xbb58('0x4c')](_0xbb58('0x4d'),'o',_0xbb58('0x51'))[_0xbb58('0x4c')](_0xbb58('0x52'),'a',_0xbb58('0x53'))[_0xbb58('0x4c')](_0xbb58('0x54'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xbb58('0x4c')](_0xbb58('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xbb58('0x4c')](_0xbb58('0x56'),'t',_0xbb58('0x57'));var _0xdb0ff7=squel['expr']();var _0x17418c=[];var _0x54d658=squel[_0xbb58('0x58')]();var _0x336598;if(_0xb28e63[_0xbb58('0x3b')]['search']){_0x336598=as[_0xbb58('0x59')](_0xb28e63[_0xbb58('0x3b')]['search']);var _0x419cef=_0x336598['sqlOperator'];for(var _0x28301d=0x0;_0x28301d<_0x336598[_0xbb58('0x5a')][_0xbb58('0x41')];_0x28301d++){var _0x1ec976=_0x336598[_0xbb58('0x5a')][_0x28301d];var _0x13d964='i';var _0x130557=_['find'](_0x2fbf90,[_0xbb58('0x2c'),_0x1ec976[_0xbb58('0x45')]]);if(!_0x130557){switch(_0x1ec976['field']){case _0xbb58('0x5b'):if(_0x1ec976[_0xbb58('0x5c')]==0x1){_0x55a1cc['having']('`'+_0x1ec976[_0xbb58('0x45')]+_0xbb58('0x5d'));}else{_0x55a1cc[_0xbb58('0x5e')]('`'+_0x1ec976['field']+_0xbb58('0x5f'));}break;case _0xbb58('0x60'):if(_0x1ec976[_0xbb58('0x61')]==='$substring'){if(_0x1ec976[_0xbb58('0x5c')]['split']('\x20')[_0xbb58('0x41')]>0x1){_0xdb0ff7[_0x419cef](_0xbb58('0x62'),qs[_0xbb58('0x63')](_0x1ec976['value']),null);}else{var _0x5aaace='%'+_0x1ec976[_0xbb58('0x5c')]+'%';_0xdb0ff7[_0x419cef](_0xbb58('0x64'),_0x5aaace,_0x5aaace,_0x5aaace);}}else{_0x130557=_[_0xbb58('0x65')](_0x2fbf90,[_0xbb58('0x2c'),_0xbb58('0x66')]);_0x1ec976['field']=_0xbb58('0x66');_0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40['text'],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x69')],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x29')]);}break;case _0xbb58('0x6a'):var _0x5e7ae0=_0x1ec976[_0xbb58('0x5c')][_0xbb58('0x31')](',')[_0xbb58('0x2e')](function(_0x20dcaa){return Number(_0x20dcaa);});_0x5e7ae0[_0xbb58('0x32')](function(_0x38b1ba){_0x54d658['or'](_0xbb58('0x6b'),'%,'+_0x38b1ba+',%');});_0x17418c=_[_0xbb58('0x6c')](_0x17418c,_0x5e7ae0);break;case'User':if(_0x1ec976[_0xbb58('0x61')]==='$substring'){_0xdb0ff7[_0x419cef](_0xbb58('0x6d'),'%'+_0x1ec976[_0xbb58('0x5c')]+'%',null);}else{_0x130557=_[_0xbb58('0x65')](_0x2fbf90,[_0xbb58('0x2c'),_0xbb58('0x6e')]);_0x1ec976[_0xbb58('0x45')]=_0xbb58('0x6e');_0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40[_0xbb58('0x5c')]['start'],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x29')]);}break;case _0xbb58('0x70'):_0x143a40=as['buildExpression']('me',null,_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40['value'][_0xbb58('0x69')],_0x143a40[_0xbb58('0x5c')]['end']);break;}}else{var _0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40[_0xbb58('0x5c')]['start'],_0x143a40['value'][_0xbb58('0x29')]);}}}else{var _0x2f0db7=_(_0xb28e63[_0xbb58('0x3b')])['keys']()[_0xbb58('0x2e')](function(_0x419215){return _['some'](_0x2fbf90,[_0xbb58('0x2c'),_0x419215])?_0x419215:undefined;})[_0xbb58('0x71')]()['value']();if(!_[_0xbb58('0x72')](_0x2f0db7)){_0x2f0db7[_0xbb58('0x32')](function(_0x3c6f5d){if(_0x3c6f5d===_0xbb58('0x73')){_0x55a1cc[_0xbb58('0x74')]('i.SmsAccountId\x20IN\x20?',[][_0xbb58('0x75')](_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d]));}else if(_0x3c6f5d===_0xbb58('0x76')){var _0x1da9c7=JSON[_0xbb58('0x77')](_0xb28e63['query'][_0x3c6f5d])['$gte'];var _0x29f64a=JSON['parse'](_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d])[_0xbb58('0x78')];_0x55a1cc[_0xbb58('0x74')](_0xbb58('0x79'),_0x1da9c7,_0x29f64a);}else{if(_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d]===_0xbb58('0x7a')){_0x55a1cc[_0xbb58('0x74')]('i.'+_0x3c6f5d+_0xbb58('0x7b'));}else{_0x55a1cc[_0xbb58('0x74')]('i.'+_0x3c6f5d+_0xbb58('0x7c'),_0xb28e63['query'][_0x3c6f5d]);}}});}if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7d')]){if(_0xb28e63[_0xbb58('0x3b')]['read']==0x1){_0x55a1cc[_0xbb58('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x55a1cc['having'](_0xbb58('0x7e'));}}if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7f')]){_0x17418c=_[_0xbb58('0x80')](_0xb28e63['query']['tag'])?_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7f')]:new Array(_0xb28e63['query'][_0xbb58('0x7f')]);_0x17418c[_0xbb58('0x32')](function(_0x3cd96a){_0x54d658['or'](_0xbb58('0x6b'),'%,'+_0x3cd96a+',%');});}if(_0xb28e63[_0xbb58('0x3b')]['filter']){var _0x30b8d2=_0xb28e63['query']['filter'][_0xbb58('0x81')]('\x5c','\x5c\x5c')[_0xbb58('0x81')]('\x27\x27',_0xbb58('0x82'));if(qs['isNumeric'](_0x30b8d2)){_0xdb0ff7['or'](_0xbb58('0x83'),_0x30b8d2+'%')['or'](_0xbb58('0x84'),_0x30b8d2+'%');}else{_0xdb0ff7['or'](_0xbb58('0x85'),qs[_0xbb58('0x63')](_0x30b8d2))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x30b8d2+'%');}}}_0x55a1cc[_0xbb58('0x74')](_0xdb0ff7);_0x55a1cc['group']('i.id');var _0x3addb7={'type':db[_0xbb58('0x86')][_0xbb58('0x87')]['SELECT'],'raw':!![]};var _0x4992f7=_0x55a1cc[_0xbb58('0x88')]();_0x4992f7[_0xbb58('0x45')](_0xbb58('0x89'));_0x4992f7[_0xbb58('0x45')](_0xbb58('0x8a'),_0xbb58('0x5b'));if(_0x3093bf[_0xbb58('0x43')]){_0x3093bf[_0xbb58('0x43')][_0xbb58('0x32')](function(_0x163ca4){_0x55a1cc[_0xbb58('0x43')]('i.'+_0x163ca4[0x0],_0x163ca4[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x17418c)){_0x55a1cc[_0xbb58('0x5e')](_0x54d658);_0x4992f7[_0xbb58('0x74')](_0xbb58('0x8b'),_0x17418c);}BPromise['resolve']()[_0xbb58('0x27')](function(){if(!_0x336598){if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x73')]||_0xb28e63['query'][_0xbb58('0x8c')])return;_0x4992f7['where'](_0xbb58('0x8d'));_0x55a1cc['where'](_0xbb58('0x8d'));return;}return _0xb28e63[_0xbb58('0x8e')][_0xbb58('0x8f')]({'attributes':['id'],'raw':!![]})[_0xbb58('0x27')](function(_0x26c15a){if(_[_0xbb58('0x72')](_0x26c15a)){_0x4992f7['where']('i.SmsAccountId\x20IS\x20NULL');_0x55a1cc[_0xbb58('0x74')](_0xbb58('0x90'));}else{_0x4992f7['where'](_0xbb58('0x91'),_[_0xbb58('0x2e')](_0x26c15a,'id'));_0x55a1cc[_0xbb58('0x74')]('i.SmsAccountId\x20IN\x20?',_[_0xbb58('0x2e')](_0x26c15a,'id'));}});})['then'](function(){db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x4992f7[_0xbb58('0x93')](),_0x3addb7)[_0xbb58('0x27')](function(_0x389cd3){_0x5db313[_0xbb58('0x1e')]=_0x389cd3[_0xbb58('0x41')];if(_0x5db313['count']===0x0)return[];return db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x45817f[_0xbb58('0x93')](),_0x3addb7)['then'](function(_0x25fb59){_0x29fb1c=_[_0xbb58('0x94')](_0x25fb59,'id');_0x3addb7=_['merge'](_0x3addb7,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x3f')]){_0x3093bf[_0xbb58('0x40')]['forEach'](function(_0x4deb01){_0x55a1cc[_0xbb58('0x45')]('i.'+_0x4deb01);});}else{_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x8a'),_0xbb58('0x5b'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x95'),_0xbb58('0x96'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x97'),_0xbb58('0x98'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x99'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9a'),_0xbb58('0x9b'));_0x55a1cc['field'](_0xbb58('0x9c'),'Contact.lastName');_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9d'),_0xbb58('0x9e'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9f'),_0xbb58('0xa0'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0xa1'),_0xbb58('0xa2'));_0x55a1cc[_0xbb58('0x45')]('c.fax',_0xbb58('0xa3'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0xa4'),_0xbb58('0xa5'));_0x55a1cc[_0xbb58('0x45')]('o.internal',_0xbb58('0xa6'));_0x55a1cc['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbb58('0x30'));}if(_0x3093bf['limit'])_0x55a1cc[_0xbb58('0x20')](_0x3093bf['limit']);if(_0x3093bf[_0xbb58('0x1f')])_0x55a1cc['offset'](_0x3093bf[_0xbb58('0x1f')]);return db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x55a1cc[_0xbb58('0x93')](),_0x3addb7);})[_0xbb58('0x27')](function(_0x30cb55){_0x2ffd8b[_0xbb58('0x74')](_0xbb58('0xa7'),_['map'](_0x30cb55,'id'));return db['sequelize'][_0xbb58('0x3b')](_0x2ffd8b[_0xbb58('0x93')](),_0x3addb7)['then'](function(_0x57f022){var _0x56722e=_[_0xbb58('0xa8')](_0x57f022,_0xbb58('0xa9'));var _0x564b8a=[];_0x30cb55[_0xbb58('0x32')](function(_0x4281c0){_0x564b8a[_0xbb58('0x34')](updateSmsInteraction(_0x4281c0,_0x29fb1c,_0x56722e));});return BPromise[_0xbb58('0xaa')](_0x564b8a);});});})[_0xbb58('0x27')](function(_0x343535){_0x5db313[_0xbb58('0xab')]=_0x343535;return _0x5db313;})[_0xbb58('0x27')](respondWithFilteredResult(_0x3333e5,_0x3093bf));})['catch'](handleError(_0x3333e5,null));};exports[_0xbb58('0xac')]=function(_0x1c8f1a,_0x4d9bb7){var _0x5b101d={'raw':![],'where':{'id':_0x1c8f1a[_0xbb58('0xad')]['id']}},_0x2bef7b={};_0x2bef7b[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0xae')]['rawAttributes']);_0x2bef7b[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0x1c8f1a['query']);_0x2bef7b[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x2bef7b[_0xbb58('0x3a')],_0x2bef7b['query']);_0x5b101d[_0xbb58('0x40')]=_[_0xbb58('0x3e')](_0x2bef7b['model'],qs[_0xbb58('0x3f')](_0x1c8f1a[_0xbb58('0x3b')]['fields']));_0x5b101d['attributes']=_0x5b101d[_0xbb58('0x40')][_0xbb58('0x41')]?_0x5b101d['attributes']:_0x2bef7b[_0xbb58('0x3a')];if(_0x1c8f1a[_0xbb58('0x3b')][_0xbb58('0xaf')]){_0x5b101d[_0xbb58('0xb0')]=[{'all':!![]}];}_0x5b101d=_[_0xbb58('0xb1')]({},_0x5b101d,_0x1c8f1a[_0xbb58('0xb2')]);return db['SmsInteraction'][_0xbb58('0x65')](_0x5b101d)['then'](handleEntityNotFound(_0x4d9bb7,null))[_0xbb58('0x27')](respondWithResult(_0x4d9bb7,null))[_0xbb58('0x35')](handleError(_0x4d9bb7,null));};exports[_0xbb58('0xb3')]=function(_0x40a994,_0x68bf76){return db[_0xbb58('0xae')]['create'](_0x40a994[_0xbb58('0x70')],{})['then'](respondWithResult(_0x68bf76,0xc9))[_0xbb58('0x35')](handleError(_0x68bf76,null));};exports[_0xbb58('0xb4')]=function(_0x4cd52b,_0x52bc27){if(_0x4cd52b[_0xbb58('0x70')]['id']){delete _0x4cd52b[_0xbb58('0x70')]['id'];}return db['SmsInteraction'][_0xbb58('0x65')]({'where':{'id':_0x4cd52b['params']['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x52bc27,null))[_0xbb58('0x27')](saveUpdates(_0x4cd52b[_0xbb58('0x70')],null))[_0xbb58('0x27')](respondWithResult(_0x52bc27,null))[_0xbb58('0x35')](handleError(_0x52bc27,null));};exports[_0xbb58('0x28')]=function(_0x8875f1,_0x2a7465){return db[_0xbb58('0xae')][_0xbb58('0x65')]({'where':{'id':_0x8875f1[_0xbb58('0xad')]['id']}})['then'](handleEntityNotFound(_0x2a7465,null))[_0xbb58('0x27')](removeEntity(_0x2a7465,null))['catch'](handleError(_0x2a7465,null));};exports[_0xbb58('0xb5')]=function(_0x586752,_0x1281d8){return db[_0xbb58('0xae')]['describe']()[_0xbb58('0x27')](respondWithResult(_0x1281d8,null))['catch'](handleError(_0x1281d8,null));};exports[_0xbb58('0xb6')]=function(_0x1378ca,_0x37e3ea,_0x4e387e){return db[_0xbb58('0xb7')][_0xbb58('0x65')]({'where':{'id':_0x1378ca[_0xbb58('0xad')]['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x37e3ea,null))[_0xbb58('0x27')](function(_0x360749){if(_0x360749){return _0x360749['addMessage'](_0x1378ca[_0xbb58('0x70')][_0xbb58('0xb8')],_[_0xbb58('0xb9')](_0x1378ca['body'],[_0xbb58('0xb8'),'id'])||{});}})[_0xbb58('0x27')](respondWithResult(_0x37e3ea,null))[_0xbb58('0x35')](handleError(_0x37e3ea,null));};exports[_0xbb58('0xba')]=function(_0xa16ba1,_0x26d28e,_0x45e60f){var _0x3641cf={'raw':![],'where':{}};var _0x31a6ee={};var _0x505902={'count':0x0,'rows':[]};return db[_0xbb58('0xae')]['findOne']({'where':{'id':_0xa16ba1[_0xbb58('0xad')]['id']}})['then'](handleEntityNotFound(_0x26d28e,null))[_0xbb58('0x27')](function(_0x1ecf17){if(_0x1ecf17){_0x31a6ee[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0xb7')][_0xbb58('0x37')]);_0x31a6ee[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0xa16ba1[_0xbb58('0x3b')]);_0x31a6ee[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x31a6ee[_0xbb58('0x3a')],_0x31a6ee[_0xbb58('0x3b')]);_0x3641cf[_0xbb58('0x40')]=_[_0xbb58('0x3e')](_0x31a6ee[_0xbb58('0x3a')],qs[_0xbb58('0x3f')](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x3f')]));_0x3641cf[_0xbb58('0x40')]=_0x3641cf[_0xbb58('0x40')][_0xbb58('0x41')]?_0x3641cf[_0xbb58('0x40')]:_0x31a6ee[_0xbb58('0x3a')];if(!_0xa16ba1[_0xbb58('0x3b')]['hasOwnProperty'](_0xbb58('0x42'))){_0x3641cf[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0xa16ba1[_0xbb58('0x3b')]['limit']);_0x3641cf[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x1f')]);}_0x3641cf[_0xbb58('0x43')]=qs['sort'](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x44')]);_0x3641cf[_0xbb58('0x74')]=qs[_0xbb58('0x3d')](_['pick'](_0xa16ba1[_0xbb58('0x3b')],_0x31a6ee[_0xbb58('0x3d')]));_0x3641cf[_0xbb58('0x74')]['SmsInteractionId']=_0x1ecf17['id'];if(_0xa16ba1['query'][_0xbb58('0xbb')]){_0x3641cf['where']=_[_0xbb58('0xb1')](_0x3641cf[_0xbb58('0x74')],{'$or':_[_0xbb58('0x2e')](_0x3641cf['attributes'],function(_0x12e94f){var _0x27ac56={};_0x27ac56[_0x12e94f]={'$like':'%'+_0xa16ba1['query'][_0xbb58('0xbb')]+'%'};return _0x27ac56;})});}if(_0xa16ba1[_0xbb58('0x3b')]['$gte']){var _0x20e214=_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0xbc')]['split'](',');var _0x2cfa2a={};_0x2cfa2a[_0x20e214[0x0]]={'$gte':moment(_0x20e214[0x1])[_0xbb58('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3641cf[_0xbb58('0x74')]=_[_0xbb58('0xb1')](_0x3641cf[_0xbb58('0x74')],_0x2cfa2a);}_0x3641cf=_[_0xbb58('0xb1')]({},_0x3641cf,_0xa16ba1[_0xbb58('0xb2')]);return db[_0xbb58('0xb7')][_0xbb58('0x1e')]({'where':_0x3641cf[_0xbb58('0x74')]})['then'](function(_0x2a0803){_0x505902['count']=_0x2a0803;if(_0xa16ba1[_0xbb58('0x3b')]['includeAll']){_0x3641cf[_0xbb58('0xb0')]=[{'all':!![]}];}return db[_0xbb58('0xb7')][_0xbb58('0xbe')](_0x3641cf);})[_0xbb58('0x27')](function(_0x3665a8){_0x505902['rows']=_0x3665a8;return _0x505902;});}})[_0xbb58('0x27')](respondWithFilteredResult(_0x26d28e,_0x3641cf))[_0xbb58('0x35')](handleError(_0x26d28e,null));};exports[_0xbb58('0xbf')]=function(_0x200d16,_0x1f5844,_0xab7d39){return db['SmsInteraction']['find']({'where':{'id':_0x200d16['params']['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x1f5844,null))['then'](function(_0x15d86c){if(_0x15d86c){return _0x15d86c[_0xbb58('0xc0')](_0x200d16[_0xbb58('0x70')][_0xbb58('0xb8')],_[_0xbb58('0xb9')](_0x200d16[_0xbb58('0x70')],[_0xbb58('0xb8'),'id'])||{})['spread'](function(){return db[_0xbb58('0x6a')][_0xbb58('0xbe')]({'attributes':['id',_0xbb58('0x2c'),_0xbb58('0xc1')],'where':{'id':_0x200d16[_0xbb58('0x70')]['ids']}});})[_0xbb58('0x27')](function(_0x5a2861){socket[_0xbb58('0xc2')](_0xbb58('0xc3'),{'id':Number(_0x200d16[_0xbb58('0xad')]['id']),'tags':_0x5a2861||[]});return{'id':Number(_0x200d16[_0xbb58('0xad')]['id']),'tags':_0x5a2861||[]};});}})[_0xbb58('0x27')](respondWithResult(_0x1f5844,null))['catch'](handleError(_0x1f5844,null));};exports[_0xbb58('0xc4')]=function(_0x2ea15c,_0x3d05df,_0x196dbf){return db[_0xbb58('0xae')]['find']({'where':{'id':_0x2ea15c[_0xbb58('0xad')]['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x3d05df,null))[_0xbb58('0x27')](function(_0x23aaec){if(_0x23aaec){return _0x23aaec['removeTags'](_0x2ea15c[_0xbb58('0x3b')][_0xbb58('0xb8')]);}})['then'](respondWithStatusCode(_0x3d05df,null))[_0xbb58('0x35')](handleError(_0x3d05df,null));};exports[_0xbb58('0xc5')]=function(_0x319d14,_0x3810f1){var _0x426144=moment()[_0xbb58('0xc6')]()[_0xbb58('0x93')]();var _0x90682c=path['join'](config['root'],'server','files','tmp');var _0x362bd8=path[_0xbb58('0xc7')](config[_0xbb58('0xc8')],_0xbb58('0xc9'),_0xbb58('0xca'),_0xbb58('0xcb'));var _0x520662=path[_0xbb58('0xc7')](_0x90682c,_0x426144);var _0x2968e3=util[_0xbb58('0xbd')](_0xbb58('0xcc'),_0x319d14['params']['id'],_0x426144);var _0x47c2ca=path[_0xbb58('0xc7')](_0x90682c,_0x2968e3);var _0x1830b0=[];_0x1830b0[_0xbb58('0x34')]({'model':db[_0xbb58('0xcd')],'as':'User','attributes':['id',_0xbb58('0x2f')],'raw':!![]});_0x1830b0[_0xbb58('0x34')]({'model':db['CmContact'],'as':_0xbb58('0x60'),'attributes':['id',_0xbb58('0xce'),_0xbb58('0xcf')],'raw':!![]});var _0x45809d=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0xbb58('0x76'),_0xbb58('0xd0'),_0xbb58('0xd1'),'read'],'include':_0x1830b0}];_0x45809d['push']({'model':db[_0xbb58('0xd2')],'as':_0xbb58('0xd3'),'attributes':['id','name']});_0x45809d['push']({'model':db[_0xbb58('0xcd')],'as':_0xbb58('0xd4'),'attributes':['id',_0xbb58('0x2f')]});return db[_0xbb58('0xae')][_0xbb58('0x65')]({'where':{'id':_0x319d14[_0xbb58('0xad')]['id']},'include':_0x45809d})[_0xbb58('0x27')](handleEntityNotFound(_0x3810f1,null))[_0xbb58('0x27')](function(_0x51c7e6){if(_0x51c7e6){var _0x3aec87=_0x51c7e6['get']({'plain':!![]});fs[_0xbb58('0xd5')](_0x520662);var _0x4237aa={'format':'A4','border':_0xbb58('0xd6'),'header':{'height':'40px','contents':{'first':_0xbb58('0xd7')}},'footer':{'height':_0xbb58('0xd8'),'contents':{'default':util[_0xbb58('0xbd')](_0xbb58('0xd9'),util['format']('%s\x20#%d','Sms',_0x3aec87['id']),moment()['format'](_0xbb58('0xda'))['toString']())}}};var _0x2d83d1={'channel':_0xbb58('0xdb'),'account':_0x3aec87[_0xbb58('0xd3')][_0xbb58('0x2c')],'agent':_0x3aec87['Owner']?_0x3aec87[_0xbb58('0xd4')][_0xbb58('0x2f')]:_0xbb58('0xdc'),'createdAt':moment(_0x3aec87[_0xbb58('0x76')])[_0xbb58('0xbd')](_0xbb58('0xdd'))[_0xbb58('0x93')](),'closedAt':_0x3aec87[_0xbb58('0xde')]?moment(_0x3aec87[_0xbb58('0xdf')])[_0xbb58('0xbd')](_0xbb58('0xdd'))['toString']():'','disposition':_0x3aec87[_0xbb58('0xe0')],'messages':_(_0x3aec87['Messages'])[_0xbb58('0xbb')]({'secret':![]})[_0xbb58('0x2e')](function(_0x400d28){return{'date':moment(_0x400d28['createdAt'])['format'](_0xbb58('0xdd'))[_0xbb58('0x93')](),'sender':_0x400d28[_0xbb58('0xd0')]==='out'?_0x400d28[_0xbb58('0xcd')]?_0x400d28[_0xbb58('0xcd')][_0xbb58('0x2f')]:_0xbb58('0xe1'):_0x400d28[_0xbb58('0x60')][_0xbb58('0xce')]+(_0x400d28[_0xbb58('0x60')][_0xbb58('0xcf')]?'\x20'+_0x400d28[_0xbb58('0x60')][_0xbb58('0xcf')]:''),'body':_0x400d28[_0xbb58('0x70')],'direction':_0x400d28[_0xbb58('0xd0')]===_0xbb58('0xe2')?'A':'C','secret':_0x400d28[_0xbb58('0xd1')],'read':_0x400d28[_0xbb58('0x7d')]};})[_0xbb58('0x5c')]()};return ejs[_0xbb58('0xe3')](path[_0xbb58('0xc7')](config['root'],_0xbb58('0xc9'),_0xbb58('0xe4'),_0xbb58('0xe5')),{'interaction':_0x2d83d1})[_0xbb58('0x27')](function(_0x1e568f){return new BPromise(function(_0xa2a796,_0x3444ee){pdf[_0xbb58('0xb3')](_0x1e568f,_0x4237aa)[_0xbb58('0xe6')](path[_0xbb58('0xc7')](_0x520662,_0xbb58('0xe7')+_0x3aec87['id']+'-'+_0x426144+_0xbb58('0xe8')),function(_0x5ab9d8,_0x4a3a0c){if(_0x5ab9d8)return _0x3444ee(_0x5ab9d8);_0xa2a796(_0x4a3a0c);});});})[_0xbb58('0x27')](function(){return new BPromise(function(_0x4cc939,_0x272bfe){zipdir(_0x520662,{'saveTo':_0x47c2ca},function(_0x2bff0d,_0x2d5bf4){if(_0x2bff0d)return _0x272bfe(_0x2bff0d);return _0x4cc939(_0x2d5bf4);});})[_0xbb58('0x27')](function(){return new BPromise(function(_0x5cc418,_0x8be3c7){rimraf(_0x520662,function(_0x13e815){if(_0x13e815)_0x8be3c7(_0x13e815);return _0x5cc418();});});})['then'](function(){return _0x3810f1[_0xbb58('0xc5')](_0x47c2ca,_0x2968e3,function(_0x123236){if(_0x123236){console[_0xbb58('0xe9')](_0xbb58('0xea'),_0x123236);}else{fs[_0xbb58('0xeb')](_0x47c2ca);}});});});}else{return _0x3810f1[_0xbb58('0x1d')](0xc8);}})[_0xbb58('0x35')](handleError(_0x3810f1,null));}; \ No newline at end of file +var _0x8ce3=['then','error','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','SmsMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','format','transcript-%d-%s.zip','User','fullname','firstName','lastName','Messages','direction','secret','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','../../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','./smsInteraction.socket','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x8ce3,0xc3));var _0x38ce=function(_0xc9c8ca,_0xbc7ae3){_0xc9c8ca=_0xc9c8ca-0x0;var _0x59fc76=_0x8ce3[_0xc9c8ca];return _0x59fc76;};'use strict';var pdf=require(_0x38ce('0x0'));var emlformat=require(_0x38ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ce('0x2'));var jsonpatch=require(_0x38ce('0x3'));var rp=require(_0x38ce('0x4'));var moment=require(_0x38ce('0x5'));var BPromise=require(_0x38ce('0x6'));var Mustache=require(_0x38ce('0x7'));var util=require(_0x38ce('0x8'));var path=require(_0x38ce('0x9'));var sox=require('sox');var csv=require(_0x38ce('0xa'));var ejs=require(_0x38ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xa'));var querystring=require('querystring');var Papa=require(_0x38ce('0xf'));var Redis=require('ioredis');var authService=require(_0x38ce('0x10'));var qs=require(_0x38ce('0x11'));var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require(_0x38ce('0x17'));var db=require(_0x38ce('0x18'))['db'];config[_0x38ce('0x19')]=_[_0x38ce('0x1a')](config[_0x38ce('0x19')],{'host':_0x38ce('0x1b'),'port':0x18eb});var socket=require(_0x38ce('0x1c'))(new Redis(config[_0x38ce('0x19')]));require(_0x38ce('0x1d'))['register'](socket);function respondWithStatusCode(_0x48ba7c,_0x3c4d7f){_0x3c4d7f=_0x3c4d7f||0xcc;return function(_0x2aabd8){if(_0x2aabd8){return _0x48ba7c[_0x38ce('0x1e')](_0x3c4d7f);}return _0x48ba7c['status'](_0x3c4d7f)[_0x38ce('0x1f')]();};}function respondWithResult(_0x54fcd3,_0x2771ec){_0x2771ec=_0x2771ec||0xc8;return function(_0xe858f0){if(_0xe858f0){return _0x54fcd3['status'](_0x2771ec)[_0x38ce('0x20')](_0xe858f0);}};}function respondWithFilteredResult(_0x2dddc1,_0x1dfaba){return function(_0x51f670){if(_0x51f670){var _0xe4099a=_0x51f670[_0x38ce('0x21')],_0x2efd6f=_0x1dfaba[_0x38ce('0x22')],_0x3df527=_0x1dfaba[_0x38ce('0x22')]+_0x1dfaba['limit'],_0x311734;if(_0x3df527>=_0xe4099a){_0x3df527=_0xe4099a;_0x311734=0xc8;}else{_0x311734=0xce;}_0x2dddc1[_0x38ce('0x23')](_0x311734);return _0x2dddc1[_0x38ce('0x24')](_0x38ce('0x25'),_0x2efd6f+'-'+_0x3df527+'/'+_0xe4099a)[_0x38ce('0x20')](_0x51f670);}return null;};}function patchUpdates(_0x30b060){return function(_0x434c31){try{jsonpatch[_0x38ce('0x26')](_0x434c31,_0x30b060,!![]);}catch(_0x42ec06){return BPromise[_0x38ce('0x27')](_0x42ec06);}return _0x434c31[_0x38ce('0x28')]();};}function saveUpdates(_0x1aace7,_0x580cf3){return function(_0x1cc10b){if(_0x1cc10b){return _0x1cc10b[_0x38ce('0x29')](_0x1aace7)[_0x38ce('0x2a')](function(_0xcf5d9e){return _0xcf5d9e;});}return null;};}function removeEntity(_0x4a56b0,_0x2c85e6){return function(_0x1d192d){if(_0x1d192d){return _0x1d192d['destroy']()[_0x38ce('0x2a')](function(){_0x4a56b0[_0x38ce('0x23')](0xcc)[_0x38ce('0x1f')]();});}};}function handleEntityNotFound(_0x5b330c,_0x4a7e8e){return function(_0x3f3516){if(!_0x3f3516){_0x5b330c[_0x38ce('0x1e')](0x194);}return _0x3f3516;};}function handleError(_0x142d72,_0x21d4e7){_0x21d4e7=_0x21d4e7||0x1f4;return function(_0x264cf0){logger[_0x38ce('0x2b')](_0x264cf0[_0x38ce('0x2c')]);if(_0x264cf0[_0x38ce('0x2d')]){delete _0x264cf0[_0x38ce('0x2d')];}_0x142d72[_0x38ce('0x23')](_0x21d4e7)[_0x38ce('0x2e')](_0x264cf0);};}function getInteractionUsers(_0x381703,_0x50692a){return new BPromise(function(_0x1212dd,_0x1538a0){try{if(_0x50692a[_0x381703['id']]){_0x381703['Users']=_[_0x38ce('0x2f')](_0x50692a[_0x381703['id']],function(_0x3cbead){return{'id':_0x3cbead['id'],'fullname':_0x3cbead['fullname']};});}}catch(_0xd96d33){_0x1538a0(_0xd96d33);}_0x1212dd(_0x381703);});}function getInteractionTags(_0x282ee4,_0x568d94){return new BPromise(function(_0x28d775,_0x53f2c9){try{if(_0x282ee4[_0x38ce('0x30')]){_0x282ee4[_0x38ce('0x31')]=[];_0x282ee4[_0x38ce('0x30')][_0x38ce('0x32')](',')[_0x38ce('0x33')](function(_0x23019f){_0x282ee4[_0x38ce('0x31')][_0x38ce('0x34')](_0x568d94[_0x23019f]);});}delete _0x282ee4['TagIds'];}catch(_0x4e5bf6){_0x53f2c9(_0x4e5bf6);}_0x28d775(_0x282ee4);});}function updateSmsInteraction(_0x469b65,_0xc4dd0f,_0x3cba20){return new BPromise(function(_0x34cb97,_0x3fe430){return getInteractionUsers(_0x469b65,_0x3cba20)['then'](function(_0x23208f){return getInteractionTags(_0x23208f,_0xc4dd0f);})[_0x38ce('0x2a')](function(_0x37f696){_0x34cb97(_0x37f696);})[_0x38ce('0x35')](function(_0x3a4895){_0x3fe430(_0x3a4895);});});}exports[_0x38ce('0x36')]=function(_0x3d7f64,_0x54050a){var _0x2297e5={},_0x73cbd2={},_0x5b8c69={'count':0x0,'rows':[]};var _0x3069aa=_[_0x38ce('0x2f')](db[_0x38ce('0x37')][_0x38ce('0x38')],function(_0x1eb47e){return{'name':_0x1eb47e[_0x38ce('0x39')],'type':_0x1eb47e[_0x38ce('0x3a')][_0x38ce('0x3b')]};});_0x73cbd2['model']=_[_0x38ce('0x2f')](_0x3069aa,_0x38ce('0x2d'));_0x73cbd2[_0x38ce('0x3c')]=_[_0x38ce('0x3d')](_0x3d7f64['query']);_0x73cbd2[_0x38ce('0x3e')]=_['intersection'](_0x73cbd2[_0x38ce('0x3f')],_0x73cbd2[_0x38ce('0x3c')]);_0x2297e5[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x73cbd2[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x3d7f64['query'][_0x38ce('0x42')]));_0x2297e5['attributes']=_0x2297e5[_0x38ce('0x40')][_0x38ce('0x43')]?_0x2297e5[_0x38ce('0x40')]:_0x73cbd2[_0x38ce('0x3f')];if(!_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x44')]('nolimit')){_0x2297e5[_0x38ce('0x45')]=qs[_0x38ce('0x45')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x2297e5[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x3d7f64['query']['offset']);}_0x2297e5[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x47')]);_0x2297e5[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x3d7f64['query'],_0x73cbd2[_0x38ce('0x3e')]),_0x3069aa);var _0x30cfe3=[];var _0x5a689b=squel[_0x38ce('0x4a')]()[_0x38ce('0x4b')]('id')[_0x38ce('0x4b')]('name')[_0x38ce('0x4b')](_0x38ce('0x4c'))[_0x38ce('0x4d')](_0x38ce('0x4e'));var _0x24cf78=squel[_0x38ce('0x4a')]()['field'](_0x38ce('0x4f'))[_0x38ce('0x4b')](_0x38ce('0x50'))[_0x38ce('0x4b')](_0x38ce('0x51'))[_0x38ce('0x4d')]('user_has_sms_interactions','ui')[_0x38ce('0x52')](_0x38ce('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x502430=squel['select']()[_0x38ce('0x4d')](_0x38ce('0x54'),'i')['left_join']('cm_contacts','c',_0x38ce('0x55'))['left_join'](_0x38ce('0x53'),'o','o.id\x20=\x20i.UserId')[_0x38ce('0x52')](_0x38ce('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0x38ce('0x52')](_0x38ce('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x38ce('0x52')](_0x38ce('0x58'),'it',_0x38ce('0x59'))[_0x38ce('0x52')](_0x38ce('0x4e'),'t',_0x38ce('0x5a'));var _0x58cc6f=squel[_0x38ce('0x5b')]();var _0x1d25b2=[];var _0x53bbc3=squel[_0x38ce('0x5b')]();var _0x316eec;if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]){_0x316eec=as[_0x38ce('0x5d')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]);var _0x5f2e8d=_0x316eec[_0x38ce('0x5e')];for(var _0x34a118=0x0;_0x34a118<_0x316eec[_0x38ce('0x5f')][_0x38ce('0x43')];_0x34a118++){var _0x2264f9=_0x316eec[_0x38ce('0x5f')][_0x34a118];var _0x5f145d='i';var _0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x2264f9[_0x38ce('0x4b')]]);if(!_0x50c3b8){switch(_0x2264f9[_0x38ce('0x4b')]){case _0x38ce('0x61'):if(_0x2264f9[_0x38ce('0x62')]==0x1){_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x63'));}else{_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x64'));}break;case _0x38ce('0x65'):if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){if(_0x2264f9[_0x38ce('0x62')]['split']('\x20')[_0x38ce('0x43')]>0x1){_0x58cc6f[_0x5f2e8d](_0x38ce('0x68'),qs[_0x38ce('0x69')](_0x2264f9[_0x38ce('0x62')]),null);}else{var _0x6b381f='%'+_0x2264f9[_0x38ce('0x62')]+'%';_0x58cc6f[_0x5f2e8d](_0x38ce('0x6a'),_0x6b381f,_0x6b381f,_0x6b381f);}}else{_0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x38ce('0x6b')]);_0x2264f9[_0x38ce('0x4b')]='ContactId';_0x51adaa=as['buildExpression'](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);}break;case _0x38ce('0x6e'):var _0x3b4e47=_0x2264f9[_0x38ce('0x62')][_0x38ce('0x32')](',')[_0x38ce('0x2f')](function(_0x1534ca){return Number(_0x1534ca);});_0x3b4e47['forEach'](function(_0x7f2eea){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x7f2eea+',%');});_0x1d25b2=_['union'](_0x1d25b2,_0x3b4e47);break;case'User':if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){_0x58cc6f[_0x5f2e8d](_0x38ce('0x70'),'%'+_0x2264f9['value']+'%',null);}else{_0x50c3b8=_['find'](_0x3069aa,[_0x38ce('0x2d'),'UserId']);_0x2264f9[_0x38ce('0x4b')]=_0x38ce('0x71');_0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa['text'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa[_0x38ce('0x62')]['end']);}break;case _0x38ce('0x73'):_0x51adaa=as[_0x38ce('0x72')]('me',null,_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa['value'][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);break;}}else{var _0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')]['start'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x1f')]);}}}else{var _0x425002=_(_0x3d7f64[_0x38ce('0x3c')])[_0x38ce('0x3d')]()[_0x38ce('0x2f')](function(_0x5b8fb5){return _[_0x38ce('0x74')](_0x3069aa,['name',_0x5b8fb5])?_0x5b8fb5:undefined;})[_0x38ce('0x75')]()[_0x38ce('0x62')]();if(!_[_0x38ce('0x76')](_0x425002)){_0x425002[_0x38ce('0x33')](function(_0x32290f){if(_0x32290f===_0x38ce('0x77')){_0x502430[_0x38ce('0x48')](_0x38ce('0x78'),[]['concat'](_0x3d7f64[_0x38ce('0x3c')][_0x32290f]));}else if(_0x32290f===_0x38ce('0x79')){var _0x204e91=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7b')];var _0x3122da=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7c')];_0x502430[_0x38ce('0x48')](_0x38ce('0x7d'),_0x204e91,_0x3122da);}else{if(_0x3d7f64[_0x38ce('0x3c')][_0x32290f]===_0x38ce('0x7e')){_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x7f'));}else{_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x80'),_0x3d7f64[_0x38ce('0x3c')][_0x32290f]);}}});}if(_0x3d7f64[_0x38ce('0x3c')]['read']){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x81')]==0x1){_0x502430[_0x38ce('0x82')]('`unreadMessages`\x20=\x200');}else{_0x502430['having'](_0x38ce('0x83'));}}if(_0x3d7f64[_0x38ce('0x3c')]['tag']){_0x1d25b2=_[_0x38ce('0x84')](_0x3d7f64[_0x38ce('0x3c')]['tag'])?_0x3d7f64['query'][_0x38ce('0x85')]:new Array(_0x3d7f64[_0x38ce('0x3c')]['tag']);_0x1d25b2[_0x38ce('0x33')](function(_0x2732ac){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x2732ac+',%');});}if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]){var _0x163d35=_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]['replace']('\x5c','\x5c\x5c')[_0x38ce('0x87')]('\x27\x27',_0x38ce('0x88'));if(qs[_0x38ce('0x89')](_0x163d35)){_0x58cc6f['or'](_0x38ce('0x8a'),_0x163d35+'%')['or'](_0x38ce('0x8b'),_0x163d35+'%');}else{_0x58cc6f['or'](_0x38ce('0x8c'),qs[_0x38ce('0x69')](_0x163d35))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x163d35+'%');}}}_0x502430['where'](_0x58cc6f);_0x502430['group'](_0x38ce('0x8d'));var _0x384671={'type':db[_0x38ce('0x8e')][_0x38ce('0x8f')][_0x38ce('0x90')],'raw':!![]};var _0x26ca11=_0x502430[_0x38ce('0x91')]();_0x26ca11['field'](_0x38ce('0x8d'));_0x26ca11['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2297e5[_0x38ce('0x46')]){_0x2297e5[_0x38ce('0x46')][_0x38ce('0x33')](function(_0x585fe0){_0x502430[_0x38ce('0x46')]('i.'+_0x585fe0[0x0],_0x585fe0[0x1]===_0x38ce('0x92')?![]:!![]);});}if(!_[_0x38ce('0x76')](_0x1d25b2)){_0x502430[_0x38ce('0x82')](_0x53bbc3);_0x26ca11[_0x38ce('0x48')]('t.id\x20IN\x20?',_0x1d25b2);}BPromise[_0x38ce('0x93')]()['then'](function(){if(!_0x316eec){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x77')]||_0x3d7f64['query'][_0x38ce('0x94')])return;_0x26ca11[_0x38ce('0x48')](_0x38ce('0x95'));_0x502430[_0x38ce('0x48')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d7f64['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4961b8){if(_['isEmpty'](_0x4961b8)){_0x26ca11[_0x38ce('0x48')](_0x38ce('0x96'));_0x502430[_0x38ce('0x48')](_0x38ce('0x96'));}else{_0x26ca11['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));_0x502430['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));}});})[_0x38ce('0x2a')](function(){db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x26ca11[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x386b51){_0x5b8c69[_0x38ce('0x21')]=_0x386b51['length'];if(_0x5b8c69[_0x38ce('0x21')]===0x0)return[];return db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x5a689b['toString'](),_0x384671)['then'](function(_0x4fa65f){_0x30cfe3=_[_0x38ce('0x99')](_0x4fa65f,'id');_0x384671=_[_0x38ce('0x9a')](_0x384671,{'model':db[_0x38ce('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x42')]){_0x2297e5[_0x38ce('0x40')][_0x38ce('0x33')](function(_0x345ba4){_0x502430[_0x38ce('0x4b')]('i.'+_0x345ba4);});}else{_0x502430[_0x38ce('0x4b')](_0x38ce('0x9b'),_0x38ce('0x61'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9c'),_0x38ce('0x9d'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9e'),_0x38ce('0x9f'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa0'));_0x502430['field'](_0x38ce('0xa1'),_0x38ce('0xa2'));_0x502430[_0x38ce('0x4b')]('c.lastName',_0x38ce('0xa3'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa4'),_0x38ce('0xa5'));_0x502430['field'](_0x38ce('0xa6'),_0x38ce('0xa7'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa8'),'Contact.mobile');_0x502430[_0x38ce('0x4b')](_0x38ce('0xa9'),_0x38ce('0xaa'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xab'),_0x38ce('0xac'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xad'),_0x38ce('0xae'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xaf'),_0x38ce('0x30'));}if(_0x2297e5['limit'])_0x502430[_0x38ce('0x45')](_0x2297e5[_0x38ce('0x45')]);if(_0x2297e5[_0x38ce('0x22')])_0x502430[_0x38ce('0x22')](_0x2297e5[_0x38ce('0x22')]);return db['sequelize']['query'](_0x502430[_0x38ce('0x98')](),_0x384671);})['then'](function(_0xed7dcc){_0x24cf78[_0x38ce('0x48')]('ui.SmsInteractionId\x20IN\x20?',_[_0x38ce('0x2f')](_0xed7dcc,'id'));return db[_0x38ce('0x97')]['query'](_0x24cf78[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x20db5f){var _0x3dc4e5=_[_0x38ce('0xb0')](_0x20db5f,_0x38ce('0xb1'));var _0x5b6014=[];_0xed7dcc[_0x38ce('0x33')](function(_0x2077ca){_0x5b6014['push'](updateSmsInteraction(_0x2077ca,_0x30cfe3,_0x3dc4e5));});return BPromise['all'](_0x5b6014);});});})[_0x38ce('0x2a')](function(_0x576530){_0x5b8c69[_0x38ce('0xb2')]=_0x576530;return _0x5b8c69;})[_0x38ce('0x2a')](respondWithFilteredResult(_0x54050a,_0x2297e5));})[_0x38ce('0x35')](handleError(_0x54050a,null));};exports[_0x38ce('0xb3')]=function(_0x1eab01,_0x20e6a4){var _0x46f224={'raw':![],'where':{'id':_0x1eab01[_0x38ce('0xb4')]['id']}},_0x4df3d5={};_0x4df3d5[_0x38ce('0x3f')]=_[_0x38ce('0x3d')](db['SmsInteraction'][_0x38ce('0x38')]);_0x4df3d5['query']=_[_0x38ce('0x3d')](_0x1eab01[_0x38ce('0x3c')]);_0x4df3d5['filters']=_['intersection'](_0x4df3d5[_0x38ce('0x3f')],_0x4df3d5['query']);_0x46f224[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x4df3d5[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x1eab01[_0x38ce('0x3c')]['fields']));_0x46f224[_0x38ce('0x40')]=_0x46f224[_0x38ce('0x40')][_0x38ce('0x43')]?_0x46f224['attributes']:_0x4df3d5['model'];if(_0x1eab01[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x46f224[_0x38ce('0xb6')]=[{'all':!![]}];}_0x46f224=_[_0x38ce('0x9a')]({},_0x46f224,_0x1eab01['options']);return db[_0x38ce('0x37')][_0x38ce('0x60')](_0x46f224)[_0x38ce('0x2a')](handleEntityNotFound(_0x20e6a4,null))[_0x38ce('0x2a')](respondWithResult(_0x20e6a4,null))['catch'](handleError(_0x20e6a4,null));};exports[_0x38ce('0xb7')]=function(_0x27fd03,_0x5d61ab){return db[_0x38ce('0x37')]['create'](_0x27fd03[_0x38ce('0x73')],{})['then'](respondWithResult(_0x5d61ab,0xc9))[_0x38ce('0x35')](handleError(_0x5d61ab,null));};exports[_0x38ce('0x29')]=function(_0x53d474,_0x192b69){if(_0x53d474['body']['id']){delete _0x53d474[_0x38ce('0x73')]['id'];}return db[_0x38ce('0x37')]['find']({'where':{'id':_0x53d474[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x192b69,null))['then'](saveUpdates(_0x53d474['body'],null))[_0x38ce('0x2a')](respondWithResult(_0x192b69,null))['catch'](handleError(_0x192b69,null));};exports['destroy']=function(_0x354543,_0x4390bc){return db[_0x38ce('0x37')]['find']({'where':{'id':_0x354543[_0x38ce('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4390bc,null))['then'](removeEntity(_0x4390bc,null))['catch'](handleError(_0x4390bc,null));};exports[_0x38ce('0xb8')]=function(_0x4f1c7e,_0x33dafc){return db[_0x38ce('0x37')][_0x38ce('0xb8')]()[_0x38ce('0x2a')](respondWithResult(_0x33dafc,null))['catch'](handleError(_0x33dafc,null));};exports[_0x38ce('0xb9')]=function(_0x2ef91e,_0xdca2f3,_0x3c98ae){return db[_0x38ce('0xba')][_0x38ce('0x60')]({'where':{'id':_0x2ef91e['params']['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0xdca2f3,null))['then'](function(_0x454596){if(_0x454596){return _0x454596[_0x38ce('0xb9')](_0x2ef91e[_0x38ce('0x73')][_0x38ce('0xbb')],_[_0x38ce('0xbc')](_0x2ef91e[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{});}})['then'](respondWithResult(_0xdca2f3,null))[_0x38ce('0x35')](handleError(_0xdca2f3,null));};exports[_0x38ce('0xbd')]=function(_0x4f2542,_0x32c0dd,_0x31ddf7){var _0x57ca62={'raw':![],'where':{}};var _0x14811b={};var _0x20f9bf={'count':0x0,'rows':[]};return db[_0x38ce('0x37')]['findOne']({'where':{'id':_0x4f2542[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x32c0dd,null))['then'](function(_0x2faf1e){if(_0x2faf1e){_0x14811b['model']=_[_0x38ce('0x3d')](db['SmsMessage'][_0x38ce('0x38')]);_0x14811b[_0x38ce('0x3c')]=_['keys'](_0x4f2542[_0x38ce('0x3c')]);_0x14811b[_0x38ce('0x3e')]=_[_0x38ce('0x41')](_0x14811b[_0x38ce('0x3f')],_0x14811b['query']);_0x57ca62[_0x38ce('0x40')]=_['intersection'](_0x14811b[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x42')]));_0x57ca62[_0x38ce('0x40')]=_0x57ca62[_0x38ce('0x40')][_0x38ce('0x43')]?_0x57ca62['attributes']:_0x14811b[_0x38ce('0x3f')];if(!_0x4f2542['query'][_0x38ce('0x44')](_0x38ce('0xbe'))){_0x57ca62[_0x38ce('0x45')]=qs['limit'](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x57ca62[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x22')]);}_0x57ca62[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x4f2542[_0x38ce('0x3c')]['sort']);_0x57ca62[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x4f2542[_0x38ce('0x3c')],_0x14811b[_0x38ce('0x3e')]));_0x57ca62['where'][_0x38ce('0xb1')]=_0x2faf1e['id'];if(_0x4f2542['query'][_0x38ce('0x86')]){_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],{'$or':_[_0x38ce('0x2f')](_0x57ca62[_0x38ce('0x40')],function(_0x2b67af){var _0x283d90={};_0x283d90[_0x2b67af]={'$like':'%'+_0x4f2542['query'][_0x38ce('0x86')]+'%'};return _0x283d90;})});}if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')]){var _0x569641=_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')][_0x38ce('0x32')](',');var _0x2a8203={};_0x2a8203[_0x569641[0x0]]={'$gte':moment(_0x569641[0x1])['format'](_0x38ce('0xbf'))};_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],_0x2a8203);}_0x57ca62=_[_0x38ce('0x9a')]({},_0x57ca62,_0x4f2542[_0x38ce('0xc0')]);return db[_0x38ce('0xba')]['count']({'where':_0x57ca62[_0x38ce('0x48')]})[_0x38ce('0x2a')](function(_0x3da4c7){_0x20f9bf['count']=_0x3da4c7;if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x57ca62['include']=[{'all':!![]}];}return db['SmsMessage'][_0x38ce('0xc1')](_0x57ca62);})[_0x38ce('0x2a')](function(_0x3d8dec){_0x20f9bf[_0x38ce('0xb2')]=_0x3d8dec;return _0x20f9bf;});}})['then'](respondWithFilteredResult(_0x32c0dd,_0x57ca62))[_0x38ce('0x35')](handleError(_0x32c0dd,null));};exports['addTags']=function(_0x4b0a3b,_0x37572e,_0x420457){return db[_0x38ce('0x37')][_0x38ce('0x60')]({'where':{'id':_0x4b0a3b['params']['id']}})['then'](handleEntityNotFound(_0x37572e,null))[_0x38ce('0x2a')](function(_0x162f5d){if(_0x162f5d){return _0x162f5d[_0x38ce('0xc2')](_0x4b0a3b[_0x38ce('0x73')]['ids'],_['omit'](_0x4b0a3b[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{})[_0x38ce('0xc3')](function(){return db[_0x38ce('0x6e')][_0x38ce('0xc1')]({'attributes':['id',_0x38ce('0x2d'),_0x38ce('0x4c')],'where':{'id':_0x4b0a3b[_0x38ce('0x73')]['ids']}});})[_0x38ce('0x2a')](function(_0x1c0372){socket['emit'](_0x38ce('0xc4'),{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]});return{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]};});}})[_0x38ce('0x2a')](respondWithResult(_0x37572e,null))['catch'](handleError(_0x37572e,null));};exports['removeTags']=function(_0x4a528f,_0x167030,_0x5af247){return db['SmsInteraction'][_0x38ce('0x60')]({'where':{'id':_0x4a528f[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x167030,null))[_0x38ce('0x2a')](function(_0x302600){if(_0x302600){return _0x302600[_0x38ce('0xc5')](_0x4a528f[_0x38ce('0x3c')][_0x38ce('0xbb')]);}})['then'](respondWithStatusCode(_0x167030,null))[_0x38ce('0x35')](handleError(_0x167030,null));};exports[_0x38ce('0xc6')]=function(_0x1042a4,_0x2f843b){var _0x1e976f=moment()[_0x38ce('0xc7')]()['toString']();var _0x1be555=path[_0x38ce('0xc8')](config['root'],_0x38ce('0xc9'),'files',_0x38ce('0xca'));var _0x45680c=path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],_0x38ce('0xc9'),_0x38ce('0xcc'),_0x38ce('0xcd'));var _0x4439b2=path['join'](_0x1be555,_0x1e976f);var _0xeec46=util[_0x38ce('0xce')](_0x38ce('0xcf'),_0x1042a4[_0x38ce('0xb4')]['id'],_0x1e976f);var _0x25072b=path['join'](_0x1be555,_0xeec46);var _0x2f8251=[];_0x2f8251[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':'User','attributes':['id',_0x38ce('0xd1')],'raw':!![]});_0x2f8251['push']({'model':db['CmContact'],'as':_0x38ce('0x65'),'attributes':['id',_0x38ce('0xd2'),_0x38ce('0xd3')],'raw':!![]});var _0x27f880=[{'model':db[_0x38ce('0xba')],'as':_0x38ce('0xd4'),'attributes':['id',_0x38ce('0x73'),_0x38ce('0x79'),_0x38ce('0xd5'),_0x38ce('0xd6'),'read'],'include':_0x2f8251}];_0x27f880[_0x38ce('0x34')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x27f880[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':_0x38ce('0xd7'),'attributes':['id',_0x38ce('0xd1')]});return db[_0x38ce('0x37')]['find']({'where':{'id':_0x1042a4[_0x38ce('0xb4')]['id']},'include':_0x27f880})['then'](handleEntityNotFound(_0x2f843b,null))['then'](function(_0x599fa7){if(_0x599fa7){var _0x279799=_0x599fa7[_0x38ce('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x4439b2);var _0x2686f2={'format':'A4','border':_0x38ce('0xd9'),'header':{'height':_0x38ce('0xda'),'contents':{'first':_0x38ce('0xdb')}},'footer':{'height':_0x38ce('0xdc'),'contents':{'default':util[_0x38ce('0xce')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x38ce('0xdd'),_0x38ce('0xde'),_0x279799['id']),moment()[_0x38ce('0xce')](_0x38ce('0xdf'))['toString']())}}};var _0x461da3={'channel':_0x38ce('0xde'),'account':_0x279799[_0x38ce('0xe0')]['name'],'agent':_0x279799[_0x38ce('0xd7')]?_0x279799['Owner'][_0x38ce('0xd1')]:_0x38ce('0xe1'),'createdAt':moment(_0x279799['createdAt'])['format'](_0x38ce('0xbf'))[_0x38ce('0x98')](),'closedAt':_0x279799[_0x38ce('0xe2')]?moment(_0x279799[_0x38ce('0xe3')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')]():'','disposition':_0x279799[_0x38ce('0xe4')],'messages':_(_0x279799[_0x38ce('0xd4')])[_0x38ce('0x86')]({'secret':![]})['map'](function(_0x5bb7e5){return{'date':moment(_0x5bb7e5[_0x38ce('0x79')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')](),'sender':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?_0x5bb7e5[_0x38ce('0xd0')]?_0x5bb7e5[_0x38ce('0xd0')][_0x38ce('0xd1')]:_0x38ce('0xe6'):_0x5bb7e5['Contact'][_0x38ce('0xd2')]+(_0x5bb7e5[_0x38ce('0x65')][_0x38ce('0xd3')]?'\x20'+_0x5bb7e5['Contact'][_0x38ce('0xd3')]:''),'body':_0x5bb7e5[_0x38ce('0x73')],'direction':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?'A':'C','secret':_0x5bb7e5['secret'],'read':_0x5bb7e5['read']};})['value']()};return ejs[_0x38ce('0xe7')](path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],'server',_0x38ce('0xe8'),'downloadInteraction.html'),{'interaction':_0x461da3})[_0x38ce('0x2a')](function(_0xd94aeb){return new BPromise(function(_0x27dde5,_0x169908){pdf[_0x38ce('0xb7')](_0xd94aeb,_0x2686f2)['toFile'](path[_0x38ce('0xc8')](_0x4439b2,'transcript-'+_0x279799['id']+'-'+_0x1e976f+_0x38ce('0xe9')),function(_0x292bb6,_0x317bf0){if(_0x292bb6)return _0x169908(_0x292bb6);_0x27dde5(_0x317bf0);});});})['then'](function(){return new BPromise(function(_0x4c6b80,_0x55050e){zipdir(_0x4439b2,{'saveTo':_0x25072b},function(_0x2bc199,_0x3d6817){if(_0x2bc199)return _0x55050e(_0x2bc199);return _0x4c6b80(_0x3d6817);});})[_0x38ce('0x2a')](function(){return new BPromise(function(_0x436315,_0x293123){rimraf(_0x4439b2,function(_0x182abc){if(_0x182abc)_0x293123(_0x182abc);return _0x436315();});});})[_0x38ce('0x2a')](function(){return _0x2f843b[_0x38ce('0xc6')](_0x25072b,_0xeec46,function(_0x585c9f){if(_0x585c9f){console[_0x38ce('0xea')](_0x38ce('0xeb'),_0x585c9f);}else{fs[_0x38ce('0xec')](_0x25072b);}});});});}else{return _0x2f843b['sendStatus'](0xc8);}})[_0x38ce('0x35')](handleError(_0x2f843b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0a6d7ed..62326ef 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 _0x8664=['remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update'];(function(_0x4c99b8,_0x50bb99){var _0x128ae0=function(_0x544c22){while(--_0x544c22){_0x4c99b8['push'](_0x4c99b8['shift']());}};_0x128ae0(++_0x50bb99);}(_0x8664,0x11a));var _0x4866=function(_0x57d54c,_0x5d4d7d){_0x57d54c=_0x57d54c-0x0;var _0x58fa2c=_0x8664[_0x57d54c];return _0x58fa2c;};'use strict';var EventEmitter=require(_0x4866('0x0'));var SmsInteraction=require(_0x4866('0x1'))['db'][_0x4866('0x2')];var SmsMessage=require(_0x4866('0x1'))['db'][_0x4866('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4866('0x4')](0x0);var events={'afterCreate':_0x4866('0x5'),'afterUpdate':_0x4866('0x6'),'afterDestroy':_0x4866('0x7')};function emitEvent(_0x4a2986){return function(_0x1d8d7a,_0x595c9d,_0x66b444){_0x1d8d7a[_0x4866('0x8')]({'attributes':['id'],'raw':!![]})[_0x4866('0x9')](function(_0x10f7c1){_0x1d8d7a[_0x4866('0xa')](_0x4866('0xb'),_0x10f7c1['map'](function(_0x4185f2){return{'id':_0x4185f2['id']};}));return SmsMessage[_0x4866('0xc')]({'where':{'SmsInteractionId':_0x1d8d7a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4866('0x9')](function(_0x20a1d7){_0x1d8d7a[_0x4866('0xa')]('unreadMessages',_0x20a1d7[_0x4866('0xd')]);SmsInteractionEvents[_0x4866('0xe')](_0x4a2986+':'+_0x1d8d7a['id'],_0x1d8d7a);SmsInteractionEvents['emit'](_0x4a2986,_0x1d8d7a);_0x66b444(null);})[_0x4866('0xf')](_0x66b444(null));};}for(var e in events){if(events[_0x4866('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xeec6=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','emit','hook'];(function(_0x1d053e,_0x3b452c){var _0x20267c=function(_0x13209e){while(--_0x13209e){_0x1d053e['push'](_0x1d053e['shift']());}};_0x20267c(++_0x3b452c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0xeec6[_0x273f88];return _0x177ca1;};'use strict';var EventEmitter=require(_0x6eec('0x0'));var SmsInteraction=require(_0x6eec('0x1'))['db'][_0x6eec('0x2')];var SmsMessage=require(_0x6eec('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6eec('0x3')](0x0);var events={'afterCreate':_0x6eec('0x4'),'afterUpdate':_0x6eec('0x5'),'afterDestroy':_0x6eec('0x6')};function emitEvent(_0x3e7b6b){return function(_0x2e450c,_0x4fedce,_0x185f31){_0x2e450c[_0x6eec('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a5e47){_0x2e450c[_0x6eec('0x8')](_0x6eec('0x9'),_0x5a5e47[_0x6eec('0xa')](function(_0x56e849){return{'id':_0x56e849['id']};}));return SmsMessage[_0x6eec('0xb')]({'where':{'SmsInteractionId':_0x2e450c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6eec('0xc')](function(_0x1c774d){_0x2e450c['setDataValue']('unreadMessages',_0x1c774d['length']);SmsInteractionEvents[_0x6eec('0xd')](_0x3e7b6b+':'+_0x2e450c['id'],_0x2e450c);SmsInteractionEvents[_0x6eec('0xd')](_0x3e7b6b,_0x2e450c);_0x185f31(null);})['catch'](_0x185f31(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x6eec('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ab42671..83e2748 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 _0xf6df=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','closed','closedAt'];(function(_0x1409cc,_0x5a6771){var _0x3e98e8=function(_0x3ee941){while(--_0x3ee941){_0x1409cc['push'](_0x1409cc['shift']());}};_0x3e98e8(++_0x5a6771);}(_0xf6df,0x134));var _0xff6d=function(_0x1ee83a,_0x45d104){_0x1ee83a=_0x1ee83a-0x0;var _0xb12159=_0xf6df[_0x1ee83a];return _0xb12159;};'use strict';var _=require(_0xff6d('0x0'));var util=require(_0xff6d('0x1'));var logger=require(_0xff6d('0x2'))(_0xff6d('0x3'));var moment=require(_0xff6d('0x4'));var BPromise=require(_0xff6d('0x5'));var rp=require(_0xff6d('0x6'));var fs=require('fs');var path=require(_0xff6d('0x7'));var rimraf=require(_0xff6d('0x8'));var config=require(_0xff6d('0x9'));var attributes=require(_0xff6d('0xa'));module['exports']=function(_0x56c5eb,_0x56e9d7){return _0x56c5eb[_0xff6d('0xb')](_0xff6d('0xc'),attributes,{'tableName':_0xff6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47f829,_0x4ef1c0,_0x4e7bec){if(_0x47f829['changed'](_0xff6d('0xe'))){_0x47f829[_0xff6d('0xf')]=moment()[_0xff6d('0x10')](_0xff6d('0x11'));}_0x4e7bec(null,_0x47f829);}}});}; \ No newline at end of file +var _0x953a=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsInteraction'];(function(_0x6eb2c1,_0x237cfd){var _0x2cd3d9=function(_0x40dabf){while(--_0x40dabf){_0x6eb2c1['push'](_0x6eb2c1['shift']());}};_0x2cd3d9(++_0x237cfd);}(_0x953a,0x72));var _0xa953=function(_0x42dd07,_0x21f9b4){_0x42dd07=_0x42dd07-0x0;var _0x172f84=_0x953a[_0x42dd07];return _0x172f84;};'use strict';var _=require(_0xa953('0x0'));var util=require(_0xa953('0x1'));var logger=require(_0xa953('0x2'))(_0xa953('0x3'));var moment=require(_0xa953('0x4'));var BPromise=require(_0xa953('0x5'));var rp=require(_0xa953('0x6'));var fs=require('fs');var path=require(_0xa953('0x7'));var rimraf=require(_0xa953('0x8'));var config=require(_0xa953('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x510ebb,_0xd40742){return _0x510ebb[_0xa953('0xa')](_0xa953('0xb'),attributes,{'tableName':_0xa953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x240ec6,_0x4eef28,_0xc81e24){if(_0x240ec6[_0xa953('0xd')](_0xa953('0xe'))){_0x240ec6[_0xa953('0xf')]=moment()[_0xa953('0x10')](_0xa953('0x11'));}_0xc81e24(null,_0x240ec6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d919151..fd82206 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 _0x68c9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','UpdateSmsInteraction','update','body','options','where','attributes','limit','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0xd274ec,_0x6b590b){var _0x5345c8=function(_0x3bf623){while(--_0x3bf623){_0xd274ec['push'](_0xd274ec['shift']());}};_0x5345c8(++_0x6b590b);}(_0x68c9,0x160));var _0x968c=function(_0x4581a0,_0x1ab944){_0x4581a0=_0x4581a0-0x0;var _0x1831f3=_0x68c9[_0x4581a0];return _0x1831f3;};'use strict';var _=require(_0x968c('0x0'));var util=require(_0x968c('0x1'));var moment=require(_0x968c('0x2'));var BPromise=require(_0x968c('0x3'));var rs=require(_0x968c('0x4'));var fs=require('fs');var Redis=require(_0x968c('0x5'));var db=require(_0x968c('0x6'))['db'];var utils=require(_0x968c('0x7'));var logger=require('../../config/logger')(_0x968c('0x8'));var config=require(_0x968c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x968c('0xa')][_0x968c('0xb')]({'port':0x232a});config[_0x968c('0xc')]=_[_0x968c('0xd')](config[_0x968c('0xc')],{'host':_0x968c('0xe'),'port':0x18eb});var socket=require(_0x968c('0xf'))(new Redis(config[_0x968c('0xc')]));require(_0x968c('0x10'))[_0x968c('0x11')](socket);function respondWithRpcPromise(_0x5921a3,_0x46ea13,_0x1b7dc6){return new BPromise(function(_0x3cd57a,_0x180886){return client[_0x968c('0x12')](_0x5921a3,_0x1b7dc6)[_0x968c('0x13')](function(_0x1443ab){logger['info'](_0x968c('0x14'),_0x46ea13,_0x968c('0x15'));logger[_0x968c('0x16')](_0x968c('0x17'),_0x46ea13,_0x968c('0x15'),JSON[_0x968c('0x18')](_0x1443ab));if(_0x1443ab[_0x968c('0x19')]){if(_0x1443ab['error']['code']===0x1f4){logger[_0x968c('0x19')](_0x968c('0x14'),_0x46ea13,_0x1443ab[_0x968c('0x19')]['message']);return _0x180886(_0x1443ab['error'][_0x968c('0x1a')]);}logger[_0x968c('0x19')](_0x968c('0x14'),_0x46ea13,_0x1443ab[_0x968c('0x19')]['message']);return _0x3cd57a(_0x1443ab['error'][_0x968c('0x1a')]);}else{logger[_0x968c('0x1b')](_0x968c('0x14'),_0x46ea13,_0x968c('0x15'));_0x3cd57a(_0x1443ab['result']['message']);}})['catch'](function(_0x400c19){logger[_0x968c('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x46ea13,_0x400c19);_0x180886(_0x400c19);});});}exports[_0x968c('0x1c')]=function(_0x2f5048){var _0x4311d6=this;return new Promise(function(_0x3a395c,_0x3db185){return db['SmsInteraction'][_0x968c('0x1d')](_0x2f5048[_0x968c('0x1e')],{'raw':_0x2f5048['options']?_0x2f5048[_0x968c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f5048[_0x968c('0x1f')]?_0x2f5048['options'][_0x968c('0x20')]||null:null,'attributes':_0x2f5048[_0x968c('0x1f')]?_0x2f5048['options'][_0x968c('0x21')]||null:null,'limit':_0x2f5048[_0x968c('0x1f')]?_0x2f5048['options'][_0x968c('0x22')]||null:null})[_0x968c('0x13')](function(_0x34c080){logger[_0x968c('0x1b')](_0x968c('0x1c'),_0x2f5048);logger['debug'](_0x968c('0x1c'),_0x2f5048,JSON[_0x968c('0x18')](_0x34c080));_0x3a395c(_0x34c080);})[_0x968c('0x23')](function(_0x191a79){logger[_0x968c('0x19')]('UpdateSmsInteraction',_0x191a79[_0x968c('0x1a')],_0x2f5048);_0x3db185(_0x4311d6['error'](0x1f4,_0x191a79[_0x968c('0x1a')]));});});};exports[_0x968c('0x24')]=function(_0x4187c8){return new Promise(function(_0x430a2a,_0x28bd5c){return db[_0x968c('0x25')][_0x968c('0x26')]({'where':_0x4187c8['options']?_0x4187c8[_0x968c('0x1f')][_0x968c('0x20')]||null:null})[_0x968c('0x13')](function(_0x3d5ed9){if(_0x3d5ed9){return _0x3d5ed9[_0x968c('0x27')](_0x4187c8[_0x968c('0x1e')][_0x968c('0x28')],_[_0x968c('0x29')](_0x4187c8[_0x968c('0x1e')],[_0x968c('0x28'),'id'])||{});}})[_0x968c('0x2a')](function(_0x137c4d){logger[_0x968c('0x1b')](_0x968c('0x2b'),_0x4187c8);logger[_0x968c('0x16')](_0x968c('0x2b'),_0x4187c8,JSON['stringify'](_0x137c4d));_0x430a2a(_0x137c4d);})[_0x968c('0x23')](function(_0x38481a){logger['error'](_0x968c('0x2b'),_0x38481a['message'],_0x4187c8);_0x28bd5c(_this[_0x968c('0x19')](0x1f4,_0x38481a['message']));});});}; \ No newline at end of file +var _0x2f7f=['stringify','error','message','result','catch','UpdateSmsInteraction','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x33fb32,_0x383e83){var _0x5f5de1=function(_0x403105){while(--_0x403105){_0x33fb32['push'](_0x33fb32['shift']());}};_0x5f5de1(++_0x383e83);}(_0x2f7f,0x1ad));var _0xf2f7=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x2f7f[_0x538c70];return _0x42ae01;};'use strict';var _=require(_0xf2f7('0x0'));var util=require('util');var moment=require(_0xf2f7('0x1'));var BPromise=require(_0xf2f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2f7('0x4'));var logger=require(_0xf2f7('0x5'))(_0xf2f7('0x6'));var config=require(_0xf2f7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf2f7('0x8')]({'port':0x232a});config[_0xf2f7('0x9')]=_[_0xf2f7('0xa')](config['redis'],{'host':_0xf2f7('0xb'),'port':0x18eb});var socket=require(_0xf2f7('0xc'))(new Redis(config['redis']));require(_0xf2f7('0xd'))[_0xf2f7('0xe')](socket);function respondWithRpcPromise(_0xbae09d,_0x392527,_0x238848){return new BPromise(function(_0x1064a5,_0x19d2d1){return client[_0xf2f7('0xf')](_0xbae09d,_0x238848)[_0xf2f7('0x10')](function(_0x98f8f7){logger[_0xf2f7('0x11')](_0xf2f7('0x12'),_0x392527,'request\x20sent');logger[_0xf2f7('0x13')](_0xf2f7('0x14'),_0x392527,_0xf2f7('0x15'),JSON[_0xf2f7('0x16')](_0x98f8f7));if(_0x98f8f7[_0xf2f7('0x17')]){if(_0x98f8f7[_0xf2f7('0x17')]['code']===0x1f4){logger[_0xf2f7('0x17')](_0xf2f7('0x12'),_0x392527,_0x98f8f7[_0xf2f7('0x17')][_0xf2f7('0x18')]);return _0x19d2d1(_0x98f8f7[_0xf2f7('0x17')][_0xf2f7('0x18')]);}logger['error'](_0xf2f7('0x12'),_0x392527,_0x98f8f7['error'][_0xf2f7('0x18')]);return _0x1064a5(_0x98f8f7['error'][_0xf2f7('0x18')]);}else{logger[_0xf2f7('0x11')](_0xf2f7('0x12'),_0x392527,_0xf2f7('0x15'));_0x1064a5(_0x98f8f7[_0xf2f7('0x19')]['message']);}})[_0xf2f7('0x1a')](function(_0x4e58bf){logger[_0xf2f7('0x17')](_0xf2f7('0x12'),_0x392527,_0x4e58bf);_0x19d2d1(_0x4e58bf);});});}exports[_0xf2f7('0x1b')]=function(_0x17fbd0){var _0x54bfdd=this;return new Promise(function(_0x1cac4e,_0x95ede5){return db['SmsInteraction']['update'](_0x17fbd0['body'],{'raw':_0x17fbd0[_0xf2f7('0x1c')]?_0x17fbd0[_0xf2f7('0x1c')][_0xf2f7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17fbd0[_0xf2f7('0x1c')]?_0x17fbd0[_0xf2f7('0x1c')][_0xf2f7('0x1e')]||null:null,'attributes':_0x17fbd0[_0xf2f7('0x1c')]?_0x17fbd0[_0xf2f7('0x1c')][_0xf2f7('0x1f')]||null:null,'limit':_0x17fbd0['options']?_0x17fbd0['options'][_0xf2f7('0x20')]||null:null})['then'](function(_0x28e31d){logger[_0xf2f7('0x11')](_0xf2f7('0x1b'),_0x17fbd0);logger['debug'](_0xf2f7('0x1b'),_0x17fbd0,JSON[_0xf2f7('0x16')](_0x28e31d));_0x1cac4e(_0x28e31d);})['catch'](function(_0x37cdb6){logger[_0xf2f7('0x17')]('UpdateSmsInteraction',_0x37cdb6[_0xf2f7('0x18')],_0x17fbd0);_0x95ede5(_0x54bfdd['error'](0x1f4,_0x37cdb6['message']));});});};exports[_0xf2f7('0x21')]=function(_0x166871){return new Promise(function(_0x3f7a3a,_0x4bd1d8){return db['SmsInteraction'][_0xf2f7('0x22')]({'where':_0x166871[_0xf2f7('0x1c')]?_0x166871[_0xf2f7('0x1c')][_0xf2f7('0x1e')]||null:null})[_0xf2f7('0x10')](function(_0x27b303){if(_0x27b303){return _0x27b303[_0xf2f7('0x23')](_0x166871[_0xf2f7('0x24')][_0xf2f7('0x25')],_[_0xf2f7('0x26')](_0x166871['body'],[_0xf2f7('0x25'),'id'])||{});}})[_0xf2f7('0x27')](function(_0x5528a2){logger[_0xf2f7('0x11')](_0xf2f7('0x28'),_0x166871);logger['debug'](_0xf2f7('0x28'),_0x166871,JSON['stringify'](_0x5528a2));_0x3f7a3a(_0x5528a2);})[_0xf2f7('0x1a')](function(_0x2b4273){logger[_0xf2f7('0x17')](_0xf2f7('0x28'),_0x2b4273['message'],_0x166871);_0x4bd1d8(_this[_0xf2f7('0x17')](0x1f4,_0x2b4273['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4594d43..6b1e5f0 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x13cac9,_0x5aa2c7){var _0x532aa7=function(_0x356307){while(--_0x356307){_0x13cac9['push'](_0x13cac9['shift']());}};_0x532aa7(++_0x5aa2c7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x47c616,_0x14efb5){var _0x19cbce=function(_0x24c429){while(--_0x24c429){_0x47c616['push'](_0x47c616['shift']());}};_0x19cbce(++_0x14efb5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ec9cc4d..815a573 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 _0xdcee=['/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show','tracked','sms','post'];(function(_0x2ea714,_0x485b81){var _0x3fdcdb=function(_0x4d00c4){while(--_0x4d00c4){_0x2ea714['push'](_0x2ea714['shift']());}};_0x3fdcdb(++_0x485b81);}(_0xdcee,0xee));var _0xedce=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0xdcee[_0x29fc2c];return _0x1adbc8;};'use strict';var multer=require(_0xedce('0x0'));var util=require('util');var path=require(_0xedce('0x1'));var timeout=require('connect-timeout');var express=require(_0xedce('0x2'));var router=express[_0xedce('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xedce('0x4'));var config=require(_0xedce('0x5'));var controller=require(_0xedce('0x6'));router[_0xedce('0x7')]('/',auth[_0xedce('0x8')](),controller[_0xedce('0x9')]);router['get']('/describe',auth[_0xedce('0x8')](),controller['describe']);router[_0xedce('0x7')](_0xedce('0xa'),auth[_0xedce('0x8')](),controller[_0xedce('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedce('0xc')](_0xedce('0xd'),'smsmessage:create'),controller['create']);router[_0xedce('0xe')](_0xedce('0xf'),controller[_0xedce('0x10')]);router[_0xedce('0x11')]('/:id',auth[_0xedce('0x8')](),controller['update']);router[_0xedce('0x11')](_0xedce('0x12'),auth[_0xedce('0x8')](),controller['accept']);router['put'](_0xedce('0x13'),auth[_0xedce('0x8')](),controller[_0xedce('0x14')]);router[_0xedce('0x15')](_0xedce('0xa'),auth[_0xedce('0x8')](),controller[_0xedce('0x16')]);module['exports']=router; \ No newline at end of file +var _0xed4e=['connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','destroy','path'];(function(_0x5417dc,_0x5761e2){var _0x496827=function(_0x50a470){while(--_0x50a470){_0x5417dc['push'](_0x5417dc['shift']());}};_0x496827(++_0x5761e2);}(_0xed4e,0xdb));var _0xeed4=function(_0x2c3e6f,_0x390b95){_0x2c3e6f=_0x2c3e6f-0x0;var _0x420c17=_0xed4e[_0x2c3e6f];return _0x420c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeed4('0x0'));var timeout=require(_0xeed4('0x1'));var express=require('express');var router=express[_0xeed4('0x2')]();var auth=require(_0xeed4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeed4('0x4'));var controller=require(_0xeed4('0x5'));router[_0xeed4('0x6')]('/',auth[_0xeed4('0x7')](),controller[_0xeed4('0x8')]);router[_0xeed4('0x6')]('/describe',auth[_0xeed4('0x7')](),controller['describe']);router[_0xeed4('0x6')](_0xeed4('0x9'),auth['isAuthenticated'](),controller[_0xeed4('0xa')]);router[_0xeed4('0xb')]('/',auth['isAuthenticated'](),interaction[_0xeed4('0xc')]('sms','smsmessage:create'),controller[_0xeed4('0xd')]);router[_0xeed4('0xb')](_0xeed4('0xe'),controller[_0xeed4('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeed4('0x10')]);router[_0xeed4('0x11')](_0xeed4('0x12'),auth[_0xeed4('0x7')](),controller[_0xeed4('0x13')]);router['put'](_0xeed4('0x14'),auth[_0xeed4('0x7')](),controller['reject']);router['delete']('/:id',auth[_0xeed4('0x7')](),controller[_0xeed4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f122ac8..63eff05 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 _0xe4ab=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x236f5a,_0x59508b){var _0x31b1df=function(_0x357004){while(--_0x357004){_0x236f5a['push'](_0x236f5a['shift']());}};_0x31b1df(++_0x59508b);}(_0xe4ab,0x17d));var _0xbe4a=function(_0xda635e,_0x238c4a){_0xda635e=_0xda635e-0x0;var _0x4c8a19=_0xe4ab[_0xda635e];return _0x4c8a19;};'use strict';var Sequelize=require(_0xbe4a('0x0'));module['exports']={'body':{'type':Sequelize[_0xbe4a('0x1')](_0xbe4a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbe4a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe4a('0x4')]('in',_0xbe4a('0x5')),'defaultValue':_0xbe4a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbe4a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xbe4a('0x6')]},'readAt':{'type':Sequelize[_0xbe4a('0x7')]},'secret':{'type':Sequelize[_0xbe4a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x02a7=['sequelize','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x1ac926,_0x40a7d3){var _0x327424=function(_0xba918a){while(--_0xba918a){_0x1ac926['push'](_0x1ac926['shift']());}};_0x327424(++_0x40a7d3);}(_0x02a7,0x1a4));var _0x702a=function(_0x78a1d5,_0x2b5639){_0x78a1d5=_0x78a1d5-0x0;var _0x393d04=_0x02a7[_0x78a1d5];return _0x393d04;};'use strict';var Sequelize=require(_0x702a('0x0'));module['exports']={'body':{'type':Sequelize[_0x702a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x702a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x702a('0x3')]('in',_0x702a('0x4')),'defaultValue':_0x702a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x702a('0x5')](0xbe)},'phone':{'type':Sequelize[_0x702a('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x702a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4ee910a..4c76d1d 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 _0x4bde=['rejectMessage','interface','channel','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','SmsMessage','fieldName','type','map','query','keys','intersection','attributes','fields','model','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rawAttributes','length','find','create','body','update','params','describe','sms-interactions','accept','read','readAt','format','UserId','user','CmContact','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','interaction','AcceptMessage','acceptMessage','manual','SIP/%s','event','EventManager','acceptmessage','sms','agent','null','RejectMessage'];(function(_0x3d4364,_0x5a159d){var _0x55311e=function(_0x3c0aff){while(--_0x3c0aff){_0x3d4364['push'](_0x3d4364['shift']());}};_0x55311e(++_0x5a159d);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x4bde[_0x5976f8];return _0x179715;};'use strict';var pdf=require(_0xe4bd('0x0'));var emlformat=require(_0xe4bd('0x1'));var rimraf=require(_0xe4bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4bd('0x3'));var rp=require(_0xe4bd('0x4'));var moment=require(_0xe4bd('0x5'));var BPromise=require(_0xe4bd('0x6'));var Mustache=require('mustache');var util=require(_0xe4bd('0x7'));var path=require(_0xe4bd('0x8'));var sox=require(_0xe4bd('0x9'));var csv=require(_0xe4bd('0xa'));var ejs=require(_0xe4bd('0xb'));var fs=require('fs');var _=require(_0xe4bd('0xc'));var squel=require('squel');var crypto=require(_0xe4bd('0xd'));var jsforce=require(_0xe4bd('0xe'));var deskjs=require(_0xe4bd('0xf'));var toCsv=require(_0xe4bd('0xa'));var querystring=require(_0xe4bd('0x10'));var Papa=require(_0xe4bd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4bd('0x12'));var hardwareService=require(_0xe4bd('0x13'));var logger=require(_0xe4bd('0x14'))('api');var utils=require(_0xe4bd('0x15'));var config=require(_0xe4bd('0x16'));var db=require(_0xe4bd('0x17'))['db'];config[_0xe4bd('0x18')]=_['defaults'](config[_0xe4bd('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4bd('0x19'))(new Redis(config['redis']));require(_0xe4bd('0x1a'))[_0xe4bd('0x1b')](socket);var jayson=require(_0xe4bd('0x1c'));var client=jayson[_0xe4bd('0x1d')][_0xe4bd('0x1e')]({'port':0x232c});var client9002=jayson[_0xe4bd('0x1d')][_0xe4bd('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x44ef1d,_0x193221,_0x2476f){if(_0x2476f){var _0x355922=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x355922[_0xe4bd('0x1f')](_0x193221)){return _0x44ef1d;}else{throw new db[(_0xe4bd('0x20'))]['ValidationError'](_0xe4bd('0x21'));}}else{return _0x44ef1d;}}function respondWithRpcPromise(_0x3009b9,_0x5982f4,_0x1731a1,_0x3dccd4){return new BPromise(function(_0x544b3c,_0x1ab4bc){var _0x56d572=_0x3dccd4||client;return _0x56d572['request'](_0x3009b9,_0x1731a1)[_0xe4bd('0x22')](function(_0x339fb7){logger[_0xe4bd('0x23')](_0xe4bd('0x24'),_0x5982f4,_0xe4bd('0x25'));logger[_0xe4bd('0x26')](_0xe4bd('0x27'),_0x5982f4,'request\x20sent',JSON[_0xe4bd('0x28')](_0x339fb7));if(_0x339fb7[_0xe4bd('0x29')]){if(_0x339fb7['error'][_0xe4bd('0x2a')]===0x1f4){logger[_0xe4bd('0x29')](_0xe4bd('0x24'),_0x5982f4,_0x339fb7[_0xe4bd('0x29')][_0xe4bd('0x2b')]);return _0x1ab4bc(_0x339fb7[_0xe4bd('0x29')][_0xe4bd('0x2b')]);}logger[_0xe4bd('0x29')](_0xe4bd('0x24'),_0x5982f4,_0x339fb7['error'][_0xe4bd('0x2b')]);return _0x544b3c(_0x339fb7[_0xe4bd('0x29')]['message']);}else{logger[_0xe4bd('0x23')](_0xe4bd('0x24'),_0x5982f4,_0xe4bd('0x25'));_0x544b3c(_0x339fb7[_0xe4bd('0x2c')][_0xe4bd('0x2b')]);}})[_0xe4bd('0x2d')](function(_0x40e9c7){logger[_0xe4bd('0x29')]('SmsMessage,\x20%s,\x20%s',_0x5982f4,_0x40e9c7);_0x1ab4bc(_0x40e9c7);});});}function respondWithStatusCode(_0x3eb927,_0x234b73){_0x234b73=_0x234b73||0xcc;return function(_0x1e04e7){if(_0x1e04e7){return _0x3eb927[_0xe4bd('0x2e')](_0x234b73);}return _0x3eb927[_0xe4bd('0x2f')](_0x234b73)[_0xe4bd('0x30')]();};}function respondWithResult(_0x243da2,_0x13d93a){_0x13d93a=_0x13d93a||0xc8;return function(_0x56dcde){if(_0x56dcde){return _0x243da2[_0xe4bd('0x2f')](_0x13d93a)[_0xe4bd('0x31')](_0x56dcde);}};}function respondWithFilteredResult(_0x10c2b0,_0xaad372){return function(_0x42f69b){if(_0x42f69b){var _0x1367a0=_0x42f69b[_0xe4bd('0x32')],_0x357af1=_0xaad372[_0xe4bd('0x33')],_0x3a9aa3=_0xaad372[_0xe4bd('0x33')]+_0xaad372['limit'],_0x34b558;if(_0x3a9aa3>=_0x1367a0){_0x3a9aa3=_0x1367a0;_0x34b558=0xc8;}else{_0x34b558=0xce;}_0x10c2b0['status'](_0x34b558);return _0x10c2b0[_0xe4bd('0x34')](_0xe4bd('0x35'),_0x357af1+'-'+_0x3a9aa3+'/'+_0x1367a0)[_0xe4bd('0x31')](_0x42f69b);}return null;};}function patchUpdates(_0x59c77f){return function(_0x5a0045){try{jsonpatch[_0xe4bd('0x36')](_0x5a0045,_0x59c77f,!![]);}catch(_0x3daae6){return BPromise[_0xe4bd('0x37')](_0x3daae6);}return _0x5a0045[_0xe4bd('0x38')]();};}function saveUpdates(_0x1c30c3,_0x320090){return function(_0xe6d43d){if(_0xe6d43d){return _0xe6d43d['update'](_0x1c30c3)['then'](function(_0x52c1b2){return _0x52c1b2;});}return null;};}function removeEntity(_0x3f6bd6,_0x5b4095){return function(_0x55f039){if(_0x55f039){return _0x55f039[_0xe4bd('0x39')]()[_0xe4bd('0x22')](function(){_0x3f6bd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x74095c,_0x1bda39){return function(_0x534000){if(!_0x534000){_0x74095c[_0xe4bd('0x2e')](0x194);}return _0x534000;};}function handleError(_0x297829,_0x341862){_0x341862=_0x341862||0x1f4;return function(_0xd88f94){logger[_0xe4bd('0x29')](_0xd88f94[_0xe4bd('0x3a')]);if(_0xd88f94[_0xe4bd('0x3b')]){delete _0xd88f94[_0xe4bd('0x3b')];}_0x297829[_0xe4bd('0x2f')](_0x341862)[_0xe4bd('0x3c')](_0xd88f94);};}exports[_0xe4bd('0x3d')]=function(_0x82480b,_0x249976){var _0x3d0cd0={},_0x5eda66={},_0x1c5d8b={'count':0x0,'rows':[]};var _0x25b98b=_['map'](db[_0xe4bd('0x3e')]['rawAttributes'],function(_0x426098){return{'name':_0x426098[_0xe4bd('0x3f')],'type':_0x426098[_0xe4bd('0x40')]['key']};});_0x5eda66['model']=_[_0xe4bd('0x41')](_0x25b98b,_0xe4bd('0x3b'));_0x5eda66[_0xe4bd('0x42')]=_[_0xe4bd('0x43')](_0x82480b['query']);_0x5eda66['filters']=_[_0xe4bd('0x44')](_0x5eda66['model'],_0x5eda66[_0xe4bd('0x42')]);_0x3d0cd0[_0xe4bd('0x45')]=_[_0xe4bd('0x44')](_0x5eda66['model'],qs['fields'](_0x82480b[_0xe4bd('0x42')][_0xe4bd('0x46')]));_0x3d0cd0[_0xe4bd('0x45')]=_0x3d0cd0[_0xe4bd('0x45')]['length']?_0x3d0cd0[_0xe4bd('0x45')]:_0x5eda66[_0xe4bd('0x47')];if(!_0x82480b[_0xe4bd('0x42')][_0xe4bd('0x48')]('nolimit')){_0x3d0cd0[_0xe4bd('0x49')]=qs[_0xe4bd('0x49')](_0x82480b['query'][_0xe4bd('0x49')]);_0x3d0cd0[_0xe4bd('0x33')]=qs[_0xe4bd('0x33')](_0x82480b[_0xe4bd('0x42')][_0xe4bd('0x33')]);}_0x3d0cd0[_0xe4bd('0x4a')]=qs[_0xe4bd('0x4b')](_0x82480b['query'][_0xe4bd('0x4b')]);_0x3d0cd0[_0xe4bd('0x4c')]=qs[_0xe4bd('0x4d')](_[_0xe4bd('0x4e')](_0x82480b[_0xe4bd('0x42')],_0x5eda66[_0xe4bd('0x4d')]),_0x25b98b);if(_0x82480b[_0xe4bd('0x42')]['filter']){_0x3d0cd0['where']=_[_0xe4bd('0x4f')](_0x3d0cd0[_0xe4bd('0x4c')],{'$or':_[_0xe4bd('0x41')](_0x25b98b,function(_0x50e69f){if(_0x50e69f['type']!==_0xe4bd('0x50')){var _0x4e5417={};_0x4e5417[_0x50e69f[_0xe4bd('0x3b')]]={'$like':'%'+_0x82480b[_0xe4bd('0x42')]['filter']+'%'};return _0x4e5417;}})});}_0x3d0cd0=_[_0xe4bd('0x4f')]({},_0x3d0cd0,_0x82480b[_0xe4bd('0x51')]);var _0x29e8de={'where':_0x3d0cd0[_0xe4bd('0x4c')]};return db[_0xe4bd('0x3e')][_0xe4bd('0x32')](_0x29e8de)[_0xe4bd('0x22')](function(_0x5c4100){_0x1c5d8b['count']=_0x5c4100;if(_0x82480b[_0xe4bd('0x42')][_0xe4bd('0x52')]){_0x3d0cd0[_0xe4bd('0x53')]=[{'all':!![]}];}return db[_0xe4bd('0x3e')][_0xe4bd('0x54')](_0x3d0cd0);})[_0xe4bd('0x22')](function(_0xa52763){_0x1c5d8b['rows']=_0xa52763;return _0x1c5d8b;})[_0xe4bd('0x22')](respondWithFilteredResult(_0x249976,_0x3d0cd0))[_0xe4bd('0x2d')](handleError(_0x249976,null));};exports['show']=function(_0x5d433e,_0x23d27f){var _0x2220d0={'raw':!![],'where':{'id':_0x5d433e['params']['id']}},_0x3038c4={};_0x3038c4[_0xe4bd('0x47')]=_[_0xe4bd('0x43')](db['SmsMessage'][_0xe4bd('0x55')]);_0x3038c4[_0xe4bd('0x42')]=_[_0xe4bd('0x43')](_0x5d433e['query']);_0x3038c4[_0xe4bd('0x4d')]=_[_0xe4bd('0x44')](_0x3038c4[_0xe4bd('0x47')],_0x3038c4[_0xe4bd('0x42')]);_0x2220d0['attributes']=_[_0xe4bd('0x44')](_0x3038c4[_0xe4bd('0x47')],qs[_0xe4bd('0x46')](_0x5d433e[_0xe4bd('0x42')][_0xe4bd('0x46')]));_0x2220d0[_0xe4bd('0x45')]=_0x2220d0[_0xe4bd('0x45')][_0xe4bd('0x56')]?_0x2220d0[_0xe4bd('0x45')]:_0x3038c4[_0xe4bd('0x47')];if(_0x5d433e[_0xe4bd('0x42')][_0xe4bd('0x52')]){_0x2220d0['include']=[{'all':!![]}];}_0x2220d0=_[_0xe4bd('0x4f')]({},_0x2220d0,_0x5d433e['options']);return db[_0xe4bd('0x3e')][_0xe4bd('0x57')](_0x2220d0)[_0xe4bd('0x22')](handleEntityNotFound(_0x23d27f,null))[_0xe4bd('0x22')](respondWithResult(_0x23d27f,null))[_0xe4bd('0x2d')](handleError(_0x23d27f,null));};exports[_0xe4bd('0x58')]=function(_0x3e9315,_0x17be71){return db[_0xe4bd('0x3e')][_0xe4bd('0x58')](_0x3e9315[_0xe4bd('0x59')],{})[_0xe4bd('0x22')](respondWithResult(_0x17be71,0xc9))[_0xe4bd('0x2d')](handleError(_0x17be71,null));};exports[_0xe4bd('0x5a')]=function(_0x383006,_0x5f0d1e){if(_0x383006['body']['id']){delete _0x383006[_0xe4bd('0x59')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x383006[_0xe4bd('0x5b')]['id']}})[_0xe4bd('0x22')](handleEntityNotFound(_0x5f0d1e,null))[_0xe4bd('0x22')](saveUpdates(_0x383006[_0xe4bd('0x59')],null))[_0xe4bd('0x22')](respondWithResult(_0x5f0d1e,null))[_0xe4bd('0x2d')](handleError(_0x5f0d1e,null));};exports[_0xe4bd('0x39')]=function(_0x4da113,_0x35239c){return db[_0xe4bd('0x3e')][_0xe4bd('0x57')]({'where':{'id':_0x4da113[_0xe4bd('0x5b')]['id']}})[_0xe4bd('0x22')](handleEntityNotFound(_0x35239c,null))[_0xe4bd('0x22')](removeEntity(_0x35239c,null))[_0xe4bd('0x2d')](handleError(_0x35239c,null));};exports['describe']=function(_0x281ea1,_0x413291){return db[_0xe4bd('0x3e')][_0xe4bd('0x5c')]()[_0xe4bd('0x22')](respondWithResult(_0x413291,null))[_0xe4bd('0x2d')](handleError(_0x413291,null));};var interaction_log=require('../../config/logger')(_0xe4bd('0x5d'));exports[_0xe4bd('0x5e')]=function(_0x38df49,_0x42d701,_0x358590){var _0x163408={'channel':'sms'};if(_0x38df49[_0xe4bd('0x59')]['id']){delete _0x38df49[_0xe4bd('0x59')]['id'];}_0x38df49[_0xe4bd('0x59')][_0xe4bd('0x5f')]=!![];_0x38df49[_0xe4bd('0x59')][_0xe4bd('0x60')]=moment()[_0xe4bd('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x38df49[_0xe4bd('0x59')][_0xe4bd('0x62')]=_0x38df49[_0xe4bd('0x59')]['UserId']||_0x38df49[_0xe4bd('0x63')]['id'];return db[_0xe4bd('0x3e')][_0xe4bd('0x57')]({'where':{'id':_0x38df49[_0xe4bd('0x5b')]['id'],'UserId':null},'include':[{'model':db[_0xe4bd('0x64')],'as':'Contact'}]})[_0xe4bd('0x22')](handleEntityNotFound(_0x42d701,null))['then'](saveUpdates(_0x38df49[_0xe4bd('0x59')],null))[_0xe4bd('0x22')](function(_0x526670){if(_0x526670){_0x163408[_0xe4bd('0x2b')]=_0x526670[_0xe4bd('0x65')]({'plain':!![]});return db[_0xe4bd('0x66')][_0xe4bd('0x57')]({'where':{'id':_0x526670['SmsInteractionId']}});}return null;})[_0xe4bd('0x22')](handleEntityNotFound(_0x42d701,null))['then'](function(_0x163f58){if(_0x163f58){return _0x163f58[_0xe4bd('0x5a')]({'UserId':_0x38df49[_0xe4bd('0x59')]['UserId'],'read1stAt':_[_0xe4bd('0x67')](_0x163f58[_0xe4bd('0x68')])?moment()['format'](_0xe4bd('0x69')):undefined});}return null;})[_0xe4bd('0x22')](function(_0x45d022){if(_0x45d022){_0x163408['interaction']=_0x45d022[_0xe4bd('0x65')]({'plain':!![]});interaction_log[_0xe4bd('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38df49[_0xe4bd('0x63')]['id'],_0x38df49[_0xe4bd('0x63')][_0xe4bd('0x3b')],_0x38df49[_0xe4bd('0x63')][_0xe4bd('0x6a')],_0x163408[_0xe4bd('0x6b')]['id'],_0x38df49[_0xe4bd('0x59')]?JSON[_0xe4bd('0x28')](_0x38df49[_0xe4bd('0x59')]):'null');return respondWithRpcPromise(_0xe4bd('0x6c'),_0xe4bd('0x6d'),_0x163408);}return null;})['then'](function(_0x2e8c0f){if(_0x2e8c0f){if(_0x38df49[_0xe4bd('0x59')][_0xe4bd('0x6e')]){_0x163408['message']['interface']=util[_0xe4bd('0x61')](_0xe4bd('0x6f'),_0x38df49[_0xe4bd('0x63')][_0xe4bd('0x3b')]);_0x163408[_0xe4bd('0x2b')]['channel']=_0x163408['channel'];_0x163408['message'][_0xe4bd('0x70')]=_0xe4bd('0x5e');return respondWithRpcPromise(_0xe4bd('0x71'),_0xe4bd('0x71'),{'event':_0xe4bd('0x72'),'message':_0x163408[_0xe4bd('0x2b')]},client9002)[_0xe4bd('0x22')](function(){return _0x163408;});}return _0x163408;}return null;})[_0xe4bd('0x22')](respondWithResult(_0x42d701,null))['catch'](handleError(_0x42d701,null));};var interaction_log=require(_0xe4bd('0x14'))(_0xe4bd('0x5d'));exports['reject']=function(_0x420a96,_0x450e71,_0x400561){var _0x147169={'agent':{},'channel':_0xe4bd('0x73')};if(_0x420a96[_0xe4bd('0x59')]['id']){delete _0x420a96[_0xe4bd('0x59')]['id'];}_0x420a96['body'][_0xe4bd('0x62')]=_0x420a96[_0xe4bd('0x59')][_0xe4bd('0x62')]||_0x420a96[_0xe4bd('0x63')]['id'];_0x147169[_0xe4bd('0x74')]['id']=_0x420a96['body'][_0xe4bd('0x62')];return db['SmsMessage'][_0xe4bd('0x57')]({'where':{'id':_0x420a96['params']['id'],'UserId':null}})[_0xe4bd('0x22')](handleEntityNotFound(_0x450e71,null))[_0xe4bd('0x22')](function(_0xe704dc){if(_0xe704dc){_0x147169['message']=_0xe704dc[_0xe4bd('0x65')]({'plain':!![]});return db[_0xe4bd('0x66')][_0xe4bd('0x57')]({'where':{'id':_0xe704dc['SmsInteractionId']}});}return null;})[_0xe4bd('0x22')](handleEntityNotFound(_0x450e71,null))[_0xe4bd('0x22')](function(_0x1e24bf){if(_0x1e24bf){_0x147169['interaction']=_0x1e24bf[_0xe4bd('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x420a96['user']['id'],_0x420a96[_0xe4bd('0x63')]['name'],_0x420a96[_0xe4bd('0x63')][_0xe4bd('0x6a')],_0x147169[_0xe4bd('0x6b')]['id'],_0x420a96[_0xe4bd('0x59')]?JSON['stringify'](_0x420a96[_0xe4bd('0x59')]):_0xe4bd('0x75'));return respondWithRpcPromise(_0xe4bd('0x76'),_0xe4bd('0x77'),_0x147169);}return null;})[_0xe4bd('0x22')](function(_0x18c1aa){if(_0x18c1aa){_0x18c1aa[_0xe4bd('0x2b')][_0xe4bd('0x78')]=util[_0xe4bd('0x61')](_0xe4bd('0x6f'),_0x420a96[_0xe4bd('0x63')][_0xe4bd('0x3b')]);_0x18c1aa[_0xe4bd('0x2b')]['channel']=_0x147169[_0xe4bd('0x79')];_0x18c1aa[_0xe4bd('0x2b')]['event']='reject';respondWithRpcPromise(_0xe4bd('0x71'),_0xe4bd('0x71'),{'event':'rejectmessage','message':_0x18c1aa['message']},client9002);return _0x147169;}return null;})[_0xe4bd('0x22')](respondWithResult(_0x450e71,null))['catch'](handleError(_0x450e71,null));};exports[_0xe4bd('0x2f')]=function(_0x3b2bc6,_0x45e2e8,_0x40c24e){if(_0x3b2bc6[_0xe4bd('0x59')]['id']){delete _0x3b2bc6[_0xe4bd('0x59')]['id'];}var _0x4f916b;return db['SmsMessage'][_0xe4bd('0x57')]({'where':{'id':_0x3b2bc6[_0xe4bd('0x5b')]['id']}})[_0xe4bd('0x22')](handleEntityNotFound(_0x45e2e8,null))[_0xe4bd('0x22')](function(_0x46840b){if(_0x46840b){_0x4f916b=_0x46840b;return db[_0xe4bd('0x7a')]['find']({'where':{'id':_0x46840b['SmsAccountId']}});}})[_0xe4bd('0x22')](handleEntityNotFound(_0x45e2e8,null))[_0xe4bd('0x22')](function(_0x1502d5){if(_0x1502d5){logger[_0xe4bd('0x26')](_0xe4bd('0x27'),'status',_0xe4bd('0x7b'),_0x1502d5[_0xe4bd('0x40')],util[_0xe4bd('0x7c')](_0x3b2bc6['body'],{'showHidden':![],'depth':null}));switch(_0x1502d5[_0xe4bd('0x40')]){case _0xe4bd('0x7d'):if(_0x3b2bc6[_0xe4bd('0x59')]['MessageSid']&&_0x3b2bc6[_0xe4bd('0x59')][_0xe4bd('0x7e')]===_0x4f916b[_0xe4bd('0x7f')]){return _0x4f916b['update']({'read':!![]});}else{logger[_0xe4bd('0x29')](_0xe4bd('0x80'),'status','twilio',util[_0xe4bd('0x7c')](_0x3b2bc6[_0xe4bd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xe4bd('0x81'):if(_0x3b2bc6[_0xe4bd('0x59')]['MessageUUID']&&_0x3b2bc6[_0xe4bd('0x59')][_0xe4bd('0x82')]===_0x4f916b[_0xe4bd('0x7f')]&&_[_0xe4bd('0x83')]([_0xe4bd('0x84'),'delivered'],_0x3b2bc6['body'][_0xe4bd('0x85')])>=0x0){return _0x4f916b[_0xe4bd('0x5a')]({'read':!![]});}else{logger['error'](_0xe4bd('0x80'),_0xe4bd('0x2f'),_0xe4bd('0x86'),util[_0xe4bd('0x7c')](_0x3b2bc6[_0xe4bd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xe4bd('0x87'):var _0x4b336c=_0x3b2bc6['body'][_0xe4bd('0x88')][0x0];if(_0x4b336c[_0xe4bd('0x2f')]['groupName']===_0xe4bd('0x89')){return _0x4f916b[_0xe4bd('0x5a')]({'read':!![]});}else{logger[_0xe4bd('0x29')](_0xe4bd('0x80'),_0xe4bd('0x2f'),_0xe4bd('0x87'),util[_0xe4bd('0x7c')](_0x3b2bc6[_0xe4bd('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4f916b;}})['then'](respondWithResult(_0x45e2e8,null))[_0xe4bd('0x2d')](handleError(_0x45e2e8,null));}; \ No newline at end of file +var _0x2cbd=['Contact','get','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','agent','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SmsAccount','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','MessageUUID','Status','infobip','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','SmsMessage','findAll','catch','params','rawAttributes','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x1eec60,_0x4f4b84){var _0x15c4ce=function(_0x5b5443){while(--_0x5b5443){_0x1eec60['push'](_0x1eec60['shift']());}};_0x15c4ce(++_0x4f4b84);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x2cbd[_0x4df6f9];return _0x4b1a73;};'use strict';var pdf=require(_0xd2cb('0x0'));var emlformat=require(_0xd2cb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd2cb('0x2'));var jsonpatch=require(_0xd2cb('0x3'));var rp=require(_0xd2cb('0x4'));var moment=require('moment');var BPromise=require(_0xd2cb('0x5'));var Mustache=require(_0xd2cb('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd2cb('0x7'));var csv=require(_0xd2cb('0x8'));var ejs=require(_0xd2cb('0x9'));var fs=require('fs');var _=require(_0xd2cb('0xa'));var squel=require('squel');var crypto=require(_0xd2cb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd2cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd2cb('0xd'));var Papa=require(_0xd2cb('0xe'));var Redis=require('ioredis');var authService=require(_0xd2cb('0xf'));var qs=require(_0xd2cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2cb('0x11'));var logger=require(_0xd2cb('0x12'))(_0xd2cb('0x13'));var utils=require(_0xd2cb('0x14'));var config=require(_0xd2cb('0x15'));var db=require('../../mysqldb')['db'];config[_0xd2cb('0x16')]=_[_0xd2cb('0x17')](config[_0xd2cb('0x16')],{'host':_0xd2cb('0x18'),'port':0x18eb});var socket=require(_0xd2cb('0x19'))(new Redis(config['redis']));require(_0xd2cb('0x1a'))[_0xd2cb('0x1b')](socket);var jayson=require(_0xd2cb('0x1c'));var client=jayson['client'][_0xd2cb('0x1d')]({'port':0x232c});var client9002=jayson[_0xd2cb('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x33538d,_0x4ef741,_0x4e02f7){if(_0x4e02f7){var _0x1346a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1346a8[_0xd2cb('0x1f')](_0x4ef741)){return _0x33538d;}else{throw new db[(_0xd2cb('0x20'))][(_0xd2cb('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 _0x33538d;}}function respondWithRpcPromise(_0x4e8970,_0x2f41d1,_0x13afe3,_0x5871e5){return new BPromise(function(_0x5fba,_0xd74fd1){var _0x434628=_0x5871e5||client;return _0x434628['request'](_0x4e8970,_0x13afe3)[_0xd2cb('0x22')](function(_0x4ea157){logger['info'](_0xd2cb('0x23'),_0x2f41d1,_0xd2cb('0x24'));logger[_0xd2cb('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2f41d1,_0xd2cb('0x24'),JSON[_0xd2cb('0x26')](_0x4ea157));if(_0x4ea157[_0xd2cb('0x27')]){if(_0x4ea157[_0xd2cb('0x27')][_0xd2cb('0x28')]===0x1f4){logger[_0xd2cb('0x27')](_0xd2cb('0x23'),_0x2f41d1,_0x4ea157[_0xd2cb('0x27')]['message']);return _0xd74fd1(_0x4ea157[_0xd2cb('0x27')][_0xd2cb('0x29')]);}logger['error'](_0xd2cb('0x23'),_0x2f41d1,_0x4ea157[_0xd2cb('0x27')][_0xd2cb('0x29')]);return _0x5fba(_0x4ea157[_0xd2cb('0x27')][_0xd2cb('0x29')]);}else{logger[_0xd2cb('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x2f41d1,_0xd2cb('0x24'));_0x5fba(_0x4ea157['result']['message']);}})['catch'](function(_0x390653){logger[_0xd2cb('0x27')](_0xd2cb('0x23'),_0x2f41d1,_0x390653);_0xd74fd1(_0x390653);});});}function respondWithStatusCode(_0x9b502c,_0x48aaad){_0x48aaad=_0x48aaad||0xcc;return function(_0x30214e){if(_0x30214e){return _0x9b502c[_0xd2cb('0x2b')](_0x48aaad);}return _0x9b502c[_0xd2cb('0x2c')](_0x48aaad)[_0xd2cb('0x2d')]();};}function respondWithResult(_0x45dd41,_0x1b9614){_0x1b9614=_0x1b9614||0xc8;return function(_0x27926d){if(_0x27926d){return _0x45dd41[_0xd2cb('0x2c')](_0x1b9614)[_0xd2cb('0x2e')](_0x27926d);}};}function respondWithFilteredResult(_0x24dba2,_0x568340){return function(_0x3b4b77){if(_0x3b4b77){var _0x2b6b77=_0x3b4b77[_0xd2cb('0x2f')],_0x58e894=_0x568340[_0xd2cb('0x30')],_0x1c3486=_0x568340['offset']+_0x568340['limit'],_0xfe4dc3;if(_0x1c3486>=_0x2b6b77){_0x1c3486=_0x2b6b77;_0xfe4dc3=0xc8;}else{_0xfe4dc3=0xce;}_0x24dba2[_0xd2cb('0x2c')](_0xfe4dc3);return _0x24dba2[_0xd2cb('0x31')](_0xd2cb('0x32'),_0x58e894+'-'+_0x1c3486+'/'+_0x2b6b77)[_0xd2cb('0x2e')](_0x3b4b77);}return null;};}function patchUpdates(_0x416c40){return function(_0x522cdd){try{jsonpatch[_0xd2cb('0x33')](_0x522cdd,_0x416c40,!![]);}catch(_0x22c42b){return BPromise[_0xd2cb('0x34')](_0x22c42b);}return _0x522cdd[_0xd2cb('0x35')]();};}function saveUpdates(_0x17715d,_0x3691e4){return function(_0x1c7bc1){if(_0x1c7bc1){return _0x1c7bc1[_0xd2cb('0x36')](_0x17715d)['then'](function(_0x421e10){return _0x421e10;});}return null;};}function removeEntity(_0x4df591,_0x2ec4fb){return function(_0x15e525){if(_0x15e525){return _0x15e525[_0xd2cb('0x37')]()[_0xd2cb('0x22')](function(){_0x4df591[_0xd2cb('0x2c')](0xcc)[_0xd2cb('0x2d')]();});}};}function handleEntityNotFound(_0x3ef977,_0x48624d){return function(_0x34ac8d){if(!_0x34ac8d){_0x3ef977['sendStatus'](0x194);}return _0x34ac8d;};}function handleError(_0x5868df,_0x326780){_0x326780=_0x326780||0x1f4;return function(_0x1699dc){logger[_0xd2cb('0x27')](_0x1699dc['stack']);if(_0x1699dc[_0xd2cb('0x38')]){delete _0x1699dc['name'];}_0x5868df[_0xd2cb('0x2c')](_0x326780)['send'](_0x1699dc);};}exports['index']=function(_0x30cccb,_0x11b54e){var _0xa34dde={},_0x2a309f={},_0x9d797e={'count':0x0,'rows':[]};var _0xe19fda=_[_0xd2cb('0x39')](db['SmsMessage']['rawAttributes'],function(_0x236708){return{'name':_0x236708[_0xd2cb('0x3a')],'type':_0x236708[_0xd2cb('0x3b')][_0xd2cb('0x3c')]};});_0x2a309f[_0xd2cb('0x3d')]=_['map'](_0xe19fda,_0xd2cb('0x38'));_0x2a309f['query']=_['keys'](_0x30cccb[_0xd2cb('0x3e')]);_0x2a309f['filters']=_[_0xd2cb('0x3f')](_0x2a309f[_0xd2cb('0x3d')],_0x2a309f['query']);_0xa34dde[_0xd2cb('0x40')]=_[_0xd2cb('0x3f')](_0x2a309f[_0xd2cb('0x3d')],qs[_0xd2cb('0x41')](_0x30cccb[_0xd2cb('0x3e')]['fields']));_0xa34dde[_0xd2cb('0x40')]=_0xa34dde[_0xd2cb('0x40')][_0xd2cb('0x42')]?_0xa34dde[_0xd2cb('0x40')]:_0x2a309f[_0xd2cb('0x3d')];if(!_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x43')](_0xd2cb('0x44'))){_0xa34dde['limit']=qs[_0xd2cb('0x45')](_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x45')]);_0xa34dde[_0xd2cb('0x30')]=qs[_0xd2cb('0x30')](_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x30')]);}_0xa34dde[_0xd2cb('0x46')]=qs[_0xd2cb('0x47')](_0x30cccb['query'][_0xd2cb('0x47')]);_0xa34dde[_0xd2cb('0x48')]=qs[_0xd2cb('0x49')](_[_0xd2cb('0x4a')](_0x30cccb[_0xd2cb('0x3e')],_0x2a309f['filters']),_0xe19fda);if(_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x4b')]){_0xa34dde[_0xd2cb('0x48')]=_[_0xd2cb('0x4c')](_0xa34dde['where'],{'$or':_[_0xd2cb('0x39')](_0xe19fda,function(_0x234a85){if(_0x234a85[_0xd2cb('0x3b')]!=='VIRTUAL'){var _0x157a2c={};_0x157a2c[_0x234a85[_0xd2cb('0x38')]]={'$like':'%'+_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x4b')]+'%'};return _0x157a2c;}})});}_0xa34dde=_[_0xd2cb('0x4c')]({},_0xa34dde,_0x30cccb['options']);var _0xd41741={'where':_0xa34dde[_0xd2cb('0x48')]};return db['SmsMessage'][_0xd2cb('0x2f')](_0xd41741)['then'](function(_0x5e43f){_0x9d797e[_0xd2cb('0x2f')]=_0x5e43f;if(_0x30cccb[_0xd2cb('0x3e')][_0xd2cb('0x4d')]){_0xa34dde[_0xd2cb('0x4e')]=[{'all':!![]}];}return db[_0xd2cb('0x4f')][_0xd2cb('0x50')](_0xa34dde);})['then'](function(_0x5e0501){_0x9d797e['rows']=_0x5e0501;return _0x9d797e;})['then'](respondWithFilteredResult(_0x11b54e,_0xa34dde))[_0xd2cb('0x51')](handleError(_0x11b54e,null));};exports['show']=function(_0x37d814,_0x5618c8){var _0x22d1e6={'raw':!![],'where':{'id':_0x37d814[_0xd2cb('0x52')]['id']}},_0x403b32={};_0x403b32[_0xd2cb('0x3d')]=_['keys'](db['SmsMessage'][_0xd2cb('0x53')]);_0x403b32[_0xd2cb('0x3e')]=_['keys'](_0x37d814['query']);_0x403b32[_0xd2cb('0x49')]=_['intersection'](_0x403b32['model'],_0x403b32['query']);_0x22d1e6[_0xd2cb('0x40')]=_[_0xd2cb('0x3f')](_0x403b32[_0xd2cb('0x3d')],qs[_0xd2cb('0x41')](_0x37d814[_0xd2cb('0x3e')][_0xd2cb('0x41')]));_0x22d1e6[_0xd2cb('0x40')]=_0x22d1e6[_0xd2cb('0x40')][_0xd2cb('0x42')]?_0x22d1e6[_0xd2cb('0x40')]:_0x403b32[_0xd2cb('0x3d')];if(_0x37d814[_0xd2cb('0x3e')]['includeAll']){_0x22d1e6[_0xd2cb('0x4e')]=[{'all':!![]}];}_0x22d1e6=_[_0xd2cb('0x4c')]({},_0x22d1e6,_0x37d814[_0xd2cb('0x54')]);return db[_0xd2cb('0x4f')][_0xd2cb('0x55')](_0x22d1e6)[_0xd2cb('0x22')](handleEntityNotFound(_0x5618c8,null))[_0xd2cb('0x22')](respondWithResult(_0x5618c8,null))['catch'](handleError(_0x5618c8,null));};exports[_0xd2cb('0x56')]=function(_0x1fdf1b,_0x280678){return db['SmsMessage']['create'](_0x1fdf1b[_0xd2cb('0x57')],{})[_0xd2cb('0x22')](respondWithResult(_0x280678,0xc9))[_0xd2cb('0x51')](handleError(_0x280678,null));};exports[_0xd2cb('0x36')]=function(_0x1adbeb,_0x4016e1){if(_0x1adbeb['body']['id']){delete _0x1adbeb['body']['id'];}return db[_0xd2cb('0x4f')][_0xd2cb('0x55')]({'where':{'id':_0x1adbeb[_0xd2cb('0x52')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x4016e1,null))['then'](saveUpdates(_0x1adbeb['body'],null))[_0xd2cb('0x22')](respondWithResult(_0x4016e1,null))['catch'](handleError(_0x4016e1,null));};exports[_0xd2cb('0x37')]=function(_0x4f01cc,_0x2178b9){return db[_0xd2cb('0x4f')][_0xd2cb('0x55')]({'where':{'id':_0x4f01cc[_0xd2cb('0x52')]['id']}})[_0xd2cb('0x22')](handleEntityNotFound(_0x2178b9,null))[_0xd2cb('0x22')](removeEntity(_0x2178b9,null))['catch'](handleError(_0x2178b9,null));};exports[_0xd2cb('0x58')]=function(_0x2d7a04,_0x1e15f9){return db[_0xd2cb('0x4f')]['describe']()[_0xd2cb('0x22')](respondWithResult(_0x1e15f9,null))[_0xd2cb('0x51')](handleError(_0x1e15f9,null));};var interaction_log=require('../../config/logger')(_0xd2cb('0x59'));exports[_0xd2cb('0x5a')]=function(_0x398fb7,_0x1266e6,_0x110d1d){var _0x311429={'channel':_0xd2cb('0x5b')};if(_0x398fb7[_0xd2cb('0x57')]['id']){delete _0x398fb7['body']['id'];}_0x398fb7[_0xd2cb('0x57')][_0xd2cb('0x5c')]=!![];_0x398fb7['body'][_0xd2cb('0x5d')]=moment()[_0xd2cb('0x5e')](_0xd2cb('0x5f'));_0x398fb7[_0xd2cb('0x57')][_0xd2cb('0x60')]=_0x398fb7[_0xd2cb('0x57')][_0xd2cb('0x60')]||_0x398fb7[_0xd2cb('0x61')]['id'];return db[_0xd2cb('0x4f')]['find']({'where':{'id':_0x398fb7[_0xd2cb('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd2cb('0x62')}]})['then'](handleEntityNotFound(_0x1266e6,null))[_0xd2cb('0x22')](saveUpdates(_0x398fb7[_0xd2cb('0x57')],null))[_0xd2cb('0x22')](function(_0x289687){if(_0x289687){_0x311429[_0xd2cb('0x29')]=_0x289687[_0xd2cb('0x63')]({'plain':!![]});return db['SmsInteraction'][_0xd2cb('0x55')]({'where':{'id':_0x289687['SmsInteractionId']}});}return null;})[_0xd2cb('0x22')](handleEntityNotFound(_0x1266e6,null))[_0xd2cb('0x22')](function(_0x3d597a){if(_0x3d597a){return _0x3d597a[_0xd2cb('0x36')]({'UserId':_0x398fb7[_0xd2cb('0x57')]['UserId'],'read1stAt':_[_0xd2cb('0x64')](_0x3d597a[_0xd2cb('0x65')])?moment()[_0xd2cb('0x5e')](_0xd2cb('0x5f')):undefined});}return null;})[_0xd2cb('0x22')](function(_0x135eec){if(_0x135eec){_0x311429[_0xd2cb('0x66')]=_0x135eec[_0xd2cb('0x63')]({'plain':!![]});interaction_log[_0xd2cb('0x2a')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x398fb7[_0xd2cb('0x61')]['id'],_0x398fb7[_0xd2cb('0x61')][_0xd2cb('0x38')],_0x398fb7['user']['role'],_0x311429[_0xd2cb('0x66')]['id'],_0x398fb7['body']?JSON['stringify'](_0x398fb7['body']):'null');return respondWithRpcPromise(_0xd2cb('0x67'),_0xd2cb('0x68'),_0x311429);}return null;})['then'](function(_0x206ab2){if(_0x206ab2){if(_0x398fb7[_0xd2cb('0x57')]['manual']){_0x311429[_0xd2cb('0x29')][_0xd2cb('0x69')]=util[_0xd2cb('0x5e')]('SIP/%s',_0x398fb7[_0xd2cb('0x61')]['name']);_0x311429[_0xd2cb('0x29')][_0xd2cb('0x6a')]=_0x311429[_0xd2cb('0x6a')];_0x311429['message'][_0xd2cb('0x6b')]=_0xd2cb('0x5a');return respondWithRpcPromise(_0xd2cb('0x6c'),'EventManager',{'event':_0xd2cb('0x6d'),'message':_0x311429['message']},client9002)[_0xd2cb('0x22')](function(){return _0x311429;});}return _0x311429;}return null;})[_0xd2cb('0x22')](respondWithResult(_0x1266e6,null))[_0xd2cb('0x51')](handleError(_0x1266e6,null));};var interaction_log=require('../../config/logger')(_0xd2cb('0x59'));exports[_0xd2cb('0x34')]=function(_0x89832a,_0x582702,_0x44c8b8){var _0x17ecf3={'agent':{},'channel':_0xd2cb('0x5b')};if(_0x89832a[_0xd2cb('0x57')]['id']){delete _0x89832a[_0xd2cb('0x57')]['id'];}_0x89832a[_0xd2cb('0x57')][_0xd2cb('0x60')]=_0x89832a['body'][_0xd2cb('0x60')]||_0x89832a[_0xd2cb('0x61')]['id'];_0x17ecf3[_0xd2cb('0x6e')]['id']=_0x89832a[_0xd2cb('0x57')][_0xd2cb('0x60')];return db['SmsMessage'][_0xd2cb('0x55')]({'where':{'id':_0x89832a[_0xd2cb('0x52')]['id'],'UserId':null}})[_0xd2cb('0x22')](handleEntityNotFound(_0x582702,null))[_0xd2cb('0x22')](function(_0x3f4eab){if(_0x3f4eab){_0x17ecf3[_0xd2cb('0x29')]=_0x3f4eab[_0xd2cb('0x63')]({'plain':!![]});return db[_0xd2cb('0x6f')][_0xd2cb('0x55')]({'where':{'id':_0x3f4eab[_0xd2cb('0x70')]}});}return null;})[_0xd2cb('0x22')](handleEntityNotFound(_0x582702,null))[_0xd2cb('0x22')](function(_0xca2201){if(_0xca2201){_0x17ecf3[_0xd2cb('0x66')]=_0xca2201['get']({'plain':!![]});interaction_log['info'](_0xd2cb('0x71'),_0x89832a['user']['id'],_0x89832a[_0xd2cb('0x61')][_0xd2cb('0x38')],_0x89832a['user'][_0xd2cb('0x72')],_0x17ecf3[_0xd2cb('0x66')]['id'],_0x89832a[_0xd2cb('0x57')]?JSON[_0xd2cb('0x26')](_0x89832a[_0xd2cb('0x57')]):_0xd2cb('0x73'));return respondWithRpcPromise(_0xd2cb('0x74'),_0xd2cb('0x75'),_0x17ecf3);}return null;})[_0xd2cb('0x22')](function(_0x26e91a){if(_0x26e91a){_0x26e91a[_0xd2cb('0x29')]['interface']=util['format']('SIP/%s',_0x89832a['user'][_0xd2cb('0x38')]);_0x26e91a[_0xd2cb('0x29')]['channel']=_0x17ecf3['channel'];_0x26e91a['message'][_0xd2cb('0x6b')]=_0xd2cb('0x34');respondWithRpcPromise(_0xd2cb('0x6c'),_0xd2cb('0x6c'),{'event':'rejectmessage','message':_0x26e91a[_0xd2cb('0x29')]},client9002);return _0x17ecf3;}return null;})[_0xd2cb('0x22')](respondWithResult(_0x582702,null))[_0xd2cb('0x51')](handleError(_0x582702,null));};exports[_0xd2cb('0x2c')]=function(_0x3ea702,_0x4579b9,_0x5480bd){if(_0x3ea702['body']['id']){delete _0x3ea702[_0xd2cb('0x57')]['id'];}var _0xda9ed8;return db[_0xd2cb('0x4f')][_0xd2cb('0x55')]({'where':{'id':_0x3ea702['params']['id']}})['then'](handleEntityNotFound(_0x4579b9,null))['then'](function(_0x3e415d){if(_0x3e415d){_0xda9ed8=_0x3e415d;return db[_0xd2cb('0x76')][_0xd2cb('0x55')]({'where':{'id':_0x3e415d['SmsAccountId']}});}})[_0xd2cb('0x22')](handleEntityNotFound(_0x4579b9,null))[_0xd2cb('0x22')](function(_0x4b868c){if(_0x4b868c){logger[_0xd2cb('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd2cb('0x77'),_0x4b868c[_0xd2cb('0x3b')],util['inspect'](_0x3ea702[_0xd2cb('0x57')],{'showHidden':![],'depth':null}));switch(_0x4b868c[_0xd2cb('0x3b')]){case'twilio':if(_0x3ea702[_0xd2cb('0x57')][_0xd2cb('0x78')]&&_0x3ea702[_0xd2cb('0x57')][_0xd2cb('0x78')]===_0xda9ed8[_0xd2cb('0x79')]){return _0xda9ed8[_0xd2cb('0x36')]({'read':!![]});}else{logger['error'](_0xd2cb('0x7a'),'status',_0xd2cb('0x7b'),util[_0xd2cb('0x7c')](_0x3ea702['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3ea702[_0xd2cb('0x57')][_0xd2cb('0x7d')]&&_0x3ea702['body'][_0xd2cb('0x7d')]===_0xda9ed8['messageId']&&_['indexOf'](['sent','delivered'],_0x3ea702[_0xd2cb('0x57')][_0xd2cb('0x7e')])>=0x0){return _0xda9ed8[_0xd2cb('0x36')]({'read':!![]});}else{logger[_0xd2cb('0x27')](_0xd2cb('0x7a'),_0xd2cb('0x2c'),'plivio',util[_0xd2cb('0x7c')](_0x3ea702[_0xd2cb('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd2cb('0x7f'):var _0x2fda99=_0x3ea702['body']['results'][0x0];if(_0x2fda99[_0xd2cb('0x2c')]['groupName']==='DELIVERED'){return _0xda9ed8[_0xd2cb('0x36')]({'read':!![]});}else{logger[_0xd2cb('0x27')](_0xd2cb('0x7a'),_0xd2cb('0x2c'),_0xd2cb('0x7f'),util[_0xd2cb('0x7c')](_0x3ea702[_0xd2cb('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xda9ed8;}})[_0xd2cb('0x22')](respondWithResult(_0x4579b9,null))[_0xd2cb('0x51')](handleError(_0x4579b9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2e95608..1463d79 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 _0x7424=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7424,0x108));var _0x4742=function(_0x122846,_0x89c6e){_0x122846=_0x122846-0x0;var _0x37ca9a=_0x7424[_0x122846];return _0x37ca9a;};'use strict';var EventEmitter=require(_0x4742('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x4742('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4742('0x2')](0x0);var events={'afterCreate':_0x4742('0x3'),'afterUpdate':'update','afterDestroy':_0x4742('0x4')};function emitEvent(_0x4f97e9){return function(_0x500949,_0x27de0a,_0x47e7b7){SmsMessageEvents[_0x4742('0x5')](_0x4f97e9+':'+_0x500949['id'],_0x500949);SmsMessageEvents[_0x4742('0x5')](_0x4f97e9,_0x500949);_0x47e7b7(null);};}for(var e in events){if(events[_0x4742('0x6')](e)){var event=events[e];SmsMessage[_0x4742('0x7')](e,emitEvent(event));}}module[_0x4742('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x72da=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x29cae5,_0x55db34){var _0x488183=function(_0x2ca563){while(--_0x2ca563){_0x29cae5['push'](_0x29cae5['shift']());}};_0x488183(++_0x55db34);}(_0x72da,0x18d));var _0xa72d=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x72da[_0x2b0875];return _0xedb8d7;};'use strict';var EventEmitter=require(_0xa72d('0x0'));var SmsMessage=require(_0xa72d('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa72d('0x2')](0x0);var events={'afterCreate':_0xa72d('0x3'),'afterUpdate':'update','afterDestroy':_0xa72d('0x4')};function emitEvent(_0x523a50){return function(_0x1abfbb,_0x4a756b,_0x36a4ed){SmsMessageEvents[_0xa72d('0x5')](_0x523a50+':'+_0x1abfbb['id'],_0x1abfbb);SmsMessageEvents[_0xa72d('0x5')](_0x523a50,_0x1abfbb);_0x36a4ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xa72d('0x6')](e,emitEvent(event));}}module[_0xa72d('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2d96603..bc422f9 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 _0xec8e=['SmsInteraction','findOne','then','update','toLowerCase','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','http_code','data','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','sort','length','createHash','digest','signature=','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId'];(function(_0x2abd62,_0x36911e){var _0x1c41af=function(_0x431f8f){while(--_0x431f8f){_0x2abd62['push'](_0x2abd62['shift']());}};_0x1c41af(++_0x36911e);}(_0xec8e,0x1c1));var _0xeec8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec8e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeec8('0x0'))('api');var moment=require(_0xeec8('0x1'));var BPromise=require(_0xeec8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeec8('0x3'));var rimraf=require('rimraf');var config=require(_0xeec8('0x4'));var attributes=require(_0xeec8('0x5'));module[_0xeec8('0x6')]=function(_0x191d94,_0x3a4e2f){return _0x191d94[_0xeec8('0x7')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xeec8('0x8')]},{'name':_0xeec8('0x9'),'fields':[_0xeec8('0xa')],'type':_0xeec8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29b230,_0x24c526,_0x5e8d87){var _0x22d46e=_0x191d94[_0xeec8('0xc')];var _0x4133f2=_0x29b230[_0xeec8('0xd')]({'plain':!![]});if(_0x4133f2[_0xeec8('0xe')]['toLowerCase']()==='in'||_0x4133f2[_0xeec8('0xe')]['toLowerCase']()===_0xeec8('0xf')&&!_0x4133f2[_0xeec8('0x10')]&&!_[_0xeec8('0x11')](_0x4133f2[_0xeec8('0x12')])){_0x22d46e[_0xeec8('0x13')][_0xeec8('0x14')]({'where':{'id':_0x4133f2['SmsInteractionId']}})[_0xeec8('0x15')](function(_0x10f4d2){if(_0x10f4d2){_0x10f4d2[_0xeec8('0x16')]({'lastMsgAt':_0x4133f2['createdAt'],'lastMsgDirection':_0x4133f2[_0xeec8('0xe')][_0xeec8('0x17')]()});}})[_0xeec8('0x18')](function(_0x58787a){console[_0xeec8('0x19')](_0x58787a);});}if(_0x4133f2[_0xeec8('0xe')]==='out'&&!_0x4133f2[_0xeec8('0x10')]){var _0x4d1919;_0x22d46e[_0xeec8('0x1a')][_0xeec8('0x1b')]({'where':{'id':_0x4133f2[_0xeec8('0x1c')]},'raw':!![]})[_0xeec8('0x15')](function(_0x2d311b){_0x4d1919=_0x2d311b;if(_0x4d1919&&_0x4d1919[_0xeec8('0x1d')]){switch(_0x4d1919['type']){case _0xeec8('0x1e'):var _0xd08410=require(_0xeec8('0x1e'));if(_0x4d1919[_0xeec8('0x1f')]&&_0x4d1919[_0xeec8('0x20')]&&_0x4d1919[_0xeec8('0x21')]){var _0x562449=new _0xd08410(_0x4d1919[_0xeec8('0x1f')],_0x4d1919[_0xeec8('0x20')]);_0x562449[_0xeec8('0x22')][_0xeec8('0x23')]({'body':_0x4133f2[_0xeec8('0xa')],'to':_0x4133f2[_0xeec8('0x21')],'from':_0x4d1919[_0xeec8('0x21')],'statusCallback':_0x4d1919['remote']+_0xeec8('0x24')+_0x4133f2['id']+_0xeec8('0x25')+_0x4d1919['token']})[_0xeec8('0x15')](function(_0x1dfad9){if(_0x1dfad9[_0xeec8('0x26')]){return _0x29b230['update']({'messageId':_0x1dfad9[_0xeec8('0x26')]});}})[_0xeec8('0x18')](function(_0x2d315f){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeec8('0x27'),_0xeec8('0x1e'),util[_0xeec8('0x28')](_0x2d315f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xeec8('0x29'),'afterCreate',_0xeec8('0x1e'),_0xeec8('0x2a'));}break;case _0xeec8('0x2b'):var _0x1e5dc0=_0xeec8('0x2c');if(_0x4d1919[_0xeec8('0x2d')]&&_0x4d1919[_0xeec8('0x2e')]){var _0x324683={'recipient':[_0x4133f2[_0xeec8('0x21')]],'message':_0x4133f2[_0xeec8('0xa')],'message_type':_0x4d1919[_0xeec8('0x2f')]};if(_0x4d1919[_0xeec8('0x2f')]&&_0x4d1919[_0xeec8('0x2f')]!=='SI'){_0x324683[_0xeec8('0x30')]=_0x4d1919[_0xeec8('0x21')];}var _0x2310e1={'url':_0x1e5dc0+'login?username='+_0x4d1919[_0xeec8('0x2d')]+_0xeec8('0x31')+_0x4d1919[_0xeec8('0x2e')],'method':'GET'};rp(_0x2310e1)[_0xeec8('0x15')](function(_0x542da7){var _0x2c080c=_0x542da7[_0xeec8('0x32')](';');var _0x2d9448={'user_key':_0x2c080c[0x0],'session_key':_0x2c080c[0x1]};_0x2310e1={'url':_0x1e5dc0+_0xeec8('0x33'),'method':_0xeec8('0x34'),'headers':{'user_key':_0x2d9448[_0xeec8('0x35')],'Session_key':_0x2d9448['session_key']},'json':!![],'body':_0x324683};return rp(_0x2310e1);})['then'](function(_0x1f18af){if(_0x1f18af[_0xeec8('0x36')]>=0x1){var _0x359e80={'messageId':_0x1f18af[_0xeec8('0x37')]};if(_0x4d1919['smsMethod']!=='GP'||!_0x4d1919[_0xeec8('0x38')]){_0x359e80[_0xeec8('0x39')]=!![];}return _0x29b230[_0xeec8('0x16')](_0x359e80);}else{return logger[_0xeec8('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeec8('0x27'),_0xeec8('0x2b'),util['inspect'](_0x1f18af,{'showHidden':![],'depth':null}));}})[_0xeec8('0x18')](function(_0x44e95a){return logger['error'](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x2b'),util['inspect'](_0x44e95a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeec8('0x2b'),_0xeec8('0x3a'));}break;case _0xeec8('0x3b'):if(_0x4d1919[_0xeec8('0x20')]){var _0x49fdde={'recipient':_0x4133f2[_0xeec8('0x21')],'message':_0x4133f2['body'],'sender':_0x4d1919[_0xeec8('0x3c')]||_0x4d1919[_0xeec8('0x21')],'authorization':_0x4d1919[_0xeec8('0x20')]};var _0x24c526={'method':_0xeec8('0x34'),'uri':_0xeec8('0x3d'),'body':_0x49fdde,'json':!![]};rp(_0x24c526)['then'](function(_0x209787){var _0x4c3070={'messageId':_0x209787[_0xeec8('0x3e')]};if(!_0x4d1919[_0xeec8('0x38')]){_0x4c3070[_0xeec8('0x39')]=!![];}return _0x29b230[_0xeec8('0x16')](_0x4c3070);})['catch'](function(_0x38140e){logger['error'](_0xeec8('0x29'),'afterCreate',_0xeec8('0x3b'),util[_0xeec8('0x28')](_0x38140e,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0xeec8('0x3f'):if(_0x4d1919['username']&&_0x4d1919['password']){var _0x49fdde={'messages':[{'source':_0xeec8('0x40'),'to':_0x4133f2[_0xeec8('0x21')],'body':_0x4133f2['body'],'from':_0x4d1919[_0xeec8('0x3c')]||_0x4d1919[_0xeec8('0x21')]}]};var _0x395ac4=util[_0xeec8('0x41')](_0xeec8('0x42'),_0x4d1919[_0xeec8('0x2d')],_0x4d1919[_0xeec8('0x2e')]);var _0x24c526={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x49fdde,'headers':{'Authorization':util['format'](_0xeec8('0x43'),new Buffer(_0x395ac4)['toString']('base64'))},'json':!![]};rp(_0x24c526)[_0xeec8('0x15')](function(_0x59a32a){if(_0x59a32a['http_code']>=0xc8&&_0x59a32a[_0xeec8('0x44')]<=0xce){if(_0x59a32a[_0xeec8('0x45')]&&_0x59a32a[_0xeec8('0x45')]['queued_count']>0x0){var _0x411be8=_[_0xeec8('0x46')](_0x59a32a[_0xeec8('0x45')][_0xeec8('0x22')]);var _0x11a456={'messageId':_0x411be8[_0xeec8('0x47')]};if(!_0x4d1919[_0xeec8('0x38')]){_0x11a456['read']=!![];}return _0x29b230[_0xeec8('0x16')](_0x11a456);}else{logger[_0xeec8('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeec8('0x27'),_0xeec8('0x48'),util[_0xeec8('0x28')](_0x59a32a,{'showHidden':![],'depth':null}));}}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),'clickSend',util[_0xeec8('0x28')](_0x59a32a,{'showHidden':![],'depth':null}));}})[_0xeec8('0x18')](function(_0x44b815){logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),'clickSend',util[_0xeec8('0x28')](_0x44b815,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),'afterCreate',_0xeec8('0x48'),_0xeec8('0x3a'));}break;case _0xeec8('0x49'):if(_0x4d1919[_0xeec8('0x4a')]&&_0x4d1919[_0xeec8('0x20')]){var _0x49fdde={'dst':_0x4133f2[_0xeec8('0x21')],'text':_0x4133f2[_0xeec8('0xa')],'src':_0x4d1919[_0xeec8('0x3c')]||_0x4d1919[_0xeec8('0x21')],'url':_0x4d1919['remote']+_0xeec8('0x24')+_0x4133f2['id']+'/status?token='+_0x4d1919[_0xeec8('0x4b')]};var _0x395ac4=util['format'](_0xeec8('0x42'),_0x4d1919[_0xeec8('0x4a')],_0x4d1919['authToken']);var _0x24c526={'method':_0xeec8('0x34'),'uri':util['format'](_0xeec8('0x4c'),_0x4d1919[_0xeec8('0x4a')]),'body':_0x49fdde,'headers':{'Authorization':util[_0xeec8('0x41')](_0xeec8('0x43'),new Buffer(_0x395ac4)[_0xeec8('0x4d')]('base64'))},'json':!![]};rp(_0x24c526)[_0xeec8('0x15')](function(_0x4b3d3d){var _0xd635df={'messageId':_0x4b3d3d[_0xeec8('0x4e')][0x0]};return _0x29b230[_0xeec8('0x16')](_0xd635df);})[_0xeec8('0x18')](function(_0x59ead8){logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x49'),util['inspect'](_0x59ead8,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x49'),_0xeec8('0x4f'));}break;case _0xeec8('0x50'):if(_0x4d1919[_0xeec8('0x2d')]&&_0x4d1919[_0xeec8('0x2e')]){if(_0x4d1919[_0xeec8('0x51')]){var _0x506c40={'method':'POST','uri':_0x4d1919[_0xeec8('0x51')]+_0xeec8('0x52'),'body':{'username':_0x4d1919['username'],'password':_0x4d1919[_0xeec8('0x2e')]},'json':!![]};return rp(_0x506c40)[_0xeec8('0x15')](function(_0x63a108){var _0x3b31a3={'method':_0xeec8('0x34'),'uri':_0x4d1919['baseUrl']+_0xeec8('0x53'),'body':{'messages':[{'from':_0x4d1919[_0xeec8('0x21')],'destinations':[{'to':_0x4133f2[_0xeec8('0x21')]}],'text':_0x4133f2[_0xeec8('0xa')],'notifyUrl':_0x4d1919[_0xeec8('0x54')]+_0xeec8('0x24')+_0x4133f2['id']+'/status?token='+_0x4d1919[_0xeec8('0x4b')],'notifyContentType':_0xeec8('0x55'),'callbackData':_0x4d1919[_0xeec8('0x21')]+';'+_0x4133f2[_0xeec8('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x63a108[_0xeec8('0x4b')]},'json':!![]};return rp(_0x3b31a3)[_0xeec8('0x15')](function(_0x124dd0){if(_0x124dd0[_0xeec8('0x22')]){var _0x872bf7={'messageId':_0x124dd0[_0xeec8('0x22')][0x0]['messageId']};if(!_0x4d1919['deliveryReport']){_0x872bf7[_0xeec8('0x39')]=!![];}return _0x29b230[_0xeec8('0x16')](_0x872bf7);}else{return logger[_0xeec8('0x19')](_0xeec8('0x29'),'afterCreate',_0xeec8('0x50'),util[_0xeec8('0x28')](_0x124dd0,{'showHidden':![],'depth':null}));}});})[_0xeec8('0x18')](function(_0x4e0bcd){return logger['error'](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x50'),util[_0xeec8('0x28')](_0x4e0bcd,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),'afterCreate',_0xeec8('0x50'),_0xeec8('0x56'));}}else{logger['error'](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xeec8('0x57'):var _0x5a229e=require(_0xeec8('0x58'));if(_0x4d1919[_0xeec8('0x59')]){var _0x5b9922={};_0x5b9922[_0xeec8('0x5a')]=_0x4d1919[_0xeec8('0x2d')];_0x5b9922[_0xeec8('0x21')]=_0x4133f2[_0xeec8('0x21')];_0x5b9922[_0xeec8('0x30')]=_0x4d1919[_0xeec8('0x21')];_0x5b9922['text']=_0x4133f2[_0xeec8('0xa')];_0x5b9922[_0xeec8('0x5b')]=+new Date();var _0x3059bf='';var _0xb1285='';var _0x4b7637=Object['keys'](_0x5b9922);_0x4b7637[_0xeec8('0x5c')]();for(var _0x2a1807=0x0;_0x2a1807<_0x4b7637[_0xeec8('0x5d')];_0x2a1807++){if(_0x3059bf!=''){_0x3059bf+='&';}_0x3059bf+=_0x4b7637[_0x2a1807]+'='+encodeURIComponent(_0x5b9922[_0x4b7637[_0x2a1807]]);_0xb1285+=_0x5b9922[_0x4b7637[_0x2a1807]];}_0xb1285+=_0x4d1919[_0xeec8('0x59')];_0xb1285=_0x5a229e[_0xeec8('0x5e')]('md5')[_0xeec8('0x16')](_0xb1285)[_0xeec8('0x5f')]('hex');if(_0x3059bf!==''){_0x3059bf+='&';}_0x3059bf+=_0xeec8('0x60')+_0xb1285;var _0x2310e1={'method':_0xeec8('0x61'),'uri':_0x4d1919[_0xeec8('0x51')]+_0xeec8('0x62')+_0x3059bf,'json':!![]};return rp(_0x2310e1)[_0xeec8('0x15')](function(_0x62c28d){var _0x236e1c=Object[_0xeec8('0x63')](_0x62c28d);if(_0x62c28d[_0x236e1c[0x0]][_0xeec8('0x19')]&&parseInt(_0x62c28d[_0x236e1c[0x0]][_0xeec8('0x19')])===0x0){var _0x31e483={'messageId':_0x62c28d[_0x236e1c[0x0]][_0xeec8('0x64')]};if(!_0x4d1919[_0xeec8('0x38')]){_0x31e483[_0xeec8('0x39')]=!![];}return _0x29b230['update'](_0x31e483);}else{return logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x57'),util['inspect'](_0x62c28d[_0xeec8('0x19')],{'showHidden':![],'depth':null}));}})[_0xeec8('0x18')](function(_0x148784){return logger[_0xeec8('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeec8('0x57'),util[_0xeec8('0x28')](_0x148784,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x57'),_0xeec8('0x65'));}break;case'clickatell':if(_0x4d1919[_0xeec8('0x59')]){var _0x4bef78={'method':_0xeec8('0x34'),'uri':_0xeec8('0x66'),'headers':{'Authorization':_0x4d1919[_0xeec8('0x59')]},'body':{'content':_0x4133f2['body'],'to':[_0x4133f2[_0xeec8('0x21')]],'from':_0x4d1919[_0xeec8('0x21')],'binary':![],'clientMessageId':_0xeec8('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x4bef78)[_0xeec8('0x15')](function(_0x3d2583){if(!_0x3d2583[_0xeec8('0x19')]){var _0x2af76c={'messageId':_0x3d2583[_0xeec8('0x22')][0x0][_0xeec8('0x68')]};if(!_0x4d1919[_0xeec8('0x38')]){_0x2af76c['read']=!![];}return _0x29b230[_0xeec8('0x16')](_0x2af76c);}else{return logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),'clickatell',util['inspect'](_0x3d2583[_0xeec8('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x396c95){return logger[_0xeec8('0x19')](_0xeec8('0x29'),'afterCreate',_0xeec8('0x69'),util['inspect'](_0x396c95,{'showHidden':![],'depth':null}));});}else{logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x69'),_0xeec8('0x65'));}break;case _0xeec8('0x6a'):if(_0x4d1919[_0xeec8('0x59')]){var _0x12bca5={};var _0x2310e1={'method':_0xeec8('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xeec8('0x6b')+_0x4d1919[_0xeec8('0x59')],'Content-Type':_0xeec8('0x55')},'body':{'from':_0x4d1919[_0xeec8('0x21')],'to':_0x4133f2[_0xeec8('0x21')],'text':_0x4133f2[_0xeec8('0xa')]},'json':!![]};return rp(_0x2310e1)[_0xeec8('0x15')](function(_0x55e5e2){if(_0x55e5e2[_0xeec8('0x6c')]==0xca){_0x12bca5[_0xeec8('0x6d')]=_0x55e5e2;var _0x59a70d={'method':_0xeec8('0x34'),'uri':_0xeec8('0x6e'),'headers':{'Authorization':_0xeec8('0x6b')+_0x4d1919[_0xeec8('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x12bca5[_0xeec8('0x6d')][_0xeec8('0x6f')]},'json':!![]};return rp(_0x59a70d)['then'](function(_0x3ca9f9){_0x12bca5[_0xeec8('0x70')]=_0x3ca9f9;var _0x14f8b5={'messageId':_0x12bca5[_0xeec8('0x6d')][_0xeec8('0x6f')],'read':!![]};return _0x29b230[_0xeec8('0x16')](_0x14f8b5);});}else{return logger[_0xeec8('0x19')](_0xeec8('0x29'),'afterCreate',_0xeec8('0x6a'),util[_0xeec8('0x28')](_0x55e5e2,{'showHidden':![],'depth':null}));}})[_0xeec8('0x18')](function(_0x83488a){return logger[_0xeec8('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeec8('0x27'),'intelepeer',util[_0xeec8('0x28')](_0x83488a,{'showHidden':![],'depth':null}));});}else{return logger[_0xeec8('0x19')](_0xeec8('0x29'),_0xeec8('0x27'),_0xeec8('0x6a'),_0xeec8('0x71'));}break;}}})[_0xeec8('0x72')](function(){_0x5e8d87();});}else{_0x5e8d87();}}},'charset':_0xeec8('0x73'),'collate':_0xeec8('0x74')});}; \ No newline at end of file +var _0x9360=['total_sent','internal_order_id','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','toString','base64','http_code','data','head','messages','message_id','read','clickSend','plivo','authId','remote','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','application/json','IBSSO\x20','csc','login','keys','sort','createHash','md5','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x9360,0xb1));var _0x0936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9360[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0936('0x0'))(_0x0936('0x1'));var moment=require(_0x0936('0x2'));var BPromise=require(_0x0936('0x3'));var rp=require(_0x0936('0x4'));var fs=require('fs');var path=require(_0x0936('0x5'));var rimraf=require(_0x0936('0x6'));var config=require(_0x0936('0x7'));var attributes=require(_0x0936('0x8'));module['exports']=function(_0x4e1b73,_0x26110d){return _0x4e1b73[_0x0936('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x0936('0xa'),'fields':[_0x0936('0xa')]},{'name':_0x0936('0xb'),'fields':[_0x0936('0xc')],'type':_0x0936('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e42cf,_0x392342,_0xd7172){var _0x50575c=_0x4e1b73[_0x0936('0xe')];var _0x59c013=_0x2e42cf[_0x0936('0xf')]({'plain':!![]});if(_0x59c013['direction'][_0x0936('0x10')]()==='in'||_0x59c013[_0x0936('0x11')]['toLowerCase']()==='out'&&!_0x59c013[_0x0936('0x12')]&&!_[_0x0936('0x13')](_0x59c013[_0x0936('0x14')])){_0x50575c[_0x0936('0x15')][_0x0936('0x16')]({'where':{'id':_0x59c013['SmsInteractionId']}})[_0x0936('0x17')](function(_0x473398){if(_0x473398){_0x473398[_0x0936('0x18')]({'lastMsgAt':_0x59c013[_0x0936('0x19')],'lastMsgDirection':_0x59c013[_0x0936('0x11')][_0x0936('0x10')]()});}})[_0x0936('0x1a')](function(_0x340771){console[_0x0936('0x1b')](_0x340771);});}if(_0x59c013[_0x0936('0x11')]===_0x0936('0x1c')&&!_0x59c013[_0x0936('0x12')]){var _0x58c925;_0x50575c[_0x0936('0x1d')][_0x0936('0x1e')]({'where':{'id':_0x59c013[_0x0936('0x1f')]},'raw':!![]})[_0x0936('0x17')](function(_0xe8ddf9){_0x58c925=_0xe8ddf9;if(_0x58c925&&_0x58c925[_0x0936('0x20')]){switch(_0x58c925[_0x0936('0x20')]){case _0x0936('0x21'):var _0x57b802=require(_0x0936('0x21'));if(_0x58c925[_0x0936('0x22')]&&_0x58c925[_0x0936('0x23')]&&_0x58c925[_0x0936('0x24')]){var _0x1fed95=new _0x57b802(_0x58c925[_0x0936('0x22')],_0x58c925[_0x0936('0x23')]);_0x1fed95['messages'][_0x0936('0x25')]({'body':_0x59c013['body'],'to':_0x59c013[_0x0936('0x24')],'from':_0x58c925['phone'],'statusCallback':_0x58c925['remote']+_0x0936('0x26')+_0x59c013['id']+_0x0936('0x27')+_0x58c925[_0x0936('0x28')]})[_0x0936('0x17')](function(_0xe66283){if(_0xe66283['sid']){return _0x2e42cf[_0x0936('0x18')]({'messageId':_0xe66283[_0x0936('0x29')]});}})[_0x0936('0x1a')](function(_0x4af51c){logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),'twilio',util[_0x0936('0x2c')](_0x4af51c,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x21'),_0x0936('0x2d'));}break;case'skebby':var _0x6c9695=_0x0936('0x2e');if(_0x58c925[_0x0936('0x2f')]&&_0x58c925[_0x0936('0x30')]){var _0x43dc6d={'recipient':[_0x59c013['phone']],'message':_0x59c013[_0x0936('0xc')],'message_type':_0x58c925['smsMethod']};if(_0x58c925[_0x0936('0x31')]&&_0x58c925[_0x0936('0x31')]!=='SI'){_0x43dc6d[_0x0936('0x32')]=_0x58c925[_0x0936('0x24')];}var _0xabfb6b={'url':_0x6c9695+_0x0936('0x33')+_0x58c925[_0x0936('0x2f')]+_0x0936('0x34')+_0x58c925['password'],'method':_0x0936('0x35')};rp(_0xabfb6b)[_0x0936('0x17')](function(_0x5ea265){var _0x307cf8=_0x5ea265[_0x0936('0x36')](';');var _0x4d2278={'user_key':_0x307cf8[0x0],'session_key':_0x307cf8[0x1]};_0xabfb6b={'url':_0x6c9695+_0x0936('0x37'),'method':_0x0936('0x38'),'headers':{'user_key':_0x4d2278[_0x0936('0x39')],'Session_key':_0x4d2278[_0x0936('0x3a')]},'json':!![],'body':_0x43dc6d};return rp(_0xabfb6b);})['then'](function(_0x45c0c2){if(_0x45c0c2[_0x0936('0x3b')]>=0x1){var _0x94a226={'messageId':_0x45c0c2[_0x0936('0x3c')]};if(_0x58c925[_0x0936('0x31')]!=='GP'||!_0x58c925['deliveryReport']){_0x94a226['read']=!![];}return _0x2e42cf[_0x0936('0x18')](_0x94a226);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0936('0x2b'),'skebby',util[_0x0936('0x2c')](_0x45c0c2,{'showHidden':![],'depth':null}));}})[_0x0936('0x1a')](function(_0xb4205e){return logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),'skebby',util[_0x0936('0x2c')](_0xb4205e,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x3d'),_0x0936('0x3e'));}break;case _0x0936('0x3f'):if(_0x58c925[_0x0936('0x23')]){var _0x2da91b={'recipient':_0x59c013[_0x0936('0x24')],'message':_0x59c013[_0x0936('0xc')],'sender':_0x58c925[_0x0936('0x40')]||_0x58c925[_0x0936('0x24')],'authorization':_0x58c925['authToken']};var _0x392342={'method':_0x0936('0x38'),'uri':_0x0936('0x41'),'body':_0x2da91b,'json':!![]};rp(_0x392342)[_0x0936('0x17')](function(_0x5e4197){var _0x17c8ce={'messageId':_0x5e4197[_0x0936('0x42')]};if(!_0x58c925[_0x0936('0x43')]){_0x17c8ce['read']=!![];}return _0x2e42cf['update'](_0x17c8ce);})[_0x0936('0x1a')](function(_0x1de9c5){logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),'connectel',util[_0x0936('0x2c')](_0x1de9c5,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x3f'),_0x0936('0x44'));}break;case _0x0936('0x45'):if(_0x58c925[_0x0936('0x2f')]&&_0x58c925[_0x0936('0x30')]){var _0x2da91b={'messages':[{'source':'xCALLY\x20Motion','to':_0x59c013[_0x0936('0x24')],'body':_0x59c013[_0x0936('0xc')],'from':_0x58c925[_0x0936('0x40')]||_0x58c925[_0x0936('0x24')]}]};var _0x11dae1=util[_0x0936('0x46')](_0x0936('0x47'),_0x58c925['username'],_0x58c925[_0x0936('0x30')]);var _0x392342={'method':_0x0936('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2da91b,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x11dae1)[_0x0936('0x48')](_0x0936('0x49')))},'json':!![]};rp(_0x392342)[_0x0936('0x17')](function(_0x1fbb50){if(_0x1fbb50[_0x0936('0x4a')]>=0xc8&&_0x1fbb50[_0x0936('0x4a')]<=0xce){if(_0x1fbb50[_0x0936('0x4b')]&&_0x1fbb50['data']['queued_count']>0x0){var _0x3c9aba=_[_0x0936('0x4c')](_0x1fbb50['data'][_0x0936('0x4d')]);var _0x493320={'messageId':_0x3c9aba[_0x0936('0x4e')]};if(!_0x58c925[_0x0936('0x43')]){_0x493320[_0x0936('0x4f')]=!![];}return _0x2e42cf['update'](_0x493320);}else{logger[_0x0936('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0936('0x2b'),_0x0936('0x50'),util['inspect'](_0x1fbb50,{'showHidden':![],'depth':null}));}}else{logger[_0x0936('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0936('0x50'),util[_0x0936('0x2c')](_0x1fbb50,{'showHidden':![],'depth':null}));}})[_0x0936('0x1a')](function(_0x2fe832){logger['error'](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x50'),util[_0x0936('0x2c')](_0x2fe832,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),'afterCreate',_0x0936('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0936('0x51'):if(_0x58c925[_0x0936('0x52')]&&_0x58c925[_0x0936('0x23')]){var _0x2da91b={'dst':_0x59c013[_0x0936('0x24')],'text':_0x59c013['body'],'src':_0x58c925[_0x0936('0x40')]||_0x58c925[_0x0936('0x24')],'url':_0x58c925[_0x0936('0x53')]+_0x0936('0x26')+_0x59c013['id']+_0x0936('0x27')+_0x58c925[_0x0936('0x28')]};var _0x11dae1=util[_0x0936('0x46')]('%s:%s',_0x58c925[_0x0936('0x52')],_0x58c925[_0x0936('0x23')]);var _0x392342={'method':_0x0936('0x38'),'uri':util[_0x0936('0x46')]('https://api.plivo.com/v1/Account/%s/Message/',_0x58c925[_0x0936('0x52')]),'body':_0x2da91b,'headers':{'Authorization':util['format'](_0x0936('0x54'),new Buffer(_0x11dae1)[_0x0936('0x48')](_0x0936('0x49')))},'json':!![]};rp(_0x392342)[_0x0936('0x17')](function(_0x20c077){var _0x595d77={'messageId':_0x20c077[_0x0936('0x55')][0x0]};return _0x2e42cf[_0x0936('0x18')](_0x595d77);})['catch'](function(_0xcec6be){logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),'plivo',util[_0x0936('0x2c')](_0xcec6be,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x51'),_0x0936('0x56'));}break;case _0x0936('0x57'):if(_0x58c925['username']&&_0x58c925[_0x0936('0x30')]){if(_0x58c925['baseUrl']){var _0x33b3fc={'method':_0x0936('0x38'),'uri':_0x58c925['baseUrl']+_0x0936('0x58'),'body':{'username':_0x58c925[_0x0936('0x2f')],'password':_0x58c925['password']},'json':!![]};return rp(_0x33b3fc)[_0x0936('0x17')](function(_0xb4863d){var _0x1a524d={'method':'POST','uri':_0x58c925[_0x0936('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x58c925[_0x0936('0x24')],'destinations':[{'to':_0x59c013[_0x0936('0x24')]}],'text':_0x59c013['body'],'notifyUrl':_0x58c925['remote']+_0x0936('0x26')+_0x59c013['id']+_0x0936('0x27')+_0x58c925[_0x0936('0x28')],'notifyContentType':_0x0936('0x5a'),'callbackData':_0x58c925[_0x0936('0x24')]+';'+_0x59c013[_0x0936('0xc')]}]},'headers':{'Authorization':_0x0936('0x5b')+_0xb4863d['token']},'json':!![]};return rp(_0x1a524d)[_0x0936('0x17')](function(_0x5e3c77){if(_0x5e3c77[_0x0936('0x4d')]){var _0x102f03={'messageId':_0x5e3c77['messages'][0x0][_0x0936('0xa')]};if(!_0x58c925['deliveryReport']){_0x102f03[_0x0936('0x4f')]=!![];}return _0x2e42cf['update'](_0x102f03);}else{return logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),'infobip',util[_0x0936('0x2c')](_0x5e3c77,{'showHidden':![],'depth':null}));}});})[_0x0936('0x1a')](function(_0x1ba670){return logger[_0x0936('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0936('0x2b'),'infobip',util[_0x0936('0x2c')](_0x1ba670,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x57'),_0x0936('0x3e'));}break;case _0x0936('0x5c'):var _0x4836fb=require('crypto');if(_0x58c925['apiKey']){var _0xaa5ab3={};_0xaa5ab3[_0x0936('0x5d')]=_0x58c925[_0x0936('0x2f')];_0xaa5ab3['phone']=_0x59c013[_0x0936('0x24')];_0xaa5ab3[_0x0936('0x32')]=_0x58c925[_0x0936('0x24')];_0xaa5ab3['text']=_0x59c013[_0x0936('0xc')];_0xaa5ab3['timestamp']=+new Date();var _0x73bf97='';var _0x4333ac='';var _0xe843c0=Object[_0x0936('0x5e')](_0xaa5ab3);_0xe843c0[_0x0936('0x5f')]();for(var _0x311094=0x0;_0x311094<_0xe843c0['length'];_0x311094++){if(_0x73bf97!=''){_0x73bf97+='&';}_0x73bf97+=_0xe843c0[_0x311094]+'='+encodeURIComponent(_0xaa5ab3[_0xe843c0[_0x311094]]);_0x4333ac+=_0xaa5ab3[_0xe843c0[_0x311094]];}_0x4333ac+=_0x58c925['apiKey'];_0x4333ac=_0x4836fb[_0x0936('0x60')](_0x0936('0x61'))['update'](_0x4333ac)['digest'](_0x0936('0x62'));if(_0x73bf97!==''){_0x73bf97+='&';}_0x73bf97+=_0x0936('0x63')+_0x4333ac;var _0xabfb6b={'method':_0x0936('0x35'),'uri':_0x58c925['baseUrl']+'/external/get/send.php?'+_0x73bf97,'json':!![]};return rp(_0xabfb6b)[_0x0936('0x17')](function(_0x2417cf){var _0x463de4=Object['keys'](_0x2417cf);if(_0x2417cf[_0x463de4[0x0]][_0x0936('0x1b')]&&parseInt(_0x2417cf[_0x463de4[0x0]][_0x0936('0x1b')])===0x0){var _0x364570={'messageId':_0x2417cf[_0x463de4[0x0]][_0x0936('0x64')]};if(!_0x58c925[_0x0936('0x43')]){_0x364570[_0x0936('0x4f')]=!![];}return _0x2e42cf[_0x0936('0x18')](_0x364570);}else{return logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x5c'),util[_0x0936('0x2c')](_0x2417cf['error'],{'showHidden':![],'depth':null}));}})[_0x0936('0x1a')](function(_0x1b2dbf){return logger[_0x0936('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0936('0x2b'),_0x0936('0x5c'),util[_0x0936('0x2c')](_0x1b2dbf,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x5c'),_0x0936('0x65'));}break;case _0x0936('0x66'):if(_0x58c925[_0x0936('0x67')]){var _0x53531e={'method':_0x0936('0x38'),'uri':_0x0936('0x68'),'headers':{'Authorization':_0x58c925[_0x0936('0x67')]},'body':{'content':_0x59c013['body'],'to':[_0x59c013['phone']],'from':_0x58c925[_0x0936('0x24')],'binary':![],'clientMessageId':_0x0936('0x69'),'charset':_0x0936('0x6a')},'json':!![]};rp(_0x53531e)[_0x0936('0x17')](function(_0x487491){if(!_0x487491[_0x0936('0x1b')]){var _0x8060e4={'messageId':_0x487491[_0x0936('0x4d')][0x0][_0x0936('0x6b')]};if(!_0x58c925[_0x0936('0x43')]){_0x8060e4[_0x0936('0x4f')]=!![];}return _0x2e42cf[_0x0936('0x18')](_0x8060e4);}else{return logger[_0x0936('0x1b')](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x66'),util[_0x0936('0x2c')](_0x487491[_0x0936('0x1b')],{'showHidden':![],'depth':null}));}})[_0x0936('0x1a')](function(_0xb65542){return logger[_0x0936('0x1b')](_0x0936('0x2a'),'afterCreate','clickatell',util[_0x0936('0x2c')](_0xb65542,{'showHidden':![],'depth':null}));});}else{logger[_0x0936('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0936('0x2b'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x0936('0x6c'):if(_0x58c925['apiKey']){var _0x1389e7={};var _0xabfb6b={'method':_0x0936('0x38'),'uri':_0x0936('0x6d'),'headers':{'Authorization':_0x0936('0x6e')+_0x58c925['apiKey'],'Content-Type':_0x0936('0x5a')},'body':{'from':_0x58c925[_0x0936('0x24')],'to':_0x59c013[_0x0936('0x24')],'text':_0x59c013[_0x0936('0xc')]},'json':!![]};return rp(_0xabfb6b)['then'](function(_0x21ddbd){if(_0x21ddbd[_0x0936('0x6f')]==0xca){_0x1389e7[_0x0936('0x70')]=_0x21ddbd;var _0x3830bb={'method':_0x0936('0x38'),'uri':_0x0936('0x71'),'headers':{'Authorization':_0x0936('0x6e')+_0x58c925[_0x0936('0x67')],'Content-Type':_0x0936('0x5a')},'body':{'refid':_0x1389e7[_0x0936('0x70')]['refid']},'json':!![]};return rp(_0x3830bb)[_0x0936('0x17')](function(_0x510d58){_0x1389e7['status']=_0x510d58;var _0xcf6542={'messageId':_0x1389e7[_0x0936('0x70')]['refid'],'read':!![]};return _0x2e42cf['update'](_0xcf6542);});}else{return logger[_0x0936('0x1b')](_0x0936('0x2a'),'afterCreate',_0x0936('0x6c'),util[_0x0936('0x2c')](_0x21ddbd,{'showHidden':![],'depth':null}));}})[_0x0936('0x1a')](function(_0x33a430){return logger['error'](_0x0936('0x2a'),'afterCreate',_0x0936('0x6c'),util[_0x0936('0x2c')](_0x33a430,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x0936('0x2a'),_0x0936('0x2b'),_0x0936('0x6c'),_0x0936('0x72'));}break;}}})[_0x0936('0x73')](function(){_0xd7172();});}else{_0xd7172();}}},'charset':_0x0936('0x74'),'collate':_0x0936('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fdf0b70..e32f24f 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 _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30f0bc,_0xefe310){var _0x195aef=function(_0x18e698){while(--_0x18e698){_0x30f0bc['push'](_0x30f0bc['shift']());}};_0x195aef(++_0xefe310);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x5eb8[_0x2ba740];return _0x358bda;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file +var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ea9b3,_0x2218d9){var _0x42f6ae=function(_0x1342d7){while(--_0x1342d7){_0x1ea9b3['push'](_0x1ea9b3['shift']());}};_0x42f6ae(++_0x2218d9);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x5eb8[_0xe89d97];return _0x1b6e5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 02b8bc9..07f226c 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 _0x0281=['./smsMessage.events','save','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x8c21cf,_0x109cea){var _0x32f287=function(_0x459830){while(--_0x459830){_0x8c21cf['push'](_0x8c21cf['shift']());}};_0x32f287(++_0x109cea);}(_0x0281,0x128));var _0x1028=function(_0x56a91a,_0x1ff9f0){_0x56a91a=_0x56a91a-0x0;var _0x4025af=_0x0281[_0x56a91a];return _0x4025af;};'use strict';var SmsMessageEvents=require(_0x1028('0x0'));var events=[_0x1028('0x1'),_0x1028('0x2'),_0x1028('0x3')];function createListener(_0x3b4bf5,_0x1d6839){return function(_0x117291){_0x1d6839[_0x1028('0x4')](_0x3b4bf5,_0x117291);};}function removeListener(_0x433787,_0x3ed9c0){return function(){SmsMessageEvents[_0x1028('0x5')](_0x433787,_0x3ed9c0);};}exports['register']=function(_0x45bab3){for(var _0xafde45=0x0,_0x39b041=events[_0x1028('0x6')];_0xafde45<_0x39b041;_0xafde45++){var _0x8a3455=events[_0xafde45];var _0x278ce5=createListener(_0x1028('0x7')+_0x8a3455,_0x45bab3);SmsMessageEvents['on'](_0x8a3455,_0x278ce5);}}; \ No newline at end of file +var _0x6abe=['save','remove','update','emit','register','smsMessage:'];(function(_0x33cee5,_0x30f586){var _0x12992d=function(_0x3be381){while(--_0x3be381){_0x33cee5['push'](_0x33cee5['shift']());}};_0x12992d(++_0x30f586);}(_0x6abe,0xde));var _0xe6ab=function(_0x2df855,_0x33b335){_0x2df855=_0x2df855-0x0;var _0xd2028=_0x6abe[_0x2df855];return _0xd2028;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xe6ab('0x0'),_0xe6ab('0x1'),_0xe6ab('0x2')];function createListener(_0x582137,_0x1113dd){return function(_0x28671e){_0x1113dd[_0xe6ab('0x3')](_0x582137,_0x28671e);};}function removeListener(_0x1d57d4,_0xee74e6){return function(){SmsMessageEvents['removeListener'](_0x1d57d4,_0xee74e6);};}exports[_0xe6ab('0x4')]=function(_0x11c9de){for(var _0x314977=0x0,_0x241e83=events['length'];_0x314977<_0x241e83;_0x314977++){var _0x18f912=events[_0x314977];var _0x4437c6=createListener(_0xe6ab('0x5')+_0x18f912,_0x11c9de);SmsMessageEvents['on'](_0x18f912,_0x4437c6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bfb3dab..98c25e1 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 _0x4bd3=['addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4bd3,0x174));var _0x34bd=function(_0x55d88d,_0x5d1ff4){_0x55d88d=_0x55d88d-0x0;var _0x13d52d=_0x4bd3[_0x55d88d];return _0x13d52d;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var controller=require(_0x34bd('0x5'));router['get']('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x7')]);router['get'](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['describe']);router[_0x34bd('0x9')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0xb')]);router[_0x34bd('0x9')](_0x34bd('0xc'),auth['isAuthenticated'](),controller[_0x34bd('0xd')]);router[_0x34bd('0x9')](_0x34bd('0xe'),auth[_0x34bd('0x6')](),controller['getTeams']);router['get'](_0x34bd('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x34bd('0x10')]('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x11')]);router[_0x34bd('0x10')](_0x34bd('0xe'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x12')]);router[_0x34bd('0x10')](_0x34bd('0xf'),auth['isAuthenticated'](),controller[_0x34bd('0x13')]);router['put']('/:id',auth[_0x34bd('0x6')](),controller[_0x34bd('0x14')]);router[_0x34bd('0x15')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x16')]);router[_0x34bd('0x15')](_0x34bd('0xe'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x17')]);router[_0x34bd('0x15')]('/:id/users',auth[_0x34bd('0x6')](),controller[_0x34bd('0x18')]);module[_0x34bd('0x19')]=router; \ No newline at end of file +var _0x49df=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout'];(function(_0x39279b,_0x19dee2){var _0x5e6c5c=function(_0x5c04fc){while(--_0x5c04fc){_0x39279b['push'](_0x39279b['shift']());}};_0x5e6c5c(++_0x19dee2);}(_0x49df,0xad));var _0xf49d=function(_0x4f8f52,_0x139a03){_0x4f8f52=_0x4f8f52-0x0;var _0x16c1d4=_0x49df[_0x4f8f52];return _0x16c1d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf49d('0x0'));var timeout=require(_0xf49d('0x1'));var express=require(_0xf49d('0x2'));var router=express[_0xf49d('0x3')]();var auth=require(_0xf49d('0x4'));var interaction=require(_0xf49d('0x5'));var config=require(_0xf49d('0x6'));var controller=require('./smsQueue.controller');router[_0xf49d('0x7')]('/',auth[_0xf49d('0x8')](),controller[_0xf49d('0x9')]);router[_0xf49d('0x7')](_0xf49d('0xa'),auth[_0xf49d('0x8')](),controller['describe']);router[_0xf49d('0x7')](_0xf49d('0xb'),auth[_0xf49d('0x8')](),controller['show']);router['get'](_0xf49d('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0xf49d('0x7')](_0xf49d('0xd'),auth[_0xf49d('0x8')](),controller['getTeams']);router[_0xf49d('0x7')](_0xf49d('0xe'),auth['isAuthenticated'](),controller[_0xf49d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf49d('0x10')]);router['post'](_0xf49d('0xd'),auth[_0xf49d('0x8')](),controller[_0xf49d('0x11')]);router['post'](_0xf49d('0xe'),auth[_0xf49d('0x8')](),controller[_0xf49d('0x12')]);router['put'](_0xf49d('0xb'),auth[_0xf49d('0x8')](),controller[_0xf49d('0x13')]);router[_0xf49d('0x14')]('/:id',auth[_0xf49d('0x8')](),controller[_0xf49d('0x15')]);router[_0xf49d('0x14')](_0xf49d('0xd'),auth[_0xf49d('0x8')](),controller[_0xf49d('0x16')]);router[_0xf49d('0x14')](_0xf49d('0xe'),auth['isAuthenticated'](),controller[_0xf49d('0x17')]);module[_0xf49d('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bcfe0d4..f53cbda 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 _0x74f1=['STRING','INTEGER','ENUM','rrmemory','name'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x74f1,0x86));var _0x174f=function(_0x4b38a,_0x45fdf7){_0x4b38a=_0x4b38a-0x0;var _0xf0592b=_0x74f1[_0x4b38a];return _0xf0592b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x174f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x174f('0x1')]},'timeout':{'type':Sequelize[_0x174f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x174f('0x3')](_0x174f('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xc83c=['roundrobin','sequelize','exports','name','STRING','INTEGER','beepall'];(function(_0x35fac6,_0x5e9d9f){var _0x2e73c9=function(_0x1c9ce3){while(--_0x1c9ce3){_0x35fac6['push'](_0x35fac6['shift']());}};_0x2e73c9(++_0x5e9d9f);}(_0xc83c,0xb7));var _0xcc83=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xc83c[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require(_0xcc83('0x0'));module[_0xcc83('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcc83('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc83('0x3')]},'timeout':{'type':Sequelize[_0xcc83('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xcc83('0x5'),_0xcc83('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0552322..78c693b 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 _0x872c=['SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','smsPause','createdAt','format','SIP','updatedAt','getTeams','Team','order','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','union','compact','isEmpty','userSmsQueue:remove','addAgents','ids','omit','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','Content-Range','apply','reject','save','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','fields','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x872c,0x153));var _0xc872=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x872c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc872('0x0'));var emlformat=require(_0xc872('0x1'));var rimraf=require(_0xc872('0x2'));var zipdir=require(_0xc872('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc872('0x4'));var moment=require(_0xc872('0x5'));var BPromise=require(_0xc872('0x6'));var Mustache=require(_0xc872('0x7'));var util=require(_0xc872('0x8'));var path=require(_0xc872('0x9'));var sox=require(_0xc872('0xa'));var csv=require('to-csv');var ejs=require(_0xc872('0xb'));var fs=require('fs');var _=require(_0xc872('0xc'));var squel=require(_0xc872('0xd'));var crypto=require(_0xc872('0xe'));var jsforce=require(_0xc872('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc872('0x10'));var querystring=require('querystring');var Papa=require(_0xc872('0x11'));var Redis=require(_0xc872('0x12'));var authService=require(_0xc872('0x13'));var qs=require(_0xc872('0x14'));var as=require(_0xc872('0x15'));var hardwareService=require(_0xc872('0x16'));var logger=require(_0xc872('0x17'))(_0xc872('0x18'));var utils=require(_0xc872('0x19'));var config=require(_0xc872('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc872('0x1b')]=_[_0xc872('0x1c')](config[_0xc872('0x1b')],{'host':_0xc872('0x1d'),'port':0x18eb});var socket=require(_0xc872('0x1e'))(new Redis(config[_0xc872('0x1b')]));require(_0xc872('0x1f'))['register'](socket);function respondWithStatusCode(_0x3552c2,_0x1ef943){_0x1ef943=_0x1ef943||0xcc;return function(_0x4ce039){if(_0x4ce039){return _0x3552c2[_0xc872('0x20')](_0x1ef943);}return _0x3552c2[_0xc872('0x21')](_0x1ef943)[_0xc872('0x22')]();};}function respondWithResult(_0x5b97e6,_0x4dbd9c){_0x4dbd9c=_0x4dbd9c||0xc8;return function(_0x45924c){if(_0x45924c){return _0x5b97e6[_0xc872('0x21')](_0x4dbd9c)[_0xc872('0x23')](_0x45924c);}};}function respondWithFilteredResult(_0x359795,_0x4e547a){return function(_0x32775f){if(_0x32775f){var _0x97aae5=_0x32775f['count'],_0x471314=_0x4e547a['offset'],_0x13e46f=_0x4e547a['offset']+_0x4e547a['limit'],_0x572b40;if(_0x13e46f>=_0x97aae5){_0x13e46f=_0x97aae5;_0x572b40=0xc8;}else{_0x572b40=0xce;}_0x359795[_0xc872('0x21')](_0x572b40);return _0x359795['set'](_0xc872('0x24'),_0x471314+'-'+_0x13e46f+'/'+_0x97aae5)[_0xc872('0x23')](_0x32775f);}return null;};}function patchUpdates(_0x2de99b){return function(_0x4f4648){try{jsonpatch[_0xc872('0x25')](_0x4f4648,_0x2de99b,!![]);}catch(_0x136013){return BPromise[_0xc872('0x26')](_0x136013);}return _0x4f4648[_0xc872('0x27')]();};}function saveUpdates(_0x436188,_0x1a345a){return function(_0x164a52){if(_0x164a52){return _0x164a52['update'](_0x436188)['then'](function(_0xba9ce2){return _0xba9ce2;});}return null;};}function removeEntity(_0x11f50d,_0x30aaf9){return function(_0x21f564){if(_0x21f564){return _0x21f564[_0xc872('0x28')]()[_0xc872('0x29')](function(){var _0x1b06cf=_0x21f564[_0xc872('0x2a')]({'plain':!![]});var _0x37c49e=_0xc872('0x2b');return db[_0xc872('0x2c')]['destroy']({'where':{'type':_0x37c49e,'resourceId':_0x1b06cf['id']}})[_0xc872('0x29')](function(){return _0x21f564;});})[_0xc872('0x29')](function(){_0x11f50d[_0xc872('0x21')](0xcc)[_0xc872('0x22')]();});}};}function handleEntityNotFound(_0x546789,_0x1d3c61){return function(_0x47dd95){if(!_0x47dd95){_0x546789['sendStatus'](0x194);}return _0x47dd95;};}function handleError(_0x5a2034,_0x4e2bc3){_0x4e2bc3=_0x4e2bc3||0x1f4;return function(_0x25f0c8){logger[_0xc872('0x2d')](_0x25f0c8[_0xc872('0x2e')]);if(_0x25f0c8[_0xc872('0x2f')]){delete _0x25f0c8[_0xc872('0x2f')];}_0x5a2034[_0xc872('0x21')](_0x4e2bc3)[_0xc872('0x30')](_0x25f0c8);};}exports[_0xc872('0x31')]=function(_0x1c7832,_0xc2f8ab){var _0x309fc7={},_0xcbddcd={},_0x3fa003={'count':0x0,'rows':[]};var _0xf4c880=_[_0xc872('0x32')](db[_0xc872('0x33')][_0xc872('0x34')],function(_0x1f8f2d){return{'name':_0x1f8f2d[_0xc872('0x35')],'type':_0x1f8f2d[_0xc872('0x36')]['key']};});_0xcbddcd[_0xc872('0x37')]=_[_0xc872('0x32')](_0xf4c880,_0xc872('0x2f'));_0xcbddcd[_0xc872('0x38')]=_[_0xc872('0x39')](_0x1c7832[_0xc872('0x38')]);_0xcbddcd[_0xc872('0x3a')]=_[_0xc872('0x3b')](_0xcbddcd[_0xc872('0x37')],_0xcbddcd[_0xc872('0x38')]);_0x309fc7[_0xc872('0x3c')]=_['intersection'](_0xcbddcd[_0xc872('0x37')],qs['fields'](_0x1c7832['query']['fields']));_0x309fc7[_0xc872('0x3c')]=_0x309fc7[_0xc872('0x3c')][_0xc872('0x3d')]?_0x309fc7[_0xc872('0x3c')]:_0xcbddcd[_0xc872('0x37')];if(!_0x1c7832['query'][_0xc872('0x3e')](_0xc872('0x3f'))){_0x309fc7[_0xc872('0x40')]=qs[_0xc872('0x40')](_0x1c7832['query']['limit']);_0x309fc7['offset']=qs[_0xc872('0x41')](_0x1c7832[_0xc872('0x38')][_0xc872('0x41')]);}_0x309fc7['order']=qs['sort'](_0x1c7832[_0xc872('0x38')][_0xc872('0x42')]);_0x309fc7['where']=qs['filters'](_[_0xc872('0x43')](_0x1c7832[_0xc872('0x38')],_0xcbddcd[_0xc872('0x3a')]),_0xf4c880);if(_0x1c7832[_0xc872('0x38')][_0xc872('0x44')]){_0x309fc7[_0xc872('0x45')]=_[_0xc872('0x46')](_0x309fc7['where'],{'$or':_[_0xc872('0x32')](_0xf4c880,function(_0x5ae925){if(_0x5ae925['type']!==_0xc872('0x47')){var _0x37a2f9={};_0x37a2f9[_0x5ae925[_0xc872('0x2f')]]={'$like':'%'+_0x1c7832[_0xc872('0x38')]['filter']+'%'};return _0x37a2f9;}})});}_0x309fc7=_[_0xc872('0x46')]({},_0x309fc7,_0x1c7832[_0xc872('0x48')]);var _0x1d5366={'where':_0x309fc7[_0xc872('0x45')]};return db[_0xc872('0x33')][_0xc872('0x49')](_0x1d5366)['then'](function(_0x417bce){_0x3fa003[_0xc872('0x49')]=_0x417bce;if(_0x1c7832[_0xc872('0x38')][_0xc872('0x4a')]){_0x309fc7[_0xc872('0x4b')]=[{'all':!![]}];}return db[_0xc872('0x33')][_0xc872('0x4c')](_0x309fc7);})[_0xc872('0x29')](function(_0xc9908b){_0x3fa003['rows']=_0xc9908b;return _0x3fa003;})[_0xc872('0x29')](respondWithFilteredResult(_0xc2f8ab,_0x309fc7))[_0xc872('0x4d')](handleError(_0xc2f8ab,null));};exports['show']=function(_0x1102ec,_0x551dce){var _0x235310={'raw':!![],'where':{'id':_0x1102ec[_0xc872('0x4e')]['id']}},_0x541f3c={};_0x541f3c['model']=_[_0xc872('0x39')](db['SmsQueue']['rawAttributes']);_0x541f3c[_0xc872('0x38')]=_[_0xc872('0x39')](_0x1102ec[_0xc872('0x38')]);_0x541f3c[_0xc872('0x3a')]=_['intersection'](_0x541f3c[_0xc872('0x37')],_0x541f3c['query']);_0x235310[_0xc872('0x3c')]=_[_0xc872('0x3b')](_0x541f3c[_0xc872('0x37')],qs[_0xc872('0x4f')](_0x1102ec[_0xc872('0x38')][_0xc872('0x4f')]));_0x235310[_0xc872('0x3c')]=_0x235310[_0xc872('0x3c')][_0xc872('0x3d')]?_0x235310[_0xc872('0x3c')]:_0x541f3c['model'];if(_0x1102ec[_0xc872('0x38')]['includeAll']){_0x235310['include']=[{'all':!![]}];}_0x235310=_[_0xc872('0x46')]({},_0x235310,_0x1102ec[_0xc872('0x48')]);return db['SmsQueue']['find'](_0x235310)[_0xc872('0x29')](handleEntityNotFound(_0x551dce,null))[_0xc872('0x29')](respondWithResult(_0x551dce,null))['catch'](handleError(_0x551dce,null));};exports['create']=function(_0x712b6d,_0x476ad3){return db[_0xc872('0x33')][_0xc872('0x50')](_0x712b6d['body'],{})[_0xc872('0x29')](function(_0x5271e9){var _0x2aefaa=_0x712b6d['user'][_0xc872('0x2a')]({'plain':!![]});if(!_0x2aefaa)throw new Error(_0xc872('0x51'));if(_0x2aefaa[_0xc872('0x52')]===_0xc872('0x53')){var _0xd0eee2=_0x5271e9[_0xc872('0x2a')]({'plain':!![]});var _0x6baff2='SmsQueues';return db[_0xc872('0x54')][_0xc872('0x55')]({'where':{'name':_0x6baff2,'userProfileId':_0x2aefaa[_0xc872('0x56')]},'raw':!![]})[_0xc872('0x29')](function(_0xd0fae9){if(_0xd0fae9&&_0xd0fae9[_0xc872('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0xd0eee2[_0xc872('0x2f')],'resourceId':_0xd0eee2['id'],'type':_0xd0fae9['name'],'sectionId':_0xd0fae9['id']},{})[_0xc872('0x29')](function(){return _0x5271e9;});}else{return _0x5271e9;}})[_0xc872('0x4d')](function(_0xa0313c){logger[_0xc872('0x2d')](_0xc872('0x58'),_0xa0313c);throw _0xa0313c;});}return _0x5271e9;})[_0xc872('0x29')](respondWithResult(_0x476ad3,0xc9))[_0xc872('0x4d')](handleError(_0x476ad3,null));};exports['update']=function(_0x2f21c7,_0x2533c1){if(_0x2f21c7['body']['id']){delete _0x2f21c7['body']['id'];}return db[_0xc872('0x33')][_0xc872('0x55')]({'where':{'id':_0x2f21c7['params']['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x2533c1,null))[_0xc872('0x29')](saveUpdates(_0x2f21c7[_0xc872('0x59')],null))[_0xc872('0x29')](respondWithResult(_0x2533c1,null))[_0xc872('0x4d')](handleError(_0x2533c1,null));};exports['destroy']=function(_0x5c0fe8,_0x599dd0){return db[_0xc872('0x33')][_0xc872('0x55')]({'where':{'id':_0x5c0fe8['params']['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x599dd0,null))['then'](removeEntity(_0x599dd0,null))[_0xc872('0x4d')](handleError(_0x599dd0,null));};exports[_0xc872('0x5a')]=function(_0x1c8c56,_0x34759f){return db[_0xc872('0x33')][_0xc872('0x5a')]()[_0xc872('0x29')](respondWithResult(_0x34759f,null))[_0xc872('0x4d')](handleError(_0x34759f,null));};exports[_0xc872('0x5b')]=function(_0x2a6dc9,_0x26442e,_0x4eae01){var _0x1ab2c6={'raw':!![],'where':{}},_0x4f5ab4={},_0x43f081;return db[_0xc872('0x33')][_0xc872('0x5c')]({'where':{'id':_0x2a6dc9[_0xc872('0x4e')]['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x26442e,null))[_0xc872('0x29')](function(_0x422eb2){if(_0x422eb2){_0x43f081=_0x422eb2[_0xc872('0x2a')]({'plain':!![]});_0x4f5ab4['model']=_['keys'](db['UserSmsQueue'][_0xc872('0x34')]);_0x4f5ab4[_0xc872('0x38')]=_['keys'](_0x2a6dc9[_0xc872('0x38')]);_0x4f5ab4['filters']=_[_0xc872('0x3b')](_0x4f5ab4[_0xc872('0x37')],_0x4f5ab4[_0xc872('0x38')]);_0x1ab2c6[_0xc872('0x3c')]=_[_0xc872('0x3b')](_0x4f5ab4[_0xc872('0x37')],qs['fields'](_0x2a6dc9[_0xc872('0x38')][_0xc872('0x4f')]));_0x1ab2c6[_0xc872('0x3c')]=_0x1ab2c6['attributes'][_0xc872('0x3d')]?_0x1ab2c6[_0xc872('0x3c')]:_0x4f5ab4[_0xc872('0x37')];if(!_0x2a6dc9[_0xc872('0x38')]['hasOwnProperty'](_0xc872('0x3f'))){_0x1ab2c6['limit']=qs[_0xc872('0x40')](_0x2a6dc9[_0xc872('0x38')]['limit']);_0x1ab2c6['offset']=qs['offset'](_0x2a6dc9[_0xc872('0x38')][_0xc872('0x41')]);}_0x1ab2c6['order']=qs[_0xc872('0x42')](_0x2a6dc9[_0xc872('0x38')][_0xc872('0x42')]);_0x1ab2c6[_0xc872('0x45')]=qs[_0xc872('0x3a')](_['pick'](_0x2a6dc9[_0xc872('0x38')],_0x4f5ab4[_0xc872('0x3a')]));_0x1ab2c6['where'][_0xc872('0x5d')]=_0x422eb2['id'];if(_0x2a6dc9[_0xc872('0x38')][_0xc872('0x44')]){_0x1ab2c6[_0xc872('0x45')]=_[_0xc872('0x46')](_0x1ab2c6[_0xc872('0x45')],{'$or':_['map'](_0x1ab2c6[_0xc872('0x3c')],function(_0x239198){var _0x346d0c={};_0x346d0c[_0x239198]={'$like':'%'+_0x2a6dc9['query'][_0xc872('0x44')]+'%'};return _0x346d0c;})});}_0x1ab2c6=_['merge']({},_0x1ab2c6,_0x2a6dc9['options']);return db[_0xc872('0x5e')]['findAll'](_0x1ab2c6);}})[_0xc872('0x29')](function(_0x94bb0e){if(_0x94bb0e){return db[_0xc872('0x5f')][_0xc872('0x60')]({'where':{'id':_[_0xc872('0x32')](_0x94bb0e,_0xc872('0x61')),'role':'agent'},'attributes':['id',_0xc872('0x2f'),_0xc872('0x62'),'updatedAt',_0xc872('0x63')]});}})[_0xc872('0x29')](function(_0x5aa5e3){if(_0x5aa5e3){return{'count':_0x5aa5e3['count'],'rows':_[_0xc872('0x32')](_0x5aa5e3['rows'],function(_0x557c8f){return{'membername':_0x557c8f[_0xc872('0x2f')],'UserId':_0x557c8f['id'],'queue_name':_0x43f081[_0xc872('0x2f')],'SmsQueueId':_0x43f081['id'],'interface':util[_0xc872('0x64')]('%s/%s',_0xc872('0x65'),_0x557c8f[_0xc872('0x2f')]),'penalty':0x0,'paused':_0x557c8f[_0xc872('0x62')],'createdAt':_0x557c8f[_0xc872('0x63')],'updatedAt':_0x557c8f[_0xc872('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc872('0x29')](respondWithFilteredResult(_0x26442e,_0x1ab2c6))[_0xc872('0x4d')](handleError(_0x26442e,null));};exports[_0xc872('0x67')]=function(_0x4c5eae,_0x2dc82e,_0x8b06fb){var _0x35530e={};var _0x2ff401={};var _0x398ca5;var _0xfb6acb;return db[_0xc872('0x33')]['findOne']({'where':{'id':_0x4c5eae[_0xc872('0x4e')]['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x2dc82e,null))['then'](function(_0x95251b){if(_0x95251b){_0x398ca5=_0x95251b;_0x2ff401['model']=_[_0xc872('0x39')](db[_0xc872('0x68')][_0xc872('0x34')]);_0x2ff401['query']=_[_0xc872('0x39')](_0x4c5eae['query']);_0x2ff401[_0xc872('0x3a')]=_[_0xc872('0x3b')](_0x2ff401[_0xc872('0x37')],_0x2ff401[_0xc872('0x38')]);_0x35530e[_0xc872('0x3c')]=_['intersection'](_0x2ff401['model'],qs[_0xc872('0x4f')](_0x4c5eae['query'][_0xc872('0x4f')]));_0x35530e[_0xc872('0x3c')]=_0x35530e[_0xc872('0x3c')][_0xc872('0x3d')]?_0x35530e[_0xc872('0x3c')]:_0x2ff401[_0xc872('0x37')];_0x35530e[_0xc872('0x69')]=qs[_0xc872('0x42')](_0x4c5eae[_0xc872('0x38')][_0xc872('0x42')]);_0x35530e['where']=qs['filters'](_[_0xc872('0x43')](_0x4c5eae['query'],_0x2ff401['filters']));if(_0x4c5eae[_0xc872('0x38')][_0xc872('0x44')]){_0x35530e[_0xc872('0x45')]=_[_0xc872('0x46')](_0x35530e[_0xc872('0x45')],{'$or':_[_0xc872('0x32')](_0x35530e[_0xc872('0x3c')],function(_0x1bb019){var _0x3bdf3f={};_0x3bdf3f[_0x1bb019]={'$like':'%'+_0x4c5eae[_0xc872('0x38')]['filter']+'%'};return _0x3bdf3f;})});}_0x35530e=_[_0xc872('0x46')]({},_0x35530e,_0x4c5eae[_0xc872('0x48')]);return _0x398ca5['getTeams'](_0x35530e);}})['then'](function(_0x247734){if(_0x247734){_0xfb6acb=_0x247734[_0xc872('0x3d')];if(!_0x4c5eae[_0xc872('0x38')]['hasOwnProperty']('nolimit')){_0x35530e[_0xc872('0x40')]=qs[_0xc872('0x40')](_0x4c5eae['query']['limit']);_0x35530e['offset']=qs['offset'](_0x4c5eae[_0xc872('0x38')][_0xc872('0x41')]);}return _0x398ca5[_0xc872('0x67')](_0x35530e);}})[_0xc872('0x29')](function(_0x596f10){if(_0x596f10){return _0x596f10?{'count':_0xfb6acb,'rows':_0x596f10}:null;}})[_0xc872('0x29')](respondWithResult(_0x2dc82e,null))['catch'](handleError(_0x2dc82e,null));};exports[_0xc872('0x6a')]=function(_0x348fd4,_0x28964a,_0x5994b9){var _0x1120d3=_0x348fd4[_0xc872('0x59')]['ids'];return db[_0xc872('0x68')][_0xc872('0x4c')]({'where':{'id':_0x1120d3},'attributes':['id'],'include':[{'model':db[_0xc872('0x5f')],'as':'Agents','attributes':['id',_0xc872('0x2f'),_0xc872('0x6b'),_0xc872('0x6c'),_0xc872('0x6d')],'raw':!![]}]})[_0xc872('0x29')](function(_0x97175a){if(_0x97175a){var _0xc2c81c=_[_0xc872('0x6e')](_0x97175a,function(_0x207846){var _0x1c7027=_0x207846[_0xc872('0x2a')]({'plain':!![]});return _0x1c7027[_0xc872('0x6f')];});return db['SmsQueue']['find']({'where':{'id':_0x348fd4['params']['id']}})[_0xc872('0x29')](function(_0x3c6551){return db[_0xc872('0x70')][_0xc872('0x71')](function(_0x1bf04e){return _0x3c6551['addTeams'](_0x1120d3,{'transaction':_0x1bf04e})[_0xc872('0x29')](function(){return BPromise[_0xc872('0x72')](_0xc2c81c,function(_0x24dd8e){return db[_0xc872('0x5e')][_0xc872('0x73')]({'where':{'UserId':_0x24dd8e['id'],'SmsQueueId':_0x348fd4[_0xc872('0x4e')]['id']},'transaction':_0x1bf04e});});})[_0xc872('0x29')](function(){_0xc2c81c[_0xc872('0x74')](function(_0x3cc67b){socket[_0xc872('0x75')](_0xc872('0x76'),{'UserId':_0x3cc67b['id'],'SmsQueueId':_0x3c6551['id']});});});});});}})[_0xc872('0x29')](respondWithStatusCode(_0x28964a,null))[_0xc872('0x4d')](handleError(_0x28964a,null));};exports[_0xc872('0x77')]=function(_0x480799,_0x3b8b48,_0x36c2ae){return db[_0xc872('0x68')][_0xc872('0x4c')]({'where':{'id':_0x480799[_0xc872('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc872('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xc872('0x29')](handleEntityNotFound(_0x3b8b48,null))['then'](function(_0x382a7a){var _0xed4a2=_[_0xc872('0x32')](_0x382a7a,'id');var _0x33619e=[];var _0x21fc70=[];var _0x180e52=squel[_0xc872('0x78')]();_0x180e52['field'](_0xc872('0x79'))[_0xc872('0x7a')](_0xc872('0x7b'),'tq')[_0xc872('0x7c')](_0xc872('0x7d'),'ut',_0xc872('0x7e'))[_0xc872('0x45')](_0xc872('0x7f'),_0x480799[_0xc872('0x4e')]['id']);for(var _0x7d1dcf=0x0;_0x7d1dcf<_0x382a7a['length'];_0x7d1dcf+=0x1){let _0x13f0f6=_0x382a7a[_0x7d1dcf];for(var _0x3ae512=0x0;_0x3ae512<_0x13f0f6['Agents']['length'];_0x3ae512+=0x1){let _0x2189fe=_0x13f0f6[_0xc872('0x6f')][_0x3ae512];var _0x27e446=_0x180e52[_0xc872('0x80')]();_0x27e446[_0xc872('0x45')](_0xc872('0x81'),_0x2189fe['id']);_0x21fc70['push'](db[_0xc872('0x70')][_0xc872('0x38')](_0x27e446['toString'](),{'type':db[_0xc872('0x70')][_0xc872('0x82')][_0xc872('0x83')]})[_0xc872('0x29')](function(_0x304c55){if(_0x304c55[_0xc872('0x3d')]===0x1){return _0x2189fe['id'];}else{var _0x5040ca=_['every'](_['map'](_0x304c55,_0xc872('0x84')),function(_0xfcf989){return _[_0xc872('0x85')](_0xed4a2,_0xfcf989);});if(_0x5040ca){return _0x2189fe['id'];}}}));}}return BPromise['all'](_0x21fc70)[_0xc872('0x29')](function(_0x481709){_0x33619e=_(_0x33619e)[_0xc872('0x86')](_0x481709)[_0xc872('0x87')]()['value']();return db[_0xc872('0x33')][_0xc872('0x55')]({'where':{'id':_0x480799[_0xc872('0x4e')]['id']}})[_0xc872('0x29')](function(_0x839611){return db[_0xc872('0x70')][_0xc872('0x71')](function(_0x35d205){return _0x839611[_0xc872('0x77')](_0x480799[_0xc872('0x38')]['ids'],{'transaction':_0x35d205})[_0xc872('0x29')](function(){if(!_[_0xc872('0x88')](_0x33619e)){return _0x839611['removeAgents'](_0x33619e,{'transaction':_0x35d205});}})['then'](function(){_0x33619e[_0xc872('0x74')](function(_0x2623d1){socket['emit'](_0xc872('0x89'),{'UserId':_0x2623d1,'SmsQueueId':_0x839611['id']});});});});});});})['then'](respondWithStatusCode(_0x3b8b48,null))['catch'](handleError(_0x3b8b48,null));};exports[_0xc872('0x8a')]=function(_0x1284d9,_0x3469b9,_0xe7d056){return db[_0xc872('0x33')][_0xc872('0x55')]({'where':{'id':_0x1284d9[_0xc872('0x4e')]['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x3469b9,null))['then'](function(_0x965aaf){if(_0x965aaf){return _0x965aaf['addAgents'](_0x1284d9[_0xc872('0x59')][_0xc872('0x8b')],_[_0xc872('0x8c')](_0x1284d9[_0xc872('0x59')],[_0xc872('0x8b'),'id'])||{})['spread'](function(_0x3a85d8){for(var _0x318be9=0x0;_0x318be9<_0x1284d9[_0xc872('0x59')]['ids'][_0xc872('0x3d')];_0x318be9+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x1284d9['body']['ids'][_0x318be9],'SmsQueueId':_0x1284d9[_0xc872('0x4e')]['id']});}return _0x3a85d8;});}})['then'](respondWithResult(_0x3469b9,null))[_0xc872('0x4d')](handleError(_0x3469b9,null));};exports['removeAgents']=function(_0x3da5a9,_0x561d74,_0x800479){return db[_0xc872('0x33')][_0xc872('0x55')]({'where':{'id':_0x3da5a9[_0xc872('0x4e')]['id']}})['then'](handleEntityNotFound(_0x561d74,null))[_0xc872('0x29')](function(_0x190ba5){if(_0x190ba5){return _0x190ba5[_0xc872('0x8d')](_0x3da5a9[_0xc872('0x38')][_0xc872('0x8b')])[_0xc872('0x29')](function(){if(_[_0xc872('0x8e')](_0x3da5a9[_0xc872('0x38')][_0xc872('0x8b')])){for(var _0x2fbead=0x0;_0x2fbead<_0x3da5a9[_0xc872('0x38')][_0xc872('0x8b')][_0xc872('0x3d')];_0x2fbead+=0x1){socket[_0xc872('0x75')](_0xc872('0x89'),{'UserId':Number(_0x3da5a9[_0xc872('0x38')][_0xc872('0x8b')][_0x2fbead]),'SmsQueueId':Number(_0x3da5a9[_0xc872('0x4e')]['id'])});}}else{socket[_0xc872('0x75')](_0xc872('0x89'),{'UserId':Number(_0x3da5a9[_0xc872('0x38')][_0xc872('0x8b')]),'SmsQueueId':Number(_0x3da5a9[_0xc872('0x4e')]['id'])});}});}})[_0xc872('0x29')](respondWithStatusCode(_0x561d74,null))[_0xc872('0x4d')](handleError(_0x561d74,null));};exports['getAgents']=function(_0x5c96e3,_0x292344,_0x16411b){var _0x37f582={};var _0x4e65fe={};var _0x3ec29a;var _0x5cbc25;return db[_0xc872('0x33')][_0xc872('0x5c')]({'where':{'id':_0x5c96e3[_0xc872('0x4e')]['id']}})[_0xc872('0x29')](handleEntityNotFound(_0x292344,null))[_0xc872('0x29')](function(_0x3eaf57){if(_0x3eaf57){_0x3ec29a=_0x3eaf57;_0x4e65fe[_0xc872('0x37')]=_[_0xc872('0x39')](db['User'][_0xc872('0x34')]);_0x4e65fe[_0xc872('0x38')]=_[_0xc872('0x39')](_0x5c96e3[_0xc872('0x38')]);_0x4e65fe[_0xc872('0x3a')]=_[_0xc872('0x3b')](_0x4e65fe[_0xc872('0x37')],_0x4e65fe[_0xc872('0x38')]);_0x37f582['attributes']=_['intersection'](_0x4e65fe[_0xc872('0x37')],qs[_0xc872('0x4f')](_0x5c96e3['query']['fields']));_0x37f582[_0xc872('0x3c')]=_0x37f582[_0xc872('0x3c')]['length']?_0x37f582[_0xc872('0x3c')]:_0x4e65fe[_0xc872('0x37')];_0x37f582[_0xc872('0x69')]=qs[_0xc872('0x42')](_0x5c96e3[_0xc872('0x38')][_0xc872('0x42')]);_0x37f582[_0xc872('0x45')]=qs['filters'](_[_0xc872('0x43')](_0x5c96e3['query'],_0x4e65fe[_0xc872('0x3a')]));if(_0x5c96e3['query'][_0xc872('0x44')]){_0x37f582[_0xc872('0x45')]=_[_0xc872('0x46')](_0x37f582[_0xc872('0x45')],{'$or':_[_0xc872('0x32')](_0x37f582[_0xc872('0x3c')],function(_0x2c30e5){var _0x153724={};_0x153724[_0x2c30e5]={'$like':'%'+_0x5c96e3[_0xc872('0x38')][_0xc872('0x44')]+'%'};return _0x153724;})});}_0x37f582=_[_0xc872('0x46')]({},_0x37f582,_0x5c96e3[_0xc872('0x48')]);return _0x3ec29a[_0xc872('0x8f')](_0x37f582);}})[_0xc872('0x29')](function(_0x2a9007){if(_0x2a9007){_0x5cbc25=_0x2a9007[_0xc872('0x3d')];if(!_0x5c96e3[_0xc872('0x38')][_0xc872('0x3e')](_0xc872('0x3f'))){_0x37f582[_0xc872('0x40')]=qs[_0xc872('0x40')](_0x5c96e3[_0xc872('0x38')][_0xc872('0x40')]);_0x37f582[_0xc872('0x41')]=qs[_0xc872('0x41')](_0x5c96e3[_0xc872('0x38')][_0xc872('0x41')]);}return _0x3ec29a[_0xc872('0x8f')](_0x37f582);}})[_0xc872('0x29')](function(_0x6acc24){if(_0x6acc24){return _0x6acc24?{'count':_0x5cbc25,'rows':_0x6acc24}:null;}})[_0xc872('0x29')](respondWithResult(_0x292344,null))[_0xc872('0x4d')](handleError(_0x292344,null));}; \ No newline at end of file +var _0xb794=['moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','then','SmsQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SmsQueue','findAll','rows','catch','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','User','UserId','agent','updatedAt','createdAt','format','SIP','smsPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','QueryTypes','TeamId','includes','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x1f4ada,_0xe8382e){var _0x5d27fa=function(_0x2957d2){while(--_0x2957d2){_0x1f4ada['push'](_0x1f4ada['shift']());}};_0x5d27fa(++_0xe8382e);}(_0xb794,0x82));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4b79('0x0'));var emlformat=require(_0x4b79('0x1'));var rimraf=require(_0x4b79('0x2'));var zipdir=require(_0x4b79('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b79('0x4'));var moment=require(_0x4b79('0x5'));var BPromise=require(_0x4b79('0x6'));var Mustache=require(_0x4b79('0x7'));var util=require('util');var path=require(_0x4b79('0x8'));var sox=require('sox');var csv=require(_0x4b79('0x9'));var ejs=require(_0x4b79('0xa'));var fs=require('fs');var _=require(_0x4b79('0xb'));var squel=require(_0x4b79('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b79('0xd'));var deskjs=require(_0x4b79('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4b79('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b79('0x10'));var as=require(_0x4b79('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b79('0x12'))(_0x4b79('0x13'));var utils=require(_0x4b79('0x14'));var config=require(_0x4b79('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4b79('0x16')](config[_0x4b79('0x17')],{'host':_0x4b79('0x18'),'port':0x18eb});var socket=require(_0x4b79('0x19'))(new Redis(config[_0x4b79('0x17')]));require(_0x4b79('0x1a'))[_0x4b79('0x1b')](socket);function respondWithStatusCode(_0x1dbfbc,_0x5b6b0c){_0x5b6b0c=_0x5b6b0c||0xcc;return function(_0x5626b2){if(_0x5626b2){return _0x1dbfbc[_0x4b79('0x1c')](_0x5b6b0c);}return _0x1dbfbc['status'](_0x5b6b0c)['end']();};}function respondWithResult(_0x2cd92e,_0xb76285){_0xb76285=_0xb76285||0xc8;return function(_0x4653e6){if(_0x4653e6){return _0x2cd92e[_0x4b79('0x1d')](_0xb76285)['json'](_0x4653e6);}};}function respondWithFilteredResult(_0x40fa5d,_0x5245d0){return function(_0xaf1a35){if(_0xaf1a35){var _0x9798ea=_0xaf1a35[_0x4b79('0x1e')],_0x37fbc1=_0x5245d0[_0x4b79('0x1f')],_0x1890e5=_0x5245d0['offset']+_0x5245d0[_0x4b79('0x20')],_0x22e49e;if(_0x1890e5>=_0x9798ea){_0x1890e5=_0x9798ea;_0x22e49e=0xc8;}else{_0x22e49e=0xce;}_0x40fa5d['status'](_0x22e49e);return _0x40fa5d[_0x4b79('0x21')](_0x4b79('0x22'),_0x37fbc1+'-'+_0x1890e5+'/'+_0x9798ea)[_0x4b79('0x23')](_0xaf1a35);}return null;};}function patchUpdates(_0x49c95b){return function(_0x8407cc){try{jsonpatch[_0x4b79('0x24')](_0x8407cc,_0x49c95b,!![]);}catch(_0x120219){return BPromise['reject'](_0x120219);}return _0x8407cc['save']();};}function saveUpdates(_0x1764a2,_0x8193eb){return function(_0x472f54){if(_0x472f54){return _0x472f54['update'](_0x1764a2)[_0x4b79('0x25')](function(_0x4f93ea){return _0x4f93ea;});}return null;};}function removeEntity(_0x8a91eb,_0x3cd278){return function(_0x48a11e){if(_0x48a11e){return _0x48a11e['destroy']()[_0x4b79('0x25')](function(){var _0x38477f=_0x48a11e['get']({'plain':!![]});var _0x3e988e=_0x4b79('0x26');return db[_0x4b79('0x27')]['destroy']({'where':{'type':_0x3e988e,'resourceId':_0x38477f['id']}})[_0x4b79('0x25')](function(){return _0x48a11e;});})[_0x4b79('0x25')](function(){_0x8a91eb[_0x4b79('0x1d')](0xcc)[_0x4b79('0x28')]();});}};}function handleEntityNotFound(_0x103114,_0x10445b){return function(_0x46f9c5){if(!_0x46f9c5){_0x103114['sendStatus'](0x194);}return _0x46f9c5;};}function handleError(_0xe3e1e3,_0x42eecf){_0x42eecf=_0x42eecf||0x1f4;return function(_0x2ab265){logger[_0x4b79('0x29')](_0x2ab265[_0x4b79('0x2a')]);if(_0x2ab265[_0x4b79('0x2b')]){delete _0x2ab265[_0x4b79('0x2b')];}_0xe3e1e3[_0x4b79('0x1d')](_0x42eecf)[_0x4b79('0x2c')](_0x2ab265);};}exports[_0x4b79('0x2d')]=function(_0x27f8ae,_0x4b0d89){var _0x3894a7={},_0x5a22bb={},_0x22abc4={'count':0x0,'rows':[]};var _0x2a6401=_[_0x4b79('0x2e')](db['SmsQueue'][_0x4b79('0x2f')],function(_0x166a70){return{'name':_0x166a70['fieldName'],'type':_0x166a70['type'][_0x4b79('0x30')]};});_0x5a22bb[_0x4b79('0x31')]=_[_0x4b79('0x2e')](_0x2a6401,_0x4b79('0x2b'));_0x5a22bb[_0x4b79('0x32')]=_[_0x4b79('0x33')](_0x27f8ae['query']);_0x5a22bb[_0x4b79('0x34')]=_['intersection'](_0x5a22bb[_0x4b79('0x31')],_0x5a22bb[_0x4b79('0x32')]);_0x3894a7[_0x4b79('0x35')]=_[_0x4b79('0x36')](_0x5a22bb[_0x4b79('0x31')],qs['fields'](_0x27f8ae['query']['fields']));_0x3894a7['attributes']=_0x3894a7[_0x4b79('0x35')][_0x4b79('0x37')]?_0x3894a7[_0x4b79('0x35')]:_0x5a22bb['model'];if(!_0x27f8ae[_0x4b79('0x32')]['hasOwnProperty'](_0x4b79('0x38'))){_0x3894a7['limit']=qs[_0x4b79('0x20')](_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x20')]);_0x3894a7[_0x4b79('0x1f')]=qs['offset'](_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x1f')]);}_0x3894a7[_0x4b79('0x39')]=qs['sort'](_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x3a')]);_0x3894a7['where']=qs['filters'](_[_0x4b79('0x3b')](_0x27f8ae[_0x4b79('0x32')],_0x5a22bb[_0x4b79('0x34')]),_0x2a6401);if(_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x3c')]){_0x3894a7[_0x4b79('0x3d')]=_[_0x4b79('0x3e')](_0x3894a7['where'],{'$or':_[_0x4b79('0x2e')](_0x2a6401,function(_0x39abf9){if(_0x39abf9['type']!==_0x4b79('0x3f')){var _0x537299={};_0x537299[_0x39abf9[_0x4b79('0x2b')]]={'$like':'%'+_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x3c')]+'%'};return _0x537299;}})});}_0x3894a7=_[_0x4b79('0x3e')]({},_0x3894a7,_0x27f8ae[_0x4b79('0x40')]);var _0x3a1c90={'where':_0x3894a7[_0x4b79('0x3d')]};return db['SmsQueue'][_0x4b79('0x1e')](_0x3a1c90)[_0x4b79('0x25')](function(_0x5d53c7){_0x22abc4[_0x4b79('0x1e')]=_0x5d53c7;if(_0x27f8ae[_0x4b79('0x32')][_0x4b79('0x41')]){_0x3894a7[_0x4b79('0x42')]=[{'all':!![]}];}return db[_0x4b79('0x43')][_0x4b79('0x44')](_0x3894a7);})[_0x4b79('0x25')](function(_0x207a8e){_0x22abc4[_0x4b79('0x45')]=_0x207a8e;return _0x22abc4;})[_0x4b79('0x25')](respondWithFilteredResult(_0x4b0d89,_0x3894a7))[_0x4b79('0x46')](handleError(_0x4b0d89,null));};exports['show']=function(_0x1664e2,_0x4a9c7a){var _0x3db83a={'raw':!![],'where':{'id':_0x1664e2['params']['id']}},_0x960628={};_0x960628[_0x4b79('0x31')]=_['keys'](db[_0x4b79('0x43')][_0x4b79('0x2f')]);_0x960628['query']=_[_0x4b79('0x33')](_0x1664e2[_0x4b79('0x32')]);_0x960628['filters']=_[_0x4b79('0x36')](_0x960628[_0x4b79('0x31')],_0x960628[_0x4b79('0x32')]);_0x3db83a[_0x4b79('0x35')]=_['intersection'](_0x960628['model'],qs[_0x4b79('0x47')](_0x1664e2['query'][_0x4b79('0x47')]));_0x3db83a[_0x4b79('0x35')]=_0x3db83a[_0x4b79('0x35')][_0x4b79('0x37')]?_0x3db83a[_0x4b79('0x35')]:_0x960628[_0x4b79('0x31')];if(_0x1664e2['query'][_0x4b79('0x41')]){_0x3db83a[_0x4b79('0x42')]=[{'all':!![]}];}_0x3db83a=_['merge']({},_0x3db83a,_0x1664e2[_0x4b79('0x40')]);return db['SmsQueue'][_0x4b79('0x48')](_0x3db83a)[_0x4b79('0x25')](handleEntityNotFound(_0x4a9c7a,null))[_0x4b79('0x25')](respondWithResult(_0x4a9c7a,null))[_0x4b79('0x46')](handleError(_0x4a9c7a,null));};exports[_0x4b79('0x49')]=function(_0x4aefb3,_0x4bca34){return db['SmsQueue']['create'](_0x4aefb3[_0x4b79('0x4a')],{})[_0x4b79('0x25')](function(_0x348e89){var _0x489841=_0x4aefb3[_0x4b79('0x4b')]['get']({'plain':!![]});if(!_0x489841)throw new Error(_0x4b79('0x4c'));if(_0x489841[_0x4b79('0x4d')]==='user'){var _0x3a71c3=_0x348e89[_0x4b79('0x4e')]({'plain':!![]});var _0x243920='SmsQueues';return db['UserProfileSection'][_0x4b79('0x48')]({'where':{'name':_0x243920,'userProfileId':_0x489841[_0x4b79('0x4f')]},'raw':!![]})[_0x4b79('0x25')](function(_0x4629b7){if(_0x4629b7&&_0x4629b7[_0x4b79('0x50')]===0x0){return db[_0x4b79('0x27')]['create']({'name':_0x3a71c3['name'],'resourceId':_0x3a71c3['id'],'type':_0x4629b7['name'],'sectionId':_0x4629b7['id']},{})[_0x4b79('0x25')](function(){return _0x348e89;});}else{return _0x348e89;}})['catch'](function(_0x2f075f){logger['error'](_0x4b79('0x51'),_0x2f075f);throw _0x2f075f;});}return _0x348e89;})[_0x4b79('0x25')](respondWithResult(_0x4bca34,0xc9))['catch'](handleError(_0x4bca34,null));};exports[_0x4b79('0x52')]=function(_0xbfb5a2,_0x535506){if(_0xbfb5a2[_0x4b79('0x4a')]['id']){delete _0xbfb5a2['body']['id'];}return db[_0x4b79('0x43')][_0x4b79('0x48')]({'where':{'id':_0xbfb5a2[_0x4b79('0x53')]['id']}})['then'](handleEntityNotFound(_0x535506,null))[_0x4b79('0x25')](saveUpdates(_0xbfb5a2[_0x4b79('0x4a')],null))['then'](respondWithResult(_0x535506,null))[_0x4b79('0x46')](handleError(_0x535506,null));};exports[_0x4b79('0x54')]=function(_0x2534d9,_0x4cbf9f){return db[_0x4b79('0x43')]['find']({'where':{'id':_0x2534d9[_0x4b79('0x53')]['id']}})[_0x4b79('0x25')](handleEntityNotFound(_0x4cbf9f,null))[_0x4b79('0x25')](removeEntity(_0x4cbf9f,null))['catch'](handleError(_0x4cbf9f,null));};exports['describe']=function(_0x169f77,_0x46ea8){return db[_0x4b79('0x43')][_0x4b79('0x55')]()[_0x4b79('0x25')](respondWithResult(_0x46ea8,null))[_0x4b79('0x46')](handleError(_0x46ea8,null));};exports[_0x4b79('0x56')]=function(_0x5cc78f,_0x43253a,_0x1b8b80){var _0x516816={'raw':!![],'where':{}},_0x19ec45={},_0x254bfb;return db[_0x4b79('0x43')][_0x4b79('0x57')]({'where':{'id':_0x5cc78f[_0x4b79('0x53')]['id']}})[_0x4b79('0x25')](handleEntityNotFound(_0x43253a,null))[_0x4b79('0x25')](function(_0x3d2b5b){if(_0x3d2b5b){_0x254bfb=_0x3d2b5b[_0x4b79('0x4e')]({'plain':!![]});_0x19ec45['model']=_[_0x4b79('0x33')](db[_0x4b79('0x58')][_0x4b79('0x2f')]);_0x19ec45[_0x4b79('0x32')]=_[_0x4b79('0x33')](_0x5cc78f[_0x4b79('0x32')]);_0x19ec45['filters']=_['intersection'](_0x19ec45[_0x4b79('0x31')],_0x19ec45[_0x4b79('0x32')]);_0x516816['attributes']=_[_0x4b79('0x36')](_0x19ec45[_0x4b79('0x31')],qs['fields'](_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x47')]));_0x516816[_0x4b79('0x35')]=_0x516816[_0x4b79('0x35')][_0x4b79('0x37')]?_0x516816[_0x4b79('0x35')]:_0x19ec45[_0x4b79('0x31')];if(!_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x59')]('nolimit')){_0x516816['limit']=qs[_0x4b79('0x20')](_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x20')]);_0x516816['offset']=qs[_0x4b79('0x1f')](_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x1f')]);}_0x516816[_0x4b79('0x39')]=qs[_0x4b79('0x3a')](_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x3a')]);_0x516816[_0x4b79('0x3d')]=qs[_0x4b79('0x34')](_[_0x4b79('0x3b')](_0x5cc78f[_0x4b79('0x32')],_0x19ec45['filters']));_0x516816[_0x4b79('0x3d')][_0x4b79('0x5a')]=_0x3d2b5b['id'];if(_0x5cc78f['query'][_0x4b79('0x3c')]){_0x516816[_0x4b79('0x3d')]=_[_0x4b79('0x3e')](_0x516816[_0x4b79('0x3d')],{'$or':_[_0x4b79('0x2e')](_0x516816[_0x4b79('0x35')],function(_0x393f8d){var _0x2ba971={};_0x2ba971[_0x393f8d]={'$like':'%'+_0x5cc78f[_0x4b79('0x32')][_0x4b79('0x3c')]+'%'};return _0x2ba971;})});}_0x516816=_[_0x4b79('0x3e')]({},_0x516816,_0x5cc78f[_0x4b79('0x40')]);return db[_0x4b79('0x58')][_0x4b79('0x44')](_0x516816);}})[_0x4b79('0x25')](function(_0x584f8b){if(_0x584f8b){return db[_0x4b79('0x5b')]['findAndCountAll']({'where':{'id':_[_0x4b79('0x2e')](_0x584f8b,_0x4b79('0x5c')),'role':_0x4b79('0x5d')},'attributes':['id',_0x4b79('0x2b'),'smsPause',_0x4b79('0x5e'),_0x4b79('0x5f')]});}})['then'](function(_0x3f1650){if(_0x3f1650){return{'count':_0x3f1650[_0x4b79('0x1e')],'rows':_[_0x4b79('0x2e')](_0x3f1650[_0x4b79('0x45')],function(_0x51acf5){return{'membername':_0x51acf5['name'],'UserId':_0x51acf5['id'],'queue_name':_0x254bfb[_0x4b79('0x2b')],'SmsQueueId':_0x254bfb['id'],'interface':util[_0x4b79('0x60')]('%s/%s',_0x4b79('0x61'),_0x51acf5[_0x4b79('0x2b')]),'penalty':0x0,'paused':_0x51acf5[_0x4b79('0x62')],'createdAt':_0x51acf5['createdAt'],'updatedAt':_0x51acf5[_0x4b79('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b79('0x25')](respondWithFilteredResult(_0x43253a,_0x516816))[_0x4b79('0x46')](handleError(_0x43253a,null));};exports[_0x4b79('0x63')]=function(_0x2126a6,_0x4566e7,_0x5b5f9e){var _0x45cb51={};var _0x10da76={};var _0x4c9f06;var _0x5cf77e;return db[_0x4b79('0x43')][_0x4b79('0x57')]({'where':{'id':_0x2126a6[_0x4b79('0x53')]['id']}})[_0x4b79('0x25')](handleEntityNotFound(_0x4566e7,null))[_0x4b79('0x25')](function(_0x5bf402){if(_0x5bf402){_0x4c9f06=_0x5bf402;_0x10da76[_0x4b79('0x31')]=_[_0x4b79('0x33')](db['Team'][_0x4b79('0x2f')]);_0x10da76['query']=_[_0x4b79('0x33')](_0x2126a6[_0x4b79('0x32')]);_0x10da76[_0x4b79('0x34')]=_[_0x4b79('0x36')](_0x10da76['model'],_0x10da76['query']);_0x45cb51[_0x4b79('0x35')]=_[_0x4b79('0x36')](_0x10da76[_0x4b79('0x31')],qs['fields'](_0x2126a6[_0x4b79('0x32')][_0x4b79('0x47')]));_0x45cb51['attributes']=_0x45cb51[_0x4b79('0x35')]['length']?_0x45cb51[_0x4b79('0x35')]:_0x10da76[_0x4b79('0x31')];_0x45cb51[_0x4b79('0x39')]=qs[_0x4b79('0x3a')](_0x2126a6['query'][_0x4b79('0x3a')]);_0x45cb51[_0x4b79('0x3d')]=qs[_0x4b79('0x34')](_['pick'](_0x2126a6[_0x4b79('0x32')],_0x10da76[_0x4b79('0x34')]));if(_0x2126a6[_0x4b79('0x32')][_0x4b79('0x3c')]){_0x45cb51[_0x4b79('0x3d')]=_[_0x4b79('0x3e')](_0x45cb51['where'],{'$or':_[_0x4b79('0x2e')](_0x45cb51[_0x4b79('0x35')],function(_0x403e74){var _0x59ae5f={};_0x59ae5f[_0x403e74]={'$like':'%'+_0x2126a6[_0x4b79('0x32')][_0x4b79('0x3c')]+'%'};return _0x59ae5f;})});}_0x45cb51=_['merge']({},_0x45cb51,_0x2126a6['options']);return _0x4c9f06[_0x4b79('0x63')](_0x45cb51);}})[_0x4b79('0x25')](function(_0x577bf7){if(_0x577bf7){_0x5cf77e=_0x577bf7[_0x4b79('0x37')];if(!_0x2126a6[_0x4b79('0x32')][_0x4b79('0x59')]('nolimit')){_0x45cb51[_0x4b79('0x20')]=qs[_0x4b79('0x20')](_0x2126a6[_0x4b79('0x32')]['limit']);_0x45cb51[_0x4b79('0x1f')]=qs['offset'](_0x2126a6[_0x4b79('0x32')][_0x4b79('0x1f')]);}return _0x4c9f06['getTeams'](_0x45cb51);}})[_0x4b79('0x25')](function(_0xeda52e){if(_0xeda52e){return _0xeda52e?{'count':_0x5cf77e,'rows':_0xeda52e}:null;}})[_0x4b79('0x25')](respondWithResult(_0x4566e7,null))['catch'](handleError(_0x4566e7,null));};exports[_0x4b79('0x64')]=function(_0xae0df9,_0x2a5d18,_0x5e53ab){var _0x48f6e4=_0xae0df9[_0x4b79('0x4a')][_0x4b79('0x65')];return db[_0x4b79('0x66')][_0x4b79('0x44')]({'where':{'id':_0x48f6e4},'attributes':['id'],'include':[{'model':db[_0x4b79('0x5b')],'as':_0x4b79('0x67'),'attributes':['id',_0x4b79('0x2b'),_0x4b79('0x68'),_0x4b79('0x69'),_0x4b79('0x6a')],'raw':!![]}]})[_0x4b79('0x25')](function(_0x54f7b0){if(_0x54f7b0){var _0x4ef8f5=_[_0x4b79('0x6b')](_0x54f7b0,function(_0x3c3547){var _0x4867de=_0x3c3547[_0x4b79('0x4e')]({'plain':!![]});return _0x4867de[_0x4b79('0x67')];});return db[_0x4b79('0x43')][_0x4b79('0x48')]({'where':{'id':_0xae0df9['params']['id']}})[_0x4b79('0x25')](function(_0x1016fa){return db['sequelize'][_0x4b79('0x6c')](function(_0x5e1ad1){return _0x1016fa[_0x4b79('0x64')](_0x48f6e4,{'transaction':_0x5e1ad1})[_0x4b79('0x25')](function(){return BPromise[_0x4b79('0x6d')](_0x4ef8f5,function(_0x27cc89){return db[_0x4b79('0x58')][_0x4b79('0x6e')]({'where':{'UserId':_0x27cc89['id'],'SmsQueueId':_0xae0df9['params']['id']},'transaction':_0x5e1ad1});});})[_0x4b79('0x25')](function(){_0x4ef8f5[_0x4b79('0x6f')](function(_0x26a251){socket[_0x4b79('0x70')]('userSmsQueue:save',{'UserId':_0x26a251['id'],'SmsQueueId':_0x1016fa['id']});});});});});}})['then'](respondWithStatusCode(_0x2a5d18,null))[_0x4b79('0x46')](handleError(_0x2a5d18,null));};exports[_0x4b79('0x71')]=function(_0x1706c9,_0xb707a5,_0x3bddec){return db[_0x4b79('0x66')][_0x4b79('0x44')]({'where':{'id':_0x1706c9[_0x4b79('0x32')][_0x4b79('0x65')]},'attributes':['id'],'include':[{'model':db[_0x4b79('0x5b')],'as':_0x4b79('0x67'),'attributes':['id'],'raw':!![]}]})[_0x4b79('0x25')](handleEntityNotFound(_0xb707a5,null))[_0x4b79('0x25')](function(_0x4cefa0){var _0x2b3830=_['map'](_0x4cefa0,'id');var _0x509d44=[];var _0x39a409=[];var _0x34cb9a=squel[_0x4b79('0x72')]();_0x34cb9a[_0x4b79('0x73')]('tq.TeamId')[_0x4b79('0x74')](_0x4b79('0x75'),'tq')['join'](_0x4b79('0x76'),'ut',_0x4b79('0x77'))[_0x4b79('0x3d')]('SmsQueueId\x20=\x20?',_0x1706c9['params']['id']);for(var _0x5e0367=0x0;_0x5e0367<_0x4cefa0[_0x4b79('0x37')];_0x5e0367+=0x1){let _0x3da103=_0x4cefa0[_0x5e0367];for(var _0x5bcca8=0x0;_0x5bcca8<_0x3da103[_0x4b79('0x67')][_0x4b79('0x37')];_0x5bcca8+=0x1){let _0xf50e94=_0x3da103[_0x4b79('0x67')][_0x5bcca8];var _0x520b21=_0x34cb9a['clone']();_0x520b21['where'](_0x4b79('0x78'),_0xf50e94['id']);_0x39a409['push'](db[_0x4b79('0x79')][_0x4b79('0x32')](_0x520b21['toString'](),{'type':db['sequelize'][_0x4b79('0x7a')]['SELECT']})[_0x4b79('0x25')](function(_0x302918){if(_0x302918[_0x4b79('0x37')]===0x1){return _0xf50e94['id'];}else{var _0x1b10bd=_['every'](_[_0x4b79('0x2e')](_0x302918,_0x4b79('0x7b')),function(_0x108588){return _[_0x4b79('0x7c')](_0x2b3830,_0x108588);});if(_0x1b10bd){return _0xf50e94['id'];}}}));}}return BPromise['all'](_0x39a409)[_0x4b79('0x25')](function(_0x1b5e5a){_0x509d44=_(_0x509d44)['union'](_0x1b5e5a)[_0x4b79('0x7d')]()[_0x4b79('0x7e')]();return db[_0x4b79('0x43')][_0x4b79('0x48')]({'where':{'id':_0x1706c9[_0x4b79('0x53')]['id']}})['then'](function(_0x33b619){return db[_0x4b79('0x79')]['transaction'](function(_0x521000){return _0x33b619[_0x4b79('0x71')](_0x1706c9[_0x4b79('0x32')][_0x4b79('0x65')],{'transaction':_0x521000})[_0x4b79('0x25')](function(){if(!_[_0x4b79('0x7f')](_0x509d44)){return _0x33b619['removeAgents'](_0x509d44,{'transaction':_0x521000});}})['then'](function(){_0x509d44['forEach'](function(_0x4147e8){socket[_0x4b79('0x70')](_0x4b79('0x80'),{'UserId':_0x4147e8,'SmsQueueId':_0x33b619['id']});});});});});});})[_0x4b79('0x25')](respondWithStatusCode(_0xb707a5,null))['catch'](handleError(_0xb707a5,null));};exports['addAgents']=function(_0x39b9d9,_0x250da2,_0x4e0bdb){return db[_0x4b79('0x43')][_0x4b79('0x48')]({'where':{'id':_0x39b9d9[_0x4b79('0x53')]['id']}})[_0x4b79('0x25')](handleEntityNotFound(_0x250da2,null))[_0x4b79('0x25')](function(_0x421394){if(_0x421394){return _0x421394[_0x4b79('0x81')](_0x39b9d9[_0x4b79('0x4a')][_0x4b79('0x65')],_[_0x4b79('0x82')](_0x39b9d9[_0x4b79('0x4a')],[_0x4b79('0x65'),'id'])||{})[_0x4b79('0x83')](function(_0x14cbd6){for(var _0x337f98=0x0;_0x337f98<_0x39b9d9['body']['ids'][_0x4b79('0x37')];_0x337f98+=0x1){socket[_0x4b79('0x70')](_0x4b79('0x84'),{'UserId':_0x39b9d9[_0x4b79('0x4a')][_0x4b79('0x65')][_0x337f98],'SmsQueueId':_0x39b9d9['params']['id']});}return _0x14cbd6;});}})[_0x4b79('0x25')](respondWithResult(_0x250da2,null))[_0x4b79('0x46')](handleError(_0x250da2,null));};exports[_0x4b79('0x85')]=function(_0x38b17d,_0x2864e3,_0x5f6abc){return db[_0x4b79('0x43')][_0x4b79('0x48')]({'where':{'id':_0x38b17d[_0x4b79('0x53')]['id']}})['then'](handleEntityNotFound(_0x2864e3,null))[_0x4b79('0x25')](function(_0x3057ad){if(_0x3057ad){return _0x3057ad[_0x4b79('0x85')](_0x38b17d[_0x4b79('0x32')][_0x4b79('0x65')])['then'](function(){if(_['isArray'](_0x38b17d[_0x4b79('0x32')][_0x4b79('0x65')])){for(var _0x3190a6=0x0;_0x3190a6<_0x38b17d[_0x4b79('0x32')][_0x4b79('0x65')][_0x4b79('0x37')];_0x3190a6+=0x1){socket['emit'](_0x4b79('0x80'),{'UserId':Number(_0x38b17d[_0x4b79('0x32')][_0x4b79('0x65')][_0x3190a6]),'SmsQueueId':Number(_0x38b17d[_0x4b79('0x53')]['id'])});}}else{socket[_0x4b79('0x70')](_0x4b79('0x80'),{'UserId':Number(_0x38b17d[_0x4b79('0x32')]['ids']),'SmsQueueId':Number(_0x38b17d['params']['id'])});}});}})[_0x4b79('0x25')](respondWithStatusCode(_0x2864e3,null))[_0x4b79('0x46')](handleError(_0x2864e3,null));};exports[_0x4b79('0x86')]=function(_0x57d820,_0x2cc359,_0x5395f3){var _0x249557={};var _0x23bf84={};var _0x259416;var _0x4d1358;return db[_0x4b79('0x43')]['findOne']({'where':{'id':_0x57d820[_0x4b79('0x53')]['id']}})[_0x4b79('0x25')](handleEntityNotFound(_0x2cc359,null))[_0x4b79('0x25')](function(_0x4d3db8){if(_0x4d3db8){_0x259416=_0x4d3db8;_0x23bf84['model']=_['keys'](db['User'][_0x4b79('0x2f')]);_0x23bf84['query']=_[_0x4b79('0x33')](_0x57d820['query']);_0x23bf84['filters']=_[_0x4b79('0x36')](_0x23bf84[_0x4b79('0x31')],_0x23bf84[_0x4b79('0x32')]);_0x249557['attributes']=_[_0x4b79('0x36')](_0x23bf84[_0x4b79('0x31')],qs[_0x4b79('0x47')](_0x57d820['query'][_0x4b79('0x47')]));_0x249557[_0x4b79('0x35')]=_0x249557[_0x4b79('0x35')][_0x4b79('0x37')]?_0x249557[_0x4b79('0x35')]:_0x23bf84[_0x4b79('0x31')];_0x249557['order']=qs[_0x4b79('0x3a')](_0x57d820[_0x4b79('0x32')]['sort']);_0x249557['where']=qs[_0x4b79('0x34')](_[_0x4b79('0x3b')](_0x57d820[_0x4b79('0x32')],_0x23bf84[_0x4b79('0x34')]));if(_0x57d820[_0x4b79('0x32')][_0x4b79('0x3c')]){_0x249557['where']=_[_0x4b79('0x3e')](_0x249557[_0x4b79('0x3d')],{'$or':_[_0x4b79('0x2e')](_0x249557[_0x4b79('0x35')],function(_0x1767ca){var _0x530a1d={};_0x530a1d[_0x1767ca]={'$like':'%'+_0x57d820[_0x4b79('0x32')][_0x4b79('0x3c')]+'%'};return _0x530a1d;})});}_0x249557=_[_0x4b79('0x3e')]({},_0x249557,_0x57d820[_0x4b79('0x40')]);return _0x259416[_0x4b79('0x86')](_0x249557);}})[_0x4b79('0x25')](function(_0x3a6173){if(_0x3a6173){_0x4d1358=_0x3a6173[_0x4b79('0x37')];if(!_0x57d820[_0x4b79('0x32')]['hasOwnProperty'](_0x4b79('0x38'))){_0x249557[_0x4b79('0x20')]=qs[_0x4b79('0x20')](_0x57d820[_0x4b79('0x32')][_0x4b79('0x20')]);_0x249557[_0x4b79('0x1f')]=qs['offset'](_0x57d820[_0x4b79('0x32')][_0x4b79('0x1f')]);}return _0x259416['getAgents'](_0x249557);}})['then'](function(_0x5c6476){if(_0x5c6476){return _0x5c6476?{'count':_0x4d1358,'rows':_0x5c6476}:null;}})[_0x4b79('0x25')](respondWithResult(_0x2cc359,null))[_0x4b79('0x46')](handleError(_0x2cc359,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 385bf84..3ce0f7d 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 _0x580f=['exports','events','SmsQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x580f,0x7f));var _0xf580=function(_0x2a7e04,_0x29ed17){_0x2a7e04=_0x2a7e04-0x0;var _0x3a96ff=_0x580f[_0x2a7e04];return _0x3a96ff;};'use strict';var EventEmitter=require(_0xf580('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xf580('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf580('0x2')](0x0);var events={'afterCreate':_0xf580('0x3'),'afterUpdate':_0xf580('0x4'),'afterDestroy':_0xf580('0x5')};function emitEvent(_0x52f51f){return function(_0x47ae1e,_0x40b709,_0x260ab4){SmsQueueEvents['emit'](_0x52f51f+':'+_0x47ae1e['id'],_0x47ae1e);SmsQueueEvents['emit'](_0x52f51f,_0x47ae1e);_0x260ab4(null);};}for(var e in events){if(events[_0xf580('0x6')](e)){var event=events[e];SmsQueue[_0xf580('0x7')](e,emitEvent(event));}}module[_0xf580('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x3fbd=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','emit'];(function(_0xa6dc5d,_0x344300){var _0x2dc334=function(_0x4c52e2){while(--_0x4c52e2){_0xa6dc5d['push'](_0xa6dc5d['shift']());}};_0x2dc334(++_0x344300);}(_0x3fbd,0x1e9));var _0xd3fb=function(_0x5418e0,_0x11af65){_0x5418e0=_0x5418e0-0x0;var _0x137dd6=_0x3fbd[_0x5418e0];return _0x137dd6;};'use strict';var EventEmitter=require(_0xd3fb('0x0'));var SmsQueue=require(_0xd3fb('0x1'))['db'][_0xd3fb('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd3fb('0x3')](0x0);var events={'afterCreate':_0xd3fb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1324fd){return function(_0x5ea403,_0x1f9568,_0x278596){SmsQueueEvents[_0xd3fb('0x5')](_0x1324fd+':'+_0x5ea403['id'],_0x5ea403);SmsQueueEvents['emit'](_0x1324fd,_0x5ea403);_0x278596(null);};}for(var e in events){if(events[_0xd3fb('0x6')](e)){var event=events[e];SmsQueue[_0xd3fb('0x7')](e,emitEvent(event));}}module[_0xd3fb('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 5d0541e..8da4112 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 _0x4a9c=['bluebird','path','rimraf','../../config/environment','define','SmsQueue','lodash','util','../../config/logger','api','moment'];(function(_0xb45202,_0x3d987f){var _0x19c7ca=function(_0x3dd10c){while(--_0x3dd10c){_0xb45202['push'](_0xb45202['shift']());}};_0x19c7ca(++_0x3d987f);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x11ad1f,_0xf95ac3){_0x11ad1f=_0x11ad1f-0x0;var _0x118af9=_0x4a9c[_0x11ad1f];return _0x118af9;};'use strict';var _=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var logger=require(_0xc4a9('0x2'))(_0xc4a9('0x3'));var moment=require(_0xc4a9('0x4'));var BPromise=require(_0xc4a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a9('0x6'));var rimraf=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x95d3f6,_0x2f35e4){return _0x95d3f6[_0xc4a9('0x9')](_0xc4a9('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacfe=['sms_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x55f754,_0x2237e1){var _0x581440=function(_0x7b8abf){while(--_0x7b8abf){_0x55f754['push'](_0x55f754['shift']());}};_0x581440(++_0x2237e1);}(_0xacfe,0xfd));var _0xeacf=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xacfe[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('SmsQueue',attributes,{'tableName':_0xeacf('0xb'),'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 d93143f..a76f05c 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 _0xd64b=['defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','map','include','model','attributes','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x76620a,_0xa59a8e){var _0x42e2c5=function(_0x4d1e33){while(--_0x4d1e33){_0x76620a['push'](_0x76620a['shift']());}};_0x42e2c5(++_0xa59a8e);}(_0xd64b,0x70));var _0xbd64=function(_0xa6e4c8,_0x52e242){_0xa6e4c8=_0xa6e4c8-0x0;var _0x29e0c8=_0xd64b[_0xa6e4c8];return _0x29e0c8;};'use strict';var _=require(_0xbd64('0x0'));var util=require(_0xbd64('0x1'));var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rs=require(_0xbd64('0x4'));var fs=require('fs');var Redis=require(_0xbd64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd64('0x6'));var logger=require(_0xbd64('0x7'))(_0xbd64('0x8'));var config=require(_0xbd64('0x9'));var jayson=require(_0xbd64('0xa'));var client=jayson[_0xbd64('0xb')][_0xbd64('0xc')]({'port':0x232a});config[_0xbd64('0xd')]=_[_0xbd64('0xe')](config['redis'],{'host':_0xbd64('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd64('0xd')]));require(_0xbd64('0x10'))[_0xbd64('0x11')](socket);function respondWithRpcPromise(_0x2528ff,_0x3e2f4d,_0x3136d7){return new BPromise(function(_0x4efd81,_0x32fce3){return client[_0xbd64('0x12')](_0x2528ff,_0x3136d7)[_0xbd64('0x13')](function(_0x353a93){logger[_0xbd64('0x14')](_0xbd64('0x15'),_0x3e2f4d,_0xbd64('0x16'));logger[_0xbd64('0x17')](_0xbd64('0x18'),_0x3e2f4d,_0xbd64('0x16'),JSON[_0xbd64('0x19')](_0x353a93));if(_0x353a93[_0xbd64('0x1a')]){if(_0x353a93[_0xbd64('0x1a')]['code']===0x1f4){logger[_0xbd64('0x1a')](_0xbd64('0x15'),_0x3e2f4d,_0x353a93[_0xbd64('0x1a')]['message']);return _0x32fce3(_0x353a93[_0xbd64('0x1a')]['message']);}logger[_0xbd64('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x3e2f4d,_0x353a93[_0xbd64('0x1a')][_0xbd64('0x1b')]);return _0x4efd81(_0x353a93[_0xbd64('0x1a')][_0xbd64('0x1b')]);}else{logger[_0xbd64('0x14')](_0xbd64('0x15'),_0x3e2f4d,_0xbd64('0x16'));_0x4efd81(_0x353a93[_0xbd64('0x1c')]['message']);}})[_0xbd64('0x1d')](function(_0x3354c3){logger[_0xbd64('0x1a')](_0xbd64('0x15'),_0x3e2f4d,_0x3354c3);_0x32fce3(_0x3354c3);});});}exports[_0xbd64('0x1e')]=function(_0x50e1d1){var _0x2464ff=this;return new Promise(function(_0x2c6657,_0x25fd1f){return db[_0xbd64('0x1f')][_0xbd64('0x20')]({'raw':_0x50e1d1['options']?_0x50e1d1[_0xbd64('0x21')][_0xbd64('0x22')]===undefined?!![]:![]:!![],'where':_0x50e1d1[_0xbd64('0x21')]?_0x50e1d1[_0xbd64('0x21')][_0xbd64('0x23')]||null:null,'attributes':_0x50e1d1[_0xbd64('0x21')]?_0x50e1d1[_0xbd64('0x21')]['attributes']||null:null,'limit':_0x50e1d1[_0xbd64('0x21')]?_0x50e1d1[_0xbd64('0x21')]['limit']||null:null,'include':_0x50e1d1['options']?_0x50e1d1[_0xbd64('0x21')]['include']?_[_0xbd64('0x24')](_0x50e1d1[_0xbd64('0x21')][_0xbd64('0x25')],function(_0x19f648){return{'model':db[_0x19f648[_0xbd64('0x26')]],'as':_0x19f648['as'],'attributes':_0x19f648[_0xbd64('0x27')],'include':_0x19f648[_0xbd64('0x25')]?_[_0xbd64('0x24')](_0x19f648[_0xbd64('0x25')],function(_0x2f4b9b){return{'model':db[_0x2f4b9b[_0xbd64('0x26')]],'as':_0x2f4b9b['as'],'attributes':_0x2f4b9b['attributes'],'include':_0x2f4b9b[_0xbd64('0x25')]?_[_0xbd64('0x24')](_0x2f4b9b[_0xbd64('0x25')],function(_0x2c08b6){return{'model':db[_0x2c08b6[_0xbd64('0x26')]],'as':_0x2c08b6['as'],'attributes':_0x2c08b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd64('0x13')](function(_0x428d06){logger['info'](_0xbd64('0x1e'),_0x50e1d1);logger[_0xbd64('0x17')](_0xbd64('0x1e'),_0x50e1d1,JSON['stringify'](_0x428d06));_0x2c6657(_0x428d06);})[_0xbd64('0x1d')](function(_0xcf325f){logger[_0xbd64('0x1a')]('GetSmsQueue',_0xcf325f[_0xbd64('0x1b')],_0x50e1d1);_0x25fd1f(_0x2464ff[_0xbd64('0x1a')](0x1f4,_0xcf325f[_0xbd64('0x1b')]));});});};exports[_0xbd64('0x28')]=function(_0x1098d2){var _0x515136=this;return new Promise(function(_0x18e556,_0x2cf4e2){return db[_0xbd64('0x1f')][_0xbd64('0x29')]({'raw':_0x1098d2[_0xbd64('0x21')]?_0x1098d2[_0xbd64('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1098d2['options']?_0x1098d2[_0xbd64('0x21')]['where']||null:null,'attributes':_0x1098d2['options']?_0x1098d2['options'][_0xbd64('0x27')]||null:null,'include':_0x1098d2[_0xbd64('0x21')]?_0x1098d2[_0xbd64('0x21')][_0xbd64('0x25')]?_[_0xbd64('0x24')](_0x1098d2[_0xbd64('0x21')][_0xbd64('0x25')],function(_0x364bad){return{'model':db[_0x364bad[_0xbd64('0x26')]],'as':_0x364bad['as'],'attributes':_0x364bad[_0xbd64('0x27')],'include':_0x364bad[_0xbd64('0x25')]?_[_0xbd64('0x24')](_0x364bad[_0xbd64('0x25')],function(_0x43352a){return{'model':db[_0x43352a[_0xbd64('0x26')]],'as':_0x43352a['as'],'attributes':_0x43352a[_0xbd64('0x27')],'include':_0x43352a[_0xbd64('0x25')]?_[_0xbd64('0x24')](_0x43352a['include'],function(_0x1a862a){return{'model':db[_0x1a862a['model']],'as':_0x1a862a['as'],'attributes':_0x1a862a[_0xbd64('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bebe7){logger[_0xbd64('0x14')]('ShowSmsQueue',_0x1098d2);logger[_0xbd64('0x17')](_0xbd64('0x28'),_0x1098d2,JSON[_0xbd64('0x19')](_0x3bebe7));_0x18e556(_0x3bebe7);})['catch'](function(_0x41b7ba){logger[_0xbd64('0x1a')](_0xbd64('0x28'),_0x41b7ba[_0xbd64('0x1b')],_0x1098d2);_0x2cf4e2(_0x515136[_0xbd64('0x1a')](0x1f4,_0x41b7ba[_0xbd64('0x1b')]));});});}; \ No newline at end of file +var _0x26d5=['request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','options','raw','where','attributes','limit','include','map','model','stringify','ShowSmsQueue','SmsQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0x26d5,0xff));var _0x526d=function(_0x25b588,_0xe1a204){_0x25b588=_0x25b588-0x0;var _0x4ffd2c=_0x26d5[_0x25b588];return _0x4ffd2c;};'use strict';var _=require(_0x526d('0x0'));var util=require(_0x526d('0x1'));var moment=require(_0x526d('0x2'));var BPromise=require(_0x526d('0x3'));var rs=require(_0x526d('0x4'));var fs=require('fs');var Redis=require(_0x526d('0x5'));var db=require(_0x526d('0x6'))['db'];var utils=require(_0x526d('0x7'));var logger=require(_0x526d('0x8'))(_0x526d('0x9'));var config=require(_0x526d('0xa'));var jayson=require(_0x526d('0xb'));var client=jayson[_0x526d('0xc')][_0x526d('0xd')]({'port':0x232a});config[_0x526d('0xe')]=_[_0x526d('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x526d('0x10')](socket);function respondWithRpcPromise(_0x5032fb,_0x318779,_0x46f7a3){return new BPromise(function(_0x8ac15c,_0x35ff6f){return client['request'](_0x5032fb,_0x46f7a3)[_0x526d('0x11')](function(_0x245fd6){logger['info']('SmsQueue,\x20%s,\x20%s',_0x318779,_0x526d('0x12'));logger['debug'](_0x526d('0x13'),_0x318779,_0x526d('0x12'),JSON['stringify'](_0x245fd6));if(_0x245fd6[_0x526d('0x14')]){if(_0x245fd6[_0x526d('0x14')][_0x526d('0x15')]===0x1f4){logger[_0x526d('0x14')](_0x526d('0x16'),_0x318779,_0x245fd6[_0x526d('0x14')][_0x526d('0x17')]);return _0x35ff6f(_0x245fd6[_0x526d('0x14')][_0x526d('0x17')]);}logger[_0x526d('0x14')](_0x526d('0x16'),_0x318779,_0x245fd6[_0x526d('0x14')]['message']);return _0x8ac15c(_0x245fd6['error'][_0x526d('0x17')]);}else{logger['info'](_0x526d('0x16'),_0x318779,'request\x20sent');_0x8ac15c(_0x245fd6[_0x526d('0x18')][_0x526d('0x17')]);}})[_0x526d('0x19')](function(_0x872803){logger[_0x526d('0x14')](_0x526d('0x16'),_0x318779,_0x872803);_0x35ff6f(_0x872803);});});}exports[_0x526d('0x1a')]=function(_0x1c5dab){var _0x11217a=this;return new Promise(function(_0x5b41d3,_0x12c77a){return db['SmsQueue']['findAll']({'raw':_0x1c5dab[_0x526d('0x1b')]?_0x1c5dab[_0x526d('0x1b')][_0x526d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c5dab[_0x526d('0x1b')]?_0x1c5dab[_0x526d('0x1b')][_0x526d('0x1d')]||null:null,'attributes':_0x1c5dab[_0x526d('0x1b')]?_0x1c5dab['options'][_0x526d('0x1e')]||null:null,'limit':_0x1c5dab[_0x526d('0x1b')]?_0x1c5dab[_0x526d('0x1b')][_0x526d('0x1f')]||null:null,'include':_0x1c5dab[_0x526d('0x1b')]?_0x1c5dab['options'][_0x526d('0x20')]?_[_0x526d('0x21')](_0x1c5dab[_0x526d('0x1b')][_0x526d('0x20')],function(_0x1ef11e){return{'model':db[_0x1ef11e[_0x526d('0x22')]],'as':_0x1ef11e['as'],'attributes':_0x1ef11e[_0x526d('0x1e')],'include':_0x1ef11e[_0x526d('0x20')]?_[_0x526d('0x21')](_0x1ef11e[_0x526d('0x20')],function(_0x190b8d){return{'model':db[_0x190b8d[_0x526d('0x22')]],'as':_0x190b8d['as'],'attributes':_0x190b8d[_0x526d('0x1e')],'include':_0x190b8d[_0x526d('0x20')]?_[_0x526d('0x21')](_0x190b8d['include'],function(_0x293733){return{'model':db[_0x293733['model']],'as':_0x293733['as'],'attributes':_0x293733['attributes']};}):[]};}):[]};}):[]:[]})[_0x526d('0x11')](function(_0x2af333){logger['info'](_0x526d('0x1a'),_0x1c5dab);logger['debug'](_0x526d('0x1a'),_0x1c5dab,JSON[_0x526d('0x23')](_0x2af333));_0x5b41d3(_0x2af333);})[_0x526d('0x19')](function(_0x492bc4){logger[_0x526d('0x14')](_0x526d('0x1a'),_0x492bc4[_0x526d('0x17')],_0x1c5dab);_0x12c77a(_0x11217a[_0x526d('0x14')](0x1f4,_0x492bc4[_0x526d('0x17')]));});});};exports[_0x526d('0x24')]=function(_0x4a58e6){var _0x494557=this;return new Promise(function(_0x281cc3,_0x4ff2b7){return db[_0x526d('0x25')]['find']({'raw':_0x4a58e6[_0x526d('0x1b')]?_0x4a58e6[_0x526d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a58e6[_0x526d('0x1b')]?_0x4a58e6[_0x526d('0x1b')][_0x526d('0x1d')]||null:null,'attributes':_0x4a58e6[_0x526d('0x1b')]?_0x4a58e6[_0x526d('0x1b')][_0x526d('0x1e')]||null:null,'include':_0x4a58e6['options']?_0x4a58e6[_0x526d('0x1b')][_0x526d('0x20')]?_['map'](_0x4a58e6[_0x526d('0x1b')]['include'],function(_0x9e1270){return{'model':db[_0x9e1270[_0x526d('0x22')]],'as':_0x9e1270['as'],'attributes':_0x9e1270['attributes'],'include':_0x9e1270[_0x526d('0x20')]?_[_0x526d('0x21')](_0x9e1270[_0x526d('0x20')],function(_0x112b2f){return{'model':db[_0x112b2f[_0x526d('0x22')]],'as':_0x112b2f['as'],'attributes':_0x112b2f[_0x526d('0x1e')],'include':_0x112b2f[_0x526d('0x20')]?_[_0x526d('0x21')](_0x112b2f[_0x526d('0x20')],function(_0x22d85e){return{'model':db[_0x22d85e[_0x526d('0x22')]],'as':_0x22d85e['as'],'attributes':_0x22d85e[_0x526d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x526d('0x11')](function(_0x8aabb1){logger['info']('ShowSmsQueue',_0x4a58e6);logger[_0x526d('0x26')](_0x526d('0x24'),_0x4a58e6,JSON[_0x526d('0x23')](_0x8aabb1));_0x281cc3(_0x8aabb1);})[_0x526d('0x19')](function(_0x1c685e){logger[_0x526d('0x14')](_0x526d('0x24'),_0x1c685e[_0x526d('0x17')],_0x4a58e6);_0x4ff2b7(_0x494557[_0x526d('0x14')](0x1f4,_0x1c685e[_0x526d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 572d153..075463b 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 _0xfe03=['register','length','smsQueue:','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x3df005,_0x54295a){var _0x5f4835=function(_0x8461f9){while(--_0x8461f9){_0x3df005['push'](_0x3df005['shift']());}};_0x5f4835(++_0x54295a);}(_0xfe03,0x1a3));var _0x3fe0=function(_0x184f76,_0xdb70f4){_0x184f76=_0x184f76-0x0;var _0xf77423=_0xfe03[_0x184f76];return _0xf77423;};'use strict';var SmsQueueEvents=require(_0x3fe0('0x0'));var events=['save',_0x3fe0('0x1'),_0x3fe0('0x2')];function createListener(_0x146be0,_0x6bca90){return function(_0x8d0f5){_0x6bca90[_0x3fe0('0x3')](_0x146be0,_0x8d0f5);};}function removeListener(_0xf9284f,_0x4d4060){return function(){SmsQueueEvents[_0x3fe0('0x4')](_0xf9284f,_0x4d4060);};}exports[_0x3fe0('0x5')]=function(_0x48a2de){for(var _0x440270=0x0,_0x2412d2=events[_0x3fe0('0x6')];_0x440270<_0x2412d2;_0x440270++){var _0x160a73=events[_0x440270];var _0x41c54a=createListener(_0x3fe0('0x7')+_0x160a73,_0x48a2de);SmsQueueEvents['on'](_0x160a73,_0x41c54a);}}; \ No newline at end of file +var _0x9973=['./smsQueue.events','save','emit','removeListener','register','length','smsQueue:'];(function(_0x1d7f68,_0x5bcd7d){var _0x53fed3=function(_0xf66da0){while(--_0xf66da0){_0x1d7f68['push'](_0x1d7f68['shift']());}};_0x53fed3(++_0x5bcd7d);}(_0x9973,0x77));var _0x3997=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9973[_0x2c91e9];return _0x13f0ff;};'use strict';var SmsQueueEvents=require(_0x3997('0x0'));var events=[_0x3997('0x1'),'remove','update'];function createListener(_0x4406e0,_0x5cab85){return function(_0x1735d9){_0x5cab85[_0x3997('0x2')](_0x4406e0,_0x1735d9);};}function removeListener(_0x5364db,_0x2e6fb1){return function(){SmsQueueEvents[_0x3997('0x3')](_0x5364db,_0x2e6fb1);};}exports[_0x3997('0x4')]=function(_0x52f7c2){for(var _0x1400ef=0x0,_0x4e7a38=events[_0x3997('0x5')];_0x1400ef<_0x4e7a38;_0x1400ef++){var _0x34a8a5=events[_0x1400ef];var _0x47b429=createListener(_0x3997('0x6')+_0x34a8a5,_0x52f7c2);SmsQueueEvents['on'](_0x34a8a5,_0x47b429);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6b3a09c..89806d8 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 _0x005f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','util'];(function(_0x5dd70f,_0x160f62){var _0x25ec2=function(_0x4c1a73){while(--_0x4c1a73){_0x5dd70f['push'](_0x5dd70f['shift']());}};_0x25ec2(++_0x160f62);}(_0x005f,0xaa));var _0xf005=function(_0x3f18bd,_0x432efe){_0x3f18bd=_0x3f18bd-0x0;var _0x2eda7e=_0x005f[_0x3f18bd];return _0x2eda7e;};'use strict';var multer=require('multer');var util=require(_0xf005('0x0'));var path=require(_0xf005('0x1'));var timeout=require(_0xf005('0x2'));var express=require(_0xf005('0x3'));var router=express[_0xf005('0x4')]();var auth=require(_0xf005('0x5'));var interaction=require(_0xf005('0x6'));var config=require(_0xf005('0x7'));var controller=require(_0xf005('0x8'));router[_0xf005('0x9')]('/',auth['isAuthenticated'](),controller[_0xf005('0xa')]);router[_0xf005('0x9')]('/describe',auth[_0xf005('0xb')](),controller['describe']);router['get'](_0xf005('0xc'),auth['isAuthenticated'](),controller[_0xf005('0xd')]);router[_0xf005('0xe')]('/',auth[_0xf005('0xb')](),controller[_0xf005('0xf')]);router[_0xf005('0x10')](_0xf005('0xc'),auth[_0xf005('0xb')](),controller[_0xf005('0x11')]);router[_0xf005('0x12')](_0xf005('0xc'),auth[_0xf005('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x38a0=['express','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x38a0,0xc4));var _0x038a=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0x38a0[_0x56bcff];return _0x340351;};'use strict';var multer=require(_0x038a('0x0'));var util=require(_0x038a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x038a('0x2'));var router=express['Router']();var auth=require(_0x038a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x038a('0x4'));var controller=require(_0x038a('0x5'));router[_0x038a('0x6')]('/',auth[_0x038a('0x7')](),controller[_0x038a('0x8')]);router[_0x038a('0x6')](_0x038a('0x9'),auth[_0x038a('0x7')](),controller[_0x038a('0xa')]);router[_0x038a('0x6')]('/:id',auth[_0x038a('0x7')](),controller['show']);router[_0x038a('0xb')]('/',auth[_0x038a('0x7')](),controller[_0x038a('0xc')]);router[_0x038a('0xd')]('/:id',auth[_0x038a('0x7')](),controller[_0x038a('0xe')]);router[_0x038a('0xf')]('/:id',auth[_0x038a('0x7')](),controller[_0x038a('0x10')]);module[_0x038a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ec5013a..7d17e8c 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 _0xc494=['sequelize','exports','STRING','DATE'];(function(_0x5999d4,_0x369131){var _0x50051f=function(_0x2194ae){while(--_0x2194ae){_0x5999d4['push'](_0x5999d4['shift']());}};_0x50051f(++_0x369131);}(_0xc494,0xc0));var _0x4c49=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xc494[_0x5ee3d3];return _0x4b272f;};'use strict';var moment=require('moment');var Sequelize=require(_0x4c49('0x0'));module[_0x4c49('0x1')]={'uniqueid':{'type':Sequelize[_0x4c49('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4c49('0x2')]},'joinAt':{'type':Sequelize[_0x4c49('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4c49('0x3')]},'exitAt':{'type':Sequelize[_0x4c49('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf1e=['exports','STRING','DATE','moment','sequelize'];(function(_0x314604,_0x53fe3c){var _0x298682=function(_0x499abb){while(--_0x499abb){_0x314604['push'](_0x314604['shift']());}};_0x298682(++_0x53fe3c);}(_0xcf1e,0x18e));var _0xecf1=function(_0xd404f9,_0x1cbaed){_0xd404f9=_0xd404f9-0x0;var _0x36f89c=_0xcf1e[_0xd404f9];return _0x36f89c;};'use strict';var moment=require(_0xecf1('0x0'));var Sequelize=require(_0xecf1('0x1'));module[_0xecf1('0x2')]={'uniqueid':{'type':Sequelize[_0xecf1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xecf1('0x3')]},'joinAt':{'type':Sequelize[_0xecf1('0x4')]},'leaveAt':{'type':Sequelize[_0xecf1('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xecf1('0x4')]},'reason':{'type':Sequelize[_0xecf1('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f1f58e9..a869e6e 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 _0xc4aa=['request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['SmsQueueReport']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['SmsQueueReport'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x36e0e9,_0x138073){var _0x4591f5=function(_0x16e820){while(--_0x16e820){_0x36e0e9['push'](_0x36e0e9['shift']());}};_0x4591f5(++_0x138073);}(_0x814b,0x1a2));var _0xb814=function(_0x4adead,_0x3e7eef){_0x4adead=_0x4adead-0x0;var _0x34cfca=_0x814b[_0x4adead];return _0x34cfca;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index daff6e8..a81a79f 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 _0x5fc2=['SmsQueueReport','report_sms_queue','uniqueid','util','api','moment','bluebird','request-promise','rimraf','./smsQueueReport.attributes','define'];(function(_0x4dd00f,_0x40145b){var _0x2270fd=function(_0xa8f547){while(--_0xa8f547){_0x4dd00f['push'](_0x4dd00f['shift']());}};_0x2270fd(++_0x40145b);}(_0x5fc2,0xc9));var _0x25fc=function(_0x34cbbf,_0x540ce2){_0x34cbbf=_0x34cbbf-0x0;var _0x3ec76e=_0x5fc2[_0x34cbbf];return _0x3ec76e;};'use strict';var _=require('lodash');var util=require(_0x25fc('0x0'));var logger=require('../../config/logger')(_0x25fc('0x1'));var moment=require(_0x25fc('0x2'));var BPromise=require(_0x25fc('0x3'));var rp=require(_0x25fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25fc('0x5'));var config=require('../../config/environment');var attributes=require(_0x25fc('0x6'));module['exports']=function(_0x2b950e,_0x80bd10){return _0x2b950e[_0x25fc('0x7')](_0x25fc('0x8'),attributes,{'tableName':_0x25fc('0x9'),'paranoid':![],'indexes':[{'name':_0x25fc('0xa'),'fields':[_0x25fc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xadb2=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x45a244,_0x12f982){var _0x57edbc=function(_0x2182b2){while(--_0x2182b2){_0x45a244['push'](_0x45a244['shift']());}};_0x57edbc(++_0x12f982);}(_0xadb2,0x114));var _0x2adb=function(_0x2ef407,_0x264644){_0x2ef407=_0x2ef407-0x0;var _0x47ff=_0xadb2[_0x2ef407];return _0x47ff;};'use strict';var _=require(_0x2adb('0x0'));var util=require(_0x2adb('0x1'));var logger=require(_0x2adb('0x2'))(_0x2adb('0x3'));var moment=require('moment');var BPromise=require(_0x2adb('0x4'));var rp=require(_0x2adb('0x5'));var fs=require('fs');var path=require(_0x2adb('0x6'));var rimraf=require(_0x2adb('0x7'));var config=require(_0x2adb('0x8'));var attributes=require(_0x2adb('0x9'));module[_0x2adb('0xa')]=function(_0x5790dc,_0x5eac80){return _0x5790dc[_0x2adb('0xb')](_0x2adb('0xc'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x2adb('0xd'),'fields':[_0x2adb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index de5fe3e..6419cd3 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 _0x242c=['rpc','../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x36a97e,_0x408145){var _0x5ae29f=function(_0x303b6c){while(--_0x303b6c){_0x36a97e['push'](_0x36a97e['shift']());}};_0x5ae29f(++_0x408145);}(_0x242c,0x8f));var _0xc242=function(_0x54551e,_0x429370){_0x54551e=_0x54551e-0x0;var _0x1d6913=_0x242c[_0x54551e];return _0x1d6913;};'use strict';var _=require(_0xc242('0x0'));var util=require(_0xc242('0x1'));var moment=require(_0xc242('0x2'));var BPromise=require(_0xc242('0x3'));var rs=require(_0xc242('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc242('0x5'));var logger=require(_0xc242('0x6'))(_0xc242('0x7'));var config=require(_0xc242('0x8'));var jayson=require(_0xc242('0x9'));var client=jayson['client'][_0xc242('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574406,_0x16d3ce,_0x4b8ebb){return new BPromise(function(_0x5bdf85,_0x203ca8){return client[_0xc242('0xb')](_0x574406,_0x4b8ebb)['then'](function(_0x346bc4){logger[_0xc242('0xc')](_0xc242('0xd'),_0x16d3ce,_0xc242('0xe'));logger[_0xc242('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x16d3ce,_0xc242('0xe'),JSON[_0xc242('0x10')](_0x346bc4));if(_0x346bc4['error']){if(_0x346bc4['error']['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x16d3ce,_0x346bc4[_0xc242('0x11')][_0xc242('0x12')]);return _0x203ca8(_0x346bc4[_0xc242('0x11')][_0xc242('0x12')]);}logger[_0xc242('0x11')](_0xc242('0xd'),_0x16d3ce,_0x346bc4[_0xc242('0x11')]['message']);return _0x5bdf85(_0x346bc4[_0xc242('0x11')][_0xc242('0x12')]);}else{logger[_0xc242('0xc')](_0xc242('0xd'),_0x16d3ce,_0xc242('0xe'));_0x5bdf85(_0x346bc4['result']['message']);}})[_0xc242('0x13')](function(_0x1a9889){logger['error'](_0xc242('0xd'),_0x16d3ce,_0x1a9889);_0x203ca8(_0x1a9889);});});}exports[_0xc242('0x14')]=function(_0x41df64){var _0xea6716=this;return new Promise(function(_0x260c5a,_0x21646b){return db[_0xc242('0x15')][_0xc242('0x16')](_0x41df64[_0xc242('0x17')],{'raw':_0x41df64[_0xc242('0x18')]?_0x41df64[_0xc242('0x18')][_0xc242('0x19')]===undefined?!![]:![]:!![]})[_0xc242('0x1a')](function(_0x2756ee){logger[_0xc242('0xc')](_0xc242('0x14'),_0x41df64);logger[_0xc242('0xf')](_0xc242('0x14'),_0x41df64,JSON[_0xc242('0x10')](_0x2756ee));_0x260c5a(_0x2756ee);})[_0xc242('0x13')](function(_0x2aed4b){logger[_0xc242('0x11')]('CreateSmsQueueReport',_0x2aed4b[_0xc242('0x12')],_0x41df64);_0x21646b(_0xea6716[_0xc242('0x11')](0x1f4,_0x2aed4b[_0xc242('0x12')]));});});};exports[_0xc242('0x1b')]=function(_0x14fd75){var _0x571b75=this;return new Promise(function(_0x3e5bf7,_0x4000ef){return db[_0xc242('0x15')][_0xc242('0x1c')](_0x14fd75['body'],{'raw':_0x14fd75[_0xc242('0x18')]?_0x14fd75[_0xc242('0x18')][_0xc242('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14fd75['options']?_0x14fd75[_0xc242('0x18')][_0xc242('0x1d')]||null:null,'attributes':_0x14fd75[_0xc242('0x18')]?_0x14fd75[_0xc242('0x18')]['attributes']||null:null,'limit':_0x14fd75['options']?_0x14fd75[_0xc242('0x18')]['limit']||null:null})[_0xc242('0x1a')](function(_0x4f876f){logger[_0xc242('0xc')](_0xc242('0x1b'),_0x14fd75);logger['debug'](_0xc242('0x1b'),_0x14fd75,JSON[_0xc242('0x10')](_0x4f876f));_0x3e5bf7(_0x4f876f);})[_0xc242('0x13')](function(_0x55c05e){logger[_0xc242('0x11')](_0xc242('0x1b'),_0x55c05e[_0xc242('0x12')],_0x14fd75);_0x4000ef(_0x571b75[_0xc242('0x11')](0x1f4,_0x55c05e[_0xc242('0x12')]));});});}; \ No newline at end of file +var _0x83ba=['result','catch','SmsQueueReport','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','attributes','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','info','SmsQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x523ad9,_0x21fdec){var _0x33e779=function(_0x27d7a6){while(--_0x27d7a6){_0x523ad9['push'](_0x523ad9['shift']());}};_0x33e779(++_0x21fdec);}(_0x83ba,0x7c));var _0xa83b=function(_0xc3d763,_0x2e826d){_0xc3d763=_0xc3d763-0x0;var _0x122a26=_0x83ba[_0xc3d763];return _0x122a26;};'use strict';var _=require('lodash');var util=require(_0xa83b('0x0'));var moment=require('moment');var BPromise=require(_0xa83b('0x1'));var rs=require(_0xa83b('0x2'));var fs=require('fs');var Redis=require(_0xa83b('0x3'));var db=require(_0xa83b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa83b('0x5'))(_0xa83b('0x6'));var config=require(_0xa83b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29c5aa,_0xe93249,_0x23ec49){return new BPromise(function(_0x4f2d5b,_0x1d062d){return client['request'](_0x29c5aa,_0x23ec49)['then'](function(_0xc37fc0){logger[_0xa83b('0x8')](_0xa83b('0x9'),_0xe93249,'request\x20sent');logger[_0xa83b('0xa')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xe93249,'request\x20sent',JSON[_0xa83b('0xb')](_0xc37fc0));if(_0xc37fc0[_0xa83b('0xc')]){if(_0xc37fc0[_0xa83b('0xc')][_0xa83b('0xd')]===0x1f4){logger[_0xa83b('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xe93249,_0xc37fc0[_0xa83b('0xc')][_0xa83b('0xe')]);return _0x1d062d(_0xc37fc0['error'][_0xa83b('0xe')]);}logger[_0xa83b('0xc')](_0xa83b('0x9'),_0xe93249,_0xc37fc0[_0xa83b('0xc')]['message']);return _0x4f2d5b(_0xc37fc0['error']['message']);}else{logger[_0xa83b('0x8')](_0xa83b('0x9'),_0xe93249,_0xa83b('0xf'));_0x4f2d5b(_0xc37fc0[_0xa83b('0x10')][_0xa83b('0xe')]);}})[_0xa83b('0x11')](function(_0x72261){logger[_0xa83b('0xc')](_0xa83b('0x9'),_0xe93249,_0x72261);_0x1d062d(_0x72261);});});}exports['CreateSmsQueueReport']=function(_0x407f5b){var _0x27e19a=this;return new Promise(function(_0x2a57d6,_0x4bf4be){return db[_0xa83b('0x12')][_0xa83b('0x13')](_0x407f5b[_0xa83b('0x14')],{'raw':_0x407f5b[_0xa83b('0x15')]?_0x407f5b[_0xa83b('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1b59a7){logger[_0xa83b('0x8')](_0xa83b('0x16'),_0x407f5b);logger['debug'](_0xa83b('0x16'),_0x407f5b,JSON[_0xa83b('0xb')](_0x1b59a7));_0x2a57d6(_0x1b59a7);})[_0xa83b('0x11')](function(_0x1734d8){logger[_0xa83b('0xc')](_0xa83b('0x16'),_0x1734d8['message'],_0x407f5b);_0x4bf4be(_0x27e19a[_0xa83b('0xc')](0x1f4,_0x1734d8[_0xa83b('0xe')]));});});};exports[_0xa83b('0x17')]=function(_0xd9e246){var _0x102ec1=this;return new Promise(function(_0x349951,_0x59c5e5){return db[_0xa83b('0x12')][_0xa83b('0x18')](_0xd9e246[_0xa83b('0x14')],{'raw':_0xd9e246[_0xa83b('0x15')]?_0xd9e246[_0xa83b('0x15')][_0xa83b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9e246[_0xa83b('0x15')]?_0xd9e246[_0xa83b('0x15')]['where']||null:null,'attributes':_0xd9e246[_0xa83b('0x15')]?_0xd9e246[_0xa83b('0x15')][_0xa83b('0x1a')]||null:null,'limit':_0xd9e246['options']?_0xd9e246[_0xa83b('0x15')]['limit']||null:null})[_0xa83b('0x1b')](function(_0xd6e677){logger[_0xa83b('0x8')]('UpdateSmsQueueReport',_0xd9e246);logger[_0xa83b('0xa')](_0xa83b('0x17'),_0xd9e246,JSON[_0xa83b('0xb')](_0xd6e677));_0x349951(_0xd6e677);})[_0xa83b('0x11')](function(_0x5a810c){logger[_0xa83b('0xc')](_0xa83b('0x17'),_0x5a810c[_0xa83b('0xe')],_0xd9e246);_0x59c5e5(_0x102ec1['error'](0x1f4,_0x5a810c[_0xa83b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3f3fb98..e0b0d62 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 _0xe605=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe605,0x92));var _0x5e60=function(_0x16f8ca,_0xdef1b4){_0x16f8ca=_0x16f8ca-0x0;var _0x166705=_0xe605[_0x16f8ca];return _0x166705;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var auth=require(_0x5e60('0x5'));var interaction=require(_0x5e60('0x6'));var config=require(_0x5e60('0x7'));var controller=require(_0x5e60('0x8'));router[_0x5e60('0x9')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0xb')]);router[_0x5e60('0x9')](_0x5e60('0xc'),auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5e60('0xe')]);router[_0x5e60('0xf')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')](_0x5e60('0x12'),auth['isAuthenticated'](),controller[_0x5e60('0x13')]);router['delete'](_0x5e60('0x12'),auth[_0x5e60('0xa')](),controller[_0x5e60('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x580ade,_0x3b9acd){var _0x1dc31a=function(_0x313b36){while(--_0x313b36){_0x580ade['push'](_0x580ade['shift']());}};_0x1dc31a(++_0x3b9acd);}(_0x2032,0xd9));var _0x2203=function(_0xb16a34,_0x529eff){_0xb16a34=_0xb16a34-0x0;var _0x3b4087=_0x2032[_0xb16a34];return _0x3b4087;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 11a3913..fd74aa3 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 _0xb13a=['sequelize','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x4f8bb6,_0x3607eb){var _0x10df2b=function(_0x1b4085){while(--_0x1b4085){_0x4f8bb6['push'](_0x4f8bb6['shift']());}};_0x10df2b(++_0x3607eb);}(_0xb13a,0x10d));var _0xab13=function(_0x1a6e4e,_0x3674c4){_0x1a6e4e=_0x1a6e4e-0x0;var _0x7199cb=_0xb13a[_0x1a6e4e];return _0x7199cb;};'use strict';var moment=require(_0xab13('0x0'));var Sequelize=require(_0xab13('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xab13('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xab13('0x3')](_0xab13('0x4'),_0xab13('0x5'),'queue'),'allowNull':![],'defaultValue':_0xab13('0x6')},'transferredAt':{'type':Sequelize[_0xab13('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xab13('0x8')]}}; \ No newline at end of file +var _0x1b7f=['NOW','STRING','ENUM','account','agent','queue','DATE'];(function(_0xaad24a,_0x1c7172){var _0x32df5b=function(_0x9550ac){while(--_0x9550ac){_0xaad24a['push'](_0xaad24a['shift']());}};_0x32df5b(++_0x1c7172);}(_0x1b7f,0x78));var _0xf1b7=function(_0x4b6229,_0x590f52){_0x4b6229=_0x4b6229-0x0;var _0x56bb54=_0x1b7f[_0x4b6229];return _0x56bb54;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf1b7('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xf1b7('0x1')](_0xf1b7('0x2'),_0xf1b7('0x3'),_0xf1b7('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf1b7('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xf1b7('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bfda1ab..c731be9 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 _0xedd9=['update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','SmsTransferReport','includeAll','catch','show','params','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject'];(function(_0x9fc63a,_0x47ecf4){var _0x679a9e=function(_0x114502){while(--_0x114502){_0x9fc63a['push'](_0x9fc63a['shift']());}};_0x679a9e(++_0x47ecf4);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a96b0,_0x43d92a){_0x2a96b0=_0x2a96b0-0x0;var _0x139f44=_0xedd9[_0x2a96b0];return _0x139f44;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={},_0x57a2cc={},_0x214d0a={'count':0x0,'rows':[]};var _0x257a26=_[_0x9edd('0x27')](db['SmsTransferReport'][_0x9edd('0x28')],function(_0x28cfae){return{'name':_0x28cfae[_0x9edd('0x29')],'type':_0x28cfae[_0x9edd('0x2a')]['key']};});_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x27')](_0x257a26,_0x9edd('0x2c'));_0x57a2cc[_0x9edd('0x2d')]=_[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2d')]);_0x57a2cc[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],_0x57a2cc[_0x9edd('0x2d')]);_0x4fe471[_0x9edd('0x31')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],qs[_0x9edd('0x32')](_0x25e135[_0x9edd('0x2d')]['fields']));_0x4fe471[_0x9edd('0x31')]=_0x4fe471[_0x9edd('0x31')][_0x9edd('0x33')]?_0x4fe471['attributes']:_0x57a2cc[_0x9edd('0x2b')];if(!_0x25e135[_0x9edd('0x2d')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x4fe471[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1d')]);_0x4fe471[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1c')]);}_0x4fe471[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x25e135['query'][_0x9edd('0x37')]);_0x4fe471['where']=qs[_0x9edd('0x2f')](_[_0x9edd('0x38')](_0x25e135[_0x9edd('0x2d')],_0x57a2cc[_0x9edd('0x2f')]),_0x257a26);if(_0x25e135[_0x9edd('0x2d')]['filter']){_0x4fe471[_0x9edd('0x39')]=_[_0x9edd('0x3a')](_0x4fe471[_0x9edd('0x39')],{'$or':_[_0x9edd('0x27')](_0x257a26,function(_0x1be77f){if(_0x1be77f[_0x9edd('0x2a')]!==_0x9edd('0x3b')){var _0x1cbbac={};_0x1cbbac[_0x1be77f[_0x9edd('0x2c')]]={'$like':'%'+_0x25e135[_0x9edd('0x2d')]['filter']+'%'};return _0x1cbbac;}})});}_0x4fe471=_[_0x9edd('0x3a')]({},_0x4fe471,_0x25e135['options']);var _0x3ef1d5={'where':_0x4fe471['where']};return db[_0x9edd('0x3c')][_0x9edd('0x1b')](_0x3ef1d5)[_0x9edd('0x21')](function(_0x479661){_0x214d0a[_0x9edd('0x1b')]=_0x479661;if(_0x25e135[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x4fe471['include']=[{'all':!![]}];}return db[_0x9edd('0x3c')]['findAll'](_0x4fe471);})[_0x9edd('0x21')](function(_0xfbc492){_0x214d0a['rows']=_0xfbc492;return _0x214d0a;})[_0x9edd('0x21')](respondWithFilteredResult(_0x3c2227,_0x4fe471))[_0x9edd('0x3e')](handleError(_0x3c2227,null));};exports[_0x9edd('0x3f')]=function(_0x810331,_0x492900){var _0x449f01={'raw':!![],'where':{'id':_0x810331[_0x9edd('0x40')]['id']}},_0x5bbdf8={};_0x5bbdf8[_0x9edd('0x2b')]=_['keys'](db[_0x9edd('0x3c')]['rawAttributes']);_0x5bbdf8['query']=_[_0x9edd('0x2e')](_0x810331[_0x9edd('0x2d')]);_0x5bbdf8[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x5bbdf8[_0x9edd('0x2b')],_0x5bbdf8[_0x9edd('0x2d')]);_0x449f01[_0x9edd('0x31')]=_[_0x9edd('0x30')](_0x5bbdf8[_0x9edd('0x2b')],qs[_0x9edd('0x32')](_0x810331[_0x9edd('0x2d')][_0x9edd('0x32')]));_0x449f01[_0x9edd('0x31')]=_0x449f01[_0x9edd('0x31')][_0x9edd('0x33')]?_0x449f01['attributes']:_0x5bbdf8[_0x9edd('0x2b')];if(_0x810331[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x449f01[_0x9edd('0x41')]=[{'all':!![]}];}_0x449f01=_[_0x9edd('0x3a')]({},_0x449f01,_0x810331[_0x9edd('0x42')]);return db[_0x9edd('0x3c')]['find'](_0x449f01)['then'](handleEntityNotFound(_0x492900,null))['then'](respondWithResult(_0x492900,null))[_0x9edd('0x3e')](handleError(_0x492900,null));};exports['create']=function(_0x8b1fdb,_0x19b56b){return db[_0x9edd('0x3c')][_0x9edd('0x43')](_0x8b1fdb[_0x9edd('0x44')],{})['then'](respondWithResult(_0x19b56b,0xc9))[_0x9edd('0x3e')](handleError(_0x19b56b,null));};exports[_0x9edd('0x20')]=function(_0x40e33d,_0x4a89ae){if(_0x40e33d[_0x9edd('0x44')]['id']){delete _0x40e33d[_0x9edd('0x44')]['id'];}return db[_0x9edd('0x3c')][_0x9edd('0x45')]({'where':{'id':_0x40e33d[_0x9edd('0x40')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x4a89ae,null))['then'](saveUpdates(_0x40e33d[_0x9edd('0x44')],null))[_0x9edd('0x21')](respondWithResult(_0x4a89ae,null))['catch'](handleError(_0x4a89ae,null));};exports[_0x9edd('0x22')]=function(_0x8d8701,_0x4bb324){return db[_0x9edd('0x3c')][_0x9edd('0x45')]({'where':{'id':_0x8d8701[_0x9edd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4bb324,null))[_0x9edd('0x21')](removeEntity(_0x4bb324,null))[_0x9edd('0x3e')](handleError(_0x4bb324,null));};exports[_0x9edd('0x46')]=function(_0x28c7bd,_0x53f6e3){return db[_0x9edd('0x3c')][_0x9edd('0x46')]()[_0x9edd('0x21')](respondWithResult(_0x53f6e3,null))['catch'](handleError(_0x53f6e3,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x57082b,_0x33479d){var _0x55aedc=function(_0x35a887){while(--_0x35a887){_0x57082b['push'](_0x57082b['shift']());}};_0x55aedc(++_0x33479d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4ec9eb8..465cab7 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 _0x0f09=['uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer'];(function(_0x33d988,_0xa94cb0){var _0x4c2a51=function(_0x143e93){while(--_0x143e93){_0x33d988['push'](_0x33d988['shift']());}};_0x4c2a51(++_0xa94cb0);}(_0x0f09,0x91));var _0x90f0=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0f09[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var logger=require(_0x90f0('0x1'))(_0x90f0('0x2'));var moment=require(_0x90f0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90f0('0x4'));var rimraf=require(_0x90f0('0x5'));var config=require(_0x90f0('0x6'));var attributes=require(_0x90f0('0x7'));module['exports']=function(_0x18d68f,_0xc9731d){return _0x18d68f[_0x90f0('0x8')](_0x90f0('0x9'),attributes,{'tableName':_0x90f0('0xa'),'paranoid':![],'indexes':[{'name':_0x90f0('0xb'),'fields':[_0x90f0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec8=['exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x6ec8,0x146));var _0x86ec=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0x6ec8[_0x4a94b1];return _0x20949f;};'use strict';var _=require(_0x86ec('0x0'));var util=require(_0x86ec('0x1'));var logger=require(_0x86ec('0x2'))(_0x86ec('0x3'));var moment=require(_0x86ec('0x4'));var BPromise=require(_0x86ec('0x5'));var rp=require(_0x86ec('0x6'));var fs=require('fs');var path=require(_0x86ec('0x7'));var rimraf=require('rimraf');var config=require(_0x86ec('0x8'));var attributes=require(_0x86ec('0x9'));module[_0x86ec('0xa')]=function(_0x162d83,_0x10a15c){return _0x162d83[_0x86ec('0xb')]('SmsTransferReport',attributes,{'tableName':_0x86ec('0xc'),'paranoid':![],'indexes':[{'name':_0x86ec('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index df74406..7c85c86 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 _0xcacf=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xcacf,0x17e));var _0xfcac=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xcacf[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xfcac('0x0'));var util=require(_0xfcac('0x1'));var moment=require(_0xfcac('0x2'));var BPromise=require(_0xfcac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcac('0x5'))(_0xfcac('0x6'));var config=require(_0xfcac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5be99e,_0x4684f8,_0x5d94c9){return new BPromise(function(_0x584123,_0x370f6f){return client[_0xfcac('0x9')](_0x5be99e,_0x5d94c9)['then'](function(_0x330efb){logger[_0xfcac('0xa')](_0xfcac('0xb'),_0x4684f8,_0xfcac('0xc'));logger[_0xfcac('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4684f8,_0xfcac('0xc'),JSON[_0xfcac('0xe')](_0x330efb));if(_0x330efb[_0xfcac('0xf')]){if(_0x330efb[_0xfcac('0xf')][_0xfcac('0x10')]===0x1f4){logger[_0xfcac('0xf')](_0xfcac('0xb'),_0x4684f8,_0x330efb['error'][_0xfcac('0x11')]);return _0x370f6f(_0x330efb[_0xfcac('0xf')][_0xfcac('0x11')]);}logger[_0xfcac('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x4684f8,_0x330efb['error'][_0xfcac('0x11')]);return _0x584123(_0x330efb[_0xfcac('0xf')][_0xfcac('0x11')]);}else{logger[_0xfcac('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x4684f8,_0xfcac('0xc'));_0x584123(_0x330efb[_0xfcac('0x12')][_0xfcac('0x11')]);}})[_0xfcac('0x13')](function(_0x5f2fce){logger['error'](_0xfcac('0xb'),_0x4684f8,_0x5f2fce);_0x370f6f(_0x5f2fce);});});} \ No newline at end of file +var _0xcc32=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x289d38,_0x55ca83){var _0x1f9744=function(_0x343ebf){while(--_0x343ebf){_0x289d38['push'](_0x289d38['shift']());}};_0x1f9744(++_0x55ca83);}(_0xcc32,0xb0));var _0x2cc3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcc32[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2cc3('0x0'));var BPromise=require(_0x2cc3('0x1'));var rs=require(_0x2cc3('0x2'));var fs=require('fs');var Redis=require(_0x2cc3('0x3'));var db=require(_0x2cc3('0x4'))['db'];var utils=require(_0x2cc3('0x5'));var logger=require(_0x2cc3('0x6'))(_0x2cc3('0x7'));var config=require(_0x2cc3('0x8'));var jayson=require(_0x2cc3('0x9'));var client=jayson[_0x2cc3('0xa')][_0x2cc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ffe4,_0x49707c,_0x1f17e9){return new BPromise(function(_0x537709,_0x1b8fca){return client[_0x2cc3('0xc')](_0x27ffe4,_0x1f17e9)[_0x2cc3('0xd')](function(_0x4eb6db){logger[_0x2cc3('0xe')](_0x2cc3('0xf'),_0x49707c,_0x2cc3('0x10'));logger[_0x2cc3('0x11')](_0x2cc3('0x12'),_0x49707c,_0x2cc3('0x10'),JSON[_0x2cc3('0x13')](_0x4eb6db));if(_0x4eb6db['error']){if(_0x4eb6db[_0x2cc3('0x14')][_0x2cc3('0x15')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x49707c,_0x4eb6db[_0x2cc3('0x14')][_0x2cc3('0x16')]);return _0x1b8fca(_0x4eb6db[_0x2cc3('0x14')][_0x2cc3('0x16')]);}logger[_0x2cc3('0x14')](_0x2cc3('0xf'),_0x49707c,_0x4eb6db[_0x2cc3('0x14')][_0x2cc3('0x16')]);return _0x537709(_0x4eb6db['error'][_0x2cc3('0x16')]);}else{logger[_0x2cc3('0xe')](_0x2cc3('0xf'),_0x49707c,'request\x20sent');_0x537709(_0x4eb6db['result'][_0x2cc3('0x16')]);}})[_0x2cc3('0x17')](function(_0x21b594){logger[_0x2cc3('0x14')](_0x2cc3('0xf'),_0x49707c,_0x21b594);_0x1b8fca(_0x21b594);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ee7b953..97d77e3 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 _0x5afd=['format','%s-%s%s','basename','extname','now','post','single','file','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname'];(function(_0x2ebf38,_0x35e0be){var _0x37e4ea=function(_0x555e22){while(--_0x555e22){_0x2ebf38['push'](_0x2ebf38['shift']());}};_0x37e4ea(++_0x35e0be);}(_0x5afd,0xbf));var _0xd5af=function(_0x4f84f7,_0x21a8ba){_0x4f84f7=_0x4f84f7-0x0;var _0x46060c=_0x5afd[_0x4f84f7];return _0x46060c;};'use strict';var multer=require(_0xd5af('0x0'));var util=require(_0xd5af('0x1'));var path=require(_0xd5af('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5af('0x3'));var router=express['Router']();var auth=require(_0xd5af('0x4'));var interaction=require(_0xd5af('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xd5af('0x6')](),controller[_0xd5af('0x7')]);router[_0xd5af('0x8')](_0xd5af('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd5af('0x8')](_0xd5af('0xa'),auth[_0xd5af('0x6')](),controller[_0xd5af('0xb')]);var upload=multer({'storage':multer[_0xd5af('0xc')]({'destination':function(_0x53d4bb,_0x4a0849,_0x4b2a96){_0x4b2a96(null,path[_0xd5af('0xd')](config[_0xd5af('0xe')],_0xd5af('0xf')));},'filename':function(_0x5a1d81,_0x196f95,_0x54c134){_0x196f95[_0xd5af('0x10')]=_0x196f95[_0xd5af('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x54c134(null,util[_0xd5af('0x11')](_0xd5af('0x12'),path[_0xd5af('0x13')](_0x196f95[_0xd5af('0x10')],path[_0xd5af('0x14')](_0x196f95[_0xd5af('0x10')])),Date[_0xd5af('0x15')](),path[_0xd5af('0x14')](_0x196f95[_0xd5af('0x10')])));}})});router[_0xd5af('0x16')]('/',upload[_0xd5af('0x17')](_0xd5af('0x18')),controller['create']);router['put'](_0xd5af('0x9'),auth[_0xd5af('0x6')](),controller['update']);router[_0xd5af('0x19')](_0xd5af('0x9'),auth[_0xd5af('0x6')](),controller[_0xd5af('0x19')]);module['exports']=router; \ No newline at end of file +var _0x8012=['create','put','/:id','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./sound.controller','get','index','isAuthenticated','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x40d756,_0x5c1d15){var _0x5a0611=function(_0x36dbc5){while(--_0x36dbc5){_0x40d756['push'](_0x40d756['shift']());}};_0x5a0611(++_0x5c1d15);}(_0x8012,0x16d));var _0x2801=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x8012[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x2801('0x0'));var util=require(_0x2801('0x1'));var path=require(_0x2801('0x2'));var timeout=require(_0x2801('0x3'));var express=require(_0x2801('0x4'));var router=express['Router']();var auth=require(_0x2801('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2801('0x6'));var controller=require(_0x2801('0x7'));router[_0x2801('0x8')]('/',auth['isAuthenticated'](),controller[_0x2801('0x9')]);router['get']('/:id',auth[_0x2801('0xa')](),controller['show']);router['get'](_0x2801('0xb'),auth[_0x2801('0xa')](),controller[_0x2801('0xc')]);var upload=multer({'storage':multer[_0x2801('0xd')]({'destination':function(_0x1d20a1,_0x139329,_0x4a4654){_0x4a4654(null,path['join'](config['root'],_0x2801('0xe')));},'filename':function(_0x289222,_0x405b38,_0x126e32){_0x405b38[_0x2801('0xf')]=_0x405b38['originalname'][_0x2801('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x126e32(null,util[_0x2801('0x11')](_0x2801('0x12'),path[_0x2801('0x13')](_0x405b38[_0x2801('0xf')],path[_0x2801('0x14')](_0x405b38[_0x2801('0xf')])),Date[_0x2801('0x15')](),path[_0x2801('0x14')](_0x405b38[_0x2801('0xf')])));}})});router[_0x2801('0x16')]('/',upload[_0x2801('0x17')](_0x2801('0x18')),controller[_0x2801('0x19')]);router[_0x2801('0x1a')](_0x2801('0x1b'),auth[_0x2801('0xa')](),controller[_0x2801('0x1c')]);router[_0x2801('0x1d')]('/:id',auth[_0x2801('0xa')](),controller[_0x2801('0x1d')]);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 e41676b..d941cd5 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 _0xfee7=['STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x1d1f39,_0x2aa90a){var _0x2bbf91=function(_0xdfd7a9){while(--_0xdfd7a9){_0x1d1f39['push'](_0x1d1f39['shift']());}};_0x2bbf91(++_0x2aa90a);}(_0xfee7,0xb4));var _0x7fee=function(_0x11f368,_0x1da503){_0x11f368=_0x11f368-0x0;var _0x425bb3=_0xfee7[_0x11f368];return _0x425bb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7fee('0x0')],'unique':_0x7fee('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7fee('0x0')]},'display_name':{'type':Sequelize[_0x7fee('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x7fee('0x0')]},'original_format':{'type':Sequelize[_0x7fee('0x0')]},'original_duration':{'type':Sequelize[_0x7fee('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x7fee('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7fee('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7fee('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x7fee('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x7fee('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x37d3=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0x37d3,0x179));var _0x337d=function(_0xfa96ad,_0x4e15b8){_0xfa96ad=_0xfa96ad-0x0;var _0x38cf8b=_0x37d3[_0xfa96ad];return _0x38cf8b;};'use strict';var Sequelize=require(_0x337d('0x0'));module[_0x337d('0x1')]={'name':{'type':Sequelize[_0x337d('0x2')],'unique':_0x337d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x337d('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x337d('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x337d('0x4')]},'original_sampleCount':{'type':Sequelize[_0x337d('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x337d('0x5')]},'original_sampleRate':{'type':Sequelize[_0x337d('0x6')]},'converted_format':{'type':Sequelize[_0x337d('0x2')]},'converted_duration':{'type':Sequelize[_0x337d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x337d('0x5')]},'converted_channelCount':{'type':Sequelize[_0x337d('0x6')]},'converted_bitRate':{'type':Sequelize[_0x337d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x337d('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c0aaa44..436182b 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 _0xabd2=['Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','duration','original_sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_sampleRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','get','Sounds','stack','name','send','map','Sound','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','format','%s.%s','create','originalname','extname','file','basename','filename','substring','wav','server/files/sounds/original','info'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xabd2,0x10c));var _0x2abd=function(_0x127e9b,_0x3b3fe7){_0x127e9b=_0x127e9b-0x0;var _0x32bd7f=_0xabd2[_0x127e9b];return _0x32bd7f;};'use strict';var pdf=require(_0x2abd('0x0'));var emlformat=require(_0x2abd('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2abd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2abd('0x3'));var Mustache=require(_0x2abd('0x4'));var util=require(_0x2abd('0x5'));var path=require(_0x2abd('0x6'));var sox=require(_0x2abd('0x7'));var csv=require(_0x2abd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2abd('0x9'));var squel=require(_0x2abd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2abd('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2abd('0xc'));var Redis=require(_0x2abd('0xd'));var authService=require(_0x2abd('0xe'));var qs=require(_0x2abd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2abd('0x10'));var logger=require('../../config/logger')(_0x2abd('0x11'));var utils=require(_0x2abd('0x12'));var config=require('../../config/environment');var db=require(_0x2abd('0x13'))['db'];function respondWithStatusCode(_0x37cbe3,_0x3bb3eb){_0x3bb3eb=_0x3bb3eb||0xcc;return function(_0x5046bf){if(_0x5046bf){return _0x37cbe3[_0x2abd('0x14')](_0x3bb3eb);}return _0x37cbe3[_0x2abd('0x15')](_0x3bb3eb)[_0x2abd('0x16')]();};}function respondWithResult(_0x53614e,_0x4eb4b5){_0x4eb4b5=_0x4eb4b5||0xc8;return function(_0x1c680c){if(_0x1c680c){return _0x53614e['status'](_0x4eb4b5)[_0x2abd('0x17')](_0x1c680c);}};}function respondWithFilteredResult(_0x1ad206,_0x57c446){return function(_0x20e4e6){if(_0x20e4e6){var _0x101700=_0x20e4e6[_0x2abd('0x18')],_0xdaf8cc=_0x57c446[_0x2abd('0x19')],_0x3fd750=_0x57c446[_0x2abd('0x19')]+_0x57c446['limit'],_0x5b2dc9;if(_0x3fd750>=_0x101700){_0x3fd750=_0x101700;_0x5b2dc9=0xc8;}else{_0x5b2dc9=0xce;}_0x1ad206[_0x2abd('0x15')](_0x5b2dc9);return _0x1ad206[_0x2abd('0x1a')]('Content-Range',_0xdaf8cc+'-'+_0x3fd750+'/'+_0x101700)['json'](_0x20e4e6);}return null;};}function patchUpdates(_0x23f67b){return function(_0x288848){try{jsonpatch[_0x2abd('0x1b')](_0x288848,_0x23f67b,!![]);}catch(_0x5c1688){return BPromise[_0x2abd('0x1c')](_0x5c1688);}return _0x288848[_0x2abd('0x1d')]();};}function saveUpdates(_0x583268,_0x3ad29d){return function(_0x186835){if(_0x186835){return _0x186835[_0x2abd('0x1e')](_0x583268)[_0x2abd('0x1f')](function(_0x4a4799){return _0x4a4799;});}return null;};}function removeEntity(_0x4858ba,_0x388eb7){return function(_0x524c38){if(_0x524c38){return _0x524c38['destroy']()[_0x2abd('0x1f')](function(){var _0x137213=_0x524c38[_0x2abd('0x20')]({'plain':!![]});var _0x2f9169=_0x2abd('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9169,'resourceId':_0x137213['id']}})[_0x2abd('0x1f')](function(){return _0x524c38;});})[_0x2abd('0x1f')](function(){_0x4858ba[_0x2abd('0x15')](0xcc)[_0x2abd('0x16')]();});}};}function handleEntityNotFound(_0x1cfe77,_0x10d4b0){return function(_0xb9dd1a){if(!_0xb9dd1a){_0x1cfe77[_0x2abd('0x14')](0x194);}return _0xb9dd1a;};}function handleError(_0x3de1ec,_0xbdb63a){_0xbdb63a=_0xbdb63a||0x1f4;return function(_0x195648){logger['error'](_0x195648[_0x2abd('0x22')]);if(_0x195648[_0x2abd('0x23')]){delete _0x195648['name'];}_0x3de1ec['status'](_0xbdb63a)[_0x2abd('0x24')](_0x195648);};}exports['index']=function(_0x21cc37,_0x1330d4){var _0x13ab71={},_0xb2db={},_0x21737c={'count':0x0,'rows':[]};var _0x4515dc=_[_0x2abd('0x25')](db[_0x2abd('0x26')][_0x2abd('0x27')],function(_0x4dc265){return{'name':_0x4dc265['fieldName'],'type':_0x4dc265[_0x2abd('0x28')][_0x2abd('0x29')]};});_0xb2db['model']=_[_0x2abd('0x25')](_0x4515dc,_0x2abd('0x23'));_0xb2db[_0x2abd('0x2a')]=_[_0x2abd('0x2b')](_0x21cc37[_0x2abd('0x2a')]);_0xb2db[_0x2abd('0x2c')]=_[_0x2abd('0x2d')](_0xb2db[_0x2abd('0x2e')],_0xb2db['query']);_0x13ab71[_0x2abd('0x2f')]=_[_0x2abd('0x2d')](_0xb2db[_0x2abd('0x2e')],qs[_0x2abd('0x30')](_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x30')]));_0x13ab71[_0x2abd('0x2f')]=_0x13ab71[_0x2abd('0x2f')][_0x2abd('0x31')]?_0x13ab71[_0x2abd('0x2f')]:_0xb2db[_0x2abd('0x2e')];if(!_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x32')](_0x2abd('0x33'))){_0x13ab71[_0x2abd('0x34')]=qs[_0x2abd('0x34')](_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x34')]);_0x13ab71[_0x2abd('0x19')]=qs[_0x2abd('0x19')](_0x21cc37['query'][_0x2abd('0x19')]);}_0x13ab71[_0x2abd('0x35')]=qs[_0x2abd('0x36')](_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x36')]);_0x13ab71[_0x2abd('0x37')]=qs['filters'](_['pick'](_0x21cc37[_0x2abd('0x2a')],_0xb2db[_0x2abd('0x2c')]),_0x4515dc);if(_0x21cc37[_0x2abd('0x2a')]['filter']){_0x13ab71['where']=_[_0x2abd('0x38')](_0x13ab71['where'],{'$or':_[_0x2abd('0x25')](_0x4515dc,function(_0x594d19){if(_0x594d19[_0x2abd('0x28')]!==_0x2abd('0x39')){var _0x52f6df={};_0x52f6df[_0x594d19[_0x2abd('0x23')]]={'$like':'%'+_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x3a')]+'%'};return _0x52f6df;}})});}_0x13ab71=_[_0x2abd('0x38')]({},_0x13ab71,_0x21cc37[_0x2abd('0x3b')]);var _0x2aa45a={'where':_0x13ab71['where']};return db[_0x2abd('0x26')][_0x2abd('0x18')](_0x2aa45a)['then'](function(_0x548fae){_0x21737c[_0x2abd('0x18')]=_0x548fae;if(_0x21cc37[_0x2abd('0x2a')][_0x2abd('0x3c')]){_0x13ab71[_0x2abd('0x3d')]=[{'all':!![]}];}return db['Sound'][_0x2abd('0x3e')](_0x13ab71);})[_0x2abd('0x1f')](function(_0x23ab29){_0x21737c['rows']=_0x23ab29;return _0x21737c;})[_0x2abd('0x1f')](respondWithFilteredResult(_0x1330d4,_0x13ab71))[_0x2abd('0x3f')](handleError(_0x1330d4,null));};exports[_0x2abd('0x40')]=function(_0x1de497,_0x5afe5e){var _0x53cffa={'raw':!![],'where':{'id':_0x1de497[_0x2abd('0x41')]['id']}},_0x2a52bd={};_0x2a52bd[_0x2abd('0x2e')]=_['keys'](db[_0x2abd('0x26')][_0x2abd('0x27')]);_0x2a52bd[_0x2abd('0x2a')]=_[_0x2abd('0x2b')](_0x1de497['query']);_0x2a52bd['filters']=_[_0x2abd('0x2d')](_0x2a52bd[_0x2abd('0x2e')],_0x2a52bd[_0x2abd('0x2a')]);_0x53cffa[_0x2abd('0x2f')]=_[_0x2abd('0x2d')](_0x2a52bd[_0x2abd('0x2e')],qs[_0x2abd('0x30')](_0x1de497[_0x2abd('0x2a')][_0x2abd('0x30')]));_0x53cffa[_0x2abd('0x2f')]=_0x53cffa[_0x2abd('0x2f')][_0x2abd('0x31')]?_0x53cffa['attributes']:_0x2a52bd[_0x2abd('0x2e')];if(_0x1de497[_0x2abd('0x2a')][_0x2abd('0x3c')]){_0x53cffa[_0x2abd('0x3d')]=[{'all':!![]}];}_0x53cffa=_[_0x2abd('0x38')]({},_0x53cffa,_0x1de497[_0x2abd('0x3b')]);return db[_0x2abd('0x26')][_0x2abd('0x42')](_0x53cffa)[_0x2abd('0x1f')](handleEntityNotFound(_0x5afe5e,null))[_0x2abd('0x1f')](respondWithResult(_0x5afe5e,null))[_0x2abd('0x3f')](handleError(_0x5afe5e,null));};exports[_0x2abd('0x43')]=function(_0x4ce0ff,_0x4ff03a,_0x2ab0cb){return db['Sound']['find']({'where':{'id':_0x4ce0ff[_0x2abd('0x41')]['id']},'attributes':[_0x2abd('0x23'),_0x2abd('0x44'),_0x2abd('0x45')],'raw':!![]})[_0x2abd('0x1f')](handleEntityNotFound(_0x4ff03a,null))[_0x2abd('0x1f')](function(_0x27c371){if(_0x27c371){if(!fs[_0x2abd('0x46')](path[_0x2abd('0x47')](config[_0x2abd('0x48')],_0x2abd('0x49'),_0x27c371[_0x2abd('0x44')]+'.'+_0x27c371[_0x2abd('0x45')]))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x4ff03a[_0x2abd('0x43')](path[_0x2abd('0x47')](config['root'],_0x2abd('0x49'),util[_0x2abd('0x4a')](_0x2abd('0x4b'),_0x27c371['save_name'],_0x27c371[_0x2abd('0x45')])),util[_0x2abd('0x4a')]('%s.%s',_0x27c371[_0x2abd('0x23')],_0x27c371[_0x2abd('0x45')]));}return null;})[_0x2abd('0x3f')](handleError(_0x4ff03a,null));};exports[_0x2abd('0x4c')]=function(_0x162681,_0x5aabf7,_0x549a8c){var _0x4b57ba={'name':path['basename'](_0x162681['file'][_0x2abd('0x4d')],path[_0x2abd('0x4e')](_0x162681[_0x2abd('0x4f')][_0x2abd('0x4d')])),'save_name':path[_0x2abd('0x50')](_0x162681[_0x2abd('0x4f')][_0x2abd('0x51')],path[_0x2abd('0x4e')](_0x162681[_0x2abd('0x4f')][_0x2abd('0x51')])),'original_format':path[_0x2abd('0x4e')](_0x162681[_0x2abd('0x4f')][_0x2abd('0x4d')])[_0x2abd('0x52')](0x1),'converted_format':_0x2abd('0x53')};var _0x18e60e=path[_0x2abd('0x47')](config[_0x2abd('0x48')],_0x2abd('0x54'),_0x162681[_0x2abd('0x4f')][_0x2abd('0x51')]);var _0x994290=path[_0x2abd('0x47')](config[_0x2abd('0x48')],_0x2abd('0x49'),util[_0x2abd('0x4a')]('%s.%s',path[_0x2abd('0x50')](_0x162681['file'][_0x2abd('0x51')],path['extname'](_0x162681[_0x2abd('0x4f')][_0x2abd('0x51')])),_0x4b57ba['converted_format']));logger[_0x2abd('0x55')](_0x2abd('0x56'),_0x18e60e);logger[_0x2abd('0x55')](_0x2abd('0x57'),_0x994290);try{fs[_0x2abd('0x58')](_0x18e60e,parseInt(_0x2abd('0x59'),0x8));var _0x2b5bb1=sox[_0x2abd('0x5a')](_0x18e60e,_0x994290,{'sampleRate':0x1f40,'format':_0x2abd('0x53'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b5bb1['on'](_0x2abd('0x5b'),function(_0x3c97cc){fs[_0x2abd('0x5c')](_0x18e60e);_0x5aabf7[_0x2abd('0x15')](0x1f4)[_0x2abd('0x24')](_0x3c97cc);});_0x2b5bb1['on'](_0x2abd('0x5d'),function(_0x70789){_0x4b57ba['original_duration']=isNaN(_0x70789[_0x2abd('0x5e')])?null:_0x70789[_0x2abd('0x5e')]*0x3e8;_0x4b57ba[_0x2abd('0x5f')]=isNaN(_0x70789['sampleCount'])?null:_0x70789['sampleCount'];_0x4b57ba[_0x2abd('0x60')]=isNaN(_0x70789[_0x2abd('0x61')])?null:_0x70789[_0x2abd('0x61')];_0x4b57ba['original_bitRate']=isNaN(_0x70789[_0x2abd('0x62')])?null:_0x70789['bitRate'];_0x4b57ba[_0x2abd('0x63')]=isNaN(_0x70789[_0x2abd('0x64')])?null:_0x70789[_0x2abd('0x64')];});_0x2b5bb1['on'](_0x2abd('0x65'),function(_0x33b090){_0x4b57ba[_0x2abd('0x66')]=isNaN(_0x33b090[_0x2abd('0x5e')])?null:_0x33b090[_0x2abd('0x5e')]*0x3e8;_0x4b57ba[_0x2abd('0x67')]=isNaN(_0x33b090[_0x2abd('0x68')])?null:_0x33b090[_0x2abd('0x68')];_0x4b57ba['converted_channelCount']=isNaN(_0x33b090['channelCount'])?null:_0x33b090[_0x2abd('0x61')];_0x4b57ba['converted_bitRate']=isNaN(_0x33b090[_0x2abd('0x62')])?null:_0x33b090[_0x2abd('0x62')];_0x4b57ba[_0x2abd('0x69')]=isNaN(_0x33b090[_0x2abd('0x64')])?null:_0x33b090[_0x2abd('0x64')];});_0x2b5bb1['on']('end',function(){fs[_0x2abd('0x58')](_0x994290,parseInt(_0x2abd('0x59'),0x8));return db[_0x2abd('0x26')]['create'](_0x4b57ba)[_0x2abd('0x1f')](function(_0x28bf77){var _0xae790c={'role':_0x162681['body'][_0x2abd('0x6a')],'userProfileId':_0x162681[_0x2abd('0x6b')]['userProfileId']};if(!_0xae790c)throw new Error(_0x2abd('0x6c'));if(_0xae790c['role']===_0x2abd('0x6d')){var _0x3c1cda=_0x28bf77['get']({'plain':!![]});return db[_0x2abd('0x6e')][_0x2abd('0x42')]({'where':{'name':'Sounds','userProfileId':_0xae790c['userProfileId']},'raw':!![]})[_0x2abd('0x1f')](function(_0x1c4953){if(_0x1c4953&&_0x1c4953[_0x2abd('0x6f')]===0x0){return db[_0x2abd('0x70')]['create']({'name':_0x3c1cda[_0x2abd('0x23')],'resourceId':_0x3c1cda['id'],'type':_0x1c4953[_0x2abd('0x23')],'sectionId':_0x1c4953['id']},{})[_0x2abd('0x1f')](function(){return _0x28bf77;});}else{return _0x28bf77;}})[_0x2abd('0x3f')](function(_0xf0e0ab){logger['error'](_0x2abd('0x71'),_0xf0e0ab);throw _0xf0e0ab;});}return _0x28bf77;})[_0x2abd('0x1f')](respondWithResult(_0x5aabf7,null))[_0x2abd('0x3f')](handleError(_0x5aabf7,null));});_0x2b5bb1[_0x2abd('0x72')]();}catch(_0x522263){_0x5aabf7['status'](0x1f4)[_0x2abd('0x24')](_0x522263);}};exports[_0x2abd('0x1e')]=function(_0x9249d2,_0x3025c1,_0x1f1de2){return db['Sound']['find']({'where':{'id':_0x9249d2['params']['id']}})['then'](handleEntityNotFound(_0x3025c1,null))['then'](saveUpdates(_[_0x2abd('0x73')](_0x9249d2[_0x2abd('0x6b')],[_0x2abd('0x23'),_0x2abd('0x74')]),null))[_0x2abd('0x1f')](respondWithResult(_0x3025c1,null))[_0x2abd('0x3f')](handleError(_0x3025c1,null));};exports[_0x2abd('0x75')]=function(_0xdf925d,_0x13cb79,_0x337749){return db[_0x2abd('0x26')]['find']({'where':{'id':_0xdf925d[_0x2abd('0x41')]['id']}})[_0x2abd('0x1f')](function(_0x4b7d61){if(_0x4b7d61){return _0x4b7d61['destroy']();}})[_0x2abd('0x1f')](function(_0xf2f701){var _0x331c13=path[_0x2abd('0x47')](config[_0x2abd('0x48')],_0x2abd('0x54'),util[_0x2abd('0x4a')](_0x2abd('0x4b'),_0xf2f701[_0x2abd('0x44')],_0xf2f701['original_format']));var _0x1b9fa2=path[_0x2abd('0x47')](config[_0x2abd('0x48')],_0x2abd('0x49'),util['format'](_0x2abd('0x4b'),_0xf2f701['save_name'],_0xf2f701[_0x2abd('0x45')]));fs[_0x2abd('0x5c')](_0x331c13);fs[_0x2abd('0x5c')](_0x1b9fa2);return _0xf2f701;})[_0x2abd('0x1f')](function(_0x1d13f3){if(_0x1d13f3){return _0x13cb79[_0x2abd('0x15')](0xcc)[_0x2abd('0x16')]();}})[_0x2abd('0x1f')](handleEntityNotFound(_0x13cb79,null))[_0x2abd('0x3f')](handleError(_0x13cb79,null));}; \ No newline at end of file +var _0xc378=['UserProfileResource','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','catch','show','params','includeAll','merge','find','converted_format','existsSync','root','server/files/sounds/converted','save_name','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','extname','originalname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','sampleRate','chmodSync','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','save','destroy','then','get'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0xc378,0x1c2));var _0x8c37=function(_0x4be3ec,_0x218441){_0x4be3ec=_0x4be3ec-0x0;var _0x44b79f=_0xc378[_0x4be3ec];return _0x44b79f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c37('0x0'));var rimraf=require(_0x8c37('0x1'));var zipdir=require(_0x8c37('0x2'));var jsonpatch=require(_0x8c37('0x3'));var rp=require(_0x8c37('0x4'));var moment=require(_0x8c37('0x5'));var BPromise=require(_0x8c37('0x6'));var Mustache=require(_0x8c37('0x7'));var util=require(_0x8c37('0x8'));var path=require(_0x8c37('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c37('0xa'));var fs=require('fs');var _=require(_0x8c37('0xb'));var squel=require(_0x8c37('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c37('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c37('0xe'));var Redis=require(_0x8c37('0xf'));var authService=require(_0x8c37('0x10'));var qs=require(_0x8c37('0x11'));var as=require(_0x8c37('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c37('0x13'))(_0x8c37('0x14'));var utils=require(_0x8c37('0x15'));var config=require(_0x8c37('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245eb8,_0x23da31){_0x23da31=_0x23da31||0xcc;return function(_0x5dff45){if(_0x5dff45){return _0x245eb8[_0x8c37('0x17')](_0x23da31);}return _0x245eb8[_0x8c37('0x18')](_0x23da31)['end']();};}function respondWithResult(_0x5e4925,_0x78855){_0x78855=_0x78855||0xc8;return function(_0x11c710){if(_0x11c710){return _0x5e4925['status'](_0x78855)['json'](_0x11c710);}};}function respondWithFilteredResult(_0x4db1f6,_0x25c620){return function(_0x13f136){if(_0x13f136){var _0x554fa4=_0x13f136[_0x8c37('0x19')],_0x253870=_0x25c620[_0x8c37('0x1a')],_0x46034b=_0x25c620[_0x8c37('0x1a')]+_0x25c620['limit'],_0x4c1032;if(_0x46034b>=_0x554fa4){_0x46034b=_0x554fa4;_0x4c1032=0xc8;}else{_0x4c1032=0xce;}_0x4db1f6[_0x8c37('0x18')](_0x4c1032);return _0x4db1f6[_0x8c37('0x1b')](_0x8c37('0x1c'),_0x253870+'-'+_0x46034b+'/'+_0x554fa4)['json'](_0x13f136);}return null;};}function patchUpdates(_0x1fd0c8){return function(_0x10d763){try{jsonpatch[_0x8c37('0x1d')](_0x10d763,_0x1fd0c8,!![]);}catch(_0x7e9cd8){return BPromise['reject'](_0x7e9cd8);}return _0x10d763[_0x8c37('0x1e')]();};}function saveUpdates(_0x63fe00,_0x316463){return function(_0x239c42){if(_0x239c42){return _0x239c42['update'](_0x63fe00)['then'](function(_0xd7de67){return _0xd7de67;});}return null;};}function removeEntity(_0x25d8c8,_0x4d1be6){return function(_0x242fd5){if(_0x242fd5){return _0x242fd5[_0x8c37('0x1f')]()[_0x8c37('0x20')](function(){var _0x69dfa2=_0x242fd5[_0x8c37('0x21')]({'plain':!![]});var _0x1ef20d='Sounds';return db[_0x8c37('0x22')][_0x8c37('0x1f')]({'where':{'type':_0x1ef20d,'resourceId':_0x69dfa2['id']}})[_0x8c37('0x20')](function(){return _0x242fd5;});})['then'](function(){_0x25d8c8[_0x8c37('0x18')](0xcc)[_0x8c37('0x23')]();});}};}function handleEntityNotFound(_0x116b6b,_0x2e77e6){return function(_0x238b70){if(!_0x238b70){_0x116b6b['sendStatus'](0x194);}return _0x238b70;};}function handleError(_0x838146,_0x4aaf30){_0x4aaf30=_0x4aaf30||0x1f4;return function(_0x5d8895){logger[_0x8c37('0x24')](_0x5d8895[_0x8c37('0x25')]);if(_0x5d8895[_0x8c37('0x26')]){delete _0x5d8895[_0x8c37('0x26')];}_0x838146[_0x8c37('0x18')](_0x4aaf30)[_0x8c37('0x27')](_0x5d8895);};}exports[_0x8c37('0x28')]=function(_0x265063,_0x28ea8f){var _0x1c53d3={},_0x5dc4a5={},_0x2eb2da={'count':0x0,'rows':[]};var _0x557b6b=_[_0x8c37('0x29')](db[_0x8c37('0x2a')][_0x8c37('0x2b')],function(_0x20aa50){return{'name':_0x20aa50[_0x8c37('0x2c')],'type':_0x20aa50[_0x8c37('0x2d')]['key']};});_0x5dc4a5[_0x8c37('0x2e')]=_[_0x8c37('0x29')](_0x557b6b,_0x8c37('0x26'));_0x5dc4a5['query']=_[_0x8c37('0x2f')](_0x265063[_0x8c37('0x30')]);_0x5dc4a5[_0x8c37('0x31')]=_[_0x8c37('0x32')](_0x5dc4a5['model'],_0x5dc4a5[_0x8c37('0x30')]);_0x1c53d3[_0x8c37('0x33')]=_['intersection'](_0x5dc4a5[_0x8c37('0x2e')],qs[_0x8c37('0x34')](_0x265063[_0x8c37('0x30')]['fields']));_0x1c53d3[_0x8c37('0x33')]=_0x1c53d3['attributes'][_0x8c37('0x35')]?_0x1c53d3['attributes']:_0x5dc4a5[_0x8c37('0x2e')];if(!_0x265063[_0x8c37('0x30')][_0x8c37('0x36')](_0x8c37('0x37'))){_0x1c53d3[_0x8c37('0x38')]=qs[_0x8c37('0x38')](_0x265063['query'][_0x8c37('0x38')]);_0x1c53d3[_0x8c37('0x1a')]=qs['offset'](_0x265063[_0x8c37('0x30')][_0x8c37('0x1a')]);}_0x1c53d3[_0x8c37('0x39')]=qs[_0x8c37('0x3a')](_0x265063[_0x8c37('0x30')][_0x8c37('0x3a')]);_0x1c53d3[_0x8c37('0x3b')]=qs['filters'](_[_0x8c37('0x3c')](_0x265063[_0x8c37('0x30')],_0x5dc4a5[_0x8c37('0x31')]),_0x557b6b);if(_0x265063[_0x8c37('0x30')][_0x8c37('0x3d')]){_0x1c53d3['where']=_['merge'](_0x1c53d3[_0x8c37('0x3b')],{'$or':_[_0x8c37('0x29')](_0x557b6b,function(_0x915514){if(_0x915514[_0x8c37('0x2d')]!==_0x8c37('0x3e')){var _0x436dd1={};_0x436dd1[_0x915514['name']]={'$like':'%'+_0x265063[_0x8c37('0x30')]['filter']+'%'};return _0x436dd1;}})});}_0x1c53d3=_['merge']({},_0x1c53d3,_0x265063[_0x8c37('0x3f')]);var _0x5d6a70={'where':_0x1c53d3[_0x8c37('0x3b')]};return db['Sound'][_0x8c37('0x19')](_0x5d6a70)['then'](function(_0x66002a){_0x2eb2da[_0x8c37('0x19')]=_0x66002a;if(_0x265063[_0x8c37('0x30')]['includeAll']){_0x1c53d3[_0x8c37('0x40')]=[{'all':!![]}];}return db[_0x8c37('0x2a')]['findAll'](_0x1c53d3);})[_0x8c37('0x20')](function(_0x3b1a92){_0x2eb2da['rows']=_0x3b1a92;return _0x2eb2da;})[_0x8c37('0x20')](respondWithFilteredResult(_0x28ea8f,_0x1c53d3))[_0x8c37('0x41')](handleError(_0x28ea8f,null));};exports[_0x8c37('0x42')]=function(_0x3107cd,_0x486625){var _0x217444={'raw':!![],'where':{'id':_0x3107cd[_0x8c37('0x43')]['id']}},_0x11fdd5={};_0x11fdd5[_0x8c37('0x2e')]=_[_0x8c37('0x2f')](db['Sound'][_0x8c37('0x2b')]);_0x11fdd5[_0x8c37('0x30')]=_[_0x8c37('0x2f')](_0x3107cd['query']);_0x11fdd5[_0x8c37('0x31')]=_[_0x8c37('0x32')](_0x11fdd5[_0x8c37('0x2e')],_0x11fdd5[_0x8c37('0x30')]);_0x217444[_0x8c37('0x33')]=_[_0x8c37('0x32')](_0x11fdd5[_0x8c37('0x2e')],qs['fields'](_0x3107cd[_0x8c37('0x30')][_0x8c37('0x34')]));_0x217444['attributes']=_0x217444['attributes'][_0x8c37('0x35')]?_0x217444[_0x8c37('0x33')]:_0x11fdd5['model'];if(_0x3107cd[_0x8c37('0x30')][_0x8c37('0x44')]){_0x217444[_0x8c37('0x40')]=[{'all':!![]}];}_0x217444=_[_0x8c37('0x45')]({},_0x217444,_0x3107cd[_0x8c37('0x3f')]);return db[_0x8c37('0x2a')][_0x8c37('0x46')](_0x217444)[_0x8c37('0x20')](handleEntityNotFound(_0x486625,null))[_0x8c37('0x20')](respondWithResult(_0x486625,null))[_0x8c37('0x41')](handleError(_0x486625,null));};exports['download']=function(_0x33f084,_0x19ca17,_0x38b46a){return db[_0x8c37('0x2a')][_0x8c37('0x46')]({'where':{'id':_0x33f084['params']['id']},'attributes':[_0x8c37('0x26'),'save_name',_0x8c37('0x47')],'raw':!![]})[_0x8c37('0x20')](handleEntityNotFound(_0x19ca17,null))[_0x8c37('0x20')](function(_0x171a63){if(_0x171a63){if(!fs[_0x8c37('0x48')](path['join'](config[_0x8c37('0x49')],_0x8c37('0x4a'),_0x171a63[_0x8c37('0x4b')]+'.'+_0x171a63['converted_format']))){throw new db['Sequelize']['ValidationError'](_0x8c37('0x4c'));}return _0x19ca17['download'](path[_0x8c37('0x4d')](config[_0x8c37('0x49')],_0x8c37('0x4a'),util['format']('%s.%s',_0x171a63[_0x8c37('0x4b')],_0x171a63[_0x8c37('0x47')])),util[_0x8c37('0x4e')](_0x8c37('0x4f'),_0x171a63[_0x8c37('0x26')],_0x171a63[_0x8c37('0x47')]));}return null;})[_0x8c37('0x41')](handleError(_0x19ca17,null));};exports[_0x8c37('0x50')]=function(_0x33fdb,_0x33e81a,_0x34e46f){var _0x180ee6={'name':path[_0x8c37('0x51')](_0x33fdb[_0x8c37('0x52')]['originalname'],path[_0x8c37('0x53')](_0x33fdb[_0x8c37('0x52')][_0x8c37('0x54')])),'save_name':path[_0x8c37('0x51')](_0x33fdb[_0x8c37('0x52')][_0x8c37('0x55')],path[_0x8c37('0x53')](_0x33fdb['file']['filename'])),'original_format':path['extname'](_0x33fdb[_0x8c37('0x52')][_0x8c37('0x54')])['substring'](0x1),'converted_format':_0x8c37('0x56')};var _0x3d9fcb=path['join'](config[_0x8c37('0x49')],'server/files/sounds/original',_0x33fdb[_0x8c37('0x52')][_0x8c37('0x55')]);var _0x43c176=path[_0x8c37('0x4d')](config[_0x8c37('0x49')],_0x8c37('0x4a'),util[_0x8c37('0x4e')](_0x8c37('0x4f'),path[_0x8c37('0x51')](_0x33fdb[_0x8c37('0x52')][_0x8c37('0x55')],path['extname'](_0x33fdb[_0x8c37('0x52')][_0x8c37('0x55')])),_0x180ee6[_0x8c37('0x47')]));logger[_0x8c37('0x57')](_0x8c37('0x58'),_0x3d9fcb);logger[_0x8c37('0x57')](_0x8c37('0x59'),_0x43c176);try{fs['chmodSync'](_0x3d9fcb,parseInt(_0x8c37('0x5a'),0x8));var _0x2dea14=sox['transcode'](_0x3d9fcb,_0x43c176,{'sampleRate':0x1f40,'format':_0x8c37('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2dea14['on'](_0x8c37('0x24'),function(_0x14487f){fs[_0x8c37('0x5b')](_0x3d9fcb);_0x33e81a['status'](0x1f4)[_0x8c37('0x27')](_0x14487f);});_0x2dea14['on']('src',function(_0x53d2e3){_0x180ee6[_0x8c37('0x5c')]=isNaN(_0x53d2e3[_0x8c37('0x5d')])?null:_0x53d2e3[_0x8c37('0x5d')]*0x3e8;_0x180ee6['original_sampleCount']=isNaN(_0x53d2e3[_0x8c37('0x5e')])?null:_0x53d2e3[_0x8c37('0x5e')];_0x180ee6[_0x8c37('0x5f')]=isNaN(_0x53d2e3[_0x8c37('0x60')])?null:_0x53d2e3[_0x8c37('0x60')];_0x180ee6[_0x8c37('0x61')]=isNaN(_0x53d2e3[_0x8c37('0x62')])?null:_0x53d2e3['bitRate'];_0x180ee6[_0x8c37('0x63')]=isNaN(_0x53d2e3['sampleRate'])?null:_0x53d2e3['sampleRate'];});_0x2dea14['on'](_0x8c37('0x64'),function(_0x1fcda2){_0x180ee6[_0x8c37('0x65')]=isNaN(_0x1fcda2[_0x8c37('0x5d')])?null:_0x1fcda2[_0x8c37('0x5d')]*0x3e8;_0x180ee6[_0x8c37('0x66')]=isNaN(_0x1fcda2[_0x8c37('0x5e')])?null:_0x1fcda2['sampleCount'];_0x180ee6[_0x8c37('0x67')]=isNaN(_0x1fcda2[_0x8c37('0x60')])?null:_0x1fcda2[_0x8c37('0x60')];_0x180ee6['converted_bitRate']=isNaN(_0x1fcda2[_0x8c37('0x62')])?null:_0x1fcda2[_0x8c37('0x62')];_0x180ee6[_0x8c37('0x68')]=isNaN(_0x1fcda2[_0x8c37('0x69')])?null:_0x1fcda2[_0x8c37('0x69')];});_0x2dea14['on'](_0x8c37('0x23'),function(){fs[_0x8c37('0x6a')](_0x43c176,parseInt(_0x8c37('0x5a'),0x8));return db[_0x8c37('0x2a')][_0x8c37('0x50')](_0x180ee6)[_0x8c37('0x20')](function(_0x1fee3e){var _0x2db1be={'role':_0x33fdb[_0x8c37('0x6b')][_0x8c37('0x6c')],'userProfileId':_0x33fdb['body'][_0x8c37('0x6d')]};if(!_0x2db1be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2db1be['role']===_0x8c37('0x6e')){var _0x3cc90b=_0x1fee3e[_0x8c37('0x21')]({'plain':!![]});return db[_0x8c37('0x6f')]['find']({'where':{'name':_0x8c37('0x70'),'userProfileId':_0x2db1be[_0x8c37('0x6d')]},'raw':!![]})[_0x8c37('0x20')](function(_0x807b59){if(_0x807b59&&_0x807b59[_0x8c37('0x71')]===0x0){return db['UserProfileResource'][_0x8c37('0x50')]({'name':_0x3cc90b[_0x8c37('0x26')],'resourceId':_0x3cc90b['id'],'type':_0x807b59['name'],'sectionId':_0x807b59['id']},{})[_0x8c37('0x20')](function(){return _0x1fee3e;});}else{return _0x1fee3e;}})[_0x8c37('0x41')](function(_0x40cf9b){logger[_0x8c37('0x24')](_0x8c37('0x72'),_0x40cf9b);throw _0x40cf9b;});}return _0x1fee3e;})[_0x8c37('0x20')](respondWithResult(_0x33e81a,null))[_0x8c37('0x41')](handleError(_0x33e81a,null));});_0x2dea14[_0x8c37('0x73')]();}catch(_0x478dec){_0x33e81a[_0x8c37('0x18')](0x1f4)['send'](_0x478dec);}};exports[_0x8c37('0x74')]=function(_0x1c0bb5,_0x3b25d0,_0x434400){return db[_0x8c37('0x2a')]['find']({'where':{'id':_0x1c0bb5[_0x8c37('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b25d0,null))['then'](saveUpdates(_[_0x8c37('0x3c')](_0x1c0bb5[_0x8c37('0x6b')],[_0x8c37('0x26'),_0x8c37('0x75')]),null))['then'](respondWithResult(_0x3b25d0,null))[_0x8c37('0x41')](handleError(_0x3b25d0,null));};exports[_0x8c37('0x76')]=function(_0x270fc3,_0x22e10b,_0x2115fb){return db[_0x8c37('0x2a')][_0x8c37('0x46')]({'where':{'id':_0x270fc3[_0x8c37('0x43')]['id']}})[_0x8c37('0x20')](function(_0x2c2a35){if(_0x2c2a35){return _0x2c2a35[_0x8c37('0x1f')]();}})['then'](function(_0x1aa200){var _0xb8a20=path[_0x8c37('0x4d')](config[_0x8c37('0x49')],_0x8c37('0x77'),util['format'](_0x8c37('0x4f'),_0x1aa200[_0x8c37('0x4b')],_0x1aa200[_0x8c37('0x78')]));var _0x5978d7=path[_0x8c37('0x4d')](config[_0x8c37('0x49')],_0x8c37('0x4a'),util['format'](_0x8c37('0x4f'),_0x1aa200[_0x8c37('0x4b')],_0x1aa200[_0x8c37('0x47')]));fs[_0x8c37('0x5b')](_0xb8a20);fs[_0x8c37('0x5b')](_0x5978d7);return _0x1aa200;})[_0x8c37('0x20')](function(_0x55d326){if(_0x55d326){return _0x22e10b[_0x8c37('0x18')](0xcc)[_0x8c37('0x23')]();}})['then'](handleEntityNotFound(_0x22e10b,null))[_0x8c37('0x41')](handleError(_0x22e10b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 20b3901..e9aff37 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 _0x80bc=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x43be07,_0x312899){var _0x5d6c29=function(_0x47aadd){while(--_0x47aadd){_0x43be07['push'](_0x43be07['shift']());}};_0x5d6c29(++_0x312899);}(_0x80bc,0x1ea));var _0xc80b=function(_0x35e54a,_0x46953a){_0x35e54a=_0x35e54a-0x0;var _0x35c2b0=_0x80bc[_0x35e54a];return _0x35c2b0;};'use strict';var _=require(_0xc80b('0x0'));var util=require('util');var logger=require(_0xc80b('0x1'))(_0xc80b('0x2'));var moment=require(_0xc80b('0x3'));var BPromise=require(_0xc80b('0x4'));var rp=require(_0xc80b('0x5'));var fs=require('fs');var path=require(_0xc80b('0x6'));var rimraf=require(_0xc80b('0x7'));var config=require(_0xc80b('0x8'));var attributes=require('./sound.attributes');module[_0xc80b('0x9')]=function(_0x3710a1,_0x15e56f){return _0x3710a1[_0xc80b('0xa')](_0xc80b('0xb'),attributes,{'tableName':_0xc80b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a08=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6a08,0xc9));var _0x86a0=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x6a08[_0x585133];return _0x18254a;};'use strict';var _=require(_0x86a0('0x0'));var util=require(_0x86a0('0x1'));var logger=require(_0x86a0('0x2'))(_0x86a0('0x3'));var moment=require(_0x86a0('0x4'));var BPromise=require(_0x86a0('0x5'));var rp=require(_0x86a0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86a0('0x7'));var config=require(_0x86a0('0x8'));var attributes=require(_0x86a0('0x9'));module[_0x86a0('0xa')]=function(_0x489330,_0x5904df){return _0x489330[_0x86a0('0xb')](_0x86a0('0xc'),attributes,{'tableName':_0x86a0('0xd'),'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 4a252f0..4e58309 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 _0xc2a3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','Sound','find','options','raw','attributes','include','map','model','ShowSound','catch'];(function(_0x373d50,_0x291c04){var _0x15bab8=function(_0x324cd9){while(--_0x324cd9){_0x373d50['push'](_0x373d50['shift']());}};_0x15bab8(++_0x291c04);}(_0xc2a3,0x1e0));var _0x3c2a=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xc2a3[_0x1fa381];return _0x47eefe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c2a('0x0'));var BPromise=require(_0x3c2a('0x1'));var rs=require(_0x3c2a('0x2'));var fs=require('fs');var Redis=require(_0x3c2a('0x3'));var db=require(_0x3c2a('0x4'))['db'];var utils=require(_0x3c2a('0x5'));var logger=require(_0x3c2a('0x6'))(_0x3c2a('0x7'));var config=require(_0x3c2a('0x8'));var jayson=require(_0x3c2a('0x9'));var client=jayson['client'][_0x3c2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1df46c,_0x49e92a,_0x11c388){return new BPromise(function(_0xe183a2,_0x24825a){return client[_0x3c2a('0xb')](_0x1df46c,_0x11c388)[_0x3c2a('0xc')](function(_0x2b9a33){logger['info'](_0x3c2a('0xd'),_0x49e92a,'request\x20sent');logger[_0x3c2a('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x49e92a,_0x3c2a('0xf'),JSON[_0x3c2a('0x10')](_0x2b9a33));if(_0x2b9a33[_0x3c2a('0x11')]){if(_0x2b9a33[_0x3c2a('0x11')][_0x3c2a('0x12')]===0x1f4){logger[_0x3c2a('0x11')]('Sound,\x20%s,\x20%s',_0x49e92a,_0x2b9a33['error']['message']);return _0x24825a(_0x2b9a33['error'][_0x3c2a('0x13')]);}logger[_0x3c2a('0x11')](_0x3c2a('0xd'),_0x49e92a,_0x2b9a33['error'][_0x3c2a('0x13')]);return _0xe183a2(_0x2b9a33[_0x3c2a('0x11')][_0x3c2a('0x13')]);}else{logger['info'](_0x3c2a('0xd'),_0x49e92a,_0x3c2a('0xf'));_0xe183a2(_0x2b9a33['result'][_0x3c2a('0x13')]);}})['catch'](function(_0x48c514){logger[_0x3c2a('0x11')](_0x3c2a('0xd'),_0x49e92a,_0x48c514);_0x24825a(_0x48c514);});});}exports['ShowSound']=function(_0x41f508){var _0x47331a=this;return new Promise(function(_0x497252,_0x206767){return db[_0x3c2a('0x14')][_0x3c2a('0x15')]({'raw':_0x41f508[_0x3c2a('0x16')]?_0x41f508[_0x3c2a('0x16')][_0x3c2a('0x17')]===undefined?!![]:![]:!![],'where':_0x41f508[_0x3c2a('0x16')]?_0x41f508[_0x3c2a('0x16')]['where']||null:null,'attributes':_0x41f508[_0x3c2a('0x16')]?_0x41f508[_0x3c2a('0x16')][_0x3c2a('0x18')]||null:null,'include':_0x41f508[_0x3c2a('0x16')]?_0x41f508[_0x3c2a('0x16')][_0x3c2a('0x19')]?_[_0x3c2a('0x1a')](_0x41f508['options'][_0x3c2a('0x19')],function(_0x18a046){return{'model':db[_0x18a046[_0x3c2a('0x1b')]],'as':_0x18a046['as'],'attributes':_0x18a046[_0x3c2a('0x18')],'include':_0x18a046['include']?_['map'](_0x18a046[_0x3c2a('0x19')],function(_0x7309c){return{'model':db[_0x7309c[_0x3c2a('0x1b')]],'as':_0x7309c['as'],'attributes':_0x7309c[_0x3c2a('0x18')],'include':_0x7309c['include']?_[_0x3c2a('0x1a')](_0x7309c[_0x3c2a('0x19')],function(_0x208cd5){return{'model':db[_0x208cd5[_0x3c2a('0x1b')]],'as':_0x208cd5['as'],'attributes':_0x208cd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c2a('0xc')](function(_0x377f96){logger['info'](_0x3c2a('0x1c'),_0x41f508);logger[_0x3c2a('0xe')](_0x3c2a('0x1c'),_0x41f508,JSON['stringify'](_0x377f96));_0x497252(_0x377f96);})[_0x3c2a('0x1d')](function(_0x5eb540){logger[_0x3c2a('0x11')](_0x3c2a('0x1c'),_0x5eb540[_0x3c2a('0x13')],_0x41f508);_0x206767(_0x47331a['error'](0x1f4,_0x5eb540[_0x3c2a('0x13')]));});});}; \ No newline at end of file +var _0x11e8=['../../config/logger','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','find','options','raw','where','map','include','attributes','catch','ShowSound','util','moment','bluebird','randomstring','ioredis'];(function(_0x21cd3d,_0x467607){var _0x5a21c4=function(_0x318d0b){while(--_0x318d0b){_0x21cd3d['push'](_0x21cd3d['shift']());}};_0x5a21c4(++_0x467607);}(_0x11e8,0x82));var _0x811e=function(_0x2a6669,_0x475384){_0x2a6669=_0x2a6669-0x0;var _0x42d0cb=_0x11e8[_0x2a6669];return _0x42d0cb;};'use strict';var _=require('lodash');var util=require(_0x811e('0x0'));var moment=require(_0x811e('0x1'));var BPromise=require(_0x811e('0x2'));var rs=require(_0x811e('0x3'));var fs=require('fs');var Redis=require(_0x811e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x811e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x811e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x48bed0,_0x505258,_0x205348){return new BPromise(function(_0x1c4782,_0x5d3b87){return client[_0x811e('0x7')](_0x48bed0,_0x205348)[_0x811e('0x8')](function(_0x47df37){logger[_0x811e('0x9')](_0x811e('0xa'),_0x505258,_0x811e('0xb'));logger[_0x811e('0xc')](_0x811e('0xd'),_0x505258,'request\x20sent',JSON[_0x811e('0xe')](_0x47df37));if(_0x47df37[_0x811e('0xf')]){if(_0x47df37[_0x811e('0xf')][_0x811e('0x10')]===0x1f4){logger['error'](_0x811e('0xa'),_0x505258,_0x47df37[_0x811e('0xf')][_0x811e('0x11')]);return _0x5d3b87(_0x47df37[_0x811e('0xf')][_0x811e('0x11')]);}logger[_0x811e('0xf')](_0x811e('0xa'),_0x505258,_0x47df37[_0x811e('0xf')]['message']);return _0x1c4782(_0x47df37[_0x811e('0xf')]['message']);}else{logger['info'](_0x811e('0xa'),_0x505258,_0x811e('0xb'));_0x1c4782(_0x47df37['result'][_0x811e('0x11')]);}})['catch'](function(_0x3357e8){logger[_0x811e('0xf')](_0x811e('0xa'),_0x505258,_0x3357e8);_0x5d3b87(_0x3357e8);});});}exports['ShowSound']=function(_0x26052e){var _0x419fff=this;return new Promise(function(_0x210fa9,_0x22e656){return db['Sound'][_0x811e('0x12')]({'raw':_0x26052e[_0x811e('0x13')]?_0x26052e['options'][_0x811e('0x14')]===undefined?!![]:![]:!![],'where':_0x26052e[_0x811e('0x13')]?_0x26052e[_0x811e('0x13')][_0x811e('0x15')]||null:null,'attributes':_0x26052e[_0x811e('0x13')]?_0x26052e[_0x811e('0x13')]['attributes']||null:null,'include':_0x26052e[_0x811e('0x13')]?_0x26052e[_0x811e('0x13')]['include']?_[_0x811e('0x16')](_0x26052e[_0x811e('0x13')]['include'],function(_0x3bddaa){return{'model':db[_0x3bddaa['model']],'as':_0x3bddaa['as'],'attributes':_0x3bddaa['attributes'],'include':_0x3bddaa[_0x811e('0x17')]?_[_0x811e('0x16')](_0x3bddaa[_0x811e('0x17')],function(_0x5ad81c){return{'model':db[_0x5ad81c['model']],'as':_0x5ad81c['as'],'attributes':_0x5ad81c[_0x811e('0x18')],'include':_0x5ad81c[_0x811e('0x17')]?_['map'](_0x5ad81c[_0x811e('0x17')],function(_0x581bb8){return{'model':db[_0x581bb8['model']],'as':_0x581bb8['as'],'attributes':_0x581bb8[_0x811e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x811e('0x8')](function(_0x460dd3){logger[_0x811e('0x9')]('ShowSound',_0x26052e);logger[_0x811e('0xc')]('ShowSound',_0x26052e,JSON[_0x811e('0xe')](_0x460dd3));_0x210fa9(_0x460dd3);})[_0x811e('0x19')](function(_0x3eef50){logger[_0x811e('0xf')](_0x811e('0x1a'),_0x3eef50[_0x811e('0x11')],_0x26052e);_0x22e656(_0x419fff[_0x811e('0xf')](0x1f4,_0x3eef50[_0x811e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d2aee80..e4b110a 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 _0xf001=['../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x41ceff,_0x11b12e){var _0x5dc73a=function(_0x1e8094){while(--_0x1e8094){_0x41ceff['push'](_0x41ceff['shift']());}};_0x5dc73a(++_0x11b12e);}(_0xf001,0xeb));var _0x1f00=function(_0x1e88eb,_0x4d031e){_0x1e88eb=_0x1e88eb-0x0;var _0x23fe01=_0xf001[_0x1e88eb];return _0x23fe01;};'use strict';var multer=require(_0x1f00('0x0'));var util=require(_0x1f00('0x1'));var path=require(_0x1f00('0x2'));var timeout=require(_0x1f00('0x3'));var express=require(_0x1f00('0x4'));var router=express[_0x1f00('0x5')]();var auth=require(_0x1f00('0x6'));var interaction=require(_0x1f00('0x7'));var config=require(_0x1f00('0x8'));var controller=require(_0x1f00('0x9'));router[_0x1f00('0xa')]('/',auth[_0x1f00('0xb')](),controller[_0x1f00('0xc')]);router[_0x1f00('0xa')](_0x1f00('0xd'),auth[_0x1f00('0xb')](),controller[_0x1f00('0xe')]);router[_0x1f00('0xf')]('/',auth[_0x1f00('0xb')](),controller[_0x1f00('0x10')]);router[_0x1f00('0x11')](_0x1f00('0xd'),auth[_0x1f00('0xb')](),controller[_0x1f00('0x12')]);router[_0x1f00('0x13')](_0x1f00('0xd'),auth['isAuthenticated'](),controller[_0x1f00('0x14')]);module[_0x1f00('0x15')]=router; \ No newline at end of file +var _0xaaeb=['post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x189c5b,_0x3d5dfe){var _0x56674a=function(_0x437717){while(--_0x437717){_0x189c5b['push'](_0x189c5b['shift']());}};_0x56674a(++_0x3d5dfe);}(_0xaaeb,0xcd));var _0xbaae=function(_0x503e25,_0xb8a860){_0x503e25=_0x503e25-0x0;var _0x47c27a=_0xaaeb[_0x503e25];return _0x47c27a;};'use strict';var multer=require(_0xbaae('0x0'));var util=require('util');var path=require(_0xbaae('0x1'));var timeout=require('connect-timeout');var express=require(_0xbaae('0x2'));var router=express[_0xbaae('0x3')]();var auth=require(_0xbaae('0x4'));var interaction=require(_0xbaae('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0xbaae('0x6')]('/',auth[_0xbaae('0x7')](),controller[_0xbaae('0x8')]);router['get'](_0xbaae('0x9'),auth['isAuthenticated'](),controller[_0xbaae('0xa')]);router[_0xbaae('0xb')]('/',auth['isAuthenticated'](),controller[_0xbaae('0xc')]);router[_0xbaae('0xd')](_0xbaae('0x9'),auth[_0xbaae('0x7')](),controller[_0xbaae('0xe')]);router[_0xbaae('0xf')](_0xbaae('0x9'),auth[_0xbaae('0x7')](),controller[_0xbaae('0x10')]);module[_0xbaae('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1b23e25..be95152 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 _0x2ecd=['STRING','medium','ENUM','out'];(function(_0x4e5779,_0x289c93){var _0x3c980a=function(_0x2f9b4d){while(--_0x2f9b4d){_0x4e5779['push'](_0x4e5779['shift']());}};_0x3c980a(++_0x289c93);}(_0x2ecd,0xb0));var _0xd2ec=function(_0x18723e,_0x30c8d1){_0x18723e=_0x18723e-0x0;var _0x35b795=_0x2ecd[_0x18723e];return _0x35b795;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd2ec('0x0')]},'body':{'type':Sequelize['TEXT'](_0xd2ec('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0xd2ec('0x2')]('in',_0xd2ec('0x3')),'defaultValue':_0xd2ec('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0x040f=['sequelize','exports','TEXT','ENUM','out'];(function(_0x1db2b0,_0x5c453f){var _0x25207d=function(_0x27f778){while(--_0x27f778){_0x1db2b0['push'](_0x1db2b0['shift']());}};_0x25207d(++_0x5c453f);}(_0x040f,0xdc));var _0xf040=function(_0x430a86,_0x3a37d4){_0x430a86=_0x430a86-0x0;var _0xebe561=_0x040f[_0x430a86];return _0xebe561;};'use strict';var Sequelize=require(_0xf040('0x0'));module[_0xf040('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf040('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xf040('0x3')]('in',_0xf040('0x4')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e61aa29..18668a4 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 _0x8d43=['fieldName','type','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','SquareMessage','count','include','findAll','rows','fields','includeAll','find','create','body','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x184245,_0x4bd603){var _0x57e656=function(_0x1e64d1){while(--_0x1e64d1){_0x184245['push'](_0x184245['shift']());}};_0x57e656(++_0x4bd603);}(_0x8d43,0x6f));var _0x38d4=function(_0x16b243,_0x58f661){_0x16b243=_0x16b243-0x0;var _0x1de31e=_0x8d43[_0x16b243];return _0x1de31e;};'use strict';var pdf=require(_0x38d4('0x0'));var emlformat=require(_0x38d4('0x1'));var rimraf=require(_0x38d4('0x2'));var zipdir=require(_0x38d4('0x3'));var jsonpatch=require(_0x38d4('0x4'));var rp=require('request-promise');var moment=require(_0x38d4('0x5'));var BPromise=require(_0x38d4('0x6'));var Mustache=require(_0x38d4('0x7'));var util=require(_0x38d4('0x8'));var path=require(_0x38d4('0x9'));var sox=require(_0x38d4('0xa'));var csv=require('to-csv');var ejs=require(_0x38d4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38d4('0xc'));var crypto=require(_0x38d4('0xd'));var jsforce=require(_0x38d4('0xe'));var deskjs=require(_0x38d4('0xf'));var toCsv=require(_0x38d4('0x10'));var querystring=require(_0x38d4('0x11'));var Papa=require(_0x38d4('0x12'));var Redis=require(_0x38d4('0x13'));var authService=require(_0x38d4('0x14'));var qs=require(_0x38d4('0x15'));var as=require(_0x38d4('0x16'));var hardwareService=require(_0x38d4('0x17'));var logger=require(_0x38d4('0x18'))(_0x38d4('0x19'));var utils=require(_0x38d4('0x1a'));var config=require(_0x38d4('0x1b'));var db=require(_0x38d4('0x1c'))['db'];function respondWithStatusCode(_0xc799c4,_0x44bd52){_0x44bd52=_0x44bd52||0xcc;return function(_0xf2fd3f){if(_0xf2fd3f){return _0xc799c4[_0x38d4('0x1d')](_0x44bd52);}return _0xc799c4['status'](_0x44bd52)[_0x38d4('0x1e')]();};}function respondWithResult(_0x27bc3a,_0x2c37b5){_0x2c37b5=_0x2c37b5||0xc8;return function(_0x56827b){if(_0x56827b){return _0x27bc3a['status'](_0x2c37b5)[_0x38d4('0x1f')](_0x56827b);}};}function respondWithFilteredResult(_0x445ff3,_0x549f94){return function(_0x24763d){if(_0x24763d){var _0xf7dc13=_0x24763d['count'],_0x1db331=_0x549f94[_0x38d4('0x20')],_0x69b43=_0x549f94['offset']+_0x549f94['limit'],_0xfc87a;if(_0x69b43>=_0xf7dc13){_0x69b43=_0xf7dc13;_0xfc87a=0xc8;}else{_0xfc87a=0xce;}_0x445ff3[_0x38d4('0x21')](_0xfc87a);return _0x445ff3['set'](_0x38d4('0x22'),_0x1db331+'-'+_0x69b43+'/'+_0xf7dc13)[_0x38d4('0x1f')](_0x24763d);}return null;};}function patchUpdates(_0x15cc02){return function(_0x2c39df){try{jsonpatch[_0x38d4('0x23')](_0x2c39df,_0x15cc02,!![]);}catch(_0x181686){return BPromise[_0x38d4('0x24')](_0x181686);}return _0x2c39df[_0x38d4('0x25')]();};}function saveUpdates(_0x24dc89,_0x6a8d5c){return function(_0x568170){if(_0x568170){return _0x568170[_0x38d4('0x26')](_0x24dc89)[_0x38d4('0x27')](function(_0x33fbfe){return _0x33fbfe;});}return null;};}function removeEntity(_0x507e44,_0x4fd2e0){return function(_0x2e0c04){if(_0x2e0c04){return _0x2e0c04[_0x38d4('0x28')]()['then'](function(){_0x507e44[_0x38d4('0x21')](0xcc)[_0x38d4('0x1e')]();});}};}function handleEntityNotFound(_0x3c1353,_0x1d9854){return function(_0x2b507f){if(!_0x2b507f){_0x3c1353[_0x38d4('0x1d')](0x194);}return _0x2b507f;};}function handleError(_0x5efe55,_0x249326){_0x249326=_0x249326||0x1f4;return function(_0x3ae46a){logger[_0x38d4('0x29')](_0x3ae46a[_0x38d4('0x2a')]);if(_0x3ae46a[_0x38d4('0x2b')]){delete _0x3ae46a['name'];}_0x5efe55[_0x38d4('0x21')](_0x249326)[_0x38d4('0x2c')](_0x3ae46a);};}exports['index']=function(_0x33bae5,_0x594593){var _0x25c6f2={},_0x2c141={},_0x1cea5a={'count':0x0,'rows':[]};var _0x400913=_['map'](db['SquareMessage']['rawAttributes'],function(_0x2ab7d3){return{'name':_0x2ab7d3[_0x38d4('0x2d')],'type':_0x2ab7d3[_0x38d4('0x2e')][_0x38d4('0x2f')]};});_0x2c141[_0x38d4('0x30')]=_[_0x38d4('0x31')](_0x400913,_0x38d4('0x2b'));_0x2c141[_0x38d4('0x32')]=_[_0x38d4('0x33')](_0x33bae5[_0x38d4('0x32')]);_0x2c141[_0x38d4('0x34')]=_['intersection'](_0x2c141[_0x38d4('0x30')],_0x2c141[_0x38d4('0x32')]);_0x25c6f2[_0x38d4('0x35')]=_[_0x38d4('0x36')](_0x2c141['model'],qs['fields'](_0x33bae5[_0x38d4('0x32')]['fields']));_0x25c6f2['attributes']=_0x25c6f2['attributes'][_0x38d4('0x37')]?_0x25c6f2['attributes']:_0x2c141[_0x38d4('0x30')];if(!_0x33bae5[_0x38d4('0x32')][_0x38d4('0x38')](_0x38d4('0x39'))){_0x25c6f2[_0x38d4('0x3a')]=qs[_0x38d4('0x3a')](_0x33bae5[_0x38d4('0x32')]['limit']);_0x25c6f2['offset']=qs[_0x38d4('0x20')](_0x33bae5[_0x38d4('0x32')][_0x38d4('0x20')]);}_0x25c6f2[_0x38d4('0x3b')]=qs[_0x38d4('0x3c')](_0x33bae5['query'][_0x38d4('0x3c')]);_0x25c6f2['where']=qs[_0x38d4('0x34')](_[_0x38d4('0x3d')](_0x33bae5['query'],_0x2c141[_0x38d4('0x34')]),_0x400913);if(_0x33bae5['query'][_0x38d4('0x3e')]){_0x25c6f2[_0x38d4('0x3f')]=_['merge'](_0x25c6f2[_0x38d4('0x3f')],{'$or':_['map'](_0x400913,function(_0x4050bd){if(_0x4050bd['type']!=='VIRTUAL'){var _0xb1508b={};_0xb1508b[_0x4050bd[_0x38d4('0x2b')]]={'$like':'%'+_0x33bae5['query'][_0x38d4('0x3e')]+'%'};return _0xb1508b;}})});}_0x25c6f2=_[_0x38d4('0x40')]({},_0x25c6f2,_0x33bae5[_0x38d4('0x41')]);var _0x10aef5={'where':_0x25c6f2['where']};return db[_0x38d4('0x42')][_0x38d4('0x43')](_0x10aef5)[_0x38d4('0x27')](function(_0x46255f){_0x1cea5a[_0x38d4('0x43')]=_0x46255f;if(_0x33bae5[_0x38d4('0x32')]['includeAll']){_0x25c6f2[_0x38d4('0x44')]=[{'all':!![]}];}return db[_0x38d4('0x42')][_0x38d4('0x45')](_0x25c6f2);})[_0x38d4('0x27')](function(_0x4589b1){_0x1cea5a[_0x38d4('0x46')]=_0x4589b1;return _0x1cea5a;})['then'](respondWithFilteredResult(_0x594593,_0x25c6f2))['catch'](handleError(_0x594593,null));};exports['show']=function(_0x1a9c98,_0x26fa58){var _0x49ecc2={'raw':!![],'where':{'id':_0x1a9c98['params']['id']}},_0x566d2e={};_0x566d2e[_0x38d4('0x30')]=_[_0x38d4('0x33')](db[_0x38d4('0x42')]['rawAttributes']);_0x566d2e['query']=_[_0x38d4('0x33')](_0x1a9c98[_0x38d4('0x32')]);_0x566d2e[_0x38d4('0x34')]=_[_0x38d4('0x36')](_0x566d2e[_0x38d4('0x30')],_0x566d2e[_0x38d4('0x32')]);_0x49ecc2[_0x38d4('0x35')]=_[_0x38d4('0x36')](_0x566d2e['model'],qs[_0x38d4('0x47')](_0x1a9c98[_0x38d4('0x32')][_0x38d4('0x47')]));_0x49ecc2['attributes']=_0x49ecc2[_0x38d4('0x35')][_0x38d4('0x37')]?_0x49ecc2[_0x38d4('0x35')]:_0x566d2e[_0x38d4('0x30')];if(_0x1a9c98[_0x38d4('0x32')][_0x38d4('0x48')]){_0x49ecc2[_0x38d4('0x44')]=[{'all':!![]}];}_0x49ecc2=_[_0x38d4('0x40')]({},_0x49ecc2,_0x1a9c98['options']);return db['SquareMessage'][_0x38d4('0x49')](_0x49ecc2)['then'](handleEntityNotFound(_0x26fa58,null))[_0x38d4('0x27')](respondWithResult(_0x26fa58,null))['catch'](handleError(_0x26fa58,null));};exports['create']=function(_0xe47497,_0x27c455){return db[_0x38d4('0x42')][_0x38d4('0x4a')](_0xe47497[_0x38d4('0x4b')],{})[_0x38d4('0x27')](respondWithResult(_0x27c455,0xc9))[_0x38d4('0x4c')](handleError(_0x27c455,null));};exports[_0x38d4('0x26')]=function(_0x56a492,_0x355d1b){if(_0x56a492['body']['id']){delete _0x56a492[_0x38d4('0x4b')]['id'];}return db[_0x38d4('0x42')][_0x38d4('0x49')]({'where':{'id':_0x56a492[_0x38d4('0x4d')]['id']}})[_0x38d4('0x27')](handleEntityNotFound(_0x355d1b,null))[_0x38d4('0x27')](saveUpdates(_0x56a492[_0x38d4('0x4b')],null))[_0x38d4('0x27')](respondWithResult(_0x355d1b,null))[_0x38d4('0x4c')](handleError(_0x355d1b,null));};exports['destroy']=function(_0x2577ac,_0xb4d164){return db[_0x38d4('0x42')][_0x38d4('0x49')]({'where':{'id':_0x2577ac[_0x38d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb4d164,null))[_0x38d4('0x27')](removeEntity(_0xb4d164,null))[_0x38d4('0x4c')](handleError(_0xb4d164,null));}; \ No newline at end of file +var _0x9297=['map','SquareMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','json','apply','save','update','then','destroy','name','send','index'];(function(_0x7d5588,_0x13773f){var _0xff1c13=function(_0x118ff7){while(--_0x118ff7){_0x7d5588['push'](_0x7d5588['shift']());}};_0xff1c13(++_0x13773f);}(_0x9297,0x12f));var _0x7929=function(_0x457c38,_0x40b79e){_0x457c38=_0x457c38-0x0;var _0xe1c49d=_0x9297[_0x457c38];return _0xe1c49d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7929('0x0'));var rimraf=require(_0x7929('0x1'));var zipdir=require(_0x7929('0x2'));var jsonpatch=require(_0x7929('0x3'));var rp=require(_0x7929('0x4'));var moment=require(_0x7929('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7929('0x6'));var util=require('util');var path=require(_0x7929('0x7'));var sox=require('sox');var csv=require(_0x7929('0x8'));var ejs=require(_0x7929('0x9'));var fs=require('fs');var _=require(_0x7929('0xa'));var squel=require('squel');var crypto=require(_0x7929('0xb'));var jsforce=require(_0x7929('0xc'));var deskjs=require(_0x7929('0xd'));var toCsv=require(_0x7929('0x8'));var querystring=require('querystring');var Papa=require(_0x7929('0xe'));var Redis=require(_0x7929('0xf'));var authService=require(_0x7929('0x10'));var qs=require(_0x7929('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7929('0x12'));var logger=require(_0x7929('0x13'))('api');var utils=require(_0x7929('0x14'));var config=require(_0x7929('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b82b4,_0x28fb1f){_0x28fb1f=_0x28fb1f||0xcc;return function(_0x597636){if(_0x597636){return _0x5b82b4[_0x7929('0x16')](_0x28fb1f);}return _0x5b82b4[_0x7929('0x17')](_0x28fb1f)[_0x7929('0x18')]();};}function respondWithResult(_0x29dfb4,_0x533ac7){_0x533ac7=_0x533ac7||0xc8;return function(_0xaaa73a){if(_0xaaa73a){return _0x29dfb4['status'](_0x533ac7)['json'](_0xaaa73a);}};}function respondWithFilteredResult(_0x2f2da6,_0x32b1ee){return function(_0x11352b){if(_0x11352b){var _0xf42f77=_0x11352b[_0x7929('0x19')],_0xddeaed=_0x32b1ee[_0x7929('0x1a')],_0xdc1d56=_0x32b1ee['offset']+_0x32b1ee[_0x7929('0x1b')],_0x5027c8;if(_0xdc1d56>=_0xf42f77){_0xdc1d56=_0xf42f77;_0x5027c8=0xc8;}else{_0x5027c8=0xce;}_0x2f2da6[_0x7929('0x17')](_0x5027c8);return _0x2f2da6['set']('Content-Range',_0xddeaed+'-'+_0xdc1d56+'/'+_0xf42f77)[_0x7929('0x1c')](_0x11352b);}return null;};}function patchUpdates(_0x2be63d){return function(_0x2a9307){try{jsonpatch[_0x7929('0x1d')](_0x2a9307,_0x2be63d,!![]);}catch(_0x1bdf81){return BPromise['reject'](_0x1bdf81);}return _0x2a9307[_0x7929('0x1e')]();};}function saveUpdates(_0x17fb16,_0x18f8b1){return function(_0x49e625){if(_0x49e625){return _0x49e625[_0x7929('0x1f')](_0x17fb16)[_0x7929('0x20')](function(_0x2b296a){return _0x2b296a;});}return null;};}function removeEntity(_0x39dc38,_0x5b0ab2){return function(_0x387c04){if(_0x387c04){return _0x387c04[_0x7929('0x21')]()[_0x7929('0x20')](function(){_0x39dc38[_0x7929('0x17')](0xcc)[_0x7929('0x18')]();});}};}function handleEntityNotFound(_0x8a8751,_0x61410c){return function(_0x29cd0a){if(!_0x29cd0a){_0x8a8751[_0x7929('0x16')](0x194);}return _0x29cd0a;};}function handleError(_0xe85187,_0x4cd032){_0x4cd032=_0x4cd032||0x1f4;return function(_0x35f05d){logger['error'](_0x35f05d['stack']);if(_0x35f05d[_0x7929('0x22')]){delete _0x35f05d[_0x7929('0x22')];}_0xe85187[_0x7929('0x17')](_0x4cd032)[_0x7929('0x23')](_0x35f05d);};}exports[_0x7929('0x24')]=function(_0x3ec150,_0xc699bb){var _0x1a2e65={},_0x3471cf={},_0x29d942={'count':0x0,'rows':[]};var _0x3d7aa1=_[_0x7929('0x25')](db[_0x7929('0x26')][_0x7929('0x27')],function(_0x3c3dbc){return{'name':_0x3c3dbc[_0x7929('0x28')],'type':_0x3c3dbc[_0x7929('0x29')]['key']};});_0x3471cf[_0x7929('0x2a')]=_['map'](_0x3d7aa1,_0x7929('0x22'));_0x3471cf[_0x7929('0x2b')]=_['keys'](_0x3ec150[_0x7929('0x2b')]);_0x3471cf[_0x7929('0x2c')]=_[_0x7929('0x2d')](_0x3471cf[_0x7929('0x2a')],_0x3471cf[_0x7929('0x2b')]);_0x1a2e65[_0x7929('0x2e')]=_[_0x7929('0x2d')](_0x3471cf[_0x7929('0x2a')],qs[_0x7929('0x2f')](_0x3ec150[_0x7929('0x2b')]['fields']));_0x1a2e65['attributes']=_0x1a2e65[_0x7929('0x2e')][_0x7929('0x30')]?_0x1a2e65[_0x7929('0x2e')]:_0x3471cf['model'];if(!_0x3ec150[_0x7929('0x2b')][_0x7929('0x31')](_0x7929('0x32'))){_0x1a2e65['limit']=qs[_0x7929('0x1b')](_0x3ec150['query']['limit']);_0x1a2e65['offset']=qs[_0x7929('0x1a')](_0x3ec150[_0x7929('0x2b')][_0x7929('0x1a')]);}_0x1a2e65[_0x7929('0x33')]=qs['sort'](_0x3ec150[_0x7929('0x2b')][_0x7929('0x34')]);_0x1a2e65['where']=qs[_0x7929('0x2c')](_[_0x7929('0x35')](_0x3ec150[_0x7929('0x2b')],_0x3471cf['filters']),_0x3d7aa1);if(_0x3ec150['query'][_0x7929('0x36')]){_0x1a2e65[_0x7929('0x37')]=_[_0x7929('0x38')](_0x1a2e65[_0x7929('0x37')],{'$or':_['map'](_0x3d7aa1,function(_0x30a703){if(_0x30a703['type']!=='VIRTUAL'){var _0xc6ca04={};_0xc6ca04[_0x30a703['name']]={'$like':'%'+_0x3ec150[_0x7929('0x2b')]['filter']+'%'};return _0xc6ca04;}})});}_0x1a2e65=_[_0x7929('0x38')]({},_0x1a2e65,_0x3ec150[_0x7929('0x39')]);var _0xdd6594={'where':_0x1a2e65[_0x7929('0x37')]};return db[_0x7929('0x26')][_0x7929('0x19')](_0xdd6594)['then'](function(_0x169c9b){_0x29d942[_0x7929('0x19')]=_0x169c9b;if(_0x3ec150[_0x7929('0x2b')][_0x7929('0x3a')]){_0x1a2e65[_0x7929('0x3b')]=[{'all':!![]}];}return db[_0x7929('0x26')]['findAll'](_0x1a2e65);})[_0x7929('0x20')](function(_0x1e2140){_0x29d942[_0x7929('0x3c')]=_0x1e2140;return _0x29d942;})['then'](respondWithFilteredResult(_0xc699bb,_0x1a2e65))[_0x7929('0x3d')](handleError(_0xc699bb,null));};exports[_0x7929('0x3e')]=function(_0x3ac937,_0x4c884e){var _0x1f4067={'raw':!![],'where':{'id':_0x3ac937[_0x7929('0x3f')]['id']}},_0x2ccc4a={};_0x2ccc4a[_0x7929('0x2a')]=_[_0x7929('0x40')](db[_0x7929('0x26')][_0x7929('0x27')]);_0x2ccc4a[_0x7929('0x2b')]=_['keys'](_0x3ac937[_0x7929('0x2b')]);_0x2ccc4a['filters']=_[_0x7929('0x2d')](_0x2ccc4a['model'],_0x2ccc4a[_0x7929('0x2b')]);_0x1f4067[_0x7929('0x2e')]=_[_0x7929('0x2d')](_0x2ccc4a[_0x7929('0x2a')],qs[_0x7929('0x2f')](_0x3ac937[_0x7929('0x2b')][_0x7929('0x2f')]));_0x1f4067[_0x7929('0x2e')]=_0x1f4067[_0x7929('0x2e')]['length']?_0x1f4067[_0x7929('0x2e')]:_0x2ccc4a[_0x7929('0x2a')];if(_0x3ac937[_0x7929('0x2b')]['includeAll']){_0x1f4067[_0x7929('0x3b')]=[{'all':!![]}];}_0x1f4067=_[_0x7929('0x38')]({},_0x1f4067,_0x3ac937['options']);return db[_0x7929('0x26')]['find'](_0x1f4067)[_0x7929('0x20')](handleEntityNotFound(_0x4c884e,null))[_0x7929('0x20')](respondWithResult(_0x4c884e,null))[_0x7929('0x3d')](handleError(_0x4c884e,null));};exports[_0x7929('0x41')]=function(_0x58f88f,_0x23a9b4){return db['SquareMessage']['create'](_0x58f88f[_0x7929('0x42')],{})[_0x7929('0x20')](respondWithResult(_0x23a9b4,0xc9))[_0x7929('0x3d')](handleError(_0x23a9b4,null));};exports[_0x7929('0x1f')]=function(_0x5dcf64,_0x2d3afb){if(_0x5dcf64[_0x7929('0x42')]['id']){delete _0x5dcf64[_0x7929('0x42')]['id'];}return db['SquareMessage'][_0x7929('0x43')]({'where':{'id':_0x5dcf64[_0x7929('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2d3afb,null))[_0x7929('0x20')](saveUpdates(_0x5dcf64[_0x7929('0x42')],null))['then'](respondWithResult(_0x2d3afb,null))[_0x7929('0x3d')](handleError(_0x2d3afb,null));};exports[_0x7929('0x21')]=function(_0x1a845b,_0x381c37){return db['SquareMessage'][_0x7929('0x43')]({'where':{'id':_0x1a845b[_0x7929('0x3f')]['id']}})[_0x7929('0x20')](handleEntityNotFound(_0x381c37,null))['then'](removeEntity(_0x381c37,null))[_0x7929('0x3d')](handleError(_0x381c37,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 89b6f1a..ee10c03 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x900037,_0x1fee29){var _0x326d96=function(_0x47adf2){while(--_0x47adf2){_0x900037['push'](_0x900037['shift']());}};_0x326d96(++_0x1fee29);}(_0x5fab,0x177));var _0xb5fa=function(_0x4de2de,_0x2171db){_0x4de2de=_0x4de2de-0x0;var _0x2e3372=_0x5fab[_0x4de2de];return _0x2e3372;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./squareMessage.attributes','define','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x493b44,_0x27ddc1){var _0x95afdb=function(_0x25a60d){while(--_0x25a60d){_0x493b44['push'](_0x493b44['shift']());}};_0x95afdb(++_0x27ddc1);}(_0x31f0,0xb7));var _0x031f=function(_0x4f9e4c,_0x5c03c3){_0x4f9e4c=_0x4f9e4c-0x0;var _0x5bf1c3=_0x31f0[_0x4f9e4c];return _0x5bf1c3;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('SquareMessage',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 78c7f8a..2b574c4 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 _0x13f5=['util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','then','lodash'];(function(_0x2276ea,_0x1c1b81){var _0x1be595=function(_0x4e2449){while(--_0x4e2449){_0x2276ea['push'](_0x2276ea['shift']());}};_0x1be595(++_0x1c1b81);}(_0x13f5,0xc3));var _0x513f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x13f5[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var moment=require(_0x513f('0x2'));var BPromise=require(_0x513f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x513f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x513f('0x5'))(_0x513f('0x6'));var config=require(_0x513f('0x7'));var jayson=require(_0x513f('0x8'));var client=jayson[_0x513f('0x9')][_0x513f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2be368,_0x6e5b15,_0x2c75a3){return new BPromise(function(_0x42951f,_0x1975b5){return client[_0x513f('0xb')](_0x2be368,_0x2c75a3)['then'](function(_0x39c6df){logger[_0x513f('0xc')](_0x513f('0xd'),_0x6e5b15,_0x513f('0xe'));logger[_0x513f('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x6e5b15,_0x513f('0xe'),JSON[_0x513f('0x10')](_0x39c6df));if(_0x39c6df['error']){if(_0x39c6df[_0x513f('0x11')][_0x513f('0x12')]===0x1f4){logger[_0x513f('0x11')](_0x513f('0xd'),_0x6e5b15,_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);return _0x1975b5(_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);}logger[_0x513f('0x11')](_0x513f('0xd'),_0x6e5b15,_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);return _0x42951f(_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);}else{logger['info'](_0x513f('0xd'),_0x6e5b15,'request\x20sent');_0x42951f(_0x39c6df[_0x513f('0x14')][_0x513f('0x13')]);}})[_0x513f('0x15')](function(_0x3ea7b8){logger[_0x513f('0x11')]('SquareMessage,\x20%s,\x20%s',_0x6e5b15,_0x3ea7b8);_0x1975b5(_0x3ea7b8);});});}exports[_0x513f('0x16')]=function(_0x73ac7d){var _0x54801f=this;return new Promise(function(_0x186121,_0x57904a){return db[_0x513f('0x17')][_0x513f('0x18')](_0x73ac7d['body'],{'raw':_0x73ac7d[_0x513f('0x19')]?_0x73ac7d[_0x513f('0x19')][_0x513f('0x1a')]===undefined?!![]:![]:!![]})[_0x513f('0x1b')](function(_0x443dcb){logger[_0x513f('0xc')]('CreateSquareMessage',_0x73ac7d);logger[_0x513f('0xf')](_0x513f('0x16'),_0x73ac7d,JSON['stringify'](_0x443dcb));_0x186121(_0x443dcb);})[_0x513f('0x15')](function(_0x3314cf){logger[_0x513f('0x11')](_0x513f('0x16'),_0x3314cf[_0x513f('0x13')],_0x73ac7d);_0x57904a(_0x54801f[_0x513f('0x11')](0x1f4,_0x3314cf['message']));});});}; \ No newline at end of file +var _0x5b47=['debug','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x1950cc,_0x4b7309){var _0x2be3cc=function(_0xe16d28){while(--_0xe16d28){_0x1950cc['push'](_0x1950cc['shift']());}};_0x2be3cc(++_0x4b7309);}(_0x5b47,0x120));var _0x75b4=function(_0x17a5e0,_0x461b0b){_0x17a5e0=_0x17a5e0-0x0;var _0x2a0cee=_0x5b47[_0x17a5e0];return _0x2a0cee;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x2'));var logger=require(_0x75b4('0x3'))(_0x75b4('0x4'));var config=require(_0x75b4('0x5'));var jayson=require(_0x75b4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53dcb0,_0x1f1e33,_0x5285bb){return new BPromise(function(_0x16138d,_0x39ff0b){return client[_0x75b4('0x7')](_0x53dcb0,_0x5285bb)[_0x75b4('0x8')](function(_0x127e77){logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,_0x75b4('0xb'));logger[_0x75b4('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1f1e33,_0x75b4('0xb'),JSON['stringify'](_0x127e77));if(_0x127e77[_0x75b4('0xd')]){if(_0x127e77[_0x75b4('0xd')][_0x75b4('0xe')]===0x1f4){logger[_0x75b4('0xd')](_0x75b4('0xa'),_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x39ff0b(_0x127e77[_0x75b4('0xd')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x16138d(_0x127e77['error'][_0x75b4('0xf')]);}else{logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,'request\x20sent');_0x16138d(_0x127e77[_0x75b4('0x10')][_0x75b4('0xf')]);}})[_0x75b4('0x11')](function(_0xc7ce4f){logger['error'](_0x75b4('0xa'),_0x1f1e33,_0xc7ce4f);_0x39ff0b(_0xc7ce4f);});});}exports[_0x75b4('0x12')]=function(_0x254063){var _0x7e396d=this;return new Promise(function(_0x33d522,_0x3a1eec){return db[_0x75b4('0x13')][_0x75b4('0x14')](_0x254063[_0x75b4('0x15')],{'raw':_0x254063[_0x75b4('0x16')]?_0x254063[_0x75b4('0x16')][_0x75b4('0x17')]===undefined?!![]:![]:!![]})[_0x75b4('0x8')](function(_0x40afc5){logger[_0x75b4('0x9')](_0x75b4('0x12'),_0x254063);logger[_0x75b4('0xc')](_0x75b4('0x12'),_0x254063,JSON[_0x75b4('0x18')](_0x40afc5));_0x33d522(_0x40afc5);})[_0x75b4('0x11')](function(_0x1583b1){logger[_0x75b4('0xd')](_0x75b4('0x12'),_0x1583b1[_0x75b4('0xf')],_0x254063);_0x3a1eec(_0x7e396d['error'](0x1f4,_0x1583b1[_0x75b4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4079a8f..687c273 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 _0x8e87=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','test','post','put','update','delete','exports','multer','util'];(function(_0x524c2e,_0x165d16){var _0x4ce75d=function(_0x568b83){while(--_0x568b83){_0x524c2e['push'](_0x524c2e['shift']());}};_0x4ce75d(++_0x165d16);}(_0x8e87,0x1a2));var _0x78e8=function(_0x17acb2,_0x2042f7){_0x17acb2=_0x17acb2-0x0;var _0x33be6c=_0x8e87[_0x17acb2];return _0x33be6c;};'use strict';var multer=require(_0x78e8('0x0'));var util=require(_0x78e8('0x1'));var path=require(_0x78e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x78e8('0x3'));var router=express[_0x78e8('0x4')]();var auth=require(_0x78e8('0x5'));var interaction=require(_0x78e8('0x6'));var config=require(_0x78e8('0x7'));var controller=require(_0x78e8('0x8'));router[_0x78e8('0x9')]('/',auth[_0x78e8('0xa')](),controller['index']);router[_0x78e8('0x9')](_0x78e8('0xb'),auth[_0x78e8('0xa')](),controller[_0x78e8('0xc')]);router[_0x78e8('0x9')](_0x78e8('0xd'),auth[_0x78e8('0xa')](),timeout('15s'),controller[_0x78e8('0xe')]);router[_0x78e8('0xf')]('/',auth[_0x78e8('0xa')](),controller['create']);router[_0x78e8('0x10')]('/:id',auth[_0x78e8('0xa')](),controller[_0x78e8('0x11')]);router[_0x78e8('0x12')](_0x78e8('0xb'),auth[_0x78e8('0xa')](),controller['destroy']);module[_0x78e8('0x13')]=router; \ No newline at end of file +var _0x385e=['../../config/environment','./squareOdbc.controller','isAuthenticated','get','show','15s','test','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b059e,_0xf30ac){var _0x173e5b=function(_0x1893a2){while(--_0x1893a2){_0x4b059e['push'](_0x4b059e['shift']());}};_0x173e5b(++_0xf30ac);}(_0x385e,0x185));var _0xe385=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x385e[_0x20cc29];return _0x28d513;};'use strict';var multer=require(_0xe385('0x0'));var util=require(_0xe385('0x1'));var path=require(_0xe385('0x2'));var timeout=require(_0xe385('0x3'));var express=require('express');var router=express[_0xe385('0x4')]();var auth=require(_0xe385('0x5'));var interaction=require(_0xe385('0x6'));var config=require(_0xe385('0x7'));var controller=require(_0xe385('0x8'));router['get']('/',auth[_0xe385('0x9')](),controller['index']);router[_0xe385('0xa')]('/:id',auth[_0xe385('0x9')](),controller[_0xe385('0xb')]);router[_0xe385('0xa')]('/:id/test',auth[_0xe385('0x9')](),timeout(_0xe385('0xc')),controller[_0xe385('0xd')]);router[_0xe385('0xe')]('/',auth['isAuthenticated'](),controller[_0xe385('0xf')]);router[_0xe385('0x10')]('/:id',auth[_0xe385('0x9')](),controller[_0xe385('0x11')]);router[_0xe385('0x12')](_0xe385('0x13'),auth[_0xe385('0x9')](),controller[_0xe385('0x14')]);module[_0xe385('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index dd92c82..0db14a2 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 _0x53b6=['sequelize','exports','STRING'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0x53b6,0x84));var _0x653b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x53b6[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x653b('0x0'));module[_0x653b('0x1')]={'name':{'type':Sequelize[_0x653b('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x653b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf984=['name','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf984,0x191));var _0x4f98=function(_0x35021f,_0x451349){_0x35021f=_0x35021f-0x0;var _0x1044e9=_0xf984[_0x35021f];return _0x1044e9;};'use strict';var Sequelize=require(_0x4f98('0x0'));module[_0x4f98('0x1')]={'name':{'type':Sequelize[_0x4f98('0x2')],'unique':_0x4f98('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4f98('0x2')]},'description':{'type':Sequelize[_0x4f98('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5d15328..7e26928 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 _0x5c62=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','destroy','then','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1e4362,_0x19a914){var _0x2bc046=function(_0x3d8d3c){while(--_0x3d8d3c){_0x1e4362['push'](_0x1e4362['shift']());}};_0x2bc046(++_0x19a914);}(_0x5c62,0x114));var _0x25c6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c62[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x25c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25c6('0x1'));var zipdir=require(_0x25c6('0x2'));var jsonpatch=require(_0x25c6('0x3'));var rp=require(_0x25c6('0x4'));var moment=require(_0x25c6('0x5'));var BPromise=require(_0x25c6('0x6'));var Mustache=require(_0x25c6('0x7'));var util=require(_0x25c6('0x8'));var path=require(_0x25c6('0x9'));var sox=require('sox');var csv=require(_0x25c6('0xa'));var ejs=require(_0x25c6('0xb'));var fs=require('fs');var _=require(_0x25c6('0xc'));var squel=require('squel');var crypto=require(_0x25c6('0xd'));var jsforce=require(_0x25c6('0xe'));var deskjs=require(_0x25c6('0xf'));var toCsv=require(_0x25c6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x25c6('0x10'));var authService=require(_0x25c6('0x11'));var qs=require(_0x25c6('0x12'));var as=require(_0x25c6('0x13'));var hardwareService=require(_0x25c6('0x14'));var logger=require(_0x25c6('0x15'))(_0x25c6('0x16'));var utils=require(_0x25c6('0x17'));var config=require(_0x25c6('0x18'));var db=require(_0x25c6('0x19'))['db'];function respondWithStatusCode(_0x1f684d,_0x3b2893){_0x3b2893=_0x3b2893||0xcc;return function(_0x2e04c1){if(_0x2e04c1){return _0x1f684d[_0x25c6('0x1a')](_0x3b2893);}return _0x1f684d[_0x25c6('0x1b')](_0x3b2893)[_0x25c6('0x1c')]();};}function respondWithResult(_0x1c6888,_0x465d21){_0x465d21=_0x465d21||0xc8;return function(_0x4b94dd){if(_0x4b94dd){return _0x1c6888[_0x25c6('0x1b')](_0x465d21)['json'](_0x4b94dd);}};}function respondWithFilteredResult(_0x40ac8a,_0x4cd084){return function(_0x398c15){if(_0x398c15){var _0x581810=_0x398c15[_0x25c6('0x1d')],_0x1ce7eb=_0x4cd084[_0x25c6('0x1e')],_0x287bb6=_0x4cd084[_0x25c6('0x1e')]+_0x4cd084[_0x25c6('0x1f')],_0x27c80e;if(_0x287bb6>=_0x581810){_0x287bb6=_0x581810;_0x27c80e=0xc8;}else{_0x27c80e=0xce;}_0x40ac8a['status'](_0x27c80e);return _0x40ac8a['set'](_0x25c6('0x20'),_0x1ce7eb+'-'+_0x287bb6+'/'+_0x581810)[_0x25c6('0x21')](_0x398c15);}return null;};}function patchUpdates(_0x5d8339){return function(_0x49b7fc){try{jsonpatch['apply'](_0x49b7fc,_0x5d8339,!![]);}catch(_0x374798){return BPromise[_0x25c6('0x22')](_0x374798);}return _0x49b7fc[_0x25c6('0x23')]();};}function saveUpdates(_0x8accde,_0x358d56){return function(_0x30c269){if(_0x30c269){return _0x30c269[_0x25c6('0x24')](_0x8accde)['then'](function(_0xc8a885){return _0xc8a885;});}return null;};}function removeEntity(_0x2bc090,_0x52f3f6){return function(_0x5f0997){if(_0x5f0997){return _0x5f0997[_0x25c6('0x25')]()[_0x25c6('0x26')](function(){var _0x46b218=_0x5f0997[_0x25c6('0x27')]({'plain':!![]});var _0x53fd29=_0x25c6('0x28');return db['UserProfileResource'][_0x25c6('0x25')]({'where':{'type':_0x53fd29,'resourceId':_0x46b218['id']}})['then'](function(){return _0x5f0997;});})[_0x25c6('0x26')](function(){_0x2bc090['status'](0xcc)[_0x25c6('0x1c')]();});}};}function handleEntityNotFound(_0x3a5fb4,_0x8e99d){return function(_0x222481){if(!_0x222481){_0x3a5fb4[_0x25c6('0x1a')](0x194);}return _0x222481;};}function handleError(_0x1f307e,_0x2bcd8c){_0x2bcd8c=_0x2bcd8c||0x1f4;return function(_0x44123f){logger[_0x25c6('0x29')](_0x44123f[_0x25c6('0x2a')]);if(_0x44123f['name']){delete _0x44123f[_0x25c6('0x2b')];}_0x1f307e[_0x25c6('0x1b')](_0x2bcd8c)['send'](_0x44123f);};}exports[_0x25c6('0x2c')]=function(_0x3169ac,_0x7b7df8){var _0x112217={},_0x3d3272={},_0x4fa748={'count':0x0,'rows':[]};var _0x3fd842=_[_0x25c6('0x2d')](db[_0x25c6('0x2e')][_0x25c6('0x2f')],function(_0x2085d8){return{'name':_0x2085d8['fieldName'],'type':_0x2085d8[_0x25c6('0x30')][_0x25c6('0x31')]};});_0x3d3272[_0x25c6('0x32')]=_[_0x25c6('0x2d')](_0x3fd842,_0x25c6('0x2b'));_0x3d3272[_0x25c6('0x33')]=_[_0x25c6('0x34')](_0x3169ac[_0x25c6('0x33')]);_0x3d3272[_0x25c6('0x35')]=_[_0x25c6('0x36')](_0x3d3272[_0x25c6('0x32')],_0x3d3272[_0x25c6('0x33')]);_0x112217[_0x25c6('0x37')]=_['intersection'](_0x3d3272[_0x25c6('0x32')],qs[_0x25c6('0x38')](_0x3169ac[_0x25c6('0x33')][_0x25c6('0x38')]));_0x112217['attributes']=_0x112217[_0x25c6('0x37')][_0x25c6('0x39')]?_0x112217['attributes']:_0x3d3272['model'];if(!_0x3169ac[_0x25c6('0x33')][_0x25c6('0x3a')](_0x25c6('0x3b'))){_0x112217['limit']=qs['limit'](_0x3169ac[_0x25c6('0x33')][_0x25c6('0x1f')]);_0x112217[_0x25c6('0x1e')]=qs[_0x25c6('0x1e')](_0x3169ac[_0x25c6('0x33')]['offset']);}_0x112217[_0x25c6('0x3c')]=qs[_0x25c6('0x3d')](_0x3169ac[_0x25c6('0x33')][_0x25c6('0x3d')]);_0x112217[_0x25c6('0x3e')]=qs[_0x25c6('0x35')](_[_0x25c6('0x3f')](_0x3169ac[_0x25c6('0x33')],_0x3d3272['filters']),_0x3fd842);if(_0x3169ac[_0x25c6('0x33')][_0x25c6('0x40')]){_0x112217[_0x25c6('0x3e')]=_[_0x25c6('0x41')](_0x112217[_0x25c6('0x3e')],{'$or':_['map'](_0x3fd842,function(_0x432ff0){if(_0x432ff0[_0x25c6('0x30')]!==_0x25c6('0x42')){var _0x4629c8={};_0x4629c8[_0x432ff0[_0x25c6('0x2b')]]={'$like':'%'+_0x3169ac['query']['filter']+'%'};return _0x4629c8;}})});}_0x112217=_[_0x25c6('0x41')]({},_0x112217,_0x3169ac['options']);var _0x33ffe2={'where':_0x112217[_0x25c6('0x3e')]};return db[_0x25c6('0x2e')][_0x25c6('0x1d')](_0x33ffe2)['then'](function(_0x99c581){_0x4fa748['count']=_0x99c581;if(_0x3169ac[_0x25c6('0x33')][_0x25c6('0x43')]){_0x112217['include']=[{'all':!![]}];}return db[_0x25c6('0x2e')][_0x25c6('0x44')](_0x112217);})['then'](function(_0x4b4fc7){_0x4fa748[_0x25c6('0x45')]=_0x4b4fc7;return _0x4fa748;})[_0x25c6('0x26')](respondWithFilteredResult(_0x7b7df8,_0x112217))[_0x25c6('0x46')](handleError(_0x7b7df8,null));};exports[_0x25c6('0x47')]=function(_0x4c1160,_0x43e31d){var _0x3e2041={'raw':!![],'where':{'id':_0x4c1160[_0x25c6('0x48')]['id']}},_0x2194bf={};_0x2194bf[_0x25c6('0x32')]=_[_0x25c6('0x34')](db[_0x25c6('0x2e')]['rawAttributes']);_0x2194bf[_0x25c6('0x33')]=_[_0x25c6('0x34')](_0x4c1160[_0x25c6('0x33')]);_0x2194bf[_0x25c6('0x35')]=_['intersection'](_0x2194bf[_0x25c6('0x32')],_0x2194bf[_0x25c6('0x33')]);_0x3e2041['attributes']=_['intersection'](_0x2194bf[_0x25c6('0x32')],qs[_0x25c6('0x38')](_0x4c1160['query'][_0x25c6('0x38')]));_0x3e2041[_0x25c6('0x37')]=_0x3e2041[_0x25c6('0x37')][_0x25c6('0x39')]?_0x3e2041[_0x25c6('0x37')]:_0x2194bf['model'];if(_0x4c1160[_0x25c6('0x33')]['includeAll']){_0x3e2041[_0x25c6('0x49')]=[{'all':!![]}];}_0x3e2041=_[_0x25c6('0x41')]({},_0x3e2041,_0x4c1160[_0x25c6('0x4a')]);return db[_0x25c6('0x2e')][_0x25c6('0x4b')](_0x3e2041)['then'](handleEntityNotFound(_0x43e31d,null))['then'](respondWithResult(_0x43e31d,null))[_0x25c6('0x46')](handleError(_0x43e31d,null));};exports[_0x25c6('0x4c')]=function(_0x1e0fde,_0xd4acbd){return db[_0x25c6('0x2e')]['create'](_0x1e0fde[_0x25c6('0x4d')],{})['then'](function(_0xcc3e81){var _0x551829=_0x1e0fde[_0x25c6('0x4e')][_0x25c6('0x27')]({'plain':!![]});if(!_0x551829)throw new Error(_0x25c6('0x4f'));if(_0x551829[_0x25c6('0x50')]===_0x25c6('0x4e')){var _0x1df04f=_0xcc3e81[_0x25c6('0x27')]({'plain':!![]});var _0x336231=_0x25c6('0x28');return db[_0x25c6('0x51')][_0x25c6('0x4b')]({'where':{'name':_0x336231,'userProfileId':_0x551829[_0x25c6('0x52')]},'raw':!![]})[_0x25c6('0x26')](function(_0x1a7172){if(_0x1a7172&&_0x1a7172['autoAssociation']===0x0){return db[_0x25c6('0x53')][_0x25c6('0x4c')]({'name':_0x1df04f[_0x25c6('0x2b')],'resourceId':_0x1df04f['id'],'type':_0x1a7172[_0x25c6('0x2b')],'sectionId':_0x1a7172['id']},{})[_0x25c6('0x26')](function(){return _0xcc3e81;});}else{return _0xcc3e81;}})[_0x25c6('0x46')](function(_0x1b41fc){logger[_0x25c6('0x29')](_0x25c6('0x54'),_0x1b41fc);throw _0x1b41fc;});}return _0xcc3e81;})['then'](respondWithResult(_0xd4acbd,0xc9))['catch'](handleError(_0xd4acbd,null));};exports[_0x25c6('0x24')]=function(_0x416fb6,_0x4b49a4){if(_0x416fb6[_0x25c6('0x4d')]['id']){delete _0x416fb6[_0x25c6('0x4d')]['id'];}return db['SquareOdbc'][_0x25c6('0x4b')]({'where':{'id':_0x416fb6[_0x25c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b49a4,null))[_0x25c6('0x26')](saveUpdates(_0x416fb6[_0x25c6('0x4d')],null))[_0x25c6('0x26')](respondWithResult(_0x4b49a4,null))[_0x25c6('0x46')](handleError(_0x4b49a4,null));};exports[_0x25c6('0x25')]=function(_0x48ef85,_0x419721){return db[_0x25c6('0x2e')]['find']({'where':{'id':_0x48ef85[_0x25c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x419721,null))['then'](removeEntity(_0x419721,null))[_0x25c6('0x46')](handleError(_0x419721,null));};exports[_0x25c6('0x55')]=function(_0x4ffeb8,_0x2937a9,_0x206b26){var _0x87d569;return db[_0x25c6('0x2e')][_0x25c6('0x4b')]({'where':{'id':_0x4ffeb8[_0x25c6('0x48')]['id']},'attributes':['id','dsn']})[_0x25c6('0x26')](handleEntityNotFound(_0x2937a9,null))[_0x25c6('0x26')](function(_0x153fd2){if(_0x153fd2){var _0x483145=require(_0x25c6('0x56'))();_0x483145[_0x25c6('0x57')](_0x153fd2[_0x25c6('0x58')]);_0x483145['closeSync']();return _0x153fd2;}})[_0x25c6('0x26')](respondWithResult(_0x2937a9,null))[_0x25c6('0x46')](handleError(_0x2937a9,null));}; \ No newline at end of file +var _0xc6e9=['end','json','offset','set','Content-Range','reject','save','then','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','fields','attributes','length','limit','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2e9601,_0x44ca90){var _0x40fa31=function(_0x214321){while(--_0x214321){_0x2e9601['push'](_0x2e9601['shift']());}};_0x40fa31(++_0x44ca90);}(_0xc6e9,0xe2));var _0x9c6e=function(_0x3085be,_0x5425c8){_0x3085be=_0x3085be-0x0;var _0x535384=_0xc6e9[_0x3085be];return _0x535384;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9c6e('0x0'));var rimraf=require(_0x9c6e('0x1'));var zipdir=require(_0x9c6e('0x2'));var jsonpatch=require(_0x9c6e('0x3'));var rp=require(_0x9c6e('0x4'));var moment=require(_0x9c6e('0x5'));var BPromise=require(_0x9c6e('0x6'));var Mustache=require(_0x9c6e('0x7'));var util=require(_0x9c6e('0x8'));var path=require(_0x9c6e('0x9'));var sox=require(_0x9c6e('0xa'));var csv=require(_0x9c6e('0xb'));var ejs=require(_0x9c6e('0xc'));var fs=require('fs');var _=require(_0x9c6e('0xd'));var squel=require('squel');var crypto=require(_0x9c6e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9c6e('0xf'));var toCsv=require(_0x9c6e('0xb'));var querystring=require('querystring');var Papa=require(_0x9c6e('0x10'));var Redis=require(_0x9c6e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c6e('0x12'));var hardwareService=require(_0x9c6e('0x13'));var logger=require(_0x9c6e('0x14'))(_0x9c6e('0x15'));var utils=require(_0x9c6e('0x16'));var config=require('../../config/environment');var db=require(_0x9c6e('0x17'))['db'];function respondWithStatusCode(_0x480048,_0x50a96b){_0x50a96b=_0x50a96b||0xcc;return function(_0xa4d63a){if(_0xa4d63a){return _0x480048[_0x9c6e('0x18')](_0x50a96b);}return _0x480048[_0x9c6e('0x19')](_0x50a96b)[_0x9c6e('0x1a')]();};}function respondWithResult(_0x5e3e37,_0x61aa84){_0x61aa84=_0x61aa84||0xc8;return function(_0x1bb064){if(_0x1bb064){return _0x5e3e37[_0x9c6e('0x19')](_0x61aa84)[_0x9c6e('0x1b')](_0x1bb064);}};}function respondWithFilteredResult(_0x36a3fe,_0x25eede){return function(_0x1cf2bf){if(_0x1cf2bf){var _0x5b3f80=_0x1cf2bf['count'],_0x19fc70=_0x25eede[_0x9c6e('0x1c')],_0x359736=_0x25eede[_0x9c6e('0x1c')]+_0x25eede['limit'],_0xc20d35;if(_0x359736>=_0x5b3f80){_0x359736=_0x5b3f80;_0xc20d35=0xc8;}else{_0xc20d35=0xce;}_0x36a3fe[_0x9c6e('0x19')](_0xc20d35);return _0x36a3fe[_0x9c6e('0x1d')](_0x9c6e('0x1e'),_0x19fc70+'-'+_0x359736+'/'+_0x5b3f80)['json'](_0x1cf2bf);}return null;};}function patchUpdates(_0x11a53f){return function(_0x2c078a){try{jsonpatch['apply'](_0x2c078a,_0x11a53f,!![]);}catch(_0x5ca781){return BPromise[_0x9c6e('0x1f')](_0x5ca781);}return _0x2c078a[_0x9c6e('0x20')]();};}function saveUpdates(_0x2bacb3,_0x45a795){return function(_0x1e66e9){if(_0x1e66e9){return _0x1e66e9['update'](_0x2bacb3)['then'](function(_0x4bda34){return _0x4bda34;});}return null;};}function removeEntity(_0x14573a,_0x38166f){return function(_0x4980f2){if(_0x4980f2){return _0x4980f2['destroy']()[_0x9c6e('0x21')](function(){var _0x2df472=_0x4980f2['get']({'plain':!![]});var _0x4cddd4=_0x9c6e('0x22');return db[_0x9c6e('0x23')][_0x9c6e('0x24')]({'where':{'type':_0x4cddd4,'resourceId':_0x2df472['id']}})['then'](function(){return _0x4980f2;});})['then'](function(){_0x14573a[_0x9c6e('0x19')](0xcc)[_0x9c6e('0x1a')]();});}};}function handleEntityNotFound(_0x5ec6fb,_0x5b0996){return function(_0x5e0165){if(!_0x5e0165){_0x5ec6fb['sendStatus'](0x194);}return _0x5e0165;};}function handleError(_0x1e2b6d,_0x2441f8){_0x2441f8=_0x2441f8||0x1f4;return function(_0x18d489){logger[_0x9c6e('0x25')](_0x18d489[_0x9c6e('0x26')]);if(_0x18d489[_0x9c6e('0x27')]){delete _0x18d489[_0x9c6e('0x27')];}_0x1e2b6d[_0x9c6e('0x19')](_0x2441f8)[_0x9c6e('0x28')](_0x18d489);};}exports[_0x9c6e('0x29')]=function(_0x28b120,_0x51420e){var _0x56dfac={},_0x3714a3={},_0x497ee7={'count':0x0,'rows':[]};var _0x1f907a=_[_0x9c6e('0x2a')](db[_0x9c6e('0x2b')]['rawAttributes'],function(_0x976d85){return{'name':_0x976d85[_0x9c6e('0x2c')],'type':_0x976d85[_0x9c6e('0x2d')][_0x9c6e('0x2e')]};});_0x3714a3[_0x9c6e('0x2f')]=_['map'](_0x1f907a,'name');_0x3714a3[_0x9c6e('0x30')]=_[_0x9c6e('0x31')](_0x28b120[_0x9c6e('0x30')]);_0x3714a3[_0x9c6e('0x32')]=_['intersection'](_0x3714a3['model'],_0x3714a3[_0x9c6e('0x30')]);_0x56dfac['attributes']=_['intersection'](_0x3714a3[_0x9c6e('0x2f')],qs[_0x9c6e('0x33')](_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x33')]));_0x56dfac[_0x9c6e('0x34')]=_0x56dfac[_0x9c6e('0x34')][_0x9c6e('0x35')]?_0x56dfac[_0x9c6e('0x34')]:_0x3714a3[_0x9c6e('0x2f')];if(!_0x28b120[_0x9c6e('0x30')]['hasOwnProperty']('nolimit')){_0x56dfac[_0x9c6e('0x36')]=qs[_0x9c6e('0x36')](_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x36')]);_0x56dfac[_0x9c6e('0x1c')]=qs['offset'](_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x1c')]);}_0x56dfac['order']=qs['sort'](_0x28b120[_0x9c6e('0x30')]['sort']);_0x56dfac[_0x9c6e('0x37')]=qs[_0x9c6e('0x32')](_['pick'](_0x28b120[_0x9c6e('0x30')],_0x3714a3[_0x9c6e('0x32')]),_0x1f907a);if(_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x38')]){_0x56dfac[_0x9c6e('0x37')]=_[_0x9c6e('0x39')](_0x56dfac[_0x9c6e('0x37')],{'$or':_[_0x9c6e('0x2a')](_0x1f907a,function(_0xf4306e){if(_0xf4306e[_0x9c6e('0x2d')]!==_0x9c6e('0x3a')){var _0x5919ec={};_0x5919ec[_0xf4306e['name']]={'$like':'%'+_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x38')]+'%'};return _0x5919ec;}})});}_0x56dfac=_[_0x9c6e('0x39')]({},_0x56dfac,_0x28b120[_0x9c6e('0x3b')]);var _0x36f189={'where':_0x56dfac[_0x9c6e('0x37')]};return db[_0x9c6e('0x2b')]['count'](_0x36f189)['then'](function(_0x5e2a36){_0x497ee7[_0x9c6e('0x3c')]=_0x5e2a36;if(_0x28b120[_0x9c6e('0x30')][_0x9c6e('0x3d')]){_0x56dfac[_0x9c6e('0x3e')]=[{'all':!![]}];}return db[_0x9c6e('0x2b')][_0x9c6e('0x3f')](_0x56dfac);})[_0x9c6e('0x21')](function(_0x4059b9){_0x497ee7[_0x9c6e('0x40')]=_0x4059b9;return _0x497ee7;})[_0x9c6e('0x21')](respondWithFilteredResult(_0x51420e,_0x56dfac))[_0x9c6e('0x41')](handleError(_0x51420e,null));};exports['show']=function(_0x5590aa,_0x4438ad){var _0x24cd28={'raw':!![],'where':{'id':_0x5590aa[_0x9c6e('0x42')]['id']}},_0xc677e8={};_0xc677e8[_0x9c6e('0x2f')]=_[_0x9c6e('0x31')](db[_0x9c6e('0x2b')]['rawAttributes']);_0xc677e8[_0x9c6e('0x30')]=_[_0x9c6e('0x31')](_0x5590aa[_0x9c6e('0x30')]);_0xc677e8[_0x9c6e('0x32')]=_[_0x9c6e('0x43')](_0xc677e8[_0x9c6e('0x2f')],_0xc677e8[_0x9c6e('0x30')]);_0x24cd28['attributes']=_[_0x9c6e('0x43')](_0xc677e8[_0x9c6e('0x2f')],qs[_0x9c6e('0x33')](_0x5590aa[_0x9c6e('0x30')][_0x9c6e('0x33')]));_0x24cd28[_0x9c6e('0x34')]=_0x24cd28[_0x9c6e('0x34')][_0x9c6e('0x35')]?_0x24cd28[_0x9c6e('0x34')]:_0xc677e8[_0x9c6e('0x2f')];if(_0x5590aa['query'][_0x9c6e('0x3d')]){_0x24cd28[_0x9c6e('0x3e')]=[{'all':!![]}];}_0x24cd28=_[_0x9c6e('0x39')]({},_0x24cd28,_0x5590aa[_0x9c6e('0x3b')]);return db['SquareOdbc']['find'](_0x24cd28)[_0x9c6e('0x21')](handleEntityNotFound(_0x4438ad,null))[_0x9c6e('0x21')](respondWithResult(_0x4438ad,null))[_0x9c6e('0x41')](handleError(_0x4438ad,null));};exports[_0x9c6e('0x44')]=function(_0x16fa1a,_0x58c522){return db[_0x9c6e('0x2b')][_0x9c6e('0x44')](_0x16fa1a[_0x9c6e('0x45')],{})[_0x9c6e('0x21')](function(_0x248a51){var _0x42c53a=_0x16fa1a[_0x9c6e('0x46')]['get']({'plain':!![]});if(!_0x42c53a)throw new Error(_0x9c6e('0x47'));if(_0x42c53a[_0x9c6e('0x48')]===_0x9c6e('0x46')){var _0x2507f0=_0x248a51[_0x9c6e('0x49')]({'plain':!![]});var _0x161bd7=_0x9c6e('0x22');return db[_0x9c6e('0x4a')][_0x9c6e('0x4b')]({'where':{'name':_0x161bd7,'userProfileId':_0x42c53a[_0x9c6e('0x4c')]},'raw':!![]})[_0x9c6e('0x21')](function(_0x430eeb){if(_0x430eeb&&_0x430eeb[_0x9c6e('0x4d')]===0x0){return db[_0x9c6e('0x23')][_0x9c6e('0x44')]({'name':_0x2507f0[_0x9c6e('0x27')],'resourceId':_0x2507f0['id'],'type':_0x430eeb[_0x9c6e('0x27')],'sectionId':_0x430eeb['id']},{})[_0x9c6e('0x21')](function(){return _0x248a51;});}else{return _0x248a51;}})[_0x9c6e('0x41')](function(_0x5ea7dd){logger['error'](_0x9c6e('0x4e'),_0x5ea7dd);throw _0x5ea7dd;});}return _0x248a51;})[_0x9c6e('0x21')](respondWithResult(_0x58c522,0xc9))[_0x9c6e('0x41')](handleError(_0x58c522,null));};exports[_0x9c6e('0x4f')]=function(_0x23f950,_0x1b608c){if(_0x23f950[_0x9c6e('0x45')]['id']){delete _0x23f950[_0x9c6e('0x45')]['id'];}return db['SquareOdbc'][_0x9c6e('0x4b')]({'where':{'id':_0x23f950[_0x9c6e('0x42')]['id']}})[_0x9c6e('0x21')](handleEntityNotFound(_0x1b608c,null))['then'](saveUpdates(_0x23f950[_0x9c6e('0x45')],null))[_0x9c6e('0x21')](respondWithResult(_0x1b608c,null))[_0x9c6e('0x41')](handleError(_0x1b608c,null));};exports[_0x9c6e('0x24')]=function(_0x2310d5,_0x2bece3){return db[_0x9c6e('0x2b')][_0x9c6e('0x4b')]({'where':{'id':_0x2310d5[_0x9c6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x2bece3,null))[_0x9c6e('0x21')](removeEntity(_0x2bece3,null))[_0x9c6e('0x41')](handleError(_0x2bece3,null));};exports[_0x9c6e('0x50')]=function(_0x5581e,_0x1e5e7a,_0x1f55dc){var _0x5faed9;return db[_0x9c6e('0x2b')]['find']({'where':{'id':_0x5581e[_0x9c6e('0x42')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x1e5e7a,null))[_0x9c6e('0x21')](function(_0x480cc8){if(_0x480cc8){var _0x557693=require(_0x9c6e('0x51'))();_0x557693[_0x9c6e('0x52')](_0x480cc8['dsn']);_0x557693[_0x9c6e('0x53')]();return _0x480cc8;}})[_0x9c6e('0x21')](respondWithResult(_0x1e5e7a,null))[_0x9c6e('0x41')](handleError(_0x1e5e7a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b9f9f98..9b28874 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 _0x3b02=['api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','square_odbc','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b02,0x1d2));var _0x23b0=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x3b02[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x23b0('0x0'));var util=require('util');var logger=require(_0x23b0('0x1'))(_0x23b0('0x2'));var moment=require(_0x23b0('0x3'));var BPromise=require(_0x23b0('0x4'));var rp=require(_0x23b0('0x5'));var fs=require('fs');var path=require(_0x23b0('0x6'));var rimraf=require(_0x23b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x23b0('0x8'));module[_0x23b0('0x9')]=function(_0x511394,_0x2b06ac){return _0x511394[_0x23b0('0xa')]('SquareOdbc',attributes,{'tableName':_0x23b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9904=['rimraf','../../config/environment','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49df34,_0x12d92a){var _0x6e524d=function(_0x43b2fb){while(--_0x43b2fb){_0x49df34['push'](_0x49df34['shift']());}};_0x6e524d(++_0x12d92a);}(_0x9904,0xf5));var _0x4990=function(_0x39b503,_0x42b6dd){_0x39b503=_0x39b503-0x0;var _0x137615=_0x9904[_0x39b503];return _0x137615;};'use strict';var _=require(_0x4990('0x0'));var util=require(_0x4990('0x1'));var logger=require(_0x4990('0x2'))(_0x4990('0x3'));var moment=require('moment');var BPromise=require(_0x4990('0x4'));var rp=require(_0x4990('0x5'));var fs=require('fs');var path=require(_0x4990('0x6'));var rimraf=require(_0x4990('0x7'));var config=require(_0x4990('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x4990('0x9')]=function(_0x43a691,_0x3ecf73){return _0x43a691['define'](_0x4990('0xa'),attributes,{'tableName':_0x4990('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 6863c3e..7351ac7 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(_0x34a8b0,_0x17a597){var _0x1e318a=function(_0x179d8a){while(--_0x179d8a){_0x34a8b0['push'](_0x34a8b0['shift']());}};_0x1e318a(++_0x17a597);}(_0x008c,0x188));var _0xc008=function(_0x58d7d2,_0x1cbd13){_0x58d7d2=_0x58d7d2-0x0;var _0x6ad2be=_0x008c[_0x58d7d2];return _0x6ad2be;};'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(_0x3c1d4a,_0x64ed3b){var _0x3b1c3c=function(_0x3a4767){while(--_0x3a4767){_0x3c1d4a['push'](_0x3c1d4a['shift']());}};_0x3b1c3c(++_0x64ed3b);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'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 2dd8769..40b9ac6 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2547=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','post','/:id/users','addUsers','put','delete','destroy','removeUsers','exports','util'];(function(_0x22781f,_0x12bb17){var _0x29adaf=function(_0x241c2c){while(--_0x241c2c){_0x22781f['push'](_0x22781f['shift']());}};_0x29adaf(++_0x12bb17);}(_0x2547,0x1cd));var _0x7254=function(_0x21afe8,_0x593137){_0x21afe8=_0x21afe8-0x0;var _0x433c24=_0x2547[_0x21afe8];return _0x433c24;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./squareProject.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id/users',auth[_0x7254('0x9')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['update']);router[_0x7254('0x11')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0x12')]);router[_0x7254('0x11')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0x13')]);module[_0x7254('0x14')]=router; \ No newline at end of file +var _0x878f=['../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','create','post','addUsers','update','delete','destroy','/:id/users','removeUsers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0x878f,0x173));var _0xf878=function(_0x14fd69,_0x183932){_0x14fd69=_0x14fd69-0x0;var _0x3af534=_0x878f[_0x14fd69];return _0x3af534;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['show']);router['get']('/:id/users',auth[_0xf878('0xa')](),controller['getUsers']);router['post']('/',auth[_0xf878('0xa')](),controller[_0xf878('0xc')]);router[_0xf878('0xd')]('/:id/users',auth[_0xf878('0xa')](),controller[_0xf878('0xe')]);router['put'](_0xf878('0xb'),auth['isAuthenticated'](),controller[_0xf878('0xf')]);router[_0xf878('0x10')](_0xf878('0xb'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0x10')](_0xf878('0x12'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);module[_0xf878('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 7f0c5c0..2632afd 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 _0x6bf6=['STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports'];(function(_0x3332c5,_0x556157){var _0x4cb745=function(_0xcf9a67){while(--_0xcf9a67){_0x3332c5['push'](_0x3332c5['shift']());}};_0x4cb745(++_0x556157);}(_0x6bf6,0x1ab));var _0x66bf=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x6bf6[_0x5cbd7b];return _0x3fdfb8;};'use strict';var Sequelize=require(_0x66bf('0x0'));module[_0x66bf('0x1')]={'name':{'type':Sequelize[_0x66bf('0x2')],'unique':_0x66bf('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x66bf('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x66bf('0x5')),'get':function(){if(this[_0x66bf('0x6')](_0x66bf('0x7'))){return this[_0x66bf('0x6')]('preproduction')[_0x66bf('0x8')](_0x66bf('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x66bf('0x5')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue'](_0x66bf('0xa'))['toString'](_0x66bf('0x9'));}}}}; \ No newline at end of file +var _0x7aa1=['production','toString','utf8','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x3119b8,_0x5d21b8){var _0x1c5fc8=function(_0x476020){while(--_0x476020){_0x3119b8['push'](_0x3119b8['shift']());}};_0x1c5fc8(++_0x5d21b8);}(_0x7aa1,0xf5));var _0x17aa=function(_0x3d35a8,_0x3a1b6b){_0x3d35a8=_0x3d35a8-0x0;var _0x319594=_0x7aa1[_0x3d35a8];return _0x319594;};'use strict';var Sequelize=require(_0x17aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x17aa('0x1')],'unique':_0x17aa('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x17aa('0x1')]},'notes':{'type':Sequelize[_0x17aa('0x3')]},'preproduction':{'type':Sequelize[_0x17aa('0x4')](_0x17aa('0x5')),'get':function(){if(this[_0x17aa('0x6')](_0x17aa('0x7'))){return this[_0x17aa('0x6')](_0x17aa('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x17aa('0x4')](_0x17aa('0x5')),'get':function(){if(this['getDataValue'](_0x17aa('0x8'))){return this[_0x17aa('0x6')]('production')[_0x17aa('0x9')](_0x17aa('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 73964ea..9e3d86d 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 _0x867f=['set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','error','name','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','count','offset'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x867f,0x155));var _0xf867=function(_0xee741b,_0x10cf16){_0xee741b=_0xee741b-0x0;var _0x9ce0a2=_0x867f[_0xee741b];return _0x9ce0a2;};'use strict';var pdf=require(_0xf867('0x0'));var emlformat=require(_0xf867('0x1'));var rimraf=require(_0xf867('0x2'));var zipdir=require(_0xf867('0x3'));var jsonpatch=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var moment=require(_0xf867('0x6'));var BPromise=require(_0xf867('0x7'));var Mustache=require(_0xf867('0x8'));var util=require(_0xf867('0x9'));var path=require('path');var sox=require(_0xf867('0xa'));var csv=require('to-csv');var ejs=require(_0xf867('0xb'));var fs=require('fs');var _=require(_0xf867('0xc'));var squel=require(_0xf867('0xd'));var crypto=require(_0xf867('0xe'));var jsforce=require(_0xf867('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf867('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf867('0x11'));var authService=require(_0xf867('0x12'));var qs=require(_0xf867('0x13'));var as=require(_0xf867('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf867('0x15'))(_0xf867('0x16'));var utils=require(_0xf867('0x17'));var config=require('../../config/environment');var db=require(_0xf867('0x18'))['db'];config['redis']=_['defaults'](config[_0xf867('0x19')],{'host':_0xf867('0x1a'),'port':0x18eb});var socket=require(_0xf867('0x1b'))(new Redis(config[_0xf867('0x19')]));require(_0xf867('0x1c'))['register'](socket);function respondWithStatusCode(_0x2a3a47,_0x1976fc){_0x1976fc=_0x1976fc||0xcc;return function(_0x376e3e){if(_0x376e3e){return _0x2a3a47[_0xf867('0x1d')](_0x1976fc);}return _0x2a3a47['status'](_0x1976fc)[_0xf867('0x1e')]();};}function respondWithResult(_0x293ffa,_0x45424f){_0x45424f=_0x45424f||0xc8;return function(_0x26db1e){if(_0x26db1e){return _0x293ffa[_0xf867('0x1f')](_0x45424f)[_0xf867('0x20')](_0x26db1e);}};}function respondWithFilteredResult(_0x18d59c,_0x5bef19){return function(_0x4549cb){if(_0x4549cb){var _0x1d28b4=_0x4549cb[_0xf867('0x21')],_0x3b343c=_0x5bef19[_0xf867('0x22')],_0x42575c=_0x5bef19[_0xf867('0x22')]+_0x5bef19['limit'],_0x3c4925;if(_0x42575c>=_0x1d28b4){_0x42575c=_0x1d28b4;_0x3c4925=0xc8;}else{_0x3c4925=0xce;}_0x18d59c[_0xf867('0x1f')](_0x3c4925);return _0x18d59c[_0xf867('0x23')](_0xf867('0x24'),_0x3b343c+'-'+_0x42575c+'/'+_0x1d28b4)[_0xf867('0x20')](_0x4549cb);}return null;};}function patchUpdates(_0x4f0b1a){return function(_0x3b471d){try{jsonpatch[_0xf867('0x25')](_0x3b471d,_0x4f0b1a,!![]);}catch(_0x4b06f7){return BPromise['reject'](_0x4b06f7);}return _0x3b471d[_0xf867('0x26')]();};}function saveUpdates(_0x40a779,_0x298bda){return function(_0x252b22){if(_0x252b22){return _0x252b22[_0xf867('0x27')](_0x40a779)[_0xf867('0x28')](function(_0x2d3fec){return _0x2d3fec;});}return null;};}function removeEntity(_0x10b259,_0x1a9f08){return function(_0x400cac){if(_0x400cac){return _0x400cac['destroy']()[_0xf867('0x28')](function(){var _0x13f899=_0x400cac[_0xf867('0x29')]({'plain':!![]});var _0x5f28e6='SquareProjects';return db[_0xf867('0x2a')][_0xf867('0x2b')]({'where':{'type':_0x5f28e6,'resourceId':_0x13f899['id']}})[_0xf867('0x28')](function(){return _0x400cac;});})[_0xf867('0x28')](function(){_0x10b259['status'](0xcc)[_0xf867('0x1e')]();});}};}function handleEntityNotFound(_0x49eab1,_0x3fb8a1){return function(_0x39aa30){if(!_0x39aa30){_0x49eab1[_0xf867('0x1d')](0x194);}return _0x39aa30;};}function handleError(_0x8649ac,_0x5d7ce9){_0x5d7ce9=_0x5d7ce9||0x1f4;return function(_0x221feb){logger[_0xf867('0x2c')](_0x221feb['stack']);if(_0x221feb[_0xf867('0x2d')]){delete _0x221feb[_0xf867('0x2d')];}_0x8649ac[_0xf867('0x1f')](_0x5d7ce9)['send'](_0x221feb);};}exports[_0xf867('0x2e')]=function(_0x2467bd,_0x42b0d9){var _0xd3fcce={},_0x3aaa4a={},_0xb46a2d={'count':0x0,'rows':[]};var _0x221124=_[_0xf867('0x2f')](db[_0xf867('0x30')][_0xf867('0x31')],function(_0x43607c){return{'name':_0x43607c['fieldName'],'type':_0x43607c['type'][_0xf867('0x32')]};});_0x3aaa4a[_0xf867('0x33')]=_[_0xf867('0x2f')](_0x221124,'name');_0x3aaa4a[_0xf867('0x34')]=_[_0xf867('0x35')](_0x2467bd[_0xf867('0x34')]);_0x3aaa4a[_0xf867('0x36')]=_['intersection'](_0x3aaa4a[_0xf867('0x33')],_0x3aaa4a[_0xf867('0x34')]);_0xd3fcce[_0xf867('0x37')]=_[_0xf867('0x38')](_0x3aaa4a[_0xf867('0x33')],qs['fields'](_0x2467bd['query'][_0xf867('0x39')]));_0xd3fcce['attributes']=_0xd3fcce[_0xf867('0x37')][_0xf867('0x3a')]?_0xd3fcce[_0xf867('0x37')]:_0x3aaa4a[_0xf867('0x33')];if(!_0x2467bd[_0xf867('0x34')][_0xf867('0x3b')](_0xf867('0x3c'))){_0xd3fcce['limit']=qs[_0xf867('0x3d')](_0x2467bd[_0xf867('0x34')][_0xf867('0x3d')]);_0xd3fcce['offset']=qs[_0xf867('0x22')](_0x2467bd[_0xf867('0x34')][_0xf867('0x22')]);}_0xd3fcce[_0xf867('0x3e')]=qs[_0xf867('0x3f')](_0x2467bd[_0xf867('0x34')][_0xf867('0x3f')]);_0xd3fcce[_0xf867('0x40')]=qs['filters'](_[_0xf867('0x41')](_0x2467bd[_0xf867('0x34')],_0x3aaa4a['filters']),_0x221124);if(_0x2467bd['query'][_0xf867('0x42')]){_0xd3fcce['where']=_['merge'](_0xd3fcce['where'],{'$or':_['map'](_0x221124,function(_0x4a6f16){if(_0x4a6f16[_0xf867('0x43')]!==_0xf867('0x44')){var _0x3686c0={};_0x3686c0[_0x4a6f16[_0xf867('0x2d')]]={'$like':'%'+_0x2467bd[_0xf867('0x34')]['filter']+'%'};return _0x3686c0;}})});}_0xd3fcce=_[_0xf867('0x45')]({},_0xd3fcce,_0x2467bd[_0xf867('0x46')]);var _0x542830={'where':_0xd3fcce[_0xf867('0x40')]};return db['SquareProject'][_0xf867('0x21')](_0x542830)[_0xf867('0x28')](function(_0x29b09c){_0xb46a2d[_0xf867('0x21')]=_0x29b09c;if(_0x2467bd[_0xf867('0x34')][_0xf867('0x47')]){_0xd3fcce[_0xf867('0x48')]=[{'all':!![]}];}return db[_0xf867('0x30')]['findAll'](_0xd3fcce);})[_0xf867('0x28')](function(_0x596cd8){_0xb46a2d[_0xf867('0x49')]=_0x596cd8;return _0xb46a2d;})[_0xf867('0x28')](respondWithFilteredResult(_0x42b0d9,_0xd3fcce))['catch'](handleError(_0x42b0d9,null));};exports[_0xf867('0x4a')]=function(_0x530211,_0x3698fd){var _0x2d6d2d={'raw':![],'where':{'id':_0x530211[_0xf867('0x4b')]['id']}},_0x24d2cb={};_0x24d2cb[_0xf867('0x33')]=_[_0xf867('0x35')](db['SquareProject'][_0xf867('0x31')]);_0x24d2cb[_0xf867('0x34')]=_['keys'](_0x530211[_0xf867('0x34')]);_0x24d2cb['filters']=_[_0xf867('0x38')](_0x24d2cb['model'],_0x24d2cb[_0xf867('0x34')]);_0x2d6d2d[_0xf867('0x37')]=_[_0xf867('0x38')](_0x24d2cb[_0xf867('0x33')],qs[_0xf867('0x39')](_0x530211[_0xf867('0x34')][_0xf867('0x39')]));_0x2d6d2d['attributes']=_0x2d6d2d[_0xf867('0x37')][_0xf867('0x3a')]?_0x2d6d2d[_0xf867('0x37')]:_0x24d2cb['model'];if(_0x530211[_0xf867('0x34')][_0xf867('0x47')]){_0x2d6d2d[_0xf867('0x48')]=[{'all':!![]}];}_0x2d6d2d=_[_0xf867('0x45')]({},_0x2d6d2d,_0x530211['options']);return db[_0xf867('0x30')]['find'](_0x2d6d2d)[_0xf867('0x28')](handleEntityNotFound(_0x3698fd,null))[_0xf867('0x28')](respondWithResult(_0x3698fd,null))[_0xf867('0x4c')](handleError(_0x3698fd,null));};exports[_0xf867('0x4d')]=function(_0x45d76a,_0x2e1583){return db[_0xf867('0x30')][_0xf867('0x4d')](_0x45d76a['body'],{})[_0xf867('0x28')](function(_0x479a0a){var _0x4362c0=_0x45d76a['user']['get']({'plain':!![]});if(!_0x4362c0)throw new Error(_0xf867('0x4e'));if(_0x4362c0[_0xf867('0x4f')]==='user'){var _0x10f50f=_0x479a0a[_0xf867('0x29')]({'plain':!![]});var _0x1a73b1=_0xf867('0x50');return db['UserProfileSection'][_0xf867('0x51')]({'where':{'name':_0x1a73b1,'userProfileId':_0x4362c0[_0xf867('0x52')]},'raw':!![]})['then'](function(_0x42c488){if(_0x42c488&&_0x42c488[_0xf867('0x53')]===0x0){return db[_0xf867('0x2a')][_0xf867('0x4d')]({'name':_0x10f50f['name'],'resourceId':_0x10f50f['id'],'type':_0x42c488[_0xf867('0x2d')],'sectionId':_0x42c488['id']},{})[_0xf867('0x28')](function(){return _0x479a0a;});}else{return _0x479a0a;}})[_0xf867('0x4c')](function(_0x10b054){logger['error'](_0xf867('0x54'),_0x10b054);throw _0x10b054;});}return _0x479a0a;})[_0xf867('0x28')](respondWithResult(_0x2e1583,0xc9))[_0xf867('0x4c')](handleError(_0x2e1583,null));};exports[_0xf867('0x27')]=function(_0x5bc5ec,_0x3c5a9e){if(_0x5bc5ec['body']['id']){delete _0x5bc5ec[_0xf867('0x55')]['id'];}return db['SquareProject'][_0xf867('0x51')]({'where':{'id':_0x5bc5ec[_0xf867('0x4b')]['id']}})[_0xf867('0x28')](handleEntityNotFound(_0x3c5a9e,null))[_0xf867('0x28')](saveUpdates(_0x5bc5ec[_0xf867('0x55')],null))[_0xf867('0x28')](respondWithResult(_0x3c5a9e,null))[_0xf867('0x4c')](handleError(_0x3c5a9e,null));};exports[_0xf867('0x2b')]=function(_0x2b703b,_0x16dc8c){return db[_0xf867('0x30')][_0xf867('0x51')]({'where':{'id':_0x2b703b[_0xf867('0x4b')]['id']}})[_0xf867('0x28')](handleEntityNotFound(_0x16dc8c,null))[_0xf867('0x28')](removeEntity(_0x16dc8c,null))[_0xf867('0x4c')](handleError(_0x16dc8c,null));};exports[_0xf867('0x56')]=function(_0x1ef350,_0x3e8c35,_0xc68d4c){return db[_0xf867('0x30')][_0xf867('0x51')]({'where':{'id':_0x1ef350['params']['id']}})['then'](handleEntityNotFound(_0x3e8c35,null))[_0xf867('0x28')](function(_0x4b74ee){if(_0x4b74ee){return _0x4b74ee[_0xf867('0x56')](_0x1ef350[_0xf867('0x55')][_0xf867('0x57')],_[_0xf867('0x58')](_0x1ef350[_0xf867('0x55')],[_0xf867('0x57'),'id'])||{});}})['then'](respondWithResult(_0x3e8c35,null))[_0xf867('0x4c')](handleError(_0x3e8c35,null));};exports['removeUsers']=function(_0x535333,_0x3a0221,_0x95dc7f){return db[_0xf867('0x30')][_0xf867('0x51')]({'where':{'id':_0x535333['params']['id']}})['then'](handleEntityNotFound(_0x3a0221,null))[_0xf867('0x28')](function(_0x165d97){if(_0x165d97){return _0x165d97[_0xf867('0x59')](_0x535333[_0xf867('0x34')]['ids'])['then'](function(){if(_['isArray'](_0x535333[_0xf867('0x34')][_0xf867('0x57')])){for(var _0x4aa12b=0x0;_0x4aa12b<_0x535333['query']['ids']['length'];_0x4aa12b+=0x1){socket[_0xf867('0x5a')](_0xf867('0x5b'),{'UserId':Number(_0x535333[_0xf867('0x34')][_0xf867('0x57')][_0x4aa12b]),'SquareProjectId':Number(_0x535333[_0xf867('0x4b')]['id'])});}}else{socket['emit'](_0xf867('0x5b'),{'UserId':Number(_0x535333[_0xf867('0x34')][_0xf867('0x57')]),'SquareProjectId':Number(_0x535333['params']['id'])});}});}})[_0xf867('0x28')](respondWithStatusCode(_0x3a0221,null))[_0xf867('0x4c')](handleError(_0x3a0221,null));};exports[_0xf867('0x5c')]=function(_0x98c09d,_0x470751,_0x22dd76){var _0xf985ac={};var _0x1bde93={};var _0x382408;var _0x4888c8;return db[_0xf867('0x30')]['findOne']({'where':{'id':_0x98c09d['params']['id']}})[_0xf867('0x28')](handleEntityNotFound(_0x470751,null))['then'](function(_0x3e52ee){if(_0x3e52ee){_0x382408=_0x3e52ee;_0x1bde93[_0xf867('0x33')]=_[_0xf867('0x35')](db[_0xf867('0x5d')][_0xf867('0x31')]);_0x1bde93[_0xf867('0x34')]=_['keys'](_0x98c09d['query']);_0x1bde93['filters']=_[_0xf867('0x38')](_0x1bde93['model'],_0x1bde93[_0xf867('0x34')]);_0xf985ac[_0xf867('0x37')]=_[_0xf867('0x38')](_0x1bde93[_0xf867('0x33')],qs[_0xf867('0x39')](_0x98c09d[_0xf867('0x34')][_0xf867('0x39')]));_0xf985ac[_0xf867('0x37')]=_0xf985ac[_0xf867('0x37')][_0xf867('0x3a')]?_0xf985ac['attributes']:_0x1bde93[_0xf867('0x33')];_0xf985ac[_0xf867('0x3e')]=qs[_0xf867('0x3f')](_0x98c09d[_0xf867('0x34')]['sort']);_0xf985ac['where']=qs[_0xf867('0x36')](_[_0xf867('0x41')](_0x98c09d[_0xf867('0x34')],_0x1bde93[_0xf867('0x36')]));if(_0x98c09d[_0xf867('0x34')][_0xf867('0x42')]){_0xf985ac[_0xf867('0x40')]=_['merge'](_0xf985ac['where'],{'$or':_['map'](_0xf985ac['attributes'],function(_0xe15a53){var _0x17ca3b={};_0x17ca3b[_0xe15a53]={'$like':'%'+_0x98c09d[_0xf867('0x34')][_0xf867('0x42')]+'%'};return _0x17ca3b;})});}_0xf985ac=_['merge']({},_0xf985ac,_0x98c09d[_0xf867('0x46')]);return _0x382408[_0xf867('0x5c')](_0xf985ac);}})[_0xf867('0x28')](function(_0x4ec3d4){if(_0x4ec3d4){_0x4888c8=_0x4ec3d4['length'];if(!_0x98c09d[_0xf867('0x34')][_0xf867('0x3b')]('nolimit')){_0xf985ac[_0xf867('0x3d')]=qs[_0xf867('0x3d')](_0x98c09d[_0xf867('0x34')][_0xf867('0x3d')]);_0xf985ac['offset']=qs[_0xf867('0x22')](_0x98c09d[_0xf867('0x34')][_0xf867('0x22')]);}return _0x382408[_0xf867('0x5c')](_0xf985ac);}})[_0xf867('0x28')](function(_0x2f6679){if(_0x2f6679){return _0x2f6679?{'count':_0x4888c8,'rows':_0x2f6679}:null;}})[_0xf867('0x28')](respondWithResult(_0x470751,null))['catch'](handleError(_0x470751,null));}; \ No newline at end of file +var _0xdfcc=['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','./squareProject.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','SquareProjects','error','name','index','map','SquareProject','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','then','findAll','show','params','keys','include','catch','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x3e3eaa,_0x33c86b){var _0x8e8d78=function(_0x3f6526){while(--_0x3f6526){_0x3e3eaa['push'](_0x3e3eaa['shift']());}};_0x8e8d78(++_0x33c86b);}(_0xdfcc,0x185));var _0xcdfc=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xdfcc[_0x5e1b91];return _0x59b52f;};'use strict';var pdf=require(_0xcdfc('0x0'));var emlformat=require(_0xcdfc('0x1'));var rimraf=require(_0xcdfc('0x2'));var zipdir=require(_0xcdfc('0x3'));var jsonpatch=require(_0xcdfc('0x4'));var rp=require(_0xcdfc('0x5'));var moment=require(_0xcdfc('0x6'));var BPromise=require(_0xcdfc('0x7'));var Mustache=require('mustache');var util=require(_0xcdfc('0x8'));var path=require(_0xcdfc('0x9'));var sox=require(_0xcdfc('0xa'));var csv=require(_0xcdfc('0xb'));var ejs=require(_0xcdfc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcdfc('0xd'));var crypto=require(_0xcdfc('0xe'));var jsforce=require(_0xcdfc('0xf'));var deskjs=require(_0xcdfc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcdfc('0x11'));var Papa=require(_0xcdfc('0x12'));var Redis=require(_0xcdfc('0x13'));var authService=require(_0xcdfc('0x14'));var qs=require(_0xcdfc('0x15'));var as=require(_0xcdfc('0x16'));var hardwareService=require(_0xcdfc('0x17'));var logger=require(_0xcdfc('0x18'))(_0xcdfc('0x19'));var utils=require(_0xcdfc('0x1a'));var config=require(_0xcdfc('0x1b'));var db=require(_0xcdfc('0x1c'))['db'];config[_0xcdfc('0x1d')]=_[_0xcdfc('0x1e')](config[_0xcdfc('0x1d')],{'host':_0xcdfc('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdfc('0x1d')]));require(_0xcdfc('0x20'))[_0xcdfc('0x21')](socket);function respondWithStatusCode(_0x28c4da,_0x37260f){_0x37260f=_0x37260f||0xcc;return function(_0x5c001a){if(_0x5c001a){return _0x28c4da[_0xcdfc('0x22')](_0x37260f);}return _0x28c4da[_0xcdfc('0x23')](_0x37260f)[_0xcdfc('0x24')]();};}function respondWithResult(_0x5f0ccf,_0x3d173a){_0x3d173a=_0x3d173a||0xc8;return function(_0x4b46c8){if(_0x4b46c8){return _0x5f0ccf[_0xcdfc('0x23')](_0x3d173a)[_0xcdfc('0x25')](_0x4b46c8);}};}function respondWithFilteredResult(_0x3555e1,_0x2881ef){return function(_0x2094f8){if(_0x2094f8){var _0x392ec3=_0x2094f8[_0xcdfc('0x26')],_0x2883ea=_0x2881ef[_0xcdfc('0x27')],_0x5ec5ed=_0x2881ef[_0xcdfc('0x27')]+_0x2881ef[_0xcdfc('0x28')],_0x309095;if(_0x5ec5ed>=_0x392ec3){_0x5ec5ed=_0x392ec3;_0x309095=0xc8;}else{_0x309095=0xce;}_0x3555e1['status'](_0x309095);return _0x3555e1[_0xcdfc('0x29')](_0xcdfc('0x2a'),_0x2883ea+'-'+_0x5ec5ed+'/'+_0x392ec3)[_0xcdfc('0x25')](_0x2094f8);}return null;};}function patchUpdates(_0x230828){return function(_0x5182cd){try{jsonpatch[_0xcdfc('0x2b')](_0x5182cd,_0x230828,!![]);}catch(_0x27778f){return BPromise[_0xcdfc('0x2c')](_0x27778f);}return _0x5182cd[_0xcdfc('0x2d')]();};}function saveUpdates(_0x20d41d,_0x1e033d){return function(_0x4b8783){if(_0x4b8783){return _0x4b8783[_0xcdfc('0x2e')](_0x20d41d)['then'](function(_0x2c20dc){return _0x2c20dc;});}return null;};}function removeEntity(_0xf5d934,_0x51afc4){return function(_0x574b61){if(_0x574b61){return _0x574b61[_0xcdfc('0x2f')]()['then'](function(){var _0x21028f=_0x574b61[_0xcdfc('0x30')]({'plain':!![]});var _0x29e726=_0xcdfc('0x31');return db['UserProfileResource'][_0xcdfc('0x2f')]({'where':{'type':_0x29e726,'resourceId':_0x21028f['id']}})['then'](function(){return _0x574b61;});})['then'](function(){_0xf5d934[_0xcdfc('0x23')](0xcc)[_0xcdfc('0x24')]();});}};}function handleEntityNotFound(_0x13a1f8,_0x252dfe){return function(_0x4f643a){if(!_0x4f643a){_0x13a1f8['sendStatus'](0x194);}return _0x4f643a;};}function handleError(_0x468dd7,_0x8d63b3){_0x8d63b3=_0x8d63b3||0x1f4;return function(_0x3b80b1){logger[_0xcdfc('0x32')](_0x3b80b1['stack']);if(_0x3b80b1[_0xcdfc('0x33')]){delete _0x3b80b1['name'];}_0x468dd7[_0xcdfc('0x23')](_0x8d63b3)['send'](_0x3b80b1);};}exports[_0xcdfc('0x34')]=function(_0x154c7a,_0x44468a){var _0x3be6bb={},_0x37d9cd={},_0x48c0a9={'count':0x0,'rows':[]};var _0x56d237=_[_0xcdfc('0x35')](db[_0xcdfc('0x36')][_0xcdfc('0x37')],function(_0x1ee156){return{'name':_0x1ee156[_0xcdfc('0x38')],'type':_0x1ee156['type'][_0xcdfc('0x39')]};});_0x37d9cd[_0xcdfc('0x3a')]=_[_0xcdfc('0x35')](_0x56d237,_0xcdfc('0x33'));_0x37d9cd[_0xcdfc('0x3b')]=_['keys'](_0x154c7a[_0xcdfc('0x3b')]);_0x37d9cd['filters']=_['intersection'](_0x37d9cd[_0xcdfc('0x3a')],_0x37d9cd[_0xcdfc('0x3b')]);_0x3be6bb[_0xcdfc('0x3c')]=_[_0xcdfc('0x3d')](_0x37d9cd[_0xcdfc('0x3a')],qs[_0xcdfc('0x3e')](_0x154c7a[_0xcdfc('0x3b')]['fields']));_0x3be6bb[_0xcdfc('0x3c')]=_0x3be6bb[_0xcdfc('0x3c')][_0xcdfc('0x3f')]?_0x3be6bb[_0xcdfc('0x3c')]:_0x37d9cd[_0xcdfc('0x3a')];if(!_0x154c7a[_0xcdfc('0x3b')]['hasOwnProperty']('nolimit')){_0x3be6bb[_0xcdfc('0x28')]=qs['limit'](_0x154c7a['query'][_0xcdfc('0x28')]);_0x3be6bb[_0xcdfc('0x27')]=qs[_0xcdfc('0x27')](_0x154c7a['query'][_0xcdfc('0x27')]);}_0x3be6bb[_0xcdfc('0x40')]=qs[_0xcdfc('0x41')](_0x154c7a[_0xcdfc('0x3b')][_0xcdfc('0x41')]);_0x3be6bb[_0xcdfc('0x42')]=qs[_0xcdfc('0x43')](_[_0xcdfc('0x44')](_0x154c7a[_0xcdfc('0x3b')],_0x37d9cd[_0xcdfc('0x43')]),_0x56d237);if(_0x154c7a[_0xcdfc('0x3b')]['filter']){_0x3be6bb[_0xcdfc('0x42')]=_[_0xcdfc('0x45')](_0x3be6bb[_0xcdfc('0x42')],{'$or':_[_0xcdfc('0x35')](_0x56d237,function(_0x37669c){if(_0x37669c[_0xcdfc('0x46')]!==_0xcdfc('0x47')){var _0x1e7b72={};_0x1e7b72[_0x37669c[_0xcdfc('0x33')]]={'$like':'%'+_0x154c7a['query'][_0xcdfc('0x48')]+'%'};return _0x1e7b72;}})});}_0x3be6bb=_[_0xcdfc('0x45')]({},_0x3be6bb,_0x154c7a[_0xcdfc('0x49')]);var _0x17f7b2={'where':_0x3be6bb[_0xcdfc('0x42')]};return db[_0xcdfc('0x36')]['count'](_0x17f7b2)[_0xcdfc('0x4a')](function(_0x438252){_0x48c0a9['count']=_0x438252;if(_0x154c7a[_0xcdfc('0x3b')]['includeAll']){_0x3be6bb['include']=[{'all':!![]}];}return db[_0xcdfc('0x36')][_0xcdfc('0x4b')](_0x3be6bb);})['then'](function(_0x58f84c){_0x48c0a9['rows']=_0x58f84c;return _0x48c0a9;})[_0xcdfc('0x4a')](respondWithFilteredResult(_0x44468a,_0x3be6bb))['catch'](handleError(_0x44468a,null));};exports[_0xcdfc('0x4c')]=function(_0x211c27,_0x580dc1){var _0x2f3a73={'raw':![],'where':{'id':_0x211c27[_0xcdfc('0x4d')]['id']}},_0x1f8773={};_0x1f8773[_0xcdfc('0x3a')]=_[_0xcdfc('0x4e')](db[_0xcdfc('0x36')][_0xcdfc('0x37')]);_0x1f8773['query']=_[_0xcdfc('0x4e')](_0x211c27[_0xcdfc('0x3b')]);_0x1f8773[_0xcdfc('0x43')]=_[_0xcdfc('0x3d')](_0x1f8773[_0xcdfc('0x3a')],_0x1f8773[_0xcdfc('0x3b')]);_0x2f3a73['attributes']=_[_0xcdfc('0x3d')](_0x1f8773[_0xcdfc('0x3a')],qs[_0xcdfc('0x3e')](_0x211c27[_0xcdfc('0x3b')]['fields']));_0x2f3a73['attributes']=_0x2f3a73[_0xcdfc('0x3c')][_0xcdfc('0x3f')]?_0x2f3a73['attributes']:_0x1f8773[_0xcdfc('0x3a')];if(_0x211c27[_0xcdfc('0x3b')]['includeAll']){_0x2f3a73[_0xcdfc('0x4f')]=[{'all':!![]}];}_0x2f3a73=_['merge']({},_0x2f3a73,_0x211c27['options']);return db['SquareProject']['find'](_0x2f3a73)['then'](handleEntityNotFound(_0x580dc1,null))[_0xcdfc('0x4a')](respondWithResult(_0x580dc1,null))[_0xcdfc('0x50')](handleError(_0x580dc1,null));};exports[_0xcdfc('0x51')]=function(_0x2b4cee,_0x307e60){return db[_0xcdfc('0x36')]['create'](_0x2b4cee[_0xcdfc('0x52')],{})['then'](function(_0x157aa7){var _0x51ccb5=_0x2b4cee[_0xcdfc('0x53')]['get']({'plain':!![]});if(!_0x51ccb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51ccb5[_0xcdfc('0x54')]===_0xcdfc('0x53')){var _0x4cb250=_0x157aa7[_0xcdfc('0x30')]({'plain':!![]});var _0x3df64c=_0xcdfc('0x31');return db[_0xcdfc('0x55')][_0xcdfc('0x56')]({'where':{'name':_0x3df64c,'userProfileId':_0x51ccb5[_0xcdfc('0x57')]},'raw':!![]})[_0xcdfc('0x4a')](function(_0x44a2fc){if(_0x44a2fc&&_0x44a2fc['autoAssociation']===0x0){return db[_0xcdfc('0x58')]['create']({'name':_0x4cb250[_0xcdfc('0x33')],'resourceId':_0x4cb250['id'],'type':_0x44a2fc[_0xcdfc('0x33')],'sectionId':_0x44a2fc['id']},{})[_0xcdfc('0x4a')](function(){return _0x157aa7;});}else{return _0x157aa7;}})[_0xcdfc('0x50')](function(_0x4250e6){logger[_0xcdfc('0x32')](_0xcdfc('0x59'),_0x4250e6);throw _0x4250e6;});}return _0x157aa7;})[_0xcdfc('0x4a')](respondWithResult(_0x307e60,0xc9))[_0xcdfc('0x50')](handleError(_0x307e60,null));};exports[_0xcdfc('0x2e')]=function(_0x5e7e9d,_0x27fdac){if(_0x5e7e9d[_0xcdfc('0x52')]['id']){delete _0x5e7e9d[_0xcdfc('0x52')]['id'];}return db[_0xcdfc('0x36')]['find']({'where':{'id':_0x5e7e9d[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x4a')](handleEntityNotFound(_0x27fdac,null))['then'](saveUpdates(_0x5e7e9d[_0xcdfc('0x52')],null))[_0xcdfc('0x4a')](respondWithResult(_0x27fdac,null))['catch'](handleError(_0x27fdac,null));};exports['destroy']=function(_0x55eace,_0x8f2d96){return db[_0xcdfc('0x36')]['find']({'where':{'id':_0x55eace[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x4a')](handleEntityNotFound(_0x8f2d96,null))[_0xcdfc('0x4a')](removeEntity(_0x8f2d96,null))['catch'](handleError(_0x8f2d96,null));};exports[_0xcdfc('0x5a')]=function(_0x411c33,_0x1f4672,_0x567532){return db[_0xcdfc('0x36')][_0xcdfc('0x56')]({'where':{'id':_0x411c33[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x4a')](handleEntityNotFound(_0x1f4672,null))[_0xcdfc('0x4a')](function(_0x1893f6){if(_0x1893f6){return _0x1893f6['addUsers'](_0x411c33[_0xcdfc('0x52')][_0xcdfc('0x5b')],_[_0xcdfc('0x5c')](_0x411c33[_0xcdfc('0x52')],['ids','id'])||{});}})[_0xcdfc('0x4a')](respondWithResult(_0x1f4672,null))[_0xcdfc('0x50')](handleError(_0x1f4672,null));};exports[_0xcdfc('0x5d')]=function(_0x3304bc,_0x2b5888,_0x316ae3){return db[_0xcdfc('0x36')]['find']({'where':{'id':_0x3304bc[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x4a')](handleEntityNotFound(_0x2b5888,null))['then'](function(_0x145c3c){if(_0x145c3c){return _0x145c3c[_0xcdfc('0x5d')](_0x3304bc['query'][_0xcdfc('0x5b')])[_0xcdfc('0x4a')](function(){if(_[_0xcdfc('0x5e')](_0x3304bc[_0xcdfc('0x3b')][_0xcdfc('0x5b')])){for(var _0x3ce945=0x0;_0x3ce945<_0x3304bc[_0xcdfc('0x3b')]['ids'][_0xcdfc('0x3f')];_0x3ce945+=0x1){socket['emit'](_0xcdfc('0x5f'),{'UserId':Number(_0x3304bc[_0xcdfc('0x3b')]['ids'][_0x3ce945]),'SquareProjectId':Number(_0x3304bc[_0xcdfc('0x4d')]['id'])});}}else{socket[_0xcdfc('0x60')](_0xcdfc('0x5f'),{'UserId':Number(_0x3304bc['query'][_0xcdfc('0x5b')]),'SquareProjectId':Number(_0x3304bc['params']['id'])});}});}})[_0xcdfc('0x4a')](respondWithStatusCode(_0x2b5888,null))[_0xcdfc('0x50')](handleError(_0x2b5888,null));};exports[_0xcdfc('0x61')]=function(_0x4a9ed3,_0x3d5685,_0x23311c){var _0x419b68={};var _0x5cd371={};var _0x4bd936;var _0x5998a2;return db[_0xcdfc('0x36')][_0xcdfc('0x62')]({'where':{'id':_0x4a9ed3[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x4a')](handleEntityNotFound(_0x3d5685,null))[_0xcdfc('0x4a')](function(_0x2f8454){if(_0x2f8454){_0x4bd936=_0x2f8454;_0x5cd371[_0xcdfc('0x3a')]=_[_0xcdfc('0x4e')](db[_0xcdfc('0x63')][_0xcdfc('0x37')]);_0x5cd371[_0xcdfc('0x3b')]=_[_0xcdfc('0x4e')](_0x4a9ed3['query']);_0x5cd371[_0xcdfc('0x43')]=_[_0xcdfc('0x3d')](_0x5cd371[_0xcdfc('0x3a')],_0x5cd371[_0xcdfc('0x3b')]);_0x419b68[_0xcdfc('0x3c')]=_['intersection'](_0x5cd371[_0xcdfc('0x3a')],qs[_0xcdfc('0x3e')](_0x4a9ed3['query'][_0xcdfc('0x3e')]));_0x419b68[_0xcdfc('0x3c')]=_0x419b68[_0xcdfc('0x3c')]['length']?_0x419b68[_0xcdfc('0x3c')]:_0x5cd371[_0xcdfc('0x3a')];_0x419b68[_0xcdfc('0x40')]=qs['sort'](_0x4a9ed3[_0xcdfc('0x3b')][_0xcdfc('0x41')]);_0x419b68[_0xcdfc('0x42')]=qs[_0xcdfc('0x43')](_[_0xcdfc('0x44')](_0x4a9ed3[_0xcdfc('0x3b')],_0x5cd371[_0xcdfc('0x43')]));if(_0x4a9ed3[_0xcdfc('0x3b')][_0xcdfc('0x48')]){_0x419b68[_0xcdfc('0x42')]=_[_0xcdfc('0x45')](_0x419b68[_0xcdfc('0x42')],{'$or':_[_0xcdfc('0x35')](_0x419b68[_0xcdfc('0x3c')],function(_0x4279ca){var _0x3b2ed4={};_0x3b2ed4[_0x4279ca]={'$like':'%'+_0x4a9ed3[_0xcdfc('0x3b')][_0xcdfc('0x48')]+'%'};return _0x3b2ed4;})});}_0x419b68=_['merge']({},_0x419b68,_0x4a9ed3[_0xcdfc('0x49')]);return _0x4bd936[_0xcdfc('0x61')](_0x419b68);}})[_0xcdfc('0x4a')](function(_0x2cf2aa){if(_0x2cf2aa){_0x5998a2=_0x2cf2aa[_0xcdfc('0x3f')];if(!_0x4a9ed3[_0xcdfc('0x3b')]['hasOwnProperty'](_0xcdfc('0x64'))){_0x419b68[_0xcdfc('0x28')]=qs['limit'](_0x4a9ed3[_0xcdfc('0x3b')][_0xcdfc('0x28')]);_0x419b68['offset']=qs['offset'](_0x4a9ed3[_0xcdfc('0x3b')]['offset']);}return _0x4bd936[_0xcdfc('0x61')](_0x419b68);}})[_0xcdfc('0x4a')](function(_0x4347e5){if(_0x4347e5){return _0x4347e5?{'count':_0x5998a2,'rows':_0x4347e5}:null;}})['then'](respondWithResult(_0x3d5685,null))['catch'](handleError(_0x3d5685,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0d15c63..91a9608 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 _0xa215=['hook','exports','events','SquareProject','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x54a7f5,_0x17eb6c){var _0x3618f2=function(_0x18db70){while(--_0x18db70){_0x54a7f5['push'](_0x54a7f5['shift']());}};_0x3618f2(++_0x17eb6c);}(_0xa215,0x142));var _0x5a21=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xa215[_0x212fcc];return _0x4d8190;};'use strict';var EventEmitter=require(_0x5a21('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5a21('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5a21('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a21('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e2036){return function(_0x11c12d,_0x39be5d,_0x1ee021){SquareProjectEvents['emit'](_0x1e2036+':'+_0x11c12d['id'],_0x11c12d);SquareProjectEvents[_0x5a21('0x4')](_0x1e2036,_0x11c12d);_0x1ee021(null);};}for(var e in events){if(events[_0x5a21('0x5')](e)){var event=events[e];SquareProject[_0x5a21('0x6')](e,emitEvent(event));}}module[_0x5a21('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xee24=['save','update','remove','emit','hook','exports','../../mysqldb','SquareProject'];(function(_0x179a65,_0x8f3e98){var _0x13b8fa=function(_0x44c82d){while(--_0x44c82d){_0x179a65['push'](_0x179a65['shift']());}};_0x13b8fa(++_0x8f3e98);}(_0xee24,0x1a6));var _0x4ee2=function(_0x2627d2,_0x105c40){_0x2627d2=_0x2627d2-0x0;var _0x404dcf=_0xee24[_0x2627d2];return _0x404dcf;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x4ee2('0x0'))['db'][_0x4ee2('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ee2('0x2'),'afterUpdate':_0x4ee2('0x3'),'afterDestroy':_0x4ee2('0x4')};function emitEvent(_0x34b373){return function(_0x5546e1,_0x1aee89,_0x179bfa){SquareProjectEvents[_0x4ee2('0x5')](_0x34b373+':'+_0x5546e1['id'],_0x5546e1);SquareProjectEvents[_0x4ee2('0x5')](_0x34b373,_0x5546e1);_0x179bfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4ee2('0x6')](e,emitEvent(event));}}module[_0x4ee2('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4167629..95cb67b 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 _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x39cd8a,_0x191d01){var _0x73b969=function(_0x5ade1d){while(--_0x5ade1d){_0x39cd8a['push'](_0x39cd8a['shift']());}};_0x73b969(++_0x191d01);}(_0x0295,0x1f0));var _0x5029=function(_0x59ecf9,_0x9a29d){_0x59ecf9=_0x59ecf9-0x0;var _0x3c68c1=_0x0295[_0x59ecf9];return _0x3c68c1;};'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')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x29f276,_0x4b0711){var _0x386400=function(_0x350d65){while(--_0x350d65){_0x29f276['push'](_0x29f276['shift']());}};_0x386400(++_0x4b0711);}(_0x0295,0x1f0));var _0x5029=function(_0x198541,_0x2e1dea){_0x198541=_0x198541-0x0;var _0x24c19a=_0x0295[_0x198541];return _0x24c19a;};'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')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6f7e5b5..649afc8 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 _0xd4da=['SquareProject','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject,\x20%s,\x20%s','result','catch','ShowSquareProject'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0xd4da,0x10c));var _0xad4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xad4d('0x0'));var util=require(_0xad4d('0x1'));var moment=require(_0xad4d('0x2'));var BPromise=require(_0xad4d('0x3'));var rs=require(_0xad4d('0x4'));var fs=require('fs');var Redis=require(_0xad4d('0x5'));var db=require(_0xad4d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xad4d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad4d('0x8')]['http']({'port':0x232a});config[_0xad4d('0x9')]=_[_0xad4d('0xa')](config[_0xad4d('0x9')],{'host':_0xad4d('0xb'),'port':0x18eb});var socket=require(_0xad4d('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0xad4d('0xd')](socket);function respondWithRpcPromise(_0x3af753,_0x5aa6e4,_0x569b7c){return new BPromise(function(_0x1af487,_0x11a305){return client[_0xad4d('0xe')](_0x3af753,_0x569b7c)[_0xad4d('0xf')](function(_0x8cce35){logger[_0xad4d('0x10')]('SquareProject,\x20%s,\x20%s',_0x5aa6e4,_0xad4d('0x11'));logger[_0xad4d('0x12')](_0xad4d('0x13'),_0x5aa6e4,_0xad4d('0x11'),JSON[_0xad4d('0x14')](_0x8cce35));if(_0x8cce35[_0xad4d('0x15')]){if(_0x8cce35[_0xad4d('0x15')][_0xad4d('0x16')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x5aa6e4,_0x8cce35[_0xad4d('0x15')]['message']);return _0x11a305(_0x8cce35['error'][_0xad4d('0x17')]);}logger['error'](_0xad4d('0x18'),_0x5aa6e4,_0x8cce35[_0xad4d('0x15')][_0xad4d('0x17')]);return _0x1af487(_0x8cce35[_0xad4d('0x15')][_0xad4d('0x17')]);}else{logger[_0xad4d('0x10')](_0xad4d('0x18'),_0x5aa6e4,_0xad4d('0x11'));_0x1af487(_0x8cce35[_0xad4d('0x19')][_0xad4d('0x17')]);}})[_0xad4d('0x1a')](function(_0x256537){logger[_0xad4d('0x15')](_0xad4d('0x18'),_0x5aa6e4,_0x256537);_0x11a305(_0x256537);});});}exports[_0xad4d('0x1b')]=function(_0x49a23b){var _0x235b4c=this;return new Promise(function(_0x1f9871,_0x13942c){return db[_0xad4d('0x1c')][_0xad4d('0x1d')]({'raw':_0x49a23b[_0xad4d('0x1e')]?_0x49a23b['options'][_0xad4d('0x1f')]===undefined?!![]:![]:!![],'where':_0x49a23b[_0xad4d('0x1e')]?_0x49a23b[_0xad4d('0x1e')][_0xad4d('0x20')]||null:null,'attributes':_0x49a23b[_0xad4d('0x1e')]?_0x49a23b['options']['attributes']||null:null,'include':_0x49a23b['options']?_0x49a23b[_0xad4d('0x1e')][_0xad4d('0x21')]?_[_0xad4d('0x22')](_0x49a23b[_0xad4d('0x1e')][_0xad4d('0x21')],function(_0x3adf2e){return{'model':db[_0x3adf2e[_0xad4d('0x23')]],'as':_0x3adf2e['as'],'attributes':_0x3adf2e[_0xad4d('0x24')],'include':_0x3adf2e['include']?_[_0xad4d('0x22')](_0x3adf2e['include'],function(_0x8825a){return{'model':db[_0x8825a[_0xad4d('0x23')]],'as':_0x8825a['as'],'attributes':_0x8825a['attributes'],'include':_0x8825a[_0xad4d('0x21')]?_[_0xad4d('0x22')](_0x8825a[_0xad4d('0x21')],function(_0x448e44){return{'model':db[_0x448e44[_0xad4d('0x23')]],'as':_0x448e44['as'],'attributes':_0x448e44[_0xad4d('0x24')]};}):[]};}):[]};}):[]:[]})[_0xad4d('0xf')](function(_0x4a232b){logger[_0xad4d('0x10')]('ShowSquareProject',_0x49a23b);logger[_0xad4d('0x12')](_0xad4d('0x1b'),_0x49a23b,JSON['stringify'](_0x4a232b));_0x1f9871(_0x4a232b);})[_0xad4d('0x1a')](function(_0x1493d3){logger[_0xad4d('0x15')](_0xad4d('0x1b'),_0x1493d3[_0xad4d('0x17')],_0x49a23b);_0x13942c(_0x235b4c['error'](0x1f4,_0x1493d3['message']));});});}; \ No newline at end of file +var _0x1bc0=['redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareProject','find','options','raw','where','attributes','include','model','map','ShowSquareProject','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x166346,_0x14bd77){var _0x25a5b2=function(_0x1af2dd){while(--_0x1af2dd){_0x166346['push'](_0x166346['shift']());}};_0x25a5b2(++_0x14bd77);}(_0x1bc0,0x106));var _0x01bc=function(_0x5914ab,_0x2baa23){_0x5914ab=_0x5914ab-0x0;var _0xb5a19c=_0x1bc0[_0x5914ab];return _0xb5a19c;};'use strict';var _=require(_0x01bc('0x0'));var util=require(_0x01bc('0x1'));var moment=require('moment');var BPromise=require(_0x01bc('0x2'));var rs=require(_0x01bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x01bc('0x4'));var logger=require(_0x01bc('0x5'))(_0x01bc('0x6'));var config=require(_0x01bc('0x7'));var jayson=require(_0x01bc('0x8'));var client=jayson[_0x01bc('0x9')][_0x01bc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x01bc('0xb')],{'host':_0x01bc('0xc'),'port':0x18eb});var socket=require(_0x01bc('0xd'))(new Redis(config['redis']));require(_0x01bc('0xe'))[_0x01bc('0xf')](socket);function respondWithRpcPromise(_0xf087e3,_0x6d2126,_0x1e1750){return new BPromise(function(_0x21b053,_0x49df72){return client[_0x01bc('0x10')](_0xf087e3,_0x1e1750)[_0x01bc('0x11')](function(_0x3d7e18){logger[_0x01bc('0x12')](_0x01bc('0x13'),_0x6d2126,_0x01bc('0x14'));logger[_0x01bc('0x15')](_0x01bc('0x16'),_0x6d2126,'request\x20sent',JSON[_0x01bc('0x17')](_0x3d7e18));if(_0x3d7e18['error']){if(_0x3d7e18[_0x01bc('0x18')][_0x01bc('0x19')]===0x1f4){logger[_0x01bc('0x18')](_0x01bc('0x13'),_0x6d2126,_0x3d7e18['error'][_0x01bc('0x1a')]);return _0x49df72(_0x3d7e18[_0x01bc('0x18')]['message']);}logger[_0x01bc('0x18')]('SquareProject,\x20%s,\x20%s',_0x6d2126,_0x3d7e18['error'][_0x01bc('0x1a')]);return _0x21b053(_0x3d7e18[_0x01bc('0x18')]['message']);}else{logger[_0x01bc('0x12')](_0x01bc('0x13'),_0x6d2126,_0x01bc('0x14'));_0x21b053(_0x3d7e18[_0x01bc('0x1b')][_0x01bc('0x1a')]);}})['catch'](function(_0x54c1e1){logger[_0x01bc('0x18')]('SquareProject,\x20%s,\x20%s',_0x6d2126,_0x54c1e1);_0x49df72(_0x54c1e1);});});}exports['ShowSquareProject']=function(_0x10bd82){var _0x782685=this;return new Promise(function(_0x55ab50,_0x4e7b63){return db[_0x01bc('0x1c')][_0x01bc('0x1d')]({'raw':_0x10bd82[_0x01bc('0x1e')]?_0x10bd82[_0x01bc('0x1e')][_0x01bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x10bd82[_0x01bc('0x1e')]?_0x10bd82[_0x01bc('0x1e')][_0x01bc('0x20')]||null:null,'attributes':_0x10bd82[_0x01bc('0x1e')]?_0x10bd82[_0x01bc('0x1e')][_0x01bc('0x21')]||null:null,'include':_0x10bd82[_0x01bc('0x1e')]?_0x10bd82['options'][_0x01bc('0x22')]?_['map'](_0x10bd82[_0x01bc('0x1e')][_0x01bc('0x22')],function(_0x1c547a){return{'model':db[_0x1c547a[_0x01bc('0x23')]],'as':_0x1c547a['as'],'attributes':_0x1c547a['attributes'],'include':_0x1c547a[_0x01bc('0x22')]?_[_0x01bc('0x24')](_0x1c547a[_0x01bc('0x22')],function(_0x3fd806){return{'model':db[_0x3fd806['model']],'as':_0x3fd806['as'],'attributes':_0x3fd806[_0x01bc('0x21')],'include':_0x3fd806['include']?_['map'](_0x3fd806['include'],function(_0x5136d0){return{'model':db[_0x5136d0['model']],'as':_0x5136d0['as'],'attributes':_0x5136d0[_0x01bc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01bc('0x11')](function(_0x298159){logger['info'](_0x01bc('0x25'),_0x10bd82);logger[_0x01bc('0x15')](_0x01bc('0x25'),_0x10bd82,JSON['stringify'](_0x298159));_0x55ab50(_0x298159);})[_0x01bc('0x26')](function(_0x31ac8f){logger[_0x01bc('0x18')]('ShowSquareProject',_0x31ac8f[_0x01bc('0x1a')],_0x10bd82);_0x4e7b63(_0x782685[_0x01bc('0x18')](0x1f4,_0x31ac8f[_0x01bc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0b3044b..1017120 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 _0xadb5=['update','emit','register','length','squareProject:','save'];(function(_0x326810,_0xea181c){var _0x57708d=function(_0x45d5c3){while(--_0x45d5c3){_0x326810['push'](_0x326810['shift']());}};_0x57708d(++_0xea181c);}(_0xadb5,0xad));var _0x5adb=function(_0x305b43,_0x3e1032){_0x305b43=_0x305b43-0x0;var _0x20f781=_0xadb5[_0x305b43];return _0x20f781;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){SquareProjectEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);SquareProjectEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file +var _0x7096=['emit','removeListener','register','length','save','update'];(function(_0xad29d0,_0x3b06ed){var _0x4d55b=function(_0x51fd84){while(--_0x51fd84){_0xad29d0['push'](_0xad29d0['shift']());}};_0x4d55b(++_0x3b06ed);}(_0x7096,0x10c));var _0x6709=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7096[_0x110c3d];return _0x226d67;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){SquareProjectEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('squareProject:'+_0x985814,_0x9d630f);SquareProjectEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c08829b..5aae341 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 _0xe487=['/:id','show','/:id/download','download','post','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','get'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xe487,0x138));var _0x7e48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe487[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7e48('0x0'));var util=require(_0x7e48('0x1'));var path=require(_0x7e48('0x2'));var timeout=require(_0x7e48('0x3'));var express=require(_0x7e48('0x4'));var router=express['Router']();var auth=require(_0x7e48('0x5'));var interaction=require(_0x7e48('0x6'));var config=require(_0x7e48('0x7'));var controller=require(_0x7e48('0x8'));router['get']('/',auth[_0x7e48('0x9')](),controller['index']);router[_0x7e48('0xa')](_0x7e48('0xb'),auth[_0x7e48('0x9')](),controller[_0x7e48('0xc')]);router['get'](_0x7e48('0xd'),auth[_0x7e48('0x9')](),controller[_0x7e48('0xe')]);router[_0x7e48('0xf')]('/',auth[_0x7e48('0x9')](),controller['create']);router[_0x7e48('0x10')](_0x7e48('0xb'),auth[_0x7e48('0x9')](),controller[_0x7e48('0x11')]);router['delete']('/:id/delete',auth[_0x7e48('0x9')](),controller[_0x7e48('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6f1d=['isAuthenticated','index','get','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller'];(function(_0x5e9949,_0x4016d6){var _0x297080=function(_0x1c2198){while(--_0x1c2198){_0x5e9949['push'](_0x5e9949['shift']());}};_0x297080(++_0x4016d6);}(_0x6f1d,0x11e));var _0xd6f1=function(_0x5eb7c4,_0x4d3afb){_0x5eb7c4=_0x5eb7c4-0x0;var _0x3d6617=_0x6f1d[_0x5eb7c4];return _0x3d6617;};'use strict';var multer=require(_0xd6f1('0x0'));var util=require(_0xd6f1('0x1'));var path=require(_0xd6f1('0x2'));var timeout=require(_0xd6f1('0x3'));var express=require('express');var router=express[_0xd6f1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6f1('0x5'));var config=require(_0xd6f1('0x6'));var controller=require(_0xd6f1('0x7'));router['get']('/',auth[_0xd6f1('0x8')](),controller[_0xd6f1('0x9')]);router[_0xd6f1('0xa')](_0xd6f1('0xb'),auth[_0xd6f1('0x8')](),controller[_0xd6f1('0xc')]);router[_0xd6f1('0xa')](_0xd6f1('0xd'),auth['isAuthenticated'](),controller[_0xd6f1('0xe')]);router[_0xd6f1('0xf')]('/',auth[_0xd6f1('0x8')](),controller['create']);router[_0xd6f1('0x10')]('/:id',auth[_0xd6f1('0x8')](),controller[_0xd6f1('0x11')]);router[_0xd6f1('0x12')]('/:id/delete',auth[_0xd6f1('0x8')](),controller[_0xd6f1('0x13')]);module[_0xd6f1('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 34f4f33..5f37391 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 _0x2842=['VIRTUAL','getDataValue','substring','lastIndexOf','exports','STRING'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x2842,0x1ba));var _0x2284=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2842[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0x2284('0x0')]={'uniqueid':{'type':Sequelize[_0x2284('0x1')]},'callerid':{'type':Sequelize[_0x2284('0x1')]},'calleridname':{'type':Sequelize[_0x2284('0x1')]},'context':{'type':Sequelize[_0x2284('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2284('0x1')]},'accountcode':{'type':Sequelize[_0x2284('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x2284('0x1')]},'saveName':{'type':Sequelize[_0x2284('0x1')]},'filename':{'type':Sequelize[_0x2284('0x1')]},'savePath':{'type':Sequelize[_0x2284('0x1')]},'format':{'type':Sequelize[_0x2284('0x2')],'get':function(){var _0x2f43bf='';var _0x4f9375=this[_0x2284('0x3')]('savePath');if(_0x4f9375){_0x2f43bf=_0x4f9375[_0x2284('0x4')](_0x4f9375[_0x2284('0x5')]('.'));}return _0x2f43bf;}}}; \ No newline at end of file +var _0xbd22=['savePath','substring','sequelize','exports','STRING'];(function(_0x5d8b4b,_0xcd8c9b){var _0x3c7e8e=function(_0xb72965){while(--_0xb72965){_0x5d8b4b['push'](_0x5d8b4b['shift']());}};_0x3c7e8e(++_0xcd8c9b);}(_0xbd22,0xf7));var _0x2bd2=function(_0x1e8f58,_0x31eee5){_0x1e8f58=_0x1e8f58-0x0;var _0x258071=_0xbd22[_0x1e8f58];return _0x258071;};'use strict';var Sequelize=require(_0x2bd2('0x0'));module[_0x2bd2('0x1')]={'uniqueid':{'type':Sequelize[_0x2bd2('0x2')]},'callerid':{'type':Sequelize[_0x2bd2('0x2')]},'calleridname':{'type':Sequelize[_0x2bd2('0x2')]},'context':{'type':Sequelize[_0x2bd2('0x2')]},'extension':{'type':Sequelize[_0x2bd2('0x2')]},'priority':{'type':Sequelize[_0x2bd2('0x2')]},'accountcode':{'type':Sequelize[_0x2bd2('0x2')]},'dnid':{'type':Sequelize[_0x2bd2('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2bd2('0x2')]},'filename':{'type':Sequelize[_0x2bd2('0x2')]},'savePath':{'type':Sequelize[_0x2bd2('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x37275d='';var _0x5cdf88=this['getDataValue'](_0x2bd2('0x3'));if(_0x5cdf88){_0x37275d=_0x5cdf88[_0x2bd2('0x4')](_0x5cdf88['lastIndexOf']('.'));}return _0x37275d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7856cc0..1d43d81 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 _0x6e00=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','length','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','SquareRecording\x20not\x20found','send','Not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','map','SquareRecording'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6e00,0x152));var _0x06e0=function(_0x3d47ec,_0x6b3ae1){_0x3d47ec=_0x3d47ec-0x0;var _0x11dc1f=_0x6e00[_0x3d47ec];return _0x11dc1f;};'use strict';var pdf=require(_0x06e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x06e0('0x1'));var zipdir=require(_0x06e0('0x2'));var jsonpatch=require(_0x06e0('0x3'));var rp=require(_0x06e0('0x4'));var moment=require('moment');var BPromise=require(_0x06e0('0x5'));var Mustache=require(_0x06e0('0x6'));var util=require(_0x06e0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x06e0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x06e0('0x9'));var jsforce=require(_0x06e0('0xa'));var deskjs=require(_0x06e0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x06e0('0xc'));var Papa=require(_0x06e0('0xd'));var Redis=require(_0x06e0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x06e0('0xf'));var as=require(_0x06e0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06e0('0x11'))(_0x06e0('0x12'));var utils=require(_0x06e0('0x13'));var config=require(_0x06e0('0x14'));var db=require(_0x06e0('0x15'))['db'];function respondWithStatusCode(_0x42bc74,_0x14bfd5){_0x14bfd5=_0x14bfd5||0xcc;return function(_0x465298){if(_0x465298){return _0x42bc74[_0x06e0('0x16')](_0x14bfd5);}return _0x42bc74[_0x06e0('0x17')](_0x14bfd5)[_0x06e0('0x18')]();};}function respondWithResult(_0x281d1a,_0x55b0ee){_0x55b0ee=_0x55b0ee||0xc8;return function(_0x345fe2){if(_0x345fe2){return _0x281d1a['status'](_0x55b0ee)['json'](_0x345fe2);}};}function respondWithFilteredResult(_0x48516e,_0x15dd42){return function(_0x1d5cc4){if(_0x1d5cc4){var _0x6a7b1d=_0x1d5cc4['count'],_0x61bb70=_0x15dd42[_0x06e0('0x19')],_0x4b079c=_0x15dd42['offset']+_0x15dd42[_0x06e0('0x1a')],_0x295aa3;if(_0x4b079c>=_0x6a7b1d){_0x4b079c=_0x6a7b1d;_0x295aa3=0xc8;}else{_0x295aa3=0xce;}_0x48516e[_0x06e0('0x17')](_0x295aa3);return _0x48516e[_0x06e0('0x1b')](_0x06e0('0x1c'),_0x61bb70+'-'+_0x4b079c+'/'+_0x6a7b1d)['json'](_0x1d5cc4);}return null;};}function patchUpdates(_0x38e1ed){return function(_0x1d50d6){try{jsonpatch[_0x06e0('0x1d')](_0x1d50d6,_0x38e1ed,!![]);}catch(_0x332336){return BPromise[_0x06e0('0x1e')](_0x332336);}return _0x1d50d6[_0x06e0('0x1f')]();};}function saveUpdates(_0x399256,_0x3db8dc){return function(_0x9a9987){if(_0x9a9987){return _0x9a9987[_0x06e0('0x20')](_0x399256)[_0x06e0('0x21')](function(_0x467c9c){return _0x467c9c;});}return null;};}function removeEntity(_0x26a655,_0x4dd61c){return function(_0x592e89){if(_0x592e89){return _0x592e89[_0x06e0('0x22')]()['then'](function(){_0x26a655[_0x06e0('0x17')](0xcc)[_0x06e0('0x18')]();});}};}function handleEntityNotFound(_0x48219f,_0x3103ad){return function(_0x5b9893){if(!_0x5b9893){_0x48219f[_0x06e0('0x16')](0x194);}return _0x5b9893;};}function handleError(_0x9cece1,_0x2805e2){_0x2805e2=_0x2805e2||0x1f4;return function(_0x2b6ea4){logger['error'](_0x2b6ea4['stack']);if(_0x2b6ea4[_0x06e0('0x23')]){delete _0x2b6ea4[_0x06e0('0x23')];}_0x9cece1['status'](_0x2805e2)['send'](_0x2b6ea4);};}exports['index']=function(_0x282843,_0x2e59ed){var _0x539add={},_0x3814c0={},_0x2b8d86={'count':0x0,'rows':[]};var _0x48dc64=_[_0x06e0('0x24')](db[_0x06e0('0x25')][_0x06e0('0x26')],function(_0x250bc7){return{'name':_0x250bc7[_0x06e0('0x27')],'type':_0x250bc7[_0x06e0('0x28')][_0x06e0('0x29')]};});_0x3814c0[_0x06e0('0x2a')]=_[_0x06e0('0x24')](_0x48dc64,'name');_0x3814c0[_0x06e0('0x2b')]=_[_0x06e0('0x2c')](_0x282843['query']);_0x3814c0['filters']=_[_0x06e0('0x2d')](_0x3814c0['model'],_0x3814c0[_0x06e0('0x2b')]);_0x539add[_0x06e0('0x2e')]=_[_0x06e0('0x2d')](_0x3814c0['model'],qs[_0x06e0('0x2f')](_0x282843['query']['fields']));_0x539add[_0x06e0('0x2e')]=_0x539add[_0x06e0('0x2e')]['length']?_0x539add[_0x06e0('0x2e')]:_0x3814c0[_0x06e0('0x2a')];if(!_0x282843['query'][_0x06e0('0x30')](_0x06e0('0x31'))){_0x539add[_0x06e0('0x1a')]=qs[_0x06e0('0x1a')](_0x282843[_0x06e0('0x2b')][_0x06e0('0x1a')]);_0x539add['offset']=qs[_0x06e0('0x19')](_0x282843['query'][_0x06e0('0x19')]);}_0x539add[_0x06e0('0x32')]=qs[_0x06e0('0x33')](_0x282843['query'][_0x06e0('0x33')]);_0x539add[_0x06e0('0x34')]=qs[_0x06e0('0x35')](_[_0x06e0('0x36')](_0x282843[_0x06e0('0x2b')],_0x3814c0[_0x06e0('0x35')]),_0x48dc64);if(_0x282843[_0x06e0('0x2b')][_0x06e0('0x37')]){_0x539add['where']=_[_0x06e0('0x38')](_0x539add[_0x06e0('0x34')],{'$or':_[_0x06e0('0x24')](_0x48dc64,function(_0x3609a9){if(_0x3609a9['type']!==_0x06e0('0x39')){var _0x34d935={};_0x34d935[_0x3609a9[_0x06e0('0x23')]]={'$like':'%'+_0x282843[_0x06e0('0x2b')]['filter']+'%'};return _0x34d935;}})});}_0x539add=_[_0x06e0('0x38')]({},_0x539add,_0x282843[_0x06e0('0x3a')]);var _0x553339={'where':_0x539add['where']};return db[_0x06e0('0x25')][_0x06e0('0x3b')](_0x553339)[_0x06e0('0x21')](function(_0x4547ee){_0x2b8d86[_0x06e0('0x3b')]=_0x4547ee;if(_0x282843['query'][_0x06e0('0x3c')]){_0x539add[_0x06e0('0x3d')]=[{'all':!![]}];}return db[_0x06e0('0x25')][_0x06e0('0x3e')](_0x539add);})['then'](function(_0x4c0bc4){_0x2b8d86[_0x06e0('0x3f')]=_0x4c0bc4;return _0x2b8d86;})['then'](respondWithFilteredResult(_0x2e59ed,_0x539add))[_0x06e0('0x40')](handleError(_0x2e59ed,null));};exports['show']=function(_0xb6bea1,_0x381eaf){var _0x25117b={'raw':!![],'where':{'id':_0xb6bea1['params']['id']}},_0x59ea27={};_0x59ea27[_0x06e0('0x2a')]=_[_0x06e0('0x2c')](db['SquareRecording'][_0x06e0('0x26')]);_0x59ea27[_0x06e0('0x2b')]=_[_0x06e0('0x2c')](_0xb6bea1[_0x06e0('0x2b')]);_0x59ea27[_0x06e0('0x35')]=_[_0x06e0('0x2d')](_0x59ea27[_0x06e0('0x2a')],_0x59ea27[_0x06e0('0x2b')]);_0x25117b['attributes']=_[_0x06e0('0x2d')](_0x59ea27[_0x06e0('0x2a')],qs[_0x06e0('0x2f')](_0xb6bea1['query'][_0x06e0('0x2f')]));_0x25117b[_0x06e0('0x2e')]=_0x25117b[_0x06e0('0x2e')][_0x06e0('0x41')]?_0x25117b['attributes']:_0x59ea27[_0x06e0('0x2a')];if(_0xb6bea1[_0x06e0('0x2b')][_0x06e0('0x3c')]){_0x25117b[_0x06e0('0x3d')]=[{'all':!![]}];}_0x25117b=_[_0x06e0('0x38')]({},_0x25117b,_0xb6bea1[_0x06e0('0x3a')]);return db['SquareRecording']['find'](_0x25117b)[_0x06e0('0x21')](handleEntityNotFound(_0x381eaf,null))[_0x06e0('0x21')](respondWithResult(_0x381eaf,null))[_0x06e0('0x40')](handleError(_0x381eaf,null));};exports[_0x06e0('0x42')]=function(_0x3db561,_0x28d7c1){return db[_0x06e0('0x25')][_0x06e0('0x42')](_0x3db561[_0x06e0('0x43')],{})['then'](respondWithResult(_0x28d7c1,0xc9))[_0x06e0('0x40')](handleError(_0x28d7c1,null));};exports[_0x06e0('0x20')]=function(_0x4b2016,_0x2c9490){if(_0x4b2016[_0x06e0('0x43')]['id']){delete _0x4b2016['body']['id'];}return db[_0x06e0('0x25')][_0x06e0('0x44')]({'where':{'id':_0x4b2016[_0x06e0('0x45')]['id']}})[_0x06e0('0x21')](handleEntityNotFound(_0x2c9490,null))[_0x06e0('0x21')](saveUpdates(_0x4b2016[_0x06e0('0x43')],null))[_0x06e0('0x21')](respondWithResult(_0x2c9490,null))[_0x06e0('0x40')](handleError(_0x2c9490,null));};exports[_0x06e0('0x46')]=function(_0x5eb0be,_0x45bbf6,_0x7d40dc){var _0x5f231c=require(_0x06e0('0x47'));var _0x1ce583=![];var _0x1344b0={};if(_0x5eb0be[_0x06e0('0x2b')][_0x06e0('0x28')]&&_0x5eb0be['query'][_0x06e0('0x28')]===_0x06e0('0x48')){_0x1344b0[_0x06e0('0x48')]=_0x5eb0be[_0x06e0('0x45')]['id'];}else{_0x1344b0['id']=_0x5eb0be[_0x06e0('0x45')]['id'];}return db[_0x06e0('0x25')][_0x06e0('0x44')]({'where':_0x1344b0,'attributes':['id',_0x06e0('0x49'),_0x06e0('0x4a')],'raw':!![]})[_0x06e0('0x21')](handleEntityNotFound(_0x45bbf6,null))['then'](function(_0x161b1b){if(_0x161b1b){var _0x2bfd1c=_0x161b1b['savePath'];var _0x382edb=util[_0x06e0('0x4b')](_0x06e0('0x4c'),_0x2bfd1c);if(fs[_0x06e0('0x4d')](_0x382edb)){_0x1ce583=!![];return _0x5f231c[_0x06e0('0x4e')](_0x382edb,_0x2bfd1c,config[_0x06e0('0x4f')][_0x06e0('0x50')])[_0x06e0('0x21')](function(){return _0x161b1b;});}return _0x161b1b;}})[_0x06e0('0x21')](function(_0xacbbe8){if(_0xacbbe8){var _0x468c9b=_0xacbbe8[_0x06e0('0x49')];if(!fs[_0x06e0('0x4d')](_0x468c9b)){throw new db[(_0x06e0('0x51'))][(_0x06e0('0x52'))]('SquareRecording\x20not\x20found');}if(_0xacbbe8['filename']){return _0x45bbf6[_0x06e0('0x46')](_0x468c9b,_0xacbbe8[_0x06e0('0x4a')]+path[_0x06e0('0x53')](_0x468c9b),function(){if(_0x1ce583){fs[_0x06e0('0x54')](_0x468c9b);}});}else{return _0x45bbf6[_0x06e0('0x46')](_0x468c9b,function(_0x40d485){if(_0x1ce583){fs['unlink'](_0x468c9b);}});}}})['catch'](function(_0x3e20b7){if(_0x3e20b7['message']===_0x06e0('0x55')){_0x45bbf6[_0x06e0('0x17')](0x194)[_0x06e0('0x56')](_0x06e0('0x57'));}else{return handleError(_0x45bbf6,null);}});};exports[_0x06e0('0x22')]=function(_0x32d85d,_0x134d7e){return db[_0x06e0('0x25')][_0x06e0('0x44')]({'where':{'id':_0x32d85d['params']['id']}})[_0x06e0('0x21')](function(_0x4bb006){if(!_0x4bb006)throw new ReferenceError('Entity\x20not\x20found');return _0x4bb006;})[_0x06e0('0x21')](function(_0x2a1866){var _0x3d1bac=_0x2a1866[_0x06e0('0x49')];logger[_0x06e0('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x3d1bac);if(!_[_0x06e0('0x59')](_0x2a1866['savePath'])&&fs[_0x06e0('0x4d')](_0x3d1bac)){logger[_0x06e0('0x58')](_0x06e0('0x5a')+_0x3d1bac+_0x06e0('0x5b'));fs[_0x06e0('0x5c')](_0x3d1bac);}_0x3d1bac=_0x3d1bac+_0x06e0('0x5d');if(!_[_0x06e0('0x59')](_0x2a1866['savePath'])&&fs[_0x06e0('0x4d')](_0x3d1bac)){logger['info']('File:\x20\x22'+_0x3d1bac+_0x06e0('0x5b'));fs[_0x06e0('0x5c')](_0x3d1bac);}return _0x2a1866;})[_0x06e0('0x21')](function(_0x22d597){if(!_0x22d597)throw new InternalError();return _0x22d597[_0x06e0('0x22')]();})[_0x06e0('0x21')](function(){_0x134d7e[_0x06e0('0x17')](0xcc)[_0x06e0('0x18')]();})[_0x06e0('0x40')](handleError(_0x134d7e,null));}; \ No newline at end of file +var _0xe141=['uniqueid','savePath','filename','%s.cypher','secrets','existsSync','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareRecording','findAll','rows','catch','show','includeAll','find','create','body','download','type'];(function(_0x40e160,_0x14aeb2){var _0x426f58=function(_0x1a33b4){while(--_0x1a33b4){_0x40e160['push'](_0x40e160['shift']());}};_0x426f58(++_0x14aeb2);}(_0xe141,0x1df));var _0x1e14=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe141[_0x45e98e];return _0x374dba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e14('0x1'));var jsonpatch=require(_0x1e14('0x2'));var rp=require('request-promise');var moment=require(_0x1e14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1e14('0x4'));var util=require(_0x1e14('0x5'));var path=require(_0x1e14('0x6'));var sox=require(_0x1e14('0x7'));var csv=require('to-csv');var ejs=require(_0x1e14('0x8'));var fs=require('fs');var _=require(_0x1e14('0x9'));var squel=require(_0x1e14('0xa'));var crypto=require(_0x1e14('0xb'));var jsforce=require(_0x1e14('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e14('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e14('0xe'));var as=require(_0x1e14('0xf'));var hardwareService=require(_0x1e14('0x10'));var logger=require(_0x1e14('0x11'))(_0x1e14('0x12'));var utils=require(_0x1e14('0x13'));var config=require(_0x1e14('0x14'));var db=require(_0x1e14('0x15'))['db'];function respondWithStatusCode(_0x379813,_0x31eb46){_0x31eb46=_0x31eb46||0xcc;return function(_0x3f4697){if(_0x3f4697){return _0x379813[_0x1e14('0x16')](_0x31eb46);}return _0x379813['status'](_0x31eb46)[_0x1e14('0x17')]();};}function respondWithResult(_0xa1a583,_0x4f8d0d){_0x4f8d0d=_0x4f8d0d||0xc8;return function(_0x27111e){if(_0x27111e){return _0xa1a583[_0x1e14('0x18')](_0x4f8d0d)[_0x1e14('0x19')](_0x27111e);}};}function respondWithFilteredResult(_0x46283c,_0x2e77d2){return function(_0x34c365){if(_0x34c365){var _0x2fb2c1=_0x34c365[_0x1e14('0x1a')],_0x49360a=_0x2e77d2[_0x1e14('0x1b')],_0x5be01d=_0x2e77d2[_0x1e14('0x1b')]+_0x2e77d2['limit'],_0x10a486;if(_0x5be01d>=_0x2fb2c1){_0x5be01d=_0x2fb2c1;_0x10a486=0xc8;}else{_0x10a486=0xce;}_0x46283c[_0x1e14('0x18')](_0x10a486);return _0x46283c[_0x1e14('0x1c')](_0x1e14('0x1d'),_0x49360a+'-'+_0x5be01d+'/'+_0x2fb2c1)[_0x1e14('0x19')](_0x34c365);}return null;};}function patchUpdates(_0x5655f5){return function(_0xf3714e){try{jsonpatch['apply'](_0xf3714e,_0x5655f5,!![]);}catch(_0x2bda4c){return BPromise[_0x1e14('0x1e')](_0x2bda4c);}return _0xf3714e[_0x1e14('0x1f')]();};}function saveUpdates(_0x51665d,_0x23c220){return function(_0x42899b){if(_0x42899b){return _0x42899b[_0x1e14('0x20')](_0x51665d)[_0x1e14('0x21')](function(_0x3f9cac){return _0x3f9cac;});}return null;};}function removeEntity(_0x5646cb,_0x2512bc){return function(_0x47a796){if(_0x47a796){return _0x47a796[_0x1e14('0x22')]()[_0x1e14('0x21')](function(){_0x5646cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x510ce2,_0x54265e){return function(_0x512dbf){if(!_0x512dbf){_0x510ce2['sendStatus'](0x194);}return _0x512dbf;};}function handleError(_0x3d8a92,_0x4bec1c){_0x4bec1c=_0x4bec1c||0x1f4;return function(_0x4b1bfa){logger[_0x1e14('0x23')](_0x4b1bfa[_0x1e14('0x24')]);if(_0x4b1bfa[_0x1e14('0x25')]){delete _0x4b1bfa[_0x1e14('0x25')];}_0x3d8a92[_0x1e14('0x18')](_0x4bec1c)[_0x1e14('0x26')](_0x4b1bfa);};}exports[_0x1e14('0x27')]=function(_0x59ef39,_0x36ebf7){var _0x5a4b66={},_0x4d5a06={},_0x5bd4b3={'count':0x0,'rows':[]};var _0x5700dd=_[_0x1e14('0x28')](db['SquareRecording'][_0x1e14('0x29')],function(_0x662592){return{'name':_0x662592[_0x1e14('0x2a')],'type':_0x662592['type'][_0x1e14('0x2b')]};});_0x4d5a06[_0x1e14('0x2c')]=_[_0x1e14('0x28')](_0x5700dd,_0x1e14('0x25'));_0x4d5a06['query']=_[_0x1e14('0x2d')](_0x59ef39['query']);_0x4d5a06[_0x1e14('0x2e')]=_[_0x1e14('0x2f')](_0x4d5a06[_0x1e14('0x2c')],_0x4d5a06[_0x1e14('0x30')]);_0x5a4b66[_0x1e14('0x31')]=_[_0x1e14('0x2f')](_0x4d5a06['model'],qs['fields'](_0x59ef39[_0x1e14('0x30')][_0x1e14('0x32')]));_0x5a4b66[_0x1e14('0x31')]=_0x5a4b66[_0x1e14('0x31')][_0x1e14('0x33')]?_0x5a4b66['attributes']:_0x4d5a06[_0x1e14('0x2c')];if(!_0x59ef39[_0x1e14('0x30')][_0x1e14('0x34')]('nolimit')){_0x5a4b66[_0x1e14('0x35')]=qs[_0x1e14('0x35')](_0x59ef39[_0x1e14('0x30')][_0x1e14('0x35')]);_0x5a4b66[_0x1e14('0x1b')]=qs['offset'](_0x59ef39[_0x1e14('0x30')][_0x1e14('0x1b')]);}_0x5a4b66[_0x1e14('0x36')]=qs[_0x1e14('0x37')](_0x59ef39[_0x1e14('0x30')]['sort']);_0x5a4b66[_0x1e14('0x38')]=qs['filters'](_[_0x1e14('0x39')](_0x59ef39[_0x1e14('0x30')],_0x4d5a06['filters']),_0x5700dd);if(_0x59ef39['query']['filter']){_0x5a4b66[_0x1e14('0x38')]=_[_0x1e14('0x3a')](_0x5a4b66['where'],{'$or':_[_0x1e14('0x28')](_0x5700dd,function(_0x1cae36){if(_0x1cae36['type']!==_0x1e14('0x3b')){var _0x296d4d={};_0x296d4d[_0x1cae36[_0x1e14('0x25')]]={'$like':'%'+_0x59ef39['query'][_0x1e14('0x3c')]+'%'};return _0x296d4d;}})});}_0x5a4b66=_[_0x1e14('0x3a')]({},_0x5a4b66,_0x59ef39[_0x1e14('0x3d')]);var _0x30ec64={'where':_0x5a4b66[_0x1e14('0x38')]};return db[_0x1e14('0x3e')]['count'](_0x30ec64)[_0x1e14('0x21')](function(_0x4b4c3f){_0x5bd4b3[_0x1e14('0x1a')]=_0x4b4c3f;if(_0x59ef39[_0x1e14('0x30')]['includeAll']){_0x5a4b66['include']=[{'all':!![]}];}return db['SquareRecording'][_0x1e14('0x3f')](_0x5a4b66);})['then'](function(_0x2907c2){_0x5bd4b3[_0x1e14('0x40')]=_0x2907c2;return _0x5bd4b3;})[_0x1e14('0x21')](respondWithFilteredResult(_0x36ebf7,_0x5a4b66))[_0x1e14('0x41')](handleError(_0x36ebf7,null));};exports[_0x1e14('0x42')]=function(_0x4d403d,_0x40c097){var _0x273fa7={'raw':!![],'where':{'id':_0x4d403d['params']['id']}},_0x2aa204={};_0x2aa204[_0x1e14('0x2c')]=_[_0x1e14('0x2d')](db[_0x1e14('0x3e')][_0x1e14('0x29')]);_0x2aa204[_0x1e14('0x30')]=_[_0x1e14('0x2d')](_0x4d403d[_0x1e14('0x30')]);_0x2aa204[_0x1e14('0x2e')]=_['intersection'](_0x2aa204['model'],_0x2aa204[_0x1e14('0x30')]);_0x273fa7[_0x1e14('0x31')]=_[_0x1e14('0x2f')](_0x2aa204[_0x1e14('0x2c')],qs['fields'](_0x4d403d[_0x1e14('0x30')][_0x1e14('0x32')]));_0x273fa7[_0x1e14('0x31')]=_0x273fa7[_0x1e14('0x31')][_0x1e14('0x33')]?_0x273fa7[_0x1e14('0x31')]:_0x2aa204['model'];if(_0x4d403d[_0x1e14('0x30')][_0x1e14('0x43')]){_0x273fa7['include']=[{'all':!![]}];}_0x273fa7=_[_0x1e14('0x3a')]({},_0x273fa7,_0x4d403d[_0x1e14('0x3d')]);return db[_0x1e14('0x3e')][_0x1e14('0x44')](_0x273fa7)[_0x1e14('0x21')](handleEntityNotFound(_0x40c097,null))[_0x1e14('0x21')](respondWithResult(_0x40c097,null))['catch'](handleError(_0x40c097,null));};exports[_0x1e14('0x45')]=function(_0x1ef7c6,_0x157276){return db[_0x1e14('0x3e')][_0x1e14('0x45')](_0x1ef7c6['body'],{})['then'](respondWithResult(_0x157276,0xc9))[_0x1e14('0x41')](handleError(_0x157276,null));};exports[_0x1e14('0x20')]=function(_0x4e85df,_0x38f0c2){if(_0x4e85df['body']['id']){delete _0x4e85df[_0x1e14('0x46')]['id'];}return db['SquareRecording'][_0x1e14('0x44')]({'where':{'id':_0x4e85df['params']['id']}})[_0x1e14('0x21')](handleEntityNotFound(_0x38f0c2,null))[_0x1e14('0x21')](saveUpdates(_0x4e85df['body'],null))[_0x1e14('0x21')](respondWithResult(_0x38f0c2,null))['catch'](handleError(_0x38f0c2,null));};exports[_0x1e14('0x47')]=function(_0x50a253,_0x8c9e3d,_0x6a0fcd){var _0x342f48=require('../../components/encryptor');var _0xb228d4=![];var _0x541f6d={};if(_0x50a253[_0x1e14('0x30')][_0x1e14('0x48')]&&_0x50a253[_0x1e14('0x30')][_0x1e14('0x48')]===_0x1e14('0x49')){_0x541f6d[_0x1e14('0x49')]=_0x50a253['params']['id'];}else{_0x541f6d['id']=_0x50a253['params']['id'];}return db[_0x1e14('0x3e')][_0x1e14('0x44')]({'where':_0x541f6d,'attributes':['id',_0x1e14('0x4a'),_0x1e14('0x4b')],'raw':!![]})[_0x1e14('0x21')](handleEntityNotFound(_0x8c9e3d,null))[_0x1e14('0x21')](function(_0x27bcad){if(_0x27bcad){var _0x5a55d7=_0x27bcad[_0x1e14('0x4a')];var _0x31fa61=util['format'](_0x1e14('0x4c'),_0x5a55d7);if(fs['existsSync'](_0x31fa61)){_0xb228d4=!![];return _0x342f48['decryptFile'](_0x31fa61,_0x5a55d7,config[_0x1e14('0x4d')]['recording'])['then'](function(){return _0x27bcad;});}return _0x27bcad;}})[_0x1e14('0x21')](function(_0x1ef3e0){if(_0x1ef3e0){var _0x184c05=_0x1ef3e0['savePath'];if(!fs[_0x1e14('0x4e')](_0x184c05)){throw new db['Sequelize'][(_0x1e14('0x4f'))]('SquareRecording\x20not\x20found');}if(_0x1ef3e0['filename']){return _0x8c9e3d[_0x1e14('0x47')](_0x184c05,_0x1ef3e0[_0x1e14('0x4b')]+path[_0x1e14('0x50')](_0x184c05),function(){if(_0xb228d4){fs[_0x1e14('0x51')](_0x184c05);}});}else{return _0x8c9e3d[_0x1e14('0x47')](_0x184c05,function(_0x228f02){if(_0xb228d4){fs[_0x1e14('0x51')](_0x184c05);}});}}})['catch'](function(_0x3c67f3){if(_0x3c67f3[_0x1e14('0x52')]===_0x1e14('0x53')){_0x8c9e3d[_0x1e14('0x18')](0x194)[_0x1e14('0x26')](_0x1e14('0x54'));}else{return handleError(_0x8c9e3d,null);}});};exports[_0x1e14('0x22')]=function(_0x16b7e2,_0x18f831){return db[_0x1e14('0x3e')][_0x1e14('0x44')]({'where':{'id':_0x16b7e2['params']['id']}})['then'](function(_0x3225a3){if(!_0x3225a3)throw new ReferenceError(_0x1e14('0x55'));return _0x3225a3;})[_0x1e14('0x21')](function(_0x23ca18){var _0x7859ae=_0x23ca18['savePath'];logger['info'](_0x1e14('0x56'),_0x7859ae);if(!_[_0x1e14('0x57')](_0x23ca18[_0x1e14('0x4a')])&&fs[_0x1e14('0x4e')](_0x7859ae)){logger[_0x1e14('0x58')]('File:\x20\x22'+_0x7859ae+_0x1e14('0x59'));fs[_0x1e14('0x5a')](_0x7859ae);}_0x7859ae=_0x7859ae+_0x1e14('0x5b');if(!_[_0x1e14('0x57')](_0x23ca18[_0x1e14('0x4a')])&&fs[_0x1e14('0x4e')](_0x7859ae)){logger[_0x1e14('0x58')]('File:\x20\x22'+_0x7859ae+_0x1e14('0x59'));fs['unlinkSync'](_0x7859ae);}return _0x23ca18;})[_0x1e14('0x21')](function(_0x96b2d9){if(!_0x96b2d9)throw new InternalError();return _0x96b2d9['destroy']();})[_0x1e14('0x21')](function(){_0x18f831[_0x1e14('0x18')](0xcc)[_0x1e14('0x17')]();})[_0x1e14('0x41')](handleError(_0x18f831,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 34cfc8f..6a7c510 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 _0x99e8=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x179ce9,_0x153f77){var _0x245e55=function(_0x30254a){while(--_0x30254a){_0x179ce9['push'](_0x179ce9['shift']());}};_0x245e55(++_0x153f77);}(_0x99e8,0x1a2));var _0x899e=function(_0x4a7821,_0x170ed5){_0x4a7821=_0x4a7821-0x0;var _0x539663=_0x99e8[_0x4a7821];return _0x539663;};'use strict';var _=require(_0x899e('0x0'));var util=require(_0x899e('0x1'));var logger=require(_0x899e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x899e('0x3'));var rp=require(_0x899e('0x4'));var fs=require('fs');var path=require(_0x899e('0x5'));var rimraf=require(_0x899e('0x6'));var config=require(_0x899e('0x7'));var attributes=require(_0x899e('0x8'));module[_0x899e('0x9')]=function(_0x3654b7,_0x10bbb5){return _0x3654b7[_0x899e('0xa')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2e6=['util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','SquareRecording','square_recordings'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xe2e6,0x1e0));var _0x6e2e=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0xe2e6[_0x22d202];return _0x3cb212;};'use strict';var _=require('lodash');var util=require(_0x6e2e('0x0'));var logger=require(_0x6e2e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6e2e('0x2'));var rp=require(_0x6e2e('0x3'));var fs=require('fs');var path=require(_0x6e2e('0x4'));var rimraf=require(_0x6e2e('0x5'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x6e2e('0x6')]=function(_0x542ef5,_0xfdd243){return _0x542ef5[_0x6e2e('0x7')](_0x6e2e('0x8'),attributes,{'tableName':_0x6e2e('0x9'),'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 f368d04..0bbd377 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 _0x581d=['stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x581d,0x1e6));var _0xd581=function(_0x31a814,_0x8c76ab){_0x31a814=_0x31a814-0x0;var _0x273671=_0x581d[_0x31a814];return _0x273671;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var moment=require('moment');var BPromise=require(_0xd581('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd581('0x3'));var db=require(_0xd581('0x4'))['db'];var utils=require(_0xd581('0x5'));var logger=require(_0xd581('0x6'))(_0xd581('0x7'));var config=require(_0xd581('0x8'));var jayson=require(_0xd581('0x9'));var client=jayson['client'][_0xd581('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2bfc,_0x10caad,_0x26f735){return new BPromise(function(_0x1a2923,_0x1b6bd2){return client[_0xd581('0xb')](_0x4a2bfc,_0x26f735)[_0xd581('0xc')](function(_0xe842c9){logger[_0xd581('0xd')](_0xd581('0xe'),_0x10caad,_0xd581('0xf'));logger[_0xd581('0x10')](_0xd581('0x11'),_0x10caad,'request\x20sent',JSON[_0xd581('0x12')](_0xe842c9));if(_0xe842c9[_0xd581('0x13')]){if(_0xe842c9[_0xd581('0x13')][_0xd581('0x14')]===0x1f4){logger[_0xd581('0x13')]('SquareRecording,\x20%s,\x20%s',_0x10caad,_0xe842c9[_0xd581('0x13')][_0xd581('0x15')]);return _0x1b6bd2(_0xe842c9['error'][_0xd581('0x15')]);}logger[_0xd581('0x13')](_0xd581('0xe'),_0x10caad,_0xe842c9[_0xd581('0x13')]['message']);return _0x1a2923(_0xe842c9[_0xd581('0x13')][_0xd581('0x15')]);}else{logger[_0xd581('0xd')](_0xd581('0xe'),_0x10caad,'request\x20sent');_0x1a2923(_0xe842c9['result'][_0xd581('0x15')]);}})[_0xd581('0x16')](function(_0x535c79){logger[_0xd581('0x13')](_0xd581('0xe'),_0x10caad,_0x535c79);_0x1b6bd2(_0x535c79);});});}exports[_0xd581('0x17')]=function(_0x49c585){var _0x41033a=this;return new Promise(function(_0x1e880d,_0x452b55){return db[_0xd581('0x18')][_0xd581('0x19')](_0x49c585['body'],{'raw':_0x49c585[_0xd581('0x1a')]?_0x49c585[_0xd581('0x1a')][_0xd581('0x1b')]===undefined?!![]:![]:!![]})[_0xd581('0xc')](function(_0x533d7f){logger[_0xd581('0xd')](_0xd581('0x17'),_0x49c585);logger[_0xd581('0x10')](_0xd581('0x17'),_0x49c585,JSON[_0xd581('0x12')](_0x533d7f));_0x1e880d(_0x533d7f);})[_0xd581('0x16')](function(_0x4ea4a1){logger['error']('CreateSquareRecording',_0x4ea4a1[_0xd581('0x15')],_0x49c585);_0x452b55(_0x41033a[_0xd581('0x13')](0x1f4,_0x4ea4a1[_0xd581('0x15')]));});});}; \ No newline at end of file +var _0xc67b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareRecording','create','options','raw','CreateSquareRecording','catch','lodash','util','moment'];(function(_0x4b3231,_0x1a4a92){var _0x52290=function(_0x118d71){while(--_0x118d71){_0x4b3231['push'](_0x4b3231['shift']());}};_0x52290(++_0x1a4a92);}(_0xc67b,0x1b0));var _0xbc67=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc67b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var moment=require(_0xbc67('0x2'));var BPromise=require(_0xbc67('0x3'));var rs=require(_0xbc67('0x4'));var fs=require('fs');var Redis=require(_0xbc67('0x5'));var db=require(_0xbc67('0x6'))['db'];var utils=require(_0xbc67('0x7'));var logger=require(_0xbc67('0x8'))(_0xbc67('0x9'));var config=require(_0xbc67('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbc67('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d694,_0x557c07,_0x223d46){return new BPromise(function(_0x4f8dd1,_0xd670f3){return client['request'](_0x13d694,_0x223d46)[_0xbc67('0xc')](function(_0x2a1107){logger[_0xbc67('0xd')](_0xbc67('0xe'),_0x557c07,_0xbc67('0xf'));logger[_0xbc67('0x10')](_0xbc67('0x11'),_0x557c07,_0xbc67('0xf'),JSON[_0xbc67('0x12')](_0x2a1107));if(_0x2a1107[_0xbc67('0x13')]){if(_0x2a1107[_0xbc67('0x13')][_0xbc67('0x14')]===0x1f4){logger['error'](_0xbc67('0xe'),_0x557c07,_0x2a1107['error']['message']);return _0xd670f3(_0x2a1107[_0xbc67('0x13')][_0xbc67('0x15')]);}logger[_0xbc67('0x13')]('SquareRecording,\x20%s,\x20%s',_0x557c07,_0x2a1107[_0xbc67('0x13')][_0xbc67('0x15')]);return _0x4f8dd1(_0x2a1107['error'][_0xbc67('0x15')]);}else{logger[_0xbc67('0xd')](_0xbc67('0xe'),_0x557c07,_0xbc67('0xf'));_0x4f8dd1(_0x2a1107[_0xbc67('0x16')][_0xbc67('0x15')]);}})['catch'](function(_0x416f9f){logger[_0xbc67('0x13')]('SquareRecording,\x20%s,\x20%s',_0x557c07,_0x416f9f);_0xd670f3(_0x416f9f);});});}exports['CreateSquareRecording']=function(_0x553598){var _0x3e2b49=this;return new Promise(function(_0x538e11,_0x21ae86){return db[_0xbc67('0x17')][_0xbc67('0x18')](_0x553598['body'],{'raw':_0x553598['options']?_0x553598[_0xbc67('0x19')][_0xbc67('0x1a')]===undefined?!![]:![]:!![]})[_0xbc67('0xc')](function(_0x4829ab){logger['info'](_0xbc67('0x1b'),_0x553598);logger['debug'](_0xbc67('0x1b'),_0x553598,JSON[_0xbc67('0x12')](_0x4829ab));_0x538e11(_0x4829ab);})[_0xbc67('0x1c')](function(_0x57bbcd){logger['error'](_0xbc67('0x1b'),_0x57bbcd[_0xbc67('0x15')],_0x553598);_0x21ae86(_0x3e2b49[_0xbc67('0x13')](0x1f4,_0x57bbcd[_0xbc67('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index af2cf6c..988e8b5 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 _0x2944=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x54eaf9,_0x3e2c97){var _0xbf4e8a=function(_0x1adae6){while(--_0x1adae6){_0x54eaf9['push'](_0x54eaf9['shift']());}};_0xbf4e8a(++_0x3e2c97);}(_0x2944,0x79));var _0x4294=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x2944[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x4294('0x0'));var util=require(_0x4294('0x1'));var path=require(_0x4294('0x2'));var timeout=require(_0x4294('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4294('0x4'));var config=require(_0x4294('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4294('0x6')]);router[_0x4294('0x7')](_0x4294('0x8'),auth[_0x4294('0x9')](),controller[_0x4294('0xa')]);router['get'](_0x4294('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4294('0xc')]('/',auth[_0x4294('0x9')](),controller[_0x4294('0xd')]);router[_0x4294('0xe')]('/:id',auth[_0x4294('0x9')](),controller[_0x4294('0xf')]);router[_0x4294('0x10')](_0x4294('0xb'),auth[_0x4294('0x9')](),controller[_0x4294('0x11')]);module[_0x4294('0x12')]=router; \ No newline at end of file +var _0xcaee=['exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','describe','isAuthenticated','show','post','create','put','update','delete','/:id','destroy'];(function(_0x5bc9d2,_0x4bce2d){var _0x7aef6c=function(_0x511ce7){while(--_0x511ce7){_0x5bc9d2['push'](_0x5bc9d2['shift']());}};_0x7aef6c(++_0x4bce2d);}(_0xcaee,0x141));var _0xecae=function(_0x7e1b59,_0x5bd248){_0x7e1b59=_0x7e1b59-0x0;var _0x290924=_0xcaee[_0x7e1b59];return _0x290924;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xecae('0x0'));var timeout=require(_0xecae('0x1'));var express=require(_0xecae('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xecae('0x3'));var config=require(_0xecae('0x4'));var controller=require(_0xecae('0x5'));router[_0xecae('0x6')]('/',auth['isAuthenticated'](),controller[_0xecae('0x7')]);router[_0xecae('0x6')](_0xecae('0x8'),auth['isAuthenticated'](),controller[_0xecae('0x9')]);router['get']('/:id',auth[_0xecae('0xa')](),controller[_0xecae('0xb')]);router[_0xecae('0xc')]('/',auth[_0xecae('0xa')](),controller[_0xecae('0xd')]);router[_0xecae('0xe')]('/:id',auth[_0xecae('0xa')](),controller[_0xecae('0xf')]);router[_0xecae('0x10')](_0xecae('0x11'),auth['isAuthenticated'](),controller[_0xecae('0x12')]);module[_0xecae('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a7261ed..ac7e1d6 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 _0xf746=['BOOLEAN','exports','STRING','DATE'];(function(_0x42318b,_0x3cb810){var _0x48d24b=function(_0x3c341c){while(--_0x3c341c){_0x42318b['push'](_0x42318b['shift']());}};_0x48d24b(++_0x3cb810);}(_0xf746,0x161));var _0x6f74=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf746[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x6f74('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6f74('0x1')]},'request':{'type':Sequelize[_0x6f74('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6f74('0x1')]},'type':{'type':Sequelize[_0x6f74('0x1')]},'uniqueid':{'type':Sequelize[_0x6f74('0x1')]},'version':{'type':Sequelize[_0x6f74('0x1')]},'callerid':{'type':Sequelize[_0x6f74('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6f74('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6f74('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6f74('0x1')]},'rdnis':{'type':Sequelize[_0x6f74('0x1')]},'context':{'type':Sequelize[_0x6f74('0x1')]},'extension':{'type':Sequelize[_0x6f74('0x1')]},'priority':{'type':Sequelize[_0x6f74('0x1')]},'enhanced':{'type':Sequelize[_0x6f74('0x1')]},'accountcode':{'type':Sequelize[_0x6f74('0x1')]},'threadid':{'type':Sequelize[_0x6f74('0x1')]},'project_name':{'type':Sequelize[_0x6f74('0x1')]},'joinAt':{'type':Sequelize[_0x6f74('0x2')]},'leaveAt':{'type':Sequelize[_0x6f74('0x2')]},'bot':{'type':Sequelize[_0x6f74('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ca5=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x27a2e4,_0x4749d1){var _0x3acf63=function(_0x2afd9b){while(--_0x2afd9b){_0x27a2e4['push'](_0x27a2e4['shift']());}};_0x3acf63(++_0x4749d1);}(_0x4ca5,0xc1));var _0x54ca=function(_0x1426e9,_0x317d83){_0x1426e9=_0x1426e9-0x0;var _0x59eddd=_0x4ca5[_0x1426e9];return _0x59eddd;};'use strict';var Sequelize=require(_0x54ca('0x0'));module[_0x54ca('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x54ca('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x54ca('0x2')]},'type':{'type':Sequelize[_0x54ca('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x54ca('0x2')]},'callerid':{'type':Sequelize[_0x54ca('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x54ca('0x2')]},'callingani2':{'type':Sequelize[_0x54ca('0x2')]},'callington':{'type':Sequelize[_0x54ca('0x2')]},'callingtns':{'type':Sequelize[_0x54ca('0x2')]},'dnid':{'type':Sequelize[_0x54ca('0x2')]},'rdnis':{'type':Sequelize[_0x54ca('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x54ca('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x54ca('0x2')]},'accountcode':{'type':Sequelize[_0x54ca('0x2')]},'threadid':{'type':Sequelize[_0x54ca('0x2')]},'project_name':{'type':Sequelize[_0x54ca('0x2')]},'joinAt':{'type':Sequelize[_0x54ca('0x3')]},'leaveAt':{'type':Sequelize[_0x54ca('0x3')]},'bot':{'type':Sequelize[_0x54ca('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 0d3583c..1043802 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 _0x1249=['reject','save','update','destroy','then','error','name','send','index','SquareReport','rawAttributes','fieldName','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x2b2b6a,_0x41ad85){var _0x290591=function(_0x1ce651){while(--_0x1ce651){_0x2b2b6a['push'](_0x2b2b6a['shift']());}};_0x290591(++_0x41ad85);}(_0x1249,0x1ab));var _0x9124=function(_0x1749ab,_0x4cb0fd){_0x1749ab=_0x1749ab-0x0;var _0x2ef967=_0x1249[_0x1749ab];return _0x2ef967;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9124('0x0'));var jsonpatch=require(_0x9124('0x1'));var rp=require(_0x9124('0x2'));var moment=require(_0x9124('0x3'));var BPromise=require(_0x9124('0x4'));var Mustache=require(_0x9124('0x5'));var util=require(_0x9124('0x6'));var path=require(_0x9124('0x7'));var sox=require(_0x9124('0x8'));var csv=require(_0x9124('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9124('0xa'));var crypto=require(_0x9124('0xb'));var jsforce=require(_0x9124('0xc'));var deskjs=require(_0x9124('0xd'));var toCsv=require(_0x9124('0x9'));var querystring=require(_0x9124('0xe'));var Papa=require(_0x9124('0xf'));var Redis=require(_0x9124('0x10'));var authService=require(_0x9124('0x11'));var qs=require(_0x9124('0x12'));var as=require(_0x9124('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9124('0x14'))(_0x9124('0x15'));var utils=require(_0x9124('0x16'));var config=require(_0x9124('0x17'));var db=require(_0x9124('0x18'))['db'];function respondWithStatusCode(_0x90a3c5,_0x2e30f6){_0x2e30f6=_0x2e30f6||0xcc;return function(_0x4a9bc4){if(_0x4a9bc4){return _0x90a3c5[_0x9124('0x19')](_0x2e30f6);}return _0x90a3c5[_0x9124('0x1a')](_0x2e30f6)[_0x9124('0x1b')]();};}function respondWithResult(_0x15c850,_0x1d0ccc){_0x1d0ccc=_0x1d0ccc||0xc8;return function(_0x11acdb){if(_0x11acdb){return _0x15c850['status'](_0x1d0ccc)[_0x9124('0x1c')](_0x11acdb);}};}function respondWithFilteredResult(_0x4d59ee,_0x4e3c26){return function(_0x52a3a2){if(_0x52a3a2){var _0x32e801=_0x52a3a2[_0x9124('0x1d')],_0x380325=_0x4e3c26['offset'],_0x24a9dd=_0x4e3c26[_0x9124('0x1e')]+_0x4e3c26[_0x9124('0x1f')],_0x2d5ffb;if(_0x24a9dd>=_0x32e801){_0x24a9dd=_0x32e801;_0x2d5ffb=0xc8;}else{_0x2d5ffb=0xce;}_0x4d59ee[_0x9124('0x1a')](_0x2d5ffb);return _0x4d59ee[_0x9124('0x20')](_0x9124('0x21'),_0x380325+'-'+_0x24a9dd+'/'+_0x32e801)[_0x9124('0x1c')](_0x52a3a2);}return null;};}function patchUpdates(_0xf11a3e){return function(_0x4fe743){try{jsonpatch[_0x9124('0x22')](_0x4fe743,_0xf11a3e,!![]);}catch(_0x227ab6){return BPromise[_0x9124('0x23')](_0x227ab6);}return _0x4fe743[_0x9124('0x24')]();};}function saveUpdates(_0x1411df,_0x36859a){return function(_0x5be69d){if(_0x5be69d){return _0x5be69d[_0x9124('0x25')](_0x1411df)['then'](function(_0x3b7969){return _0x3b7969;});}return null;};}function removeEntity(_0x5edbf9,_0xb0aef8){return function(_0x2e11d8){if(_0x2e11d8){return _0x2e11d8[_0x9124('0x26')]()[_0x9124('0x27')](function(){_0x5edbf9[_0x9124('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b79c,_0x49439b){return function(_0x2e2ef8){if(!_0x2e2ef8){_0x40b79c[_0x9124('0x19')](0x194);}return _0x2e2ef8;};}function handleError(_0x553f70,_0x1f9d18){_0x1f9d18=_0x1f9d18||0x1f4;return function(_0xe96d88){logger[_0x9124('0x28')](_0xe96d88['stack']);if(_0xe96d88[_0x9124('0x29')]){delete _0xe96d88['name'];}_0x553f70['status'](_0x1f9d18)[_0x9124('0x2a')](_0xe96d88);};}exports[_0x9124('0x2b')]=function(_0x5218ce,_0x29168e){var _0x553857={},_0x25fd8f={},_0x5623c5={'count':0x0,'rows':[]};var _0x18de5d=_['map'](db[_0x9124('0x2c')][_0x9124('0x2d')],function(_0x48f736){return{'name':_0x48f736[_0x9124('0x2e')],'type':_0x48f736['type'][_0x9124('0x2f')]};});_0x25fd8f['model']=_[_0x9124('0x30')](_0x18de5d,'name');_0x25fd8f['query']=_[_0x9124('0x31')](_0x5218ce['query']);_0x25fd8f[_0x9124('0x32')]=_[_0x9124('0x33')](_0x25fd8f[_0x9124('0x34')],_0x25fd8f[_0x9124('0x35')]);_0x553857['attributes']=_['intersection'](_0x25fd8f['model'],qs[_0x9124('0x36')](_0x5218ce[_0x9124('0x35')][_0x9124('0x36')]));_0x553857[_0x9124('0x37')]=_0x553857['attributes'][_0x9124('0x38')]?_0x553857[_0x9124('0x37')]:_0x25fd8f[_0x9124('0x34')];if(!_0x5218ce[_0x9124('0x35')][_0x9124('0x39')](_0x9124('0x3a'))){_0x553857[_0x9124('0x1f')]=qs[_0x9124('0x1f')](_0x5218ce['query'][_0x9124('0x1f')]);_0x553857[_0x9124('0x1e')]=qs[_0x9124('0x1e')](_0x5218ce['query'][_0x9124('0x1e')]);}_0x553857[_0x9124('0x3b')]=qs[_0x9124('0x3c')](_0x5218ce[_0x9124('0x35')][_0x9124('0x3c')]);_0x553857[_0x9124('0x3d')]=qs['filters'](_[_0x9124('0x3e')](_0x5218ce['query'],_0x25fd8f[_0x9124('0x32')]),_0x18de5d);if(_0x5218ce[_0x9124('0x35')][_0x9124('0x3f')]){_0x553857[_0x9124('0x3d')]=_[_0x9124('0x40')](_0x553857[_0x9124('0x3d')],{'$or':_[_0x9124('0x30')](_0x18de5d,function(_0x2c634d){if(_0x2c634d[_0x9124('0x41')]!==_0x9124('0x42')){var _0x39fb3a={};_0x39fb3a[_0x2c634d[_0x9124('0x29')]]={'$like':'%'+_0x5218ce['query'][_0x9124('0x3f')]+'%'};return _0x39fb3a;}})});}_0x553857=_[_0x9124('0x40')]({},_0x553857,_0x5218ce[_0x9124('0x43')]);var _0xf2f2cb={'where':_0x553857[_0x9124('0x3d')]};return db['SquareReport'][_0x9124('0x1d')](_0xf2f2cb)['then'](function(_0x5dd99d){_0x5623c5['count']=_0x5dd99d;if(_0x5218ce[_0x9124('0x35')][_0x9124('0x44')]){_0x553857['include']=[{'all':!![]}];}return db['SquareReport'][_0x9124('0x45')](_0x553857);})[_0x9124('0x27')](function(_0x3b4a36){_0x5623c5['rows']=_0x3b4a36;return _0x5623c5;})['then'](respondWithFilteredResult(_0x29168e,_0x553857))[_0x9124('0x46')](handleError(_0x29168e,null));};exports[_0x9124('0x47')]=function(_0x5c8ce3,_0x2c794f){var _0x43b53e={'raw':!![],'where':{'id':_0x5c8ce3['params']['id']}},_0x17c2ae={};_0x17c2ae[_0x9124('0x34')]=_[_0x9124('0x31')](db[_0x9124('0x2c')]['rawAttributes']);_0x17c2ae[_0x9124('0x35')]=_[_0x9124('0x31')](_0x5c8ce3[_0x9124('0x35')]);_0x17c2ae[_0x9124('0x32')]=_[_0x9124('0x33')](_0x17c2ae[_0x9124('0x34')],_0x17c2ae[_0x9124('0x35')]);_0x43b53e[_0x9124('0x37')]=_[_0x9124('0x33')](_0x17c2ae['model'],qs[_0x9124('0x36')](_0x5c8ce3[_0x9124('0x35')][_0x9124('0x36')]));_0x43b53e[_0x9124('0x37')]=_0x43b53e[_0x9124('0x37')][_0x9124('0x38')]?_0x43b53e[_0x9124('0x37')]:_0x17c2ae[_0x9124('0x34')];if(_0x5c8ce3[_0x9124('0x35')][_0x9124('0x44')]){_0x43b53e['include']=[{'all':!![]}];}_0x43b53e=_[_0x9124('0x40')]({},_0x43b53e,_0x5c8ce3['options']);return db[_0x9124('0x2c')][_0x9124('0x48')](_0x43b53e)[_0x9124('0x27')](handleEntityNotFound(_0x2c794f,null))[_0x9124('0x27')](respondWithResult(_0x2c794f,null))[_0x9124('0x46')](handleError(_0x2c794f,null));};exports[_0x9124('0x49')]=function(_0x3f2c48,_0x20c2e9){return db[_0x9124('0x2c')][_0x9124('0x49')](_0x3f2c48[_0x9124('0x4a')],{})['then'](respondWithResult(_0x20c2e9,0xc9))[_0x9124('0x46')](handleError(_0x20c2e9,null));};exports['update']=function(_0x3aac8d,_0x21f849){if(_0x3aac8d[_0x9124('0x4a')]['id']){delete _0x3aac8d['body']['id'];}return db[_0x9124('0x2c')][_0x9124('0x48')]({'where':{'id':_0x3aac8d[_0x9124('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21f849,null))[_0x9124('0x27')](saveUpdates(_0x3aac8d[_0x9124('0x4a')],null))[_0x9124('0x27')](respondWithResult(_0x21f849,null))[_0x9124('0x46')](handleError(_0x21f849,null));};exports[_0x9124('0x26')]=function(_0xde5a5c,_0x4b9d6b){return db[_0x9124('0x2c')][_0x9124('0x48')]({'where':{'id':_0xde5a5c[_0x9124('0x4b')]['id']}})[_0x9124('0x27')](handleEntityNotFound(_0x4b9d6b,null))['then'](removeEntity(_0x4b9d6b,null))[_0x9124('0x46')](handleError(_0x4b9d6b,null));};exports[_0x9124('0x4c')]=function(_0x1ce0c2,_0x382d8f){return db[_0x9124('0x2c')][_0x9124('0x4c')]()[_0x9124('0x27')](respondWithResult(_0x382d8f,null))[_0x9124('0x46')](handleError(_0x382d8f,null));}; \ No newline at end of file +var _0xacf7=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','json','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','rows','show','options','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x55b481,_0x224fd2){var _0x437640=function(_0xac85b9){while(--_0xac85b9){_0x55b481['push'](_0x55b481['shift']());}};_0x437640(++_0x224fd2);}(_0xacf7,0x161));var _0x7acf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xacf7[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x7acf('0x0'));var emlformat=require(_0x7acf('0x1'));var rimraf=require(_0x7acf('0x2'));var zipdir=require(_0x7acf('0x3'));var jsonpatch=require(_0x7acf('0x4'));var rp=require(_0x7acf('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7acf('0x6'));var util=require('util');var path=require(_0x7acf('0x7'));var sox=require('sox');var csv=require(_0x7acf('0x8'));var ejs=require(_0x7acf('0x9'));var fs=require('fs');var _=require(_0x7acf('0xa'));var squel=require(_0x7acf('0xb'));var crypto=require(_0x7acf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7acf('0xd'));var toCsv=require(_0x7acf('0x8'));var querystring=require(_0x7acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x7acf('0xf'));var authService=require(_0x7acf('0x10'));var qs=require(_0x7acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7acf('0x12'));var logger=require(_0x7acf('0x13'))(_0x7acf('0x14'));var utils=require(_0x7acf('0x15'));var config=require(_0x7acf('0x16'));var db=require(_0x7acf('0x17'))['db'];function respondWithStatusCode(_0x30c9aa,_0x17b960){_0x17b960=_0x17b960||0xcc;return function(_0x4f0f71){if(_0x4f0f71){return _0x30c9aa[_0x7acf('0x18')](_0x17b960);}return _0x30c9aa['status'](_0x17b960)[_0x7acf('0x19')]();};}function respondWithResult(_0x3ab460,_0x13e301){_0x13e301=_0x13e301||0xc8;return function(_0x10c2d8){if(_0x10c2d8){return _0x3ab460[_0x7acf('0x1a')](_0x13e301)['json'](_0x10c2d8);}};}function respondWithFilteredResult(_0x5504b8,_0x1333ce){return function(_0x5e0169){if(_0x5e0169){var _0x54c1b7=_0x5e0169['count'],_0x649d96=_0x1333ce[_0x7acf('0x1b')],_0x2ba6b6=_0x1333ce[_0x7acf('0x1b')]+_0x1333ce[_0x7acf('0x1c')],_0x5c4aa4;if(_0x2ba6b6>=_0x54c1b7){_0x2ba6b6=_0x54c1b7;_0x5c4aa4=0xc8;}else{_0x5c4aa4=0xce;}_0x5504b8['status'](_0x5c4aa4);return _0x5504b8[_0x7acf('0x1d')]('Content-Range',_0x649d96+'-'+_0x2ba6b6+'/'+_0x54c1b7)[_0x7acf('0x1e')](_0x5e0169);}return null;};}function patchUpdates(_0x3c596a){return function(_0x4e8570){try{jsonpatch['apply'](_0x4e8570,_0x3c596a,!![]);}catch(_0x34d039){return BPromise[_0x7acf('0x1f')](_0x34d039);}return _0x4e8570[_0x7acf('0x20')]();};}function saveUpdates(_0x9818a,_0x2b98e9){return function(_0x364992){if(_0x364992){return _0x364992[_0x7acf('0x21')](_0x9818a)[_0x7acf('0x22')](function(_0x16e4bd){return _0x16e4bd;});}return null;};}function removeEntity(_0xa11427,_0x2d7a2d){return function(_0x3d54fd){if(_0x3d54fd){return _0x3d54fd['destroy']()[_0x7acf('0x22')](function(){_0xa11427['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x214dbc,_0x412a1e){return function(_0x1e8025){if(!_0x1e8025){_0x214dbc[_0x7acf('0x18')](0x194);}return _0x1e8025;};}function handleError(_0x2e8ebc,_0x3e9d67){_0x3e9d67=_0x3e9d67||0x1f4;return function(_0x4acda1){logger[_0x7acf('0x23')](_0x4acda1[_0x7acf('0x24')]);if(_0x4acda1['name']){delete _0x4acda1[_0x7acf('0x25')];}_0x2e8ebc['status'](_0x3e9d67)[_0x7acf('0x26')](_0x4acda1);};}exports[_0x7acf('0x27')]=function(_0x41d7bb,_0xe0c8ee){var _0x5ca95f={},_0x405548={},_0x1d085f={'count':0x0,'rows':[]};var _0x1bae9c=_['map'](db[_0x7acf('0x28')][_0x7acf('0x29')],function(_0x76d1af){return{'name':_0x76d1af[_0x7acf('0x2a')],'type':_0x76d1af[_0x7acf('0x2b')][_0x7acf('0x2c')]};});_0x405548[_0x7acf('0x2d')]=_[_0x7acf('0x2e')](_0x1bae9c,_0x7acf('0x25'));_0x405548['query']=_[_0x7acf('0x2f')](_0x41d7bb[_0x7acf('0x30')]);_0x405548[_0x7acf('0x31')]=_[_0x7acf('0x32')](_0x405548[_0x7acf('0x2d')],_0x405548['query']);_0x5ca95f[_0x7acf('0x33')]=_[_0x7acf('0x32')](_0x405548[_0x7acf('0x2d')],qs[_0x7acf('0x34')](_0x41d7bb[_0x7acf('0x30')]['fields']));_0x5ca95f['attributes']=_0x5ca95f[_0x7acf('0x33')][_0x7acf('0x35')]?_0x5ca95f[_0x7acf('0x33')]:_0x405548['model'];if(!_0x41d7bb[_0x7acf('0x30')][_0x7acf('0x36')]('nolimit')){_0x5ca95f[_0x7acf('0x1c')]=qs[_0x7acf('0x1c')](_0x41d7bb[_0x7acf('0x30')]['limit']);_0x5ca95f[_0x7acf('0x1b')]=qs['offset'](_0x41d7bb[_0x7acf('0x30')][_0x7acf('0x1b')]);}_0x5ca95f[_0x7acf('0x37')]=qs[_0x7acf('0x38')](_0x41d7bb['query'][_0x7acf('0x38')]);_0x5ca95f[_0x7acf('0x39')]=qs[_0x7acf('0x31')](_[_0x7acf('0x3a')](_0x41d7bb[_0x7acf('0x30')],_0x405548[_0x7acf('0x31')]),_0x1bae9c);if(_0x41d7bb['query'][_0x7acf('0x3b')]){_0x5ca95f['where']=_['merge'](_0x5ca95f['where'],{'$or':_[_0x7acf('0x2e')](_0x1bae9c,function(_0x31fe40){if(_0x31fe40[_0x7acf('0x2b')]!=='VIRTUAL'){var _0x529d6f={};_0x529d6f[_0x31fe40[_0x7acf('0x25')]]={'$like':'%'+_0x41d7bb['query'][_0x7acf('0x3b')]+'%'};return _0x529d6f;}})});}_0x5ca95f=_[_0x7acf('0x3c')]({},_0x5ca95f,_0x41d7bb['options']);var _0x3267ed={'where':_0x5ca95f['where']};return db[_0x7acf('0x28')][_0x7acf('0x3d')](_0x3267ed)['then'](function(_0x28e2e5){_0x1d085f[_0x7acf('0x3d')]=_0x28e2e5;if(_0x41d7bb[_0x7acf('0x30')][_0x7acf('0x3e')]){_0x5ca95f[_0x7acf('0x3f')]=[{'all':!![]}];}return db[_0x7acf('0x28')]['findAll'](_0x5ca95f);})[_0x7acf('0x22')](function(_0x1641a9){_0x1d085f[_0x7acf('0x40')]=_0x1641a9;return _0x1d085f;})[_0x7acf('0x22')](respondWithFilteredResult(_0xe0c8ee,_0x5ca95f))['catch'](handleError(_0xe0c8ee,null));};exports[_0x7acf('0x41')]=function(_0x50a58d,_0x8f5f83){var _0x554306={'raw':!![],'where':{'id':_0x50a58d['params']['id']}},_0x47288e={};_0x47288e[_0x7acf('0x2d')]=_['keys'](db[_0x7acf('0x28')][_0x7acf('0x29')]);_0x47288e[_0x7acf('0x30')]=_[_0x7acf('0x2f')](_0x50a58d[_0x7acf('0x30')]);_0x47288e[_0x7acf('0x31')]=_[_0x7acf('0x32')](_0x47288e[_0x7acf('0x2d')],_0x47288e['query']);_0x554306[_0x7acf('0x33')]=_['intersection'](_0x47288e[_0x7acf('0x2d')],qs[_0x7acf('0x34')](_0x50a58d[_0x7acf('0x30')][_0x7acf('0x34')]));_0x554306['attributes']=_0x554306['attributes']['length']?_0x554306[_0x7acf('0x33')]:_0x47288e[_0x7acf('0x2d')];if(_0x50a58d[_0x7acf('0x30')][_0x7acf('0x3e')]){_0x554306[_0x7acf('0x3f')]=[{'all':!![]}];}_0x554306=_[_0x7acf('0x3c')]({},_0x554306,_0x50a58d[_0x7acf('0x42')]);return db[_0x7acf('0x28')][_0x7acf('0x43')](_0x554306)[_0x7acf('0x22')](handleEntityNotFound(_0x8f5f83,null))[_0x7acf('0x22')](respondWithResult(_0x8f5f83,null))[_0x7acf('0x44')](handleError(_0x8f5f83,null));};exports[_0x7acf('0x45')]=function(_0x1b87a9,_0x390578){return db[_0x7acf('0x28')][_0x7acf('0x45')](_0x1b87a9[_0x7acf('0x46')],{})[_0x7acf('0x22')](respondWithResult(_0x390578,0xc9))[_0x7acf('0x44')](handleError(_0x390578,null));};exports['update']=function(_0x4630c3,_0x9e4ba0){if(_0x4630c3[_0x7acf('0x46')]['id']){delete _0x4630c3[_0x7acf('0x46')]['id'];}return db[_0x7acf('0x28')][_0x7acf('0x43')]({'where':{'id':_0x4630c3[_0x7acf('0x47')]['id']}})[_0x7acf('0x22')](handleEntityNotFound(_0x9e4ba0,null))[_0x7acf('0x22')](saveUpdates(_0x4630c3['body'],null))[_0x7acf('0x22')](respondWithResult(_0x9e4ba0,null))['catch'](handleError(_0x9e4ba0,null));};exports[_0x7acf('0x48')]=function(_0x2a9bf0,_0x4a3695){return db[_0x7acf('0x28')][_0x7acf('0x43')]({'where':{'id':_0x2a9bf0['params']['id']}})[_0x7acf('0x22')](handleEntityNotFound(_0x4a3695,null))['then'](removeEntity(_0x4a3695,null))[_0x7acf('0x44')](handleError(_0x4a3695,null));};exports[_0x7acf('0x49')]=function(_0x425228,_0x572778){return db['SquareReport']['describe']()[_0x7acf('0x22')](respondWithResult(_0x572778,null))['catch'](handleError(_0x572778,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5435841..d8156ac 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 _0x989d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x989d,0x96));var _0xd989=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x989d[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xd989('0x0'));var util=require(_0xd989('0x1'));var logger=require(_0xd989('0x2'))(_0xd989('0x3'));var moment=require(_0xd989('0x4'));var BPromise=require(_0xd989('0x5'));var rp=require(_0xd989('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd989('0x7'));var config=require(_0xd989('0x8'));var attributes=require(_0xd989('0x9'));module[_0xd989('0xa')]=function(_0x59f745,_0x4eb096){return _0x59f745[_0xd989('0xb')]('SquareReport',attributes,{'tableName':_0xd989('0xc'),'paranoid':![],'indexes':[{'name':_0xd989('0xd'),'fields':[_0xd989('0xe'),_0xd989('0xf')]},{'name':_0xd989('0x10'),'fields':[_0xd989('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2440=['define','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path','./squareReport.attributes'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x2440,0x123));var _0x0244=function(_0x13215a,_0x526999){_0x13215a=_0x13215a-0x0;var _0x27feb6=_0x2440[_0x13215a];return _0x27feb6;};'use strict';var _=require('lodash');var util=require(_0x0244('0x0'));var logger=require(_0x0244('0x1'))(_0x0244('0x2'));var moment=require(_0x0244('0x3'));var BPromise=require(_0x0244('0x4'));var rp=require(_0x0244('0x5'));var fs=require('fs');var path=require(_0x0244('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0244('0x7'));module['exports']=function(_0x236b10,_0x2c1c9d){return _0x236b10[_0x0244('0x8')]('SquareReport',attributes,{'tableName':_0x0244('0x9'),'paranoid':![],'indexes':[{'name':_0x0244('0xa'),'fields':[_0x0244('0xb'),'project_name']},{'name':'leaveAt','fields':[_0x0244('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0556d50..d767cd9 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 _0xf342=['SquareReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','SquareReport','update','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x5a252f,_0x9b355d){var _0x246e5e=function(_0x3a3c3d){while(--_0x3a3c3d){_0x5a252f['push'](_0x5a252f['shift']());}};_0x246e5e(++_0x9b355d);}(_0xf342,0xa7));var _0x2f34=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf342[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2f34('0x0'));var util=require('util');var moment=require(_0x2f34('0x1'));var BPromise=require(_0x2f34('0x2'));var rs=require(_0x2f34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f34('0x4'))['db'];var utils=require(_0x2f34('0x5'));var logger=require(_0x2f34('0x6'))(_0x2f34('0x7'));var config=require(_0x2f34('0x8'));var jayson=require(_0x2f34('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24e809,_0x56fcf5,_0xaa4964){return new BPromise(function(_0x4e23c8,_0x27522e){return client[_0x2f34('0xa')](_0x24e809,_0xaa4964)[_0x2f34('0xb')](function(_0x3ba873){logger[_0x2f34('0xc')](_0x2f34('0xd'),_0x56fcf5,'request\x20sent');logger[_0x2f34('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x56fcf5,'request\x20sent',JSON[_0x2f34('0xf')](_0x3ba873));if(_0x3ba873[_0x2f34('0x10')]){if(_0x3ba873['error'][_0x2f34('0x11')]===0x1f4){logger[_0x2f34('0x10')](_0x2f34('0xd'),_0x56fcf5,_0x3ba873[_0x2f34('0x10')][_0x2f34('0x12')]);return _0x27522e(_0x3ba873[_0x2f34('0x10')][_0x2f34('0x12')]);}logger[_0x2f34('0x10')]('SquareReport,\x20%s,\x20%s',_0x56fcf5,_0x3ba873[_0x2f34('0x10')][_0x2f34('0x12')]);return _0x4e23c8(_0x3ba873[_0x2f34('0x10')][_0x2f34('0x12')]);}else{logger[_0x2f34('0xc')](_0x2f34('0xd'),_0x56fcf5,_0x2f34('0x13'));_0x4e23c8(_0x3ba873[_0x2f34('0x14')]['message']);}})[_0x2f34('0x15')](function(_0x4e24e6){logger[_0x2f34('0x10')](_0x2f34('0xd'),_0x56fcf5,_0x4e24e6);_0x27522e(_0x4e24e6);});});}exports[_0x2f34('0x16')]=function(_0x56e48f){var _0x1e715c=this;return new Promise(function(_0xf453ea,_0x15a1a0){return db['SquareReport'][_0x2f34('0x17')](_0x56e48f[_0x2f34('0x18')],{'raw':_0x56e48f[_0x2f34('0x19')]?_0x56e48f[_0x2f34('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2f34('0xb')](function(_0xa86290){logger['info'](_0x2f34('0x16'),_0x56e48f);logger[_0x2f34('0xe')]('CreateSquareReport',_0x56e48f,JSON[_0x2f34('0xf')](_0xa86290));_0xf453ea(_0xa86290);})[_0x2f34('0x15')](function(_0x500688){logger[_0x2f34('0x10')](_0x2f34('0x16'),_0x500688[_0x2f34('0x12')],_0x56e48f);_0x15a1a0(_0x1e715c['error'](0x1f4,_0x500688[_0x2f34('0x12')]));});});};exports[_0x2f34('0x1a')]=function(_0xdd70d7){var _0x16f5ef=this;return new Promise(function(_0x564a86,_0x4c8e97){return db[_0x2f34('0x1b')][_0x2f34('0x1c')](_0xdd70d7[_0x2f34('0x18')],{'raw':_0xdd70d7['options']?_0xdd70d7['options'][_0x2f34('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdd70d7['options']?_0xdd70d7[_0x2f34('0x19')]['where']||null:null,'attributes':_0xdd70d7['options']?_0xdd70d7['options']['attributes']||null:null,'limit':_0xdd70d7[_0x2f34('0x19')]?_0xdd70d7[_0x2f34('0x19')]['limit']||null:null})[_0x2f34('0xb')](function(_0x38656f){logger[_0x2f34('0xc')](_0x2f34('0x1a'),_0xdd70d7);logger['debug'](_0x2f34('0x1a'),_0xdd70d7,JSON[_0x2f34('0xf')](_0x38656f));_0x564a86(_0x38656f);})[_0x2f34('0x15')](function(_0x1b1812){logger[_0x2f34('0x10')](_0x2f34('0x1a'),_0x1b1812['message'],_0xdd70d7);_0x4c8e97(_0x16f5ef[_0x2f34('0x10')](0x1f4,_0x1b1812[_0x2f34('0x12')]));});});}; \ No newline at end of file +var _0x9e06=['http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareReport','SquareReport','body','options','raw','then','stringify','UpdateSquareReport','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9e06,0x174));var _0x69e0=function(_0x152dc0,_0x53ebab){_0x152dc0=_0x152dc0-0x0;var _0x3de423=_0x9e06[_0x152dc0];return _0x3de423;};'use strict';var _=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var moment=require(_0x69e0('0x2'));var BPromise=require(_0x69e0('0x3'));var rs=require(_0x69e0('0x4'));var fs=require('fs');var Redis=require(_0x69e0('0x5'));var db=require(_0x69e0('0x6'))['db'];var utils=require(_0x69e0('0x7'));var logger=require(_0x69e0('0x8'))(_0x69e0('0x9'));var config=require(_0x69e0('0xa'));var jayson=require(_0x69e0('0xb'));var client=jayson[_0x69e0('0xc')][_0x69e0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdad29d,_0x307da7,_0x2378d0){return new BPromise(function(_0x292732,_0xe24057){return client[_0x69e0('0xe')](_0xdad29d,_0x2378d0)['then'](function(_0x5c2dcd){logger[_0x69e0('0xf')](_0x69e0('0x10'),_0x307da7,_0x69e0('0x11'));logger[_0x69e0('0x12')](_0x69e0('0x13'),_0x307da7,'request\x20sent',JSON['stringify'](_0x5c2dcd));if(_0x5c2dcd['error']){if(_0x5c2dcd[_0x69e0('0x14')][_0x69e0('0x15')]===0x1f4){logger[_0x69e0('0x14')]('SquareReport,\x20%s,\x20%s',_0x307da7,_0x5c2dcd[_0x69e0('0x14')]['message']);return _0xe24057(_0x5c2dcd[_0x69e0('0x14')]['message']);}logger[_0x69e0('0x14')](_0x69e0('0x10'),_0x307da7,_0x5c2dcd[_0x69e0('0x14')]['message']);return _0x292732(_0x5c2dcd[_0x69e0('0x14')][_0x69e0('0x16')]);}else{logger['info'](_0x69e0('0x10'),_0x307da7,'request\x20sent');_0x292732(_0x5c2dcd[_0x69e0('0x17')]['message']);}})['catch'](function(_0x420f95){logger[_0x69e0('0x14')](_0x69e0('0x10'),_0x307da7,_0x420f95);_0xe24057(_0x420f95);});});}exports[_0x69e0('0x18')]=function(_0x4dbc7f){var _0x50d05e=this;return new Promise(function(_0x3bf495,_0x42c85c){return db[_0x69e0('0x19')]['create'](_0x4dbc7f[_0x69e0('0x1a')],{'raw':_0x4dbc7f[_0x69e0('0x1b')]?_0x4dbc7f['options'][_0x69e0('0x1c')]===undefined?!![]:![]:!![]})[_0x69e0('0x1d')](function(_0x40eadd){logger[_0x69e0('0xf')](_0x69e0('0x18'),_0x4dbc7f);logger[_0x69e0('0x12')](_0x69e0('0x18'),_0x4dbc7f,JSON[_0x69e0('0x1e')](_0x40eadd));_0x3bf495(_0x40eadd);})['catch'](function(_0x32b67a){logger[_0x69e0('0x14')](_0x69e0('0x18'),_0x32b67a[_0x69e0('0x16')],_0x4dbc7f);_0x42c85c(_0x50d05e[_0x69e0('0x14')](0x1f4,_0x32b67a[_0x69e0('0x16')]));});});};exports[_0x69e0('0x1f')]=function(_0x30c910){var _0x5529ea=this;return new Promise(function(_0x233ca6,_0x10cb79){return db[_0x69e0('0x19')]['update'](_0x30c910[_0x69e0('0x1a')],{'raw':_0x30c910[_0x69e0('0x1b')]?_0x30c910['options'][_0x69e0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30c910['options']?_0x30c910[_0x69e0('0x1b')][_0x69e0('0x20')]||null:null,'attributes':_0x30c910[_0x69e0('0x1b')]?_0x30c910[_0x69e0('0x1b')][_0x69e0('0x21')]||null:null,'limit':_0x30c910['options']?_0x30c910[_0x69e0('0x1b')]['limit']||null:null})[_0x69e0('0x1d')](function(_0x2bb16a){logger[_0x69e0('0xf')](_0x69e0('0x1f'),_0x30c910);logger[_0x69e0('0x12')](_0x69e0('0x1f'),_0x30c910,JSON['stringify'](_0x2bb16a));_0x233ca6(_0x2bb16a);})[_0x69e0('0x22')](function(_0xd8e996){logger[_0x69e0('0x14')](_0x69e0('0x1f'),_0xd8e996[_0x69e0('0x16')],_0x30c910);_0x10cb79(_0x5529ea[_0x69e0('0x14')](0x1f4,_0xd8e996[_0x69e0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index af8b1a1..b4bca51 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x814b,0x1a2));var _0xb814=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x814b[_0x1ad926];return _0x1b81dc;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +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(_0x5ebfb9,_0x3704b0){var _0x286a8c=function(_0x199e17){while(--_0x199e17){_0x5ebfb9['push'](_0x5ebfb9['shift']());}};_0x286a8c(++_0x3704b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37e3d1,_0x168a19){_0x37e3d1=_0x37e3d1-0x0;var _0x482fcf=_0x5f2f[_0x37e3d1];return _0x482fcf;};'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 4db48af..c9c7eb9 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 _0x4dd9=['sequelize','exports','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x4dd9,0x99));var _0x94dd=function(_0x5c8736,_0x2a2a03){_0x5c8736=_0x5c8736-0x0;var _0x142bdb=_0x4dd9[_0x5c8736];return _0x142bdb;};'use strict';var Sequelize=require(_0x94dd('0x0'));module[_0x94dd('0x1')]={'uniqueid':{'type':Sequelize[_0x94dd('0x2')]},'node':{'type':Sequelize[_0x94dd('0x2')]},'application':{'type':Sequelize[_0x94dd('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x94dd('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc654=['STRING','sequelize','exports'];(function(_0x1ebc25,_0x4b386d){var _0x1b73a6=function(_0x5e37cb){while(--_0x5e37cb){_0x1ebc25['push'](_0x1ebc25['shift']());}};_0x1b73a6(++_0x4b386d);}(_0xc654,0x19c));var _0x4c65=function(_0x44e78e,_0x5f2ba5){_0x44e78e=_0x44e78e-0x0;var _0xff1bb2=_0xc654[_0x44e78e];return _0xff1bb2;};'use strict';var Sequelize=require(_0x4c65('0x0'));module[_0x4c65('0x1')]={'uniqueid':{'type':Sequelize[_0x4c65('0x2')]},'node':{'type':Sequelize[_0x4c65('0x2')]},'application':{'type':Sequelize[_0x4c65('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x4c65('0x2')]},'callerid':{'type':Sequelize[_0x4c65('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f367041..2a90f6a 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 _0xc2ec=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format'];(function(_0x133833,_0x1efbd9){var _0x492d42=function(_0x10a45a){while(--_0x10a45a){_0x133833['push'](_0x133833['shift']());}};_0x492d42(++_0x1efbd9);}(_0xc2ec,0xd1));var _0xcc2e=function(_0x54d8d7,_0x446e6f){_0x54d8d7=_0x54d8d7-0x0;var _0x150af6=_0xc2ec[_0x54d8d7];return _0x150af6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc2e('0x1'));var jsonpatch=require(_0xcc2e('0x2'));var rp=require(_0xcc2e('0x3'));var moment=require(_0xcc2e('0x4'));var BPromise=require(_0xcc2e('0x5'));var Mustache=require(_0xcc2e('0x6'));var util=require(_0xcc2e('0x7'));var path=require('path');var sox=require(_0xcc2e('0x8'));var csv=require(_0xcc2e('0x9'));var ejs=require(_0xcc2e('0xa'));var fs=require('fs');var _=require(_0xcc2e('0xb'));var squel=require(_0xcc2e('0xc'));var crypto=require(_0xcc2e('0xd'));var jsforce=require(_0xcc2e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc2e('0x9'));var querystring=require('querystring');var Papa=require(_0xcc2e('0xf'));var Redis=require(_0xcc2e('0x10'));var authService=require(_0xcc2e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcc2e('0x12'));var hardwareService=require(_0xcc2e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcc2e('0x14'))['db'];function respondWithStatusCode(_0x467bb9,_0x4f0202){_0x4f0202=_0x4f0202||0xcc;return function(_0x29ad7e){if(_0x29ad7e){return _0x467bb9[_0xcc2e('0x15')](_0x4f0202);}return _0x467bb9['status'](_0x4f0202)[_0xcc2e('0x16')]();};}function respondWithResult(_0x1874fa,_0xa83406){_0xa83406=_0xa83406||0xc8;return function(_0x216c85){if(_0x216c85){return _0x1874fa[_0xcc2e('0x17')](_0xa83406)[_0xcc2e('0x18')](_0x216c85);}};}function respondWithFilteredResult(_0x27aed2,_0x17702a){return function(_0x217835){if(_0x217835){var _0x25a30c=_0x217835[_0xcc2e('0x19')],_0x364d3d=_0x17702a[_0xcc2e('0x1a')],_0x546cf6=_0x17702a[_0xcc2e('0x1a')]+_0x17702a['limit'],_0x5c4669;if(_0x546cf6>=_0x25a30c){_0x546cf6=_0x25a30c;_0x5c4669=0xc8;}else{_0x5c4669=0xce;}_0x27aed2[_0xcc2e('0x17')](_0x5c4669);return _0x27aed2[_0xcc2e('0x1b')]('Content-Range',_0x364d3d+'-'+_0x546cf6+'/'+_0x25a30c)[_0xcc2e('0x18')](_0x217835);}return null;};}function patchUpdates(_0x2f9b4b){return function(_0x4fe015){try{jsonpatch[_0xcc2e('0x1c')](_0x4fe015,_0x2f9b4b,!![]);}catch(_0x5f3892){return BPromise[_0xcc2e('0x1d')](_0x5f3892);}return _0x4fe015[_0xcc2e('0x1e')]();};}function saveUpdates(_0x50c07f,_0x1cb345){return function(_0x42ca2c){if(_0x42ca2c){return _0x42ca2c['update'](_0x50c07f)[_0xcc2e('0x1f')](function(_0x2d97ff){return _0x2d97ff;});}return null;};}function removeEntity(_0x1b4747,_0x3c33f8){return function(_0x52c57a){if(_0x52c57a){return _0x52c57a[_0xcc2e('0x20')]()[_0xcc2e('0x1f')](function(){_0x1b4747[_0xcc2e('0x17')](0xcc)[_0xcc2e('0x16')]();});}};}function handleEntityNotFound(_0x3af858,_0x280401){return function(_0x5cd007){if(!_0x5cd007){_0x3af858[_0xcc2e('0x15')](0x194);}return _0x5cd007;};}function handleError(_0xc80a35,_0x225b20){_0x225b20=_0x225b20||0x1f4;return function(_0x37f909){logger['error'](_0x37f909[_0xcc2e('0x21')]);if(_0x37f909[_0xcc2e('0x22')]){delete _0x37f909[_0xcc2e('0x22')];}_0xc80a35[_0xcc2e('0x17')](_0x225b20)[_0xcc2e('0x23')](_0x37f909);};}exports[_0xcc2e('0x24')]=function(_0x33bdf3,_0x9af4bb){var _0x130f57={},_0x49eb7d={},_0x17d352={'count':0x0,'rows':[]};var _0x17ef8d=_[_0xcc2e('0x25')](db[_0xcc2e('0x26')][_0xcc2e('0x27')],function(_0x596516){return{'name':_0x596516['fieldName'],'type':_0x596516[_0xcc2e('0x28')][_0xcc2e('0x29')]};});_0x49eb7d[_0xcc2e('0x2a')]=_[_0xcc2e('0x25')](_0x17ef8d,'name');_0x49eb7d[_0xcc2e('0x2b')]=_[_0xcc2e('0x2c')](_0x33bdf3[_0xcc2e('0x2b')]);_0x49eb7d['filters']=_[_0xcc2e('0x2d')](_0x49eb7d['model'],_0x49eb7d[_0xcc2e('0x2b')]);_0x130f57[_0xcc2e('0x2e')]=_[_0xcc2e('0x2d')](_0x49eb7d['model'],qs[_0xcc2e('0x2f')](_0x33bdf3['query']['fields']));_0x130f57[_0xcc2e('0x2e')]=_0x130f57[_0xcc2e('0x2e')][_0xcc2e('0x30')]?_0x130f57[_0xcc2e('0x2e')]:_0x49eb7d[_0xcc2e('0x2a')];if(!_0x33bdf3[_0xcc2e('0x2b')][_0xcc2e('0x31')]('nolimit')){_0x130f57[_0xcc2e('0x32')]=qs[_0xcc2e('0x32')](_0x33bdf3[_0xcc2e('0x2b')]['limit']);_0x130f57['offset']=qs[_0xcc2e('0x1a')](_0x33bdf3['query'][_0xcc2e('0x1a')]);}_0x130f57[_0xcc2e('0x33')]=qs[_0xcc2e('0x34')](_0x33bdf3[_0xcc2e('0x2b')][_0xcc2e('0x34')]);_0x130f57[_0xcc2e('0x35')]=qs[_0xcc2e('0x36')](_[_0xcc2e('0x37')](_0x33bdf3['query'],_0x49eb7d[_0xcc2e('0x36')]),_0x17ef8d);if(_0x33bdf3[_0xcc2e('0x2b')][_0xcc2e('0x38')]){_0x130f57[_0xcc2e('0x35')]=_['merge'](_0x130f57[_0xcc2e('0x35')],{'$or':_['map'](_0x17ef8d,function(_0x27ca54){if(_0x27ca54[_0xcc2e('0x28')]!==_0xcc2e('0x39')){var _0x38cb01={};_0x38cb01[_0x27ca54[_0xcc2e('0x22')]]={'$like':'%'+_0x33bdf3[_0xcc2e('0x2b')][_0xcc2e('0x38')]+'%'};return _0x38cb01;}})});}_0x130f57=_['merge']({},_0x130f57,_0x33bdf3[_0xcc2e('0x3a')]);var _0x44d1d7={'where':_0x130f57[_0xcc2e('0x35')]};return db['SquareDetailsReport']['count'](_0x44d1d7)['then'](function(_0x202982){_0x17d352[_0xcc2e('0x19')]=_0x202982;if(_0x33bdf3[_0xcc2e('0x2b')][_0xcc2e('0x3b')]){_0x130f57[_0xcc2e('0x3c')]=[{'all':!![]}];}return db[_0xcc2e('0x26')][_0xcc2e('0x3d')](_0x130f57);})[_0xcc2e('0x1f')](function(_0x136d3e){_0x17d352[_0xcc2e('0x3e')]=_0x136d3e;return _0x17d352;})[_0xcc2e('0x1f')](respondWithFilteredResult(_0x9af4bb,_0x130f57))[_0xcc2e('0x3f')](handleError(_0x9af4bb,null));};exports[_0xcc2e('0x40')]=function(_0x1e1bb6,_0x23bc42){var _0x4740cf={'raw':!![],'where':{'id':_0x1e1bb6[_0xcc2e('0x41')]['id']}},_0x1fbafd={};_0x1fbafd[_0xcc2e('0x2a')]=_['keys'](db['SquareDetailsReport'][_0xcc2e('0x27')]);_0x1fbafd[_0xcc2e('0x2b')]=_[_0xcc2e('0x2c')](_0x1e1bb6['query']);_0x1fbafd[_0xcc2e('0x36')]=_[_0xcc2e('0x2d')](_0x1fbafd[_0xcc2e('0x2a')],_0x1fbafd[_0xcc2e('0x2b')]);_0x4740cf[_0xcc2e('0x2e')]=_['intersection'](_0x1fbafd[_0xcc2e('0x2a')],qs[_0xcc2e('0x2f')](_0x1e1bb6[_0xcc2e('0x2b')][_0xcc2e('0x2f')]));_0x4740cf[_0xcc2e('0x2e')]=_0x4740cf[_0xcc2e('0x2e')][_0xcc2e('0x30')]?_0x4740cf['attributes']:_0x1fbafd[_0xcc2e('0x2a')];if(_0x1e1bb6[_0xcc2e('0x2b')][_0xcc2e('0x3b')]){_0x4740cf[_0xcc2e('0x3c')]=[{'all':!![]}];}_0x4740cf=_['merge']({},_0x4740cf,_0x1e1bb6[_0xcc2e('0x3a')]);return db[_0xcc2e('0x26')][_0xcc2e('0x42')](_0x4740cf)['then'](handleEntityNotFound(_0x23bc42,null))[_0xcc2e('0x1f')](respondWithResult(_0x23bc42,null))[_0xcc2e('0x3f')](handleError(_0x23bc42,null));};exports[_0xcc2e('0x43')]=function(_0x2845d5,_0xbafcf5){return db['SquareDetailsReport'][_0xcc2e('0x43')](_0x2845d5['body'],{})['then'](respondWithResult(_0xbafcf5,0xc9))[_0xcc2e('0x3f')](handleError(_0xbafcf5,null));};exports['update']=function(_0x347ffa,_0x5ed2e8){if(_0x347ffa[_0xcc2e('0x44')]['id']){delete _0x347ffa['body']['id'];}return db[_0xcc2e('0x26')][_0xcc2e('0x42')]({'where':{'id':_0x347ffa['params']['id']}})[_0xcc2e('0x1f')](handleEntityNotFound(_0x5ed2e8,null))[_0xcc2e('0x1f')](saveUpdates(_0x347ffa[_0xcc2e('0x44')],null))[_0xcc2e('0x1f')](respondWithResult(_0x5ed2e8,null))[_0xcc2e('0x3f')](handleError(_0x5ed2e8,null));};exports[_0xcc2e('0x20')]=function(_0x20cecf,_0x5edbbe){return db[_0xcc2e('0x26')][_0xcc2e('0x42')]({'where':{'id':_0x20cecf[_0xcc2e('0x41')]['id']}})[_0xcc2e('0x1f')](handleEntityNotFound(_0x5edbbe,null))[_0xcc2e('0x1f')](removeEntity(_0x5edbbe,null))[_0xcc2e('0x3f')](handleError(_0x5edbbe,null));};exports[_0xcc2e('0x45')]=function(_0x550318,_0x58e61b){return db[_0xcc2e('0x26')][_0xcc2e('0x45')]()['then'](respondWithResult(_0x58e61b,null))[_0xcc2e('0x3f')](handleError(_0x58e61b,null));}; \ No newline at end of file +var _0xc6fb=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x278ff6,_0x57c288){var _0x54c3e9=function(_0xd212cd){while(--_0xd212cd){_0x278ff6['push'](_0x278ff6['shift']());}};_0x54c3e9(++_0x57c288);}(_0xc6fb,0x106));var _0xbc6f=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc6fb[_0x54d4a8];return _0x3b321b;};'use strict';var pdf=require(_0xbc6f('0x0'));var emlformat=require(_0xbc6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc6f('0x2'));var rp=require(_0xbc6f('0x3'));var moment=require(_0xbc6f('0x4'));var BPromise=require(_0xbc6f('0x5'));var Mustache=require(_0xbc6f('0x6'));var util=require('util');var path=require(_0xbc6f('0x7'));var sox=require(_0xbc6f('0x8'));var csv=require(_0xbc6f('0x9'));var ejs=require(_0xbc6f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc6f('0xb'));var deskjs=require(_0xbc6f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc6f('0xd'));var Papa=require(_0xbc6f('0xe'));var Redis=require(_0xbc6f('0xf'));var authService=require(_0xbc6f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc6f('0x11'));var hardwareService=require(_0xbc6f('0x12'));var logger=require(_0xbc6f('0x13'))('api');var utils=require(_0xbc6f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366aa6,_0x356b91){_0x356b91=_0x356b91||0xcc;return function(_0x2fdd49){if(_0x2fdd49){return _0x366aa6[_0xbc6f('0x15')](_0x356b91);}return _0x366aa6['status'](_0x356b91)[_0xbc6f('0x16')]();};}function respondWithResult(_0x471267,_0x2b22d9){_0x2b22d9=_0x2b22d9||0xc8;return function(_0x46eb79){if(_0x46eb79){return _0x471267[_0xbc6f('0x17')](_0x2b22d9)['json'](_0x46eb79);}};}function respondWithFilteredResult(_0x923a0e,_0x34a8ba){return function(_0x3dc9f6){if(_0x3dc9f6){var _0x4e6fd9=_0x3dc9f6[_0xbc6f('0x18')],_0x252070=_0x34a8ba[_0xbc6f('0x19')],_0x234066=_0x34a8ba['offset']+_0x34a8ba[_0xbc6f('0x1a')],_0x499d90;if(_0x234066>=_0x4e6fd9){_0x234066=_0x4e6fd9;_0x499d90=0xc8;}else{_0x499d90=0xce;}_0x923a0e[_0xbc6f('0x17')](_0x499d90);return _0x923a0e[_0xbc6f('0x1b')](_0xbc6f('0x1c'),_0x252070+'-'+_0x234066+'/'+_0x4e6fd9)[_0xbc6f('0x1d')](_0x3dc9f6);}return null;};}function patchUpdates(_0x18a67f){return function(_0x4aad21){try{jsonpatch[_0xbc6f('0x1e')](_0x4aad21,_0x18a67f,!![]);}catch(_0x1c5da8){return BPromise[_0xbc6f('0x1f')](_0x1c5da8);}return _0x4aad21[_0xbc6f('0x20')]();};}function saveUpdates(_0x1d1722,_0x18496b){return function(_0x571e9e){if(_0x571e9e){return _0x571e9e[_0xbc6f('0x21')](_0x1d1722)['then'](function(_0x3e0bff){return _0x3e0bff;});}return null;};}function removeEntity(_0xc53eca,_0x1eda06){return function(_0x3048e3){if(_0x3048e3){return _0x3048e3[_0xbc6f('0x22')]()['then'](function(){_0xc53eca[_0xbc6f('0x17')](0xcc)[_0xbc6f('0x16')]();});}};}function handleEntityNotFound(_0x15d5f1,_0x335057){return function(_0x292493){if(!_0x292493){_0x15d5f1['sendStatus'](0x194);}return _0x292493;};}function handleError(_0x4e2024,_0x20dc75){_0x20dc75=_0x20dc75||0x1f4;return function(_0x1f2ae6){logger[_0xbc6f('0x23')](_0x1f2ae6[_0xbc6f('0x24')]);if(_0x1f2ae6['name']){delete _0x1f2ae6[_0xbc6f('0x25')];}_0x4e2024['status'](_0x20dc75)[_0xbc6f('0x26')](_0x1f2ae6);};}exports[_0xbc6f('0x27')]=function(_0x59f96e,_0x26c273){var _0x44e15c={},_0x43faa3={},_0x326e15={'count':0x0,'rows':[]};var _0x505cfc=_[_0xbc6f('0x28')](db[_0xbc6f('0x29')][_0xbc6f('0x2a')],function(_0x4de3cb){return{'name':_0x4de3cb[_0xbc6f('0x2b')],'type':_0x4de3cb['type'][_0xbc6f('0x2c')]};});_0x43faa3[_0xbc6f('0x2d')]=_[_0xbc6f('0x28')](_0x505cfc,_0xbc6f('0x25'));_0x43faa3[_0xbc6f('0x2e')]=_[_0xbc6f('0x2f')](_0x59f96e[_0xbc6f('0x2e')]);_0x43faa3[_0xbc6f('0x30')]=_[_0xbc6f('0x31')](_0x43faa3[_0xbc6f('0x2d')],_0x43faa3['query']);_0x44e15c[_0xbc6f('0x32')]=_[_0xbc6f('0x31')](_0x43faa3[_0xbc6f('0x2d')],qs['fields'](_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x33')]));_0x44e15c[_0xbc6f('0x32')]=_0x44e15c['attributes'][_0xbc6f('0x34')]?_0x44e15c['attributes']:_0x43faa3['model'];if(!_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x35')](_0xbc6f('0x36'))){_0x44e15c[_0xbc6f('0x1a')]=qs[_0xbc6f('0x1a')](_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x1a')]);_0x44e15c[_0xbc6f('0x19')]=qs[_0xbc6f('0x19')](_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x19')]);}_0x44e15c[_0xbc6f('0x37')]=qs['sort'](_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x38')]);_0x44e15c[_0xbc6f('0x39')]=qs[_0xbc6f('0x30')](_[_0xbc6f('0x3a')](_0x59f96e[_0xbc6f('0x2e')],_0x43faa3[_0xbc6f('0x30')]),_0x505cfc);if(_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x3b')]){_0x44e15c['where']=_[_0xbc6f('0x3c')](_0x44e15c['where'],{'$or':_[_0xbc6f('0x28')](_0x505cfc,function(_0x45213c){if(_0x45213c[_0xbc6f('0x3d')]!==_0xbc6f('0x3e')){var _0x4b9819={};_0x4b9819[_0x45213c['name']]={'$like':'%'+_0x59f96e[_0xbc6f('0x2e')][_0xbc6f('0x3b')]+'%'};return _0x4b9819;}})});}_0x44e15c=_['merge']({},_0x44e15c,_0x59f96e[_0xbc6f('0x3f')]);var _0x3c94cf={'where':_0x44e15c[_0xbc6f('0x39')]};return db[_0xbc6f('0x29')][_0xbc6f('0x18')](_0x3c94cf)[_0xbc6f('0x40')](function(_0x330ea){_0x326e15[_0xbc6f('0x18')]=_0x330ea;if(_0x59f96e['query'][_0xbc6f('0x41')]){_0x44e15c[_0xbc6f('0x42')]=[{'all':!![]}];}return db[_0xbc6f('0x29')][_0xbc6f('0x43')](_0x44e15c);})[_0xbc6f('0x40')](function(_0x1d5821){_0x326e15[_0xbc6f('0x44')]=_0x1d5821;return _0x326e15;})[_0xbc6f('0x40')](respondWithFilteredResult(_0x26c273,_0x44e15c))[_0xbc6f('0x45')](handleError(_0x26c273,null));};exports[_0xbc6f('0x46')]=function(_0x47bdb0,_0x565619){var _0x4a3ee8={'raw':!![],'where':{'id':_0x47bdb0[_0xbc6f('0x47')]['id']}},_0x3b9f25={};_0x3b9f25['model']=_[_0xbc6f('0x2f')](db[_0xbc6f('0x29')][_0xbc6f('0x2a')]);_0x3b9f25[_0xbc6f('0x2e')]=_[_0xbc6f('0x2f')](_0x47bdb0[_0xbc6f('0x2e')]);_0x3b9f25[_0xbc6f('0x30')]=_['intersection'](_0x3b9f25[_0xbc6f('0x2d')],_0x3b9f25[_0xbc6f('0x2e')]);_0x4a3ee8[_0xbc6f('0x32')]=_[_0xbc6f('0x31')](_0x3b9f25['model'],qs[_0xbc6f('0x33')](_0x47bdb0['query'][_0xbc6f('0x33')]));_0x4a3ee8['attributes']=_0x4a3ee8[_0xbc6f('0x32')][_0xbc6f('0x34')]?_0x4a3ee8['attributes']:_0x3b9f25[_0xbc6f('0x2d')];if(_0x47bdb0['query']['includeAll']){_0x4a3ee8[_0xbc6f('0x42')]=[{'all':!![]}];}_0x4a3ee8=_[_0xbc6f('0x3c')]({},_0x4a3ee8,_0x47bdb0[_0xbc6f('0x3f')]);return db[_0xbc6f('0x29')]['find'](_0x4a3ee8)[_0xbc6f('0x40')](handleEntityNotFound(_0x565619,null))[_0xbc6f('0x40')](respondWithResult(_0x565619,null))[_0xbc6f('0x45')](handleError(_0x565619,null));};exports['create']=function(_0x52b469,_0x196b2e){return db[_0xbc6f('0x29')][_0xbc6f('0x48')](_0x52b469['body'],{})[_0xbc6f('0x40')](respondWithResult(_0x196b2e,0xc9))[_0xbc6f('0x45')](handleError(_0x196b2e,null));};exports[_0xbc6f('0x21')]=function(_0x558120,_0x3587ff){if(_0x558120[_0xbc6f('0x49')]['id']){delete _0x558120[_0xbc6f('0x49')]['id'];}return db[_0xbc6f('0x29')]['find']({'where':{'id':_0x558120[_0xbc6f('0x47')]['id']}})[_0xbc6f('0x40')](handleEntityNotFound(_0x3587ff,null))['then'](saveUpdates(_0x558120[_0xbc6f('0x49')],null))['then'](respondWithResult(_0x3587ff,null))[_0xbc6f('0x45')](handleError(_0x3587ff,null));};exports[_0xbc6f('0x22')]=function(_0x59b5ec,_0x11df8c){return db[_0xbc6f('0x29')][_0xbc6f('0x4a')]({'where':{'id':_0x59b5ec[_0xbc6f('0x47')]['id']}})[_0xbc6f('0x40')](handleEntityNotFound(_0x11df8c,null))[_0xbc6f('0x40')](removeEntity(_0x11df8c,null))[_0xbc6f('0x45')](handleError(_0x11df8c,null));};exports[_0xbc6f('0x4b')]=function(_0x5073cf,_0x5d487a){return db[_0xbc6f('0x29')]['describe']()[_0xbc6f('0x40')](respondWithResult(_0x5d487a,null))['catch'](handleError(_0x5d487a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 09f179a..efa656f 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 _0x9246=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x437750,_0x4440a1){var _0x5aa9e7=function(_0x39ee92){while(--_0x39ee92){_0x437750['push'](_0x437750['shift']());}};_0x5aa9e7(++_0x4440a1);}(_0x9246,0xc3));var _0x6924=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x9246[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x6924('0x0'));var util=require(_0x6924('0x1'));var logger=require(_0x6924('0x2'))(_0x6924('0x3'));var moment=require(_0x6924('0x4'));var BPromise=require('bluebird');var rp=require(_0x6924('0x5'));var fs=require('fs');var path=require(_0x6924('0x6'));var rimraf=require('rimraf');var config=require(_0x6924('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x6924('0x8')]=function(_0x2dbc44,_0x1459bc){return _0x2dbc44[_0x6924('0x9')](_0x6924('0xa'),attributes,{'tableName':_0x6924('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc6a=['report_square_details','api','bluebird','request-promise','path','./squareReportDetail.attributes','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbc6a,0xa2));var _0xabc6=function(_0x449e95,_0x28215f){_0x449e95=_0x449e95-0x0;var _0x2b950c=_0xbc6a[_0x449e95];return _0x2b950c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xabc6('0x0'));var moment=require('moment');var BPromise=require(_0xabc6('0x1'));var rp=require(_0xabc6('0x2'));var fs=require('fs');var path=require(_0xabc6('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xabc6('0x4'));module[_0xabc6('0x5')]=function(_0x30beb0,_0x327353){return _0x30beb0['define']('SquareDetailsReport',attributes,{'tableName':_0xabc6('0x6'),'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 883a68c..cb1e2c6 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 _0xf67e=['client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1ee35d,_0x56b6a8){var _0x1338d2=function(_0x16820d){while(--_0x16820d){_0x1ee35d['push'](_0x1ee35d['shift']());}};_0x1338d2(++_0x56b6a8);}(_0xf67e,0x13a));var _0xef67=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf67e[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xef67('0x0'));var moment=require(_0xef67('0x1'));var BPromise=require(_0xef67('0x2'));var rs=require(_0xef67('0x3'));var fs=require('fs');var Redis=require(_0xef67('0x4'));var db=require(_0xef67('0x5'))['db'];var utils=require(_0xef67('0x6'));var logger=require(_0xef67('0x7'))(_0xef67('0x8'));var config=require('../../config/environment');var jayson=require(_0xef67('0x9'));var client=jayson[_0xef67('0xa')][_0xef67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x188504,_0x180a1b,_0x4335a5){return new BPromise(function(_0x1b2b99,_0x57988d){return client['request'](_0x188504,_0x4335a5)[_0xef67('0xc')](function(_0x325de0){logger[_0xef67('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x180a1b,_0xef67('0xe'));logger[_0xef67('0xf')](_0xef67('0x10'),_0x180a1b,_0xef67('0xe'),JSON[_0xef67('0x11')](_0x325de0));if(_0x325de0[_0xef67('0x12')]){if(_0x325de0[_0xef67('0x12')][_0xef67('0x13')]===0x1f4){logger['error'](_0xef67('0x14'),_0x180a1b,_0x325de0['error'][_0xef67('0x15')]);return _0x57988d(_0x325de0[_0xef67('0x12')]['message']);}logger[_0xef67('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x180a1b,_0x325de0[_0xef67('0x12')][_0xef67('0x15')]);return _0x1b2b99(_0x325de0[_0xef67('0x12')]['message']);}else{logger[_0xef67('0xd')](_0xef67('0x14'),_0x180a1b,_0xef67('0xe'));_0x1b2b99(_0x325de0['result'][_0xef67('0x15')]);}})['catch'](function(_0x1cf377){logger[_0xef67('0x12')](_0xef67('0x14'),_0x180a1b,_0x1cf377);_0x57988d(_0x1cf377);});});}exports[_0xef67('0x16')]=function(_0x2f10f0){var _0x8d0f53=this;return new Promise(function(_0x5f2906,_0x128bce){return db[_0xef67('0x17')]['create'](_0x2f10f0[_0xef67('0x18')],{'raw':_0x2f10f0[_0xef67('0x19')]?_0x2f10f0[_0xef67('0x19')][_0xef67('0x1a')]===undefined?!![]:![]:!![]})[_0xef67('0xc')](function(_0x4c038c){logger[_0xef67('0xd')](_0xef67('0x16'),_0x2f10f0);logger['debug']('CreateSquareDetailsReport',_0x2f10f0,JSON[_0xef67('0x11')](_0x4c038c));_0x5f2906(_0x4c038c);})['catch'](function(_0xebaca0){logger[_0xef67('0x12')](_0xef67('0x16'),_0xebaca0[_0xef67('0x15')],_0x2f10f0);_0x128bce(_0x8d0f53[_0xef67('0x12')](0x1f4,_0xebaca0[_0xef67('0x15')]));});});}; \ No newline at end of file +var _0x0734=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','SquareDetailsReport','body','options','CreateSquareDetailsReport','stringify','lodash','util'];(function(_0x26f518,_0x5a6c2d){var _0x3666d=function(_0x38ef7f){while(--_0x38ef7f){_0x26f518['push'](_0x26f518['shift']());}};_0x3666d(++_0x5a6c2d);}(_0x0734,0x116));var _0x4073=function(_0x5e8536,_0x1b4db4){_0x5e8536=_0x5e8536-0x0;var _0x5a6f32=_0x0734[_0x5e8536];return _0x5a6f32;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require('moment');var BPromise=require(_0x4073('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4073('0x3'));var db=require(_0x4073('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4073('0x5'))(_0x4073('0x6'));var config=require(_0x4073('0x7'));var jayson=require(_0x4073('0x8'));var client=jayson[_0x4073('0x9')][_0x4073('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513f6e,_0x33e273,_0x36b2d8){return new BPromise(function(_0x5e529b,_0x4f0d90){return client[_0x4073('0xb')](_0x513f6e,_0x36b2d8)[_0x4073('0xc')](function(_0x174c32){logger[_0x4073('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x33e273,_0x4073('0xe'));logger[_0x4073('0xf')](_0x4073('0x10'),_0x33e273,_0x4073('0xe'),JSON['stringify'](_0x174c32));if(_0x174c32[_0x4073('0x11')]){if(_0x174c32[_0x4073('0x11')][_0x4073('0x12')]===0x1f4){logger[_0x4073('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x33e273,_0x174c32[_0x4073('0x11')][_0x4073('0x13')]);return _0x4f0d90(_0x174c32[_0x4073('0x11')][_0x4073('0x13')]);}logger[_0x4073('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x33e273,_0x174c32['error'][_0x4073('0x13')]);return _0x5e529b(_0x174c32[_0x4073('0x11')][_0x4073('0x13')]);}else{logger[_0x4073('0xd')](_0x4073('0x14'),_0x33e273,_0x4073('0xe'));_0x5e529b(_0x174c32[_0x4073('0x15')][_0x4073('0x13')]);}})[_0x4073('0x16')](function(_0x52eec2){logger[_0x4073('0x11')](_0x4073('0x14'),_0x33e273,_0x52eec2);_0x4f0d90(_0x52eec2);});});}exports['CreateSquareDetailsReport']=function(_0x20ca41){var _0x5880b9=this;return new Promise(function(_0x599f89,_0x3d80d3){return db[_0x4073('0x17')]['create'](_0x20ca41[_0x4073('0x18')],{'raw':_0x20ca41[_0x4073('0x19')]?_0x20ca41[_0x4073('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4073('0xc')](function(_0x5b1154){logger[_0x4073('0xd')](_0x4073('0x1a'),_0x20ca41);logger[_0x4073('0xf')](_0x4073('0x1a'),_0x20ca41,JSON[_0x4073('0x1b')](_0x5b1154));_0x599f89(_0x5b1154);})['catch'](function(_0x4bfa1e){logger[_0x4073('0x11')]('CreateSquareDetailsReport',_0x4bfa1e[_0x4073('0x13')],_0x20ca41);_0x3d80d3(_0x5880b9['error'](0x1f4,_0x4bfa1e[_0x4073('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ed3e0c8..ca20a0b 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 _0xdbfd=['express','Router','isAuthenticated','index','/process/:pid/kill'];(function(_0x9d6f16,_0x3ea2e2){var _0x21e763=function(_0x33fe3f){while(--_0x33fe3f){_0x9d6f16['push'](_0x9d6f16['shift']());}};_0x21e763(++_0x3ea2e2);}(_0xdbfd,0x18b));var _0xddbf=function(_0x71ddaf,_0x13b8bd){_0x71ddaf=_0x71ddaf-0x0;var _0x5373b3=_0xdbfd[_0x71ddaf];return _0x5373b3;};'use strict';var express=require(_0xddbf('0x0'));var router=express[_0xddbf('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0xddbf('0x2')](),controller[_0xddbf('0x3')]);router['get'](_0xddbf('0x4'),auth[_0xddbf('0x2')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x5950=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5950,0x11e));var _0x0595=function(_0x20e27a,_0x5969ca){_0x20e27a=_0x20e27a-0x0;var _0x2bd07a=_0x5950[_0x20e27a];return _0x2bd07a;};'use strict';var express=require(_0x0595('0x0'));var router=express[_0x0595('0x1')]();var auth=require(_0x0595('0x2'));var controller=require(_0x0595('0x3'));router[_0x0595('0x4')]('/',auth[_0x0595('0x5')](),controller[_0x0595('0x6')]);router[_0x0595('0x4')](_0x0595('0x7'),auth[_0x0595('0x5')](),controller[_0x0595('0x8')]);module[_0x0595('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9d59966..fdac8fb 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 _0xefe2=['getAllData','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index'];(function(_0x27526d,_0x39ef31){var _0xef86a=function(_0x26a9a7){while(--_0x26a9a7){_0x27526d['push'](_0x27526d['shift']());}};_0xef86a(++_0x39ef31);}(_0xefe2,0x160));var _0x2efe=function(_0x157b85,_0x299ecf){_0x157b85=_0x157b85-0x0;var _0x343e99=_0xefe2[_0x157b85];return _0x343e99;};'use strict';var info=require(_0x2efe('0x0'));var exec=require(_0x2efe('0x1'))['exec'];var logger=require('../../config/logger')(_0x2efe('0x2'));var util=require(_0x2efe('0x3'));var BPromise=require(_0x2efe('0x4'));var _=require(_0x2efe('0x5'));function handleError(_0xbf884d,_0x455c32,_0x2351bb){_0x455c32=_0x455c32||0x1f4;return function(_0x446d61){logger['error'](_0x2efe('0x6'),_0x2351bb,_0x455c32,util[_0x2efe('0x7')](_0x446d61,{'showHidden':![],'depth':null}));delete _0x446d61[_0x2efe('0x8')];_0xbf884d[_0x2efe('0x9')](_0x455c32)[_0x2efe('0xa')](_0x446d61);};}exports[_0x2efe('0xb')]=function(_0x49ce3a,_0x4962e0){return info[_0x2efe('0xc')]()['then'](function(_0x542d81){return _0x4962e0[_0x2efe('0x9')](0xc8)['json'](_0x542d81);})['catch'](function(_0x432a91){return _0x4962e0[_0x2efe('0x9')](0x1f4)['json'](_0x432a91);});};exports[_0x2efe('0xd')]=function(_0x9bd36e,_0x3bf3b4){var _0x480bcd=[_0x2efe('0xe')];return new BPromise(function(_0x1b0b13,_0x2bc8d9){return exec(util[_0x2efe('0xf')](_0x2efe('0x10'),_0x9bd36e['params'][_0x2efe('0x11')]),function(_0x2b7657,_0x564219,_0x2316c8){if(_0x2b7657){return _0x2bc8d9(_0x2b7657);}return _0x1b0b13(_0x564219);});})[_0x2efe('0x12')](function(_0x237b46){var _0x1759dc=![];var _0x528375=_0x237b46[_0x2efe('0x13')](/\n/);for(var _0xf643a1=0x0,_0x1288f4=_0x480bcd['length'];_0xf643a1<_0x1288f4,_0x1759dc===![];_0xf643a1+=0x1){if(_0x237b46[_0x2efe('0x14')](_0x480bcd[_0xf643a1])>=0x0){_0x1759dc=!![];}}if(!_0x1759dc){throw new Error(util[_0x2efe('0xf')](_0x2efe('0x15'),_0x9bd36e[_0x2efe('0x16')][_0x2efe('0x11')]));}process[_0x2efe('0x17')](_0x9bd36e[_0x2efe('0x16')][_0x2efe('0x11')],_0x2efe('0x18'));return _0x3bf3b4[_0x2efe('0x9')](0xc8)[_0x2efe('0x19')]({'message':util[_0x2efe('0xf')](_0x2efe('0x1a'),_0x9bd36e[_0x2efe('0x16')][_0x2efe('0x11')])});})[_0x2efe('0x1b')](handleError(_0x3bf3b4,null,_0x2efe('0xd')));}; \ No newline at end of file +var _0x7103=['name','status','send','index','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x16765f,_0x3dd736){var _0x1326d4=function(_0x523c1a){while(--_0x523c1a){_0x16765f['push'](_0x16765f['shift']());}};_0x1326d4(++_0x3dd736);}(_0x7103,0x1d2));var _0x3710=function(_0x54c933,_0x2df4f0){_0x54c933=_0x54c933-0x0;var _0x2a0f72=_0x7103[_0x54c933];return _0x2a0f72;};'use strict';var info=require(_0x3710('0x0'));var exec=require(_0x3710('0x1'))[_0x3710('0x2')];var logger=require('../../config/logger')(_0x3710('0x3'));var util=require(_0x3710('0x4'));var BPromise=require(_0x3710('0x5'));var _=require(_0x3710('0x6'));function handleError(_0x3c5bbd,_0x2e0597,_0x56ad00){_0x2e0597=_0x2e0597||0x1f4;return function(_0x42c077){logger[_0x3710('0x7')](_0x3710('0x8'),_0x56ad00,_0x2e0597,util[_0x3710('0x9')](_0x42c077,{'showHidden':![],'depth':null}));delete _0x42c077[_0x3710('0xa')];_0x3c5bbd[_0x3710('0xb')](_0x2e0597)[_0x3710('0xc')](_0x42c077);};}exports[_0x3710('0xd')]=function(_0x585ac6,_0x2d8434){return info[_0x3710('0xe')]()[_0x3710('0xf')](function(_0xda0735){return _0x2d8434[_0x3710('0xb')](0xc8)[_0x3710('0x10')](_0xda0735);})[_0x3710('0x11')](function(_0x461756){return _0x2d8434[_0x3710('0xb')](0x1f4)[_0x3710('0x10')](_0x461756);});};exports[_0x3710('0x12')]=function(_0x3e2e2a,_0x2a2c0e){var _0x497ae=['components/import/cm'];return new BPromise(function(_0x28876c,_0x40c2ee){return exec(util[_0x3710('0x13')](_0x3710('0x14'),_0x3e2e2a['params'][_0x3710('0x15')]),function(_0x1823c3,_0x4b85e4,_0x141692){if(_0x1823c3){return _0x40c2ee(_0x1823c3);}return _0x28876c(_0x4b85e4);});})[_0x3710('0xf')](function(_0x27b97c){var _0x3e2694=![];var _0x3252c4=_0x27b97c[_0x3710('0x16')](/\n/);for(var _0x40d827=0x0,_0x13bd90=_0x497ae['length'];_0x40d827<_0x13bd90,_0x3e2694===![];_0x40d827+=0x1){if(_0x27b97c[_0x3710('0x17')](_0x497ae[_0x40d827])>=0x0){_0x3e2694=!![];}}if(!_0x3e2694){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3e2e2a[_0x3710('0x18')][_0x3710('0x15')]));}process[_0x3710('0x19')](_0x3e2e2a[_0x3710('0x18')][_0x3710('0x15')],_0x3710('0x1a'));return _0x2a2c0e[_0x3710('0xb')](0xc8)[_0x3710('0x10')]({'message':util[_0x3710('0x13')](_0x3710('0x1b'),_0x3e2e2a['params'][_0x3710('0x15')])});})[_0x3710('0x11')](handleError(_0x2a2c0e,null,_0x3710('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f55b5fc..4a83c04 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 _0xda55=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x2e72c7,_0x3cefda){var _0x12f876=function(_0x286755){while(--_0x286755){_0x2e72c7['push'](_0x2e72c7['shift']());}};_0x12f876(++_0x3cefda);}(_0xda55,0x6d));var _0x5da5=function(_0xef3ae2,_0x4c63b8){_0xef3ae2=_0xef3ae2-0x0;var _0x1cc22b=_0xda55[_0xef3ae2];return _0x1cc22b;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var auth=require(_0x5da5('0x4'));var interaction=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var controller=require('./tag.controller');router[_0x5da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x5da5('0x8')]);router['get'](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xb')]);router[_0x5da5('0xc')]('/',auth[_0x5da5('0xa')](),controller[_0x5da5('0xd')]);router[_0x5da5('0xe')](_0x5da5('0x9'),auth['isAuthenticated'](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0x11')]);module[_0x5da5('0x12')]=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0xcb91[_0x2d2ca2];return _0x48489d;};'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('./tag.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 537519d..a9bcfb1 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 _0x3423=['name','#0091EA','STRING'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3342('0x0')],'defaultValue':_0x3342('0x2')},'description':{'type':Sequelize[_0x3342('0x0')]}}; \ No newline at end of file +var _0x3423=['name','#0091EA','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3342('0x0')],'defaultValue':_0x3342('0x2')},'description':{'type':Sequelize[_0x3342('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7143686..431587e 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 _0x66ed=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','json','apply','reject','save','update','then','get','Tags','error','stack','name','map','Tag','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','length','nolimit','limit','offset','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2faa4c,_0x1e3141){var _0x3016d3=function(_0x26ea0f){while(--_0x26ea0f){_0x2faa4c['push'](_0x2faa4c['shift']());}};_0x3016d3(++_0x1e3141);}(_0x66ed,0x199));var _0xd66e=function(_0x594469,_0x1b95d0){_0x594469=_0x594469-0x0;var _0x55f6c8=_0x66ed[_0x594469];return _0x55f6c8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd66e('0x0'));var zipdir=require(_0xd66e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd66e('0x2'));var moment=require(_0xd66e('0x3'));var BPromise=require(_0xd66e('0x4'));var Mustache=require(_0xd66e('0x5'));var util=require(_0xd66e('0x6'));var path=require(_0xd66e('0x7'));var sox=require(_0xd66e('0x8'));var csv=require(_0xd66e('0x9'));var ejs=require(_0xd66e('0xa'));var fs=require('fs');var _=require(_0xd66e('0xb'));var squel=require(_0xd66e('0xc'));var crypto=require(_0xd66e('0xd'));var jsforce=require(_0xd66e('0xe'));var deskjs=require(_0xd66e('0xf'));var toCsv=require(_0xd66e('0x9'));var querystring=require('querystring');var Papa=require(_0xd66e('0x10'));var Redis=require(_0xd66e('0x11'));var authService=require(_0xd66e('0x12'));var qs=require(_0xd66e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd66e('0x14'));var logger=require(_0xd66e('0x15'))(_0xd66e('0x16'));var utils=require(_0xd66e('0x17'));var config=require(_0xd66e('0x18'));var db=require(_0xd66e('0x19'))['db'];function respondWithStatusCode(_0xeb08d6,_0x7fd5c0){_0x7fd5c0=_0x7fd5c0||0xcc;return function(_0x523524){if(_0x523524){return _0xeb08d6[_0xd66e('0x1a')](_0x7fd5c0);}return _0xeb08d6[_0xd66e('0x1b')](_0x7fd5c0)[_0xd66e('0x1c')]();};}function respondWithResult(_0x2171b4,_0x1dcbf3){_0x1dcbf3=_0x1dcbf3||0xc8;return function(_0x45e322){if(_0x45e322){return _0x2171b4['status'](_0x1dcbf3)['json'](_0x45e322);}};}function respondWithFilteredResult(_0x12b7e2,_0x1df9d1){return function(_0x14023c){if(_0x14023c){var _0x1cd2e7=_0x14023c[_0xd66e('0x1d')],_0x34c848=_0x1df9d1['offset'],_0x1f0031=_0x1df9d1['offset']+_0x1df9d1['limit'],_0x38b269;if(_0x1f0031>=_0x1cd2e7){_0x1f0031=_0x1cd2e7;_0x38b269=0xc8;}else{_0x38b269=0xce;}_0x12b7e2[_0xd66e('0x1b')](_0x38b269);return _0x12b7e2[_0xd66e('0x1e')]('Content-Range',_0x34c848+'-'+_0x1f0031+'/'+_0x1cd2e7)[_0xd66e('0x1f')](_0x14023c);}return null;};}function patchUpdates(_0x2fa466){return function(_0x3b5358){try{jsonpatch[_0xd66e('0x20')](_0x3b5358,_0x2fa466,!![]);}catch(_0x21a922){return BPromise[_0xd66e('0x21')](_0x21a922);}return _0x3b5358[_0xd66e('0x22')]();};}function saveUpdates(_0x112c88,_0x2849e2){return function(_0x161e6c){if(_0x161e6c){return _0x161e6c[_0xd66e('0x23')](_0x112c88)[_0xd66e('0x24')](function(_0x2d10ee){return _0x2d10ee;});}return null;};}function removeEntity(_0x19c329,_0x2b2dee){return function(_0x36adb7){if(_0x36adb7){return _0x36adb7['destroy']()[_0xd66e('0x24')](function(){var _0x5141fe=_0x36adb7[_0xd66e('0x25')]({'plain':!![]});var _0x3f9034=_0xd66e('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f9034,'resourceId':_0x5141fe['id']}})['then'](function(){return _0x36adb7;});})[_0xd66e('0x24')](function(){_0x19c329[_0xd66e('0x1b')](0xcc)[_0xd66e('0x1c')]();});}};}function handleEntityNotFound(_0x113a7a,_0x1b0d0e){return function(_0x2e0ca3){if(!_0x2e0ca3){_0x113a7a[_0xd66e('0x1a')](0x194);}return _0x2e0ca3;};}function handleError(_0x50773c,_0x4e8239){_0x4e8239=_0x4e8239||0x1f4;return function(_0x5b4186){logger[_0xd66e('0x27')](_0x5b4186[_0xd66e('0x28')]);if(_0x5b4186[_0xd66e('0x29')]){delete _0x5b4186['name'];}_0x50773c['status'](_0x4e8239)['send'](_0x5b4186);};}exports['index']=function(_0x29ddf6,_0x1ecce4){var _0x323295={},_0x2e8e8f={},_0x405cfc={'count':0x0,'rows':[]};var _0x57fd64=_[_0xd66e('0x2a')](db[_0xd66e('0x2b')][_0xd66e('0x2c')],function(_0x5ab67d){return{'name':_0x5ab67d[_0xd66e('0x2d')],'type':_0x5ab67d['type'][_0xd66e('0x2e')]};});_0x2e8e8f['model']=_[_0xd66e('0x2a')](_0x57fd64,_0xd66e('0x29'));_0x2e8e8f['query']=_['keys'](_0x29ddf6['query']);_0x2e8e8f['filters']=_[_0xd66e('0x2f')](_0x2e8e8f[_0xd66e('0x30')],_0x2e8e8f[_0xd66e('0x31')]);_0x323295[_0xd66e('0x32')]=_[_0xd66e('0x2f')](_0x2e8e8f[_0xd66e('0x30')],qs[_0xd66e('0x33')](_0x29ddf6[_0xd66e('0x31')][_0xd66e('0x33')]));_0x323295[_0xd66e('0x32')]=_0x323295[_0xd66e('0x32')][_0xd66e('0x34')]?_0x323295[_0xd66e('0x32')]:_0x2e8e8f['model'];if(!_0x29ddf6['query']['hasOwnProperty'](_0xd66e('0x35'))){_0x323295[_0xd66e('0x36')]=qs[_0xd66e('0x36')](_0x29ddf6[_0xd66e('0x31')]['limit']);_0x323295[_0xd66e('0x37')]=qs[_0xd66e('0x37')](_0x29ddf6[_0xd66e('0x31')][_0xd66e('0x37')]);}_0x323295['order']=qs['sort'](_0x29ddf6[_0xd66e('0x31')][_0xd66e('0x38')]);_0x323295[_0xd66e('0x39')]=qs['filters'](_[_0xd66e('0x3a')](_0x29ddf6[_0xd66e('0x31')],_0x2e8e8f[_0xd66e('0x3b')]),_0x57fd64);if(_0x29ddf6[_0xd66e('0x31')][_0xd66e('0x3c')]){_0x323295['where']=_[_0xd66e('0x3d')](_0x323295[_0xd66e('0x39')],{'$or':_[_0xd66e('0x2a')](_0x57fd64,function(_0x17c8ae){if(_0x17c8ae[_0xd66e('0x3e')]!==_0xd66e('0x3f')){var _0x2881c8={};_0x2881c8[_0x17c8ae['name']]={'$like':'%'+_0x29ddf6['query'][_0xd66e('0x3c')]+'%'};return _0x2881c8;}})});}_0x323295=_[_0xd66e('0x3d')]({},_0x323295,_0x29ddf6[_0xd66e('0x40')]);var _0x4ffaa0={'where':_0x323295[_0xd66e('0x39')]};return db[_0xd66e('0x2b')][_0xd66e('0x1d')](_0x4ffaa0)[_0xd66e('0x24')](function(_0x174bad){_0x405cfc['count']=_0x174bad;if(_0x29ddf6[_0xd66e('0x31')][_0xd66e('0x41')]){_0x323295[_0xd66e('0x42')]=[{'all':!![]}];}return db['Tag'][_0xd66e('0x43')](_0x323295);})[_0xd66e('0x24')](function(_0x294132){_0x405cfc[_0xd66e('0x44')]=_0x294132;return _0x405cfc;})[_0xd66e('0x24')](respondWithFilteredResult(_0x1ecce4,_0x323295))['catch'](handleError(_0x1ecce4,null));};exports[_0xd66e('0x45')]=function(_0x45de83,_0x4339b7){var _0x314acb={'raw':!![],'where':{'id':_0x45de83[_0xd66e('0x46')]['id']}},_0x975654={};_0x975654['model']=_[_0xd66e('0x47')](db[_0xd66e('0x2b')][_0xd66e('0x2c')]);_0x975654[_0xd66e('0x31')]=_[_0xd66e('0x47')](_0x45de83[_0xd66e('0x31')]);_0x975654[_0xd66e('0x3b')]=_[_0xd66e('0x2f')](_0x975654[_0xd66e('0x30')],_0x975654[_0xd66e('0x31')]);_0x314acb[_0xd66e('0x32')]=_['intersection'](_0x975654['model'],qs['fields'](_0x45de83['query'][_0xd66e('0x33')]));_0x314acb['attributes']=_0x314acb[_0xd66e('0x32')][_0xd66e('0x34')]?_0x314acb['attributes']:_0x975654[_0xd66e('0x30')];if(_0x45de83[_0xd66e('0x31')][_0xd66e('0x41')]){_0x314acb['include']=[{'all':!![]}];}_0x314acb=_['merge']({},_0x314acb,_0x45de83[_0xd66e('0x40')]);return db[_0xd66e('0x2b')][_0xd66e('0x48')](_0x314acb)[_0xd66e('0x24')](handleEntityNotFound(_0x4339b7,null))[_0xd66e('0x24')](respondWithResult(_0x4339b7,null))[_0xd66e('0x49')](handleError(_0x4339b7,null));};exports[_0xd66e('0x4a')]=function(_0x2f57dc,_0x3cbf73){return db[_0xd66e('0x2b')][_0xd66e('0x4a')](_0x2f57dc['body'],{})[_0xd66e('0x24')](function(_0x47928a){var _0xee971d=_0x2f57dc[_0xd66e('0x4b')][_0xd66e('0x25')]({'plain':!![]});if(!_0xee971d)throw new Error(_0xd66e('0x4c'));if(_0xee971d[_0xd66e('0x4d')]===_0xd66e('0x4b')){var _0x555b23=_0x47928a[_0xd66e('0x25')]({'plain':!![]});var _0x37f8cd=_0xd66e('0x26');return db[_0xd66e('0x4e')][_0xd66e('0x48')]({'where':{'name':_0x37f8cd,'userProfileId':_0xee971d[_0xd66e('0x4f')]},'raw':!![]})[_0xd66e('0x24')](function(_0x2e1c32){if(_0x2e1c32&&_0x2e1c32[_0xd66e('0x50')]===0x0){return db[_0xd66e('0x51')][_0xd66e('0x4a')]({'name':_0x555b23[_0xd66e('0x29')],'resourceId':_0x555b23['id'],'type':_0x2e1c32[_0xd66e('0x29')],'sectionId':_0x2e1c32['id']},{})[_0xd66e('0x24')](function(){return _0x47928a;});}else{return _0x47928a;}})['catch'](function(_0xf056f){logger[_0xd66e('0x27')](_0xd66e('0x52'),_0xf056f);throw _0xf056f;});}return _0x47928a;})[_0xd66e('0x24')](respondWithResult(_0x3cbf73,0xc9))[_0xd66e('0x49')](handleError(_0x3cbf73,null));};exports[_0xd66e('0x23')]=function(_0x4ca970,_0x6d0177){if(_0x4ca970[_0xd66e('0x53')]['id']){delete _0x4ca970[_0xd66e('0x53')]['id'];}return db[_0xd66e('0x2b')][_0xd66e('0x48')]({'where':{'id':_0x4ca970[_0xd66e('0x46')]['id']}})[_0xd66e('0x24')](handleEntityNotFound(_0x6d0177,null))[_0xd66e('0x24')](saveUpdates(_0x4ca970[_0xd66e('0x53')],null))['then'](respondWithResult(_0x6d0177,null))['catch'](handleError(_0x6d0177,null));};exports[_0xd66e('0x54')]=function(_0x4fe8bb,_0x2442d3){return db[_0xd66e('0x2b')][_0xd66e('0x48')]({'where':{'id':_0x4fe8bb[_0xd66e('0x46')]['id']}})[_0xd66e('0x24')](handleEntityNotFound(_0x2442d3,null))[_0xd66e('0x24')](removeEntity(_0x2442d3,null))[_0xd66e('0x49')](handleError(_0x2442d3,null));}; \ No newline at end of file +var _0xdafd=['send','index','map','Tag','type','key','keys','query','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','destroy','then','get','Tags','error','stack','name'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdafd,0x11d));var _0xddaf=function(_0xd2b48e,_0x1480c3){_0xd2b48e=_0xd2b48e-0x0;var _0xa03845=_0xdafd[_0xd2b48e];return _0xa03845;};'use strict';var pdf=require(_0xddaf('0x0'));var emlformat=require(_0xddaf('0x1'));var rimraf=require(_0xddaf('0x2'));var zipdir=require(_0xddaf('0x3'));var jsonpatch=require(_0xddaf('0x4'));var rp=require(_0xddaf('0x5'));var moment=require('moment');var BPromise=require(_0xddaf('0x6'));var Mustache=require(_0xddaf('0x7'));var util=require(_0xddaf('0x8'));var path=require(_0xddaf('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xddaf('0xa'));var fs=require('fs');var _=require(_0xddaf('0xb'));var squel=require(_0xddaf('0xc'));var crypto=require('crypto');var jsforce=require(_0xddaf('0xd'));var deskjs=require(_0xddaf('0xe'));var toCsv=require(_0xddaf('0xf'));var querystring=require(_0xddaf('0x10'));var Papa=require(_0xddaf('0x11'));var Redis=require(_0xddaf('0x12'));var authService=require(_0xddaf('0x13'));var qs=require(_0xddaf('0x14'));var as=require(_0xddaf('0x15'));var hardwareService=require(_0xddaf('0x16'));var logger=require(_0xddaf('0x17'))(_0xddaf('0x18'));var utils=require('../../config/utils');var config=require(_0xddaf('0x19'));var db=require(_0xddaf('0x1a'))['db'];function respondWithStatusCode(_0x3bdb02,_0x2dfd4c){_0x2dfd4c=_0x2dfd4c||0xcc;return function(_0x19ec56){if(_0x19ec56){return _0x3bdb02[_0xddaf('0x1b')](_0x2dfd4c);}return _0x3bdb02[_0xddaf('0x1c')](_0x2dfd4c)[_0xddaf('0x1d')]();};}function respondWithResult(_0x2250b9,_0x53f97c){_0x53f97c=_0x53f97c||0xc8;return function(_0x16041c){if(_0x16041c){return _0x2250b9[_0xddaf('0x1c')](_0x53f97c)[_0xddaf('0x1e')](_0x16041c);}};}function respondWithFilteredResult(_0x119c15,_0x34622b){return function(_0x114a5c){if(_0x114a5c){var _0x22f81f=_0x114a5c[_0xddaf('0x1f')],_0x50a90f=_0x34622b['offset'],_0x3d4009=_0x34622b[_0xddaf('0x20')]+_0x34622b['limit'],_0x296c2d;if(_0x3d4009>=_0x22f81f){_0x3d4009=_0x22f81f;_0x296c2d=0xc8;}else{_0x296c2d=0xce;}_0x119c15[_0xddaf('0x1c')](_0x296c2d);return _0x119c15[_0xddaf('0x21')]('Content-Range',_0x50a90f+'-'+_0x3d4009+'/'+_0x22f81f)[_0xddaf('0x1e')](_0x114a5c);}return null;};}function patchUpdates(_0x5dfd67){return function(_0x2ee19e){try{jsonpatch[_0xddaf('0x22')](_0x2ee19e,_0x5dfd67,!![]);}catch(_0x229343){return BPromise[_0xddaf('0x23')](_0x229343);}return _0x2ee19e['save']();};}function saveUpdates(_0x153ccc,_0x50d2d8){return function(_0x55a7d8){if(_0x55a7d8){return _0x55a7d8['update'](_0x153ccc)['then'](function(_0x612bc4){return _0x612bc4;});}return null;};}function removeEntity(_0x3f8978,_0xe74970){return function(_0x534224){if(_0x534224){return _0x534224[_0xddaf('0x24')]()[_0xddaf('0x25')](function(){var _0x4fe48c=_0x534224[_0xddaf('0x26')]({'plain':!![]});var _0x543565=_0xddaf('0x27');return db['UserProfileResource'][_0xddaf('0x24')]({'where':{'type':_0x543565,'resourceId':_0x4fe48c['id']}})[_0xddaf('0x25')](function(){return _0x534224;});})[_0xddaf('0x25')](function(){_0x3f8978[_0xddaf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25640c,_0x16780b){return function(_0x70a3fb){if(!_0x70a3fb){_0x25640c[_0xddaf('0x1b')](0x194);}return _0x70a3fb;};}function handleError(_0x2510d0,_0x5380e7){_0x5380e7=_0x5380e7||0x1f4;return function(_0x46dfda){logger[_0xddaf('0x28')](_0x46dfda[_0xddaf('0x29')]);if(_0x46dfda[_0xddaf('0x2a')]){delete _0x46dfda[_0xddaf('0x2a')];}_0x2510d0[_0xddaf('0x1c')](_0x5380e7)[_0xddaf('0x2b')](_0x46dfda);};}exports[_0xddaf('0x2c')]=function(_0x3d187b,_0x8002da){var _0x4a2baf={},_0x2a744e={},_0x24e111={'count':0x0,'rows':[]};var _0x439da3=_[_0xddaf('0x2d')](db[_0xddaf('0x2e')]['rawAttributes'],function(_0x5030b1){return{'name':_0x5030b1['fieldName'],'type':_0x5030b1[_0xddaf('0x2f')][_0xddaf('0x30')]};});_0x2a744e['model']=_[_0xddaf('0x2d')](_0x439da3,_0xddaf('0x2a'));_0x2a744e['query']=_[_0xddaf('0x31')](_0x3d187b[_0xddaf('0x32')]);_0x2a744e['filters']=_[_0xddaf('0x33')](_0x2a744e[_0xddaf('0x34')],_0x2a744e[_0xddaf('0x32')]);_0x4a2baf['attributes']=_[_0xddaf('0x33')](_0x2a744e['model'],qs[_0xddaf('0x35')](_0x3d187b[_0xddaf('0x32')][_0xddaf('0x35')]));_0x4a2baf[_0xddaf('0x36')]=_0x4a2baf['attributes'][_0xddaf('0x37')]?_0x4a2baf[_0xddaf('0x36')]:_0x2a744e[_0xddaf('0x34')];if(!_0x3d187b['query']['hasOwnProperty'](_0xddaf('0x38'))){_0x4a2baf['limit']=qs[_0xddaf('0x39')](_0x3d187b[_0xddaf('0x32')][_0xddaf('0x39')]);_0x4a2baf[_0xddaf('0x20')]=qs[_0xddaf('0x20')](_0x3d187b[_0xddaf('0x32')][_0xddaf('0x20')]);}_0x4a2baf[_0xddaf('0x3a')]=qs[_0xddaf('0x3b')](_0x3d187b[_0xddaf('0x32')][_0xddaf('0x3b')]);_0x4a2baf[_0xddaf('0x3c')]=qs[_0xddaf('0x3d')](_['pick'](_0x3d187b[_0xddaf('0x32')],_0x2a744e[_0xddaf('0x3d')]),_0x439da3);if(_0x3d187b[_0xddaf('0x32')][_0xddaf('0x3e')]){_0x4a2baf[_0xddaf('0x3c')]=_[_0xddaf('0x3f')](_0x4a2baf[_0xddaf('0x3c')],{'$or':_['map'](_0x439da3,function(_0x508605){if(_0x508605[_0xddaf('0x2f')]!==_0xddaf('0x40')){var _0x3147e0={};_0x3147e0[_0x508605['name']]={'$like':'%'+_0x3d187b['query'][_0xddaf('0x3e')]+'%'};return _0x3147e0;}})});}_0x4a2baf=_[_0xddaf('0x3f')]({},_0x4a2baf,_0x3d187b['options']);var _0x176f87={'where':_0x4a2baf[_0xddaf('0x3c')]};return db[_0xddaf('0x2e')][_0xddaf('0x1f')](_0x176f87)['then'](function(_0x10f442){_0x24e111[_0xddaf('0x1f')]=_0x10f442;if(_0x3d187b[_0xddaf('0x32')][_0xddaf('0x41')]){_0x4a2baf[_0xddaf('0x42')]=[{'all':!![]}];}return db['Tag'][_0xddaf('0x43')](_0x4a2baf);})['then'](function(_0x49e7d9){_0x24e111[_0xddaf('0x44')]=_0x49e7d9;return _0x24e111;})[_0xddaf('0x25')](respondWithFilteredResult(_0x8002da,_0x4a2baf))[_0xddaf('0x45')](handleError(_0x8002da,null));};exports[_0xddaf('0x46')]=function(_0x4fa5ec,_0xd3be05){var _0x27485f={'raw':!![],'where':{'id':_0x4fa5ec['params']['id']}},_0x2644f4={};_0x2644f4['model']=_[_0xddaf('0x31')](db[_0xddaf('0x2e')]['rawAttributes']);_0x2644f4['query']=_[_0xddaf('0x31')](_0x4fa5ec[_0xddaf('0x32')]);_0x2644f4[_0xddaf('0x3d')]=_['intersection'](_0x2644f4[_0xddaf('0x34')],_0x2644f4[_0xddaf('0x32')]);_0x27485f[_0xddaf('0x36')]=_[_0xddaf('0x33')](_0x2644f4[_0xddaf('0x34')],qs[_0xddaf('0x35')](_0x4fa5ec[_0xddaf('0x32')][_0xddaf('0x35')]));_0x27485f['attributes']=_0x27485f[_0xddaf('0x36')]['length']?_0x27485f[_0xddaf('0x36')]:_0x2644f4['model'];if(_0x4fa5ec[_0xddaf('0x32')][_0xddaf('0x41')]){_0x27485f[_0xddaf('0x42')]=[{'all':!![]}];}_0x27485f=_[_0xddaf('0x3f')]({},_0x27485f,_0x4fa5ec[_0xddaf('0x47')]);return db[_0xddaf('0x2e')]['find'](_0x27485f)[_0xddaf('0x25')](handleEntityNotFound(_0xd3be05,null))[_0xddaf('0x25')](respondWithResult(_0xd3be05,null))[_0xddaf('0x45')](handleError(_0xd3be05,null));};exports['create']=function(_0x1ce005,_0x866225){return db['Tag'][_0xddaf('0x48')](_0x1ce005['body'],{})[_0xddaf('0x25')](function(_0x171044){var _0x216f6c=_0x1ce005[_0xddaf('0x49')][_0xddaf('0x26')]({'plain':!![]});if(!_0x216f6c)throw new Error(_0xddaf('0x4a'));if(_0x216f6c[_0xddaf('0x4b')]===_0xddaf('0x49')){var _0x254ecb=_0x171044[_0xddaf('0x26')]({'plain':!![]});var _0x6f2169=_0xddaf('0x27');return db[_0xddaf('0x4c')][_0xddaf('0x4d')]({'where':{'name':_0x6f2169,'userProfileId':_0x216f6c['userProfileId']},'raw':!![]})[_0xddaf('0x25')](function(_0x52792e){if(_0x52792e&&_0x52792e['autoAssociation']===0x0){return db[_0xddaf('0x4e')][_0xddaf('0x48')]({'name':_0x254ecb[_0xddaf('0x2a')],'resourceId':_0x254ecb['id'],'type':_0x52792e[_0xddaf('0x2a')],'sectionId':_0x52792e['id']},{})[_0xddaf('0x25')](function(){return _0x171044;});}else{return _0x171044;}})[_0xddaf('0x45')](function(_0x31ab20){logger[_0xddaf('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31ab20);throw _0x31ab20;});}return _0x171044;})[_0xddaf('0x25')](respondWithResult(_0x866225,0xc9))[_0xddaf('0x45')](handleError(_0x866225,null));};exports[_0xddaf('0x4f')]=function(_0x4f4c1e,_0x2e4719){if(_0x4f4c1e[_0xddaf('0x50')]['id']){delete _0x4f4c1e['body']['id'];}return db[_0xddaf('0x2e')][_0xddaf('0x4d')]({'where':{'id':_0x4f4c1e[_0xddaf('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e4719,null))[_0xddaf('0x25')](saveUpdates(_0x4f4c1e['body'],null))[_0xddaf('0x25')](respondWithResult(_0x2e4719,null))[_0xddaf('0x45')](handleError(_0x2e4719,null));};exports[_0xddaf('0x24')]=function(_0x522e52,_0xc0980e){return db[_0xddaf('0x2e')][_0xddaf('0x4d')]({'where':{'id':_0x522e52[_0xddaf('0x51')]['id']}})[_0xddaf('0x25')](handleEntityNotFound(_0xc0980e,null))['then'](removeEntity(_0xc0980e,null))['catch'](handleError(_0xc0980e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cb0ae24..97337cb 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 _0xb609=['exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb609,0x1e5));var _0x9b60=function(_0x1637c5,_0x2e5c3f){_0x1637c5=_0x1637c5-0x0;var _0x3a0202=_0xb609[_0x1637c5];return _0x3a0202;};'use strict';var _=require('lodash');var util=require(_0x9b60('0x0'));var logger=require(_0x9b60('0x1'))(_0x9b60('0x2'));var moment=require(_0x9b60('0x3'));var BPromise=require(_0x9b60('0x4'));var rp=require(_0x9b60('0x5'));var fs=require('fs');var path=require(_0x9b60('0x6'));var rimraf=require(_0x9b60('0x7'));var config=require(_0x9b60('0x8'));var attributes=require(_0x9b60('0x9'));module[_0x9b60('0xa')]=function(_0x42bbf8,_0x4e9d59){return _0x42bbf8['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb501=['bluebird','path','../../config/environment','exports','Tag','tools_tags','lodash','util','../../config/logger','api'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xb501,0x1d2));var _0x1b50=function(_0x849be6,_0x574641){_0x849be6=_0x849be6-0x0;var _0x100d66=_0xb501[_0x849be6];return _0x100d66;};'use strict';var _=require(_0x1b50('0x0'));var util=require(_0x1b50('0x1'));var logger=require(_0x1b50('0x2'))(_0x1b50('0x3'));var moment=require('moment');var BPromise=require(_0x1b50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b50('0x5'));var rimraf=require('rimraf');var config=require(_0x1b50('0x6'));var attributes=require('./tag.attributes');module[_0x1b50('0x7')]=function(_0x333f0a,_0x3ae8b4){return _0x333f0a['define'](_0x1b50('0x8'),attributes,{'tableName':_0x1b50('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a437514..724b234 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 _0xe706=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\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(_0x1837bc,_0x197b05){var _0x3d43d9=function(_0x910246){while(--_0x910246){_0x1837bc['push'](_0x1837bc['shift']());}};_0x3d43d9(++_0x197b05);}(_0xe706,0xa3));var _0x6e70=function(_0x2e9280,_0x44d032){_0x2e9280=_0x2e9280-0x0;var _0x17f9e5=_0xe706[_0x2e9280];return _0x17f9e5;};'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']('Tag,\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']('Tag,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x0fd9,0xa3));var _0x90fd=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x0fd9[_0x39872b];return _0x55fa18;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('Tag,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('Tag,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0db5aa3..5a767eb 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 _0xc601=['addQueues','addAgents','/:id','update','delete','destroy','removeQueues','multer','connect-timeout','./team.controller','get','show','/:id/queues','isAuthenticated','getQueues','/:id/users','getAgents','post','create'];(function(_0x468f4b,_0x46903a){var _0x492398=function(_0x392a1b){while(--_0x392a1b){_0x468f4b['push'](_0x468f4b['shift']());}};_0x492398(++_0x46903a);}(_0xc601,0x1a9));var _0x1c60=function(_0x5cd90a,_0x5c968c){_0x5cd90a=_0x5cd90a-0x0;var _0x31cb47=_0xc601[_0x5cd90a];return _0x31cb47;};'use strict';var multer=require(_0x1c60('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1c60('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1c60('0x2'));router[_0x1c60('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c60('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x1c60('0x4')]);router[_0x1c60('0x3')](_0x1c60('0x5'),auth[_0x1c60('0x6')](),controller[_0x1c60('0x7')]);router[_0x1c60('0x3')](_0x1c60('0x8'),auth[_0x1c60('0x6')](),controller[_0x1c60('0x9')]);router[_0x1c60('0xa')]('/',auth[_0x1c60('0x6')](),controller[_0x1c60('0xb')]);router[_0x1c60('0xa')](_0x1c60('0x5'),auth[_0x1c60('0x6')](),controller[_0x1c60('0xc')]);router[_0x1c60('0xa')](_0x1c60('0x8'),auth[_0x1c60('0x6')](),controller[_0x1c60('0xd')]);router['put'](_0x1c60('0xe'),auth['isAuthenticated'](),controller[_0x1c60('0xf')]);router[_0x1c60('0x10')](_0x1c60('0xe'),auth[_0x1c60('0x6')](),controller[_0x1c60('0x11')]);router['delete']('/:id/queues',auth[_0x1c60('0x6')](),controller[_0x1c60('0x12')]);router[_0x1c60('0x10')](_0x1c60('0x8'),auth[_0x1c60('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xc48b=['addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','express','../../components/auth/service','./team.controller','isAuthenticated','index','get','/:id/queues','getQueues','/:id/users','post','create','addQueues'];(function(_0x3f69e3,_0x191d58){var _0x1388f0=function(_0x50b7da){while(--_0x50b7da){_0x3f69e3['push'](_0x3f69e3['shift']());}};_0x1388f0(++_0x191d58);}(_0xc48b,0x133));var _0xbc48=function(_0x3634d8,_0xbfa70b){_0x3634d8=_0x3634d8-0x0;var _0x2c1369=_0xc48b[_0x3634d8];return _0x2c1369;};'use strict';var multer=require(_0xbc48('0x0'));var util=require(_0xbc48('0x1'));var path=require(_0xbc48('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc48('0x3'));var router=express['Router']();var auth=require(_0xbc48('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc48('0x5'));router['get']('/',auth[_0xbc48('0x6')](),controller[_0xbc48('0x7')]);router[_0xbc48('0x8')]('/:id',auth[_0xbc48('0x6')](),controller['show']);router[_0xbc48('0x8')](_0xbc48('0x9'),auth[_0xbc48('0x6')](),controller[_0xbc48('0xa')]);router[_0xbc48('0x8')](_0xbc48('0xb'),auth[_0xbc48('0x6')](),controller['getAgents']);router[_0xbc48('0xc')]('/',auth[_0xbc48('0x6')](),controller[_0xbc48('0xd')]);router[_0xbc48('0xc')](_0xbc48('0x9'),auth[_0xbc48('0x6')](),controller[_0xbc48('0xe')]);router['post'](_0xbc48('0xb'),auth[_0xbc48('0x6')](),controller[_0xbc48('0xf')]);router[_0xbc48('0x10')](_0xbc48('0x11'),auth['isAuthenticated'](),controller[_0xbc48('0x12')]);router[_0xbc48('0x13')](_0xbc48('0x11'),auth[_0xbc48('0x6')](),controller[_0xbc48('0x14')]);router[_0xbc48('0x13')](_0xbc48('0x9'),auth[_0xbc48('0x6')](),controller['removeQueues']);router['delete']('/:id/users',auth[_0xbc48('0x6')](),controller[_0xbc48('0x15')]);module[_0xbc48('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 715c7a6..4188d2c 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 _0xe067=['STRING','name','exports'];(function(_0x20bb3a,_0x2f9595){var _0x39e219=function(_0x3c2abc){while(--_0x3c2abc){_0x20bb3a['push'](_0x20bb3a['shift']());}};_0x39e219(++_0x2f9595);}(_0xe067,0xec));var _0x7e06=function(_0x5f083d,_0x24edd9){_0x5f083d=_0x5f083d-0x0;var _0x29a0f2=_0xe067[_0x5f083d];return _0x29a0f2;};'use strict';var Sequelize=require('sequelize');module[_0x7e06('0x0')]={'name':{'type':Sequelize[_0x7e06('0x1')],'allowNull':![],'unique':_0x7e06('0x2')},'description':{'type':Sequelize[_0x7e06('0x1')]}}; \ No newline at end of file +var _0xc7bd=['sequelize','exports','name','STRING'];(function(_0x4c6302,_0x311370){var _0x58bc5c=function(_0x51f64d){while(--_0x51f64d){_0x4c6302['push'](_0x4c6302['shift']());}};_0x58bc5c(++_0x311370);}(_0xc7bd,0xd4));var _0xdc7b=function(_0x1c7708,_0x1b2740){_0x1c7708=_0x1c7708-0x0;var _0x23bd79=_0xc7bd[_0x1c7708];return _0x23bd79;};'use strict';var Sequelize=require(_0xdc7b('0x0'));module[_0xdc7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdc7b('0x2')},'description':{'type':Sequelize[_0xdc7b('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 7a18ac7..7184dac 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 _0xf69b=['index','Team','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','pick','addQueues','isValidChannel','Sequelize','Queues','removeQueues','remove','ids','addAgents','Chat','Sms','Fax','Openchannel','Whatsapp','each','Voice','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','userTeam:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','sendStatus','error','name','send'];(function(_0x5ecda3,_0x958008){var _0x11506b=function(_0x42168e){while(--_0x42168e){_0x5ecda3['push'](_0x5ecda3['shift']());}};_0x11506b(++_0x958008);}(_0xf69b,0x1e8));var _0xbf69=function(_0x4b093a,_0x4758e5){_0x4b093a=_0x4b093a-0x0;var _0x3a91f1=_0xf69b[_0x4b093a];return _0x3a91f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf69('0x0'));var rimraf=require(_0xbf69('0x1'));var zipdir=require(_0xbf69('0x2'));var jsonpatch=require(_0xbf69('0x3'));var rp=require(_0xbf69('0x4'));var moment=require(_0xbf69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf69('0x6'));var util=require(_0xbf69('0x7'));var path=require('path');var sox=require(_0xbf69('0x8'));var csv=require(_0xbf69('0x9'));var ejs=require(_0xbf69('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbf69('0xb'));var crypto=require(_0xbf69('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf69('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf69('0xe'));var Redis=require('ioredis');var authService=require(_0xbf69('0xf'));var qs=require(_0xbf69('0x10'));var as=require(_0xbf69('0x11'));var hardwareService=require(_0xbf69('0x12'));var logger=require('../../config/logger')(_0xbf69('0x13'));var utils=require(_0xbf69('0x14'));var config=require(_0xbf69('0x15'));var db=require(_0xbf69('0x16'))['db'];config[_0xbf69('0x17')]=_['defaults'](config['redis'],{'host':_0xbf69('0x18'),'port':0x18eb});var socket=require(_0xbf69('0x19'))(new Redis(config['redis']));require(_0xbf69('0x1a'))[_0xbf69('0x1b')](socket);function respondWithStatusCode(_0x246db6,_0x465512){_0x465512=_0x465512||0xcc;return function(_0x38b6a9){if(_0x38b6a9){return _0x246db6['sendStatus'](_0x465512);}return _0x246db6[_0xbf69('0x1c')](_0x465512)[_0xbf69('0x1d')]();};}function respondWithResult(_0x3f0381,_0x2ee436){_0x2ee436=_0x2ee436||0xc8;return function(_0x49e1fb){if(_0x49e1fb){return _0x3f0381[_0xbf69('0x1c')](_0x2ee436)[_0xbf69('0x1e')](_0x49e1fb);}};}function respondWithFilteredResult(_0x166564,_0x71a9c8){return function(_0x15d517){if(_0x15d517){var _0x3e320c=_0x15d517[_0xbf69('0x1f')],_0x1ba7c1=_0x71a9c8['offset'],_0x5856d9=_0x71a9c8[_0xbf69('0x20')]+_0x71a9c8[_0xbf69('0x21')],_0x4e46db;if(_0x5856d9>=_0x3e320c){_0x5856d9=_0x3e320c;_0x4e46db=0xc8;}else{_0x4e46db=0xce;}_0x166564[_0xbf69('0x1c')](_0x4e46db);return _0x166564[_0xbf69('0x22')](_0xbf69('0x23'),_0x1ba7c1+'-'+_0x5856d9+'/'+_0x3e320c)[_0xbf69('0x1e')](_0x15d517);}return null;};}function patchUpdates(_0x48c427){return function(_0x168fbc){try{jsonpatch[_0xbf69('0x24')](_0x168fbc,_0x48c427,!![]);}catch(_0x25cf44){return BPromise[_0xbf69('0x25')](_0x25cf44);}return _0x168fbc[_0xbf69('0x26')]();};}function saveUpdates(_0x465e65,_0x85fa71){return function(_0x3e2895){if(_0x3e2895){return _0x3e2895[_0xbf69('0x27')](_0x465e65)[_0xbf69('0x28')](function(_0x1a3d06){return _0x1a3d06;});}return null;};}function removeEntity(_0x210f60,_0xc8d83d){return function(_0x359c53){if(_0x359c53){return _0x359c53[_0xbf69('0x29')]()[_0xbf69('0x28')](function(){var _0x1ebfa0=_0x359c53[_0xbf69('0x2a')]({'plain':!![]});var _0x1efd21=_0xbf69('0x2b');return db['UserProfileResource'][_0xbf69('0x29')]({'where':{'type':_0x1efd21,'resourceId':_0x1ebfa0['id']}})[_0xbf69('0x28')](function(){return _0x359c53;});})[_0xbf69('0x28')](function(){_0x210f60[_0xbf69('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58d2ea,_0x60488){return function(_0x1f3f24){if(!_0x1f3f24){_0x58d2ea[_0xbf69('0x2c')](0x194);}return _0x1f3f24;};}function handleError(_0x2aac60,_0x3a0dfe){_0x3a0dfe=_0x3a0dfe||0x1f4;return function(_0x428356){logger[_0xbf69('0x2d')](_0x428356['stack']);if(_0x428356[_0xbf69('0x2e')]){delete _0x428356['name'];}_0x2aac60[_0xbf69('0x1c')](_0x3a0dfe)[_0xbf69('0x2f')](_0x428356);};}exports[_0xbf69('0x30')]=function(_0x2589ce,_0x37eee6){var _0x45f890={},_0x51799f={},_0x2501e2={'count':0x0,'rows':[]};var _0x5d51f8=_['map'](db[_0xbf69('0x31')][_0xbf69('0x32')],function(_0x32a893){return{'name':_0x32a893[_0xbf69('0x33')],'type':_0x32a893[_0xbf69('0x34')]['key']};});_0x51799f[_0xbf69('0x35')]=_[_0xbf69('0x36')](_0x5d51f8,_0xbf69('0x2e'));_0x51799f['query']=_['keys'](_0x2589ce[_0xbf69('0x37')]);_0x51799f[_0xbf69('0x38')]=_['intersection'](_0x51799f[_0xbf69('0x35')],_0x51799f['query']);_0x45f890[_0xbf69('0x39')]=_[_0xbf69('0x3a')](_0x51799f['model'],qs['fields'](_0x2589ce['query'][_0xbf69('0x3b')]));_0x45f890[_0xbf69('0x39')]=_0x45f890[_0xbf69('0x39')]['length']?_0x45f890[_0xbf69('0x39')]:_0x51799f[_0xbf69('0x35')];if(!_0x2589ce[_0xbf69('0x37')][_0xbf69('0x3c')](_0xbf69('0x3d'))){_0x45f890[_0xbf69('0x21')]=qs[_0xbf69('0x21')](_0x2589ce['query'][_0xbf69('0x21')]);_0x45f890[_0xbf69('0x20')]=qs['offset'](_0x2589ce[_0xbf69('0x37')][_0xbf69('0x20')]);}_0x45f890['order']=qs['sort'](_0x2589ce[_0xbf69('0x37')][_0xbf69('0x3e')]);_0x45f890[_0xbf69('0x3f')]=qs['filters'](_['pick'](_0x2589ce[_0xbf69('0x37')],_0x51799f['filters']),_0x5d51f8);if(_0x2589ce[_0xbf69('0x37')][_0xbf69('0x40')]){_0x45f890[_0xbf69('0x3f')]=_[_0xbf69('0x41')](_0x45f890[_0xbf69('0x3f')],{'$or':_[_0xbf69('0x36')](_0x5d51f8,function(_0x2fd95d){if(_0x2fd95d[_0xbf69('0x34')]!==_0xbf69('0x42')){var _0x157384={};_0x157384[_0x2fd95d[_0xbf69('0x2e')]]={'$like':'%'+_0x2589ce[_0xbf69('0x37')]['filter']+'%'};return _0x157384;}})});}_0x45f890=_[_0xbf69('0x41')]({},_0x45f890,_0x2589ce['options']);var _0x176b25={'where':_0x45f890['where']};return db['Team'][_0xbf69('0x1f')](_0x176b25)[_0xbf69('0x28')](function(_0x3b4a26){_0x2501e2['count']=_0x3b4a26;if(_0x2589ce[_0xbf69('0x37')][_0xbf69('0x43')]){_0x45f890[_0xbf69('0x44')]=[{'all':!![]}];}return db[_0xbf69('0x31')]['findAll'](_0x45f890);})[_0xbf69('0x28')](function(_0xa5d91a){_0x2501e2[_0xbf69('0x45')]=_0xa5d91a;return _0x2501e2;})[_0xbf69('0x28')](respondWithFilteredResult(_0x37eee6,_0x45f890))[_0xbf69('0x46')](handleError(_0x37eee6,null));};exports['show']=function(_0x32e3e2,_0x5d38fa){var _0x74efcf={'raw':![],'where':{'id':_0x32e3e2[_0xbf69('0x47')]['id']}},_0x35a45f={};_0x35a45f['model']=_['keys'](db[_0xbf69('0x31')][_0xbf69('0x32')]);_0x35a45f[_0xbf69('0x37')]=_[_0xbf69('0x48')](_0x32e3e2[_0xbf69('0x37')]);_0x35a45f['filters']=_[_0xbf69('0x3a')](_0x35a45f[_0xbf69('0x35')],_0x35a45f[_0xbf69('0x37')]);_0x74efcf[_0xbf69('0x39')]=_[_0xbf69('0x3a')](_0x35a45f[_0xbf69('0x35')],qs['fields'](_0x32e3e2[_0xbf69('0x37')][_0xbf69('0x3b')]));_0x74efcf[_0xbf69('0x39')]=_0x74efcf[_0xbf69('0x39')][_0xbf69('0x49')]?_0x74efcf[_0xbf69('0x39')]:_0x35a45f[_0xbf69('0x35')];if(_0x32e3e2[_0xbf69('0x37')][_0xbf69('0x43')]){_0x74efcf[_0xbf69('0x44')]=[{'all':!![]}];}_0x74efcf=_[_0xbf69('0x41')]({},_0x74efcf,_0x32e3e2[_0xbf69('0x4a')]);return db[_0xbf69('0x31')][_0xbf69('0x4b')](_0x74efcf)[_0xbf69('0x28')](handleEntityNotFound(_0x5d38fa,null))[_0xbf69('0x28')](respondWithResult(_0x5d38fa,null))[_0xbf69('0x46')](handleError(_0x5d38fa,null));};exports[_0xbf69('0x4c')]=function(_0x4b4210,_0x10266d){return db[_0xbf69('0x31')][_0xbf69('0x4c')](_0x4b4210[_0xbf69('0x4d')],{})[_0xbf69('0x28')](function(_0x4c9410){var _0x4d2f29=_0x4b4210['user']['get']({'plain':!![]});if(!_0x4d2f29)throw new Error(_0xbf69('0x4e'));if(_0x4d2f29[_0xbf69('0x4f')]===_0xbf69('0x50')){var _0x214331=_0x4c9410[_0xbf69('0x2a')]({'plain':!![]});var _0x1424a0='Teams';return db[_0xbf69('0x51')]['find']({'where':{'name':_0x1424a0,'userProfileId':_0x4d2f29[_0xbf69('0x52')]},'raw':!![]})[_0xbf69('0x28')](function(_0x28da1e){if(_0x28da1e&&_0x28da1e[_0xbf69('0x53')]===0x0){return db[_0xbf69('0x54')][_0xbf69('0x4c')]({'name':_0x214331['name'],'resourceId':_0x214331['id'],'type':_0x28da1e[_0xbf69('0x2e')],'sectionId':_0x28da1e['id']},{})[_0xbf69('0x28')](function(){return _0x4c9410;});}else{return _0x4c9410;}})['catch'](function(_0x336d35){logger[_0xbf69('0x2d')](_0xbf69('0x55'),_0x336d35);throw _0x336d35;});}return _0x4c9410;})['then'](respondWithResult(_0x10266d,0xc9))['catch'](handleError(_0x10266d,null));};exports['update']=function(_0xf37cc7,_0x2b873c){if(_0xf37cc7['body']['id']){delete _0xf37cc7[_0xbf69('0x4d')]['id'];}return db[_0xbf69('0x31')][_0xbf69('0x4b')]({'where':{'id':_0xf37cc7['params']['id']}})[_0xbf69('0x28')](handleEntityNotFound(_0x2b873c,null))[_0xbf69('0x28')](saveUpdates(_0xf37cc7['body'],null))[_0xbf69('0x28')](respondWithResult(_0x2b873c,null))[_0xbf69('0x46')](handleError(_0x2b873c,null));};exports[_0xbf69('0x29')]=function(_0x37ce20,_0x327d94){return db[_0xbf69('0x31')][_0xbf69('0x4b')]({'where':{'id':_0x37ce20[_0xbf69('0x47')]['id']}})[_0xbf69('0x28')](handleEntityNotFound(_0x327d94,null))[_0xbf69('0x28')](removeEntity(_0x327d94,null))[_0xbf69('0x46')](handleError(_0x327d94,null));};exports[_0xbf69('0x56')]=function(_0x1b7436,_0x42c8ff,_0xc82e59){return db[_0xbf69('0x31')][_0xbf69('0x57')]({'where':{'id':_0x1b7436['params']['id']}})['then'](handleEntityNotFound(_0x42c8ff,null))[_0xbf69('0x28')](function(_0x50b281){if(!_0x1b7436[_0xbf69('0x37')][_0xbf69('0x58')]||!utils['isValidChannel'](_0x1b7436[_0xbf69('0x37')]['channel'])){throw new db['Sequelize'][(_0xbf69('0x59'))](_0xbf69('0x5a'));}var _0x3941cc={};var _0x559eaa={};_0x559eaa['model']=_[_0xbf69('0x48')](db[_[_0xbf69('0x5b')](_0x1b7436[_0xbf69('0x37')][_0xbf69('0x58')][_0xbf69('0x5c')]())+_0xbf69('0x5d')]['rawAttributes']);_0x559eaa['query']=_[_0xbf69('0x48')](_0x1b7436['query']);_0x559eaa[_0xbf69('0x38')]=_[_0xbf69('0x3a')](_0x559eaa[_0xbf69('0x35')],_0x559eaa[_0xbf69('0x37')]);_0x3941cc['attributes']=_[_0xbf69('0x3a')](_0x559eaa[_0xbf69('0x35')],qs[_0xbf69('0x3b')](_0x1b7436[_0xbf69('0x37')][_0xbf69('0x3b')]));_0x3941cc[_0xbf69('0x39')]=_0x3941cc[_0xbf69('0x39')][_0xbf69('0x49')]?_0x3941cc['attributes']:_0x559eaa[_0xbf69('0x35')];_0x3941cc[_0xbf69('0x21')]=qs[_0xbf69('0x21')](_0x1b7436['query'][_0xbf69('0x21')]);_0x3941cc[_0xbf69('0x20')]=qs[_0xbf69('0x20')](_0x1b7436[_0xbf69('0x37')]['offset']);_0x3941cc[_0xbf69('0x5e')]=qs[_0xbf69('0x3e')](_0x1b7436[_0xbf69('0x37')][_0xbf69('0x3e')]);_0x3941cc[_0xbf69('0x3f')]=qs[_0xbf69('0x38')](_[_0xbf69('0x5f')](_0x1b7436[_0xbf69('0x37')],_0x559eaa[_0xbf69('0x38')]));_0x3941cc=_[_0xbf69('0x41')]({},_0x3941cc,_0x1b7436[_0xbf69('0x4a')]);return _0x50b281[_0xbf69('0x2a')+_[_0xbf69('0x5b')](_0x1b7436[_0xbf69('0x37')][_0xbf69('0x58')][_0xbf69('0x5c')]())+'Queues'](_0x3941cc);})[_0xbf69('0x28')](respondWithResult(_0x42c8ff,null))['catch'](handleError(_0x42c8ff,null));};exports[_0xbf69('0x60')]=function(_0x41742c,_0x590797,_0x5ece7c){return db[_0xbf69('0x31')][_0xbf69('0x57')]({'where':{'id':_0x41742c['params']['id']}})['then'](function(_0x53e31e){if(_0x53e31e){if(!_0x41742c[_0xbf69('0x4d')][_0xbf69('0x58')]||!utils[_0xbf69('0x61')](_0x41742c[_0xbf69('0x4d')][_0xbf69('0x58')])){throw new db[(_0xbf69('0x62'))][(_0xbf69('0x59'))](_0xbf69('0x5a'));}return _0x53e31e['add'+_[_0xbf69('0x5b')](_0x41742c[_0xbf69('0x4d')]['channel']['toLowerCase']())+_0xbf69('0x63')](_0x41742c[_0xbf69('0x4d')]['ids']);}return null;})[_0xbf69('0x28')](handleEntityNotFound(_0x590797,null))[_0xbf69('0x28')](respondWithStatusCode(_0x590797,null))[_0xbf69('0x46')](handleError(_0x590797,null));};exports[_0xbf69('0x64')]=function(_0x41e934,_0x20d345,_0x5a13a2){return db[_0xbf69('0x31')][_0xbf69('0x57')]({'where':{'id':_0x41e934[_0xbf69('0x47')]['id']}})[_0xbf69('0x28')](function(_0x1a2fbd){if(_0x1a2fbd){if(!_0x41e934[_0xbf69('0x37')][_0xbf69('0x58')]||!utils[_0xbf69('0x61')](_0x41e934[_0xbf69('0x37')][_0xbf69('0x58')])){throw new db['Sequelize'][(_0xbf69('0x59'))](_0xbf69('0x5a'));}return _0x1a2fbd[_0xbf69('0x65')+_['capitalize'](_0x41e934[_0xbf69('0x37')][_0xbf69('0x58')][_0xbf69('0x5c')]())+_0xbf69('0x63')](_0x41e934[_0xbf69('0x37')][_0xbf69('0x66')]);}return null;})['then'](handleEntityNotFound(_0x20d345,null))[_0xbf69('0x28')](respondWithStatusCode(_0x20d345,null))[_0xbf69('0x46')](handleError(_0x20d345,null));};exports[_0xbf69('0x67')]=function(_0x66dc4c,_0x547cf1,_0x1d87d3){return db['Team']['find']({'where':{'id':_0x66dc4c[_0xbf69('0x47')]['id']}})[_0xbf69('0x28')](handleEntityNotFound(_0x547cf1,null))[_0xbf69('0x28')](function(_0x10fc61){if(_0x10fc61){var _0x59dfb4=['Voice',_0xbf69('0x68'),'Mail',_0xbf69('0x69'),_0xbf69('0x6a'),_0xbf69('0x6b'),_0xbf69('0x6c')];return BPromise[_0xbf69('0x6d')](_0x59dfb4,function(_0x1c9917){return _0x10fc61[_0xbf69('0x2a')+_0x1c9917+'Queues']({'attributes':['id',_0xbf69('0x2e')]})['then'](function(_0x410fa0){return BPromise[_0xbf69('0x6d')](_0x410fa0,function(_0x33e7e8){return _0x33e7e8[_0xbf69('0x67')](_0x66dc4c[_0xbf69('0x4d')][_0xbf69('0x66')])[_0xbf69('0x28')](function(){if(_0x1c9917===_0xbf69('0x6e')){return db['User'][_0xbf69('0x6f')]({'where':{'id':_0x66dc4c[_0xbf69('0x4d')][_0xbf69('0x66')]},'attributes':['id',_0xbf69('0x2e'),_0xbf69('0x70'),_0xbf69('0x71'),_0xbf69('0x72')],'raw':!![]})['then'](function(_0x51e66f){return BPromise[_0xbf69('0x6d')](_[_0xbf69('0x40')](_0x51e66f,{'online':0x1}),function(_0x4e6054){return db[_0xbf69('0x73')][_0xbf69('0x74')]({'membername':_0x4e6054[_0xbf69('0x2e')],'UserId':_0x4e6054['id'],'queue_name':_0x33e7e8[_0xbf69('0x2e')],'VoiceQueueId':_0x33e7e8['id'],'interface':_[_0xbf69('0x75')](_0x4e6054[_0xbf69('0x72')])?util[_0xbf69('0x76')](_0xbf69('0x77'),_0x4e6054[_0xbf69('0x2e')]):_0x4e6054[_0xbf69('0x72')],'paused':_0x4e6054[_0xbf69('0x71')]||![],'penalty':0x0});});});}});});})[_0xbf69('0x28')](function(){return _0x10fc61;});})[_0xbf69('0x28')](function(){return _0x10fc61;});}})[_0xbf69('0x28')](function(_0x1409de){if(_0x1409de){return _0x1409de[_0xbf69('0x67')](_0x66dc4c['body'][_0xbf69('0x66')],_[_0xbf69('0x78')](_0x66dc4c[_0xbf69('0x4d')],[_0xbf69('0x66'),'id'])||{})[_0xbf69('0x79')](function(_0x5c5360){for(var _0x2065c5=0x0;_0x2065c5<_0x66dc4c['body'][_0xbf69('0x66')][_0xbf69('0x49')];_0x2065c5+=0x1){socket[_0xbf69('0x7a')](_0xbf69('0x7b'),{'UserId':_0x66dc4c[_0xbf69('0x4d')][_0xbf69('0x66')][_0x2065c5],'TeamId':_0x66dc4c[_0xbf69('0x47')]['id']});}return _0x5c5360;});}})[_0xbf69('0x28')](respondWithResult(_0x547cf1,null))[_0xbf69('0x46')](handleError(_0x547cf1,null));};exports[_0xbf69('0x7c')]=function(_0x2d6cd4,_0x24b3cc,_0x2674f5){return db[_0xbf69('0x31')][_0xbf69('0x4b')]({'where':{'id':_0x2d6cd4[_0xbf69('0x47')]['id']}})['then'](handleEntityNotFound(_0x24b3cc,null))[_0xbf69('0x28')](function(_0x47b8b1){if(_0x47b8b1){return BPromise['each']([_0xbf69('0x7d'),_0xbf69('0x7e'),_0xbf69('0x7f'),_0xbf69('0x80'),_0xbf69('0x81'),_0xbf69('0x82'),_0xbf69('0x83')],function(_0x174053){return _0x47b8b1['get'+_[_0xbf69('0x5b')](_0x174053)+_0xbf69('0x63')]({'attributes':['id',_0xbf69('0x2e')]})[_0xbf69('0x28')](function(_0x41f7bc){return BPromise[_0xbf69('0x6d')](_0x41f7bc,function(_0x121df4){return _0x121df4['removeAgents'](_0x2d6cd4[_0xbf69('0x37')][_0xbf69('0x66')])[_0xbf69('0x28')](function(){if(_0x174053===_0xbf69('0x7d')){return db[_0xbf69('0x73')][_0xbf69('0x29')]({'where':{'VoiceQueueId':_0x121df4['id'],'UserId':_0x2d6cd4[_0xbf69('0x37')]['ids']}});}});});})[_0xbf69('0x28')](function(){return _0x47b8b1;});})[_0xbf69('0x28')](function(){return _0x47b8b1;});}})[_0xbf69('0x28')](function(_0x479540){if(_0x479540){return _0x479540[_0xbf69('0x7c')](_0x2d6cd4[_0xbf69('0x37')]['ids'])[_0xbf69('0x28')](function(){if(_['isArray'](_0x2d6cd4['query'][_0xbf69('0x66')])){for(var _0x4fa78f=0x0;_0x4fa78f<_0x2d6cd4[_0xbf69('0x37')][_0xbf69('0x66')][_0xbf69('0x49')];_0x4fa78f+=0x1){socket[_0xbf69('0x7a')](_0xbf69('0x84'),{'UserId':Number(_0x2d6cd4['query'][_0xbf69('0x66')][_0x4fa78f]),'TeamId':Number(_0x2d6cd4[_0xbf69('0x47')]['id'])});}}else{socket[_0xbf69('0x7a')](_0xbf69('0x84'),{'UserId':Number(_0x2d6cd4[_0xbf69('0x37')][_0xbf69('0x66')]),'TeamId':Number(_0x2d6cd4[_0xbf69('0x47')]['id'])});}});}})[_0xbf69('0x28')](respondWithStatusCode(_0x24b3cc,null))['catch'](handleError(_0x24b3cc,null));};exports[_0xbf69('0x85')]=function(_0x15cd58,_0x5d8633,_0x2538b4){var _0x336844={};var _0xaf2753={};var _0x3fa757;var _0x4c9fba;return db[_0xbf69('0x31')][_0xbf69('0x57')]({'where':{'id':_0x15cd58[_0xbf69('0x47')]['id']}})[_0xbf69('0x28')](handleEntityNotFound(_0x5d8633,null))['then'](function(_0x4221ec){if(_0x4221ec){_0x3fa757=_0x4221ec;_0xaf2753['model']=_[_0xbf69('0x48')](db['User'][_0xbf69('0x32')]);_0xaf2753[_0xbf69('0x37')]=_[_0xbf69('0x48')](_0x15cd58[_0xbf69('0x37')]);_0xaf2753[_0xbf69('0x38')]=_[_0xbf69('0x3a')](_0xaf2753[_0xbf69('0x35')],_0xaf2753[_0xbf69('0x37')]);_0x336844['attributes']=_['intersection'](_0xaf2753[_0xbf69('0x35')],qs[_0xbf69('0x3b')](_0x15cd58['query'][_0xbf69('0x3b')]));_0x336844[_0xbf69('0x39')]=_0x336844[_0xbf69('0x39')][_0xbf69('0x49')]?_0x336844[_0xbf69('0x39')]:_0xaf2753[_0xbf69('0x35')];_0x336844[_0xbf69('0x5e')]=qs[_0xbf69('0x3e')](_0x15cd58[_0xbf69('0x37')][_0xbf69('0x3e')]);_0x336844[_0xbf69('0x3f')]=qs[_0xbf69('0x38')](_[_0xbf69('0x5f')](_0x15cd58[_0xbf69('0x37')],_0xaf2753['filters']));if(_0x15cd58[_0xbf69('0x37')][_0xbf69('0x40')]){_0x336844[_0xbf69('0x3f')]=_[_0xbf69('0x41')](_0x336844[_0xbf69('0x3f')],{'$or':_['map'](_0x336844[_0xbf69('0x39')],function(_0x1796f1){var _0x5813c8={};_0x5813c8[_0x1796f1]={'$like':'%'+_0x15cd58[_0xbf69('0x37')][_0xbf69('0x40')]+'%'};return _0x5813c8;})});}_0x336844=_['merge']({},_0x336844,_0x15cd58[_0xbf69('0x4a')]);return _0x3fa757['getAgents'](_0x336844);}})[_0xbf69('0x28')](function(_0x3446c0){if(_0x3446c0){_0x4c9fba=_0x3446c0[_0xbf69('0x49')];if(!_0x15cd58['query'][_0xbf69('0x3c')](_0xbf69('0x3d'))){_0x336844[_0xbf69('0x21')]=qs[_0xbf69('0x21')](_0x15cd58['query'][_0xbf69('0x21')]);_0x336844[_0xbf69('0x20')]=qs[_0xbf69('0x20')](_0x15cd58['query'][_0xbf69('0x20')]);}return _0x3fa757[_0xbf69('0x85')](_0x336844);}})[_0xbf69('0x28')](function(_0x3096c8){if(_0x3096c8){return _0x3096c8?{'count':_0x4c9fba,'rows':_0x3096c8}:null;}})[_0xbf69('0x28')](respondWithResult(_0x5d8633,null))[_0xbf69('0x46')](handleError(_0x5d8633,null));}; \ No newline at end of file +var _0xc15e=['omit','spread','emit','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','isArray','userTeam:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','get','Teams','UserProfileResource','destroy','error','stack','send','map','Team','type','key','model','name','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','keys','rawAttributes','fields','includeAll','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','add','ids','removeQueues','isValidChannel','remove','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','SIP/%s'];(function(_0x48c9b3,_0x1fb678){var _0x4c782f=function(_0x4b3842){while(--_0x4b3842){_0x48c9b3['push'](_0x48c9b3['shift']());}};_0x4c782f(++_0x1fb678);}(_0xc15e,0x191));var _0xec15=function(_0x2ea0ab,_0xf66f63){_0x2ea0ab=_0x2ea0ab-0x0;var _0x2e235a=_0xc15e[_0x2ea0ab];return _0x2e235a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xec15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec15('0x1'));var moment=require(_0xec15('0x2'));var BPromise=require(_0xec15('0x3'));var Mustache=require(_0xec15('0x4'));var util=require(_0xec15('0x5'));var path=require(_0xec15('0x6'));var sox=require(_0xec15('0x7'));var csv=require(_0xec15('0x8'));var ejs=require(_0xec15('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec15('0xa'));var crypto=require(_0xec15('0xb'));var jsforce=require(_0xec15('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec15('0x8'));var querystring=require(_0xec15('0xd'));var Papa=require(_0xec15('0xe'));var Redis=require(_0xec15('0xf'));var authService=require(_0xec15('0x10'));var qs=require(_0xec15('0x11'));var as=require(_0xec15('0x12'));var hardwareService=require(_0xec15('0x13'));var logger=require(_0xec15('0x14'))(_0xec15('0x15'));var utils=require('../../config/utils');var config=require(_0xec15('0x16'));var db=require(_0xec15('0x17'))['db'];config[_0xec15('0x18')]=_[_0xec15('0x19')](config[_0xec15('0x18')],{'host':_0xec15('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec15('0x18')]));require(_0xec15('0x1b'))[_0xec15('0x1c')](socket);function respondWithStatusCode(_0x4cfad8,_0x435f27){_0x435f27=_0x435f27||0xcc;return function(_0x32a21c){if(_0x32a21c){return _0x4cfad8[_0xec15('0x1d')](_0x435f27);}return _0x4cfad8[_0xec15('0x1e')](_0x435f27)[_0xec15('0x1f')]();};}function respondWithResult(_0x22888c,_0x28fdf0){_0x28fdf0=_0x28fdf0||0xc8;return function(_0x5d5ffe){if(_0x5d5ffe){return _0x22888c['status'](_0x28fdf0)[_0xec15('0x20')](_0x5d5ffe);}};}function respondWithFilteredResult(_0x352270,_0x261ccd){return function(_0x285ae5){if(_0x285ae5){var _0x2b7316=_0x285ae5['count'],_0x19f643=_0x261ccd['offset'],_0x23b1cf=_0x261ccd[_0xec15('0x21')]+_0x261ccd[_0xec15('0x22')],_0x62d563;if(_0x23b1cf>=_0x2b7316){_0x23b1cf=_0x2b7316;_0x62d563=0xc8;}else{_0x62d563=0xce;}_0x352270[_0xec15('0x1e')](_0x62d563);return _0x352270[_0xec15('0x23')](_0xec15('0x24'),_0x19f643+'-'+_0x23b1cf+'/'+_0x2b7316)[_0xec15('0x20')](_0x285ae5);}return null;};}function patchUpdates(_0xfc9560){return function(_0x149304){try{jsonpatch['apply'](_0x149304,_0xfc9560,!![]);}catch(_0x33e30a){return BPromise[_0xec15('0x25')](_0x33e30a);}return _0x149304[_0xec15('0x26')]();};}function saveUpdates(_0x3d3c1b,_0x424d6f){return function(_0xb39725){if(_0xb39725){return _0xb39725[_0xec15('0x27')](_0x3d3c1b)[_0xec15('0x28')](function(_0x22b576){return _0x22b576;});}return null;};}function removeEntity(_0x28fad5,_0x53df4c){return function(_0x3f9131){if(_0x3f9131){return _0x3f9131['destroy']()[_0xec15('0x28')](function(){var _0x36b955=_0x3f9131[_0xec15('0x29')]({'plain':!![]});var _0xbccde7=_0xec15('0x2a');return db[_0xec15('0x2b')][_0xec15('0x2c')]({'where':{'type':_0xbccde7,'resourceId':_0x36b955['id']}})[_0xec15('0x28')](function(){return _0x3f9131;});})[_0xec15('0x28')](function(){_0x28fad5[_0xec15('0x1e')](0xcc)[_0xec15('0x1f')]();});}};}function handleEntityNotFound(_0xd676e1,_0x39ddcd){return function(_0x3f2e39){if(!_0x3f2e39){_0xd676e1['sendStatus'](0x194);}return _0x3f2e39;};}function handleError(_0x1ea8d7,_0x566293){_0x566293=_0x566293||0x1f4;return function(_0x139c9b){logger[_0xec15('0x2d')](_0x139c9b[_0xec15('0x2e')]);if(_0x139c9b['name']){delete _0x139c9b['name'];}_0x1ea8d7[_0xec15('0x1e')](_0x566293)[_0xec15('0x2f')](_0x139c9b);};}exports['index']=function(_0x5a01d7,_0x76cfce){var _0x475ebb={},_0x10991c={},_0x272abf={'count':0x0,'rows':[]};var _0x18a966=_[_0xec15('0x30')](db[_0xec15('0x31')]['rawAttributes'],function(_0x589c7a){return{'name':_0x589c7a['fieldName'],'type':_0x589c7a[_0xec15('0x32')][_0xec15('0x33')]};});_0x10991c[_0xec15('0x34')]=_['map'](_0x18a966,_0xec15('0x35'));_0x10991c[_0xec15('0x36')]=_['keys'](_0x5a01d7[_0xec15('0x36')]);_0x10991c['filters']=_[_0xec15('0x37')](_0x10991c['model'],_0x10991c[_0xec15('0x36')]);_0x475ebb[_0xec15('0x38')]=_['intersection'](_0x10991c[_0xec15('0x34')],qs['fields'](_0x5a01d7[_0xec15('0x36')]['fields']));_0x475ebb[_0xec15('0x38')]=_0x475ebb[_0xec15('0x38')][_0xec15('0x39')]?_0x475ebb['attributes']:_0x10991c['model'];if(!_0x5a01d7['query'][_0xec15('0x3a')](_0xec15('0x3b'))){_0x475ebb[_0xec15('0x22')]=qs['limit'](_0x5a01d7[_0xec15('0x36')][_0xec15('0x22')]);_0x475ebb[_0xec15('0x21')]=qs[_0xec15('0x21')](_0x5a01d7[_0xec15('0x36')]['offset']);}_0x475ebb['order']=qs[_0xec15('0x3c')](_0x5a01d7[_0xec15('0x36')][_0xec15('0x3c')]);_0x475ebb[_0xec15('0x3d')]=qs['filters'](_[_0xec15('0x3e')](_0x5a01d7[_0xec15('0x36')],_0x10991c[_0xec15('0x3f')]),_0x18a966);if(_0x5a01d7[_0xec15('0x36')][_0xec15('0x40')]){_0x475ebb[_0xec15('0x3d')]=_[_0xec15('0x41')](_0x475ebb[_0xec15('0x3d')],{'$or':_[_0xec15('0x30')](_0x18a966,function(_0x4a4ab3){if(_0x4a4ab3[_0xec15('0x32')]!==_0xec15('0x42')){var _0x13a1e8={};_0x13a1e8[_0x4a4ab3[_0xec15('0x35')]]={'$like':'%'+_0x5a01d7[_0xec15('0x36')][_0xec15('0x40')]+'%'};return _0x13a1e8;}})});}_0x475ebb=_[_0xec15('0x41')]({},_0x475ebb,_0x5a01d7[_0xec15('0x43')]);var _0xccc6c5={'where':_0x475ebb['where']};return db[_0xec15('0x31')][_0xec15('0x44')](_0xccc6c5)[_0xec15('0x28')](function(_0x5a296b){_0x272abf[_0xec15('0x44')]=_0x5a296b;if(_0x5a01d7['query']['includeAll']){_0x475ebb[_0xec15('0x45')]=[{'all':!![]}];}return db['Team'][_0xec15('0x46')](_0x475ebb);})['then'](function(_0x450708){_0x272abf[_0xec15('0x47')]=_0x450708;return _0x272abf;})['then'](respondWithFilteredResult(_0x76cfce,_0x475ebb))['catch'](handleError(_0x76cfce,null));};exports[_0xec15('0x48')]=function(_0x565b4c,_0xe43f99){var _0x18e628={'raw':![],'where':{'id':_0x565b4c['params']['id']}},_0xa88e41={};_0xa88e41[_0xec15('0x34')]=_[_0xec15('0x49')](db[_0xec15('0x31')][_0xec15('0x4a')]);_0xa88e41[_0xec15('0x36')]=_[_0xec15('0x49')](_0x565b4c[_0xec15('0x36')]);_0xa88e41['filters']=_[_0xec15('0x37')](_0xa88e41['model'],_0xa88e41[_0xec15('0x36')]);_0x18e628[_0xec15('0x38')]=_[_0xec15('0x37')](_0xa88e41[_0xec15('0x34')],qs[_0xec15('0x4b')](_0x565b4c['query']['fields']));_0x18e628['attributes']=_0x18e628[_0xec15('0x38')][_0xec15('0x39')]?_0x18e628['attributes']:_0xa88e41[_0xec15('0x34')];if(_0x565b4c[_0xec15('0x36')][_0xec15('0x4c')]){_0x18e628[_0xec15('0x45')]=[{'all':!![]}];}_0x18e628=_[_0xec15('0x41')]({},_0x18e628,_0x565b4c['options']);return db[_0xec15('0x31')][_0xec15('0x4d')](_0x18e628)[_0xec15('0x28')](handleEntityNotFound(_0xe43f99,null))['then'](respondWithResult(_0xe43f99,null))[_0xec15('0x4e')](handleError(_0xe43f99,null));};exports['create']=function(_0x4079e1,_0x21ffda){return db[_0xec15('0x31')]['create'](_0x4079e1[_0xec15('0x4f')],{})[_0xec15('0x28')](function(_0x3aa126){var _0x1f8d89=_0x4079e1[_0xec15('0x50')][_0xec15('0x29')]({'plain':!![]});if(!_0x1f8d89)throw new Error(_0xec15('0x51'));if(_0x1f8d89['role']===_0xec15('0x50')){var _0x4aa0c8=_0x3aa126[_0xec15('0x29')]({'plain':!![]});var _0x35fa37='Teams';return db['UserProfileSection'][_0xec15('0x4d')]({'where':{'name':_0x35fa37,'userProfileId':_0x1f8d89['userProfileId']},'raw':!![]})['then'](function(_0x17b2ea){if(_0x17b2ea&&_0x17b2ea['autoAssociation']===0x0){return db['UserProfileResource'][_0xec15('0x52')]({'name':_0x4aa0c8[_0xec15('0x35')],'resourceId':_0x4aa0c8['id'],'type':_0x17b2ea[_0xec15('0x35')],'sectionId':_0x17b2ea['id']},{})['then'](function(){return _0x3aa126;});}else{return _0x3aa126;}})['catch'](function(_0x1f0303){logger['error'](_0xec15('0x53'),_0x1f0303);throw _0x1f0303;});}return _0x3aa126;})[_0xec15('0x28')](respondWithResult(_0x21ffda,0xc9))[_0xec15('0x4e')](handleError(_0x21ffda,null));};exports['update']=function(_0x1b27af,_0x4abb6e){if(_0x1b27af['body']['id']){delete _0x1b27af[_0xec15('0x4f')]['id'];}return db[_0xec15('0x31')][_0xec15('0x4d')]({'where':{'id':_0x1b27af[_0xec15('0x54')]['id']}})[_0xec15('0x28')](handleEntityNotFound(_0x4abb6e,null))['then'](saveUpdates(_0x1b27af[_0xec15('0x4f')],null))[_0xec15('0x28')](respondWithResult(_0x4abb6e,null))[_0xec15('0x4e')](handleError(_0x4abb6e,null));};exports[_0xec15('0x2c')]=function(_0x9469a4,_0x1652f2){return db[_0xec15('0x31')][_0xec15('0x4d')]({'where':{'id':_0x9469a4['params']['id']}})[_0xec15('0x28')](handleEntityNotFound(_0x1652f2,null))[_0xec15('0x28')](removeEntity(_0x1652f2,null))[_0xec15('0x4e')](handleError(_0x1652f2,null));};exports[_0xec15('0x55')]=function(_0x4f1db4,_0x2a772f,_0x51c6bf){return db[_0xec15('0x31')][_0xec15('0x56')]({'where':{'id':_0x4f1db4[_0xec15('0x54')]['id']}})[_0xec15('0x28')](handleEntityNotFound(_0x2a772f,null))[_0xec15('0x28')](function(_0x2ddb4c){if(!_0x4f1db4[_0xec15('0x36')][_0xec15('0x57')]||!utils['isValidChannel'](_0x4f1db4['query']['channel'])){throw new db['Sequelize'][(_0xec15('0x58'))](_0xec15('0x59'));}var _0x498a31={};var _0x4332d6={};_0x4332d6[_0xec15('0x34')]=_[_0xec15('0x49')](db[_[_0xec15('0x5a')](_0x4f1db4[_0xec15('0x36')]['channel'][_0xec15('0x5b')]())+_0xec15('0x5c')]['rawAttributes']);_0x4332d6[_0xec15('0x36')]=_[_0xec15('0x49')](_0x4f1db4[_0xec15('0x36')]);_0x4332d6[_0xec15('0x3f')]=_[_0xec15('0x37')](_0x4332d6[_0xec15('0x34')],_0x4332d6['query']);_0x498a31[_0xec15('0x38')]=_[_0xec15('0x37')](_0x4332d6[_0xec15('0x34')],qs[_0xec15('0x4b')](_0x4f1db4[_0xec15('0x36')]['fields']));_0x498a31[_0xec15('0x38')]=_0x498a31[_0xec15('0x38')]['length']?_0x498a31[_0xec15('0x38')]:_0x4332d6[_0xec15('0x34')];_0x498a31[_0xec15('0x22')]=qs[_0xec15('0x22')](_0x4f1db4[_0xec15('0x36')]['limit']);_0x498a31[_0xec15('0x21')]=qs[_0xec15('0x21')](_0x4f1db4[_0xec15('0x36')]['offset']);_0x498a31[_0xec15('0x5d')]=qs[_0xec15('0x3c')](_0x4f1db4[_0xec15('0x36')][_0xec15('0x3c')]);_0x498a31[_0xec15('0x3d')]=qs[_0xec15('0x3f')](_[_0xec15('0x3e')](_0x4f1db4[_0xec15('0x36')],_0x4332d6['filters']));_0x498a31=_[_0xec15('0x41')]({},_0x498a31,_0x4f1db4[_0xec15('0x43')]);return _0x2ddb4c[_0xec15('0x29')+_[_0xec15('0x5a')](_0x4f1db4[_0xec15('0x36')]['channel'][_0xec15('0x5b')]())+_0xec15('0x5e')](_0x498a31);})[_0xec15('0x28')](respondWithResult(_0x2a772f,null))['catch'](handleError(_0x2a772f,null));};exports['addQueues']=function(_0x50fe9a,_0x8cdbdd,_0x5b62a9){return db[_0xec15('0x31')]['findOne']({'where':{'id':_0x50fe9a[_0xec15('0x54')]['id']}})[_0xec15('0x28')](function(_0x3bcabb){if(_0x3bcabb){if(!_0x50fe9a['body'][_0xec15('0x57')]||!utils['isValidChannel'](_0x50fe9a['body'][_0xec15('0x57')])){throw new db['Sequelize'][(_0xec15('0x58'))](_0xec15('0x59'));}return _0x3bcabb[_0xec15('0x5f')+_[_0xec15('0x5a')](_0x50fe9a[_0xec15('0x4f')][_0xec15('0x57')]['toLowerCase']())+_0xec15('0x5e')](_0x50fe9a[_0xec15('0x4f')][_0xec15('0x60')]);}return null;})[_0xec15('0x28')](handleEntityNotFound(_0x8cdbdd,null))[_0xec15('0x28')](respondWithStatusCode(_0x8cdbdd,null))[_0xec15('0x4e')](handleError(_0x8cdbdd,null));};exports[_0xec15('0x61')]=function(_0x5f586d,_0x4e730a,_0x42433e){return db['Team'][_0xec15('0x56')]({'where':{'id':_0x5f586d[_0xec15('0x54')]['id']}})[_0xec15('0x28')](function(_0x4de6da){if(_0x4de6da){if(!_0x5f586d[_0xec15('0x36')][_0xec15('0x57')]||!utils[_0xec15('0x62')](_0x5f586d['query'][_0xec15('0x57')])){throw new db['Sequelize']['ValidationError'](_0xec15('0x59'));}return _0x4de6da[_0xec15('0x63')+_[_0xec15('0x5a')](_0x5f586d['query'][_0xec15('0x57')][_0xec15('0x5b')]())+_0xec15('0x5e')](_0x5f586d[_0xec15('0x36')][_0xec15('0x60')]);}return null;})[_0xec15('0x28')](handleEntityNotFound(_0x4e730a,null))[_0xec15('0x28')](respondWithStatusCode(_0x4e730a,null))[_0xec15('0x4e')](handleError(_0x4e730a,null));};exports[_0xec15('0x64')]=function(_0xf5f89a,_0x33654e,_0x4089a5){return db[_0xec15('0x31')][_0xec15('0x4d')]({'where':{'id':_0xf5f89a[_0xec15('0x54')]['id']}})[_0xec15('0x28')](handleEntityNotFound(_0x33654e,null))[_0xec15('0x28')](function(_0x928acd){if(_0x928acd){var _0x589925=[_0xec15('0x65'),_0xec15('0x66'),'Mail',_0xec15('0x67'),_0xec15('0x68'),_0xec15('0x69'),_0xec15('0x6a')];return BPromise[_0xec15('0x6b')](_0x589925,function(_0x2be0ea){return _0x928acd[_0xec15('0x29')+_0x2be0ea+_0xec15('0x5e')]({'attributes':['id',_0xec15('0x35')]})[_0xec15('0x28')](function(_0x50cc27){return BPromise[_0xec15('0x6b')](_0x50cc27,function(_0x540e83){return _0x540e83['addAgents'](_0xf5f89a['body'][_0xec15('0x60')])['then'](function(){if(_0x2be0ea==='Voice'){return db[_0xec15('0x6c')][_0xec15('0x46')]({'where':{'id':_0xf5f89a[_0xec15('0x4f')][_0xec15('0x60')]},'attributes':['id',_0xec15('0x35'),_0xec15('0x6d'),_0xec15('0x6e'),_0xec15('0x6f')],'raw':!![]})[_0xec15('0x28')](function(_0x360de4){return BPromise[_0xec15('0x6b')](_[_0xec15('0x40')](_0x360de4,{'online':0x1}),function(_0xa1aff4){return db[_0xec15('0x70')][_0xec15('0x71')]({'membername':_0xa1aff4[_0xec15('0x35')],'UserId':_0xa1aff4['id'],'queue_name':_0x540e83[_0xec15('0x35')],'VoiceQueueId':_0x540e83['id'],'interface':_['isNil'](_0xa1aff4[_0xec15('0x6f')])?util['format'](_0xec15('0x72'),_0xa1aff4['name']):_0xa1aff4[_0xec15('0x6f')],'paused':_0xa1aff4[_0xec15('0x6e')]||![],'penalty':0x0});});});}});});})[_0xec15('0x28')](function(){return _0x928acd;});})['then'](function(){return _0x928acd;});}})['then'](function(_0x1c59d2){if(_0x1c59d2){return _0x1c59d2[_0xec15('0x64')](_0xf5f89a['body'][_0xec15('0x60')],_[_0xec15('0x73')](_0xf5f89a[_0xec15('0x4f')],[_0xec15('0x60'),'id'])||{})[_0xec15('0x74')](function(_0x3ab2a0){for(var _0x16ab91=0x0;_0x16ab91<_0xf5f89a['body']['ids'][_0xec15('0x39')];_0x16ab91+=0x1){socket[_0xec15('0x75')]('userTeam:save',{'UserId':_0xf5f89a[_0xec15('0x4f')]['ids'][_0x16ab91],'TeamId':_0xf5f89a[_0xec15('0x54')]['id']});}return _0x3ab2a0;});}})['then'](respondWithResult(_0x33654e,null))[_0xec15('0x4e')](handleError(_0x33654e,null));};exports[_0xec15('0x76')]=function(_0x193fa9,_0x5e8989,_0x23f4d2){return db['Team'][_0xec15('0x4d')]({'where':{'id':_0x193fa9[_0xec15('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e8989,null))[_0xec15('0x28')](function(_0x583cc7){if(_0x583cc7){return BPromise[_0xec15('0x6b')]([_0xec15('0x77'),_0xec15('0x78'),_0xec15('0x79'),_0xec15('0x7a'),_0xec15('0x7b'),_0xec15('0x7c'),_0xec15('0x7d')],function(_0x5c051b){return _0x583cc7[_0xec15('0x29')+_[_0xec15('0x5a')](_0x5c051b)+_0xec15('0x5e')]({'attributes':['id',_0xec15('0x35')]})['then'](function(_0x51e104){return BPromise[_0xec15('0x6b')](_0x51e104,function(_0x57bb13){return _0x57bb13[_0xec15('0x76')](_0x193fa9[_0xec15('0x36')][_0xec15('0x60')])['then'](function(){if(_0x5c051b==='voice'){return db[_0xec15('0x70')]['destroy']({'where':{'VoiceQueueId':_0x57bb13['id'],'UserId':_0x193fa9[_0xec15('0x36')][_0xec15('0x60')]}});}});});})['then'](function(){return _0x583cc7;});})[_0xec15('0x28')](function(){return _0x583cc7;});}})['then'](function(_0x3cb977){if(_0x3cb977){return _0x3cb977['removeAgents'](_0x193fa9['query'][_0xec15('0x60')])[_0xec15('0x28')](function(){if(_[_0xec15('0x7e')](_0x193fa9[_0xec15('0x36')][_0xec15('0x60')])){for(var _0x3ec268=0x0;_0x3ec268<_0x193fa9[_0xec15('0x36')][_0xec15('0x60')]['length'];_0x3ec268+=0x1){socket[_0xec15('0x75')](_0xec15('0x7f'),{'UserId':Number(_0x193fa9[_0xec15('0x36')][_0xec15('0x60')][_0x3ec268]),'TeamId':Number(_0x193fa9[_0xec15('0x54')]['id'])});}}else{socket[_0xec15('0x75')](_0xec15('0x7f'),{'UserId':Number(_0x193fa9[_0xec15('0x36')][_0xec15('0x60')]),'TeamId':Number(_0x193fa9[_0xec15('0x54')]['id'])});}});}})[_0xec15('0x28')](respondWithStatusCode(_0x5e8989,null))['catch'](handleError(_0x5e8989,null));};exports[_0xec15('0x80')]=function(_0x3e5f56,_0xd85373,_0x35dab0){var _0x229fca={};var _0x3a351a={};var _0x29d76b;var _0x1120f6;return db[_0xec15('0x31')]['findOne']({'where':{'id':_0x3e5f56['params']['id']}})[_0xec15('0x28')](handleEntityNotFound(_0xd85373,null))[_0xec15('0x28')](function(_0x45388d){if(_0x45388d){_0x29d76b=_0x45388d;_0x3a351a[_0xec15('0x34')]=_[_0xec15('0x49')](db['User'][_0xec15('0x4a')]);_0x3a351a['query']=_[_0xec15('0x49')](_0x3e5f56[_0xec15('0x36')]);_0x3a351a[_0xec15('0x3f')]=_[_0xec15('0x37')](_0x3a351a[_0xec15('0x34')],_0x3a351a[_0xec15('0x36')]);_0x229fca[_0xec15('0x38')]=_[_0xec15('0x37')](_0x3a351a[_0xec15('0x34')],qs['fields'](_0x3e5f56[_0xec15('0x36')]['fields']));_0x229fca[_0xec15('0x38')]=_0x229fca[_0xec15('0x38')][_0xec15('0x39')]?_0x229fca[_0xec15('0x38')]:_0x3a351a[_0xec15('0x34')];_0x229fca[_0xec15('0x5d')]=qs['sort'](_0x3e5f56[_0xec15('0x36')][_0xec15('0x3c')]);_0x229fca['where']=qs[_0xec15('0x3f')](_['pick'](_0x3e5f56[_0xec15('0x36')],_0x3a351a[_0xec15('0x3f')]));if(_0x3e5f56[_0xec15('0x36')][_0xec15('0x40')]){_0x229fca[_0xec15('0x3d')]=_['merge'](_0x229fca[_0xec15('0x3d')],{'$or':_[_0xec15('0x30')](_0x229fca[_0xec15('0x38')],function(_0x4c28c8){var _0x40e66b={};_0x40e66b[_0x4c28c8]={'$like':'%'+_0x3e5f56['query'][_0xec15('0x40')]+'%'};return _0x40e66b;})});}_0x229fca=_['merge']({},_0x229fca,_0x3e5f56[_0xec15('0x43')]);return _0x29d76b[_0xec15('0x80')](_0x229fca);}})['then'](function(_0x437150){if(_0x437150){_0x1120f6=_0x437150[_0xec15('0x39')];if(!_0x3e5f56[_0xec15('0x36')]['hasOwnProperty'](_0xec15('0x3b'))){_0x229fca[_0xec15('0x22')]=qs[_0xec15('0x22')](_0x3e5f56[_0xec15('0x36')][_0xec15('0x22')]);_0x229fca['offset']=qs[_0xec15('0x21')](_0x3e5f56[_0xec15('0x36')][_0xec15('0x21')]);}return _0x29d76b[_0xec15('0x80')](_0x229fca);}})['then'](function(_0xd448bf){if(_0xd448bf){return _0xd448bf?{'count':_0x1120f6,'rows':_0xd448bf}:null;}})[_0xec15('0x28')](respondWithResult(_0xd85373,null))[_0xec15('0x4e')](handleError(_0xd85373,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 4d90826..a0d3d81 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 _0x5233=['hook','exports','events','Team','setMaxListeners','save','remove'];(function(_0x28fc08,_0x18b054){var _0xa6a26b=function(_0x3933b2){while(--_0x3933b2){_0x28fc08['push'](_0x28fc08['shift']());}};_0xa6a26b(++_0x18b054);}(_0x5233,0x183));var _0x3523=function(_0x4a1afc,_0x333574){_0x4a1afc=_0x4a1afc-0x0;var _0x4bafdc=_0x5233[_0x4a1afc];return _0x4bafdc;};'use strict';var EventEmitter=require(_0x3523('0x0'));var Team=require('../../mysqldb')['db'][_0x3523('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x3523('0x2')](0x0);var events={'afterCreate':_0x3523('0x3'),'afterUpdate':'update','afterDestroy':_0x3523('0x4')};function emitEvent(_0x425d6c){return function(_0x45bbb2,_0x1bee45,_0x1ec3d9){TeamEvents['emit'](_0x425d6c+':'+_0x45bbb2['id'],_0x45bbb2);TeamEvents['emit'](_0x425d6c,_0x45bbb2);_0x1ec3d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3523('0x5')](e,emitEvent(event));}}module[_0x3523('0x6')]=TeamEvents; \ No newline at end of file +var _0xb2d9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb2d9,0xd5));var _0x9b2d=function(_0xc7e4a8,_0x500400){_0xc7e4a8=_0xc7e4a8-0x0;var _0x4ed9f1=_0xb2d9[_0xc7e4a8];return _0x4ed9f1;};'use strict';var EventEmitter=require(_0x9b2d('0x0'));var Team=require(_0x9b2d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9b2d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9b2d('0x3')};function emitEvent(_0x1b416d){return function(_0x52c070,_0x3cfdf0,_0x2c4db5){TeamEvents[_0x9b2d('0x4')](_0x1b416d+':'+_0x52c070['id'],_0x52c070);TeamEvents['emit'](_0x1b416d,_0x52c070);_0x2c4db5(null);};}for(var e in events){if(events[_0x9b2d('0x5')](e)){var event=events[e];Team[_0x9b2d('0x6')](e,emitEvent(event));}}module[_0x9b2d('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 b3a649d..b288b8f 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 _0x325a=['api','moment','request-promise','path','rimraf','./team.attributes','exports','define','teams','lodash','util','../../config/logger'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x325a,0xa5));var _0xa325=function(_0x14376f,_0x5e9d48){_0x14376f=_0x14376f-0x0;var _0x118c3e=_0x325a[_0x14376f];return _0x118c3e;};'use strict';var _=require(_0xa325('0x0'));var util=require(_0xa325('0x1'));var logger=require(_0xa325('0x2'))(_0xa325('0x3'));var moment=require(_0xa325('0x4'));var BPromise=require('bluebird');var rp=require(_0xa325('0x5'));var fs=require('fs');var path=require(_0xa325('0x6'));var rimraf=require(_0xa325('0x7'));var config=require('../../config/environment');var attributes=require(_0xa325('0x8'));module[_0xa325('0x9')]=function(_0x202e96,_0x146cdf){return _0x202e96[_0xa325('0xa')]('Team',attributes,{'tableName':_0xa325('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1a0=['Team','teams','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes'];(function(_0x308d9b,_0x5f3094){var _0x3585a7=function(_0x476332){while(--_0x476332){_0x308d9b['push'](_0x308d9b['shift']());}};_0x3585a7(++_0x5f3094);}(_0xb1a0,0x10a));var _0x0b1a=function(_0x13601,_0x2f1b4c){_0x13601=_0x13601-0x0;var _0x38563c=_0xb1a0[_0x13601];return _0x38563c;};'use strict';var _=require(_0x0b1a('0x0'));var util=require(_0x0b1a('0x1'));var logger=require(_0x0b1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0b1a('0x3'));var rp=require(_0x0b1a('0x4'));var fs=require('fs');var path=require(_0x0b1a('0x5'));var rimraf=require(_0x0b1a('0x6'));var config=require(_0x0b1a('0x7'));var attributes=require(_0x0b1a('0x8'));module['exports']=function(_0x59f809,_0x51003f){return _0x59f809['define'](_0x0b1a('0x9'),attributes,{'tableName':_0x0b1a('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 15dfd43..3fa0528 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 _0xe465=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird'];(function(_0x1063f0,_0x53980d){var _0x4698ce=function(_0x21d966){while(--_0x21d966){_0x1063f0['push'](_0x1063f0['shift']());}};_0x4698ce(++_0x53980d);}(_0xe465,0x1d9));var _0x5e46=function(_0xbbe857,_0x516e34){_0xbbe857=_0xbbe857-0x0;var _0x1b5dc1=_0xe465[_0xbbe857];return _0x1b5dc1;};'use strict';var _=require(_0x5e46('0x0'));var util=require(_0x5e46('0x1'));var moment=require('moment');var BPromise=require(_0x5e46('0x2'));var rs=require(_0x5e46('0x3'));var fs=require('fs');var Redis=require(_0x5e46('0x4'));var db=require(_0x5e46('0x5'))['db'];var utils=require(_0x5e46('0x6'));var logger=require(_0x5e46('0x7'))(_0x5e46('0x8'));var config=require(_0x5e46('0x9'));var jayson=require(_0x5e46('0xa'));var client=jayson[_0x5e46('0xb')][_0x5e46('0xc')]({'port':0x232a});config[_0x5e46('0xd')]=_[_0x5e46('0xe')](config[_0x5e46('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e46('0xf'))(new Redis(config['redis']));require(_0x5e46('0x10'))[_0x5e46('0x11')](socket);function respondWithRpcPromise(_0x1e8356,_0x168d7c,_0x87f900){return new BPromise(function(_0x1acfd3,_0x5c2508){return client[_0x5e46('0x12')](_0x1e8356,_0x87f900)[_0x5e46('0x13')](function(_0x6158bb){logger[_0x5e46('0x14')](_0x5e46('0x15'),_0x168d7c,'request\x20sent');logger[_0x5e46('0x16')](_0x5e46('0x17'),_0x168d7c,'request\x20sent',JSON[_0x5e46('0x18')](_0x6158bb));if(_0x6158bb[_0x5e46('0x19')]){if(_0x6158bb[_0x5e46('0x19')][_0x5e46('0x1a')]===0x1f4){logger['error'](_0x5e46('0x15'),_0x168d7c,_0x6158bb[_0x5e46('0x19')][_0x5e46('0x1b')]);return _0x5c2508(_0x6158bb[_0x5e46('0x19')][_0x5e46('0x1b')]);}logger[_0x5e46('0x19')](_0x5e46('0x15'),_0x168d7c,_0x6158bb[_0x5e46('0x19')][_0x5e46('0x1b')]);return _0x1acfd3(_0x6158bb['error'][_0x5e46('0x1b')]);}else{logger[_0x5e46('0x14')](_0x5e46('0x15'),_0x168d7c,'request\x20sent');_0x1acfd3(_0x6158bb['result'][_0x5e46('0x1b')]);}})['catch'](function(_0x1ef772){logger[_0x5e46('0x19')](_0x5e46('0x15'),_0x168d7c,_0x1ef772);_0x5c2508(_0x1ef772);});});} \ No newline at end of file +var _0xeb3e=['http','redis','defaults','socket.io-emitter','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cc4da,_0x201bd5){var _0x2144f4=function(_0x59d734){while(--_0x59d734){_0x1cc4da['push'](_0x1cc4da['shift']());}};_0x2144f4(++_0x201bd5);}(_0xeb3e,0xe6));var _0xeeb3=function(_0x45fa82,_0x1b44fa){_0x45fa82=_0x45fa82-0x0;var _0x21384b=_0xeb3e[_0x45fa82];return _0x21384b;};'use strict';var _=require(_0xeeb3('0x0'));var util=require(_0xeeb3('0x1'));var moment=require(_0xeeb3('0x2'));var BPromise=require(_0xeeb3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeb3('0x4'));var db=require(_0xeeb3('0x5'))['db'];var utils=require(_0xeeb3('0x6'));var logger=require(_0xeeb3('0x7'))(_0xeeb3('0x8'));var config=require(_0xeeb3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeeb3('0xa')]({'port':0x232a});config[_0xeeb3('0xb')]=_[_0xeeb3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeeb3('0xd'))(new Redis(config[_0xeeb3('0xb')]));require('./team.socket')[_0xeeb3('0xe')](socket);function respondWithRpcPromise(_0x220124,_0x253d52,_0xf21333){return new BPromise(function(_0x20b64f,_0x25cd19){return client['request'](_0x220124,_0xf21333)[_0xeeb3('0xf')](function(_0x20e7ca){logger[_0xeeb3('0x10')](_0xeeb3('0x11'),_0x253d52,_0xeeb3('0x12'));logger[_0xeeb3('0x13')](_0xeeb3('0x14'),_0x253d52,_0xeeb3('0x12'),JSON[_0xeeb3('0x15')](_0x20e7ca));if(_0x20e7ca[_0xeeb3('0x16')]){if(_0x20e7ca['error']['code']===0x1f4){logger[_0xeeb3('0x16')](_0xeeb3('0x11'),_0x253d52,_0x20e7ca['error'][_0xeeb3('0x17')]);return _0x25cd19(_0x20e7ca['error']['message']);}logger[_0xeeb3('0x16')](_0xeeb3('0x11'),_0x253d52,_0x20e7ca['error'][_0xeeb3('0x17')]);return _0x20b64f(_0x20e7ca['error'][_0xeeb3('0x17')]);}else{logger[_0xeeb3('0x10')](_0xeeb3('0x11'),_0x253d52,'request\x20sent');_0x20b64f(_0x20e7ca['result'][_0xeeb3('0x17')]);}})['catch'](function(_0x2636d7){logger[_0xeeb3('0x16')](_0xeeb3('0x11'),_0x253d52,_0x2636d7);_0x25cd19(_0x2636d7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 44654a7..30040b9 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 _0xad68=['removeListener','register','length','team:','remove','update','emit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xad68,0x100));var _0x8ad6=function(_0x299d43,_0x4ebe75){_0x299d43=_0x299d43-0x0;var _0x2173b6=_0xad68[_0x299d43];return _0x2173b6;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x8ad6('0x0'),_0x8ad6('0x1')];function createListener(_0x55f6b6,_0x4d2376){return function(_0x2df527){_0x4d2376[_0x8ad6('0x2')](_0x55f6b6,_0x2df527);};}function removeListener(_0x186cec,_0x1aec69){return function(){TeamEvents[_0x8ad6('0x3')](_0x186cec,_0x1aec69);};}exports[_0x8ad6('0x4')]=function(_0x3efdb7){for(var _0x5273c2=0x0,_0x144a85=events[_0x8ad6('0x5')];_0x5273c2<_0x144a85;_0x5273c2++){var _0x3e009f=events[_0x5273c2];var _0x46ba71=createListener(_0x8ad6('0x6')+_0x3e009f,_0x3efdb7);TeamEvents['on'](_0x3e009f,_0x46ba71);}}; \ No newline at end of file +var _0x8411=['emit','removeListener','length','team:','remove','update'];(function(_0x15f80e,_0x28a721){var _0x4c8a21=function(_0x41a484){while(--_0x41a484){_0x15f80e['push'](_0x15f80e['shift']());}};_0x4c8a21(++_0x28a721);}(_0x8411,0x118));var _0x1841=function(_0x59b251,_0x5182f1){_0x59b251=_0x59b251-0x0;var _0x431354=_0x8411[_0x59b251];return _0x431354;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x1841('0x0'),_0x1841('0x1')];function createListener(_0x4e0ff9,_0x596436){return function(_0x112b9a){_0x596436[_0x1841('0x2')](_0x4e0ff9,_0x112b9a);};}function removeListener(_0x2e07e5,_0x29c8aa){return function(){TeamEvents[_0x1841('0x3')](_0x2e07e5,_0x29c8aa);};}exports['register']=function(_0x3432f2){for(var _0x54a581=0x0,_0x4224eb=events[_0x1841('0x4')];_0x54a581<_0x4224eb;_0x54a581++){var _0x2c77df=events[_0x54a581];var _0xa774c1=createListener(_0x1841('0x5')+_0x2c77df,_0x3432f2);TeamEvents['on'](_0x2c77df,_0xa774c1);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fe78207..4470f24 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 _0x93c5=['put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','post','create'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x93c5,0x8a));var _0x593c=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x93c5[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x593c('0x0'));var util=require('util');var path=require(_0x593c('0x1'));var timeout=require(_0x593c('0x2'));var express=require(_0x593c('0x3'));var router=express[_0x593c('0x4')]();var auth=require(_0x593c('0x5'));var interaction=require(_0x593c('0x6'));var config=require(_0x593c('0x7'));var controller=require(_0x593c('0x8'));router[_0x593c('0x9')]('/',auth[_0x593c('0xa')](),controller[_0x593c('0xb')]);router[_0x593c('0x9')]('/:id',auth[_0x593c('0xa')](),controller['show']);router[_0x593c('0xc')]('/',auth['isAuthenticated'](),controller[_0x593c('0xd')]);router[_0x593c('0xe')](_0x593c('0xf'),auth[_0x593c('0xa')](),controller['update']);router[_0x593c('0x10')](_0x593c('0xf'),auth[_0x593c('0xa')](),controller[_0x593c('0x11')]);module[_0x593c('0x12')]=router; \ No newline at end of file +var _0x7f89=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x7f89,0x19d));var _0x97f8=function(_0x437e08,_0x1cab6c){_0x437e08=_0x437e08-0x0;var _0xcf57f2=_0x7f89[_0x437e08];return _0xcf57f2;};'use strict';var multer=require(_0x97f8('0x0'));var util=require('util');var path=require(_0x97f8('0x1'));var timeout=require(_0x97f8('0x2'));var express=require(_0x97f8('0x3'));var router=express[_0x97f8('0x4')]();var auth=require(_0x97f8('0x5'));var interaction=require(_0x97f8('0x6'));var config=require(_0x97f8('0x7'));var controller=require('./template.controller');router[_0x97f8('0x8')]('/',auth[_0x97f8('0x9')](),controller[_0x97f8('0xa')]);router['get'](_0x97f8('0xb'),auth[_0x97f8('0x9')](),controller[_0x97f8('0xc')]);router['post']('/',auth[_0x97f8('0x9')](),controller[_0x97f8('0xd')]);router['put'](_0x97f8('0xb'),auth[_0x97f8('0x9')](),controller[_0x97f8('0xe')]);router[_0x97f8('0xf')](_0x97f8('0xb'),auth[_0x97f8('0x9')](),controller[_0x97f8('0x10')]);module[_0x97f8('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9dffa46..095e91e 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 _0xc52b=['sequelize','exports','STRING'];(function(_0x50b15b,_0x71ac13){var _0x1334e2=function(_0x1bf4fa){while(--_0x1bf4fa){_0x50b15b['push'](_0x50b15b['shift']());}};_0x1334e2(++_0x71ac13);}(_0xc52b,0xae));var _0xbc52=function(_0x1bec98,_0x579a1a){_0x1bec98=_0x1bec98-0x0;var _0x48af29=_0xc52b[_0x1bec98];return _0x48af29;};'use strict';var Sequelize=require(_0xbc52('0x0'));module[_0xbc52('0x1')]={'name':{'type':Sequelize[_0xbc52('0x2')]},'description':{'type':Sequelize[_0xbc52('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0ade=['sequelize','STRING'];(function(_0x518afa,_0x3970f3){var _0x4eafbb=function(_0x2225bd){while(--_0x2225bd){_0x518afa['push'](_0x518afa['shift']());}};_0x4eafbb(++_0x3970f3);}(_0x0ade,0x1dc));var _0xe0ad=function(_0x4479d1,_0x3e4613){_0x4479d1=_0x4479d1-0x0;var _0x11ebf3=_0x0ade[_0x4479d1];return _0x11ebf3;};'use strict';var Sequelize=require(_0xe0ad('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0ad('0x1')]},'description':{'type':Sequelize[_0xe0ad('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 4b3d879..dcc031e 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 _0xa491=['Template','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','Templates','UserProfileResource','error','name','send','index','map'];(function(_0xb7e1b0,_0x161a6f){var _0xaa6764=function(_0x8ec85b){while(--_0x8ec85b){_0xb7e1b0['push'](_0xb7e1b0['shift']());}};_0xaa6764(++_0x161a6f);}(_0xa491,0xd0));var _0x1a49=function(_0x2f3336,_0x4ae7dc){_0x2f3336=_0x2f3336-0x0;var _0xb0684d=_0xa491[_0x2f3336];return _0xb0684d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a49('0x0'));var rimraf=require(_0x1a49('0x1'));var zipdir=require(_0x1a49('0x2'));var jsonpatch=require(_0x1a49('0x3'));var rp=require('request-promise');var moment=require(_0x1a49('0x4'));var BPromise=require(_0x1a49('0x5'));var Mustache=require('mustache');var util=require(_0x1a49('0x6'));var path=require(_0x1a49('0x7'));var sox=require(_0x1a49('0x8'));var csv=require(_0x1a49('0x9'));var ejs=require(_0x1a49('0xa'));var fs=require('fs');var _=require(_0x1a49('0xb'));var squel=require(_0x1a49('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a49('0xd'));var deskjs=require(_0x1a49('0xe'));var toCsv=require(_0x1a49('0x9'));var querystring=require('querystring');var Papa=require(_0x1a49('0xf'));var Redis=require('ioredis');var authService=require(_0x1a49('0x10'));var qs=require(_0x1a49('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a49('0x12'));var logger=require(_0x1a49('0x13'))(_0x1a49('0x14'));var utils=require(_0x1a49('0x15'));var config=require(_0x1a49('0x16'));var db=require(_0x1a49('0x17'))['db'];function respondWithStatusCode(_0x5c6b64,_0x4752fd){_0x4752fd=_0x4752fd||0xcc;return function(_0x3ad510){if(_0x3ad510){return _0x5c6b64[_0x1a49('0x18')](_0x4752fd);}return _0x5c6b64[_0x1a49('0x19')](_0x4752fd)[_0x1a49('0x1a')]();};}function respondWithResult(_0x26a2cc,_0x4e5121){_0x4e5121=_0x4e5121||0xc8;return function(_0x47dbca){if(_0x47dbca){return _0x26a2cc[_0x1a49('0x19')](_0x4e5121)[_0x1a49('0x1b')](_0x47dbca);}};}function respondWithFilteredResult(_0x113d6e,_0x8f507f){return function(_0x34fb46){if(_0x34fb46){var _0x23670b=_0x34fb46[_0x1a49('0x1c')],_0x5411ba=_0x8f507f[_0x1a49('0x1d')],_0x286413=_0x8f507f['offset']+_0x8f507f[_0x1a49('0x1e')],_0x2cdcba;if(_0x286413>=_0x23670b){_0x286413=_0x23670b;_0x2cdcba=0xc8;}else{_0x2cdcba=0xce;}_0x113d6e['status'](_0x2cdcba);return _0x113d6e['set'](_0x1a49('0x1f'),_0x5411ba+'-'+_0x286413+'/'+_0x23670b)[_0x1a49('0x1b')](_0x34fb46);}return null;};}function patchUpdates(_0x79b914){return function(_0x51823f){try{jsonpatch['apply'](_0x51823f,_0x79b914,!![]);}catch(_0x4683a6){return BPromise[_0x1a49('0x20')](_0x4683a6);}return _0x51823f[_0x1a49('0x21')]();};}function saveUpdates(_0x1da58c,_0x42ab01){return function(_0x140593){if(_0x140593){return _0x140593[_0x1a49('0x22')](_0x1da58c)['then'](function(_0x3f9fb8){return _0x3f9fb8;});}return null;};}function removeEntity(_0x6178a3,_0x1e5e0d){return function(_0xc950e0){if(_0xc950e0){return _0xc950e0[_0x1a49('0x23')]()[_0x1a49('0x24')](function(){var _0xd6f8b0=_0xc950e0['get']({'plain':!![]});var _0x4f8113=_0x1a49('0x25');return db[_0x1a49('0x26')]['destroy']({'where':{'type':_0x4f8113,'resourceId':_0xd6f8b0['id']}})[_0x1a49('0x24')](function(){return _0xc950e0;});})[_0x1a49('0x24')](function(){_0x6178a3[_0x1a49('0x19')](0xcc)[_0x1a49('0x1a')]();});}};}function handleEntityNotFound(_0x339c44,_0x50ec89){return function(_0x6c44cf){if(!_0x6c44cf){_0x339c44[_0x1a49('0x18')](0x194);}return _0x6c44cf;};}function handleError(_0x475940,_0x349ce4){_0x349ce4=_0x349ce4||0x1f4;return function(_0x4ec0dc){logger[_0x1a49('0x27')](_0x4ec0dc['stack']);if(_0x4ec0dc['name']){delete _0x4ec0dc[_0x1a49('0x28')];}_0x475940[_0x1a49('0x19')](_0x349ce4)[_0x1a49('0x29')](_0x4ec0dc);};}exports[_0x1a49('0x2a')]=function(_0x3e8940,_0x3852fd){var _0x589a8f={},_0x4c5b16={},_0x465488={'count':0x0,'rows':[]};var _0x2193c9=_[_0x1a49('0x2b')](db[_0x1a49('0x2c')][_0x1a49('0x2d')],function(_0x3f4f5f){return{'name':_0x3f4f5f[_0x1a49('0x2e')],'type':_0x3f4f5f[_0x1a49('0x2f')][_0x1a49('0x30')]};});_0x4c5b16[_0x1a49('0x31')]=_[_0x1a49('0x2b')](_0x2193c9,'name');_0x4c5b16[_0x1a49('0x32')]=_[_0x1a49('0x33')](_0x3e8940['query']);_0x4c5b16['filters']=_['intersection'](_0x4c5b16['model'],_0x4c5b16[_0x1a49('0x32')]);_0x589a8f[_0x1a49('0x34')]=_[_0x1a49('0x35')](_0x4c5b16['model'],qs[_0x1a49('0x36')](_0x3e8940[_0x1a49('0x32')][_0x1a49('0x36')]));_0x589a8f[_0x1a49('0x34')]=_0x589a8f[_0x1a49('0x34')][_0x1a49('0x37')]?_0x589a8f[_0x1a49('0x34')]:_0x4c5b16['model'];if(!_0x3e8940[_0x1a49('0x32')][_0x1a49('0x38')](_0x1a49('0x39'))){_0x589a8f['limit']=qs[_0x1a49('0x1e')](_0x3e8940[_0x1a49('0x32')][_0x1a49('0x1e')]);_0x589a8f['offset']=qs[_0x1a49('0x1d')](_0x3e8940[_0x1a49('0x32')][_0x1a49('0x1d')]);}_0x589a8f[_0x1a49('0x3a')]=qs[_0x1a49('0x3b')](_0x3e8940[_0x1a49('0x32')][_0x1a49('0x3b')]);_0x589a8f[_0x1a49('0x3c')]=qs[_0x1a49('0x3d')](_[_0x1a49('0x3e')](_0x3e8940['query'],_0x4c5b16['filters']),_0x2193c9);if(_0x3e8940[_0x1a49('0x32')]['filter']){_0x589a8f[_0x1a49('0x3c')]=_['merge'](_0x589a8f[_0x1a49('0x3c')],{'$or':_[_0x1a49('0x2b')](_0x2193c9,function(_0xdd0d4c){if(_0xdd0d4c[_0x1a49('0x2f')]!=='VIRTUAL'){var _0x40b0ef={};_0x40b0ef[_0xdd0d4c[_0x1a49('0x28')]]={'$like':'%'+_0x3e8940[_0x1a49('0x32')][_0x1a49('0x3f')]+'%'};return _0x40b0ef;}})});}_0x589a8f=_[_0x1a49('0x40')]({},_0x589a8f,_0x3e8940[_0x1a49('0x41')]);var _0x3f6f36={'where':_0x589a8f[_0x1a49('0x3c')]};return db['Template'][_0x1a49('0x1c')](_0x3f6f36)[_0x1a49('0x24')](function(_0x3bc810){_0x465488['count']=_0x3bc810;if(_0x3e8940[_0x1a49('0x32')][_0x1a49('0x42')]){_0x589a8f[_0x1a49('0x43')]=[{'all':!![]}];}return db[_0x1a49('0x2c')][_0x1a49('0x44')](_0x589a8f);})[_0x1a49('0x24')](function(_0x3e2452){_0x465488[_0x1a49('0x45')]=_0x3e2452;return _0x465488;})['then'](respondWithFilteredResult(_0x3852fd,_0x589a8f))['catch'](handleError(_0x3852fd,null));};exports[_0x1a49('0x46')]=function(_0x2f4d46,_0x2f93e1){var _0x128071={'raw':!![],'where':{'id':_0x2f4d46[_0x1a49('0x47')]['id']}},_0x3d6db3={};_0x3d6db3['model']=_[_0x1a49('0x33')](db[_0x1a49('0x2c')]['rawAttributes']);_0x3d6db3[_0x1a49('0x32')]=_[_0x1a49('0x33')](_0x2f4d46[_0x1a49('0x32')]);_0x3d6db3['filters']=_['intersection'](_0x3d6db3[_0x1a49('0x31')],_0x3d6db3[_0x1a49('0x32')]);_0x128071['attributes']=_[_0x1a49('0x35')](_0x3d6db3[_0x1a49('0x31')],qs[_0x1a49('0x36')](_0x2f4d46['query'][_0x1a49('0x36')]));_0x128071[_0x1a49('0x34')]=_0x128071[_0x1a49('0x34')][_0x1a49('0x37')]?_0x128071['attributes']:_0x3d6db3['model'];if(_0x2f4d46[_0x1a49('0x32')][_0x1a49('0x42')]){_0x128071['include']=[{'all':!![]}];}_0x128071=_[_0x1a49('0x40')]({},_0x128071,_0x2f4d46['options']);return db[_0x1a49('0x2c')][_0x1a49('0x48')](_0x128071)[_0x1a49('0x24')](handleEntityNotFound(_0x2f93e1,null))[_0x1a49('0x24')](respondWithResult(_0x2f93e1,null))['catch'](handleError(_0x2f93e1,null));};exports[_0x1a49('0x49')]=function(_0x4f13ad,_0x2d931c){return db[_0x1a49('0x2c')]['create'](_0x4f13ad[_0x1a49('0x4a')],{})[_0x1a49('0x24')](function(_0x33f371){var _0x5f562e=_0x4f13ad[_0x1a49('0x4b')][_0x1a49('0x4c')]({'plain':!![]});if(!_0x5f562e)throw new Error(_0x1a49('0x4d'));if(_0x5f562e[_0x1a49('0x4e')]==='user'){var _0x2f76a7=_0x33f371[_0x1a49('0x4c')]({'plain':!![]});var _0x17adef=_0x1a49('0x25');return db[_0x1a49('0x4f')][_0x1a49('0x48')]({'where':{'name':_0x17adef,'userProfileId':_0x5f562e[_0x1a49('0x50')]},'raw':!![]})['then'](function(_0x396fd0){if(_0x396fd0&&_0x396fd0[_0x1a49('0x51')]===0x0){return db[_0x1a49('0x26')]['create']({'name':_0x2f76a7[_0x1a49('0x28')],'resourceId':_0x2f76a7['id'],'type':_0x396fd0[_0x1a49('0x28')],'sectionId':_0x396fd0['id']},{})[_0x1a49('0x24')](function(){return _0x33f371;});}else{return _0x33f371;}})['catch'](function(_0x96b1a9){logger['error'](_0x1a49('0x52'),_0x96b1a9);throw _0x96b1a9;});}return _0x33f371;})[_0x1a49('0x24')](respondWithResult(_0x2d931c,0xc9))['catch'](handleError(_0x2d931c,null));};exports[_0x1a49('0x22')]=function(_0x2d5cc8,_0x13c26c){if(_0x2d5cc8[_0x1a49('0x4a')]['id']){delete _0x2d5cc8['body']['id'];}return db[_0x1a49('0x2c')][_0x1a49('0x48')]({'where':{'id':_0x2d5cc8[_0x1a49('0x47')]['id']}})[_0x1a49('0x24')](handleEntityNotFound(_0x13c26c,null))[_0x1a49('0x24')](saveUpdates(_0x2d5cc8[_0x1a49('0x4a')],null))[_0x1a49('0x24')](respondWithResult(_0x13c26c,null))['catch'](handleError(_0x13c26c,null));};exports[_0x1a49('0x23')]=function(_0x485fe0,_0x34d671){return db[_0x1a49('0x2c')][_0x1a49('0x48')]({'where':{'id':_0x485fe0['params']['id']}})[_0x1a49('0x24')](handleEntityNotFound(_0x34d671,null))[_0x1a49('0x24')](removeEntity(_0x34d671,null))[_0x1a49('0x53')](handleError(_0x34d671,null));}; \ No newline at end of file +var _0x68ea=['desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','index','map','Template','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce'];(function(_0x2f00dd,_0xd659bd){var _0x1bfa6c=function(_0x483ef3){while(--_0x483ef3){_0x2f00dd['push'](_0x2f00dd['shift']());}};_0x1bfa6c(++_0xd659bd);}(_0x68ea,0x94));var _0xa68e=function(_0xe7514c,_0x44f623){_0xe7514c=_0xe7514c-0x0;var _0x54c7bb=_0x68ea[_0xe7514c];return _0x54c7bb;};'use strict';var pdf=require(_0xa68e('0x0'));var emlformat=require(_0xa68e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa68e('0x2'));var jsonpatch=require(_0xa68e('0x3'));var rp=require(_0xa68e('0x4'));var moment=require(_0xa68e('0x5'));var BPromise=require(_0xa68e('0x6'));var Mustache=require(_0xa68e('0x7'));var util=require('util');var path=require(_0xa68e('0x8'));var sox=require(_0xa68e('0x9'));var csv=require(_0xa68e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa68e('0xb'));var squel=require(_0xa68e('0xc'));var crypto=require('crypto');var jsforce=require(_0xa68e('0xd'));var deskjs=require(_0xa68e('0xe'));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(_0xa68e('0xf'));var as=require(_0xa68e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa68e('0x11'));var utils=require(_0xa68e('0x12'));var config=require(_0xa68e('0x13'));var db=require(_0xa68e('0x14'))['db'];function respondWithStatusCode(_0x2a35b9,_0x44a76d){_0x44a76d=_0x44a76d||0xcc;return function(_0x24e903){if(_0x24e903){return _0x2a35b9['sendStatus'](_0x44a76d);}return _0x2a35b9[_0xa68e('0x15')](_0x44a76d)[_0xa68e('0x16')]();};}function respondWithResult(_0x41fe84,_0x2426dc){_0x2426dc=_0x2426dc||0xc8;return function(_0x43eb38){if(_0x43eb38){return _0x41fe84['status'](_0x2426dc)[_0xa68e('0x17')](_0x43eb38);}};}function respondWithFilteredResult(_0x5cc713,_0x5c176e){return function(_0x255c2d){if(_0x255c2d){var _0x460de0=_0x255c2d['count'],_0x4f558b=_0x5c176e[_0xa68e('0x18')],_0x39560b=_0x5c176e[_0xa68e('0x18')]+_0x5c176e[_0xa68e('0x19')],_0x5d7b91;if(_0x39560b>=_0x460de0){_0x39560b=_0x460de0;_0x5d7b91=0xc8;}else{_0x5d7b91=0xce;}_0x5cc713[_0xa68e('0x15')](_0x5d7b91);return _0x5cc713[_0xa68e('0x1a')](_0xa68e('0x1b'),_0x4f558b+'-'+_0x39560b+'/'+_0x460de0)['json'](_0x255c2d);}return null;};}function patchUpdates(_0x51b0b2){return function(_0x40f458){try{jsonpatch[_0xa68e('0x1c')](_0x40f458,_0x51b0b2,!![]);}catch(_0xb50117){return BPromise[_0xa68e('0x1d')](_0xb50117);}return _0x40f458[_0xa68e('0x1e')]();};}function saveUpdates(_0x5c83af,_0x20ee6c){return function(_0x3e1ce9){if(_0x3e1ce9){return _0x3e1ce9[_0xa68e('0x1f')](_0x5c83af)[_0xa68e('0x20')](function(_0x4d18ca){return _0x4d18ca;});}return null;};}function removeEntity(_0x3a7a35,_0x583dd4){return function(_0x5616cc){if(_0x5616cc){return _0x5616cc[_0xa68e('0x21')]()[_0xa68e('0x20')](function(){var _0x16d78e=_0x5616cc[_0xa68e('0x22')]({'plain':!![]});var _0x3d9f14=_0xa68e('0x23');return db[_0xa68e('0x24')]['destroy']({'where':{'type':_0x3d9f14,'resourceId':_0x16d78e['id']}})[_0xa68e('0x20')](function(){return _0x5616cc;});})['then'](function(){_0x3a7a35[_0xa68e('0x15')](0xcc)[_0xa68e('0x16')]();});}};}function handleEntityNotFound(_0x37aaf0,_0x37fb5e){return function(_0x3b10a4){if(!_0x3b10a4){_0x37aaf0['sendStatus'](0x194);}return _0x3b10a4;};}function handleError(_0x5557bd,_0x478a11){_0x478a11=_0x478a11||0x1f4;return function(_0x16a721){logger[_0xa68e('0x25')](_0x16a721['stack']);if(_0x16a721['name']){delete _0x16a721[_0xa68e('0x26')];}_0x5557bd[_0xa68e('0x15')](_0x478a11)['send'](_0x16a721);};}exports[_0xa68e('0x27')]=function(_0x329229,_0x26a81e){var _0x498ab5={},_0x1b736c={},_0x45670d={'count':0x0,'rows':[]};var _0x4e3b8e=_[_0xa68e('0x28')](db[_0xa68e('0x29')][_0xa68e('0x2a')],function(_0x282fea){return{'name':_0x282fea[_0xa68e('0x2b')],'type':_0x282fea[_0xa68e('0x2c')][_0xa68e('0x2d')]};});_0x1b736c['model']=_['map'](_0x4e3b8e,_0xa68e('0x26'));_0x1b736c['query']=_[_0xa68e('0x2e')](_0x329229[_0xa68e('0x2f')]);_0x1b736c['filters']=_[_0xa68e('0x30')](_0x1b736c[_0xa68e('0x31')],_0x1b736c[_0xa68e('0x2f')]);_0x498ab5[_0xa68e('0x32')]=_[_0xa68e('0x30')](_0x1b736c['model'],qs[_0xa68e('0x33')](_0x329229['query'][_0xa68e('0x33')]));_0x498ab5[_0xa68e('0x32')]=_0x498ab5[_0xa68e('0x32')][_0xa68e('0x34')]?_0x498ab5[_0xa68e('0x32')]:_0x1b736c[_0xa68e('0x31')];if(!_0x329229[_0xa68e('0x2f')][_0xa68e('0x35')](_0xa68e('0x36'))){_0x498ab5[_0xa68e('0x19')]=qs['limit'](_0x329229[_0xa68e('0x2f')]['limit']);_0x498ab5['offset']=qs['offset'](_0x329229['query'][_0xa68e('0x18')]);}_0x498ab5[_0xa68e('0x37')]=qs[_0xa68e('0x38')](_0x329229[_0xa68e('0x2f')][_0xa68e('0x38')]);_0x498ab5[_0xa68e('0x39')]=qs[_0xa68e('0x3a')](_[_0xa68e('0x3b')](_0x329229['query'],_0x1b736c[_0xa68e('0x3a')]),_0x4e3b8e);if(_0x329229[_0xa68e('0x2f')][_0xa68e('0x3c')]){_0x498ab5[_0xa68e('0x39')]=_[_0xa68e('0x3d')](_0x498ab5[_0xa68e('0x39')],{'$or':_[_0xa68e('0x28')](_0x4e3b8e,function(_0x50b703){if(_0x50b703[_0xa68e('0x2c')]!==_0xa68e('0x3e')){var _0x605b46={};_0x605b46[_0x50b703[_0xa68e('0x26')]]={'$like':'%'+_0x329229[_0xa68e('0x2f')][_0xa68e('0x3c')]+'%'};return _0x605b46;}})});}_0x498ab5=_[_0xa68e('0x3d')]({},_0x498ab5,_0x329229[_0xa68e('0x3f')]);var _0x4da7da={'where':_0x498ab5[_0xa68e('0x39')]};return db[_0xa68e('0x29')][_0xa68e('0x40')](_0x4da7da)[_0xa68e('0x20')](function(_0x435bb7){_0x45670d[_0xa68e('0x40')]=_0x435bb7;if(_0x329229[_0xa68e('0x2f')][_0xa68e('0x41')]){_0x498ab5[_0xa68e('0x42')]=[{'all':!![]}];}return db[_0xa68e('0x29')][_0xa68e('0x43')](_0x498ab5);})['then'](function(_0x2dda9b){_0x45670d[_0xa68e('0x44')]=_0x2dda9b;return _0x45670d;})['then'](respondWithFilteredResult(_0x26a81e,_0x498ab5))[_0xa68e('0x45')](handleError(_0x26a81e,null));};exports[_0xa68e('0x46')]=function(_0x5e1b58,_0x75935){var _0x25685b={'raw':!![],'where':{'id':_0x5e1b58['params']['id']}},_0x3c2f56={};_0x3c2f56[_0xa68e('0x31')]=_[_0xa68e('0x2e')](db[_0xa68e('0x29')][_0xa68e('0x2a')]);_0x3c2f56[_0xa68e('0x2f')]=_[_0xa68e('0x2e')](_0x5e1b58[_0xa68e('0x2f')]);_0x3c2f56[_0xa68e('0x3a')]=_[_0xa68e('0x30')](_0x3c2f56['model'],_0x3c2f56[_0xa68e('0x2f')]);_0x25685b[_0xa68e('0x32')]=_['intersection'](_0x3c2f56[_0xa68e('0x31')],qs['fields'](_0x5e1b58['query'][_0xa68e('0x33')]));_0x25685b[_0xa68e('0x32')]=_0x25685b[_0xa68e('0x32')][_0xa68e('0x34')]?_0x25685b[_0xa68e('0x32')]:_0x3c2f56[_0xa68e('0x31')];if(_0x5e1b58['query']['includeAll']){_0x25685b[_0xa68e('0x42')]=[{'all':!![]}];}_0x25685b=_[_0xa68e('0x3d')]({},_0x25685b,_0x5e1b58['options']);return db[_0xa68e('0x29')]['find'](_0x25685b)[_0xa68e('0x20')](handleEntityNotFound(_0x75935,null))[_0xa68e('0x20')](respondWithResult(_0x75935,null))[_0xa68e('0x45')](handleError(_0x75935,null));};exports[_0xa68e('0x47')]=function(_0x3e74a3,_0x25b78b){return db[_0xa68e('0x29')]['create'](_0x3e74a3['body'],{})[_0xa68e('0x20')](function(_0x2fff58){var _0x5ce54b=_0x3e74a3['user']['get']({'plain':!![]});if(!_0x5ce54b)throw new Error(_0xa68e('0x48'));if(_0x5ce54b[_0xa68e('0x49')]===_0xa68e('0x4a')){var _0x199472=_0x2fff58['get']({'plain':!![]});var _0x21916b=_0xa68e('0x23');return db['UserProfileSection'][_0xa68e('0x4b')]({'where':{'name':_0x21916b,'userProfileId':_0x5ce54b[_0xa68e('0x4c')]},'raw':!![]})[_0xa68e('0x20')](function(_0x2b0080){if(_0x2b0080&&_0x2b0080[_0xa68e('0x4d')]===0x0){return db[_0xa68e('0x24')][_0xa68e('0x47')]({'name':_0x199472[_0xa68e('0x26')],'resourceId':_0x199472['id'],'type':_0x2b0080[_0xa68e('0x26')],'sectionId':_0x2b0080['id']},{})[_0xa68e('0x20')](function(){return _0x2fff58;});}else{return _0x2fff58;}})[_0xa68e('0x45')](function(_0x19222e){logger['error'](_0xa68e('0x4e'),_0x19222e);throw _0x19222e;});}return _0x2fff58;})['then'](respondWithResult(_0x25b78b,0xc9))[_0xa68e('0x45')](handleError(_0x25b78b,null));};exports[_0xa68e('0x1f')]=function(_0x46d451,_0x4aaa49){if(_0x46d451[_0xa68e('0x4f')]['id']){delete _0x46d451[_0xa68e('0x4f')]['id'];}return db['Template']['find']({'where':{'id':_0x46d451[_0xa68e('0x50')]['id']}})[_0xa68e('0x20')](handleEntityNotFound(_0x4aaa49,null))['then'](saveUpdates(_0x46d451[_0xa68e('0x4f')],null))[_0xa68e('0x20')](respondWithResult(_0x4aaa49,null))[_0xa68e('0x45')](handleError(_0x4aaa49,null));};exports[_0xa68e('0x21')]=function(_0x223ed9,_0x1a9f89){return db['Template']['find']({'where':{'id':_0x223ed9['params']['id']}})[_0xa68e('0x20')](handleEntityNotFound(_0x1a9f89,null))[_0xa68e('0x20')](removeEntity(_0x1a9f89,null))[_0xa68e('0x45')](handleError(_0x1a9f89,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5dd8f60..2442697 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 _0xdb4d=['Template','tools_templates','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xdb4d,0x77));var _0xddb4=function(_0x40195e,_0x5c4ecd){_0x40195e=_0x40195e-0x0;var _0x39e50d=_0xdb4d[_0x40195e];return _0x39e50d;};'use strict';var _=require(_0xddb4('0x0'));var util=require('util');var logger=require(_0xddb4('0x1'))('api');var moment=require(_0xddb4('0x2'));var BPromise=require(_0xddb4('0x3'));var rp=require(_0xddb4('0x4'));var fs=require('fs');var path=require(_0xddb4('0x5'));var rimraf=require(_0xddb4('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x7bbf36,_0x5c2002){return _0x7bbf36['define'](_0xddb4('0x7'),attributes,{'tableName':_0xddb4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb29=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','tools_templates'];(function(_0x454087,_0xb66160){var _0x11a9ab=function(_0x2c309e){while(--_0x2c309e){_0x454087['push'](_0x454087['shift']());}};_0x11a9ab(++_0xb66160);}(_0xbb29,0x78));var _0x9bb2=function(_0x36f4ab,_0x355d15){_0x36f4ab=_0x36f4ab-0x0;var _0x3c17b8=_0xbb29[_0x36f4ab];return _0x3c17b8;};'use strict';var _=require(_0x9bb2('0x0'));var util=require(_0x9bb2('0x1'));var logger=require(_0x9bb2('0x2'))(_0x9bb2('0x3'));var moment=require(_0x9bb2('0x4'));var BPromise=require('bluebird');var rp=require(_0x9bb2('0x5'));var fs=require('fs');var path=require(_0x9bb2('0x6'));var rimraf=require(_0x9bb2('0x7'));var config=require(_0x9bb2('0x8'));var attributes=require(_0x9bb2('0x9'));module[_0x9bb2('0xa')]=function(_0x79c10f,_0x27fc10){return _0x79c10f['define']('Template',attributes,{'tableName':_0x9bb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 0e17f05..68ea39a 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 _0x9af2=['result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message'];(function(_0x5248c9,_0x31ac41){var _0xbf13a2=function(_0x128756){while(--_0x128756){_0x5248c9['push'](_0x5248c9['shift']());}};_0xbf13a2(++_0x31ac41);}(_0x9af2,0xb7));var _0x29af=function(_0x1e55f4,_0x28afbc){_0x1e55f4=_0x1e55f4-0x0;var _0x1b27db=_0x9af2[_0x1e55f4];return _0x1b27db;};'use strict';var _=require(_0x29af('0x0'));var util=require(_0x29af('0x1'));var moment=require(_0x29af('0x2'));var BPromise=require(_0x29af('0x3'));var rs=require(_0x29af('0x4'));var fs=require('fs');var Redis=require(_0x29af('0x5'));var db=require(_0x29af('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x29af('0x7'))(_0x29af('0x8'));var config=require(_0x29af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x29af('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3326eb,_0x1e6dcf,_0x5a452e){return new BPromise(function(_0x59bf4e,_0x1f0f1f){return client[_0x29af('0xb')](_0x3326eb,_0x5a452e)[_0x29af('0xc')](function(_0x3dfd37){logger[_0x29af('0xd')]('Template,\x20%s,\x20%s',_0x1e6dcf,_0x29af('0xe'));logger['debug'](_0x29af('0xf'),_0x1e6dcf,_0x29af('0xe'),JSON[_0x29af('0x10')](_0x3dfd37));if(_0x3dfd37[_0x29af('0x11')]){if(_0x3dfd37[_0x29af('0x11')][_0x29af('0x12')]===0x1f4){logger['error'](_0x29af('0x13'),_0x1e6dcf,_0x3dfd37[_0x29af('0x11')][_0x29af('0x14')]);return _0x1f0f1f(_0x3dfd37[_0x29af('0x11')][_0x29af('0x14')]);}logger[_0x29af('0x11')](_0x29af('0x13'),_0x1e6dcf,_0x3dfd37[_0x29af('0x11')][_0x29af('0x14')]);return _0x59bf4e(_0x3dfd37[_0x29af('0x11')][_0x29af('0x14')]);}else{logger['info'](_0x29af('0x13'),_0x1e6dcf,_0x29af('0xe'));_0x59bf4e(_0x3dfd37[_0x29af('0x15')][_0x29af('0x14')]);}})[_0x29af('0x16')](function(_0x551b5e){logger['error'](_0x29af('0x13'),_0x1e6dcf,_0x551b5e);_0x1f0f1f(_0x551b5e);});});}exports['GetTemplate']=function(_0x3afbfb){var _0x3c7945=this;return new Promise(function(_0x35dc34,_0x24b53e){return db[_0x29af('0x17')][_0x29af('0x18')]({'raw':_0x3afbfb[_0x29af('0x19')]?_0x3afbfb[_0x29af('0x19')][_0x29af('0x1a')]===undefined?!![]:![]:!![],'where':_0x3afbfb['options']?_0x3afbfb['options'][_0x29af('0x1b')]||null:null,'attributes':_0x3afbfb[_0x29af('0x19')]?_0x3afbfb[_0x29af('0x19')][_0x29af('0x1c')]||null:null,'limit':_0x3afbfb[_0x29af('0x19')]?_0x3afbfb['options'][_0x29af('0x1d')]||null:null,'include':_0x3afbfb[_0x29af('0x19')]?_0x3afbfb[_0x29af('0x19')][_0x29af('0x1e')]?_[_0x29af('0x1f')](_0x3afbfb[_0x29af('0x19')][_0x29af('0x1e')],function(_0x5459c1){return{'model':db[_0x5459c1[_0x29af('0x20')]],'as':_0x5459c1['as'],'attributes':_0x5459c1[_0x29af('0x1c')],'include':_0x5459c1[_0x29af('0x1e')]?_[_0x29af('0x1f')](_0x5459c1[_0x29af('0x1e')],function(_0x1aab7c){return{'model':db[_0x1aab7c['model']],'as':_0x1aab7c['as'],'attributes':_0x1aab7c[_0x29af('0x1c')],'include':_0x1aab7c[_0x29af('0x1e')]?_[_0x29af('0x1f')](_0x1aab7c[_0x29af('0x1e')],function(_0x571d88){return{'model':db[_0x571d88['model']],'as':_0x571d88['as'],'attributes':_0x571d88['attributes']};}):[]};}):[]};}):[]:[]})[_0x29af('0xc')](function(_0x583a51){logger[_0x29af('0xd')](_0x29af('0x21'),_0x3afbfb);logger['debug'](_0x29af('0x21'),_0x3afbfb,JSON[_0x29af('0x10')](_0x583a51));_0x35dc34(_0x583a51);})[_0x29af('0x16')](function(_0x2d16ef){logger['error'](_0x29af('0x21'),_0x2d16ef[_0x29af('0x14')],_0x3afbfb);_0x24b53e(_0x3c7945[_0x29af('0x11')](0x1f4,_0x2d16ef[_0x29af('0x14')]));});});}; \ No newline at end of file +var _0xb095=['Template','findAll','options','where','attributes','include','model','map','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTemplate'];(function(_0x51f012,_0x629f0d){var _0x1e3e8f=function(_0x5f4175){while(--_0x5f4175){_0x51f012['push'](_0x51f012['shift']());}};_0x1e3e8f(++_0x629f0d);}(_0xb095,0x129));var _0x5b09=function(_0x587adf,_0x4328c3){_0x587adf=_0x587adf-0x0;var _0x10096b=_0xb095[_0x587adf];return _0x10096b;};'use strict';var _=require(_0x5b09('0x0'));var util=require(_0x5b09('0x1'));var moment=require(_0x5b09('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b09('0x3'));var fs=require('fs');var Redis=require(_0x5b09('0x4'));var db=require(_0x5b09('0x5'))['db'];var utils=require(_0x5b09('0x6'));var logger=require(_0x5b09('0x7'))(_0x5b09('0x8'));var config=require(_0x5b09('0x9'));var jayson=require(_0x5b09('0xa'));var client=jayson['client'][_0x5b09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbec4db,_0x194d00,_0x130a6f){return new BPromise(function(_0x17f4c3,_0x47de6d){return client[_0x5b09('0xc')](_0xbec4db,_0x130a6f)['then'](function(_0x1a3b7b){logger[_0x5b09('0xd')](_0x5b09('0xe'),_0x194d00,_0x5b09('0xf'));logger[_0x5b09('0x10')](_0x5b09('0x11'),_0x194d00,'request\x20sent',JSON['stringify'](_0x1a3b7b));if(_0x1a3b7b[_0x5b09('0x12')]){if(_0x1a3b7b[_0x5b09('0x12')][_0x5b09('0x13')]===0x1f4){logger[_0x5b09('0x12')]('Template,\x20%s,\x20%s',_0x194d00,_0x1a3b7b[_0x5b09('0x12')]['message']);return _0x47de6d(_0x1a3b7b[_0x5b09('0x12')]['message']);}logger['error']('Template,\x20%s,\x20%s',_0x194d00,_0x1a3b7b[_0x5b09('0x12')][_0x5b09('0x14')]);return _0x17f4c3(_0x1a3b7b[_0x5b09('0x12')][_0x5b09('0x14')]);}else{logger[_0x5b09('0xd')](_0x5b09('0xe'),_0x194d00,_0x5b09('0xf'));_0x17f4c3(_0x1a3b7b[_0x5b09('0x15')][_0x5b09('0x14')]);}})['catch'](function(_0x51ab95){logger[_0x5b09('0x12')](_0x5b09('0xe'),_0x194d00,_0x51ab95);_0x47de6d(_0x51ab95);});});}exports[_0x5b09('0x16')]=function(_0x2db0a7){var _0x20b8e9=this;return new Promise(function(_0x550d02,_0x43e9db){return db[_0x5b09('0x17')][_0x5b09('0x18')]({'raw':_0x2db0a7[_0x5b09('0x19')]?_0x2db0a7[_0x5b09('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2db0a7[_0x5b09('0x19')]?_0x2db0a7[_0x5b09('0x19')][_0x5b09('0x1a')]||null:null,'attributes':_0x2db0a7[_0x5b09('0x19')]?_0x2db0a7['options'][_0x5b09('0x1b')]||null:null,'limit':_0x2db0a7[_0x5b09('0x19')]?_0x2db0a7[_0x5b09('0x19')]['limit']||null:null,'include':_0x2db0a7['options']?_0x2db0a7[_0x5b09('0x19')][_0x5b09('0x1c')]?_['map'](_0x2db0a7[_0x5b09('0x19')]['include'],function(_0xa4aecc){return{'model':db[_0xa4aecc[_0x5b09('0x1d')]],'as':_0xa4aecc['as'],'attributes':_0xa4aecc['attributes'],'include':_0xa4aecc[_0x5b09('0x1c')]?_[_0x5b09('0x1e')](_0xa4aecc[_0x5b09('0x1c')],function(_0x389652){return{'model':db[_0x389652[_0x5b09('0x1d')]],'as':_0x389652['as'],'attributes':_0x389652[_0x5b09('0x1b')],'include':_0x389652[_0x5b09('0x1c')]?_[_0x5b09('0x1e')](_0x389652['include'],function(_0x2ec0f1){return{'model':db[_0x2ec0f1[_0x5b09('0x1d')]],'as':_0x2ec0f1['as'],'attributes':_0x2ec0f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b09('0x1f')](function(_0x30f688){logger[_0x5b09('0xd')]('GetTemplate',_0x2db0a7);logger[_0x5b09('0x10')](_0x5b09('0x16'),_0x2db0a7,JSON['stringify'](_0x30f688));_0x550d02(_0x30f688);})['catch'](function(_0x5e7ce0){logger[_0x5b09('0x12')]('GetTemplate',_0x5e7ce0[_0x5b09('0x14')],_0x2db0a7);_0x43e9db(_0x20b8e9[_0x5b09('0x12')](0x1f4,_0x5e7ce0[_0x5b09('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index cf8f03f..06f52a7 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 _0x84cd=['isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','./trigger.controller','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x84cd,0x13e));var _0xd84c=function(_0xcb62bb,_0xf25747){_0xcb62bb=_0xcb62bb-0x0;var _0x646333=_0x84cd[_0xcb62bb];return _0x646333;};'use strict';var multer=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var path=require(_0xd84c('0x2'));var timeout=require(_0xd84c('0x3'));var express=require(_0xd84c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd84c('0x5'));router[_0xd84c('0x6')]('/',auth[_0xd84c('0x7')](),controller[_0xd84c('0x8')]);router[_0xd84c('0x6')]('/:id',auth[_0xd84c('0x7')](),controller[_0xd84c('0x9')]);router[_0xd84c('0x6')](_0xd84c('0xa'),auth[_0xd84c('0x7')](),controller[_0xd84c('0xb')]);router[_0xd84c('0x6')](_0xd84c('0xc'),auth['isAuthenticated'](),controller[_0xd84c('0xd')]);router[_0xd84c('0x6')]('/:id/actions',auth['isAuthenticated'](),controller[_0xd84c('0xe')]);router[_0xd84c('0xf')]('/',auth[_0xd84c('0x7')](),controller[_0xd84c('0x10')]);router['post'](_0xd84c('0xa'),auth[_0xd84c('0x7')](),controller[_0xd84c('0x11')]);router['post']('/:id/any_conditions',auth[_0xd84c('0x7')](),controller[_0xd84c('0x12')]);router[_0xd84c('0xf')]('/:id/actions',auth[_0xd84c('0x7')](),controller[_0xd84c('0x13')]);router[_0xd84c('0x14')](_0xd84c('0x15'),auth['isAuthenticated'](),controller[_0xd84c('0x16')]);router[_0xd84c('0x17')]('/:id',auth[_0xd84c('0x7')](),controller[_0xd84c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xbcb8=['getActions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0x3046da,_0x599123){var _0x467db2=function(_0x17aa26){while(--_0x17aa26){_0x3046da['push'](_0x3046da['shift']());}};_0x467db2(++_0x599123);}(_0xbcb8,0x132));var _0x8bcb=function(_0x343005,_0x22ce36){_0x343005=_0x343005-0x0;var _0x5bf321=_0xbcb8[_0x343005];return _0x5bf321;};'use strict';var multer=require(_0x8bcb('0x0'));var util=require(_0x8bcb('0x1'));var path=require(_0x8bcb('0x2'));var timeout=require(_0x8bcb('0x3'));var express=require(_0x8bcb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8bcb('0x5'));var config=require(_0x8bcb('0x6'));var controller=require(_0x8bcb('0x7'));router[_0x8bcb('0x8')]('/',auth[_0x8bcb('0x9')](),controller[_0x8bcb('0xa')]);router[_0x8bcb('0x8')](_0x8bcb('0xb'),auth[_0x8bcb('0x9')](),controller[_0x8bcb('0xc')]);router[_0x8bcb('0x8')](_0x8bcb('0xd'),auth[_0x8bcb('0x9')](),controller[_0x8bcb('0xe')]);router[_0x8bcb('0x8')](_0x8bcb('0xf'),auth['isAuthenticated'](),controller[_0x8bcb('0x10')]);router[_0x8bcb('0x8')](_0x8bcb('0x11'),auth[_0x8bcb('0x9')](),controller[_0x8bcb('0x12')]);router[_0x8bcb('0x13')]('/',auth[_0x8bcb('0x9')](),controller[_0x8bcb('0x14')]);router[_0x8bcb('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x8bcb('0x15')]);router[_0x8bcb('0x13')]('/:id/any_conditions',auth[_0x8bcb('0x9')](),controller[_0x8bcb('0x16')]);router[_0x8bcb('0x13')]('/:id/actions',auth[_0x8bcb('0x9')](),controller[_0x8bcb('0x17')]);router['put'](_0x8bcb('0xb'),auth['isAuthenticated'](),controller[_0x8bcb('0x18')]);router['delete'](_0x8bcb('0xb'),auth['isAuthenticated'](),controller[_0x8bcb('0x19')]);module[_0x8bcb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5171b01..0e0639a 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 _0x14a2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x14a2,0x9d));var _0x214a=function(_0x4307d5,_0x53c2d0){_0x4307d5=_0x4307d5-0x0;var _0x45efaa=_0x14a2[_0x4307d5];return _0x45efaa;};'use strict';var Sequelize=require(_0x214a('0x0'));module[_0x214a('0x1')]={'name':{'type':Sequelize[_0x214a('0x2')]},'channel':{'type':Sequelize[_0x214a('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x214a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x60ff=['exports','STRING','BOOLEAN'];(function(_0x384647,_0x309611){var _0x1dae49=function(_0x26acfc){while(--_0x26acfc){_0x384647['push'](_0x384647['shift']());}};_0x1dae49(++_0x309611);}(_0x60ff,0x1c2));var _0xf60f=function(_0x536a2f,_0x1bc3a8){_0x536a2f=_0x536a2f-0x0;var _0x575d25=_0x60ff[_0x536a2f];return _0x575d25;};'use strict';var Sequelize=require('sequelize');module[_0xf60f('0x0')]={'name':{'type':Sequelize[_0xf60f('0x1')]},'channel':{'type':Sequelize[_0xf60f('0x1')]},'description':{'type':Sequelize[_0xf60f('0x1')]},'status':{'type':Sequelize[_0xf60f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a52869b..7b906a3 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 _0x76ac=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Trigger','fieldName','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','rawAttributes','intersection','catch','create','body','user'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x76ac,0x198));var _0xc76a=function(_0x2799f7,_0xb3e3ad){_0x2799f7=_0x2799f7-0x0;var _0x927b00=_0x76ac[_0x2799f7];return _0x927b00;};'use strict';var pdf=require(_0xc76a('0x0'));var emlformat=require(_0xc76a('0x1'));var rimraf=require(_0xc76a('0x2'));var zipdir=require(_0xc76a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc76a('0x4'));var moment=require(_0xc76a('0x5'));var BPromise=require(_0xc76a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc76a('0x7'));var sox=require(_0xc76a('0x8'));var csv=require(_0xc76a('0x9'));var ejs=require(_0xc76a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc76a('0xb'));var crypto=require(_0xc76a('0xc'));var jsforce=require(_0xc76a('0xd'));var deskjs=require(_0xc76a('0xe'));var toCsv=require(_0xc76a('0x9'));var querystring=require(_0xc76a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc76a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76a('0x11'));var logger=require(_0xc76a('0x12'))(_0xc76a('0x13'));var utils=require('../../config/utils');var config=require(_0xc76a('0x14'));var db=require(_0xc76a('0x15'))['db'];function respondWithStatusCode(_0x15297a,_0x4a9e79){_0x4a9e79=_0x4a9e79||0xcc;return function(_0x40409a){if(_0x40409a){return _0x15297a[_0xc76a('0x16')](_0x4a9e79);}return _0x15297a[_0xc76a('0x17')](_0x4a9e79)[_0xc76a('0x18')]();};}function respondWithResult(_0x28715c,_0x20eca5){_0x20eca5=_0x20eca5||0xc8;return function(_0x44acd6){if(_0x44acd6){return _0x28715c[_0xc76a('0x17')](_0x20eca5)[_0xc76a('0x19')](_0x44acd6);}};}function respondWithFilteredResult(_0x519c3a,_0x15ebdb){return function(_0x3ab9ae){if(_0x3ab9ae){var _0x5e926d=_0x3ab9ae['count'],_0x5b69bb=_0x15ebdb['offset'],_0x350318=_0x15ebdb[_0xc76a('0x1a')]+_0x15ebdb[_0xc76a('0x1b')],_0x5d08c1;if(_0x350318>=_0x5e926d){_0x350318=_0x5e926d;_0x5d08c1=0xc8;}else{_0x5d08c1=0xce;}_0x519c3a['status'](_0x5d08c1);return _0x519c3a[_0xc76a('0x1c')](_0xc76a('0x1d'),_0x5b69bb+'-'+_0x350318+'/'+_0x5e926d)[_0xc76a('0x19')](_0x3ab9ae);}return null;};}function patchUpdates(_0x139710){return function(_0xe7fa56){try{jsonpatch[_0xc76a('0x1e')](_0xe7fa56,_0x139710,!![]);}catch(_0x2f0585){return BPromise[_0xc76a('0x1f')](_0x2f0585);}return _0xe7fa56[_0xc76a('0x20')]();};}function saveUpdates(_0x448d63,_0x3b3aaa){return function(_0x1d442b){if(_0x1d442b){return _0x1d442b[_0xc76a('0x21')](_0x448d63)[_0xc76a('0x22')](function(_0x27c060){return _0x27c060;});}return null;};}function removeEntity(_0x1f6966,_0x383730){return function(_0x3e568d){if(_0x3e568d){return _0x3e568d[_0xc76a('0x23')]()[_0xc76a('0x22')](function(){var _0x4a443e=_0x3e568d[_0xc76a('0x24')]({'plain':!![]});var _0x5f09f6='Triggers';return db[_0xc76a('0x25')]['destroy']({'where':{'type':_0x5f09f6,'resourceId':_0x4a443e['id']}})[_0xc76a('0x22')](function(){return _0x3e568d;});})['then'](function(){_0x1f6966[_0xc76a('0x17')](0xcc)[_0xc76a('0x18')]();});}};}function handleEntityNotFound(_0x32d684,_0x3f0ea1){return function(_0x2df657){if(!_0x2df657){_0x32d684['sendStatus'](0x194);}return _0x2df657;};}function handleError(_0x390003,_0xec5893){_0xec5893=_0xec5893||0x1f4;return function(_0x46d101){logger[_0xc76a('0x26')](_0x46d101[_0xc76a('0x27')]);if(_0x46d101[_0xc76a('0x28')]){delete _0x46d101['name'];}_0x390003[_0xc76a('0x17')](_0xec5893)[_0xc76a('0x29')](_0x46d101);};}exports[_0xc76a('0x2a')]=function(_0x37da43,_0x230fb3){var _0x36f33c={},_0x3df84c={},_0xe13a0b={'count':0x0,'rows':[]};var _0x164b0e=_['map'](db[_0xc76a('0x2b')]['rawAttributes'],function(_0x45ded1){return{'name':_0x45ded1[_0xc76a('0x2c')],'type':_0x45ded1['type'][_0xc76a('0x2d')]};});_0x3df84c[_0xc76a('0x2e')]=_[_0xc76a('0x2f')](_0x164b0e,_0xc76a('0x28'));_0x3df84c[_0xc76a('0x30')]=_[_0xc76a('0x31')](_0x37da43[_0xc76a('0x30')]);_0x3df84c['filters']=_['intersection'](_0x3df84c['model'],_0x3df84c['query']);_0x36f33c[_0xc76a('0x32')]=_['intersection'](_0x3df84c['model'],qs[_0xc76a('0x33')](_0x37da43['query'][_0xc76a('0x33')]));_0x36f33c[_0xc76a('0x32')]=_0x36f33c[_0xc76a('0x32')][_0xc76a('0x34')]?_0x36f33c[_0xc76a('0x32')]:_0x3df84c[_0xc76a('0x2e')];if(!_0x37da43['query'][_0xc76a('0x35')](_0xc76a('0x36'))){_0x36f33c[_0xc76a('0x1b')]=qs[_0xc76a('0x1b')](_0x37da43['query'][_0xc76a('0x1b')]);_0x36f33c[_0xc76a('0x1a')]=qs[_0xc76a('0x1a')](_0x37da43[_0xc76a('0x30')]['offset']);}_0x36f33c[_0xc76a('0x37')]=qs[_0xc76a('0x38')](_0x37da43[_0xc76a('0x30')]['sort']);_0x36f33c[_0xc76a('0x39')]=qs[_0xc76a('0x3a')](_[_0xc76a('0x3b')](_0x37da43[_0xc76a('0x30')],_0x3df84c[_0xc76a('0x3a')]),_0x164b0e);if(_0x37da43[_0xc76a('0x30')][_0xc76a('0x3c')]){_0x36f33c[_0xc76a('0x39')]=_['merge'](_0x36f33c[_0xc76a('0x39')],{'$or':_[_0xc76a('0x2f')](_0x164b0e,function(_0x35b0da){if(_0x35b0da[_0xc76a('0x3d')]!==_0xc76a('0x3e')){var _0x541325={};_0x541325[_0x35b0da['name']]={'$like':'%'+_0x37da43[_0xc76a('0x30')][_0xc76a('0x3c')]+'%'};return _0x541325;}})});}_0x36f33c=_[_0xc76a('0x3f')]({},_0x36f33c,_0x37da43[_0xc76a('0x40')]);var _0x50fcde={'where':_0x36f33c[_0xc76a('0x39')]};return db[_0xc76a('0x2b')][_0xc76a('0x41')](_0x50fcde)[_0xc76a('0x22')](function(_0x441650){_0xe13a0b[_0xc76a('0x41')]=_0x441650;if(_0x37da43[_0xc76a('0x30')][_0xc76a('0x42')]){_0x36f33c[_0xc76a('0x43')]=[{'all':!![]}];}return db[_0xc76a('0x2b')][_0xc76a('0x44')](_0x36f33c);})[_0xc76a('0x22')](function(_0x603f4a){_0xe13a0b[_0xc76a('0x45')]=_0x603f4a;return _0xe13a0b;})[_0xc76a('0x22')](respondWithFilteredResult(_0x230fb3,_0x36f33c))['catch'](handleError(_0x230fb3,null));};exports['show']=function(_0x1f26e0,_0x5bf2f2){var _0x319fe3={'raw':![],'where':{'id':_0x1f26e0[_0xc76a('0x46')]['id']}},_0x1a62fb={};_0x1a62fb[_0xc76a('0x2e')]=_[_0xc76a('0x31')](db['Trigger'][_0xc76a('0x47')]);_0x1a62fb[_0xc76a('0x30')]=_[_0xc76a('0x31')](_0x1f26e0['query']);_0x1a62fb[_0xc76a('0x3a')]=_[_0xc76a('0x48')](_0x1a62fb[_0xc76a('0x2e')],_0x1a62fb['query']);_0x319fe3[_0xc76a('0x32')]=_['intersection'](_0x1a62fb[_0xc76a('0x2e')],qs[_0xc76a('0x33')](_0x1f26e0[_0xc76a('0x30')][_0xc76a('0x33')]));_0x319fe3['attributes']=_0x319fe3[_0xc76a('0x32')][_0xc76a('0x34')]?_0x319fe3[_0xc76a('0x32')]:_0x1a62fb[_0xc76a('0x2e')];if(_0x1f26e0[_0xc76a('0x30')][_0xc76a('0x42')]){_0x319fe3[_0xc76a('0x43')]=[{'all':!![]}];}_0x319fe3=_['merge']({},_0x319fe3,_0x1f26e0[_0xc76a('0x40')]);return db[_0xc76a('0x2b')]['find'](_0x319fe3)[_0xc76a('0x22')](handleEntityNotFound(_0x5bf2f2,null))[_0xc76a('0x22')](respondWithResult(_0x5bf2f2,null))[_0xc76a('0x49')](handleError(_0x5bf2f2,null));};exports[_0xc76a('0x4a')]=function(_0x3ae31f,_0x1f7c2a){return db[_0xc76a('0x2b')][_0xc76a('0x4a')](_0x3ae31f[_0xc76a('0x4b')],{})[_0xc76a('0x22')](function(_0x4ec2fd){var _0x5aeaa1=_0x3ae31f[_0xc76a('0x4c')][_0xc76a('0x24')]({'plain':!![]});if(!_0x5aeaa1)throw new Error(_0xc76a('0x4d'));if(_0x5aeaa1[_0xc76a('0x4e')]==='user'){var _0x18c81b=_0x4ec2fd[_0xc76a('0x24')]({'plain':!![]});var _0x17e7bc=_0xc76a('0x4f');return db[_0xc76a('0x50')]['find']({'where':{'name':_0x17e7bc,'userProfileId':_0x5aeaa1[_0xc76a('0x51')]},'raw':!![]})['then'](function(_0x52be96){if(_0x52be96&&_0x52be96[_0xc76a('0x52')]===0x0){return db[_0xc76a('0x25')][_0xc76a('0x4a')]({'name':_0x18c81b[_0xc76a('0x28')],'resourceId':_0x18c81b['id'],'type':_0x52be96[_0xc76a('0x28')],'sectionId':_0x52be96['id']},{})[_0xc76a('0x22')](function(){return _0x4ec2fd;});}else{return _0x4ec2fd;}})['catch'](function(_0x294c61){logger[_0xc76a('0x26')](_0xc76a('0x53'),_0x294c61);throw _0x294c61;});}return _0x4ec2fd;})[_0xc76a('0x22')](respondWithResult(_0x1f7c2a,0xc9))['catch'](handleError(_0x1f7c2a,null));};exports[_0xc76a('0x21')]=function(_0x178741,_0x5366fe){if(_0x178741['body']['id']){delete _0x178741[_0xc76a('0x4b')]['id'];}return db[_0xc76a('0x2b')]['find']({'where':{'id':_0x178741[_0xc76a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5366fe,null))[_0xc76a('0x22')](saveUpdates(_0x178741[_0xc76a('0x4b')],null))[_0xc76a('0x22')](respondWithResult(_0x5366fe,null))['catch'](handleError(_0x5366fe,null));};exports[_0xc76a('0x23')]=function(_0x32ec17,_0x9be381){return db[_0xc76a('0x2b')][_0xc76a('0x54')]({'where':{'id':_0x32ec17[_0xc76a('0x46')]['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x9be381,null))[_0xc76a('0x22')](removeEntity(_0x9be381,null))['catch'](handleError(_0x9be381,null));};exports[_0xc76a('0x55')]=function(_0x1cf5a3,_0x40f1f2,_0x46c332){if(_0x1cf5a3[_0xc76a('0x4b')]['id']){delete _0x1cf5a3['body']['id'];}return db[_0xc76a('0x2b')]['find']({'where':{'id':_0x1cf5a3[_0xc76a('0x46')]['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x40f1f2,null))[_0xc76a('0x22')](function(_0x5b7640){if(_0x5b7640){_0x1cf5a3['body'][_0xc76a('0x56')]=_0x5b7640['id'];return db[_0xc76a('0x57')]['create'](_0x1cf5a3[_0xc76a('0x4b')]);}})['then'](respondWithResult(_0x40f1f2,null))[_0xc76a('0x49')](handleError(_0x40f1f2,null));};exports[_0xc76a('0x58')]=function(_0x816206,_0x507faa,_0x42b4ce){if(_0x816206[_0xc76a('0x4b')]['id']){delete _0x816206[_0xc76a('0x4b')]['id'];}return db['Trigger'][_0xc76a('0x54')]({'where':{'id':_0x816206[_0xc76a('0x46')]['id']}})['then'](handleEntityNotFound(_0x507faa,null))['then'](function(_0x3ee161){if(_0x3ee161){_0x816206['body'][_0xc76a('0x59')]=_0x3ee161['id'];return db[_0xc76a('0x57')][_0xc76a('0x4a')](_0x816206[_0xc76a('0x4b')]);}})[_0xc76a('0x22')](respondWithResult(_0x507faa,null))[_0xc76a('0x49')](handleError(_0x507faa,null));};exports[_0xc76a('0x5a')]=function(_0x4aa143,_0x3d6a90,_0x49d557){var _0x42bcbd={};var _0x40a0da={};var _0x6ca86a;var _0x282908;return db['Trigger'][_0xc76a('0x5b')]({'where':{'id':_0x4aa143[_0xc76a('0x46')]['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x3d6a90,null))[_0xc76a('0x22')](function(_0x947008){if(_0x947008){_0x6ca86a=_0x947008;_0x40a0da[_0xc76a('0x2e')]=_[_0xc76a('0x31')](db[_0xc76a('0x57')][_0xc76a('0x47')]);_0x40a0da[_0xc76a('0x30')]=_[_0xc76a('0x31')](_0x4aa143[_0xc76a('0x30')]);_0x40a0da['filters']=_[_0xc76a('0x48')](_0x40a0da[_0xc76a('0x2e')],_0x40a0da[_0xc76a('0x30')]);_0x42bcbd[_0xc76a('0x32')]=_[_0xc76a('0x48')](_0x40a0da['model'],qs[_0xc76a('0x33')](_0x4aa143[_0xc76a('0x30')][_0xc76a('0x33')]));_0x42bcbd[_0xc76a('0x32')]=_0x42bcbd['attributes']['length']?_0x42bcbd[_0xc76a('0x32')]:_0x40a0da[_0xc76a('0x2e')];_0x42bcbd[_0xc76a('0x37')]=qs[_0xc76a('0x38')](_0x4aa143['query'][_0xc76a('0x38')]);_0x42bcbd['where']=qs['filters'](_['pick'](_0x4aa143[_0xc76a('0x30')],_0x40a0da[_0xc76a('0x3a')]));if(_0x4aa143[_0xc76a('0x30')][_0xc76a('0x3c')]){_0x42bcbd[_0xc76a('0x39')]=_[_0xc76a('0x3f')](_0x42bcbd[_0xc76a('0x39')],{'$or':_[_0xc76a('0x2f')](_0x42bcbd[_0xc76a('0x32')],function(_0x4693d1){var _0x3f74fb={};_0x3f74fb[_0x4693d1]={'$like':'%'+_0x4aa143[_0xc76a('0x30')][_0xc76a('0x3c')]+'%'};return _0x3f74fb;})});}_0x42bcbd=_[_0xc76a('0x3f')]({},_0x42bcbd,_0x4aa143[_0xc76a('0x40')]);return _0x6ca86a[_0xc76a('0x5a')](_0x42bcbd);}})['then'](function(_0x17f8c4){if(_0x17f8c4){_0x282908=_0x17f8c4[_0xc76a('0x34')];if(!_0x4aa143[_0xc76a('0x30')]['hasOwnProperty']('nolimit')){_0x42bcbd[_0xc76a('0x1b')]=qs[_0xc76a('0x1b')](_0x4aa143[_0xc76a('0x30')][_0xc76a('0x1b')]);_0x42bcbd['offset']=qs[_0xc76a('0x1a')](_0x4aa143[_0xc76a('0x30')]['offset']);}return _0x6ca86a[_0xc76a('0x5a')](_0x42bcbd);}})[_0xc76a('0x22')](function(_0x4921ca){if(_0x4921ca){return _0x4921ca?{'count':_0x282908,'rows':_0x4921ca}:null;}})['then'](respondWithResult(_0x3d6a90,null))[_0xc76a('0x49')](handleError(_0x3d6a90,null));};exports[_0xc76a('0x5c')]=function(_0x32c78f,_0x44bc57,_0x24d9e6){var _0x3125f3={};var _0x5b2088={};var _0x4d70c3;var _0x332a3e;return db[_0xc76a('0x2b')][_0xc76a('0x5b')]({'where':{'id':_0x32c78f[_0xc76a('0x46')]['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x44bc57,null))['then'](function(_0x5a16cc){if(_0x5a16cc){_0x4d70c3=_0x5a16cc;_0x5b2088[_0xc76a('0x2e')]=_[_0xc76a('0x31')](db[_0xc76a('0x57')][_0xc76a('0x47')]);_0x5b2088[_0xc76a('0x30')]=_[_0xc76a('0x31')](_0x32c78f[_0xc76a('0x30')]);_0x5b2088[_0xc76a('0x3a')]=_[_0xc76a('0x48')](_0x5b2088['model'],_0x5b2088[_0xc76a('0x30')]);_0x3125f3['attributes']=_['intersection'](_0x5b2088['model'],qs[_0xc76a('0x33')](_0x32c78f['query']['fields']));_0x3125f3[_0xc76a('0x32')]=_0x3125f3[_0xc76a('0x32')]['length']?_0x3125f3['attributes']:_0x5b2088[_0xc76a('0x2e')];_0x3125f3[_0xc76a('0x37')]=qs[_0xc76a('0x38')](_0x32c78f['query'][_0xc76a('0x38')]);_0x3125f3[_0xc76a('0x39')]=qs['filters'](_[_0xc76a('0x3b')](_0x32c78f[_0xc76a('0x30')],_0x5b2088[_0xc76a('0x3a')]));if(_0x32c78f[_0xc76a('0x30')][_0xc76a('0x3c')]){_0x3125f3[_0xc76a('0x39')]=_[_0xc76a('0x3f')](_0x3125f3[_0xc76a('0x39')],{'$or':_[_0xc76a('0x2f')](_0x3125f3[_0xc76a('0x32')],function(_0x16edda){var _0x1edd29={};_0x1edd29[_0x16edda]={'$like':'%'+_0x32c78f['query']['filter']+'%'};return _0x1edd29;})});}_0x3125f3=_[_0xc76a('0x3f')]({},_0x3125f3,_0x32c78f['options']);return _0x4d70c3[_0xc76a('0x5c')](_0x3125f3);}})['then'](function(_0x1932f1){if(_0x1932f1){_0x332a3e=_0x1932f1[_0xc76a('0x34')];if(!_0x32c78f[_0xc76a('0x30')][_0xc76a('0x35')](_0xc76a('0x36'))){_0x3125f3[_0xc76a('0x1b')]=qs[_0xc76a('0x1b')](_0x32c78f[_0xc76a('0x30')][_0xc76a('0x1b')]);_0x3125f3[_0xc76a('0x1a')]=qs[_0xc76a('0x1a')](_0x32c78f['query'][_0xc76a('0x1a')]);}return _0x4d70c3[_0xc76a('0x5c')](_0x3125f3);}})['then'](function(_0x49b567){if(_0x49b567){return _0x49b567?{'count':_0x332a3e,'rows':_0x49b567}:null;}})[_0xc76a('0x22')](respondWithResult(_0x44bc57,null))[_0xc76a('0x49')](handleError(_0x44bc57,null));};exports[_0xc76a('0x5d')]=function(_0x831d07,_0x511dd5,_0x47129b){if(_0x831d07[_0xc76a('0x4b')]['id']){delete _0x831d07[_0xc76a('0x4b')]['id'];}return db[_0xc76a('0x2b')][_0xc76a('0x54')]({'where':{'id':_0x831d07[_0xc76a('0x46')]['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x511dd5,null))[_0xc76a('0x22')](function(_0x521844){if(_0x521844){_0x831d07['body'][_0xc76a('0x5e')]=_0x521844['id'];return db[_0xc76a('0x5f')][_0xc76a('0x4a')](_0x831d07[_0xc76a('0x4b')]);}})['then'](respondWithResult(_0x511dd5,null))[_0xc76a('0x49')](handleError(_0x511dd5,null));};exports['getActions']=function(_0x42d693,_0x4b1704,_0x5e6726){var _0x3a4b48={};var _0x411949={};var _0x1b6b99;var _0x23196b;return db['Trigger'][_0xc76a('0x5b')]({'where':{'id':_0x42d693['params']['id']}})[_0xc76a('0x22')](handleEntityNotFound(_0x4b1704,null))['then'](function(_0x58266d){if(_0x58266d){_0x1b6b99=_0x58266d;_0x411949['model']=_[_0xc76a('0x31')](db['Action'][_0xc76a('0x47')]);_0x411949[_0xc76a('0x30')]=_[_0xc76a('0x31')](_0x42d693[_0xc76a('0x30')]);_0x411949[_0xc76a('0x3a')]=_['intersection'](_0x411949[_0xc76a('0x2e')],_0x411949[_0xc76a('0x30')]);_0x3a4b48[_0xc76a('0x32')]=_[_0xc76a('0x48')](_0x411949['model'],qs[_0xc76a('0x33')](_0x42d693['query'][_0xc76a('0x33')]));_0x3a4b48['attributes']=_0x3a4b48[_0xc76a('0x32')][_0xc76a('0x34')]?_0x3a4b48[_0xc76a('0x32')]:_0x411949[_0xc76a('0x2e')];_0x3a4b48[_0xc76a('0x37')]=qs[_0xc76a('0x38')](_0x42d693[_0xc76a('0x30')][_0xc76a('0x38')]);_0x3a4b48['where']=qs[_0xc76a('0x3a')](_['pick'](_0x42d693[_0xc76a('0x30')],_0x411949['filters']));if(_0x42d693['query'][_0xc76a('0x3c')]){_0x3a4b48[_0xc76a('0x39')]=_['merge'](_0x3a4b48[_0xc76a('0x39')],{'$or':_['map'](_0x3a4b48[_0xc76a('0x32')],function(_0x81482f){var _0x4706a6={};_0x4706a6[_0x81482f]={'$like':'%'+_0x42d693['query'][_0xc76a('0x3c')]+'%'};return _0x4706a6;})});}_0x3a4b48=_[_0xc76a('0x3f')]({},_0x3a4b48,_0x42d693[_0xc76a('0x40')]);return _0x1b6b99['getActions'](_0x3a4b48);}})[_0xc76a('0x22')](function(_0x15dd9f){if(_0x15dd9f){_0x23196b=_0x15dd9f[_0xc76a('0x34')];if(!_0x42d693[_0xc76a('0x30')][_0xc76a('0x35')](_0xc76a('0x36'))){_0x3a4b48[_0xc76a('0x1b')]=qs['limit'](_0x42d693[_0xc76a('0x30')][_0xc76a('0x1b')]);_0x3a4b48[_0xc76a('0x1a')]=qs['offset'](_0x42d693[_0xc76a('0x30')]['offset']);}return _0x1b6b99[_0xc76a('0x60')](_0x3a4b48);}})['then'](function(_0x2851aa){if(_0x2851aa){return _0x2851aa?{'count':_0x23196b,'rows':_0x2851aa}:null;}})[_0xc76a('0x22')](respondWithResult(_0x4b1704,null))[_0xc76a('0x49')](handleError(_0x4b1704,null));}; \ No newline at end of file +var _0x0926=['model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','Trigger','findAll','rows','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','getActions','Action','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0x0926,0x1bc));var _0x6092=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x0926[_0x33155c];return _0x5becf7;};'use strict';var pdf=require(_0x6092('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6092('0x1'));var zipdir=require(_0x6092('0x2'));var jsonpatch=require(_0x6092('0x3'));var rp=require(_0x6092('0x4'));var moment=require(_0x6092('0x5'));var BPromise=require(_0x6092('0x6'));var Mustache=require(_0x6092('0x7'));var util=require(_0x6092('0x8'));var path=require('path');var sox=require(_0x6092('0x9'));var csv=require(_0x6092('0xa'));var ejs=require(_0x6092('0xb'));var fs=require('fs');var _=require(_0x6092('0xc'));var squel=require(_0x6092('0xd'));var crypto=require(_0x6092('0xe'));var jsforce=require(_0x6092('0xf'));var deskjs=require(_0x6092('0x10'));var toCsv=require(_0x6092('0xa'));var querystring=require(_0x6092('0x11'));var Papa=require(_0x6092('0x12'));var Redis=require(_0x6092('0x13'));var authService=require(_0x6092('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6092('0x15'));var hardwareService=require(_0x6092('0x16'));var logger=require(_0x6092('0x17'))(_0x6092('0x18'));var utils=require(_0x6092('0x19'));var config=require('../../config/environment');var db=require(_0x6092('0x1a'))['db'];function respondWithStatusCode(_0x279491,_0x2ec137){_0x2ec137=_0x2ec137||0xcc;return function(_0x49c05c){if(_0x49c05c){return _0x279491[_0x6092('0x1b')](_0x2ec137);}return _0x279491['status'](_0x2ec137)[_0x6092('0x1c')]();};}function respondWithResult(_0x3c4873,_0x2efe33){_0x2efe33=_0x2efe33||0xc8;return function(_0x2ca5bc){if(_0x2ca5bc){return _0x3c4873['status'](_0x2efe33)['json'](_0x2ca5bc);}};}function respondWithFilteredResult(_0x2f4489,_0x564465){return function(_0x1f0037){if(_0x1f0037){var _0x3237fc=_0x1f0037['count'],_0x31e85d=_0x564465[_0x6092('0x1d')],_0x831860=_0x564465['offset']+_0x564465[_0x6092('0x1e')],_0x3e336c;if(_0x831860>=_0x3237fc){_0x831860=_0x3237fc;_0x3e336c=0xc8;}else{_0x3e336c=0xce;}_0x2f4489[_0x6092('0x1f')](_0x3e336c);return _0x2f4489[_0x6092('0x20')](_0x6092('0x21'),_0x31e85d+'-'+_0x831860+'/'+_0x3237fc)[_0x6092('0x22')](_0x1f0037);}return null;};}function patchUpdates(_0x3ef445){return function(_0x347f3e){try{jsonpatch[_0x6092('0x23')](_0x347f3e,_0x3ef445,!![]);}catch(_0x5b91bc){return BPromise[_0x6092('0x24')](_0x5b91bc);}return _0x347f3e[_0x6092('0x25')]();};}function saveUpdates(_0x4a9a89,_0x4cf0a2){return function(_0x2c7b83){if(_0x2c7b83){return _0x2c7b83['update'](_0x4a9a89)[_0x6092('0x26')](function(_0x2bf1a5){return _0x2bf1a5;});}return null;};}function removeEntity(_0x8b47d7,_0x520181){return function(_0x4d6b73){if(_0x4d6b73){return _0x4d6b73['destroy']()[_0x6092('0x26')](function(){var _0x5c68d4=_0x4d6b73[_0x6092('0x27')]({'plain':!![]});var _0x47bb43='Triggers';return db[_0x6092('0x28')][_0x6092('0x29')]({'where':{'type':_0x47bb43,'resourceId':_0x5c68d4['id']}})[_0x6092('0x26')](function(){return _0x4d6b73;});})[_0x6092('0x26')](function(){_0x8b47d7[_0x6092('0x1f')](0xcc)[_0x6092('0x1c')]();});}};}function handleEntityNotFound(_0x3500d4,_0x2371b6){return function(_0x3519ea){if(!_0x3519ea){_0x3500d4[_0x6092('0x1b')](0x194);}return _0x3519ea;};}function handleError(_0x444c26,_0x29fd33){_0x29fd33=_0x29fd33||0x1f4;return function(_0x461951){logger[_0x6092('0x2a')](_0x461951[_0x6092('0x2b')]);if(_0x461951[_0x6092('0x2c')]){delete _0x461951['name'];}_0x444c26[_0x6092('0x1f')](_0x29fd33)[_0x6092('0x2d')](_0x461951);};}exports[_0x6092('0x2e')]=function(_0x565351,_0xfa3340){var _0x5899e2={},_0xc95b89={},_0x35f047={'count':0x0,'rows':[]};var _0x568330=_[_0x6092('0x2f')](db['Trigger'][_0x6092('0x30')],function(_0x2289d3){return{'name':_0x2289d3[_0x6092('0x31')],'type':_0x2289d3[_0x6092('0x32')]['key']};});_0xc95b89[_0x6092('0x33')]=_[_0x6092('0x2f')](_0x568330,_0x6092('0x2c'));_0xc95b89[_0x6092('0x34')]=_['keys'](_0x565351[_0x6092('0x34')]);_0xc95b89['filters']=_['intersection'](_0xc95b89['model'],_0xc95b89[_0x6092('0x34')]);_0x5899e2[_0x6092('0x35')]=_[_0x6092('0x36')](_0xc95b89[_0x6092('0x33')],qs[_0x6092('0x37')](_0x565351['query'][_0x6092('0x37')]));_0x5899e2[_0x6092('0x35')]=_0x5899e2['attributes'][_0x6092('0x38')]?_0x5899e2[_0x6092('0x35')]:_0xc95b89['model'];if(!_0x565351[_0x6092('0x34')][_0x6092('0x39')]('nolimit')){_0x5899e2[_0x6092('0x1e')]=qs[_0x6092('0x1e')](_0x565351[_0x6092('0x34')][_0x6092('0x1e')]);_0x5899e2[_0x6092('0x1d')]=qs[_0x6092('0x1d')](_0x565351[_0x6092('0x34')][_0x6092('0x1d')]);}_0x5899e2[_0x6092('0x3a')]=qs[_0x6092('0x3b')](_0x565351['query'][_0x6092('0x3b')]);_0x5899e2[_0x6092('0x3c')]=qs[_0x6092('0x3d')](_[_0x6092('0x3e')](_0x565351[_0x6092('0x34')],_0xc95b89[_0x6092('0x3d')]),_0x568330);if(_0x565351[_0x6092('0x34')][_0x6092('0x3f')]){_0x5899e2[_0x6092('0x3c')]=_[_0x6092('0x40')](_0x5899e2[_0x6092('0x3c')],{'$or':_['map'](_0x568330,function(_0x5eae6e){if(_0x5eae6e[_0x6092('0x32')]!==_0x6092('0x41')){var _0x48eb6d={};_0x48eb6d[_0x5eae6e['name']]={'$like':'%'+_0x565351[_0x6092('0x34')][_0x6092('0x3f')]+'%'};return _0x48eb6d;}})});}_0x5899e2=_[_0x6092('0x40')]({},_0x5899e2,_0x565351[_0x6092('0x42')]);var _0x547860={'where':_0x5899e2[_0x6092('0x3c')]};return db['Trigger'][_0x6092('0x43')](_0x547860)[_0x6092('0x26')](function(_0x1cb887){_0x35f047[_0x6092('0x43')]=_0x1cb887;if(_0x565351['query']['includeAll']){_0x5899e2[_0x6092('0x44')]=[{'all':!![]}];}return db[_0x6092('0x45')][_0x6092('0x46')](_0x5899e2);})[_0x6092('0x26')](function(_0xfd570e){_0x35f047[_0x6092('0x47')]=_0xfd570e;return _0x35f047;})[_0x6092('0x26')](respondWithFilteredResult(_0xfa3340,_0x5899e2))['catch'](handleError(_0xfa3340,null));};exports[_0x6092('0x48')]=function(_0x4d9b89,_0x4e38c0){var _0x459cd7={'raw':![],'where':{'id':_0x4d9b89[_0x6092('0x49')]['id']}},_0x4d703b={};_0x4d703b[_0x6092('0x33')]=_[_0x6092('0x4a')](db[_0x6092('0x45')]['rawAttributes']);_0x4d703b[_0x6092('0x34')]=_['keys'](_0x4d9b89['query']);_0x4d703b[_0x6092('0x3d')]=_[_0x6092('0x36')](_0x4d703b[_0x6092('0x33')],_0x4d703b[_0x6092('0x34')]);_0x459cd7[_0x6092('0x35')]=_[_0x6092('0x36')](_0x4d703b[_0x6092('0x33')],qs[_0x6092('0x37')](_0x4d9b89[_0x6092('0x34')]['fields']));_0x459cd7['attributes']=_0x459cd7['attributes'][_0x6092('0x38')]?_0x459cd7[_0x6092('0x35')]:_0x4d703b[_0x6092('0x33')];if(_0x4d9b89['query']['includeAll']){_0x459cd7[_0x6092('0x44')]=[{'all':!![]}];}_0x459cd7=_[_0x6092('0x40')]({},_0x459cd7,_0x4d9b89[_0x6092('0x42')]);return db['Trigger']['find'](_0x459cd7)[_0x6092('0x26')](handleEntityNotFound(_0x4e38c0,null))['then'](respondWithResult(_0x4e38c0,null))['catch'](handleError(_0x4e38c0,null));};exports[_0x6092('0x4b')]=function(_0x3e3323,_0x417a32){return db[_0x6092('0x45')][_0x6092('0x4b')](_0x3e3323['body'],{})[_0x6092('0x26')](function(_0x46a7d5){var _0x2022a9=_0x3e3323[_0x6092('0x4c')]['get']({'plain':!![]});if(!_0x2022a9)throw new Error(_0x6092('0x4d'));if(_0x2022a9[_0x6092('0x4e')]===_0x6092('0x4c')){var _0x4004a5=_0x46a7d5[_0x6092('0x27')]({'plain':!![]});var _0x5cd87c=_0x6092('0x4f');return db[_0x6092('0x50')][_0x6092('0x51')]({'where':{'name':_0x5cd87c,'userProfileId':_0x2022a9[_0x6092('0x52')]},'raw':!![]})[_0x6092('0x26')](function(_0x5026e0){if(_0x5026e0&&_0x5026e0['autoAssociation']===0x0){return db[_0x6092('0x28')]['create']({'name':_0x4004a5['name'],'resourceId':_0x4004a5['id'],'type':_0x5026e0[_0x6092('0x2c')],'sectionId':_0x5026e0['id']},{})['then'](function(){return _0x46a7d5;});}else{return _0x46a7d5;}})[_0x6092('0x53')](function(_0x4f2fb0){logger[_0x6092('0x2a')](_0x6092('0x54'),_0x4f2fb0);throw _0x4f2fb0;});}return _0x46a7d5;})[_0x6092('0x26')](respondWithResult(_0x417a32,0xc9))['catch'](handleError(_0x417a32,null));};exports[_0x6092('0x55')]=function(_0x515bb0,_0x22bf73){if(_0x515bb0['body']['id']){delete _0x515bb0[_0x6092('0x56')]['id'];}return db['Trigger'][_0x6092('0x51')]({'where':{'id':_0x515bb0['params']['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x22bf73,null))[_0x6092('0x26')](saveUpdates(_0x515bb0['body'],null))[_0x6092('0x26')](respondWithResult(_0x22bf73,null))[_0x6092('0x53')](handleError(_0x22bf73,null));};exports['destroy']=function(_0x29338e,_0x4d64f3){return db[_0x6092('0x45')][_0x6092('0x51')]({'where':{'id':_0x29338e[_0x6092('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d64f3,null))['then'](removeEntity(_0x4d64f3,null))[_0x6092('0x53')](handleError(_0x4d64f3,null));};exports[_0x6092('0x57')]=function(_0xc59519,_0x586897,_0x38de97){if(_0xc59519[_0x6092('0x56')]['id']){delete _0xc59519['body']['id'];}return db[_0x6092('0x45')]['find']({'where':{'id':_0xc59519[_0x6092('0x49')]['id']}})['then'](handleEntityNotFound(_0x586897,null))[_0x6092('0x26')](function(_0x52044c){if(_0x52044c){_0xc59519[_0x6092('0x56')][_0x6092('0x58')]=_0x52044c['id'];return db[_0x6092('0x59')]['create'](_0xc59519['body']);}})['then'](respondWithResult(_0x586897,null))['catch'](handleError(_0x586897,null));};exports[_0x6092('0x5a')]=function(_0x17e16d,_0x17470c,_0x3c1c7d){if(_0x17e16d[_0x6092('0x56')]['id']){delete _0x17e16d[_0x6092('0x56')]['id'];}return db['Trigger'][_0x6092('0x51')]({'where':{'id':_0x17e16d[_0x6092('0x49')]['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x17470c,null))['then'](function(_0x1bdd7c){if(_0x1bdd7c){_0x17e16d['body'][_0x6092('0x5b')]=_0x1bdd7c['id'];return db[_0x6092('0x59')]['create'](_0x17e16d[_0x6092('0x56')]);}})['then'](respondWithResult(_0x17470c,null))[_0x6092('0x53')](handleError(_0x17470c,null));};exports[_0x6092('0x5c')]=function(_0x480dc4,_0x429bf9,_0x2ab5d1){var _0x3dbf3b={};var _0x38df45={};var _0x239da4;var _0x58ef8c;return db['Trigger'][_0x6092('0x5d')]({'where':{'id':_0x480dc4['params']['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x429bf9,null))[_0x6092('0x26')](function(_0x5f0776){if(_0x5f0776){_0x239da4=_0x5f0776;_0x38df45['model']=_[_0x6092('0x4a')](db[_0x6092('0x59')][_0x6092('0x30')]);_0x38df45['query']=_['keys'](_0x480dc4[_0x6092('0x34')]);_0x38df45['filters']=_[_0x6092('0x36')](_0x38df45[_0x6092('0x33')],_0x38df45[_0x6092('0x34')]);_0x3dbf3b[_0x6092('0x35')]=_[_0x6092('0x36')](_0x38df45[_0x6092('0x33')],qs[_0x6092('0x37')](_0x480dc4[_0x6092('0x34')]['fields']));_0x3dbf3b[_0x6092('0x35')]=_0x3dbf3b[_0x6092('0x35')][_0x6092('0x38')]?_0x3dbf3b[_0x6092('0x35')]:_0x38df45[_0x6092('0x33')];_0x3dbf3b[_0x6092('0x3a')]=qs[_0x6092('0x3b')](_0x480dc4[_0x6092('0x34')][_0x6092('0x3b')]);_0x3dbf3b[_0x6092('0x3c')]=qs[_0x6092('0x3d')](_[_0x6092('0x3e')](_0x480dc4['query'],_0x38df45[_0x6092('0x3d')]));if(_0x480dc4[_0x6092('0x34')][_0x6092('0x3f')]){_0x3dbf3b[_0x6092('0x3c')]=_['merge'](_0x3dbf3b[_0x6092('0x3c')],{'$or':_['map'](_0x3dbf3b[_0x6092('0x35')],function(_0x7c7628){var _0x348d73={};_0x348d73[_0x7c7628]={'$like':'%'+_0x480dc4[_0x6092('0x34')][_0x6092('0x3f')]+'%'};return _0x348d73;})});}_0x3dbf3b=_[_0x6092('0x40')]({},_0x3dbf3b,_0x480dc4['options']);return _0x239da4[_0x6092('0x5c')](_0x3dbf3b);}})[_0x6092('0x26')](function(_0x5def67){if(_0x5def67){_0x58ef8c=_0x5def67[_0x6092('0x38')];if(!_0x480dc4[_0x6092('0x34')]['hasOwnProperty'](_0x6092('0x5e'))){_0x3dbf3b[_0x6092('0x1e')]=qs[_0x6092('0x1e')](_0x480dc4[_0x6092('0x34')][_0x6092('0x1e')]);_0x3dbf3b[_0x6092('0x1d')]=qs['offset'](_0x480dc4['query'][_0x6092('0x1d')]);}return _0x239da4[_0x6092('0x5c')](_0x3dbf3b);}})[_0x6092('0x26')](function(_0xc8d552){if(_0xc8d552){return _0xc8d552?{'count':_0x58ef8c,'rows':_0xc8d552}:null;}})['then'](respondWithResult(_0x429bf9,null))[_0x6092('0x53')](handleError(_0x429bf9,null));};exports[_0x6092('0x5f')]=function(_0x2c0879,_0x1cd414,_0xe7873c){var _0x13bc29={};var _0x2477bd={};var _0x3ac4c6;var _0x2c3d47;return db[_0x6092('0x45')][_0x6092('0x5d')]({'where':{'id':_0x2c0879[_0x6092('0x49')]['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x1cd414,null))[_0x6092('0x26')](function(_0x23bd4e){if(_0x23bd4e){_0x3ac4c6=_0x23bd4e;_0x2477bd[_0x6092('0x33')]=_[_0x6092('0x4a')](db[_0x6092('0x59')][_0x6092('0x30')]);_0x2477bd[_0x6092('0x34')]=_[_0x6092('0x4a')](_0x2c0879[_0x6092('0x34')]);_0x2477bd[_0x6092('0x3d')]=_[_0x6092('0x36')](_0x2477bd[_0x6092('0x33')],_0x2477bd[_0x6092('0x34')]);_0x13bc29['attributes']=_['intersection'](_0x2477bd['model'],qs[_0x6092('0x37')](_0x2c0879[_0x6092('0x34')][_0x6092('0x37')]));_0x13bc29[_0x6092('0x35')]=_0x13bc29[_0x6092('0x35')][_0x6092('0x38')]?_0x13bc29[_0x6092('0x35')]:_0x2477bd[_0x6092('0x33')];_0x13bc29[_0x6092('0x3a')]=qs['sort'](_0x2c0879['query'][_0x6092('0x3b')]);_0x13bc29['where']=qs['filters'](_[_0x6092('0x3e')](_0x2c0879['query'],_0x2477bd[_0x6092('0x3d')]));if(_0x2c0879[_0x6092('0x34')][_0x6092('0x3f')]){_0x13bc29[_0x6092('0x3c')]=_[_0x6092('0x40')](_0x13bc29[_0x6092('0x3c')],{'$or':_[_0x6092('0x2f')](_0x13bc29['attributes'],function(_0x432ece){var _0x5f240c={};_0x5f240c[_0x432ece]={'$like':'%'+_0x2c0879[_0x6092('0x34')][_0x6092('0x3f')]+'%'};return _0x5f240c;})});}_0x13bc29=_[_0x6092('0x40')]({},_0x13bc29,_0x2c0879[_0x6092('0x42')]);return _0x3ac4c6[_0x6092('0x5f')](_0x13bc29);}})[_0x6092('0x26')](function(_0x75a8e3){if(_0x75a8e3){_0x2c3d47=_0x75a8e3['length'];if(!_0x2c0879[_0x6092('0x34')][_0x6092('0x39')](_0x6092('0x5e'))){_0x13bc29[_0x6092('0x1e')]=qs['limit'](_0x2c0879[_0x6092('0x34')][_0x6092('0x1e')]);_0x13bc29[_0x6092('0x1d')]=qs[_0x6092('0x1d')](_0x2c0879[_0x6092('0x34')][_0x6092('0x1d')]);}return _0x3ac4c6[_0x6092('0x5f')](_0x13bc29);}})['then'](function(_0x63200e){if(_0x63200e){return _0x63200e?{'count':_0x2c3d47,'rows':_0x63200e}:null;}})[_0x6092('0x26')](respondWithResult(_0x1cd414,null))[_0x6092('0x53')](handleError(_0x1cd414,null));};exports[_0x6092('0x60')]=function(_0x50be91,_0x60339d,_0x3f473c){if(_0x50be91['body']['id']){delete _0x50be91[_0x6092('0x56')]['id'];}return db[_0x6092('0x45')]['find']({'where':{'id':_0x50be91[_0x6092('0x49')]['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x60339d,null))[_0x6092('0x26')](function(_0x538553){if(_0x538553){_0x50be91[_0x6092('0x56')]['TriggerId']=_0x538553['id'];return db['Action']['create'](_0x50be91['body']);}})[_0x6092('0x26')](respondWithResult(_0x60339d,null))[_0x6092('0x53')](handleError(_0x60339d,null));};exports[_0x6092('0x61')]=function(_0x107f14,_0x4b3034,_0x537f8d){var _0x4c467d={};var _0x49d048={};var _0x37da38;var _0x3f6f98;return db[_0x6092('0x45')]['findOne']({'where':{'id':_0x107f14[_0x6092('0x49')]['id']}})[_0x6092('0x26')](handleEntityNotFound(_0x4b3034,null))[_0x6092('0x26')](function(_0x56d98b){if(_0x56d98b){_0x37da38=_0x56d98b;_0x49d048['model']=_[_0x6092('0x4a')](db[_0x6092('0x62')]['rawAttributes']);_0x49d048[_0x6092('0x34')]=_[_0x6092('0x4a')](_0x107f14[_0x6092('0x34')]);_0x49d048['filters']=_[_0x6092('0x36')](_0x49d048[_0x6092('0x33')],_0x49d048[_0x6092('0x34')]);_0x4c467d[_0x6092('0x35')]=_[_0x6092('0x36')](_0x49d048['model'],qs[_0x6092('0x37')](_0x107f14[_0x6092('0x34')][_0x6092('0x37')]));_0x4c467d[_0x6092('0x35')]=_0x4c467d[_0x6092('0x35')][_0x6092('0x38')]?_0x4c467d[_0x6092('0x35')]:_0x49d048[_0x6092('0x33')];_0x4c467d[_0x6092('0x3a')]=qs[_0x6092('0x3b')](_0x107f14['query'][_0x6092('0x3b')]);_0x4c467d[_0x6092('0x3c')]=qs[_0x6092('0x3d')](_['pick'](_0x107f14[_0x6092('0x34')],_0x49d048[_0x6092('0x3d')]));if(_0x107f14[_0x6092('0x34')][_0x6092('0x3f')]){_0x4c467d['where']=_[_0x6092('0x40')](_0x4c467d[_0x6092('0x3c')],{'$or':_[_0x6092('0x2f')](_0x4c467d[_0x6092('0x35')],function(_0x43b853){var _0xa39884={};_0xa39884[_0x43b853]={'$like':'%'+_0x107f14[_0x6092('0x34')][_0x6092('0x3f')]+'%'};return _0xa39884;})});}_0x4c467d=_[_0x6092('0x40')]({},_0x4c467d,_0x107f14['options']);return _0x37da38[_0x6092('0x61')](_0x4c467d);}})[_0x6092('0x26')](function(_0x4c0b10){if(_0x4c0b10){_0x3f6f98=_0x4c0b10['length'];if(!_0x107f14[_0x6092('0x34')][_0x6092('0x39')](_0x6092('0x5e'))){_0x4c467d[_0x6092('0x1e')]=qs['limit'](_0x107f14[_0x6092('0x34')]['limit']);_0x4c467d[_0x6092('0x1d')]=qs[_0x6092('0x1d')](_0x107f14[_0x6092('0x34')][_0x6092('0x1d')]);}return _0x37da38[_0x6092('0x61')](_0x4c467d);}})[_0x6092('0x26')](function(_0x2bd180){if(_0x2bd180){return _0x2bd180?{'count':_0x3f6f98,'rows':_0x2bd180}:null;}})['then'](respondWithResult(_0x4b3034,null))[_0x6092('0x53')](handleError(_0x4b3034,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e6993d3..ed258af 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x173d00,_0x1fd777){var _0x20a409=function(_0x2c2c7b){while(--_0x2c2c7b){_0x173d00['push'](_0x173d00['shift']());}};_0x20a409(++_0x1fd777);}(_0xdb28,0x106));var _0x8db2=function(_0x57a8f3,_0x1d0a3f){_0x57a8f3=_0x57a8f3-0x0;var _0x3cbba2=_0xdb28[_0x57a8f3];return _0x3cbba2;};'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('./trigger.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','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 23b4147..6b476ff 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 _0x36ee=['message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','find','ShowTrigger','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xcbc3aa,_0x56c70a){var _0x349f89=function(_0x3a5f30){while(--_0x3a5f30){_0xcbc3aa['push'](_0xcbc3aa['shift']());}};_0x349f89(++_0x56c70a);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('Trigger,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('Trigger,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')]({'raw':_0x2184ae['options']?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'limit':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')]['limit']||null:null,'include':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x2184ae[_0xe36e('0x1b')]['include'],function(_0x598a7a){return{'model':db[_0x598a7a[_0xe36e('0x21')]],'as':_0x598a7a['as'],'attributes':_0x598a7a[_0xe36e('0x1e')],'include':_0x598a7a[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x598a7a[_0xe36e('0x1f')],function(_0x1507f9){return{'model':db[_0x1507f9[_0xe36e('0x21')]],'as':_0x1507f9['as'],'attributes':_0x1507f9['attributes'],'include':_0x1507f9[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x1507f9[_0xe36e('0x1f')],function(_0x262caa){return{'model':db[_0x262caa['model']],'as':_0x262caa['as'],'attributes':_0x262caa[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf7b02e){logger['info'](_0xe36e('0x18'),_0x2184ae);logger['debug'](_0xe36e('0x18'),_0x2184ae,JSON['stringify'](_0xf7b02e));_0x21d9a3(_0xf7b02e);})[_0xe36e('0x17')](function(_0x59548b){logger['error']('GetTrigger',_0x59548b['message'],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0x59548b[_0xe36e('0x14')]));});});};exports['ShowTrigger']=function(_0x4ac819){var _0x1fa1ec=this;return new Promise(function(_0xb8d44e,_0x259e19){return db[_0xe36e('0x19')][_0xe36e('0x22')]({'raw':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'include':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')],function(_0xf808f5){return{'model':db[_0xf808f5['model']],'as':_0xf808f5['as'],'attributes':_0xf808f5[_0xe36e('0x1e')],'include':_0xf808f5['include']?_['map'](_0xf808f5[_0xe36e('0x1f')],function(_0x4f620d){return{'model':db[_0x4f620d[_0xe36e('0x21')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0xe36e('0x1e')],'include':_0x4f620d[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4f620d['include'],function(_0x56135c){return{'model':db[_0x56135c[_0xe36e('0x21')]],'as':_0x56135c['as'],'attributes':_0x56135c[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe36e('0xc')](function(_0x243338){logger['info'](_0xe36e('0x23'),_0x4ac819);logger[_0xe36e('0xe')](_0xe36e('0x23'),_0x4ac819,JSON['stringify'](_0x243338));_0xb8d44e(_0x243338);})[_0xe36e('0x17')](function(_0x2ff8f4){logger['error'](_0xe36e('0x23'),_0x2ff8f4[_0xe36e('0x14')],_0x4ac819);_0x259e19(_0x1fa1ec[_0xe36e('0x12')](0x1f4,_0x2ff8f4[_0xe36e('0x14')]));});});}; \ No newline at end of file +var _0x80ed=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetTrigger','Trigger','find','raw','debug','ShowTrigger','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x80ed,0x11c));var _0xd80e=function(_0x549608,_0x461b2c){_0x549608=_0x549608-0x0;var _0x2439b0=_0x80ed[_0x549608];return _0x2439b0;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetTrigger']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['Trigger'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowTrigger']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowTrigger',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowTrigger',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a2b5e0a..94b30e1 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['show','post','clone','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x1fccb3,_0x4ebbbb){var _0x465f5f=function(_0x55d5f2){while(--_0x55d5f2){_0x1fccb3['push'](_0x1fccb3['shift']());}};_0x465f5f(++_0x4ebbbb);}(_0x55ca,0x126));var _0xa55c=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x55ca[_0x51674a];return _0x13fca6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/:id/clone',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xe')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);module[_0xa55c('0x12')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1a1ec7,_0x2c9cc1){var _0x55650a=function(_0x469410){while(--_0x469410){_0x1a1ec7['push'](_0x1a1ec7['shift']());}};_0x55650a(++_0x2c9cc1);}(_0x008c,0x188));var _0xc008=function(_0x2287df,_0x5a4a24){_0x2287df=_0x2287df-0x0;var _0x2afbc1=_0x008c[_0x2287df];return _0x2afbc1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['put']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['delete'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index feec118..6b66744 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 _0x43bc=['sequelize','STRING','name','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','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]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','pai','fingerprint','active','passive','actpass','dynamic','update,nonat','BOOLEAN'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x43bc,0x12c));var _0xc43b=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x43bc[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xc43b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc43b('0x1')],'allowNull':![],'unique':_0xc43b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc43b('0x3'),_0xc43b('0x4'),_0xc43b('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc43b('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x7'),_0xc43b('0x8'),_0xc43b('0x9'),'ALLOWED',_0xc43b('0xa'),_0xc43b('0xb'),_0xc43b('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xc43b('0x1')]},'permit':{'type':Sequelize[_0xc43b('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc43b('0x1')]},'remotesecret':{'type':Sequelize[_0xc43b('0x1')]},'transport':{'type':Sequelize[_0xc43b('0x1')],'defaultValue':_0xc43b('0xd'),'set':function(_0x2438dc){this[_0xc43b('0xe')]('transport',_0x2438dc?_0x2438dc[_0xc43b('0xf')](','):null);},'get':function(){return this[_0xc43b('0x10')]('transport')?this['getDataValue'](_0xc43b('0x11'))[_0xc43b('0x12')](','):null;},'comment':_0xc43b('0x13')},'dtmfmode':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x14'),_0xc43b('0x15'),_0xc43b('0x16'),_0xc43b('0x17'),_0xc43b('0x18')),'defaultValue':_0xc43b('0x14')},'directmedia':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no','nonat',_0xc43b('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc43b('0x1')]},'directmediadeny':{'type':Sequelize[_0xc43b('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x6d549e){this[_0xc43b('0xe')](_0xc43b('0x1b'),_0x6d549e?_0x6d549e[_0xc43b('0xf')](','):null);},'get':function(){return this[_0xc43b('0x10')](_0xc43b('0x1b'))?this[_0xc43b('0x10')](_0xc43b('0x1b'))[_0xc43b('0x12')](','):null;},'comment':_0xc43b('0x1c')},'callgroup':{'type':Sequelize[_0xc43b('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc43b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xc43b('0x1d')},'allow':{'type':Sequelize[_0xc43b('0x1')],'allowNull':![],'defaultValue':_0xc43b('0x1e'),'set':function(_0x2d669a){this[_0xc43b('0xe')](_0xc43b('0x1f'),_0x2d669a?_0x2d669a[_0xc43b('0xf')](';'):_0xc43b('0x1e'));},'get':function(){return this[_0xc43b('0x10')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0xc43b('0x20')},'autoframing':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'insecure':{'type':Sequelize[_0xc43b('0x1')],'defaultValue':'port,invite','set':function(_0x54f5b9){this[_0xc43b('0xe')]('insecure',_0x54f5b9?_0x54f5b9['join'](','):null);},'get':function(){return this[_0xc43b('0x10')](_0xc43b('0x21'))?this[_0xc43b('0x10')](_0xc43b('0x21'))[_0xc43b('0x12')](','):null;},'comment':_0xc43b('0x22')},'trustrpid':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc43b('0x6')]('yes','no',_0xc43b('0x23'))},'promiscredir':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xc43b('0x19'),'no')},'accountcode':{'type':Sequelize[_0xc43b('0x24')](0xb)},'setvar':{'type':Sequelize[_0xc43b('0x1')]},'callerid':{'type':Sequelize[_0xc43b('0x1')],'defaultValue':_0xc43b('0x25')},'amaflags':{'type':Sequelize[_0xc43b('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc43b('0x19'),'no'),'defaultValue':_0xc43b('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xc43b('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc43b('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no',_0xc43b('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc43b('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'mailbox':{'type':Sequelize[_0xc43b('0x1')]},'session_timers':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x27'),_0xc43b('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xc43b('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xc43b('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xc43b('0x6')]('uac',_0xc43b('0x29')),'defaultValue':_0xc43b('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xc43b('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xc43b('0x1')]},'fromuser':{'type':Sequelize[_0xc43b('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':_0xc43b('0x19')},'keepalive':{'type':Sequelize[_0xc43b('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xc43b('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc43b('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc43b('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc43b('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xc43b('0x6')]('yes','no',_0xc43b('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc43b('0x1')]},'callbackextension':{'type':Sequelize[_0xc43b('0x1')]},'timert1':{'type':Sequelize[_0xc43b('0x24')](0xb)},'timerb':{'type':Sequelize[_0xc43b('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xc43b('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xc43b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc43b('0x1')]},'use_q850_reason':{'type':Sequelize[_0xc43b('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'force_avp':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'icesupport':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xc43b('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc43b('0x6')]('yes','no',_0xc43b('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xc43b('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc43b('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc43b('0x1')]},'dtlscipher':{'type':Sequelize[_0xc43b('0x1')]},'dtlscafile':{'type':Sequelize[_0xc43b('0x1')]},'dtlscapath':{'type':Sequelize[_0xc43b('0x1')]},'dtlssetup':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x2c'),_0xc43b('0x2d'),_0xc43b('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc43b('0x1')]},'recordofffeature':{'type':Sequelize[_0xc43b('0x1')]},'call_limit':{'type':Sequelize[_0xc43b('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc43b('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xc43b('0x6')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xc43b('0x1')]},'mohsuggest':{'type':Sequelize[_0xc43b('0x1')]},'parkinglot':{'type':Sequelize[_0xc43b('0x1')]},'description':{'type':Sequelize[_0xc43b('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xc43b('0x2f')},'canreinvite':{'type':Sequelize[_0xc43b('0x6')](_0xc43b('0x19'),'no','nonat',_0xc43b('0x1a'),_0xc43b('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc43b('0x1')]},'otherFields':{'type':Sequelize[_0xc43b('0x1')]},'active':{'type':Sequelize[_0xc43b('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc43b('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc8bb=['ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','setDataValue','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','user','peer','friend','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN'];(function(_0x5b1537,_0x42d705){var _0xc46a1c=function(_0x5ebe3f){while(--_0x5ebe3f){_0x5b1537['push'](_0x5b1537['shift']());}};_0xc46a1c(++_0x42d705);}(_0xc8bb,0x138));var _0xbc8b=function(_0x1ab065,_0x9db343){_0x1ab065=_0x1ab065-0x0;var _0x4c5d96=_0xc8bb[_0x1ab065];return _0x4c5d96;};'use strict';var Sequelize=require(_0xbc8b('0x0'));module[_0xbc8b('0x1')]={'name':{'type':Sequelize[_0xbc8b('0x2')],'allowNull':![],'unique':_0xbc8b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xbc8b('0x4'),_0xbc8b('0x5')),'allowNull':![],'defaultValue':_0xbc8b('0x6')},'context':{'type':Sequelize[_0xbc8b('0x2')],'allowNull':![],'defaultValue':_0xbc8b('0x7')},'callingpres':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x9'),_0xbc8b('0xa'),_0xbc8b('0xb'),_0xbc8b('0xc'),_0xbc8b('0xd'),_0xbc8b('0xe'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xbc8b('0x2')]},'md5secret':{'type':Sequelize[_0xbc8b('0x2')]},'remotesecret':{'type':Sequelize[_0xbc8b('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xbc8b('0xf'),'set':function(_0x3ad8e7){this['setDataValue'](_0xbc8b('0x10'),_0x3ad8e7?_0x3ad8e7[_0xbc8b('0x11')](','):null);},'get':function(){return this[_0xbc8b('0x12')](_0xbc8b('0x10'))?this[_0xbc8b('0x12')](_0xbc8b('0x10'))['split'](','):null;},'comment':_0xbc8b('0x13')},'dtmfmode':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x14'),_0xbc8b('0x15'),_0xbc8b('0x16'),_0xbc8b('0x17'),_0xbc8b('0x18')),'defaultValue':_0xbc8b('0x14')},'directmedia':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no',_0xbc8b('0x1a'),_0xbc8b('0x1b'),_0xbc8b('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xbc8b('0x2')]},'nat':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':_0xbc8b('0x1d'),'set':function(_0x2fd962){this['setDataValue'](_0xbc8b('0x1e'),_0x2fd962?_0x2fd962['join'](','):null);},'get':function(){return this[_0xbc8b('0x12')]('nat')?this[_0xbc8b('0x12')](_0xbc8b('0x1e'))[_0xbc8b('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xbc8b('0x2')]},'namedcallgroup':{'type':Sequelize[_0xbc8b('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbc8b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xbc8b('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x350fce){this[_0xbc8b('0x20')]('allow',_0x350fce?_0x350fce[_0xbc8b('0x11')](';'):_0xbc8b('0x21'));},'get':function(){return this['getDataValue'](_0xbc8b('0x22'))?this[_0xbc8b('0x12')](_0xbc8b('0x22'))[_0xbc8b('0x1f')](';'):null;},'comment':_0xbc8b('0x23')},'autoframing':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xbc8b('0x24'),'set':function(_0xe0e613){this[_0xbc8b('0x20')](_0xbc8b('0x25'),_0xe0e613?_0xe0e613['join'](','):null);},'get':function(){return this[_0xbc8b('0x12')](_0xbc8b('0x25'))?this[_0xbc8b('0x12')]('insecure')[_0xbc8b('0x1f')](','):null;},'comment':_0xbc8b('0x26')},'trustrpid':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbc8b('0x8')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xbc8b('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0xbc8b('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'accountcode':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'setvar':{'type':Sequelize[_0xbc8b('0x2')]},'callerid':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xbc8b('0x2')]},'callcounter':{'type':Sequelize[_0xbc8b('0x8')]('yes','no'),'defaultValue':_0xbc8b('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xbc8b('0x19'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xbc8b('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xbc8b('0x8')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xbc8b('0x2')]},'template':{'type':Sequelize[_0xbc8b('0x2')]},'videosupport':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no',_0xbc8b('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbc8b('0x8')]('yes','no')},'mailbox':{'type':Sequelize[_0xbc8b('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xbc8b('0x2a'),_0xbc8b('0x2b'),_0xbc8b('0x2c'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xbc8b('0x8')]('uac',_0xbc8b('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xbc8b('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xbc8b('0x2')]},'port':{'type':Sequelize[_0xbc8b('0x28')](0x5)},'qualify':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no'),'defaultValue':_0xbc8b('0x19')},'keepalive':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xbc8b('0x2')]},'defaultuser':{'type':Sequelize[_0xbc8b('0x2')]},'rtptimeout':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xbc8b('0x19'),'no',_0xbc8b('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbc8b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'timerb':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xbc8b('0x2')]},'contactdeny':{'type':Sequelize[_0xbc8b('0x2')]},'contactacl':{'type':Sequelize[_0xbc8b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbc8b('0x2')]},'use_q850_reason':{'type':Sequelize[_0xbc8b('0x2')]},'maxforwards':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xbc8b('0x2f'),_0xbc8b('0x30'))},'dtlsrekey':{'type':Sequelize[_0xbc8b('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbc8b('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xbc8b('0x2')]},'dtlscipher':{'type':Sequelize[_0xbc8b('0x2')]},'dtlscafile':{'type':Sequelize[_0xbc8b('0x2')]},'dtlscapath':{'type':Sequelize[_0xbc8b('0x2')]},'dtlssetup':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x31'),'passive',_0xbc8b('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbc8b('0x2')]},'usereqphone':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xbc8b('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no')},'vmexten':{'type':Sequelize[_0xbc8b('0x2')]},'mohinterpret':{'type':Sequelize[_0xbc8b('0x2')]},'mohsuggest':{'type':Sequelize[_0xbc8b('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbc8b('0x2')]},'host':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':_0xbc8b('0x33')},'canreinvite':{'type':Sequelize[_0xbc8b('0x8')](_0xbc8b('0x19'),'no','nonat',_0xbc8b('0x1b'),_0xbc8b('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xbc8b('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbc8b('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 7eaf4da..6f36f7e 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 _0xdd6e=['intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','clone','find','omit','createdAt','updatedAt','body','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','findAll','Reload','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','keys','filters'];(function(_0x3d17fb,_0x2aa8f2){var _0x5aa433=function(_0xd50c93){while(--_0xd50c93){_0x3d17fb['push'](_0x3d17fb['shift']());}};_0x5aa433(++_0x2aa8f2);}(_0xdd6e,0xa5));var _0xedd6=function(_0x1937d8,_0x8b5ec4){_0x1937d8=_0x1937d8-0x0;var _0x1bbdfb=_0xdd6e[_0x1937d8];return _0x1bbdfb;};'use strict';var pdf=require(_0xedd6('0x0'));var emlformat=require(_0xedd6('0x1'));var rimraf=require(_0xedd6('0x2'));var zipdir=require(_0xedd6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedd6('0x4'));var moment=require(_0xedd6('0x5'));var BPromise=require(_0xedd6('0x6'));var Mustache=require(_0xedd6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xedd6('0x8'));var ejs=require(_0xedd6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedd6('0xa'));var crypto=require(_0xedd6('0xb'));var jsforce=require(_0xedd6('0xc'));var deskjs=require(_0xedd6('0xd'));var toCsv=require(_0xedd6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xedd6('0xe'));var authService=require(_0xedd6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xedd6('0x10'));var hardwareService=require(_0xedd6('0x11'));var logger=require(_0xedd6('0x12'))(_0xedd6('0x13'));var utils=require('../../config/utils');var config=require(_0xedd6('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedd6('0x15'));var client=jayson[_0xedd6('0x16')][_0xedd6('0x17')]({'port':0x232a});function checkPasswordPattern(_0x339ab6,_0x56d5ee,_0x2112c8){if(_0x2112c8){var _0x2de87c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2de87c[_0xedd6('0x18')](_0x56d5ee)){return _0x339ab6;}else{throw new db[(_0xedd6('0x19'))][(_0xedd6('0x1a'))](_0xedd6('0x1b'));}}else{return _0x339ab6;}}function respondWithRpcPromise(_0x3c6c73,_0x40f6bd,_0xb7ddc6,_0x129bef){return new BPromise(function(_0x2d75f4,_0x40abb0){var _0x522eed=_0x129bef||client;return _0x522eed[_0xedd6('0x1c')](_0x3c6c73,_0xb7ddc6)[_0xedd6('0x1d')](function(_0x1c7808){logger[_0xedd6('0x1e')]('Trunk,\x20%s,\x20%s',_0x40f6bd,'request\x20sent');logger[_0xedd6('0x1f')]('Trunk,\x20%s,\x20%s,\x20%s',_0x40f6bd,_0xedd6('0x20'),JSON[_0xedd6('0x21')](_0x1c7808));if(_0x1c7808[_0xedd6('0x22')]){if(_0x1c7808[_0xedd6('0x22')][_0xedd6('0x23')]===0x1f4){logger[_0xedd6('0x22')](_0xedd6('0x24'),_0x40f6bd,_0x1c7808[_0xedd6('0x22')]['message']);return _0x40abb0(_0x1c7808[_0xedd6('0x22')][_0xedd6('0x25')]);}logger['error'](_0xedd6('0x24'),_0x40f6bd,_0x1c7808['error'][_0xedd6('0x25')]);return _0x2d75f4(_0x1c7808[_0xedd6('0x22')][_0xedd6('0x25')]);}else{logger['info'](_0xedd6('0x24'),_0x40f6bd,_0xedd6('0x20'));_0x2d75f4(_0x1c7808[_0xedd6('0x26')][_0xedd6('0x25')]);}})['catch'](function(_0x200b78){logger[_0xedd6('0x22')](_0xedd6('0x24'),_0x40f6bd,_0x200b78);_0x40abb0(_0x200b78);});});}function respondWithStatusCode(_0x11748d,_0x518e3f){_0x518e3f=_0x518e3f||0xcc;return function(_0x5968bf){if(_0x5968bf){return _0x11748d['sendStatus'](_0x518e3f);}return _0x11748d['status'](_0x518e3f)[_0xedd6('0x27')]();};}function respondWithResult(_0x449eea,_0x15140b){_0x15140b=_0x15140b||0xc8;return function(_0x1ccbd1){if(_0x1ccbd1){return _0x449eea[_0xedd6('0x28')](_0x15140b)[_0xedd6('0x29')](_0x1ccbd1);}};}function respondWithFilteredResult(_0x3bb0b1,_0xbcaf37){return function(_0x4f2ed4){if(_0x4f2ed4){var _0x40564e=_0x4f2ed4[_0xedd6('0x2a')],_0x25e146=_0xbcaf37[_0xedd6('0x2b')],_0x53cc63=_0xbcaf37[_0xedd6('0x2b')]+_0xbcaf37[_0xedd6('0x2c')],_0xc1730e;if(_0x53cc63>=_0x40564e){_0x53cc63=_0x40564e;_0xc1730e=0xc8;}else{_0xc1730e=0xce;}_0x3bb0b1[_0xedd6('0x28')](_0xc1730e);return _0x3bb0b1[_0xedd6('0x2d')](_0xedd6('0x2e'),_0x25e146+'-'+_0x53cc63+'/'+_0x40564e)[_0xedd6('0x29')](_0x4f2ed4);}return null;};}function patchUpdates(_0x856d12){return function(_0x3453e3){try{jsonpatch[_0xedd6('0x2f')](_0x3453e3,_0x856d12,!![]);}catch(_0x5a0e2a){return BPromise['reject'](_0x5a0e2a);}return _0x3453e3[_0xedd6('0x30')]();};}function saveUpdates(_0x2731f0,_0x17dea7){return function(_0x2ba70b){if(_0x2ba70b){return _0x2ba70b[_0xedd6('0x31')](_0x2731f0)[_0xedd6('0x1d')](function(_0x215edd){return _0x215edd;});}return null;};}function removeEntity(_0x3481de,_0x5213ed){return function(_0x457ad3){if(_0x457ad3){return _0x457ad3[_0xedd6('0x32')]()['then'](function(){var _0x3b76c8=_0x457ad3[_0xedd6('0x33')]({'plain':!![]});var _0x2fcbcb=_0xedd6('0x34');return db[_0xedd6('0x35')][_0xedd6('0x32')]({'where':{'type':_0x2fcbcb,'resourceId':_0x3b76c8['id']}})[_0xedd6('0x1d')](function(){return _0x457ad3;});})[_0xedd6('0x1d')](function(){_0x3481de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb14b,_0x97d808){return function(_0x18972c){if(!_0x18972c){_0x1eb14b[_0xedd6('0x36')](0x194);}return _0x18972c;};}function handleError(_0x4ff5a9,_0x315ea3){_0x315ea3=_0x315ea3||0x1f4;return function(_0x18f7d3){logger[_0xedd6('0x22')](_0x18f7d3[_0xedd6('0x37')]);if(_0x18f7d3[_0xedd6('0x38')]){delete _0x18f7d3[_0xedd6('0x38')];}_0x4ff5a9[_0xedd6('0x28')](_0x315ea3)[_0xedd6('0x39')](_0x18f7d3);};}exports[_0xedd6('0x3a')]=function(_0xef90bb,_0x5c110b){var _0x390370={},_0x10eb7d={},_0x3efd84={'count':0x0,'rows':[]};var _0x1130a6=_[_0xedd6('0x3b')](db[_0xedd6('0x3c')][_0xedd6('0x3d')],function(_0x4d5a19){return{'name':_0x4d5a19[_0xedd6('0x3e')],'type':_0x4d5a19[_0xedd6('0x3f')][_0xedd6('0x40')]};});_0x10eb7d['model']=_[_0xedd6('0x3b')](_0x1130a6,_0xedd6('0x38'));_0x10eb7d['query']=_[_0xedd6('0x41')](_0xef90bb['query']);_0x10eb7d[_0xedd6('0x42')]=_[_0xedd6('0x43')](_0x10eb7d[_0xedd6('0x44')],_0x10eb7d['query']);_0x390370[_0xedd6('0x45')]=_[_0xedd6('0x43')](_0x10eb7d[_0xedd6('0x44')],qs[_0xedd6('0x46')](_0xef90bb['query'][_0xedd6('0x46')]));_0x390370[_0xedd6('0x45')]=_0x390370[_0xedd6('0x45')][_0xedd6('0x47')]?_0x390370['attributes']:_0x10eb7d[_0xedd6('0x44')];if(!_0xef90bb[_0xedd6('0x48')][_0xedd6('0x49')](_0xedd6('0x4a'))){_0x390370['limit']=qs[_0xedd6('0x2c')](_0xef90bb[_0xedd6('0x48')][_0xedd6('0x2c')]);_0x390370['offset']=qs[_0xedd6('0x2b')](_0xef90bb[_0xedd6('0x48')][_0xedd6('0x2b')]);}_0x390370[_0xedd6('0x4b')]=qs[_0xedd6('0x4c')](_0xef90bb[_0xedd6('0x48')][_0xedd6('0x4c')]);_0x390370[_0xedd6('0x4d')]=qs[_0xedd6('0x42')](_[_0xedd6('0x4e')](_0xef90bb['query'],_0x10eb7d[_0xedd6('0x42')]),_0x1130a6);if(_0xef90bb[_0xedd6('0x48')][_0xedd6('0x4f')]){_0x390370[_0xedd6('0x4d')]=_['merge'](_0x390370[_0xedd6('0x4d')],{'$or':_['map'](_0x1130a6,function(_0x2c0daa){if(_0x2c0daa[_0xedd6('0x3f')]!=='VIRTUAL'){var _0x5ddebc={};_0x5ddebc[_0x2c0daa[_0xedd6('0x38')]]={'$like':'%'+_0xef90bb[_0xedd6('0x48')]['filter']+'%'};return _0x5ddebc;}})});}_0x390370=_[_0xedd6('0x50')]({},_0x390370,_0xef90bb[_0xedd6('0x51')]);var _0x36bc62={'where':_0x390370[_0xedd6('0x4d')]};return db[_0xedd6('0x3c')][_0xedd6('0x2a')](_0x36bc62)['then'](function(_0x5c8bc7){_0x3efd84[_0xedd6('0x2a')]=_0x5c8bc7;if(_0xef90bb['query']['includeAll']){_0x390370[_0xedd6('0x52')]=[{'all':!![]}];}return db[_0xedd6('0x3c')]['findAll'](_0x390370);})['then'](function(_0x530266){_0x3efd84[_0xedd6('0x53')]=_0x530266;return _0x3efd84;})[_0xedd6('0x1d')](respondWithFilteredResult(_0x5c110b,_0x390370))[_0xedd6('0x54')](handleError(_0x5c110b,null));};exports[_0xedd6('0x55')]=function(_0x4fe2e8,_0x557f41){var _0x2a41c2={'raw':![],'where':{'id':_0x4fe2e8[_0xedd6('0x56')]['id']}},_0x555cf2={};_0x555cf2['model']=_[_0xedd6('0x41')](db[_0xedd6('0x3c')]['rawAttributes']);_0x555cf2[_0xedd6('0x48')]=_['keys'](_0x4fe2e8[_0xedd6('0x48')]);_0x555cf2[_0xedd6('0x42')]=_[_0xedd6('0x43')](_0x555cf2[_0xedd6('0x44')],_0x555cf2[_0xedd6('0x48')]);_0x2a41c2[_0xedd6('0x45')]=_[_0xedd6('0x43')](_0x555cf2[_0xedd6('0x44')],qs[_0xedd6('0x46')](_0x4fe2e8[_0xedd6('0x48')]['fields']));_0x2a41c2['attributes']=_0x2a41c2['attributes'][_0xedd6('0x47')]?_0x2a41c2[_0xedd6('0x45')]:_0x555cf2[_0xedd6('0x44')];if(_0x4fe2e8[_0xedd6('0x48')][_0xedd6('0x57')]){_0x2a41c2[_0xedd6('0x52')]=[{'all':!![]}];}_0x2a41c2=_[_0xedd6('0x50')]({},_0x2a41c2,_0x4fe2e8[_0xedd6('0x51')]);return db['Trunk']['find'](_0x2a41c2)[_0xedd6('0x1d')](handleEntityNotFound(_0x557f41,null))['then'](respondWithResult(_0x557f41,null))[_0xedd6('0x54')](handleError(_0x557f41,null));};exports[_0xedd6('0x58')]=function(_0x93dc93,_0x237949){var _0x3e94e9={'where':{'id':_0x93dc93[_0xedd6('0x56')]['id']}},_0x576186={};_0x576186[_0xedd6('0x44')]=_['keys'](db[_0xedd6('0x3c')][_0xedd6('0x3d')]);_0x3e94e9[_0xedd6('0x45')]=_[_0xedd6('0x43')](_0x576186['model'],qs[_0xedd6('0x46')](_0x93dc93[_0xedd6('0x48')][_0xedd6('0x46')]));_0x3e94e9[_0xedd6('0x45')]=_0x3e94e9[_0xedd6('0x45')]['length']?_0x3e94e9[_0xedd6('0x45')]:_0x576186[_0xedd6('0x44')];if(_0x93dc93['query'][_0xedd6('0x57')]){_0x3e94e9[_0xedd6('0x52')]=[{'all':!![]}];}_0x3e94e9=_[_0xedd6('0x50')]({},_0x3e94e9,_0x93dc93['options']);return db[_0xedd6('0x3c')][_0xedd6('0x59')](_0x3e94e9)[_0xedd6('0x1d')](handleEntityNotFound(_0x237949,null))[_0xedd6('0x1d')](function(_0x39c652){if(_0x39c652){var _0x263123=_0x39c652[_0xedd6('0x33')]({'plain':!![]});_0x263123=qs[_0xedd6('0x5a')](_0x263123,['id',_0xedd6('0x5b'),_0xedd6('0x5c')]);_0x93dc93[_0xedd6('0x5d')]=_[_0xedd6('0x5a')](_0x93dc93['body'],['id',_0xedd6('0x5b'),_0xedd6('0x5c')]);return db[_0xedd6('0x3c')][_0xedd6('0x5e')](_['merge'](_0x263123,_0x93dc93[_0xedd6('0x5d')]),{'include':_0x93dc93[_0xedd6('0x48')][_0xedd6('0x57')]?[{'all':!![]}]:undefined})[_0xedd6('0x1d')](function(_0x4621e1){var _0x4308fa=_0x93dc93[_0xedd6('0x5f')][_0xedd6('0x33')]({'plain':!![]});if(!_0x4308fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4308fa['role']==='user'){var _0x4f8779=_0x4621e1[_0xedd6('0x33')]({'plain':!![]});var _0x2b64b7=_0xedd6('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x2b64b7,'userProfileId':_0x4308fa[_0xedd6('0x60')]},'raw':!![]})[_0xedd6('0x1d')](function(_0x3dfa86){if(_0x3dfa86&&_0x3dfa86['autoAssociation']===0x0){return db[_0xedd6('0x35')]['create']({'name':_0x4f8779[_0xedd6('0x38')],'resourceId':_0x4f8779['id'],'type':_0x3dfa86[_0xedd6('0x38')],'sectionId':_0x3dfa86['id']},{})[_0xedd6('0x1d')](function(){return _0x4621e1;});}else{return _0x4621e1;}})[_0xedd6('0x54')](function(_0x1a566d){logger[_0xedd6('0x22')](_0xedd6('0x61'),_0x1a566d);throw _0x1a566d;});}return _0x4621e1;});}})[_0xedd6('0x1d')](respondWithResult(_0x237949,0xc9))['catch'](handleError(_0x237949,null));};exports[_0xedd6('0x5e')]=function(_0x199865,_0x8068ca,_0x360bac){var _0xc9b0f0;return db[_0xedd6('0x3c')][_0xedd6('0x5e')](_0x199865['body'],{'raw':!![]})[_0xedd6('0x1d')](function(_0x1ed036){_0xc9b0f0=_0x1ed036;return db['Trunk']['findAll']({'raw':!![]});})[_0xedd6('0x1d')](function(_0x3bb3b8){var _0x4a5c52=fs[_0xedd6('0x62')](path[_0xedd6('0x63')](config[_0xedd6('0x64')],_0xedd6('0x65')),_0xedd6('0x66'));var _0x5741c9=fs[_0xedd6('0x62')](path[_0xedd6('0x63')](config[_0xedd6('0x64')],_0xedd6('0x67')),_0xedd6('0x66'));var _0x3ba74d=ejs[_0xedd6('0x68')](_0x4a5c52,{'trunks':_0x3bb3b8||[]});fs[_0xedd6('0x69')](_0xedd6('0x6a'),_0x3ba74d);if(_0xc9b0f0[_0xedd6('0x6b')]){var _0x1c7f7c=ejs[_0xedd6('0x68')](_0x5741c9,{'trunks':_0x3bb3b8||[]});fs[_0xedd6('0x69')](_0xedd6('0x6c'),_0x1c7f7c);}})[_0xedd6('0x1d')](function(){return respondWithRpcPromise('Reload',_0xedd6('0x5e'),{'module':_0xedd6('0x6d')});})[_0xedd6('0x1d')](function(){var _0xa45c46=_0x199865[_0xedd6('0x5f')][_0xedd6('0x33')]({'plain':!![]});if(!_0xa45c46)throw new Error(_0xedd6('0x6e'));if(_0xa45c46[_0xedd6('0x6f')]===_0xedd6('0x5f')){var _0x22429d=_0xc9b0f0[_0xedd6('0x33')]({'plain':!![]});return db[_0xedd6('0x70')][_0xedd6('0x59')]({'where':{'name':_0xedd6('0x34'),'userProfileId':_0xa45c46['userProfileId']},'raw':!![]})[_0xedd6('0x1d')](function(_0x56d7ff){if(_0x56d7ff&&_0x56d7ff[_0xedd6('0x71')]===0x0){return db[_0xedd6('0x35')][_0xedd6('0x5e')]({'name':_0x22429d[_0xedd6('0x38')],'resourceId':_0x22429d['id'],'type':_0x56d7ff[_0xedd6('0x38')],'sectionId':_0x56d7ff['id']},{})[_0xedd6('0x1d')](function(){return _0xc9b0f0;});}else{return _0xc9b0f0;}})[_0xedd6('0x54')](function(_0x48492a){logger[_0xedd6('0x22')](_0xedd6('0x61'),_0x48492a);throw _0x48492a;});}return _0xc9b0f0;})[_0xedd6('0x1d')](respondWithResult(_0x8068ca,0xc9))[_0xedd6('0x54')](handleError(_0x8068ca,null));};exports['update']=function(_0x3de6c2,_0x4edfb0,_0x5d1f15){var _0xd2e35d;return db[_0xedd6('0x3c')][_0xedd6('0x59')]({'where':{'id':_0x3de6c2[_0xedd6('0x56')]['id']}})[_0xedd6('0x1d')](handleEntityNotFound(_0x4edfb0,null))[_0xedd6('0x1d')](saveUpdates(_0x3de6c2[_0xedd6('0x5d')],null))[_0xedd6('0x1d')](function(_0x1da337){if(_0x1da337){_0xd2e35d=_0x1da337;return db['Trunk'][_0xedd6('0x72')]({'raw':!![]});}})[_0xedd6('0x1d')](function(_0x491b1b){if(_0x491b1b){var _0x15d3e9=fs['readFileSync'](path[_0xedd6('0x63')](config[_0xedd6('0x64')],_0xedd6('0x65')),'utf8');var _0x7eed73=fs[_0xedd6('0x62')](path[_0xedd6('0x63')](config[_0xedd6('0x64')],'server/files/templates/registry.ejs'),_0xedd6('0x66'));var _0xd90c2d=ejs[_0xedd6('0x68')](_0x15d3e9,{'trunks':_0x491b1b||[]});fs[_0xedd6('0x69')](_0xedd6('0x6a'),_0xd90c2d);var _0x51a875=ejs[_0xedd6('0x68')](_0x7eed73,{'trunks':_0x491b1b||[]});fs['writeFileSync'](_0xedd6('0x6c'),_0x51a875);return respondWithRpcPromise(_0xedd6('0x73'),'update',{'module':'chan_sip.so'});}return null;})[_0xedd6('0x1d')](function(_0x4212ef){if(_0x4212ef){return _0xd2e35d;}})[_0xedd6('0x1d')](respondWithResult(_0x4edfb0,null))['catch'](handleError(_0x4edfb0,null));};exports[_0xedd6('0x32')]=function(_0x6f935c,_0x37ee25,_0x2a8e4b){var _0x8c3c6;return db[_0xedd6('0x3c')][_0xedd6('0x59')]({'where':{'id':_0x6f935c['params']['id']}})['then'](handleEntityNotFound(_0x37ee25,null))[_0xedd6('0x1d')](removeEntity(_0x37ee25,null))[_0xedd6('0x1d')](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x4c3b9f){var _0x521012=fs[_0xedd6('0x62')](path[_0xedd6('0x63')](config[_0xedd6('0x64')],_0xedd6('0x65')),_0xedd6('0x66'));var _0x2b47c3=fs[_0xedd6('0x62')](path[_0xedd6('0x63')](config[_0xedd6('0x64')],_0xedd6('0x67')),_0xedd6('0x66'));var _0x2ed44d=ejs[_0xedd6('0x68')](_0x521012,{'trunks':_0x4c3b9f});var _0x6c5673=ejs['render'](_0x2b47c3,{'trunks':_0x4c3b9f});fs[_0xedd6('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x2ed44d);fs[_0xedd6('0x69')](_0xedd6('0x6c'),_0x6c5673);return respondWithRpcPromise(_0xedd6('0x73'),_0xedd6('0x32'),{'module':_0xedd6('0x6d')});})['catch'](handleError(_0x37ee25,null));}; \ No newline at end of file +var _0x3f72=['sendStatus','name','send','index','map','Trunk','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','clone','params','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../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','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource'];(function(_0x1704eb,_0x17d0bd){var _0x370a8d=function(_0xf58521){while(--_0xf58521){_0x1704eb['push'](_0x1704eb['shift']());}};_0x370a8d(++_0x17d0bd);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x23f7('0x0'));var emlformat=require(_0x23f7('0x1'));var rimraf=require(_0x23f7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23f7('0x3'));var moment=require(_0x23f7('0x4'));var BPromise=require(_0x23f7('0x5'));var Mustache=require(_0x23f7('0x6'));var util=require(_0x23f7('0x7'));var path=require('path');var sox=require(_0x23f7('0x8'));var csv=require('to-csv');var ejs=require(_0x23f7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23f7('0xa'));var crypto=require(_0x23f7('0xb'));var jsforce=require(_0x23f7('0xc'));var deskjs=require(_0x23f7('0xd'));var toCsv=require(_0x23f7('0xe'));var querystring=require(_0x23f7('0xf'));var Papa=require(_0x23f7('0x10'));var Redis=require(_0x23f7('0x11'));var authService=require(_0x23f7('0x12'));var qs=require(_0x23f7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f7('0x14'));var logger=require(_0x23f7('0x15'))(_0x23f7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x23f7('0x17'))['db'];var jayson=require(_0x23f7('0x18'));var client=jayson[_0x23f7('0x19')][_0x23f7('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x37510b,_0x5515f6,_0x416a12){if(_0x416a12){var _0x462af4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x462af4[_0x23f7('0x1b')](_0x5515f6)){return _0x37510b;}else{throw new db[(_0x23f7('0x1c'))]['ValidationError'](_0x23f7('0x1d'));}}else{return _0x37510b;}}function respondWithRpcPromise(_0x434484,_0x1c88ce,_0x2fab15,_0x15a35d){return new BPromise(function(_0x436512,_0x1d6122){var _0x4f7348=_0x15a35d||client;return _0x4f7348[_0x23f7('0x1e')](_0x434484,_0x2fab15)[_0x23f7('0x1f')](function(_0x4e125c){logger['info'](_0x23f7('0x20'),_0x1c88ce,_0x23f7('0x21'));logger[_0x23f7('0x22')](_0x23f7('0x23'),_0x1c88ce,_0x23f7('0x21'),JSON[_0x23f7('0x24')](_0x4e125c));if(_0x4e125c[_0x23f7('0x25')]){if(_0x4e125c[_0x23f7('0x25')]['code']===0x1f4){logger[_0x23f7('0x25')](_0x23f7('0x20'),_0x1c88ce,_0x4e125c[_0x23f7('0x25')]['message']);return _0x1d6122(_0x4e125c['error'][_0x23f7('0x26')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1c88ce,_0x4e125c[_0x23f7('0x25')][_0x23f7('0x26')]);return _0x436512(_0x4e125c['error'][_0x23f7('0x26')]);}else{logger[_0x23f7('0x27')]('Trunk,\x20%s,\x20%s',_0x1c88ce,_0x23f7('0x21'));_0x436512(_0x4e125c[_0x23f7('0x28')][_0x23f7('0x26')]);}})['catch'](function(_0x574472){logger[_0x23f7('0x25')](_0x23f7('0x20'),_0x1c88ce,_0x574472);_0x1d6122(_0x574472);});});}function respondWithStatusCode(_0x3dad05,_0x4861de){_0x4861de=_0x4861de||0xcc;return function(_0x26bdf6){if(_0x26bdf6){return _0x3dad05['sendStatus'](_0x4861de);}return _0x3dad05[_0x23f7('0x29')](_0x4861de)[_0x23f7('0x2a')]();};}function respondWithResult(_0x57d6e6,_0xfe525b){_0xfe525b=_0xfe525b||0xc8;return function(_0x2c69c5){if(_0x2c69c5){return _0x57d6e6[_0x23f7('0x29')](_0xfe525b)[_0x23f7('0x2b')](_0x2c69c5);}};}function respondWithFilteredResult(_0xf1fa9f,_0x58f5c6){return function(_0x3a69a){if(_0x3a69a){var _0x2422d2=_0x3a69a[_0x23f7('0x2c')],_0x310fa8=_0x58f5c6[_0x23f7('0x2d')],_0x45513e=_0x58f5c6[_0x23f7('0x2d')]+_0x58f5c6[_0x23f7('0x2e')],_0x4165ed;if(_0x45513e>=_0x2422d2){_0x45513e=_0x2422d2;_0x4165ed=0xc8;}else{_0x4165ed=0xce;}_0xf1fa9f[_0x23f7('0x29')](_0x4165ed);return _0xf1fa9f[_0x23f7('0x2f')](_0x23f7('0x30'),_0x310fa8+'-'+_0x45513e+'/'+_0x2422d2)['json'](_0x3a69a);}return null;};}function patchUpdates(_0x1dbb5e){return function(_0x1d4754){try{jsonpatch[_0x23f7('0x31')](_0x1d4754,_0x1dbb5e,!![]);}catch(_0x519705){return BPromise[_0x23f7('0x32')](_0x519705);}return _0x1d4754[_0x23f7('0x33')]();};}function saveUpdates(_0x2f8a2c,_0xff5c15){return function(_0x301818){if(_0x301818){return _0x301818[_0x23f7('0x34')](_0x2f8a2c)['then'](function(_0x1425e4){return _0x1425e4;});}return null;};}function removeEntity(_0x275f7d,_0xce1783){return function(_0x471767){if(_0x471767){return _0x471767[_0x23f7('0x35')]()[_0x23f7('0x1f')](function(){var _0x3bfb07=_0x471767[_0x23f7('0x36')]({'plain':!![]});var _0x5f37c7=_0x23f7('0x37');return db[_0x23f7('0x38')][_0x23f7('0x35')]({'where':{'type':_0x5f37c7,'resourceId':_0x3bfb07['id']}})[_0x23f7('0x1f')](function(){return _0x471767;});})['then'](function(){_0x275f7d['status'](0xcc)[_0x23f7('0x2a')]();});}};}function handleEntityNotFound(_0x5d9de4,_0x310cb0){return function(_0x46af4e){if(!_0x46af4e){_0x5d9de4[_0x23f7('0x39')](0x194);}return _0x46af4e;};}function handleError(_0xf1b093,_0x55330a){_0x55330a=_0x55330a||0x1f4;return function(_0x535f8a){logger[_0x23f7('0x25')](_0x535f8a['stack']);if(_0x535f8a['name']){delete _0x535f8a[_0x23f7('0x3a')];}_0xf1b093[_0x23f7('0x29')](_0x55330a)[_0x23f7('0x3b')](_0x535f8a);};}exports[_0x23f7('0x3c')]=function(_0x41b0cc,_0x321d80){var _0x36a8db={},_0x2ea06d={},_0x566ea2={'count':0x0,'rows':[]};var _0x2cbbac=_[_0x23f7('0x3d')](db[_0x23f7('0x3e')][_0x23f7('0x3f')],function(_0x2deda2){return{'name':_0x2deda2[_0x23f7('0x40')],'type':_0x2deda2['type']['key']};});_0x2ea06d[_0x23f7('0x41')]=_[_0x23f7('0x3d')](_0x2cbbac,_0x23f7('0x3a'));_0x2ea06d[_0x23f7('0x42')]=_[_0x23f7('0x43')](_0x41b0cc[_0x23f7('0x42')]);_0x2ea06d['filters']=_[_0x23f7('0x44')](_0x2ea06d[_0x23f7('0x41')],_0x2ea06d[_0x23f7('0x42')]);_0x36a8db[_0x23f7('0x45')]=_[_0x23f7('0x44')](_0x2ea06d[_0x23f7('0x41')],qs[_0x23f7('0x46')](_0x41b0cc[_0x23f7('0x42')]['fields']));_0x36a8db['attributes']=_0x36a8db['attributes'][_0x23f7('0x47')]?_0x36a8db[_0x23f7('0x45')]:_0x2ea06d[_0x23f7('0x41')];if(!_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x48')](_0x23f7('0x49'))){_0x36a8db[_0x23f7('0x2e')]=qs['limit'](_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x2e')]);_0x36a8db[_0x23f7('0x2d')]=qs[_0x23f7('0x2d')](_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x2d')]);}_0x36a8db['order']=qs[_0x23f7('0x4a')](_0x41b0cc[_0x23f7('0x42')]['sort']);_0x36a8db[_0x23f7('0x4b')]=qs[_0x23f7('0x4c')](_[_0x23f7('0x4d')](_0x41b0cc[_0x23f7('0x42')],_0x2ea06d['filters']),_0x2cbbac);if(_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x4e')]){_0x36a8db[_0x23f7('0x4b')]=_[_0x23f7('0x4f')](_0x36a8db[_0x23f7('0x4b')],{'$or':_['map'](_0x2cbbac,function(_0xa29622){if(_0xa29622[_0x23f7('0x50')]!==_0x23f7('0x51')){var _0x1f35ab={};_0x1f35ab[_0xa29622['name']]={'$like':'%'+_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x4e')]+'%'};return _0x1f35ab;}})});}_0x36a8db=_['merge']({},_0x36a8db,_0x41b0cc[_0x23f7('0x52')]);var _0x4da6bf={'where':_0x36a8db[_0x23f7('0x4b')]};return db['Trunk'][_0x23f7('0x2c')](_0x4da6bf)['then'](function(_0x4052fb){_0x566ea2[_0x23f7('0x2c')]=_0x4052fb;if(_0x41b0cc[_0x23f7('0x42')][_0x23f7('0x53')]){_0x36a8db[_0x23f7('0x54')]=[{'all':!![]}];}return db['Trunk'][_0x23f7('0x55')](_0x36a8db);})[_0x23f7('0x1f')](function(_0x3a73a6){_0x566ea2['rows']=_0x3a73a6;return _0x566ea2;})[_0x23f7('0x1f')](respondWithFilteredResult(_0x321d80,_0x36a8db))[_0x23f7('0x56')](handleError(_0x321d80,null));};exports[_0x23f7('0x57')]=function(_0x20b2d9,_0x334d61){var _0xbb6418={'raw':![],'where':{'id':_0x20b2d9['params']['id']}},_0x29152c={};_0x29152c[_0x23f7('0x41')]=_[_0x23f7('0x43')](db[_0x23f7('0x3e')]['rawAttributes']);_0x29152c[_0x23f7('0x42')]=_[_0x23f7('0x43')](_0x20b2d9[_0x23f7('0x42')]);_0x29152c[_0x23f7('0x4c')]=_[_0x23f7('0x44')](_0x29152c[_0x23f7('0x41')],_0x29152c[_0x23f7('0x42')]);_0xbb6418[_0x23f7('0x45')]=_[_0x23f7('0x44')](_0x29152c[_0x23f7('0x41')],qs[_0x23f7('0x46')](_0x20b2d9[_0x23f7('0x42')]['fields']));_0xbb6418[_0x23f7('0x45')]=_0xbb6418['attributes']['length']?_0xbb6418[_0x23f7('0x45')]:_0x29152c[_0x23f7('0x41')];if(_0x20b2d9[_0x23f7('0x42')]['includeAll']){_0xbb6418[_0x23f7('0x54')]=[{'all':!![]}];}_0xbb6418=_[_0x23f7('0x4f')]({},_0xbb6418,_0x20b2d9[_0x23f7('0x52')]);return db[_0x23f7('0x3e')][_0x23f7('0x58')](_0xbb6418)['then'](handleEntityNotFound(_0x334d61,null))[_0x23f7('0x1f')](respondWithResult(_0x334d61,null))[_0x23f7('0x56')](handleError(_0x334d61,null));};exports[_0x23f7('0x59')]=function(_0x13f16c,_0x1cda11){var _0x1c6d56={'where':{'id':_0x13f16c[_0x23f7('0x5a')]['id']}},_0x19e00b={};_0x19e00b[_0x23f7('0x41')]=_[_0x23f7('0x43')](db[_0x23f7('0x3e')][_0x23f7('0x3f')]);_0x1c6d56['attributes']=_[_0x23f7('0x44')](_0x19e00b[_0x23f7('0x41')],qs[_0x23f7('0x46')](_0x13f16c[_0x23f7('0x42')]['fields']));_0x1c6d56[_0x23f7('0x45')]=_0x1c6d56[_0x23f7('0x45')][_0x23f7('0x47')]?_0x1c6d56['attributes']:_0x19e00b[_0x23f7('0x41')];if(_0x13f16c[_0x23f7('0x42')]['includeAll']){_0x1c6d56[_0x23f7('0x54')]=[{'all':!![]}];}_0x1c6d56=_[_0x23f7('0x4f')]({},_0x1c6d56,_0x13f16c[_0x23f7('0x52')]);return db[_0x23f7('0x3e')][_0x23f7('0x58')](_0x1c6d56)[_0x23f7('0x1f')](handleEntityNotFound(_0x1cda11,null))['then'](function(_0x237c92){if(_0x237c92){var _0x242019=_0x237c92[_0x23f7('0x36')]({'plain':!![]});_0x242019=qs[_0x23f7('0x5b')](_0x242019,['id',_0x23f7('0x5c'),_0x23f7('0x5d')]);_0x13f16c[_0x23f7('0x5e')]=_[_0x23f7('0x5b')](_0x13f16c[_0x23f7('0x5e')],['id',_0x23f7('0x5c'),_0x23f7('0x5d')]);return db[_0x23f7('0x3e')][_0x23f7('0x5f')](_[_0x23f7('0x4f')](_0x242019,_0x13f16c[_0x23f7('0x5e')]),{'include':_0x13f16c[_0x23f7('0x42')][_0x23f7('0x53')]?[{'all':!![]}]:undefined})[_0x23f7('0x1f')](function(_0x29c9f9){var _0x100b42=_0x13f16c[_0x23f7('0x60')][_0x23f7('0x36')]({'plain':!![]});if(!_0x100b42)throw new Error(_0x23f7('0x61'));if(_0x100b42[_0x23f7('0x62')]===_0x23f7('0x60')){var _0x41add5=_0x29c9f9[_0x23f7('0x36')]({'plain':!![]});var _0x32f430=_0x23f7('0x37');return db[_0x23f7('0x63')][_0x23f7('0x58')]({'where':{'name':_0x32f430,'userProfileId':_0x100b42[_0x23f7('0x64')]},'raw':!![]})[_0x23f7('0x1f')](function(_0x2ce60f){if(_0x2ce60f&&_0x2ce60f[_0x23f7('0x65')]===0x0){return db['UserProfileResource'][_0x23f7('0x5f')]({'name':_0x41add5[_0x23f7('0x3a')],'resourceId':_0x41add5['id'],'type':_0x2ce60f[_0x23f7('0x3a')],'sectionId':_0x2ce60f['id']},{})['then'](function(){return _0x29c9f9;});}else{return _0x29c9f9;}})[_0x23f7('0x56')](function(_0x216071){logger['error'](_0x23f7('0x66'),_0x216071);throw _0x216071;});}return _0x29c9f9;});}})['then'](respondWithResult(_0x1cda11,0xc9))[_0x23f7('0x56')](handleError(_0x1cda11,null));};exports[_0x23f7('0x5f')]=function(_0x339492,_0x4e32eb,_0x505188){var _0x4d3400;return db[_0x23f7('0x3e')][_0x23f7('0x5f')](_0x339492[_0x23f7('0x5e')],{'raw':!![]})[_0x23f7('0x1f')](function(_0x1efe33){_0x4d3400=_0x1efe33;return db[_0x23f7('0x3e')][_0x23f7('0x55')]({'raw':!![]});})[_0x23f7('0x1f')](function(_0x1e4e10){var _0x4b8f95=fs[_0x23f7('0x67')](path[_0x23f7('0x68')](config['root'],_0x23f7('0x69')),_0x23f7('0x6a'));var _0xa92775=fs['readFileSync'](path[_0x23f7('0x68')](config[_0x23f7('0x6b')],_0x23f7('0x6c')),_0x23f7('0x6a'));var _0x3a1ddb=ejs[_0x23f7('0x6d')](_0x4b8f95,{'trunks':_0x1e4e10||[]});fs['writeFileSync'](_0x23f7('0x6e'),_0x3a1ddb);if(_0x4d3400[_0x23f7('0x6f')]){var _0x5e41ac=ejs[_0x23f7('0x6d')](_0xa92775,{'trunks':_0x1e4e10||[]});fs['writeFileSync'](_0x23f7('0x70'),_0x5e41ac);}})[_0x23f7('0x1f')](function(){return respondWithRpcPromise(_0x23f7('0x71'),_0x23f7('0x5f'),{'module':_0x23f7('0x72')});})[_0x23f7('0x1f')](function(){var _0x270463=_0x339492[_0x23f7('0x60')][_0x23f7('0x36')]({'plain':!![]});if(!_0x270463)throw new Error(_0x23f7('0x61'));if(_0x270463['role']==='user'){var _0xba3791=_0x4d3400['get']({'plain':!![]});return db[_0x23f7('0x63')][_0x23f7('0x58')]({'where':{'name':_0x23f7('0x37'),'userProfileId':_0x270463[_0x23f7('0x64')]},'raw':!![]})[_0x23f7('0x1f')](function(_0xb566dc){if(_0xb566dc&&_0xb566dc[_0x23f7('0x65')]===0x0){return db[_0x23f7('0x38')]['create']({'name':_0xba3791[_0x23f7('0x3a')],'resourceId':_0xba3791['id'],'type':_0xb566dc[_0x23f7('0x3a')],'sectionId':_0xb566dc['id']},{})[_0x23f7('0x1f')](function(){return _0x4d3400;});}else{return _0x4d3400;}})[_0x23f7('0x56')](function(_0x31fd8d){logger[_0x23f7('0x25')](_0x23f7('0x66'),_0x31fd8d);throw _0x31fd8d;});}return _0x4d3400;})['then'](respondWithResult(_0x4e32eb,0xc9))[_0x23f7('0x56')](handleError(_0x4e32eb,null));};exports[_0x23f7('0x34')]=function(_0x560bf7,_0x370a84,_0x283570){var _0x15f132;return db['Trunk'][_0x23f7('0x58')]({'where':{'id':_0x560bf7['params']['id']}})[_0x23f7('0x1f')](handleEntityNotFound(_0x370a84,null))[_0x23f7('0x1f')](saveUpdates(_0x560bf7[_0x23f7('0x5e')],null))['then'](function(_0x42cf0f){if(_0x42cf0f){_0x15f132=_0x42cf0f;return db[_0x23f7('0x3e')][_0x23f7('0x55')]({'raw':!![]});}})[_0x23f7('0x1f')](function(_0x2d8867){if(_0x2d8867){var _0x41d3c4=fs[_0x23f7('0x67')](path[_0x23f7('0x68')](config[_0x23f7('0x6b')],_0x23f7('0x69')),_0x23f7('0x6a'));var _0x3adb22=fs[_0x23f7('0x67')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x23f7('0x6a'));var _0x585f15=ejs[_0x23f7('0x6d')](_0x41d3c4,{'trunks':_0x2d8867||[]});fs[_0x23f7('0x73')](_0x23f7('0x6e'),_0x585f15);var _0x277e15=ejs[_0x23f7('0x6d')](_0x3adb22,{'trunks':_0x2d8867||[]});fs['writeFileSync'](_0x23f7('0x70'),_0x277e15);return respondWithRpcPromise(_0x23f7('0x71'),'update',{'module':_0x23f7('0x72')});}return null;})[_0x23f7('0x1f')](function(_0x2b827d){if(_0x2b827d){return _0x15f132;}})['then'](respondWithResult(_0x370a84,null))[_0x23f7('0x56')](handleError(_0x370a84,null));};exports[_0x23f7('0x35')]=function(_0x52395f,_0x58ea45,_0x455037){var _0x161c12;return db[_0x23f7('0x3e')]['find']({'where':{'id':_0x52395f['params']['id']}})[_0x23f7('0x1f')](handleEntityNotFound(_0x58ea45,null))['then'](removeEntity(_0x58ea45,null))[_0x23f7('0x1f')](function(){return db[_0x23f7('0x3e')][_0x23f7('0x55')]({'raw':!![]});})[_0x23f7('0x1f')](function(_0x9d9404){var _0x4c4544=fs[_0x23f7('0x67')](path[_0x23f7('0x68')](config[_0x23f7('0x6b')],_0x23f7('0x69')),_0x23f7('0x6a'));var _0x15fc42=fs[_0x23f7('0x67')](path[_0x23f7('0x68')](config[_0x23f7('0x6b')],_0x23f7('0x6c')),_0x23f7('0x6a'));var _0x55bc4d=ejs[_0x23f7('0x6d')](_0x4c4544,{'trunks':_0x9d9404});var _0x1f82a0=ejs[_0x23f7('0x6d')](_0x15fc42,{'trunks':_0x9d9404});fs[_0x23f7('0x73')](_0x23f7('0x6e'),_0x55bc4d);fs['writeFileSync'](_0x23f7('0x70'),_0x1f82a0);return respondWithRpcPromise('Reload',_0x23f7('0x35'),{'module':_0x23f7('0x72')});})[_0x23f7('0x56')](handleError(_0x58ea45,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 34316ae..e3d912e 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 _0x1ba9=['tools_trunks','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','Trunk'];(function(_0x5de963,_0x340318){var _0x3867de=function(_0xe0b8ea){while(--_0xe0b8ea){_0x5de963['push'](_0x5de963['shift']());}};_0x3867de(++_0x340318);}(_0x1ba9,0x85));var _0x91ba=function(_0x1e8a17,_0x3dbc4d){_0x1e8a17=_0x1e8a17-0x0;var _0x276fdb=_0x1ba9[_0x1e8a17];return _0x276fdb;};'use strict';var _=require(_0x91ba('0x0'));var util=require('util');var logger=require(_0x91ba('0x1'))(_0x91ba('0x2'));var moment=require('moment');var BPromise=require(_0x91ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91ba('0x4'));var rimraf=require(_0x91ba('0x5'));var config=require(_0x91ba('0x6'));var attributes=require('./trunk.attributes');module[_0x91ba('0x7')]=function(_0x62bb44,_0x14abda){return _0x62bb44[_0x91ba('0x8')](_0x91ba('0x9'),attributes,{'tableName':_0x91ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x646e=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x155d32,_0x5a7a61){var _0x1e78d4=function(_0x2a3509){while(--_0x2a3509){_0x155d32['push'](_0x155d32['shift']());}};_0x1e78d4(++_0x5a7a61);}(_0x646e,0x75));var _0xe646=function(_0x4c35ac,_0x3a4322){_0x4c35ac=_0x4c35ac-0x0;var _0x113569=_0x646e[_0x4c35ac];return _0x113569;};'use strict';var _=require(_0xe646('0x0'));var util=require(_0xe646('0x1'));var logger=require(_0xe646('0x2'))(_0xe646('0x3'));var moment=require(_0xe646('0x4'));var BPromise=require(_0xe646('0x5'));var rp=require(_0xe646('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe646('0x7'));var config=require(_0xe646('0x8'));var attributes=require(_0xe646('0x9'));module[_0xe646('0xa')]=function(_0x39cbf4,_0x3ed5b5){return _0x39cbf4[_0xe646('0xb')](_0xe646('0xc'),attributes,{'tableName':_0xe646('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d4b1336..f57cacb 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 _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x444881,_0x37ac97){var _0x3c0ff6=function(_0x44faa3){while(--_0x44faa3){_0x444881['push'](_0x444881['shift']());}};_0x3c0ff6(++_0x37ac97);}(_0x14a0,0x8e));var _0x014a=function(_0x271997,_0x17c310){_0x271997=_0x271997-0x0;var _0xcd8686=_0x14a0[_0x271997];return _0xcd8686;};'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']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\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')]('Trunk,\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);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x9ffd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','catch','GetTrunk','Trunk','findAll','options','raw','include','map','model','attributes','where','ShowTrunk'];(function(_0x58dfe6,_0x326727){var _0x1fa6c0=function(_0x26ad6e){while(--_0x26ad6e){_0x58dfe6['push'](_0x58dfe6['shift']());}};_0x1fa6c0(++_0x326727);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x17e558,_0x5636f8){_0x17e558=_0x17e558-0x0;var _0x35981c=_0x9ffd[_0x17e558];return _0x35981c;};'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']('Trunk,\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')]('Trunk,\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')]('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}exports[_0xd9ff('0x17')]=function(_0x3afd19){var _0x5f45c4=this;return new Promise(function(_0x2d4df1,_0x3ccf15){return db[_0xd9ff('0x18')][_0xd9ff('0x19')]({'raw':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options']['where']||null:null,'attributes':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')]['attributes']||null:null,'limit':_0x3afd19['options']?_0x3afd19['options']['limit']||null:null,'include':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options'][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x278b66){return{'model':db[_0x278b66[_0xd9ff('0x1e')]],'as':_0x278b66['as'],'attributes':_0x278b66['attributes'],'include':_0x278b66['include']?_[_0xd9ff('0x1d')](_0x278b66['include'],function(_0x3ca906){return{'model':db[_0x3ca906['model']],'as':_0x3ca906['as'],'attributes':_0x3ca906[_0xd9ff('0x1f')],'include':_0x3ca906['include']?_[_0xd9ff('0x1d')](_0x3ca906[_0xd9ff('0x1c')],function(_0x2138b4){return{'model':db[_0x2138b4[_0xd9ff('0x1e')]],'as':_0x2138b4['as'],'attributes':_0x2138b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0xe11f88){logger[_0xd9ff('0x15')](_0xd9ff('0x17'),_0x3afd19);logger['debug'](_0xd9ff('0x17'),_0x3afd19,JSON[_0xd9ff('0x10')](_0xe11f88));_0x2d4df1(_0xe11f88);})[_0xd9ff('0x16')](function(_0x45fb63){logger[_0xd9ff('0x11')](_0xd9ff('0x17'),_0x45fb63[_0xd9ff('0x13')],_0x3afd19);_0x3ccf15(_0x5f45c4[_0xd9ff('0x11')](0x1f4,_0x45fb63[_0xd9ff('0x13')]));});});};exports['ShowTrunk']=function(_0xcea5db){var _0x4ba2be=this;return new Promise(function(_0x1d55fd,_0x29c532){return db[_0xd9ff('0x18')]['find']({'raw':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db['options'][_0xd9ff('0x20')]||null:null,'attributes':_0xcea5db['options']?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1f')]||null:null,'include':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x36749c){return{'model':db[_0x36749c[_0xd9ff('0x1e')]],'as':_0x36749c['as'],'attributes':_0x36749c[_0xd9ff('0x1f')],'include':_0x36749c[_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x36749c[_0xd9ff('0x1c')],function(_0x498025){return{'model':db[_0x498025[_0xd9ff('0x1e')]],'as':_0x498025['as'],'attributes':_0x498025[_0xd9ff('0x1f')],'include':_0x498025[_0xd9ff('0x1c')]?_['map'](_0x498025[_0xd9ff('0x1c')],function(_0x5e3ff9){return{'model':db[_0x5e3ff9[_0xd9ff('0x1e')]],'as':_0x5e3ff9['as'],'attributes':_0x5e3ff9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0x5db498){logger[_0xd9ff('0x15')](_0xd9ff('0x21'),_0xcea5db);logger[_0xd9ff('0xd')]('ShowTrunk',_0xcea5db,JSON['stringify'](_0x5db498));_0x1d55fd(_0x5db498);})['catch'](function(_0x7ac3d1){logger[_0xd9ff('0x11')](_0xd9ff('0x21'),_0x7ac3d1[_0xd9ff('0x13')],_0xcea5db);_0x29c532(_0x4ba2be[_0xd9ff('0x11')](0x1f4,_0x7ac3d1[_0xd9ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 92e2b22..1b79298 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 _0xc360=['getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','diskStorage','join','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','delete','/:id/queues','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc360,0x1aa));var _0x0c36=function(_0x457884,_0x4e1ffd){_0x457884=_0x457884-0x0;var _0x3f3d99=_0xc360[_0x457884];return _0x3f3d99;};'use strict';var multer=require(_0x0c36('0x0'));var util=require(_0x0c36('0x1'));var path=require(_0x0c36('0x2'));var timeout=require(_0x0c36('0x3'));var express=require(_0x0c36('0x4'));var router=express[_0x0c36('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0c36('0x6'));var config=require(_0x0c36('0x7'));var controller=require(_0x0c36('0x8'));router[_0x0c36('0x9')]('/',auth[_0x0c36('0xa')](),controller[_0x0c36('0xb')]);router['get'](_0x0c36('0xc'),auth['isAuthenticated'](),controller[_0x0c36('0xd')]);router[_0x0c36('0x9')](_0x0c36('0xe'),auth[_0x0c36('0xa')](),controller[_0x0c36('0xf')]);router[_0x0c36('0x9')](_0x0c36('0x10'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x11')]);router[_0x0c36('0x9')](_0x0c36('0x12'),controller[_0x0c36('0x13')]);router[_0x0c36('0x9')](_0x0c36('0x14'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x15')]);router[_0x0c36('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0c36('0x16')]);router[_0x0c36('0x9')](_0x0c36('0x17'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x18')]);router['get']('/:id/groups',auth[_0x0c36('0xa')](),controller[_0x0c36('0x19')]);router[_0x0c36('0x9')]('/:id/recordings',auth[_0x0c36('0xa')](),controller[_0x0c36('0x1a')]);router[_0x0c36('0x9')](_0x0c36('0x1b'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x1c')]);router['get'](_0x0c36('0x1d'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x1e')]);router[_0x0c36('0x9')](_0x0c36('0x1f'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x20')]);router['get'](_0x0c36('0x21'),auth[_0x0c36('0xa')](),controller['getMailInteractions']);router[_0x0c36('0x9')](_0x0c36('0x22'),auth[_0x0c36('0xa')](),controller['getSmsInteractions']);router['get'](_0x0c36('0x23'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x24')]);router['get'](_0x0c36('0x25'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x26')]);router['get'](_0x0c36('0x27'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x28')]);router[_0x0c36('0x9')](_0x0c36('0x29'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x2a')]);router[_0x0c36('0x9')](_0x0c36('0x2b'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x2c')]);router[_0x0c36('0x9')](_0x0c36('0x2d'),auth[_0x0c36('0xa')](),controller['getVoicePrefixes']);router[_0x0c36('0x9')](_0x0c36('0x2e'),auth[_0x0c36('0xa')](),controller['getFaxAccounts']);router[_0x0c36('0x9')]('/:id/mail_accounts',auth[_0x0c36('0xa')](),controller[_0x0c36('0x2f')]);router[_0x0c36('0x9')](_0x0c36('0x30'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x31')]);router[_0x0c36('0x9')](_0x0c36('0x32'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x33')]);router[_0x0c36('0x9')]('/:id/chat_websites',auth[_0x0c36('0xa')](),controller['getChatWebsites']);router[_0x0c36('0x9')](_0x0c36('0x34'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x35')]);router[_0x0c36('0x9')](_0x0c36('0x36'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x37')]);router[_0x0c36('0x9')](_0x0c36('0x38'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x39')]);router[_0x0c36('0x9')](_0x0c36('0x3a'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x3b')]);router[_0x0c36('0x3c')](_0x0c36('0x3d'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x3e')]);router[_0x0c36('0x3c')](_0x0c36('0x14'),auth['isAuthenticated'](),controller[_0x0c36('0x3f')]);router['post']('/',auth[_0x0c36('0xa')](),controller['create']);router[_0x0c36('0x3c')]('/:id/queues',auth[_0x0c36('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x0c36('0x40')]({'destination':function(_0x57cb2a,_0x3860cb,_0x243ab6){_0x243ab6(null,path[_0x0c36('0x41')](config['root'],'server/files/images/'));},'filename':function(_0x7edb50,_0x5d86e6,_0x1dfe95){_0x1dfe95(null,util['format'](_0x0c36('0x42'),Date[_0x0c36('0x43')](),_0x5d86e6['originalname']));}})});router[_0x0c36('0x3c')](_0x0c36('0x12'),upload[_0x0c36('0x44')](_0x0c36('0x45')),controller[_0x0c36('0x46')]);router[_0x0c36('0x3c')](_0x0c36('0x47'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x48')]);router[_0x0c36('0x3c')](_0x0c36('0x49'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x4a')]);router[_0x0c36('0x3c')](_0x0c36('0x4b'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x4c')]);router['post']('/:id/unpause',auth[_0x0c36('0xa')](),controller['unpause']);router[_0x0c36('0x3c')]('/:id/teams',auth[_0x0c36('0xa')](),controller[_0x0c36('0x4d')]);router[_0x0c36('0x3c')](_0x0c36('0x4e'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x4f')]);router[_0x0c36('0x3c')](_0x0c36('0x50'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x51')]);router[_0x0c36('0x3c')](_0x0c36('0x52'),auth[_0x0c36('0xa')](),controller['addFaxInteractions']);router[_0x0c36('0x3c')](_0x0c36('0x53'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x54')]);router[_0x0c36('0x3c')](_0x0c36('0x55'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x56')]);router[_0x0c36('0x3c')]('/:id/whatsapp_interactions',auth[_0x0c36('0xa')](),controller[_0x0c36('0x57')]);router[_0x0c36('0x3c')](_0x0c36('0x2e'),auth['isAuthenticated'](),controller[_0x0c36('0x58')]);router['post'](_0x0c36('0x59'),auth[_0x0c36('0xa')](),controller['addMailAccounts']);router['post'](_0x0c36('0x30'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x0c36('0x3c')](_0x0c36('0x32'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x5a')]);router[_0x0c36('0x3c')](_0x0c36('0x5b'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x5c')]);router[_0x0c36('0x3c')](_0x0c36('0x34'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x5d')]);router[_0x0c36('0x3c')](_0x0c36('0x36'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x5e')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0x0c36('0x10'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x5f')]);router[_0x0c36('0x60')](_0x0c36('0x61'),auth[_0x0c36('0xa')](),controller['changePassword']);router[_0x0c36('0x62')](_0x0c36('0x63'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x64')]);router[_0x0c36('0x62')](_0x0c36('0x27'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x65')]);router[_0x0c36('0x62')](_0x0c36('0x10'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x66')]);router[_0x0c36('0x62')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x0c36('0x67')]);router[_0x0c36('0x62')](_0x0c36('0x50'),auth['isAuthenticated'](),controller[_0x0c36('0x68')]);router['delete'](_0x0c36('0x52'),auth['isAuthenticated'](),controller[_0x0c36('0x69')]);router[_0x0c36('0x62')]('/:id/sms_interactions',auth[_0x0c36('0xa')](),controller[_0x0c36('0x6a')]);router[_0x0c36('0x62')](_0x0c36('0x55'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x6b')]);router['delete'](_0x0c36('0x6c'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x6d')]);router[_0x0c36('0x62')](_0x0c36('0x2e'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x6e')]);router[_0x0c36('0x62')](_0x0c36('0x59'),auth['isAuthenticated'](),controller[_0x0c36('0x6f')]);router[_0x0c36('0x62')](_0x0c36('0x30'),auth[_0x0c36('0xa')](),controller['removeOpenchannelAccounts']);router[_0x0c36('0x62')](_0x0c36('0x32'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x70')]);router['delete'](_0x0c36('0x5b'),auth[_0x0c36('0xa')](),controller['removeChatWebsites']);router[_0x0c36('0x62')](_0x0c36('0x34'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x71')]);router[_0x0c36('0x62')](_0x0c36('0x36'),auth[_0x0c36('0xa')](),controller[_0x0c36('0x72')]);router[_0x0c36('0x62')](_0x0c36('0x3a'),auth['isAuthenticated'](),controller[_0x0c36('0x73')]);module['exports']=router; \ No newline at end of file +var _0xa943=['../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/:id/queues','addQueues','diskStorage','server/files/images/','%s-%s','originalname','single','file','addAvatar','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','/:id','update','put','delete','removeTeams','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x67c72,_0x411d0c){var _0xac0260=function(_0x1dc4aa){while(--_0x1dc4aa){_0x67c72['push'](_0x67c72['shift']());}};_0xac0260(++_0x411d0c);}(_0xa943,0x1b8));var _0x3a94=function(_0xbaf269,_0x3b8be9){_0xbaf269=_0xbaf269-0x0;var _0x1d6b74=_0xa943[_0xbaf269];return _0x1d6b74;};'use strict';var multer=require(_0x3a94('0x0'));var util=require(_0x3a94('0x1'));var path=require(_0x3a94('0x2'));var timeout=require(_0x3a94('0x3'));var express=require(_0x3a94('0x4'));var router=express[_0x3a94('0x5')]();var auth=require(_0x3a94('0x6'));var interaction=require(_0x3a94('0x7'));var config=require(_0x3a94('0x8'));var controller=require(_0x3a94('0x9'));router['get']('/',auth[_0x3a94('0xa')](),controller[_0x3a94('0xb')]);router[_0x3a94('0xc')](_0x3a94('0xd'),auth[_0x3a94('0xa')](),controller[_0x3a94('0xe')]);router[_0x3a94('0xc')](_0x3a94('0xf'),auth['isAuthenticated'](),controller[_0x3a94('0x10')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3a94('0x11')]);router[_0x3a94('0xc')](_0x3a94('0x12'),controller[_0x3a94('0x13')]);router['get'](_0x3a94('0x14'),auth['isAuthenticated'](),controller[_0x3a94('0x15')]);router[_0x3a94('0xc')]('/:id/queues',auth[_0x3a94('0xa')](),controller[_0x3a94('0x16')]);router[_0x3a94('0xc')](_0x3a94('0x17'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x18')]);router[_0x3a94('0xc')](_0x3a94('0x19'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x1a')]);router[_0x3a94('0xc')](_0x3a94('0x1b'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x1c')]);router[_0x3a94('0xc')]('/:id/screen_recordings',auth[_0x3a94('0xa')](),controller[_0x3a94('0x1d')]);router['get'](_0x3a94('0x1e'),auth['isAuthenticated'](),controller[_0x3a94('0x1f')]);router[_0x3a94('0xc')](_0x3a94('0x20'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x21')]);router['get'](_0x3a94('0x22'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x23')]);router[_0x3a94('0xc')](_0x3a94('0x24'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x25')]);router[_0x3a94('0xc')](_0x3a94('0x26'),auth[_0x3a94('0xa')](),controller['getFaxInteractions']);router[_0x3a94('0xc')]('/:id/whatsapp/interactions',auth[_0x3a94('0xa')](),controller[_0x3a94('0x27')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x3a94('0x28')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x3a94('0xc')](_0x3a94('0x29'),auth['isAuthenticated'](),controller[_0x3a94('0x2a')]);router['get'](_0x3a94('0x2b'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x2c')]);router[_0x3a94('0xc')](_0x3a94('0x2d'),auth[_0x3a94('0xa')](),controller['getFaxAccounts']);router[_0x3a94('0xc')](_0x3a94('0x2e'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x2f')]);router[_0x3a94('0xc')](_0x3a94('0x30'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x31')]);router['get'](_0x3a94('0x32'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x33')]);router[_0x3a94('0xc')]('/:id/chat_websites',auth[_0x3a94('0xa')](),controller[_0x3a94('0x34')]);router[_0x3a94('0xc')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x3a94('0x35')]);router[_0x3a94('0xc')](_0x3a94('0x36'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x37')]);router[_0x3a94('0xc')](_0x3a94('0x38'),auth[_0x3a94('0xa')](),controller['getScheduledCalls']);router[_0x3a94('0xc')](_0x3a94('0x39'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x3a')]);router[_0x3a94('0x3b')]('/create_many',auth[_0x3a94('0xa')](),controller['bulkCreate']);router[_0x3a94('0x3b')](_0x3a94('0x14'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x3c')]);router[_0x3a94('0x3b')]('/',auth[_0x3a94('0xa')](),controller[_0x3a94('0x3d')]);router['post'](_0x3a94('0x3e'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x3f')]);var upload=multer({'storage':multer[_0x3a94('0x40')]({'destination':function(_0x20620b,_0x1e3082,_0x625d57){_0x625d57(null,path['join'](config['root'],_0x3a94('0x41')));},'filename':function(_0x22fd84,_0x3e272c,_0x5fe061){_0x5fe061(null,util['format'](_0x3a94('0x42'),Date['now'](),_0x3e272c[_0x3a94('0x43')]));}})});router[_0x3a94('0x3b')](_0x3a94('0x12'),upload[_0x3a94('0x44')](_0x3a94('0x45')),controller[_0x3a94('0x46')]);router['post']('/:id/login',auth[_0x3a94('0xa')](),controller['login']);router[_0x3a94('0x3b')](_0x3a94('0x47'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x48')]);router[_0x3a94('0x3b')]('/:id/pause',auth[_0x3a94('0xa')](),controller[_0x3a94('0x49')]);router[_0x3a94('0x3b')](_0x3a94('0x4a'),auth['isAuthenticated'](),controller[_0x3a94('0x4b')]);router[_0x3a94('0x3b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3a94('0x4c')]);router[_0x3a94('0x3b')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x3a94('0x4d')]);router['post'](_0x3a94('0x4e'),auth['isAuthenticated'](),controller[_0x3a94('0x4f')]);router['post'](_0x3a94('0x50'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x51')]);router[_0x3a94('0x3b')](_0x3a94('0x52'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x53')]);router[_0x3a94('0x3b')](_0x3a94('0x54'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x55')]);router['post'](_0x3a94('0x56'),auth[_0x3a94('0xa')](),controller['addWhatsappInteractions']);router[_0x3a94('0x3b')](_0x3a94('0x2d'),auth['isAuthenticated'](),controller[_0x3a94('0x57')]);router[_0x3a94('0x3b')](_0x3a94('0x2e'),auth['isAuthenticated'](),controller[_0x3a94('0x58')]);router[_0x3a94('0x3b')](_0x3a94('0x30'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x59')]);router['post'](_0x3a94('0x32'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x5a')]);router[_0x3a94('0x3b')](_0x3a94('0x5b'),auth['isAuthenticated'](),controller[_0x3a94('0x5c')]);router[_0x3a94('0x3b')](_0x3a94('0x5d'),auth['isAuthenticated'](),controller[_0x3a94('0x5e')]);router[_0x3a94('0x3b')](_0x3a94('0x36'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x5f')]);router[_0x3a94('0x3b')](_0x3a94('0x39'),auth[_0x3a94('0xa')](),controller['createApiKey']);router['put'](_0x3a94('0x60'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x61')]);router[_0x3a94('0x62')]('/:id/password',auth[_0x3a94('0xa')](),controller['changePassword']);router[_0x3a94('0x63')](_0x3a94('0x3e'),auth[_0x3a94('0xa')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0x3a94('0xa')](),controller[_0x3a94('0x64')]);router[_0x3a94('0x63')]('/:id',auth[_0x3a94('0xa')](),controller['destroy']);router[_0x3a94('0x63')](_0x3a94('0x65'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x3a94('0x63')](_0x3a94('0x4e'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x66')]);router[_0x3a94('0x63')](_0x3a94('0x50'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x67')]);router[_0x3a94('0x63')](_0x3a94('0x52'),auth[_0x3a94('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x3a94('0x54'),auth[_0x3a94('0xa')](),controller[_0x3a94('0x68')]);router['delete'](_0x3a94('0x56'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x3a94('0x63')]('/:id/fax_accounts',auth[_0x3a94('0xa')](),controller[_0x3a94('0x69')]);router[_0x3a94('0x63')](_0x3a94('0x2e'),auth['isAuthenticated'](),controller[_0x3a94('0x6a')]);router['delete'](_0x3a94('0x30'),auth['isAuthenticated'](),controller[_0x3a94('0x6b')]);router['delete']('/:id/sms_accounts',auth[_0x3a94('0xa')](),controller[_0x3a94('0x6c')]);router[_0x3a94('0x63')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x3a94('0x6d')]);router['delete']('/:id/whatsapp_accounts',auth[_0x3a94('0xa')](),controller['removeWhatsappAccounts']);router[_0x3a94('0x63')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x3a94('0x6e')]);router['delete'](_0x3a94('0x39'),auth['isAuthenticated'](),controller['removeApiKey']);module[_0x3a94('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c364356..482227c 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 _0x3461=['email','toLowerCase','admin','user','agent','local','accountcode','getDataValue','fullname','BOOLEAN','DATE','INTEGER','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','active','passive','update,nonat','showWebBar','get','isArray','udp','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','wss','encryption','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','util','lodash','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','callerid','format','internal'];(function(_0x503357,_0x1920f3){var _0x48ba12=function(_0x17b04b){while(--_0x17b04b){_0x503357['push'](_0x503357['shift']());}};_0x48ba12(++_0x1920f3);}(_0x3461,0x105));var _0x1346=function(_0x46874a,_0x2b9a96){_0x46874a=_0x46874a-0x0;var _0x5424aa=_0x3461[_0x46874a];return _0x5424aa;};'use strict';var Sequelize=require(_0x1346('0x0'));var moment=require('moment');var util=require(_0x1346('0x1'));var _=require(_0x1346('0x2'));module[_0x1346('0x3')]={'name':{'type':Sequelize[_0x1346('0x4')],'allowNull':![],'unique':_0x1346('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b8aea){this['setDataValue'](_0x1346('0x5'),_0x5b8aea);this['setDataValue'](_0x1346('0x6'),_0x5b8aea);},'comment':_0x1346('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x135082){this[_0x1346('0x8')]('fullname',_0x135082);this[_0x1346('0x8')](_0x1346('0x9'),util[_0x1346('0xa')]('\x22%s\x22\x20<%s>',_0x135082,this['getDataValue'](_0x1346('0xb'))));}},'alias':{'type':Sequelize[_0x1346('0x4')]},'email':{'type':Sequelize[_0x1346('0x4')],'allowNull':![],'unique':_0x1346('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4c3959){if(_0x4c3959){this['setDataValue']('email',_0x4c3959[_0x1346('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x1346('0xe'),_0x1346('0xf'),_0x1346('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x1346('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1346('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x1346('0xb'),'set':function(_0x22108a){this[_0x1346('0x8')]('internal',_0x22108a);this[_0x1346('0x8')](_0x1346('0x12'),_0x22108a);this['setDataValue'](_0x1346('0x9'),util['format']('\x22%s\x22\x20<%s>',this[_0x1346('0x13')](_0x1346('0x14')),_0x22108a));}},'salt':{'type':Sequelize[_0x1346('0x4')]},'phone':{'type':Sequelize[_0x1346('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x1346('0x4')]},'zipcode':{'type':Sequelize[_0x1346('0x4')]},'userpic':{'type':Sequelize[_0x1346('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1346('0x4')]},'online':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1346('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1346('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1346('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1346('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1346('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1346('0x18')]('friend',_0x1346('0xf'),_0x1346('0x19')),'allowNull':!![],'defaultValue':_0x1346('0x1a')},'context':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![],'defaultValue':_0x1346('0x1b')},'callingpres':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x1c'),_0x1346('0x1d'),_0x1346('0x1e'),'ALLOWED',_0x1346('0x1f'),_0x1346('0x20'),'PROHIB_FAILED_SCREEN',_0x1346('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x47a0c7){this['setDataValue'](_0x1346('0x22'),_0x47a0c7?_0x47a0c7['join'](','):null);},'get':function(){return this[_0x1346('0x13')](_0x1346('0x22'))?this['getDataValue'](_0x1346('0x22'))[_0x1346('0x23')](','):null;},'comment':_0x1346('0x24')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0x1346('0x25'),'inband',_0x1346('0x26')),'allowNull':!![],'defaultValue':_0x1346('0x27')},'directmedia':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no',_0x1346('0x29'),_0x1346('0x2a'),_0x1346('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1346('0x2c'),'set':function(_0x2bb248){this['setDataValue'](_0x1346('0x2d'),_0x2bb248?_0x2bb248['join'](','):null);},'get':function(){return this[_0x1346('0x13')](_0x1346('0x2d'))?this[_0x1346('0x13')](_0x1346('0x2d'))[_0x1346('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1346('0x4')]},'namedcallgroup':{'type':Sequelize[_0x1346('0x4')]},'pickupgroup':{'type':Sequelize[_0x1346('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1346('0x4')]},'language':{'type':Sequelize[_0x1346('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1346('0x2e')},'allow':{'type':Sequelize[_0x1346('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e9899){this[_0x1346('0x8')](_0x1346('0x2f'),_0x4e9899?_0x4e9899['join'](';'):_0x1346('0x30'));},'get':function(){return this[_0x1346('0x13')](_0x1346('0x2f'))?this['getDataValue'](_0x1346('0x2f'))[_0x1346('0x23')](';'):null;},'comment':_0x1346('0x31')},'autoframing':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x5b5635){this[_0x1346('0x8')](_0x1346('0x32'),_0x5b5635?_0x5b5635[_0x1346('0x33')](','):null);},'get':function(){return this[_0x1346('0x13')](_0x1346('0x32'))?this['getDataValue'](_0x1346('0x32'))[_0x1346('0x23')](','):null;},'comment':_0x1346('0x34')},'trustrpid':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1346('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1346('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1346('0x36')},'amaflags':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1346('0x28')},'busylevel':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1346('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no',_0x1346('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1346('0x18')]('accept',_0x1346('0x38'),_0x1346('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x3a'),_0x1346('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1346('0x18')]('yes','no'),'allowNull':!![],'defaultValue':_0x1346('0x28')},'keepalive':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1346('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x1346('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no',_0x1346('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x3d'),_0x1346('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1346('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1346('0x18')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x1346('0x29'),_0x1346('0x2a'),_0x1346('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x1346('0x16')]},'showWebBar':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0,'set':function(_0x43490b){this[_0x1346('0x8')](_0x1346('0x40'),_0x43490b);var _0x32f961=this[_0x1346('0x41')]({'plain':!![]});switch(_0x43490b){case 0x0:case 0x1:var _0x43d6a5=_0x32f961[_0x1346('0x22')]?_[_0x1346('0x42')](_0x32f961[_0x1346('0x22')])?_0x32f961[_0x1346('0x22')][_0x1346('0x33')]():_0x32f961[_0x1346('0x22')]:_0x1346('0x43');if(_0x43d6a5==='wss'){_0x43d6a5=_0x1346('0x43');}this[_0x1346('0x8')]('transport',_0x43d6a5);this[_0x1346('0x8')]('encryption','no');this[_0x1346('0x8')](_0x1346('0x44'),null);this[_0x1346('0x8')](_0x1346('0x45'),null);this[_0x1346('0x8')](_0x1346('0x46'),null);this['setDataValue'](_0x1346('0x47'),null);this[_0x1346('0x8')]('dtlsverify',null);this[_0x1346('0x8')](_0x1346('0x48'),null);this[_0x1346('0x8')]('dtlscertfile',null);this['setDataValue'](_0x1346('0x49'),null);this[_0x1346('0x8')](_0x1346('0x4a'),'no');break;case 0x2:this[_0x1346('0x8')](_0x1346('0x22'),_0x1346('0x4b'));this[_0x1346('0x8')](_0x1346('0x4c'),_0x1346('0x28'));this[_0x1346('0x8')]('avpf',_0x1346('0x28'));this['setDataValue'](_0x1346('0x45'),_0x1346('0x28'));this[_0x1346('0x8')](_0x1346('0x46'),_0x1346('0x28'));this['setDataValue'](_0x1346('0x47'),'yes');this[_0x1346('0x8')](_0x1346('0x4d'),'no');this[_0x1346('0x8')](_0x1346('0x48'),'actpass');this[_0x1346('0x8')](_0x1346('0x4e'),_0x32f961['dtlscertfile']||_0x1346('0x4f'));this['setDataValue'](_0x1346('0x49'),_0x32f961['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x1346('0x8')](_0x1346('0x4a'),_0x1346('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x1346('0x50')],'set':function(_0x6218f2){this[_0x1346('0x8')](_0x1346('0x51'),_0x6218f2?_0x6218f2['join'](','):[]);},'get':function(){return this['getDataValue'](_0x1346('0x51'))?_[_0x1346('0x52')](this[_0x1346('0x13')]('permissions')[_0x1346('0x23')](','),function(_0x570dad){return parseInt(_0x570dad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1346('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1346('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1346('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1346('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1346('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1346('0x18')](_0x1346('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1346('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1346('0x4')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1346('0x53')],'get':function(){return this['getDataValue'](_0x1346('0x54'))?this[_0x1346('0x13')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1346('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1346('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![],'set':function(_0x53597a){if(typeof _0x53597a===_0x1346('0x55')){var _0x4f5444=_0x53597a==='1'?!![]:_0x53597a==='0'?![]:_0x53597a===_0x1346('0x56')?!![]:_0x53597a===_0x1346('0x57')?![]:![];this[_0x1346('0x8')](_0x1346('0x58'),_0x4f5444);}else{this['setDataValue'](_0x1346('0x58'),_0x53597a);}}},'blocked':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![],'set':function(_0x52d5b0){this[_0x1346('0x8')](_0x1346('0x59'),_0x52d5b0);if(_0x52d5b0===!![]){this[_0x1346('0x8')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0x1346('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x1346('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1346('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1346('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x0978=['always','refuse','originate','uac','uas','certificate','active','passive','actpass','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','avpf','icesupport','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','screenrecording','blocked','loginAttempts','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','INTEGER','internal','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>'];(function(_0x4c6120,_0x2bad41){var _0x2d8329=function(_0x188111){while(--_0x188111){_0x4c6120['push'](_0x4c6120['shift']());}};_0x2d8329(++_0x2bad41);}(_0x0978,0x170));var _0x8097=function(_0x1d8744,_0x366ebf){_0x1d8744=_0x1d8744-0x0;var _0x4c5770=_0x0978[_0x1d8744];return _0x4c5770;};'use strict';var Sequelize=require(_0x8097('0x0'));var moment=require('moment');var util=require(_0x8097('0x1'));var _=require(_0x8097('0x2'));module[_0x8097('0x3')]={'name':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'unique':_0x8097('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x429fe8){this[_0x8097('0x6')]('name',_0x429fe8);this[_0x8097('0x6')](_0x8097('0x7'),_0x429fe8);},'comment':_0x8097('0x8')},'fullname':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'set':function(_0x149b0f){this['setDataValue']('fullname',_0x149b0f);this[_0x8097('0x6')]('callerid',util[_0x8097('0x9')](_0x8097('0xa'),_0x149b0f,this[_0x8097('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x8097('0x4')]},'email':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'unique':_0x8097('0xc'),'validate':{'isEmail':!![]},'set':function(_0x65dfb9){if(_0x65dfb9){this['setDataValue']('email',_0x65dfb9[_0x8097('0xd')]());}}},'role':{'type':Sequelize[_0x8097('0xe')]('admin',_0x8097('0xf'),_0x8097('0x10'),_0x8097('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':![],'unique':_0x8097('0x13'),'set':function(_0x3f97df){this['setDataValue']('internal',_0x3f97df);this[_0x8097('0x6')](_0x8097('0x14'),_0x3f97df);this['setDataValue']('callerid',util[_0x8097('0x9')](_0x8097('0xa'),this[_0x8097('0xb')](_0x8097('0x15')),_0x3f97df));}},'salt':{'type':Sequelize[_0x8097('0x4')]},'phone':{'type':Sequelize[_0x8097('0x4')]},'mobile':{'type':Sequelize[_0x8097('0x4')]},'address':{'type':Sequelize[_0x8097('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8097('0x4')]},'country':{'type':Sequelize[_0x8097('0x4')]},'online':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8097('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x8097('0x17')]},'chatCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8097('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![],'defaultValue':_0x8097('0x18')},'ipaddr':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x8097('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x19'),_0x8097('0xf'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![],'defaultValue':_0x8097('0x1a')},'callingpres':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x1b'),_0x8097('0x1c'),'ALLOWED_FAILED_SCREEN',_0x8097('0x1d'),_0x8097('0x1e'),_0x8097('0x1f'),_0x8097('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8097('0x21'),'set':function(_0x578c21){this[_0x8097('0x6')]('transport',_0x578c21?_0x578c21[_0x8097('0x22')](','):null);},'get':function(){return this[_0x8097('0xb')](_0x8097('0x23'))?this[_0x8097('0xb')](_0x8097('0x23'))[_0x8097('0x24')](','):null;},'comment':_0x8097('0x25')},'dtmfmode':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x26'),_0x8097('0x27'),'shortinfo','inband','auto'),'allowNull':!![],'defaultValue':_0x8097('0x26')},'directmedia':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no',_0x8097('0x29'),_0x8097('0x2a'),_0x8097('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2d1265){this[_0x8097('0x6')](_0x8097('0x2c'),_0x2d1265?_0x2d1265['join'](','):null);},'get':function(){return this[_0x8097('0xb')]('nat')?this[_0x8097('0xb')](_0x8097('0x2c'))[_0x8097('0x24')](','):null;},'comment':_0x8097('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8097('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x8097('0x4')]},'language':{'type':Sequelize[_0x8097('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8097('0x4')]},'disallow':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'defaultValue':_0x8097('0x2e')},'allow':{'type':Sequelize[_0x8097('0x4')],'allowNull':![],'defaultValue':_0x8097('0x2f'),'set':function(_0x15f3e3){this[_0x8097('0x6')](_0x8097('0x30'),_0x15f3e3?_0x15f3e3[_0x8097('0x22')](';'):_0x8097('0x2f'));},'get':function(){return this[_0x8097('0xb')](_0x8097('0x30'))?this[_0x8097('0xb')](_0x8097('0x30'))[_0x8097('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![],'set':function(_0x2e962c){this[_0x8097('0x6')]('insecure',_0x2e962c?_0x2e962c[_0x8097('0x22')](','):null);},'get':function(){return this[_0x8097('0xb')](_0x8097('0x31'))?this[_0x8097('0xb')](_0x8097('0x31'))[_0x8097('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8097('0x28'),'no',_0x8097('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x8097('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8097('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':_0x8097('0x28')},'busylevel':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no',_0x8097('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8097('0xe')]('accept',_0x8097('0x35'),_0x8097('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x8097('0x37'),_0x8097('0x38')),'allowNull':!![],'defaultValue':_0x8097('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':_0x8097('0x28')},'keepalive':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x8097('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x8097('0x28'),'no','fingerprint',_0x8097('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8097('0x3a'),_0x8097('0x3b'),_0x8097('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x8097('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8097('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8097('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no','nonat',_0x8097('0x2a'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x8097('0x17')]},'showWebBar':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0,'set':function(_0x571484){this['setDataValue'](_0x8097('0x3d'),_0x571484);var _0x42a4b2=this[_0x8097('0x3e')]({'plain':!![]});switch(_0x571484){case 0x0:case 0x1:var _0x266f77=_0x42a4b2[_0x8097('0x23')]?_['isArray'](_0x42a4b2[_0x8097('0x23')])?_0x42a4b2[_0x8097('0x23')]['join']():_0x42a4b2[_0x8097('0x23')]:_0x8097('0x21');if(_0x266f77===_0x8097('0x3f')){_0x266f77=_0x8097('0x21');}this[_0x8097('0x6')]('transport',_0x266f77);this[_0x8097('0x6')]('encryption','no');this[_0x8097('0x6')]('avpf',null);this[_0x8097('0x6')](_0x8097('0x40'),null);this[_0x8097('0x6')]('icesupport',null);this[_0x8097('0x6')](_0x8097('0x41'),null);this[_0x8097('0x6')](_0x8097('0x42'),null);this['setDataValue'](_0x8097('0x43'),null);this[_0x8097('0x6')]('dtlscertfile',null);this['setDataValue'](_0x8097('0x44'),null);this[_0x8097('0x6')](_0x8097('0x45'),'no');break;case 0x2:this[_0x8097('0x6')](_0x8097('0x23'),_0x8097('0x3f'));this[_0x8097('0x6')](_0x8097('0x46'),_0x8097('0x28'));this[_0x8097('0x6')](_0x8097('0x47'),_0x8097('0x28'));this[_0x8097('0x6')]('force_avp',_0x8097('0x28'));this[_0x8097('0x6')](_0x8097('0x48'),_0x8097('0x28'));this[_0x8097('0x6')](_0x8097('0x41'),_0x8097('0x28'));this[_0x8097('0x6')]('dtlsverify','no');this[_0x8097('0x6')](_0x8097('0x43'),'actpass');this[_0x8097('0x6')](_0x8097('0x49'),_0x42a4b2['dtlscertfile']||_0x8097('0x4a'));this['setDataValue'](_0x8097('0x44'),_0x42a4b2[_0x8097('0x44')]||_0x8097('0x4b'));this[_0x8097('0x6')](_0x8097('0x45'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5ef32a){this[_0x8097('0x6')](_0x8097('0x4c'),_0x5ef32a?_0x5ef32a[_0x8097('0x22')](','):[]);},'get':function(){return this[_0x8097('0xb')](_0x8097('0x4c'))?_[_0x8097('0x4d')](this[_0x8097('0xb')](_0x8097('0x4c'))[_0x8097('0x24')](','),function(_0x43096e){return parseInt(_0x43096e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8097('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8097('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8097('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8097('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8097('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8097('0xe')](_0x8097('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8097('0x4')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8097('0x4e')],'get':function(){return this[_0x8097('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x8097('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8097('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![],'set':function(_0x469b58){if(typeof _0x469b58===_0x8097('0x4f')){var _0x2c417a=_0x469b58==='1'?!![]:_0x469b58==='0'?![]:_0x469b58==='true'?!![]:_0x469b58==='false'?![]:![];this['setDataValue'](_0x8097('0x50'),_0x2c417a);}else{this['setDataValue'](_0x8097('0x50'),_0x469b58);}}},'blocked':{'type':Sequelize[_0x8097('0x16')],'defaultValue':![],'set':function(_0x1aaaa8){this[_0x8097('0x6')](_0x8097('0x51'),_0x1aaaa8);if(_0x1aaaa8===!![]){this[_0x8097('0x6')]('blockedAt',moment());this[_0x8097('0x6')](_0x8097('0x52'),0x0);}else{this[_0x8097('0x6')](_0x8097('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x8097('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8097('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 4520e9b..fa5d24d 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 _0xcf58=['LOGIN','device','PAUSE','LOGININPAUSE','concat','logout','all','pause','QueuePause','DEFAULT\x20PAUSE','mailPause','faxPause','smsPause','lastPauseAt','mail','chat','fax','sms','openchannel','manual','%s%s','getTeams','Team','addTeams','getVoiceQueues','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getWhatsappQueues','getOpenchannelQueues','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.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','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','apply','reject','update','destroy','get','Users','user','Agents','agent','Telephones','telephone','filter','map','value','includes','role','find','name','end','stack','send','index','fieldName','type','model','differenceBy','password','salt','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','merge','sequelize','where','lower','col','options','includeAll','include','User','findAll','rows','params','bulkCreate','body','describe','addContacts','omit','ids','agent\x20role','admin','getLicense','users','isNil','format','count\x20%s:\x20%s','create','internal','findById','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','voicemail','mailbox','VoiceMail','email','permissions','101','103','113','104','105','106','107','108','114','UserProfileSection','UserProfileResource','changePassword','Setting','findOne','securePassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Unauthorized','addQueues','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','Queue:save','voice','online','push','interface','SIP/%s','each','upsert','removeQueues','channel','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','join','root','userpic','existsSync','server/files/images/','download','getContacts','CmContact','rawAttributes','CmList','List','Tag','Tags','color','tag','nolimit','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcf58,0x86));var _0x8cf5=function(_0x1d5281,_0x52cf58){_0x1d5281=_0x1d5281-0x0;var _0x12f0d6=_0xcf58[_0x1d5281];return _0x12f0d6;};'use strict';var pdf=require(_0x8cf5('0x0'));var emlformat=require(_0x8cf5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8cf5('0x2'));var jsonpatch=require(_0x8cf5('0x3'));var rp=require('request-promise');var moment=require(_0x8cf5('0x4'));var BPromise=require(_0x8cf5('0x5'));var Mustache=require(_0x8cf5('0x6'));var util=require(_0x8cf5('0x7'));var path=require('path');var sox=require(_0x8cf5('0x8'));var csv=require(_0x8cf5('0x9'));var ejs=require(_0x8cf5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cf5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8cf5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8cf5('0xd'));var Redis=require(_0x8cf5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8cf5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cf5('0x10'))(_0x8cf5('0x11'));var utils=require(_0x8cf5('0x12'));var config=require(_0x8cf5('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8cf5('0x14')](config[_0x8cf5('0x15')],{'host':_0x8cf5('0x16'),'port':0x18eb});var socket=require(_0x8cf5('0x17'))(new Redis(config[_0x8cf5('0x15')]));require(_0x8cf5('0x18'))[_0x8cf5('0x19')](socket);var jayson=require(_0x8cf5('0x1a'));var client=jayson[_0x8cf5('0x1b')][_0x8cf5('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3d00c5,_0xfb619c,_0x4a4a4a){if(_0x4a4a4a){var _0x42215b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42215b[_0x8cf5('0x1d')](_0xfb619c)){return _0x3d00c5;}else{throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x20'));}}else{return _0x3d00c5;}}function respondWithRpcPromise(_0x29586a,_0x4ca0d8,_0x1fdaf0,_0x1a1e34){return new BPromise(function(_0x144694,_0x15a6a8){var _0x1ba86c=_0x1a1e34||client;return _0x1ba86c[_0x8cf5('0x21')](_0x29586a,_0x1fdaf0)[_0x8cf5('0x22')](function(_0x2efab1){logger[_0x8cf5('0x23')](_0x8cf5('0x24'),_0x4ca0d8,_0x8cf5('0x25'));logger['debug'](_0x8cf5('0x26'),_0x4ca0d8,'request\x20sent',JSON[_0x8cf5('0x27')](_0x2efab1));if(_0x2efab1['error']){if(_0x2efab1[_0x8cf5('0x28')][_0x8cf5('0x29')]===0x1f4){logger['error'](_0x8cf5('0x24'),_0x4ca0d8,_0x2efab1[_0x8cf5('0x28')][_0x8cf5('0x2a')]);return _0x15a6a8(_0x2efab1[_0x8cf5('0x28')][_0x8cf5('0x2a')]);}logger['error'](_0x8cf5('0x24'),_0x4ca0d8,_0x2efab1['error']['message']);return _0x144694(_0x2efab1[_0x8cf5('0x28')][_0x8cf5('0x2a')]);}else{logger[_0x8cf5('0x23')](_0x8cf5('0x24'),_0x4ca0d8,'request\x20sent');_0x144694(_0x2efab1[_0x8cf5('0x2b')][_0x8cf5('0x2a')]);}})[_0x8cf5('0x2c')](function(_0x5edad0){logger[_0x8cf5('0x28')](_0x8cf5('0x24'),_0x4ca0d8,_0x5edad0);_0x15a6a8(_0x5edad0);});});}function respondWithStatusCode(_0x1c0a0c,_0xdd1cba){_0xdd1cba=_0xdd1cba||0xcc;return function(_0x2308e2){if(_0x2308e2){return _0x1c0a0c[_0x8cf5('0x2d')](_0xdd1cba);}return _0x1c0a0c[_0x8cf5('0x2e')](_0xdd1cba)['end']();};}function respondWithResult(_0x5a5f99,_0x21f9b2){_0x21f9b2=_0x21f9b2||0xc8;return function(_0x2179c7){if(_0x2179c7){return _0x5a5f99['status'](_0x21f9b2)[_0x8cf5('0x2f')](_0x2179c7);}};}function respondWithFilteredResult(_0x2dfc9a,_0x103b01){return function(_0x257bfd){if(_0x257bfd){var _0x49970c=_0x257bfd[_0x8cf5('0x30')],_0x4c58a5=_0x103b01[_0x8cf5('0x31')],_0x4570dd=_0x103b01[_0x8cf5('0x31')]+_0x103b01['limit'],_0x5d9940;if(_0x4570dd>=_0x49970c){_0x4570dd=_0x49970c;_0x5d9940=0xc8;}else{_0x5d9940=0xce;}_0x2dfc9a['status'](_0x5d9940);return _0x2dfc9a[_0x8cf5('0x32')]('Content-Range',_0x4c58a5+'-'+_0x4570dd+'/'+_0x49970c)[_0x8cf5('0x2f')](_0x257bfd);}return null;};}function patchUpdates(_0x28be8f){return function(_0x128f56){try{jsonpatch[_0x8cf5('0x33')](_0x128f56,_0x28be8f,!![]);}catch(_0x4b307c){return BPromise[_0x8cf5('0x34')](_0x4b307c);}return _0x128f56['save']();};}function saveUpdates(_0x4c567f,_0x4cfeb0){return function(_0xb0bbc0){if(_0xb0bbc0){return _0xb0bbc0[_0x8cf5('0x35')](_0x4c567f)['then'](function(_0xc8c9e7){return _0xc8c9e7;});}return null;};}function removeEntity(_0x5ce73a,_0x1748bc){return function(_0xd37797){if(_0xd37797){return _0xd37797[_0x8cf5('0x36')]()[_0x8cf5('0x22')](function(){var _0x117c43=_0xd37797[_0x8cf5('0x37')]({'plain':!![]});var _0x1086a3=[{'name':_0x8cf5('0x38'),'value':_0x8cf5('0x39'),'ignore':!![]},{'name':_0x8cf5('0x3a'),'value':_0x8cf5('0x3b'),'ignore':![]},{'name':_0x8cf5('0x3c'),'value':_0x8cf5('0x3d'),'ignore':![]}];var _0x3fd158=_(_0x1086a3)[_0x8cf5('0x3e')]('ignore')[_0x8cf5('0x3f')]('value')[_0x8cf5('0x40')]();if(_[_0x8cf5('0x41')](_0x3fd158,_0x117c43[_0x8cf5('0x42')])){return;}var _0x496157=_[_0x8cf5('0x43')](_0x1086a3,[_0x8cf5('0x40'),_0x117c43['role']])[_0x8cf5('0x44')];return db['UserProfileResource'][_0x8cf5('0x36')]({'where':{'type':_0x496157,'resourceId':_0x117c43['id']}})['then'](function(){return _0xd37797;});})[_0x8cf5('0x22')](function(){_0x5ce73a[_0x8cf5('0x2e')](0xcc)[_0x8cf5('0x45')]();});}};}function handleEntityNotFound(_0x44c6c5,_0x24811d){return function(_0x43409a){if(!_0x43409a){_0x44c6c5['sendStatus'](0x194);}return _0x43409a;};}function handleError(_0x58042e,_0x4550fa){_0x4550fa=_0x4550fa||0x1f4;return function(_0x3e5657){logger[_0x8cf5('0x28')](_0x3e5657[_0x8cf5('0x46')]);if(_0x3e5657[_0x8cf5('0x44')]){delete _0x3e5657[_0x8cf5('0x44')];}_0x58042e['status'](_0x4550fa)[_0x8cf5('0x47')](_0x3e5657);};}exports[_0x8cf5('0x48')]=function(_0x2fbdb5,_0x988a53){var _0x426269={},_0x460d44={},_0x2efeb0={'count':0x0,'rows':[]};var _0x475098=_[_0x8cf5('0x3f')](db['User']['rawAttributes'],function(_0x3c7262){return{'name':_0x3c7262[_0x8cf5('0x49')],'type':_0x3c7262[_0x8cf5('0x4a')]['key']};});_0x460d44[_0x8cf5('0x4b')]=_[_0x8cf5('0x4c')](_[_0x8cf5('0x3f')](_0x475098,_0x8cf5('0x44')),[_0x8cf5('0x4d'),_0x8cf5('0x4e')]);_0x460d44[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x2fbdb5[_0x8cf5('0x4f')]);_0x460d44[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x460d44['model'],_0x460d44[_0x8cf5('0x4f')]);_0x426269[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x460d44[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x426269[_0x8cf5('0x53')]=_0x426269[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x426269[_0x8cf5('0x53')]:_0x460d44[_0x8cf5('0x4b')];if(!_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x56')]('nolimit')){_0x426269[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x2fbdb5[_0x8cf5('0x4f')]['limit']);_0x426269[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}_0x426269[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x426269['where']=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x2fbdb5[_0x8cf5('0x4f')],_0x460d44[_0x8cf5('0x51')]),_0x475098);if(_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x426269['where']=_[_0x8cf5('0x5b')](_0x426269['where'],{'$or':_[_0x8cf5('0x3f')](_0x475098,function(_0x3c50d2){if(_0x3c50d2['type']!=='VIRTUAL'){return db[_0x8cf5('0x5c')][_0x8cf5('0x5d')](db['sequelize']['fn'](_0x8cf5('0x5e'),db[_0x8cf5('0x5c')][_0x8cf5('0x5f')](_0x3c50d2[_0x8cf5('0x44')])),{'$like':db['sequelize']['fn'](_0x8cf5('0x5e'),'%'+_0x2fbdb5[_0x8cf5('0x4f')]['filter']+'%')});}})});}_0x426269=_['merge']({},_0x426269,_0x2fbdb5[_0x8cf5('0x60')]);var _0x2c692e={'where':_0x426269[_0x8cf5('0x5d')]};return db['User'][_0x8cf5('0x30')](_0x2c692e)['then'](function(_0x426c48){_0x2efeb0['count']=_0x426c48;if(_0x2fbdb5[_0x8cf5('0x4f')][_0x8cf5('0x61')]){_0x426269[_0x8cf5('0x62')]=[{'all':!![]}];}return db[_0x8cf5('0x63')][_0x8cf5('0x64')](_0x426269);})[_0x8cf5('0x22')](function(_0x5cbeb7){_0x2efeb0[_0x8cf5('0x65')]=_0x5cbeb7;return _0x2efeb0;})[_0x8cf5('0x22')](respondWithFilteredResult(_0x988a53,_0x426269))['catch'](handleError(_0x988a53,null));};exports['show']=function(_0x1edf77,_0x112392){var _0x68ef39={'raw':![],'where':{'id':_0x1edf77[_0x8cf5('0x66')]['id']}},_0x28514a={};_0x28514a[_0x8cf5('0x4b')]=_[_0x8cf5('0x4c')](_['keys'](db['User']['rawAttributes']),[_0x8cf5('0x4d'),_0x8cf5('0x4e')]);_0x28514a['query']=_[_0x8cf5('0x50')](_0x1edf77['query']);_0x28514a[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x28514a['model'],_0x28514a[_0x8cf5('0x4f')]);_0x68ef39['attributes']=_[_0x8cf5('0x52')](_0x28514a[_0x8cf5('0x4b')],qs['fields'](_0x1edf77[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x68ef39[_0x8cf5('0x53')]=_0x68ef39['attributes'][_0x8cf5('0x55')]?_0x68ef39[_0x8cf5('0x53')]:_0x28514a[_0x8cf5('0x4b')];if(_0x1edf77['query']['includeAll']){_0x68ef39['include']=[{'all':!![]}];}_0x68ef39=_[_0x8cf5('0x5b')]({},_0x68ef39,_0x1edf77[_0x8cf5('0x60')]);return db[_0x8cf5('0x63')][_0x8cf5('0x43')](_0x68ef39)[_0x8cf5('0x22')](handleEntityNotFound(_0x112392,null))[_0x8cf5('0x22')](respondWithResult(_0x112392,null))[_0x8cf5('0x2c')](handleError(_0x112392,null));};exports[_0x8cf5('0x67')]=function(_0x27c193,_0x55f12a){return db[_0x8cf5('0x63')][_0x8cf5('0x67')](_0x27c193['body'],{'raw':![],'individualHooks':!![]})[_0x8cf5('0x22')](respondWithResult(_0x55f12a,0xc9))[_0x8cf5('0x2c')](handleError(_0x55f12a,null));};exports[_0x8cf5('0x35')]=function(_0x30c687,_0x1f79a1){if(_0x30c687[_0x8cf5('0x68')]['id']){delete _0x30c687['body']['id'];}delete _0x30c687[_0x8cf5('0x68')][_0x8cf5('0x42')];return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x30c687[_0x8cf5('0x66')]['id']}})['then'](handleEntityNotFound(_0x1f79a1,null))[_0x8cf5('0x22')](saveUpdates(_0x30c687[_0x8cf5('0x68')],null))[_0x8cf5('0x22')](respondWithResult(_0x1f79a1,null))[_0x8cf5('0x2c')](handleError(_0x1f79a1,null));};exports[_0x8cf5('0x69')]=function(_0x54222b,_0x1cf320){return db['User'][_0x8cf5('0x69')]()['then'](respondWithResult(_0x1cf320,null))[_0x8cf5('0x2c')](handleError(_0x1cf320,null));};exports['addContacts']=function(_0x4c5724,_0x3db8a2,_0x274ec9){return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x4c5724[_0x8cf5('0x66')]['id']}})['then'](handleEntityNotFound(_0x3db8a2,null))[_0x8cf5('0x22')](function(_0x189dd1){if(_0x189dd1){return _0x189dd1[_0x8cf5('0x6a')](_0x4c5724['body']['ids'],_[_0x8cf5('0x6b')](_0x4c5724['body'],[_0x8cf5('0x6c'),'id'])||{});}})[_0x8cf5('0x22')](respondWithResult(_0x3db8a2,null))[_0x8cf5('0x2c')](handleError(_0x3db8a2,null));};var getLicense=function(_0x5b4386){return new BPromise(function(_0x173bd4,_0x3f432c){var _0x67cc=0x0;_0x5b4386[_0x8cf5('0x68')]['role']==='agent'&&_0x173bd4(_0x8cf5('0x6d'));return db[_0x8cf5('0x63')]['count']({'where':{'$or':[{'role':_0x5b4386[_0x8cf5('0x68')][_0x8cf5('0x42')]===_0x8cf5('0x3d')?_0x8cf5('0x3d'):[_0x8cf5('0x6e'),_0x8cf5('0x39')]}]}})['then'](function(_0x58427e){_0x67cc=_0x58427e;return require('../../config/license/util')[_0x8cf5('0x6f')]();})['then'](function(_0x215065){var _0x44dcfd=_0x5b4386['body'][_0x8cf5('0x42')]==='telephone'?'telephones':_0x8cf5('0x70');if(!_[_0x8cf5('0x71')](_0x215065[_0x44dcfd])&&_0x67cc>=_0x215065[_0x44dcfd]){return _0x3f432c({'message':'License\x20limit\x20reached'});}return _0x173bd4(util[_0x8cf5('0x72')](_0x8cf5('0x73'),_0x44dcfd,_0x67cc));})['catch'](function(_0xbb2288){return _0x3f432c(_0xbb2288);});});};exports[_0x8cf5('0x74')]=function(_0x23de27,_0x3bba80){return getLicense(_0x23de27)[_0x8cf5('0x22')](function(_0x1c83a2){if(!_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')]){var _0x5ad5ed;return db['Setting'][_0x8cf5('0x76')](0x1)['then'](function(_0x55304e){return checkPasswordPattern(_0x55304e,_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x4d')],_0x55304e['securePassword']);})[_0x8cf5('0x22')](function(_0x3ada23){_0x5ad5ed=_0x3ada23[_0x8cf5('0x77')];return db[_0x8cf5('0x63')][_0x8cf5('0x78')](_0x8cf5('0x75'));})['then'](function(_0x7bee99){if(_[_0x8cf5('0x71')](_0x7bee99)){if(_0x5ad5ed){_0x23de27['body'][_0x8cf5('0x75')]=_0x5ad5ed;}else{_0x23de27['body'][_0x8cf5('0x75')]=0x1;}}else{if(_['isNil'](_0x5ad5ed)||_0x5ad5ed==_0x7bee99){_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')]=_0x7bee99+0x1;}else if(_0x5ad5ed>_0x7bee99){_0x23de27[_0x8cf5('0x68')]['internal']=_0x5ad5ed;}else{return db['sequelize'][_0x8cf5('0x4f')](_0x8cf5('0x79'),{'type':db[_0x8cf5('0x5c')][_0x8cf5('0x7a')][_0x8cf5('0x7b')]})['then'](function(_0x277dce){if(_0x277dce&&_0x277dce[_0x8cf5('0x55')]){for(var _0x517710=0x0,_0x4a3eb9=_0x277dce[_0x8cf5('0x55')];_0x517710<_0x4a3eb9&&_[_0x8cf5('0x71')](_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')]);_0x517710++){if(_0x5ad5ed<=_0x277dce[_0x517710]['from']){_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')]=_0x277dce[_0x517710]['from'];}else if(_0x5ad5ed>_0x277dce[_0x517710]['from']&&_0x5ad5ed<=_0x277dce[_0x517710]['to']){_0x23de27['body'][_0x8cf5('0x75')]=_0x5ad5ed;}}}if(_[_0x8cf5('0x71')](_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')])){_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x75')]=_0x7bee99+0x1;}});}}});}})[_0x8cf5('0x22')](function(){if(_0x23de27['body'][_0x8cf5('0x7c')]){_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x7d')]=_0x23de27[_0x8cf5('0x68')]['internal'];_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x7e')]={'mailbox':_0x23de27[_0x8cf5('0x68')]['internal'],'password':_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x4d')],'fullname':_0x23de27['body']['fullname'],'email':_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x7f')]};}if(_0x23de27['body']&&_0x23de27['body'][_0x8cf5('0x42')]==='agent'){if(!_0x23de27['body'][_0x8cf5('0x80')]){_0x23de27[_0x8cf5('0x68')][_0x8cf5('0x80')]=[_0x8cf5('0x81'),'102',_0x8cf5('0x82'),_0x8cf5('0x83'),'110',_0x8cf5('0x84'),_0x8cf5('0x85'),_0x8cf5('0x86'),_0x8cf5('0x87'),_0x8cf5('0x88'),'109','100','111',_0x8cf5('0x89')];}}return db[_0x8cf5('0x63')][_0x8cf5('0x74')](_0x23de27[_0x8cf5('0x68')],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x8cf5('0x22')](function(_0x248bb8){if(_0x23de27[_0x8cf5('0x68')]['role']===_0x8cf5('0x39'))return _0x248bb8;var _0x35c024=_0x23de27[_0x8cf5('0x39')][_0x8cf5('0x37')]({'plain':!![]});if(!_0x35c024)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35c024[_0x8cf5('0x42')]===_0x8cf5('0x39')){var _0x2d6589=_0x248bb8[_0x8cf5('0x37')]({'plain':!![]});var _0xa17bc1=[{'name':_0x8cf5('0x3a'),'value':'agent'},{'name':'Telephones','value':'telephone'}];var _0x22b64b=_[_0x8cf5('0x43')](_0xa17bc1,[_0x8cf5('0x40'),_0x2d6589['role']])[_0x8cf5('0x44')];return db[_0x8cf5('0x8a')]['find']({'where':{'name':_0x22b64b,'userProfileId':_0x35c024['userProfileId']},'raw':!![]})[_0x8cf5('0x22')](function(_0x29cb45){if(_0x29cb45&&_0x29cb45['autoAssociation']===0x0){return db[_0x8cf5('0x8b')][_0x8cf5('0x74')]({'name':_0x2d6589[_0x8cf5('0x44')],'resourceId':_0x2d6589['id'],'type':_0x29cb45[_0x8cf5('0x44')],'sectionId':_0x29cb45['id']},{})[_0x8cf5('0x22')](function(){return _0x248bb8;});}else{return _0x248bb8;}})[_0x8cf5('0x2c')](function(_0x2019a3){logger[_0x8cf5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2019a3);throw _0x2019a3;});}return _0x248bb8;})[_0x8cf5('0x22')](respondWithResult(_0x3bba80,0xc9))[_0x8cf5('0x2c')](handleError(_0x3bba80,null));};exports[_0x8cf5('0x8c')]=function(_0x2a67f2,_0x1821a4,_0x454d76){var _0x1fec2d=![];if(_0x2a67f2['body']['id']){delete _0x2a67f2['body']['id'];}return db[_0x8cf5('0x8d')][_0x8cf5('0x8e')]({'attributes':['id','securePassword']})[_0x8cf5('0x22')](function(_0x3fd555){_0x1fec2d=_0x3fd555[_0x8cf5('0x8f')];return db[_0x8cf5('0x63')]['find']({'where':{'id':_0x2a67f2[_0x8cf5('0x66')]['id']}});})[_0x8cf5('0x22')](function(_0x3c4cd8){if(_0x3c4cd8){if(_0x3c4cd8['id']==_0x2a67f2[_0x8cf5('0x39')]['id']){if(!_0x2a67f2[_0x8cf5('0x68')]['oldPassword']||!_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x90')]){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x91'));}if(!_0x3c4cd8[_0x8cf5('0x92')](_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x93')])){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x94'));}if(_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x93')]==_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x90')]){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x95'));}return _0x3c4cd8;}else if(_0x2a67f2[_0x8cf5('0x39')][_0x8cf5('0x42')]=='admin'){if(!_0x2a67f2[_0x8cf5('0x68')]['newPassword']){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x3c4cd8;}else if(_0x2a67f2[_0x8cf5('0x39')][_0x8cf5('0x42')]==_0x8cf5('0x39')){if(!_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x90')]){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3c4cd8[_0x8cf5('0x42')]!=_0x8cf5('0x3b')){throw new db['Sequelize'][(_0x8cf5('0x1f'))](_0x8cf5('0x96'));}return _0x3c4cd8;}else{throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x96'));}}return null;})[_0x8cf5('0x22')](handleEntityNotFound(_0x1821a4,null))[_0x8cf5('0x22')](function(_0x25a639){return checkPasswordPattern(_0x25a639,_0x2a67f2[_0x8cf5('0x68')][_0x8cf5('0x90')],_0x1fec2d);})[_0x8cf5('0x22')](saveUpdates({'password':_0x2a67f2[_0x8cf5('0x68')]['newPassword'],'passwordResetAt':_0x2a67f2[_0x8cf5('0x39')]['id']==_0x2a67f2[_0x8cf5('0x66')]['id']?moment():null},null))[_0x8cf5('0x22')](respondWithResult(_0x1821a4,null))[_0x8cf5('0x2c')](handleError(_0x1821a4,null));};exports[_0x8cf5('0x97')]=function(_0x270c19,_0x88d99d,_0x4a422c){var _0x2b406e=_0x270c19[_0x8cf5('0x68')]['channel'];return db[_0x8cf5('0x63')]['find']({'where':{'id':_0x270c19[_0x8cf5('0x66')]['id']},'attributes':['id',_0x8cf5('0x44'),_0x8cf5('0x42'),'online',_0x8cf5('0x98'),_0x8cf5('0x99'),'interface']})[_0x8cf5('0x22')](handleEntityNotFound(_0x88d99d,null))[_0x8cf5('0x22')](function(_0x59dfc3){if(_0x59dfc3){if(!utils[_0x8cf5('0x9a')](_0x2b406e)){throw new db['Sequelize'][(_0x8cf5('0x1f'))](_0x8cf5('0x9b'));}return _0x59dfc3[_0x8cf5('0x9c')+_[_0x8cf5('0x9d')](_0x2b406e[_0x8cf5('0x9e')]())+_0x8cf5('0x9f')](_0x270c19[_0x8cf5('0x68')][_0x8cf5('0x6c')],{'penalty':_0x270c19[_0x8cf5('0x68')][_0x8cf5('0xa0')]||0x0})['spread'](function(_0x5d89e0){for(var _0x2f75a7=0x0;_0x2f75a7<_0x270c19[_0x8cf5('0x68')][_0x8cf5('0x6c')][_0x8cf5('0x55')];_0x2f75a7+=0x1){var _0x110376={'UserId':_0x270c19['params']['id']};_0x110376[_['capitalize'](_0x2b406e['toLowerCase']())+_0x8cf5('0xa1')]=_0x270c19[_0x8cf5('0x68')]['ids'][_0x2f75a7];socket[_0x8cf5('0xa2')](_0x8cf5('0x39')+_[_0x8cf5('0x9d')](_0x2b406e[_0x8cf5('0x9e')]())+_0x8cf5('0xa3'),_0x110376);}return _0x5d89e0;})[_0x8cf5('0x22')](function(){if(_0x2b406e===_0x8cf5('0xa4')){return db['VoiceQueue'][_0x8cf5('0x64')]({'where':{'id':_0x270c19['body']['ids']||[]},'raw':!![],'attributes':['id',_0x8cf5('0x44')]});}})[_0x8cf5('0x22')](function(_0x35ee42){var _0x1b246a=_0x59dfc3[_0x8cf5('0x37')]({'plain':!![]});var _0x29d83e=[];if(_0x2b406e===_0x8cf5('0xa4')&&_0x1b246a[_0x8cf5('0x42')]==='agent'&&_0x1b246a[_0x8cf5('0xa5')]){for(var _0x488675=0x0;_0x488675<_0x35ee42[_0x8cf5('0x55')];_0x488675+=0x1){_0x29d83e[_0x8cf5('0xa6')]({'membername':_0x1b246a[_0x8cf5('0x44')],'UserId':_0x1b246a['id'],'queue_name':_0x35ee42[_0x488675][_0x8cf5('0x44')],'VoiceQueueId':_0x35ee42[_0x488675]['id'],'interface':_[_0x8cf5('0x71')](_0x1b246a[_0x8cf5('0xa7')])?util[_0x8cf5('0x72')](_0x8cf5('0xa8'),_0x1b246a[_0x8cf5('0x44')]):_0x1b246a[_0x8cf5('0xa7')],'paused':_0x1b246a['voicePause']||![],'penalty':_0x270c19[_0x8cf5('0x68')]['penalty']||0x0});}return BPromise[_0x8cf5('0xa9')](_0x29d83e,function(_0x5e1360){return db['UserVoiceQueueRt'][_0x8cf5('0xaa')](_0x5e1360);});}return _0x59dfc3;});}})[_0x8cf5('0x22')](respondWithStatusCode(_0x88d99d,null))[_0x8cf5('0x2c')](handleError(_0x88d99d,null));};exports[_0x8cf5('0xab')]=function(_0x579706,_0x5a5e82,_0x354e02){var _0x562967;return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x579706[_0x8cf5('0x66')]['id']},'attributes':['id',_0x8cf5('0x44'),'role']})['then'](handleEntityNotFound(_0x5a5e82,null))[_0x8cf5('0x22')](function(_0x4b102e){if(_0x4b102e){_0x562967=_0x4b102e;if(!_0x579706[_0x8cf5('0x4f')][_0x8cf5('0xac')]||!utils['isValidChannel'](_0x579706[_0x8cf5('0x4f')][_0x8cf5('0xac')])){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0x9b'));}return _0x4b102e['remove'+_[_0x8cf5('0x9d')](_0x579706['query']['channel'][_0x8cf5('0x9e')]())+_0x8cf5('0x9f')](_0x579706[_0x8cf5('0x4f')][_0x8cf5('0x6c')]);}})[_0x8cf5('0x22')](function(_0x495050){for(var _0x306d4b=0x0;_0x306d4b<_0x579706[_0x8cf5('0x4f')][_0x8cf5('0x6c')]['length'];_0x306d4b+=0x1){var _0x58ebd1={'UserId':_0x579706[_0x8cf5('0x66')]['id']};_0x58ebd1[_[_0x8cf5('0x9d')](_0x579706[_0x8cf5('0x4f')][_0x8cf5('0xac')]['toLowerCase']())+'QueueId']=_0x579706[_0x8cf5('0x4f')][_0x8cf5('0x6c')][_0x306d4b];socket[_0x8cf5('0xa2')](_0x8cf5('0x39')+_[_0x8cf5('0x9d')](_0x579706[_0x8cf5('0x4f')][_0x8cf5('0xac')][_0x8cf5('0x9e')]())+_0x8cf5('0xad'),_0x58ebd1);}return _0x495050;})[_0x8cf5('0x22')](function(){if(_0x579706[_0x8cf5('0x4f')][_0x8cf5('0xac')]===_0x8cf5('0xa4')){return db[_0x8cf5('0xae')]['destroy']({'where':{'UserId':_0x579706[_0x8cf5('0x66')]['id'],'VoiceQueueId':_0x579706[_0x8cf5('0x4f')][_0x8cf5('0x6c')]},'individualHooks':!![]})['then'](function(){return _0x562967;});}return _0x562967;})[_0x8cf5('0x22')](respondWithStatusCode(_0x5a5e82,null))['catch'](handleError(_0x5a5e82,null));};exports[_0x8cf5('0xaf')]=function(_0x53d888,_0x5e2e77,_0x10f5c0){_0x53d888[_0x8cf5('0x68')]['userpic']=_0x53d888[_0x8cf5('0xb0')][_0x8cf5('0xb1')];return db['User'][_0x8cf5('0x43')]({'where':{'id':_0x53d888[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x5e2e77,null))[_0x8cf5('0x22')](saveUpdates(_0x53d888[_0x8cf5('0x68')],null))['then'](respondWithResult(_0x5e2e77,null))[_0x8cf5('0x2c')](handleError(_0x5e2e77,null));};exports['getAvatar']=function(_0x56d4ef,_0x31a28c,_0x436ba0){var _0x518452=path[_0x8cf5('0xb2')](config[_0x8cf5('0xb3')],'server/files/images/logos/default_profile.png');return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x56d4ef[_0x8cf5('0x66')]['id']},'attributes':['id',_0x8cf5('0xb4')],'raw':!![]})[_0x8cf5('0x22')](handleEntityNotFound(_0x31a28c,null))['then'](function(_0x1b659d){if(_0x1b659d){if(_[_0x8cf5('0x71')](_0x1b659d[_0x8cf5('0xb4')])){return _0x31a28c['download'](_0x518452);}else{if(!fs[_0x8cf5('0xb5')](path['join'](config['root'],_0x8cf5('0xb6'),_0x1b659d[_0x8cf5('0xb4')]))){return _0x31a28c[_0x8cf5('0xb7')](_0x518452);}return _0x31a28c[_0x8cf5('0xb7')](path[_0x8cf5('0xb2')](config[_0x8cf5('0xb3')],'server/files/images/',_0x1b659d['userpic']));}}})[_0x8cf5('0x2c')](handleError(_0x31a28c,null));};exports[_0x8cf5('0xb8')]=function(_0xf762de,_0x46d588,_0x5eae26){var _0x4ad45b={};var _0x189f8c={};var _0x416b37;var _0x329cf0;return db['User'][_0x8cf5('0x8e')]({'where':{'id':_0xf762de[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x46d588,null))[_0x8cf5('0x22')](function(_0x4a9804){if(_0x4a9804){_0x416b37=_0x4a9804;_0x189f8c[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xb9')][_0x8cf5('0xba')]);_0x189f8c['query']=_[_0x8cf5('0x50')](_0xf762de[_0x8cf5('0x4f')]);_0x189f8c[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x189f8c[_0x8cf5('0x4b')],_0x189f8c[_0x8cf5('0x4f')]);_0x4ad45b[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x189f8c['model'],qs[_0x8cf5('0x54')](_0xf762de[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x4ad45b[_0x8cf5('0x53')]=_0x4ad45b[_0x8cf5('0x53')]['length']?_0x4ad45b[_0x8cf5('0x53')]:_0x189f8c[_0x8cf5('0x4b')];_0x4ad45b['order']=qs[_0x8cf5('0x59')](_0xf762de['query']['sort']);_0x4ad45b[_0x8cf5('0x5d')]=qs['filters'](_[_0x8cf5('0x5a')](_0xf762de[_0x8cf5('0x4f')],_0x189f8c[_0x8cf5('0x51')]));if(_0xf762de[_0x8cf5('0x4f')]['filter']){_0x4ad45b['where']=_[_0x8cf5('0x5b')](_0x4ad45b['where'],{'$or':_[_0x8cf5('0x3f')](_0x4ad45b[_0x8cf5('0x53')],function(_0x1e6676){var _0xec276b={};_0xec276b[_0x1e6676]={'$like':'%'+_0xf762de['query']['filter']+'%'};return _0xec276b;})});}_0x4ad45b=_['merge']({},_0x4ad45b,_0xf762de[_0x8cf5('0x60')]);return _0x416b37[_0x8cf5('0xb8')](_0x4ad45b);}})[_0x8cf5('0x22')](function(_0x3bb69d){if(_0x3bb69d){_0x329cf0=_0x3bb69d[_0x8cf5('0x55')];if(_0xf762de['query']['hasOwnProperty'](_0x8cf5('0x61'))){_0x4ad45b['include']=[{'model':db[_0x8cf5('0xbb')],'as':_0x8cf5('0xbc'),'required':![]},{'model':db[_0x8cf5('0xbd')],'as':_0x8cf5('0xbe'),'attributes':['id',_0x8cf5('0x44'),_0x8cf5('0xbf')],'where':_0xf762de[_0x8cf5('0x4f')][_0x8cf5('0xc0')]?{'id':_0xf762de[_0x8cf5('0x4f')][_0x8cf5('0xc0')]}:undefined,'required':_0xf762de[_0x8cf5('0x4f')]['tag']?!![]:![]}];}if(!_0xf762de[_0x8cf5('0x4f')][_0x8cf5('0x56')]('nolimit')){_0x4ad45b[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0xf762de[_0x8cf5('0x4f')]['limit']);_0x4ad45b['offset']=qs[_0x8cf5('0x31')](_0xf762de[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x416b37[_0x8cf5('0xb8')](_0x4ad45b);}})[_0x8cf5('0x22')](function(_0x52aa70){if(_0x52aa70){return _0x52aa70?{'count':_0x329cf0,'rows':_0x52aa70}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x46d588,null))['catch'](handleError(_0x46d588,null));};exports['getQueues']=function(_0x2f3a17,_0x46e76c,_0xaedb89){var _0x50b27e;var _0x22d7b6;var _0x323578={};var _0x630eec;return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x2f3a17['params']['id']},'attributes':['id',_0x8cf5('0x44'),_0x8cf5('0x42')]})['then'](handleEntityNotFound(_0x46e76c,null))[_0x8cf5('0x22')](function(_0x4ceb1d){if(!utils[_0x8cf5('0x9a')](_0x2f3a17['query'][_0x8cf5('0xac')])){throw new db['Sequelize'][(_0x8cf5('0x1f'))](_0x8cf5('0x9b'));}_0x50b27e=_0x4ceb1d;var _0x59f513={};_0x59f513[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_[_0x8cf5('0x9d')](_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0xac')])+'Queue']['rawAttributes']);_0x59f513[_0x8cf5('0x4f')]=_['keys'](_0x2f3a17[_0x8cf5('0x4f')]);_0x59f513[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x59f513[_0x8cf5('0x4b')],_0x59f513[_0x8cf5('0x4f')]);_0x323578[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x59f513[_0x8cf5('0x4b')],qs['fields'](_0x2f3a17['query'][_0x8cf5('0x54')]));_0x323578[_0x8cf5('0x53')]=_0x323578[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x323578[_0x8cf5('0x53')]:_0x59f513[_0x8cf5('0x4b')];_0x323578[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x2f3a17[_0x8cf5('0x4f')]['sort']);_0x323578['where']=qs['filters'](_[_0x8cf5('0x5a')](_0x2f3a17[_0x8cf5('0x4f')],_0x59f513[_0x8cf5('0x51')]));if(_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x323578['where']=_[_0x8cf5('0x5b')](_0x323578[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x323578[_0x8cf5('0x53')],function(_0xcb04c6){var _0xf83d93={};_0xf83d93[_0xcb04c6]={'$like':'%'+_0x2f3a17[_0x8cf5('0x4f')]['filter']+'%'};return _0xf83d93;})});}_0x323578=_['merge']({},_0x323578,_0x2f3a17[_0x8cf5('0x60')]);switch(_0x50b27e[_0x8cf5('0x42')]){case _0x8cf5('0x6e'):return db[_[_0x8cf5('0x9d')](_0x2f3a17['query']['channel'])+'Queue'][_0x8cf5('0x64')](_0x323578);case _0x8cf5('0x39'):case'agent':return _0x50b27e['get'+_[_0x8cf5('0x9d')](_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0xac')])+_0x8cf5('0x9f')](_0x323578);default:throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))]('Unknown\x20role');}})[_0x8cf5('0x22')](function(_0x51ea8c){_0x630eec=_0x51ea8c[_0x8cf5('0x55')];if(!_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x323578[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0x57')]);_0x323578[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}switch(_0x50b27e[_0x8cf5('0x42')]){case _0x8cf5('0x6e'):return db[_['capitalize'](_0x2f3a17[_0x8cf5('0x4f')][_0x8cf5('0xac')])+_0x8cf5('0xc2')]['findAll'](_0x323578);case _0x8cf5('0x39'):case'agent':return _0x50b27e['get'+_[_0x8cf5('0x9d')](_0x2f3a17[_0x8cf5('0x4f')]['channel'])+_0x8cf5('0x9f')](_0x323578);}})[_0x8cf5('0x22')](function(_0x2895a4){return{'count':_0x630eec,'rows':_0x2895a4};})[_0x8cf5('0x22')](respondWithResult(_0x46e76c,null))[_0x8cf5('0x2c')](handleError(_0x46e76c,null));};exports['getVoiceQueuesRt']=function(_0x57dfbc,_0x33e6c6,_0x19a9f7){var _0xda4cfd={};var _0x41ad00={};var _0x236f87;var _0x419508;return db['User'][_0x8cf5('0x8e')]({'where':{'id':_0x57dfbc[_0x8cf5('0x66')]['id']}})['then'](handleEntityNotFound(_0x33e6c6,null))[_0x8cf5('0x22')](function(_0x2fec63){if(_0x2fec63){_0x236f87=_0x2fec63;_0x41ad00[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db['UserVoiceQueueRt'][_0x8cf5('0xba')]);_0x41ad00['query']=_[_0x8cf5('0x50')](_0x57dfbc[_0x8cf5('0x4f')]);_0x41ad00[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x41ad00['model'],_0x41ad00['query']);_0xda4cfd[_0x8cf5('0x53')]=_['intersection'](_0x41ad00[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x57dfbc[_0x8cf5('0x4f')]['fields']));_0xda4cfd['attributes']=_0xda4cfd['attributes'][_0x8cf5('0x55')]?_0xda4cfd['attributes']:_0x41ad00[_0x8cf5('0x4b')];_0xda4cfd[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x57dfbc['query'][_0x8cf5('0x59')]);_0xda4cfd[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_['pick'](_0x57dfbc[_0x8cf5('0x4f')],_0x41ad00[_0x8cf5('0x51')]));if(_0x57dfbc[_0x8cf5('0x4f')]['filter']){_0xda4cfd[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0xda4cfd['where'],{'$or':_[_0x8cf5('0x3f')](_0xda4cfd[_0x8cf5('0x53')],function(_0x48c8c5){var _0x31f709={};_0x31f709[_0x48c8c5]={'$like':'%'+_0x57dfbc[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0x31f709;})});}_0xda4cfd=_['merge']({},_0xda4cfd,_0x57dfbc[_0x8cf5('0x60')]);return _0x236f87[_0x8cf5('0xc3')](_0xda4cfd);}})['then'](function(_0x40e8da){if(_0x40e8da){_0x419508=_0x40e8da[_0x8cf5('0x55')];if(!_0x57dfbc['query'][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0xda4cfd['limit']=qs[_0x8cf5('0x57')](_0x57dfbc[_0x8cf5('0x4f')]['limit']);_0xda4cfd[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x57dfbc[_0x8cf5('0x4f')]['offset']);}return _0x236f87['getVoiceQueuesRt'](_0xda4cfd);}})[_0x8cf5('0x22')](function(_0xdb393d){if(_0xdb393d){return _0xdb393d?{'count':_0x419508,'rows':_0xdb393d}:null;}})['then'](respondWithResult(_0x33e6c6,null))[_0x8cf5('0x2c')](handleError(_0x33e6c6,null));};exports[_0x8cf5('0xc4')]=function(_0x59b9c8,_0x398f98,_0x5d47a2){var _0x33b449={};var _0x4bed90={};var _0x58d25f;var _0x38a49f;return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x59b9c8[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x398f98,null))[_0x8cf5('0x22')](function(_0x2b3e12){if(_0x2b3e12){_0x58d25f=_0x2b3e12;_0x4bed90[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xc5')][_0x8cf5('0xba')]);_0x4bed90[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x59b9c8[_0x8cf5('0x4f')]);_0x4bed90[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x4bed90['model'],_0x4bed90[_0x8cf5('0x4f')]);_0x33b449[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x4bed90['model'],qs[_0x8cf5('0x54')](_0x59b9c8[_0x8cf5('0x4f')]['fields']));_0x33b449[_0x8cf5('0x53')]=_0x33b449['attributes']['length']?_0x33b449['attributes']:_0x4bed90[_0x8cf5('0x4b')];_0x33b449[_0x8cf5('0x58')]=qs['sort'](_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x33b449[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x59b9c8[_0x8cf5('0x4f')],_0x4bed90['filters']));if(_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x33b449['where']=_[_0x8cf5('0x5b')](_0x33b449[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x33b449[_0x8cf5('0x53')],function(_0x428d55){var _0x3774ad={};_0x3774ad[_0x428d55]={'$like':'%'+_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0x3774ad;})});}_0x33b449=_['merge']({},_0x33b449,_0x59b9c8[_0x8cf5('0x60')]);return _0x58d25f[_0x8cf5('0xc4')](_0x33b449);}})[_0x8cf5('0x22')](function(_0x2da548){if(_0x2da548){_0x38a49f=_0x2da548[_0x8cf5('0x55')];if(!_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x33b449[_0x8cf5('0x57')]=qs['limit'](_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x57')]);_0x33b449[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x59b9c8[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x58d25f[_0x8cf5('0xc4')](_0x33b449);}})[_0x8cf5('0x22')](function(_0x2f46e8){if(_0x2f46e8){return _0x2f46e8?{'count':_0x38a49f,'rows':_0x2f46e8}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x398f98,null))['catch'](handleError(_0x398f98,null));};exports[_0x8cf5('0xc6')]=function(_0x524ac5,_0xbd24f4,_0x3416f8){var _0x4eefe8={'raw':!![],'where':{}};var _0x5a572d={};var _0x2e441c={'count':0x0,'rows':[]};return db[_0x8cf5('0x63')]['findOne']({'where':{'id':_0x524ac5[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0xbd24f4,null))[_0x8cf5('0x22')](function(_0x1eb423){if(_0x1eb423){_0x5a572d['model']=_[_0x8cf5('0x50')](db[_0x8cf5('0xc7')]['rawAttributes']);_0x5a572d[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x524ac5[_0x8cf5('0x4f')]);_0x5a572d[_0x8cf5('0x51')]=_['intersection'](_0x5a572d['model'],_0x5a572d[_0x8cf5('0x4f')]);_0x4eefe8['attributes']=_['intersection'](_0x5a572d[_0x8cf5('0x4b')],qs['fields'](_0x524ac5[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x4eefe8['attributes']=_0x4eefe8[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x4eefe8['attributes']:_0x5a572d[_0x8cf5('0x4b')];if(!_0x524ac5[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x4eefe8['limit']=qs[_0x8cf5('0x57')](_0x524ac5[_0x8cf5('0x4f')][_0x8cf5('0x57')]);_0x4eefe8[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x524ac5[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}_0x4eefe8['order']=qs[_0x8cf5('0x59')](_0x524ac5[_0x8cf5('0x4f')]['sort']);_0x4eefe8[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_['pick'](_0x524ac5[_0x8cf5('0x4f')],_0x5a572d[_0x8cf5('0x51')]));_0x4eefe8['where'][_0x8cf5('0xc8')]=_0x1eb423['id'];if(_0x524ac5['query'][_0x8cf5('0x3e')]){_0x4eefe8['where']=_['merge'](_0x4eefe8['where'],{'$or':_['map'](_0x4eefe8[_0x8cf5('0x53')],function(_0x1eb00f){var _0x40920d={};_0x40920d[_0x1eb00f]={'$like':'%'+_0x524ac5['query']['filter']+'%'};return _0x40920d;})});}_0x4eefe8=_[_0x8cf5('0x5b')]({},_0x4eefe8,_0x524ac5[_0x8cf5('0x60')]);return db[_0x8cf5('0xc7')][_0x8cf5('0x30')]({'where':_0x4eefe8['where']})[_0x8cf5('0x22')](function(_0x2b3f1f){_0x2e441c[_0x8cf5('0x30')]=_0x2b3f1f;if(_0x524ac5[_0x8cf5('0x4f')]['includeAll']){_0x4eefe8[_0x8cf5('0x62')]=[{'all':!![]}];}return db[_0x8cf5('0xc7')][_0x8cf5('0x64')](_0x4eefe8);})[_0x8cf5('0x22')](function(_0x370c12){_0x2e441c[_0x8cf5('0x65')]=_0x370c12;return _0x2e441c;});}})[_0x8cf5('0x22')](respondWithFilteredResult(_0xbd24f4,_0x4eefe8))[_0x8cf5('0x2c')](handleError(_0xbd24f4,null));};exports[_0x8cf5('0xc9')]=function(_0x49ec8a,_0xc45654,_0x391448){var _0x404aa8={'raw':!![],'where':{}};var _0x4eb502={};var _0x153155={'count':0x0,'rows':[]};return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x49ec8a[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0xc45654,null))[_0x8cf5('0x22')](function(_0x2cd0e8){if(_0x2cd0e8){_0x4eb502[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xca')][_0x8cf5('0xba')]);_0x4eb502['query']=_[_0x8cf5('0x50')](_0x49ec8a['query']);_0x4eb502[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x4eb502[_0x8cf5('0x4b')],_0x4eb502[_0x8cf5('0x4f')]);_0x404aa8[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x4eb502['model'],qs[_0x8cf5('0x54')](_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x404aa8[_0x8cf5('0x53')]=_0x404aa8[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x404aa8[_0x8cf5('0x53')]:_0x4eb502[_0x8cf5('0x4b')];if(!_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x404aa8[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x57')]);_0x404aa8[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}_0x404aa8['order']=qs[_0x8cf5('0x59')](_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x404aa8[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_['pick'](_0x49ec8a[_0x8cf5('0x4f')],_0x4eb502['filters']));_0x404aa8[_0x8cf5('0x5d')][_0x8cf5('0xc8')]=_0x2cd0e8['id'];if(_0x49ec8a['query'][_0x8cf5('0x3e')]){_0x404aa8[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0x404aa8[_0x8cf5('0x5d')],{'$or':_['map'](_0x404aa8[_0x8cf5('0x53')],function(_0x37911d){var _0x3b32ea={};_0x3b32ea[_0x37911d]={'$like':'%'+_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0x3b32ea;})});}_0x404aa8=_[_0x8cf5('0x5b')]({},_0x404aa8,_0x49ec8a[_0x8cf5('0x60')]);return db['ScreenRecording'][_0x8cf5('0x30')]({'where':_0x404aa8['where']})[_0x8cf5('0x22')](function(_0xe1ce89){_0x153155[_0x8cf5('0x30')]=_0xe1ce89;if(_0x49ec8a[_0x8cf5('0x4f')][_0x8cf5('0x61')]){_0x404aa8[_0x8cf5('0x62')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x404aa8);})[_0x8cf5('0x22')](function(_0x5635bc){_0x153155[_0x8cf5('0x65')]=_0x5635bc;return _0x153155;});}})['then'](respondWithFilteredResult(_0xc45654,_0x404aa8))[_0x8cf5('0x2c')](handleError(_0xc45654,null));};exports[_0x8cf5('0xcb')]=function(_0x52693e,_0x1afa71,_0x23072a){var _0x415c27={};var _0x4df5c7={};var _0x20994f;var _0x3a6d3a;return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x52693e['params']['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x1afa71,null))[_0x8cf5('0x22')](function(_0x305bef){if(_0x305bef){_0x20994f=_0x305bef;_0x4df5c7['model']=_[_0x8cf5('0x50')](db['ChatInteraction'][_0x8cf5('0xba')]);_0x4df5c7[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x52693e['query']);_0x4df5c7[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x4df5c7['model'],_0x4df5c7['query']);_0x415c27['attributes']=_[_0x8cf5('0x52')](_0x4df5c7[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x52693e[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x415c27['attributes']=_0x415c27[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x415c27[_0x8cf5('0x53')]:_0x4df5c7[_0x8cf5('0x4b')];_0x415c27[_0x8cf5('0x58')]=qs['sort'](_0x52693e[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x415c27[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_['pick'](_0x52693e[_0x8cf5('0x4f')],_0x4df5c7[_0x8cf5('0x51')]));if(_0x52693e[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x415c27[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0x415c27[_0x8cf5('0x5d')],{'$or':_['map'](_0x415c27['attributes'],function(_0x450c64){var _0x1b92de={};_0x1b92de[_0x450c64]={'$like':'%'+_0x52693e['query']['filter']+'%'};return _0x1b92de;})});}_0x415c27=_[_0x8cf5('0x5b')]({},_0x415c27,_0x52693e[_0x8cf5('0x60')]);return _0x20994f[_0x8cf5('0xcb')](_0x415c27);}})['then'](function(_0x2078cf){if(_0x2078cf){_0x3a6d3a=_0x2078cf[_0x8cf5('0x55')];if(!_0x52693e[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x415c27['limit']=qs[_0x8cf5('0x57')](_0x52693e['query'][_0x8cf5('0x57')]);_0x415c27[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x52693e[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x20994f[_0x8cf5('0xcb')](_0x415c27);}})[_0x8cf5('0x22')](function(_0x1f9fe3){if(_0x1f9fe3){return _0x1f9fe3?{'count':_0x3a6d3a,'rows':_0x1f9fe3}:null;}})['then'](respondWithResult(_0x1afa71,null))[_0x8cf5('0x2c')](handleError(_0x1afa71,null));};exports[_0x8cf5('0xcc')]=function(_0x12a5ff,_0x145020,_0xff8589){var _0x3942dc={};var _0x394b7e={};var _0x2332b0;var _0x2f3e86;return db['User'][_0x8cf5('0x8e')]({'where':{'id':_0x12a5ff[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x145020,null))[_0x8cf5('0x22')](function(_0x41a702){if(_0x41a702){_0x2332b0=_0x41a702;_0x394b7e[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db['OpenchannelInteraction'][_0x8cf5('0xba')]);_0x394b7e['query']=_['keys'](_0x12a5ff[_0x8cf5('0x4f')]);_0x394b7e[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x394b7e['model'],_0x394b7e[_0x8cf5('0x4f')]);_0x3942dc[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x394b7e[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x12a5ff[_0x8cf5('0x4f')]['fields']));_0x3942dc['attributes']=_0x3942dc['attributes'][_0x8cf5('0x55')]?_0x3942dc[_0x8cf5('0x53')]:_0x394b7e[_0x8cf5('0x4b')];_0x3942dc['order']=qs['sort'](_0x12a5ff[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x3942dc[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x12a5ff[_0x8cf5('0x4f')],_0x394b7e[_0x8cf5('0x51')]));if(_0x12a5ff[_0x8cf5('0x4f')]['filter']){_0x3942dc['where']=_[_0x8cf5('0x5b')](_0x3942dc[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x3942dc[_0x8cf5('0x53')],function(_0x3aa2a6){var _0x43f701={};_0x43f701[_0x3aa2a6]={'$like':'%'+_0x12a5ff[_0x8cf5('0x4f')]['filter']+'%'};return _0x43f701;})});}_0x3942dc=_[_0x8cf5('0x5b')]({},_0x3942dc,_0x12a5ff['options']);return _0x2332b0[_0x8cf5('0xcc')](_0x3942dc);}})[_0x8cf5('0x22')](function(_0x5271f3){if(_0x5271f3){_0x2f3e86=_0x5271f3['length'];if(!_0x12a5ff[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x3942dc[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x12a5ff[_0x8cf5('0x4f')][_0x8cf5('0x57')]);_0x3942dc[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x12a5ff[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x2332b0['getOpenchannelInteractions'](_0x3942dc);}})['then'](function(_0x9bb309){if(_0x9bb309){return _0x9bb309?{'count':_0x2f3e86,'rows':_0x9bb309}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x145020,null))['catch'](handleError(_0x145020,null));};exports[_0x8cf5('0xcd')]=function(_0x4c27f0,_0x5bd4b5,_0x369594){var _0x59ce7e={'raw':!![],'where':{}};var _0x3fbd7e={};var _0x2d8208={'count':0x0,'rows':[]};return db[_0x8cf5('0x63')]['findOne']({'where':{'id':_0x4c27f0['params']['id']}})['then'](handleEntityNotFound(_0x5bd4b5,null))[_0x8cf5('0x22')](function(_0x573424){if(_0x573424){_0x3fbd7e[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db['MailInteraction'][_0x8cf5('0xba')]);_0x3fbd7e[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x4c27f0['query']);_0x3fbd7e[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x3fbd7e['model'],_0x3fbd7e[_0x8cf5('0x4f')]);_0x59ce7e[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x3fbd7e[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x4c27f0[_0x8cf5('0x4f')]['fields']));_0x59ce7e[_0x8cf5('0x53')]=_0x59ce7e[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x59ce7e[_0x8cf5('0x53')]:_0x3fbd7e['model'];if(!_0x4c27f0[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x59ce7e[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x4c27f0['query'][_0x8cf5('0x57')]);_0x59ce7e[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x4c27f0[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}_0x59ce7e[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x4c27f0['query'][_0x8cf5('0x59')]);_0x59ce7e[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x4c27f0[_0x8cf5('0x4f')],_0x3fbd7e[_0x8cf5('0x51')]));_0x59ce7e[_0x8cf5('0x5d')][_0x8cf5('0xc8')]=_0x573424['id'];if(_0x4c27f0['query']['filter']){_0x59ce7e[_0x8cf5('0x5d')]=_['merge'](_0x59ce7e['where'],{'$or':_[_0x8cf5('0x3f')](_0x59ce7e[_0x8cf5('0x53')],function(_0x2eb6f5){var _0x35316d={};_0x35316d[_0x2eb6f5]={'$like':'%'+_0x4c27f0[_0x8cf5('0x4f')]['filter']+'%'};return _0x35316d;})});}_0x59ce7e=_[_0x8cf5('0x5b')]({},_0x59ce7e,_0x4c27f0[_0x8cf5('0x60')]);return db[_0x8cf5('0xce')][_0x8cf5('0x30')]({'where':_0x59ce7e[_0x8cf5('0x5d')]})['then'](function(_0xf25c38){_0x2d8208['count']=_0xf25c38;if(_0x4c27f0[_0x8cf5('0x4f')]['includeAll']){_0x59ce7e[_0x8cf5('0x62')]=[{'all':!![]}];}return db[_0x8cf5('0xce')]['findAll'](_0x59ce7e);})['then'](function(_0x4f74e0){_0x2d8208[_0x8cf5('0x65')]=_0x4f74e0;return _0x2d8208;});}})[_0x8cf5('0x22')](respondWithFilteredResult(_0x5bd4b5,_0x59ce7e))['catch'](handleError(_0x5bd4b5,null));};exports[_0x8cf5('0xcf')]=function(_0x1c9eb2,_0x4c2646,_0x4775d3){var _0x3fe36d={};var _0x5250bb={};var _0x45db38;var _0x51f1fb;return db['User'][_0x8cf5('0x8e')]({'where':{'id':_0x1c9eb2[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x4c2646,null))[_0x8cf5('0x22')](function(_0x267383){if(_0x267383){_0x45db38=_0x267383;_0x5250bb[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xd0')]['rawAttributes']);_0x5250bb[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x1c9eb2[_0x8cf5('0x4f')]);_0x5250bb['filters']=_[_0x8cf5('0x52')](_0x5250bb[_0x8cf5('0x4b')],_0x5250bb['query']);_0x3fe36d['attributes']=_[_0x8cf5('0x52')](_0x5250bb[_0x8cf5('0x4b')],qs['fields'](_0x1c9eb2[_0x8cf5('0x4f')]['fields']));_0x3fe36d['attributes']=_0x3fe36d[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x3fe36d['attributes']:_0x5250bb['model'];_0x3fe36d[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x1c9eb2[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x3fe36d[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x1c9eb2[_0x8cf5('0x4f')],_0x5250bb['filters']));if(_0x1c9eb2[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x3fe36d['where']=_[_0x8cf5('0x5b')](_0x3fe36d['where'],{'$or':_['map'](_0x3fe36d[_0x8cf5('0x53')],function(_0x4d4e8f){var _0xcdf26={};_0xcdf26[_0x4d4e8f]={'$like':'%'+_0x1c9eb2[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0xcdf26;})});}_0x3fe36d=_[_0x8cf5('0x5b')]({},_0x3fe36d,_0x1c9eb2[_0x8cf5('0x60')]);return _0x45db38[_0x8cf5('0xcf')](_0x3fe36d);}})[_0x8cf5('0x22')](function(_0x4616a9){if(_0x4616a9){_0x51f1fb=_0x4616a9[_0x8cf5('0x55')];if(!_0x1c9eb2[_0x8cf5('0x4f')]['hasOwnProperty'](_0x8cf5('0xc1'))){_0x3fe36d[_0x8cf5('0x57')]=qs['limit'](_0x1c9eb2[_0x8cf5('0x4f')]['limit']);_0x3fe36d[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x1c9eb2[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x45db38[_0x8cf5('0xcf')](_0x3fe36d);}})['then'](function(_0x3b1ae2){if(_0x3b1ae2){return _0x3b1ae2?{'count':_0x51f1fb,'rows':_0x3b1ae2}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x4c2646,null))[_0x8cf5('0x2c')](handleError(_0x4c2646,null));};exports[_0x8cf5('0xd1')]=function(_0x3c4f5e,_0x76b14b,_0x804819){var _0x1df402={};var _0x3f9a97={};var _0x200d40;var _0x50df76;return db[_0x8cf5('0x63')]['findOne']({'where':{'id':_0x3c4f5e[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x76b14b,null))[_0x8cf5('0x22')](function(_0x20ff2b){if(_0x20ff2b){_0x200d40=_0x20ff2b;_0x3f9a97[_0x8cf5('0x4b')]=_['keys'](db[_0x8cf5('0xd2')][_0x8cf5('0xba')]);_0x3f9a97['query']=_['keys'](_0x3c4f5e[_0x8cf5('0x4f')]);_0x3f9a97['filters']=_[_0x8cf5('0x52')](_0x3f9a97[_0x8cf5('0x4b')],_0x3f9a97[_0x8cf5('0x4f')]);_0x1df402[_0x8cf5('0x53')]=_['intersection'](_0x3f9a97[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x3c4f5e[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x1df402[_0x8cf5('0x53')]=_0x1df402[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x1df402['attributes']:_0x3f9a97[_0x8cf5('0x4b')];_0x1df402[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x3c4f5e[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x1df402[_0x8cf5('0x5d')]=qs['filters'](_[_0x8cf5('0x5a')](_0x3c4f5e['query'],_0x3f9a97[_0x8cf5('0x51')]));if(_0x3c4f5e[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x1df402[_0x8cf5('0x5d')]=_['merge'](_0x1df402['where'],{'$or':_[_0x8cf5('0x3f')](_0x1df402['attributes'],function(_0x2ba5a6){var _0x132cd9={};_0x132cd9[_0x2ba5a6]={'$like':'%'+_0x3c4f5e['query']['filter']+'%'};return _0x132cd9;})});}_0x1df402=_['merge']({},_0x1df402,_0x3c4f5e[_0x8cf5('0x60')]);return _0x200d40[_0x8cf5('0xd1')](_0x1df402);}})[_0x8cf5('0x22')](function(_0x7446e0){if(_0x7446e0){_0x50df76=_0x7446e0[_0x8cf5('0x55')];if(!_0x3c4f5e[_0x8cf5('0x4f')]['hasOwnProperty']('nolimit')){_0x1df402[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x3c4f5e['query'][_0x8cf5('0x57')]);_0x1df402[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x3c4f5e[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x200d40[_0x8cf5('0xd1')](_0x1df402);}})[_0x8cf5('0x22')](function(_0x2bed6a){if(_0x2bed6a){return _0x2bed6a?{'count':_0x50df76,'rows':_0x2bed6a}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x76b14b,null))[_0x8cf5('0x2c')](handleError(_0x76b14b,null));};exports['getWhatsappInteractions']=function(_0x37460d,_0x414402,_0x47f4a2){var _0x5ea33a={};var _0x50f893={};var _0x4420ff;var _0x446a5b;return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x37460d[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x414402,null))[_0x8cf5('0x22')](function(_0x25400e){if(_0x25400e){_0x4420ff=_0x25400e;_0x50f893[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xd3')][_0x8cf5('0xba')]);_0x50f893[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x37460d[_0x8cf5('0x4f')]);_0x50f893[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x50f893[_0x8cf5('0x4b')],_0x50f893[_0x8cf5('0x4f')]);_0x5ea33a[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x50f893[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x37460d[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x5ea33a[_0x8cf5('0x53')]=_0x5ea33a[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x5ea33a[_0x8cf5('0x53')]:_0x50f893[_0x8cf5('0x4b')];_0x5ea33a[_0x8cf5('0x58')]=qs['sort'](_0x37460d[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x5ea33a[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x37460d[_0x8cf5('0x4f')],_0x50f893['filters']));if(_0x37460d[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x5ea33a['where']=_['merge'](_0x5ea33a[_0x8cf5('0x5d')],{'$or':_['map'](_0x5ea33a[_0x8cf5('0x53')],function(_0xcb0e5a){var _0x4b470c={};_0x4b470c[_0xcb0e5a]={'$like':'%'+_0x37460d[_0x8cf5('0x4f')]['filter']+'%'};return _0x4b470c;})});}_0x5ea33a=_['merge']({},_0x5ea33a,_0x37460d[_0x8cf5('0x60')]);return _0x4420ff['getWhatsappInteractions'](_0x5ea33a);}})[_0x8cf5('0x22')](function(_0xe32629){if(_0xe32629){_0x446a5b=_0xe32629[_0x8cf5('0x55')];if(!_0x37460d[_0x8cf5('0x4f')][_0x8cf5('0x56')](_0x8cf5('0xc1'))){_0x5ea33a['limit']=qs[_0x8cf5('0x57')](_0x37460d[_0x8cf5('0x4f')]['limit']);_0x5ea33a['offset']=qs[_0x8cf5('0x31')](_0x37460d[_0x8cf5('0x4f')][_0x8cf5('0x31')]);}return _0x4420ff[_0x8cf5('0xd4')](_0x5ea33a);}})['then'](function(_0x567511){if(_0x567511){return _0x567511?{'count':_0x446a5b,'rows':_0x567511}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x414402,null))[_0x8cf5('0x2c')](handleError(_0x414402,null));};exports[_0x8cf5('0xd5')]=function(_0x54b7c8,_0x5b6627,_0x48d646){var _0x892d51;var _0x5017a1;var _0x241ff3;var _0x159133=!_[_0x8cf5('0x71')](_0x54b7c8[_0x8cf5('0x66')]['id'])?_0x54b7c8[_0x8cf5('0x66')]['id']:!_['isNil'](_0x54b7c8[_0x8cf5('0x39')]['id'])?_0x54b7c8['user']['id']:null;return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x159133,'role':{'$or':[_0x8cf5('0x6e'),_0x8cf5('0x39'),'agent']}},'attributes':['id','name',_0x8cf5('0xd6'),_0x8cf5('0xd7'),_0x8cf5('0x42'),'internal',_0x8cf5('0x98')]})[_0x8cf5('0x22')](function(_0x29d35d){if(_0x29d35d){if(_0x29d35d['role']===_0x8cf5('0x3b')){_0x892d51=_0x29d35d;if(_0x54b7c8[_0x8cf5('0x68')]['interface']){_0x241ff3=util[_0x8cf5('0x72')](_0x8cf5('0xd8'),_0x892d51[_0x54b7c8[_0x8cf5('0x68')][_0x8cf5('0xa7')]]);}else if(_0x54b7c8['body']['intrf']){_0x241ff3=util[_0x8cf5('0x72')](_0x8cf5('0xa8'),_0x54b7c8[_0x8cf5('0x68')]['intrf']);}else{_0x241ff3=util[_0x8cf5('0x72')]('SIP/%s',_0x892d51[_0x8cf5('0x44')]);}socket['to'](util[_0x8cf5('0x72')](_0x8cf5('0xd9'),_0x892d51[_0x8cf5('0x44')]))[_0x8cf5('0xa2')](_0x8cf5('0xda'),{'ip':_0x54b7c8[_0x8cf5('0xdb')]['x-forwarded-for']||_0x54b7c8[_0x8cf5('0xdc')][_0x8cf5('0xdd')]||_0x54b7c8[_0x8cf5('0xde')][_0x8cf5('0xdd')]||_0x54b7c8[_0x8cf5('0xdc')][_0x8cf5('0xde')][_0x8cf5('0xdd')]});return db[_0x8cf5('0xae')][_0x8cf5('0x36')]({'where':{'membername':_0x892d51['name']},'individualHooks':!![]});}}else{throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))](_0x8cf5('0xdf'));}})[_0x8cf5('0x22')](function(){if(_0x892d51){return _0x892d51['getVoiceQueues']({'raw':!![]});}})[_0x8cf5('0x22')](function(_0x277e3c){if(_0x892d51){var _0x166130=[];if(_0x277e3c){_0x5017a1=_0x277e3c;if(_0x5017a1[_0x8cf5('0x55')]){for(var _0x53fc88=0x0;_0x53fc88<_0x5017a1[_0x8cf5('0x55')];_0x53fc88++){_0x166130[_0x8cf5('0xa6')]({'membername':_0x892d51['name'],'UserId':_0x892d51['id'],'queue_name':_0x5017a1[_0x53fc88][_0x8cf5('0x44')],'VoiceQueueId':_0x5017a1[_0x53fc88]['id'],'interface':_0x241ff3,'paused':_0x892d51[_0x8cf5('0x98')]||![],'penalty':_0x5017a1[_0x53fc88][_0x8cf5('0xe0')]||0x0});}return BPromise[_0x8cf5('0xa9')](_0x166130,function(_0x9344af){return db[_0x8cf5('0xae')][_0x8cf5('0xaa')](_0x9344af);});}}}})[_0x8cf5('0x22')](function(){if(_0x892d51){return db[_0x8cf5('0xe1')][_0x8cf5('0x64')]({'where':{'membername':_0x892d51[_0x8cf5('0x44')],'exitAt':null}});}})[_0x8cf5('0x22')](function(_0x2d1e8f){if(_0x892d51){var _0x3da6c9=[];_0x2d1e8f[_0x8cf5('0xe2')](function(_0x599b28){_0x3da6c9[_0x8cf5('0xa6')](_0x599b28[_0x8cf5('0x35')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3da6c9);}})[_0x8cf5('0x22')](function(){if(_0x892d51){var _0x3de0b5=[];var _0x58aa4c=[];var _0x5f5542=utils[_0x8cf5('0xe3')]();var _0xc9e74e={'membername':_0x892d51[_0x8cf5('0x44')],'interface':_0x241ff3,'enterAt':moment()['format'](_0x8cf5('0xe4')),'role':_0x892d51[_0x8cf5('0x42')],'internal':_0x892d51[_0x8cf5('0x75')]};_0x5f5542[_0x8cf5('0xe2')](function(_0x492db2){_0x3de0b5[_0x8cf5('0xa6')](_[_0x8cf5('0x5b')]({'channel':_0x492db2,'type':_0x8cf5('0xe5'),'data1':_0x54b7c8['body'][_0x8cf5('0xe6')],'data2':_0x241ff3},_0xc9e74e));if(_0x892d51['loginInPause']){_0x58aa4c[_0x8cf5('0xa6')](_[_0x8cf5('0x5b')]({'channel':_0x492db2,'type':_0x8cf5('0xe7'),'data1':_0x8cf5('0xe8')},_0xc9e74e));}});return db[_0x8cf5('0xe1')][_0x8cf5('0x67')](_0x3de0b5[_0x8cf5('0xe9')](_0x58aa4c),{'individualHooks':!![]});}})[_0x8cf5('0x22')](function(){if(_0x892d51){return _0x892d51[_0x8cf5('0x35')]({'online':!![],'lastLoginAt':moment()[_0x8cf5('0x72')](_0x8cf5('0xe4')),'voicePause':_0x892d51[_0x8cf5('0x98')]||![],'mailPause':_0x892d51[_0x8cf5('0x98')]||![],'chatPause':_0x892d51['loginInPause']||![],'faxPause':_0x892d51[_0x8cf5('0x98')]||![],'smsPause':_0x892d51[_0x8cf5('0x98')]||![],'openchannelPause':_0x892d51[_0x8cf5('0x98')]||![],'whatsappPause':_0x892d51[_0x8cf5('0x98')]||![],'pauseType':_0x892d51['loginInPause']?_0x8cf5('0xe8'):null,'interface':_0x241ff3,'lastPauseAt':moment()['format'](_0x8cf5('0xe4'))});}})[_0x8cf5('0x22')](function(_0x13ab74){if(_0x54b7c8['isMiddleware']){return _0x48d646();}else{return BPromise['resolve'](_0x13ab74)[_0x8cf5('0x22')](respondWithResult(_0x5b6627,null));}})['catch'](handleError(_0x5b6627,null));};exports[_0x8cf5('0xea')]=function(_0x4dc474,_0x31837a,_0x45fbfb){var _0x534798;return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x4dc474[_0x8cf5('0x66')]['id'],'role':_0x8cf5('0x3b')},'attributes':['id','name','role']})[_0x8cf5('0x22')](handleEntityNotFound(_0x31837a,null))[_0x8cf5('0x22')](function(_0x3c8ef2){if(_0x3c8ef2){_0x534798=_0x3c8ef2;return db[_0x8cf5('0xae')]['destroy']({'where':{'membername':_0x534798['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x8cf5('0xe1')][_0x8cf5('0x64')]({'where':{'membername':_0x534798[_0x8cf5('0x44')],'exitAt':null}});})[_0x8cf5('0x22')](function(_0x307ae0){var _0x539fbc=[];_0x307ae0[_0x8cf5('0xe2')](function(_0x1b31b4){_0x539fbc[_0x8cf5('0xa6')](_0x1b31b4[_0x8cf5('0x35')]({'exitAt':moment()['format'](_0x8cf5('0xe4'))}));});return BPromise[_0x8cf5('0xeb')](_0x539fbc);})['then'](function(){return _0x534798[_0x8cf5('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x31837a,null))[_0x8cf5('0x2c')](handleError(_0x31837a,null));};exports[_0x8cf5('0xec')]=function(_0x14d4db,_0x33bedc,_0xbabe8a){var _0x33a090;return db[_0x8cf5('0xae')][_0x8cf5('0x35')]({'paused':0x1},{'where':{'UserId':_0x14d4db[_0x8cf5('0x66')]['id']},'individualHooks':!![]})[_0x8cf5('0x22')](function(){return db['User'][_0x8cf5('0x43')]({'where':{'id':_0x14d4db[_0x8cf5('0x66')]['id'],'role':_0x8cf5('0x3b')},'attributes':['id','name',_0x8cf5('0x42'),_0x8cf5('0x75'),'interface']});})[_0x8cf5('0x22')](handleEntityNotFound(_0x33bedc,null))[_0x8cf5('0x22')](function(_0x35df2c){if(_0x35df2c){_0x33a090=_0x35df2c;return respondWithRpcPromise(_0x8cf5('0xed'),_0x8cf5('0xec'),{'id':_0x33a090['id'],'name':_0x33a090[_0x8cf5('0x44')],'pause':!![]});}})[_0x8cf5('0x22')](function(){if(_0x33a090){return db[_0x8cf5('0xe1')][_0x8cf5('0x64')]({'where':{'membername':_0x33a090[_0x8cf5('0x44')],'type':_0x8cf5('0xe7'),'exitAt':null}});}})[_0x8cf5('0x22')](function(_0x4b5659){if(_0x4b5659[_0x8cf5('0x55')]){var _0x503298=moment()[_0x8cf5('0x72')](_0x8cf5('0xe4'));for(var _0x5352ba=0x0,_0x33eb10=_0x4b5659['length'];_0x5352ba<_0x33eb10;_0x5352ba++){_0x4b5659[_0x5352ba]['updateAttributes']({'exitAt':_0x503298});}}})[_0x8cf5('0x22')](function(){var _0x1d31f5=[];var _0x49d1aa=utils[_0x8cf5('0xe3')]();_0x49d1aa[_0x8cf5('0xe2')](function(_0x398a1f){_0x1d31f5[_0x8cf5('0xa6')]({'channel':_0x398a1f,'membername':_0x33a090[_0x8cf5('0x44')],'interface':_[_0x8cf5('0x71')](_0x33a090[_0x8cf5('0xa7')])?util[_0x8cf5('0x72')](_0x8cf5('0xa8'),_0x33a090['name']):_0x33a090[_0x8cf5('0xa7')],'type':_0x8cf5('0xe7'),'enterAt':moment()['format'](_0x8cf5('0xe4')),'data1':_0x14d4db[_0x8cf5('0x68')]['type']||_0x8cf5('0xee'),'role':_0x33a090[_0x8cf5('0x42')],'internal':_0x33a090[_0x8cf5('0x75')]});});return db[_0x8cf5('0xe1')]['bulkCreate'](_0x1d31f5,{'individualHooks':!![]});})[_0x8cf5('0x22')](function(){return _0x33a090[_0x8cf5('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x14d4db[_0x8cf5('0x68')]['type']||_0x8cf5('0xee'),'lastPauseAt':moment()[_0x8cf5('0x72')](_0x8cf5('0xe4'))});})['then'](respondWithResult(_0x33bedc,null))[_0x8cf5('0x2c')](handleError(_0x33bedc,null));};exports['unpause']=function(_0x53f0cb,_0x330539,_0x22063e){var _0x4c1547;return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x53f0cb[_0x8cf5('0x66')]['id']},'attributes':['id',_0x8cf5('0x44'),_0x8cf5('0x42'),'voicePause',_0x8cf5('0xef'),'chatPause',_0x8cf5('0xf0'),'openchannelPause',_0x8cf5('0xf1'),'whatsapppause','pauseType',_0x8cf5('0xf2')]})[_0x8cf5('0x22')](handleEntityNotFound(_0x330539,null))['then'](function(_0x27aba8){if(_0x27aba8){_0x4c1547=_0x27aba8;if(_0x53f0cb[_0x8cf5('0x68')]['channel']&&!utils[_0x8cf5('0x9a')](_0x53f0cb[_0x8cf5('0x68')][_0x8cf5('0xac')])){throw new db[(_0x8cf5('0x1e'))][(_0x8cf5('0x1f'))]('Unknown\x20channel');}switch(_0x53f0cb[_0x8cf5('0x68')][_0x8cf5('0xac')]){case _0x8cf5('0xa4'):return respondWithRpcPromise(_0x8cf5('0xed'),'unpause',{'id':_0x4c1547['id'],'name':_0x4c1547[_0x8cf5('0x44')],'pause':![]})['then'](function(){return db[_0x8cf5('0xae')][_0x8cf5('0x35')]({'paused':0x0},{'where':{'UserId':_0x4c1547['id']},'individualHooks':!![]});})[_0x8cf5('0x22')](function(){return db[_0x8cf5('0xe1')][_0x8cf5('0x43')]({'where':{'channel':_0x53f0cb['body'][_0x8cf5('0xac')],'membername':_0x4c1547[_0x8cf5('0x44')],'type':_0x8cf5('0xe7'),'exitAt':null}});})['then'](function(_0x2785f9){if(_0x2785f9){return _0x2785f9[_0x8cf5('0x35')]({'exitAt':moment()[_0x8cf5('0x72')](_0x8cf5('0xe4')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8cf5('0x22')](function(){return _0x4c1547[_0x8cf5('0x35')]({'voicePause':![]});});case _0x8cf5('0xf3'):case _0x8cf5('0xf4'):case _0x8cf5('0xf5'):case _0x8cf5('0xf6'):case'whatsapp':case _0x8cf5('0xf7'):return db['MemberReport'][_0x8cf5('0x43')]({'where':{'channel':_0x53f0cb['body'][_0x8cf5('0xac')],'membername':_0x4c1547['name'],'type':_0x8cf5('0xe7'),'exitAt':null}})['then'](function(_0x47c9d8){if(_0x47c9d8){return _0x47c9d8[_0x8cf5('0x35')]({'exitAt':moment()[_0x8cf5('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8cf5('0xf8')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x5b557a={};_[_0x8cf5('0x32')](_0x5b557a,util['format'](_0x8cf5('0xf9'),_0x53f0cb[_0x8cf5('0x68')][_0x8cf5('0xac')],'Pause'),![]);return _0x4c1547['update'](_0x5b557a);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x4c1547['id'],'name':_0x4c1547[_0x8cf5('0x44')],'pause':![]})[_0x8cf5('0x22')](function(){return db[_0x8cf5('0xae')][_0x8cf5('0x35')]({'paused':0x0},{'where':{'UserId':_0x4c1547['id']}});})[_0x8cf5('0x22')](function(){return db[_0x8cf5('0xe1')]['findAll']({'where':{'membername':_0x4c1547[_0x8cf5('0x44')],'type':_0x8cf5('0xe7'),'exitAt':null}});})[_0x8cf5('0x22')](function(_0x3faed1){var _0x16ce44=[];_0x3faed1[_0x8cf5('0xe2')](function(_0x4ff625){_0x16ce44[_0x8cf5('0xa6')](_0x4ff625[_0x8cf5('0x35')]({'exitAt':moment()[_0x8cf5('0x72')](_0x8cf5('0xe4')),'data2':_0x8cf5('0xf8')}));});return BPromise[_0x8cf5('0xeb')](_0x16ce44);})[_0x8cf5('0x22')](function(){return _0x4c1547[_0x8cf5('0x35')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8cf5('0x22')](respondWithResult(_0x330539,null))[_0x8cf5('0x2c')](handleError(_0x330539,null));};exports[_0x8cf5('0xfa')]=function(_0x266a34,_0x434888,_0x1894a3){var _0x3045b3={};var _0x1d47d4={};var _0x22f70b;var _0x1f26a4;return db[_0x8cf5('0x63')]['findOne']({'where':{'id':_0x266a34['params']['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x434888,null))[_0x8cf5('0x22')](function(_0x1d4c79){if(_0x1d4c79){_0x22f70b=_0x1d4c79;_0x1d47d4[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0xfb')][_0x8cf5('0xba')]);_0x1d47d4[_0x8cf5('0x4f')]=_[_0x8cf5('0x50')](_0x266a34[_0x8cf5('0x4f')]);_0x1d47d4['filters']=_['intersection'](_0x1d47d4['model'],_0x1d47d4[_0x8cf5('0x4f')]);_0x3045b3[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x1d47d4[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x266a34[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x3045b3[_0x8cf5('0x53')]=_0x3045b3[_0x8cf5('0x53')]['length']?_0x3045b3[_0x8cf5('0x53')]:_0x1d47d4['model'];_0x3045b3[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x266a34[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x3045b3[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x266a34[_0x8cf5('0x4f')],_0x1d47d4[_0x8cf5('0x51')]));if(_0x266a34[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x3045b3[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0x3045b3[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x3045b3[_0x8cf5('0x53')],function(_0x26cd2c){var _0x330ccb={};_0x330ccb[_0x26cd2c]={'$like':'%'+_0x266a34[_0x8cf5('0x4f')]['filter']+'%'};return _0x330ccb;})});}_0x3045b3=_[_0x8cf5('0x5b')]({},_0x3045b3,_0x266a34[_0x8cf5('0x60')]);return _0x22f70b[_0x8cf5('0xfa')](_0x3045b3);}})['then'](function(_0x446182){if(_0x446182){_0x1f26a4=_0x446182['length'];if(!_0x266a34[_0x8cf5('0x4f')][_0x8cf5('0x56')]('nolimit')){_0x3045b3[_0x8cf5('0x57')]=qs[_0x8cf5('0x57')](_0x266a34['query'][_0x8cf5('0x57')]);_0x3045b3[_0x8cf5('0x31')]=qs['offset'](_0x266a34['query'][_0x8cf5('0x31')]);}return _0x22f70b['getTeams'](_0x3045b3);}})['then'](function(_0x15ed35){if(_0x15ed35){return _0x15ed35?{'count':_0x1f26a4,'rows':_0x15ed35}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x434888,null))[_0x8cf5('0x2c')](handleError(_0x434888,null));};exports[_0x8cf5('0xfc')]=function(_0x3d5316,_0x385ea7){return db[_0x8cf5('0x63')][_0x8cf5('0x43')]({'where':{'id':_0x3d5316['params']['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x385ea7,null))['then'](function(_0x3ae694){if(_0x3ae694){var _0x4c869d=_0x3ae694['get']({'plain':!![]});return _0x3ae694['addTeams'](_0x3d5316[_0x8cf5('0x68')][_0x8cf5('0x6c')],_[_0x8cf5('0x6b')](_0x3d5316[_0x8cf5('0x68')],[_0x8cf5('0x6c'),'id'])||{})[_0x8cf5('0x22')](function(){for(var _0x3c4ae2=0x0;_0x3c4ae2<_0x3d5316[_0x8cf5('0x68')][_0x8cf5('0x6c')][_0x8cf5('0x55')];_0x3c4ae2++){var _0x2f07fd=[];db['Team'][_0x8cf5('0x8e')]({'where':{'id':_0x3d5316[_0x8cf5('0x68')]['ids'][_0x3c4ae2]}})['then'](function(_0x1b2763){_0x2f07fd[_0x8cf5('0xa6')](_0x1b2763[_0x8cf5('0xfd')]()[_0x8cf5('0x22')](function(_0x363404){for(var _0x39a7ef=0x0;_0x39a7ef<_0x363404['length'];_0x39a7ef++){_0x363404[_0x39a7ef][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0xff'));}return _0x363404;}));_0x2f07fd[_0x8cf5('0xa6')](_0x1b2763[_0x8cf5('0x100')]()[_0x8cf5('0x22')](function(_0x2efeb4){for(var _0x304b4e=0x0;_0x304b4e<_0x2efeb4['length'];_0x304b4e++){_0x2efeb4[_0x304b4e][_0x8cf5('0xfe')](_0x8cf5('0xac'),'Chat');}return _0x2efeb4;}));_0x2f07fd['push'](_0x1b2763[_0x8cf5('0x101')]()[_0x8cf5('0x22')](function(_0x21fe70){for(var _0x1ebb79=0x0;_0x1ebb79<_0x21fe70[_0x8cf5('0x55')];_0x1ebb79++){_0x21fe70[_0x1ebb79][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0x102'));}return _0x21fe70;}));_0x2f07fd['push'](_0x1b2763[_0x8cf5('0x103')]()[_0x8cf5('0x22')](function(_0x3be336){for(var _0x1204f4=0x0;_0x1204f4<_0x3be336[_0x8cf5('0x55')];_0x1204f4++){_0x3be336[_0x1204f4][_0x8cf5('0xfe')]('channel',_0x8cf5('0x104'));}return _0x3be336;}));_0x2f07fd['push'](_0x1b2763['getWhatsappQueues']()[_0x8cf5('0x22')](function(_0x430f14){for(var _0x169f33=0x0;_0x169f33<_0x430f14['length'];_0x169f33++){_0x430f14[_0x169f33][_0x8cf5('0xfe')]('channel',_0x8cf5('0x105'));}return _0x430f14;}));_0x2f07fd['push'](_0x1b2763[_0x8cf5('0x106')]()['then'](function(_0x525362){for(var _0x27be1a=0x0;_0x27be1a<_0x525362[_0x8cf5('0x55')];_0x27be1a++){_0x525362[_0x27be1a][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0x107'));}return _0x525362;}));_0x2f07fd[_0x8cf5('0xa6')](_0x1b2763['getOpenchannelQueues']()[_0x8cf5('0x22')](function(_0x15f069){for(var _0x23da06=0x0;_0x23da06<_0x15f069[_0x8cf5('0x55')];_0x23da06++){_0x15f069[_0x23da06][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0x108'));}return _0x15f069;}));return BPromise[_0x8cf5('0xeb')](_0x2f07fd);})[_0x8cf5('0x22')](function(_0x4f786b){var _0x5428c9=_[_0x8cf5('0x109')](_0x4f786b);_0x2f07fd=[];return db[_0x8cf5('0x5c')][_0x8cf5('0x10a')](function(_0x24aa79){for(var _0x4be042=0x0;_0x4be042<_0x5428c9[_0x8cf5('0x55')];_0x4be042++){_0x2f07fd[_0x8cf5('0xa6')](_0x5428c9[_0x4be042][_0x8cf5('0x10b')](_0x4c869d['id']),{'transaction':_0x24aa79});}return BPromise[_0x8cf5('0xeb')](_0x2f07fd)['then'](function(){if(_0x4c869d['online']){return BPromise[_0x8cf5('0xa9')](_[_0x8cf5('0x3e')](_0x5428c9,function(_0x373ebe){return _0x373ebe[_0x8cf5('0x10c')](_0x8cf5('0xac'))===_0x8cf5('0xff');}),function(_0x4b5e8b){return db[_0x8cf5('0xae')][_0x8cf5('0xaa')]({'membername':_0x4c869d[_0x8cf5('0x44')],'UserId':_0x4c869d['id'],'queue_name':_0x4b5e8b[_0x8cf5('0x44')],'VoiceQueueId':_0x4b5e8b['id'],'interface':_[_0x8cf5('0x71')](_0x4c869d[_0x8cf5('0xa7')])?util[_0x8cf5('0x72')]('SIP/%s',_0x4c869d['name']):_0x4c869d['interface'],'paused':_0x4c869d[_0x8cf5('0x99')]||![],'penalty':_0x4c869d[_0x8cf5('0xa0')]},{'transaction':_0x24aa79});});}else{return;}})[_0x8cf5('0x22')](function(){for(var _0x4e8210=0x0;_0x4e8210<_0x5428c9[_0x8cf5('0x55')];_0x4e8210++){var _0x532406=_0x5428c9[_0x4e8210][_0x8cf5('0x10c')]('channel');var _0x45c25d=_0x532406+_0x8cf5('0xa1');socket[_0x8cf5('0xa2')](_0x8cf5('0x39')+_0x532406+_0x8cf5('0xa3'),{'UserId':_0x4c869d['id'],['queueField']:_0x5428c9[_0x4e8210]['id']});}});});});}});}})[_0x8cf5('0x22')](respondWithStatusCode(_0x385ea7,null))[_0x8cf5('0x2c')](handleError(_0x385ea7,null));};exports['removeTeams']=function(_0x2fe54b,_0x424b48){return db['User'][_0x8cf5('0x8e')]({'where':{'id':_0x2fe54b[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x424b48,null))['then'](function(_0x73638e){if(_0x73638e){var _0x26f632=_0x73638e[_0x8cf5('0x37')]({'plain':!![]});var _0x183ce2=_0x2fe54b[_0x8cf5('0x4f')]['ids'];return _0x73638e[_0x8cf5('0x10d')](_0x183ce2)[_0x8cf5('0x22')](function(){for(var _0x1f753f=0x0;_0x1f753f<_0x183ce2[_0x8cf5('0x55')];_0x1f753f++){var _0x4af3d1=[];db[_0x8cf5('0xfb')][_0x8cf5('0x8e')]({'where':{'id':_0x183ce2[_0x1f753f]}})['then'](function(_0x415021){_0x4af3d1[_0x8cf5('0xa6')](_0x415021[_0x8cf5('0xfd')]()['then'](function(_0x2da9ab){for(var _0x762eb6=0x0;_0x762eb6<_0x2da9ab[_0x8cf5('0x55')];_0x762eb6++){_0x2da9ab[_0x762eb6][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0xff'));}return _0x2da9ab;}));_0x4af3d1[_0x8cf5('0xa6')](_0x415021[_0x8cf5('0x100')]()[_0x8cf5('0x22')](function(_0x5afaa9){for(var _0x682dc=0x0;_0x682dc<_0x5afaa9[_0x8cf5('0x55')];_0x682dc++){_0x5afaa9[_0x682dc]['setDataValue']('channel','Chat');}return _0x5afaa9;}));_0x4af3d1[_0x8cf5('0xa6')](_0x415021[_0x8cf5('0x101')]()['then'](function(_0x4d8177){for(var _0x37ab4c=0x0;_0x37ab4c<_0x4d8177[_0x8cf5('0x55')];_0x37ab4c++){_0x4d8177[_0x37ab4c][_0x8cf5('0xfe')](_0x8cf5('0xac'),'Mail');}return _0x4d8177;}));_0x4af3d1['push'](_0x415021[_0x8cf5('0x103')]()[_0x8cf5('0x22')](function(_0x324782){for(var _0x43b879=0x0;_0x43b879<_0x324782[_0x8cf5('0x55')];_0x43b879++){_0x324782[_0x43b879][_0x8cf5('0xfe')](_0x8cf5('0xac'),_0x8cf5('0x104'));}return _0x324782;}));_0x4af3d1['push'](_0x415021[_0x8cf5('0x10e')]()[_0x8cf5('0x22')](function(_0x1cff9e){for(var _0xa015ed=0x0;_0xa015ed<_0x1cff9e['length'];_0xa015ed++){_0x1cff9e[_0xa015ed]['setDataValue']('channel',_0x8cf5('0x105'));}return _0x1cff9e;}));_0x4af3d1['push'](_0x415021['getFaxQueues']()[_0x8cf5('0x22')](function(_0x2ae5b9){for(var _0x3022cd=0x0;_0x3022cd<_0x2ae5b9['length'];_0x3022cd++){_0x2ae5b9[_0x3022cd][_0x8cf5('0xfe')]('channel',_0x8cf5('0x107'));}return _0x2ae5b9;}));_0x4af3d1[_0x8cf5('0xa6')](_0x415021[_0x8cf5('0x10f')]()[_0x8cf5('0x22')](function(_0x1aafb3){for(var _0x330bd9=0x0;_0x330bd9<_0x1aafb3['length'];_0x330bd9++){_0x1aafb3[_0x330bd9][_0x8cf5('0xfe')]('channel',_0x8cf5('0x108'));}return _0x1aafb3;}));return BPromise[_0x8cf5('0xeb')](_0x4af3d1);})[_0x8cf5('0x22')](function(_0x24eacc){var _0x351b64=_[_0x8cf5('0x109')](_0x24eacc);_0x4af3d1=[];return db[_0x8cf5('0x5c')]['transaction'](function(_0x2b6bc9){for(var _0x3cb5c4=0x0;_0x3cb5c4<_0x351b64[_0x8cf5('0x55')];_0x3cb5c4++){_0x4af3d1[_0x8cf5('0xa6')](_0x351b64[_0x3cb5c4][_0x8cf5('0x110')](_0x26f632['id']),{'transaction':_0x2b6bc9});}return BPromise['all'](_0x4af3d1)[_0x8cf5('0x22')](function(){if(_0x26f632[_0x8cf5('0xa5')]){return BPromise['each'](_['filter'](_0x351b64,function(_0x2acbdc){return _0x2acbdc['getDataValue']('channel')===_0x8cf5('0xff');}),function(_0x4a404c){return db[_0x8cf5('0xae')][_0x8cf5('0x36')]({'where':{'VoiceQueueId':_0x4a404c['id'],'UserId':_0x26f632['id']},'transaction':_0x2b6bc9});});}else{return;}})[_0x8cf5('0x22')](function(){for(var _0x15e8be=0x0;_0x15e8be<_0x351b64['length'];_0x15e8be++){var _0x380f9f=_0x351b64[_0x15e8be][_0x8cf5('0x10c')](_0x8cf5('0xac'));var _0x3855cd=_0x380f9f+_0x8cf5('0xa1');socket[_0x8cf5('0xa2')](_0x8cf5('0x39')+_0x380f9f+'Queue:remove',{'UserId':_0x26f632['id'],['queueField']:_0x351b64[_0x15e8be]['id']});}});});});}});}})[_0x8cf5('0x22')](respondWithStatusCode(_0x424b48,null))[_0x8cf5('0x2c')](handleError(_0x424b48,null));};exports[_0x8cf5('0x111')]=function(_0x2ce296,_0x2c0a73,_0x241f0f){var _0x1ad5ab={};var _0x5529a6={};var _0x19e28a;var _0x47e34e;return db[_0x8cf5('0x63')][_0x8cf5('0x8e')]({'where':{'id':_0x2ce296[_0x8cf5('0x66')]['id']}})[_0x8cf5('0x22')](handleEntityNotFound(_0x2c0a73,null))[_0x8cf5('0x22')](function(_0x512fa7){if(_0x512fa7){_0x19e28a=_0x512fa7;_0x5529a6[_0x8cf5('0x4b')]=_['keys'](db[_0x8cf5('0xbb')][_0x8cf5('0xba')]);_0x5529a6[_0x8cf5('0x4f')]=_['keys'](_0x2ce296[_0x8cf5('0x4f')]);_0x5529a6['filters']=_[_0x8cf5('0x52')](_0x5529a6[_0x8cf5('0x4b')],_0x5529a6[_0x8cf5('0x4f')]);_0x1ad5ab[_0x8cf5('0x53')]=_['intersection'](_0x5529a6[_0x8cf5('0x4b')],qs['fields'](_0x2ce296[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x1ad5ab[_0x8cf5('0x53')]=_0x1ad5ab[_0x8cf5('0x53')][_0x8cf5('0x55')]?_0x1ad5ab[_0x8cf5('0x53')]:_0x5529a6[_0x8cf5('0x4b')];_0x1ad5ab[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x2ce296['query'][_0x8cf5('0x59')]);_0x1ad5ab[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x2ce296[_0x8cf5('0x4f')],_0x5529a6[_0x8cf5('0x51')]));if(_0x2ce296[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x1ad5ab[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0x1ad5ab[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x1ad5ab['attributes'],function(_0x1cab66){var _0x145f59={};_0x145f59[_0x1cab66]={'$like':'%'+_0x2ce296[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0x145f59;})});}_0x1ad5ab=_['merge']({},_0x1ad5ab,_0x2ce296[_0x8cf5('0x60')]);return _0x19e28a['getLists'](_0x1ad5ab);}})[_0x8cf5('0x22')](function(_0xe43675){if(_0xe43675){_0x47e34e=_0xe43675[_0x8cf5('0x55')];if(!_0x2ce296[_0x8cf5('0x4f')]['hasOwnProperty'](_0x8cf5('0xc1'))){_0x1ad5ab['limit']=qs['limit'](_0x2ce296['query']['limit']);_0x1ad5ab[_0x8cf5('0x31')]=qs[_0x8cf5('0x31')](_0x2ce296['query']['offset']);}return _0x19e28a['getLists'](_0x1ad5ab);}})[_0x8cf5('0x22')](function(_0xb18737){if(_0xb18737){return _0xb18737?{'count':_0x47e34e,'rows':_0xb18737}:null;}})[_0x8cf5('0x22')](respondWithResult(_0x2c0a73,null))[_0x8cf5('0x2c')](handleError(_0x2c0a73,null));};exports[_0x8cf5('0x112')]=function(_0x8c5372,_0xeba760,_0x25afcd){var _0x384db4={};var _0x3658f4={};var _0x3cba65;var _0x8c07b1;return db[_0x8cf5('0x63')]['findOne']({'where':{'id':_0x8c5372['params']['id']}})['then'](handleEntityNotFound(_0xeba760,null))[_0x8cf5('0x22')](function(_0x32fbce){if(_0x32fbce){_0x3cba65=_0x32fbce;_0x3658f4[_0x8cf5('0x4b')]=_[_0x8cf5('0x50')](db[_0x8cf5('0x63')][_0x8cf5('0xba')]);_0x3658f4[_0x8cf5('0x4f')]=_['keys'](_0x8c5372['query']);_0x3658f4[_0x8cf5('0x51')]=_[_0x8cf5('0x52')](_0x3658f4[_0x8cf5('0x4b')],_0x3658f4['query']);_0x384db4[_0x8cf5('0x53')]=_[_0x8cf5('0x52')](_0x3658f4[_0x8cf5('0x4b')],qs[_0x8cf5('0x54')](_0x8c5372[_0x8cf5('0x4f')][_0x8cf5('0x54')]));_0x384db4[_0x8cf5('0x53')]=_0x384db4[_0x8cf5('0x53')]['length']?_0x384db4[_0x8cf5('0x53')]:_0x3658f4[_0x8cf5('0x4b')];_0x384db4[_0x8cf5('0x58')]=qs[_0x8cf5('0x59')](_0x8c5372[_0x8cf5('0x4f')][_0x8cf5('0x59')]);_0x384db4[_0x8cf5('0x5d')]=qs[_0x8cf5('0x51')](_[_0x8cf5('0x5a')](_0x8c5372[_0x8cf5('0x4f')],_0x3658f4['filters']));if(_0x8c5372[_0x8cf5('0x4f')][_0x8cf5('0x3e')]){_0x384db4[_0x8cf5('0x5d')]=_[_0x8cf5('0x5b')](_0x384db4[_0x8cf5('0x5d')],{'$or':_[_0x8cf5('0x3f')](_0x384db4[_0x8cf5('0x53')],function(_0x50af1e){var _0x4d0aff={};_0x4d0aff[_0x50af1e]={'$like':'%'+_0x8c5372[_0x8cf5('0x4f')][_0x8cf5('0x3e')]+'%'};return _0x4d0aff;})});}_0x384db4[_0x8cf5('0x4b')]=db['User'];_0x384db4['as']=_0x8cf5('0x3a');_0x384db4=_[_0x8cf5('0x5b')]({},_0x384db4,_0x8c5372[_0x8cf5('0x60')]);return _0x3cba65['getVoiceQueues']({'include':[_0x384db4]});}})['then'](function(_0x183c02){if(_0x183c02){var _0x560562={},_0x67acd=[],_0x4d910a=0x0;for(var _0x5d4b65=0x0;_0x5d4b65<_0x183c02[_0x8cf5('0x55')];_0x5d4b65+=0x1){for(var _0x13e097=0x0,_0x56fc5e;_0x13e097<_0x183c02[_0x5d4b65][_0x8cf5('0x3a')][_0x8cf5('0x55')];_0x13e097+=0x1){_0x56fc5e=_0x183c02[_0x5d4b65][_0x8cf5('0x3a')][_0x13e097]['get']({'plain':!![]});_0x560562[_0x56fc5e['id']]=_0x56fc5e;}}_0x560562=_['values'](_0x560562);for(var _0x1ad4bd=qs[_0x8cf5('0x31')](_0x8c5372[_0x8cf5('0x4f')][_0x8cf5('0x31')]);_0x1ad4bd<_0x560562['length']&&_0x67acd['length']=_0xb28d42){_0x564d67=_0xb28d42;_0x12c5cc=0xc8;}else{_0x12c5cc=0xce;}_0x2c3099[_0x4402('0x2a')](_0x12c5cc);return _0x2c3099['set']('Content-Range',_0x2817ad+'-'+_0x564d67+'/'+_0xb28d42)['json'](_0x3263ab);}return null;};}function patchUpdates(_0x5ea5f5){return function(_0x1df278){try{jsonpatch[_0x4402('0x30')](_0x1df278,_0x5ea5f5,!![]);}catch(_0x58010b){return BPromise['reject'](_0x58010b);}return _0x1df278[_0x4402('0x31')]();};}function saveUpdates(_0x13714e,_0x47212a){return function(_0x1feae1){if(_0x1feae1){return _0x1feae1[_0x4402('0x32')](_0x13714e)[_0x4402('0x1f')](function(_0x3d47a4){return _0x3d47a4;});}return null;};}function removeEntity(_0x2f9809,_0x538032){return function(_0x42f74a){if(_0x42f74a){return _0x42f74a[_0x4402('0x33')]()['then'](function(){var _0xdc8b43=_0x42f74a[_0x4402('0x34')]({'plain':!![]});var _0x3250a5=[{'name':'Users','value':_0x4402('0x35'),'ignore':!![]},{'name':_0x4402('0x36'),'value':_0x4402('0x37'),'ignore':![]},{'name':'Telephones','value':_0x4402('0x38'),'ignore':![]}];var _0x2dc431=_(_0x3250a5)[_0x4402('0x39')](_0x4402('0x3a'))['map'](_0x4402('0x3b'))['value']();if(_[_0x4402('0x3c')](_0x2dc431,_0xdc8b43[_0x4402('0x3d')])){return;}var _0x68c44e=_[_0x4402('0x3e')](_0x3250a5,[_0x4402('0x3b'),_0xdc8b43[_0x4402('0x3d')]])[_0x4402('0x3f')];return db[_0x4402('0x40')][_0x4402('0x33')]({'where':{'type':_0x68c44e,'resourceId':_0xdc8b43['id']}})[_0x4402('0x1f')](function(){return _0x42f74a;});})[_0x4402('0x1f')](function(){_0x2f9809[_0x4402('0x2a')](0xcc)[_0x4402('0x2b')]();});}};}function handleEntityNotFound(_0x3378d6,_0x52443e){return function(_0x3665bb){if(!_0x3665bb){_0x3378d6[_0x4402('0x41')](0x194);}return _0x3665bb;};}function handleError(_0x3b706c,_0x4d29e9){_0x4d29e9=_0x4d29e9||0x1f4;return function(_0x3349b2){logger[_0x4402('0x25')](_0x3349b2[_0x4402('0x42')]);if(_0x3349b2[_0x4402('0x3f')]){delete _0x3349b2[_0x4402('0x3f')];}_0x3b706c[_0x4402('0x2a')](_0x4d29e9)[_0x4402('0x43')](_0x3349b2);};}exports[_0x4402('0x44')]=function(_0x103f69,_0x1c63ce){var _0x56be56={},_0x6b8251={},_0x4c5878={'count':0x0,'rows':[]};var _0xc83296=_[_0x4402('0x45')](db[_0x4402('0x46')][_0x4402('0x47')],function(_0x3e01ed){return{'name':_0x3e01ed[_0x4402('0x48')],'type':_0x3e01ed['type'][_0x4402('0x49')]};});_0x6b8251['model']=_[_0x4402('0x4a')](_[_0x4402('0x45')](_0xc83296,_0x4402('0x3f')),[_0x4402('0x4b'),_0x4402('0x4c')]);_0x6b8251[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x103f69['query']);_0x6b8251[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x6b8251[_0x4402('0x51')],_0x6b8251[_0x4402('0x4d')]);_0x56be56['attributes']=_['intersection'](_0x6b8251[_0x4402('0x51')],qs[_0x4402('0x52')](_0x103f69[_0x4402('0x4d')][_0x4402('0x52')]));_0x56be56['attributes']=_0x56be56[_0x4402('0x53')][_0x4402('0x54')]?_0x56be56[_0x4402('0x53')]:_0x6b8251[_0x4402('0x51')];if(!_0x103f69[_0x4402('0x4d')]['hasOwnProperty'](_0x4402('0x55'))){_0x56be56[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x103f69[_0x4402('0x4d')][_0x4402('0x2f')]);_0x56be56[_0x4402('0x2e')]=qs['offset'](_0x103f69[_0x4402('0x4d')]['offset']);}_0x56be56[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x103f69[_0x4402('0x4d')][_0x4402('0x57')]);_0x56be56[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x103f69['query'],_0x6b8251[_0x4402('0x4f')]),_0xc83296);if(_0x103f69[_0x4402('0x4d')]['filter']){_0x56be56[_0x4402('0x58')]=_['merge'](_0x56be56['where'],{'$or':_[_0x4402('0x45')](_0xc83296,function(_0x5628cb){if(_0x5628cb['type']!==_0x4402('0x5a')){return db[_0x4402('0x5b')]['where'](db['sequelize']['fn'](_0x4402('0x5c'),db[_0x4402('0x5b')][_0x4402('0x5d')](_0x5628cb[_0x4402('0x3f')])),{'$like':db[_0x4402('0x5b')]['fn'](_0x4402('0x5c'),'%'+_0x103f69[_0x4402('0x4d')]['filter']+'%')});}})});}_0x56be56=_[_0x4402('0x5e')]({},_0x56be56,_0x103f69[_0x4402('0x5f')]);var _0x3f2ede={'where':_0x56be56[_0x4402('0x58')]};return db[_0x4402('0x46')][_0x4402('0x2d')](_0x3f2ede)[_0x4402('0x1f')](function(_0x37beb1){_0x4c5878[_0x4402('0x2d')]=_0x37beb1;if(_0x103f69[_0x4402('0x4d')][_0x4402('0x60')]){_0x56be56[_0x4402('0x61')]=[{'all':!![]}];}return db['User']['findAll'](_0x56be56);})[_0x4402('0x1f')](function(_0x4413df){_0x4c5878[_0x4402('0x62')]=_0x4413df;return _0x4c5878;})['then'](respondWithFilteredResult(_0x1c63ce,_0x56be56))['catch'](handleError(_0x1c63ce,null));};exports['show']=function(_0x1ee5da,_0x4f052){var _0x273091={'raw':![],'where':{'id':_0x1ee5da[_0x4402('0x63')]['id']}},_0x207624={};_0x207624[_0x4402('0x51')]=_['differenceBy'](_[_0x4402('0x4e')](db[_0x4402('0x46')]['rawAttributes']),[_0x4402('0x4b'),_0x4402('0x4c')]);_0x207624[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x1ee5da[_0x4402('0x4d')]);_0x207624[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x207624[_0x4402('0x51')],_0x207624[_0x4402('0x4d')]);_0x273091[_0x4402('0x53')]=_['intersection'](_0x207624[_0x4402('0x51')],qs[_0x4402('0x52')](_0x1ee5da[_0x4402('0x4d')]['fields']));_0x273091[_0x4402('0x53')]=_0x273091['attributes'][_0x4402('0x54')]?_0x273091[_0x4402('0x53')]:_0x207624[_0x4402('0x51')];if(_0x1ee5da[_0x4402('0x4d')]['includeAll']){_0x273091[_0x4402('0x61')]=[{'all':!![]}];}_0x273091=_[_0x4402('0x5e')]({},_0x273091,_0x1ee5da[_0x4402('0x5f')]);return db['User']['find'](_0x273091)[_0x4402('0x1f')](handleEntityNotFound(_0x4f052,null))[_0x4402('0x1f')](respondWithResult(_0x4f052,null))[_0x4402('0x29')](handleError(_0x4f052,null));};exports['bulkCreate']=function(_0x1a5a7d,_0x105456){return db[_0x4402('0x46')]['bulkCreate'](_0x1a5a7d[_0x4402('0x64')],{'raw':![],'individualHooks':!![]})[_0x4402('0x1f')](respondWithResult(_0x105456,0xc9))[_0x4402('0x29')](handleError(_0x105456,null));};exports[_0x4402('0x32')]=function(_0x554975,_0x137967){if(_0x554975['body']['id']){delete _0x554975[_0x4402('0x64')]['id'];}delete _0x554975[_0x4402('0x64')][_0x4402('0x3d')];return db['User']['find']({'where':{'id':_0x554975['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x137967,null))['then'](saveUpdates(_0x554975[_0x4402('0x64')],null))[_0x4402('0x1f')](respondWithResult(_0x137967,null))['catch'](handleError(_0x137967,null));};exports[_0x4402('0x65')]=function(_0x515d85,_0x5335ab){return db[_0x4402('0x46')][_0x4402('0x65')]()[_0x4402('0x1f')](respondWithResult(_0x5335ab,null))['catch'](handleError(_0x5335ab,null));};exports['addContacts']=function(_0x2823d9,_0x4e735d,_0x30a11e){return db['User'][_0x4402('0x3e')]({'where':{'id':_0x2823d9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4e735d,null))['then'](function(_0x5b4150){if(_0x5b4150){return _0x5b4150[_0x4402('0x66')](_0x2823d9['body'][_0x4402('0x67')],_[_0x4402('0x68')](_0x2823d9[_0x4402('0x64')],[_0x4402('0x67'),'id'])||{});}})[_0x4402('0x1f')](respondWithResult(_0x4e735d,null))['catch'](handleError(_0x4e735d,null));};var getLicense=function(_0x4f3da1){return new BPromise(function(_0x2fc12b,_0x19aa96){var _0x3ecc4f=0x0;_0x4f3da1['body'][_0x4402('0x3d')]===_0x4402('0x37')&&_0x2fc12b('agent\x20role');return db[_0x4402('0x46')][_0x4402('0x2d')]({'where':{'$or':[{'role':_0x4f3da1[_0x4402('0x64')]['role']==='telephone'?_0x4402('0x38'):[_0x4402('0x69'),_0x4402('0x35')]}]}})[_0x4402('0x1f')](function(_0x3a0daf){_0x3ecc4f=_0x3a0daf;return require('../../config/license/util')[_0x4402('0x6a')]();})['then'](function(_0x551d3b){var _0x57399e=_0x4f3da1[_0x4402('0x64')][_0x4402('0x3d')]===_0x4402('0x38')?_0x4402('0x6b'):_0x4402('0x6c');if(!_[_0x4402('0x6d')](_0x551d3b[_0x57399e])&&_0x3ecc4f>=_0x551d3b[_0x57399e]){return _0x19aa96({'message':'License\x20limit\x20reached'});}return _0x2fc12b(util[_0x4402('0x6e')]('count\x20%s:\x20%s',_0x57399e,_0x3ecc4f));})[_0x4402('0x29')](function(_0x5de000){return _0x19aa96(_0x5de000);});});};exports[_0x4402('0x6f')]=function(_0x2ae806,_0x243d76){return getLicense(_0x2ae806)[_0x4402('0x1f')](function(_0x11caae){if(!_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]){var _0x1b4f14;return db[_0x4402('0x71')][_0x4402('0x72')](0x1)[_0x4402('0x1f')](function(_0x23da78){return checkPasswordPattern(_0x23da78,_0x2ae806[_0x4402('0x64')]['password'],_0x23da78[_0x4402('0x73')]);})[_0x4402('0x1f')](function(_0x14d6b7){_0x1b4f14=_0x14d6b7[_0x4402('0x74')];return db[_0x4402('0x46')]['max'](_0x4402('0x70'));})[_0x4402('0x1f')](function(_0x3e6350){if(_['isNil'](_0x3e6350)){if(_0x1b4f14){_0x2ae806['body']['internal']=_0x1b4f14;}else{_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]=0x1;}}else{if(_['isNil'](_0x1b4f14)||_0x1b4f14==_0x3e6350){_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]=_0x3e6350+0x1;}else if(_0x1b4f14>_0x3e6350){_0x2ae806['body'][_0x4402('0x70')]=_0x1b4f14;}else{return db[_0x4402('0x5b')]['query'](_0x4402('0x75'),{'type':db[_0x4402('0x5b')][_0x4402('0x76')][_0x4402('0x77')]})[_0x4402('0x1f')](function(_0x549a7f){if(_0x549a7f&&_0x549a7f[_0x4402('0x54')]){for(var _0xbf9cdc=0x0,_0xf3637f=_0x549a7f[_0x4402('0x54')];_0xbf9cdc<_0xf3637f&&_[_0x4402('0x6d')](_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]);_0xbf9cdc++){if(_0x1b4f14<=_0x549a7f[_0xbf9cdc][_0x4402('0x78')]){_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]=_0x549a7f[_0xbf9cdc]['from'];}else if(_0x1b4f14>_0x549a7f[_0xbf9cdc][_0x4402('0x78')]&&_0x1b4f14<=_0x549a7f[_0xbf9cdc]['to']){_0x2ae806[_0x4402('0x64')]['internal']=_0x1b4f14;}}}if(_[_0x4402('0x6d')](_0x2ae806[_0x4402('0x64')][_0x4402('0x70')])){_0x2ae806[_0x4402('0x64')][_0x4402('0x70')]=_0x3e6350+0x1;}});}}});}})[_0x4402('0x1f')](function(){if(_0x2ae806[_0x4402('0x64')]['voicemail']){_0x2ae806[_0x4402('0x64')]['mailbox']=_0x2ae806[_0x4402('0x64')][_0x4402('0x70')];_0x2ae806['body'][_0x4402('0x79')]={'mailbox':_0x2ae806['body'][_0x4402('0x70')],'password':_0x2ae806[_0x4402('0x64')]['password'],'fullname':_0x2ae806[_0x4402('0x64')]['fullname'],'email':_0x2ae806[_0x4402('0x64')][_0x4402('0x7a')]};}if(_0x2ae806[_0x4402('0x64')]&&_0x2ae806[_0x4402('0x64')]['role']===_0x4402('0x37')){if(!_0x2ae806[_0x4402('0x64')]['permissions']){_0x2ae806['body']['permissions']=[_0x4402('0x7b'),'102',_0x4402('0x7c'),_0x4402('0x7d'),'110',_0x4402('0x7e'),'105','106',_0x4402('0x7f'),_0x4402('0x80'),'109','100',_0x4402('0x81'),_0x4402('0x82')];}}return db[_0x4402('0x46')][_0x4402('0x6f')](_0x2ae806[_0x4402('0x64')],{'include':[{'model':db[_0x4402('0x79')],'as':_0x4402('0x79')}]});})['then'](function(_0x4abd0e){if(_0x2ae806[_0x4402('0x64')][_0x4402('0x3d')]===_0x4402('0x35'))return _0x4abd0e;var _0x28157c=_0x2ae806[_0x4402('0x35')][_0x4402('0x34')]({'plain':!![]});if(!_0x28157c)throw new Error(_0x4402('0x83'));if(_0x28157c[_0x4402('0x3d')]===_0x4402('0x35')){var _0x3df488=_0x4abd0e['get']({'plain':!![]});var _0x2cc9e6=[{'name':_0x4402('0x36'),'value':_0x4402('0x37')},{'name':_0x4402('0x84'),'value':'telephone'}];var _0x4a4c76=_[_0x4402('0x3e')](_0x2cc9e6,['value',_0x3df488['role']])[_0x4402('0x3f')];return db['UserProfileSection'][_0x4402('0x3e')]({'where':{'name':_0x4a4c76,'userProfileId':_0x28157c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x3a6755){if(_0x3a6755&&_0x3a6755[_0x4402('0x85')]===0x0){return db[_0x4402('0x40')]['create']({'name':_0x3df488[_0x4402('0x3f')],'resourceId':_0x3df488['id'],'type':_0x3a6755['name'],'sectionId':_0x3a6755['id']},{})['then'](function(){return _0x4abd0e;});}else{return _0x4abd0e;}})[_0x4402('0x29')](function(_0xd1f73f){logger['error'](_0x4402('0x86'),_0xd1f73f);throw _0xd1f73f;});}return _0x4abd0e;})[_0x4402('0x1f')](respondWithResult(_0x243d76,0xc9))[_0x4402('0x29')](handleError(_0x243d76,null));};exports[_0x4402('0x87')]=function(_0x4b2c7f,_0x55e9eb,_0x488417){var _0x5e6aca=![];if(_0x4b2c7f[_0x4402('0x64')]['id']){delete _0x4b2c7f['body']['id'];}return db[_0x4402('0x71')]['findOne']({'attributes':['id','securePassword']})[_0x4402('0x1f')](function(_0x11df5b){_0x5e6aca=_0x11df5b[_0x4402('0x73')];return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x4b2c7f[_0x4402('0x63')]['id']}});})['then'](function(_0x279e85){if(_0x279e85){if(_0x279e85['id']==_0x4b2c7f[_0x4402('0x35')]['id']){if(!_0x4b2c7f[_0x4402('0x64')][_0x4402('0x88')]||!_0x4b2c7f[_0x4402('0x64')][_0x4402('0x89')]){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))](_0x4402('0x8b'));}if(!_0x279e85['authenticate'](_0x4b2c7f['body'][_0x4402('0x88')])){throw new db[(_0x4402('0x1c'))]['ValidationError'](_0x4402('0x8c'));}if(_0x4b2c7f[_0x4402('0x64')]['oldPassword']==_0x4b2c7f['body'][_0x4402('0x89')]){throw new db['Sequelize']['ValidationError'](_0x4402('0x8d'));}return _0x279e85;}else if(_0x4b2c7f[_0x4402('0x35')][_0x4402('0x3d')]==_0x4402('0x69')){if(!_0x4b2c7f[_0x4402('0x64')][_0x4402('0x89')]){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))](_0x4402('0x8e'));}return _0x279e85;}else if(_0x4b2c7f[_0x4402('0x35')][_0x4402('0x3d')]=='user'){if(!_0x4b2c7f[_0x4402('0x64')][_0x4402('0x89')]){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))](_0x4402('0x8e'));}if(_0x279e85[_0x4402('0x3d')]!=_0x4402('0x37')){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))]('Unauthorized');}return _0x279e85;}else{throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))]('Unauthorized');}}return null;})[_0x4402('0x1f')](handleEntityNotFound(_0x55e9eb,null))['then'](function(_0x529782){return checkPasswordPattern(_0x529782,_0x4b2c7f[_0x4402('0x64')][_0x4402('0x89')],_0x5e6aca);})['then'](saveUpdates({'password':_0x4b2c7f['body'][_0x4402('0x89')],'passwordResetAt':_0x4b2c7f[_0x4402('0x35')]['id']==_0x4b2c7f[_0x4402('0x63')]['id']?moment():null},null))['then'](respondWithResult(_0x55e9eb,null))[_0x4402('0x29')](handleError(_0x55e9eb,null));};exports[_0x4402('0x8f')]=function(_0x144be7,_0xde7631,_0x37939c){var _0x843cfc=_0x144be7[_0x4402('0x64')][_0x4402('0x90')];return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x144be7['params']['id']},'attributes':['id','name',_0x4402('0x3d'),_0x4402('0x91'),_0x4402('0x92'),_0x4402('0x93'),_0x4402('0x94')]})[_0x4402('0x1f')](handleEntityNotFound(_0xde7631,null))['then'](function(_0x28e930){if(_0x28e930){if(!utils[_0x4402('0x95')](_0x843cfc)){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))]('Unknown\x20channel');}return _0x28e930['add'+_[_0x4402('0x96')](_0x843cfc['toLowerCase']())+_0x4402('0x97')](_0x144be7[_0x4402('0x64')][_0x4402('0x67')],{'penalty':_0x144be7['body']['penalty']||0x0})[_0x4402('0x98')](function(_0x5cf36a){for(var _0x2c7404=0x0;_0x2c7404<_0x144be7['body'][_0x4402('0x67')][_0x4402('0x54')];_0x2c7404+=0x1){var _0x268de9={'UserId':_0x144be7['params']['id']};_0x268de9[_['capitalize'](_0x843cfc[_0x4402('0x99')]())+'QueueId']=_0x144be7['body'][_0x4402('0x67')][_0x2c7404];socket[_0x4402('0x9a')](_0x4402('0x35')+_[_0x4402('0x96')](_0x843cfc[_0x4402('0x99')]())+_0x4402('0x9b'),_0x268de9);}return _0x5cf36a;})[_0x4402('0x1f')](function(){if(_0x843cfc===_0x4402('0x9c')){return db[_0x4402('0x9d')][_0x4402('0x9e')]({'where':{'id':_0x144be7[_0x4402('0x64')][_0x4402('0x67')]||[]},'raw':!![],'attributes':['id',_0x4402('0x3f')]});}})['then'](function(_0x2fbeb9){var _0x732afa=_0x28e930[_0x4402('0x34')]({'plain':!![]});var _0x48d690=[];if(_0x843cfc==='voice'&&_0x732afa['role']===_0x4402('0x37')&&_0x732afa['online']){for(var _0xfdf99c=0x0;_0xfdf99c<_0x2fbeb9[_0x4402('0x54')];_0xfdf99c+=0x1){_0x48d690[_0x4402('0x9f')]({'membername':_0x732afa[_0x4402('0x3f')],'UserId':_0x732afa['id'],'queue_name':_0x2fbeb9[_0xfdf99c][_0x4402('0x3f')],'VoiceQueueId':_0x2fbeb9[_0xfdf99c]['id'],'interface':_['isNil'](_0x732afa[_0x4402('0x94')])?util[_0x4402('0x6e')](_0x4402('0xa0'),_0x732afa['name']):_0x732afa[_0x4402('0x94')],'paused':_0x732afa[_0x4402('0x93')]||![],'penalty':_0x144be7[_0x4402('0x64')][_0x4402('0xa1')]||0x0});}return BPromise[_0x4402('0xa2')](_0x48d690,function(_0x6cf5cf){return db['UserVoiceQueueRt']['upsert'](_0x6cf5cf);});}return _0x28e930;});}})[_0x4402('0x1f')](respondWithStatusCode(_0xde7631,null))[_0x4402('0x29')](handleError(_0xde7631,null));};exports[_0x4402('0xa3')]=function(_0x517a22,_0x40e814,_0x4ff826){var _0x4db364;return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x517a22['params']['id']},'attributes':['id',_0x4402('0x3f'),'role']})['then'](handleEntityNotFound(_0x40e814,null))['then'](function(_0x2b004f){if(_0x2b004f){_0x4db364=_0x2b004f;if(!_0x517a22['query']['channel']||!utils[_0x4402('0x95')](_0x517a22['query'][_0x4402('0x90')])){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))](_0x4402('0xa4'));}return _0x2b004f[_0x4402('0xa5')+_[_0x4402('0x96')](_0x517a22['query'][_0x4402('0x90')]['toLowerCase']())+_0x4402('0x97')](_0x517a22[_0x4402('0x4d')]['ids']);}})[_0x4402('0x1f')](function(_0x3c78ec){for(var _0x332eee=0x0;_0x332eee<_0x517a22[_0x4402('0x4d')][_0x4402('0x67')]['length'];_0x332eee+=0x1){var _0x5e99ee={'UserId':_0x517a22[_0x4402('0x63')]['id']};_0x5e99ee[_['capitalize'](_0x517a22['query'][_0x4402('0x90')][_0x4402('0x99')]())+_0x4402('0xa6')]=_0x517a22[_0x4402('0x4d')]['ids'][_0x332eee];socket[_0x4402('0x9a')](_0x4402('0x35')+_[_0x4402('0x96')](_0x517a22[_0x4402('0x4d')][_0x4402('0x90')][_0x4402('0x99')]())+_0x4402('0xa7'),_0x5e99ee);}return _0x3c78ec;})['then'](function(){if(_0x517a22['query'][_0x4402('0x90')]===_0x4402('0x9c')){return db[_0x4402('0xa8')]['destroy']({'where':{'UserId':_0x517a22[_0x4402('0x63')]['id'],'VoiceQueueId':_0x517a22[_0x4402('0x4d')]['ids']},'individualHooks':!![]})[_0x4402('0x1f')](function(){return _0x4db364;});}return _0x4db364;})[_0x4402('0x1f')](respondWithStatusCode(_0x40e814,null))[_0x4402('0x29')](handleError(_0x40e814,null));};exports[_0x4402('0xa9')]=function(_0x4439e2,_0x174476,_0x2012bd){_0x4439e2[_0x4402('0x64')]['userpic']=_0x4439e2[_0x4402('0xaa')][_0x4402('0xab')];return db[_0x4402('0x46')]['find']({'where':{'id':_0x4439e2[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x174476,null))['then'](saveUpdates(_0x4439e2[_0x4402('0x64')],null))[_0x4402('0x1f')](respondWithResult(_0x174476,null))[_0x4402('0x29')](handleError(_0x174476,null));};exports['getAvatar']=function(_0x1d434e,_0x3e8caf,_0x473cf5){var _0x183352=path[_0x4402('0xac')](config[_0x4402('0xad')],_0x4402('0xae'));return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x1d434e['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3e8caf,null))['then'](function(_0x3ffd46){if(_0x3ffd46){if(_[_0x4402('0x6d')](_0x3ffd46[_0x4402('0xaf')])){return _0x3e8caf[_0x4402('0xb0')](_0x183352);}else{if(!fs[_0x4402('0xb1')](path['join'](config[_0x4402('0xad')],_0x4402('0xb2'),_0x3ffd46[_0x4402('0xaf')]))){return _0x3e8caf[_0x4402('0xb0')](_0x183352);}return _0x3e8caf[_0x4402('0xb0')](path[_0x4402('0xac')](config['root'],_0x4402('0xb2'),_0x3ffd46[_0x4402('0xaf')]));}}})['catch'](handleError(_0x3e8caf,null));};exports['getContacts']=function(_0x138f25,_0x2e1405,_0x4b0ebe){var _0x2f38ee={};var _0x4259fc={};var _0x4353b7;var _0x4dd48c;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x138f25[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x2e1405,null))[_0x4402('0x1f')](function(_0x3d5319){if(_0x3d5319){_0x4353b7=_0x3d5319;_0x4259fc[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xb4')]['rawAttributes']);_0x4259fc[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x138f25['query']);_0x4259fc[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x4259fc[_0x4402('0x51')],_0x4259fc[_0x4402('0x4d')]);_0x2f38ee[_0x4402('0x53')]=_[_0x4402('0x50')](_0x4259fc[_0x4402('0x51')],qs[_0x4402('0x52')](_0x138f25[_0x4402('0x4d')]['fields']));_0x2f38ee[_0x4402('0x53')]=_0x2f38ee[_0x4402('0x53')][_0x4402('0x54')]?_0x2f38ee['attributes']:_0x4259fc[_0x4402('0x51')];_0x2f38ee[_0x4402('0x56')]=qs['sort'](_0x138f25['query']['sort']);_0x2f38ee['where']=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x138f25[_0x4402('0x4d')],_0x4259fc[_0x4402('0x4f')]));if(_0x138f25[_0x4402('0x4d')][_0x4402('0x39')]){_0x2f38ee[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x2f38ee[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x2f38ee[_0x4402('0x53')],function(_0x183f24){var _0x395823={};_0x395823[_0x183f24]={'$like':'%'+_0x138f25[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x395823;})});}_0x2f38ee=_['merge']({},_0x2f38ee,_0x138f25[_0x4402('0x5f')]);return _0x4353b7['getContacts'](_0x2f38ee);}})['then'](function(_0x56084f){if(_0x56084f){_0x4dd48c=_0x56084f['length'];if(_0x138f25[_0x4402('0x4d')]['hasOwnProperty']('includeAll')){_0x2f38ee[_0x4402('0x61')]=[{'model':db[_0x4402('0xb5')],'as':_0x4402('0xb6'),'required':![]},{'model':db[_0x4402('0xb7')],'as':'Tags','attributes':['id',_0x4402('0x3f'),_0x4402('0xb8')],'where':_0x138f25[_0x4402('0x4d')]['tag']?{'id':_0x138f25['query'][_0x4402('0xb9')]}:undefined,'required':_0x138f25[_0x4402('0x4d')]['tag']?!![]:![]}];}if(!_0x138f25[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x2f38ee[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x138f25[_0x4402('0x4d')][_0x4402('0x2f')]);_0x2f38ee['offset']=qs['offset'](_0x138f25[_0x4402('0x4d')][_0x4402('0x2e')]);}return _0x4353b7[_0x4402('0xbb')](_0x2f38ee);}})[_0x4402('0x1f')](function(_0x16ec2c){if(_0x16ec2c){return _0x16ec2c?{'count':_0x4dd48c,'rows':_0x16ec2c}:null;}})[_0x4402('0x1f')](respondWithResult(_0x2e1405,null))[_0x4402('0x29')](handleError(_0x2e1405,null));};exports[_0x4402('0xbc')]=function(_0x4447dc,_0x2888f0,_0x3ad56f){var _0x553a44;var _0x1ae9f0;var _0x335976={};var _0x4add02;return db['User'][_0x4402('0xb3')]({'where':{'id':_0x4447dc['params']['id']},'attributes':['id','name',_0x4402('0x3d')]})[_0x4402('0x1f')](handleEntityNotFound(_0x2888f0,null))[_0x4402('0x1f')](function(_0x532f9d){if(!utils['isValidChannel'](_0x4447dc[_0x4402('0x4d')][_0x4402('0x90')])){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))](_0x4402('0xa4'));}_0x553a44=_0x532f9d;var _0x305146={};_0x305146[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_[_0x4402('0x96')](_0x4447dc[_0x4402('0x4d')]['channel'])+_0x4402('0xbd')]['rawAttributes']);_0x305146[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x4447dc['query']);_0x305146[_0x4402('0x4f')]=_['intersection'](_0x305146['model'],_0x305146[_0x4402('0x4d')]);_0x335976['attributes']=_[_0x4402('0x50')](_0x305146[_0x4402('0x51')],qs[_0x4402('0x52')](_0x4447dc[_0x4402('0x4d')]['fields']));_0x335976['attributes']=_0x335976[_0x4402('0x53')][_0x4402('0x54')]?_0x335976[_0x4402('0x53')]:_0x305146[_0x4402('0x51')];_0x335976[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x4447dc[_0x4402('0x4d')]['sort']);_0x335976[_0x4402('0x58')]=qs[_0x4402('0x4f')](_['pick'](_0x4447dc['query'],_0x305146[_0x4402('0x4f')]));if(_0x4447dc['query']['filter']){_0x335976[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x335976['where'],{'$or':_[_0x4402('0x45')](_0x335976[_0x4402('0x53')],function(_0x5c0f7b){var _0x1ca89a={};_0x1ca89a[_0x5c0f7b]={'$like':'%'+_0x4447dc[_0x4402('0x4d')]['filter']+'%'};return _0x1ca89a;})});}_0x335976=_['merge']({},_0x335976,_0x4447dc[_0x4402('0x5f')]);switch(_0x553a44['role']){case _0x4402('0x69'):return db[_['capitalize'](_0x4447dc['query']['channel'])+_0x4402('0xbd')]['findAll'](_0x335976);case'user':case'agent':return _0x553a44[_0x4402('0x34')+_[_0x4402('0x96')](_0x4447dc['query'][_0x4402('0x90')])+_0x4402('0x97')](_0x335976);default:throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))]('Unknown\x20role');}})[_0x4402('0x1f')](function(_0x1b89d2){_0x4add02=_0x1b89d2['length'];if(!_0x4447dc[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x335976[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x4447dc[_0x4402('0x4d')][_0x4402('0x2f')]);_0x335976[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x4447dc[_0x4402('0x4d')]['offset']);}switch(_0x553a44[_0x4402('0x3d')]){case _0x4402('0x69'):return db[_[_0x4402('0x96')](_0x4447dc['query'][_0x4402('0x90')])+_0x4402('0xbd')]['findAll'](_0x335976);case _0x4402('0x35'):case'agent':return _0x553a44['get'+_[_0x4402('0x96')](_0x4447dc[_0x4402('0x4d')][_0x4402('0x90')])+_0x4402('0x97')](_0x335976);}})[_0x4402('0x1f')](function(_0x170157){return{'count':_0x4add02,'rows':_0x170157};})['then'](respondWithResult(_0x2888f0,null))[_0x4402('0x29')](handleError(_0x2888f0,null));};exports[_0x4402('0xbe')]=function(_0x369b5e,_0x285fda,_0x4b0aac){var _0x3cca76={};var _0x572004={};var _0x15123a;var _0x1a0a35;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x369b5e['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x285fda,null))[_0x4402('0x1f')](function(_0x5d8031){if(_0x5d8031){_0x15123a=_0x5d8031;_0x572004['model']=_[_0x4402('0x4e')](db[_0x4402('0xa8')][_0x4402('0x47')]);_0x572004['query']=_[_0x4402('0x4e')](_0x369b5e[_0x4402('0x4d')]);_0x572004[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x572004['model'],_0x572004[_0x4402('0x4d')]);_0x3cca76[_0x4402('0x53')]=_[_0x4402('0x50')](_0x572004[_0x4402('0x51')],qs['fields'](_0x369b5e[_0x4402('0x4d')][_0x4402('0x52')]));_0x3cca76[_0x4402('0x53')]=_0x3cca76[_0x4402('0x53')]['length']?_0x3cca76[_0x4402('0x53')]:_0x572004['model'];_0x3cca76[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x369b5e[_0x4402('0x4d')][_0x4402('0x57')]);_0x3cca76[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x369b5e[_0x4402('0x4d')],_0x572004[_0x4402('0x4f')]));if(_0x369b5e[_0x4402('0x4d')][_0x4402('0x39')]){_0x3cca76['where']=_[_0x4402('0x5e')](_0x3cca76[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x3cca76['attributes'],function(_0x359941){var _0x837d56={};_0x837d56[_0x359941]={'$like':'%'+_0x369b5e[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x837d56;})});}_0x3cca76=_['merge']({},_0x3cca76,_0x369b5e[_0x4402('0x5f')]);return _0x15123a[_0x4402('0xbe')](_0x3cca76);}})[_0x4402('0x1f')](function(_0x90c7f9){if(_0x90c7f9){_0x1a0a35=_0x90c7f9[_0x4402('0x54')];if(!_0x369b5e[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x3cca76[_0x4402('0x2f')]=qs['limit'](_0x369b5e[_0x4402('0x4d')][_0x4402('0x2f')]);_0x3cca76[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x369b5e['query'][_0x4402('0x2e')]);}return _0x15123a[_0x4402('0xbe')](_0x3cca76);}})['then'](function(_0x4239d9){if(_0x4239d9){return _0x4239d9?{'count':_0x1a0a35,'rows':_0x4239d9}:null;}})[_0x4402('0x1f')](respondWithResult(_0x285fda,null))[_0x4402('0x29')](handleError(_0x285fda,null));};exports[_0x4402('0xbf')]=function(_0x141a44,_0x5b253e,_0x124ca2){var _0x4e65fc={};var _0x1e9bb5={};var _0xb7ba46;var _0x3d4e22;return db['User'][_0x4402('0xb3')]({'where':{'id':_0x141a44['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b253e,null))['then'](function(_0x3a626e){if(_0x3a626e){_0xb7ba46=_0x3a626e;_0x1e9bb5[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xc0')][_0x4402('0x47')]);_0x1e9bb5[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x141a44[_0x4402('0x4d')]);_0x1e9bb5[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x1e9bb5['model'],_0x1e9bb5['query']);_0x4e65fc['attributes']=_[_0x4402('0x50')](_0x1e9bb5[_0x4402('0x51')],qs[_0x4402('0x52')](_0x141a44[_0x4402('0x4d')][_0x4402('0x52')]));_0x4e65fc[_0x4402('0x53')]=_0x4e65fc['attributes'][_0x4402('0x54')]?_0x4e65fc[_0x4402('0x53')]:_0x1e9bb5[_0x4402('0x51')];_0x4e65fc[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x141a44[_0x4402('0x4d')][_0x4402('0x57')]);_0x4e65fc[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x141a44[_0x4402('0x4d')],_0x1e9bb5['filters']));if(_0x141a44[_0x4402('0x4d')][_0x4402('0x39')]){_0x4e65fc[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x4e65fc[_0x4402('0x58')],{'$or':_['map'](_0x4e65fc[_0x4402('0x53')],function(_0x3aeaa4){var _0x41d962={};_0x41d962[_0x3aeaa4]={'$like':'%'+_0x141a44[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x41d962;})});}_0x4e65fc=_[_0x4402('0x5e')]({},_0x4e65fc,_0x141a44[_0x4402('0x5f')]);return _0xb7ba46[_0x4402('0xbf')](_0x4e65fc);}})[_0x4402('0x1f')](function(_0x4dd368){if(_0x4dd368){_0x3d4e22=_0x4dd368['length'];if(!_0x141a44[_0x4402('0x4d')][_0x4402('0xba')]('nolimit')){_0x4e65fc[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x141a44['query']['limit']);_0x4e65fc['offset']=qs[_0x4402('0x2e')](_0x141a44['query'][_0x4402('0x2e')]);}return _0xb7ba46[_0x4402('0xbf')](_0x4e65fc);}})[_0x4402('0x1f')](function(_0x424955){if(_0x424955){return _0x424955?{'count':_0x3d4e22,'rows':_0x424955}:null;}})['then'](respondWithResult(_0x5b253e,null))[_0x4402('0x29')](handleError(_0x5b253e,null));};exports['getRecordings']=function(_0x56b541,_0x1bfce8,_0x626688){var _0x1f92d3={'raw':!![],'where':{}};var _0x184e36={};var _0x3003cf={'count':0x0,'rows':[]};return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x56b541[_0x4402('0x63')]['id']}})['then'](handleEntityNotFound(_0x1bfce8,null))[_0x4402('0x1f')](function(_0x42dc51){if(_0x42dc51){_0x184e36[_0x4402('0x51')]=_[_0x4402('0x4e')](db['VoiceRecording'][_0x4402('0x47')]);_0x184e36[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x56b541[_0x4402('0x4d')]);_0x184e36[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x184e36[_0x4402('0x51')],_0x184e36[_0x4402('0x4d')]);_0x1f92d3['attributes']=_[_0x4402('0x50')](_0x184e36['model'],qs[_0x4402('0x52')](_0x56b541['query']['fields']));_0x1f92d3['attributes']=_0x1f92d3[_0x4402('0x53')][_0x4402('0x54')]?_0x1f92d3[_0x4402('0x53')]:_0x184e36[_0x4402('0x51')];if(!_0x56b541[_0x4402('0x4d')][_0x4402('0xba')]('nolimit')){_0x1f92d3[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x56b541[_0x4402('0x4d')][_0x4402('0x2f')]);_0x1f92d3[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x56b541[_0x4402('0x4d')]['offset']);}_0x1f92d3[_0x4402('0x56')]=qs['sort'](_0x56b541[_0x4402('0x4d')]['sort']);_0x1f92d3[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x56b541[_0x4402('0x4d')],_0x184e36[_0x4402('0x4f')]));_0x1f92d3['where'][_0x4402('0xc1')]=_0x42dc51['id'];if(_0x56b541['query']['filter']){_0x1f92d3[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x1f92d3[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x1f92d3[_0x4402('0x53')],function(_0x114714){var _0x14ef3f={};_0x14ef3f[_0x114714]={'$like':'%'+_0x56b541[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x14ef3f;})});}_0x1f92d3=_[_0x4402('0x5e')]({},_0x1f92d3,_0x56b541[_0x4402('0x5f')]);return db[_0x4402('0xc2')]['count']({'where':_0x1f92d3['where']})[_0x4402('0x1f')](function(_0x20749a){_0x3003cf[_0x4402('0x2d')]=_0x20749a;if(_0x56b541[_0x4402('0x4d')][_0x4402('0x60')]){_0x1f92d3[_0x4402('0x61')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4402('0x9e')](_0x1f92d3);})[_0x4402('0x1f')](function(_0x2f21f1){_0x3003cf[_0x4402('0x62')]=_0x2f21f1;return _0x3003cf;});}})[_0x4402('0x1f')](respondWithFilteredResult(_0x1bfce8,_0x1f92d3))['catch'](handleError(_0x1bfce8,null));};exports[_0x4402('0xc3')]=function(_0x18e79c,_0x3930cf,_0x423a56){var _0x34127d={'raw':!![],'where':{}};var _0x461734={};var _0x311a1f={'count':0x0,'rows':[]};return db['User'][_0x4402('0xb3')]({'where':{'id':_0x18e79c[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3930cf,null))[_0x4402('0x1f')](function(_0x1a672b){if(_0x1a672b){_0x461734[_0x4402('0x51')]=_['keys'](db[_0x4402('0xc4')][_0x4402('0x47')]);_0x461734['query']=_['keys'](_0x18e79c['query']);_0x461734[_0x4402('0x4f')]=_['intersection'](_0x461734['model'],_0x461734[_0x4402('0x4d')]);_0x34127d[_0x4402('0x53')]=_['intersection'](_0x461734[_0x4402('0x51')],qs['fields'](_0x18e79c[_0x4402('0x4d')][_0x4402('0x52')]));_0x34127d[_0x4402('0x53')]=_0x34127d['attributes'][_0x4402('0x54')]?_0x34127d[_0x4402('0x53')]:_0x461734[_0x4402('0x51')];if(!_0x18e79c[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x34127d['limit']=qs[_0x4402('0x2f')](_0x18e79c[_0x4402('0x4d')][_0x4402('0x2f')]);_0x34127d['offset']=qs[_0x4402('0x2e')](_0x18e79c[_0x4402('0x4d')]['offset']);}_0x34127d[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x18e79c[_0x4402('0x4d')][_0x4402('0x57')]);_0x34127d[_0x4402('0x58')]=qs['filters'](_['pick'](_0x18e79c[_0x4402('0x4d')],_0x461734[_0x4402('0x4f')]));_0x34127d[_0x4402('0x58')][_0x4402('0xc1')]=_0x1a672b['id'];if(_0x18e79c[_0x4402('0x4d')][_0x4402('0x39')]){_0x34127d[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x34127d[_0x4402('0x58')],{'$or':_['map'](_0x34127d[_0x4402('0x53')],function(_0x555cca){var _0x25746c={};_0x25746c[_0x555cca]={'$like':'%'+_0x18e79c[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x25746c;})});}_0x34127d=_['merge']({},_0x34127d,_0x18e79c[_0x4402('0x5f')]);return db[_0x4402('0xc4')]['count']({'where':_0x34127d[_0x4402('0x58')]})[_0x4402('0x1f')](function(_0x2da095){_0x311a1f[_0x4402('0x2d')]=_0x2da095;if(_0x18e79c[_0x4402('0x4d')][_0x4402('0x60')]){_0x34127d[_0x4402('0x61')]=[{'all':!![]}];}return db[_0x4402('0xc4')][_0x4402('0x9e')](_0x34127d);})[_0x4402('0x1f')](function(_0x373da2){_0x311a1f['rows']=_0x373da2;return _0x311a1f;});}})[_0x4402('0x1f')](respondWithFilteredResult(_0x3930cf,_0x34127d))[_0x4402('0x29')](handleError(_0x3930cf,null));};exports[_0x4402('0xc5')]=function(_0x48b889,_0x28775f,_0x1ff2e7){var _0x477655={};var _0x3d6f8d={};var _0x1fb3b5;var _0x3751f3;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x48b889[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x28775f,null))[_0x4402('0x1f')](function(_0x231905){if(_0x231905){_0x1fb3b5=_0x231905;_0x3d6f8d[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xc6')]['rawAttributes']);_0x3d6f8d[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x48b889[_0x4402('0x4d')]);_0x3d6f8d['filters']=_[_0x4402('0x50')](_0x3d6f8d[_0x4402('0x51')],_0x3d6f8d[_0x4402('0x4d')]);_0x477655[_0x4402('0x53')]=_[_0x4402('0x50')](_0x3d6f8d['model'],qs[_0x4402('0x52')](_0x48b889['query'][_0x4402('0x52')]));_0x477655[_0x4402('0x53')]=_0x477655[_0x4402('0x53')][_0x4402('0x54')]?_0x477655[_0x4402('0x53')]:_0x3d6f8d[_0x4402('0x51')];_0x477655['order']=qs[_0x4402('0x57')](_0x48b889[_0x4402('0x4d')][_0x4402('0x57')]);_0x477655[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x48b889['query'],_0x3d6f8d[_0x4402('0x4f')]));if(_0x48b889['query'][_0x4402('0x39')]){_0x477655[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x477655['where'],{'$or':_[_0x4402('0x45')](_0x477655[_0x4402('0x53')],function(_0xdbac03){var _0x5ae9ae={};_0x5ae9ae[_0xdbac03]={'$like':'%'+_0x48b889[_0x4402('0x4d')]['filter']+'%'};return _0x5ae9ae;})});}_0x477655=_[_0x4402('0x5e')]({},_0x477655,_0x48b889['options']);return _0x1fb3b5['getChatInteractions'](_0x477655);}})[_0x4402('0x1f')](function(_0x4ed803){if(_0x4ed803){_0x3751f3=_0x4ed803[_0x4402('0x54')];if(!_0x48b889[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x477655[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x48b889['query'][_0x4402('0x2f')]);_0x477655[_0x4402('0x2e')]=qs['offset'](_0x48b889[_0x4402('0x4d')]['offset']);}return _0x1fb3b5[_0x4402('0xc5')](_0x477655);}})[_0x4402('0x1f')](function(_0x151f49){if(_0x151f49){return _0x151f49?{'count':_0x3751f3,'rows':_0x151f49}:null;}})[_0x4402('0x1f')](respondWithResult(_0x28775f,null))[_0x4402('0x29')](handleError(_0x28775f,null));};exports[_0x4402('0xc7')]=function(_0x2f5215,_0x5f5066,_0x1e1fde){var _0x53bd9a={};var _0x4762fa={};var _0x1f1db8;var _0x328218;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x2f5215[_0x4402('0x63')]['id']}})['then'](handleEntityNotFound(_0x5f5066,null))[_0x4402('0x1f')](function(_0x42092a){if(_0x42092a){_0x1f1db8=_0x42092a;_0x4762fa[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xc8')][_0x4402('0x47')]);_0x4762fa[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x2f5215[_0x4402('0x4d')]);_0x4762fa[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x4762fa[_0x4402('0x51')],_0x4762fa['query']);_0x53bd9a[_0x4402('0x53')]=_['intersection'](_0x4762fa[_0x4402('0x51')],qs[_0x4402('0x52')](_0x2f5215[_0x4402('0x4d')][_0x4402('0x52')]));_0x53bd9a[_0x4402('0x53')]=_0x53bd9a[_0x4402('0x53')][_0x4402('0x54')]?_0x53bd9a['attributes']:_0x4762fa[_0x4402('0x51')];_0x53bd9a['order']=qs['sort'](_0x2f5215[_0x4402('0x4d')]['sort']);_0x53bd9a[_0x4402('0x58')]=qs['filters'](_[_0x4402('0x59')](_0x2f5215['query'],_0x4762fa['filters']));if(_0x2f5215[_0x4402('0x4d')][_0x4402('0x39')]){_0x53bd9a[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x53bd9a[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x53bd9a[_0x4402('0x53')],function(_0x5db984){var _0x55f20f={};_0x55f20f[_0x5db984]={'$like':'%'+_0x2f5215[_0x4402('0x4d')]['filter']+'%'};return _0x55f20f;})});}_0x53bd9a=_[_0x4402('0x5e')]({},_0x53bd9a,_0x2f5215[_0x4402('0x5f')]);return _0x1f1db8[_0x4402('0xc7')](_0x53bd9a);}})[_0x4402('0x1f')](function(_0x3bc101){if(_0x3bc101){_0x328218=_0x3bc101['length'];if(!_0x2f5215[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x53bd9a[_0x4402('0x2f')]=qs['limit'](_0x2f5215[_0x4402('0x4d')][_0x4402('0x2f')]);_0x53bd9a[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x2f5215[_0x4402('0x4d')][_0x4402('0x2e')]);}return _0x1f1db8[_0x4402('0xc7')](_0x53bd9a);}})[_0x4402('0x1f')](function(_0x2dc146){if(_0x2dc146){return _0x2dc146?{'count':_0x328218,'rows':_0x2dc146}:null;}})[_0x4402('0x1f')](respondWithResult(_0x5f5066,null))[_0x4402('0x29')](handleError(_0x5f5066,null));};exports[_0x4402('0xc9')]=function(_0x4be0c4,_0x15c6ba,_0x7e7935){var _0x33138e={'raw':!![],'where':{}};var _0x57b876={};var _0x51c868={'count':0x0,'rows':[]};return db[_0x4402('0x46')]['findOne']({'where':{'id':_0x4be0c4[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x15c6ba,null))['then'](function(_0x174b1b){if(_0x174b1b){_0x57b876['model']=_[_0x4402('0x4e')](db[_0x4402('0xca')][_0x4402('0x47')]);_0x57b876['query']=_[_0x4402('0x4e')](_0x4be0c4['query']);_0x57b876[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x57b876[_0x4402('0x51')],_0x57b876[_0x4402('0x4d')]);_0x33138e[_0x4402('0x53')]=_[_0x4402('0x50')](_0x57b876[_0x4402('0x51')],qs['fields'](_0x4be0c4[_0x4402('0x4d')][_0x4402('0x52')]));_0x33138e[_0x4402('0x53')]=_0x33138e[_0x4402('0x53')][_0x4402('0x54')]?_0x33138e['attributes']:_0x57b876['model'];if(!_0x4be0c4[_0x4402('0x4d')][_0x4402('0xba')]('nolimit')){_0x33138e['limit']=qs[_0x4402('0x2f')](_0x4be0c4['query'][_0x4402('0x2f')]);_0x33138e[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x4be0c4[_0x4402('0x4d')][_0x4402('0x2e')]);}_0x33138e[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x4be0c4[_0x4402('0x4d')][_0x4402('0x57')]);_0x33138e['where']=qs[_0x4402('0x4f')](_['pick'](_0x4be0c4[_0x4402('0x4d')],_0x57b876['filters']));_0x33138e[_0x4402('0x58')]['UserId']=_0x174b1b['id'];if(_0x4be0c4['query'][_0x4402('0x39')]){_0x33138e[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x33138e['where'],{'$or':_['map'](_0x33138e['attributes'],function(_0x2dd99b){var _0x65e373={};_0x65e373[_0x2dd99b]={'$like':'%'+_0x4be0c4[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x65e373;})});}_0x33138e=_[_0x4402('0x5e')]({},_0x33138e,_0x4be0c4[_0x4402('0x5f')]);return db['MailInteraction']['count']({'where':_0x33138e[_0x4402('0x58')]})[_0x4402('0x1f')](function(_0xba438){_0x51c868[_0x4402('0x2d')]=_0xba438;if(_0x4be0c4[_0x4402('0x4d')][_0x4402('0x60')]){_0x33138e[_0x4402('0x61')]=[{'all':!![]}];}return db['MailInteraction'][_0x4402('0x9e')](_0x33138e);})[_0x4402('0x1f')](function(_0x432b73){_0x51c868[_0x4402('0x62')]=_0x432b73;return _0x51c868;});}})[_0x4402('0x1f')](respondWithFilteredResult(_0x15c6ba,_0x33138e))[_0x4402('0x29')](handleError(_0x15c6ba,null));};exports[_0x4402('0xcb')]=function(_0xe1171b,_0xfb2060,_0x42c0cf){var _0x4ddab5={};var _0x49ca86={};var _0x11ec9a;var _0x3bcd1d;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0xe1171b[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0xfb2060,null))[_0x4402('0x1f')](function(_0x953577){if(_0x953577){_0x11ec9a=_0x953577;_0x49ca86['model']=_[_0x4402('0x4e')](db[_0x4402('0xcc')][_0x4402('0x47')]);_0x49ca86[_0x4402('0x4d')]=_['keys'](_0xe1171b[_0x4402('0x4d')]);_0x49ca86[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x49ca86[_0x4402('0x51')],_0x49ca86['query']);_0x4ddab5[_0x4402('0x53')]=_[_0x4402('0x50')](_0x49ca86[_0x4402('0x51')],qs[_0x4402('0x52')](_0xe1171b[_0x4402('0x4d')]['fields']));_0x4ddab5[_0x4402('0x53')]=_0x4ddab5['attributes'][_0x4402('0x54')]?_0x4ddab5[_0x4402('0x53')]:_0x49ca86[_0x4402('0x51')];_0x4ddab5[_0x4402('0x56')]=qs[_0x4402('0x57')](_0xe1171b[_0x4402('0x4d')]['sort']);_0x4ddab5[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0xe1171b[_0x4402('0x4d')],_0x49ca86[_0x4402('0x4f')]));if(_0xe1171b[_0x4402('0x4d')][_0x4402('0x39')]){_0x4ddab5[_0x4402('0x58')]=_['merge'](_0x4ddab5[_0x4402('0x58')],{'$or':_['map'](_0x4ddab5['attributes'],function(_0xab42e7){var _0x1f5177={};_0x1f5177[_0xab42e7]={'$like':'%'+_0xe1171b[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x1f5177;})});}_0x4ddab5=_[_0x4402('0x5e')]({},_0x4ddab5,_0xe1171b[_0x4402('0x5f')]);return _0x11ec9a[_0x4402('0xcb')](_0x4ddab5);}})['then'](function(_0x3839dd){if(_0x3839dd){_0x3bcd1d=_0x3839dd[_0x4402('0x54')];if(!_0xe1171b[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x4ddab5[_0x4402('0x2f')]=qs['limit'](_0xe1171b[_0x4402('0x4d')]['limit']);_0x4ddab5[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0xe1171b[_0x4402('0x4d')]['offset']);}return _0x11ec9a[_0x4402('0xcb')](_0x4ddab5);}})[_0x4402('0x1f')](function(_0x4b7bb8){if(_0x4b7bb8){return _0x4b7bb8?{'count':_0x3bcd1d,'rows':_0x4b7bb8}:null;}})[_0x4402('0x1f')](respondWithResult(_0xfb2060,null))['catch'](handleError(_0xfb2060,null));};exports['getFaxInteractions']=function(_0x50bf80,_0x3f49e1,_0x1331d4){var _0x1bcd45={};var _0x54999e={};var _0x576286;var _0x48dbb7;return db[_0x4402('0x46')]['findOne']({'where':{'id':_0x50bf80['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3f49e1,null))['then'](function(_0x69219d){if(_0x69219d){_0x576286=_0x69219d;_0x54999e[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xcd')][_0x4402('0x47')]);_0x54999e[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x50bf80['query']);_0x54999e[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x54999e[_0x4402('0x51')],_0x54999e['query']);_0x1bcd45[_0x4402('0x53')]=_[_0x4402('0x50')](_0x54999e['model'],qs['fields'](_0x50bf80[_0x4402('0x4d')][_0x4402('0x52')]));_0x1bcd45['attributes']=_0x1bcd45[_0x4402('0x53')]['length']?_0x1bcd45['attributes']:_0x54999e[_0x4402('0x51')];_0x1bcd45[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x50bf80[_0x4402('0x4d')]['sort']);_0x1bcd45[_0x4402('0x58')]=qs[_0x4402('0x4f')](_['pick'](_0x50bf80[_0x4402('0x4d')],_0x54999e[_0x4402('0x4f')]));if(_0x50bf80[_0x4402('0x4d')][_0x4402('0x39')]){_0x1bcd45[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x1bcd45[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x1bcd45[_0x4402('0x53')],function(_0x2b8c9a){var _0x380968={};_0x380968[_0x2b8c9a]={'$like':'%'+_0x50bf80[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x380968;})});}_0x1bcd45=_['merge']({},_0x1bcd45,_0x50bf80[_0x4402('0x5f')]);return _0x576286[_0x4402('0xce')](_0x1bcd45);}})[_0x4402('0x1f')](function(_0x38030b){if(_0x38030b){_0x48dbb7=_0x38030b[_0x4402('0x54')];if(!_0x50bf80[_0x4402('0x4d')][_0x4402('0xba')]('nolimit')){_0x1bcd45[_0x4402('0x2f')]=qs['limit'](_0x50bf80['query'][_0x4402('0x2f')]);_0x1bcd45[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x50bf80[_0x4402('0x4d')][_0x4402('0x2e')]);}return _0x576286[_0x4402('0xce')](_0x1bcd45);}})[_0x4402('0x1f')](function(_0x3074eb){if(_0x3074eb){return _0x3074eb?{'count':_0x48dbb7,'rows':_0x3074eb}:null;}})[_0x4402('0x1f')](respondWithResult(_0x3f49e1,null))[_0x4402('0x29')](handleError(_0x3f49e1,null));};exports[_0x4402('0xcf')]=function(_0x3b5f81,_0x623464,_0x479ccc){var _0x546185={};var _0x560252={};var _0x55605c;var _0x26d870;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x3b5f81[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x623464,null))[_0x4402('0x1f')](function(_0x406a71){if(_0x406a71){_0x55605c=_0x406a71;_0x560252[_0x4402('0x51')]=_[_0x4402('0x4e')](db[_0x4402('0xd0')][_0x4402('0x47')]);_0x560252[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x3b5f81[_0x4402('0x4d')]);_0x560252[_0x4402('0x4f')]=_['intersection'](_0x560252[_0x4402('0x51')],_0x560252[_0x4402('0x4d')]);_0x546185[_0x4402('0x53')]=_[_0x4402('0x50')](_0x560252[_0x4402('0x51')],qs[_0x4402('0x52')](_0x3b5f81['query']['fields']));_0x546185[_0x4402('0x53')]=_0x546185[_0x4402('0x53')][_0x4402('0x54')]?_0x546185[_0x4402('0x53')]:_0x560252['model'];_0x546185['order']=qs[_0x4402('0x57')](_0x3b5f81[_0x4402('0x4d')]['sort']);_0x546185[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x3b5f81[_0x4402('0x4d')],_0x560252[_0x4402('0x4f')]));if(_0x3b5f81['query'][_0x4402('0x39')]){_0x546185['where']=_[_0x4402('0x5e')](_0x546185[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x546185[_0x4402('0x53')],function(_0x1f4265){var _0x58a989={};_0x58a989[_0x1f4265]={'$like':'%'+_0x3b5f81[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x58a989;})});}_0x546185=_[_0x4402('0x5e')]({},_0x546185,_0x3b5f81[_0x4402('0x5f')]);return _0x55605c[_0x4402('0xcf')](_0x546185);}})[_0x4402('0x1f')](function(_0x542351){if(_0x542351){_0x26d870=_0x542351['length'];if(!_0x3b5f81[_0x4402('0x4d')]['hasOwnProperty']('nolimit')){_0x546185[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x3b5f81['query']['limit']);_0x546185[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x3b5f81[_0x4402('0x4d')]['offset']);}return _0x55605c[_0x4402('0xcf')](_0x546185);}})[_0x4402('0x1f')](function(_0x10fc22){if(_0x10fc22){return _0x10fc22?{'count':_0x26d870,'rows':_0x10fc22}:null;}})[_0x4402('0x1f')](respondWithResult(_0x623464,null))[_0x4402('0x29')](handleError(_0x623464,null));};exports[_0x4402('0xd1')]=function(_0x5c4f9d,_0x2b5424,_0x237a74){var _0x4cb656;var _0x42f57f;var _0x26a9f2;var _0x1a2971=!_['isNil'](_0x5c4f9d[_0x4402('0x63')]['id'])?_0x5c4f9d[_0x4402('0x63')]['id']:!_[_0x4402('0x6d')](_0x5c4f9d['user']['id'])?_0x5c4f9d[_0x4402('0x35')]['id']:null;return db['User']['find']({'where':{'id':_0x1a2971,'role':{'$or':[_0x4402('0x69'),'user','agent']}},'attributes':['id',_0x4402('0x3f'),_0x4402('0xd2'),_0x4402('0xd3'),_0x4402('0x3d'),_0x4402('0x70'),_0x4402('0x92')]})[_0x4402('0x1f')](function(_0x1e555e){if(_0x1e555e){if(_0x1e555e[_0x4402('0x3d')]===_0x4402('0x37')){_0x4cb656=_0x1e555e;if(_0x5c4f9d['body'][_0x4402('0x94')]){_0x26a9f2=util[_0x4402('0x6e')](_0x4402('0xd4'),_0x4cb656[_0x5c4f9d[_0x4402('0x64')][_0x4402('0x94')]]);}else if(_0x5c4f9d[_0x4402('0x64')][_0x4402('0xd5')]){_0x26a9f2=util[_0x4402('0x6e')](_0x4402('0xa0'),_0x5c4f9d[_0x4402('0x64')]['intrf']);}else{_0x26a9f2=util[_0x4402('0x6e')](_0x4402('0xa0'),_0x4cb656['name']);}socket['to'](util['format'](_0x4402('0xd6'),_0x4cb656[_0x4402('0x3f')]))[_0x4402('0x9a')]('user:forcelogout',{'ip':_0x5c4f9d['headers'][_0x4402('0xd7')]||_0x5c4f9d[_0x4402('0xd8')]['remoteAddress']||_0x5c4f9d[_0x4402('0xd9')][_0x4402('0xda')]||_0x5c4f9d['connection']['socket'][_0x4402('0xda')]});return db[_0x4402('0xa8')][_0x4402('0x33')]({'where':{'membername':_0x4cb656['name']},'individualHooks':!![]});}}else{throw new db[(_0x4402('0x1c'))]['ValidationError'](_0x4402('0xdb'));}})[_0x4402('0x1f')](function(){if(_0x4cb656){return _0x4cb656['getVoiceQueues']({'raw':!![]});}})[_0x4402('0x1f')](function(_0x56c894){if(_0x4cb656){var _0x3df09d=[];if(_0x56c894){_0x42f57f=_0x56c894;if(_0x42f57f[_0x4402('0x54')]){for(var _0x535867=0x0;_0x535867<_0x42f57f[_0x4402('0x54')];_0x535867++){_0x3df09d['push']({'membername':_0x4cb656[_0x4402('0x3f')],'UserId':_0x4cb656['id'],'queue_name':_0x42f57f[_0x535867][_0x4402('0x3f')],'VoiceQueueId':_0x42f57f[_0x535867]['id'],'interface':_0x26a9f2,'paused':_0x4cb656[_0x4402('0x92')]||![],'penalty':_0x42f57f[_0x535867][_0x4402('0xdc')]||0x0});}return BPromise[_0x4402('0xa2')](_0x3df09d,function(_0x70a6b3){return db['UserVoiceQueueRt'][_0x4402('0xdd')](_0x70a6b3);});}}}})[_0x4402('0x1f')](function(){if(_0x4cb656){return db[_0x4402('0xde')][_0x4402('0x9e')]({'where':{'membername':_0x4cb656[_0x4402('0x3f')],'exitAt':null}});}})[_0x4402('0x1f')](function(_0xacf9d1){if(_0x4cb656){var _0x4b0196=[];_0xacf9d1[_0x4402('0xdf')](function(_0x2e08de){_0x4b0196['push'](_0x2e08de[_0x4402('0x32')]({'exitAt':moment()[_0x4402('0x6e')](_0x4402('0xe0'))}));});return BPromise['all'](_0x4b0196);}})[_0x4402('0x1f')](function(){if(_0x4cb656){var _0x598a55=[];var _0x56a082=[];var _0x4175f5=utils['getChannels']();var _0x4eab87={'membername':_0x4cb656['name'],'interface':_0x26a9f2,'enterAt':moment()['format'](_0x4402('0xe0')),'role':_0x4cb656[_0x4402('0x3d')],'internal':_0x4cb656[_0x4402('0x70')]};_0x4175f5[_0x4402('0xdf')](function(_0x2c7ae2){_0x598a55[_0x4402('0x9f')](_[_0x4402('0x5e')]({'channel':_0x2c7ae2,'type':_0x4402('0xe1'),'data1':_0x5c4f9d['body'][_0x4402('0xe2')],'data2':_0x26a9f2},_0x4eab87));if(_0x4cb656[_0x4402('0x92')]){_0x56a082[_0x4402('0x9f')](_[_0x4402('0x5e')]({'channel':_0x2c7ae2,'type':_0x4402('0xe3'),'data1':'LOGININPAUSE'},_0x4eab87));}});return db[_0x4402('0xde')][_0x4402('0xe4')](_0x598a55['concat'](_0x56a082),{'individualHooks':!![]});}})['then'](function(){if(_0x4cb656){return _0x4cb656[_0x4402('0x32')]({'online':!![],'lastLoginAt':moment()[_0x4402('0x6e')](_0x4402('0xe0')),'voicePause':_0x4cb656[_0x4402('0x92')]||![],'mailPause':_0x4cb656[_0x4402('0x92')]||![],'chatPause':_0x4cb656[_0x4402('0x92')]||![],'faxPause':_0x4cb656[_0x4402('0x92')]||![],'smsPause':_0x4cb656[_0x4402('0x92')]||![],'openchannelPause':_0x4cb656[_0x4402('0x92')]||![],'whatsappPause':_0x4cb656[_0x4402('0x92')]||![],'pauseType':_0x4cb656[_0x4402('0x92')]?_0x4402('0xe5'):null,'interface':_0x26a9f2,'lastPauseAt':moment()[_0x4402('0x6e')](_0x4402('0xe0'))});}})[_0x4402('0x1f')](function(_0x5c6f7e){if(_0x5c4f9d['isMiddleware']){return _0x237a74();}else{return BPromise[_0x4402('0xe6')](_0x5c6f7e)[_0x4402('0x1f')](respondWithResult(_0x2b5424,null));}})[_0x4402('0x29')](handleError(_0x2b5424,null));};exports[_0x4402('0xe7')]=function(_0x29e4d8,_0x15d5a6,_0x2a96c1){var _0x5bef07;return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x29e4d8['params']['id'],'role':'agent'},'attributes':['id',_0x4402('0x3f'),_0x4402('0x3d')]})['then'](handleEntityNotFound(_0x15d5a6,null))[_0x4402('0x1f')](function(_0x5dd83c){if(_0x5dd83c){_0x5bef07=_0x5dd83c;return db['UserVoiceQueueRt'][_0x4402('0x33')]({'where':{'membername':_0x5bef07[_0x4402('0x3f')]},'individualHooks':!![]});}})[_0x4402('0x1f')](function(){return db[_0x4402('0xde')][_0x4402('0x9e')]({'where':{'membername':_0x5bef07[_0x4402('0x3f')],'exitAt':null}});})[_0x4402('0x1f')](function(_0x6c6746){var _0xea2347=[];_0x6c6746[_0x4402('0xdf')](function(_0x133cb4){_0xea2347['push'](_0x133cb4['update']({'exitAt':moment()[_0x4402('0x6e')](_0x4402('0xe0'))}));});return BPromise['all'](_0xea2347);})[_0x4402('0x1f')](function(){return _0x5bef07['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4402('0x1f')](respondWithResult(_0x15d5a6,null))['catch'](handleError(_0x15d5a6,null));};exports[_0x4402('0xe8')]=function(_0x54c447,_0x5dfd40,_0x20e790){var _0x930021;return db['UserVoiceQueueRt'][_0x4402('0x32')]({'paused':0x1},{'where':{'UserId':_0x54c447[_0x4402('0x63')]['id']},'individualHooks':!![]})[_0x4402('0x1f')](function(){return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x54c447[_0x4402('0x63')]['id'],'role':_0x4402('0x37')},'attributes':['id',_0x4402('0x3f'),_0x4402('0x3d'),_0x4402('0x70'),_0x4402('0x94')]});})['then'](handleEntityNotFound(_0x5dfd40,null))[_0x4402('0x1f')](function(_0x1b0f6a){if(_0x1b0f6a){_0x930021=_0x1b0f6a;return respondWithRpcPromise('QueuePause','pause',{'id':_0x930021['id'],'name':_0x930021[_0x4402('0x3f')],'pause':!![]});}})['then'](function(){if(_0x930021){return db[_0x4402('0xde')]['findAll']({'where':{'membername':_0x930021['name'],'type':_0x4402('0xe3'),'exitAt':null}});}})[_0x4402('0x1f')](function(_0x15291e){if(_0x15291e['length']){var _0x465c3f=moment()[_0x4402('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x456d99=0x0,_0x24c564=_0x15291e[_0x4402('0x54')];_0x456d99<_0x24c564;_0x456d99++){_0x15291e[_0x456d99]['updateAttributes']({'exitAt':_0x465c3f});}}})[_0x4402('0x1f')](function(){var _0x4fa239=[];var _0x12fa4d=utils[_0x4402('0xe9')]();_0x12fa4d['forEach'](function(_0x4ac8fb){_0x4fa239[_0x4402('0x9f')]({'channel':_0x4ac8fb,'membername':_0x930021[_0x4402('0x3f')],'interface':_['isNil'](_0x930021[_0x4402('0x94')])?util[_0x4402('0x6e')]('SIP/%s',_0x930021['name']):_0x930021[_0x4402('0x94')],'type':_0x4402('0xe3'),'enterAt':moment()[_0x4402('0x6e')](_0x4402('0xe0')),'data1':_0x54c447['body'][_0x4402('0xea')]||_0x4402('0xeb'),'role':_0x930021[_0x4402('0x3d')],'internal':_0x930021[_0x4402('0x70')]});});return db[_0x4402('0xde')]['bulkCreate'](_0x4fa239,{'individualHooks':!![]});})[_0x4402('0x1f')](function(){return _0x930021[_0x4402('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x54c447[_0x4402('0x64')][_0x4402('0xea')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x4402('0x6e')](_0x4402('0xe0'))});})[_0x4402('0x1f')](respondWithResult(_0x5dfd40,null))['catch'](handleError(_0x5dfd40,null));};exports[_0x4402('0xec')]=function(_0x33e682,_0x3d3efb,_0xf7f6f1){var _0x4436f3;return db['User'][_0x4402('0x3e')]({'where':{'id':_0x33e682[_0x4402('0x63')]['id']},'attributes':['id',_0x4402('0x3f'),_0x4402('0x3d'),'voicePause',_0x4402('0xed'),_0x4402('0xee'),_0x4402('0xef'),'openchannelPause',_0x4402('0xf0'),'whatsapppause',_0x4402('0xf1'),_0x4402('0xf2')]})[_0x4402('0x1f')](handleEntityNotFound(_0x3d3efb,null))[_0x4402('0x1f')](function(_0x9a7276){if(_0x9a7276){_0x4436f3=_0x9a7276;if(_0x33e682['body'][_0x4402('0x90')]&&!utils[_0x4402('0x95')](_0x33e682[_0x4402('0x64')][_0x4402('0x90')])){throw new db[(_0x4402('0x1c'))][(_0x4402('0x8a'))]('Unknown\x20channel');}switch(_0x33e682[_0x4402('0x64')][_0x4402('0x90')]){case _0x4402('0x9c'):return respondWithRpcPromise(_0x4402('0xf3'),_0x4402('0xec'),{'id':_0x4436f3['id'],'name':_0x4436f3[_0x4402('0x3f')],'pause':![]})['then'](function(){return db[_0x4402('0xa8')]['update']({'paused':0x0},{'where':{'UserId':_0x4436f3['id']},'individualHooks':!![]});})[_0x4402('0x1f')](function(){return db[_0x4402('0xde')][_0x4402('0x3e')]({'where':{'channel':_0x33e682[_0x4402('0x64')][_0x4402('0x90')],'membername':_0x4436f3[_0x4402('0x3f')],'type':'PAUSE','exitAt':null}});})[_0x4402('0x1f')](function(_0x2b8423){if(_0x2b8423){return _0x2b8423[_0x4402('0x32')]({'exitAt':moment()['format'](_0x4402('0xe0')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4402('0x1f')](function(){return _0x4436f3[_0x4402('0x32')]({'voicePause':![]});});case'mail':case _0x4402('0xf4'):case _0x4402('0xf5'):case _0x4402('0xf6'):case _0x4402('0xf7'):case _0x4402('0xf8'):return db[_0x4402('0xde')][_0x4402('0x3e')]({'where':{'channel':_0x33e682[_0x4402('0x64')]['channel'],'membername':_0x4436f3[_0x4402('0x3f')],'type':'PAUSE','exitAt':null}})[_0x4402('0x1f')](function(_0x15ec9c){if(_0x15ec9c){return _0x15ec9c['update']({'exitAt':moment()[_0x4402('0x6e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x31c88b={};_[_0x4402('0xf9')](_0x31c88b,util[_0x4402('0x6e')](_0x4402('0xfa'),_0x33e682[_0x4402('0x64')][_0x4402('0x90')],_0x4402('0xfb')),![]);return _0x4436f3[_0x4402('0x32')](_0x31c88b);});default:return respondWithRpcPromise('QueuePause',_0x4402('0xec'),{'id':_0x4436f3['id'],'name':_0x4436f3[_0x4402('0x3f')],'pause':![]})[_0x4402('0x1f')](function(){return db[_0x4402('0xa8')]['update']({'paused':0x0},{'where':{'UserId':_0x4436f3['id']}});})[_0x4402('0x1f')](function(){return db[_0x4402('0xde')]['findAll']({'where':{'membername':_0x4436f3[_0x4402('0x3f')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x3a02d3){var _0x413751=[];_0x3a02d3[_0x4402('0xdf')](function(_0x28c891){_0x413751['push'](_0x28c891[_0x4402('0x32')]({'exitAt':moment()[_0x4402('0x6e')](_0x4402('0xe0')),'data2':_0x4402('0xfc')}));});return BPromise[_0x4402('0xfd')](_0x413751);})[_0x4402('0x1f')](function(){return _0x4436f3[_0x4402('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4402('0x1f')](respondWithResult(_0x3d3efb,null))[_0x4402('0x29')](handleError(_0x3d3efb,null));};exports['getTeams']=function(_0x289685,_0xb1540d,_0x5cdcb8){var _0x25ab97={};var _0x3fbb27={};var _0x596c0c;var _0x161da2;return db['User'][_0x4402('0xb3')]({'where':{'id':_0x289685[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0xb1540d,null))['then'](function(_0x5c13b6){if(_0x5c13b6){_0x596c0c=_0x5c13b6;_0x3fbb27['model']=_['keys'](db[_0x4402('0xfe')][_0x4402('0x47')]);_0x3fbb27[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x289685[_0x4402('0x4d')]);_0x3fbb27['filters']=_[_0x4402('0x50')](_0x3fbb27[_0x4402('0x51')],_0x3fbb27[_0x4402('0x4d')]);_0x25ab97[_0x4402('0x53')]=_[_0x4402('0x50')](_0x3fbb27[_0x4402('0x51')],qs['fields'](_0x289685[_0x4402('0x4d')][_0x4402('0x52')]));_0x25ab97[_0x4402('0x53')]=_0x25ab97[_0x4402('0x53')]['length']?_0x25ab97['attributes']:_0x3fbb27[_0x4402('0x51')];_0x25ab97['order']=qs[_0x4402('0x57')](_0x289685[_0x4402('0x4d')][_0x4402('0x57')]);_0x25ab97[_0x4402('0x58')]=qs[_0x4402('0x4f')](_[_0x4402('0x59')](_0x289685[_0x4402('0x4d')],_0x3fbb27[_0x4402('0x4f')]));if(_0x289685[_0x4402('0x4d')]['filter']){_0x25ab97[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x25ab97[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x25ab97[_0x4402('0x53')],function(_0xef4fcb){var _0x4a45fe={};_0x4a45fe[_0xef4fcb]={'$like':'%'+_0x289685[_0x4402('0x4d')][_0x4402('0x39')]+'%'};return _0x4a45fe;})});}_0x25ab97=_[_0x4402('0x5e')]({},_0x25ab97,_0x289685[_0x4402('0x5f')]);return _0x596c0c[_0x4402('0xff')](_0x25ab97);}})[_0x4402('0x1f')](function(_0x45f64b){if(_0x45f64b){_0x161da2=_0x45f64b[_0x4402('0x54')];if(!_0x289685[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x25ab97[_0x4402('0x2f')]=qs['limit'](_0x289685[_0x4402('0x4d')][_0x4402('0x2f')]);_0x25ab97['offset']=qs[_0x4402('0x2e')](_0x289685[_0x4402('0x4d')][_0x4402('0x2e')]);}return _0x596c0c[_0x4402('0xff')](_0x25ab97);}})[_0x4402('0x1f')](function(_0x39c635){if(_0x39c635){return _0x39c635?{'count':_0x161da2,'rows':_0x39c635}:null;}})[_0x4402('0x1f')](respondWithResult(_0xb1540d,null))[_0x4402('0x29')](handleError(_0xb1540d,null));};exports[_0x4402('0x100')]=function(_0x68411,_0x2ee0de){return db[_0x4402('0x46')][_0x4402('0x3e')]({'where':{'id':_0x68411[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x2ee0de,null))[_0x4402('0x1f')](function(_0x5ae7e4){if(_0x5ae7e4){var _0x10e310=_0x5ae7e4[_0x4402('0x34')]({'plain':!![]});return _0x5ae7e4[_0x4402('0x100')](_0x68411[_0x4402('0x64')]['ids'],_[_0x4402('0x68')](_0x68411[_0x4402('0x64')],['ids','id'])||{})[_0x4402('0x1f')](function(){for(var _0x5a7dd3=0x0;_0x5a7dd3<_0x68411['body']['ids'][_0x4402('0x54')];_0x5a7dd3++){var _0x3b7acb=[];db['Team']['findOne']({'where':{'id':_0x68411['body'][_0x4402('0x67')][_0x5a7dd3]}})[_0x4402('0x1f')](function(_0x15f26c){_0x3b7acb[_0x4402('0x9f')](_0x15f26c[_0x4402('0x101')]()[_0x4402('0x1f')](function(_0x502946){for(var _0x3d8132=0x0;_0x3d8132<_0x502946['length'];_0x3d8132++){_0x502946[_0x3d8132]['setDataValue'](_0x4402('0x90'),'Voice');}return _0x502946;}));_0x3b7acb[_0x4402('0x9f')](_0x15f26c[_0x4402('0x102')]()['then'](function(_0x112558){for(var _0x41ce38=0x0;_0x41ce38<_0x112558['length'];_0x41ce38++){_0x112558[_0x41ce38][_0x4402('0x103')](_0x4402('0x90'),_0x4402('0x104'));}return _0x112558;}));_0x3b7acb[_0x4402('0x9f')](_0x15f26c['getMailQueues']()['then'](function(_0x59b43c){for(var _0x15c98c=0x0;_0x15c98c<_0x59b43c[_0x4402('0x54')];_0x15c98c++){_0x59b43c[_0x15c98c][_0x4402('0x103')]('channel',_0x4402('0x105'));}return _0x59b43c;}));_0x3b7acb['push'](_0x15f26c[_0x4402('0x106')]()[_0x4402('0x1f')](function(_0x5acec9){for(var _0xa616c5=0x0;_0xa616c5<_0x5acec9['length'];_0xa616c5++){_0x5acec9[_0xa616c5]['setDataValue'](_0x4402('0x90'),'Sms');}return _0x5acec9;}));_0x3b7acb[_0x4402('0x9f')](_0x15f26c[_0x4402('0x107')]()[_0x4402('0x1f')](function(_0x4c98f7){for(var _0x1aa742=0x0;_0x1aa742<_0x4c98f7[_0x4402('0x54')];_0x1aa742++){_0x4c98f7[_0x1aa742]['setDataValue'](_0x4402('0x90'),_0x4402('0x108'));}return _0x4c98f7;}));_0x3b7acb['push'](_0x15f26c['getFaxQueues']()[_0x4402('0x1f')](function(_0x3f9250){for(var _0x460682=0x0;_0x460682<_0x3f9250['length'];_0x460682++){_0x3f9250[_0x460682][_0x4402('0x103')]('channel',_0x4402('0x109'));}return _0x3f9250;}));_0x3b7acb[_0x4402('0x9f')](_0x15f26c[_0x4402('0x10a')]()[_0x4402('0x1f')](function(_0x311714){for(var _0x4cb295=0x0;_0x4cb295<_0x311714['length'];_0x4cb295++){_0x311714[_0x4cb295][_0x4402('0x103')](_0x4402('0x90'),_0x4402('0x10b'));}return _0x311714;}));return BPromise[_0x4402('0xfd')](_0x3b7acb);})[_0x4402('0x1f')](function(_0x4199a0){var _0x225b20=_['flatten'](_0x4199a0);_0x3b7acb=[];return db[_0x4402('0x5b')][_0x4402('0x10c')](function(_0x2c9a8a){for(var _0x11cefc=0x0;_0x11cefc<_0x225b20[_0x4402('0x54')];_0x11cefc++){_0x3b7acb[_0x4402('0x9f')](_0x225b20[_0x11cefc][_0x4402('0x10d')](_0x10e310['id']),{'transaction':_0x2c9a8a});}return BPromise[_0x4402('0xfd')](_0x3b7acb)['then'](function(){if(_0x10e310[_0x4402('0x91')]){return BPromise[_0x4402('0xa2')](_['filter'](_0x225b20,function(_0x26eb37){return _0x26eb37[_0x4402('0x10e')](_0x4402('0x90'))===_0x4402('0x10f');}),function(_0x52c781){return db[_0x4402('0xa8')]['upsert']({'membername':_0x10e310['name'],'UserId':_0x10e310['id'],'queue_name':_0x52c781[_0x4402('0x3f')],'VoiceQueueId':_0x52c781['id'],'interface':_[_0x4402('0x6d')](_0x10e310[_0x4402('0x94')])?util[_0x4402('0x6e')](_0x4402('0xa0'),_0x10e310[_0x4402('0x3f')]):_0x10e310[_0x4402('0x94')],'paused':_0x10e310[_0x4402('0x93')]||![],'penalty':_0x10e310[_0x4402('0xa1')]},{'transaction':_0x2c9a8a});});}else{return;}})[_0x4402('0x1f')](function(){for(var _0x4b36bf=0x0;_0x4b36bf<_0x225b20['length'];_0x4b36bf++){var _0x5326b4=_0x225b20[_0x4b36bf]['getDataValue']('channel');var _0x8ace51=_0x5326b4+_0x4402('0xa6');socket[_0x4402('0x9a')](_0x4402('0x35')+_0x5326b4+_0x4402('0x9b'),{'UserId':_0x10e310['id'],['queueField']:_0x225b20[_0x4b36bf]['id']});}});});});}});}})[_0x4402('0x1f')](respondWithStatusCode(_0x2ee0de,null))[_0x4402('0x29')](handleError(_0x2ee0de,null));};exports[_0x4402('0x110')]=function(_0x25f498,_0x24452d){return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x25f498[_0x4402('0x63')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x24452d,null))[_0x4402('0x1f')](function(_0x913e52){if(_0x913e52){var _0x3db537=_0x913e52[_0x4402('0x34')]({'plain':!![]});var _0x5193b6=_0x25f498[_0x4402('0x4d')][_0x4402('0x67')];return _0x913e52[_0x4402('0x110')](_0x5193b6)[_0x4402('0x1f')](function(){for(var _0x46dc60=0x0;_0x46dc60<_0x5193b6[_0x4402('0x54')];_0x46dc60++){var _0x1bd967=[];db['Team']['findOne']({'where':{'id':_0x5193b6[_0x46dc60]}})['then'](function(_0x189d88){_0x1bd967[_0x4402('0x9f')](_0x189d88[_0x4402('0x101')]()['then'](function(_0x25e90c){for(var _0x51f571=0x0;_0x51f571<_0x25e90c[_0x4402('0x54')];_0x51f571++){_0x25e90c[_0x51f571][_0x4402('0x103')]('channel',_0x4402('0x10f'));}return _0x25e90c;}));_0x1bd967[_0x4402('0x9f')](_0x189d88[_0x4402('0x102')]()[_0x4402('0x1f')](function(_0x314972){for(var _0x4cc7a1=0x0;_0x4cc7a1<_0x314972['length'];_0x4cc7a1++){_0x314972[_0x4cc7a1][_0x4402('0x103')](_0x4402('0x90'),_0x4402('0x104'));}return _0x314972;}));_0x1bd967['push'](_0x189d88[_0x4402('0x111')]()[_0x4402('0x1f')](function(_0x1d6e62){for(var _0x208389=0x0;_0x208389<_0x1d6e62['length'];_0x208389++){_0x1d6e62[_0x208389][_0x4402('0x103')](_0x4402('0x90'),'Mail');}return _0x1d6e62;}));_0x1bd967[_0x4402('0x9f')](_0x189d88[_0x4402('0x106')]()[_0x4402('0x1f')](function(_0x6d83fe){for(var _0x3c1a77=0x0;_0x3c1a77<_0x6d83fe['length'];_0x3c1a77++){_0x6d83fe[_0x3c1a77][_0x4402('0x103')]('channel',_0x4402('0x112'));}return _0x6d83fe;}));_0x1bd967[_0x4402('0x9f')](_0x189d88[_0x4402('0x107')]()[_0x4402('0x1f')](function(_0x9264ce){for(var _0x4101f2=0x0;_0x4101f2<_0x9264ce['length'];_0x4101f2++){_0x9264ce[_0x4101f2][_0x4402('0x103')](_0x4402('0x90'),_0x4402('0x108'));}return _0x9264ce;}));_0x1bd967['push'](_0x189d88['getFaxQueues']()[_0x4402('0x1f')](function(_0x357257){for(var _0x140023=0x0;_0x140023<_0x357257[_0x4402('0x54')];_0x140023++){_0x357257[_0x140023]['setDataValue'](_0x4402('0x90'),'Fax');}return _0x357257;}));_0x1bd967['push'](_0x189d88[_0x4402('0x10a')]()[_0x4402('0x1f')](function(_0x53fae8){for(var _0x5d9c75=0x0;_0x5d9c75<_0x53fae8[_0x4402('0x54')];_0x5d9c75++){_0x53fae8[_0x5d9c75]['setDataValue'](_0x4402('0x90'),_0x4402('0x10b'));}return _0x53fae8;}));return BPromise[_0x4402('0xfd')](_0x1bd967);})[_0x4402('0x1f')](function(_0x43b5d7){var _0x57128c=_['flatten'](_0x43b5d7);_0x1bd967=[];return db[_0x4402('0x5b')][_0x4402('0x10c')](function(_0x3b54f4){for(var _0x398365=0x0;_0x398365<_0x57128c[_0x4402('0x54')];_0x398365++){_0x1bd967[_0x4402('0x9f')](_0x57128c[_0x398365][_0x4402('0x113')](_0x3db537['id']),{'transaction':_0x3b54f4});}return BPromise['all'](_0x1bd967)[_0x4402('0x1f')](function(){if(_0x3db537[_0x4402('0x91')]){return BPromise['each'](_[_0x4402('0x39')](_0x57128c,function(_0x44f082){return _0x44f082['getDataValue']('channel')===_0x4402('0x10f');}),function(_0x2eb6ad){return db[_0x4402('0xa8')][_0x4402('0x33')]({'where':{'VoiceQueueId':_0x2eb6ad['id'],'UserId':_0x3db537['id']},'transaction':_0x3b54f4});});}else{return;}})[_0x4402('0x1f')](function(){for(var _0x45fff9=0x0;_0x45fff9<_0x57128c[_0x4402('0x54')];_0x45fff9++){var _0x397e79=_0x57128c[_0x45fff9][_0x4402('0x10e')]('channel');var _0x69059b=_0x397e79+_0x4402('0xa6');socket[_0x4402('0x9a')](_0x4402('0x35')+_0x397e79+_0x4402('0xa7'),{'UserId':_0x3db537['id'],['queueField']:_0x57128c[_0x45fff9]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x24452d,null))[_0x4402('0x29')](handleError(_0x24452d,null));};exports[_0x4402('0x114')]=function(_0x588991,_0x169263,_0x375c1e){var _0x208187={};var _0x370f6c={};var _0x389d76;var _0x1bc557;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x588991['params']['id']}})['then'](handleEntityNotFound(_0x169263,null))[_0x4402('0x1f')](function(_0x238624){if(_0x238624){_0x389d76=_0x238624;_0x370f6c['model']=_['keys'](db['CmList'][_0x4402('0x47')]);_0x370f6c[_0x4402('0x4d')]=_[_0x4402('0x4e')](_0x588991['query']);_0x370f6c[_0x4402('0x4f')]=_['intersection'](_0x370f6c[_0x4402('0x51')],_0x370f6c[_0x4402('0x4d')]);_0x208187[_0x4402('0x53')]=_['intersection'](_0x370f6c[_0x4402('0x51')],qs[_0x4402('0x52')](_0x588991[_0x4402('0x4d')][_0x4402('0x52')]));_0x208187['attributes']=_0x208187[_0x4402('0x53')][_0x4402('0x54')]?_0x208187[_0x4402('0x53')]:_0x370f6c[_0x4402('0x51')];_0x208187[_0x4402('0x56')]=qs[_0x4402('0x57')](_0x588991[_0x4402('0x4d')][_0x4402('0x57')]);_0x208187['where']=qs[_0x4402('0x4f')](_['pick'](_0x588991['query'],_0x370f6c[_0x4402('0x4f')]));if(_0x588991[_0x4402('0x4d')][_0x4402('0x39')]){_0x208187[_0x4402('0x58')]=_[_0x4402('0x5e')](_0x208187[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x208187[_0x4402('0x53')],function(_0x18dabd){var _0x52ac9f={};_0x52ac9f[_0x18dabd]={'$like':'%'+_0x588991[_0x4402('0x4d')]['filter']+'%'};return _0x52ac9f;})});}_0x208187=_['merge']({},_0x208187,_0x588991['options']);return _0x389d76['getLists'](_0x208187);}})[_0x4402('0x1f')](function(_0x382f7e){if(_0x382f7e){_0x1bc557=_0x382f7e['length'];if(!_0x588991[_0x4402('0x4d')][_0x4402('0xba')](_0x4402('0x55'))){_0x208187[_0x4402('0x2f')]=qs[_0x4402('0x2f')](_0x588991[_0x4402('0x4d')][_0x4402('0x2f')]);_0x208187[_0x4402('0x2e')]=qs[_0x4402('0x2e')](_0x588991[_0x4402('0x4d')][_0x4402('0x2e')]);}return _0x389d76[_0x4402('0x114')](_0x208187);}})[_0x4402('0x1f')](function(_0x1e3082){if(_0x1e3082){return _0x1e3082?{'count':_0x1bc557,'rows':_0x1e3082}:null;}})[_0x4402('0x1f')](respondWithResult(_0x169263,null))[_0x4402('0x29')](handleError(_0x169263,null));};exports[_0x4402('0x115')]=function(_0x217d25,_0x385257,_0x131416){var _0x59650e={};var _0x17c279={};var _0x2cdb0a;var _0x5e0487;return db[_0x4402('0x46')][_0x4402('0xb3')]({'where':{'id':_0x217d25['params']['id']}})['then'](handleEntityNotFound(_0x385257,null))[_0x4402('0x1f')](function(_0x286ef6){if(_0x286ef6){_0x2cdb0a=_0x286ef6;_0x17c279['model']=_[_0x4402('0x4e')](db[_0x4402('0x46')]['rawAttributes']);_0x17c279['query']=_[_0x4402('0x4e')](_0x217d25[_0x4402('0x4d')]);_0x17c279[_0x4402('0x4f')]=_[_0x4402('0x50')](_0x17c279[_0x4402('0x51')],_0x17c279[_0x4402('0x4d')]);_0x59650e[_0x4402('0x53')]=_[_0x4402('0x50')](_0x17c279[_0x4402('0x51')],qs[_0x4402('0x52')](_0x217d25[_0x4402('0x4d')][_0x4402('0x52')]));_0x59650e[_0x4402('0x53')]=_0x59650e[_0x4402('0x53')][_0x4402('0x54')]?_0x59650e[_0x4402('0x53')]:_0x17c279['model'];_0x59650e['order']=qs[_0x4402('0x57')](_0x217d25['query'][_0x4402('0x57')]);_0x59650e[_0x4402('0x58')]=qs['filters'](_[_0x4402('0x59')](_0x217d25['query'],_0x17c279[_0x4402('0x4f')]));if(_0x217d25['query'][_0x4402('0x39')]){_0x59650e[_0x4402('0x58')]=_['merge'](_0x59650e[_0x4402('0x58')],{'$or':_[_0x4402('0x45')](_0x59650e[_0x4402('0x53')],function(_0x26226a){var _0x4c2656={};_0x4c2656[_0x26226a]={'$like':'%'+_0x217d25[_0x4402('0x4d')]['filter']+'%'};return _0x4c2656;})});}_0x59650e['model']=db[_0x4402('0x46')];_0x59650e['as']=_0x4402('0x36');_0x59650e=_[_0x4402('0x5e')]({},_0x59650e,_0x217d25[_0x4402('0x5f')]);return _0x2cdb0a[_0x4402('0x101')]({'include':[_0x59650e]});}})[_0x4402('0x1f')](function(_0x13be61){if(_0x13be61){var _0x388bad={},_0x13c8df=[],_0x1f9b59=0x0;for(var _0x2adb58=0x0;_0x2adb58<_0x13be61[_0x4402('0x54')];_0x2adb58+=0x1){for(var _0x5e4857=0x0,_0x5241df;_0x5e4857<_0x13be61[_0x2adb58][_0x4402('0x36')]['length'];_0x5e4857+=0x1){_0x5241df=_0x13be61[_0x2adb58][_0x4402('0x36')][_0x5e4857]['get']({'plain':!![]});_0x388bad[_0x5241df['id']]=_0x5241df;}}_0x388bad=_['values'](_0x388bad);for(var _0x19c435=qs[_0x4402('0x2e')](_0x217d25[_0x4402('0x4d')]['offset']);_0x19c435<_0x388bad['length']&&_0x13c8df[_0x4402('0x54')]=_0x1672fc[_0x2af9('0x50')]){throw new Error(_0x2af9('0x51'));}})['then'](function(){if(_0x6949fd){return db[_0x2af9('0x2a')][_0x2af9('0x47')]({'where':{'membername':_0x6949fd[_0x2af9('0x25')]},'individualHooks':!![]});}})[_0x2af9('0x29')](function(){if(_0x6949fd){return _0x6949fd[_0x2af9('0x52')]({'raw':!![]});}})[_0x2af9('0x29')](function(_0x58670f){if(_0x6949fd){if(_0x58670f){var _0xcb2dd8=[];_0x4ac6de=_0x58670f;if(_0x4ac6de[_0x2af9('0x48')]){for(var _0x371f6c=0x0;_0x371f6c<_0x4ac6de[_0x2af9('0x48')];_0x371f6c++){_0xcb2dd8['push'](db['UserVoiceQueueRt'][_0x2af9('0x53')]({'membername':_0x6949fd[_0x2af9('0x25')],'UserId':_0x6949fd['id'],'queue_name':_0x4ac6de[_0x371f6c][_0x2af9('0x25')],'VoiceQueueId':_0x4ac6de[_0x371f6c]['id'],'interface':_0xe210d2,'paused':_0x6949fd[_0x2af9('0x4c')]||![],'penalty':_0x4ac6de[_0x371f6c][_0x2af9('0x54')]||0x0}));}return BPromise[_0x2af9('0x45')](_0xcb2dd8);}}}})['then'](function(){if(_0x6949fd){return db[_0x2af9('0x2c')][_0x2af9('0x19')]({'where':{'membername':_0x6949fd['name'],'exitAt':null}});}})[_0x2af9('0x29')](function(_0x3d62f5){if(_0x6949fd){if(_0x3d62f5&&_0x3d62f5[_0x2af9('0x48')]){var _0x4bff06=[];_0x3d62f5[_0x2af9('0x32')](function(_0x5f4feb){_0x4bff06[_0x2af9('0x44')](_0x5f4feb['update']({'exitAt':moment()['format'](_0x2af9('0x2f'))}));});return BPromise[_0x2af9('0x45')](_0x4bff06);}}})[_0x2af9('0x29')](function(_0x3f5ca2){if(_0x6949fd){var _0xb6cf4a=[];var _0x2bfe97=[];var _0x139f17=utils[_0x2af9('0x31')]();var _0x266758={'membername':_0x6949fd[_0x2af9('0x25')],'interface':_0xe210d2,'enterAt':moment()[_0x2af9('0x2e')](_0x2af9('0x2f')),'role':_0x6949fd[_0x2af9('0x26')],'internal':_0x6949fd[_0x2af9('0x27')]};_0x139f17[_0x2af9('0x32')](function(_0x8b6c5a){_0xb6cf4a[_0x2af9('0x44')](_[_0x2af9('0x55')]({'channel':_0x8b6c5a,'type':_0x2af9('0x56'),'data1':_0x2af9('0x57'),'data2':_0xe210d2},_0x266758));if(_0x6949fd['loginInPause']){_0x2bfe97[_0x2af9('0x44')](_[_0x2af9('0x55')]({'channel':_0x8b6c5a,'type':'PAUSE','data1':_0x2af9('0x58')},_0x266758));}});return db[_0x2af9('0x2c')]['bulkCreate'](_0xb6cf4a[_0x2af9('0x59')](_0x2bfe97),{'individualHooks':!![]});}})[_0x2af9('0x29')](function(){if(_0x6949fd){return _0x6949fd[_0x2af9('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x2af9('0x2e')](_0x2af9('0x2f')),'voicePause':_0x6949fd[_0x2af9('0x4c')]||![],'mailPause':_0x6949fd[_0x2af9('0x4c')]||![],'chatPause':_0x6949fd[_0x2af9('0x4c')]||![],'faxPause':_0x6949fd[_0x2af9('0x4c')]||![],'smsPause':_0x6949fd[_0x2af9('0x4c')]||![],'openchannelPause':_0x6949fd[_0x2af9('0x4c')]||![],'pauseType':_0x6949fd[_0x2af9('0x4c')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x2af9('0x2e')](_0x2af9('0x2f')),'interface':_0xe210d2});}})['then'](function(_0x1ccd50){_0x5db830(_0x1ccd50);})[_0x2af9('0x17')](function(_0x22cd6d){_0x54d32c(_0x390d61[_0x2af9('0x13')](0x1f4,_0x22cd6d[_0x2af9('0x15')]));});});}; \ No newline at end of file +var _0xfcdf=['Pause','all','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./user.socket','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetUser','User','options','raw','attributes','limit','include','map','model','find','where','ShowUser','PauseUser','name','internal','interface','UserVoiceQueueRt','MemberReport','findAll','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','push','isNil','format','SIP/%s','body','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','update','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','set','%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcdf,0x1e4));var _0xffcd=function(_0x5e259d,_0x33f179){_0x5e259d=_0x5e259d-0x0;var _0x2a442d=_0xfcdf[_0x5e259d];return _0x2a442d;};'use strict';var _=require(_0xffcd('0x0'));var util=require(_0xffcd('0x1'));var moment=require(_0xffcd('0x2'));var BPromise=require(_0xffcd('0x3'));var rs=require(_0xffcd('0x4'));var fs=require('fs');var Redis=require(_0xffcd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xffcd('0x6'));var logger=require('../../config/logger')(_0xffcd('0x7'));var config=require('../../config/environment');var jayson=require(_0xffcd('0x8'));var client=jayson[_0xffcd('0x9')][_0xffcd('0xa')]({'port':0x232a});config[_0xffcd('0xb')]=_['defaults'](config[_0xffcd('0xb')],{'host':_0xffcd('0xc'),'port':0x18eb});var socket=require(_0xffcd('0xd'))(new Redis(config['redis']));require(_0xffcd('0xe'))['register'](socket);function respondWithRpcPromise(_0x5dcc26,_0x37d2ac,_0x3f039a){return new BPromise(function(_0x20bc59,_0x3918e7){return client[_0xffcd('0xf')](_0x5dcc26,_0x3f039a)[_0xffcd('0x10')](function(_0x138cf6){logger['info'](_0xffcd('0x11'),_0x37d2ac,_0xffcd('0x12'));logger[_0xffcd('0x13')](_0xffcd('0x14'),_0x37d2ac,_0xffcd('0x12'),JSON[_0xffcd('0x15')](_0x138cf6));if(_0x138cf6[_0xffcd('0x16')]){if(_0x138cf6[_0xffcd('0x16')]['code']===0x1f4){logger[_0xffcd('0x16')](_0xffcd('0x11'),_0x37d2ac,_0x138cf6[_0xffcd('0x16')]['message']);return _0x3918e7(_0x138cf6[_0xffcd('0x16')][_0xffcd('0x17')]);}logger[_0xffcd('0x16')]('User,\x20%s,\x20%s',_0x37d2ac,_0x138cf6[_0xffcd('0x16')]['message']);return _0x20bc59(_0x138cf6['error'][_0xffcd('0x17')]);}else{logger[_0xffcd('0x18')](_0xffcd('0x11'),_0x37d2ac,_0xffcd('0x12'));_0x20bc59(_0x138cf6[_0xffcd('0x19')][_0xffcd('0x17')]);}})[_0xffcd('0x1a')](function(_0x2453a4){logger[_0xffcd('0x16')]('User,\x20%s,\x20%s',_0x37d2ac,_0x2453a4);_0x3918e7(_0x2453a4);});});}exports[_0xffcd('0x1b')]=function(_0x216021){var _0x237adf=this;return new Promise(function(_0x5571cb,_0x4a0f73){return db[_0xffcd('0x1c')]['findAll']({'raw':_0x216021[_0xffcd('0x1d')]?_0x216021['options'][_0xffcd('0x1e')]===undefined?!![]:![]:!![],'where':_0x216021[_0xffcd('0x1d')]?_0x216021['options']['where']||null:null,'attributes':_0x216021[_0xffcd('0x1d')]?_0x216021['options'][_0xffcd('0x1f')]||null:null,'limit':_0x216021['options']?_0x216021[_0xffcd('0x1d')][_0xffcd('0x20')]||null:null,'include':_0x216021['options']?_0x216021[_0xffcd('0x1d')][_0xffcd('0x21')]?_[_0xffcd('0x22')](_0x216021[_0xffcd('0x1d')][_0xffcd('0x21')],function(_0x149551){return{'model':db[_0x149551[_0xffcd('0x23')]],'as':_0x149551['as'],'attributes':_0x149551[_0xffcd('0x1f')],'include':_0x149551['include']?_['map'](_0x149551[_0xffcd('0x21')],function(_0x2e1bf0){return{'model':db[_0x2e1bf0['model']],'as':_0x2e1bf0['as'],'attributes':_0x2e1bf0[_0xffcd('0x1f')],'include':_0x2e1bf0[_0xffcd('0x21')]?_[_0xffcd('0x22')](_0x2e1bf0[_0xffcd('0x21')],function(_0x45861e){return{'model':db[_0x45861e[_0xffcd('0x23')]],'as':_0x45861e['as'],'attributes':_0x45861e[_0xffcd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xffcd('0x10')](function(_0x286846){logger[_0xffcd('0x18')](_0xffcd('0x1b'),_0x216021);logger[_0xffcd('0x13')]('GetUser',_0x216021,JSON['stringify'](_0x286846));_0x5571cb(_0x286846);})[_0xffcd('0x1a')](function(_0x47b85d){logger[_0xffcd('0x16')]('GetUser',_0x47b85d[_0xffcd('0x17')],_0x216021);_0x4a0f73(_0x237adf[_0xffcd('0x16')](0x1f4,_0x47b85d['message']));});});};exports['ShowUser']=function(_0x521415){var _0x489090=this;return new Promise(function(_0x53244e,_0x21068e){return db[_0xffcd('0x1c')][_0xffcd('0x24')]({'raw':_0x521415[_0xffcd('0x1d')]?_0x521415[_0xffcd('0x1d')][_0xffcd('0x1e')]===undefined?!![]:![]:!![],'where':_0x521415[_0xffcd('0x1d')]?_0x521415[_0xffcd('0x1d')][_0xffcd('0x25')]||null:null,'attributes':_0x521415['options']?_0x521415['options'][_0xffcd('0x1f')]||null:null,'include':_0x521415['options']?_0x521415[_0xffcd('0x1d')][_0xffcd('0x21')]?_[_0xffcd('0x22')](_0x521415[_0xffcd('0x1d')]['include'],function(_0x270840){return{'model':db[_0x270840[_0xffcd('0x23')]],'as':_0x270840['as'],'attributes':_0x270840['attributes'],'include':_0x270840[_0xffcd('0x21')]?_[_0xffcd('0x22')](_0x270840['include'],function(_0x12723b){return{'model':db[_0x12723b[_0xffcd('0x23')]],'as':_0x12723b['as'],'attributes':_0x12723b['attributes'],'include':_0x12723b[_0xffcd('0x21')]?_[_0xffcd('0x22')](_0x12723b[_0xffcd('0x21')],function(_0x57f4ef){return{'model':db[_0x57f4ef[_0xffcd('0x23')]],'as':_0x57f4ef['as'],'attributes':_0x57f4ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xffcd('0x10')](function(_0x1c99d4){logger[_0xffcd('0x18')](_0xffcd('0x26'),_0x521415);logger[_0xffcd('0x13')](_0xffcd('0x26'),_0x521415,JSON[_0xffcd('0x15')](_0x1c99d4));_0x53244e(_0x1c99d4);})[_0xffcd('0x1a')](function(_0x59df87){logger[_0xffcd('0x16')](_0xffcd('0x26'),_0x59df87['message'],_0x521415);_0x21068e(_0x489090[_0xffcd('0x16')](0x1f4,_0x59df87['message']));});});};exports[_0xffcd('0x27')]=function(_0x42efdb){var _0x57597d=this;return new Promise(function(_0x198fde,_0x3ff5d2){var _0x54b5a8;return db['User'][_0xffcd('0x24')]({'where':_0x42efdb[_0xffcd('0x1d')][_0xffcd('0x25')]||{},'attributes':['id',_0xffcd('0x28'),'role',_0xffcd('0x29'),_0xffcd('0x2a')]})[_0xffcd('0x10')](function(_0x48a00f){if(_0x48a00f){_0x54b5a8=_0x48a00f;return db[_0xffcd('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x54b5a8['id']},'individualHooks':!![]});}})[_0xffcd('0x10')](function(){if(_0x54b5a8){return db[_0xffcd('0x2c')][_0xffcd('0x2d')]({'where':{'membername':_0x54b5a8[_0xffcd('0x28')],'type':_0xffcd('0x2e'),'exitAt':null}});}})[_0xffcd('0x10')](function(_0x337beb){if(_0x54b5a8){if(_0x337beb&&_0x337beb['length']){var _0x38bf17=moment()['format'](_0xffcd('0x2f'));for(var _0x469b67=0x0,_0x47978b=_0x337beb[_0xffcd('0x30')];_0x469b67<_0x47978b;_0x469b67++){_0x337beb[_0x469b67]['updateAttributes']({'exitAt':_0x38bf17});}}}})[_0xffcd('0x10')](function(){if(_0x54b5a8){var _0x43fe77=[];var _0x22d0e9=utils[_0xffcd('0x31')]();_0x22d0e9[_0xffcd('0x32')](function(_0x54ecd4){_0x43fe77[_0xffcd('0x33')]({'channel':_0x54ecd4,'membername':_0x54b5a8[_0xffcd('0x28')],'interface':_[_0xffcd('0x34')](_0x54b5a8[_0xffcd('0x2a')])?util[_0xffcd('0x35')](_0xffcd('0x36'),_0x54b5a8[_0xffcd('0x28')]):_0x54b5a8[_0xffcd('0x2a')],'type':_0xffcd('0x2e'),'enterAt':moment()['format'](_0xffcd('0x2f')),'data1':_0x42efdb[_0xffcd('0x37')]['type']||_0xffcd('0x38'),'role':_0x54b5a8[_0xffcd('0x39')],'internal':_0x54b5a8['internal'],'uniqueid':_0x42efdb[_0xffcd('0x37')][_0xffcd('0x3a')]||null});});return db[_0xffcd('0x2c')][_0xffcd('0x3b')](_0x43fe77,{'individualHooks':!![]});}})['then'](function(){if(_0x54b5a8){return _0x54b5a8[_0xffcd('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x42efdb[_0xffcd('0x37')]['type']||_0xffcd('0x38'),'lastPauseAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f'))});}})['then'](function(_0x32f6f7){_0x198fde(_0x32f6f7);})['catch'](function(_0x5922eb){_0x3ff5d2(_0x57597d[_0xffcd('0x16')](0x1f4,_0x5922eb[_0xffcd('0x17')]));});});};exports['UnpauseUser']=function(_0x31b834){var _0x2be05f=this;return new Promise(function(_0x2ae60f,_0x2004d2){var _0x187218;return db[_0xffcd('0x1c')][_0xffcd('0x3d')]({'where':_0x31b834[_0xffcd('0x1d')][_0xffcd('0x25')]||{},'attributes':['id',_0xffcd('0x28')]})[_0xffcd('0x10')](function(_0x3eaf12){if(_0x3eaf12){_0x187218=_0x3eaf12;if(_0x31b834['body'][_0xffcd('0x3e')]&&!utils[_0xffcd('0x3f')](_0x31b834[_0xffcd('0x37')]['channel'])){throw new Error(_0xffcd('0x40'));}switch(_0x31b834['body'][_0xffcd('0x3e')]){case _0xffcd('0x41'):return db[_0xffcd('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x187218['id']}})[_0xffcd('0x10')](function(){return db[_0xffcd('0x2c')]['find']({'where':{'channel':_0x31b834[_0xffcd('0x37')][_0xffcd('0x3e')],'membername':_0x187218['name'],'type':_0xffcd('0x2e'),'exitAt':null}});})[_0xffcd('0x10')](function(_0x1f049a){if(_0x1f049a){return _0x1f049a['update']({'exitAt':moment()[_0xffcd('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xffcd('0x42')},{'individualHooks':!![]});}return null;})[_0xffcd('0x10')](function(){return _0x187218['update']({'voicePause':![]});});case _0xffcd('0x43'):case _0xffcd('0x44'):case _0xffcd('0x45'):case _0xffcd('0x46'):case _0xffcd('0x47'):return db['MemberReport'][_0xffcd('0x24')]({'where':{'channel':_0x31b834['body']['channel'],'membername':_0x187218[_0xffcd('0x28')],'type':'PAUSE','exitAt':null}})['then'](function(_0x502bc2){return _0x502bc2[_0xffcd('0x3c')]({'exitAt':moment()['format'](_0xffcd('0x2f')),'data2':_0xffcd('0x42')},{'individualHooks':!![]});})[_0xffcd('0x10')](function(){var _0x658f46={};_[_0xffcd('0x48')](_0x658f46,util[_0xffcd('0x35')](_0xffcd('0x49'),_0x31b834[_0xffcd('0x37')][_0xffcd('0x3e')],_0xffcd('0x4a')),![]);return _0x187218['update'](_0x658f46);});default:return db[_0xffcd('0x2b')][_0xffcd('0x3c')]({'paused':0x0},{'where':{'UserId':_0x187218['id']}})[_0xffcd('0x10')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x187218[_0xffcd('0x28')],'type':'PAUSE','exitAt':null}});})[_0xffcd('0x10')](function(_0x2d196b){var _0x52df43=[];_0x2d196b[_0xffcd('0x32')](function(_0x5b56c2){_0x52df43[_0xffcd('0x33')](_0x5b56c2[_0xffcd('0x3c')]({'exitAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f')),'data2':'system'}));});return BPromise[_0xffcd('0x4b')](_0x52df43);})['then'](function(){return _0x187218['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xffcd('0x10')](function(_0x30c8b6){_0x2ae60f(_0x30c8b6);})['catch'](function(_0x5dea7d){_0x2004d2(_0x2be05f['error'](0x1f4,_0x5dea7d[_0xffcd('0x17')]));});});};exports['LogoutUser']=function(_0x4f6c5c){var _0x4ea6e2=this;return new Promise(function(_0x45c221,_0x579623){var _0x15232f;return db[_0xffcd('0x1c')][_0xffcd('0x3d')]({'where':_0x4f6c5c[_0xffcd('0x1d')][_0xffcd('0x25')]||{},'attributes':['id','name']})['then'](function(_0x541f53){if(_0x541f53){_0x15232f=_0x541f53;return db['UserVoiceQueueRt'][_0xffcd('0x4c')]({'where':{'membername':_0x15232f['name']},'individualHooks':!![]});}})[_0xffcd('0x10')](function(){if(_0x15232f){return db[_0xffcd('0x2c')]['findAll']({'where':{'membername':_0x15232f[_0xffcd('0x28')],'exitAt':null}});}})[_0xffcd('0x10')](function(_0x1eaa77){if(_0x15232f){if(_0x1eaa77&&_0x1eaa77[_0xffcd('0x30')]){var _0xbe1bc8=[];_0x1eaa77[_0xffcd('0x32')](function(_0x1836cf){_0xbe1bc8[_0xffcd('0x33')](_0x1836cf[_0xffcd('0x3c')]({'exitAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f'))}));});return BPromise[_0xffcd('0x4b')](_0xbe1bc8);}}})[_0xffcd('0x10')](function(){if(_0x15232f){return _0x15232f['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x20ea68){_0x45c221(_0x20ea68);})[_0xffcd('0x1a')](function(_0x359c0f){_0x579623(_0x4ea6e2[_0xffcd('0x16')](0x1f4,_0x359c0f[_0xffcd('0x17')]));});});};exports[_0xffcd('0x4d')]=function(_0x514a4a){var _0x1af8c9=this;return new Promise(function(_0x3bb36b,_0x3ddbb1){var _0x17ae6b;var _0x191d06;var _0x63280e;var _0x3df1a5;return db['User'][_0xffcd('0x3d')]({'where':_0x514a4a[_0xffcd('0x1d')][_0xffcd('0x25')]||{},'attributes':['id',_0xffcd('0x28'),'role',_0xffcd('0x4e'),_0xffcd('0x4f'),'internal',_0xffcd('0x50'),_0xffcd('0x2a')]})['then'](function(_0x3e4652){if(_0x3e4652){_0x17ae6b=_0x3e4652;_0x3df1a5=_0x514a4a[_0xffcd('0x37')][_0xffcd('0x2a')]?_0x514a4a['body'][_0xffcd('0x2a')]:util[_0xffcd('0x35')]('SIP/%s',_0x17ae6b[_0xffcd('0x28')]);return db['User'][_0xffcd('0x51')]({'where':{'role':_0xffcd('0x52'),'online':!![],'id':{'$ne':_0x17ae6b['id']}}});}})[_0xffcd('0x10')](function(_0x395870){if(_0x395870){_0x63280e=_0x395870;return require(_0xffcd('0x53'))[_0xffcd('0x54')]();}})['then'](function(_0x325fd2){if(_0x325fd2&&_0x325fd2['agents']&&_0x63280e>=_0x325fd2[_0xffcd('0x55')]){throw new Error(_0xffcd('0x56'));}})[_0xffcd('0x10')](function(){if(_0x17ae6b){return db[_0xffcd('0x2b')][_0xffcd('0x4c')]({'where':{'membername':_0x17ae6b['name']},'individualHooks':!![]});}})[_0xffcd('0x10')](function(){if(_0x17ae6b){return _0x17ae6b['getVoiceQueues']({'raw':!![]});}})[_0xffcd('0x10')](function(_0x432f4c){if(_0x17ae6b){if(_0x432f4c){var _0x25da81=[];_0x191d06=_0x432f4c;if(_0x191d06[_0xffcd('0x30')]){for(var _0x57e7bb=0x0;_0x57e7bb<_0x191d06[_0xffcd('0x30')];_0x57e7bb++){_0x25da81[_0xffcd('0x33')](db[_0xffcd('0x2b')][_0xffcd('0x57')]({'membername':_0x17ae6b[_0xffcd('0x28')],'UserId':_0x17ae6b['id'],'queue_name':_0x191d06[_0x57e7bb]['name'],'VoiceQueueId':_0x191d06[_0x57e7bb]['id'],'interface':_0x3df1a5,'paused':_0x17ae6b[_0xffcd('0x50')]||![],'penalty':_0x191d06[_0x57e7bb]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xffcd('0x4b')](_0x25da81);}}}})[_0xffcd('0x10')](function(){if(_0x17ae6b){return db[_0xffcd('0x2c')][_0xffcd('0x2d')]({'where':{'membername':_0x17ae6b[_0xffcd('0x28')],'exitAt':null}});}})['then'](function(_0x26146c){if(_0x17ae6b){if(_0x26146c&&_0x26146c[_0xffcd('0x30')]){var _0x4ce2b2=[];_0x26146c[_0xffcd('0x32')](function(_0x51c6f1){_0x4ce2b2[_0xffcd('0x33')](_0x51c6f1['update']({'exitAt':moment()['format'](_0xffcd('0x2f'))}));});return BPromise[_0xffcd('0x4b')](_0x4ce2b2);}}})[_0xffcd('0x10')](function(_0xefcc81){if(_0x17ae6b){var _0x3477af=[];var _0x4d0e08=[];var _0x157135=utils[_0xffcd('0x31')]();var _0x454171={'membername':_0x17ae6b[_0xffcd('0x28')],'interface':_0x3df1a5,'enterAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f')),'role':_0x17ae6b[_0xffcd('0x39')],'internal':_0x17ae6b[_0xffcd('0x29')]};_0x157135['forEach'](function(_0x4c01cd){_0x3477af['push'](_[_0xffcd('0x58')]({'channel':_0x4c01cd,'type':_0xffcd('0x59'),'data1':_0xffcd('0x5a'),'data2':_0x3df1a5},_0x454171));if(_0x17ae6b[_0xffcd('0x50')]){_0x4d0e08[_0xffcd('0x33')](_[_0xffcd('0x58')]({'channel':_0x4c01cd,'type':_0xffcd('0x2e'),'data1':_0xffcd('0x5b')},_0x454171));}});return db[_0xffcd('0x2c')][_0xffcd('0x3b')](_0x3477af[_0xffcd('0x5c')](_0x4d0e08),{'individualHooks':!![]});}})[_0xffcd('0x10')](function(){if(_0x17ae6b){return _0x17ae6b[_0xffcd('0x3c')]({'online':!![],'lastLoginAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f')),'voicePause':_0x17ae6b[_0xffcd('0x50')]||![],'mailPause':_0x17ae6b[_0xffcd('0x50')]||![],'chatPause':_0x17ae6b['loginInPause']||![],'faxPause':_0x17ae6b[_0xffcd('0x50')]||![],'smsPause':_0x17ae6b[_0xffcd('0x50')]||![],'openchannelPause':_0x17ae6b[_0xffcd('0x50')]||![],'pauseType':_0x17ae6b['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xffcd('0x35')](_0xffcd('0x2f')),'interface':_0x3df1a5});}})[_0xffcd('0x10')](function(_0x5aa50b){_0x3bb36b(_0x5aa50b);})['catch'](function(_0x31867c){_0x3ddbb1(_0x1af8c9[_0xffcd('0x16')](0x1f4,_0x31867c[_0xffcd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5d402e3..b17ec4e 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 _0x733f=['removeListener','register','user:','./user.events','save','remove','update'];(function(_0x138014,_0x3ccd10){var _0x44254e=function(_0x3f581c){while(--_0x3f581c){_0x138014['push'](_0x138014['shift']());}};_0x44254e(++_0x3ccd10);}(_0x733f,0x161));var _0xf733=function(_0x2b46d6,_0x5ca74c){_0x2b46d6=_0x2b46d6-0x0;var _0x5d018f=_0x733f[_0x2b46d6];return _0x5d018f;};'use strict';var UserEvents=require(_0xf733('0x0'));var events=[_0xf733('0x1'),_0xf733('0x2'),_0xf733('0x3')];function createListener(_0x3671e7,_0xde2e6d){return function(_0x76fa8b){_0xde2e6d['emit'](_0x3671e7,_0x76fa8b);};}function removeListener(_0x2db1eb,_0x365579){return function(){UserEvents[_0xf733('0x4')](_0x2db1eb,_0x365579);};}exports[_0xf733('0x5')]=function(_0x5db637){for(var _0x53a71a=0x0,_0x587289=events['length'];_0x53a71a<_0x587289;_0x53a71a++){var _0x5c72ce=events[_0x53a71a];var _0x11c1e=createListener(_0xf733('0x6')+_0x5c72ce,_0x5db637);UserEvents['on'](_0x5c72ce,_0x11c1e);}}; \ No newline at end of file +var _0x8891=['user:','remove','emit','register','length'];(function(_0x5ab539,_0x538b62){var _0x1d6dea=function(_0xfaae1b){while(--_0xfaae1b){_0x5ab539['push'](_0x5ab539['shift']());}};_0x1d6dea(++_0x538b62);}(_0x8891,0x182));var _0x1889=function(_0xdcca54,_0x4b2b61){_0xdcca54=_0xdcca54-0x0;var _0x453197=_0x8891[_0xdcca54];return _0x453197;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x1889('0x0'),'update'];function createListener(_0x4cbfc5,_0x32925f){return function(_0x9f5995){_0x32925f[_0x1889('0x1')](_0x4cbfc5,_0x9f5995);};}function removeListener(_0x21e3fc,_0x4f6698){return function(){UserEvents['removeListener'](_0x21e3fc,_0x4f6698);};}exports[_0x1889('0x2')]=function(_0x54f2a2){for(var _0x100ae5=0x0,_0x41ff39=events[_0x1889('0x3')];_0x100ae5<_0x41ff39;_0x100ae5++){var _0x35c10b=events[_0x100ae5];var _0x1c5a86=createListener(_0x1889('0x4')+_0x35c10b,_0x54f2a2);UserEvents['on'](_0x35c10b,_0x1c5a86);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4559077..18d5e95 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 _0x67f9=['../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout','express','Router'];(function(_0x5e5b83,_0x19baf0){var _0x5d20c4=function(_0x3491e8){while(--_0x3491e8){_0x5e5b83['push'](_0x5e5b83['shift']());}};_0x5d20c4(++_0x19baf0);}(_0x67f9,0x1db));var _0x967f=function(_0x4ae583,_0x557094){_0x4ae583=_0x4ae583-0x0;var _0x4f83d7=_0x67f9[_0x4ae583];return _0x4f83d7;};'use strict';var multer=require(_0x967f('0x0'));var util=require(_0x967f('0x1'));var path=require('path');var timeout=require(_0x967f('0x2'));var express=require(_0x967f('0x3'));var router=express[_0x967f('0x4')]();var auth=require(_0x967f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x967f('0x6'));module[_0x967f('0x7')]=router; \ No newline at end of file +var _0x838a=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2fe42e,_0x33d7f2){var _0x8155d9=function(_0xfa34e8){while(--_0xfa34e8){_0x2fe42e['push'](_0x2fe42e['shift']());}};_0x8155d9(++_0x33d7f2);}(_0x838a,0xa2));var _0xa838=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x838a[_0x5c4585];return _0x21dede;};'use strict';var multer=require(_0xa838('0x0'));var util=require(_0xa838('0x1'));var path=require(_0xa838('0x2'));var timeout=require(_0xa838('0x3'));var express=require(_0xa838('0x4'));var router=express[_0xa838('0x5')]();var auth=require(_0xa838('0x6'));var interaction=require(_0xa838('0x7'));var config=require(_0xa838('0x8'));module[_0xa838('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c655226..2bd4966 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x15fe6b,_0x2b47dc){var _0x2b6c58=function(_0x26f321){while(--_0x26f321){_0x15fe6b['push'](_0x15fe6b['shift']());}};_0x2b6c58(++_0x2b47dc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6de39e5..d78193a 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 _0x29e2=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userChatQueue.attributes'];(function(_0x308aaa,_0x23c9ad){var _0x2db829=function(_0x45a6df){while(--_0x45a6df){_0x308aaa['push'](_0x308aaa['shift']());}};_0x2db829(++_0x23c9ad);}(_0x29e2,0xe1));var _0x229e=function(_0x2125d4,_0x4a5b20){_0x2125d4=_0x2125d4-0x0;var _0x59a013=_0x29e2[_0x2125d4];return _0x59a013;};'use strict';var _=require(_0x229e('0x0'));var util=require(_0x229e('0x1'));var logger=require(_0x229e('0x2'))(_0x229e('0x3'));var moment=require('moment');var BPromise=require(_0x229e('0x4'));var rp=require(_0x229e('0x5'));var fs=require('fs');var path=require(_0x229e('0x6'));var rimraf=require(_0x229e('0x7'));var config=require('../../config/environment');var attributes=require(_0x229e('0x8'));module[_0x229e('0x9')]=function(_0x3df24c,_0x2b66bf){return _0x3df24c[_0x229e('0xa')](_0x229e('0xb'),attributes,{'tableName':_0x229e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f22=['api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x56094d,_0x5ebf28){var _0x1399cd=function(_0x3229ab){while(--_0x3229ab){_0x56094d['push'](_0x56094d['shift']());}};_0x1399cd(++_0x5ebf28);}(_0x7f22,0xa6));var _0x27f2=function(_0x581f70,_0x332605){_0x581f70=_0x581f70-0x0;var _0x42d7ad=_0x7f22[_0x581f70];return _0x42d7ad;};'use strict';var _=require(_0x27f2('0x0'));var util=require(_0x27f2('0x1'));var logger=require(_0x27f2('0x2'))(_0x27f2('0x3'));var moment=require('moment');var BPromise=require(_0x27f2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27f2('0x5'));var rimraf=require(_0x27f2('0x6'));var config=require(_0x27f2('0x7'));var attributes=require(_0x27f2('0x8'));module[_0x27f2('0x9')]=function(_0xee344e,_0x5b6635){return _0xee344e[_0x27f2('0xa')](_0x27f2('0xb'),attributes,{'tableName':_0x27f2('0xc'),'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 ac2f369..a589acf 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 _0xe034=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent'];(function(_0x3f3b46,_0x2b921a){var _0x4b4d60=function(_0x5865e1){while(--_0x5865e1){_0x3f3b46['push'](_0x3f3b46['shift']());}};_0x4b4d60(++_0x2b921a);}(_0xe034,0x12d));var _0x4e03=function(_0x4289ea,_0x4b63fc){_0x4289ea=_0x4289ea-0x0;var _0x59e237=_0xe034[_0x4289ea];return _0x59e237;};'use strict';var _=require(_0x4e03('0x0'));var util=require(_0x4e03('0x1'));var moment=require(_0x4e03('0x2'));var BPromise=require(_0x4e03('0x3'));var rs=require(_0x4e03('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e03('0x5'))['db'];var utils=require(_0x4e03('0x6'));var logger=require(_0x4e03('0x7'))(_0x4e03('0x8'));var config=require(_0x4e03('0x9'));var jayson=require(_0x4e03('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1793e7,_0x21fc0c,_0x3a4a59){return new BPromise(function(_0xce3181,_0x4c66cd){return client[_0x4e03('0xb')](_0x1793e7,_0x3a4a59)[_0x4e03('0xc')](function(_0x173a34){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x21fc0c,_0x4e03('0xd'));logger[_0x4e03('0xe')](_0x4e03('0xf'),_0x21fc0c,_0x4e03('0xd'),JSON[_0x4e03('0x10')](_0x173a34));if(_0x173a34[_0x4e03('0x11')]){if(_0x173a34[_0x4e03('0x11')]['code']===0x1f4){logger['error'](_0x4e03('0x12'),_0x21fc0c,_0x173a34[_0x4e03('0x11')][_0x4e03('0x13')]);return _0x4c66cd(_0x173a34[_0x4e03('0x11')]['message']);}logger[_0x4e03('0x11')](_0x4e03('0x12'),_0x21fc0c,_0x173a34[_0x4e03('0x11')][_0x4e03('0x13')]);return _0xce3181(_0x173a34[_0x4e03('0x11')][_0x4e03('0x13')]);}else{logger['info'](_0x4e03('0x12'),_0x21fc0c,_0x4e03('0xd'));_0xce3181(_0x173a34[_0x4e03('0x14')][_0x4e03('0x13')]);}})['catch'](function(_0x5b4432){logger['error'](_0x4e03('0x12'),_0x21fc0c,_0x5b4432);_0x4c66cd(_0x5b4432);});});} \ No newline at end of file +var _0x5bed=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserChatQueue,\x20%s,\x20%s','message','info'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5bed,0x1cd));var _0xd5be=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5bed[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd5be('0x0'));var util=require(_0xd5be('0x1'));var moment=require(_0xd5be('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5be('0x3'));var fs=require('fs');var Redis=require(_0xd5be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5be('0x5'));var logger=require(_0xd5be('0x6'))(_0xd5be('0x7'));var config=require(_0xd5be('0x8'));var jayson=require(_0xd5be('0x9'));var client=jayson[_0xd5be('0xa')][_0xd5be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf834e4,_0x11b057,_0xbdf41d){return new BPromise(function(_0x95d5a0,_0x1d7856){return client[_0xd5be('0xc')](_0xf834e4,_0xbdf41d)[_0xd5be('0xd')](function(_0x2c38b6){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x11b057,'request\x20sent');logger[_0xd5be('0xe')](_0xd5be('0xf'),_0x11b057,_0xd5be('0x10'),JSON[_0xd5be('0x11')](_0x2c38b6));if(_0x2c38b6[_0xd5be('0x12')]){if(_0x2c38b6[_0xd5be('0x12')]['code']===0x1f4){logger['error'](_0xd5be('0x13'),_0x11b057,_0x2c38b6[_0xd5be('0x12')][_0xd5be('0x14')]);return _0x1d7856(_0x2c38b6['error'][_0xd5be('0x14')]);}logger[_0xd5be('0x12')](_0xd5be('0x13'),_0x11b057,_0x2c38b6[_0xd5be('0x12')]['message']);return _0x95d5a0(_0x2c38b6[_0xd5be('0x12')]['message']);}else{logger[_0xd5be('0x15')](_0xd5be('0x13'),_0x11b057,_0xd5be('0x10'));_0x95d5a0(_0x2c38b6[_0xd5be('0x16')][_0xd5be('0x14')]);}})['catch'](function(_0x4d5853){logger[_0xd5be('0x12')](_0xd5be('0x13'),_0x11b057,_0x4d5853);_0x1d7856(_0x4d5853);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3b44d77..7aead6b 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 _0x13fc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x13fc,0xe5));var _0xc13f=function(_0x57664a,_0x4b0f3f){_0x57664a=_0x57664a-0x0;var _0x4f4637=_0x13fc[_0x57664a];return _0x4f4637;};'use strict';var multer=require(_0xc13f('0x0'));var util=require('util');var path=require(_0xc13f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc13f('0x2'));var router=express[_0xc13f('0x3')]();var auth=require(_0xc13f('0x4'));var interaction=require(_0xc13f('0x5'));var config=require(_0xc13f('0x6'));module[_0xc13f('0x7')]=router; \ No newline at end of file +var _0x90c3=['../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2c15d2,_0x4e67c7){var _0x40f732=function(_0x3cac62){while(--_0x3cac62){_0x2c15d2['push'](_0x2c15d2['shift']());}};_0x40f732(++_0x4e67c7);}(_0x90c3,0x192));var _0x390c=function(_0xa69467,_0x21f379){_0xa69467=_0xa69467-0x0;var _0x5ce378=_0x90c3[_0xa69467];return _0x5ce378;};'use strict';var multer=require(_0x390c('0x0'));var util=require(_0x390c('0x1'));var path=require('path');var timeout=require(_0x390c('0x2'));var express=require(_0x390c('0x3'));var router=express[_0x390c('0x4')]();var auth=require(_0x390c('0x5'));var interaction=require(_0x390c('0x6'));var config=require(_0x390c('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 83e7ae8..2b3c797 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 _0x7708=['exports','INTEGER','sequelize'];(function(_0x2ea70c,_0xdfb3b3){var _0x33f938=function(_0x5133da){while(--_0x5133da){_0x2ea70c['push'](_0x2ea70c['shift']());}};_0x33f938(++_0xdfb3b3);}(_0x7708,0x188));var _0x8770=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x7708[_0x23f8c8];return _0x3dc718;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8770('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe511=['INTEGER','sequelize','exports'];(function(_0x1b5f00,_0x2bba5a){var _0x235948=function(_0x367ee1){while(--_0x367ee1){_0x1b5f00['push'](_0x1b5f00['shift']());}};_0x235948(++_0x2bba5a);}(_0xe511,0x16f));var _0x1e51=function(_0x76d88d,_0x48b0f2){_0x76d88d=_0x76d88d-0x0;var _0x2fa9e0=_0xe511[_0x76d88d];return _0x2fa9e0;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1e51('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 52492ae..ce2a64c 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(_0xb4ec3a,_0x2bace0){var _0x1b83db=function(_0x5278f3){while(--_0x5278f3){_0xb4ec3a['push'](_0xb4ec3a['shift']());}};_0x1b83db(++_0x2bace0);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f280,_0x4a1dad){_0x44f280=_0x44f280-0x0;var _0x4ee19d=_0xb10b[_0x44f280];return _0x4ee19d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b3017,_0x531959){_0x3b3017=_0x3b3017-0x0;var _0xd8fd8d=_0xb10b[_0x3b3017];return _0xd8fd8d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b5e86f2..cba2936 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 _0x4ca5=['jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e61e9,_0x56448c){var _0x22d371=function(_0x57ca58){while(--_0x57ca58){_0x1e61e9['push'](_0x1e61e9['shift']());}};_0x22d371(++_0x56448c);}(_0x4ca5,0x1ae));var _0x54ca=function(_0x40a438,_0x371cf5){_0x40a438=_0x40a438-0x0;var _0x1e8152=_0x4ca5[_0x40a438];return _0x1e8152;};'use strict';var _=require(_0x54ca('0x0'));var util=require(_0x54ca('0x1'));var moment=require(_0x54ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x54ca('0x3'));var fs=require('fs');var Redis=require(_0x54ca('0x4'));var db=require(_0x54ca('0x5'))['db'];var utils=require(_0x54ca('0x6'));var logger=require(_0x54ca('0x7'))(_0x54ca('0x8'));var config=require(_0x54ca('0x9'));var jayson=require(_0x54ca('0xa'));var client=jayson[_0x54ca('0xb')][_0x54ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c2530,_0x40e297,_0x1ad273){return new BPromise(function(_0xe0f9b2,_0x148311){return client['request'](_0x5c2530,_0x1ad273)[_0x54ca('0xd')](function(_0x388bdc){logger[_0x54ca('0xe')](_0x54ca('0xf'),_0x40e297,_0x54ca('0x10'));logger[_0x54ca('0x11')](_0x54ca('0x12'),_0x40e297,_0x54ca('0x10'),JSON['stringify'](_0x388bdc));if(_0x388bdc[_0x54ca('0x13')]){if(_0x388bdc[_0x54ca('0x13')]['code']===0x1f4){logger['error'](_0x54ca('0xf'),_0x40e297,_0x388bdc['error'][_0x54ca('0x14')]);return _0x148311(_0x388bdc['error'][_0x54ca('0x14')]);}logger[_0x54ca('0x13')](_0x54ca('0xf'),_0x40e297,_0x388bdc['error'][_0x54ca('0x14')]);return _0xe0f9b2(_0x388bdc['error'][_0x54ca('0x14')]);}else{logger[_0x54ca('0xe')](_0x54ca('0xf'),_0x40e297,_0x54ca('0x10'));_0xe0f9b2(_0x388bdc['result'][_0x54ca('0x14')]);}})[_0x54ca('0x15')](function(_0x5717b3){logger[_0x54ca('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x40e297,_0x5717b3);_0x148311(_0x5717b3);});});} \ No newline at end of file +var _0x844d=['stringify','error','code','message','result','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x361ab9,_0x5e38e9){var _0x1ddadb=function(_0x5e9182){while(--_0x5e9182){_0x361ab9['push'](_0x361ab9['shift']());}};_0x1ddadb(++_0x5e38e9);}(_0x844d,0xec));var _0xd844=function(_0x4f750b,_0x4e3e43){_0x4f750b=_0x4f750b-0x0;var _0x918b39=_0x844d[_0x4f750b];return _0x918b39;};'use strict';var _=require('lodash');var util=require(_0xd844('0x0'));var moment=require('moment');var BPromise=require(_0xd844('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd844('0x2'))['db'];var utils=require(_0xd844('0x3'));var logger=require(_0xd844('0x4'))(_0xd844('0x5'));var config=require(_0xd844('0x6'));var jayson=require(_0xd844('0x7'));var client=jayson[_0xd844('0x8')][_0xd844('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389e21,_0x4d995f,_0x204ff2){return new BPromise(function(_0x1186b0,_0x35fc5b){return client[_0xd844('0xa')](_0x389e21,_0x204ff2)[_0xd844('0xb')](function(_0x30dd13){logger[_0xd844('0xc')](_0xd844('0xd'),_0x4d995f,_0xd844('0xe'));logger[_0xd844('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4d995f,_0xd844('0xe'),JSON[_0xd844('0x10')](_0x30dd13));if(_0x30dd13[_0xd844('0x11')]){if(_0x30dd13[_0xd844('0x11')][_0xd844('0x12')]===0x1f4){logger[_0xd844('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4d995f,_0x30dd13[_0xd844('0x11')][_0xd844('0x13')]);return _0x35fc5b(_0x30dd13[_0xd844('0x11')]['message']);}logger[_0xd844('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4d995f,_0x30dd13[_0xd844('0x11')][_0xd844('0x13')]);return _0x1186b0(_0x30dd13[_0xd844('0x11')][_0xd844('0x13')]);}else{logger['info'](_0xd844('0xd'),_0x4d995f,_0xd844('0xe'));_0x1186b0(_0x30dd13[_0xd844('0x14')]['message']);}})['catch'](function(_0x3bf358){logger[_0xd844('0x11')](_0xd844('0xd'),_0x4d995f,_0x3bf358);_0x35fc5b(_0x3bf358);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5806221..27c0e5f 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 _0x9b17=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x167b19,_0x56081a){var _0x1fcca2=function(_0x544ca4){while(--_0x544ca4){_0x167b19['push'](_0x167b19['shift']());}};_0x1fcca2(++_0x56081a);}(_0x9b17,0x101));var _0x79b1=function(_0x543349,_0x8f9924){_0x543349=_0x543349-0x0;var _0x2f87da=_0x9b17[_0x543349];return _0x2f87da;};'use strict';var multer=require(_0x79b1('0x0'));var util=require(_0x79b1('0x1'));var path=require(_0x79b1('0x2'));var timeout=require(_0x79b1('0x3'));var express=require(_0x79b1('0x4'));var router=express[_0x79b1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x79b1('0x6'));var config=require(_0x79b1('0x7'));module[_0x79b1('0x8')]=router; \ No newline at end of file +var _0xfe99=['exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x486b80,_0x2a085d){var _0x2755bd=function(_0xa6e59e){while(--_0xa6e59e){_0x486b80['push'](_0x486b80['shift']());}};_0x2755bd(++_0x2a085d);}(_0xfe99,0x1a5));var _0x9fe9=function(_0x15a068,_0x256618){_0x15a068=_0x15a068-0x0;var _0x1ec1ff=_0xfe99[_0x15a068];return _0x1ec1ff;};'use strict';var multer=require(_0x9fe9('0x0'));var util=require(_0x9fe9('0x1'));var path=require('path');var timeout=require(_0x9fe9('0x2'));var express=require('express');var router=express[_0x9fe9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9fe9('0x4'));var config=require(_0x9fe9('0x5'));module[_0x9fe9('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 1df70a3..e8a23ea 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 _0xbaf0=['exports','INTEGER'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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(_0x158987,_0x13dd8a){var _0x62dbe5=function(_0x983ff){while(--_0x983ff){_0x158987['push'](_0x158987['shift']());}};_0x62dbe5(++_0x13dd8a);}(_0xe706,0xa3));var _0x6e70=function(_0x2beeb9,_0x415c85){_0x2beeb9=_0x2beeb9-0x0;var _0x3f7f25=_0xe706[_0x2beeb9];return _0x3f7f25;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 6af2e2a..398f7b8 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(_0x565d47,_0x481178){var _0x16c6e3=function(_0x3d2c7e){while(--_0x3d2c7e){_0x565d47['push'](_0x565d47['shift']());}};_0x16c6e3(++_0x481178);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x155a9b,_0x98ede5){var _0x47ffc3=function(_0x2a9ae7){while(--_0x2a9ae7){_0x155a9b['push'](_0x155a9b['shift']());}};_0x47ffc3(++_0x98ede5);}(_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 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 5e95baf..0eef6a1 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 _0x8caf=['debug','request\x20sent','stringify','error','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x8caf,0x16f));var _0xf8ca=function(_0x38a155,_0x2aa026){_0x38a155=_0x38a155-0x0;var _0x269403=_0x8caf[_0x38a155];return _0x269403;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var moment=require('moment');var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require(_0xf8ca('0x6'));var logger=require(_0xf8ca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf8ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51d92f,_0xdaf0ac,_0x3faec9){return new BPromise(function(_0x28625e,_0x1becd2){return client['request'](_0x51d92f,_0x3faec9)[_0xf8ca('0x9')](function(_0x288464){logger[_0xf8ca('0xa')]('UserMailQueue,\x20%s,\x20%s',_0xdaf0ac,'request\x20sent');logger[_0xf8ca('0xb')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0xdaf0ac,_0xf8ca('0xc'),JSON[_0xf8ca('0xd')](_0x288464));if(_0x288464[_0xf8ca('0xe')]){if(_0x288464[_0xf8ca('0xe')]['code']===0x1f4){logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0xdaf0ac,_0x288464[_0xf8ca('0xe')][_0xf8ca('0x10')]);return _0x1becd2(_0x288464['error'][_0xf8ca('0x10')]);}logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0xdaf0ac,_0x288464[_0xf8ca('0xe')][_0xf8ca('0x10')]);return _0x28625e(_0x288464['error'][_0xf8ca('0x10')]);}else{logger[_0xf8ca('0xa')]('UserMailQueue,\x20%s,\x20%s',_0xdaf0ac,'request\x20sent');_0x28625e(_0x288464['result']['message']);}})[_0xf8ca('0x11')](function(_0x2f3ee7){logger['error']('UserMailQueue,\x20%s,\x20%s',_0xdaf0ac,_0x2f3ee7);_0x1becd2(_0x2f3ee7);});});} \ No newline at end of file +var _0xe861=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xe861,0xb3));var _0x1e86=function(_0x3935a3,_0x4a7a83){_0x3935a3=_0x3935a3-0x0;var _0x5a217f=_0xe861[_0x3935a3];return _0x5a217f;};'use strict';var _=require(_0x1e86('0x0'));var util=require(_0x1e86('0x1'));var moment=require(_0x1e86('0x2'));var BPromise=require(_0x1e86('0x3'));var rs=require(_0x1e86('0x4'));var fs=require('fs');var Redis=require(_0x1e86('0x5'));var db=require(_0x1e86('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e86('0x7'))(_0x1e86('0x8'));var config=require(_0x1e86('0x9'));var jayson=require(_0x1e86('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2ca8,_0x213a1c,_0xcb9988){return new BPromise(function(_0x15d6fc,_0x40a40d){return client['request'](_0x1b2ca8,_0xcb9988)['then'](function(_0x4b13c5){logger['info'](_0x1e86('0xb'),_0x213a1c,_0x1e86('0xc'));logger[_0x1e86('0xd')](_0x1e86('0xe'),_0x213a1c,'request\x20sent',JSON[_0x1e86('0xf')](_0x4b13c5));if(_0x4b13c5[_0x1e86('0x10')]){if(_0x4b13c5['error'][_0x1e86('0x11')]===0x1f4){logger[_0x1e86('0x10')](_0x1e86('0xb'),_0x213a1c,_0x4b13c5[_0x1e86('0x10')]['message']);return _0x40a40d(_0x4b13c5['error'][_0x1e86('0x12')]);}logger['error'](_0x1e86('0xb'),_0x213a1c,_0x4b13c5[_0x1e86('0x10')][_0x1e86('0x12')]);return _0x15d6fc(_0x4b13c5['error']['message']);}else{logger[_0x1e86('0x13')](_0x1e86('0xb'),_0x213a1c,_0x1e86('0xc'));_0x15d6fc(_0x4b13c5[_0x1e86('0x14')][_0x1e86('0x12')]);}})[_0x1e86('0x15')](function(_0x376604){logger[_0x1e86('0x10')](_0x1e86('0xb'),_0x213a1c,_0x376604);_0x40a40d(_0x376604);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 16c706d..b2d9994 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 _0x1efa=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x75a7b9,_0x5446c1){var _0x5d6d8a=function(_0x19cf6e){while(--_0x19cf6e){_0x75a7b9['push'](_0x75a7b9['shift']());}};_0x5d6d8a(++_0x5446c1);}(_0x1efa,0x15d));var _0xa1ef=function(_0x3c4d0f,_0x4bb2e7){_0x3c4d0f=_0x3c4d0f-0x0;var _0x35afa7=_0x1efa[_0x3c4d0f];return _0x35afa7;};'use strict';var multer=require(_0xa1ef('0x0'));var util=require(_0xa1ef('0x1'));var path=require(_0xa1ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1ef('0x3'));var router=express[_0xa1ef('0x4')]();var auth=require(_0xa1ef('0x5'));var interaction=require(_0xa1ef('0x6'));var config=require(_0xa1ef('0x7'));module['exports']=router; \ No newline at end of file +var _0x516f=['util','path','connect-timeout','express','Router','../../components/auth/service','exports','multer'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x516f,0x7f));var _0xf516=function(_0x3ff33b,_0x2d0603){_0x3ff33b=_0x3ff33b-0x0;var _0x27d46e=_0x516f[_0x3ff33b];return _0x27d46e;};'use strict';var multer=require(_0xf516('0x0'));var util=require(_0xf516('0x1'));var path=require(_0xf516('0x2'));var timeout=require(_0xf516('0x3'));var express=require(_0xf516('0x4'));var router=express[_0xf516('0x5')]();var auth=require(_0xf516('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xf516('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a6f463a..0232215 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x3044c4,_0x16021a){var _0x167d1e=function(_0x3faeee){while(--_0x3faeee){_0x3044c4['push'](_0x3044c4['shift']());}};_0x167d1e(++_0x16021a);}(_0xe706,0xa3));var _0x6e70=function(_0x3afb73,_0xaa578f){_0x3afb73=_0x3afb73-0x0;var _0x5165f2=_0xe706[_0x3afb73];return _0x5165f2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xa640e7,_0x7d9bfc){var _0x26162d=function(_0x8c4149){while(--_0x8c4149){_0xa640e7['push'](_0xa640e7['shift']());}};_0x26162d(++_0x7d9bfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('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 3bf4200..410c39c 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 _0xb9dd=['../../config/environment','exports','define','UserOpenchannelQueue','lodash','moment','bluebird','request-promise'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xb9dd,0x74));var _0xdb9d=function(_0x2ee4a6,_0xf2cbc4){_0x2ee4a6=_0x2ee4a6-0x0;var _0x1e6f37=_0xb9dd[_0x2ee4a6];return _0x1e6f37;};'use strict';var _=require(_0xdb9d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdb9d('0x1'));var BPromise=require(_0xdb9d('0x2'));var rp=require(_0xdb9d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb9d('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xdb9d('0x5')]=function(_0x4db489,_0x3e131b){return _0x4db489[_0xdb9d('0x6')](_0xdb9d('0x7'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bee=['../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x303864,_0x1a0eaf){var _0x250c15=function(_0x362a9a){while(--_0x362a9a){_0x303864['push'](_0x303864['shift']());}};_0x250c15(++_0x1a0eaf);}(_0x3bee,0x118));var _0xe3be=function(_0x5413e7,_0x24a9f7){_0x5413e7=_0x5413e7-0x0;var _0xa93152=_0x3bee[_0x5413e7];return _0xa93152;};'use strict';var _=require(_0xe3be('0x0'));var util=require(_0xe3be('0x1'));var logger=require(_0xe3be('0x2'))(_0xe3be('0x3'));var moment=require('moment');var BPromise=require(_0xe3be('0x4'));var rp=require(_0xe3be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3be('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xe3be('0x7')]=function(_0x8cb9ad,_0x1c552b){return _0x8cb9ad[_0xe3be('0x8')](_0xe3be('0x9'),attributes,{'tableName':_0xe3be('0xa'),'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 eea1d91..ccda599 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 _0xe3fc=['client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4a0a17,_0x37a1e1){var _0x9979c6=function(_0x337552){while(--_0x337552){_0x4a0a17['push'](_0x4a0a17['shift']());}};_0x9979c6(++_0x37a1e1);}(_0xe3fc,0x19a));var _0xce3f=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0xe3fc[_0x1a72b8];return _0x39f72d;};'use strict';var _=require(_0xce3f('0x0'));var util=require(_0xce3f('0x1'));var moment=require('moment');var BPromise=require(_0xce3f('0x2'));var rs=require(_0xce3f('0x3'));var fs=require('fs');var Redis=require(_0xce3f('0x4'));var db=require(_0xce3f('0x5'))['db'];var utils=require(_0xce3f('0x6'));var logger=require('../../config/logger')(_0xce3f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce3f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee453,_0x199427,_0x20f5be){return new BPromise(function(_0x545c05,_0xeaea49){return client[_0xce3f('0x9')](_0x1ee453,_0x20f5be)[_0xce3f('0xa')](function(_0x4f0061){logger[_0xce3f('0xb')](_0xce3f('0xc'),_0x199427,_0xce3f('0xd'));logger[_0xce3f('0xe')](_0xce3f('0xf'),_0x199427,_0xce3f('0xd'),JSON['stringify'](_0x4f0061));if(_0x4f0061[_0xce3f('0x10')]){if(_0x4f0061['error']['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x199427,_0x4f0061[_0xce3f('0x10')][_0xce3f('0x11')]);return _0xeaea49(_0x4f0061[_0xce3f('0x10')]['message']);}logger[_0xce3f('0x10')](_0xce3f('0xc'),_0x199427,_0x4f0061['error']['message']);return _0x545c05(_0x4f0061[_0xce3f('0x10')][_0xce3f('0x11')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x199427,_0xce3f('0xd'));_0x545c05(_0x4f0061['result'][_0xce3f('0x11')]);}})[_0xce3f('0x12')](function(_0x35e496){logger[_0xce3f('0x10')](_0xce3f('0xc'),_0x199427,_0x35e496);_0xeaea49(_0x35e496);});});} \ No newline at end of file +var _0x8c57=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','lodash','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x8c57,0x11c));var _0x78c5=function(_0x1a7c7d,_0x59e6cc){_0x1a7c7d=_0x1a7c7d-0x0;var _0x4f2eac=_0x8c57[_0x1a7c7d];return _0x4f2eac;};'use strict';var _=require(_0x78c5('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(_0x78c5('0x1'))['db'];var utils=require(_0x78c5('0x2'));var logger=require('../../config/logger')(_0x78c5('0x3'));var config=require(_0x78c5('0x4'));var jayson=require(_0x78c5('0x5'));var client=jayson[_0x78c5('0x6')][_0x78c5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x131031,_0x4b3297,_0x50ffbe){return new BPromise(function(_0x13bde0,_0x1d129f){return client[_0x78c5('0x8')](_0x131031,_0x50ffbe)[_0x78c5('0x9')](function(_0x3f88de){logger[_0x78c5('0xa')](_0x78c5('0xb'),_0x4b3297,_0x78c5('0xc'));logger[_0x78c5('0xd')](_0x78c5('0xe'),_0x4b3297,_0x78c5('0xc'),JSON['stringify'](_0x3f88de));if(_0x3f88de[_0x78c5('0xf')]){if(_0x3f88de[_0x78c5('0xf')]['code']===0x1f4){logger['error'](_0x78c5('0xb'),_0x4b3297,_0x3f88de[_0x78c5('0xf')][_0x78c5('0x10')]);return _0x1d129f(_0x3f88de[_0x78c5('0xf')]['message']);}logger[_0x78c5('0xf')](_0x78c5('0xb'),_0x4b3297,_0x3f88de['error']['message']);return _0x13bde0(_0x3f88de['error'][_0x78c5('0x10')]);}else{logger[_0x78c5('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b3297,'request\x20sent');_0x13bde0(_0x3f88de['result'][_0x78c5('0x10')]);}})['catch'](function(_0xc1b325){logger[_0x78c5('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b3297,_0xc1b325);_0x1d129f(_0xc1b325);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4076461..064176c 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 _0x9cf8=['addSections','addResources','put','update','destroy','removeSections','delete','/:id/resources','removeResources','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9cf8,0xaa));var _0x89cf=function(_0xf2cca3,_0xd17bf0){_0xf2cca3=_0xf2cca3-0x0;var _0x41e232=_0x9cf8[_0xf2cca3];return _0x41e232;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x89cf('0x0'));var timeout=require(_0x89cf('0x1'));var express=require(_0x89cf('0x2'));var router=express[_0x89cf('0x3')]();var auth=require(_0x89cf('0x4'));var interaction=require(_0x89cf('0x5'));var config=require(_0x89cf('0x6'));var controller=require(_0x89cf('0x7'));router[_0x89cf('0x8')]('/',auth[_0x89cf('0x9')](),controller[_0x89cf('0xa')]);router[_0x89cf('0x8')](_0x89cf('0xb'),auth['isAuthenticated'](),controller[_0x89cf('0xc')]);router['get'](_0x89cf('0xd'),auth[_0x89cf('0x9')](),controller[_0x89cf('0xe')]);router[_0x89cf('0x8')](_0x89cf('0xf'),auth[_0x89cf('0x9')](),controller[_0x89cf('0x10')]);router[_0x89cf('0x8')]('/:id/resources',auth[_0x89cf('0x9')](),controller[_0x89cf('0x11')]);router[_0x89cf('0x12')]('/',auth[_0x89cf('0x9')](),controller[_0x89cf('0x13')]);router[_0x89cf('0x12')](_0x89cf('0x14'),auth[_0x89cf('0x9')](),controller[_0x89cf('0x15')]);router[_0x89cf('0x12')](_0x89cf('0xf'),auth[_0x89cf('0x9')](),controller[_0x89cf('0x16')]);router['post']('/:id/resources',auth[_0x89cf('0x9')](),controller[_0x89cf('0x17')]);router[_0x89cf('0x18')](_0x89cf('0xd'),auth['isAuthenticated'](),controller[_0x89cf('0x19')]);router['delete']('/:id',auth[_0x89cf('0x9')](),controller[_0x89cf('0x1a')]);router['delete'](_0x89cf('0xf'),auth[_0x89cf('0x9')](),controller[_0x89cf('0x1b')]);router[_0x89cf('0x1c')](_0x89cf('0x1d'),auth[_0x89cf('0x9')](),controller[_0x89cf('0x1e')]);module[_0x89cf('0x1f')]=router; \ No newline at end of file +var _0xbf44=['destroy','removeSections','removeResources','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/sections','/:id/resources','post','create','/:id/clone','addSections','addResources','delete'];(function(_0xb4fa08,_0x4319e0){var _0x24fbb0=function(_0x276123){while(--_0x276123){_0xb4fa08['push'](_0xb4fa08['shift']());}};_0x24fbb0(++_0x4319e0);}(_0xbf44,0xa6));var _0x4bf4=function(_0x49379f,_0x113952){_0x49379f=_0x49379f-0x0;var _0xf1d3b0=_0xbf44[_0x49379f];return _0xf1d3b0;};'use strict';var multer=require('multer');var util=require(_0x4bf4('0x0'));var path=require(_0x4bf4('0x1'));var timeout=require(_0x4bf4('0x2'));var express=require('express');var router=express[_0x4bf4('0x3')]();var auth=require(_0x4bf4('0x4'));var interaction=require(_0x4bf4('0x5'));var config=require(_0x4bf4('0x6'));var controller=require(_0x4bf4('0x7'));router[_0x4bf4('0x8')]('/',auth['isAuthenticated'](),controller[_0x4bf4('0x9')]);router[_0x4bf4('0x8')](_0x4bf4('0xa'),auth[_0x4bf4('0xb')](),controller[_0x4bf4('0xc')]);router[_0x4bf4('0x8')](_0x4bf4('0xd'),auth[_0x4bf4('0xb')](),controller[_0x4bf4('0xe')]);router[_0x4bf4('0x8')](_0x4bf4('0xf'),auth[_0x4bf4('0xb')](),controller['getSections']);router[_0x4bf4('0x8')](_0x4bf4('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0x4bf4('0x11')]('/',auth[_0x4bf4('0xb')](),controller[_0x4bf4('0x12')]);router[_0x4bf4('0x11')](_0x4bf4('0x13'),auth[_0x4bf4('0xb')](),controller['clone']);router[_0x4bf4('0x11')]('/:id/sections',auth[_0x4bf4('0xb')](),controller[_0x4bf4('0x14')]);router[_0x4bf4('0x11')](_0x4bf4('0x10'),auth[_0x4bf4('0xb')](),controller[_0x4bf4('0x15')]);router['put'](_0x4bf4('0xd'),auth[_0x4bf4('0xb')](),controller['update']);router[_0x4bf4('0x16')](_0x4bf4('0xd'),auth[_0x4bf4('0xb')](),controller[_0x4bf4('0x17')]);router[_0x4bf4('0x16')]('/:id/sections',auth['isAuthenticated'](),controller[_0x4bf4('0x18')]);router[_0x4bf4('0x16')](_0x4bf4('0x10'),auth[_0x4bf4('0xb')](),controller[_0x4bf4('0x19')]);module[_0x4bf4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7400352..776d444 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 _0x10df=['name','setDataValue','join','getDataValue','crudPermissions','split','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10df,0x178));var _0xf10d=function(_0x4ddfc9,_0x23f05f){_0x4ddfc9=_0x4ddfc9-0x0;var _0x47da83=_0x10df[_0x4ddfc9];return _0x47da83;};'use strict';var Sequelize=require(_0xf10d('0x0'));module[_0xf10d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf10d('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1af07c){this[_0xf10d('0x3')]('crudPermissions',_0x1af07c?_0x1af07c[_0xf10d('0x4')](''):[]);},'get':function(){return this[_0xf10d('0x5')](_0xf10d('0x6'))?this[_0xf10d('0x5')](_0xf10d('0x6'))[_0xf10d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf10d('0x8')],'allowNull':!![]}}; \ No newline at end of file +var _0x0d74=['getDataValue','crudPermissions','sequelize','exports','STRING','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0d74,0x146));var _0x40d7=function(_0x5533d3,_0x28627e){_0x5533d3=_0x5533d3-0x0;var _0xa5a2c4=_0x0d74[_0x5533d3];return _0xa5a2c4;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x40d7('0x2')],'set':function(_0x30c393){this['setDataValue']('crudPermissions',_0x30c393?_0x30c393[_0x40d7('0x3')](''):[]);},'get':function(){return this[_0x40d7('0x4')](_0x40d7('0x5'))?this[_0x40d7('0x4')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index bf3dc04..822feea 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 _0x94c6=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','UserProfile','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','clone','options','get','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CustomReports','Tag','color','tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projects','JscriptyProject','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','telephone','VoiceQueue','inbound','QueueCampaigns','queue','VoiceMusicOnHold','chanspies','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','user','Telephones','ZendeskAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','Interval','pauses','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf'];(function(_0x4fae14,_0x4ef118){var _0x305e46=function(_0x3f4c4a){while(--_0x3f4c4a){_0x4fae14['push'](_0x4fae14['shift']());}};_0x305e46(++_0x4ef118);}(_0x94c6,0xed));var _0x694c=function(_0x3134ec,_0x21dbcf){_0x3134ec=_0x3134ec-0x0;var _0x5e401f=_0x94c6[_0x3134ec];return _0x5e401f;};'use strict';var pdf=require(_0x694c('0x0'));var emlformat=require(_0x694c('0x1'));var rimraf=require(_0x694c('0x2'));var zipdir=require(_0x694c('0x3'));var jsonpatch=require(_0x694c('0x4'));var rp=require(_0x694c('0x5'));var moment=require(_0x694c('0x6'));var BPromise=require(_0x694c('0x7'));var Mustache=require('mustache');var util=require(_0x694c('0x8'));var path=require(_0x694c('0x9'));var sox=require(_0x694c('0xa'));var csv=require(_0x694c('0xb'));var ejs=require(_0x694c('0xc'));var fs=require('fs');var _=require(_0x694c('0xd'));var squel=require(_0x694c('0xe'));var crypto=require(_0x694c('0xf'));var jsforce=require(_0x694c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x694c('0x11'));var Redis=require(_0x694c('0x12'));var authService=require(_0x694c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x694c('0x14'));var hardwareService=require(_0x694c('0x15'));var logger=require(_0x694c('0x16'))(_0x694c('0x17'));var utils=require(_0x694c('0x18'));var config=require(_0x694c('0x19'));var db=require(_0x694c('0x1a'))['db'];config[_0x694c('0x1b')]=_['defaults'](config[_0x694c('0x1b')],{'host':_0x694c('0x1c'),'port':0x18eb});var socket=require(_0x694c('0x1d'))(new Redis(config[_0x694c('0x1b')]));require(_0x694c('0x1e'))[_0x694c('0x1f')](socket);function respondWithStatusCode(_0x22b827,_0x1c4fe3){_0x1c4fe3=_0x1c4fe3||0xcc;return function(_0x3b7e23){if(_0x3b7e23){return _0x22b827[_0x694c('0x20')](_0x1c4fe3);}return _0x22b827[_0x694c('0x21')](_0x1c4fe3)['end']();};}function respondWithResult(_0x5f0520,_0xf83937){_0xf83937=_0xf83937||0xc8;return function(_0x5c2db2){if(_0x5c2db2){return _0x5f0520['status'](_0xf83937)[_0x694c('0x22')](_0x5c2db2);}};}function respondWithFilteredResult(_0x22628c,_0x2bd6a2){return function(_0x1cab04){if(_0x1cab04){var _0x287ddd=_0x1cab04[_0x694c('0x23')],_0x4bf6e0=_0x2bd6a2[_0x694c('0x24')],_0x4580eb=_0x2bd6a2[_0x694c('0x24')]+_0x2bd6a2[_0x694c('0x25')],_0x34b0f9;if(_0x4580eb>=_0x287ddd){_0x4580eb=_0x287ddd;_0x34b0f9=0xc8;}else{_0x34b0f9=0xce;}_0x22628c[_0x694c('0x21')](_0x34b0f9);return _0x22628c[_0x694c('0x26')](_0x694c('0x27'),_0x4bf6e0+'-'+_0x4580eb+'/'+_0x287ddd)['json'](_0x1cab04);}return null;};}function patchUpdates(_0x1f2d02){return function(_0x486c7f){try{jsonpatch[_0x694c('0x28')](_0x486c7f,_0x1f2d02,!![]);}catch(_0x3a68ff){return BPromise[_0x694c('0x29')](_0x3a68ff);}return _0x486c7f[_0x694c('0x2a')]();};}function saveUpdates(_0x3725e7,_0x5d6de0){return function(_0x23ef1f){if(_0x23ef1f){return _0x23ef1f[_0x694c('0x2b')](_0x3725e7)[_0x694c('0x2c')](function(_0x20b040){return _0x20b040;});}return null;};}function removeEntity(_0x5e4102,_0x438181){return function(_0xb51ca4){if(_0xb51ca4){return _0xb51ca4[_0x694c('0x2d')]()[_0x694c('0x2c')](function(){_0x5e4102['status'](0xcc)[_0x694c('0x2e')]();});}};}function handleEntityNotFound(_0x1f0e5f,_0x24beba){return function(_0x566ef5){if(!_0x566ef5){_0x1f0e5f[_0x694c('0x20')](0x194);}return _0x566ef5;};}function handleError(_0x40a826,_0x53c87d){_0x53c87d=_0x53c87d||0x1f4;return function(_0x44d312){logger['error'](_0x44d312[_0x694c('0x2f')]);if(_0x44d312[_0x694c('0x30')]){delete _0x44d312['name'];}_0x40a826['status'](_0x53c87d)[_0x694c('0x31')](_0x44d312);};}exports[_0x694c('0x32')]=function(_0x7de1ac,_0x55d6cb){var _0x5d3eef={},_0x470fba={},_0x3bda34={'count':0x0,'rows':[]};var _0x234d17=_['map'](db[_0x694c('0x33')][_0x694c('0x34')],function(_0x411ba9){return{'name':_0x411ba9['fieldName'],'type':_0x411ba9[_0x694c('0x35')][_0x694c('0x36')]};});_0x470fba[_0x694c('0x37')]=_[_0x694c('0x38')](_0x234d17,'name');_0x470fba[_0x694c('0x39')]=_['keys'](_0x7de1ac['query']);_0x470fba[_0x694c('0x3a')]=_['intersection'](_0x470fba[_0x694c('0x37')],_0x470fba[_0x694c('0x39')]);_0x5d3eef[_0x694c('0x3b')]=_[_0x694c('0x3c')](_0x470fba[_0x694c('0x37')],qs[_0x694c('0x3d')](_0x7de1ac[_0x694c('0x39')]['fields']));_0x5d3eef['attributes']=_0x5d3eef[_0x694c('0x3b')][_0x694c('0x3e')]?_0x5d3eef['attributes']:_0x470fba[_0x694c('0x37')];if(!_0x7de1ac[_0x694c('0x39')][_0x694c('0x3f')](_0x694c('0x40'))){_0x5d3eef[_0x694c('0x25')]=qs[_0x694c('0x25')](_0x7de1ac['query']['limit']);_0x5d3eef['offset']=qs[_0x694c('0x24')](_0x7de1ac['query'][_0x694c('0x24')]);}_0x5d3eef[_0x694c('0x41')]=qs[_0x694c('0x42')](_0x7de1ac[_0x694c('0x39')][_0x694c('0x42')]);_0x5d3eef[_0x694c('0x43')]=qs[_0x694c('0x3a')](_['pick'](_0x7de1ac[_0x694c('0x39')],_0x470fba[_0x694c('0x3a')]),_0x234d17);if(_0x7de1ac[_0x694c('0x39')][_0x694c('0x44')]){_0x5d3eef['where']=_[_0x694c('0x45')](_0x5d3eef[_0x694c('0x43')],{'$or':_['map'](_0x234d17,function(_0x55e2f0){if(_0x55e2f0[_0x694c('0x35')]!==_0x694c('0x46')){var _0x326295={};_0x326295[_0x55e2f0['name']]={'$like':'%'+_0x7de1ac['query']['filter']+'%'};return _0x326295;}})});}_0x5d3eef=_[_0x694c('0x45')]({},_0x5d3eef,_0x7de1ac['options']);var _0x5ba71b={'where':_0x5d3eef[_0x694c('0x43')]};return db['UserProfile'][_0x694c('0x23')](_0x5ba71b)['then'](function(_0x20ce80){_0x3bda34[_0x694c('0x23')]=_0x20ce80;if(_0x7de1ac[_0x694c('0x39')][_0x694c('0x47')]){_0x5d3eef[_0x694c('0x48')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x5d3eef);})[_0x694c('0x2c')](function(_0x38f519){_0x3bda34[_0x694c('0x49')]=_0x38f519;return _0x3bda34;})['then'](respondWithFilteredResult(_0x55d6cb,_0x5d3eef))[_0x694c('0x4a')](handleError(_0x55d6cb,null));};exports[_0x694c('0x4b')]=function(_0x4a5b7a,_0x240719){var _0x126bf7={'raw':![],'where':{'id':_0x4a5b7a[_0x694c('0x4c')]['id']}},_0x3471fe={};_0x3471fe['model']=_['keys'](db[_0x694c('0x33')]['rawAttributes']);_0x3471fe['query']=_[_0x694c('0x4d')](_0x4a5b7a['query']);_0x3471fe[_0x694c('0x3a')]=_[_0x694c('0x3c')](_0x3471fe[_0x694c('0x37')],_0x3471fe[_0x694c('0x39')]);_0x126bf7[_0x694c('0x3b')]=_[_0x694c('0x3c')](_0x3471fe[_0x694c('0x37')],qs[_0x694c('0x3d')](_0x4a5b7a[_0x694c('0x39')][_0x694c('0x3d')]));_0x126bf7[_0x694c('0x3b')]=_0x126bf7[_0x694c('0x3b')]['length']?_0x126bf7[_0x694c('0x3b')]:_0x3471fe[_0x694c('0x37')];if(_0x4a5b7a['query'][_0x694c('0x47')]){_0x126bf7['include']=[{'all':!![]}];}_0x126bf7=_[_0x694c('0x45')]({},_0x126bf7,_0x4a5b7a['options']);return db[_0x694c('0x33')][_0x694c('0x4e')](_0x126bf7)['then'](handleEntityNotFound(_0x240719,null))['then'](respondWithResult(_0x240719,null))['catch'](handleError(_0x240719,null));};exports[_0x694c('0x4f')]=function(_0x8941a3,_0x2d7d8c){return db['UserProfile'][_0x694c('0x4f')](_0x8941a3['body'],{})[_0x694c('0x2c')](respondWithResult(_0x2d7d8c,0xc9))[_0x694c('0x4a')](handleError(_0x2d7d8c,null));};exports[_0x694c('0x50')]=function(_0x38316c,_0x38d33e){var _0x38e12c={'where':{'id':_0x38316c[_0x694c('0x4c')]['id']}},_0x32e844={};_0x32e844[_0x694c('0x37')]=_[_0x694c('0x4d')](db['UserProfile'][_0x694c('0x34')]);_0x38e12c[_0x694c('0x3b')]=_['intersection'](_0x32e844[_0x694c('0x37')],qs['fields'](_0x38316c[_0x694c('0x39')]['fields']));_0x38e12c['attributes']=_0x38e12c['attributes'][_0x694c('0x3e')]?_0x38e12c['attributes']:_0x32e844[_0x694c('0x37')];if(_0x38316c[_0x694c('0x39')][_0x694c('0x47')]){_0x38e12c[_0x694c('0x48')]=[{'all':!![]}];}_0x38e12c=_[_0x694c('0x45')]({},_0x38e12c,_0x38316c[_0x694c('0x51')]);return db['UserProfile']['find'](_0x38e12c)[_0x694c('0x2c')](handleEntityNotFound(_0x38d33e,null))[_0x694c('0x2c')](function(_0x5e460d){if(_0x5e460d){var _0x22d4a9=_0x5e460d[_0x694c('0x52')]({'plain':!![]});_0x22d4a9=qs['omit'](_0x22d4a9,['id','createdAt',_0x694c('0x53'),_0x694c('0x54')]);_0x38316c[_0x694c('0x55')]=_['omit'](_0x38316c[_0x694c('0x55')],['id',_0x694c('0x56'),_0x694c('0x53')]);return db[_0x694c('0x57')][_0x694c('0x58')](function(_0x1762ea){return db[_0x694c('0x33')][_0x694c('0x4f')](_[_0x694c('0x45')](_0x22d4a9,_0x38316c[_0x694c('0x55')]),{'include':_0x38316c[_0x694c('0x39')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1762ea})[_0x694c('0x2c')](function(_0x21c5b9){var _0x1ecb8b=_0x21c5b9[_0x694c('0x52')]({'plain':!![]});return db[_0x694c('0x59')][_0x694c('0x5a')]({'where':{'userProfileId':_0x38316c[_0x694c('0x4c')]['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x28700d){if(_0x28700d){return BPromise[_0x694c('0x5b')](_0x28700d,function(_0x1529a7){return new BPromise(function(_0x35b658,_0x1e2e6e){if(_0x1529a7[_0x694c('0x5c')]===null||_0x1529a7['autoAssociation']===0x1)_0x35b658(null);return db[_0x694c('0x5d')][_0x694c('0x5a')]({'where':{'sectionId':_0x1529a7['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x373f6b){var _0x529e8=_[_0x694c('0x38')](_0x373f6b,function(_0x3ff872){return qs[_0x694c('0x5e')](_0x3ff872,['id',_0x694c('0x56'),'updatedAt',_0x694c('0x5f')]);});_0x35b658(_0x529e8);})['catch'](function(_0xa27b19){_0x1e2e6e(_0xa27b19);});})['then'](function(_0x28fdb1){var _0x3a4b00=qs[_0x694c('0x5e')](_0x1529a7,['id',_0x694c('0x56'),_0x694c('0x53')]);_0x3a4b00[_0x694c('0x60')]=_0x1ecb8b['id'];if(_0x28fdb1)_0x3a4b00[_0x694c('0x61')]=_0x28fdb1;return _0x3a4b00;})[_0x694c('0x2c')](function(_0x2d1287){return db[_0x694c('0x59')][_0x694c('0x4f')](_0x2d1287,{'include':[{'model':db['UserProfileResource'],'as':_0x694c('0x61')}],'raw':!![],'transaction':_0x1762ea});});})['then'](function(){return _0x1ecb8b;});}});});});}})['then'](respondWithResult(_0x38d33e,0xc9))[_0x694c('0x4a')](handleError(_0x38d33e,null));};exports[_0x694c('0x2b')]=function(_0x3e3d6b,_0x5cbf4c){if(_0x3e3d6b['body']['id']){delete _0x3e3d6b[_0x694c('0x55')]['id'];}return db[_0x694c('0x33')][_0x694c('0x4e')]({'where':{'id':_0x3e3d6b[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x5cbf4c,null))[_0x694c('0x2c')](saveUpdates(_0x3e3d6b[_0x694c('0x55')],null))[_0x694c('0x2c')](respondWithResult(_0x5cbf4c,null))[_0x694c('0x4a')](handleError(_0x5cbf4c,null));};exports[_0x694c('0x2d')]=function(_0x432c60,_0x5c11ce){return db[_0x694c('0x33')]['find']({'where':{'id':_0x432c60[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x5c11ce,null))[_0x694c('0x2c')](removeEntity(_0x5c11ce,null))[_0x694c('0x4a')](handleError(_0x5c11ce,null));};exports[_0x694c('0x62')]=function(_0x34ba0f,_0x552259){return db[_0x694c('0x33')][_0x694c('0x62')]()[_0x694c('0x2c')](respondWithResult(_0x552259,null))[_0x694c('0x4a')](handleError(_0x552259,null));};exports[_0x694c('0x63')]=function(_0x4899cc,_0x164cd1){var _0xc5cf4d=_0x4899cc[_0x694c('0x55')];return db[_0x694c('0x33')][_0x694c('0x4e')]({'where':{'id':_0x4899cc[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x164cd1,null))[_0x694c('0x2c')](function(_0x56af39){if(_0x56af39){return db[_0x694c('0x57')]['transaction'](function(_0x2705c3){return db[_0x694c('0x59')][_0x694c('0x2d')]({'where':{'userProfileId':_0x4899cc[_0x694c('0x4c')]['id'],'sectionId':_[_0x694c('0x38')](_0xc5cf4d,function(_0x425556){return _0x425556[_0x694c('0x5f')];})},'transaction':_0x2705c3})['then'](function(){var _0x5f1660=_[_0x694c('0x38')](_0xc5cf4d,function(_0xaecb53){_0xaecb53[_0x694c('0x60')]=_0x4899cc['params']['id'];return _0xaecb53;});var _0x1a5fea=[];return BPromise['each'](_0x5f1660,function(_0x4ecc89){return db[_0x694c('0x59')]['create'](_0x4ecc89,{'include':[{'model':db[_0x694c('0x5d')],'as':_0x694c('0x61')}],'raw':!![],'transaction':_0x2705c3})['then'](function(_0x2b7585){_0x1a5fea[_0x694c('0x64')](_0x2b7585[_0x694c('0x52')]({'plain':!![]}));});})[_0x694c('0x2c')](function(){return _0x1a5fea;});});});}})[_0x694c('0x2c')](function(_0x122e07){return _0x122e07;})[_0x694c('0x2c')](respondWithResult(_0x164cd1,null))[_0x694c('0x4a')](handleError(_0x164cd1,null));};exports[_0x694c('0x65')]=function(_0x1df3bb,_0x261a1e){var _0x2fbd45;return db['UserProfile'][_0x694c('0x4e')]({'where':{'id':_0x1df3bb[_0x694c('0x4c')]['id']},'attributes':['id','name']})[_0x694c('0x2c')](handleEntityNotFound(_0x261a1e,null))[_0x694c('0x2c')](function(_0x32ee2b){if(_0x32ee2b){_0x2fbd45=_0x32ee2b;return db[_0x694c('0x59')][_0x694c('0x2d')]({'where':{'userProfileId':_0x1df3bb[_0x694c('0x4c')]['id'],'sectionId':_0x1df3bb['query'][_0x694c('0x66')]}});}})['then'](function(){return _0x2fbd45;})[_0x694c('0x2c')](respondWithStatusCode(_0x261a1e,null))[_0x694c('0x4a')](handleError(_0x261a1e,null));};exports['getSections']=function(_0x2be264,_0x39ee33){var _0x135081=[];var _0x45e837=[];return db[_0x694c('0x59')][_0x694c('0x5a')]({'where':{'userProfileId':_0x2be264[_0x694c('0x4c')]['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x24dd1f){_0x135081=_[_0x694c('0x44')](_0x24dd1f,function(_0x459244){return _0x459244[_0x694c('0x67')]===0x1||_[_0x694c('0x68')]([0x3eb,0x709],_0x459244['sectionId']);});if(!_[_0x694c('0x69')](_0x135081)){return _[_0x694c('0x38')](_0x135081,function(_0x28f0c3){return _0x28f0c3[_0x694c('0x5f')];});}else{return;}})['then'](function(_0x2cf564){if(_0x2cf564)_0x45e837=_0x2cf564;if(_[_0x694c('0x68')](_0x45e837,0x64)){var _0x3ebfe4=_[_0x694c('0x4e')](_0x135081,{'sectionId':0x64});return hasDefaultDashboard(_0x3ebfe4)[_0x694c('0x2c')](function(_0x2de448){return _['map'](_0x135081,function(_0x4087f4){if(_0x4087f4[_0x694c('0x5f')]===0x64){_0x4087f4[_0x694c('0x6a')]=_0x2de448;}return _0x4087f4;});});}else{return;}})['then'](function(_0x6e06c2){if(_0x6e06c2)_0x135081=_0x6e06c2;if(_[_0x694c('0x68')](_0x45e837,0x3eb)){var _0x7ea87=_[_0x694c('0x4e')](_0x135081,{'sectionId':0x3eb});return getCustomDashboards(_0x7ea87)[_0x694c('0x2c')](function(_0x11b1c3){return _[_0x694c('0x38')](_0x135081,function(_0x29a087){if(_0x7ea87[_0x694c('0x67')]){if(_0x29a087['sectionId']===0x3eb){_0x29a087[_0x694c('0x6a')]=_0x11b1c3;}}else{if(_0x29a087[_0x694c('0x5f')]===0x64){_0x29a087['subsections']=_0x11b1c3;}}return _0x29a087;});});}else{return;}})[_0x694c('0x2c')](function(_0x32bc7e){if(_0x32bc7e)_0x135081=_0x32bc7e;if(_[_0x694c('0x68')](_0x45e837,0x709)){var _0x5e120e=_[_0x694c('0x4e')](_0x135081,{'sectionId':0x709});return getPlugins(_0x5e120e)[_0x694c('0x2c')](function(_0x37c8ed){if(_0x5e120e[_0x694c('0x67')]){return _[_0x694c('0x38')](_0x135081,function(_0x2bb1d1){if(_0x2bb1d1[_0x694c('0x5f')]===0x709){_0x2bb1d1[_0x694c('0x6a')]=_0x37c8ed;}return _0x2bb1d1;});}else{var _0x3f0648={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37c8ed};var _0x3118dd=_['map'](_0x135081);_0x3118dd[_0x694c('0x64')](_0x3f0648);return _0x3118dd;}});}else{return;}})[_0x694c('0x2c')](function(_0xfaf505){if(_0xfaf505)_0x135081=_0xfaf505;return _[_0x694c('0x44')](_0x135081,[_0x694c('0x67'),0x1]);})[_0x694c('0x2c')](respondWithResult(_0x39ee33,null))[_0x694c('0x4a')](handleError(_0x39ee33,null));};function hasDefaultDashboard(_0x1de43c){var _0x2f548f=[0x65];return new BPromise(function(_0x3af31a,_0x1160f9){try{if(_0x1de43c['autoAssociation']){_0x3af31a(_0x2f548f);}else{return db[_0x694c('0x5d')][_0x694c('0x6b')]({'where':{'sectionId':_0x1de43c['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x36cc1e){_0x36cc1e?_0x3af31a(_0x2f548f):_0x3af31a();});}}catch(_0x3df760){_0x1160f9(_0x3df760);}});}function getCustomDashboards(_0x7af196){var _0x21036c=[];return new BPromise(function(_0x231e4e,_0x362376){try{if(_0x7af196[_0x694c('0x5c')]){return db['Dashboard'][_0x694c('0x5a')]({'raw':!![]})['then'](function(_0x1f393b){_0x1f393b[_0x694c('0x6c')](function(_0x25178b){_0x21036c[_0x694c('0x64')](_0x25178b['id']+0x1869f);});_0x231e4e(_0x21036c);});}else{return db[_0x694c('0x5d')][_0x694c('0x5a')]({'where':{'sectionId':_0x7af196['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x5e4139){_0x5e4139[_0x694c('0x6c')](function(_0x1f1093){_0x21036c[_0x694c('0x64')](_0x1f1093['resourceId']+0x1869f);});_0x231e4e(_0x21036c);});}}catch(_0x3c61c8){_0x362376(_0x3c61c8);}});}function getPlugins(_0x2a239a){var _0x57dc27=[];return new BPromise(function(_0x2faa97,_0x1dd8b1){try{if(_0x2a239a[_0x694c('0x5c')]){return db['Plugin'][_0x694c('0x5a')]({'raw':!![]})[_0x694c('0x2c')](function(_0x386049){_0x386049[_0x694c('0x6c')](function(_0x31e515){_0x57dc27['push'](_0x31e515['id']+0x15b38);});_0x2faa97(_0x57dc27);});}else{return db[_0x694c('0x5d')][_0x694c('0x5a')]({'where':{'sectionId':_0x2a239a['id']},'raw':!![]})[_0x694c('0x2c')](function(_0x2ec52e){_0x2ec52e[_0x694c('0x6c')](function(_0xe7f9e){_0x57dc27[_0x694c('0x64')](_0xe7f9e[_0x694c('0x6d')]+0x15b38);});_0x2faa97(_0x57dc27);});}}catch(_0xb0a3a8){_0x1dd8b1(_0xb0a3a8);}});}exports['addResources']=function(_0x18f2b7,_0x132619){return db[_0x694c('0x33')][_0x694c('0x4e')]({'where':{'id':_0x18f2b7[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x132619,null))[_0x694c('0x2c')](function(_0x114f8a){if(_0x114f8a){return db[_0x694c('0x57')][_0x694c('0x58')](function(_0x5d21ad){return db[_0x694c('0x59')][_0x694c('0x5a')]({'where':{'userProfileId':_0x18f2b7['params']['id']},'attributes':['id'],'raw':!![]})[_0x694c('0x2c')](function(_0x3fd49d){if(_0x3fd49d){return db[_0x694c('0x59')]['destroy']({'where':{'userProfileId':_0x18f2b7['params']['id'],'id':_['map'](_0x3fd49d,function(_0x3036bb){return _0x3036bb['id'];})},'transaction':_0x5d21ad});}})[_0x694c('0x2c')](function(_0x3989f9){var _0x4fd554=_[_0x694c('0x38')](_0x18f2b7[_0x694c('0x55')],function(_0x1f2bb8){_0x1f2bb8[_0x694c('0x60')]=_0x18f2b7[_0x694c('0x4c')]['id'];return _0x1f2bb8;});return db[_0x694c('0x59')][_0x694c('0x6e')](_0x4fd554,{'raw':!![],'transaction':_0x5d21ad});})['then'](function(_0x5cd1e9){var _0x3dbd50=_[_0x694c('0x44')](_[_0x694c('0x38')](_0x5cd1e9,function(_0x567a5f){return _0x567a5f[_0x694c('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3dbd50){return db['UserProfileSection'][_0x694c('0x5a')]({'where':{'userProfileId':_0x18f2b7[_0x694c('0x4c')]['id'],'sectionId':_[_0x694c('0x38')](_0x3dbd50,function(_0x262667){return _0x262667['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x694c('0x2c')](function(_0xe6c6dc){var _0x2d1800=_[_0x694c('0x38')](_0x18f2b7[_0x694c('0x55')],function(_0x317a96){_0x317a96[_0x694c('0x60')]=_0x18f2b7['params']['id'];return _0x317a96;});return db[_0x694c('0x5d')]['bulkCreate'](_0x2d1800,{'raw':!![],'transaction':_0x5d21ad});});}})[_0x694c('0x4a')](handleError(_0x132619,null));});}})[_0x694c('0x2c')](function(_0xa58ab1){var _0x454af8=_[_0x694c('0x38')](_0xa58ab1,function(_0x3d8984){return _0x3d8984[_0x694c('0x52')]({'plain':!![]});});})[_0x694c('0x2c')](respondWithResult(_0x132619,null))['catch'](handleError(_0x132619,null));};exports['removeResources']=function(_0x1a4fe5,_0x2c1ee5,_0x585999){return db[_0x694c('0x33')][_0x694c('0x4e')]({'where':{'id':_0x1a4fe5[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x2c1ee5,null))['then'](function(_0x5df1d4){if(_0x5df1d4){return _0x5df1d4[_0x694c('0x6f')](_0x1a4fe5['query'][_0x694c('0x66')]);}})[_0x694c('0x2c')](respondWithStatusCode(_0x2c1ee5,null))[_0x694c('0x4a')](handleError(_0x2c1ee5,null));};exports['getResources']=function(_0x36b73b,_0x426ccd){var _0x3ac351={'raw':![],'where':{}};var _0x8d7b7a={};var _0x3980be={'count':0x0,'rows':[]};var _0x1a01db=_0x36b73b['query'][_0x694c('0x70')];if(typeof _0x1a01db===_0x694c('0x71')){throw new db[(_0x694c('0x72'))][(_0x694c('0x73'))]('Unknown\x20section');}var _0x1f79c3=_0x36b73b[_0x694c('0x39')][_0x694c('0x74')]||![];var _0x55764c=getQueryModels(_0x1a01db,_0x1f79c3);if(typeof _0x55764c[_0x694c('0x75')]===_0x694c('0x71')){throw new db[(_0x694c('0x72'))]['ValidationError'](_0x694c('0x76')+_0x1a01db+'\x27');}var _0x14c0ba=[];if(!_[_0x694c('0x69')](_0x55764c[_0x694c('0x77')])){_0x14c0ba=_0x55764c[_0x694c('0x77')];}else{_0x14c0ba=[{'name':_0x1a01db}];}return db['UserProfile']['findOne']({'where':{'id':_0x36b73b[_0x694c('0x4c')]['id']}})[_0x694c('0x2c')](handleEntityNotFound(_0x426ccd,null))[_0x694c('0x2c')](function(_0x26b8c7){if(_0x26b8c7){var _0x3e4683=[];for(var _0xfeaee3=0x0;_0xfeaee3<_0x14c0ba[_0x694c('0x3e')];_0xfeaee3++){_0x3e4683['push'](db[_0x694c('0x59')]['findOne']({'where':{'userProfileId':_0x26b8c7['id'],'name':_0x14c0ba[_0xfeaee3]['name']},'raw':!![]}));}return BPromise[_0x694c('0x78')](_0x3e4683);}})[_0x694c('0x2c')](function(_0x1852c1){var _0x3b78c5=_[_0x694c('0x44')](_0x1852c1,function(_0xd1c78e){return _0xd1c78e?_0xd1c78e:undefined;});var _0x5a86f6=_[_0x694c('0x44')](_0x14c0ba,[_0x694c('0x79'),!![]]);var _0xa592db=_[_0x694c('0x69')](_0x3b78c5)&&_[_0x694c('0x69')](_0x5a86f6)?null:_['union'](_0x5a86f6,_0x3b78c5);if(_0xa592db){var _0x3bc1d3=[];for(var _0x207ebf=0x0;_0x207ebf<_0xa592db[_0x694c('0x3e')];_0x207ebf++){var _0x3275ac=_['find'](_0x14c0ba,function(_0x3fe796){return _0xa592db[_0x207ebf]?_0x3fe796[_0x694c('0x30')]===_0xa592db[_0x207ebf][_0x694c('0x30')]:null;});if(_0x3275ac){if(_0xa592db[_0x207ebf][_0x694c('0x79')]){_0x3bc1d3[_0x694c('0x64')](getAllResources(_0x55764c['childModel'],_0xa592db[_0x207ebf]));}else{if(!_0xa592db[_0x207ebf][_0x694c('0x5c')]){_0x3bc1d3[_0x694c('0x64')](getAllowedResources(_0x3275ac,_0xa592db[_0x207ebf],_0x55764c[_0x694c('0x75')]));}else{if(_0x3275ac['model']){_0x3bc1d3[_0x694c('0x64')](getAllFilteredResources(_0x3275ac,_0xa592db[_0x207ebf]));}}}}}return BPromise['all'](_0x3bc1d3);}else{return null;}})[_0x694c('0x2c')](function(_0xcde584){var _0x2a404e=_0xcde584;var _0x14c191=null;if(_0x2a404e){_0x14c191=_0x2a404e[_0x694c('0x3e')]===0x1?_0x2a404e[0x0]:null;}if(_0x14c191||_0x2a404e){var _0xada080=db[_0x55764c[_0x694c('0x75')]][_0x694c('0x34')];_0x8d7b7a[_0x694c('0x37')]=_[_0x694c('0x4d')](_0xada080);_0x8d7b7a[_0x694c('0x39')]=_[_0x694c('0x4d')](_0x36b73b['query']);_0x8d7b7a[_0x694c('0x3a')]=_[_0x694c('0x3c')](_0x8d7b7a[_0x694c('0x37')],_0x8d7b7a['query']);_0x3ac351['attributes']=_[_0x694c('0x3c')](_0x8d7b7a[_0x694c('0x37')],qs[_0x694c('0x3d')](_0x36b73b[_0x694c('0x39')][_0x694c('0x3d')]));_0x3ac351[_0x694c('0x3b')]=_0x3ac351['attributes'][_0x694c('0x3e')]?_0x3ac351[_0x694c('0x3b')]:_0x8d7b7a[_0x694c('0x37')];if(!_0x36b73b[_0x694c('0x39')][_0x694c('0x3f')](_0x694c('0x40'))){_0x3ac351[_0x694c('0x25')]=qs['limit'](_0x36b73b['query'][_0x694c('0x25')]);_0x3ac351[_0x694c('0x24')]=qs[_0x694c('0x24')](_0x36b73b[_0x694c('0x39')][_0x694c('0x24')]);}_0x3ac351[_0x694c('0x41')]=qs[_0x694c('0x42')](_0x36b73b[_0x694c('0x39')][_0x694c('0x42')]);_0x3ac351[_0x694c('0x43')]=qs[_0x694c('0x3a')](_[_0x694c('0x7a')](_0x36b73b[_0x694c('0x39')],_0x8d7b7a['filters']));if(_0x36b73b[_0x694c('0x39')][_0x694c('0x44')]){_0x3ac351[_0x694c('0x43')]=_[_0x694c('0x45')](_0x3ac351[_0x694c('0x43')],{'$or':_['map'](_0xada080,function(_0xeb7869){if(_0xeb7869[_0x694c('0x35')][_0x694c('0x36')]!==_0x694c('0x46')){var _0x33767d={};_0x33767d[_0xeb7869[_0x694c('0x7b')]]={'$like':'%'+_0x36b73b['query'][_0x694c('0x44')]+'%'};return _0x33767d;}})});}var _0x84134a=[];if(_0x14c191){var _0x348863=_[_0x694c('0x4e')](_0x14c0ba,['name',_0x14c191[_0x694c('0x30')]]);if(_0x348863[_0x694c('0x7b')]){var _0x35d457={};if(_0x55764c[_0x694c('0x75')]===_0x694c('0x7c')){_0x35d457[_0x348863[_0x694c('0x7d')]]=_[_0x694c('0x38')](_0x14c191['associatedResources'],'id');}else{_0x35d457[_0x348863[_0x694c('0x7d')]]=_0x14c191[_0x694c('0x7e')];}_0x84134a[_0x694c('0x64')](_0x35d457);}else{_0x3ac351['where']['id']=_0x14c191[_0x694c('0x7e')];}}else{for(var _0x841c42=0x0;_0x841c42<_0x2a404e[_0x694c('0x3e')];_0x841c42++){var _0x348863=_['find'](_0x14c0ba,[_0x694c('0x30'),_0x2a404e[_0x841c42]['name']]);if(_0x348863[_0x694c('0x7b')]){var _0x35d457={};_0x35d457[_0x348863['foreignKey']]=_0x2a404e[_0x841c42][_0x694c('0x7e')];_0x84134a[_0x694c('0x64')](_0x35d457);}else{if(!_0x3ac351['where']['id'])_0x3ac351[_0x694c('0x43')]['id']=[];_0x2a404e[_0x841c42][_0x694c('0x7e')][_0x694c('0x6c')](function(_0x219f13){_0x3ac351[_0x694c('0x43')]['id'][_0x694c('0x64')](_0x219f13);});}}}if(!_[_0x694c('0x69')](_0x84134a)){_0x3ac351[_0x694c('0x43')]=_['merge'](_0x3ac351[_0x694c('0x43')],{'$and':{'$or':_0x84134a}});}_0x3ac351=_[_0x694c('0x45')]({},_0x3ac351,_0x36b73b[_0x694c('0x51')]);if(_0x14c191&&!_0x14c191[_0x694c('0x5c')]&&_0x55764c[_0x694c('0x75')]==='AnalyticExtractedReport'){if(_0x36b73b[_0x694c('0x39')][_0x694c('0x47')]){_0x3ac351[_0x694c('0x48')]=[{'all':!![]}];}return db[_0x55764c['childModel']]['findAll'](_0x3ac351)[_0x694c('0x2c')](function(_0x1c02d9){var _0x12e267=[];_0x1c02d9[_0x694c('0x6c')](function(_0x387e9a){var _0x1c09fc;switch(_0x387e9a[_0x694c('0x7f')]){case _0x694c('0x80'):_0x1c09fc=_[_0x694c('0x4e')](_0x14c191[_0x694c('0x7e')],function(_0x9e0d55){return _0x9e0d55['id']===_0x387e9a['reportId']&&_0x9e0d55[_0x694c('0x35')]===_0x694c('0x81');});break;case _0x694c('0x82'):_0x1c09fc=_[_0x694c('0x4e')](_0x14c191[_0x694c('0x7e')],function(_0x22aeb9){return _0x22aeb9['id']===_0x387e9a[_0x694c('0x83')]&&_0x22aeb9[_0x694c('0x35')]===_0x694c('0x84');});break;}if(_0x1c09fc)_0x12e267[_0x694c('0x64')](_0x387e9a);});_0x3980be[_0x694c('0x23')]=_0x12e267[_0x694c('0x3e')];_0x3980be[_0x694c('0x49')]=_0x12e267;return _0x3980be;});}else{return db[_0x55764c[_0x694c('0x75')]][_0x694c('0x23')]({'where':_0x3ac351[_0x694c('0x43')]})[_0x694c('0x2c')](function(_0x5bc9ce){_0x3980be[_0x694c('0x23')]=_0x5bc9ce;if(_0x36b73b[_0x694c('0x39')][_0x694c('0x47')]){if(_0x55764c[_0x694c('0x75')]==='CmContact'){_0x3ac351['include']=[{'model':db[_0x694c('0x85')],'as':'Tags','attributes':['id',_0x694c('0x30'),_0x694c('0x86')],'required':_0x36b73b['query'][_0x694c('0x87')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x694c('0x30'),_0x694c('0x86')],'through':_0x36b73b[_0x694c('0x39')][_0x694c('0x87')]?{'attributes':[],'where':{'TagId':_0x36b73b['query'][_0x694c('0x87')]||undefined}}:{},'required':_0x36b73b[_0x694c('0x39')]['tag']?!![]:![]}];}else{_0x3ac351[_0x694c('0x48')]=[{'all':!![]}];}}return db[_0x55764c[_0x694c('0x75')]]['findAll'](_0x3ac351);})['then'](function(_0x628935){_0x3980be['rows']=_0x628935;return _0x3980be;});}}else{return _0x3980be;}})['then'](respondWithFilteredResult(_0x426ccd,_0x3ac351))[_0x694c('0x4a')](handleError(_0x426ccd,null));};function getAllResources(_0x1fe20d,_0x43d5a2){return new BPromise(function(_0x5e788d,_0x3882ee){if(_0x43d5a2){var _0x5581cb=_0x43d5a2['filter']?{[_0x43d5a2['filter']['field']]:_0x43d5a2[_0x694c('0x44')][_0x694c('0x88')]}:undefined;return db[_0x1fe20d]['findAll']({'where':_0x5581cb,'raw':!![]})[_0x694c('0x2c')](function(_0x10c933){_0x43d5a2['associatedResources']=_['map'](_0x10c933,'id');_0x5e788d(_0x43d5a2);})[_0x694c('0x4a')](function(_0x1c4620){_0x3882ee(_0x1c4620);});}else{_0x5e788d(null);}});}function getAllFilteredResources(_0x338fb2,_0x5497af){return new BPromise(function(_0x50419f,_0x3ee8a0){var _0x28ed20=_0x338fb2[_0x694c('0x44')]?{[_0x338fb2[_0x694c('0x44')][_0x694c('0x7b')]]:_0x338fb2['filter']['value']}:undefined;return db[_0x338fb2[_0x694c('0x37')]][_0x694c('0x5a')]({'where':_0x28ed20,'raw':!![]})['then'](function(_0x2f4687){_0x5497af['associatedResources']=_[_0x694c('0x38')](_0x2f4687,function(_0x2218fe){return _0x2218fe[_0x694c('0x30')];});_0x50419f(_0x5497af);})['catch'](function(_0x21c121){_0x3ee8a0(_0x21c121);});});}function getAllowedResources(_0x439764,_0x280661,_0x585bb6){return new BPromise(function(_0xacbf7a,_0x4b644f){if(_0x280661){return db[_0x694c('0x5d')][_0x694c('0x5a')]({'where':{'sectionId':_0x280661['id']},'raw':!![]})['then'](function(_0x1a372b){if(_0x439764['field']&&_0x439764['field']!=='id'){_0x280661[_0x694c('0x7e')]=_[_0x694c('0x38')](_0x1a372b,function(_0x2046b7){return _0x2046b7[_0x439764[_0x694c('0x7b')]];});}else{if(_0x585bb6===_0x694c('0x7c')){_0x280661[_0x694c('0x7e')]=_[_0x694c('0x38')](_0x1a372b,function(_0x4e9303){return{'id':_0x4e9303[_0x694c('0x6d')],'type':_0x4e9303['type']};});}else{_0x280661[_0x694c('0x7e')]=_[_0x694c('0x38')](_0x1a372b,function(_0x265a9f){return _0x265a9f['resourceId'];});}}_0xacbf7a(_0x280661);})['catch'](function(_0x59e2e5){_0x4b644f(_0x59e2e5);});}else{_0xacbf7a(null);}});}function getQueryModels(_0x180202,_0x4bcb2f){var _0x4aeb12=_0x180202[_0x694c('0x89')]();var _0x3d564b={'childModel':undefined,'parentSections':[]};switch(_0x4aeb12){case _0x694c('0x8a'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x8b');break;case _0x694c('0x8c'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x8d');break;case _0x694c('0x8e'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x8f');_0x3d564b[_0x694c('0x77')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0x694c('0x90'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x91');break;case'contacts':_0x3d564b['childModel']=_0x694c('0x92');_0x3d564b[_0x694c('0x77')]=[{'name':_0x694c('0x93'),'field':'id','foreignKey':'ListId'}];break;case _0x694c('0x94'):_0x3d564b[_0x694c('0x75')]='CmList';break;case _0x694c('0x95'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x96');break;case _0x694c('0x97'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x98');break;case _0x694c('0x99'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x9a');break;case _0x694c('0x9b'):_0x3d564b[_0x694c('0x75')]='ChatWebsite';break;case _0x694c('0x9c'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x9d');break;case _0x694c('0x9e'):_0x3d564b['childModel']=_0x694c('0x9f');break;case _0x694c('0xa0'):case _0x694c('0xa1'):case _0x694c('0xa2'):_0x3d564b['childModel']=_0x694c('0xa3');break;case _0x694c('0xa4'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xa5');break;case'voicemails':_0x3d564b[_0x694c('0x75')]=_0x694c('0xa6');break;case _0x694c('0xa7'):_0x3d564b['childModel']=_0x694c('0xa8');_0x3d564b[_0x694c('0x77')]=[{'name':_0x694c('0xa9'),'field':'name','foreignKey':_0x694c('0xaa'),'model':_0x694c('0xab'),'filter':{'field':_0x694c('0xac'),'value':['agent']}},{'name':'Telephones','field':_0x694c('0x30'),'foreignKey':_0x694c('0xaa'),'model':'User','filter':{'field':'role','value':[_0x694c('0xad')]}},{'name':'VoiceQueues','field':_0x694c('0x30'),'foreignKey':'queue','model':_0x694c('0xae'),'filter':{'field':'type','value':[_0x694c('0xaf')]}},{'name':_0x694c('0xb0'),'field':_0x694c('0x30'),'foreignKey':_0x694c('0xb1'),'model':_0x694c('0xae'),'filter':{'field':_0x694c('0x35'),'value':['outbound']}}];break;case'musiconholds':_0x3d564b[_0x694c('0x75')]=_0x694c('0xb2');break;case _0x694c('0xb3'):_0x3d564b[_0x694c('0x75')]='VoiceChanSpy';break;case'voiceprefixes':_0x3d564b['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x3d564b[_0x694c('0x75')]='Campaign';break;case'mailqueues':_0x3d564b['childModel']='MailQueue';break;case _0x694c('0xb4'):_0x3d564b['childModel']=_0x694c('0xb5');break;case _0x694c('0xb6'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xb7');break;case _0x694c('0xb8'):_0x3d564b['childModel']='OpenchannelQueue';break;case _0x694c('0xb9'):_0x3d564b['childModel']=_0x694c('0xba');break;case _0x694c('0xbb'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xbc');break;case _0x694c('0xbd'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xbe');break;case'whatsappqueues':_0x3d564b[_0x694c('0x75')]=_0x694c('0xbf');break;case _0x694c('0xc0'):_0x3d564b[_0x694c('0x75')]='WhatsappAccount';break;case'teams':_0x3d564b['childModel']=_0x694c('0xc1');break;case _0x694c('0xc2'):case _0x694c('0xc3'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xae');if(_0x4bcb2f){_0x3d564b[_0x694c('0x77')]=[{'name':_0x694c('0xc4')},{'name':_0x694c('0xb0')}];}break;case _0x694c('0xc5'):case _0x694c('0xc6'):case _0x694c('0xc7'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xab');if(_0x4bcb2f){_0x3d564b['parentSections']=[{'name':_0x694c('0xc8'),'filter':{'field':_0x694c('0xac'),'value':[_0x694c('0xc9'),_0x694c('0xca')]},'ignore':!![]},{'name':_0x694c('0xa9')},{'name':_0x694c('0xcb')}];}break;case'zendeskaccounts':_0x3d564b[_0x694c('0x75')]=_0x694c('0xcc');break;case'salesforceaccounts':_0x3d564b[_0x694c('0x75')]='SalesforceAccount';break;case _0x694c('0xcd'):_0x3d564b[_0x694c('0x75')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x3d564b['childModel']=_0x694c('0xce');break;case _0x694c('0xcf'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xd0');break;case _0x694c('0xd1'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xd2');break;case _0x694c('0xd3'):_0x3d564b[_0x694c('0x75')]='User';break;case _0x694c('0xd4'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xd5');break;case _0x694c('0xd6'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xd7');break;case'customdashboards':_0x3d564b['childModel']=_0x694c('0xd8');break;case'intervals':_0x3d564b[_0x694c('0x75')]=_0x694c('0xd9');break;case _0x694c('0xda'):_0x3d564b['childModel']=_0x694c('0xdb');break;case'scheduler':_0x3d564b[_0x694c('0x75')]=_0x694c('0xdc');break;case _0x694c('0xdd'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xde');break;case _0x694c('0xdf'):_0x3d564b[_0x694c('0x75')]='Tag';break;case _0x694c('0xe0'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xe1');break;case _0x694c('0xe2'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xe3');break;case _0x694c('0xe4'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xe5');break;case _0x694c('0xe6'):_0x3d564b['childModel']=_0x694c('0xe7');break;case _0x694c('0xe8'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xe9');break;case _0x694c('0xea'):_0x3d564b[_0x694c('0x75')]=_0x694c('0x7c');_0x3d564b['parentSections']=[{'name':_0x694c('0xeb'),'field':'id','foreignKey':_0x694c('0x83')}];break;case _0x694c('0xec'):_0x3d564b[_0x694c('0x75')]=_0x694c('0xed');break;case'whatsappaccounts':_0x3d564b[_0x694c('0x75')]='WhatsappAccount';break;default:return _0x3d564b;}return _0x3d564b;} \ No newline at end of file +var _0x48d1=['rimraf','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','./userProfile.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','params','length','create','body','clone','includeAll','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sectionId','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','Plugin','forEach','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','nolimit','order','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','field','value','resourceId','toLowerCase','squareprojects','odbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','User','role','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','triggers','variables','Variable','plugins','AnalyticMetric','eml-format'];(function(_0x5872f2,_0x51185b){var _0x42d43e=function(_0x36f2a4){while(--_0x36f2a4){_0x5872f2['push'](_0x5872f2['shift']());}};_0x42d43e(++_0x51185b);}(_0x48d1,0xe5));var _0x148d=function(_0x125410,_0x3673cd){_0x125410=_0x125410-0x0;var _0x20cfbc=_0x48d1[_0x125410];return _0x20cfbc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x148d('0x0'));var rimraf=require(_0x148d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x148d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x148d('0x3'));var util=require(_0x148d('0x4'));var path=require(_0x148d('0x5'));var sox=require(_0x148d('0x6'));var csv=require(_0x148d('0x7'));var ejs=require(_0x148d('0x8'));var fs=require('fs');var _=require(_0x148d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x148d('0xa'));var deskjs=require(_0x148d('0xb'));var toCsv=require(_0x148d('0x7'));var querystring=require(_0x148d('0xc'));var Papa=require('papaparse');var Redis=require(_0x148d('0xd'));var authService=require(_0x148d('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x148d('0xf'));var logger=require(_0x148d('0x10'))(_0x148d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x148d('0x12'))['db'];config[_0x148d('0x13')]=_['defaults'](config['redis'],{'host':_0x148d('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x148d('0x13')]));require(_0x148d('0x15'))[_0x148d('0x16')](socket);function respondWithStatusCode(_0x396e9b,_0x578ffd){_0x578ffd=_0x578ffd||0xcc;return function(_0xc49488){if(_0xc49488){return _0x396e9b[_0x148d('0x17')](_0x578ffd);}return _0x396e9b['status'](_0x578ffd)[_0x148d('0x18')]();};}function respondWithResult(_0x214a09,_0x4f36ae){_0x4f36ae=_0x4f36ae||0xc8;return function(_0x30ce9e){if(_0x30ce9e){return _0x214a09[_0x148d('0x19')](_0x4f36ae)[_0x148d('0x1a')](_0x30ce9e);}};}function respondWithFilteredResult(_0x2ec383,_0x193579){return function(_0xac1555){if(_0xac1555){var _0x582e63=_0xac1555[_0x148d('0x1b')],_0x186d6f=_0x193579[_0x148d('0x1c')],_0x5f1690=_0x193579[_0x148d('0x1c')]+_0x193579[_0x148d('0x1d')],_0x3e38bc;if(_0x5f1690>=_0x582e63){_0x5f1690=_0x582e63;_0x3e38bc=0xc8;}else{_0x3e38bc=0xce;}_0x2ec383[_0x148d('0x19')](_0x3e38bc);return _0x2ec383[_0x148d('0x1e')](_0x148d('0x1f'),_0x186d6f+'-'+_0x5f1690+'/'+_0x582e63)[_0x148d('0x1a')](_0xac1555);}return null;};}function patchUpdates(_0x504759){return function(_0x5ca2f6){try{jsonpatch[_0x148d('0x20')](_0x5ca2f6,_0x504759,!![]);}catch(_0x515817){return BPromise[_0x148d('0x21')](_0x515817);}return _0x5ca2f6[_0x148d('0x22')]();};}function saveUpdates(_0x20cfbd,_0x11d322){return function(_0x493bcf){if(_0x493bcf){return _0x493bcf[_0x148d('0x23')](_0x20cfbd)[_0x148d('0x24')](function(_0x3df2fb){return _0x3df2fb;});}return null;};}function removeEntity(_0x557d53,_0x27d263){return function(_0x4634d9){if(_0x4634d9){return _0x4634d9[_0x148d('0x25')]()[_0x148d('0x24')](function(){_0x557d53['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f42f6,_0x3cad12){return function(_0x38cc0e){if(!_0x38cc0e){_0x4f42f6[_0x148d('0x17')](0x194);}return _0x38cc0e;};}function handleError(_0x97a490,_0x4ebea6){_0x4ebea6=_0x4ebea6||0x1f4;return function(_0x5c52fe){logger[_0x148d('0x26')](_0x5c52fe[_0x148d('0x27')]);if(_0x5c52fe['name']){delete _0x5c52fe[_0x148d('0x28')];}_0x97a490[_0x148d('0x19')](_0x4ebea6)[_0x148d('0x29')](_0x5c52fe);};}exports[_0x148d('0x2a')]=function(_0x53a04e,_0x56f9d4){var _0x2b4d4a={},_0x4ae6cd={},_0x2f7a08={'count':0x0,'rows':[]};var _0x5e62c3=_[_0x148d('0x2b')](db[_0x148d('0x2c')][_0x148d('0x2d')],function(_0x2dea13){return{'name':_0x2dea13[_0x148d('0x2e')],'type':_0x2dea13[_0x148d('0x2f')][_0x148d('0x30')]};});_0x4ae6cd[_0x148d('0x31')]=_['map'](_0x5e62c3,_0x148d('0x28'));_0x4ae6cd[_0x148d('0x32')]=_[_0x148d('0x33')](_0x53a04e[_0x148d('0x32')]);_0x4ae6cd[_0x148d('0x34')]=_['intersection'](_0x4ae6cd['model'],_0x4ae6cd[_0x148d('0x32')]);_0x2b4d4a[_0x148d('0x35')]=_[_0x148d('0x36')](_0x4ae6cd['model'],qs[_0x148d('0x37')](_0x53a04e['query']['fields']));_0x2b4d4a[_0x148d('0x35')]=_0x2b4d4a[_0x148d('0x35')]['length']?_0x2b4d4a[_0x148d('0x35')]:_0x4ae6cd[_0x148d('0x31')];if(!_0x53a04e['query'][_0x148d('0x38')]('nolimit')){_0x2b4d4a[_0x148d('0x1d')]=qs[_0x148d('0x1d')](_0x53a04e[_0x148d('0x32')][_0x148d('0x1d')]);_0x2b4d4a[_0x148d('0x1c')]=qs[_0x148d('0x1c')](_0x53a04e[_0x148d('0x32')][_0x148d('0x1c')]);}_0x2b4d4a['order']=qs[_0x148d('0x39')](_0x53a04e[_0x148d('0x32')]['sort']);_0x2b4d4a['where']=qs[_0x148d('0x34')](_[_0x148d('0x3a')](_0x53a04e[_0x148d('0x32')],_0x4ae6cd[_0x148d('0x34')]),_0x5e62c3);if(_0x53a04e['query'][_0x148d('0x3b')]){_0x2b4d4a[_0x148d('0x3c')]=_[_0x148d('0x3d')](_0x2b4d4a[_0x148d('0x3c')],{'$or':_[_0x148d('0x2b')](_0x5e62c3,function(_0xf46f24){if(_0xf46f24[_0x148d('0x2f')]!==_0x148d('0x3e')){var _0x51f155={};_0x51f155[_0xf46f24[_0x148d('0x28')]]={'$like':'%'+_0x53a04e[_0x148d('0x32')][_0x148d('0x3b')]+'%'};return _0x51f155;}})});}_0x2b4d4a=_[_0x148d('0x3d')]({},_0x2b4d4a,_0x53a04e[_0x148d('0x3f')]);var _0x362702={'where':_0x2b4d4a[_0x148d('0x3c')]};return db[_0x148d('0x2c')][_0x148d('0x1b')](_0x362702)[_0x148d('0x24')](function(_0x17c240){_0x2f7a08[_0x148d('0x1b')]=_0x17c240;if(_0x53a04e['query']['includeAll']){_0x2b4d4a[_0x148d('0x40')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x2b4d4a);})[_0x148d('0x24')](function(_0x2a1aaa){_0x2f7a08[_0x148d('0x41')]=_0x2a1aaa;return _0x2f7a08;})[_0x148d('0x24')](respondWithFilteredResult(_0x56f9d4,_0x2b4d4a))[_0x148d('0x42')](handleError(_0x56f9d4,null));};exports['show']=function(_0xab6251,_0x283166){var _0x3e136f={'raw':![],'where':{'id':_0xab6251[_0x148d('0x43')]['id']}},_0x4aed82={};_0x4aed82[_0x148d('0x31')]=_[_0x148d('0x33')](db[_0x148d('0x2c')][_0x148d('0x2d')]);_0x4aed82[_0x148d('0x32')]=_[_0x148d('0x33')](_0xab6251[_0x148d('0x32')]);_0x4aed82['filters']=_['intersection'](_0x4aed82[_0x148d('0x31')],_0x4aed82[_0x148d('0x32')]);_0x3e136f[_0x148d('0x35')]=_['intersection'](_0x4aed82[_0x148d('0x31')],qs[_0x148d('0x37')](_0xab6251[_0x148d('0x32')][_0x148d('0x37')]));_0x3e136f[_0x148d('0x35')]=_0x3e136f[_0x148d('0x35')][_0x148d('0x44')]?_0x3e136f[_0x148d('0x35')]:_0x4aed82[_0x148d('0x31')];if(_0xab6251[_0x148d('0x32')]['includeAll']){_0x3e136f['include']=[{'all':!![]}];}_0x3e136f=_[_0x148d('0x3d')]({},_0x3e136f,_0xab6251[_0x148d('0x3f')]);return db[_0x148d('0x2c')]['find'](_0x3e136f)[_0x148d('0x24')](handleEntityNotFound(_0x283166,null))[_0x148d('0x24')](respondWithResult(_0x283166,null))[_0x148d('0x42')](handleError(_0x283166,null));};exports[_0x148d('0x45')]=function(_0x359369,_0x5d45b9){return db[_0x148d('0x2c')][_0x148d('0x45')](_0x359369[_0x148d('0x46')],{})[_0x148d('0x24')](respondWithResult(_0x5d45b9,0xc9))[_0x148d('0x42')](handleError(_0x5d45b9,null));};exports[_0x148d('0x47')]=function(_0x5979c9,_0x1de51a){var _0x2a15a2={'where':{'id':_0x5979c9[_0x148d('0x43')]['id']}},_0xe1b8ce={};_0xe1b8ce[_0x148d('0x31')]=_[_0x148d('0x33')](db[_0x148d('0x2c')]['rawAttributes']);_0x2a15a2[_0x148d('0x35')]=_[_0x148d('0x36')](_0xe1b8ce['model'],qs[_0x148d('0x37')](_0x5979c9[_0x148d('0x32')][_0x148d('0x37')]));_0x2a15a2[_0x148d('0x35')]=_0x2a15a2[_0x148d('0x35')]['length']?_0x2a15a2['attributes']:_0xe1b8ce[_0x148d('0x31')];if(_0x5979c9[_0x148d('0x32')][_0x148d('0x48')]){_0x2a15a2[_0x148d('0x40')]=[{'all':!![]}];}_0x2a15a2=_[_0x148d('0x3d')]({},_0x2a15a2,_0x5979c9['options']);return db['UserProfile'][_0x148d('0x49')](_0x2a15a2)[_0x148d('0x24')](handleEntityNotFound(_0x1de51a,null))[_0x148d('0x24')](function(_0x479905){if(_0x479905){var _0x176834=_0x479905[_0x148d('0x4a')]({'plain':!![]});_0x176834=qs[_0x148d('0x4b')](_0x176834,['id','createdAt',_0x148d('0x4c'),_0x148d('0x4d')]);_0x5979c9[_0x148d('0x46')]=_[_0x148d('0x4b')](_0x5979c9[_0x148d('0x46')],['id',_0x148d('0x4e'),_0x148d('0x4c')]);return db[_0x148d('0x4f')][_0x148d('0x50')](function(_0x27aaa){return db[_0x148d('0x2c')]['create'](_[_0x148d('0x3d')](_0x176834,_0x5979c9[_0x148d('0x46')]),{'include':_0x5979c9[_0x148d('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x27aaa})[_0x148d('0x24')](function(_0x251232){var _0x51efa3=_0x251232[_0x148d('0x4a')]({'plain':!![]});return db[_0x148d('0x51')][_0x148d('0x52')]({'where':{'userProfileId':_0x5979c9['params']['id']},'raw':!![]})['then'](function(_0x2584ac){if(_0x2584ac){return BPromise[_0x148d('0x53')](_0x2584ac,function(_0x299be8){return new BPromise(function(_0x240f76,_0x10bf19){if(_0x299be8[_0x148d('0x54')]===null||_0x299be8[_0x148d('0x54')]===0x1)_0x240f76(null);return db[_0x148d('0x55')][_0x148d('0x52')]({'where':{'sectionId':_0x299be8['id']},'raw':!![]})[_0x148d('0x24')](function(_0x31c739){var _0x3cfc19=_[_0x148d('0x2b')](_0x31c739,function(_0xe0ddbc){return qs[_0x148d('0x4b')](_0xe0ddbc,['id',_0x148d('0x4e'),_0x148d('0x4c'),'sectionId']);});_0x240f76(_0x3cfc19);})[_0x148d('0x42')](function(_0x461eea){_0x10bf19(_0x461eea);});})['then'](function(_0x50a4c8){var _0x451fd2=qs[_0x148d('0x4b')](_0x299be8,['id','createdAt',_0x148d('0x4c')]);_0x451fd2[_0x148d('0x56')]=_0x51efa3['id'];if(_0x50a4c8)_0x451fd2[_0x148d('0x57')]=_0x50a4c8;return _0x451fd2;})['then'](function(_0x820342){return db[_0x148d('0x51')][_0x148d('0x45')](_0x820342,{'include':[{'model':db['UserProfileResource'],'as':_0x148d('0x57')}],'raw':!![],'transaction':_0x27aaa});});})['then'](function(){return _0x51efa3;});}});});});}})[_0x148d('0x24')](respondWithResult(_0x1de51a,0xc9))[_0x148d('0x42')](handleError(_0x1de51a,null));};exports[_0x148d('0x23')]=function(_0x5711a0,_0x33719f){if(_0x5711a0[_0x148d('0x46')]['id']){delete _0x5711a0['body']['id'];}return db[_0x148d('0x2c')][_0x148d('0x49')]({'where':{'id':_0x5711a0[_0x148d('0x43')]['id']}})[_0x148d('0x24')](handleEntityNotFound(_0x33719f,null))[_0x148d('0x24')](saveUpdates(_0x5711a0['body'],null))[_0x148d('0x24')](respondWithResult(_0x33719f,null))[_0x148d('0x42')](handleError(_0x33719f,null));};exports['destroy']=function(_0xf1bccb,_0x296782){return db[_0x148d('0x2c')][_0x148d('0x49')]({'where':{'id':_0xf1bccb[_0x148d('0x43')]['id']}})[_0x148d('0x24')](handleEntityNotFound(_0x296782,null))[_0x148d('0x24')](removeEntity(_0x296782,null))[_0x148d('0x42')](handleError(_0x296782,null));};exports[_0x148d('0x58')]=function(_0x5b8402,_0x24916d){return db[_0x148d('0x2c')]['describe']()[_0x148d('0x24')](respondWithResult(_0x24916d,null))[_0x148d('0x42')](handleError(_0x24916d,null));};exports[_0x148d('0x59')]=function(_0x177a9d,_0x4dc750){var _0x446739=_0x177a9d[_0x148d('0x46')];return db[_0x148d('0x2c')][_0x148d('0x49')]({'where':{'id':_0x177a9d[_0x148d('0x43')]['id']}})[_0x148d('0x24')](handleEntityNotFound(_0x4dc750,null))[_0x148d('0x24')](function(_0x279634){if(_0x279634){return db[_0x148d('0x4f')][_0x148d('0x50')](function(_0x1d92fe){return db[_0x148d('0x51')][_0x148d('0x25')]({'where':{'userProfileId':_0x177a9d['params']['id'],'sectionId':_['map'](_0x446739,function(_0x3d2af1){return _0x3d2af1[_0x148d('0x5a')];})},'transaction':_0x1d92fe})['then'](function(){var _0x14bef1=_['map'](_0x446739,function(_0x179e40){_0x179e40['userProfileId']=_0x177a9d[_0x148d('0x43')]['id'];return _0x179e40;});var _0x3749f1=[];return BPromise[_0x148d('0x53')](_0x14bef1,function(_0x5de582){return db[_0x148d('0x51')][_0x148d('0x45')](_0x5de582,{'include':[{'model':db[_0x148d('0x55')],'as':_0x148d('0x57')}],'raw':!![],'transaction':_0x1d92fe})['then'](function(_0x458f82){_0x3749f1['push'](_0x458f82[_0x148d('0x4a')]({'plain':!![]}));});})[_0x148d('0x24')](function(){return _0x3749f1;});});});}})[_0x148d('0x24')](function(_0x1a6d4a){return _0x1a6d4a;})[_0x148d('0x24')](respondWithResult(_0x4dc750,null))[_0x148d('0x42')](handleError(_0x4dc750,null));};exports[_0x148d('0x5b')]=function(_0x543f6e,_0x529563){var _0x454127;return db['UserProfile'][_0x148d('0x49')]({'where':{'id':_0x543f6e[_0x148d('0x43')]['id']},'attributes':['id',_0x148d('0x28')]})[_0x148d('0x24')](handleEntityNotFound(_0x529563,null))[_0x148d('0x24')](function(_0x7895ad){if(_0x7895ad){_0x454127=_0x7895ad;return db[_0x148d('0x51')][_0x148d('0x25')]({'where':{'userProfileId':_0x543f6e['params']['id'],'sectionId':_0x543f6e[_0x148d('0x32')][_0x148d('0x5c')]}});}})[_0x148d('0x24')](function(){return _0x454127;})[_0x148d('0x24')](respondWithStatusCode(_0x529563,null))[_0x148d('0x42')](handleError(_0x529563,null));};exports[_0x148d('0x5d')]=function(_0xf11092,_0x2b5db4){var _0x30d718=[];var _0x4f1ee0=[];return db['UserProfileSection'][_0x148d('0x52')]({'where':{'userProfileId':_0xf11092[_0x148d('0x43')]['id']},'raw':!![]})[_0x148d('0x24')](function(_0x59ecf5){_0x30d718=_[_0x148d('0x3b')](_0x59ecf5,function(_0x527a09){return _0x527a09[_0x148d('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x527a09[_0x148d('0x5a')]);});if(!_[_0x148d('0x5f')](_0x30d718)){return _[_0x148d('0x2b')](_0x30d718,function(_0x3ac97f){return _0x3ac97f[_0x148d('0x5a')];});}else{return;}})[_0x148d('0x24')](function(_0x36c9f5){if(_0x36c9f5)_0x4f1ee0=_0x36c9f5;if(_[_0x148d('0x60')](_0x4f1ee0,0x64)){var _0x4e92b4=_['find'](_0x30d718,{'sectionId':0x64});return hasDefaultDashboard(_0x4e92b4)['then'](function(_0x11fecb){return _['map'](_0x30d718,function(_0x4835f2){if(_0x4835f2[_0x148d('0x5a')]===0x64){_0x4835f2['subsections']=_0x11fecb;}return _0x4835f2;});});}else{return;}})[_0x148d('0x24')](function(_0x4e479a){if(_0x4e479a)_0x30d718=_0x4e479a;if(_['includes'](_0x4f1ee0,0x3eb)){var _0xa79313=_[_0x148d('0x49')](_0x30d718,{'sectionId':0x3eb});return getCustomDashboards(_0xa79313)[_0x148d('0x24')](function(_0xeb7a8c){return _[_0x148d('0x2b')](_0x30d718,function(_0x3f7473){if(_0xa79313[_0x148d('0x5e')]){if(_0x3f7473[_0x148d('0x5a')]===0x3eb){_0x3f7473[_0x148d('0x61')]=_0xeb7a8c;}}else{if(_0x3f7473[_0x148d('0x5a')]===0x64){_0x3f7473[_0x148d('0x61')]=_0xeb7a8c;}}return _0x3f7473;});});}else{return;}})['then'](function(_0x3f8e05){if(_0x3f8e05)_0x30d718=_0x3f8e05;if(_['includes'](_0x4f1ee0,0x709)){var _0x1ea4f5=_[_0x148d('0x49')](_0x30d718,{'sectionId':0x709});return getPlugins(_0x1ea4f5)[_0x148d('0x24')](function(_0x581b22){if(_0x1ea4f5[_0x148d('0x5e')]){return _[_0x148d('0x2b')](_0x30d718,function(_0x3d65e6){if(_0x3d65e6['sectionId']===0x709){_0x3d65e6[_0x148d('0x61')]=_0x581b22;}return _0x3d65e6;});}else{var _0xad417f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x581b22};var _0x40b011=_['map'](_0x30d718);_0x40b011[_0x148d('0x62')](_0xad417f);return _0x40b011;}});}else{return;}})[_0x148d('0x24')](function(_0x55c305){if(_0x55c305)_0x30d718=_0x55c305;return _[_0x148d('0x3b')](_0x30d718,['enabled',0x1]);})[_0x148d('0x24')](respondWithResult(_0x2b5db4,null))[_0x148d('0x42')](handleError(_0x2b5db4,null));};function hasDefaultDashboard(_0x1f8a88){var _0x12dc48=[0x65];return new BPromise(function(_0x35310d,_0x5b6a6f){try{if(_0x1f8a88['autoAssociation']){_0x35310d(_0x12dc48);}else{return db[_0x148d('0x55')][_0x148d('0x63')]({'where':{'sectionId':_0x1f8a88['id']},'raw':!![]})[_0x148d('0x24')](function(_0x4c1680){_0x4c1680?_0x35310d(_0x12dc48):_0x35310d();});}}catch(_0x5f12d3){_0x5b6a6f(_0x5f12d3);}});}function getCustomDashboards(_0x525fa9){var _0x368a5f=[];return new BPromise(function(_0x4faa77,_0x25b8b3){try{if(_0x525fa9[_0x148d('0x54')]){return db[_0x148d('0x64')][_0x148d('0x52')]({'raw':!![]})['then'](function(_0x59bc32){_0x59bc32['forEach'](function(_0x1fd31e){_0x368a5f[_0x148d('0x62')](_0x1fd31e['id']+0x1869f);});_0x4faa77(_0x368a5f);});}else{return db[_0x148d('0x55')][_0x148d('0x52')]({'where':{'sectionId':_0x525fa9['id']},'raw':!![]})['then'](function(_0xe51ddc){_0xe51ddc['forEach'](function(_0x516cc6){_0x368a5f[_0x148d('0x62')](_0x516cc6['resourceId']+0x1869f);});_0x4faa77(_0x368a5f);});}}catch(_0x407525){_0x25b8b3(_0x407525);}});}function getPlugins(_0x306a0a){var _0x51ef2c=[];return new BPromise(function(_0x1930df,_0x4a4c4c){try{if(_0x306a0a[_0x148d('0x54')]){return db[_0x148d('0x65')][_0x148d('0x52')]({'raw':!![]})[_0x148d('0x24')](function(_0x1e4425){_0x1e4425[_0x148d('0x66')](function(_0x5c2beb){_0x51ef2c['push'](_0x5c2beb['id']+0x15b38);});_0x1930df(_0x51ef2c);});}else{return db[_0x148d('0x55')]['findAll']({'where':{'sectionId':_0x306a0a['id']},'raw':!![]})[_0x148d('0x24')](function(_0x39694a){_0x39694a['forEach'](function(_0x1c0038){_0x51ef2c[_0x148d('0x62')](_0x1c0038['resourceId']+0x15b38);});_0x1930df(_0x51ef2c);});}}catch(_0x43f6dd){_0x4a4c4c(_0x43f6dd);}});}exports['addResources']=function(_0x12cfd7,_0x248049){return db[_0x148d('0x2c')][_0x148d('0x49')]({'where':{'id':_0x12cfd7['params']['id']}})[_0x148d('0x24')](handleEntityNotFound(_0x248049,null))[_0x148d('0x24')](function(_0x5a0c9b){if(_0x5a0c9b){return db[_0x148d('0x4f')][_0x148d('0x50')](function(_0x47126a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x12cfd7['params']['id']},'attributes':['id'],'raw':!![]})[_0x148d('0x24')](function(_0x5d313b){if(_0x5d313b){return db[_0x148d('0x51')][_0x148d('0x25')]({'where':{'userProfileId':_0x12cfd7[_0x148d('0x43')]['id'],'id':_['map'](_0x5d313b,function(_0x110b83){return _0x110b83['id'];})},'transaction':_0x47126a});}})[_0x148d('0x24')](function(_0x5311ca){var _0x4f532b=_[_0x148d('0x2b')](_0x12cfd7[_0x148d('0x46')],function(_0x1cafe5){_0x1cafe5[_0x148d('0x56')]=_0x12cfd7[_0x148d('0x43')]['id'];return _0x1cafe5;});return db[_0x148d('0x51')][_0x148d('0x67')](_0x4f532b,{'raw':!![],'transaction':_0x47126a});})[_0x148d('0x24')](function(_0x29933e){var _0x3973f5=_[_0x148d('0x3b')](_[_0x148d('0x2b')](_0x29933e,function(_0x40c744){return _0x40c744['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3973f5){return db[_0x148d('0x51')][_0x148d('0x52')]({'where':{'userProfileId':_0x12cfd7[_0x148d('0x43')]['id'],'sectionId':_['map'](_0x3973f5,function(_0x6ac5fa){return _0x6ac5fa[_0x148d('0x5a')];})},'attributes':['id',_0x148d('0x5a')],'raw':!![]})[_0x148d('0x24')](function(_0x360bb9){var _0x169158=_[_0x148d('0x2b')](_0x12cfd7[_0x148d('0x46')],function(_0x5d9111){_0x5d9111[_0x148d('0x56')]=_0x12cfd7[_0x148d('0x43')]['id'];return _0x5d9111;});return db[_0x148d('0x55')][_0x148d('0x67')](_0x169158,{'raw':!![],'transaction':_0x47126a});});}})[_0x148d('0x42')](handleError(_0x248049,null));});}})[_0x148d('0x24')](function(_0x44bf80){var _0x44fb5d=_[_0x148d('0x2b')](_0x44bf80,function(_0x4b25af){return _0x4b25af['get']({'plain':!![]});});})['then'](respondWithResult(_0x248049,null))[_0x148d('0x42')](handleError(_0x248049,null));};exports[_0x148d('0x68')]=function(_0x2a0b68,_0x12eb34,_0x47cc6e){return db[_0x148d('0x2c')]['find']({'where':{'id':_0x2a0b68[_0x148d('0x43')]['id']}})[_0x148d('0x24')](handleEntityNotFound(_0x12eb34,null))[_0x148d('0x24')](function(_0x388bd8){if(_0x388bd8){return _0x388bd8[_0x148d('0x68')](_0x2a0b68[_0x148d('0x32')][_0x148d('0x5c')]);}})[_0x148d('0x24')](respondWithStatusCode(_0x12eb34,null))['catch'](handleError(_0x12eb34,null));};exports[_0x148d('0x69')]=function(_0xd60c36,_0x5b730d){var _0x5be1a2={'raw':![],'where':{}};var _0x30736a={};var _0x6e0a38={'count':0x0,'rows':[]};var _0x48eae7=_0xd60c36[_0x148d('0x32')][_0x148d('0x6a')];if(typeof _0x48eae7===_0x148d('0x6b')){throw new db[(_0x148d('0x6c'))][(_0x148d('0x6d'))](_0x148d('0x6e'));}var _0x25d674=_0xd60c36[_0x148d('0x32')][_0x148d('0x6f')]||![];var _0x4939bd=getQueryModels(_0x48eae7,_0x25d674);if(typeof _0x4939bd[_0x148d('0x70')]==='undefined'){throw new db[(_0x148d('0x6c'))]['ValidationError'](_0x148d('0x71')+_0x48eae7+'\x27');}var _0xa41e88=[];if(!_[_0x148d('0x5f')](_0x4939bd['parentSections'])){_0xa41e88=_0x4939bd[_0x148d('0x72')];}else{_0xa41e88=[{'name':_0x48eae7}];}return db['UserProfile']['findOne']({'where':{'id':_0xd60c36['params']['id']}})['then'](handleEntityNotFound(_0x5b730d,null))[_0x148d('0x24')](function(_0xc3c78e){if(_0xc3c78e){var _0x564bfb=[];for(var _0x4d8350=0x0;_0x4d8350<_0xa41e88[_0x148d('0x44')];_0x4d8350++){_0x564bfb[_0x148d('0x62')](db[_0x148d('0x51')][_0x148d('0x63')]({'where':{'userProfileId':_0xc3c78e['id'],'name':_0xa41e88[_0x4d8350][_0x148d('0x28')]},'raw':!![]}));}return BPromise[_0x148d('0x73')](_0x564bfb);}})[_0x148d('0x24')](function(_0xf25c99){var _0xe02120=_[_0x148d('0x3b')](_0xf25c99,function(_0x2e274e){return _0x2e274e?_0x2e274e:undefined;});var _0x1fc062=_[_0x148d('0x3b')](_0xa41e88,[_0x148d('0x74'),!![]]);var _0x1b9997=_[_0x148d('0x5f')](_0xe02120)&&_[_0x148d('0x5f')](_0x1fc062)?null:_[_0x148d('0x75')](_0x1fc062,_0xe02120);if(_0x1b9997){var _0x2c9408=[];for(var _0x278ac6=0x0;_0x278ac6<_0x1b9997[_0x148d('0x44')];_0x278ac6++){var _0x18f557=_[_0x148d('0x49')](_0xa41e88,function(_0x6b9b0c){return _0x1b9997[_0x278ac6]?_0x6b9b0c[_0x148d('0x28')]===_0x1b9997[_0x278ac6]['name']:null;});if(_0x18f557){if(_0x1b9997[_0x278ac6][_0x148d('0x74')]){_0x2c9408[_0x148d('0x62')](getAllResources(_0x4939bd['childModel'],_0x1b9997[_0x278ac6]));}else{if(!_0x1b9997[_0x278ac6][_0x148d('0x54')]){_0x2c9408['push'](getAllowedResources(_0x18f557,_0x1b9997[_0x278ac6],_0x4939bd[_0x148d('0x70')]));}else{if(_0x18f557[_0x148d('0x31')]){_0x2c9408['push'](getAllFilteredResources(_0x18f557,_0x1b9997[_0x278ac6]));}}}}}return BPromise['all'](_0x2c9408);}else{return null;}})[_0x148d('0x24')](function(_0xe0a15f){var _0x1a7a94=_0xe0a15f;var _0x6b2706=null;if(_0x1a7a94){_0x6b2706=_0x1a7a94['length']===0x1?_0x1a7a94[0x0]:null;}if(_0x6b2706||_0x1a7a94){var _0x4bcd1a=db[_0x4939bd['childModel']][_0x148d('0x2d')];_0x30736a[_0x148d('0x31')]=_[_0x148d('0x33')](_0x4bcd1a);_0x30736a['query']=_[_0x148d('0x33')](_0xd60c36[_0x148d('0x32')]);_0x30736a[_0x148d('0x34')]=_[_0x148d('0x36')](_0x30736a[_0x148d('0x31')],_0x30736a['query']);_0x5be1a2[_0x148d('0x35')]=_[_0x148d('0x36')](_0x30736a[_0x148d('0x31')],qs[_0x148d('0x37')](_0xd60c36[_0x148d('0x32')][_0x148d('0x37')]));_0x5be1a2[_0x148d('0x35')]=_0x5be1a2[_0x148d('0x35')][_0x148d('0x44')]?_0x5be1a2[_0x148d('0x35')]:_0x30736a[_0x148d('0x31')];if(!_0xd60c36['query'][_0x148d('0x38')](_0x148d('0x76'))){_0x5be1a2[_0x148d('0x1d')]=qs[_0x148d('0x1d')](_0xd60c36[_0x148d('0x32')][_0x148d('0x1d')]);_0x5be1a2[_0x148d('0x1c')]=qs[_0x148d('0x1c')](_0xd60c36['query'][_0x148d('0x1c')]);}_0x5be1a2[_0x148d('0x77')]=qs[_0x148d('0x39')](_0xd60c36[_0x148d('0x32')][_0x148d('0x39')]);_0x5be1a2[_0x148d('0x3c')]=qs[_0x148d('0x34')](_[_0x148d('0x3a')](_0xd60c36[_0x148d('0x32')],_0x30736a[_0x148d('0x34')]));if(_0xd60c36[_0x148d('0x32')][_0x148d('0x3b')]){_0x5be1a2[_0x148d('0x3c')]=_[_0x148d('0x3d')](_0x5be1a2[_0x148d('0x3c')],{'$or':_[_0x148d('0x2b')](_0x4bcd1a,function(_0x914c3b){if(_0x914c3b['type']['key']!==_0x148d('0x3e')){var _0x5dd264={};_0x5dd264[_0x914c3b['field']]={'$like':'%'+_0xd60c36[_0x148d('0x32')]['filter']+'%'};return _0x5dd264;}})});}var _0x4de95d=[];if(_0x6b2706){var _0x4de676=_['find'](_0xa41e88,[_0x148d('0x28'),_0x6b2706[_0x148d('0x28')]]);if(_0x4de676['field']){var _0x26e226={};if(_0x4939bd[_0x148d('0x70')]===_0x148d('0x78')){_0x26e226[_0x4de676[_0x148d('0x79')]]=_[_0x148d('0x2b')](_0x6b2706[_0x148d('0x7a')],'id');}else{_0x26e226[_0x4de676[_0x148d('0x79')]]=_0x6b2706['associatedResources'];}_0x4de95d[_0x148d('0x62')](_0x26e226);}else{_0x5be1a2['where']['id']=_0x6b2706[_0x148d('0x7a')];}}else{for(var _0x5e8b73=0x0;_0x5e8b73<_0x1a7a94[_0x148d('0x44')];_0x5e8b73++){var _0x4de676=_[_0x148d('0x49')](_0xa41e88,[_0x148d('0x28'),_0x1a7a94[_0x5e8b73][_0x148d('0x28')]]);if(_0x4de676['field']){var _0x26e226={};_0x26e226[_0x4de676[_0x148d('0x79')]]=_0x1a7a94[_0x5e8b73]['associatedResources'];_0x4de95d[_0x148d('0x62')](_0x26e226);}else{if(!_0x5be1a2[_0x148d('0x3c')]['id'])_0x5be1a2[_0x148d('0x3c')]['id']=[];_0x1a7a94[_0x5e8b73]['associatedResources'][_0x148d('0x66')](function(_0x4b899f){_0x5be1a2[_0x148d('0x3c')]['id'][_0x148d('0x62')](_0x4b899f);});}}}if(!_['isEmpty'](_0x4de95d)){_0x5be1a2[_0x148d('0x3c')]=_[_0x148d('0x3d')](_0x5be1a2[_0x148d('0x3c')],{'$and':{'$or':_0x4de95d}});}_0x5be1a2=_[_0x148d('0x3d')]({},_0x5be1a2,_0xd60c36[_0x148d('0x3f')]);if(_0x6b2706&&!_0x6b2706[_0x148d('0x54')]&&_0x4939bd['childModel']===_0x148d('0x78')){if(_0xd60c36['query'][_0x148d('0x48')]){_0x5be1a2[_0x148d('0x40')]=[{'all':!![]}];}return db[_0x4939bd[_0x148d('0x70')]]['findAll'](_0x5be1a2)['then'](function(_0x4b7bbf){var _0x44d482=[];_0x4b7bbf['forEach'](function(_0x4e15ee){var _0x1a1a0a;switch(_0x4e15ee[_0x148d('0x7b')]){case _0x148d('0x7c'):_0x1a1a0a=_[_0x148d('0x49')](_0x6b2706[_0x148d('0x7a')],function(_0xd596e8){return _0xd596e8['id']===_0x4e15ee[_0x148d('0x7d')]&&_0xd596e8[_0x148d('0x2f')]===_0x148d('0x7e');});break;case _0x148d('0x7f'):_0x1a1a0a=_[_0x148d('0x49')](_0x6b2706[_0x148d('0x7a')],function(_0x3aff8d){return _0x3aff8d['id']===_0x4e15ee[_0x148d('0x7d')]&&_0x3aff8d[_0x148d('0x2f')]===_0x148d('0x80');});break;}if(_0x1a1a0a)_0x44d482[_0x148d('0x62')](_0x4e15ee);});_0x6e0a38[_0x148d('0x1b')]=_0x44d482[_0x148d('0x44')];_0x6e0a38[_0x148d('0x41')]=_0x44d482;return _0x6e0a38;});}else{return db[_0x4939bd['childModel']]['count']({'where':_0x5be1a2[_0x148d('0x3c')]})['then'](function(_0xe96273){_0x6e0a38[_0x148d('0x1b')]=_0xe96273;if(_0xd60c36['query'][_0x148d('0x48')]){if(_0x4939bd[_0x148d('0x70')]===_0x148d('0x81')){_0x5be1a2[_0x148d('0x40')]=[{'model':db[_0x148d('0x82')],'as':_0x148d('0x83'),'attributes':['id',_0x148d('0x28'),_0x148d('0x84')],'required':_0xd60c36[_0x148d('0x32')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0x148d('0x85'),'attributes':['id','name',_0x148d('0x84')],'through':_0xd60c36[_0x148d('0x32')][_0x148d('0x86')]?{'attributes':[],'where':{'TagId':_0xd60c36['query'][_0x148d('0x86')]||undefined}}:{},'required':_0xd60c36['query'][_0x148d('0x86')]?!![]:![]}];}else{_0x5be1a2[_0x148d('0x40')]=[{'all':!![]}];}}return db[_0x4939bd[_0x148d('0x70')]][_0x148d('0x52')](_0x5be1a2);})[_0x148d('0x24')](function(_0x4333c1){_0x6e0a38[_0x148d('0x41')]=_0x4333c1;return _0x6e0a38;});}}else{return _0x6e0a38;}})[_0x148d('0x24')](respondWithFilteredResult(_0x5b730d,_0x5be1a2))[_0x148d('0x42')](handleError(_0x5b730d,null));};function getAllResources(_0x4de218,_0x5c3c00){return new BPromise(function(_0x5cd98e,_0x3595d9){if(_0x5c3c00){var _0x304357=_0x5c3c00['filter']?{[_0x5c3c00[_0x148d('0x3b')]['field']]:_0x5c3c00[_0x148d('0x3b')]['value']}:undefined;return db[_0x4de218][_0x148d('0x52')]({'where':_0x304357,'raw':!![]})['then'](function(_0x3ef540){_0x5c3c00['associatedResources']=_[_0x148d('0x2b')](_0x3ef540,'id');_0x5cd98e(_0x5c3c00);})[_0x148d('0x42')](function(_0x2b7b6c){_0x3595d9(_0x2b7b6c);});}else{_0x5cd98e(null);}});}function getAllFilteredResources(_0xdb02b1,_0x22e0a4){return new BPromise(function(_0x5b208f,_0x303d8d){var _0x10874a=_0xdb02b1[_0x148d('0x3b')]?{[_0xdb02b1[_0x148d('0x3b')][_0x148d('0x87')]]:_0xdb02b1['filter'][_0x148d('0x88')]}:undefined;return db[_0xdb02b1['model']][_0x148d('0x52')]({'where':_0x10874a,'raw':!![]})[_0x148d('0x24')](function(_0x2b13ae){_0x22e0a4['associatedResources']=_[_0x148d('0x2b')](_0x2b13ae,function(_0x521e4a){return _0x521e4a[_0x148d('0x28')];});_0x5b208f(_0x22e0a4);})[_0x148d('0x42')](function(_0xbeaf9b){_0x303d8d(_0xbeaf9b);});});}function getAllowedResources(_0x5003d5,_0x5309ab,_0x140ae7){return new BPromise(function(_0x291c1d,_0x18280f){if(_0x5309ab){return db[_0x148d('0x55')]['findAll']({'where':{'sectionId':_0x5309ab['id']},'raw':!![]})[_0x148d('0x24')](function(_0x55eb44){if(_0x5003d5['field']&&_0x5003d5[_0x148d('0x87')]!=='id'){_0x5309ab['associatedResources']=_[_0x148d('0x2b')](_0x55eb44,function(_0x30ae30){return _0x30ae30[_0x5003d5['field']];});}else{if(_0x140ae7==='AnalyticExtractedReport'){_0x5309ab['associatedResources']=_[_0x148d('0x2b')](_0x55eb44,function(_0x46275f){return{'id':_0x46275f[_0x148d('0x89')],'type':_0x46275f[_0x148d('0x2f')]};});}else{_0x5309ab[_0x148d('0x7a')]=_['map'](_0x55eb44,function(_0x4fa19e){return _0x4fa19e[_0x148d('0x89')];});}}_0x291c1d(_0x5309ab);})['catch'](function(_0x139ba3){_0x18280f(_0x139ba3);});}else{_0x291c1d(null);}});}function getQueryModels(_0x4c0c6f,_0x39afd8){var _0x24b873=_0x4c0c6f[_0x148d('0x8a')]();var _0x3a05dd={'childModel':undefined,'parentSections':[]};switch(_0x24b873){case _0x148d('0x8b'):_0x3a05dd['childModel']='SquareProject';break;case _0x148d('0x8c'):_0x3a05dd[_0x148d('0x70')]='SquareOdbc';break;case _0x148d('0x8d'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x8e');_0x3a05dd[_0x148d('0x72')]=[{'name':_0x148d('0x8f'),'field':_0x148d('0x28'),'foreignKey':'projectName'}];break;case _0x148d('0x90'):_0x3a05dd['childModel']=_0x148d('0x91');break;case _0x148d('0x92'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x81');_0x3a05dd[_0x148d('0x72')]=[{'name':'Lists','field':'id','foreignKey':_0x148d('0x93')}];break;case _0x148d('0x94'):_0x3a05dd['childModel']=_0x148d('0x95');break;case _0x148d('0x96'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x97');break;case _0x148d('0x98'):_0x3a05dd[_0x148d('0x70')]='CmCustomField';break;case'chatqueues':_0x3a05dd['childModel']=_0x148d('0x99');break;case _0x148d('0x9a'):_0x3a05dd['childModel']=_0x148d('0x9b');break;case _0x148d('0x9c'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x9d');break;case _0x148d('0x9e'):_0x3a05dd['childModel']='FaxAccount';break;case _0x148d('0x9f'):case _0x148d('0xa0'):case _0x148d('0xa1'):_0x3a05dd['childModel']=_0x148d('0xa2');break;case'contexts':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xa3');break;case _0x148d('0xa4'):_0x3a05dd['childModel']='VoiceMail';break;case _0x148d('0xa5'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xa6');_0x3a05dd['parentSections']=[{'name':'Agents','field':'name','foreignKey':'membername','model':_0x148d('0xa7'),'filter':{'field':_0x148d('0xa8'),'value':['agent']}},{'name':_0x148d('0xa9'),'field':_0x148d('0x28'),'foreignKey':'membername','model':_0x148d('0xa7'),'filter':{'field':_0x148d('0xa8'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x148d('0xaa'),'model':_0x148d('0xab'),'filter':{'field':_0x148d('0x2f'),'value':[_0x148d('0xac')]}},{'name':_0x148d('0xad'),'field':_0x148d('0x28'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x148d('0x2f'),'value':[_0x148d('0xae')]}}];break;case _0x148d('0xaf'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xb0');break;case _0x148d('0xb1'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xb2');break;case _0x148d('0xb3'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xb4');break;case'ivrcampaigns':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xb5');break;case _0x148d('0xb6'):_0x3a05dd[_0x148d('0x70')]='MailQueue';break;case'mailaccounts':_0x3a05dd[_0x148d('0x70')]='MailAccount';break;case _0x148d('0xb7'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xb8');break;case'openchannelqueues':_0x3a05dd['childModel']='OpenchannelQueue';break;case _0x148d('0xb9'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xba');break;case'smsqueues':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xbb');break;case _0x148d('0xbc'):_0x3a05dd[_0x148d('0x70')]='SmsAccount';break;case _0x148d('0xbd'):_0x3a05dd['childModel']=_0x148d('0xbe');break;case _0x148d('0xbf'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xc0');break;case _0x148d('0xc1'):_0x3a05dd['childModel']='Team';break;case _0x148d('0xc2'):case _0x148d('0xc3'):_0x3a05dd[_0x148d('0x70')]='VoiceQueue';if(_0x39afd8){_0x3a05dd['parentSections']=[{'name':_0x148d('0xc4')},{'name':'QueueCampaigns'}];}break;case _0x148d('0xc5'):case _0x148d('0xc6'):case _0x148d('0xc7'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xa7');if(_0x39afd8){_0x3a05dd[_0x148d('0x72')]=[{'name':_0x148d('0xc8'),'filter':{'field':_0x148d('0xa8'),'value':['admin',_0x148d('0xc9')]},'ignore':!![]},{'name':_0x148d('0xca')},{'name':_0x148d('0xa9')}];}break;case _0x148d('0xcb'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xcc');break;case _0x148d('0xcd'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xce');break;case _0x148d('0xcf'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xd0');break;case'sugarcrmaccounts':_0x3a05dd[_0x148d('0x70')]='SugarcrmAccount';break;case'deskaccounts':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xd1');break;case _0x148d('0xd2'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xd3');break;case _0x148d('0xd4'):_0x3a05dd[_0x148d('0x70')]='User';break;case _0x148d('0xd5'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xd6');break;case _0x148d('0xd7'):_0x3a05dd[_0x148d('0x70')]='Disposition';break;case _0x148d('0xd8'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x64');break;case'intervals':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xd9');break;case _0x148d('0xda'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xdb');break;case _0x148d('0xdc'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xdd');break;case _0x148d('0xde'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xdf');break;case _0x148d('0xe0'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0x82');break;case'templates':_0x3a05dd[_0x148d('0x70')]='Template';break;case _0x148d('0xe1'):_0x3a05dd[_0x148d('0x70')]='Trigger';break;case'trunks':_0x3a05dd[_0x148d('0x70')]='Trunk';break;case _0x148d('0xe2'):_0x3a05dd[_0x148d('0x70')]=_0x148d('0xe3');break;case _0x148d('0xe4'):_0x3a05dd[_0x148d('0x70')]='Plugin';break;case'extractedreports':_0x3a05dd[_0x148d('0x70')]=_0x148d('0x78');_0x3a05dd['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x148d('0x7d')}];break;case'metrics':_0x3a05dd[_0x148d('0x70')]=_0x148d('0xe5');break;case _0x148d('0xbf'):_0x3a05dd[_0x148d('0x70')]='WhatsappAccount';break;default:return _0x3a05dd;}return _0x3a05dd;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index fac8ef7..69ad4dc 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 _0x90d1=['UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x41273c,_0x4c0c04){var _0x453ce4=function(_0x5504e9){while(--_0x5504e9){_0x41273c['push'](_0x41273c['shift']());}};_0x453ce4(++_0x4c0c04);}(_0x90d1,0x1a2));var _0x190d=function(_0x11500e,_0x457be0){_0x11500e=_0x11500e-0x0;var _0x135e1a=_0x90d1[_0x11500e];return _0x135e1a;};'use strict';var EventEmitter=require(_0x190d('0x0'));var UserProfile=require(_0x190d('0x1'))['db'][_0x190d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x190d('0x3')](0x0);var events={'afterCreate':_0x190d('0x4'),'afterUpdate':_0x190d('0x5'),'afterDestroy':_0x190d('0x6')};function emitEvent(_0x59355e){return function(_0xf5df00,_0x2aac90,_0x1ad652){UserProfileEvents[_0x190d('0x7')](_0x59355e+':'+_0xf5df00['id'],_0xf5df00);UserProfileEvents['emit'](_0x59355e,_0xf5df00);_0x1ad652(null);};}for(var e in events){if(events[_0x190d('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x190d('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xf488=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xf488,0x1e6));var _0x8f48=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0xf488[_0x497948];return _0x39bb36;};'use strict';var EventEmitter=require(_0x8f48('0x0'));var UserProfile=require(_0x8f48('0x1'))['db'][_0x8f48('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8f48('0x3')](0x0);var events={'afterCreate':_0x8f48('0x4'),'afterUpdate':_0x8f48('0x5'),'afterDestroy':_0x8f48('0x6')};function emitEvent(_0x2856c5){return function(_0x1613e8,_0x58a19a,_0x1ef262){UserProfileEvents['emit'](_0x2856c5+':'+_0x1613e8['id'],_0x1613e8);UserProfileEvents[_0x8f48('0x7')](_0x2856c5,_0x1613e8);_0x1ef262(null);};}for(var e in events){if(events[_0x8f48('0x8')](e)){var event=events[e];UserProfile[_0x8f48('0x9')](e,emitEvent(event));}}module[_0x8f48('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 561fa40..9b63c13 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 _0xf1c4=['define','UserProfile','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf1c4,0x174));var _0x4f1c=function(_0x1bcc06,_0x12282d){_0x1bcc06=_0x1bcc06-0x0;var _0x57e7f4=_0xf1c4[_0x1bcc06];return _0x57e7f4;};'use strict';var _=require('lodash');var util=require(_0x4f1c('0x0'));var logger=require(_0x4f1c('0x1'))('api');var moment=require(_0x4f1c('0x2'));var BPromise=require(_0x4f1c('0x3'));var rp=require(_0x4f1c('0x4'));var fs=require('fs');var path=require(_0x4f1c('0x5'));var rimraf=require(_0x4f1c('0x6'));var config=require(_0x4f1c('0x7'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x1d5088,_0x3ec3d4){return _0x1d5088[_0x4f1c('0x8')](_0x4f1c('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0935=['./userProfile.attributes','exports','define','UserProfile','user_profiles','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x29840d,_0x4bef48){var _0x4917cd=function(_0x5499b9){while(--_0x5499b9){_0x29840d['push'](_0x29840d['shift']());}};_0x4917cd(++_0x4bef48);}(_0x0935,0x1a9));var _0x5093=function(_0x342125,_0x2b47ae){_0x342125=_0x342125-0x0;var _0x46ff47=_0x0935[_0x342125];return _0x46ff47;};'use strict';var _=require('lodash');var util=require(_0x5093('0x0'));var logger=require(_0x5093('0x1'))(_0x5093('0x2'));var moment=require(_0x5093('0x3'));var BPromise=require(_0x5093('0x4'));var rp=require(_0x5093('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5093('0x6'));var config=require('../../config/environment');var attributes=require(_0x5093('0x7'));module[_0x5093('0x8')]=function(_0x50f1c6,_0x487d98){return _0x50f1c6[_0x5093('0x9')](_0x5093('0xa'),attributes,{'tableName':_0x5093('0xb'),'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 9b9f1ea..507e55c 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x2bbed1,_0x55779e){var _0x2a0d6a=function(_0x1bc677){while(--_0x1bc677){_0x2bbed1['push'](_0x2bbed1['shift']());}};_0x2a0d6a(++_0x55779e);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1a99cd,_0x54129b){_0x1a99cd=_0x1a99cd-0x0;var _0x3f11de=_0xbd51[_0x1a99cd];return _0x3f11de;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});config[_0x1bd5('0x8')]=_[_0x1bd5('0x9')](config[_0x1bd5('0x8')],{'host':_0x1bd5('0xa'),'port':0x18eb});var socket=require(_0x1bd5('0xb'))(new Redis(config['redis']));require(_0x1bd5('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bd975,_0x28df8e,_0x3b868a){return new BPromise(function(_0x1fbc68,_0x2344e1){return client[_0x1bd5('0xd')](_0x2bd975,_0x3b868a)['then'](function(_0x456ef8){logger['info'](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));logger[_0x1bd5('0x10')](_0x1bd5('0x11'),_0x28df8e,_0x1bd5('0xf'),JSON[_0x1bd5('0x12')](_0x456ef8));if(_0x456ef8[_0x1bd5('0x13')]){if(_0x456ef8['error']['code']===0x1f4){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x2344e1(_0x456ef8['error']['message']);}logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x1fbc68(_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));_0x1fbc68(_0x456ef8['result']['message']);}})[_0x1bd5('0x16')](function(_0x260827){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x260827);_0x2344e1(_0x260827);});});} \ No newline at end of file +var _0x24ca=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1614eb,_0x428fd8){var _0x5bd96c=function(_0x5a7b5c){while(--_0x5a7b5c){_0x1614eb['push'](_0x1614eb['shift']());}};_0x5bd96c(++_0x428fd8);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0x24ca[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('UserProfile,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a22bbca..629d945 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 _0x816a=['register','length','./userProfile.events','save','remove','update','removeListener'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x816a,0x17c));var _0xa816=function(_0x373278,_0x201ed8){_0x373278=_0x373278-0x0;var _0x4af74a=_0x816a[_0x373278];return _0x4af74a;};'use strict';var UserProfileEvents=require(_0xa816('0x0'));var events=[_0xa816('0x1'),_0xa816('0x2'),_0xa816('0x3')];function createListener(_0xb051b2,_0x5c499c){return function(_0x10fcf4){_0x5c499c['emit'](_0xb051b2,_0x10fcf4);};}function removeListener(_0x1e01a9,_0x4ec5c6){return function(){UserProfileEvents[_0xa816('0x4')](_0x1e01a9,_0x4ec5c6);};}exports[_0xa816('0x5')]=function(_0x574df5){for(var _0xb78693=0x0,_0x1627e3=events[_0xa816('0x6')];_0xb78693<_0x1627e3;_0xb78693++){var _0x4f7fc3=events[_0xb78693];var _0x32fc54=createListener('userProfile:'+_0x4f7fc3,_0x574df5);UserProfileEvents['on'](_0x4f7fc3,_0x32fc54);}}; \ No newline at end of file +var _0x345d=['./userProfile.events','save','remove','update','emit','length','userProfile:'];(function(_0x59ca69,_0x2e3412){var _0x8bfb2c=function(_0x25a040){while(--_0x25a040){_0x59ca69['push'](_0x59ca69['shift']());}};_0x8bfb2c(++_0x2e3412);}(_0x345d,0x165));var _0xd345=function(_0x1ea4b9,_0x1244aa){_0x1ea4b9=_0x1ea4b9-0x0;var _0x4fc0d7=_0x345d[_0x1ea4b9];return _0x4fc0d7;};'use strict';var UserProfileEvents=require(_0xd345('0x0'));var events=[_0xd345('0x1'),_0xd345('0x2'),_0xd345('0x3')];function createListener(_0x3aac1d,_0x36efb9){return function(_0x4035d1){_0x36efb9[_0xd345('0x4')](_0x3aac1d,_0x4035d1);};}function removeListener(_0x541431,_0x6e84c3){return function(){UserProfileEvents['removeListener'](_0x541431,_0x6e84c3);};}exports['register']=function(_0x3b1c5b){for(var _0x5176e0=0x0,_0x404a5a=events[_0xd345('0x5')];_0x5176e0<_0x404a5a;_0x5176e0++){var _0x12aa5d=events[_0x5176e0];var _0x5ebda4=createListener(_0xd345('0x6')+_0x12aa5d,_0x3b1c5b);UserProfileEvents['on'](_0x12aa5d,_0x5ebda4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6845f02..d51b3ca 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 _0xc771=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc771,0x100));var _0x1c77=function(_0x17c3b9,_0x5e926a){_0x17c3b9=_0x17c3b9-0x0;var _0x527948=_0xc771[_0x17c3b9];return _0x527948;};'use strict';var multer=require(_0x1c77('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1c77('0x1'));var router=express[_0x1c77('0x2')]();var auth=require(_0x1c77('0x3'));var interaction=require(_0x1c77('0x4'));var config=require('../../config/environment');var controller=require(_0x1c77('0x5'));router[_0x1c77('0x6')]('/',auth[_0x1c77('0x7')](),controller['index']);router[_0x1c77('0x6')]('/describe',auth[_0x1c77('0x7')](),controller['describe']);router[_0x1c77('0x6')](_0x1c77('0x8'),auth['isAuthenticated'](),controller[_0x1c77('0x9')]);router[_0x1c77('0xa')]('/',auth[_0x1c77('0x7')](),controller[_0x1c77('0xb')]);router[_0x1c77('0xc')]('/:id',auth[_0x1c77('0x7')](),controller[_0x1c77('0xd')]);router[_0x1c77('0xe')]('/:id',auth[_0x1c77('0x7')](),controller[_0x1c77('0xf')]);module[_0x1c77('0x10')]=router; \ No newline at end of file +var _0xaa76=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0xaa76,0xbb));var _0x6aa7=function(_0x115a36,_0x40ad5a){_0x115a36=_0x115a36-0x0;var _0x2958d1=_0xaa76[_0x115a36];return _0x2958d1;};'use strict';var multer=require(_0x6aa7('0x0'));var util=require(_0x6aa7('0x1'));var path=require(_0x6aa7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6aa7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6aa7('0x4'));var config=require(_0x6aa7('0x5'));var controller=require('./userProfileResource.controller');router[_0x6aa7('0x6')]('/',auth[_0x6aa7('0x7')](),controller[_0x6aa7('0x8')]);router[_0x6aa7('0x6')](_0x6aa7('0x9'),auth[_0x6aa7('0x7')](),controller[_0x6aa7('0xa')]);router['get']('/:id',auth[_0x6aa7('0x7')](),controller['show']);router[_0x6aa7('0xb')]('/',auth['isAuthenticated'](),controller[_0x6aa7('0xc')]);router[_0x6aa7('0xd')](_0x6aa7('0xe'),auth[_0x6aa7('0x7')](),controller[_0x6aa7('0xf')]);router[_0x6aa7('0x10')](_0x6aa7('0xe'),auth[_0x6aa7('0x7')](),controller[_0x6aa7('0x11')]);module[_0x6aa7('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 1e6c3c7..d008253 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 _0x327a=['exports','STRING','INTEGER','sequelize'];(function(_0x1b8b77,_0x3285b3){var _0x999edc=function(_0x14b647){while(--_0x14b647){_0x1b8b77['push'](_0x1b8b77['shift']());}};_0x999edc(++_0x3285b3);}(_0x327a,0x167));var _0xa327=function(_0xb1dd06,_0x112dad){_0xb1dd06=_0xb1dd06-0x0;var _0xc97380=_0x327a[_0xb1dd06];return _0xc97380;};'use strict';var Sequelize=require(_0xa327('0x0'));module[_0xa327('0x1')]={'name':{'type':Sequelize[_0xa327('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa327('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa327('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7a58=['STRING','sequelize'];(function(_0x5a974e,_0x10e22a){var _0x437da2=function(_0x15b187){while(--_0x15b187){_0x5a974e['push'](_0x5a974e['shift']());}};_0x437da2(++_0x10e22a);}(_0x7a58,0x15d));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x87a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x87a5('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x87a5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9ae50e7..2a905ac 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 _0xdc97=['map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','filters','find','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','name'];(function(_0x7fc5c5,_0x443be6){var _0x1f573d=function(_0x5bc58a){while(--_0x5bc58a){_0x7fc5c5['push'](_0x7fc5c5['shift']());}};_0x1f573d(++_0x443be6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x184949,_0x50c9ff){_0x184949=_0x184949-0x0;var _0x451a91=_0xdc97[_0x184949];return _0x451a91;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be1c8,_0x599ef1){_0x599ef1=_0x599ef1||0xcc;return function(_0x94c75a){if(_0x94c75a){return _0x4be1c8[_0x7dc9('0x16')](_0x599ef1);}return _0x4be1c8['status'](_0x599ef1)[_0x7dc9('0x17')]();};}function respondWithResult(_0x2f3acd,_0xaadf2){_0xaadf2=_0xaadf2||0xc8;return function(_0xf37bc7){if(_0xf37bc7){return _0x2f3acd[_0x7dc9('0x18')](_0xaadf2)[_0x7dc9('0x19')](_0xf37bc7);}};}function respondWithFilteredResult(_0x524d09,_0x3a54f2){return function(_0x278191){if(_0x278191){var _0x1b0aa1=_0x278191[_0x7dc9('0x1a')],_0x442819=_0x3a54f2[_0x7dc9('0x1b')],_0x11606f=_0x3a54f2[_0x7dc9('0x1b')]+_0x3a54f2['limit'],_0xbe0437;if(_0x11606f>=_0x1b0aa1){_0x11606f=_0x1b0aa1;_0xbe0437=0xc8;}else{_0xbe0437=0xce;}_0x524d09[_0x7dc9('0x18')](_0xbe0437);return _0x524d09['set'](_0x7dc9('0x1c'),_0x442819+'-'+_0x11606f+'/'+_0x1b0aa1)[_0x7dc9('0x19')](_0x278191);}return null;};}function patchUpdates(_0x5d61d7){return function(_0x41f66e){try{jsonpatch[_0x7dc9('0x1d')](_0x41f66e,_0x5d61d7,!![]);}catch(_0x12f08d){return BPromise[_0x7dc9('0x1e')](_0x12f08d);}return _0x41f66e[_0x7dc9('0x1f')]();};}function saveUpdates(_0x184bfd,_0x2dad65){return function(_0x2895f5){if(_0x2895f5){return _0x2895f5[_0x7dc9('0x20')](_0x184bfd)[_0x7dc9('0x21')](function(_0x576681){return _0x576681;});}return null;};}function removeEntity(_0x593e60,_0x12954f){return function(_0x5981e2){if(_0x5981e2){return _0x5981e2['destroy']()[_0x7dc9('0x21')](function(){_0x593e60[_0x7dc9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffc080,_0x43d31f){return function(_0x41110a){if(!_0x41110a){_0xffc080['sendStatus'](0x194);}return _0x41110a;};}function handleError(_0x424763,_0x1e3a8d){_0x1e3a8d=_0x1e3a8d||0x1f4;return function(_0xf95336){logger['error'](_0xf95336['stack']);if(_0xf95336['name']){delete _0xf95336[_0x7dc9('0x22')];}_0x424763[_0x7dc9('0x18')](_0x1e3a8d)['send'](_0xf95336);};}exports['index']=function(_0x47771b,_0x5afb7d){var _0x2d22eb={},_0x1c690b={},_0x3a74a0={'count':0x0,'rows':[]};var _0x3e4102=_[_0x7dc9('0x23')](db[_0x7dc9('0x24')][_0x7dc9('0x25')],function(_0x229f8e){return{'name':_0x229f8e[_0x7dc9('0x26')],'type':_0x229f8e[_0x7dc9('0x27')][_0x7dc9('0x28')]};});_0x1c690b[_0x7dc9('0x29')]=_['map'](_0x3e4102,'name');_0x1c690b['query']=_['keys'](_0x47771b['query']);_0x1c690b['filters']=_['intersection'](_0x1c690b['model'],_0x1c690b[_0x7dc9('0x2a')]);_0x2d22eb[_0x7dc9('0x2b')]=_[_0x7dc9('0x2c')](_0x1c690b[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x47771b[_0x7dc9('0x2a')]['fields']));_0x2d22eb['attributes']=_0x2d22eb['attributes'][_0x7dc9('0x2e')]?_0x2d22eb['attributes']:_0x1c690b[_0x7dc9('0x29')];if(!_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x2f')](_0x7dc9('0x30'))){_0x2d22eb[_0x7dc9('0x31')]=qs[_0x7dc9('0x31')](_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x31')]);_0x2d22eb['offset']=qs[_0x7dc9('0x1b')](_0x47771b['query'][_0x7dc9('0x1b')]);}_0x2d22eb[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x47771b[_0x7dc9('0x2a')]['sort']);_0x2d22eb[_0x7dc9('0x34')]=qs['filters'](_[_0x7dc9('0x35')](_0x47771b['query'],_0x1c690b['filters']),_0x3e4102);if(_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]){_0x2d22eb[_0x7dc9('0x34')]=_[_0x7dc9('0x37')](_0x2d22eb['where'],{'$or':_[_0x7dc9('0x23')](_0x3e4102,function(_0x183d87){if(_0x183d87[_0x7dc9('0x27')]!==_0x7dc9('0x38')){var _0x4290b9={};_0x4290b9[_0x183d87[_0x7dc9('0x22')]]={'$like':'%'+_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]+'%'};return _0x4290b9;}})});}_0x2d22eb=_[_0x7dc9('0x37')]({},_0x2d22eb,_0x47771b[_0x7dc9('0x39')]);var _0x452aed={'where':_0x2d22eb[_0x7dc9('0x34')]};return db['UserProfileResource'][_0x7dc9('0x1a')](_0x452aed)[_0x7dc9('0x21')](function(_0x466b02){_0x3a74a0[_0x7dc9('0x1a')]=_0x466b02;if(_0x47771b['query'][_0x7dc9('0x3a')]){_0x2d22eb[_0x7dc9('0x3b')]=[{'all':!![]}];}return db[_0x7dc9('0x24')][_0x7dc9('0x3c')](_0x2d22eb);})[_0x7dc9('0x21')](function(_0x3436a6){_0x3a74a0['rows']=_0x3436a6;return _0x3a74a0;})['then'](respondWithFilteredResult(_0x5afb7d,_0x2d22eb))[_0x7dc9('0x3d')](handleError(_0x5afb7d,null));};exports[_0x7dc9('0x3e')]=function(_0x495100,_0x3a705c){var _0x4a37ec={'raw':![],'where':{'id':_0x495100[_0x7dc9('0x3f')]['id']}},_0x315d65={};_0x315d65[_0x7dc9('0x29')]=_['keys'](db[_0x7dc9('0x24')][_0x7dc9('0x25')]);_0x315d65[_0x7dc9('0x2a')]=_[_0x7dc9('0x40')](_0x495100[_0x7dc9('0x2a')]);_0x315d65[_0x7dc9('0x41')]=_[_0x7dc9('0x2c')](_0x315d65['model'],_0x315d65[_0x7dc9('0x2a')]);_0x4a37ec['attributes']=_['intersection'](_0x315d65[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x495100[_0x7dc9('0x2a')][_0x7dc9('0x2d')]));_0x4a37ec[_0x7dc9('0x2b')]=_0x4a37ec[_0x7dc9('0x2b')][_0x7dc9('0x2e')]?_0x4a37ec[_0x7dc9('0x2b')]:_0x315d65[_0x7dc9('0x29')];if(_0x495100['query'][_0x7dc9('0x3a')]){_0x4a37ec[_0x7dc9('0x3b')]=[{'all':!![]}];}_0x4a37ec=_[_0x7dc9('0x37')]({},_0x4a37ec,_0x495100[_0x7dc9('0x39')]);return db[_0x7dc9('0x24')][_0x7dc9('0x42')](_0x4a37ec)['then'](handleEntityNotFound(_0x3a705c,null))[_0x7dc9('0x21')](respondWithResult(_0x3a705c,null))[_0x7dc9('0x3d')](handleError(_0x3a705c,null));};exports['create']=function(_0x288c80,_0x1f7700){return db[_0x7dc9('0x24')]['create'](_0x288c80[_0x7dc9('0x43')],{})['then'](respondWithResult(_0x1f7700,0xc9))['catch'](handleError(_0x1f7700,null));};exports[_0x7dc9('0x20')]=function(_0x30a315,_0x36d591){if(_0x30a315['body']['id']){delete _0x30a315['body']['id'];}return db[_0x7dc9('0x24')]['find']({'where':{'id':_0x30a315[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x36d591,null))['then'](saveUpdates(_0x30a315[_0x7dc9('0x43')],null))[_0x7dc9('0x21')](respondWithResult(_0x36d591,null))[_0x7dc9('0x3d')](handleError(_0x36d591,null));};exports[_0x7dc9('0x44')]=function(_0x414bf4,_0x113087){return db[_0x7dc9('0x24')][_0x7dc9('0x42')]({'where':{'id':_0x414bf4[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x113087,null))[_0x7dc9('0x21')](removeEntity(_0x113087,null))[_0x7dc9('0x3d')](handleError(_0x113087,null));};exports[_0x7dc9('0x45')]=function(_0x59be9b,_0x3132b1){return db['UserProfileResource']['describe']()[_0x7dc9('0x21')](respondWithResult(_0x3132b1,null))[_0x7dc9('0x3d')](handleError(_0x3132b1,null));}; \ No newline at end of file +var _0x7bae=['include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','UserProfileResource'];(function(_0x549c12,_0x3ac29f){var _0x25dd31=function(_0x3d1097){while(--_0x3d1097){_0x549c12['push'](_0x549c12['shift']());}};_0x25dd31(++_0x3ac29f);}(_0x7bae,0x13b));var _0xe7ba=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x7bae[_0x28d18d];return _0x470640;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7ba('0x0'));var zipdir=require(_0xe7ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7ba('0x2'));var moment=require('moment');var BPromise=require(_0xe7ba('0x3'));var Mustache=require(_0xe7ba('0x4'));var util=require(_0xe7ba('0x5'));var path=require(_0xe7ba('0x6'));var sox=require(_0xe7ba('0x7'));var csv=require(_0xe7ba('0x8'));var ejs=require(_0xe7ba('0x9'));var fs=require('fs');var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x8'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4fcb0,_0x588c8b){_0x588c8b=_0x588c8b||0xcc;return function(_0x602b1){if(_0x602b1){return _0xf4fcb0[_0xe7ba('0x19')](_0x588c8b);}return _0xf4fcb0[_0xe7ba('0x1a')](_0x588c8b)[_0xe7ba('0x1b')]();};}function respondWithResult(_0x15d018,_0x41369f){_0x41369f=_0x41369f||0xc8;return function(_0x561dbb){if(_0x561dbb){return _0x15d018['status'](_0x41369f)[_0xe7ba('0x1c')](_0x561dbb);}};}function respondWithFilteredResult(_0x7ba72a,_0x359f6f){return function(_0x5d1d03){if(_0x5d1d03){var _0x4390e3=_0x5d1d03[_0xe7ba('0x1d')],_0x4b20fd=_0x359f6f['offset'],_0x590bab=_0x359f6f[_0xe7ba('0x1e')]+_0x359f6f['limit'],_0x5e9176;if(_0x590bab>=_0x4390e3){_0x590bab=_0x4390e3;_0x5e9176=0xc8;}else{_0x5e9176=0xce;}_0x7ba72a['status'](_0x5e9176);return _0x7ba72a['set'](_0xe7ba('0x1f'),_0x4b20fd+'-'+_0x590bab+'/'+_0x4390e3)[_0xe7ba('0x1c')](_0x5d1d03);}return null;};}function patchUpdates(_0x39ca38){return function(_0x3c06c3){try{jsonpatch[_0xe7ba('0x20')](_0x3c06c3,_0x39ca38,!![]);}catch(_0x58550c){return BPromise[_0xe7ba('0x21')](_0x58550c);}return _0x3c06c3[_0xe7ba('0x22')]();};}function saveUpdates(_0x3b40fb,_0x136ec6){return function(_0x4aaf35){if(_0x4aaf35){return _0x4aaf35[_0xe7ba('0x23')](_0x3b40fb)[_0xe7ba('0x24')](function(_0x5a158f){return _0x5a158f;});}return null;};}function removeEntity(_0x191863,_0x4514e8){return function(_0x27c882){if(_0x27c882){return _0x27c882[_0xe7ba('0x25')]()[_0xe7ba('0x24')](function(){_0x191863[_0xe7ba('0x1a')](0xcc)[_0xe7ba('0x1b')]();});}};}function handleEntityNotFound(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(!_0xa72f1c){_0x2b29f0['sendStatus'](0x194);}return _0xa72f1c;};}function handleError(_0x48b481,_0x4dcc7b){_0x4dcc7b=_0x4dcc7b||0x1f4;return function(_0x4cd124){logger[_0xe7ba('0x26')](_0x4cd124['stack']);if(_0x4cd124['name']){delete _0x4cd124['name'];}_0x48b481[_0xe7ba('0x1a')](_0x4dcc7b)[_0xe7ba('0x27')](_0x4cd124);};}exports[_0xe7ba('0x28')]=function(_0x2ea78a,_0x3435c6){var _0xc88099={},_0x4ed792={},_0x3a59d6={'count':0x0,'rows':[]};var _0x47be66=_[_0xe7ba('0x29')](db['UserProfileResource'][_0xe7ba('0x2a')],function(_0x92fe7){return{'name':_0x92fe7[_0xe7ba('0x2b')],'type':_0x92fe7['type']['key']};});_0x4ed792[_0xe7ba('0x2c')]=_[_0xe7ba('0x29')](_0x47be66,_0xe7ba('0x2d'));_0x4ed792[_0xe7ba('0x2e')]=_[_0xe7ba('0x2f')](_0x2ea78a['query']);_0x4ed792[_0xe7ba('0x30')]=_[_0xe7ba('0x31')](_0x4ed792['model'],_0x4ed792[_0xe7ba('0x2e')]);_0xc88099['attributes']=_['intersection'](_0x4ed792[_0xe7ba('0x2c')],qs[_0xe7ba('0x32')](_0x2ea78a[_0xe7ba('0x2e')]['fields']));_0xc88099[_0xe7ba('0x33')]=_0xc88099['attributes'][_0xe7ba('0x34')]?_0xc88099[_0xe7ba('0x33')]:_0x4ed792[_0xe7ba('0x2c')];if(!_0x2ea78a[_0xe7ba('0x2e')][_0xe7ba('0x35')]('nolimit')){_0xc88099[_0xe7ba('0x36')]=qs[_0xe7ba('0x36')](_0x2ea78a['query'][_0xe7ba('0x36')]);_0xc88099[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x2ea78a['query'][_0xe7ba('0x1e')]);}_0xc88099[_0xe7ba('0x37')]=qs['sort'](_0x2ea78a[_0xe7ba('0x2e')][_0xe7ba('0x38')]);_0xc88099[_0xe7ba('0x39')]=qs['filters'](_[_0xe7ba('0x3a')](_0x2ea78a[_0xe7ba('0x2e')],_0x4ed792['filters']),_0x47be66);if(_0x2ea78a[_0xe7ba('0x2e')][_0xe7ba('0x3b')]){_0xc88099[_0xe7ba('0x39')]=_['merge'](_0xc88099['where'],{'$or':_[_0xe7ba('0x29')](_0x47be66,function(_0x2ebb27){if(_0x2ebb27[_0xe7ba('0x3c')]!==_0xe7ba('0x3d')){var _0x3581ef={};_0x3581ef[_0x2ebb27['name']]={'$like':'%'+_0x2ea78a[_0xe7ba('0x2e')][_0xe7ba('0x3b')]+'%'};return _0x3581ef;}})});}_0xc88099=_[_0xe7ba('0x3e')]({},_0xc88099,_0x2ea78a[_0xe7ba('0x3f')]);var _0x5e9619={'where':_0xc88099[_0xe7ba('0x39')]};return db[_0xe7ba('0x40')][_0xe7ba('0x1d')](_0x5e9619)[_0xe7ba('0x24')](function(_0x35a5f3){_0x3a59d6[_0xe7ba('0x1d')]=_0x35a5f3;if(_0x2ea78a[_0xe7ba('0x2e')]['includeAll']){_0xc88099[_0xe7ba('0x41')]=[{'all':!![]}];}return db[_0xe7ba('0x40')][_0xe7ba('0x42')](_0xc88099);})[_0xe7ba('0x24')](function(_0xf61205){_0x3a59d6[_0xe7ba('0x43')]=_0xf61205;return _0x3a59d6;})[_0xe7ba('0x24')](respondWithFilteredResult(_0x3435c6,_0xc88099))[_0xe7ba('0x44')](handleError(_0x3435c6,null));};exports[_0xe7ba('0x45')]=function(_0x50792c,_0x22668f){var _0x417734={'raw':![],'where':{'id':_0x50792c['params']['id']}},_0x5d4be2={};_0x5d4be2[_0xe7ba('0x2c')]=_[_0xe7ba('0x2f')](db[_0xe7ba('0x40')]['rawAttributes']);_0x5d4be2[_0xe7ba('0x2e')]=_[_0xe7ba('0x2f')](_0x50792c[_0xe7ba('0x2e')]);_0x5d4be2[_0xe7ba('0x30')]=_[_0xe7ba('0x31')](_0x5d4be2['model'],_0x5d4be2[_0xe7ba('0x2e')]);_0x417734['attributes']=_[_0xe7ba('0x31')](_0x5d4be2[_0xe7ba('0x2c')],qs[_0xe7ba('0x32')](_0x50792c[_0xe7ba('0x2e')][_0xe7ba('0x32')]));_0x417734[_0xe7ba('0x33')]=_0x417734[_0xe7ba('0x33')][_0xe7ba('0x34')]?_0x417734['attributes']:_0x5d4be2[_0xe7ba('0x2c')];if(_0x50792c[_0xe7ba('0x2e')][_0xe7ba('0x46')]){_0x417734[_0xe7ba('0x41')]=[{'all':!![]}];}_0x417734=_[_0xe7ba('0x3e')]({},_0x417734,_0x50792c[_0xe7ba('0x3f')]);return db[_0xe7ba('0x40')][_0xe7ba('0x47')](_0x417734)[_0xe7ba('0x24')](handleEntityNotFound(_0x22668f,null))[_0xe7ba('0x24')](respondWithResult(_0x22668f,null))['catch'](handleError(_0x22668f,null));};exports[_0xe7ba('0x48')]=function(_0x5c447d,_0x31ac09){return db[_0xe7ba('0x40')][_0xe7ba('0x48')](_0x5c447d[_0xe7ba('0x49')],{})[_0xe7ba('0x24')](respondWithResult(_0x31ac09,0xc9))[_0xe7ba('0x44')](handleError(_0x31ac09,null));};exports['update']=function(_0x271592,_0x1cc668){if(_0x271592[_0xe7ba('0x49')]['id']){delete _0x271592[_0xe7ba('0x49')]['id'];}return db[_0xe7ba('0x40')][_0xe7ba('0x47')]({'where':{'id':_0x271592[_0xe7ba('0x4a')]['id']}})[_0xe7ba('0x24')](handleEntityNotFound(_0x1cc668,null))[_0xe7ba('0x24')](saveUpdates(_0x271592[_0xe7ba('0x49')],null))[_0xe7ba('0x24')](respondWithResult(_0x1cc668,null))['catch'](handleError(_0x1cc668,null));};exports[_0xe7ba('0x25')]=function(_0x1270bd,_0x198d8d){return db[_0xe7ba('0x40')][_0xe7ba('0x47')]({'where':{'id':_0x1270bd[_0xe7ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x198d8d,null))[_0xe7ba('0x24')](removeEntity(_0x198d8d,null))[_0xe7ba('0x44')](handleError(_0x198d8d,null));};exports['describe']=function(_0x330ebd,_0x704dae){return db[_0xe7ba('0x40')][_0xe7ba('0x4b')]()['then'](respondWithResult(_0x704dae,null))['catch'](handleError(_0x704dae,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 05b4a84..658aedc 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 _0xb58b=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','bluebird','request-promise','rimraf','./userProfileResource.attributes'];(function(_0x34a27d,_0x27ad23){var _0xde9384=function(_0xd458b9){while(--_0xd458b9){_0x34a27d['push'](_0x34a27d['shift']());}};_0xde9384(++_0x27ad23);}(_0xb58b,0x1f1));var _0xbb58=function(_0x2fcd07,_0x29b229){_0x2fcd07=_0x2fcd07-0x0;var _0x809dc0=_0xb58b[_0x2fcd07];return _0x809dc0;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[{'name':_0xbb58('0xb'),'fields':[_0xbb58('0xc'),_0xbb58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['request-promise','path','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId','util','api','bluebird'];(function(_0x37b308,_0x539a97){var _0x2dec75=function(_0x3b627b){while(--_0x3b627b){_0x37b308['push'](_0x37b308['shift']());}};_0x2dec75(++_0x539a97);}(_0x5ff3,0x17d));var _0x35ff=function(_0x284490,_0x25dddb){_0x284490=_0x284490-0x0;var _0x3e941d=_0x5ff3[_0x284490];return _0x3e941d;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('UserProfileResource',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x35ff('0xa'),_0x35ff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1ccaafd..5b397b2 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 _0x15c6=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x535a20,_0x278ee4){var _0x13d870=function(_0x3ae1f0){while(--_0x3ae1f0){_0x535a20['push'](_0x535a20['shift']());}};_0x13d870(++_0x278ee4);}(_0x15c6,0x116));var _0x615c=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x15c6[_0x48fff1];return _0x127a1d;};'use strict';var _=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var moment=require(_0x615c('0x2'));var BPromise=require(_0x615c('0x3'));var rs=require(_0x615c('0x4'));var fs=require('fs');var Redis=require(_0x615c('0x5'));var db=require(_0x615c('0x6'))['db'];var utils=require(_0x615c('0x7'));var logger=require(_0x615c('0x8'))(_0x615c('0x9'));var config=require(_0x615c('0xa'));var jayson=require(_0x615c('0xb'));var client=jayson[_0x615c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d37f2,_0x3efb85,_0x3f5139){return new BPromise(function(_0x13f709,_0x2489d7){return client[_0x615c('0xd')](_0x2d37f2,_0x3f5139)['then'](function(_0x156251){logger[_0x615c('0xe')](_0x615c('0xf'),_0x3efb85,_0x615c('0x10'));logger[_0x615c('0x11')](_0x615c('0x12'),_0x3efb85,'request\x20sent',JSON[_0x615c('0x13')](_0x156251));if(_0x156251['error']){if(_0x156251['error']['code']===0x1f4){logger[_0x615c('0x14')](_0x615c('0xf'),_0x3efb85,_0x156251['error'][_0x615c('0x15')]);return _0x2489d7(_0x156251['error'][_0x615c('0x15')]);}logger['error'](_0x615c('0xf'),_0x3efb85,_0x156251[_0x615c('0x14')][_0x615c('0x15')]);return _0x13f709(_0x156251[_0x615c('0x14')]['message']);}else{logger[_0x615c('0xe')](_0x615c('0xf'),_0x3efb85,_0x615c('0x10'));_0x13f709(_0x156251[_0x615c('0x16')][_0x615c('0x15')]);}})['catch'](function(_0x5dee53){logger[_0x615c('0x14')](_0x615c('0xf'),_0x3efb85,_0x5dee53);_0x2489d7(_0x5dee53);});});} \ No newline at end of file +var _0x8ac9=['jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0xc60870,_0x57048f){var _0x33f000=function(_0x5f59a0){while(--_0x5f59a0){_0xc60870['push'](_0xc60870['shift']());}};_0x33f000(++_0x57048f);}(_0x8ac9,0x12a));var _0x98ac=function(_0x34817b,_0x20294d){_0x34817b=_0x34817b-0x0;var _0x2beab2=_0x8ac9[_0x34817b];return _0x2beab2;};'use strict';var _=require(_0x98ac('0x0'));var util=require('util');var moment=require(_0x98ac('0x1'));var BPromise=require(_0x98ac('0x2'));var rs=require(_0x98ac('0x3'));var fs=require('fs');var Redis=require(_0x98ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98ac('0x5'));var logger=require('../../config/logger')(_0x98ac('0x6'));var config=require(_0x98ac('0x7'));var jayson=require(_0x98ac('0x8'));var client=jayson[_0x98ac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42aa9f,_0x37b712,_0x3c3c7f){return new BPromise(function(_0x41b386,_0x3639b6){return client[_0x98ac('0xa')](_0x42aa9f,_0x3c3c7f)[_0x98ac('0xb')](function(_0x3acb26){logger['info'](_0x98ac('0xc'),_0x37b712,'request\x20sent');logger['debug'](_0x98ac('0xd'),_0x37b712,'request\x20sent',JSON['stringify'](_0x3acb26));if(_0x3acb26[_0x98ac('0xe')]){if(_0x3acb26[_0x98ac('0xe')]['code']===0x1f4){logger[_0x98ac('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x37b712,_0x3acb26[_0x98ac('0xe')]['message']);return _0x3639b6(_0x3acb26['error'][_0x98ac('0xf')]);}logger[_0x98ac('0xe')](_0x98ac('0xc'),_0x37b712,_0x3acb26['error'][_0x98ac('0xf')]);return _0x41b386(_0x3acb26[_0x98ac('0xe')][_0x98ac('0xf')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x37b712,_0x98ac('0x10'));_0x41b386(_0x3acb26[_0x98ac('0x11')][_0x98ac('0xf')]);}})['catch'](function(_0x352eda){logger[_0x98ac('0xe')](_0x98ac('0xc'),_0x37b712,_0x352eda);_0x3639b6(_0x352eda);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d383348..5b1674f 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 _0x5f3a=['post','/:id','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show'];(function(_0xa7d678,_0x3dfdff){var _0x5cc539=function(_0x4393d7){while(--_0x4393d7){_0xa7d678['push'](_0xa7d678['shift']());}};_0x5cc539(++_0x3dfdff);}(_0x5f3a,0x16d));var _0xa5f3=function(_0x3b1aec,_0x4a66ff){_0x3b1aec=_0x3b1aec-0x0;var _0x574c45=_0x5f3a[_0x3b1aec];return _0x574c45;};'use strict';var multer=require(_0xa5f3('0x0'));var util=require(_0xa5f3('0x1'));var path=require(_0xa5f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa5f3('0x3')]();var auth=require(_0xa5f3('0x4'));var interaction=require(_0xa5f3('0x5'));var config=require(_0xa5f3('0x6'));var controller=require(_0xa5f3('0x7'));router[_0xa5f3('0x8')]('/',auth[_0xa5f3('0x9')](),controller['index']);router[_0xa5f3('0x8')](_0xa5f3('0xa'),auth[_0xa5f3('0x9')](),controller[_0xa5f3('0xb')]);router['get']('/:id',auth[_0xa5f3('0x9')](),controller[_0xa5f3('0xc')]);router[_0xa5f3('0xd')]('/',auth[_0xa5f3('0x9')](),controller['create']);router['put'](_0xa5f3('0xe'),auth[_0xa5f3('0x9')](),controller[_0xa5f3('0xf')]);router[_0xa5f3('0x10')](_0xa5f3('0xe'),auth[_0xa5f3('0x9')](),controller[_0xa5f3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdb73=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x15e490,_0x3776ba){var _0x558233=function(_0x50b26e){while(--_0x50b26e){_0x15e490['push'](_0x15e490['shift']());}};_0x558233(++_0x3776ba);}(_0xdb73,0xe7));var _0x3db7=function(_0x356f4a,_0x4460f9){_0x356f4a=_0x356f4a-0x0;var _0x39d51a=_0xdb73[_0x356f4a];return _0x39d51a;};'use strict';var multer=require(_0x3db7('0x0'));var util=require(_0x3db7('0x1'));var path=require(_0x3db7('0x2'));var timeout=require(_0x3db7('0x3'));var express=require(_0x3db7('0x4'));var router=express[_0x3db7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3db7('0x6'));var config=require(_0x3db7('0x7'));var controller=require(_0x3db7('0x8'));router[_0x3db7('0x9')]('/',auth[_0x3db7('0xa')](),controller['index']);router[_0x3db7('0x9')](_0x3db7('0xb'),auth[_0x3db7('0xa')](),controller[_0x3db7('0xc')]);router['get'](_0x3db7('0xd'),auth['isAuthenticated'](),controller[_0x3db7('0xe')]);router[_0x3db7('0xf')]('/',auth[_0x3db7('0xa')](),controller[_0x3db7('0x10')]);router[_0x3db7('0x11')](_0x3db7('0xd'),auth['isAuthenticated'](),controller[_0x3db7('0x12')]);router[_0x3db7('0x13')](_0x3db7('0xd'),auth[_0x3db7('0xa')](),controller[_0x3db7('0x14')]);module[_0x3db7('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b1a342e..998e9c4 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 _0xa24e=['BOOLEAN','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x52e68a,_0x58bed4){var _0x3f8611=function(_0xf13f57){while(--_0xf13f57){_0x52e68a['push'](_0x52e68a['shift']());}};_0x3f8611(++_0x58bed4);}(_0xa24e,0x137));var _0xea24=function(_0x9ba307,_0x570631){_0x9ba307=_0x9ba307-0x0;var _0x335d04=_0xa24e[_0x9ba307];return _0x335d04;};'use strict';var Sequelize=require(_0xea24('0x0'));module[_0xea24('0x1')]={'name':{'type':Sequelize[_0xea24('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xea24('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xea24('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xea24('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xea24('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xea24('0x2')],'set':function(_0x403530){this['setDataValue'](_0xea24('0x5'),_0x403530?_0x403530[_0xea24('0x6')](''):[]);},'get':function(){return this[_0xea24('0x7')](_0xea24('0x5'))?this[_0xea24('0x7')]('crudPermissions')[_0xea24('0x8')](''):[];}}}; \ No newline at end of file +var _0x5620=['crudPermissions','split','sequelize','STRING','setDataValue','join','getDataValue'];(function(_0x31ec9a,_0x1398e0){var _0x1bf996=function(_0xed27e7){while(--_0xed27e7){_0x31ec9a['push'](_0x31ec9a['shift']());}};_0x1bf996(++_0x1398e0);}(_0x5620,0xbf));var _0x0562=function(_0x24a737,_0x3ff299){_0x24a737=_0x24a737-0x0;var _0x37b618=_0x5620[_0x24a737];return _0x37b618;};'use strict';var Sequelize=require(_0x0562('0x0'));module['exports']={'name':{'type':Sequelize[_0x0562('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0562('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0562('0x1')],'set':function(_0x4ef07f){this[_0x0562('0x2')]('crudPermissions',_0x4ef07f?_0x4ef07f[_0x0562('0x3')](''):[]);},'get':function(){return this[_0x0562('0x4')](_0x0562('0x5'))?this[_0x0562('0x4')](_0x0562('0x5'))[_0x0562('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 09762d2..c0f98dd 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 _0xf72f=['catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','UserProfileSection','include','findAll','rows'];(function(_0x8dd519,_0x2f5484){var _0x267c69=function(_0x181b42){while(--_0x181b42){_0x8dd519['push'](_0x8dd519['shift']());}};_0x267c69(++_0x2f5484);}(_0xf72f,0x171));var _0xff72=function(_0x42ef75,_0x2279fa){_0x42ef75=_0x42ef75-0x0;var _0x31571b=_0xf72f[_0x42ef75];return _0x31571b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff72('0x0'));var rimraf=require(_0xff72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff72('0x2'));var rp=require(_0xff72('0x3'));var moment=require(_0xff72('0x4'));var BPromise=require(_0xff72('0x5'));var Mustache=require(_0xff72('0x6'));var util=require(_0xff72('0x7'));var path=require(_0xff72('0x8'));var sox=require(_0xff72('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xff72('0xa'));var squel=require('squel');var crypto=require(_0xff72('0xb'));var jsforce=require(_0xff72('0xc'));var deskjs=require(_0xff72('0xd'));var toCsv=require(_0xff72('0xe'));var querystring=require(_0xff72('0xf'));var Papa=require(_0xff72('0x10'));var Redis=require(_0xff72('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xff72('0x12'));var as=require(_0xff72('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xff72('0x14'));var config=require('../../config/environment');var db=require(_0xff72('0x15'))['db'];function respondWithStatusCode(_0x5cd1f4,_0x4c720a){_0x4c720a=_0x4c720a||0xcc;return function(_0x3a2744){if(_0x3a2744){return _0x5cd1f4[_0xff72('0x16')](_0x4c720a);}return _0x5cd1f4[_0xff72('0x17')](_0x4c720a)[_0xff72('0x18')]();};}function respondWithResult(_0x56a9f4,_0x22dabc){_0x22dabc=_0x22dabc||0xc8;return function(_0x50cd3f){if(_0x50cd3f){return _0x56a9f4['status'](_0x22dabc)[_0xff72('0x19')](_0x50cd3f);}};}function respondWithFilteredResult(_0x2a1c39,_0x43ec9b){return function(_0x30d10c){if(_0x30d10c){var _0xf7b15e=_0x30d10c[_0xff72('0x1a')],_0x2f7385=_0x43ec9b[_0xff72('0x1b')],_0x4d7514=_0x43ec9b[_0xff72('0x1b')]+_0x43ec9b['limit'],_0x40b2de;if(_0x4d7514>=_0xf7b15e){_0x4d7514=_0xf7b15e;_0x40b2de=0xc8;}else{_0x40b2de=0xce;}_0x2a1c39[_0xff72('0x17')](_0x40b2de);return _0x2a1c39[_0xff72('0x1c')](_0xff72('0x1d'),_0x2f7385+'-'+_0x4d7514+'/'+_0xf7b15e)[_0xff72('0x19')](_0x30d10c);}return null;};}function patchUpdates(_0x532cee){return function(_0x50d996){try{jsonpatch[_0xff72('0x1e')](_0x50d996,_0x532cee,!![]);}catch(_0x292558){return BPromise['reject'](_0x292558);}return _0x50d996[_0xff72('0x1f')]();};}function saveUpdates(_0x28ae2b,_0x12ed64){return function(_0x5dad57){if(_0x5dad57){return _0x5dad57[_0xff72('0x20')](_0x28ae2b)['then'](function(_0x4e3b7f){return _0x4e3b7f;});}return null;};}function removeEntity(_0x46b096,_0x218336){return function(_0x52bc46){if(_0x52bc46){return _0x52bc46['destroy']()[_0xff72('0x21')](function(){_0x46b096[_0xff72('0x17')](0xcc)[_0xff72('0x18')]();});}};}function handleEntityNotFound(_0x654882,_0x23c2ba){return function(_0x147af0){if(!_0x147af0){_0x654882[_0xff72('0x16')](0x194);}return _0x147af0;};}function handleError(_0x4d3a8c,_0x51f5db){_0x51f5db=_0x51f5db||0x1f4;return function(_0x192f32){logger[_0xff72('0x22')](_0x192f32['stack']);if(_0x192f32[_0xff72('0x23')]){delete _0x192f32['name'];}_0x4d3a8c[_0xff72('0x17')](_0x51f5db)[_0xff72('0x24')](_0x192f32);};}exports[_0xff72('0x25')]=function(_0x13b910,_0x63c267){var _0xf8ce1c={},_0x21e0fe={},_0x1e2b62={'count':0x0,'rows':[]};var _0x161571=_[_0xff72('0x26')](db['UserProfileSection'][_0xff72('0x27')],function(_0x2c8631){return{'name':_0x2c8631[_0xff72('0x28')],'type':_0x2c8631['type'][_0xff72('0x29')]};});_0x21e0fe[_0xff72('0x2a')]=_['map'](_0x161571,_0xff72('0x23'));_0x21e0fe[_0xff72('0x2b')]=_[_0xff72('0x2c')](_0x13b910[_0xff72('0x2b')]);_0x21e0fe['filters']=_[_0xff72('0x2d')](_0x21e0fe[_0xff72('0x2a')],_0x21e0fe[_0xff72('0x2b')]);_0xf8ce1c[_0xff72('0x2e')]=_['intersection'](_0x21e0fe[_0xff72('0x2a')],qs[_0xff72('0x2f')](_0x13b910['query'][_0xff72('0x2f')]));_0xf8ce1c[_0xff72('0x2e')]=_0xf8ce1c['attributes']['length']?_0xf8ce1c[_0xff72('0x2e')]:_0x21e0fe[_0xff72('0x2a')];if(!_0x13b910[_0xff72('0x2b')][_0xff72('0x30')](_0xff72('0x31'))){_0xf8ce1c[_0xff72('0x32')]=qs[_0xff72('0x32')](_0x13b910[_0xff72('0x2b')][_0xff72('0x32')]);_0xf8ce1c[_0xff72('0x1b')]=qs[_0xff72('0x1b')](_0x13b910[_0xff72('0x2b')][_0xff72('0x1b')]);}_0xf8ce1c[_0xff72('0x33')]=qs[_0xff72('0x34')](_0x13b910['query'][_0xff72('0x34')]);_0xf8ce1c[_0xff72('0x35')]=qs[_0xff72('0x36')](_['pick'](_0x13b910[_0xff72('0x2b')],_0x21e0fe[_0xff72('0x36')]),_0x161571);if(_0x13b910['query'][_0xff72('0x37')]){_0xf8ce1c[_0xff72('0x35')]=_[_0xff72('0x38')](_0xf8ce1c[_0xff72('0x35')],{'$or':_['map'](_0x161571,function(_0x481866){if(_0x481866[_0xff72('0x39')]!==_0xff72('0x3a')){var _0xe9068={};_0xe9068[_0x481866[_0xff72('0x23')]]={'$like':'%'+_0x13b910[_0xff72('0x2b')]['filter']+'%'};return _0xe9068;}})});}_0xf8ce1c=_[_0xff72('0x38')]({},_0xf8ce1c,_0x13b910['options']);var _0x2c04ed={'where':_0xf8ce1c[_0xff72('0x35')]};return db[_0xff72('0x3b')][_0xff72('0x1a')](_0x2c04ed)['then'](function(_0x1432c3){_0x1e2b62[_0xff72('0x1a')]=_0x1432c3;if(_0x13b910[_0xff72('0x2b')]['includeAll']){_0xf8ce1c[_0xff72('0x3c')]=[{'all':!![]}];}return db[_0xff72('0x3b')][_0xff72('0x3d')](_0xf8ce1c);})[_0xff72('0x21')](function(_0xd19d7a){_0x1e2b62[_0xff72('0x3e')]=_0xd19d7a;return _0x1e2b62;})[_0xff72('0x21')](respondWithFilteredResult(_0x63c267,_0xf8ce1c))[_0xff72('0x3f')](handleError(_0x63c267,null));};exports[_0xff72('0x40')]=function(_0x4428b7,_0x3f33e9){var _0x4c534e={'raw':![],'where':{'id':_0x4428b7[_0xff72('0x41')]['id']}},_0x24c09e={};_0x24c09e['model']=_[_0xff72('0x2c')](db[_0xff72('0x3b')][_0xff72('0x27')]);_0x24c09e['query']=_[_0xff72('0x2c')](_0x4428b7[_0xff72('0x2b')]);_0x24c09e[_0xff72('0x36')]=_[_0xff72('0x2d')](_0x24c09e['model'],_0x24c09e[_0xff72('0x2b')]);_0x4c534e['attributes']=_[_0xff72('0x2d')](_0x24c09e['model'],qs[_0xff72('0x2f')](_0x4428b7[_0xff72('0x2b')][_0xff72('0x2f')]));_0x4c534e[_0xff72('0x2e')]=_0x4c534e[_0xff72('0x2e')][_0xff72('0x42')]?_0x4c534e['attributes']:_0x24c09e[_0xff72('0x2a')];if(_0x4428b7[_0xff72('0x2b')][_0xff72('0x43')]){_0x4c534e['include']=[{'all':!![]}];}_0x4c534e=_[_0xff72('0x38')]({},_0x4c534e,_0x4428b7['options']);return db[_0xff72('0x3b')]['find'](_0x4c534e)['then'](handleEntityNotFound(_0x3f33e9,null))['then'](respondWithResult(_0x3f33e9,null))[_0xff72('0x3f')](handleError(_0x3f33e9,null));};exports[_0xff72('0x44')]=function(_0x264df6,_0x4c5a90){return db['UserProfileSection'][_0xff72('0x44')](_0x264df6[_0xff72('0x45')],{})[_0xff72('0x21')](respondWithResult(_0x4c5a90,0xc9))[_0xff72('0x3f')](handleError(_0x4c5a90,null));};exports['update']=function(_0x399683,_0x53d30a){if(_0x399683[_0xff72('0x45')]['id']){delete _0x399683[_0xff72('0x45')]['id'];}return db['UserProfileSection'][_0xff72('0x46')]({'where':{'id':_0x399683[_0xff72('0x41')]['id']}})[_0xff72('0x21')](handleEntityNotFound(_0x53d30a,null))['then'](saveUpdates(_0x399683['body'],null))['then'](respondWithResult(_0x53d30a,null))[_0xff72('0x3f')](handleError(_0x53d30a,null));};exports['destroy']=function(_0x2dd3d6,_0x4c8dd2){return db['UserProfileSection'][_0xff72('0x46')]({'where':{'id':_0x2dd3d6[_0xff72('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c8dd2,null))[_0xff72('0x21')](removeEntity(_0x4c8dd2,null))['catch'](handleError(_0x4c8dd2,null));};exports[_0xff72('0x47')]=function(_0x538730,_0x1e433a){return db[_0xff72('0x3b')][_0xff72('0x47')]()[_0xff72('0x21')](respondWithResult(_0x1e433a,null))[_0xff72('0x3f')](handleError(_0x1e433a,null));}; \ No newline at end of file +var _0x4297=['sendStatus','stack','name','send','map','UserProfileSection','fieldName','type','model','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x4297,0x13a));var _0x7429=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x4297[_0x22d7bb];return _0x40a737;};'use strict';var pdf=require(_0x7429('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7429('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7429('0x2'));var rp=require(_0x7429('0x3'));var moment=require(_0x7429('0x4'));var BPromise=require(_0x7429('0x5'));var Mustache=require(_0x7429('0x6'));var util=require(_0x7429('0x7'));var path=require(_0x7429('0x8'));var sox=require(_0x7429('0x9'));var csv=require(_0x7429('0xa'));var ejs=require(_0x7429('0xb'));var fs=require('fs');var _=require(_0x7429('0xc'));var squel=require('squel');var crypto=require(_0x7429('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7429('0xa'));var querystring=require(_0x7429('0xe'));var Papa=require(_0x7429('0xf'));var Redis=require(_0x7429('0x10'));var authService=require(_0x7429('0x11'));var qs=require(_0x7429('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7429('0x13'));var logger=require(_0x7429('0x14'))(_0x7429('0x15'));var utils=require(_0x7429('0x16'));var config=require(_0x7429('0x17'));var db=require(_0x7429('0x18'))['db'];function respondWithStatusCode(_0x3bf3b7,_0x3d3e04){_0x3d3e04=_0x3d3e04||0xcc;return function(_0x4d75c3){if(_0x4d75c3){return _0x3bf3b7['sendStatus'](_0x3d3e04);}return _0x3bf3b7[_0x7429('0x19')](_0x3d3e04)['end']();};}function respondWithResult(_0x2a98d2,_0x4dadb8){_0x4dadb8=_0x4dadb8||0xc8;return function(_0xbca794){if(_0xbca794){return _0x2a98d2[_0x7429('0x19')](_0x4dadb8)[_0x7429('0x1a')](_0xbca794);}};}function respondWithFilteredResult(_0x37444d,_0x4ddaa5){return function(_0x195745){if(_0x195745){var _0x1dd711=_0x195745[_0x7429('0x1b')],_0x41104f=_0x4ddaa5['offset'],_0x11a5d5=_0x4ddaa5[_0x7429('0x1c')]+_0x4ddaa5[_0x7429('0x1d')],_0x46b6a3;if(_0x11a5d5>=_0x1dd711){_0x11a5d5=_0x1dd711;_0x46b6a3=0xc8;}else{_0x46b6a3=0xce;}_0x37444d['status'](_0x46b6a3);return _0x37444d['set'](_0x7429('0x1e'),_0x41104f+'-'+_0x11a5d5+'/'+_0x1dd711)[_0x7429('0x1a')](_0x195745);}return null;};}function patchUpdates(_0x14fd37){return function(_0xc9258b){try{jsonpatch[_0x7429('0x1f')](_0xc9258b,_0x14fd37,!![]);}catch(_0x1dc00a){return BPromise['reject'](_0x1dc00a);}return _0xc9258b[_0x7429('0x20')]();};}function saveUpdates(_0x15cb78,_0x3cf455){return function(_0xca4a7d){if(_0xca4a7d){return _0xca4a7d[_0x7429('0x21')](_0x15cb78)[_0x7429('0x22')](function(_0x3b33e3){return _0x3b33e3;});}return null;};}function removeEntity(_0x4ea4e2,_0x5896ea){return function(_0x518b76){if(_0x518b76){return _0x518b76[_0x7429('0x23')]()[_0x7429('0x22')](function(){_0x4ea4e2[_0x7429('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2deb,_0x5b0410){return function(_0x3a1c08){if(!_0x3a1c08){_0x2b2deb[_0x7429('0x24')](0x194);}return _0x3a1c08;};}function handleError(_0x5a5120,_0x44d54d){_0x44d54d=_0x44d54d||0x1f4;return function(_0x6f61de){logger['error'](_0x6f61de[_0x7429('0x25')]);if(_0x6f61de[_0x7429('0x26')]){delete _0x6f61de[_0x7429('0x26')];}_0x5a5120[_0x7429('0x19')](_0x44d54d)[_0x7429('0x27')](_0x6f61de);};}exports['index']=function(_0x46a8e8,_0x2d850d){var _0x58579c={},_0x446b13={},_0x5e621b={'count':0x0,'rows':[]};var _0x190ff1=_[_0x7429('0x28')](db[_0x7429('0x29')]['rawAttributes'],function(_0x23804c){return{'name':_0x23804c[_0x7429('0x2a')],'type':_0x23804c[_0x7429('0x2b')]['key']};});_0x446b13[_0x7429('0x2c')]=_['map'](_0x190ff1,_0x7429('0x26'));_0x446b13[_0x7429('0x2d')]=_['keys'](_0x46a8e8['query']);_0x446b13[_0x7429('0x2e')]=_['intersection'](_0x446b13[_0x7429('0x2c')],_0x446b13[_0x7429('0x2d')]);_0x58579c[_0x7429('0x2f')]=_[_0x7429('0x30')](_0x446b13['model'],qs[_0x7429('0x31')](_0x46a8e8[_0x7429('0x2d')]['fields']));_0x58579c['attributes']=_0x58579c['attributes']['length']?_0x58579c['attributes']:_0x446b13['model'];if(!_0x46a8e8[_0x7429('0x2d')]['hasOwnProperty'](_0x7429('0x32'))){_0x58579c[_0x7429('0x1d')]=qs['limit'](_0x46a8e8[_0x7429('0x2d')][_0x7429('0x1d')]);_0x58579c[_0x7429('0x1c')]=qs[_0x7429('0x1c')](_0x46a8e8[_0x7429('0x2d')][_0x7429('0x1c')]);}_0x58579c['order']=qs[_0x7429('0x33')](_0x46a8e8['query'][_0x7429('0x33')]);_0x58579c[_0x7429('0x34')]=qs['filters'](_[_0x7429('0x35')](_0x46a8e8[_0x7429('0x2d')],_0x446b13['filters']),_0x190ff1);if(_0x46a8e8[_0x7429('0x2d')][_0x7429('0x36')]){_0x58579c['where']=_[_0x7429('0x37')](_0x58579c[_0x7429('0x34')],{'$or':_['map'](_0x190ff1,function(_0x12e0da){if(_0x12e0da['type']!==_0x7429('0x38')){var _0x24cf4d={};_0x24cf4d[_0x12e0da[_0x7429('0x26')]]={'$like':'%'+_0x46a8e8['query'][_0x7429('0x36')]+'%'};return _0x24cf4d;}})});}_0x58579c=_[_0x7429('0x37')]({},_0x58579c,_0x46a8e8[_0x7429('0x39')]);var _0x229b6f={'where':_0x58579c[_0x7429('0x34')]};return db[_0x7429('0x29')][_0x7429('0x1b')](_0x229b6f)[_0x7429('0x22')](function(_0x29cf77){_0x5e621b[_0x7429('0x1b')]=_0x29cf77;if(_0x46a8e8[_0x7429('0x2d')][_0x7429('0x3a')]){_0x58579c['include']=[{'all':!![]}];}return db[_0x7429('0x29')]['findAll'](_0x58579c);})[_0x7429('0x22')](function(_0x13bbce){_0x5e621b[_0x7429('0x3b')]=_0x13bbce;return _0x5e621b;})[_0x7429('0x22')](respondWithFilteredResult(_0x2d850d,_0x58579c))['catch'](handleError(_0x2d850d,null));};exports[_0x7429('0x3c')]=function(_0xd52e84,_0x1fc4a7){var _0x2d5daa={'raw':![],'where':{'id':_0xd52e84[_0x7429('0x3d')]['id']}},_0x48cd4f={};_0x48cd4f[_0x7429('0x2c')]=_[_0x7429('0x3e')](db[_0x7429('0x29')][_0x7429('0x3f')]);_0x48cd4f[_0x7429('0x2d')]=_[_0x7429('0x3e')](_0xd52e84[_0x7429('0x2d')]);_0x48cd4f[_0x7429('0x2e')]=_[_0x7429('0x30')](_0x48cd4f[_0x7429('0x2c')],_0x48cd4f[_0x7429('0x2d')]);_0x2d5daa[_0x7429('0x2f')]=_[_0x7429('0x30')](_0x48cd4f['model'],qs[_0x7429('0x31')](_0xd52e84[_0x7429('0x2d')][_0x7429('0x31')]));_0x2d5daa['attributes']=_0x2d5daa[_0x7429('0x2f')]['length']?_0x2d5daa['attributes']:_0x48cd4f[_0x7429('0x2c')];if(_0xd52e84[_0x7429('0x2d')][_0x7429('0x3a')]){_0x2d5daa[_0x7429('0x40')]=[{'all':!![]}];}_0x2d5daa=_['merge']({},_0x2d5daa,_0xd52e84[_0x7429('0x39')]);return db[_0x7429('0x29')][_0x7429('0x41')](_0x2d5daa)['then'](handleEntityNotFound(_0x1fc4a7,null))['then'](respondWithResult(_0x1fc4a7,null))[_0x7429('0x42')](handleError(_0x1fc4a7,null));};exports['create']=function(_0x482a57,_0x32e246){return db[_0x7429('0x29')][_0x7429('0x43')](_0x482a57[_0x7429('0x44')],{})[_0x7429('0x22')](respondWithResult(_0x32e246,0xc9))[_0x7429('0x42')](handleError(_0x32e246,null));};exports['update']=function(_0x5d8ead,_0x5a352c){if(_0x5d8ead[_0x7429('0x44')]['id']){delete _0x5d8ead[_0x7429('0x44')]['id'];}return db['UserProfileSection'][_0x7429('0x41')]({'where':{'id':_0x5d8ead[_0x7429('0x3d')]['id']}})[_0x7429('0x22')](handleEntityNotFound(_0x5a352c,null))[_0x7429('0x22')](saveUpdates(_0x5d8ead[_0x7429('0x44')],null))[_0x7429('0x22')](respondWithResult(_0x5a352c,null))[_0x7429('0x42')](handleError(_0x5a352c,null));};exports[_0x7429('0x23')]=function(_0x435c9c,_0x4712ec){return db[_0x7429('0x29')][_0x7429('0x41')]({'where':{'id':_0x435c9c[_0x7429('0x3d')]['id']}})[_0x7429('0x22')](handleEntityNotFound(_0x4712ec,null))[_0x7429('0x22')](removeEntity(_0x4712ec,null))[_0x7429('0x42')](handleError(_0x4712ec,null));};exports[_0x7429('0x45')]=function(_0xc265cf,_0x3615b2){return db[_0x7429('0x29')]['describe']()[_0x7429('0x22')](respondWithResult(_0x3615b2,null))[_0x7429('0x42')](handleError(_0x3615b2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d549525..d053ff8 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 _0x642e=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x642e,0x10b));var _0xe642=function(_0x21a460,_0xa20997){_0x21a460=_0x21a460-0x0;var _0xd89e97=_0x642e[_0x21a460];return _0xd89e97;};'use strict';var _=require(_0xe642('0x0'));var util=require(_0xe642('0x1'));var logger=require(_0xe642('0x2'))('api');var moment=require(_0xe642('0x3'));var BPromise=require(_0xe642('0x4'));var rp=require(_0xe642('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe642('0x6'));var config=require(_0xe642('0x7'));var attributes=require(_0xe642('0x8'));module[_0xe642('0x9')]=function(_0xcc65b5,_0x562882){return _0xcc65b5[_0xe642('0xa')](_0xe642('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe642('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc661=['./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a5afd,_0x5be220){var _0x4f93e8=function(_0x30d4a9){while(--_0x30d4a9){_0x4a5afd['push'](_0x4a5afd['shift']());}};_0x4f93e8(++_0x5be220);}(_0xc661,0xc7));var _0x1c66=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xc661[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x1c66('0x0'));var util=require(_0x1c66('0x1'));var logger=require(_0x1c66('0x2'))(_0x1c66('0x3'));var moment=require('moment');var BPromise=require(_0x1c66('0x4'));var rp=require(_0x1c66('0x5'));var fs=require('fs');var path=require(_0x1c66('0x6'));var rimraf=require(_0x1c66('0x7'));var config=require(_0x1c66('0x8'));var attributes=require(_0x1c66('0x9'));module[_0x1c66('0xa')]=function(_0x240f14,_0x3afb9f){return _0x240f14[_0x1c66('0xb')](_0x1c66('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x1c66('0xd'),'fields':[_0x1c66('0xe'),_0x1c66('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 34aa361..b174493 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 _0x75c6=['rpc','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52971b,_0x2f5b43){var _0x210896=function(_0x5f39f5){while(--_0x5f39f5){_0x52971b['push'](_0x52971b['shift']());}};_0x210896(++_0x2f5b43);}(_0x75c6,0xb7));var _0x675c=function(_0x27e6f2,_0x413871){_0x27e6f2=_0x27e6f2-0x0;var _0x2ac6ed=_0x75c6[_0x27e6f2];return _0x2ac6ed;};'use strict';var _=require(_0x675c('0x0'));var util=require(_0x675c('0x1'));var moment=require(_0x675c('0x2'));var BPromise=require(_0x675c('0x3'));var rs=require(_0x675c('0x4'));var fs=require('fs');var Redis=require(_0x675c('0x5'));var db=require(_0x675c('0x6'))['db'];var utils=require(_0x675c('0x7'));var logger=require(_0x675c('0x8'))(_0x675c('0x9'));var config=require('../../config/environment');var jayson=require(_0x675c('0xa'));var client=jayson[_0x675c('0xb')][_0x675c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdda345,_0x5a1c9c,_0x301803){return new BPromise(function(_0x57f664,_0x677bb8){return client['request'](_0xdda345,_0x301803)[_0x675c('0xd')](function(_0x3d8b49){logger[_0x675c('0xe')](_0x675c('0xf'),_0x5a1c9c,_0x675c('0x10'));logger[_0x675c('0x11')](_0x675c('0x12'),_0x5a1c9c,'request\x20sent',JSON['stringify'](_0x3d8b49));if(_0x3d8b49[_0x675c('0x13')]){if(_0x3d8b49[_0x675c('0x13')][_0x675c('0x14')]===0x1f4){logger[_0x675c('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x5a1c9c,_0x3d8b49['error'][_0x675c('0x15')]);return _0x677bb8(_0x3d8b49[_0x675c('0x13')]['message']);}logger[_0x675c('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x5a1c9c,_0x3d8b49['error'][_0x675c('0x15')]);return _0x57f664(_0x3d8b49[_0x675c('0x13')]['message']);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x5a1c9c,_0x675c('0x10'));_0x57f664(_0x3d8b49[_0x675c('0x16')][_0x675c('0x15')]);}})[_0x675c('0x17')](function(_0x2432c7){logger[_0x675c('0x13')](_0x675c('0xf'),_0x5a1c9c,_0x2432c7);_0x677bb8(_0x2432c7);});});} \ No newline at end of file +var _0xac23=['rpc','../../config/environment','jayson/promise','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac23,0xb6));var _0x3ac2=function(_0x3e64ed,_0x491816){_0x3e64ed=_0x3e64ed-0x0;var _0x14d8bc=_0xac23[_0x3e64ed];return _0x14d8bc;};'use strict';var _=require(_0x3ac2('0x0'));var util=require(_0x3ac2('0x1'));var moment=require(_0x3ac2('0x2'));var BPromise=require(_0x3ac2('0x3'));var rs=require(_0x3ac2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ac2('0x5'))['db'];var utils=require(_0x3ac2('0x6'));var logger=require('../../config/logger')(_0x3ac2('0x7'));var config=require(_0x3ac2('0x8'));var jayson=require(_0x3ac2('0x9'));var client=jayson[_0x3ac2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e3c26,_0x55fbe1,_0x20cc67){return new BPromise(function(_0x21bf63,_0x241ae9){return client['request'](_0x5e3c26,_0x20cc67)['then'](function(_0x4647dd){logger[_0x3ac2('0xb')](_0x3ac2('0xc'),_0x55fbe1,_0x3ac2('0xd'));logger[_0x3ac2('0xe')](_0x3ac2('0xf'),_0x55fbe1,_0x3ac2('0xd'),JSON['stringify'](_0x4647dd));if(_0x4647dd['error']){if(_0x4647dd[_0x3ac2('0x10')][_0x3ac2('0x11')]===0x1f4){logger[_0x3ac2('0x10')](_0x3ac2('0xc'),_0x55fbe1,_0x4647dd['error'][_0x3ac2('0x12')]);return _0x241ae9(_0x4647dd[_0x3ac2('0x10')][_0x3ac2('0x12')]);}logger['error'](_0x3ac2('0xc'),_0x55fbe1,_0x4647dd[_0x3ac2('0x10')][_0x3ac2('0x12')]);return _0x21bf63(_0x4647dd[_0x3ac2('0x10')][_0x3ac2('0x12')]);}else{logger[_0x3ac2('0xb')](_0x3ac2('0xc'),_0x55fbe1,_0x3ac2('0xd'));_0x21bf63(_0x4647dd[_0x3ac2('0x13')][_0x3ac2('0x12')]);}})[_0x3ac2('0x14')](function(_0x4a512d){logger[_0x3ac2('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x55fbe1,_0x4a512d);_0x241ae9(_0x4a512d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 17925d7..af9a2aa 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 _0xa48a=['../../components/interaction/service','../../config/environment','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1a574a,_0x5c1b4f){var _0x1d3ccb=function(_0x2d265a){while(--_0x2d265a){_0x1a574a['push'](_0x1a574a['shift']());}};_0x1d3ccb(++_0x5c1b4f);}(_0xa48a,0x1d7));var _0xaa48=function(_0xc49285,_0x111e4d){_0xc49285=_0xc49285-0x0;var _0xf5de25=_0xa48a[_0xc49285];return _0xf5de25;};'use strict';var multer=require('multer');var util=require(_0xaa48('0x0'));var path=require(_0xaa48('0x1'));var timeout=require(_0xaa48('0x2'));var express=require('express');var router=express[_0xaa48('0x3')]();var auth=require(_0xaa48('0x4'));var interaction=require(_0xaa48('0x5'));var config=require(_0xaa48('0x6'));module['exports']=router; \ No newline at end of file +var _0xe2de=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xe2de,0x127));var _0xee2d=function(_0x160ceb,_0x231e9a){_0x160ceb=_0x160ceb-0x0;var _0x8cc690=_0xe2de[_0x160ceb];return _0x8cc690;};'use strict';var multer=require(_0xee2d('0x0'));var util=require(_0xee2d('0x1'));var path=require(_0xee2d('0x2'));var timeout=require(_0xee2d('0x3'));var express=require(_0xee2d('0x4'));var router=express[_0xee2d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xee2d('0x6'));var config=require(_0xee2d('0x7'));module[_0xee2d('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 1d8efee..4396f4b 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(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_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(_0x314b56,_0x292792){var _0x34e0d4=function(_0x519f29){while(--_0x519f29){_0x314b56['push'](_0x314b56['shift']());}};_0x34e0d4(++_0x292792);}(_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 e84d85e..9462ade 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 _0x30fe=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x30fe,0x149));var _0xe30f=function(_0x13b1bf,_0x1c9053){_0x13b1bf=_0x13b1bf-0x0;var _0x3fa789=_0x30fe[_0x13b1bf];return _0x3fa789;};'use strict';var _=require('lodash');var util=require(_0xe30f('0x0'));var logger=require('../../config/logger')(_0xe30f('0x1'));var moment=require('moment');var BPromise=require(_0xe30f('0x2'));var rp=require(_0xe30f('0x3'));var fs=require('fs');var path=require(_0xe30f('0x4'));var rimraf=require(_0xe30f('0x5'));var config=require(_0xe30f('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xe30f('0x7')]=function(_0x1e2055,_0x1fa4c9){return _0x1e2055[_0xe30f('0x8')](_0xe30f('0x9'),attributes,{'tableName':_0xe30f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc4a=['lodash','util','../../config/logger','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x2713ed,_0x5fd338){_0x2713ed=_0x2713ed-0x0;var _0x2420b1=_0xbc4a[_0x2713ed];return _0x2420b1;};'use strict';var _=require(_0xabc4('0x0'));var util=require(_0xabc4('0x1'));var logger=require(_0xabc4('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(_0xabc4('0x3'));var config=require('../../config/environment');var attributes=require(_0xabc4('0x4'));module[_0xabc4('0x5')]=function(_0x282a1e,_0x422903){return _0x282a1e[_0xabc4('0x6')](_0xabc4('0x7'),attributes,{'tableName':_0xabc4('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 8e60f72..ae92f19 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 _0x098c=['../../config/environment','jayson/promise','request','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x098c,0x1f1));var _0xc098=function(_0x1bb9a3,_0x11d873){_0x1bb9a3=_0x1bb9a3-0x0;var _0x36e207=_0x098c[_0x1bb9a3];return _0x36e207;};'use strict';var _=require(_0xc098('0x0'));var util=require('util');var moment=require(_0xc098('0x1'));var BPromise=require(_0xc098('0x2'));var rs=require(_0xc098('0x3'));var fs=require('fs');var Redis=require(_0xc098('0x4'));var db=require(_0xc098('0x5'))['db'];var utils=require(_0xc098('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc098('0x7'));var jayson=require(_0xc098('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24dfad,_0x59e80d,_0x5324ef){return new BPromise(function(_0x160537,_0x33d0e6){return client[_0xc098('0x9')](_0x24dfad,_0x5324ef)['then'](function(_0x25bb2d){logger[_0xc098('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x59e80d,_0xc098('0xb'));logger['debug'](_0xc098('0xc'),_0x59e80d,_0xc098('0xb'),JSON[_0xc098('0xd')](_0x25bb2d));if(_0x25bb2d[_0xc098('0xe')]){if(_0x25bb2d[_0xc098('0xe')][_0xc098('0xf')]===0x1f4){logger[_0xc098('0xe')](_0xc098('0x10'),_0x59e80d,_0x25bb2d['error'][_0xc098('0x11')]);return _0x33d0e6(_0x25bb2d['error'][_0xc098('0x11')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x59e80d,_0x25bb2d[_0xc098('0xe')][_0xc098('0x11')]);return _0x160537(_0x25bb2d['error'][_0xc098('0x11')]);}else{logger[_0xc098('0xa')](_0xc098('0x10'),_0x59e80d,_0xc098('0xb'));_0x160537(_0x25bb2d['result']['message']);}})['catch'](function(_0x5ded33){logger[_0xc098('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x59e80d,_0x5ded33);_0x33d0e6(_0x5ded33);});});} \ No newline at end of file +var _0xa7eb=['code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','error'];(function(_0x7a2c26,_0x3c7981){var _0x3db948=function(_0x175d0c){while(--_0x175d0c){_0x7a2c26['push'](_0x7a2c26['shift']());}};_0x3db948(++_0x3c7981);}(_0xa7eb,0x1cb));var _0xba7e=function(_0x4b0b67,_0x2b38d4){_0x4b0b67=_0x4b0b67-0x0;var _0x24b26=_0xa7eb[_0x4b0b67];return _0x24b26;};'use strict';var _=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var moment=require(_0xba7e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba7e('0x4'));var logger=require(_0xba7e('0x5'))(_0xba7e('0x6'));var config=require(_0xba7e('0x7'));var jayson=require(_0xba7e('0x8'));var client=jayson['client'][_0xba7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e8c2,_0x4670d4,_0xd896c4){return new BPromise(function(_0x4c2a33,_0x19f558){return client[_0xba7e('0xa')](_0x45e8c2,_0xd896c4)[_0xba7e('0xb')](function(_0x485123){logger[_0xba7e('0xc')](_0xba7e('0xd'),_0x4670d4,_0xba7e('0xe'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4670d4,_0xba7e('0xe'),JSON['stringify'](_0x485123));if(_0x485123[_0xba7e('0xf')]){if(_0x485123[_0xba7e('0xf')][_0xba7e('0x10')]===0x1f4){logger[_0xba7e('0xf')](_0xba7e('0xd'),_0x4670d4,_0x485123[_0xba7e('0xf')]['message']);return _0x19f558(_0x485123[_0xba7e('0xf')][_0xba7e('0x11')]);}logger[_0xba7e('0xf')](_0xba7e('0xd'),_0x4670d4,_0x485123[_0xba7e('0xf')][_0xba7e('0x11')]);return _0x4c2a33(_0x485123[_0xba7e('0xf')]['message']);}else{logger[_0xba7e('0xc')](_0xba7e('0xd'),_0x4670d4,_0xba7e('0xe'));_0x4c2a33(_0x485123['result'][_0xba7e('0x11')]);}})[_0xba7e('0x12')](function(_0x4c3295){logger[_0xba7e('0xf')](_0xba7e('0xd'),_0x4670d4,_0x4c3295);_0x19f558(_0x4c3295);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 619d327..5d98a24 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 _0x1f2c=['../../components/interaction/service','../../config/environment','multer','util','path','express','Router'];(function(_0x1b166c,_0x423645){var _0x4d27b4=function(_0x1b8014){while(--_0x1b8014){_0x1b166c['push'](_0x1b166c['shift']());}};_0x4d27b4(++_0x423645);}(_0x1f2c,0x144));var _0xc1f2=function(_0x50a810,_0x26e8ea){_0x50a810=_0x50a810-0x0;var _0x1c5382=_0x1f2c[_0x50a810];return _0x1c5382;};'use strict';var multer=require(_0xc1f2('0x0'));var util=require(_0xc1f2('0x1'));var path=require(_0xc1f2('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1f2('0x3'));var router=express[_0xc1f2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1f2('0x5'));var config=require(_0xc1f2('0x6'));module['exports']=router; \ No newline at end of file +var _0x6e57=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','express'];(function(_0xff8595,_0x39341d){var _0x31e49e=function(_0x23ee7b){while(--_0x23ee7b){_0xff8595['push'](_0xff8595['shift']());}};_0x31e49e(++_0x39341d);}(_0x6e57,0x193));var _0x76e5=function(_0x88328,_0x1ddfa0){_0x88328=_0x88328-0x0;var _0x3d2bfa=_0x6e57[_0x88328];return _0x3d2bfa;};'use strict';var multer=require(_0x76e5('0x0'));var util=require(_0x76e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x76e5('0x2'));var router=express[_0x76e5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x76e5('0x4'));var config=require(_0x76e5('0x5'));module[_0x76e5('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 012f7af..3676ada 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x289bea,_0x458a65){var _0x526baa=function(_0x515a89){while(--_0x515a89){_0x289bea['push'](_0x289bea['shift']());}};_0x526baa(++_0x458a65);}(_0xe706,0xa3));var _0x6e70=function(_0x4057ec,_0x425f09){_0x4057ec=_0x4057ec-0x0;var _0xe062c=_0xe706[_0x4057ec];return _0xe062c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2cd35d,_0x13b278){var _0x6a1151=function(_0x44b2c9){while(--_0x44b2c9){_0x2cd35d['push'](_0x2cd35d['shift']());}};_0x6a1151(++_0x13b278);}(_0xe706,0xa3));var _0x6e70=function(_0x53a85b,_0x43dbc8){_0x53a85b=_0x53a85b-0x0;var _0x50b2fd=_0xe706[_0x53a85b];return _0x50b2fd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6202aa2..a452288 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 _0xecdb=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x331448,_0x1cff5b){var _0x2decfb=function(_0x3edc8e){while(--_0x3edc8e){_0x331448['push'](_0x331448['shift']());}};_0x2decfb(++_0x1cff5b);}(_0xecdb,0xb8));var _0xbecd=function(_0x1aab4a,_0x490672){_0x1aab4a=_0x1aab4a-0x0;var _0x59529f=_0xecdb[_0x1aab4a];return _0x59529f;};'use strict';var _=require(_0xbecd('0x0'));var util=require(_0xbecd('0x1'));var logger=require('../../config/logger')(_0xbecd('0x2'));var moment=require('moment');var BPromise=require(_0xbecd('0x3'));var rp=require(_0xbecd('0x4'));var fs=require('fs');var path=require(_0xbecd('0x5'));var rimraf=require(_0xbecd('0x6'));var config=require(_0xbecd('0x7'));var attributes=require(_0xbecd('0x8'));module[_0xbecd('0x9')]=function(_0x1a7ea9,_0x4e3c5c){return _0x1a7ea9[_0xbecd('0xa')]('UserVoiceQueue',attributes,{'tableName':_0xbecd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3766=['request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird'];(function(_0x4d03d6,_0x438a06){var _0x22752e=function(_0x1b2894){while(--_0x1b2894){_0x4d03d6['push'](_0x4d03d6['shift']());}};_0x22752e(++_0x438a06);}(_0x3766,0x174));var _0x6376=function(_0x5133c2,_0x49fa51){_0x5133c2=_0x5133c2-0x0;var _0x55b197=_0x3766[_0x5133c2];return _0x55b197;};'use strict';var _=require(_0x6376('0x0'));var util=require(_0x6376('0x1'));var logger=require('../../config/logger')(_0x6376('0x2'));var moment=require(_0x6376('0x3'));var BPromise=require(_0x6376('0x4'));var rp=require(_0x6376('0x5'));var fs=require('fs');var path=require(_0x6376('0x6'));var rimraf=require(_0x6376('0x7'));var config=require('../../config/environment');var attributes=require(_0x6376('0x8'));module[_0x6376('0x9')]=function(_0x2ff176,_0x5683b2){return _0x2ff176[_0x6376('0xa')](_0x6376('0xb'),attributes,{'tableName':_0x6376('0xc'),'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 1c4daa5..b177cfb 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 _0x1a38=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x46f01c,_0x3833de){var _0x2a9593=function(_0x40e7ca){while(--_0x40e7ca){_0x46f01c['push'](_0x46f01c['shift']());}};_0x2a9593(++_0x3833de);}(_0x1a38,0x96));var _0x81a3=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x1a38[_0x368587];return _0x42d33c;};'use strict';var _=require(_0x81a3('0x0'));var util=require('util');var moment=require(_0x81a3('0x1'));var BPromise=require(_0x81a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require('../../config/environment');var jayson=require(_0x81a3('0x7'));var client=jayson['client'][_0x81a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53188c,_0x351ac6,_0x332da0){return new BPromise(function(_0x3dcc5b,_0x824b13){return client[_0x81a3('0x9')](_0x53188c,_0x332da0)[_0x81a3('0xa')](function(_0x107728){logger[_0x81a3('0xb')](_0x81a3('0xc'),_0x351ac6,_0x81a3('0xd'));logger['debug'](_0x81a3('0xe'),_0x351ac6,'request\x20sent',JSON[_0x81a3('0xf')](_0x107728));if(_0x107728[_0x81a3('0x10')]){if(_0x107728[_0x81a3('0x10')][_0x81a3('0x11')]===0x1f4){logger[_0x81a3('0x10')](_0x81a3('0xc'),_0x351ac6,_0x107728[_0x81a3('0x10')][_0x81a3('0x12')]);return _0x824b13(_0x107728[_0x81a3('0x10')][_0x81a3('0x12')]);}logger[_0x81a3('0x10')](_0x81a3('0xc'),_0x351ac6,_0x107728['error'][_0x81a3('0x12')]);return _0x3dcc5b(_0x107728[_0x81a3('0x10')][_0x81a3('0x12')]);}else{logger[_0x81a3('0xb')](_0x81a3('0xc'),_0x351ac6,_0x81a3('0xd'));_0x3dcc5b(_0x107728['result'][_0x81a3('0x12')]);}})[_0x81a3('0x13')](function(_0x54537f){logger[_0x81a3('0x10')](_0x81a3('0xc'),_0x351ac6,_0x54537f);_0x824b13(_0x54537f);});});} \ No newline at end of file +var _0x3e76=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x45d7e5,_0x3d4735){var _0x5c9ab9=function(_0x22fd33){while(--_0x22fd33){_0x45d7e5['push'](_0x45d7e5['shift']());}};_0x5c9ab9(++_0x3d4735);}(_0x3e76,0x136));var _0x63e7=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x3e76[_0x5c6994];return _0x1d5c84;};'use strict';var _=require(_0x63e7('0x0'));var util=require(_0x63e7('0x1'));var moment=require(_0x63e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x63e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x63e7('0x5'))(_0x63e7('0x6'));var config=require(_0x63e7('0x7'));var jayson=require(_0x63e7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdb1f1a,_0x5c1534,_0x39a928){return new BPromise(function(_0x22f524,_0x2107d7){return client[_0x63e7('0x9')](_0xdb1f1a,_0x39a928)[_0x63e7('0xa')](function(_0x5c4f64){logger['info'](_0x63e7('0xb'),_0x5c1534,_0x63e7('0xc'));logger[_0x63e7('0xd')](_0x63e7('0xe'),_0x5c1534,_0x63e7('0xc'),JSON[_0x63e7('0xf')](_0x5c4f64));if(_0x5c4f64[_0x63e7('0x10')]){if(_0x5c4f64['error'][_0x63e7('0x11')]===0x1f4){logger[_0x63e7('0x10')](_0x63e7('0xb'),_0x5c1534,_0x5c4f64[_0x63e7('0x10')][_0x63e7('0x12')]);return _0x2107d7(_0x5c4f64['error'][_0x63e7('0x12')]);}logger[_0x63e7('0x10')](_0x63e7('0xb'),_0x5c1534,_0x5c4f64['error'][_0x63e7('0x12')]);return _0x22f524(_0x5c4f64[_0x63e7('0x10')]['message']);}else{logger[_0x63e7('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x5c1534,_0x63e7('0xc'));_0x22f524(_0x5c4f64[_0x63e7('0x14')][_0x63e7('0x12')]);}})['catch'](function(_0x31b854){logger[_0x63e7('0x10')](_0x63e7('0xb'),_0x5c1534,_0x31b854);_0x2107d7(_0x31b854);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 04978dc..688356f 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 _0x325d=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x325d,0x1e1));var _0xd325=function(_0x785462,_0x198be2){_0x785462=_0x785462-0x0;var _0x52ddfd=_0x325d[_0x785462];return _0x52ddfd;};'use strict';var multer=require(_0xd325('0x0'));var util=require(_0xd325('0x1'));var path=require(_0xd325('0x2'));var timeout=require(_0xd325('0x3'));var express=require(_0xd325('0x4'));var router=express[_0xd325('0x5')]();var auth=require(_0xd325('0x6'));var interaction=require(_0xd325('0x7'));var config=require(_0xd325('0x8'));module[_0xd325('0x9')]=router; \ No newline at end of file +var _0xee48=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x2cc9e5,_0x3a797f){var _0x589d4c=function(_0x7adde6){while(--_0x7adde6){_0x2cc9e5['push'](_0x2cc9e5['shift']());}};_0x589d4c(++_0x3a797f);}(_0xee48,0x12d));var _0x8ee4=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xee48[_0x4f3c9b];return _0x84e58a;};'use strict';var multer=require('multer');var util=require(_0x8ee4('0x0'));var path=require(_0x8ee4('0x1'));var timeout=require(_0x8ee4('0x2'));var express=require('express');var router=express[_0x8ee4('0x3')]();var auth=require(_0x8ee4('0x4'));var interaction=require(_0x8ee4('0x5'));var config=require(_0x8ee4('0x6'));module[_0x8ee4('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 57b227c..0b31ca0 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 _0x59e5=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x35815d,_0x47dbc3){var _0x4c096e=function(_0x15c315){while(--_0x15c315){_0x35815d['push'](_0x35815d['shift']());}};_0x4c096e(++_0x47dbc3);}(_0x59e5,0x16a));var _0x559e=function(_0x4d4390,_0x6b9678){_0x4d4390=_0x4d4390-0x0;var _0x448716=_0x59e5[_0x4d4390];return _0x448716;};'use strict';var Sequelize=require('sequelize');module[_0x559e('0x0')]={'uniqueid':{'type':Sequelize[_0x559e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x559e('0x2')},'membername':{'type':Sequelize[_0x559e('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x559e('0x3')],'allowNull':![],'unique':_0x559e('0x4'),'comment':_0x559e('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x559e('0x3')],'allowNull':![],'unique':_0x559e('0x4'),'comment':_0x559e('0x2')},'penalty':{'type':Sequelize[_0x559e('0x1')](0xb),'defaultValue':0x0,'comment':_0x559e('0x2')},'paused':{'type':Sequelize[_0x559e('0x1')](0xb),'defaultValue':0x0,'comment':_0x559e('0x2')}}; \ No newline at end of file +var _0xefc9=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4db484,_0x30f79a){var _0x194876=function(_0x49f02f){while(--_0x49f02f){_0x4db484['push'](_0x4db484['shift']());}};_0x194876(++_0x30f79a);}(_0xefc9,0x1cd));var _0x9efc=function(_0x480b67,_0x2a9e9a){_0x480b67=_0x480b67-0x0;var _0x5a0f11=_0xefc9[_0x480b67];return _0x5a0f11;};'use strict';var Sequelize=require(_0x9efc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9efc('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9efc('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x9efc('0x2')},'UserId':{'type':Sequelize[_0x9efc('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9efc('0x3')],'allowNull':![],'unique':_0x9efc('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x9efc('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x9efc('0x3')],'allowNull':![],'unique':_0x9efc('0x4'),'comment':_0x9efc('0x2')},'penalty':{'type':Sequelize[_0x9efc('0x1')](0xb),'defaultValue':0x0,'comment':_0x9efc('0x2')},'paused':{'type':Sequelize[_0x9efc('0x1')](0xb),'defaultValue':0x0,'comment':_0x9efc('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 601bf19..e8a12ff 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 _0x66e7=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x1cdc7a,_0x421804){var _0x57a225=function(_0x4a9e41){while(--_0x4a9e41){_0x1cdc7a['push'](_0x1cdc7a['shift']());}};_0x57a225(++_0x421804);}(_0x66e7,0x138));var _0x766e=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x66e7[_0x648163];return _0x199d4d;};'use strict';var EventEmitter=require(_0x766e('0x0'));var UserVoiceQueueRt=require(_0x766e('0x1'))['db'][_0x766e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x766e('0x3'),'afterUpdate':'update','afterDestroy':_0x766e('0x4')};function emitEvent(_0x53633a){return function(_0x9b6f7b,_0x199f23,_0x282801){UserVoiceQueueRtEvents[_0x766e('0x5')](_0x53633a+':'+_0x9b6f7b['id'],_0x9b6f7b);UserVoiceQueueRtEvents[_0x766e('0x5')](_0x53633a,_0x9b6f7b);_0x282801(null);};}for(var e in events){if(events[_0x766e('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x766e('0x7')](e,emitEvent(event));}}module[_0x766e('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc1ed=['update','remove','emit','hasOwnProperty','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x52c828,_0x1f6ebb){var _0x272523=function(_0x5a2f1b){while(--_0x5a2f1b){_0x52c828['push'](_0x52c828['shift']());}};_0x272523(++_0x1f6ebb);}(_0xc1ed,0x7c));var _0xdc1e=function(_0x186940,_0x289e25){_0x186940=_0x186940-0x0;var _0x20f150=_0xc1ed[_0x186940];return _0x20f150;};'use strict';var EventEmitter=require(_0xdc1e('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xdc1e('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xdc1e('0x2')](0x0);var events={'afterCreate':_0xdc1e('0x3'),'afterUpdate':_0xdc1e('0x4'),'afterDestroy':_0xdc1e('0x5')};function emitEvent(_0x5d6a7f){return function(_0x572475,_0x10da18,_0x51fa77){UserVoiceQueueRtEvents['emit'](_0x5d6a7f+':'+_0x572475['id'],_0x572475);UserVoiceQueueRtEvents[_0xdc1e('0x6')](_0x5d6a7f,_0x572475);_0x51fa77(null);};}for(var e in events){if(events[_0xdc1e('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 048c5f4..29eeea3 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 _0xf08d=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xf08d,0x14f));var _0xdf08=function(_0x16dc5e,_0x17cdbf){_0x16dc5e=_0x16dc5e-0x0;var _0x372972=_0xf08d[_0x16dc5e];return _0x372972;};'use strict';var _=require(_0xdf08('0x0'));var util=require(_0xdf08('0x1'));var logger=require(_0xdf08('0x2'))('api');var moment=require(_0xdf08('0x3'));var BPromise=require(_0xdf08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf08('0x5'));var rimraf=require(_0xdf08('0x6'));var config=require(_0xdf08('0x7'));var attributes=require(_0xdf08('0x8'));module[_0xdf08('0x9')]=function(_0x151e73,_0x1f3341){return _0x151e73[_0xdf08('0xa')](_0xdf08('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9990=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util'];(function(_0x17017e,_0x509679){var _0xbc7086=function(_0x30679d){while(--_0x30679d){_0x17017e['push'](_0x17017e['shift']());}};_0xbc7086(++_0x509679);}(_0x9990,0x66));var _0x0999=function(_0x3adad8,_0x5aef55){_0x3adad8=_0x3adad8-0x0;var _0x177095=_0x9990[_0x3adad8];return _0x177095;};'use strict';var _=require(_0x0999('0x0'));var util=require(_0x0999('0x1'));var logger=require(_0x0999('0x2'))(_0x0999('0x3'));var moment=require(_0x0999('0x4'));var BPromise=require(_0x0999('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0999('0x6'));var rimraf=require(_0x0999('0x7'));var config=require(_0x0999('0x8'));var attributes=require(_0x0999('0x9'));module[_0x0999('0xa')]=function(_0x4ed725,_0x455d1d){return _0x4ed725[_0x0999('0xb')](_0x0999('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','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 33703ef..2d2471d 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 _0x48b3=['../../config/environment','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x48b3,0x12b));var _0x348b=function(_0x3309c1,_0x2fe4c9){_0x3309c1=_0x3309c1-0x0;var _0x1011e3=_0x48b3[_0x3309c1];return _0x1011e3;};'use strict';var _=require('lodash');var util=require(_0x348b('0x0'));var moment=require(_0x348b('0x1'));var BPromise=require('bluebird');var rs=require(_0x348b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x348b('0x3'))['db'];var utils=require(_0x348b('0x4'));var logger=require(_0x348b('0x5'))(_0x348b('0x6'));var config=require(_0x348b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x348b('0x8')]({'port':0x232a});config[_0x348b('0x9')]=_['defaults'](config[_0x348b('0x9')],{'host':_0x348b('0xa'),'port':0x18eb});var socket=require(_0x348b('0xb'))(new Redis(config[_0x348b('0x9')]));require(_0x348b('0xc'))[_0x348b('0xd')](socket);function respondWithRpcPromise(_0x445a5c,_0x47bd62,_0x389d14){return new BPromise(function(_0x179d7f,_0x4e2f95){return client['request'](_0x445a5c,_0x389d14)[_0x348b('0xe')](function(_0xa7172a){logger[_0x348b('0xf')](_0x348b('0x10'),_0x47bd62,_0x348b('0x11'));logger[_0x348b('0x12')](_0x348b('0x13'),_0x47bd62,'request\x20sent',JSON['stringify'](_0xa7172a));if(_0xa7172a[_0x348b('0x14')]){if(_0xa7172a[_0x348b('0x14')][_0x348b('0x15')]===0x1f4){logger[_0x348b('0x14')](_0x348b('0x10'),_0x47bd62,_0xa7172a[_0x348b('0x14')]['message']);return _0x4e2f95(_0xa7172a[_0x348b('0x14')][_0x348b('0x16')]);}logger[_0x348b('0x14')](_0x348b('0x10'),_0x47bd62,_0xa7172a[_0x348b('0x14')]['message']);return _0x179d7f(_0xa7172a[_0x348b('0x14')][_0x348b('0x16')]);}else{logger['info'](_0x348b('0x10'),_0x47bd62,_0x348b('0x11'));_0x179d7f(_0xa7172a['result']['message']);}})['catch'](function(_0x176c94){logger[_0x348b('0x14')](_0x348b('0x10'),_0x47bd62,_0x176c94);_0x4e2f95(_0x176c94);});});}exports[_0x348b('0x17')]=function(_0x354aff){var _0x28ff16=this;return new Promise(function(_0x38dd9d,_0x208c46){return db[_0x348b('0x18')][_0x348b('0x19')]({'raw':_0x354aff[_0x348b('0x1a')]?_0x354aff[_0x348b('0x1a')][_0x348b('0x1b')]===undefined?!![]:![]:!![],'where':_0x354aff[_0x348b('0x1a')]?_0x354aff[_0x348b('0x1a')][_0x348b('0x1c')]||null:null,'attributes':[[db[_0x348b('0x1d')]['fn'](_0x348b('0x1e'),db[_0x348b('0x1d')]['fn']('IF',db[_0x348b('0x1d')]['literal'](_0x348b('0x1f')))),_0x348b('0x20')]]})['then'](function(_0x41cf29){logger[_0x348b('0xf')](_0x348b('0x17'),_0x354aff);logger['debug'](_0x348b('0x17'),_0x354aff,JSON[_0x348b('0x21')](_0x41cf29));_0x38dd9d(_0x41cf29);})['catch'](function(_0x31a02b){logger[_0x348b('0x14')](_0x348b('0x17'),_0x31a02b[_0x348b('0x16')],_0x354aff);_0x208c46(_0x28ff16[_0x348b('0x14')](0x1f4,_0x31a02b[_0x348b('0x16')]));});});}; \ No newline at end of file +var _0x3b14=['raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','options'];(function(_0x5ac49c,_0x153bdc){var _0x5d4b97=function(_0x4a94e1){while(--_0x4a94e1){_0x5ac49c['push'](_0x5ac49c['shift']());}};_0x5d4b97(++_0x153bdc);}(_0x3b14,0x1cf));var _0x43b1=function(_0x3bb16a,_0x22b2c1){_0x3bb16a=_0x3bb16a-0x0;var _0x4c5ea0=_0x3b14[_0x3bb16a];return _0x4c5ea0;};'use strict';var _=require(_0x43b1('0x0'));var util=require(_0x43b1('0x1'));var moment=require(_0x43b1('0x2'));var BPromise=require(_0x43b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43b1('0x5'));var logger=require('../../config/logger')(_0x43b1('0x6'));var config=require(_0x43b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43b1('0x8')][_0x43b1('0x9')]({'port':0x232a});config[_0x43b1('0xa')]=_[_0x43b1('0xb')](config[_0x43b1('0xa')],{'host':_0x43b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43b1('0xa')]));require('./userVoiceQueueRt.socket')[_0x43b1('0xd')](socket);function respondWithRpcPromise(_0x2f1680,_0x38d5b1,_0x3137ae){return new BPromise(function(_0x18045e,_0x50291a){return client[_0x43b1('0xe')](_0x2f1680,_0x3137ae)[_0x43b1('0xf')](function(_0x2597b3){logger[_0x43b1('0x10')](_0x43b1('0x11'),_0x38d5b1,'request\x20sent');logger[_0x43b1('0x12')](_0x43b1('0x13'),_0x38d5b1,'request\x20sent',JSON[_0x43b1('0x14')](_0x2597b3));if(_0x2597b3[_0x43b1('0x15')]){if(_0x2597b3[_0x43b1('0x15')][_0x43b1('0x16')]===0x1f4){logger['error'](_0x43b1('0x11'),_0x38d5b1,_0x2597b3[_0x43b1('0x15')][_0x43b1('0x17')]);return _0x50291a(_0x2597b3[_0x43b1('0x15')][_0x43b1('0x17')]);}logger[_0x43b1('0x15')](_0x43b1('0x11'),_0x38d5b1,_0x2597b3[_0x43b1('0x15')]['message']);return _0x18045e(_0x2597b3[_0x43b1('0x15')][_0x43b1('0x17')]);}else{logger[_0x43b1('0x10')](_0x43b1('0x11'),_0x38d5b1,'request\x20sent');_0x18045e(_0x2597b3[_0x43b1('0x18')][_0x43b1('0x17')]);}})['catch'](function(_0x3212db){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x38d5b1,_0x3212db);_0x50291a(_0x3212db);});});}exports[_0x43b1('0x19')]=function(_0x162b6f){var _0xd60691=this;return new Promise(function(_0x27ce24,_0x3ced11){return db['UserVoiceQueueRt']['findAll']({'raw':_0x162b6f[_0x43b1('0x1a')]?_0x162b6f[_0x43b1('0x1a')][_0x43b1('0x1b')]===undefined?!![]:![]:!![],'where':_0x162b6f['options']?_0x162b6f[_0x43b1('0x1a')][_0x43b1('0x1c')]||null:null,'attributes':[[db[_0x43b1('0x1d')]['fn'](_0x43b1('0x1e'),db[_0x43b1('0x1d')]['fn']('IF',db[_0x43b1('0x1d')][_0x43b1('0x1f')](_0x43b1('0x20')))),_0x43b1('0x21')]]})[_0x43b1('0xf')](function(_0x348929){logger['info']('GetVoiceQueueRtPauses',_0x162b6f);logger[_0x43b1('0x12')](_0x43b1('0x19'),_0x162b6f,JSON[_0x43b1('0x14')](_0x348929));_0x27ce24(_0x348929);})[_0x43b1('0x22')](function(_0x2a2962){logger[_0x43b1('0x15')](_0x43b1('0x19'),_0x2a2962[_0x43b1('0x17')],_0x162b6f);_0x3ced11(_0xd60691[_0x43b1('0x15')](0x1f4,_0x2a2962['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 376e8b3..4f5039a 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 _0x4319=['update','register','length','save','remove'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0x4319,0x1d4));var _0x9431=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x4319[_0x273f77];return _0x71e147;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x9431('0x0'),_0x9431('0x1'),_0x9431('0x2')];function createListener(_0x13ac09,_0xfd8da9){return function(_0x4b1523){_0xfd8da9['emit'](_0x13ac09,_0x4b1523);};}function removeListener(_0x429c02,_0x37270f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x429c02,_0x37270f);};}exports[_0x9431('0x3')]=function(_0x2b5d77){for(var _0x51a75a=0x0,_0x246252=events[_0x9431('0x4')];_0x51a75a<_0x246252;_0x51a75a++){var _0x2cd5bc=events[_0x51a75a];var _0x3acd92=createListener('userVoiceQueueRt:'+_0x2cd5bc,_0x2b5d77);UserVoiceQueueRtEvents['on'](_0x2cd5bc,_0x3acd92);}}; \ No newline at end of file +var _0x5b40=['update','emit','length','userVoiceQueueRt:','save','remove'];(function(_0x264ffb,_0x487afc){var _0x1d096b=function(_0x565772){while(--_0x565772){_0x264ffb['push'](_0x264ffb['shift']());}};_0x1d096b(++_0x487afc);}(_0x5b40,0xd6));var _0x05b4=function(_0x46d69e,_0x4f9893){_0x46d69e=_0x46d69e-0x0;var _0xe501d9=_0x5b40[_0x46d69e];return _0xe501d9;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x05b4('0x0'),_0x05b4('0x1'),_0x05b4('0x2')];function createListener(_0x4c6a4d,_0x384e5d){return function(_0x1bee86){_0x384e5d[_0x05b4('0x3')](_0x4c6a4d,_0x1bee86);};}function removeListener(_0x5aca4b,_0x21354f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5aca4b,_0x21354f);};}exports['register']=function(_0x5ed239){for(var _0x58a684=0x0,_0xb81154=events[_0x05b4('0x4')];_0x58a684<_0xb81154;_0x58a684++){var _0x549554=events[_0x58a684];var _0x2b41c6=createListener(_0x05b4('0x5')+_0x549554,_0x5ed239);UserVoiceQueueRtEvents['on'](_0x549554,_0x2b41c6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 386a947..e3edcca 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 _0x13b5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express'];(function(_0x28ba9e,_0x1e8204){var _0x18c3cb=function(_0x2cf51b){while(--_0x2cf51b){_0x28ba9e['push'](_0x28ba9e['shift']());}};_0x18c3cb(++_0x1e8204);}(_0x13b5,0x83));var _0x513b=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x13b5[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x513b('0x0'));var util=require('util');var path=require(_0x513b('0x1'));var timeout=require(_0x513b('0x2'));var express=require(_0x513b('0x3'));var router=express[_0x513b('0x4')]();var auth=require(_0x513b('0x5'));var interaction=require(_0x513b('0x6'));var config=require(_0x513b('0x7'));module[_0x513b('0x8')]=router; \ No newline at end of file +var _0x8d0f=['express','Router','../../components/interaction/service','exports','multer','util','connect-timeout'];(function(_0x5d4c60,_0x4f7a4f){var _0x17b350=function(_0x368169){while(--_0x368169){_0x5d4c60['push'](_0x5d4c60['shift']());}};_0x17b350(++_0x4f7a4f);}(_0x8d0f,0x100));var _0xf8d0=function(_0x4b9f65,_0xc06e2a){_0x4b9f65=_0x4b9f65-0x0;var _0x2e7b7d=_0x8d0f[_0x4b9f65];return _0x2e7b7d;};'use strict';var multer=require(_0xf8d0('0x0'));var util=require(_0xf8d0('0x1'));var path=require('path');var timeout=require(_0xf8d0('0x2'));var express=require(_0xf8d0('0x3'));var router=express[_0xf8d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf8d0('0x5'));var config=require('../../config/environment');module[_0xf8d0('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index cb0433f..7148bfc 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(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x488a0d,_0x3b5878){var _0x467447=function(_0x36106b){while(--_0x36106b){_0x488a0d['push'](_0x488a0d['shift']());}};_0x467447(++_0x3b5878);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 455bdec..907dfb7 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 _0x20bb=['lodash','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x23137e,_0x4c326f){var _0x234d58=function(_0x532570){while(--_0x532570){_0x23137e['push'](_0x23137e['shift']());}};_0x234d58(++_0x4c326f);}(_0x20bb,0x78));var _0xb20b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x20bb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb20b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb20b('0x1'));var BPromise=require(_0xb20b('0x2'));var rp=require(_0xb20b('0x3'));var fs=require('fs');var path=require(_0xb20b('0x4'));var rimraf=require('rimraf');var config=require(_0xb20b('0x5'));var attributes=require(_0xb20b('0x6'));module['exports']=function(_0x29c29f,_0x22a756){return _0x29c29f[_0xb20b('0x7')](_0xb20b('0x8'),attributes,{'tableName':_0xb20b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe981=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x26ea7d,_0x3f6c0f){var _0x3f85fb=function(_0x2843e4){while(--_0x2843e4){_0x26ea7d['push'](_0x26ea7d['shift']());}};_0x3f85fb(++_0x3f6c0f);}(_0xe981,0x198));var _0x1e98=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0xe981[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0x1e98('0x0'));var util=require(_0x1e98('0x1'));var logger=require(_0x1e98('0x2'))(_0x1e98('0x3'));var moment=require('moment');var BPromise=require(_0x1e98('0x4'));var rp=require(_0x1e98('0x5'));var fs=require('fs');var path=require(_0x1e98('0x6'));var rimraf=require(_0x1e98('0x7'));var config=require(_0x1e98('0x8'));var attributes=require(_0x1e98('0x9'));module[_0x1e98('0xa')]=function(_0x5ea91c,_0x54cee9){return _0x5ea91c[_0x1e98('0xb')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','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 d1be5bf..e086d3d 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(_0x29964a,_0x35fd4f){var _0x52e430=function(_0x504b00){while(--_0x504b00){_0x29964a['push'](_0x29964a['shift']());}};_0x52e430(++_0x35fd4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x188a1d,_0x16f498){var _0x244feb=function(_0x52b7f4){while(--_0x52b7f4){_0x188a1d['push'](_0x188a1d['shift']());}};_0x244feb(++_0x16f498);}(_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);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8e3accd..6ff15bf 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 _0xd165=['exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','post','create','/:id'];(function(_0x310e1b,_0x4e5cfe){var _0x29c586=function(_0xcfb057){while(--_0xcfb057){_0x310e1b['push'](_0x310e1b['shift']());}};_0x29c586(++_0x4e5cfe);}(_0xd165,0x69));var _0x5d16=function(_0x48a525,_0xf0e62e){_0x48a525=_0x48a525-0x0;var _0x555d13=_0xd165[_0x48a525];return _0x555d13;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5d16('0x0'));var express=require(_0x5d16('0x1'));var router=express['Router']();var auth=require(_0x5d16('0x2'));var interaction=require(_0x5d16('0x3'));var config=require(_0x5d16('0x4'));var controller=require(_0x5d16('0x5'));router['get']('/',auth[_0x5d16('0x6')](),controller[_0x5d16('0x7')]);router[_0x5d16('0x8')]('/:id',auth[_0x5d16('0x6')](),controller['show']);router[_0x5d16('0x9')]('/',auth[_0x5d16('0x6')](),controller[_0x5d16('0xa')]);router['put'](_0x5d16('0xb'),auth[_0x5d16('0x6')](),controller['update']);router['delete'](_0x5d16('0xb'),auth[_0x5d16('0x6')](),controller['destroy']);module[_0x5d16('0xc')]=router; \ No newline at end of file +var _0xe40b=['isAuthenticated','/:id','show','post','put','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe40b,0x1aa));var _0xbe40=function(_0x3c7687,_0x2538d9){_0x3c7687=_0x3c7687-0x0;var _0x53d2cc=_0xe40b[_0x3c7687];return _0x53d2cc;};'use strict';var multer=require('multer');var util=require(_0xbe40('0x0'));var path=require(_0xbe40('0x1'));var timeout=require(_0xbe40('0x2'));var express=require('express');var router=express[_0xbe40('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe40('0x4'));var config=require(_0xbe40('0x5'));var controller=require(_0xbe40('0x6'));router[_0xbe40('0x7')]('/',auth[_0xbe40('0x8')](),controller['index']);router[_0xbe40('0x7')](_0xbe40('0x9'),auth[_0xbe40('0x8')](),controller[_0xbe40('0xa')]);router[_0xbe40('0xb')]('/',auth[_0xbe40('0x8')](),controller['create']);router[_0xbe40('0xc')](_0xbe40('0x9'),auth[_0xbe40('0x8')](),controller['update']);router['delete'](_0xbe40('0x9'),auth[_0xbe40('0x8')](),controller[_0xbe40('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c5f8d31..3416c6c 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 _0xf339=['sequelize','exports','STRING','name'];(function(_0x47199b,_0x16e824){var _0x390911=function(_0x2f874d){while(--_0x2f874d){_0x47199b['push'](_0x47199b['shift']());}};_0x390911(++_0x16e824);}(_0xf339,0x1dc));var _0x9f33=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf339[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x9f33('0x0'));module[_0x9f33('0x1')]={'name':{'type':Sequelize[_0x9f33('0x2')],'unique':_0x9f33('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f33('0x2')]}}; \ No newline at end of file +var _0x67aa=['name','sequelize'];(function(_0x2ce5e3,_0x429426){var _0xe1e73c=function(_0x4a1c38){while(--_0x4a1c38){_0x2ce5e3['push'](_0x2ce5e3['shift']());}};_0xe1e73c(++_0x429426);}(_0x67aa,0xe7));var _0xa67a=function(_0x5d245c,_0x858414){_0x5d245c=_0x5d245c-0x0;var _0x2cfacd=_0x67aa[_0x5d245c];return _0x2cfacd;};'use strict';var Sequelize=require(_0xa67a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa67a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index e0130c4..853066b 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 _0xd626=['error','stack','name','send','index','Variable','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','destroy','get','Variables','UserProfileResource','then'];(function(_0x428ec2,_0x150404){var _0x1654d6=function(_0x3efc0c){while(--_0x3efc0c){_0x428ec2['push'](_0x428ec2['shift']());}};_0x1654d6(++_0x150404);}(_0xd626,0x1a8));var _0x6d62=function(_0x587410,_0x515a61){_0x587410=_0x587410-0x0;var _0x3e482c=_0xd626[_0x587410];return _0x3e482c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d62('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d62('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6d62('0x2'));var util=require(_0x6d62('0x3'));var path=require('path');var sox=require(_0x6d62('0x4'));var csv=require(_0x6d62('0x5'));var ejs=require(_0x6d62('0x6'));var fs=require('fs');var _=require(_0x6d62('0x7'));var squel=require(_0x6d62('0x8'));var crypto=require(_0x6d62('0x9'));var jsforce=require(_0x6d62('0xa'));var deskjs=require(_0x6d62('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6d62('0xc'));var Papa=require(_0x6d62('0xd'));var Redis=require(_0x6d62('0xe'));var authService=require(_0x6d62('0xf'));var qs=require(_0x6d62('0x10'));var as=require(_0x6d62('0x11'));var hardwareService=require(_0x6d62('0x12'));var logger=require(_0x6d62('0x13'))(_0x6d62('0x14'));var utils=require(_0x6d62('0x15'));var config=require(_0x6d62('0x16'));var db=require(_0x6d62('0x17'))['db'];function respondWithStatusCode(_0x40e60b,_0x334a64){_0x334a64=_0x334a64||0xcc;return function(_0x2a600c){if(_0x2a600c){return _0x40e60b[_0x6d62('0x18')](_0x334a64);}return _0x40e60b[_0x6d62('0x19')](_0x334a64)[_0x6d62('0x1a')]();};}function respondWithResult(_0x591347,_0x56210a){_0x56210a=_0x56210a||0xc8;return function(_0x4e81f1){if(_0x4e81f1){return _0x591347[_0x6d62('0x19')](_0x56210a)[_0x6d62('0x1b')](_0x4e81f1);}};}function respondWithFilteredResult(_0x1b98fb,_0xd3716f){return function(_0x59ea2c){if(_0x59ea2c){var _0x302d44=_0x59ea2c['count'],_0x3def71=_0xd3716f[_0x6d62('0x1c')],_0x64cf82=_0xd3716f[_0x6d62('0x1c')]+_0xd3716f[_0x6d62('0x1d')],_0x1644d1;if(_0x64cf82>=_0x302d44){_0x64cf82=_0x302d44;_0x1644d1=0xc8;}else{_0x1644d1=0xce;}_0x1b98fb[_0x6d62('0x19')](_0x1644d1);return _0x1b98fb['set']('Content-Range',_0x3def71+'-'+_0x64cf82+'/'+_0x302d44)[_0x6d62('0x1b')](_0x59ea2c);}return null;};}function patchUpdates(_0x31e04c){return function(_0x3056f0){try{jsonpatch[_0x6d62('0x1e')](_0x3056f0,_0x31e04c,!![]);}catch(_0x31a589){return BPromise['reject'](_0x31a589);}return _0x3056f0[_0x6d62('0x1f')]();};}function saveUpdates(_0xeb3b8a,_0x173d93){return function(_0x4871ad){if(_0x4871ad){return _0x4871ad[_0x6d62('0x20')](_0xeb3b8a)['then'](function(_0x55dcbe){return _0x55dcbe;});}return null;};}function removeEntity(_0x33df84,_0x296949){return function(_0x1bf1ee){if(_0x1bf1ee){return _0x1bf1ee[_0x6d62('0x21')]()['then'](function(){var _0x4e4cbb=_0x1bf1ee[_0x6d62('0x22')]({'plain':!![]});var _0x2b25fa=_0x6d62('0x23');return db[_0x6d62('0x24')]['destroy']({'where':{'type':_0x2b25fa,'resourceId':_0x4e4cbb['id']}})['then'](function(){return _0x1bf1ee;});})[_0x6d62('0x25')](function(){_0x33df84['status'](0xcc)[_0x6d62('0x1a')]();});}};}function handleEntityNotFound(_0x226635,_0x14ebfa){return function(_0x3ab72c){if(!_0x3ab72c){_0x226635[_0x6d62('0x18')](0x194);}return _0x3ab72c;};}function handleError(_0x4cd977,_0x478bfe){_0x478bfe=_0x478bfe||0x1f4;return function(_0xb95d68){logger[_0x6d62('0x26')](_0xb95d68[_0x6d62('0x27')]);if(_0xb95d68[_0x6d62('0x28')]){delete _0xb95d68[_0x6d62('0x28')];}_0x4cd977[_0x6d62('0x19')](_0x478bfe)[_0x6d62('0x29')](_0xb95d68);};}exports[_0x6d62('0x2a')]=function(_0x2256e2,_0x1dedf2){var _0x33c7b8={},_0x80cfc4={},_0x453e27={'count':0x0,'rows':[]};var _0x4ea6c0=_['map'](db[_0x6d62('0x2b')]['rawAttributes'],function(_0x5194b9){return{'name':_0x5194b9['fieldName'],'type':_0x5194b9[_0x6d62('0x2c')][_0x6d62('0x2d')]};});_0x80cfc4[_0x6d62('0x2e')]=_[_0x6d62('0x2f')](_0x4ea6c0,'name');_0x80cfc4[_0x6d62('0x30')]=_[_0x6d62('0x31')](_0x2256e2[_0x6d62('0x30')]);_0x80cfc4[_0x6d62('0x32')]=_['intersection'](_0x80cfc4[_0x6d62('0x2e')],_0x80cfc4[_0x6d62('0x30')]);_0x33c7b8[_0x6d62('0x33')]=_[_0x6d62('0x34')](_0x80cfc4[_0x6d62('0x2e')],qs['fields'](_0x2256e2[_0x6d62('0x30')][_0x6d62('0x35')]));_0x33c7b8[_0x6d62('0x33')]=_0x33c7b8[_0x6d62('0x33')][_0x6d62('0x36')]?_0x33c7b8[_0x6d62('0x33')]:_0x80cfc4[_0x6d62('0x2e')];if(!_0x2256e2[_0x6d62('0x30')][_0x6d62('0x37')](_0x6d62('0x38'))){_0x33c7b8[_0x6d62('0x1d')]=qs[_0x6d62('0x1d')](_0x2256e2[_0x6d62('0x30')]['limit']);_0x33c7b8[_0x6d62('0x1c')]=qs[_0x6d62('0x1c')](_0x2256e2['query']['offset']);}_0x33c7b8[_0x6d62('0x39')]=qs['sort'](_0x2256e2[_0x6d62('0x30')]['sort']);_0x33c7b8['where']=qs[_0x6d62('0x32')](_[_0x6d62('0x3a')](_0x2256e2[_0x6d62('0x30')],_0x80cfc4[_0x6d62('0x32')]),_0x4ea6c0);if(_0x2256e2['query']['filter']){_0x33c7b8[_0x6d62('0x3b')]=_['merge'](_0x33c7b8[_0x6d62('0x3b')],{'$or':_[_0x6d62('0x2f')](_0x4ea6c0,function(_0x1692ab){if(_0x1692ab[_0x6d62('0x2c')]!==_0x6d62('0x3c')){var _0x42c445={};_0x42c445[_0x1692ab[_0x6d62('0x28')]]={'$like':'%'+_0x2256e2[_0x6d62('0x30')]['filter']+'%'};return _0x42c445;}})});}_0x33c7b8=_['merge']({},_0x33c7b8,_0x2256e2[_0x6d62('0x3d')]);var _0x5750b6={'where':_0x33c7b8[_0x6d62('0x3b')]};return db['Variable'][_0x6d62('0x3e')](_0x5750b6)[_0x6d62('0x25')](function(_0x5ec6a1){_0x453e27[_0x6d62('0x3e')]=_0x5ec6a1;if(_0x2256e2[_0x6d62('0x30')][_0x6d62('0x3f')]){_0x33c7b8[_0x6d62('0x40')]=[{'all':!![]}];}return db[_0x6d62('0x2b')][_0x6d62('0x41')](_0x33c7b8);})[_0x6d62('0x25')](function(_0x45c79a){_0x453e27['rows']=_0x45c79a;return _0x453e27;})[_0x6d62('0x25')](respondWithFilteredResult(_0x1dedf2,_0x33c7b8))[_0x6d62('0x42')](handleError(_0x1dedf2,null));};exports[_0x6d62('0x43')]=function(_0x4ee3fa,_0x265333){var _0x565b4e={'raw':!![],'where':{'id':_0x4ee3fa[_0x6d62('0x44')]['id']}},_0x5dbd86={};_0x5dbd86['model']=_[_0x6d62('0x31')](db[_0x6d62('0x2b')][_0x6d62('0x45')]);_0x5dbd86[_0x6d62('0x30')]=_[_0x6d62('0x31')](_0x4ee3fa[_0x6d62('0x30')]);_0x5dbd86[_0x6d62('0x32')]=_[_0x6d62('0x34')](_0x5dbd86['model'],_0x5dbd86[_0x6d62('0x30')]);_0x565b4e[_0x6d62('0x33')]=_[_0x6d62('0x34')](_0x5dbd86[_0x6d62('0x2e')],qs[_0x6d62('0x35')](_0x4ee3fa['query']['fields']));_0x565b4e[_0x6d62('0x33')]=_0x565b4e[_0x6d62('0x33')][_0x6d62('0x36')]?_0x565b4e['attributes']:_0x5dbd86[_0x6d62('0x2e')];if(_0x4ee3fa[_0x6d62('0x30')]['includeAll']){_0x565b4e[_0x6d62('0x40')]=[{'all':!![]}];}_0x565b4e=_[_0x6d62('0x46')]({},_0x565b4e,_0x4ee3fa[_0x6d62('0x3d')]);return db['Variable'][_0x6d62('0x47')](_0x565b4e)[_0x6d62('0x25')](handleEntityNotFound(_0x265333,null))[_0x6d62('0x25')](respondWithResult(_0x265333,null))[_0x6d62('0x42')](handleError(_0x265333,null));};exports[_0x6d62('0x48')]=function(_0x413870,_0x2a12f1){return db['Variable']['create'](_0x413870['body'],{})[_0x6d62('0x25')](function(_0x5ad833){var _0x21ed06=_0x413870['user'][_0x6d62('0x22')]({'plain':!![]});if(!_0x21ed06)throw new Error(_0x6d62('0x49'));if(_0x21ed06['role']===_0x6d62('0x4a')){var _0x5c0e16=_0x5ad833['get']({'plain':!![]});var _0x47c2a3=_0x6d62('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x47c2a3,'userProfileId':_0x21ed06[_0x6d62('0x4b')]},'raw':!![]})[_0x6d62('0x25')](function(_0x26352e){if(_0x26352e&&_0x26352e['autoAssociation']===0x0){return db[_0x6d62('0x24')]['create']({'name':_0x5c0e16[_0x6d62('0x28')],'resourceId':_0x5c0e16['id'],'type':_0x26352e[_0x6d62('0x28')],'sectionId':_0x26352e['id']},{})['then'](function(){return _0x5ad833;});}else{return _0x5ad833;}})[_0x6d62('0x42')](function(_0x49e38a){logger[_0x6d62('0x26')](_0x6d62('0x4c'),_0x49e38a);throw _0x49e38a;});}return _0x5ad833;})['then'](respondWithResult(_0x2a12f1,0xc9))[_0x6d62('0x42')](handleError(_0x2a12f1,null));};exports[_0x6d62('0x20')]=function(_0x4b17e,_0x4e4167){if(_0x4b17e['body']['id']){delete _0x4b17e['body']['id'];}return db[_0x6d62('0x2b')][_0x6d62('0x47')]({'where':{'id':_0x4b17e[_0x6d62('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e4167,null))['then'](saveUpdates(_0x4b17e['body'],null))[_0x6d62('0x25')](respondWithResult(_0x4e4167,null))[_0x6d62('0x42')](handleError(_0x4e4167,null));};exports['destroy']=function(_0x2608fc,_0x165377){return db['Variable'][_0x6d62('0x47')]({'where':{'id':_0x2608fc[_0x6d62('0x44')]['id']}})[_0x6d62('0x25')](handleEntityNotFound(_0x165377,null))[_0x6d62('0x25')](removeEntity(_0x165377,null))['catch'](handleError(_0x165377,null));}; \ No newline at end of file +var _0x9bbf=['type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','rows','catch','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes'];(function(_0x10f154,_0x12cf31){var _0xa58978=function(_0x293f42){while(--_0x293f42){_0x10f154['push'](_0x10f154['shift']());}};_0xa58978(++_0x12cf31);}(_0x9bbf,0x15d));var _0xf9bb=function(_0x1065ce,_0x3c9581){_0x1065ce=_0x1065ce-0x0;var _0x22f4ac=_0x9bbf[_0x1065ce];return _0x22f4ac;};'use strict';var pdf=require(_0xf9bb('0x0'));var emlformat=require(_0xf9bb('0x1'));var rimraf=require(_0xf9bb('0x2'));var zipdir=require(_0xf9bb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9bb('0x4'));var moment=require('moment');var BPromise=require(_0xf9bb('0x5'));var Mustache=require('mustache');var util=require(_0xf9bb('0x6'));var path=require(_0xf9bb('0x7'));var sox=require(_0xf9bb('0x8'));var csv=require(_0xf9bb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf9bb('0xa'));var squel=require('squel');var crypto=require(_0xf9bb('0xb'));var jsforce=require(_0xf9bb('0xc'));var deskjs=require(_0xf9bb('0xd'));var toCsv=require(_0xf9bb('0x9'));var querystring=require(_0xf9bb('0xe'));var Papa=require(_0xf9bb('0xf'));var Redis=require(_0xf9bb('0x10'));var authService=require(_0xf9bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf9bb('0x12'));var hardwareService=require(_0xf9bb('0x13'));var logger=require(_0xf9bb('0x14'))('api');var utils=require(_0xf9bb('0x15'));var config=require(_0xf9bb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3120ff,_0x5aaa32){_0x5aaa32=_0x5aaa32||0xcc;return function(_0x4e52f0){if(_0x4e52f0){return _0x3120ff[_0xf9bb('0x17')](_0x5aaa32);}return _0x3120ff['status'](_0x5aaa32)[_0xf9bb('0x18')]();};}function respondWithResult(_0x1bb352,_0x25de51){_0x25de51=_0x25de51||0xc8;return function(_0x1a5d94){if(_0x1a5d94){return _0x1bb352[_0xf9bb('0x19')](_0x25de51)[_0xf9bb('0x1a')](_0x1a5d94);}};}function respondWithFilteredResult(_0x2a652a,_0x3733e3){return function(_0xb26536){if(_0xb26536){var _0x7cb1d=_0xb26536[_0xf9bb('0x1b')],_0x1b1c63=_0x3733e3[_0xf9bb('0x1c')],_0x4e6dc5=_0x3733e3[_0xf9bb('0x1c')]+_0x3733e3[_0xf9bb('0x1d')],_0xe20db3;if(_0x4e6dc5>=_0x7cb1d){_0x4e6dc5=_0x7cb1d;_0xe20db3=0xc8;}else{_0xe20db3=0xce;}_0x2a652a[_0xf9bb('0x19')](_0xe20db3);return _0x2a652a['set'](_0xf9bb('0x1e'),_0x1b1c63+'-'+_0x4e6dc5+'/'+_0x7cb1d)[_0xf9bb('0x1a')](_0xb26536);}return null;};}function patchUpdates(_0x46e485){return function(_0x20923d){try{jsonpatch[_0xf9bb('0x1f')](_0x20923d,_0x46e485,!![]);}catch(_0x25f83a){return BPromise['reject'](_0x25f83a);}return _0x20923d['save']();};}function saveUpdates(_0x167234,_0x3774b5){return function(_0x2a6ac2){if(_0x2a6ac2){return _0x2a6ac2[_0xf9bb('0x20')](_0x167234)[_0xf9bb('0x21')](function(_0x52b45f){return _0x52b45f;});}return null;};}function removeEntity(_0x110876,_0x34e6a8){return function(_0x1dd29e){if(_0x1dd29e){return _0x1dd29e[_0xf9bb('0x22')]()[_0xf9bb('0x21')](function(){var _0x11dc9f=_0x1dd29e[_0xf9bb('0x23')]({'plain':!![]});var _0x1727a1=_0xf9bb('0x24');return db[_0xf9bb('0x25')][_0xf9bb('0x22')]({'where':{'type':_0x1727a1,'resourceId':_0x11dc9f['id']}})['then'](function(){return _0x1dd29e;});})[_0xf9bb('0x21')](function(){_0x110876[_0xf9bb('0x19')](0xcc)[_0xf9bb('0x18')]();});}};}function handleEntityNotFound(_0x957be,_0x22f5f2){return function(_0x4f2087){if(!_0x4f2087){_0x957be[_0xf9bb('0x17')](0x194);}return _0x4f2087;};}function handleError(_0x304105,_0x2a264b){_0x2a264b=_0x2a264b||0x1f4;return function(_0xd6c998){logger[_0xf9bb('0x26')](_0xd6c998[_0xf9bb('0x27')]);if(_0xd6c998[_0xf9bb('0x28')]){delete _0xd6c998[_0xf9bb('0x28')];}_0x304105['status'](_0x2a264b)[_0xf9bb('0x29')](_0xd6c998);};}exports[_0xf9bb('0x2a')]=function(_0x36fa60,_0x523d78){var _0x4e0262={},_0x3b1fee={},_0x3a9826={'count':0x0,'rows':[]};var _0x1f8aa6=_[_0xf9bb('0x2b')](db[_0xf9bb('0x2c')][_0xf9bb('0x2d')],function(_0x25c360){return{'name':_0x25c360['fieldName'],'type':_0x25c360[_0xf9bb('0x2e')][_0xf9bb('0x2f')]};});_0x3b1fee[_0xf9bb('0x30')]=_['map'](_0x1f8aa6,_0xf9bb('0x28'));_0x3b1fee[_0xf9bb('0x31')]=_[_0xf9bb('0x32')](_0x36fa60[_0xf9bb('0x31')]);_0x3b1fee['filters']=_['intersection'](_0x3b1fee[_0xf9bb('0x30')],_0x3b1fee[_0xf9bb('0x31')]);_0x4e0262[_0xf9bb('0x33')]=_[_0xf9bb('0x34')](_0x3b1fee[_0xf9bb('0x30')],qs[_0xf9bb('0x35')](_0x36fa60['query'][_0xf9bb('0x35')]));_0x4e0262[_0xf9bb('0x33')]=_0x4e0262[_0xf9bb('0x33')]['length']?_0x4e0262['attributes']:_0x3b1fee['model'];if(!_0x36fa60[_0xf9bb('0x31')][_0xf9bb('0x36')](_0xf9bb('0x37'))){_0x4e0262[_0xf9bb('0x1d')]=qs['limit'](_0x36fa60[_0xf9bb('0x31')]['limit']);_0x4e0262[_0xf9bb('0x1c')]=qs[_0xf9bb('0x1c')](_0x36fa60[_0xf9bb('0x31')][_0xf9bb('0x1c')]);}_0x4e0262[_0xf9bb('0x38')]=qs[_0xf9bb('0x39')](_0x36fa60[_0xf9bb('0x31')][_0xf9bb('0x39')]);_0x4e0262[_0xf9bb('0x3a')]=qs[_0xf9bb('0x3b')](_[_0xf9bb('0x3c')](_0x36fa60[_0xf9bb('0x31')],_0x3b1fee['filters']),_0x1f8aa6);if(_0x36fa60[_0xf9bb('0x31')][_0xf9bb('0x3d')]){_0x4e0262[_0xf9bb('0x3a')]=_[_0xf9bb('0x3e')](_0x4e0262[_0xf9bb('0x3a')],{'$or':_['map'](_0x1f8aa6,function(_0x3c5b6f){if(_0x3c5b6f[_0xf9bb('0x2e')]!=='VIRTUAL'){var _0x2f4acd={};_0x2f4acd[_0x3c5b6f[_0xf9bb('0x28')]]={'$like':'%'+_0x36fa60['query'][_0xf9bb('0x3d')]+'%'};return _0x2f4acd;}})});}_0x4e0262=_['merge']({},_0x4e0262,_0x36fa60['options']);var _0x49cedd={'where':_0x4e0262[_0xf9bb('0x3a')]};return db[_0xf9bb('0x2c')][_0xf9bb('0x1b')](_0x49cedd)['then'](function(_0x1a5c0b){_0x3a9826['count']=_0x1a5c0b;if(_0x36fa60['query'][_0xf9bb('0x3f')]){_0x4e0262['include']=[{'all':!![]}];}return db[_0xf9bb('0x2c')]['findAll'](_0x4e0262);})[_0xf9bb('0x21')](function(_0x1cf950){_0x3a9826[_0xf9bb('0x40')]=_0x1cf950;return _0x3a9826;})[_0xf9bb('0x21')](respondWithFilteredResult(_0x523d78,_0x4e0262))[_0xf9bb('0x41')](handleError(_0x523d78,null));};exports[_0xf9bb('0x42')]=function(_0x2a4de2,_0x5deb63){var _0x114786={'raw':!![],'where':{'id':_0x2a4de2[_0xf9bb('0x43')]['id']}},_0x4ef8a7={};_0x4ef8a7[_0xf9bb('0x30')]=_[_0xf9bb('0x32')](db[_0xf9bb('0x2c')]['rawAttributes']);_0x4ef8a7['query']=_[_0xf9bb('0x32')](_0x2a4de2[_0xf9bb('0x31')]);_0x4ef8a7[_0xf9bb('0x3b')]=_[_0xf9bb('0x34')](_0x4ef8a7[_0xf9bb('0x30')],_0x4ef8a7[_0xf9bb('0x31')]);_0x114786[_0xf9bb('0x33')]=_[_0xf9bb('0x34')](_0x4ef8a7[_0xf9bb('0x30')],qs[_0xf9bb('0x35')](_0x2a4de2[_0xf9bb('0x31')][_0xf9bb('0x35')]));_0x114786['attributes']=_0x114786[_0xf9bb('0x33')][_0xf9bb('0x44')]?_0x114786['attributes']:_0x4ef8a7[_0xf9bb('0x30')];if(_0x2a4de2[_0xf9bb('0x31')][_0xf9bb('0x3f')]){_0x114786[_0xf9bb('0x45')]=[{'all':!![]}];}_0x114786=_[_0xf9bb('0x3e')]({},_0x114786,_0x2a4de2[_0xf9bb('0x46')]);return db[_0xf9bb('0x2c')][_0xf9bb('0x47')](_0x114786)[_0xf9bb('0x21')](handleEntityNotFound(_0x5deb63,null))[_0xf9bb('0x21')](respondWithResult(_0x5deb63,null))[_0xf9bb('0x41')](handleError(_0x5deb63,null));};exports['create']=function(_0x4e576b,_0x15f2c0){return db[_0xf9bb('0x2c')][_0xf9bb('0x48')](_0x4e576b[_0xf9bb('0x49')],{})['then'](function(_0x1dd8ab){var _0x4ca946=_0x4e576b[_0xf9bb('0x4a')]['get']({'plain':!![]});if(!_0x4ca946)throw new Error(_0xf9bb('0x4b'));if(_0x4ca946['role']===_0xf9bb('0x4a')){var _0xe8b186=_0x1dd8ab[_0xf9bb('0x23')]({'plain':!![]});var _0x189ce0='Variables';return db['UserProfileSection'][_0xf9bb('0x47')]({'where':{'name':_0x189ce0,'userProfileId':_0x4ca946[_0xf9bb('0x4c')]},'raw':!![]})['then'](function(_0x4d963b){if(_0x4d963b&&_0x4d963b[_0xf9bb('0x4d')]===0x0){return db[_0xf9bb('0x25')][_0xf9bb('0x48')]({'name':_0xe8b186[_0xf9bb('0x28')],'resourceId':_0xe8b186['id'],'type':_0x4d963b[_0xf9bb('0x28')],'sectionId':_0x4d963b['id']},{})[_0xf9bb('0x21')](function(){return _0x1dd8ab;});}else{return _0x1dd8ab;}})[_0xf9bb('0x41')](function(_0x271cbb){logger[_0xf9bb('0x26')](_0xf9bb('0x4e'),_0x271cbb);throw _0x271cbb;});}return _0x1dd8ab;})[_0xf9bb('0x21')](respondWithResult(_0x15f2c0,0xc9))[_0xf9bb('0x41')](handleError(_0x15f2c0,null));};exports['update']=function(_0x1f8d37,_0x46c300){if(_0x1f8d37['body']['id']){delete _0x1f8d37[_0xf9bb('0x49')]['id'];}return db[_0xf9bb('0x2c')][_0xf9bb('0x47')]({'where':{'id':_0x1f8d37['params']['id']}})['then'](handleEntityNotFound(_0x46c300,null))[_0xf9bb('0x21')](saveUpdates(_0x1f8d37[_0xf9bb('0x49')],null))[_0xf9bb('0x21')](respondWithResult(_0x46c300,null))['catch'](handleError(_0x46c300,null));};exports[_0xf9bb('0x22')]=function(_0x4fa654,_0x3c6fcb){return db[_0xf9bb('0x2c')][_0xf9bb('0x47')]({'where':{'id':_0x4fa654[_0xf9bb('0x43')]['id']}})[_0xf9bb('0x21')](handleEntityNotFound(_0x3c6fcb,null))[_0xf9bb('0x21')](removeEntity(_0x3c6fcb,null))[_0xf9bb('0x41')](handleError(_0x3c6fcb,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e9902b5..70647d6 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 _0xe7db=['api','moment','bluebird','request-promise','path','./variable.attributes','define','Variable','lodash'];(function(_0x288cee,_0x2ddb87){var _0x21e1d1=function(_0x3af89c){while(--_0x3af89c){_0x288cee['push'](_0x288cee['shift']());}};_0x21e1d1(++_0x2ddb87);}(_0xe7db,0x167));var _0xbe7d=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0xe7db[_0x5426e2];return _0x920dc;};'use strict';var _=require(_0xbe7d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe7d('0x1'));var moment=require(_0xbe7d('0x2'));var BPromise=require(_0xbe7d('0x3'));var rp=require(_0xbe7d('0x4'));var fs=require('fs');var path=require(_0xbe7d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe7d('0x6'));module['exports']=function(_0x223480,_0x4b4e3a){return _0x223480[_0xbe7d('0x7')](_0xbe7d('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a61=['request-promise','path','rimraf','Variable','tools_variables','lodash','../../config/logger','api','moment'];(function(_0x5a86ca,_0x7a30c3){var _0x846c00=function(_0x542717){while(--_0x542717){_0x5a86ca['push'](_0x5a86ca['shift']());}};_0x846c00(++_0x7a30c3);}(_0x6a61,0xa7));var _0x16a6=function(_0x4d3052,_0x4c9783){_0x4d3052=_0x4d3052-0x0;var _0x225120=_0x6a61[_0x4d3052];return _0x225120;};'use strict';var _=require(_0x16a6('0x0'));var util=require('util');var logger=require(_0x16a6('0x1'))(_0x16a6('0x2'));var moment=require(_0x16a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x16a6('0x4'));var fs=require('fs');var path=require(_0x16a6('0x5'));var rimraf=require(_0x16a6('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0x4c83ea,_0x1f2547){return _0x4c83ea['define'](_0x16a6('0x7'),attributes,{'tableName':_0x16a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 2943c0e..7bdcd54 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 _0x6622=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6622,0x132));var _0x2662=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x6622[_0x284506];return _0x1e9ee5;};'use strict';var _=require(_0x2662('0x0'));var util=require(_0x2662('0x1'));var moment=require(_0x2662('0x2'));var BPromise=require(_0x2662('0x3'));var rs=require(_0x2662('0x4'));var fs=require('fs');var Redis=require(_0x2662('0x5'));var db=require(_0x2662('0x6'))['db'];var utils=require(_0x2662('0x7'));var logger=require(_0x2662('0x8'))(_0x2662('0x9'));var config=require('../../config/environment');var jayson=require(_0x2662('0xa'));var client=jayson['client'][_0x2662('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38a40f,_0x442e6d,_0x5850d2){return new BPromise(function(_0x5eccde,_0x148512){return client[_0x2662('0xc')](_0x38a40f,_0x5850d2)[_0x2662('0xd')](function(_0x45e593){logger[_0x2662('0xe')](_0x2662('0xf'),_0x442e6d,_0x2662('0x10'));logger[_0x2662('0x11')]('Variable,\x20%s,\x20%s,\x20%s',_0x442e6d,_0x2662('0x10'),JSON[_0x2662('0x12')](_0x45e593));if(_0x45e593['error']){if(_0x45e593[_0x2662('0x13')][_0x2662('0x14')]===0x1f4){logger[_0x2662('0x13')](_0x2662('0xf'),_0x442e6d,_0x45e593[_0x2662('0x13')][_0x2662('0x15')]);return _0x148512(_0x45e593[_0x2662('0x13')][_0x2662('0x15')]);}logger[_0x2662('0x13')](_0x2662('0xf'),_0x442e6d,_0x45e593[_0x2662('0x13')][_0x2662('0x15')]);return _0x5eccde(_0x45e593[_0x2662('0x13')][_0x2662('0x15')]);}else{logger['info'](_0x2662('0xf'),_0x442e6d,'request\x20sent');_0x5eccde(_0x45e593[_0x2662('0x16')][_0x2662('0x15')]);}})[_0x2662('0x17')](function(_0x474ee7){logger[_0x2662('0x13')](_0x2662('0xf'),_0x442e6d,_0x474ee7);_0x148512(_0x474ee7);});});}exports[_0x2662('0x18')]=function(_0x4d9fb5){var _0x23682b=this;return new Promise(function(_0x33fb9f,_0xb409f1){return db[_0x2662('0x19')][_0x2662('0x1a')]({'raw':_0x4d9fb5[_0x2662('0x1b')]?_0x4d9fb5[_0x2662('0x1b')][_0x2662('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d9fb5[_0x2662('0x1b')]?_0x4d9fb5['options'][_0x2662('0x1d')]||null:null,'attributes':_0x4d9fb5[_0x2662('0x1b')]?_0x4d9fb5[_0x2662('0x1b')][_0x2662('0x1e')]||null:null,'include':_0x4d9fb5[_0x2662('0x1b')]?_0x4d9fb5['options'][_0x2662('0x1f')]?_[_0x2662('0x20')](_0x4d9fb5['options'][_0x2662('0x1f')],function(_0x76120d){return{'model':db[_0x76120d['model']],'as':_0x76120d['as'],'attributes':_0x76120d[_0x2662('0x1e')],'include':_0x76120d[_0x2662('0x1f')]?_[_0x2662('0x20')](_0x76120d['include'],function(_0x58cd59){return{'model':db[_0x58cd59[_0x2662('0x21')]],'as':_0x58cd59['as'],'attributes':_0x58cd59['attributes'],'include':_0x58cd59[_0x2662('0x1f')]?_[_0x2662('0x20')](_0x58cd59[_0x2662('0x1f')],function(_0x3fc50f){return{'model':db[_0x3fc50f[_0x2662('0x21')]],'as':_0x3fc50f['as'],'attributes':_0x3fc50f[_0x2662('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6d835d){logger['info'](_0x2662('0x18'),_0x4d9fb5);logger['debug'](_0x2662('0x18'),_0x4d9fb5,JSON[_0x2662('0x12')](_0x6d835d));_0x33fb9f(_0x6d835d);})[_0x2662('0x17')](function(_0x54d326){logger[_0x2662('0x13')](_0x2662('0x18'),_0x54d326['message'],_0x4d9fb5);_0xb409f1(_0x23682b['error'](0x1f4,_0x54d326['message']));});});}; \ No newline at end of file +var _0x8ace=['error','code','message','request\x20sent','result','catch','ShowVariable','Variable','find','options','where','include','map','attributes','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x8ace,0x12f));var _0xe8ac=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0x8ace[_0x40927b];return _0x2635e8;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require('moment');var BPromise=require(_0xe8ac('0x2'));var rs=require(_0xe8ac('0x3'));var fs=require('fs');var Redis=require(_0xe8ac('0x4'));var db=require(_0xe8ac('0x5'))['db'];var utils=require(_0xe8ac('0x6'));var logger=require(_0xe8ac('0x7'))(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var jayson=require(_0xe8ac('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4beaf6,_0x1d72f7,_0x6f3af2){return new BPromise(function(_0x27edf1,_0x3af600){return client[_0xe8ac('0xb')](_0x4beaf6,_0x6f3af2)[_0xe8ac('0xc')](function(_0x364302){logger[_0xe8ac('0xd')](_0xe8ac('0xe'),_0x1d72f7,'request\x20sent');logger['debug'](_0xe8ac('0xf'),_0x1d72f7,'request\x20sent',JSON[_0xe8ac('0x10')](_0x364302));if(_0x364302['error']){if(_0x364302[_0xe8ac('0x11')][_0xe8ac('0x12')]===0x1f4){logger[_0xe8ac('0x11')](_0xe8ac('0xe'),_0x1d72f7,_0x364302[_0xe8ac('0x11')][_0xe8ac('0x13')]);return _0x3af600(_0x364302[_0xe8ac('0x11')][_0xe8ac('0x13')]);}logger[_0xe8ac('0x11')](_0xe8ac('0xe'),_0x1d72f7,_0x364302[_0xe8ac('0x11')][_0xe8ac('0x13')]);return _0x27edf1(_0x364302[_0xe8ac('0x11')][_0xe8ac('0x13')]);}else{logger['info'](_0xe8ac('0xe'),_0x1d72f7,_0xe8ac('0x14'));_0x27edf1(_0x364302[_0xe8ac('0x15')][_0xe8ac('0x13')]);}})[_0xe8ac('0x16')](function(_0x2438b9){logger[_0xe8ac('0x11')](_0xe8ac('0xe'),_0x1d72f7,_0x2438b9);_0x3af600(_0x2438b9);});});}exports[_0xe8ac('0x17')]=function(_0x3fd052){var _0x42a579=this;return new Promise(function(_0x4b02cd,_0x5249ee){return db[_0xe8ac('0x18')][_0xe8ac('0x19')]({'raw':_0x3fd052['options']?_0x3fd052[_0xe8ac('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3fd052['options']?_0x3fd052[_0xe8ac('0x1a')][_0xe8ac('0x1b')]||null:null,'attributes':_0x3fd052[_0xe8ac('0x1a')]?_0x3fd052[_0xe8ac('0x1a')]['attributes']||null:null,'include':_0x3fd052[_0xe8ac('0x1a')]?_0x3fd052[_0xe8ac('0x1a')][_0xe8ac('0x1c')]?_['map'](_0x3fd052['options'][_0xe8ac('0x1c')],function(_0x1e79fd){return{'model':db[_0x1e79fd['model']],'as':_0x1e79fd['as'],'attributes':_0x1e79fd['attributes'],'include':_0x1e79fd['include']?_[_0xe8ac('0x1d')](_0x1e79fd[_0xe8ac('0x1c')],function(_0x24d2c0){return{'model':db[_0x24d2c0['model']],'as':_0x24d2c0['as'],'attributes':_0x24d2c0[_0xe8ac('0x1e')],'include':_0x24d2c0['include']?_[_0xe8ac('0x1d')](_0x24d2c0[_0xe8ac('0x1c')],function(_0x775572){return{'model':db[_0x775572['model']],'as':_0x775572['as'],'attributes':_0x775572['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8ac('0xc')](function(_0x1aea00){logger[_0xe8ac('0xd')](_0xe8ac('0x17'),_0x3fd052);logger[_0xe8ac('0x1f')](_0xe8ac('0x17'),_0x3fd052,JSON[_0xe8ac('0x10')](_0x1aea00));_0x4b02cd(_0x1aea00);})[_0xe8ac('0x16')](function(_0x291b22){logger[_0xe8ac('0x11')](_0xe8ac('0x17'),_0x291b22['message'],_0x3fd052);_0x5249ee(_0x42a579[_0xe8ac('0x11')](0x1f4,_0x291b22['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1884fed..76e816d 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 _0x3ccf=['/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x139c36,_0x8becd6){var _0x1e36db=function(_0xd22768){while(--_0xd22768){_0x139c36['push'](_0x139c36['shift']());}};_0x1e36db(++_0x8becd6);}(_0x3ccf,0x198));var _0xf3cc=function(_0xa3f3d7,_0x5138b4){_0xa3f3d7=_0xa3f3d7-0x0;var _0x205ae5=_0x3ccf[_0xa3f3d7];return _0x205ae5;};'use strict';var express=require(_0xf3cc('0x0'));var router=express[_0xf3cc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf3cc('0x2'));router[_0xf3cc('0x3')]('/',controller['index']);router[_0xf3cc('0x3')](_0xf3cc('0x4'),auth[_0xf3cc('0x5')](),auth[_0xf3cc('0x6')](),controller[_0xf3cc('0x7')]);router[_0xf3cc('0x3')](_0xf3cc('0x8'),auth[_0xf3cc('0x5')](),auth[_0xf3cc('0x6')](),controller[_0xf3cc('0x9')]);router[_0xf3cc('0x3')](_0xf3cc('0xa'),auth['isAuthenticated'](),auth[_0xf3cc('0x6')](),controller[_0xf3cc('0xb')]);router['get'](_0xf3cc('0xc'),auth[_0xf3cc('0x5')](),controller[_0xf3cc('0xd')]);router[_0xf3cc('0x3')](_0xf3cc('0xe'),controller['migrations']);module[_0xf3cc('0xf')]=router; \ No newline at end of file +var _0x1c06=['pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x3e01c8,_0x30ec78){var _0x2a6804=function(_0x499374){while(--_0x499374){_0x3e01c8['push'](_0x3e01c8['shift']());}};_0x2a6804(++_0x30ec78);}(_0x1c06,0xc0));var _0x61c0=function(_0x7b341f,_0x11e481){_0x7b341f=_0x7b341f-0x0;var _0x46d0a1=_0x1c06[_0x7b341f];return _0x46d0a1;};'use strict';var express=require(_0x61c0('0x0'));var router=express[_0x61c0('0x1')]();var auth=require(_0x61c0('0x2'));var controller=require(_0x61c0('0x3'));router['get']('/',controller[_0x61c0('0x4')]);router[_0x61c0('0x5')]('/fetch',auth[_0x61c0('0x6')](),auth[_0x61c0('0x7')](),controller[_0x61c0('0x8')]);router[_0x61c0('0x5')](_0x61c0('0x9'),auth[_0x61c0('0x6')](),auth[_0x61c0('0x7')](),controller[_0x61c0('0xa')]);router[_0x61c0('0x5')](_0x61c0('0xb'),auth['isAuthenticated'](),auth[_0x61c0('0x7')](),controller[_0x61c0('0xc')]);router[_0x61c0('0x5')](_0x61c0('0xd'),auth[_0x61c0('0x6')](),controller[_0x61c0('0xe')]);router['get'](_0x61c0('0xf'),controller[_0x61c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ee49866..4b8c9c9 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 _0x6691=['sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','migrations','length','.js','push','sort','Migration'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6691,0x12d));var _0x1669=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6691[_0x6c993a];return _0x27f547;};'use strict';var Umzug=require(_0x1669('0x0'));var path=require(_0x1669('0x1'));var fs=require('fs');var _=require(_0x1669('0x2'));var pkginfo=require(_0x1669('0x3'))(module,_0x1669('0x4'));var compareVersions=require(_0x1669('0x5'));var exec=require(_0x1669('0x6'))[_0x1669('0x7')];var db=require(_0x1669('0x8'))['db'];var config=require(_0x1669('0x9'));var pm2=require('../../config/pm2');var logger=require(_0x1669('0xa'))(_0x1669('0xb'));var git=require(_0x1669('0xc'))(config[_0x1669('0xd')]);exports['index']=function(_0x5d23fd,_0x59d1e5){var _0x3420d5={'current':module['exports']['version'],'phonebar':0x2};if(_0x5d23fd['query']&&_0x5d23fd[_0x1669('0xe')]['latest']){return git[_0x1669('0xf')]()[_0x1669('0x10')](function(_0xdf793d,_0x14907e){_0x3420d5[_0x1669('0x11')]=(_0xdf793d?module[_0x1669('0x12')][_0x1669('0x4')]:_0x14907e[_0x1669('0x11')])||_0x1669('0x13');return _0x59d1e5[_0x1669('0x14')](0xc8)[_0x1669('0x15')](_0x3420d5);});}else{return _0x59d1e5[_0x1669('0x14')](0xc8)[_0x1669('0x15')](_0x3420d5);}};exports[_0x1669('0xf')]=function(_0x804289,_0x355ac3){return git[_0x1669('0xf')]([_0x1669('0x16'),_0x1669('0x17')],function(_0x318db1){if(_0x318db1){logger[_0x1669('0x18')](_0x318db1);return _0x355ac3[_0x1669('0x14')](0x1f4)[_0x1669('0x15')](_0x318db1);}logger['info'](_0x1669('0x19'));return _0x355ac3[_0x1669('0x14')](0xc8)[_0x1669('0x15')]({'output':_0x1669('0x1a')});});};exports[_0x1669('0x1b')]=function(_0x5d7585,_0x56e3d9){return git[_0x1669('0x1b')]([_0x1669('0x1c'),_0x1669('0x1d')],function(_0x4fcf1c){if(_0x4fcf1c){logger[_0x1669('0x18')](_0x4fcf1c);return _0x56e3d9[_0x1669('0x14')](0x1f4)[_0x1669('0x15')](_0x4fcf1c);}logger['info'](_0x1669('0x1e'));return _0x56e3d9[_0x1669('0x14')](0xc8)['json']({'output':_0x1669('0x1f')});});};exports[_0x1669('0x20')]=function(_0x4e1b1b,_0x2a5ef1){exec(_0x1669('0x21'),function(_0x2e95c3,_0x17c227,_0x311f56){logger['info'](_0x17c227);logger[_0x1669('0x22')](_0x311f56);if(_0x2e95c3){logger[_0x1669('0x18')](_0x2e95c3);return _0x2a5ef1[_0x1669('0x14')](0x1f4)['json'](_0x2e95c3);}return _0x2a5ef1[_0x1669('0x14')](0xc8)['json']({'output':_0x17c227});});};exports['restart']=function(_0x238ce2,_0x50c9a0){return pm2[_0x1669('0x23')](_0x1669('0x24'))[_0x1669('0x25')](function(_0x51eacb){logger[_0x1669('0x22')](_0x1669('0x26'),_0x51eacb);return _0x50c9a0[_0x1669('0x14')](0xc8)['json']({'output':_0x1669('0x27')});})['catch'](function(_0x207c9f){logger[_0x1669('0x18')](_0x207c9f);return _0x50c9a0['status'](0x1f4)[_0x1669('0x15')](_0x207c9f);});};exports['migrations']=function(_0x29aff9,_0x1512e2){var _0x31f4f0=fs[_0x1669('0x28')](path['join'](config['root'],'server',_0x1669('0x29')));var _0x6429dc=[];for(var _0x1cbaa7=0x0;_0x1cbaa7<_0x31f4f0[_0x1669('0x2a')];_0x1cbaa7++){var _0x3af755=_0x31f4f0[_0x1cbaa7]['replace'](_0x1669('0x2b'),'');if(compareVersions(module[_0x1669('0x12')][_0x1669('0x4')],_0x3af755)===-0x1){_0x6429dc[_0x1669('0x2c')](_0x3af755);}}if(_0x6429dc[_0x1669('0x2a')]){var _0x24fa95=_0x6429dc[_0x1669('0x2d')](compareVersions);var _0x4414cd=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x1669('0x2e')],'modelName':'Migration','columnName':_0x1669('0x4')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x1669('0x2f')][_0x1669('0x30')],function(){throw new Error(_0x1669('0x31'));}],'path':path[_0x1669('0x32')](config[_0x1669('0xd')],_0x1669('0x33'),_0x1669('0x29')),'pattern':/\.js$/}});_0x4414cd['up']({'migrations':_[_0x1669('0x34')](_0x24fa95,function(_0x2683fe){return _0x2683fe+'.js';})})[_0x1669('0x25')](function(){return _0x1512e2[_0x1669('0x14')](0xc8)[_0x1669('0x15')]({'output':_0x1669('0x35')+module[_0x1669('0x12')][_0x1669('0x4')]+_0x1669('0x36')+_['last'](_0x24fa95),'migrations':_[_0x1669('0x32')](_0x24fa95)});})[_0x1669('0x37')](function(_0x373c81){if(_0x373c81 instanceof db[_0x1669('0x2f')][_0x1669('0x38')]){return _0x1512e2[_0x1669('0x14')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1512e2['status'](0x1f4)[_0x1669('0x15')](_0x373c81);}});}else{return _0x1512e2[_0x1669('0x14')](0xc8)[_0x1669('0x15')]({'output':_0x1669('0x39')});}}; \ No newline at end of file +var _0x5c96=['migrations','readdirSync','root','server','length','replace','exports','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0x5c96,0x133));var _0x65c9=function(_0x14ae47,_0x28aa16){_0x14ae47=_0x14ae47-0x0;var _0xc716d6=_0x5c96[_0x14ae47];return _0xc716d6;};'use strict';var Umzug=require(_0x65c9('0x0'));var path=require(_0x65c9('0x1'));var fs=require('fs');var _=require(_0x65c9('0x2'));var pkginfo=require(_0x65c9('0x3'))(module,'version');var compareVersions=require(_0x65c9('0x4'));var exec=require(_0x65c9('0x5'))[_0x65c9('0x6')];var db=require(_0x65c9('0x7'))['db'];var config=require(_0x65c9('0x8'));var pm2=require(_0x65c9('0x9'));var logger=require(_0x65c9('0xa'))('update');var git=require('simple-git')(config['root']);exports['index']=function(_0x1a9b93,_0x10a355){var _0x1c679d={'current':module['exports'][_0x65c9('0xb')],'phonebar':0x2};if(_0x1a9b93[_0x65c9('0xc')]&&_0x1a9b93[_0x65c9('0xc')][_0x65c9('0xd')]){return git[_0x65c9('0xe')]()[_0x65c9('0xf')](function(_0x292827,_0x4f7e7a){_0x1c679d['latest']=(_0x292827?module['exports'][_0x65c9('0xb')]:_0x4f7e7a[_0x65c9('0xd')])||_0x65c9('0x10');return _0x10a355[_0x65c9('0x11')](0xc8)[_0x65c9('0x12')](_0x1c679d);});}else{return _0x10a355['status'](0xc8)[_0x65c9('0x12')](_0x1c679d);}};exports[_0x65c9('0xe')]=function(_0x436a6c,_0x13d1bb){return git['fetch']([_0x65c9('0x13'),_0x65c9('0x14')],function(_0x379f5f){if(_0x379f5f){logger[_0x65c9('0x15')](_0x379f5f);return _0x13d1bb[_0x65c9('0x11')](0x1f4)[_0x65c9('0x12')](_0x379f5f);}logger[_0x65c9('0x16')](_0x65c9('0x17'));return _0x13d1bb[_0x65c9('0x11')](0xc8)[_0x65c9('0x12')]({'output':_0x65c9('0x18')});});};exports[_0x65c9('0x19')]=function(_0x4d31d3,_0x51f948){return git[_0x65c9('0x19')]([_0x65c9('0x1a'),_0x65c9('0x1b')],function(_0x1caf2a){if(_0x1caf2a){logger[_0x65c9('0x15')](_0x1caf2a);return _0x51f948[_0x65c9('0x11')](0x1f4)[_0x65c9('0x12')](_0x1caf2a);}logger['info'](_0x65c9('0x1c'));return _0x51f948['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x179812,_0x133225){exec(_0x65c9('0x1d'),function(_0x20258f,_0x26ed90,_0x106b9e){logger[_0x65c9('0x16')](_0x26ed90);logger[_0x65c9('0x16')](_0x106b9e);if(_0x20258f){logger[_0x65c9('0x15')](_0x20258f);return _0x133225[_0x65c9('0x11')](0x1f4)[_0x65c9('0x12')](_0x20258f);}return _0x133225['status'](0xc8)[_0x65c9('0x12')]({'output':_0x26ed90});});};exports[_0x65c9('0x1e')]=function(_0x3f5d1e,_0x3841a7){return pm2[_0x65c9('0x1e')](_0x65c9('0x1f'))[_0x65c9('0x20')](function(_0x4c6469){logger[_0x65c9('0x16')](_0x65c9('0x21'),_0x4c6469);return _0x3841a7['status'](0xc8)[_0x65c9('0x12')]({'output':_0x65c9('0x22')});})['catch'](function(_0x1db634){logger[_0x65c9('0x15')](_0x1db634);return _0x3841a7['status'](0x1f4)['json'](_0x1db634);});};exports[_0x65c9('0x23')]=function(_0x5612e9,_0x436c32){var _0x50fb61=fs[_0x65c9('0x24')](path['join'](config[_0x65c9('0x25')],_0x65c9('0x26'),_0x65c9('0x23')));var _0x547e4d=[];for(var _0x393173=0x0;_0x393173<_0x50fb61[_0x65c9('0x27')];_0x393173++){var _0x499fa6=_0x50fb61[_0x393173][_0x65c9('0x28')]('.js','');if(compareVersions(module[_0x65c9('0x29')][_0x65c9('0xb')],_0x499fa6)===-0x1){_0x547e4d[_0x65c9('0x2a')](_0x499fa6);}}if(_0x547e4d[_0x65c9('0x27')]){var _0x5315f2=_0x547e4d[_0x65c9('0x2b')](compareVersions);var _0x34b80b=new Umzug({'storage':_0x65c9('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':_0x65c9('0x2d'),'columnName':_0x65c9('0xb')},'migrations':{'params':[db['sequelize'][_0x65c9('0x2e')](),db['sequelize'][_0x65c9('0x2f')],function(){throw new Error(_0x65c9('0x30'));}],'path':path[_0x65c9('0x31')](config[_0x65c9('0x25')],'server',_0x65c9('0x23')),'pattern':/\.js$/}});_0x34b80b['up']({'migrations':_[_0x65c9('0x32')](_0x5315f2,function(_0x5309b3){return _0x5309b3+_0x65c9('0x33');})})[_0x65c9('0x20')](function(){return _0x436c32[_0x65c9('0x11')](0xc8)[_0x65c9('0x12')]({'output':_0x65c9('0x34')+module[_0x65c9('0x29')][_0x65c9('0xb')]+_0x65c9('0x35')+_[_0x65c9('0x36')](_0x5315f2),'migrations':_[_0x65c9('0x31')](_0x5315f2)});})[_0x65c9('0x37')](function(_0x3f6df7){if(_0x3f6df7 instanceof db[_0x65c9('0x2c')][_0x65c9('0x38')]){return _0x436c32[_0x65c9('0x11')](0xc8)[_0x65c9('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x436c32[_0x65c9('0x11')](0x1f4)['json'](_0x3f6df7);}});}else{return _0x436c32[_0x65c9('0x11')](0xc8)[_0x65c9('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 90e3541..fa3e99f 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 _0x58eb=['connect-timeout','Router','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x505e50,_0x3c32e9){var _0x37ef44=function(_0x4cbcc7){while(--_0x4cbcc7){_0x505e50['push'](_0x505e50['shift']());}};_0x37ef44(++_0x3c32e9);}(_0x58eb,0x15f));var _0xb58e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58eb[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xb58e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb58e('0x1'));var express=require('express');var router=express[_0xb58e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb58e('0x3'));var config=require('../../config/environment');var controller=require(_0xb58e('0x4'));router['get']('/',auth[_0xb58e('0x5')](),controller['index']);router[_0xb58e('0x6')](_0xb58e('0x7'),auth['isAuthenticated'](),controller[_0xb58e('0x8')]);router[_0xb58e('0x6')](_0xb58e('0x9'),auth[_0xb58e('0x5')](),controller[_0xb58e('0xa')]);router[_0xb58e('0xb')]('/',auth[_0xb58e('0x5')](),controller['create']);router[_0xb58e('0xc')](_0xb58e('0x9'),auth['isAuthenticated'](),controller[_0xb58e('0xd')]);router['delete'](_0xb58e('0x9'),auth[_0xb58e('0x5')](),controller[_0xb58e('0xe')]);module[_0xb58e('0xf')]=router; \ No newline at end of file +var _0x5973=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x22fd6a,_0x50be64){var _0x31a7fe=function(_0x3dae06){while(--_0x3dae06){_0x22fd6a['push'](_0x22fd6a['shift']());}};_0x31a7fe(++_0x50be64);}(_0x5973,0x151));var _0x3597=function(_0x9c08ca,_0x4d3960){_0x9c08ca=_0x9c08ca-0x0;var _0x26541e=_0x5973[_0x9c08ca];return _0x26541e;};'use strict';var multer=require(_0x3597('0x0'));var util=require(_0x3597('0x1'));var path=require(_0x3597('0x2'));var timeout=require(_0x3597('0x3'));var express=require(_0x3597('0x4'));var router=express[_0x3597('0x5')]();var auth=require(_0x3597('0x6'));var interaction=require(_0x3597('0x7'));var config=require('../../config/environment');var controller=require(_0x3597('0x8'));router[_0x3597('0x9')]('/',auth[_0x3597('0xa')](),controller['index']);router[_0x3597('0x9')](_0x3597('0xb'),auth['isAuthenticated'](),controller[_0x3597('0xc')]);router[_0x3597('0x9')](_0x3597('0xd'),auth[_0x3597('0xa')](),controller[_0x3597('0xe')]);router[_0x3597('0xf')]('/',auth[_0x3597('0xa')](),controller[_0x3597('0x10')]);router[_0x3597('0x11')](_0x3597('0xd'),auth[_0x3597('0xa')](),controller[_0x3597('0x12')]);router[_0x3597('0x13')]('/:id',auth[_0x3597('0xa')](),controller['destroy']);module[_0x3597('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f03676a..84e5f91 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 _0xee14=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING'];(function(_0x2a2558,_0xb534a1){var _0x58e718=function(_0x47dff6){while(--_0x47dff6){_0x2a2558['push'](_0x2a2558['shift']());}};_0x58e718(++_0xb534a1);}(_0xee14,0x13a));var _0x4ee1=function(_0x170ef2,_0x353a66){_0x170ef2=_0x170ef2-0x0;var _0x35d027=_0xee14[_0x170ef2];return _0x35d027;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4ee1('0x0')]},'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridnum':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'queue':{'type':Sequelize[_0x4ee1('0x0')]},'interface':{'type':Sequelize[_0x4ee1('0x0')]},'membername':{'type':Sequelize[_0x4ee1('0x0')]},'agentcalledAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentconnectAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4ee1('0x2')]},'agentcomplete':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4ee1('0x2')]},'agentacw':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4ee1('0x0')]},'lastevent':{'type':Sequelize[_0x4ee1('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4ee1('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4ee1('0x0')]},'connectedlinenum':{'type':Sequelize[_0x4ee1('0x0')]},'connectedlinename':{'type':Sequelize[_0x4ee1('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'exten':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'destchannel':{'type':Sequelize[_0x4ee1('0x0')]},'destchannelstate':{'type':Sequelize[_0x4ee1('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4ee1('0x0')]},'destcalleridname':{'type':Sequelize[_0x4ee1('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4ee1('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4ee1('0x0')]},'destlanguage':{'type':Sequelize[_0x4ee1('0x0')]},'destaccountcode':{'type':Sequelize[_0x4ee1('0x0')]},'destcontext':{'type':Sequelize[_0x4ee1('0x0')]},'destexten':{'type':Sequelize[_0x4ee1('0x0')]},'destpriority':{'type':Sequelize[_0x4ee1('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x4ee1('0x0')]},'transfer':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4ee1('0x0')],'comment':_0x4ee1('0x4')},'transferexten':{'type':Sequelize[_0x4ee1('0x0')]},'transferuniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'agententerreason':{'type':Sequelize[_0x4ee1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2ca=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x69e47b,_0x2ab23b){var _0x5392a3=function(_0x4a7581){while(--_0x4a7581){_0x69e47b['push'](_0x69e47b['shift']());}};_0x5392a3(++_0x2ab23b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xf2ca[_0x2f45ea];return _0x485a84;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'type':{'type':Sequelize[_0xaf2c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'queue':{'type':Sequelize[_0xaf2c('0x2')]},'interface':{'type':Sequelize[_0xaf2c('0x2')]},'membername':{'type':Sequelize[_0xaf2c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xaf2c('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaf2c('0x2')]},'channelstate':{'type':Sequelize[_0xaf2c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize[_0xaf2c('0x2')]},'destpriority':{'type':Sequelize[_0xaf2c('0x2')]},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xaf2c('0x2')]},'transfer':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index fb1571a..64c559b 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 _0xbb30=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','index','map','VoiceAgentReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','html-pdf'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0xbb30,0xda));var _0x0bb3=function(_0x533ac8,_0x2c4fde){_0x533ac8=_0x533ac8-0x0;var _0x48ae7c=_0xbb30[_0x533ac8];return _0x48ae7c;};'use strict';var pdf=require(_0x0bb3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bb3('0x1'));var zipdir=require(_0x0bb3('0x2'));var jsonpatch=require(_0x0bb3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0bb3('0x4'));var Mustache=require(_0x0bb3('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bb3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0bb3('0x7'));var squel=require('squel');var crypto=require(_0x0bb3('0x8'));var jsforce=require(_0x0bb3('0x9'));var deskjs=require(_0x0bb3('0xa'));var toCsv=require(_0x0bb3('0x6'));var querystring=require(_0x0bb3('0xb'));var Papa=require(_0x0bb3('0xc'));var Redis=require(_0x0bb3('0xd'));var authService=require(_0x0bb3('0xe'));var qs=require(_0x0bb3('0xf'));var as=require(_0x0bb3('0x10'));var hardwareService=require(_0x0bb3('0x11'));var logger=require(_0x0bb3('0x12'))(_0x0bb3('0x13'));var utils=require(_0x0bb3('0x14'));var config=require(_0x0bb3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x411d1b,_0x185f47){_0x185f47=_0x185f47||0xcc;return function(_0xc45a15){if(_0xc45a15){return _0x411d1b[_0x0bb3('0x16')](_0x185f47);}return _0x411d1b[_0x0bb3('0x17')](_0x185f47)['end']();};}function respondWithResult(_0x382934,_0x13da48){_0x13da48=_0x13da48||0xc8;return function(_0x3a587b){if(_0x3a587b){return _0x382934['status'](_0x13da48)['json'](_0x3a587b);}};}function respondWithFilteredResult(_0x1b70e1,_0x52cfa4){return function(_0x499ab5){if(_0x499ab5){var _0x18e5ac=_0x499ab5['count'],_0xf4d51e=_0x52cfa4[_0x0bb3('0x18')],_0x24fdbe=_0x52cfa4[_0x0bb3('0x18')]+_0x52cfa4['limit'],_0x2be147;if(_0x24fdbe>=_0x18e5ac){_0x24fdbe=_0x18e5ac;_0x2be147=0xc8;}else{_0x2be147=0xce;}_0x1b70e1[_0x0bb3('0x17')](_0x2be147);return _0x1b70e1[_0x0bb3('0x19')](_0x0bb3('0x1a'),_0xf4d51e+'-'+_0x24fdbe+'/'+_0x18e5ac)[_0x0bb3('0x1b')](_0x499ab5);}return null;};}function patchUpdates(_0x2a18cc){return function(_0x3dcf4e){try{jsonpatch[_0x0bb3('0x1c')](_0x3dcf4e,_0x2a18cc,!![]);}catch(_0xdc1e74){return BPromise[_0x0bb3('0x1d')](_0xdc1e74);}return _0x3dcf4e['save']();};}function saveUpdates(_0x5b7ddc,_0x3c0cdf){return function(_0x36268f){if(_0x36268f){return _0x36268f[_0x0bb3('0x1e')](_0x5b7ddc)[_0x0bb3('0x1f')](function(_0x44808e){return _0x44808e;});}return null;};}function removeEntity(_0x429b1e,_0x34ad81){return function(_0x18d199){if(_0x18d199){return _0x18d199['destroy']()['then'](function(){_0x429b1e[_0x0bb3('0x17')](0xcc)[_0x0bb3('0x20')]();});}};}function handleEntityNotFound(_0x22984d,_0x376e64){return function(_0x26ca7d){if(!_0x26ca7d){_0x22984d['sendStatus'](0x194);}return _0x26ca7d;};}function handleError(_0x439f78,_0x19fabd){_0x19fabd=_0x19fabd||0x1f4;return function(_0x5f35a5){logger['error'](_0x5f35a5[_0x0bb3('0x21')]);if(_0x5f35a5['name']){delete _0x5f35a5[_0x0bb3('0x22')];}_0x439f78[_0x0bb3('0x17')](_0x19fabd)[_0x0bb3('0x23')](_0x5f35a5);};}exports[_0x0bb3('0x24')]=function(_0x3dd4ef,_0x21a0ad){var _0xdb17e8={},_0x39b96d={},_0x9c9c62={'count':0x0,'rows':[]};var _0x560acb=_[_0x0bb3('0x25')](db[_0x0bb3('0x26')][_0x0bb3('0x27')],function(_0x54e58a){return{'name':_0x54e58a['fieldName'],'type':_0x54e58a[_0x0bb3('0x28')][_0x0bb3('0x29')]};});_0x39b96d[_0x0bb3('0x2a')]=_[_0x0bb3('0x25')](_0x560acb,_0x0bb3('0x22'));_0x39b96d[_0x0bb3('0x2b')]=_[_0x0bb3('0x2c')](_0x3dd4ef[_0x0bb3('0x2b')]);_0x39b96d[_0x0bb3('0x2d')]=_[_0x0bb3('0x2e')](_0x39b96d[_0x0bb3('0x2a')],_0x39b96d[_0x0bb3('0x2b')]);_0xdb17e8[_0x0bb3('0x2f')]=_['intersection'](_0x39b96d['model'],qs['fields'](_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x30')]));_0xdb17e8[_0x0bb3('0x2f')]=_0xdb17e8[_0x0bb3('0x2f')][_0x0bb3('0x31')]?_0xdb17e8[_0x0bb3('0x2f')]:_0x39b96d[_0x0bb3('0x2a')];if(!_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x32')](_0x0bb3('0x33'))){_0xdb17e8[_0x0bb3('0x34')]=qs[_0x0bb3('0x34')](_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x34')]);_0xdb17e8[_0x0bb3('0x18')]=qs[_0x0bb3('0x18')](_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x18')]);}_0xdb17e8[_0x0bb3('0x35')]=qs[_0x0bb3('0x36')](_0x3dd4ef['query']['sort']);_0xdb17e8[_0x0bb3('0x37')]=qs[_0x0bb3('0x2d')](_[_0x0bb3('0x38')](_0x3dd4ef[_0x0bb3('0x2b')],_0x39b96d[_0x0bb3('0x2d')]),_0x560acb);if(_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x39')]){_0xdb17e8[_0x0bb3('0x37')]=_[_0x0bb3('0x3a')](_0xdb17e8[_0x0bb3('0x37')],{'$or':_[_0x0bb3('0x25')](_0x560acb,function(_0x2ffb7c){if(_0x2ffb7c[_0x0bb3('0x28')]!==_0x0bb3('0x3b')){var _0x409465={};_0x409465[_0x2ffb7c[_0x0bb3('0x22')]]={'$like':'%'+_0x3dd4ef[_0x0bb3('0x2b')][_0x0bb3('0x39')]+'%'};return _0x409465;}})});}_0xdb17e8=_[_0x0bb3('0x3a')]({},_0xdb17e8,_0x3dd4ef[_0x0bb3('0x3c')]);var _0x5cb81e={'where':_0xdb17e8[_0x0bb3('0x37')]};return db['VoiceAgentReport'][_0x0bb3('0x3d')](_0x5cb81e)[_0x0bb3('0x1f')](function(_0x24b877){_0x9c9c62[_0x0bb3('0x3d')]=_0x24b877;if(_0x3dd4ef['query'][_0x0bb3('0x3e')]){_0xdb17e8[_0x0bb3('0x3f')]=[{'all':!![]}];}return db[_0x0bb3('0x26')][_0x0bb3('0x40')](_0xdb17e8);})[_0x0bb3('0x1f')](function(_0x140844){_0x9c9c62['rows']=_0x140844;return _0x9c9c62;})['then'](respondWithFilteredResult(_0x21a0ad,_0xdb17e8))[_0x0bb3('0x41')](handleError(_0x21a0ad,null));};exports[_0x0bb3('0x42')]=function(_0x350bf0,_0xb220c0){var _0x5cf418={'raw':![],'where':{'id':_0x350bf0[_0x0bb3('0x43')]['id']}},_0x168d12={};_0x168d12[_0x0bb3('0x2a')]=_[_0x0bb3('0x2c')](db[_0x0bb3('0x26')][_0x0bb3('0x27')]);_0x168d12['query']=_[_0x0bb3('0x2c')](_0x350bf0[_0x0bb3('0x2b')]);_0x168d12[_0x0bb3('0x2d')]=_[_0x0bb3('0x2e')](_0x168d12['model'],_0x168d12[_0x0bb3('0x2b')]);_0x5cf418[_0x0bb3('0x2f')]=_['intersection'](_0x168d12['model'],qs[_0x0bb3('0x30')](_0x350bf0[_0x0bb3('0x2b')][_0x0bb3('0x30')]));_0x5cf418['attributes']=_0x5cf418[_0x0bb3('0x2f')][_0x0bb3('0x31')]?_0x5cf418[_0x0bb3('0x2f')]:_0x168d12['model'];if(_0x350bf0[_0x0bb3('0x2b')][_0x0bb3('0x3e')]){_0x5cf418[_0x0bb3('0x3f')]=[{'all':!![]}];}_0x5cf418=_[_0x0bb3('0x3a')]({},_0x5cf418,_0x350bf0['options']);return db[_0x0bb3('0x26')][_0x0bb3('0x44')](_0x5cf418)['then'](handleEntityNotFound(_0xb220c0,null))['then'](respondWithResult(_0xb220c0,null))['catch'](handleError(_0xb220c0,null));};exports[_0x0bb3('0x45')]=function(_0x14c606,_0x49d375){return db['VoiceAgentReport']['create'](_0x14c606['body'],{})[_0x0bb3('0x1f')](respondWithResult(_0x49d375,0xc9))[_0x0bb3('0x41')](handleError(_0x49d375,null));};exports[_0x0bb3('0x1e')]=function(_0x2799fc,_0x68edfd){if(_0x2799fc['body']['id']){delete _0x2799fc[_0x0bb3('0x46')]['id'];}return db[_0x0bb3('0x26')]['find']({'where':{'id':_0x2799fc[_0x0bb3('0x43')]['id']}})[_0x0bb3('0x1f')](handleEntityNotFound(_0x68edfd,null))[_0x0bb3('0x1f')](saveUpdates(_0x2799fc[_0x0bb3('0x46')],null))[_0x0bb3('0x1f')](respondWithResult(_0x68edfd,null))[_0x0bb3('0x41')](handleError(_0x68edfd,null));};exports[_0x0bb3('0x47')]=function(_0x24c9fb,_0xe92c3){return db[_0x0bb3('0x26')][_0x0bb3('0x44')]({'where':{'id':_0x24c9fb[_0x0bb3('0x43')]['id']}})[_0x0bb3('0x1f')](handleEntityNotFound(_0xe92c3,null))[_0x0bb3('0x1f')](removeEntity(_0xe92c3,null))[_0x0bb3('0x41')](handleError(_0xe92c3,null));};exports[_0x0bb3('0x48')]=function(_0x19212e,_0x118503){return db[_0x0bb3('0x26')][_0x0bb3('0x48')]()[_0x0bb3('0x1f')](respondWithResult(_0x118503,null))[_0x0bb3('0x41')](handleError(_0x118503,null));}; \ No newline at end of file +var _0x0b45=['includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0b45,0x130));var _0x50b4=function(_0x998453,_0x5419cf){_0x998453=_0x998453-0x0;var _0x4fa8dd=_0x0b45[_0x998453];return _0x4fa8dd;};'use strict';var pdf=require(_0x50b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x50b4('0x1'));var zipdir=require(_0x50b4('0x2'));var jsonpatch=require(_0x50b4('0x3'));var rp=require(_0x50b4('0x4'));var moment=require(_0x50b4('0x5'));var BPromise=require(_0x50b4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x50b4('0x7'));var sox=require(_0x50b4('0x8'));var csv=require(_0x50b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x50b4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50b4('0xb'));var toCsv=require(_0x50b4('0x9'));var querystring=require('querystring');var Papa=require(_0x50b4('0xc'));var Redis=require(_0x50b4('0xd'));var authService=require(_0x50b4('0xe'));var qs=require(_0x50b4('0xf'));var as=require(_0x50b4('0x10'));var hardwareService=require(_0x50b4('0x11'));var logger=require(_0x50b4('0x12'))(_0x50b4('0x13'));var utils=require(_0x50b4('0x14'));var config=require('../../config/environment');var db=require(_0x50b4('0x15'))['db'];function respondWithStatusCode(_0x3b15a8,_0xabc96b){_0xabc96b=_0xabc96b||0xcc;return function(_0x1df6ba){if(_0x1df6ba){return _0x3b15a8[_0x50b4('0x16')](_0xabc96b);}return _0x3b15a8[_0x50b4('0x17')](_0xabc96b)[_0x50b4('0x18')]();};}function respondWithResult(_0x4f7d70,_0x5e59fa){_0x5e59fa=_0x5e59fa||0xc8;return function(_0x1437df){if(_0x1437df){return _0x4f7d70[_0x50b4('0x17')](_0x5e59fa)[_0x50b4('0x19')](_0x1437df);}};}function respondWithFilteredResult(_0x2a323a,_0x5504c8){return function(_0x447195){if(_0x447195){var _0x10ce40=_0x447195[_0x50b4('0x1a')],_0xa971b=_0x5504c8['offset'],_0x3b682c=_0x5504c8[_0x50b4('0x1b')]+_0x5504c8['limit'],_0x2f22a9;if(_0x3b682c>=_0x10ce40){_0x3b682c=_0x10ce40;_0x2f22a9=0xc8;}else{_0x2f22a9=0xce;}_0x2a323a['status'](_0x2f22a9);return _0x2a323a[_0x50b4('0x1c')](_0x50b4('0x1d'),_0xa971b+'-'+_0x3b682c+'/'+_0x10ce40)[_0x50b4('0x19')](_0x447195);}return null;};}function patchUpdates(_0x4af0f6){return function(_0x420766){try{jsonpatch[_0x50b4('0x1e')](_0x420766,_0x4af0f6,!![]);}catch(_0x4d2503){return BPromise[_0x50b4('0x1f')](_0x4d2503);}return _0x420766[_0x50b4('0x20')]();};}function saveUpdates(_0xc7b39c,_0x173985){return function(_0x11bbc4){if(_0x11bbc4){return _0x11bbc4[_0x50b4('0x21')](_0xc7b39c)[_0x50b4('0x22')](function(_0x307ffb){return _0x307ffb;});}return null;};}function removeEntity(_0x37327b,_0x1426cf){return function(_0x5cff9b){if(_0x5cff9b){return _0x5cff9b[_0x50b4('0x23')]()[_0x50b4('0x22')](function(){_0x37327b[_0x50b4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a95c,_0x4ceff2){return function(_0x59fd92){if(!_0x59fd92){_0x28a95c['sendStatus'](0x194);}return _0x59fd92;};}function handleError(_0x4e184a,_0xcf83eb){_0xcf83eb=_0xcf83eb||0x1f4;return function(_0x8071b6){logger['error'](_0x8071b6[_0x50b4('0x24')]);if(_0x8071b6[_0x50b4('0x25')]){delete _0x8071b6[_0x50b4('0x25')];}_0x4e184a['status'](_0xcf83eb)[_0x50b4('0x26')](_0x8071b6);};}exports[_0x50b4('0x27')]=function(_0x35d16b,_0x2438dd){var _0x2cbed2={},_0x272079={},_0x2b7156={'count':0x0,'rows':[]};var _0x5e835c=_[_0x50b4('0x28')](db[_0x50b4('0x29')][_0x50b4('0x2a')],function(_0x3ffce8){return{'name':_0x3ffce8[_0x50b4('0x2b')],'type':_0x3ffce8['type']['key']};});_0x272079[_0x50b4('0x2c')]=_[_0x50b4('0x28')](_0x5e835c,_0x50b4('0x25'));_0x272079[_0x50b4('0x2d')]=_[_0x50b4('0x2e')](_0x35d16b[_0x50b4('0x2d')]);_0x272079['filters']=_[_0x50b4('0x2f')](_0x272079[_0x50b4('0x2c')],_0x272079[_0x50b4('0x2d')]);_0x2cbed2[_0x50b4('0x30')]=_[_0x50b4('0x2f')](_0x272079[_0x50b4('0x2c')],qs[_0x50b4('0x31')](_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x31')]));_0x2cbed2[_0x50b4('0x30')]=_0x2cbed2[_0x50b4('0x30')][_0x50b4('0x32')]?_0x2cbed2['attributes']:_0x272079[_0x50b4('0x2c')];if(!_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x33')](_0x50b4('0x34'))){_0x2cbed2[_0x50b4('0x35')]=qs['limit'](_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x35')]);_0x2cbed2[_0x50b4('0x1b')]=qs['offset'](_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x1b')]);}_0x2cbed2['order']=qs[_0x50b4('0x36')](_0x35d16b['query']['sort']);_0x2cbed2[_0x50b4('0x37')]=qs[_0x50b4('0x38')](_[_0x50b4('0x39')](_0x35d16b['query'],_0x272079[_0x50b4('0x38')]),_0x5e835c);if(_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x3a')]){_0x2cbed2['where']=_[_0x50b4('0x3b')](_0x2cbed2[_0x50b4('0x37')],{'$or':_[_0x50b4('0x28')](_0x5e835c,function(_0x28d8dd){if(_0x28d8dd['type']!==_0x50b4('0x3c')){var _0x3513a7={};_0x3513a7[_0x28d8dd[_0x50b4('0x25')]]={'$like':'%'+_0x35d16b[_0x50b4('0x2d')]['filter']+'%'};return _0x3513a7;}})});}_0x2cbed2=_[_0x50b4('0x3b')]({},_0x2cbed2,_0x35d16b['options']);var _0x326a66={'where':_0x2cbed2['where']};return db[_0x50b4('0x29')]['count'](_0x326a66)[_0x50b4('0x22')](function(_0x280827){_0x2b7156['count']=_0x280827;if(_0x35d16b[_0x50b4('0x2d')][_0x50b4('0x3d')]){_0x2cbed2[_0x50b4('0x3e')]=[{'all':!![]}];}return db[_0x50b4('0x29')][_0x50b4('0x3f')](_0x2cbed2);})[_0x50b4('0x22')](function(_0x1c0d2c){_0x2b7156[_0x50b4('0x40')]=_0x1c0d2c;return _0x2b7156;})[_0x50b4('0x22')](respondWithFilteredResult(_0x2438dd,_0x2cbed2))[_0x50b4('0x41')](handleError(_0x2438dd,null));};exports[_0x50b4('0x42')]=function(_0x4ea880,_0x2a2a5d){var _0x293bf1={'raw':![],'where':{'id':_0x4ea880[_0x50b4('0x43')]['id']}},_0xf5b5f={};_0xf5b5f['model']=_['keys'](db[_0x50b4('0x29')][_0x50b4('0x2a')]);_0xf5b5f[_0x50b4('0x2d')]=_['keys'](_0x4ea880[_0x50b4('0x2d')]);_0xf5b5f[_0x50b4('0x38')]=_[_0x50b4('0x2f')](_0xf5b5f[_0x50b4('0x2c')],_0xf5b5f[_0x50b4('0x2d')]);_0x293bf1[_0x50b4('0x30')]=_[_0x50b4('0x2f')](_0xf5b5f[_0x50b4('0x2c')],qs[_0x50b4('0x31')](_0x4ea880['query']['fields']));_0x293bf1['attributes']=_0x293bf1['attributes'][_0x50b4('0x32')]?_0x293bf1[_0x50b4('0x30')]:_0xf5b5f[_0x50b4('0x2c')];if(_0x4ea880[_0x50b4('0x2d')][_0x50b4('0x3d')]){_0x293bf1[_0x50b4('0x3e')]=[{'all':!![]}];}_0x293bf1=_[_0x50b4('0x3b')]({},_0x293bf1,_0x4ea880[_0x50b4('0x44')]);return db[_0x50b4('0x29')]['find'](_0x293bf1)[_0x50b4('0x22')](handleEntityNotFound(_0x2a2a5d,null))['then'](respondWithResult(_0x2a2a5d,null))[_0x50b4('0x41')](handleError(_0x2a2a5d,null));};exports[_0x50b4('0x45')]=function(_0x8be1d5,_0x19890f){return db[_0x50b4('0x29')]['create'](_0x8be1d5[_0x50b4('0x46')],{})[_0x50b4('0x22')](respondWithResult(_0x19890f,0xc9))[_0x50b4('0x41')](handleError(_0x19890f,null));};exports[_0x50b4('0x21')]=function(_0x1277af,_0x5036f4){if(_0x1277af['body']['id']){delete _0x1277af[_0x50b4('0x46')]['id'];}return db[_0x50b4('0x29')][_0x50b4('0x47')]({'where':{'id':_0x1277af[_0x50b4('0x43')]['id']}})[_0x50b4('0x22')](handleEntityNotFound(_0x5036f4,null))[_0x50b4('0x22')](saveUpdates(_0x1277af[_0x50b4('0x46')],null))[_0x50b4('0x22')](respondWithResult(_0x5036f4,null))[_0x50b4('0x41')](handleError(_0x5036f4,null));};exports[_0x50b4('0x23')]=function(_0x48ef92,_0x45ddad){return db['VoiceAgentReport'][_0x50b4('0x47')]({'where':{'id':_0x48ef92[_0x50b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x45ddad,null))[_0x50b4('0x22')](removeEntity(_0x45ddad,null))[_0x50b4('0x41')](handleError(_0x45ddad,null));};exports[_0x50b4('0x48')]=function(_0x22ab2c,_0x1d9a24){return db['VoiceAgentReport'][_0x50b4('0x48')]()['then'](respondWithResult(_0x1d9a24,null))['catch'](handleError(_0x1d9a24,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index bd2b000..4da4a41 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(_0x5997df,_0x546d57){var _0x25df4f=function(_0x1ac603){while(--_0x1ac603){_0x5997df['push'](_0x5997df['shift']());}};_0x25df4f(++_0x546d57);}(_0xedd9,0xfc));var _0x9edd=function(_0x53a9e7,_0x586464){_0x53a9e7=_0x53a9e7-0x0;var _0x363b50=_0xedd9[_0x53a9e7];return _0x363b50;};'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 _0xedd9=['./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f5d83,_0x30a464){var _0x489494=function(_0x8dacac){while(--_0x8dacac){_0x3f5d83['push'](_0x3f5d83['shift']());}};_0x489494(++_0x30a464);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f077b,_0x316228){_0x4f077b=_0x4f077b-0x0;var _0x35d4cb=_0xedd9[_0x4f077b];return _0x35d4cb;};'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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d79acaf..1f3172c 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 _0x061b=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','body','where','limit','UpdateVoiceAgentReport','stringify','util','moment','randomstring'];(function(_0x49e283,_0x354df7){var _0x2ab1e4=function(_0x243354){while(--_0x243354){_0x49e283['push'](_0x49e283['shift']());}};_0x2ab1e4(++_0x354df7);}(_0x061b,0x15d));var _0xb061=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x061b[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xb061('0x0'));var moment=require(_0xb061('0x1'));var BPromise=require('bluebird');var rs=require(_0xb061('0x2'));var fs=require('fs');var Redis=require(_0xb061('0x3'));var db=require(_0xb061('0x4'))['db'];var utils=require(_0xb061('0x5'));var logger=require('../../config/logger')(_0xb061('0x6'));var config=require(_0xb061('0x7'));var jayson=require(_0xb061('0x8'));var client=jayson[_0xb061('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6b03cb,_0x13770a,_0x25028c){return new BPromise(function(_0x3be8a1,_0x4de0cd){return client[_0xb061('0xa')](_0x6b03cb,_0x25028c)[_0xb061('0xb')](function(_0x34da68){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x13770a,_0xb061('0xc'));logger[_0xb061('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x13770a,_0xb061('0xc'),JSON['stringify'](_0x34da68));if(_0x34da68[_0xb061('0xe')]){if(_0x34da68[_0xb061('0xe')][_0xb061('0xf')]===0x1f4){logger[_0xb061('0xe')](_0xb061('0x10'),_0x13770a,_0x34da68[_0xb061('0xe')][_0xb061('0x11')]);return _0x4de0cd(_0x34da68[_0xb061('0xe')][_0xb061('0x11')]);}logger[_0xb061('0xe')](_0xb061('0x10'),_0x13770a,_0x34da68[_0xb061('0xe')][_0xb061('0x11')]);return _0x3be8a1(_0x34da68['error'][_0xb061('0x11')]);}else{logger[_0xb061('0x12')](_0xb061('0x10'),_0x13770a,_0xb061('0xc'));_0x3be8a1(_0x34da68[_0xb061('0x13')][_0xb061('0x11')]);}})[_0xb061('0x14')](function(_0x20796a){logger[_0xb061('0xe')](_0xb061('0x10'),_0x13770a,_0x20796a);_0x4de0cd(_0x20796a);});});}exports[_0xb061('0x15')]=function(_0x17cdf6){var _0x2d96c2=this;return new Promise(function(_0x50a1b1,_0x2f0125){return db[_0xb061('0x16')][_0xb061('0x17')](_0x17cdf6['body'],{'raw':_0x17cdf6[_0xb061('0x18')]?_0x17cdf6[_0xb061('0x18')][_0xb061('0x19')]===undefined?!![]:![]:!![]})[_0xb061('0xb')](function(_0xaa6b7){logger[_0xb061('0x12')](_0xb061('0x15'),_0x17cdf6);logger[_0xb061('0xd')](_0xb061('0x15'),_0x17cdf6,JSON['stringify'](_0xaa6b7));_0x50a1b1(_0xaa6b7);})[_0xb061('0x14')](function(_0x28b37d){logger[_0xb061('0xe')](_0xb061('0x15'),_0x28b37d[_0xb061('0x11')],_0x17cdf6);_0x2f0125(_0x2d96c2[_0xb061('0xe')](0x1f4,_0x28b37d['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x58f9c2){var _0x20e963=this;return new Promise(function(_0x278c3a,_0x3f7cd9){return db['VoiceAgentReport'][_0xb061('0x1a')](_0x58f9c2[_0xb061('0x1b')],{'raw':_0x58f9c2['options']?_0x58f9c2[_0xb061('0x18')][_0xb061('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f9c2[_0xb061('0x18')]?_0x58f9c2['options'][_0xb061('0x1c')]||null:null,'attributes':_0x58f9c2[_0xb061('0x18')]?_0x58f9c2[_0xb061('0x18')]['attributes']||null:null,'limit':_0x58f9c2[_0xb061('0x18')]?_0x58f9c2[_0xb061('0x18')][_0xb061('0x1d')]||null:null})[_0xb061('0xb')](function(_0x4b86c2){logger[_0xb061('0x12')](_0xb061('0x1e'),_0x58f9c2);logger[_0xb061('0xd')](_0xb061('0x1e'),_0x58f9c2,JSON[_0xb061('0x1f')](_0x4b86c2));_0x278c3a(_0x4b86c2);})['catch'](function(_0x269cd9){logger[_0xb061('0xe')](_0xb061('0x1e'),_0x269cd9[_0xb061('0x11')],_0x58f9c2);_0x3f7cd9(_0x20e963[_0xb061('0xe')](0x1f4,_0x269cd9[_0xb061('0x11')]));});});}; \ No newline at end of file +var _0x95ab=['raw','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','create','options','then','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','body'];(function(_0x2aaa60,_0x22258f){var _0x2e3fa5=function(_0x335589){while(--_0x335589){_0x2aaa60['push'](_0x2aaa60['shift']());}};_0x2e3fa5(++_0x22258f);}(_0x95ab,0x12f));var _0xb95a=function(_0x4b08ed,_0x42a811){_0x4b08ed=_0x4b08ed-0x0;var _0x3eb861=_0x95ab[_0x4b08ed];return _0x3eb861;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb95a('0x0'));var BPromise=require(_0xb95a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb95a('0x2'));var db=require(_0xb95a('0x3'))['db'];var utils=require(_0xb95a('0x4'));var logger=require(_0xb95a('0x5'))('rpc');var config=require(_0xb95a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb95a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37d481,_0xeb0528,_0x922a6e){return new BPromise(function(_0x48d8b6,_0xb3fa2f){return client['request'](_0x37d481,_0x922a6e)['then'](function(_0x11215b){logger[_0xb95a('0x8')](_0xb95a('0x9'),_0xeb0528,'request\x20sent');logger['debug'](_0xb95a('0xa'),_0xeb0528,'request\x20sent',JSON[_0xb95a('0xb')](_0x11215b));if(_0x11215b[_0xb95a('0xc')]){if(_0x11215b[_0xb95a('0xc')][_0xb95a('0xd')]===0x1f4){logger[_0xb95a('0xc')](_0xb95a('0x9'),_0xeb0528,_0x11215b[_0xb95a('0xc')]['message']);return _0xb3fa2f(_0x11215b[_0xb95a('0xc')][_0xb95a('0xe')]);}logger[_0xb95a('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0xeb0528,_0x11215b['error']['message']);return _0x48d8b6(_0x11215b[_0xb95a('0xc')][_0xb95a('0xe')]);}else{logger[_0xb95a('0x8')](_0xb95a('0x9'),_0xeb0528,_0xb95a('0xf'));_0x48d8b6(_0x11215b[_0xb95a('0x10')][_0xb95a('0xe')]);}})[_0xb95a('0x11')](function(_0x2cc01e){logger[_0xb95a('0xc')](_0xb95a('0x9'),_0xeb0528,_0x2cc01e);_0xb3fa2f(_0x2cc01e);});});}exports['CreateVoiceAgentReport']=function(_0xdc3319){var _0x1aa388=this;return new Promise(function(_0x20d2dd,_0x471532){return db['VoiceAgentReport'][_0xb95a('0x12')](_0xdc3319['body'],{'raw':_0xdc3319[_0xb95a('0x13')]?_0xdc3319[_0xb95a('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xb95a('0x14')](function(_0x4ef6e6){logger['info'](_0xb95a('0x15'),_0xdc3319);logger[_0xb95a('0x16')](_0xb95a('0x15'),_0xdc3319,JSON[_0xb95a('0xb')](_0x4ef6e6));_0x20d2dd(_0x4ef6e6);})[_0xb95a('0x11')](function(_0xe2980e){logger[_0xb95a('0xc')](_0xb95a('0x15'),_0xe2980e[_0xb95a('0xe')],_0xdc3319);_0x471532(_0x1aa388['error'](0x1f4,_0xe2980e[_0xb95a('0xe')]));});});};exports[_0xb95a('0x17')]=function(_0x480421){var _0x1640c7=this;return new Promise(function(_0x54e5d5,_0x307bc4){return db[_0xb95a('0x18')][_0xb95a('0x19')](_0x480421[_0xb95a('0x1a')],{'raw':_0x480421[_0xb95a('0x13')]?_0x480421[_0xb95a('0x13')][_0xb95a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480421[_0xb95a('0x13')]?_0x480421['options']['where']||null:null,'attributes':_0x480421['options']?_0x480421[_0xb95a('0x13')][_0xb95a('0x1c')]||null:null,'limit':_0x480421['options']?_0x480421[_0xb95a('0x13')][_0xb95a('0x1d')]||null:null})[_0xb95a('0x14')](function(_0x4be188){logger[_0xb95a('0x8')]('UpdateVoiceAgentReport',_0x480421);logger[_0xb95a('0x16')](_0xb95a('0x17'),_0x480421,JSON[_0xb95a('0xb')](_0x4be188));_0x54e5d5(_0x4be188);})[_0xb95a('0x11')](function(_0x4b51de){logger[_0xb95a('0xc')](_0xb95a('0x17'),_0x4b51de['message'],_0x480421);_0x307bc4(_0x1640c7[_0xb95a('0xc')](0x1f4,_0x4b51de['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index cf0a044..d57baa5 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 _0x1d4f=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','path','Router','../../components/auth/service'];(function(_0x57430a,_0x1f4530){var _0x500a76=function(_0x15e991){while(--_0x15e991){_0x57430a['push'](_0x57430a['shift']());}};_0x500a76(++_0x1f4530);}(_0x1d4f,0x1e7));var _0xf1d4=function(_0x4c9e59,_0x2df903){_0x4c9e59=_0x4c9e59-0x0;var _0x301118=_0x1d4f[_0x4c9e59];return _0x301118;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf1d4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf1d4('0x1')]();var auth=require(_0xf1d4('0x2'));var interaction=require(_0xf1d4('0x3'));var config=require(_0xf1d4('0x4'));var controller=require('./voiceCallReport.controller');router[_0xf1d4('0x5')]('/',auth['isAuthenticated'](),controller[_0xf1d4('0x6')]);router[_0xf1d4('0x5')](_0xf1d4('0x7'),auth[_0xf1d4('0x8')](),controller[_0xf1d4('0x9')]);router['get'](_0xf1d4('0xa'),auth[_0xf1d4('0x8')](),controller[_0xf1d4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf1d4('0xa'),auth[_0xf1d4('0x8')](),controller[_0xf1d4('0xc')]);router[_0xf1d4('0xd')](_0xf1d4('0xa'),auth[_0xf1d4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8199=['post','create','put','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x9fb44c,_0x3ab9f7){var _0x1e0b9f=function(_0x312a9f){while(--_0x312a9f){_0x9fb44c['push'](_0x9fb44c['shift']());}};_0x1e0b9f(++_0x3ab9f7);}(_0x8199,0x6e));var _0x9819=function(_0x4d031a,_0x625b5d){_0x4d031a=_0x4d031a-0x0;var _0x35a74c=_0x8199[_0x4d031a];return _0x35a74c;};'use strict';var multer=require(_0x9819('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9819('0x1'));var express=require('express');var router=express[_0x9819('0x2')]();var auth=require(_0x9819('0x3'));var interaction=require(_0x9819('0x4'));var config=require('../../config/environment');var controller=require(_0x9819('0x5'));router[_0x9819('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9819('0x6')]('/describe',auth[_0x9819('0x7')](),controller[_0x9819('0x8')]);router[_0x9819('0x6')](_0x9819('0x9'),auth[_0x9819('0x7')](),controller['show']);router[_0x9819('0xa')]('/',auth[_0x9819('0x7')](),controller[_0x9819('0xb')]);router[_0x9819('0xc')](_0x9819('0x9'),auth[_0x9819('0x7')](),controller['update']);router[_0x9819('0xd')](_0x9819('0x9'),auth[_0x9819('0x7')](),controller['destroy']);module[_0x9819('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 12fb276..05b4493 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x4dbe67,_0x1ebc59){var _0x3d7eb9=function(_0x44eecb){while(--_0x44eecb){_0x4dbe67['push'](_0x4dbe67['shift']());}};_0x3d7eb9(++_0x1ebc59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x345865,_0x1d878d){var _0x2e14f4=function(_0x52e646){while(--_0x52e646){_0x345865['push'](_0x345865['shift']());}};_0x2e14f4(++_0x1d878d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 136e5eb..c982cdb 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 _0x2c93=['include','fullname','alias','User','then','catch','keys','includeAll','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','end','error','name','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceCallReport'];(function(_0x57a228,_0x3598e7){var _0x3e334a=function(_0x3fa0ae){while(--_0x3fa0ae){_0x57a228['push'](_0x57a228['shift']());}};_0x3e334a(++_0x3598e7);}(_0x2c93,0x1ea));var _0x32c9=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x2c93[_0x432fca];return _0x3adba4;};'use strict';var pdf=require(_0x32c9('0x0'));var emlformat=require(_0x32c9('0x1'));var rimraf=require(_0x32c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32c9('0x3'));var rp=require(_0x32c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32c9('0x5'));var util=require(_0x32c9('0x6'));var path=require(_0x32c9('0x7'));var sox=require('sox');var csv=require(_0x32c9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x32c9('0x9'));var squel=require(_0x32c9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32c9('0xb'));var toCsv=require(_0x32c9('0x8'));var querystring=require(_0x32c9('0xc'));var Papa=require('papaparse');var Redis=require(_0x32c9('0xd'));var authService=require(_0x32c9('0xe'));var qs=require(_0x32c9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x32c9('0x10'));var utils=require(_0x32c9('0x11'));var config=require('../../config/environment');var db=require(_0x32c9('0x12'))['db'];function respondWithStatusCode(_0x3b422f,_0x15d7d0){_0x15d7d0=_0x15d7d0||0xcc;return function(_0xe8a3f9){if(_0xe8a3f9){return _0x3b422f[_0x32c9('0x13')](_0x15d7d0);}return _0x3b422f[_0x32c9('0x14')](_0x15d7d0)['end']();};}function respondWithResult(_0x3da271,_0x3b8e64){_0x3b8e64=_0x3b8e64||0xc8;return function(_0x38d4ee){if(_0x38d4ee){return _0x3da271[_0x32c9('0x14')](_0x3b8e64)[_0x32c9('0x15')](_0x38d4ee);}};}function respondWithFilteredResult(_0xce6a82,_0x282b86){return function(_0xfe5131){if(_0xfe5131){var _0x393a92=_0xfe5131[_0x32c9('0x16')],_0x434b0b=_0x282b86[_0x32c9('0x17')],_0x578bbe=_0x282b86[_0x32c9('0x17')]+_0x282b86[_0x32c9('0x18')],_0x561629;if(_0x578bbe>=_0x393a92){_0x578bbe=_0x393a92;_0x561629=0xc8;}else{_0x561629=0xce;}_0xce6a82['status'](_0x561629);return _0xce6a82[_0x32c9('0x19')]('Content-Range',_0x434b0b+'-'+_0x578bbe+'/'+_0x393a92)['json'](_0xfe5131);}return null;};}function patchUpdates(_0x3f435c){return function(_0x1cd5e6){try{jsonpatch[_0x32c9('0x1a')](_0x1cd5e6,_0x3f435c,!![]);}catch(_0xb8af9e){return BPromise[_0x32c9('0x1b')](_0xb8af9e);}return _0x1cd5e6[_0x32c9('0x1c')]();};}function saveUpdates(_0xf72381,_0x93f9c1){return function(_0x183a14){if(_0x183a14){return _0x183a14[_0x32c9('0x1d')](_0xf72381)['then'](function(_0x3e6430){return _0x3e6430;});}return null;};}function removeEntity(_0x3069a5,_0xbb7527){return function(_0x370fd6){if(_0x370fd6){return _0x370fd6['destroy']()['then'](function(){_0x3069a5[_0x32c9('0x14')](0xcc)[_0x32c9('0x1e')]();});}};}function handleEntityNotFound(_0x455842,_0x5556c4){return function(_0x54b687){if(!_0x54b687){_0x455842['sendStatus'](0x194);}return _0x54b687;};}function handleError(_0x27a4d2,_0x1e02f6){_0x1e02f6=_0x1e02f6||0x1f4;return function(_0x13e336){logger[_0x32c9('0x1f')](_0x13e336['stack']);if(_0x13e336['name']){delete _0x13e336[_0x32c9('0x20')];}_0x27a4d2['status'](_0x1e02f6)['send'](_0x13e336);};}exports['index']=function(_0x1c27c3,_0xbd438c){var _0x315f5a={},_0x113ed4={},_0x2be822={'count':0x0,'rows':[]};var _0x3f5c39=_[_0x32c9('0x21')](db['VoiceCallReport'][_0x32c9('0x22')],function(_0x144672){return{'name':_0x144672['fieldName'],'type':_0x144672[_0x32c9('0x23')][_0x32c9('0x24')]};});_0x113ed4['model']=_[_0x32c9('0x21')](_0x3f5c39,'name');_0x113ed4[_0x32c9('0x25')]=_['keys'](_0x1c27c3[_0x32c9('0x25')]);_0x113ed4[_0x32c9('0x26')]=_[_0x32c9('0x27')](_0x113ed4['model'],_0x113ed4['query']);_0x315f5a['attributes']=_['intersection'](_0x113ed4[_0x32c9('0x28')],qs[_0x32c9('0x29')](_0x1c27c3['query'][_0x32c9('0x29')]));_0x315f5a[_0x32c9('0x2a')]=_0x315f5a[_0x32c9('0x2a')][_0x32c9('0x2b')]?_0x315f5a['attributes']:_0x113ed4[_0x32c9('0x28')];if(!_0x1c27c3[_0x32c9('0x25')][_0x32c9('0x2c')](_0x32c9('0x2d'))){_0x315f5a[_0x32c9('0x18')]=qs[_0x32c9('0x18')](_0x1c27c3[_0x32c9('0x25')][_0x32c9('0x18')]);_0x315f5a[_0x32c9('0x17')]=qs[_0x32c9('0x17')](_0x1c27c3[_0x32c9('0x25')][_0x32c9('0x17')]);}_0x315f5a[_0x32c9('0x2e')]=qs[_0x32c9('0x2f')](_0x1c27c3[_0x32c9('0x25')][_0x32c9('0x2f')]);_0x315f5a['where']=qs[_0x32c9('0x26')](_[_0x32c9('0x30')](_0x1c27c3[_0x32c9('0x25')],_0x113ed4[_0x32c9('0x26')]),_0x3f5c39);if(_0x1c27c3['query'][_0x32c9('0x31')]){_0x315f5a[_0x32c9('0x32')]=_[_0x32c9('0x33')](_0x315f5a[_0x32c9('0x32')],{'$or':_[_0x32c9('0x21')](_0x3f5c39,function(_0xb3cb9d){if(_0xb3cb9d[_0x32c9('0x23')]!==_0x32c9('0x34')){var _0x2f4195={};_0x2f4195[_0xb3cb9d['name']]={'$like':'%'+_0x1c27c3[_0x32c9('0x25')][_0x32c9('0x31')]+'%'};return _0x2f4195;}})});}_0x315f5a=_[_0x32c9('0x33')]({},_0x315f5a,_0x1c27c3['options']);var _0x158a3f={'where':_0x315f5a['where']};return db[_0x32c9('0x35')][_0x32c9('0x16')](_0x158a3f)['then'](function(_0x4ba676){_0x2be822['count']=_0x4ba676;if(_0x1c27c3[_0x32c9('0x25')]['includeAll']){_0x315f5a[_0x32c9('0x36')]=[{'attributes':['id',_0x32c9('0x20'),_0x32c9('0x37'),_0x32c9('0x38')],'model':db[_0x32c9('0x39')],'as':_0x32c9('0x39')}];}return db[_0x32c9('0x35')]['findAll'](_0x315f5a);})['then'](function(_0x1205fd){_0x2be822['rows']=_0x1205fd;return _0x2be822;})[_0x32c9('0x3a')](respondWithFilteredResult(_0xbd438c,_0x315f5a))[_0x32c9('0x3b')](handleError(_0xbd438c,null));};exports['show']=function(_0x4ef467,_0x168dff){var _0x14df55={'raw':!![],'where':{'id':_0x4ef467['params']['id']}},_0x52204a={};_0x52204a[_0x32c9('0x28')]=_[_0x32c9('0x3c')](db[_0x32c9('0x35')][_0x32c9('0x22')]);_0x52204a[_0x32c9('0x25')]=_[_0x32c9('0x3c')](_0x4ef467[_0x32c9('0x25')]);_0x52204a['filters']=_['intersection'](_0x52204a[_0x32c9('0x28')],_0x52204a[_0x32c9('0x25')]);_0x14df55[_0x32c9('0x2a')]=_[_0x32c9('0x27')](_0x52204a[_0x32c9('0x28')],qs['fields'](_0x4ef467[_0x32c9('0x25')][_0x32c9('0x29')]));_0x14df55[_0x32c9('0x2a')]=_0x14df55[_0x32c9('0x2a')][_0x32c9('0x2b')]?_0x14df55[_0x32c9('0x2a')]:_0x52204a[_0x32c9('0x28')];if(_0x4ef467[_0x32c9('0x25')][_0x32c9('0x3d')]){_0x14df55[_0x32c9('0x36')]=[{'all':!![]}];}_0x14df55=_[_0x32c9('0x33')]({},_0x14df55,_0x4ef467['options']);return db['VoiceCallReport'][_0x32c9('0x3e')](_0x14df55)[_0x32c9('0x3a')](handleEntityNotFound(_0x168dff,null))[_0x32c9('0x3a')](respondWithResult(_0x168dff,null))[_0x32c9('0x3b')](handleError(_0x168dff,null));};exports[_0x32c9('0x3f')]=function(_0x4fb22c,_0x45ca69){return db[_0x32c9('0x35')]['create'](_0x4fb22c[_0x32c9('0x40')],{})[_0x32c9('0x3a')](respondWithResult(_0x45ca69,0xc9))[_0x32c9('0x3b')](handleError(_0x45ca69,null));};exports['destroy']=function(_0x38f025,_0x27942e){return db[_0x32c9('0x35')][_0x32c9('0x3e')]({'where':{'id':_0x38f025['params']['id']}})[_0x32c9('0x3a')](handleEntityNotFound(_0x27942e,null))[_0x32c9('0x3a')](removeEntity(_0x27942e,null))[_0x32c9('0x3b')](handleError(_0x27942e,null));};exports['describe']=function(_0x1362d8,_0x33b346){return db['VoiceCallReport'][_0x32c9('0x41')]()[_0x32c9('0x3a')](respondWithResult(_0x33b346,null))[_0x32c9('0x3b')](handleError(_0x33b346,null));};exports[_0x32c9('0x1d')]=function(_0x500f81,_0x1064b5){if(_0x500f81[_0x32c9('0x40')]['uniqueid']){delete _0x500f81[_0x32c9('0x40')][_0x32c9('0x42')];}return db[_0x32c9('0x35')][_0x32c9('0x3e')]({'where':{'uniqueid':_0x500f81['params']['id'],'UserId':{'$or':[null,_0x500f81[_0x32c9('0x43')]['id']]}}})[_0x32c9('0x3a')](handleEntityNotFound(_0x1064b5,null))['then'](saveUpdates(_0x500f81[_0x32c9('0x40')],null))[_0x32c9('0x3a')](respondWithResult(_0x1064b5,null))[_0x32c9('0x3b')](handleError(_0x1064b5,null));}; \ No newline at end of file +var _0x3793=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','alias','User','findAll','rows','catch','show','params','fields','include','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x3793,0x124));var _0x3379=function(_0x253a0f,_0x5e56ca){_0x253a0f=_0x253a0f-0x0;var _0x4228b4=_0x3793[_0x253a0f];return _0x4228b4;};'use strict';var pdf=require(_0x3379('0x0'));var emlformat=require(_0x3379('0x1'));var rimraf=require(_0x3379('0x2'));var zipdir=require(_0x3379('0x3'));var jsonpatch=require(_0x3379('0x4'));var rp=require(_0x3379('0x5'));var moment=require(_0x3379('0x6'));var BPromise=require(_0x3379('0x7'));var Mustache=require(_0x3379('0x8'));var util=require('util');var path=require(_0x3379('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3379('0xa'));var squel=require(_0x3379('0xb'));var crypto=require(_0x3379('0xc'));var jsforce=require(_0x3379('0xd'));var deskjs=require(_0x3379('0xe'));var toCsv=require(_0x3379('0xf'));var querystring=require(_0x3379('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3379('0x11'));var hardwareService=require(_0x3379('0x12'));var logger=require(_0x3379('0x13'))(_0x3379('0x14'));var utils=require(_0x3379('0x15'));var config=require(_0x3379('0x16'));var db=require(_0x3379('0x17'))['db'];function respondWithStatusCode(_0x17a1e8,_0x14f66f){_0x14f66f=_0x14f66f||0xcc;return function(_0x5b0773){if(_0x5b0773){return _0x17a1e8[_0x3379('0x18')](_0x14f66f);}return _0x17a1e8[_0x3379('0x19')](_0x14f66f)[_0x3379('0x1a')]();};}function respondWithResult(_0x3c4504,_0xd7cb5e){_0xd7cb5e=_0xd7cb5e||0xc8;return function(_0x3c74e8){if(_0x3c74e8){return _0x3c4504[_0x3379('0x19')](_0xd7cb5e)[_0x3379('0x1b')](_0x3c74e8);}};}function respondWithFilteredResult(_0x36aa01,_0x3cb060){return function(_0x30127c){if(_0x30127c){var _0x178c54=_0x30127c[_0x3379('0x1c')],_0x418a29=_0x3cb060[_0x3379('0x1d')],_0x11d67c=_0x3cb060[_0x3379('0x1d')]+_0x3cb060[_0x3379('0x1e')],_0x41eef0;if(_0x11d67c>=_0x178c54){_0x11d67c=_0x178c54;_0x41eef0=0xc8;}else{_0x41eef0=0xce;}_0x36aa01[_0x3379('0x19')](_0x41eef0);return _0x36aa01[_0x3379('0x1f')](_0x3379('0x20'),_0x418a29+'-'+_0x11d67c+'/'+_0x178c54)['json'](_0x30127c);}return null;};}function patchUpdates(_0xace4eb){return function(_0x18adda){try{jsonpatch[_0x3379('0x21')](_0x18adda,_0xace4eb,!![]);}catch(_0x2f963f){return BPromise['reject'](_0x2f963f);}return _0x18adda[_0x3379('0x22')]();};}function saveUpdates(_0x4527fa,_0x4a1221){return function(_0x48d333){if(_0x48d333){return _0x48d333[_0x3379('0x23')](_0x4527fa)[_0x3379('0x24')](function(_0xfbacc0){return _0xfbacc0;});}return null;};}function removeEntity(_0x314584,_0x4e8d76){return function(_0x2f5935){if(_0x2f5935){return _0x2f5935[_0x3379('0x25')]()['then'](function(){_0x314584[_0x3379('0x19')](0xcc)[_0x3379('0x1a')]();});}};}function handleEntityNotFound(_0x559b08,_0x543111){return function(_0x4b5e71){if(!_0x4b5e71){_0x559b08[_0x3379('0x18')](0x194);}return _0x4b5e71;};}function handleError(_0x127c30,_0x3aefe0){_0x3aefe0=_0x3aefe0||0x1f4;return function(_0x276d9f){logger[_0x3379('0x26')](_0x276d9f[_0x3379('0x27')]);if(_0x276d9f[_0x3379('0x28')]){delete _0x276d9f[_0x3379('0x28')];}_0x127c30[_0x3379('0x19')](_0x3aefe0)[_0x3379('0x29')](_0x276d9f);};}exports[_0x3379('0x2a')]=function(_0x48f21a,_0x3827f2){var _0x5a15eb={},_0x5a1d58={},_0x1db9ce={'count':0x0,'rows':[]};var _0x37090f=_[_0x3379('0x2b')](db[_0x3379('0x2c')][_0x3379('0x2d')],function(_0x31b363){return{'name':_0x31b363[_0x3379('0x2e')],'type':_0x31b363[_0x3379('0x2f')][_0x3379('0x30')]};});_0x5a1d58[_0x3379('0x31')]=_[_0x3379('0x2b')](_0x37090f,_0x3379('0x28'));_0x5a1d58[_0x3379('0x32')]=_[_0x3379('0x33')](_0x48f21a[_0x3379('0x32')]);_0x5a1d58[_0x3379('0x34')]=_[_0x3379('0x35')](_0x5a1d58['model'],_0x5a1d58['query']);_0x5a15eb['attributes']=_['intersection'](_0x5a1d58['model'],qs['fields'](_0x48f21a[_0x3379('0x32')]['fields']));_0x5a15eb[_0x3379('0x36')]=_0x5a15eb[_0x3379('0x36')][_0x3379('0x37')]?_0x5a15eb[_0x3379('0x36')]:_0x5a1d58['model'];if(!_0x48f21a['query'][_0x3379('0x38')]('nolimit')){_0x5a15eb[_0x3379('0x1e')]=qs[_0x3379('0x1e')](_0x48f21a[_0x3379('0x32')][_0x3379('0x1e')]);_0x5a15eb[_0x3379('0x1d')]=qs[_0x3379('0x1d')](_0x48f21a[_0x3379('0x32')][_0x3379('0x1d')]);}_0x5a15eb[_0x3379('0x39')]=qs['sort'](_0x48f21a[_0x3379('0x32')][_0x3379('0x3a')]);_0x5a15eb[_0x3379('0x3b')]=qs[_0x3379('0x34')](_['pick'](_0x48f21a[_0x3379('0x32')],_0x5a1d58[_0x3379('0x34')]),_0x37090f);if(_0x48f21a[_0x3379('0x32')][_0x3379('0x3c')]){_0x5a15eb[_0x3379('0x3b')]=_[_0x3379('0x3d')](_0x5a15eb[_0x3379('0x3b')],{'$or':_[_0x3379('0x2b')](_0x37090f,function(_0x1cfeaf){if(_0x1cfeaf[_0x3379('0x2f')]!==_0x3379('0x3e')){var _0x575569={};_0x575569[_0x1cfeaf[_0x3379('0x28')]]={'$like':'%'+_0x48f21a[_0x3379('0x32')][_0x3379('0x3c')]+'%'};return _0x575569;}})});}_0x5a15eb=_[_0x3379('0x3d')]({},_0x5a15eb,_0x48f21a[_0x3379('0x3f')]);var _0x3df9d6={'where':_0x5a15eb['where']};return db['VoiceCallReport'][_0x3379('0x1c')](_0x3df9d6)[_0x3379('0x24')](function(_0x1a44b7){_0x1db9ce[_0x3379('0x1c')]=_0x1a44b7;if(_0x48f21a['query'][_0x3379('0x40')]){_0x5a15eb['include']=[{'attributes':['id',_0x3379('0x28'),'fullname',_0x3379('0x41')],'model':db[_0x3379('0x42')],'as':'User'}];}return db['VoiceCallReport'][_0x3379('0x43')](_0x5a15eb);})['then'](function(_0x31a28e){_0x1db9ce[_0x3379('0x44')]=_0x31a28e;return _0x1db9ce;})['then'](respondWithFilteredResult(_0x3827f2,_0x5a15eb))[_0x3379('0x45')](handleError(_0x3827f2,null));};exports[_0x3379('0x46')]=function(_0x521a56,_0x3c0c43){var _0x193d55={'raw':!![],'where':{'id':_0x521a56[_0x3379('0x47')]['id']}},_0x16a67d={};_0x16a67d[_0x3379('0x31')]=_[_0x3379('0x33')](db['VoiceCallReport'][_0x3379('0x2d')]);_0x16a67d['query']=_[_0x3379('0x33')](_0x521a56[_0x3379('0x32')]);_0x16a67d['filters']=_[_0x3379('0x35')](_0x16a67d[_0x3379('0x31')],_0x16a67d[_0x3379('0x32')]);_0x193d55[_0x3379('0x36')]=_[_0x3379('0x35')](_0x16a67d['model'],qs[_0x3379('0x48')](_0x521a56[_0x3379('0x32')]['fields']));_0x193d55[_0x3379('0x36')]=_0x193d55[_0x3379('0x36')][_0x3379('0x37')]?_0x193d55[_0x3379('0x36')]:_0x16a67d['model'];if(_0x521a56[_0x3379('0x32')][_0x3379('0x40')]){_0x193d55[_0x3379('0x49')]=[{'all':!![]}];}_0x193d55=_[_0x3379('0x3d')]({},_0x193d55,_0x521a56['options']);return db['VoiceCallReport'][_0x3379('0x4a')](_0x193d55)[_0x3379('0x24')](handleEntityNotFound(_0x3c0c43,null))[_0x3379('0x24')](respondWithResult(_0x3c0c43,null))[_0x3379('0x45')](handleError(_0x3c0c43,null));};exports[_0x3379('0x4b')]=function(_0x126e8a,_0x5de846){return db[_0x3379('0x2c')][_0x3379('0x4b')](_0x126e8a[_0x3379('0x4c')],{})[_0x3379('0x24')](respondWithResult(_0x5de846,0xc9))['catch'](handleError(_0x5de846,null));};exports[_0x3379('0x25')]=function(_0xdb7482,_0x532142){return db[_0x3379('0x2c')][_0x3379('0x4a')]({'where':{'id':_0xdb7482[_0x3379('0x47')]['id']}})[_0x3379('0x24')](handleEntityNotFound(_0x532142,null))['then'](removeEntity(_0x532142,null))[_0x3379('0x45')](handleError(_0x532142,null));};exports[_0x3379('0x4d')]=function(_0x4cf20a,_0x4add28){return db[_0x3379('0x2c')][_0x3379('0x4d')]()[_0x3379('0x24')](respondWithResult(_0x4add28,null))[_0x3379('0x45')](handleError(_0x4add28,null));};exports[_0x3379('0x23')]=function(_0xa015ae,_0x1364b6){if(_0xa015ae[_0x3379('0x4c')][_0x3379('0x4e')]){delete _0xa015ae[_0x3379('0x4c')]['uniqueid'];}return db[_0x3379('0x2c')][_0x3379('0x4a')]({'where':{'uniqueid':_0xa015ae[_0x3379('0x47')]['id'],'UserId':{'$or':[null,_0xa015ae[_0x3379('0x4f')]['id']]}}})[_0x3379('0x24')](handleEntityNotFound(_0x1364b6,null))[_0x3379('0x24')](saveUpdates(_0xa015ae[_0x3379('0x4c')],null))['then'](respondWithResult(_0x1364b6,null))[_0x3379('0x45')](handleError(_0x1364b6,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e721bec..2168a39 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 _0x8769=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','../../config/logger','api','moment'];(function(_0x34ee96,_0x2cfa31){var _0x527e9a=function(_0x4b9b62){while(--_0x4b9b62){_0x34ee96['push'](_0x34ee96['shift']());}};_0x527e9a(++_0x2cfa31);}(_0x8769,0x173));var _0x9876=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8769[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9876('0x0'))(_0x9876('0x1'));var moment=require(_0x9876('0x2'));var BPromise=require('bluebird');var rp=require(_0x9876('0x3'));var fs=require('fs');var path=require(_0x9876('0x4'));var rimraf=require(_0x9876('0x5'));var config=require(_0x9876('0x6'));var attributes=require(_0x9876('0x7'));module[_0x9876('0x8')]=function(_0x5b3f46,_0x494dd0){return _0x5b3f46[_0x9876('0x9')]('VoiceCallReport',attributes,{'tableName':_0x9876('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed11=['util','../../config/logger','rimraf','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x51949f,_0x1b9642){var _0x1f197f=function(_0x590871){while(--_0x590871){_0x51949f['push'](_0x51949f['shift']());}};_0x1f197f(++_0x1b9642);}(_0xed11,0x120));var _0x1ed1=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xed11[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x1ed1('0x0'));var logger=require(_0x1ed1('0x1'))('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(_0x1ed1('0x2'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x1ed1('0x3')]=function(_0x3aa418,_0x2f1d61){return _0x3aa418[_0x1ed1('0x4')](_0x1ed1('0x5'),attributes,{'tableName':_0x1ed1('0x6'),'paranoid':![],'indexes':[{'fields':[_0x1ed1('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index badec5e..9d8395d 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 _0x93ea=['stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','limit','attributes','map','model','include','debug','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x93ea,0x108));var _0xa93e=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x93ea[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xa93e('0x0'));var util=require('util');var moment=require(_0xa93e('0x1'));var BPromise=require(_0xa93e('0x2'));var rs=require(_0xa93e('0x3'));var fs=require('fs');var Redis=require(_0xa93e('0x4'));var db=require(_0xa93e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa93e('0x6'))(_0xa93e('0x7'));var config=require(_0xa93e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa93e('0x9')][_0xa93e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x119d27,_0x5ce1ec,_0x5f2ad1){return new BPromise(function(_0x4c5899,_0x300ae7){return client[_0xa93e('0xb')](_0x119d27,_0x5f2ad1)[_0xa93e('0xc')](function(_0x3006e1){logger[_0xa93e('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x5ce1ec,_0xa93e('0xe'));logger['debug'](_0xa93e('0xf'),_0x5ce1ec,_0xa93e('0xe'),JSON[_0xa93e('0x10')](_0x3006e1));if(_0x3006e1['error']){if(_0x3006e1[_0xa93e('0x11')][_0xa93e('0x12')]===0x1f4){logger['error'](_0xa93e('0x13'),_0x5ce1ec,_0x3006e1['error'][_0xa93e('0x14')]);return _0x300ae7(_0x3006e1['error'][_0xa93e('0x14')]);}logger[_0xa93e('0x11')](_0xa93e('0x13'),_0x5ce1ec,_0x3006e1[_0xa93e('0x11')][_0xa93e('0x14')]);return _0x4c5899(_0x3006e1[_0xa93e('0x11')][_0xa93e('0x14')]);}else{logger[_0xa93e('0xd')](_0xa93e('0x13'),_0x5ce1ec,_0xa93e('0xe'));_0x4c5899(_0x3006e1[_0xa93e('0x15')][_0xa93e('0x14')]);}})[_0xa93e('0x16')](function(_0x43af85){logger[_0xa93e('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5ce1ec,_0x43af85);_0x300ae7(_0x43af85);});});}exports[_0xa93e('0x17')]=function(_0x23a241){var _0x4d386d=this;return new Promise(function(_0x415c03,_0x19033d){return db['VoiceCallReport'][_0xa93e('0x18')]({'raw':_0x23a241[_0xa93e('0x19')]?_0x23a241['options'][_0xa93e('0x1a')]===undefined?!![]:![]:!![],'where':_0x23a241[_0xa93e('0x19')]?_0x23a241['options'][_0xa93e('0x1b')]||null:null,'attributes':_0x23a241[_0xa93e('0x19')]?_0x23a241['options']['attributes']||null:null,'limit':_0x23a241[_0xa93e('0x19')]?_0x23a241[_0xa93e('0x19')][_0xa93e('0x1c')]||null:null,'include':_0x23a241[_0xa93e('0x19')]?_0x23a241[_0xa93e('0x19')]['include']?_['map'](_0x23a241[_0xa93e('0x19')]['include'],function(_0x8f736){return{'model':db[_0x8f736['model']],'as':_0x8f736['as'],'attributes':_0x8f736[_0xa93e('0x1d')],'include':_0x8f736['include']?_[_0xa93e('0x1e')](_0x8f736['include'],function(_0xbf3db1){return{'model':db[_0xbf3db1[_0xa93e('0x1f')]],'as':_0xbf3db1['as'],'attributes':_0xbf3db1[_0xa93e('0x1d')],'include':_0xbf3db1[_0xa93e('0x20')]?_[_0xa93e('0x1e')](_0xbf3db1[_0xa93e('0x20')],function(_0x24e99c){return{'model':db[_0x24e99c[_0xa93e('0x1f')]],'as':_0x24e99c['as'],'attributes':_0x24e99c[_0xa93e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a42dc){logger[_0xa93e('0xd')](_0xa93e('0x17'),_0x23a241);logger[_0xa93e('0x21')](_0xa93e('0x17'),_0x23a241,JSON['stringify'](_0x5a42dc));_0x415c03(_0x5a42dc);})[_0xa93e('0x16')](function(_0x253590){logger[_0xa93e('0x11')](_0xa93e('0x17'),_0x253590[_0xa93e('0x14')],_0x23a241);_0x19033d(_0x4d386d[_0xa93e('0x11')](0x1f4,_0x253590[_0xa93e('0x14')]));});});};exports[_0xa93e('0x22')]=function(_0x173c7f){var _0x465465=this;return new Promise(function(_0x2db0c4,_0x54172d){return db[_0xa93e('0x23')][_0xa93e('0x24')](_0x173c7f[_0xa93e('0x25')],{'raw':_0x173c7f['options']?_0x173c7f['options'][_0xa93e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1b6d98){logger[_0xa93e('0xd')](_0xa93e('0x22'),_0x173c7f);logger[_0xa93e('0x21')](_0xa93e('0x22'),_0x173c7f,JSON[_0xa93e('0x10')](_0x1b6d98));_0x2db0c4(_0x1b6d98);})['catch'](function(_0x1340e4){logger[_0xa93e('0x11')](_0xa93e('0x22'),_0x1340e4[_0xa93e('0x14')],_0x173c7f);_0x54172d(_0x465465[_0xa93e('0x11')](0x1f4,_0x1340e4[_0xa93e('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x315d8f){var _0x59e67d=this;return new Promise(function(_0x5dea4c,_0x235bb1){return db[_0xa93e('0x23')][_0xa93e('0x26')](_0x315d8f[_0xa93e('0x25')],{'raw':_0x315d8f['options']?_0x315d8f['options'][_0xa93e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x315d8f[_0xa93e('0x19')]?_0x315d8f['options']['where']||null:null,'attributes':_0x315d8f[_0xa93e('0x19')]?_0x315d8f['options']['attributes']||null:null,'limit':_0x315d8f[_0xa93e('0x19')]?_0x315d8f[_0xa93e('0x19')][_0xa93e('0x1c')]||null:null})[_0xa93e('0xc')](function(_0x411020){logger[_0xa93e('0xd')](_0xa93e('0x27'),_0x315d8f);logger[_0xa93e('0x21')](_0xa93e('0x27'),_0x315d8f,JSON['stringify'](_0x411020));_0x5dea4c(_0x411020);})['catch'](function(_0x888b6){logger['error'](_0xa93e('0x27'),_0x888b6['message'],_0x315d8f);_0x235bb1(_0x59e67d[_0xa93e('0x11')](0x1f4,_0x888b6['message']));});});}; \ No newline at end of file +var _0xdbdc=['CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','map','attributes','model','then','create','body'];(function(_0x4db69e,_0x2e1ac6){var _0x13bba2=function(_0x3056e7){while(--_0x3056e7){_0x4db69e['push'](_0x4db69e['shift']());}};_0x13bba2(++_0x2e1ac6);}(_0xdbdc,0xbc));var _0xcdbd=function(_0x4c40fe,_0x24cc84){_0x4c40fe=_0x4c40fe-0x0;var _0x3aef1c=_0xdbdc[_0x4c40fe];return _0x3aef1c;};'use strict';var _=require(_0xcdbd('0x0'));var util=require(_0xcdbd('0x1'));var moment=require(_0xcdbd('0x2'));var BPromise=require(_0xcdbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdbd('0x5'));var logger=require(_0xcdbd('0x6'))(_0xcdbd('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdbd('0x8'));var client=jayson[_0xcdbd('0x9')][_0xcdbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4be8f8,_0x30c4c0,_0x99bc12){return new BPromise(function(_0xe323d1,_0x4101ae){return client['request'](_0x4be8f8,_0x99bc12)['then'](function(_0x24817a){logger[_0xcdbd('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x30c4c0,'request\x20sent');logger[_0xcdbd('0xc')](_0xcdbd('0xd'),_0x30c4c0,_0xcdbd('0xe'),JSON[_0xcdbd('0xf')](_0x24817a));if(_0x24817a[_0xcdbd('0x10')]){if(_0x24817a[_0xcdbd('0x10')][_0xcdbd('0x11')]===0x1f4){logger['error'](_0xcdbd('0x12'),_0x30c4c0,_0x24817a[_0xcdbd('0x10')][_0xcdbd('0x13')]);return _0x4101ae(_0x24817a[_0xcdbd('0x10')]['message']);}logger[_0xcdbd('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x30c4c0,_0x24817a['error'][_0xcdbd('0x13')]);return _0xe323d1(_0x24817a[_0xcdbd('0x10')][_0xcdbd('0x13')]);}else{logger[_0xcdbd('0xb')](_0xcdbd('0x12'),_0x30c4c0,_0xcdbd('0xe'));_0xe323d1(_0x24817a['result'][_0xcdbd('0x13')]);}})[_0xcdbd('0x14')](function(_0x35aef1){logger[_0xcdbd('0x10')](_0xcdbd('0x12'),_0x30c4c0,_0x35aef1);_0x4101ae(_0x35aef1);});});}exports[_0xcdbd('0x15')]=function(_0x210575){var _0x23c41e=this;return new Promise(function(_0x1a0370,_0x18b06a){return db[_0xcdbd('0x16')]['findAll']({'raw':_0x210575[_0xcdbd('0x17')]?_0x210575[_0xcdbd('0x17')][_0xcdbd('0x18')]===undefined?!![]:![]:!![],'where':_0x210575[_0xcdbd('0x17')]?_0x210575[_0xcdbd('0x17')][_0xcdbd('0x19')]||null:null,'attributes':_0x210575[_0xcdbd('0x17')]?_0x210575[_0xcdbd('0x17')]['attributes']||null:null,'limit':_0x210575[_0xcdbd('0x17')]?_0x210575[_0xcdbd('0x17')][_0xcdbd('0x1a')]||null:null,'include':_0x210575[_0xcdbd('0x17')]?_0x210575[_0xcdbd('0x17')][_0xcdbd('0x1b')]?_[_0xcdbd('0x1c')](_0x210575[_0xcdbd('0x17')][_0xcdbd('0x1b')],function(_0x304250){return{'model':db[_0x304250['model']],'as':_0x304250['as'],'attributes':_0x304250[_0xcdbd('0x1d')],'include':_0x304250[_0xcdbd('0x1b')]?_[_0xcdbd('0x1c')](_0x304250[_0xcdbd('0x1b')],function(_0x518c9b){return{'model':db[_0x518c9b['model']],'as':_0x518c9b['as'],'attributes':_0x518c9b['attributes'],'include':_0x518c9b[_0xcdbd('0x1b')]?_[_0xcdbd('0x1c')](_0x518c9b[_0xcdbd('0x1b')],function(_0x34f046){return{'model':db[_0x34f046[_0xcdbd('0x1e')]],'as':_0x34f046['as'],'attributes':_0x34f046[_0xcdbd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdbd('0x1f')](function(_0x4ff4fb){logger[_0xcdbd('0xb')](_0xcdbd('0x15'),_0x210575);logger[_0xcdbd('0xc')](_0xcdbd('0x15'),_0x210575,JSON[_0xcdbd('0xf')](_0x4ff4fb));_0x1a0370(_0x4ff4fb);})[_0xcdbd('0x14')](function(_0x453b3f){logger['error'](_0xcdbd('0x15'),_0x453b3f[_0xcdbd('0x13')],_0x210575);_0x18b06a(_0x23c41e['error'](0x1f4,_0x453b3f['message']));});});};exports['CreateVoiceCallReport']=function(_0x48ecfc){var _0x24c8ff=this;return new Promise(function(_0x264cdb,_0x2280da){return db[_0xcdbd('0x16')][_0xcdbd('0x20')](_0x48ecfc[_0xcdbd('0x21')],{'raw':_0x48ecfc['options']?_0x48ecfc['options'][_0xcdbd('0x18')]===undefined?!![]:![]:!![]})[_0xcdbd('0x1f')](function(_0x9a5bf8){logger[_0xcdbd('0xb')](_0xcdbd('0x22'),_0x48ecfc);logger[_0xcdbd('0xc')](_0xcdbd('0x22'),_0x48ecfc,JSON[_0xcdbd('0xf')](_0x9a5bf8));_0x264cdb(_0x9a5bf8);})[_0xcdbd('0x14')](function(_0x56a4a1){logger['error']('CreateVoiceCallReport',_0x56a4a1['message'],_0x48ecfc);_0x2280da(_0x24c8ff['error'](0x1f4,_0x56a4a1[_0xcdbd('0x13')]));});});};exports[_0xcdbd('0x23')]=function(_0x19c0b9){var _0x565edf=this;return new Promise(function(_0x3f066c,_0x4f0630){return db[_0xcdbd('0x16')][_0xcdbd('0x24')](_0x19c0b9[_0xcdbd('0x21')],{'raw':_0x19c0b9['options']?_0x19c0b9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19c0b9[_0xcdbd('0x17')]?_0x19c0b9[_0xcdbd('0x17')][_0xcdbd('0x19')]||null:null,'attributes':_0x19c0b9['options']?_0x19c0b9['options'][_0xcdbd('0x1d')]||null:null,'limit':_0x19c0b9[_0xcdbd('0x17')]?_0x19c0b9[_0xcdbd('0x17')][_0xcdbd('0x1a')]||null:null})[_0xcdbd('0x1f')](function(_0x460220){logger['info'](_0xcdbd('0x23'),_0x19c0b9);logger[_0xcdbd('0xc')](_0xcdbd('0x23'),_0x19c0b9,JSON[_0xcdbd('0xf')](_0x460220));_0x3f066c(_0x460220);})[_0xcdbd('0x14')](function(_0x4651ca){logger[_0xcdbd('0x10')](_0xcdbd('0x23'),_0x4651ca['message'],_0x19c0b9);_0x4f0630(_0x565edf[_0xcdbd('0x10')](0x1f4,_0x4651ca[_0xcdbd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a5b24fd..1b98327 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 _0xc2e5=['get','isAuthenticated','show','post','create','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller'];(function(_0x268596,_0x2a7a14){var _0x55fa58=function(_0x2365b6){while(--_0x2365b6){_0x268596['push'](_0x268596['shift']());}};_0x55fa58(++_0x2a7a14);}(_0xc2e5,0x6f));var _0x5c2e=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xc2e5[_0x590a38];return _0xf36626;};'use strict';var multer=require('multer');var util=require(_0x5c2e('0x0'));var path=require(_0x5c2e('0x1'));var timeout=require(_0x5c2e('0x2'));var express=require(_0x5c2e('0x3'));var router=express[_0x5c2e('0x4')]();var auth=require(_0x5c2e('0x5'));var interaction=require(_0x5c2e('0x6'));var config=require('../../config/environment');var controller=require(_0x5c2e('0x7'));router[_0x5c2e('0x8')]('/',auth[_0x5c2e('0x9')](),controller['index']);router[_0x5c2e('0x8')]('/:id',auth[_0x5c2e('0x9')](),controller[_0x5c2e('0xa')]);router[_0x5c2e('0xb')]('/',auth[_0x5c2e('0x9')](),controller[_0x5c2e('0xc')]);router['put'](_0x5c2e('0xd'),auth[_0x5c2e('0x9')](),controller[_0x5c2e('0xe')]);router[_0x5c2e('0xf')](_0x5c2e('0xd'),auth[_0x5c2e('0x9')](),controller['destroy']);module[_0x5c2e('0x10')]=router; \ No newline at end of file +var _0x9a22=['path','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x9a22,0x75));var _0x29a2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9a22[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var path=require(_0x29a2('0x2'));var timeout=require(_0x29a2('0x3'));var express=require(_0x29a2('0x4'));var router=express[_0x29a2('0x5')]();var auth=require(_0x29a2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29a2('0x7'));router[_0x29a2('0x8')]('/',auth[_0x29a2('0x9')](),controller[_0x29a2('0xa')]);router[_0x29a2('0x8')](_0x29a2('0xb'),auth[_0x29a2('0x9')](),controller[_0x29a2('0xc')]);router['post']('/',auth[_0x29a2('0x9')](),controller[_0x29a2('0xd')]);router['put'](_0x29a2('0xb'),auth[_0x29a2('0x9')](),controller['update']);router[_0x29a2('0xe')](_0x29a2('0xb'),auth['isAuthenticated'](),controller[_0x29a2('0xf')]);module[_0x29a2('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 4ccae95..3bbbbcc 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 _0xbac0=['setDataValue','options','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x45c631,_0x3c246a){var _0x3b05e1=function(_0x1611a3){while(--_0x1611a3){_0x45c631['push'](_0x45c631['shift']());}};_0x3b05e1(++_0x3c246a);}(_0xbac0,0xd5));var _0x0bac=function(_0x15a833,_0x5092d6){_0x15a833=_0x15a833-0x0;var _0x371593=_0xbac0[_0x15a833];return _0x371593;};'use strict';var Sequelize=require(_0x0bac('0x0'));module[_0x0bac('0x1')]={'name':{'type':Sequelize[_0x0bac('0x2')]},'prefix':{'type':Sequelize[_0x0bac('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x0bac('0x2')],'set':function(_0x2cffa3){this[_0x0bac('0x3')](_0x0bac('0x4'),_0x2cffa3?_0x2cffa3[_0x0bac('0x5')](''):[]);},'get':function(){return this[_0x0bac('0x6')](_0x0bac('0x4'))?this[_0x0bac('0x6')](_0x0bac('0x4'))[_0x0bac('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0bac('0x2')]},'description':{'type':Sequelize[_0x0bac('0x2')]}}; \ No newline at end of file +var _0x1731=['exports','STRING','join','getDataValue','options','split','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1731,0xbd));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1173('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1173('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1173('0x1')],'set':function(_0x2fbafb){this['setDataValue']('options',_0x2fbafb?_0x2fbafb[_0x1173('0x2')](''):[]);},'get':function(){return this[_0x1173('0x3')](_0x1173('0x4'))?this[_0x1173('0x3')]('options')[_0x1173('0x5')](''):[];}},'auth':{'type':Sequelize[_0x1173('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x1173('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1173('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5ddbf87..eb8ba71 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 _0x833e=['key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type'];(function(_0x984ac2,_0x1ba15e){var _0x450bdc=function(_0x186527){while(--_0x186527){_0x984ac2['push'](_0x984ac2['shift']());}};_0x450bdc(++_0x1ba15e);}(_0x833e,0x1bb));var _0xe833=function(_0x4dd9a7,_0x429797){_0x4dd9a7=_0x4dd9a7-0x0;var _0x17918a=_0x833e[_0x4dd9a7];return _0x17918a;};'use strict';var pdf=require(_0xe833('0x0'));var emlformat=require(_0xe833('0x1'));var rimraf=require(_0xe833('0x2'));var zipdir=require(_0xe833('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe833('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe833('0x5'));var path=require(_0xe833('0x6'));var sox=require('sox');var csv=require(_0xe833('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe833('0x8'));var jsforce=require(_0xe833('0x9'));var deskjs=require(_0xe833('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe833('0xb'));var Papa=require(_0xe833('0xc'));var Redis=require('ioredis');var authService=require(_0xe833('0xd'));var qs=require(_0xe833('0xe'));var as=require(_0xe833('0xf'));var hardwareService=require(_0xe833('0x10'));var logger=require(_0xe833('0x11'))(_0xe833('0x12'));var utils=require('../../config/utils');var config=require(_0xe833('0x13'));var db=require(_0xe833('0x14'))['db'];function respondWithStatusCode(_0x5aa379,_0x26c5e9){_0x26c5e9=_0x26c5e9||0xcc;return function(_0x551223){if(_0x551223){return _0x5aa379['sendStatus'](_0x26c5e9);}return _0x5aa379['status'](_0x26c5e9)['end']();};}function respondWithResult(_0x325162,_0x3e8665){_0x3e8665=_0x3e8665||0xc8;return function(_0x80d443){if(_0x80d443){return _0x325162[_0xe833('0x15')](_0x3e8665)[_0xe833('0x16')](_0x80d443);}};}function respondWithFilteredResult(_0x460dec,_0x51248d){return function(_0xb40f9b){if(_0xb40f9b){var _0x4f13db=_0xb40f9b['count'],_0x4f1458=_0x51248d['offset'],_0x456a3b=_0x51248d[_0xe833('0x17')]+_0x51248d[_0xe833('0x18')],_0x4ad9b8;if(_0x456a3b>=_0x4f13db){_0x456a3b=_0x4f13db;_0x4ad9b8=0xc8;}else{_0x4ad9b8=0xce;}_0x460dec[_0xe833('0x15')](_0x4ad9b8);return _0x460dec[_0xe833('0x19')](_0xe833('0x1a'),_0x4f1458+'-'+_0x456a3b+'/'+_0x4f13db)[_0xe833('0x16')](_0xb40f9b);}return null;};}function patchUpdates(_0x2f98a4){return function(_0x5c053c){try{jsonpatch[_0xe833('0x1b')](_0x5c053c,_0x2f98a4,!![]);}catch(_0x4b28e4){return BPromise[_0xe833('0x1c')](_0x4b28e4);}return _0x5c053c[_0xe833('0x1d')]();};}function saveUpdates(_0x2940fa,_0x1a705b){return function(_0x396313){if(_0x396313){return _0x396313['update'](_0x2940fa)[_0xe833('0x1e')](function(_0xec74f9){return _0xec74f9;});}return null;};}function removeEntity(_0x5844c2,_0x2e84ab){return function(_0x3991a0){if(_0x3991a0){return _0x3991a0[_0xe833('0x1f')]()[_0xe833('0x1e')](function(){var _0x2d1e99=_0x3991a0[_0xe833('0x20')]({'plain':!![]});var _0x54963b='ChanSpies';return db[_0xe833('0x21')][_0xe833('0x1f')]({'where':{'type':_0x54963b,'resourceId':_0x2d1e99['id']}})[_0xe833('0x1e')](function(){return _0x3991a0;});})[_0xe833('0x1e')](function(){_0x5844c2[_0xe833('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f84a4,_0x549173){return function(_0x5e1382){if(!_0x5e1382){_0x4f84a4[_0xe833('0x22')](0x194);}return _0x5e1382;};}function handleError(_0x5ddbcf,_0x552a43){_0x552a43=_0x552a43||0x1f4;return function(_0x279621){logger[_0xe833('0x23')](_0x279621[_0xe833('0x24')]);if(_0x279621[_0xe833('0x25')]){delete _0x279621[_0xe833('0x25')];}_0x5ddbcf[_0xe833('0x15')](_0x552a43)['send'](_0x279621);};}exports[_0xe833('0x26')]=function(_0xf6168,_0xa427e){var _0x15265a={},_0x9f7da4={},_0x51c032={'count':0x0,'rows':[]};var _0x5d74c7=_['map'](db[_0xe833('0x27')][_0xe833('0x28')],function(_0x10bdbb){return{'name':_0x10bdbb[_0xe833('0x29')],'type':_0x10bdbb[_0xe833('0x2a')][_0xe833('0x2b')]};});_0x9f7da4[_0xe833('0x2c')]=_[_0xe833('0x2d')](_0x5d74c7,_0xe833('0x25'));_0x9f7da4[_0xe833('0x2e')]=_[_0xe833('0x2f')](_0xf6168[_0xe833('0x2e')]);_0x9f7da4['filters']=_[_0xe833('0x30')](_0x9f7da4[_0xe833('0x2c')],_0x9f7da4[_0xe833('0x2e')]);_0x15265a[_0xe833('0x31')]=_[_0xe833('0x30')](_0x9f7da4[_0xe833('0x2c')],qs[_0xe833('0x32')](_0xf6168['query'][_0xe833('0x32')]));_0x15265a[_0xe833('0x31')]=_0x15265a['attributes'][_0xe833('0x33')]?_0x15265a['attributes']:_0x9f7da4[_0xe833('0x2c')];if(!_0xf6168['query'][_0xe833('0x34')](_0xe833('0x35'))){_0x15265a[_0xe833('0x18')]=qs[_0xe833('0x18')](_0xf6168[_0xe833('0x2e')][_0xe833('0x18')]);_0x15265a[_0xe833('0x17')]=qs[_0xe833('0x17')](_0xf6168['query'][_0xe833('0x17')]);}_0x15265a[_0xe833('0x36')]=qs['sort'](_0xf6168[_0xe833('0x2e')][_0xe833('0x37')]);_0x15265a['where']=qs[_0xe833('0x38')](_[_0xe833('0x39')](_0xf6168['query'],_0x9f7da4[_0xe833('0x38')]),_0x5d74c7);if(_0xf6168[_0xe833('0x2e')][_0xe833('0x3a')]){_0x15265a[_0xe833('0x3b')]=_['merge'](_0x15265a[_0xe833('0x3b')],{'$or':_['map'](_0x5d74c7,function(_0x5a4041){if(_0x5a4041['type']!==_0xe833('0x3c')){var _0x1a70b5={};_0x1a70b5[_0x5a4041['name']]={'$like':'%'+_0xf6168[_0xe833('0x2e')]['filter']+'%'};return _0x1a70b5;}})});}_0x15265a=_[_0xe833('0x3d')]({},_0x15265a,_0xf6168[_0xe833('0x3e')]);var _0x159498={'where':_0x15265a[_0xe833('0x3b')]};return db[_0xe833('0x27')]['count'](_0x159498)['then'](function(_0x74fcd0){_0x51c032[_0xe833('0x3f')]=_0x74fcd0;if(_0xf6168[_0xe833('0x2e')][_0xe833('0x40')]){_0x15265a[_0xe833('0x41')]=[{'all':!![]}];}return db[_0xe833('0x27')][_0xe833('0x42')](_0x15265a);})['then'](function(_0x35069d){_0x51c032['rows']=_0x35069d;return _0x51c032;})[_0xe833('0x1e')](respondWithFilteredResult(_0xa427e,_0x15265a))['catch'](handleError(_0xa427e,null));};exports[_0xe833('0x43')]=function(_0x3a6779,_0x202390){var _0x586752={'raw':![],'where':{'id':_0x3a6779[_0xe833('0x44')]['id']}},_0x129dbc={};_0x129dbc[_0xe833('0x2c')]=_[_0xe833('0x2f')](db[_0xe833('0x27')][_0xe833('0x28')]);_0x129dbc[_0xe833('0x2e')]=_[_0xe833('0x2f')](_0x3a6779[_0xe833('0x2e')]);_0x129dbc[_0xe833('0x38')]=_['intersection'](_0x129dbc[_0xe833('0x2c')],_0x129dbc[_0xe833('0x2e')]);_0x586752[_0xe833('0x31')]=_[_0xe833('0x30')](_0x129dbc[_0xe833('0x2c')],qs[_0xe833('0x32')](_0x3a6779['query'][_0xe833('0x32')]));_0x586752['attributes']=_0x586752[_0xe833('0x31')][_0xe833('0x33')]?_0x586752[_0xe833('0x31')]:_0x129dbc[_0xe833('0x2c')];if(_0x3a6779[_0xe833('0x2e')][_0xe833('0x40')]){_0x586752[_0xe833('0x41')]=[{'all':!![]}];}_0x586752=_[_0xe833('0x3d')]({},_0x586752,_0x3a6779[_0xe833('0x3e')]);return db[_0xe833('0x27')][_0xe833('0x45')](_0x586752)[_0xe833('0x1e')](handleEntityNotFound(_0x202390,null))['then'](respondWithResult(_0x202390,null))[_0xe833('0x46')](handleError(_0x202390,null));};exports[_0xe833('0x47')]=function(_0x3c3dca,_0x11e5f1){return db[_0xe833('0x27')]['create'](_0x3c3dca[_0xe833('0x48')],{})['then'](function(_0x515e24){var _0x2d43b9=_0x3c3dca[_0xe833('0x49')]['get']({'plain':!![]});if(!_0x2d43b9)throw new Error(_0xe833('0x4a'));if(_0x2d43b9[_0xe833('0x4b')]==='user'){var _0x22c6a3=_0x515e24[_0xe833('0x20')]({'plain':!![]});var _0xc2e923=_0xe833('0x4c');return db['UserProfileSection'][_0xe833('0x45')]({'where':{'name':_0xc2e923,'userProfileId':_0x2d43b9[_0xe833('0x4d')]},'raw':!![]})['then'](function(_0xe36f0d){if(_0xe36f0d&&_0xe36f0d[_0xe833('0x4e')]===0x0){return db[_0xe833('0x21')][_0xe833('0x47')]({'name':_0x22c6a3['name'],'resourceId':_0x22c6a3['id'],'type':_0xe36f0d['name'],'sectionId':_0xe36f0d['id']},{})[_0xe833('0x1e')](function(){return _0x515e24;});}else{return _0x515e24;}})[_0xe833('0x46')](function(_0x512f0c){logger[_0xe833('0x23')](_0xe833('0x4f'),_0x512f0c);throw _0x512f0c;});}return _0x515e24;})[_0xe833('0x1e')](respondWithResult(_0x11e5f1,0xc9))[_0xe833('0x46')](handleError(_0x11e5f1,null));};exports[_0xe833('0x50')]=function(_0x1112e7,_0x566634){if(_0x1112e7[_0xe833('0x48')]['id']){delete _0x1112e7[_0xe833('0x48')]['id'];}return db[_0xe833('0x27')]['find']({'where':{'id':_0x1112e7[_0xe833('0x44')]['id']}})[_0xe833('0x1e')](handleEntityNotFound(_0x566634,null))[_0xe833('0x1e')](saveUpdates(_0x1112e7[_0xe833('0x48')],null))[_0xe833('0x1e')](respondWithResult(_0x566634,null))[_0xe833('0x46')](handleError(_0x566634,null));};exports['destroy']=function(_0x2508ce,_0x4cc141){return db[_0xe833('0x27')][_0xe833('0x45')]({'where':{'id':_0x2508ce['params']['id']}})[_0xe833('0x1e')](handleEntityNotFound(_0x4cc141,null))[_0xe833('0x1e')](removeEntity(_0x4cc141,null))[_0xe833('0x46')](handleError(_0x4cc141,null));}; \ No newline at end of file +var _0x11d8=['json','offset','limit','set','Content-Range','apply','save','destroy','then','get','ChanSpies','UserProfileResource','end','error','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','include','findAll','catch','show','params','keys','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x3a85f4,_0x5cdeb5){var _0x52cc04=function(_0xa6ac0e){while(--_0xa6ac0e){_0x3a85f4['push'](_0x3a85f4['shift']());}};_0x52cc04(++_0x5cdeb5);}(_0x11d8,0x1c1));var _0x811d=function(_0x3f1230,_0x3da84c){_0x3f1230=_0x3f1230-0x0;var _0x4f06c9=_0x11d8[_0x3f1230];return _0x4f06c9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x811d('0x0'));var zipdir=require(_0x811d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x811d('0x2'));var moment=require(_0x811d('0x3'));var BPromise=require(_0x811d('0x4'));var Mustache=require('mustache');var util=require(_0x811d('0x5'));var path=require(_0x811d('0x6'));var sox=require(_0x811d('0x7'));var csv=require(_0x811d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x811d('0x9'));var crypto=require(_0x811d('0xa'));var jsforce=require(_0x811d('0xb'));var deskjs=require(_0x811d('0xc'));var toCsv=require(_0x811d('0x8'));var querystring=require(_0x811d('0xd'));var Papa=require(_0x811d('0xe'));var Redis=require(_0x811d('0xf'));var authService=require(_0x811d('0x10'));var qs=require(_0x811d('0x11'));var as=require(_0x811d('0x12'));var hardwareService=require(_0x811d('0x13'));var logger=require('../../config/logger')(_0x811d('0x14'));var utils=require(_0x811d('0x15'));var config=require('../../config/environment');var db=require(_0x811d('0x16'))['db'];function respondWithStatusCode(_0x4bca82,_0x527004){_0x527004=_0x527004||0xcc;return function(_0x350dfc){if(_0x350dfc){return _0x4bca82[_0x811d('0x17')](_0x527004);}return _0x4bca82[_0x811d('0x18')](_0x527004)['end']();};}function respondWithResult(_0x3b8112,_0x380773){_0x380773=_0x380773||0xc8;return function(_0x58cd94){if(_0x58cd94){return _0x3b8112['status'](_0x380773)[_0x811d('0x19')](_0x58cd94);}};}function respondWithFilteredResult(_0x3f269b,_0x4f3054){return function(_0x94245a){if(_0x94245a){var _0x1f9d7f=_0x94245a['count'],_0x44cfce=_0x4f3054[_0x811d('0x1a')],_0x1a131d=_0x4f3054[_0x811d('0x1a')]+_0x4f3054[_0x811d('0x1b')],_0x18b2ae;if(_0x1a131d>=_0x1f9d7f){_0x1a131d=_0x1f9d7f;_0x18b2ae=0xc8;}else{_0x18b2ae=0xce;}_0x3f269b[_0x811d('0x18')](_0x18b2ae);return _0x3f269b[_0x811d('0x1c')](_0x811d('0x1d'),_0x44cfce+'-'+_0x1a131d+'/'+_0x1f9d7f)[_0x811d('0x19')](_0x94245a);}return null;};}function patchUpdates(_0xa60feb){return function(_0xa2d02f){try{jsonpatch[_0x811d('0x1e')](_0xa2d02f,_0xa60feb,!![]);}catch(_0x52bba1){return BPromise['reject'](_0x52bba1);}return _0xa2d02f[_0x811d('0x1f')]();};}function saveUpdates(_0x1c1570,_0x3ef96c){return function(_0x31c94e){if(_0x31c94e){return _0x31c94e['update'](_0x1c1570)['then'](function(_0x567a5d){return _0x567a5d;});}return null;};}function removeEntity(_0x53da90,_0x516960){return function(_0x2c5129){if(_0x2c5129){return _0x2c5129[_0x811d('0x20')]()[_0x811d('0x21')](function(){var _0x598ef6=_0x2c5129[_0x811d('0x22')]({'plain':!![]});var _0x1e9700=_0x811d('0x23');return db[_0x811d('0x24')]['destroy']({'where':{'type':_0x1e9700,'resourceId':_0x598ef6['id']}})[_0x811d('0x21')](function(){return _0x2c5129;});})[_0x811d('0x21')](function(){_0x53da90[_0x811d('0x18')](0xcc)[_0x811d('0x25')]();});}};}function handleEntityNotFound(_0xd23025,_0x5859f8){return function(_0x5f0c50){if(!_0x5f0c50){_0xd23025[_0x811d('0x17')](0x194);}return _0x5f0c50;};}function handleError(_0x3aef16,_0x1bbb23){_0x1bbb23=_0x1bbb23||0x1f4;return function(_0xd315a6){logger[_0x811d('0x26')](_0xd315a6['stack']);if(_0xd315a6[_0x811d('0x27')]){delete _0xd315a6[_0x811d('0x27')];}_0x3aef16[_0x811d('0x18')](_0x1bbb23)['send'](_0xd315a6);};}exports[_0x811d('0x28')]=function(_0x31a874,_0x81a7e){var _0x330090={},_0x45b670={},_0x18597f={'count':0x0,'rows':[]};var _0x25bd8b=_[_0x811d('0x29')](db[_0x811d('0x2a')][_0x811d('0x2b')],function(_0x2f72e8){return{'name':_0x2f72e8[_0x811d('0x2c')],'type':_0x2f72e8[_0x811d('0x2d')]['key']};});_0x45b670[_0x811d('0x2e')]=_[_0x811d('0x29')](_0x25bd8b,'name');_0x45b670[_0x811d('0x2f')]=_['keys'](_0x31a874[_0x811d('0x2f')]);_0x45b670[_0x811d('0x30')]=_[_0x811d('0x31')](_0x45b670['model'],_0x45b670['query']);_0x330090[_0x811d('0x32')]=_['intersection'](_0x45b670['model'],qs[_0x811d('0x33')](_0x31a874[_0x811d('0x2f')][_0x811d('0x33')]));_0x330090[_0x811d('0x32')]=_0x330090['attributes'][_0x811d('0x34')]?_0x330090[_0x811d('0x32')]:_0x45b670[_0x811d('0x2e')];if(!_0x31a874[_0x811d('0x2f')][_0x811d('0x35')](_0x811d('0x36'))){_0x330090[_0x811d('0x1b')]=qs[_0x811d('0x1b')](_0x31a874[_0x811d('0x2f')]['limit']);_0x330090[_0x811d('0x1a')]=qs['offset'](_0x31a874[_0x811d('0x2f')][_0x811d('0x1a')]);}_0x330090[_0x811d('0x37')]=qs[_0x811d('0x38')](_0x31a874['query'][_0x811d('0x38')]);_0x330090['where']=qs[_0x811d('0x30')](_['pick'](_0x31a874[_0x811d('0x2f')],_0x45b670['filters']),_0x25bd8b);if(_0x31a874[_0x811d('0x2f')][_0x811d('0x39')]){_0x330090[_0x811d('0x3a')]=_[_0x811d('0x3b')](_0x330090['where'],{'$or':_[_0x811d('0x29')](_0x25bd8b,function(_0x303176){if(_0x303176['type']!==_0x811d('0x3c')){var _0x1995a0={};_0x1995a0[_0x303176['name']]={'$like':'%'+_0x31a874[_0x811d('0x2f')]['filter']+'%'};return _0x1995a0;}})});}_0x330090=_['merge']({},_0x330090,_0x31a874[_0x811d('0x3d')]);var _0x45640e={'where':_0x330090['where']};return db[_0x811d('0x2a')][_0x811d('0x3e')](_0x45640e)[_0x811d('0x21')](function(_0xe6bcaf){_0x18597f[_0x811d('0x3e')]=_0xe6bcaf;if(_0x31a874['query']['includeAll']){_0x330090[_0x811d('0x3f')]=[{'all':!![]}];}return db[_0x811d('0x2a')][_0x811d('0x40')](_0x330090);})['then'](function(_0x2b332e){_0x18597f['rows']=_0x2b332e;return _0x18597f;})[_0x811d('0x21')](respondWithFilteredResult(_0x81a7e,_0x330090))[_0x811d('0x41')](handleError(_0x81a7e,null));};exports[_0x811d('0x42')]=function(_0x39dfac,_0x2feeab){var _0x186955={'raw':![],'where':{'id':_0x39dfac[_0x811d('0x43')]['id']}},_0x4a08d1={};_0x4a08d1['model']=_[_0x811d('0x44')](db[_0x811d('0x2a')][_0x811d('0x2b')]);_0x4a08d1[_0x811d('0x2f')]=_[_0x811d('0x44')](_0x39dfac[_0x811d('0x2f')]);_0x4a08d1[_0x811d('0x30')]=_[_0x811d('0x31')](_0x4a08d1['model'],_0x4a08d1[_0x811d('0x2f')]);_0x186955['attributes']=_[_0x811d('0x31')](_0x4a08d1[_0x811d('0x2e')],qs[_0x811d('0x33')](_0x39dfac[_0x811d('0x2f')][_0x811d('0x33')]));_0x186955[_0x811d('0x32')]=_0x186955['attributes']['length']?_0x186955[_0x811d('0x32')]:_0x4a08d1[_0x811d('0x2e')];if(_0x39dfac[_0x811d('0x2f')][_0x811d('0x45')]){_0x186955[_0x811d('0x3f')]=[{'all':!![]}];}_0x186955=_['merge']({},_0x186955,_0x39dfac[_0x811d('0x3d')]);return db[_0x811d('0x2a')][_0x811d('0x46')](_0x186955)[_0x811d('0x21')](handleEntityNotFound(_0x2feeab,null))[_0x811d('0x21')](respondWithResult(_0x2feeab,null))[_0x811d('0x41')](handleError(_0x2feeab,null));};exports[_0x811d('0x47')]=function(_0x3b1d9a,_0x524315){return db[_0x811d('0x2a')][_0x811d('0x47')](_0x3b1d9a['body'],{})[_0x811d('0x21')](function(_0x216fbc){var _0x3d7c4d=_0x3b1d9a[_0x811d('0x48')]['get']({'plain':!![]});if(!_0x3d7c4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d7c4d[_0x811d('0x49')]===_0x811d('0x48')){var _0x2e7bff=_0x216fbc['get']({'plain':!![]});var _0x2398d4='ChanSpies';return db[_0x811d('0x4a')][_0x811d('0x46')]({'where':{'name':_0x2398d4,'userProfileId':_0x3d7c4d[_0x811d('0x4b')]},'raw':!![]})[_0x811d('0x21')](function(_0x53aed8){if(_0x53aed8&&_0x53aed8[_0x811d('0x4c')]===0x0){return db['UserProfileResource'][_0x811d('0x47')]({'name':_0x2e7bff['name'],'resourceId':_0x2e7bff['id'],'type':_0x53aed8[_0x811d('0x27')],'sectionId':_0x53aed8['id']},{})['then'](function(){return _0x216fbc;});}else{return _0x216fbc;}})[_0x811d('0x41')](function(_0x4eb450){logger[_0x811d('0x26')](_0x811d('0x4d'),_0x4eb450);throw _0x4eb450;});}return _0x216fbc;})[_0x811d('0x21')](respondWithResult(_0x524315,0xc9))[_0x811d('0x41')](handleError(_0x524315,null));};exports['update']=function(_0x1433b4,_0x186256){if(_0x1433b4[_0x811d('0x4e')]['id']){delete _0x1433b4[_0x811d('0x4e')]['id'];}return db[_0x811d('0x2a')][_0x811d('0x46')]({'where':{'id':_0x1433b4[_0x811d('0x43')]['id']}})[_0x811d('0x21')](handleEntityNotFound(_0x186256,null))['then'](saveUpdates(_0x1433b4[_0x811d('0x4e')],null))[_0x811d('0x21')](respondWithResult(_0x186256,null))[_0x811d('0x41')](handleError(_0x186256,null));};exports[_0x811d('0x20')]=function(_0x4d699f,_0x31ba58){return db[_0x811d('0x2a')]['find']({'where':{'id':_0x4d699f[_0x811d('0x43')]['id']}})[_0x811d('0x21')](handleEntityNotFound(_0x31ba58,null))[_0x811d('0x21')](removeEntity(_0x31ba58,null))[_0x811d('0x41')](handleError(_0x31ba58,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index cbcae38..fac1d7c 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 _0xea03=['merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xea03,0x15e));var _0x3ea0=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0xea03[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0x3ea0('0x0'));var util=require(_0x3ea0('0x1'));var BPromise=require(_0x3ea0('0x2'));var attributes=require(_0x3ea0('0x3'));var getUserApplications=function(_0x3604b3,_0xac02f,_0x37993d){var _0x4c12f6=0x1;var _0x45033d=[];var _0x290e87={'context':_0xac02f[_0x3ea0('0x4')]||_0x3ea0('0x5'),'exten':util[_0x3ea0('0x6')](_0x3ea0('0x7'),_0x3604b3[_0x3ea0('0x8')],_0x37993d),'type':_0x3ea0('0x9'),'isApp':![],'ChanSpyId':_0x3604b3['id'],'UserId':_0xac02f['id']};_0x45033d['push'](_[_0x3ea0('0xa')]({'app':_0x3ea0('0xb'),'appdata':util[_0x3ea0('0x6')](_0x3ea0('0xc'),'chanspy'),'priority':_0x4c12f6++},_0x290e87));if(_0x3604b3[_0x3ea0('0xd')]){_0x45033d['push'](_[_0x3ea0('0xa')]({'app':_0x3ea0('0xe'),'appdata':util[_0x3ea0('0x6')](_0x3ea0('0xf'),_0x3604b3[_0x3ea0('0x10')]),'priority':_0x4c12f6++},_0x290e87));}if(_0x3604b3[_0x3ea0('0x11')]){_0x45033d['push'](_[_0x3ea0('0xa')]({'app':_0x3ea0('0x12'),'appdata':_0x3604b3[_0x3ea0('0x13')],'priority':_0x4c12f6++},_0x290e87));}_0x45033d[_0x3ea0('0x14')](_[_0x3ea0('0xa')]({'app':_0x3ea0('0x15'),'appdata':util[_0x3ea0('0x6')](_0x3ea0('0x16'),_0xac02f[_0x3ea0('0x17')],_0x3604b3[_0x3ea0('0x18')]?_0x3604b3[_0x3ea0('0x18')][_0x3ea0('0x19')](''):''),'priority':_0x4c12f6++},_0x290e87));if(_0x3604b3['record']){_0x45033d['push'](_[_0x3ea0('0xa')]({'app':'StopMixMonitor','priority':_0x4c12f6++},_0x290e87));}return _0x45033d;};var getChanSpyApplications=function(_0x2f757f,_0x3a75e5){var _0x3f85f4=[];for(var _0x387853=0x0,_0x318c48=0x1;_0x387853<_0x3a75e5['length'];_0x387853++,_0x318c48=0x1){_0x3f85f4=_0x3f85f4[_0x3ea0('0x1a')](getUserApplications(_0x2f757f,_0x3a75e5[_0x387853],_0x3a75e5[_0x387853]['internal']));if(_0x3a75e5[_0x387853][_0x3ea0('0x1b')]!=_0x3a75e5[_0x387853][_0x3ea0('0x17')]){_0x3f85f4=_0x3f85f4['concat'](getUserApplications(_0x2f757f,_0x3a75e5[_0x387853],_0x3a75e5[_0x387853][_0x3ea0('0x17')]));}}return _0x3f85f4;};var getChanSpyPromise=function(_0x38e599,_0x56bed1){return new BPromise(function(_0x1a16e2,_0xe618b3){return _0x38e599[_0x3ea0('0x1c')]['findAll']({'attributes':['id','name',_0x3ea0('0x1b')],'where':{'role':_0x3ea0('0x1d'),'chanspy':!![]},'raw':!![]})[_0x3ea0('0x1e')](function(_0x234a42){if(_0x234a42){return _0x1a16e2(getChanSpyApplications(_0x56bed1,_0x234a42));}return _0x1a16e2([]);})[_0x3ea0('0x1f')](function(_0x4c383c){_0xe618b3(_0x4c383c);});});};module[_0x3ea0('0x20')]=function(_0xe73905,_0x3cda1e){var _0x36242a=_0xe73905['models'];return _0xe73905[_0x3ea0('0x21')](_0x3ea0('0x22'),attributes,{'tableName':_0x3ea0('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fcd8e,_0x3fa1a9,_0x3774e4){return getChanSpyPromise(_0x36242a,_0x3fcd8e)[_0x3ea0('0x1e')](function(_0x26562d){if(_0x26562d&&_0x26562d[_0x3ea0('0x24')]){return _0x36242a[_0x3ea0('0x25')][_0x3ea0('0x26')](_0x26562d);}})[_0x3ea0('0x1e')](function(){_0x3774e4();})[_0x3ea0('0x1f')](function(_0x46d82f){_0x3774e4(_0x46d82f);});},'afterUpdate':function(_0x30df23,_0x573f11,_0x7a5377){return _0x36242a[_0x3ea0('0x25')]['destroy']({'where':{'ChanSpyId':_0x30df23['id']}})[_0x3ea0('0x1e')](function(){return getChanSpyPromise(_0x36242a,_0x30df23);})['then'](function(_0x2d3ca3){if(_0x2d3ca3&&_0x2d3ca3[_0x3ea0('0x24')]){return _0x36242a['VoiceExtension']['bulkCreate'](_0x2d3ca3);}})[_0x3ea0('0x1e')](function(){_0x7a5377();})[_0x3ea0('0x1f')](function(_0x37dbc0){_0x7a5377(_0x37dbc0);});},'afterDestroy':function(_0x23f8fa,_0x24fb50,_0x26e585){return _0x36242a[_0x3ea0('0x25')][_0x3ea0('0x27')]({'where':{'ChanSpyId':_0x23f8fa['id']}})[_0x3ea0('0x1e')](function(){_0x26e585();})[_0x3ea0('0x1f')](function(_0x203316){_0x26e585(_0x203316);});}}});}; \ No newline at end of file +var _0xa88d=['context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x5b1219,_0x3bf3a1){var _0x47f002=function(_0x2c595f){while(--_0x2c595f){_0x5b1219['push'](_0x5b1219['shift']());}};_0x47f002(++_0x3bf3a1);}(_0xa88d,0x12c));var _0xda88=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xa88d[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0xda88('0x0'));var util=require(_0xda88('0x1'));var BPromise=require(_0xda88('0x2'));var attributes=require(_0xda88('0x3'));var getUserApplications=function(_0x41e490,_0x3109b1,_0x11ea6e){var _0x32f69b=0x1;var _0x33f038=[];var _0x8c1020={'context':_0x3109b1[_0xda88('0x4')]||_0xda88('0x5'),'exten':util[_0xda88('0x6')](_0xda88('0x7'),_0x41e490[_0xda88('0x8')],_0x11ea6e),'type':_0xda88('0x9'),'isApp':![],'ChanSpyId':_0x41e490['id'],'UserId':_0x3109b1['id']};_0x33f038[_0xda88('0xa')](_['merge']({'app':_0xda88('0xb'),'appdata':util[_0xda88('0x6')](_0xda88('0xc'),_0xda88('0xd')),'priority':_0x32f69b++},_0x8c1020));if(_0x41e490[_0xda88('0xe')]){_0x33f038[_0xda88('0xa')](_[_0xda88('0xf')]({'app':_0xda88('0x10'),'appdata':util[_0xda88('0x6')](_0xda88('0x11'),_0x41e490[_0xda88('0x12')]),'priority':_0x32f69b++},_0x8c1020));}if(_0x41e490['auth']){_0x33f038[_0xda88('0xa')](_[_0xda88('0xf')]({'app':_0xda88('0x13'),'appdata':_0x41e490['password'],'priority':_0x32f69b++},_0x8c1020));}_0x33f038[_0xda88('0xa')](_[_0xda88('0xf')]({'app':'ChanSpy','appdata':util['format'](_0xda88('0x14'),_0x3109b1[_0xda88('0x15')],_0x41e490['options']?_0x41e490[_0xda88('0x16')][_0xda88('0x17')](''):''),'priority':_0x32f69b++},_0x8c1020));if(_0x41e490[_0xda88('0xe')]){_0x33f038[_0xda88('0xa')](_[_0xda88('0xf')]({'app':_0xda88('0x18'),'priority':_0x32f69b++},_0x8c1020));}return _0x33f038;};var getChanSpyApplications=function(_0x446734,_0x55966e){var _0x172668=[];for(var _0xcbeed4=0x0,_0x2593d0=0x1;_0xcbeed4<_0x55966e[_0xda88('0x19')];_0xcbeed4++,_0x2593d0=0x1){_0x172668=_0x172668['concat'](getUserApplications(_0x446734,_0x55966e[_0xcbeed4],_0x55966e[_0xcbeed4][_0xda88('0x1a')]));if(_0x55966e[_0xcbeed4][_0xda88('0x1a')]!=_0x55966e[_0xcbeed4][_0xda88('0x15')]){_0x172668=_0x172668[_0xda88('0x1b')](getUserApplications(_0x446734,_0x55966e[_0xcbeed4],_0x55966e[_0xcbeed4][_0xda88('0x15')]));}}return _0x172668;};var getChanSpyPromise=function(_0x3c3d48,_0x36dee5){return new BPromise(function(_0x18c229,_0x28d8ce){return _0x3c3d48[_0xda88('0x1c')][_0xda88('0x1d')]({'attributes':['id',_0xda88('0x15'),_0xda88('0x1a')],'where':{'role':_0xda88('0x1e'),'chanspy':!![]},'raw':!![]})[_0xda88('0x1f')](function(_0x40a62d){if(_0x40a62d){return _0x18c229(getChanSpyApplications(_0x36dee5,_0x40a62d));}return _0x18c229([]);})['catch'](function(_0x4d5b91){_0x28d8ce(_0x4d5b91);});});};module['exports']=function(_0x425de7,_0x3f8577){var _0x706862=_0x425de7['models'];return _0x425de7['define'](_0xda88('0x20'),attributes,{'tableName':_0xda88('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ce811,_0x259c75,_0x591e94){return getChanSpyPromise(_0x706862,_0x1ce811)[_0xda88('0x1f')](function(_0x4652cd){if(_0x4652cd&&_0x4652cd['length']){return _0x706862['VoiceExtension'][_0xda88('0x22')](_0x4652cd);}})[_0xda88('0x1f')](function(){_0x591e94();})[_0xda88('0x23')](function(_0x227959){_0x591e94(_0x227959);});},'afterUpdate':function(_0x180d1a,_0x1885dd,_0x315f4d){return _0x706862[_0xda88('0x24')][_0xda88('0x25')]({'where':{'ChanSpyId':_0x180d1a['id']}})['then'](function(){return getChanSpyPromise(_0x706862,_0x180d1a);})[_0xda88('0x1f')](function(_0x47c040){if(_0x47c040&&_0x47c040[_0xda88('0x19')]){return _0x706862[_0xda88('0x24')]['bulkCreate'](_0x47c040);}})[_0xda88('0x1f')](function(){_0x315f4d();})[_0xda88('0x23')](function(_0x3ab4ed){_0x315f4d(_0x3ab4ed);});},'afterDestroy':function(_0x188abe,_0x191b18,_0x2c4e63){return _0x706862[_0xda88('0x24')][_0xda88('0x25')]({'where':{'ChanSpyId':_0x188abe['id']}})['then'](function(){_0x2c4e63();})[_0xda88('0x23')](function(_0x6fe401){_0x2c4e63(_0x6fe401);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a33d6b8..3b93463 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 _0x6d98=['client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x6d98,0x139));var _0x86d9=function(_0x4d6077,_0x3ba9c4){_0x4d6077=_0x4d6077-0x0;var _0x4fb8fb=_0x6d98[_0x4d6077];return _0x4fb8fb;};'use strict';var _=require('lodash');var util=require(_0x86d9('0x0'));var moment=require(_0x86d9('0x1'));var BPromise=require(_0x86d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d9('0x3'));var db=require(_0x86d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x86d9('0x6'));var client=jayson[_0x86d9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bafd1,_0x79dff2,_0x501034){return new BPromise(function(_0x32dbce,_0xee5d30){return client[_0x86d9('0x8')](_0x3bafd1,_0x501034)[_0x86d9('0x9')](function(_0x1f5ccf){logger[_0x86d9('0xa')](_0x86d9('0xb'),_0x79dff2,_0x86d9('0xc'));logger[_0x86d9('0xd')](_0x86d9('0xe'),_0x79dff2,'request\x20sent',JSON[_0x86d9('0xf')](_0x1f5ccf));if(_0x1f5ccf[_0x86d9('0x10')]){if(_0x1f5ccf['error'][_0x86d9('0x11')]===0x1f4){logger[_0x86d9('0x10')](_0x86d9('0xb'),_0x79dff2,_0x1f5ccf['error'][_0x86d9('0x12')]);return _0xee5d30(_0x1f5ccf[_0x86d9('0x10')][_0x86d9('0x12')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x79dff2,_0x1f5ccf[_0x86d9('0x10')][_0x86d9('0x12')]);return _0x32dbce(_0x1f5ccf[_0x86d9('0x10')]['message']);}else{logger['info'](_0x86d9('0xb'),_0x79dff2,'request\x20sent');_0x32dbce(_0x1f5ccf[_0x86d9('0x13')][_0x86d9('0x12')]);}})['catch'](function(_0x4fe5d8){logger[_0x86d9('0x10')](_0x86d9('0xb'),_0x79dff2,_0x4fe5d8);_0xee5d30(_0x4fe5d8);});});} \ No newline at end of file +var _0x3375=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xba5340,_0xa6983d){var _0x444433=function(_0xad4805){while(--_0xad4805){_0xba5340['push'](_0xba5340['shift']());}};_0x444433(++_0xa6983d);}(_0x3375,0x188));var _0x5337=function(_0xe5a003,_0x17f56c){_0xe5a003=_0xe5a003-0x0;var _0x4bd410=_0x3375[_0xe5a003];return _0x4bd410;};'use strict';var _=require(_0x5337('0x0'));var util=require(_0x5337('0x1'));var moment=require(_0x5337('0x2'));var BPromise=require('bluebird');var rs=require(_0x5337('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5337('0x4'))['db'];var utils=require(_0x5337('0x5'));var logger=require(_0x5337('0x6'))('rpc');var config=require(_0x5337('0x7'));var jayson=require(_0x5337('0x8'));var client=jayson[_0x5337('0x9')][_0x5337('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x369406,_0x12bf2e,_0x1dd1bb){return new BPromise(function(_0x58896f,_0x32e719){return client[_0x5337('0xb')](_0x369406,_0x1dd1bb)[_0x5337('0xc')](function(_0x51f1bd){logger[_0x5337('0xd')](_0x5337('0xe'),_0x12bf2e,'request\x20sent');logger[_0x5337('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x12bf2e,_0x5337('0x10'),JSON['stringify'](_0x51f1bd));if(_0x51f1bd[_0x5337('0x11')]){if(_0x51f1bd['error'][_0x5337('0x12')]===0x1f4){logger[_0x5337('0x11')](_0x5337('0xe'),_0x12bf2e,_0x51f1bd[_0x5337('0x11')][_0x5337('0x13')]);return _0x32e719(_0x51f1bd[_0x5337('0x11')]['message']);}logger[_0x5337('0x11')](_0x5337('0xe'),_0x12bf2e,_0x51f1bd['error'][_0x5337('0x13')]);return _0x58896f(_0x51f1bd[_0x5337('0x11')][_0x5337('0x13')]);}else{logger['info'](_0x5337('0xe'),_0x12bf2e,'request\x20sent');_0x58896f(_0x51f1bd['result'][_0x5337('0x13')]);}})[_0x5337('0x14')](function(_0x447d75){logger['error'](_0x5337('0xe'),_0x12bf2e,_0x447d75);_0x32e719(_0x447d75);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ac1d1df..90171b6 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 _0x3457=['put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x418fd4,_0x8f136d){var _0xc7e5ef=function(_0xdcad4c){while(--_0xdcad4c){_0x418fd4['push'](_0x418fd4['shift']());}};_0xc7e5ef(++_0x8f136d);}(_0x3457,0xa6));var _0x7345=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3457[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7345('0x0'));var util=require(_0x7345('0x1'));var path=require(_0x7345('0x2'));var timeout=require(_0x7345('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7345('0x4'));var interaction=require(_0x7345('0x5'));var config=require(_0x7345('0x6'));var controller=require(_0x7345('0x7'));router[_0x7345('0x8')]('/',auth[_0x7345('0x9')](),controller[_0x7345('0xa')]);router[_0x7345('0x8')](_0x7345('0xb'),auth[_0x7345('0x9')](),controller['show']);router[_0x7345('0xc')]('/',auth[_0x7345('0x9')](),controller[_0x7345('0xd')]);router[_0x7345('0xe')](_0x7345('0xb'),auth[_0x7345('0x9')](),controller[_0x7345('0xf')]);router['delete'](_0x7345('0xb'),auth[_0x7345('0x9')](),controller[_0x7345('0x10')]);module[_0x7345('0x11')]=router; \ No newline at end of file +var _0x9cf6=['show','post','create','/:id','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./voiceContext.controller','get','index','isAuthenticated'];(function(_0x434543,_0x2fd498){var _0x3e6749=function(_0x5956f7){while(--_0x5956f7){_0x434543['push'](_0x434543['shift']());}};_0x3e6749(++_0x2fd498);}(_0x9cf6,0x1e3));var _0x69cf=function(_0x371676,_0x531f69){_0x371676=_0x371676-0x0;var _0x170a7d=_0x9cf6[_0x371676];return _0x170a7d;};'use strict';var multer=require(_0x69cf('0x0'));var util=require(_0x69cf('0x1'));var path=require(_0x69cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x69cf('0x3'));var router=express[_0x69cf('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x69cf('0x5'));var config=require('../../config/environment');var controller=require(_0x69cf('0x6'));router[_0x69cf('0x7')]('/',auth['isAuthenticated'](),controller[_0x69cf('0x8')]);router['get']('/:id',auth[_0x69cf('0x9')](),controller[_0x69cf('0xa')]);router[_0x69cf('0xb')]('/',auth['isAuthenticated'](),controller[_0x69cf('0xc')]);router['put'](_0x69cf('0xd'),auth[_0x69cf('0x9')](),controller[_0x69cf('0xe')]);router[_0x69cf('0xf')](_0x69cf('0xd'),auth[_0x69cf('0x9')](),controller['destroy']);module[_0x69cf('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9b98b22..57fc68a 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0xd4dc07,_0x31586c){var _0x4b0ab8=function(_0x2301c2){while(--_0x2301c2){_0xd4dc07['push'](_0xd4dc07['shift']());}};_0x4b0ab8(++_0x31586c);}(_0x34e8,0x12c));var _0x834e=function(_0xf843fa,_0x2c3bee){_0xf843fa=_0xf843fa-0x0;var _0x4daf75=_0x34e8[_0xf843fa];return _0x4daf75;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x344bc0,_0x1b4ef0){var _0x73e1f9=function(_0x41dadf){while(--_0x41dadf){_0x344bc0['push'](_0x344bc0['shift']());}};_0x73e1f9(++_0x1b4ef0);}(_0x34e8,0x12c));var _0x834e=function(_0x4c5e41,_0x330bc6){_0x4c5e41=_0x4c5e41-0x0;var _0x4a7067=_0x34e8[_0x4c5e41];return _0x4a7067;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 17afe4b..025c9ac 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 _0x34e8=['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','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','sendStatus','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','show','length','create','body','join','root','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','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','client'];(function(_0xcbde7b,_0x1a2234){var _0x7da893=function(_0x2a1def){while(--_0x2a1def){_0xcbde7b['push'](_0xcbde7b['shift']());}};_0x7da893(++_0x1a2234);}(_0x34e8,0x12c));var _0x834e=function(_0x27139b,_0x1f6a34){_0x27139b=_0x27139b-0x0;var _0xe20f20=_0x34e8[_0x27139b];return _0xe20f20;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x834e('0x1d')][_0x834e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x58a27e,_0x23848e,_0x2d95f2){if(_0x2d95f2){var _0x28e659=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28e659[_0x834e('0x1f')](_0x23848e)){return _0x58a27e;}else{throw new db['Sequelize'][(_0x834e('0x20'))](_0x834e('0x21'));}}else{return _0x58a27e;}}function respondWithRpcPromise(_0x57274a,_0x316205,_0x4a9cdc,_0x38a8cd){return new BPromise(function(_0x36d443,_0x478afe){var _0x43ac41=_0x38a8cd||client;return _0x43ac41[_0x834e('0x22')](_0x57274a,_0x4a9cdc)[_0x834e('0x23')](function(_0x50b3f6){logger[_0x834e('0x24')](_0x834e('0x25'),_0x316205,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x316205,_0x834e('0x26'),JSON[_0x834e('0x29')](_0x50b3f6));if(_0x50b3f6['error']){if(_0x50b3f6[_0x834e('0x2a')][_0x834e('0x2b')]===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6['error'][_0x834e('0x2c')]);return _0x478afe(_0x50b3f6[_0x834e('0x2a')]['message']);}logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6[_0x834e('0x2a')]['message']);return _0x36d443(_0x50b3f6['error'][_0x834e('0x2c')]);}else{logger[_0x834e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x834e('0x26'));_0x36d443(_0x50b3f6[_0x834e('0x2d')]['message']);}})[_0x834e('0x2e')](function(_0x2e1983){logger[_0x834e('0x2a')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x2e1983);_0x478afe(_0x2e1983);});});}function respondWithStatusCode(_0x24fcf7,_0x3e310f){_0x3e310f=_0x3e310f||0xcc;return function(_0x5e1cc5){if(_0x5e1cc5){return _0x24fcf7['sendStatus'](_0x3e310f);}return _0x24fcf7[_0x834e('0x2f')](_0x3e310f)['end']();};}function respondWithResult(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0xc8;return function(_0x3db026){if(_0x3db026){return _0x2826ec[_0x834e('0x2f')](_0x3f1b0b)[_0x834e('0x30')](_0x3db026);}};}function respondWithFilteredResult(_0x130cc5,_0x491919){return function(_0x510780){if(_0x510780){var _0x4dc64a=_0x510780[_0x834e('0x31')],_0x58c1d7=_0x491919['offset'],_0x2c7a8d=_0x491919[_0x834e('0x32')]+_0x491919[_0x834e('0x33')],_0x567cea;if(_0x2c7a8d>=_0x4dc64a){_0x2c7a8d=_0x4dc64a;_0x567cea=0xc8;}else{_0x567cea=0xce;}_0x130cc5[_0x834e('0x2f')](_0x567cea);return _0x130cc5[_0x834e('0x34')](_0x834e('0x35'),_0x58c1d7+'-'+_0x2c7a8d+'/'+_0x4dc64a)[_0x834e('0x30')](_0x510780);}return null;};}function patchUpdates(_0x3d149d){return function(_0xfaf716){try{jsonpatch[_0x834e('0x36')](_0xfaf716,_0x3d149d,!![]);}catch(_0x493289){return BPromise[_0x834e('0x37')](_0x493289);}return _0xfaf716['save']();};}function saveUpdates(_0x2c75c2,_0x3787b0){return function(_0x9ab921){if(_0x9ab921){return _0x9ab921[_0x834e('0x38')](_0x2c75c2)[_0x834e('0x23')](function(_0x4689c2){return _0x4689c2;});}return null;};}function removeEntity(_0x4696a1,_0x38cd29){return function(_0x358c31){if(_0x358c31){return _0x358c31[_0x834e('0x39')]()['then'](function(){var _0x2a3c7f=_0x358c31[_0x834e('0x3a')]({'plain':!![]});var _0x24a9df=_0x834e('0x3b');return db['UserProfileResource'][_0x834e('0x39')]({'where':{'type':_0x24a9df,'resourceId':_0x2a3c7f['id']}})[_0x834e('0x23')](function(){return _0x358c31;});})['then'](function(){_0x4696a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e58fa,_0x41bf4d){return function(_0x20c6ae){if(!_0x20c6ae){_0x3e58fa[_0x834e('0x3c')](0x194);}return _0x20c6ae;};}function handleError(_0x339e28,_0x1b76dd){_0x1b76dd=_0x1b76dd||0x1f4;return function(_0x4c2ef6){logger[_0x834e('0x2a')](_0x4c2ef6['stack']);if(_0x4c2ef6[_0x834e('0x3d')]){delete _0x4c2ef6[_0x834e('0x3d')];}_0x339e28['status'](_0x1b76dd)[_0x834e('0x3e')](_0x4c2ef6);};}exports[_0x834e('0x3f')]=function(_0x491c28,_0x481f70){var _0x388711={},_0xd0d43a={},_0x2e9383={'count':0x0,'rows':[]};var _0x130c23=_[_0x834e('0x40')](db['VoiceContext'][_0x834e('0x41')],function(_0x548d1d){return{'name':_0x548d1d['fieldName'],'type':_0x548d1d[_0x834e('0x42')]['key']};});_0xd0d43a[_0x834e('0x43')]=_[_0x834e('0x40')](_0x130c23,_0x834e('0x3d'));_0xd0d43a[_0x834e('0x44')]=_[_0x834e('0x45')](_0x491c28['query']);_0xd0d43a[_0x834e('0x46')]=_[_0x834e('0x47')](_0xd0d43a[_0x834e('0x43')],_0xd0d43a['query']);_0x388711[_0x834e('0x48')]=_[_0x834e('0x47')](_0xd0d43a['model'],qs[_0x834e('0x49')](_0x491c28['query'][_0x834e('0x49')]));_0x388711[_0x834e('0x48')]=_0x388711['attributes']['length']?_0x388711[_0x834e('0x48')]:_0xd0d43a[_0x834e('0x43')];if(!_0x491c28[_0x834e('0x44')][_0x834e('0x4a')](_0x834e('0x4b'))){_0x388711[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x491c28['query'][_0x834e('0x33')]);_0x388711['offset']=qs[_0x834e('0x32')](_0x491c28['query'][_0x834e('0x32')]);}_0x388711['order']=qs[_0x834e('0x4c')](_0x491c28[_0x834e('0x44')]['sort']);_0x388711[_0x834e('0x4d')]=qs[_0x834e('0x46')](_[_0x834e('0x4e')](_0x491c28[_0x834e('0x44')],_0xd0d43a[_0x834e('0x46')]),_0x130c23);if(_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]){_0x388711[_0x834e('0x4d')]=_[_0x834e('0x50')](_0x388711[_0x834e('0x4d')],{'$or':_['map'](_0x130c23,function(_0x3124be){if(_0x3124be[_0x834e('0x42')]!=='VIRTUAL'){var _0x112306={};_0x112306[_0x3124be[_0x834e('0x3d')]]={'$like':'%'+_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]+'%'};return _0x112306;}})});}_0x388711=_[_0x834e('0x50')]({},_0x388711,_0x491c28[_0x834e('0x51')]);var _0x4eab06={'where':_0x388711['where']};return db[_0x834e('0x52')][_0x834e('0x31')](_0x4eab06)[_0x834e('0x23')](function(_0x40ff5a){_0x2e9383[_0x834e('0x31')]=_0x40ff5a;if(_0x491c28[_0x834e('0x44')][_0x834e('0x53')]){_0x388711[_0x834e('0x54')]=[{'all':!![]}];}return db[_0x834e('0x52')][_0x834e('0x55')](_0x388711);})[_0x834e('0x23')](function(_0x385435){_0x2e9383[_0x834e('0x56')]=_0x385435;return _0x2e9383;})[_0x834e('0x23')](respondWithFilteredResult(_0x481f70,_0x388711))[_0x834e('0x2e')](handleError(_0x481f70,null));};exports[_0x834e('0x57')]=function(_0x3df078,_0x32b8f7){var _0x420841={'raw':![],'where':{'id':_0x3df078['params']['id']}},_0x1adf86={};_0x1adf86[_0x834e('0x43')]=_[_0x834e('0x45')](db['VoiceContext'][_0x834e('0x41')]);_0x1adf86[_0x834e('0x44')]=_['keys'](_0x3df078[_0x834e('0x44')]);_0x1adf86[_0x834e('0x46')]=_[_0x834e('0x47')](_0x1adf86[_0x834e('0x43')],_0x1adf86[_0x834e('0x44')]);_0x420841[_0x834e('0x48')]=_[_0x834e('0x47')](_0x1adf86['model'],qs[_0x834e('0x49')](_0x3df078[_0x834e('0x44')][_0x834e('0x49')]));_0x420841[_0x834e('0x48')]=_0x420841[_0x834e('0x48')][_0x834e('0x58')]?_0x420841[_0x834e('0x48')]:_0x1adf86[_0x834e('0x43')];if(_0x3df078['query'][_0x834e('0x53')]){_0x420841['include']=[{'all':!![]}];}_0x420841=_[_0x834e('0x50')]({},_0x420841,_0x3df078['options']);return db[_0x834e('0x52')]['find'](_0x420841)['then'](handleEntityNotFound(_0x32b8f7,null))[_0x834e('0x23')](respondWithResult(_0x32b8f7,null))[_0x834e('0x2e')](handleError(_0x32b8f7,null));};exports['create']=function(_0x5be43d,_0x2c8155,_0x2452b4){var _0x138ed2;return db[_0x834e('0x52')][_0x834e('0x59')](_0x5be43d[_0x834e('0x5a')],{'raw':!![]})[_0x834e('0x23')](function(_0x4273f1){_0x138ed2=_0x4273f1;return db['VoiceContext'][_0x834e('0x55')]({'raw':!![]});})[_0x834e('0x23')](function(_0x5d5ac2){var _0x281342=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),_0x834e('0x5d'));var _0x37ee0e=ejs[_0x834e('0x5e')](_0x281342,{'contexts':_0x5d5ac2||[]});fs[_0x834e('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x37ee0e);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x59'),{'module':'chan_sip.so'});})[_0x834e('0x23')](function(){var _0x1fcae9=_0x5be43d[_0x834e('0x61')][_0x834e('0x3a')]({'plain':!![]});if(!_0x1fcae9)throw new Error(_0x834e('0x62'));if(_0x1fcae9[_0x834e('0x63')]===_0x834e('0x61')){var _0x1def00=_0x138ed2[_0x834e('0x3a')]({'plain':!![]});return db[_0x834e('0x64')][_0x834e('0x65')]({'where':{'name':_0x834e('0x3b'),'userProfileId':_0x1fcae9[_0x834e('0x66')]},'raw':!![]})[_0x834e('0x23')](function(_0x460a7a){if(_0x460a7a&&_0x460a7a[_0x834e('0x67')]===0x0){return db[_0x834e('0x68')][_0x834e('0x59')]({'name':_0x1def00[_0x834e('0x3d')],'resourceId':_0x1def00['id'],'type':_0x460a7a[_0x834e('0x3d')],'sectionId':_0x460a7a['id']},{})[_0x834e('0x23')](function(){return _0x138ed2;});}else{return _0x138ed2;}})[_0x834e('0x2e')](function(_0x5c83eb){logger[_0x834e('0x2a')](_0x834e('0x69'),_0x5c83eb);throw _0x5c83eb;});}return _0x138ed2;})[_0x834e('0x23')](respondWithResult(_0x2c8155,0xc9))[_0x834e('0x2e')](handleError(_0x2c8155,null));};exports['update']=function(_0x30faa8,_0x5a9c70,_0x56a152){var _0x2fdb1b;return db[_0x834e('0x52')][_0x834e('0x65')]({'where':{'id':_0x30faa8[_0x834e('0x6a')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x5a9c70,null))[_0x834e('0x23')](saveUpdates(_0x30faa8[_0x834e('0x5a')],null))[_0x834e('0x23')](function(_0x525ed3){if(_0x525ed3){_0x2fdb1b=_0x525ed3;return db[_0x834e('0x52')]['findAll']({'raw':!![]});}})[_0x834e('0x23')](function(_0xd35dda){var _0x514fe5=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],_0x834e('0x6b')),_0x834e('0x5d'));var _0x2c41bd=ejs['render'](_0x514fe5,{'contexts':_0xd35dda||[]});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x2c41bd);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x38'),{'module':_0x834e('0x6d')});})[_0x834e('0x23')](function(){return _0x2fdb1b;})[_0x834e('0x23')](respondWithResult(_0x5a9c70,null))[_0x834e('0x2e')](handleError(_0x5a9c70,null));};exports[_0x834e('0x39')]=function(_0x5b2bf6,_0x1b158b,_0x2e4d80){var _0x42fc96;return db[_0x834e('0x52')]['find']({'where':{'id':_0x5b2bf6[_0x834e('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1b158b,null))['then'](removeEntity(_0x1b158b,null))['then'](function(){return db[_0x834e('0x52')][_0x834e('0x55')]({'raw':!![]});})['then'](function(_0x2645df){var _0x1b200d=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x346be5=ejs[_0x834e('0x5e')](_0x1b200d,{'contexts':_0x2645df});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x346be5);return respondWithRpcPromise(_0x834e('0x60'),'destroy',{'module':_0x834e('0x6d')});})['catch'](handleError(_0x1b158b,null));}; \ No newline at end of file +var _0xedd9=['VoiceContext','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','update','params','root','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','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','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index'];(function(_0x154a1b,_0x2f8997){var _0x2bf301=function(_0x254141){while(--_0x254141){_0x154a1b['push'](_0x154a1b['shift']());}};_0x2bf301(++_0x2f8997);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d689f,_0x35fa1d){_0x3d689f=_0x3d689f-0x0;var _0x5459b6=_0xedd9[_0x3d689f];return _0x5459b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var jayson=require(_0x9edd('0x17'));var client=jayson[_0x9edd('0x18')][_0x9edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3a7b84,_0xfca576,_0xef5498){if(_0xef5498){var _0x47eb64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47eb64[_0x9edd('0x1a')](_0xfca576)){return _0x3a7b84;}else{throw new db[(_0x9edd('0x1b'))][(_0x9edd('0x1c'))](_0x9edd('0x1d'));}}else{return _0x3a7b84;}}function respondWithRpcPromise(_0x13b6b6,_0x338f3c,_0x1042aa,_0x75a4ab){return new BPromise(function(_0x4ea60f,_0x5f5bf4){var _0x448996=_0x75a4ab||client;return _0x448996[_0x9edd('0x1e')](_0x13b6b6,_0x1042aa)['then'](function(_0x1b54c0){logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,'request\x20sent');logger[_0x9edd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x338f3c,_0x9edd('0x22'),JSON[_0x9edd('0x23')](_0x1b54c0));if(_0x1b54c0['error']){if(_0x1b54c0['error'][_0x9edd('0x24')]===0x1f4){logger['error'](_0x9edd('0x20'),_0x338f3c,_0x1b54c0['error']['message']);return _0x5f5bf4(_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x338f3c,_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);return _0x4ea60f(_0x1b54c0[_0x9edd('0x25')]['message']);}else{logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,_0x9edd('0x22'));_0x4ea60f(_0x1b54c0[_0x9edd('0x27')][_0x9edd('0x26')]);}})['catch'](function(_0x46c383){logger[_0x9edd('0x25')](_0x9edd('0x20'),_0x338f3c,_0x46c383);_0x5f5bf4(_0x46c383);});});}function respondWithStatusCode(_0x2f9f86,_0x310a4d){_0x310a4d=_0x310a4d||0xcc;return function(_0x4d507f){if(_0x4d507f){return _0x2f9f86['sendStatus'](_0x310a4d);}return _0x2f9f86[_0x9edd('0x28')](_0x310a4d)[_0x9edd('0x29')]();};}function respondWithResult(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0xc8;return function(_0x3c2227){if(_0x3c2227){return _0x8d67aa['status'](_0x25e135)['json'](_0x3c2227);}};}function respondWithFilteredResult(_0x214d0a,_0x257a26){return function(_0x1c762c){if(_0x1c762c){var _0x52746a=_0x1c762c[_0x9edd('0x2a')],_0x238b22=_0x257a26['offset'],_0x28cfae=_0x257a26[_0x9edd('0x2b')]+_0x257a26[_0x9edd('0x2c')],_0x2ae8dd;if(_0x28cfae>=_0x52746a){_0x28cfae=_0x52746a;_0x2ae8dd=0xc8;}else{_0x2ae8dd=0xce;}_0x214d0a[_0x9edd('0x28')](_0x2ae8dd);return _0x214d0a[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x238b22+'-'+_0x28cfae+'/'+_0x52746a)[_0x9edd('0x2f')](_0x1c762c);}return null;};}function patchUpdates(_0x209aba){return function(_0x1fba7b){try{jsonpatch[_0x9edd('0x30')](_0x1fba7b,_0x209aba,!![]);}catch(_0x1c2e2b){return BPromise[_0x9edd('0x31')](_0x1c2e2b);}return _0x1fba7b[_0x9edd('0x32')]();};}function saveUpdates(_0x6907a5,_0xa55906){return function(_0x1a6c23){if(_0x1a6c23){return _0x1a6c23['update'](_0x6907a5)[_0x9edd('0x33')](function(_0x259259){return _0x259259;});}return null;};}function removeEntity(_0x267c74,_0x5d1707){return function(_0x2d2f88){if(_0x2d2f88){return _0x2d2f88[_0x9edd('0x34')]()[_0x9edd('0x33')](function(){var _0x38a7be=_0x2d2f88[_0x9edd('0x35')]({'plain':!![]});var _0x2bc4ed=_0x9edd('0x36');return db[_0x9edd('0x37')][_0x9edd('0x34')]({'where':{'type':_0x2bc4ed,'resourceId':_0x38a7be['id']}})[_0x9edd('0x33')](function(){return _0x2d2f88;});})[_0x9edd('0x33')](function(){_0x267c74[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x14f780,_0x5757fc){return function(_0x37fcb2){if(!_0x37fcb2){_0x14f780['sendStatus'](0x194);}return _0x37fcb2;};}function handleError(_0x968303,_0x148630){_0x148630=_0x148630||0x1f4;return function(_0x10d6fd){logger[_0x9edd('0x25')](_0x10d6fd[_0x9edd('0x38')]);if(_0x10d6fd['name']){delete _0x10d6fd[_0x9edd('0x39')];}_0x968303[_0x9edd('0x28')](_0x148630)[_0x9edd('0x3a')](_0x10d6fd);};}exports[_0x9edd('0x3b')]=function(_0x1be77f,_0x337e6c){var _0x5c0627={},_0x1cbbac={},_0x1ccee8={'count':0x0,'rows':[]};var _0x35c16f=_['map'](db[_0x9edd('0x3c')]['rawAttributes'],function(_0x3ef1d5){return{'name':_0x3ef1d5['fieldName'],'type':_0x3ef1d5[_0x9edd('0x3d')][_0x9edd('0x3e')]};});_0x1cbbac[_0x9edd('0x3f')]=_['map'](_0x35c16f,_0x9edd('0x39'));_0x1cbbac[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x1be77f['query']);_0x1cbbac[_0x9edd('0x42')]=_['intersection'](_0x1cbbac[_0x9edd('0x3f')],_0x1cbbac[_0x9edd('0x40')]);_0x5c0627['attributes']=_[_0x9edd('0x43')](_0x1cbbac[_0x9edd('0x3f')],qs[_0x9edd('0x44')](_0x1be77f[_0x9edd('0x40')]['fields']));_0x5c0627[_0x9edd('0x45')]=_0x5c0627['attributes'][_0x9edd('0x46')]?_0x5c0627[_0x9edd('0x45')]:_0x1cbbac['model'];if(!_0x1be77f[_0x9edd('0x40')]['hasOwnProperty']('nolimit')){_0x5c0627[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2c')]);_0x5c0627[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2b')]);}_0x5c0627[_0x9edd('0x47')]=qs[_0x9edd('0x48')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x48')]);_0x5c0627[_0x9edd('0x49')]=qs[_0x9edd('0x42')](_[_0x9edd('0x4a')](_0x1be77f['query'],_0x1cbbac[_0x9edd('0x42')]),_0x35c16f);if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]){_0x5c0627[_0x9edd('0x49')]=_[_0x9edd('0x4c')](_0x5c0627[_0x9edd('0x49')],{'$or':_[_0x9edd('0x4d')](_0x35c16f,function(_0x4e9ad1){if(_0x4e9ad1['type']!=='VIRTUAL'){var _0x4a7dc9={};_0x4a7dc9[_0x4e9ad1['name']]={'$like':'%'+_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]+'%'};return _0x4a7dc9;}})});}_0x5c0627=_[_0x9edd('0x4c')]({},_0x5c0627,_0x1be77f[_0x9edd('0x4e')]);var _0x367791={'where':_0x5c0627['where']};return db[_0x9edd('0x3c')][_0x9edd('0x2a')](_0x367791)[_0x9edd('0x33')](function(_0x4a89ae){_0x1ccee8[_0x9edd('0x2a')]=_0x4a89ae;if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x5c0627[_0x9edd('0x50')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x51')](_0x5c0627);})['then'](function(_0x441e4a){_0x1ccee8[_0x9edd('0x52')]=_0x441e4a;return _0x1ccee8;})['then'](respondWithFilteredResult(_0x337e6c,_0x5c0627))[_0x9edd('0x53')](handleError(_0x337e6c,null));};exports[_0x9edd('0x54')]=function(_0x4bb324,_0x2bd089){var _0x8134cd={'raw':![],'where':{'id':_0x4bb324['params']['id']}},_0x468239={};_0x468239[_0x9edd('0x3f')]=_[_0x9edd('0x41')](db[_0x9edd('0x3c')][_0x9edd('0x55')]);_0x468239['query']=_[_0x9edd('0x41')](_0x4bb324[_0x9edd('0x40')]);_0x468239[_0x9edd('0x42')]=_['intersection'](_0x468239[_0x9edd('0x3f')],_0x468239[_0x9edd('0x40')]);_0x8134cd['attributes']=_[_0x9edd('0x43')](_0x468239['model'],qs[_0x9edd('0x44')](_0x4bb324[_0x9edd('0x40')][_0x9edd('0x44')]));_0x8134cd[_0x9edd('0x45')]=_0x8134cd[_0x9edd('0x45')][_0x9edd('0x46')]?_0x8134cd[_0x9edd('0x45')]:_0x468239[_0x9edd('0x3f')];if(_0x4bb324[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x8134cd[_0x9edd('0x50')]=[{'all':!![]}];}_0x8134cd=_['merge']({},_0x8134cd,_0x4bb324[_0x9edd('0x4e')]);return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x8134cd)['then'](handleEntityNotFound(_0x2bd089,null))[_0x9edd('0x33')](respondWithResult(_0x2bd089,null))['catch'](handleError(_0x2bd089,null));};exports['create']=function(_0x54ecfa,_0x1348a7,_0x45f47c){var _0x366316;return db[_0x9edd('0x3c')]['create'](_0x54ecfa['body'],{'raw':!![]})['then'](function(_0x71820f){_0x366316=_0x71820f;return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x2e2920){var _0x41ec97=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],_0x9edd('0x59')),'utf8');var _0x421e82=ejs[_0x9edd('0x5a')](_0x41ec97,{'contexts':_0x2e2920||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x421e82);})[_0x9edd('0x33')](function(){return respondWithRpcPromise(_0x9edd('0x5c'),'create',{'module':_0x9edd('0x5d')});})[_0x9edd('0x33')](function(){var _0x430eb4=_0x54ecfa[_0x9edd('0x5e')][_0x9edd('0x35')]({'plain':!![]});if(!_0x430eb4)throw new Error(_0x9edd('0x5f'));if(_0x430eb4['role']==='user'){var _0x452ca5=_0x366316['get']({'plain':!![]});return db[_0x9edd('0x60')][_0x9edd('0x56')]({'where':{'name':_0x9edd('0x36'),'userProfileId':_0x430eb4[_0x9edd('0x61')]},'raw':!![]})['then'](function(_0x21ead2){if(_0x21ead2&&_0x21ead2['autoAssociation']===0x0){return db[_0x9edd('0x37')][_0x9edd('0x62')]({'name':_0x452ca5[_0x9edd('0x39')],'resourceId':_0x452ca5['id'],'type':_0x21ead2['name'],'sectionId':_0x21ead2['id']},{})[_0x9edd('0x33')](function(){return _0x366316;});}else{return _0x366316;}})['catch'](function(_0x37e603){logger[_0x9edd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e603);throw _0x37e603;});}return _0x366316;})[_0x9edd('0x33')](respondWithResult(_0x1348a7,0xc9))['catch'](handleError(_0x1348a7,null));};exports[_0x9edd('0x63')]=function(_0x134c9c,_0x307a61,_0x50f4fc){var _0x4181b9;return db[_0x9edd('0x3c')][_0x9edd('0x56')]({'where':{'id':_0x134c9c[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x307a61,null))['then'](saveUpdates(_0x134c9c['body'],null))[_0x9edd('0x33')](function(_0x211526){if(_0x211526){_0x4181b9=_0x211526;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bc89b){var _0x4e003a=fs['readFileSync'](path[_0x9edd('0x58')](config[_0x9edd('0x65')],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x11e082=ejs[_0x9edd('0x5a')](_0x4e003a,{'contexts':_0x1bc89b||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x11e082);})['then'](function(){return respondWithRpcPromise(_0x9edd('0x5c'),_0x9edd('0x63'),{'module':'chan_sip.so'});})[_0x9edd('0x33')](function(){return _0x4181b9;})[_0x9edd('0x33')](respondWithResult(_0x307a61,null))['catch'](handleError(_0x307a61,null));};exports[_0x9edd('0x34')]=function(_0x475dc3,_0x460a92,_0x1d9536){var _0x5ce70b;return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x475dc3[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x460a92,null))[_0x9edd('0x33')](removeEntity(_0x460a92,null))['then'](function(){return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x383cb9){var _0x25626a=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x3c7874=ejs[_0x9edd('0x5a')](_0x25626a,{'contexts':_0x383cb9});fs[_0x9edd('0x67')](_0x9edd('0x5b'),_0x3c7874);return respondWithRpcPromise('Reload',_0x9edd('0x34'),{'module':_0x9edd('0x5d')});})[_0x9edd('0x53')](handleError(_0x460a92,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index cacfd49..768dc70 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 _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xea4995,_0xc796a0){var _0x39e928=function(_0xe8f912){while(--_0xe8f912){_0xea4995['push'](_0xea4995['shift']());}};_0x39e928(++_0xc796a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 46c5847..4a535d3 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 _0xcd92=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0xcd92,0xb3));var _0x2cd9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcd92[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var moment=require(_0x2cd9('0x2'));var BPromise=require(_0x2cd9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cd9('0x4'))['db'];var utils=require(_0x2cd9('0x5'));var logger=require(_0x2cd9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2cd9('0x7'));var client=jayson['client'][_0x2cd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a5775,_0x2cc67c,_0x3c8853){return new BPromise(function(_0x5ec84b,_0x2b76ec){return client['request'](_0x1a5775,_0x3c8853)[_0x2cd9('0x9')](function(_0x2b4f20){logger['info'](_0x2cd9('0xa'),_0x2cc67c,_0x2cd9('0xb'));logger[_0x2cd9('0xc')](_0x2cd9('0xd'),_0x2cc67c,_0x2cd9('0xb'),JSON[_0x2cd9('0xe')](_0x2b4f20));if(_0x2b4f20['error']){if(_0x2b4f20[_0x2cd9('0xf')][_0x2cd9('0x10')]===0x1f4){logger[_0x2cd9('0xf')](_0x2cd9('0xa'),_0x2cc67c,_0x2b4f20[_0x2cd9('0xf')][_0x2cd9('0x11')]);return _0x2b76ec(_0x2b4f20[_0x2cd9('0xf')][_0x2cd9('0x11')]);}logger[_0x2cd9('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2cc67c,_0x2b4f20[_0x2cd9('0xf')]['message']);return _0x5ec84b(_0x2b4f20[_0x2cd9('0xf')][_0x2cd9('0x11')]);}else{logger[_0x2cd9('0x12')](_0x2cd9('0xa'),_0x2cc67c,_0x2cd9('0xb'));_0x5ec84b(_0x2b4f20[_0x2cd9('0x13')]['message']);}})['catch'](function(_0x334cd1){logger[_0x2cd9('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2cc67c,_0x334cd1);_0x2b76ec(_0x334cd1);});});} \ No newline at end of file +var _0xcffe=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0xbdf091,_0x35a06c){var _0x129fd5=function(_0x529abd){while(--_0x529abd){_0xbdf091['push'](_0xbdf091['shift']());}};_0x129fd5(++_0x35a06c);}(_0xcffe,0x1a1));var _0xecff=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0xcffe[_0x3b7b42];return _0x1ebaad;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2fa9,_0x38a8f6,_0x50c98b){return new BPromise(function(_0x298c19,_0x1f7386){return client['request'](_0x2e2fa9,_0x50c98b)[_0xecff('0xc')](function(_0x3eefb9){logger[_0xecff('0xd')](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));logger['debug'](_0xecff('0x10'),_0x38a8f6,_0xecff('0xf'),JSON[_0xecff('0x11')](_0x3eefb9));if(_0x3eefb9[_0xecff('0x12')]){if(_0x3eefb9[_0xecff('0x12')][_0xecff('0x13')]===0x1f4){logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);return _0x1f7386(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9['error']['message']);return _0x298c19(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}else{logger['info'](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));_0x298c19(_0x3eefb9[_0xecff('0x15')]['message']);}})['catch'](function(_0x24abef){logger[_0xecff('0x12')]('VoiceContext,\x20%s,\x20%s',_0x38a8f6,_0x24abef);_0x1f7386(_0x24abef);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a8286ce..e83e3ca 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 _0x83df=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x83df,0x13d));var _0xf83d=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x83df[_0x56f7e2];return _0x36240b;};'use strict';var multer=require('multer');var util=require(_0xf83d('0x0'));var path=require(_0xf83d('0x1'));var timeout=require(_0xf83d('0x2'));var express=require(_0xf83d('0x3'));var router=express[_0xf83d('0x4')]();var auth=require(_0xf83d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf83d('0x6'));var controller=require(_0xf83d('0x7'));router[_0xf83d('0x8')]('/',auth[_0xf83d('0x9')](),controller[_0xf83d('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf83d('0xb')]);router[_0xf83d('0x8')](_0xf83d('0xc'),auth[_0xf83d('0x9')](),controller[_0xf83d('0xd')]);router['post']('/',auth[_0xf83d('0x9')](),controller[_0xf83d('0xe')]);router[_0xf83d('0xf')]('/:id',auth[_0xf83d('0x9')](),controller[_0xf83d('0x10')]);router[_0xf83d('0x11')](_0xf83d('0xc'),auth[_0xf83d('0x9')](),controller['destroy']);module[_0xf83d('0x12')]=router; \ No newline at end of file +var _0x97d4=['/:id','post','create','put','delete','destroy','util','path','connect-timeout','express','get','isAuthenticated','index','/describe'];(function(_0x47d10a,_0x2e7ff0){var _0x1561fb=function(_0x3bf450){while(--_0x3bf450){_0x47d10a['push'](_0x47d10a['shift']());}};_0x1561fb(++_0x2e7ff0);}(_0x97d4,0x1c6));var _0x497d=function(_0x23a4bc,_0x32deba){_0x23a4bc=_0x23a4bc-0x0;var _0x2a450e=_0x97d4[_0x23a4bc];return _0x2a450e;};'use strict';var multer=require('multer');var util=require(_0x497d('0x0'));var path=require(_0x497d('0x1'));var timeout=require(_0x497d('0x2'));var express=require(_0x497d('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('./voiceDialReport.controller');router[_0x497d('0x4')]('/',auth[_0x497d('0x5')](),controller[_0x497d('0x6')]);router['get'](_0x497d('0x7'),auth[_0x497d('0x5')](),controller['describe']);router[_0x497d('0x4')](_0x497d('0x8'),auth[_0x497d('0x5')](),controller['show']);router[_0x497d('0x9')]('/',auth[_0x497d('0x5')](),controller[_0x497d('0xa')]);router[_0x497d('0xb')](_0x497d('0x8'),auth[_0x497d('0x5')](),controller['update']);router[_0x497d('0xc')](_0x497d('0x8'),auth[_0x497d('0x5')](),controller[_0x497d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5d6bb06..4d50f0f 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 _0x90a3=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x90a3,0x166));var _0x390a=function(_0x20ae9c,_0x274d67){_0x20ae9c=_0x20ae9c-0x0;var _0x5da8cc=_0x90a3[_0x20ae9c];return _0x5da8cc;};'use strict';var Sequelize=require(_0x390a('0x0'));module[_0x390a('0x1')]={'privilege':{'type':Sequelize[_0x390a('0x2')]},'channel':{'type':Sequelize[_0x390a('0x2')]},'channelstate':{'type':Sequelize[_0x390a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x390a('0x2')]},'calleridnum':{'type':Sequelize[_0x390a('0x2')]},'calleridname':{'type':Sequelize[_0x390a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x390a('0x2')]},'connectedlinename':{'type':Sequelize[_0x390a('0x2')]},'language':{'type':Sequelize[_0x390a('0x2')]},'accountcode':{'type':Sequelize[_0x390a('0x2')]},'context':{'type':Sequelize[_0x390a('0x2')]},'exten':{'type':Sequelize[_0x390a('0x2')]},'priority':{'type':Sequelize[_0x390a('0x3')]},'uniqueid':{'type':Sequelize[_0x390a('0x2')]},'linkedid':{'type':Sequelize[_0x390a('0x2')]},'destchannel':{'type':Sequelize[_0x390a('0x2')]},'destchannelstate':{'type':Sequelize[_0x390a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x390a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x390a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x390a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x390a('0x2')]},'destcontext':{'type':Sequelize[_0x390a('0x2')]},'destexten':{'type':Sequelize[_0x390a('0x2')]},'destpriority':{'type':Sequelize[_0x390a('0x3')]},'destuniqueid':{'type':Sequelize[_0x390a('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x390a('0x2')]},'dialstatus':{'type':Sequelize[_0x390a('0x2')]},'starttime':{'type':Sequelize[_0x390a('0x4')]},'answertime':{'type':Sequelize[_0x390a('0x4')]},'endtime':{'type':Sequelize[_0x390a('0x4')]},'lastevent':{'type':Sequelize[_0x390a('0x2')],'comment':_0x390a('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x390a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4f4e=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x353e55,_0x384e65){var _0xe1646a=function(_0x4f2877){while(--_0x4f2877){_0x353e55['push'](_0x353e55['shift']());}};_0xe1646a(++_0x384e65);}(_0x4f4e,0x97));var _0xe4f4=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x4f4e[_0x4f3b2d];return _0x3dddfa;};'use strict';var Sequelize=require(_0xe4f4('0x0'));module[_0xe4f4('0x1')]={'privilege':{'type':Sequelize[_0xe4f4('0x2')]},'channel':{'type':Sequelize[_0xe4f4('0x2')]},'channelstate':{'type':Sequelize[_0xe4f4('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe4f4('0x2')]},'calleridnum':{'type':Sequelize[_0xe4f4('0x2')]},'calleridname':{'type':Sequelize[_0xe4f4('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe4f4('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe4f4('0x2')]},'accountcode':{'type':Sequelize[_0xe4f4('0x2')]},'context':{'type':Sequelize[_0xe4f4('0x2')]},'exten':{'type':Sequelize[_0xe4f4('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe4f4('0x2')]},'linkedid':{'type':Sequelize[_0xe4f4('0x2')]},'destchannel':{'type':Sequelize[_0xe4f4('0x2')]},'destchannelstate':{'type':Sequelize[_0xe4f4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe4f4('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe4f4('0x2')]},'destcalleridname':{'type':Sequelize[_0xe4f4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe4f4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe4f4('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe4f4('0x2')]},'destexten':{'type':Sequelize[_0xe4f4('0x2')]},'destpriority':{'type':Sequelize[_0xe4f4('0x3')]},'destuniqueid':{'type':Sequelize[_0xe4f4('0x2')]},'destlinkedid':{'type':Sequelize[_0xe4f4('0x2')]},'dialstring':{'type':Sequelize[_0xe4f4('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe4f4('0x4')]},'lastevent':{'type':Sequelize[_0xe4f4('0x2')],'comment':_0xe4f4('0x5')},'routeId':{'type':Sequelize[_0xe4f4('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe4f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8cd475a..5154a44 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 _0x1e5f=['filters','intersection','fields','attributes','length','sort','where','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','keys','rawAttributes','merge','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','query'];(function(_0x2e7e14,_0x3fba18){var _0x302e96=function(_0x57fed7){while(--_0x57fed7){_0x2e7e14['push'](_0x2e7e14['shift']());}};_0x302e96(++_0x3fba18);}(_0x1e5f,0xae));var _0xf1e5=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x1e5f[_0x265e0e];return _0x518157;};'use strict';var pdf=require(_0xf1e5('0x0'));var emlformat=require(_0xf1e5('0x1'));var rimraf=require(_0xf1e5('0x2'));var zipdir=require(_0xf1e5('0x3'));var jsonpatch=require(_0xf1e5('0x4'));var rp=require(_0xf1e5('0x5'));var moment=require(_0xf1e5('0x6'));var BPromise=require(_0xf1e5('0x7'));var Mustache=require(_0xf1e5('0x8'));var util=require('util');var path=require(_0xf1e5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1e5('0xa'));var fs=require('fs');var _=require(_0xf1e5('0xb'));var squel=require(_0xf1e5('0xc'));var crypto=require(_0xf1e5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf1e5('0xe'));var toCsv=require(_0xf1e5('0xf'));var querystring=require(_0xf1e5('0x10'));var Papa=require(_0xf1e5('0x11'));var Redis=require(_0xf1e5('0x12'));var authService=require(_0xf1e5('0x13'));var qs=require(_0xf1e5('0x14'));var as=require(_0xf1e5('0x15'));var hardwareService=require(_0xf1e5('0x16'));var logger=require(_0xf1e5('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf1e5('0x18'));var db=require(_0xf1e5('0x19'))['db'];function respondWithStatusCode(_0x278001,_0xba064){_0xba064=_0xba064||0xcc;return function(_0x337de7){if(_0x337de7){return _0x278001[_0xf1e5('0x1a')](_0xba064);}return _0x278001['status'](_0xba064)[_0xf1e5('0x1b')]();};}function respondWithResult(_0x2d0a9b,_0x26c793){_0x26c793=_0x26c793||0xc8;return function(_0x36cae2){if(_0x36cae2){return _0x2d0a9b[_0xf1e5('0x1c')](_0x26c793)['json'](_0x36cae2);}};}function respondWithFilteredResult(_0x416871,_0x28823){return function(_0x48b461){if(_0x48b461){var _0x403868=_0x48b461['count'],_0x21df31=_0x28823[_0xf1e5('0x1d')],_0x199bf2=_0x28823[_0xf1e5('0x1d')]+_0x28823[_0xf1e5('0x1e')],_0x3aa17d;if(_0x199bf2>=_0x403868){_0x199bf2=_0x403868;_0x3aa17d=0xc8;}else{_0x3aa17d=0xce;}_0x416871['status'](_0x3aa17d);return _0x416871[_0xf1e5('0x1f')](_0xf1e5('0x20'),_0x21df31+'-'+_0x199bf2+'/'+_0x403868)[_0xf1e5('0x21')](_0x48b461);}return null;};}function patchUpdates(_0x1450ba){return function(_0xedb8d9){try{jsonpatch[_0xf1e5('0x22')](_0xedb8d9,_0x1450ba,!![]);}catch(_0x44ef03){return BPromise[_0xf1e5('0x23')](_0x44ef03);}return _0xedb8d9[_0xf1e5('0x24')]();};}function saveUpdates(_0x383dbb,_0x153adc){return function(_0x58d777){if(_0x58d777){return _0x58d777[_0xf1e5('0x25')](_0x383dbb)[_0xf1e5('0x26')](function(_0x4abc40){return _0x4abc40;});}return null;};}function removeEntity(_0x5b5b3a,_0x202020){return function(_0x1a56f2){if(_0x1a56f2){return _0x1a56f2[_0xf1e5('0x27')]()[_0xf1e5('0x26')](function(){_0x5b5b3a[_0xf1e5('0x1c')](0xcc)[_0xf1e5('0x1b')]();});}};}function handleEntityNotFound(_0x3c4bba,_0x1d5d0d){return function(_0x15c332){if(!_0x15c332){_0x3c4bba[_0xf1e5('0x1a')](0x194);}return _0x15c332;};}function handleError(_0x18e67d,_0x3ea738){_0x3ea738=_0x3ea738||0x1f4;return function(_0x3af0d5){logger[_0xf1e5('0x28')](_0x3af0d5[_0xf1e5('0x29')]);if(_0x3af0d5['name']){delete _0x3af0d5[_0xf1e5('0x2a')];}_0x18e67d[_0xf1e5('0x1c')](_0x3ea738)[_0xf1e5('0x2b')](_0x3af0d5);};}exports[_0xf1e5('0x2c')]=function(_0x3d922d,_0x26f458){var _0x5f13a7={},_0x283483={},_0x58dcf1={'count':0x0,'rows':[]};var _0x565e1c=_[_0xf1e5('0x2d')](db[_0xf1e5('0x2e')]['rawAttributes'],function(_0x36ea06){return{'name':_0x36ea06[_0xf1e5('0x2f')],'type':_0x36ea06[_0xf1e5('0x30')]['key']};});_0x283483[_0xf1e5('0x31')]=_[_0xf1e5('0x2d')](_0x565e1c,_0xf1e5('0x2a'));_0x283483[_0xf1e5('0x32')]=_['keys'](_0x3d922d[_0xf1e5('0x32')]);_0x283483[_0xf1e5('0x33')]=_['intersection'](_0x283483['model'],_0x283483[_0xf1e5('0x32')]);_0x5f13a7['attributes']=_[_0xf1e5('0x34')](_0x283483['model'],qs[_0xf1e5('0x35')](_0x3d922d[_0xf1e5('0x32')]['fields']));_0x5f13a7[_0xf1e5('0x36')]=_0x5f13a7[_0xf1e5('0x36')][_0xf1e5('0x37')]?_0x5f13a7['attributes']:_0x283483[_0xf1e5('0x31')];if(!_0x3d922d[_0xf1e5('0x32')]['hasOwnProperty']('nolimit')){_0x5f13a7['limit']=qs[_0xf1e5('0x1e')](_0x3d922d[_0xf1e5('0x32')][_0xf1e5('0x1e')]);_0x5f13a7[_0xf1e5('0x1d')]=qs[_0xf1e5('0x1d')](_0x3d922d['query'][_0xf1e5('0x1d')]);}_0x5f13a7['order']=qs[_0xf1e5('0x38')](_0x3d922d[_0xf1e5('0x32')]['sort']);_0x5f13a7['where']=qs[_0xf1e5('0x33')](_['pick'](_0x3d922d[_0xf1e5('0x32')],_0x283483[_0xf1e5('0x33')]),_0x565e1c);if(_0x3d922d[_0xf1e5('0x32')]['filter']){_0x5f13a7['where']=_['merge'](_0x5f13a7[_0xf1e5('0x39')],{'$or':_[_0xf1e5('0x2d')](_0x565e1c,function(_0x24c429){if(_0x24c429[_0xf1e5('0x30')]!==_0xf1e5('0x3a')){var _0x45d591={};_0x45d591[_0x24c429[_0xf1e5('0x2a')]]={'$like':'%'+_0x3d922d[_0xf1e5('0x32')][_0xf1e5('0x3b')]+'%'};return _0x45d591;}})});}_0x5f13a7=_['merge']({},_0x5f13a7,_0x3d922d['options']);var _0x9d28d8={'where':_0x5f13a7[_0xf1e5('0x39')]};return db[_0xf1e5('0x2e')][_0xf1e5('0x3c')](_0x9d28d8)[_0xf1e5('0x26')](function(_0x47e8c5){_0x58dcf1['count']=_0x47e8c5;if(_0x3d922d[_0xf1e5('0x32')][_0xf1e5('0x3d')]){_0x5f13a7[_0xf1e5('0x3e')]=[{'all':!![]}];}return db[_0xf1e5('0x2e')][_0xf1e5('0x3f')](_0x5f13a7);})['then'](function(_0x69dbc6){_0x58dcf1['rows']=_0x69dbc6;return _0x58dcf1;})[_0xf1e5('0x26')](respondWithFilteredResult(_0x26f458,_0x5f13a7))[_0xf1e5('0x40')](handleError(_0x26f458,null));};exports[_0xf1e5('0x41')]=function(_0x244354,_0x25e339){var _0x663e22={'raw':!![],'where':{'id':_0x244354[_0xf1e5('0x42')]['id']}},_0x45fb23={};_0x45fb23['model']=_[_0xf1e5('0x43')](db['VoiceDialReport'][_0xf1e5('0x44')]);_0x45fb23['query']=_[_0xf1e5('0x43')](_0x244354[_0xf1e5('0x32')]);_0x45fb23[_0xf1e5('0x33')]=_[_0xf1e5('0x34')](_0x45fb23[_0xf1e5('0x31')],_0x45fb23[_0xf1e5('0x32')]);_0x663e22['attributes']=_['intersection'](_0x45fb23[_0xf1e5('0x31')],qs[_0xf1e5('0x35')](_0x244354[_0xf1e5('0x32')][_0xf1e5('0x35')]));_0x663e22['attributes']=_0x663e22[_0xf1e5('0x36')][_0xf1e5('0x37')]?_0x663e22[_0xf1e5('0x36')]:_0x45fb23[_0xf1e5('0x31')];if(_0x244354[_0xf1e5('0x32')][_0xf1e5('0x3d')]){_0x663e22[_0xf1e5('0x3e')]=[{'all':!![]}];}_0x663e22=_[_0xf1e5('0x45')]({},_0x663e22,_0x244354[_0xf1e5('0x46')]);return db[_0xf1e5('0x2e')][_0xf1e5('0x47')](_0x663e22)[_0xf1e5('0x26')](handleEntityNotFound(_0x25e339,null))[_0xf1e5('0x26')](respondWithResult(_0x25e339,null))[_0xf1e5('0x40')](handleError(_0x25e339,null));};exports[_0xf1e5('0x48')]=function(_0x2f558d,_0x89dfbd){return db[_0xf1e5('0x2e')][_0xf1e5('0x48')](_0x2f558d[_0xf1e5('0x49')],{})[_0xf1e5('0x26')](respondWithResult(_0x89dfbd,0xc9))['catch'](handleError(_0x89dfbd,null));};exports[_0xf1e5('0x25')]=function(_0x1e82d0,_0x3eb601){if(_0x1e82d0[_0xf1e5('0x49')]['id']){delete _0x1e82d0[_0xf1e5('0x49')]['id'];}return db['VoiceDialReport'][_0xf1e5('0x47')]({'where':{'id':_0x1e82d0[_0xf1e5('0x42')]['id']}})[_0xf1e5('0x26')](handleEntityNotFound(_0x3eb601,null))[_0xf1e5('0x26')](saveUpdates(_0x1e82d0[_0xf1e5('0x49')],null))[_0xf1e5('0x26')](respondWithResult(_0x3eb601,null))['catch'](handleError(_0x3eb601,null));};exports[_0xf1e5('0x27')]=function(_0x32c151,_0x154cc8){return db[_0xf1e5('0x2e')][_0xf1e5('0x47')]({'where':{'id':_0x32c151[_0xf1e5('0x42')]['id']}})['then'](handleEntityNotFound(_0x154cc8,null))[_0xf1e5('0x26')](removeEntity(_0x154cc8,null))[_0xf1e5('0x40')](handleError(_0x154cc8,null));};exports[_0xf1e5('0x4a')]=function(_0x4ea2d9,_0x3c9021){return db[_0xf1e5('0x2e')][_0xf1e5('0x4a')]()[_0xf1e5('0x26')](respondWithResult(_0x3c9021,null))[_0xf1e5('0x40')](handleError(_0x3c9021,null));}; \ No newline at end of file +var _0xe3e0=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','count','offset','limit','status','set','json','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','catch','params','length','include','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis'];(function(_0x18474f,_0x51e0f9){var _0xab5297=function(_0x4b2327){while(--_0x4b2327){_0x18474f['push'](_0x18474f['shift']());}};_0xab5297(++_0x51e0f9);}(_0xe3e0,0x188));var _0x0e3e=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xe3e0[_0x4fdcc0];return _0xc0ce94;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e3e('0x0'));var rimraf=require(_0x0e3e('0x1'));var zipdir=require(_0x0e3e('0x2'));var jsonpatch=require(_0x0e3e('0x3'));var rp=require('request-promise');var moment=require(_0x0e3e('0x4'));var BPromise=require(_0x0e3e('0x5'));var Mustache=require(_0x0e3e('0x6'));var util=require(_0x0e3e('0x7'));var path=require(_0x0e3e('0x8'));var sox=require(_0x0e3e('0x9'));var csv=require('to-csv');var ejs=require(_0x0e3e('0xa'));var fs=require('fs');var _=require(_0x0e3e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e3e('0xc'));var deskjs=require(_0x0e3e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0e3e('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e3e('0xf'));var authService=require(_0x0e3e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0e3e('0x11'));var hardwareService=require(_0x0e3e('0x12'));var logger=require(_0x0e3e('0x13'))('api');var utils=require(_0x0e3e('0x14'));var config=require(_0x0e3e('0x15'));var db=require(_0x0e3e('0x16'))['db'];function respondWithStatusCode(_0x33a438,_0x4ac6c1){_0x4ac6c1=_0x4ac6c1||0xcc;return function(_0x7d688c){if(_0x7d688c){return _0x33a438['sendStatus'](_0x4ac6c1);}return _0x33a438['status'](_0x4ac6c1)['end']();};}function respondWithResult(_0x41e8e7,_0x3bbdae){_0x3bbdae=_0x3bbdae||0xc8;return function(_0x4840aa){if(_0x4840aa){return _0x41e8e7['status'](_0x3bbdae)['json'](_0x4840aa);}};}function respondWithFilteredResult(_0x1f3314,_0x1ebf08){return function(_0x107f06){if(_0x107f06){var _0x4f47f2=_0x107f06[_0x0e3e('0x17')],_0x10b14d=_0x1ebf08[_0x0e3e('0x18')],_0x2373c3=_0x1ebf08[_0x0e3e('0x18')]+_0x1ebf08[_0x0e3e('0x19')],_0xe4a7ce;if(_0x2373c3>=_0x4f47f2){_0x2373c3=_0x4f47f2;_0xe4a7ce=0xc8;}else{_0xe4a7ce=0xce;}_0x1f3314[_0x0e3e('0x1a')](_0xe4a7ce);return _0x1f3314[_0x0e3e('0x1b')]('Content-Range',_0x10b14d+'-'+_0x2373c3+'/'+_0x4f47f2)[_0x0e3e('0x1c')](_0x107f06);}return null;};}function patchUpdates(_0x2d9e1f){return function(_0x1765ed){try{jsonpatch['apply'](_0x1765ed,_0x2d9e1f,!![]);}catch(_0x5751ac){return BPromise[_0x0e3e('0x1d')](_0x5751ac);}return _0x1765ed[_0x0e3e('0x1e')]();};}function saveUpdates(_0x481fbd,_0x3971d0){return function(_0x58fab9){if(_0x58fab9){return _0x58fab9['update'](_0x481fbd)[_0x0e3e('0x1f')](function(_0x20fa76){return _0x20fa76;});}return null;};}function removeEntity(_0x378b6d,_0x5a00c5){return function(_0x5a9a15){if(_0x5a9a15){return _0x5a9a15[_0x0e3e('0x20')]()['then'](function(){_0x378b6d[_0x0e3e('0x1a')](0xcc)[_0x0e3e('0x21')]();});}};}function handleEntityNotFound(_0x1ffbc3,_0x24f838){return function(_0x52515){if(!_0x52515){_0x1ffbc3['sendStatus'](0x194);}return _0x52515;};}function handleError(_0xa25f05,_0x58da3b){_0x58da3b=_0x58da3b||0x1f4;return function(_0x118344){logger['error'](_0x118344[_0x0e3e('0x22')]);if(_0x118344['name']){delete _0x118344[_0x0e3e('0x23')];}_0xa25f05[_0x0e3e('0x1a')](_0x58da3b)[_0x0e3e('0x24')](_0x118344);};}exports[_0x0e3e('0x25')]=function(_0x3ce220,_0x49604f){var _0x122a8a={},_0x5412bb={},_0x52985f={'count':0x0,'rows':[]};var _0x1cda18=_[_0x0e3e('0x26')](db['VoiceDialReport'][_0x0e3e('0x27')],function(_0xdc5b8a){return{'name':_0xdc5b8a[_0x0e3e('0x28')],'type':_0xdc5b8a['type'][_0x0e3e('0x29')]};});_0x5412bb[_0x0e3e('0x2a')]=_[_0x0e3e('0x26')](_0x1cda18,_0x0e3e('0x23'));_0x5412bb[_0x0e3e('0x2b')]=_[_0x0e3e('0x2c')](_0x3ce220[_0x0e3e('0x2b')]);_0x5412bb[_0x0e3e('0x2d')]=_[_0x0e3e('0x2e')](_0x5412bb['model'],_0x5412bb['query']);_0x122a8a[_0x0e3e('0x2f')]=_[_0x0e3e('0x2e')](_0x5412bb[_0x0e3e('0x2a')],qs[_0x0e3e('0x30')](_0x3ce220[_0x0e3e('0x2b')]['fields']));_0x122a8a[_0x0e3e('0x2f')]=_0x122a8a[_0x0e3e('0x2f')]['length']?_0x122a8a[_0x0e3e('0x2f')]:_0x5412bb[_0x0e3e('0x2a')];if(!_0x3ce220[_0x0e3e('0x2b')][_0x0e3e('0x31')](_0x0e3e('0x32'))){_0x122a8a['limit']=qs['limit'](_0x3ce220['query']['limit']);_0x122a8a['offset']=qs[_0x0e3e('0x18')](_0x3ce220['query']['offset']);}_0x122a8a[_0x0e3e('0x33')]=qs[_0x0e3e('0x34')](_0x3ce220[_0x0e3e('0x2b')][_0x0e3e('0x34')]);_0x122a8a[_0x0e3e('0x35')]=qs[_0x0e3e('0x2d')](_['pick'](_0x3ce220['query'],_0x5412bb[_0x0e3e('0x2d')]),_0x1cda18);if(_0x3ce220['query'][_0x0e3e('0x36')]){_0x122a8a[_0x0e3e('0x35')]=_[_0x0e3e('0x37')](_0x122a8a[_0x0e3e('0x35')],{'$or':_['map'](_0x1cda18,function(_0x358a49){if(_0x358a49['type']!==_0x0e3e('0x38')){var _0x3d1104={};_0x3d1104[_0x358a49['name']]={'$like':'%'+_0x3ce220[_0x0e3e('0x2b')][_0x0e3e('0x36')]+'%'};return _0x3d1104;}})});}_0x122a8a=_[_0x0e3e('0x37')]({},_0x122a8a,_0x3ce220[_0x0e3e('0x39')]);var _0xb098b5={'where':_0x122a8a[_0x0e3e('0x35')]};return db[_0x0e3e('0x3a')][_0x0e3e('0x17')](_0xb098b5)[_0x0e3e('0x1f')](function(_0xe1d9a5){_0x52985f[_0x0e3e('0x17')]=_0xe1d9a5;if(_0x3ce220[_0x0e3e('0x2b')][_0x0e3e('0x3b')]){_0x122a8a['include']=[{'all':!![]}];}return db[_0x0e3e('0x3a')]['findAll'](_0x122a8a);})['then'](function(_0xbc77e2){_0x52985f['rows']=_0xbc77e2;return _0x52985f;})[_0x0e3e('0x1f')](respondWithFilteredResult(_0x49604f,_0x122a8a))[_0x0e3e('0x3c')](handleError(_0x49604f,null));};exports['show']=function(_0x5ca57c,_0x2f9b0a){var _0x44187f={'raw':!![],'where':{'id':_0x5ca57c[_0x0e3e('0x3d')]['id']}},_0x19c245={};_0x19c245[_0x0e3e('0x2a')]=_[_0x0e3e('0x2c')](db[_0x0e3e('0x3a')][_0x0e3e('0x27')]);_0x19c245[_0x0e3e('0x2b')]=_[_0x0e3e('0x2c')](_0x5ca57c['query']);_0x19c245[_0x0e3e('0x2d')]=_[_0x0e3e('0x2e')](_0x19c245['model'],_0x19c245[_0x0e3e('0x2b')]);_0x44187f['attributes']=_[_0x0e3e('0x2e')](_0x19c245[_0x0e3e('0x2a')],qs[_0x0e3e('0x30')](_0x5ca57c[_0x0e3e('0x2b')][_0x0e3e('0x30')]));_0x44187f[_0x0e3e('0x2f')]=_0x44187f[_0x0e3e('0x2f')][_0x0e3e('0x3e')]?_0x44187f['attributes']:_0x19c245[_0x0e3e('0x2a')];if(_0x5ca57c[_0x0e3e('0x2b')]['includeAll']){_0x44187f[_0x0e3e('0x3f')]=[{'all':!![]}];}_0x44187f=_[_0x0e3e('0x37')]({},_0x44187f,_0x5ca57c[_0x0e3e('0x39')]);return db[_0x0e3e('0x3a')]['find'](_0x44187f)[_0x0e3e('0x1f')](handleEntityNotFound(_0x2f9b0a,null))[_0x0e3e('0x1f')](respondWithResult(_0x2f9b0a,null))['catch'](handleError(_0x2f9b0a,null));};exports[_0x0e3e('0x40')]=function(_0x36e3b0,_0x1f3b9f){return db[_0x0e3e('0x3a')]['create'](_0x36e3b0[_0x0e3e('0x41')],{})[_0x0e3e('0x1f')](respondWithResult(_0x1f3b9f,0xc9))['catch'](handleError(_0x1f3b9f,null));};exports[_0x0e3e('0x42')]=function(_0x14f531,_0x29b4a1){if(_0x14f531[_0x0e3e('0x41')]['id']){delete _0x14f531[_0x0e3e('0x41')]['id'];}return db[_0x0e3e('0x3a')]['find']({'where':{'id':_0x14f531['params']['id']}})[_0x0e3e('0x1f')](handleEntityNotFound(_0x29b4a1,null))['then'](saveUpdates(_0x14f531[_0x0e3e('0x41')],null))[_0x0e3e('0x1f')](respondWithResult(_0x29b4a1,null))[_0x0e3e('0x3c')](handleError(_0x29b4a1,null));};exports['destroy']=function(_0x4c52a2,_0x91e417){return db[_0x0e3e('0x3a')]['find']({'where':{'id':_0x4c52a2[_0x0e3e('0x3d')]['id']}})[_0x0e3e('0x1f')](handleEntityNotFound(_0x91e417,null))['then'](removeEntity(_0x91e417,null))[_0x0e3e('0x3c')](handleError(_0x91e417,null));};exports[_0x0e3e('0x43')]=function(_0x231f05,_0x6f56df){return db[_0x0e3e('0x3a')][_0x0e3e('0x43')]()[_0x0e3e('0x1f')](respondWithResult(_0x6f56df,null))[_0x0e3e('0x3c')](handleError(_0x6f56df,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 11c4e14..2653f20 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 _0x3a44=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid'];(function(_0x476f52,_0x23822c){var _0x25d16d=function(_0xeb22d4){while(--_0xeb22d4){_0x476f52['push'](_0x476f52['shift']());}};_0x25d16d(++_0x23822c);}(_0x3a44,0xa8));var _0x43a4=function(_0xf6d509,_0x5bec48){_0xf6d509=_0xf6d509-0x0;var _0x6f8f45=_0x3a44[_0xf6d509];return _0x6f8f45;};'use strict';var _=require(_0x43a4('0x0'));var util=require('util');var logger=require(_0x43a4('0x1'))('api');var moment=require(_0x43a4('0x2'));var BPromise=require(_0x43a4('0x3'));var rp=require(_0x43a4('0x4'));var fs=require('fs');var path=require(_0x43a4('0x5'));var rimraf=require(_0x43a4('0x6'));var config=require(_0x43a4('0x7'));var attributes=require(_0x43a4('0x8'));module['exports']=function(_0x1a77ad,_0x4dca43){return _0x1a77ad[_0x43a4('0x9')](_0x43a4('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x43a4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a08=['util','moment','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x1a08,0xdb));var _0x81a0=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x1a08[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x81a0('0x2'));var BPromise=require(_0x81a0('0x3'));var rp=require(_0x81a0('0x4'));var fs=require('fs');var path=require(_0x81a0('0x5'));var rimraf=require('rimraf');var config=require(_0x81a0('0x6'));var attributes=require(_0x81a0('0x7'));module[_0x81a0('0x8')]=function(_0x249a24,_0x1a9aa9){return _0x249a24[_0x81a0('0x9')]('VoiceDialReport',attributes,{'tableName':_0x81a0('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 41e807f..0ef48b9 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 _0xc1c4=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','attributes','limit','debug'];(function(_0x51ab82,_0x5a46f1){var _0x4e6918=function(_0x10cc3f){while(--_0x10cc3f){_0x51ab82['push'](_0x51ab82['shift']());}};_0x4e6918(++_0x5a46f1);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x25689f,_0x37a6fb){_0x25689f=_0x25689f-0x0;var _0x364094=_0xc1c4[_0x25689f];return _0x364094;};'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']('VoiceDialReport,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x486065(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);}logger[_0x4c1c('0x13')]('VoiceDialReport,\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')](_0x5a9217[_0x4c1c('0x1b')],{'raw':_0x5a9217[_0x4c1c('0x1c')]?_0x5a9217[_0x4c1c('0x1c')][_0x4c1c('0x1d')]===undefined?!![]:![]:!![]})[_0x4c1c('0xd')](function(_0x58aca9){logger['info'](_0x4c1c('0x18'),_0x5a9217);logger['debug'](_0x4c1c('0x18'),_0x5a9217,JSON[_0x4c1c('0x12')](_0x58aca9));_0x213019(_0x58aca9);})['catch'](function(_0x23377c){logger['error']('CreateVoiceDialReport',_0x23377c[_0x4c1c('0x15')],_0x5a9217);_0x64fe4b(_0x1fad89[_0x4c1c('0x13')](0x1f4,_0x23377c[_0x4c1c('0x15')]));});});};exports[_0x4c1c('0x1e')]=function(_0x3117d2){var _0x5cb64e=this;return new Promise(function(_0x1b533b,_0x1e07d1){return db[_0x4c1c('0x19')][_0x4c1c('0x1f')](_0x3117d2[_0x4c1c('0x1b')],{'raw':_0x3117d2['options']?_0x3117d2['options'][_0x4c1c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3117d2['options']?_0x3117d2[_0x4c1c('0x1c')]['where']||null:null,'attributes':_0x3117d2[_0x4c1c('0x1c')]?_0x3117d2[_0x4c1c('0x1c')][_0x4c1c('0x20')]||null:null,'limit':_0x3117d2['options']?_0x3117d2[_0x4c1c('0x1c')][_0x4c1c('0x21')]||null:null})[_0x4c1c('0xd')](function(_0xb1e9b5){logger[_0x4c1c('0xe')](_0x4c1c('0x1e'),_0x3117d2);logger[_0x4c1c('0x22')](_0x4c1c('0x1e'),_0x3117d2,JSON['stringify'](_0xb1e9b5));_0x1b533b(_0xb1e9b5);})['catch'](function(_0x47bb26){logger['error']('UpdateVoiceDialReport',_0x47bb26[_0x4c1c('0x15')],_0x3117d2);_0x1e07d1(_0x5cb64e[_0x4c1c('0x13')](0x1f4,_0x47bb26['message']));});});}; \ No newline at end of file +var _0xb04a=['error','message','result','catch','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','where','attributes','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5aac88,_0x1d4efe){var _0x5dbd3c=function(_0x53aca1){while(--_0x53aca1){_0x5aac88['push'](_0x5aac88['shift']());}};_0x5dbd3c(++_0x1d4efe);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require(_0xab04('0x1'));var moment=require(_0xab04('0x2'));var BPromise=require(_0xab04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab04('0x4'));var db=require(_0xab04('0x5'))['db'];var utils=require(_0xab04('0x6'));var logger=require('../../config/logger')(_0xab04('0x7'));var config=require(_0xab04('0x8'));var jayson=require(_0xab04('0x9'));var client=jayson['client'][_0xab04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d9b2,_0x598d0f,_0x53a969){return new BPromise(function(_0x4d47f5,_0xb75c20){return client['request'](_0x46d9b2,_0x53a969)['then'](function(_0x4b7ecc){logger[_0xab04('0xb')](_0xab04('0xc'),_0x598d0f,_0xab04('0xd'));logger[_0xab04('0xe')](_0xab04('0xf'),_0x598d0f,_0xab04('0xd'),JSON[_0xab04('0x10')](_0x4b7ecc));if(_0x4b7ecc[_0xab04('0x11')]){if(_0x4b7ecc[_0xab04('0x11')]['code']===0x1f4){logger['error'](_0xab04('0xc'),_0x598d0f,_0x4b7ecc[_0xab04('0x11')][_0xab04('0x12')]);return _0xb75c20(_0x4b7ecc[_0xab04('0x11')]['message']);}logger[_0xab04('0x11')](_0xab04('0xc'),_0x598d0f,_0x4b7ecc['error'][_0xab04('0x12')]);return _0x4d47f5(_0x4b7ecc[_0xab04('0x11')][_0xab04('0x12')]);}else{logger[_0xab04('0xb')](_0xab04('0xc'),_0x598d0f,'request\x20sent');_0x4d47f5(_0x4b7ecc[_0xab04('0x13')][_0xab04('0x12')]);}})[_0xab04('0x14')](function(_0x25c42e){logger[_0xab04('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x598d0f,_0x25c42e);_0xb75c20(_0x25c42e);});});}exports['CreateVoiceDialReport']=function(_0x371c30){var _0x278c93=this;return new Promise(function(_0x2c0b39,_0x4eb15e){return db['VoiceDialReport'][_0xab04('0x15')](_0x371c30[_0xab04('0x16')],{'raw':_0x371c30[_0xab04('0x17')]?_0x371c30['options'][_0xab04('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x395c6b){logger[_0xab04('0xb')]('CreateVoiceDialReport',_0x371c30);logger['debug'](_0xab04('0x19'),_0x371c30,JSON[_0xab04('0x10')](_0x395c6b));_0x2c0b39(_0x395c6b);})['catch'](function(_0x3f0d72){logger[_0xab04('0x11')](_0xab04('0x19'),_0x3f0d72[_0xab04('0x12')],_0x371c30);_0x4eb15e(_0x278c93[_0xab04('0x11')](0x1f4,_0x3f0d72['message']));});});};exports[_0xab04('0x1a')]=function(_0x4df287){var _0x1fced6=this;return new Promise(function(_0x11a7d1,_0x561525){return db[_0xab04('0x1b')]['update'](_0x4df287['body'],{'raw':_0x4df287['options']?_0x4df287[_0xab04('0x17')][_0xab04('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4df287[_0xab04('0x17')]?_0x4df287[_0xab04('0x17')][_0xab04('0x1c')]||null:null,'attributes':_0x4df287['options']?_0x4df287['options'][_0xab04('0x1d')]||null:null,'limit':_0x4df287['options']?_0x4df287[_0xab04('0x17')][_0xab04('0x1e')]||null:null})[_0xab04('0x1f')](function(_0x2fb6e4){logger[_0xab04('0xb')](_0xab04('0x1a'),_0x4df287);logger['debug'](_0xab04('0x1a'),_0x4df287,JSON[_0xab04('0x10')](_0x2fb6e4));_0x11a7d1(_0x2fb6e4);})['catch'](function(_0x33ce1e){logger[_0xab04('0x11')](_0xab04('0x1a'),_0x33ce1e[_0xab04('0x12')],_0x4df287);_0x561525(_0x1fced6[_0xab04('0x11')](0x1f4,_0x33ce1e[_0xab04('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 87e6953..725e9c4 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 _0xf751=['index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get'];(function(_0x4b7987,_0x2b867b){var _0x585c85=function(_0x2b0717){while(--_0x2b0717){_0x4b7987['push'](_0x4b7987['shift']());}};_0x585c85(++_0x2b867b);}(_0xf751,0x132));var _0x1f75=function(_0xd21e3,_0x1ab046){_0xd21e3=_0xd21e3-0x0;var _0x23d3dd=_0xf751[_0xd21e3];return _0x23d3dd;};'use strict';var multer=require(_0x1f75('0x0'));var util=require(_0x1f75('0x1'));var path=require(_0x1f75('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f75('0x3'));var router=express[_0x1f75('0x4')]();var auth=require(_0x1f75('0x5'));var interaction=require(_0x1f75('0x6'));var config=require('../../config/environment');var controller=require(_0x1f75('0x7'));router[_0x1f75('0x8')]('/',auth['isAuthenticated'](),controller[_0x1f75('0x9')]);router[_0x1f75('0x8')](_0x1f75('0xa'),auth[_0x1f75('0xb')](),controller[_0x1f75('0xc')]);router[_0x1f75('0xd')]('/',auth[_0x1f75('0xb')](),controller[_0x1f75('0xe')]);router[_0x1f75('0xd')]('/:id/applications',auth[_0x1f75('0xb')](),controller[_0x1f75('0xf')]);router[_0x1f75('0x10')](_0x1f75('0xa'),auth[_0x1f75('0xb')](),controller[_0x1f75('0x11')]);router[_0x1f75('0x12')](_0x1f75('0xa'),auth['isAuthenticated'](),controller[_0x1f75('0x13')]);module[_0x1f75('0x14')]=router; \ No newline at end of file +var _0x72bc=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','show','post','create','/:id/applications','addApplications','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x10c062,_0x31bcd0){var _0x1a6dd6=function(_0x3652d7){while(--_0x3652d7){_0x10c062['push'](_0x10c062['shift']());}};_0x1a6dd6(++_0x31bcd0);}(_0x72bc,0x1d6));var _0xc72b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x72bc[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0xc72b('0x0'));var path=require(_0xc72b('0x1'));var timeout=require(_0xc72b('0x2'));var express=require('express');var router=express[_0xc72b('0x3')]();var auth=require(_0xc72b('0x4'));var interaction=require(_0xc72b('0x5'));var config=require(_0xc72b('0x6'));var controller=require(_0xc72b('0x7'));router[_0xc72b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc72b('0x9')]);router[_0xc72b('0x8')]('/:id',auth[_0xc72b('0xa')](),controller[_0xc72b('0xb')]);router[_0xc72b('0xc')]('/',auth['isAuthenticated'](),controller[_0xc72b('0xd')]);router[_0xc72b('0xc')](_0xc72b('0xe'),auth['isAuthenticated'](),controller[_0xc72b('0xf')]);router['put'](_0xc72b('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xc72b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc72b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a69b436..14778ef 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(_0x21ff39,_0x126f14){var _0x1fea2a=function(_0xf05676){while(--_0xf05676){_0x21ff39['push'](_0x21ff39['shift']());}};_0x1fea2a(++_0x126f14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x3374fd,_0x59a9bc){var _0xb10792=function(_0x51eb9d){while(--_0x51eb9d){_0x3374fd['push'](_0x3374fd['shift']());}};_0xb10792(++_0x59a9bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 8836136..0d72bae 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f0e=['InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','VoiceExtension','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','get','InboundRoutes','OutboundRoutes','outbound'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x9f0e,0x116));var _0xe9f0=function(_0x42c1f8,_0x4dd01a){_0x42c1f8=_0x42c1f8-0x0;var _0x17e091=_0x9f0e[_0x42c1f8];return _0x17e091;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var as=require(_0xe9f0('0x14'));var hardwareService=require(_0xe9f0('0x15'));var logger=require('../../config/logger')(_0xe9f0('0x16'));var utils=require(_0xe9f0('0x17'));var config=require(_0xe9f0('0x18'));var db=require('../../mysqldb')['db'];config[_0xe9f0('0x19')]=_['defaults'](config[_0xe9f0('0x19')],{'host':_0xe9f0('0x1a'),'port':0x18eb});var socket=require(_0xe9f0('0x1b'))(new Redis(config[_0xe9f0('0x19')]));require('./voiceExtension.socket')[_0xe9f0('0x1c')](socket);function respondWithStatusCode(_0x5a10c6,_0x1e3ba8){_0x1e3ba8=_0x1e3ba8||0xcc;return function(_0x23914b){if(_0x23914b){return _0x5a10c6[_0xe9f0('0x1d')](_0x1e3ba8);}return _0x5a10c6['status'](_0x1e3ba8)[_0xe9f0('0x1e')]();};}function respondWithResult(_0x33e9e4,_0x2e68ef){_0x2e68ef=_0x2e68ef||0xc8;return function(_0x598eee){if(_0x598eee){return _0x33e9e4[_0xe9f0('0x1f')](_0x2e68ef)[_0xe9f0('0x20')](_0x598eee);}};}function respondWithFilteredResult(_0xcd2042,_0xd71ac8){return function(_0x3ed69a){if(_0x3ed69a){var _0x2ab12b=_0x3ed69a[_0xe9f0('0x21')],_0x3da237=_0xd71ac8[_0xe9f0('0x22')],_0x59bf5a=_0xd71ac8['offset']+_0xd71ac8[_0xe9f0('0x23')],_0x15a33b;if(_0x59bf5a>=_0x2ab12b){_0x59bf5a=_0x2ab12b;_0x15a33b=0xc8;}else{_0x15a33b=0xce;}_0xcd2042[_0xe9f0('0x1f')](_0x15a33b);return _0xcd2042[_0xe9f0('0x24')](_0xe9f0('0x25'),_0x3da237+'-'+_0x59bf5a+'/'+_0x2ab12b)['json'](_0x3ed69a);}return null;};}function patchUpdates(_0x33f143){return function(_0xfaa312){try{jsonpatch['apply'](_0xfaa312,_0x33f143,!![]);}catch(_0x51e03f){return BPromise['reject'](_0x51e03f);}return _0xfaa312[_0xe9f0('0x26')]();};}function saveUpdates(_0xa1ddc,_0x1211ae){return function(_0x316cdf){if(_0x316cdf){return _0x316cdf[_0xe9f0('0x27')](_0xa1ddc)['then'](function(_0x229fe0){return _0x229fe0;});}return null;};}function removeEntity(_0x38b7ee,_0x437d43){return function(_0x10801b){if(_0x10801b){return _0x10801b[_0xe9f0('0x28')]()[_0xe9f0('0x29')](function(){var _0x37c0fc=_0x10801b[_0xe9f0('0x2a')]({'plain':!![]});var _0x3c4ba9=[{'name':_0xe9f0('0x2b'),'value':'inbound','ignore':![]},{'name':_0xe9f0('0x2c'),'value':_0xe9f0('0x2d'),'ignore':![]},{'name':_0xe9f0('0x2e'),'value':_0xe9f0('0x2f'),'ignore':![]}];var _0x4cf1b1=_(_0x3c4ba9)[_0xe9f0('0x30')](_0xe9f0('0x31'))[_0xe9f0('0x32')](_0xe9f0('0x33'))[_0xe9f0('0x33')]();if(_['includes'](_0x4cf1b1,_0x37c0fc[_0xe9f0('0x34')])){return;}var _0xdc16bc=_[_0xe9f0('0x35')](_0x3c4ba9,[_0xe9f0('0x33'),_0x37c0fc[_0xe9f0('0x34')]])[_0xe9f0('0x36')];return db[_0xe9f0('0x37')][_0xe9f0('0x28')]({'where':{'type':_0xdc16bc,'resourceId':_0x37c0fc['id']}})[_0xe9f0('0x29')](function(){return _0x10801b;});})[_0xe9f0('0x29')](function(){_0x38b7ee[_0xe9f0('0x1f')](0xcc)[_0xe9f0('0x1e')]();});}};}function handleEntityNotFound(_0x445ad0,_0x2ab77d){return function(_0x343d18){if(!_0x343d18){_0x445ad0[_0xe9f0('0x1d')](0x194);}return _0x343d18;};}function handleError(_0x80e3ac,_0x3e1846){_0x3e1846=_0x3e1846||0x1f4;return function(_0x2e7535){logger[_0xe9f0('0x38')](_0x2e7535[_0xe9f0('0x39')]);if(_0x2e7535[_0xe9f0('0x36')]){delete _0x2e7535[_0xe9f0('0x36')];}_0x80e3ac[_0xe9f0('0x1f')](_0x3e1846)['send'](_0x2e7535);};}exports['index']=function(_0x58d38b,_0x191a39){var _0x585742={},_0x9bf61d={},_0xc5fa13={'count':0x0,'rows':[]};var _0x4d3bd6=_[_0xe9f0('0x32')](db['VoiceExtension']['rawAttributes'],function(_0x59024e){return{'name':_0x59024e[_0xe9f0('0x3a')],'type':_0x59024e[_0xe9f0('0x34')]['key']};});_0x9bf61d[_0xe9f0('0x3b')]=_[_0xe9f0('0x32')](_0x4d3bd6,_0xe9f0('0x36'));_0x9bf61d['query']=_['keys'](_0x58d38b[_0xe9f0('0x3c')]);_0x9bf61d[_0xe9f0('0x3d')]=_[_0xe9f0('0x3e')](_0x9bf61d['model'],_0x9bf61d[_0xe9f0('0x3c')]);_0x585742[_0xe9f0('0x3f')]=_[_0xe9f0('0x3e')](_0x9bf61d[_0xe9f0('0x3b')],qs[_0xe9f0('0x40')](_0x58d38b['query'][_0xe9f0('0x40')]));_0x585742[_0xe9f0('0x3f')]=_0x585742[_0xe9f0('0x3f')]['length']?_0x585742[_0xe9f0('0x3f')]:_0x9bf61d[_0xe9f0('0x3b')];if(!_0x58d38b['query'][_0xe9f0('0x41')]('nolimit')){_0x585742[_0xe9f0('0x23')]=qs['limit'](_0x58d38b['query']['limit']);_0x585742['offset']=qs['offset'](_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x22')]);}_0x585742[_0xe9f0('0x42')]=qs[_0xe9f0('0x43')](_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x43')]);_0x585742[_0xe9f0('0x44')]=qs[_0xe9f0('0x3d')](_[_0xe9f0('0x45')](_0x58d38b['query'],_0x9bf61d[_0xe9f0('0x3d')]),_0x4d3bd6);if(_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x30')]){_0x585742['where']=_['merge'](_0x585742[_0xe9f0('0x44')],{'$or':_['map'](_0x4d3bd6,function(_0x297689){if(_0x297689[_0xe9f0('0x34')]!==_0xe9f0('0x46')){var _0x42d9d2={};_0x42d9d2[_0x297689['name']]={'$like':'%'+_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x30')]+'%'};return _0x42d9d2;}})});}_0x585742=_[_0xe9f0('0x47')]({},_0x585742,_0x58d38b[_0xe9f0('0x48')]);var _0x37a2ac={'where':_0x585742['where']};return db[_0xe9f0('0x49')][_0xe9f0('0x21')](_0x37a2ac)[_0xe9f0('0x29')](function(_0x319380){_0xc5fa13[_0xe9f0('0x21')]=_0x319380;if(_0x58d38b['query'][_0xe9f0('0x4a')]){_0x585742['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xe9f0('0x4b')](_0x585742);})[_0xe9f0('0x29')](function(_0x536734){_0xc5fa13[_0xe9f0('0x4c')]=_0x536734;return _0xc5fa13;})[_0xe9f0('0x29')](respondWithFilteredResult(_0x191a39,_0x585742))[_0xe9f0('0x4d')](handleError(_0x191a39,null));};exports[_0xe9f0('0x4e')]=function(_0xdf4173,_0x410e17){var _0x15d529={'raw':![],'where':{'id':_0xdf4173[_0xe9f0('0x4f')]['id']}},_0x573437={};_0x573437['model']=_[_0xe9f0('0x50')](db['VoiceExtension'][_0xe9f0('0x51')]);_0x573437['query']=_[_0xe9f0('0x50')](_0xdf4173[_0xe9f0('0x3c')]);_0x573437[_0xe9f0('0x3d')]=_['intersection'](_0x573437[_0xe9f0('0x3b')],_0x573437[_0xe9f0('0x3c')]);_0x15d529[_0xe9f0('0x3f')]=_[_0xe9f0('0x3e')](_0x573437[_0xe9f0('0x3b')],qs[_0xe9f0('0x40')](_0xdf4173[_0xe9f0('0x3c')][_0xe9f0('0x40')]));_0x15d529[_0xe9f0('0x3f')]=_0x15d529[_0xe9f0('0x3f')][_0xe9f0('0x52')]?_0x15d529[_0xe9f0('0x3f')]:_0x573437['model'];if(_0xdf4173['query'][_0xe9f0('0x4a')]){_0x15d529[_0xe9f0('0x53')]=[{'all':!![]}];}_0x15d529=_[_0xe9f0('0x47')]({},_0x15d529,_0xdf4173['options']);return db[_0xe9f0('0x49')]['find'](_0x15d529)[_0xe9f0('0x29')](handleEntityNotFound(_0x410e17,null))[_0xe9f0('0x29')](respondWithResult(_0x410e17,null))[_0xe9f0('0x4d')](handleError(_0x410e17,null));};exports[_0xe9f0('0x28')]=function(_0x49fc70,_0xb18f13){return db[_0xe9f0('0x49')]['find']({'where':{'id':_0x49fc70[_0xe9f0('0x4f')]['id']}})[_0xe9f0('0x29')](handleEntityNotFound(_0xb18f13,null))[_0xe9f0('0x29')](removeEntity(_0xb18f13,null))[_0xe9f0('0x4d')](handleError(_0xb18f13,null));};exports['create']=function(_0x182e7f,_0x3a5d19){if(_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x34')]===_0xe9f0('0x2d')&&!_[_0xe9f0('0x55')](_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x56')],'_')){_0x182e7f['body'][_0xe9f0('0x56')]='_'[_0xe9f0('0x57')](_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x56')]);}return db[_0xe9f0('0x49')][_0xe9f0('0x58')](_0x182e7f[_0xe9f0('0x54')],{'raw':![]})[_0xe9f0('0x29')](function(_0xd780f5){var _0x127407=_0x182e7f[_0xe9f0('0x59')][_0xe9f0('0x2a')]({'plain':!![]});if(!_0x127407)throw new Error(_0xe9f0('0x5a'));if(_0x127407[_0xe9f0('0x5b')]==='user'){var _0x37d2af=_0xd780f5[_0xe9f0('0x2a')]({'plain':!![]});var _0x52bcce=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xe9f0('0x2c'),'value':'outbound'},{'name':_0xe9f0('0x2e'),'value':_0xe9f0('0x2f')}];var _0x2b37ff=_['find'](_0x52bcce,[_0xe9f0('0x33'),_0x37d2af[_0xe9f0('0x34')]])[_0xe9f0('0x36')];return db[_0xe9f0('0x5c')]['find']({'where':{'name':_0x2b37ff,'userProfileId':_0x127407[_0xe9f0('0x5d')]},'raw':!![]})[_0xe9f0('0x29')](function(_0x28a66e){if(_0x28a66e&&_0x28a66e[_0xe9f0('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x37d2af[_0xe9f0('0x36')],'resourceId':_0x37d2af['id'],'type':_0x28a66e[_0xe9f0('0x36')],'sectionId':_0x28a66e['id']},{})[_0xe9f0('0x29')](function(){return _0xd780f5;});}else{return _0xd780f5;}})[_0xe9f0('0x4d')](function(_0x7cbe71){logger['error'](_0xe9f0('0x5f'),_0x7cbe71);throw _0x7cbe71;});}return _0xd780f5;})['then'](respondWithResult(_0x3a5d19,0xc9))[_0xe9f0('0x4d')](handleError(_0x3a5d19,null));};exports['update']=function(_0x7c05aa,_0x15ece3){if(_0x7c05aa[_0xe9f0('0x54')]['id']){delete _0x7c05aa[_0xe9f0('0x54')]['id'];}return db[_0xe9f0('0x49')]['find']({'where':{'id':_0x7c05aa['params']['id']}})['then'](handleEntityNotFound(_0x15ece3,null))[_0xe9f0('0x29')](function(_0x260927){if(_0x260927){return db['VoiceExtension'][_0xe9f0('0x27')](_['pick'](_0x7c05aa['body'],[_0xe9f0('0x56'),_0xe9f0('0x60'),_0xe9f0('0x61'),_0xe9f0('0x62'),_0xe9f0('0x63'),_0xe9f0('0x64')]),{'where':{'context':_0x260927['context'],'exten':_0x260927['exten']},'individualHooks':!![]})[_0xe9f0('0x29')](function(_0x248f10){return _0x248f10;});}return null;})[_0xe9f0('0x29')](respondWithStatusCode(_0x15ece3,null))[_0xe9f0('0x4d')](handleError(_0x15ece3,null));};exports['addApplications']=function(_0xb9b439,_0x83dea9,_0x22b44a){return db[_0xe9f0('0x49')][_0xe9f0('0x65')]({'where':{'id':_0xb9b439[_0xe9f0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x83dea9,null))[_0xe9f0('0x29')](function(_0x2b074a){if(_0x2b074a){return db[_0xe9f0('0x66')][_0xe9f0('0x67')](function(_0xb6e75d){return db['VoiceExtension'][_0xe9f0('0x28')]({'where':{'VoiceExtensionId':_0xb9b439[_0xe9f0('0x4f')]['id']},'transaction':_0xb6e75d})[_0xe9f0('0x29')](function(_0x2e2ac7){var _0x214ac0=_[_0xe9f0('0x32')](_0xb9b439[_0xe9f0('0x54')],function(_0x16cc6b){_0x16cc6b[_0xe9f0('0x68')]=_0xb9b439[_0xe9f0('0x4f')]['id'];return _0x16cc6b;});return db[_0xe9f0('0x49')][_0xe9f0('0x69')](_0x214ac0,{'transaction':_0xb6e75d});});})['then'](function(){return db[_0xe9f0('0x49')][_0xe9f0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0xb9b439[_0xe9f0('0x4f')]['id']},'order':_0xe9f0('0x6b')});});}})[_0xe9f0('0x29')](respondWithResult(_0x83dea9,null))[_0xe9f0('0x4d')](handleError(_0x83dea9,null));}; \ No newline at end of file +var _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(_0x54fd5b,_0x51c5d8){var _0x3d10bd=function(_0x58c45a){while(--_0x58c45a){_0x54fd5b['push'](_0x54fd5b['shift']());}};_0x3d10bd(++_0x51c5d8);}(_0xba34,0x119));var _0x4ba3=function(_0x10d43d,_0x2299d1){_0x10d43d=_0x10d43d-0x0;var _0x4009f2=_0xba34[_0x10d43d];return _0x4009f2;};'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 86a485f..722a1ab 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 _0xb6a6=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x3e9636,_0x58ddab){var _0x11d917=function(_0x3775c7){while(--_0x3775c7){_0x3e9636['push'](_0x3e9636['shift']());}};_0x11d917(++_0x58ddab);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x522f15,_0x3ebe5d){_0x522f15=_0x522f15-0x0;var _0x2ff599=_0xb6a6[_0x522f15];return _0x2ff599;};'use strict';var EventEmitter=require(_0x6b6a('0x0'));var VoiceExtension=require(_0x6b6a('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b6a('0x2'),'afterUpdate':_0x6b6a('0x3'),'afterDestroy':_0x6b6a('0x4')};function emitEvent(_0x8abe65){return function(_0xe80650,_0x494fb4,_0x15a57d){VoiceExtensionEvents[_0x6b6a('0x5')](_0x8abe65+':'+_0xe80650['id'],_0xe80650);VoiceExtensionEvents[_0x6b6a('0x5')](_0x8abe65,_0xe80650);_0x15a57d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6b6a('0x6')](e,emitEvent(event));}}module[_0x6b6a('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x666b=['emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x666b,0x107));var _0xb666=function(_0x3d10de,_0x1fda5e){_0x3d10de=_0x3d10de-0x0;var _0x45a02d=_0x666b[_0x3d10de];return _0x45a02d;};'use strict';var EventEmitter=require(_0xb666('0x0'));var VoiceExtension=require(_0xb666('0x1'))['db'][_0xb666('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb666('0x3')](0x0);var events={'afterCreate':_0xb666('0x4'),'afterUpdate':_0xb666('0x5'),'afterDestroy':_0xb666('0x6')};function emitEvent(_0x358f08){return function(_0x5aac6f,_0x583c12,_0x1c79d3){VoiceExtensionEvents[_0xb666('0x7')](_0x358f08+':'+_0x5aac6f['id'],_0x5aac6f);VoiceExtensionEvents[_0xb666('0x7')](_0x358f08,_0x5aac6f);_0x1c79d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb666('0x8')](e,emitEvent(event));}}module[_0xb666('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 4cce5a7..8a8eff0 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 _0x1a85=['moment','path','rimraf','../../config/environment','exports','VoiceExtension','voice_extensions','../../config/logger','api'];(function(_0x579ccf,_0x422fe2){var _0xe25624=function(_0xd1ae45){while(--_0xd1ae45){_0x579ccf['push'](_0x579ccf['shift']());}};_0xe25624(++_0x422fe2);}(_0x1a85,0x178));var _0x51a8=function(_0x2ff5aa,_0x4d251f){_0x2ff5aa=_0x2ff5aa-0x0;var _0x366c91=_0x1a85[_0x2ff5aa];return _0x366c91;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./voiceExtension.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x5003eb,_0x51614c){var _0x3ef03d=function(_0x35bb5d){while(--_0x35bb5d){_0x5003eb['push'](_0x5003eb['shift']());}};_0x3ef03d(++_0x51614c);}(_0xda2d,0x102));var _0xdda2=function(_0xf6e463,_0x1eb2d2){_0xf6e463=_0xf6e463-0x0;var _0x476823=_0xda2d[_0xf6e463];return _0x476823;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cd16e5a..5c8eb1b 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 _0x8397=['http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x8397,0xf4));var _0x7839=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x8397[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7839('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7839('0x1'))['db'];var utils=require(_0x7839('0x2'));var logger=require(_0x7839('0x3'))(_0x7839('0x4'));var config=require(_0x7839('0x5'));var jayson=require(_0x7839('0x6'));var client=jayson[_0x7839('0x7')][_0x7839('0x8')]({'port':0x232a});config[_0x7839('0x9')]=_[_0x7839('0xa')](config[_0x7839('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7839('0xb'))(new Redis(config[_0x7839('0x9')]));require(_0x7839('0xc'))[_0x7839('0xd')](socket);function respondWithRpcPromise(_0x4bb2f2,_0x49e190,_0x45b3b0){return new BPromise(function(_0x3665bb,_0x14cc48){return client[_0x7839('0xe')](_0x4bb2f2,_0x45b3b0)[_0x7839('0xf')](function(_0x5d9177){logger['info'](_0x7839('0x10'),_0x49e190,_0x7839('0x11'));logger[_0x7839('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x49e190,_0x7839('0x11'),JSON[_0x7839('0x13')](_0x5d9177));if(_0x5d9177[_0x7839('0x14')]){if(_0x5d9177[_0x7839('0x14')][_0x7839('0x15')]===0x1f4){logger[_0x7839('0x14')](_0x7839('0x10'),_0x49e190,_0x5d9177[_0x7839('0x14')][_0x7839('0x16')]);return _0x14cc48(_0x5d9177['error']['message']);}logger[_0x7839('0x14')](_0x7839('0x10'),_0x49e190,_0x5d9177['error'][_0x7839('0x16')]);return _0x3665bb(_0x5d9177['error'][_0x7839('0x16')]);}else{logger[_0x7839('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x49e190,_0x7839('0x11'));_0x3665bb(_0x5d9177[_0x7839('0x18')][_0x7839('0x16')]);}})[_0x7839('0x19')](function(_0x23d5a4){logger[_0x7839('0x14')](_0x7839('0x10'),_0x49e190,_0x23d5a4);_0x14cc48(_0x23d5a4);});});}exports[_0x7839('0x1a')]=function(_0x2ee4d0){var _0x2ff3b2=this;return new Promise(function(_0x431bda,_0x5516af){return db[_0x7839('0x1b')][_0x7839('0x1c')]({'raw':_0x2ee4d0[_0x7839('0x1d')]?_0x2ee4d0[_0x7839('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2ee4d0[_0x7839('0x1d')]?_0x2ee4d0['options'][_0x7839('0x1e')]||null:null,'attributes':_0x2ee4d0[_0x7839('0x1d')]?_0x2ee4d0[_0x7839('0x1d')][_0x7839('0x1f')]||null:null,'limit':_0x2ee4d0['options']?_0x2ee4d0[_0x7839('0x1d')][_0x7839('0x20')]||null:null,'include':_0x2ee4d0[_0x7839('0x1d')]?_0x2ee4d0[_0x7839('0x1d')][_0x7839('0x21')]?_[_0x7839('0x22')](_0x2ee4d0[_0x7839('0x1d')]['include'],function(_0x4c8188){return{'model':db[_0x4c8188[_0x7839('0x23')]],'as':_0x4c8188['as'],'attributes':_0x4c8188[_0x7839('0x1f')],'include':_0x4c8188['include']?_['map'](_0x4c8188[_0x7839('0x21')],function(_0xd25297){return{'model':db[_0xd25297[_0x7839('0x23')]],'as':_0xd25297['as'],'attributes':_0xd25297[_0x7839('0x1f')],'include':_0xd25297[_0x7839('0x21')]?_['map'](_0xd25297[_0x7839('0x21')],function(_0x223204){return{'model':db[_0x223204[_0x7839('0x23')]],'as':_0x223204['as'],'attributes':_0x223204[_0x7839('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50088b){logger[_0x7839('0x17')]('GetVoiceExtension',_0x2ee4d0);logger[_0x7839('0x12')](_0x7839('0x1a'),_0x2ee4d0,JSON['stringify'](_0x50088b));_0x431bda(_0x50088b);})[_0x7839('0x19')](function(_0x4d74e9){logger[_0x7839('0x14')]('GetVoiceExtension',_0x4d74e9[_0x7839('0x16')],_0x2ee4d0);_0x5516af(_0x2ff3b2['error'](0x1f4,_0x4d74e9[_0x7839('0x16')]));});});}; \ No newline at end of file +var _0xeadb=['rpc','../../config/environment','jayson/promise','client','http','redis','request','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x52f7fe,_0x38f3d6){var _0x33c2c5=function(_0x490b8a){while(--_0x490b8a){_0x52f7fe['push'](_0x52f7fe['shift']());}};_0x33c2c5(++_0x38f3d6);}(_0xeadb,0x121));var _0xbead=function(_0x157985,_0x262d88){_0x157985=_0x157985-0x0;var _0x47ae59=_0xeadb[_0x157985];return _0x47ae59;};'use strict';var _=require('lodash');var util=require(_0xbead('0x0'));var moment=require(_0xbead('0x1'));var BPromise=require(_0xbead('0x2'));var rs=require(_0xbead('0x3'));var fs=require('fs');var Redis=require(_0xbead('0x4'));var db=require(_0xbead('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbead('0x6'))(_0xbead('0x7'));var config=require(_0xbead('0x8'));var jayson=require(_0xbead('0x9'));var client=jayson[_0xbead('0xa')][_0xbead('0xb')]({'port':0x232a});config[_0xbead('0xc')]=_['defaults'](config[_0xbead('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbead('0xc')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x20a003,_0x21384a,_0x48be59){return new BPromise(function(_0x450b48,_0x28edda){return client[_0xbead('0xd')](_0x20a003,_0x48be59)['then'](function(_0x2596a8){logger['info'](_0xbead('0xe'),_0x21384a,'request\x20sent');logger[_0xbead('0xf')](_0xbead('0x10'),_0x21384a,_0xbead('0x11'),JSON[_0xbead('0x12')](_0x2596a8));if(_0x2596a8[_0xbead('0x13')]){if(_0x2596a8[_0xbead('0x13')][_0xbead('0x14')]===0x1f4){logger[_0xbead('0x13')](_0xbead('0xe'),_0x21384a,_0x2596a8[_0xbead('0x13')][_0xbead('0x15')]);return _0x28edda(_0x2596a8[_0xbead('0x13')][_0xbead('0x15')]);}logger[_0xbead('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x21384a,_0x2596a8[_0xbead('0x13')][_0xbead('0x15')]);return _0x450b48(_0x2596a8[_0xbead('0x13')][_0xbead('0x15')]);}else{logger[_0xbead('0x16')](_0xbead('0xe'),_0x21384a,_0xbead('0x11'));_0x450b48(_0x2596a8[_0xbead('0x17')][_0xbead('0x15')]);}})['catch'](function(_0x31d24f){logger[_0xbead('0x13')](_0xbead('0xe'),_0x21384a,_0x31d24f);_0x28edda(_0x31d24f);});});}exports[_0xbead('0x18')]=function(_0x2999da){var _0x2e47f3=this;return new Promise(function(_0x40cf68,_0x4053c4){return db[_0xbead('0x19')][_0xbead('0x1a')]({'raw':_0x2999da['options']?_0x2999da[_0xbead('0x1b')][_0xbead('0x1c')]===undefined?!![]:![]:!![],'where':_0x2999da[_0xbead('0x1b')]?_0x2999da['options'][_0xbead('0x1d')]||null:null,'attributes':_0x2999da[_0xbead('0x1b')]?_0x2999da[_0xbead('0x1b')][_0xbead('0x1e')]||null:null,'limit':_0x2999da['options']?_0x2999da['options'][_0xbead('0x1f')]||null:null,'include':_0x2999da['options']?_0x2999da[_0xbead('0x1b')][_0xbead('0x20')]?_[_0xbead('0x21')](_0x2999da[_0xbead('0x1b')][_0xbead('0x20')],function(_0x1da661){return{'model':db[_0x1da661['model']],'as':_0x1da661['as'],'attributes':_0x1da661[_0xbead('0x1e')],'include':_0x1da661[_0xbead('0x20')]?_[_0xbead('0x21')](_0x1da661[_0xbead('0x20')],function(_0x3e20b6){return{'model':db[_0x3e20b6[_0xbead('0x22')]],'as':_0x3e20b6['as'],'attributes':_0x3e20b6['attributes'],'include':_0x3e20b6[_0xbead('0x20')]?_[_0xbead('0x21')](_0x3e20b6[_0xbead('0x20')],function(_0x243b85){return{'model':db[_0x243b85[_0xbead('0x22')]],'as':_0x243b85['as'],'attributes':_0x243b85['attributes']};}):[]};}):[]};}):[]:[]})[_0xbead('0x23')](function(_0x3c81c4){logger['info'](_0xbead('0x18'),_0x2999da);logger['debug']('GetVoiceExtension',_0x2999da,JSON[_0xbead('0x12')](_0x3c81c4));_0x40cf68(_0x3c81c4);})[_0xbead('0x24')](function(_0x2dafb6){logger[_0xbead('0x13')](_0xbead('0x18'),_0x2dafb6[_0xbead('0x15')],_0x2999da);_0x4053c4(_0x2e47f3[_0xbead('0x13')](0x1f4,_0x2dafb6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 35fb0ce..59508b6 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 _0xebae=['voiceExtension:','./voiceExtension.events','remove','emit','register'];(function(_0x4d6f0d,_0x2e26ca){var _0x50b4fa=function(_0x1a3416){while(--_0x1a3416){_0x4d6f0d['push'](_0x4d6f0d['shift']());}};_0x50b4fa(++_0x2e26ca);}(_0xebae,0xb5));var _0xeeba=function(_0x132844,_0x98bc49){_0x132844=_0x132844-0x0;var _0x13c26f=_0xebae[_0x132844];return _0x13c26f;};'use strict';var VoiceExtensionEvents=require(_0xeeba('0x0'));var events=['save',_0xeeba('0x1'),'update'];function createListener(_0x4047c7,_0x141ef){return function(_0x272c0){_0x141ef[_0xeeba('0x2')](_0x4047c7,_0x272c0);};}function removeListener(_0x433820,_0x252fb0){return function(){VoiceExtensionEvents['removeListener'](_0x433820,_0x252fb0);};}exports[_0xeeba('0x3')]=function(_0x3fd26a){for(var _0x4edb01=0x0,_0x2b4a07=events['length'];_0x4edb01<_0x2b4a07;_0x4edb01++){var _0x366ee6=events[_0x4edb01];var _0x153e81=createListener(_0xeeba('0x4')+_0x366ee6,_0x3fd26a);VoiceExtensionEvents['on'](_0x366ee6,_0x153e81);}}; \ No newline at end of file +var _0x84b2=['save','remove','update','removeListener','length','voiceExtension:','./voiceExtension.events'];(function(_0x5169f1,_0x5e93c2){var _0x5e42ad=function(_0x216030){while(--_0x216030){_0x5169f1['push'](_0x5169f1['shift']());}};_0x5e42ad(++_0x5e93c2);}(_0x84b2,0x117));var _0x284b=function(_0x12046e,_0x4e73c1){_0x12046e=_0x12046e-0x0;var _0x183778=_0x84b2[_0x12046e];return _0x183778;};'use strict';var VoiceExtensionEvents=require(_0x284b('0x0'));var events=[_0x284b('0x1'),_0x284b('0x2'),_0x284b('0x3')];function createListener(_0x432d0b,_0xfacee6){return function(_0x2433f4){_0xfacee6['emit'](_0x432d0b,_0x2433f4);};}function removeListener(_0x2ab9c2,_0x81fee0){return function(){VoiceExtensionEvents[_0x284b('0x4')](_0x2ab9c2,_0x81fee0);};}exports['register']=function(_0x5b0ecf){for(var _0x2d6fa3=0x0,_0xa0b667=events[_0x284b('0x5')];_0x2d6fa3<_0xa0b667;_0x2d6fa3++){var _0x105ca6=events[_0x2d6fa3];var _0x7f9571=createListener(_0x284b('0x6')+_0x105ca6,_0x5b0ecf);VoiceExtensionEvents['on'](_0x105ca6,_0x7f9571);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6a2f42a..5eb0f05 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 _0xfb15=['isAuthenticated','get','/:id','getMessages','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceMail.controller'];(function(_0x508513,_0x1614ab){var _0x28686f=function(_0x526682){while(--_0x526682){_0x508513['push'](_0x508513['shift']());}};_0x28686f(++_0x1614ab);}(_0xfb15,0x15e));var _0x5fb1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfb15[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x5fb1('0x0'));var util=require(_0x5fb1('0x1'));var path=require(_0x5fb1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5fb1('0x3')]();var auth=require(_0x5fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5fb1('0x5'));var controller=require(_0x5fb1('0x6'));router['get']('/',auth[_0x5fb1('0x7')](),controller['index']);router[_0x5fb1('0x8')](_0x5fb1('0x9'),auth[_0x5fb1('0x7')](),controller['show']);router['get']('/:id/messages',auth[_0x5fb1('0x7')](),controller[_0x5fb1('0xa')]);router[_0x5fb1('0xb')]('/',auth[_0x5fb1('0x7')](),controller['create']);router[_0x5fb1('0xc')](_0x5fb1('0x9'),auth[_0x5fb1('0x7')](),controller[_0x5fb1('0xd')]);router[_0x5fb1('0xe')](_0x5fb1('0x9'),auth[_0x5fb1('0x7')](),controller[_0x5fb1('0xf')]);module[_0x5fb1('0x10')]=router; \ No newline at end of file +var _0xb958=['update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb958,0xaf));var _0x8b95=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xb958[_0x1428d9];return _0x438019;};'use strict';var multer=require(_0x8b95('0x0'));var util=require('util');var path=require(_0x8b95('0x1'));var timeout=require(_0x8b95('0x2'));var express=require('express');var router=express[_0x8b95('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b95('0x4'));var config=require(_0x8b95('0x5'));var controller=require(_0x8b95('0x6'));router[_0x8b95('0x7')]('/',auth[_0x8b95('0x8')](),controller[_0x8b95('0x9')]);router[_0x8b95('0x7')](_0x8b95('0xa'),auth['isAuthenticated'](),controller[_0x8b95('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x8b95('0xc')]);router[_0x8b95('0xd')]('/',auth[_0x8b95('0x8')](),controller[_0x8b95('0xe')]);router['put'](_0x8b95('0xa'),auth['isAuthenticated'](),controller[_0x8b95('0xf')]);router[_0x8b95('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8b95('0x11')]);module[_0x8b95('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 7055fe4..88eebaf 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 _0x3c81=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x33d5e1,_0x18a908){var _0x33f71e=function(_0x17c1c0){while(--_0x17c1c0){_0x33d5e1['push'](_0x33d5e1['shift']());}};_0x33f71e(++_0x18a908);}(_0x3c81,0x102));var _0x13c8=function(_0x23234b,_0x25ce64){_0x23234b=_0x23234b-0x0;var _0x1a108f=_0x3c81[_0x23234b];return _0x1a108f;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x13c8('0x2')]},'email':{'type':Sequelize[_0x13c8('0x2')],'validate':{'isEmail':!![]},'set':function(_0x18bd0f){this[_0x13c8('0x4')](_0x13c8('0x5'),typeof _0x18bd0f===_0x13c8('0x6')&&_0x18bd0f[_0x13c8('0x7')]()?_0x18bd0f['trim']():null);}},'pager':{'type':Sequelize[_0x13c8('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x8')},'attach':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x13c8('0x2')]},'callback':{'type':Sequelize[_0x13c8('0x2')]},'review':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x13c8('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x13c8('0x9')](_0x13c8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x13c8('0x9')]('yes','no'),'defaultValue':_0x13c8('0xa'),'allowNull':![]},'stamp':{'type':_0x13c8('0xc')},'emailsubject':{'type':Sequelize[_0x13c8('0x2')]},'emailbody':{'type':Sequelize[_0x13c8('0x2')]},'maxsecs':{'type':Sequelize[_0x13c8('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x13c8('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x13c8('0xe')],'get':function(){return this[_0x13c8('0xf')](_0x13c8('0x10'))+_0x13c8('0x11')+this[_0x13c8('0xf')]('mailbox');}}}; \ No newline at end of file +var _0x4cf8=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x1a090d,_0x2adda1){var _0x1f1e22=function(_0x56beb8){while(--_0x56beb8){_0x1a090d['push'](_0x1a090d['shift']());}};_0x1f1e22(++_0x2adda1);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x4cf8[_0x53f0db];return _0xae0a5c;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'customer_id':{'type':Sequelize[_0x84cf('0x2')]},'context':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':_0x84cf('0x3'),'unique':_0x84cf('0x4')},'mailbox':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x84cf('0x4')},'password':{'type':Sequelize[_0x84cf('0x2')]},'fullname':{'type':Sequelize[_0x84cf('0x2')]},'email':{'type':Sequelize[_0x84cf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c613d){this['setDataValue']('email',typeof _0x2c613d===_0x84cf('0x5')&&_0x2c613d['trim']()?_0x2c613d[_0x84cf('0x6')]():null);}},'pager':{'type':Sequelize[_0x84cf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x84cf('0x7')},'attach':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x84cf('0x2')]},'review':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x84cf('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x84cf('0xb')},'emailsubject':{'type':Sequelize[_0x84cf('0x2')]},'emailbody':{'type':Sequelize[_0x84cf('0x2')]},'maxsecs':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x84cf('0xd')],'get':function(){return this[_0x84cf('0xe')]('fullname')+'\x20-\x20'+this[_0x84cf('0xe')](_0x84cf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1b40fd6..1a00449 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 _0xbac9=['rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','options','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','Voicemails','error','name','index','VoiceMail','key','model','map','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','type','filter','includeAll','include','findAll'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xbac9,0x157));var _0x9bac=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0xbac9[_0x42e8f3];return _0x47feab;};'use strict';var pdf=require(_0x9bac('0x0'));var emlformat=require(_0x9bac('0x1'));var rimraf=require(_0x9bac('0x2'));var zipdir=require(_0x9bac('0x3'));var jsonpatch=require(_0x9bac('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9bac('0x5'));var Mustache=require('mustache');var util=require(_0x9bac('0x6'));var path=require('path');var sox=require(_0x9bac('0x7'));var csv=require(_0x9bac('0x8'));var ejs=require(_0x9bac('0x9'));var fs=require('fs');var _=require(_0x9bac('0xa'));var squel=require(_0x9bac('0xb'));var crypto=require(_0x9bac('0xc'));var jsforce=require(_0x9bac('0xd'));var deskjs=require(_0x9bac('0xe'));var toCsv=require(_0x9bac('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9bac('0xf'));var authService=require(_0x9bac('0x10'));var qs=require(_0x9bac('0x11'));var as=require(_0x9bac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9bac('0x13'))(_0x9bac('0x14'));var utils=require('../../config/utils');var config=require(_0x9bac('0x15'));var db=require(_0x9bac('0x16'))['db'];function respondWithStatusCode(_0x33fc2e,_0x3c1b8a){_0x3c1b8a=_0x3c1b8a||0xcc;return function(_0x57950c){if(_0x57950c){return _0x33fc2e[_0x9bac('0x17')](_0x3c1b8a);}return _0x33fc2e[_0x9bac('0x18')](_0x3c1b8a)[_0x9bac('0x19')]();};}function respondWithResult(_0x8fc2b8,_0x4539f5){_0x4539f5=_0x4539f5||0xc8;return function(_0x2ca615){if(_0x2ca615){return _0x8fc2b8[_0x9bac('0x18')](_0x4539f5)[_0x9bac('0x1a')](_0x2ca615);}};}function respondWithFilteredResult(_0x1bfcaa,_0x1114c5){return function(_0x2d3748){if(_0x2d3748){var _0x4d752c=_0x2d3748[_0x9bac('0x1b')],_0x4237d8=_0x1114c5[_0x9bac('0x1c')],_0xec848d=_0x1114c5['offset']+_0x1114c5[_0x9bac('0x1d')],_0x17c937;if(_0xec848d>=_0x4d752c){_0xec848d=_0x4d752c;_0x17c937=0xc8;}else{_0x17c937=0xce;}_0x1bfcaa['status'](_0x17c937);return _0x1bfcaa[_0x9bac('0x1e')]('Content-Range',_0x4237d8+'-'+_0xec848d+'/'+_0x4d752c)['json'](_0x2d3748);}return null;};}function patchUpdates(_0x22d756){return function(_0x3d2043){try{jsonpatch[_0x9bac('0x1f')](_0x3d2043,_0x22d756,!![]);}catch(_0x61046a){return BPromise['reject'](_0x61046a);}return _0x3d2043[_0x9bac('0x20')]();};}function saveUpdates(_0x2e646e,_0x5444c1){return function(_0x31a114){if(_0x31a114){return _0x31a114[_0x9bac('0x21')](_0x2e646e)[_0x9bac('0x22')](function(_0x4b6436){return _0x4b6436;});}return null;};}function removeEntity(_0x385428,_0x53d4b0){return function(_0x329167){if(_0x329167){return _0x329167[_0x9bac('0x23')]()['then'](function(){var _0xd7ff36=_0x329167[_0x9bac('0x24')]({'plain':!![]});var _0x574f38=_0x9bac('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x574f38,'resourceId':_0xd7ff36['id']}})[_0x9bac('0x22')](function(){return _0x329167;});})[_0x9bac('0x22')](function(){_0x385428[_0x9bac('0x18')](0xcc)[_0x9bac('0x19')]();});}};}function handleEntityNotFound(_0x2b4286,_0x50ea39){return function(_0x5cb6b1){if(!_0x5cb6b1){_0x2b4286[_0x9bac('0x17')](0x194);}return _0x5cb6b1;};}function handleError(_0x163fc9,_0x35bee1){_0x35bee1=_0x35bee1||0x1f4;return function(_0xa9a72c){logger[_0x9bac('0x26')](_0xa9a72c['stack']);if(_0xa9a72c[_0x9bac('0x27')]){delete _0xa9a72c[_0x9bac('0x27')];}_0x163fc9[_0x9bac('0x18')](_0x35bee1)['send'](_0xa9a72c);};}exports[_0x9bac('0x28')]=function(_0x586dac,_0x2e228d){var _0x5897a9={},_0xe428b1={},_0xf8ed67={'count':0x0,'rows':[]};var _0x2cb6e6=_['map'](db[_0x9bac('0x29')]['rawAttributes'],function(_0x49f354){return{'name':_0x49f354['fieldName'],'type':_0x49f354['type'][_0x9bac('0x2a')]};});_0xe428b1[_0x9bac('0x2b')]=_[_0x9bac('0x2c')](_0x2cb6e6,_0x9bac('0x27'));_0xe428b1['query']=_['keys'](_0x586dac[_0x9bac('0x2d')]);_0xe428b1['filters']=_['intersection'](_0xe428b1[_0x9bac('0x2b')],_0xe428b1['query']);_0x5897a9[_0x9bac('0x2e')]=_[_0x9bac('0x2f')](_0xe428b1[_0x9bac('0x2b')],qs[_0x9bac('0x30')](_0x586dac[_0x9bac('0x2d')][_0x9bac('0x30')]));_0x5897a9[_0x9bac('0x2e')]=_0x5897a9['attributes'][_0x9bac('0x31')]?_0x5897a9['attributes']:_0xe428b1[_0x9bac('0x2b')];if(!_0x586dac['query']['hasOwnProperty'](_0x9bac('0x32'))){_0x5897a9['limit']=qs[_0x9bac('0x1d')](_0x586dac['query'][_0x9bac('0x1d')]);_0x5897a9[_0x9bac('0x1c')]=qs[_0x9bac('0x1c')](_0x586dac[_0x9bac('0x2d')][_0x9bac('0x1c')]);}_0x5897a9[_0x9bac('0x33')]=qs['sort'](_0x586dac[_0x9bac('0x2d')][_0x9bac('0x34')]);_0x5897a9[_0x9bac('0x35')]=qs[_0x9bac('0x36')](_[_0x9bac('0x37')](_0x586dac[_0x9bac('0x2d')],_0xe428b1['filters']),_0x2cb6e6);if(_0x586dac[_0x9bac('0x2d')]['filter']){_0x5897a9[_0x9bac('0x35')]=_[_0x9bac('0x38')](_0x5897a9[_0x9bac('0x35')],{'$or':_[_0x9bac('0x2c')](_0x2cb6e6,function(_0x116d18){if(_0x116d18[_0x9bac('0x39')]!=='VIRTUAL'){var _0x10aa16={};_0x10aa16[_0x116d18['name']]={'$like':'%'+_0x586dac[_0x9bac('0x2d')][_0x9bac('0x3a')]+'%'};return _0x10aa16;}})});}_0x5897a9=_['merge']({},_0x5897a9,_0x586dac['options']);var _0x51828c={'where':_0x5897a9[_0x9bac('0x35')]};return db['VoiceMail'][_0x9bac('0x1b')](_0x51828c)['then'](function(_0x51ec7e){_0xf8ed67[_0x9bac('0x1b')]=_0x51ec7e;if(_0x586dac['query'][_0x9bac('0x3b')]){_0x5897a9[_0x9bac('0x3c')]=[{'all':!![]}];}return db[_0x9bac('0x29')][_0x9bac('0x3d')](_0x5897a9);})[_0x9bac('0x22')](function(_0x2a696a){_0xf8ed67[_0x9bac('0x3e')]=_0x2a696a;return _0xf8ed67;})[_0x9bac('0x22')](respondWithFilteredResult(_0x2e228d,_0x5897a9))[_0x9bac('0x3f')](handleError(_0x2e228d,null));};exports['show']=function(_0x4f5933,_0x3377fc){var _0x4b1cb1={'raw':!![],'where':{'id':_0x4f5933[_0x9bac('0x40')]['id']}},_0x517ecb={};_0x517ecb[_0x9bac('0x2b')]=_[_0x9bac('0x41')](db[_0x9bac('0x29')][_0x9bac('0x42')]);_0x517ecb['query']=_[_0x9bac('0x41')](_0x4f5933[_0x9bac('0x2d')]);_0x517ecb[_0x9bac('0x36')]=_['intersection'](_0x517ecb[_0x9bac('0x2b')],_0x517ecb[_0x9bac('0x2d')]);_0x4b1cb1[_0x9bac('0x2e')]=_[_0x9bac('0x2f')](_0x517ecb[_0x9bac('0x2b')],qs[_0x9bac('0x30')](_0x4f5933[_0x9bac('0x2d')][_0x9bac('0x30')]));_0x4b1cb1[_0x9bac('0x2e')]=_0x4b1cb1[_0x9bac('0x2e')][_0x9bac('0x31')]?_0x4b1cb1[_0x9bac('0x2e')]:_0x517ecb[_0x9bac('0x2b')];if(_0x4f5933[_0x9bac('0x2d')][_0x9bac('0x3b')]){_0x4b1cb1['include']=[{'all':!![]}];}_0x4b1cb1=_[_0x9bac('0x38')]({},_0x4b1cb1,_0x4f5933['options']);return db[_0x9bac('0x29')][_0x9bac('0x43')](_0x4b1cb1)['then'](handleEntityNotFound(_0x3377fc,null))[_0x9bac('0x22')](respondWithResult(_0x3377fc,null))[_0x9bac('0x3f')](handleError(_0x3377fc,null));};exports['create']=function(_0x39ae04,_0x21b3d7){return db[_0x9bac('0x29')][_0x9bac('0x44')](_0x39ae04[_0x9bac('0x45')],{})[_0x9bac('0x22')](function(_0x9286f0){var _0x2cfd43=_0x39ae04[_0x9bac('0x46')]['get']({'plain':!![]});if(!_0x2cfd43)throw new Error(_0x9bac('0x47'));if(_0x2cfd43['role']===_0x9bac('0x46')){var _0x517721=_0x9286f0['get']({'plain':!![]});var _0x300daa='Voicemails';return db['UserProfileSection'][_0x9bac('0x43')]({'where':{'name':_0x300daa,'userProfileId':_0x2cfd43[_0x9bac('0x48')]},'raw':!![]})[_0x9bac('0x22')](function(_0x578bff){if(_0x578bff&&_0x578bff[_0x9bac('0x49')]===0x0){return db[_0x9bac('0x4a')]['create']({'name':_0x517721['name'],'resourceId':_0x517721['id'],'type':_0x578bff[_0x9bac('0x27')],'sectionId':_0x578bff['id']},{})[_0x9bac('0x22')](function(){return _0x9286f0;});}else{return _0x9286f0;}})['catch'](function(_0x41105c){logger[_0x9bac('0x26')](_0x9bac('0x4b'),_0x41105c);throw _0x41105c;});}return _0x9286f0;})[_0x9bac('0x22')](respondWithResult(_0x21b3d7,0xc9))[_0x9bac('0x3f')](handleError(_0x21b3d7,null));};exports[_0x9bac('0x21')]=function(_0x285e35,_0x31e623){if(_0x285e35[_0x9bac('0x45')]['id']){delete _0x285e35[_0x9bac('0x45')]['id'];}return db[_0x9bac('0x29')][_0x9bac('0x43')]({'where':{'id':_0x285e35['params']['id']}})[_0x9bac('0x22')](handleEntityNotFound(_0x31e623,null))['then'](saveUpdates(_0x285e35['body'],null))[_0x9bac('0x22')](respondWithResult(_0x31e623,null))[_0x9bac('0x3f')](handleError(_0x31e623,null));};exports[_0x9bac('0x23')]=function(_0x459e27,_0x5c3444){return db[_0x9bac('0x29')][_0x9bac('0x43')]({'where':{'id':_0x459e27[_0x9bac('0x40')]['id']}})[_0x9bac('0x22')](handleEntityNotFound(_0x5c3444,null))['then'](removeEntity(_0x5c3444,null))[_0x9bac('0x3f')](handleError(_0x5c3444,null));};exports[_0x9bac('0x4c')]=function(_0x347e7a,_0x5ee66b,_0x2ddce5){return db[_0x9bac('0x29')][_0x9bac('0x4d')]({'where':{'id':_0x347e7a[_0x9bac('0x40')]['id']}})[_0x9bac('0x22')](handleEntityNotFound(_0x5ee66b,null))[_0x9bac('0x22')](function(_0x126fa5){var _0xfe5d2b;var _0x1b90d2={},_0x2dc97e={};_0x2dc97e[_0x9bac('0x2b')]=_['keys'](db[_0x9bac('0x4e')]['rawAttributes']);_0x2dc97e['query']=_[_0x9bac('0x41')](_0x347e7a[_0x9bac('0x2d')]);_0x2dc97e[_0x9bac('0x36')]=_[_0x9bac('0x2f')](_0x2dc97e[_0x9bac('0x2b')],_0x2dc97e[_0x9bac('0x2d')]);_0x1b90d2[_0x9bac('0x2e')]=_[_0x9bac('0x2f')](_0x2dc97e[_0x9bac('0x2b')],qs[_0x9bac('0x30')](_0x347e7a[_0x9bac('0x2d')][_0x9bac('0x30')]));_0x1b90d2['attributes']=_0x1b90d2['attributes'][_0x9bac('0x31')]?_0x1b90d2[_0x9bac('0x2e')]:_0x2dc97e[_0x9bac('0x2b')];if(!_0x347e7a[_0x9bac('0x2d')]['hasOwnProperty']('nolimit')){_0x1b90d2['limit']=qs[_0x9bac('0x1d')](_0x347e7a['query'][_0x9bac('0x1d')]);_0x1b90d2[_0x9bac('0x1c')]=qs[_0x9bac('0x1c')](_0x347e7a[_0x9bac('0x2d')][_0x9bac('0x1c')]);}_0x1b90d2[_0x9bac('0x33')]=qs[_0x9bac('0x34')](_0x347e7a[_0x9bac('0x2d')]['sort']);_0x1b90d2[_0x9bac('0x35')]=qs[_0x9bac('0x36')](_[_0x9bac('0x37')](_0x347e7a[_0x9bac('0x2d')],_0x2dc97e['filters']));if(_0x347e7a[_0x9bac('0x2d')][_0x9bac('0x3a')]){_0x1b90d2['where']=_[_0x9bac('0x38')](_0x1b90d2[_0x9bac('0x35')],{'$or':_[_0x9bac('0x2c')](_0x1b90d2[_0x9bac('0x2e')],function(_0x49bcd2){var _0x554c9e={};_0x554c9e[_0x49bcd2]={'$like':'%'+_0x347e7a[_0x9bac('0x2d')][_0x9bac('0x3a')]+'%'};return _0x554c9e;})});}_0x1b90d2[_0x9bac('0x35')]=_['merge'](_0x1b90d2[_0x9bac('0x35')],{'mailboxuser':_0x126fa5[_0x9bac('0x4f')]});_0x1b90d2=_[_0x9bac('0x38')]({},_0x1b90d2,_0x347e7a[_0x9bac('0x50')]);return db[_0x9bac('0x4e')]['findAndCountAll'](_0x1b90d2)['then'](respondWithFilteredResult(_0x5ee66b,_0x1b90d2));})['catch'](handleError(_0x5ee66b,null));}; \ No newline at end of file +var _0xa28d=['UserProfileResource','sendStatus','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','pick','filter','where','type','VIRTUAL','options','include','findAll','rows','catch','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','findAndCountAll','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','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','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xa28d,0x8d));var _0xda28=function(_0x1be172,_0x3ea136){_0x1be172=_0x1be172-0x0;var _0x339ba8=_0xa28d[_0x1be172];return _0x339ba8;};'use strict';var pdf=require(_0xda28('0x0'));var emlformat=require(_0xda28('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda28('0x3'));var moment=require(_0xda28('0x4'));var BPromise=require(_0xda28('0x5'));var Mustache=require(_0xda28('0x6'));var util=require(_0xda28('0x7'));var path=require(_0xda28('0x8'));var sox=require(_0xda28('0x9'));var csv=require('to-csv');var ejs=require(_0xda28('0xa'));var fs=require('fs');var _=require(_0xda28('0xb'));var squel=require(_0xda28('0xc'));var crypto=require(_0xda28('0xd'));var jsforce=require(_0xda28('0xe'));var deskjs=require(_0xda28('0xf'));var toCsv=require('to-csv');var querystring=require(_0xda28('0x10'));var Papa=require(_0xda28('0x11'));var Redis=require(_0xda28('0x12'));var authService=require(_0xda28('0x13'));var qs=require(_0xda28('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda28('0x15'));var logger=require(_0xda28('0x16'))(_0xda28('0x17'));var utils=require(_0xda28('0x18'));var config=require(_0xda28('0x19'));var db=require(_0xda28('0x1a'))['db'];function respondWithStatusCode(_0x583ab2,_0x55432c){_0x55432c=_0x55432c||0xcc;return function(_0x1539f3){if(_0x1539f3){return _0x583ab2['sendStatus'](_0x55432c);}return _0x583ab2['status'](_0x55432c)[_0xda28('0x1b')]();};}function respondWithResult(_0x5ace5a,_0x1e4e0b){_0x1e4e0b=_0x1e4e0b||0xc8;return function(_0x5ea1ef){if(_0x5ea1ef){return _0x5ace5a[_0xda28('0x1c')](_0x1e4e0b)[_0xda28('0x1d')](_0x5ea1ef);}};}function respondWithFilteredResult(_0x3fefab,_0x42bbc){return function(_0x457e9f){if(_0x457e9f){var _0x4eb461=_0x457e9f[_0xda28('0x1e')],_0x501370=_0x42bbc[_0xda28('0x1f')],_0x2374f7=_0x42bbc['offset']+_0x42bbc['limit'],_0x2acddd;if(_0x2374f7>=_0x4eb461){_0x2374f7=_0x4eb461;_0x2acddd=0xc8;}else{_0x2acddd=0xce;}_0x3fefab[_0xda28('0x1c')](_0x2acddd);return _0x3fefab[_0xda28('0x20')](_0xda28('0x21'),_0x501370+'-'+_0x2374f7+'/'+_0x4eb461)[_0xda28('0x1d')](_0x457e9f);}return null;};}function patchUpdates(_0x5231fc){return function(_0x3d2331){try{jsonpatch[_0xda28('0x22')](_0x3d2331,_0x5231fc,!![]);}catch(_0xa4d2e9){return BPromise[_0xda28('0x23')](_0xa4d2e9);}return _0x3d2331[_0xda28('0x24')]();};}function saveUpdates(_0x47a55f,_0x4f4ecd){return function(_0xb8336d){if(_0xb8336d){return _0xb8336d['update'](_0x47a55f)[_0xda28('0x25')](function(_0x326f99){return _0x326f99;});}return null;};}function removeEntity(_0x91a946,_0x4a1d20){return function(_0x2aab7e){if(_0x2aab7e){return _0x2aab7e[_0xda28('0x26')]()[_0xda28('0x25')](function(){var _0x3053e9=_0x2aab7e[_0xda28('0x27')]({'plain':!![]});var _0x1e8693=_0xda28('0x28');return db[_0xda28('0x29')][_0xda28('0x26')]({'where':{'type':_0x1e8693,'resourceId':_0x3053e9['id']}})[_0xda28('0x25')](function(){return _0x2aab7e;});})[_0xda28('0x25')](function(){_0x91a946['status'](0xcc)[_0xda28('0x1b')]();});}};}function handleEntityNotFound(_0x37c3a0,_0x402611){return function(_0x3e6479){if(!_0x3e6479){_0x37c3a0[_0xda28('0x2a')](0x194);}return _0x3e6479;};}function handleError(_0x4b003e,_0x4ce585){_0x4ce585=_0x4ce585||0x1f4;return function(_0x4e94ee){logger['error'](_0x4e94ee[_0xda28('0x2b')]);if(_0x4e94ee[_0xda28('0x2c')]){delete _0x4e94ee['name'];}_0x4b003e[_0xda28('0x1c')](_0x4ce585)[_0xda28('0x2d')](_0x4e94ee);};}exports[_0xda28('0x2e')]=function(_0x4796ea,_0x59674d){var _0x2b9592={},_0x436b36={},_0xff9b10={'count':0x0,'rows':[]};var _0x27ab9e=_[_0xda28('0x2f')](db[_0xda28('0x30')][_0xda28('0x31')],function(_0x211db8){return{'name':_0x211db8[_0xda28('0x32')],'type':_0x211db8['type'][_0xda28('0x33')]};});_0x436b36[_0xda28('0x34')]=_[_0xda28('0x2f')](_0x27ab9e,_0xda28('0x2c'));_0x436b36[_0xda28('0x35')]=_[_0xda28('0x36')](_0x4796ea[_0xda28('0x35')]);_0x436b36[_0xda28('0x37')]=_['intersection'](_0x436b36[_0xda28('0x34')],_0x436b36['query']);_0x2b9592[_0xda28('0x38')]=_[_0xda28('0x39')](_0x436b36[_0xda28('0x34')],qs[_0xda28('0x3a')](_0x4796ea[_0xda28('0x35')]['fields']));_0x2b9592[_0xda28('0x38')]=_0x2b9592[_0xda28('0x38')][_0xda28('0x3b')]?_0x2b9592[_0xda28('0x38')]:_0x436b36[_0xda28('0x34')];if(!_0x4796ea[_0xda28('0x35')]['hasOwnProperty'](_0xda28('0x3c'))){_0x2b9592[_0xda28('0x3d')]=qs[_0xda28('0x3d')](_0x4796ea[_0xda28('0x35')]['limit']);_0x2b9592[_0xda28('0x1f')]=qs['offset'](_0x4796ea[_0xda28('0x35')][_0xda28('0x1f')]);}_0x2b9592[_0xda28('0x3e')]=qs['sort'](_0x4796ea['query']['sort']);_0x2b9592['where']=qs['filters'](_[_0xda28('0x3f')](_0x4796ea[_0xda28('0x35')],_0x436b36[_0xda28('0x37')]),_0x27ab9e);if(_0x4796ea[_0xda28('0x35')][_0xda28('0x40')]){_0x2b9592['where']=_['merge'](_0x2b9592[_0xda28('0x41')],{'$or':_['map'](_0x27ab9e,function(_0x2761d1){if(_0x2761d1[_0xda28('0x42')]!==_0xda28('0x43')){var _0x176d56={};_0x176d56[_0x2761d1[_0xda28('0x2c')]]={'$like':'%'+_0x4796ea[_0xda28('0x35')][_0xda28('0x40')]+'%'};return _0x176d56;}})});}_0x2b9592=_['merge']({},_0x2b9592,_0x4796ea[_0xda28('0x44')]);var _0x335015={'where':_0x2b9592['where']};return db[_0xda28('0x30')]['count'](_0x335015)[_0xda28('0x25')](function(_0xfecf87){_0xff9b10[_0xda28('0x1e')]=_0xfecf87;if(_0x4796ea[_0xda28('0x35')]['includeAll']){_0x2b9592[_0xda28('0x45')]=[{'all':!![]}];}return db[_0xda28('0x30')][_0xda28('0x46')](_0x2b9592);})[_0xda28('0x25')](function(_0x391b0c){_0xff9b10[_0xda28('0x47')]=_0x391b0c;return _0xff9b10;})[_0xda28('0x25')](respondWithFilteredResult(_0x59674d,_0x2b9592))[_0xda28('0x48')](handleError(_0x59674d,null));};exports['show']=function(_0x144afb,_0x362c66){var _0x5ef0cf={'raw':!![],'where':{'id':_0x144afb[_0xda28('0x49')]['id']}},_0x3756f5={};_0x3756f5[_0xda28('0x34')]=_['keys'](db[_0xda28('0x30')][_0xda28('0x31')]);_0x3756f5[_0xda28('0x35')]=_['keys'](_0x144afb['query']);_0x3756f5[_0xda28('0x37')]=_['intersection'](_0x3756f5[_0xda28('0x34')],_0x3756f5[_0xda28('0x35')]);_0x5ef0cf[_0xda28('0x38')]=_[_0xda28('0x39')](_0x3756f5[_0xda28('0x34')],qs['fields'](_0x144afb[_0xda28('0x35')]['fields']));_0x5ef0cf[_0xda28('0x38')]=_0x5ef0cf['attributes']['length']?_0x5ef0cf['attributes']:_0x3756f5[_0xda28('0x34')];if(_0x144afb[_0xda28('0x35')]['includeAll']){_0x5ef0cf[_0xda28('0x45')]=[{'all':!![]}];}_0x5ef0cf=_[_0xda28('0x4a')]({},_0x5ef0cf,_0x144afb['options']);return db['VoiceMail'][_0xda28('0x4b')](_0x5ef0cf)[_0xda28('0x25')](handleEntityNotFound(_0x362c66,null))[_0xda28('0x25')](respondWithResult(_0x362c66,null))[_0xda28('0x48')](handleError(_0x362c66,null));};exports[_0xda28('0x4c')]=function(_0x544fb8,_0x5416cf){return db['VoiceMail']['create'](_0x544fb8['body'],{})[_0xda28('0x25')](function(_0x4b8822){var _0x2535cd=_0x544fb8['user'][_0xda28('0x27')]({'plain':!![]});if(!_0x2535cd)throw new Error(_0xda28('0x4d'));if(_0x2535cd['role']===_0xda28('0x4e')){var _0x11b4dd=_0x4b8822[_0xda28('0x27')]({'plain':!![]});var _0x46929f=_0xda28('0x28');return db[_0xda28('0x4f')][_0xda28('0x4b')]({'where':{'name':_0x46929f,'userProfileId':_0x2535cd[_0xda28('0x50')]},'raw':!![]})[_0xda28('0x25')](function(_0x5030de){if(_0x5030de&&_0x5030de[_0xda28('0x51')]===0x0){return db[_0xda28('0x29')]['create']({'name':_0x11b4dd[_0xda28('0x2c')],'resourceId':_0x11b4dd['id'],'type':_0x5030de[_0xda28('0x2c')],'sectionId':_0x5030de['id']},{})['then'](function(){return _0x4b8822;});}else{return _0x4b8822;}})['catch'](function(_0x3fdb47){logger['error'](_0xda28('0x52'),_0x3fdb47);throw _0x3fdb47;});}return _0x4b8822;})[_0xda28('0x25')](respondWithResult(_0x5416cf,0xc9))[_0xda28('0x48')](handleError(_0x5416cf,null));};exports[_0xda28('0x53')]=function(_0x1549bd,_0x58b6f6){if(_0x1549bd[_0xda28('0x54')]['id']){delete _0x1549bd[_0xda28('0x54')]['id'];}return db['VoiceMail'][_0xda28('0x4b')]({'where':{'id':_0x1549bd[_0xda28('0x49')]['id']}})[_0xda28('0x25')](handleEntityNotFound(_0x58b6f6,null))[_0xda28('0x25')](saveUpdates(_0x1549bd[_0xda28('0x54')],null))[_0xda28('0x25')](respondWithResult(_0x58b6f6,null))[_0xda28('0x48')](handleError(_0x58b6f6,null));};exports['destroy']=function(_0x52cb3f,_0x2cd77e){return db[_0xda28('0x30')]['find']({'where':{'id':_0x52cb3f[_0xda28('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cd77e,null))[_0xda28('0x25')](removeEntity(_0x2cd77e,null))[_0xda28('0x48')](handleError(_0x2cd77e,null));};exports[_0xda28('0x55')]=function(_0x5cf170,_0x11492b,_0x146628){return db[_0xda28('0x30')][_0xda28('0x56')]({'where':{'id':_0x5cf170['params']['id']}})[_0xda28('0x25')](handleEntityNotFound(_0x11492b,null))[_0xda28('0x25')](function(_0x259509){var _0x1d3552;var _0x1d368d={},_0x53da01={};_0x53da01[_0xda28('0x34')]=_['keys'](db[_0xda28('0x57')]['rawAttributes']);_0x53da01[_0xda28('0x35')]=_[_0xda28('0x36')](_0x5cf170[_0xda28('0x35')]);_0x53da01[_0xda28('0x37')]=_[_0xda28('0x39')](_0x53da01[_0xda28('0x34')],_0x53da01['query']);_0x1d368d[_0xda28('0x38')]=_['intersection'](_0x53da01[_0xda28('0x34')],qs[_0xda28('0x3a')](_0x5cf170['query']['fields']));_0x1d368d['attributes']=_0x1d368d[_0xda28('0x38')][_0xda28('0x3b')]?_0x1d368d[_0xda28('0x38')]:_0x53da01[_0xda28('0x34')];if(!_0x5cf170[_0xda28('0x35')][_0xda28('0x58')](_0xda28('0x3c'))){_0x1d368d[_0xda28('0x3d')]=qs[_0xda28('0x3d')](_0x5cf170[_0xda28('0x35')]['limit']);_0x1d368d[_0xda28('0x1f')]=qs[_0xda28('0x1f')](_0x5cf170['query'][_0xda28('0x1f')]);}_0x1d368d[_0xda28('0x3e')]=qs['sort'](_0x5cf170[_0xda28('0x35')][_0xda28('0x59')]);_0x1d368d[_0xda28('0x41')]=qs[_0xda28('0x37')](_[_0xda28('0x3f')](_0x5cf170['query'],_0x53da01[_0xda28('0x37')]));if(_0x5cf170[_0xda28('0x35')][_0xda28('0x40')]){_0x1d368d[_0xda28('0x41')]=_['merge'](_0x1d368d[_0xda28('0x41')],{'$or':_['map'](_0x1d368d['attributes'],function(_0x3493c8){var _0x1e14a2={};_0x1e14a2[_0x3493c8]={'$like':'%'+_0x5cf170[_0xda28('0x35')][_0xda28('0x40')]+'%'};return _0x1e14a2;})});}_0x1d368d[_0xda28('0x41')]=_[_0xda28('0x4a')](_0x1d368d[_0xda28('0x41')],{'mailboxuser':_0x259509['mailbox']});_0x1d368d=_[_0xda28('0x4a')]({},_0x1d368d,_0x5cf170['options']);return db[_0xda28('0x57')][_0xda28('0x5a')](_0x1d368d)[_0xda28('0x25')](respondWithFilteredResult(_0x11492b,_0x1d368d));})['catch'](handleError(_0x11492b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 86bab34..32bf08a 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 _0x90a7=['path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x378eeb,_0xee1b06){var _0x117bde=function(_0x58134c){while(--_0x58134c){_0x378eeb['push'](_0x378eeb['shift']());}};_0x117bde(++_0xee1b06);}(_0x90a7,0x167));var _0x790a=function(_0x314a28,_0x155e5c){_0x314a28=_0x314a28-0x0;var _0x427812=_0x90a7[_0x314a28];return _0x427812;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x790a('0x0'))(_0x790a('0x1'));var moment=require(_0x790a('0x2'));var BPromise=require(_0x790a('0x3'));var rp=require(_0x790a('0x4'));var fs=require('fs');var path=require(_0x790a('0x5'));var rimraf=require(_0x790a('0x6'));var config=require('../../config/environment');var attributes=require(_0x790a('0x7'));module[_0x790a('0x8')]=function(_0xf99e9,_0x54a863){return _0xf99e9[_0x790a('0x9')](_0x790a('0xa'),attributes,{'tableName':_0x790a('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x790a('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc096=['bluebird','path','../../config/environment','exports','define','voice_voicemail','mailbox_context','mailbox','../../config/logger','moment'];(function(_0x2ad9eb,_0x3ed930){var _0x5782d5=function(_0x217bd9){while(--_0x217bd9){_0x2ad9eb['push'](_0x2ad9eb['shift']());}};_0x5782d5(++_0x3ed930);}(_0xc096,0x1ca));var _0x6c09=function(_0x558eb1,_0x502908){_0x558eb1=_0x558eb1-0x0;var _0x2f0b9e=_0xc096[_0x558eb1];return _0x2f0b9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c09('0x0'))('api');var moment=require(_0x6c09('0x1'));var BPromise=require(_0x6c09('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c09('0x3'));var rimraf=require('rimraf');var config=require(_0x6c09('0x4'));var attributes=require('./voiceMail.attributes');module[_0x6c09('0x5')]=function(_0x457616,_0x4a890a){return _0x457616[_0x6c09('0x6')]('VoiceMail',attributes,{'tableName':_0x6c09('0x7'),'paranoid':![],'indexes':[{'name':_0x6c09('0x8'),'fields':[_0x6c09('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f8171c7..4b2c64e 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 _0xfd8b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring'];(function(_0x1d5895,_0x1acd4a){var _0x12977e=function(_0x3edd60){while(--_0x3edd60){_0x1d5895['push'](_0x1d5895['shift']());}};_0x12977e(++_0x1acd4a);}(_0xfd8b,0x123));var _0xbfd8=function(_0x598376,_0x2d79e6){_0x598376=_0x598376-0x0;var _0x2f1482=_0xfd8b[_0x598376];return _0x2f1482;};'use strict';var _=require('lodash');var util=require(_0xbfd8('0x0'));var moment=require('moment');var BPromise=require(_0xbfd8('0x1'));var rs=require(_0xbfd8('0x2'));var fs=require('fs');var Redis=require(_0xbfd8('0x3'));var db=require(_0xbfd8('0x4'))['db'];var utils=require(_0xbfd8('0x5'));var logger=require(_0xbfd8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfd8('0x7'));var client=jayson[_0xbfd8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566c7f,_0x4f61f1,_0x2ca74b){return new BPromise(function(_0x2f5174,_0x13cd52){return client[_0xbfd8('0x9')](_0x566c7f,_0x2ca74b)[_0xbfd8('0xa')](function(_0x35bc85){logger[_0xbfd8('0xb')]('VoiceMail,\x20%s,\x20%s',_0x4f61f1,_0xbfd8('0xc'));logger['debug'](_0xbfd8('0xd'),_0x4f61f1,_0xbfd8('0xc'),JSON[_0xbfd8('0xe')](_0x35bc85));if(_0x35bc85[_0xbfd8('0xf')]){if(_0x35bc85[_0xbfd8('0xf')][_0xbfd8('0x10')]===0x1f4){logger['error'](_0xbfd8('0x11'),_0x4f61f1,_0x35bc85[_0xbfd8('0xf')][_0xbfd8('0x12')]);return _0x13cd52(_0x35bc85['error'][_0xbfd8('0x12')]);}logger[_0xbfd8('0xf')](_0xbfd8('0x11'),_0x4f61f1,_0x35bc85[_0xbfd8('0xf')][_0xbfd8('0x12')]);return _0x2f5174(_0x35bc85[_0xbfd8('0xf')][_0xbfd8('0x12')]);}else{logger[_0xbfd8('0xb')](_0xbfd8('0x11'),_0x4f61f1,_0xbfd8('0xc'));_0x2f5174(_0x35bc85[_0xbfd8('0x13')][_0xbfd8('0x12')]);}})[_0xbfd8('0x14')](function(_0x422ba7){logger[_0xbfd8('0xf')](_0xbfd8('0x11'),_0x4f61f1,_0x422ba7);_0x13cd52(_0x422ba7);});});} \ No newline at end of file +var _0x8252=['../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x103e1d,_0x328a87){var _0x37a18b=function(_0x4fef2a){while(--_0x4fef2a){_0x103e1d['push'](_0x103e1d['shift']());}};_0x37a18b(++_0x328a87);}(_0x8252,0xa1));var _0x2825=function(_0x2dcbfe,_0x13313a){_0x2dcbfe=_0x2dcbfe-0x0;var _0x5f0459=_0x8252[_0x2dcbfe];return _0x5f0459;};'use strict';var _=require(_0x2825('0x0'));var util=require(_0x2825('0x1'));var moment=require(_0x2825('0x2'));var BPromise=require(_0x2825('0x3'));var rs=require(_0x2825('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2825('0x5'))(_0x2825('0x6'));var config=require(_0x2825('0x7'));var jayson=require(_0x2825('0x8'));var client=jayson[_0x2825('0x9')][_0x2825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d13ce,_0x3e4760,_0x8d2e6){return new BPromise(function(_0x17389f,_0x2b320f){return client[_0x2825('0xb')](_0x4d13ce,_0x8d2e6)[_0x2825('0xc')](function(_0x5a68e0){logger[_0x2825('0xd')]('VoiceMail,\x20%s,\x20%s',_0x3e4760,'request\x20sent');logger[_0x2825('0xe')](_0x2825('0xf'),_0x3e4760,_0x2825('0x10'),JSON[_0x2825('0x11')](_0x5a68e0));if(_0x5a68e0['error']){if(_0x5a68e0['error'][_0x2825('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x3e4760,_0x5a68e0[_0x2825('0x13')]['message']);return _0x2b320f(_0x5a68e0[_0x2825('0x13')][_0x2825('0x14')]);}logger[_0x2825('0x13')](_0x2825('0x15'),_0x3e4760,_0x5a68e0[_0x2825('0x13')][_0x2825('0x14')]);return _0x17389f(_0x5a68e0[_0x2825('0x13')][_0x2825('0x14')]);}else{logger[_0x2825('0xd')](_0x2825('0x15'),_0x3e4760,'request\x20sent');_0x17389f(_0x5a68e0[_0x2825('0x16')][_0x2825('0x14')]);}})[_0x2825('0x17')](function(_0x37f939){logger['error'](_0x2825('0x15'),_0x3e4760,_0x37f939);_0x2b320f(_0x37f939);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4276c1e..75be4f0 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','download','create','delete','exports','multer'];(function(_0x459d30,_0x4e010e){var _0x49526c=function(_0x20772b){while(--_0x20772b){_0x459d30['push'](_0x459d30['shift']());}};_0x49526c(++_0x4e010e);}(_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')]('/:id/download',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['post']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee2f('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0xc6ac=['show','download','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x37830f,_0xd39d9f){var _0x1ed3d6=function(_0x365088){while(--_0x365088){_0x37830f['push'](_0x37830f['shift']());}};_0x1ed3d6(++_0xd39d9f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x87c106,_0xdc8cf9){_0x87c106=_0x87c106-0x0;var _0x2bbbf7=_0xc6ac[_0x87c106];return _0x2bbbf7;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xa')]('/:id/download',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xe')]);router[_0xcc6a('0xf')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x10')]);router['put'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 63a8fac..c124025 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 _0xd018=['long','TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB'];(function(_0x3352bc,_0x56d886){var _0x498667=function(_0x150a17){while(--_0x150a17){_0x3352bc['push'](_0x3352bc['shift']());}};_0x498667(++_0x56d886);}(_0xd018,0x105));var _0x8d01=function(_0x2b263d,_0x83f114){_0x2b263d=_0x2b263d-0x0;var _0x4f2569=_0xd018[_0x2b263d];return _0x4f2569;};'use strict';var Sequelize=require('sequelize');module[_0x8d01('0x0')]={'name':{'type':Sequelize[_0x8d01('0x1')],'get':function(_0x482392){return this[_0x8d01('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x8d01('0x4')](_0x8d01('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8d01('0x3')],'defaultValue':''},'stamp':{'type':_0x8d01('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xfa5d=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa5d,0x1ee));var _0xdfa5=function(_0x5a98b8,_0x3a4eaf){_0x5a98b8=_0x5a98b8-0x0;var _0x14efd3=_0xfa5d[_0x5a98b8];return _0x14efd3;};'use strict';var Sequelize=require(_0xdfa5('0x0'));module[_0xdfa5('0x1')]={'name':{'type':Sequelize[_0xdfa5('0x2')],'get':function(_0x18e5d6){return this[_0xdfa5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xdfa5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xdfa5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':''},'stamp':{'type':_0xdfa5('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 39da83d..348620c 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 _0xd7a0=['recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','Content-Range','save','update','then','destroy','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','differenceBy','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','VoiceMailMessage','findAll','rows','show','params','includeAll','find','catch','create','body','download'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0xd7a0,0x163));var _0x0d7a=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0xd7a0[_0x2a5b3b];return _0xae665a;};'use strict';var pdf=require(_0x0d7a('0x0'));var emlformat=require(_0x0d7a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d7a('0x3'));var moment=require(_0x0d7a('0x4'));var BPromise=require(_0x0d7a('0x5'));var Mustache=require(_0x0d7a('0x6'));var util=require(_0x0d7a('0x7'));var path=require('path');var sox=require(_0x0d7a('0x8'));var csv=require(_0x0d7a('0x9'));var ejs=require(_0x0d7a('0xa'));var fs=require('fs');var _=require(_0x0d7a('0xb'));var squel=require(_0x0d7a('0xc'));var crypto=require(_0x0d7a('0xd'));var jsforce=require(_0x0d7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d7a('0x9'));var querystring=require(_0x0d7a('0xf'));var Papa=require(_0x0d7a('0x10'));var Redis=require(_0x0d7a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d7a('0x12'));var as=require(_0x0d7a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d7a('0x14'))(_0x0d7a('0x15'));var utils=require(_0x0d7a('0x16'));var config=require(_0x0d7a('0x17'));var db=require(_0x0d7a('0x18'))['db'];function respondWithStatusCode(_0x4fe358,_0x5432bb){_0x5432bb=_0x5432bb||0xcc;return function(_0x30b43e){if(_0x30b43e){return _0x4fe358[_0x0d7a('0x19')](_0x5432bb);}return _0x4fe358[_0x0d7a('0x1a')](_0x5432bb)['end']();};}function respondWithResult(_0x2f2449,_0x4d2c9d){_0x4d2c9d=_0x4d2c9d||0xc8;return function(_0x51b844){if(_0x51b844){return _0x2f2449[_0x0d7a('0x1a')](_0x4d2c9d)['json'](_0x51b844);}};}function respondWithFilteredResult(_0x42f5b0,_0x84d9a4){return function(_0xfd77c){if(_0xfd77c){var _0x1a06b1=_0xfd77c['count'],_0x4bb62c=_0x84d9a4[_0x0d7a('0x1b')],_0x1999d7=_0x84d9a4[_0x0d7a('0x1b')]+_0x84d9a4[_0x0d7a('0x1c')],_0x5f5c18;if(_0x1999d7>=_0x1a06b1){_0x1999d7=_0x1a06b1;_0x5f5c18=0xc8;}else{_0x5f5c18=0xce;}_0x42f5b0[_0x0d7a('0x1a')](_0x5f5c18);return _0x42f5b0['set'](_0x0d7a('0x1d'),_0x4bb62c+'-'+_0x1999d7+'/'+_0x1a06b1)['json'](_0xfd77c);}return null;};}function patchUpdates(_0x569285){return function(_0x4e7ec4){try{jsonpatch['apply'](_0x4e7ec4,_0x569285,!![]);}catch(_0x3a55c6){return BPromise['reject'](_0x3a55c6);}return _0x4e7ec4[_0x0d7a('0x1e')]();};}function saveUpdates(_0x2264c3,_0x4c997f){return function(_0x884472){if(_0x884472){return _0x884472[_0x0d7a('0x1f')](_0x2264c3)[_0x0d7a('0x20')](function(_0x1b0dd8){return _0x1b0dd8;});}return null;};}function removeEntity(_0x542a24,_0x4291b8){return function(_0x2c11b6){if(_0x2c11b6){return _0x2c11b6[_0x0d7a('0x21')]()['then'](function(){_0x542a24['status'](0xcc)[_0x0d7a('0x22')]();});}};}function handleEntityNotFound(_0xbd4e67,_0x2f1d5b){return function(_0x1944ba){if(!_0x1944ba){_0xbd4e67[_0x0d7a('0x19')](0x194);}return _0x1944ba;};}function handleError(_0x551171,_0x14670c){_0x14670c=_0x14670c||0x1f4;return function(_0x1c9ad5){logger[_0x0d7a('0x23')](_0x1c9ad5[_0x0d7a('0x24')]);if(_0x1c9ad5['name']){delete _0x1c9ad5['name'];}_0x551171[_0x0d7a('0x1a')](_0x14670c)[_0x0d7a('0x25')](_0x1c9ad5);};}exports[_0x0d7a('0x26')]=function(_0x2815f9,_0x2d3631){var _0x177208={},_0x37cc5f={},_0x20abcb={'count':0x0,'rows':[]};var _0x4c8e8b=_[_0x0d7a('0x27')](db['VoiceMailMessage'][_0x0d7a('0x28')],function(_0x18f651){return{'name':_0x18f651[_0x0d7a('0x29')],'type':_0x18f651[_0x0d7a('0x2a')][_0x0d7a('0x2b')]};});_0x37cc5f['model']=_[_0x0d7a('0x2c')](_[_0x0d7a('0x27')](_0x4c8e8b,_0x0d7a('0x2d')),['name']);_0x37cc5f[_0x0d7a('0x2e')]=_[_0x0d7a('0x2f')](_0x2815f9['query']);_0x37cc5f[_0x0d7a('0x30')]=_[_0x0d7a('0x31')](_0x37cc5f[_0x0d7a('0x32')],_0x37cc5f['query']);_0x177208[_0x0d7a('0x33')]=_['intersection'](_0x37cc5f[_0x0d7a('0x32')],qs[_0x0d7a('0x34')](_0x2815f9['query'][_0x0d7a('0x34')]));_0x177208[_0x0d7a('0x33')]=_0x177208[_0x0d7a('0x33')][_0x0d7a('0x35')]?_0x177208[_0x0d7a('0x33')]:_0x37cc5f[_0x0d7a('0x32')];if(!_0x2815f9[_0x0d7a('0x2e')]['hasOwnProperty'](_0x0d7a('0x36'))){_0x177208[_0x0d7a('0x1c')]=qs['limit'](_0x2815f9[_0x0d7a('0x2e')]['limit']);_0x177208['offset']=qs[_0x0d7a('0x1b')](_0x2815f9[_0x0d7a('0x2e')][_0x0d7a('0x1b')]);}_0x177208['order']=qs[_0x0d7a('0x37')](_0x2815f9[_0x0d7a('0x2e')][_0x0d7a('0x37')]);_0x177208[_0x0d7a('0x38')]=qs[_0x0d7a('0x30')](_[_0x0d7a('0x39')](_0x2815f9[_0x0d7a('0x2e')],_0x37cc5f[_0x0d7a('0x30')]),_0x4c8e8b);if(_0x2815f9[_0x0d7a('0x2e')][_0x0d7a('0x3a')]){_0x177208[_0x0d7a('0x38')]=_[_0x0d7a('0x3b')](_0x177208[_0x0d7a('0x38')],{'$or':_['map'](_0x4c8e8b,function(_0x5cd533){if(_0x5cd533[_0x0d7a('0x2a')]!==_0x0d7a('0x3c')){var _0x4f5d90={};_0x4f5d90[_0x5cd533[_0x0d7a('0x2d')]]={'$like':'%'+_0x2815f9[_0x0d7a('0x2e')]['filter']+'%'};return _0x4f5d90;}})});}_0x177208=_[_0x0d7a('0x3b')]({},_0x177208,_0x2815f9[_0x0d7a('0x3d')]);var _0x4d1987={'where':_0x177208[_0x0d7a('0x38')]};return db['VoiceMailMessage'][_0x0d7a('0x3e')](_0x4d1987)['then'](function(_0x5dfd82){_0x20abcb[_0x0d7a('0x3e')]=_0x5dfd82;if(_0x2815f9['query']['includeAll']){_0x177208[_0x0d7a('0x3f')]=[{'all':!![]}];}return db[_0x0d7a('0x40')][_0x0d7a('0x41')](_0x177208);})['then'](function(_0x13b378){_0x20abcb[_0x0d7a('0x42')]=_0x13b378;return _0x20abcb;})[_0x0d7a('0x20')](respondWithFilteredResult(_0x2d3631,_0x177208))['catch'](handleError(_0x2d3631,null));};exports[_0x0d7a('0x43')]=function(_0xb6b62,_0x524712){var _0x4c9c50={'raw':!![],'where':{'id':_0xb6b62[_0x0d7a('0x44')]['id']}},_0xadccd7={};_0xadccd7['model']=_[_0x0d7a('0x2f')](db[_0x0d7a('0x40')][_0x0d7a('0x28')]);_0xadccd7[_0x0d7a('0x2e')]=_[_0x0d7a('0x2f')](_0xb6b62[_0x0d7a('0x2e')]);_0xadccd7[_0x0d7a('0x30')]=_[_0x0d7a('0x31')](_0xadccd7[_0x0d7a('0x32')],_0xadccd7[_0x0d7a('0x2e')]);_0x4c9c50[_0x0d7a('0x33')]=_[_0x0d7a('0x31')](_0xadccd7[_0x0d7a('0x32')],qs[_0x0d7a('0x34')](_0xb6b62[_0x0d7a('0x2e')][_0x0d7a('0x34')]));_0x4c9c50['attributes']=_0x4c9c50[_0x0d7a('0x33')][_0x0d7a('0x35')]?_0x4c9c50['attributes']:_0xadccd7['model'];if(_0xb6b62['query'][_0x0d7a('0x45')]){_0x4c9c50[_0x0d7a('0x3f')]=[{'all':!![]}];}_0x4c9c50=_[_0x0d7a('0x3b')]({},_0x4c9c50,_0xb6b62['options']);return db[_0x0d7a('0x40')][_0x0d7a('0x46')](_0x4c9c50)[_0x0d7a('0x20')](handleEntityNotFound(_0x524712,null))['then'](respondWithResult(_0x524712,null))[_0x0d7a('0x47')](handleError(_0x524712,null));};exports[_0x0d7a('0x48')]=function(_0x2a297a,_0x2a5f5e){return db[_0x0d7a('0x40')][_0x0d7a('0x48')](_0x2a297a['body'],{})[_0x0d7a('0x20')](respondWithResult(_0x2a5f5e,0xc9))['catch'](handleError(_0x2a5f5e,null));};exports['update']=function(_0x3f53ac,_0x14491e){if(_0x3f53ac[_0x0d7a('0x49')]['id']){delete _0x3f53ac[_0x0d7a('0x49')]['id'];}return db[_0x0d7a('0x40')]['find']({'where':{'id':_0x3f53ac[_0x0d7a('0x44')]['id']}})[_0x0d7a('0x20')](handleEntityNotFound(_0x14491e,null))[_0x0d7a('0x20')](saveUpdates(_0x3f53ac[_0x0d7a('0x49')],null))['then'](respondWithResult(_0x14491e,null))[_0x0d7a('0x47')](handleError(_0x14491e,null));};exports[_0x0d7a('0x21')]=function(_0x40a0d8,_0x1b82de){return db[_0x0d7a('0x40')][_0x0d7a('0x46')]({'where':{'id':_0x40a0d8[_0x0d7a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b82de,null))[_0x0d7a('0x20')](removeEntity(_0x1b82de,null))[_0x0d7a('0x47')](handleError(_0x1b82de,null));};exports[_0x0d7a('0x4a')]=function(_0x11027c,_0x4ed0eb,_0x37fa20){return db[_0x0d7a('0x40')][_0x0d7a('0x46')]({'where':{'id':_0x11027c[_0x0d7a('0x44')]['id']},'attributes':['id',_0x0d7a('0x4b'),_0x0d7a('0x4c')]})[_0x0d7a('0x20')](handleEntityNotFound(_0x4ed0eb,null))[_0x0d7a('0x20')](function(_0x3664d2){if(_0x3664d2){if(!_0x3664d2['recording']){throw new db[(_0x0d7a('0x4d'))][(_0x0d7a('0x4e'))](_0x0d7a('0x4f'));}var _0x50f549={'Content-Type':_0x0d7a('0x50'),'Content-Disposition':_0x0d7a('0x51')};if(_0x3664d2[_0x0d7a('0x4c')]){_0x50f549[_0x0d7a('0x52')]=_0x0d7a('0x53')+_0x3664d2[_0x0d7a('0x4c')]+_0x0d7a('0x54');}_0x4ed0eb[_0x0d7a('0x55')](_0x50f549);return _0x4ed0eb[_0x0d7a('0x25')](new Buffer(_0x3664d2['recording']));}})[_0x0d7a('0x47')](handleError(_0x4ed0eb,null));}; \ No newline at end of file +var _0xcea2=['hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x377399,_0x161596){var _0x133fcc=function(_0x1c97ca){while(--_0x1c97ca){_0x377399['push'](_0x377399['shift']());}};_0x133fcc(++_0x161596);}(_0xcea2,0x15a));var _0x2cea=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcea2[_0x36eaaa];return _0x461349;};'use strict';var pdf=require(_0x2cea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cea('0x2'));var rp=require(_0x2cea('0x3'));var moment=require(_0x2cea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cea('0x5'));var util=require(_0x2cea('0x6'));var path=require(_0x2cea('0x7'));var sox=require('sox');var csv=require(_0x2cea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0x8'));var querystring=require('querystring');var Papa=require(_0x2cea('0xe'));var Redis=require(_0x2cea('0xf'));var authService=require(_0x2cea('0x10'));var qs=require(_0x2cea('0x11'));var as=require(_0x2cea('0x12'));var hardwareService=require(_0x2cea('0x13'));var logger=require(_0x2cea('0x14'))(_0x2cea('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2cea('0x16'))['db'];function respondWithStatusCode(_0x2db0ff,_0x528c1d){_0x528c1d=_0x528c1d||0xcc;return function(_0x4bd265){if(_0x4bd265){return _0x2db0ff[_0x2cea('0x17')](_0x528c1d);}return _0x2db0ff['status'](_0x528c1d)[_0x2cea('0x18')]();};}function respondWithResult(_0xc5d08e,_0x4377b1){_0x4377b1=_0x4377b1||0xc8;return function(_0x5cf805){if(_0x5cf805){return _0xc5d08e['status'](_0x4377b1)['json'](_0x5cf805);}};}function respondWithFilteredResult(_0x369c72,_0x586ad5){return function(_0x3c7130){if(_0x3c7130){var _0x338669=_0x3c7130[_0x2cea('0x19')],_0x981e3f=_0x586ad5[_0x2cea('0x1a')],_0x17322c=_0x586ad5[_0x2cea('0x1a')]+_0x586ad5['limit'],_0x232dad;if(_0x17322c>=_0x338669){_0x17322c=_0x338669;_0x232dad=0xc8;}else{_0x232dad=0xce;}_0x369c72[_0x2cea('0x1b')](_0x232dad);return _0x369c72[_0x2cea('0x1c')](_0x2cea('0x1d'),_0x981e3f+'-'+_0x17322c+'/'+_0x338669)[_0x2cea('0x1e')](_0x3c7130);}return null;};}function patchUpdates(_0xa1d749){return function(_0x17dc48){try{jsonpatch['apply'](_0x17dc48,_0xa1d749,!![]);}catch(_0x27375b){return BPromise['reject'](_0x27375b);}return _0x17dc48[_0x2cea('0x1f')]();};}function saveUpdates(_0x5516c8,_0xa73bea){return function(_0x4fd3d5){if(_0x4fd3d5){return _0x4fd3d5[_0x2cea('0x20')](_0x5516c8)[_0x2cea('0x21')](function(_0x210d7e){return _0x210d7e;});}return null;};}function removeEntity(_0x1b389b,_0x3246bc){return function(_0x3f6f0e){if(_0x3f6f0e){return _0x3f6f0e[_0x2cea('0x22')]()['then'](function(){_0x1b389b[_0x2cea('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(!_0x3966d5){_0x7d88b9[_0x2cea('0x17')](0x194);}return _0x3966d5;};}function handleError(_0x56807e,_0x41d272){_0x41d272=_0x41d272||0x1f4;return function(_0xd4bd54){logger[_0x2cea('0x23')](_0xd4bd54[_0x2cea('0x24')]);if(_0xd4bd54[_0x2cea('0x25')]){delete _0xd4bd54[_0x2cea('0x25')];}_0x56807e['status'](_0x41d272)[_0x2cea('0x26')](_0xd4bd54);};}exports[_0x2cea('0x27')]=function(_0x2bbe9b,_0x32af98){var _0x46ef5a={},_0x3ea40c={},_0xe99cca={'count':0x0,'rows':[]};var _0x2741cb=_['map'](db[_0x2cea('0x28')][_0x2cea('0x29')],function(_0x5f3fb4){return{'name':_0x5f3fb4[_0x2cea('0x2a')],'type':_0x5f3fb4[_0x2cea('0x2b')][_0x2cea('0x2c')]};});_0x3ea40c[_0x2cea('0x2d')]=_['differenceBy'](_[_0x2cea('0x2e')](_0x2741cb,_0x2cea('0x25')),['name']);_0x3ea40c[_0x2cea('0x2f')]=_[_0x2cea('0x30')](_0x2bbe9b[_0x2cea('0x2f')]);_0x3ea40c[_0x2cea('0x31')]=_[_0x2cea('0x32')](_0x3ea40c[_0x2cea('0x2d')],_0x3ea40c[_0x2cea('0x2f')]);_0x46ef5a[_0x2cea('0x33')]=_[_0x2cea('0x32')](_0x3ea40c[_0x2cea('0x2d')],qs[_0x2cea('0x34')](_0x2bbe9b['query'][_0x2cea('0x34')]));_0x46ef5a[_0x2cea('0x33')]=_0x46ef5a[_0x2cea('0x33')][_0x2cea('0x35')]?_0x46ef5a['attributes']:_0x3ea40c['model'];if(!_0x2bbe9b[_0x2cea('0x2f')][_0x2cea('0x36')]('nolimit')){_0x46ef5a[_0x2cea('0x37')]=qs['limit'](_0x2bbe9b[_0x2cea('0x2f')]['limit']);_0x46ef5a[_0x2cea('0x1a')]=qs['offset'](_0x2bbe9b[_0x2cea('0x2f')][_0x2cea('0x1a')]);}_0x46ef5a['order']=qs[_0x2cea('0x38')](_0x2bbe9b[_0x2cea('0x2f')]['sort']);_0x46ef5a[_0x2cea('0x39')]=qs[_0x2cea('0x31')](_[_0x2cea('0x3a')](_0x2bbe9b[_0x2cea('0x2f')],_0x3ea40c[_0x2cea('0x31')]),_0x2741cb);if(_0x2bbe9b['query'][_0x2cea('0x3b')]){_0x46ef5a[_0x2cea('0x39')]=_['merge'](_0x46ef5a['where'],{'$or':_[_0x2cea('0x2e')](_0x2741cb,function(_0x4a3cd8){if(_0x4a3cd8['type']!=='VIRTUAL'){var _0x50f632={};_0x50f632[_0x4a3cd8[_0x2cea('0x25')]]={'$like':'%'+_0x2bbe9b[_0x2cea('0x2f')]['filter']+'%'};return _0x50f632;}})});}_0x46ef5a=_[_0x2cea('0x3c')]({},_0x46ef5a,_0x2bbe9b[_0x2cea('0x3d')]);var _0x249aaa={'where':_0x46ef5a['where']};return db[_0x2cea('0x28')][_0x2cea('0x19')](_0x249aaa)[_0x2cea('0x21')](function(_0x37d175){_0xe99cca[_0x2cea('0x19')]=_0x37d175;if(_0x2bbe9b[_0x2cea('0x2f')][_0x2cea('0x3e')]){_0x46ef5a[_0x2cea('0x3f')]=[{'all':!![]}];}return db[_0x2cea('0x28')][_0x2cea('0x40')](_0x46ef5a);})[_0x2cea('0x21')](function(_0x1516a2){_0xe99cca[_0x2cea('0x41')]=_0x1516a2;return _0xe99cca;})[_0x2cea('0x21')](respondWithFilteredResult(_0x32af98,_0x46ef5a))[_0x2cea('0x42')](handleError(_0x32af98,null));};exports[_0x2cea('0x43')]=function(_0x36efa8,_0xa0692d){var _0x49fcfa={'raw':!![],'where':{'id':_0x36efa8['params']['id']}},_0x294057={};_0x294057[_0x2cea('0x2d')]=_[_0x2cea('0x30')](db[_0x2cea('0x28')][_0x2cea('0x29')]);_0x294057[_0x2cea('0x2f')]=_[_0x2cea('0x30')](_0x36efa8[_0x2cea('0x2f')]);_0x294057[_0x2cea('0x31')]=_[_0x2cea('0x32')](_0x294057[_0x2cea('0x2d')],_0x294057['query']);_0x49fcfa['attributes']=_[_0x2cea('0x32')](_0x294057[_0x2cea('0x2d')],qs['fields'](_0x36efa8[_0x2cea('0x2f')]['fields']));_0x49fcfa[_0x2cea('0x33')]=_0x49fcfa['attributes'][_0x2cea('0x35')]?_0x49fcfa[_0x2cea('0x33')]:_0x294057[_0x2cea('0x2d')];if(_0x36efa8[_0x2cea('0x2f')][_0x2cea('0x3e')]){_0x49fcfa[_0x2cea('0x3f')]=[{'all':!![]}];}_0x49fcfa=_[_0x2cea('0x3c')]({},_0x49fcfa,_0x36efa8[_0x2cea('0x3d')]);return db[_0x2cea('0x28')][_0x2cea('0x44')](_0x49fcfa)['then'](handleEntityNotFound(_0xa0692d,null))[_0x2cea('0x21')](respondWithResult(_0xa0692d,null))[_0x2cea('0x42')](handleError(_0xa0692d,null));};exports[_0x2cea('0x45')]=function(_0x348baf,_0x568899){return db['VoiceMailMessage'][_0x2cea('0x45')](_0x348baf[_0x2cea('0x46')],{})[_0x2cea('0x21')](respondWithResult(_0x568899,0xc9))['catch'](handleError(_0x568899,null));};exports[_0x2cea('0x20')]=function(_0x1e8d0f,_0x4223d8){if(_0x1e8d0f[_0x2cea('0x46')]['id']){delete _0x1e8d0f['body']['id'];}return db[_0x2cea('0x28')]['find']({'where':{'id':_0x1e8d0f['params']['id']}})[_0x2cea('0x21')](handleEntityNotFound(_0x4223d8,null))[_0x2cea('0x21')](saveUpdates(_0x1e8d0f[_0x2cea('0x46')],null))[_0x2cea('0x21')](respondWithResult(_0x4223d8,null))['catch'](handleError(_0x4223d8,null));};exports['destroy']=function(_0x3c8ede,_0x4278e5){return db[_0x2cea('0x28')][_0x2cea('0x44')]({'where':{'id':_0x3c8ede['params']['id']}})['then'](handleEntityNotFound(_0x4278e5,null))['then'](removeEntity(_0x4278e5,null))[_0x2cea('0x42')](handleError(_0x4278e5,null));};exports[_0x2cea('0x47')]=function(_0x127069,_0x25dc12,_0x1e9937){return db[_0x2cea('0x28')][_0x2cea('0x44')]({'where':{'id':_0x127069['params']['id']},'attributes':['id',_0x2cea('0x48'),_0x2cea('0x49')]})[_0x2cea('0x21')](handleEntityNotFound(_0x25dc12,null))['then'](function(_0x103f18){if(_0x103f18){if(!_0x103f18['recording']){throw new db[(_0x2cea('0x4a'))][(_0x2cea('0x4b'))](_0x2cea('0x4c'));}var _0xc8a4b5={'Content-Type':_0x2cea('0x4d'),'Content-Disposition':_0x2cea('0x4e')};if(_0x103f18[_0x2cea('0x49')]){_0xc8a4b5[_0x2cea('0x4f')]='attachment;\x20filename=\x22'+_0x103f18[_0x2cea('0x49')]+'.wav\x22';}_0x25dc12[_0x2cea('0x1c')](_0xc8a4b5);return _0x25dc12[_0x2cea('0x26')](new Buffer(_0x103f18[_0x2cea('0x48')]));}})['catch'](handleError(_0x25dc12,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4099cd3..75fab7a 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 _0x4ffe=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x15aacf,_0x2887aa){var _0x2796f9=function(_0x28d775){while(--_0x28d775){_0x15aacf['push'](_0x15aacf['shift']());}};_0x2796f9(++_0x2887aa);}(_0x4ffe,0x172));var _0xe4ff=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0x4ffe[_0x400b64];return _0x1d615d;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var logger=require(_0xe4ff('0x2'))('api');var moment=require(_0xe4ff('0x3'));var BPromise=require(_0xe4ff('0x4'));var rp=require(_0xe4ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4ff('0x6'));var config=require(_0xe4ff('0x7'));var attributes=require(_0xe4ff('0x8'));module[_0xe4ff('0x9')]=function(_0x68c0c7,_0x50250d){return _0x68c0c7[_0xe4ff('0xa')](_0xe4ff('0xb'),attributes,{'tableName':_0xe4ff('0xc'),'paranoid':![],'indexes':[{'name':_0xe4ff('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x7fce=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x37bb04,_0x26cb1b){var _0x1dded9=function(_0x199f3a){while(--_0x199f3a){_0x37bb04['push'](_0x37bb04['shift']());}};_0x1dded9(++_0x26cb1b);}(_0x7fce,0xdc));var _0xe7fc=function(_0x76a110,_0x21ff24){_0x76a110=_0x76a110-0x0;var _0x33fb3e=_0x7fce[_0x76a110];return _0x33fb3e;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var logger=require(_0xe7fc('0x2'))('api');var moment=require(_0xe7fc('0x3'));var BPromise=require('bluebird');var rp=require(_0xe7fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x223d07,_0x51c63b){return _0x223d07[_0xe7fc('0x7')](_0xe7fc('0x8'),attributes,{'tableName':_0xe7fc('0x9'),'paranoid':![],'indexes':[{'name':_0xe7fc('0xa'),'fields':[_0xe7fc('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e3eeaa7..55c3b60 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x384117,_0x5c65ee){_0x384117=_0x384117-0x0;var _0x23a2d7=_0x7a54[_0x384117];return _0x23a2d7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3a89f8,_0x14b4f1){var _0x26e4cb=function(_0x47dce1){while(--_0x47dce1){_0x3a89f8['push'](_0x3a89f8['shift']());}};_0x26e4cb(++_0x14b4f1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 490da78..12191fc 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 _0xa6b9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','put','update','delete','removeSound','exports','multer','util','path','connect-timeout','express'];(function(_0x5780ba,_0x4c7ab6){var _0x7c431e=function(_0x3524cf){while(--_0x3524cf){_0x5780ba['push'](_0x5780ba['shift']());}};_0x7c431e(++_0x4c7ab6);}(_0xa6b9,0xb8));var _0x9a6b=function(_0x579339,_0x2c974c){_0x579339=_0x579339-0x0;var _0x53e88f=_0xa6b9[_0x579339];return _0x53e88f;};'use strict';var multer=require(_0x9a6b('0x0'));var util=require(_0x9a6b('0x1'));var path=require(_0x9a6b('0x2'));var timeout=require(_0x9a6b('0x3'));var express=require(_0x9a6b('0x4'));var router=express['Router']();var auth=require(_0x9a6b('0x5'));var interaction=require(_0x9a6b('0x6'));var config=require(_0x9a6b('0x7'));var controller=require(_0x9a6b('0x8'));router[_0x9a6b('0x9')]('/',auth[_0x9a6b('0xa')](),controller[_0x9a6b('0xb')]);router[_0x9a6b('0x9')](_0x9a6b('0xc'),auth[_0x9a6b('0xa')](),controller[_0x9a6b('0xd')]);router[_0x9a6b('0x9')](_0x9a6b('0xe'),auth[_0x9a6b('0xa')](),controller['getSounds']);router['post']('/',auth[_0x9a6b('0xa')](),controller['create']);router[_0x9a6b('0xf')](_0x9a6b('0xe'),auth['isAuthenticated'](),controller['addSound']);router[_0x9a6b('0x10')](_0x9a6b('0xc'),auth[_0x9a6b('0xa')](),controller[_0x9a6b('0x11')]);router[_0x9a6b('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x9a6b('0x12')]('/:id/sounds/:id2',auth[_0x9a6b('0xa')](),controller[_0x9a6b('0x13')]);module[_0x9a6b('0x14')]=router; \ No newline at end of file +var _0x7bd1=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer'];(function(_0x118080,_0x22e694){var _0x3d36d3=function(_0x43a90f){while(--_0x43a90f){_0x118080['push'](_0x118080['shift']());}};_0x3d36d3(++_0x22e694);}(_0x7bd1,0x141));var _0x17bd=function(_0x5943d1,_0x59cdc4){_0x5943d1=_0x5943d1-0x0;var _0x4f0631=_0x7bd1[_0x5943d1];return _0x4f0631;};'use strict';var multer=require(_0x17bd('0x0'));var util=require(_0x17bd('0x1'));var path=require('path');var timeout=require(_0x17bd('0x2'));var express=require(_0x17bd('0x3'));var router=express[_0x17bd('0x4')]();var auth=require(_0x17bd('0x5'));var interaction=require(_0x17bd('0x6'));var config=require('../../config/environment');var controller=require(_0x17bd('0x7'));router[_0x17bd('0x8')]('/',auth[_0x17bd('0x9')](),controller[_0x17bd('0xa')]);router[_0x17bd('0x8')](_0x17bd('0xb'),auth[_0x17bd('0x9')](),controller['show']);router[_0x17bd('0x8')](_0x17bd('0xc'),auth[_0x17bd('0x9')](),controller[_0x17bd('0xd')]);router[_0x17bd('0xe')]('/',auth[_0x17bd('0x9')](),controller[_0x17bd('0xf')]);router[_0x17bd('0xe')]('/:id/sounds',auth[_0x17bd('0x9')](),controller[_0x17bd('0x10')]);router[_0x17bd('0x11')](_0x17bd('0xb'),auth[_0x17bd('0x9')](),controller[_0x17bd('0x12')]);router[_0x17bd('0x13')](_0x17bd('0xb'),auth[_0x17bd('0x9')](),controller[_0x17bd('0x14')]);router['delete'](_0x17bd('0x15'),auth[_0x17bd('0x9')](),controller['removeSound']);module[_0x17bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index bf6306f..509cd22 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 _0x3139=['name','custom','files','quietmp3nb','mp3','alpha','sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3139,0x138));var _0x9313=function(_0x592efe,_0x425f81){_0x592efe=_0x592efe-0x0;var _0x5413a6=_0x3139[_0x592efe];return _0x5413a6;};'use strict';var Sequelize=require(_0x9313('0x0'));module[_0x9313('0x1')]={'name':{'type':Sequelize[_0x9313('0x2')],'allowNull':![],'unique':_0x9313('0x3')},'mode':{'type':Sequelize['ENUM'](_0x9313('0x4'),_0x9313('0x5'),'mp3nb',_0x9313('0x6'),'quietmp3',_0x9313('0x7')),'allowNull':!![],'defaultValue':_0x9313('0x5')},'directory':{'type':Sequelize[_0x9313('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9313('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9313('0x8')},'format':{'type':Sequelize[_0x9313('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf87e=['ENUM','files','quietmp3nb','quietmp3','mp3','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x22bea5,_0x2dc602){var _0x284321=function(_0x423581){while(--_0x423581){_0x22bea5['push'](_0x22bea5['shift']());}};_0x284321(++_0x2dc602);}(_0xf87e,0x13c));var _0xef87=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf87e[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xef87('0x0'));module[_0xef87('0x1')]={'name':{'type':Sequelize[_0xef87('0x2')],'allowNull':![],'unique':_0xef87('0x3')},'mode':{'type':Sequelize[_0xef87('0x4')]('custom',_0xef87('0x5'),'mp3nb',_0xef87('0x6'),_0xef87('0x7'),_0xef87('0x8')),'allowNull':!![],'defaultValue':_0xef87('0x5')},'directory':{'type':Sequelize[_0xef87('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xef87('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xef87('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xef87('0x2')],'allowNull':!![]},'stamp':{'type':_0xef87('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 9256e3c..b742a4d 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(_0x3dd2c2,_0x22e7cd){var _0x451dc1=function(_0x55288c){while(--_0x55288c){_0x3dd2c2['push'](_0x3dd2c2['shift']());}};_0x451dc1(++_0x22e7cd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x5ceb01,_0x570521){var _0x40b6a5=function(_0x2d43d3){while(--_0x2d43d3){_0x5ceb01['push'](_0x5ceb01['shift']());}};_0x40b6a5(++_0x570521);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2d19b7e..e633261 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 _0x511a=['rimraf','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','api','moment','bluebird','request-promise','path'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x511a,0x165));var _0xa511=function(_0x3bd442,_0x552023){_0x3bd442=_0x3bd442-0x0;var _0x1d5bec=_0x511a[_0x3bd442];return _0x1d5bec;};'use strict';var _=require(_0xa511('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa511('0x1'));var moment=require(_0xa511('0x2'));var BPromise=require(_0xa511('0x3'));var rp=require(_0xa511('0x4'));var fs=require('fs');var path=require(_0xa511('0x5'));var rimraf=require(_0xa511('0x6'));var config=require('../../config/environment');var attributes=require(_0xa511('0x7'));module[_0xa511('0x8')]=function(_0xbe3f1b,_0x4d76a1){return _0xbe3f1b[_0xa511('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xa511('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dfa=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x260f87,_0xa9af42){var _0x10589a=function(_0x18660a){while(--_0x18660a){_0x260f87['push'](_0x260f87['shift']());}};_0x10589a(++_0xa9af42);}(_0x5dfa,0x94));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa5df('0x0'));var util=require(_0xa5df('0x1'));var logger=require(_0xa5df('0x2'))('api');var moment=require(_0xa5df('0x3'));var BPromise=require(_0xa5df('0x4'));var rp=require(_0xa5df('0x5'));var fs=require('fs');var path=require(_0xa5df('0x6'));var rimraf=require('rimraf');var config=require(_0xa5df('0x7'));var attributes=require(_0xa5df('0x8'));module[_0xa5df('0x9')]=function(_0x4a4e43,_0x12b470){return _0x4a4e43[_0xa5df('0xa')](_0xa5df('0xb'),attributes,{'tableName':_0xa5df('0xc'),'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 9a58eb4..92f657b 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 _0xb7ef=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x278d8c,_0x4e835f){var _0x57ca73=function(_0xdaf7c9){while(--_0xdaf7c9){_0x278d8c['push'](_0x278d8c['shift']());}};_0x57ca73(++_0x4e835f);}(_0xb7ef,0xdd));var _0xfb7e=function(_0xda287a,_0x41ca7e){_0xda287a=_0xda287a-0x0;var _0x4aeeeb=_0xb7ef[_0xda287a];return _0x4aeeeb;};'use strict';var _=require(_0xfb7e('0x0'));var util=require(_0xfb7e('0x1'));var moment=require('moment');var BPromise=require(_0xfb7e('0x2'));var rs=require(_0xfb7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7e('0x4'))['db'];var utils=require(_0xfb7e('0x5'));var logger=require('../../config/logger')(_0xfb7e('0x6'));var config=require(_0xfb7e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb7e('0x8')][_0xfb7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2329f7,_0x4d98b7,_0x579f62){return new BPromise(function(_0x117fe9,_0x272750){return client[_0xfb7e('0xa')](_0x2329f7,_0x579f62)[_0xfb7e('0xb')](function(_0x534964){logger[_0xfb7e('0xc')](_0xfb7e('0xd'),_0x4d98b7,_0xfb7e('0xe'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4d98b7,'request\x20sent',JSON[_0xfb7e('0xf')](_0x534964));if(_0x534964['error']){if(_0x534964[_0xfb7e('0x10')][_0xfb7e('0x11')]===0x1f4){logger[_0xfb7e('0x10')](_0xfb7e('0xd'),_0x4d98b7,_0x534964[_0xfb7e('0x10')][_0xfb7e('0x12')]);return _0x272750(_0x534964['error'][_0xfb7e('0x12')]);}logger[_0xfb7e('0x10')](_0xfb7e('0xd'),_0x4d98b7,_0x534964['error']['message']);return _0x117fe9(_0x534964[_0xfb7e('0x10')][_0xfb7e('0x12')]);}else{logger[_0xfb7e('0xc')](_0xfb7e('0xd'),_0x4d98b7,'request\x20sent');_0x117fe9(_0x534964['result'][_0xfb7e('0x12')]);}})[_0xfb7e('0x13')](function(_0x426298){logger['error'](_0xfb7e('0xd'),_0x4d98b7,_0x426298);_0x272750(_0x426298);});});} \ No newline at end of file +var _0x3338=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3338,0xbc));var _0x8333=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x3338[_0x51beba];return _0x167ee0;};'use strict';var _=require(_0x8333('0x0'));var util=require(_0x8333('0x1'));var moment=require(_0x8333('0x2'));var BPromise=require(_0x8333('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8333('0x4'));var db=require(_0x8333('0x5'))['db'];var utils=require(_0x8333('0x6'));var logger=require(_0x8333('0x7'))(_0x8333('0x8'));var config=require(_0x8333('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8333('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40cf96,_0x185eb9,_0x17130a){return new BPromise(function(_0x303977,_0x4438ed){return client[_0x8333('0xb')](_0x40cf96,_0x17130a)[_0x8333('0xc')](function(_0x1ed0a0){logger['info'](_0x8333('0xd'),_0x185eb9,_0x8333('0xe'));logger[_0x8333('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x185eb9,'request\x20sent',JSON[_0x8333('0x10')](_0x1ed0a0));if(_0x1ed0a0['error']){if(_0x1ed0a0['error'][_0x8333('0x11')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x185eb9,_0x1ed0a0[_0x8333('0x12')][_0x8333('0x13')]);return _0x4438ed(_0x1ed0a0['error'][_0x8333('0x13')]);}logger[_0x8333('0x12')](_0x8333('0xd'),_0x185eb9,_0x1ed0a0[_0x8333('0x12')]['message']);return _0x303977(_0x1ed0a0[_0x8333('0x12')][_0x8333('0x13')]);}else{logger[_0x8333('0x14')](_0x8333('0xd'),_0x185eb9,_0x8333('0xe'));_0x303977(_0x1ed0a0[_0x8333('0x15')][_0x8333('0x13')]);}})[_0x8333('0x16')](function(_0x22ff2a){logger[_0x8333('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x185eb9,_0x22ff2a);_0x4438ed(_0x22ff2a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fad589d..59c3250 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 _0x61e3=['describe','/:id','/:id/users','getAgents','post','create','addAgents','put','destroy','delete','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated'];(function(_0x58ba8a,_0x5c95b){var _0x22e188=function(_0x182109){while(--_0x182109){_0x58ba8a['push'](_0x58ba8a['shift']());}};_0x22e188(++_0x5c95b);}(_0x61e3,0xa5));var _0x361e=function(_0x485379,_0x66bbde){_0x485379=_0x485379-0x0;var _0x5e4a98=_0x61e3[_0x485379];return _0x5e4a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x361e('0x0'));var timeout=require(_0x361e('0x1'));var express=require(_0x361e('0x2'));var router=express[_0x361e('0x3')]();var auth=require(_0x361e('0x4'));var interaction=require(_0x361e('0x5'));var config=require(_0x361e('0x6'));var controller=require(_0x361e('0x7'));router[_0x361e('0x8')]('/',auth['isAuthenticated'](),controller[_0x361e('0x9')]);router[_0x361e('0x8')]('/describe',auth[_0x361e('0xa')](),controller[_0x361e('0xb')]);router['get'](_0x361e('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x361e('0xd'),auth[_0x361e('0xa')](),controller[_0x361e('0xe')]);router[_0x361e('0xf')]('/',auth['isAuthenticated'](),controller[_0x361e('0x10')]);router[_0x361e('0xf')](_0x361e('0xd'),auth[_0x361e('0xa')](),controller[_0x361e('0x11')]);router[_0x361e('0x12')](_0x361e('0xc'),auth[_0x361e('0xa')](),controller['update']);router['delete'](_0x361e('0xc'),auth['isAuthenticated'](),controller[_0x361e('0x13')]);router[_0x361e('0x14')](_0x361e('0xd'),auth['isAuthenticated'](),controller[_0x361e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x80de=['update','destroy','delete','removeAgents','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','post','create','addAgents','put','/:id'];(function(_0x5ab2b4,_0x288fab){var _0x326806=function(_0x3ad9d5){while(--_0x3ad9d5){_0x5ab2b4['push'](_0x5ab2b4['shift']());}};_0x326806(++_0x288fab);}(_0x80de,0x16c));var _0xe80d=function(_0xadbd3,_0x34b5c1){_0xadbd3=_0xadbd3-0x0;var _0x48e620=_0x80de[_0xadbd3];return _0x48e620;};'use strict';var multer=require(_0xe80d('0x0'));var util=require(_0xe80d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe80d('0x2')]();var auth=require(_0xe80d('0x3'));var interaction=require(_0xe80d('0x4'));var config=require(_0xe80d('0x5'));var controller=require(_0xe80d('0x6'));router[_0xe80d('0x7')]('/',auth[_0xe80d('0x8')](),controller[_0xe80d('0x9')]);router[_0xe80d('0x7')](_0xe80d('0xa'),auth[_0xe80d('0x8')](),controller[_0xe80d('0xb')]);router[_0xe80d('0x7')]('/:id',auth[_0xe80d('0x8')](),controller[_0xe80d('0xc')]);router[_0xe80d('0x7')](_0xe80d('0xd'),auth[_0xe80d('0x8')](),controller[_0xe80d('0xe')]);router[_0xe80d('0xf')]('/',auth[_0xe80d('0x8')](),controller[_0xe80d('0x10')]);router['post'](_0xe80d('0xd'),auth[_0xe80d('0x8')](),controller[_0xe80d('0x11')]);router[_0xe80d('0x12')](_0xe80d('0x13'),auth[_0xe80d('0x8')](),controller[_0xe80d('0x14')]);router['delete'](_0xe80d('0x13'),auth['isAuthenticated'](),controller[_0xe80d('0x15')]);router[_0xe80d('0x16')](_0xe80d('0xd'),auth[_0xe80d('0x8')](),controller[_0xe80d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 83245b0..eef9d7f 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 _0x38c3=['getDataValue','STRING','sequelize','exports','name','VIRTUAL','system-'];(function(_0x3288d6,_0x5a994d){var _0x5aa6bb=function(_0x55f239){while(--_0x55f239){_0x3288d6['push'](_0x3288d6['shift']());}};_0x5aa6bb(++_0x5a994d);}(_0x38c3,0x13d));var _0x338c=function(_0x4bda95,_0x3dd9b1){_0x4bda95=_0x4bda95-0x0;var _0x2dd15f=_0x38c3[_0x4bda95];return _0x2dd15f;};'use strict';var Sequelize=require(_0x338c('0x0'));module[_0x338c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x338c('0x2')},'prefix':{'type':Sequelize[_0x338c('0x3')],'get':function(_0x36a187){return _0x338c('0x4')+this[_0x338c('0x5')](_0x338c('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x338c('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x60a1=['VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize','exports','name'];(function(_0x4283d2,_0x598906){var _0x5ee5e7=function(_0x1da278){while(--_0x1da278){_0x4283d2['push'](_0x4283d2['shift']());}};_0x5ee5e7(++_0x598906);}(_0x60a1,0x75));var _0x160a=function(_0x3cf91c,_0x15f8cd){_0x3cf91c=_0x3cf91c-0x0;var _0x55a5d8=_0x60a1[_0x3cf91c];return _0x55a5d8;};'use strict';var Sequelize=require(_0x160a('0x0'));module[_0x160a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x160a('0x2')},'prefix':{'type':Sequelize[_0x160a('0x3')],'get':function(_0x5d9cc6){return _0x160a('0x4')+this[_0x160a('0x5')](_0x160a('0x2'))+'-';}},'description':{'type':Sequelize[_0x160a('0x6')]},'callerIdAll':{'type':Sequelize[_0x160a('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x160a('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e90d6b3..8d12548 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 _0x2083=['NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','${EXTEN:','charAt','body','system-','update','findById','addAgents','omit','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','User','order','pick','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','where','VIRTUAL','filter','merge','options','count','include','findAll','rows','show','params','keys','length','includeAll','find','catch','describe','create','sequelize','transaction','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix'];(function(_0x47c3c3,_0x5dc6a5){var _0x1ca8e4=function(_0x5d1736){while(--_0x5d1736){_0x47c3c3['push'](_0x47c3c3['shift']());}};_0x1ca8e4(++_0x5dc6a5);}(_0x2083,0x113));var _0x3208=function(_0x4d61ee,_0x95701){_0x4d61ee=_0x4d61ee-0x0;var _0x5e439d=_0x2083[_0x4d61ee];return _0x5e439d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3208('0x0'));var rimraf=require(_0x3208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3208('0x2'));var moment=require(_0x3208('0x3'));var BPromise=require(_0x3208('0x4'));var Mustache=require(_0x3208('0x5'));var util=require(_0x3208('0x6'));var path=require(_0x3208('0x7'));var sox=require('sox');var csv=require(_0x3208('0x8'));var ejs=require(_0x3208('0x9'));var fs=require('fs');var _=require(_0x3208('0xa'));var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require(_0x3208('0xd'));var deskjs=require(_0x3208('0xe'));var toCsv=require(_0x3208('0x8'));var querystring=require('querystring');var Papa=require(_0x3208('0xf'));var Redis=require(_0x3208('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3208('0x11'));var as=require(_0x3208('0x12'));var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require('../../config/environment');var db=require(_0x3208('0x15'))['db'];config[_0x3208('0x16')]=_[_0x3208('0x17')](config['redis'],{'host':_0x3208('0x18'),'port':0x18eb});var socket=require(_0x3208('0x19'))(new Redis(config[_0x3208('0x16')]));require(_0x3208('0x1a'))[_0x3208('0x1b')](socket);function respondWithStatusCode(_0x379814,_0x1bec84){_0x1bec84=_0x1bec84||0xcc;return function(_0x555d27){if(_0x555d27){return _0x379814[_0x3208('0x1c')](_0x1bec84);}return _0x379814[_0x3208('0x1d')](_0x1bec84)[_0x3208('0x1e')]();};}function respondWithResult(_0x1a301a,_0x27792a){_0x27792a=_0x27792a||0xc8;return function(_0x42c2ba){if(_0x42c2ba){return _0x1a301a['status'](_0x27792a)['json'](_0x42c2ba);}};}function respondWithFilteredResult(_0x2f07a8,_0x5b65aa){return function(_0x39b532){if(_0x39b532){var _0x24a688=_0x39b532['count'],_0x7a4a19=_0x5b65aa[_0x3208('0x1f')],_0xb2ad37=_0x5b65aa[_0x3208('0x1f')]+_0x5b65aa[_0x3208('0x20')],_0x11be75;if(_0xb2ad37>=_0x24a688){_0xb2ad37=_0x24a688;_0x11be75=0xc8;}else{_0x11be75=0xce;}_0x2f07a8[_0x3208('0x1d')](_0x11be75);return _0x2f07a8[_0x3208('0x21')](_0x3208('0x22'),_0x7a4a19+'-'+_0xb2ad37+'/'+_0x24a688)[_0x3208('0x23')](_0x39b532);}return null;};}function patchUpdates(_0x5c208f){return function(_0x38d4d7){try{jsonpatch['apply'](_0x38d4d7,_0x5c208f,!![]);}catch(_0x4b822a){return BPromise[_0x3208('0x24')](_0x4b822a);}return _0x38d4d7[_0x3208('0x25')]();};}function saveUpdates(_0x3f755d,_0xd119b1){return function(_0x5827f3){if(_0x5827f3){return _0x5827f3['update'](_0x3f755d)[_0x3208('0x26')](function(_0x46cc9f){return _0x46cc9f;});}return null;};}function removeEntity(_0x20d6b8,_0xcd731a){return function(_0x24aa48){if(_0x24aa48){return _0x24aa48[_0x3208('0x27')]()[_0x3208('0x26')](function(){var _0x15a5c9=_0x24aa48['get']({'plain':!![]});var _0x350a12=_0x3208('0x28');return db[_0x3208('0x29')][_0x3208('0x27')]({'where':{'type':_0x350a12,'resourceId':_0x15a5c9['id']}})[_0x3208('0x26')](function(){return _0x24aa48;});})['then'](function(){_0x20d6b8[_0x3208('0x1d')](0xcc)[_0x3208('0x1e')]();});}};}function handleEntityNotFound(_0x91169b,_0x3852f7){return function(_0x364122){if(!_0x364122){_0x91169b[_0x3208('0x1c')](0x194);}return _0x364122;};}function handleError(_0x307394,_0xb44300){_0xb44300=_0xb44300||0x1f4;return function(_0x187fea){logger[_0x3208('0x2a')](_0x187fea[_0x3208('0x2b')]);if(_0x187fea[_0x3208('0x2c')]){delete _0x187fea[_0x3208('0x2c')];}_0x307394[_0x3208('0x1d')](_0xb44300)[_0x3208('0x2d')](_0x187fea);};}exports[_0x3208('0x2e')]=function(_0x28cdf1,_0x58c7fe){var _0x1c4f01={},_0x5a17cd={},_0x4440db={'count':0x0,'rows':[]};var _0x1bc7de=_[_0x3208('0x2f')](db[_0x3208('0x30')][_0x3208('0x31')],function(_0x5bc353){return{'name':_0x5bc353[_0x3208('0x32')],'type':_0x5bc353[_0x3208('0x33')]['key']};});_0x5a17cd['model']=_[_0x3208('0x2f')](_0x1bc7de,_0x3208('0x2c'));_0x5a17cd[_0x3208('0x34')]=_['keys'](_0x28cdf1[_0x3208('0x34')]);_0x5a17cd['filters']=_[_0x3208('0x35')](_0x5a17cd[_0x3208('0x36')],_0x5a17cd[_0x3208('0x34')]);_0x1c4f01[_0x3208('0x37')]=_[_0x3208('0x35')](_0x5a17cd[_0x3208('0x36')],qs[_0x3208('0x38')](_0x28cdf1[_0x3208('0x34')][_0x3208('0x38')]));_0x1c4f01[_0x3208('0x37')]=_0x1c4f01[_0x3208('0x37')]['length']?_0x1c4f01[_0x3208('0x37')]:_0x5a17cd['model'];if(!_0x28cdf1['query'][_0x3208('0x39')](_0x3208('0x3a'))){_0x1c4f01['limit']=qs['limit'](_0x28cdf1[_0x3208('0x34')][_0x3208('0x20')]);_0x1c4f01[_0x3208('0x1f')]=qs[_0x3208('0x1f')](_0x28cdf1[_0x3208('0x34')]['offset']);}_0x1c4f01['order']=qs[_0x3208('0x3b')](_0x28cdf1['query'][_0x3208('0x3b')]);_0x1c4f01['where']=qs[_0x3208('0x3c')](_['pick'](_0x28cdf1[_0x3208('0x34')],_0x5a17cd[_0x3208('0x3c')]),_0x1bc7de);if(_0x28cdf1[_0x3208('0x34')]['filter']){_0x1c4f01[_0x3208('0x3d')]=_['merge'](_0x1c4f01[_0x3208('0x3d')],{'$or':_[_0x3208('0x2f')](_0x1bc7de,function(_0x4a9f05){if(_0x4a9f05[_0x3208('0x33')]!==_0x3208('0x3e')){var _0x3e5cc9={};_0x3e5cc9[_0x4a9f05[_0x3208('0x2c')]]={'$like':'%'+_0x28cdf1[_0x3208('0x34')][_0x3208('0x3f')]+'%'};return _0x3e5cc9;}})});}_0x1c4f01=_[_0x3208('0x40')]({},_0x1c4f01,_0x28cdf1[_0x3208('0x41')]);var _0x2722dc={'where':_0x1c4f01[_0x3208('0x3d')]};return db[_0x3208('0x30')][_0x3208('0x42')](_0x2722dc)[_0x3208('0x26')](function(_0x297eaa){_0x4440db['count']=_0x297eaa;if(_0x28cdf1['query']['includeAll']){_0x1c4f01[_0x3208('0x43')]=[{'all':!![]}];}return db[_0x3208('0x30')][_0x3208('0x44')](_0x1c4f01);})[_0x3208('0x26')](function(_0x32d0b5){_0x4440db[_0x3208('0x45')]=_0x32d0b5;return _0x4440db;})[_0x3208('0x26')](respondWithFilteredResult(_0x58c7fe,_0x1c4f01))['catch'](handleError(_0x58c7fe,null));};exports[_0x3208('0x46')]=function(_0x527d74,_0x4483ea){var _0x6216d0={'raw':![],'where':{'id':_0x527d74[_0x3208('0x47')]['id']}},_0x34d6b1={};_0x34d6b1['model']=_[_0x3208('0x48')](db[_0x3208('0x30')]['rawAttributes']);_0x34d6b1[_0x3208('0x34')]=_[_0x3208('0x48')](_0x527d74[_0x3208('0x34')]);_0x34d6b1[_0x3208('0x3c')]=_[_0x3208('0x35')](_0x34d6b1[_0x3208('0x36')],_0x34d6b1[_0x3208('0x34')]);_0x6216d0[_0x3208('0x37')]=_[_0x3208('0x35')](_0x34d6b1['model'],qs['fields'](_0x527d74['query'][_0x3208('0x38')]));_0x6216d0['attributes']=_0x6216d0[_0x3208('0x37')][_0x3208('0x49')]?_0x6216d0['attributes']:_0x34d6b1[_0x3208('0x36')];if(_0x527d74[_0x3208('0x34')][_0x3208('0x4a')]){_0x6216d0[_0x3208('0x43')]=[{'all':!![]}];}_0x6216d0=_[_0x3208('0x40')]({},_0x6216d0,_0x527d74[_0x3208('0x41')]);return db[_0x3208('0x30')][_0x3208('0x4b')](_0x6216d0)[_0x3208('0x26')](handleEntityNotFound(_0x4483ea,null))['then'](respondWithResult(_0x4483ea,null))[_0x3208('0x4c')](handleError(_0x4483ea,null));};exports['destroy']=function(_0x9142c8,_0x4b3874){return db[_0x3208('0x30')][_0x3208('0x4b')]({'where':{'id':_0x9142c8[_0x3208('0x47')]['id']}})[_0x3208('0x26')](handleEntityNotFound(_0x4b3874,null))[_0x3208('0x26')](removeEntity(_0x4b3874,null))[_0x3208('0x4c')](handleError(_0x4b3874,null));};exports[_0x3208('0x4d')]=function(_0x16142d,_0x1befb4){return db[_0x3208('0x30')][_0x3208('0x4d')]()[_0x3208('0x26')](respondWithResult(_0x1befb4,null))[_0x3208('0x4c')](handleError(_0x1befb4,null));};exports[_0x3208('0x4e')]=function(_0x2e964d,_0x8b4cb9){var _0x23cc3d;return db[_0x3208('0x4f')][_0x3208('0x50')](function(_0x1751a1){return db['VoicePrefix'][_0x3208('0x4e')](_0x2e964d['body'],{'transaction':_0x1751a1})[_0x3208('0x26')](function(_0x178746){_0x23cc3d=_0x178746[_0x3208('0x51')]({'plain':!![]});return db[_0x3208('0x52')][_0x3208('0x4b')]({'where':{'id':_0x23cc3d[_0x3208('0x53')]},'raw':!![]})[_0x3208('0x26')](function(_0x445f6e){return createVoicePrefixExtensions(_0x23cc3d,_0x445f6e,_0x1751a1);});});})['then'](function(){var _0x3c4cf4=_0x2e964d['user']['get']({'plain':!![]});if(!_0x3c4cf4)throw new Error(_0x3208('0x54'));if(_0x3c4cf4['role']===_0x3208('0x55')){var _0x1c7353=_0x23cc3d;return db[_0x3208('0x56')][_0x3208('0x4b')]({'where':{'name':_0x3208('0x28'),'userProfileId':_0x3c4cf4[_0x3208('0x57')]},'raw':!![]})[_0x3208('0x26')](function(_0x4d7f70){if(_0x4d7f70&&_0x4d7f70[_0x3208('0x58')]===0x0){return db['UserProfileResource'][_0x3208('0x4e')]({'name':_0x1c7353['name'],'resourceId':_0x1c7353['id'],'type':_0x4d7f70[_0x3208('0x2c')],'sectionId':_0x4d7f70['id']},{})[_0x3208('0x26')](function(){return _0x23cc3d;});}else{return _0x23cc3d;}})[_0x3208('0x4c')](function(_0x2d8886){logger[_0x3208('0x2a')](_0x3208('0x59'),_0x2d8886);throw _0x2d8886;});}return _0x23cc3d;})[_0x3208('0x26')](respondWithResult(_0x8b4cb9,null))[_0x3208('0x4c')](handleError(_0x8b4cb9,null));};function Extension(_0x18529e,_0x577f7a,_0x474611,_0x5dd51b){this[_0x3208('0x5a')]='from-sip';this[_0x3208('0x5b')]=_0x18529e;this['app']=_0x474611;this[_0x3208('0x33')]='system';this[_0x3208('0x5c')]=_0x3208('0x5d');this[_0x3208('0x5e')]=_0x577f7a;this[_0x3208('0x5f')]=_0x5dd51b;}function createVoicePrefixExtensions(_0x44fb68,_0x1bbd7c,_0x52bfdc){return new BPromise(function(_0x3221e4,_0x425eb8){var _0x4ed57f=new Extension(formatPrefixName(_0x44fb68[_0x3208('0x60')]),0x1,_0x3208('0x61'),_0x3208('0x62'));_0x4ed57f['VoicePrefixId']=_0x44fb68['id'];return db[_0x3208('0x52')][_0x3208('0x4e')](_0x4ed57f,{'transaction':_0x52bfdc})[_0x3208('0x26')](function(_0x3e5d6f){var _0x353703=_0x3e5d6f[_0x3208('0x51')]({'plain':!![]});var _0x3c8058=_[_0x3208('0x2f')](addVoicePrefixExtensions(_0x44fb68,_0x1bbd7c),function(_0x588d54){_0x588d54[_0x3208('0x53')]=_0x353703['id'];_0x588d54[_0x3208('0x63')]=_0x44fb68['id'];return _0x588d54;});return db['VoiceExtension'][_0x3208('0x64')](_0x3c8058,{'transaction':_0x52bfdc})['then'](function(_0x7dc77d){if(!_0x7dc77d){return _0x425eb8(_0x3208('0x65'));}else{return _0x3221e4(_0x7dc77d);}})[_0x3208('0x4c')](function(_0x4469e6){return _0x425eb8(_0x4469e6);});});;});};function addVoicePrefixExtensions(_0xaf7906,_0x40b3df){var _0x5147ca=[];var _0x29023e=formatPrefixName(_0xaf7906[_0x3208('0x60')]);_0x5147ca['push'](new Extension(_0x29023e,0x2,_0x3208('0x66'),_0x3208('0x67')+_0xaf7906[_0x3208('0x2c')]));if(_0xaf7906[_0x3208('0x68')]){_0x5147ca[_0x3208('0x69')](new Extension(_0x29023e,0x3,_0x3208('0x66'),_0x3208('0x6a')+_0xaf7906[_0x3208('0x68')]));}else{_0x5147ca[_0x3208('0x69')](new Extension(_0x29023e,0x3,_0x3208('0x61'),'No\x20callerid\x20available'));}_0x5147ca[_0x3208('0x69')](new Extension(_0x29023e,0x4,'goto',_0x40b3df[_0x3208('0x5a')]+','+_0x3208('0x6b')+(0x8+_0xaf7906['name'][_0x3208('0x49')])+'}'+','+0x1));return _0x5147ca;}function formatPrefixName(_0x4db07e){var _0x406cc5='_';for(var _0x39c30f=0x0;_0x39c30f<_0x4db07e[_0x3208('0x49')];_0x39c30f++){if(_0x4db07e[_0x3208('0x6c')](_0x39c30f)=='-'){_0x406cc5+=_0x4db07e[_0x3208('0x6c')](_0x39c30f);}else{_0x406cc5+='['+_0x4db07e['charAt'](_0x39c30f)+']';}}_0x406cc5+='.';return _0x406cc5;}exports['update']=function(_0x3e3bf2,_0x1139fe,_0x806a9b){var _0x5a5ac0=_0x3e3bf2[_0x3208('0x6d')];_0x5a5ac0[_0x3208('0x60')]=_0x3208('0x6e')+_0x5a5ac0[_0x3208('0x2c')]+'-';return db[_0x3208('0x4f')][_0x3208('0x50')](function(_0x1cb6b1){return db['VoicePrefix'][_0x3208('0x6f')](_0x5a5ac0,{'where':{'id':_0x5a5ac0['id']},'transaction':_0x1cb6b1})[_0x3208('0x26')](function(){return db[_0x3208('0x52')][_0x3208('0x27')]({'where':{'VoicePrefixId':_0x5a5ac0['id']},'transaction':_0x1cb6b1})[_0x3208('0x26')](function(){return db[_0x3208('0x52')]['find']({'where':{'id':_0x5a5ac0['VoiceExtensionId']},'raw':!![]})['then'](function(_0x172153){return createVoicePrefixExtensions(_0x5a5ac0,_0x172153,_0x1cb6b1);});});});})[_0x3208('0x26')](function(){return db['VoicePrefix'][_0x3208('0x70')](_0x5a5ac0['id']);})[_0x3208('0x26')](respondWithResult(_0x1139fe,null))['catch'](handleError(_0x1139fe,null));};exports['addAgents']=function(_0xca30b4,_0x503cdd,_0x56e75c){return db['VoicePrefix'][_0x3208('0x4b')]({'where':{'id':_0xca30b4[_0x3208('0x47')]['id']}})[_0x3208('0x26')](handleEntityNotFound(_0x503cdd,null))[_0x3208('0x26')](function(_0x22e222){if(_0x22e222){return _0x22e222[_0x3208('0x71')](_0xca30b4[_0x3208('0x6d')]['ids'],_[_0x3208('0x72')](_0xca30b4[_0x3208('0x6d')],[_0x3208('0x73'),'id'])||{})[_0x3208('0x74')](function(_0x1c3490){for(var _0xa4258e=0x0;_0xa4258e<_0xca30b4[_0x3208('0x6d')][_0x3208('0x73')]['length'];_0xa4258e+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0xca30b4['body'][_0x3208('0x73')][_0xa4258e],'VoicePrefixId':_0xca30b4[_0x3208('0x47')]['id']});}return _0x1c3490;});}})[_0x3208('0x26')](respondWithResult(_0x503cdd,null))[_0x3208('0x4c')](handleError(_0x503cdd,null));};exports[_0x3208('0x75')]=function(_0x2ac83a,_0x5122e1,_0x8d1987){return db['VoicePrefix'][_0x3208('0x4b')]({'where':{'id':_0x2ac83a[_0x3208('0x47')]['id']}})['then'](handleEntityNotFound(_0x5122e1,null))[_0x3208('0x26')](function(_0x10bf2f){if(_0x10bf2f){return _0x10bf2f[_0x3208('0x75')](_0x2ac83a['query'][_0x3208('0x73')])[_0x3208('0x26')](function(){if(_['isArray'](_0x2ac83a[_0x3208('0x34')][_0x3208('0x73')])){for(var _0x1b8ea7=0x0;_0x1b8ea7<_0x2ac83a[_0x3208('0x34')][_0x3208('0x73')][_0x3208('0x49')];_0x1b8ea7+=0x1){socket[_0x3208('0x76')](_0x3208('0x77'),{'UserId':Number(_0x2ac83a['query'][_0x3208('0x73')][_0x1b8ea7]),'VoicePrefixId':Number(_0x2ac83a[_0x3208('0x47')]['id'])});}}else{socket['emit'](_0x3208('0x77'),{'UserId':Number(_0x2ac83a[_0x3208('0x34')][_0x3208('0x73')]),'VoicePrefixId':Number(_0x2ac83a[_0x3208('0x47')]['id'])});}});}})[_0x3208('0x26')](respondWithStatusCode(_0x5122e1,null))['catch'](handleError(_0x5122e1,null));};exports[_0x3208('0x78')]=function(_0x84a95d,_0x1abd92,_0x46d5aa){var _0x305bdf={};var _0x1f7889={};var _0x4ab338;var _0x2b08ad;return db[_0x3208('0x30')]['findOne']({'where':{'id':_0x84a95d[_0x3208('0x47')]['id']}})[_0x3208('0x26')](handleEntityNotFound(_0x1abd92,null))[_0x3208('0x26')](function(_0x183d87){if(_0x183d87){_0x4ab338=_0x183d87;_0x1f7889['model']=_[_0x3208('0x48')](db[_0x3208('0x79')]['rawAttributes']);_0x1f7889['query']=_[_0x3208('0x48')](_0x84a95d[_0x3208('0x34')]);_0x1f7889[_0x3208('0x3c')]=_[_0x3208('0x35')](_0x1f7889[_0x3208('0x36')],_0x1f7889['query']);_0x305bdf['attributes']=_[_0x3208('0x35')](_0x1f7889['model'],qs[_0x3208('0x38')](_0x84a95d['query']['fields']));_0x305bdf[_0x3208('0x37')]=_0x305bdf[_0x3208('0x37')][_0x3208('0x49')]?_0x305bdf[_0x3208('0x37')]:_0x1f7889[_0x3208('0x36')];_0x305bdf[_0x3208('0x7a')]=qs[_0x3208('0x3b')](_0x84a95d[_0x3208('0x34')][_0x3208('0x3b')]);_0x305bdf[_0x3208('0x3d')]=qs['filters'](_[_0x3208('0x7b')](_0x84a95d['query'],_0x1f7889[_0x3208('0x3c')]));if(_0x84a95d[_0x3208('0x34')][_0x3208('0x3f')]){_0x305bdf[_0x3208('0x3d')]=_[_0x3208('0x40')](_0x305bdf[_0x3208('0x3d')],{'$or':_[_0x3208('0x2f')](_0x305bdf[_0x3208('0x37')],function(_0x5ae39c){var _0x1e12d3={};_0x1e12d3[_0x5ae39c]={'$like':'%'+_0x84a95d['query'][_0x3208('0x3f')]+'%'};return _0x1e12d3;})});}_0x305bdf=_[_0x3208('0x40')]({},_0x305bdf,_0x84a95d[_0x3208('0x41')]);return _0x4ab338[_0x3208('0x78')](_0x305bdf);}})[_0x3208('0x26')](function(_0x93a05d){if(_0x93a05d){_0x2b08ad=_0x93a05d[_0x3208('0x49')];if(!_0x84a95d['query'][_0x3208('0x39')]('nolimit')){_0x305bdf[_0x3208('0x20')]=qs[_0x3208('0x20')](_0x84a95d[_0x3208('0x34')][_0x3208('0x20')]);_0x305bdf[_0x3208('0x1f')]=qs[_0x3208('0x1f')](_0x84a95d[_0x3208('0x34')][_0x3208('0x1f')]);}return _0x4ab338[_0x3208('0x78')](_0x305bdf);}})['then'](function(_0x2396bb){if(_0x2396bb){return _0x2396bb?{'count':_0x2b08ad,'rows':_0x2396bb}:null;}})[_0x3208('0x26')](respondWithResult(_0x1abd92,null))[_0x3208('0x4c')](handleError(_0x1abd92,null));}; \ No newline at end of file +var _0xf057=['lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','VoicePrefixes','UserProfileResource','error','stack','name','send','fieldName','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','options','VoicePrefix','includeAll','findAll','rows','catch','params','find','destroy','describe','create','sequelize','body','VoiceExtensionId','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','transaction','findById','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','rawAttributes','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf057,0x6f));var _0x7f05=function(_0x38b873,_0x1ef1ea){_0x38b873=_0x38b873-0x0;var _0x44291c=_0xf057[_0x38b873];return _0x44291c;};'use strict';var pdf=require(_0x7f05('0x0'));var emlformat=require(_0x7f05('0x1'));var rimraf=require(_0x7f05('0x2'));var zipdir=require(_0x7f05('0x3'));var jsonpatch=require(_0x7f05('0x4'));var rp=require(_0x7f05('0x5'));var moment=require(_0x7f05('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f05('0x7'));var path=require(_0x7f05('0x8'));var sox=require(_0x7f05('0x9'));var csv=require(_0x7f05('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f05('0xb'));var squel=require(_0x7f05('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7f05('0xa'));var querystring=require(_0x7f05('0xd'));var Papa=require(_0x7f05('0xe'));var Redis=require(_0x7f05('0xf'));var authService=require(_0x7f05('0x10'));var qs=require(_0x7f05('0x11'));var as=require(_0x7f05('0x12'));var hardwareService=require(_0x7f05('0x13'));var logger=require(_0x7f05('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7f05('0x15'));var db=require(_0x7f05('0x16'))['db'];config['redis']=_[_0x7f05('0x17')](config[_0x7f05('0x18')],{'host':_0x7f05('0x19'),'port':0x18eb});var socket=require(_0x7f05('0x1a'))(new Redis(config[_0x7f05('0x18')]));require(_0x7f05('0x1b'))[_0x7f05('0x1c')](socket);function respondWithStatusCode(_0x184554,_0x56cc3d){_0x56cc3d=_0x56cc3d||0xcc;return function(_0x8748eb){if(_0x8748eb){return _0x184554[_0x7f05('0x1d')](_0x56cc3d);}return _0x184554[_0x7f05('0x1e')](_0x56cc3d)[_0x7f05('0x1f')]();};}function respondWithResult(_0xbb10bd,_0x1ce27c){_0x1ce27c=_0x1ce27c||0xc8;return function(_0x581c97){if(_0x581c97){return _0xbb10bd[_0x7f05('0x1e')](_0x1ce27c)['json'](_0x581c97);}};}function respondWithFilteredResult(_0x26c990,_0x334582){return function(_0x1ef1f1){if(_0x1ef1f1){var _0x34708a=_0x1ef1f1[_0x7f05('0x20')],_0x49c387=_0x334582[_0x7f05('0x21')],_0x243a4d=_0x334582[_0x7f05('0x21')]+_0x334582[_0x7f05('0x22')],_0x517bc9;if(_0x243a4d>=_0x34708a){_0x243a4d=_0x34708a;_0x517bc9=0xc8;}else{_0x517bc9=0xce;}_0x26c990[_0x7f05('0x1e')](_0x517bc9);return _0x26c990[_0x7f05('0x23')](_0x7f05('0x24'),_0x49c387+'-'+_0x243a4d+'/'+_0x34708a)[_0x7f05('0x25')](_0x1ef1f1);}return null;};}function patchUpdates(_0x244b58){return function(_0x3fb421){try{jsonpatch[_0x7f05('0x26')](_0x3fb421,_0x244b58,!![]);}catch(_0x2efc7c){return BPromise[_0x7f05('0x27')](_0x2efc7c);}return _0x3fb421[_0x7f05('0x28')]();};}function saveUpdates(_0x4e4fa4,_0x27b268){return function(_0x3c15f9){if(_0x3c15f9){return _0x3c15f9['update'](_0x4e4fa4)['then'](function(_0x2f99b1){return _0x2f99b1;});}return null;};}function removeEntity(_0x1961ca,_0x1bdb31){return function(_0x4a20a9){if(_0x4a20a9){return _0x4a20a9['destroy']()[_0x7f05('0x29')](function(){var _0xcd176c=_0x4a20a9['get']({'plain':!![]});var _0x304616=_0x7f05('0x2a');return db[_0x7f05('0x2b')]['destroy']({'where':{'type':_0x304616,'resourceId':_0xcd176c['id']}})[_0x7f05('0x29')](function(){return _0x4a20a9;});})[_0x7f05('0x29')](function(){_0x1961ca['status'](0xcc)[_0x7f05('0x1f')]();});}};}function handleEntityNotFound(_0x449937,_0x8cd597){return function(_0x184f2e){if(!_0x184f2e){_0x449937[_0x7f05('0x1d')](0x194);}return _0x184f2e;};}function handleError(_0x2716e6,_0x306124){_0x306124=_0x306124||0x1f4;return function(_0x59a33a){logger[_0x7f05('0x2c')](_0x59a33a[_0x7f05('0x2d')]);if(_0x59a33a[_0x7f05('0x2e')]){delete _0x59a33a[_0x7f05('0x2e')];}_0x2716e6[_0x7f05('0x1e')](_0x306124)[_0x7f05('0x2f')](_0x59a33a);};}exports['index']=function(_0x2a8271,_0x1e5a59){var _0x17dc79={},_0xbf9485={},_0x2129a4={'count':0x0,'rows':[]};var _0x510848=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x1e8ab7){return{'name':_0x1e8ab7[_0x7f05('0x30')],'type':_0x1e8ab7['type'][_0x7f05('0x31')]};});_0xbf9485[_0x7f05('0x32')]=_[_0x7f05('0x33')](_0x510848,_0x7f05('0x2e'));_0xbf9485['query']=_[_0x7f05('0x34')](_0x2a8271['query']);_0xbf9485[_0x7f05('0x35')]=_[_0x7f05('0x36')](_0xbf9485['model'],_0xbf9485[_0x7f05('0x37')]);_0x17dc79['attributes']=_[_0x7f05('0x36')](_0xbf9485[_0x7f05('0x32')],qs[_0x7f05('0x38')](_0x2a8271[_0x7f05('0x37')][_0x7f05('0x38')]));_0x17dc79[_0x7f05('0x39')]=_0x17dc79[_0x7f05('0x39')][_0x7f05('0x3a')]?_0x17dc79[_0x7f05('0x39')]:_0xbf9485['model'];if(!_0x2a8271[_0x7f05('0x37')][_0x7f05('0x3b')](_0x7f05('0x3c'))){_0x17dc79[_0x7f05('0x22')]=qs[_0x7f05('0x22')](_0x2a8271[_0x7f05('0x37')][_0x7f05('0x22')]);_0x17dc79[_0x7f05('0x21')]=qs['offset'](_0x2a8271[_0x7f05('0x37')][_0x7f05('0x21')]);}_0x17dc79['order']=qs[_0x7f05('0x3d')](_0x2a8271[_0x7f05('0x37')][_0x7f05('0x3d')]);_0x17dc79['where']=qs['filters'](_[_0x7f05('0x3e')](_0x2a8271['query'],_0xbf9485[_0x7f05('0x35')]),_0x510848);if(_0x2a8271[_0x7f05('0x37')][_0x7f05('0x3f')]){_0x17dc79['where']=_[_0x7f05('0x40')](_0x17dc79[_0x7f05('0x41')],{'$or':_[_0x7f05('0x33')](_0x510848,function(_0x2f38db){if(_0x2f38db[_0x7f05('0x42')]!=='VIRTUAL'){var _0x459fa3={};_0x459fa3[_0x2f38db['name']]={'$like':'%'+_0x2a8271[_0x7f05('0x37')][_0x7f05('0x3f')]+'%'};return _0x459fa3;}})});}_0x17dc79=_[_0x7f05('0x40')]({},_0x17dc79,_0x2a8271[_0x7f05('0x43')]);var _0x1c7a6f={'where':_0x17dc79[_0x7f05('0x41')]};return db[_0x7f05('0x44')][_0x7f05('0x20')](_0x1c7a6f)['then'](function(_0x348f6a){_0x2129a4['count']=_0x348f6a;if(_0x2a8271[_0x7f05('0x37')][_0x7f05('0x45')]){_0x17dc79['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x7f05('0x46')](_0x17dc79);})[_0x7f05('0x29')](function(_0x36f062){_0x2129a4[_0x7f05('0x47')]=_0x36f062;return _0x2129a4;})[_0x7f05('0x29')](respondWithFilteredResult(_0x1e5a59,_0x17dc79))[_0x7f05('0x48')](handleError(_0x1e5a59,null));};exports['show']=function(_0x50c8d8,_0x94ca0e){var _0x1999da={'raw':![],'where':{'id':_0x50c8d8[_0x7f05('0x49')]['id']}},_0x5041f0={};_0x5041f0[_0x7f05('0x32')]=_['keys'](db[_0x7f05('0x44')]['rawAttributes']);_0x5041f0['query']=_['keys'](_0x50c8d8['query']);_0x5041f0[_0x7f05('0x35')]=_[_0x7f05('0x36')](_0x5041f0[_0x7f05('0x32')],_0x5041f0[_0x7f05('0x37')]);_0x1999da[_0x7f05('0x39')]=_['intersection'](_0x5041f0[_0x7f05('0x32')],qs[_0x7f05('0x38')](_0x50c8d8[_0x7f05('0x37')][_0x7f05('0x38')]));_0x1999da[_0x7f05('0x39')]=_0x1999da[_0x7f05('0x39')][_0x7f05('0x3a')]?_0x1999da[_0x7f05('0x39')]:_0x5041f0[_0x7f05('0x32')];if(_0x50c8d8[_0x7f05('0x37')]['includeAll']){_0x1999da['include']=[{'all':!![]}];}_0x1999da=_['merge']({},_0x1999da,_0x50c8d8[_0x7f05('0x43')]);return db[_0x7f05('0x44')][_0x7f05('0x4a')](_0x1999da)[_0x7f05('0x29')](handleEntityNotFound(_0x94ca0e,null))[_0x7f05('0x29')](respondWithResult(_0x94ca0e,null))[_0x7f05('0x48')](handleError(_0x94ca0e,null));};exports[_0x7f05('0x4b')]=function(_0x4d430b,_0x297b1a){return db[_0x7f05('0x44')][_0x7f05('0x4a')]({'where':{'id':_0x4d430b[_0x7f05('0x49')]['id']}})[_0x7f05('0x29')](handleEntityNotFound(_0x297b1a,null))[_0x7f05('0x29')](removeEntity(_0x297b1a,null))[_0x7f05('0x48')](handleError(_0x297b1a,null));};exports[_0x7f05('0x4c')]=function(_0x55b2c6,_0x260013){return db[_0x7f05('0x44')][_0x7f05('0x4c')]()[_0x7f05('0x29')](respondWithResult(_0x260013,null))[_0x7f05('0x48')](handleError(_0x260013,null));};exports[_0x7f05('0x4d')]=function(_0x161926,_0x321fc9){var _0x3370b3;return db[_0x7f05('0x4e')]['transaction'](function(_0x5cce1e){return db['VoicePrefix'][_0x7f05('0x4d')](_0x161926[_0x7f05('0x4f')],{'transaction':_0x5cce1e})[_0x7f05('0x29')](function(_0x4fb4b9){_0x3370b3=_0x4fb4b9['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x3370b3[_0x7f05('0x50')]},'raw':!![]})['then'](function(_0xeb1db3){return createVoicePrefixExtensions(_0x3370b3,_0xeb1db3,_0x5cce1e);});});})[_0x7f05('0x29')](function(){var _0x23380a=_0x161926[_0x7f05('0x51')][_0x7f05('0x52')]({'plain':!![]});if(!_0x23380a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23380a[_0x7f05('0x53')]===_0x7f05('0x51')){var _0x581421=_0x3370b3;return db[_0x7f05('0x54')][_0x7f05('0x4a')]({'where':{'name':'VoicePrefixes','userProfileId':_0x23380a[_0x7f05('0x55')]},'raw':!![]})[_0x7f05('0x29')](function(_0x324d03){if(_0x324d03&&_0x324d03[_0x7f05('0x56')]===0x0){return db[_0x7f05('0x2b')][_0x7f05('0x4d')]({'name':_0x581421['name'],'resourceId':_0x581421['id'],'type':_0x324d03[_0x7f05('0x2e')],'sectionId':_0x324d03['id']},{})[_0x7f05('0x29')](function(){return _0x3370b3;});}else{return _0x3370b3;}})[_0x7f05('0x48')](function(_0x36de54){logger[_0x7f05('0x2c')](_0x7f05('0x57'),_0x36de54);throw _0x36de54;});}return _0x3370b3;})['then'](respondWithResult(_0x321fc9,null))[_0x7f05('0x48')](handleError(_0x321fc9,null));};function Extension(_0x2350b7,_0x21bbb9,_0x11506f,_0xa103bf){this[_0x7f05('0x58')]=_0x7f05('0x59');this['exten']=_0x2350b7;this['app']=_0x11506f;this[_0x7f05('0x42')]=_0x7f05('0x5a');this[_0x7f05('0x5b')]=_0x7f05('0x5c');this['priority']=_0x21bbb9;this['appdata']=_0xa103bf;}function createVoicePrefixExtensions(_0x4edbce,_0x1ebd24,_0xa495aa){return new BPromise(function(_0x1e328e,_0x8d2dc1){var _0x5c0e23=new Extension(formatPrefixName(_0x4edbce[_0x7f05('0x5d')]),0x1,_0x7f05('0x5e'),_0x7f05('0x5f'));_0x5c0e23[_0x7f05('0x60')]=_0x4edbce['id'];return db[_0x7f05('0x61')][_0x7f05('0x4d')](_0x5c0e23,{'transaction':_0xa495aa})[_0x7f05('0x29')](function(_0x3282c6){var _0x5b3e08=_0x3282c6[_0x7f05('0x52')]({'plain':!![]});var _0x5a1ba8=_[_0x7f05('0x33')](addVoicePrefixExtensions(_0x4edbce,_0x1ebd24),function(_0xa4b29b){_0xa4b29b['VoiceExtensionId']=_0x5b3e08['id'];_0xa4b29b[_0x7f05('0x60')]=_0x4edbce['id'];return _0xa4b29b;});return db[_0x7f05('0x61')]['bulkCreate'](_0x5a1ba8,{'transaction':_0xa495aa})[_0x7f05('0x29')](function(_0x4940f0){if(!_0x4940f0){return _0x8d2dc1(_0x7f05('0x62'));}else{return _0x1e328e(_0x4940f0);}})[_0x7f05('0x48')](function(_0x45e638){return _0x8d2dc1(_0x45e638);});});;});};function addVoicePrefixExtensions(_0x1d4d3c,_0x4dbe9f){var _0x262e25=[];var _0x4a1122=formatPrefixName(_0x1d4d3c[_0x7f05('0x5d')]);_0x262e25[_0x7f05('0x63')](new Extension(_0x4a1122,0x2,_0x7f05('0x64'),_0x7f05('0x65')+_0x1d4d3c[_0x7f05('0x2e')]));if(_0x1d4d3c[_0x7f05('0x66')]){_0x262e25[_0x7f05('0x63')](new Extension(_0x4a1122,0x3,_0x7f05('0x64'),_0x7f05('0x67')+_0x1d4d3c['callerIdAll']));}else{_0x262e25[_0x7f05('0x63')](new Extension(_0x4a1122,0x3,'NoOp',_0x7f05('0x68')));}_0x262e25[_0x7f05('0x63')](new Extension(_0x4a1122,0x4,_0x7f05('0x69'),_0x4dbe9f[_0x7f05('0x58')]+','+_0x7f05('0x6a')+(0x8+_0x1d4d3c[_0x7f05('0x2e')][_0x7f05('0x3a')])+'}'+','+0x1));return _0x262e25;}function formatPrefixName(_0x45b107){var _0x52f663='_';for(var _0x10bacc=0x0;_0x10bacc<_0x45b107[_0x7f05('0x3a')];_0x10bacc++){if(_0x45b107['charAt'](_0x10bacc)=='-'){_0x52f663+=_0x45b107['charAt'](_0x10bacc);}else{_0x52f663+='['+_0x45b107[_0x7f05('0x6b')](_0x10bacc)+']';}}_0x52f663+='.';return _0x52f663;}exports[_0x7f05('0x6c')]=function(_0x56de85,_0x1c92b6,_0x49cce2){var _0x19af5f=_0x56de85[_0x7f05('0x4f')];_0x19af5f[_0x7f05('0x5d')]=_0x7f05('0x6d')+_0x19af5f[_0x7f05('0x2e')]+'-';return db[_0x7f05('0x4e')][_0x7f05('0x6e')](function(_0xda4e93){return db[_0x7f05('0x44')][_0x7f05('0x6c')](_0x19af5f,{'where':{'id':_0x19af5f['id']},'transaction':_0xda4e93})[_0x7f05('0x29')](function(){return db[_0x7f05('0x61')][_0x7f05('0x4b')]({'where':{'VoicePrefixId':_0x19af5f['id']},'transaction':_0xda4e93})[_0x7f05('0x29')](function(){return db[_0x7f05('0x61')][_0x7f05('0x4a')]({'where':{'id':_0x19af5f[_0x7f05('0x50')]},'raw':!![]})['then'](function(_0xda9991){return createVoicePrefixExtensions(_0x19af5f,_0xda9991,_0xda4e93);});});});})[_0x7f05('0x29')](function(){return db[_0x7f05('0x44')][_0x7f05('0x6f')](_0x19af5f['id']);})[_0x7f05('0x29')](respondWithResult(_0x1c92b6,null))['catch'](handleError(_0x1c92b6,null));};exports['addAgents']=function(_0x5d7050,_0x407572,_0x2a4ca9){return db['VoicePrefix'][_0x7f05('0x4a')]({'where':{'id':_0x5d7050[_0x7f05('0x49')]['id']}})[_0x7f05('0x29')](handleEntityNotFound(_0x407572,null))['then'](function(_0x447d7b){if(_0x447d7b){return _0x447d7b['addAgents'](_0x5d7050['body'][_0x7f05('0x70')],_[_0x7f05('0x71')](_0x5d7050[_0x7f05('0x4f')],[_0x7f05('0x70'),'id'])||{})['spread'](function(_0xdb975b){for(var _0xd8b28c=0x0;_0xd8b28c<_0x5d7050[_0x7f05('0x4f')]['ids'][_0x7f05('0x3a')];_0xd8b28c+=0x1){socket['emit'](_0x7f05('0x72'),{'UserId':_0x5d7050[_0x7f05('0x4f')]['ids'][_0xd8b28c],'VoicePrefixId':_0x5d7050[_0x7f05('0x49')]['id']});}return _0xdb975b;});}})[_0x7f05('0x29')](respondWithResult(_0x407572,null))[_0x7f05('0x48')](handleError(_0x407572,null));};exports[_0x7f05('0x73')]=function(_0x1adc1c,_0x46ef23,_0x5f00b1){return db[_0x7f05('0x44')][_0x7f05('0x4a')]({'where':{'id':_0x1adc1c['params']['id']}})['then'](handleEntityNotFound(_0x46ef23,null))[_0x7f05('0x29')](function(_0x4cde74){if(_0x4cde74){return _0x4cde74[_0x7f05('0x73')](_0x1adc1c[_0x7f05('0x37')][_0x7f05('0x70')])[_0x7f05('0x29')](function(){if(_[_0x7f05('0x74')](_0x1adc1c[_0x7f05('0x37')][_0x7f05('0x70')])){for(var _0x32f721=0x0;_0x32f721<_0x1adc1c[_0x7f05('0x37')][_0x7f05('0x70')]['length'];_0x32f721+=0x1){socket[_0x7f05('0x75')](_0x7f05('0x76'),{'UserId':Number(_0x1adc1c[_0x7f05('0x37')]['ids'][_0x32f721]),'VoicePrefixId':Number(_0x1adc1c[_0x7f05('0x49')]['id'])});}}else{socket[_0x7f05('0x75')](_0x7f05('0x76'),{'UserId':Number(_0x1adc1c['query'][_0x7f05('0x70')]),'VoicePrefixId':Number(_0x1adc1c[_0x7f05('0x49')]['id'])});}});}})[_0x7f05('0x29')](respondWithStatusCode(_0x46ef23,null))[_0x7f05('0x48')](handleError(_0x46ef23,null));};exports[_0x7f05('0x77')]=function(_0x5d4c39,_0x1f71b1,_0x2aeb0c){var _0x47f15f={};var _0x5495aa={};var _0x234e19;var _0x33553d;return db[_0x7f05('0x44')]['findOne']({'where':{'id':_0x5d4c39[_0x7f05('0x49')]['id']}})[_0x7f05('0x29')](handleEntityNotFound(_0x1f71b1,null))[_0x7f05('0x29')](function(_0x3b7bc6){if(_0x3b7bc6){_0x234e19=_0x3b7bc6;_0x5495aa[_0x7f05('0x32')]=_['keys'](db['User'][_0x7f05('0x78')]);_0x5495aa[_0x7f05('0x37')]=_['keys'](_0x5d4c39[_0x7f05('0x37')]);_0x5495aa[_0x7f05('0x35')]=_[_0x7f05('0x36')](_0x5495aa[_0x7f05('0x32')],_0x5495aa[_0x7f05('0x37')]);_0x47f15f['attributes']=_[_0x7f05('0x36')](_0x5495aa[_0x7f05('0x32')],qs[_0x7f05('0x38')](_0x5d4c39['query'][_0x7f05('0x38')]));_0x47f15f[_0x7f05('0x39')]=_0x47f15f[_0x7f05('0x39')]['length']?_0x47f15f[_0x7f05('0x39')]:_0x5495aa[_0x7f05('0x32')];_0x47f15f[_0x7f05('0x79')]=qs[_0x7f05('0x3d')](_0x5d4c39[_0x7f05('0x37')][_0x7f05('0x3d')]);_0x47f15f[_0x7f05('0x41')]=qs[_0x7f05('0x35')](_['pick'](_0x5d4c39['query'],_0x5495aa[_0x7f05('0x35')]));if(_0x5d4c39[_0x7f05('0x37')][_0x7f05('0x3f')]){_0x47f15f[_0x7f05('0x41')]=_[_0x7f05('0x40')](_0x47f15f[_0x7f05('0x41')],{'$or':_[_0x7f05('0x33')](_0x47f15f[_0x7f05('0x39')],function(_0x6c8ab8){var _0x512148={};_0x512148[_0x6c8ab8]={'$like':'%'+_0x5d4c39[_0x7f05('0x37')][_0x7f05('0x3f')]+'%'};return _0x512148;})});}_0x47f15f=_['merge']({},_0x47f15f,_0x5d4c39['options']);return _0x234e19[_0x7f05('0x77')](_0x47f15f);}})[_0x7f05('0x29')](function(_0x21830f){if(_0x21830f){_0x33553d=_0x21830f['length'];if(!_0x5d4c39[_0x7f05('0x37')][_0x7f05('0x3b')](_0x7f05('0x3c'))){_0x47f15f[_0x7f05('0x22')]=qs['limit'](_0x5d4c39[_0x7f05('0x37')][_0x7f05('0x22')]);_0x47f15f[_0x7f05('0x21')]=qs[_0x7f05('0x21')](_0x5d4c39['query'][_0x7f05('0x21')]);}return _0x234e19['getAgents'](_0x47f15f);}})[_0x7f05('0x29')](function(_0x4beaa1){if(_0x4beaa1){return _0x4beaa1?{'count':_0x33553d,'rows':_0x4beaa1}:null;}})[_0x7f05('0x29')](respondWithResult(_0x1f71b1,null))[_0x7f05('0x48')](handleError(_0x1f71b1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9756c2c..c0a94fb 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x6eea12,_0x4124e9){var _0x38e98c=function(_0x505842){while(--_0x505842){_0x6eea12['push'](_0x6eea12['shift']());}};_0x38e98c(++_0x4124e9);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2ab8d70..6e9956a 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 _0xfe56=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util'];(function(_0xa9d706,_0x5dfeed){var _0xa64fba=function(_0x1f4266){while(--_0x1f4266){_0xa9d706['push'](_0xa9d706['shift']());}};_0xa64fba(++_0x5dfeed);}(_0xfe56,0xce));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6fe5('0x0'));var util=require(_0x6fe5('0x1'));var logger=require('../../config/logger')(_0x6fe5('0x2'));var moment=require(_0x6fe5('0x3'));var BPromise=require(_0x6fe5('0x4'));var rp=require(_0x6fe5('0x5'));var fs=require('fs');var path=require(_0x6fe5('0x6'));var rimraf=require(_0x6fe5('0x7'));var config=require(_0x6fe5('0x8'));var attributes=require(_0x6fe5('0x9'));module[_0x6fe5('0xa')]=function(_0x407c1d,_0x152ff9){return _0x407c1d[_0x6fe5('0xb')]('VoicePrefix',attributes,{'tableName':_0x6fe5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc823=['../../config/logger','moment','bluebird','path','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','util'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xc823,0xf2));var _0x3c82=function(_0x133c8b,_0x23ac4c){_0x133c8b=_0x133c8b-0x0;var _0xe2b25f=_0xc823[_0x133c8b];return _0xe2b25f;};'use strict';var _=require('lodash');var util=require(_0x3c82('0x0'));var logger=require(_0x3c82('0x1'))('api');var moment=require(_0x3c82('0x2'));var BPromise=require(_0x3c82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c82('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c82('0x5'));module['exports']=function(_0x7af711,_0x323b6d){return _0x7af711[_0x3c82('0x6')](_0x3c82('0x7'),attributes,{'tableName':_0x3c82('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index d94d8e3..09d3d9c 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 _0xad10=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x547cbe,_0x334521){var _0x4f3222=function(_0x4d471a){while(--_0x4d471a){_0x547cbe['push'](_0x547cbe['shift']());}};_0x4f3222(++_0x334521);}(_0xad10,0x1b3));var _0x0ad1=function(_0xbe471,_0x304d9a){_0xbe471=_0xbe471-0x0;var _0x162df6=_0xad10[_0xbe471];return _0x162df6;};'use strict';var _=require(_0x0ad1('0x0'));var util=require(_0x0ad1('0x1'));var moment=require(_0x0ad1('0x2'));var BPromise=require(_0x0ad1('0x3'));var rs=require(_0x0ad1('0x4'));var fs=require('fs');var Redis=require(_0x0ad1('0x5'));var db=require(_0x0ad1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ad1('0x7'))(_0x0ad1('0x8'));var config=require(_0x0ad1('0x9'));var jayson=require(_0x0ad1('0xa'));var client=jayson['client'][_0x0ad1('0xb')]({'port':0x232a});config[_0x0ad1('0xc')]=_[_0x0ad1('0xd')](config['redis'],{'host':_0x0ad1('0xe'),'port':0x18eb});var socket=require(_0x0ad1('0xf'))(new Redis(config[_0x0ad1('0xc')]));require(_0x0ad1('0x10'))[_0x0ad1('0x11')](socket);function respondWithRpcPromise(_0x4656dd,_0x65deff,_0x205209){return new BPromise(function(_0x4247ba,_0x212f14){return client[_0x0ad1('0x12')](_0x4656dd,_0x205209)[_0x0ad1('0x13')](function(_0x2af3f6){logger[_0x0ad1('0x14')](_0x0ad1('0x15'),_0x65deff,_0x0ad1('0x16'));logger[_0x0ad1('0x17')](_0x0ad1('0x18'),_0x65deff,'request\x20sent',JSON[_0x0ad1('0x19')](_0x2af3f6));if(_0x2af3f6[_0x0ad1('0x1a')]){if(_0x2af3f6[_0x0ad1('0x1a')][_0x0ad1('0x1b')]===0x1f4){logger[_0x0ad1('0x1a')](_0x0ad1('0x15'),_0x65deff,_0x2af3f6[_0x0ad1('0x1a')]['message']);return _0x212f14(_0x2af3f6['error'][_0x0ad1('0x1c')]);}logger['error'](_0x0ad1('0x15'),_0x65deff,_0x2af3f6[_0x0ad1('0x1a')][_0x0ad1('0x1c')]);return _0x4247ba(_0x2af3f6[_0x0ad1('0x1a')][_0x0ad1('0x1c')]);}else{logger[_0x0ad1('0x14')](_0x0ad1('0x15'),_0x65deff,_0x0ad1('0x16'));_0x4247ba(_0x2af3f6['result']['message']);}})['catch'](function(_0x2d1b7e){logger[_0x0ad1('0x1a')](_0x0ad1('0x15'),_0x65deff,_0x2d1b7e);_0x212f14(_0x2d1b7e);});});} \ No newline at end of file +var _0xaa65=['rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x35d615,_0x35ba8b){var _0x3d4c7b=function(_0x21a320){while(--_0x21a320){_0x35d615['push'](_0x35d615['shift']());}};_0x3d4c7b(++_0x35ba8b);}(_0xaa65,0x108));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5aa6('0x0'));var util=require(_0x5aa6('0x1'));var moment=require(_0x5aa6('0x2'));var BPromise=require(_0x5aa6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5aa6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aa6('0x5'));var logger=require('../../config/logger')(_0x5aa6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5aa6('0x7')][_0x5aa6('0x8')]({'port':0x232a});config[_0x5aa6('0x9')]=_[_0x5aa6('0xa')](config[_0x5aa6('0x9')],{'host':_0x5aa6('0xb'),'port':0x18eb});var socket=require(_0x5aa6('0xc'))(new Redis(config[_0x5aa6('0x9')]));require(_0x5aa6('0xd'))[_0x5aa6('0xe')](socket);function respondWithRpcPromise(_0x1e32ba,_0x317732,_0x2fb01c){return new BPromise(function(_0x4f7c84,_0x5cfb23){return client[_0x5aa6('0xf')](_0x1e32ba,_0x2fb01c)[_0x5aa6('0x10')](function(_0xebb932){logger[_0x5aa6('0x11')](_0x5aa6('0x12'),_0x317732,_0x5aa6('0x13'));logger['debug'](_0x5aa6('0x14'),_0x317732,_0x5aa6('0x13'),JSON[_0x5aa6('0x15')](_0xebb932));if(_0xebb932['error']){if(_0xebb932[_0x5aa6('0x16')][_0x5aa6('0x17')]===0x1f4){logger['error'](_0x5aa6('0x12'),_0x317732,_0xebb932[_0x5aa6('0x16')][_0x5aa6('0x18')]);return _0x5cfb23(_0xebb932[_0x5aa6('0x16')]['message']);}logger['error'](_0x5aa6('0x12'),_0x317732,_0xebb932[_0x5aa6('0x16')]['message']);return _0x4f7c84(_0xebb932['error'][_0x5aa6('0x18')]);}else{logger[_0x5aa6('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x317732,'request\x20sent');_0x4f7c84(_0xebb932[_0x5aa6('0x19')][_0x5aa6('0x18')]);}})[_0x5aa6('0x1a')](function(_0x1b1efd){logger[_0x5aa6('0x16')](_0x5aa6('0x12'),_0x317732,_0x1b1efd);_0x5cfb23(_0x1b1efd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4d6bc6b..acc2233 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 _0xddee=['length','voicePrefix:','./voicePrefix.events','save','remove','update','removeListener'];(function(_0x437110,_0x7271e4){var _0x1cb4d3=function(_0x5e3fc){while(--_0x5e3fc){_0x437110['push'](_0x437110['shift']());}};_0x1cb4d3(++_0x7271e4);}(_0xddee,0x9c));var _0xedde=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xddee[_0x30033a];return _0x5e3518;};'use strict';var VoicePrefixEvents=require(_0xedde('0x0'));var events=[_0xedde('0x1'),_0xedde('0x2'),_0xedde('0x3')];function createListener(_0x5e95e8,_0x2f340a){return function(_0x54f831){_0x2f340a['emit'](_0x5e95e8,_0x54f831);};}function removeListener(_0x5535e3,_0x37503f){return function(){VoicePrefixEvents[_0xedde('0x4')](_0x5535e3,_0x37503f);};}exports['register']=function(_0x249623){for(var _0x56c2d8=0x0,_0xb2b510=events[_0xedde('0x5')];_0x56c2d8<_0xb2b510;_0x56c2d8++){var _0x58a0ea=events[_0x56c2d8];var _0x5a5d04=createListener(_0xedde('0x6')+_0x58a0ea,_0x249623);VoicePrefixEvents['on'](_0x58a0ea,_0x5a5d04);}}; \ No newline at end of file +var _0x49b1=['register','length','voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x49b1,0x7b));var _0x149b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x49b1[_0x1facfa];return _0x9ec701;};'use strict';var VoicePrefixEvents=require(_0x149b('0x0'));var events=['save',_0x149b('0x1'),_0x149b('0x2')];function createListener(_0x625fe,_0xfa886d){return function(_0x5a8b7b){_0xfa886d[_0x149b('0x3')](_0x625fe,_0x5a8b7b);};}function removeListener(_0x5f0880,_0x481504){return function(){VoicePrefixEvents[_0x149b('0x4')](_0x5f0880,_0x481504);};}exports[_0x149b('0x5')]=function(_0xf86ed7){for(var _0x550759=0x0,_0x2d5c49=events[_0x149b('0x6')];_0x550759<_0x2d5c49;_0x550759++){var _0x23d7a7=events[_0x550759];var _0x49fe31=createListener(_0x149b('0x7')+_0x23d7a7,_0xf86ed7);VoicePrefixEvents['on'](_0x23d7a7,_0x49fe31);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a77ac55..7a2f955 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 _0x1f72=['clone','addTeams','/:id/lists','addLists','put','update','delete','removeAgents','removeLists','removeBlackLists','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','getLists','/:id/blacklists','create','post','/:id/clone'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f72,0x142));var _0x21f7=function(_0x35eb11,_0x2efa16){_0x35eb11=_0x35eb11-0x0;var _0x44a14e=_0x1f72[_0x35eb11];return _0x44a14e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x21f7('0x0'));var timeout=require(_0x21f7('0x1'));var express=require(_0x21f7('0x2'));var router=express[_0x21f7('0x3')]();var auth=require(_0x21f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21f7('0x5'));var controller=require(_0x21f7('0x6'));router['get']('/',auth[_0x21f7('0x7')](),controller[_0x21f7('0x8')]);router['get'](_0x21f7('0x9'),auth[_0x21f7('0x7')](),controller[_0x21f7('0xa')]);router['get'](_0x21f7('0xb'),auth[_0x21f7('0x7')](),controller[_0x21f7('0xc')]);router[_0x21f7('0xd')](_0x21f7('0xe'),auth[_0x21f7('0x7')](),controller[_0x21f7('0xf')]);router[_0x21f7('0xd')](_0x21f7('0x10'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x11')]);router['get'](_0x21f7('0x12'),auth[_0x21f7('0x7')](),controller['getHopperBlacks']);router['get'](_0x21f7('0x13'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x14')]);router['get'](_0x21f7('0x15'),auth[_0x21f7('0x7')](),controller['getAgents']);router[_0x21f7('0xd')](_0x21f7('0x16'),auth['isAuthenticated'](),controller[_0x21f7('0x17')]);router[_0x21f7('0xd')]('/:id/lists',auth[_0x21f7('0x7')](),controller[_0x21f7('0x18')]);router[_0x21f7('0xd')](_0x21f7('0x19'),auth[_0x21f7('0x7')](),controller['getBlackLists']);router['post']('/',auth[_0x21f7('0x7')](),controller[_0x21f7('0x1a')]);router[_0x21f7('0x1b')](_0x21f7('0x1c'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x1d')]);router[_0x21f7('0x1b')](_0x21f7('0x13'),auth['isAuthenticated'](),controller[_0x21f7('0x1e')]);router['post'](_0x21f7('0x15'),auth[_0x21f7('0x7')](),controller['addAgents']);router['post'](_0x21f7('0x1f'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x20')]);router[_0x21f7('0x1b')]('/:id/blacklists',auth[_0x21f7('0x7')](),controller['addBlackLists']);router[_0x21f7('0x21')](_0x21f7('0x9'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x22')]);router['delete'](_0x21f7('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x21f7('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x21f7('0x23')]('/:id/users',auth[_0x21f7('0x7')](),controller[_0x21f7('0x24')]);router[_0x21f7('0x23')](_0x21f7('0x1f'),auth[_0x21f7('0x7')](),controller[_0x21f7('0x25')]);router['delete']('/:id/blacklists',auth[_0x21f7('0x7')](),controller[_0x21f7('0x26')]);module['exports']=router; \ No newline at end of file +var _0x576a=['/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','/:id/teams','addTeams','addLists','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','index','show','isAuthenticated'];(function(_0x4078c8,_0x1d7bba){var _0x1e7acb=function(_0xf13efe){while(--_0xf13efe){_0x4078c8['push'](_0x4078c8['shift']());}};_0x1e7acb(++_0x1d7bba);}(_0x576a,0x65));var _0xa576=function(_0x21a625,_0x4006c9){_0x21a625=_0x21a625-0x0;var _0x116700=_0x576a[_0x21a625];return _0x116700;};'use strict';var multer=require('multer');var util=require(_0xa576('0x0'));var path=require('path');var timeout=require(_0xa576('0x1'));var express=require('express');var router=express[_0xa576('0x2')]();var auth=require(_0xa576('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa576('0x4'));var controller=require(_0xa576('0x5'));router[_0xa576('0x6')]('/',auth['isAuthenticated'](),controller[_0xa576('0x7')]);router[_0xa576('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa576('0x8')]);router[_0xa576('0x6')]('/:id/hoppers',auth[_0xa576('0x9')](),controller['getHoppers']);router[_0xa576('0x6')](_0xa576('0xa'),auth[_0xa576('0x9')](),controller['getHopperHistories']);router[_0xa576('0x6')](_0xa576('0xb'),auth[_0xa576('0x9')](),controller[_0xa576('0xc')]);router[_0xa576('0x6')](_0xa576('0xd'),auth['isAuthenticated'](),controller[_0xa576('0xe')]);router[_0xa576('0x6')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xa576('0x6')](_0xa576('0xf'),auth['isAuthenticated'](),controller[_0xa576('0x10')]);router[_0xa576('0x6')](_0xa576('0x11'),auth[_0xa576('0x9')](),controller[_0xa576('0x12')]);router['get'](_0xa576('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0xa576('0x6')](_0xa576('0x14'),auth[_0xa576('0x9')](),controller['getBlackLists']);router[_0xa576('0x15')]('/',auth['isAuthenticated'](),controller[_0xa576('0x16')]);router[_0xa576('0x15')](_0xa576('0x17'),auth[_0xa576('0x9')](),controller[_0xa576('0x18')]);router[_0xa576('0x15')](_0xa576('0x19'),auth[_0xa576('0x9')](),controller[_0xa576('0x1a')]);router[_0xa576('0x15')](_0xa576('0xf'),auth[_0xa576('0x9')](),controller['addAgents']);router['post'](_0xa576('0x13'),auth[_0xa576('0x9')](),controller[_0xa576('0x1b')]);router[_0xa576('0x15')](_0xa576('0x14'),auth[_0xa576('0x9')](),controller[_0xa576('0x1c')]);router[_0xa576('0x1d')](_0xa576('0x1e'),auth[_0xa576('0x9')](),controller[_0xa576('0x1f')]);router[_0xa576('0x20')](_0xa576('0x1e'),auth[_0xa576('0x9')](),controller[_0xa576('0x21')]);router['delete'](_0xa576('0x19'),auth[_0xa576('0x9')](),controller[_0xa576('0x22')]);router[_0xa576('0x20')](_0xa576('0xf'),auth[_0xa576('0x9')](),controller[_0xa576('0x23')]);router[_0xa576('0x20')](_0xa576('0x13'),auth['isAuthenticated'](),controller['removeLists']);router[_0xa576('0x20')](_0xa576('0x14'),auth[_0xa576('0x9')](),controller[_0xa576('0x24')]);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 bb0aa4d..d2fc1c9 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(_0x328c9b,_0x12cecb){var _0x2c5ea8=function(_0x1f16af){while(--_0x1f16af){_0x328c9b['push'](_0x328c9b['shift']());}};_0x2c5ea8(++_0x12cecb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x5a07a2,_0x32f99c){var _0x2238fe=function(_0x5152a2){while(--_0x5152a2){_0x5a07a2['push'](_0x5a07a2['shift']());}};_0x2238fe(++_0x32f99c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 af4815c..8d51081 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 _0xc198=['rows','show','params','include','options','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','QueueCampaigns','outbound','destroy','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','union','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','all','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','NOW()','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','save','update','VoiceQueues','inbound','filter','map','value','type','find','name','then','end','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','count','includeAll','findAll'];(function(_0x556feb,_0x1f7e87){var _0x8297d5=function(_0x58a2bc){while(--_0x58a2bc){_0x556feb['push'](_0x556feb['shift']());}};_0x8297d5(++_0x1f7e87);}(_0xc198,0x125));var _0x8c19=function(_0x11533d,_0x6c0a94){_0x11533d=_0x11533d-0x0;var _0x1208e6=_0xc198[_0x11533d];return _0x1208e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c19('0x0'));var rimraf=require(_0x8c19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c19('0x2'));var rp=require(_0x8c19('0x3'));var moment=require(_0x8c19('0x4'));var BPromise=require(_0x8c19('0x5'));var Mustache=require(_0x8c19('0x6'));var util=require(_0x8c19('0x7'));var path=require(_0x8c19('0x8'));var sox=require(_0x8c19('0x9'));var csv=require('to-csv');var ejs=require(_0x8c19('0xa'));var fs=require('fs');var _=require(_0x8c19('0xb'));var squel=require(_0x8c19('0xc'));var crypto=require(_0x8c19('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c19('0xe'));var toCsv=require(_0x8c19('0xf'));var querystring=require('querystring');var Papa=require(_0x8c19('0x10'));var Redis=require('ioredis');var authService=require(_0x8c19('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8c19('0x12'));var hardwareService=require(_0x8c19('0x13'));var logger=require(_0x8c19('0x14'))(_0x8c19('0x15'));var utils=require(_0x8c19('0x16'));var config=require(_0x8c19('0x17'));var db=require('../../mysqldb')['db'];config[_0x8c19('0x18')]=_[_0x8c19('0x19')](config[_0x8c19('0x18')],{'host':_0x8c19('0x1a'),'port':0x18eb});var socket=require(_0x8c19('0x1b'))(new Redis(config[_0x8c19('0x18')]));require(_0x8c19('0x1c'))[_0x8c19('0x1d')](socket);function respondWithStatusCode(_0x1ea23b,_0x1d2d38){_0x1d2d38=_0x1d2d38||0xcc;return function(_0xca7fbb){if(_0xca7fbb){return _0x1ea23b[_0x8c19('0x1e')](_0x1d2d38);}return _0x1ea23b[_0x8c19('0x1f')](_0x1d2d38)['end']();};}function respondWithResult(_0x557ea1,_0x66b0d5){_0x66b0d5=_0x66b0d5||0xc8;return function(_0x2407d1){if(_0x2407d1){return _0x557ea1['status'](_0x66b0d5)[_0x8c19('0x20')](_0x2407d1);}};}function respondWithFilteredResult(_0x2be657,_0x7e2bc5){return function(_0x1f27ee){if(_0x1f27ee){var _0x24d003=_0x1f27ee['count'],_0xfa39f1=_0x7e2bc5[_0x8c19('0x21')],_0x17d043=_0x7e2bc5[_0x8c19('0x21')]+_0x7e2bc5[_0x8c19('0x22')],_0x3bd171;if(_0x17d043>=_0x24d003){_0x17d043=_0x24d003;_0x3bd171=0xc8;}else{_0x3bd171=0xce;}_0x2be657[_0x8c19('0x1f')](_0x3bd171);return _0x2be657[_0x8c19('0x23')](_0x8c19('0x24'),_0xfa39f1+'-'+_0x17d043+'/'+_0x24d003)[_0x8c19('0x20')](_0x1f27ee);}return null;};}function patchUpdates(_0xd06322){return function(_0x4418c0){try{jsonpatch['apply'](_0x4418c0,_0xd06322,!![]);}catch(_0x394bab){return BPromise['reject'](_0x394bab);}return _0x4418c0[_0x8c19('0x25')]();};}function saveUpdates(_0x2e3ffd,_0x185946){return function(_0x5cfe84){if(_0x5cfe84){return _0x5cfe84[_0x8c19('0x26')](_0x2e3ffd)['then'](function(_0x52152c){return _0x52152c;});}return null;};}function removeEntity(_0x4ee70f,_0x2c4421){return function(_0x2538bb){if(_0x2538bb){return _0x2538bb['destroy']()['then'](function(){var _0x5c644b=_0x2538bb['get']({'plain':!![]});var _0x39793=[{'name':_0x8c19('0x27'),'value':_0x8c19('0x28'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x138c9e=_(_0x39793)[_0x8c19('0x29')]('ignore')[_0x8c19('0x2a')](_0x8c19('0x2b'))[_0x8c19('0x2b')]();if(_['includes'](_0x138c9e,_0x5c644b[_0x8c19('0x2c')])){return;}var _0x307b37=_[_0x8c19('0x2d')](_0x39793,[_0x8c19('0x2b'),_0x5c644b[_0x8c19('0x2c')]])[_0x8c19('0x2e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x307b37,'resourceId':_0x5c644b['id']}})[_0x8c19('0x2f')](function(){return _0x2538bb;});})[_0x8c19('0x2f')](function(){_0x4ee70f[_0x8c19('0x1f')](0xcc)[_0x8c19('0x30')]();});}};}function handleEntityNotFound(_0x38c121,_0x5ac81c){return function(_0x1eb966){if(!_0x1eb966){_0x38c121[_0x8c19('0x1e')](0x194);}return _0x1eb966;};}function handleError(_0x110643,_0x1b7014){_0x1b7014=_0x1b7014||0x1f4;return function(_0x3b6917){logger['error'](_0x3b6917['stack']);if(_0x3b6917['name']){delete _0x3b6917['name'];}_0x110643[_0x8c19('0x1f')](_0x1b7014)['send'](_0x3b6917);};}exports['index']=function(_0x5c70ee,_0x534673){var _0x5e5b6f={},_0x514056={},_0x469d24={'count':0x0,'rows':[]};var _0x1b8fd5=_[_0x8c19('0x2a')](db[_0x8c19('0x31')][_0x8c19('0x32')],function(_0x47d21b){return{'name':_0x47d21b[_0x8c19('0x33')],'type':_0x47d21b['type'][_0x8c19('0x34')]};});_0x514056['model']=_[_0x8c19('0x2a')](_0x1b8fd5,_0x8c19('0x2e'));_0x514056[_0x8c19('0x35')]=_[_0x8c19('0x36')](_0x5c70ee[_0x8c19('0x35')]);_0x514056[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x514056[_0x8c19('0x39')],_0x514056['query']);_0x5e5b6f['attributes']=_['intersection'](_0x514056[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0x5c70ee[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x5e5b6f[_0x8c19('0x3b')]=_0x5e5b6f[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x5e5b6f[_0x8c19('0x3b')]:_0x514056[_0x8c19('0x39')];if(!_0x5c70ee[_0x8c19('0x35')][_0x8c19('0x3d')](_0x8c19('0x3e'))){_0x5e5b6f[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x5c70ee[_0x8c19('0x35')][_0x8c19('0x22')]);_0x5e5b6f[_0x8c19('0x21')]=qs[_0x8c19('0x21')](_0x5c70ee['query']['offset']);}_0x5e5b6f[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0x5c70ee[_0x8c19('0x35')]['sort']);_0x5e5b6f[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0x5c70ee[_0x8c19('0x35')],_0x514056[_0x8c19('0x37')]),_0x1b8fd5);if(_0x5c70ee['query'][_0x8c19('0x29')]){_0x5e5b6f[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x5e5b6f[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x1b8fd5,function(_0x47a03d){if(_0x47a03d[_0x8c19('0x2c')]!=='VIRTUAL'){var _0x2fc95b={};_0x2fc95b[_0x47a03d[_0x8c19('0x2e')]]={'$like':'%'+_0x5c70ee[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x2fc95b;}})});}_0x5e5b6f=_[_0x8c19('0x43')]({},_0x5e5b6f,_0x5c70ee['options']);var _0xa4b942={'where':_0x5e5b6f[_0x8c19('0x41')]};return db[_0x8c19('0x31')][_0x8c19('0x44')](_0xa4b942)[_0x8c19('0x2f')](function(_0x3d2e7d){_0x469d24[_0x8c19('0x44')]=_0x3d2e7d;if(_0x5c70ee['query'][_0x8c19('0x45')]){_0x5e5b6f['include']=[{'all':!![]}];}return db[_0x8c19('0x31')][_0x8c19('0x46')](_0x5e5b6f);})[_0x8c19('0x2f')](function(_0x5735e6){_0x469d24[_0x8c19('0x47')]=_0x5735e6;return _0x469d24;})[_0x8c19('0x2f')](respondWithFilteredResult(_0x534673,_0x5e5b6f))['catch'](handleError(_0x534673,null));};exports[_0x8c19('0x48')]=function(_0x3cb7c4,_0x5ced1c){var _0x4dac25={'raw':![],'where':{'id':_0x3cb7c4[_0x8c19('0x49')]['id']}},_0x861b4b={};_0x861b4b['model']=_['keys'](db[_0x8c19('0x31')][_0x8c19('0x32')]);_0x861b4b['query']=_[_0x8c19('0x36')](_0x3cb7c4[_0x8c19('0x35')]);_0x861b4b['filters']=_['intersection'](_0x861b4b['model'],_0x861b4b['query']);_0x4dac25[_0x8c19('0x3b')]=_['intersection'](_0x861b4b['model'],qs[_0x8c19('0x3a')](_0x3cb7c4[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x4dac25[_0x8c19('0x3b')]=_0x4dac25['attributes'][_0x8c19('0x3c')]?_0x4dac25[_0x8c19('0x3b')]:_0x861b4b[_0x8c19('0x39')];if(_0x3cb7c4[_0x8c19('0x35')][_0x8c19('0x45')]){_0x4dac25[_0x8c19('0x4a')]=[{'all':!![]}];}_0x4dac25=_[_0x8c19('0x43')]({},_0x4dac25,_0x3cb7c4[_0x8c19('0x4b')]);return db['VoiceQueue']['find'](_0x4dac25)['then'](handleEntityNotFound(_0x5ced1c,null))[_0x8c19('0x2f')](respondWithResult(_0x5ced1c,null))[_0x8c19('0x4c')](handleError(_0x5ced1c,null));};exports[_0x8c19('0x4d')]=function(_0xb0a493,_0x3e4add){return db['VoiceQueue']['create'](_0xb0a493[_0x8c19('0x4e')],{})[_0x8c19('0x2f')](function(_0x218be3){var _0x49becc=_0xb0a493['user'][_0x8c19('0x4f')]({'plain':!![]});if(!_0x49becc)throw new Error(_0x8c19('0x50'));if(_0x49becc[_0x8c19('0x51')]===_0x8c19('0x52')){var _0x5cd6c8=_0x218be3[_0x8c19('0x4f')]({'plain':!![]});var _0x32cb28=[{'name':_0x8c19('0x27'),'value':_0x8c19('0x28')},{'name':'QueueCampaigns','value':'outbound'}];var _0xbc5df3=_[_0x8c19('0x2d')](_0x32cb28,[_0x8c19('0x2b'),_0x5cd6c8[_0x8c19('0x2c')]])[_0x8c19('0x2e')];return db[_0x8c19('0x53')][_0x8c19('0x2d')]({'where':{'name':_0xbc5df3,'userProfileId':_0x49becc[_0x8c19('0x54')]},'raw':!![]})[_0x8c19('0x2f')](function(_0x3629ee){if(_0x3629ee&&_0x3629ee[_0x8c19('0x55')]===0x0){return db[_0x8c19('0x56')]['create']({'name':_0x5cd6c8[_0x8c19('0x2e')],'resourceId':_0x5cd6c8['id'],'type':_0x3629ee[_0x8c19('0x2e')],'sectionId':_0x3629ee['id']},{})['then'](function(){return _0x218be3;});}else{return _0x218be3;}})[_0x8c19('0x4c')](function(_0x2df2a5){logger[_0x8c19('0x57')](_0x8c19('0x58'),_0x2df2a5);throw _0x2df2a5;});}return _0x218be3;})[_0x8c19('0x2f')](respondWithResult(_0x3e4add,0xc9))[_0x8c19('0x4c')](handleError(_0x3e4add,null));};exports[_0x8c19('0x59')]=function(_0x17c181,_0x31f766){var _0xb3ade8={'where':{'id':_0x17c181[_0x8c19('0x49')]['id']}},_0x5e2ec2={};_0x5e2ec2['model']=_['keys'](db['VoiceQueue'][_0x8c19('0x32')]);_0xb3ade8[_0x8c19('0x3b')]=_[_0x8c19('0x38')](_0x5e2ec2[_0x8c19('0x39')],qs['fields'](_0x17c181[_0x8c19('0x35')][_0x8c19('0x3a')]));_0xb3ade8['attributes']=_0xb3ade8[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0xb3ade8[_0x8c19('0x3b')]:_0x5e2ec2[_0x8c19('0x39')];if(_0x17c181[_0x8c19('0x35')][_0x8c19('0x45')]){_0xb3ade8['include']=[{'all':!![]}];}_0xb3ade8=_[_0x8c19('0x43')]({},_0xb3ade8,_0x17c181[_0x8c19('0x4b')]);return db[_0x8c19('0x31')][_0x8c19('0x2d')](_0xb3ade8)[_0x8c19('0x2f')](handleEntityNotFound(_0x31f766,null))[_0x8c19('0x2f')](function(_0x2a2ad3){if(_0x2a2ad3){var _0x1ac036=_0x2a2ad3[_0x8c19('0x4f')]({'plain':!![]});_0x1ac036=qs['omit'](_0x1ac036,['id',_0x8c19('0x5a'),_0x8c19('0x5b')]);_0x17c181[_0x8c19('0x4e')]=_[_0x8c19('0x5c')](_0x17c181[_0x8c19('0x4e')],['id',_0x8c19('0x5a'),_0x8c19('0x5b')]);return db[_0x8c19('0x31')]['create'](_[_0x8c19('0x43')](_0x1ac036,_0x17c181[_0x8c19('0x4e')]),{'include':_0x17c181[_0x8c19('0x35')][_0x8c19('0x45')]?[{'all':!![]}]:undefined})[_0x8c19('0x2f')](function(_0x2b334d){var _0x282fa4=_0x17c181[_0x8c19('0x52')][_0x8c19('0x4f')]({'plain':!![]});if(!_0x282fa4)throw new Error(_0x8c19('0x50'));if(_0x282fa4[_0x8c19('0x51')]==='user'){var _0x588d07=_0x2b334d[_0x8c19('0x4f')]({'plain':!![]});var _0x4cdda2=[{'name':_0x8c19('0x27'),'value':'inbound'},{'name':_0x8c19('0x5d'),'value':_0x8c19('0x5e')}];var _0x582cec=_[_0x8c19('0x2d')](_0x4cdda2,[_0x8c19('0x2b'),_0x588d07[_0x8c19('0x2c')]])['name'];return db[_0x8c19('0x53')]['find']({'where':{'name':_0x582cec,'userProfileId':_0x282fa4[_0x8c19('0x54')]},'raw':!![]})[_0x8c19('0x2f')](function(_0x13b138){if(_0x13b138&&_0x13b138[_0x8c19('0x55')]===0x0){return db[_0x8c19('0x56')][_0x8c19('0x4d')]({'name':_0x588d07[_0x8c19('0x2e')],'resourceId':_0x588d07['id'],'type':_0x13b138[_0x8c19('0x2e')],'sectionId':_0x13b138['id']},{})[_0x8c19('0x2f')](function(){return _0x2b334d;});}else{return _0x2b334d;}})['catch'](function(_0x4c92e9){logger[_0x8c19('0x57')](_0x8c19('0x58'),_0x4c92e9);throw _0x4c92e9;});}return _0x2b334d;});}})[_0x8c19('0x2f')](respondWithResult(_0x31f766,0xc9))[_0x8c19('0x4c')](handleError(_0x31f766,null));};exports[_0x8c19('0x26')]=function(_0x4b6795,_0x58e96b){if(_0x4b6795[_0x8c19('0x4e')]['id']){delete _0x4b6795['body']['id'];}return db['VoiceQueue'][_0x8c19('0x2d')]({'where':{'id':_0x4b6795['params']['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x58e96b,null))[_0x8c19('0x2f')](saveUpdates(_0x4b6795[_0x8c19('0x4e')],null))[_0x8c19('0x2f')](respondWithResult(_0x58e96b,null))['catch'](handleError(_0x58e96b,null));};exports[_0x8c19('0x5f')]=function(_0x30dce9,_0x29fbf3){return db[_0x8c19('0x31')][_0x8c19('0x2d')]({'where':{'id':_0x30dce9[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x29fbf3,null))[_0x8c19('0x2f')](removeEntity(_0x29fbf3,null))[_0x8c19('0x4c')](handleError(_0x29fbf3,null));};exports['getHoppers']=function(_0x19dfe6,_0x3b02e4,_0x2e7210){var _0x18599d={'raw':![],'where':{}};var _0x14e23c={};var _0x41f319={'count':0x0,'rows':[]};return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0x19dfe6[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x3b02e4,null))[_0x8c19('0x2f')](function(_0x219b92){if(_0x219b92){_0x14e23c[_0x8c19('0x39')]=_[_0x8c19('0x36')](db[_0x8c19('0x61')][_0x8c19('0x32')]);_0x14e23c['query']=_[_0x8c19('0x36')](_0x19dfe6[_0x8c19('0x35')]);_0x14e23c[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x14e23c[_0x8c19('0x39')],_0x14e23c['query']);_0x18599d[_0x8c19('0x3b')]=_[_0x8c19('0x38')](_0x14e23c[_0x8c19('0x39')],qs['fields'](_0x19dfe6[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x18599d[_0x8c19('0x3b')]=_0x18599d['attributes'][_0x8c19('0x3c')]?_0x18599d[_0x8c19('0x3b')]:_0x14e23c[_0x8c19('0x39')];if(!_0x19dfe6['query'][_0x8c19('0x3d')]('nolimit')){_0x18599d[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x19dfe6[_0x8c19('0x35')]['limit']);_0x18599d[_0x8c19('0x21')]=qs[_0x8c19('0x21')](_0x19dfe6[_0x8c19('0x35')][_0x8c19('0x21')]);}_0x18599d[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0x19dfe6[_0x8c19('0x35')]['sort']);_0x18599d[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_['pick'](_0x19dfe6[_0x8c19('0x35')],_0x14e23c['filters']));_0x18599d[_0x8c19('0x41')][_0x8c19('0x62')]=_0x219b92['id'];if(_0x19dfe6['query'][_0x8c19('0x29')]){_0x18599d['where']=_[_0x8c19('0x43')](_0x18599d[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x18599d[_0x8c19('0x3b')],function(_0x1cebd5){var _0xe419cf={};_0xe419cf[_0x1cebd5]={'$like':'%'+_0x19dfe6['query'][_0x8c19('0x29')]+'%'};return _0xe419cf;})});}_0x18599d=_[_0x8c19('0x43')]({},_0x18599d,_0x19dfe6[_0x8c19('0x4b')]);return db['CmHopper']['count']({'where':_0x18599d[_0x8c19('0x41')]})[_0x8c19('0x2f')](function(_0x2c1bee){_0x41f319[_0x8c19('0x44')]=_0x2c1bee;if(_0x19dfe6[_0x8c19('0x35')][_0x8c19('0x45')]){_0x18599d['include']=[{'all':!![]}];}return db['CmHopper'][_0x8c19('0x46')](_0x18599d);})[_0x8c19('0x2f')](function(_0x38dfa4){_0x41f319[_0x8c19('0x47')]=_0x38dfa4;return _0x41f319;});}})[_0x8c19('0x2f')](respondWithFilteredResult(_0x3b02e4,_0x18599d))['catch'](handleError(_0x3b02e4,null));};exports[_0x8c19('0x63')]=function(_0x458c18,_0x4cf738,_0x2a7545){var _0x23b1b0={'raw':!![],'where':{}};var _0x3e03b6={};var _0x18cf94={'count':0x0,'rows':[]};return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0x458c18['params']['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x4cf738,null))[_0x8c19('0x2f')](function(_0x4f58e1){if(_0x4f58e1){_0x3e03b6[_0x8c19('0x39')]=_[_0x8c19('0x36')](db['CmHopperHistory']['rawAttributes']);_0x3e03b6[_0x8c19('0x35')]=_['keys'](_0x458c18[_0x8c19('0x35')]);_0x3e03b6[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x3e03b6['model'],_0x3e03b6['query']);_0x23b1b0[_0x8c19('0x3b')]=_['intersection'](_0x3e03b6[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0x458c18[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x23b1b0['attributes']=_0x23b1b0[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x23b1b0[_0x8c19('0x3b')]:_0x3e03b6[_0x8c19('0x39')];if(!_0x458c18[_0x8c19('0x35')][_0x8c19('0x3d')](_0x8c19('0x3e'))){_0x23b1b0['limit']=qs['limit'](_0x458c18[_0x8c19('0x35')][_0x8c19('0x22')]);_0x23b1b0[_0x8c19('0x21')]=qs['offset'](_0x458c18[_0x8c19('0x35')]['offset']);}_0x23b1b0['order']=qs[_0x8c19('0x40')](_0x458c18[_0x8c19('0x35')][_0x8c19('0x40')]);_0x23b1b0[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0x458c18[_0x8c19('0x35')],_0x3e03b6[_0x8c19('0x37')]));_0x23b1b0['where']['VoiceQueueId']=_0x4f58e1['id'];if(_0x458c18['query'][_0x8c19('0x29')]){_0x23b1b0[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x23b1b0[_0x8c19('0x41')],{'$or':_['map'](_0x23b1b0[_0x8c19('0x3b')],function(_0x346424){var _0x39b40b={};_0x39b40b[_0x346424]={'$like':'%'+_0x458c18[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x39b40b;})});}_0x23b1b0=_['merge']({},_0x23b1b0,_0x458c18[_0x8c19('0x4b')]);return db[_0x8c19('0x64')][_0x8c19('0x44')]({'where':_0x23b1b0['where']})[_0x8c19('0x2f')](function(_0x15c6b0){_0x18cf94[_0x8c19('0x44')]=_0x15c6b0;if(_0x458c18[_0x8c19('0x35')][_0x8c19('0x45')]){_0x23b1b0['include']=[{'all':!![]}];}return db[_0x8c19('0x64')][_0x8c19('0x46')](_0x23b1b0);})[_0x8c19('0x2f')](function(_0x509551){_0x18cf94['rows']=_0x509551;return _0x18cf94;});}})['then'](respondWithFilteredResult(_0x4cf738,_0x23b1b0))[_0x8c19('0x4c')](handleError(_0x4cf738,null));};exports[_0x8c19('0x65')]=function(_0x3ecc54,_0xd2cd47,_0x1e253b){var _0x409e72={'raw':!![],'where':{}};var _0x503a41={};var _0x4cd516={'count':0x0,'rows':[]};return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0x3ecc54[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0xd2cd47,null))['then'](function(_0x24cc3d){if(_0x24cc3d){_0x503a41[_0x8c19('0x39')]=_[_0x8c19('0x36')](db[_0x8c19('0x66')][_0x8c19('0x32')]);_0x503a41['query']=_[_0x8c19('0x36')](_0x3ecc54[_0x8c19('0x35')]);_0x503a41[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x503a41[_0x8c19('0x39')],_0x503a41[_0x8c19('0x35')]);_0x409e72[_0x8c19('0x3b')]=_[_0x8c19('0x38')](_0x503a41[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0x3ecc54[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x409e72[_0x8c19('0x3b')]=_0x409e72[_0x8c19('0x3b')]['length']?_0x409e72[_0x8c19('0x3b')]:_0x503a41[_0x8c19('0x39')];if(!_0x3ecc54['query'][_0x8c19('0x3d')]('nolimit')){_0x409e72[_0x8c19('0x22')]=qs['limit'](_0x3ecc54[_0x8c19('0x35')][_0x8c19('0x22')]);_0x409e72[_0x8c19('0x21')]=qs[_0x8c19('0x21')](_0x3ecc54[_0x8c19('0x35')][_0x8c19('0x21')]);}_0x409e72[_0x8c19('0x3f')]=qs['sort'](_0x3ecc54['query']['sort']);_0x409e72['where']=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0x3ecc54[_0x8c19('0x35')],_0x503a41[_0x8c19('0x37')]));_0x409e72[_0x8c19('0x41')][_0x8c19('0x62')]=_0x24cc3d['id'];if(_0x3ecc54['query'][_0x8c19('0x29')]){_0x409e72[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x409e72[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x409e72[_0x8c19('0x3b')],function(_0x558ac0){var _0x12a5a3={};_0x12a5a3[_0x558ac0]={'$like':'%'+_0x3ecc54['query'][_0x8c19('0x29')]+'%'};return _0x12a5a3;})});}_0x409e72=_[_0x8c19('0x43')]({},_0x409e72,_0x3ecc54[_0x8c19('0x4b')]);return db[_0x8c19('0x66')][_0x8c19('0x44')]({'where':_0x409e72[_0x8c19('0x41')]})[_0x8c19('0x2f')](function(_0x5dd023){_0x4cd516[_0x8c19('0x44')]=_0x5dd023;if(_0x3ecc54['query'][_0x8c19('0x45')]){_0x409e72[_0x8c19('0x4a')]=[{'all':!![]}];}return db[_0x8c19('0x66')]['findAll'](_0x409e72);})[_0x8c19('0x2f')](function(_0x58f6eb){_0x4cd516[_0x8c19('0x47')]=_0x58f6eb;return _0x4cd516;});}})[_0x8c19('0x2f')](respondWithFilteredResult(_0xd2cd47,_0x409e72))['catch'](handleError(_0xd2cd47,null));};exports['getHopperBlacks']=function(_0xa50daf,_0x4fc365,_0x17a582){var _0x3ef900={'raw':!![],'where':{}};var _0x377e2b={};var _0x37e6e2={'count':0x0,'rows':[]};return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0xa50daf[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x4fc365,null))[_0x8c19('0x2f')](function(_0xa0b464){if(_0xa0b464){_0x377e2b[_0x8c19('0x39')]=_[_0x8c19('0x36')](db[_0x8c19('0x67')][_0x8c19('0x32')]);_0x377e2b[_0x8c19('0x35')]=_[_0x8c19('0x36')](_0xa50daf[_0x8c19('0x35')]);_0x377e2b[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x377e2b[_0x8c19('0x39')],_0x377e2b[_0x8c19('0x35')]);_0x3ef900['attributes']=_[_0x8c19('0x38')](_0x377e2b[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0xa50daf[_0x8c19('0x35')]['fields']));_0x3ef900[_0x8c19('0x3b')]=_0x3ef900['attributes'][_0x8c19('0x3c')]?_0x3ef900[_0x8c19('0x3b')]:_0x377e2b[_0x8c19('0x39')];if(!_0xa50daf['query'][_0x8c19('0x3d')](_0x8c19('0x3e'))){_0x3ef900['limit']=qs[_0x8c19('0x22')](_0xa50daf[_0x8c19('0x35')][_0x8c19('0x22')]);_0x3ef900[_0x8c19('0x21')]=qs[_0x8c19('0x21')](_0xa50daf[_0x8c19('0x35')][_0x8c19('0x21')]);}_0x3ef900[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0xa50daf[_0x8c19('0x35')]['sort']);_0x3ef900[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0xa50daf[_0x8c19('0x35')],_0x377e2b['filters']));_0x3ef900[_0x8c19('0x41')][_0x8c19('0x62')]=_0xa0b464['id'];if(_0xa50daf['query'][_0x8c19('0x29')]){_0x3ef900[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x3ef900[_0x8c19('0x41')],{'$or':_['map'](_0x3ef900['attributes'],function(_0xfb5832){var _0x3ef0d8={};_0x3ef0d8[_0xfb5832]={'$like':'%'+_0xa50daf[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x3ef0d8;})});}_0x3ef900=_[_0x8c19('0x43')]({},_0x3ef900,_0xa50daf[_0x8c19('0x4b')]);return db[_0x8c19('0x67')][_0x8c19('0x44')]({'where':_0x3ef900['where']})[_0x8c19('0x2f')](function(_0x3020a2){_0x37e6e2[_0x8c19('0x44')]=_0x3020a2;if(_0xa50daf[_0x8c19('0x35')][_0x8c19('0x45')]){_0x3ef900[_0x8c19('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8c19('0x46')](_0x3ef900);})[_0x8c19('0x2f')](function(_0x2e6cf1){_0x37e6e2['rows']=_0x2e6cf1;return _0x37e6e2;});}})[_0x8c19('0x2f')](respondWithFilteredResult(_0x4fc365,_0x3ef900))[_0x8c19('0x4c')](handleError(_0x4fc365,null));};exports[_0x8c19('0x68')]=function(_0x26e92d,_0xc432dd,_0x5c49c5){var _0x53d45a={};var _0x17255={};var _0x17a202;var _0x56f32b;return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0x26e92d[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0xc432dd,null))[_0x8c19('0x2f')](function(_0x261223){if(_0x261223){_0x17a202=_0x261223;_0x17255[_0x8c19('0x39')]=_[_0x8c19('0x36')](db[_0x8c19('0x69')][_0x8c19('0x32')]);_0x17255[_0x8c19('0x35')]=_[_0x8c19('0x36')](_0x26e92d[_0x8c19('0x35')]);_0x17255['filters']=_['intersection'](_0x17255['model'],_0x17255[_0x8c19('0x35')]);_0x53d45a[_0x8c19('0x3b')]=_[_0x8c19('0x38')](_0x17255[_0x8c19('0x39')],qs['fields'](_0x26e92d[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x53d45a[_0x8c19('0x3b')]=_0x53d45a[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x53d45a[_0x8c19('0x3b')]:_0x17255[_0x8c19('0x39')];_0x53d45a[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0x26e92d[_0x8c19('0x35')][_0x8c19('0x40')]);_0x53d45a[_0x8c19('0x41')]=qs['filters'](_[_0x8c19('0x42')](_0x26e92d[_0x8c19('0x35')],_0x17255[_0x8c19('0x37')]));if(_0x26e92d[_0x8c19('0x35')][_0x8c19('0x29')]){_0x53d45a[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x53d45a[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x53d45a[_0x8c19('0x3b')],function(_0x17b120){var _0x32dc70={};_0x32dc70[_0x17b120]={'$like':'%'+_0x26e92d[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x32dc70;})});}_0x53d45a=_['merge']({},_0x53d45a,_0x26e92d[_0x8c19('0x4b')]);return _0x17a202[_0x8c19('0x68')](_0x53d45a);}})[_0x8c19('0x2f')](function(_0x9e1604){if(_0x9e1604){_0x56f32b=_0x9e1604[_0x8c19('0x3c')];if(!_0x26e92d['query']['hasOwnProperty'](_0x8c19('0x3e'))){_0x53d45a[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x26e92d[_0x8c19('0x35')]['limit']);_0x53d45a[_0x8c19('0x21')]=qs['offset'](_0x26e92d[_0x8c19('0x35')]['offset']);}return _0x17a202[_0x8c19('0x68')](_0x53d45a);}})[_0x8c19('0x2f')](function(_0xd99069){if(_0xd99069){return _0xd99069?{'count':_0x56f32b,'rows':_0xd99069}:null;}})[_0x8c19('0x2f')](respondWithResult(_0xc432dd,null))['catch'](handleError(_0xc432dd,null));};exports[_0x8c19('0x6a')]=function(_0x11aedd,_0x5b90ff,_0x11099d){var _0x1a7dbb=_0x11aedd['body'][_0x8c19('0x6b')];var _0x2f3243=_['map'](_0x1a7dbb,'id');return db['Team'][_0x8c19('0x46')]({'where':{'id':_0x2f3243},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8c19('0x6c'),'attributes':['id','name',_0x8c19('0x6d'),_0x8c19('0x6e'),_0x8c19('0x6f')],'raw':!![]}]})[_0x8c19('0x2f')](function(_0x11c87e){if(_0x11c87e){var _0x4470aa=_[_0x8c19('0x70')](_0x11c87e,function(_0x8d50d6){var _0x32616e=_0x8d50d6[_0x8c19('0x4f')]({'plain':!![]});_0x32616e['Agents'][_0x8c19('0x71')](function(_0x3d2f35){_0x3d2f35[_0x8c19('0x72')]=_[_0x8c19('0x2d')](_0x1a7dbb,{'id':_0x32616e['id']})[_0x8c19('0x72')];});return _0x32616e[_0x8c19('0x6c')];});return db[_0x8c19('0x31')]['find']({'where':{'id':_0x11aedd[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](function(_0x4b379f){return db['sequelize'][_0x8c19('0x73')](function(_0x1ecdcd){return _0x4b379f['addTeams'](_0x2f3243,{'transaction':_0x1ecdcd})[_0x8c19('0x2f')](function(){return BPromise[_0x8c19('0x74')](_0x4470aa,function(_0x30218f){return db[_0x8c19('0x75')]['findOrCreate']({'where':{'UserId':_0x30218f['id'],'VoiceQueueId':_0x11aedd[_0x8c19('0x49')]['id']},'defaults':{'penalty':_0x30218f['penalty']},'transaction':_0x1ecdcd});});})[_0x8c19('0x2f')](function(){return BPromise[_0x8c19('0x74')](_[_0x8c19('0x29')](_0x4470aa,{'online':!![]}),function(_0x2edc04){return db[_0x8c19('0x76')][_0x8c19('0x77')]({'membername':_0x2edc04[_0x8c19('0x2e')],'UserId':_0x2edc04['id'],'queue_name':_0x4b379f[_0x8c19('0x2e')],'VoiceQueueId':_0x4b379f['id'],'interface':_[_0x8c19('0x78')](_0x2edc04['interface'])?util[_0x8c19('0x79')](_0x8c19('0x7a'),_0x2edc04[_0x8c19('0x2e')]):_0x2edc04['interface'],'paused':_0x2edc04[_0x8c19('0x6e')]||![],'penalty':_0x2edc04[_0x8c19('0x72')]},{'transaction':_0x1ecdcd});});})[_0x8c19('0x2f')](function(){_0x4470aa['forEach'](function(_0x58fbba){socket[_0x8c19('0x7b')](_0x8c19('0x7c'),{'UserId':_0x58fbba['id'],'VoiceQueueId':_0x4b379f['id']});});});});});}})['then'](respondWithStatusCode(_0x5b90ff,null))['catch'](handleError(_0x5b90ff,null));};exports['removeTeams']=function(_0x43a857,_0x3cfba6,_0x2c5315){return db[_0x8c19('0x69')][_0x8c19('0x46')]({'where':{'id':_0x43a857[_0x8c19('0x35')][_0x8c19('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x8c19('0x7e')],'as':_0x8c19('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x8c19('0x2f')](handleEntityNotFound(_0x3cfba6,null))[_0x8c19('0x2f')](function(_0x3dbe66){var _0x2b9bbb=_[_0x8c19('0x2a')](_0x3dbe66,'id');var _0x5f38a0=[];var _0x5359ee=[];var _0x2debaa=squel['select']();_0x2debaa[_0x8c19('0x7f')](_0x8c19('0x80'))[_0x8c19('0x81')](_0x8c19('0x82'),'tq')[_0x8c19('0x83')](_0x8c19('0x84'),'ut',_0x8c19('0x85'))[_0x8c19('0x41')](_0x8c19('0x86'),_0x43a857[_0x8c19('0x49')]['id']);for(var _0x519452=0x0;_0x519452<_0x3dbe66['length'];_0x519452+=0x1){let _0x3dac5d=_0x3dbe66[_0x519452];for(var _0x5a5ac9=0x0;_0x5a5ac9<_0x3dac5d[_0x8c19('0x6c')][_0x8c19('0x3c')];_0x5a5ac9+=0x1){let _0x50e146=_0x3dac5d[_0x8c19('0x6c')][_0x5a5ac9];var _0xd19004=_0x2debaa['clone']();_0xd19004[_0x8c19('0x41')](_0x8c19('0x87'),_0x50e146['id']);_0x5359ee[_0x8c19('0x88')](db[_0x8c19('0x89')][_0x8c19('0x35')](_0xd19004[_0x8c19('0x8a')](),{'type':db[_0x8c19('0x89')][_0x8c19('0x8b')]['SELECT']})[_0x8c19('0x2f')](function(_0x41a859){if(_0x41a859[_0x8c19('0x3c')]===0x1){return _0x50e146['id'];}else{var _0x372556=_['every'](_[_0x8c19('0x2a')](_0x41a859,_0x8c19('0x8c')),function(_0x261d09){return _[_0x8c19('0x8d')](_0x2b9bbb,_0x261d09);});if(_0x372556){return _0x50e146['id'];}}}));}}return BPromise['all'](_0x5359ee)[_0x8c19('0x2f')](function(_0x22251d){_0x5f38a0=_(_0x5f38a0)[_0x8c19('0x8e')](_0x22251d)[_0x8c19('0x8f')]()[_0x8c19('0x2b')]();return db[_0x8c19('0x31')]['find']({'where':{'id':_0x43a857[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](function(_0x403c56){return db[_0x8c19('0x89')][_0x8c19('0x73')](function(_0x3f93f0){return _0x403c56[_0x8c19('0x90')](_0x43a857[_0x8c19('0x35')][_0x8c19('0x7d')],{'transaction':_0x3f93f0})[_0x8c19('0x2f')](function(){if(!_[_0x8c19('0x91')](_0x5f38a0)){return _0x403c56[_0x8c19('0x92')](_0x5f38a0,{'transaction':_0x3f93f0})[_0x8c19('0x2f')](function(){return db[_0x8c19('0x76')][_0x8c19('0x5f')]({'where':{'VoiceQueueId':_0x43a857[_0x8c19('0x49')]['id'],'UserId':_0x5f38a0},'transaction':_0x3f93f0});});}})[_0x8c19('0x2f')](function(){_0x5f38a0[_0x8c19('0x71')](function(_0x3ca3be){socket[_0x8c19('0x7b')](_0x8c19('0x93'),{'UserId':_0x3ca3be,'VoiceQueueId':_0x403c56['id']});});});});});});})[_0x8c19('0x2f')](respondWithStatusCode(_0x3cfba6,null))[_0x8c19('0x4c')](handleError(_0x3cfba6,null));};exports[_0x8c19('0x94')]=function(_0xcb3937,_0x135301,_0x17f351){var _0x1e58dd,_0x3691e2;return db[_0x8c19('0x31')]['find']({'where':{'id':_0xcb3937[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x135301,null))[_0x8c19('0x2f')](function(_0x34aa42){if(_0x34aa42){_0x3691e2=_0x34aa42;return _0x34aa42[_0x8c19('0x94')](_0xcb3937[_0x8c19('0x4e')]['ids'],_[_0x8c19('0x5c')](_0xcb3937['body'],[_0x8c19('0x7d'),'id'])||{})[_0x8c19('0x95')](function(_0x3f2666){for(var _0x346468=0x0;_0x346468<_0xcb3937[_0x8c19('0x4e')][_0x8c19('0x7d')][_0x8c19('0x3c')];_0x346468+=0x1){socket[_0x8c19('0x7b')](_0x8c19('0x7c'),{'UserId':_0xcb3937['body']['ids'][_0x346468],'VoiceQueueId':_0xcb3937[_0x8c19('0x49')]['id']});}return _0x3f2666;});}})[_0x8c19('0x2f')](function(_0x19bb7e){_0x1e58dd=_0x19bb7e||[];if(_0x3691e2){return db['User'][_0x8c19('0x46')]({'where':{'id':_0xcb3937[_0x8c19('0x4e')]['ids']},'attributes':['id','name',_0x8c19('0x6d'),_0x8c19('0x6e'),'interface'],'raw':!![]});}})[_0x8c19('0x2f')](function(_0x2305d0){if(!_[_0x8c19('0x91')](_0x2305d0)){var _0x672508=[];for(var _0x81c562=0x0;_0x81c562<_0x2305d0['length'];_0x81c562++){if(_0x2305d0[_0x81c562]['online']){_0x672508[_0x8c19('0x88')](db[_0x8c19('0x76')]['upsert']({'membername':_0x2305d0[_0x81c562]['name'],'UserId':_0x2305d0[_0x81c562]['id'],'queue_name':_0x3691e2[_0x8c19('0x2e')],'VoiceQueueId':_0x3691e2['id'],'interface':_[_0x8c19('0x78')](_0x2305d0[_0x81c562][_0x8c19('0x6f')])?util[_0x8c19('0x79')]('SIP/%s',_0x2305d0[_0x81c562][_0x8c19('0x2e')]):_0x2305d0[_0x81c562][_0x8c19('0x6f')],'paused':_0x2305d0[_0x81c562][_0x8c19('0x6e')]||![],'penalty':_0xcb3937[_0x8c19('0x4e')]['penalty']||0x0}));}}return BPromise[_0x8c19('0x96')](_0x672508);}})['then'](function(){return _0x1e58dd;})[_0x8c19('0x2f')](respondWithResult(_0x135301,null))[_0x8c19('0x4c')](handleError(_0x135301,null));};exports[_0x8c19('0x92')]=function(_0x446b45,_0x27c59e,_0x3b4402){return db[_0x8c19('0x31')][_0x8c19('0x2d')]({'where':{'id':_0x446b45['params']['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x27c59e,null))[_0x8c19('0x2f')](function(_0x20c5ae){if(_0x20c5ae){return _0x20c5ae[_0x8c19('0x92')](_0x446b45[_0x8c19('0x35')][_0x8c19('0x7d')])[_0x8c19('0x2f')](function(){if(_[_0x8c19('0x97')](_0x446b45[_0x8c19('0x35')][_0x8c19('0x7d')])){for(var _0x1e3305=0x0;_0x1e3305<_0x446b45[_0x8c19('0x35')]['ids'][_0x8c19('0x3c')];_0x1e3305+=0x1){socket[_0x8c19('0x7b')](_0x8c19('0x93'),{'UserId':Number(_0x446b45[_0x8c19('0x35')][_0x8c19('0x7d')][_0x1e3305]),'VoiceQueueId':Number(_0x446b45[_0x8c19('0x49')]['id'])});}}else{socket[_0x8c19('0x7b')](_0x8c19('0x93'),{'UserId':Number(_0x446b45[_0x8c19('0x35')]['ids']),'VoiceQueueId':Number(_0x446b45[_0x8c19('0x49')]['id'])});}});}})[_0x8c19('0x2f')](function(_0x4801c7){return db[_0x8c19('0x76')][_0x8c19('0x5f')]({'where':{'VoiceQueueId':_0x446b45[_0x8c19('0x49')]['id'],'UserId':_0x446b45[_0x8c19('0x35')]['ids']}})[_0x8c19('0x2f')](function(){return _0x4801c7;});})[_0x8c19('0x2f')](respondWithStatusCode(_0x27c59e,null))[_0x8c19('0x4c')](handleError(_0x27c59e,null));};exports[_0x8c19('0x98')]=function(_0x402697,_0x909eb1,_0x4d8a08){var _0x334283={};var _0x25ad21={};var _0x28b1ec;var _0x97740a;return db[_0x8c19('0x31')][_0x8c19('0x60')]({'where':{'id':_0x402697[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x909eb1,null))['then'](function(_0x22da37){if(_0x22da37){_0x28b1ec=_0x22da37;_0x25ad21['model']=_[_0x8c19('0x36')](db[_0x8c19('0x7e')][_0x8c19('0x32')]);_0x25ad21[_0x8c19('0x35')]=_[_0x8c19('0x36')](_0x402697[_0x8c19('0x35')]);_0x25ad21[_0x8c19('0x37')]=_[_0x8c19('0x38')](_0x25ad21[_0x8c19('0x39')],_0x25ad21[_0x8c19('0x35')]);_0x334283['attributes']=_[_0x8c19('0x38')](_0x25ad21[_0x8c19('0x39')],qs['fields'](_0x402697[_0x8c19('0x35')][_0x8c19('0x3a')]));_0x334283[_0x8c19('0x3b')]=_0x334283[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x334283[_0x8c19('0x3b')]:_0x25ad21[_0x8c19('0x39')];_0x334283[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0x402697[_0x8c19('0x35')][_0x8c19('0x40')]);_0x334283[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0x402697['query'],_0x25ad21[_0x8c19('0x37')]));if(_0x402697[_0x8c19('0x35')][_0x8c19('0x29')]){_0x334283[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x334283[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x334283[_0x8c19('0x3b')],function(_0x358f9e){var _0x54ec8d={};_0x54ec8d[_0x358f9e]={'$like':'%'+_0x402697['query'][_0x8c19('0x29')]+'%'};return _0x54ec8d;})});}_0x334283=_[_0x8c19('0x43')]({},_0x334283,_0x402697[_0x8c19('0x4b')]);return _0x28b1ec['getAgents'](_0x334283);}})[_0x8c19('0x2f')](function(_0x467950){if(_0x467950){_0x97740a=_0x467950[_0x8c19('0x3c')];if(!_0x402697[_0x8c19('0x35')][_0x8c19('0x3d')](_0x8c19('0x3e'))){_0x334283[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x402697[_0x8c19('0x35')][_0x8c19('0x22')]);_0x334283[_0x8c19('0x21')]=qs[_0x8c19('0x21')](_0x402697['query'][_0x8c19('0x21')]);}return _0x28b1ec[_0x8c19('0x98')](_0x334283);}})[_0x8c19('0x2f')](function(_0x10cf25){if(_0x10cf25){return _0x10cf25?{'count':_0x97740a,'rows':_0x10cf25}:null;}})[_0x8c19('0x2f')](respondWithResult(_0x909eb1,null))[_0x8c19('0x4c')](handleError(_0x909eb1,null));};exports[_0x8c19('0x99')]=function(_0x477bcf,_0x38dd4a,_0x28ff7b){var _0x2b9a62={};var _0x1562dc={};var _0x3b9ecd;var _0x275999;return db['VoiceQueue']['findOne']({'where':{'id':_0x477bcf['params']['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x38dd4a,null))['then'](function(_0x222b32){if(_0x222b32){_0x3b9ecd=_0x222b32;_0x1562dc[_0x8c19('0x39')]=_[_0x8c19('0x36')](db['UserVoiceQueueRt'][_0x8c19('0x32')]);_0x1562dc['query']=_['keys'](_0x477bcf['query']);_0x1562dc['filters']=_['intersection'](_0x1562dc['model'],_0x1562dc['query']);_0x2b9a62['attributes']=_[_0x8c19('0x38')](_0x1562dc[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0x477bcf['query']['fields']));_0x2b9a62['attributes']=_0x2b9a62[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x2b9a62[_0x8c19('0x3b')]:_0x1562dc['model'];_0x2b9a62[_0x8c19('0x3f')]=qs['sort'](_0x477bcf[_0x8c19('0x35')]['sort']);_0x2b9a62[_0x8c19('0x41')]=qs[_0x8c19('0x37')](_['pick'](_0x477bcf[_0x8c19('0x35')],_0x1562dc[_0x8c19('0x37')]));if(_0x477bcf[_0x8c19('0x35')]['filter']){_0x2b9a62[_0x8c19('0x41')]=_['merge'](_0x2b9a62[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x2b9a62[_0x8c19('0x3b')],function(_0x2abffd){var _0x36b262={};_0x36b262[_0x2abffd]={'$like':'%'+_0x477bcf[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x36b262;})});}_0x2b9a62=_[_0x8c19('0x43')]({},_0x2b9a62,_0x477bcf['options']);return _0x3b9ecd[_0x8c19('0x99')](_0x2b9a62);}})['then'](function(_0x59eb1e){if(_0x59eb1e){_0x275999=_0x59eb1e[_0x8c19('0x3c')];if(!_0x477bcf[_0x8c19('0x35')][_0x8c19('0x3d')]('nolimit')){_0x2b9a62['limit']=qs[_0x8c19('0x22')](_0x477bcf[_0x8c19('0x35')][_0x8c19('0x22')]);_0x2b9a62['offset']=qs[_0x8c19('0x21')](_0x477bcf['query'][_0x8c19('0x21')]);}return _0x3b9ecd[_0x8c19('0x99')](_0x2b9a62);}})[_0x8c19('0x2f')](function(_0x28cb3b){return _0x28cb3b?{'count':_0x275999,'rows':_0x28cb3b}:null;})['then'](respondWithResult(_0x38dd4a,null))['catch'](handleError(_0x38dd4a,null));};exports['getLists']=function(_0x47687b,_0x114800,_0xde0fcd){var _0x2b2d95={};var _0x309d14={};var _0x43ab46;var _0x3160d6;return db['VoiceQueue'][_0x8c19('0x60')]({'where':{'id':_0x47687b['params']['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x114800,null))[_0x8c19('0x2f')](function(_0x163b6f){if(_0x163b6f){_0x43ab46=_0x163b6f;_0x309d14[_0x8c19('0x39')]=_[_0x8c19('0x36')](db['CmList'][_0x8c19('0x32')]);_0x309d14['query']=_['keys'](_0x47687b[_0x8c19('0x35')]);_0x309d14[_0x8c19('0x37')]=_['intersection'](_0x309d14['model'],_0x309d14[_0x8c19('0x35')]);_0x2b2d95[_0x8c19('0x3b')]=_[_0x8c19('0x38')](_0x309d14[_0x8c19('0x39')],qs[_0x8c19('0x3a')](_0x47687b['query']['fields']));_0x2b2d95[_0x8c19('0x3b')]=_0x2b2d95[_0x8c19('0x3b')][_0x8c19('0x3c')]?_0x2b2d95[_0x8c19('0x3b')]:_0x309d14[_0x8c19('0x39')];_0x2b2d95['order']=qs[_0x8c19('0x40')](_0x47687b[_0x8c19('0x35')][_0x8c19('0x40')]);_0x2b2d95['where']=qs[_0x8c19('0x37')](_[_0x8c19('0x42')](_0x47687b['query'],_0x309d14[_0x8c19('0x37')]));if(_0x47687b[_0x8c19('0x35')][_0x8c19('0x29')]){_0x2b2d95[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x2b2d95[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x2b2d95['attributes'],function(_0xb33b83){var _0xb7f43b={};_0xb7f43b[_0xb33b83]={'$like':'%'+_0x47687b[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0xb7f43b;})});}_0x2b2d95=_[_0x8c19('0x43')]({},_0x2b2d95,_0x47687b[_0x8c19('0x4b')]);return _0x43ab46['getLists'](_0x2b2d95);}})['then'](function(_0x3ded5d){if(_0x3ded5d){_0x3160d6=_0x3ded5d[_0x8c19('0x3c')];if(!_0x47687b['query'][_0x8c19('0x3d')](_0x8c19('0x3e'))){_0x2b2d95[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x47687b['query'][_0x8c19('0x22')]);_0x2b2d95['offset']=qs['offset'](_0x47687b['query'][_0x8c19('0x21')]);}return _0x43ab46[_0x8c19('0x9a')](_0x2b2d95);}})['then'](function(_0x1c59a1){if(_0x1c59a1){return _0x1c59a1?{'count':_0x3160d6,'rows':_0x1c59a1}:null;}})[_0x8c19('0x2f')](respondWithResult(_0x114800,null))[_0x8c19('0x4c')](handleError(_0x114800,null));};exports[_0x8c19('0x9b')]=function(_0x33484f,_0x72feed,_0x3a61ae){var _0x5548ed,_0x6cda87;return db[_0x8c19('0x31')][_0x8c19('0x2d')]({'where':{'id':_0x33484f['params']['id']}})['then'](handleEntityNotFound(_0x72feed,null))[_0x8c19('0x2f')](function(_0x173c18){if(_0x173c18){_0x6cda87=_0x173c18;return _0x173c18['addLists'](_0x33484f[_0x8c19('0x4e')][_0x8c19('0x7d')],_['omit'](_0x33484f[_0x8c19('0x4e')],[_0x8c19('0x7d'),'id'])||{});}return null;})['spread'](function(_0x5b2602){var _0xddf58b;_0x5548ed=_0x5b2602||[];var _0x4173b6=[];if(_0x5b2602){for(var _0x42499e=0x0;_0x42499e<_0x5b2602[_0x8c19('0x3c')];_0x42499e+=0x1){var _0x4a87d6=_0x5b2602[_0x42499e][_0x8c19('0x4f')]({'plain':!![]});_0x6cda87['dialCheckDuplicateType']=_0x33484f[_0x8c19('0x4e')][_0x8c19('0x9c')]?_0x33484f[_0x8c19('0x4e')][_0x8c19('0x9c')]:_0x6cda87['dialCheckDuplicateType'];switch(_0x6cda87[_0x8c19('0x9c')]){case'always':_0xddf58b=squel[_0x8c19('0x9d')]()[_0x8c19('0x9e')](_0x8c19('0x9f'))[_0x8c19('0xa0')]([_0x8c19('0xa1'),_0x8c19('0xa2'),_0x8c19('0xa3'),'ListId','VoiceQueueId',_0x8c19('0x5a'),_0x8c19('0x5b')],squel[_0x8c19('0xa4')]()[_0x8c19('0x7f')](_0x8c19('0xa1'),'phone')[_0x8c19('0x7f')](_0x8c19('0xa5'),_0x8c19('0xa2'))[_0x8c19('0x7f')]('id',_0x8c19('0xa3'))[_0x8c19('0x7f')](_0x4a87d6[_0x8c19('0xa6')][_0x8c19('0x8a')](),_0x8c19('0xa7'))[_0x8c19('0x7f')](_0x33484f['params']['id'][_0x8c19('0x8a')](),_0x8c19('0x62'))[_0x8c19('0x7f')](_0x8c19('0xa5'),_0x8c19('0x5a'))[_0x8c19('0x7f')](_0x8c19('0xa5'),'updatedAt')[_0x8c19('0x81')](_0x8c19('0xa8'))[_0x8c19('0x41')]('deletedAt\x20IS\x20NULL')[_0x8c19('0x41')](_0x8c19('0xa9'),_0x4a87d6[_0x8c19('0xa6')]['toString']())['where'](_0x8c19('0xaa'))[_0x8c19('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8c19('0xa4')]()[_0x8c19('0x7f')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x8c19('0xab'))[_0x8c19('0x41')]('VoiceQueueId\x20=\x20?',_0x33484f[_0x8c19('0x49')]['id'][_0x8c19('0x8a')]()))[_0x8c19('0x41')](_0x8c19('0xac'),squel[_0x8c19('0xa4')]()['field'](_0x8c19('0xad'))[_0x8c19('0x81')](_0x8c19('0x9f'))[_0x8c19('0x41')](_0x8c19('0x86'),_0x33484f[_0x8c19('0x49')]['id'][_0x8c19('0x8a')]())))['toString']();break;case _0x8c19('0xae'):_0xddf58b=squel['insert']()[_0x8c19('0x9e')](_0x8c19('0x9f'))['fromQuery'](['phone',_0x8c19('0xa2'),'ContactId',_0x8c19('0xa7'),_0x8c19('0x62'),_0x8c19('0x5a'),'updatedAt'],squel[_0x8c19('0xa4')]()['field']('phone',_0x8c19('0xa1'))[_0x8c19('0x7f')]('NOW()',_0x8c19('0xa2'))[_0x8c19('0x7f')]('id',_0x8c19('0xa3'))[_0x8c19('0x7f')](_0x4a87d6['CmListId'][_0x8c19('0x8a')](),_0x8c19('0xa7'))[_0x8c19('0x7f')](_0x33484f[_0x8c19('0x49')]['id'][_0x8c19('0x8a')](),_0x8c19('0x62'))['field'](_0x8c19('0xa5'),'createdAt')[_0x8c19('0x7f')](_0x8c19('0xa5'),_0x8c19('0x5b'))['from']('cm_contacts')['where'](_0x8c19('0xaf'))[_0x8c19('0x41')]('ListId\x20=\x20?',_0x4a87d6[_0x8c19('0xa6')]['toString']())[_0x8c19('0x41')](_0x8c19('0xaa'))[_0x8c19('0x41')](_0x8c19('0xac'),squel[_0x8c19('0xa4')]()[_0x8c19('0x7f')](_0x8c19('0xad'))['from'](_0x8c19('0x9f'))['where'](_0x8c19('0x86'),_0x33484f[_0x8c19('0x49')]['id'][_0x8c19('0x8a')]())))[_0x8c19('0x8a')]();break;default:_0xddf58b=squel[_0x8c19('0x9d')]()[_0x8c19('0x9e')](_0x8c19('0x9f'))[_0x8c19('0xa0')]([_0x8c19('0xa1'),_0x8c19('0xa2'),_0x8c19('0xa3'),_0x8c19('0xa7'),_0x8c19('0x62'),_0x8c19('0x5a'),_0x8c19('0x5b')],squel[_0x8c19('0xa4')]()['field']('phone',_0x8c19('0xa1'))[_0x8c19('0x7f')](_0x8c19('0xa5'),_0x8c19('0xa2'))[_0x8c19('0x7f')]('id',_0x8c19('0xa3'))[_0x8c19('0x7f')](_0x4a87d6[_0x8c19('0xa6')][_0x8c19('0x8a')](),'ListId')['field'](_0x33484f[_0x8c19('0x49')]['id'][_0x8c19('0x8a')](),'VoiceQueueId')[_0x8c19('0x7f')](_0x8c19('0xa5'),'createdAt')[_0x8c19('0x7f')]('NOW()',_0x8c19('0x5b'))[_0x8c19('0x81')]('cm_contacts')[_0x8c19('0x41')](_0x8c19('0xaf'))[_0x8c19('0x41')](_0x8c19('0xa9'),_0x4a87d6[_0x8c19('0xa6')]['toString']())[_0x8c19('0x41')](_0x8c19('0xaa')))[_0x8c19('0x8a')]();}_0x4173b6['push'](db['sequelize'][_0x8c19('0x35')](_0xddf58b));}return BPromise[_0x8c19('0x96')](_0x4173b6);}})[_0x8c19('0x2f')](function(){return _0x5548ed;})[_0x8c19('0x2f')](respondWithResult(_0x72feed,null))['catch'](handleError(_0x72feed,null));};exports[_0x8c19('0xb0')]=function(_0x2038d5,_0x55c349,_0x321665){return db[_0x8c19('0x31')][_0x8c19('0x2d')]({'where':{'id':_0x2038d5[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x55c349,null))[_0x8c19('0x2f')](function(_0x101db8){if(_0x101db8){return _0x101db8[_0x8c19('0xb0')](_0x2038d5[_0x8c19('0x35')]['ids']);}})[_0x8c19('0x2f')](function(_0x214870){if(_0x214870){return db['CmHopper'][_0x8c19('0x5f')]({'where':{'ListId':_0x2038d5[_0x8c19('0x35')][_0x8c19('0x7d')],'VoiceQueueId':_0x2038d5[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](function(){return _0x214870;});}})[_0x8c19('0x2f')](respondWithStatusCode(_0x55c349,null))[_0x8c19('0x4c')](handleError(_0x55c349,null));};exports['getBlackLists']=function(_0x4b4818,_0x1d0cdc,_0x46b30c){var _0x4ba380={};var _0x434507={};var _0x4efc23;var _0x173b25;return db['VoiceQueue'][_0x8c19('0x60')]({'where':{'id':_0x4b4818[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x1d0cdc,null))[_0x8c19('0x2f')](function(_0x2167e2){if(_0x2167e2){_0x4efc23=_0x2167e2;_0x434507[_0x8c19('0x39')]=_[_0x8c19('0x36')](db[_0x8c19('0xb1')]['rawAttributes']);_0x434507[_0x8c19('0x35')]=_['keys'](_0x4b4818[_0x8c19('0x35')]);_0x434507['filters']=_[_0x8c19('0x38')](_0x434507[_0x8c19('0x39')],_0x434507[_0x8c19('0x35')]);_0x4ba380['attributes']=_[_0x8c19('0x38')](_0x434507[_0x8c19('0x39')],qs['fields'](_0x4b4818[_0x8c19('0x35')]['fields']));_0x4ba380[_0x8c19('0x3b')]=_0x4ba380['attributes'][_0x8c19('0x3c')]?_0x4ba380['attributes']:_0x434507['model'];_0x4ba380[_0x8c19('0x3f')]=qs[_0x8c19('0x40')](_0x4b4818[_0x8c19('0x35')][_0x8c19('0x40')]);_0x4ba380[_0x8c19('0x41')]=qs['filters'](_[_0x8c19('0x42')](_0x4b4818[_0x8c19('0x35')],_0x434507[_0x8c19('0x37')]));if(_0x4b4818[_0x8c19('0x35')][_0x8c19('0x29')]){_0x4ba380[_0x8c19('0x41')]=_[_0x8c19('0x43')](_0x4ba380[_0x8c19('0x41')],{'$or':_[_0x8c19('0x2a')](_0x4ba380['attributes'],function(_0x480434){var _0x3061e6={};_0x3061e6[_0x480434]={'$like':'%'+_0x4b4818[_0x8c19('0x35')][_0x8c19('0x29')]+'%'};return _0x3061e6;})});}_0x4ba380=_[_0x8c19('0x43')]({},_0x4ba380,_0x4b4818[_0x8c19('0x4b')]);return _0x4efc23['getBlackLists'](_0x4ba380);}})[_0x8c19('0x2f')](function(_0x32f8d1){if(_0x32f8d1){_0x173b25=_0x32f8d1[_0x8c19('0x3c')];if(!_0x4b4818[_0x8c19('0x35')][_0x8c19('0x3d')]('nolimit')){_0x4ba380[_0x8c19('0x22')]=qs[_0x8c19('0x22')](_0x4b4818[_0x8c19('0x35')][_0x8c19('0x22')]);_0x4ba380[_0x8c19('0x21')]=qs['offset'](_0x4b4818['query'][_0x8c19('0x21')]);}return _0x4efc23[_0x8c19('0xb2')](_0x4ba380);}})[_0x8c19('0x2f')](function(_0x286afc){if(_0x286afc){return _0x286afc?{'count':_0x173b25,'rows':_0x286afc}:null;}})[_0x8c19('0x2f')](respondWithResult(_0x1d0cdc,null))[_0x8c19('0x4c')](handleError(_0x1d0cdc,null));};exports[_0x8c19('0xb3')]=function(_0x360cee,_0x29ec65,_0x3076cb){var _0x145534,_0x3babfb;return db[_0x8c19('0x31')]['find']({'where':{'id':_0x360cee[_0x8c19('0x49')]['id']}})['then'](handleEntityNotFound(_0x29ec65,null))[_0x8c19('0x2f')](function(_0x514c53){if(_0x514c53){_0x3babfb=_0x514c53;return _0x514c53['addBlackLists'](_0x360cee[_0x8c19('0x4e')][_0x8c19('0x7d')],_[_0x8c19('0x5c')](_0x360cee[_0x8c19('0x4e')],[_0x8c19('0x7d'),'id'])||{});}return null;})['spread'](function(_0x5e24b8){var _0x55c4a4;_0x145534=_0x5e24b8||[];var _0x260a22=[];if(_0x5e24b8){for(var _0x5542ee=0x0;_0x5542ee<_0x5e24b8[_0x8c19('0x3c')];_0x5542ee+=0x1){var _0x578d93=_0x5e24b8[_0x5542ee][_0x8c19('0x4f')]({'plain':!![]});_0x55c4a4=squel['insert']()[_0x8c19('0x9e')](_0x8c19('0xb4'))['fromQuery'](['phone',_0x8c19('0xa3'),'ListId',_0x8c19('0x62'),_0x8c19('0x5a'),_0x8c19('0x5b')],squel[_0x8c19('0xa4')]()[_0x8c19('0x7f')](_0x8c19('0xa1'),'phone')['field']('id',_0x8c19('0xa3'))[_0x8c19('0x7f')](_0x578d93[_0x8c19('0xa6')][_0x8c19('0x8a')](),'ListId')['field'](_0x360cee['params']['id'][_0x8c19('0x8a')](),'VoiceQueueId')[_0x8c19('0x7f')]('NOW()','createdAt')[_0x8c19('0x7f')](_0x8c19('0xa5'),_0x8c19('0x5b'))[_0x8c19('0x81')](_0x8c19('0xa8'))[_0x8c19('0x41')](_0x8c19('0xaf'))['where'](_0x8c19('0xa9'),_0x578d93[_0x8c19('0xa6')][_0x8c19('0x8a')]())[_0x8c19('0x41')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x260a22[_0x8c19('0x88')](db[_0x8c19('0x89')][_0x8c19('0x35')](_0x55c4a4));}return BPromise[_0x8c19('0x96')](_0x260a22);}})['then'](function(){return _0x145534;})['then'](respondWithResult(_0x29ec65,null))[_0x8c19('0x4c')](handleError(_0x29ec65,null));};exports[_0x8c19('0xb5')]=function(_0x19ccfc,_0x98aac,_0xf1d8e8){return db['VoiceQueue'][_0x8c19('0x2d')]({'where':{'id':_0x19ccfc[_0x8c19('0x49')]['id']}})[_0x8c19('0x2f')](handleEntityNotFound(_0x98aac,null))[_0x8c19('0x2f')](function(_0x402dd1){if(_0x402dd1){return _0x402dd1['removeBlackLists'](_0x19ccfc['query']['ids']);}})[_0x8c19('0x2f')](function(_0x5ea54d){if(_0x5ea54d){return db[_0x8c19('0x67')][_0x8c19('0x5f')]({'where':{'ListId':_0x19ccfc[_0x8c19('0x35')][_0x8c19('0x7d')],'VoiceQueueId':_0x19ccfc[_0x8c19('0x49')]['id']}})['then'](function(){return _0x5ea54d;});}})[_0x8c19('0x2f')](respondWithStatusCode(_0x98aac,null))[_0x8c19('0x4c')](handleError(_0x98aac,null));}; \ No newline at end of file +var _0xdf05=['userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','union','compact','transaction','isEmpty','userVoiceQueue:remove','addAgents','upsert','format','all','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','CmListId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','phone\x20IS\x20NOT\x20NULL','getBlackLists','addBlackLists','removeBlackLists','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','limit','set','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','role','getHoppers','findOne','hasOwnProperty','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit'];(function(_0x5a8f33,_0x11ab70){var _0x349091=function(_0x5ad118){while(--_0x5ad118){_0x5a8f33['push'](_0x5a8f33['shift']());}};_0x349091(++_0x11ab70);}(_0xdf05,0xee));var _0x5df0=function(_0x50af9c,_0xf03b1e){_0x50af9c=_0x50af9c-0x0;var _0x5b5e5a=_0xdf05[_0x50af9c];return _0x5b5e5a;};'use strict';var pdf=require(_0x5df0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5df0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5df0('0x2'));var rp=require('request-promise');var moment=require(_0x5df0('0x3'));var BPromise=require(_0x5df0('0x4'));var Mustache=require(_0x5df0('0x5'));var util=require('util');var path=require(_0x5df0('0x6'));var sox=require(_0x5df0('0x7'));var csv=require(_0x5df0('0x8'));var ejs=require(_0x5df0('0x9'));var fs=require('fs');var _=require(_0x5df0('0xa'));var squel=require('squel');var crypto=require(_0x5df0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5df0('0xc'));var toCsv=require(_0x5df0('0x8'));var querystring=require('querystring');var Papa=require(_0x5df0('0xd'));var Redis=require(_0x5df0('0xe'));var authService=require(_0x5df0('0xf'));var qs=require(_0x5df0('0x10'));var as=require(_0x5df0('0x11'));var hardwareService=require(_0x5df0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5df0('0x13'));var config=require(_0x5df0('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5df0('0x15')](config[_0x5df0('0x16')],{'host':_0x5df0('0x17'),'port':0x18eb});var socket=require(_0x5df0('0x18'))(new Redis(config[_0x5df0('0x16')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x14f167,_0x32ac6d){_0x32ac6d=_0x32ac6d||0xcc;return function(_0x26d531){if(_0x26d531){return _0x14f167[_0x5df0('0x19')](_0x32ac6d);}return _0x14f167[_0x5df0('0x1a')](_0x32ac6d)['end']();};}function respondWithResult(_0x552e02,_0xac2c5c){_0xac2c5c=_0xac2c5c||0xc8;return function(_0x35d3b5){if(_0x35d3b5){return _0x552e02['status'](_0xac2c5c)[_0x5df0('0x1b')](_0x35d3b5);}};}function respondWithFilteredResult(_0x566b0a,_0x563d46){return function(_0x313070){if(_0x313070){var _0xe851f4=_0x313070['count'],_0x32e6c0=_0x563d46['offset'],_0x5d2ebc=_0x563d46['offset']+_0x563d46[_0x5df0('0x1c')],_0x57ed6e;if(_0x5d2ebc>=_0xe851f4){_0x5d2ebc=_0xe851f4;_0x57ed6e=0xc8;}else{_0x57ed6e=0xce;}_0x566b0a['status'](_0x57ed6e);return _0x566b0a[_0x5df0('0x1d')]('Content-Range',_0x32e6c0+'-'+_0x5d2ebc+'/'+_0xe851f4)[_0x5df0('0x1b')](_0x313070);}return null;};}function patchUpdates(_0x3fcbcb){return function(_0x2da8fd){try{jsonpatch[_0x5df0('0x1e')](_0x2da8fd,_0x3fcbcb,!![]);}catch(_0x419167){return BPromise[_0x5df0('0x1f')](_0x419167);}return _0x2da8fd[_0x5df0('0x20')]();};}function saveUpdates(_0x3522bb,_0x375a32){return function(_0x5dcc53){if(_0x5dcc53){return _0x5dcc53[_0x5df0('0x21')](_0x3522bb)[_0x5df0('0x22')](function(_0x129152){return _0x129152;});}return null;};}function removeEntity(_0xfaedf8,_0xd2bc28){return function(_0x4e4a3d){if(_0x4e4a3d){return _0x4e4a3d[_0x5df0('0x23')]()[_0x5df0('0x22')](function(){var _0x535f0=_0x4e4a3d['get']({'plain':!![]});var _0x2f3af5=[{'name':_0x5df0('0x24'),'value':_0x5df0('0x25'),'ignore':![]},{'name':_0x5df0('0x26'),'value':_0x5df0('0x27'),'ignore':![]}];var _0x857a4f=_(_0x2f3af5)[_0x5df0('0x28')]('ignore')['map'](_0x5df0('0x29'))['value']();if(_[_0x5df0('0x2a')](_0x857a4f,_0x535f0[_0x5df0('0x2b')])){return;}var _0x42f9e8=_[_0x5df0('0x2c')](_0x2f3af5,[_0x5df0('0x29'),_0x535f0[_0x5df0('0x2b')]])[_0x5df0('0x2d')];return db[_0x5df0('0x2e')][_0x5df0('0x23')]({'where':{'type':_0x42f9e8,'resourceId':_0x535f0['id']}})['then'](function(){return _0x4e4a3d;});})[_0x5df0('0x22')](function(){_0xfaedf8[_0x5df0('0x1a')](0xcc)[_0x5df0('0x2f')]();});}};}function handleEntityNotFound(_0x4f36b7,_0x4fff56){return function(_0x2af3d3){if(!_0x2af3d3){_0x4f36b7[_0x5df0('0x19')](0x194);}return _0x2af3d3;};}function handleError(_0x521f53,_0x34a00a){_0x34a00a=_0x34a00a||0x1f4;return function(_0x1c0de0){logger[_0x5df0('0x30')](_0x1c0de0[_0x5df0('0x31')]);if(_0x1c0de0[_0x5df0('0x2d')]){delete _0x1c0de0['name'];}_0x521f53[_0x5df0('0x1a')](_0x34a00a)[_0x5df0('0x32')](_0x1c0de0);};}exports[_0x5df0('0x33')]=function(_0x5b3665,_0x3b6b0a){var _0x8ce68a={},_0x4d1586={},_0x10811f={'count':0x0,'rows':[]};var _0x54d6c1=_[_0x5df0('0x34')](db[_0x5df0('0x35')][_0x5df0('0x36')],function(_0x1d64e6){return{'name':_0x1d64e6[_0x5df0('0x37')],'type':_0x1d64e6[_0x5df0('0x2b')]['key']};});_0x4d1586[_0x5df0('0x38')]=_[_0x5df0('0x34')](_0x54d6c1,_0x5df0('0x2d'));_0x4d1586[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x5b3665[_0x5df0('0x39')]);_0x4d1586['filters']=_[_0x5df0('0x3b')](_0x4d1586[_0x5df0('0x38')],_0x4d1586[_0x5df0('0x39')]);_0x8ce68a[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x4d1586['model'],qs[_0x5df0('0x3d')](_0x5b3665['query']['fields']));_0x8ce68a['attributes']=_0x8ce68a['attributes'][_0x5df0('0x3e')]?_0x8ce68a[_0x5df0('0x3c')]:_0x4d1586[_0x5df0('0x38')];if(!_0x5b3665['query']['hasOwnProperty'](_0x5df0('0x3f'))){_0x8ce68a[_0x5df0('0x1c')]=qs[_0x5df0('0x1c')](_0x5b3665[_0x5df0('0x39')][_0x5df0('0x1c')]);_0x8ce68a[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x5b3665[_0x5df0('0x39')]['offset']);}_0x8ce68a[_0x5df0('0x41')]=qs['sort'](_0x5b3665[_0x5df0('0x39')][_0x5df0('0x42')]);_0x8ce68a[_0x5df0('0x43')]=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x5b3665[_0x5df0('0x39')],_0x4d1586[_0x5df0('0x44')]),_0x54d6c1);if(_0x5b3665[_0x5df0('0x39')][_0x5df0('0x28')]){_0x8ce68a[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x8ce68a[_0x5df0('0x43')],{'$or':_[_0x5df0('0x34')](_0x54d6c1,function(_0x393e2b){if(_0x393e2b[_0x5df0('0x2b')]!==_0x5df0('0x47')){var _0x239964={};_0x239964[_0x393e2b[_0x5df0('0x2d')]]={'$like':'%'+_0x5b3665[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x239964;}})});}_0x8ce68a=_['merge']({},_0x8ce68a,_0x5b3665[_0x5df0('0x48')]);var _0x2aab8d={'where':_0x8ce68a[_0x5df0('0x43')]};return db[_0x5df0('0x35')][_0x5df0('0x49')](_0x2aab8d)[_0x5df0('0x22')](function(_0x48037c){_0x10811f['count']=_0x48037c;if(_0x5b3665[_0x5df0('0x39')][_0x5df0('0x4a')]){_0x8ce68a[_0x5df0('0x4b')]=[{'all':!![]}];}return db['VoiceQueue'][_0x5df0('0x4c')](_0x8ce68a);})[_0x5df0('0x22')](function(_0x55b96e){_0x10811f[_0x5df0('0x4d')]=_0x55b96e;return _0x10811f;})[_0x5df0('0x22')](respondWithFilteredResult(_0x3b6b0a,_0x8ce68a))[_0x5df0('0x4e')](handleError(_0x3b6b0a,null));};exports[_0x5df0('0x4f')]=function(_0xcf8037,_0x1425d1){var _0x1f0f0d={'raw':![],'where':{'id':_0xcf8037[_0x5df0('0x50')]['id']}},_0xccbec1={};_0xccbec1[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db[_0x5df0('0x35')]['rawAttributes']);_0xccbec1['query']=_[_0x5df0('0x3a')](_0xcf8037[_0x5df0('0x39')]);_0xccbec1[_0x5df0('0x44')]=_[_0x5df0('0x3b')](_0xccbec1[_0x5df0('0x38')],_0xccbec1[_0x5df0('0x39')]);_0x1f0f0d['attributes']=_['intersection'](_0xccbec1['model'],qs[_0x5df0('0x3d')](_0xcf8037[_0x5df0('0x39')][_0x5df0('0x3d')]));_0x1f0f0d['attributes']=_0x1f0f0d['attributes'][_0x5df0('0x3e')]?_0x1f0f0d[_0x5df0('0x3c')]:_0xccbec1[_0x5df0('0x38')];if(_0xcf8037['query'][_0x5df0('0x4a')]){_0x1f0f0d['include']=[{'all':!![]}];}_0x1f0f0d=_[_0x5df0('0x46')]({},_0x1f0f0d,_0xcf8037['options']);return db[_0x5df0('0x35')][_0x5df0('0x2c')](_0x1f0f0d)[_0x5df0('0x22')](handleEntityNotFound(_0x1425d1,null))[_0x5df0('0x22')](respondWithResult(_0x1425d1,null))[_0x5df0('0x4e')](handleError(_0x1425d1,null));};exports[_0x5df0('0x51')]=function(_0x27a9ad,_0x413f52){return db[_0x5df0('0x35')][_0x5df0('0x51')](_0x27a9ad[_0x5df0('0x52')],{})[_0x5df0('0x22')](function(_0x272a38){var _0x33f9c1=_0x27a9ad[_0x5df0('0x53')]['get']({'plain':!![]});if(!_0x33f9c1)throw new Error(_0x5df0('0x54'));if(_0x33f9c1['role']==='user'){var _0x444acd=_0x272a38[_0x5df0('0x55')]({'plain':!![]});var _0x24feeb=[{'name':_0x5df0('0x24'),'value':_0x5df0('0x25')},{'name':_0x5df0('0x26'),'value':'outbound'}];var _0x25a2ac=_[_0x5df0('0x2c')](_0x24feeb,[_0x5df0('0x29'),_0x444acd[_0x5df0('0x2b')]])[_0x5df0('0x2d')];return db[_0x5df0('0x56')][_0x5df0('0x2c')]({'where':{'name':_0x25a2ac,'userProfileId':_0x33f9c1[_0x5df0('0x57')]},'raw':!![]})['then'](function(_0x56b0fa){if(_0x56b0fa&&_0x56b0fa[_0x5df0('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x444acd['name'],'resourceId':_0x444acd['id'],'type':_0x56b0fa['name'],'sectionId':_0x56b0fa['id']},{})[_0x5df0('0x22')](function(){return _0x272a38;});}else{return _0x272a38;}})[_0x5df0('0x4e')](function(_0x127826){logger[_0x5df0('0x30')](_0x5df0('0x59'),_0x127826);throw _0x127826;});}return _0x272a38;})[_0x5df0('0x22')](respondWithResult(_0x413f52,0xc9))[_0x5df0('0x4e')](handleError(_0x413f52,null));};exports['clone']=function(_0xbae050,_0xc3a613){var _0x32eb6a={'where':{'id':_0xbae050[_0x5df0('0x50')]['id']}},_0x432bf3={};_0x432bf3['model']=_[_0x5df0('0x3a')](db[_0x5df0('0x35')][_0x5df0('0x36')]);_0x32eb6a['attributes']=_[_0x5df0('0x3b')](_0x432bf3[_0x5df0('0x38')],qs[_0x5df0('0x3d')](_0xbae050[_0x5df0('0x39')]['fields']));_0x32eb6a['attributes']=_0x32eb6a[_0x5df0('0x3c')][_0x5df0('0x3e')]?_0x32eb6a[_0x5df0('0x3c')]:_0x432bf3[_0x5df0('0x38')];if(_0xbae050[_0x5df0('0x39')]['includeAll']){_0x32eb6a[_0x5df0('0x4b')]=[{'all':!![]}];}_0x32eb6a=_[_0x5df0('0x46')]({},_0x32eb6a,_0xbae050['options']);return db[_0x5df0('0x35')][_0x5df0('0x2c')](_0x32eb6a)['then'](handleEntityNotFound(_0xc3a613,null))[_0x5df0('0x22')](function(_0x447304){if(_0x447304){var _0x215544=_0x447304[_0x5df0('0x55')]({'plain':!![]});_0x215544=qs['omit'](_0x215544,['id',_0x5df0('0x5a'),_0x5df0('0x5b')]);_0xbae050[_0x5df0('0x52')]=_[_0x5df0('0x5c')](_0xbae050[_0x5df0('0x52')],['id','createdAt',_0x5df0('0x5b')]);return db[_0x5df0('0x35')]['create'](_['merge'](_0x215544,_0xbae050['body']),{'include':_0xbae050[_0x5df0('0x39')][_0x5df0('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2c18dc){var _0xac2634=_0xbae050[_0x5df0('0x53')]['get']({'plain':!![]});if(!_0xac2634)throw new Error(_0x5df0('0x54'));if(_0xac2634[_0x5df0('0x5d')]==='user'){var _0x44af14=_0x2c18dc['get']({'plain':!![]});var _0x335428=[{'name':_0x5df0('0x24'),'value':_0x5df0('0x25')},{'name':_0x5df0('0x26'),'value':_0x5df0('0x27')}];var _0x373f78=_['find'](_0x335428,[_0x5df0('0x29'),_0x44af14[_0x5df0('0x2b')]])[_0x5df0('0x2d')];return db[_0x5df0('0x56')][_0x5df0('0x2c')]({'where':{'name':_0x373f78,'userProfileId':_0xac2634[_0x5df0('0x57')]},'raw':!![]})['then'](function(_0x51d7df){if(_0x51d7df&&_0x51d7df[_0x5df0('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x44af14[_0x5df0('0x2d')],'resourceId':_0x44af14['id'],'type':_0x51d7df[_0x5df0('0x2d')],'sectionId':_0x51d7df['id']},{})[_0x5df0('0x22')](function(){return _0x2c18dc;});}else{return _0x2c18dc;}})['catch'](function(_0x1fe174){logger[_0x5df0('0x30')](_0x5df0('0x59'),_0x1fe174);throw _0x1fe174;});}return _0x2c18dc;});}})[_0x5df0('0x22')](respondWithResult(_0xc3a613,0xc9))[_0x5df0('0x4e')](handleError(_0xc3a613,null));};exports[_0x5df0('0x21')]=function(_0x28a843,_0x501419){if(_0x28a843[_0x5df0('0x52')]['id']){delete _0x28a843[_0x5df0('0x52')]['id'];}return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x28a843[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x501419,null))['then'](saveUpdates(_0x28a843['body'],null))[_0x5df0('0x22')](respondWithResult(_0x501419,null))[_0x5df0('0x4e')](handleError(_0x501419,null));};exports[_0x5df0('0x23')]=function(_0x27772b,_0x1d62a9){return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x27772b[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x1d62a9,null))[_0x5df0('0x22')](removeEntity(_0x1d62a9,null))[_0x5df0('0x4e')](handleError(_0x1d62a9,null));};exports[_0x5df0('0x5e')]=function(_0x347679,_0x999471,_0xde91c5){var _0x3aa0ed={'raw':![],'where':{}};var _0x1536ae={};var _0x520dc9={'count':0x0,'rows':[]};return db[_0x5df0('0x35')][_0x5df0('0x5f')]({'where':{'id':_0x347679['params']['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x999471,null))[_0x5df0('0x22')](function(_0xd9a683){if(_0xd9a683){_0x1536ae[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db['CmHopper'][_0x5df0('0x36')]);_0x1536ae[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x347679[_0x5df0('0x39')]);_0x1536ae[_0x5df0('0x44')]=_['intersection'](_0x1536ae[_0x5df0('0x38')],_0x1536ae['query']);_0x3aa0ed[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x1536ae[_0x5df0('0x38')],qs[_0x5df0('0x3d')](_0x347679[_0x5df0('0x39')]['fields']));_0x3aa0ed['attributes']=_0x3aa0ed['attributes']['length']?_0x3aa0ed[_0x5df0('0x3c')]:_0x1536ae[_0x5df0('0x38')];if(!_0x347679[_0x5df0('0x39')][_0x5df0('0x60')]('nolimit')){_0x3aa0ed[_0x5df0('0x1c')]=qs[_0x5df0('0x1c')](_0x347679['query'][_0x5df0('0x1c')]);_0x3aa0ed[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x347679['query']['offset']);}_0x3aa0ed['order']=qs[_0x5df0('0x42')](_0x347679['query'][_0x5df0('0x42')]);_0x3aa0ed[_0x5df0('0x43')]=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x347679[_0x5df0('0x39')],_0x1536ae[_0x5df0('0x44')]));_0x3aa0ed['where'][_0x5df0('0x61')]=_0xd9a683['id'];if(_0x347679[_0x5df0('0x39')][_0x5df0('0x28')]){_0x3aa0ed[_0x5df0('0x43')]=_['merge'](_0x3aa0ed[_0x5df0('0x43')],{'$or':_[_0x5df0('0x34')](_0x3aa0ed[_0x5df0('0x3c')],function(_0x21d90){var _0x1dca92={};_0x1dca92[_0x21d90]={'$like':'%'+_0x347679['query'][_0x5df0('0x28')]+'%'};return _0x1dca92;})});}_0x3aa0ed=_[_0x5df0('0x46')]({},_0x3aa0ed,_0x347679[_0x5df0('0x48')]);return db[_0x5df0('0x62')][_0x5df0('0x49')]({'where':_0x3aa0ed[_0x5df0('0x43')]})['then'](function(_0x56b553){_0x520dc9['count']=_0x56b553;if(_0x347679[_0x5df0('0x39')][_0x5df0('0x4a')]){_0x3aa0ed[_0x5df0('0x4b')]=[{'all':!![]}];}return db[_0x5df0('0x62')]['findAll'](_0x3aa0ed);})['then'](function(_0x471ed3){_0x520dc9[_0x5df0('0x4d')]=_0x471ed3;return _0x520dc9;});}})['then'](respondWithFilteredResult(_0x999471,_0x3aa0ed))[_0x5df0('0x4e')](handleError(_0x999471,null));};exports[_0x5df0('0x63')]=function(_0x6b094c,_0x4aa7a3,_0x3006cf){var _0x22ec8d={'raw':!![],'where':{}};var _0x43cafc={};var _0xd629f3={'count':0x0,'rows':[]};return db[_0x5df0('0x35')]['findOne']({'where':{'id':_0x6b094c[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x4aa7a3,null))[_0x5df0('0x22')](function(_0xa12094){if(_0xa12094){_0x43cafc[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db[_0x5df0('0x64')]['rawAttributes']);_0x43cafc[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x6b094c[_0x5df0('0x39')]);_0x43cafc['filters']=_['intersection'](_0x43cafc[_0x5df0('0x38')],_0x43cafc[_0x5df0('0x39')]);_0x22ec8d[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x43cafc['model'],qs[_0x5df0('0x3d')](_0x6b094c[_0x5df0('0x39')]['fields']));_0x22ec8d['attributes']=_0x22ec8d['attributes'][_0x5df0('0x3e')]?_0x22ec8d['attributes']:_0x43cafc[_0x5df0('0x38')];if(!_0x6b094c['query'][_0x5df0('0x60')]('nolimit')){_0x22ec8d[_0x5df0('0x1c')]=qs['limit'](_0x6b094c['query'][_0x5df0('0x1c')]);_0x22ec8d['offset']=qs[_0x5df0('0x40')](_0x6b094c[_0x5df0('0x39')][_0x5df0('0x40')]);}_0x22ec8d['order']=qs[_0x5df0('0x42')](_0x6b094c[_0x5df0('0x39')][_0x5df0('0x42')]);_0x22ec8d['where']=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x6b094c['query'],_0x43cafc[_0x5df0('0x44')]));_0x22ec8d['where'][_0x5df0('0x61')]=_0xa12094['id'];if(_0x6b094c['query'][_0x5df0('0x28')]){_0x22ec8d[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x22ec8d[_0x5df0('0x43')],{'$or':_['map'](_0x22ec8d['attributes'],function(_0x34bc46){var _0x3bc464={};_0x3bc464[_0x34bc46]={'$like':'%'+_0x6b094c[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x3bc464;})});}_0x22ec8d=_[_0x5df0('0x46')]({},_0x22ec8d,_0x6b094c[_0x5df0('0x48')]);return db[_0x5df0('0x64')][_0x5df0('0x49')]({'where':_0x22ec8d[_0x5df0('0x43')]})[_0x5df0('0x22')](function(_0x289b66){_0xd629f3[_0x5df0('0x49')]=_0x289b66;if(_0x6b094c[_0x5df0('0x39')][_0x5df0('0x4a')]){_0x22ec8d[_0x5df0('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5df0('0x4c')](_0x22ec8d);})[_0x5df0('0x22')](function(_0xa20283){_0xd629f3[_0x5df0('0x4d')]=_0xa20283;return _0xd629f3;});}})['then'](respondWithFilteredResult(_0x4aa7a3,_0x22ec8d))[_0x5df0('0x4e')](handleError(_0x4aa7a3,null));};exports[_0x5df0('0x65')]=function(_0x58e957,_0x1fef28,_0x35bdd7){var _0x14d9d={'raw':!![],'where':{}};var _0x56baf9={};var _0x5d9900={'count':0x0,'rows':[]};return db[_0x5df0('0x35')][_0x5df0('0x5f')]({'where':{'id':_0x58e957[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x1fef28,null))['then'](function(_0x354ff0){if(_0x354ff0){_0x56baf9[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db['CmHopperFinal'][_0x5df0('0x36')]);_0x56baf9[_0x5df0('0x39')]=_['keys'](_0x58e957[_0x5df0('0x39')]);_0x56baf9['filters']=_[_0x5df0('0x3b')](_0x56baf9['model'],_0x56baf9[_0x5df0('0x39')]);_0x14d9d[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x56baf9[_0x5df0('0x38')],qs['fields'](_0x58e957[_0x5df0('0x39')]['fields']));_0x14d9d[_0x5df0('0x3c')]=_0x14d9d[_0x5df0('0x3c')][_0x5df0('0x3e')]?_0x14d9d[_0x5df0('0x3c')]:_0x56baf9[_0x5df0('0x38')];if(!_0x58e957[_0x5df0('0x39')]['hasOwnProperty'](_0x5df0('0x3f'))){_0x14d9d['limit']=qs[_0x5df0('0x1c')](_0x58e957[_0x5df0('0x39')]['limit']);_0x14d9d[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x58e957[_0x5df0('0x39')][_0x5df0('0x40')]);}_0x14d9d[_0x5df0('0x41')]=qs['sort'](_0x58e957[_0x5df0('0x39')][_0x5df0('0x42')]);_0x14d9d['where']=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x58e957[_0x5df0('0x39')],_0x56baf9[_0x5df0('0x44')]));_0x14d9d['where'][_0x5df0('0x61')]=_0x354ff0['id'];if(_0x58e957[_0x5df0('0x39')][_0x5df0('0x28')]){_0x14d9d[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x14d9d['where'],{'$or':_[_0x5df0('0x34')](_0x14d9d[_0x5df0('0x3c')],function(_0x5482ad){var _0x387418={};_0x387418[_0x5482ad]={'$like':'%'+_0x58e957[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x387418;})});}_0x14d9d=_[_0x5df0('0x46')]({},_0x14d9d,_0x58e957[_0x5df0('0x48')]);return db[_0x5df0('0x66')][_0x5df0('0x49')]({'where':_0x14d9d['where']})[_0x5df0('0x22')](function(_0x25deb7){_0x5d9900[_0x5df0('0x49')]=_0x25deb7;if(_0x58e957['query'][_0x5df0('0x4a')]){_0x14d9d[_0x5df0('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5df0('0x4c')](_0x14d9d);})['then'](function(_0x5de2f3){_0x5d9900[_0x5df0('0x4d')]=_0x5de2f3;return _0x5d9900;});}})[_0x5df0('0x22')](respondWithFilteredResult(_0x1fef28,_0x14d9d))['catch'](handleError(_0x1fef28,null));};exports[_0x5df0('0x67')]=function(_0x2aba2b,_0x321f56,_0x108e3d){var _0x762274={'raw':!![],'where':{}};var _0x577567={};var _0x39124c={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2aba2b[_0x5df0('0x50')]['id']}})['then'](handleEntityNotFound(_0x321f56,null))[_0x5df0('0x22')](function(_0x419980){if(_0x419980){_0x577567[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db[_0x5df0('0x68')][_0x5df0('0x36')]);_0x577567[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x2aba2b[_0x5df0('0x39')]);_0x577567[_0x5df0('0x44')]=_[_0x5df0('0x3b')](_0x577567['model'],_0x577567['query']);_0x762274[_0x5df0('0x3c')]=_['intersection'](_0x577567[_0x5df0('0x38')],qs['fields'](_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x3d')]));_0x762274[_0x5df0('0x3c')]=_0x762274[_0x5df0('0x3c')][_0x5df0('0x3e')]?_0x762274['attributes']:_0x577567[_0x5df0('0x38')];if(!_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x60')](_0x5df0('0x3f'))){_0x762274['limit']=qs[_0x5df0('0x1c')](_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x1c')]);_0x762274[_0x5df0('0x40')]=qs['offset'](_0x2aba2b[_0x5df0('0x39')]['offset']);}_0x762274[_0x5df0('0x41')]=qs[_0x5df0('0x42')](_0x2aba2b['query'][_0x5df0('0x42')]);_0x762274['where']=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x2aba2b[_0x5df0('0x39')],_0x577567[_0x5df0('0x44')]));_0x762274[_0x5df0('0x43')][_0x5df0('0x61')]=_0x419980['id'];if(_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x28')]){_0x762274[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x762274['where'],{'$or':_[_0x5df0('0x34')](_0x762274[_0x5df0('0x3c')],function(_0x4c8268){var _0x508008={};_0x508008[_0x4c8268]={'$like':'%'+_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x508008;})});}_0x762274=_[_0x5df0('0x46')]({},_0x762274,_0x2aba2b[_0x5df0('0x48')]);return db[_0x5df0('0x68')][_0x5df0('0x49')]({'where':_0x762274['where']})['then'](function(_0x2ea438){_0x39124c[_0x5df0('0x49')]=_0x2ea438;if(_0x2aba2b[_0x5df0('0x39')][_0x5df0('0x4a')]){_0x762274['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x5df0('0x4c')](_0x762274);})['then'](function(_0xfcb845){_0x39124c['rows']=_0xfcb845;return _0x39124c;});}})[_0x5df0('0x22')](respondWithFilteredResult(_0x321f56,_0x762274))[_0x5df0('0x4e')](handleError(_0x321f56,null));};exports['getTeams']=function(_0xf3a662,_0x49a6b5,_0x57d349){var _0x516968={};var _0x271760={};var _0xbac54f;var _0x54fb01;return db[_0x5df0('0x35')][_0x5df0('0x5f')]({'where':{'id':_0xf3a662[_0x5df0('0x50')]['id']}})['then'](handleEntityNotFound(_0x49a6b5,null))[_0x5df0('0x22')](function(_0x5e23ab){if(_0x5e23ab){_0xbac54f=_0x5e23ab;_0x271760[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db['Team']['rawAttributes']);_0x271760['query']=_[_0x5df0('0x3a')](_0xf3a662[_0x5df0('0x39')]);_0x271760[_0x5df0('0x44')]=_[_0x5df0('0x3b')](_0x271760[_0x5df0('0x38')],_0x271760[_0x5df0('0x39')]);_0x516968[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x271760['model'],qs[_0x5df0('0x3d')](_0xf3a662[_0x5df0('0x39')][_0x5df0('0x3d')]));_0x516968[_0x5df0('0x3c')]=_0x516968['attributes'][_0x5df0('0x3e')]?_0x516968[_0x5df0('0x3c')]:_0x271760[_0x5df0('0x38')];_0x516968[_0x5df0('0x41')]=qs[_0x5df0('0x42')](_0xf3a662['query'][_0x5df0('0x42')]);_0x516968[_0x5df0('0x43')]=qs[_0x5df0('0x44')](_['pick'](_0xf3a662[_0x5df0('0x39')],_0x271760[_0x5df0('0x44')]));if(_0xf3a662[_0x5df0('0x39')]['filter']){_0x516968[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x516968['where'],{'$or':_[_0x5df0('0x34')](_0x516968['attributes'],function(_0x4bcf66){var _0x26b56f={};_0x26b56f[_0x4bcf66]={'$like':'%'+_0xf3a662[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x26b56f;})});}_0x516968=_[_0x5df0('0x46')]({},_0x516968,_0xf3a662[_0x5df0('0x48')]);return _0xbac54f[_0x5df0('0x69')](_0x516968);}})[_0x5df0('0x22')](function(_0x4c5be4){if(_0x4c5be4){_0x54fb01=_0x4c5be4[_0x5df0('0x3e')];if(!_0xf3a662[_0x5df0('0x39')][_0x5df0('0x60')](_0x5df0('0x3f'))){_0x516968[_0x5df0('0x1c')]=qs['limit'](_0xf3a662['query'][_0x5df0('0x1c')]);_0x516968[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0xf3a662[_0x5df0('0x39')][_0x5df0('0x40')]);}return _0xbac54f[_0x5df0('0x69')](_0x516968);}})[_0x5df0('0x22')](function(_0xa7f96c){if(_0xa7f96c){return _0xa7f96c?{'count':_0x54fb01,'rows':_0xa7f96c}:null;}})[_0x5df0('0x22')](respondWithResult(_0x49a6b5,null))[_0x5df0('0x4e')](handleError(_0x49a6b5,null));};exports[_0x5df0('0x6a')]=function(_0x13b9e7,_0x294701,_0x52834a){var _0x3ef8a8=_0x13b9e7[_0x5df0('0x52')][_0x5df0('0x6b')];var _0x4533f7=_[_0x5df0('0x34')](_0x3ef8a8,'id');return db[_0x5df0('0x6c')][_0x5df0('0x4c')]({'where':{'id':_0x4533f7},'attributes':['id'],'include':[{'model':db[_0x5df0('0x6d')],'as':_0x5df0('0x6e'),'attributes':['id','name',_0x5df0('0x6f'),_0x5df0('0x70'),_0x5df0('0x71')],'raw':!![]}]})[_0x5df0('0x22')](function(_0x59e8f4){if(_0x59e8f4){var _0x653d2b=_[_0x5df0('0x72')](_0x59e8f4,function(_0x3722f0){var _0x5f34f5=_0x3722f0[_0x5df0('0x55')]({'plain':!![]});_0x5f34f5['Agents'][_0x5df0('0x73')](function(_0x2dd34f){_0x2dd34f[_0x5df0('0x74')]=_['find'](_0x3ef8a8,{'id':_0x5f34f5['id']})[_0x5df0('0x74')];});return _0x5f34f5[_0x5df0('0x6e')];});return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x13b9e7[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](function(_0x2606cb){return db[_0x5df0('0x75')]['transaction'](function(_0xb1d89f){return _0x2606cb['addTeams'](_0x4533f7,{'transaction':_0xb1d89f})['then'](function(){return BPromise[_0x5df0('0x76')](_0x653d2b,function(_0x5f69bd){return db['UserVoiceQueue'][_0x5df0('0x77')]({'where':{'UserId':_0x5f69bd['id'],'VoiceQueueId':_0x13b9e7[_0x5df0('0x50')]['id']},'defaults':{'penalty':_0x5f69bd[_0x5df0('0x74')]},'transaction':_0xb1d89f});});})[_0x5df0('0x22')](function(){return BPromise[_0x5df0('0x76')](_[_0x5df0('0x28')](_0x653d2b,{'online':!![]}),function(_0x52a8a4){return db[_0x5df0('0x78')]['upsert']({'membername':_0x52a8a4[_0x5df0('0x2d')],'UserId':_0x52a8a4['id'],'queue_name':_0x2606cb[_0x5df0('0x2d')],'VoiceQueueId':_0x2606cb['id'],'interface':_[_0x5df0('0x79')](_0x52a8a4[_0x5df0('0x71')])?util['format'](_0x5df0('0x7a'),_0x52a8a4['name']):_0x52a8a4[_0x5df0('0x71')],'paused':_0x52a8a4['voicePause']||![],'penalty':_0x52a8a4[_0x5df0('0x74')]},{'transaction':_0xb1d89f});});})[_0x5df0('0x22')](function(){_0x653d2b[_0x5df0('0x73')](function(_0x25b25c){socket[_0x5df0('0x7b')](_0x5df0('0x7c'),{'UserId':_0x25b25c['id'],'VoiceQueueId':_0x2606cb['id']});});});});});}})['then'](respondWithStatusCode(_0x294701,null))[_0x5df0('0x4e')](handleError(_0x294701,null));};exports[_0x5df0('0x7d')]=function(_0x4224ed,_0x219fd1,_0x7bb7ac){return db[_0x5df0('0x6c')][_0x5df0('0x4c')]({'where':{'id':_0x4224ed[_0x5df0('0x39')][_0x5df0('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x5df0('0x6d')],'as':_0x5df0('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x5df0('0x22')](handleEntityNotFound(_0x219fd1,null))[_0x5df0('0x22')](function(_0x4c5808){var _0x29ccba=_[_0x5df0('0x34')](_0x4c5808,'id');var _0x4118d2=[];var _0x313e67=[];var _0x3aefc5=squel[_0x5df0('0x7f')]();_0x3aefc5[_0x5df0('0x80')]('tq.TeamId')[_0x5df0('0x81')](_0x5df0('0x82'),'tq')[_0x5df0('0x83')]('user_has_teams','ut',_0x5df0('0x84'))[_0x5df0('0x43')](_0x5df0('0x85'),_0x4224ed[_0x5df0('0x50')]['id']);for(var _0x53ee5c=0x0;_0x53ee5c<_0x4c5808['length'];_0x53ee5c+=0x1){let _0x2255a0=_0x4c5808[_0x53ee5c];for(var _0x8eb739=0x0;_0x8eb739<_0x2255a0['Agents'][_0x5df0('0x3e')];_0x8eb739+=0x1){let _0x471cb0=_0x2255a0['Agents'][_0x8eb739];var _0x49c0f9=_0x3aefc5[_0x5df0('0x86')]();_0x49c0f9[_0x5df0('0x43')](_0x5df0('0x87'),_0x471cb0['id']);_0x313e67[_0x5df0('0x88')](db[_0x5df0('0x75')][_0x5df0('0x39')](_0x49c0f9[_0x5df0('0x89')](),{'type':db[_0x5df0('0x75')][_0x5df0('0x8a')]['SELECT']})[_0x5df0('0x22')](function(_0x2faf65){if(_0x2faf65[_0x5df0('0x3e')]===0x1){return _0x471cb0['id'];}else{var _0x3fddb0=_[_0x5df0('0x8b')](_[_0x5df0('0x34')](_0x2faf65,_0x5df0('0x8c')),function(_0x31b027){return _[_0x5df0('0x2a')](_0x29ccba,_0x31b027);});if(_0x3fddb0){return _0x471cb0['id'];}}}));}}return BPromise['all'](_0x313e67)[_0x5df0('0x22')](function(_0x2e2cc9){_0x4118d2=_(_0x4118d2)[_0x5df0('0x8d')](_0x2e2cc9)[_0x5df0('0x8e')]()['value']();return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x4224ed[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](function(_0x440266){return db[_0x5df0('0x75')][_0x5df0('0x8f')](function(_0x48a992){return _0x440266[_0x5df0('0x7d')](_0x4224ed[_0x5df0('0x39')]['ids'],{'transaction':_0x48a992})[_0x5df0('0x22')](function(){if(!_[_0x5df0('0x90')](_0x4118d2)){return _0x440266['removeAgents'](_0x4118d2,{'transaction':_0x48a992})['then'](function(){return db[_0x5df0('0x78')][_0x5df0('0x23')]({'where':{'VoiceQueueId':_0x4224ed[_0x5df0('0x50')]['id'],'UserId':_0x4118d2},'transaction':_0x48a992});});}})['then'](function(){_0x4118d2['forEach'](function(_0xcc40a5){socket[_0x5df0('0x7b')](_0x5df0('0x91'),{'UserId':_0xcc40a5,'VoiceQueueId':_0x440266['id']});});});});});});})[_0x5df0('0x22')](respondWithStatusCode(_0x219fd1,null))['catch'](handleError(_0x219fd1,null));};exports[_0x5df0('0x92')]=function(_0x3764fb,_0x2eba3e,_0x3434d4){var _0xbbde8f,_0xa005fb;return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x3764fb[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x2eba3e,null))[_0x5df0('0x22')](function(_0x387611){if(_0x387611){_0xa005fb=_0x387611;return _0x387611[_0x5df0('0x92')](_0x3764fb[_0x5df0('0x52')][_0x5df0('0x7e')],_[_0x5df0('0x5c')](_0x3764fb[_0x5df0('0x52')],['ids','id'])||{})['spread'](function(_0x5cf7b9){for(var _0xa3f93c=0x0;_0xa3f93c<_0x3764fb[_0x5df0('0x52')][_0x5df0('0x7e')]['length'];_0xa3f93c+=0x1){socket[_0x5df0('0x7b')](_0x5df0('0x7c'),{'UserId':_0x3764fb[_0x5df0('0x52')][_0x5df0('0x7e')][_0xa3f93c],'VoiceQueueId':_0x3764fb[_0x5df0('0x50')]['id']});}return _0x5cf7b9;});}})['then'](function(_0x352c35){_0xbbde8f=_0x352c35||[];if(_0xa005fb){return db[_0x5df0('0x6d')][_0x5df0('0x4c')]({'where':{'id':_0x3764fb[_0x5df0('0x52')][_0x5df0('0x7e')]},'attributes':['id',_0x5df0('0x2d'),_0x5df0('0x6f'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x33dad9){if(!_[_0x5df0('0x90')](_0x33dad9)){var _0x336fbe=[];for(var _0x36853b=0x0;_0x36853b<_0x33dad9[_0x5df0('0x3e')];_0x36853b++){if(_0x33dad9[_0x36853b][_0x5df0('0x6f')]){_0x336fbe[_0x5df0('0x88')](db[_0x5df0('0x78')][_0x5df0('0x93')]({'membername':_0x33dad9[_0x36853b][_0x5df0('0x2d')],'UserId':_0x33dad9[_0x36853b]['id'],'queue_name':_0xa005fb[_0x5df0('0x2d')],'VoiceQueueId':_0xa005fb['id'],'interface':_['isNil'](_0x33dad9[_0x36853b][_0x5df0('0x71')])?util[_0x5df0('0x94')](_0x5df0('0x7a'),_0x33dad9[_0x36853b]['name']):_0x33dad9[_0x36853b][_0x5df0('0x71')],'paused':_0x33dad9[_0x36853b]['voicePause']||![],'penalty':_0x3764fb['body']['penalty']||0x0}));}}return BPromise[_0x5df0('0x95')](_0x336fbe);}})[_0x5df0('0x22')](function(){return _0xbbde8f;})[_0x5df0('0x22')](respondWithResult(_0x2eba3e,null))[_0x5df0('0x4e')](handleError(_0x2eba3e,null));};exports[_0x5df0('0x96')]=function(_0x21febe,_0x15b38f,_0x2179df){return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x21febe[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x15b38f,null))[_0x5df0('0x22')](function(_0x48eee8){if(_0x48eee8){return _0x48eee8[_0x5df0('0x96')](_0x21febe[_0x5df0('0x39')][_0x5df0('0x7e')])[_0x5df0('0x22')](function(){if(_[_0x5df0('0x97')](_0x21febe['query']['ids'])){for(var _0x4c4b79=0x0;_0x4c4b79<_0x21febe[_0x5df0('0x39')][_0x5df0('0x7e')][_0x5df0('0x3e')];_0x4c4b79+=0x1){socket[_0x5df0('0x7b')](_0x5df0('0x91'),{'UserId':Number(_0x21febe[_0x5df0('0x39')]['ids'][_0x4c4b79]),'VoiceQueueId':Number(_0x21febe[_0x5df0('0x50')]['id'])});}}else{socket[_0x5df0('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x21febe[_0x5df0('0x39')][_0x5df0('0x7e')]),'VoiceQueueId':Number(_0x21febe[_0x5df0('0x50')]['id'])});}});}})[_0x5df0('0x22')](function(_0x1a8f38){return db[_0x5df0('0x78')][_0x5df0('0x23')]({'where':{'VoiceQueueId':_0x21febe[_0x5df0('0x50')]['id'],'UserId':_0x21febe[_0x5df0('0x39')][_0x5df0('0x7e')]}})[_0x5df0('0x22')](function(){return _0x1a8f38;});})[_0x5df0('0x22')](respondWithStatusCode(_0x15b38f,null))[_0x5df0('0x4e')](handleError(_0x15b38f,null));};exports[_0x5df0('0x98')]=function(_0x15cef7,_0x4e9ac6,_0x1128e5){var _0x4ba1be={};var _0x26685b={};var _0x561cda;var _0x21e266;return db['VoiceQueue']['findOne']({'where':{'id':_0x15cef7[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x4e9ac6,null))['then'](function(_0x98e1ff){if(_0x98e1ff){_0x561cda=_0x98e1ff;_0x26685b[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db[_0x5df0('0x6d')][_0x5df0('0x36')]);_0x26685b[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x15cef7[_0x5df0('0x39')]);_0x26685b[_0x5df0('0x44')]=_['intersection'](_0x26685b[_0x5df0('0x38')],_0x26685b[_0x5df0('0x39')]);_0x4ba1be[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x26685b['model'],qs[_0x5df0('0x3d')](_0x15cef7['query'][_0x5df0('0x3d')]));_0x4ba1be[_0x5df0('0x3c')]=_0x4ba1be['attributes'][_0x5df0('0x3e')]?_0x4ba1be[_0x5df0('0x3c')]:_0x26685b[_0x5df0('0x38')];_0x4ba1be['order']=qs[_0x5df0('0x42')](_0x15cef7[_0x5df0('0x39')][_0x5df0('0x42')]);_0x4ba1be[_0x5df0('0x43')]=qs['filters'](_[_0x5df0('0x45')](_0x15cef7[_0x5df0('0x39')],_0x26685b[_0x5df0('0x44')]));if(_0x15cef7[_0x5df0('0x39')][_0x5df0('0x28')]){_0x4ba1be[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x4ba1be[_0x5df0('0x43')],{'$or':_[_0x5df0('0x34')](_0x4ba1be[_0x5df0('0x3c')],function(_0x41ccb8){var _0x12801f={};_0x12801f[_0x41ccb8]={'$like':'%'+_0x15cef7[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x12801f;})});}_0x4ba1be=_['merge']({},_0x4ba1be,_0x15cef7[_0x5df0('0x48')]);return _0x561cda[_0x5df0('0x98')](_0x4ba1be);}})['then'](function(_0x4d549a){if(_0x4d549a){_0x21e266=_0x4d549a['length'];if(!_0x15cef7[_0x5df0('0x39')][_0x5df0('0x60')](_0x5df0('0x3f'))){_0x4ba1be[_0x5df0('0x1c')]=qs[_0x5df0('0x1c')](_0x15cef7[_0x5df0('0x39')][_0x5df0('0x1c')]);_0x4ba1be[_0x5df0('0x40')]=qs['offset'](_0x15cef7[_0x5df0('0x39')][_0x5df0('0x40')]);}return _0x561cda['getAgents'](_0x4ba1be);}})[_0x5df0('0x22')](function(_0x52507e){if(_0x52507e){return _0x52507e?{'count':_0x21e266,'rows':_0x52507e}:null;}})['then'](respondWithResult(_0x4e9ac6,null))['catch'](handleError(_0x4e9ac6,null));};exports['getMembers']=function(_0x5baece,_0x72e1f1,_0x44f9cf){var _0x41f1c6={};var _0x1a6a8a={};var _0x1b2a67;var _0x44e517;return db[_0x5df0('0x35')]['findOne']({'where':{'id':_0x5baece['params']['id']}})['then'](handleEntityNotFound(_0x72e1f1,null))['then'](function(_0x514079){if(_0x514079){_0x1b2a67=_0x514079;_0x1a6a8a[_0x5df0('0x38')]=_[_0x5df0('0x3a')](db['UserVoiceQueueRt']['rawAttributes']);_0x1a6a8a[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x5baece[_0x5df0('0x39')]);_0x1a6a8a[_0x5df0('0x44')]=_[_0x5df0('0x3b')](_0x1a6a8a['model'],_0x1a6a8a['query']);_0x41f1c6[_0x5df0('0x3c')]=_[_0x5df0('0x3b')](_0x1a6a8a['model'],qs['fields'](_0x5baece['query']['fields']));_0x41f1c6['attributes']=_0x41f1c6[_0x5df0('0x3c')][_0x5df0('0x3e')]?_0x41f1c6[_0x5df0('0x3c')]:_0x1a6a8a['model'];_0x41f1c6[_0x5df0('0x41')]=qs[_0x5df0('0x42')](_0x5baece[_0x5df0('0x39')][_0x5df0('0x42')]);_0x41f1c6[_0x5df0('0x43')]=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x5baece[_0x5df0('0x39')],_0x1a6a8a[_0x5df0('0x44')]));if(_0x5baece[_0x5df0('0x39')][_0x5df0('0x28')]){_0x41f1c6[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x41f1c6[_0x5df0('0x43')],{'$or':_[_0x5df0('0x34')](_0x41f1c6[_0x5df0('0x3c')],function(_0x1351b5){var _0x3e13b4={};_0x3e13b4[_0x1351b5]={'$like':'%'+_0x5baece[_0x5df0('0x39')]['filter']+'%'};return _0x3e13b4;})});}_0x41f1c6=_['merge']({},_0x41f1c6,_0x5baece['options']);return _0x1b2a67[_0x5df0('0x99')](_0x41f1c6);}})[_0x5df0('0x22')](function(_0x2d3216){if(_0x2d3216){_0x44e517=_0x2d3216['length'];if(!_0x5baece[_0x5df0('0x39')][_0x5df0('0x60')]('nolimit')){_0x41f1c6[_0x5df0('0x1c')]=qs[_0x5df0('0x1c')](_0x5baece['query'][_0x5df0('0x1c')]);_0x41f1c6[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x5baece[_0x5df0('0x39')][_0x5df0('0x40')]);}return _0x1b2a67[_0x5df0('0x99')](_0x41f1c6);}})[_0x5df0('0x22')](function(_0x11a965){return _0x11a965?{'count':_0x44e517,'rows':_0x11a965}:null;})[_0x5df0('0x22')](respondWithResult(_0x72e1f1,null))[_0x5df0('0x4e')](handleError(_0x72e1f1,null));};exports[_0x5df0('0x9a')]=function(_0x83e893,_0x66f3da,_0x5851bd){var _0x30443a={};var _0x22e2ba={};var _0x9a82eb;var _0x5dc63a;return db[_0x5df0('0x35')][_0x5df0('0x5f')]({'where':{'id':_0x83e893[_0x5df0('0x50')]['id']}})['then'](handleEntityNotFound(_0x66f3da,null))[_0x5df0('0x22')](function(_0x43455a){if(_0x43455a){_0x9a82eb=_0x43455a;_0x22e2ba['model']=_[_0x5df0('0x3a')](db['CmList']['rawAttributes']);_0x22e2ba[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x83e893[_0x5df0('0x39')]);_0x22e2ba[_0x5df0('0x44')]=_['intersection'](_0x22e2ba[_0x5df0('0x38')],_0x22e2ba[_0x5df0('0x39')]);_0x30443a['attributes']=_[_0x5df0('0x3b')](_0x22e2ba[_0x5df0('0x38')],qs['fields'](_0x83e893[_0x5df0('0x39')][_0x5df0('0x3d')]));_0x30443a[_0x5df0('0x3c')]=_0x30443a['attributes'][_0x5df0('0x3e')]?_0x30443a[_0x5df0('0x3c')]:_0x22e2ba[_0x5df0('0x38')];_0x30443a['order']=qs[_0x5df0('0x42')](_0x83e893[_0x5df0('0x39')]['sort']);_0x30443a[_0x5df0('0x43')]=qs[_0x5df0('0x44')](_[_0x5df0('0x45')](_0x83e893[_0x5df0('0x39')],_0x22e2ba[_0x5df0('0x44')]));if(_0x83e893['query']['filter']){_0x30443a[_0x5df0('0x43')]=_['merge'](_0x30443a[_0x5df0('0x43')],{'$or':_[_0x5df0('0x34')](_0x30443a[_0x5df0('0x3c')],function(_0xb66b5e){var _0x53aa66={};_0x53aa66[_0xb66b5e]={'$like':'%'+_0x83e893[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x53aa66;})});}_0x30443a=_['merge']({},_0x30443a,_0x83e893[_0x5df0('0x48')]);return _0x9a82eb['getLists'](_0x30443a);}})['then'](function(_0x5890ac){if(_0x5890ac){_0x5dc63a=_0x5890ac[_0x5df0('0x3e')];if(!_0x83e893[_0x5df0('0x39')]['hasOwnProperty'](_0x5df0('0x3f'))){_0x30443a[_0x5df0('0x1c')]=qs[_0x5df0('0x1c')](_0x83e893[_0x5df0('0x39')]['limit']);_0x30443a[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x83e893['query'][_0x5df0('0x40')]);}return _0x9a82eb[_0x5df0('0x9a')](_0x30443a);}})['then'](function(_0x2b714b){if(_0x2b714b){return _0x2b714b?{'count':_0x5dc63a,'rows':_0x2b714b}:null;}})[_0x5df0('0x22')](respondWithResult(_0x66f3da,null))[_0x5df0('0x4e')](handleError(_0x66f3da,null));};exports[_0x5df0('0x9b')]=function(_0x2405f6,_0x2e19c3,_0x1b0a7b){var _0x1ea146,_0x391bce;return db[_0x5df0('0x35')]['find']({'where':{'id':_0x2405f6['params']['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x2e19c3,null))['then'](function(_0x43b9c8){if(_0x43b9c8){_0x391bce=_0x43b9c8;return _0x43b9c8['addLists'](_0x2405f6[_0x5df0('0x52')]['ids'],_[_0x5df0('0x5c')](_0x2405f6[_0x5df0('0x52')],[_0x5df0('0x7e'),'id'])||{});}return null;})[_0x5df0('0x9c')](function(_0x32e138){var _0x209aa1;_0x1ea146=_0x32e138||[];var _0x5486af=[];if(_0x32e138){for(var _0x2b725e=0x0;_0x2b725e<_0x32e138[_0x5df0('0x3e')];_0x2b725e+=0x1){var _0x216852=_0x32e138[_0x2b725e][_0x5df0('0x55')]({'plain':!![]});_0x391bce[_0x5df0('0x9d')]=_0x2405f6[_0x5df0('0x52')]['dialCheckDuplicateType']?_0x2405f6[_0x5df0('0x52')][_0x5df0('0x9d')]:_0x391bce[_0x5df0('0x9d')];switch(_0x391bce[_0x5df0('0x9d')]){case _0x5df0('0x9e'):_0x209aa1=squel['insert']()[_0x5df0('0x9f')]('cm_hopper')[_0x5df0('0xa0')]([_0x5df0('0xa1'),_0x5df0('0xa2'),_0x5df0('0xa3'),'ListId',_0x5df0('0x61'),_0x5df0('0x5a'),_0x5df0('0x5b')],squel[_0x5df0('0x7f')]()['field'](_0x5df0('0xa1'),_0x5df0('0xa1'))['field']('NOW()','scheduledAt')[_0x5df0('0x80')]('id',_0x5df0('0xa3'))[_0x5df0('0x80')](_0x216852[_0x5df0('0xa4')][_0x5df0('0x89')](),_0x5df0('0xa5'))['field'](_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')](),_0x5df0('0x61'))['field'](_0x5df0('0xa6'),'createdAt')[_0x5df0('0x80')]('NOW()',_0x5df0('0x5b'))['from'](_0x5df0('0xa7'))[_0x5df0('0x43')](_0x5df0('0xa8'))[_0x5df0('0x43')](_0x5df0('0xa9'),_0x216852[_0x5df0('0xa4')][_0x5df0('0x89')]())[_0x5df0('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x5df0('0x43')](_0x5df0('0xaa'),squel[_0x5df0('0x7f')]()['field'](_0x5df0('0xab'))[_0x5df0('0x81')](_0x5df0('0xac'))['where'](_0x5df0('0x85'),_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')]()))[_0x5df0('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5df0('0x7f')]()[_0x5df0('0x80')](_0x5df0('0xad'))[_0x5df0('0x81')](_0x5df0('0xae'))[_0x5df0('0x43')](_0x5df0('0x85'),_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')]())))[_0x5df0('0x89')]();break;case _0x5df0('0xaf'):_0x209aa1=squel[_0x5df0('0xb0')]()[_0x5df0('0x9f')]('cm_hopper')['fromQuery']([_0x5df0('0xa1'),_0x5df0('0xa2'),_0x5df0('0xa3'),'ListId',_0x5df0('0x61'),_0x5df0('0x5a'),_0x5df0('0x5b')],squel['select']()[_0x5df0('0x80')](_0x5df0('0xa1'),_0x5df0('0xa1'))[_0x5df0('0x80')](_0x5df0('0xa6'),_0x5df0('0xa2'))[_0x5df0('0x80')]('id',_0x5df0('0xa3'))[_0x5df0('0x80')](_0x216852[_0x5df0('0xa4')][_0x5df0('0x89')](),_0x5df0('0xa5'))[_0x5df0('0x80')](_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')](),_0x5df0('0x61'))[_0x5df0('0x80')]('NOW()',_0x5df0('0x5a'))[_0x5df0('0x80')](_0x5df0('0xa6'),_0x5df0('0x5b'))[_0x5df0('0x81')](_0x5df0('0xa7'))[_0x5df0('0x43')](_0x5df0('0xa8'))[_0x5df0('0x43')](_0x5df0('0xa9'),_0x216852[_0x5df0('0xa4')][_0x5df0('0x89')]())[_0x5df0('0x43')](_0x5df0('0xb1'))[_0x5df0('0x43')](_0x5df0('0xaa'),squel['select']()[_0x5df0('0x80')]('COALESCE(phone,\x27\x27)')[_0x5df0('0x81')](_0x5df0('0xae'))['where'](_0x5df0('0x85'),_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')]())))[_0x5df0('0x89')]();break;default:_0x209aa1=squel['insert']()[_0x5df0('0x9f')](_0x5df0('0xae'))[_0x5df0('0xa0')]([_0x5df0('0xa1'),_0x5df0('0xa2'),_0x5df0('0xa3'),_0x5df0('0xa5'),_0x5df0('0x61'),_0x5df0('0x5a'),_0x5df0('0x5b')],squel['select']()[_0x5df0('0x80')](_0x5df0('0xa1'),'phone')['field']('NOW()',_0x5df0('0xa2'))[_0x5df0('0x80')]('id',_0x5df0('0xa3'))['field'](_0x216852[_0x5df0('0xa4')]['toString'](),_0x5df0('0xa5'))['field'](_0x2405f6[_0x5df0('0x50')]['id'][_0x5df0('0x89')](),'VoiceQueueId')[_0x5df0('0x80')](_0x5df0('0xa6'),_0x5df0('0x5a'))[_0x5df0('0x80')](_0x5df0('0xa6'),_0x5df0('0x5b'))[_0x5df0('0x81')]('cm_contacts')[_0x5df0('0x43')](_0x5df0('0xa8'))[_0x5df0('0x43')](_0x5df0('0xa9'),_0x216852[_0x5df0('0xa4')][_0x5df0('0x89')]())[_0x5df0('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x5df0('0x89')]();}_0x5486af['push'](db[_0x5df0('0x75')]['query'](_0x209aa1));}return BPromise[_0x5df0('0x95')](_0x5486af);}})[_0x5df0('0x22')](function(){return _0x1ea146;})[_0x5df0('0x22')](respondWithResult(_0x2e19c3,null))[_0x5df0('0x4e')](handleError(_0x2e19c3,null));};exports['removeLists']=function(_0x2b3332,_0x3544ec,_0x47f1b9){return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x2b3332[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x3544ec,null))[_0x5df0('0x22')](function(_0x1a5550){if(_0x1a5550){return _0x1a5550['removeLists'](_0x2b3332[_0x5df0('0x39')][_0x5df0('0x7e')]);}})[_0x5df0('0x22')](function(_0x55b72f){if(_0x55b72f){return db[_0x5df0('0x62')][_0x5df0('0x23')]({'where':{'ListId':_0x2b3332[_0x5df0('0x39')][_0x5df0('0x7e')],'VoiceQueueId':_0x2b3332[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](function(){return _0x55b72f;});}})[_0x5df0('0x22')](respondWithStatusCode(_0x3544ec,null))[_0x5df0('0x4e')](handleError(_0x3544ec,null));};exports['getBlackLists']=function(_0x2df073,_0x5b70fb,_0x48224d){var _0x5a51fb={};var _0x51a2e0={};var _0x442c0d;var _0x423ed6;return db[_0x5df0('0x35')]['findOne']({'where':{'id':_0x2df073[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x5b70fb,null))['then'](function(_0x265af2){if(_0x265af2){_0x442c0d=_0x265af2;_0x51a2e0[_0x5df0('0x38')]=_['keys'](db['CmList'][_0x5df0('0x36')]);_0x51a2e0[_0x5df0('0x39')]=_[_0x5df0('0x3a')](_0x2df073[_0x5df0('0x39')]);_0x51a2e0['filters']=_[_0x5df0('0x3b')](_0x51a2e0[_0x5df0('0x38')],_0x51a2e0[_0x5df0('0x39')]);_0x5a51fb['attributes']=_['intersection'](_0x51a2e0['model'],qs[_0x5df0('0x3d')](_0x2df073[_0x5df0('0x39')][_0x5df0('0x3d')]));_0x5a51fb[_0x5df0('0x3c')]=_0x5a51fb[_0x5df0('0x3c')]['length']?_0x5a51fb[_0x5df0('0x3c')]:_0x51a2e0['model'];_0x5a51fb['order']=qs[_0x5df0('0x42')](_0x2df073[_0x5df0('0x39')][_0x5df0('0x42')]);_0x5a51fb['where']=qs['filters'](_[_0x5df0('0x45')](_0x2df073[_0x5df0('0x39')],_0x51a2e0[_0x5df0('0x44')]));if(_0x2df073[_0x5df0('0x39')][_0x5df0('0x28')]){_0x5a51fb[_0x5df0('0x43')]=_[_0x5df0('0x46')](_0x5a51fb['where'],{'$or':_['map'](_0x5a51fb['attributes'],function(_0x6d0262){var _0x463301={};_0x463301[_0x6d0262]={'$like':'%'+_0x2df073[_0x5df0('0x39')][_0x5df0('0x28')]+'%'};return _0x463301;})});}_0x5a51fb=_[_0x5df0('0x46')]({},_0x5a51fb,_0x2df073[_0x5df0('0x48')]);return _0x442c0d[_0x5df0('0xb2')](_0x5a51fb);}})[_0x5df0('0x22')](function(_0x17a982){if(_0x17a982){_0x423ed6=_0x17a982[_0x5df0('0x3e')];if(!_0x2df073['query']['hasOwnProperty'](_0x5df0('0x3f'))){_0x5a51fb['limit']=qs['limit'](_0x2df073['query']['limit']);_0x5a51fb[_0x5df0('0x40')]=qs[_0x5df0('0x40')](_0x2df073[_0x5df0('0x39')]['offset']);}return _0x442c0d[_0x5df0('0xb2')](_0x5a51fb);}})[_0x5df0('0x22')](function(_0x2c6480){if(_0x2c6480){return _0x2c6480?{'count':_0x423ed6,'rows':_0x2c6480}:null;}})[_0x5df0('0x22')](respondWithResult(_0x5b70fb,null))[_0x5df0('0x4e')](handleError(_0x5b70fb,null));};exports[_0x5df0('0xb3')]=function(_0x23c551,_0x3ca24e,_0x57c2bd){var _0x279498,_0x233b57;return db['VoiceQueue'][_0x5df0('0x2c')]({'where':{'id':_0x23c551[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x3ca24e,null))[_0x5df0('0x22')](function(_0x5223a6){if(_0x5223a6){_0x233b57=_0x5223a6;return _0x5223a6['addBlackLists'](_0x23c551[_0x5df0('0x52')][_0x5df0('0x7e')],_[_0x5df0('0x5c')](_0x23c551[_0x5df0('0x52')],[_0x5df0('0x7e'),'id'])||{});}return null;})[_0x5df0('0x9c')](function(_0xdd5c8b){var _0x263e71;_0x279498=_0xdd5c8b||[];var _0x40f2a4=[];if(_0xdd5c8b){for(var _0x1b1234=0x0;_0x1b1234<_0xdd5c8b['length'];_0x1b1234+=0x1){var _0x31f315=_0xdd5c8b[_0x1b1234]['get']({'plain':!![]});_0x263e71=squel[_0x5df0('0xb0')]()[_0x5df0('0x9f')]('cm_hopper_black')[_0x5df0('0xa0')]([_0x5df0('0xa1'),'ContactId',_0x5df0('0xa5'),_0x5df0('0x61'),_0x5df0('0x5a'),_0x5df0('0x5b')],squel[_0x5df0('0x7f')]()[_0x5df0('0x80')](_0x5df0('0xa1'),_0x5df0('0xa1'))[_0x5df0('0x80')]('id',_0x5df0('0xa3'))[_0x5df0('0x80')](_0x31f315['CmListId'][_0x5df0('0x89')](),'ListId')[_0x5df0('0x80')](_0x23c551[_0x5df0('0x50')]['id'][_0x5df0('0x89')](),_0x5df0('0x61'))[_0x5df0('0x80')](_0x5df0('0xa6'),'createdAt')[_0x5df0('0x80')](_0x5df0('0xa6'),_0x5df0('0x5b'))[_0x5df0('0x81')]('cm_contacts')['where'](_0x5df0('0xa8'))['where'](_0x5df0('0xa9'),_0x31f315[_0x5df0('0xa4')][_0x5df0('0x89')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5df0('0x89')]();_0x40f2a4[_0x5df0('0x88')](db['sequelize'][_0x5df0('0x39')](_0x263e71));}return BPromise[_0x5df0('0x95')](_0x40f2a4);}})[_0x5df0('0x22')](function(){return _0x279498;})[_0x5df0('0x22')](respondWithResult(_0x3ca24e,null))[_0x5df0('0x4e')](handleError(_0x3ca24e,null));};exports[_0x5df0('0xb4')]=function(_0x7f9fac,_0x479752,_0x160486){return db[_0x5df0('0x35')][_0x5df0('0x2c')]({'where':{'id':_0x7f9fac['params']['id']}})[_0x5df0('0x22')](handleEntityNotFound(_0x479752,null))[_0x5df0('0x22')](function(_0x2f465c){if(_0x2f465c){return _0x2f465c[_0x5df0('0xb4')](_0x7f9fac[_0x5df0('0x39')][_0x5df0('0x7e')]);}})[_0x5df0('0x22')](function(_0xb76f00){if(_0xb76f00){return db[_0x5df0('0x68')][_0x5df0('0x23')]({'where':{'ListId':_0x7f9fac[_0x5df0('0x39')]['ids'],'VoiceQueueId':_0x7f9fac[_0x5df0('0x50')]['id']}})[_0x5df0('0x22')](function(){return _0xb76f00;});}})[_0x5df0('0x22')](respondWithStatusCode(_0x479752,null))[_0x5df0('0x4e')](handleError(_0x479752,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 4f53556..a7f8fde 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 _0xbfa2=['hook','../../mysqldb','save','update','emit','hasOwnProperty'];(function(_0x2b0b61,_0x170827){var _0x2ae144=function(_0x4f0459){while(--_0x4f0459){_0x2b0b61['push'](_0x2b0b61['shift']());}};_0x2ae144(++_0x170827);}(_0xbfa2,0x157));var _0x2bfa=function(_0x2e5691,_0xeaa28f){_0x2e5691=_0x2e5691-0x0;var _0x4c6509=_0xbfa2[_0x2e5691];return _0x4c6509;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2bfa('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2bfa('0x1'),'afterUpdate':_0x2bfa('0x2'),'afterDestroy':'remove'};function emitEvent(_0x216197){return function(_0xd4a126,_0x3a1148,_0x5c8b2e){VoiceQueueEvents[_0x2bfa('0x3')](_0x216197+':'+_0xd4a126['id'],_0xd4a126);VoiceQueueEvents['emit'](_0x216197,_0xd4a126);_0x5c8b2e(null);};}for(var e in events){if(events[_0x2bfa('0x4')](e)){var event=events[e];VoiceQueue[_0x2bfa('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x69a0=['events','../../mysqldb','VoiceQueue','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f4808,_0x4ecc27){var _0x2be7ac=function(_0x10f7dc){while(--_0x10f7dc){_0x2f4808['push'](_0x2f4808['shift']());}};_0x2be7ac(++_0x4ecc27);}(_0x69a0,0x90));var _0x069a=function(_0x370f37,_0x3903f7){_0x370f37=_0x370f37-0x0;var _0x2deaab=_0x69a0[_0x370f37];return _0x2deaab;};'use strict';var EventEmitter=require(_0x069a('0x0'));var VoiceQueue=require(_0x069a('0x1'))['db'][_0x069a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x069a('0x3'),'afterUpdate':'update','afterDestroy':_0x069a('0x4')};function emitEvent(_0x112672){return function(_0x7d3a05,_0x3b2dab,_0x2aaef6){VoiceQueueEvents[_0x069a('0x5')](_0x112672+':'+_0x7d3a05['id'],_0x7d3a05);VoiceQueueEvents[_0x069a('0x5')](_0x112672,_0x7d3a05);_0x2aaef6(null);};}for(var e in events){if(events[_0x069a('0x6')](e)){var event=events[e];VoiceQueue[_0x069a('0x7')](e,emitEvent(event));}}module[_0x069a('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 a59395b..847c807 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 _0x61c7=['rimraf','exports','VoiceQueue','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x61c7,0x1aa));var _0x761c=function(_0x8f66c0,_0x59161a){_0x8f66c0=_0x8f66c0-0x0;var _0x171236=_0x61c7[_0x8f66c0];return _0x171236;};'use strict';var _=require('lodash');var util=require(_0x761c('0x0'));var logger=require(_0x761c('0x1'))('api');var moment=require(_0x761c('0x2'));var BPromise=require(_0x761c('0x3'));var rp=require(_0x761c('0x4'));var fs=require('fs');var path=require(_0x761c('0x5'));var rimraf=require(_0x761c('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module[_0x761c('0x7')]=function(_0x385473,_0x22f276){return _0x385473['define'](_0x761c('0x8'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30cb=['moment','bluebird','request-promise','path','../../config/environment','exports','define','voice_queues','lodash','util','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x30cb,0xb8));var _0xb30c=function(_0x147aa5,_0x44d876){_0x147aa5=_0x147aa5-0x0;var _0x3ad6d6=_0x30cb[_0x147aa5];return _0x3ad6d6;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var logger=require(_0xb30c('0x2'))('api');var moment=require(_0xb30c('0x3'));var BPromise=require(_0xb30c('0x4'));var rp=require(_0xb30c('0x5'));var fs=require('fs');var path=require(_0xb30c('0x6'));var rimraf=require('rimraf');var config=require(_0xb30c('0x7'));var attributes=require('./voiceQueue.attributes');module[_0xb30c('0x8')]=function(_0x12f3f5,_0x5e3bc7){return _0x12f3f5[_0xb30c('0x9')]('VoiceQueue',attributes,{'tableName':_0xb30c('0xa'),'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 81b04ce..d541c95 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 _0xdfc2=['include','map','attributes','debug','ShowVoiceQueue','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit'];(function(_0x28055e,_0x8312ed){var _0x550d3c=function(_0x487c01){while(--_0x487c01){_0x28055e['push'](_0x28055e['shift']());}};_0x550d3c(++_0x8312ed);}(_0xdfc2,0x103));var _0x2dfc=function(_0x2439e2,_0x4f8174){_0x2439e2=_0x2439e2-0x0;var _0x4229fe=_0xdfc2[_0x2439e2];return _0x4229fe;};'use strict';var _=require(_0x2dfc('0x0'));var util=require(_0x2dfc('0x1'));var moment=require(_0x2dfc('0x2'));var BPromise=require(_0x2dfc('0x3'));var rs=require(_0x2dfc('0x4'));var fs=require('fs');var Redis=require(_0x2dfc('0x5'));var db=require(_0x2dfc('0x6'))['db'];var utils=require(_0x2dfc('0x7'));var logger=require(_0x2dfc('0x8'))(_0x2dfc('0x9'));var config=require(_0x2dfc('0xa'));var jayson=require(_0x2dfc('0xb'));var client=jayson[_0x2dfc('0xc')]['http']({'port':0x232a});config[_0x2dfc('0xd')]=_[_0x2dfc('0xe')](config[_0x2dfc('0xd')],{'host':_0x2dfc('0xf'),'port':0x18eb});var socket=require(_0x2dfc('0x10'))(new Redis(config[_0x2dfc('0xd')]));require('./voiceQueue.socket')[_0x2dfc('0x11')](socket);function respondWithRpcPromise(_0x1b5e01,_0xa4fc51,_0x497f8d){return new BPromise(function(_0x30ee98,_0x320751){return client[_0x2dfc('0x12')](_0x1b5e01,_0x497f8d)[_0x2dfc('0x13')](function(_0x3e59d5){logger[_0x2dfc('0x14')](_0x2dfc('0x15'),_0xa4fc51,_0x2dfc('0x16'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xa4fc51,'request\x20sent',JSON[_0x2dfc('0x17')](_0x3e59d5));if(_0x3e59d5['error']){if(_0x3e59d5[_0x2dfc('0x18')]['code']===0x1f4){logger[_0x2dfc('0x18')](_0x2dfc('0x15'),_0xa4fc51,_0x3e59d5[_0x2dfc('0x18')][_0x2dfc('0x19')]);return _0x320751(_0x3e59d5[_0x2dfc('0x18')]['message']);}logger[_0x2dfc('0x18')](_0x2dfc('0x15'),_0xa4fc51,_0x3e59d5[_0x2dfc('0x18')][_0x2dfc('0x19')]);return _0x30ee98(_0x3e59d5['error']['message']);}else{logger[_0x2dfc('0x14')]('VoiceQueue,\x20%s,\x20%s',_0xa4fc51,'request\x20sent');_0x30ee98(_0x3e59d5[_0x2dfc('0x1a')][_0x2dfc('0x19')]);}})[_0x2dfc('0x1b')](function(_0x2965e9){logger[_0x2dfc('0x18')](_0x2dfc('0x15'),_0xa4fc51,_0x2965e9);_0x320751(_0x2965e9);});});}exports[_0x2dfc('0x1c')]=function(_0x52973f){var _0xc3b86f=this;return new Promise(function(_0x1e9936,_0x5d64a8){return db[_0x2dfc('0x1d')][_0x2dfc('0x1e')]({'raw':_0x52973f[_0x2dfc('0x1f')]?_0x52973f['options'][_0x2dfc('0x20')]===undefined?!![]:![]:!![],'where':_0x52973f[_0x2dfc('0x1f')]?_0x52973f['options'][_0x2dfc('0x21')]||null:null,'attributes':_0x52973f[_0x2dfc('0x1f')]?_0x52973f[_0x2dfc('0x1f')]['attributes']||null:null,'limit':_0x52973f[_0x2dfc('0x1f')]?_0x52973f[_0x2dfc('0x1f')][_0x2dfc('0x22')]||null:null,'include':_0x52973f[_0x2dfc('0x1f')]?_0x52973f[_0x2dfc('0x1f')][_0x2dfc('0x23')]?_[_0x2dfc('0x24')](_0x52973f[_0x2dfc('0x1f')][_0x2dfc('0x23')],function(_0x18bd2c){return{'model':db[_0x18bd2c['model']],'as':_0x18bd2c['as'],'attributes':_0x18bd2c[_0x2dfc('0x25')],'include':_0x18bd2c[_0x2dfc('0x23')]?_[_0x2dfc('0x24')](_0x18bd2c[_0x2dfc('0x23')],function(_0x431301){return{'model':db[_0x431301['model']],'as':_0x431301['as'],'attributes':_0x431301[_0x2dfc('0x25')],'include':_0x431301[_0x2dfc('0x23')]?_['map'](_0x431301[_0x2dfc('0x23')],function(_0x534f36){return{'model':db[_0x534f36['model']],'as':_0x534f36['as'],'attributes':_0x534f36[_0x2dfc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2dfc('0x13')](function(_0x5ea2c3){logger[_0x2dfc('0x14')]('GetVoiceQueue',_0x52973f);logger[_0x2dfc('0x26')](_0x2dfc('0x1c'),_0x52973f,JSON[_0x2dfc('0x17')](_0x5ea2c3));_0x1e9936(_0x5ea2c3);})[_0x2dfc('0x1b')](function(_0x336e1e){logger[_0x2dfc('0x18')](_0x2dfc('0x1c'),_0x336e1e[_0x2dfc('0x19')],_0x52973f);_0x5d64a8(_0xc3b86f[_0x2dfc('0x18')](0x1f4,_0x336e1e['message']));});});};exports[_0x2dfc('0x27')]=function(_0x33db38){var _0xa259cf=this;return new Promise(function(_0x3c380b,_0x43c1f3){return db['VoiceQueue'][_0x2dfc('0x28')]({'raw':_0x33db38[_0x2dfc('0x1f')]?_0x33db38[_0x2dfc('0x1f')][_0x2dfc('0x20')]===undefined?!![]:![]:!![],'where':_0x33db38[_0x2dfc('0x1f')]?_0x33db38['options']['where']||null:null,'attributes':_0x33db38[_0x2dfc('0x1f')]?_0x33db38[_0x2dfc('0x1f')]['attributes']||null:null,'include':_0x33db38[_0x2dfc('0x1f')]?_0x33db38[_0x2dfc('0x1f')][_0x2dfc('0x23')]?_[_0x2dfc('0x24')](_0x33db38[_0x2dfc('0x1f')]['include'],function(_0x38d759){return{'model':db[_0x38d759['model']],'as':_0x38d759['as'],'attributes':_0x38d759['attributes'],'include':_0x38d759[_0x2dfc('0x23')]?_['map'](_0x38d759[_0x2dfc('0x23')],function(_0x3cd7b9){return{'model':db[_0x3cd7b9[_0x2dfc('0x29')]],'as':_0x3cd7b9['as'],'attributes':_0x3cd7b9[_0x2dfc('0x25')],'include':_0x3cd7b9[_0x2dfc('0x23')]?_[_0x2dfc('0x24')](_0x3cd7b9[_0x2dfc('0x23')],function(_0x4a6f43){return{'model':db[_0x4a6f43['model']],'as':_0x4a6f43['as'],'attributes':_0x4a6f43[_0x2dfc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2dfc('0x13')](function(_0x4dfd6f){logger['info'](_0x2dfc('0x27'),_0x33db38);logger['debug']('ShowVoiceQueue',_0x33db38,JSON['stringify'](_0x4dfd6f));_0x3c380b(_0x4dfd6f);})[_0x2dfc('0x1b')](function(_0x36d3cf){logger['error']('ShowVoiceQueue',_0x36d3cf['message'],_0x33db38);_0x43c1f3(_0xa259cf[_0x2dfc('0x18')](0x1f4,_0x36d3cf['message']));});});}; \ No newline at end of file +var _0x9304=['options','where','attributes','include','model','map','stringify','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueue'];(function(_0x227ca6,_0x3fdf76){var _0x8b653f=function(_0x464845){while(--_0x464845){_0x227ca6['push'](_0x227ca6['shift']());}};_0x8b653f(++_0x3fdf76);}(_0x9304,0xb9));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require(_0x4930('0x1'));var moment=require('moment');var BPromise=require(_0x4930('0x2'));var rs=require(_0x4930('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4930('0x4'));var logger=require(_0x4930('0x5'))('rpc');var config=require(_0x4930('0x6'));var jayson=require(_0x4930('0x7'));var client=jayson[_0x4930('0x8')][_0x4930('0x9')]({'port':0x232a});config[_0x4930('0xa')]=_[_0x4930('0xb')](config[_0x4930('0xa')],{'host':_0x4930('0xc'),'port':0x18eb});var socket=require(_0x4930('0xd'))(new Redis(config[_0x4930('0xa')]));require('./voiceQueue.socket')[_0x4930('0xe')](socket);function respondWithRpcPromise(_0x5e2fe5,_0xe6b97f,_0x4222f5){return new BPromise(function(_0x3efa7f,_0x18e121){return client[_0x4930('0xf')](_0x5e2fe5,_0x4222f5)[_0x4930('0x10')](function(_0x1d153c){logger[_0x4930('0x11')](_0x4930('0x12'),_0xe6b97f,'request\x20sent');logger[_0x4930('0x13')](_0x4930('0x14'),_0xe6b97f,'request\x20sent',JSON['stringify'](_0x1d153c));if(_0x1d153c[_0x4930('0x15')]){if(_0x1d153c[_0x4930('0x15')]['code']===0x1f4){logger[_0x4930('0x15')](_0x4930('0x12'),_0xe6b97f,_0x1d153c[_0x4930('0x15')][_0x4930('0x16')]);return _0x18e121(_0x1d153c[_0x4930('0x15')][_0x4930('0x16')]);}logger[_0x4930('0x15')]('VoiceQueue,\x20%s,\x20%s',_0xe6b97f,_0x1d153c[_0x4930('0x15')][_0x4930('0x16')]);return _0x3efa7f(_0x1d153c['error']['message']);}else{logger[_0x4930('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xe6b97f,'request\x20sent');_0x3efa7f(_0x1d153c['result'][_0x4930('0x16')]);}})[_0x4930('0x17')](function(_0x2bfd8c){logger['error'](_0x4930('0x12'),_0xe6b97f,_0x2bfd8c);_0x18e121(_0x2bfd8c);});});}exports[_0x4930('0x18')]=function(_0x5c835d){var _0x2b86ba=this;return new Promise(function(_0x432b31,_0x1d2ea1){return db['VoiceQueue']['findAll']({'raw':_0x5c835d[_0x4930('0x19')]?_0x5c835d[_0x4930('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5c835d[_0x4930('0x19')]?_0x5c835d[_0x4930('0x19')][_0x4930('0x1a')]||null:null,'attributes':_0x5c835d[_0x4930('0x19')]?_0x5c835d[_0x4930('0x19')][_0x4930('0x1b')]||null:null,'limit':_0x5c835d[_0x4930('0x19')]?_0x5c835d['options']['limit']||null:null,'include':_0x5c835d[_0x4930('0x19')]?_0x5c835d[_0x4930('0x19')][_0x4930('0x1c')]?_['map'](_0x5c835d[_0x4930('0x19')]['include'],function(_0x3e8287){return{'model':db[_0x3e8287['model']],'as':_0x3e8287['as'],'attributes':_0x3e8287[_0x4930('0x1b')],'include':_0x3e8287[_0x4930('0x1c')]?_['map'](_0x3e8287[_0x4930('0x1c')],function(_0x5eb93c){return{'model':db[_0x5eb93c[_0x4930('0x1d')]],'as':_0x5eb93c['as'],'attributes':_0x5eb93c['attributes'],'include':_0x5eb93c['include']?_[_0x4930('0x1e')](_0x5eb93c['include'],function(_0x15a130){return{'model':db[_0x15a130[_0x4930('0x1d')]],'as':_0x15a130['as'],'attributes':_0x15a130[_0x4930('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38e2ec){logger[_0x4930('0x11')](_0x4930('0x18'),_0x5c835d);logger[_0x4930('0x13')]('GetVoiceQueue',_0x5c835d,JSON[_0x4930('0x1f')](_0x38e2ec));_0x432b31(_0x38e2ec);})['catch'](function(_0x42fe6c){logger[_0x4930('0x15')](_0x4930('0x18'),_0x42fe6c[_0x4930('0x16')],_0x5c835d);_0x1d2ea1(_0x2b86ba[_0x4930('0x15')](0x1f4,_0x42fe6c[_0x4930('0x16')]));});});};exports[_0x4930('0x20')]=function(_0x4bc201){var _0x12a6e6=this;return new Promise(function(_0x505ded,_0x2def7d){return db[_0x4930('0x21')][_0x4930('0x22')]({'raw':_0x4bc201['options']?_0x4bc201[_0x4930('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4bc201[_0x4930('0x19')]?_0x4bc201[_0x4930('0x19')][_0x4930('0x1a')]||null:null,'attributes':_0x4bc201[_0x4930('0x19')]?_0x4bc201[_0x4930('0x19')]['attributes']||null:null,'include':_0x4bc201[_0x4930('0x19')]?_0x4bc201['options'][_0x4930('0x1c')]?_[_0x4930('0x1e')](_0x4bc201['options'][_0x4930('0x1c')],function(_0xf15f12){return{'model':db[_0xf15f12[_0x4930('0x1d')]],'as':_0xf15f12['as'],'attributes':_0xf15f12[_0x4930('0x1b')],'include':_0xf15f12[_0x4930('0x1c')]?_['map'](_0xf15f12[_0x4930('0x1c')],function(_0x3b8759){return{'model':db[_0x3b8759[_0x4930('0x1d')]],'as':_0x3b8759['as'],'attributes':_0x3b8759[_0x4930('0x1b')],'include':_0x3b8759[_0x4930('0x1c')]?_[_0x4930('0x1e')](_0x3b8759[_0x4930('0x1c')],function(_0x3639a8){return{'model':db[_0x3639a8['model']],'as':_0x3639a8['as'],'attributes':_0x3639a8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec540){logger[_0x4930('0x11')](_0x4930('0x20'),_0x4bc201);logger[_0x4930('0x13')](_0x4930('0x20'),_0x4bc201,JSON[_0x4930('0x1f')](_0x2ec540));_0x505ded(_0x2ec540);})[_0x4930('0x17')](function(_0x2b0a7a){logger[_0x4930('0x15')]('ShowVoiceQueue',_0x2b0a7a[_0x4930('0x16')],_0x4bc201);_0x2def7d(_0x12a6e6[_0x4930('0x15')](0x1f4,_0x2b0a7a[_0x4930('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 68ac704..046267c 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 _0x421c=['remove','update','removeListener','length','./voiceQueue.events'];(function(_0x42628e,_0x239bee){var _0x73615a=function(_0x57779f){while(--_0x57779f){_0x42628e['push'](_0x42628e['shift']());}};_0x73615a(++_0x239bee);}(_0x421c,0x1c1));var _0xc421=function(_0x592c95,_0x371f18){_0x592c95=_0x592c95-0x0;var _0x380e55=_0x421c[_0x592c95];return _0x380e55;};'use strict';var VoiceQueueEvents=require(_0xc421('0x0'));var events=['save',_0xc421('0x1'),_0xc421('0x2')];function createListener(_0x44fe80,_0x4c90e3){return function(_0x4f6589){_0x4c90e3['emit'](_0x44fe80,_0x4f6589);};}function removeListener(_0x23a285,_0x21e3fa){return function(){VoiceQueueEvents[_0xc421('0x3')](_0x23a285,_0x21e3fa);};}exports['register']=function(_0x1a8fe1){for(var _0x3e3f7d=0x0,_0x54c098=events[_0xc421('0x4')];_0x3e3f7d<_0x54c098;_0x3e3f7d++){var _0x17d47e=events[_0x3e3f7d];var _0x432a1e=createListener('voiceQueue:'+_0x17d47e,_0x1a8fe1);VoiceQueueEvents['on'](_0x17d47e,_0x432a1e);}}; \ No newline at end of file +var _0x253c=['save','remove','update','emit','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x6d4c69,_0x13f29e){var _0xc2260=function(_0xedd20){while(--_0xedd20){_0x6d4c69['push'](_0x6d4c69['shift']());}};_0xc2260(++_0x13f29e);}(_0x253c,0x13f));var _0xc253=function(_0x284318,_0xd1ce42){_0x284318=_0x284318-0x0;var _0x2682f5=_0x253c[_0x284318];return _0x2682f5;};'use strict';var VoiceQueueEvents=require(_0xc253('0x0'));var events=[_0xc253('0x1'),_0xc253('0x2'),_0xc253('0x3')];function createListener(_0x145a1e,_0x3dd32f){return function(_0x210f35){_0x3dd32f[_0xc253('0x4')](_0x145a1e,_0x210f35);};}function removeListener(_0x36476f,_0x2b6f68){return function(){VoiceQueueEvents[_0xc253('0x5')](_0x36476f,_0x2b6f68);};}exports['register']=function(_0xfc59d7){for(var _0x10ef82=0x0,_0x52b88f=events[_0xc253('0x6')];_0x10ef82<_0x52b88f;_0x10ef82++){var _0x3c60c8=events[_0x10ef82];var _0x51ba94=createListener(_0xc253('0x7')+_0x3c60c8,_0xfc59d7);VoiceQueueEvents['on'](_0x3c60c8,_0x51ba94);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f8a03e7..eeeb781 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 _0xed1c=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x51beeb,_0x5d8902){var _0x13b2b5=function(_0x81b90e){while(--_0x81b90e){_0x51beeb['push'](_0x51beeb['shift']());}};_0x13b2b5(++_0x5d8902);}(_0xed1c,0xe4));var _0xced1=function(_0x2056c8,_0x2e0e62){_0x2056c8=_0x2056c8-0x0;var _0xb48caf=_0xed1c[_0x2056c8];return _0xb48caf;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xced1('0x2'));var interaction=require(_0xced1('0x3'));var config=require(_0xced1('0x4'));var controller=require('./voiceQueueReport.controller');router[_0xced1('0x5')]('/',auth[_0xced1('0x6')](),controller[_0xced1('0x7')]);router[_0xced1('0x5')]('/describe',auth[_0xced1('0x6')](),controller[_0xced1('0x8')]);router[_0xced1('0x5')](_0xced1('0x9'),auth[_0xced1('0x6')](),controller[_0xced1('0xa')]);router[_0xced1('0x5')](_0xced1('0xb'),auth['isAuthenticated'](),controller[_0xced1('0xc')]);router['post']('/',auth[_0xced1('0x6')](),controller[_0xced1('0xd')]);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x6')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')]('/:id',auth[_0xced1('0x6')](),controller[_0xced1('0x11')]);module[_0xced1('0x12')]=router; \ No newline at end of file +var _0x430c=['Router','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x53b16e,_0x3cd54d){var _0x1408f8=function(_0x2f8b45){while(--_0x2f8b45){_0x53b16e['push'](_0x53b16e['shift']());}};_0x1408f8(++_0x3cd54d);}(_0x430c,0x1a1));var _0xc430=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0x430c[_0x1757f2];return _0x5e7212;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xc430('0x4')]('/',auth[_0xc430('0x5')](),controller['index']);router[_0xc430('0x4')]('/describe',auth[_0xc430('0x5')](),controller[_0xc430('0x6')]);router[_0xc430('0x4')](_0xc430('0x7'),auth[_0xc430('0x5')](),controller[_0xc430('0x8')]);router[_0xc430('0x4')](_0xc430('0x9'),auth[_0xc430('0x5')](),controller['show']);router[_0xc430('0xa')]('/',auth[_0xc430('0x5')](),controller['create']);router[_0xc430('0xb')]('/:id',auth[_0xc430('0x5')](),controller['update']);router[_0xc430('0xc')](_0xc430('0x9'),auth[_0xc430('0x5')](),controller[_0xc430('0xd')]);module[_0xc430('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index c4f5ee0..c5aa98b 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 _0x2aa3=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER'];(function(_0x4f1748,_0x134303){var _0x2fe044=function(_0x23bd27){while(--_0x23bd27){_0x4f1748['push'](_0x4f1748['shift']());}};_0x2fe044(++_0x134303);}(_0x2aa3,0x83));var _0x32aa=function(_0x2653dc,_0xe54015){_0x2653dc=_0x2653dc-0x0;var _0x546d81=_0x2aa3[_0x2653dc];return _0x546d81;};'use strict';var Sequelize=require(_0x32aa('0x0'));var moment=require(_0x32aa('0x1'));module[_0x32aa('0x2')]={'type':{'type':Sequelize[_0x32aa('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x32aa('0x3')]},'queue':{'type':Sequelize[_0x32aa('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x32aa('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x32aa('0x4')],'set':function(_0x22e989){var _0x3d7c94=moment(_0x22e989);var _0x53ab98=moment(this[_0x32aa('0x5')](_0x32aa('0x6')))[_0x32aa('0x7')](_0x32aa('0x8'));var _0x18ded0=_0x3d7c94[_0x32aa('0x9')](_0x53ab98,_0x32aa('0xa'));this[_0x32aa('0xb')]('queuecallerleaveAt',_0x22e989);this[_0x32aa('0xb')]('holdtime',_0x18ded0||null);}},'position':{'type':Sequelize[_0x32aa('0xc')]},'count':{'type':Sequelize[_0x32aa('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x32aa('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x32aa('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x32aa('0x4')]},'queuecallerexit':{'type':Sequelize[_0x32aa('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x32aa('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x32aa('0xe')},'originalposition':{'type':Sequelize[_0x32aa('0xc')]},'channel':{'type':Sequelize[_0x32aa('0x3')]},'connectedlinenum':{'type':Sequelize[_0x32aa('0x3')]},'connectedlinename':{'type':Sequelize[_0x32aa('0x3')]},'accountcode':{'type':Sequelize[_0x32aa('0x3')]},'context':{'type':Sequelize[_0x32aa('0x3')]},'exten':{'type':Sequelize[_0x32aa('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x32aa('0xc')]},'mohtime':{'type':Sequelize[_0x32aa('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x32aa('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x32aa('0x3')]},'transfer':{'type':Sequelize[_0x32aa('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x32aa('0xf')},'transferexten':{'type':Sequelize[_0x32aa('0x3')]},'transferuniqueid':{'type':Sequelize[_0x32aa('0x3')]},'disposition':{'type':Sequelize[_0x32aa('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x32aa('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e16=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER'];(function(_0x378d18,_0x17362b){var _0x52d233=function(_0x24949a){while(--_0x24949a){_0x378d18['push'](_0x378d18['shift']());}};_0x52d233(++_0x17362b);}(_0x0e16,0x183));var _0x60e1=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x0e16[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x60e1('0x0'));var moment=require(_0x60e1('0x1'));module[_0x60e1('0x2')]={'type':{'type':Sequelize[_0x60e1('0x3')]},'uniqueid':{'type':Sequelize[_0x60e1('0x3')]},'calleridnum':{'type':Sequelize[_0x60e1('0x3')]},'calleridname':{'type':Sequelize[_0x60e1('0x3')]},'queue':{'type':Sequelize[_0x60e1('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x60e1('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x60e1('0x4')],'set':function(_0x41a3c6){var _0x3664e2=moment(_0x41a3c6);var _0x4c1471=moment(this[_0x60e1('0x5')]('queuecallerjoinAt'))[_0x60e1('0x6')](_0x60e1('0x7'));var _0xd750d2=_0x3664e2[_0x60e1('0x8')](_0x4c1471,_0x60e1('0x9'));this['setDataValue']('queuecallerleaveAt',_0x41a3c6);this[_0x60e1('0xa')](_0x60e1('0xb'),_0xd750d2||null);}},'position':{'type':Sequelize[_0x60e1('0xc')]},'count':{'type':Sequelize[_0x60e1('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x60e1('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x60e1('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x60e1('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x60e1('0x4')]},'queuecallerexit':{'type':Sequelize[_0x60e1('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x60e1('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x60e1('0x3')],'comment':_0x60e1('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x60e1('0x3')]},'connectedlinenum':{'type':Sequelize[_0x60e1('0x3')]},'connectedlinename':{'type':Sequelize[_0x60e1('0x3')]},'accountcode':{'type':Sequelize[_0x60e1('0x3')]},'context':{'type':Sequelize[_0x60e1('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x60e1('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x60e1('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x60e1('0x3')]},'transfer':{'type':Sequelize[_0x60e1('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x60e1('0xf')},'transferexten':{'type':Sequelize[_0x60e1('0x3')]},'transferuniqueid':{'type':Sequelize[_0x60e1('0x3')]},'disposition':{'type':Sequelize[_0x60e1('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x60e1('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5625cd5..b8d12b8 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x7a54,0x106));var _0x47a5=function(_0x32d9b5,_0x5e9ddf){_0x32d9b5=_0x32d9b5-0x0;var _0x16cb4c=_0x7a54[_0x32d9b5];return _0x16cb4c;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x7a54,0x106));var _0x47a5=function(_0x11875d,_0x375a39){_0x11875d=_0x11875d-0x0;var _0x9d3fb1=_0x7a54[_0x11875d];return _0x9d3fb1;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f6814c4..01c38a8 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 _0xf908=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x4f1ff1,_0x3fe992){var _0x21b8a7=function(_0x159627){while(--_0x159627){_0x4f1ff1['push'](_0x4f1ff1['shift']());}};_0x21b8a7(++_0x3fe992);}(_0xf908,0x1bd));var _0x8f90=function(_0x494b94,_0x1363d3){_0x494b94=_0x494b94-0x0;var _0x257326=_0xf908[_0x494b94];return _0x257326;};'use strict';var EventEmitter=require(_0x8f90('0x0'));var VoiceQueueReport=require(_0x8f90('0x1'))['db'][_0x8f90('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8f90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f90('0x4'),'afterDestroy':_0x8f90('0x5')};function emitEvent(_0x8da7fa){return function(_0x55ac1e,_0x49e4a5,_0x8ae3bc){VoiceQueueReportEvents[_0x8f90('0x6')](_0x8da7fa+':'+_0x55ac1e['id'],_0x55ac1e);VoiceQueueReportEvents[_0x8f90('0x6')](_0x8da7fa,_0x55ac1e);_0x8ae3bc(null);};}for(var e in events){if(events[_0x8f90('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8f90('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb74e=['hook','exports','../../mysqldb','VoiceQueueReport','remove','emit','hasOwnProperty'];(function(_0x5d81c1,_0x759cb3){var _0x41ead2=function(_0x360680){while(--_0x360680){_0x5d81c1['push'](_0x5d81c1['shift']());}};_0x41ead2(++_0x759cb3);}(_0xb74e,0xe9));var _0xeb74=function(_0x5d73e3,_0x1a648d){_0x5d73e3=_0x5d73e3-0x0;var _0x4fba9c=_0xb74e[_0x5d73e3];return _0x4fba9c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xeb74('0x0'))['db'][_0xeb74('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeb74('0x2')};function emitEvent(_0x67c683){return function(_0x2d50b0,_0x4be1f3,_0x2082e3){VoiceQueueReportEvents[_0xeb74('0x3')](_0x67c683+':'+_0x2d50b0['id'],_0x2d50b0);VoiceQueueReportEvents['emit'](_0x67c683,_0x2d50b0);_0x2082e3(null);};}for(var e in events){if(events[_0xeb74('0x4')](e)){var event=events[e];VoiceQueueReport[_0xeb74('0x5')](e,emitEvent(event));}}module[_0xeb74('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 16f1184..346f41c 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 _0x6ad4=['VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xb94ff7,_0x46f8dc){var _0x5951de=function(_0x394fcf){while(--_0x394fcf){_0xb94ff7['push'](_0xb94ff7['shift']());}};_0x5951de(++_0x46f8dc);}(_0x6ad4,0x19e));var _0x46ad=function(_0x16ad3b,_0x3e409d){_0x16ad3b=_0x16ad3b-0x0;var _0x1b17a3=_0x6ad4[_0x16ad3b];return _0x1b17a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x46ad('0x0'))('api');var moment=require(_0x46ad('0x1'));var BPromise=require(_0x46ad('0x2'));var rp=require(_0x46ad('0x3'));var fs=require('fs');var path=require(_0x46ad('0x4'));var rimraf=require('rimraf');var config=require(_0x46ad('0x5'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x45af8c,_0x1b7c10){return _0x45af8c['define'](_0x46ad('0x6'),attributes,{'tableName':_0x46ad('0x7'),'paranoid':![],'indexes':[{'fields':[_0x46ad('0x8')]},{'fields':[_0x46ad('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7297=['moment','path','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x207d64,_0x578268){var _0x129a06=function(_0x3f66d9){while(--_0x3f66d9){_0x207d64['push'](_0x207d64['shift']());}};_0x129a06(++_0x578268);}(_0x7297,0xb8));var _0x7729=function(_0x1566a8,_0x1c71e4){_0x1566a8=_0x1566a8-0x0;var _0x88e2f5=_0x7297[_0x1566a8];return _0x88e2f5;};'use strict';var _=require(_0x7729('0x0'));var util=require(_0x7729('0x1'));var logger=require(_0x7729('0x2'))('api');var moment=require(_0x7729('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7729('0x4'));var rimraf=require('rimraf');var config=require(_0x7729('0x5'));var attributes=require(_0x7729('0x6'));module['exports']=function(_0x10277a,_0xc39eab){return _0x10277a[_0x7729('0x7')](_0x7729('0x8'),attributes,{'tableName':_0x7729('0x9'),'paranoid':![],'indexes':[{'fields':[_0x7729('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9ac2c10..3d89c71 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 _0xa3c4=['client','http','redis','defaults','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','attributes','map','include','model','info','debug','CreateVoiceQueueReport','create','raw','VoiceQueueReport','update','body','where','limit','UpdateVoiceQueueReport','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49eb58,_0x4d34e6){var _0x2b81fe=function(_0x470dfd){while(--_0x470dfd){_0x49eb58['push'](_0x49eb58['shift']());}};_0x2b81fe(++_0x4d34e6);}(_0xa3c4,0x17b));var _0x4a3c=function(_0x53698e,_0x18ad17){_0x53698e=_0x53698e-0x0;var _0x58dbb4=_0xa3c4[_0x53698e];return _0x58dbb4;};'use strict';var _=require('lodash');var util=require(_0x4a3c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a3c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a3c('0x2'))['db'];var utils=require(_0x4a3c('0x3'));var logger=require(_0x4a3c('0x4'))(_0x4a3c('0x5'));var config=require(_0x4a3c('0x6'));var jayson=require(_0x4a3c('0x7'));var client=jayson[_0x4a3c('0x8')][_0x4a3c('0x9')]({'port':0x232a});config[_0x4a3c('0xa')]=_[_0x4a3c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4a3c('0xc'))[_0x4a3c('0xd')](socket);function respondWithRpcPromise(_0x526edf,_0x487adb,_0x244d79){return new BPromise(function(_0x19cc0c,_0xc92802){return client[_0x4a3c('0xe')](_0x526edf,_0x244d79)[_0x4a3c('0xf')](function(_0x4affdd){logger['info'](_0x4a3c('0x10'),_0x487adb,_0x4a3c('0x11'));logger['debug'](_0x4a3c('0x12'),_0x487adb,_0x4a3c('0x11'),JSON[_0x4a3c('0x13')](_0x4affdd));if(_0x4affdd[_0x4a3c('0x14')]){if(_0x4affdd[_0x4a3c('0x14')][_0x4a3c('0x15')]===0x1f4){logger[_0x4a3c('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x487adb,_0x4affdd[_0x4a3c('0x14')][_0x4a3c('0x16')]);return _0xc92802(_0x4affdd[_0x4a3c('0x14')]['message']);}logger[_0x4a3c('0x14')](_0x4a3c('0x10'),_0x487adb,_0x4affdd[_0x4a3c('0x14')][_0x4a3c('0x16')]);return _0x19cc0c(_0x4affdd[_0x4a3c('0x14')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x487adb,_0x4a3c('0x11'));_0x19cc0c(_0x4affdd[_0x4a3c('0x17')][_0x4a3c('0x16')]);}})[_0x4a3c('0x18')](function(_0x4d69ad){logger[_0x4a3c('0x14')](_0x4a3c('0x10'),_0x487adb,_0x4d69ad);_0xc92802(_0x4d69ad);});});}exports[_0x4a3c('0x19')]=function(_0x2815f5){var _0x577b1a=this;return new Promise(function(_0x5bbe89,_0xcf712f){return db['VoiceQueueReport'][_0x4a3c('0x1a')]({'raw':_0x2815f5[_0x4a3c('0x1b')]?_0x2815f5[_0x4a3c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2815f5['options']?_0x2815f5['options']['where']||null:null,'attributes':_0x2815f5[_0x4a3c('0x1b')]?_0x2815f5[_0x4a3c('0x1b')][_0x4a3c('0x1c')]||null:null,'limit':_0x2815f5[_0x4a3c('0x1b')]?_0x2815f5['options']['limit']||null:null,'include':_0x2815f5[_0x4a3c('0x1b')]?_0x2815f5[_0x4a3c('0x1b')]['include']?_[_0x4a3c('0x1d')](_0x2815f5[_0x4a3c('0x1b')][_0x4a3c('0x1e')],function(_0x51f533){return{'model':db[_0x51f533[_0x4a3c('0x1f')]],'as':_0x51f533['as'],'attributes':_0x51f533[_0x4a3c('0x1c')],'include':_0x51f533['include']?_['map'](_0x51f533[_0x4a3c('0x1e')],function(_0x43ac06){return{'model':db[_0x43ac06[_0x4a3c('0x1f')]],'as':_0x43ac06['as'],'attributes':_0x43ac06[_0x4a3c('0x1c')],'include':_0x43ac06[_0x4a3c('0x1e')]?_[_0x4a3c('0x1d')](_0x43ac06[_0x4a3c('0x1e')],function(_0x21a83f){return{'model':db[_0x21a83f[_0x4a3c('0x1f')]],'as':_0x21a83f['as'],'attributes':_0x21a83f[_0x4a3c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a3c('0xf')](function(_0x3206ef){logger[_0x4a3c('0x20')]('GetVoiceQueueReport',_0x2815f5);logger[_0x4a3c('0x21')](_0x4a3c('0x19'),_0x2815f5,JSON[_0x4a3c('0x13')](_0x3206ef));_0x5bbe89(_0x3206ef);})['catch'](function(_0x250558){logger[_0x4a3c('0x14')](_0x4a3c('0x19'),_0x250558[_0x4a3c('0x16')],_0x2815f5);_0xcf712f(_0x577b1a['error'](0x1f4,_0x250558[_0x4a3c('0x16')]));});});};exports[_0x4a3c('0x22')]=function(_0x291b70){var _0xc543be=this;return new Promise(function(_0x19483e,_0x29b41f){return db['VoiceQueueReport'][_0x4a3c('0x23')](_0x291b70['body'],{'raw':_0x291b70[_0x4a3c('0x1b')]?_0x291b70[_0x4a3c('0x1b')][_0x4a3c('0x24')]===undefined?!![]:![]:!![]})[_0x4a3c('0xf')](function(_0x3b03c6){logger[_0x4a3c('0x20')](_0x4a3c('0x22'),_0x291b70);logger[_0x4a3c('0x21')]('CreateVoiceQueueReport',_0x291b70,JSON[_0x4a3c('0x13')](_0x3b03c6));_0x19483e(_0x3b03c6);})[_0x4a3c('0x18')](function(_0x4ed77e){logger['error'](_0x4a3c('0x22'),_0x4ed77e[_0x4a3c('0x16')],_0x291b70);_0x29b41f(_0xc543be['error'](0x1f4,_0x4ed77e[_0x4a3c('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x599f2d){var _0x142caa=this;return new Promise(function(_0x596f45,_0x3b4c2c){return db[_0x4a3c('0x25')][_0x4a3c('0x26')](_0x599f2d[_0x4a3c('0x27')],{'raw':_0x599f2d['options']?_0x599f2d[_0x4a3c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599f2d[_0x4a3c('0x1b')]?_0x599f2d[_0x4a3c('0x1b')][_0x4a3c('0x28')]||null:null,'attributes':_0x599f2d[_0x4a3c('0x1b')]?_0x599f2d[_0x4a3c('0x1b')][_0x4a3c('0x1c')]||null:null,'limit':_0x599f2d[_0x4a3c('0x1b')]?_0x599f2d[_0x4a3c('0x1b')][_0x4a3c('0x29')]||null:null})[_0x4a3c('0xf')](function(_0x4bae28){logger['info'](_0x4a3c('0x2a'),_0x599f2d);logger[_0x4a3c('0x21')](_0x4a3c('0x2a'),_0x599f2d,JSON['stringify'](_0x4bae28));_0x596f45(_0x4bae28);})['catch'](function(_0x38c80c){logger[_0x4a3c('0x14')](_0x4a3c('0x2a'),_0x38c80c[_0x4a3c('0x16')],_0x599f2d);_0x3b4c2c(_0x142caa[_0x4a3c('0x14')](0x1f4,_0x38c80c['message']));});});}; \ No newline at end of file +var _0x237f=['limit','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','stringify','CreateVoiceQueueReport','create','catch','UpdateVoiceQueueReport','update'];(function(_0x12ee20,_0xe48b32){var _0x1e5909=function(_0x434de3){while(--_0x434de3){_0x12ee20['push'](_0x12ee20['shift']());}};_0x1e5909(++_0xe48b32);}(_0x237f,0x141));var _0xf237=function(_0x308f79,_0x121c42){_0x308f79=_0x308f79-0x0;var _0x71490e=_0x237f[_0x308f79];return _0x71490e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf237('0x0'));var BPromise=require('bluebird');var rs=require(_0xf237('0x1'));var fs=require('fs');var Redis=require(_0xf237('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf237('0x3'));var logger=require(_0xf237('0x4'))(_0xf237('0x5'));var config=require('../../config/environment');var jayson=require(_0xf237('0x6'));var client=jayson[_0xf237('0x7')][_0xf237('0x8')]({'port':0x232a});config['redis']=_[_0xf237('0x9')](config[_0xf237('0xa')],{'host':_0xf237('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf237('0xc'))['register'](socket);function respondWithRpcPromise(_0x39d569,_0x1fd5e0,_0x4450d6){return new BPromise(function(_0x10f2c9,_0x3d1149){return client['request'](_0x39d569,_0x4450d6)[_0xf237('0xd')](function(_0x41e5c8){logger[_0xf237('0xe')](_0xf237('0xf'),_0x1fd5e0,'request\x20sent');logger[_0xf237('0x10')](_0xf237('0x11'),_0x1fd5e0,_0xf237('0x12'),JSON['stringify'](_0x41e5c8));if(_0x41e5c8[_0xf237('0x13')]){if(_0x41e5c8[_0xf237('0x13')][_0xf237('0x14')]===0x1f4){logger[_0xf237('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x1fd5e0,_0x41e5c8[_0xf237('0x13')][_0xf237('0x15')]);return _0x3d1149(_0x41e5c8[_0xf237('0x13')][_0xf237('0x15')]);}logger[_0xf237('0x13')](_0xf237('0xf'),_0x1fd5e0,_0x41e5c8['error'][_0xf237('0x15')]);return _0x10f2c9(_0x41e5c8[_0xf237('0x13')][_0xf237('0x15')]);}else{logger[_0xf237('0xe')](_0xf237('0xf'),_0x1fd5e0,'request\x20sent');_0x10f2c9(_0x41e5c8[_0xf237('0x16')][_0xf237('0x15')]);}})['catch'](function(_0x6603ed){logger['error'](_0xf237('0xf'),_0x1fd5e0,_0x6603ed);_0x3d1149(_0x6603ed);});});}exports[_0xf237('0x17')]=function(_0x1776de){var _0x3c8705=this;return new Promise(function(_0x20791e,_0x438c93){return db[_0xf237('0x18')][_0xf237('0x19')]({'raw':_0x1776de['options']?_0x1776de[_0xf237('0x1a')][_0xf237('0x1b')]===undefined?!![]:![]:!![],'where':_0x1776de[_0xf237('0x1a')]?_0x1776de['options'][_0xf237('0x1c')]||null:null,'attributes':_0x1776de['options']?_0x1776de['options'][_0xf237('0x1d')]||null:null,'limit':_0x1776de['options']?_0x1776de[_0xf237('0x1a')]['limit']||null:null,'include':_0x1776de[_0xf237('0x1a')]?_0x1776de[_0xf237('0x1a')][_0xf237('0x1e')]?_[_0xf237('0x1f')](_0x1776de[_0xf237('0x1a')][_0xf237('0x1e')],function(_0x39c701){return{'model':db[_0x39c701[_0xf237('0x20')]],'as':_0x39c701['as'],'attributes':_0x39c701[_0xf237('0x1d')],'include':_0x39c701[_0xf237('0x1e')]?_[_0xf237('0x1f')](_0x39c701[_0xf237('0x1e')],function(_0x13eb30){return{'model':db[_0x13eb30[_0xf237('0x20')]],'as':_0x13eb30['as'],'attributes':_0x13eb30[_0xf237('0x1d')],'include':_0x13eb30[_0xf237('0x1e')]?_[_0xf237('0x1f')](_0x13eb30[_0xf237('0x1e')],function(_0x24384f){return{'model':db[_0x24384f[_0xf237('0x20')]],'as':_0x24384f['as'],'attributes':_0x24384f[_0xf237('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x500c6a){logger['info']('GetVoiceQueueReport',_0x1776de);logger[_0xf237('0x10')](_0xf237('0x17'),_0x1776de,JSON[_0xf237('0x21')](_0x500c6a));_0x20791e(_0x500c6a);})['catch'](function(_0x49ba66){logger[_0xf237('0x13')](_0xf237('0x17'),_0x49ba66['message'],_0x1776de);_0x438c93(_0x3c8705['error'](0x1f4,_0x49ba66['message']));});});};exports[_0xf237('0x22')]=function(_0x43aca5){var _0x48c2f3=this;return new Promise(function(_0xaf649c,_0xf778c8){return db[_0xf237('0x18')][_0xf237('0x23')](_0x43aca5['body'],{'raw':_0x43aca5[_0xf237('0x1a')]?_0x43aca5['options'][_0xf237('0x1b')]===undefined?!![]:![]:!![]})[_0xf237('0xd')](function(_0x11bc38){logger['info'](_0xf237('0x22'),_0x43aca5);logger[_0xf237('0x10')]('CreateVoiceQueueReport',_0x43aca5,JSON[_0xf237('0x21')](_0x11bc38));_0xaf649c(_0x11bc38);})[_0xf237('0x24')](function(_0x2ae68b){logger[_0xf237('0x13')]('CreateVoiceQueueReport',_0x2ae68b[_0xf237('0x15')],_0x43aca5);_0xf778c8(_0x48c2f3['error'](0x1f4,_0x2ae68b['message']));});});};exports[_0xf237('0x25')]=function(_0x2acd65){var _0x5a0bba=this;return new Promise(function(_0x22b075,_0x3ee674){return db[_0xf237('0x18')][_0xf237('0x26')](_0x2acd65['body'],{'raw':_0x2acd65['options']?_0x2acd65[_0xf237('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acd65[_0xf237('0x1a')]?_0x2acd65['options'][_0xf237('0x1c')]||null:null,'attributes':_0x2acd65[_0xf237('0x1a')]?_0x2acd65[_0xf237('0x1a')]['attributes']||null:null,'limit':_0x2acd65['options']?_0x2acd65[_0xf237('0x1a')][_0xf237('0x27')]||null:null})['then'](function(_0x49d036){logger[_0xf237('0xe')](_0xf237('0x25'),_0x2acd65);logger['debug']('UpdateVoiceQueueReport',_0x2acd65,JSON['stringify'](_0x49d036));_0x22b075(_0x49d036);})[_0xf237('0x24')](function(_0x2e61db){logger[_0xf237('0x13')](_0xf237('0x25'),_0x2e61db[_0xf237('0x15')],_0x2acd65);_0x3ee674(_0x5a0bba[_0xf237('0x13')](0x1f4,_0x2e61db['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b628857..a61f209 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 _0x1f93=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x48ba32,_0x49f353){var _0x1619b7=function(_0x356d6e){while(--_0x356d6e){_0x48ba32['push'](_0x48ba32['shift']());}};_0x1619b7(++_0x49f353);}(_0x1f93,0x118));var _0x31f9=function(_0x4c7db1,_0x5bf167){_0x4c7db1=_0x4c7db1-0x0;var _0x2d6282=_0x1f93[_0x4c7db1];return _0x2d6282;};'use strict';var VoiceQueueReportEvents=require(_0x31f9('0x0'));var events=[_0x31f9('0x1'),_0x31f9('0x2'),_0x31f9('0x3')];function createListener(_0x2852bf,_0x26eb87){return function(_0x3c93af){_0x26eb87[_0x31f9('0x4')](_0x2852bf,_0x3c93af);};}function removeListener(_0x11be65,_0x4c44b7){return function(){VoiceQueueReportEvents[_0x31f9('0x5')](_0x11be65,_0x4c44b7);};}exports[_0x31f9('0x6')]=function(_0x52d35b){for(var _0x3277e1=0x0,_0x312fc1=events[_0x31f9('0x7')];_0x3277e1<_0x312fc1;_0x3277e1++){var _0x2b839a=events[_0x3277e1];var _0x16cff0=createListener(_0x31f9('0x8')+_0x2b839a,_0x52d35b);VoiceQueueReportEvents['on'](_0x2b839a,_0x16cff0);}}; \ No newline at end of file +var _0xcd10=['update','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x5b9885,_0x2f4072){var _0x23aa2a=function(_0x563ce1){while(--_0x563ce1){_0x5b9885['push'](_0x5b9885['shift']());}};_0x23aa2a(++_0x2f4072);}(_0xcd10,0x155));var _0x0cd1=function(_0x1c563b,_0x81e48f){_0x1c563b=_0x1c563b-0x0;var _0xabfa64=_0xcd10[_0x1c563b];return _0xabfa64;};'use strict';var VoiceQueueReportEvents=require(_0x0cd1('0x0'));var events=[_0x0cd1('0x1'),'remove',_0x0cd1('0x2')];function createListener(_0x402451,_0x93a7a9){return function(_0x3fc68a){_0x93a7a9['emit'](_0x402451,_0x3fc68a);};}function removeListener(_0x2365b2,_0x5d3672){return function(){VoiceQueueReportEvents[_0x0cd1('0x3')](_0x2365b2,_0x5d3672);};}exports[_0x0cd1('0x4')]=function(_0x455605){for(var _0x4706ac=0x0,_0x26bf63=events[_0x0cd1('0x5')];_0x4706ac<_0x26bf63;_0x4706ac++){var _0x23d983=events[_0x4706ac];var _0x3b2c2a=createListener(_0x0cd1('0x6')+_0x23d983,_0x455605);VoiceQueueReportEvents['on'](_0x23d983,_0x3b2c2a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7a9d750..ee2da35 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 _0x5973=['get','isAuthenticated','index','show','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x4259ab,_0x4c2bdc){var _0x593a39=function(_0x44843a){while(--_0x44843a){_0x4259ab['push'](_0x4259ab['shift']());}};_0x593a39(++_0x4c2bdc);}(_0x5973,0x1e4));var _0x3597=function(_0x28e7ad,_0x304787){_0x28e7ad=_0x28e7ad-0x0;var _0x111aeb=_0x5973[_0x28e7ad];return _0x111aeb;};'use strict';var multer=require(_0x3597('0x0'));var util=require(_0x3597('0x1'));var path=require(_0x3597('0x2'));var timeout=require(_0x3597('0x3'));var express=require(_0x3597('0x4'));var router=express[_0x3597('0x5')]();var auth=require(_0x3597('0x6'));var interaction=require(_0x3597('0x7'));var config=require(_0x3597('0x8'));var controller=require(_0x3597('0x9'));router[_0x3597('0xa')]('/',auth[_0x3597('0xb')](),controller[_0x3597('0xc')]);router[_0x3597('0xa')]('/:id',auth[_0x3597('0xb')](),controller[_0x3597('0xd')]);router['post']('/',auth[_0x3597('0xb')](),controller[_0x3597('0xe')]);router[_0x3597('0xf')](_0x3597('0x10'),auth[_0x3597('0xb')](),controller[_0x3597('0x11')]);router['delete'](_0x3597('0x10'),auth[_0x3597('0xb')](),controller[_0x3597('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd830=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','create','put','/:id','update','delete','destroy','multer'];(function(_0x555552,_0x576279){var _0x5b280d=function(_0x2ef8ef){while(--_0x2ef8ef){_0x555552['push'](_0x555552['shift']());}};_0x5b280d(++_0x576279);}(_0xd830,0x1ca));var _0x0d83=function(_0x1a2df8,_0x1cf604){_0x1a2df8=_0x1a2df8-0x0;var _0x3d3679=_0xd830[_0x1a2df8];return _0x3d3679;};'use strict';var multer=require(_0x0d83('0x0'));var util=require(_0x0d83('0x1'));var path=require('path');var timeout=require(_0x0d83('0x2'));var express=require(_0x0d83('0x3'));var router=express[_0x0d83('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d83('0x5'));var config=require(_0x0d83('0x6'));var controller=require(_0x0d83('0x7'));router[_0x0d83('0x8')]('/',auth['isAuthenticated'](),controller[_0x0d83('0x9')]);router[_0x0d83('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0d83('0xa')](),controller[_0x0d83('0xb')]);router[_0x0d83('0xc')](_0x0d83('0xd'),auth[_0x0d83('0xa')](),controller[_0x0d83('0xe')]);router[_0x0d83('0xf')](_0x0d83('0xd'),auth[_0x0d83('0xa')](),controller[_0x0d83('0x10')]);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 9507887..e5b8e74 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 _0xa312=['moment','STRING','DATE'];(function(_0x23b2ea,_0x50ae6f){var _0x5b0503=function(_0x332a68){while(--_0x332a68){_0x23b2ea['push'](_0x23b2ea['shift']());}};_0x5b0503(++_0x50ae6f);}(_0xa312,0x159));var _0x2a31=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0xa312[_0x5b1c50];return _0x2d379b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a31('0x0'));module['exports']={'time':{'type':Sequelize[_0x2a31('0x1')]},'callid':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2a31('0x2')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xf5eb=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xf5eb,0x171));var _0xbf5e=function(_0x1c6126,_0x278b38){_0x1c6126=_0x1c6126-0x0;var _0x4a375f=_0xf5eb[_0x1c6126];return _0x4a375f;};'use strict';var Sequelize=require(_0xbf5e('0x0'));var moment=require(_0xbf5e('0x1'));module['exports']={'time':{'type':Sequelize[_0xbf5e('0x2')]},'callid':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xbf5e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbf5e('0x3')],'allowNull':![],'defaultValue':moment()[_0xbf5e('0x4')](_0xbf5e('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 865e2f9..b8c4fde 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(_0x30fa96,_0x475786){var _0x3e76d4=function(_0x5a15e7){while(--_0x5a15e7){_0x30fa96['push'](_0x30fa96['shift']());}};_0x3e76d4(++_0x475786);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c50e4,_0x15cd2f){_0x2c50e4=_0x2c50e4-0x0;var _0x474118=_0xb10b[_0x2c50e4];return _0x474118;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x2ac632,_0x1683fe){var _0x3d5699=function(_0x47096c){while(--_0x47096c){_0x2ac632['push'](_0x2ac632['shift']());}};_0x3d5699(++_0x1683fe);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ab5bd,_0x56fbcf){_0x3ab5bd=_0x3ab5bd-0x0;var _0xe4109d=_0xb10b[_0x3ab5bd];return _0xe4109d;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6f50790..79471f2 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api'];(function(_0x227949,_0x1e9bdc){var _0x44d431=function(_0x4e12ea){while(--_0x4e12ea){_0x227949['push'](_0x227949['shift']());}};_0x44d431(++_0x1e9bdc);}(_0xfcf0,0x138));var _0x0fcf=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0xfcf0[_0x17e771];return _0x1f3a6d;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x33af=['moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x33af,0xec));var _0xf33a=function(_0x4ac31f,_0x3bf843){_0x4ac31f=_0x4ac31f-0x0;var _0x1f1926=_0x33af[_0x4ac31f];return _0x1f1926;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3a95bcb..8e38635 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 _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb03e,0x1eb));var _0xeb03=function(_0xe1b85f,_0x1d0145){_0xe1b85f=_0xe1b85f-0x0;var _0x164659=_0xb03e[_0xe1b85f];return _0x164659;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file +var _0x6b24=['client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6b24,0x1ce));var _0x46b2=function(_0xe01d60,_0x340301){_0xe01d60=_0xe01d60-0x0;var _0x46d858=_0x6b24[_0xe01d60];return _0x46d858;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512905,_0x326eb7,_0x233ccf){return new BPromise(function(_0x1f81b8,_0x1531c){return client[_0x46b2('0x7')](_0x512905,_0x233ccf)[_0x46b2('0x8')](function(_0x3144df){logger[_0x46b2('0x9')](_0x46b2('0xa'),_0x326eb7,'request\x20sent');logger['debug'](_0x46b2('0xb'),_0x326eb7,_0x46b2('0xc'),JSON[_0x46b2('0xd')](_0x3144df));if(_0x3144df['error']){if(_0x3144df[_0x46b2('0xe')][_0x46b2('0xf')]===0x1f4){logger[_0x46b2('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1531c(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1f81b8(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}else{logger['info'](_0x46b2('0xa'),_0x326eb7,_0x46b2('0xc'));_0x1f81b8(_0x3144df['result'][_0x46b2('0x10')]);}})[_0x46b2('0x11')](function(_0xe3d3d9){logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0xe3d3d9);_0x1531c(_0xe3d3d9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8b62027..417ff76 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(_0x58bcb8,_0x57c63a){var _0x7a8167=function(_0x56a8cd){while(--_0x56a8cd){_0x58bcb8['push'](_0x58bcb8['shift']());}};_0x7a8167(++_0x57c63a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x5c4da1,_0x30b8be){var _0x4580fa=function(_0xf2ef30){while(--_0xf2ef30){_0x5c4da1['push'](_0x5c4da1['shift']());}};_0x4580fa(++_0x30b8be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 a87e98c..1faa782 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 _0xd259=['TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','toString','DATE','updatedAt','sequelize','getDataValue','extname','value','STRING','setDataValue','channel','membername','split'];(function(_0x8efd01,_0xa24ac){var _0xfe58bd=function(_0x386122){while(--_0x386122){_0x8efd01['push'](_0x8efd01['shift']());}};_0xfe58bd(++_0xa24ac);}(_0xd259,0xab));var _0x9d25=function(_0x3897af,_0x522f66){_0x3897af=_0x3897af-0x0;var _0x17918a=_0xd259[_0x3897af];return _0x17918a;};'use strict';var Sequelize=require(_0x9d25('0x0'));var moment=require('moment');var path=require('path');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9d25('0x1')]('value')?path[_0x9d25('0x2')](this[_0x9d25('0x1')](_0x9d25('0x3'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9d25('0x4')],'set':function(_0x18eb53){if(_0x18eb53){this[_0x9d25('0x5')](_0x9d25('0x6'),_0x18eb53);this['setDataValue'](_0x9d25('0x7'),_0x18eb53[_0x9d25('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9d25('0x4')]},'calleridnum':{'type':Sequelize[_0x9d25('0x4')]},'calleridname':{'type':Sequelize[_0x9d25('0x4')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9d25('0x4')]},'context':{'type':Sequelize[_0x9d25('0x4')]},'exten':{'type':Sequelize[_0x9d25('0x4')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9d25('0x4')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x9d25('0x4')]},'userDisposition':{'type':Sequelize[_0x9d25('0x4')]},'location':{'type':Sequelize[_0x9d25('0x9')]},'transcribeName':{'type':Sequelize[_0x9d25('0x4')]},'transcribeStatus':{'type':Sequelize[_0x9d25('0x4')],'defaultValue':_0x9d25('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x9d25('0x9')]},'failureReason':{'type':Sequelize[_0x9d25('0x9')]},'sentiment':{'type':Sequelize[_0x9d25('0x4')]},'sPositive':{'type':Sequelize[_0x9d25('0xb')]},'sNegative':{'type':Sequelize[_0x9d25('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x9d25('0xb')]},'tempSentiment':{'type':Sequelize[_0x9d25('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9d25('0xd')))[_0x9d25('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x9d25('0xf')]();}},'updatedAt':{'type':Sequelize[_0x9d25('0x10')],'get':function(){return moment(this['getDataValue'](_0x9d25('0x11')))[_0x9d25('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x1b78=['extname','STRING','setDataValue','membername','split','INTEGER','TEXT','FLOAT','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','path','exports','getDataValue','value'];(function(_0x5d6ff1,_0x34cda3){var _0x19b0ad=function(_0x285a5d){while(--_0x285a5d){_0x5d6ff1['push'](_0x5d6ff1['shift']());}};_0x19b0ad(++_0x34cda3);}(_0x1b78,0x72));var _0x81b7=function(_0x3c911e,_0x783ece){_0x3c911e=_0x3c911e-0x0;var _0x3add2e=_0x1b78[_0x3c911e];return _0x3add2e;};'use strict';var Sequelize=require(_0x81b7('0x0'));var moment=require(_0x81b7('0x1'));var path=require(_0x81b7('0x2'));module[_0x81b7('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x81b7('0x4')](_0x81b7('0x5'))?path[_0x81b7('0x6')](this['getDataValue'](_0x81b7('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x81b7('0x7')],'set':function(_0x36982d){if(_0x36982d){this['setDataValue']('channel',_0x36982d);this[_0x81b7('0x8')](_0x81b7('0x9'),_0x36982d[_0x81b7('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x81b7('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x81b7('0x7')]},'connectedlinename':{'type':Sequelize[_0x81b7('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x81b7('0x7')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x81b7('0x7')]},'type':{'type':Sequelize[_0x81b7('0x7')]},'rating':{'type':Sequelize[_0x81b7('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x81b7('0x7')]},'userDisposition':{'type':Sequelize[_0x81b7('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x81b7('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x81b7('0xc')]},'fileText':{'type':Sequelize[_0x81b7('0xc')]},'failureReason':{'type':Sequelize[_0x81b7('0xc')]},'sentiment':{'type':Sequelize[_0x81b7('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x81b7('0xd')]},'sMixed':{'type':Sequelize[_0x81b7('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x81b7('0xe')))[_0x81b7('0xf')](_0x81b7('0x10'))[_0x81b7('0x11')]();}},'updatedAt':{'type':Sequelize[_0x81b7('0x12')],'get':function(){return moment(this[_0x81b7('0x4')](_0x81b7('0x13')))['format'](_0x81b7('0x10'))[_0x81b7('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 5570052..dcd0531 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 _0xe2fb=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','update','body','describe','download','type','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','token','$and','push','decryptFile','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','query','filters','intersection'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe2fb,0xf3));var _0xbe2f=function(_0x1e97bd,_0x7b3a6d){_0x1e97bd=_0x1e97bd-0x0;var _0x472349=_0xe2fb[_0x1e97bd];return _0x472349;};'use strict';var pdf=require(_0xbe2f('0x0'));var emlformat=require(_0xbe2f('0x1'));var rimraf=require(_0xbe2f('0x2'));var zipdir=require(_0xbe2f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe2f('0x4'));var moment=require(_0xbe2f('0x5'));var BPromise=require(_0xbe2f('0x6'));var Mustache=require('mustache');var util=require(_0xbe2f('0x7'));var path=require(_0xbe2f('0x8'));var sox=require(_0xbe2f('0x9'));var csv=require('to-csv');var ejs=require(_0xbe2f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe2f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbe2f('0xc'));var toCsv=require(_0xbe2f('0xd'));var querystring=require(_0xbe2f('0xe'));var Papa=require(_0xbe2f('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0xbe2f('0x10'));var Redis=require(_0xbe2f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe2f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe2f('0x13'));var utils=require(_0xbe2f('0x14'));var config=require(_0xbe2f('0x15'));var db=require(_0xbe2f('0x16'))['db'];function respondWithStatusCode(_0x2c506f,_0x4b7452){_0x4b7452=_0x4b7452||0xcc;return function(_0x5a2c35){if(_0x5a2c35){return _0x2c506f[_0xbe2f('0x17')](_0x4b7452);}return _0x2c506f[_0xbe2f('0x18')](_0x4b7452)['end']();};}function respondWithResult(_0x25ff23,_0x356cf6){_0x356cf6=_0x356cf6||0xc8;return function(_0x5e139a){if(_0x5e139a){return _0x25ff23[_0xbe2f('0x18')](_0x356cf6)[_0xbe2f('0x19')](_0x5e139a);}};}function respondWithFilteredResult(_0x3b69ac,_0x1a39da){return function(_0x1706b9){if(_0x1706b9){var _0x545dc3=_0x1706b9[_0xbe2f('0x1a')],_0x59c135=_0x1a39da[_0xbe2f('0x1b')],_0x2ce10d=_0x1a39da[_0xbe2f('0x1b')]+_0x1a39da[_0xbe2f('0x1c')],_0x3d7fe8;if(_0x2ce10d>=_0x545dc3){_0x2ce10d=_0x545dc3;_0x3d7fe8=0xc8;}else{_0x3d7fe8=0xce;}_0x3b69ac[_0xbe2f('0x18')](_0x3d7fe8);return _0x3b69ac[_0xbe2f('0x1d')](_0xbe2f('0x1e'),_0x59c135+'-'+_0x2ce10d+'/'+_0x545dc3)[_0xbe2f('0x19')](_0x1706b9);}return null;};}function patchUpdates(_0x1da5fa){return function(_0x5448dc){try{jsonpatch[_0xbe2f('0x1f')](_0x5448dc,_0x1da5fa,!![]);}catch(_0x7fd9d6){return BPromise[_0xbe2f('0x20')](_0x7fd9d6);}return _0x5448dc[_0xbe2f('0x21')]();};}function saveUpdates(_0x370034,_0x12a225){return function(_0x5e1aa0){if(_0x5e1aa0){return _0x5e1aa0['update'](_0x370034)['then'](function(_0x38c832){return _0x38c832;});}return null;};}function removeEntity(_0x30d59e,_0xfbef49){return function(_0x2efdd1){if(_0x2efdd1){return _0x2efdd1[_0xbe2f('0x22')]()[_0xbe2f('0x23')](function(){_0x30d59e['status'](0xcc)[_0xbe2f('0x24')]();});}};}function handleEntityNotFound(_0x28e289,_0x5aee6d){return function(_0x2eb0f0){if(!_0x2eb0f0){_0x28e289[_0xbe2f('0x17')](0x194);}return _0x2eb0f0;};}function handleError(_0x434411,_0x5e0b88){_0x5e0b88=_0x5e0b88||0x1f4;return function(_0x488a71){logger['error'](_0x488a71[_0xbe2f('0x25')]);if(_0x488a71[_0xbe2f('0x26')]){delete _0x488a71[_0xbe2f('0x26')];}_0x434411[_0xbe2f('0x18')](_0x5e0b88)[_0xbe2f('0x27')](_0x488a71);};}exports[_0xbe2f('0x28')]=function(_0x3f65d4,_0x38ce09){var _0x47f22f={},_0x21b392={},_0x4d4a66={'count':0x0,'rows':[]};var _0x2ddfa8=_[_0xbe2f('0x29')](db[_0xbe2f('0x2a')][_0xbe2f('0x2b')],function(_0x49bca7){return{'name':_0x49bca7['fieldName'],'type':_0x49bca7['type'][_0xbe2f('0x2c')]};});_0x21b392[_0xbe2f('0x2d')]=_[_0xbe2f('0x2e')](_[_0xbe2f('0x29')](_0x2ddfa8,_0xbe2f('0x26')),[_0xbe2f('0x2f')]);_0x21b392[_0xbe2f('0x30')]=_['keys'](_0x3f65d4['query']);_0x21b392[_0xbe2f('0x31')]=_[_0xbe2f('0x32')](_0x21b392[_0xbe2f('0x2d')],_0x21b392[_0xbe2f('0x30')]);_0x47f22f[_0xbe2f('0x33')]=_[_0xbe2f('0x32')](_0x21b392[_0xbe2f('0x2d')],qs[_0xbe2f('0x34')](_0x3f65d4[_0xbe2f('0x30')][_0xbe2f('0x34')]));_0x47f22f['attributes']=_0x47f22f[_0xbe2f('0x33')][_0xbe2f('0x35')]?_0x47f22f[_0xbe2f('0x33')]:_0x21b392[_0xbe2f('0x2d')];if(!_0x3f65d4['query'][_0xbe2f('0x36')](_0xbe2f('0x37'))){_0x47f22f['limit']=qs[_0xbe2f('0x1c')](_0x3f65d4[_0xbe2f('0x30')][_0xbe2f('0x1c')]);_0x47f22f[_0xbe2f('0x1b')]=qs[_0xbe2f('0x1b')](_0x3f65d4[_0xbe2f('0x30')][_0xbe2f('0x1b')]);}_0x47f22f['order']=qs[_0xbe2f('0x38')](_0x3f65d4[_0xbe2f('0x30')][_0xbe2f('0x38')]);_0x47f22f[_0xbe2f('0x39')]=qs[_0xbe2f('0x31')](_[_0xbe2f('0x3a')](_0x3f65d4[_0xbe2f('0x30')],_0x21b392[_0xbe2f('0x31')]),_0x2ddfa8);if(_0x3f65d4['query']['filter']){_0x47f22f[_0xbe2f('0x39')]=_[_0xbe2f('0x3b')](_0x47f22f[_0xbe2f('0x39')],{'$or':_[_0xbe2f('0x29')](_0x2ddfa8,function(_0x3d9b34){if(_0x3d9b34['type']!==_0xbe2f('0x3c')){var _0x1840ee={};_0x1840ee[_0x3d9b34['name']]={'$like':'%'+_0x3f65d4[_0xbe2f('0x30')]['filter']+'%'};return _0x1840ee;}})});}_0x47f22f=_['merge']({},_0x47f22f,_0x3f65d4[_0xbe2f('0x3d')]);var _0x4e8709={'where':_0x47f22f[_0xbe2f('0x39')]};return db['VoiceRecording'][_0xbe2f('0x1a')](_0x4e8709)[_0xbe2f('0x23')](function(_0x40bb92){_0x4d4a66[_0xbe2f('0x1a')]=_0x40bb92;if(_0x3f65d4[_0xbe2f('0x30')][_0xbe2f('0x3e')]){_0x47f22f[_0xbe2f('0x3f')]=[{'all':!![]}];}return db[_0xbe2f('0x2a')]['findAll'](_0x47f22f);})['then'](function(_0x5101de){_0x4d4a66['rows']=_0x5101de;return _0x4d4a66;})['then'](respondWithFilteredResult(_0x38ce09,_0x47f22f))[_0xbe2f('0x40')](handleError(_0x38ce09,null));};exports[_0xbe2f('0x41')]=function(_0x5cbc03,_0x1b8f50){var _0x283c9d={'raw':![],'where':{'id':_0x5cbc03[_0xbe2f('0x42')]['id']}},_0x5b7215={};_0x5b7215[_0xbe2f('0x2d')]=_[_0xbe2f('0x43')](db[_0xbe2f('0x2a')]['rawAttributes']);_0x5b7215[_0xbe2f('0x30')]=_[_0xbe2f('0x43')](_0x5cbc03[_0xbe2f('0x30')]);_0x5b7215[_0xbe2f('0x31')]=_['intersection'](_0x5b7215['model'],_0x5b7215[_0xbe2f('0x30')]);_0x283c9d[_0xbe2f('0x33')]=_[_0xbe2f('0x32')](_0x5b7215['model'],qs[_0xbe2f('0x34')](_0x5cbc03['query'][_0xbe2f('0x34')]));_0x283c9d['attributes']=_0x283c9d[_0xbe2f('0x33')][_0xbe2f('0x35')]?_0x283c9d['attributes']:_0x5b7215[_0xbe2f('0x2d')];if(_0x5cbc03['query'][_0xbe2f('0x3e')]){_0x283c9d[_0xbe2f('0x3f')]=[{'all':!![]}];}_0x283c9d=_['merge']({},_0x283c9d,_0x5cbc03['options']);return db['VoiceRecording'][_0xbe2f('0x44')](_0x283c9d)[_0xbe2f('0x23')](handleEntityNotFound(_0x1b8f50,null))[_0xbe2f('0x23')](respondWithResult(_0x1b8f50,null))['catch'](handleError(_0x1b8f50,null));};exports[_0xbe2f('0x45')]=function(_0x433a07,_0x631aac){return db[_0xbe2f('0x2a')][_0xbe2f('0x45')](_0x433a07['body'],{})[_0xbe2f('0x23')](respondWithResult(_0x631aac,0xc9))[_0xbe2f('0x40')](handleError(_0x631aac,null));};exports[_0xbe2f('0x46')]=function(_0x35aa20,_0x13e564){if(_0x35aa20[_0xbe2f('0x47')]['id']){delete _0x35aa20['body']['id'];}return db[_0xbe2f('0x2a')][_0xbe2f('0x44')]({'where':{'id':_0x35aa20['params']['id']}})[_0xbe2f('0x23')](handleEntityNotFound(_0x13e564,null))[_0xbe2f('0x23')](saveUpdates(_0x35aa20[_0xbe2f('0x47')],null))[_0xbe2f('0x23')](respondWithResult(_0x13e564,null))[_0xbe2f('0x40')](handleError(_0x13e564,null));};exports[_0xbe2f('0x48')]=function(_0x1b17c7,_0x1590cb){return db['VoiceRecording']['describe']()[_0xbe2f('0x23')](respondWithResult(_0x1590cb,null))[_0xbe2f('0x40')](handleError(_0x1590cb,null));};exports[_0xbe2f('0x49')]=function(_0xfd885f,_0x285136,_0x64276c){var _0x15faf2=require('../../components/encryptor');var _0x54c2c8=![];var _0x215f5c={};if(_0xfd885f['query'][_0xbe2f('0x4a')]&&_0xfd885f[_0xbe2f('0x30')][_0xbe2f('0x4a')]===_0xbe2f('0x4b')){_0x215f5c[_0xbe2f('0x4b')]=_0xfd885f[_0xbe2f('0x42')]['id'];}else{_0x215f5c['id']=_0xfd885f[_0xbe2f('0x42')]['id'];}return db[_0xbe2f('0x2a')][_0xbe2f('0x44')]({'where':_0x215f5c,'attributes':['id',_0xbe2f('0x4c')],'raw':!![]})[_0xbe2f('0x23')](handleEntityNotFound(_0x285136,null))[_0xbe2f('0x23')](function(_0x39cc82){if(_0x39cc82){var _0x10ab46=_0x39cc82[_0xbe2f('0x4c')];var _0x1b002a=util['format'](_0xbe2f('0x4d'),_0x10ab46);if(fs[_0xbe2f('0x4e')](_0x1b002a)){_0x54c2c8=!![];return _0x15faf2['decryptFile'](_0x1b002a,_0x10ab46,config[_0xbe2f('0x4f')][_0xbe2f('0x50')])[_0xbe2f('0x23')](function(){return _0x39cc82;});}return _0x39cc82;}})[_0xbe2f('0x23')](function(_0x2eacdb){if(_0x2eacdb){var _0x3a16ac=_0x2eacdb[_0xbe2f('0x4c')];if(!fs[_0xbe2f('0x4e')](_0x3a16ac)){throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x53'));}if(_0x2eacdb[_0xbe2f('0x54')]){return _0x285136['download'](_0x3a16ac,_0x2eacdb[_0xbe2f('0x54')]+path[_0xbe2f('0x55')](_0x3a16ac),function(){if(_0x54c2c8){fs[_0xbe2f('0x56')](_0x3a16ac);}});}else{return _0x285136[_0xbe2f('0x49')](_0x3a16ac,function(_0x564347){if(_0x54c2c8){fs[_0xbe2f('0x56')](_0x3a16ac);}});}}})[_0xbe2f('0x40')](function(_0x2fedd4){if(_0x2fedd4[_0xbe2f('0x57')]===_0xbe2f('0x53')){_0x285136[_0xbe2f('0x18')](0x194)['send'](_0xbe2f('0x58'));}else{return handleError(_0x285136,null);}});};exports['downloads']=function(_0x1fad25,_0x37b3ad,_0x965f7c){var _0x2dee6a=require(_0xbe2f('0x59'));var _0x5218fa=![];var _0x126a4d={'$and':[db[_0xbe2f('0x5a')]['where'](db[_0xbe2f('0x5a')]['fn']('MD5',db[_0xbe2f('0x5a')]['col']('uniqueid')),_0x1fad25[_0xbe2f('0x30')][_0xbe2f('0x5b')])]};if(_0x1fad25['query'][_0xbe2f('0x4a')]&&_0x1fad25['query'][_0xbe2f('0x4a')]===_0xbe2f('0x4b')){_0x126a4d[_0xbe2f('0x5c')][_0xbe2f('0x5d')]({'uniqueid':_0x1fad25[_0xbe2f('0x42')]['id']});}else{_0x126a4d['$and'][_0xbe2f('0x5d')]({'id':_0x1fad25['params']['id']});}return db[_0xbe2f('0x2a')]['find']({'where':_0x126a4d,'attributes':['id',_0xbe2f('0x4c')],'raw':!![]})[_0xbe2f('0x23')](handleEntityNotFound(_0x37b3ad,null))[_0xbe2f('0x23')](function(_0x5a985a){if(_0x5a985a){var _0x56d71e=util[_0xbe2f('0x2f')]('%s.cypher',_0x5a985a['value']);if(fs[_0xbe2f('0x4e')](_0x56d71e)){_0x5218fa=!![];return _0x2dee6a[_0xbe2f('0x5e')](_0x56d71e,_0x5a985a[_0xbe2f('0x4c')],config[_0xbe2f('0x4f')][_0xbe2f('0x50')])[_0xbe2f('0x23')](function(){return _0x5a985a;});}return _0x5a985a;}})[_0xbe2f('0x23')](function(_0x24ede6){if(_0x24ede6){if(!fs[_0xbe2f('0x4e')](_0x24ede6[_0xbe2f('0x4c')])){throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x53'));}if(_0x24ede6[_0xbe2f('0x54')]){return _0x37b3ad[_0xbe2f('0x49')](_0x24ede6[_0xbe2f('0x4c')],_0x24ede6[_0xbe2f('0x54')]+path[_0xbe2f('0x55')](_0x24ede6[_0xbe2f('0x4c')]),function(){if(_0x5218fa){fs[_0xbe2f('0x56')](_0x24ede6[_0xbe2f('0x4c')]);}});}else{return _0x37b3ad[_0xbe2f('0x49')](_0x24ede6[_0xbe2f('0x4c')],function(_0xda8350){if(_0x5218fa){fs['unlink'](_0x24ede6[_0xbe2f('0x4c')]);}});}}})['catch'](handleError(_0x37b3ad,null));};exports[_0xbe2f('0x22')]=function(_0x573975,_0x43fe75){return db[_0xbe2f('0x2a')][_0xbe2f('0x44')]({'where':{'id':_0x573975['params']['id']}})[_0xbe2f('0x23')](function(_0x5d8bd8){if(!_0x5d8bd8)throw new ReferenceError(_0xbe2f('0x5f'));return _0x5d8bd8;})[_0xbe2f('0x23')](function(_0x2e6517){var _0x4ec1b2=_0x2e6517[_0xbe2f('0x4c')];logger[_0xbe2f('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x4ec1b2);if(!_[_0xbe2f('0x61')](_0x2e6517[_0xbe2f('0x4c')])&&fs[_0xbe2f('0x4e')](_0x4ec1b2)){logger[_0xbe2f('0x60')](_0xbe2f('0x62')+_0x4ec1b2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbe2f('0x63')](_0x4ec1b2);}_0x4ec1b2=_0x4ec1b2+_0xbe2f('0x64');if(!_[_0xbe2f('0x61')](_0x2e6517[_0xbe2f('0x4c')])&&fs['existsSync'](_0x4ec1b2)){logger['info']('File:\x20\x22'+_0x4ec1b2+_0xbe2f('0x65'));fs[_0xbe2f('0x63')](_0x4ec1b2);}return _0x2e6517;})[_0xbe2f('0x23')](function(_0x513b6d){if(!_0x513b6d)throw new InternalError();return _0x513b6d['destroy']();})[_0xbe2f('0x23')](function(){_0x43fe75[_0xbe2f('0x18')](0xcc)[_0xbe2f('0x24')]();})['catch'](handleError(_0x43fe75,null));};function getBucketslist(_0x5ab431,_0xae74a7,_0x2f81aa){return new Promise(function(_0x4637f4,_0x17b485){var _0x5e88a0=new AWS['S3']({'accessKeyId':_0xae74a7,'secretAccessKey':_0x5ab431,'region':_0x2f81aa});_0x5e88a0['listBuckets']({},function(_0x4ee441,_0x41628c){if(_0x4ee441){return _0x17b485(_0x4ee441);}else{return _0x4637f4(_0x41628c);}});});}function createBucket(_0x2a2b20,_0x553323,_0x3029f9,_0x192882){return new Promise(function(_0x463b4a,_0x5baec9){var _0x110217=new AWS['S3']({'accessKeyId':_0x553323,'secretAccessKey':_0x2a2b20,'region':_0x3029f9});_0x110217[_0xbe2f('0x66')]({'Bucket':_0x192882},function(_0x4d87aa,_0x2ad091){if(_0x4d87aa){return _0x5baec9(_0x4d87aa);}else{return _0x463b4a(_0x2ad091);}});});}function uploadFile(_0x3a6b80,_0x252581,_0x26ffdb,_0xee6fe3,_0x2edbcc,_0x4e6dff){return new Promise(function(_0x5540b0,_0x2824d6){var _0x392c37=new AWS['S3']({'accessKeyId':_0x252581,'secretAccessKey':_0x3a6b80,'region':_0x26ffdb});_0x392c37[_0xbe2f('0x67')]({'Bucket':_0xee6fe3,'Key':_0x2edbcc,'Body':_0x4e6dff},function(_0x32aef3,_0x99ddd3){if(_0x32aef3){return _0x2824d6(_0x32aef3);}else{return _0x5540b0(_0x99ddd3);}});});}function startTranscribe(_0x1cc5d4,_0x417964,_0x345e76,_0x33da56,_0x20af5e,_0x40ee4b){return new Promise(function(_0x4df047,_0x51ce24){var _0x505486=new AWS[(_0xbe2f('0x68'))]({'accessKeyId':_0x417964,'secretAccessKey':_0x1cc5d4,'region':_0x345e76});_0x505486[_0xbe2f('0x69')]({'TranscriptionJobName':_0x33da56,'LanguageCode':_0x20af5e,'Media':{'MediaFileUri':_0x40ee4b}},function(_0x809f2d,_0x5e1d28){if(_0x809f2d){return _0x51ce24(_0x809f2d);}else{return _0x4df047(_0x5e1d28);}});});}function transcribe(_0x98dbf8,_0x5501e2,_0x288766,_0x40b483,_0x1a2391,_0x269e94,_0x320a79){return new Promise(function(_0xf0ec9a,_0x302919){var _0x55e045={};logger['info'](util[_0xbe2f('0x2f')](_0xbe2f('0x6a'),_0x98dbf8,_0x1a2391));return uploadFile(_0x5501e2,_0x288766,_0x40b483,_0x1a2391,path['basename'](_0x269e94),fs[_0xbe2f('0x6b')](_0x269e94))[_0xbe2f('0x23')](function(_0x373549){logger[_0xbe2f('0x60')](util['format'](_0xbe2f('0x6c'),_0x98dbf8,_0x1a2391,_0x373549[_0xbe2f('0x6d')]));_0x55e045[_0xbe2f('0x6e')]=_0x373549['Bucket'];_0x55e045[_0xbe2f('0x6f')]=_0x373549[_0xbe2f('0x6d')];logger[_0xbe2f('0x60')](util[_0xbe2f('0x2f')](_0xbe2f('0x70'),_0x98dbf8));return startTranscribe(_0x5501e2,_0x288766,_0x40b483,uuidv4(),_0x320a79,_0x373549[_0xbe2f('0x6d')]);})[_0xbe2f('0x23')](function(_0x2a7deb){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x98dbf8,_0x2a7deb[_0xbe2f('0x71')][_0xbe2f('0x72')]));_0x55e045[_0xbe2f('0x73')]=_0x2a7deb[_0xbe2f('0x71')][_0xbe2f('0x72')];_0x55e045['transcribeStatus']=_0x2a7deb[_0xbe2f('0x71')][_0xbe2f('0x74')];return _0xf0ec9a(_0x55e045);})[_0xbe2f('0x40')](function(_0x5e0fcf){return _0x302919(_0x5e0fcf);});});}exports[_0xbe2f('0x75')]=function(_0x429d9f,_0x358dcf,_0x56eef9){var _0x2c1693;var _0x2c69c1;var _0x3e2c3f;var _0x1a8c31=require(_0xbe2f('0x59'));return db[_0xbe2f('0x2a')][_0xbe2f('0x76')]({'where':{'id':_0x429d9f[_0xbe2f('0x42')]['id']}})['then'](function(_0x22a3b9){if(_0x22a3b9){var _0x5e2189=util[_0xbe2f('0x2f')](_0xbe2f('0x4d'),_0x22a3b9['value']);if(fs['existsSync'](_0x5e2189)){cypher=!![];return _0x1a8c31[_0xbe2f('0x5e')](_0x5e2189,_0x22a3b9['value'],config[_0xbe2f('0x4f')][_0xbe2f('0x50')])[_0xbe2f('0x23')](function(){return _0x22a3b9;});}return _0x22a3b9;}})['then'](function(_0x7fa989){if(!_0x7fa989){throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x77'));}_0x2c69c1=_0x7fa989;return db[_0xbe2f('0x78')]['findOne']({'where':{'id':0x1}});})[_0xbe2f('0x23')](handleEntityNotFound(_0x358dcf,null))[_0xbe2f('0x23')](function(_0x4e3cb7){if(_0x4e3cb7){_0x2c1693=_0x4e3cb7;if(!_0x2c1693[_0xbe2f('0x79')]||!_0x2c1693[_0xbe2f('0x7a')]||!_0x2c1693[_0xbe2f('0x7b')]||!_0x2c1693['language']||!_0x2c1693[_0xbe2f('0x6e')]){throw new db[(_0xbe2f('0x51'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x429d9f['body'][_0xbe2f('0x7c')]&&(!_0x2c1693[_0xbe2f('0x7d')]||!_0x2c1693['sentimentAccountId']||!_0x2c1693[_0xbe2f('0x7e')]||!_0x2c1693[_0xbe2f('0x7f')]||!_0x2c1693['bucket'])){throw new db['Sequelize'][(_0xbe2f('0x52'))](_0xbe2f('0x80'));}return db[_0xbe2f('0x81')][_0xbe2f('0x76')]({'where':{'id':_0x2c1693[_0xbe2f('0x7a')]}});}})[_0xbe2f('0x23')](function(_0x1d7395){if(!_0x1d7395){throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x82'));}if(!_0x1d7395[_0xbe2f('0x83')]||!_0x1d7395[_0xbe2f('0x84')]){throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x85'));}_0x3e2c3f=_0x1d7395;return getBucketslist(_0x3e2c3f[_0xbe2f('0x83')],_0x3e2c3f[_0xbe2f('0x84')],_0x2c1693[_0xbe2f('0x7b')]);})[_0xbe2f('0x23')](function(_0xbcc3e6){if(_0xbcc3e6&&_0xbcc3e6['Buckets']){var _0xaaf92d=_['find'](_0xbcc3e6[_0xbe2f('0x86')],function(_0x472210){return _0x472210['Name']===_0x2c1693['bucket'];});if(!_0xaaf92d){logger[_0xbe2f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x429d9f[_0xbe2f('0x42')]['id'],_0x2c1693[_0xbe2f('0x6e')]));return createBucket(_0x3e2c3f[_0xbe2f('0x83')],_0x3e2c3f[_0xbe2f('0x84')],_0x2c1693[_0xbe2f('0x7b')],_0x2c1693['bucket']);}logger[_0xbe2f('0x60')](util[_0xbe2f('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x429d9f[_0xbe2f('0x42')]['id'],_0x2c1693[_0xbe2f('0x6e')]));return;}})[_0xbe2f('0x23')](function(_0x4d84bc){if(_0x2c69c1[_0xbe2f('0x87')]==='NEW'){return transcribe(_0x429d9f[_0xbe2f('0x42')]['id'],_0x3e2c3f['data1'],_0x3e2c3f[_0xbe2f('0x84')],_0x2c1693['transcribeRegion'],_0x2c1693[_0xbe2f('0x6e')],_0x2c69c1[_0xbe2f('0x4c')],_0x2c1693['language']);}else{logger[_0xbe2f('0x60')](util[_0xbe2f('0x2f')](_0xbe2f('0x88'),_0x429d9f[_0xbe2f('0x42')]['id']));return{'transcribeStatus':_0xbe2f('0x89')};}})['then'](function(_0x8774e5){if(_0x8774e5){_0x8774e5[_0xbe2f('0x8a')]=_0x429d9f[_0xbe2f('0x47')][_0xbe2f('0x7c')];return _0x2c69c1[_0xbe2f('0x8b')](_0x8774e5);}})[_0xbe2f('0x23')](respondWithResult(_0x358dcf,null))[_0xbe2f('0x40')](handleError(_0x358dcf,null));};function writeFile(_0x1a1366,_0x5e69f1){return new Promise(function(_0x836f30,_0x8056c8){fs[_0xbe2f('0x8c')](_0x5e69f1,_0x1a1366,function(_0x5c4524,_0x32f936){if(_0x5c4524){return _0x8056c8(_0x5c4524);}else{return _0x836f30(_0x32f936);}});});}exports[_0xbe2f('0x8d')]=function(_0x3e3814,_0xde8552,_0x37f4f7){return db['VoiceRecording']['findOne']({'where':{'id':_0x3e3814[_0xbe2f('0x42')]['id']}})['then'](handleEntityNotFound(_0xde8552))[_0xbe2f('0x23')](function(_0x15d4e){if(_0x15d4e&&_0x15d4e[_0xbe2f('0x8e')]){var _0x5a58f8=_0x15d4e['fileText'];var _0x458525=config[_0xbe2f('0x8f')]+_0xbe2f('0x90')+_0x15d4e['id']+_0xbe2f('0x91');if(fs['existsSync'](_0x458525)){return _0x458525;}return writeFile(_0x5a58f8,_0x458525)['then'](function(){return _0x458525;});}else{throw new db[(_0xbe2f('0x51'))][(_0xbe2f('0x52'))](_0xbe2f('0x92'));}})[_0xbe2f('0x23')](function(_0x1e7fb0){return _0xde8552['download'](_0x1e7fb0);})['catch'](handleError(_0xde8552));}; \ No newline at end of file +var _0x8192=['cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','update','body','describe','download','uniqueid','format','%s.cypher','existsSync','decryptFile','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','../../components/encryptor','sequelize','MD5','col','token','$and','push','secrets','extname','Entity\x20not\x20found'];(function(_0x5a791e,_0x1d6450){var _0x29b447=function(_0x318121){while(--_0x318121){_0x5a791e['push'](_0x5a791e['shift']());}};_0x29b447(++_0x1d6450);}(_0x8192,0x1ec));var _0x2819=function(_0x2281a5,_0x3e212c){_0x2281a5=_0x2281a5-0x0;var _0x21ca08=_0x8192[_0x2281a5];return _0x21ca08;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2819('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2819('0x1'));var jsonpatch=require(_0x2819('0x2'));var rp=require(_0x2819('0x3'));var moment=require(_0x2819('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2819('0x5'));var util=require('util');var path=require(_0x2819('0x6'));var sox=require(_0x2819('0x7'));var csv=require(_0x2819('0x8'));var ejs=require(_0x2819('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2819('0xa'));var crypto=require(_0x2819('0xb'));var jsforce=require(_0x2819('0xc'));var deskjs=require(_0x2819('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2819('0xe'));var AWS=require(_0x2819('0xf'));var uuidv4=require(_0x2819('0x10'));var Redis=require(_0x2819('0x11'));var authService=require(_0x2819('0x12'));var qs=require(_0x2819('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2819('0x14'));var logger=require(_0x2819('0x15'))(_0x2819('0x16'));var utils=require(_0x2819('0x17'));var config=require(_0x2819('0x18'));var db=require(_0x2819('0x19'))['db'];function respondWithStatusCode(_0x5919ae,_0x3d133f){_0x3d133f=_0x3d133f||0xcc;return function(_0x3a8ebb){if(_0x3a8ebb){return _0x5919ae[_0x2819('0x1a')](_0x3d133f);}return _0x5919ae[_0x2819('0x1b')](_0x3d133f)[_0x2819('0x1c')]();};}function respondWithResult(_0x33cfc8,_0x2298dc){_0x2298dc=_0x2298dc||0xc8;return function(_0x46035c){if(_0x46035c){return _0x33cfc8[_0x2819('0x1b')](_0x2298dc)[_0x2819('0x1d')](_0x46035c);}};}function respondWithFilteredResult(_0xf40511,_0x536d3b){return function(_0x5be2f4){if(_0x5be2f4){var _0x54283d=_0x5be2f4[_0x2819('0x1e')],_0x2007f8=_0x536d3b[_0x2819('0x1f')],_0x4f981b=_0x536d3b[_0x2819('0x1f')]+_0x536d3b[_0x2819('0x20')],_0x1c38cd;if(_0x4f981b>=_0x54283d){_0x4f981b=_0x54283d;_0x1c38cd=0xc8;}else{_0x1c38cd=0xce;}_0xf40511[_0x2819('0x1b')](_0x1c38cd);return _0xf40511[_0x2819('0x21')](_0x2819('0x22'),_0x2007f8+'-'+_0x4f981b+'/'+_0x54283d)['json'](_0x5be2f4);}return null;};}function patchUpdates(_0x3aabc5){return function(_0x5724ec){try{jsonpatch[_0x2819('0x23')](_0x5724ec,_0x3aabc5,!![]);}catch(_0x54ad56){return BPromise[_0x2819('0x24')](_0x54ad56);}return _0x5724ec[_0x2819('0x25')]();};}function saveUpdates(_0x1e8b74,_0x200745){return function(_0x56affe){if(_0x56affe){return _0x56affe['update'](_0x1e8b74)[_0x2819('0x26')](function(_0x36532c){return _0x36532c;});}return null;};}function removeEntity(_0x20adc6,_0x3d4c50){return function(_0x4f1edb){if(_0x4f1edb){return _0x4f1edb[_0x2819('0x27')]()[_0x2819('0x26')](function(){_0x20adc6['status'](0xcc)[_0x2819('0x1c')]();});}};}function handleEntityNotFound(_0x42d76c,_0x52535f){return function(_0x3b684c){if(!_0x3b684c){_0x42d76c[_0x2819('0x1a')](0x194);}return _0x3b684c;};}function handleError(_0xac3d7e,_0x59b9dd){_0x59b9dd=_0x59b9dd||0x1f4;return function(_0x3c4ab6){logger[_0x2819('0x28')](_0x3c4ab6[_0x2819('0x29')]);if(_0x3c4ab6['name']){delete _0x3c4ab6[_0x2819('0x2a')];}_0xac3d7e[_0x2819('0x1b')](_0x59b9dd)['send'](_0x3c4ab6);};}exports[_0x2819('0x2b')]=function(_0x1bf66a,_0x3803e3){var _0x57d05a={},_0xecf614={},_0xb2f92c={'count':0x0,'rows':[]};var _0x2ec037=_[_0x2819('0x2c')](db[_0x2819('0x2d')][_0x2819('0x2e')],function(_0x469c03){return{'name':_0x469c03['fieldName'],'type':_0x469c03[_0x2819('0x2f')][_0x2819('0x30')]};});_0xecf614[_0x2819('0x31')]=_[_0x2819('0x32')](_[_0x2819('0x2c')](_0x2ec037,'name'),['format']);_0xecf614[_0x2819('0x33')]=_['keys'](_0x1bf66a[_0x2819('0x33')]);_0xecf614['filters']=_[_0x2819('0x34')](_0xecf614['model'],_0xecf614[_0x2819('0x33')]);_0x57d05a[_0x2819('0x35')]=_[_0x2819('0x34')](_0xecf614['model'],qs[_0x2819('0x36')](_0x1bf66a[_0x2819('0x33')]['fields']));_0x57d05a[_0x2819('0x35')]=_0x57d05a['attributes']['length']?_0x57d05a[_0x2819('0x35')]:_0xecf614[_0x2819('0x31')];if(!_0x1bf66a[_0x2819('0x33')]['hasOwnProperty'](_0x2819('0x37'))){_0x57d05a[_0x2819('0x20')]=qs[_0x2819('0x20')](_0x1bf66a['query']['limit']);_0x57d05a[_0x2819('0x1f')]=qs[_0x2819('0x1f')](_0x1bf66a['query']['offset']);}_0x57d05a[_0x2819('0x38')]=qs[_0x2819('0x39')](_0x1bf66a[_0x2819('0x33')]['sort']);_0x57d05a[_0x2819('0x3a')]=qs[_0x2819('0x3b')](_[_0x2819('0x3c')](_0x1bf66a[_0x2819('0x33')],_0xecf614['filters']),_0x2ec037);if(_0x1bf66a[_0x2819('0x33')]['filter']){_0x57d05a[_0x2819('0x3a')]=_[_0x2819('0x3d')](_0x57d05a['where'],{'$or':_[_0x2819('0x2c')](_0x2ec037,function(_0xed625d){if(_0xed625d[_0x2819('0x2f')]!==_0x2819('0x3e')){var _0x48b755={};_0x48b755[_0xed625d[_0x2819('0x2a')]]={'$like':'%'+_0x1bf66a['query']['filter']+'%'};return _0x48b755;}})});}_0x57d05a=_[_0x2819('0x3d')]({},_0x57d05a,_0x1bf66a[_0x2819('0x3f')]);var _0x1d7cb7={'where':_0x57d05a[_0x2819('0x3a')]};return db[_0x2819('0x2d')][_0x2819('0x1e')](_0x1d7cb7)[_0x2819('0x26')](function(_0x34fed2){_0xb2f92c['count']=_0x34fed2;if(_0x1bf66a['query'][_0x2819('0x40')]){_0x57d05a[_0x2819('0x41')]=[{'all':!![]}];}return db[_0x2819('0x2d')][_0x2819('0x42')](_0x57d05a);})[_0x2819('0x26')](function(_0x2f3a64){_0xb2f92c[_0x2819('0x43')]=_0x2f3a64;return _0xb2f92c;})[_0x2819('0x26')](respondWithFilteredResult(_0x3803e3,_0x57d05a))[_0x2819('0x44')](handleError(_0x3803e3,null));};exports['show']=function(_0x2228f5,_0x49c2a2){var _0x49da12={'raw':![],'where':{'id':_0x2228f5[_0x2819('0x45')]['id']}},_0x2c26c0={};_0x2c26c0[_0x2819('0x31')]=_[_0x2819('0x46')](db[_0x2819('0x2d')]['rawAttributes']);_0x2c26c0['query']=_[_0x2819('0x46')](_0x2228f5[_0x2819('0x33')]);_0x2c26c0[_0x2819('0x3b')]=_[_0x2819('0x34')](_0x2c26c0['model'],_0x2c26c0[_0x2819('0x33')]);_0x49da12['attributes']=_['intersection'](_0x2c26c0[_0x2819('0x31')],qs[_0x2819('0x36')](_0x2228f5['query']['fields']));_0x49da12[_0x2819('0x35')]=_0x49da12[_0x2819('0x35')][_0x2819('0x47')]?_0x49da12[_0x2819('0x35')]:_0x2c26c0[_0x2819('0x31')];if(_0x2228f5['query'][_0x2819('0x40')]){_0x49da12[_0x2819('0x41')]=[{'all':!![]}];}_0x49da12=_['merge']({},_0x49da12,_0x2228f5['options']);return db[_0x2819('0x2d')][_0x2819('0x48')](_0x49da12)[_0x2819('0x26')](handleEntityNotFound(_0x49c2a2,null))['then'](respondWithResult(_0x49c2a2,null))[_0x2819('0x44')](handleError(_0x49c2a2,null));};exports['create']=function(_0x21e355,_0x33362a){return db[_0x2819('0x2d')][_0x2819('0x49')](_0x21e355['body'],{})[_0x2819('0x26')](respondWithResult(_0x33362a,0xc9))['catch'](handleError(_0x33362a,null));};exports[_0x2819('0x4a')]=function(_0x4095b9,_0xeb3ad){if(_0x4095b9[_0x2819('0x4b')]['id']){delete _0x4095b9['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x4095b9[_0x2819('0x45')]['id']}})[_0x2819('0x26')](handleEntityNotFound(_0xeb3ad,null))[_0x2819('0x26')](saveUpdates(_0x4095b9[_0x2819('0x4b')],null))['then'](respondWithResult(_0xeb3ad,null))[_0x2819('0x44')](handleError(_0xeb3ad,null));};exports['describe']=function(_0x10e96c,_0x1744ba){return db[_0x2819('0x2d')][_0x2819('0x4c')]()['then'](respondWithResult(_0x1744ba,null))[_0x2819('0x44')](handleError(_0x1744ba,null));};exports[_0x2819('0x4d')]=function(_0x5097a0,_0x3a9648,_0x265b41){var _0x2000ce=require('../../components/encryptor');var _0x12bb6d=![];var _0x4ecf54={};if(_0x5097a0[_0x2819('0x33')]['type']&&_0x5097a0[_0x2819('0x33')]['type']==='uniqueid'){_0x4ecf54[_0x2819('0x4e')]=_0x5097a0[_0x2819('0x45')]['id'];}else{_0x4ecf54['id']=_0x5097a0[_0x2819('0x45')]['id'];}return db[_0x2819('0x2d')][_0x2819('0x48')]({'where':_0x4ecf54,'attributes':['id','value'],'raw':!![]})[_0x2819('0x26')](handleEntityNotFound(_0x3a9648,null))[_0x2819('0x26')](function(_0x578c50){if(_0x578c50){var _0x5a4f70=_0x578c50['value'];var _0x2b2109=util[_0x2819('0x4f')](_0x2819('0x50'),_0x5a4f70);if(fs[_0x2819('0x51')](_0x2b2109)){_0x12bb6d=!![];return _0x2000ce[_0x2819('0x52')](_0x2b2109,_0x5a4f70,config['secrets'][_0x2819('0x53')])[_0x2819('0x26')](function(){return _0x578c50;});}return _0x578c50;}})[_0x2819('0x26')](function(_0x1e048e){if(_0x1e048e){var _0x2a8ec7=_0x1e048e[_0x2819('0x54')];if(!fs['existsSync'](_0x2a8ec7)){throw new db[(_0x2819('0x55'))][(_0x2819('0x56'))](_0x2819('0x57'));}if(_0x1e048e['filename']){return _0x3a9648[_0x2819('0x4d')](_0x2a8ec7,_0x1e048e[_0x2819('0x58')]+path['extname'](_0x2a8ec7),function(){if(_0x12bb6d){fs[_0x2819('0x59')](_0x2a8ec7);}});}else{return _0x3a9648[_0x2819('0x4d')](_0x2a8ec7,function(_0xde78db){if(_0x12bb6d){fs[_0x2819('0x59')](_0x2a8ec7);}});}}})['catch'](function(_0x46b6fc){if(_0x46b6fc['message']===_0x2819('0x57')){_0x3a9648[_0x2819('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x3a9648,null);}});};exports['downloads']=function(_0x3fdd4b,_0x1d38a2,_0x2e862d){var _0x9df6f6=require(_0x2819('0x5a'));var _0x57c05d=![];var _0x87d87e={'$and':[db[_0x2819('0x5b')][_0x2819('0x3a')](db[_0x2819('0x5b')]['fn'](_0x2819('0x5c'),db[_0x2819('0x5b')][_0x2819('0x5d')](_0x2819('0x4e'))),_0x3fdd4b['query'][_0x2819('0x5e')])]};if(_0x3fdd4b[_0x2819('0x33')]['type']&&_0x3fdd4b['query'][_0x2819('0x2f')]===_0x2819('0x4e')){_0x87d87e[_0x2819('0x5f')][_0x2819('0x60')]({'uniqueid':_0x3fdd4b['params']['id']});}else{_0x87d87e[_0x2819('0x5f')][_0x2819('0x60')]({'id':_0x3fdd4b[_0x2819('0x45')]['id']});}return db[_0x2819('0x2d')][_0x2819('0x48')]({'where':_0x87d87e,'attributes':['id',_0x2819('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x1d38a2,null))[_0x2819('0x26')](function(_0x211df9){if(_0x211df9){var _0xe8495a=util['format'](_0x2819('0x50'),_0x211df9[_0x2819('0x54')]);if(fs['existsSync'](_0xe8495a)){_0x57c05d=!![];return _0x9df6f6[_0x2819('0x52')](_0xe8495a,_0x211df9[_0x2819('0x54')],config[_0x2819('0x61')][_0x2819('0x53')])['then'](function(){return _0x211df9;});}return _0x211df9;}})[_0x2819('0x26')](function(_0x41d756){if(_0x41d756){if(!fs[_0x2819('0x51')](_0x41d756[_0x2819('0x54')])){throw new db[(_0x2819('0x55'))][(_0x2819('0x56'))](_0x2819('0x57'));}if(_0x41d756[_0x2819('0x58')]){return _0x1d38a2['download'](_0x41d756[_0x2819('0x54')],_0x41d756['filename']+path[_0x2819('0x62')](_0x41d756[_0x2819('0x54')]),function(){if(_0x57c05d){fs['unlink'](_0x41d756[_0x2819('0x54')]);}});}else{return _0x1d38a2['download'](_0x41d756[_0x2819('0x54')],function(_0x2948a3){if(_0x57c05d){fs[_0x2819('0x59')](_0x41d756[_0x2819('0x54')]);}});}}})[_0x2819('0x44')](handleError(_0x1d38a2,null));};exports[_0x2819('0x27')]=function(_0x49a002,_0x218a26){return db[_0x2819('0x2d')][_0x2819('0x48')]({'where':{'id':_0x49a002['params']['id']}})['then'](function(_0x1f6319){if(!_0x1f6319)throw new ReferenceError(_0x2819('0x63'));return _0x1f6319;})[_0x2819('0x26')](function(_0x3eea40){var _0x44d9ac=_0x3eea40[_0x2819('0x54')];logger['info'](_0x2819('0x64'),_0x44d9ac);if(!_[_0x2819('0x65')](_0x3eea40[_0x2819('0x54')])&&fs['existsSync'](_0x44d9ac)){logger[_0x2819('0x66')](_0x2819('0x67')+_0x44d9ac+_0x2819('0x68'));fs[_0x2819('0x69')](_0x44d9ac);}_0x44d9ac=_0x44d9ac+'.cypher';if(!_[_0x2819('0x65')](_0x3eea40['value'])&&fs[_0x2819('0x51')](_0x44d9ac)){logger[_0x2819('0x66')](_0x2819('0x67')+_0x44d9ac+_0x2819('0x68'));fs[_0x2819('0x69')](_0x44d9ac);}return _0x3eea40;})[_0x2819('0x26')](function(_0x1d549e){if(!_0x1d549e)throw new InternalError();return _0x1d549e['destroy']();})[_0x2819('0x26')](function(){_0x218a26[_0x2819('0x1b')](0xcc)['end']();})[_0x2819('0x44')](handleError(_0x218a26,null));};function getBucketslist(_0x3bb6a4,_0x435edb,_0x40ed5b){return new Promise(function(_0x576c78,_0x37d851){var _0x1387e0=new AWS['S3']({'accessKeyId':_0x435edb,'secretAccessKey':_0x3bb6a4,'region':_0x40ed5b});_0x1387e0[_0x2819('0x6a')]({},function(_0x2ab2d8,_0x1aa495){if(_0x2ab2d8){return _0x37d851(_0x2ab2d8);}else{return _0x576c78(_0x1aa495);}});});}function createBucket(_0x26dced,_0xc3ddde,_0x5aae76,_0x7ccc4c){return new Promise(function(_0x5cd187,_0x4245c0){var _0x5f4c33=new AWS['S3']({'accessKeyId':_0xc3ddde,'secretAccessKey':_0x26dced,'region':_0x5aae76});_0x5f4c33[_0x2819('0x6b')]({'Bucket':_0x7ccc4c},function(_0x1601e9,_0x33dc59){if(_0x1601e9){return _0x4245c0(_0x1601e9);}else{return _0x5cd187(_0x33dc59);}});});}function uploadFile(_0xdbac76,_0x1a1b9a,_0x31dcd0,_0x16bc99,_0x2c1a62,_0x1d8724){return new Promise(function(_0x50bd27,_0x4b57e4){var _0x3453e=new AWS['S3']({'accessKeyId':_0x1a1b9a,'secretAccessKey':_0xdbac76,'region':_0x31dcd0});_0x3453e[_0x2819('0x6c')]({'Bucket':_0x16bc99,'Key':_0x2c1a62,'Body':_0x1d8724},function(_0x3d61c3,_0x3e71f9){if(_0x3d61c3){return _0x4b57e4(_0x3d61c3);}else{return _0x50bd27(_0x3e71f9);}});});}function startTranscribe(_0x4e3b10,_0x99ba1f,_0x640437,_0x2cd84c,_0x3742b2,_0xf2561b){return new Promise(function(_0x2c7aad,_0x5ca7f3){var _0x56e13e=new AWS['TranscribeService']({'accessKeyId':_0x99ba1f,'secretAccessKey':_0x4e3b10,'region':_0x640437});_0x56e13e[_0x2819('0x6d')]({'TranscriptionJobName':_0x2cd84c,'LanguageCode':_0x3742b2,'Media':{'MediaFileUri':_0xf2561b}},function(_0x3700a1,_0x293b1c){if(_0x3700a1){return _0x5ca7f3(_0x3700a1);}else{return _0x2c7aad(_0x293b1c);}});});}function transcribe(_0x56d9b7,_0x41e446,_0x2d88a5,_0x533cef,_0x1485a7,_0x4ca877,_0x2803f4){return new Promise(function(_0x22e860,_0x467aa0){var _0x56a0ff={};logger[_0x2819('0x66')](util[_0x2819('0x4f')](_0x2819('0x6e'),_0x56d9b7,_0x1485a7));return uploadFile(_0x41e446,_0x2d88a5,_0x533cef,_0x1485a7,path['basename'](_0x4ca877),fs[_0x2819('0x6f')](_0x4ca877))[_0x2819('0x26')](function(_0x1ce639){logger['info'](util[_0x2819('0x4f')](_0x2819('0x70'),_0x56d9b7,_0x1485a7,_0x1ce639['Location']));_0x56a0ff[_0x2819('0x71')]=_0x1ce639[_0x2819('0x72')];_0x56a0ff[_0x2819('0x73')]=_0x1ce639[_0x2819('0x74')];logger['info'](util[_0x2819('0x4f')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x56d9b7));return startTranscribe(_0x41e446,_0x2d88a5,_0x533cef,uuidv4(),_0x2803f4,_0x1ce639[_0x2819('0x74')]);})[_0x2819('0x26')](function(_0x7270aa){logger[_0x2819('0x66')](util[_0x2819('0x4f')](_0x2819('0x75'),_0x56d9b7,_0x7270aa[_0x2819('0x76')][_0x2819('0x77')]));_0x56a0ff[_0x2819('0x78')]=_0x7270aa['TranscriptionJob'][_0x2819('0x77')];_0x56a0ff[_0x2819('0x79')]=_0x7270aa['TranscriptionJob'][_0x2819('0x7a')];return _0x22e860(_0x56a0ff);})[_0x2819('0x44')](function(_0x3c46c9){return _0x467aa0(_0x3c46c9);});});}exports[_0x2819('0x7b')]=function(_0x2ebe3f,_0x2d43d3,_0x3d7a43){var _0xa0f586;var _0x33567d;var _0x38cf69;var _0x3319ab=require(_0x2819('0x5a'));return db[_0x2819('0x2d')][_0x2819('0x7c')]({'where':{'id':_0x2ebe3f[_0x2819('0x45')]['id']}})['then'](function(_0x540e84){if(_0x540e84){var _0x47a9da=util[_0x2819('0x4f')](_0x2819('0x50'),_0x540e84['value']);if(fs[_0x2819('0x51')](_0x47a9da)){cypher=!![];return _0x3319ab[_0x2819('0x52')](_0x47a9da,_0x540e84[_0x2819('0x54')],config[_0x2819('0x61')][_0x2819('0x53')])[_0x2819('0x26')](function(){return _0x540e84;});}return _0x540e84;}})['then'](function(_0x242e50){if(!_0x242e50){throw new db[(_0x2819('0x55'))][(_0x2819('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x33567d=_0x242e50;return db['Setting'][_0x2819('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2d43d3,null))[_0x2819('0x26')](function(_0x5a859d){if(_0x5a859d){_0xa0f586=_0x5a859d;if(!_0xa0f586['transcribe']||!_0xa0f586[_0x2819('0x7d')]||!_0xa0f586[_0x2819('0x7e')]||!_0xa0f586['language']||!_0xa0f586[_0x2819('0x71')]){throw new db['Sequelize'][(_0x2819('0x56'))](_0x2819('0x7f'));}if(_0x2ebe3f[_0x2819('0x4b')][_0x2819('0x80')]&&(!_0xa0f586[_0x2819('0x81')]||!_0xa0f586[_0x2819('0x82')]||!_0xa0f586[_0x2819('0x83')]||!_0xa0f586[_0x2819('0x84')]||!_0xa0f586[_0x2819('0x71')])){throw new db['Sequelize'][(_0x2819('0x56'))](_0x2819('0x85'));}return db['CloudProvider']['findOne']({'where':{'id':_0xa0f586[_0x2819('0x7d')]}});}})[_0x2819('0x26')](function(_0x49eb54){if(!_0x49eb54){throw new db[(_0x2819('0x55'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x49eb54['data1']||!_0x49eb54['data2']){throw new db['Sequelize'][(_0x2819('0x56'))](_0x2819('0x86'));}_0x38cf69=_0x49eb54;return getBucketslist(_0x38cf69[_0x2819('0x87')],_0x38cf69['data2'],_0xa0f586[_0x2819('0x7e')]);})[_0x2819('0x26')](function(_0x3878a4){if(_0x3878a4&&_0x3878a4[_0x2819('0x88')]){var _0x26149f=_[_0x2819('0x48')](_0x3878a4[_0x2819('0x88')],function(_0x29014d){return _0x29014d['Name']===_0xa0f586['bucket'];});if(!_0x26149f){logger[_0x2819('0x66')](util['format'](_0x2819('0x89'),_0x2ebe3f[_0x2819('0x45')]['id'],_0xa0f586[_0x2819('0x71')]));return createBucket(_0x38cf69[_0x2819('0x87')],_0x38cf69[_0x2819('0x8a')],_0xa0f586[_0x2819('0x7e')],_0xa0f586['bucket']);}logger[_0x2819('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2ebe3f[_0x2819('0x45')]['id'],_0xa0f586[_0x2819('0x71')]));return;}})[_0x2819('0x26')](function(_0x467ee3){if(_0x33567d[_0x2819('0x79')]===_0x2819('0x8b')){return transcribe(_0x2ebe3f[_0x2819('0x45')]['id'],_0x38cf69['data1'],_0x38cf69[_0x2819('0x8a')],_0xa0f586['transcribeRegion'],_0xa0f586[_0x2819('0x71')],_0x33567d[_0x2819('0x54')],_0xa0f586[_0x2819('0x84')]);}else{logger[_0x2819('0x66')](util[_0x2819('0x4f')](_0x2819('0x8c'),_0x2ebe3f[_0x2819('0x45')]['id']));return{'transcribeStatus':_0x2819('0x8d')};}})[_0x2819('0x26')](function(_0xc9dfc7){if(_0xc9dfc7){_0xc9dfc7[_0x2819('0x8e')]=_0x2ebe3f[_0x2819('0x4b')]['runSentiment'];return _0x33567d[_0x2819('0x8f')](_0xc9dfc7);}})[_0x2819('0x26')](respondWithResult(_0x2d43d3,null))[_0x2819('0x44')](handleError(_0x2d43d3,null));};function writeFile(_0x34c9a8,_0x211663){return new Promise(function(_0x28fdbe,_0x3614a1){fs['writeFile'](_0x211663,_0x34c9a8,function(_0x331cbe,_0x2c30b9){if(_0x331cbe){return _0x3614a1(_0x331cbe);}else{return _0x28fdbe(_0x2c30b9);}});});}exports[_0x2819('0x90')]=function(_0x15f344,_0x43bfb0,_0x333912){return db[_0x2819('0x2d')][_0x2819('0x7c')]({'where':{'id':_0x15f344[_0x2819('0x45')]['id']}})['then'](handleEntityNotFound(_0x43bfb0))['then'](function(_0x41e2c9){if(_0x41e2c9&&_0x41e2c9['fileText']){var _0x2d8c29=_0x41e2c9[_0x2819('0x91')];var _0x213697=config['root']+_0x2819('0x92')+_0x41e2c9['id']+_0x2819('0x93');if(fs['existsSync'](_0x213697)){return _0x213697;}return writeFile(_0x2d8c29,_0x213697)['then'](function(){return _0x213697;});}else{throw new db['Sequelize'][(_0x2819('0x56'))]('Transcript\x20not\x20available');}})['then'](function(_0x4c281c){return _0x43bfb0[_0x2819('0x4d')](_0x4c281c);})[_0x2819('0x44')](handleError(_0x43bfb0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f376eb9..cb94579 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 _0xfb65=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0xfb65,0x82));var _0x5fb6=function(_0x3fe8c2,_0x26abad){_0x3fe8c2=_0x3fe8c2-0x0;var _0x3256ce=_0xfb65[_0x3fe8c2];return _0x3256ce;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));module[_0x5fb6('0x8')]=function(_0x4dec8f,_0x50782b){return _0x4dec8f[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'paranoid':![],'indexes':[{'name':_0x5fb6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xea1c=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcea1('0x0'))(_0xcea1('0x1'));var moment=require(_0xcea1('0x2'));var BPromise=require(_0xcea1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcea1('0x4'));var rimraf=require(_0xcea1('0x5'));var config=require(_0xcea1('0x6'));var attributes=require(_0xcea1('0x7'));module[_0xcea1('0x8')]=function(_0x1ff8bf,_0x29732f){return _0x1ff8bf[_0xcea1('0x9')](_0xcea1('0xa'),attributes,{'tableName':_0xcea1('0xb'),'paranoid':![],'indexes':[{'name':_0xcea1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 265a731..609bd6d 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(_0x41a4bb,_0x36b115){var _0x4d4239=function(_0x572b5c){while(--_0x572b5c){_0x41a4bb['push'](_0x41a4bb['shift']());}};_0x4d4239(++_0x36b115);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 82f48d4..d987691 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 _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./voiceTransferReport.controller'];(function(_0x29f2bd,_0xb50d24){var _0x2aed3d=function(_0x1eed38){while(--_0x1eed38){_0x29f2bd['push'](_0x29f2bd['shift']());}};_0x2aed3d(++_0xb50d24);}(_0xba34,0x119));var _0x4ba3=function(_0x2b318e,_0x45030e){_0x2b318e=_0x2b318e-0x0;var _0x8e3aa3=_0xba34[_0x2b318e];return _0x8e3aa3;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('0x11')]=router; \ No newline at end of file +var _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id','show','post'];(function(_0x21a1fa,_0x42c5ed){var _0x3d62d5=function(_0xd78796){while(--_0xd78796){_0x21a1fa['push'](_0x21a1fa['shift']());}};_0x3d62d5(++_0x42c5ed);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x799246,_0x2b1c8c){_0x799246=_0x799246-0x0;var _0x1fc3c1=_0xb4c7[_0x799246];return _0x1fc3c1;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ded82be..5da0da1 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 _0xa422=['sequelize','exports','ENUM','blind','STRING','Yes'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0xa422,0xe4));var _0x2a42=function(_0x42e339,_0x589ddc){_0x42e339=_0x42e339-0x0;var _0x5a2392=_0xa422[_0x42e339];return _0x5a2392;};'use strict';var Sequelize=require(_0x2a42('0x0'));var moment=require('moment');module[_0x2a42('0x1')]={'type':{'type':Sequelize[_0x2a42('0x2')](_0x2a42('0x3'),'attended')},'result':{'type':Sequelize[_0x2a42('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x2a42('0x4')]},'transferercalleridname':{'type':Sequelize[_0x2a42('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2a42('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x2a42('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x2a42('0x4')]},'transfererexten':{'type':Sequelize[_0x2a42('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2a42('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x2a42('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x2a42('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2a42('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2a42('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2a42('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x2a42('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x2a42('0x4')]},'isexternal':{'type':Sequelize[_0x2a42('0x2')](_0x2a42('0x5'),'No')},'context':{'type':Sequelize[_0x2a42('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56fe=['ENUM','attended','STRING','sequelize'];(function(_0x269514,_0x237280){var _0x5ecb17=function(_0x3900a1){while(--_0x3900a1){_0x269514['push'](_0x269514['shift']());}};_0x5ecb17(++_0x237280);}(_0x56fe,0x133));var _0xe56f=function(_0x5704ae,_0x1439da){_0x5704ae=_0x5704ae-0x0;var _0x58c267=_0x56fe[_0x5704ae];return _0x58c267;};'use strict';var Sequelize=require(_0xe56f('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xe56f('0x1')]('blind',_0xe56f('0x2'))},'result':{'type':Sequelize[_0xe56f('0x3')]},'transfererchannel':{'type':Sequelize[_0xe56f('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xe56f('0x3')]},'transferercalleridname':{'type':Sequelize[_0xe56f('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe56f('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xe56f('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xe56f('0x3')]},'transferercontext':{'type':Sequelize[_0xe56f('0x3')]},'transfererexten':{'type':Sequelize[_0xe56f('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xe56f('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xe56f('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe56f('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe56f('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe56f('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe56f('0x3')]},'isexternal':{'type':Sequelize[_0xe56f('0x1')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f30e8ef..e5ae03d 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 _0x9daf=['key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','merge','create','body','find','html-pdf','eml-format','rimraf','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','then','stack','name','send','index','map','VoiceTransferReport','fieldName','type'];(function(_0x4b07ea,_0xcdeb36){var _0x42d77a=function(_0x2de220){while(--_0x2de220){_0x4b07ea['push'](_0x4b07ea['shift']());}};_0x42d77a(++_0xcdeb36);}(_0x9daf,0x12c));var _0xf9da=function(_0x1ae125,_0x20820a){_0x1ae125=_0x1ae125-0x0;var _0x1f3b2b=_0x9daf[_0x1ae125];return _0x1f3b2b;};'use strict';var pdf=require(_0xf9da('0x0'));var emlformat=require(_0xf9da('0x1'));var rimraf=require(_0xf9da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf9da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf9da('0x4'));var util=require(_0xf9da('0x5'));var path=require('path');var sox=require(_0xf9da('0x6'));var csv=require(_0xf9da('0x7'));var ejs=require(_0xf9da('0x8'));var fs=require('fs');var _=require(_0xf9da('0x9'));var squel=require(_0xf9da('0xa'));var crypto=require(_0xf9da('0xb'));var jsforce=require(_0xf9da('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf9da('0x7'));var querystring=require('querystring');var Papa=require(_0xf9da('0xd'));var Redis=require(_0xf9da('0xe'));var authService=require(_0xf9da('0xf'));var qs=require(_0xf9da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9da('0x11'))(_0xf9da('0x12'));var utils=require(_0xf9da('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f2d3d,_0x4d3458){_0x4d3458=_0x4d3458||0xcc;return function(_0x195dd3){if(_0x195dd3){return _0x3f2d3d[_0xf9da('0x14')](_0x4d3458);}return _0x3f2d3d['status'](_0x4d3458)[_0xf9da('0x15')]();};}function respondWithResult(_0x4d1350,_0x4181d0){_0x4181d0=_0x4181d0||0xc8;return function(_0x4d43dc){if(_0x4d43dc){return _0x4d1350[_0xf9da('0x16')](_0x4181d0)['json'](_0x4d43dc);}};}function respondWithFilteredResult(_0x27e8bf,_0x4b4f09){return function(_0x382abd){if(_0x382abd){var _0x518500=_0x382abd[_0xf9da('0x17')],_0x22758f=_0x4b4f09[_0xf9da('0x18')],_0x235506=_0x4b4f09[_0xf9da('0x18')]+_0x4b4f09[_0xf9da('0x19')],_0x1111ab;if(_0x235506>=_0x518500){_0x235506=_0x518500;_0x1111ab=0xc8;}else{_0x1111ab=0xce;}_0x27e8bf[_0xf9da('0x16')](_0x1111ab);return _0x27e8bf['set']('Content-Range',_0x22758f+'-'+_0x235506+'/'+_0x518500)[_0xf9da('0x1a')](_0x382abd);}return null;};}function patchUpdates(_0x31a44b){return function(_0xe52ac7){try{jsonpatch[_0xf9da('0x1b')](_0xe52ac7,_0x31a44b,!![]);}catch(_0x5e4e7c){return BPromise[_0xf9da('0x1c')](_0x5e4e7c);}return _0xe52ac7[_0xf9da('0x1d')]();};}function saveUpdates(_0x3986f7,_0x48529e){return function(_0x2499b5){if(_0x2499b5){return _0x2499b5[_0xf9da('0x1e')](_0x3986f7)[_0xf9da('0x1f')](function(_0x31976b){return _0x31976b;});}return null;};}function removeEntity(_0x624a86,_0x45017b){return function(_0xcce503){if(_0xcce503){return _0xcce503['destroy']()[_0xf9da('0x1f')](function(){_0x624a86[_0xf9da('0x16')](0xcc)[_0xf9da('0x15')]();});}};}function handleEntityNotFound(_0x48debc,_0x20c57f){return function(_0x4d7c71){if(!_0x4d7c71){_0x48debc[_0xf9da('0x14')](0x194);}return _0x4d7c71;};}function handleError(_0x1b97e3,_0x50bb1a){_0x50bb1a=_0x50bb1a||0x1f4;return function(_0x39b48c){logger['error'](_0x39b48c[_0xf9da('0x20')]);if(_0x39b48c['name']){delete _0x39b48c[_0xf9da('0x21')];}_0x1b97e3[_0xf9da('0x16')](_0x50bb1a)[_0xf9da('0x22')](_0x39b48c);};}exports[_0xf9da('0x23')]=function(_0x516d6b,_0x43c5b2){var _0x10cead={},_0x3bb53f={},_0x4eadc7={'count':0x0,'rows':[]};var _0x54e646=_[_0xf9da('0x24')](db[_0xf9da('0x25')]['rawAttributes'],function(_0x253b93){return{'name':_0x253b93[_0xf9da('0x26')],'type':_0x253b93[_0xf9da('0x27')][_0xf9da('0x28')]};});_0x3bb53f[_0xf9da('0x29')]=_[_0xf9da('0x24')](_0x54e646,_0xf9da('0x21'));_0x3bb53f[_0xf9da('0x2a')]=_[_0xf9da('0x2b')](_0x516d6b[_0xf9da('0x2a')]);_0x3bb53f['filters']=_['intersection'](_0x3bb53f[_0xf9da('0x29')],_0x3bb53f['query']);_0x10cead['attributes']=_[_0xf9da('0x2c')](_0x3bb53f[_0xf9da('0x29')],qs[_0xf9da('0x2d')](_0x516d6b[_0xf9da('0x2a')][_0xf9da('0x2d')]));_0x10cead['attributes']=_0x10cead[_0xf9da('0x2e')]['length']?_0x10cead[_0xf9da('0x2e')]:_0x3bb53f[_0xf9da('0x29')];if(!_0x516d6b['query']['hasOwnProperty'](_0xf9da('0x2f'))){_0x10cead[_0xf9da('0x19')]=qs[_0xf9da('0x19')](_0x516d6b['query'][_0xf9da('0x19')]);_0x10cead[_0xf9da('0x18')]=qs[_0xf9da('0x18')](_0x516d6b[_0xf9da('0x2a')]['offset']);}_0x10cead[_0xf9da('0x30')]=qs[_0xf9da('0x31')](_0x516d6b[_0xf9da('0x2a')][_0xf9da('0x31')]);_0x10cead['where']=qs[_0xf9da('0x32')](_[_0xf9da('0x33')](_0x516d6b[_0xf9da('0x2a')],_0x3bb53f[_0xf9da('0x32')]),_0x54e646);if(_0x516d6b[_0xf9da('0x2a')][_0xf9da('0x34')]){_0x10cead[_0xf9da('0x35')]=_['merge'](_0x10cead[_0xf9da('0x35')],{'$or':_[_0xf9da('0x24')](_0x54e646,function(_0x5722ff){if(_0x5722ff[_0xf9da('0x27')]!==_0xf9da('0x36')){var _0x4450e0={};_0x4450e0[_0x5722ff[_0xf9da('0x21')]]={'$like':'%'+_0x516d6b[_0xf9da('0x2a')][_0xf9da('0x34')]+'%'};return _0x4450e0;}})});}_0x10cead=_['merge']({},_0x10cead,_0x516d6b[_0xf9da('0x37')]);var _0x32ca2d={'where':_0x10cead[_0xf9da('0x35')]};return db[_0xf9da('0x25')][_0xf9da('0x17')](_0x32ca2d)[_0xf9da('0x1f')](function(_0xdb9058){_0x4eadc7[_0xf9da('0x17')]=_0xdb9058;if(_0x516d6b['query']['includeAll']){_0x10cead[_0xf9da('0x38')]=[{'all':!![]}];}return db[_0xf9da('0x25')][_0xf9da('0x39')](_0x10cead);})[_0xf9da('0x1f')](function(_0x1d15f3){_0x4eadc7[_0xf9da('0x3a')]=_0x1d15f3;return _0x4eadc7;})['then'](respondWithFilteredResult(_0x43c5b2,_0x10cead))[_0xf9da('0x3b')](handleError(_0x43c5b2,null));};exports['show']=function(_0x2fb0ed,_0x2957a){var _0x36bb7f={'raw':!![],'where':{'id':_0x2fb0ed[_0xf9da('0x3c')]['id']}},_0x555ae5={};_0x555ae5['model']=_[_0xf9da('0x2b')](db[_0xf9da('0x25')][_0xf9da('0x3d')]);_0x555ae5[_0xf9da('0x2a')]=_['keys'](_0x2fb0ed[_0xf9da('0x2a')]);_0x555ae5['filters']=_[_0xf9da('0x2c')](_0x555ae5['model'],_0x555ae5[_0xf9da('0x2a')]);_0x36bb7f[_0xf9da('0x2e')]=_[_0xf9da('0x2c')](_0x555ae5[_0xf9da('0x29')],qs['fields'](_0x2fb0ed[_0xf9da('0x2a')][_0xf9da('0x2d')]));_0x36bb7f['attributes']=_0x36bb7f[_0xf9da('0x2e')][_0xf9da('0x3e')]?_0x36bb7f[_0xf9da('0x2e')]:_0x555ae5[_0xf9da('0x29')];if(_0x2fb0ed[_0xf9da('0x2a')][_0xf9da('0x3f')]){_0x36bb7f['include']=[{'all':!![]}];}_0x36bb7f=_[_0xf9da('0x40')]({},_0x36bb7f,_0x2fb0ed[_0xf9da('0x37')]);return db[_0xf9da('0x25')]['find'](_0x36bb7f)[_0xf9da('0x1f')](handleEntityNotFound(_0x2957a,null))['then'](respondWithResult(_0x2957a,null))[_0xf9da('0x3b')](handleError(_0x2957a,null));};exports['create']=function(_0x3b54fa,_0x58c63c){return db['VoiceTransferReport'][_0xf9da('0x41')](_0x3b54fa[_0xf9da('0x42')],{})[_0xf9da('0x1f')](respondWithResult(_0x58c63c,0xc9))[_0xf9da('0x3b')](handleError(_0x58c63c,null));};exports[_0xf9da('0x1e')]=function(_0x1a1d49,_0x18d863){if(_0x1a1d49['body']['id']){delete _0x1a1d49[_0xf9da('0x42')]['id'];}return db[_0xf9da('0x25')][_0xf9da('0x43')]({'where':{'id':_0x1a1d49[_0xf9da('0x3c')]['id']}})[_0xf9da('0x1f')](handleEntityNotFound(_0x18d863,null))[_0xf9da('0x1f')](saveUpdates(_0x1a1d49[_0xf9da('0x42')],null))[_0xf9da('0x1f')](respondWithResult(_0x18d863,null))['catch'](handleError(_0x18d863,null));};exports['destroy']=function(_0xa3b0b3,_0x424a9d){return db[_0xf9da('0x25')][_0xf9da('0x43')]({'where':{'id':_0xa3b0b3[_0xf9da('0x3c')]['id']}})['then'](handleEntityNotFound(_0x424a9d,null))['then'](removeEntity(_0x424a9d,null))['catch'](handleError(_0x424a9d,null));}; \ No newline at end of file +var _0x616e=['lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','then','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x4af68c,_0x412447){var _0x49398e=function(_0x3b5b46){while(--_0x3b5b46){_0x4af68c['push'](_0x4af68c['shift']());}};_0x49398e(++_0x412447);}(_0x616e,0x18d));var _0xe616=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x616e[_0x21af3a];return _0x268a49;};'use strict';var pdf=require(_0xe616('0x0'));var emlformat=require(_0xe616('0x1'));var rimraf=require(_0xe616('0x2'));var zipdir=require(_0xe616('0x3'));var jsonpatch=require(_0xe616('0x4'));var rp=require('request-promise');var moment=require(_0xe616('0x5'));var BPromise=require(_0xe616('0x6'));var Mustache=require(_0xe616('0x7'));var util=require(_0xe616('0x8'));var path=require(_0xe616('0x9'));var sox=require(_0xe616('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe616('0xb'));var squel=require(_0xe616('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe616('0xd'));var toCsv=require(_0xe616('0xe'));var querystring=require(_0xe616('0xf'));var Papa=require(_0xe616('0x10'));var Redis=require('ioredis');var authService=require(_0xe616('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe616('0x12'));var logger=require(_0xe616('0x13'))(_0xe616('0x14'));var utils=require('../../config/utils');var config=require(_0xe616('0x15'));var db=require(_0xe616('0x16'))['db'];function respondWithStatusCode(_0x2e6a75,_0x59c652){_0x59c652=_0x59c652||0xcc;return function(_0x969860){if(_0x969860){return _0x2e6a75[_0xe616('0x17')](_0x59c652);}return _0x2e6a75[_0xe616('0x18')](_0x59c652)[_0xe616('0x19')]();};}function respondWithResult(_0x5a9eaf,_0x50eeea){_0x50eeea=_0x50eeea||0xc8;return function(_0x3234ee){if(_0x3234ee){return _0x5a9eaf[_0xe616('0x18')](_0x50eeea)[_0xe616('0x1a')](_0x3234ee);}};}function respondWithFilteredResult(_0x16e600,_0x87dfeb){return function(_0x1d9b06){if(_0x1d9b06){var _0x1fdc22=_0x1d9b06[_0xe616('0x1b')],_0x3cc33d=_0x87dfeb[_0xe616('0x1c')],_0x1b91e8=_0x87dfeb[_0xe616('0x1c')]+_0x87dfeb[_0xe616('0x1d')],_0x3b9f38;if(_0x1b91e8>=_0x1fdc22){_0x1b91e8=_0x1fdc22;_0x3b9f38=0xc8;}else{_0x3b9f38=0xce;}_0x16e600[_0xe616('0x18')](_0x3b9f38);return _0x16e600['set'](_0xe616('0x1e'),_0x3cc33d+'-'+_0x1b91e8+'/'+_0x1fdc22)[_0xe616('0x1a')](_0x1d9b06);}return null;};}function patchUpdates(_0x400c30){return function(_0x32a0ad){try{jsonpatch[_0xe616('0x1f')](_0x32a0ad,_0x400c30,!![]);}catch(_0x406ffb){return BPromise['reject'](_0x406ffb);}return _0x32a0ad['save']();};}function saveUpdates(_0x2a60f0,_0x5db497){return function(_0x1df5a4){if(_0x1df5a4){return _0x1df5a4['update'](_0x2a60f0)[_0xe616('0x20')](function(_0x5dda89){return _0x5dda89;});}return null;};}function removeEntity(_0x2036bc,_0x4f258f){return function(_0x2af9fa){if(_0x2af9fa){return _0x2af9fa[_0xe616('0x21')]()[_0xe616('0x20')](function(){_0x2036bc['status'](0xcc)[_0xe616('0x19')]();});}};}function handleEntityNotFound(_0x4209e5,_0x1b90ea){return function(_0x471e87){if(!_0x471e87){_0x4209e5['sendStatus'](0x194);}return _0x471e87;};}function handleError(_0x50135e,_0x22044a){_0x22044a=_0x22044a||0x1f4;return function(_0x2f1087){logger['error'](_0x2f1087[_0xe616('0x22')]);if(_0x2f1087[_0xe616('0x23')]){delete _0x2f1087[_0xe616('0x23')];}_0x50135e[_0xe616('0x18')](_0x22044a)[_0xe616('0x24')](_0x2f1087);};}exports[_0xe616('0x25')]=function(_0x40a090,_0x4d1632){var _0x58a08={},_0xc7a9a9={},_0x1d9832={'count':0x0,'rows':[]};var _0x410a0e=_[_0xe616('0x26')](db[_0xe616('0x27')][_0xe616('0x28')],function(_0x2d4caf){return{'name':_0x2d4caf['fieldName'],'type':_0x2d4caf['type']['key']};});_0xc7a9a9['model']=_[_0xe616('0x26')](_0x410a0e,_0xe616('0x23'));_0xc7a9a9[_0xe616('0x29')]=_[_0xe616('0x2a')](_0x40a090[_0xe616('0x29')]);_0xc7a9a9[_0xe616('0x2b')]=_[_0xe616('0x2c')](_0xc7a9a9[_0xe616('0x2d')],_0xc7a9a9['query']);_0x58a08[_0xe616('0x2e')]=_['intersection'](_0xc7a9a9['model'],qs[_0xe616('0x2f')](_0x40a090[_0xe616('0x29')][_0xe616('0x2f')]));_0x58a08[_0xe616('0x2e')]=_0x58a08[_0xe616('0x2e')][_0xe616('0x30')]?_0x58a08[_0xe616('0x2e')]:_0xc7a9a9[_0xe616('0x2d')];if(!_0x40a090['query'][_0xe616('0x31')](_0xe616('0x32'))){_0x58a08[_0xe616('0x1d')]=qs[_0xe616('0x1d')](_0x40a090[_0xe616('0x29')][_0xe616('0x1d')]);_0x58a08[_0xe616('0x1c')]=qs[_0xe616('0x1c')](_0x40a090[_0xe616('0x29')]['offset']);}_0x58a08[_0xe616('0x33')]=qs[_0xe616('0x34')](_0x40a090[_0xe616('0x29')][_0xe616('0x34')]);_0x58a08['where']=qs[_0xe616('0x2b')](_['pick'](_0x40a090[_0xe616('0x29')],_0xc7a9a9[_0xe616('0x2b')]),_0x410a0e);if(_0x40a090[_0xe616('0x29')][_0xe616('0x35')]){_0x58a08[_0xe616('0x36')]=_['merge'](_0x58a08[_0xe616('0x36')],{'$or':_[_0xe616('0x26')](_0x410a0e,function(_0x57fa72){if(_0x57fa72['type']!=='VIRTUAL'){var _0x28320f={};_0x28320f[_0x57fa72[_0xe616('0x23')]]={'$like':'%'+_0x40a090[_0xe616('0x29')][_0xe616('0x35')]+'%'};return _0x28320f;}})});}_0x58a08=_[_0xe616('0x37')]({},_0x58a08,_0x40a090[_0xe616('0x38')]);var _0x53eec3={'where':_0x58a08[_0xe616('0x36')]};return db['VoiceTransferReport'][_0xe616('0x1b')](_0x53eec3)[_0xe616('0x20')](function(_0x292d31){_0x1d9832[_0xe616('0x1b')]=_0x292d31;if(_0x40a090[_0xe616('0x29')][_0xe616('0x39')]){_0x58a08[_0xe616('0x3a')]=[{'all':!![]}];}return db[_0xe616('0x27')][_0xe616('0x3b')](_0x58a08);})[_0xe616('0x20')](function(_0x597388){_0x1d9832[_0xe616('0x3c')]=_0x597388;return _0x1d9832;})[_0xe616('0x20')](respondWithFilteredResult(_0x4d1632,_0x58a08))[_0xe616('0x3d')](handleError(_0x4d1632,null));};exports[_0xe616('0x3e')]=function(_0x14fc9f,_0x324cb5){var _0x19143d={'raw':!![],'where':{'id':_0x14fc9f[_0xe616('0x3f')]['id']}},_0x4a7eec={};_0x4a7eec[_0xe616('0x2d')]=_[_0xe616('0x2a')](db[_0xe616('0x27')][_0xe616('0x28')]);_0x4a7eec[_0xe616('0x29')]=_[_0xe616('0x2a')](_0x14fc9f[_0xe616('0x29')]);_0x4a7eec[_0xe616('0x2b')]=_[_0xe616('0x2c')](_0x4a7eec[_0xe616('0x2d')],_0x4a7eec['query']);_0x19143d[_0xe616('0x2e')]=_[_0xe616('0x2c')](_0x4a7eec[_0xe616('0x2d')],qs[_0xe616('0x2f')](_0x14fc9f[_0xe616('0x29')][_0xe616('0x2f')]));_0x19143d[_0xe616('0x2e')]=_0x19143d[_0xe616('0x2e')][_0xe616('0x30')]?_0x19143d[_0xe616('0x2e')]:_0x4a7eec[_0xe616('0x2d')];if(_0x14fc9f[_0xe616('0x29')][_0xe616('0x39')]){_0x19143d['include']=[{'all':!![]}];}_0x19143d=_[_0xe616('0x37')]({},_0x19143d,_0x14fc9f['options']);return db[_0xe616('0x27')][_0xe616('0x40')](_0x19143d)['then'](handleEntityNotFound(_0x324cb5,null))[_0xe616('0x20')](respondWithResult(_0x324cb5,null))[_0xe616('0x3d')](handleError(_0x324cb5,null));};exports[_0xe616('0x41')]=function(_0x35e084,_0x2da224){return db['VoiceTransferReport'][_0xe616('0x41')](_0x35e084[_0xe616('0x42')],{})['then'](respondWithResult(_0x2da224,0xc9))[_0xe616('0x3d')](handleError(_0x2da224,null));};exports[_0xe616('0x43')]=function(_0x20aa50,_0x2c4c5f){if(_0x20aa50[_0xe616('0x42')]['id']){delete _0x20aa50[_0xe616('0x42')]['id'];}return db[_0xe616('0x27')][_0xe616('0x40')]({'where':{'id':_0x20aa50[_0xe616('0x3f')]['id']}})[_0xe616('0x20')](handleEntityNotFound(_0x2c4c5f,null))[_0xe616('0x20')](saveUpdates(_0x20aa50[_0xe616('0x42')],null))['then'](respondWithResult(_0x2c4c5f,null))[_0xe616('0x3d')](handleError(_0x2c4c5f,null));};exports['destroy']=function(_0x5e6d98,_0x59d77b){return db['VoiceTransferReport']['find']({'where':{'id':_0x5e6d98['params']['id']}})['then'](handleEntityNotFound(_0x59d77b,null))[_0xe616('0x20')](removeEntity(_0x59d77b,null))[_0xe616('0x3d')](handleError(_0x59d77b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 20972a9..84a3080 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 _0x8eaa=['bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x5592c9,_0x451a19){var _0xe8679e=function(_0x465e31){while(--_0x465e31){_0x5592c9['push'](_0x5592c9['shift']());}};_0xe8679e(++_0x451a19);}(_0x8eaa,0x165));var _0xa8ea=function(_0x53e08d,_0x374a33){_0x53e08d=_0x53e08d-0x0;var _0x493968=_0x8eaa[_0x53e08d];return _0x493968;};'use strict';var _=require(_0xa8ea('0x0'));var util=require(_0xa8ea('0x1'));var logger=require(_0xa8ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa8ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8ea('0x4'));var rimraf=require(_0xa8ea('0x5'));var config=require(_0xa8ea('0x6'));var attributes=require(_0xa8ea('0x7'));module['exports']=function(_0x223b45,_0x42d14d){return _0x223b45['define'](_0xa8ea('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddab=['api','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x1931d6,_0x4d2b7d){var _0x54fdf9=function(_0x2f7f40){while(--_0x2f7f40){_0x1931d6['push'](_0x1931d6['shift']());}};_0x54fdf9(++_0x4d2b7d);}(_0xddab,0x1d8));var _0xbdda=function(_0x273f21,_0x73ed47){_0x273f21=_0x273f21-0x0;var _0x52aae9=_0xddab[_0x273f21];return _0x52aae9;};'use strict';var _=require(_0xbdda('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbdda('0x1'));var moment=require('moment');var BPromise=require(_0xbdda('0x2'));var rp=require(_0xbdda('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdda('0x4'));var config=require(_0xbdda('0x5'));var attributes=require(_0xbdda('0x6'));module[_0xbdda('0x7')]=function(_0x56597f,_0x1fb9c1){return _0x56597f[_0xbdda('0x8')](_0xbdda('0x9'),attributes,{'tableName':_0xbdda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 5a444de..eee9308 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 _0x0f59=['CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','debug','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x0f59,0x1ed));var _0x90f5=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x0f59[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0x90f5('0x0'));var util=require(_0x90f5('0x1'));var moment=require(_0x90f5('0x2'));var BPromise=require(_0x90f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f5('0x5'));var logger=require('../../config/logger')(_0x90f5('0x6'));var config=require(_0x90f5('0x7'));var jayson=require(_0x90f5('0x8'));var client=jayson[_0x90f5('0x9')][_0x90f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5f81,_0x44580e,_0x18c49a){return new BPromise(function(_0x101b22,_0x5556bd){return client[_0x90f5('0xb')](_0x1b5f81,_0x18c49a)[_0x90f5('0xc')](function(_0x1398a0){logger['info'](_0x90f5('0xd'),_0x44580e,_0x90f5('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x44580e,_0x90f5('0xe'),JSON[_0x90f5('0xf')](_0x1398a0));if(_0x1398a0[_0x90f5('0x10')]){if(_0x1398a0['error'][_0x90f5('0x11')]===0x1f4){logger[_0x90f5('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x44580e,_0x1398a0[_0x90f5('0x10')][_0x90f5('0x12')]);return _0x5556bd(_0x1398a0['error']['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x44580e,_0x1398a0[_0x90f5('0x10')][_0x90f5('0x12')]);return _0x101b22(_0x1398a0[_0x90f5('0x10')][_0x90f5('0x12')]);}else{logger['info'](_0x90f5('0xd'),_0x44580e,_0x90f5('0xe'));_0x101b22(_0x1398a0[_0x90f5('0x13')]['message']);}})['catch'](function(_0x3fcf1c){logger[_0x90f5('0x10')](_0x90f5('0xd'),_0x44580e,_0x3fcf1c);_0x5556bd(_0x3fcf1c);});});}exports[_0x90f5('0x14')]=function(_0x1ca0d3){var _0x2a18db=this;return new Promise(function(_0x1acf09,_0x5638d3){return db[_0x90f5('0x15')]['create'](_0x1ca0d3[_0x90f5('0x16')],{'raw':_0x1ca0d3[_0x90f5('0x17')]?_0x1ca0d3[_0x90f5('0x17')][_0x90f5('0x18')]===undefined?!![]:![]:!![]})[_0x90f5('0xc')](function(_0x2f6b33){logger['info'](_0x90f5('0x14'),_0x1ca0d3);logger[_0x90f5('0x19')](_0x90f5('0x14'),_0x1ca0d3,JSON[_0x90f5('0xf')](_0x2f6b33));_0x1acf09(_0x2f6b33);})[_0x90f5('0x1a')](function(_0x19717f){logger[_0x90f5('0x10')](_0x90f5('0x14'),_0x19717f[_0x90f5('0x12')],_0x1ca0d3);_0x5638d3(_0x2a18db[_0x90f5('0x10')](0x1f4,_0x19717f[_0x90f5('0x12')]));});});}; \ No newline at end of file +var _0x17e5=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','raw','catch','lodash','util','moment','bluebird'];(function(_0x33c320,_0x3562af){var _0x159fc3=function(_0x1407a2){while(--_0x1407a2){_0x33c320['push'](_0x33c320['shift']());}};_0x159fc3(++_0x3562af);}(_0x17e5,0x15a));var _0x517e=function(_0xa10bb,_0x20e669){_0xa10bb=_0xa10bb-0x0;var _0x5a1168=_0x17e5[_0xa10bb];return _0x5a1168;};'use strict';var _=require(_0x517e('0x0'));var util=require(_0x517e('0x1'));var moment=require(_0x517e('0x2'));var BPromise=require(_0x517e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x517e('0x4'));var db=require(_0x517e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x517e('0x6'));var config=require(_0x517e('0x7'));var jayson=require(_0x517e('0x8'));var client=jayson[_0x517e('0x9')][_0x517e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x98327a,_0x270ade,_0x58b4ec){return new BPromise(function(_0x1f3b09,_0x4be49f){return client[_0x517e('0xb')](_0x98327a,_0x58b4ec)['then'](function(_0x4cd4b7){logger[_0x517e('0xc')](_0x517e('0xd'),_0x270ade,_0x517e('0xe'));logger[_0x517e('0xf')](_0x517e('0x10'),_0x270ade,_0x517e('0xe'),JSON[_0x517e('0x11')](_0x4cd4b7));if(_0x4cd4b7[_0x517e('0x12')]){if(_0x4cd4b7['error'][_0x517e('0x13')]===0x1f4){logger[_0x517e('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x270ade,_0x4cd4b7[_0x517e('0x12')][_0x517e('0x14')]);return _0x4be49f(_0x4cd4b7[_0x517e('0x12')]['message']);}logger[_0x517e('0x12')](_0x517e('0xd'),_0x270ade,_0x4cd4b7[_0x517e('0x12')][_0x517e('0x14')]);return _0x1f3b09(_0x4cd4b7[_0x517e('0x12')][_0x517e('0x14')]);}else{logger[_0x517e('0xc')](_0x517e('0xd'),_0x270ade,_0x517e('0xe'));_0x1f3b09(_0x4cd4b7[_0x517e('0x15')][_0x517e('0x14')]);}})['catch'](function(_0x33240e){logger['error'](_0x517e('0xd'),_0x270ade,_0x33240e);_0x4be49f(_0x33240e);});});}exports[_0x517e('0x16')]=function(_0xa50eea){var _0x488770=this;return new Promise(function(_0x18e6b4,_0x1e132f){return db['VoiceTransferReport']['create'](_0xa50eea['body'],{'raw':_0xa50eea['options']?_0xa50eea['options'][_0x517e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x35565){logger[_0x517e('0xc')](_0x517e('0x16'),_0xa50eea);logger['debug']('CreateVoiceTransferReport',_0xa50eea,JSON['stringify'](_0x35565));_0x18e6b4(_0x35565);})[_0x517e('0x18')](function(_0x1b9d31){logger[_0x517e('0x12')](_0x517e('0x16'),_0x1b9d31[_0x517e('0x14')],_0xa50eea);_0x1e132f(_0x488770[_0x517e('0x12')](0x1f4,_0x1b9d31[_0x517e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1447fa6..52e533a 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 _0xac55=['/hold','hold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','/hangup','/answer','answer'];(function(_0x22ad09,_0x2b17bd){var _0x480175=function(_0x5d9467){while(--_0x5d9467){_0x22ad09['push'](_0x22ad09['shift']());}};_0x480175(++_0x2b17bd);}(_0xac55,0x1c8));var _0x5ac5=function(_0x16ee9a,_0x1929ec){_0x16ee9a=_0x16ee9a-0x0;var _0x8c3c=_0xac55[_0x16ee9a];return _0x8c3c;};'use strict';var express=require(_0x5ac5('0x0'));var router=express[_0x5ac5('0x1')]();var auth=require(_0x5ac5('0x2'));var controller=require(_0x5ac5('0x3'));router['post'](_0x5ac5('0x4'),auth[_0x5ac5('0x5')](),auth[_0x5ac5('0x6')](),controller[_0x5ac5('0x7')]);router[_0x5ac5('0x8')](_0x5ac5('0x9'),auth[_0x5ac5('0x5')](),auth['canUpdate'](),controller['hangup']);router[_0x5ac5('0x8')](_0x5ac5('0xa'),auth[_0x5ac5('0x5')](),auth[_0x5ac5('0x6')](),controller[_0x5ac5('0xb')]);router[_0x5ac5('0x8')](_0x5ac5('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x5ac5('0xd')]);router[_0x5ac5('0x8')]('/unhold',auth[_0x5ac5('0x5')](),auth[_0x5ac5('0x6')](),controller['unhold']);router[_0x5ac5('0x8')](_0x5ac5('0xe'),auth['isAuthenticated'](),auth[_0x5ac5('0x6')](),controller[_0x5ac5('0xf')]);router[_0x5ac5('0x8')](_0x5ac5('0x10'),auth[_0x5ac5('0x5')](),auth['canUpdate'](),controller[_0x5ac5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2904=['/unhold','unhold','/calls','calls','transfer','express','Router','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','hangup','/answer','answer','/hold','hold'];(function(_0x1763f4,_0x1a418c){var _0x41aa95=function(_0x315565){while(--_0x315565){_0x1763f4['push'](_0x1763f4['shift']());}};_0x41aa95(++_0x1a418c);}(_0x2904,0x137));var _0x4290=function(_0x8e70e4,_0x53e414){_0x8e70e4=_0x8e70e4-0x0;var _0x5cb27f=_0x2904[_0x8e70e4];return _0x5cb27f;};'use strict';var express=require(_0x4290('0x0'));var router=express[_0x4290('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4290('0x2'));router['post'](_0x4290('0x3'),auth[_0x4290('0x4')](),auth[_0x4290('0x5')](),controller[_0x4290('0x6')]);router[_0x4290('0x7')]('/hangup',auth[_0x4290('0x4')](),auth[_0x4290('0x5')](),controller[_0x4290('0x8')]);router['post'](_0x4290('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4290('0xa')]);router['post'](_0x4290('0xb'),auth[_0x4290('0x4')](),auth['canUpdate'](),controller[_0x4290('0xc')]);router[_0x4290('0x7')](_0x4290('0xd'),auth[_0x4290('0x4')](),auth[_0x4290('0x5')](),controller[_0x4290('0xe')]);router[_0x4290('0x7')](_0x4290('0xf'),auth[_0x4290('0x4')](),auth['canUpdate'](),controller[_0x4290('0x10')]);router[_0x4290('0x7')]('/transfer',auth[_0x4290('0x4')](),auth['canUpdate'](),controller[_0x4290('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f3f38a5..42c6302 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 _0x0d77=['info','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','calls','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','defaults','localhost','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required'];(function(_0x42d134,_0x521b9f){var _0x5bacd4=function(_0x222d18){while(--_0x222d18){_0x42d134['push'](_0x42d134['shift']());}};_0x5bacd4(++_0x521b9f);}(_0x0d77,0x8b));var _0x70d7=function(_0x4b2c5a,_0x43c243){_0x4b2c5a=_0x4b2c5a-0x0;var _0x4b80e6=_0x0d77[_0x4b2c5a];return _0x4b80e6;};'use strict';var path=require(_0x70d7('0x0'));var fs=require('fs');var _=require(_0x70d7('0x1'));var db=require(_0x70d7('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x70d7('0x3'));var BPromise=require(_0x70d7('0x4'));var jayson=require(_0x70d7('0x5'));var amiClient=jayson['client'][_0x70d7('0x6')]({'port':0x232a});var logger=require(_0x70d7('0x7'))('webbarapi');var Redis=require(_0x70d7('0x8'));config[_0x70d7('0x9')]=_[_0x70d7('0xa')](config[_0x70d7('0x9')],{'host':_0x70d7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x70d7('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x70d7('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x70d7('0xd')},'callbackUrl':{'type':_0x70d7('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x70d7('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],_0x70d7('0xe')]},'sessionId':{'type':_0x70d7('0xd'),'required':[!![],_0x70d7('0xf')]},'transferNumber':{'type':_0x70d7('0xd'),'required':[!![],_0x70d7('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],_0x70d7('0xe')]},'sessionId':{'type':_0x70d7('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x70d7('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x70d7('0xc'),'required':[!![],_0x70d7('0xe')]}});function emit(_0x4e9dfd,_0x5e10fc,_0x5dfbc2){logger[_0x70d7('0x11')](_0x4e9dfd,_0x5e10fc,JSON[_0x70d7('0x12')](_0x5dfbc2));io['to'](_0x4e9dfd)[_0x70d7('0x13')](_0x5e10fc,_0x5dfbc2);}function handleError(_0x191191){return function(_0x90afee){console[_0x70d7('0x14')](_0x70d7('0x15'),_0x90afee,_0x90afee instanceof RangeError);logger[_0x70d7('0x16')](_0x90afee['stack']);if(_0x90afee instanceof RangeError){if(_0x90afee[_0x70d7('0x17')]){delete _0x90afee['name'];}_0x191191[_0x70d7('0x18')](0x194)[_0x70d7('0x19')](_0x90afee);}else{if(_0x90afee['name']){delete _0x90afee[_0x70d7('0x17')];}_0x191191['status'](0x1f4)[_0x70d7('0x19')](_0x90afee);}};}function checkError(){return function(_0x49fc68){if(!_0x49fc68){throw new RangeError(_0x70d7('0x1a'));}return _0x49fc68;};}function respondWithRpcPromise(_0x25e20c,_0xdba842){return new BPromise(function(_0x23ae30,_0x334aac){var _0x100238=amiClient;return _0x100238[_0x70d7('0x1b')](_0x25e20c,_0xdba842)[_0x70d7('0x1c')](function(_0x5de06f){if(_0x5de06f['error']){if(_0x5de06f[_0x70d7('0x16')][_0x70d7('0x1d')]===0x1f4){return _0x334aac(_0x5de06f[_0x70d7('0x16')][_0x70d7('0x1e')]);}return _0x23ae30(_0x5de06f['error'][_0x70d7('0x1e')]);}else{_0x23ae30(_0x5de06f[_0x70d7('0x1f')]);}})['catch'](function(_0x57e98c){_0x334aac(_0x57e98c);});});}function getAgent(_0x3d44fa){return db[_0x70d7('0x20')][_0x70d7('0x21')]({'where':{'id':_0x3d44fa,'role':_0x70d7('0x22')}})[_0x70d7('0x1c')](checkError());}function getAgentCheckSession(_0x1c3a9d,_0x2ccce1){return new BPromise(function(_0x2d3bc0,_0x64586a){var _0x586dcc=respondWithRpcPromise(_0x70d7('0x23'));var _0x5e9b43=getAgent(_0x1c3a9d);Promise['all']([_0x586dcc,_0x5e9b43])[_0x70d7('0x1c')](function(_0x3f078d){var _0x1ce4a0=_0x3f078d[0x0];var _0x1159d6=_0x3f078d[0x1];var _0xa83d87=_[_0x70d7('0x24')](_0x1ce4a0[_0x70d7('0x25')],function(_0x405f05){return _0x405f05[_0x70d7('0x26')]==_0x1159d6['id']&&_0x405f05[_0x70d7('0x27')]==_0x2ccce1;});if(_0xa83d87[_0x70d7('0x28')]==0x1){_0x2d3bc0(_0x1159d6);}else{_0x64586a(new RangeError(_0x70d7('0x29')+_0x2ccce1+_0x70d7('0x2a')));}});});}exports[_0x70d7('0x2b')]=function(_0x5550a2,_0x1c84c3){logger[_0x70d7('0x11')](_0x70d7('0x2c'),_0x5550a2[_0x70d7('0x2d')]);var _0x3d0814=originateValidation[_0x70d7('0x2e')](_0x5550a2['body']);if(_0x3d0814[_0x70d7('0x28')]>0x0){return _0x1c84c3[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0x3d0814);}var _0x3257c5=_0x5550a2[_0x70d7('0x2d')][_0x70d7('0x30')];var _0x1b14df=_0x5550a2[_0x70d7('0x2d')][_0x70d7('0x31')];var _0x12aa60=_0x5550a2['body'][_0x70d7('0x32')];var _0xeebec8=_0x5550a2[_0x70d7('0x2d')][_0x70d7('0x33')];return getAgent(_0x3257c5)[_0x70d7('0x1c')](function(_0xe7fd2f){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0xe7fd2f[_0x70d7('0x17')]);emit(util[_0x70d7('0x35')](_0x70d7('0x36'),_0xe7fd2f[_0x70d7('0x17')]),_0x70d7('0x37'),{'callNumber':_0x1b14df,'callerId':_0x12aa60,'callbackUrl':_0xeebec8});return _0x1c84c3[_0x70d7('0x18')](0xc8)[_0x70d7('0x2f')]({'error':![],'message':_0x70d7('0x38')});})[_0x70d7('0x39')](handleError(_0x1c84c3));};exports[_0x70d7('0x3a')]=function(_0x429fc9,_0x77d8b0){logger[_0x70d7('0x11')](_0x70d7('0x3b'),_0x429fc9[_0x70d7('0x2d')]);var _0xb191c5=hangupValidation[_0x70d7('0x2e')](_0x429fc9[_0x70d7('0x2d')]);if(_0xb191c5['length']>0x0){return _0x77d8b0[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0xb191c5);}var _0x343bd6=_0x429fc9[_0x70d7('0x2d')]['userId'];var _0x1e0553=_0x429fc9['body']['sessionId'];return getAgent(_0x343bd6)[_0x70d7('0x1c')](function(_0x552976){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x552976['name']);emit(util[_0x70d7('0x35')]('user:%s',_0x552976[_0x70d7('0x17')]),'webbar:hangup',{'sessionId':_0x1e0553});return _0x77d8b0[_0x70d7('0x18')](0xc8)['json']({'error':![],'message':_0x70d7('0x3c')});})[_0x70d7('0x39')](handleError(_0x77d8b0));};exports[_0x70d7('0x3d')]=function(_0x2a399d,_0x2ccfed){logger['info'](_0x70d7('0x3e'),_0x2a399d[_0x70d7('0x2d')]);var _0x1750f3=answerValidation[_0x70d7('0x2e')](_0x2a399d['body']);if(_0x1750f3[_0x70d7('0x28')]>0x0){return _0x2ccfed['status'](0x190)[_0x70d7('0x2f')](_0x1750f3);}var _0x3812dc=_0x2a399d[_0x70d7('0x2d')][_0x70d7('0x30')];var _0x10817a=_0x2a399d[_0x70d7('0x2d')][_0x70d7('0x27')];return getAgent(_0x3812dc)['then'](function(_0x26df78){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x26df78[_0x70d7('0x17')]);emit(util[_0x70d7('0x35')](_0x70d7('0x36'),_0x26df78[_0x70d7('0x17')]),'webbar:answer',{'sessionId':_0x10817a});return _0x2ccfed['status'](0xc8)[_0x70d7('0x2f')]({'error':![],'message':_0x70d7('0x3f')});})[_0x70d7('0x39')](handleError(_0x2ccfed));};exports[_0x70d7('0x40')]=function(_0x247b20,_0x4c7940){logger[_0x70d7('0x11')](_0x70d7('0x41'),_0x247b20[_0x70d7('0x2d')]);var _0x4cc0f5=holdValidation['validate'](_0x247b20['body']);if(_0x4cc0f5[_0x70d7('0x28')]>0x0){return _0x4c7940[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0x4cc0f5);}var _0x3c94d1=_0x247b20[_0x70d7('0x2d')][_0x70d7('0x30')];var _0x58cc41=_0x247b20['body'][_0x70d7('0x27')];return getAgent(_0x3c94d1)['then'](function(_0x4a9b84){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x4a9b84[_0x70d7('0x17')]);emit(util['format'](_0x70d7('0x36'),_0x4a9b84[_0x70d7('0x17')]),_0x70d7('0x42'),{'sessionId':_0x58cc41});return _0x4c7940[_0x70d7('0x18')](0xc8)['json']({'error':![],'message':_0x70d7('0x43')});})[_0x70d7('0x39')](handleError(_0x4c7940));};exports['unhold']=function(_0x2f94e6,_0x1fbb91){logger[_0x70d7('0x11')]('unhold\x20fired:',_0x2f94e6['body']);var _0x226c83=unholdValidation[_0x70d7('0x2e')](_0x2f94e6[_0x70d7('0x2d')]);if(_0x226c83[_0x70d7('0x28')]>0x0){return _0x1fbb91[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0x226c83);}var _0x4c3bc8=_0x2f94e6['body'][_0x70d7('0x30')];var _0x5a13f0=_0x2f94e6['body'][_0x70d7('0x27')];return getAgent(_0x4c3bc8)[_0x70d7('0x1c')](function(_0x4b6c45){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x4b6c45[_0x70d7('0x17')]);emit(util[_0x70d7('0x35')]('user:%s',_0x4b6c45['name']),_0x70d7('0x44'),{'sessionId':_0x5a13f0});return _0x1fbb91['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x70d7('0x39')](handleError(_0x1fbb91));};exports[_0x70d7('0x45')]=function(_0x21db92,_0x27d16e){logger[_0x70d7('0x11')](_0x70d7('0x46'),_0x27d16e[_0x70d7('0x2d')]);var _0xd36207=callsValidation[_0x70d7('0x2e')](_0x21db92['body']);if(_0xd36207[_0x70d7('0x28')]>0x0){return _0x27d16e[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0xd36207);}var _0x362c3d=_0x21db92[_0x70d7('0x2d')][_0x70d7('0x30')];var _0x2a2d83=respondWithRpcPromise(_0x70d7('0x23'));var _0x3b3376=getAgent(_0x362c3d);return Promise['all']([_0x2a2d83,_0x3b3376])[_0x70d7('0x1c')](function(_0x5c9be7){var _0xe442dc=_0x5c9be7[0x0];var _0x3d93c5=_0x5c9be7[0x1];var _0x184b51=_['filter'](_0xe442dc[_0x70d7('0x25')],function(_0x12cf11){return _0x12cf11[_0x70d7('0x26')]==_0x3d93c5['id'];});return _0x27d16e[_0x70d7('0x18')](0xc8)['json']({'count':_0x184b51[_0x70d7('0x28')],'rows':_0x184b51});})['catch'](handleError(_0x27d16e));};exports['conference']=function(_0x45b1fa,_0x3cedaa){logger[_0x70d7('0x11')](_0x70d7('0x47'),_0x45b1fa[_0x70d7('0x2d')]);var _0x4a0c27=conferenceValidation['validate'](_0x45b1fa[_0x70d7('0x2d')]);if(_0x4a0c27['length']>0x0){return _0x3cedaa[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0x4a0c27);}var _0x139aee=_0x45b1fa[_0x70d7('0x2d')][_0x70d7('0x30')];return getAgent(_0x139aee)[_0x70d7('0x1c')](function(_0x1a7481){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x1a7481[_0x70d7('0x17')]);emit(util[_0x70d7('0x35')]('user:%s',_0x1a7481[_0x70d7('0x17')]),_0x70d7('0x48'));return _0x3cedaa[_0x70d7('0x18')](0xc8)[_0x70d7('0x2f')]({'error':![],'message':_0x70d7('0x49')});})['catch'](handleError(_0x3cedaa));};exports[_0x70d7('0x4a')]=function(_0x1c7a2a,_0x5d974e){logger[_0x70d7('0x11')]('transfer\x20fired:',_0x1c7a2a[_0x70d7('0x2d')]);var _0x5d606f=transferValidation[_0x70d7('0x2e')](_0x1c7a2a[_0x70d7('0x2d')]);if(_0x5d606f[_0x70d7('0x28')]>0x0){return _0x5d974e[_0x70d7('0x18')](0x190)[_0x70d7('0x2f')](_0x5d606f);}var _0x1655bf=_0x1c7a2a['body'][_0x70d7('0x30')];var _0x5ad885=_0x1c7a2a[_0x70d7('0x2d')][_0x70d7('0x27')];var _0x38b5ee=_0x1c7a2a[_0x70d7('0x2d')][_0x70d7('0x4b')];return getAgent(_0x1655bf)[_0x70d7('0x1c')](function(_0x5e39c4){logger[_0x70d7('0x11')](_0x70d7('0x34'),_0x5e39c4[_0x70d7('0x17')]);emit(util['format'](_0x70d7('0x36'),_0x5e39c4[_0x70d7('0x17')]),_0x70d7('0x4c'),{'sessionId':_0x5ad885,'transferNumber':_0x38b5ee});return _0x5d974e[_0x70d7('0x18')](0xc8)['json']({'error':![],'message':_0x70d7('0x4d')});})[_0x70d7('0x39')](handleError(_0x5d974e));}; \ No newline at end of file +var _0x818f=['then','code','message','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','body','json','userId','callNumber','callbackUrl','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','user:%s','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','status','send','name','NotFound','request'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x818f,0x1da));var _0xf818=function(_0x39df48,_0x718404){_0x39df48=_0x39df48-0x0;var _0x546156=_0x818f[_0x39df48];return _0x546156;};'use strict';var path=require(_0xf818('0x0'));var fs=require('fs');var _=require(_0xf818('0x1'));var db=require(_0xf818('0x2'))['db'];var config=require(_0xf818('0x3'));var util=require(_0xf818('0x4'));var BPromise=require(_0xf818('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf818('0x6')][_0xf818('0x7')]({'port':0x232a});var logger=require(_0xf818('0x8'))(_0xf818('0x9'));var Redis=require(_0xf818('0xa'));config[_0xf818('0xb')]=_[_0xf818('0xc')](config[_0xf818('0xb')],{'host':_0xf818('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf818('0xb')]));var Schema=require(_0xf818('0xe'));var originateValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xf818('0x10')]},'callerId':{'type':_0xf818('0x11')},'callbackUrl':{'type':_0xf818('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]},'sessionId':{'type':_0xf818('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf818('0x11'),'required':[!![],_0xf818('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]},'sessionId':{'type':_0xf818('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf818('0xf'),'required':[!![],_0xf818('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x81f4bb,_0x4c49f1,_0x13ed62){logger[_0xf818('0x14')](_0x81f4bb,_0x4c49f1,JSON['stringify'](_0x13ed62));io['to'](_0x81f4bb)[_0xf818('0x15')](_0x4c49f1,_0x13ed62);}function handleError(_0x2d3b2a){return function(_0x295a83){console['log'](_0xf818('0x16'),_0x295a83,_0x295a83 instanceof RangeError);logger[_0xf818('0x17')](_0x295a83[_0xf818('0x18')]);if(_0x295a83 instanceof RangeError){if(_0x295a83['name']){delete _0x295a83['name'];}_0x2d3b2a[_0xf818('0x19')](0x194)[_0xf818('0x1a')](_0x295a83);}else{if(_0x295a83['name']){delete _0x295a83[_0xf818('0x1b')];}_0x2d3b2a['status'](0x1f4)[_0xf818('0x1a')](_0x295a83);}};}function checkError(){return function(_0x40c28d){if(!_0x40c28d){throw new RangeError(_0xf818('0x1c'));}return _0x40c28d;};}function respondWithRpcPromise(_0x48ea10,_0x333354){return new BPromise(function(_0x3a1e90,_0x5c5c4a){var _0x324a30=amiClient;return _0x324a30[_0xf818('0x1d')](_0x48ea10,_0x333354)[_0xf818('0x1e')](function(_0x236a4e){if(_0x236a4e[_0xf818('0x17')]){if(_0x236a4e[_0xf818('0x17')][_0xf818('0x1f')]===0x1f4){return _0x5c5c4a(_0x236a4e['error']['message']);}return _0x3a1e90(_0x236a4e[_0xf818('0x17')][_0xf818('0x20')]);}else{_0x3a1e90(_0x236a4e['result']);}})[_0xf818('0x21')](function(_0x21be3c){_0x5c5c4a(_0x21be3c);});});}function getAgent(_0x57627f){return db[_0xf818('0x22')][_0xf818('0x23')]({'where':{'id':_0x57627f,'role':_0xf818('0x24')}})[_0xf818('0x1e')](checkError());}function getAgentCheckSession(_0x22f5af,_0x2bfe83){return new BPromise(function(_0x4eba3f,_0x382721){var _0x483262=respondWithRpcPromise(_0xf818('0x25'));var _0x56f2d2=getAgent(_0x22f5af);Promise['all']([_0x483262,_0x56f2d2])['then'](function(_0x1f806c){var _0x8b17e9=_0x1f806c[0x0];var _0x924cdd=_0x1f806c[0x1];var _0x586d5e=_[_0xf818('0x26')](_0x8b17e9[_0xf818('0x27')],function(_0x445ec3){return _0x445ec3[_0xf818('0x28')]==_0x924cdd['id']&&_0x445ec3[_0xf818('0x29')]==_0x2bfe83;});if(_0x586d5e[_0xf818('0x2a')]==0x1){_0x4eba3f(_0x924cdd);}else{_0x382721(new RangeError(_0xf818('0x2b')+_0x2bfe83+'\x20not\x20found!'));}});});}exports['originate']=function(_0x364672,_0x39b303){logger[_0xf818('0x14')]('originate\x20fired:',_0x364672[_0xf818('0x2c')]);var _0x29a221=originateValidation['validate'](_0x364672[_0xf818('0x2c')]);if(_0x29a221[_0xf818('0x2a')]>0x0){return _0x39b303[_0xf818('0x19')](0x190)[_0xf818('0x2d')](_0x29a221);}var _0x135af2=_0x364672['body'][_0xf818('0x2e')];var _0x427e1=_0x364672[_0xf818('0x2c')][_0xf818('0x2f')];var _0x4f0f28=_0x364672[_0xf818('0x2c')]['callerId'];var _0xa7a133=_0x364672[_0xf818('0x2c')][_0xf818('0x30')];return getAgent(_0x135af2)[_0xf818('0x1e')](function(_0x27e649){logger[_0xf818('0x14')]('entityFound:',_0x27e649[_0xf818('0x1b')]);emit(util['format']('user:%s',_0x27e649['name']),_0xf818('0x31'),{'callNumber':_0x427e1,'callerId':_0x4f0f28,'callbackUrl':_0xa7a133});return _0x39b303[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x32')});})[_0xf818('0x21')](handleError(_0x39b303));};exports[_0xf818('0x33')]=function(_0x4d0f08,_0x28b012){logger[_0xf818('0x14')](_0xf818('0x34'),_0x4d0f08[_0xf818('0x2c')]);var _0x31aa99=hangupValidation[_0xf818('0xe')](_0x4d0f08[_0xf818('0x2c')]);if(_0x31aa99[_0xf818('0x2a')]>0x0){return _0x28b012[_0xf818('0x19')](0x190)['json'](_0x31aa99);}var _0x478db4=_0x4d0f08[_0xf818('0x2c')]['userId'];var _0x286652=_0x4d0f08[_0xf818('0x2c')][_0xf818('0x29')];return getAgent(_0x478db4)['then'](function(_0x4e83dc){logger[_0xf818('0x14')](_0xf818('0x35'),_0x4e83dc[_0xf818('0x1b')]);emit(util[_0xf818('0x36')](_0xf818('0x37'),_0x4e83dc[_0xf818('0x1b')]),_0xf818('0x38'),{'sessionId':_0x286652});return _0x28b012[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x39')});})['catch'](handleError(_0x28b012));};exports['answer']=function(_0x165ad8,_0xe4f99a){logger[_0xf818('0x14')]('answer\x20fired:',_0x165ad8['body']);var _0x4b8f89=answerValidation['validate'](_0x165ad8[_0xf818('0x2c')]);if(_0x4b8f89[_0xf818('0x2a')]>0x0){return _0xe4f99a[_0xf818('0x19')](0x190)[_0xf818('0x2d')](_0x4b8f89);}var _0x3c8382=_0x165ad8[_0xf818('0x2c')]['userId'];var _0x53a72a=_0x165ad8['body'][_0xf818('0x29')];return getAgent(_0x3c8382)['then'](function(_0x281d96){logger[_0xf818('0x14')](_0xf818('0x35'),_0x281d96[_0xf818('0x1b')]);emit(util[_0xf818('0x36')](_0xf818('0x37'),_0x281d96['name']),_0xf818('0x3a'),{'sessionId':_0x53a72a});return _0xe4f99a['status'](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x3b')});})['catch'](handleError(_0xe4f99a));};exports[_0xf818('0x3c')]=function(_0x28657a,_0x3dad62){logger['info'](_0xf818('0x3d'),_0x28657a[_0xf818('0x2c')]);var _0x404848=holdValidation[_0xf818('0xe')](_0x28657a[_0xf818('0x2c')]);if(_0x404848[_0xf818('0x2a')]>0x0){return _0x3dad62[_0xf818('0x19')](0x190)[_0xf818('0x2d')](_0x404848);}var _0x2bba48=_0x28657a[_0xf818('0x2c')][_0xf818('0x2e')];var _0x363181=_0x28657a[_0xf818('0x2c')][_0xf818('0x29')];return getAgent(_0x2bba48)[_0xf818('0x1e')](function(_0x42dbcc){logger[_0xf818('0x14')]('entityFound:',_0x42dbcc[_0xf818('0x1b')]);emit(util['format']('user:%s',_0x42dbcc[_0xf818('0x1b')]),'webbar:hold',{'sessionId':_0x363181});return _0x3dad62['status'](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x3e')});})[_0xf818('0x21')](handleError(_0x3dad62));};exports[_0xf818('0x3f')]=function(_0x1d8a56,_0x48eeaf){logger['info']('unhold\x20fired:',_0x1d8a56[_0xf818('0x2c')]);var _0x194aab=unholdValidation[_0xf818('0xe')](_0x1d8a56[_0xf818('0x2c')]);if(_0x194aab[_0xf818('0x2a')]>0x0){return _0x48eeaf[_0xf818('0x19')](0x190)['json'](_0x194aab);}var _0xfb3474=_0x1d8a56[_0xf818('0x2c')][_0xf818('0x2e')];var _0x415c6f=_0x1d8a56[_0xf818('0x2c')][_0xf818('0x29')];return getAgent(_0xfb3474)['then'](function(_0x36b8cd){logger['info']('entityFound:',_0x36b8cd['name']);emit(util['format'](_0xf818('0x37'),_0x36b8cd['name']),_0xf818('0x40'),{'sessionId':_0x415c6f});return _0x48eeaf[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x41')});})[_0xf818('0x21')](handleError(_0x48eeaf));};exports[_0xf818('0x42')]=function(_0xcc415c,_0x439a96){logger[_0xf818('0x14')](_0xf818('0x43'),_0x439a96[_0xf818('0x2c')]);var _0x35d032=callsValidation[_0xf818('0xe')](_0xcc415c[_0xf818('0x2c')]);if(_0x35d032[_0xf818('0x2a')]>0x0){return _0x439a96[_0xf818('0x19')](0x190)[_0xf818('0x2d')](_0x35d032);}var _0x33a04c=_0xcc415c[_0xf818('0x2c')]['userId'];var _0x172853=respondWithRpcPromise(_0xf818('0x25'));var _0x31a788=getAgent(_0x33a04c);return Promise['all']([_0x172853,_0x31a788])['then'](function(_0x48c888){var _0x2e8b53=_0x48c888[0x0];var _0x442895=_0x48c888[0x1];var _0x4d6fb3=_[_0xf818('0x26')](_0x2e8b53['rows'],function(_0x4aff09){return _0x4aff09['UserId']==_0x442895['id'];});return _0x439a96[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'count':_0x4d6fb3['length'],'rows':_0x4d6fb3});})[_0xf818('0x21')](handleError(_0x439a96));};exports[_0xf818('0x44')]=function(_0x4fec6e,_0x2696fb){logger[_0xf818('0x14')]('conference\x20fired:',_0x4fec6e[_0xf818('0x2c')]);var _0x34243e=conferenceValidation['validate'](_0x4fec6e[_0xf818('0x2c')]);if(_0x34243e[_0xf818('0x2a')]>0x0){return _0x2696fb['status'](0x190)[_0xf818('0x2d')](_0x34243e);}var _0x1a64d7=_0x4fec6e[_0xf818('0x2c')][_0xf818('0x2e')];return getAgent(_0x1a64d7)['then'](function(_0x1ba418){logger[_0xf818('0x14')](_0xf818('0x35'),_0x1ba418[_0xf818('0x1b')]);emit(util[_0xf818('0x36')](_0xf818('0x37'),_0x1ba418[_0xf818('0x1b')]),'webbar:conference');return _0x2696fb[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xf818('0x21')](handleError(_0x2696fb));};exports['transfer']=function(_0x98b63f,_0x4bef26){logger[_0xf818('0x14')](_0xf818('0x45'),_0x98b63f['body']);var _0x17c4b5=transferValidation['validate'](_0x98b63f[_0xf818('0x2c')]);if(_0x17c4b5['length']>0x0){return _0x4bef26[_0xf818('0x19')](0x190)[_0xf818('0x2d')](_0x17c4b5);}var _0x2cbce5=_0x98b63f[_0xf818('0x2c')][_0xf818('0x2e')];var _0x5a68e3=_0x98b63f[_0xf818('0x2c')][_0xf818('0x29')];var _0x35998c=_0x98b63f['body']['transferNumber'];return getAgent(_0x2cbce5)[_0xf818('0x1e')](function(_0x2bd100){logger[_0xf818('0x14')]('entityFound:',_0x2bd100[_0xf818('0x1b')]);emit(util[_0xf818('0x36')](_0xf818('0x37'),_0x2bd100[_0xf818('0x1b')]),_0xf818('0x46'),{'sessionId':_0x5a68e3,'transferNumber':_0x35998c});return _0x4bef26[_0xf818('0x19')](0xc8)[_0xf818('0x2d')]({'error':![],'message':_0xf818('0x47')});})[_0xf818('0x21')](handleError(_0x4bef26));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2ace8ae..f3f4a29 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 _0xf244=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','notify','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAgents'];(function(_0x2aaf5b,_0x1679fe){var _0x455adb=function(_0x37eedd){while(--_0x37eedd){_0x2aaf5b['push'](_0x2aaf5b['shift']());}};_0x455adb(++_0x1679fe);}(_0xf244,0x160));var _0x4f24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf244[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x4f24('0x0'));var util=require('util');var path=require(_0x4f24('0x1'));var timeout=require(_0x4f24('0x2'));var express=require(_0x4f24('0x3'));var router=express['Router']();var auth=require(_0x4f24('0x4'));var interaction=require(_0x4f24('0x5'));var config=require(_0x4f24('0x6'));var controller=require('./whatsappAccount.controller');router[_0x4f24('0x7')]('/',auth[_0x4f24('0x8')](),controller[_0x4f24('0x9')]);router[_0x4f24('0x7')](_0x4f24('0xa'),auth[_0x4f24('0x8')](),controller['describe']);router['get']('/:id',auth[_0x4f24('0x8')](),controller['show']);router[_0x4f24('0x7')](_0x4f24('0xb'),auth[_0x4f24('0x8')](),controller[_0x4f24('0xc')]);router[_0x4f24('0x7')]('/:id/canned_answers',auth[_0x4f24('0x8')](),controller[_0x4f24('0xd')]);router[_0x4f24('0x7')](_0x4f24('0xe'),auth[_0x4f24('0x8')](),controller[_0x4f24('0xf')]);router[_0x4f24('0x7')](_0x4f24('0x10'),auth[_0x4f24('0x8')](),controller[_0x4f24('0x11')]);router[_0x4f24('0x12')]('/',auth[_0x4f24('0x8')](),controller[_0x4f24('0x13')]);router[_0x4f24('0x12')](_0x4f24('0xb'),auth['isAuthenticated'](),controller[_0x4f24('0x14')]);router[_0x4f24('0x12')](_0x4f24('0x15'),auth[_0x4f24('0x8')](),controller['addAnswer']);router[_0x4f24('0x12')](_0x4f24('0xe'),auth[_0x4f24('0x8')](),controller[_0x4f24('0x16')]);router[_0x4f24('0x12')](_0x4f24('0x10'),auth[_0x4f24('0x8')](),controller['addApplications']);router[_0x4f24('0x12')]('/:id/notify',controller[_0x4f24('0x17')]);router[_0x4f24('0x12')](_0x4f24('0x18'),auth[_0x4f24('0x8')](),controller['send']);router[_0x4f24('0x19')](_0x4f24('0x1a'),auth[_0x4f24('0x8')](),controller[_0x4f24('0x1b')]);router[_0x4f24('0x1c')](_0x4f24('0x1a'),auth['isAuthenticated'](),controller[_0x4f24('0x1d')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4f24('0x1e')]);router['delete'](_0x4f24('0x15'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x4f24('0x1c')]('/:id/users',auth[_0x4f24('0x8')](),controller[_0x4f24('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xea05=['./whatsappAccount.controller','get','isAuthenticated','index','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12c297,_0x34d7e9){var _0x7b5eaa=function(_0x1ce37c){while(--_0x1ce37c){_0x12c297['push'](_0x12c297['shift']());}};_0x7b5eaa(++_0x34d7e9);}(_0xea05,0x81));var _0x5ea0=function(_0xb60128,_0x4a7b12){_0xb60128=_0xb60128-0x0;var _0x34f128=_0xea05[_0xb60128];return _0x34f128;};'use strict';var multer=require(_0x5ea0('0x0'));var util=require('util');var path=require(_0x5ea0('0x1'));var timeout=require(_0x5ea0('0x2'));var express=require('express');var router=express[_0x5ea0('0x3')]();var auth=require(_0x5ea0('0x4'));var interaction=require(_0x5ea0('0x5'));var config=require(_0x5ea0('0x6'));var controller=require(_0x5ea0('0x7'));router[_0x5ea0('0x8')]('/',auth[_0x5ea0('0x9')](),controller[_0x5ea0('0xa')]);router[_0x5ea0('0x8')]('/describe',auth[_0x5ea0('0x9')](),controller['describe']);router['get']('/:id',auth[_0x5ea0('0x9')](),controller['show']);router['get'](_0x5ea0('0xb'),auth[_0x5ea0('0x9')](),controller['getDispositions']);router[_0x5ea0('0x8')](_0x5ea0('0xc'),auth['isAuthenticated'](),controller[_0x5ea0('0xd')]);router['get'](_0x5ea0('0xe'),auth['isAuthenticated'](),controller[_0x5ea0('0xf')]);router['get'](_0x5ea0('0x10'),auth[_0x5ea0('0x9')](),controller['getApplications']);router[_0x5ea0('0x11')]('/',auth[_0x5ea0('0x9')](),controller['create']);router[_0x5ea0('0x11')](_0x5ea0('0xb'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x12')]);router['post'](_0x5ea0('0xc'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x13')]);router[_0x5ea0('0x11')](_0x5ea0('0xe'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x14')]);router[_0x5ea0('0x11')](_0x5ea0('0x10'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x15')]);router[_0x5ea0('0x11')](_0x5ea0('0x16'),controller['notify']);router[_0x5ea0('0x11')](_0x5ea0('0x17'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x18')]);router[_0x5ea0('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x5ea0('0x1a')]);router[_0x5ea0('0x1b')](_0x5ea0('0x1c'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x1d')]);router[_0x5ea0('0x1b')](_0x5ea0('0xb'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x1e')]);router[_0x5ea0('0x1b')](_0x5ea0('0xc'),auth['isAuthenticated'](),controller[_0x5ea0('0x1f')]);router[_0x5ea0('0x1b')](_0x5ea0('0xe'),auth[_0x5ea0('0x9')](),controller[_0x5ea0('0x20')]);module[_0x5ea0('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1933f65..8c9bfb7 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 _0x487c=['ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x487c,0x18f));var _0xc487=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x487c[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require(_0xc487('0x0'));var rs=require(_0xc487('0x1'));module['exports']={'name':{'type':Sequelize[_0xc487('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc487('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc487('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc487('0x2')],'defaultValue':function(){return rs[_0xc487('0x3')]();}},'phone':{'type':Sequelize[_0xc487('0x2')]},'type':{'type':Sequelize[_0xc487('0x4')](_0xc487('0x5'))},'accountSid':{'type':Sequelize[_0xc487('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc487('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc487('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc487('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc487('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc487('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc487('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc487('0x8')],'comment':_0xc487('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc487('0xa'),'set':function(_0x1ec8b3){if(!_0x1ec8b3){this[_0xc487('0xb')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xc487('0xc'),_0x1ec8b3);}},'description':{'type':Sequelize[_0xc487('0x2')]}}; \ No newline at end of file +var _0x0910=['STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x47d866,_0x1e15f4){var _0x1f35bf=function(_0x1effbc){while(--_0x1effbc){_0x47d866['push'](_0x47d866['shift']());}};_0x1f35bf(++_0x1e15f4);}(_0x0910,0x114));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0091('0x0'));var rs=require(_0x0091('0x1'));module[_0x0091('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0091('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0091('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x0091('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x0091('0x4')],'defaultValue':function(){return rs[_0x0091('0x5')]();}},'phone':{'type':Sequelize[_0x0091('0x4')]},'type':{'type':Sequelize[_0x0091('0x6')]('twilio')},'accountSid':{'type':Sequelize[_0x0091('0x4')]},'authToken':{'type':Sequelize[_0x0091('0x4')]},'notificationTemplate':{'type':Sequelize[_0x0091('0x7')],'defaultValue':function(){return _0x0091('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0091('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0091('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0091('0xa'),'set':function(_0xa1324){if(!_0xa1324){this[_0x0091('0xb')](_0x0091('0xc'),null);}this[_0x0091('0xb')](_0x0091('0xd'),_0xa1324);}},'description':{'type':Sequelize[_0x0091('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 56aaca8..03cfe8e 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 _0xb49a=['userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','error','WhatsappAccount,\x20%s,\x20%s','message','result','status','end','json','offset','limit','set','save','update','then','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','mandatoryDispositionPause','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','length','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xb49a,0xfb));var _0xab49=function(_0x236e98,_0x3c93cc){_0x236e98=_0x236e98-0x0;var _0x4d0037=_0xb49a[_0x236e98];return _0x4d0037;};'use strict';var pdf=require(_0xab49('0x0'));var emlformat=require(_0xab49('0x1'));var rimraf=require(_0xab49('0x2'));var zipdir=require(_0xab49('0x3'));var jsonpatch=require(_0xab49('0x4'));var rp=require('request-promise');var moment=require(_0xab49('0x5'));var BPromise=require(_0xab49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab49('0x7'));var sox=require(_0xab49('0x8'));var csv=require(_0xab49('0x9'));var ejs=require(_0xab49('0xa'));var fs=require('fs');var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x9'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var db=require(_0xab49('0x17'))['db'];config[_0xab49('0x18')]=_[_0xab49('0x19')](config[_0xab49('0x18')],{'host':_0xab49('0x1a'),'port':0x18eb});var socket=require(_0xab49('0x1b'))(new Redis(config[_0xab49('0x18')]));require(_0xab49('0x1c'))[_0xab49('0x1d')](socket);var jayson=require(_0xab49('0x1e'));var client=jayson[_0xab49('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0xcd137f,_0x38ee23,_0x205b09){if(_0x205b09){var _0x9c59e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9c59e1[_0xab49('0x20')](_0x38ee23)){return _0xcd137f;}else{throw new db['Sequelize'][(_0xab49('0x21'))](_0xab49('0x22'));}}else{return _0xcd137f;}}function respondWithRpcPromise(_0x311de3,_0xcaa6ca,_0x2bf1ce,_0x47f977){return new BPromise(function(_0x167a2a,_0x24cb8f){var _0x28449b=_0x47f977||client;return _0x28449b['request'](_0x311de3,_0x2bf1ce)['then'](function(_0x31da6b){logger[_0xab49('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0xcaa6ca,_0xab49('0x24'));logger[_0xab49('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xcaa6ca,_0xab49('0x24'),JSON['stringify'](_0x31da6b));if(_0x31da6b[_0xab49('0x26')]){if(_0x31da6b[_0xab49('0x26')]['code']===0x1f4){logger['error'](_0xab49('0x27'),_0xcaa6ca,_0x31da6b['error'][_0xab49('0x28')]);return _0x24cb8f(_0x31da6b['error'][_0xab49('0x28')]);}logger[_0xab49('0x26')](_0xab49('0x27'),_0xcaa6ca,_0x31da6b['error'][_0xab49('0x28')]);return _0x167a2a(_0x31da6b['error'][_0xab49('0x28')]);}else{logger[_0xab49('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0xcaa6ca,_0xab49('0x24'));_0x167a2a(_0x31da6b[_0xab49('0x29')]['message']);}})['catch'](function(_0x11446b){logger[_0xab49('0x26')](_0xab49('0x27'),_0xcaa6ca,_0x11446b);_0x24cb8f(_0x11446b);});});}function respondWithStatusCode(_0x5b7c22,_0x1b1fed){_0x1b1fed=_0x1b1fed||0xcc;return function(_0x237273){if(_0x237273){return _0x5b7c22['sendStatus'](_0x1b1fed);}return _0x5b7c22[_0xab49('0x2a')](_0x1b1fed)[_0xab49('0x2b')]();};}function respondWithResult(_0x342fdf,_0x57fbad){_0x57fbad=_0x57fbad||0xc8;return function(_0x30a3dd){if(_0x30a3dd){return _0x342fdf['status'](_0x57fbad)[_0xab49('0x2c')](_0x30a3dd);}};}function respondWithFilteredResult(_0x53ec05,_0x19f094){return function(_0x54942c){if(_0x54942c){var _0x134a03=_0x54942c['count'],_0x24bd0f=_0x19f094[_0xab49('0x2d')],_0x1c48ef=_0x19f094[_0xab49('0x2d')]+_0x19f094[_0xab49('0x2e')],_0x211be2;if(_0x1c48ef>=_0x134a03){_0x1c48ef=_0x134a03;_0x211be2=0xc8;}else{_0x211be2=0xce;}_0x53ec05['status'](_0x211be2);return _0x53ec05[_0xab49('0x2f')]('Content-Range',_0x24bd0f+'-'+_0x1c48ef+'/'+_0x134a03)[_0xab49('0x2c')](_0x54942c);}return null;};}function patchUpdates(_0x4f6352){return function(_0x4dcb39){try{jsonpatch['apply'](_0x4dcb39,_0x4f6352,!![]);}catch(_0x178766){return BPromise['reject'](_0x178766);}return _0x4dcb39[_0xab49('0x30')]();};}function saveUpdates(_0x2e013f,_0x15c7f1){return function(_0x59d493){if(_0x59d493){return _0x59d493[_0xab49('0x31')](_0x2e013f)[_0xab49('0x32')](function(_0x3cc88b){return _0x3cc88b;});}return null;};}function removeEntity(_0x18ef20,_0x3da5f3){return function(_0x56b768){if(_0x56b768){return _0x56b768[_0xab49('0x33')]()[_0xab49('0x32')](function(){var _0x496000=_0x56b768['get']({'plain':!![]});var _0x2b97e5=_0xab49('0x34');return db[_0xab49('0x35')][_0xab49('0x33')]({'where':{'type':_0x2b97e5,'resourceId':_0x496000['id']}})[_0xab49('0x32')](function(){return _0x56b768;});})[_0xab49('0x32')](function(){_0x18ef20[_0xab49('0x2a')](0xcc)[_0xab49('0x2b')]();});}};}function handleEntityNotFound(_0x459b9d,_0x43027f){return function(_0x2b3ea5){if(!_0x2b3ea5){_0x459b9d[_0xab49('0x36')](0x194);}return _0x2b3ea5;};}function handleError(_0x2599ac,_0x4a9f39){_0x4a9f39=_0x4a9f39||0x1f4;return function(_0x2289a7){logger[_0xab49('0x26')](_0x2289a7[_0xab49('0x37')]);if(_0x2289a7[_0xab49('0x38')]){delete _0x2289a7[_0xab49('0x38')];}_0x2599ac['status'](_0x4a9f39)[_0xab49('0x39')](_0x2289a7);};}exports['index']=function(_0x4ff230,_0x1c5f94){var _0x254806={'include':[{'model':db[_0xab49('0x3a')],'as':'mandatoryDispositionPause'}]},_0x32341b={},_0x7d8f77={'count':0x0,'rows':[]};var _0x37b9cb=_[_0xab49('0x3b')](db[_0xab49('0x3c')][_0xab49('0x3d')],function(_0x212041){return{'name':_0x212041['fieldName'],'type':_0x212041['type'][_0xab49('0x3e')]};});_0x32341b[_0xab49('0x3f')]=_[_0xab49('0x3b')](_0x37b9cb,'name');_0x32341b[_0xab49('0x40')]=_['keys'](_0x4ff230['query']);_0x32341b['filters']=_['intersection'](_0x32341b[_0xab49('0x3f')],_0x32341b[_0xab49('0x40')]);_0x254806[_0xab49('0x41')]=_[_0xab49('0x42')](_0x32341b[_0xab49('0x3f')],qs[_0xab49('0x43')](_0x4ff230[_0xab49('0x40')][_0xab49('0x43')]));_0x254806[_0xab49('0x41')]=_0x254806[_0xab49('0x41')]['length']?_0x254806[_0xab49('0x41')]:_0x32341b[_0xab49('0x3f')];if(!_0x4ff230['query'][_0xab49('0x44')](_0xab49('0x45'))){_0x254806[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x4ff230[_0xab49('0x40')][_0xab49('0x2e')]);_0x254806[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0x4ff230['query'][_0xab49('0x2d')]);}_0x254806[_0xab49('0x46')]=qs[_0xab49('0x47')](_0x4ff230['query'][_0xab49('0x47')]);_0x254806[_0xab49('0x48')]=qs[_0xab49('0x49')](_[_0xab49('0x4a')](_0x4ff230[_0xab49('0x40')],_0x32341b[_0xab49('0x49')]),_0x37b9cb);if(_0x4ff230['query'][_0xab49('0x4b')]){_0x254806[_0xab49('0x48')]=_[_0xab49('0x4c')](_0x254806[_0xab49('0x48')],{'$or':_[_0xab49('0x3b')](_0x37b9cb,function(_0x4289d2){if(_0x4289d2['type']!==_0xab49('0x4d')){var _0x186fcf={};_0x186fcf[_0x4289d2[_0xab49('0x38')]]={'$like':'%'+_0x4ff230[_0xab49('0x40')][_0xab49('0x4b')]+'%'};return _0x186fcf;}})});}_0x254806=_[_0xab49('0x4c')]({},_0x254806,_0x4ff230[_0xab49('0x4e')]);var _0x2185f1={'where':_0x254806[_0xab49('0x48')]};return db[_0xab49('0x3c')][_0xab49('0x4f')](_0x2185f1)[_0xab49('0x32')](function(_0x5103a5){_0x7d8f77[_0xab49('0x4f')]=_0x5103a5;if(_0x4ff230[_0xab49('0x40')][_0xab49('0x50')]){_0x254806[_0xab49('0x51')]=[{'all':!![]}];}return db[_0xab49('0x3c')][_0xab49('0x52')](_0x254806);})[_0xab49('0x32')](function(_0x545b25){_0x7d8f77[_0xab49('0x53')]=_0x545b25;return _0x7d8f77;})['then'](respondWithFilteredResult(_0x1c5f94,_0x254806))[_0xab49('0x54')](handleError(_0x1c5f94,null));};exports['show']=function(_0x676c7d,_0xcbc0ef){var _0x4bc6cf={'raw':![],'where':{'id':_0x676c7d[_0xab49('0x55')]['id']},'include':[{'model':db[_0xab49('0x3a')],'as':_0xab49('0x56')}]},_0x2fff6e={};_0x2fff6e[_0xab49('0x3f')]=_[_0xab49('0x57')](db[_0xab49('0x3c')][_0xab49('0x3d')]);_0x2fff6e[_0xab49('0x40')]=_[_0xab49('0x57')](_0x676c7d[_0xab49('0x40')]);_0x2fff6e[_0xab49('0x49')]=_[_0xab49('0x42')](_0x2fff6e[_0xab49('0x3f')],_0x2fff6e[_0xab49('0x40')]);_0x4bc6cf[_0xab49('0x41')]=_[_0xab49('0x42')](_0x2fff6e['model'],qs[_0xab49('0x43')](_0x676c7d[_0xab49('0x40')][_0xab49('0x43')]));_0x4bc6cf[_0xab49('0x41')]=_0x4bc6cf[_0xab49('0x41')]['length']?_0x4bc6cf[_0xab49('0x41')]:_0x2fff6e[_0xab49('0x3f')];if(_0x676c7d[_0xab49('0x40')][_0xab49('0x50')]){_0x4bc6cf[_0xab49('0x51')]=[{'all':!![]}];}_0x4bc6cf=_[_0xab49('0x4c')]({},_0x4bc6cf,_0x676c7d['options']);return db[_0xab49('0x3c')][_0xab49('0x58')](_0x4bc6cf)[_0xab49('0x32')](handleEntityNotFound(_0xcbc0ef,null))[_0xab49('0x32')](respondWithResult(_0xcbc0ef,null))['catch'](handleError(_0xcbc0ef,null));};exports['create']=function(_0x143ca1,_0x4d3629){return db[_0xab49('0x3c')][_0xab49('0x59')](_0x143ca1[_0xab49('0x5a')],{})[_0xab49('0x32')](function(_0xbad48e){var _0x22294f=_0x143ca1[_0xab49('0x5b')][_0xab49('0x5c')]({'plain':!![]});if(!_0x22294f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22294f[_0xab49('0x5d')]===_0xab49('0x5b')){var _0x385a54=_0xbad48e[_0xab49('0x5c')]({'plain':!![]});var _0x29a166='WhatsappAccounts';return db[_0xab49('0x5e')][_0xab49('0x58')]({'where':{'name':_0x29a166,'userProfileId':_0x22294f[_0xab49('0x5f')]},'raw':!![]})[_0xab49('0x32')](function(_0x32cdf2){if(_0x32cdf2&&_0x32cdf2[_0xab49('0x60')]===0x0){return db[_0xab49('0x35')][_0xab49('0x59')]({'name':_0x385a54[_0xab49('0x38')],'resourceId':_0x385a54['id'],'type':_0x32cdf2[_0xab49('0x38')],'sectionId':_0x32cdf2['id']},{})[_0xab49('0x32')](function(){return _0xbad48e;});}else{return _0xbad48e;}})[_0xab49('0x54')](function(_0x1406fd){logger['error'](_0xab49('0x61'),_0x1406fd);throw _0x1406fd;});}return _0xbad48e;})[_0xab49('0x32')](respondWithResult(_0x4d3629,0xc9))[_0xab49('0x54')](handleError(_0x4d3629,null));};exports[_0xab49('0x31')]=function(_0x106be9,_0x1583aa){if(_0x106be9[_0xab49('0x5a')]['id']){delete _0x106be9[_0xab49('0x5a')]['id'];}return db[_0xab49('0x3c')][_0xab49('0x58')]({'where':{'id':_0x106be9['params']['id']},'include':[{'model':db[_0xab49('0x3a')],'as':_0xab49('0x56')}]})['then'](handleEntityNotFound(_0x1583aa,null))[_0xab49('0x32')](saveUpdates(_0x106be9[_0xab49('0x5a')],null))[_0xab49('0x32')](respondWithResult(_0x1583aa,null))['catch'](handleError(_0x1583aa,null));};exports[_0xab49('0x33')]=function(_0x47509b,_0x51386a){return db['WhatsappAccount'][_0xab49('0x58')]({'where':{'id':_0x47509b[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x51386a,null))['then'](removeEntity(_0x51386a,null))['catch'](handleError(_0x51386a,null));};exports[_0xab49('0x62')]=function(_0x8439e0,_0x370987){return db[_0xab49('0x3c')][_0xab49('0x62')]()[_0xab49('0x32')](respondWithResult(_0x370987,null))[_0xab49('0x54')](handleError(_0x370987,null));};exports[_0xab49('0x63')]=function(_0x48b809,_0x4f05e5,_0x462ddf){if(_0x48b809[_0xab49('0x5a')]['id']){delete _0x48b809[_0xab49('0x5a')]['id'];}return db[_0xab49('0x3c')][_0xab49('0x58')]({'where':{'id':_0x48b809[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x4f05e5,null))[_0xab49('0x32')](function(_0x2cca91){if(_0x2cca91){_0x48b809[_0xab49('0x5a')]['WhatsappAccountId']=_0x2cca91['id'];return db[_0xab49('0x64')][_0xab49('0x59')](_0x48b809[_0xab49('0x5a')]);}})[_0xab49('0x32')](respondWithResult(_0x4f05e5,null))[_0xab49('0x54')](handleError(_0x4f05e5,null));};exports[_0xab49('0x65')]=function(_0x394bb6,_0xa67ec7,_0x5863b1){var _0x34ae9d={'raw':![],'where':{}};var _0x4934fa={};var _0x21665f={'count':0x0,'rows':[]};return db[_0xab49('0x3c')][_0xab49('0x66')]({'where':{'id':_0x394bb6['params']['id']}})[_0xab49('0x32')](handleEntityNotFound(_0xa67ec7,null))[_0xab49('0x32')](function(_0x553fc5){if(_0x553fc5){_0x4934fa[_0xab49('0x3f')]=_[_0xab49('0x57')](db[_0xab49('0x64')][_0xab49('0x3d')]);_0x4934fa[_0xab49('0x40')]=_[_0xab49('0x57')](_0x394bb6[_0xab49('0x40')]);_0x4934fa[_0xab49('0x49')]=_[_0xab49('0x42')](_0x4934fa[_0xab49('0x3f')],_0x4934fa[_0xab49('0x40')]);_0x34ae9d[_0xab49('0x41')]=_[_0xab49('0x42')](_0x4934fa['model'],qs[_0xab49('0x43')](_0x394bb6[_0xab49('0x40')][_0xab49('0x43')]));_0x34ae9d['attributes']=_0x34ae9d[_0xab49('0x41')][_0xab49('0x67')]?_0x34ae9d['attributes']:_0x4934fa[_0xab49('0x3f')];if(!_0x394bb6[_0xab49('0x40')]['hasOwnProperty'](_0xab49('0x45'))){_0x34ae9d[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x394bb6[_0xab49('0x40')][_0xab49('0x2e')]);_0x34ae9d[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0x394bb6[_0xab49('0x40')]['offset']);}_0x34ae9d['order']=qs[_0xab49('0x47')](_0x394bb6[_0xab49('0x40')][_0xab49('0x47')]);_0x34ae9d[_0xab49('0x48')]=qs[_0xab49('0x49')](_[_0xab49('0x4a')](_0x394bb6[_0xab49('0x40')],_0x4934fa[_0xab49('0x49')]));_0x34ae9d['where'][_0xab49('0x68')]=_0x553fc5['id'];if(_0x394bb6['query'][_0xab49('0x4b')]){_0x34ae9d[_0xab49('0x48')]=_[_0xab49('0x4c')](_0x34ae9d[_0xab49('0x48')],{'$or':_[_0xab49('0x3b')](_0x34ae9d[_0xab49('0x41')],function(_0x10ae41){var _0x2a3125={};_0x2a3125[_0x10ae41]={'$like':'%'+_0x394bb6[_0xab49('0x40')][_0xab49('0x4b')]+'%'};return _0x2a3125;})});}_0x34ae9d=_[_0xab49('0x4c')]({},_0x34ae9d,_0x394bb6[_0xab49('0x4e')]);return db[_0xab49('0x64')][_0xab49('0x4f')]({'where':_0x34ae9d[_0xab49('0x48')]})[_0xab49('0x32')](function(_0x5034f5){_0x21665f['count']=_0x5034f5;if(_0x394bb6[_0xab49('0x40')][_0xab49('0x50')]){_0x34ae9d[_0xab49('0x51')]=[{'all':!![]}];}return db[_0xab49('0x64')][_0xab49('0x52')](_0x34ae9d);})[_0xab49('0x32')](function(_0x4c8483){_0x21665f[_0xab49('0x53')]=_0x4c8483;return _0x21665f;});}})['then'](respondWithFilteredResult(_0xa67ec7,_0x34ae9d))['catch'](handleError(_0xa67ec7,null));};exports[_0xab49('0x69')]=function(_0x4cc02b,_0x3e0c73,_0x1bb224){return db['WhatsappAccount'][_0xab49('0x58')]({'where':{'id':_0x4cc02b[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x3e0c73,null))['then'](function(_0x5021af){if(_0x5021af){return _0x5021af[_0xab49('0x69')](_0x4cc02b[_0xab49('0x40')][_0xab49('0x6a')]);}})[_0xab49('0x32')](respondWithStatusCode(_0x3e0c73,null))[_0xab49('0x54')](handleError(_0x3e0c73,null));};exports[_0xab49('0x6b')]=function(_0x531f22,_0x12132d,_0x47d5ca){if(_0x531f22[_0xab49('0x5a')]['id']){delete _0x531f22['body']['id'];}return db[_0xab49('0x3c')][_0xab49('0x58')]({'where':{'id':_0x531f22['params']['id']}})['then'](handleEntityNotFound(_0x12132d,null))[_0xab49('0x32')](function(_0x2894eb){if(_0x2894eb){_0x531f22[_0xab49('0x5a')][_0xab49('0x68')]=_0x2894eb['id'];return db[_0xab49('0x6c')][_0xab49('0x59')](_0x531f22[_0xab49('0x5a')]);}})['then'](respondWithResult(_0x12132d,null))['catch'](handleError(_0x12132d,null));};exports[_0xab49('0x6d')]=function(_0x5de181,_0x5ae153,_0x24305c){var _0x1ce887={'raw':![],'where':{}};var _0x261e84={};var _0x44f1fa={'count':0x0,'rows':[]};return db[_0xab49('0x3c')]['findOne']({'where':{'id':_0x5de181[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x5ae153,null))[_0xab49('0x32')](function(_0x1bd307){if(_0x1bd307){_0x261e84[_0xab49('0x3f')]=_[_0xab49('0x57')](db[_0xab49('0x6c')][_0xab49('0x3d')]);_0x261e84['query']=_[_0xab49('0x57')](_0x5de181[_0xab49('0x40')]);_0x261e84['filters']=_['intersection'](_0x261e84['model'],_0x261e84[_0xab49('0x40')]);_0x1ce887[_0xab49('0x41')]=_[_0xab49('0x42')](_0x261e84[_0xab49('0x3f')],qs[_0xab49('0x43')](_0x5de181[_0xab49('0x40')][_0xab49('0x43')]));_0x1ce887['attributes']=_0x1ce887[_0xab49('0x41')][_0xab49('0x67')]?_0x1ce887[_0xab49('0x41')]:_0x261e84[_0xab49('0x3f')];if(!_0x5de181[_0xab49('0x40')]['hasOwnProperty'](_0xab49('0x45'))){_0x1ce887[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x5de181[_0xab49('0x40')]['limit']);_0x1ce887[_0xab49('0x2d')]=qs['offset'](_0x5de181['query'][_0xab49('0x2d')]);}_0x1ce887[_0xab49('0x46')]=qs[_0xab49('0x47')](_0x5de181['query'][_0xab49('0x47')]);_0x1ce887[_0xab49('0x48')]=qs[_0xab49('0x49')](_['pick'](_0x5de181['query'],_0x261e84[_0xab49('0x49')]));_0x1ce887[_0xab49('0x48')]['WhatsappAccountId']=_0x1bd307['id'];if(_0x5de181[_0xab49('0x40')][_0xab49('0x4b')]){_0x1ce887['where']=_[_0xab49('0x4c')](_0x1ce887['where'],{'$or':_['map'](_0x1ce887[_0xab49('0x41')],function(_0x1825ab){var _0x5500b2={};_0x5500b2[_0x1825ab]={'$like':'%'+_0x5de181[_0xab49('0x40')][_0xab49('0x4b')]+'%'};return _0x5500b2;})});}_0x1ce887=_[_0xab49('0x4c')]({},_0x1ce887,_0x5de181[_0xab49('0x4e')]);return db[_0xab49('0x6c')][_0xab49('0x4f')]({'where':_0x1ce887[_0xab49('0x48')]})[_0xab49('0x32')](function(_0x1fc4c2){_0x44f1fa[_0xab49('0x4f')]=_0x1fc4c2;if(_0x5de181['query'][_0xab49('0x50')]){_0x1ce887[_0xab49('0x51')]=[{'all':!![]}];}return db[_0xab49('0x6c')]['findAll'](_0x1ce887);})[_0xab49('0x32')](function(_0x3d150d){_0x44f1fa[_0xab49('0x53')]=_0x3d150d;return _0x44f1fa;});}})['then'](respondWithFilteredResult(_0x5ae153,_0x1ce887))[_0xab49('0x54')](handleError(_0x5ae153,null));};exports['removeAnswers']=function(_0x4dfc20,_0x139e28,_0x5cdd4c){return db[_0xab49('0x3c')][_0xab49('0x58')]({'where':{'id':_0x4dfc20[_0xab49('0x55')]['id']}})['then'](handleEntityNotFound(_0x139e28,null))[_0xab49('0x32')](function(_0x103191){if(_0x103191){return _0x103191[_0xab49('0x6e')](_0x4dfc20[_0xab49('0x40')][_0xab49('0x6a')]);}})[_0xab49('0x32')](respondWithStatusCode(_0x139e28,null))[_0xab49('0x54')](handleError(_0x139e28,null));};exports[_0xab49('0x6f')]=function(_0x1935e6,_0x1bf195,_0x31ff77){return db[_0xab49('0x3c')]['find']({'where':{'id':_0x1935e6[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x1bf195,null))['then'](function(_0x557a7d){if(_0x557a7d){return _0x557a7d[_0xab49('0x6f')](_0x1935e6[_0xab49('0x5a')][_0xab49('0x6a')],_[_0xab49('0x70')](_0x1935e6[_0xab49('0x5a')],['ids','id'])||{})[_0xab49('0x71')](function(_0x5942d8){for(var _0x573e31=0x0;_0x573e31<_0x1935e6[_0xab49('0x5a')][_0xab49('0x6a')][_0xab49('0x67')];_0x573e31+=0x1){socket[_0xab49('0x72')](_0xab49('0x73'),{'UserId':_0x1935e6[_0xab49('0x5a')][_0xab49('0x6a')][_0x573e31],'WhatsappAccountId':_0x1935e6[_0xab49('0x55')]['id']});}return _0x5942d8;});}})[_0xab49('0x32')](respondWithResult(_0x1bf195,null))[_0xab49('0x54')](handleError(_0x1bf195,null));};exports['removeAgents']=function(_0x4fab7a,_0xac7b9d,_0x30a92a){return db[_0xab49('0x3c')]['find']({'where':{'id':_0x4fab7a[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0xac7b9d,null))[_0xab49('0x32')](function(_0x2cc47f){if(_0x2cc47f){return _0x2cc47f[_0xab49('0x74')](_0x4fab7a[_0xab49('0x40')][_0xab49('0x6a')])[_0xab49('0x32')](function(){if(_['isArray'](_0x4fab7a['query'][_0xab49('0x6a')])){for(var _0x498e29=0x0;_0x498e29<_0x4fab7a[_0xab49('0x40')]['ids'][_0xab49('0x67')];_0x498e29+=0x1){socket[_0xab49('0x72')](_0xab49('0x75'),{'UserId':Number(_0x4fab7a['query']['ids'][_0x498e29]),'WhatsappAccountId':Number(_0x4fab7a[_0xab49('0x55')]['id'])});}}else{socket[_0xab49('0x72')](_0xab49('0x75'),{'UserId':Number(_0x4fab7a[_0xab49('0x40')][_0xab49('0x6a')]),'WhatsappAccountId':Number(_0x4fab7a['params']['id'])});}});}})[_0xab49('0x32')](respondWithStatusCode(_0xac7b9d,null))[_0xab49('0x54')](handleError(_0xac7b9d,null));};exports[_0xab49('0x76')]=function(_0x46113f,_0x2c02c0,_0x4944c4){var _0x158a9c={};var _0x4722cd={};var _0x195523;var _0x33300b;return db[_0xab49('0x3c')][_0xab49('0x66')]({'where':{'id':_0x46113f[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x2c02c0,null))[_0xab49('0x32')](function(_0x868da5){if(_0x868da5){_0x195523=_0x868da5;_0x4722cd[_0xab49('0x3f')]=_[_0xab49('0x57')](db[_0xab49('0x77')][_0xab49('0x3d')]);_0x4722cd[_0xab49('0x40')]=_[_0xab49('0x57')](_0x46113f[_0xab49('0x40')]);_0x4722cd['filters']=_[_0xab49('0x42')](_0x4722cd['model'],_0x4722cd['query']);_0x158a9c[_0xab49('0x41')]=_[_0xab49('0x42')](_0x4722cd['model'],qs[_0xab49('0x43')](_0x46113f['query'][_0xab49('0x43')]));_0x158a9c[_0xab49('0x41')]=_0x158a9c[_0xab49('0x41')][_0xab49('0x67')]?_0x158a9c['attributes']:_0x4722cd[_0xab49('0x3f')];_0x158a9c[_0xab49('0x46')]=qs[_0xab49('0x47')](_0x46113f[_0xab49('0x40')][_0xab49('0x47')]);_0x158a9c['where']=qs['filters'](_[_0xab49('0x4a')](_0x46113f[_0xab49('0x40')],_0x4722cd[_0xab49('0x49')]));if(_0x46113f[_0xab49('0x40')][_0xab49('0x4b')]){_0x158a9c[_0xab49('0x48')]=_[_0xab49('0x4c')](_0x158a9c[_0xab49('0x48')],{'$or':_[_0xab49('0x3b')](_0x158a9c['attributes'],function(_0x31168b){var _0x240e29={};_0x240e29[_0x31168b]={'$like':'%'+_0x46113f[_0xab49('0x40')][_0xab49('0x4b')]+'%'};return _0x240e29;})});}_0x158a9c=_['merge']({},_0x158a9c,_0x46113f[_0xab49('0x4e')]);return _0x195523[_0xab49('0x76')](_0x158a9c);}})[_0xab49('0x32')](function(_0x30eccb){if(_0x30eccb){_0x33300b=_0x30eccb[_0xab49('0x67')];if(!_0x46113f[_0xab49('0x40')]['hasOwnProperty'](_0xab49('0x45'))){_0x158a9c[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x46113f[_0xab49('0x40')][_0xab49('0x2e')]);_0x158a9c[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0x46113f[_0xab49('0x40')][_0xab49('0x2d')]);}return _0x195523[_0xab49('0x76')](_0x158a9c);}})[_0xab49('0x32')](function(_0xec5984){if(_0xec5984){return _0xec5984?{'count':_0x33300b,'rows':_0xec5984}:null;}})[_0xab49('0x32')](respondWithResult(_0x2c02c0,null))[_0xab49('0x54')](handleError(_0x2c02c0,null));};exports[_0xab49('0x78')]=function(_0x3d12c2,_0x45f6ed,_0xd24be5){return db['WhatsappAccount'][_0xab49('0x66')]({'where':{'id':_0x3d12c2['params']['id']}})[_0xab49('0x32')](handleEntityNotFound(_0x45f6ed,null))[_0xab49('0x32')](function(_0x2c7c0c){if(_0x2c7c0c){return db['sequelize'][_0xab49('0x79')](function(_0xf0c546){return db[_0xab49('0x7a')][_0xab49('0x33')]({'where':{'WhatsappAccountId':_0x3d12c2['params']['id']},'transaction':_0xf0c546})['then'](function(_0x246a06){var _0x1f317a=_[_0xab49('0x3b')](_0x3d12c2[_0xab49('0x5a')],function(_0x4e4692){_0x4e4692[_0xab49('0x68')]=_0x3d12c2[_0xab49('0x55')]['id'];return _0x4e4692;});return db[_0xab49('0x7a')][_0xab49('0x7b')](_0x1f317a,{'transaction':_0xf0c546});});})[_0xab49('0x32')](function(){return db[_0xab49('0x7a')][_0xab49('0x7c')]({'where':{'WhatsappAccountId':_0x3d12c2['params']['id']},'order':_0xab49('0x7d')});});}})[_0xab49('0x32')](respondWithResult(_0x45f6ed,null))[_0xab49('0x54')](handleError(_0x45f6ed,null));};exports[_0xab49('0x7e')]=function(_0x3b0a1b,_0xbafcbc,_0x12f5bf){var _0x1d0f25={};var _0x3f07de={};var _0xf65de;var _0x2de754;return db[_0xab49('0x3c')][_0xab49('0x66')]({'where':{'id':_0x3b0a1b[_0xab49('0x55')]['id']}})[_0xab49('0x32')](handleEntityNotFound(_0xbafcbc,null))[_0xab49('0x32')](function(_0xc97bd4){if(_0xc97bd4){_0xf65de=_0xc97bd4;_0x3f07de[_0xab49('0x3f')]=_[_0xab49('0x57')](db[_0xab49('0x7a')][_0xab49('0x3d')]);_0x3f07de[_0xab49('0x40')]=_[_0xab49('0x57')](_0x3b0a1b[_0xab49('0x40')]);_0x3f07de[_0xab49('0x49')]=_[_0xab49('0x42')](_0x3f07de['model'],_0x3f07de[_0xab49('0x40')]);_0x1d0f25[_0xab49('0x41')]=_['intersection'](_0x3f07de['model'],qs['fields'](_0x3b0a1b[_0xab49('0x40')][_0xab49('0x43')]));_0x1d0f25[_0xab49('0x41')]=_0x1d0f25['attributes'][_0xab49('0x67')]?_0x1d0f25[_0xab49('0x41')]:_0x3f07de[_0xab49('0x3f')];_0x1d0f25[_0xab49('0x46')]=qs[_0xab49('0x47')](_0x3b0a1b[_0xab49('0x40')][_0xab49('0x47')]);_0x1d0f25[_0xab49('0x48')]=qs['filters'](_[_0xab49('0x4a')](_0x3b0a1b[_0xab49('0x40')],_0x3f07de[_0xab49('0x49')]));if(_0x3b0a1b[_0xab49('0x40')][_0xab49('0x4b')]){_0x1d0f25['where']=_[_0xab49('0x4c')](_0x1d0f25[_0xab49('0x48')],{'$or':_['map'](_0x1d0f25[_0xab49('0x41')],function(_0x22b488){var _0x905b14={};_0x905b14[_0x22b488]={'$like':'%'+_0x3b0a1b['query'][_0xab49('0x4b')]+'%'};return _0x905b14;})});}_0x1d0f25=_[_0xab49('0x4c')]({},_0x1d0f25,_0x3b0a1b[_0xab49('0x4e')]);return _0xf65de[_0xab49('0x7e')](_0x1d0f25);}})[_0xab49('0x32')](function(_0x496621){if(_0x496621){_0x2de754=_0x496621[_0xab49('0x67')];if(!_0x3b0a1b['query'][_0xab49('0x44')](_0xab49('0x45'))){_0x1d0f25[_0xab49('0x2e')]=qs['limit'](_0x3b0a1b[_0xab49('0x40')][_0xab49('0x2e')]);_0x1d0f25[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0x3b0a1b[_0xab49('0x40')]['offset']);}return _0xf65de[_0xab49('0x7e')](_0x1d0f25);}})['then'](function(_0x509b77){if(_0x509b77){return _0x509b77?{'count':_0x2de754,'rows':_0x509b77}:null;}})['then'](respondWithResult(_0xbafcbc,null))[_0xab49('0x54')](handleError(_0xbafcbc,null));};exports['notify']=function(_0x5e477f,_0x59d1bf,_0x29161a){var _0x4ae0f3={'channel':'whatsapp'};var _0x510b89=[];var _0x5d28c9=[];var _0x31e4e4={};return db['WhatsappAccount'][_0xab49('0x58')]({'where':{'id':_0x5e477f['params']['id']},'include':[{'model':db[_0xab49('0x7a')],'as':'Applications'}]})[_0xab49('0x32')](handleEntityNotFound(_0x59d1bf,null))[_0xab49('0x32')](function(_0x5776ed){_0x4ae0f3[_0xab49('0x7f')]=_0x5776ed;_0x4ae0f3[_0xab49('0x80')]=_[_0xab49('0x81')](_0x5776ed[_0xab49('0x82')],[_0xab49('0x7d')],[_0xab49('0x83')]);if(_0x4ae0f3[_0xab49('0x7f')][_0xab49('0x82')]){delete _0x4ae0f3[_0xab49('0x7f')][_0xab49('0x82')];}return db[_0xab49('0x84')][_0xab49('0x62')]();})[_0xab49('0x32')](function(_0x1afe17){if(!_0x1afe17){throw new db[(_0xab49('0x85'))][(_0xab49('0x21'))](_0xab49('0x86'));}_0x510b89=_['difference'](_['keys'](_0x1afe17),[_0xab49('0x87'),'updatedAt']);_0x5d28c9=_['difference'](_[_0xab49('0x57')](_0x1afe17),[_0xab49('0x87'),_0xab49('0x88'),_0xab49('0x89'),_0xab49('0x8a')]);_0x4ae0f3[_0xab49('0x5a')]={'mapKey':_0xab49('0x8b')};if(_0x4ae0f3['account']['type']&&_0x4ae0f3['account'][_0xab49('0x8c')]===_0xab49('0x8d')){_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x8e')]=_0x5e477f[_0xab49('0x5a')]['From'][_0xab49('0x8f')]('whatsapp:','');_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x5a')]=_0x5e477f[_0xab49('0x5a')][_0xab49('0x90')];_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x91')]=_0x5e477f['body'][_0xab49('0x92')];}if(_0x4ae0f3[_0xab49('0x5a')]['id']){delete _0x4ae0f3[_0xab49('0x5a')]['id'];}if(_[_0xab49('0x93')](_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x8e')])){throw new db['Sequelize']['ValidationError'](_0xab49('0x94'));}if(_[_0xab49('0x93')](_0x4ae0f3[_0xab49('0x5a')]['body'])||_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x5a')]===''){throw new db['Sequelize'][(_0xab49('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xab49('0x93')](_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x95')])){throw new db[(_0xab49('0x85'))][(_0xab49('0x21'))](_0xab49('0x96')+_0x5d28c9);}if(!_[_0xab49('0x97')](_0x5d28c9,_0x4ae0f3['body'][_0xab49('0x95')])){throw new db['Sequelize'][(_0xab49('0x21'))](_0xab49('0x98')+_0x5d28c9);}_0x31e4e4[_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x95')]]=_0x4ae0f3['body']['from'];return db[_0xab49('0x99')]['find']({'where':{'id':_0x4ae0f3[_0xab49('0x7f')][_0xab49('0x8a')]},'include':[{'model':db['CmContact'],'as':_0xab49('0x9a'),'where':_0x31e4e4,'limit':0x1,'order':[['updatedAt',_0xab49('0x9b')]]}]});})[_0xab49('0x32')](handleEntityNotFound(_0x59d1bf,null))[_0xab49('0x32')](function(_0x558f23){if(_0x558f23){_0x4ae0f3['list']=_['omit'](_0x558f23,[_0xab49('0x9a')]);if(_0x558f23[_0xab49('0x9a')][_0xab49('0x67')]){return _0x558f23[_0xab49('0x9a')][0x0];}var _0x416d10=_[_0xab49('0x19')](_0x4ae0f3[_0xab49('0x5a')],{'firstName':_0x4ae0f3[_0xab49('0x5a')]['from'],'ListId':_0x558f23['id']});_0x416d10[_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x95')]]=_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x8e')];return db[_0xab49('0x84')][_0xab49('0x59')](_0x416d10,{'fields':_0x510b89,'raw':!![]});}})[_0xab49('0x32')](handleEntityNotFound(_0x59d1bf,null))[_0xab49('0x32')](function(_0x2cbf2c){if(_0x2cbf2c){_0x4ae0f3[_0xab49('0x9c')]=_0x2cbf2c;var _0x316a45={'ContactId':_0x2cbf2c['id'],'phone':_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x8e')],'WhatsappAccountId':_0x5e477f[_0xab49('0x55')]['id']};var _0x59a8c6={'ContactId':_0x2cbf2c['id'],'WhatsappAccountId':_0x5e477f[_0xab49('0x55')]['id'],'closed':![]};return db[_0xab49('0x9d')][_0xab49('0x58')]({'where':_0x59a8c6})[_0xab49('0x32')](function(_0x461981){if(_0x461981){return[_0x461981,![]];}return db[_0xab49('0x9d')][_0xab49('0x59')](_0x316a45)['then'](function(_0x5892fb){return[_0x5892fb,!![]];});});}})[_0xab49('0x71')](function(_0x2d76f8,_0x3c448d){_0x4ae0f3[_0xab49('0x9e')]=_0x2d76f8['get']({'plain':!![]});_0x4ae0f3[_0xab49('0x9e')]['created']=![];if(_0x3c448d){if(_0x4ae0f3['account'][_0xab49('0x9f')]){_0x4ae0f3[_0xab49('0x80')]['push']({'id':0x0,'priority':_0x4ae0f3[_0xab49('0x80')][_0xab49('0x67')]+0x1,'app':_0xab49('0xa0'),'appdata':_0xab49('0xa1'),'interval':_0xab49('0xa2')});}_0x4ae0f3[_0xab49('0x9e')][_0xab49('0xa3')]=!![];}return db[_0xab49('0xa4')][_0xab49('0x59')]({'phone':_0x4ae0f3['body'][_0xab49('0x8e')],'messageId':_0x4ae0f3[_0xab49('0x5a')][_0xab49('0x91')],'body':_0x4ae0f3[_0xab49('0x5a')]['body'],'WhatsappAccountId':_0x5e477f[_0xab49('0x55')]['id'],'WhatsappInteractionId':_0x2d76f8['id'],'direction':'in','ContactId':_0x2d76f8[_0xab49('0xa5')],'AttachmentId':_0x4ae0f3[_0xab49('0x5a')][_0xab49('0xa6')]});})['then'](function(_0x58d013){_0x4ae0f3[_0xab49('0x28')]=_0x58d013;if(_0x4ae0f3[_0xab49('0x9e')][_0xab49('0xa7')]){return db[_0xab49('0x77')][_0xab49('0x58')]({'attributes':['id','name'],'where':{'id':_0x4ae0f3['interaction']['UserId']}})[_0xab49('0x32')](function(_0x3f0374){if(_0x3f0374){_0x4ae0f3[_0xab49('0x80')][_0xab49('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f0374[_0xab49('0x38')]+','+(_0x4ae0f3[_0xab49('0x7f')][_0xab49('0xa9')]||0xa),'interval':_0xab49('0xa2')});}return respondWithRpcPromise(_0xab49('0xaa'),'startRouting',_0x4ae0f3);});}return respondWithRpcPromise(_0xab49('0xaa'),_0xab49('0xab'),_0x4ae0f3);})['then'](function(_0x3c8e05){if(_0x3c8e05){var _0x52d194=0xc8;var _0x39dd75=_0xab49('0xac');logger[_0xab49('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39dd75,_0x52d194,'entity\x20found');logger[_0xab49('0x25')](_0xab49('0xad'),_0x39dd75,_0x52d194,_0xab49('0xae'),JSON[_0xab49('0xaf')](_0x3c8e05));if(_0x4ae0f3[_0xab49('0x7f')][_0xab49('0x8c')]===_0xab49('0x8d')){return _0x59d1bf[_0xab49('0x2a')](_0x52d194)[_0xab49('0x2f')](_0xab49('0xb0'),_0xab49('0xb1'))[_0xab49('0x39')]('\x0a');}else{return _0x59d1bf[_0xab49('0x2a')](_0x52d194)[_0xab49('0x2c')](_0x3c8e05);}}})[_0xab49('0x54')](handleError(_0x59d1bf,null));};exports[_0xab49('0x39')]=function(_0x2b37d5,_0x3150a2,_0x5db47b){var _0x398679,_0x2cf1dd,_0x504215;if(_[_0xab49('0x93')](_0x2b37d5['body'][_0xab49('0x5a')])||_0x2b37d5[_0xab49('0x5a')]['body']===''){throw new db[(_0xab49('0x85'))][(_0xab49('0x21'))](_0xab49('0xb2'));}if(_[_0xab49('0x93')](_0x2b37d5['body']['to'])){throw new db[(_0xab49('0x85'))]['ValidationError'](_0xab49('0xb3'));}_0x398679=_0x2b37d5['body']['to'];return db[_0xab49('0x3c')][_0xab49('0x58')]({'where':{'id':_0x2b37d5[_0xab49('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xab49('0x84')],'as':_0xab49('0x9a'),'where':{'mobile':_0x398679},'limit':0x1,'order':[[_0xab49('0x88'),_0xab49('0x9b')]]}]}]})['then'](handleEntityNotFound(_0x3150a2,null))['then'](function(_0x2f1fa8){if(_0x2f1fa8&&_0x2f1fa8['List']){_0x2cf1dd=_0x2f1fa8['get']({'plain':!![]});if(_0x2cf1dd[_0xab49('0xb4')]&&_0x2cf1dd[_0xab49('0xb4')][_0xab49('0x9a')][_0xab49('0x67')]){return _0x2cf1dd['List']['Contacts'][0x0];}return db['CmContact'][_0xab49('0x59')](_[_0xab49('0x19')](_0x2b37d5[_0xab49('0x5a')],{'firstName':_0x398679,'mobile':_0x398679,'phone':_0x398679,'ListId':_0x2cf1dd[_0xab49('0x8a')]}));}})['then'](handleEntityNotFound(_0x3150a2,null))['then'](function(_0x5df0e1){if(_0x5df0e1){_0x504215=_0x5df0e1;return db[_0xab49('0x9d')]['find']({'where':{'ContactId':_0x504215['id'],'closed':![],'WhatsappAccountId':_0x2cf1dd['id']}})['then'](function(_0x9de011){if(_0x9de011){return[_0x9de011,![]];}return db[_0xab49('0x9d')]['create']({'UserId':_0x2b37d5[_0xab49('0x5b')]['id'],'ContactId':_0x504215['id'],'WhatsappAccountId':_0x2cf1dd['id'],'phone':_0x398679,'firstMsgDirection':_0xab49('0xb5'),'Messages':[_[_0xab49('0x4c')](_0x2b37d5['body'],{'read':![],'body':_0x2b37d5[_0xab49('0x5a')][_0xab49('0x5a')],'phone':_0x398679,'WhatsappAccountId':_0x2cf1dd['id'],'UserId':_0x2b37d5[_0xab49('0x5b')]['id'],'ContactId':_0x504215['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xab49('0xb6')}]})[_0xab49('0x32')](function(_0x3fafb7){return[_0x3fafb7,!![]];});});}})['spread'](function(_0x459b4b,_0x55d451){if(_0x55d451){return _0x459b4b;}return db['WhatsappMessage']['create'](_[_0xab49('0x4c')](_0x2b37d5['body'],{'read':![],'body':_0x2b37d5[_0xab49('0x5a')][_0xab49('0x5a')],'phone':_0x398679,'WhatsappAccountId':_0x2cf1dd['id'],'WhatsappInteractionId':_0x459b4b['id'],'UserId':_0x2b37d5['user']['id'],'ContactId':_0x504215['id']}))[_0xab49('0x32')](function(_0xa1991c){_0x459b4b[_0xab49('0xb7')][_0xab49('0xb6')]=[];_0x459b4b[_0xab49('0xb7')][_0xab49('0xb6')]['push'](_0xa1991c['dataValues']);return _0x459b4b;});})['then'](respondWithResult(_0x3150a2,null))[_0xab49('0x54')](handleError(_0x3150a2,null));}; \ No newline at end of file +var _0xc6d8=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','List','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0xc6d8[_0x526818];return _0x44c7e3;};'use strict';var pdf=require(_0x8c6d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c6d('0x2'));var rp=require('request-promise');var moment=require(_0x8c6d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c6d('0x4'));var path=require(_0x8c6d('0x5'));var sox=require(_0x8c6d('0x6'));var csv=require(_0x8c6d('0x7'));var ejs=require(_0x8c6d('0x8'));var fs=require('fs');var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x7'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8c6d('0x16')](config[_0x8c6d('0x17')],{'host':_0x8c6d('0x18'),'port':0x18eb});var socket=require(_0x8c6d('0x19'))(new Redis(config[_0x8c6d('0x17')]));require(_0x8c6d('0x1a'))[_0x8c6d('0x1b')](socket);var jayson=require(_0x8c6d('0x1c'));var client=jayson[_0x8c6d('0x1d')][_0x8c6d('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x4fb956,_0x16c6b5,_0x4b2bb1){if(_0x4b2bb1){var _0x16af06=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16af06['test'](_0x16c6b5)){return _0x4fb956;}else{throw new db[(_0x8c6d('0x1f'))][(_0x8c6d('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 _0x4fb956;}}function respondWithRpcPromise(_0x7f894c,_0x2b8a26,_0x51a5fa,_0x3e5495){return new BPromise(function(_0x5a22de,_0x4c2f8d){var _0x21b8ee=_0x3e5495||client;return _0x21b8ee['request'](_0x7f894c,_0x51a5fa)[_0x8c6d('0x21')](function(_0x174a4f){logger[_0x8c6d('0x22')](_0x8c6d('0x23'),_0x2b8a26,_0x8c6d('0x24'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2b8a26,'request\x20sent',JSON[_0x8c6d('0x25')](_0x174a4f));if(_0x174a4f['error']){if(_0x174a4f[_0x8c6d('0x26')]['code']===0x1f4){logger['error'](_0x8c6d('0x23'),_0x2b8a26,_0x174a4f[_0x8c6d('0x26')]['message']);return _0x4c2f8d(_0x174a4f['error']['message']);}logger['error'](_0x8c6d('0x23'),_0x2b8a26,_0x174a4f[_0x8c6d('0x26')][_0x8c6d('0x27')]);return _0x5a22de(_0x174a4f['error'][_0x8c6d('0x27')]);}else{logger['info'](_0x8c6d('0x23'),_0x2b8a26,'request\x20sent');_0x5a22de(_0x174a4f[_0x8c6d('0x28')][_0x8c6d('0x27')]);}})[_0x8c6d('0x29')](function(_0x2b6d18){logger[_0x8c6d('0x26')](_0x8c6d('0x23'),_0x2b8a26,_0x2b6d18);_0x4c2f8d(_0x2b6d18);});});}function respondWithStatusCode(_0x9c269d,_0x41957d){_0x41957d=_0x41957d||0xcc;return function(_0x3eab38){if(_0x3eab38){return _0x9c269d['sendStatus'](_0x41957d);}return _0x9c269d['status'](_0x41957d)[_0x8c6d('0x2a')]();};}function respondWithResult(_0x93a094,_0xfc6000){_0xfc6000=_0xfc6000||0xc8;return function(_0x42a7db){if(_0x42a7db){return _0x93a094[_0x8c6d('0x2b')](_0xfc6000)[_0x8c6d('0x2c')](_0x42a7db);}};}function respondWithFilteredResult(_0x2bc94a,_0x2d028f){return function(_0x407234){if(_0x407234){var _0x43d70c=_0x407234[_0x8c6d('0x2d')],_0x3375dd=_0x2d028f[_0x8c6d('0x2e')],_0x15a508=_0x2d028f[_0x8c6d('0x2e')]+_0x2d028f[_0x8c6d('0x2f')],_0x4e5203;if(_0x15a508>=_0x43d70c){_0x15a508=_0x43d70c;_0x4e5203=0xc8;}else{_0x4e5203=0xce;}_0x2bc94a[_0x8c6d('0x2b')](_0x4e5203);return _0x2bc94a[_0x8c6d('0x30')](_0x8c6d('0x31'),_0x3375dd+'-'+_0x15a508+'/'+_0x43d70c)[_0x8c6d('0x2c')](_0x407234);}return null;};}function patchUpdates(_0x247448){return function(_0x55cc8e){try{jsonpatch[_0x8c6d('0x32')](_0x55cc8e,_0x247448,!![]);}catch(_0x57f11d){return BPromise[_0x8c6d('0x33')](_0x57f11d);}return _0x55cc8e[_0x8c6d('0x34')]();};}function saveUpdates(_0xa81460,_0x331573){return function(_0x334afb){if(_0x334afb){return _0x334afb[_0x8c6d('0x35')](_0xa81460)['then'](function(_0x5ae56b){return _0x5ae56b;});}return null;};}function removeEntity(_0x3731ab,_0x2b7ca7){return function(_0x3df42f){if(_0x3df42f){return _0x3df42f[_0x8c6d('0x36')]()['then'](function(){var _0x2818fa=_0x3df42f[_0x8c6d('0x37')]({'plain':!![]});var _0xdc33f5=_0x8c6d('0x38');return db[_0x8c6d('0x39')][_0x8c6d('0x36')]({'where':{'type':_0xdc33f5,'resourceId':_0x2818fa['id']}})['then'](function(){return _0x3df42f;});})[_0x8c6d('0x21')](function(){_0x3731ab[_0x8c6d('0x2b')](0xcc)[_0x8c6d('0x2a')]();});}};}function handleEntityNotFound(_0x2ef932,_0xff4b5b){return function(_0x30f620){if(!_0x30f620){_0x2ef932[_0x8c6d('0x3a')](0x194);}return _0x30f620;};}function handleError(_0x301332,_0x24200c){_0x24200c=_0x24200c||0x1f4;return function(_0x30025b){logger[_0x8c6d('0x26')](_0x30025b[_0x8c6d('0x3b')]);if(_0x30025b['name']){delete _0x30025b[_0x8c6d('0x3c')];}_0x301332[_0x8c6d('0x2b')](_0x24200c)[_0x8c6d('0x3d')](_0x30025b);};}exports[_0x8c6d('0x3e')]=function(_0xa8ea55,_0x4e7cb7){var _0x26027f={'include':[{'model':db[_0x8c6d('0x3f')],'as':_0x8c6d('0x40')}]},_0x250967={},_0x5b9b06={'count':0x0,'rows':[]};var _0x3b329=_['map'](db[_0x8c6d('0x41')][_0x8c6d('0x42')],function(_0x27d6f5){return{'name':_0x27d6f5[_0x8c6d('0x43')],'type':_0x27d6f5[_0x8c6d('0x44')][_0x8c6d('0x45')]};});_0x250967[_0x8c6d('0x46')]=_[_0x8c6d('0x47')](_0x3b329,_0x8c6d('0x3c'));_0x250967[_0x8c6d('0x48')]=_[_0x8c6d('0x49')](_0xa8ea55['query']);_0x250967['filters']=_['intersection'](_0x250967[_0x8c6d('0x46')],_0x250967[_0x8c6d('0x48')]);_0x26027f[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x250967[_0x8c6d('0x46')],qs['fields'](_0xa8ea55[_0x8c6d('0x48')][_0x8c6d('0x4c')]));_0x26027f[_0x8c6d('0x4a')]=_0x26027f['attributes'][_0x8c6d('0x4d')]?_0x26027f[_0x8c6d('0x4a')]:_0x250967['model'];if(!_0xa8ea55['query']['hasOwnProperty']('nolimit')){_0x26027f['limit']=qs[_0x8c6d('0x2f')](_0xa8ea55[_0x8c6d('0x48')][_0x8c6d('0x2f')]);_0x26027f[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0xa8ea55['query']['offset']);}_0x26027f['order']=qs['sort'](_0xa8ea55[_0x8c6d('0x48')]['sort']);_0x26027f[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_[_0x8c6d('0x50')](_0xa8ea55[_0x8c6d('0x48')],_0x250967[_0x8c6d('0x4f')]),_0x3b329);if(_0xa8ea55[_0x8c6d('0x48')]['filter']){_0x26027f[_0x8c6d('0x4e')]=_[_0x8c6d('0x51')](_0x26027f['where'],{'$or':_[_0x8c6d('0x47')](_0x3b329,function(_0xc0547e){if(_0xc0547e['type']!==_0x8c6d('0x52')){var _0xb6e94={};_0xb6e94[_0xc0547e[_0x8c6d('0x3c')]]={'$like':'%'+_0xa8ea55[_0x8c6d('0x48')][_0x8c6d('0x53')]+'%'};return _0xb6e94;}})});}_0x26027f=_[_0x8c6d('0x51')]({},_0x26027f,_0xa8ea55[_0x8c6d('0x54')]);var _0x17eb0f={'where':_0x26027f[_0x8c6d('0x4e')]};return db[_0x8c6d('0x41')][_0x8c6d('0x2d')](_0x17eb0f)[_0x8c6d('0x21')](function(_0x4f4d51){_0x5b9b06[_0x8c6d('0x2d')]=_0x4f4d51;if(_0xa8ea55[_0x8c6d('0x48')][_0x8c6d('0x55')]){_0x26027f['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x26027f);})[_0x8c6d('0x21')](function(_0x1f3ea6){_0x5b9b06[_0x8c6d('0x56')]=_0x1f3ea6;return _0x5b9b06;})[_0x8c6d('0x21')](respondWithFilteredResult(_0x4e7cb7,_0x26027f))['catch'](handleError(_0x4e7cb7,null));};exports[_0x8c6d('0x57')]=function(_0x5972db,_0x6bcc06){var _0x17c078={'raw':![],'where':{'id':_0x5972db['params']['id']},'include':[{'model':db[_0x8c6d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x173752={};_0x173752[_0x8c6d('0x46')]=_['keys'](db[_0x8c6d('0x41')][_0x8c6d('0x42')]);_0x173752[_0x8c6d('0x48')]=_[_0x8c6d('0x49')](_0x5972db['query']);_0x173752[_0x8c6d('0x4f')]=_[_0x8c6d('0x4b')](_0x173752[_0x8c6d('0x46')],_0x173752[_0x8c6d('0x48')]);_0x17c078[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x173752[_0x8c6d('0x46')],qs[_0x8c6d('0x4c')](_0x5972db['query'][_0x8c6d('0x4c')]));_0x17c078[_0x8c6d('0x4a')]=_0x17c078[_0x8c6d('0x4a')][_0x8c6d('0x4d')]?_0x17c078['attributes']:_0x173752[_0x8c6d('0x46')];if(_0x5972db['query']['includeAll']){_0x17c078[_0x8c6d('0x58')]=[{'all':!![]}];}_0x17c078=_[_0x8c6d('0x51')]({},_0x17c078,_0x5972db[_0x8c6d('0x54')]);return db[_0x8c6d('0x41')][_0x8c6d('0x59')](_0x17c078)[_0x8c6d('0x21')](handleEntityNotFound(_0x6bcc06,null))[_0x8c6d('0x21')](respondWithResult(_0x6bcc06,null))['catch'](handleError(_0x6bcc06,null));};exports[_0x8c6d('0x5a')]=function(_0x3927e8,_0x3af565){return db['WhatsappAccount'][_0x8c6d('0x5a')](_0x3927e8[_0x8c6d('0x5b')],{})[_0x8c6d('0x21')](function(_0x26bb3c){var _0x7cff8=_0x3927e8['user'][_0x8c6d('0x37')]({'plain':!![]});if(!_0x7cff8)throw new Error(_0x8c6d('0x5c'));if(_0x7cff8['role']===_0x8c6d('0x5d')){var _0x4e0ee6=_0x26bb3c[_0x8c6d('0x37')]({'plain':!![]});var _0x4c4b61='WhatsappAccounts';return db[_0x8c6d('0x5e')][_0x8c6d('0x59')]({'where':{'name':_0x4c4b61,'userProfileId':_0x7cff8[_0x8c6d('0x5f')]},'raw':!![]})[_0x8c6d('0x21')](function(_0x466d71){if(_0x466d71&&_0x466d71[_0x8c6d('0x60')]===0x0){return db[_0x8c6d('0x39')][_0x8c6d('0x5a')]({'name':_0x4e0ee6[_0x8c6d('0x3c')],'resourceId':_0x4e0ee6['id'],'type':_0x466d71[_0x8c6d('0x3c')],'sectionId':_0x466d71['id']},{})[_0x8c6d('0x21')](function(){return _0x26bb3c;});}else{return _0x26bb3c;}})['catch'](function(_0x3640a4){logger[_0x8c6d('0x26')](_0x8c6d('0x61'),_0x3640a4);throw _0x3640a4;});}return _0x26bb3c;})['then'](respondWithResult(_0x3af565,0xc9))[_0x8c6d('0x29')](handleError(_0x3af565,null));};exports[_0x8c6d('0x35')]=function(_0x19d781,_0x57dd2f){if(_0x19d781[_0x8c6d('0x5b')]['id']){delete _0x19d781['body']['id'];}return db[_0x8c6d('0x41')]['find']({'where':{'id':_0x19d781['params']['id']},'include':[{'model':db[_0x8c6d('0x3f')],'as':_0x8c6d('0x40')}]})['then'](handleEntityNotFound(_0x57dd2f,null))['then'](saveUpdates(_0x19d781['body'],null))[_0x8c6d('0x21')](respondWithResult(_0x57dd2f,null))[_0x8c6d('0x29')](handleError(_0x57dd2f,null));};exports[_0x8c6d('0x36')]=function(_0x194ffc,_0x5e44d7){return db['WhatsappAccount'][_0x8c6d('0x59')]({'where':{'id':_0x194ffc[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x5e44d7,null))[_0x8c6d('0x21')](removeEntity(_0x5e44d7,null))[_0x8c6d('0x29')](handleError(_0x5e44d7,null));};exports[_0x8c6d('0x63')]=function(_0x2d3dd3,_0x3c6a3c){return db['WhatsappAccount'][_0x8c6d('0x63')]()[_0x8c6d('0x21')](respondWithResult(_0x3c6a3c,null))[_0x8c6d('0x29')](handleError(_0x3c6a3c,null));};exports[_0x8c6d('0x64')]=function(_0x559bd4,_0x32039f,_0x55f8c4){if(_0x559bd4['body']['id']){delete _0x559bd4[_0x8c6d('0x5b')]['id'];}return db[_0x8c6d('0x41')][_0x8c6d('0x59')]({'where':{'id':_0x559bd4['params']['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x32039f,null))[_0x8c6d('0x21')](function(_0x4861ec){if(_0x4861ec){_0x559bd4[_0x8c6d('0x5b')][_0x8c6d('0x65')]=_0x4861ec['id'];return db[_0x8c6d('0x66')][_0x8c6d('0x5a')](_0x559bd4[_0x8c6d('0x5b')]);}})['then'](respondWithResult(_0x32039f,null))['catch'](handleError(_0x32039f,null));};exports[_0x8c6d('0x67')]=function(_0x2fedab,_0x31dead,_0x34c0a3){var _0x405461={'raw':![],'where':{}};var _0x363fbb={};var _0x1500f0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8c6d('0x68')]({'where':{'id':_0x2fedab[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x31dead,null))[_0x8c6d('0x21')](function(_0x94b152){if(_0x94b152){_0x363fbb[_0x8c6d('0x46')]=_[_0x8c6d('0x49')](db['Disposition'][_0x8c6d('0x42')]);_0x363fbb[_0x8c6d('0x48')]=_[_0x8c6d('0x49')](_0x2fedab[_0x8c6d('0x48')]);_0x363fbb['filters']=_[_0x8c6d('0x4b')](_0x363fbb[_0x8c6d('0x46')],_0x363fbb[_0x8c6d('0x48')]);_0x405461[_0x8c6d('0x4a')]=_['intersection'](_0x363fbb[_0x8c6d('0x46')],qs[_0x8c6d('0x4c')](_0x2fedab['query'][_0x8c6d('0x4c')]));_0x405461[_0x8c6d('0x4a')]=_0x405461['attributes'][_0x8c6d('0x4d')]?_0x405461[_0x8c6d('0x4a')]:_0x363fbb[_0x8c6d('0x46')];if(!_0x2fedab[_0x8c6d('0x48')][_0x8c6d('0x69')](_0x8c6d('0x6a'))){_0x405461[_0x8c6d('0x2f')]=qs[_0x8c6d('0x2f')](_0x2fedab[_0x8c6d('0x48')][_0x8c6d('0x2f')]);_0x405461[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x2fedab[_0x8c6d('0x48')][_0x8c6d('0x2e')]);}_0x405461[_0x8c6d('0x6b')]=qs[_0x8c6d('0x6c')](_0x2fedab[_0x8c6d('0x48')]['sort']);_0x405461[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_[_0x8c6d('0x50')](_0x2fedab[_0x8c6d('0x48')],_0x363fbb[_0x8c6d('0x4f')]));_0x405461[_0x8c6d('0x4e')][_0x8c6d('0x65')]=_0x94b152['id'];if(_0x2fedab[_0x8c6d('0x48')][_0x8c6d('0x53')]){_0x405461[_0x8c6d('0x4e')]=_[_0x8c6d('0x51')](_0x405461[_0x8c6d('0x4e')],{'$or':_[_0x8c6d('0x47')](_0x405461['attributes'],function(_0x35c5a9){var _0x9dc580={};_0x9dc580[_0x35c5a9]={'$like':'%'+_0x2fedab[_0x8c6d('0x48')][_0x8c6d('0x53')]+'%'};return _0x9dc580;})});}_0x405461=_['merge']({},_0x405461,_0x2fedab[_0x8c6d('0x54')]);return db[_0x8c6d('0x66')][_0x8c6d('0x2d')]({'where':_0x405461[_0x8c6d('0x4e')]})[_0x8c6d('0x21')](function(_0x4db68b){_0x1500f0[_0x8c6d('0x2d')]=_0x4db68b;if(_0x2fedab[_0x8c6d('0x48')]['includeAll']){_0x405461['include']=[{'all':!![]}];}return db[_0x8c6d('0x66')][_0x8c6d('0x6d')](_0x405461);})[_0x8c6d('0x21')](function(_0x232cac){_0x1500f0[_0x8c6d('0x56')]=_0x232cac;return _0x1500f0;});}})[_0x8c6d('0x21')](respondWithFilteredResult(_0x31dead,_0x405461))[_0x8c6d('0x29')](handleError(_0x31dead,null));};exports[_0x8c6d('0x6e')]=function(_0xefdb73,_0x3722be,_0x2778fa){return db['WhatsappAccount']['find']({'where':{'id':_0xefdb73['params']['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x3722be,null))[_0x8c6d('0x21')](function(_0x4b83df){if(_0x4b83df){return _0x4b83df[_0x8c6d('0x6e')](_0xefdb73['query'][_0x8c6d('0x6f')]);}})[_0x8c6d('0x21')](respondWithStatusCode(_0x3722be,null))[_0x8c6d('0x29')](handleError(_0x3722be,null));};exports[_0x8c6d('0x70')]=function(_0xcf76ab,_0x276ad5,_0xc233cb){if(_0xcf76ab['body']['id']){delete _0xcf76ab['body']['id'];}return db[_0x8c6d('0x41')][_0x8c6d('0x59')]({'where':{'id':_0xcf76ab[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x276ad5,null))[_0x8c6d('0x21')](function(_0x2b9d6b){if(_0x2b9d6b){_0xcf76ab[_0x8c6d('0x5b')][_0x8c6d('0x65')]=_0x2b9d6b['id'];return db[_0x8c6d('0x71')][_0x8c6d('0x5a')](_0xcf76ab['body']);}})[_0x8c6d('0x21')](respondWithResult(_0x276ad5,null))[_0x8c6d('0x29')](handleError(_0x276ad5,null));};exports[_0x8c6d('0x72')]=function(_0xed9664,_0x34ed47,_0x4c4c60){var _0x5b76bc={'raw':![],'where':{}};var _0x39b47c={};var _0x5e70cd={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8c6d('0x68')]({'where':{'id':_0xed9664[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x34ed47,null))[_0x8c6d('0x21')](function(_0x49a4ab){if(_0x49a4ab){_0x39b47c['model']=_[_0x8c6d('0x49')](db[_0x8c6d('0x71')][_0x8c6d('0x42')]);_0x39b47c['query']=_[_0x8c6d('0x49')](_0xed9664[_0x8c6d('0x48')]);_0x39b47c['filters']=_[_0x8c6d('0x4b')](_0x39b47c[_0x8c6d('0x46')],_0x39b47c[_0x8c6d('0x48')]);_0x5b76bc[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x39b47c[_0x8c6d('0x46')],qs[_0x8c6d('0x4c')](_0xed9664['query'][_0x8c6d('0x4c')]));_0x5b76bc[_0x8c6d('0x4a')]=_0x5b76bc[_0x8c6d('0x4a')][_0x8c6d('0x4d')]?_0x5b76bc[_0x8c6d('0x4a')]:_0x39b47c[_0x8c6d('0x46')];if(!_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x69')]('nolimit')){_0x5b76bc[_0x8c6d('0x2f')]=qs[_0x8c6d('0x2f')](_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x2f')]);_0x5b76bc[_0x8c6d('0x2e')]=qs['offset'](_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x2e')]);}_0x5b76bc[_0x8c6d('0x6b')]=qs[_0x8c6d('0x6c')](_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x6c')]);_0x5b76bc['where']=qs['filters'](_[_0x8c6d('0x50')](_0xed9664[_0x8c6d('0x48')],_0x39b47c[_0x8c6d('0x4f')]));_0x5b76bc[_0x8c6d('0x4e')][_0x8c6d('0x65')]=_0x49a4ab['id'];if(_0xed9664[_0x8c6d('0x48')]['filter']){_0x5b76bc[_0x8c6d('0x4e')]=_['merge'](_0x5b76bc[_0x8c6d('0x4e')],{'$or':_[_0x8c6d('0x47')](_0x5b76bc['attributes'],function(_0x4619cb){var _0x1c630a={};_0x1c630a[_0x4619cb]={'$like':'%'+_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x53')]+'%'};return _0x1c630a;})});}_0x5b76bc=_[_0x8c6d('0x51')]({},_0x5b76bc,_0xed9664[_0x8c6d('0x54')]);return db['CannedAnswer']['count']({'where':_0x5b76bc['where']})[_0x8c6d('0x21')](function(_0x5b5bd6){_0x5e70cd[_0x8c6d('0x2d')]=_0x5b5bd6;if(_0xed9664[_0x8c6d('0x48')][_0x8c6d('0x55')]){_0x5b76bc[_0x8c6d('0x58')]=[{'all':!![]}];}return db[_0x8c6d('0x71')]['findAll'](_0x5b76bc);})[_0x8c6d('0x21')](function(_0x51ea88){_0x5e70cd[_0x8c6d('0x56')]=_0x51ea88;return _0x5e70cd;});}})[_0x8c6d('0x21')](respondWithFilteredResult(_0x34ed47,_0x5b76bc))['catch'](handleError(_0x34ed47,null));};exports['removeAnswers']=function(_0x1929a3,_0x29e7dc,_0x12024b){return db[_0x8c6d('0x41')][_0x8c6d('0x59')]({'where':{'id':_0x1929a3['params']['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x29e7dc,null))[_0x8c6d('0x21')](function(_0x3f8ee2){if(_0x3f8ee2){return _0x3f8ee2[_0x8c6d('0x73')](_0x1929a3[_0x8c6d('0x48')][_0x8c6d('0x6f')]);}})[_0x8c6d('0x21')](respondWithStatusCode(_0x29e7dc,null))[_0x8c6d('0x29')](handleError(_0x29e7dc,null));};exports['addAgents']=function(_0x71ebbe,_0x3d8b8a,_0x530d72){return db['WhatsappAccount'][_0x8c6d('0x59')]({'where':{'id':_0x71ebbe['params']['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x3d8b8a,null))['then'](function(_0x36356c){if(_0x36356c){return _0x36356c[_0x8c6d('0x74')](_0x71ebbe[_0x8c6d('0x5b')][_0x8c6d('0x6f')],_[_0x8c6d('0x75')](_0x71ebbe[_0x8c6d('0x5b')],[_0x8c6d('0x6f'),'id'])||{})['spread'](function(_0x537463){for(var _0x142641=0x0;_0x142641<_0x71ebbe[_0x8c6d('0x5b')][_0x8c6d('0x6f')][_0x8c6d('0x4d')];_0x142641+=0x1){socket[_0x8c6d('0x76')](_0x8c6d('0x77'),{'UserId':_0x71ebbe[_0x8c6d('0x5b')][_0x8c6d('0x6f')][_0x142641],'WhatsappAccountId':_0x71ebbe[_0x8c6d('0x62')]['id']});}return _0x537463;});}})[_0x8c6d('0x21')](respondWithResult(_0x3d8b8a,null))['catch'](handleError(_0x3d8b8a,null));};exports[_0x8c6d('0x78')]=function(_0x244143,_0x3d8a7a,_0xe9e676){return db[_0x8c6d('0x41')]['find']({'where':{'id':_0x244143[_0x8c6d('0x62')]['id']}})['then'](handleEntityNotFound(_0x3d8a7a,null))[_0x8c6d('0x21')](function(_0x42b8af){if(_0x42b8af){return _0x42b8af['removeAgents'](_0x244143[_0x8c6d('0x48')]['ids'])[_0x8c6d('0x21')](function(){if(_['isArray'](_0x244143[_0x8c6d('0x48')][_0x8c6d('0x6f')])){for(var _0x39ddc9=0x0;_0x39ddc9<_0x244143[_0x8c6d('0x48')]['ids'][_0x8c6d('0x4d')];_0x39ddc9+=0x1){socket[_0x8c6d('0x76')](_0x8c6d('0x79'),{'UserId':Number(_0x244143['query'][_0x8c6d('0x6f')][_0x39ddc9]),'WhatsappAccountId':Number(_0x244143[_0x8c6d('0x62')]['id'])});}}else{socket[_0x8c6d('0x76')](_0x8c6d('0x79'),{'UserId':Number(_0x244143[_0x8c6d('0x48')][_0x8c6d('0x6f')]),'WhatsappAccountId':Number(_0x244143[_0x8c6d('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d8a7a,null))[_0x8c6d('0x29')](handleError(_0x3d8a7a,null));};exports[_0x8c6d('0x7a')]=function(_0x31a667,_0x1a0a12,_0x576dad){var _0x1cfbfe={};var _0x19fc0c={};var _0x43b864;var _0x1e8b0b;return db[_0x8c6d('0x41')][_0x8c6d('0x68')]({'where':{'id':_0x31a667[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x1a0a12,null))[_0x8c6d('0x21')](function(_0x30caff){if(_0x30caff){_0x43b864=_0x30caff;_0x19fc0c[_0x8c6d('0x46')]=_[_0x8c6d('0x49')](db['User']['rawAttributes']);_0x19fc0c['query']=_[_0x8c6d('0x49')](_0x31a667['query']);_0x19fc0c[_0x8c6d('0x4f')]=_[_0x8c6d('0x4b')](_0x19fc0c[_0x8c6d('0x46')],_0x19fc0c[_0x8c6d('0x48')]);_0x1cfbfe['attributes']=_[_0x8c6d('0x4b')](_0x19fc0c[_0x8c6d('0x46')],qs[_0x8c6d('0x4c')](_0x31a667[_0x8c6d('0x48')][_0x8c6d('0x4c')]));_0x1cfbfe[_0x8c6d('0x4a')]=_0x1cfbfe[_0x8c6d('0x4a')][_0x8c6d('0x4d')]?_0x1cfbfe['attributes']:_0x19fc0c[_0x8c6d('0x46')];_0x1cfbfe['order']=qs[_0x8c6d('0x6c')](_0x31a667[_0x8c6d('0x48')][_0x8c6d('0x6c')]);_0x1cfbfe['where']=qs['filters'](_[_0x8c6d('0x50')](_0x31a667[_0x8c6d('0x48')],_0x19fc0c[_0x8c6d('0x4f')]));if(_0x31a667[_0x8c6d('0x48')][_0x8c6d('0x53')]){_0x1cfbfe[_0x8c6d('0x4e')]=_['merge'](_0x1cfbfe[_0x8c6d('0x4e')],{'$or':_[_0x8c6d('0x47')](_0x1cfbfe[_0x8c6d('0x4a')],function(_0x3ce083){var _0x2729b4={};_0x2729b4[_0x3ce083]={'$like':'%'+_0x31a667['query'][_0x8c6d('0x53')]+'%'};return _0x2729b4;})});}_0x1cfbfe=_[_0x8c6d('0x51')]({},_0x1cfbfe,_0x31a667[_0x8c6d('0x54')]);return _0x43b864[_0x8c6d('0x7a')](_0x1cfbfe);}})[_0x8c6d('0x21')](function(_0x238f35){if(_0x238f35){_0x1e8b0b=_0x238f35[_0x8c6d('0x4d')];if(!_0x31a667[_0x8c6d('0x48')][_0x8c6d('0x69')]('nolimit')){_0x1cfbfe[_0x8c6d('0x2f')]=qs[_0x8c6d('0x2f')](_0x31a667[_0x8c6d('0x48')][_0x8c6d('0x2f')]);_0x1cfbfe[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x31a667['query'][_0x8c6d('0x2e')]);}return _0x43b864['getAgents'](_0x1cfbfe);}})[_0x8c6d('0x21')](function(_0x3c1e72){if(_0x3c1e72){return _0x3c1e72?{'count':_0x1e8b0b,'rows':_0x3c1e72}:null;}})[_0x8c6d('0x21')](respondWithResult(_0x1a0a12,null))[_0x8c6d('0x29')](handleError(_0x1a0a12,null));};exports[_0x8c6d('0x7b')]=function(_0x529b5f,_0x13c127,_0x106241){return db[_0x8c6d('0x41')]['findOne']({'where':{'id':_0x529b5f[_0x8c6d('0x62')]['id']}})[_0x8c6d('0x21')](handleEntityNotFound(_0x13c127,null))[_0x8c6d('0x21')](function(_0x3c26dc){if(_0x3c26dc){return db[_0x8c6d('0x7c')][_0x8c6d('0x7d')](function(_0x26c23d){return db[_0x8c6d('0x7e')][_0x8c6d('0x36')]({'where':{'WhatsappAccountId':_0x529b5f[_0x8c6d('0x62')]['id']},'transaction':_0x26c23d})[_0x8c6d('0x21')](function(_0x597fe7){var _0x5af491=_[_0x8c6d('0x47')](_0x529b5f[_0x8c6d('0x5b')],function(_0x34e206){_0x34e206[_0x8c6d('0x65')]=_0x529b5f['params']['id'];return _0x34e206;});return db[_0x8c6d('0x7e')]['bulkCreate'](_0x5af491,{'transaction':_0x26c23d});});})[_0x8c6d('0x21')](function(){return db['WhatsappApplication'][_0x8c6d('0x7f')]({'where':{'WhatsappAccountId':_0x529b5f[_0x8c6d('0x62')]['id']},'order':_0x8c6d('0x80')});});}})[_0x8c6d('0x21')](respondWithResult(_0x13c127,null))['catch'](handleError(_0x13c127,null));};exports[_0x8c6d('0x81')]=function(_0x33b84b,_0x290df2,_0x5ce02a){var _0x18b22f={};var _0x435f2b={};var _0x5c26dc;var _0x1be67d;return db[_0x8c6d('0x41')][_0x8c6d('0x68')]({'where':{'id':_0x33b84b[_0x8c6d('0x62')]['id']}})['then'](handleEntityNotFound(_0x290df2,null))['then'](function(_0x4ef00c){if(_0x4ef00c){_0x5c26dc=_0x4ef00c;_0x435f2b[_0x8c6d('0x46')]=_['keys'](db[_0x8c6d('0x7e')][_0x8c6d('0x42')]);_0x435f2b[_0x8c6d('0x48')]=_[_0x8c6d('0x49')](_0x33b84b['query']);_0x435f2b[_0x8c6d('0x4f')]=_[_0x8c6d('0x4b')](_0x435f2b[_0x8c6d('0x46')],_0x435f2b['query']);_0x18b22f[_0x8c6d('0x4a')]=_['intersection'](_0x435f2b[_0x8c6d('0x46')],qs[_0x8c6d('0x4c')](_0x33b84b[_0x8c6d('0x48')][_0x8c6d('0x4c')]));_0x18b22f[_0x8c6d('0x4a')]=_0x18b22f[_0x8c6d('0x4a')]['length']?_0x18b22f['attributes']:_0x435f2b[_0x8c6d('0x46')];_0x18b22f[_0x8c6d('0x6b')]=qs[_0x8c6d('0x6c')](_0x33b84b[_0x8c6d('0x48')][_0x8c6d('0x6c')]);_0x18b22f[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_[_0x8c6d('0x50')](_0x33b84b[_0x8c6d('0x48')],_0x435f2b[_0x8c6d('0x4f')]));if(_0x33b84b[_0x8c6d('0x48')][_0x8c6d('0x53')]){_0x18b22f[_0x8c6d('0x4e')]=_[_0x8c6d('0x51')](_0x18b22f['where'],{'$or':_['map'](_0x18b22f[_0x8c6d('0x4a')],function(_0x311a5a){var _0x5e5ba7={};_0x5e5ba7[_0x311a5a]={'$like':'%'+_0x33b84b['query'][_0x8c6d('0x53')]+'%'};return _0x5e5ba7;})});}_0x18b22f=_[_0x8c6d('0x51')]({},_0x18b22f,_0x33b84b[_0x8c6d('0x54')]);return _0x5c26dc[_0x8c6d('0x81')](_0x18b22f);}})[_0x8c6d('0x21')](function(_0x3d3a51){if(_0x3d3a51){_0x1be67d=_0x3d3a51[_0x8c6d('0x4d')];if(!_0x33b84b[_0x8c6d('0x48')]['hasOwnProperty'](_0x8c6d('0x6a'))){_0x18b22f['limit']=qs[_0x8c6d('0x2f')](_0x33b84b[_0x8c6d('0x48')][_0x8c6d('0x2f')]);_0x18b22f[_0x8c6d('0x2e')]=qs['offset'](_0x33b84b['query'][_0x8c6d('0x2e')]);}return _0x5c26dc[_0x8c6d('0x81')](_0x18b22f);}})[_0x8c6d('0x21')](function(_0x332de0){if(_0x332de0){return _0x332de0?{'count':_0x1be67d,'rows':_0x332de0}:null;}})[_0x8c6d('0x21')](respondWithResult(_0x290df2,null))[_0x8c6d('0x29')](handleError(_0x290df2,null));};exports[_0x8c6d('0x82')]=function(_0x196c74,_0x4c8cdc,_0xb63a7d){var _0x37cf5e={'channel':_0x8c6d('0x83')};var _0x5b7fb8=[];var _0x2b7c64=[];var _0x4b4b1a={};return db['WhatsappAccount'][_0x8c6d('0x59')]({'where':{'id':_0x196c74['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x8c6d('0x84')}]})[_0x8c6d('0x21')](handleEntityNotFound(_0x4c8cdc,null))[_0x8c6d('0x21')](function(_0x6fefe6){_0x37cf5e[_0x8c6d('0x85')]=_0x6fefe6;_0x37cf5e[_0x8c6d('0x86')]=_['orderBy'](_0x6fefe6[_0x8c6d('0x84')],[_0x8c6d('0x80')],[_0x8c6d('0x87')]);if(_0x37cf5e[_0x8c6d('0x85')]['Applications']){delete _0x37cf5e[_0x8c6d('0x85')][_0x8c6d('0x84')];}return db[_0x8c6d('0x88')][_0x8c6d('0x63')]();})['then'](function(_0x4202d3){if(!_0x4202d3){throw new db[(_0x8c6d('0x1f'))][(_0x8c6d('0x20'))](_0x8c6d('0x89'));}_0x5b7fb8=_[_0x8c6d('0x8a')](_[_0x8c6d('0x49')](_0x4202d3),[_0x8c6d('0x8b'),'updatedAt']);_0x2b7c64=_[_0x8c6d('0x8a')](_[_0x8c6d('0x49')](_0x4202d3),[_0x8c6d('0x8b'),_0x8c6d('0x8c'),_0x8c6d('0x8d'),'ListId']);_0x37cf5e[_0x8c6d('0x5b')]={'mapKey':_0x8c6d('0x8e')};if(_0x37cf5e[_0x8c6d('0x85')][_0x8c6d('0x44')]&&_0x37cf5e['account'][_0x8c6d('0x44')]===_0x8c6d('0x8f')){_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x90')]=_0x196c74['body'][_0x8c6d('0x91')][_0x8c6d('0x92')](_0x8c6d('0x93'),'');_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x5b')]=_0x196c74['body']['Body'];_0x37cf5e[_0x8c6d('0x5b')]['messageId']=_0x196c74['body'][_0x8c6d('0x94')];}if(_0x37cf5e[_0x8c6d('0x5b')]['id']){delete _0x37cf5e[_0x8c6d('0x5b')]['id'];}if(_['isNil'](_0x37cf5e[_0x8c6d('0x5b')]['from'])){throw new db[(_0x8c6d('0x1f'))]['ValidationError'](_0x8c6d('0x95'));}if(_[_0x8c6d('0x96')](_0x37cf5e['body'][_0x8c6d('0x5b')])||_0x37cf5e[_0x8c6d('0x5b')]['body']===''){throw new db[(_0x8c6d('0x1f'))][(_0x8c6d('0x20'))](_0x8c6d('0x97'));}if(_['isNil'](_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x98')])){throw new db[(_0x8c6d('0x1f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7c64);}if(!_[_0x8c6d('0x99')](_0x2b7c64,_0x37cf5e['body'][_0x8c6d('0x98')])){throw new db[(_0x8c6d('0x1f'))][(_0x8c6d('0x20'))](_0x8c6d('0x9a')+_0x2b7c64);}_0x4b4b1a[_0x37cf5e['body'][_0x8c6d('0x98')]]=_0x37cf5e[_0x8c6d('0x5b')]['from'];return db[_0x8c6d('0x9b')][_0x8c6d('0x59')]({'where':{'id':_0x37cf5e[_0x8c6d('0x85')][_0x8c6d('0x9c')]},'include':[{'model':db[_0x8c6d('0x88')],'as':_0x8c6d('0x9d'),'where':_0x4b4b1a,'limit':0x1,'order':[[_0x8c6d('0x8c'),_0x8c6d('0x9e')]]}]});})[_0x8c6d('0x21')](handleEntityNotFound(_0x4c8cdc,null))['then'](function(_0x44cf58){if(_0x44cf58){_0x37cf5e['list']=_[_0x8c6d('0x75')](_0x44cf58,[_0x8c6d('0x9d')]);if(_0x44cf58[_0x8c6d('0x9d')][_0x8c6d('0x4d')]){return _0x44cf58[_0x8c6d('0x9d')][0x0];}var _0x1befc1=_[_0x8c6d('0x16')](_0x37cf5e['body'],{'firstName':_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x90')],'ListId':_0x44cf58['id']});_0x1befc1[_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x98')]]=_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x90')];return db[_0x8c6d('0x88')][_0x8c6d('0x5a')](_0x1befc1,{'fields':_0x5b7fb8,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c8cdc,null))[_0x8c6d('0x21')](function(_0x1e141a){if(_0x1e141a){_0x37cf5e['contact']=_0x1e141a;var _0x166e91={'ContactId':_0x1e141a['id'],'phone':_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x90')],'WhatsappAccountId':_0x196c74[_0x8c6d('0x62')]['id']};var _0x54f967={'ContactId':_0x1e141a['id'],'WhatsappAccountId':_0x196c74[_0x8c6d('0x62')]['id'],'closed':![]};return db[_0x8c6d('0x9f')][_0x8c6d('0x59')]({'where':_0x54f967})['then'](function(_0x7ec86c){if(_0x7ec86c){return[_0x7ec86c,![]];}return db[_0x8c6d('0x9f')][_0x8c6d('0x5a')](_0x166e91)[_0x8c6d('0x21')](function(_0x27b82b){return[_0x27b82b,!![]];});});}})[_0x8c6d('0xa0')](function(_0x469848,_0x23e4f3){_0x37cf5e[_0x8c6d('0xa1')]=_0x469848[_0x8c6d('0x37')]({'plain':!![]});_0x37cf5e[_0x8c6d('0xa1')][_0x8c6d('0xa2')]=![];if(_0x23e4f3){if(_0x37cf5e['account'][_0x8c6d('0xa3')]){_0x37cf5e['applications'][_0x8c6d('0xa4')]({'id':0x0,'priority':_0x37cf5e['applications'][_0x8c6d('0x4d')]+0x1,'app':_0x8c6d('0xa5'),'appdata':_0x8c6d('0xa6'),'interval':_0x8c6d('0xa7')});}_0x37cf5e['interaction'][_0x8c6d('0xa2')]=!![];}return db[_0x8c6d('0xa8')][_0x8c6d('0x5a')]({'phone':_0x37cf5e['body'][_0x8c6d('0x90')],'messageId':_0x37cf5e['body']['messageId'],'body':_0x37cf5e[_0x8c6d('0x5b')][_0x8c6d('0x5b')],'WhatsappAccountId':_0x196c74[_0x8c6d('0x62')]['id'],'WhatsappInteractionId':_0x469848['id'],'direction':'in','ContactId':_0x469848['ContactId'],'AttachmentId':_0x37cf5e[_0x8c6d('0x5b')]['AttachmentId']});})[_0x8c6d('0x21')](function(_0x3a50bb){_0x37cf5e['message']=_0x3a50bb;if(_0x37cf5e[_0x8c6d('0xa1')][_0x8c6d('0xa9')]){return db[_0x8c6d('0xaa')][_0x8c6d('0x59')]({'attributes':['id','name'],'where':{'id':_0x37cf5e[_0x8c6d('0xa1')][_0x8c6d('0xa9')]}})['then'](function(_0x2d73a8){if(_0x2d73a8){_0x37cf5e['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x8c6d('0xab'),'appdata':_0x2d73a8[_0x8c6d('0x3c')]+','+(_0x37cf5e[_0x8c6d('0x85')][_0x8c6d('0xac')]||0xa),'interval':_0x8c6d('0xa7')});}return respondWithRpcPromise(_0x8c6d('0xad'),_0x8c6d('0xae'),_0x37cf5e);});}return respondWithRpcPromise(_0x8c6d('0xad'),_0x8c6d('0xae'),_0x37cf5e);})[_0x8c6d('0x21')](function(_0x4d877a){if(_0x4d877a){var _0x409652=0xc8;var _0x407140='receiveMessage';logger['info'](_0x8c6d('0xaf'),_0x407140,_0x409652,_0x8c6d('0xb0'));logger[_0x8c6d('0xb1')](_0x8c6d('0xb2'),_0x407140,_0x409652,_0x8c6d('0xb0'),JSON['stringify'](_0x4d877a));if(_0x37cf5e['account']['type']===_0x8c6d('0x8f')){return _0x4c8cdc[_0x8c6d('0x2b')](_0x409652)[_0x8c6d('0x30')](_0x8c6d('0xb3'),'text/xml')[_0x8c6d('0x3d')]('\x0a');}else{return _0x4c8cdc['status'](_0x409652)['json'](_0x4d877a);}}})[_0x8c6d('0x29')](handleError(_0x4c8cdc,null));};exports[_0x8c6d('0x3d')]=function(_0x385252,_0x24a0e6,_0x513a5a){var _0x377948,_0x10578b,_0x4baaf8;if(_['isNil'](_0x385252[_0x8c6d('0x5b')]['body'])||_0x385252['body'][_0x8c6d('0x5b')]===''){throw new db[(_0x8c6d('0x1f'))][(_0x8c6d('0x20'))](_0x8c6d('0x97'));}if(_[_0x8c6d('0x96')](_0x385252[_0x8c6d('0x5b')]['to'])){throw new db[(_0x8c6d('0x1f'))]['ValidationError']('to\x20is\x20mandatory');}_0x377948=_0x385252['body']['to'];return db[_0x8c6d('0x41')][_0x8c6d('0x59')]({'where':{'id':_0x385252[_0x8c6d('0x62')]['id']},'include':[{'model':db[_0x8c6d('0x9b')],'as':_0x8c6d('0xb4'),'include':[{'model':db[_0x8c6d('0x88')],'as':_0x8c6d('0x9d'),'where':{'mobile':_0x377948},'limit':0x1,'order':[[_0x8c6d('0x8c'),'DESC']]}]}]})[_0x8c6d('0x21')](handleEntityNotFound(_0x24a0e6,null))[_0x8c6d('0x21')](function(_0x3dd962){if(_0x3dd962&&_0x3dd962[_0x8c6d('0xb4')]){_0x10578b=_0x3dd962[_0x8c6d('0x37')]({'plain':!![]});if(_0x10578b[_0x8c6d('0xb4')]&&_0x10578b['List']['Contacts'][_0x8c6d('0x4d')]){return _0x10578b[_0x8c6d('0xb4')][_0x8c6d('0x9d')][0x0];}return db['CmContact'][_0x8c6d('0x5a')](_[_0x8c6d('0x16')](_0x385252['body'],{'firstName':_0x377948,'mobile':_0x377948,'phone':_0x377948,'ListId':_0x10578b[_0x8c6d('0x9c')]}));}})[_0x8c6d('0x21')](handleEntityNotFound(_0x24a0e6,null))[_0x8c6d('0x21')](function(_0x553184){if(_0x553184){_0x4baaf8=_0x553184;return db['WhatsappInteraction'][_0x8c6d('0x59')]({'where':{'ContactId':_0x4baaf8['id'],'closed':![],'WhatsappAccountId':_0x10578b['id']}})[_0x8c6d('0x21')](function(_0x53d7c1){if(_0x53d7c1){return[_0x53d7c1,![]];}return db['WhatsappInteraction'][_0x8c6d('0x5a')]({'UserId':_0x385252[_0x8c6d('0x5d')]['id'],'ContactId':_0x4baaf8['id'],'WhatsappAccountId':_0x10578b['id'],'phone':_0x377948,'firstMsgDirection':_0x8c6d('0xb5'),'Messages':[_[_0x8c6d('0x51')](_0x385252['body'],{'read':![],'body':_0x385252[_0x8c6d('0x5b')][_0x8c6d('0x5b')],'phone':_0x377948,'WhatsappAccountId':_0x10578b['id'],'UserId':_0x385252['user']['id'],'ContactId':_0x4baaf8['id']})]},{'include':[{'model':db[_0x8c6d('0xa8')],'as':_0x8c6d('0xb6')}]})[_0x8c6d('0x21')](function(_0x2678b6){return[_0x2678b6,!![]];});});}})[_0x8c6d('0xa0')](function(_0x3eba3e,_0x5d7503){if(_0x5d7503){return _0x3eba3e;}return db[_0x8c6d('0xa8')][_0x8c6d('0x5a')](_[_0x8c6d('0x51')](_0x385252[_0x8c6d('0x5b')],{'read':![],'body':_0x385252[_0x8c6d('0x5b')]['body'],'phone':_0x377948,'WhatsappAccountId':_0x10578b['id'],'WhatsappInteractionId':_0x3eba3e['id'],'UserId':_0x385252[_0x8c6d('0x5d')]['id'],'ContactId':_0x4baaf8['id']}))[_0x8c6d('0x21')](function(_0x2f6692){_0x3eba3e[_0x8c6d('0xb7')][_0x8c6d('0xb6')]=[];_0x3eba3e[_0x8c6d('0xb7')][_0x8c6d('0xb6')][_0x8c6d('0xa4')](_0x2f6692[_0x8c6d('0xb7')]);return _0x3eba3e;});})[_0x8c6d('0x21')](respondWithResult(_0x24a0e6,null))[_0x8c6d('0x29')](handleError(_0x24a0e6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b1adf73..782489a 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 _0xa498=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xa498,0x1d6));var _0x8a49=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0xa498[_0x3f940e];return _0x424b2e;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8a49('0x0'))['db'][_0x8a49('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a49('0x2'),'afterDestroy':_0x8a49('0x3')};function emitEvent(_0x1d4dd2){return function(_0x65eb15,_0x2f362e,_0x5aaf52){WhatsappAccountEvents[_0x8a49('0x4')](_0x1d4dd2+':'+_0x65eb15['id'],_0x65eb15);WhatsappAccountEvents['emit'](_0x1d4dd2,_0x65eb15);_0x5aaf52(null);};}for(var e in events){if(events[_0x8a49('0x5')](e)){var event=events[e];WhatsappAccount[_0x8a49('0x6')](e,emitEvent(event));}}module[_0x8a49('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa899=['exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x32cea3,_0x39e6ff){var _0x3189fd=function(_0x50785b){while(--_0x50785b){_0x32cea3['push'](_0x32cea3['shift']());}};_0x3189fd(++_0x39e6ff);}(_0xa899,0x155));var _0x9a89=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xa899[_0x4cd690];return _0x4a74a9;};'use strict';var EventEmitter=require(_0x9a89('0x0'));var WhatsappAccount=require(_0x9a89('0x1'))['db'][_0x9a89('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a89('0x3'),'afterUpdate':_0x9a89('0x4'),'afterDestroy':_0x9a89('0x5')};function emitEvent(_0x45233c){return function(_0x405c47,_0x15c431,_0x105758){WhatsappAccountEvents[_0x9a89('0x6')](_0x45233c+':'+_0x405c47['id'],_0x405c47);WhatsappAccountEvents[_0x9a89('0x6')](_0x45233c,_0x405c47);_0x105758(null);};}for(var e in events){if(events[_0x9a89('0x7')](e)){var event=events[e];WhatsappAccount[_0x9a89('0x8')](e,emitEvent(event));}}module[_0x9a89('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 ac75ec4..bc2f239 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 _0xe124=['WhatsappAccount','whatsapp_accounts','lodash','util','moment','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x19e448,_0x86b898){var _0x67e5d2=function(_0xe3043){while(--_0xe3043){_0x19e448['push'](_0x19e448['shift']());}};_0x67e5d2(++_0x86b898);}(_0xe124,0x16a));var _0x4e12=function(_0x252618,_0x5e8423){_0x252618=_0x252618-0x0;var _0x3669c0=_0xe124[_0x252618];return _0x3669c0;};'use strict';var _=require(_0x4e12('0x0'));var util=require(_0x4e12('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e12('0x2'));var BPromise=require(_0x4e12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e12('0x4'));var rimraf=require(_0x4e12('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e12('0x6'));module[_0x4e12('0x7')]=function(_0x37a4ef,_0x240565){return _0x37a4ef['define'](_0x4e12('0x8'),attributes,{'tableName':_0x4e12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae7f=['request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0xae7f,0x174));var _0xfae7=function(_0x215951,_0x575b2c){_0x215951=_0x215951-0x0;var _0x262999=_0xae7f[_0x215951];return _0x262999;};'use strict';var _=require(_0xfae7('0x0'));var util=require(_0xfae7('0x1'));var logger=require(_0xfae7('0x2'))(_0xfae7('0x3'));var moment=require(_0xfae7('0x4'));var BPromise=require('bluebird');var rp=require(_0xfae7('0x5'));var fs=require('fs');var path=require(_0xfae7('0x6'));var rimraf=require('rimraf');var config=require(_0xfae7('0x7'));var attributes=require(_0xfae7('0x8'));module[_0xfae7('0x9')]=function(_0x5c3ae9,_0x9393cf){return _0x5c3ae9[_0xfae7('0xa')](_0xfae7('0xb'),attributes,{'tableName':_0xfae7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 95bb4cf..3a1e3dd 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 _0xc6b8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','WhatsappAccount','options','where','attributes','include','model','map','ShowWhatsappAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xc2ea26,_0x6ca1b4){var _0x2d7bc2=function(_0x59d276){while(--_0x59d276){_0xc2ea26['push'](_0xc2ea26['shift']());}};_0x2d7bc2(++_0x6ca1b4);}(_0xc6b8,0x162));var _0x8c6b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc6b8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8c6b('0x0'));var util=require('util');var moment=require(_0x8c6b('0x1'));var BPromise=require(_0x8c6b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c6b('0x3'));var db=require(_0x8c6b('0x4'))['db'];var utils=require(_0x8c6b('0x5'));var logger=require(_0x8c6b('0x6'))(_0x8c6b('0x7'));var config=require(_0x8c6b('0x8'));var jayson=require(_0x8c6b('0x9'));var client=jayson[_0x8c6b('0xa')][_0x8c6b('0xb')]({'port':0x232a});config[_0x8c6b('0xc')]=_[_0x8c6b('0xd')](config[_0x8c6b('0xc')],{'host':_0x8c6b('0xe'),'port':0x18eb});var socket=require(_0x8c6b('0xf'))(new Redis(config[_0x8c6b('0xc')]));require(_0x8c6b('0x10'))[_0x8c6b('0x11')](socket);function respondWithRpcPromise(_0x441499,_0x133e20,_0x5654b2){return new BPromise(function(_0x127c84,_0x57929e){return client['request'](_0x441499,_0x5654b2)[_0x8c6b('0x12')](function(_0x57ad48){logger[_0x8c6b('0x13')](_0x8c6b('0x14'),_0x133e20,_0x8c6b('0x15'));logger[_0x8c6b('0x16')](_0x8c6b('0x17'),_0x133e20,'request\x20sent',JSON[_0x8c6b('0x18')](_0x57ad48));if(_0x57ad48[_0x8c6b('0x19')]){if(_0x57ad48[_0x8c6b('0x19')]['code']===0x1f4){logger[_0x8c6b('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x133e20,_0x57ad48[_0x8c6b('0x19')][_0x8c6b('0x1a')]);return _0x57929e(_0x57ad48[_0x8c6b('0x19')]['message']);}logger[_0x8c6b('0x19')](_0x8c6b('0x14'),_0x133e20,_0x57ad48[_0x8c6b('0x19')][_0x8c6b('0x1a')]);return _0x127c84(_0x57ad48[_0x8c6b('0x19')][_0x8c6b('0x1a')]);}else{logger['info'](_0x8c6b('0x14'),_0x133e20,_0x8c6b('0x15'));_0x127c84(_0x57ad48[_0x8c6b('0x1b')][_0x8c6b('0x1a')]);}})['catch'](function(_0x1884db){logger['error'](_0x8c6b('0x14'),_0x133e20,_0x1884db);_0x57929e(_0x1884db);});});}exports['ShowWhatsappAccount']=function(_0x3c888f){var _0x58029d=this;return new Promise(function(_0x17fb8d,_0x36ac37){return db[_0x8c6b('0x1c')]['find']({'raw':_0x3c888f['options']?_0x3c888f[_0x8c6b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3c888f[_0x8c6b('0x1d')]?_0x3c888f[_0x8c6b('0x1d')][_0x8c6b('0x1e')]||null:null,'attributes':_0x3c888f['options']?_0x3c888f['options'][_0x8c6b('0x1f')]||null:null,'include':_0x3c888f[_0x8c6b('0x1d')]?_0x3c888f[_0x8c6b('0x1d')]['include']?_['map'](_0x3c888f[_0x8c6b('0x1d')][_0x8c6b('0x20')],function(_0x327875){return{'model':db[_0x327875[_0x8c6b('0x21')]],'as':_0x327875['as'],'attributes':_0x327875[_0x8c6b('0x1f')],'include':_0x327875[_0x8c6b('0x20')]?_[_0x8c6b('0x22')](_0x327875['include'],function(_0x12513e){return{'model':db[_0x12513e[_0x8c6b('0x21')]],'as':_0x12513e['as'],'attributes':_0x12513e['attributes'],'include':_0x12513e[_0x8c6b('0x20')]?_[_0x8c6b('0x22')](_0x12513e[_0x8c6b('0x20')],function(_0x3f6890){return{'model':db[_0x3f6890['model']],'as':_0x3f6890['as'],'attributes':_0x3f6890['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c6b('0x12')](function(_0x27f15a){logger[_0x8c6b('0x13')]('ShowWhatsappAccount',_0x3c888f);logger[_0x8c6b('0x16')](_0x8c6b('0x23'),_0x3c888f,JSON[_0x8c6b('0x18')](_0x27f15a));_0x17fb8d(_0x27f15a);})['catch'](function(_0x29306d){logger[_0x8c6b('0x19')](_0x8c6b('0x23'),_0x29306d['message'],_0x3c888f);_0x36ac37(_0x58029d[_0x8c6b('0x19')](0x1f4,_0x29306d[_0x8c6b('0x1a')]));});});}; \ No newline at end of file +var _0x0473=['model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','map','include'];(function(_0x2586df,_0x17558e){var _0x5bc581=function(_0x2f6b47){while(--_0x2f6b47){_0x2586df['push'](_0x2586df['shift']());}};_0x5bc581(++_0x17558e);}(_0x0473,0x77));var _0x3047=function(_0x4a370f,_0x5da124){_0x4a370f=_0x4a370f-0x0;var _0x23de07=_0x0473[_0x4a370f];return _0x23de07;};'use strict';var _=require(_0x3047('0x0'));var util=require(_0x3047('0x1'));var moment=require(_0x3047('0x2'));var BPromise=require(_0x3047('0x3'));var rs=require(_0x3047('0x4'));var fs=require('fs');var Redis=require(_0x3047('0x5'));var db=require(_0x3047('0x6'))['db'];var utils=require(_0x3047('0x7'));var logger=require(_0x3047('0x8'))(_0x3047('0x9'));var config=require(_0x3047('0xa'));var jayson=require(_0x3047('0xb'));var client=jayson[_0x3047('0xc')][_0x3047('0xd')]({'port':0x232a});config[_0x3047('0xe')]=_[_0x3047('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3047('0x10'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x3047('0x11')](socket);function respondWithRpcPromise(_0x1b48c3,_0x2a346e,_0xc1839){return new BPromise(function(_0x53c20d,_0x15920d){return client['request'](_0x1b48c3,_0xc1839)[_0x3047('0x12')](function(_0x354e6a){logger[_0x3047('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x2a346e,_0x3047('0x14'));logger[_0x3047('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a346e,_0x3047('0x14'),JSON[_0x3047('0x16')](_0x354e6a));if(_0x354e6a[_0x3047('0x17')]){if(_0x354e6a[_0x3047('0x17')][_0x3047('0x18')]===0x1f4){logger['error'](_0x3047('0x19'),_0x2a346e,_0x354e6a['error'][_0x3047('0x1a')]);return _0x15920d(_0x354e6a[_0x3047('0x17')]['message']);}logger[_0x3047('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2a346e,_0x354e6a[_0x3047('0x17')][_0x3047('0x1a')]);return _0x53c20d(_0x354e6a[_0x3047('0x17')][_0x3047('0x1a')]);}else{logger[_0x3047('0x13')](_0x3047('0x19'),_0x2a346e,'request\x20sent');_0x53c20d(_0x354e6a[_0x3047('0x1b')][_0x3047('0x1a')]);}})[_0x3047('0x1c')](function(_0x4a2b22){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2a346e,_0x4a2b22);_0x15920d(_0x4a2b22);});});}exports['ShowWhatsappAccount']=function(_0x347a9e){var _0x53730b=this;return new Promise(function(_0xa54152,_0x340aee){return db[_0x3047('0x1d')][_0x3047('0x1e')]({'raw':_0x347a9e[_0x3047('0x1f')]?_0x347a9e[_0x3047('0x1f')][_0x3047('0x20')]===undefined?!![]:![]:!![],'where':_0x347a9e[_0x3047('0x1f')]?_0x347a9e[_0x3047('0x1f')][_0x3047('0x21')]||null:null,'attributes':_0x347a9e[_0x3047('0x1f')]?_0x347a9e[_0x3047('0x1f')][_0x3047('0x22')]||null:null,'include':_0x347a9e['options']?_0x347a9e[_0x3047('0x1f')]['include']?_[_0x3047('0x23')](_0x347a9e[_0x3047('0x1f')][_0x3047('0x24')],function(_0x18bcf7){return{'model':db[_0x18bcf7[_0x3047('0x25')]],'as':_0x18bcf7['as'],'attributes':_0x18bcf7[_0x3047('0x22')],'include':_0x18bcf7[_0x3047('0x24')]?_['map'](_0x18bcf7[_0x3047('0x24')],function(_0x42f953){return{'model':db[_0x42f953[_0x3047('0x25')]],'as':_0x42f953['as'],'attributes':_0x42f953[_0x3047('0x22')],'include':_0x42f953['include']?_[_0x3047('0x23')](_0x42f953[_0x3047('0x24')],function(_0x1f655a){return{'model':db[_0x1f655a[_0x3047('0x25')]],'as':_0x1f655a['as'],'attributes':_0x1f655a[_0x3047('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4d79){logger[_0x3047('0x13')](_0x3047('0x26'),_0x347a9e);logger[_0x3047('0x15')](_0x3047('0x26'),_0x347a9e,JSON['stringify'](_0x5f4d79));_0xa54152(_0x5f4d79);})['catch'](function(_0x28b01a){logger['error']('ShowWhatsappAccount',_0x28b01a[_0x3047('0x1a')],_0x347a9e);_0x340aee(_0x53730b[_0x3047('0x17')](0x1f4,_0x28b01a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 561b981..b9c5876 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 _0x1535=['register','whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener'];(function(_0x440d8e,_0x398f43){var _0x1d76ba=function(_0x2f0f6){while(--_0x2f0f6){_0x440d8e['push'](_0x440d8e['shift']());}};_0x1d76ba(++_0x398f43);}(_0x1535,0x14b));var _0x5153=function(_0x2c3d82,_0x332926){_0x2c3d82=_0x2c3d82-0x0;var _0xb81778=_0x1535[_0x2c3d82];return _0xb81778;};'use strict';var WhatsappAccountEvents=require(_0x5153('0x0'));var events=[_0x5153('0x1'),_0x5153('0x2'),_0x5153('0x3')];function createListener(_0x1bafef,_0x7ca148){return function(_0x366217){_0x7ca148['emit'](_0x1bafef,_0x366217);};}function removeListener(_0x49ab32,_0x5c7248){return function(){WhatsappAccountEvents[_0x5153('0x4')](_0x49ab32,_0x5c7248);};}exports[_0x5153('0x5')]=function(_0x2579bf){for(var _0x4126b0=0x0,_0xc0b9f4=events['length'];_0x4126b0<_0xc0b9f4;_0x4126b0++){var _0x58f971=events[_0x4126b0];var _0x13db68=createListener(_0x5153('0x6')+_0x58f971,_0x2579bf);WhatsappAccountEvents['on'](_0x58f971,_0x13db68);}}; \ No newline at end of file +var _0xa507=['emit','removeListener','register','length','save','update'];(function(_0x9e7bff,_0x38ffd4){var _0x5c781e=function(_0x28fbdb){while(--_0x28fbdb){_0x9e7bff['push'](_0x9e7bff['shift']());}};_0x5c781e(++_0x38ffd4);}(_0xa507,0xdc));var _0x7a50=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xa507[_0x283b55];return _0x192e58;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x7a50('0x0'),'remove',_0x7a50('0x1')];function createListener(_0x49c0ce,_0x276e39){return function(_0xfd54b0){_0x276e39[_0x7a50('0x2')](_0x49c0ce,_0xfd54b0);};}function removeListener(_0x49d58a,_0x2b47af){return function(){WhatsappAccountEvents[_0x7a50('0x3')](_0x49d58a,_0x2b47af);};}exports[_0x7a50('0x4')]=function(_0x12e5db){for(var _0x365406=0x0,_0x11f942=events[_0x7a50('0x5')];_0x365406<_0x11f942;_0x365406++){var _0x5c203f=events[_0x365406];var _0x2685e4=createListener('whatsappAccount:'+_0x5c203f,_0x12e5db);WhatsappAccountEvents['on'](_0x5c203f,_0x2685e4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b770b11..c2a60bb 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 _0xce70=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x354d0f,_0x2e2f2f){var _0x5e9d8e=function(_0x1d0f94){while(--_0x1d0f94){_0x354d0f['push'](_0x354d0f['shift']());}};_0x5e9d8e(++_0x2e2f2f);}(_0xce70,0x1df));var _0x0ce7=function(_0x4d9323,_0x45091c){_0x4d9323=_0x4d9323-0x0;var _0x48e98a=_0xce70[_0x4d9323];return _0x48e98a;};'use strict';var multer=require(_0x0ce7('0x0'));var util=require(_0x0ce7('0x1'));var path=require('path');var timeout=require(_0x0ce7('0x2'));var express=require(_0x0ce7('0x3'));var router=express['Router']();var auth=require(_0x0ce7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ce7('0x5'));var controller=require(_0x0ce7('0x6'));router[_0x0ce7('0x7')]('/',auth[_0x0ce7('0x8')](),controller[_0x0ce7('0x9')]);router[_0x0ce7('0x7')](_0x0ce7('0xa'),auth['isAuthenticated'](),controller[_0x0ce7('0xb')]);router[_0x0ce7('0xc')]('/',auth[_0x0ce7('0x8')](),controller['create']);router[_0x0ce7('0xd')]('/:id',auth[_0x0ce7('0x8')](),controller[_0x0ce7('0xe')]);router[_0x0ce7('0xf')](_0x0ce7('0xa'),auth[_0x0ce7('0x8')](),controller[_0x0ce7('0x10')]);module[_0x0ce7('0x11')]=router; \ No newline at end of file +var _0xdf29=['delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x1e535b,_0xc587){var _0x468d83=function(_0x597fb4){while(--_0x597fb4){_0x1e535b['push'](_0x1e535b['shift']());}};_0x468d83(++_0xc587);}(_0xdf29,0xa7));var _0x9df2=function(_0x933212,_0x1d6a47){_0x933212=_0x933212-0x0;var _0x36b058=_0xdf29[_0x933212];return _0x36b058;};'use strict';var multer=require('multer');var util=require(_0x9df2('0x0'));var path=require(_0x9df2('0x1'));var timeout=require(_0x9df2('0x2'));var express=require(_0x9df2('0x3'));var router=express[_0x9df2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9df2('0x5'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x9df2('0x6')](),controller[_0x9df2('0x7')]);router[_0x9df2('0x8')](_0x9df2('0x9'),auth[_0x9df2('0x6')](),controller[_0x9df2('0xa')]);router['post']('/',auth[_0x9df2('0x6')](),controller[_0x9df2('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9df2('0xc')]);router[_0x9df2('0xd')](_0x9df2('0x9'),auth[_0x9df2('0x6')](),controller[_0x9df2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fd59112..c3c9c23 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 _0x3cdb=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x3f7e37,_0x32f790){var _0x2a3ec7=function(_0x32922c){while(--_0x32922c){_0x3f7e37['push'](_0x3f7e37['shift']());}};_0x2a3ec7(++_0x32f790);}(_0x3cdb,0xf3));var _0xb3cd=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x3cdb[_0x8bb4c1];return _0x67a6e1;};'use strict';var Sequelize=require(_0xb3cd('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb3cd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb3cd('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb3cd('0x3')]()},'description':{'type':Sequelize[_0xb3cd('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb3cd('0x4')}}; \ No newline at end of file +var _0xca56=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1f7a83,_0x409f6a){var _0x29e1be=function(_0x427609){while(--_0x427609){_0x1f7a83['push'](_0x1f7a83['shift']());}};_0x29e1be(++_0x409f6a);}(_0xca56,0x1dc));var _0x6ca5=function(_0x3113bc,_0x51e4b6){_0x3113bc=_0x3113bc-0x0;var _0x4a5395=_0xca56[_0x3113bc];return _0x4a5395;};'use strict';var Sequelize=require(_0x6ca5('0x0'));module[_0x6ca5('0x1')]={'priority':{'type':Sequelize[_0x6ca5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6ca5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6ca5('0x3')],'defaultValue':_0x6ca5('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0fb17cf..abce83f 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 _0x8a93=['../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','VIRTUAL','filter','options','where','WhatsappApplication','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x11c4b6,_0x572fdb){var _0x2cb405=function(_0xf12cc4){while(--_0xf12cc4){_0x11c4b6['push'](_0x11c4b6['shift']());}};_0x2cb405(++_0x572fdb);}(_0x8a93,0x1e3));var _0x38a9=function(_0x458c52,_0x5e3fb4){_0x458c52=_0x458c52-0x0;var _0x43f43b=_0x8a93[_0x458c52];return _0x43f43b;};'use strict';var pdf=require(_0x38a9('0x0'));var emlformat=require(_0x38a9('0x1'));var rimraf=require(_0x38a9('0x2'));var zipdir=require(_0x38a9('0x3'));var jsonpatch=require(_0x38a9('0x4'));var rp=require('request-promise');var moment=require(_0x38a9('0x5'));var BPromise=require(_0x38a9('0x6'));var Mustache=require(_0x38a9('0x7'));var util=require('util');var path=require(_0x38a9('0x8'));var sox=require(_0x38a9('0x9'));var csv=require(_0x38a9('0xa'));var ejs=require(_0x38a9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38a9('0xc'));var crypto=require(_0x38a9('0xd'));var jsforce=require(_0x38a9('0xe'));var deskjs=require(_0x38a9('0xf'));var toCsv=require(_0x38a9('0xa'));var querystring=require(_0x38a9('0x10'));var Papa=require(_0x38a9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x38a9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38a9('0x13'));var logger=require('../../config/logger')(_0x38a9('0x14'));var utils=require('../../config/utils');var config=require(_0x38a9('0x15'));var db=require(_0x38a9('0x16'))['db'];function respondWithStatusCode(_0x18cdd9,_0x32b258){_0x32b258=_0x32b258||0xcc;return function(_0x441f74){if(_0x441f74){return _0x18cdd9[_0x38a9('0x17')](_0x32b258);}return _0x18cdd9['status'](_0x32b258)[_0x38a9('0x18')]();};}function respondWithResult(_0x5a5af7,_0xb79de3){_0xb79de3=_0xb79de3||0xc8;return function(_0x390dbf){if(_0x390dbf){return _0x5a5af7[_0x38a9('0x19')](_0xb79de3)[_0x38a9('0x1a')](_0x390dbf);}};}function respondWithFilteredResult(_0x2a3196,_0x5f4158){return function(_0x1f68ab){if(_0x1f68ab){var _0x4617e7=_0x1f68ab[_0x38a9('0x1b')],_0x12b70c=_0x5f4158[_0x38a9('0x1c')],_0x15cc90=_0x5f4158[_0x38a9('0x1c')]+_0x5f4158[_0x38a9('0x1d')],_0x2635b5;if(_0x15cc90>=_0x4617e7){_0x15cc90=_0x4617e7;_0x2635b5=0xc8;}else{_0x2635b5=0xce;}_0x2a3196['status'](_0x2635b5);return _0x2a3196[_0x38a9('0x1e')]('Content-Range',_0x12b70c+'-'+_0x15cc90+'/'+_0x4617e7)['json'](_0x1f68ab);}return null;};}function patchUpdates(_0x382996){return function(_0x2792dd){try{jsonpatch['apply'](_0x2792dd,_0x382996,!![]);}catch(_0x1778b5){return BPromise[_0x38a9('0x1f')](_0x1778b5);}return _0x2792dd[_0x38a9('0x20')]();};}function saveUpdates(_0x8079f0,_0x1b1b3c){return function(_0x302278){if(_0x302278){return _0x302278[_0x38a9('0x21')](_0x8079f0)['then'](function(_0x46dc80){return _0x46dc80;});}return null;};}function removeEntity(_0x44cfe2,_0x1b18ef){return function(_0x10444d){if(_0x10444d){return _0x10444d[_0x38a9('0x22')]()[_0x38a9('0x23')](function(){_0x44cfe2[_0x38a9('0x19')](0xcc)[_0x38a9('0x18')]();});}};}function handleEntityNotFound(_0x347760,_0x2a94d1){return function(_0x58edc2){if(!_0x58edc2){_0x347760['sendStatus'](0x194);}return _0x58edc2;};}function handleError(_0x461dad,_0x256e64){_0x256e64=_0x256e64||0x1f4;return function(_0x1f72ba){logger[_0x38a9('0x24')](_0x1f72ba[_0x38a9('0x25')]);if(_0x1f72ba[_0x38a9('0x26')]){delete _0x1f72ba[_0x38a9('0x26')];}_0x461dad[_0x38a9('0x19')](_0x256e64)[_0x38a9('0x27')](_0x1f72ba);};}exports[_0x38a9('0x28')]=function(_0x34db63,_0x3d70e7){var _0xfe4a57={},_0x5ed6f7={},_0x4a88bc={'count':0x0,'rows':[]};var _0x1d1e4c=_[_0x38a9('0x29')](db['WhatsappApplication'][_0x38a9('0x2a')],function(_0x31c54a){return{'name':_0x31c54a[_0x38a9('0x2b')],'type':_0x31c54a[_0x38a9('0x2c')]['key']};});_0x5ed6f7[_0x38a9('0x2d')]=_[_0x38a9('0x29')](_0x1d1e4c,_0x38a9('0x26'));_0x5ed6f7[_0x38a9('0x2e')]=_[_0x38a9('0x2f')](_0x34db63[_0x38a9('0x2e')]);_0x5ed6f7['filters']=_[_0x38a9('0x30')](_0x5ed6f7[_0x38a9('0x2d')],_0x5ed6f7[_0x38a9('0x2e')]);_0xfe4a57[_0x38a9('0x31')]=_[_0x38a9('0x30')](_0x5ed6f7[_0x38a9('0x2d')],qs[_0x38a9('0x32')](_0x34db63[_0x38a9('0x2e')]['fields']));_0xfe4a57['attributes']=_0xfe4a57['attributes'][_0x38a9('0x33')]?_0xfe4a57[_0x38a9('0x31')]:_0x5ed6f7[_0x38a9('0x2d')];if(!_0x34db63[_0x38a9('0x2e')][_0x38a9('0x34')](_0x38a9('0x35'))){_0xfe4a57[_0x38a9('0x1d')]=qs['limit'](_0x34db63[_0x38a9('0x2e')]['limit']);_0xfe4a57['offset']=qs[_0x38a9('0x1c')](_0x34db63[_0x38a9('0x2e')][_0x38a9('0x1c')]);}_0xfe4a57['order']=qs[_0x38a9('0x36')](_0x34db63[_0x38a9('0x2e')][_0x38a9('0x36')]);_0xfe4a57['where']=qs[_0x38a9('0x37')](_[_0x38a9('0x38')](_0x34db63[_0x38a9('0x2e')],_0x5ed6f7[_0x38a9('0x37')]),_0x1d1e4c);if(_0x34db63[_0x38a9('0x2e')]['filter']){_0xfe4a57['where']=_[_0x38a9('0x39')](_0xfe4a57['where'],{'$or':_['map'](_0x1d1e4c,function(_0x400aec){if(_0x400aec[_0x38a9('0x2c')]!==_0x38a9('0x3a')){var _0x5825d1={};_0x5825d1[_0x400aec[_0x38a9('0x26')]]={'$like':'%'+_0x34db63[_0x38a9('0x2e')][_0x38a9('0x3b')]+'%'};return _0x5825d1;}})});}_0xfe4a57=_['merge']({},_0xfe4a57,_0x34db63[_0x38a9('0x3c')]);var _0x3f3eb5={'where':_0xfe4a57[_0x38a9('0x3d')]};return db[_0x38a9('0x3e')][_0x38a9('0x1b')](_0x3f3eb5)[_0x38a9('0x23')](function(_0x3940da){_0x4a88bc['count']=_0x3940da;if(_0x34db63[_0x38a9('0x2e')][_0x38a9('0x3f')]){_0xfe4a57[_0x38a9('0x40')]=[{'all':!![]}];}return db[_0x38a9('0x3e')][_0x38a9('0x41')](_0xfe4a57);})['then'](function(_0x9275c7){_0x4a88bc['rows']=_0x9275c7;return _0x4a88bc;})['then'](respondWithFilteredResult(_0x3d70e7,_0xfe4a57))[_0x38a9('0x42')](handleError(_0x3d70e7,null));};exports[_0x38a9('0x43')]=function(_0x18bea5,_0x5052db){var _0x5ed801={'raw':!![],'where':{'id':_0x18bea5[_0x38a9('0x44')]['id']}},_0x407465={};_0x407465['model']=_[_0x38a9('0x2f')](db[_0x38a9('0x3e')][_0x38a9('0x2a')]);_0x407465[_0x38a9('0x2e')]=_[_0x38a9('0x2f')](_0x18bea5[_0x38a9('0x2e')]);_0x407465[_0x38a9('0x37')]=_[_0x38a9('0x30')](_0x407465['model'],_0x407465[_0x38a9('0x2e')]);_0x5ed801[_0x38a9('0x31')]=_['intersection'](_0x407465['model'],qs[_0x38a9('0x32')](_0x18bea5['query']['fields']));_0x5ed801['attributes']=_0x5ed801['attributes'][_0x38a9('0x33')]?_0x5ed801['attributes']:_0x407465[_0x38a9('0x2d')];if(_0x18bea5['query'][_0x38a9('0x3f')]){_0x5ed801[_0x38a9('0x40')]=[{'all':!![]}];}_0x5ed801=_['merge']({},_0x5ed801,_0x18bea5[_0x38a9('0x3c')]);return db[_0x38a9('0x3e')][_0x38a9('0x45')](_0x5ed801)[_0x38a9('0x23')](handleEntityNotFound(_0x5052db,null))['then'](respondWithResult(_0x5052db,null))[_0x38a9('0x42')](handleError(_0x5052db,null));};exports[_0x38a9('0x46')]=function(_0x54b4b2,_0x3b5a32){return db[_0x38a9('0x3e')][_0x38a9('0x46')](_0x54b4b2[_0x38a9('0x47')],{})[_0x38a9('0x23')](respondWithResult(_0x3b5a32,0xc9))[_0x38a9('0x42')](handleError(_0x3b5a32,null));};exports['update']=function(_0x5c3d8d,_0x3ce22b){if(_0x5c3d8d[_0x38a9('0x47')]['id']){delete _0x5c3d8d[_0x38a9('0x47')]['id'];}return db['WhatsappApplication'][_0x38a9('0x45')]({'where':{'id':_0x5c3d8d[_0x38a9('0x44')]['id']}})[_0x38a9('0x23')](handleEntityNotFound(_0x3ce22b,null))[_0x38a9('0x23')](saveUpdates(_0x5c3d8d['body'],null))['then'](respondWithResult(_0x3ce22b,null))[_0x38a9('0x42')](handleError(_0x3ce22b,null));};exports[_0x38a9('0x22')]=function(_0x495c32,_0x2a9059){return db['WhatsappApplication'][_0x38a9('0x45')]({'where':{'id':_0x495c32[_0x38a9('0x44')]['id']}})[_0x38a9('0x23')](handleEntityNotFound(_0x2a9059,null))['then'](removeEntity(_0x2a9059,null))[_0x38a9('0x42')](handleError(_0x2a9059,null));}; \ No newline at end of file +var _0xa525=['index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','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','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xa525,0x1e1));var _0x5a52=function(_0x5ca868,_0xcf669){_0x5ca868=_0x5ca868-0x0;var _0x2c8b6f=_0xa525[_0x5ca868];return _0x2c8b6f;};'use strict';var pdf=require(_0x5a52('0x0'));var emlformat=require(_0x5a52('0x1'));var rimraf=require(_0x5a52('0x2'));var zipdir=require(_0x5a52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a52('0x4'));var BPromise=require(_0x5a52('0x5'));var Mustache=require(_0x5a52('0x6'));var util=require(_0x5a52('0x7'));var path=require(_0x5a52('0x8'));var sox=require(_0x5a52('0x9'));var csv=require(_0x5a52('0xa'));var ejs=require(_0x5a52('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a52('0xc'));var crypto=require(_0x5a52('0xd'));var jsforce=require(_0x5a52('0xe'));var deskjs=require(_0x5a52('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5a52('0x10'));var Papa=require(_0x5a52('0x11'));var Redis=require(_0x5a52('0x12'));var authService=require(_0x5a52('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5a52('0x14'));var hardwareService=require(_0x5a52('0x15'));var logger=require('../../config/logger')(_0x5a52('0x16'));var utils=require(_0x5a52('0x17'));var config=require(_0x5a52('0x18'));var db=require(_0x5a52('0x19'))['db'];function respondWithStatusCode(_0x36b37e,_0x16c281){_0x16c281=_0x16c281||0xcc;return function(_0x21af02){if(_0x21af02){return _0x36b37e[_0x5a52('0x1a')](_0x16c281);}return _0x36b37e['status'](_0x16c281)[_0x5a52('0x1b')]();};}function respondWithResult(_0x13a75c,_0x4b8139){_0x4b8139=_0x4b8139||0xc8;return function(_0x1a8634){if(_0x1a8634){return _0x13a75c[_0x5a52('0x1c')](_0x4b8139)[_0x5a52('0x1d')](_0x1a8634);}};}function respondWithFilteredResult(_0x53ec87,_0x341998){return function(_0x33fd03){if(_0x33fd03){var _0x721940=_0x33fd03[_0x5a52('0x1e')],_0x1280ca=_0x341998[_0x5a52('0x1f')],_0x19afb5=_0x341998[_0x5a52('0x1f')]+_0x341998[_0x5a52('0x20')],_0x3918e4;if(_0x19afb5>=_0x721940){_0x19afb5=_0x721940;_0x3918e4=0xc8;}else{_0x3918e4=0xce;}_0x53ec87['status'](_0x3918e4);return _0x53ec87[_0x5a52('0x21')](_0x5a52('0x22'),_0x1280ca+'-'+_0x19afb5+'/'+_0x721940)[_0x5a52('0x1d')](_0x33fd03);}return null;};}function patchUpdates(_0x1601a8){return function(_0x49112e){try{jsonpatch[_0x5a52('0x23')](_0x49112e,_0x1601a8,!![]);}catch(_0x19c29c){return BPromise[_0x5a52('0x24')](_0x19c29c);}return _0x49112e[_0x5a52('0x25')]();};}function saveUpdates(_0x300a79,_0x5c662f){return function(_0x442c90){if(_0x442c90){return _0x442c90[_0x5a52('0x26')](_0x300a79)[_0x5a52('0x27')](function(_0x4f7ac1){return _0x4f7ac1;});}return null;};}function removeEntity(_0x3dc9e7,_0xa624d8){return function(_0x2d1d41){if(_0x2d1d41){return _0x2d1d41[_0x5a52('0x28')]()['then'](function(){_0x3dc9e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b56f9,_0x341fdc){return function(_0x2c6777){if(!_0x2c6777){_0x3b56f9[_0x5a52('0x1a')](0x194);}return _0x2c6777;};}function handleError(_0x46d08e,_0x3c1226){_0x3c1226=_0x3c1226||0x1f4;return function(_0x146c85){logger[_0x5a52('0x29')](_0x146c85[_0x5a52('0x2a')]);if(_0x146c85['name']){delete _0x146c85[_0x5a52('0x2b')];}_0x46d08e[_0x5a52('0x1c')](_0x3c1226)['send'](_0x146c85);};}exports[_0x5a52('0x2c')]=function(_0x43e207,_0x4b9d2f){var _0x3e74a2={},_0x30e814={},_0x3c79f0={'count':0x0,'rows':[]};var _0x51ff87=_[_0x5a52('0x2d')](db[_0x5a52('0x2e')][_0x5a52('0x2f')],function(_0x3c9ab5){return{'name':_0x3c9ab5['fieldName'],'type':_0x3c9ab5[_0x5a52('0x30')][_0x5a52('0x31')]};});_0x30e814[_0x5a52('0x32')]=_['map'](_0x51ff87,_0x5a52('0x2b'));_0x30e814[_0x5a52('0x33')]=_[_0x5a52('0x34')](_0x43e207['query']);_0x30e814['filters']=_[_0x5a52('0x35')](_0x30e814[_0x5a52('0x32')],_0x30e814[_0x5a52('0x33')]);_0x3e74a2[_0x5a52('0x36')]=_['intersection'](_0x30e814[_0x5a52('0x32')],qs[_0x5a52('0x37')](_0x43e207[_0x5a52('0x33')][_0x5a52('0x37')]));_0x3e74a2['attributes']=_0x3e74a2[_0x5a52('0x36')][_0x5a52('0x38')]?_0x3e74a2[_0x5a52('0x36')]:_0x30e814[_0x5a52('0x32')];if(!_0x43e207['query']['hasOwnProperty'](_0x5a52('0x39'))){_0x3e74a2['limit']=qs['limit'](_0x43e207['query'][_0x5a52('0x20')]);_0x3e74a2[_0x5a52('0x1f')]=qs[_0x5a52('0x1f')](_0x43e207[_0x5a52('0x33')][_0x5a52('0x1f')]);}_0x3e74a2[_0x5a52('0x3a')]=qs[_0x5a52('0x3b')](_0x43e207[_0x5a52('0x33')][_0x5a52('0x3b')]);_0x3e74a2[_0x5a52('0x3c')]=qs[_0x5a52('0x3d')](_[_0x5a52('0x3e')](_0x43e207['query'],_0x30e814[_0x5a52('0x3d')]),_0x51ff87);if(_0x43e207[_0x5a52('0x33')][_0x5a52('0x3f')]){_0x3e74a2[_0x5a52('0x3c')]=_[_0x5a52('0x40')](_0x3e74a2[_0x5a52('0x3c')],{'$or':_[_0x5a52('0x2d')](_0x51ff87,function(_0x447649){if(_0x447649[_0x5a52('0x30')]!==_0x5a52('0x41')){var _0x5c9716={};_0x5c9716[_0x447649[_0x5a52('0x2b')]]={'$like':'%'+_0x43e207['query'][_0x5a52('0x3f')]+'%'};return _0x5c9716;}})});}_0x3e74a2=_['merge']({},_0x3e74a2,_0x43e207[_0x5a52('0x42')]);var _0x2b3be2={'where':_0x3e74a2['where']};return db[_0x5a52('0x2e')][_0x5a52('0x1e')](_0x2b3be2)[_0x5a52('0x27')](function(_0x4aefe1){_0x3c79f0[_0x5a52('0x1e')]=_0x4aefe1;if(_0x43e207[_0x5a52('0x33')][_0x5a52('0x43')]){_0x3e74a2['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x3e74a2);})['then'](function(_0x271e17){_0x3c79f0[_0x5a52('0x44')]=_0x271e17;return _0x3c79f0;})[_0x5a52('0x27')](respondWithFilteredResult(_0x4b9d2f,_0x3e74a2))[_0x5a52('0x45')](handleError(_0x4b9d2f,null));};exports['show']=function(_0x14cc7e,_0x5e8673){var _0x218b56={'raw':!![],'where':{'id':_0x14cc7e[_0x5a52('0x46')]['id']}},_0x5afc47={};_0x5afc47[_0x5a52('0x32')]=_[_0x5a52('0x34')](db[_0x5a52('0x2e')][_0x5a52('0x2f')]);_0x5afc47['query']=_['keys'](_0x14cc7e[_0x5a52('0x33')]);_0x5afc47['filters']=_[_0x5a52('0x35')](_0x5afc47[_0x5a52('0x32')],_0x5afc47[_0x5a52('0x33')]);_0x218b56[_0x5a52('0x36')]=_[_0x5a52('0x35')](_0x5afc47[_0x5a52('0x32')],qs[_0x5a52('0x37')](_0x14cc7e[_0x5a52('0x33')][_0x5a52('0x37')]));_0x218b56['attributes']=_0x218b56['attributes'][_0x5a52('0x38')]?_0x218b56['attributes']:_0x5afc47[_0x5a52('0x32')];if(_0x14cc7e[_0x5a52('0x33')][_0x5a52('0x43')]){_0x218b56[_0x5a52('0x47')]=[{'all':!![]}];}_0x218b56=_[_0x5a52('0x40')]({},_0x218b56,_0x14cc7e[_0x5a52('0x42')]);return db['WhatsappApplication'][_0x5a52('0x48')](_0x218b56)[_0x5a52('0x27')](handleEntityNotFound(_0x5e8673,null))['then'](respondWithResult(_0x5e8673,null))[_0x5a52('0x45')](handleError(_0x5e8673,null));};exports[_0x5a52('0x49')]=function(_0x55a370,_0x2f660a){return db['WhatsappApplication'][_0x5a52('0x49')](_0x55a370[_0x5a52('0x4a')],{})[_0x5a52('0x27')](respondWithResult(_0x2f660a,0xc9))[_0x5a52('0x45')](handleError(_0x2f660a,null));};exports[_0x5a52('0x26')]=function(_0x33bb46,_0xade2fc){if(_0x33bb46[_0x5a52('0x4a')]['id']){delete _0x33bb46['body']['id'];}return db[_0x5a52('0x2e')][_0x5a52('0x48')]({'where':{'id':_0x33bb46[_0x5a52('0x46')]['id']}})[_0x5a52('0x27')](handleEntityNotFound(_0xade2fc,null))[_0x5a52('0x27')](saveUpdates(_0x33bb46[_0x5a52('0x4a')],null))[_0x5a52('0x27')](respondWithResult(_0xade2fc,null))['catch'](handleError(_0xade2fc,null));};exports[_0x5a52('0x28')]=function(_0xbe5ef1,_0x200f5d){return db['WhatsappApplication'][_0x5a52('0x48')]({'where':{'id':_0xbe5ef1['params']['id']}})[_0x5a52('0x27')](handleEntityNotFound(_0x200f5d,null))['then'](removeEntity(_0x200f5d,null))[_0x5a52('0x45')](handleError(_0x200f5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 102ced2..b7aec04 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 _0x3264=['./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x3264,0x7f));var _0x4326=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3264[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var logger=require(_0x4326('0x1'))(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4326('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4326('0x5'));module[_0x4326('0x6')]=function(_0xed0465,_0x3f8d4e){return _0xed0465['define'](_0x4326('0x7'),attributes,{'tableName':_0x4326('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4326('0x9'),'collate':_0x4326('0xa')});}; \ No newline at end of file +var _0x6b20=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4'];(function(_0x3e5a9e,_0x19a237){var _0x195044=function(_0x1053d3){while(--_0x1053d3){_0x3e5a9e['push'](_0x3e5a9e['shift']());}};_0x195044(++_0x19a237);}(_0x6b20,0xd1));var _0x06b2=function(_0x3c4ae8,_0xd1de3){_0x3c4ae8=_0x3c4ae8-0x0;var _0x5a9321=_0x6b20[_0x3c4ae8];return _0x5a9321;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var logger=require('../../config/logger')(_0x06b2('0x2'));var moment=require('moment');var BPromise=require(_0x06b2('0x3'));var rp=require(_0x06b2('0x4'));var fs=require('fs');var path=require(_0x06b2('0x5'));var rimraf=require('rimraf');var config=require(_0x06b2('0x6'));var attributes=require(_0x06b2('0x7'));module[_0x06b2('0x8')]=function(_0x30d39c,_0x3b792b){return _0x30d39c[_0x06b2('0x9')](_0x06b2('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06b2('0xb'),'collate':_0x06b2('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 126d010..ceb4824 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 _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4148,0xc6));var _0x8414=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0x4148[_0x3441e9];return _0x7f9ada;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file +var _0x07e8=['moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x07e8,0x10f));var _0x807e=function(_0x6b0f0e,_0x1fc315){_0x6b0f0e=_0x6b0f0e-0x0;var _0x1eed67=_0x07e8[_0x6b0f0e];return _0x1eed67;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa12efd,_0x30766c,_0x178efb){return new BPromise(function(_0x1845b3,_0x54e3cb){return client[_0x807e('0x9')](_0xa12efd,_0x178efb)[_0x807e('0xa')](function(_0x400374){logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));logger[_0x807e('0xe')](_0x807e('0xf'),_0x30766c,_0x807e('0xd'),JSON[_0x807e('0x10')](_0x400374));if(_0x400374[_0x807e('0x11')]){if(_0x400374[_0x807e('0x11')][_0x807e('0x12')]===0x1f4){logger[_0x807e('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x30766c,_0x400374[_0x807e('0x11')][_0x807e('0x13')]);return _0x54e3cb(_0x400374[_0x807e('0x11')][_0x807e('0x13')]);}logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x400374[_0x807e('0x11')]['message']);return _0x1845b3(_0x400374['error'][_0x807e('0x13')]);}else{logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));_0x1845b3(_0x400374['result'][_0x807e('0x13')]);}})[_0x807e('0x14')](function(_0x1ffc81){logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x1ffc81);_0x54e3cb(_0x1ffc81);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1233ab1..c98a682 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 _0xf9a6=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x2dbe73,_0x185cf9){var _0x2ac241=function(_0x51357e){while(--_0x51357e){_0x2dbe73['push'](_0x2dbe73['shift']());}};_0x2ac241(++_0x185cf9);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x3513e5,_0x18968e){_0x3513e5=_0x3513e5-0x0;var _0x33ff7d=_0xf9a6[_0x3513e5];return _0x33ff7d;};'use strict';var multer=require(_0x6f9a('0x0'));var util=require(_0x6f9a('0x1'));var path=require(_0x6f9a('0x2'));var timeout=require(_0x6f9a('0x3'));var express=require(_0x6f9a('0x4'));var router=express['Router']();var auth=require(_0x6f9a('0x5'));var interaction=require(_0x6f9a('0x6'));var config=require('../../config/environment');var controller=require(_0x6f9a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6f9a('0x8')]);router[_0x6f9a('0x9')](_0x6f9a('0xa'),auth[_0x6f9a('0xb')](),controller['describe']);router[_0x6f9a('0x9')](_0x6f9a('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6f9a('0xd'),auth['isAuthenticated'](),controller[_0x6f9a('0xe')]);router[_0x6f9a('0x9')](_0x6f9a('0xf'),auth[_0x6f9a('0xb')](),controller[_0x6f9a('0x10')]);router['post']('/',auth[_0x6f9a('0xb')](),controller['create']);router[_0x6f9a('0x11')](_0x6f9a('0xd'),auth[_0x6f9a('0xb')](),controller[_0x6f9a('0x12')]);router[_0x6f9a('0x11')](_0x6f9a('0x13'),auth[_0x6f9a('0xb')](),interaction[_0x6f9a('0x14')](_0x6f9a('0x15'),_0x6f9a('0x16')),controller['addTags']);router[_0x6f9a('0x17')](_0x6f9a('0xc'),auth[_0x6f9a('0xb')](),interaction[_0x6f9a('0x14')](_0x6f9a('0x15'),_0x6f9a('0x18')),controller[_0x6f9a('0x19')]);router[_0x6f9a('0x1a')](_0x6f9a('0xc'),auth[_0x6f9a('0xb')](),interaction[_0x6f9a('0x14')]('whatsapp',_0x6f9a('0x1b')),controller[_0x6f9a('0x1c')]);router['delete']('/:id/tags',auth[_0x6f9a('0xb')](),controller[_0x6f9a('0x1d')]);module[_0x6f9a('0x1e')]=router; \ No newline at end of file +var _0x3cd3=['post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x8c8310,_0x29ea05){var _0x1a4c20=function(_0xd3cc1c){while(--_0xd3cc1c){_0x8c8310['push'](_0x8c8310['shift']());}};_0x1a4c20(++_0x29ea05);}(_0x3cd3,0x125));var _0x33cd=function(_0x1d37a6,_0xaaef06){_0x1d37a6=_0x1d37a6-0x0;var _0x17bc51=_0x3cd3[_0x1d37a6];return _0x17bc51;};'use strict';var multer=require(_0x33cd('0x0'));var util=require('util');var path=require(_0x33cd('0x1'));var timeout=require(_0x33cd('0x2'));var express=require(_0x33cd('0x3'));var router=express[_0x33cd('0x4')]();var auth=require(_0x33cd('0x5'));var interaction=require(_0x33cd('0x6'));var config=require('../../config/environment');var controller=require(_0x33cd('0x7'));router[_0x33cd('0x8')]('/',auth[_0x33cd('0x9')](),controller['index']);router[_0x33cd('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x33cd('0xa')]);router['get'](_0x33cd('0xb'),auth[_0x33cd('0x9')](),controller[_0x33cd('0xc')]);router[_0x33cd('0x8')](_0x33cd('0xd'),auth[_0x33cd('0x9')](),controller[_0x33cd('0xe')]);router['get'](_0x33cd('0xf'),auth[_0x33cd('0x9')](),controller[_0x33cd('0x10')]);router[_0x33cd('0x11')]('/',auth[_0x33cd('0x9')](),controller[_0x33cd('0x12')]);router[_0x33cd('0x11')](_0x33cd('0xd'),auth[_0x33cd('0x9')](),controller[_0x33cd('0x13')]);router[_0x33cd('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x33cd('0x14')](_0x33cd('0x15'),_0x33cd('0x16')),controller['addTags']);router[_0x33cd('0x17')](_0x33cd('0xb'),auth['isAuthenticated'](),interaction[_0x33cd('0x14')]('whatsapp',_0x33cd('0x18')),controller[_0x33cd('0x19')]);router[_0x33cd('0x1a')](_0x33cd('0xb'),auth[_0x33cd('0x9')](),interaction['tracked'](_0x33cd('0x15'),_0x33cd('0x1b')),controller[_0x33cd('0x1c')]);router[_0x33cd('0x1a')]('/:id/tags',auth[_0x33cd('0x9')](),controller[_0x33cd('0x1d')]);module[_0x33cd('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 a24ec79..4028080 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 _0xce1b=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce1b,0x1d4));var _0xbce1=function(_0x217719,_0x3c5899){_0x217719=_0x217719-0x0;var _0x1af2b0=_0xce1b[_0x217719];return _0x1af2b0;};'use strict';var Sequelize=require(_0xbce1('0x0'));var moment=require('moment');module[_0xbce1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbce1('0x2')]},'disposition':{'type':Sequelize[_0xbce1('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbce1('0x3')]},'read1stAt':{'type':Sequelize[_0xbce1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbce1('0x4')]('in',_0xbce1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbce1('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0ae6=['exports','BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x41600f,_0x5320df){var _0x4b4286=function(_0x375442){while(--_0x375442){_0x41600f['push'](_0x41600f['shift']());}};_0x4b4286(++_0x5320df);}(_0x0ae6,0x1d9));var _0x60ae=function(_0x5c8cd3,_0x2411cd){_0x5c8cd3=_0x5c8cd3-0x0;var _0x1e9ca6=_0x0ae6[_0x5c8cd3];return _0x1e9ca6;};'use strict';var Sequelize=require(_0x60ae('0x0'));var moment=require('moment');module[_0x60ae('0x1')]={'closed':{'type':Sequelize[_0x60ae('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x60ae('0x3')]},'disposition':{'type':Sequelize[_0x60ae('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x60ae('0x4')]},'read1stAt':{'type':Sequelize[_0x60ae('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x60ae('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x60ae('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x60ae('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 661f665..3b82872 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(_0xe589dc,_0x47abdc){var _0x4163d4=function(_0x1c1058){while(--_0x1c1058){_0xe589dc['push'](_0xe589dc['shift']());}};_0x4163d4(++_0x47abdc);}(_0xadb5,0xad));var _0x5adb=function(_0x167eb7,_0x5425c2){_0x167eb7=_0x167eb7-0x0;var _0x49600e=_0xadb5[_0x167eb7];return _0x49600e;};'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 _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(_0x78fd21,_0x24199d){var _0x5087cd=function(_0x551fe4){while(--_0x551fe4){_0x78fd21['push'](_0x78fd21['shift']());}};_0x5087cd(++_0x24199d);}(_0xadb5,0xad));var _0x5adb=function(_0x3bdb13,_0x4ab302){_0x3bdb13=_0x3bdb13-0x0;var _0x1ec9c4=_0xadb5[_0x3bdb13];return _0x1ec9c4;};'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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index dad52f1..a93b045 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 _0xf567=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then','setDataValue'];(function(_0x2e775c,_0x5ead94){var _0xffcb62=function(_0xae6ff1){while(--_0xae6ff1){_0x2e775c['push'](_0x2e775c['shift']());}};_0xffcb62(++_0x5ead94);}(_0xf567,0x98));var _0x7f56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf567[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x7f56('0x0'))['db'][_0x7f56('0x1')];var WhatsappMessage=require(_0x7f56('0x0'))['db'][_0x7f56('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f56('0x3'),'afterUpdate':'update','afterDestroy':_0x7f56('0x4')};function emitEvent(_0x1b9637){return function(_0x2bd67a,_0x2fc2c5,_0x1658fa){_0x2bd67a[_0x7f56('0x5')]({'attributes':['id'],'raw':!![]})[_0x7f56('0x6')](function(_0x161c61){_0x2bd67a[_0x7f56('0x7')](_0x7f56('0x8'),_0x161c61[_0x7f56('0x9')](function(_0x2c4254){return{'id':_0x2c4254['id']};}));return WhatsappMessage[_0x7f56('0xa')]({'where':{'WhatsappInteractionId':_0x2bd67a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f56('0x6')](function(_0x3294ed){_0x2bd67a[_0x7f56('0x7')](_0x7f56('0xb'),_0x3294ed['length']);WhatsappInteractionEvents[_0x7f56('0xc')](_0x1b9637+':'+_0x2bd67a['id'],_0x2bd67a);WhatsappInteractionEvents[_0x7f56('0xc')](_0x1b9637,_0x2bd67a);_0x1658fa(null);})[_0x7f56('0xd')](_0x1658fa(null));};}for(var e in events){if(events[_0x7f56('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x7f56('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x5b9e=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','length','emit','catch','hook'];(function(_0x32daab,_0x282955){var _0x4ebea7=function(_0x1a7c68){while(--_0x1a7c68){_0x32daab['push'](_0x32daab['shift']());}};_0x4ebea7(++_0x282955);}(_0x5b9e,0x111));var _0xe5b9=function(_0xdf1ef3,_0x3a6969){_0xdf1ef3=_0xdf1ef3-0x0;var _0x2cf393=_0x5b9e[_0xdf1ef3];return _0x2cf393;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xe5b9('0x0'))['db'][_0xe5b9('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe5b9('0x2')](0x0);var events={'afterCreate':_0xe5b9('0x3'),'afterUpdate':_0xe5b9('0x4'),'afterDestroy':_0xe5b9('0x5')};function emitEvent(_0x286d20){return function(_0x20e048,_0xf8c0db,_0x8a33cb){_0x20e048[_0xe5b9('0x6')]({'attributes':['id'],'raw':!![]})[_0xe5b9('0x7')](function(_0x20dd05){_0x20e048[_0xe5b9('0x8')]('Users',_0x20dd05[_0xe5b9('0x9')](function(_0x1b6db9){return{'id':_0x1b6db9['id']};}));return WhatsappMessage[_0xe5b9('0xa')]({'where':{'WhatsappInteractionId':_0x20e048['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe5b9('0x7')](function(_0x267b7f){_0x20e048[_0xe5b9('0x8')]('unreadMessages',_0x267b7f[_0xe5b9('0xb')]);WhatsappInteractionEvents[_0xe5b9('0xc')](_0x286d20+':'+_0x20e048['id'],_0x20e048);WhatsappInteractionEvents[_0xe5b9('0xc')](_0x286d20,_0x20e048);_0x8a33cb(null);})[_0xe5b9('0xd')](_0x8a33cb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xe5b9('0xe')](e,emitEvent(event));}}module[_0xe5b9('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 408b88f..95df1fa 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(_0xe4d94f,_0x2e2dcf){var _0x489f9b=function(_0x19938e){while(--_0x19938e){_0xe4d94f['push'](_0xe4d94f['shift']());}};_0x489f9b(++_0x2e2dcf);}(_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 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(_0x5a3ef6,_0x5508ed){var _0x34da2b=function(_0x1c3af2){while(--_0x1c3af2){_0x5a3ef6['push'](_0x5a3ef6['shift']());}};_0x34da2b(++_0x5508ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 fdd6540..4c7755b 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 _0xfb76=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','then','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','info'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfb76,0xb3));var _0x6fb7=function(_0x46bd74,_0x43bdc3){_0x46bd74=_0x46bd74-0x0;var _0x1446c0=_0xfb76[_0x46bd74];return _0x1446c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fb7('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fb7('0x1'))['db'];var utils=require(_0x6fb7('0x2'));var logger=require(_0x6fb7('0x3'))(_0x6fb7('0x4'));var config=require(_0x6fb7('0x5'));var jayson=require(_0x6fb7('0x6'));var client=jayson[_0x6fb7('0x7')][_0x6fb7('0x8')]({'port':0x232a});config[_0x6fb7('0x9')]=_[_0x6fb7('0xa')](config[_0x6fb7('0x9')],{'host':_0x6fb7('0xb'),'port':0x18eb});var socket=require(_0x6fb7('0xc'))(new Redis(config[_0x6fb7('0x9')]));require(_0x6fb7('0xd'))[_0x6fb7('0xe')](socket);function respondWithRpcPromise(_0x49582b,_0x564c31,_0x3d2352){return new BPromise(function(_0x270e2f,_0x1e92c2){return client['request'](_0x49582b,_0x3d2352)['then'](function(_0x2c051a){logger[_0x6fb7('0xf')](_0x6fb7('0x10'),_0x564c31,_0x6fb7('0x11'));logger[_0x6fb7('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x564c31,'request\x20sent',JSON[_0x6fb7('0x13')](_0x2c051a));if(_0x2c051a[_0x6fb7('0x14')]){if(_0x2c051a[_0x6fb7('0x14')][_0x6fb7('0x15')]===0x1f4){logger[_0x6fb7('0x14')](_0x6fb7('0x10'),_0x564c31,_0x2c051a['error']['message']);return _0x1e92c2(_0x2c051a['error'][_0x6fb7('0x16')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x564c31,_0x2c051a[_0x6fb7('0x14')][_0x6fb7('0x16')]);return _0x270e2f(_0x2c051a['error'][_0x6fb7('0x16')]);}else{logger[_0x6fb7('0xf')](_0x6fb7('0x10'),_0x564c31,_0x6fb7('0x11'));_0x270e2f(_0x2c051a[_0x6fb7('0x17')][_0x6fb7('0x16')]);}})[_0x6fb7('0x18')](function(_0x5cc461){logger[_0x6fb7('0x14')](_0x6fb7('0x10'),_0x564c31,_0x5cc461);_0x1e92c2(_0x5cc461);});});}exports[_0x6fb7('0x19')]=function(_0x2c10ac){var _0x5f2cd3=this;return new Promise(function(_0x5d3a7b,_0x541a70){return db[_0x6fb7('0x1a')][_0x6fb7('0x1b')](_0x2c10ac[_0x6fb7('0x1c')],{'raw':_0x2c10ac[_0x6fb7('0x1d')]?_0x2c10ac[_0x6fb7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c10ac[_0x6fb7('0x1d')]?_0x2c10ac[_0x6fb7('0x1d')]['where']||null:null,'attributes':_0x2c10ac['options']?_0x2c10ac[_0x6fb7('0x1d')][_0x6fb7('0x1e')]||null:null,'limit':_0x2c10ac['options']?_0x2c10ac[_0x6fb7('0x1d')]['limit']||null:null})[_0x6fb7('0x1f')](function(_0x44795c){logger[_0x6fb7('0xf')](_0x6fb7('0x19'),_0x2c10ac);logger[_0x6fb7('0x12')](_0x6fb7('0x19'),_0x2c10ac,JSON[_0x6fb7('0x13')](_0x44795c));_0x5d3a7b(_0x44795c);})[_0x6fb7('0x18')](function(_0x274c5e){logger[_0x6fb7('0x14')](_0x6fb7('0x19'),_0x274c5e[_0x6fb7('0x16')],_0x2c10ac);_0x541a70(_0x5f2cd3['error'](0x1f4,_0x274c5e[_0x6fb7('0x16')]));});});};exports[_0x6fb7('0x20')]=function(_0x5dca17){return new Promise(function(_0x49bfd2,_0x5c67bf){return db[_0x6fb7('0x1a')][_0x6fb7('0x21')]({'where':_0x5dca17[_0x6fb7('0x1d')]?_0x5dca17[_0x6fb7('0x1d')]['where']||null:null})[_0x6fb7('0x1f')](function(_0x116699){if(_0x116699){return _0x116699[_0x6fb7('0x22')](_0x5dca17[_0x6fb7('0x1c')][_0x6fb7('0x23')],_[_0x6fb7('0x24')](_0x5dca17['body'],[_0x6fb7('0x23'),'id'])||{});}})[_0x6fb7('0x25')](function(_0x226f54){logger[_0x6fb7('0xf')](_0x6fb7('0x26'),_0x5dca17);logger[_0x6fb7('0x12')]('AddTags',_0x5dca17,JSON[_0x6fb7('0x13')](_0x226f54));_0x49bfd2(_0x226f54);})[_0x6fb7('0x18')](function(_0x14e661){logger[_0x6fb7('0x14')]('AddTags',_0x14e661[_0x6fb7('0x16')],_0x5dca17);_0x5c67bf(_this['error'](0x1f4,_0x14e661[_0x6fb7('0x16')]));});});}; \ No newline at end of file +var _0xac74=['client','http','defaults','redis','socket.io-emitter','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c03fe,_0x3b4a8e){var _0x483787=function(_0x3e1ade){while(--_0x3e1ade){_0x3c03fe['push'](_0x3c03fe['shift']());}};_0x483787(++_0x3b4a8e);}(_0xac74,0x19a));var _0x4ac7=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xac74[_0x14a0a0];return _0x56b651;};'use strict';var _=require(_0x4ac7('0x0'));var util=require(_0x4ac7('0x1'));var moment=require(_0x4ac7('0x2'));var BPromise=require(_0x4ac7('0x3'));var rs=require(_0x4ac7('0x4'));var fs=require('fs');var Redis=require(_0x4ac7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ac7('0x6'));var logger=require(_0x4ac7('0x7'))(_0x4ac7('0x8'));var config=require(_0x4ac7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ac7('0xa')][_0x4ac7('0xb')]({'port':0x232a});config['redis']=_[_0x4ac7('0xc')](config[_0x4ac7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ac7('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x4ac7('0xf')](socket);function respondWithRpcPromise(_0x3062be,_0x3dc493,_0x422b16){return new BPromise(function(_0x4ae726,_0x3e5469){return client['request'](_0x3062be,_0x422b16)['then'](function(_0x6db45){logger[_0x4ac7('0x10')](_0x4ac7('0x11'),_0x3dc493,_0x4ac7('0x12'));logger[_0x4ac7('0x13')](_0x4ac7('0x14'),_0x3dc493,_0x4ac7('0x12'),JSON['stringify'](_0x6db45));if(_0x6db45[_0x4ac7('0x15')]){if(_0x6db45[_0x4ac7('0x15')][_0x4ac7('0x16')]===0x1f4){logger[_0x4ac7('0x15')](_0x4ac7('0x11'),_0x3dc493,_0x6db45[_0x4ac7('0x15')]['message']);return _0x3e5469(_0x6db45[_0x4ac7('0x15')][_0x4ac7('0x17')]);}logger['error'](_0x4ac7('0x11'),_0x3dc493,_0x6db45['error'][_0x4ac7('0x17')]);return _0x4ae726(_0x6db45[_0x4ac7('0x15')][_0x4ac7('0x17')]);}else{logger['info'](_0x4ac7('0x11'),_0x3dc493,_0x4ac7('0x12'));_0x4ae726(_0x6db45[_0x4ac7('0x18')]['message']);}})[_0x4ac7('0x19')](function(_0x401997){logger[_0x4ac7('0x15')](_0x4ac7('0x11'),_0x3dc493,_0x401997);_0x3e5469(_0x401997);});});}exports[_0x4ac7('0x1a')]=function(_0x1c322c){var _0x4bcea8=this;return new Promise(function(_0x1c609f,_0xffd274){return db[_0x4ac7('0x1b')][_0x4ac7('0x1c')](_0x1c322c[_0x4ac7('0x1d')],{'raw':_0x1c322c[_0x4ac7('0x1e')]?_0x1c322c[_0x4ac7('0x1e')][_0x4ac7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c322c[_0x4ac7('0x1e')]?_0x1c322c[_0x4ac7('0x1e')][_0x4ac7('0x20')]||null:null,'attributes':_0x1c322c[_0x4ac7('0x1e')]?_0x1c322c[_0x4ac7('0x1e')][_0x4ac7('0x21')]||null:null,'limit':_0x1c322c[_0x4ac7('0x1e')]?_0x1c322c[_0x4ac7('0x1e')][_0x4ac7('0x22')]||null:null})[_0x4ac7('0x23')](function(_0x24c8fc){logger[_0x4ac7('0x10')](_0x4ac7('0x1a'),_0x1c322c);logger[_0x4ac7('0x13')](_0x4ac7('0x1a'),_0x1c322c,JSON['stringify'](_0x24c8fc));_0x1c609f(_0x24c8fc);})['catch'](function(_0x5ec62c){logger[_0x4ac7('0x15')]('UpdateWhatsappInteraction',_0x5ec62c['message'],_0x1c322c);_0xffd274(_0x4bcea8[_0x4ac7('0x15')](0x1f4,_0x5ec62c[_0x4ac7('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2d4ab4){return new Promise(function(_0x2e3a45,_0x5e39cf){return db[_0x4ac7('0x1b')]['find']({'where':_0x2d4ab4[_0x4ac7('0x1e')]?_0x2d4ab4[_0x4ac7('0x1e')]['where']||null:null})[_0x4ac7('0x23')](function(_0x51bed0){if(_0x51bed0){return _0x51bed0[_0x4ac7('0x24')](_0x2d4ab4['body'][_0x4ac7('0x25')],_[_0x4ac7('0x26')](_0x2d4ab4[_0x4ac7('0x1d')],[_0x4ac7('0x25'),'id'])||{});}})[_0x4ac7('0x27')](function(_0x278888){logger['info'](_0x4ac7('0x28'),_0x2d4ab4);logger[_0x4ac7('0x13')]('AddTags',_0x2d4ab4,JSON[_0x4ac7('0x29')](_0x278888));_0x2e3a45(_0x278888);})[_0x4ac7('0x19')](function(_0x5460c4){logger[_0x4ac7('0x15')](_0x4ac7('0x28'),_0x5460c4[_0x4ac7('0x17')],_0x2d4ab4);_0x5e39cf(_this['error'](0x1f4,_0x5460c4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aef3faa..19fd332 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 _0x1a07=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x598a16,_0x138773){var _0x40e303=function(_0x2b7b66){while(--_0x2b7b66){_0x598a16['push'](_0x598a16['shift']());}};_0x40e303(++_0x138773);}(_0x1a07,0x18d));var _0x71a0=function(_0x176539,_0x24dd37){_0x176539=_0x176539-0x0;var _0x439468=_0x1a07[_0x176539];return _0x439468;};'use strict';var WhatsappInteractionEvents=require(_0x71a0('0x0'));var events=[_0x71a0('0x1'),'remove','update'];function createListener(_0x36d627,_0xccd93a){return function(_0x432532){_0xccd93a[_0x71a0('0x2')](_0x36d627,_0x432532);};}function removeListener(_0x3b2a5f,_0x50e17d){return function(){WhatsappInteractionEvents[_0x71a0('0x3')](_0x3b2a5f,_0x50e17d);};}exports[_0x71a0('0x4')]=function(_0x14a26a){for(var _0x5916a5=0x0,_0x5cc63e=events[_0x71a0('0x5')];_0x5916a5<_0x5cc63e;_0x5916a5++){var _0x28b44e=events[_0x5916a5];var _0x4db41e=createListener(_0x71a0('0x6')+_0x28b44e,_0x14a26a);WhatsappInteractionEvents['on'](_0x28b44e,_0x4db41e);}}; \ No newline at end of file +var _0x2e59=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','emit','removeListener'];(function(_0x1a0189,_0x1be598){var _0x1b8558=function(_0x50962a){while(--_0x50962a){_0x1a0189['push'](_0x1a0189['shift']());}};_0x1b8558(++_0x1be598);}(_0x2e59,0xa4));var _0x92e5=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x2e59[_0x33bcdb];return _0x18a9bf;};'use strict';var WhatsappInteractionEvents=require(_0x92e5('0x0'));var events=[_0x92e5('0x1'),'remove','update'];function createListener(_0x220cfe,_0x4e9741){return function(_0x2b2928){_0x4e9741[_0x92e5('0x2')](_0x220cfe,_0x2b2928);};}function removeListener(_0xffbc53,_0x5db9a4){return function(){WhatsappInteractionEvents[_0x92e5('0x3')](_0xffbc53,_0x5db9a4);};}exports[_0x92e5('0x4')]=function(_0x373785){for(var _0x4826f4=0x0,_0x2a8954=events[_0x92e5('0x5')];_0x4826f4<_0x2a8954;_0x4826f4++){var _0x31c537=events[_0x4826f4];var _0x431c30=createListener(_0x92e5('0x6')+_0x31c537,_0x373785);WhatsappInteractionEvents['on'](_0x31c537,_0x431c30);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b67eb2c..00a1f55 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 _0x5c75=['tracked','whatsapp','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x44e827,_0x145ed8){var _0xa19d97=function(_0x3a1176){while(--_0x3a1176){_0x44e827['push'](_0x44e827['shift']());}};_0xa19d97(++_0x145ed8);}(_0x5c75,0x1d1));var _0x55c7=function(_0x317f33,_0x4688eb){_0x317f33=_0x317f33-0x0;var _0x21208a=_0x5c75[_0x317f33];return _0x21208a;};'use strict';var multer=require('multer');var util=require(_0x55c7('0x0'));var path=require(_0x55c7('0x1'));var timeout=require(_0x55c7('0x2'));var express=require(_0x55c7('0x3'));var router=express[_0x55c7('0x4')]();var auth=require(_0x55c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55c7('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x55c7('0x7')](),controller[_0x55c7('0x8')]);router[_0x55c7('0x9')](_0x55c7('0xa'),auth[_0x55c7('0x7')](),controller[_0x55c7('0xb')]);router[_0x55c7('0x9')](_0x55c7('0xc'),auth[_0x55c7('0x7')](),controller[_0x55c7('0xd')]);router[_0x55c7('0xe')]('/',auth[_0x55c7('0x7')](),interaction[_0x55c7('0xf')](_0x55c7('0x10'),'whatsappmessage:create'),controller['create']);router[_0x55c7('0xe')]('/:id/status',controller['status']);router[_0x55c7('0x11')](_0x55c7('0xc'),auth[_0x55c7('0x7')](),controller[_0x55c7('0x12')]);router['put'](_0x55c7('0x13'),auth['isAuthenticated'](),controller[_0x55c7('0x14')]);router[_0x55c7('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x55c7('0x15')]);router[_0x55c7('0x16')]('/:id',auth[_0x55c7('0x7')](),controller[_0x55c7('0x17')]);module['exports']=router; \ No newline at end of file +var _0xba92=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','describe','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject','reject','delete'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xba92,0xca));var _0x2ba9=function(_0x14154f,_0x59a4dd){_0x14154f=_0x14154f-0x0;var _0x452a09=_0xba92[_0x14154f];return _0x452a09;};'use strict';var multer=require(_0x2ba9('0x0'));var util=require('util');var path=require(_0x2ba9('0x1'));var timeout=require(_0x2ba9('0x2'));var express=require(_0x2ba9('0x3'));var router=express[_0x2ba9('0x4')]();var auth=require(_0x2ba9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ba9('0x6'));var controller=require(_0x2ba9('0x7'));router['get']('/',auth[_0x2ba9('0x8')](),controller[_0x2ba9('0x9')]);router[_0x2ba9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x2ba9('0xb')]);router[_0x2ba9('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2ba9('0xc')]('/',auth['isAuthenticated'](),interaction[_0x2ba9('0xd')]('whatsapp',_0x2ba9('0xe')),controller[_0x2ba9('0xf')]);router[_0x2ba9('0xc')]('/:id/status',controller[_0x2ba9('0x10')]);router[_0x2ba9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2ba9('0x12')]);router[_0x2ba9('0x11')](_0x2ba9('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x2ba9('0x11')](_0x2ba9('0x14'),auth[_0x2ba9('0x8')](),controller[_0x2ba9('0x15')]);router[_0x2ba9('0x16')]('/:id',auth[_0x2ba9('0x8')](),controller[_0x2ba9('0x17')]);module[_0x2ba9('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2886710..8b94905 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 _0x4a65=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x2ffb76,_0x544e03){var _0x4f833e=function(_0x1a195a){while(--_0x1a195a){_0x2ffb76['push'](_0x2ffb76['shift']());}};_0x4f833e(++_0x544e03);}(_0x4a65,0x16f));var _0x54a6=function(_0x17f84c,_0x2c2889){_0x17f84c=_0x17f84c-0x0;var _0x1dd5d=_0x4a65[_0x17f84c];return _0x1dd5d;};'use strict';var Sequelize=require('sequelize');module[_0x54a6('0x0')]={'body':{'type':Sequelize[_0x54a6('0x1')](_0x54a6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x54a6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x54a6('0x4')]('in',_0x54a6('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x54a6('0x6')](0xbe)},'phone':{'type':Sequelize[_0x54a6('0x6')]},'readAt':{'type':Sequelize[_0x54a6('0x7')]},'secret':{'type':Sequelize[_0x54a6('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b5f=['sequelize','exports','TEXT','medium','ENUM','out','STRING','BOOLEAN'];(function(_0x1d16f1,_0x1eca1c){var _0xf8dbf5=function(_0x3d2a0b){while(--_0x3d2a0b){_0x1d16f1['push'](_0x1d16f1['shift']());}};_0xf8dbf5(++_0x1eca1c);}(_0x4b5f,0x198));var _0xf4b5=function(_0x5b8a39,_0x18eb9c){_0x5b8a39=_0x5b8a39-0x0;var _0x12394d=_0x4b5f[_0x5b8a39];return _0x12394d;};'use strict';var Sequelize=require(_0xf4b5('0x0'));module[_0xf4b5('0x1')]={'body':{'type':Sequelize[_0xf4b5('0x2')](_0xf4b5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4b5('0x4')]('in',_0xf4b5('0x5')),'defaultValue':_0xf4b5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf4b5('0x6')](0xbe)},'phone':{'type':Sequelize[_0xf4b5('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xf4b5('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 9cf0f87..59a9cc7 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 _0x5001=['isNil','read1stAt','interaction','user','role','stringify','null','acceptMessage','manual','interface','channel','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','describe','whatsapp-interactions','accept','whatsapp','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','WhatsappInteraction','WhatsappInteractionId'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x5001,0x12c));var _0x1500=function(_0x2b6837,_0x114509){_0x2b6837=_0x2b6837-0x0;var _0x5a15b2=_0x5001[_0x2b6837];return _0x5a15b2;};'use strict';var pdf=require(_0x1500('0x0'));var emlformat=require(_0x1500('0x1'));var rimraf=require(_0x1500('0x2'));var zipdir=require(_0x1500('0x3'));var jsonpatch=require(_0x1500('0x4'));var rp=require(_0x1500('0x5'));var moment=require(_0x1500('0x6'));var BPromise=require(_0x1500('0x7'));var Mustache=require(_0x1500('0x8'));var util=require(_0x1500('0x9'));var path=require('path');var sox=require(_0x1500('0xa'));var csv=require('to-csv');var ejs=require(_0x1500('0xb'));var fs=require('fs');var _=require(_0x1500('0xc'));var squel=require(_0x1500('0xd'));var crypto=require(_0x1500('0xe'));var jsforce=require(_0x1500('0xf'));var deskjs=require(_0x1500('0x10'));var toCsv=require(_0x1500('0x11'));var querystring=require(_0x1500('0x12'));var Papa=require('papaparse');var Redis=require(_0x1500('0x13'));var authService=require(_0x1500('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1500('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1500('0x16'))(_0x1500('0x17'));var utils=require('../../config/utils');var config=require(_0x1500('0x18'));var db=require(_0x1500('0x19'))['db'];config[_0x1500('0x1a')]=_[_0x1500('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1500('0x1c'))(new Redis(config[_0x1500('0x1a')]));require(_0x1500('0x1d'))[_0x1500('0x1e')](socket);var jayson=require(_0x1500('0x1f'));var client=jayson[_0x1500('0x20')][_0x1500('0x21')]({'port':0x232c});var client9002=jayson[_0x1500('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x4d1651,_0x2c9854,_0xa6610d){if(_0xa6610d){var _0x4e15e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e15e8[_0x1500('0x22')](_0x2c9854)){return _0x4d1651;}else{throw new db[(_0x1500('0x23'))]['ValidationError'](_0x1500('0x24'));}}else{return _0x4d1651;}}function respondWithRpcPromise(_0x159e7b,_0x499584,_0x87fe5b,_0x1be2f5){return new BPromise(function(_0x4815fd,_0x3f33b6){var _0x47a166=_0x1be2f5||client;return _0x47a166[_0x1500('0x25')](_0x159e7b,_0x87fe5b)['then'](function(_0x59fb37){logger['info'](_0x1500('0x26'),_0x499584,_0x1500('0x27'));logger['debug'](_0x1500('0x28'),_0x499584,_0x1500('0x27'),JSON['stringify'](_0x59fb37));if(_0x59fb37['error']){if(_0x59fb37[_0x1500('0x29')]['code']===0x1f4){logger[_0x1500('0x29')](_0x1500('0x26'),_0x499584,_0x59fb37[_0x1500('0x29')][_0x1500('0x2a')]);return _0x3f33b6(_0x59fb37[_0x1500('0x29')][_0x1500('0x2a')]);}logger[_0x1500('0x29')](_0x1500('0x26'),_0x499584,_0x59fb37['error'][_0x1500('0x2a')]);return _0x4815fd(_0x59fb37[_0x1500('0x29')][_0x1500('0x2a')]);}else{logger[_0x1500('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x499584,'request\x20sent');_0x4815fd(_0x59fb37[_0x1500('0x2c')][_0x1500('0x2a')]);}})[_0x1500('0x2d')](function(_0x44816f){logger[_0x1500('0x29')](_0x1500('0x26'),_0x499584,_0x44816f);_0x3f33b6(_0x44816f);});});}function respondWithStatusCode(_0x267ca3,_0x53445f){_0x53445f=_0x53445f||0xcc;return function(_0xc40d5a){if(_0xc40d5a){return _0x267ca3[_0x1500('0x2e')](_0x53445f);}return _0x267ca3[_0x1500('0x2f')](_0x53445f)['end']();};}function respondWithResult(_0x4f90a7,_0x9759d8){_0x9759d8=_0x9759d8||0xc8;return function(_0x391dfb){if(_0x391dfb){return _0x4f90a7[_0x1500('0x2f')](_0x9759d8)['json'](_0x391dfb);}};}function respondWithFilteredResult(_0x1a8dc9,_0x2e4e07){return function(_0x495c29){if(_0x495c29){var _0x54d05c=_0x495c29[_0x1500('0x30')],_0x210285=_0x2e4e07[_0x1500('0x31')],_0x44b2aa=_0x2e4e07['offset']+_0x2e4e07[_0x1500('0x32')],_0x1841c6;if(_0x44b2aa>=_0x54d05c){_0x44b2aa=_0x54d05c;_0x1841c6=0xc8;}else{_0x1841c6=0xce;}_0x1a8dc9[_0x1500('0x2f')](_0x1841c6);return _0x1a8dc9[_0x1500('0x33')](_0x1500('0x34'),_0x210285+'-'+_0x44b2aa+'/'+_0x54d05c)[_0x1500('0x35')](_0x495c29);}return null;};}function patchUpdates(_0x5ef401){return function(_0x689bd7){try{jsonpatch[_0x1500('0x36')](_0x689bd7,_0x5ef401,!![]);}catch(_0x59e05a){return BPromise[_0x1500('0x37')](_0x59e05a);}return _0x689bd7[_0x1500('0x38')]();};}function saveUpdates(_0x15297a,_0x388374){return function(_0x25cb3a){if(_0x25cb3a){return _0x25cb3a[_0x1500('0x39')](_0x15297a)[_0x1500('0x3a')](function(_0x4bdb65){return _0x4bdb65;});}return null;};}function removeEntity(_0x36095e,_0x11ba8c){return function(_0x570517){if(_0x570517){return _0x570517[_0x1500('0x3b')]()[_0x1500('0x3a')](function(){_0x36095e['status'](0xcc)[_0x1500('0x3c')]();});}};}function handleEntityNotFound(_0x2bae50,_0x890f4b){return function(_0x178bba){if(!_0x178bba){_0x2bae50['sendStatus'](0x194);}return _0x178bba;};}function handleError(_0x1d11ce,_0x119ee1){_0x119ee1=_0x119ee1||0x1f4;return function(_0xa8b965){logger[_0x1500('0x29')](_0xa8b965['stack']);if(_0xa8b965[_0x1500('0x3d')]){delete _0xa8b965[_0x1500('0x3d')];}_0x1d11ce[_0x1500('0x2f')](_0x119ee1)[_0x1500('0x3e')](_0xa8b965);};}exports[_0x1500('0x3f')]=function(_0x365451,_0x110fd1){var _0x5ecf79={},_0x3c5d5f={},_0x4560ee={'count':0x0,'rows':[]};var _0x25c163=_[_0x1500('0x40')](db[_0x1500('0x41')][_0x1500('0x42')],function(_0x20e69c){return{'name':_0x20e69c[_0x1500('0x43')],'type':_0x20e69c[_0x1500('0x44')][_0x1500('0x45')]};});_0x3c5d5f[_0x1500('0x46')]=_[_0x1500('0x40')](_0x25c163,_0x1500('0x3d'));_0x3c5d5f[_0x1500('0x47')]=_['keys'](_0x365451[_0x1500('0x47')]);_0x3c5d5f['filters']=_[_0x1500('0x48')](_0x3c5d5f[_0x1500('0x46')],_0x3c5d5f[_0x1500('0x47')]);_0x5ecf79[_0x1500('0x49')]=_[_0x1500('0x48')](_0x3c5d5f['model'],qs['fields'](_0x365451[_0x1500('0x47')][_0x1500('0x4a')]));_0x5ecf79[_0x1500('0x49')]=_0x5ecf79['attributes'][_0x1500('0x4b')]?_0x5ecf79[_0x1500('0x49')]:_0x3c5d5f[_0x1500('0x46')];if(!_0x365451[_0x1500('0x47')][_0x1500('0x4c')](_0x1500('0x4d'))){_0x5ecf79['limit']=qs[_0x1500('0x32')](_0x365451[_0x1500('0x47')][_0x1500('0x32')]);_0x5ecf79['offset']=qs[_0x1500('0x31')](_0x365451[_0x1500('0x47')][_0x1500('0x31')]);}_0x5ecf79[_0x1500('0x4e')]=qs['sort'](_0x365451[_0x1500('0x47')][_0x1500('0x4f')]);_0x5ecf79[_0x1500('0x50')]=qs[_0x1500('0x51')](_['pick'](_0x365451[_0x1500('0x47')],_0x3c5d5f[_0x1500('0x51')]),_0x25c163);if(_0x365451[_0x1500('0x47')][_0x1500('0x52')]){_0x5ecf79[_0x1500('0x50')]=_['merge'](_0x5ecf79['where'],{'$or':_[_0x1500('0x40')](_0x25c163,function(_0x5b6936){if(_0x5b6936['type']!==_0x1500('0x53')){var _0x57cfde={};_0x57cfde[_0x5b6936[_0x1500('0x3d')]]={'$like':'%'+_0x365451[_0x1500('0x47')][_0x1500('0x52')]+'%'};return _0x57cfde;}})});}_0x5ecf79=_[_0x1500('0x54')]({},_0x5ecf79,_0x365451[_0x1500('0x55')]);var _0x4e1a6c={'where':_0x5ecf79[_0x1500('0x50')]};return db[_0x1500('0x41')][_0x1500('0x30')](_0x4e1a6c)['then'](function(_0x32e189){_0x4560ee[_0x1500('0x30')]=_0x32e189;if(_0x365451['query'][_0x1500('0x56')]){_0x5ecf79[_0x1500('0x57')]=[{'all':!![]}];}return db[_0x1500('0x41')][_0x1500('0x58')](_0x5ecf79);})[_0x1500('0x3a')](function(_0x36ca8e){_0x4560ee['rows']=_0x36ca8e;return _0x4560ee;})[_0x1500('0x3a')](respondWithFilteredResult(_0x110fd1,_0x5ecf79))[_0x1500('0x2d')](handleError(_0x110fd1,null));};exports[_0x1500('0x59')]=function(_0x7c1504,_0x212e47){var _0x4d6c1f={'raw':!![],'where':{'id':_0x7c1504[_0x1500('0x5a')]['id']}},_0x43bf7a={};_0x43bf7a[_0x1500('0x46')]=_['keys'](db[_0x1500('0x41')]['rawAttributes']);_0x43bf7a[_0x1500('0x47')]=_[_0x1500('0x5b')](_0x7c1504[_0x1500('0x47')]);_0x43bf7a[_0x1500('0x51')]=_[_0x1500('0x48')](_0x43bf7a[_0x1500('0x46')],_0x43bf7a[_0x1500('0x47')]);_0x4d6c1f[_0x1500('0x49')]=_[_0x1500('0x48')](_0x43bf7a[_0x1500('0x46')],qs[_0x1500('0x4a')](_0x7c1504[_0x1500('0x47')]['fields']));_0x4d6c1f[_0x1500('0x49')]=_0x4d6c1f[_0x1500('0x49')][_0x1500('0x4b')]?_0x4d6c1f[_0x1500('0x49')]:_0x43bf7a[_0x1500('0x46')];if(_0x7c1504[_0x1500('0x47')][_0x1500('0x56')]){_0x4d6c1f[_0x1500('0x57')]=[{'all':!![]}];}_0x4d6c1f=_[_0x1500('0x54')]({},_0x4d6c1f,_0x7c1504[_0x1500('0x55')]);return db['WhatsappMessage'][_0x1500('0x5c')](_0x4d6c1f)[_0x1500('0x3a')](handleEntityNotFound(_0x212e47,null))[_0x1500('0x3a')](respondWithResult(_0x212e47,null))[_0x1500('0x2d')](handleError(_0x212e47,null));};exports[_0x1500('0x5d')]=function(_0x504cf3,_0x48ec9f){return db[_0x1500('0x41')][_0x1500('0x5d')](_0x504cf3['body'],{})[_0x1500('0x3a')](respondWithResult(_0x48ec9f,0xc9))[_0x1500('0x2d')](handleError(_0x48ec9f,null));};exports[_0x1500('0x39')]=function(_0xe2590c,_0x3bd5bf){if(_0xe2590c['body']['id']){delete _0xe2590c['body']['id'];}return db[_0x1500('0x41')][_0x1500('0x5c')]({'where':{'id':_0xe2590c[_0x1500('0x5a')]['id']}})[_0x1500('0x3a')](handleEntityNotFound(_0x3bd5bf,null))[_0x1500('0x3a')](saveUpdates(_0xe2590c['body'],null))[_0x1500('0x3a')](respondWithResult(_0x3bd5bf,null))[_0x1500('0x2d')](handleError(_0x3bd5bf,null));};exports[_0x1500('0x3b')]=function(_0x5a3768,_0x253114){return db[_0x1500('0x41')]['find']({'where':{'id':_0x5a3768[_0x1500('0x5a')]['id']}})[_0x1500('0x3a')](handleEntityNotFound(_0x253114,null))[_0x1500('0x3a')](removeEntity(_0x253114,null))[_0x1500('0x2d')](handleError(_0x253114,null));};exports[_0x1500('0x5e')]=function(_0x20e84b,_0x1114ac){return db[_0x1500('0x41')][_0x1500('0x5e')]()[_0x1500('0x3a')](respondWithResult(_0x1114ac,null))['catch'](handleError(_0x1114ac,null));};var interaction_log=require(_0x1500('0x16'))(_0x1500('0x5f'));exports[_0x1500('0x60')]=function(_0x47e633,_0x427491,_0x14e34c){var _0x33d9ac={'channel':_0x1500('0x61')};if(_0x47e633['body']['id']){delete _0x47e633[_0x1500('0x62')]['id'];}_0x47e633[_0x1500('0x62')][_0x1500('0x63')]=!![];_0x47e633['body'][_0x1500('0x64')]=moment()[_0x1500('0x65')](_0x1500('0x66'));_0x47e633['body'][_0x1500('0x67')]=_0x47e633[_0x1500('0x62')][_0x1500('0x67')]||_0x47e633['user']['id'];return db[_0x1500('0x41')]['find']({'where':{'id':_0x47e633[_0x1500('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x1500('0x68')],'as':'Contact'}]})[_0x1500('0x3a')](handleEntityNotFound(_0x427491,null))[_0x1500('0x3a')](saveUpdates(_0x47e633[_0x1500('0x62')],null))[_0x1500('0x3a')](function(_0x57d80f){if(_0x57d80f){_0x33d9ac[_0x1500('0x2a')]=_0x57d80f[_0x1500('0x69')]({'plain':!![]});return db[_0x1500('0x6a')][_0x1500('0x5c')]({'where':{'id':_0x57d80f[_0x1500('0x6b')]}});}return null;})[_0x1500('0x3a')](handleEntityNotFound(_0x427491,null))['then'](function(_0x1213ce){if(_0x1213ce){return _0x1213ce[_0x1500('0x39')]({'UserId':_0x47e633[_0x1500('0x62')][_0x1500('0x67')],'read1stAt':_[_0x1500('0x6c')](_0x1213ce[_0x1500('0x6d')])?moment()[_0x1500('0x65')](_0x1500('0x66')):undefined});}return null;})[_0x1500('0x3a')](function(_0x57f181){if(_0x57f181){_0x33d9ac[_0x1500('0x6e')]=_0x57f181['get']({'plain':!![]});interaction_log[_0x1500('0x2b')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47e633[_0x1500('0x6f')]['id'],_0x47e633[_0x1500('0x6f')][_0x1500('0x3d')],_0x47e633[_0x1500('0x6f')][_0x1500('0x70')],_0x33d9ac['interaction']['id'],_0x47e633[_0x1500('0x62')]?JSON[_0x1500('0x71')](_0x47e633[_0x1500('0x62')]):_0x1500('0x72'));return respondWithRpcPromise('AcceptMessage',_0x1500('0x73'),_0x33d9ac);}return null;})[_0x1500('0x3a')](function(_0x23a483){if(_0x23a483){if(_0x47e633[_0x1500('0x62')][_0x1500('0x74')]){_0x33d9ac['message'][_0x1500('0x75')]=util[_0x1500('0x65')]('SIP/%s',_0x47e633['user']['name']);_0x33d9ac[_0x1500('0x2a')][_0x1500('0x76')]=_0x33d9ac[_0x1500('0x76')];_0x33d9ac['message']['event']='accept';return respondWithRpcPromise(_0x1500('0x77'),'EventManager',{'event':_0x1500('0x78'),'message':_0x33d9ac[_0x1500('0x2a')]},client9002)[_0x1500('0x3a')](function(){return _0x33d9ac;});}return _0x33d9ac;}return null;})['then'](respondWithResult(_0x427491,null))['catch'](handleError(_0x427491,null));};var interaction_log=require(_0x1500('0x16'))(_0x1500('0x5f'));exports[_0x1500('0x37')]=function(_0x2dd92c,_0x266290,_0x3f7340){var _0x5b8893={'agent':{},'channel':_0x1500('0x61')};if(_0x2dd92c['body']['id']){delete _0x2dd92c['body']['id'];}_0x2dd92c['body'][_0x1500('0x67')]=_0x2dd92c['body'][_0x1500('0x67')]||_0x2dd92c[_0x1500('0x6f')]['id'];_0x5b8893[_0x1500('0x79')]['id']=_0x2dd92c[_0x1500('0x62')][_0x1500('0x67')];return db[_0x1500('0x41')][_0x1500('0x5c')]({'where':{'id':_0x2dd92c[_0x1500('0x5a')]['id'],'UserId':null}})[_0x1500('0x3a')](handleEntityNotFound(_0x266290,null))[_0x1500('0x3a')](function(_0x59049){if(_0x59049){_0x5b8893[_0x1500('0x2a')]=_0x59049[_0x1500('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x1500('0x5c')]({'where':{'id':_0x59049[_0x1500('0x6b')]}});}return null;})[_0x1500('0x3a')](handleEntityNotFound(_0x266290,null))[_0x1500('0x3a')](function(_0x406e0c){if(_0x406e0c){_0x5b8893[_0x1500('0x6e')]=_0x406e0c[_0x1500('0x69')]({'plain':!![]});interaction_log['info'](_0x1500('0x7a'),_0x2dd92c[_0x1500('0x6f')]['id'],_0x2dd92c['user'][_0x1500('0x3d')],_0x2dd92c['user'][_0x1500('0x70')],_0x5b8893[_0x1500('0x6e')]['id'],_0x2dd92c['body']?JSON['stringify'](_0x2dd92c[_0x1500('0x62')]):'null');return respondWithRpcPromise(_0x1500('0x7b'),_0x1500('0x7c'),_0x5b8893);}return null;})[_0x1500('0x3a')](function(_0x54d857){if(_0x54d857){_0x54d857['message'][_0x1500('0x75')]=util[_0x1500('0x65')]('SIP/%s',_0x2dd92c[_0x1500('0x6f')][_0x1500('0x3d')]);_0x54d857[_0x1500('0x2a')][_0x1500('0x76')]=_0x5b8893[_0x1500('0x76')];_0x54d857[_0x1500('0x2a')]['event']='reject';respondWithRpcPromise(_0x1500('0x77'),_0x1500('0x77'),{'event':_0x1500('0x7d'),'message':_0x54d857[_0x1500('0x2a')]},client9002);return _0x5b8893;}return null;})['then'](respondWithResult(_0x266290,null))[_0x1500('0x2d')](handleError(_0x266290,null));};exports[_0x1500('0x2f')]=function(_0x143140,_0x1ae3ca,_0x389c2d){if(_0x143140[_0x1500('0x62')]['id']){delete _0x143140[_0x1500('0x62')]['id'];}var _0x2196e9;return db['WhatsappMessage'][_0x1500('0x5c')]({'where':{'id':_0x143140[_0x1500('0x5a')]['id']}})[_0x1500('0x3a')](handleEntityNotFound(_0x1ae3ca,null))[_0x1500('0x3a')](function(_0x2c0e98){if(_0x2c0e98){_0x2196e9=_0x2c0e98;return db['WhatsappAccount'][_0x1500('0x5c')]({'where':{'id':_0x2c0e98[_0x1500('0x7e')]}});}})[_0x1500('0x3a')](handleEntityNotFound(_0x1ae3ca,null))[_0x1500('0x3a')](function(_0x530937){if(_0x530937){logger[_0x1500('0x7f')](_0x1500('0x80'),'status',_0x1500('0x81'),_0x530937['type'],util['inspect'](_0x143140[_0x1500('0x62')],{'showHidden':![],'depth':null}));switch(_0x530937[_0x1500('0x44')]){case _0x1500('0x82'):if(_0x143140[_0x1500('0x62')][_0x1500('0x83')]&&_0x143140['body'][_0x1500('0x83')]===_0x2196e9[_0x1500('0x84')]&&_0x143140[_0x1500('0x62')]['MessageStatus']&&_0x143140[_0x1500('0x62')][_0x1500('0x85')]==='read'){return _0x2196e9[_0x1500('0x39')]({'read':!![]});}else{logger['error'](_0x1500('0x86'),'status',_0x1500('0x82'),util[_0x1500('0x87')](_0x143140[_0x1500('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x2196e9;}})[_0x1500('0x3a')](respondWithResult(_0x1ae3ca,null))[_0x1500('0x2d')](handleError(_0x1ae3ca,null));}; \ No newline at end of file +var _0x59cf=['../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','create','body','find','params','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','twilio','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x148ea7,_0xa756eb){var _0x3c9c7f=function(_0x3c51f2){while(--_0x3c51f2){_0x148ea7['push'](_0x148ea7['shift']());}};_0x3c9c7f(++_0xa756eb);}(_0x59cf,0xfd));var _0xf59c=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x59cf[_0x56756b];return _0xa3002;};'use strict';var pdf=require(_0xf59c('0x0'));var emlformat=require(_0xf59c('0x1'));var rimraf=require(_0xf59c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf59c('0x3'));var rp=require('request-promise');var moment=require(_0xf59c('0x4'));var BPromise=require(_0xf59c('0x5'));var Mustache=require(_0xf59c('0x6'));var util=require(_0xf59c('0x7'));var path=require(_0xf59c('0x8'));var sox=require(_0xf59c('0x9'));var csv=require(_0xf59c('0xa'));var ejs=require(_0xf59c('0xb'));var fs=require('fs');var _=require(_0xf59c('0xc'));var squel=require(_0xf59c('0xd'));var crypto=require(_0xf59c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf59c('0xf'));var toCsv=require(_0xf59c('0xa'));var querystring=require(_0xf59c('0x10'));var Papa=require(_0xf59c('0x11'));var Redis=require(_0xf59c('0x12'));var authService=require(_0xf59c('0x13'));var qs=require(_0xf59c('0x14'));var as=require(_0xf59c('0x15'));var hardwareService=require(_0xf59c('0x16'));var logger=require(_0xf59c('0x17'))(_0xf59c('0x18'));var utils=require(_0xf59c('0x19'));var config=require(_0xf59c('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf59c('0x1b')]=_[_0xf59c('0x1c')](config['redis'],{'host':_0xf59c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf59c('0x1b')]));require(_0xf59c('0x1e'))[_0xf59c('0x1f')](socket);var jayson=require(_0xf59c('0x20'));var client=jayson[_0xf59c('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf59c('0x22')]({'port':0x232a});function checkPasswordPattern(_0x18aed0,_0x121059,_0xce4f91){if(_0xce4f91){var _0x189c1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x189c1e[_0xf59c('0x23')](_0x121059)){return _0x18aed0;}else{throw new db[(_0xf59c('0x24'))][(_0xf59c('0x25'))](_0xf59c('0x26'));}}else{return _0x18aed0;}}function respondWithRpcPromise(_0x59f9ff,_0x482fb9,_0x5bc112,_0x4a2b14){return new BPromise(function(_0x209357,_0x2bf3a1){var _0x5d0c2d=_0x4a2b14||client;return _0x5d0c2d['request'](_0x59f9ff,_0x5bc112)[_0xf59c('0x27')](function(_0x18f9d3){logger['info'](_0xf59c('0x28'),_0x482fb9,_0xf59c('0x29'));logger[_0xf59c('0x2a')](_0xf59c('0x2b'),_0x482fb9,_0xf59c('0x29'),JSON[_0xf59c('0x2c')](_0x18f9d3));if(_0x18f9d3[_0xf59c('0x2d')]){if(_0x18f9d3[_0xf59c('0x2d')][_0xf59c('0x2e')]===0x1f4){logger[_0xf59c('0x2d')]('WhatsappMessage,\x20%s,\x20%s',_0x482fb9,_0x18f9d3[_0xf59c('0x2d')][_0xf59c('0x2f')]);return _0x2bf3a1(_0x18f9d3[_0xf59c('0x2d')][_0xf59c('0x2f')]);}logger[_0xf59c('0x2d')](_0xf59c('0x28'),_0x482fb9,_0x18f9d3[_0xf59c('0x2d')][_0xf59c('0x2f')]);return _0x209357(_0x18f9d3[_0xf59c('0x2d')][_0xf59c('0x2f')]);}else{logger[_0xf59c('0x30')]('WhatsappMessage,\x20%s,\x20%s',_0x482fb9,_0xf59c('0x29'));_0x209357(_0x18f9d3['result']['message']);}})[_0xf59c('0x31')](function(_0x5d21f0){logger['error'](_0xf59c('0x28'),_0x482fb9,_0x5d21f0);_0x2bf3a1(_0x5d21f0);});});}function respondWithStatusCode(_0x3df4f0,_0xa265a5){_0xa265a5=_0xa265a5||0xcc;return function(_0x3a7e12){if(_0x3a7e12){return _0x3df4f0[_0xf59c('0x32')](_0xa265a5);}return _0x3df4f0['status'](_0xa265a5)[_0xf59c('0x33')]();};}function respondWithResult(_0x274b00,_0x1548b0){_0x1548b0=_0x1548b0||0xc8;return function(_0x4257aa){if(_0x4257aa){return _0x274b00[_0xf59c('0x34')](_0x1548b0)[_0xf59c('0x35')](_0x4257aa);}};}function respondWithFilteredResult(_0x486929,_0x2f54ec){return function(_0x3ab89d){if(_0x3ab89d){var _0x50e1fb=_0x3ab89d[_0xf59c('0x36')],_0x3e9466=_0x2f54ec[_0xf59c('0x37')],_0x1be7bc=_0x2f54ec[_0xf59c('0x37')]+_0x2f54ec[_0xf59c('0x38')],_0xe83cd1;if(_0x1be7bc>=_0x50e1fb){_0x1be7bc=_0x50e1fb;_0xe83cd1=0xc8;}else{_0xe83cd1=0xce;}_0x486929[_0xf59c('0x34')](_0xe83cd1);return _0x486929[_0xf59c('0x39')](_0xf59c('0x3a'),_0x3e9466+'-'+_0x1be7bc+'/'+_0x50e1fb)[_0xf59c('0x35')](_0x3ab89d);}return null;};}function patchUpdates(_0x1f186c){return function(_0x524170){try{jsonpatch[_0xf59c('0x3b')](_0x524170,_0x1f186c,!![]);}catch(_0x9aa40){return BPromise[_0xf59c('0x3c')](_0x9aa40);}return _0x524170[_0xf59c('0x3d')]();};}function saveUpdates(_0xe129fb,_0x37ca9a){return function(_0x30c5ed){if(_0x30c5ed){return _0x30c5ed[_0xf59c('0x3e')](_0xe129fb)[_0xf59c('0x27')](function(_0x1de200){return _0x1de200;});}return null;};}function removeEntity(_0x181204,_0x494532){return function(_0xfeb513){if(_0xfeb513){return _0xfeb513[_0xf59c('0x3f')]()[_0xf59c('0x27')](function(){_0x181204[_0xf59c('0x34')](0xcc)[_0xf59c('0x33')]();});}};}function handleEntityNotFound(_0x58f6b6,_0x2cfc6e){return function(_0x4bac17){if(!_0x4bac17){_0x58f6b6[_0xf59c('0x32')](0x194);}return _0x4bac17;};}function handleError(_0x22a1d5,_0x2d7917){_0x2d7917=_0x2d7917||0x1f4;return function(_0x25d4fa){logger[_0xf59c('0x2d')](_0x25d4fa[_0xf59c('0x40')]);if(_0x25d4fa[_0xf59c('0x41')]){delete _0x25d4fa[_0xf59c('0x41')];}_0x22a1d5[_0xf59c('0x34')](_0x2d7917)[_0xf59c('0x42')](_0x25d4fa);};}exports[_0xf59c('0x43')]=function(_0x4889f8,_0x14acb5){var _0x4604ec={},_0x5564f7={},_0x31d0aa={'count':0x0,'rows':[]};var _0x3d889f=_[_0xf59c('0x44')](db[_0xf59c('0x45')][_0xf59c('0x46')],function(_0x214b0c){return{'name':_0x214b0c[_0xf59c('0x47')],'type':_0x214b0c[_0xf59c('0x48')][_0xf59c('0x49')]};});_0x5564f7[_0xf59c('0x4a')]=_[_0xf59c('0x44')](_0x3d889f,'name');_0x5564f7[_0xf59c('0x4b')]=_['keys'](_0x4889f8['query']);_0x5564f7[_0xf59c('0x4c')]=_[_0xf59c('0x4d')](_0x5564f7['model'],_0x5564f7[_0xf59c('0x4b')]);_0x4604ec[_0xf59c('0x4e')]=_['intersection'](_0x5564f7[_0xf59c('0x4a')],qs[_0xf59c('0x4f')](_0x4889f8['query']['fields']));_0x4604ec[_0xf59c('0x4e')]=_0x4604ec['attributes'][_0xf59c('0x50')]?_0x4604ec['attributes']:_0x5564f7[_0xf59c('0x4a')];if(!_0x4889f8[_0xf59c('0x4b')]['hasOwnProperty'](_0xf59c('0x51'))){_0x4604ec['limit']=qs[_0xf59c('0x38')](_0x4889f8[_0xf59c('0x4b')]['limit']);_0x4604ec[_0xf59c('0x37')]=qs[_0xf59c('0x37')](_0x4889f8['query'][_0xf59c('0x37')]);}_0x4604ec[_0xf59c('0x52')]=qs['sort'](_0x4889f8[_0xf59c('0x4b')][_0xf59c('0x53')]);_0x4604ec['where']=qs[_0xf59c('0x4c')](_[_0xf59c('0x54')](_0x4889f8[_0xf59c('0x4b')],_0x5564f7[_0xf59c('0x4c')]),_0x3d889f);if(_0x4889f8[_0xf59c('0x4b')][_0xf59c('0x55')]){_0x4604ec[_0xf59c('0x56')]=_['merge'](_0x4604ec['where'],{'$or':_[_0xf59c('0x44')](_0x3d889f,function(_0xfca396){if(_0xfca396[_0xf59c('0x48')]!==_0xf59c('0x57')){var _0x4d73a3={};_0x4d73a3[_0xfca396[_0xf59c('0x41')]]={'$like':'%'+_0x4889f8['query'][_0xf59c('0x55')]+'%'};return _0x4d73a3;}})});}_0x4604ec=_['merge']({},_0x4604ec,_0x4889f8[_0xf59c('0x58')]);var _0x2d6d19={'where':_0x4604ec['where']};return db[_0xf59c('0x45')][_0xf59c('0x36')](_0x2d6d19)[_0xf59c('0x27')](function(_0x59f6ed){_0x31d0aa[_0xf59c('0x36')]=_0x59f6ed;if(_0x4889f8[_0xf59c('0x4b')][_0xf59c('0x59')]){_0x4604ec[_0xf59c('0x5a')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xf59c('0x5b')](_0x4604ec);})[_0xf59c('0x27')](function(_0x56ff0f){_0x31d0aa[_0xf59c('0x5c')]=_0x56ff0f;return _0x31d0aa;})['then'](respondWithFilteredResult(_0x14acb5,_0x4604ec))['catch'](handleError(_0x14acb5,null));};exports[_0xf59c('0x5d')]=function(_0x2662d4,_0x34fe2d){var _0xbaef0e={'raw':!![],'where':{'id':_0x2662d4['params']['id']}},_0x1133dc={};_0x1133dc[_0xf59c('0x4a')]=_['keys'](db[_0xf59c('0x45')][_0xf59c('0x46')]);_0x1133dc[_0xf59c('0x4b')]=_[_0xf59c('0x5e')](_0x2662d4['query']);_0x1133dc['filters']=_[_0xf59c('0x4d')](_0x1133dc['model'],_0x1133dc[_0xf59c('0x4b')]);_0xbaef0e[_0xf59c('0x4e')]=_['intersection'](_0x1133dc['model'],qs['fields'](_0x2662d4[_0xf59c('0x4b')][_0xf59c('0x4f')]));_0xbaef0e[_0xf59c('0x4e')]=_0xbaef0e[_0xf59c('0x4e')]['length']?_0xbaef0e['attributes']:_0x1133dc[_0xf59c('0x4a')];if(_0x2662d4[_0xf59c('0x4b')][_0xf59c('0x59')]){_0xbaef0e[_0xf59c('0x5a')]=[{'all':!![]}];}_0xbaef0e=_['merge']({},_0xbaef0e,_0x2662d4['options']);return db[_0xf59c('0x45')]['find'](_0xbaef0e)['then'](handleEntityNotFound(_0x34fe2d,null))[_0xf59c('0x27')](respondWithResult(_0x34fe2d,null))[_0xf59c('0x31')](handleError(_0x34fe2d,null));};exports[_0xf59c('0x5f')]=function(_0x57f8a3,_0x4981fe){return db[_0xf59c('0x45')][_0xf59c('0x5f')](_0x57f8a3[_0xf59c('0x60')],{})[_0xf59c('0x27')](respondWithResult(_0x4981fe,0xc9))[_0xf59c('0x31')](handleError(_0x4981fe,null));};exports[_0xf59c('0x3e')]=function(_0x2812e4,_0x18046a){if(_0x2812e4[_0xf59c('0x60')]['id']){delete _0x2812e4[_0xf59c('0x60')]['id'];}return db[_0xf59c('0x45')][_0xf59c('0x61')]({'where':{'id':_0x2812e4['params']['id']}})[_0xf59c('0x27')](handleEntityNotFound(_0x18046a,null))['then'](saveUpdates(_0x2812e4[_0xf59c('0x60')],null))[_0xf59c('0x27')](respondWithResult(_0x18046a,null))[_0xf59c('0x31')](handleError(_0x18046a,null));};exports['destroy']=function(_0x58d4ad,_0xfb4979){return db['WhatsappMessage']['find']({'where':{'id':_0x58d4ad[_0xf59c('0x62')]['id']}})[_0xf59c('0x27')](handleEntityNotFound(_0xfb4979,null))[_0xf59c('0x27')](removeEntity(_0xfb4979,null))['catch'](handleError(_0xfb4979,null));};exports['describe']=function(_0x23d330,_0x343c40){return db[_0xf59c('0x45')]['describe']()[_0xf59c('0x27')](respondWithResult(_0x343c40,null))['catch'](handleError(_0x343c40,null));};var interaction_log=require(_0xf59c('0x17'))(_0xf59c('0x63'));exports[_0xf59c('0x64')]=function(_0x385c04,_0x15a6f4,_0x4836a9){var _0xd07e8c={'channel':_0xf59c('0x65')};if(_0x385c04[_0xf59c('0x60')]['id']){delete _0x385c04[_0xf59c('0x60')]['id'];}_0x385c04[_0xf59c('0x60')][_0xf59c('0x66')]=!![];_0x385c04[_0xf59c('0x60')]['readAt']=moment()['format'](_0xf59c('0x67'));_0x385c04[_0xf59c('0x60')][_0xf59c('0x68')]=_0x385c04['body'][_0xf59c('0x68')]||_0x385c04[_0xf59c('0x69')]['id'];return db[_0xf59c('0x45')]['find']({'where':{'id':_0x385c04[_0xf59c('0x62')]['id'],'UserId':null},'include':[{'model':db[_0xf59c('0x6a')],'as':_0xf59c('0x6b')}]})[_0xf59c('0x27')](handleEntityNotFound(_0x15a6f4,null))[_0xf59c('0x27')](saveUpdates(_0x385c04[_0xf59c('0x60')],null))['then'](function(_0x4c1bee){if(_0x4c1bee){_0xd07e8c['message']=_0x4c1bee[_0xf59c('0x6c')]({'plain':!![]});return db[_0xf59c('0x6d')]['find']({'where':{'id':_0x4c1bee[_0xf59c('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x15a6f4,null))['then'](function(_0xd1d37e){if(_0xd1d37e){return _0xd1d37e[_0xf59c('0x3e')]({'UserId':_0x385c04[_0xf59c('0x60')][_0xf59c('0x68')],'read1stAt':_[_0xf59c('0x6f')](_0xd1d37e[_0xf59c('0x70')])?moment()[_0xf59c('0x71')](_0xf59c('0x67')):undefined});}return null;})['then'](function(_0x6c19ba){if(_0x6c19ba){_0xd07e8c[_0xf59c('0x72')]=_0x6c19ba[_0xf59c('0x6c')]({'plain':!![]});interaction_log['info'](_0xf59c('0x73'),_0x385c04[_0xf59c('0x69')]['id'],_0x385c04[_0xf59c('0x69')][_0xf59c('0x41')],_0x385c04['user'][_0xf59c('0x74')],_0xd07e8c[_0xf59c('0x72')]['id'],_0x385c04[_0xf59c('0x60')]?JSON[_0xf59c('0x2c')](_0x385c04[_0xf59c('0x60')]):_0xf59c('0x75'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xd07e8c);}return null;})[_0xf59c('0x27')](function(_0x2b1b48){if(_0x2b1b48){if(_0x385c04[_0xf59c('0x60')][_0xf59c('0x76')]){_0xd07e8c['message'][_0xf59c('0x77')]=util[_0xf59c('0x71')](_0xf59c('0x78'),_0x385c04['user'][_0xf59c('0x41')]);_0xd07e8c[_0xf59c('0x2f')][_0xf59c('0x79')]=_0xd07e8c[_0xf59c('0x79')];_0xd07e8c['message'][_0xf59c('0x7a')]=_0xf59c('0x64');return respondWithRpcPromise('EventManager',_0xf59c('0x7b'),{'event':_0xf59c('0x7c'),'message':_0xd07e8c[_0xf59c('0x2f')]},client9002)[_0xf59c('0x27')](function(){return _0xd07e8c;});}return _0xd07e8c;}return null;})[_0xf59c('0x27')](respondWithResult(_0x15a6f4,null))[_0xf59c('0x31')](handleError(_0x15a6f4,null));};var interaction_log=require(_0xf59c('0x17'))(_0xf59c('0x63'));exports[_0xf59c('0x3c')]=function(_0x578d91,_0x177cf2,_0x4f53ef){var _0x1dd19e={'agent':{},'channel':'whatsapp'};if(_0x578d91[_0xf59c('0x60')]['id']){delete _0x578d91[_0xf59c('0x60')]['id'];}_0x578d91[_0xf59c('0x60')][_0xf59c('0x68')]=_0x578d91[_0xf59c('0x60')][_0xf59c('0x68')]||_0x578d91['user']['id'];_0x1dd19e[_0xf59c('0x7d')]['id']=_0x578d91[_0xf59c('0x60')][_0xf59c('0x68')];return db[_0xf59c('0x45')]['find']({'where':{'id':_0x578d91[_0xf59c('0x62')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x177cf2,null))[_0xf59c('0x27')](function(_0x2f4498){if(_0x2f4498){_0x1dd19e[_0xf59c('0x2f')]=_0x2f4498[_0xf59c('0x6c')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2f4498[_0xf59c('0x6e')]}});}return null;})[_0xf59c('0x27')](handleEntityNotFound(_0x177cf2,null))[_0xf59c('0x27')](function(_0xe02e0f){if(_0xe02e0f){_0x1dd19e[_0xf59c('0x72')]=_0xe02e0f[_0xf59c('0x6c')]({'plain':!![]});interaction_log[_0xf59c('0x30')](_0xf59c('0x7e'),_0x578d91[_0xf59c('0x69')]['id'],_0x578d91[_0xf59c('0x69')][_0xf59c('0x41')],_0x578d91[_0xf59c('0x69')]['role'],_0x1dd19e[_0xf59c('0x72')]['id'],_0x578d91['body']?JSON[_0xf59c('0x2c')](_0x578d91[_0xf59c('0x60')]):_0xf59c('0x75'));return respondWithRpcPromise(_0xf59c('0x7f'),_0xf59c('0x80'),_0x1dd19e);}return null;})[_0xf59c('0x27')](function(_0x3d9375){if(_0x3d9375){_0x3d9375['message'][_0xf59c('0x77')]=util[_0xf59c('0x71')]('SIP/%s',_0x578d91[_0xf59c('0x69')][_0xf59c('0x41')]);_0x3d9375[_0xf59c('0x2f')][_0xf59c('0x79')]=_0x1dd19e['channel'];_0x3d9375['message'][_0xf59c('0x7a')]='reject';respondWithRpcPromise(_0xf59c('0x7b'),_0xf59c('0x7b'),{'event':_0xf59c('0x81'),'message':_0x3d9375[_0xf59c('0x2f')]},client9002);return _0x1dd19e;}return null;})['then'](respondWithResult(_0x177cf2,null))['catch'](handleError(_0x177cf2,null));};exports['status']=function(_0x1836fa,_0x405123,_0x39d1c2){if(_0x1836fa[_0xf59c('0x60')]['id']){delete _0x1836fa[_0xf59c('0x60')]['id'];}var _0x3f2ac6;return db[_0xf59c('0x45')][_0xf59c('0x61')]({'where':{'id':_0x1836fa[_0xf59c('0x62')]['id']}})[_0xf59c('0x27')](handleEntityNotFound(_0x405123,null))[_0xf59c('0x27')](function(_0x481e86){if(_0x481e86){_0x3f2ac6=_0x481e86;return db['WhatsappAccount'][_0xf59c('0x61')]({'where':{'id':_0x481e86[_0xf59c('0x82')]}});}})[_0xf59c('0x27')](handleEntityNotFound(_0x405123,null))['then'](function(_0x4d5322){if(_0x4d5322){logger[_0xf59c('0x2a')](_0xf59c('0x83'),'status',_0xf59c('0x84'),_0x4d5322[_0xf59c('0x48')],util[_0xf59c('0x85')](_0x1836fa[_0xf59c('0x60')],{'showHidden':![],'depth':null}));switch(_0x4d5322[_0xf59c('0x48')]){case'twilio':if(_0x1836fa[_0xf59c('0x60')]['MessageSid']&&_0x1836fa[_0xf59c('0x60')][_0xf59c('0x86')]===_0x3f2ac6[_0xf59c('0x87')]&&_0x1836fa['body'][_0xf59c('0x88')]&&_0x1836fa[_0xf59c('0x60')][_0xf59c('0x88')]===_0xf59c('0x66')){return _0x3f2ac6[_0xf59c('0x3e')]({'read':!![]});}else{logger[_0xf59c('0x2d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf59c('0x34'),_0xf59c('0x89'),util[_0xf59c('0x85')](_0x1836fa[_0xf59c('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x3f2ac6;}})[_0xf59c('0x27')](respondWithResult(_0x405123,null))['catch'](handleError(_0x405123,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 64ec850..3821719 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x144657,_0x3e2d7a){var _0x21712a=function(_0x18375b){while(--_0x18375b){_0x144657['push'](_0x144657['shift']());}};_0x21712a(++_0x3e2d7a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ce17a,_0x99b128){_0x1ce17a=_0x1ce17a-0x0;var _0x3f2c4d=_0x5f2f[_0x1ce17a];return _0x3f2c4d;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x18dc41,_0x3a6d71){var _0x2f5325=function(_0x3d408b){while(--_0x3d408b){_0x18dc41['push'](_0x18dc41['shift']());}};_0x2f5325(++_0x3a6d71);}(_0x7a54,0x106));var _0x47a5=function(_0x2fd030,_0x5357eb){_0x2fd030=_0x2fd030-0x0;var _0x25c27f=_0x7a54[_0x2fd030];return _0x25c27f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d451836..a356bb6 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 _0x9e95=['/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','direction','catch','error','find','type','twilio','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/'];(function(_0x4a0877,_0x212c9b){var _0x3d15d9=function(_0x28f6e4){while(--_0x28f6e4){_0x4a0877['push'](_0x4a0877['shift']());}};_0x3d15d9(++_0x212c9b);}(_0x9e95,0x186));var _0x59e9=function(_0x2afb23,_0x2700fa){_0x2afb23=_0x2afb23-0x0;var _0x19791e=_0x9e95[_0x2afb23];return _0x19791e;};'use strict';var _=require(_0x59e9('0x0'));var util=require(_0x59e9('0x1'));var logger=require(_0x59e9('0x2'))('api');var moment=require(_0x59e9('0x3'));var BPromise=require(_0x59e9('0x4'));var rp=require(_0x59e9('0x5'));var fs=require('fs');var path=require(_0x59e9('0x6'));var rimraf=require(_0x59e9('0x7'));var config=require(_0x59e9('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x59e9('0x9')]=function(_0x410553,_0xc46951){return _0x410553[_0x59e9('0xa')](_0x59e9('0xb'),attributes,{'tableName':_0x59e9('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x59e9('0xd')]},{'name':_0x59e9('0xe'),'fields':[_0x59e9('0xf')],'type':_0x59e9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x555864,_0x139f14,_0x301b17){var _0x35d666=_0x410553[_0x59e9('0x11')];var _0xee181d=_0x555864[_0x59e9('0x12')]({'plain':!![]});if(_0xee181d['direction']['toLowerCase']()==='in'||_0xee181d['direction']['toLowerCase']()===_0x59e9('0x13')&&!_0xee181d[_0x59e9('0x14')]&&!_[_0x59e9('0x15')](_0xee181d[_0x59e9('0x16')])){_0x35d666[_0x59e9('0x17')][_0x59e9('0x18')]({'where':{'id':_0xee181d[_0x59e9('0x19')]}})[_0x59e9('0x1a')](function(_0x304512){if(_0x304512){_0x304512[_0x59e9('0x1b')]({'lastMsgAt':_0xee181d[_0x59e9('0x1c')],'lastMsgDirection':_0xee181d[_0x59e9('0x1d')]['toLowerCase']()});}})[_0x59e9('0x1e')](function(_0x17a669){console[_0x59e9('0x1f')](_0x17a669);});}if(_0xee181d[_0x59e9('0x1d')]===_0x59e9('0x13')&&!_0xee181d[_0x59e9('0x14')]){var _0x39c298;_0x35d666['WhatsappAccount'][_0x59e9('0x20')]({'where':{'id':_0xee181d['WhatsappAccountId']},'raw':!![]})['then'](function(_0x53be63){_0x39c298=_0x53be63;if(_0x39c298&&_0x39c298[_0x59e9('0x21')]){switch(_0x39c298[_0x59e9('0x21')]){case _0x59e9('0x22'):var _0xd7106d=require(_0x59e9('0x22'));if(_0x39c298['accountSid']&&_0x39c298['authToken']&&_0x39c298[_0x59e9('0x23')]){var _0x31eea4=new _0xd7106d(_0x39c298['accountSid'],_0x39c298[_0x59e9('0x24')]);_0x31eea4[_0x59e9('0x25')][_0x59e9('0x26')]({'body':_0xee181d[_0x59e9('0xf')],'to':_0x59e9('0x27')+_0xee181d[_0x59e9('0x23')],'from':_0x59e9('0x27')+_0x39c298['phone'],'statusCallback':_0x39c298[_0x59e9('0x28')]+_0x59e9('0x29')+_0xee181d['id']+_0x59e9('0x2a')+_0x39c298['token']})['then'](function(_0x436743){if(_0x436743[_0x59e9('0x2b')]){return _0x555864[_0x59e9('0x1b')]({'messageId':_0x436743[_0x59e9('0x2b')]});}})[_0x59e9('0x1e')](function(_0x24764c){logger[_0x59e9('0x1f')](_0x59e9('0x2c'),'afterCreate',_0x59e9('0x22'),util[_0x59e9('0x2d')](_0x24764c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59e9('0x2c'),'afterCreate',_0x59e9('0x22'),_0x59e9('0x2e'));}break;}}})[_0x59e9('0x2f')](function(){_0x301b17();});}else{_0x301b17();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xeebe=['whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne','WhatsappInteractionId','then','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','accountSid','authToken','phone','create'];(function(_0x288e9f,_0x146a40){var _0x2789e8=function(_0xc0b471){while(--_0xc0b471){_0x288e9f['push'](_0x288e9f['shift']());}};_0x2789e8(++_0x146a40);}(_0xeebe,0x1ee));var _0xeeeb=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xeebe[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xeeeb('0x0'));var util=require(_0xeeeb('0x1'));var logger=require(_0xeeeb('0x2'))(_0xeeeb('0x3'));var moment=require(_0xeeeb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeeeb('0x5'));var attributes=require(_0xeeeb('0x6'));module[_0xeeeb('0x7')]=function(_0x38eabe,_0x2eb6a6){return _0x38eabe[_0xeeeb('0x8')]('WhatsappMessage',attributes,{'tableName':_0xeeeb('0x9'),'paranoid':![],'indexes':[{'name':_0xeeeb('0xa'),'fields':[_0xeeeb('0xa')]},{'name':_0xeeeb('0xb'),'fields':['body'],'type':_0xeeeb('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ff899,_0x29a5d9,_0x261b4c){var _0x5841f7=_0x38eabe[_0xeeeb('0xd')];var _0x488c3e=_0x4ff899[_0xeeeb('0xe')]({'plain':!![]});if(_0x488c3e[_0xeeeb('0xf')][_0xeeeb('0x10')]()==='in'||_0x488c3e['direction']['toLowerCase']()===_0xeeeb('0x11')&&!_0x488c3e['secret']&&!_[_0xeeeb('0x12')](_0x488c3e[_0xeeeb('0x13')])){_0x5841f7['WhatsappInteraction'][_0xeeeb('0x14')]({'where':{'id':_0x488c3e[_0xeeeb('0x15')]}})[_0xeeeb('0x16')](function(_0xbdf69b){if(_0xbdf69b){_0xbdf69b['update']({'lastMsgAt':_0x488c3e[_0xeeeb('0x17')],'lastMsgDirection':_0x488c3e[_0xeeeb('0xf')][_0xeeeb('0x10')]()});}})['catch'](function(_0x15e653){console[_0xeeeb('0x18')](_0x15e653);});}if(_0x488c3e[_0xeeeb('0xf')]===_0xeeeb('0x11')&&!_0x488c3e[_0xeeeb('0x19')]){var _0x2d55b7;_0x5841f7[_0xeeeb('0x1a')][_0xeeeb('0x1b')]({'where':{'id':_0x488c3e[_0xeeeb('0x1c')]},'raw':!![]})[_0xeeeb('0x16')](function(_0x1ab83b){_0x2d55b7=_0x1ab83b;if(_0x2d55b7&&_0x2d55b7[_0xeeeb('0x1d')]){switch(_0x2d55b7[_0xeeeb('0x1d')]){case'twilio':var _0x3e28ec=require('twilio');if(_0x2d55b7[_0xeeeb('0x1e')]&&_0x2d55b7[_0xeeeb('0x1f')]&&_0x2d55b7[_0xeeeb('0x20')]){var _0x5f1ad4=new _0x3e28ec(_0x2d55b7['accountSid'],_0x2d55b7[_0xeeeb('0x1f')]);_0x5f1ad4['messages'][_0xeeeb('0x21')]({'body':_0x488c3e['body'],'to':_0xeeeb('0x22')+_0x488c3e[_0xeeeb('0x20')],'from':_0xeeeb('0x22')+_0x2d55b7['phone'],'statusCallback':_0x2d55b7[_0xeeeb('0x23')]+_0xeeeb('0x24')+_0x488c3e['id']+_0xeeeb('0x25')+_0x2d55b7[_0xeeeb('0x26')]})['then'](function(_0x1e631e){if(_0x1e631e[_0xeeeb('0x27')]){return _0x4ff899[_0xeeeb('0x28')]({'messageId':_0x1e631e[_0xeeeb('0x27')]});}})[_0xeeeb('0x29')](function(_0x10332b){logger[_0xeeeb('0x18')](_0xeeeb('0x2a'),_0xeeeb('0x2b'),'twilio',util[_0xeeeb('0x2c')](_0x10332b,{'showHidden':![],'depth':null}));});}else{logger[_0xeeeb('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0xeeeb('0x2d'));}break;}}})[_0xeeeb('0x2e')](function(){_0x261b4c();});}else{_0x261b4c();}}},'charset':_0xeeeb('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 475c0d2..f41da4c 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 _0x35ac=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappMessage.socket','register','request'];(function(_0x49b720,_0x10e9f2){var _0x290c1b=function(_0x3d056a){while(--_0x3d056a){_0x49b720['push'](_0x49b720['shift']());}};_0x290c1b(++_0x10e9f2);}(_0x35ac,0x9e));var _0xc35a=function(_0x21cde8,_0x324f60){_0x21cde8=_0x21cde8-0x0;var _0x300c9f=_0x35ac[_0x21cde8];return _0x300c9f;};'use strict';var _=require(_0xc35a('0x0'));var util=require(_0xc35a('0x1'));var moment=require(_0xc35a('0x2'));var BPromise=require(_0xc35a('0x3'));var rs=require(_0xc35a('0x4'));var fs=require('fs');var Redis=require(_0xc35a('0x5'));var db=require(_0xc35a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc35a('0x7'));var config=require(_0xc35a('0x8'));var jayson=require(_0xc35a('0x9'));var client=jayson['client'][_0xc35a('0xa')]({'port':0x232a});config[_0xc35a('0xb')]=_[_0xc35a('0xc')](config[_0xc35a('0xb')],{'host':_0xc35a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc35a('0xb')]));require(_0xc35a('0xe'))[_0xc35a('0xf')](socket);function respondWithRpcPromise(_0x25ec31,_0x3df58e,_0x42076f){return new BPromise(function(_0x4c210e,_0x2b060e){return client[_0xc35a('0x10')](_0x25ec31,_0x42076f)[_0xc35a('0x11')](function(_0x49b021){logger[_0xc35a('0x12')](_0xc35a('0x13'),_0x3df58e,_0xc35a('0x14'));logger[_0xc35a('0x15')](_0xc35a('0x16'),_0x3df58e,_0xc35a('0x14'),JSON[_0xc35a('0x17')](_0x49b021));if(_0x49b021[_0xc35a('0x18')]){if(_0x49b021[_0xc35a('0x18')][_0xc35a('0x19')]===0x1f4){logger[_0xc35a('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x3df58e,_0x49b021[_0xc35a('0x18')][_0xc35a('0x1a')]);return _0x2b060e(_0x49b021[_0xc35a('0x18')][_0xc35a('0x1a')]);}logger['error'](_0xc35a('0x13'),_0x3df58e,_0x49b021[_0xc35a('0x18')][_0xc35a('0x1a')]);return _0x4c210e(_0x49b021[_0xc35a('0x18')][_0xc35a('0x1a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3df58e,'request\x20sent');_0x4c210e(_0x49b021[_0xc35a('0x1b')][_0xc35a('0x1a')]);}})['catch'](function(_0x1cbd42){logger[_0xc35a('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x3df58e,_0x1cbd42);_0x2b060e(_0x1cbd42);});});}exports[_0xc35a('0x1c')]=function(_0x19e5c3){var _0x937fd7=this;return new Promise(function(_0x30e57b,_0x11961c){return db[_0xc35a('0x1d')][_0xc35a('0x1e')](_0x19e5c3[_0xc35a('0x1f')],{'raw':_0x19e5c3[_0xc35a('0x20')]?_0x19e5c3[_0xc35a('0x20')][_0xc35a('0x21')]===undefined?!![]:![]:!![]})[_0xc35a('0x11')](function(_0x253b83){logger[_0xc35a('0x12')]('CreateWhatsappMessage',_0x19e5c3);logger['debug'](_0xc35a('0x1c'),_0x19e5c3,JSON['stringify'](_0x253b83));_0x30e57b(_0x253b83);})[_0xc35a('0x22')](function(_0x1f4927){logger[_0xc35a('0x18')]('CreateWhatsappMessage',_0x1f4927[_0xc35a('0x1a')],_0x19e5c3);_0x11961c(_0x937fd7[_0xc35a('0x18')](0x1f4,_0x1f4927['message']));});});}; \ No newline at end of file +var _0x9a98=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage','WhatsappMessage','create','options','info','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2fa6df,_0x27a679){var _0x541051=function(_0x233564){while(--_0x233564){_0x2fa6df['push'](_0x2fa6df['shift']());}};_0x541051(++_0x27a679);}(_0x9a98,0x134));var _0x89a9=function(_0x9a64bb,_0xadeb05){_0x9a64bb=_0x9a64bb-0x0;var _0x219647=_0x9a98[_0x9a64bb];return _0x219647;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x89a9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a9('0x1'));var db=require(_0x89a9('0x2'))['db'];var utils=require(_0x89a9('0x3'));var logger=require(_0x89a9('0x4'))(_0x89a9('0x5'));var config=require(_0x89a9('0x6'));var jayson=require(_0x89a9('0x7'));var client=jayson[_0x89a9('0x8')][_0x89a9('0x9')]({'port':0x232a});config[_0x89a9('0xa')]=_[_0x89a9('0xb')](config[_0x89a9('0xa')],{'host':_0x89a9('0xc'),'port':0x18eb});var socket=require(_0x89a9('0xd'))(new Redis(config[_0x89a9('0xa')]));require(_0x89a9('0xe'))[_0x89a9('0xf')](socket);function respondWithRpcPromise(_0x369a71,_0x59fb17,_0x3ea5e5){return new BPromise(function(_0x5ccc9e,_0x3abb74){return client[_0x89a9('0x10')](_0x369a71,_0x3ea5e5)[_0x89a9('0x11')](function(_0xfd4648){logger['info'](_0x89a9('0x12'),_0x59fb17,_0x89a9('0x13'));logger[_0x89a9('0x14')](_0x89a9('0x15'),_0x59fb17,_0x89a9('0x13'),JSON[_0x89a9('0x16')](_0xfd4648));if(_0xfd4648[_0x89a9('0x17')]){if(_0xfd4648[_0x89a9('0x17')]['code']===0x1f4){logger['error'](_0x89a9('0x12'),_0x59fb17,_0xfd4648[_0x89a9('0x17')][_0x89a9('0x18')]);return _0x3abb74(_0xfd4648[_0x89a9('0x17')][_0x89a9('0x18')]);}logger[_0x89a9('0x17')](_0x89a9('0x12'),_0x59fb17,_0xfd4648[_0x89a9('0x17')][_0x89a9('0x18')]);return _0x5ccc9e(_0xfd4648[_0x89a9('0x17')][_0x89a9('0x18')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x59fb17,_0x89a9('0x13'));_0x5ccc9e(_0xfd4648[_0x89a9('0x19')][_0x89a9('0x18')]);}})['catch'](function(_0x57eafe){logger['error'](_0x89a9('0x12'),_0x59fb17,_0x57eafe);_0x3abb74(_0x57eafe);});});}exports[_0x89a9('0x1a')]=function(_0x56e5bb){var _0x342fd1=this;return new Promise(function(_0x29b40b,_0xeceff2){return db[_0x89a9('0x1b')][_0x89a9('0x1c')](_0x56e5bb['body'],{'raw':_0x56e5bb[_0x89a9('0x1d')]?_0x56e5bb[_0x89a9('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x89a9('0x11')](function(_0x59383a){logger[_0x89a9('0x1e')](_0x89a9('0x1a'),_0x56e5bb);logger['debug'](_0x89a9('0x1a'),_0x56e5bb,JSON[_0x89a9('0x16')](_0x59383a));_0x29b40b(_0x59383a);})[_0x89a9('0x1f')](function(_0x1febee){logger['error'](_0x89a9('0x1a'),_0x1febee[_0x89a9('0x18')],_0x56e5bb);_0xeceff2(_0x342fd1['error'](0x1f4,_0x1febee[_0x89a9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9c9f1d6..eafc2cf 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 _0x9092=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0x1e95a1,_0x1b57c0){var _0x21c663=function(_0x5f17ea){while(--_0x5f17ea){_0x1e95a1['push'](_0x1e95a1['shift']());}};_0x21c663(++_0x1b57c0);}(_0x9092,0xf3));var _0x2909=function(_0x304fe4,_0x2348be){_0x304fe4=_0x304fe4-0x0;var _0x147821=_0x9092[_0x304fe4];return _0x147821;};'use strict';var WhatsappMessageEvents=require(_0x2909('0x0'));var events=['save',_0x2909('0x1'),_0x2909('0x2')];function createListener(_0x21f976,_0x8b7e5d){return function(_0x16fb61){_0x8b7e5d[_0x2909('0x3')](_0x21f976,_0x16fb61);};}function removeListener(_0x247d4e,_0x34bcde){return function(){WhatsappMessageEvents['removeListener'](_0x247d4e,_0x34bcde);};}exports[_0x2909('0x4')]=function(_0x11937b){for(var _0x1e15ec=0x0,_0x18c9ed=events[_0x2909('0x5')];_0x1e15ec<_0x18c9ed;_0x1e15ec++){var _0x35c277=events[_0x1e15ec];var _0x1f658f=createListener(_0x2909('0x6')+_0x35c277,_0x11937b);WhatsappMessageEvents['on'](_0x35c277,_0x1f658f);}}; \ No newline at end of file +var _0x23c0=['removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x17efd7,_0x5bc32e){var _0x191509=function(_0x5929fa){while(--_0x5929fa){_0x17efd7['push'](_0x17efd7['shift']());}};_0x191509(++_0x5bc32e);}(_0x23c0,0x153));var _0x023c=function(_0x38580f,_0x29c673){_0x38580f=_0x38580f-0x0;var _0x5a9282=_0x23c0[_0x38580f];return _0x5a9282;};'use strict';var WhatsappMessageEvents=require(_0x023c('0x0'));var events=[_0x023c('0x1'),_0x023c('0x2'),'update'];function createListener(_0x48710e,_0x9f20a7){return function(_0x54214d){_0x9f20a7[_0x023c('0x3')](_0x48710e,_0x54214d);};}function removeListener(_0x2d07cf,_0x5490dd){return function(){WhatsappMessageEvents[_0x023c('0x4')](_0x2d07cf,_0x5490dd);};}exports[_0x023c('0x5')]=function(_0x67d4c2){for(var _0x1ff1e6=0x0,_0x549614=events['length'];_0x1ff1e6<_0x549614;_0x1ff1e6++){var _0x5b39e8=events[_0x1ff1e6];var _0x149b1c=createListener(_0x023c('0x6')+_0x5b39e8,_0x67d4c2);WhatsappMessageEvents['on'](_0x5b39e8,_0x149b1c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index aa3493f..97abbec 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 _0x6578=['Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','removeTeams','exports','multer','util','path'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x6578,0x105));var _0x8657=function(_0x32225e,_0x4c66ce){_0x32225e=_0x32225e-0x0;var _0x400259=_0x6578[_0x32225e];return _0x400259;};'use strict';var multer=require(_0x8657('0x0'));var util=require(_0x8657('0x1'));var path=require(_0x8657('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8657('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8657('0x4'));var config=require(_0x8657('0x5'));var controller=require(_0x8657('0x6'));router['get']('/',auth[_0x8657('0x7')](),controller[_0x8657('0x8')]);router[_0x8657('0x9')](_0x8657('0xa'),auth[_0x8657('0x7')](),controller[_0x8657('0xb')]);router[_0x8657('0x9')](_0x8657('0xc'),auth[_0x8657('0x7')](),controller[_0x8657('0xd')]);router[_0x8657('0x9')]('/:id/members',auth[_0x8657('0x7')](),controller['getMembers']);router[_0x8657('0x9')](_0x8657('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x8657('0x9')](_0x8657('0xf'),auth['isAuthenticated'](),controller[_0x8657('0x10')]);router[_0x8657('0x11')]('/',auth[_0x8657('0x7')](),controller[_0x8657('0x12')]);router['post'](_0x8657('0xe'),auth[_0x8657('0x7')](),controller['addTeams']);router['post']('/:id/users',auth[_0x8657('0x7')](),controller[_0x8657('0x13')]);router[_0x8657('0x14')](_0x8657('0xc'),auth[_0x8657('0x7')](),controller['update']);router[_0x8657('0x15')]('/:id',auth[_0x8657('0x7')](),controller['destroy']);router[_0x8657('0x15')](_0x8657('0xe'),auth['isAuthenticated'](),controller[_0x8657('0x16')]);router[_0x8657('0x15')](_0x8657('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x8657('0x17')]=router; \ No newline at end of file +var _0x7d3b=['removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams'];(function(_0xae80a8,_0xc4258c){var _0x27ad19=function(_0x40dcd7){while(--_0x40dcd7){_0xae80a8['push'](_0xae80a8['shift']());}};_0x27ad19(++_0xc4258c);}(_0x7d3b,0x13a));var _0xb7d3=function(_0x3e0e33,_0x42053e){_0x3e0e33=_0x3e0e33-0x0;var _0x4e9f31=_0x7d3b[_0x3e0e33];return _0x4e9f31;};'use strict';var multer=require(_0xb7d3('0x0'));var util=require(_0xb7d3('0x1'));var path=require(_0xb7d3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7d3('0x3'));var router=express[_0xb7d3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb7d3('0x5'));var config=require(_0xb7d3('0x6'));var controller=require(_0xb7d3('0x7'));router[_0xb7d3('0x8')]('/',auth['isAuthenticated'](),controller[_0xb7d3('0x9')]);router[_0xb7d3('0x8')](_0xb7d3('0xa'),auth[_0xb7d3('0xb')](),controller[_0xb7d3('0xc')]);router[_0xb7d3('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb7d3('0x8')]('/:id/members',auth[_0xb7d3('0xb')](),controller['getMembers']);router[_0xb7d3('0x8')](_0xb7d3('0xd'),auth[_0xb7d3('0xb')](),controller['getTeams']);router[_0xb7d3('0x8')](_0xb7d3('0xe'),auth[_0xb7d3('0xb')](),controller[_0xb7d3('0xf')]);router[_0xb7d3('0x10')]('/',auth[_0xb7d3('0xb')](),controller['create']);router[_0xb7d3('0x10')](_0xb7d3('0xd'),auth[_0xb7d3('0xb')](),controller[_0xb7d3('0x11')]);router['post']('/:id/users',auth[_0xb7d3('0xb')](),controller[_0xb7d3('0x12')]);router[_0xb7d3('0x13')](_0xb7d3('0x14'),auth[_0xb7d3('0xb')](),controller['update']);router[_0xb7d3('0x15')](_0xb7d3('0x14'),auth[_0xb7d3('0xb')](),controller[_0xb7d3('0x16')]);router[_0xb7d3('0x15')]('/:id/teams',auth[_0xb7d3('0xb')](),controller[_0xb7d3('0x17')]);router[_0xb7d3('0x15')]('/:id/users',auth[_0xb7d3('0xb')](),controller[_0xb7d3('0x18')]);module[_0xb7d3('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f94c050..3874e18 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 _0xd688=['STRING','name','INTEGER','ENUM','rrmemory','beepall','exports'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0xd688,0x6f));var _0x8d68=function(_0x72ee58,_0x3ddc46){_0x72ee58=_0x72ee58-0x0;var _0x233307=_0xd688[_0x72ee58];return _0x233307;};'use strict';var Sequelize=require('sequelize');module[_0x8d68('0x0')]={'name':{'type':Sequelize[_0x8d68('0x1')],'unique':_0x8d68('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8d68('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8d68('0x4')](_0x8d68('0x5'),_0x8d68('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x8d68('0x1')]}}; \ No newline at end of file +var _0x9a57=['roundrobin','STRING','name','INTEGER','ENUM'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9a57,0xa6));var _0x79a5=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x9a57[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x79a5('0x0')],'unique':_0x79a5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x79a5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79a5('0x3')]('rrmemory','beepall',_0x79a5('0x4'))},'description':{'type':Sequelize[_0x79a5('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 13c41d6..405117b 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 _0x2980=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','WhatsappQueue','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x2980,0x192));var _0x0298=function(_0x20598c,_0x1ca305){_0x20598c=_0x20598c-0x0;var _0x3952b6=_0x2980[_0x20598c];return _0x3952b6;};'use strict';var pdf=require(_0x0298('0x0'));var emlformat=require(_0x0298('0x1'));var rimraf=require(_0x0298('0x2'));var zipdir=require(_0x0298('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0298('0x4'));var BPromise=require(_0x0298('0x5'));var Mustache=require(_0x0298('0x6'));var util=require(_0x0298('0x7'));var path=require(_0x0298('0x8'));var sox=require(_0x0298('0x9'));var csv=require(_0x0298('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0298('0xb'));var squel=require(_0x0298('0xc'));var crypto=require('crypto');var jsforce=require(_0x0298('0xd'));var deskjs=require(_0x0298('0xe'));var toCsv=require(_0x0298('0xa'));var querystring=require('querystring');var Papa=require(_0x0298('0xf'));var Redis=require(_0x0298('0x10'));var authService=require(_0x0298('0x11'));var qs=require(_0x0298('0x12'));var as=require(_0x0298('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0298('0x14'))(_0x0298('0x15'));var utils=require(_0x0298('0x16'));var config=require(_0x0298('0x17'));var db=require(_0x0298('0x18'))['db'];config['redis']=_['defaults'](config[_0x0298('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0298('0x19')]));require(_0x0298('0x1a'))['register'](socket);function respondWithStatusCode(_0x3039dd,_0x4d65e2){_0x4d65e2=_0x4d65e2||0xcc;return function(_0x5672d8){if(_0x5672d8){return _0x3039dd[_0x0298('0x1b')](_0x4d65e2);}return _0x3039dd[_0x0298('0x1c')](_0x4d65e2)[_0x0298('0x1d')]();};}function respondWithResult(_0x397bfb,_0x22872a){_0x22872a=_0x22872a||0xc8;return function(_0xb26e8f){if(_0xb26e8f){return _0x397bfb[_0x0298('0x1c')](_0x22872a)[_0x0298('0x1e')](_0xb26e8f);}};}function respondWithFilteredResult(_0x32189d,_0x9919cd){return function(_0x3e5c12){if(_0x3e5c12){var _0x550da8=_0x3e5c12[_0x0298('0x1f')],_0x1e3192=_0x9919cd[_0x0298('0x20')],_0x55bc4a=_0x9919cd['offset']+_0x9919cd[_0x0298('0x21')],_0x1f3d9e;if(_0x55bc4a>=_0x550da8){_0x55bc4a=_0x550da8;_0x1f3d9e=0xc8;}else{_0x1f3d9e=0xce;}_0x32189d['status'](_0x1f3d9e);return _0x32189d[_0x0298('0x22')](_0x0298('0x23'),_0x1e3192+'-'+_0x55bc4a+'/'+_0x550da8)[_0x0298('0x1e')](_0x3e5c12);}return null;};}function patchUpdates(_0x473e4f){return function(_0x510bef){try{jsonpatch[_0x0298('0x24')](_0x510bef,_0x473e4f,!![]);}catch(_0x241721){return BPromise[_0x0298('0x25')](_0x241721);}return _0x510bef[_0x0298('0x26')]();};}function saveUpdates(_0x4fc344,_0x41c069){return function(_0x44ff10){if(_0x44ff10){return _0x44ff10[_0x0298('0x27')](_0x4fc344)[_0x0298('0x28')](function(_0x4c8d53){return _0x4c8d53;});}return null;};}function removeEntity(_0x22d047,_0x4e834b){return function(_0x5ac4b2){if(_0x5ac4b2){return _0x5ac4b2['destroy']()[_0x0298('0x28')](function(){var _0x769195=_0x5ac4b2[_0x0298('0x29')]({'plain':!![]});var _0x589896='WhatsappQueues';return db[_0x0298('0x2a')][_0x0298('0x2b')]({'where':{'type':_0x589896,'resourceId':_0x769195['id']}})[_0x0298('0x28')](function(){return _0x5ac4b2;});})['then'](function(){_0x22d047['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df651,_0x2240b8){return function(_0x56120e){if(!_0x56120e){_0x3df651['sendStatus'](0x194);}return _0x56120e;};}function handleError(_0x2ca52a,_0xc9930f){_0xc9930f=_0xc9930f||0x1f4;return function(_0x348f1a){logger[_0x0298('0x2c')](_0x348f1a['stack']);if(_0x348f1a['name']){delete _0x348f1a[_0x0298('0x2d')];}_0x2ca52a[_0x0298('0x1c')](_0xc9930f)[_0x0298('0x2e')](_0x348f1a);};}exports[_0x0298('0x2f')]=function(_0x1705f6,_0x27da49){var _0x2135ce={},_0x44cdeb={},_0x1e0b35={'count':0x0,'rows':[]};var _0x144573=_[_0x0298('0x30')](db[_0x0298('0x31')]['rawAttributes'],function(_0x33e59d){return{'name':_0x33e59d[_0x0298('0x32')],'type':_0x33e59d['type'][_0x0298('0x33')]};});_0x44cdeb[_0x0298('0x34')]=_[_0x0298('0x30')](_0x144573,_0x0298('0x2d'));_0x44cdeb[_0x0298('0x35')]=_['keys'](_0x1705f6[_0x0298('0x35')]);_0x44cdeb[_0x0298('0x36')]=_['intersection'](_0x44cdeb['model'],_0x44cdeb[_0x0298('0x35')]);_0x2135ce[_0x0298('0x37')]=_[_0x0298('0x38')](_0x44cdeb[_0x0298('0x34')],qs['fields'](_0x1705f6[_0x0298('0x35')][_0x0298('0x39')]));_0x2135ce['attributes']=_0x2135ce['attributes'][_0x0298('0x3a')]?_0x2135ce[_0x0298('0x37')]:_0x44cdeb[_0x0298('0x34')];if(!_0x1705f6[_0x0298('0x35')][_0x0298('0x3b')](_0x0298('0x3c'))){_0x2135ce[_0x0298('0x21')]=qs[_0x0298('0x21')](_0x1705f6[_0x0298('0x35')]['limit']);_0x2135ce[_0x0298('0x20')]=qs[_0x0298('0x20')](_0x1705f6['query']['offset']);}_0x2135ce[_0x0298('0x3d')]=qs[_0x0298('0x3e')](_0x1705f6[_0x0298('0x35')][_0x0298('0x3e')]);_0x2135ce[_0x0298('0x3f')]=qs[_0x0298('0x36')](_[_0x0298('0x40')](_0x1705f6['query'],_0x44cdeb[_0x0298('0x36')]),_0x144573);if(_0x1705f6['query'][_0x0298('0x41')]){_0x2135ce['where']=_[_0x0298('0x42')](_0x2135ce[_0x0298('0x3f')],{'$or':_['map'](_0x144573,function(_0x4bb414){if(_0x4bb414[_0x0298('0x43')]!==_0x0298('0x44')){var _0x2111af={};_0x2111af[_0x4bb414[_0x0298('0x2d')]]={'$like':'%'+_0x1705f6[_0x0298('0x35')][_0x0298('0x41')]+'%'};return _0x2111af;}})});}_0x2135ce=_[_0x0298('0x42')]({},_0x2135ce,_0x1705f6[_0x0298('0x45')]);var _0x1083b0={'where':_0x2135ce['where']};return db['WhatsappQueue'][_0x0298('0x1f')](_0x1083b0)[_0x0298('0x28')](function(_0x2eebd2){_0x1e0b35[_0x0298('0x1f')]=_0x2eebd2;if(_0x1705f6[_0x0298('0x35')][_0x0298('0x46')]){_0x2135ce[_0x0298('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x0298('0x48')](_0x2135ce);})[_0x0298('0x28')](function(_0x288034){_0x1e0b35[_0x0298('0x49')]=_0x288034;return _0x1e0b35;})['then'](respondWithFilteredResult(_0x27da49,_0x2135ce))[_0x0298('0x4a')](handleError(_0x27da49,null));};exports[_0x0298('0x4b')]=function(_0x74becc,_0x461673){var _0x13706f={'raw':!![],'where':{'id':_0x74becc[_0x0298('0x4c')]['id']}},_0x4b7501={};_0x4b7501[_0x0298('0x34')]=_['keys'](db[_0x0298('0x31')][_0x0298('0x4d')]);_0x4b7501[_0x0298('0x35')]=_[_0x0298('0x4e')](_0x74becc[_0x0298('0x35')]);_0x4b7501[_0x0298('0x36')]=_[_0x0298('0x38')](_0x4b7501['model'],_0x4b7501[_0x0298('0x35')]);_0x13706f[_0x0298('0x37')]=_[_0x0298('0x38')](_0x4b7501[_0x0298('0x34')],qs[_0x0298('0x39')](_0x74becc[_0x0298('0x35')]['fields']));_0x13706f['attributes']=_0x13706f[_0x0298('0x37')][_0x0298('0x3a')]?_0x13706f[_0x0298('0x37')]:_0x4b7501[_0x0298('0x34')];if(_0x74becc['query'][_0x0298('0x46')]){_0x13706f[_0x0298('0x47')]=[{'all':!![]}];}_0x13706f=_[_0x0298('0x42')]({},_0x13706f,_0x74becc[_0x0298('0x45')]);return db['WhatsappQueue'][_0x0298('0x4f')](_0x13706f)[_0x0298('0x28')](handleEntityNotFound(_0x461673,null))[_0x0298('0x28')](respondWithResult(_0x461673,null))[_0x0298('0x4a')](handleError(_0x461673,null));};exports[_0x0298('0x50')]=function(_0x715de1,_0x1c921d){return db['WhatsappQueue'][_0x0298('0x50')](_0x715de1[_0x0298('0x51')],{})[_0x0298('0x28')](function(_0x3a1eb3){var _0x4c38b2=_0x715de1[_0x0298('0x52')][_0x0298('0x29')]({'plain':!![]});if(!_0x4c38b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c38b2[_0x0298('0x53')]===_0x0298('0x52')){var _0xdc951=_0x3a1eb3['get']({'plain':!![]});var _0x4368f8=_0x0298('0x54');return db[_0x0298('0x55')][_0x0298('0x4f')]({'where':{'name':_0x4368f8,'userProfileId':_0x4c38b2[_0x0298('0x56')]},'raw':!![]})[_0x0298('0x28')](function(_0x2a6e8f){if(_0x2a6e8f&&_0x2a6e8f[_0x0298('0x57')]===0x0){return db[_0x0298('0x2a')][_0x0298('0x50')]({'name':_0xdc951['name'],'resourceId':_0xdc951['id'],'type':_0x2a6e8f[_0x0298('0x2d')],'sectionId':_0x2a6e8f['id']},{})[_0x0298('0x28')](function(){return _0x3a1eb3;});}else{return _0x3a1eb3;}})[_0x0298('0x4a')](function(_0x53c7c){logger[_0x0298('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53c7c);throw _0x53c7c;});}return _0x3a1eb3;})['then'](respondWithResult(_0x1c921d,0xc9))[_0x0298('0x4a')](handleError(_0x1c921d,null));};exports[_0x0298('0x27')]=function(_0x824b7d,_0x2e7a4a){if(_0x824b7d[_0x0298('0x51')]['id']){delete _0x824b7d[_0x0298('0x51')]['id'];}return db[_0x0298('0x31')][_0x0298('0x4f')]({'where':{'id':_0x824b7d['params']['id']}})['then'](handleEntityNotFound(_0x2e7a4a,null))[_0x0298('0x28')](saveUpdates(_0x824b7d[_0x0298('0x51')],null))[_0x0298('0x28')](respondWithResult(_0x2e7a4a,null))[_0x0298('0x4a')](handleError(_0x2e7a4a,null));};exports[_0x0298('0x2b')]=function(_0x157d92,_0xbb67b0){return db['WhatsappQueue'][_0x0298('0x4f')]({'where':{'id':_0x157d92[_0x0298('0x4c')]['id']}})[_0x0298('0x28')](handleEntityNotFound(_0xbb67b0,null))[_0x0298('0x28')](removeEntity(_0xbb67b0,null))['catch'](handleError(_0xbb67b0,null));};exports[_0x0298('0x58')]=function(_0xb61955,_0x21e395){return db[_0x0298('0x31')]['describe']()[_0x0298('0x28')](respondWithResult(_0x21e395,null))[_0x0298('0x4a')](handleError(_0x21e395,null));};exports[_0x0298('0x59')]=function(_0x225784,_0x2492ff,_0x52b143){var _0x5dca6={'raw':!![],'where':{}},_0x4d17be={},_0x317b15;return db['WhatsappQueue']['findOne']({'where':{'id':_0x225784[_0x0298('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2492ff,null))[_0x0298('0x28')](function(_0x4dae7b){if(_0x4dae7b){_0x317b15=_0x4dae7b[_0x0298('0x29')]({'plain':!![]});_0x4d17be[_0x0298('0x34')]=_[_0x0298('0x4e')](db[_0x0298('0x5a')][_0x0298('0x4d')]);_0x4d17be['query']=_['keys'](_0x225784['query']);_0x4d17be['filters']=_[_0x0298('0x38')](_0x4d17be[_0x0298('0x34')],_0x4d17be[_0x0298('0x35')]);_0x5dca6['attributes']=_[_0x0298('0x38')](_0x4d17be[_0x0298('0x34')],qs[_0x0298('0x39')](_0x225784[_0x0298('0x35')][_0x0298('0x39')]));_0x5dca6['attributes']=_0x5dca6[_0x0298('0x37')][_0x0298('0x3a')]?_0x5dca6[_0x0298('0x37')]:_0x4d17be[_0x0298('0x34')];if(!_0x225784[_0x0298('0x35')][_0x0298('0x3b')](_0x0298('0x3c'))){_0x5dca6[_0x0298('0x21')]=qs[_0x0298('0x21')](_0x225784[_0x0298('0x35')][_0x0298('0x21')]);_0x5dca6[_0x0298('0x20')]=qs[_0x0298('0x20')](_0x225784[_0x0298('0x35')][_0x0298('0x20')]);}_0x5dca6[_0x0298('0x3d')]=qs[_0x0298('0x3e')](_0x225784[_0x0298('0x35')]['sort']);_0x5dca6[_0x0298('0x3f')]=qs[_0x0298('0x36')](_[_0x0298('0x40')](_0x225784[_0x0298('0x35')],_0x4d17be[_0x0298('0x36')]));_0x5dca6['where'][_0x0298('0x5b')]=_0x4dae7b['id'];if(_0x225784[_0x0298('0x35')]['filter']){_0x5dca6[_0x0298('0x3f')]=_[_0x0298('0x42')](_0x5dca6[_0x0298('0x3f')],{'$or':_[_0x0298('0x30')](_0x5dca6[_0x0298('0x37')],function(_0x1d9b0a){var _0x2c3934={};_0x2c3934[_0x1d9b0a]={'$like':'%'+_0x225784[_0x0298('0x35')][_0x0298('0x41')]+'%'};return _0x2c3934;})});}_0x5dca6=_[_0x0298('0x42')]({},_0x5dca6,_0x225784['options']);return db[_0x0298('0x5a')][_0x0298('0x48')](_0x5dca6);}})[_0x0298('0x28')](function(_0x4bf0ec){if(_0x4bf0ec){return db['User'][_0x0298('0x5c')]({'where':{'id':_[_0x0298('0x30')](_0x4bf0ec,_0x0298('0x5d')),'role':_0x0298('0x5e')},'attributes':['id',_0x0298('0x2d'),'whatsappPause','updatedAt',_0x0298('0x5f')]});}})[_0x0298('0x28')](function(_0x4b8a87){if(_0x4b8a87){return{'count':_0x4b8a87['count'],'rows':_['map'](_0x4b8a87[_0x0298('0x49')],function(_0xe2312e){return{'membername':_0xe2312e[_0x0298('0x2d')],'UserId':_0xe2312e['id'],'queue_name':_0x317b15['name'],'WhatsappQueueId':_0x317b15['id'],'interface':util[_0x0298('0x60')]('%s/%s',_0x0298('0x61'),_0xe2312e[_0x0298('0x2d')]),'penalty':0x0,'paused':_0xe2312e['whatsappPause'],'createdAt':_0xe2312e[_0x0298('0x5f')],'updatedAt':_0xe2312e[_0x0298('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0298('0x28')](respondWithFilteredResult(_0x2492ff,_0x5dca6))[_0x0298('0x4a')](handleError(_0x2492ff,null));};exports[_0x0298('0x63')]=function(_0x220123,_0x284f90,_0x2f8151){var _0x39960b={};var _0x13dc0e={};var _0x4d62cd;var _0x31acaa;return db[_0x0298('0x31')][_0x0298('0x64')]({'where':{'id':_0x220123[_0x0298('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284f90,null))[_0x0298('0x28')](function(_0x4bf26c){if(_0x4bf26c){_0x4d62cd=_0x4bf26c;_0x13dc0e[_0x0298('0x34')]=_[_0x0298('0x4e')](db[_0x0298('0x65')][_0x0298('0x4d')]);_0x13dc0e[_0x0298('0x35')]=_[_0x0298('0x4e')](_0x220123[_0x0298('0x35')]);_0x13dc0e[_0x0298('0x36')]=_[_0x0298('0x38')](_0x13dc0e['model'],_0x13dc0e[_0x0298('0x35')]);_0x39960b['attributes']=_[_0x0298('0x38')](_0x13dc0e['model'],qs['fields'](_0x220123['query'][_0x0298('0x39')]));_0x39960b['attributes']=_0x39960b['attributes'][_0x0298('0x3a')]?_0x39960b[_0x0298('0x37')]:_0x13dc0e[_0x0298('0x34')];_0x39960b[_0x0298('0x3d')]=qs[_0x0298('0x3e')](_0x220123['query'][_0x0298('0x3e')]);_0x39960b[_0x0298('0x3f')]=qs[_0x0298('0x36')](_[_0x0298('0x40')](_0x220123[_0x0298('0x35')],_0x13dc0e['filters']));if(_0x220123[_0x0298('0x35')][_0x0298('0x41')]){_0x39960b[_0x0298('0x3f')]=_['merge'](_0x39960b['where'],{'$or':_[_0x0298('0x30')](_0x39960b[_0x0298('0x37')],function(_0x3af6b0){var _0x3019aa={};_0x3019aa[_0x3af6b0]={'$like':'%'+_0x220123[_0x0298('0x35')][_0x0298('0x41')]+'%'};return _0x3019aa;})});}_0x39960b=_[_0x0298('0x42')]({},_0x39960b,_0x220123[_0x0298('0x45')]);return _0x4d62cd[_0x0298('0x63')](_0x39960b);}})['then'](function(_0x202594){if(_0x202594){_0x31acaa=_0x202594[_0x0298('0x3a')];if(!_0x220123['query'][_0x0298('0x3b')](_0x0298('0x3c'))){_0x39960b[_0x0298('0x21')]=qs[_0x0298('0x21')](_0x220123['query'][_0x0298('0x21')]);_0x39960b[_0x0298('0x20')]=qs[_0x0298('0x20')](_0x220123[_0x0298('0x35')][_0x0298('0x20')]);}return _0x4d62cd[_0x0298('0x63')](_0x39960b);}})['then'](function(_0x1eb2cb){if(_0x1eb2cb){return _0x1eb2cb?{'count':_0x31acaa,'rows':_0x1eb2cb}:null;}})[_0x0298('0x28')](respondWithResult(_0x284f90,null))[_0x0298('0x4a')](handleError(_0x284f90,null));};exports['addTeams']=function(_0x332191,_0x583ff9,_0x5cba28){var _0x54cefc=_0x332191[_0x0298('0x51')]['ids'];return db[_0x0298('0x65')][_0x0298('0x48')]({'where':{'id':_0x54cefc},'attributes':['id'],'include':[{'model':db[_0x0298('0x66')],'as':_0x0298('0x67'),'attributes':['id',_0x0298('0x2d'),_0x0298('0x68'),_0x0298('0x69'),'interface'],'raw':!![]}]})[_0x0298('0x28')](function(_0x102113){if(_0x102113){var _0x1aa3bd=_[_0x0298('0x6a')](_0x102113,function(_0x3b93d2){var _0x300a78=_0x3b93d2[_0x0298('0x29')]({'plain':!![]});return _0x300a78['Agents'];});return db[_0x0298('0x31')][_0x0298('0x4f')]({'where':{'id':_0x332191['params']['id']}})[_0x0298('0x28')](function(_0x3cc3bd){return db[_0x0298('0x6b')][_0x0298('0x6c')](function(_0xa9eee8){return _0x3cc3bd[_0x0298('0x6d')](_0x54cefc,{'transaction':_0xa9eee8})[_0x0298('0x28')](function(){return BPromise[_0x0298('0x6e')](_0x1aa3bd,function(_0x3f4ab3){return db['UserWhatsappQueue'][_0x0298('0x6f')]({'where':{'UserId':_0x3f4ab3['id'],'WhatsappQueueId':_0x332191[_0x0298('0x4c')]['id']},'transaction':_0xa9eee8});});})[_0x0298('0x28')](function(){_0x1aa3bd[_0x0298('0x70')](function(_0x34ab87){socket[_0x0298('0x71')]('userWhatsappQueue:save',{'UserId':_0x34ab87['id'],'WhatsappQueueId':_0x3cc3bd['id']});});});});});}})[_0x0298('0x28')](respondWithStatusCode(_0x583ff9,null))[_0x0298('0x4a')](handleError(_0x583ff9,null));};exports[_0x0298('0x72')]=function(_0x3a2387,_0x525010,_0x23d226){return db[_0x0298('0x65')][_0x0298('0x48')]({'where':{'id':_0x3a2387[_0x0298('0x35')][_0x0298('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0298('0x28')](handleEntityNotFound(_0x525010,null))[_0x0298('0x28')](function(_0x316064){var _0x5ee8ce=_['map'](_0x316064,'id');var _0x484145=[];var _0x1e5a27=[];var _0xf6fa3=squel[_0x0298('0x74')]();_0xf6fa3['field'](_0x0298('0x75'))['from']('team_has_whatsapp_queues','tq')[_0x0298('0x76')](_0x0298('0x77'),'ut',_0x0298('0x78'))['where'](_0x0298('0x79'),_0x3a2387[_0x0298('0x4c')]['id']);for(var _0x59ea13=0x0;_0x59ea13<_0x316064['length'];_0x59ea13+=0x1){let _0x1aa20e=_0x316064[_0x59ea13];for(var _0x5c58d1=0x0;_0x5c58d1<_0x1aa20e[_0x0298('0x67')][_0x0298('0x3a')];_0x5c58d1+=0x1){let _0x42f088=_0x1aa20e[_0x0298('0x67')][_0x5c58d1];var _0x399ac4=_0xf6fa3[_0x0298('0x7a')]();_0x399ac4['where'](_0x0298('0x7b'),_0x42f088['id']);_0x1e5a27['push'](db[_0x0298('0x6b')][_0x0298('0x35')](_0x399ac4[_0x0298('0x7c')](),{'type':db[_0x0298('0x6b')][_0x0298('0x7d')][_0x0298('0x7e')]})[_0x0298('0x28')](function(_0x426c45){if(_0x426c45['length']===0x1){return _0x42f088['id'];}else{var _0x2ad5cb=_[_0x0298('0x7f')](_[_0x0298('0x30')](_0x426c45,_0x0298('0x80')),function(_0x1b64fa){return _['includes'](_0x5ee8ce,_0x1b64fa);});if(_0x2ad5cb){return _0x42f088['id'];}}}));}}return BPromise[_0x0298('0x81')](_0x1e5a27)['then'](function(_0x393b98){_0x484145=_(_0x484145)[_0x0298('0x82')](_0x393b98)[_0x0298('0x83')]()[_0x0298('0x84')]();return db['WhatsappQueue'][_0x0298('0x4f')]({'where':{'id':_0x3a2387[_0x0298('0x4c')]['id']}})[_0x0298('0x28')](function(_0x42e529){return db[_0x0298('0x6b')][_0x0298('0x6c')](function(_0x300499){return _0x42e529['removeTeams'](_0x3a2387[_0x0298('0x35')][_0x0298('0x73')],{'transaction':_0x300499})[_0x0298('0x28')](function(){if(!_[_0x0298('0x85')](_0x484145)){return _0x42e529[_0x0298('0x86')](_0x484145,{'transaction':_0x300499});}})[_0x0298('0x28')](function(){_0x484145[_0x0298('0x70')](function(_0x24ef32){socket[_0x0298('0x71')](_0x0298('0x87'),{'UserId':_0x24ef32,'WhatsappQueueId':_0x42e529['id']});});});});});});})[_0x0298('0x28')](respondWithStatusCode(_0x525010,null))[_0x0298('0x4a')](handleError(_0x525010,null));};exports[_0x0298('0x88')]=function(_0x5bf488,_0x363fb3,_0x2d2ce1){return db[_0x0298('0x31')]['find']({'where':{'id':_0x5bf488[_0x0298('0x4c')]['id']}})[_0x0298('0x28')](handleEntityNotFound(_0x363fb3,null))[_0x0298('0x28')](function(_0x35461c){if(_0x35461c){return _0x35461c['addAgents'](_0x5bf488['body']['ids'],_[_0x0298('0x89')](_0x5bf488[_0x0298('0x51')],[_0x0298('0x73'),'id'])||{})[_0x0298('0x8a')](function(_0x4fae81){for(var _0x148d1d=0x0;_0x148d1d<_0x5bf488['body'][_0x0298('0x73')]['length'];_0x148d1d+=0x1){socket[_0x0298('0x71')]('userWhatsappQueue:save',{'UserId':_0x5bf488[_0x0298('0x51')]['ids'][_0x148d1d],'WhatsappQueueId':_0x5bf488[_0x0298('0x4c')]['id']});}return _0x4fae81;});}})['then'](respondWithResult(_0x363fb3,null))[_0x0298('0x4a')](handleError(_0x363fb3,null));};exports[_0x0298('0x86')]=function(_0x4d6eaa,_0x519c6b,_0x4305a2){return db[_0x0298('0x31')]['find']({'where':{'id':_0x4d6eaa[_0x0298('0x4c')]['id']}})['then'](handleEntityNotFound(_0x519c6b,null))[_0x0298('0x28')](function(_0x5d8ede){if(_0x5d8ede){return _0x5d8ede['removeAgents'](_0x4d6eaa[_0x0298('0x35')]['ids'])[_0x0298('0x28')](function(){if(_['isArray'](_0x4d6eaa[_0x0298('0x35')]['ids'])){for(var _0x1434fa=0x0;_0x1434fa<_0x4d6eaa[_0x0298('0x35')][_0x0298('0x73')][_0x0298('0x3a')];_0x1434fa+=0x1){socket[_0x0298('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x4d6eaa['query'][_0x0298('0x73')][_0x1434fa]),'WhatsappQueueId':Number(_0x4d6eaa[_0x0298('0x4c')]['id'])});}}else{socket[_0x0298('0x71')](_0x0298('0x87'),{'UserId':Number(_0x4d6eaa[_0x0298('0x35')][_0x0298('0x73')]),'WhatsappQueueId':Number(_0x4d6eaa['params']['id'])});}});}})[_0x0298('0x28')](respondWithStatusCode(_0x519c6b,null))[_0x0298('0x4a')](handleError(_0x519c6b,null));};exports[_0x0298('0x8b')]=function(_0x360615,_0x1d14e3,_0x203c67){var _0x27cf6f={};var _0x1ffbec={};var _0x23f339;var _0x195bbc;return db['WhatsappQueue'][_0x0298('0x64')]({'where':{'id':_0x360615[_0x0298('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d14e3,null))[_0x0298('0x28')](function(_0x2eb10b){if(_0x2eb10b){_0x23f339=_0x2eb10b;_0x1ffbec[_0x0298('0x34')]=_['keys'](db[_0x0298('0x66')][_0x0298('0x4d')]);_0x1ffbec[_0x0298('0x35')]=_[_0x0298('0x4e')](_0x360615[_0x0298('0x35')]);_0x1ffbec[_0x0298('0x36')]=_[_0x0298('0x38')](_0x1ffbec[_0x0298('0x34')],_0x1ffbec[_0x0298('0x35')]);_0x27cf6f[_0x0298('0x37')]=_[_0x0298('0x38')](_0x1ffbec[_0x0298('0x34')],qs[_0x0298('0x39')](_0x360615[_0x0298('0x35')][_0x0298('0x39')]));_0x27cf6f[_0x0298('0x37')]=_0x27cf6f[_0x0298('0x37')]['length']?_0x27cf6f[_0x0298('0x37')]:_0x1ffbec['model'];_0x27cf6f[_0x0298('0x3d')]=qs[_0x0298('0x3e')](_0x360615[_0x0298('0x35')][_0x0298('0x3e')]);_0x27cf6f[_0x0298('0x3f')]=qs[_0x0298('0x36')](_[_0x0298('0x40')](_0x360615[_0x0298('0x35')],_0x1ffbec['filters']));if(_0x360615[_0x0298('0x35')][_0x0298('0x41')]){_0x27cf6f['where']=_[_0x0298('0x42')](_0x27cf6f[_0x0298('0x3f')],{'$or':_[_0x0298('0x30')](_0x27cf6f[_0x0298('0x37')],function(_0x4c3f19){var _0x200c9f={};_0x200c9f[_0x4c3f19]={'$like':'%'+_0x360615['query'][_0x0298('0x41')]+'%'};return _0x200c9f;})});}_0x27cf6f=_[_0x0298('0x42')]({},_0x27cf6f,_0x360615[_0x0298('0x45')]);return _0x23f339[_0x0298('0x8b')](_0x27cf6f);}})[_0x0298('0x28')](function(_0x2b8305){if(_0x2b8305){_0x195bbc=_0x2b8305[_0x0298('0x3a')];if(!_0x360615[_0x0298('0x35')][_0x0298('0x3b')]('nolimit')){_0x27cf6f[_0x0298('0x21')]=qs[_0x0298('0x21')](_0x360615[_0x0298('0x35')]['limit']);_0x27cf6f[_0x0298('0x20')]=qs[_0x0298('0x20')](_0x360615[_0x0298('0x35')]['offset']);}return _0x23f339['getAgents'](_0x27cf6f);}})[_0x0298('0x28')](function(_0x1a0181){if(_0x1a0181){return _0x1a0181?{'count':_0x195bbc,'rows':_0x1a0181}:null;}})[_0x0298('0x28')](respondWithResult(_0x1d14e3,null))[_0x0298('0x4a')](handleError(_0x1d14e3,null));}; \ No newline at end of file +var _0x35c8=['omit','spread','userWhatsappQueue:save','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','get','WhatsappQueues','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','UserWhatsappQueue','sort','pick','User','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','each','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents'];(function(_0x32171a,_0x2d1d9c){var _0x4a9fbe=function(_0x332012){while(--_0x332012){_0x32171a['push'](_0x32171a['shift']());}};_0x4a9fbe(++_0x2d1d9c);}(_0x35c8,0x125));var _0x835c=function(_0x3978bf,_0x4196ac){_0x3978bf=_0x3978bf-0x0;var _0x32ceeb=_0x35c8[_0x3978bf];return _0x32ceeb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x835c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x835c('0x1'));var rp=require(_0x835c('0x2'));var moment=require(_0x835c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x835c('0x4'));var path=require('path');var sox=require(_0x835c('0x5'));var csv=require('to-csv');var ejs=require(_0x835c('0x6'));var fs=require('fs');var _=require(_0x835c('0x7'));var squel=require('squel');var crypto=require(_0x835c('0x8'));var jsforce=require(_0x835c('0x9'));var deskjs=require(_0x835c('0xa'));var toCsv=require(_0x835c('0xb'));var querystring=require('querystring');var Papa=require(_0x835c('0xc'));var Redis=require(_0x835c('0xd'));var authService=require(_0x835c('0xe'));var qs=require(_0x835c('0xf'));var as=require(_0x835c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x835c('0x11'))(_0x835c('0x12'));var utils=require(_0x835c('0x13'));var config=require('../../config/environment');var db=require(_0x835c('0x14'))['db'];config['redis']=_[_0x835c('0x15')](config[_0x835c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x835c('0x17'))(new Redis(config[_0x835c('0x16')]));require(_0x835c('0x18'))[_0x835c('0x19')](socket);function respondWithStatusCode(_0xb3eb58,_0x5afe91){_0x5afe91=_0x5afe91||0xcc;return function(_0x7b78ff){if(_0x7b78ff){return _0xb3eb58['sendStatus'](_0x5afe91);}return _0xb3eb58[_0x835c('0x1a')](_0x5afe91)[_0x835c('0x1b')]();};}function respondWithResult(_0x3614f3,_0x4987ae){_0x4987ae=_0x4987ae||0xc8;return function(_0x3b0c33){if(_0x3b0c33){return _0x3614f3[_0x835c('0x1a')](_0x4987ae)[_0x835c('0x1c')](_0x3b0c33);}};}function respondWithFilteredResult(_0x38c21b,_0x1a5ed0){return function(_0x18a107){if(_0x18a107){var _0x127c24=_0x18a107[_0x835c('0x1d')],_0x310053=_0x1a5ed0[_0x835c('0x1e')],_0x548fb5=_0x1a5ed0[_0x835c('0x1e')]+_0x1a5ed0['limit'],_0x376a2d;if(_0x548fb5>=_0x127c24){_0x548fb5=_0x127c24;_0x376a2d=0xc8;}else{_0x376a2d=0xce;}_0x38c21b[_0x835c('0x1a')](_0x376a2d);return _0x38c21b['set'](_0x835c('0x1f'),_0x310053+'-'+_0x548fb5+'/'+_0x127c24)[_0x835c('0x1c')](_0x18a107);}return null;};}function patchUpdates(_0x4d72ac){return function(_0x2e1872){try{jsonpatch[_0x835c('0x20')](_0x2e1872,_0x4d72ac,!![]);}catch(_0x1c1293){return BPromise[_0x835c('0x21')](_0x1c1293);}return _0x2e1872[_0x835c('0x22')]();};}function saveUpdates(_0x2816cd,_0x52236b){return function(_0x430ccd){if(_0x430ccd){return _0x430ccd['update'](_0x2816cd)['then'](function(_0x12dbc2){return _0x12dbc2;});}return null;};}function removeEntity(_0x5ab026,_0x4376c3){return function(_0x1b48da){if(_0x1b48da){return _0x1b48da[_0x835c('0x23')]()['then'](function(){var _0x5cac03=_0x1b48da[_0x835c('0x24')]({'plain':!![]});var _0x129df9=_0x835c('0x25');return db[_0x835c('0x26')]['destroy']({'where':{'type':_0x129df9,'resourceId':_0x5cac03['id']}})['then'](function(){return _0x1b48da;});})[_0x835c('0x27')](function(){_0x5ab026[_0x835c('0x1a')](0xcc)[_0x835c('0x1b')]();});}};}function handleEntityNotFound(_0x51c49a,_0xc74513){return function(_0x1acf10){if(!_0x1acf10){_0x51c49a[_0x835c('0x28')](0x194);}return _0x1acf10;};}function handleError(_0x98765c,_0x4b76be){_0x4b76be=_0x4b76be||0x1f4;return function(_0x52d732){logger[_0x835c('0x29')](_0x52d732[_0x835c('0x2a')]);if(_0x52d732[_0x835c('0x2b')]){delete _0x52d732[_0x835c('0x2b')];}_0x98765c['status'](_0x4b76be)[_0x835c('0x2c')](_0x52d732);};}exports[_0x835c('0x2d')]=function(_0x497f8c,_0x4e14d8){var _0x2cb7b8={},_0xc9c03={},_0x40cca9={'count':0x0,'rows':[]};var _0x1f040e=_[_0x835c('0x2e')](db[_0x835c('0x2f')][_0x835c('0x30')],function(_0x15fa74){return{'name':_0x15fa74['fieldName'],'type':_0x15fa74['type'][_0x835c('0x31')]};});_0xc9c03['model']=_[_0x835c('0x2e')](_0x1f040e,_0x835c('0x2b'));_0xc9c03['query']=_[_0x835c('0x32')](_0x497f8c[_0x835c('0x33')]);_0xc9c03['filters']=_[_0x835c('0x34')](_0xc9c03[_0x835c('0x35')],_0xc9c03['query']);_0x2cb7b8[_0x835c('0x36')]=_[_0x835c('0x34')](_0xc9c03[_0x835c('0x35')],qs[_0x835c('0x37')](_0x497f8c[_0x835c('0x33')][_0x835c('0x37')]));_0x2cb7b8[_0x835c('0x36')]=_0x2cb7b8[_0x835c('0x36')][_0x835c('0x38')]?_0x2cb7b8[_0x835c('0x36')]:_0xc9c03[_0x835c('0x35')];if(!_0x497f8c[_0x835c('0x33')][_0x835c('0x39')](_0x835c('0x3a'))){_0x2cb7b8['limit']=qs[_0x835c('0x3b')](_0x497f8c[_0x835c('0x33')][_0x835c('0x3b')]);_0x2cb7b8['offset']=qs[_0x835c('0x1e')](_0x497f8c[_0x835c('0x33')][_0x835c('0x1e')]);}_0x2cb7b8[_0x835c('0x3c')]=qs['sort'](_0x497f8c[_0x835c('0x33')]['sort']);_0x2cb7b8[_0x835c('0x3d')]=qs[_0x835c('0x3e')](_['pick'](_0x497f8c[_0x835c('0x33')],_0xc9c03[_0x835c('0x3e')]),_0x1f040e);if(_0x497f8c[_0x835c('0x33')][_0x835c('0x3f')]){_0x2cb7b8[_0x835c('0x3d')]=_[_0x835c('0x40')](_0x2cb7b8['where'],{'$or':_['map'](_0x1f040e,function(_0x3c530a){if(_0x3c530a[_0x835c('0x41')]!==_0x835c('0x42')){var _0x59842c={};_0x59842c[_0x3c530a[_0x835c('0x2b')]]={'$like':'%'+_0x497f8c['query'][_0x835c('0x3f')]+'%'};return _0x59842c;}})});}_0x2cb7b8=_[_0x835c('0x40')]({},_0x2cb7b8,_0x497f8c[_0x835c('0x43')]);var _0x3b874c={'where':_0x2cb7b8[_0x835c('0x3d')]};return db['WhatsappQueue'][_0x835c('0x1d')](_0x3b874c)[_0x835c('0x27')](function(_0x4133ad){_0x40cca9['count']=_0x4133ad;if(_0x497f8c[_0x835c('0x33')][_0x835c('0x44')]){_0x2cb7b8[_0x835c('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x835c('0x46')](_0x2cb7b8);})['then'](function(_0x1f9b41){_0x40cca9[_0x835c('0x47')]=_0x1f9b41;return _0x40cca9;})[_0x835c('0x27')](respondWithFilteredResult(_0x4e14d8,_0x2cb7b8))[_0x835c('0x48')](handleError(_0x4e14d8,null));};exports[_0x835c('0x49')]=function(_0x1060fc,_0x371fba){var _0x70e6d={'raw':!![],'where':{'id':_0x1060fc[_0x835c('0x4a')]['id']}},_0x3feb74={};_0x3feb74['model']=_[_0x835c('0x32')](db['WhatsappQueue']['rawAttributes']);_0x3feb74['query']=_[_0x835c('0x32')](_0x1060fc[_0x835c('0x33')]);_0x3feb74[_0x835c('0x3e')]=_[_0x835c('0x34')](_0x3feb74[_0x835c('0x35')],_0x3feb74[_0x835c('0x33')]);_0x70e6d[_0x835c('0x36')]=_['intersection'](_0x3feb74[_0x835c('0x35')],qs[_0x835c('0x37')](_0x1060fc[_0x835c('0x33')][_0x835c('0x37')]));_0x70e6d[_0x835c('0x36')]=_0x70e6d[_0x835c('0x36')][_0x835c('0x38')]?_0x70e6d[_0x835c('0x36')]:_0x3feb74[_0x835c('0x35')];if(_0x1060fc[_0x835c('0x33')][_0x835c('0x44')]){_0x70e6d[_0x835c('0x45')]=[{'all':!![]}];}_0x70e6d=_[_0x835c('0x40')]({},_0x70e6d,_0x1060fc[_0x835c('0x43')]);return db[_0x835c('0x2f')]['find'](_0x70e6d)['then'](handleEntityNotFound(_0x371fba,null))[_0x835c('0x27')](respondWithResult(_0x371fba,null))[_0x835c('0x48')](handleError(_0x371fba,null));};exports[_0x835c('0x4b')]=function(_0x55a4ec,_0x25658b){return db[_0x835c('0x2f')][_0x835c('0x4b')](_0x55a4ec[_0x835c('0x4c')],{})[_0x835c('0x27')](function(_0x186c8b){var _0x54a0bb=_0x55a4ec[_0x835c('0x4d')][_0x835c('0x24')]({'plain':!![]});if(!_0x54a0bb)throw new Error(_0x835c('0x4e'));if(_0x54a0bb[_0x835c('0x4f')]===_0x835c('0x4d')){var _0x26190c=_0x186c8b[_0x835c('0x24')]({'plain':!![]});var _0x4efd3a=_0x835c('0x25');return db[_0x835c('0x50')]['find']({'where':{'name':_0x4efd3a,'userProfileId':_0x54a0bb[_0x835c('0x51')]},'raw':!![]})[_0x835c('0x27')](function(_0x489539){if(_0x489539&&_0x489539[_0x835c('0x52')]===0x0){return db[_0x835c('0x26')][_0x835c('0x4b')]({'name':_0x26190c[_0x835c('0x2b')],'resourceId':_0x26190c['id'],'type':_0x489539[_0x835c('0x2b')],'sectionId':_0x489539['id']},{})[_0x835c('0x27')](function(){return _0x186c8b;});}else{return _0x186c8b;}})['catch'](function(_0x4bafdb){logger['error'](_0x835c('0x53'),_0x4bafdb);throw _0x4bafdb;});}return _0x186c8b;})[_0x835c('0x27')](respondWithResult(_0x25658b,0xc9))['catch'](handleError(_0x25658b,null));};exports[_0x835c('0x54')]=function(_0x5d8298,_0x67e11d){if(_0x5d8298[_0x835c('0x4c')]['id']){delete _0x5d8298['body']['id'];}return db[_0x835c('0x2f')][_0x835c('0x55')]({'where':{'id':_0x5d8298[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](handleEntityNotFound(_0x67e11d,null))[_0x835c('0x27')](saveUpdates(_0x5d8298[_0x835c('0x4c')],null))[_0x835c('0x27')](respondWithResult(_0x67e11d,null))[_0x835c('0x48')](handleError(_0x67e11d,null));};exports[_0x835c('0x23')]=function(_0x5c3e45,_0x341bee){return db[_0x835c('0x2f')][_0x835c('0x55')]({'where':{'id':_0x5c3e45[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](handleEntityNotFound(_0x341bee,null))['then'](removeEntity(_0x341bee,null))['catch'](handleError(_0x341bee,null));};exports[_0x835c('0x56')]=function(_0x2511dc,_0x3bef0a){return db['WhatsappQueue'][_0x835c('0x56')]()[_0x835c('0x27')](respondWithResult(_0x3bef0a,null))[_0x835c('0x48')](handleError(_0x3bef0a,null));};exports[_0x835c('0x57')]=function(_0x718d88,_0x1d32fa,_0x5940e2){var _0x397213={'raw':!![],'where':{}},_0x1cfd11={},_0x1bc4be;return db[_0x835c('0x2f')]['findOne']({'where':{'id':_0x718d88[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](handleEntityNotFound(_0x1d32fa,null))[_0x835c('0x27')](function(_0x1b8dfa){if(_0x1b8dfa){_0x1bc4be=_0x1b8dfa[_0x835c('0x24')]({'plain':!![]});_0x1cfd11[_0x835c('0x35')]=_[_0x835c('0x32')](db[_0x835c('0x58')][_0x835c('0x30')]);_0x1cfd11[_0x835c('0x33')]=_[_0x835c('0x32')](_0x718d88[_0x835c('0x33')]);_0x1cfd11[_0x835c('0x3e')]=_[_0x835c('0x34')](_0x1cfd11['model'],_0x1cfd11[_0x835c('0x33')]);_0x397213[_0x835c('0x36')]=_[_0x835c('0x34')](_0x1cfd11[_0x835c('0x35')],qs[_0x835c('0x37')](_0x718d88[_0x835c('0x33')][_0x835c('0x37')]));_0x397213[_0x835c('0x36')]=_0x397213['attributes'][_0x835c('0x38')]?_0x397213[_0x835c('0x36')]:_0x1cfd11[_0x835c('0x35')];if(!_0x718d88[_0x835c('0x33')]['hasOwnProperty'](_0x835c('0x3a'))){_0x397213[_0x835c('0x3b')]=qs[_0x835c('0x3b')](_0x718d88['query'][_0x835c('0x3b')]);_0x397213['offset']=qs[_0x835c('0x1e')](_0x718d88[_0x835c('0x33')]['offset']);}_0x397213['order']=qs['sort'](_0x718d88[_0x835c('0x33')][_0x835c('0x59')]);_0x397213[_0x835c('0x3d')]=qs[_0x835c('0x3e')](_[_0x835c('0x5a')](_0x718d88[_0x835c('0x33')],_0x1cfd11['filters']));_0x397213[_0x835c('0x3d')]['WhatsappQueueId']=_0x1b8dfa['id'];if(_0x718d88[_0x835c('0x33')][_0x835c('0x3f')]){_0x397213[_0x835c('0x3d')]=_['merge'](_0x397213['where'],{'$or':_['map'](_0x397213['attributes'],function(_0x58036d){var _0x33c041={};_0x33c041[_0x58036d]={'$like':'%'+_0x718d88[_0x835c('0x33')][_0x835c('0x3f')]+'%'};return _0x33c041;})});}_0x397213=_[_0x835c('0x40')]({},_0x397213,_0x718d88['options']);return db[_0x835c('0x58')]['findAll'](_0x397213);}})[_0x835c('0x27')](function(_0x3b1408){if(_0x3b1408){return db[_0x835c('0x5b')]['findAndCountAll']({'where':{'id':_[_0x835c('0x2e')](_0x3b1408,_0x835c('0x5c')),'role':'agent'},'attributes':['id',_0x835c('0x2b'),_0x835c('0x5d'),_0x835c('0x5e'),_0x835c('0x5f')]});}})['then'](function(_0x396910){if(_0x396910){return{'count':_0x396910[_0x835c('0x1d')],'rows':_[_0x835c('0x2e')](_0x396910['rows'],function(_0x153602){return{'membername':_0x153602[_0x835c('0x2b')],'UserId':_0x153602['id'],'queue_name':_0x1bc4be[_0x835c('0x2b')],'WhatsappQueueId':_0x1bc4be['id'],'interface':util['format'](_0x835c('0x60'),_0x835c('0x61'),_0x153602[_0x835c('0x2b')]),'penalty':0x0,'paused':_0x153602[_0x835c('0x5d')],'createdAt':_0x153602[_0x835c('0x5f')],'updatedAt':_0x153602['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x835c('0x27')](respondWithFilteredResult(_0x1d32fa,_0x397213))['catch'](handleError(_0x1d32fa,null));};exports[_0x835c('0x62')]=function(_0x5bd136,_0x25624f,_0x2dcd0a){var _0xc84915={};var _0x51ca8b={};var _0x3cda95;var _0x422166;return db[_0x835c('0x2f')][_0x835c('0x63')]({'where':{'id':_0x5bd136[_0x835c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25624f,null))[_0x835c('0x27')](function(_0x3b05c0){if(_0x3b05c0){_0x3cda95=_0x3b05c0;_0x51ca8b[_0x835c('0x35')]=_['keys'](db['Team']['rawAttributes']);_0x51ca8b[_0x835c('0x33')]=_[_0x835c('0x32')](_0x5bd136[_0x835c('0x33')]);_0x51ca8b[_0x835c('0x3e')]=_[_0x835c('0x34')](_0x51ca8b[_0x835c('0x35')],_0x51ca8b[_0x835c('0x33')]);_0xc84915[_0x835c('0x36')]=_[_0x835c('0x34')](_0x51ca8b['model'],qs[_0x835c('0x37')](_0x5bd136[_0x835c('0x33')][_0x835c('0x37')]));_0xc84915['attributes']=_0xc84915[_0x835c('0x36')][_0x835c('0x38')]?_0xc84915[_0x835c('0x36')]:_0x51ca8b[_0x835c('0x35')];_0xc84915[_0x835c('0x3c')]=qs[_0x835c('0x59')](_0x5bd136[_0x835c('0x33')][_0x835c('0x59')]);_0xc84915['where']=qs['filters'](_[_0x835c('0x5a')](_0x5bd136[_0x835c('0x33')],_0x51ca8b[_0x835c('0x3e')]));if(_0x5bd136[_0x835c('0x33')][_0x835c('0x3f')]){_0xc84915[_0x835c('0x3d')]=_[_0x835c('0x40')](_0xc84915[_0x835c('0x3d')],{'$or':_['map'](_0xc84915['attributes'],function(_0x49b5b7){var _0x3c2bfc={};_0x3c2bfc[_0x49b5b7]={'$like':'%'+_0x5bd136[_0x835c('0x33')][_0x835c('0x3f')]+'%'};return _0x3c2bfc;})});}_0xc84915=_[_0x835c('0x40')]({},_0xc84915,_0x5bd136[_0x835c('0x43')]);return _0x3cda95[_0x835c('0x62')](_0xc84915);}})[_0x835c('0x27')](function(_0x171c9b){if(_0x171c9b){_0x422166=_0x171c9b[_0x835c('0x38')];if(!_0x5bd136[_0x835c('0x33')][_0x835c('0x39')]('nolimit')){_0xc84915[_0x835c('0x3b')]=qs[_0x835c('0x3b')](_0x5bd136['query'][_0x835c('0x3b')]);_0xc84915[_0x835c('0x1e')]=qs[_0x835c('0x1e')](_0x5bd136[_0x835c('0x33')][_0x835c('0x1e')]);}return _0x3cda95[_0x835c('0x62')](_0xc84915);}})[_0x835c('0x27')](function(_0x41cf5c){if(_0x41cf5c){return _0x41cf5c?{'count':_0x422166,'rows':_0x41cf5c}:null;}})[_0x835c('0x27')](respondWithResult(_0x25624f,null))[_0x835c('0x48')](handleError(_0x25624f,null));};exports[_0x835c('0x64')]=function(_0x1b1f8c,_0x378823,_0x309c39){var _0x28bd7e=_0x1b1f8c[_0x835c('0x4c')][_0x835c('0x65')];return db[_0x835c('0x66')][_0x835c('0x46')]({'where':{'id':_0x28bd7e},'attributes':['id'],'include':[{'model':db[_0x835c('0x5b')],'as':'Agents','attributes':['id',_0x835c('0x2b'),_0x835c('0x67'),_0x835c('0x68'),_0x835c('0x69')],'raw':!![]}]})['then'](function(_0x2ecb62){if(_0x2ecb62){var _0x44e9b3=_[_0x835c('0x6a')](_0x2ecb62,function(_0x150932){var _0x167c93=_0x150932[_0x835c('0x24')]({'plain':!![]});return _0x167c93[_0x835c('0x6b')];});return db[_0x835c('0x2f')]['find']({'where':{'id':_0x1b1f8c[_0x835c('0x4a')]['id']}})['then'](function(_0x11dbe5){return db['sequelize']['transaction'](function(_0x2ee9e9){return _0x11dbe5[_0x835c('0x64')](_0x28bd7e,{'transaction':_0x2ee9e9})[_0x835c('0x27')](function(){return BPromise[_0x835c('0x6c')](_0x44e9b3,function(_0x130c65){return db[_0x835c('0x58')][_0x835c('0x6d')]({'where':{'UserId':_0x130c65['id'],'WhatsappQueueId':_0x1b1f8c['params']['id']},'transaction':_0x2ee9e9});});})[_0x835c('0x27')](function(){_0x44e9b3[_0x835c('0x6e')](function(_0x1b561a){socket['emit']('userWhatsappQueue:save',{'UserId':_0x1b561a['id'],'WhatsappQueueId':_0x11dbe5['id']});});});});});}})[_0x835c('0x27')](respondWithStatusCode(_0x378823,null))[_0x835c('0x48')](handleError(_0x378823,null));};exports['removeTeams']=function(_0xd063a,_0x44cb7c,_0xc32650){return db[_0x835c('0x66')]['findAll']({'where':{'id':_0xd063a[_0x835c('0x33')][_0x835c('0x65')]},'attributes':['id'],'include':[{'model':db[_0x835c('0x5b')],'as':_0x835c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x835c('0x27')](handleEntityNotFound(_0x44cb7c,null))['then'](function(_0x5ead1c){var _0x2231e0=_[_0x835c('0x2e')](_0x5ead1c,'id');var _0x2c9237=[];var _0x433ab8=[];var _0x1a7e13=squel[_0x835c('0x6f')]();_0x1a7e13[_0x835c('0x70')](_0x835c('0x71'))[_0x835c('0x72')](_0x835c('0x73'),'tq')[_0x835c('0x74')](_0x835c('0x75'),'ut',_0x835c('0x76'))['where'](_0x835c('0x77'),_0xd063a[_0x835c('0x4a')]['id']);for(var _0x4cf4eb=0x0;_0x4cf4eb<_0x5ead1c['length'];_0x4cf4eb+=0x1){let _0x377523=_0x5ead1c[_0x4cf4eb];for(var _0x5801bc=0x0;_0x5801bc<_0x377523[_0x835c('0x6b')][_0x835c('0x38')];_0x5801bc+=0x1){let _0x3242df=_0x377523[_0x835c('0x6b')][_0x5801bc];var _0x4e70d6=_0x1a7e13[_0x835c('0x78')]();_0x4e70d6['where'](_0x835c('0x79'),_0x3242df['id']);_0x433ab8[_0x835c('0x7a')](db['sequelize'][_0x835c('0x33')](_0x4e70d6['toString'](),{'type':db[_0x835c('0x7b')]['QueryTypes'][_0x835c('0x7c')]})[_0x835c('0x27')](function(_0x101f43){if(_0x101f43[_0x835c('0x38')]===0x1){return _0x3242df['id'];}else{var _0x57b96f=_[_0x835c('0x7d')](_['map'](_0x101f43,_0x835c('0x7e')),function(_0x2a90d1){return _[_0x835c('0x7f')](_0x2231e0,_0x2a90d1);});if(_0x57b96f){return _0x3242df['id'];}}}));}}return BPromise[_0x835c('0x80')](_0x433ab8)['then'](function(_0x522971){_0x2c9237=_(_0x2c9237)[_0x835c('0x81')](_0x522971)[_0x835c('0x82')]()[_0x835c('0x83')]();return db[_0x835c('0x2f')][_0x835c('0x55')]({'where':{'id':_0xd063a[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](function(_0x3c33ad){return db['sequelize'][_0x835c('0x84')](function(_0x363981){return _0x3c33ad[_0x835c('0x85')](_0xd063a[_0x835c('0x33')][_0x835c('0x65')],{'transaction':_0x363981})[_0x835c('0x27')](function(){if(!_[_0x835c('0x86')](_0x2c9237)){return _0x3c33ad[_0x835c('0x87')](_0x2c9237,{'transaction':_0x363981});}})['then'](function(){_0x2c9237['forEach'](function(_0x593c55){socket[_0x835c('0x88')](_0x835c('0x89'),{'UserId':_0x593c55,'WhatsappQueueId':_0x3c33ad['id']});});});});});});})[_0x835c('0x27')](respondWithStatusCode(_0x44cb7c,null))[_0x835c('0x48')](handleError(_0x44cb7c,null));};exports['addAgents']=function(_0x201e3a,_0x223670,_0x502da5){return db['WhatsappQueue']['find']({'where':{'id':_0x201e3a[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](handleEntityNotFound(_0x223670,null))[_0x835c('0x27')](function(_0x32433f){if(_0x32433f){return _0x32433f[_0x835c('0x8a')](_0x201e3a[_0x835c('0x4c')][_0x835c('0x65')],_[_0x835c('0x8b')](_0x201e3a[_0x835c('0x4c')],[_0x835c('0x65'),'id'])||{})[_0x835c('0x8c')](function(_0x16c4fe){for(var _0x33bce4=0x0;_0x33bce4<_0x201e3a[_0x835c('0x4c')][_0x835c('0x65')][_0x835c('0x38')];_0x33bce4+=0x1){socket[_0x835c('0x88')](_0x835c('0x8d'),{'UserId':_0x201e3a[_0x835c('0x4c')][_0x835c('0x65')][_0x33bce4],'WhatsappQueueId':_0x201e3a[_0x835c('0x4a')]['id']});}return _0x16c4fe;});}})[_0x835c('0x27')](respondWithResult(_0x223670,null))[_0x835c('0x48')](handleError(_0x223670,null));};exports[_0x835c('0x87')]=function(_0x56496e,_0x529fb9,_0x4a27ec){return db['WhatsappQueue'][_0x835c('0x55')]({'where':{'id':_0x56496e[_0x835c('0x4a')]['id']}})[_0x835c('0x27')](handleEntityNotFound(_0x529fb9,null))['then'](function(_0x562012){if(_0x562012){return _0x562012['removeAgents'](_0x56496e['query'][_0x835c('0x65')])[_0x835c('0x27')](function(){if(_[_0x835c('0x8e')](_0x56496e[_0x835c('0x33')][_0x835c('0x65')])){for(var _0x5d8cb3=0x0;_0x5d8cb3<_0x56496e[_0x835c('0x33')]['ids']['length'];_0x5d8cb3+=0x1){socket['emit'](_0x835c('0x89'),{'UserId':Number(_0x56496e[_0x835c('0x33')][_0x835c('0x65')][_0x5d8cb3]),'WhatsappQueueId':Number(_0x56496e[_0x835c('0x4a')]['id'])});}}else{socket[_0x835c('0x88')]('userWhatsappQueue:remove',{'UserId':Number(_0x56496e[_0x835c('0x33')][_0x835c('0x65')]),'WhatsappQueueId':Number(_0x56496e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x529fb9,null))[_0x835c('0x48')](handleError(_0x529fb9,null));};exports[_0x835c('0x8f')]=function(_0x3791a2,_0x4c5452,_0x297d0e){var _0x22fc8a={};var _0x32b921={};var _0x2ea0b5;var _0x4fd147;return db[_0x835c('0x2f')]['findOne']({'where':{'id':_0x3791a2[_0x835c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c5452,null))[_0x835c('0x27')](function(_0x3cdb87){if(_0x3cdb87){_0x2ea0b5=_0x3cdb87;_0x32b921[_0x835c('0x35')]=_[_0x835c('0x32')](db[_0x835c('0x5b')][_0x835c('0x30')]);_0x32b921[_0x835c('0x33')]=_['keys'](_0x3791a2[_0x835c('0x33')]);_0x32b921[_0x835c('0x3e')]=_[_0x835c('0x34')](_0x32b921[_0x835c('0x35')],_0x32b921['query']);_0x22fc8a[_0x835c('0x36')]=_[_0x835c('0x34')](_0x32b921[_0x835c('0x35')],qs[_0x835c('0x37')](_0x3791a2['query'][_0x835c('0x37')]));_0x22fc8a['attributes']=_0x22fc8a['attributes']['length']?_0x22fc8a[_0x835c('0x36')]:_0x32b921[_0x835c('0x35')];_0x22fc8a['order']=qs[_0x835c('0x59')](_0x3791a2[_0x835c('0x33')][_0x835c('0x59')]);_0x22fc8a[_0x835c('0x3d')]=qs[_0x835c('0x3e')](_['pick'](_0x3791a2[_0x835c('0x33')],_0x32b921[_0x835c('0x3e')]));if(_0x3791a2['query'][_0x835c('0x3f')]){_0x22fc8a[_0x835c('0x3d')]=_['merge'](_0x22fc8a[_0x835c('0x3d')],{'$or':_['map'](_0x22fc8a['attributes'],function(_0x579293){var _0x3feae4={};_0x3feae4[_0x579293]={'$like':'%'+_0x3791a2['query']['filter']+'%'};return _0x3feae4;})});}_0x22fc8a=_[_0x835c('0x40')]({},_0x22fc8a,_0x3791a2['options']);return _0x2ea0b5['getAgents'](_0x22fc8a);}})[_0x835c('0x27')](function(_0x114949){if(_0x114949){_0x4fd147=_0x114949['length'];if(!_0x3791a2[_0x835c('0x33')]['hasOwnProperty'](_0x835c('0x3a'))){_0x22fc8a[_0x835c('0x3b')]=qs[_0x835c('0x3b')](_0x3791a2[_0x835c('0x33')]['limit']);_0x22fc8a[_0x835c('0x1e')]=qs[_0x835c('0x1e')](_0x3791a2[_0x835c('0x33')][_0x835c('0x1e')]);}return _0x2ea0b5[_0x835c('0x8f')](_0x22fc8a);}})['then'](function(_0x24b3aa){if(_0x24b3aa){return _0x24b3aa?{'count':_0x4fd147,'rows':_0x24b3aa}:null;}})[_0x835c('0x27')](respondWithResult(_0x4c5452,null))[_0x835c('0x48')](handleError(_0x4c5452,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 938d503..e42a920 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 _0x5f65=['events','setMaxListeners','save','emit','hook','exports'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0x5f65,0x1e0));var _0x55f6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5f65[_0x47a349];return _0x18ab75;};'use strict';var EventEmitter=require(_0x55f6('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x55f6('0x1')](0x0);var events={'afterCreate':_0x55f6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd4c406){return function(_0x45432a,_0x5c4ea7,_0x5547b5){WhatsappQueueEvents['emit'](_0xd4c406+':'+_0x45432a['id'],_0x45432a);WhatsappQueueEvents[_0x55f6('0x3')](_0xd4c406,_0x45432a);_0x5547b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x55f6('0x4')](e,emitEvent(event));}}module[_0x55f6('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb297=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x1f50df,_0x189959){var _0x3320bc=function(_0x3c3958){while(--_0x3c3958){_0x1f50df['push'](_0x1f50df['shift']());}};_0x3320bc(++_0x189959);}(_0xb297,0x1d0));var _0x7b29=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xb297[_0x3b7a0c];return _0x3bb70f;};'use strict';var EventEmitter=require(_0x7b29('0x0'));var WhatsappQueue=require(_0x7b29('0x1'))['db'][_0x7b29('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7b29('0x3')](0x0);var events={'afterCreate':_0x7b29('0x4'),'afterUpdate':_0x7b29('0x5'),'afterDestroy':'remove'};function emitEvent(_0x536c6b){return function(_0x30c8a1,_0x418103,_0x548ed2){WhatsappQueueEvents[_0x7b29('0x6')](_0x536c6b+':'+_0x30c8a1['id'],_0x30c8a1);WhatsappQueueEvents[_0x7b29('0x6')](_0x536c6b,_0x30c8a1);_0x548ed2(null);};}for(var e in events){if(events[_0x7b29('0x7')](e)){var event=events[e];WhatsappQueue[_0x7b29('0x8')](e,emitEvent(event));}}module[_0x7b29('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 3ea8e3f..8d96e85 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 _0xe128=['lodash','util','moment','path','./whatsappQueue.attributes','whatsapp_queues'];(function(_0x835976,_0x1e0c83){var _0x3e5914=function(_0x452566){while(--_0x452566){_0x835976['push'](_0x835976['shift']());}};_0x3e5914(++_0x1e0c83);}(_0xe128,0xa8));var _0x8e12=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xe128[_0x1db251];return _0x56685a;};'use strict';var _=require(_0x8e12('0x0'));var util=require(_0x8e12('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e12('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e12('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e12('0x4'));module['exports']=function(_0x2c15b7,_0xe2dd69){return _0x2c15b7['define']('WhatsappQueue',attributes,{'tableName':_0x8e12('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de4=['rimraf','./whatsappQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2100ab,_0x3af81d){var _0x2293d8=function(_0x450095){while(--_0x450095){_0x2100ab['push'](_0x2100ab['shift']());}};_0x2293d8(++_0x3af81d);}(_0x0de4,0xa9));var _0x40de=function(_0x2b6625,_0x3087b0){_0x2b6625=_0x2b6625-0x0;var _0x103372=_0x0de4[_0x2b6625];return _0x103372;};'use strict';var _=require(_0x40de('0x0'));var util=require(_0x40de('0x1'));var logger=require(_0x40de('0x2'))(_0x40de('0x3'));var moment=require(_0x40de('0x4'));var BPromise=require(_0x40de('0x5'));var rp=require(_0x40de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40de('0x7'));var config=require('../../config/environment');var attributes=require(_0x40de('0x8'));module[_0x40de('0x9')]=function(_0x17a4d6,_0x685710){return _0x17a4d6[_0x40de('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','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 3005c24..980c2d6 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 _0x4960=['defaults','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','limit','include','map','attributes','model','debug','stringify','find','where','ShowWhatsappQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x1751fb,_0x3f7254){var _0x508c24=function(_0x2ac66e){while(--_0x2ac66e){_0x1751fb['push'](_0x1751fb['shift']());}};_0x508c24(++_0x3f7254);}(_0x4960,0x1a7));var _0x0496=function(_0x5e3f0a,_0x539b4d){_0x5e3f0a=_0x5e3f0a-0x0;var _0x2b5920=_0x4960[_0x5e3f0a];return _0x2b5920;};'use strict';var _=require(_0x0496('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0496('0x1'));var rs=require(_0x0496('0x2'));var fs=require('fs');var Redis=require(_0x0496('0x3'));var db=require(_0x0496('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0496('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0496('0x6'));var client=jayson[_0x0496('0x7')][_0x0496('0x8')]({'port':0x232a});config['redis']=_[_0x0496('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x0496('0xa')](socket);function respondWithRpcPromise(_0x28a3c,_0x3bf70d,_0x4b372c){return new BPromise(function(_0x5483ea,_0x31f3a7){return client[_0x0496('0xb')](_0x28a3c,_0x4b372c)[_0x0496('0xc')](function(_0x4b4d2c){logger[_0x0496('0xd')](_0x0496('0xe'),_0x3bf70d,_0x0496('0xf'));logger['debug'](_0x0496('0x10'),_0x3bf70d,_0x0496('0xf'),JSON['stringify'](_0x4b4d2c));if(_0x4b4d2c[_0x0496('0x11')]){if(_0x4b4d2c[_0x0496('0x11')][_0x0496('0x12')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3bf70d,_0x4b4d2c['error']['message']);return _0x31f3a7(_0x4b4d2c[_0x0496('0x11')][_0x0496('0x13')]);}logger[_0x0496('0x11')](_0x0496('0xe'),_0x3bf70d,_0x4b4d2c[_0x0496('0x11')][_0x0496('0x13')]);return _0x5483ea(_0x4b4d2c[_0x0496('0x11')][_0x0496('0x13')]);}else{logger[_0x0496('0xd')](_0x0496('0xe'),_0x3bf70d,'request\x20sent');_0x5483ea(_0x4b4d2c[_0x0496('0x14')]['message']);}})['catch'](function(_0x335d5f){logger[_0x0496('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x3bf70d,_0x335d5f);_0x31f3a7(_0x335d5f);});});}exports[_0x0496('0x15')]=function(_0x2b02bd){var _0x28f3dd=this;return new Promise(function(_0x111831,_0x39e751){return db[_0x0496('0x16')][_0x0496('0x17')]({'raw':_0x2b02bd['options']?_0x2b02bd['options'][_0x0496('0x18')]===undefined?!![]:![]:!![],'where':_0x2b02bd['options']?_0x2b02bd[_0x0496('0x19')]['where']||null:null,'attributes':_0x2b02bd[_0x0496('0x19')]?_0x2b02bd[_0x0496('0x19')]['attributes']||null:null,'limit':_0x2b02bd[_0x0496('0x19')]?_0x2b02bd[_0x0496('0x19')][_0x0496('0x1a')]||null:null,'include':_0x2b02bd[_0x0496('0x19')]?_0x2b02bd['options'][_0x0496('0x1b')]?_['map'](_0x2b02bd[_0x0496('0x19')][_0x0496('0x1b')],function(_0x1b7779){return{'model':db[_0x1b7779['model']],'as':_0x1b7779['as'],'attributes':_0x1b7779['attributes'],'include':_0x1b7779['include']?_[_0x0496('0x1c')](_0x1b7779[_0x0496('0x1b')],function(_0x1960a7){return{'model':db[_0x1960a7['model']],'as':_0x1960a7['as'],'attributes':_0x1960a7[_0x0496('0x1d')],'include':_0x1960a7[_0x0496('0x1b')]?_[_0x0496('0x1c')](_0x1960a7['include'],function(_0x87770d){return{'model':db[_0x87770d[_0x0496('0x1e')]],'as':_0x87770d['as'],'attributes':_0x87770d[_0x0496('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0496('0xc')](function(_0x565bfb){logger[_0x0496('0xd')](_0x0496('0x15'),_0x2b02bd);logger[_0x0496('0x1f')](_0x0496('0x15'),_0x2b02bd,JSON[_0x0496('0x20')](_0x565bfb));_0x111831(_0x565bfb);})['catch'](function(_0x427d2e){logger[_0x0496('0x11')](_0x0496('0x15'),_0x427d2e[_0x0496('0x13')],_0x2b02bd);_0x39e751(_0x28f3dd[_0x0496('0x11')](0x1f4,_0x427d2e[_0x0496('0x13')]));});});};exports['ShowWhatsappQueue']=function(_0x44d039){var _0x21d8a6=this;return new Promise(function(_0x39ad7f,_0x900050){return db[_0x0496('0x16')][_0x0496('0x21')]({'raw':_0x44d039[_0x0496('0x19')]?_0x44d039[_0x0496('0x19')][_0x0496('0x18')]===undefined?!![]:![]:!![],'where':_0x44d039[_0x0496('0x19')]?_0x44d039[_0x0496('0x19')][_0x0496('0x22')]||null:null,'attributes':_0x44d039['options']?_0x44d039[_0x0496('0x19')][_0x0496('0x1d')]||null:null,'include':_0x44d039[_0x0496('0x19')]?_0x44d039[_0x0496('0x19')][_0x0496('0x1b')]?_['map'](_0x44d039[_0x0496('0x19')][_0x0496('0x1b')],function(_0x308ef1){return{'model':db[_0x308ef1[_0x0496('0x1e')]],'as':_0x308ef1['as'],'attributes':_0x308ef1[_0x0496('0x1d')],'include':_0x308ef1['include']?_['map'](_0x308ef1[_0x0496('0x1b')],function(_0x904e23){return{'model':db[_0x904e23['model']],'as':_0x904e23['as'],'attributes':_0x904e23[_0x0496('0x1d')],'include':_0x904e23[_0x0496('0x1b')]?_[_0x0496('0x1c')](_0x904e23[_0x0496('0x1b')],function(_0x31bd14){return{'model':db[_0x31bd14['model']],'as':_0x31bd14['as'],'attributes':_0x31bd14['attributes']};}):[]};}):[]};}):[]:[]})[_0x0496('0xc')](function(_0xd129d6){logger[_0x0496('0xd')](_0x0496('0x23'),_0x44d039);logger[_0x0496('0x1f')](_0x0496('0x23'),_0x44d039,JSON[_0x0496('0x20')](_0xd129d6));_0x39ad7f(_0xd129d6);})['catch'](function(_0x217630){logger[_0x0496('0x11')](_0x0496('0x23'),_0x217630[_0x0496('0x13')],_0x44d039);_0x900050(_0x21d8a6[_0x0496('0x11')](0x1f4,_0x217630[_0x0496('0x13')]));});});}; \ No newline at end of file +var _0xa8fa=['localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','map','include','model','info','debug','catch','find','raw','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8fa,0x195));var _0xaa8f=function(_0x199ae1,_0x229bab){_0x199ae1=_0x199ae1-0x0;var _0x5d0de7=_0xa8fa[_0x199ae1];return _0x5d0de7;};'use strict';var _=require(_0xaa8f('0x0'));var util=require(_0xaa8f('0x1'));var moment=require(_0xaa8f('0x2'));var BPromise=require(_0xaa8f('0x3'));var rs=require(_0xaa8f('0x4'));var fs=require('fs');var Redis=require(_0xaa8f('0x5'));var db=require(_0xaa8f('0x6'))['db'];var utils=require(_0xaa8f('0x7'));var logger=require(_0xaa8f('0x8'))(_0xaa8f('0x9'));var config=require(_0xaa8f('0xa'));var jayson=require(_0xaa8f('0xb'));var client=jayson[_0xaa8f('0xc')]['http']({'port':0x232a});config[_0xaa8f('0xd')]=_[_0xaa8f('0xe')](config['redis'],{'host':_0xaa8f('0xf'),'port':0x18eb});var socket=require(_0xaa8f('0x10'))(new Redis(config['redis']));require(_0xaa8f('0x11'))['register'](socket);function respondWithRpcPromise(_0x154c86,_0x29359b,_0x38c77c){return new BPromise(function(_0x56a5ea,_0x3e5262){return client[_0xaa8f('0x12')](_0x154c86,_0x38c77c)[_0xaa8f('0x13')](function(_0xfa46d8){logger['info'](_0xaa8f('0x14'),_0x29359b,_0xaa8f('0x15'));logger['debug'](_0xaa8f('0x16'),_0x29359b,'request\x20sent',JSON[_0xaa8f('0x17')](_0xfa46d8));if(_0xfa46d8[_0xaa8f('0x18')]){if(_0xfa46d8['error']['code']===0x1f4){logger[_0xaa8f('0x18')](_0xaa8f('0x14'),_0x29359b,_0xfa46d8[_0xaa8f('0x18')][_0xaa8f('0x19')]);return _0x3e5262(_0xfa46d8[_0xaa8f('0x18')][_0xaa8f('0x19')]);}logger['error'](_0xaa8f('0x14'),_0x29359b,_0xfa46d8[_0xaa8f('0x18')][_0xaa8f('0x19')]);return _0x56a5ea(_0xfa46d8[_0xaa8f('0x18')][_0xaa8f('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x29359b,_0xaa8f('0x15'));_0x56a5ea(_0xfa46d8[_0xaa8f('0x1a')][_0xaa8f('0x19')]);}})['catch'](function(_0x5bde16){logger[_0xaa8f('0x18')](_0xaa8f('0x14'),_0x29359b,_0x5bde16);_0x3e5262(_0x5bde16);});});}exports[_0xaa8f('0x1b')]=function(_0x293a98){var _0x15bec6=this;return new Promise(function(_0x39c990,_0x277e9b){return db[_0xaa8f('0x1c')]['findAll']({'raw':_0x293a98[_0xaa8f('0x1d')]?_0x293a98[_0xaa8f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x293a98['options']?_0x293a98[_0xaa8f('0x1d')][_0xaa8f('0x1e')]||null:null,'attributes':_0x293a98[_0xaa8f('0x1d')]?_0x293a98[_0xaa8f('0x1d')][_0xaa8f('0x1f')]||null:null,'limit':_0x293a98[_0xaa8f('0x1d')]?_0x293a98[_0xaa8f('0x1d')][_0xaa8f('0x20')]||null:null,'include':_0x293a98[_0xaa8f('0x1d')]?_0x293a98['options']['include']?_[_0xaa8f('0x21')](_0x293a98[_0xaa8f('0x1d')][_0xaa8f('0x22')],function(_0x4dde39){return{'model':db[_0x4dde39[_0xaa8f('0x23')]],'as':_0x4dde39['as'],'attributes':_0x4dde39['attributes'],'include':_0x4dde39[_0xaa8f('0x22')]?_[_0xaa8f('0x21')](_0x4dde39[_0xaa8f('0x22')],function(_0x110b54){return{'model':db[_0x110b54[_0xaa8f('0x23')]],'as':_0x110b54['as'],'attributes':_0x110b54[_0xaa8f('0x1f')],'include':_0x110b54[_0xaa8f('0x22')]?_[_0xaa8f('0x21')](_0x110b54['include'],function(_0x404970){return{'model':db[_0x404970[_0xaa8f('0x23')]],'as':_0x404970['as'],'attributes':_0x404970[_0xaa8f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3398){logger[_0xaa8f('0x24')](_0xaa8f('0x1b'),_0x293a98);logger[_0xaa8f('0x25')](_0xaa8f('0x1b'),_0x293a98,JSON[_0xaa8f('0x17')](_0x3d3398));_0x39c990(_0x3d3398);})[_0xaa8f('0x26')](function(_0x53ae0e){logger[_0xaa8f('0x18')](_0xaa8f('0x1b'),_0x53ae0e[_0xaa8f('0x19')],_0x293a98);_0x277e9b(_0x15bec6[_0xaa8f('0x18')](0x1f4,_0x53ae0e[_0xaa8f('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0xa042d7){var _0x3c7864=this;return new Promise(function(_0x483f01,_0x1305fd){return db['WhatsappQueue'][_0xaa8f('0x27')]({'raw':_0xa042d7[_0xaa8f('0x1d')]?_0xa042d7[_0xaa8f('0x1d')][_0xaa8f('0x28')]===undefined?!![]:![]:!![],'where':_0xa042d7[_0xaa8f('0x1d')]?_0xa042d7['options'][_0xaa8f('0x1e')]||null:null,'attributes':_0xa042d7['options']?_0xa042d7[_0xaa8f('0x1d')][_0xaa8f('0x1f')]||null:null,'include':_0xa042d7[_0xaa8f('0x1d')]?_0xa042d7['options'][_0xaa8f('0x22')]?_[_0xaa8f('0x21')](_0xa042d7[_0xaa8f('0x1d')][_0xaa8f('0x22')],function(_0x5329a6){return{'model':db[_0x5329a6['model']],'as':_0x5329a6['as'],'attributes':_0x5329a6[_0xaa8f('0x1f')],'include':_0x5329a6[_0xaa8f('0x22')]?_[_0xaa8f('0x21')](_0x5329a6[_0xaa8f('0x22')],function(_0x1ceb87){return{'model':db[_0x1ceb87[_0xaa8f('0x23')]],'as':_0x1ceb87['as'],'attributes':_0x1ceb87[_0xaa8f('0x1f')],'include':_0x1ceb87[_0xaa8f('0x22')]?_[_0xaa8f('0x21')](_0x1ceb87['include'],function(_0x2676aa){return{'model':db[_0x2676aa[_0xaa8f('0x23')]],'as':_0x2676aa['as'],'attributes':_0x2676aa[_0xaa8f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaa8f('0x13')](function(_0x766be6){logger[_0xaa8f('0x24')](_0xaa8f('0x29'),_0xa042d7);logger[_0xaa8f('0x25')](_0xaa8f('0x29'),_0xa042d7,JSON[_0xaa8f('0x17')](_0x766be6));_0x483f01(_0x766be6);})[_0xaa8f('0x26')](function(_0x55ac1d){logger['error']('ShowWhatsappQueue',_0x55ac1d[_0xaa8f('0x19')],_0xa042d7);_0x1305fd(_0x3c7864[_0xaa8f('0x18')](0x1f4,_0x55ac1d[_0xaa8f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a85d41d..ed506fa 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 _0x5aed=['remove','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x2532fc,_0xf8cd6){var _0x2a7bff=function(_0x4cfd80){while(--_0x4cfd80){_0x2532fc['push'](_0x2532fc['shift']());}};_0x2a7bff(++_0xf8cd6);}(_0x5aed,0x1e7));var _0xd5ae=function(_0x263b53,_0x1af43f){_0x263b53=_0x263b53-0x0;var _0x211d6e=_0x5aed[_0x263b53];return _0x211d6e;};'use strict';var WhatsappQueueEvents=require(_0xd5ae('0x0'));var events=['save',_0xd5ae('0x1'),_0xd5ae('0x2')];function createListener(_0x16b9e8,_0x13a7af){return function(_0x357ea5){_0x13a7af[_0xd5ae('0x3')](_0x16b9e8,_0x357ea5);};}function removeListener(_0x39a1e3,_0x451555){return function(){WhatsappQueueEvents[_0xd5ae('0x4')](_0x39a1e3,_0x451555);};}exports[_0xd5ae('0x5')]=function(_0x3b2cb9){for(var _0x4588ed=0x0,_0x82d382=events[_0xd5ae('0x6')];_0x4588ed<_0x82d382;_0x4588ed++){var _0x1ccdf7=events[_0x4588ed];var _0xbca1ea=createListener(_0xd5ae('0x7')+_0x1ccdf7,_0x3b2cb9);WhatsappQueueEvents['on'](_0x1ccdf7,_0xbca1ea);}}; \ No newline at end of file +var _0x002c=['removeListener','length','whatsappQueue:','remove','emit'];(function(_0x5ca0b3,_0x33f5ef){var _0x6ba806=function(_0x58b844){while(--_0x58b844){_0x5ca0b3['push'](_0x5ca0b3['shift']());}};_0x6ba806(++_0x33f5ef);}(_0x002c,0xe9));var _0xc002=function(_0x3dc14c,_0x45643e){_0x3dc14c=_0x3dc14c-0x0;var _0x5deccc=_0x002c[_0x3dc14c];return _0x5deccc;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xc002('0x0'),'update'];function createListener(_0x45fdd3,_0x1ca783){return function(_0x29c8d7){_0x1ca783[_0xc002('0x1')](_0x45fdd3,_0x29c8d7);};}function removeListener(_0x419836,_0xf406b0){return function(){WhatsappQueueEvents[_0xc002('0x2')](_0x419836,_0xf406b0);};}exports['register']=function(_0x552813){for(var _0x3cd52f=0x0,_0x4111da=events[_0xc002('0x3')];_0x3cd52f<_0x4111da;_0x3cd52f++){var _0x3794d9=events[_0x3cd52f];var _0x4d2040=createListener(_0xc002('0x4')+_0x3794d9,_0x552813);WhatsappQueueEvents['on'](_0x3794d9,_0x4d2040);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3090a5b..76bbc10 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 _0xa329=['delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put'];(function(_0x275c37,_0x54749a){var _0x5b3bf4=function(_0x2107d8){while(--_0x2107d8){_0x275c37['push'](_0x275c37['shift']());}};_0x5b3bf4(++_0x54749a);}(_0xa329,0x162));var _0x9a32=function(_0x368acc,_0x133420){_0x368acc=_0x368acc-0x0;var _0x502e88=_0xa329[_0x368acc];return _0x502e88;};'use strict';var multer=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var path=require('path');var timeout=require(_0x9a32('0x2'));var express=require('express');var router=express[_0x9a32('0x3')]();var auth=require(_0x9a32('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a32('0x5'));router[_0x9a32('0x6')]('/',auth[_0x9a32('0x7')](),controller[_0x9a32('0x8')]);router[_0x9a32('0x6')](_0x9a32('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x9a32('0xa'),auth[_0x9a32('0x7')](),controller['show']);router[_0x9a32('0xb')]('/',auth[_0x9a32('0x7')](),controller[_0x9a32('0xc')]);router[_0x9a32('0xd')](_0x9a32('0xa'),auth[_0x9a32('0x7')](),controller['update']);router[_0x9a32('0xe')](_0x9a32('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a32('0xf')]=router; \ No newline at end of file +var _0xdebe=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x2567f2,_0x2ba4ee){var _0x348305=function(_0xbb4ce7){while(--_0xbb4ce7){_0x2567f2['push'](_0x2567f2['shift']());}};_0x348305(++_0x2ba4ee);}(_0xdebe,0x142));var _0xedeb=function(_0x1d266d,_0x9ade81){_0x1d266d=_0x1d266d-0x0;var _0x3d26c6=_0xdebe[_0x1d266d];return _0x3d26c6;};'use strict';var multer=require(_0xedeb('0x0'));var util=require(_0xedeb('0x1'));var path=require(_0xedeb('0x2'));var timeout=require(_0xedeb('0x3'));var express=require('express');var router=express[_0xedeb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xedeb('0x5'));var config=require(_0xedeb('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xedeb('0x7')]('/',auth[_0xedeb('0x8')](),controller['index']);router['get']('/describe',auth[_0xedeb('0x8')](),controller[_0xedeb('0x9')]);router['get'](_0xedeb('0xa'),auth['isAuthenticated'](),controller[_0xedeb('0xb')]);router[_0xedeb('0xc')]('/',auth[_0xedeb('0x8')](),controller[_0xedeb('0xd')]);router[_0xedeb('0xe')]('/:id',auth[_0xedeb('0x8')](),controller[_0xedeb('0xf')]);router[_0xedeb('0x10')](_0xedeb('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xedeb('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e10463c..f0b1ae7 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 _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x51d242,_0x250dcd){var _0xf7466b=function(_0x3c4ff6){while(--_0x3c4ff6){_0x51d242['push'](_0x51d242['shift']());}};_0xf7466b(++_0x250dcd);}(_0x34e8,0x12c));var _0x834e=function(_0x56e6bb,_0x3c23a5){_0x56e6bb=_0x56e6bb-0x0;var _0x108ec9=_0x34e8[_0x56e6bb];return _0x108ec9;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x4c204f,_0x1c5374){var _0x1ed105=function(_0x446463){while(--_0x446463){_0x4c204f['push'](_0x4c204f['shift']());}};_0x1ed105(++_0x1c5374);}(_0x34e8,0x12c));var _0x834e=function(_0x40fb05,_0x3550f2){_0x40fb05=_0x40fb05-0x0;var _0x5043f0=_0x34e8[_0x40fb05];return _0x5043f0;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 50e80c6..3692b4b 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 _0xb470=['count','offset','set','Content-Range','reject','update','then','destroy','end','error','name','index','map','WhatsappQueueReport','rawAttributes','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','filter','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json'];(function(_0x1d6528,_0x1c20a3){var _0x3928df=function(_0x520799){while(--_0x520799){_0x1d6528['push'](_0x1d6528['shift']());}};_0x3928df(++_0x1c20a3);}(_0xb470,0x75));var _0x0b47=function(_0x56caba,_0x5879ec){_0x56caba=_0x56caba-0x0;var _0x1998df=_0xb470[_0x56caba];return _0x1998df;};'use strict';var pdf=require(_0x0b47('0x0'));var emlformat=require(_0x0b47('0x1'));var rimraf=require(_0x0b47('0x2'));var zipdir=require(_0x0b47('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b47('0x4'));var moment=require(_0x0b47('0x5'));var BPromise=require(_0x0b47('0x6'));var Mustache=require('mustache');var util=require(_0x0b47('0x7'));var path=require(_0x0b47('0x8'));var sox=require(_0x0b47('0x9'));var csv=require(_0x0b47('0xa'));var ejs=require(_0x0b47('0xb'));var fs=require('fs');var _=require(_0x0b47('0xc'));var squel=require(_0x0b47('0xd'));var crypto=require(_0x0b47('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b47('0xf'));var Redis=require(_0x0b47('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b47('0x11'));var as=require(_0x0b47('0x12'));var hardwareService=require(_0x0b47('0x13'));var logger=require(_0x0b47('0x14'))(_0x0b47('0x15'));var utils=require(_0x0b47('0x16'));var config=require(_0x0b47('0x17'));var db=require(_0x0b47('0x18'))['db'];function respondWithStatusCode(_0x58b8d,_0x3d8949){_0x3d8949=_0x3d8949||0xcc;return function(_0x53ce05){if(_0x53ce05){return _0x58b8d['sendStatus'](_0x3d8949);}return _0x58b8d[_0x0b47('0x19')](_0x3d8949)['end']();};}function respondWithResult(_0x1e58a5,_0x1e4988){_0x1e4988=_0x1e4988||0xc8;return function(_0x4d427b){if(_0x4d427b){return _0x1e58a5[_0x0b47('0x19')](_0x1e4988)[_0x0b47('0x1a')](_0x4d427b);}};}function respondWithFilteredResult(_0x2bb088,_0x379c9d){return function(_0x387084){if(_0x387084){var _0x1c5e68=_0x387084[_0x0b47('0x1b')],_0x1e9588=_0x379c9d['offset'],_0x1dc752=_0x379c9d[_0x0b47('0x1c')]+_0x379c9d['limit'],_0x130a13;if(_0x1dc752>=_0x1c5e68){_0x1dc752=_0x1c5e68;_0x130a13=0xc8;}else{_0x130a13=0xce;}_0x2bb088[_0x0b47('0x19')](_0x130a13);return _0x2bb088[_0x0b47('0x1d')](_0x0b47('0x1e'),_0x1e9588+'-'+_0x1dc752+'/'+_0x1c5e68)['json'](_0x387084);}return null;};}function patchUpdates(_0x5cf426){return function(_0x5aee61){try{jsonpatch['apply'](_0x5aee61,_0x5cf426,!![]);}catch(_0x257bca){return BPromise[_0x0b47('0x1f')](_0x257bca);}return _0x5aee61['save']();};}function saveUpdates(_0x3f1c9c,_0x501357){return function(_0x450f1a){if(_0x450f1a){return _0x450f1a[_0x0b47('0x20')](_0x3f1c9c)[_0x0b47('0x21')](function(_0x1b8f26){return _0x1b8f26;});}return null;};}function removeEntity(_0x13180b,_0x2c709c){return function(_0x3bd7f1){if(_0x3bd7f1){return _0x3bd7f1[_0x0b47('0x22')]()[_0x0b47('0x21')](function(){_0x13180b[_0x0b47('0x19')](0xcc)[_0x0b47('0x23')]();});}};}function handleEntityNotFound(_0x4f79d4,_0xc87cd){return function(_0x11935a){if(!_0x11935a){_0x4f79d4['sendStatus'](0x194);}return _0x11935a;};}function handleError(_0x32559d,_0x2a2287){_0x2a2287=_0x2a2287||0x1f4;return function(_0x27518e){logger[_0x0b47('0x24')](_0x27518e['stack']);if(_0x27518e['name']){delete _0x27518e[_0x0b47('0x25')];}_0x32559d[_0x0b47('0x19')](_0x2a2287)['send'](_0x27518e);};}exports[_0x0b47('0x26')]=function(_0x4509fc,_0x3f0ab4){var _0x195d5a={},_0x15db7d={},_0x1bfbd1={'count':0x0,'rows':[]};var _0x33a81a=_[_0x0b47('0x27')](db[_0x0b47('0x28')][_0x0b47('0x29')],function(_0x370022){return{'name':_0x370022['fieldName'],'type':_0x370022['type'][_0x0b47('0x2a')]};});_0x15db7d['model']=_[_0x0b47('0x27')](_0x33a81a,_0x0b47('0x25'));_0x15db7d[_0x0b47('0x2b')]=_[_0x0b47('0x2c')](_0x4509fc[_0x0b47('0x2b')]);_0x15db7d['filters']=_[_0x0b47('0x2d')](_0x15db7d[_0x0b47('0x2e')],_0x15db7d[_0x0b47('0x2b')]);_0x195d5a['attributes']=_[_0x0b47('0x2d')](_0x15db7d[_0x0b47('0x2e')],qs[_0x0b47('0x2f')](_0x4509fc[_0x0b47('0x2b')][_0x0b47('0x2f')]));_0x195d5a[_0x0b47('0x30')]=_0x195d5a['attributes']['length']?_0x195d5a[_0x0b47('0x30')]:_0x15db7d[_0x0b47('0x2e')];if(!_0x4509fc[_0x0b47('0x2b')][_0x0b47('0x31')](_0x0b47('0x32'))){_0x195d5a[_0x0b47('0x33')]=qs[_0x0b47('0x33')](_0x4509fc[_0x0b47('0x2b')][_0x0b47('0x33')]);_0x195d5a[_0x0b47('0x1c')]=qs[_0x0b47('0x1c')](_0x4509fc['query']['offset']);}_0x195d5a[_0x0b47('0x34')]=qs['sort'](_0x4509fc[_0x0b47('0x2b')][_0x0b47('0x35')]);_0x195d5a[_0x0b47('0x36')]=qs[_0x0b47('0x37')](_[_0x0b47('0x38')](_0x4509fc[_0x0b47('0x2b')],_0x15db7d['filters']),_0x33a81a);if(_0x4509fc['query']['filter']){_0x195d5a[_0x0b47('0x36')]=_[_0x0b47('0x39')](_0x195d5a[_0x0b47('0x36')],{'$or':_[_0x0b47('0x27')](_0x33a81a,function(_0x197706){if(_0x197706[_0x0b47('0x3a')]!=='VIRTUAL'){var _0x5cc21d={};_0x5cc21d[_0x197706[_0x0b47('0x25')]]={'$like':'%'+_0x4509fc[_0x0b47('0x2b')][_0x0b47('0x3b')]+'%'};return _0x5cc21d;}})});}_0x195d5a=_['merge']({},_0x195d5a,_0x4509fc['options']);var _0x4648d6={'where':_0x195d5a[_0x0b47('0x36')]};return db['WhatsappQueueReport'][_0x0b47('0x1b')](_0x4648d6)[_0x0b47('0x21')](function(_0xa332b7){_0x1bfbd1['count']=_0xa332b7;if(_0x4509fc['query'][_0x0b47('0x3c')]){_0x195d5a[_0x0b47('0x3d')]=[{'all':!![]}];}return db[_0x0b47('0x28')][_0x0b47('0x3e')](_0x195d5a);})[_0x0b47('0x21')](function(_0x1f6191){_0x1bfbd1[_0x0b47('0x3f')]=_0x1f6191;return _0x1bfbd1;})[_0x0b47('0x21')](respondWithFilteredResult(_0x3f0ab4,_0x195d5a))[_0x0b47('0x40')](handleError(_0x3f0ab4,null));};exports[_0x0b47('0x41')]=function(_0x381379,_0x9e721c){var _0x2bd25b={'raw':!![],'where':{'id':_0x381379['params']['id']}},_0x5ddd10={};_0x5ddd10[_0x0b47('0x2e')]=_['keys'](db[_0x0b47('0x28')]['rawAttributes']);_0x5ddd10[_0x0b47('0x2b')]=_[_0x0b47('0x2c')](_0x381379[_0x0b47('0x2b')]);_0x5ddd10[_0x0b47('0x37')]=_['intersection'](_0x5ddd10[_0x0b47('0x2e')],_0x5ddd10[_0x0b47('0x2b')]);_0x2bd25b['attributes']=_[_0x0b47('0x2d')](_0x5ddd10['model'],qs[_0x0b47('0x2f')](_0x381379[_0x0b47('0x2b')][_0x0b47('0x2f')]));_0x2bd25b[_0x0b47('0x30')]=_0x2bd25b[_0x0b47('0x30')][_0x0b47('0x42')]?_0x2bd25b[_0x0b47('0x30')]:_0x5ddd10[_0x0b47('0x2e')];if(_0x381379[_0x0b47('0x2b')][_0x0b47('0x3c')]){_0x2bd25b['include']=[{'all':!![]}];}_0x2bd25b=_['merge']({},_0x2bd25b,_0x381379['options']);return db['WhatsappQueueReport'][_0x0b47('0x43')](_0x2bd25b)[_0x0b47('0x21')](handleEntityNotFound(_0x9e721c,null))['then'](respondWithResult(_0x9e721c,null))[_0x0b47('0x40')](handleError(_0x9e721c,null));};exports['create']=function(_0x3e5b44,_0x3cd7d1){return db['WhatsappQueueReport'][_0x0b47('0x44')](_0x3e5b44[_0x0b47('0x45')],{})[_0x0b47('0x21')](respondWithResult(_0x3cd7d1,0xc9))[_0x0b47('0x40')](handleError(_0x3cd7d1,null));};exports['update']=function(_0x279665,_0x209363){if(_0x279665[_0x0b47('0x45')]['id']){delete _0x279665['body']['id'];}return db[_0x0b47('0x28')][_0x0b47('0x43')]({'where':{'id':_0x279665['params']['id']}})[_0x0b47('0x21')](handleEntityNotFound(_0x209363,null))['then'](saveUpdates(_0x279665['body'],null))[_0x0b47('0x21')](respondWithResult(_0x209363,null))[_0x0b47('0x40')](handleError(_0x209363,null));};exports['destroy']=function(_0x440c1b,_0x53cefe){return db[_0x0b47('0x28')][_0x0b47('0x43')]({'where':{'id':_0x440c1b[_0x0b47('0x46')]['id']}})['then'](handleEntityNotFound(_0x53cefe,null))['then'](removeEntity(_0x53cefe,null))[_0x0b47('0x40')](handleError(_0x53cefe,null));};exports[_0x0b47('0x47')]=function(_0x15a9fb,_0x13bdf4){return db[_0x0b47('0x28')][_0x0b47('0x47')]()[_0x0b47('0x21')](respondWithResult(_0x13bdf4,null))[_0x0b47('0x40')](handleError(_0x13bdf4,null));}; \ No newline at end of file +var _0xe785=['update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','sort','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','find','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','apply','reject','save'];(function(_0x574535,_0x9d7385){var _0xf5be8b=function(_0x416e9c){while(--_0x416e9c){_0x574535['push'](_0x574535['shift']());}};_0xf5be8b(++_0x9d7385);}(_0xe785,0x128));var _0x5e78=function(_0x2ce6fc,_0x468cf5){_0x2ce6fc=_0x2ce6fc-0x0;var _0x5a37b9=_0xe785[_0x2ce6fc];return _0x5a37b9;};'use strict';var pdf=require(_0x5e78('0x0'));var emlformat=require(_0x5e78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e78('0x2'));var jsonpatch=require(_0x5e78('0x3'));var rp=require(_0x5e78('0x4'));var moment=require(_0x5e78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e78('0x6'));var path=require(_0x5e78('0x7'));var sox=require(_0x5e78('0x8'));var csv=require(_0x5e78('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e78('0xa'));var crypto=require(_0x5e78('0xb'));var jsforce=require(_0x5e78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e78('0x9'));var querystring=require('querystring');var Papa=require(_0x5e78('0xd'));var Redis=require('ioredis');var authService=require(_0x5e78('0xe'));var qs=require(_0x5e78('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e78('0x10'));var logger=require(_0x5e78('0x11'))(_0x5e78('0x12'));var utils=require(_0x5e78('0x13'));var config=require(_0x5e78('0x14'));var db=require(_0x5e78('0x15'))['db'];function respondWithStatusCode(_0x6b8fb5,_0x53edaa){_0x53edaa=_0x53edaa||0xcc;return function(_0x46b082){if(_0x46b082){return _0x6b8fb5[_0x5e78('0x16')](_0x53edaa);}return _0x6b8fb5[_0x5e78('0x17')](_0x53edaa)['end']();};}function respondWithResult(_0x441b92,_0x2528ba){_0x2528ba=_0x2528ba||0xc8;return function(_0x9e71a4){if(_0x9e71a4){return _0x441b92[_0x5e78('0x17')](_0x2528ba)['json'](_0x9e71a4);}};}function respondWithFilteredResult(_0x4f125f,_0x60a88d){return function(_0x1e39e2){if(_0x1e39e2){var _0xc0786e=_0x1e39e2['count'],_0x399424=_0x60a88d[_0x5e78('0x18')],_0x154c7f=_0x60a88d[_0x5e78('0x18')]+_0x60a88d[_0x5e78('0x19')],_0x493adc;if(_0x154c7f>=_0xc0786e){_0x154c7f=_0xc0786e;_0x493adc=0xc8;}else{_0x493adc=0xce;}_0x4f125f['status'](_0x493adc);return _0x4f125f['set']('Content-Range',_0x399424+'-'+_0x154c7f+'/'+_0xc0786e)['json'](_0x1e39e2);}return null;};}function patchUpdates(_0x1aa2ab){return function(_0x37a13b){try{jsonpatch[_0x5e78('0x1a')](_0x37a13b,_0x1aa2ab,!![]);}catch(_0x385206){return BPromise[_0x5e78('0x1b')](_0x385206);}return _0x37a13b[_0x5e78('0x1c')]();};}function saveUpdates(_0x578a61,_0xa20b19){return function(_0x2b3f5e){if(_0x2b3f5e){return _0x2b3f5e[_0x5e78('0x1d')](_0x578a61)[_0x5e78('0x1e')](function(_0x41c9d8){return _0x41c9d8;});}return null;};}function removeEntity(_0x41e10b,_0xbab14d){return function(_0x39e685){if(_0x39e685){return _0x39e685['destroy']()[_0x5e78('0x1e')](function(){_0x41e10b[_0x5e78('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341429,_0x1e4e03){return function(_0x3e297e){if(!_0x3e297e){_0x341429[_0x5e78('0x16')](0x194);}return _0x3e297e;};}function handleError(_0x352536,_0x5075b5){_0x5075b5=_0x5075b5||0x1f4;return function(_0x3c21f9){logger[_0x5e78('0x1f')](_0x3c21f9[_0x5e78('0x20')]);if(_0x3c21f9[_0x5e78('0x21')]){delete _0x3c21f9[_0x5e78('0x21')];}_0x352536[_0x5e78('0x17')](_0x5075b5)[_0x5e78('0x22')](_0x3c21f9);};}exports[_0x5e78('0x23')]=function(_0x503ec3,_0x250618){var _0x2de40e={},_0x4b540c={},_0x58c726={'count':0x0,'rows':[]};var _0x4ff829=_['map'](db[_0x5e78('0x24')][_0x5e78('0x25')],function(_0x4872c5){return{'name':_0x4872c5[_0x5e78('0x26')],'type':_0x4872c5[_0x5e78('0x27')]['key']};});_0x4b540c[_0x5e78('0x28')]=_['map'](_0x4ff829,_0x5e78('0x21'));_0x4b540c[_0x5e78('0x29')]=_[_0x5e78('0x2a')](_0x503ec3[_0x5e78('0x29')]);_0x4b540c['filters']=_[_0x5e78('0x2b')](_0x4b540c['model'],_0x4b540c[_0x5e78('0x29')]);_0x2de40e['attributes']=_[_0x5e78('0x2b')](_0x4b540c[_0x5e78('0x28')],qs[_0x5e78('0x2c')](_0x503ec3['query'][_0x5e78('0x2c')]));_0x2de40e[_0x5e78('0x2d')]=_0x2de40e['attributes'][_0x5e78('0x2e')]?_0x2de40e['attributes']:_0x4b540c[_0x5e78('0x28')];if(!_0x503ec3[_0x5e78('0x29')]['hasOwnProperty'](_0x5e78('0x2f'))){_0x2de40e[_0x5e78('0x19')]=qs[_0x5e78('0x19')](_0x503ec3[_0x5e78('0x29')][_0x5e78('0x19')]);_0x2de40e[_0x5e78('0x18')]=qs[_0x5e78('0x18')](_0x503ec3[_0x5e78('0x29')][_0x5e78('0x18')]);}_0x2de40e['order']=qs[_0x5e78('0x30')](_0x503ec3['query'][_0x5e78('0x30')]);_0x2de40e['where']=qs[_0x5e78('0x31')](_['pick'](_0x503ec3[_0x5e78('0x29')],_0x4b540c[_0x5e78('0x31')]),_0x4ff829);if(_0x503ec3[_0x5e78('0x29')]['filter']){_0x2de40e[_0x5e78('0x32')]=_[_0x5e78('0x33')](_0x2de40e['where'],{'$or':_['map'](_0x4ff829,function(_0x8d252e){if(_0x8d252e[_0x5e78('0x27')]!==_0x5e78('0x34')){var _0xcb76d6={};_0xcb76d6[_0x8d252e[_0x5e78('0x21')]]={'$like':'%'+_0x503ec3[_0x5e78('0x29')][_0x5e78('0x35')]+'%'};return _0xcb76d6;}})});}_0x2de40e=_[_0x5e78('0x33')]({},_0x2de40e,_0x503ec3[_0x5e78('0x36')]);var _0x1761c5={'where':_0x2de40e[_0x5e78('0x32')]};return db['WhatsappQueueReport'][_0x5e78('0x37')](_0x1761c5)[_0x5e78('0x1e')](function(_0xed25cf){_0x58c726[_0x5e78('0x37')]=_0xed25cf;if(_0x503ec3['query'][_0x5e78('0x38')]){_0x2de40e[_0x5e78('0x39')]=[{'all':!![]}];}return db[_0x5e78('0x24')][_0x5e78('0x3a')](_0x2de40e);})[_0x5e78('0x1e')](function(_0x3f7aab){_0x58c726['rows']=_0x3f7aab;return _0x58c726;})[_0x5e78('0x1e')](respondWithFilteredResult(_0x250618,_0x2de40e))[_0x5e78('0x3b')](handleError(_0x250618,null));};exports[_0x5e78('0x3c')]=function(_0x17a806,_0x103243){var _0x4d1ed6={'raw':!![],'where':{'id':_0x17a806['params']['id']}},_0x3c3d79={};_0x3c3d79[_0x5e78('0x28')]=_[_0x5e78('0x2a')](db['WhatsappQueueReport'][_0x5e78('0x25')]);_0x3c3d79[_0x5e78('0x29')]=_['keys'](_0x17a806[_0x5e78('0x29')]);_0x3c3d79[_0x5e78('0x31')]=_[_0x5e78('0x2b')](_0x3c3d79['model'],_0x3c3d79[_0x5e78('0x29')]);_0x4d1ed6['attributes']=_[_0x5e78('0x2b')](_0x3c3d79[_0x5e78('0x28')],qs[_0x5e78('0x2c')](_0x17a806[_0x5e78('0x29')]['fields']));_0x4d1ed6[_0x5e78('0x2d')]=_0x4d1ed6[_0x5e78('0x2d')]['length']?_0x4d1ed6['attributes']:_0x3c3d79[_0x5e78('0x28')];if(_0x17a806[_0x5e78('0x29')][_0x5e78('0x38')]){_0x4d1ed6[_0x5e78('0x39')]=[{'all':!![]}];}_0x4d1ed6=_[_0x5e78('0x33')]({},_0x4d1ed6,_0x17a806['options']);return db[_0x5e78('0x24')][_0x5e78('0x3d')](_0x4d1ed6)[_0x5e78('0x1e')](handleEntityNotFound(_0x103243,null))[_0x5e78('0x1e')](respondWithResult(_0x103243,null))[_0x5e78('0x3b')](handleError(_0x103243,null));};exports['create']=function(_0x113011,_0x26c4ef){return db['WhatsappQueueReport']['create'](_0x113011['body'],{})[_0x5e78('0x1e')](respondWithResult(_0x26c4ef,0xc9))[_0x5e78('0x3b')](handleError(_0x26c4ef,null));};exports[_0x5e78('0x1d')]=function(_0x29bfc0,_0x284e46){if(_0x29bfc0['body']['id']){delete _0x29bfc0[_0x5e78('0x3e')]['id'];}return db[_0x5e78('0x24')][_0x5e78('0x3d')]({'where':{'id':_0x29bfc0['params']['id']}})[_0x5e78('0x1e')](handleEntityNotFound(_0x284e46,null))[_0x5e78('0x1e')](saveUpdates(_0x29bfc0[_0x5e78('0x3e')],null))[_0x5e78('0x1e')](respondWithResult(_0x284e46,null))[_0x5e78('0x3b')](handleError(_0x284e46,null));};exports['destroy']=function(_0xfb1088,_0x464811){return db['WhatsappQueueReport'][_0x5e78('0x3d')]({'where':{'id':_0xfb1088[_0x5e78('0x3f')]['id']}})[_0x5e78('0x1e')](handleEntityNotFound(_0x464811,null))[_0x5e78('0x1e')](removeEntity(_0x464811,null))[_0x5e78('0x3b')](handleError(_0x464811,null));};exports[_0x5e78('0x40')]=function(_0x420ae9,_0x3c77ab){return db[_0x5e78('0x24')][_0x5e78('0x40')]()['then'](respondWithResult(_0x3c77ab,null))[_0x5e78('0x3b')](handleError(_0x3c77ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index d4a9105..7b68df4 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 _0x627e=['path','rimraf','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x312389,_0x5a700b){var _0x3082ae=function(_0x587f4a){while(--_0x587f4a){_0x312389['push'](_0x312389['shift']());}};_0x3082ae(++_0x5a700b);}(_0x627e,0x14a));var _0xe627=function(_0x1dad5c,_0x1a8f4b){_0x1dad5c=_0x1dad5c-0x0;var _0xdb7e7=_0x627e[_0x1dad5c];return _0xdb7e7;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'paranoid':![],'indexes':[{'name':_0xe627('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x57e8=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4e897e,_0x5970fe){var _0x5d39cc=function(_0x260bb2){while(--_0x260bb2){_0x4e897e['push'](_0x4e897e['shift']());}};_0x5d39cc(++_0x5970fe);}(_0x57e8,0x17a));var _0x857e=function(_0x1a0dd6,_0x567ec3){_0x1a0dd6=_0x1a0dd6-0x0;var _0x2ec32c=_0x57e8[_0x1a0dd6];return _0x2ec32c;};'use strict';var _=require('lodash');var util=require(_0x857e('0x0'));var logger=require('../../config/logger')(_0x857e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x857e('0x2'));var fs=require('fs');var path=require(_0x857e('0x3'));var rimraf=require(_0x857e('0x4'));var config=require(_0x857e('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0x857e('0x6')]=function(_0xea8903,_0x1ec8d2){return _0xea8903[_0x857e('0x7')](_0x857e('0x8'),attributes,{'tableName':_0x857e('0x9'),'paranoid':![],'indexes':[{'name':_0x857e('0xa'),'fields':[_0x857e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4aa3100..f8b1e97 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 _0x7f70=['body','options','then','UpdateWhatsappQueueReport','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x1e83fb,_0x3cbe21){var _0x1107aa=function(_0x507984){while(--_0x507984){_0x1e83fb['push'](_0x1e83fb['shift']());}};_0x1107aa(++_0x3cbe21);}(_0x7f70,0x1a0));var _0x07f7=function(_0x34fc6e,_0x562f03){_0x34fc6e=_0x34fc6e-0x0;var _0x243a35=_0x7f70[_0x34fc6e];return _0x243a35;};'use strict';var _=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var moment=require(_0x07f7('0x2'));var BPromise=require(_0x07f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07f7('0x4'));var db=require(_0x07f7('0x5'))['db'];var utils=require(_0x07f7('0x6'));var logger=require('../../config/logger')(_0x07f7('0x7'));var config=require(_0x07f7('0x8'));var jayson=require(_0x07f7('0x9'));var client=jayson[_0x07f7('0xa')][_0x07f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ac929,_0x5cdbfb,_0x47e064){return new BPromise(function(_0x1ce3b7,_0x298500){return client[_0x07f7('0xc')](_0x5ac929,_0x47e064)['then'](function(_0x27bbee){logger[_0x07f7('0xd')](_0x07f7('0xe'),_0x5cdbfb,_0x07f7('0xf'));logger[_0x07f7('0x10')](_0x07f7('0x11'),_0x5cdbfb,_0x07f7('0xf'),JSON[_0x07f7('0x12')](_0x27bbee));if(_0x27bbee['error']){if(_0x27bbee[_0x07f7('0x13')][_0x07f7('0x14')]===0x1f4){logger[_0x07f7('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5cdbfb,_0x27bbee['error'][_0x07f7('0x15')]);return _0x298500(_0x27bbee['error'][_0x07f7('0x15')]);}logger[_0x07f7('0x13')](_0x07f7('0xe'),_0x5cdbfb,_0x27bbee[_0x07f7('0x13')][_0x07f7('0x15')]);return _0x1ce3b7(_0x27bbee[_0x07f7('0x13')][_0x07f7('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x5cdbfb,_0x07f7('0xf'));_0x1ce3b7(_0x27bbee['result'][_0x07f7('0x15')]);}})[_0x07f7('0x16')](function(_0x2e550e){logger[_0x07f7('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5cdbfb,_0x2e550e);_0x298500(_0x2e550e);});});}exports[_0x07f7('0x17')]=function(_0x20cd56){var _0x2c8f2b=this;return new Promise(function(_0x5ccaa9,_0x694f04){return db[_0x07f7('0x18')][_0x07f7('0x19')](_0x20cd56[_0x07f7('0x1a')],{'raw':_0x20cd56[_0x07f7('0x1b')]?_0x20cd56[_0x07f7('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x07f7('0x1c')](function(_0xc481c6){logger[_0x07f7('0xd')](_0x07f7('0x17'),_0x20cd56);logger[_0x07f7('0x10')](_0x07f7('0x17'),_0x20cd56,JSON[_0x07f7('0x12')](_0xc481c6));_0x5ccaa9(_0xc481c6);})[_0x07f7('0x16')](function(_0x5daa99){logger[_0x07f7('0x13')](_0x07f7('0x17'),_0x5daa99['message'],_0x20cd56);_0x694f04(_0x2c8f2b[_0x07f7('0x13')](0x1f4,_0x5daa99['message']));});});};exports[_0x07f7('0x1d')]=function(_0x53c7c5){var _0x1d8edd=this;return new Promise(function(_0x59bead,_0x2857e0){return db['WhatsappQueueReport']['update'](_0x53c7c5[_0x07f7('0x1a')],{'raw':_0x53c7c5['options']?_0x53c7c5['options'][_0x07f7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53c7c5[_0x07f7('0x1b')]?_0x53c7c5[_0x07f7('0x1b')][_0x07f7('0x1f')]||null:null,'attributes':_0x53c7c5[_0x07f7('0x1b')]?_0x53c7c5['options'][_0x07f7('0x20')]||null:null,'limit':_0x53c7c5['options']?_0x53c7c5[_0x07f7('0x1b')][_0x07f7('0x21')]||null:null})[_0x07f7('0x1c')](function(_0x2d3f7f){logger[_0x07f7('0xd')](_0x07f7('0x1d'),_0x53c7c5);logger['debug'](_0x07f7('0x1d'),_0x53c7c5,JSON[_0x07f7('0x12')](_0x2d3f7f));_0x59bead(_0x2d3f7f);})[_0x07f7('0x16')](function(_0x56fa27){logger['error']('UpdateWhatsappQueueReport',_0x56fa27[_0x07f7('0x15')],_0x53c7c5);_0x2857e0(_0x1d8edd[_0x07f7('0x13')](0x1f4,_0x56fa27[_0x07f7('0x15')]));});});}; \ No newline at end of file +var _0xa694=['info','request\x20sent','debug','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','update','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x4877f7,_0x2eab43){var _0xca30a8=function(_0x417a92){while(--_0x417a92){_0x4877f7['push'](_0x4877f7['shift']());}};_0xca30a8(++_0x2eab43);}(_0xa694,0x153));var _0x4a69=function(_0x31d918,_0xbb4dcf){_0x31d918=_0x31d918-0x0;var _0x14a917=_0xa694[_0x31d918];return _0x14a917;};'use strict';var _=require(_0x4a69('0x0'));var util=require('util');var moment=require(_0x4a69('0x1'));var BPromise=require(_0x4a69('0x2'));var rs=require(_0x4a69('0x3'));var fs=require('fs');var Redis=require(_0x4a69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a69('0x5'));var logger=require(_0x4a69('0x6'))(_0x4a69('0x7'));var config=require(_0x4a69('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a69('0x9')][_0x4a69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46bf58,_0x1c80bd,_0x1bda06){return new BPromise(function(_0x2cf777,_0x1ce957){return client[_0x4a69('0xb')](_0x46bf58,_0x1bda06)[_0x4a69('0xc')](function(_0x368c22){logger[_0x4a69('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1c80bd,_0x4a69('0xe'));logger[_0x4a69('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1c80bd,_0x4a69('0xe'),JSON['stringify'](_0x368c22));if(_0x368c22[_0x4a69('0x10')]){if(_0x368c22[_0x4a69('0x10')][_0x4a69('0x11')]===0x1f4){logger['error'](_0x4a69('0x12'),_0x1c80bd,_0x368c22[_0x4a69('0x10')][_0x4a69('0x13')]);return _0x1ce957(_0x368c22['error'][_0x4a69('0x13')]);}logger[_0x4a69('0x10')](_0x4a69('0x12'),_0x1c80bd,_0x368c22[_0x4a69('0x10')][_0x4a69('0x13')]);return _0x2cf777(_0x368c22['error'][_0x4a69('0x13')]);}else{logger[_0x4a69('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1c80bd,_0x4a69('0xe'));_0x2cf777(_0x368c22[_0x4a69('0x14')][_0x4a69('0x13')]);}})[_0x4a69('0x15')](function(_0x4136dc){logger[_0x4a69('0x10')](_0x4a69('0x12'),_0x1c80bd,_0x4136dc);_0x1ce957(_0x4136dc);});});}exports[_0x4a69('0x16')]=function(_0x31f51e){var _0x28824c=this;return new Promise(function(_0x3df39f,_0x3b83ca){return db[_0x4a69('0x17')][_0x4a69('0x18')](_0x31f51e[_0x4a69('0x19')],{'raw':_0x31f51e[_0x4a69('0x1a')]?_0x31f51e[_0x4a69('0x1a')][_0x4a69('0x1b')]===undefined?!![]:![]:!![]})[_0x4a69('0xc')](function(_0x309656){logger[_0x4a69('0xd')](_0x4a69('0x16'),_0x31f51e);logger[_0x4a69('0xf')](_0x4a69('0x16'),_0x31f51e,JSON[_0x4a69('0x1c')](_0x309656));_0x3df39f(_0x309656);})['catch'](function(_0x2f7085){logger['error'](_0x4a69('0x16'),_0x2f7085[_0x4a69('0x13')],_0x31f51e);_0x3b83ca(_0x28824c['error'](0x1f4,_0x2f7085[_0x4a69('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2c4676){var _0x33afc6=this;return new Promise(function(_0x1a130d,_0x3ddcec){return db[_0x4a69('0x17')][_0x4a69('0x1d')](_0x2c4676['body'],{'raw':_0x2c4676[_0x4a69('0x1a')]?_0x2c4676[_0x4a69('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c4676[_0x4a69('0x1a')]?_0x2c4676[_0x4a69('0x1a')]['where']||null:null,'attributes':_0x2c4676['options']?_0x2c4676[_0x4a69('0x1a')]['attributes']||null:null,'limit':_0x2c4676['options']?_0x2c4676[_0x4a69('0x1a')][_0x4a69('0x1e')]||null:null})[_0x4a69('0xc')](function(_0x436f08){logger[_0x4a69('0xd')](_0x4a69('0x1f'),_0x2c4676);logger[_0x4a69('0xf')](_0x4a69('0x1f'),_0x2c4676,JSON[_0x4a69('0x1c')](_0x436f08));_0x1a130d(_0x436f08);})[_0x4a69('0x15')](function(_0x51769f){logger[_0x4a69('0x10')](_0x4a69('0x1f'),_0x51769f[_0x4a69('0x13')],_0x2c4676);_0x3ddcec(_0x33afc6[_0x4a69('0x10')](0x1f4,_0x51769f[_0x4a69('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 467c134..bd6b018 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 _0x4405=['path','connect-timeout','express','./whatsappTransferReport.controller','get','describe','isAuthenticated','show','post','create','put','/:id','update','exports','multer','util'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x4405,0xce));var _0x5440=function(_0x5dd957,_0x15644f){_0x5dd957=_0x5dd957-0x0;var _0x1826e0=_0x4405[_0x5dd957];return _0x1826e0;};'use strict';var multer=require(_0x5440('0x0'));var util=require(_0x5440('0x1'));var path=require(_0x5440('0x2'));var timeout=require(_0x5440('0x3'));var express=require(_0x5440('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5440('0x5'));router[_0x5440('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5440('0x7')]);router[_0x5440('0x6')]('/:id',auth[_0x5440('0x8')](),controller[_0x5440('0x9')]);router[_0x5440('0xa')]('/',auth[_0x5440('0x8')](),controller[_0x5440('0xb')]);router[_0x5440('0xc')](_0x5440('0xd'),auth[_0x5440('0x8')](),controller[_0x5440('0xe')]);router['delete'](_0x5440('0xd'),auth[_0x5440('0x8')](),controller['destroy']);module[_0x5440('0xf')]=router; \ No newline at end of file +var _0xb7ea=['/:id','update','destroy','exports','util','path','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x13602c,_0x5eb241){var _0x255277=function(_0x77730f){while(--_0x77730f){_0x13602c['push'](_0x13602c['shift']());}};_0x255277(++_0x5eb241);}(_0xb7ea,0x6a));var _0xab7e=function(_0x5c1b05,_0x213768){_0x5c1b05=_0x5c1b05-0x0;var _0x1a65e7=_0xb7ea[_0x5c1b05];return _0x1a65e7;};'use strict';var multer=require('multer');var util=require(_0xab7e('0x0'));var path=require(_0xab7e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xab7e('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xab7e('0x3'));var controller=require(_0xab7e('0x4'));router[_0xab7e('0x5')]('/',auth[_0xab7e('0x6')](),controller[_0xab7e('0x7')]);router[_0xab7e('0x5')](_0xab7e('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xab7e('0x5')]('/:id',auth[_0xab7e('0x6')](),controller[_0xab7e('0x9')]);router[_0xab7e('0xa')]('/',auth[_0xab7e('0x6')](),controller[_0xab7e('0xb')]);router[_0xab7e('0xc')](_0xab7e('0xd'),auth[_0xab7e('0x6')](),controller[_0xab7e('0xe')]);router['delete'](_0xab7e('0xd'),auth['isAuthenticated'](),controller[_0xab7e('0xf')]);module[_0xab7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 0a0c6bc..c7678e7 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x3dcc1e,_0x8ade32){var _0x9def22=function(_0x38c314){while(--_0x38c314){_0x3dcc1e['push'](_0x3dcc1e['shift']());}};_0x9def22(++_0x8ade32);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0x0b0e[_0x23292a];return _0x4564f2;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7570e66..7205f5b 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 _0xf979=['count','offset','limit','set','Content-Range','json','apply','save','update','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','create','body','destroy','find','describe','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0xf979,0x1a9));var _0x9f97=function(_0x4ccd74,_0x47a3b0){_0x4ccd74=_0x4ccd74-0x0;var _0x444449=_0xf979[_0x4ccd74];return _0x444449;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f97('0x0'));var rimraf=require(_0x9f97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f97('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f97('0x3'));var Mustache=require('mustache');var util=require(_0x9f97('0x4'));var path=require('path');var sox=require(_0x9f97('0x5'));var csv=require(_0x9f97('0x6'));var ejs=require(_0x9f97('0x7'));var fs=require('fs');var _=require(_0x9f97('0x8'));var squel=require(_0x9f97('0x9'));var crypto=require(_0x9f97('0xa'));var jsforce=require(_0x9f97('0xb'));var deskjs=require(_0x9f97('0xc'));var toCsv=require(_0x9f97('0x6'));var querystring=require(_0x9f97('0xd'));var Papa=require(_0x9f97('0xe'));var Redis=require(_0x9f97('0xf'));var authService=require(_0x9f97('0x10'));var qs=require(_0x9f97('0x11'));var as=require(_0x9f97('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f97('0x13'))('api');var utils=require(_0x9f97('0x14'));var config=require(_0x9f97('0x15'));var db=require(_0x9f97('0x16'))['db'];function respondWithStatusCode(_0x123c79,_0x7f3449){_0x7f3449=_0x7f3449||0xcc;return function(_0x10bee0){if(_0x10bee0){return _0x123c79[_0x9f97('0x17')](_0x7f3449);}return _0x123c79['status'](_0x7f3449)['end']();};}function respondWithResult(_0x2e31ce,_0x53a826){_0x53a826=_0x53a826||0xc8;return function(_0x310ea0){if(_0x310ea0){return _0x2e31ce[_0x9f97('0x18')](_0x53a826)['json'](_0x310ea0);}};}function respondWithFilteredResult(_0x53f831,_0x40c30d){return function(_0x760a21){if(_0x760a21){var _0x273532=_0x760a21[_0x9f97('0x19')],_0x4f89d7=_0x40c30d[_0x9f97('0x1a')],_0x3dfe3d=_0x40c30d[_0x9f97('0x1a')]+_0x40c30d[_0x9f97('0x1b')],_0x37dcc7;if(_0x3dfe3d>=_0x273532){_0x3dfe3d=_0x273532;_0x37dcc7=0xc8;}else{_0x37dcc7=0xce;}_0x53f831[_0x9f97('0x18')](_0x37dcc7);return _0x53f831[_0x9f97('0x1c')](_0x9f97('0x1d'),_0x4f89d7+'-'+_0x3dfe3d+'/'+_0x273532)[_0x9f97('0x1e')](_0x760a21);}return null;};}function patchUpdates(_0x2f80ca){return function(_0x2c638d){try{jsonpatch[_0x9f97('0x1f')](_0x2c638d,_0x2f80ca,!![]);}catch(_0x2e0931){return BPromise['reject'](_0x2e0931);}return _0x2c638d[_0x9f97('0x20')]();};}function saveUpdates(_0x4400a8,_0xe949e9){return function(_0x51b7fc){if(_0x51b7fc){return _0x51b7fc[_0x9f97('0x21')](_0x4400a8)[_0x9f97('0x22')](function(_0xd24eb6){return _0xd24eb6;});}return null;};}function removeEntity(_0x33ff6d,_0x49ccee){return function(_0x58d0bc){if(_0x58d0bc){return _0x58d0bc['destroy']()['then'](function(){_0x33ff6d[_0x9f97('0x18')](0xcc)[_0x9f97('0x23')]();});}};}function handleEntityNotFound(_0x1b61cd,_0x3c3bd9){return function(_0x58596f){if(!_0x58596f){_0x1b61cd[_0x9f97('0x17')](0x194);}return _0x58596f;};}function handleError(_0x5bbc2a,_0x37c7f1){_0x37c7f1=_0x37c7f1||0x1f4;return function(_0x47a3ba){logger[_0x9f97('0x24')](_0x47a3ba[_0x9f97('0x25')]);if(_0x47a3ba[_0x9f97('0x26')]){delete _0x47a3ba[_0x9f97('0x26')];}_0x5bbc2a[_0x9f97('0x18')](_0x37c7f1)[_0x9f97('0x27')](_0x47a3ba);};}exports[_0x9f97('0x28')]=function(_0x15c8f4,_0x276003){var _0x2201a4={},_0x10ef1d={},_0x4761f0={'count':0x0,'rows':[]};var _0x1d7330=_[_0x9f97('0x29')](db[_0x9f97('0x2a')][_0x9f97('0x2b')],function(_0x4746c3){return{'name':_0x4746c3[_0x9f97('0x2c')],'type':_0x4746c3[_0x9f97('0x2d')][_0x9f97('0x2e')]};});_0x10ef1d[_0x9f97('0x2f')]=_['map'](_0x1d7330,'name');_0x10ef1d[_0x9f97('0x30')]=_[_0x9f97('0x31')](_0x15c8f4[_0x9f97('0x30')]);_0x10ef1d[_0x9f97('0x32')]=_[_0x9f97('0x33')](_0x10ef1d[_0x9f97('0x2f')],_0x10ef1d['query']);_0x2201a4['attributes']=_[_0x9f97('0x33')](_0x10ef1d['model'],qs['fields'](_0x15c8f4[_0x9f97('0x30')][_0x9f97('0x34')]));_0x2201a4[_0x9f97('0x35')]=_0x2201a4[_0x9f97('0x35')]['length']?_0x2201a4[_0x9f97('0x35')]:_0x10ef1d['model'];if(!_0x15c8f4['query'][_0x9f97('0x36')](_0x9f97('0x37'))){_0x2201a4['limit']=qs['limit'](_0x15c8f4[_0x9f97('0x30')][_0x9f97('0x1b')]);_0x2201a4[_0x9f97('0x1a')]=qs[_0x9f97('0x1a')](_0x15c8f4[_0x9f97('0x30')]['offset']);}_0x2201a4['order']=qs[_0x9f97('0x38')](_0x15c8f4[_0x9f97('0x30')][_0x9f97('0x38')]);_0x2201a4[_0x9f97('0x39')]=qs['filters'](_[_0x9f97('0x3a')](_0x15c8f4[_0x9f97('0x30')],_0x10ef1d[_0x9f97('0x32')]),_0x1d7330);if(_0x15c8f4[_0x9f97('0x30')][_0x9f97('0x3b')]){_0x2201a4['where']=_[_0x9f97('0x3c')](_0x2201a4[_0x9f97('0x39')],{'$or':_['map'](_0x1d7330,function(_0x103511){if(_0x103511[_0x9f97('0x2d')]!==_0x9f97('0x3d')){var _0x59bf7e={};_0x59bf7e[_0x103511[_0x9f97('0x26')]]={'$like':'%'+_0x15c8f4['query'][_0x9f97('0x3b')]+'%'};return _0x59bf7e;}})});}_0x2201a4=_[_0x9f97('0x3c')]({},_0x2201a4,_0x15c8f4['options']);var _0x4a5a34={'where':_0x2201a4[_0x9f97('0x39')]};return db[_0x9f97('0x2a')][_0x9f97('0x19')](_0x4a5a34)['then'](function(_0x4a01cc){_0x4761f0[_0x9f97('0x19')]=_0x4a01cc;if(_0x15c8f4[_0x9f97('0x30')][_0x9f97('0x3e')]){_0x2201a4[_0x9f97('0x3f')]=[{'all':!![]}];}return db[_0x9f97('0x2a')]['findAll'](_0x2201a4);})[_0x9f97('0x22')](function(_0x343206){_0x4761f0[_0x9f97('0x40')]=_0x343206;return _0x4761f0;})['then'](respondWithFilteredResult(_0x276003,_0x2201a4))[_0x9f97('0x41')](handleError(_0x276003,null));};exports[_0x9f97('0x42')]=function(_0x51227b,_0x5ca994){var _0x41759e={'raw':!![],'where':{'id':_0x51227b[_0x9f97('0x43')]['id']}},_0x5a6ad6={};_0x5a6ad6['model']=_['keys'](db[_0x9f97('0x2a')][_0x9f97('0x2b')]);_0x5a6ad6['query']=_[_0x9f97('0x31')](_0x51227b[_0x9f97('0x30')]);_0x5a6ad6[_0x9f97('0x32')]=_['intersection'](_0x5a6ad6[_0x9f97('0x2f')],_0x5a6ad6[_0x9f97('0x30')]);_0x41759e[_0x9f97('0x35')]=_['intersection'](_0x5a6ad6[_0x9f97('0x2f')],qs[_0x9f97('0x34')](_0x51227b[_0x9f97('0x30')][_0x9f97('0x34')]));_0x41759e[_0x9f97('0x35')]=_0x41759e[_0x9f97('0x35')][_0x9f97('0x44')]?_0x41759e['attributes']:_0x5a6ad6['model'];if(_0x51227b['query']['includeAll']){_0x41759e['include']=[{'all':!![]}];}_0x41759e=_['merge']({},_0x41759e,_0x51227b[_0x9f97('0x45')]);return db[_0x9f97('0x2a')]['find'](_0x41759e)['then'](handleEntityNotFound(_0x5ca994,null))[_0x9f97('0x22')](respondWithResult(_0x5ca994,null))[_0x9f97('0x41')](handleError(_0x5ca994,null));};exports['create']=function(_0x29456d,_0x3bbdf8){return db[_0x9f97('0x2a')][_0x9f97('0x46')](_0x29456d['body'],{})[_0x9f97('0x22')](respondWithResult(_0x3bbdf8,0xc9))[_0x9f97('0x41')](handleError(_0x3bbdf8,null));};exports[_0x9f97('0x21')]=function(_0x467961,_0x54b371){if(_0x467961[_0x9f97('0x47')]['id']){delete _0x467961[_0x9f97('0x47')]['id'];}return db[_0x9f97('0x2a')]['find']({'where':{'id':_0x467961['params']['id']}})['then'](handleEntityNotFound(_0x54b371,null))[_0x9f97('0x22')](saveUpdates(_0x467961['body'],null))[_0x9f97('0x22')](respondWithResult(_0x54b371,null))[_0x9f97('0x41')](handleError(_0x54b371,null));};exports[_0x9f97('0x48')]=function(_0x224771,_0x41b316){return db['WhatsappTransferReport'][_0x9f97('0x49')]({'where':{'id':_0x224771[_0x9f97('0x43')]['id']}})[_0x9f97('0x22')](handleEntityNotFound(_0x41b316,null))[_0x9f97('0x22')](removeEntity(_0x41b316,null))['catch'](handleError(_0x41b316,null));};exports[_0x9f97('0x4a')]=function(_0x4d84f2,_0x2b6630){return db[_0x9f97('0x2a')][_0x9f97('0x4a')]()[_0x9f97('0x22')](respondWithResult(_0x2b6630,null))['catch'](handleError(_0x2b6630,null));}; \ No newline at end of file +var _0xef40=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','fields','include','create','body','update','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xef40,0xd0));var _0x0ef4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xef40[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x0ef4('0x0'));var emlformat=require(_0x0ef4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0ef4('0x2'));var jsonpatch=require(_0x0ef4('0x3'));var rp=require(_0x0ef4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0ef4('0x5'));var util=require(_0x0ef4('0x6'));var path=require('path');var sox=require(_0x0ef4('0x7'));var csv=require('to-csv');var ejs=require(_0x0ef4('0x8'));var fs=require('fs');var _=require(_0x0ef4('0x9'));var squel=require('squel');var crypto=require(_0x0ef4('0xa'));var jsforce=require(_0x0ef4('0xb'));var deskjs=require(_0x0ef4('0xc'));var toCsv=require(_0x0ef4('0xd'));var querystring=require('querystring');var Papa=require(_0x0ef4('0xe'));var Redis=require('ioredis');var authService=require(_0x0ef4('0xf'));var qs=require(_0x0ef4('0x10'));var as=require(_0x0ef4('0x11'));var hardwareService=require(_0x0ef4('0x12'));var logger=require('../../config/logger')(_0x0ef4('0x13'));var utils=require(_0x0ef4('0x14'));var config=require(_0x0ef4('0x15'));var db=require(_0x0ef4('0x16'))['db'];function respondWithStatusCode(_0x2cd928,_0x491390){_0x491390=_0x491390||0xcc;return function(_0x43b535){if(_0x43b535){return _0x2cd928[_0x0ef4('0x17')](_0x491390);}return _0x2cd928['status'](_0x491390)[_0x0ef4('0x18')]();};}function respondWithResult(_0xffa437,_0x53a262){_0x53a262=_0x53a262||0xc8;return function(_0x3ce341){if(_0x3ce341){return _0xffa437[_0x0ef4('0x19')](_0x53a262)[_0x0ef4('0x1a')](_0x3ce341);}};}function respondWithFilteredResult(_0x436045,_0x25c8b0){return function(_0x996735){if(_0x996735){var _0x37187f=_0x996735[_0x0ef4('0x1b')],_0x5747bc=_0x25c8b0[_0x0ef4('0x1c')],_0x2d5739=_0x25c8b0[_0x0ef4('0x1c')]+_0x25c8b0[_0x0ef4('0x1d')],_0x2003e9;if(_0x2d5739>=_0x37187f){_0x2d5739=_0x37187f;_0x2003e9=0xc8;}else{_0x2003e9=0xce;}_0x436045[_0x0ef4('0x19')](_0x2003e9);return _0x436045[_0x0ef4('0x1e')]('Content-Range',_0x5747bc+'-'+_0x2d5739+'/'+_0x37187f)[_0x0ef4('0x1a')](_0x996735);}return null;};}function patchUpdates(_0x42448f){return function(_0x127a2a){try{jsonpatch[_0x0ef4('0x1f')](_0x127a2a,_0x42448f,!![]);}catch(_0x47cb21){return BPromise[_0x0ef4('0x20')](_0x47cb21);}return _0x127a2a[_0x0ef4('0x21')]();};}function saveUpdates(_0x3bca92,_0x2941f3){return function(_0xe91e91){if(_0xe91e91){return _0xe91e91['update'](_0x3bca92)[_0x0ef4('0x22')](function(_0x441d73){return _0x441d73;});}return null;};}function removeEntity(_0x3e0a9f,_0x51bab2){return function(_0x5d608c){if(_0x5d608c){return _0x5d608c[_0x0ef4('0x23')]()[_0x0ef4('0x22')](function(){_0x3e0a9f[_0x0ef4('0x19')](0xcc)[_0x0ef4('0x18')]();});}};}function handleEntityNotFound(_0x96df8c,_0x50c216){return function(_0x2f004e){if(!_0x2f004e){_0x96df8c[_0x0ef4('0x17')](0x194);}return _0x2f004e;};}function handleError(_0x9deed7,_0x1065a6){_0x1065a6=_0x1065a6||0x1f4;return function(_0x23f456){logger[_0x0ef4('0x24')](_0x23f456[_0x0ef4('0x25')]);if(_0x23f456['name']){delete _0x23f456[_0x0ef4('0x26')];}_0x9deed7['status'](_0x1065a6)['send'](_0x23f456);};}exports[_0x0ef4('0x27')]=function(_0x45f7f5,_0x4ffff3){var _0x595a33={},_0x240c29={},_0x97972b={'count':0x0,'rows':[]};var _0x384556=_[_0x0ef4('0x28')](db[_0x0ef4('0x29')][_0x0ef4('0x2a')],function(_0x53c915){return{'name':_0x53c915[_0x0ef4('0x2b')],'type':_0x53c915[_0x0ef4('0x2c')][_0x0ef4('0x2d')]};});_0x240c29[_0x0ef4('0x2e')]=_[_0x0ef4('0x28')](_0x384556,_0x0ef4('0x26'));_0x240c29[_0x0ef4('0x2f')]=_[_0x0ef4('0x30')](_0x45f7f5[_0x0ef4('0x2f')]);_0x240c29[_0x0ef4('0x31')]=_['intersection'](_0x240c29[_0x0ef4('0x2e')],_0x240c29['query']);_0x595a33[_0x0ef4('0x32')]=_['intersection'](_0x240c29['model'],qs['fields'](_0x45f7f5[_0x0ef4('0x2f')]['fields']));_0x595a33[_0x0ef4('0x32')]=_0x595a33[_0x0ef4('0x32')][_0x0ef4('0x33')]?_0x595a33[_0x0ef4('0x32')]:_0x240c29[_0x0ef4('0x2e')];if(!_0x45f7f5[_0x0ef4('0x2f')][_0x0ef4('0x34')](_0x0ef4('0x35'))){_0x595a33[_0x0ef4('0x1d')]=qs[_0x0ef4('0x1d')](_0x45f7f5[_0x0ef4('0x2f')]['limit']);_0x595a33[_0x0ef4('0x1c')]=qs['offset'](_0x45f7f5[_0x0ef4('0x2f')][_0x0ef4('0x1c')]);}_0x595a33[_0x0ef4('0x36')]=qs['sort'](_0x45f7f5['query']['sort']);_0x595a33[_0x0ef4('0x37')]=qs[_0x0ef4('0x31')](_[_0x0ef4('0x38')](_0x45f7f5[_0x0ef4('0x2f')],_0x240c29[_0x0ef4('0x31')]),_0x384556);if(_0x45f7f5[_0x0ef4('0x2f')][_0x0ef4('0x39')]){_0x595a33['where']=_[_0x0ef4('0x3a')](_0x595a33[_0x0ef4('0x37')],{'$or':_[_0x0ef4('0x28')](_0x384556,function(_0x2ac2a8){if(_0x2ac2a8[_0x0ef4('0x2c')]!=='VIRTUAL'){var _0x3982a8={};_0x3982a8[_0x2ac2a8['name']]={'$like':'%'+_0x45f7f5[_0x0ef4('0x2f')]['filter']+'%'};return _0x3982a8;}})});}_0x595a33=_[_0x0ef4('0x3a')]({},_0x595a33,_0x45f7f5[_0x0ef4('0x3b')]);var _0xe87554={'where':_0x595a33['where']};return db['WhatsappTransferReport']['count'](_0xe87554)[_0x0ef4('0x22')](function(_0x50b55f){_0x97972b[_0x0ef4('0x1b')]=_0x50b55f;if(_0x45f7f5[_0x0ef4('0x2f')][_0x0ef4('0x3c')]){_0x595a33['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x0ef4('0x3d')](_0x595a33);})['then'](function(_0x1f464e){_0x97972b[_0x0ef4('0x3e')]=_0x1f464e;return _0x97972b;})[_0x0ef4('0x22')](respondWithFilteredResult(_0x4ffff3,_0x595a33))[_0x0ef4('0x3f')](handleError(_0x4ffff3,null));};exports[_0x0ef4('0x40')]=function(_0x360430,_0x3e0d4c){var _0x3c28c6={'raw':!![],'where':{'id':_0x360430[_0x0ef4('0x41')]['id']}},_0x18886b={};_0x18886b['model']=_[_0x0ef4('0x30')](db[_0x0ef4('0x29')][_0x0ef4('0x2a')]);_0x18886b[_0x0ef4('0x2f')]=_[_0x0ef4('0x30')](_0x360430[_0x0ef4('0x2f')]);_0x18886b[_0x0ef4('0x31')]=_[_0x0ef4('0x42')](_0x18886b['model'],_0x18886b['query']);_0x3c28c6['attributes']=_['intersection'](_0x18886b[_0x0ef4('0x2e')],qs[_0x0ef4('0x43')](_0x360430[_0x0ef4('0x2f')]['fields']));_0x3c28c6[_0x0ef4('0x32')]=_0x3c28c6[_0x0ef4('0x32')][_0x0ef4('0x33')]?_0x3c28c6[_0x0ef4('0x32')]:_0x18886b['model'];if(_0x360430[_0x0ef4('0x2f')][_0x0ef4('0x3c')]){_0x3c28c6[_0x0ef4('0x44')]=[{'all':!![]}];}_0x3c28c6=_[_0x0ef4('0x3a')]({},_0x3c28c6,_0x360430['options']);return db[_0x0ef4('0x29')]['find'](_0x3c28c6)[_0x0ef4('0x22')](handleEntityNotFound(_0x3e0d4c,null))['then'](respondWithResult(_0x3e0d4c,null))[_0x0ef4('0x3f')](handleError(_0x3e0d4c,null));};exports[_0x0ef4('0x45')]=function(_0x14cf23,_0x34ca4e){return db[_0x0ef4('0x29')]['create'](_0x14cf23[_0x0ef4('0x46')],{})[_0x0ef4('0x22')](respondWithResult(_0x34ca4e,0xc9))[_0x0ef4('0x3f')](handleError(_0x34ca4e,null));};exports[_0x0ef4('0x47')]=function(_0x424e24,_0x37a3d9){if(_0x424e24[_0x0ef4('0x46')]['id']){delete _0x424e24['body']['id'];}return db[_0x0ef4('0x29')][_0x0ef4('0x48')]({'where':{'id':_0x424e24[_0x0ef4('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a3d9,null))[_0x0ef4('0x22')](saveUpdates(_0x424e24[_0x0ef4('0x46')],null))['then'](respondWithResult(_0x37a3d9,null))['catch'](handleError(_0x37a3d9,null));};exports['destroy']=function(_0x14098c,_0x35a6b7){return db['WhatsappTransferReport'][_0x0ef4('0x48')]({'where':{'id':_0x14098c[_0x0ef4('0x41')]['id']}})[_0x0ef4('0x22')](handleEntityNotFound(_0x35a6b7,null))['then'](removeEntity(_0x35a6b7,null))[_0x0ef4('0x3f')](handleError(_0x35a6b7,null));};exports[_0x0ef4('0x49')]=function(_0xeb8510,_0x4ed2a9){return db[_0x0ef4('0x29')]['describe']()[_0x0ef4('0x22')](respondWithResult(_0x4ed2a9,null))[_0x0ef4('0x3f')](handleError(_0x4ed2a9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a4e6f79..764918c 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 _0xf06f=['rimraf','define','WhatsappTransferReport','uniqueid','lodash','util','moment','bluebird','path'];(function(_0x3a1afe,_0x3a4322){var _0x3cb0ec=function(_0x4df467){while(--_0x4df467){_0x3a1afe['push'](_0x3a1afe['shift']());}};_0x3cb0ec(++_0x3a4322);}(_0xf06f,0x1c6));var _0xff06=function(_0x3a0a1c,_0x31e08b){_0x3a0a1c=_0x3a0a1c-0x0;var _0x13d3bb=_0xf06f[_0x3a0a1c];return _0x13d3bb;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff06('0x4'));var rimraf=require(_0xff06('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x1fded1,_0x31ea02){return _0x1fded1[_0xff06('0x6')](_0xff06('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xff06('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd916=['../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xbb3992,_0x2a8c74){var _0x2c499b=function(_0x3cf451){while(--_0x3cf451){_0xbb3992['push'](_0xbb3992['shift']());}};_0x2c499b(++_0x2a8c74);}(_0xd916,0xe3));var _0x6d91=function(_0x2f7892,_0x519d90){_0x2f7892=_0x2f7892-0x0;var _0x307d1c=_0xd916[_0x2f7892];return _0x307d1c;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var BPromise=require(_0x6d91('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d91('0x6'));var config=require(_0x6d91('0x7'));var attributes=require(_0x6d91('0x8'));module[_0x6d91('0x9')]=function(_0x52cf6a,_0x2a02e5){return _0x52cf6a['define'](_0x6d91('0xa'),attributes,{'tableName':_0x6d91('0xb'),'paranoid':![],'indexes':[{'name':_0x6d91('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 78b6d83..d08150c 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(_0x276c5c,_0x2f3cf9){var _0x441fb5=function(_0x331dd3){while(--_0x331dd3){_0x276c5c['push'](_0x276c5c['shift']());}};_0x441fb5(++_0x2f3cf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x4fb29a,_0x15ba28){var _0x15549d=function(_0x49d3bb){while(--_0x49d3bb){_0x4fb29a['push'](_0x4fb29a['shift']());}};_0x15549d(++_0x15ba28);}(_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);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 5c27c43..af1a70d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc00e=['./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/seedDB','./config/license','catch','./mysqldb'];(function(_0x2b819f,_0x18bc27){var _0xcc8d77=function(_0x31fb61){while(--_0x31fb61){_0x2b819f['push'](_0x2b819f['shift']());}};_0xcc8d77(++_0x18bc27);}(_0xc00e,0x15e));var _0xec00=function(_0x5cf914,_0x345d8b){_0x5cf914=_0x5cf914-0x0;var _0x4e31ff=_0xc00e[_0x5cf914];return _0x4e31ff;};'use strict';var _=require('lodash');var mysqldb=require(_0xec00('0x0'));var rpc=require(_0xec00('0x1'));var config=require(_0xec00('0x2'));var logger=require(_0xec00('0x3'))(_0xec00('0x4'));var pm2=require(_0xec00('0x5'));var pm2Config=require(_0xec00('0x6'));var schedule=require(_0xec00('0x7'));var chat=require(_0xec00('0x8'));var transcribe=require(_0xec00('0x9'));function main(){return mysqldb['db'][_0xec00('0xa')]['sync']()[_0xec00('0xb')](function(){return rpc['listen']();})[_0xec00('0xb')](function(_0x5a13ad){logger[_0xec00('0xc')](_0x5a13ad);return chat[_0xec00('0xd')]();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0xec00('0xd')]();})[_0xec00('0xb')](function(_0x1eada6){logger[_0xec00('0xc')](_0x1eada6);return pm2[_0xec00('0xd')](pm2Config);})[_0xec00('0xb')](function(_0x4e3f77){logger['info'](_0xec00('0xe'),_[_0xec00('0xf')](_['filter'](_0x4e3f77,{'status':_0xec00('0x10')}),_0xec00('0x11'))[_0xec00('0x12')]());logger[_0xec00('0xc')](_0xec00('0x13'),_[_0xec00('0xf')](_[_0xec00('0x14')](_0x4e3f77,function(_0x3350b9){return _0x3350b9[_0xec00('0x15')]!==_0xec00('0x10');}),_0xec00('0x11'))['join']()||_0xec00('0x16'));config[_0xec00('0x17')]&&require(_0xec00('0x18'))['default']();require(_0xec00('0x19'))['default']();})[_0xec00('0x1a')](function(_0x1b9e5b){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1b9e5b);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x622a=['seedDB','./config/seedDB','./config/license','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','map','filter','online','name','join','None'];(function(_0x5e6931,_0x247366){var _0x1b6bd7=function(_0x53e18b){while(--_0x53e18b){_0x5e6931['push'](_0x5e6931['shift']());}};_0x1b6bd7(++_0x247366);}(_0x622a,0x1bb));var _0xa622=function(_0x33b9bd,_0xd2bd45){_0x33b9bd=_0x33b9bd-0x0;var _0x5c996f=_0x622a[_0x33b9bd];return _0x5c996f;};'use strict';var _=require(_0xa622('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xa622('0x1'));var config=require(_0xa622('0x2'));var logger=require(_0xa622('0x3'))(_0xa622('0x4'));var pm2=require(_0xa622('0x5'));var pm2Config=require(_0xa622('0x6'));var schedule=require(_0xa622('0x7'));var chat=require(_0xa622('0x8'));var transcribe=require(_0xa622('0x9'));function main(){return mysqldb['db'][_0xa622('0xa')]['sync']()[_0xa622('0xb')](function(){return rpc[_0xa622('0xc')]();})[_0xa622('0xb')](function(_0x38bf30){logger[_0xa622('0xd')](_0x38bf30);return chat[_0xa622('0xe')]();})[_0xa622('0xb')](function(){return schedule[_0xa622('0xe')]();})[_0xa622('0xb')](function(){return transcribe['start']();})[_0xa622('0xb')](function(_0x2bb0ba){logger['info'](_0x2bb0ba);return pm2[_0xa622('0xe')](pm2Config);})[_0xa622('0xb')](function(_0x18c1aa){logger[_0xa622('0xd')]('Online\x20apps:',_[_0xa622('0xf')](_[_0xa622('0x10')](_0x18c1aa,{'status':_0xa622('0x11')}),_0xa622('0x12'))[_0xa622('0x13')]());logger[_0xa622('0xd')]('Offline\x20apps:',_[_0xa622('0xf')](_[_0xa622('0x10')](_0x18c1aa,function(_0x456322){return _0x456322['status']!==_0xa622('0x11');}),_0xa622('0x12'))[_0xa622('0x13')]()||_0xa622('0x14'));config[_0xa622('0x15')]&&require(_0xa622('0x16'))['default']();require(_0xa622('0x17'))[_0xa622('0x18')]();})[_0xa622('0x19')](function(_0x470cc1){logger[_0xa622('0x1a')](_0xa622('0x1b'),_0x470cc1);process[_0xa622('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 810a19f..093aece 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 _0xbd26=['lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','secrets','role','fullname','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','name','then','status','Wrong\x20credentials.','Bearer','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','session','payload','verify','randomBytes','hex','toString','HS512','../../mysqldb'];(function(_0x22577f,_0x495538){var _0x35c955=function(_0x171566){while(--_0x171566){_0x22577f['push'](_0x22577f['shift']());}};_0x35c955(++_0x495538);}(_0xbd26,0xbf));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x6bd2('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var _=require(_0x6bd2('0x1'));var jwt=require(_0x6bd2('0x2'));var expressJwt=require(_0x6bd2('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x6bd2('0x4'));var crypto=require(_0x6bd2('0x5'));var BPromise=require(_0x6bd2('0x6'));var validateJwt=expressJwt({'secret':config[_0x6bd2('0x7')]['session']});var userAttributes=['id',_0x6bd2('0x8'),_0x6bd2('0x9'),'name','internal',_0x6bd2('0xa'),_0x6bd2('0xb'),_0x6bd2('0xc'),_0x6bd2('0xd'),_0x6bd2('0xe'),_0x6bd2('0xf'),_0x6bd2('0x10'),'faxPause',_0x6bd2('0x11'),_0x6bd2('0x12'),'pauseType',_0x6bd2('0x13'),_0x6bd2('0x14'),'lastPauseAt','crudPermissions',_0x6bd2('0x15'),_0x6bd2('0x16'),'alias',_0x6bd2('0x17'),_0x6bd2('0x18'),'phoneBarDnd',_0x6bd2('0x19'),'phoneBarEnableDtmfTone',_0x6bd2('0x1a'),_0x6bd2('0x1b'),'phoneBarPrefixRequired',_0x6bd2('0x1c'),_0x6bd2('0x1d'),_0x6bd2('0x1e'),_0x6bd2('0x1f'),_0x6bd2('0x20')];exports[_0x6bd2('0x21')]=function(){return this[_0x6bd2('0x22')](!![])[_0x6bd2('0x23')](function(_0x8b7d8e,_0x5793ce,_0x46b56a){if(_0x8b7d8e[_0x6bd2('0x24')]){_0x46b56a();}else{return db[_0x6bd2('0x25')][_0x6bd2('0x26')]({'where':{'id':_0x8b7d8e[_0x6bd2('0x27')]['id']},'attributes':['id',_0x6bd2('0x28'),_0x6bd2('0x29')],'raw':!![]})['then'](function(_0x113cd7){if(_0x113cd7&&_0x113cd7[_0x6bd2('0x28')]){return _0x5793ce['status'](_0x113cd7['disposition']===_0x6bd2('0x2a')?0x195:0x193)[_0x6bd2('0x2b')]({'message':_0x113cd7[_0x6bd2('0x29')]===_0x6bd2('0x2a')?_0x6bd2('0x2c'):_0x6bd2('0x2d')});}else{_0x46b56a();}})[_0x6bd2('0x2e')](function(_0x4e7cac){_0x46b56a(_0x4e7cac);});}});};exports[_0x6bd2('0x22')]=function isAuthenticated(_0x261439){return compose()[_0x6bd2('0x23')](function(_0x4866e7,_0x57defd,_0x337ce8){if(_0x4866e7[_0x6bd2('0x2f')][_0x6bd2('0x30')]){if(_[_0x6bd2('0x31')](_0x4866e7[_0x6bd2('0x2f')][_0x6bd2('0x30')],_0x6bd2('0x32'))){var _0x44bd0a=basicAuth(_0x4866e7);db[_0x6bd2('0x33')][_0x6bd2('0x34')]({'where':{'name':_0x44bd0a[_0x6bd2('0x35')]}})[_0x6bd2('0x36')](function(_0x4b99d5){if(!_0x4b99d5||!_0x4b99d5['authenticate'](_0x44bd0a['pass'])){return _0x57defd[_0x6bd2('0x37')](0x191)[_0x6bd2('0x2b')]({'message':_0x6bd2('0x38')});}_0x4866e7[_0x6bd2('0x24')]={'id':_0x4b99d5['id']};_0x337ce8();})[_0x6bd2('0x2e')](function(_0x35dcaa){_0x337ce8(_0x35dcaa);});}else if(_[_0x6bd2('0x31')](_0x4866e7[_0x6bd2('0x2f')]['authorization'],_0x6bd2('0x39'))){validateJwt(_0x4866e7,_0x57defd,_0x337ce8);}else{if(_0x261439){_0x337ce8();}else{return _0x57defd['status'](0x193)[_0x6bd2('0x2b')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4866e7[_0x6bd2('0x3a')][_0x6bd2('0x3b')]){try{var _0xc4c565={'audience':hardwareConf[_0x6bd2('0x3c')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4866e7[_0x6bd2('0x3a')]['apikey'],_0xc4c565)['then'](function(_0x411f13){return db[_0x6bd2('0x33')]['find']({'where':{'id':_0x411f13[_0x6bd2('0x3d')]}})['then'](function(_0x1d7d19){if(!_0x1d7d19||!_[_0x6bd2('0x3e')](_0x1d7d19[_0x6bd2('0x3f')],_0x411f13[_0x6bd2('0x40')])){return _0x57defd['status'](0x191)['json']({'message':_0x6bd2('0x41')});}_0x4866e7['user']={'id':_0x1d7d19['id']};_0x337ce8();});})['catch'](function(){return _0x57defd[_0x6bd2('0x37')](0x191)[_0x6bd2('0x2b')]({'message':_0x6bd2('0x42')});});}catch(_0x4e3079){_0x337ce8(_0x4e3079);}}else if(_0x261439){_0x337ce8();}else{return _0x57defd[_0x6bd2('0x37')](0x193)[_0x6bd2('0x2b')]({'message':_0x6bd2('0x43')});}})[_0x6bd2('0x23')](function(_0x3a0278,_0x2eeff9,_0x5d6ebf){if(_0x3a0278[_0x6bd2('0x24')]){db['User'][_0x6bd2('0x34')]({'where':{'id':_0x3a0278['user']['id']},'attributes':userAttributes})[_0x6bd2('0x36')](function(_0x25dba7){if(!_0x25dba7){return _0x2eeff9[_0x6bd2('0x37')](0x194)['json']({'message':_0x6bd2('0x44')});}_0x3a0278[_0x6bd2('0x24')]=_0x25dba7;_0x5d6ebf();})[_0x6bd2('0x2e')](function(_0x33e70c){_0x5d6ebf(_0x33e70c);});}else if(_0x261439){_0x5d6ebf();}else{return _0x2eeff9[_0x6bd2('0x37')](0x194)[_0x6bd2('0x2b')]({'message':_0x6bd2('0x45')});}});};exports[_0x6bd2('0x46')]=function canUpdate(){return compose()['use'](function(_0x4d0cdd,_0x23e8c4,_0x6faee2){return require('../../config/license/util')['getLicense']()[_0x6bd2('0x36')](function(_0x3ef5d5){if(_0x3ef5d5[_0x6bd2('0x47')]){_0x6faee2();}else{return _0x23e8c4['status'](0x193)[_0x6bd2('0x2b')]({'message':'Forbidden'});}})['catch'](function(_0x507c18){_0x6faee2(_0x507c18);});});};exports[_0x6bd2('0x48')]=function(_0x1218f1,_0x2d0c18,_0x536fbb){_0x1218f1[_0x6bd2('0x48')]=!![];return _0x536fbb();};exports[_0x6bd2('0x49')]=function signToken(_0x1e8c5e){return signJwt(_0x1e8c5e);};exports[_0x6bd2('0x4a')]=function(_0x4e49a0,_0x205e50){if(!_0x4e49a0['user']){return _0x205e50['status'](0x194)[_0x6bd2('0x2b')]({'message':_0x6bd2('0x4b')});}var _0x4c6cc3={'payload':{'id':_0x4e49a0[_0x6bd2('0x24')]['id'],'role':_0x4e49a0[_0x6bd2('0x24')][_0x6bd2('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4c6cc3)[_0x6bd2('0x36')](function(_0x4f1fb1){_0x205e50[_0x6bd2('0x4c')](_0x6bd2('0x4d'),_0x4f1fb1);_0x205e50[_0x6bd2('0x4e')](_0x6bd2('0x4f'));})[_0x6bd2('0x2e')](function(_0x409e54){return _0x205e50[_0x6bd2('0x37')](0x1f4)['send'](_0x409e54);});};exports[_0x6bd2('0x50')]=function(_0x23d0ab){if(_[_0x6bd2('0x51')](_0x23d0ab[_0x6bd2('0x3f')])||_['isNil'](_0x23d0ab['apiKeyIat'])){return null;}else{return createJwt(_0x23d0ab);}};exports[_0x6bd2('0x52')]=function(_0x524a3c){_0x524a3c[_0x6bd2('0x3f')]=generateNonce();_0x524a3c[_0x6bd2('0x53')]=generateIssuedAt();return createJwt(_0x524a3c);};exports[_0x6bd2('0x54')]=function(_0xf8c1f2,_0x233847){var _0x439add=_0xf8c1f2[_0x6bd2('0x3a')]['apikey'];if(_0x439add){var _0x3608a9={'nonce':_0x233847[_0x6bd2('0x3f')],'iat':_0x233847[_0x6bd2('0x53')],'audience':hardwareConf[_0x6bd2('0x3c')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x439add,_0x3608a9)[_0x6bd2('0x36')](function(){return generateApiKey(_0x233847);});}else{throw{'message':_0x6bd2('0x55')};}};function signJwt(_0x3d7f65){var _0x11973e=BPromise[_0x6bd2('0x56')](jwt[_0x6bd2('0x57')],{'context':jwt});var _0x315df9=_0x3d7f65[_0x6bd2('0x58')]||config['secrets'][_0x6bd2('0x59')];return new BPromise(function(_0x15ed25,_0x1aa412){_0x11973e(_0x3d7f65[_0x6bd2('0x5a')],_0x315df9,_0x3d7f65['options'])[_0x6bd2('0x36')](function(_0x33e9d4){_0x15ed25(_0x33e9d4);})[_0x6bd2('0x2e')](function(_0x2acafc){_0x1aa412(_0x2acafc);});});}function verifyJwt(_0x486307,_0x52acdf,_0x22b1b8){var _0x1f1c56=BPromise[_0x6bd2('0x56')](jwt[_0x6bd2('0x5b')],{'context':jwt});var _0x34dae7=_0x22b1b8||config['secrets'][_0x6bd2('0x59')];return new BPromise(function(_0x5d8f40,_0x1e5705){_0x1f1c56(_0x486307,_0x34dae7,_0x52acdf)[_0x6bd2('0x36')](function(_0x606810){_0x5d8f40(_0x606810);})[_0x6bd2('0x2e')](function(_0x3504e8){_0x1e5705(_0x3504e8);});});}function generateNonce(){return crypto[_0x6bd2('0x5c')](0x10)['toString'](_0x6bd2('0x5d'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x6bd2('0x5e')]();}function createJwt(_0x1fd016){var _0x315e9b={'payload':{'iat':_0x1fd016[_0x6bd2('0x53')],'nonce':_0x1fd016[_0x6bd2('0x3f')]},'options':{'algorithm':_0x6bd2('0x5f'),'subject':_0x1fd016['id'][_0x6bd2('0x5e')](),'issuer':hardwareConf[_0x6bd2('0x3c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x315e9b)[_0x6bd2('0x36')](function(_0x58e91d){return{'iat':_0x1fd016[_0x6bd2('0x53')],'nonce':_0x1fd016[_0x6bd2('0x3f')],'token':_0x58e91d};});} \ No newline at end of file +var _0xe5f8=['apikey','getUuid','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','catch','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/hardware','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','email','userpic','md5secret','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','unmanaged','Unmanaged.','headers','authorization','startsWith','Basic','find','authenticate','pass','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query'];(function(_0x56f119,_0x140102){var _0xabaef6=function(_0x5ea94a){while(--_0x5ea94a){_0x56f119['push'](_0x56f119['shift']());}};_0xabaef6(++_0x140102);}(_0xe5f8,0x14f));var _0x8e5f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe5f8[_0x122ef9];return _0x42fba0;};'use strict';var db=require(_0x8e5f('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x8e5f('0x1'));var _=require('lodash');var jwt=require(_0x8e5f('0x2'));var expressJwt=require(_0x8e5f('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x8e5f('0x4'));var crypto=require(_0x8e5f('0x5'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x8e5f('0x6')][_0x8e5f('0x7')]});var userAttributes=['id',_0x8e5f('0x8'),_0x8e5f('0x9'),_0x8e5f('0xa'),_0x8e5f('0xb'),_0x8e5f('0xc'),_0x8e5f('0xd'),'permissions',_0x8e5f('0xe'),'voicePause',_0x8e5f('0xf'),_0x8e5f('0x10'),_0x8e5f('0x11'),'smsPause',_0x8e5f('0x12'),_0x8e5f('0x13'),_0x8e5f('0x14'),_0x8e5f('0x15'),_0x8e5f('0x16'),_0x8e5f('0x17'),_0x8e5f('0x18'),_0x8e5f('0x19'),_0x8e5f('0x1a'),_0x8e5f('0x1b'),_0x8e5f('0x1c'),_0x8e5f('0x1d'),_0x8e5f('0x1e'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x8e5f('0x1f'),'phoneBarPrefixRequired',_0x8e5f('0x20'),_0x8e5f('0x21'),_0x8e5f('0x22'),_0x8e5f('0x23'),_0x8e5f('0x24')];exports[_0x8e5f('0x25')]=function(){return this[_0x8e5f('0x26')](!![])[_0x8e5f('0x27')](function(_0x142096,_0x16faf7,_0x237cf9){if(_0x142096[_0x8e5f('0x28')]){_0x237cf9();}else{return db[_0x8e5f('0x29')]['findOne']({'where':{'id':_0x142096[_0x8e5f('0x2a')]['id']},'attributes':['id',_0x8e5f('0x2b'),_0x8e5f('0x2c')],'raw':!![]})[_0x8e5f('0x2d')](function(_0xf31747){if(_0xf31747&&_0xf31747[_0x8e5f('0x2b')]){return _0x16faf7['status'](_0xf31747['disposition']===_0x8e5f('0x2e')?0x195:0x193)['json']({'message':_0xf31747[_0x8e5f('0x2c')]===_0x8e5f('0x2e')?_0x8e5f('0x2f'):'Forbidden.'});}else{_0x237cf9();}})['catch'](function(_0x1fb7c0){_0x237cf9(_0x1fb7c0);});}});};exports['isAuthenticated']=function isAuthenticated(_0x57f699){return compose()[_0x8e5f('0x27')](function(_0x5b06e3,_0xb76efb,_0x3ac619){if(_0x5b06e3[_0x8e5f('0x30')][_0x8e5f('0x31')]){if(_[_0x8e5f('0x32')](_0x5b06e3[_0x8e5f('0x30')][_0x8e5f('0x31')],_0x8e5f('0x33'))){var _0x196990=basicAuth(_0x5b06e3);db['User'][_0x8e5f('0x34')]({'where':{'name':_0x196990['name']}})[_0x8e5f('0x2d')](function(_0x3219a7){if(!_0x3219a7||!_0x3219a7[_0x8e5f('0x35')](_0x196990[_0x8e5f('0x36')])){return _0xb76efb[_0x8e5f('0x37')](0x191)[_0x8e5f('0x38')]({'message':_0x8e5f('0x39')});}_0x5b06e3[_0x8e5f('0x28')]={'id':_0x3219a7['id']};_0x3ac619();})['catch'](function(_0x48eb6a){_0x3ac619(_0x48eb6a);});}else if(_[_0x8e5f('0x32')](_0x5b06e3[_0x8e5f('0x30')][_0x8e5f('0x31')],_0x8e5f('0x3a'))){validateJwt(_0x5b06e3,_0xb76efb,_0x3ac619);}else{if(_0x57f699){_0x3ac619();}else{return _0xb76efb[_0x8e5f('0x37')](0x193)[_0x8e5f('0x38')]({'message':_0x8e5f('0x3b')});}}}else if(_0x5b06e3[_0x8e5f('0x3c')][_0x8e5f('0x3d')]){try{var _0x4db007={'audience':hardwareConf[_0x8e5f('0x3e')](),'issuer':hardwareConf[_0x8e5f('0x3e')]()};verifyJwt(_0x5b06e3[_0x8e5f('0x3c')]['apikey'],_0x4db007)[_0x8e5f('0x2d')](function(_0x59870c){return db['User']['find']({'where':{'id':_0x59870c['sub']}})[_0x8e5f('0x2d')](function(_0x466b64){if(!_0x466b64||!_['isEqual'](_0x466b64['apiKeyNonce'],_0x59870c[_0x8e5f('0x3f')])){return _0xb76efb['status'](0x191)[_0x8e5f('0x38')]({'message':_0x8e5f('0x40')});}_0x5b06e3['user']={'id':_0x466b64['id']};_0x3ac619();});})['catch'](function(){return _0xb76efb[_0x8e5f('0x37')](0x191)['json']({'message':_0x8e5f('0x41')});});}catch(_0x2839c6){_0x3ac619(_0x2839c6);}}else if(_0x57f699){_0x3ac619();}else{return _0xb76efb[_0x8e5f('0x37')](0x193)[_0x8e5f('0x38')]({'message':_0x8e5f('0x3b')});}})[_0x8e5f('0x27')](function(_0x1df20d,_0x2eca40,_0x31939b){if(_0x1df20d[_0x8e5f('0x28')]){db[_0x8e5f('0x42')]['find']({'where':{'id':_0x1df20d['user']['id']},'attributes':userAttributes})[_0x8e5f('0x2d')](function(_0x5baa13){if(!_0x5baa13){return _0x2eca40[_0x8e5f('0x37')](0x194)[_0x8e5f('0x38')]({'message':_0x8e5f('0x43')});}_0x1df20d[_0x8e5f('0x28')]=_0x5baa13;_0x31939b();})['catch'](function(_0xf9008e){_0x31939b(_0xf9008e);});}else if(_0x57f699){_0x31939b();}else{return _0x2eca40[_0x8e5f('0x37')](0x194)[_0x8e5f('0x38')]({'message':_0x8e5f('0x44')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x8e5f('0x27')](function(_0x22899b,_0x37626d,_0x390844){return require(_0x8e5f('0x45'))[_0x8e5f('0x46')]()[_0x8e5f('0x2d')](function(_0x5ed988){if(_0x5ed988[_0x8e5f('0x47')]){_0x390844();}else{return _0x37626d['status'](0x193)[_0x8e5f('0x38')]({'message':_0x8e5f('0x48')});}})['catch'](function(_0x405271){_0x390844(_0x405271);});});};exports[_0x8e5f('0x49')]=function(_0x1e73d3,_0x1195e5,_0x695c7d){_0x1e73d3[_0x8e5f('0x49')]=!![];return _0x695c7d();};exports['signToken']=function signToken(_0x2ad4c2){return signJwt(_0x2ad4c2);};exports[_0x8e5f('0x4a')]=function(_0x7cabfe,_0x1af714){if(!_0x7cabfe[_0x8e5f('0x28')]){return _0x1af714[_0x8e5f('0x37')](0x194)[_0x8e5f('0x38')]({'message':_0x8e5f('0x4b')});}var _0x95e02e={'payload':{'id':_0x7cabfe[_0x8e5f('0x28')]['id'],'role':_0x7cabfe[_0x8e5f('0x28')][_0x8e5f('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x95e02e)[_0x8e5f('0x2d')](function(_0xbb9592){_0x1af714[_0x8e5f('0x4c')](_0x8e5f('0x4d'),_0xbb9592);_0x1af714[_0x8e5f('0x4e')](_0x8e5f('0x4f'));})[_0x8e5f('0x50')](function(_0x2ff028){return _0x1af714[_0x8e5f('0x37')](0x1f4)[_0x8e5f('0x51')](_0x2ff028);});};exports[_0x8e5f('0x52')]=function(_0x1012b8){if(_[_0x8e5f('0x53')](_0x1012b8[_0x8e5f('0x54')])||_[_0x8e5f('0x53')](_0x1012b8[_0x8e5f('0x55')])){return null;}else{return createJwt(_0x1012b8);}};exports[_0x8e5f('0x56')]=function(_0x1adda7){_0x1adda7[_0x8e5f('0x54')]=generateNonce();_0x1adda7[_0x8e5f('0x55')]=generateIssuedAt();return createJwt(_0x1adda7);};exports[_0x8e5f('0x57')]=function(_0x363c88,_0x5844a0){var _0x227e85=_0x363c88[_0x8e5f('0x3c')][_0x8e5f('0x3d')];if(_0x227e85){var _0x39b342={'nonce':_0x5844a0[_0x8e5f('0x54')],'iat':_0x5844a0[_0x8e5f('0x55')],'audience':hardwareConf[_0x8e5f('0x3e')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x227e85,_0x39b342)[_0x8e5f('0x2d')](function(){return generateApiKey(_0x5844a0);});}else{throw{'message':_0x8e5f('0x58')};}};function signJwt(_0x43d8a0){var _0x4f7865=BPromise[_0x8e5f('0x59')](jwt[_0x8e5f('0x5a')],{'context':jwt});var _0x40ef31=_0x43d8a0['secret']||config['secrets'][_0x8e5f('0x7')];return new BPromise(function(_0x344fbd,_0x30fbea){_0x4f7865(_0x43d8a0[_0x8e5f('0x5b')],_0x40ef31,_0x43d8a0[_0x8e5f('0x5c')])[_0x8e5f('0x2d')](function(_0x1801eb){_0x344fbd(_0x1801eb);})['catch'](function(_0x1e466f){_0x30fbea(_0x1e466f);});});}function verifyJwt(_0x2887e0,_0x326cd5,_0x5dd9f6){var _0x12f89d=BPromise[_0x8e5f('0x59')](jwt[_0x8e5f('0x5d')],{'context':jwt});var _0x24d9ce=_0x5dd9f6||config[_0x8e5f('0x6')]['session'];return new BPromise(function(_0x1c2928,_0x4fdf66){_0x12f89d(_0x2887e0,_0x24d9ce,_0x326cd5)['then'](function(_0x3d56be){_0x1c2928(_0x3d56be);})[_0x8e5f('0x50')](function(_0x32fdac){_0x4fdf66(_0x32fdac);});});}function generateNonce(){return crypto[_0x8e5f('0x5e')](0x10)[_0x8e5f('0x5f')]('hex');}function generateIssuedAt(){return Math[_0x8e5f('0x60')](Date[_0x8e5f('0x61')]()/0x3e8)[_0x8e5f('0x5f')]();}function createJwt(_0x493490){var _0x3e6ae7={'payload':{'iat':_0x493490[_0x8e5f('0x55')],'nonce':_0x493490[_0x8e5f('0x54')]},'options':{'algorithm':_0x8e5f('0x62'),'subject':_0x493490['id'][_0x8e5f('0x5f')](),'issuer':hardwareConf[_0x8e5f('0x3e')](),'audience':hardwareConf[_0x8e5f('0x3e')]()}};return signJwt(_0x3e6ae7)[_0x8e5f('0x2d')](function(_0x35c1d2){return{'iat':_0x493490[_0x8e5f('0x55')],'nonce':_0x493490['apiKeyNonce'],'token':_0x35c1d2};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5dba678..6e5359d 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 _0xb7e7=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','createDecipher','data','close','unlink'];(function(_0x3f2675,_0x4e3757){var _0x2c4376=function(_0x87fcad){while(--_0x87fcad){_0x3f2675['push'](_0x3f2675['shift']());}};_0x2c4376(++_0x4e3757);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var crypto=require(_0x7b7e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x7b7e('0x1')};function combineOptions(_0x518dc6){var _0x1b7cc7={};for(var _0x54a37f in defaultOptions){if(defaultOptions[_0x7b7e('0x2')](_0x54a37f)){_0x1b7cc7[_0x54a37f]=defaultOptions[_0x54a37f];}}if(_0x518dc6){for(var _0x556d68 in _0x518dc6){if(_0x518dc6[_0x7b7e('0x2')](_0x556d68)){_0x1b7cc7[_0x556d68]=_0x518dc6[_0x556d68];}}}return _0x1b7cc7;}exports[_0x7b7e('0x3')]=function(_0x1d9384,_0x52047f,_0x53ed64,_0x333fa4){return new BPromise(function(_0x372bde,_0x7f87e0){_0x333fa4=combineOptions(_0x333fa4);var _0x55ce81=new Buffer(_0x53ed64);var _0x42b871=fs[_0x7b7e('0x4')](_0x1d9384);var _0x2917f9=fs[_0x7b7e('0x5')](_0x52047f);var _0x148964=crypto[_0x7b7e('0x6')](_0x333fa4[_0x7b7e('0x7')],_0x55ce81);_0x42b871['on']('data',function(_0x299519){var _0x1eef0a=new Buffer(_0x148964[_0x7b7e('0x8')](_0x299519),_0x7b7e('0x9'));_0x2917f9[_0x7b7e('0xa')](_0x1eef0a);});_0x42b871['on'](_0x7b7e('0xb'),function(){try{var _0x36d2a3=new Buffer(_0x148964[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x2917f9[_0x7b7e('0xa')](_0x36d2a3);_0x2917f9[_0x7b7e('0xb')]();_0x2917f9['on']('close',function(){return _0x372bde(_0x52047f);});}catch(_0x422d3a){fs['unlink'](_0x52047f);return _0x7f87e0(_0x422d3a);}});});};exports['decryptFile']=function(_0x2889ed,_0xd304f5,_0xf067da,_0x457ec5){return new BPromise(function(_0x3d2fb2,_0x5703fd){_0x457ec5=combineOptions(_0x457ec5);var _0x51baf6=new Buffer(_0xf067da);var _0xc7f087=fs[_0x7b7e('0x4')](_0x2889ed);var _0x27f999=fs[_0x7b7e('0x5')](_0xd304f5);var _0x2cc400=crypto[_0x7b7e('0xd')](_0x457ec5[_0x7b7e('0x7')],_0x51baf6);_0xc7f087['on'](_0x7b7e('0xe'),function(_0x2acb8c){var _0x429a0e=new Buffer(_0x2cc400[_0x7b7e('0x8')](_0x2acb8c),_0x7b7e('0x9'));_0x27f999[_0x7b7e('0xa')](_0x429a0e);});_0xc7f087['on'](_0x7b7e('0xb'),function(){try{var _0x9776c3=new Buffer(_0x2cc400[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x27f999[_0x7b7e('0xa')](_0x9776c3);_0x27f999[_0x7b7e('0xb')]();_0x27f999['on'](_0x7b7e('0xf'),function(){return _0x3d2fb2(_0xd304f5);});}catch(_0x4c0647){fs[_0x7b7e('0x10')](_0xd304f5);return _0x5703fd(_0x4c0647);}});});}; \ No newline at end of file +var _0xbaf0=['data','update','binary','write','end','decryptFile','createDecipher','final','close','unlink','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0baf('0x0'));var defaultOptions={'algorithm':_0x0baf('0x1')};function combineOptions(_0x1e212d){var _0x263f79={};for(var _0x1688bc in defaultOptions){if(defaultOptions[_0x0baf('0x2')](_0x1688bc)){_0x263f79[_0x1688bc]=defaultOptions[_0x1688bc];}}if(_0x1e212d){for(var _0x5a3e42 in _0x1e212d){if(_0x1e212d[_0x0baf('0x2')](_0x5a3e42)){_0x263f79[_0x5a3e42]=_0x1e212d[_0x5a3e42];}}}return _0x263f79;}exports[_0x0baf('0x3')]=function(_0x2d3fa5,_0x39b8f3,_0xe4c3c4,_0x335e24){return new BPromise(function(_0x1a10b1,_0x2dcaac){_0x335e24=combineOptions(_0x335e24);var _0x1d0a0d=new Buffer(_0xe4c3c4);var _0x5f5030=fs[_0x0baf('0x4')](_0x2d3fa5);var _0x5f20aa=fs[_0x0baf('0x5')](_0x39b8f3);var _0x2c7442=crypto[_0x0baf('0x6')](_0x335e24[_0x0baf('0x7')],_0x1d0a0d);_0x5f5030['on'](_0x0baf('0x8'),function(_0xf4c8ac){var _0x41cead=new Buffer(_0x2c7442[_0x0baf('0x9')](_0xf4c8ac),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x41cead);});_0x5f5030['on'](_0x0baf('0xc'),function(){try{var _0x51d93c=new Buffer(_0x2c7442['final'](_0x0baf('0xa')),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x51d93c);_0x5f20aa[_0x0baf('0xc')]();_0x5f20aa['on']('close',function(){return _0x1a10b1(_0x39b8f3);});}catch(_0x2ab33e){fs['unlink'](_0x39b8f3);return _0x2dcaac(_0x2ab33e);}});});};exports[_0x0baf('0xd')]=function(_0x1f50c3,_0x7fbf67,_0x2bc381,_0xb8339e){return new BPromise(function(_0x469599,_0x4f80a8){_0xb8339e=combineOptions(_0xb8339e);var _0x4cd79d=new Buffer(_0x2bc381);var _0x2312c7=fs[_0x0baf('0x4')](_0x1f50c3);var _0x283408=fs[_0x0baf('0x5')](_0x7fbf67);var _0x2cf7da=crypto[_0x0baf('0xe')](_0xb8339e['algorithm'],_0x4cd79d);_0x2312c7['on'](_0x0baf('0x8'),function(_0xfbecec){var _0x1ef0e5=new Buffer(_0x2cf7da[_0x0baf('0x9')](_0xfbecec),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x1ef0e5);});_0x2312c7['on']('end',function(){try{var _0x5cff5d=new Buffer(_0x2cf7da[_0x0baf('0xf')](_0x0baf('0xa')),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x5cff5d);_0x283408[_0x0baf('0xc')]();_0x283408['on'](_0x0baf('0x10'),function(){return _0x469599(_0x7fbf67);});}catch(_0x210cd8){fs[_0x0baf('0x11')](_0x7fbf67);return _0x4f80a8(_0x210cd8);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5f2019a..cbcd685 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 _0xbec5=['%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','join','mkdirSync','each','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push'];(function(_0x986e88,_0x292f45){var _0x188f29=function(_0x2bd9eb){while(--_0x2bd9eb){_0x986e88['push'](_0x986e88['shift']());}};_0x188f29(++_0x292f45);}(_0xbec5,0xe5));var _0x5bec=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbec5[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x5bec('0x0'));var path=require(_0x5bec('0x1'));var _=require('lodash');var csv=require(_0x5bec('0x2'));var fs=require('fs');var BPromise=require(_0x5bec('0x3'));var zipdir=require(_0x5bec('0x4'));var rimraf=require(_0x5bec('0x5'));var db=require(_0x5bec('0x6'))['db'];var dbH=require('../../mysqldb')[_0x5bec('0x7')];var logger=require(_0x5bec('0x8'))(_0x5bec('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5bec('0xa')][0x3];var PATH=process[_0x5bec('0xa')][0x4];function analyticExtractedReport(_0x38456e,_0x406e65){var _0x43d96e={'status':_0x38456e};var _0x302aae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x406e65){_0x43d96e[_0x5bec('0xb')]=_0x406e65;}return db[_0x5bec('0xc')]['update'](_0x43d96e,_0x302aae);}function main(){var _0x41a827=0x1388;var _0x5c2d67;logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5bec('0x10')][_0x5bec('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5bec('0x12'),'splitSizeCsv']})[_0x5bec('0x13')](function(_0x1c888f){if(_0x1c888f){_0x5c2d67=_0x1c888f;_0x41a827=_0x5c2d67['splitSizeCsv']||0x1388;}})[_0x5bec('0x13')](function(){return dbH[_0x5bec('0x14')][_0x5bec('0x15')](util[_0x5bec('0xe')](_0x5bec('0x16'),QUERY),{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')][_0x5bec('0x18')]});})[_0x5bec('0x13')](function(_0x3ebc41){if(!_0x3ebc41[0x0][_0x5bec('0x19')]){return analyticExtractedReport(_0x5bec('0x1a'));}var _0x11fb8e=[];var _0x506639=0x0;var _0x4ab821=!![];if(_0x3ebc41&&_0x3ebc41[_0x5bec('0x1b')]){var _0x773740=_0x3ebc41[0x0][_0x5bec('0x19')]%(_0x506639+_0x41a827);if(_0x5c2d67[_0x5bec('0x12')]){for(;_0x4ab821;_0x506639+=_0x41a827,_0x773740=_0x3ebc41[0x0]['num']%(_0x506639+_0x41a827)){if(_0x773740==0x0||_0x773740==_0x3ebc41[0x0]['num']){_0x4ab821=![];}_0x11fb8e[_0x5bec('0x1c')](dbH[_0x5bec('0x14')]['query'](util[_0x5bec('0xe')](_0x5bec('0x1d'),QUERY,_0x41a827,_0x506639),{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')]['SELECT']}));}}else{_0x11fb8e[_0x5bec('0x1c')](dbH['sequelize'][_0x5bec('0x15')](QUERY,{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')][_0x5bec('0x18')]}));}}var _0xfed23=path['dirname'](PATH);var _0x232584=path['basename'](PATH,_0x5bec('0x1e'));var _0x3ddb88=_0x5c2d67['split']&&_0x11fb8e[_0x5bec('0x1b')]>0x1;var _0xbef70b=[];if(!fs['existsSync'](path[_0x5bec('0x1f')](_0xfed23,_0x232584))&&_0x3ddb88){fs[_0x5bec('0x20')](path[_0x5bec('0x1f')](_0xfed23,_0x232584));}return BPromise[_0x5bec('0x21')](_0x11fb8e,function(_0x226d55){_0xbef70b[_0x5bec('0x1c')](_0x226d55);})[_0x5bec('0x13')](function(){for(var _0x4de66a=0x0;_0x4de66a<_0xbef70b['length'];_0x4de66a+=0x1){var _0x5e44b3;var _0x2961bd=_0xbef70b[_0x4de66a];if(_0x3ddb88){_0x5e44b3=path[_0x5bec('0x1f')](_0xfed23,_0x232584,util[_0x5bec('0xe')]('%s%d.%s',_0x232584,_0x4de66a,_0x5bec('0x22')));}else{_0x5e44b3=path[_0x5bec('0x1f')](_0xfed23,util['format'](_0x5bec('0x23'),_0x232584,_0x5bec('0x22')));}fs['writeFileSync'](_0x5e44b3,csv(_0x2961bd));}})['then'](function(){if(_0x3ddb88){zipdir(path[_0x5bec('0x1f')](_0xfed23,_0x232584),{'saveTo':path[_0x5bec('0x1f')](_0xfed23,util[_0x5bec('0xe')](_0x5bec('0x23'),_0x232584,_0x5bec('0x24')))},function(_0x3f224c,_0x5d6621){});rimraf(path[_0x5bec('0x1f')](_0xfed23,_0x232584),function(){});}})['then'](function(){logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0x25'),EXTRACTED_REPORT_ID,_0x5bec('0x26')));return analyticExtractedReport('Completed',_0x3ddb88?util[_0x5bec('0xe')](_0x5bec('0x23'),_0x232584,_0x3ddb88?_0x5bec('0x24'):'csv'):null);});})[_0x5bec('0x27')](function(_0x4cfb89){logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5bec('0x29')](_0x4cfb89,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5bec('0x2a'));});}main(); \ No newline at end of file +var _0x2dae=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2dae,0xc3));var _0xe2da=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x2dae[_0x622035];return _0x326cf2;};'use strict';var util=require(_0xe2da('0x0'));var path=require('path');var _=require(_0xe2da('0x1'));var csv=require(_0xe2da('0x2'));var fs=require('fs');var BPromise=require(_0xe2da('0x3'));var zipdir=require(_0xe2da('0x4'));var rimraf=require(_0xe2da('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe2da('0x6'))[_0xe2da('0x7')];var logger=require(_0xe2da('0x8'))(_0xe2da('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe2da('0xa')][0x3];var PATH=process[_0xe2da('0xa')][0x4];function analyticExtractedReport(_0x34cc98,_0x2efbd8){var _0x238da3={'status':_0x34cc98};var _0x1c71ea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2efbd8){_0x238da3[_0xe2da('0xb')]=_0x2efbd8;}return db[_0xe2da('0xc')][_0xe2da('0xd')](_0x238da3,_0x1c71ea);}function main(){var _0x5a2fc5=0x1388;var _0x52e650;logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x10'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return db[_0xe2da('0x12')][_0xe2da('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe2da('0x14'),'splitSizeCsv']})[_0xe2da('0x15')](function(_0x5200b1){if(_0x5200b1){_0x52e650=_0x5200b1;_0x5a2fc5=_0x52e650[_0xe2da('0x16')]||0x1388;}})[_0xe2da('0x15')](function(){return dbH[_0xe2da('0x17')][_0xe2da('0x18')](util[_0xe2da('0xf')](_0xe2da('0x19'),QUERY),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]});})['then'](function(_0x586b27){if(!_0x586b27[0x0][_0xe2da('0x1b')]){return analyticExtractedReport(_0xe2da('0x1c'));}var _0x33f919=[];var _0x4dc58b=0x0;var _0x25d4fa=!![];if(_0x586b27&&_0x586b27[_0xe2da('0x1d')]){var _0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5);if(_0x52e650['split']){for(;_0x25d4fa;_0x4dc58b+=_0x5a2fc5,_0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5)){if(_0x2ea60e==0x0||_0x2ea60e==_0x586b27[0x0][_0xe2da('0x1b')]){_0x25d4fa=![];}_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](util['format'](_0xe2da('0x1f'),QUERY,_0x5a2fc5,_0x4dc58b),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]}));}}else{_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](QUERY,{'type':dbH[_0xe2da('0x17')][_0xe2da('0x20')]['SELECT']}));}}var _0x467cd6=path['dirname'](PATH);var _0x30efdc=path[_0xe2da('0x21')](PATH,_0xe2da('0x22'));var _0x28f1d3=_0x52e650[_0xe2da('0x14')]&&_0x33f919[_0xe2da('0x1d')]>0x1;var _0x38f2c4=[];if(!fs[_0xe2da('0x23')](path['join'](_0x467cd6,_0x30efdc))&&_0x28f1d3){fs[_0xe2da('0x24')](path[_0xe2da('0x25')](_0x467cd6,_0x30efdc));}return BPromise[_0xe2da('0x26')](_0x33f919,function(_0x14704d){_0x38f2c4[_0xe2da('0x1e')](_0x14704d);})[_0xe2da('0x15')](function(){for(var _0x124d93=0x0;_0x124d93<_0x38f2c4['length'];_0x124d93+=0x1){var _0x2adc49;var _0x3e23d7=_0x38f2c4[_0x124d93];if(_0x28f1d3){_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,_0x30efdc,util[_0xe2da('0xf')](_0xe2da('0x27'),_0x30efdc,_0x124d93,_0xe2da('0x28')));}else{_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'csv'));}fs['writeFileSync'](_0x2adc49,csv(_0x3e23d7));}})[_0xe2da('0x15')](function(){if(_0x28f1d3){zipdir(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),{'saveTo':path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'zip'))},function(_0x356ab4,_0x1ec8ca){});rimraf(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),function(){});}})[_0xe2da('0x15')](function(){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x29'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return analyticExtractedReport(_0xe2da('0x2a'),_0x28f1d3?util['format']('%s.%s',_0x30efdc,_0x28f1d3?_0xe2da('0x2b'):_0xe2da('0x28')):null);});})[_0xe2da('0x2c')](function(_0x34f5fe){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x2d'),EXTRACTED_REPORT_ID,_0xe2da('0x11')),util[_0xe2da('0x2e')](_0x34f5fe,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe2da('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 976fb5c..19eb44f 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x18efd8,_0x3124c5){var _0x5e7b4e=function(_0x23cd11){while(--_0x23cd11){_0x18efd8['push'](_0x18efd8['shift']());}};_0x5e7b4e(++_0x3124c5);}(_0xb10b,0x12a));var _0xbb10=function(_0x443ec0,_0x186140){_0x443ec0=_0x443ec0-0x0;var _0x227249=_0xb10b[_0x443ec0];return _0x227249;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x270189,_0xf390a0){var _0x23f4fd=function(_0x190d41){while(--_0x190d41){_0x270189['push'](_0x270189['shift']());}};_0x23f4fd(++_0xf390a0);}(_0xb10b,0x12a));var _0xbb10=function(_0x10c814,_0x2c5349){_0x10c814=_0x10c814-0x0;var _0x3620e8=_0xb10b[_0x10c814];return _0x3620e8;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 423203b..097ca3d 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 _0x500e=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','each','join','xlsx','%s.%s','binary','zip','info','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','XLSX','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','format','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x500e,0xbf));var _0xe500=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x500e[_0x481bf7];return _0x461787;};'use strict';var util=require('util');var path=require(_0xe500('0x0'));var _=require(_0xe500('0x1'));var fs=require('fs');var json2xls=require(_0xe500('0x2'));var BPromise=require(_0xe500('0x3'));var zipdir=require(_0xe500('0x4'));var rimraf=require(_0xe500('0x5'));var db=require(_0xe500('0x6'))['db'];var dbH=require(_0xe500('0x6'))[_0xe500('0x7')];var logger=require('../../config/logger')(_0xe500('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe500('0x9')][0x2]);var QUERY=process[_0xe500('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x43d5b2,_0x2f6d0a){var _0x57bd54={'status':_0x43d5b2};var _0x31b74f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f6d0a){_0x57bd54['savename']=_0x2f6d0a;}return db[_0xe500('0xa')]['update'](_0x57bd54,_0x31b74f);}function main(){var _0x3271ef=0x1388;var _0x1d783f;logger['info'](util[_0xe500('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xe500('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe500('0xd'),_0xe500('0xe')]})[_0xe500('0xf')](function(_0x11683c){if(_0x11683c){_0x1d783f=_0x11683c;_0x3271ef=_0x1d783f[_0xe500('0xe')]||0x1388;}})['then'](function(){return dbH[_0xe500('0x10')][_0xe500('0x11')](util[_0xe500('0xb')](_0xe500('0x12'),QUERY),{'type':dbH[_0xe500('0x10')][_0xe500('0x13')][_0xe500('0x14')]});})[_0xe500('0xf')](function(_0x4f7305){if(!_0x4f7305[0x0][_0xe500('0x15')]){return analyticExtractedReport(_0xe500('0x16'));}var _0x582d76=[];var _0x2d539a=0x0;var _0x2a1157=!![];if(_0x1d783f[_0xe500('0xd')]){if(_0x4f7305&&_0x4f7305[_0xe500('0x17')]){var _0x1a2aa2=_0x4f7305[0x0][_0xe500('0x15')]%(_0x2d539a+_0x3271ef);for(;_0x2a1157;_0x2d539a+=_0x3271ef,_0x1a2aa2=_0x4f7305[0x0][_0xe500('0x15')]%(_0x2d539a+_0x3271ef)){if(_0x1a2aa2==0x0||_0x1a2aa2==_0x4f7305[0x0][_0xe500('0x15')]){_0x2a1157=![];}_0x582d76[_0xe500('0x18')](dbH['sequelize'][_0xe500('0x11')](util[_0xe500('0xb')](_0xe500('0x19'),QUERY,_0x3271ef,_0x2d539a),{'type':dbH[_0xe500('0x10')][_0xe500('0x13')][_0xe500('0x14')]}));}}}else{_0x582d76['push'](dbH['sequelize'][_0xe500('0x11')](QUERY,{'type':dbH[_0xe500('0x10')][_0xe500('0x13')]['SELECT']}));}var _0x299964=path[_0xe500('0x1a')](PATH);var _0x11673b=path['basename'](PATH,_0xe500('0x1b'));var _0xdd74c3=_0x1d783f[_0xe500('0xd')]&&_0x582d76[_0xe500('0x17')]>0x1;var _0x4eb73c=[];if(!fs[_0xe500('0x1c')](path['join'](_0x299964,_0x11673b))&&_0xdd74c3){fs['mkdirSync'](path['join'](_0x299964,_0x11673b));}return BPromise[_0xe500('0x1d')](_0x582d76,function(_0x10ac5d){_0x4eb73c[_0xe500('0x18')](_0x10ac5d);})[_0xe500('0xf')](function(){for(var _0x10efd7=0x0;_0x10efd7<_0x4eb73c[_0xe500('0x17')];_0x10efd7+=0x1){var _0x17181b;var _0x37d368=_0x4eb73c[_0x10efd7];if(_0xdd74c3){_0x17181b=path[_0xe500('0x1e')](_0x299964,_0x11673b,util['format']('%s%d.%s',_0x11673b,_0x10efd7,_0xe500('0x1f')));}else{_0x17181b=path[_0xe500('0x1e')](_0x299964,util['format'](_0xe500('0x20'),_0x11673b,_0xe500('0x1f')));}fs['writeFileSync'](_0x17181b,json2xls(_0x37d368),_0xe500('0x21'));}})['then'](function(){if(_0xdd74c3){zipdir(path['join'](_0x299964,_0x11673b),{'saveTo':path['join'](_0x299964,util['format'](_0xe500('0x20'),_0x11673b,_0xe500('0x22')))},function(_0xdaa831,_0x1e2e51){});rimraf(path[_0xe500('0x1e')](_0x299964,_0x11673b),function(){});}})[_0xe500('0xf')](function(){logger[_0xe500('0x23')](util[_0xe500('0xb')](_0xe500('0x24'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xe500('0x25'),_0xdd74c3?util[_0xe500('0xb')]('%s.%s',_0x11673b,_0xdd74c3?'zip':'xlsx'):null);});})[_0xe500('0x26')](function(_0x1629b7){logger['info'](util[_0xe500('0xb')](_0xe500('0x27'),EXTRACTED_REPORT_ID,_0xe500('0x28')),util[_0xe500('0x29')](_0x1629b7,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe500('0x2a'));});}main(); \ No newline at end of file +var _0x630c=['splitSizeXlsx','then','format','SELECT','num','Empty','length','push','sequelize','query','QueryTypes','dirname','basename','.xlsx','split','existsSync','join','mkdirSync','each','xlsx','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','XLSX','find'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x630c,0x9d));var _0xc630=function(_0x298101,_0x1a612f){_0x298101=_0x298101-0x0;var _0x3b899a=_0x630c[_0x298101];return _0x3b899a;};'use strict';var util=require(_0xc630('0x0'));var path=require('path');var _=require(_0xc630('0x1'));var fs=require('fs');var json2xls=require(_0xc630('0x2'));var BPromise=require(_0xc630('0x3'));var zipdir=require(_0xc630('0x4'));var rimraf=require(_0xc630('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc630('0x6'))[_0xc630('0x7')];var logger=require(_0xc630('0x8'))(_0xc630('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc630('0xa')][0x2]);var QUERY=process[_0xc630('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x1c67b8,_0x457bdd){var _0x4b1961={'status':_0x1c67b8};var _0x2f1bc7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x457bdd){_0x4b1961[_0xc630('0xb')]=_0x457bdd;}return db['AnalyticExtractedReport']['update'](_0x4b1961,_0x2f1bc7);}function main(){var _0x4be772=0x1388;var _0x11912c;logger[_0xc630('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc630('0xd')));return db['Setting'][_0xc630('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc630('0xf')]})['then'](function(_0x165904){if(_0x165904){_0x11912c=_0x165904;_0x4be772=_0x11912c[_0xc630('0xf')]||0x1388;}})[_0xc630('0x10')](function(){return dbH['sequelize']['query'](util[_0xc630('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xc630('0x12')]});})[_0xc630('0x10')](function(_0x14d23c){if(!_0x14d23c[0x0][_0xc630('0x13')]){return analyticExtractedReport(_0xc630('0x14'));}var _0x2e79d1=[];var _0x518aa6=0x0;var _0x353a8a=!![];if(_0x11912c['split']){if(_0x14d23c&&_0x14d23c[_0xc630('0x15')]){var _0x9a8c01=_0x14d23c[0x0][_0xc630('0x13')]%(_0x518aa6+_0x4be772);for(;_0x353a8a;_0x518aa6+=_0x4be772,_0x9a8c01=_0x14d23c[0x0][_0xc630('0x13')]%(_0x518aa6+_0x4be772)){if(_0x9a8c01==0x0||_0x9a8c01==_0x14d23c[0x0][_0xc630('0x13')]){_0x353a8a=![];}_0x2e79d1[_0xc630('0x16')](dbH[_0xc630('0x17')][_0xc630('0x18')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4be772,_0x518aa6),{'type':dbH[_0xc630('0x17')][_0xc630('0x19')][_0xc630('0x12')]}));}}}else{_0x2e79d1[_0xc630('0x16')](dbH[_0xc630('0x17')][_0xc630('0x18')](QUERY,{'type':dbH[_0xc630('0x17')][_0xc630('0x19')][_0xc630('0x12')]}));}var _0x3bca84=path[_0xc630('0x1a')](PATH);var _0x5de63d=path[_0xc630('0x1b')](PATH,_0xc630('0x1c'));var _0x3adfbf=_0x11912c[_0xc630('0x1d')]&&_0x2e79d1['length']>0x1;var _0x2eb7ba=[];if(!fs[_0xc630('0x1e')](path[_0xc630('0x1f')](_0x3bca84,_0x5de63d))&&_0x3adfbf){fs[_0xc630('0x20')](path['join'](_0x3bca84,_0x5de63d));}return BPromise[_0xc630('0x21')](_0x2e79d1,function(_0x46da15){_0x2eb7ba[_0xc630('0x16')](_0x46da15);})[_0xc630('0x10')](function(){for(var _0x4b2166=0x0;_0x4b2166<_0x2eb7ba['length'];_0x4b2166+=0x1){var _0x48c27d;var _0x58f9df=_0x2eb7ba[_0x4b2166];if(_0x3adfbf){_0x48c27d=path['join'](_0x3bca84,_0x5de63d,util[_0xc630('0x11')]('%s%d.%s',_0x5de63d,_0x4b2166,_0xc630('0x22')));}else{_0x48c27d=path[_0xc630('0x1f')](_0x3bca84,util[_0xc630('0x11')]('%s.%s',_0x5de63d,_0xc630('0x22')));}fs['writeFileSync'](_0x48c27d,json2xls(_0x58f9df),_0xc630('0x23'));}})[_0xc630('0x10')](function(){if(_0x3adfbf){zipdir(path[_0xc630('0x1f')](_0x3bca84,_0x5de63d),{'saveTo':path[_0xc630('0x1f')](_0x3bca84,util[_0xc630('0x11')](_0xc630('0x24'),_0x5de63d,_0xc630('0x25')))},function(_0x143329,_0x48b9f4){});rimraf(path[_0xc630('0x1f')](_0x3bca84,_0x5de63d),function(){});}})[_0xc630('0x10')](function(){logger['info'](util['format'](_0xc630('0x26'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x3adfbf?util[_0xc630('0x11')](_0xc630('0x24'),_0x5de63d,_0x3adfbf?_0xc630('0x25'):_0xc630('0x22')):null);});})[_0xc630('0x27')](function(_0x1cab84){logger[_0xc630('0xc')](util[_0xc630('0x11')](_0xc630('0x28'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xc630('0x29')](_0x1cab84,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc630('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4caa7e9..fb82d49 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 _0xd3ef=['sortBy','rewrite','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','VoiceExtensionId','outbound','push','cutdigits','context','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate'];(function(_0x29c526,_0x4c1364){var _0x43f549=function(_0x30c87a){while(--_0x30c87a){_0x29c526['push'](_0x29c526['shift']());}};_0x43f549(++_0x4c1364);}(_0xd3ef,0xce));var _0xfd3e=function(_0x3fb225,_0x47d95d){_0x3fb225=_0x3fb225-0x0;var _0x5122d3=_0xd3ef[_0x3fb225];return _0x5122d3;};'use strict';var _=require('lodash');var util=require(_0xfd3e('0x0'));function rewrite(_0x460dc9,_0x6aa93d){var _0x30573a=this;return _0x460dc9[_0xfd3e('0x1')][_0xfd3e('0x2')][_0xfd3e('0x3')]({'raw':!![]})[_0xfd3e('0x4')](function(_0x487585){_0x30573a['intervals']=_0x487585;return _0x460dc9[_0xfd3e('0x1')][_0xfd3e('0x5')][_0xfd3e('0x3')]({'where':{'IntervalId':_0x6aa93d[_0xfd3e('0x6')]},'raw':!![]});})[_0xfd3e('0x4')](function(_0x2a1bee){return _0x460dc9[_0xfd3e('0x1')][_0xfd3e('0x5')][_0xfd3e('0x3')]({'where':{'exten':{'$in':_[_0xfd3e('0x7')](_['map'](_0x2a1bee,_0xfd3e('0x8')))}},'order':[{'raw':_0xfd3e('0x9')}],'raw':!![]});})[_0xfd3e('0x4')](function(_0x2eab4c){var _0xab3ae2=_['filter'](_0x2eab4c,{'priority':'1'});var _0x29fa53=_[_0xfd3e('0xa')](_0x2eab4c,{'isApp':0x1});var _0x50754f=_['groupBy'](_0x29fa53,_0xfd3e('0x8'));var _0x58cc95=[_0xfd3e('0xb'),_0xfd3e('0xc')];var _0x4b2084=[];var _0x5f0667=[];for(var _0x28d70a in _0x50754f){if(_0x50754f[_0xfd3e('0xd')](_0x28d70a)){_0x30573a[_0xfd3e('0xe')]=0x2;_0x30573a[_0xfd3e('0xf')]=[];_0x30573a[_0xfd3e('0x10')]=_[_0xfd3e('0x11')](_0xab3ae2,{'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')]});_0x30573a[_0xfd3e('0xf')]['push']({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':util[_0xfd3e('0x14')](_0xfd3e('0x15'),_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')]),'context':_0x50754f[_0x28d70a][0x0]['context'],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});if(_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')]===_0xfd3e('0x17')){if(_0x30573a[_0xfd3e('0x10')]){_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x30573a[_0xfd3e('0x10')][_0xfd3e('0x19')]?'${EXTEN:'+_0x30573a[_0xfd3e('0x10')]['cutdigits']+'}':'${EXTEN}'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0]['exten'],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']});}_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x1b')+_0x50754f[_0x28d70a][0x0]['VoiceExtensionId'],'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});var _0x48924c=_0x30573a[_0xfd3e('0xe')]++;_0x30573a[_0xfd3e('0xf')]['push']({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':'ExecIf','appdata':_0xfd3e('0x1c')+(_0x48924c+0x2)+_0xfd3e('0x1d')+(_0x48924c+0x1)+')','context':_0x50754f[_0x28d70a][0x0]['context'],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x48924c,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});if(_0x30573a[_0xfd3e('0x10')]){_0x30573a[_0xfd3e('0xf')]['push']({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':_0xfd3e('0x13'),'appdata':_0x30573a['extension'][_0xfd3e('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x30573a[_0xfd3e('0x10')][_0xfd3e('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x50754f[_0x28d70a][0x0]['context'],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});}_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x1e')+_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')],'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0]['exten'],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});if(_0x30573a[_0xfd3e('0x10')]&&_0x30573a[_0xfd3e('0x10')]['hasOwnProperty']('recordingFormat')&&_0x30573a[_0xfd3e('0x10')][_0xfd3e('0x1f')]!=='none'){_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x20'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x21')+_0x30573a[_0xfd3e('0x10')]['recordingFormat']||_0xfd3e('0x22'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']});}}_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x23'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']});_0x30573a['extensions']['push']({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':'Set','appdata':_0xfd3e('0x24'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']});_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x25'),'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'priority':_0x30573a[_0xfd3e('0xe')]++,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']});for(var _0x217b2b=0x0,_0x2287f9=0x0;_0x217b2b<_0x50754f[_0x28d70a][_0xfd3e('0x26')];_0x217b2b+=0x1,_0x2287f9=0x0){var _0x2c7625=_0x50754f[_0x28d70a][_0x217b2b];if(_0x2c7625[_0xfd3e('0x12')]){_0x2c7625[_0xfd3e('0x12')]=_0x2c7625[_0xfd3e('0x12')][_0xfd3e('0x27')]();}var _0x6b7133=[];var _0x4cb75f=[];delete _0x2c7625['id'];delete _0x2c7625['createdAt'];delete _0x2c7625[_0xfd3e('0x28')];var _0xdf3e21=_0x2c7625[_0xfd3e('0x29')]!==_0xfd3e('0x2a')?[_0x2c7625['interval']]:_0x2c7625[_0xfd3e('0x6')]?_[_0xfd3e('0x2b')](_['filter'](_0x30573a[_0xfd3e('0x2c')],{'IntervalId':_0x2c7625['IntervalId']}),'interval'):[];if(_0x2c7625[_0xfd3e('0xd')](_0xfd3e('0x2d'))){if(_0x2c7625[_0xfd3e('0x2d')]&&_0x2c7625[_0xfd3e('0x2d')]!=='--'){_0x6b7133['push']({'type':_0x2c7625[_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x2e')+_0x2c7625[_0xfd3e('0x2d')],'context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625['exten'],'priority':_0xdf3e21[_0xfd3e('0x26')]+_0x30573a[_0xfd3e('0xe')]+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});}}if(_0x2c7625[_0xfd3e('0x12')]===_0xfd3e('0x17')&&_0x2c7625[_0xfd3e('0xd')](_0xfd3e('0x2f'))){if(_0x2c7625[_0xfd3e('0x2f')]){_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625[_0xfd3e('0x12')],'app':'ExecIf','appdata':_0xfd3e('0x30')+_0x2c7625['callerID']+')','context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625['exten'],'priority':_0xdf3e21[_0xfd3e('0x26')]+_0x30573a['priority']+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});}else{_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625[_0xfd3e('0x12')],'app':'ExecIf','appdata':_0xfd3e('0x31'),'context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625[_0xfd3e('0x8')],'priority':_0xdf3e21['length']+_0x30573a[_0xfd3e('0xe')]+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});}}if(_0x2c7625[_0xfd3e('0xd')](_0xfd3e('0x32'))){if(_0x58cc95[_0xfd3e('0x33')](_0x2c7625[_0xfd3e('0x34')][_0xfd3e('0x27')]())>=0x0&&_0x2c7625[_0xfd3e('0x35')]!=='custom'){if(_0x2c7625[_0xfd3e('0x32')]){_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625[_0xfd3e('0x12')],'app':_0xfd3e('0x36'),'appdata':_0xfd3e('0x37'),'context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625[_0xfd3e('0x8')],'priority':_0xdf3e21['length']+_0x30573a['priority']+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625['type'],'app':'Set','appdata':_0xfd3e('0x38'),'context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625[_0xfd3e('0x8')],'priority':_0xdf3e21[_0xfd3e('0x26')]+_0x30573a[_0xfd3e('0xe')]+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});}else{_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625['type'],'app':'ExecIf','appdata':_0xfd3e('0x39'),'context':_0x2c7625[_0xfd3e('0x1a')],'exten':_0x2c7625[_0xfd3e('0x8')],'priority':_0xdf3e21[_0xfd3e('0x26')]+_0x30573a[_0xfd3e('0xe')]+_0x2287f9++,'VoiceExtensionId':_0x2c7625['VoiceExtensionId']});_0x6b7133[_0xfd3e('0x18')]({'type':_0x2c7625[_0xfd3e('0x12')],'app':_0xfd3e('0x13'),'appdata':_0xfd3e('0x3a'),'context':_0x2c7625['context'],'exten':_0x2c7625['exten'],'priority':_0xdf3e21['length']+_0x30573a[_0xfd3e('0xe')]+_0x2287f9++,'VoiceExtensionId':_0x2c7625[_0xfd3e('0x16')]});}}}for(var _0xa029f7=0x0;_0xa029f7<_0xdf3e21[_0xfd3e('0x26')];_0xa029f7+=0x1){var _0x377c07=_0x30573a[_0xfd3e('0xe')]+_0xdf3e21[_0xfd3e('0x26')];var _0x59364d=_0xa029f7===_0xdf3e21[_0xfd3e('0x26')]-0x1?_0x30573a[_0xfd3e('0xe')]+_0x6b7133[_0xfd3e('0x26')]+_0x4cb75f[_0xfd3e('0x26')]+0x2:_0x30573a[_0xfd3e('0xe')]+_0xa029f7+0x1;_0x6b7133['splice'](_0xa029f7,0x0,{'type':_0x2c7625['type'],'app':'GotoIfTime','appdata':_0xdf3e21[_0xa029f7]+'?'+_0x2c7625[_0xfd3e('0x1a')]+_0xfd3e('0x3b')+_0x377c07+':'+_0x2c7625[_0xfd3e('0x1a')]+',${EXTEN},'+_0x59364d,'exten':_0x2c7625[_0xfd3e('0x8')],'context':_0x2c7625[_0xfd3e('0x1a')],'priority':_0x30573a[_0xfd3e('0xe')]+_0xa029f7,'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});}_0x2c7625['priority']=_0x6b7133[_0xfd3e('0x26')]?_[_0xfd3e('0x3c')](_0x6b7133)[_0xfd3e('0xe')]+0x1:_0x30573a[_0xfd3e('0xe')];_0x30573a[_0xfd3e('0xe')]=(_0x4cb75f[_0xfd3e('0x26')]?_[_0xfd3e('0x3c')](_0x4cb75f)[_0xfd3e('0xe')]:_0x2c7625[_0xfd3e('0xe')])+0x1;_0x30573a[_0xfd3e('0xf')]=_[_0xfd3e('0x3d')](_0x30573a[_0xfd3e('0xf')],_0x6b7133,[_0x2c7625],_0x4cb75f);}_0x30573a[_0xfd3e('0xf')][_0xfd3e('0x18')]({'type':_0x50754f[_0x28d70a][0x0]['type'],'app':_0xfd3e('0x3e'),'exten':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x8')],'context':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x1a')],'priority':_0x30573a['priority'],'VoiceExtensionId':_0x50754f[_0x28d70a][0x0][_0xfd3e('0x16')]});_0x4b2084[_0xfd3e('0x18')](_0x50754f[_0x28d70a][0x0]['VoiceExtensionId']);_0x5f0667=_[_0xfd3e('0x3d')](_0x5f0667,_0x30573a[_0xfd3e('0xf')]);}}return _0x460dc9[_0xfd3e('0x3f')](function(_0x4a9224){return _0x460dc9[_0xfd3e('0x1')][_0xfd3e('0x5')][_0xfd3e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4b2084}},'transaction':_0x4a9224})[_0xfd3e('0x4')](function(_0x282996){return _0x460dc9[_0xfd3e('0x1')][_0xfd3e('0x5')][_0xfd3e('0x41')](_[_0xfd3e('0x42')](_0x5f0667,_0xfd3e('0xe')),{'transaction':_0x4a9224});});});})['catch'](function(_0x57178d){console['error'](_0x57178d);});}exports[_0xfd3e('0x43')]=rewrite; \ No newline at end of file +var _0xc68d=['groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','CDR(type)=%s','type','VoiceExtensionId','outbound','cutdigits','${EXTEN:','context','CDR(routeid)=','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-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','interval','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','concat','sortBy','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0xc68d,0x17a));var _0xdc68=function(_0x54c299,_0x3f5c8b){_0x54c299=_0x54c299-0x0;var _0x211fe4=_0xc68d[_0x54c299];return _0x211fe4;};'use strict';var _=require('lodash');var util=require(_0xdc68('0x0'));function rewrite(_0x102838,_0x5798ca){var _0x4f21d3=this;return _0x102838[_0xdc68('0x1')][_0xdc68('0x2')][_0xdc68('0x3')]({'raw':!![]})[_0xdc68('0x4')](function(_0x402e65){_0x4f21d3[_0xdc68('0x5')]=_0x402e65;return _0x102838['models'][_0xdc68('0x6')][_0xdc68('0x3')]({'where':{'IntervalId':_0x5798ca[_0xdc68('0x7')]},'raw':!![]});})['then'](function(_0x214161){return _0x102838[_0xdc68('0x1')][_0xdc68('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xdc68('0x8')](_0x214161,_0xdc68('0x9')))}},'order':[{'raw':_0xdc68('0xa')}],'raw':!![]});})[_0xdc68('0x4')](function(_0x54b946){var _0x420435=_[_0xdc68('0xb')](_0x54b946,{'priority':'1'});var _0x6db3df=_[_0xdc68('0xb')](_0x54b946,{'isApp':0x1});var _0x5a0bbc=_[_0xdc68('0xc')](_0x6db3df,_0xdc68('0x9'));var _0x500a71=[_0xdc68('0xd'),_0xdc68('0xe')];var _0xf942bc=[];var _0x4d2c1f=[];for(var _0x2f5572 in _0x5a0bbc){if(_0x5a0bbc[_0xdc68('0xf')](_0x2f5572)){_0x4f21d3[_0xdc68('0x10')]=0x2;_0x4f21d3[_0xdc68('0x11')]=[];_0x4f21d3[_0xdc68('0x12')]=_[_0xdc68('0x13')](_0x420435,{'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')]});_0x4f21d3['extensions'][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':_0xdc68('0x15'),'appdata':util['format'](_0xdc68('0x16'),_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')]),'context':_0x5a0bbc[_0x2f5572][0x0]['context'],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});if(_0x5a0bbc[_0x2f5572][0x0]['type']===_0xdc68('0x19')){if(_0x4f21d3[_0xdc68('0x12')]){_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x4f21d3[_0xdc68('0x12')][_0xdc68('0x1a')]?_0xdc68('0x1b')+_0x4f21d3[_0xdc68('0x12')][_0xdc68('0x1a')]+'}':'${EXTEN}'),'context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});}_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x1d')+_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId'],'context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0]['exten'],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});var _0xd5cceb=_0x4f21d3[_0xdc68('0x10')]++;_0x4f21d3['extensions'][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':_0xdc68('0x1e'),'appdata':_0xdc68('0x1f')+(_0xd5cceb+0x2)+_0xdc68('0x20')+(_0xd5cceb+0x1)+')','context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0xd5cceb,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId']});if(_0x4f21d3['extension']){_0x4f21d3['extensions']['push']({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0x4f21d3[_0xdc68('0x12')][_0xdc68('0x1a')]?_0xdc68('0x21')+_0x4f21d3[_0xdc68('0x12')][_0xdc68('0x1a')]+'}':_0xdc68('0x22'),'context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId']});}_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':'Set','appdata':_0xdc68('0x23')+_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')],'context':_0x5a0bbc[_0x2f5572][0x0]['context'],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId']});if(_0x4f21d3[_0xdc68('0x12')]&&_0x4f21d3['extension']['hasOwnProperty'](_0xdc68('0x24'))&&_0x4f21d3['extension'][_0xdc68('0x24')]!==_0xdc68('0x25')){_0x4f21d3['extensions']['push']({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x26'),'context':_0x5a0bbc[_0x2f5572][0x0]['context'],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId']});_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x27')+_0x4f21d3[_0xdc68('0x12')][_0xdc68('0x24')]||'wav','context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3['priority']++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});}}_0x4f21d3[_0xdc68('0x11')]['push']({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x28'),'context':_0x5a0bbc[_0x2f5572][0x0]['context'],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3[_0xdc68('0x10')]++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0]['exten'],'priority':_0x4f21d3['priority']++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0]['VoiceExtensionId']});_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x29'),'context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'priority':_0x4f21d3['priority']++,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});for(var _0x1ae829=0x0,_0x17d6ce=0x0;_0x1ae829<_0x5a0bbc[_0x2f5572]['length'];_0x1ae829+=0x1,_0x17d6ce=0x0){var _0x108f1e=_0x5a0bbc[_0x2f5572][_0x1ae829];if(_0x108f1e[_0xdc68('0x17')]){_0x108f1e['type']=_0x108f1e['type'][_0xdc68('0x2a')]();}var _0x70ebeb=[];var _0x38c798=[];delete _0x108f1e['id'];delete _0x108f1e['createdAt'];delete _0x108f1e[_0xdc68('0x2b')];var _0xae9bf7=_0x108f1e[_0xdc68('0x2c')]!=='*,*,*,*'?[_0x108f1e[_0xdc68('0x2c')]]:_0x108f1e['IntervalId']?_['map'](_[_0xdc68('0xb')](_0x4f21d3[_0xdc68('0x5')],{'IntervalId':_0x108f1e[_0xdc68('0x7')]}),_0xdc68('0x2c')):[];if(_0x108f1e['hasOwnProperty'](_0xdc68('0x2d'))){if(_0x108f1e[_0xdc68('0x2d')]&&_0x108f1e[_0xdc68('0x2d')]!=='--'){_0x70ebeb[_0xdc68('0x14')]({'type':_0x108f1e[_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':'CDR(tag)='+_0x108f1e[_0xdc68('0x2d')],'context':_0x108f1e[_0xdc68('0x1c')],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7[_0xdc68('0x2e')]+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});}}if(_0x108f1e['type']===_0xdc68('0x19')&&_0x108f1e[_0xdc68('0xf')]('callerID')){if(_0x108f1e[_0xdc68('0x2f')]){_0x70ebeb[_0xdc68('0x14')]({'type':_0x108f1e['type'],'app':_0xdc68('0x1e'),'appdata':_0xdc68('0x30')+_0x108f1e[_0xdc68('0x2f')]+')','context':_0x108f1e[_0xdc68('0x1c')],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7[_0xdc68('0x2e')]+_0x4f21d3['priority']+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});}else{_0x70ebeb[_0xdc68('0x14')]({'type':_0x108f1e['type'],'app':_0xdc68('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x108f1e['context'],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7[_0xdc68('0x2e')]+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});}}if(_0x108f1e[_0xdc68('0xf')](_0xdc68('0x31'))){if(_0x500a71[_0xdc68('0x32')](_0x108f1e[_0xdc68('0x33')][_0xdc68('0x2a')]())>=0x0&&_0x108f1e[_0xdc68('0x34')]!=='custom'){if(_0x108f1e[_0xdc68('0x31')]){_0x70ebeb[_0xdc68('0x14')]({'type':_0x108f1e['type'],'app':_0xdc68('0x1e'),'appdata':_0xdc68('0x35'),'context':_0x108f1e['context'],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7['length']+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});_0x70ebeb['push']({'type':_0x108f1e[_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x36'),'context':_0x108f1e['context'],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7['length']+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});}else{_0x70ebeb[_0xdc68('0x14')]({'type':_0x108f1e[_0xdc68('0x17')],'app':_0xdc68('0x1e'),'appdata':_0xdc68('0x37'),'context':_0x108f1e['context'],'exten':_0x108f1e['exten'],'priority':_0xae9bf7[_0xdc68('0x2e')]+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e['VoiceExtensionId']});_0x70ebeb['push']({'type':_0x108f1e[_0xdc68('0x17')],'app':_0xdc68('0x15'),'appdata':_0xdc68('0x38'),'context':_0x108f1e[_0xdc68('0x1c')],'exten':_0x108f1e[_0xdc68('0x9')],'priority':_0xae9bf7[_0xdc68('0x2e')]+_0x4f21d3[_0xdc68('0x10')]+_0x17d6ce++,'VoiceExtensionId':_0x108f1e[_0xdc68('0x18')]});}}}for(var _0x2ee21f=0x0;_0x2ee21f<_0xae9bf7['length'];_0x2ee21f+=0x1){var _0x7b6fdb=_0x4f21d3[_0xdc68('0x10')]+_0xae9bf7['length'];var _0xcbd481=_0x2ee21f===_0xae9bf7['length']-0x1?_0x4f21d3[_0xdc68('0x10')]+_0x70ebeb[_0xdc68('0x2e')]+_0x38c798[_0xdc68('0x2e')]+0x2:_0x4f21d3[_0xdc68('0x10')]+_0x2ee21f+0x1;_0x70ebeb['splice'](_0x2ee21f,0x0,{'type':_0x108f1e[_0xdc68('0x17')],'app':_0xdc68('0x39'),'appdata':_0xae9bf7[_0x2ee21f]+'?'+_0x108f1e[_0xdc68('0x1c')]+_0xdc68('0x3a')+_0x7b6fdb+':'+_0x108f1e[_0xdc68('0x1c')]+_0xdc68('0x3a')+_0xcbd481,'exten':_0x108f1e[_0xdc68('0x9')],'context':_0x108f1e[_0xdc68('0x1c')],'priority':_0x4f21d3[_0xdc68('0x10')]+_0x2ee21f,'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});}_0x108f1e['priority']=_0x70ebeb[_0xdc68('0x2e')]?_[_0xdc68('0x3b')](_0x70ebeb)['priority']+0x1:_0x4f21d3[_0xdc68('0x10')];_0x4f21d3[_0xdc68('0x10')]=(_0x38c798[_0xdc68('0x2e')]?_[_0xdc68('0x3b')](_0x38c798)[_0xdc68('0x10')]:_0x108f1e[_0xdc68('0x10')])+0x1;_0x4f21d3[_0xdc68('0x11')]=_['concat'](_0x4f21d3[_0xdc68('0x11')],_0x70ebeb,[_0x108f1e],_0x38c798);}_0x4f21d3[_0xdc68('0x11')][_0xdc68('0x14')]({'type':_0x5a0bbc[_0x2f5572][0x0]['type'],'app':_0xdc68('0x3c'),'exten':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x9')],'context':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x1c')],'priority':_0x4f21d3[_0xdc68('0x10')],'VoiceExtensionId':_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]});_0xf942bc['push'](_0x5a0bbc[_0x2f5572][0x0][_0xdc68('0x18')]);_0x4d2c1f=_[_0xdc68('0x3d')](_0x4d2c1f,_0x4f21d3[_0xdc68('0x11')]);}}return _0x102838['transaction'](function(_0x4e4588){return _0x102838['models'][_0xdc68('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xf942bc}},'transaction':_0x4e4588})[_0xdc68('0x4')](function(_0x4008e2){return _0x102838['models']['VoiceExtension']['bulkCreate'](_[_0xdc68('0x3e')](_0x4d2c1f,_0xdc68('0x10')),{'transaction':_0x4e4588});});});})['catch'](function(_0x3f020d){console[_0xdc68('0x3f')](_0x3f020d);});}exports[_0xdc68('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 42bdc1e..905bc52 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x306bc3,_0x1bb7ff){var _0x33628f=function(_0x9cf734){while(--_0x9cf734){_0x306bc3['push'](_0x306bc3['shift']());}};_0x33628f(++_0x1bb7ff);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb7e7[_0x2763f2];return _0x3ef471;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d95b959..d9cfff5 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0xa02ee0,_0x2cd1e6){var _0x166099=function(_0x250338){while(--_0x250338){_0xa02ee0['push'](_0xa02ee0['shift']());}};_0x166099(++_0x2cd1e6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x2a0c17,_0x5bb866){var _0x41f49f=function(_0x2a8088){while(--_0x2a8088){_0x2a0c17['push'](_0x2a0c17['shift']());}};_0x41f49f(++_0x5bb866);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 2af978a..dbc6226 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 _0xc43d=['../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','message','split','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','field','ListId\x20=\x20?','\x20=\x20?','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','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','code','main','stringify','start','binding','clone','server/files/tmp','body','ContactItemType','name','header','writeFileSync','createReadStream','errors','find','hasOwnProperty','trim','data','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','catch','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb'];(function(_0x55aed2,_0xb33353){var _0x1a37ad=function(_0x167486){while(--_0x167486){_0x55aed2['push'](_0x55aed2['shift']());}};_0x1a37ad(++_0xb33353);}(_0xc43d,0x99));var _0xdc43=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xc43d[_0x457b64];return _0x437111;};'use strict';var fs=require('fs');var path=require(_0xdc43('0x0'));var _=require(_0xdc43('0x1'));var Papa=require(_0xdc43('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xdc43('0x3'));var squel=require(_0xdc43('0x4'));var Redis=require(_0xdc43('0x5'));var db=require(_0xdc43('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xdc43('0x7'))(_0xdc43('0x8'));config[_0xdc43('0x9')]=_[_0xdc43('0xa')](config[_0xdc43('0x9')],{'host':_0xdc43('0xb'),'port':0x18eb});var socket=require(_0xdc43('0xc'))(new Redis(config[_0xdc43('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()[_0xdc43('0xd')](_0xdc43('0xe'));var tempTableName=_0xdc43('0xf')+moment()[_0xdc43('0xd')](_0xdc43('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x35a899){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))*$/[_0xdc43('0x11')](_0x35a899);}function selectNotIn(_0x3fa8bf,_0x1fb885,_0x1f3f1b,_0x4bb829,_0x46c153){return squel[_0xdc43('0x12')]()['field'](_0xdc43('0x13'))[_0xdc43('0x14')](_0x4bb829)['join'](_0x1fb885,null,_0x1fb885+'.id\x20=\x20'+_0x4bb829+'.'+_0x1f3f1b)['where'](_0x4bb829+'.'+_0x1f3f1b+_0xdc43('0x15')+_0x3fa8bf+'.'+_0x1f3f1b)[_0xdc43('0x16')](_0x1fb885+_0xdc43('0x17')+_0x46c153[_0xdc43('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x20eb98,_0x48dd1a){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdc43('0x19')][_0xdc43('0x1a')](_0xdc43('0x1b')+tempTableName)[_0xdc43('0x1c')](function(_0x1e0375){if(_0x1e0375!==null){var _0x2f9343=[];for(var _0x43bd5b=0x0;_0x43bd5b<_0x1e0375[_0xdc43('0x1d')];_0x43bd5b++){var _0x1e229f=_0x1e0375[_0x43bd5b];if(!_[_0xdc43('0x1e')](_0x1e229f[_0xdc43('0x13')])){if(!_[_0xdc43('0x1e')](_0x1e229f[_0xdc43('0x1f')]))_0x2f9343[_0xdc43('0x20')](insertAdditionalPhones(_0x1e229f));promisesContact['push']({'contact':_0x1e229f});}}}Promise[_0xdc43('0x21')](_0x2f9343)[_0xdc43('0x22')](function(){_0x20eb98({'val':0x1});});})['catch'](function(_0xed7e60){logger[_0xdc43('0x23')](_0xed7e60[_0xdc43('0x24')]);});});}function insertAdditionalPhones(_0xcb00fc){return new Promise(function(_0x529356,_0x1833af){var _0x4e1aa0=_0xcb00fc[_0xdc43('0x1f')];if(_[_0xdc43('0x1e')](_0x4e1aa0))_0x1833af({'val':0x0});else{var _0x44c778=_0x4e1aa0[_0xdc43('0x25')](';');var _0x2ceb34=[];orderBy=0x0;for(var _0x402557=0x0;_0x402557<_0x44c778[_0xdc43('0x1d')];_0x402557++){_0x2ceb34[_0xdc43('0x20')](splitAdditionalPhone(_0xcb00fc['id'],_0x44c778[_0x402557]));}Promise['all'](_0x2ceb34)[_0xdc43('0x22')](function(){_0x529356({'val':_0x44c778[_0xdc43('0x1d')]});});}});}function splitAdditionalPhone(_0x47aa49,_0x3aa728){return new Promise(function(_0x38b1c7,_0x33db24){var _0x25a4bf=_0x3aa728['split'](':');var _0x7a73e7=_0x25a4bf[0x0];var _0x4e823d=_0x25a4bf[0x1];if(_0x4e823d!==''){var _0x6a4a48=_0x4e823d[_0xdc43('0x25')]('|');var _0x25b609=[];for(var _0x38ff9f=0x0;_0x38ff9f<_0x6a4a48[_0xdc43('0x1d')];_0x38ff9f++){if(_0x6a4a48[_0x38ff9f]!==''){var _0x5659a3=_[_0xdc43('0x26')](promisesAdditionalPhones,{'contactId':_0x47aa49,'phone':_0x6a4a48[_0x38ff9f]});if(_0x5659a3[_0xdc43('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xdc43('0x20')]({'contactId':_0x47aa49,'contactTypeId':_0x7a73e7,'phone':_0x6a4a48[_0x38ff9f],'orderBy':orderBy});}}}_0x38b1c7({'ok':0x1});}else _0x38b1c7({'res':0x0});});}function createAdditionalPhone(_0x525cff,_0x3c5842,_0x40db8f,_0x136344){return new Promise(function(_0x3f29c7,_0x16bc87){return db[_0xdc43('0x27')][_0xdc43('0x28')]({'where':{'CmContactId':_0x525cff,'item':_0x40db8f}})['then'](function(_0x1f8209){if(_0x1f8209){return db['CmContactHasItem'][_0xdc43('0x29')]({'ItemTypeId':_0x3c5842,'OrderBy':_0x136344},{'where':{'CmContactId':_0x525cff,'item':_0x40db8f}})['then'](function(_0x1fd55e){_0x3f29c7({'res':_0xdc43('0x2a')});});}else{return db[_0xdc43('0x27')]['create']({'CmContactId':_0x525cff,'item':_0x40db8f,'ItemTypeId':_0x3c5842,'OrderBy':_0x136344,'ItemClass':_0xdc43('0x2b')})[_0xdc43('0x22')](function(_0x15f953){_0x3f29c7({'res':_0xdc43('0x2c')});});}});});}function updateContact(_0x2ecb8b){return new Promise(function(_0x662eaa,_0x3810d4){var _0xbfc537=_0x2ecb8b['id'];delete _0x2ecb8b['id'];return db[_0xdc43('0x2d')]['update'](_0x2ecb8b,{'where':{'id':_0xbfc537}})['then'](function(_0x760825){updatedRows+=0x1;return db[_0xdc43('0x2e')]['update']({'phone':_0x2ecb8b['phone']},{'where':{'ContactId':_0xbfc537}})[_0xdc43('0x22')](function(_0x22700a){_0x662eaa({'ret':'OK'});});});});}function insertCmHopper(_0xd44364,_0x32915b,_0x8d61c6,_0x114fd7,_0x1480ff){var _0x5779da=['cm_contacts.phone',_0xdc43('0x2f'),'cm_contacts.id','cm_contacts.ListId',_0x32915b+'.'+_0x114fd7,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xdc43('0x30'),_0xdc43('0x31'),'\x22'+_0x1480ff+'\x22'];return squel[_0xdc43('0x32')]()[_0xdc43('0x33')](_0xdc43('0x34'))[_0xdc43('0x35')](['phone',_0xdc43('0x36'),_0xdc43('0x37'),_0xdc43('0x38'),_0x114fd7,_0xdc43('0x39'),_0xdc43('0x3a'),_0xdc43('0x3b'),_0xdc43('0x3c'),'recallme'],squel['select']()[_0xdc43('0x3d')](_0x5779da)[_0xdc43('0x14')](_0x32915b)[_0xdc43('0x18')](_0xdc43('0x3e'),null,_0xdc43('0x3f')+_0x32915b+_0xdc43('0x40'))[_0xdc43('0x18')](_0x8d61c6,null,_0x8d61c6+_0xdc43('0x41')+_0x32915b+'.'+_0x114fd7)[_0xdc43('0x16')](_0x32915b+_0xdc43('0x42'),_0xd44364)[_0xdc43('0x16')](_0xdc43('0x43'),NOW)['where'](_0xdc43('0x44'),selectNotIn(_0x32915b,_0x8d61c6,_0x114fd7,_0xdc43('0x34'),[_0xdc43('0x45'),_0xdc43('0x46')]))['where'](_0xdc43('0x44'),selectNotIn(_0x32915b,_0x8d61c6,_0x114fd7,_0xdc43('0x34'),['\x22always\x22'])))[_0xdc43('0x47')]();}function insertCmHopperBlack(_0x32fef2,_0xe00efb,_0x415fbe,_0x1ee3ce){var _0x279310=['cm_contacts.phone',_0xdc43('0x48'),'cm_contacts.ListId',_0xe00efb+'.'+_0x1ee3ce,_0xdc43('0x49'),_0xdc43('0x4a')];return squel['insert']()[_0xdc43('0x33')](_0xdc43('0x4b'))[_0xdc43('0x35')]([_0xdc43('0x13'),'ContactId',_0xdc43('0x38'),_0x1ee3ce,_0xdc43('0x39'),'updatedAt'],squel[_0xdc43('0x12')]()[_0xdc43('0x3d')](_0x279310)[_0xdc43('0x14')](_0xe00efb)[_0xdc43('0x18')](_0xdc43('0x3e'),null,_0xdc43('0x3f')+_0xe00efb+_0xdc43('0x40'))['join'](_0x415fbe,null,_0x415fbe+'.id\x20=\x20'+_0xe00efb+'.'+_0x1ee3ce)['where'](_0xe00efb+_0xdc43('0x42'),_0x32fef2)[_0xdc43('0x16')](_0xdc43('0x43'),NOW)[_0xdc43('0x16')](_0xdc43('0x44'),squel[_0xdc43('0x12')]()[_0xdc43('0x4c')]('phone')[_0xdc43('0x14')](_0xdc43('0x4b'))[_0xdc43('0x16')](_0xdc43('0x4d'),_0x32fef2)[_0xdc43('0x16')](_0x1ee3ce+_0xdc43('0x4e'),_0xe00efb+'.'+_0x1ee3ce)))[_0xdc43('0x47')]();}function insertCmHopperAdditionalPhones(_0x8dd82d){var _0x53f9fb=['cm_hopper.id',_0xdc43('0x4f'),_0xdc43('0x50'),_0xdc43('0x51'),_0xdc43('0x52')];return squel[_0xdc43('0x32')]()[_0xdc43('0x33')](_0xdc43('0x53'))[_0xdc43('0x35')](['CmHopperId',_0xdc43('0x13'),_0xdc43('0x54'),_0xdc43('0x39'),_0xdc43('0x3a')],squel['select']()[_0xdc43('0x3d')](_0x53f9fb)[_0xdc43('0x14')](_0xdc43('0x34'))[_0xdc43('0x18')](_0xdc43('0x3e'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xdc43('0x18')]('cm_contact_has_items',null,_0xdc43('0x55'))[_0xdc43('0x16')](_0xdc43('0x56'),_0x8dd82d)[_0xdc43('0x16')](_0xdc43('0x43'),NOW))[_0xdc43('0x47')]();}function insertCmContact(_0x1e4bae,_0x42f440,_0x4bb7a9,_0x1cca43){var _0x224ae7=_[_0xdc43('0x57')](_[_0xdc43('0x58')](_0x1cca43),[_0xdc43('0x38'),_0xdc43('0x59'),_0xdc43('0x39'),_0xdc43('0x3a')]);return squel[_0xdc43('0x32')]()[_0xdc43('0x33')](_0xdc43('0x3e'))['fromQuery'](_0x224ae7,squel[_0xdc43('0x12')]()['fields'](_0x224ae7)[_0xdc43('0x14')](_0x42f440)[_0xdc43('0x16')]('('+_0x4bb7a9[_0xdc43('0x18')](',')+_0xdc43('0x5a'),squel[_0xdc43('0x12')]()['fields'](_0x4bb7a9)['from']('cm_contacts')[_0xdc43('0x16')](_0xdc43('0x4d'),_0x1e4bae))[_0xdc43('0x16')](_0xdc43('0x5b'),squel[_0xdc43('0x12')]()['field'](_0xdc43('0x5c'),_0xdc43('0x5d'))['from'](_0x42f440)[_0xdc43('0x5e')](_0x4bb7a9[_0xdc43('0x18')](','))))['toString']();}function handleStop(){logger[_0xdc43('0x5f')](_0xdc43('0x60'));stopped=!![];}function handleUncaughtException(_0x266045){logger['error'](_0x266045[_0xdc43('0x24')]);process[_0xdc43('0x61')](0x1);}function handleError(_0x2cd67a,_0xbe993d){stats['errors'][_0xdc43('0x20')]({'name':_0xbe993d[_0xdc43('0x62')],'message':_0xbe993d[_0xdc43('0x24')],'row':_0x2cd67a});}function handleQuery(_0x39b405){logger[_0xdc43('0x5f')](_0x39b405);return db[_0xdc43('0x19')]['query'](_0x39b405)['spread'](function(_0x12f63e){results[_0xdc43('0x20')](_0x12f63e);})['catch'](function(_0x2dcb9f){logger[_0xdc43('0x23')](_0x2dcb9f[_0xdc43('0x24')]);});}function main(_0x2c760f,_0x29b46a,_0x350090,_0x3df51d){logger[_0xdc43('0x5f')](_0xdc43('0x63'),_0x2c760f,JSON[_0xdc43('0x64')](_0x29b46a));process['send'](_0xdc43('0x65'));var _0x42de72=_0x29b46a[_0xdc43('0x66')];var _0x37d4a1=_[_0xdc43('0x67')](_0x42de72);var _0x164688=_0x29b46a['socket_timestamp'];var _0x122cdd=path[_0xdc43('0x18')](config['root'],_0xdc43('0x68'),_0x164688+'.csv');logger['info'](_0xdc43('0x69'),_0x29b46a);db[_0xdc43('0x6a')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x58a830){for(var _0x2c267a=0x0;_0x2c267a<_0x58a830[_0xdc43('0x1d')];_0x2c267a++){if(_0x58a830[_0x2c267a][_0xdc43('0x6b')]in _0x42de72){contactItemTypes['push'](_0x58a830[_0x2c267a]);delete _0x37d4a1[_0x58a830[_0x2c267a]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x37d4a1[_0xdc43('0x1f')]='';var _0x5935c7=_[_0xdc43('0x58')](_0x37d4a1)[_0xdc43('0x18')]();logger[_0xdc43('0x5f')](_0xdc43('0x6c'),_0x5935c7);fs[_0xdc43('0x6d')](_0x122cdd,_0x5935c7+'\x0a');Papa['parse'](fs[_0xdc43('0x6e')](_0x2c760f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x344bda,_0x292117){try{for(var _0x3e9f42=0x0,_0x16840c=[];_0x3e9f42<_0x344bda['data'][_0xdc43('0x1d')];_0x3e9f42++){stats['rows']+=0x1;if(_0x344bda['errors'][_0x3e9f42]){handleError(_0x344bda['data'][_0x3e9f42],_0x344bda[_0xdc43('0x6f')][_0x3e9f42]);}else{var _0x3977f2=[];var _0x1c659b=[];for(var _0x3cb011 in _0x42de72){let _0x145927=contactItemTypes[_0xdc43('0x70')](_0x10fdd3=>_0x10fdd3[_0xdc43('0x6b')]===_0x3cb011);if(_['isNil'](_0x145927)){if(_0x42de72[_0xdc43('0x71')](_0x3cb011)){if(_0x344bda['data'][_0x3e9f42][_0x42de72[_0x3cb011]]){var _0x50d292=_[_0xdc43('0x72')](_0x344bda[_0xdc43('0x73')][_0x3e9f42][_0x42de72[_0x3cb011]][_0xdc43('0x74')](/"/g,'\x27'));switch(_0x3cb011){case _0xdc43('0x36'):var _0x4d8f8b=moment(_0x50d292,_0xdc43('0xe'),!![]);if(_0x4d8f8b[_0xdc43('0x75')]()){_0x16840c[_0xdc43('0x20')]('\x22'+_0x50d292+'\x22');}else{_0x3977f2['push'](_0xdc43('0x76'));}break;case _0xdc43('0x3b'):var _0x1c05e0=parseInt(_0x50d292);_0x50d292=_[_0xdc43('0x77')](_0x1c05e0)||_0x1c05e0<0x0||_0x1c05e0>0x4?_0x3df51d?0x3:0x2:_0x1c05e0;_0x16840c[_0xdc43('0x20')]('\x22'+_0x50d292+'\x22');break;case _0xdc43('0x3c'):var _0x4ee3a3=parseInt(_0x50d292);if(_[_0xdc43('0x78')](_0x4ee3a3)&&_[_0xdc43('0x79')](_0x350090,_0x4ee3a3)){_0x16840c[_0xdc43('0x20')]('\x22'+_0x4ee3a3+'\x22');}else{_0x3977f2[_0xdc43('0x20')](_0xdc43('0x7a'));}break;case _0xdc43('0x7b'):if(isEmail(_0x50d292)){_0x16840c[_0xdc43('0x20')]('\x22'+_0x50d292+'\x22');}else{_0x3977f2[_0xdc43('0x20')](_0xdc43('0x7c'));}break;case _0xdc43('0x7d'):var _0x5611ba=moment(_0x50d292,_0xdc43('0x7e'),!![]);if(_0x5611ba[_0xdc43('0x75')]()){_0x16840c[_0xdc43('0x20')]('\x22'+_0x50d292+'\x22');}else{_0x3977f2['push'](_0xdc43('0x7f'));}break;default:_0x16840c[_0xdc43('0x20')]('\x22'+_0x50d292+'\x22');}}else{switch(_0x3cb011){case _0xdc43('0x80'):case'phone':_0x3977f2[_0xdc43('0x20')](_0x3cb011+_0xdc43('0x81'));break;default:_0x16840c[_0xdc43('0x20')]('\x22\x22');}}}}else{var _0x5d5828='';for(var _0x5e1a38=0x0;_0x5e1a38<_0x42de72[_0x3cb011][_0xdc43('0x1d')];_0x5e1a38++){var _0x50d292=_[_0xdc43('0x72')](_0x344bda[_0xdc43('0x73')][_0x3e9f42][_0x42de72[_0x3cb011][_0x5e1a38]][_0xdc43('0x74')](/"/g,'\x27'));if(_0x5d5828=='')_0x5d5828=_0x50d292;else _0x5d5828+='|'+_0x50d292;}_0x1c659b[_0xdc43('0x20')](_0x145927['id']+':'+_0x5d5828);}}if(hasAdditionalPhones){_0x16840c[_0xdc43('0x20')]('\x22'+_0x1c659b[_0xdc43('0x18')](';')+'\x22');}if(_0x3977f2[_0xdc43('0x1d')]){handleError(_0x344bda[_0xdc43('0x73')][_0x3e9f42],{'code':_0xdc43('0x82'),'message':_0x3977f2[_0xdc43('0x18')]()});}else{fs[_0xdc43('0x83')](_0x122cdd,_0x16840c[_0xdc43('0x18')]()+'\x0a');}_0x16840c=[];}if(!(stats['rows']%0xc8)){socket[_0xdc43('0x84')](_0xdc43('0x85')+_0x164688,stats);stats[_0xdc43('0x6f')]=[];}}if(stopped){logger['info'](_0xdc43('0x86'));_0x292117[_0xdc43('0x87')]();}}catch(_0x3d2b79){handleError(_0x344bda['data'][_0x3e9f42],{'code':_0xdc43('0x88'),'message':_0x3d2b79['message']});logger[_0xdc43('0x23')](_0xdc43('0x89'),_0x3d2b79[_0xdc43('0x24')]);}},'complete':function(){try{var _0x23fa9b=[];var _0x1ca5d2=tempTableName;_0x23fa9b[_0xdc43('0x20')](_0xdc43('0x8a')+_0x1ca5d2+_0xdc43('0x8b'));logger[_0xdc43('0x5f')]('CIS\x20len',contactItemTypes['length']);var _0x279fe9=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',_0x122cdd,_0x1ca5d2,_0x5935c7,_0x29b46a['ListId'],_0x29b46a['CompanyId']||null,NOW,NOW);if(_[_0xdc43('0x1e')](_0x42de72[_0xdc43('0x36')])){_0x279fe9+=_0xdc43('0x8c');}_0x23fa9b[_0xdc43('0x20')](_0x279fe9);BPromise[_0xdc43('0x8d')](_0x23fa9b,handleQuery)[_0xdc43('0x22')](function(_0x3dfc55){BPromise[_0xdc43('0x21')]([handleAdditionalPhones()])['then'](function(){_0x23fa9b=[];for(var _0x3bd87e=0x0;_0x3bd87e\x20\x20');}var _0x32c67a=path[_0xdc43('0x18')](config[_0xdc43('0x98')],_0xdc43('0x68'),process['argv'][0x2]);if(!fs[_0xdc43('0x99')](_0x32c67a)){throw new Error(_0xdc43('0x9a'));}var _0x156d41={};try{_0x156d41=JSON['parse'](process[_0xdc43('0x97')][0x3]);if(!_0x156d41[_0xdc43('0x66')]){throw new Error(_0xdc43('0x9b'));}var _0x5f263d=0x0;if(_0x156d41[_0xdc43('0x66')][_0xdc43('0x3c')]){_0x5f263d=0x1;}if(!_0x156d41[_0xdc43('0x38')]){throw new Error(_0xdc43('0x9c'));}}catch(_0x373962){throw new Error(_0xdc43('0x9d'));}var _0x1d9b34=[];try{_0x1d9b34=_['map'](JSON[_0xdc43('0x9e')](process['argv'][0x4]),'id');}catch(_0x492955){logger[_0xdc43('0x5f')](_0xdc43('0x9f'));}main(_0x32c67a,_0x156d41,_0x1d9b34,_0x5f263d);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xa81b=['appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','localhost','redis','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','sequelize','spread','length','isNil','AdditionalPhones','push','catch','error','message','split','all','then','filter','CmContactHasItem','update','updated','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ListId','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','errors','code','stringify','send','start','binding','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','data','rows','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow'];(function(_0x382caa,_0x464054){var _0x571244=function(_0x4c4cf8){while(--_0x4c4cf8){_0x382caa['push'](_0x382caa['shift']());}};_0x571244(++_0x464054);}(_0xa81b,0x152));var _0xba81=function(_0x2e4e48,_0x322a92){_0x2e4e48=_0x2e4e48-0x0;var _0x2642a0=_0xa81b[_0x2e4e48];return _0x2642a0;};'use strict';var fs=require('fs');var path=require(_0xba81('0x0'));var _=require(_0xba81('0x1'));var Papa=require(_0xba81('0x2'));var util=require(_0xba81('0x3'));var BPromise=require(_0xba81('0x4'));var moment=require(_0xba81('0x5'));var squel=require(_0xba81('0x6'));var Redis=require(_0xba81('0x7'));var db=require(_0xba81('0x8'))['db'];var config=require(_0xba81('0x9'));var logger=require(_0xba81('0xa'))('import');config['redis']=_[_0xba81('0xb')](config['redis'],{'host':_0xba81('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba81('0xd')]));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()[_0xba81('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xba81('0xf')+moment()[_0xba81('0xe')](_0xba81('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x18d479){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))*$/[_0xba81('0x11')](_0x18d479);}function selectNotIn(_0x2599c7,_0x2f2ab1,_0x51512d,_0x554be7,_0x5c1253){return squel[_0xba81('0x12')]()[_0xba81('0x13')](_0xba81('0x14'))[_0xba81('0x15')](_0x554be7)[_0xba81('0x16')](_0x2f2ab1,null,_0x2f2ab1+'.id\x20=\x20'+_0x554be7+'.'+_0x51512d)['where'](_0x554be7+'.'+_0x51512d+'\x20=\x20'+_0x2599c7+'.'+_0x51512d)[_0xba81('0x17')](_0x2f2ab1+'.dialCheckDuplicateType\x20IN\x20('+_0x5c1253['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x23c52d,_0x6047d3){promisesAdditionalPhones=[];promisesContact=[];return db[_0xba81('0x18')]['query']('select\x20*\x20from\x20'+tempTableName)[_0xba81('0x19')](function(_0x54eac6){if(_0x54eac6!==null){var _0x52123d=[];for(var _0x392e55=0x0;_0x392e55<_0x54eac6[_0xba81('0x1a')];_0x392e55++){var _0x469fa1=_0x54eac6[_0x392e55];if(!_[_0xba81('0x1b')](_0x469fa1[_0xba81('0x14')])){if(!_['isNil'](_0x469fa1[_0xba81('0x1c')]))_0x52123d['push'](insertAdditionalPhones(_0x469fa1));promisesContact[_0xba81('0x1d')]({'contact':_0x469fa1});}}}Promise['all'](_0x52123d)['then'](function(){_0x23c52d({'val':0x1});});})[_0xba81('0x1e')](function(_0x1c969a){logger[_0xba81('0x1f')](_0x1c969a[_0xba81('0x20')]);});});}function insertAdditionalPhones(_0x360b73){return new Promise(function(_0xf5fb99,_0x174668){var _0x11ef5a=_0x360b73[_0xba81('0x1c')];if(_[_0xba81('0x1b')](_0x11ef5a))_0x174668({'val':0x0});else{var _0x5205c0=_0x11ef5a[_0xba81('0x21')](';');var _0xb11f41=[];orderBy=0x0;for(var _0x2f443a=0x0;_0x2f443a<_0x5205c0[_0xba81('0x1a')];_0x2f443a++){_0xb11f41[_0xba81('0x1d')](splitAdditionalPhone(_0x360b73['id'],_0x5205c0[_0x2f443a]));}Promise[_0xba81('0x22')](_0xb11f41)[_0xba81('0x23')](function(){_0xf5fb99({'val':_0x5205c0['length']});});}});}function splitAdditionalPhone(_0x46ae93,_0x51a80a){return new Promise(function(_0x4ba8ea,_0x5b6681){var _0x2d0e53=_0x51a80a[_0xba81('0x21')](':');var _0x440be3=_0x2d0e53[0x0];var _0xcf8c59=_0x2d0e53[0x1];if(_0xcf8c59!==''){var _0x615ef1=_0xcf8c59[_0xba81('0x21')]('|');var _0x2ae9a1=[];for(var _0xcf0089=0x0;_0xcf0089<_0x615ef1[_0xba81('0x1a')];_0xcf0089++){if(_0x615ef1[_0xcf0089]!==''){var _0x5dfaa0=_[_0xba81('0x24')](promisesAdditionalPhones,{'contactId':_0x46ae93,'phone':_0x615ef1[_0xcf0089]});if(_0x5dfaa0[_0xba81('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xba81('0x1d')]({'contactId':_0x46ae93,'contactTypeId':_0x440be3,'phone':_0x615ef1[_0xcf0089],'orderBy':orderBy});}}}_0x4ba8ea({'ok':0x1});}else _0x4ba8ea({'res':0x0});});}function createAdditionalPhone(_0xb9e2b4,_0x4f1830,_0x3ab147,_0x42a71f){return new Promise(function(_0x2624ee,_0x2bf8cd){return db[_0xba81('0x25')]['findOne']({'where':{'CmContactId':_0xb9e2b4,'item':_0x3ab147}})['then'](function(_0x5e572e){if(_0x5e572e){return db[_0xba81('0x25')][_0xba81('0x26')]({'ItemTypeId':_0x4f1830,'OrderBy':_0x42a71f},{'where':{'CmContactId':_0xb9e2b4,'item':_0x3ab147}})[_0xba81('0x23')](function(_0xef1985){_0x2624ee({'res':_0xba81('0x27')});});}else{return db[_0xba81('0x25')]['create']({'CmContactId':_0xb9e2b4,'item':_0x3ab147,'ItemTypeId':_0x4f1830,'OrderBy':_0x42a71f,'ItemClass':_0xba81('0x28')})[_0xba81('0x23')](function(_0x1b7f85){_0x2624ee({'res':'inserted'});});}});});}function updateContact(_0xe4eebc){return new Promise(function(_0x38f886,_0x26c792){var _0x57a801=_0xe4eebc['id'];delete _0xe4eebc['id'];return db[_0xba81('0x29')][_0xba81('0x26')](_0xe4eebc,{'where':{'id':_0x57a801}})['then'](function(_0x1bb827){updatedRows+=0x1;return db[_0xba81('0x2a')]['update']({'phone':_0xe4eebc['phone']},{'where':{'ContactId':_0x57a801}})[_0xba81('0x23')](function(_0x42f4d9){_0x38f886({'ret':'OK'});});});});}function insertCmHopper(_0x5947b7,_0x31fea9,_0x10e3f7,_0xa0df3a,_0x3a9550){var _0x2cc4fc=[_0xba81('0x2b'),_0xba81('0x2c'),'cm_contacts.id',_0xba81('0x2d'),_0x31fea9+'.'+_0xa0df3a,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3a9550+'\x22'];return squel[_0xba81('0x2e')]()[_0xba81('0x2f')](_0xba81('0x30'))[_0xba81('0x31')](['phone',_0xba81('0x32'),_0xba81('0x33'),'ListId',_0xa0df3a,_0xba81('0x34'),_0xba81('0x35'),_0xba81('0x36'),_0xba81('0x37'),_0xba81('0x38')],squel[_0xba81('0x12')]()[_0xba81('0x39')](_0x2cc4fc)[_0xba81('0x15')](_0x31fea9)['join'](_0xba81('0x3a'),null,_0xba81('0x3b')+_0x31fea9+_0xba81('0x3c'))[_0xba81('0x16')](_0x10e3f7,null,_0x10e3f7+_0xba81('0x3d')+_0x31fea9+'.'+_0xa0df3a)[_0xba81('0x17')](_0x31fea9+_0xba81('0x3e'),_0x5947b7)['where'](_0xba81('0x3f'),NOW)[_0xba81('0x17')](_0xba81('0x40'),selectNotIn(_0x31fea9,_0x10e3f7,_0xa0df3a,_0xba81('0x30'),[_0xba81('0x41'),_0xba81('0x42')]))[_0xba81('0x17')](_0xba81('0x40'),selectNotIn(_0x31fea9,_0x10e3f7,_0xa0df3a,'cm_hopper',['\x22always\x22'])))[_0xba81('0x43')]();}function insertCmHopperBlack(_0x592e26,_0x37ab3b,_0x2b6807,_0x246563){var _0x28f701=[_0xba81('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x37ab3b+'.'+_0x246563,_0xba81('0x44'),_0xba81('0x45')];return squel[_0xba81('0x2e')]()['into'](_0xba81('0x46'))['fromQuery'](['phone','ContactId',_0xba81('0x47'),_0x246563,_0xba81('0x34'),_0xba81('0x35')],squel[_0xba81('0x12')]()[_0xba81('0x39')](_0x28f701)[_0xba81('0x15')](_0x37ab3b)[_0xba81('0x16')](_0xba81('0x3a'),null,_0xba81('0x3b')+_0x37ab3b+'.CmListId')[_0xba81('0x16')](_0x2b6807,null,_0x2b6807+_0xba81('0x3d')+_0x37ab3b+'.'+_0x246563)[_0xba81('0x17')](_0x37ab3b+'.CmListId\x20=\x20?',_0x592e26)[_0xba81('0x17')](_0xba81('0x3f'),NOW)[_0xba81('0x17')](_0xba81('0x40'),squel['select']()[_0xba81('0x13')]('phone')[_0xba81('0x15')](_0xba81('0x46'))[_0xba81('0x17')](_0xba81('0x48'),_0x592e26)[_0xba81('0x17')](_0x246563+_0xba81('0x49'),_0x37ab3b+'.'+_0x246563)))['toString']();}function insertCmHopperAdditionalPhones(_0x2e9da0){var _0x25cc9c=['cm_hopper.id',_0xba81('0x4a'),_0xba81('0x4b'),_0xba81('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0xba81('0x2e')]()[_0xba81('0x2f')]('cm_hopper_additional_phones')[_0xba81('0x31')]([_0xba81('0x4d'),_0xba81('0x14'),_0xba81('0x4e'),_0xba81('0x34'),_0xba81('0x35')],squel[_0xba81('0x12')]()['fields'](_0x25cc9c)[_0xba81('0x15')](_0xba81('0x30'))[_0xba81('0x16')](_0xba81('0x3a'),null,_0xba81('0x4f'))[_0xba81('0x16')](_0xba81('0x50'),null,_0xba81('0x51'))[_0xba81('0x17')](_0xba81('0x52'),_0x2e9da0)[_0xba81('0x17')](_0xba81('0x3f'),NOW))[_0xba81('0x43')]();}function insertCmContact(_0x3c74b1,_0xf99c9b,_0x26f125,_0x3a629f){var _0x4c85db=_[_0xba81('0x53')](_['keys'](_0x3a629f),[_0xba81('0x47'),_0xba81('0x54'),_0xba81('0x34'),_0xba81('0x35')]);return squel['insert']()[_0xba81('0x2f')]('cm_contacts')[_0xba81('0x31')](_0x4c85db,squel['select']()[_0xba81('0x39')](_0x4c85db)[_0xba81('0x15')](_0xf99c9b)[_0xba81('0x17')]('('+_0x26f125[_0xba81('0x16')](',')+_0xba81('0x55'),squel['select']()[_0xba81('0x39')](_0x26f125)[_0xba81('0x15')](_0xba81('0x3a'))[_0xba81('0x17')](_0xba81('0x48'),_0x3c74b1))[_0xba81('0x17')](_0xba81('0x56'),squel[_0xba81('0x12')]()[_0xba81('0x13')]('MIN(id)',_0xba81('0x57'))['from'](_0xf99c9b)[_0xba81('0x58')](_0x26f125['join'](','))))['toString']();}function handleStop(){logger[_0xba81('0x59')](_0xba81('0x5a'));stopped=!![];}function handleUncaughtException(_0x4d06c3){logger[_0xba81('0x1f')](_0x4d06c3['message']);process['exit'](0x1);}function handleError(_0x28351c,_0x6a722f){stats[_0xba81('0x5b')][_0xba81('0x1d')]({'name':_0x6a722f[_0xba81('0x5c')],'message':_0x6a722f[_0xba81('0x20')],'row':_0x28351c});}function handleQuery(_0x58ea70){logger['info'](_0x58ea70);return db['sequelize']['query'](_0x58ea70)[_0xba81('0x19')](function(_0x2e6b29){results['push'](_0x2e6b29);})[_0xba81('0x1e')](function(_0x4ee832){logger[_0xba81('0x1f')](_0x4ee832['message']);});}function main(_0x4874bd,_0x2a104b,_0xaba358,_0x4be8ea){logger['info']('main',_0x4874bd,JSON[_0xba81('0x5d')](_0x2a104b));process[_0xba81('0x5e')](_0xba81('0x5f'));var _0x5346a0=_0x2a104b[_0xba81('0x60')];var _0x462d24=_['clone'](_0x5346a0);var _0x56b161=_0x2a104b[_0xba81('0x61')];var _0x4b4498=path['join'](config[_0xba81('0x62')],'server/files/tmp',_0x56b161+_0xba81('0x63'));logger[_0xba81('0x59')](_0xba81('0x64'),_0x2a104b);db[_0xba81('0x65')][_0xba81('0x66')]({'raw':!![],'attributes':['id',_0xba81('0x67')]})[_0xba81('0x23')](function(_0x4e068f){for(var _0x148794=0x0;_0x148794<_0x4e068f[_0xba81('0x1a')];_0x148794++){if(_0x4e068f[_0x148794][_0xba81('0x67')]in _0x5346a0){contactItemTypes[_0xba81('0x1d')](_0x4e068f[_0x148794]);delete _0x462d24[_0x4e068f[_0x148794][_0xba81('0x67')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x462d24[_0xba81('0x1c')]='';var _0x6706e3=_[_0xba81('0x68')](_0x462d24)[_0xba81('0x16')]();logger[_0xba81('0x59')](_0xba81('0x69'),_0x6706e3);fs[_0xba81('0x6a')](_0x4b4498,_0x6706e3+'\x0a');Papa[_0xba81('0x6b')](fs['createReadStream'](_0x4874bd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2a4381,_0x518f22){try{for(var _0x358710=0x0,_0x1ca9b1=[];_0x358710<_0x2a4381[_0xba81('0x6c')][_0xba81('0x1a')];_0x358710++){stats[_0xba81('0x6d')]+=0x1;if(_0x2a4381[_0xba81('0x5b')][_0x358710]){handleError(_0x2a4381['data'][_0x358710],_0x2a4381['errors'][_0x358710]);}else{var _0x2aaee1=[];var _0x3cce62=[];for(var _0x376289 in _0x5346a0){let _0x23614f=contactItemTypes[_0xba81('0x6e')](_0x179c51=>_0x179c51['name']===_0x376289);if(_[_0xba81('0x1b')](_0x23614f)){if(_0x5346a0[_0xba81('0x6f')](_0x376289)){if(_0x2a4381['data'][_0x358710][_0x5346a0[_0x376289]]){var _0x60dd53=_[_0xba81('0x70')](_0x2a4381[_0xba81('0x6c')][_0x358710][_0x5346a0[_0x376289]][_0xba81('0x71')](/"/g,'\x27'));switch(_0x376289){case _0xba81('0x32'):var _0x7066a1=moment(_0x60dd53,_0xba81('0x72'),!![]);if(_0x7066a1[_0xba81('0x73')]()){_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x60dd53+'\x22');}else{_0x2aaee1[_0xba81('0x1d')](_0xba81('0x74'));}break;case _0xba81('0x36'):var _0x3b2434=parseInt(_0x60dd53);_0x60dd53=_[_0xba81('0x75')](_0x3b2434)||_0x3b2434<0x0||_0x3b2434>0x4?_0x4be8ea?0x3:0x2:_0x3b2434;_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x60dd53+'\x22');break;case _0xba81('0x37'):var _0x17ac1d=parseInt(_0x60dd53);if(_[_0xba81('0x76')](_0x17ac1d)&&_[_0xba81('0x77')](_0xaba358,_0x17ac1d)){_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x17ac1d+'\x22');}else{_0x2aaee1[_0xba81('0x1d')](_0xba81('0x78'));}break;case _0xba81('0x79'):if(isEmail(_0x60dd53)){_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x60dd53+'\x22');}else{_0x2aaee1[_0xba81('0x1d')](_0xba81('0x7a'));}break;case _0xba81('0x7b'):var _0x5308b5=moment(_0x60dd53,_0xba81('0x7c'),!![]);if(_0x5308b5['isValid']()){_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x60dd53+'\x22');}else{_0x2aaee1[_0xba81('0x1d')](_0xba81('0x7d'));}break;default:_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x60dd53+'\x22');}}else{switch(_0x376289){case'firstName':case _0xba81('0x14'):_0x2aaee1['push'](_0x376289+'\x20not\x20specified');break;default:_0x1ca9b1['push']('\x22\x22');}}}}else{var _0x12ace8='';for(var _0x4e4240=0x0;_0x4e4240<_0x5346a0[_0x376289][_0xba81('0x1a')];_0x4e4240++){var _0x60dd53=_[_0xba81('0x70')](_0x2a4381[_0xba81('0x6c')][_0x358710][_0x5346a0[_0x376289][_0x4e4240]][_0xba81('0x71')](/"/g,'\x27'));if(_0x12ace8=='')_0x12ace8=_0x60dd53;else _0x12ace8+='|'+_0x60dd53;}_0x3cce62[_0xba81('0x1d')](_0x23614f['id']+':'+_0x12ace8);}}if(hasAdditionalPhones){_0x1ca9b1[_0xba81('0x1d')]('\x22'+_0x3cce62['join'](';')+'\x22');}if(_0x2aaee1['length']){handleError(_0x2a4381['data'][_0x358710],{'code':_0xba81('0x7e'),'message':_0x2aaee1[_0xba81('0x16')]()});}else{fs[_0xba81('0x7f')](_0x4b4498,_0x1ca9b1[_0xba81('0x16')]()+'\x0a');}_0x1ca9b1=[];}if(!(stats[_0xba81('0x6d')]%0xc8)){socket[_0xba81('0x80')](_0xba81('0x81')+_0x56b161,stats);stats['errors']=[];}}if(stopped){logger[_0xba81('0x59')](_0xba81('0x82'));_0x518f22[_0xba81('0x83')]();}}catch(_0x3cf13d){handleError(_0x2a4381[_0xba81('0x6c')][_0x358710],{'code':'SystemError','message':_0x3cf13d[_0xba81('0x20')]});logger['error'](_0xba81('0x84'),_0x3cf13d[_0xba81('0x20')]);}},'complete':function(){try{var _0x16543c=[];var _0x3a4b72=tempTableName;_0x16543c[_0xba81('0x1d')](_0xba81('0x85')+_0x3a4b72+_0xba81('0x86'));logger[_0xba81('0x59')](_0xba81('0x87'),contactItemTypes[_0xba81('0x1a')]);var _0x433335=util[_0xba81('0xe')](_0xba81('0x88'),_0x4b4498,_0x3a4b72,_0x6706e3,_0x2a104b[_0xba81('0x47')],_0x2a104b[_0xba81('0x54')]||null,NOW,NOW);if(_[_0xba81('0x1b')](_0x5346a0[_0xba81('0x32')])){_0x433335+=_0xba81('0x89');}_0x16543c[_0xba81('0x1d')](_0x433335);BPromise[_0xba81('0x8a')](_0x16543c,handleQuery)[_0xba81('0x23')](function(_0x514442){BPromise[_0xba81('0x22')]([handleAdditionalPhones()])[_0xba81('0x23')](function(){_0x16543c=[];for(var _0x50346b=0x0;_0x50346b=_0x3ec1d2){return _0x207f39[_0x771d('0xf')](0x193)[_0x771d('0x10')]({'message':util['format'](_0x771d('0x11'),_0x14b2a3)});}_0x11a0f0();})[_0x771d('0x12')](function(_0x26f7a5){_0x11a0f0(_0x26f7a5);});});}function isUserLimit(){return isLimit(_0x771d('0x13'),0x1,db[_0x771d('0x14')],{'where':{'$or':[{'role':_0x771d('0x15')},{'role':_0x771d('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x78c9=['data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x385603,_0x1cf762){var _0x2e10ca=function(_0x1824c0){while(--_0x1824c0){_0x385603['push'](_0x385603['shift']());}};_0x2e10ca(++_0x1cf762);}(_0x78c9,0x167));var _0x978c=function(_0x5d00c8,_0x29a6fb){_0x5d00c8=_0x5d00c8-0x0;var _0x378880=_0x78c9[_0x5d00c8];return _0x378880;};'use strict';var crypto=require(_0x978c('0x0'));var util=require(_0x978c('0x1'));var compose=require(_0x978c('0x2'));var db=require(_0x978c('0x3'))['db'];var config=require(_0x978c('0x4'));function getValueFromLicense(_0x256013,_0x45bb91){if(_0x256013&&_0x45bb91){if(_0x45bb91[_0x978c('0x5')]&&_0x45bb91[_0x978c('0x6')]){var _0x588b75=_0x45bb91['data1'];var _0x4bfd70=_0x45bb91[_0x978c('0x6')];var _0x1f44d9=_0x588b75[_0x978c('0x7')]('-')[0x4];var _0x182ea5=_0x588b75[_0x978c('0x7')]('-')[0x0];var _0x9efa2a=crypto[_0x978c('0x8')]('aes-256-ctr',util[_0x978c('0x9')](_0x978c('0xa'),_0x1f44d9,_0x588b75,_0x182ea5));var _0x3cb25d=_0x9efa2a[_0x978c('0xb')](_0x4bfd70,_0x978c('0xc'),_0x978c('0xd'));_0x3cb25d+=_0x9efa2a[_0x978c('0xe')]('utf8');var _0xa1c092=JSON[_0x978c('0xf')](_0x3cb25d);return _0xa1c092[_0x978c('0x10')](_0x256013)?_0xa1c092[_0x256013]:null;}}return null;}function isLimit(_0x2ff595,_0x185b17,_0x16cf30,_0x214255){var _0x31f7a5=_0x185b17;return compose()['use'](function(_0xd97da9,_0x1a6583,_0x111966){return db['License'][_0x978c('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x978c('0x12')](function(_0x474df4){var _0x51a25e=getValueFromLicense(_0x2ff595,_0x474df4);return _0x51a25e?_0x51a25e:_0x31f7a5;})[_0x978c('0x12')](function(_0x188fa6){_0x31f7a5=_0x188fa6;return _0x16cf30[_0x978c('0x13')](_0x214255);})[_0x978c('0x12')](function(_0x25cbb9){if(_0x25cbb9>=_0x31f7a5){return _0x1a6583[_0x978c('0x14')](0x193)['json']({'message':util[_0x978c('0x9')](_0x978c('0x15'),_0x2ff595)});}_0x111966();})[_0x978c('0x16')](function(_0x168503){_0x111966(_0x168503);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x978c('0x17')],{'where':{'$or':[{'role':_0x978c('0x18')},{'role':_0x978c('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b34f238..bc2f497 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 _0xfeaf=['slice','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','value','includes','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','start','$between','shift','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split'];(function(_0x2c61f8,_0xb8a4dd){var _0x4badd1=function(_0x548e80){while(--_0x548e80){_0x2c61f8['push'](_0x2c61f8['shift']());}};_0x4badd1(++_0xb8a4dd);}(_0xfeaf,0x1ef));var _0xffea=function(_0x203008,_0x4de77a){_0x203008=_0x203008-0x0;var _0x2cb771=_0xfeaf[_0x203008];return _0x2cb771;};'use strict';var _=require(_0xffea('0x0'));var moment=require(_0xffea('0x1'));exports[_0xffea('0x2')]=function(_0x2a6ec2){var _0x2da375={'conditions':[]};_0x2da375['sqlOperator']=_[_0xffea('0x3')](_0x2a6ec2,_0xffea('0x4'))?'or':_0xffea('0x5');var _0xc4885f=_0x2a6ec2[_0xffea('0x6')](_0xffea('0x7'),'')['replace'](_0xffea('0x4'),'')[_0xffea('0x8')]('||');for(var _0x1b8f2e=0x0;_0x1b8f2e<_0xc4885f['length'];_0x1b8f2e++){var _0x570975=_0xc4885f[_0x1b8f2e]['split'](':=');var _0x184a69=_0x570975[0x0];var _0x2b1b40=_0x570975[_0xffea('0x9')](0x1);_0x2b1b40['forEach'](function(_0x48b420){var _0x2fc992=_0x48b420[_0xffea('0x8')]('[')['shift']();var _0x546549=_0x48b420['match'](/\[(.*?)\]/g);_0x546549['forEach'](function(_0x393851){var _0x1519ab=_0x393851[_0xffea('0x8')]('[')['filter'](function(_0x895394){return _0x895394[_0xffea('0xa')](']')>-0x1;})[_0xffea('0xb')](function(_0x5b485d){return _0x5b485d['split'](']')[0x0];})[0x0];_0x2da375[_0xffea('0xc')][_0xffea('0xd')]({'field':_0x184a69,'operator':_0x2fc992,'value':_0x1519ab});});});}return _0x2da375;};exports[_0xffea('0xe')]=function(_0xd6f3cc,_0x2836d7,_0x243609){var _0x21d09f={};if(_0x2836d7===_0xffea('0xf')){if(_0x243609['operator']===_0xffea('0x10')){_0x243609[_0xffea('0x11')]='$between';_0x243609[_0xffea('0x12')]+=','+_0x243609[_0xffea('0x12')];}else if(_[_0xffea('0x13')](['$gt',_0xffea('0x14')],_0x243609[_0xffea('0x11')])){_0x243609[_0xffea('0x12')]=moment(_0x243609[_0xffea('0x12')])['add'](0x1,_0xffea('0x15'))[_0xffea('0x16')](_0xffea('0x17'));}}if(_0x243609[_0xffea('0x18')]){_0x2836d7=_0x243609['castTo'];_0x21d09f[_0xffea('0x19')]=_0xffea('0x1a')+_0xd6f3cc+'.'+_0x243609[_0xffea('0x1b')]+_0xffea('0x1c')+_0x243609[_0xffea('0x18')]+')\x20'+parseOperator(_0x243609[_0xffea('0x11')]);}else{_0x21d09f[_0xffea('0x19')]=_0xd6f3cc+'.'+_0x243609['field']+'\x20'+parseOperator(_0x243609[_0xffea('0x11')]);}if(_[_0xffea('0x13')](['$ne',_0xffea('0x1d')],_0x243609['operator']))_0x21d09f[_0xffea('0x19')]='('+_0x21d09f[_0xffea('0x19')]+_0xffea('0x1e')+_0xd6f3cc+'.'+_0x243609[_0xffea('0x1b')]+_0xffea('0x1f');_0x21d09f[_0xffea('0x12')]=parseValue(_0x2836d7,_0x243609[_0xffea('0x11')],_0x243609['value']);return _0x21d09f;};function parseOperator(_0x539ea7){var _0xd5bfc6;switch(_0x539ea7){case _0xffea('0x20'):_0xd5bfc6='IN\x20?';break;case'$notIn':_0xd5bfc6=_0xffea('0x21');break;case _0xffea('0x10'):_0xd5bfc6=_0xffea('0x22');break;case _0xffea('0x23'):_0xd5bfc6=_0xffea('0x24');break;case _0xffea('0x25'):case _0xffea('0x26'):case _0xffea('0x27'):_0xd5bfc6=_0xffea('0x28');break;case _0xffea('0x29'):_0xd5bfc6=_0xffea('0x2a');break;case _0xffea('0x2b'):_0xd5bfc6=_0xffea('0x2c');break;case _0xffea('0x14'):_0xd5bfc6=_0xffea('0x2d');break;case'$gte':_0xd5bfc6=_0xffea('0x2e');break;case'$between':_0xd5bfc6='BETWEEN\x20?\x20AND\x20?';break;}return _0xd5bfc6;}function parseValue(_0x392406,_0x66dfa,_0x11a795){var _0x199880={'start':undefined,'end':undefined};switch(_0x66dfa){case _0xffea('0x20'):case _0xffea('0x1d'):_0x199880[_0xffea('0x2f')]=_0x11a795['split'](',');break;case _0xffea('0x25'):_0x199880[_0xffea('0x2f')]='%'+_0x11a795+'%';break;case _0xffea('0x26'):_0x199880[_0xffea('0x2f')]=_0x11a795+'%';break;case'$endsWith':_0x199880['start']='%'+_0x11a795;break;case _0xffea('0x30'):var _0xf7f6da=_0x11a795[_0xffea('0x8')](',');var _0x11a795=_0xf7f6da[_0xffea('0x31')]();var _0x21e558=_0xf7f6da[_0xffea('0x32')]();if(_0x392406==='DATE'){_0x11a795=moment(_0x11a795)[_0xffea('0x33')](0x0,!![])[_0xffea('0x16')]();_0x21e558=moment(_0x21e558)[_0xffea('0x33')](0x0,!![])[_0xffea('0x34')](0x17,_0xffea('0x35'))['add'](0x3b,_0xffea('0x36'))['add'](0x3b,_0xffea('0x37'))[_0xffea('0x16')]();}_0x199880={'start':_0x11a795,'end':_0x21e558};break;default:_0x199880[_0xffea('0x2f')]=_0x11a795;break;}return _0x199880;} \ No newline at end of file +var _0xd542=['[$or]','and','replace','[$and]','length','split','slice','forEach','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','utcOffset','hours','minutes','seconds','lodash','moment','startsWith'];(function(_0x4f7066,_0x10153e){var _0xa2ba81=function(_0x2beed7){while(--_0x2beed7){_0x4f7066['push'](_0x4f7066['shift']());}};_0xa2ba81(++_0x10153e);}(_0xd542,0x1b5));var _0x2d54=function(_0x5cf649,_0x2fe038){_0x5cf649=_0x5cf649-0x0;var _0x3e6f9b=_0xd542[_0x5cf649];return _0x3e6f9b;};'use strict';var _=require(_0x2d54('0x0'));var moment=require(_0x2d54('0x1'));exports['parseSearch']=function(_0x2216bc){var _0x5332e1={'conditions':[]};_0x5332e1['sqlOperator']=_[_0x2d54('0x2')](_0x2216bc,_0x2d54('0x3'))?'or':_0x2d54('0x4');var _0x579f28=_0x2216bc[_0x2d54('0x5')](_0x2d54('0x6'),'')['replace'](_0x2d54('0x3'),'')['split']('||');for(var _0x31810e=0x0;_0x31810e<_0x579f28[_0x2d54('0x7')];_0x31810e++){var _0x3abc00=_0x579f28[_0x31810e][_0x2d54('0x8')](':=');var _0x318464=_0x3abc00[0x0];var _0x57d449=_0x3abc00[_0x2d54('0x9')](0x1);_0x57d449[_0x2d54('0xa')](function(_0x31b7e6){var _0x588696=_0x31b7e6[_0x2d54('0x8')]('[')['shift']();var _0xb9264b=_0x31b7e6['match'](/\[(.*?)\]/g);_0xb9264b[_0x2d54('0xa')](function(_0x18900c){var _0x9fd366=_0x18900c[_0x2d54('0x8')]('[')[_0x2d54('0xb')](function(_0x5543ad){return _0x5543ad[_0x2d54('0xc')](']')>-0x1;})[_0x2d54('0xd')](function(_0x562ce6){return _0x562ce6[_0x2d54('0x8')](']')[0x0];})[0x0];_0x5332e1[_0x2d54('0xe')][_0x2d54('0xf')]({'field':_0x318464,'operator':_0x588696,'value':_0x9fd366});});});}return _0x5332e1;};exports['buildExpression']=function(_0x169305,_0x422bf0,_0xaba6d2){var _0x2cd06e={};if(_0x422bf0===_0x2d54('0x10')){if(_0xaba6d2[_0x2d54('0x11')]===_0x2d54('0x12')){_0xaba6d2[_0x2d54('0x11')]=_0x2d54('0x13');_0xaba6d2['value']+=','+_0xaba6d2[_0x2d54('0x14')];}else if(_[_0x2d54('0x15')](['$gt',_0x2d54('0x16')],_0xaba6d2['operator'])){_0xaba6d2[_0x2d54('0x14')]=moment(_0xaba6d2[_0x2d54('0x14')])[_0x2d54('0x17')](0x1,_0x2d54('0x18'))[_0x2d54('0x19')](_0x2d54('0x1a'));}}if(_0xaba6d2['castTo']){_0x422bf0=_0xaba6d2[_0x2d54('0x1b')];_0x2cd06e[_0x2d54('0x1c')]=_0x2d54('0x1d')+_0x169305+'.'+_0xaba6d2[_0x2d54('0x1e')]+_0x2d54('0x1f')+_0xaba6d2['castTo']+')\x20'+parseOperator(_0xaba6d2[_0x2d54('0x11')]);}else{_0x2cd06e[_0x2d54('0x1c')]=_0x169305+'.'+_0xaba6d2[_0x2d54('0x1e')]+'\x20'+parseOperator(_0xaba6d2[_0x2d54('0x11')]);}if(_['includes']([_0x2d54('0x20'),'$notIn'],_0xaba6d2['operator']))_0x2cd06e[_0x2d54('0x1c')]='('+_0x2cd06e[_0x2d54('0x1c')]+_0x2d54('0x21')+_0x169305+'.'+_0xaba6d2['field']+_0x2d54('0x22');_0x2cd06e[_0x2d54('0x14')]=parseValue(_0x422bf0,_0xaba6d2[_0x2d54('0x11')],_0xaba6d2[_0x2d54('0x14')]);return _0x2cd06e;};function parseOperator(_0xb80351){var _0x35aeff;switch(_0xb80351){case _0x2d54('0x23'):_0x35aeff='IN\x20?';break;case _0x2d54('0x24'):_0x35aeff=_0x2d54('0x25');break;case _0x2d54('0x12'):_0x35aeff=_0x2d54('0x26');break;case _0x2d54('0x20'):_0x35aeff=_0x2d54('0x27');break;case _0x2d54('0x28'):case'$startsWith':case _0x2d54('0x29'):_0x35aeff='LIKE\x20?';break;case _0x2d54('0x2a'):_0x35aeff=_0x2d54('0x2b');break;case'$gt':_0x35aeff=_0x2d54('0x2c');break;case _0x2d54('0x16'):_0x35aeff=_0x2d54('0x2d');break;case _0x2d54('0x2e'):_0x35aeff=_0x2d54('0x2f');break;case _0x2d54('0x13'):_0x35aeff=_0x2d54('0x30');break;}return _0x35aeff;}function parseValue(_0x4e42c5,_0x70a02b,_0x1a3b03){var _0x5b1239={'start':undefined,'end':undefined};switch(_0x70a02b){case _0x2d54('0x23'):case _0x2d54('0x24'):_0x5b1239[_0x2d54('0x31')]=_0x1a3b03['split'](',');break;case'$substring':_0x5b1239[_0x2d54('0x31')]='%'+_0x1a3b03+'%';break;case _0x2d54('0x32'):_0x5b1239[_0x2d54('0x31')]=_0x1a3b03+'%';break;case _0x2d54('0x29'):_0x5b1239['start']='%'+_0x1a3b03;break;case _0x2d54('0x13'):var _0x3ec170=_0x1a3b03[_0x2d54('0x8')](',');var _0x1a3b03=_0x3ec170['shift']();var _0x2500e0=_0x3ec170['pop']();if(_0x4e42c5===_0x2d54('0x10')){_0x1a3b03=moment(_0x1a3b03)['utcOffset'](0x0,!![])['format']();_0x2500e0=moment(_0x2500e0)[_0x2d54('0x33')](0x0,!![])[_0x2d54('0x17')](0x17,_0x2d54('0x34'))[_0x2d54('0x17')](0x3b,_0x2d54('0x35'))[_0x2d54('0x17')](0x3b,_0x2d54('0x36'))[_0x2d54('0x19')]();}_0x5b1239={'start':_0x1a3b03,'end':_0x2500e0};break;default:_0x5b1239[_0x2d54('0x31')]=_0x1a3b03;break;}return _0x5b1239;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c53da74..e786f16 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 _0x6a53=['join','moment','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','parse','isArray','limit','offset','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','toString'];(function(_0x37192e,_0x3d4936){var _0x2a5279=function(_0x2fbe36){while(--_0x2fbe36){_0x37192e['push'](_0x37192e['shift']());}};_0x2a5279(++_0x3d4936);}(_0x6a53,0x1ef));var _0x36a5=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0x6a53[_0x2dd628];return _0x2e138c;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x36a5('0x0'));var LIMIT_VALUE=0xfa;exports[_0x36a5('0x1')]=function(_0x1b955e){var _0x435e92=null;if(_0x1b955e){_0x435e92=_0x1b955e[_0x36a5('0x2')](',');}return _0x435e92;};exports[_0x36a5('0x3')]=function(_0x1a5a23,_0x2246a5){var _0x8624c4={};if(!_[_0x36a5('0x4')](_0x1a5a23)){_['forOwn'](_0x1a5a23,function(_0x7e27a7,_0x4e06a4){try{if(_0x2246a5){var _0x1ad3a8=_[_0x36a5('0x5')](_0x2246a5,{'name':_0x4e06a4})||{};if(_0x1ad3a8[_0x36a5('0x6')]===_0x36a5('0x7')&&_[_0x36a5('0x8')](_0x7e27a7)){var _0x709745=JSON['parse'](_0x7e27a7);var _0x5d76a4={'$gte':moment(moment(_0x709745[_0x36a5('0x9')])[_0x36a5('0xa')](_0x36a5('0xb')))[_0x36a5('0xc')]()[_0x36a5('0xa')](),'$lte':moment(moment(_0x709745[_0x36a5('0xd')])[_0x36a5('0xa')](_0x36a5('0xb')))[_0x36a5('0xc')]()['subtract'](0x1,'s')[_0x36a5('0xa')]()};_0x8624c4[_0x4e06a4]=_0x5d76a4;}else{_0x8624c4[_0x4e06a4]=_['isArray'](_0x7e27a7)?_0x7e27a7:JSON[_0x36a5('0xe')](_0x7e27a7);}}else{_0x8624c4[_0x4e06a4]=_[_0x36a5('0xf')](_0x7e27a7)?_0x7e27a7:JSON[_0x36a5('0xe')](_0x7e27a7);}}catch(_0x1ec0d2){_0x8624c4[_0x4e06a4]=_0x7e27a7[_0x36a5('0x2')](',');}});}return _0x8624c4;};exports[_0x36a5('0x10')]=function(_0x12590a){_0x12590a=parseInt(_0x12590a,0xa);if(!_0x12590a||_0x12590a<0x0){_0x12590a=LIMIT_VALUE;}return _0x12590a;};exports[_0x36a5('0x11')]=function(_0x49b96e){_0x49b96e=parseInt(_0x49b96e,0xa);if(!_0x49b96e||_0x49b96e<0x0){_0x49b96e=0x0;}return _0x49b96e;};exports['sort']=function(_0x49e73e){var _0x73b9c8,_0x5790d2=null;if(_0x49e73e){_0x73b9c8=_0x49e73e[_0x36a5('0x2')](',');_0x5790d2=_['map'](_0x73b9c8,function(_0x381800){if(_0x381800[_0x36a5('0x12')]('-')===0x0){return[_0x381800===_0x36a5('0x13')?sequelize[_0x36a5('0x14')](sequelize[_0x36a5('0x15')](_0x36a5('0x13')),_0x36a5('0x16')):_0x381800[_0x36a5('0x17')](0x1),'DESC'];}else{return[_0x381800==='priority'?sequelize[_0x36a5('0x14')](sequelize[_0x36a5('0x15')](_0x36a5('0x13')),'unsigned'):_0x381800,_0x36a5('0x18')];}});}return _0x5790d2;};exports[_0x36a5('0x19')]=function(_0x2dfb31,_0x117fd4){if(_['isEmpty'](_0x2dfb31)){return _0x2dfb31;}if(_[_0x36a5('0xf')](_0x2dfb31)){for(var _0x428d51=0x0;_0x428d51<_0x2dfb31[_0x36a5('0x1a')];_0x428d51+=0x1){_0x2dfb31[_0x428d51]=this[_0x36a5('0x19')](_0x2dfb31[_0x428d51],_0x117fd4);}return _0x2dfb31;}if(!_[_0x36a5('0x1b')](_0x2dfb31)){return _0x2dfb31;}if(_[_0x36a5('0x1c')](_0x117fd4)){_0x117fd4=[_0x117fd4];}if(!_[_0x36a5('0xf')](_0x117fd4)){return _0x2dfb31;}for(var _0x28d62c=0x0;_0x28d62c<_0x117fd4[_0x36a5('0x1a')];_0x28d62c+=0x1){_['unset'](_0x2dfb31,_0x117fd4[_0x28d62c]);}for(var _0x33d51b in _0x2dfb31){if(_0x2dfb31[_0x36a5('0x1d')](_0x33d51b)){_0x2dfb31[_0x33d51b]=this[_0x36a5('0x19')](_0x2dfb31[_0x33d51b],_0x117fd4);}}return _0x2dfb31;};exports[_0x36a5('0x1e')]=function(_0x116b56){return _0x116b56[_0x36a5('0x1f')](RegExp(_0x36a5('0x20')))?!![]:![];};exports[_0x36a5('0x21')]=function(_0x3c7109){return _0x3c7109[_0x36a5('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0x36a5('0x22')]=function(_0x5a2781){var _0x33d568=[];_0x5a2781[_0x36a5('0x2')]('\x20')[_0x36a5('0x23')](function(_0x4b610f){_0x33d568['push']('+'+_0x4b610f[_0x36a5('0x24')]()+'*');});return _0x33d568[_0x36a5('0x25')]('\x20');}; \ No newline at end of file +var _0xa7be=['ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','isEmail','match','getFullTextValue','forEach','push','toString','join','fields','split','filters','isEmpty','find','DATE','parse','$gte','format','utc','YYYY-MM-DD','isArray','limit','offset','sort','map','priority','cast','unsigned','DESC'];(function(_0x284d70,_0x4e5330){var _0x5a40f8=function(_0x5507e7){while(--_0x5507e7){_0x284d70['push'](_0x284d70['shift']());}};_0x5a40f8(++_0x4e5330);}(_0xa7be,0xfc));var _0xea7b=function(_0x23a913,_0x195690){_0x23a913=_0x23a913-0x0;var _0x5c2268=_0xa7be[_0x23a913];return _0x5c2268;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xea7b('0x0')]=function(_0x2131d6){var _0x62a6a5=null;if(_0x2131d6){_0x62a6a5=_0x2131d6[_0xea7b('0x1')](',');}return _0x62a6a5;};exports[_0xea7b('0x2')]=function(_0x39cd98,_0x181a5e){var _0x361360={};if(!_[_0xea7b('0x3')](_0x39cd98)){_['forOwn'](_0x39cd98,function(_0x4d1580,_0x37249d){try{if(_0x181a5e){var _0x345115=_[_0xea7b('0x4')](_0x181a5e,{'name':_0x37249d})||{};if(_0x345115['type']===_0xea7b('0x5')&&_['isPlainObject'](_0x4d1580)){var _0x26aa9f=JSON[_0xea7b('0x6')](_0x4d1580);var _0x9c42a3={'$gte':moment(moment(_0x26aa9f[_0xea7b('0x7')])[_0xea7b('0x8')]('YYYY-MM-DD'))[_0xea7b('0x9')]()['format'](),'$lte':moment(moment(_0x26aa9f['$lte'])[_0xea7b('0x8')](_0xea7b('0xa')))['utc']()['subtract'](0x1,'s')[_0xea7b('0x8')]()};_0x361360[_0x37249d]=_0x9c42a3;}else{_0x361360[_0x37249d]=_[_0xea7b('0xb')](_0x4d1580)?_0x4d1580:JSON[_0xea7b('0x6')](_0x4d1580);}}else{_0x361360[_0x37249d]=_['isArray'](_0x4d1580)?_0x4d1580:JSON['parse'](_0x4d1580);}}catch(_0x32eb81){_0x361360[_0x37249d]=_0x4d1580[_0xea7b('0x1')](',');}});}return _0x361360;};exports[_0xea7b('0xc')]=function(_0x1e11ca){_0x1e11ca=parseInt(_0x1e11ca,0xa);if(!_0x1e11ca||_0x1e11ca<0x0){_0x1e11ca=LIMIT_VALUE;}return _0x1e11ca;};exports[_0xea7b('0xd')]=function(_0x4b43b9){_0x4b43b9=parseInt(_0x4b43b9,0xa);if(!_0x4b43b9||_0x4b43b9<0x0){_0x4b43b9=0x0;}return _0x4b43b9;};exports[_0xea7b('0xe')]=function(_0x2090b1){var _0x5d842c,_0x108bf2=null;if(_0x2090b1){_0x5d842c=_0x2090b1[_0xea7b('0x1')](',');_0x108bf2=_[_0xea7b('0xf')](_0x5d842c,function(_0x4c8885){if(_0x4c8885['indexOf']('-')===0x0){return[_0x4c8885===_0xea7b('0x10')?sequelize[_0xea7b('0x11')](sequelize['col']('priority'),_0xea7b('0x12')):_0x4c8885['substr'](0x1),_0xea7b('0x13')];}else{return[_0x4c8885===_0xea7b('0x10')?sequelize[_0xea7b('0x11')](sequelize['col'](_0xea7b('0x10')),_0xea7b('0x12')):_0x4c8885,_0xea7b('0x14')];}});}return _0x108bf2;};exports[_0xea7b('0x15')]=function(_0x5b59bd,_0x14d222){if(_[_0xea7b('0x3')](_0x5b59bd)){return _0x5b59bd;}if(_[_0xea7b('0xb')](_0x5b59bd)){for(var _0x44d4ef=0x0;_0x44d4ef<_0x5b59bd[_0xea7b('0x16')];_0x44d4ef+=0x1){_0x5b59bd[_0x44d4ef]=this[_0xea7b('0x15')](_0x5b59bd[_0x44d4ef],_0x14d222);}return _0x5b59bd;}if(!_['isObject'](_0x5b59bd)){return _0x5b59bd;}if(_[_0xea7b('0x17')](_0x14d222)){_0x14d222=[_0x14d222];}if(!_[_0xea7b('0xb')](_0x14d222)){return _0x5b59bd;}for(var _0x3caf1f=0x0;_0x3caf1f<_0x14d222['length'];_0x3caf1f+=0x1){_[_0xea7b('0x18')](_0x5b59bd,_0x14d222[_0x3caf1f]);}for(var _0x2b05d5 in _0x5b59bd){if(_0x5b59bd[_0xea7b('0x19')](_0x2b05d5)){_0x5b59bd[_0x2b05d5]=this['omit'](_0x5b59bd[_0x2b05d5],_0x14d222);}}return _0x5b59bd;};exports[_0xea7b('0x1a')]=function(_0x2d1f99){return _0x2d1f99['match'](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xea7b('0x1b')]=function(_0x258664){return _0x258664[_0xea7b('0x1c')](/^\S+@\S+$/)?!![]:![];};exports[_0xea7b('0x1d')]=function(_0x3393a5){var _0x5aa070=[];_0x3393a5[_0xea7b('0x1')]('\x20')[_0xea7b('0x1e')](function(_0x4a2f40){_0x5aa070[_0xea7b('0x1f')]('+'+_0x4a2f40[_0xea7b('0x20')]()+'*');});return _0x5aa070[_0xea7b('0x21')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index db71a61..0ded8f1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x372f=['test','appPath','client','use','json\x20replacer','split','static','get','views','/server/views','engine','html','ejs','renderFile','urlencoded','json','50mb','initialize','express','body-parser','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','env','production','set','join','root','public','development'];(function(_0x5df8fd,_0x14c922){var _0x17c157=function(_0x49e9b0){while(--_0x49e9b0){_0x5df8fd['push'](_0x5df8fd['shift']());}};_0x17c157(++_0x14c922);}(_0x372f,0x1b6));var _0xf372=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x372f[_0x432682];return _0x463d05;};'use strict';var express=require(_0xf372('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xf372('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0xf372('0x2'));var errorHandler=require(_0xf372('0x3'));var path=require('path');var passport=require(_0xf372('0x4'));var cors=require(_0xf372('0x5'));var moment=require(_0xf372('0x6'));var config=require(_0xf372('0x7'));var db=require(_0xf372('0x8'))['db'];exports[_0xf372('0x9')]=function(_0x458f42){var _0x5da4ad=_0x458f42['get'](_0xf372('0xa'));if(_0x5da4ad===_0xf372('0xb')){_0x458f42[_0xf372('0xc')]('appPath',path[_0xf372('0xd')](config[_0xf372('0xe')],_0xf372('0xf')));}if(_0x5da4ad===_0xf372('0x10')||_0x5da4ad===_0xf372('0x11')){_0x458f42['set'](_0xf372('0x12'),path['join'](config[_0xf372('0xe')],_0xf372('0x13')));_0x458f42[_0xf372('0x14')](errorHandler());}_0x458f42[_0xf372('0xc')](_0xf372('0x15'),function(_0x5d3996,_0x5bf0dd){if(this[_0x5d3996]instanceof Date){_0x5bf0dd=this[_0x5d3996]['toISOString']()[_0xf372('0x16')]('.')[0x0]+'Z';}return _0x5bf0dd;});_0x458f42[_0xf372('0x14')](express[_0xf372('0x17')](_0x458f42[_0xf372('0x18')](_0xf372('0x12'))));_0x458f42[_0xf372('0xc')](_0xf372('0x19'),config[_0xf372('0xe')]+_0xf372('0x1a'));_0x458f42[_0xf372('0x1b')](_0xf372('0x1c'),require(_0xf372('0x1d'))[_0xf372('0x1e')]);_0x458f42['set']('view\x20engine',_0xf372('0x1c'));_0x458f42['use'](bodyParser[_0xf372('0x1f')]({'limit':'50mb','extended':!![]}));_0x458f42['use'](bodyParser[_0xf372('0x20')]({'limit':_0xf372('0x21')}));_0x458f42[_0xf372('0x14')](cors());_0x458f42[_0xf372('0x14')](methodOverride());_0x458f42[_0xf372('0x14')](cookieParser());_0x458f42[_0xf372('0x14')](passport[_0xf372('0x22')]());}; \ No newline at end of file +var _0x89e1=['/server/views','engine','html','ejs','view\x20engine','urlencoded','json','50mb','initialize','express','body-parser','cookie-parser','path','passport','./environment','../mysqldb','default','env','production','set','appPath','root','development','test','join','client','json\x20replacer','split','use','static','get','views'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0x89e1,0xe9));var _0x189e=function(_0x46bfda,_0xc2dd29){_0x46bfda=_0x46bfda-0x0;var _0x48b6fa=_0x89e1[_0x46bfda];return _0x48b6fa;};'use strict';var express=require(_0x189e('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x189e('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x189e('0x2'));var errorHandler=require('errorhandler');var path=require(_0x189e('0x3'));var passport=require(_0x189e('0x4'));var cors=require('cors');var moment=require('moment');var config=require(_0x189e('0x5'));var db=require(_0x189e('0x6'))['db'];exports[_0x189e('0x7')]=function(_0x45b7c8){var _0x295cad=_0x45b7c8['get'](_0x189e('0x8'));if(_0x295cad===_0x189e('0x9')){_0x45b7c8[_0x189e('0xa')](_0x189e('0xb'),path['join'](config[_0x189e('0xc')],'public'));}if(_0x295cad===_0x189e('0xd')||_0x295cad===_0x189e('0xe')){_0x45b7c8[_0x189e('0xa')](_0x189e('0xb'),path[_0x189e('0xf')](config['root'],_0x189e('0x10')));_0x45b7c8['use'](errorHandler());}_0x45b7c8[_0x189e('0xa')](_0x189e('0x11'),function(_0x52284d,_0x563a18){if(this[_0x52284d]instanceof Date){_0x563a18=this[_0x52284d]['toISOString']()[_0x189e('0x12')]('.')[0x0]+'Z';}return _0x563a18;});_0x45b7c8[_0x189e('0x13')](express[_0x189e('0x14')](_0x45b7c8[_0x189e('0x15')](_0x189e('0xb'))));_0x45b7c8['set'](_0x189e('0x16'),config['root']+_0x189e('0x17'));_0x45b7c8[_0x189e('0x18')](_0x189e('0x19'),require(_0x189e('0x1a'))['renderFile']);_0x45b7c8[_0x189e('0xa')](_0x189e('0x1b'),'html');_0x45b7c8[_0x189e('0x13')](bodyParser[_0x189e('0x1c')]({'limit':'50mb','extended':!![]}));_0x45b7c8[_0x189e('0x13')](bodyParser[_0x189e('0x1d')]({'limit':_0x189e('0x1e')}));_0x45b7c8[_0x189e('0x13')](cors());_0x45b7c8[_0x189e('0x13')](methodOverride());_0x45b7c8[_0x189e('0x13')](cookieParser());_0x45b7c8[_0x189e('0x13')](passport[_0x189e('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index acdc232..41f1fca 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 _0xf776=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','utf8','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','keys','length','filter','IPv4','concat','head','mac'];(function(_0x5948a7,_0x944950){var _0x4926e6=function(_0x42c767){while(--_0x42c767){_0x5948a7['push'](_0x5948a7['shift']());}};_0x4926e6(++_0x944950);}(_0xf776,0x169));var _0x6f77=function(_0x4f3b1c,_0x2e6e90){_0x4f3b1c=_0x4f3b1c-0x0;var _0x3f2df4=_0xf776[_0x4f3b1c];return _0x3f2df4;};'use strict';var _=require(_0x6f77('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6f77('0x1'));var exec=require(_0x6f77('0x2'))['execSync'];function getInterfaces(){var _0x43f2fd=[];var _0x2458e0=os[_0x6f77('0x3')]();var _0x16874b=_['orderBy'](_[_0x6f77('0x4')](_0x2458e0));for(var _0x4fde71=0x0;_0x4fde71<_0x16874b[_0x6f77('0x5')];_0x4fde71++){var _0x21909a=_0x2458e0[_0x16874b[_0x4fde71]][_0x6f77('0x6')](function(_0x18a937){return _0x18a937['family']===_0x6f77('0x7')&&_0x18a937['internal']===![];});_0x43f2fd=_0x43f2fd[_0x6f77('0x8')](_0x21909a);}return _0x43f2fd;}function getFirstInterface(){var _0x2f8dec=_[_0x6f77('0x9')](getInterfaces());return{'macAddress':_0x2f8dec&&_0x2f8dec[_0x6f77('0xa')]?_0x2f8dec['mac']:_0x6f77('0xb'),'ipAddress':_0x2f8dec&&_0x2f8dec[_0x6f77('0xc')]?_0x2f8dec[_0x6f77('0xc')]:_0x6f77('0xd')};}exports[_0x6f77('0xe')]=getFirstInterface;function getCPUhash(){var _0x1ae008=_['orderBy'](os[_0x6f77('0xf')]()[_0x6f77('0x10')](function(_0x150260){return _0x150260[_0x6f77('0x11')];}))[_0x6f77('0x12')](':');return crypto[_0x6f77('0x13')](_0x6f77('0x14'))[_0x6f77('0x15')](_0x1ae008)[_0x6f77('0x16')](_0x6f77('0x17'));}exports[_0x6f77('0x18')]=function(){switch(os[_0x6f77('0x19')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x6f77('0x1a')})[_0x6f77('0x1b')]('\x0d\x0a','');default:var _0x5cf3b9=getFirstInterface();var _0x41d3fd=getCPUhash();var _0x55bb85=_0x41d3fd+'|'+os[_0x6f77('0x1c')]()+'|'+_0x5cf3b9[_0x6f77('0x1d')]+'|'+_0x5cf3b9['ipAddress'];var _0x51c8d9=crypto[_0x6f77('0x13')](_0x6f77('0x14'))[_0x6f77('0x15')](_0x55bb85)[_0x6f77('0x16')](_0x6f77('0x17'));return _0x51c8d9[_0x6f77('0x1e')](0x0,0x8)+'-'+_0x51c8d9[_0x6f77('0x1e')](0x8,0xc)+'-'+_0x51c8d9[_0x6f77('0x1e')](0xc,0x10)+'-'+_0x51c8d9['substring'](0x10,0x14)+'-'+_0x51c8d9[_0x6f77('0x1e')](0x14);}}; \ No newline at end of file +var _0xec39=['dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','md5','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','hex','getUuid','platform','win32'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xec39,0x19f));var _0x9ec3=function(_0x420533,_0x3e1f4c){_0x420533=_0x420533-0x0;var _0x4d0913=_0xec39[_0x420533];return _0x4d0913;};'use strict';var _=require(_0x9ec3('0x0'));var os=require('os');var crypto=require(_0x9ec3('0x1'));var machine=require(_0x9ec3('0x2'));var exec=require(_0x9ec3('0x3'))[_0x9ec3('0x4')];function getInterfaces(){var _0xb3d117=[];var _0x3d481c=os['networkInterfaces']();var _0x1f43fb=_[_0x9ec3('0x5')](_[_0x9ec3('0x6')](_0x3d481c));for(var _0x4a3996=0x0;_0x4a3996<_0x1f43fb['length'];_0x4a3996++){var _0x55adba=_0x3d481c[_0x1f43fb[_0x4a3996]][_0x9ec3('0x7')](function(_0x11c4d1){return _0x11c4d1[_0x9ec3('0x8')]==='IPv4'&&_0x11c4d1[_0x9ec3('0x9')]===![];});_0xb3d117=_0xb3d117[_0x9ec3('0xa')](_0x55adba);}return _0xb3d117;}function getFirstInterface(){var _0x2e49f3=_[_0x9ec3('0xb')](getInterfaces());return{'macAddress':_0x2e49f3&&_0x2e49f3[_0x9ec3('0xc')]?_0x2e49f3[_0x9ec3('0xc')]:_0x9ec3('0xd'),'ipAddress':_0x2e49f3&&_0x2e49f3['address']?_0x2e49f3[_0x9ec3('0xe')]:_0x9ec3('0xf')};}exports[_0x9ec3('0x10')]=getFirstInterface;function getCPUhash(){var _0x418f90=_[_0x9ec3('0x5')](os[_0x9ec3('0x11')]()[_0x9ec3('0x12')](function(_0x536796){return _0x536796[_0x9ec3('0x13')];}))[_0x9ec3('0x14')](':');return crypto[_0x9ec3('0x15')]('md5')[_0x9ec3('0x16')](_0x418f90)['digest'](_0x9ec3('0x17'));}exports[_0x9ec3('0x18')]=function(){switch(os[_0x9ec3('0x19')]()){case _0x9ec3('0x1a'):return exec(_0x9ec3('0x1b'),{'encoding':_0x9ec3('0x1c')})[_0x9ec3('0x1d')]('\x0d\x0a','');default:var _0x21c2db=getFirstInterface();var _0x453010=getCPUhash();var _0x58dd6f=_0x453010+'|'+os[_0x9ec3('0x1e')]()+'|'+_0x21c2db['macAddress']+'|'+_0x21c2db['ipAddress'];var _0x2ae9bd=crypto[_0x9ec3('0x15')](_0x9ec3('0x1f'))[_0x9ec3('0x16')](_0x58dd6f)[_0x9ec3('0x20')]('hex');return _0x2ae9bd[_0x9ec3('0x21')](0x0,0x8)+'-'+_0x2ae9bd['substring'](0x8,0xc)+'-'+_0x2ae9bd[_0x9ec3('0x21')](0xc,0x10)+'-'+_0x2ae9bd['substring'](0x10,0x14)+'-'+_0x2ae9bd[_0x9ec3('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3112d1b..1bccd60 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 _0x4d68=['version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','createCipher','secrets','update','utf8','base64','final','createDecipher','aes-256-ctr','session','||FIELD||VALUE||\x0a','User','admin','fullname','|machineUuid|','|name|','email','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','crypto','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s'];(function(_0x1b7487,_0x5a9042){var _0xf25604=function(_0x580a4b){while(--_0x580a4b){_0x1b7487['push'](_0x1b7487['shift']());}};_0xf25604(++_0x5a9042);}(_0x4d68,0x1c3));var _0x84d6=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x4d68[_0x208505];return _0x1a985f;};'use strict';var util=require(_0x84d6('0x0'));var crypto=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var rp=require(_0x84d6('0x3'));var BPromise=require(_0x84d6('0x4'));var pkginfo=require(_0x84d6('0x5'))(module,'version');var db=require(_0x84d6('0x6'))['db'];var config=require('../environment');var hardware=require(_0x84d6('0x7'));var logger=require('../logger')(_0x84d6('0x8'));var jira=require(_0x84d6('0x9'));var HOST=_0x84d6('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x539e34){return new BPromise(function(_0x561dd8,_0x218daf){var _0xa64ed3=util[_0x84d6('0xb')](_0x84d6('0xc'),HOST,_0x539e34,module['exports'][_0x84d6('0xd')]);if(oldToken){_0xa64ed3=util['format'](_0x84d6('0xe'),HOST,_0x539e34,module[_0x84d6('0xf')][_0x84d6('0xd')],oldToken);}var _0x4c0fca={'uri':_0xa64ed3,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4c0fca)[_0x84d6('0x10')](function(_0x5a7122){_0x561dd8(_0x5a7122);})[_0x84d6('0x11')](function(_0xf67dc8){_0x218daf(_0xf67dc8);});});}function encryptDate(_0x19ab7d){var _0x19e7a9=crypto[_0x84d6('0x12')]('aes-256-ctr',config[_0x84d6('0x13')]['session']);var _0x29c5d4=_0x19e7a9[_0x84d6('0x14')](_0x19ab7d,_0x84d6('0x15'),_0x84d6('0x16'));_0x29c5d4+=_0x19e7a9[_0x84d6('0x17')](_0x84d6('0x16'));return _0x29c5d4;}function decryptDate(_0x957ae6){var _0x4f39f0=crypto[_0x84d6('0x18')](_0x84d6('0x19'),config[_0x84d6('0x13')][_0x84d6('0x1a')]);var _0x385e2b=_0x4f39f0['update'](_0x957ae6,_0x84d6('0x16'),_0x84d6('0x15'));_0x385e2b+=_0x4f39f0['final'](_0x84d6('0x15'));return _0x385e2b;}function sendJiraAlert(_0x47a884,_0x309f26,_0x38d725){var _0x652e57=_0x84d6('0x1b');return db[_0x84d6('0x1c')]['findOne']({'where':{'role':_0x84d6('0x1d')},'attributes':[_0x84d6('0x1e'),'email'],'raw':!![]})['then'](function(_0xc1c137){ADMIN=_0xc1c137;_0x652e57+='|reason|'+_0x38d725+'|\x0a';_0x652e57+='|uuid|'+_0x47a884+'|\x0a';_0x652e57+=_0x84d6('0x1f')+_0x309f26+'|\x0a';_0x652e57+=_0x84d6('0x20')+ADMIN[_0x84d6('0x1e')]+'|\x0a';_0x652e57+='|email|'+ADMIN[_0x84d6('0x21')]+'|\x0a';return _0x652e57;})['then'](function(_0x5deb1f){var _0x26e753=hardware[_0x84d6('0x22')]()['ipAddress'];return jira[_0x84d6('0x23')]({'key':_0x84d6('0x24'),'summary':_0x84d6('0x25'),'description':_0x5deb1f,'issuetype':_0x84d6('0x26'),'oldToken':_0x47a884,'newToken':_0x309f26,'email':ADMIN['email'],'name':ADMIN[_0x84d6('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x26e753});});}function manageLicense(_0x5d9284,_0x3ff67a){var _0x19b6aa=_0x3ff67a['get']({'plain':!![]});httpRequest(_0x5d9284)[_0x84d6('0x10')](function(_0x1fcb3b){if(oldToken){oldToken=undefined;}if(_0x1fcb3b['active']){if(!_0x19b6aa['license']&&_0x19b6aa[_0x84d6('0x8')]!=_0x1fcb3b['license']||_0x19b6aa[_0x84d6('0x8')]&&_0x19b6aa['data2']){logger[_0x84d6('0x27')](_0x84d6('0x28'));}if(_0x19b6aa[_0x84d6('0x8')]&&!_0x19b6aa[_0x84d6('0x29')]&&_0x19b6aa[_0x84d6('0x8')]!=_0x1fcb3b[_0x84d6('0x8')]){logger[_0x84d6('0x27')](_0x84d6('0x2a'));}if(_0x19b6aa[_0x84d6('0x8')]&&!_0x19b6aa[_0x84d6('0x29')]&&_0x19b6aa[_0x84d6('0x8')]==_0x1fcb3b[_0x84d6('0x8')]){return _0x3ff67a;}return _0x3ff67a['update']({'data1':_0x5d9284,'data2':null,'license':_0x1fcb3b[_0x84d6('0x8')]});}else{if(_0x1fcb3b[_0x84d6('0x8')]||_0x19b6aa[_0x84d6('0x8')]){if(!_0x19b6aa[_0x84d6('0x29')]){if(_0x19b6aa[_0x84d6('0x2b')]==_0x5d9284){GRAY_PERIOD_REASON=_0x84d6('0x2c');logger[_0x84d6('0x27')](_0x84d6('0x2d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x19b6aa[_0x84d6('0x2b')];logger['info'](_0x84d6('0x2e'),_0x19b6aa[_0x84d6('0x2b')],_0x5d9284);}sendJiraAlert(_0x19b6aa['data1'],_0x1fcb3b[_0x84d6('0x2f')],GRAY_PERIOD_REASON);logger[_0x84d6('0x27')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x84d6('0x30')](),moment()[_0x84d6('0xb')](_0x84d6('0x31')));return _0x3ff67a[_0x84d6('0x14')]({'data2':encryptDate(moment()[_0x84d6('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x84d6('0x32')](decryptDate(_0x19b6aa[_0x84d6('0x29')]),_0x84d6('0x33'))>DAYS){logger['info'](_0x84d6('0x34'),moment()['format'](_0x84d6('0x31')));return _0x3ff67a['update']({'data1':_0x5d9284,'data2':null,'license':null});}}}else{if(_0x19b6aa['data1']!=_0x5d9284){logger[_0x84d6('0x27')](_0x84d6('0x2e'),_0x19b6aa[_0x84d6('0x2b')],_0x5d9284);return _0x3ff67a['update']({'data1':_0x5d9284,'data2':null,'license':null});}}}return _0x3ff67a;})[_0x84d6('0x10')](function(_0x161a7d){_0x3ff67a=_0x161a7d;})[_0x84d6('0x11')](function(_0x5d7e52){logger['error'](_0x5d7e52['message']);})[_0x84d6('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0x84d6('0x36')](),_0x3ff67a);},TIME);});}function defaultLicense(){var _0x2194fb=hardware[_0x84d6('0x36')]();if(_0x2194fb){return db[_0x84d6('0x37')][_0x84d6('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x2194fb}})['spread'](function(_0x573025,_0x30836a){logger[_0x84d6('0x27')](_0x84d6('0x39'),_0x2194fb);manageLicense(_0x2194fb,_0x573025);})[_0x84d6('0x11')](function(_0xb37bd3){logger['error'](_0xb37bd3['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x06ae=['exports','GET','then','catch','createCipher','aes-256-ctr','session','update','utf8','base64','createDecipher','secrets','final','User','admin','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format'];(function(_0x119cea,_0x7c3387){var _0x44f489=function(_0x2e721f){while(--_0x2e721f){_0x119cea['push'](_0x119cea['shift']());}};_0x44f489(++_0x7c3387);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var crypto=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var rp=require(_0xe06a('0x2'));var BPromise=require(_0xe06a('0x3'));var pkginfo=require(_0xe06a('0x4'))(module,_0xe06a('0x5'));var db=require(_0xe06a('0x6'))['db'];var config=require(_0xe06a('0x7'));var hardware=require(_0xe06a('0x8'));var logger=require('../logger')('license');var jira=require('../../api/jira/jira.controller');var HOST=_0xe06a('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x745f79){return new BPromise(function(_0x20bd8a,_0x3dfa60){var _0x1ea66c=util['format'](_0xe06a('0xa'),HOST,_0x745f79,module['exports']['version']);if(oldToken){_0x1ea66c=util[_0xe06a('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x745f79,module[_0xe06a('0xc')]['version'],oldToken);}var _0x521741={'uri':_0x1ea66c,'method':_0xe06a('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x521741)[_0xe06a('0xe')](function(_0x574fd0){_0x20bd8a(_0x574fd0);})[_0xe06a('0xf')](function(_0x11afc9){_0x3dfa60(_0x11afc9);});});}function encryptDate(_0x4997ac){var _0xb402c7=crypto[_0xe06a('0x10')](_0xe06a('0x11'),config['secrets'][_0xe06a('0x12')]);var _0x34e933=_0xb402c7[_0xe06a('0x13')](_0x4997ac,_0xe06a('0x14'),_0xe06a('0x15'));_0x34e933+=_0xb402c7['final'](_0xe06a('0x15'));return _0x34e933;}function decryptDate(_0x1080da){var _0x171b77=crypto[_0xe06a('0x16')](_0xe06a('0x11'),config[_0xe06a('0x17')]['session']);var _0xa9b1af=_0x171b77['update'](_0x1080da,'base64','utf8');_0xa9b1af+=_0x171b77[_0xe06a('0x18')](_0xe06a('0x14'));return _0xa9b1af;}function sendJiraAlert(_0xc62c1f,_0x57f5aa,_0x614743){var _0x6483d4='||FIELD||VALUE||\x0a';return db[_0xe06a('0x19')]['findOne']({'where':{'role':_0xe06a('0x1a')},'attributes':['fullname','email'],'raw':!![]})[_0xe06a('0xe')](function(_0x99dcd5){ADMIN=_0x99dcd5;_0x6483d4+=_0xe06a('0x1b')+_0x614743+'|\x0a';_0x6483d4+=_0xe06a('0x1c')+_0xc62c1f+'|\x0a';_0x6483d4+=_0xe06a('0x1d')+_0x57f5aa+'|\x0a';_0x6483d4+=_0xe06a('0x1e')+ADMIN[_0xe06a('0x1f')]+'|\x0a';_0x6483d4+=_0xe06a('0x20')+ADMIN[_0xe06a('0x21')]+'|\x0a';return _0x6483d4;})[_0xe06a('0xe')](function(_0x5970d9){var _0xd6bf1=hardware[_0xe06a('0x22')]()[_0xe06a('0x23')];return jira[_0xe06a('0x24')]({'key':_0xe06a('0x25'),'summary':_0xe06a('0x26'),'description':_0x5970d9,'issuetype':_0xe06a('0x27'),'oldToken':_0xc62c1f,'newToken':_0x57f5aa,'email':ADMIN[_0xe06a('0x21')],'name':ADMIN[_0xe06a('0x1f')],'reason':GRAY_PERIOD_REASON,'ip':_0xd6bf1});});}function manageLicense(_0x4ef4ca,_0x53bdca){var _0x42453d=_0x53bdca['get']({'plain':!![]});httpRequest(_0x4ef4ca)[_0xe06a('0xe')](function(_0x5143fd){if(oldToken){oldToken=undefined;}if(_0x5143fd['active']){if(!_0x42453d['license']&&_0x42453d[_0xe06a('0x28')]!=_0x5143fd[_0xe06a('0x28')]||_0x42453d['license']&&_0x42453d[_0xe06a('0x29')]){logger[_0xe06a('0x2a')](_0xe06a('0x2b'));}if(_0x42453d[_0xe06a('0x28')]&&!_0x42453d[_0xe06a('0x29')]&&_0x42453d[_0xe06a('0x28')]!=_0x5143fd[_0xe06a('0x28')]){logger[_0xe06a('0x2a')](_0xe06a('0x2c'));}if(_0x42453d['license']&&!_0x42453d['data2']&&_0x42453d[_0xe06a('0x28')]==_0x5143fd[_0xe06a('0x28')]){return _0x53bdca;}return _0x53bdca[_0xe06a('0x13')]({'data1':_0x4ef4ca,'data2':null,'license':_0x5143fd[_0xe06a('0x28')]});}else{if(_0x5143fd['license']||_0x42453d[_0xe06a('0x28')]){if(!_0x42453d['data2']){if(_0x42453d[_0xe06a('0x2d')]==_0x4ef4ca){GRAY_PERIOD_REASON=_0xe06a('0x2e');logger[_0xe06a('0x2a')](_0xe06a('0x2f'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x42453d[_0xe06a('0x2d')];logger[_0xe06a('0x2a')](_0xe06a('0x30'),_0x42453d[_0xe06a('0x2d')],_0x4ef4ca);}sendJiraAlert(_0x42453d['data1'],_0x5143fd['uuid'],GRAY_PERIOD_REASON);logger[_0xe06a('0x2a')](_0xe06a('0x31'),GRAY_PERIOD_REASON[_0xe06a('0x32')](),moment()[_0xe06a('0xb')](_0xe06a('0x33')));return _0x53bdca[_0xe06a('0x13')]({'data2':encryptDate(moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xe06a('0x34')](decryptDate(_0x42453d['data2']),_0xe06a('0x35'))>DAYS){logger['info'](_0xe06a('0x36'),moment()[_0xe06a('0xb')](_0xe06a('0x33')));return _0x53bdca['update']({'data1':_0x4ef4ca,'data2':null,'license':null});}}}else{if(_0x42453d['data1']!=_0x4ef4ca){logger[_0xe06a('0x2a')](_0xe06a('0x30'),_0x42453d[_0xe06a('0x2d')],_0x4ef4ca);return _0x53bdca[_0xe06a('0x13')]({'data1':_0x4ef4ca,'data2':null,'license':null});}}}return _0x53bdca;})[_0xe06a('0xe')](function(_0x47750f){_0x53bdca=_0x47750f;})['catch'](function(_0x5ccd64){logger['error'](_0x5ccd64['message']);})[_0xe06a('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0xe06a('0x38')](),_0x53bdca);},TIME);});}function defaultLicense(){var _0x33499a=hardware[_0xe06a('0x38')]();if(_0x33499a){return db[_0xe06a('0x39')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x33499a}})[_0xe06a('0x3a')](function(_0x102f49,_0x9c0671){logger['info'](_0xe06a('0x3b'),_0x33499a);manageLicense(_0x33499a,_0x102f49);})[_0xe06a('0xf')](function(_0x308722){logger[_0xe06a('0x3c')](_0x308722[_0xe06a('0x3d')]);});}}exports[_0xe06a('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7a49480..98aa96f 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 _0x3a5e=['machineUuid','getUuid','aes-256-ctr','secrets','session','deadline','add','days','grayReason','uuid','changed','Breaking\x20license','message','2027-01-01T00:00:00.000Z','getLicense','License','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','data1','data2','split','createDecipher','format','%s:%s:%s','update','utf8','final','parse','demo'];(function(_0x502aa5,_0x143342){var _0x212160=function(_0x94e7ac){while(--_0x94e7ac){_0x502aa5['push'](_0x502aa5['shift']());}};_0x212160(++_0x143342);}(_0x3a5e,0x14c));var _0xe3a5=function(_0xc86fe5,_0x1021d9){_0xc86fe5=_0xc86fe5-0x0;var _0x108c03=_0x3a5e[_0xc86fe5];return _0x108c03;};'use strict';var crypto=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var _=require(_0xe3a5('0x2'));var moment=require(_0xe3a5('0x3'));var hardware=require(_0xe3a5('0x4'));var config=require(_0xe3a5('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0xa86e6b,_0x189d9c){if(_0xa86e6b){try{var _0x46dbe3=_0x189d9c||_0xa86e6b[_0xe3a5('0x6')];if(_[_0xe3a5('0x7')](_0x46dbe3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5e1507=_0xa86e6b[_0xe3a5('0x8')];var _0x4ff682=_0xa86e6b[_0xe3a5('0x9')];var _0x32fab4=_0x5e1507[_0xe3a5('0xa')]('-')[0x4];var _0x437915=_0x5e1507[_0xe3a5('0xa')]('-')[0x0];var _0x2c37d1=crypto[_0xe3a5('0xb')]('aes-256-ctr',util[_0xe3a5('0xc')](_0xe3a5('0xd'),_0x32fab4,_0x5e1507,_0x437915));var _0x2782c2=_0x2c37d1[_0xe3a5('0xe')](_0x46dbe3,'base64',_0xe3a5('0xf'));_0x2782c2+=_0x2c37d1[_0xe3a5('0x10')](_0xe3a5('0xf'));var _0xed6d6a=JSON[_0xe3a5('0x11')](_0x2782c2);_0xed6d6a[_0xe3a5('0x12')]=![];_0xed6d6a['uuid']=_0x5e1507;_0xed6d6a[_0xe3a5('0x13')]=hardware[_0xe3a5('0x14')]();if(_0x4ff682){var _0x35097b=crypto[_0xe3a5('0xb')](_0xe3a5('0x15'),config[_0xe3a5('0x16')][_0xe3a5('0x17')]);var _0x45aad6=_0x35097b[_0xe3a5('0xe')](_0x4ff682,'base64','utf8');_0x45aad6+=_0x35097b[_0xe3a5('0x10')](_0xe3a5('0xf'));_0xed6d6a['gray']=_0x45aad6;_0xed6d6a[_0xe3a5('0x18')]=moment(_0x45aad6)[_0xe3a5('0x19')](0x7,_0xe3a5('0x1a'))[_0xe3a5('0xc')]();_0xed6d6a[_0xe3a5('0x1b')]=_0xed6d6a[_0xe3a5('0x1c')]!=_0xed6d6a[_0xe3a5('0x13')]?_0xe3a5('0x1d'):'disabled';}return _0xed6d6a;}catch(_0x53091a){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe3a5('0x1e'),'uuid':_0xa86e6b[_0xe3a5('0x8')],'machineUuid':hardware[_0xe3a5('0x14')](),'message':_0x53091a[_0xe3a5('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe3a5('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0xa86e6b['data1'],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xe3a5('0x21')]=function(_0xd5f03b){return db[_0xe3a5('0x22')][_0xe3a5('0x23')](_[_0xe3a5('0x24')](_0xd5f03b,{'raw':!![],'where':{'id':0x1}}))[_0xe3a5('0x25')](function(_0x6839ee){return checkLicense(_0x6839ee,null);});};exports[_0xe3a5('0x26')]=checkLicense; \ No newline at end of file +var _0xea03=['%s:%s:%s','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','aes-256-ctr','update','deadline','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','message','Demo\x20license','getLicense','License','find','then','checkLicense','crypto','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format'];(function(_0xe31ddb,_0x4c335f){var _0x227539=function(_0x186e69){while(--_0x186e69){_0xe31ddb['push'](_0xe31ddb['shift']());}};_0x227539(++_0x4c335f);}(_0xea03,0x1ba));var _0x3ea0=function(_0xb19de0,_0x28572e){_0xb19de0=_0xb19de0-0x0;var _0x4d39ec=_0xea03[_0xb19de0];return _0x4d39ec;};'use strict';var crypto=require(_0x3ea0('0x0'));var util=require('util');var _=require(_0x3ea0('0x1'));var moment=require(_0x3ea0('0x2'));var hardware=require(_0x3ea0('0x3'));var config=require(_0x3ea0('0x4'));var db=require(_0x3ea0('0x5'))['db'];function checkLicense(_0x5d24b9,_0x4d62ed){if(_0x5d24b9){try{var _0x531f4a=_0x4d62ed||_0x5d24b9[_0x3ea0('0x6')];if(_[_0x3ea0('0x7')](_0x531f4a)){throw new Error(_0x3ea0('0x8'));}var _0xed8a4b=_0x5d24b9[_0x3ea0('0x9')];var _0x58cf30=_0x5d24b9[_0x3ea0('0xa')];var _0x13b5ab=_0xed8a4b[_0x3ea0('0xb')]('-')[0x4];var _0x35383d=_0xed8a4b[_0x3ea0('0xb')]('-')[0x0];var _0xdf2188=crypto[_0x3ea0('0xc')]('aes-256-ctr',util[_0x3ea0('0xd')](_0x3ea0('0xe'),_0x13b5ab,_0xed8a4b,_0x35383d));var _0x81ba56=_0xdf2188['update'](_0x531f4a,_0x3ea0('0xf'),_0x3ea0('0x10'));_0x81ba56+=_0xdf2188[_0x3ea0('0x11')](_0x3ea0('0x10'));var _0x5ec7fb=JSON[_0x3ea0('0x12')](_0x81ba56);_0x5ec7fb[_0x3ea0('0x13')]=![];_0x5ec7fb[_0x3ea0('0x14')]=_0xed8a4b;_0x5ec7fb[_0x3ea0('0x15')]=hardware[_0x3ea0('0x16')]();if(_0x58cf30){var _0x3df170=crypto['createDecipher'](_0x3ea0('0x17'),config['secrets']['session']);var _0x28b678=_0x3df170[_0x3ea0('0x18')](_0x58cf30,'base64','utf8');_0x28b678+=_0x3df170['final'](_0x3ea0('0x10'));_0x5ec7fb['gray']=_0x28b678;_0x5ec7fb[_0x3ea0('0x19')]=moment(_0x28b678)['add'](0x7,_0x3ea0('0x1a'))[_0x3ea0('0xd')]();_0x5ec7fb[_0x3ea0('0x1b')]=_0x5ec7fb[_0x3ea0('0x14')]!=_0x5ec7fb[_0x3ea0('0x15')]?_0x3ea0('0x1c'):_0x3ea0('0x1d');}return _0x5ec7fb;}catch(_0x3bd5c9){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3ea0('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x5d24b9[_0x3ea0('0x9')],'machineUuid':hardware[_0x3ea0('0x16')](),'message':_0x3bd5c9[_0x3ea0('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3ea0('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3ea0('0x20'),'uuid':_0x5d24b9[_0x3ea0('0x9')],'machineUuid':hardware[_0x3ea0('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x3ea0('0x21')]=function(_0x40b932){return db[_0x3ea0('0x22')][_0x3ea0('0x23')](_['defaults'](_0x40b932,{'raw':!![],'where':{'id':0x1}}))[_0x3ea0('0x24')](function(_0x3efaed){return checkLicense(_0x3efaed,null);});};exports[_0x3ea0('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 71fee53..e17f1c1 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 _0xaeaa=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xaeaa,0xf3));var _0xaaea=function(_0xdd9669,_0xa191e0){_0xdd9669=_0xdd9669-0x0;var _0x295444=_0xaeaa[_0xdd9669];return _0x295444;};'use strict';module['exports']={'DOMAIN':_0xaaea('0x0'),'SESSION_SECRET':_0xaaea('0x1'),'GOOGLE_ID':_0xaaea('0x2'),'GOOGLE_SECRET':_0xaaea('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x4ddb=['myappanuglar-secret','secret','exports'];(function(_0x19993b,_0x497594){var _0x3b73a9=function(_0x108403){while(--_0x108403){_0x19993b['push'](_0x19993b['shift']());}};_0x3b73a9(++_0x497594);}(_0x4ddb,0x1c7));var _0xb4dd=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0x4ddb[_0x5d9c37];return _0x1ba9eb;};'use strict';module[_0xb4dd('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xb4dd('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xb4dd('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 43daf0a..fc1c7fc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11f0=['File','%s-%s','error','info','Console','env','moment','winston','util','path','INFO','log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports'];(function(_0x51df92,_0x1f4cf6){var _0x211286=function(_0x3057b0){while(--_0x3057b0){_0x51df92['push'](_0x51df92['shift']());}};_0x211286(++_0x1f4cf6);}(_0x11f0,0xc3));var _0x011f=function(_0xe827ba,_0x318c2f){_0xe827ba=_0xe827ba-0x0;var _0x63f2e0=_0x11f0[_0xe827ba];return _0x63f2e0;};'use strict';var moment=require(_0x011f('0x0'));var winston=require(_0x011f('0x1'));var util=require(_0x011f('0x2'));var path=require(_0x011f('0x3'));var debugLevel=_0x011f('0x4');function filename(_0x154233,_0x469006){return path['join']('/var',_0x011f('0x5'),'xcally',util[_0x011f('0x6')]('%s-%s.log',_0x154233,_0x469006));}function formatter(_0x10906a,_0x280ee5){return util[_0x011f('0x6')](_0x011f('0x7'),moment()['format'](_0x011f('0x8')),_0x280ee5[_0x011f('0x9')][_0x011f('0xa')](),_0x10906a,_0x280ee5[_0x011f('0xb')]);}module[_0x011f('0xc')]=function(_0x14765b){return new winston[(_0x011f('0xd'))]({'transports':[new winston[(_0x011f('0xe'))][(_0x011f('0xf'))]({'name':util[_0x011f('0x6')](_0x011f('0x10'),_0x14765b,_0x011f('0x11')),'filename':filename(_0x14765b,_0x011f('0x11')),'level':_0x011f('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e098b){return formatter(_0x14765b,_0x4e098b);}}),new winston[(_0x011f('0xe'))]['File']({'name':util['format'](_0x011f('0x10'),_0x14765b,_0x011f('0x12')),'filename':filename(_0x14765b,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2fdbb1){return formatter(_0x14765b,_0x2fdbb1);}}),new winston[(_0x011f('0xe'))][(_0x011f('0x13'))]({'level':process[_0x011f('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x3382ff){return formatter(_0x14765b,_0x3382ff);}})]});}; \ No newline at end of file +var _0xfcbe=['debugLevel','moment','winston','util','path','INFO','join','/var','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','File','error','%s-%s','info','transports','Console'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfcbe,0x181));var _0xefcb=function(_0x2d8b2f,_0x1be1c7){_0x2d8b2f=_0x2d8b2f-0x0;var _0x4fb232=_0xfcbe[_0x2d8b2f];return _0x4fb232;};'use strict';var moment=require(_0xefcb('0x0'));var winston=require(_0xefcb('0x1'));var util=require(_0xefcb('0x2'));var path=require(_0xefcb('0x3'));var debugLevel=_0xefcb('0x4');function filename(_0x1b6583,_0x7377e0){return path[_0xefcb('0x5')](_0xefcb('0x6'),_0xefcb('0x7'),'xcally',util[_0xefcb('0x8')](_0xefcb('0x9'),_0x1b6583,_0x7377e0));}function formatter(_0x502c93,_0x133b77){return util[_0xefcb('0x8')](_0xefcb('0xa'),moment()['format'](_0xefcb('0xb')),_0x133b77[_0xefcb('0xc')][_0xefcb('0xd')](),_0x502c93,_0x133b77[_0xefcb('0xe')]);}module[_0xefcb('0xf')]=function(_0x5ecd6c){return new winston[(_0xefcb('0x10'))]({'transports':[new winston['transports'][(_0xefcb('0x11'))]({'name':util[_0xefcb('0x8')]('%s-%s',_0x5ecd6c,_0xefcb('0x12')),'filename':filename(_0x5ecd6c,_0xefcb('0x12')),'level':_0xefcb('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x556f28){return formatter(_0x5ecd6c,_0x556f28);}}),new winston['transports'][(_0xefcb('0x11'))]({'name':util['format'](_0xefcb('0x13'),_0x5ecd6c,_0xefcb('0x14')),'filename':filename(_0x5ecd6c,_0xefcb('0x14')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ad724){return formatter(_0x5ecd6c,_0x1ad724);}}),new winston[(_0xefcb('0x15'))][(_0xefcb('0x16'))]({'level':process['env'][_0xefcb('0x17')]||debugLevel,'json':![],'formatter':function(_0x1ac66f){return formatter(_0x5ecd6c,_0x1ac66f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index ea81e72..e37a673 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 _0xde64=['agi','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0x5030cb,_0x235afd){var _0x2bdf74=function(_0x276fa1){while(--_0x276fa1){_0x5030cb['push'](_0x5030cb['shift']());}};_0x2bdf74(++_0x235afd);}(_0xde64,0x17c));var _0x4de6=function(_0x30cf94,_0xae9636){_0x30cf94=_0x30cf94-0x0;var _0x4e7b40=_0xde64[_0x30cf94];return _0x4e7b40;};'use strict';var path=require(_0x4de6('0x0'));var os=require('os');var config={'apps':[{'name':_0x4de6('0x1'),'script':path[_0x4de6('0x2')](__dirname,_0x4de6('0x3'))},{'name':_0x4de6('0x4'),'script':path[_0x4de6('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x4de6('0x5'),'script':path[_0x4de6('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x4de6('0x2')](__dirname,_0x4de6('0x6'))},{'name':'routing','script':path['join'](__dirname,_0x4de6('0x7'))},{'name':_0x4de6('0x8'),'script':path[_0x4de6('0x2')](__dirname,_0x4de6('0x9'))}]};module[_0x4de6('0xa')]=config; \ No newline at end of file +var _0xa0d6=['join','../../services/agi/index.js','email','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami'];(function(_0x4c916a,_0x51b4b7){var _0x3452df=function(_0x24c129){while(--_0x24c129){_0x4c916a['push'](_0x4c916a['shift']());}};_0x3452df(++_0x51b4b7);}(_0xa0d6,0x1f0));var _0x6a0d=function(_0x5bd553,_0xe1512f){_0x5bd553=_0x5bd553-0x0;var _0x435568=_0xa0d6[_0x5bd553];return _0x435568;};'use strict';var path=require(_0x6a0d('0x0'));var os=require('os');var config={'apps':[{'name':_0x6a0d('0x1'),'script':path['join'](__dirname,_0x6a0d('0x2'))},{'name':_0x6a0d('0x3'),'script':path[_0x6a0d('0x4')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,_0x6a0d('0x5'))},{'name':_0x6a0d('0x6'),'script':path[_0x6a0d('0x4')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x6a0d('0x4')](__dirname,'../../services/routing/index.js')},{'name':_0x6a0d('0x7'),'script':path[_0x6a0d('0x4')](__dirname,_0x6a0d('0x8'))}]};module[_0x6a0d('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fa9d52d..d8bc386 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 _0x6631=['connected','start','then','disconnect','stop','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x984cb7,_0x563ee4){var _0x579006=function(_0x482682){while(--_0x482682){_0x984cb7['push'](_0x984cb7['shift']());}};_0x579006(++_0x563ee4);}(_0x6631,0x134));var _0x1663=function(_0xcf2ea7,_0x42de51){_0xcf2ea7=_0xcf2ea7-0x0;var _0x59ef59=_0x6631[_0xcf2ea7];return _0x59ef59;};'use strict';var pm2=require(_0x1663('0x0'));var BPromise=require(_0x1663('0x1'));var config=require(_0x1663('0x2'));function connect(){return new BPromise(function(_0x8a1e8e,_0x3f563e){return pm2[_0x1663('0x3')](function(_0x5e5e43){if(_0x5e5e43){return _0x3f563e(_0x5e5e43);}return _0x8a1e8e(_0x1663('0x4'));});});};exports[_0x1663('0x5')]=function(_0x232bfe){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x338908,_0x1faf52){return pm2[_0x1663('0x5')](_0x232bfe,function(_0x347c23,_0x168cf0){if(_0x347c23){return _0x1faf52(_0x347c23);}pm2[_0x1663('0x7')]();return _0x338908(_0x168cf0);});});});};exports[_0x1663('0x8')]=function(_0xc6c733){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x5d2ced,_0x181fb0){return pm2['stop'](_0xc6c733,function(_0x27ac53,_0x4becd1){if(_0x27ac53){return _0x181fb0(_0x27ac53);}pm2[_0x1663('0x7')]();return _0x5d2ced(_0x4becd1);});});});};exports['restart']=function(_0x2a8053){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x48e712,_0x22f979){return pm2['restart'](_0x2a8053,function(_0x3f828a,_0x204ace){if(_0x3f828a){return _0x22f979(_0x3f828a);}pm2[_0x1663('0x7')]();return _0x48e712(_0x204ace);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x3cd1ee,_0x23417f){return pm2['list'](function(_0xc839b9,_0x8565e6){if(_0xc839b9){return _0x23417f(_0xc839b9);}pm2[_0x1663('0x7')]();return _0x3cd1ee(_0x8565e6);});});});};exports[_0x1663('0x9')]=function(_0x180f82){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x26e925,_0x30598b){return pm2['describe'](_0x180f82,function(_0x5103a8,_0x57fa31){if(_0x5103a8){return _0x30598b(_0x5103a8);}pm2[_0x1663('0x7')]();return _0x26e925(_0x57fa31);});});});};exports['delete']=function(_0x19a783){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x2de0a7,_0xb9a911){return pm2[_0x1663('0xa')](_0x19a783,function(_0x1f4943,_0x4853b2){if(_0x1f4943){return _0xb9a911(_0x1f4943);}pm2[_0x1663('0x7')]();return _0x2de0a7(_0x4853b2);});});});};exports[_0x1663('0xb')]=function(){return connect()[_0x1663('0x6')](function(){return new BPromise(function(_0x377c81,_0x5b27b4){return pm2[_0x1663('0xb')](function(_0x2b8e2d){if(_0x2b8e2d){return _0x5b27b4(_0x2b8e2d);}return _0x377c81(_0x1663('0xc'));});});});}; \ No newline at end of file +var _0xcac6=['stop','restart','list','describe','delete','dump','saved','bluebird','./config','connected','start','then','disconnect'];(function(_0x1b1965,_0x31ce89){var _0x3d29fd=function(_0x219403){while(--_0x219403){_0x1b1965['push'](_0x1b1965['shift']());}};_0x3d29fd(++_0x31ce89);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var pm2=require('pm2');var BPromise=require(_0x6cac('0x0'));var config=require(_0x6cac('0x1'));function connect(){return new BPromise(function(_0x193a84,_0x73a7f7){return pm2['connect'](function(_0x50a4ed){if(_0x50a4ed){return _0x73a7f7(_0x50a4ed);}return _0x193a84(_0x6cac('0x2'));});});};exports[_0x6cac('0x3')]=function(_0x2810e7){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x42ea15,_0x44b83d){return pm2[_0x6cac('0x3')](_0x2810e7,function(_0x51a850,_0x2abd7b){if(_0x51a850){return _0x44b83d(_0x51a850);}pm2[_0x6cac('0x5')]();return _0x42ea15(_0x2abd7b);});});});};exports[_0x6cac('0x6')]=function(_0xde53ae){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x4cb1e3,_0x5c1dca){return pm2[_0x6cac('0x6')](_0xde53ae,function(_0x58564a,_0x1a0893){if(_0x58564a){return _0x5c1dca(_0x58564a);}pm2[_0x6cac('0x5')]();return _0x4cb1e3(_0x1a0893);});});});};exports[_0x6cac('0x7')]=function(_0x275141){return connect()['then'](function(){return new BPromise(function(_0x2c5f0c,_0x5ca873){return pm2[_0x6cac('0x7')](_0x275141,function(_0x38596e,_0x2d21fd){if(_0x38596e){return _0x5ca873(_0x38596e);}pm2[_0x6cac('0x5')]();return _0x2c5f0c(_0x2d21fd);});});});};exports[_0x6cac('0x8')]=function(){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x544b50,_0x479bf1){return pm2['list'](function(_0x2e4f43,_0x189107){if(_0x2e4f43){return _0x479bf1(_0x2e4f43);}pm2['disconnect']();return _0x544b50(_0x189107);});});});};exports[_0x6cac('0x9')]=function(_0x47e205){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x14a13b,_0x5b002c){return pm2[_0x6cac('0x9')](_0x47e205,function(_0x2dfdc1,_0x440058){if(_0x2dfdc1){return _0x5b002c(_0x2dfdc1);}pm2['disconnect']();return _0x14a13b(_0x440058);});});});};exports[_0x6cac('0xa')]=function(_0x4cd6b4){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x45adb0,_0x3c8e59){return pm2[_0x6cac('0xa')](_0x4cd6b4,function(_0x3f9375,_0x3188aa){if(_0x3f9375){return _0x3c8e59(_0x3f9375);}pm2[_0x6cac('0x5')]();return _0x45adb0(_0x3188aa);});});});};exports['dump']=function(){return connect()[_0x6cac('0x4')](function(){return new BPromise(function(_0x4c0361,_0x30cd33){return pm2[_0x6cac('0xb')](function(_0x683b3){if(_0x683b3){return _0x30cd33(_0x683b3);}return _0x4c0361(_0x6cac('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 67e5a70..86df88c 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 _0x3931=['map','length','emit','chatInteraction:update','catch','error','start','lodash','moment','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','update','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x3931,0x1cf));var _0x1393=function(_0x2e4fe3,_0x46dcf2){_0x2e4fe3=_0x2e4fe3-0x0;var _0x2ee885=_0x3931[_0x2e4fe3];return _0x2ee885;};'use strict';var _=require(_0x1393('0x0'));var moment=require(_0x1393('0x1'));var Redis=require('ioredis');var db=require(_0x1393('0x2'))['db'];var config=require(_0x1393('0x3'));config[_0x1393('0x4')]=_[_0x1393('0x5')](config[_0x1393('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1393('0x6'))(new Redis(config[_0x1393('0x4')]));function closeInteractions(){var _0x5d3f5e=0x0;var _0x21feb8=[];return db['Setting'][_0x1393('0x7')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x1393('0x8')](function(_0x5658ea){_0x5d3f5e=_0x5658ea[_0x1393('0x9')];if(_0x5d3f5e){return db[_0x1393('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x1393('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1393('0xc')](_0x5658ea[_0x1393('0x9')],_0x1393('0xd'))}}});}else{return[];}})[_0x1393('0x8')](function(_0x344f88){_0x21feb8=_0x344f88;if(_0x5d3f5e){return db[_0x1393('0xa')][_0x1393('0xe')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x1393('0xf')](_0x1393('0x10'))},{'where':{'id':_[_0x1393('0x11')](_0x21feb8||[],'id')}});}})['then'](function(_0x296b76){for(var _0x29d904=0x0;_0x29d904<_0x21feb8[_0x1393('0x12')];_0x29d904++){io[_0x1393('0x13')](_0x1393('0x14'),{'id':_0x21feb8[_0x29d904]['id'],'closed':!![]});}})[_0x1393('0x15')](function(_0x41eb44){console[_0x1393('0x16')](_0x41eb44);});}exports[_0x1393('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6ea6=['localhost','socket.io-emitter','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','timeout','format','map','length','emit','chatInteraction:update','catch','error','start','lodash','ioredis','../../mysqldb','../../config/environment','redis','defaults'];(function(_0x3c3583,_0x23c5fe){var _0x49e5a1=function(_0x1937bc){while(--_0x1937bc){_0x3c3583['push'](_0x3c3583['shift']());}};_0x49e5a1(++_0x23c5fe);}(_0x6ea6,0x19a));var _0x66ea=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x6ea6[_0x36c6eb];return _0x30675b;};'use strict';var _=require(_0x66ea('0x0'));var moment=require('moment');var Redis=require(_0x66ea('0x1'));var db=require(_0x66ea('0x2'))['db'];var config=require(_0x66ea('0x3'));config[_0x66ea('0x4')]=_[_0x66ea('0x5')](config['redis'],{'host':_0x66ea('0x6'),'port':0x18eb});var io=require(_0x66ea('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x23acac=0x0;var _0x365832=[];return db[_0x66ea('0x8')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x66ea('0x9')](function(_0x36aa34){_0x23acac=_0x36aa34[_0x66ea('0xa')];if(_0x23acac){return db[_0x66ea('0xb')][_0x66ea('0xc')]({'raw':!![],'attributes':['id',_0x66ea('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x66ea('0xe')](_0x36aa34['chatTimeout'],_0x66ea('0xf'))}}});}else{return[];}})[_0x66ea('0x9')](function(_0x53f78e){_0x365832=_0x53f78e;if(_0x23acac){return db[_0x66ea('0xb')]['update']({'closeReason':_0x66ea('0x10'),'disposition':_0x66ea('0x11'),'closed':!![],'closedAt':moment()[_0x66ea('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x66ea('0x13')](_0x365832||[],'id')}});}})['then'](function(_0x310c44){for(var _0x52cb20=0x0;_0x52cb20<_0x365832[_0x66ea('0x14')];_0x52cb20++){io[_0x66ea('0x15')](_0x66ea('0x16'),{'id':_0x365832[_0x52cb20]['id'],'closed':!![]});}})[_0x66ea('0x17')](function(_0x24a8a5){console[_0x66ea('0x18')](_0x24a8a5);});}exports[_0x66ea('0x19')]=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 2bf154d..f37f170 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 _0xaee1=['bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','error','error\x20mail','email\x20sent','catch','info','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','keyBy','intersection','length','toString','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','start','add\x20cron','deleteJob','exists','startAt','stop\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','email','user'];(function(_0x33ec0b,_0x5339ed){var _0x27d163=function(_0x4c73ad){while(--_0x4c73ad){_0x33ec0b['push'](_0x33ec0b['shift']());}};_0x27d163(++_0x5339ed);}(_0xaee1,0xea));var _0x1aee=function(_0x1ebff0,_0x3d2b5d){_0x1ebff0=_0x1ebff0-0x0;var _0x2ce73e=_0xaee1[_0x1ebff0];return _0x2ce73e;};'use strict';var fs=require('fs');var util=require(_0x1aee('0x0'));var path=require(_0x1aee('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x1aee('0x2'));var jayson=require(_0x1aee('0x3'));var BPromise=require(_0x1aee('0x4'));var logger=require('../logger')(_0x1aee('0x5'));var db=require(_0x1aee('0x6'))['db'];var analyticCustomReportController=require(_0x1aee('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1aee('0x8')][_0x1aee('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x10af20,_0x37adbe){return function(){logger['info'](_0x1aee('0xa'),_0x10af20['email']);var _0x5b42b6=!![];var _0x59b0f6={'tls':{'rejectUnauthorized':![]}};if(_0x10af20['MailAccount'][_0x1aee('0xb')][_0x1aee('0xc')]){_0x59b0f6[_0x1aee('0xc')]=_0x10af20[_0x1aee('0xd')]['Smtp'][_0x1aee('0xc')];}else{_0x59b0f6[_0x1aee('0xe')]=_0x10af20['MailAccount'][_0x1aee('0xb')][_0x1aee('0xe')];_0x59b0f6[_0x1aee('0xf')]=_0x10af20[_0x1aee('0xd')][_0x1aee('0xb')][_0x1aee('0xf')];_0x59b0f6['secure']=_0x10af20[_0x1aee('0xd')]['Smtp'][_0x1aee('0x10')];}if(_0x10af20[_0x1aee('0xd')]['Smtp']['authentication']){_0x59b0f6[_0x1aee('0x11')]={'user':_0x10af20[_0x1aee('0xd')]['Smtp']['user'],'pass':_0x10af20['MailAccount']['Smtp'][_0x1aee('0x12')]};}var _0x4771ff={'account':_0x59b0f6,'message':{'from':util[_0x1aee('0x13')](_0x1aee('0x14'),_0x10af20[_0x1aee('0xd')][_0x1aee('0x15')],_0x10af20[_0x1aee('0xd')][_0x1aee('0x16')]||_0x10af20[_0x1aee('0xd')]['Smtp'][_0x1aee('0x17')]),'to':_0x10af20['email'],'cc':_0x10af20['cc'],'bcc':_0x10af20[_0x1aee('0x18')],'subject':util[_0x1aee('0x13')](_0x1aee('0x19'),_0x37adbe['name'],_0x10af20[_0x1aee('0x1a')],_0x10af20['subtractUnit'])}};var _0x47ff22=path[_0x1aee('0x1b')](__dirname,'../../files/reports');var _0x2eeebe=_0x37adbe['savename'];var _0x49e4ca=util['format']('%s.%s',path['basename'](_0x37adbe['savename'],path[_0x1aee('0x1c')](_0x37adbe['savename'])),_0x1aee('0x1d'));var _0xccaa41=path[_0x1aee('0x1b')](_0x47ff22,_0x2eeebe);var _0x451dff=path[_0x1aee('0x1b')](_0x47ff22,_0x49e4ca);if(fs[_0x1aee('0x1e')](_0xccaa41)){_0x37adbe[_0x1aee('0x1f')]=_0x1aee('0x20');_0x4771ff[_0x1aee('0x21')][_0x1aee('0x22')]=[{'filename':_0x2eeebe,'path':_0xccaa41}];_0x4771ff[_0x1aee('0x21')][_0x1aee('0x23')]=util[_0x1aee('0x13')](_0x1aee('0x24'),JSON[_0x1aee('0x25')](_0x37adbe,null,0x2));}else if(fs[_0x1aee('0x1e')](_0x451dff)){_0x37adbe[_0x1aee('0x1f')]=_0x1aee('0x20');_0x4771ff[_0x1aee('0x21')][_0x1aee('0x22')]=[{'filename':_0x49e4ca,'path':_0x451dff}];}else{_0x4771ff[_0x1aee('0x21')]['text']=_0x1aee('0x26');if(!_0x10af20[_0x1aee('0x27')]){_0x5b42b6=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5b42b6){return client[_0x1aee('0x28')]('SendMail',_0x4771ff)['then'](function(_0xeda1ea){if(_0xeda1ea[_0x1aee('0x29')]){return logger[_0x1aee('0x29')](_0x1aee('0x2a'),JSON[_0x1aee('0x25')](_0xeda1ea));}return logger['info'](_0x1aee('0x2b'));})[_0x1aee('0x2c')](function(_0x4201ab){return logger[_0x1aee('0x29')]('error\x20mail',JSON[_0x1aee('0x25')](_0x4201ab));});}};}function handleError(){return function(_0x3c4e5d){return logger['error'](JSON['stringify'](_0x3c4e5d));};}function handleResult(_0x305501){return function(_0x6ac233){logger[_0x1aee('0x2d')](_0x1aee('0x2e'),JSON[_0x1aee('0x25')](_0x6ac233));if(_0x305501[_0x1aee('0xd')]&&_0x305501['MailAccount'][_0x1aee('0xb')]&&!_['isNil'](_0x305501['email'])){setTimeout(handleSendEmail(_0x305501,_0x6ac233),0x3c*0x3e8);}};}function handleJob(_0x3354e8){return function(){try{if(_[_0x1aee('0x2f')](_0x3354e8[_0x1aee('0x1a')])){return logger['info'](_0x1aee('0x30'));}if(_[_0x1aee('0x2f')](_0x3354e8[_0x1aee('0x31')])){return logger[_0x1aee('0x2d')](_0x1aee('0x32'));}var _0x5a37e1={'startDate':moment()['subtract'](_0x3354e8[_0x1aee('0x1a')],_0x3354e8['subtractUnit'])[_0x1aee('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x1aee('0x33')),'type':'scheduled','output':_0x3354e8[_0x1aee('0x34')],'name':_0x3354e8[_0x1aee('0x15')]};if(!_['isNil'](_0x3354e8['DefaultReportId'])){logger[_0x1aee('0x2d')](_0x1aee('0x35'),_0x3354e8[_0x1aee('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x3354e8[_0x1aee('0x36')]},_0x5a37e1)[_0x1aee('0x37')](handleResult(_0x3354e8))[_0x1aee('0x2c')](handleError());}if(!_['isNil'](_0x3354e8[_0x1aee('0x38')])){logger[_0x1aee('0x2d')]('exec\x20custom\x20report\x20id:%s',_0x3354e8[_0x1aee('0x38')]);return analyticCustomReportController[_0x1aee('0x39')]({'id':_0x3354e8[_0x1aee('0x38')]},_0x5a37e1)[_0x1aee('0x37')](handleResult(_0x3354e8))[_0x1aee('0x2c')](handleError());}}catch(_0x2960ee){logger[_0x1aee('0x29')](JSON[_0x1aee('0x25')](_0x2960ee));}return logger[_0x1aee('0x2d')](_0x1aee('0x3a'));};}function getJobs(_0x27528e){var _0x40c589={};if(_0x27528e){_0x40c589['id']=_0x27528e;}return db[_0x1aee('0x3b')][_0x1aee('0x3c')]({'where':_0x40c589,'include':[{'model':db[_0x1aee('0xd')],'attributes':['id',_0x1aee('0x15'),_0x1aee('0x16')],'include':[{'model':db[_0x1aee('0x3d')],'as':'Smtp'}]}]})[_0x1aee('0x37')](function(_0xc24e70){var _0x3b7080=_[_0x1aee('0x3e')](manager[_0x1aee('0x3f')]);var _0x44f788=_[_0x1aee('0x40')](_0xc24e70,function(_0x432266){return _0x432266['id']['toString']();});var _0x10881c=_[_0x1aee('0x41')](_0xc24e70,function(_0x49e95e){return _0x49e95e['id']['toString']();});var _0x23ef0d=_0x27528e?_0x44f788:_['difference'](_0x44f788,_0x3b7080);var _0x4835fb=_[_0x1aee('0x42')](_0x44f788,_0x3b7080);var _0x34aacd=_['difference'](_0x3b7080,_0x44f788);var _0x43f0c3;var _0x5e2831;for(_0x43f0c3=0x0;_0x43f0c3<_0x34aacd[_0x1aee('0x43')]&&!_0x27528e;_0x43f0c3+=0x1){_0x5e2831=_0x34aacd[_0x43f0c3][_0x1aee('0x44')]();if(manager['exists'](_0x5e2831)){manager[_0x1aee('0x45')](_0x5e2831);manager['deleteJob'](_0x5e2831);logger[_0x1aee('0x2d')](_0x1aee('0x46'),_0x5e2831);}}logger['info'](_0x1aee('0x47'),JSON['stringify'](_0x23ef0d));for(_0x43f0c3=0x0;_0x43f0c3<_0x23ef0d['length'];_0x43f0c3+=0x1){_0x5e2831=_0x23ef0d[_0x43f0c3][_0x1aee('0x44')]();logger['info'](_0x1aee('0x48'),_0x5e2831);if(_0x27528e){logger[_0x1aee('0x2d')](_0x1aee('0x49'),_0x27528e);logger[_0x1aee('0x2d')](JSON[_0x1aee('0x25')](_0x10881c[_0x5e2831]));BPromise[_0x1aee('0x4a')]()[_0x1aee('0x37')](handleJob(_0x10881c[_0x5e2831]));logger['info'](_0x1aee('0x4b'),_0x10881c[_0x5e2831]['name'],_0x10881c[_0x5e2831][_0x1aee('0x4c')]);}else if(_0x10881c[_0x5e2831][_0x1aee('0x4c')]&&_0x10881c[_0x5e2831]['active']&&moment()[_0x1aee('0x4d')](_0x10881c[_0x5e2831]['startAt'],_0x10881c[_0x5e2831][_0x1aee('0x4e')])){manager['add'](_0x5e2831,_0x10881c[_0x5e2831]['cron'],handleJob(_0x10881c[_0x5e2831]));manager[_0x1aee('0x4f')](_0x5e2831);logger[_0x1aee('0x2d')](_0x1aee('0x50'),_0x10881c[_0x5e2831][_0x1aee('0x15')],_0x10881c[_0x5e2831]['cron']);}else if(manager['exists'](_0x5e2831)){manager[_0x1aee('0x45')](_0x5e2831);manager[_0x1aee('0x51')](_0x5e2831);logger[_0x1aee('0x2d')]('stop\x20cron',_0x10881c[_0x5e2831][_0x1aee('0x15')],_0x10881c[_0x5e2831][_0x1aee('0x4c')]);}}for(_0x43f0c3=0x0,_0x5e2831;_0x43f0c3<_0x4835fb[_0x1aee('0x43')]&&!_0x27528e;_0x43f0c3+=0x1){_0x5e2831=_0x4835fb[_0x43f0c3][_0x1aee('0x44')]();if(manager[_0x1aee('0x52')](_0x5e2831)){if(_0x10881c[_0x5e2831][_0x1aee('0x4c')]&&_0x10881c[_0x5e2831]['active']&&moment()[_0x1aee('0x4d')](_0x10881c[_0x5e2831][_0x1aee('0x53')],_0x10881c[_0x5e2831][_0x1aee('0x4e')])){manager['update'](_0x5e2831,_0x10881c[_0x5e2831][_0x1aee('0x4c')],handleJob(_0x10881c[_0x5e2831]));logger[_0x1aee('0x2d')]('update\x20cron',_0x10881c[_0x5e2831][_0x1aee('0x15')],_0x10881c[_0x5e2831][_0x1aee('0x4c')]);}else{manager['stop'](_0x5e2831);manager['deleteJob'](_0x5e2831);logger[_0x1aee('0x2d')](_0x1aee('0x54'),_0x10881c[_0x5e2831]['name'],_0x10881c[_0x5e2831][_0x1aee('0x4c')]);}}}})[_0x1aee('0x2c')](function(_0x466de0){logger[_0x1aee('0x29')](JSON[_0x1aee('0x25')](_0x466de0));});}exports[_0x1aee('0x55')]=function(_0x4bb26a){return getJobs(_0x4bb26a);};exports[_0x1aee('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf738=['then','error\x20mail','catch','error','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','add','stop\x20cron','isBetween','startAt','endAt','update','update\x20cron','start','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','authentication','user','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','extname','zip','status','Sent','message','attachments','stringify','existsSync','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf738,0x18e));var _0x8f73=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xf738[_0xe66cf2];return _0x2d84e7;};'use strict';var fs=require('fs');var util=require(_0x8f73('0x0'));var path=require(_0x8f73('0x1'));var _=require(_0x8f73('0x2'));var moment=require(_0x8f73('0x3'));var CronJobManager=require(_0x8f73('0x4'));var jayson=require(_0x8f73('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0x8f73('0x6'));var db=require(_0x8f73('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x8f73('0x8'));var client=jayson['client'][_0x8f73('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x26aa8c,_0x5f31d3){return function(){logger[_0x8f73('0xa')](_0x8f73('0xb'),_0x26aa8c[_0x8f73('0xc')]);var _0xf6b249=!![];var _0x4b2796={'tls':{'rejectUnauthorized':![]}};if(_0x26aa8c['MailAccount'][_0x8f73('0xd')][_0x8f73('0xe')]){_0x4b2796[_0x8f73('0xe')]=_0x26aa8c[_0x8f73('0xf')][_0x8f73('0xd')][_0x8f73('0xe')];}else{_0x4b2796[_0x8f73('0x10')]=_0x26aa8c['MailAccount'][_0x8f73('0xd')][_0x8f73('0x10')];_0x4b2796['port']=_0x26aa8c['MailAccount']['Smtp'][_0x8f73('0x11')];_0x4b2796[_0x8f73('0x12')]=_0x26aa8c[_0x8f73('0xf')][_0x8f73('0xd')]['secure'];}if(_0x26aa8c[_0x8f73('0xf')][_0x8f73('0xd')][_0x8f73('0x13')]){_0x4b2796['auth']={'user':_0x26aa8c[_0x8f73('0xf')][_0x8f73('0xd')][_0x8f73('0x14')],'pass':_0x26aa8c[_0x8f73('0xf')]['Smtp']['pass']};}var _0x102697={'account':_0x4b2796,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x26aa8c[_0x8f73('0xf')][_0x8f73('0x15')],_0x26aa8c['MailAccount'][_0x8f73('0xc')]||_0x26aa8c['MailAccount'][_0x8f73('0xd')][_0x8f73('0x14')]),'to':_0x26aa8c[_0x8f73('0xc')],'cc':_0x26aa8c['cc'],'bcc':_0x26aa8c['bcc'],'subject':util[_0x8f73('0x16')](_0x8f73('0x17'),_0x5f31d3['name'],_0x26aa8c['subtractNumber'],_0x26aa8c[_0x8f73('0x18')])}};var _0x2c26f5=path[_0x8f73('0x19')](__dirname,'../../files/reports');var _0x43dfe4=_0x5f31d3[_0x8f73('0x1a')];var _0x3d3794=util[_0x8f73('0x16')](_0x8f73('0x1b'),path['basename'](_0x5f31d3[_0x8f73('0x1a')],path[_0x8f73('0x1c')](_0x5f31d3['savename'])),_0x8f73('0x1d'));var _0x519870=path[_0x8f73('0x19')](_0x2c26f5,_0x43dfe4);var _0x34e8a7=path[_0x8f73('0x19')](_0x2c26f5,_0x3d3794);if(fs['existsSync'](_0x519870)){_0x5f31d3[_0x8f73('0x1e')]=_0x8f73('0x1f');_0x102697[_0x8f73('0x20')][_0x8f73('0x21')]=[{'filename':_0x43dfe4,'path':_0x519870}];_0x102697[_0x8f73('0x20')]['text']=util[_0x8f73('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8f73('0x22')](_0x5f31d3,null,0x2));}else if(fs[_0x8f73('0x23')](_0x34e8a7)){_0x5f31d3[_0x8f73('0x1e')]='Sent';_0x102697[_0x8f73('0x20')][_0x8f73('0x21')]=[{'filename':_0x3d3794,'path':_0x34e8a7}];}else{_0x102697['message'][_0x8f73('0x24')]=_0x8f73('0x25');if(!_0x26aa8c[_0x8f73('0x26')]){_0xf6b249=![];logger[_0x8f73('0xa')](_0x8f73('0x27'));}}if(_0xf6b249){return client[_0x8f73('0x28')](_0x8f73('0x29'),_0x102697)[_0x8f73('0x2a')](function(_0x182189){if(_0x182189['error']){return logger['error'](_0x8f73('0x2b'),JSON[_0x8f73('0x22')](_0x182189));}return logger[_0x8f73('0xa')]('email\x20sent');})[_0x8f73('0x2c')](function(_0x3186ce){return logger[_0x8f73('0x2d')](_0x8f73('0x2b'),JSON[_0x8f73('0x22')](_0x3186ce));});}};}function handleError(){return function(_0x1c2612){return logger[_0x8f73('0x2d')](JSON[_0x8f73('0x22')](_0x1c2612));};}function handleResult(_0x16175a){return function(_0x140d39){logger['info']('data',JSON[_0x8f73('0x22')](_0x140d39));if(_0x16175a[_0x8f73('0xf')]&&_0x16175a[_0x8f73('0xf')][_0x8f73('0xd')]&&!_[_0x8f73('0x2e')](_0x16175a[_0x8f73('0xc')])){setTimeout(handleSendEmail(_0x16175a,_0x140d39),0x3c*0x3e8);}};}function handleJob(_0x1ca4c6){return function(){try{if(_[_0x8f73('0x2e')](_0x1ca4c6[_0x8f73('0x2f')])){return logger[_0x8f73('0xa')](_0x8f73('0x30'));}if(_[_0x8f73('0x2e')](_0x1ca4c6['subtractUnit'])){return logger[_0x8f73('0xa')](_0x8f73('0x31'));}var _0x2a24a0={'startDate':moment()['subtract'](_0x1ca4c6['subtractNumber'],_0x1ca4c6[_0x8f73('0x18')])[_0x8f73('0x16')](_0x8f73('0x32')),'endDate':moment()[_0x8f73('0x16')](_0x8f73('0x32')),'type':_0x8f73('0x33'),'output':_0x1ca4c6['output'],'name':_0x1ca4c6['name']};if(!_['isNil'](_0x1ca4c6['DefaultReportId'])){logger[_0x8f73('0xa')](_0x8f73('0x34'),_0x1ca4c6[_0x8f73('0x35')]);return analyticDefaultReportController[_0x8f73('0x36')]({'id':_0x1ca4c6[_0x8f73('0x35')]},_0x2a24a0)[_0x8f73('0x2a')](handleResult(_0x1ca4c6))[_0x8f73('0x2c')](handleError());}if(!_['isNil'](_0x1ca4c6[_0x8f73('0x37')])){logger['info'](_0x8f73('0x38'),_0x1ca4c6[_0x8f73('0x37')]);return analyticCustomReportController['runReport']({'id':_0x1ca4c6['CustomReportId']},_0x2a24a0)[_0x8f73('0x2a')](handleResult(_0x1ca4c6))[_0x8f73('0x2c')](handleError());}}catch(_0x423b7c){logger[_0x8f73('0x2d')](JSON[_0x8f73('0x22')](_0x423b7c));}return logger[_0x8f73('0xa')](_0x8f73('0x39'));};}function getJobs(_0xcf1131){var _0x593d42={};if(_0xcf1131){_0x593d42['id']=_0xcf1131;}return db[_0x8f73('0x3a')][_0x8f73('0x3b')]({'where':_0x593d42,'include':[{'model':db[_0x8f73('0xf')],'attributes':['id',_0x8f73('0x15'),_0x8f73('0xc')],'include':[{'model':db[_0x8f73('0x3c')],'as':_0x8f73('0xd')}]}]})[_0x8f73('0x2a')](function(_0x2eaebd){var _0x1803b5=_[_0x8f73('0x3d')](manager[_0x8f73('0x3e')]);var _0x2c14eb=_[_0x8f73('0x3f')](_0x2eaebd,function(_0x1e24bb){return _0x1e24bb['id'][_0x8f73('0x40')]();});var _0x10ae6e=_[_0x8f73('0x41')](_0x2eaebd,function(_0x4c18fe){return _0x4c18fe['id'][_0x8f73('0x40')]();});var _0x3c61b8=_0xcf1131?_0x2c14eb:_[_0x8f73('0x42')](_0x2c14eb,_0x1803b5);var _0x438542=_[_0x8f73('0x43')](_0x2c14eb,_0x1803b5);var _0x34d8f3=_[_0x8f73('0x42')](_0x1803b5,_0x2c14eb);var _0x3caccc;var _0x38fa6f;for(_0x3caccc=0x0;_0x3caccc<_0x34d8f3[_0x8f73('0x44')]&&!_0xcf1131;_0x3caccc+=0x1){_0x38fa6f=_0x34d8f3[_0x3caccc][_0x8f73('0x40')]();if(manager[_0x8f73('0x45')](_0x38fa6f)){manager[_0x8f73('0x46')](_0x38fa6f);manager[_0x8f73('0x47')](_0x38fa6f);logger[_0x8f73('0xa')](_0x8f73('0x48'),_0x38fa6f);}}logger[_0x8f73('0xa')](_0x8f73('0x49'),JSON['stringify'](_0x3c61b8));for(_0x3caccc=0x0;_0x3caccc<_0x3c61b8[_0x8f73('0x44')];_0x3caccc+=0x1){_0x38fa6f=_0x3c61b8[_0x3caccc][_0x8f73('0x40')]();logger[_0x8f73('0xa')](_0x8f73('0x4a'),_0x38fa6f);if(_0xcf1131){logger['info'](_0x8f73('0x4b'),_0xcf1131);logger[_0x8f73('0xa')](JSON[_0x8f73('0x22')](_0x10ae6e[_0x38fa6f]));BPromise[_0x8f73('0x4c')]()['then'](handleJob(_0x10ae6e[_0x38fa6f]));logger[_0x8f73('0xa')](_0x8f73('0x4d'),_0x10ae6e[_0x38fa6f][_0x8f73('0x15')],_0x10ae6e[_0x38fa6f][_0x8f73('0x4e')]);}else if(_0x10ae6e[_0x38fa6f]['cron']&&_0x10ae6e[_0x38fa6f][_0x8f73('0x4f')]&&moment()['isBetween'](_0x10ae6e[_0x38fa6f]['startAt'],_0x10ae6e[_0x38fa6f]['endAt'])){manager[_0x8f73('0x50')](_0x38fa6f,_0x10ae6e[_0x38fa6f]['cron'],handleJob(_0x10ae6e[_0x38fa6f]));manager['start'](_0x38fa6f);logger['info']('add\x20cron',_0x10ae6e[_0x38fa6f]['name'],_0x10ae6e[_0x38fa6f][_0x8f73('0x4e')]);}else if(manager['exists'](_0x38fa6f)){manager['stop'](_0x38fa6f);manager[_0x8f73('0x47')](_0x38fa6f);logger['info'](_0x8f73('0x51'),_0x10ae6e[_0x38fa6f][_0x8f73('0x15')],_0x10ae6e[_0x38fa6f][_0x8f73('0x4e')]);}}for(_0x3caccc=0x0,_0x38fa6f;_0x3caccc<_0x438542[_0x8f73('0x44')]&&!_0xcf1131;_0x3caccc+=0x1){_0x38fa6f=_0x438542[_0x3caccc][_0x8f73('0x40')]();if(manager[_0x8f73('0x45')](_0x38fa6f)){if(_0x10ae6e[_0x38fa6f][_0x8f73('0x4e')]&&_0x10ae6e[_0x38fa6f][_0x8f73('0x4f')]&&moment()[_0x8f73('0x52')](_0x10ae6e[_0x38fa6f][_0x8f73('0x53')],_0x10ae6e[_0x38fa6f][_0x8f73('0x54')])){manager[_0x8f73('0x55')](_0x38fa6f,_0x10ae6e[_0x38fa6f]['cron'],handleJob(_0x10ae6e[_0x38fa6f]));logger[_0x8f73('0xa')](_0x8f73('0x56'),_0x10ae6e[_0x38fa6f][_0x8f73('0x15')],_0x10ae6e[_0x38fa6f]['cron']);}else{manager[_0x8f73('0x46')](_0x38fa6f);manager[_0x8f73('0x47')](_0x38fa6f);logger[_0x8f73('0xa')](_0x8f73('0x51'),_0x10ae6e[_0x38fa6f][_0x8f73('0x15')],_0x10ae6e[_0x38fa6f][_0x8f73('0x4e')]);}}}})[_0x8f73('0x2c')](function(_0x2863d9){logger['error'](JSON[_0x8f73('0x22')](_0x2863d9));});}exports['run']=function(_0x147614){return getJobs(_0x147614);};exports[_0x8f73('0x57')]=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 aa716ce..d99a3f6 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 _0xcfd5=['Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[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\x20Analysis\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','catch','start','lodash','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob'];(function(_0x3152c8,_0x241ce3){var _0x206033=function(_0x27932a){while(--_0x27932a){_0x3152c8['push'](_0x3152c8['shift']());}};_0x206033(++_0x241ce3);}(_0xcfd5,0x90));var _0x5cfd=function(_0x10cb7f,_0x1e506a){_0x10cb7f=_0x10cb7f-0x0;var _0x4f2c1e=_0xcfd5[_0x10cb7f];return _0x4f2c1e;};var _=require(_0x5cfd('0x0'));var AWS=require(_0x5cfd('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x5cfd('0x2'));var db=require(_0x5cfd('0x3'))['db'];var logger=require(_0x5cfd('0x4'))(_0x5cfd('0x5'));function getTranscriptionJob(_0x29cba9,_0x2f8281,_0x8a1930,_0x1cb3c2){return new Promise(function(_0xd3284,_0x5af5be){var _0x3983bc=new AWS[(_0x5cfd('0x6'))]({'accessKeyId':_0x2f8281,'secretAccessKey':_0x29cba9,'region':_0x8a1930});_0x3983bc[_0x5cfd('0x7')]({'TranscriptionJobName':_0x1cb3c2},function(_0x8f2540,_0x3139f6){if(_0x8f2540){return _0x5af5be(_0x8f2540);}else{return _0xd3284(_0x3139f6);}});});}function sentiment(_0x19079f,_0x428e12,_0x4ced7f,_0x59d013,_0x5f1079){return new Promise(function(_0x46b2b2,_0x104012){var _0x4c8b9d=new AWS[(_0x5cfd('0x8'))]({'accessKeyId':_0x428e12,'secretAccessKey':_0x19079f,'region':_0x4ced7f});_0x4c8b9d[_0x5cfd('0x9')]({'Text':_0x59d013,'LanguageCode':_0x5f1079[_0x5cfd('0xa')](0x0,0x2)},function(_0x508cdb,_0x52e8f9){if(_0x508cdb){return _0x104012(_0x508cdb);}else{return _0x46b2b2(_0x52e8f9);}});});}function checkTranscribeJob(_0x3714e1,_0x42bf8f,_0x4bfed6){var _0x1ccddd;return new BPromise(function(_0x628230,_0x1d4c54){logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0xd'),_0x3714e1['id'],_0x3714e1[_0x5cfd('0xe')]));return getTranscriptionJob(_0x4bfed6[_0x5cfd('0xf')],_0x4bfed6[_0x5cfd('0x10')],_0x42bf8f[_0x5cfd('0x11')],_0x3714e1['transcribeName'])[_0x5cfd('0x12')](function(_0x49dc4d){logger['info'](util[_0x5cfd('0xc')](_0x5cfd('0x13'),_0x3714e1['id'],_0x3714e1[_0x5cfd('0xe')],_0x49dc4d[_0x5cfd('0x14')][_0x5cfd('0x15')]));if(!_0x3714e1[_0x5cfd('0x16')]){switch(_0x49dc4d[_0x5cfd('0x14')][_0x5cfd('0x15')]){case _0x5cfd('0x17'):var _0x4dc1ff={'transcribeStatus':_0x49dc4d[_0x5cfd('0x14')][_0x5cfd('0x15')],'fileUri':_0x49dc4d[_0x5cfd('0x14')][_0x5cfd('0x18')][_0x5cfd('0x19')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x3714e1['id']));return rp({'uri':_0x49dc4d['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x5cfd('0x12')](function(_0x23e0e6){logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0x1a'),_0x3714e1['id']));if(_0x23e0e6&&_0x23e0e6[_0x5cfd('0x1b')]&&_0x23e0e6['results'][_0x5cfd('0x1c')]&&_0x23e0e6[_0x5cfd('0x1b')]['transcripts'][_0x5cfd('0x1d')]){_0x4dc1ff[_0x5cfd('0x16')]='';for(var _0x4bcce6=0x0;_0x4bcce6<_0x23e0e6[_0x5cfd('0x1b')][_0x5cfd('0x1c')][_0x5cfd('0x1d')];_0x4bcce6++){_0x4dc1ff[_0x5cfd('0x16')]+=_0x23e0e6[_0x5cfd('0x1b')]['transcripts'][_0x4bcce6][_0x5cfd('0x1e')]+'';}}return _0x3714e1[_0x5cfd('0x1f')](_0x4dc1ff);})['then'](function(){logger[_0x5cfd('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3714e1['id']));if(!_0x3714e1[_0x5cfd('0x20')]){throw new db['Sequelize'][(_0x5cfd('0x21'))](_0x5cfd('0x22'));}if(!_0x42bf8f[_0x5cfd('0x23')]||!_0x42bf8f[_0x5cfd('0x24')]||!_0x42bf8f[_0x5cfd('0x25')]||!_0x42bf8f[_0x5cfd('0x26')]||!_0x42bf8f[_0x5cfd('0x27')]){throw new db['Sequelize'][(_0x5cfd('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4dc1ff[_0x5cfd('0x16')]){throw new Error(_0x5cfd('0x28'));}if(_0x42bf8f[_0x5cfd('0x24')]===_0x4bfed6['id']){return _0x4bfed6;}else{return db[_0x5cfd('0x29')][_0x5cfd('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x5cfd('0x12')](function(_0x1eed9a){if(!_0x1eed9a){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x2c'));}if(!_0x1eed9a[_0x5cfd('0xf')]||!_0x1eed9a['data2']){throw new db[(_0x5cfd('0x2b'))]['ValidationError'](_0x5cfd('0x2d'));}_0x1ccddd=_0x1eed9a;logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0x2e'),_0x3714e1['id']));return sentiment(_0x1ccddd[_0x5cfd('0xf')],_0x1ccddd[_0x5cfd('0x10')],_0x42bf8f[_0x5cfd('0x25')],_0x4dc1ff['fileText'],_0x42bf8f[_0x5cfd('0x26')]);})[_0x5cfd('0x12')](function(_0x34c04b){logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0x2f'),_0x3714e1['id']));return _0x3714e1[_0x5cfd('0x1f')]({'sentiment':_0x34c04b[_0x5cfd('0x30')],'sPositive':_0x34c04b[_0x5cfd('0x31')][_0x5cfd('0x32')],'sNegative':_0x34c04b[_0x5cfd('0x31')][_0x5cfd('0x33')],'sMixed':_0x34c04b[_0x5cfd('0x31')][_0x5cfd('0x34')],'sNeutral':_0x34c04b[_0x5cfd('0x31')][_0x5cfd('0x35')]});})[_0x5cfd('0x12')](function(){logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0x36'),_0x3714e1['id']));_0x628230();});case _0x5cfd('0x37'):return _0x3714e1[_0x5cfd('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x49dc4d['TranscriptionJob'][_0x5cfd('0x38')]})[_0x5cfd('0x12')](function(){logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3714e1['id']));_0x628230();});default:logger[_0x5cfd('0xb')](util['format'](_0x5cfd('0x39'),_0x3714e1['id']));break;}}else{return BPromise[_0x5cfd('0x3a')]()['then'](function(){if(!_0x3714e1[_0x5cfd('0x20')]){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x22'));}if(!_0x42bf8f['sentiment']||!_0x42bf8f[_0x5cfd('0x24')]||!_0x42bf8f[_0x5cfd('0x25')]||!_0x42bf8f[_0x5cfd('0x26')]||!_0x42bf8f[_0x5cfd('0x27')]){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x3b'));}if(!_0x3714e1[_0x5cfd('0x16')]){throw new Error(_0x5cfd('0x28'));}if(_0x42bf8f[_0x5cfd('0x24')]===_0x4bfed6['id']){return _0x4bfed6;}else{return db['CloudProvider'][_0x5cfd('0x2a')]({'where':{'id':_settings[_0x5cfd('0x24')]}});}})[_0x5cfd('0x12')](function(_0x34be02){if(!_0x34be02){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x34be02[_0x5cfd('0xf')]||!_0x34be02[_0x5cfd('0x10')]){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x2d'));}_0x1ccddd=_0x34be02;logger[_0x5cfd('0xb')](util[_0x5cfd('0xc')](_0x5cfd('0x2e'),_0x3714e1['id']));return sentiment(_0x1ccddd[_0x5cfd('0xf')],_0x1ccddd['data2'],_0x42bf8f[_0x5cfd('0x25')],_0x3714e1[_0x5cfd('0x16')],_0x42bf8f[_0x5cfd('0x26')]);})['then'](function(_0x5d08db){logger['info'](util[_0x5cfd('0xc')](_0x5cfd('0x2f'),_0x3714e1['id']));return _0x3714e1['update']({'sentiment':_0x5d08db[_0x5cfd('0x30')],'sPositive':_0x5d08db[_0x5cfd('0x31')][_0x5cfd('0x32')],'sNegative':_0x5d08db[_0x5cfd('0x31')][_0x5cfd('0x33')],'sMixed':_0x5d08db[_0x5cfd('0x31')][_0x5cfd('0x34')],'sNeutral':_0x5d08db['SentimentScore'][_0x5cfd('0x35')],'transcribeStatus':_0x5cfd('0x17')});})[_0x5cfd('0x12')](function(){logger['info'](util[_0x5cfd('0xc')](_0x5cfd('0x36'),_0x3714e1['id']));_0x628230();});}})['catch'](function(_0x23d678){if(_0x23d678){if(!_0x23d678['name']||_0x23d678[_0x5cfd('0x3c')]!==_0x5cfd('0x3d')){logger[_0x5cfd('0x3e')](util[_0x5cfd('0xc')](_0x5cfd('0x3f'),_0x3714e1['id']),util[_0x5cfd('0x40')](_0x23d678,{'showHidden':![],'depth':null}));}}_0x628230();});});}function checkTranscribe(){var _0x49ec84;var _0x1f97ea;var _0x525caa;return db[_0x5cfd('0x41')][_0x5cfd('0x42')]({'where':{'transcribeStatus':_0x5cfd('0x43')}})[_0x5cfd('0x12')](function(_0x386b94){if(!_0x386b94||!_0x386b94[_0x5cfd('0x1d')]){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x49ec84=_0x386b94;return db[_0x5cfd('0x44')][_0x5cfd('0x2a')]({'where':{'id':0x1}});})['then'](function(_0x5dbc26){if(!_0x5dbc26){throw new db[(_0x5cfd('0x2b'))]['ValidationError'](_0x5cfd('0x45'));}_0x1f97ea=_0x5dbc26;if(!_0x1f97ea[_0x5cfd('0x5')]||!_0x1f97ea[_0x5cfd('0x46')]||!_0x1f97ea[_0x5cfd('0x11')]||!_0x1f97ea['language']||!_0x1f97ea[_0x5cfd('0x27')]){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x47'));}return db[_0x5cfd('0x29')][_0x5cfd('0x2a')]({'where':{'id':_0x1f97ea[_0x5cfd('0x46')]}});})[_0x5cfd('0x12')](function(_0x580ac9){if(!_0x580ac9){throw new db[(_0x5cfd('0x2b'))][(_0x5cfd('0x21'))](_0x5cfd('0x2c'));}if(!_0x580ac9[_0x5cfd('0xf')]||!_0x580ac9[_0x5cfd('0x10')]){throw new db['Sequelize']['ValidationError'](_0x5cfd('0x2d'));}_0x525caa=_0x580ac9;var _0x151abb=[];_0x49ec84[_0x5cfd('0x48')](function(_0x504fb9){_0x151abb[_0x5cfd('0x49')](checkTranscribeJob(_0x504fb9,_0x1f97ea,_0x525caa));});return BPromise['all'](_0x151abb);})[_0x5cfd('0x4a')](function(_0x3ddf91){if(_0x3ddf91){if(!_0x3ddf91[_0x5cfd('0x3c')]||_0x3ddf91['name']!=='SequelizeValidationError'){logger[_0x5cfd('0x3e')](util['inspect'](_0x3ddf91,{'showHidden':![],'depth':null}));}}});}exports[_0x5cfd('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x968b=['format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Positive','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','language','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','Mixed','Neutral','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info'];(function(_0x2bd26e,_0x4e713e){var _0xde0ff1=function(_0x2211b6){while(--_0x2211b6){_0x2bd26e['push'](_0x2bd26e['shift']());}};_0xde0ff1(++_0x4e713e);}(_0x968b,0x170));var _0xb968=function(_0x53bcd4,_0x4dc740){_0x53bcd4=_0x53bcd4-0x0;var _0x455aff=_0x968b[_0x53bcd4];return _0x455aff;};var _=require(_0xb968('0x0'));var AWS=require(_0xb968('0x1'));var rp=require(_0xb968('0x2'));var util=require(_0xb968('0x3'));var BPromise=require('bluebird');var db=require(_0xb968('0x4'))['db'];var logger=require('../../config/logger')(_0xb968('0x5'));function getTranscriptionJob(_0x39344d,_0x5ba7bb,_0x4812ff,_0x3dac67){return new Promise(function(_0xe34596,_0x31ee65){var _0xcb2ef3=new AWS[(_0xb968('0x6'))]({'accessKeyId':_0x5ba7bb,'secretAccessKey':_0x39344d,'region':_0x4812ff});_0xcb2ef3[_0xb968('0x7')]({'TranscriptionJobName':_0x3dac67},function(_0x561fad,_0x4fd4b1){if(_0x561fad){return _0x31ee65(_0x561fad);}else{return _0xe34596(_0x4fd4b1);}});});}function sentiment(_0xc22f37,_0x23ec2a,_0x152fa3,_0x5ac129,_0x49fb29){return new Promise(function(_0x2305ab,_0x45b7da){var _0x663ad8=new AWS[(_0xb968('0x8'))]({'accessKeyId':_0x23ec2a,'secretAccessKey':_0xc22f37,'region':_0x152fa3});_0x663ad8[_0xb968('0x9')]({'Text':_0x5ac129,'LanguageCode':_0x49fb29[_0xb968('0xa')](0x0,0x2)},function(_0x3f12ba,_0x25231f){if(_0x3f12ba){return _0x45b7da(_0x3f12ba);}else{return _0x2305ab(_0x25231f);}});});}function checkTranscribeJob(_0x3b427e,_0x4727ee,_0x2a4e78){var _0x2eebaa;return new BPromise(function(_0x15c74b,_0x561a98){logger[_0xb968('0xb')](util[_0xb968('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3b427e['id'],_0x3b427e[_0xb968('0xd')]));return getTranscriptionJob(_0x2a4e78[_0xb968('0xe')],_0x2a4e78[_0xb968('0xf')],_0x4727ee[_0xb968('0x10')],_0x3b427e[_0xb968('0xd')])[_0xb968('0x11')](function(_0x31fe47){logger['info'](util[_0xb968('0xc')](_0xb968('0x12'),_0x3b427e['id'],_0x3b427e['transcribeName'],_0x31fe47[_0xb968('0x13')]['TranscriptionJobStatus']));if(!_0x3b427e[_0xb968('0x14')]){switch(_0x31fe47['TranscriptionJob'][_0xb968('0x15')]){case'COMPLETED':var _0x1e267a={'transcribeStatus':_0x31fe47[_0xb968('0x13')][_0xb968('0x15')],'fileUri':_0x31fe47['TranscriptionJob']['Transcript'][_0xb968('0x16')]};logger[_0xb968('0xb')](util[_0xb968('0xc')](_0xb968('0x17'),_0x3b427e['id']));return rp({'uri':_0x31fe47[_0xb968('0x13')][_0xb968('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x3d5297){logger[_0xb968('0xb')](util[_0xb968('0xc')](_0xb968('0x19'),_0x3b427e['id']));if(_0x3d5297&&_0x3d5297[_0xb968('0x1a')]&&_0x3d5297[_0xb968('0x1a')][_0xb968('0x1b')]&&_0x3d5297[_0xb968('0x1a')]['transcripts']['length']){_0x1e267a[_0xb968('0x14')]='';for(var _0x39dacf=0x0;_0x39dacf<_0x3d5297[_0xb968('0x1a')]['transcripts'][_0xb968('0x1c')];_0x39dacf++){_0x1e267a[_0xb968('0x14')]+=_0x3d5297['results']['transcripts'][_0x39dacf][_0xb968('0x1d')]+'';}}return _0x3b427e['update'](_0x1e267a);})[_0xb968('0x11')](function(){logger['info'](util[_0xb968('0xc')](_0xb968('0x1e'),_0x3b427e['id']));if(!_0x3b427e[_0xb968('0x1f')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4727ee[_0xb968('0x22')]||!_0x4727ee[_0xb968('0x23')]||!_0x4727ee[_0xb968('0x24')]||!_0x4727ee['language']||!_0x4727ee[_0xb968('0x25')]){throw new db['Sequelize'][(_0xb968('0x21'))](_0xb968('0x26'));}if(!_0x1e267a['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4727ee[_0xb968('0x23')]===_0x2a4e78['id']){return _0x2a4e78;}else{return db[_0xb968('0x27')][_0xb968('0x28')]({'where':{'id':_settings[_0xb968('0x23')]}});}})[_0xb968('0x11')](function(_0x558c80){if(!_0x558c80){throw new db[(_0xb968('0x20'))]['ValidationError'](_0xb968('0x29'));}if(!_0x558c80[_0xb968('0xe')]||!_0x558c80[_0xb968('0xf')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2eebaa=_0x558c80;logger[_0xb968('0xb')](util[_0xb968('0xc')](_0xb968('0x2a'),_0x3b427e['id']));return sentiment(_0x2eebaa[_0xb968('0xe')],_0x2eebaa[_0xb968('0xf')],_0x4727ee[_0xb968('0x24')],_0x1e267a['fileText'],_0x4727ee['language']);})[_0xb968('0x11')](function(_0x49096f){logger[_0xb968('0xb')](util[_0xb968('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3b427e['id']));return _0x3b427e[_0xb968('0x2b')]({'sentiment':_0x49096f[_0xb968('0x2c')],'sPositive':_0x49096f[_0xb968('0x2d')][_0xb968('0x2e')],'sNegative':_0x49096f[_0xb968('0x2d')]['Negative'],'sMixed':_0x49096f[_0xb968('0x2d')]['Mixed'],'sNeutral':_0x49096f['SentimentScore']['Neutral']});})[_0xb968('0x11')](function(){logger['info'](util[_0xb968('0xc')](_0xb968('0x1e'),_0x3b427e['id']));_0x15c74b();});case _0xb968('0x2f'):return _0x3b427e[_0xb968('0x2b')]({'transcribeStatus':_0xb968('0x2f'),'failureReason':_0x31fe47[_0xb968('0x13')][_0xb968('0x30')]})['then'](function(){logger[_0xb968('0xb')](util[_0xb968('0xc')](_0xb968('0x1e'),_0x3b427e['id']));_0x15c74b();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3b427e['id']));break;}}else{return BPromise[_0xb968('0x31')]()[_0xb968('0x11')](function(){if(!_0x3b427e[_0xb968('0x1f')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x32'));}if(!_0x4727ee['sentiment']||!_0x4727ee[_0xb968('0x23')]||!_0x4727ee[_0xb968('0x24')]||!_0x4727ee[_0xb968('0x33')]||!_0x4727ee[_0xb968('0x25')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x26'));}if(!_0x3b427e[_0xb968('0x14')]){throw new Error(_0xb968('0x34'));}if(_0x4727ee[_0xb968('0x23')]===_0x2a4e78['id']){return _0x2a4e78;}else{return db[_0xb968('0x27')][_0xb968('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb968('0x11')](function(_0x2873a8){if(!_0x2873a8){throw new db['Sequelize'][(_0xb968('0x21'))](_0xb968('0x29'));}if(!_0x2873a8[_0xb968('0xe')]||!_0x2873a8[_0xb968('0xf')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x35'));}_0x2eebaa=_0x2873a8;logger[_0xb968('0xb')](util[_0xb968('0xc')](_0xb968('0x2a'),_0x3b427e['id']));return sentiment(_0x2eebaa[_0xb968('0xe')],_0x2eebaa[_0xb968('0xf')],_0x4727ee[_0xb968('0x24')],_0x3b427e[_0xb968('0x14')],_0x4727ee[_0xb968('0x33')]);})[_0xb968('0x11')](function(_0x59023f){logger['info'](util[_0xb968('0xc')](_0xb968('0x36'),_0x3b427e['id']));return _0x3b427e[_0xb968('0x2b')]({'sentiment':_0x59023f[_0xb968('0x2c')],'sPositive':_0x59023f[_0xb968('0x2d')][_0xb968('0x2e')],'sNegative':_0x59023f['SentimentScore'][_0xb968('0x37')],'sMixed':_0x59023f[_0xb968('0x2d')][_0xb968('0x38')],'sNeutral':_0x59023f[_0xb968('0x2d')][_0xb968('0x39')],'transcribeStatus':_0xb968('0x3a')});})['then'](function(){logger[_0xb968('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b427e['id']));_0x15c74b();});}})['catch'](function(_0x2d94ab){if(_0x2d94ab){if(!_0x2d94ab[_0xb968('0x3b')]||_0x2d94ab['name']!==_0xb968('0x3c')){logger[_0xb968('0x3d')](util[_0xb968('0xc')](_0xb968('0x3e'),_0x3b427e['id']),util['inspect'](_0x2d94ab,{'showHidden':![],'depth':null}));}}_0x15c74b();});});}function checkTranscribe(){var _0x34693d;var _0x1081fe;var _0x2377d2;return db[_0xb968('0x3f')][_0xb968('0x40')]({'where':{'transcribeStatus':_0xb968('0x41')}})[_0xb968('0x11')](function(_0x2ef37b){if(!_0x2ef37b||!_0x2ef37b[_0xb968('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xb968('0x42'));}_0x34693d=_0x2ef37b;return db[_0xb968('0x43')]['findOne']({'where':{'id':0x1}});})[_0xb968('0x11')](function(_0x8e6a4b){if(!_0x8e6a4b){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x44'));}_0x1081fe=_0x8e6a4b;if(!_0x1081fe[_0xb968('0x5')]||!_0x1081fe[_0xb968('0x45')]||!_0x1081fe[_0xb968('0x10')]||!_0x1081fe['language']||!_0x1081fe[_0xb968('0x25')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x46'));}return db[_0xb968('0x27')][_0xb968('0x28')]({'where':{'id':_0x1081fe['transcribeAccountId']}});})[_0xb968('0x11')](function(_0x50ab3b){if(!_0x50ab3b){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x29'));}if(!_0x50ab3b[_0xb968('0xe')]||!_0x50ab3b[_0xb968('0xf')]){throw new db[(_0xb968('0x20'))][(_0xb968('0x21'))](_0xb968('0x35'));}_0x2377d2=_0x50ab3b;var _0x32cf6a=[];_0x34693d[_0xb968('0x47')](function(_0x2e415e){_0x32cf6a[_0xb968('0x48')](checkTranscribeJob(_0x2e415e,_0x1081fe,_0x2377d2));});return BPromise[_0xb968('0x49')](_0x32cf6a);})[_0xb968('0x4a')](function(_0x3fba43){if(_0x3fba43){if(!_0x3fba43[_0xb968('0x3b')]||_0x3fba43['name']!==_0xb968('0x3c')){logger['error'](util['inspect'](_0x3fba43,{'showHidden':![],'depth':null}));}}});}exports[_0xb968('0x4b')]=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 f139dab..bd4a903 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7081=['hopper1','contacts2','Biondo','push','now','Innocenzo','innocenzo.biondo','@xcally.com','CmContact','then','bulkCreate','log','finished\x20populating','CmHopper','destroy'];(function(_0x811525,_0x222b7e){var _0x15cb6a=function(_0x44241e){while(--_0x44241e){_0x811525['push'](_0x811525['shift']());}};_0x15cb6a(++_0x222b7e);}(_0x7081,0x1b5));var _0x1708=function(_0xd1315c,_0x2ce3a0){_0xd1315c=_0xd1315c-0x0;var _0x40565a=_0x7081[_0xd1315c];return _0x40565a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1708('0x0')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1708('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1708('0x2')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1708('0x2')](),'updatedAt':Date[_0x1708('0x2')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1708('0x1')]({'id':i,'firstName':_0x1708('0x3')+i,'lastName':_0x1708('0x0')+i,'phone':0xf879fb460+i,'email':_0x1708('0x4')+i+_0x1708('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1708('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1708('0x2')](),'updatedAt':Date[_0x1708('0x2')]()});}db[_0x1708('0x6')]['destroy']({'where':{}})[_0x1708('0x7')](function(){return db['CmContact'][_0x1708('0x8')](contacts);})[_0x1708('0x7')](function(){console[_0x1708('0x9')](_0x1708('0xa'),'contacts1');return db[_0x1708('0xb')][_0x1708('0xc')]({'where':{}});})[_0x1708('0x7')](function(){return db[_0x1708('0xb')][_0x1708('0x8')](hopper);})[_0x1708('0x7')](function(){console[_0x1708('0x9')]('finished\x20populating',_0x1708('0xd'));return db[_0x1708('0x6')][_0x1708('0x8')](contacts2);})[_0x1708('0x7')](function(){console[_0x1708('0x9')]('finished\x20populating',_0x1708('0xe'));return db[_0x1708('0xb')][_0x1708('0x8')](hopper2);})[_0x1708('0x7')](function(){console[_0x1708('0x9')](_0x1708('0xa'),'hopper2');})['catch'](function(_0x222a9f){console[_0x1708('0x9')](_0x222a9f);}); \ No newline at end of file +var _0xa474=['@xcally.com','now','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','hopper1','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x486e68,_0x1050fe){var _0x2a5710=function(_0xdc4479){while(--_0xdc4479){_0x486e68['push'](_0x486e68['shift']());}};_0x2a5710(++_0x1050fe);}(_0xa474,0x80));var _0x4a47=function(_0x37c7bc,_0xa076f9){_0x37c7bc=_0x37c7bc-0x0;var _0x516fa0=_0xa474[_0x37c7bc];return _0x516fa0;};'use strict';var util=require('util');var db=require(_0x4a47('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4a47('0x1')]({'id':i,'firstName':_0x4a47('0x2')+i,'lastName':_0x4a47('0x3')+i,'phone':0xf879fb460+i,'email':_0x4a47('0x4')+i+_0x4a47('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4a47('0x6')](),'updatedAt':Date[_0x4a47('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4a47('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4a47('0x3')+i,'phone':0xf879fb460+i,'email':_0x4a47('0x4')+i+_0x4a47('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4a47('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4a47('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4a47('0x6')]()});}db[_0x4a47('0x7')][_0x4a47('0x8')]({'where':{}})[_0x4a47('0x9')](function(){return db['CmContact'][_0x4a47('0xa')](contacts);})[_0x4a47('0x9')](function(){console['log']('finished\x20populating',_0x4a47('0xb'));return db[_0x4a47('0xc')][_0x4a47('0x8')]({'where':{}});})[_0x4a47('0x9')](function(){return db[_0x4a47('0xc')]['bulkCreate'](hopper);})[_0x4a47('0x9')](function(){console[_0x4a47('0xd')](_0x4a47('0xe'),_0x4a47('0xf'));return db['CmContact'][_0x4a47('0xa')](contacts2);})[_0x4a47('0x9')](function(){console[_0x4a47('0xd')](_0x4a47('0xe'),_0x4a47('0x10'));return db['CmHopper'][_0x4a47('0xa')](hopper2);})['then'](function(){console[_0x4a47('0xd')](_0x4a47('0xe'),_0x4a47('0x11'));})[_0x4a47('0x12')](function(_0x20d29b){console[_0x4a47('0xd')](_0x20d29b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ed8b3f4..6847a3f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x679d=['util','%s%s','agent','format','%s%s@xcally.com','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x679d,0x186));var _0xd679=function(_0x36d986,_0x3acae){_0x36d986=_0x36d986-0x0;var _0x4ae0ed=_0x679d[_0x36d986];return _0x4ae0ed;};'use strict';var util=require(_0xd679('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xd679('0x1'),_0xd679('0x2'),i),'fullname':util[_0xd679('0x3')](_0xd679('0x1'),_0xd679('0x2'),i),'email':util[_0xd679('0x3')](_0xd679('0x4'),_0xd679('0x2'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xd679('0x5'),'ws',_0xd679('0x6')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0xd679('0x1'),'agent',i),'encryption':_0xd679('0x7'),'avpf':_0xd679('0x7'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd679('0x7'),'dtlsverify':'no','dtlscertfile':_0xd679('0x8'),'dtlsprivatekey':_0xd679('0x9'),'dtlssetup':'actpass','callerid':util[_0xd679('0x3')](_0xd679('0xa'),util[_0xd679('0x3')]('%s%s',_0xd679('0x2'),i),0xfa0+i)});}db['User'][_0xd679('0xb')](users)[_0xd679('0xc')](function(){console[_0xd679('0xd')]('add\x20user');})[_0xd679('0xe')](function(_0x263104){console[_0xd679('0xd')](_0x263104);}); \ No newline at end of file +var _0x49fe=['User','then','add\x20user','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49fe,0x16c));var _0xe49f=function(_0x195604,_0x1cd244){_0x195604=_0x195604-0x0;var _0x44db2d=_0x49fe[_0x195604];return _0x44db2d;};'use strict';var util=require(_0xe49f('0x0'));var db=require(_0xe49f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe49f('0x2')]('%s%s',_0xe49f('0x3'),i),'fullname':util[_0xe49f('0x2')](_0xe49f('0x4'),'agent',i),'email':util[_0xe49f('0x2')](_0xe49f('0x5'),'agent',i),'role':_0xe49f('0x3'),'password':_0xe49f('0x6'),'internal':0xfa0+i,'type':_0xe49f('0x7'),'transport':[_0xe49f('0x8'),'ws',_0xe49f('0x9')],'disallow':[_0xe49f('0xa')],'allow':[_0xe49f('0xb')],'defaultuser':util[_0xe49f('0x2')](_0xe49f('0x4'),_0xe49f('0x3'),i),'encryption':_0xe49f('0xc'),'avpf':_0xe49f('0xc'),'force_avp':_0xe49f('0xc'),'icesupport':_0xe49f('0xc'),'dtlsenable':_0xe49f('0xc'),'dtlsverify':'no','dtlscertfile':_0xe49f('0xd'),'dtlsprivatekey':_0xe49f('0xe'),'dtlssetup':'actpass','callerid':util[_0xe49f('0x2')](_0xe49f('0xf'),util[_0xe49f('0x2')](_0xe49f('0x4'),_0xe49f('0x3'),i),0xfa0+i)});}db[_0xe49f('0x10')]['bulkCreate'](users)[_0xe49f('0x11')](function(){console['log'](_0xe49f('0x12'));})[_0xe49f('0x13')](function(_0x170ed4){console['log'](_0x170ed4);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9305ae0..039adbb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5aa1=['log','join','default','connection','address','request','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','Agents','User','name','role','agent','type','ivr','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','telephone','where','format','%s:queue:%s','length','user:%s','find','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','userProfileId','VoiceQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','leave','removeMailInteractions','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch'];(function(_0x4bb0fc,_0x53728b){var _0x48d479=function(_0x404820){while(--_0x404820){_0x4bb0fc['push'](_0x4bb0fc['shift']());}};_0x48d479(++_0x53728b);}(_0x5aa1,0x12a));var _0x15aa=function(_0xe0c82f,_0x318ba7){_0xe0c82f=_0xe0c82f-0x0;var _0x3f6eba=_0x5aa1[_0xe0c82f];return _0x3f6eba;};'use strict';var _=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var BPromise=require('bluebird');var db=require(_0x15aa('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x15aa('0x3'),'model':db[_0x15aa('0x4')],'attributes':['id',_0x15aa('0x5'),_0x15aa('0x6')],'raw':!![],'where':{'role':_0x15aa('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x15aa('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x15aa('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x15aa('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x15aa('0x5'),_0x15aa('0x8')],'where':{'type':_0x15aa('0x9')}};function getAssociatedResources(_0x3a784e,_0x3c96ac,_0x138410){return db['UserProfileSection']['findOne']({'where':{'name':_0x3a784e,'userProfileId':_0x3c96ac},'raw':!![]})[_0x15aa('0xa')](function(_0x34122f){if(_0x34122f){if(_0x34122f['autoAssociation']){switch(_0x3a784e){case _0x15aa('0xb'):case _0x15aa('0xc'):case _0x15aa('0xd'):case _0x15aa('0xe'):case _0x15aa('0xf'):case _0x15aa('0x10'):case _0x15aa('0x11'):return db[_0x138410][_0x15aa('0x12')](queryQueues);case _0x15aa('0x13'):return db[_0x138410]['findAll'](queryTelephones);case _0x15aa('0x14'):return db[_0x138410]['findAll'](queryTrunks);case _0x15aa('0x15'):return db[_0x138410][_0x15aa('0x12')](queryCampaigns);}}else{return db[_0x15aa('0x16')][_0x15aa('0x12')]({'attributes':[_0x15aa('0x17')],'where':{'sectionId':_0x34122f['id']},'raw':!![]})[_0x15aa('0xa')](function(_0x7c7934){if(_0x7c7934){var _0x2041ca={'where':{'id':_[_0x15aa('0x18')](_0x7c7934,_0x15aa('0x17'))},'raw':!![]};switch(_0x138410){case'User':_0x2041ca['where'][_0x15aa('0x6')]=_0x15aa('0x19');break;case'Campaign':_0x2041ca[_0x15aa('0x1a')][_0x15aa('0x8')]='ivr';break;}return db[_0x138410][_0x15aa('0x12')](_0x2041ca);}else{return[];}});}}else{return[];}})['then'](function(_0x1c85bf){return _0x1c85bf;});}function joinOrLeaveQueues(_0x25bde1,_0x477542,_0x5b188f,_0xfc6371){_0x25bde1[_0x477542](util[_0x15aa('0x1b')](_0x15aa('0x1c'),_0x5b188f,_0xfc6371[_0x15aa('0x5')]));if(_0xfc6371[_0x15aa('0x3')]){for(var _0x1948b6=0x0;_0x1948b6<_0xfc6371[_0x15aa('0x3')][_0x15aa('0x1d')];_0x1948b6+=0x1){_0x25bde1[_0x477542](util[_0x15aa('0x1b')](_0x15aa('0x1e'),_0xfc6371[_0x15aa('0x3')][_0x1948b6][_0x15aa('0x5')]));}}}function joinOrLeave(_0x537816,_0xb58d87,_0x2f1a36){var _0x360d0d;if(_0x537816['handshake']['query']['id']){db[_0x15aa('0x4')][_0x15aa('0x1f')]({'attributes':['id',_0x15aa('0x5'),_0x15aa('0x6'),'userProfileId'],'where':{'id':_0x537816['handshake'][_0x15aa('0x20')]['id']},'include':[{'model':db[_0x15aa('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x15aa('0x22')],'as':_0x15aa('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x15aa('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x15aa('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x15aa('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x15aa('0xa')](function(_0x1bedf7){if(_0x1bedf7){_0x360d0d=_0x1bedf7;_0x537816[_0xb58d87](util['format'](_0x15aa('0x1e'),_0x1bedf7[_0x15aa('0x5')]));var _0x394169=[];switch(_0x1bedf7[_0x15aa('0x6')]){case _0x15aa('0x27'):_0x537816[_0xb58d87](_0x15aa('0x28'));_0x537816[_0xb58d87](_0x15aa('0x29'));if(queryQueues[_0x15aa('0x2a')](_0x15aa('0x2b'))){delete queryQueues['include'];}_0x394169[_0x15aa('0x2c')](db['VoiceQueue'][_0x15aa('0x12')](queryQueues));_0x394169[_0x15aa('0x2c')](db['ChatQueue']['findAll'](queryQueues));_0x394169['push'](db[_0x15aa('0x2d')]['findAll'](queryQueues));_0x394169[_0x15aa('0x2c')](db[_0x15aa('0x2e')]['findAll'](queryQueues));_0x394169['push'](db[_0x15aa('0x2f')]['findAll'](queryQueues));_0x394169[_0x15aa('0x2c')](db[_0x15aa('0x30')][_0x15aa('0x12')](queryQueues));_0x394169['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x394169[_0x15aa('0x2c')](db[_0x15aa('0x4')]['findAll'](queryTelephones));_0x394169[_0x15aa('0x2c')](db[_0x15aa('0x31')]['findAll'](queryTrunks));_0x394169['push'](db[_0x15aa('0x32')][_0x15aa('0x12')](queryCampaigns));_0x394169[_0x15aa('0x2c')](db[_0x15aa('0x4')][_0x15aa('0x12')](queryAgents));break;case'user':_0x537816[_0xb58d87](_0x15aa('0x28'));_0x537816[_0xb58d87](_0x15aa('0x29'));_0x394169['push'](getAssociatedResources(_0x15aa('0xb'),_0x1bedf7[_0x15aa('0x33')],_0x15aa('0x34')));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0xc'),_0x1bedf7[_0x15aa('0x33')],'ChatQueue'));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0xd'),_0x1bedf7['userProfileId'],_0x15aa('0x2d')));_0x394169[_0x15aa('0x2c')](getAssociatedResources('SmsQueues',_0x1bedf7['userProfileId'],_0x15aa('0x2e')));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0xf'),_0x1bedf7['userProfileId'],_0x15aa('0x2f')));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0x10'),_0x1bedf7['userProfileId'],_0x15aa('0x30')));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0x11'),_0x1bedf7['userProfileId'],_0x15aa('0x35')));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0x13'),_0x1bedf7[_0x15aa('0x33')],_0x15aa('0x4')));_0x394169['push'](getAssociatedResources(_0x15aa('0x14'),_0x1bedf7[_0x15aa('0x33')],'Trunk'));_0x394169[_0x15aa('0x2c')](getAssociatedResources(_0x15aa('0x15'),_0x1bedf7[_0x15aa('0x33')],_0x15aa('0x32')));_0x394169['push'](db[_0x15aa('0x4')][_0x15aa('0x12')](queryAgents));break;case _0x15aa('0x7'):_0x537816[_0xb58d87](_0x15aa('0x28'));_0x537816[_0xb58d87](_0x15aa('0x29'));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x36')]({'attributes':['id',_0x15aa('0x5')]}));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x37')]({'attributes':['id',_0x15aa('0x5')]}));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x38')]({'attributes':['id',_0x15aa('0x5')]}));_0x394169['push'](_0x1bedf7['getSmsQueues']({'attributes':['id','name']}));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x39')]({'attributes':['id',_0x15aa('0x5')]}));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x3a')]({'attributes':['id','name']}));_0x394169[_0x15aa('0x2c')](_0x1bedf7[_0x15aa('0x3b')]({'attributes':['id',_0x15aa('0x5')]}));break;}return BPromise[_0x15aa('0x3c')](_0x394169);}})[_0x15aa('0xa')](function(_0x5aec02){if(_0x5aec02&&_0x5aec02[_0x15aa('0x1d')]){for(var _0x205980=0x0;_0x205980<_0x5aec02[_0x15aa('0x1d')];_0x205980+=0x1){for(var _0x443c4e=0x0;_0x443c4e<_0x5aec02[_0x205980]['length'];_0x443c4e+=0x1){switch(_0x205980){case 0x0:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x3d'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x1:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x3e'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x2:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x3f'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x3:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x40'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x4:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x41'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x5:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x42'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x6:joinOrLeaveQueues(_0x537816,_0xb58d87,_0x15aa('0x43'),_0x5aec02[_0x205980][_0x443c4e]);break;case 0x7:_0x537816[_0xb58d87](util['format'](_0x15aa('0x44'),_0x5aec02[_0x205980][_0x443c4e][_0x15aa('0x5')]));break;case 0x8:_0x537816[_0xb58d87](util[_0x15aa('0x1b')](_0x15aa('0x45'),_0x5aec02[_0x205980][_0x443c4e][_0x15aa('0x5')]));break;case 0x9:_0x537816[_0xb58d87](util[_0x15aa('0x1b')](_0x15aa('0x46'),_0x5aec02[_0x205980][_0x443c4e][_0x15aa('0x8')],_0x5aec02[_0x205980][_0x443c4e][_0x15aa('0x5')]));break;case 0xa:_0x537816[_0xb58d87](util[_0x15aa('0x1b')](_0x15aa('0x1e'),_0x5aec02[_0x205980][_0x443c4e][_0x15aa('0x5')]));break;}}}}})[_0x15aa('0xa')](function(){if(_0xb58d87==='leave'){var _0x55ecee=_['map'](_0x360d0d[_0x15aa('0x47')],'id');return _0x360d0d[_0x15aa('0x48')](_0x55ecee)[_0x15aa('0xa')](function(){for(var _0x42a11d=0x0;_0x42a11d<_0x55ecee[_0x15aa('0x1d')];_0x42a11d+=0x1){_0x2f1a36[_0x15aa('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x55ecee[_0x42a11d]),'UserId':Number(_0x360d0d['id'])});}});}})[_0x15aa('0xa')](function(){if(_0xb58d87===_0x15aa('0x4a')){var _0x3b6154=_[_0x15aa('0x18')](_0x360d0d['MailInteractions'],'id');return _0x360d0d[_0x15aa('0x4b')](_0x3b6154)[_0x15aa('0xa')](function(){for(var _0x49e0fa=0x0;_0x49e0fa<_0x3b6154['length'];_0x49e0fa+=0x1){_0x2f1a36['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3b6154[_0x49e0fa]),'UserId':Number(_0x360d0d['id'])});}});}})[_0x15aa('0xa')](function(){if(_0xb58d87==='leave'){var _0x204f57=_['map'](_0x360d0d[_0x15aa('0x4c')],'id');return _0x360d0d[_0x15aa('0x4d')](_0x204f57)[_0x15aa('0xa')](function(){for(var _0x9d3ff3=0x0;_0x9d3ff3<_0x204f57[_0x15aa('0x1d')];_0x9d3ff3+=0x1){_0x2f1a36['emit'](_0x15aa('0x4e'),{'FaxInteractionId':Number(_0x204f57[_0x9d3ff3]),'UserId':Number(_0x360d0d['id'])});}});}})['then'](function(){if(_0xb58d87===_0x15aa('0x4a')){var _0x275fad=_[_0x15aa('0x18')](_0x360d0d[_0x15aa('0x4f')],'id');return _0x360d0d['removeSmsInteractions'](_0x275fad)[_0x15aa('0xa')](function(){for(var _0xe9b899=0x0;_0xe9b899<_0x275fad[_0x15aa('0x1d')];_0xe9b899+=0x1){_0x2f1a36['emit'](_0x15aa('0x50'),{'SmsInteractionId':Number(_0x275fad[_0xe9b899]),'UserId':Number(_0x360d0d['id'])});}});}})[_0x15aa('0xa')](function(){if(_0xb58d87===_0x15aa('0x4a')){var _0x3f8963=_['map'](_0x360d0d['OpenchannelInteractions'],'id');return _0x360d0d[_0x15aa('0x51')](_0x3f8963)[_0x15aa('0xa')](function(){for(var _0x40f1b3=0x0;_0x40f1b3<_0x3f8963[_0x15aa('0x1d')];_0x40f1b3+=0x1){_0x2f1a36['emit'](_0x15aa('0x52'),{'OpenchannelInteractionId':Number(_0x3f8963[_0x40f1b3]),'UserId':Number(_0x360d0d['id'])});}});}})[_0x15aa('0xa')](function(){if(_0xb58d87===_0x15aa('0x4a')){var _0x2c02cd=_[_0x15aa('0x18')](_0x360d0d[_0x15aa('0x53')],'id');return _0x360d0d[_0x15aa('0x54')](_0x2c02cd)[_0x15aa('0xa')](function(){for(var _0x2b48ef=0x0;_0x2b48ef<_0x2c02cd[_0x15aa('0x1d')];_0x2b48ef+=0x1){_0x2f1a36[_0x15aa('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2c02cd[_0x2b48ef]),'UserId':Number(_0x360d0d['id'])});}});}})[_0x15aa('0x55')](function(_0x5e429b){_0x537816[_0x15aa('0x56')](_0x5e429b);});}}function onDisconnect(_0x1d3211,_0x596a0f){joinOrLeave(_0x1d3211,_0x15aa('0x4a'),_0x596a0f);}function onConnect(_0x40c48d){joinOrLeave(_0x40c48d,_0x15aa('0x57'));}exports[_0x15aa('0x58')]=function(_0x39a4cd){_0x39a4cd['on'](_0x15aa('0x59'),function(_0x4074da){_0x4074da['setMaxListeners'](0x0);_0x4074da[_0x15aa('0x5a')]=_0x4074da[_0x15aa('0x5b')]['connection']['remoteAddress']+':'+_0x4074da[_0x15aa('0x5b')][_0x15aa('0x59')]['remotePort'];_0x4074da['connectedAt']=new Date();_0x4074da[_0x15aa('0x56')]=function(_0x3642b4){console['log'](_0x15aa('0x5c')+_0x4074da[_0x15aa('0x5d')][_0x15aa('0x5')]+'['+_0x4074da[_0x15aa('0x5a')]+']',_0x3642b4);};_0x4074da['on'](_0x15aa('0x5e'),function(){onDisconnect(_0x4074da,_0x39a4cd);_0x4074da[_0x15aa('0x56')](_0x15aa('0x5f'));});onConnect(_0x4074da);_0x4074da['log']('CONNECTED');});}; \ No newline at end of file +var _0x43f7=['Agents','User','role','agent','telephone','type','ivr','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','IvrCampaigns','UserProfileResource','findAll','resourceId','where','Campaign','length','user:%s','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','VoiceQueue','SmsQueue','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','map','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x43f7,0xc3));var _0x743f=function(_0x259789,_0x2d595b){_0x259789=_0x259789-0x0;var _0xf3e27=_0x43f7[_0x259789];return _0xf3e27;};'use strict';var _=require(_0x743f('0x0'));var util=require(_0x743f('0x1'));var BPromise=require(_0x743f('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x743f('0x3'));var queryQueues={'attributes':['id',_0x743f('0x4')],'include':[{'as':_0x743f('0x5'),'model':db[_0x743f('0x6')],'attributes':['id','name',_0x743f('0x7')],'raw':!![],'where':{'role':_0x743f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x743f('0x4')],'where':{'role':_0x743f('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x743f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x743f('0x4')],'where':{'role':_0x743f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x743f('0xa')],'where':{'type':_0x743f('0xb')}};function getAssociatedResources(_0x289a4a,_0x5837e3,_0x5e4c50){return db['UserProfileSection'][_0x743f('0xc')]({'where':{'name':_0x289a4a,'userProfileId':_0x5837e3},'raw':!![]})[_0x743f('0xd')](function(_0x326788){if(_0x326788){if(_0x326788['autoAssociation']){switch(_0x289a4a){case _0x743f('0xe'):case _0x743f('0xf'):case _0x743f('0x10'):case _0x743f('0x11'):case'MailQueues':case _0x743f('0x12'):case _0x743f('0x13'):return db[_0x5e4c50]['findAll'](queryQueues);case _0x743f('0x14'):return db[_0x5e4c50]['findAll'](queryTelephones);case _0x743f('0x15'):return db[_0x5e4c50]['findAll'](queryTrunks);case _0x743f('0x16'):return db[_0x5e4c50]['findAll'](queryCampaigns);}}else{return db[_0x743f('0x17')][_0x743f('0x18')]({'attributes':[_0x743f('0x19')],'where':{'sectionId':_0x326788['id']},'raw':!![]})['then'](function(_0x489c9d){if(_0x489c9d){var _0x5dd3f5={'where':{'id':_['map'](_0x489c9d,_0x743f('0x19'))},'raw':!![]};switch(_0x5e4c50){case _0x743f('0x6'):_0x5dd3f5[_0x743f('0x1a')]['role']=_0x743f('0x9');break;case _0x743f('0x1b'):_0x5dd3f5[_0x743f('0x1a')]['type']='ivr';break;}return db[_0x5e4c50]['findAll'](_0x5dd3f5);}else{return[];}});}}else{return[];}})[_0x743f('0xd')](function(_0x1bfbda){return _0x1bfbda;});}function joinOrLeaveQueues(_0x4f7baa,_0x269c67,_0xe816c3,_0x4e0c3b){_0x4f7baa[_0x269c67](util['format']('%s:queue:%s',_0xe816c3,_0x4e0c3b['name']));if(_0x4e0c3b['Agents']){for(var _0xc9c0c0=0x0;_0xc9c0c0<_0x4e0c3b[_0x743f('0x5')][_0x743f('0x1c')];_0xc9c0c0+=0x1){_0x4f7baa[_0x269c67](util['format'](_0x743f('0x1d'),_0x4e0c3b[_0x743f('0x5')][_0xc9c0c0]['name']));}}}function joinOrLeave(_0x19e3f3,_0x2d1ae4,_0x59d9a5){var _0x4437f6;if(_0x19e3f3['handshake'][_0x743f('0x1e')]['id']){db[_0x743f('0x6')][_0x743f('0x1f')]({'attributes':['id',_0x743f('0x4'),_0x743f('0x7'),'userProfileId'],'where':{'id':_0x19e3f3[_0x743f('0x20')][_0x743f('0x1e')]['id']},'include':[{'model':db[_0x743f('0x21')],'as':_0x743f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x743f('0x23')],'as':_0x743f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x743f('0x25')],'as':_0x743f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x743f('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x743f('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x743f('0x29')],'as':_0x743f('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x12c60b){if(_0x12c60b){_0x4437f6=_0x12c60b;_0x19e3f3[_0x2d1ae4](util[_0x743f('0x2b')](_0x743f('0x1d'),_0x12c60b[_0x743f('0x4')]));var _0x77e1bc=[];switch(_0x12c60b['role']){case _0x743f('0x2c'):_0x19e3f3[_0x2d1ae4](_0x743f('0x2d'));_0x19e3f3[_0x2d1ae4](_0x743f('0x2e'));if(queryQueues[_0x743f('0x2f')]('include')){delete queryQueues[_0x743f('0x30')];}_0x77e1bc[_0x743f('0x31')](db['VoiceQueue'][_0x743f('0x18')](queryQueues));_0x77e1bc[_0x743f('0x31')](db[_0x743f('0x32')]['findAll'](queryQueues));_0x77e1bc[_0x743f('0x31')](db['FaxQueue'][_0x743f('0x18')](queryQueues));_0x77e1bc[_0x743f('0x31')](db['SmsQueue'][_0x743f('0x18')](queryQueues));_0x77e1bc[_0x743f('0x31')](db[_0x743f('0x33')][_0x743f('0x18')](queryQueues));_0x77e1bc['push'](db[_0x743f('0x34')][_0x743f('0x18')](queryQueues));_0x77e1bc['push'](db[_0x743f('0x35')]['findAll'](queryQueues));_0x77e1bc['push'](db[_0x743f('0x6')][_0x743f('0x18')](queryTelephones));_0x77e1bc[_0x743f('0x31')](db[_0x743f('0x36')]['findAll'](queryTrunks));_0x77e1bc[_0x743f('0x31')](db[_0x743f('0x1b')][_0x743f('0x18')](queryCampaigns));_0x77e1bc[_0x743f('0x31')](db['User'][_0x743f('0x18')](queryAgents));break;case'user':_0x19e3f3[_0x2d1ae4](_0x743f('0x2d'));_0x19e3f3[_0x2d1ae4]('voice:outbound');_0x77e1bc[_0x743f('0x31')](getAssociatedResources(_0x743f('0xe'),_0x12c60b[_0x743f('0x37')],_0x743f('0x38')));_0x77e1bc[_0x743f('0x31')](getAssociatedResources(_0x743f('0xf'),_0x12c60b['userProfileId'],_0x743f('0x32')));_0x77e1bc['push'](getAssociatedResources(_0x743f('0x10'),_0x12c60b[_0x743f('0x37')],'FaxQueue'));_0x77e1bc[_0x743f('0x31')](getAssociatedResources(_0x743f('0x11'),_0x12c60b['userProfileId'],_0x743f('0x39')));_0x77e1bc[_0x743f('0x31')](getAssociatedResources(_0x743f('0x3a'),_0x12c60b['userProfileId'],_0x743f('0x33')));_0x77e1bc['push'](getAssociatedResources(_0x743f('0x12'),_0x12c60b[_0x743f('0x37')],'OpenchannelQueue'));_0x77e1bc[_0x743f('0x31')](getAssociatedResources('WhatsappQueues',_0x12c60b[_0x743f('0x37')],_0x743f('0x35')));_0x77e1bc['push'](getAssociatedResources(_0x743f('0x14'),_0x12c60b[_0x743f('0x37')],_0x743f('0x6')));_0x77e1bc[_0x743f('0x31')](getAssociatedResources(_0x743f('0x15'),_0x12c60b[_0x743f('0x37')],'Trunk'));_0x77e1bc[_0x743f('0x31')](getAssociatedResources('IvrCampaigns',_0x12c60b[_0x743f('0x37')],_0x743f('0x1b')));_0x77e1bc[_0x743f('0x31')](db['User']['findAll'](queryAgents));break;case'agent':_0x19e3f3[_0x2d1ae4](_0x743f('0x2d'));_0x19e3f3[_0x2d1ae4](_0x743f('0x2e'));_0x77e1bc[_0x743f('0x31')](_0x12c60b[_0x743f('0x3b')]({'attributes':['id',_0x743f('0x4')]}));_0x77e1bc['push'](_0x12c60b[_0x743f('0x3c')]({'attributes':['id','name']}));_0x77e1bc[_0x743f('0x31')](_0x12c60b[_0x743f('0x3d')]({'attributes':['id',_0x743f('0x4')]}));_0x77e1bc[_0x743f('0x31')](_0x12c60b[_0x743f('0x3e')]({'attributes':['id','name']}));_0x77e1bc[_0x743f('0x31')](_0x12c60b[_0x743f('0x3f')]({'attributes':['id',_0x743f('0x4')]}));_0x77e1bc['push'](_0x12c60b['getOpenchannelQueues']({'attributes':['id',_0x743f('0x4')]}));_0x77e1bc['push'](_0x12c60b['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x743f('0x40')](_0x77e1bc);}})[_0x743f('0xd')](function(_0x2f5e6e){if(_0x2f5e6e&&_0x2f5e6e[_0x743f('0x1c')]){for(var _0x677a96=0x0;_0x677a96<_0x2f5e6e[_0x743f('0x1c')];_0x677a96+=0x1){for(var _0x4bdaeb=0x0;_0x4bdaeb<_0x2f5e6e[_0x677a96][_0x743f('0x1c')];_0x4bdaeb+=0x1){switch(_0x677a96){case 0x0:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x41'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x1:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x42'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x2:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x43'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x3:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x44'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x4:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x45'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x5:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x46'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x6:joinOrLeaveQueues(_0x19e3f3,_0x2d1ae4,_0x743f('0x47'),_0x2f5e6e[_0x677a96][_0x4bdaeb]);break;case 0x7:_0x19e3f3[_0x2d1ae4](util['format'](_0x743f('0x48'),_0x2f5e6e[_0x677a96][_0x4bdaeb]['name']));break;case 0x8:_0x19e3f3[_0x2d1ae4](util[_0x743f('0x2b')](_0x743f('0x49'),_0x2f5e6e[_0x677a96][_0x4bdaeb][_0x743f('0x4')]));break;case 0x9:_0x19e3f3[_0x2d1ae4](util[_0x743f('0x2b')]('campaign:%s:%s',_0x2f5e6e[_0x677a96][_0x4bdaeb]['type'],_0x2f5e6e[_0x677a96][_0x4bdaeb][_0x743f('0x4')]));break;case 0xa:_0x19e3f3[_0x2d1ae4](util['format'](_0x743f('0x1d'),_0x2f5e6e[_0x677a96][_0x4bdaeb][_0x743f('0x4')]));break;}}}}})[_0x743f('0xd')](function(){if(_0x2d1ae4===_0x743f('0x4a')){var _0x14408f=_[_0x743f('0x4b')](_0x4437f6['ChatInteractions'],'id');return _0x4437f6['removeChatInteractions'](_0x14408f)[_0x743f('0xd')](function(){for(var _0x2e3282=0x0;_0x2e3282<_0x14408f['length'];_0x2e3282+=0x1){_0x59d9a5['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x14408f[_0x2e3282]),'UserId':Number(_0x4437f6['id'])});}});}})[_0x743f('0xd')](function(){if(_0x2d1ae4==='leave'){var _0x3003da=_['map'](_0x4437f6['MailInteractions'],'id');return _0x4437f6[_0x743f('0x4c')](_0x3003da)['then'](function(){for(var _0x43bad9=0x0;_0x43bad9<_0x3003da[_0x743f('0x1c')];_0x43bad9+=0x1){_0x59d9a5[_0x743f('0x4d')](_0x743f('0x4e'),{'MailInteractionId':Number(_0x3003da[_0x43bad9]),'UserId':Number(_0x4437f6['id'])});}});}})[_0x743f('0xd')](function(){if(_0x2d1ae4===_0x743f('0x4a')){var _0x17ce30=_['map'](_0x4437f6[_0x743f('0x26')],'id');return _0x4437f6[_0x743f('0x4f')](_0x17ce30)[_0x743f('0xd')](function(){for(var _0x55226a=0x0;_0x55226a<_0x17ce30['length'];_0x55226a+=0x1){_0x59d9a5[_0x743f('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x17ce30[_0x55226a]),'UserId':Number(_0x4437f6['id'])});}});}})['then'](function(){if(_0x2d1ae4==='leave'){var _0x589679=_[_0x743f('0x4b')](_0x4437f6[_0x743f('0x50')],'id');return _0x4437f6[_0x743f('0x51')](_0x589679)[_0x743f('0xd')](function(){for(var _0x4fe9c2=0x0;_0x4fe9c2<_0x589679[_0x743f('0x1c')];_0x4fe9c2+=0x1){_0x59d9a5[_0x743f('0x4d')](_0x743f('0x52'),{'SmsInteractionId':Number(_0x589679[_0x4fe9c2]),'UserId':Number(_0x4437f6['id'])});}});}})[_0x743f('0xd')](function(){if(_0x2d1ae4===_0x743f('0x4a')){var _0x5c1f0b=_['map'](_0x4437f6[_0x743f('0x53')],'id');return _0x4437f6['removeOpenchannelInteractions'](_0x5c1f0b)[_0x743f('0xd')](function(){for(var _0x159a26=0x0;_0x159a26<_0x5c1f0b[_0x743f('0x1c')];_0x159a26+=0x1){_0x59d9a5[_0x743f('0x4d')](_0x743f('0x54'),{'OpenchannelInteractionId':Number(_0x5c1f0b[_0x159a26]),'UserId':Number(_0x4437f6['id'])});}});}})[_0x743f('0xd')](function(){if(_0x2d1ae4===_0x743f('0x4a')){var _0x4f6801=_[_0x743f('0x4b')](_0x4437f6[_0x743f('0x2a')],'id');return _0x4437f6[_0x743f('0x55')](_0x4f6801)[_0x743f('0xd')](function(){for(var _0x576314=0x0;_0x576314<_0x4f6801[_0x743f('0x1c')];_0x576314+=0x1){_0x59d9a5[_0x743f('0x4d')](_0x743f('0x56'),{'WhatsappInteractionId':Number(_0x4f6801[_0x576314]),'UserId':Number(_0x4437f6['id'])});}});}})['catch'](function(_0xf6b389){_0x19e3f3[_0x743f('0x57')](_0xf6b389);});}}function onDisconnect(_0x2ee526,_0x309614){joinOrLeave(_0x2ee526,_0x743f('0x4a'),_0x309614);}function onConnect(_0x1c67bd){joinOrLeave(_0x1c67bd,_0x743f('0x58'));}exports[_0x743f('0x59')]=function(_0x5a406c){_0x5a406c['on'](_0x743f('0x5a'),function(_0x44fd81){_0x44fd81[_0x743f('0x5b')](0x0);_0x44fd81[_0x743f('0x5c')]=_0x44fd81[_0x743f('0x5d')][_0x743f('0x5a')]['remoteAddress']+':'+_0x44fd81[_0x743f('0x5d')]['connection']['remotePort'];_0x44fd81[_0x743f('0x5e')]=new Date();_0x44fd81[_0x743f('0x57')]=function(_0x46bba8){console[_0x743f('0x57')](_0x743f('0x5f')+_0x44fd81[_0x743f('0x60')][_0x743f('0x4')]+'['+_0x44fd81[_0x743f('0x5c')]+']',_0x46bba8);};_0x44fd81['on'](_0x743f('0x61'),function(){onDisconnect(_0x44fd81,_0x5a406c);_0x44fd81['log'](_0x743f('0x62'));});onConnect(_0x44fd81);_0x44fd81[_0x743f('0x57')](_0x743f('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 48bc218..b4a3353 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 _0xccda=['FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','info','error','code','catch','Trigger,\x20%s','get','channel','event','UserId','User','find','interface','SIP/%s','name','incomingmessage','outgoingmessage','opened','changed','closed','then','format','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','newmessage','Sms','SmsInteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp'];(function(_0x10d7f5,_0x5ce1fa){var _0xacff61=function(_0x6d7eca){while(--_0x6d7eca){_0x10d7f5['push'](_0x10d7f5['shift']());}};_0xacff61(++_0x5ce1fa);}(_0xccda,0x107));var _0xaccd=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0xccda[_0x57d500];return _0x142c14;};'use strict';var util=require(_0xaccd('0x0'));var db=require(_0xaccd('0x1'))['db'];var jayson=require(_0xaccd('0x2'));var logger=require(_0xaccd('0x3'))('triggers');var client=jayson[_0xaccd('0x4')][_0xaccd('0x5')]({'port':0x232a});var triggers=[{'channel':_0xaccd('0x6'),'model':_0xaccd('0x7'),'event':_0xaccd('0x8'),'condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0xaccd('0x7'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xaccd('0x6'),'model':'ChatMessage','event':_0xaccd('0x8'),'condition':_0xaccd('0xa'),'callback':afterCreateMessage},{'channel':_0xaccd('0xb'),'model':'SmsInteraction','event':_0xaccd('0x8'),'condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0xaccd('0xc'),'event':_0xaccd('0xd'),'condition':_0xaccd('0xe'),'callback':afterUpdate},{'channel':_0xaccd('0xb'),'model':_0xaccd('0xf'),'event':_0xaccd('0x8'),'condition':_0xaccd('0xa'),'callback':afterCreateMessage},{'channel':_0xaccd('0x10'),'model':'WhatsappInteraction','event':_0xaccd('0x8'),'condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':_0xaccd('0x10'),'model':'WhatsappInteraction','event':_0xaccd('0xd'),'condition':_0xaccd('0xe'),'callback':afterUpdate},{'channel':_0xaccd('0x10'),'model':'WhatsappMessage','event':_0xaccd('0x8'),'condition':_0xaccd('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xaccd('0x11'),'event':_0xaccd('0x8'),'condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':_0xaccd('0x12'),'model':'FaxInteraction','event':'afterUpdate','condition':_0xaccd('0xe'),'callback':afterUpdate},{'channel':'Fax','model':_0xaccd('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0xaccd('0x14'),'event':'afterCreate','condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':_0xaccd('0x15'),'model':_0xaccd('0x14'),'event':'afterUpdate','condition':_0xaccd('0xe'),'callback':afterUpdate},{'channel':_0xaccd('0x15'),'model':'MailMessage','event':_0xaccd('0x8'),'condition':_0xaccd('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xaccd('0x16'),'event':_0xaccd('0x8'),'condition':_0xaccd('0x9'),'callback':afterCreate},{'channel':_0xaccd('0x17'),'model':'OpenchannelInteraction','event':_0xaccd('0xd'),'condition':_0xaccd('0xe'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xaccd('0x18'),'event':_0xaccd('0x8'),'condition':_0xaccd('0xa'),'callback':afterCreateMessage}];function request(_0x169e9e){return client[_0xaccd('0x19')](_0xaccd('0x1a'),_0x169e9e)['then'](function(_0x160b2e){logger[_0xaccd('0x1b')]('Trigger,\x20%s',_0xaccd('0x1a'),_0x160b2e);if(_0x160b2e[_0xaccd('0x1c')]){if(_0x160b2e[_0xaccd('0x1c')][_0xaccd('0x1d')]===0x1f4){logger[_0xaccd('0x1c')]('Trigger,\x20%s',_0xaccd('0x1a'),_0x160b2e['error']);}}})[_0xaccd('0x1e')](function(_0x49182c){logger[_0xaccd('0x1c')](_0xaccd('0x1f'),_0xaccd('0x1a'),_0x49182c);});}function afterCreateMessage(_0x350af5,_0x4611df){return function(_0x5d2a79,_0x3158d6){_0x5d2a79=_0x5d2a79[_0xaccd('0x20')]({'plain':!![]});_0x5d2a79[_0xaccd('0x21')]=_0x350af5;_0x5d2a79[_0xaccd('0x22')]=_0x5d2a79['direction'];if(_0x5d2a79[_0xaccd('0x23')]){return db[_0xaccd('0x24')][_0xaccd('0x25')]({'where':{'id':_0x5d2a79[_0xaccd('0x23')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x1a81ec){_0x5d2a79[_0xaccd('0x26')]=util['format'](_0xaccd('0x27'),_0x1a81ec[_0xaccd('0x28')]);_0x5d2a79[_0xaccd('0x21')]=_0x350af5;return request({'event':_0xaccd('0x29'),'message':_0x5d2a79});})[_0xaccd('0x1e')](function(_0x5d8a56){console[_0xaccd('0x1c')](_0x5d8a56);});}else{return request({'event':_0xaccd('0x2a'),'message':_0x5d2a79});}};}function afterCreate(_0x18bfb8,_0xd70bec){return function(_0x1bd2b1,_0x2a4b08){_0x1bd2b1=_0x1bd2b1[_0xaccd('0x20')]({'plain':!![]});_0x1bd2b1['channel']=_0x18bfb8;_0x1bd2b1['event']=_0xaccd('0x2b');return request({'event':_0xd70bec,'message':_0x1bd2b1});};}function afterUpdate(_0x558453,_0x330fa5){return function(_0x25b43a,_0x2b7709){if(_0x25b43a[_0xaccd('0x2c')](_0xaccd('0x2d'))&&_0x25b43a[_0xaccd('0x2d')]){_0x25b43a=_0x25b43a['get']({'plain':!![]});_0x25b43a[_0xaccd('0x21')]=_0x558453;_0x25b43a[_0xaccd('0x22')]=_0xaccd('0x2d');if(_0x25b43a[_0xaccd('0x23')]){return db['User'][_0xaccd('0x25')]({'where':{'id':_0x25b43a[_0xaccd('0x23')]},'attributes':['id',_0xaccd('0x28')],'raw':!![]})[_0xaccd('0x2e')](function(_0xb40c67){_0x25b43a[_0xaccd('0x26')]=util[_0xaccd('0x2f')]('SIP/%s',_0xb40c67['name']);return request({'event':_0x330fa5,'message':_0x25b43a});})['catch'](function(_0x165427){console[_0xaccd('0x1c')](_0x165427);});}else{return request({'event':_0x330fa5,'message':_0x25b43a});}}};}exports[_0xaccd('0x30')]=function(){for(var _0xfc774e=0x0;_0xfc774e=_0x4a4e[_0x5c40('0x15')]){throw Error(_0x5c40('0x16'));}_0x483340(_0x82d4c7);})['catch'](function(_0x8bf9f0){_0x193ddc(_0x8bf9f0);});});}; \ No newline at end of file +var _0xffb7=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail','chat','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xffb7,0x17c));var _0x7ffb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xffb7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7ffb('0x0'));var BPromise=require(_0x7ffb('0x1'));var db=require(_0x7ffb('0x2'))['db'];var util=require('./license/util');var channels=[_0x7ffb('0x3'),_0x7ffb('0x4'),_0x7ffb('0x5'),'fax',_0x7ffb('0x6'),_0x7ffb('0x7'),_0x7ffb('0x8')];exports['getChannels']=function(){return channels;};exports[_0x7ffb('0x9')]=function(_0x209d99){_0x209d99=_0x209d99[_0x7ffb('0xa')]();return _[_0x7ffb('0xb')](channels,_0x209d99);};exports[_0x7ffb('0xc')]=function(_0x530746,_0x223f30,_0x4f43d1,_0x419c58){var _0x2412bb={'loginAttempts':_0x223f30,'blocked':_0x4f43d1};if(!_[_0x7ffb('0xd')](_0x419c58)){_0x2412bb[_0x7ffb('0xe')]=_0x419c58;}return _0x530746[_0x7ffb('0xf')](_0x2412bb);};exports[_0x7ffb('0x10')]=function(_0x2abbe){return new BPromise(function(_0x5607e4,_0xd86c11){var _0x2f0263=0x0;if(_0x2abbe[_0x7ffb('0x11')]!==_0x7ffb('0x12')){_0x5607e4(_0x2abbe);}db[_0x7ffb('0x13')][_0x7ffb('0x14')]({'where':{'role':_0x7ffb('0x12'),'online':!![],'id':{'$ne':_0x2abbe['id']}}})['then'](function(_0x1203d6){_0x2f0263=_0x1203d6;return util[_0x7ffb('0x10')]();})[_0x7ffb('0x15')](function(_0x355400){if(_0x355400&&_0x355400[_0x7ffb('0x16')]&&_0x2f0263>=_0x355400['agents']){throw Error(_0x7ffb('0x17'));}_0x5607e4(_0x2abbe);})[_0x7ffb('0x18')](function(_0x312a5b){_0xd86c11(_0x312a5b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f4b5cdb..e34e851 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdae2=['status','render','json','send','exports','404'];(function(_0xdeb02e,_0x4a73c6){var _0x3eb81e=function(_0x44c177){while(--_0x44c177){_0xdeb02e['push'](_0xdeb02e['shift']());}};_0x3eb81e(++_0x4a73c6);}(_0xdae2,0x17e));var _0x2dae=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xdae2[_0x263a74];return _0x2aa86c;};'use strict';module[_0x2dae('0x0')][0x194]=function pageNotFound(_0x44fd78,_0x3bb495){var _0x3463f9=_0x2dae('0x1');var _0x37cdfb=0x194;var _0x4b6510={'status':_0x37cdfb};_0x3bb495['status'](_0x4b6510[_0x2dae('0x2')]);_0x3bb495[_0x2dae('0x3')](_0x3463f9,{},function(_0x3a3f66,_0x4a5792){if(_0x3a3f66){return _0x3bb495[_0x2dae('0x2')](_0x4b6510['status'])[_0x2dae('0x4')](_0x4b6510);}_0x3bb495[_0x2dae('0x5')](_0x4a5792);});}; \ No newline at end of file +var _0x354a=['json','send','exports','status','render'];(function(_0x4d2ec1,_0x470a0a){var _0x17ad5f=function(_0x1ea488){while(--_0x1ea488){_0x4d2ec1['push'](_0x4d2ec1['shift']());}};_0x17ad5f(++_0x470a0a);}(_0x354a,0x115));var _0xa354=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x354a[_0x2c7dc6];return _0x10002b;};'use strict';module[_0xa354('0x0')][0x194]=function pageNotFound(_0x4fe8ed,_0x3f6c9b){var _0x1059b3='404';var _0x20f713=0x194;var _0x398aa9={'status':_0x20f713};_0x3f6c9b[_0xa354('0x1')](_0x398aa9[_0xa354('0x1')]);_0x3f6c9b[_0xa354('0x2')](_0x1059b3,{},function(_0xc13181,_0x229acb){if(_0xc13181){return _0x3f6c9b[_0xa354('0x1')](_0x398aa9[_0xa354('0x1')])[_0xa354('0x3')](_0x398aa9);}_0x3f6c9b[_0xa354('0x4')](_0x229acb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c1fbc7f..45c4762 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../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','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','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','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.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','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','ChatQueue','ChatQueues','SmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceExtension','Applications','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessions','TrunkId','TrunkBackupId','Agents','Teams','team_has_voice_queues','VoiceRecording','Messages','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','CannedAnswer','List','ListId','Template','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachments','Interaction','restrict','IntervalId','TagId','Dispositions','FaxAccountId','Answers','Exntensions','fax_interaction_has_tags','Users','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','mandatoryDispositionPause','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelMessage','OpenchannelQueueId','ProactiveActions','ChatMessage','Agent','ChatQueueId','ChatInteractionId','ChatWebsiteId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','Website','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','SubjectId','FieldId','DescriptionId','Field','Variable','VariableId','SugarcrmConfiguration','Subjects','Subject','Description','DeskField','Descriptions','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','VoiceQueues','MailQueues','SmsQueues','team_has_whatsapp_queues','HopperBlacks','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8_general_ci','mysql','utf8','database','username','sequelizeHistory','password','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','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model'];(function(_0x2081f1,_0x36e8ce){var _0x2ad889=function(_0x51ce96){while(--_0x51ce96){_0x2081f1['push'](_0x2081f1['shift']());}};_0x2ad889(++_0x36e8ce);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x12ec70,_0x1ad3dd){_0x12ec70=_0x12ec70-0x0;var _0x4f09d4=_0x3eea[_0x12ec70];return _0x4f09d4;};'use strict';var path=require(_0xa3ee('0x0'));var config=require('../config/environment');var Sequelize=require(_0xa3ee('0x1'));var _=require(_0xa3ee('0x2'));var jstz=require(_0xa3ee('0x3'));var timezone=jstz[_0xa3ee('0x4')]();config[_0xa3ee('0x1')]=_[_0xa3ee('0x5')](config[_0xa3ee('0x1')],{'database':_0xa3ee('0x6'),'username':_0xa3ee('0x7'),'password':_0xa3ee('0x8'),'options':{'host':_0xa3ee('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xa3ee('0xa')](),'define':{'charset':'utf8','collate':_0xa3ee('0xb')}}});config['sequelizeHistory']=_[_0xa3ee('0x5')](config['sequelizeHistory'],{'database':_0xa3ee('0x6'),'username':'xcall','password':_0xa3ee('0x8'),'options':{'host':_0xa3ee('0x9'),'port':0xcea,'dialect':_0xa3ee('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xa3ee('0xa')](),'define':{'charset':_0xa3ee('0xd'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xa3ee('0xe')],config[_0xa3ee('0x1')][_0xa3ee('0xf')],config[_0xa3ee('0x1')]['password'],config[_0xa3ee('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa3ee('0x10')][_0xa3ee('0xe')],config[_0xa3ee('0x10')][_0xa3ee('0xf')],config['sequelizeHistory'][_0xa3ee('0x11')],config[_0xa3ee('0x10')]['options'])};db['User']=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x13'));db[_0xa3ee('0x14')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x15'));db[_0xa3ee('0x16')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x17'));db['VoiceExtension']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x18'));db[_0xa3ee('0x19')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xa3ee('0x1a')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x1b'));db['VoiceRecording']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x1c'));db[_0xa3ee('0x1d')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x1e'));db[_0xa3ee('0x1f')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/voiceMail/voiceMail.model');db[_0xa3ee('0x20')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x21'));db[_0xa3ee('0x22')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x23'));db[_0xa3ee('0x24')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x25'));db[_0xa3ee('0x26')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x27'));db['VoiceQueueReport']=db['sequelize']['import'](_0xa3ee('0x28'));db['MemberReport']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x29'));db[_0xa3ee('0x2a')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x2b'));db[_0xa3ee('0x2c')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xa3ee('0x2d')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x2e'));db['UserVoiceQueue']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x2f'));db['UserChatQueue']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x30'));db[_0xa3ee('0x31')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x32'));db[_0xa3ee('0x33')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x34'));db['UserSmsQueue']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x35'));db['UserOpenchannelQueue']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x36'));db[_0xa3ee('0x37')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x38'));db[_0xa3ee('0x39')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x3a'));db[_0xa3ee('0x3b')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x3c'));db[_0xa3ee('0x3d')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/mailAccount/mailAccount.model');db[_0xa3ee('0x3e')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/mailQueue/mailQueue.model');db[_0xa3ee('0x3f')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x40'));db[_0xa3ee('0x41')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x42'));db[_0xa3ee('0x43')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x44'));db[_0xa3ee('0x45')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x46'));db[_0xa3ee('0x47')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db[_0xa3ee('0x48')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x49'));db[_0xa3ee('0x4a')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x4b'));db['FaxAccount']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x4c'));db[_0xa3ee('0x4d')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x4e'));db[_0xa3ee('0x4f')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x50'));db[_0xa3ee('0x51')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x52'));db[_0xa3ee('0x53')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/faxQueue/faxQueue.model');db[_0xa3ee('0x54')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x55'));db['SmsAccount']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x56'));db[_0xa3ee('0x57')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x58'));db[_0xa3ee('0x59')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x5a'));db[_0xa3ee('0x5b')]=db['sequelize'][_0xa3ee('0x12')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x5c'));db[_0xa3ee('0x5d')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x5e'));db['OpenchannelApplication']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0xa3ee('0x5f')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x60'));db[_0xa3ee('0x61')]=db[_0xa3ee('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xa3ee('0x62')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x63'));db[_0xa3ee('0x64')]=db[_0xa3ee('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xa3ee('0x65')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x66'));db['ChatInteraction']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x67'));db['ChatMessage']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/chatMessage/chatMessage.model');db[_0xa3ee('0x68')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/chatQueue/chatQueue.model');db[_0xa3ee('0x69')]=db[_0xa3ee('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xa3ee('0x6a')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa3ee('0x6b')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x6c'));db[_0xa3ee('0x6d')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x6e'));db[_0xa3ee('0x6f')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x70'));db[_0xa3ee('0x71')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x72'));db['CmHopperFinal']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x73'));db['CmHopperHistory']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db['sequelize']['import'](_0xa3ee('0x74'));db[_0xa3ee('0x75')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x76'));db[_0xa3ee('0x77')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x78'));db[_0xa3ee('0x79')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x7a'));db['CannedAnswer']=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x7b'));db[_0xa3ee('0x7c')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x7d'));db[_0xa3ee('0x7e')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x7f'));db[_0xa3ee('0x80')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x81'));db[_0xa3ee('0x82')]=db['sequelize'][_0xa3ee('0x12')]('../api/pause/pause.model');db['Cdr']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x83'));db[_0xa3ee('0x84')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xa3ee('0x85')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x86'));db['Sound']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/sound/sound.model');db[_0xa3ee('0x87')]=db['sequelize']['import'](_0xa3ee('0x88'));db['Template']=db['sequelize'][_0xa3ee('0x12')]('../api/template/template.model');db['Trigger']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/trigger/trigger.model');db['Variable']=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x89'));db[_0xa3ee('0x8a')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x8b'));db['IntegrationReport']=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x8c'));db[_0xa3ee('0x8d')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0x8e'));db['AnalyticDefaultReport']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x8f'));db[_0xa3ee('0x90')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x91'));db[_0xa3ee('0x92')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x93'));db[_0xa3ee('0x94')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x95'));db['AnalyticTreeReport']=db['sequelize'][_0xa3ee('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xa3ee('0x96')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x97'));db['SalesforceConfiguration']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x98'));db[_0xa3ee('0x99')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x9a'));db[_0xa3ee('0x9b')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x9c'));db['SugarcrmConfiguration']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x9d'));db[_0xa3ee('0x9e')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xa3ee('0x9f')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xa0'));db[_0xa3ee('0xa1')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xa2'));db['DeskField']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/intDeskField/intDeskField.model');db[_0xa3ee('0xa3')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xa4'));db[_0xa3ee('0xa5')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xa6'));db[_0xa3ee('0xa7')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xa8'));db[_0xa3ee('0xa9')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xaa'));db['ZendeskConfiguration']=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xa3ee('0xab')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xac'));db[_0xa3ee('0xad')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xae'));db[_0xa3ee('0xaf')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xa3ee('0xb0')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xb1'));db[_0xa3ee('0xb2')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xb3'));db[_0xa3ee('0xb4')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xb5'));db[_0xa3ee('0xb6')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xb7'));db[_0xa3ee('0xb8')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xb9'));db[_0xa3ee('0xba')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xbb'));db[_0xa3ee('0xbc')]=db['sequelize']['import'](_0xa3ee('0xbd'));db[_0xa3ee('0xbe')]=db['sequelize']['import'](_0xa3ee('0xbf'));db[_0xa3ee('0xc0')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xc1'));db[_0xa3ee('0xc2')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xc3'));db[_0xa3ee('0xc4')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xc5'));db['FreshsalesConfiguration']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xc6'));db[_0xa3ee('0xc7')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x8b'));db['Network']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xc8'));db[_0xa3ee('0xc9')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xca'));db[_0xa3ee('0xcb')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xcc'));db[_0xa3ee('0xcd')]=db['sequelize']['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xa3ee('0xce')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xcf'));db[_0xa3ee('0xd0')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xd1'));db[_0xa3ee('0xd2')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xd3'));db[_0xa3ee('0xd4')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0xa3ee('0xd5')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xd6'));db[_0xa3ee('0xd7')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xd8'));db[_0xa3ee('0xd9')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xda'));db[_0xa3ee('0xdb')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xdc'));db[_0xa3ee('0xdd')]=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0xa3ee('0x12')]('../api/squareMessage/squareMessage.model');db[_0xa3ee('0xde')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xdf'));db[_0xa3ee('0xe0')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xe1'));db[_0xa3ee('0xe2')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xe3'));db[_0xa3ee('0xe4')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xe5'));db[_0xa3ee('0xe6')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xe7'));db[_0xa3ee('0xe8')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xe9'));db[_0xa3ee('0xea')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xeb'));db[_0xa3ee('0xec')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0xa3ee('0x12')]('../api/faxTransferReport/faxTransferReport.model');db[_0xa3ee('0xed')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xee'));db[_0xa3ee('0xef')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xf0'));db[_0xa3ee('0xf1')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xf2'));db[_0xa3ee('0xf3')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xf4'));db[_0xa3ee('0xf5')]=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xf6'));db['UserProfileSection']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xf7'));db[_0xa3ee('0xf8')]=db['sequelize'][_0xa3ee('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xa3ee('0xf9')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xfa'));db[_0xa3ee('0xfb')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0xfc'));db['WhatsappApplication']=db['sequelize'][_0xa3ee('0x12')](_0xa3ee('0xfd'));db[_0xa3ee('0xfe')]=db[_0xa3ee('0x1')]['import'](_0xa3ee('0xff'));db[_0xa3ee('0x100')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0xa3ee('0x1')]['import'](_0xa3ee('0x101'));db[_0xa3ee('0x102')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x103'));db[_0xa3ee('0x104')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x105'));db[_0xa3ee('0x106')]=db[_0xa3ee('0x1')][_0xa3ee('0x12')](_0xa3ee('0x107'));db[_0xa3ee('0x108')][_0xa3ee('0x109')](db[_0xa3ee('0x1f')],{'as':_0xa3ee('0x1f'),'onDelete':'cascade','foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db['VoiceRecording'],{'as':_0xa3ee('0x10c'),'foreignKey':_0xa3ee('0x10a')});db['User']['hasMany'](db[_0xa3ee('0x2d')],{'as':_0xa3ee('0x10d'),'foreignKey':'UserId'});db['User']['hasMany'](db['VoiceExtension'],{'as':_0xa3ee('0x10e'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x110')],{'as':_0xa3ee('0x111'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x112')],{'as':_0xa3ee('0x113'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x114')],{'as':_0xa3ee('0x114'),'foreignKey':'UserId'});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x5f')],{'as':_0xa3ee('0x115'),'foreignKey':'UserId'});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x116')],{'as':_0xa3ee('0x117'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x59')],{'as':'SmsInteractions','foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0x4f')],{'as':'FaxInteractions','foreignKey':_0xa3ee('0x10a')});db['User'][_0xa3ee('0x10b')](db['MailInteraction'],{'as':_0xa3ee('0x118'),'foreignKey':_0xa3ee('0x10a')});db['User'][_0xa3ee('0x10b')](db[_0xa3ee('0xfe')],{'as':_0xa3ee('0x119'),'foreignKey':'UserId'});db[_0xa3ee('0x108')][_0xa3ee('0x10b')](db[_0xa3ee('0xf9')],{'as':_0xa3ee('0x11a'),'foreignKey':_0xa3ee('0x11b')});db[_0xa3ee('0x108')][_0xa3ee('0x11c')](db[_0xa3ee('0xf5')],{'as':_0xa3ee('0xf5'),'foreignKey':'userProfileId'});db[_0xa3ee('0x108')]['belongsToMany'](db['ChatGroup'],{'as':'Groups','through':_0xa3ee('0x11d')});db['User']['belongsToMany'](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x11e'),'through':_0xa3ee('0x11f')});db['User'][_0xa3ee('0x120')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x121'),'through':'cm_user_has_lists'});db['User'][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x122')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x41')],{'as':_0xa3ee('0x118'),'through':_0xa3ee('0x123')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x116')],{'as':_0xa3ee('0x117'),'through':_0xa3ee('0x124')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x4f')],{'as':_0xa3ee('0x125'),'through':'user_has_fax_interactions'});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0x59')],{'as':_0xa3ee('0x126'),'through':_0xa3ee('0x127')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x5f')],{'as':_0xa3ee('0x115'),'through':_0xa3ee('0x128')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0xfe')],{'as':_0xa3ee('0x119'),'through':_0xa3ee('0x129')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x1a')],{'as':'VoiceQueues','through':_0xa3ee('0x12a'),'required':![]});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db['MailQueue'],{'as':'MailQueues','through':_0xa3ee('0x31'),'required':![]});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0x12b')],{'as':_0xa3ee('0x12c'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x53')],{'as':'FaxQueues','through':_0xa3ee('0x33'),'required':![]});db['User']['belongsToMany'](db[_0xa3ee('0x12d')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db['User']['belongsToMany'](db['OpenchannelQueue'],{'as':_0xa3ee('0x12e'),'through':_0xa3ee('0x12f'),'required':![]});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x104')],{'as':_0xa3ee('0x130'),'through':_0xa3ee('0x37'),'required':![]});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0xf1')],{'through':_0xa3ee('0x131')});db['User']['belongsToMany'](db[_0xa3ee('0xf3')],{'as':_0xa3ee('0x132'),'through':_0xa3ee('0x133'),'required':![]});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0x62')],{'as':_0xa3ee('0x134'),'through':_0xa3ee('0x135')});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0x136')],{'as':_0xa3ee('0x137'),'through':_0xa3ee('0x138')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db['MailAccount'],{'as':_0xa3ee('0x139'),'through':_0xa3ee('0x13a')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x5d')],{'as':_0xa3ee('0x13b'),'through':_0xa3ee('0x13c')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0x13d')],{'as':_0xa3ee('0x13e'),'through':_0xa3ee('0x13f')});db[_0xa3ee('0x108')][_0xa3ee('0x120')](db[_0xa3ee('0xfb')],{'as':_0xa3ee('0x140'),'through':_0xa3ee('0x141')});db[_0xa3ee('0x108')]['belongsToMany'](db[_0xa3ee('0xdb')],{'as':_0xa3ee('0x142'),'through':_0xa3ee('0x143')});db[_0xa3ee('0x14')][_0xa3ee('0x10b')](db[_0xa3ee('0x144')],{'as':'SpiedAgents','onDelete':_0xa3ee('0x10f'),'foreignKey':'ChanSpyId'});db[_0xa3ee('0x16')][_0xa3ee('0x10b')](db[_0xa3ee('0x144')],{'onDelete':'cascade'});db[_0xa3ee('0x144')][_0xa3ee('0x10b')](db[_0xa3ee('0x144')],{'as':_0xa3ee('0x145'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x19')]['belongsToMany'](db[_0xa3ee('0x146')],{'as':_0xa3ee('0x147'),'through':_0xa3ee('0x148')});db[_0xa3ee('0x1a')]['hasMany'](db[_0xa3ee('0x2d')],{'as':_0xa3ee('0x149'),'foreignKey':'VoiceQueueId'});db[_0xa3ee('0x1a')][_0xa3ee('0x10b')](db[_0xa3ee('0x6f')],{'as':_0xa3ee('0x14a'),'foreignKey':'VoiceQueueId'});db[_0xa3ee('0x1a')][_0xa3ee('0x10b')](db[_0xa3ee('0x110')],{'as':'HopperFinals','foreignKey':_0xa3ee('0x14b')});db['VoiceQueue'][_0xa3ee('0x10b')](db[_0xa3ee('0x112')],{'as':_0xa3ee('0x14c'),'foreignKey':_0xa3ee('0x14b')});db[_0xa3ee('0x1a')][_0xa3ee('0x10b')](db[_0xa3ee('0x114')],{'as':_0xa3ee('0x114'),'foreignKey':_0xa3ee('0x14b')});db[_0xa3ee('0x1a')][_0xa3ee('0x10b')](db[_0xa3ee('0x71')],{'as':'HopperBlacks','foreignKey':_0xa3ee('0x14b')});db[_0xa3ee('0x1a')][_0xa3ee('0x10b')](db[_0xa3ee('0xd0')],{'as':_0xa3ee('0x14d'),'foreignKey':_0xa3ee('0x14b')});db[_0xa3ee('0x1a')]['belongsTo'](db[_0xa3ee('0x2a')],{'as':_0xa3ee('0x2a'),'foreignKey':_0xa3ee('0x14e')});db[_0xa3ee('0x1a')]['belongsTo'](db[_0xa3ee('0x2a')],{'as':'TrunkBackup','foreignKey':_0xa3ee('0x14f')});db[_0xa3ee('0x1a')]['belongsTo'](db[_0xa3ee('0x80')],{'as':_0xa3ee('0x80'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0xa3ee('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0xa3ee('0xf1')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xa3ee('0x1a')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':_0xa3ee('0x12a')});db[_0xa3ee('0x1a')][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'as':_0xa3ee('0x151'),'through':_0xa3ee('0x152')});db['VoiceQueue'][_0xa3ee('0x120')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xa3ee('0x153')][_0xa3ee('0x11c')](db['User'],{'as':'User','foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x1d')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x108'),'foreignKey':'UserId'});db[_0xa3ee('0x1f')][_0xa3ee('0x10b')](db[_0xa3ee('0x20')],{'as':_0xa3ee('0x154'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xa3ee('0x155')});db['VoiceMailMessage'][_0xa3ee('0x11c')](db[_0xa3ee('0x1f')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xa3ee('0x22')][_0xa3ee('0x10b')](db[_0xa3ee('0x156')],{'as':_0xa3ee('0x157'),'foreignKey':_0xa3ee('0x158'),'constraints':![]});db['VoiceCallReport'][_0xa3ee('0x10b')](db[_0xa3ee('0x26')],{'as':_0xa3ee('0x159'),'foreignKey':_0xa3ee('0x158'),'constraints':![]});db['VoiceCallReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x108'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xa3ee('0x11c')](db['CmContact'],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db['MailServerIn'][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{'as':_0xa3ee('0x3d'),'foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x3b')][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{'as':_0xa3ee('0x3d'),'foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x3d')][_0xa3ee('0x109')](db[_0xa3ee('0x39')],{'as':_0xa3ee('0x15d'),'onDelete':'cascade'});db[_0xa3ee('0x3d')][_0xa3ee('0x109')](db[_0xa3ee('0x3b')],{'as':_0xa3ee('0x15e'),'onDelete':_0xa3ee('0x10f')});db['MailAccount']['hasMany'](db[_0xa3ee('0x7c')],{'as':'Dispositions','foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x3d')][_0xa3ee('0x10b')](db[_0xa3ee('0x15f')],{'as':'Answers','foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x3d')][_0xa3ee('0x10b')](db['MailMessage'],{'as':_0xa3ee('0x154'),'foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x3d')][_0xa3ee('0x10b')](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0xa3ee('0x10b')](db['MailApplication'],{'as':_0xa3ee('0x145')});db[_0xa3ee('0x3d')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db['MailAccount'][_0xa3ee('0x11c')](db[_0xa3ee('0x162')],{'as':_0xa3ee('0x162'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0xa3ee('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0xa3ee('0x163')});db[_0xa3ee('0x3d')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':'Agents','through':_0xa3ee('0x13a')});db[_0xa3ee('0x3e')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':'UserMailQueue'});db[_0xa3ee('0x3e')][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x164'),'as':_0xa3ee('0x151')});db[_0xa3ee('0x41')][_0xa3ee('0x10b')](db[_0xa3ee('0x43')],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x165')});db[_0xa3ee('0x41')][_0xa3ee('0x11c')](db['MailAccount'],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x15c')});db['MailInteraction'][_0xa3ee('0x11c')](db['CmContact'],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db['MailInteraction']['belongsTo'](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x41')]['belongsToMany'](db[_0xa3ee('0x87')],{'through':'mail_interaction_has_tags','as':_0xa3ee('0x168')});db[_0xa3ee('0x41')]['belongsToMany'](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x169'),'as':_0xa3ee('0x16a')});db[_0xa3ee('0x41')]['belongsToMany'](db[_0xa3ee('0x108')],{'as':'Users','through':_0xa3ee('0x123'),'foreignKey':_0xa3ee('0x165')});db[_0xa3ee('0x43')][_0xa3ee('0x10b')](db['Attachment'],{'as':_0xa3ee('0x16b'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x43')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x108')});db['MailMessage'][_0xa3ee('0x11c')](db['CmContact'],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x15a')});db[_0xa3ee('0x43')][_0xa3ee('0x11c')](db[_0xa3ee('0x41')],{'as':_0xa3ee('0x16c'),'foreignKey':_0xa3ee('0x165')});db[_0xa3ee('0x43')][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x15c')});db[_0xa3ee('0x45')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x45')][_0xa3ee('0x11c')](db[_0xa3ee('0x3e')],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x45')][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{'onDelete':'restrict'});db[_0xa3ee('0x45')]['belongsTo'](db[_0xa3ee('0x80')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x45')][_0xa3ee('0x11c')](db[_0xa3ee('0x87')],{'onDelete':'restrict','foreignKey':_0xa3ee('0x16f')});db[_0xa3ee('0x47')][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{});db['MailQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0x47')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':'ContactId'});db[_0xa3ee('0x47')][_0xa3ee('0x11c')](db['MailInteraction'],{});db['MailQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x43')],{});db['MailQueueReport']['belongsTo'](db[_0xa3ee('0x108')],{});db['MailQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x3e')],{});db[_0xa3ee('0x48')][_0xa3ee('0x10b')](db[_0xa3ee('0x4a')],{'as':'Items','onDelete':_0xa3ee('0x10f')});db['FaxAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x7c')],{'as':_0xa3ee('0x170'),'foreignKey':_0xa3ee('0x171')});db[_0xa3ee('0x136')][_0xa3ee('0x10b')](db[_0xa3ee('0x15f')],{'as':_0xa3ee('0x172'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x4f')],{'as':'Interactions'});db['FaxAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x4d')],{'as':_0xa3ee('0x145')});db['FaxAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x144')],{'as':_0xa3ee('0x173'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x136')][_0xa3ee('0x10b')](db['FaxMessage'],{'as':'Messages'});db[_0xa3ee('0x136')]['belongsTo'](db[_0xa3ee('0x2a')],{'as':_0xa3ee('0x2a')});db[_0xa3ee('0x136')][_0xa3ee('0x11c')](db['CmList'],{'as':_0xa3ee('0x160'),'foreignKey':'ListId'});db[_0xa3ee('0x136')][_0xa3ee('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa3ee('0x163')});db[_0xa3ee('0x136')]['belongsToMany'](db['User'],{'as':_0xa3ee('0x150'),'through':'user_has_fax_accounts'});db[_0xa3ee('0x4d')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x4d')][_0xa3ee('0x11c')](db[_0xa3ee('0x53')],{'onDelete':'restrict'});db['FaxApplication'][_0xa3ee('0x11c')](db['FaxAccount'],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x4d')][_0xa3ee('0x11c')](db[_0xa3ee('0x87')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16f')});db[_0xa3ee('0x4f')][_0xa3ee('0x10b')](db[_0xa3ee('0x51')],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':'FaxInteractionId'});db[_0xa3ee('0x4f')]['belongsTo'](db[_0xa3ee('0x136')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x171')});db[_0xa3ee('0x4f')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x4f')][_0xa3ee('0x11c')](db['User'],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x4f')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x174'),'as':_0xa3ee('0x168')});db['FaxInteraction'][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x174'),'as':_0xa3ee('0x16a')});db[_0xa3ee('0x4f')][_0xa3ee('0x120')](db['User'],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x176'),'foreignKey':_0xa3ee('0x177')});db[_0xa3ee('0x51')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x10f'),'as':'User'});db['FaxMessage'][_0xa3ee('0x11c')](db[_0xa3ee('0x4f')],{'as':_0xa3ee('0x16c'),'foreignKey':_0xa3ee('0x177')});db[_0xa3ee('0x51')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'onDelete':_0xa3ee('0x10f'),'as':'Contact'});db['FaxMessage'][_0xa3ee('0x11c')](db[_0xa3ee('0xe6')],{'as':_0xa3ee('0xe6'),'foreignKey':_0xa3ee('0x178')});db[_0xa3ee('0x51')][_0xa3ee('0x11c')](db['FaxAccount'],{'as':'Account','foreignKey':_0xa3ee('0x171')});db[_0xa3ee('0x53')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':_0xa3ee('0x33')});db[_0xa3ee('0x53')][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x179'),'as':'Teams'});db[_0xa3ee('0x54')]['belongsTo'](db[_0xa3ee('0x136')],{});db[_0xa3ee('0x54')]['belongsTo'](db['CmList'],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db['FaxQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db['FaxQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x4f')],{});db[_0xa3ee('0x54')][_0xa3ee('0x11c')](db[_0xa3ee('0x51')],{});db[_0xa3ee('0x54')]['belongsTo'](db[_0xa3ee('0x108')],{});db[_0xa3ee('0x54')]['belongsTo'](db[_0xa3ee('0x53')],{});db[_0xa3ee('0x13d')][_0xa3ee('0x10b')](db['Disposition'],{'as':_0xa3ee('0x170'),'foreignKey':_0xa3ee('0x17a')});db[_0xa3ee('0x13d')]['hasMany'](db[_0xa3ee('0x15f')],{'as':'Answers','foreignKey':_0xa3ee('0x17a')});db[_0xa3ee('0x13d')][_0xa3ee('0x10b')](db[_0xa3ee('0x5b')],{'as':_0xa3ee('0x154'),'foreignKey':_0xa3ee('0x17a')});db[_0xa3ee('0x13d')][_0xa3ee('0x10b')](db[_0xa3ee('0x59')],{'as':_0xa3ee('0x17b')});db[_0xa3ee('0x13d')][_0xa3ee('0x10b')](db['SmsApplication'],{'as':'Applications'});db[_0xa3ee('0x13d')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db['SmsAccount'][_0xa3ee('0x11c')](db[_0xa3ee('0x82')],{'as':_0xa3ee('0x17c'),'foreignKey':_0xa3ee('0x163')});db['SmsAccount'][_0xa3ee('0x120')](db['User'],{'as':_0xa3ee('0x150'),'through':_0xa3ee('0x13f')});db[_0xa3ee('0x57')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':'restrict'});db['SmsApplication'][_0xa3ee('0x11c')](db[_0xa3ee('0x12d')],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x57')][_0xa3ee('0x11c')](db[_0xa3ee('0x13d')],{'onDelete':'restrict'});db[_0xa3ee('0x57')][_0xa3ee('0x11c')](db[_0xa3ee('0x80')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x57')]['belongsTo'](db[_0xa3ee('0x87')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16f')});db[_0xa3ee('0x59')][_0xa3ee('0x10b')](db['SmsMessage'],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x17d')});db[_0xa3ee('0x59')][_0xa3ee('0x11c')](db[_0xa3ee('0x13d')],{'as':_0xa3ee('0x166'),'foreignKey':'SmsAccountId'});db[_0xa3ee('0x59')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':'Contact','foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x59')][_0xa3ee('0x11c')](db['User'],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x59')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x17e'),'as':'Tags'});db['SmsInteraction'][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xa3ee('0x59')]['belongsToMany'](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x127'),'foreignKey':_0xa3ee('0x17d')});db[_0xa3ee('0x5b')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x108')});db[_0xa3ee('0x5b')][_0xa3ee('0x11c')](db['CmContact'],{'onDelete':'cascade','as':_0xa3ee('0x15a')});db[_0xa3ee('0x5b')]['belongsTo'](db[_0xa3ee('0x59')],{'onDelete':_0xa3ee('0x10f'),'as':'Interaction','foreignKey':_0xa3ee('0x17d')});db['SmsMessage']['belongsTo'](db[_0xa3ee('0x13d')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xa3ee('0x12d')]['belongsToMany'](db['User'],{'as':_0xa3ee('0x150'),'through':_0xa3ee('0x17f'),'foreignKey':_0xa3ee('0x180')});db['SmsQueue'][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x181'),'as':_0xa3ee('0x151')});db[_0xa3ee('0x5d')][_0xa3ee('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa3ee('0x182')});db[_0xa3ee('0x5d')][_0xa3ee('0x10b')](db[_0xa3ee('0x15f')],{'as':_0xa3ee('0x172'),'foreignKey':_0xa3ee('0x182')});db['OpenchannelAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x5f')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xa3ee('0x5d')][_0xa3ee('0x10b')](db['OpenchannelMessage'],{'as':_0xa3ee('0x154'),'foreignKey':'OpenchannelAccountId'});db[_0xa3ee('0x5d')][_0xa3ee('0x10b')](db[_0xa3ee('0x183')],{'as':_0xa3ee('0x145'),'foreignKey':_0xa3ee('0x182')});db['OpenchannelAccount'][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0x5d')]['belongsTo'](db[_0xa3ee('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0xa3ee('0x163')});db[_0xa3ee('0x5d')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':'Agents','through':_0xa3ee('0x13c')});db[_0xa3ee('0x183')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x16d')});db['OpenchannelApplication']['belongsTo'](db[_0xa3ee('0x61')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication']['belongsTo'](db[_0xa3ee('0x5d')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x182')});db[_0xa3ee('0x183')][_0xa3ee('0x11c')](db['Interval'],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x183')][_0xa3ee('0x11c')](db[_0xa3ee('0x87')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16f')});db[_0xa3ee('0x5f')][_0xa3ee('0x10b')](db['OpenchannelMessage'],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x184')});db[_0xa3ee('0x5f')][_0xa3ee('0x11c')](db[_0xa3ee('0x5d')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x182')});db[_0xa3ee('0x5f')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x5f')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x5f')][_0xa3ee('0x120')](db['Tag'],{'through':_0xa3ee('0x185'),'as':_0xa3ee('0x168')});db[_0xa3ee('0x5f')]['belongsToMany'](db['Tag'],{'through':_0xa3ee('0x185'),'as':_0xa3ee('0x16a')});db['OpenchannelInteraction']['belongsToMany'](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x128'),'foreignKey':'OpenchannelInteractionId'});db[_0xa3ee('0x186')][_0xa3ee('0x11c')](db['User'],{'onDelete':'cascade','as':_0xa3ee('0x108')});db[_0xa3ee('0x186')][_0xa3ee('0x11c')](db['CmContact'],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x15a')});db['OpenchannelMessage'][_0xa3ee('0x11c')](db[_0xa3ee('0x5f')],{'onDelete':_0xa3ee('0x10f'),'as':'Interaction','foreignKey':_0xa3ee('0x184')});db['OpenchannelMessage'][_0xa3ee('0x11c')](db[_0xa3ee('0xe6')],{'as':_0xa3ee('0xe6'),'foreignKey':_0xa3ee('0x178')});db[_0xa3ee('0x186')][_0xa3ee('0x11c')](db[_0xa3ee('0x5d')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x182')});db[_0xa3ee('0x61')]['belongsToMany'](db['User'],{'as':_0xa3ee('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0xa3ee('0x187')});db['OpenchannelQueue']['belongsToMany'](db[_0xa3ee('0xde')],{'through':'team_has_openchannel_queues','as':_0xa3ee('0x151')});db[_0xa3ee('0x62')][_0xa3ee('0x10b')](db[_0xa3ee('0x7c')],{'as':_0xa3ee('0x170'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xa3ee('0x10b')](db[_0xa3ee('0x15f')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xa3ee('0x62')][_0xa3ee('0x10b')](db[_0xa3ee('0x6a')],{'as':_0xa3ee('0x188')});db['ChatWebsite'][_0xa3ee('0x10b')](db[_0xa3ee('0x116')],{'as':'Interactions'});db[_0xa3ee('0x62')]['hasMany'](db[_0xa3ee('0x65')],{'as':'Applications'});db[_0xa3ee('0x62')][_0xa3ee('0x10b')](db[_0xa3ee('0x189')],{'as':_0xa3ee('0x154')});db[_0xa3ee('0x62')]['belongsTo'](db['CmList'],{'as':_0xa3ee('0x160'),'foreignKey':'ListId'});db[_0xa3ee('0x62')][_0xa3ee('0x11c')](db[_0xa3ee('0x80')],{'as':_0xa3ee('0x80'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x62')][_0xa3ee('0x11c')](db[_0xa3ee('0x82')],{'as':_0xa3ee('0x17c'),'foreignKey':_0xa3ee('0x163')});db[_0xa3ee('0x62')]['belongsToMany'](db['User'],{'as':_0xa3ee('0x150'),'through':_0xa3ee('0x135')});db[_0xa3ee('0x64')][_0xa3ee('0x11c')](db[_0xa3ee('0x5d')],{});db['OpenchannelQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0xa3ee('0x64')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x64')][_0xa3ee('0x11c')](db[_0xa3ee('0x5f')],{});db[_0xa3ee('0x64')][_0xa3ee('0x11c')](db[_0xa3ee('0x186')],{});db[_0xa3ee('0x64')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{});db[_0xa3ee('0x64')]['belongsTo'](db[_0xa3ee('0x61')],{});db[_0xa3ee('0x65')][_0xa3ee('0x11c')](db['User'],{'as':_0xa3ee('0x18a'),'foreignKey':_0xa3ee('0x10a'),'onDelete':_0xa3ee('0x16d')});db['ChatApplication'][_0xa3ee('0x11c')](db[_0xa3ee('0x12b')],{'as':'Queue','foreignKey':_0xa3ee('0x18b'),'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x65')][_0xa3ee('0x11c')](db[_0xa3ee('0x62')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0xa3ee('0x16d')});db['ChatApplication'][_0xa3ee('0x11c')](db[_0xa3ee('0x87')],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16f')});db['ChatInteraction'][_0xa3ee('0x10b')](db[_0xa3ee('0x189')],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x18c')});db[_0xa3ee('0x116')]['belongsTo'](db[_0xa3ee('0x62')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x18d')});db[_0xa3ee('0x116')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x116')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':'Owner','foreignKey':_0xa3ee('0x10a')});db[_0xa3ee('0x116')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':'chat_interaction_has_tags','as':_0xa3ee('0x168')});db[_0xa3ee('0x116')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x18e'),'as':'ThroughTags'});db[_0xa3ee('0x116')][_0xa3ee('0x120')](db['User'],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x124'),'foreignKey':_0xa3ee('0x18c')});db[_0xa3ee('0x189')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x108')});db[_0xa3ee('0x189')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x189')][_0xa3ee('0x11c')](db[_0xa3ee('0x116')],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x16c'),'foreignKey':_0xa3ee('0x18c')});db['ChatMessage'][_0xa3ee('0x11c')](db['Attachment'],{'as':_0xa3ee('0xe6'),'foreignKey':_0xa3ee('0x178')});db[_0xa3ee('0x189')][_0xa3ee('0x11c')](db[_0xa3ee('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xa3ee('0x68')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'onDelete':_0xa3ee('0x10f'),'as':'Contact','foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x68')][_0xa3ee('0x11c')](db[_0xa3ee('0x62')],{'as':'Account','foreignKey':_0xa3ee('0x18d')});db[_0xa3ee('0x12b')][_0xa3ee('0x120')](db['User'],{'as':'Agents','through':_0xa3ee('0x18f'),'hooks':!![]});db[_0xa3ee('0x12b')]['belongsToMany'](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x190'),'as':_0xa3ee('0x151')});db['ChatGroup'][_0xa3ee('0x10b')](db['ChatInternalMessage'],{'as':_0xa3ee('0x154'),'foreignKey':_0xa3ee('0x191'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x69')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x149'),'through':_0xa3ee('0x11d')});db[_0xa3ee('0x6a')][_0xa3ee('0x11c')](db[_0xa3ee('0x62')],{'as':_0xa3ee('0x192'),'foreignKey':_0xa3ee('0x18d')});db[_0xa3ee('0x6b')][_0xa3ee('0x10b')](db[_0xa3ee('0x6d')],{'as':'Contacts','foreignKey':_0xa3ee('0x193')});db[_0xa3ee('0x6d')][_0xa3ee('0x10b')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x6d')][_0xa3ee('0x10b')](db['CmHopperFinal'],{'as':_0xa3ee('0x111'),'foreignKey':_0xa3ee('0x15b')});db['CmContact']['hasMany'](db[_0xa3ee('0x112')],{'as':_0xa3ee('0x14c'),'foreignKey':_0xa3ee('0x15b')});db['CmContact'][_0xa3ee('0x10b')](db['ReportAgentPreview'],{'as':_0xa3ee('0x114'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x6d')][_0xa3ee('0x10b')](db[_0xa3ee('0xd0')],{'as':_0xa3ee('0x14d'),'foreignKey':_0xa3ee('0x15b')});db['CmContact']['hasMany'](db[_0xa3ee('0x5f')],{'as':_0xa3ee('0x115'),'foreignKey':_0xa3ee('0x15b'),'onDelete':'restrict'});db[_0xa3ee('0x6d')]['hasMany'](db[_0xa3ee('0x116')],{'as':_0xa3ee('0x117'),'foreignKey':_0xa3ee('0x15b'),'onDelete':'restrict'});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xa3ee('0x15b'),'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x6d')][_0xa3ee('0x10b')](db['FaxInteraction'],{'as':_0xa3ee('0x125'),'foreignKey':_0xa3ee('0x15b'),'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x6d')]['hasMany'](db[_0xa3ee('0x41')],{'as':_0xa3ee('0x118'),'foreignKey':_0xa3ee('0x15b'),'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x6d')][_0xa3ee('0x11c')](db[_0xa3ee('0x6b')],{'as':_0xa3ee('0x194'),'foreignKey':_0xa3ee('0x193')});db[_0xa3ee('0x6d')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':'List','foreignKey':_0xa3ee('0x161'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x6d')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x11f')});db[_0xa3ee('0x6d')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'as':_0xa3ee('0x168'),'through':_0xa3ee('0x195')});db[_0xa3ee('0x6d')]['belongsToMany'](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x195'),'as':_0xa3ee('0x16a')});db[_0xa3ee('0x6f')]['belongsTo'](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x6f')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161'),'onDelete':'cascade'});db[_0xa3ee('0x6f')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x18a'),'foreignKey':'UserId'});db[_0xa3ee('0x6f')][_0xa3ee('0x11c')](db['VoiceQueue'],{'as':_0xa3ee('0x196'),'foreignKey':_0xa3ee('0x14b'),'onDelete':_0xa3ee('0x10f')});db['CmHopper'][_0xa3ee('0x11c')](db[_0xa3ee('0xe2')],{'as':_0xa3ee('0xe2'),'foreignKey':_0xa3ee('0x197'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x6f')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x198')});db[_0xa3ee('0x71')]['belongsTo'](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b'),'onDelete':_0xa3ee('0x10f')});db['CmHopperBlack'][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161'),'onDelete':'cascade'});db[_0xa3ee('0x71')][_0xa3ee('0x11c')](db[_0xa3ee('0x1a')],{'as':_0xa3ee('0x196'),'foreignKey':'VoiceQueueId','onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x71')]['belongsTo'](db[_0xa3ee('0xe2')],{'as':_0xa3ee('0xe2'),'foreignKey':_0xa3ee('0x197'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0x79')][_0xa3ee('0x10b')](db[_0xa3ee('0x7e')],{'as':{'plural':_0xa3ee('0x199'),'singular':_0xa3ee('0x19a')},'foreignKey':_0xa3ee('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0xa3ee('0x79')][_0xa3ee('0x10b')](db['Condition'],{'as':{'plural':'Any','singular':_0xa3ee('0x19c')},'foreignKey':_0xa3ee('0x19d'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db[_0xa3ee('0x79')]['hasMany'](db['Action'],{'as':_0xa3ee('0x19e'),'foreignKey':_0xa3ee('0x19f'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db[_0xa3ee('0x80')],{'as':_0xa3ee('0x1a0'),'foreignKey':_0xa3ee('0x16e'),'onDelete':_0xa3ee('0x10f'),'hooks':!![],'required':![]});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xa3ee('0x16e'),'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db[_0xa3ee('0x45')],{'as':_0xa3ee('0x1a1'),'foreignKey':'IntervalId'});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db[_0xa3ee('0x65')],{'as':_0xa3ee('0x1a2'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db[_0xa3ee('0x4d')],{'as':_0xa3ee('0x1a3'),'foreignKey':'IntervalId'});db[_0xa3ee('0x80')][_0xa3ee('0x10b')](db['SmsApplication'],{'as':_0xa3ee('0x1a4'),'foreignKey':_0xa3ee('0x16e')});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0xa3ee('0x85')][_0xa3ee('0x11c')](db[_0xa3ee('0x1a5')],{'foreignKey':_0xa3ee('0x1a6')});db['Schedule'][_0xa3ee('0x11c')](db['AnalyticCustomReport'],{'foreignKey':_0xa3ee('0x1a7')});db[_0xa3ee('0x146')][_0xa3ee('0x120')](db['VoiceMusicOnHold'],{'as':_0xa3ee('0x1a8'),'through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0xa3ee('0x120')](db[_0xa3ee('0x6d')],{'through':_0xa3ee('0x195')});db[_0xa3ee('0x87')]['belongsToMany'](db[_0xa3ee('0x116')],{'through':_0xa3ee('0x18e')});db[_0xa3ee('0x87')][_0xa3ee('0x120')](db[_0xa3ee('0x41')],{'through':_0xa3ee('0x169')});db[_0xa3ee('0x87')][_0xa3ee('0x120')](db[_0xa3ee('0x59')],{'through':'sms_interaction_has_tags'});db[_0xa3ee('0x87')][_0xa3ee('0x120')](db['FaxInteraction'],{'through':_0xa3ee('0x174')});db[_0xa3ee('0x87')][_0xa3ee('0x120')](db['OpenchannelInteraction'],{'through':_0xa3ee('0x185')});db[_0xa3ee('0x87')][_0xa3ee('0x120')](db[_0xa3ee('0xfe')],{'through':_0xa3ee('0x1a9')});db[_0xa3ee('0x1aa')]['hasMany'](db['Condition'],{'as':{'plural':_0xa3ee('0x1ab'),'singular':_0xa3ee('0x1ac')},'foreignKey':_0xa3ee('0x1ad'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db[_0xa3ee('0x1aa')][_0xa3ee('0x10b')](db['Condition'],{'as':{'plural':_0xa3ee('0x1ae'),'singular':_0xa3ee('0x1af')},'foreignKey':_0xa3ee('0x1b0'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db[_0xa3ee('0x1aa')][_0xa3ee('0x10b')](db[_0xa3ee('0x77')],{'as':_0xa3ee('0x19e'),'foreignKey':_0xa3ee('0x1b1'),'onDelete':_0xa3ee('0x10f'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xa3ee('0x94')],{'as':'Fields','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1a7'),'hooks':!![]});db[_0xa3ee('0x1a5')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xa3ee('0x1b2'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1a6')});db['AnalyticMetric'][_0xa3ee('0x10b')](db[_0xa3ee('0x94')],{'as':_0xa3ee('0x1b2'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b3')});db[_0xa3ee('0x94')][_0xa3ee('0x11c')](db[_0xa3ee('0x92')],{'foreignKey':_0xa3ee('0x1b3')});db[_0xa3ee('0x96')]['hasMany'](db[_0xa3ee('0x1b4')],{'as':_0xa3ee('0x1b5'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0x1b4')][_0xa3ee('0x10b')](db[_0xa3ee('0x99')],{'as':'Subjects','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0x1b4')]['hasMany'](db[_0xa3ee('0x99')],{'as':'Descriptions','onDelete':_0xa3ee('0x10f'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xa3ee('0x10b')](db[_0xa3ee('0x99')],{'as':'Fields','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b8')});db['SalesforceConfiguration'][_0xa3ee('0x11c')](db['SalesforceAccount'],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db['SalesforceField'][_0xa3ee('0x10b')](db[_0xa3ee('0x99')],{'as':'Subject','foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0x99')][_0xa3ee('0x10b')](db[_0xa3ee('0x99')],{'as':'Description','foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0x99')]['hasMany'](db[_0xa3ee('0x99')],{'as':_0xa3ee('0x1ba'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0x99')][_0xa3ee('0x11c')](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db[_0xa3ee('0x9b')][_0xa3ee('0x10b')](db[_0xa3ee('0x1bd')],{'as':_0xa3ee('0x1b5'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0x1bd')]['hasMany'](db[_0xa3ee('0x9e')],{'as':_0xa3ee('0x1be'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xa3ee('0x1bd')][_0xa3ee('0x10b')](db['SugarcrmField'],{'as':_0xa3ee('0x1b2'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0x1bd')]['belongsTo'](db[_0xa3ee('0x9b')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0x9e')][_0xa3ee('0x10b')](db[_0xa3ee('0x9e')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db['SugarcrmField'][_0xa3ee('0x10b')](db[_0xa3ee('0x9e')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db['SugarcrmField']['hasMany'](db[_0xa3ee('0x9e')],{'as':_0xa3ee('0x1ba'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0x9e')][_0xa3ee('0x11c')](db['Variable'],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db[_0xa3ee('0x9f')][_0xa3ee('0x10b')](db[_0xa3ee('0xa1')],{'as':_0xa3ee('0x1b5'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xa1')]['hasMany'](db[_0xa3ee('0x1c1')],{'as':_0xa3ee('0x1be'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b7')});db['DeskConfiguration']['hasMany'](db[_0xa3ee('0x1c1')],{'as':_0xa3ee('0x1c2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xa3ee('0xa1')][_0xa3ee('0x10b')](db['DeskField'],{'as':_0xa3ee('0x1b2'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xa1')][_0xa3ee('0x11c')](db[_0xa3ee('0x9f')],{'as':_0xa3ee('0x166'),'foreignKey':'AccountId'});db[_0xa3ee('0xa1')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x1c3')});db[_0xa3ee('0x1c1')]['hasMany'](db['DeskField'],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db['DeskField'][_0xa3ee('0x10b')](db[_0xa3ee('0x1c1')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0xa3ee('0x10b')](db[_0xa3ee('0x1c1')],{'as':_0xa3ee('0x1ba'),'foreignKey':'FieldId'});db[_0xa3ee('0x1c1')]['belongsTo'](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0xa5')],{'as':_0xa3ee('0x1b5'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xa5')][_0xa3ee('0x10b')](db[_0xa3ee('0xa7')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xa5')][_0xa3ee('0x10b')](db['ZohoField'],{'as':_0xa3ee('0x1c2'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xa5')][_0xa3ee('0x10b')](db[_0xa3ee('0xa7')],{'as':'Fields','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xa5')][_0xa3ee('0x11c')](db[_0xa3ee('0xa3')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xa7')][_0xa3ee('0x10b')](db[_0xa3ee('0xa7')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xa7')][_0xa3ee('0x10b')](db[_0xa3ee('0xa7')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db['ZohoField'][_0xa3ee('0x10b')](db['ZohoField'],{'as':_0xa3ee('0x1ba'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xa7')][_0xa3ee('0x11c')](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db[_0xa3ee('0xa9')][_0xa3ee('0x10b')](db[_0xa3ee('0x1c4')],{'as':_0xa3ee('0x1b5'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db['ZendeskConfiguration']['hasMany'](db[_0xa3ee('0xab')],{'as':'Subjects','foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0x1c4')][_0xa3ee('0x10b')](db['ZendeskField'],{'as':_0xa3ee('0x1c2'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0x1c4')][_0xa3ee('0x10b')](db[_0xa3ee('0xab')],{'as':'Fields','foreignKey':_0xa3ee('0x1b8')});db['ZendeskConfiguration'][_0xa3ee('0x11c')](db[_0xa3ee('0xa9')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0x1c4')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x1c5')});db[_0xa3ee('0xab')]['hasMany'](db[_0xa3ee('0xab')],{'as':_0xa3ee('0x1bf'),'foreignKey':'SubjectId'});db[_0xa3ee('0xab')][_0xa3ee('0x10b')](db[_0xa3ee('0xab')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db['ZendeskField'][_0xa3ee('0x10b')](db[_0xa3ee('0xab')],{'as':'Field','foreignKey':_0xa3ee('0x1b8')});db['ZendeskField'][_0xa3ee('0x11c')](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db[_0xa3ee('0xad')][_0xa3ee('0x10b')](db[_0xa3ee('0xaf')],{'as':_0xa3ee('0x1b5'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xaf')][_0xa3ee('0x10b')](db[_0xa3ee('0xb0')],{'as':_0xa3ee('0x1be'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xaf')][_0xa3ee('0x10b')](db[_0xa3ee('0xb0')],{'as':_0xa3ee('0x1c2'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b9')});db['FreshdeskConfiguration'][_0xa3ee('0x10b')](db[_0xa3ee('0xb0')],{'as':_0xa3ee('0x1b2'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b8')});db['FreshdeskConfiguration'][_0xa3ee('0x11c')](db['FreshdeskAccount'],{'as':_0xa3ee('0x166'),'foreignKey':'AccountId'});db[_0xa3ee('0xaf')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':_0xa3ee('0x1c6')});db[_0xa3ee('0xb0')]['hasMany'](db[_0xa3ee('0xb0')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xb0')][_0xa3ee('0x10b')](db[_0xa3ee('0xb0')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xb0')][_0xa3ee('0x10b')](db['FreshdeskField'],{'as':_0xa3ee('0x1ba'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xb0')][_0xa3ee('0x11c')](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db['VtigerAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0xb4')],{'as':'Configurations','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xb4')][_0xa3ee('0x10b')](db[_0xa3ee('0xb6')],{'as':_0xa3ee('0x1be'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xb4')][_0xa3ee('0x10b')](db['VtigerField'],{'as':_0xa3ee('0x1c2'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xb4')]['hasMany'](db[_0xa3ee('0xb6')],{'as':_0xa3ee('0x1b2'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xb4')][_0xa3ee('0x11c')](db[_0xa3ee('0xb2')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xb6')][_0xa3ee('0x10b')](db[_0xa3ee('0xb6')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xb6')]['hasMany'](db[_0xa3ee('0xb6')],{'as':'Description','foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xb6')]['hasMany'](db['VtigerField'],{'as':_0xa3ee('0x1ba'),'foreignKey':'FieldId'});db[_0xa3ee('0xb6')][_0xa3ee('0x11c')](db[_0xa3ee('0x1bb')],{'as':'Variable','foreignKey':_0xa3ee('0x1bc')});db['ServicenowAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0xba')],{'as':'Configurations','onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xba')][_0xa3ee('0x10b')](db[_0xa3ee('0xbc')],{'as':_0xa3ee('0x1be'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xba')][_0xa3ee('0x10b')](db[_0xa3ee('0xbc')],{'as':'Descriptions','foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xba')][_0xa3ee('0x10b')](db[_0xa3ee('0xbc')],{'as':_0xa3ee('0x1b2'),'foreignKey':'FieldId'});db[_0xa3ee('0xba')]['belongsTo'](db[_0xa3ee('0xb8')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1b6')});db['ServicenowField']['hasMany'](db[_0xa3ee('0xbc')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xbc')]['hasMany'](db[_0xa3ee('0xbc')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xbc')]['hasMany'](db[_0xa3ee('0xbc')],{'as':_0xa3ee('0x1ba'),'foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0xa3ee('0x1bb'),'foreignKey':'VariableId'});db[_0xa3ee('0xbe')]['hasMany'](db[_0xa3ee('0xc0')],{'as':_0xa3ee('0x1b5'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xc0')][_0xa3ee('0x10b')](db['Dynamics365Field'],{'as':_0xa3ee('0x1be'),'onDelete':'cascade','foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xc0')]['hasMany'](db['Dynamics365Field'],{'as':_0xa3ee('0x1c2'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xc0')][_0xa3ee('0x10b')](db[_0xa3ee('0xc2')],{'as':'Fields','onDelete':_0xa3ee('0x10f'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xa3ee('0x11c')](db[_0xa3ee('0xbe')],{'as':'Account','foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xc2')][_0xa3ee('0x10b')](db[_0xa3ee('0xc2')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xc2')][_0xa3ee('0x10b')](db['Dynamics365Field'],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xc2')][_0xa3ee('0x10b')](db[_0xa3ee('0xc2')],{'as':_0xa3ee('0x1ba'),'foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0xc2')]['belongsTo'](db[_0xa3ee('0x1bb')],{'as':_0xa3ee('0x1bb'),'foreignKey':_0xa3ee('0x1bc')});db['FreshsalesAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x1c7')],{'as':_0xa3ee('0x1b5'),'onDelete':_0xa3ee('0x10f'),'foreignKey':'AccountId'});db[_0xa3ee('0x1c7')][_0xa3ee('0x10b')](db[_0xa3ee('0xc7')],{'as':_0xa3ee('0x1be'),'foreignKey':'SubjectId'});db[_0xa3ee('0x1c7')]['hasMany'](db['FreshsalesField'],{'as':_0xa3ee('0x1c2'),'foreignKey':_0xa3ee('0x1b9')});db['FreshsalesConfiguration'][_0xa3ee('0x10b')](db[_0xa3ee('0xc7')],{'as':'Fields','foreignKey':_0xa3ee('0x1b8')});db[_0xa3ee('0x1c7')][_0xa3ee('0x11c')](db[_0xa3ee('0xc4')],{'as':'Account','foreignKey':_0xa3ee('0x1b6')});db[_0xa3ee('0xc7')][_0xa3ee('0x10b')](db[_0xa3ee('0xc7')],{'as':_0xa3ee('0x1bf'),'foreignKey':_0xa3ee('0x1b7')});db[_0xa3ee('0xc7')]['hasMany'](db[_0xa3ee('0xc7')],{'as':_0xa3ee('0x1c0'),'foreignKey':_0xa3ee('0x1b9')});db[_0xa3ee('0xc7')][_0xa3ee('0x10b')](db[_0xa3ee('0xc7')],{'as':_0xa3ee('0x1ba'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xa3ee('0x11c')](db['Variable'],{'as':_0xa3ee('0x1bb'),'foreignKey':'VariableId'});db[_0xa3ee('0xc9')][_0xa3ee('0x11c')](db['ChatWebsite'],{});db[_0xa3ee('0xc9')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0xc9')][_0xa3ee('0x11c')](db['CmContact'],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0xc9')][_0xa3ee('0x11c')](db[_0xa3ee('0x116')],{});db[_0xa3ee('0xc9')][_0xa3ee('0x11c')](db[_0xa3ee('0x189')],{});db[_0xa3ee('0xc9')]['belongsTo'](db[_0xa3ee('0x108')],{});db['ChatQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x12b')],{});db[_0xa3ee('0xcb')]['belongsTo'](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1c8')});db[_0xa3ee('0xcb')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1c9')});db['JscriptySessionReport'][_0xa3ee('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xa3ee('0x10f')});db['JscriptySessionReport'][_0xa3ee('0x10b')](db[_0xa3ee('0xcd')],{'foreignKey':_0xa3ee('0x1ca'),'onDelete':_0xa3ee('0x10f')});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db[_0xa3ee('0x13d')],{});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db['CmList'],{'as':_0xa3ee('0x160'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0xd2')]['belongsTo'](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db[_0xa3ee('0x59')],{});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db['SmsMessage'],{});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db['User'],{});db[_0xa3ee('0xd2')][_0xa3ee('0x11c')](db[_0xa3ee('0x12d')],{});db[_0xa3ee('0xd5')][_0xa3ee('0x10b')](db[_0xa3ee('0xd0')],{'foreignKey':_0xa3ee('0x1cb')});db[_0xa3ee('0xd5')][_0xa3ee('0x10b')](db[_0xa3ee('0xce')],{'foreignKey':'ProjectId'});db[_0xa3ee('0xd5')]['hasMany'](db[_0xa3ee('0xcd')],{'foreignKey':_0xa3ee('0x1cb')});db[_0xa3ee('0xdb')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x143')});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':'user_has_teams'});db[_0xa3ee('0xde')]['belongsToMany'](db[_0xa3ee('0x1a')],{'through':_0xa3ee('0x152'),'as':_0xa3ee('0x1cc')});db['Team'][_0xa3ee('0x120')](db[_0xa3ee('0x3e')],{'through':_0xa3ee('0x164'),'as':_0xa3ee('0x1cd')});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db[_0xa3ee('0x53')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db[_0xa3ee('0x12d')],{'through':_0xa3ee('0x181'),'as':_0xa3ee('0x1ce')});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db[_0xa3ee('0x61')],{'through':'team_has_openchannel_queues','as':_0xa3ee('0x12e')});db[_0xa3ee('0xde')][_0xa3ee('0x120')](db[_0xa3ee('0x104')],{'through':_0xa3ee('0x1cf'),'as':_0xa3ee('0x130')});db['Campaign'][_0xa3ee('0x10b')](db[_0xa3ee('0x6f')],{'as':_0xa3ee('0x14a'),'foreignKey':_0xa3ee('0x197')});db[_0xa3ee('0xe2')][_0xa3ee('0x10b')](db['CmHopperFinal'],{'as':_0xa3ee('0x111'),'foreignKey':_0xa3ee('0x197')});db[_0xa3ee('0xe2')][_0xa3ee('0x10b')](db['CmHopperHistory'],{'as':_0xa3ee('0x14c'),'foreignKey':'CampaignId'});db[_0xa3ee('0xe2')]['hasMany'](db[_0xa3ee('0x71')],{'as':_0xa3ee('0x1d0'),'foreignKey':_0xa3ee('0x197')});db[_0xa3ee('0xe2')]['belongsTo'](db[_0xa3ee('0x2a')],{'as':_0xa3ee('0x2a'),'foreignKey':_0xa3ee('0x14e')});db[_0xa3ee('0xe2')][_0xa3ee('0x11c')](db[_0xa3ee('0x2a')],{'as':'TrunkBackup','foreignKey':_0xa3ee('0x14f')});db[_0xa3ee('0xe2')]['belongsTo'](db[_0xa3ee('0x80')],{'as':_0xa3ee('0x80'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0xe2')]['belongsTo'](db['SquareProject'],{'as':_0xa3ee('0xdb'),'foreignKey':'SquareProjectId'});db[_0xa3ee('0xe2')][_0xa3ee('0x120')](db['CmList'],{'as':_0xa3ee('0x121'),'through':_0xa3ee('0x1d1')});db[_0xa3ee('0xe2')][_0xa3ee('0x120')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x1d2'),'through':_0xa3ee('0x1d3')});db[_0xa3ee('0xea')][_0xa3ee('0x11c')](db[_0xa3ee('0x43')],{});db['MailTransferReport']['belongsTo'](db[_0xa3ee('0x41')],{});db[_0xa3ee('0xea')][_0xa3ee('0x11c')](db[_0xa3ee('0x3d')],{'foreignKey':_0xa3ee('0x1d4'),'as':_0xa3ee('0x1d5')});db[_0xa3ee('0xea')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d6'),'as':_0xa3ee('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d8'),'as':_0xa3ee('0x1d9')});db[_0xa3ee('0xea')]['belongsTo'](db['MailQueue'],{'foreignKey':_0xa3ee('0x1da'),'as':_0xa3ee('0x1db')});db[_0xa3ee('0xea')][_0xa3ee('0x11c')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db['ChatTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x189')],{});db[_0xa3ee('0xec')][_0xa3ee('0x11c')](db[_0xa3ee('0x116')],{});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xa3ee('0x1dc'),'as':_0xa3ee('0x1d5')});db['ChatTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d6'),'as':'FromAgent'});db[_0xa3ee('0xec')]['belongsTo'](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d8'),'as':_0xa3ee('0x1d9')});db[_0xa3ee('0xec')][_0xa3ee('0x11c')](db[_0xa3ee('0x12b')],{'foreignKey':_0xa3ee('0x1dd'),'as':_0xa3ee('0x1db')});db[_0xa3ee('0xec')][_0xa3ee('0x11c')](db[_0xa3ee('0x62')],{'foreignKey':_0xa3ee('0x1de'),'as':_0xa3ee('0x1df')});db[_0xa3ee('0x1e0')]['belongsTo'](db[_0xa3ee('0x51')],{});db[_0xa3ee('0x1e0')][_0xa3ee('0x11c')](db[_0xa3ee('0x4f')],{});db['FaxTransferReport'][_0xa3ee('0x11c')](db['FaxAccount'],{'foreignKey':_0xa3ee('0x1e1'),'as':_0xa3ee('0x1d5')});db[_0xa3ee('0x1e0')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d6'),'as':_0xa3ee('0x1d7')});db[_0xa3ee('0x1e0')][_0xa3ee('0x11c')](db['User'],{'foreignKey':_0xa3ee('0x1d8'),'as':'ToAgent'});db['FaxTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x53')],{'foreignKey':_0xa3ee('0x1e2'),'as':_0xa3ee('0x1db')});db['FaxTransferReport']['belongsTo'](db[_0xa3ee('0x136')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0xa3ee('0xed')][_0xa3ee('0x11c')](db[_0xa3ee('0x186')],{});db[_0xa3ee('0xed')][_0xa3ee('0x11c')](db[_0xa3ee('0x5f')],{});db[_0xa3ee('0xed')]['belongsTo'](db[_0xa3ee('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa3ee('0x1d5')});db[_0xa3ee('0xed')][_0xa3ee('0x11c')](db['User'],{'foreignKey':_0xa3ee('0x1d6'),'as':_0xa3ee('0x1d7')});db[_0xa3ee('0xed')]['belongsTo'](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d8'),'as':'ToAgent'});db[_0xa3ee('0xed')][_0xa3ee('0x11c')](db[_0xa3ee('0x61')],{'foreignKey':_0xa3ee('0x1e3'),'as':_0xa3ee('0x1db')});db[_0xa3ee('0xed')][_0xa3ee('0x11c')](db['OpenchannelAccount'],{'foreignKey':_0xa3ee('0x1e4'),'as':_0xa3ee('0x1df')});db[_0xa3ee('0xef')][_0xa3ee('0x11c')](db['SmsMessage'],{});db['SmsTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x59')],{});db[_0xa3ee('0xef')][_0xa3ee('0x11c')](db[_0xa3ee('0x13d')],{'foreignKey':'FromSmsAccountId','as':_0xa3ee('0x1d5')});db[_0xa3ee('0xef')]['belongsTo'](db[_0xa3ee('0x108')],{'foreignKey':'FromUserId','as':_0xa3ee('0x1d7')});db[_0xa3ee('0xef')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':'ToUserId','as':_0xa3ee('0x1d9')});db[_0xa3ee('0xef')][_0xa3ee('0x11c')](db['SmsQueue'],{'foreignKey':_0xa3ee('0x1e5'),'as':_0xa3ee('0x1db')});db['SmsTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x13d')],{'foreignKey':_0xa3ee('0x1e6'),'as':_0xa3ee('0x1df')});db[_0xa3ee('0xf1')][_0xa3ee('0x10b')](db[_0xa3ee('0x7c')],{'as':'Dispositions','foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0xf1')][_0xa3ee('0x10b')](db['CmCustomField'],{'as':_0xa3ee('0x1e7'),'foreignKey':'ListId'});db['CmList'][_0xa3ee('0x10b')](db[_0xa3ee('0x6d')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0xa3ee('0xf1')]['hasMany'](db[_0xa3ee('0x110')],{'as':_0xa3ee('0x111'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0xf1')][_0xa3ee('0x10b')](db[_0xa3ee('0x112')],{'as':_0xa3ee('0x113'),'foreignKey':_0xa3ee('0x161')});db['CmList'][_0xa3ee('0x10b')](db['ReportAgentPreview'],{'as':_0xa3ee('0x114'),'foreignKey':_0xa3ee('0x161')});db[_0xa3ee('0xf1')][_0xa3ee('0x120')](db['VoiceQueue'],{'as':_0xa3ee('0x1e8'),'through':'voice_queues_has_cm_lists'});db[_0xa3ee('0xf1')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0xa3ee('0x10b')](db[_0xa3ee('0x144')],{'as':'Extensions','onDelete':_0xa3ee('0x10f')});db['VoicePrefix']['belongsToMany'](db['User'],{'as':'Agents','through':_0xa3ee('0x133')});db[_0xa3ee('0xf5')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xa3ee('0x1e9')});db[_0xa3ee('0xf5')]['hasMany'](db[_0xa3ee('0x1ea')],{'as':_0xa3ee('0x1eb'),'foreignKey':_0xa3ee('0x1e9'),'onDelete':'cascade'});db[_0xa3ee('0x1ea')][_0xa3ee('0x10b')](db['UserProfileResource'],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x7c')],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xa3ee('0x10b')](db[_0xa3ee('0x15f')],{'as':_0xa3ee('0x172'),'foreignKey':_0xa3ee('0x1ec')});db['WhatsappAccount']['hasMany'](db[_0xa3ee('0x100')],{'as':_0xa3ee('0x154'),'foreignKey':'WhatsappAccountId'});db[_0xa3ee('0xfb')][_0xa3ee('0x10b')](db[_0xa3ee('0xfe')],{'as':'Interactions'});db[_0xa3ee('0xfb')]['hasMany'](db[_0xa3ee('0x1ed')],{'as':_0xa3ee('0x145')});db[_0xa3ee('0xfb')]['belongsTo'](db[_0xa3ee('0xf1')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0xa3ee('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0xa3ee('0x163')});db['WhatsappAccount'][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x150'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xa3ee('0x11c')](db['User'],{'onDelete':_0xa3ee('0x16d')});db['WhatsappApplication'][_0xa3ee('0x11c')](db[_0xa3ee('0x104')],{'onDelete':'restrict'});db[_0xa3ee('0x1ed')][_0xa3ee('0x11c')](db[_0xa3ee('0xfb')],{'onDelete':_0xa3ee('0x16d')});db[_0xa3ee('0x1ed')][_0xa3ee('0x11c')](db['Interval'],{'onDelete':_0xa3ee('0x16d'),'foreignKey':_0xa3ee('0x16e')});db[_0xa3ee('0x1ed')][_0xa3ee('0x11c')](db[_0xa3ee('0x87')],{'onDelete':'restrict','foreignKey':_0xa3ee('0x16f')});db[_0xa3ee('0xfe')][_0xa3ee('0x10b')](db['WhatsappMessage'],{'as':_0xa3ee('0x154'),'onDelete':_0xa3ee('0x10f'),'foreignKey':_0xa3ee('0x1ee')});db[_0xa3ee('0xfe')][_0xa3ee('0x11c')](db[_0xa3ee('0xfb')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xa3ee('0xfe')][_0xa3ee('0x11c')](db[_0xa3ee('0x6d')],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db['WhatsappInteraction'][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x167'),'foreignKey':_0xa3ee('0x10a')});db['WhatsappInteraction'][_0xa3ee('0x120')](db['Tag'],{'through':_0xa3ee('0x1a9'),'as':_0xa3ee('0x168')});db[_0xa3ee('0xfe')][_0xa3ee('0x120')](db[_0xa3ee('0x87')],{'through':'whatsapp_interaction_has_tags','as':_0xa3ee('0x16a')});db[_0xa3ee('0xfe')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x175'),'through':_0xa3ee('0x129'),'foreignKey':_0xa3ee('0x1ee')});db[_0xa3ee('0x100')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'as':_0xa3ee('0x108')});db[_0xa3ee('0x100')]['belongsTo'](db[_0xa3ee('0x6d')],{'onDelete':_0xa3ee('0x10f'),'as':_0xa3ee('0x15a')});db[_0xa3ee('0x100')][_0xa3ee('0x11c')](db[_0xa3ee('0xfe')],{'onDelete':_0xa3ee('0x10f'),'as':'Interaction','foreignKey':_0xa3ee('0x1ee')});db[_0xa3ee('0x100')][_0xa3ee('0x11c')](db[_0xa3ee('0xfb')],{'as':_0xa3ee('0x166'),'foreignKey':_0xa3ee('0x1ec')});db[_0xa3ee('0x1ef')]['belongsTo'](db[_0xa3ee('0xfb')],{});db[_0xa3ee('0x1ef')][_0xa3ee('0x11c')](db[_0xa3ee('0xf1')],{'as':_0xa3ee('0x160'),'foreignKey':'ListId'});db[_0xa3ee('0x1ef')][_0xa3ee('0x11c')](db['CmContact'],{'as':_0xa3ee('0x15a'),'foreignKey':_0xa3ee('0x15b')});db[_0xa3ee('0x1ef')][_0xa3ee('0x11c')](db[_0xa3ee('0xfe')],{});db[_0xa3ee('0x1ef')][_0xa3ee('0x11c')](db[_0xa3ee('0x104')],{});db['WhatsappQueueReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x100')],{});db['WhatsappQueueReport'][_0xa3ee('0x11c')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0xa3ee('0x100')],{});db[_0xa3ee('0x102')][_0xa3ee('0x11c')](db[_0xa3ee('0xfe')],{});db['WhatsappTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0xfb')],{'foreignKey':'FromWhatsappAccountId','as':_0xa3ee('0x1d5')});db[_0xa3ee('0x102')]['belongsTo'](db[_0xa3ee('0xfb')],{'foreignKey':_0xa3ee('0x1f0'),'as':'ToAccount'});db[_0xa3ee('0x102')][_0xa3ee('0x11c')](db[_0xa3ee('0x104')],{'foreignKey':_0xa3ee('0x1f1'),'as':_0xa3ee('0x1db')});db[_0xa3ee('0x102')][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':_0xa3ee('0x1d6'),'as':_0xa3ee('0x1d7')});db['WhatsappTransferReport'][_0xa3ee('0x11c')](db[_0xa3ee('0x108')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xa3ee('0x104')][_0xa3ee('0x120')](db[_0xa3ee('0x108')],{'as':'Agents','through':_0xa3ee('0x37'),'foreignKey':_0xa3ee('0x1f2')});db[_0xa3ee('0x104')][_0xa3ee('0x120')](db[_0xa3ee('0xde')],{'through':_0xa3ee('0x1cf'),'as':'Teams'});module[_0xa3ee('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x84e7=['SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','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','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','VoiceMail','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','Notifications','SenderId','belongsTo','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','MailQueue','ChatQueues','UserChatQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','UserVoiceQueue','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailAccount','Imap','Smtp','Dispositions','MailAccountId','Answers','Interactions','List','ListId','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','Account','MailApplication','restrict','TagId','Items','FaxAccountId','FaxApplication','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','CompanyId','Hoppers','HopperHistories','OpenchannelInteractions','cm_contact_has_tags','Queue','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticDefaultReport','DefaultReportId','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','FieldId','Subject','DescriptionId','Field','VariableId','SugarcrmAccount','SugarcrmField','Subjects','SubjectId','Description','Descriptions','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','Dynamics365Account','FreshsalesField','FromId','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','MailQueues','SmsQueues','WhatsappQueue','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','mysql','name','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../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','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x84e7,0x122));var _0x784e=function(_0x3e7d8c,_0x5f5af2){_0x3e7d8c=_0x3e7d8c-0x0;var _0x54e5a6=_0x84e7[_0x3e7d8c];return _0x54e5a6;};'use strict';var path=require('path');var config=require(_0x784e('0x0'));var Sequelize=require(_0x784e('0x1'));var _=require('lodash');var jstz=require(_0x784e('0x2'));var timezone=jstz[_0x784e('0x3')]();config['sequelize']=_[_0x784e('0x4')](config[_0x784e('0x1')],{'database':_0x784e('0x5'),'username':_0x784e('0x6'),'password':_0x784e('0x7'),'options':{'host':_0x784e('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x784e('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x784e('0xa'),'collate':_0x784e('0xb')}}});config['sequelizeHistory']=_[_0x784e('0x4')](config[_0x784e('0xc')],{'database':_0x784e('0x5'),'username':_0x784e('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x784e('0xd'),'dialectOptions':{'charset':_0x784e('0x9')},'logging':![],'timezone':timezone[_0x784e('0xe')](),'define':{'charset':_0x784e('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x784e('0x1')][_0x784e('0xf')],config[_0x784e('0x1')][_0x784e('0x10')],config[_0x784e('0x1')][_0x784e('0x11')],config['sequelize'][_0x784e('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x784e('0xf')],config[_0x784e('0xc')][_0x784e('0x10')],config[_0x784e('0xc')][_0x784e('0x11')],config[_0x784e('0xc')][_0x784e('0x12')])};db[_0x784e('0x13')]=db[_0x784e('0x1')]['import']('../api/user/user.model');db[_0x784e('0x14')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x16'));db[_0x784e('0x17')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/voiceContext/voiceContext.model');db[_0x784e('0x18')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x19'));db[_0x784e('0x1a')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x784e('0x1')]['import'](_0x784e('0x1b'));db[_0x784e('0x1c')]=db['sequelize']['import'](_0x784e('0x1d'));db[_0x784e('0x1e')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize'][_0x784e('0x15')](_0x784e('0x1f'));db['VoiceMailMessage']=db[_0x784e('0x1')]['import'](_0x784e('0x20'));db['VoiceCallReport']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x21'));db[_0x784e('0x22')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x23'));db[_0x784e('0x24')]=db[_0x784e('0x1')]['import'](_0x784e('0x25'));db[_0x784e('0x26')]=db['sequelize']['import'](_0x784e('0x27'));db[_0x784e('0x28')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x29'));db[_0x784e('0x2a')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x2b'));db[_0x784e('0x2c')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x2d'));db[_0x784e('0x2e')]=db[_0x784e('0x1')]['import'](_0x784e('0x2f'));db['UserVoiceQueue']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x30'));db['UserChatQueue']=db[_0x784e('0x1')]['import'](_0x784e('0x31'));db[_0x784e('0x32')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x33'));db['UserFaxQueue']=db['sequelize'][_0x784e('0x15')](_0x784e('0x34'));db[_0x784e('0x35')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0x784e('0x36')]=db[_0x784e('0x1')]['import'](_0x784e('0x37'));db['UserWhatsappQueue']=db['sequelize']['import'](_0x784e('0x38'));db[_0x784e('0x39')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x3a'));db[_0x784e('0x3b')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x3c'));db['MailAccount']=db['sequelize'][_0x784e('0x15')](_0x784e('0x3d'));db['MailQueue']=db['sequelize']['import'](_0x784e('0x3e'));db[_0x784e('0x3f')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x40'));db[_0x784e('0x41')]=db['sequelize'][_0x784e('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x784e('0x42')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x43'));db['MailApplication']=db['sequelize'][_0x784e('0x15')](_0x784e('0x44'));db[_0x784e('0x45')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x46'));db[_0x784e('0x47')]=db[_0x784e('0x1')]['import'](_0x784e('0x48'));db[_0x784e('0x49')]=db['sequelize']['import'](_0x784e('0x4a'));db[_0x784e('0x4b')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x4c'));db['FaxApplication']=db['sequelize']['import'](_0x784e('0x4d'));db[_0x784e('0x4e')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x4f'));db['FaxMessage']=db['sequelize']['import'](_0x784e('0x50'));db[_0x784e('0x51')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x52'));db['FaxQueueReport']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x53'));db[_0x784e('0x54')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x55'));db[_0x784e('0x56')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x57'));db['SmsInteraction']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x58'));db[_0x784e('0x59')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x5a'));db[_0x784e('0x5b')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/smsQueue/smsQueue.model');db[_0x784e('0x5c')]=db[_0x784e('0x1')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x784e('0x5d')]=db['sequelize'][_0x784e('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x784e('0x5e')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x5f'));db['OpenchannelMessage']=db['sequelize'][_0x784e('0x15')](_0x784e('0x60'));db[_0x784e('0x61')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x784e('0x1')][_0x784e('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0x784e('0x62')]=db[_0x784e('0x1')]['import'](_0x784e('0x63'));db[_0x784e('0x64')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x784e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x784e('0x65')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x66'));db[_0x784e('0x67')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x784e('0x68')]=db[_0x784e('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x69'));db[_0x784e('0x6a')]=db[_0x784e('0x1')]['import'](_0x784e('0x6b'));db[_0x784e('0x6c')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/cmCompany/cmCompany.model');db[_0x784e('0x6d')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x6e'));db[_0x784e('0x6f')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x70'));db['CmHopperBlack']=db[_0x784e('0x1')]['import'](_0x784e('0x71'));db[_0x784e('0x72')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x73'));db[_0x784e('0x74')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x75'));db[_0x784e('0x76')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x77'));db[_0x784e('0x78')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x79'));db[_0x784e('0x7a')]=db['sequelize'][_0x784e('0x15')]('../api/action/action.model');db[_0x784e('0x7b')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x7c'));db[_0x784e('0x7d')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0x784e('0x7e')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/disposition/disposition.model');db['Condition']=db[_0x784e('0x1')][_0x784e('0x15')]('../api/condition/condition.model');db['Interval']=db['sequelize'][_0x784e('0x15')](_0x784e('0x7f'));db[_0x784e('0x80')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/pause/pause.model');db[_0x784e('0x81')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x82'));db[_0x784e('0x83')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x84'));db['Schedule']=db['sequelize'][_0x784e('0x15')](_0x784e('0x85'));db['Sound']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x86'));db[_0x784e('0x87')]=db['sequelize'][_0x784e('0x15')](_0x784e('0x88'));db[_0x784e('0x89')]=db[_0x784e('0x1')]['import']('../api/template/template.model');db['Trigger']=db[_0x784e('0x1')]['import']('../api/trigger/trigger.model');db[_0x784e('0x8a')]=db['sequelize']['import'](_0x784e('0x8b'));db[_0x784e('0x8c')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x784e('0x8d')]=db[_0x784e('0x1')]['import'](_0x784e('0x8e'));db[_0x784e('0x8f')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x90'));db['AnalyticDefaultReport']=db[_0x784e('0x1')][_0x784e('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x784e('0x91')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x92'));db['AnalyticMetric']=db[_0x784e('0x1')]['import'](_0x784e('0x93'));db[_0x784e('0x94')]=db[_0x784e('0x1')]['import'](_0x784e('0x95'));db[_0x784e('0x96')]=db[_0x784e('0x1')]['import'](_0x784e('0x97'));db[_0x784e('0x98')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x99'));db['SalesforceConfiguration']=db[_0x784e('0x1')][_0x784e('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x9a'));db['SugarcrmAccount']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x9b'));db[_0x784e('0x9c')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x9d'));db['SugarcrmField']=db['sequelize'][_0x784e('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x784e('0x9e')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x784e('0x9f')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xa0'));db[_0x784e('0xa1')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xa2'));db[_0x784e('0xa3')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xa4'));db[_0x784e('0xa5')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xa6'));db[_0x784e('0xa7')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xa8'));db[_0x784e('0xa9')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xaa'));db[_0x784e('0xab')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xac'));db['ZendeskField']=db[_0x784e('0x1')]['import'](_0x784e('0xad'));db['FreshdeskAccount']=db['sequelize']['import'](_0x784e('0xae'));db[_0x784e('0xaf')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xb0'));db[_0x784e('0xb1')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xb2'));db[_0x784e('0xb3')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xb4'));db[_0x784e('0xb5')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xb6'));db[_0x784e('0xb7')]=db['sequelize']['import'](_0x784e('0xb8'));db[_0x784e('0xb9')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xba'));db[_0x784e('0xbb')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xbc'));db[_0x784e('0xbd')]=db['sequelize'][_0x784e('0x15')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xbe'));db[_0x784e('0xbf')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xc0'));db[_0x784e('0xc1')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xc2'));db[_0x784e('0xc3')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xc4'));db[_0x784e('0xc5')]=db[_0x784e('0x1')]['import'](_0x784e('0xc6'));db['FreshsalesField']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xc7'));db[_0x784e('0x8c')]=db[_0x784e('0x1')]['import']('../api/integration/integration.model');db[_0x784e('0xc8')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xc9'));db[_0x784e('0xca')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x784e('0xcb')]=db['sequelize'][_0x784e('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x784e('0xcc')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xcd'));db[_0x784e('0xce')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x784e('0xcf')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xd0'));db[_0x784e('0xd1')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xd2'));db[_0x784e('0xd3')]=db['sequelize'][_0x784e('0x15')]('../api/squareReport/squareReport.model');db[_0x784e('0xd4')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xd5'));db[_0x784e('0xd6')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xd7'));db['Setting']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xd8'));db[_0x784e('0xd9')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xda'));db[_0x784e('0xdb')]=db[_0x784e('0x1')]['import'](_0x784e('0xdc'));db['SquareRecording']=db[_0x784e('0x1')][_0x784e('0x15')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0x784e('0x1')]['import'](_0x784e('0xdd'));db[_0x784e('0xde')]=db[_0x784e('0x1')]['import'](_0x784e('0xdf'));db[_0x784e('0xe0')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xe1'));db[_0x784e('0xe2')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/campaign/campaign.model');db['Migration']=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xe3'));db[_0x784e('0xe4')]=db['sequelize'][_0x784e('0x15')]('../api/attachment/attachment.model');db[_0x784e('0xe5')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/plugin/plugin.model');db[_0x784e('0xe6')]=db['sequelize'][_0x784e('0x15')](_0x784e('0xe7'));db[_0x784e('0xe8')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xe9'));db[_0x784e('0xea')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xeb'));db[_0x784e('0xec')]=db[_0x784e('0x1')]['import'](_0x784e('0xed'));db[_0x784e('0xee')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xef'));db[_0x784e('0xf0')]=db[_0x784e('0x1')]['import'](_0x784e('0xf1'));db[_0x784e('0xf2')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x784e('0xf3')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xf4'));db[_0x784e('0xf5')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xf6'));db[_0x784e('0xf7')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x784e('0xf8')]=db['sequelize'][_0x784e('0x15')]('../api/notification/notification.model');db[_0x784e('0xf9')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xfa'));db['WhatsappApplication']=db[_0x784e('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x784e('0xfb')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x784e('0xfc')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0xfd'));db[_0x784e('0xfe')]=db['sequelize']['import'](_0x784e('0xff'));db[_0x784e('0x100')]=db[_0x784e('0x1')][_0x784e('0x15')](_0x784e('0x101'));db['WhatsappQueue']=db[_0x784e('0x1')]['import'](_0x784e('0x102'));db[_0x784e('0x103')]=db[_0x784e('0x1')][_0x784e('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0x784e('0x13')][_0x784e('0x104')](db['VoiceMail'],{'as':_0x784e('0x105'),'onDelete':'cascade','foreignKey':_0x784e('0x106')});db[_0x784e('0x13')]['hasMany'](db[_0x784e('0x1c')],{'as':_0x784e('0x107'),'foreignKey':'UserId'});db[_0x784e('0x13')][_0x784e('0x108')](db['UserVoiceQueueRt'],{'as':_0x784e('0x109'),'foreignKey':_0x784e('0x106')});db['User'][_0x784e('0x108')](db['VoiceExtension'],{'as':_0x784e('0x10a'),'onDelete':_0x784e('0x10b'),'hooks':!![]});db[_0x784e('0x13')][_0x784e('0x108')](db['CmHopperFinal'],{'as':_0x784e('0x10c'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0x74')],{'as':_0x784e('0x10d'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0x76')],{'as':_0x784e('0x76'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db['ChatInteraction'],{'as':_0x784e('0x10e'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0x10f')],{'as':_0x784e('0x110'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0x4e')],{'as':_0x784e('0x111'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db['MailInteraction'],{'as':_0x784e('0x112'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x13')][_0x784e('0x108')](db[_0x784e('0xfb')],{'as':'WhatsappInteractions','foreignKey':_0x784e('0x106')});db[_0x784e('0x13')]['hasMany'](db['Notification'],{'as':_0x784e('0x113'),'foreignKey':_0x784e('0x114')});db['User'][_0x784e('0x115')](db[_0x784e('0xf3')],{'as':_0x784e('0xf3'),'foreignKey':'userProfileId'});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x117')],{'as':'Groups','through':_0x784e('0x118')});db['User'][_0x784e('0x116')](db[_0x784e('0x6d')],{'as':_0x784e('0x119'),'through':_0x784e('0x11a')});db[_0x784e('0x13')]['belongsToMany'](db[_0x784e('0xf0')],{'as':_0x784e('0x11b'),'through':'cm_user_has_lists'});db['User'][_0x784e('0x116')](db[_0x784e('0xde')],{'through':_0x784e('0x11c')});db[_0x784e('0x13')]['belongsToMany'](db[_0x784e('0x41')],{'as':'MailInteractions','through':_0x784e('0x11d')});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x11e')],{'as':_0x784e('0x10e'),'through':_0x784e('0x11f')});db['User'][_0x784e('0x116')](db[_0x784e('0x4e')],{'as':_0x784e('0x111'),'through':'user_has_fax_interactions'});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x10f')],{'as':'SmsInteractions','through':_0x784e('0x120')});db['User'][_0x784e('0x116')](db[_0x784e('0x5e')],{'as':'OpenchannelInteractions','through':_0x784e('0x121')});db[_0x784e('0x13')][_0x784e('0x116')](db['WhatsappInteraction'],{'as':_0x784e('0x122'),'through':_0x784e('0x123')});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x124')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x125')],{'as':'MailQueues','through':_0x784e('0x32'),'required':![]});db[_0x784e('0x13')]['belongsToMany'](db[_0x784e('0x68')],{'as':_0x784e('0x126'),'through':_0x784e('0x127'),'required':![],'hooks':!![]});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x51')],{'as':_0x784e('0x128'),'through':'UserFaxQueue','required':![]});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x5b')],{'as':'SmsQueues','through':_0x784e('0x35'),'required':![]});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x61')],{'as':_0x784e('0x129'),'through':_0x784e('0x36'),'required':![]});db['User'][_0x784e('0x116')](db['WhatsappQueue'],{'as':_0x784e('0x12a'),'through':_0x784e('0x12b'),'required':![]});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0xf0')],{'through':_0x784e('0x12c')});db[_0x784e('0x13')][_0x784e('0x116')](db['VoicePrefix'],{'as':_0x784e('0x12d'),'through':_0x784e('0x12e'),'required':![]});db['User'][_0x784e('0x116')](db[_0x784e('0x12f')],{'as':_0x784e('0x130'),'through':_0x784e('0x131')});db['User'][_0x784e('0x116')](db['FaxAccount'],{'as':_0x784e('0x132'),'through':'user_has_fax_accounts'});db[_0x784e('0x13')]['belongsToMany'](db['MailAccount'],{'as':_0x784e('0x133'),'through':_0x784e('0x134')});db[_0x784e('0x13')][_0x784e('0x116')](db[_0x784e('0x5c')],{'as':'OpenchannelAccounts','through':_0x784e('0x135')});db[_0x784e('0x13')]['belongsToMany'](db['SmsAccount'],{'as':_0x784e('0x136'),'through':'user_has_sms_accounts'});db['User'][_0x784e('0x116')](db[_0x784e('0xf9')],{'as':_0x784e('0x137'),'through':'user_has_whatsapp_accounts'});db[_0x784e('0x13')]['belongsToMany'](db[_0x784e('0xdb')],{'as':_0x784e('0x138'),'through':_0x784e('0x139')});db[_0x784e('0x14')]['hasMany'](db[_0x784e('0x18')],{'as':_0x784e('0x13a'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x13b')});db[_0x784e('0x17')]['hasMany'](db[_0x784e('0x18')],{'onDelete':_0x784e('0x10b')});db[_0x784e('0x18')]['hasMany'](db[_0x784e('0x18')],{'as':_0x784e('0x13c'),'onDelete':_0x784e('0x10b')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x784e('0x13d')],{'as':_0x784e('0x13e'),'through':_0x784e('0x13f')});db[_0x784e('0x124')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x784e('0x124')][_0x784e('0x108')](db[_0x784e('0x6f')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x784e('0x124')][_0x784e('0x108')](db[_0x784e('0x72')],{'as':'HopperFinals','foreignKey':_0x784e('0x140')});db[_0x784e('0x124')][_0x784e('0x108')](db[_0x784e('0x74')],{'as':'HopperHistories','foreignKey':_0x784e('0x140')});db[_0x784e('0x124')][_0x784e('0x108')](db['ReportAgentPreview'],{'as':_0x784e('0x76'),'foreignKey':_0x784e('0x140')});db[_0x784e('0x124')][_0x784e('0x108')](db[_0x784e('0x141')],{'as':_0x784e('0x142'),'foreignKey':_0x784e('0x140')});db[_0x784e('0x124')][_0x784e('0x108')](db[_0x784e('0xcf')],{'as':_0x784e('0x143'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x784e('0x115')](db[_0x784e('0x2a')],{'as':'Trunk','foreignKey':_0x784e('0x144')});db[_0x784e('0x124')][_0x784e('0x115')](db[_0x784e('0x2a')],{'as':_0x784e('0x145'),'foreignKey':_0x784e('0x146')});db['VoiceQueue'][_0x784e('0x115')](db[_0x784e('0x147')],{'as':_0x784e('0x147'),'foreignKey':_0x784e('0x148')});db['VoiceQueue']['belongsTo'](db[_0x784e('0x80')],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db[_0x784e('0x124')]['belongsToMany'](db[_0x784e('0xf0')],{'as':_0x784e('0x11b'),'through':_0x784e('0x14b')});db[_0x784e('0x124')][_0x784e('0x116')](db['User'],{'as':_0x784e('0x14c'),'through':_0x784e('0x14d')});db[_0x784e('0x124')][_0x784e('0x116')](db[_0x784e('0xde')],{'as':_0x784e('0x14e'),'through':_0x784e('0x14f')});db[_0x784e('0x124')][_0x784e('0x116')](db[_0x784e('0xf0')],{'as':_0x784e('0x150'),'through':_0x784e('0x151')});db[_0x784e('0x1c')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x13'),'foreignKey':_0x784e('0x106')});db['VoiceMail'][_0x784e('0x108')](db[_0x784e('0x152')],{'as':_0x784e('0x153'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x154'),'sourceKey':_0x784e('0x155')});db[_0x784e('0x152')][_0x784e('0x115')](db[_0x784e('0x105')],{'foreignKey':_0x784e('0x154'),'targetKey':'mailbox'});db[_0x784e('0x156')][_0x784e('0x108')](db[_0x784e('0x26')],{'as':_0x784e('0x157'),'foreignKey':_0x784e('0x158'),'constraints':![]});db['VoiceCallReport'][_0x784e('0x108')](db[_0x784e('0x24')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x784e('0x156')][_0x784e('0x115')](db['User'],{'as':_0x784e('0x13'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x156')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0x39')][_0x784e('0x115')](db[_0x784e('0x15b')],{'as':_0x784e('0x15b'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x784e('0x115')](db[_0x784e('0x15b')],{'as':_0x784e('0x15b'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x784e('0x104')](db[_0x784e('0x39')],{'as':_0x784e('0x15c'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x15b')][_0x784e('0x104')](db['MailServerOut'],{'as':_0x784e('0x15d'),'onDelete':'cascade'});db[_0x784e('0x15b')][_0x784e('0x108')](db['Disposition'],{'as':_0x784e('0x15e'),'foreignKey':_0x784e('0x15f')});db['MailAccount']['hasMany'](db[_0x784e('0x7d')],{'as':_0x784e('0x160'),'foreignKey':'MailAccountId'});db[_0x784e('0x15b')][_0x784e('0x108')](db[_0x784e('0x42')],{'as':'Messages','foreignKey':_0x784e('0x15f')});db[_0x784e('0x15b')]['hasMany'](db[_0x784e('0x41')],{'as':_0x784e('0x161')});db[_0x784e('0x15b')]['hasMany'](db['MailApplication'],{'as':_0x784e('0x13c')});db[_0x784e('0x15b')][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0x15b')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x784e('0x15b')][_0x784e('0x115')](db[_0x784e('0x80')],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db['MailAccount'][_0x784e('0x116')](db['User'],{'as':_0x784e('0x14c'),'through':_0x784e('0x134')});db[_0x784e('0x125')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':'Agents','through':_0x784e('0x32')});db[_0x784e('0x125')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x784e('0x14e')});db[_0x784e('0x41')][_0x784e('0x108')](db[_0x784e('0x42')],{'as':_0x784e('0x153'),'onDelete':_0x784e('0x10b'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x784e('0x115')](db[_0x784e('0x15b')],{'as':'Account','foreignKey':_0x784e('0x15f')});db['MailInteraction'][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':'ContactId'});db[_0x784e('0x41')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x164'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x41')]['belongsToMany'](db['Tag'],{'through':_0x784e('0x165'),'as':_0x784e('0x166')});db[_0x784e('0x41')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x165'),'as':'ThroughTags'});db[_0x784e('0x41')][_0x784e('0x116')](db['User'],{'as':_0x784e('0x167'),'through':'user_has_mail_interactions','foreignKey':_0x784e('0x168')});db[_0x784e('0x42')][_0x784e('0x108')](db[_0x784e('0xe4')],{'as':_0x784e('0x169'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x42')][_0x784e('0x115')](db['User'],{'as':_0x784e('0x13')});db[_0x784e('0x42')][_0x784e('0x115')](db[_0x784e('0x6d')],{'onDelete':_0x784e('0x10b'),'as':'Contact'});db[_0x784e('0x42')]['belongsTo'](db['MailInteraction'],{'as':_0x784e('0x16a'),'foreignKey':_0x784e('0x168')});db[_0x784e('0x42')][_0x784e('0x115')](db[_0x784e('0x15b')],{'as':_0x784e('0x16b'),'foreignKey':'MailAccountId'});db[_0x784e('0x16c')][_0x784e('0x115')](db[_0x784e('0x13')],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x16c')][_0x784e('0x115')](db['MailQueue'],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x16c')]['belongsTo'](db['MailAccount'],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x16c')][_0x784e('0x115')](db[_0x784e('0x147')],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x148')});db[_0x784e('0x16c')]['belongsTo'](db['Tag'],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x16e')});db[_0x784e('0x45')][_0x784e('0x115')](db[_0x784e('0x15b')],{});db[_0x784e('0x45')][_0x784e('0x115')](db['CmList'],{'as':'List','foreignKey':_0x784e('0x163')});db[_0x784e('0x45')][_0x784e('0x115')](db['CmContact'],{'as':_0x784e('0x159'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x784e('0x115')](db[_0x784e('0x41')],{});db[_0x784e('0x45')][_0x784e('0x115')](db[_0x784e('0x42')],{});db[_0x784e('0x45')][_0x784e('0x115')](db[_0x784e('0x13')],{});db[_0x784e('0x45')][_0x784e('0x115')](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0x784e('0x49')],{'as':_0x784e('0x16f'),'onDelete':_0x784e('0x10b')});db['FaxAccount'][_0x784e('0x108')](db[_0x784e('0x7e')],{'as':'Dispositions','foreignKey':_0x784e('0x170')});db['FaxAccount'][_0x784e('0x108')](db[_0x784e('0x7d')],{'as':_0x784e('0x160'),'foreignKey':_0x784e('0x170')});db[_0x784e('0x4b')][_0x784e('0x108')](db[_0x784e('0x4e')],{'as':_0x784e('0x161')});db[_0x784e('0x4b')][_0x784e('0x108')](db[_0x784e('0x171')],{'as':_0x784e('0x13c')});db['FaxAccount'][_0x784e('0x108')](db[_0x784e('0x18')],{'as':_0x784e('0x172'),'onDelete':'cascade'});db[_0x784e('0x4b')][_0x784e('0x108')](db[_0x784e('0x173')],{'as':'Messages'});db[_0x784e('0x4b')]['belongsTo'](db['Trunk'],{'as':_0x784e('0x2a')});db[_0x784e('0x4b')][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0x4b')][_0x784e('0x115')](db[_0x784e('0x80')],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db[_0x784e('0x4b')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x174')});db[_0x784e('0x171')]['belongsTo'](db[_0x784e('0x13')],{'onDelete':_0x784e('0x16d')});db['FaxApplication'][_0x784e('0x115')](db['FaxQueue'],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x171')][_0x784e('0x115')](db[_0x784e('0x4b')],{'onDelete':'restrict'});db['FaxApplication'][_0x784e('0x115')](db[_0x784e('0x87')],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x16e')});db['FaxInteraction'][_0x784e('0x108')](db['FaxMessage'],{'as':_0x784e('0x153'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x175')});db['FaxInteraction'][_0x784e('0x115')](db['FaxAccount'],{'as':'Account','foreignKey':_0x784e('0x170')});db[_0x784e('0x4e')][_0x784e('0x115')](db['CmContact'],{'as':_0x784e('0x159'),'foreignKey':'ContactId'});db[_0x784e('0x4e')]['belongsTo'](db[_0x784e('0x13')],{'as':_0x784e('0x164'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x4e')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x176'),'as':_0x784e('0x166')});db[_0x784e('0x4e')][_0x784e('0x116')](db['Tag'],{'through':_0x784e('0x176'),'as':_0x784e('0x177')});db[_0x784e('0x4e')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':_0x784e('0x178'),'foreignKey':_0x784e('0x175')});db[_0x784e('0x173')][_0x784e('0x115')](db[_0x784e('0x13')],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x13')});db[_0x784e('0x173')][_0x784e('0x115')](db[_0x784e('0x4e')],{'as':'Interaction','foreignKey':_0x784e('0x175')});db[_0x784e('0x173')]['belongsTo'](db['CmContact'],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x159')});db['FaxMessage'][_0x784e('0x115')](db[_0x784e('0xe4')],{'as':'Attachment','foreignKey':_0x784e('0x179')});db[_0x784e('0x173')]['belongsTo'](db[_0x784e('0x4b')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x170')});db[_0x784e('0x51')]['belongsToMany'](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x784e('0xde')],{'through':_0x784e('0x17a'),'as':_0x784e('0x14e')});db[_0x784e('0x17b')][_0x784e('0x115')](db[_0x784e('0x4b')],{});db[_0x784e('0x17b')][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0x17b')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0x17b')][_0x784e('0x115')](db[_0x784e('0x4e')],{});db[_0x784e('0x17b')][_0x784e('0x115')](db['FaxMessage'],{});db[_0x784e('0x17b')][_0x784e('0x115')](db[_0x784e('0x13')],{});db['FaxQueueReport'][_0x784e('0x115')](db['FaxQueue'],{});db[_0x784e('0x54')][_0x784e('0x108')](db['Disposition'],{'as':_0x784e('0x15e'),'foreignKey':_0x784e('0x17c')});db[_0x784e('0x54')][_0x784e('0x108')](db[_0x784e('0x7d')],{'as':'Answers','foreignKey':_0x784e('0x17c')});db['SmsAccount'][_0x784e('0x108')](db[_0x784e('0x59')],{'as':'Messages','foreignKey':_0x784e('0x17c')});db[_0x784e('0x54')][_0x784e('0x108')](db[_0x784e('0x10f')],{'as':_0x784e('0x161')});db['SmsAccount']['hasMany'](db[_0x784e('0x56')],{'as':_0x784e('0x13c')});db[_0x784e('0x54')]['belongsTo'](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db['SmsAccount']['belongsTo'](db[_0x784e('0x80')],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db[_0x784e('0x54')]['belongsToMany'](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x784e('0x115')](db[_0x784e('0x13')],{'onDelete':'restrict'});db[_0x784e('0x56')][_0x784e('0x115')](db[_0x784e('0x5b')],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x56')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x56')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x784e('0x56')][_0x784e('0x115')](db[_0x784e('0x87')],{'onDelete':'restrict','foreignKey':_0x784e('0x16e')});db[_0x784e('0x10f')][_0x784e('0x108')](db['SmsMessage'],{'as':'Messages','onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x17d')});db[_0x784e('0x10f')]['belongsTo'](db[_0x784e('0x54')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x17c')});db[_0x784e('0x10f')][_0x784e('0x115')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x784e('0x10f')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x164'),'foreignKey':_0x784e('0x106')});db['SmsInteraction']['belongsToMany'](db[_0x784e('0x87')],{'through':_0x784e('0x17e'),'as':_0x784e('0x166')});db['SmsInteraction'][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x17e'),'as':_0x784e('0x177')});db[_0x784e('0x10f')]['belongsToMany'](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':_0x784e('0x120'),'foreignKey':_0x784e('0x17d')});db[_0x784e('0x59')][_0x784e('0x115')](db['User'],{'as':'User'});db[_0x784e('0x59')][_0x784e('0x115')](db['CmContact'],{'onDelete':'cascade','as':_0x784e('0x159')});db[_0x784e('0x59')][_0x784e('0x115')](db[_0x784e('0x10f')],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x16a'),'foreignKey':_0x784e('0x17d')});db[_0x784e('0x59')][_0x784e('0x115')](db[_0x784e('0x54')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x17c')});db[_0x784e('0x5b')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x35'),'foreignKey':_0x784e('0x17f')});db[_0x784e('0x5b')][_0x784e('0x116')](db[_0x784e('0xde')],{'through':'team_has_sms_queues','as':_0x784e('0x14e')});db[_0x784e('0x5c')]['hasMany'](db[_0x784e('0x7e')],{'as':_0x784e('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x784e('0x5c')][_0x784e('0x108')](db[_0x784e('0x7d')],{'as':'Answers','foreignKey':_0x784e('0x180')});db[_0x784e('0x5c')][_0x784e('0x108')](db[_0x784e('0x5e')],{'as':_0x784e('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0x784e('0x5c')][_0x784e('0x108')](db[_0x784e('0x181')],{'as':_0x784e('0x153'),'foreignKey':_0x784e('0x180')});db['OpenchannelAccount']['hasMany'](db[_0x784e('0x5d')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0x784e('0x5c')][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0x784e('0x5c')][_0x784e('0x115')](db['Pause'],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db[_0x784e('0x5c')]['belongsToMany'](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x135')});db['OpenchannelApplication']['belongsTo'](db[_0x784e('0x13')],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x5d')]['belongsTo'](db[_0x784e('0x61')],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x182')});db[_0x784e('0x5d')][_0x784e('0x115')](db['OpenchannelAccount'],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x180')});db[_0x784e('0x5d')][_0x784e('0x115')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x784e('0x148')});db[_0x784e('0x5d')][_0x784e('0x115')](db[_0x784e('0x87')],{'onDelete':_0x784e('0x16d'),'foreignKey':'TagId'});db[_0x784e('0x5e')][_0x784e('0x108')](db[_0x784e('0x181')],{'as':_0x784e('0x153'),'onDelete':_0x784e('0x10b'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x180')});db[_0x784e('0x5e')]['belongsTo'](db[_0x784e('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x784e('0x5e')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':'Owner','foreignKey':_0x784e('0x106')});db[_0x784e('0x5e')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x183'),'as':_0x784e('0x166')});db[_0x784e('0x5e')][_0x784e('0x116')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x784e('0x177')});db[_0x784e('0x5e')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':'Users','through':_0x784e('0x121'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x784e('0x115')](db['User'],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x13')});db[_0x784e('0x181')][_0x784e('0x115')](db[_0x784e('0x6d')],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x159')});db[_0x784e('0x181')][_0x784e('0x115')](db[_0x784e('0x5e')],{'onDelete':_0x784e('0x10b'),'as':'Interaction','foreignKey':_0x784e('0x184')});db[_0x784e('0x181')][_0x784e('0x115')](db['Attachment'],{'as':_0x784e('0xe4'),'foreignKey':_0x784e('0x179')});db[_0x784e('0x181')][_0x784e('0x115')](db[_0x784e('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x784e('0x61')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x784e('0x182')});db[_0x784e('0x61')][_0x784e('0x116')](db[_0x784e('0xde')],{'through':_0x784e('0x185'),'as':_0x784e('0x14e')});db[_0x784e('0x12f')][_0x784e('0x108')](db[_0x784e('0x7e')],{'as':'Dispositions','foreignKey':_0x784e('0x186')});db[_0x784e('0x12f')][_0x784e('0x108')](db[_0x784e('0x7d')],{'as':_0x784e('0x160'),'foreignKey':_0x784e('0x186')});db[_0x784e('0x12f')][_0x784e('0x108')](db[_0x784e('0x6a')],{'as':_0x784e('0x187')});db['ChatWebsite'][_0x784e('0x108')](db[_0x784e('0x11e')],{'as':'Interactions'});db[_0x784e('0x12f')][_0x784e('0x108')](db[_0x784e('0x64')],{'as':_0x784e('0x13c')});db['ChatWebsite'][_0x784e('0x108')](db[_0x784e('0x65')],{'as':_0x784e('0x153')});db[_0x784e('0x12f')][_0x784e('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x784e('0x12f')][_0x784e('0x115')](db[_0x784e('0x147')],{'as':_0x784e('0x147'),'foreignKey':'IntervalId'});db[_0x784e('0x12f')][_0x784e('0x115')](db['Pause'],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db['ChatWebsite'][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x131')});db[_0x784e('0x62')]['belongsTo'](db[_0x784e('0x5c')],{});db['OpenchannelQueueReport'][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0x62')]['belongsTo'](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db['OpenchannelQueueReport'][_0x784e('0x115')](db[_0x784e('0x5e')],{});db['OpenchannelQueueReport'][_0x784e('0x115')](db[_0x784e('0x181')],{});db['OpenchannelQueueReport'][_0x784e('0x115')](db['User'],{});db['OpenchannelQueueReport'][_0x784e('0x115')](db[_0x784e('0x61')],{});db[_0x784e('0x64')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x188'),'foreignKey':_0x784e('0x106'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x64')]['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':_0x784e('0x189'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x64')][_0x784e('0x115')](db[_0x784e('0x12f')],{'as':_0x784e('0x18a'),'foreignKey':_0x784e('0x186'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x64')][_0x784e('0x115')](db['Tag'],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x16e')});db['ChatInteraction'][_0x784e('0x108')](db[_0x784e('0x65')],{'as':_0x784e('0x153'),'onDelete':'cascade','foreignKey':_0x784e('0x18b')});db[_0x784e('0x11e')][_0x784e('0x115')](db[_0x784e('0x12f')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x186')});db[_0x784e('0x11e')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x784e('0x11e')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x164'),'foreignKey':_0x784e('0x106')});db[_0x784e('0x11e')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x18c'),'as':'Tags'});db[_0x784e('0x11e')][_0x784e('0x116')](db['Tag'],{'through':_0x784e('0x18c'),'as':_0x784e('0x177')});db[_0x784e('0x11e')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':_0x784e('0x11f'),'foreignKey':'ChatInteractionId'});db[_0x784e('0x65')][_0x784e('0x115')](db['User'],{'onDelete':'cascade','as':_0x784e('0x13')});db[_0x784e('0x65')][_0x784e('0x115')](db['CmContact'],{'onDelete':'cascade','as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db['ChatMessage'][_0x784e('0x115')](db['ChatInteraction'],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x16a'),'foreignKey':_0x784e('0x18b')});db[_0x784e('0x65')][_0x784e('0x115')](db['Attachment'],{'as':_0x784e('0xe4'),'foreignKey':_0x784e('0x179')});db[_0x784e('0x65')][_0x784e('0x115')](db[_0x784e('0x12f')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x784e('0x67')][_0x784e('0x115')](db[_0x784e('0x6d')],{'onDelete':_0x784e('0x10b'),'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0x67')][_0x784e('0x115')](db[_0x784e('0x12f')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x186')});db[_0x784e('0x68')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x784e('0x68')][_0x784e('0x116')](db[_0x784e('0xde')],{'through':_0x784e('0x18d'),'as':_0x784e('0x14e')});db[_0x784e('0x117')][_0x784e('0x108')](db[_0x784e('0xcb')],{'as':'Messages','foreignKey':_0x784e('0x18e'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x117')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x18f'),'through':'chat_group_has_users'});db[_0x784e('0x6a')][_0x784e('0x115')](db[_0x784e('0x12f')],{'as':_0x784e('0x18a'),'foreignKey':_0x784e('0x186')});db[_0x784e('0x6c')]['hasMany'](db['CmContact'],{'as':_0x784e('0x119'),'foreignKey':_0x784e('0x190')});db['CmContact'][_0x784e('0x108')](db['CmHopper'],{'as':_0x784e('0x191'),'foreignKey':'ContactId'});db['CmContact'][_0x784e('0x108')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x784e('0x15a')});db[_0x784e('0x6d')][_0x784e('0x108')](db['CmHopperHistory'],{'as':_0x784e('0x192'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0x6d')][_0x784e('0x108')](db[_0x784e('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x784e('0x15a')});db[_0x784e('0x6d')][_0x784e('0x108')](db[_0x784e('0xcf')],{'as':_0x784e('0x143'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0x6d')][_0x784e('0x108')](db[_0x784e('0x5e')],{'as':_0x784e('0x193'),'foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x6d')]['hasMany'](db[_0x784e('0x11e')],{'as':_0x784e('0x10e'),'foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x6d')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x6d')][_0x784e('0x108')](db['FaxInteraction'],{'as':_0x784e('0x111'),'foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x6d')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x6d')][_0x784e('0x115')](db['CmCompany'],{'as':'Company','foreignKey':'CompanyId'});db[_0x784e('0x6d')]['belongsTo'](db['CmList'],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x6d')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':'cm_user_has_contacts'});db[_0x784e('0x6d')][_0x784e('0x116')](db[_0x784e('0x87')],{'as':_0x784e('0x166'),'through':_0x784e('0x194')});db['CmContact'][_0x784e('0x116')](db['Tag'],{'through':_0x784e('0x194'),'as':_0x784e('0x177')});db[_0x784e('0x6f')][_0x784e('0x115')](db['CmContact'],{'as':_0x784e('0x159'),'foreignKey':'ContactId','onDelete':_0x784e('0x10b')});db['CmHopper'][_0x784e('0x115')](db['CmList'],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x6f')][_0x784e('0x115')](db['User'],{'as':'Agent','foreignKey':_0x784e('0x106')});db['CmHopper']['belongsTo'](db['VoiceQueue'],{'as':_0x784e('0x195'),'foreignKey':'VoiceQueueId','onDelete':_0x784e('0x10b')});db['CmHopper']['belongsTo'](db[_0x784e('0xe2')],{'as':_0x784e('0xe2'),'foreignKey':_0x784e('0x196'),'onDelete':'cascade'});db[_0x784e('0x6f')][_0x784e('0x115')](db['User'],{'as':_0x784e('0x164'),'foreignKey':_0x784e('0x197')});db[_0x784e('0x141')]['belongsTo'](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x141')][_0x784e('0x115')](db['CmList'],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163'),'onDelete':_0x784e('0x10b')});db[_0x784e('0x141')][_0x784e('0x115')](db['VoiceQueue'],{'as':_0x784e('0x195'),'foreignKey':'VoiceQueueId','onDelete':_0x784e('0x10b')});db[_0x784e('0x141')][_0x784e('0x115')](db[_0x784e('0xe2')],{'as':'Campaign','foreignKey':_0x784e('0x196'),'onDelete':'cascade'});db['Automation'][_0x784e('0x108')](db[_0x784e('0x198')],{'as':{'plural':_0x784e('0x199'),'singular':_0x784e('0x19a')},'foreignKey':_0x784e('0x19b'),'onDelete':_0x784e('0x10b'),'hooks':!![]});db['Automation'][_0x784e('0x108')](db['Condition'],{'as':{'plural':_0x784e('0x19c'),'singular':_0x784e('0x19d')},'foreignKey':_0x784e('0x19e'),'onDelete':_0x784e('0x10b'),'hooks':!![]});db[_0x784e('0x7b')][_0x784e('0x108')](db[_0x784e('0x7a')],{'as':_0x784e('0x19f'),'foreignKey':_0x784e('0x1a0'),'onDelete':'cascade','hooks':!![]});db[_0x784e('0x147')]['hasMany'](db[_0x784e('0x147')],{'as':_0x784e('0x1a1'),'foreignKey':_0x784e('0x148'),'onDelete':_0x784e('0x10b'),'hooks':!![],'required':![]});db[_0x784e('0x147')][_0x784e('0x108')](db[_0x784e('0x18')],{'as':_0x784e('0x10a'),'foreignKey':_0x784e('0x148'),'onDelete':_0x784e('0x16d')});db[_0x784e('0x147')][_0x784e('0x108')](db[_0x784e('0x16c')],{'as':_0x784e('0x1a2'),'foreignKey':_0x784e('0x148')});db[_0x784e('0x147')][_0x784e('0x108')](db[_0x784e('0x64')],{'as':_0x784e('0x1a3'),'foreignKey':'IntervalId'});db[_0x784e('0x147')]['hasMany'](db[_0x784e('0x171')],{'as':_0x784e('0x1a4'),'foreignKey':_0x784e('0x148')});db[_0x784e('0x147')][_0x784e('0x108')](db['SmsApplication'],{'as':_0x784e('0x1a5'),'foreignKey':'IntervalId'});db[_0x784e('0x1a6')][_0x784e('0x115')](db['MailAccount'],{});db['Schedule'][_0x784e('0x115')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x784e('0x1a6')][_0x784e('0x115')](db[_0x784e('0x8f')],{'foreignKey':_0x784e('0x1a7')});db[_0x784e('0x13d')][_0x784e('0x116')](db[_0x784e('0x1a')],{'as':_0x784e('0x1a8'),'through':_0x784e('0x13f'),'onDelete':_0x784e('0x16d')});db['Tag']['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x784e('0x87')][_0x784e('0x116')](db[_0x784e('0x11e')],{'through':_0x784e('0x18c')});db[_0x784e('0x87')]['belongsToMany'](db['MailInteraction'],{'through':_0x784e('0x165')});db[_0x784e('0x87')][_0x784e('0x116')](db[_0x784e('0x10f')],{'through':_0x784e('0x17e')});db[_0x784e('0x87')][_0x784e('0x116')](db[_0x784e('0x4e')],{'through':_0x784e('0x176')});db[_0x784e('0x87')]['belongsToMany'](db[_0x784e('0x5e')],{'through':'openchannel_interaction_has_tags'});db[_0x784e('0x87')][_0x784e('0x116')](db[_0x784e('0xfb')],{'through':_0x784e('0x1a9')});db[_0x784e('0x1aa')]['hasMany'](db['Condition'],{'as':{'plural':_0x784e('0x1ab'),'singular':_0x784e('0x1ac')},'foreignKey':_0x784e('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x784e('0x1aa')]['hasMany'](db[_0x784e('0x198')],{'as':{'plural':'AnyConditions','singular':_0x784e('0x1ae')},'foreignKey':_0x784e('0x1af'),'onDelete':_0x784e('0x10b'),'hooks':!![]});db[_0x784e('0x1aa')][_0x784e('0x108')](db[_0x784e('0x7a')],{'as':_0x784e('0x19f'),'foreignKey':_0x784e('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0x784e('0x8f')][_0x784e('0x108')](db[_0x784e('0x94')],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1a7'),'hooks':!![]});db[_0x784e('0x1b2')][_0x784e('0x108')](db[_0x784e('0x94')],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b3')});db[_0x784e('0x1b4')]['hasMany'](db[_0x784e('0x94')],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b5')});db[_0x784e('0x94')][_0x784e('0x115')](db[_0x784e('0x1b4')],{'foreignKey':_0x784e('0x1b5')});db[_0x784e('0x98')]['hasMany'](db[_0x784e('0x1b6')],{'as':_0x784e('0x1b7'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0x1b6')][_0x784e('0x108')](db[_0x784e('0x1b9')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x784e('0x1b6')][_0x784e('0x108')](db[_0x784e('0x1b9')],{'as':'Descriptions','onDelete':_0x784e('0x10b'),'foreignKey':'DescriptionId'});db[_0x784e('0x1b6')][_0x784e('0x108')](db[_0x784e('0x1b9')],{'as':_0x784e('0x1b1'),'onDelete':'cascade','foreignKey':_0x784e('0x1ba')});db['SalesforceConfiguration'][_0x784e('0x115')](db[_0x784e('0x98')],{'as':_0x784e('0x16b'),'foreignKey':'AccountId'});db[_0x784e('0x1b9')][_0x784e('0x108')](db['SalesforceField'],{'as':_0x784e('0x1bb'),'foreignKey':'SubjectId'});db[_0x784e('0x1b9')]['hasMany'](db[_0x784e('0x1b9')],{'as':'Description','foreignKey':_0x784e('0x1bc')});db[_0x784e('0x1b9')][_0x784e('0x108')](db[_0x784e('0x1b9')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0x1b9')]['belongsTo'](db[_0x784e('0x8a')],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db[_0x784e('0x1bf')]['hasMany'](db[_0x784e('0x9c')],{'as':_0x784e('0x1b7'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0x9c')]['hasMany'](db[_0x784e('0x1c0')],{'as':_0x784e('0x1c1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0x9c')][_0x784e('0x108')](db[_0x784e('0x1c0')],{'as':'Descriptions','onDelete':_0x784e('0x10b'),'foreignKey':'DescriptionId'});db[_0x784e('0x9c')]['hasMany'](db['SugarcrmField'],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0x9c')][_0x784e('0x115')](db['SugarcrmAccount'],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0x1c0')][_0x784e('0x108')](db[_0x784e('0x1c0')],{'as':'Subject','foreignKey':_0x784e('0x1c2')});db['SugarcrmField'][_0x784e('0x108')](db['SugarcrmField'],{'as':_0x784e('0x1c3'),'foreignKey':_0x784e('0x1bc')});db['SugarcrmField'][_0x784e('0x108')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x784e('0x1ba')});db[_0x784e('0x1c0')][_0x784e('0x115')](db['Variable'],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db[_0x784e('0x9e')][_0x784e('0x108')](db['DeskConfiguration'],{'as':_0x784e('0x1b7'),'onDelete':_0x784e('0x10b'),'foreignKey':'AccountId'});db[_0x784e('0x9f')][_0x784e('0x108')](db[_0x784e('0xa1')],{'as':_0x784e('0x1c1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0x9f')]['hasMany'](db[_0x784e('0xa1')],{'as':_0x784e('0x1c4'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0x9f')]['hasMany'](db['DeskField'],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1ba')});db['DeskConfiguration'][_0x784e('0x115')](db[_0x784e('0x9e')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x784e('0x116')](db['Tag'],{'through':_0x784e('0x1c5')});db['DeskField'][_0x784e('0x108')](db[_0x784e('0xa1')],{'as':_0x784e('0x1bb'),'foreignKey':'SubjectId'});db[_0x784e('0xa1')][_0x784e('0x108')](db[_0x784e('0xa1')],{'as':_0x784e('0x1c3'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0xa1')]['hasMany'](db[_0x784e('0xa1')],{'as':'Field','foreignKey':_0x784e('0x1ba')});db[_0x784e('0xa1')][_0x784e('0x115')](db[_0x784e('0x8a')],{'as':'Variable','foreignKey':_0x784e('0x1be')});db['ZohoAccount'][_0x784e('0x108')](db[_0x784e('0xa5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x784e('0x1b8')});db[_0x784e('0xa5')][_0x784e('0x108')](db[_0x784e('0xa7')],{'as':_0x784e('0x1c1'),'onDelete':'cascade','foreignKey':_0x784e('0x1c2')});db[_0x784e('0xa5')][_0x784e('0x108')](db[_0x784e('0xa7')],{'as':_0x784e('0x1c4'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1bc')});db['ZohoConfiguration'][_0x784e('0x108')](db['ZohoField'],{'as':'Fields','onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1ba')});db['ZohoConfiguration'][_0x784e('0x115')](db[_0x784e('0xa3')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0xa7')][_0x784e('0x108')](db[_0x784e('0xa7')],{'as':'Subject','foreignKey':_0x784e('0x1c2')});db['ZohoField'][_0x784e('0x108')](db[_0x784e('0xa7')],{'as':_0x784e('0x1c3'),'foreignKey':'DescriptionId'});db[_0x784e('0xa7')][_0x784e('0x108')](db[_0x784e('0xa7')],{'as':'Field','foreignKey':'FieldId'});db[_0x784e('0xa7')]['belongsTo'](db['Variable'],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db[_0x784e('0xa9')]['hasMany'](db[_0x784e('0xab')],{'as':'Configurations','onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0xab')][_0x784e('0x108')](db['ZendeskField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x784e('0x108')](db['ZendeskField'],{'as':_0x784e('0x1c4'),'foreignKey':'DescriptionId'});db[_0x784e('0xab')][_0x784e('0x108')](db[_0x784e('0x1c6')],{'as':_0x784e('0x1b1'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xab')]['belongsTo'](db[_0x784e('0xa9')],{'as':'Account','foreignKey':_0x784e('0x1b8')});db[_0x784e('0xab')][_0x784e('0x116')](db['Tag'],{'through':_0x784e('0x1c7')});db['ZendeskField']['hasMany'](db[_0x784e('0x1c6')],{'as':'Subject','foreignKey':_0x784e('0x1c2')});db['ZendeskField'][_0x784e('0x108')](db[_0x784e('0x1c6')],{'as':_0x784e('0x1c3'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0x1c6')]['hasMany'](db[_0x784e('0x1c6')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0x1c6')][_0x784e('0x115')](db['Variable'],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db['FreshdeskAccount']['hasMany'](db[_0x784e('0xaf')],{'as':_0x784e('0x1b7'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0xaf')][_0x784e('0x108')](db[_0x784e('0xb1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x784e('0x1c2')});db[_0x784e('0xaf')][_0x784e('0x108')](db[_0x784e('0xb1')],{'as':_0x784e('0x1c4'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0xaf')][_0x784e('0x108')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xaf')][_0x784e('0x115')](db[_0x784e('0x1c8')],{'as':_0x784e('0x16b'),'foreignKey':'AccountId'});db[_0x784e('0xaf')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x784e('0x108')](db[_0x784e('0xb1')],{'as':_0x784e('0x1bb'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0xb1')][_0x784e('0x108')](db[_0x784e('0xb1')],{'as':_0x784e('0x1c3'),'foreignKey':'DescriptionId'});db[_0x784e('0xb1')][_0x784e('0x108')](db[_0x784e('0xb1')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xb1')][_0x784e('0x115')](db[_0x784e('0x8a')],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db[_0x784e('0xb3')][_0x784e('0x108')](db[_0x784e('0xb5')],{'as':'Configurations','onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0xb5')][_0x784e('0x108')](db[_0x784e('0xb7')],{'as':'Subjects','foreignKey':_0x784e('0x1c2')});db[_0x784e('0xb5')][_0x784e('0x108')](db[_0x784e('0xb7')],{'as':_0x784e('0x1c4'),'foreignKey':_0x784e('0x1bc')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x784e('0x1b1'),'foreignKey':_0x784e('0x1ba')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x784e('0xb7')][_0x784e('0x108')](db[_0x784e('0xb7')],{'as':_0x784e('0x1bb'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0xb7')][_0x784e('0x108')](db[_0x784e('0xb7')],{'as':_0x784e('0x1c3'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0xb7')][_0x784e('0x108')](db[_0x784e('0xb7')],{'as':_0x784e('0x1bd'),'foreignKey':'FieldId'});db[_0x784e('0xb7')][_0x784e('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0x784e('0x1be')});db[_0x784e('0xb9')][_0x784e('0x108')](db[_0x784e('0xbb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x784e('0x1b8')});db[_0x784e('0xbb')][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':'Subjects','foreignKey':_0x784e('0x1c2')});db[_0x784e('0xbb')][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':_0x784e('0x1c4'),'foreignKey':'DescriptionId'});db[_0x784e('0xbb')][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':_0x784e('0x1b1'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0x784e('0xb9')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x1b8')});db['ServicenowField'][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':_0x784e('0x1bb'),'foreignKey':_0x784e('0x1c2')});db['ServicenowField'][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':_0x784e('0x1c3'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x784e('0x108')](db[_0x784e('0xbd')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xbd')][_0x784e('0x115')](db[_0x784e('0x8a')],{'as':_0x784e('0x8a'),'foreignKey':_0x784e('0x1be')});db[_0x784e('0x1c9')][_0x784e('0x108')](db[_0x784e('0xbf')],{'as':_0x784e('0x1b7'),'onDelete':'cascade','foreignKey':_0x784e('0x1b8')});db[_0x784e('0xbf')][_0x784e('0x108')](db[_0x784e('0xc1')],{'as':_0x784e('0x1c1'),'onDelete':'cascade','foreignKey':_0x784e('0x1c2')});db['Dynamics365Configuration']['hasMany'](db[_0x784e('0xc1')],{'as':_0x784e('0x1c4'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0xbf')]['hasMany'](db[_0x784e('0xc1')],{'as':_0x784e('0x1b1'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xbf')][_0x784e('0x115')](db[_0x784e('0x1c9')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x1b8')});db['Dynamics365Field'][_0x784e('0x108')](db[_0x784e('0xc1')],{'as':_0x784e('0x1bb'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0xc1')]['hasMany'](db[_0x784e('0xc1')],{'as':'Description','foreignKey':_0x784e('0x1bc')});db[_0x784e('0xc1')][_0x784e('0x108')](db[_0x784e('0xc1')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0xc1')]['belongsTo'](db[_0x784e('0x8a')],{'as':'Variable','foreignKey':'VariableId'});db[_0x784e('0xc3')][_0x784e('0x108')](db[_0x784e('0xc5')],{'as':_0x784e('0x1b7'),'onDelete':_0x784e('0x10b'),'foreignKey':'AccountId'});db[_0x784e('0xc5')][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':_0x784e('0x1c1'),'foreignKey':_0x784e('0x1c2')});db[_0x784e('0xc5')][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':'Descriptions','foreignKey':_0x784e('0x1bc')});db[_0x784e('0xc5')][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':_0x784e('0x1b1'),'foreignKey':_0x784e('0x1ba')});db['FreshsalesConfiguration'][_0x784e('0x115')](db[_0x784e('0xc3')],{'as':_0x784e('0x16b'),'foreignKey':_0x784e('0x1b8')});db[_0x784e('0x1ca')][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':_0x784e('0x1bb'),'foreignKey':_0x784e('0x1c2')});db['FreshsalesField'][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':_0x784e('0x1c3'),'foreignKey':_0x784e('0x1bc')});db[_0x784e('0x1ca')][_0x784e('0x108')](db[_0x784e('0x1ca')],{'as':_0x784e('0x1bd'),'foreignKey':_0x784e('0x1ba')});db[_0x784e('0x1ca')][_0x784e('0x115')](db[_0x784e('0x8a')],{'as':'Variable','foreignKey':'VariableId'});db[_0x784e('0xca')][_0x784e('0x115')](db[_0x784e('0x12f')],{});db[_0x784e('0xca')][_0x784e('0x115')](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0xca')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':'Contact','foreignKey':_0x784e('0x15a')});db[_0x784e('0xca')]['belongsTo'](db[_0x784e('0x11e')],{});db['ChatQueueReport'][_0x784e('0x115')](db['ChatMessage'],{});db[_0x784e('0xca')][_0x784e('0x115')](db[_0x784e('0x13')],{});db[_0x784e('0xca')][_0x784e('0x115')](db[_0x784e('0x68')],{});db[_0x784e('0xcb')][_0x784e('0x115')](db['User'],{'onDelete':'cascade','foreignKey':_0x784e('0x1cb')});db[_0x784e('0xcb')][_0x784e('0x115')](db[_0x784e('0x13')],{'onDelete':'cascade','foreignKey':_0x784e('0x1cc')});db[_0x784e('0xcf')][_0x784e('0x108')](db[_0x784e('0xce')],{'foreignKey':_0x784e('0x1cd'),'onDelete':_0x784e('0x10b')});db['JscriptySessionReport'][_0x784e('0x108')](db[_0x784e('0xcc')],{'foreignKey':_0x784e('0x1cd'),'onDelete':_0x784e('0x10b')});db[_0x784e('0xd1')][_0x784e('0x115')](db['SmsAccount'],{});db[_0x784e('0xd1')]['belongsTo'](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db['SmsQueueReport'][_0x784e('0x115')](db['CmContact'],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db['SmsQueueReport'][_0x784e('0x115')](db[_0x784e('0x10f')],{});db[_0x784e('0xd1')][_0x784e('0x115')](db[_0x784e('0x59')],{});db[_0x784e('0xd1')][_0x784e('0x115')](db['User'],{});db['SmsQueueReport'][_0x784e('0x115')](db['SmsQueue'],{});db[_0x784e('0xd6')][_0x784e('0x108')](db[_0x784e('0xcf')],{'foreignKey':_0x784e('0x1ce')});db['JscriptyProject']['hasMany'](db[_0x784e('0xce')],{'foreignKey':'ProjectId'});db[_0x784e('0xd6')][_0x784e('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0x784e('0x1ce')});db[_0x784e('0xdb')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':_0x784e('0x139')});db[_0x784e('0xde')]['belongsToMany'](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x11c')});db[_0x784e('0xde')][_0x784e('0x116')](db[_0x784e('0x124')],{'through':_0x784e('0x14f'),'as':_0x784e('0x1cf')});db['Team'][_0x784e('0x116')](db[_0x784e('0x125')],{'through':_0x784e('0x1d0'),'as':_0x784e('0x1d1')});db[_0x784e('0xde')][_0x784e('0x116')](db[_0x784e('0x68')],{'through':_0x784e('0x18d'),'as':'ChatQueues'});db['Team']['belongsToMany'](db[_0x784e('0x51')],{'through':_0x784e('0x17a'),'as':_0x784e('0x128')});db[_0x784e('0xde')][_0x784e('0x116')](db[_0x784e('0x5b')],{'through':'team_has_sms_queues','as':_0x784e('0x1d2')});db[_0x784e('0xde')][_0x784e('0x116')](db['OpenchannelQueue'],{'through':_0x784e('0x185'),'as':'OpenchannelQueues'});db[_0x784e('0xde')][_0x784e('0x116')](db[_0x784e('0x1d3')],{'through':_0x784e('0x1d4'),'as':'WhatsappQueues'});db['Campaign'][_0x784e('0x108')](db['CmHopper'],{'as':_0x784e('0x191'),'foreignKey':_0x784e('0x196')});db['Campaign'][_0x784e('0x108')](db[_0x784e('0x72')],{'as':_0x784e('0x10c'),'foreignKey':_0x784e('0x196')});db['Campaign']['hasMany'](db[_0x784e('0x74')],{'as':_0x784e('0x192'),'foreignKey':'CampaignId'});db[_0x784e('0xe2')][_0x784e('0x108')](db[_0x784e('0x141')],{'as':_0x784e('0x142'),'foreignKey':'CampaignId'});db['Campaign'][_0x784e('0x115')](db['Trunk'],{'as':_0x784e('0x2a'),'foreignKey':_0x784e('0x144')});db[_0x784e('0xe2')][_0x784e('0x115')](db[_0x784e('0x2a')],{'as':_0x784e('0x145'),'foreignKey':_0x784e('0x146')});db[_0x784e('0xe2')][_0x784e('0x115')](db[_0x784e('0x147')],{'as':'Interval','foreignKey':_0x784e('0x148')});db[_0x784e('0xe2')][_0x784e('0x115')](db[_0x784e('0xdb')],{'as':'SquareProject','foreignKey':_0x784e('0x1d5')});db[_0x784e('0xe2')][_0x784e('0x116')](db[_0x784e('0xf0')],{'as':_0x784e('0x11b'),'through':'campaigns_has_cm_lists'});db[_0x784e('0xe2')][_0x784e('0x116')](db[_0x784e('0xf0')],{'as':_0x784e('0x150'),'through':_0x784e('0x1d6')});db[_0x784e('0xe6')]['belongsTo'](db['MailMessage'],{});db[_0x784e('0xe6')][_0x784e('0x115')](db['MailInteraction'],{});db['MailTransferReport'][_0x784e('0x115')](db[_0x784e('0x15b')],{'foreignKey':_0x784e('0x1d7'),'as':_0x784e('0x1d8')});db[_0x784e('0xe6')][_0x784e('0x115')](db['User'],{'foreignKey':_0x784e('0x1d9'),'as':_0x784e('0x1da')});db[_0x784e('0xe6')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':'ToUserId','as':_0x784e('0x1db')});db[_0x784e('0xe6')][_0x784e('0x115')](db['MailQueue'],{'foreignKey':_0x784e('0x1dc'),'as':_0x784e('0x1dd')});db[_0x784e('0xe6')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x784e('0x1de')});db[_0x784e('0xe8')][_0x784e('0x115')](db['ChatMessage'],{});db[_0x784e('0xe8')][_0x784e('0x115')](db[_0x784e('0x11e')],{});db[_0x784e('0xe8')][_0x784e('0x115')](db[_0x784e('0x12f')],{'foreignKey':_0x784e('0x1df'),'as':_0x784e('0x1d8')});db[_0x784e('0xe8')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport'][_0x784e('0x115')](db['User'],{'foreignKey':_0x784e('0x1e0'),'as':_0x784e('0x1db')});db['ChatTransferReport']['belongsTo'](db[_0x784e('0x68')],{'foreignKey':_0x784e('0x1e1'),'as':_0x784e('0x1dd')});db['ChatTransferReport'][_0x784e('0x115')](db[_0x784e('0x12f')],{'foreignKey':'ToChatWebsiteId','as':_0x784e('0x1de')});db['FaxTransferReport'][_0x784e('0x115')](db[_0x784e('0x173')],{});db[_0x784e('0xea')][_0x784e('0x115')](db[_0x784e('0x4e')],{});db[_0x784e('0xea')]['belongsTo'](db[_0x784e('0x4b')],{'foreignKey':_0x784e('0x1e2'),'as':_0x784e('0x1d8')});db[_0x784e('0xea')][_0x784e('0x115')](db['User'],{'foreignKey':_0x784e('0x1d9'),'as':'FromAgent'});db[_0x784e('0xea')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':_0x784e('0x1e0'),'as':'ToAgent'});db[_0x784e('0xea')][_0x784e('0x115')](db['FaxQueue'],{'foreignKey':_0x784e('0x1e3'),'as':_0x784e('0x1dd')});db['FaxTransferReport'][_0x784e('0x115')](db['FaxAccount'],{'foreignKey':_0x784e('0x1e4'),'as':_0x784e('0x1de')});db[_0x784e('0xec')][_0x784e('0x115')](db[_0x784e('0x181')],{});db[_0x784e('0xec')][_0x784e('0x115')](db[_0x784e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x784e('0x5c')],{'foreignKey':_0x784e('0x1e5'),'as':'FromAccount'});db[_0x784e('0xec')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':'FromUserId','as':_0x784e('0x1da')});db[_0x784e('0xec')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':'ToUserId','as':_0x784e('0x1db')});db['OpenchannelTransferReport'][_0x784e('0x115')](db[_0x784e('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db['OpenchannelTransferReport'][_0x784e('0x115')](db[_0x784e('0x5c')],{'foreignKey':_0x784e('0x1e6'),'as':'ToAccount'});db[_0x784e('0xee')][_0x784e('0x115')](db['SmsMessage'],{});db[_0x784e('0xee')]['belongsTo'](db['SmsInteraction'],{});db[_0x784e('0xee')]['belongsTo'](db[_0x784e('0x54')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x784e('0xee')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':_0x784e('0x1d9'),'as':'FromAgent'});db[_0x784e('0xee')][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':_0x784e('0x1e0'),'as':_0x784e('0x1db')});db[_0x784e('0xee')][_0x784e('0x115')](db[_0x784e('0x5b')],{'foreignKey':_0x784e('0x1e7'),'as':_0x784e('0x1dd')});db['SmsTransferReport']['belongsTo'](db[_0x784e('0x54')],{'foreignKey':_0x784e('0x1e8'),'as':_0x784e('0x1de')});db[_0x784e('0xf0')][_0x784e('0x108')](db[_0x784e('0x7e')],{'as':_0x784e('0x15e'),'foreignKey':_0x784e('0x163')});db[_0x784e('0xf0')]['hasMany'](db['CmCustomField'],{'as':_0x784e('0x1e9'),'foreignKey':'ListId'});db['CmList'][_0x784e('0x108')](db[_0x784e('0x6d')],{'as':_0x784e('0x119'),'onDelete':_0x784e('0x10b'),'foreignKey':_0x784e('0x163')});db[_0x784e('0xf0')][_0x784e('0x108')](db[_0x784e('0x72')],{'as':_0x784e('0x10c'),'foreignKey':_0x784e('0x163')});db['CmList'][_0x784e('0x108')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x784e('0xf0')][_0x784e('0x108')](db[_0x784e('0x76')],{'as':_0x784e('0x76'),'foreignKey':'ListId'});db[_0x784e('0xf0')][_0x784e('0x116')](db[_0x784e('0x124')],{'as':_0x784e('0x1ea'),'through':_0x784e('0x14b')});db[_0x784e('0xf0')][_0x784e('0x116')](db['User'],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0x784e('0x108')](db[_0x784e('0x18')],{'as':_0x784e('0x10a'),'onDelete':_0x784e('0x10b')});db[_0x784e('0xf2')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x12e')});db[_0x784e('0xf3')][_0x784e('0x108')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'foreignKey':'userProfileId'});db[_0x784e('0xf3')][_0x784e('0x108')](db['UserProfileSection'],{'as':_0x784e('0x1eb'),'foreignKey':'userProfileId','onDelete':_0x784e('0x10b')});db[_0x784e('0xf5')]['hasMany'](db[_0x784e('0xf7')],{'as':_0x784e('0x1ec'),'foreignKey':_0x784e('0x1ed'),'onDelete':_0x784e('0x10b')});db[_0x784e('0xf9')][_0x784e('0x108')](db[_0x784e('0x7e')],{'as':_0x784e('0x15e'),'foreignKey':_0x784e('0x1ee')});db[_0x784e('0xf9')][_0x784e('0x108')](db[_0x784e('0x7d')],{'as':_0x784e('0x160'),'foreignKey':_0x784e('0x1ee')});db[_0x784e('0xf9')]['hasMany'](db['WhatsappMessage'],{'as':_0x784e('0x153'),'foreignKey':_0x784e('0x1ee')});db[_0x784e('0xf9')]['hasMany'](db[_0x784e('0xfb')],{'as':'Interactions'});db['WhatsappAccount'][_0x784e('0x108')](db[_0x784e('0x1ef')],{'as':_0x784e('0x13c')});db[_0x784e('0xf9')]['belongsTo'](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0xf9')][_0x784e('0x115')](db['Pause'],{'as':_0x784e('0x149'),'foreignKey':_0x784e('0x14a')});db[_0x784e('0xf9')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x14c'),'through':_0x784e('0x1f0')});db[_0x784e('0x1ef')]['belongsTo'](db['User'],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x1ef')][_0x784e('0x115')](db[_0x784e('0x1d3')],{'onDelete':_0x784e('0x16d')});db[_0x784e('0x1ef')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x784e('0x16d')});db['WhatsappApplication'][_0x784e('0x115')](db['Interval'],{'onDelete':_0x784e('0x16d'),'foreignKey':_0x784e('0x148')});db[_0x784e('0x1ef')][_0x784e('0x115')](db[_0x784e('0x87')],{'onDelete':'restrict','foreignKey':_0x784e('0x16e')});db[_0x784e('0xfb')][_0x784e('0x108')](db[_0x784e('0xfc')],{'as':_0x784e('0x153'),'onDelete':'cascade','foreignKey':_0x784e('0x1f1')});db['WhatsappInteraction'][_0x784e('0x115')](db[_0x784e('0xf9')],{'as':_0x784e('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0x784e('0xfb')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':_0x784e('0x15a')});db[_0x784e('0xfb')]['belongsTo'](db[_0x784e('0x13')],{'as':_0x784e('0x164'),'foreignKey':'UserId'});db[_0x784e('0xfb')][_0x784e('0x116')](db[_0x784e('0x87')],{'through':_0x784e('0x1a9'),'as':_0x784e('0x166')});db[_0x784e('0xfb')]['belongsToMany'](db['Tag'],{'through':_0x784e('0x1a9'),'as':_0x784e('0x177')});db[_0x784e('0xfb')][_0x784e('0x116')](db[_0x784e('0x13')],{'as':_0x784e('0x167'),'through':_0x784e('0x123'),'foreignKey':_0x784e('0x1f1')});db[_0x784e('0xfc')][_0x784e('0x115')](db[_0x784e('0x13')],{'as':_0x784e('0x13')});db['WhatsappMessage'][_0x784e('0x115')](db[_0x784e('0x6d')],{'onDelete':'cascade','as':_0x784e('0x159')});db['WhatsappMessage'][_0x784e('0x115')](db[_0x784e('0xfb')],{'onDelete':_0x784e('0x10b'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x784e('0xfc')][_0x784e('0x115')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x784e('0x1ee')});db['WhatsappQueueReport'][_0x784e('0x115')](db[_0x784e('0xf9')],{});db[_0x784e('0xfe')]['belongsTo'](db[_0x784e('0xf0')],{'as':_0x784e('0x162'),'foreignKey':_0x784e('0x163')});db[_0x784e('0xfe')][_0x784e('0x115')](db[_0x784e('0x6d')],{'as':_0x784e('0x159'),'foreignKey':'ContactId'});db[_0x784e('0xfe')]['belongsTo'](db[_0x784e('0xfb')],{});db[_0x784e('0xfe')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x784e('0xfc')],{});db[_0x784e('0xfe')][_0x784e('0x115')](db[_0x784e('0x13')],{});db[_0x784e('0x100')][_0x784e('0x115')](db['WhatsappMessage'],{});db[_0x784e('0x100')][_0x784e('0x115')](db[_0x784e('0xfb')],{});db[_0x784e('0x100')]['belongsTo'](db[_0x784e('0xf9')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x784e('0x100')]['belongsTo'](db[_0x784e('0xf9')],{'foreignKey':'ToWhatsappAccountId','as':_0x784e('0x1de')});db[_0x784e('0x100')][_0x784e('0x115')](db[_0x784e('0x1d3')],{'foreignKey':_0x784e('0x1f2'),'as':_0x784e('0x1dd')});db[_0x784e('0x100')]['belongsTo'](db[_0x784e('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0x784e('0x115')](db[_0x784e('0x13')],{'foreignKey':'ToUserId','as':_0x784e('0x1db')});db['WhatsappQueue'][_0x784e('0x116')](db['User'],{'as':_0x784e('0x14c'),'through':_0x784e('0x12b'),'foreignKey':_0x784e('0x1f3')});db[_0x784e('0x1d3')][_0x784e('0x116')](db[_0x784e('0xde')],{'through':_0x784e('0x1d4'),'as':_0x784e('0x14e')});module[_0x784e('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ed122de..5181f68 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a5=['./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','/demo','root','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','use','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','headers','x-forwarded-for','url','statusCode','responseTime','user','name','role','logger','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)','connection','other','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts'];(function(_0x2337aa,_0xbf517f){var _0x4fc51e=function(_0x5e4cfc){while(--_0x5e4cfc){_0x2337aa['push'](_0x2337aa['shift']());}};_0x4fc51e(++_0xbf517f);}(_0xd8a5,0x16f));var _0x5d8a=function(_0x49118a,_0x3d8e76){_0x49118a=_0x49118a-0x0;var _0x17decb=_0xd8a5[_0x49118a];return _0x17decb;};'use strict';var path=require(_0x5d8a('0x0'));var express=require(_0x5d8a('0x1'));var ewinston=require(_0x5d8a('0x2'));var util=require('util');var errors=require(_0x5d8a('0x3'));var config=require(_0x5d8a('0x4'));var logger=require(_0x5d8a('0x5'))(_0x5d8a('0x6'));var authLogger=require(_0x5d8a('0x5'))(_0x5d8a('0x7'));exports['default']=function(_0x4c3521){_0x4c3521[_0x5d8a('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1bb830,_0x386005){return util[_0x5d8a('0x9')](_0x5d8a('0xa'),_0x1bb830['method'],_0x1bb830[_0x5d8a('0xb')][_0x5d8a('0xc')]?_0x1bb830[_0x5d8a('0xb')][_0x5d8a('0xc')]:_0x1bb830['connection']['remoteAddress']||_0x1bb830['ip'],_0x1bb830[_0x5d8a('0xd')],_0x386005[_0x5d8a('0xe')],_0x386005[_0x5d8a('0xf')],_0x1bb830[_0x5d8a('0x10')]?_0x1bb830[_0x5d8a('0x10')]['id']:null,_0x1bb830[_0x5d8a('0x10')]?_0x1bb830[_0x5d8a('0x10')][_0x5d8a('0x11')]:null,_0x1bb830['user']?_0x1bb830[_0x5d8a('0x10')][_0x5d8a('0x12')]:null);}}));_0x4c3521[_0x5d8a('0x8')](ewinston[_0x5d8a('0x13')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x366a3c,_0x4156d4){var _0x3aceee='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x366a3c['body']&&_0x366a3c[_0x5d8a('0x14')][_0x5d8a('0x15')]&&_0x366a3c['body'][_0x5d8a('0x16')]){_0x3aceee=_0x5d8a('0x17');}return util[_0x5d8a('0x9')](_0x3aceee,_0x366a3c['method'],_0x366a3c[_0x5d8a('0xb')]['x-forwarded-for']?_0x366a3c[_0x5d8a('0xb')][_0x5d8a('0xc')]:_0x366a3c[_0x5d8a('0x18')]['remoteAddress']||_0x366a3c['ip'],_0x366a3c['url'],_0x4156d4['statusCode'],_0x4156d4[_0x5d8a('0xf')],_0x366a3c[_0x5d8a('0x10')]?_0x366a3c[_0x5d8a('0x10')]['id']:null,_0x366a3c[_0x5d8a('0x10')]?_0x366a3c[_0x5d8a('0x10')][_0x5d8a('0x11')]:null,_0x366a3c['user']?_0x366a3c[_0x5d8a('0x10')][_0x5d8a('0x12')]:null,_0x366a3c['body']&&_0x366a3c['body'][_0x5d8a('0x15')]?_0x366a3c['body'][_0x5d8a('0x15')]:_0x5d8a('0x19'),_0x366a3c[_0x5d8a('0x14')]&&_0x366a3c[_0x5d8a('0x14')][_0x5d8a('0x16')]?_0x366a3c['body'][_0x5d8a('0x16')]:'',_0x366a3c['body']&&_0x366a3c[_0x5d8a('0x14')]['agent_name']?_0x366a3c[_0x5d8a('0x14')]['agent_name']:'');},'ignoreRoute':function(_0xfee4b0){var _0x40bfb4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40bfb4['test'](_0xfee4b0[_0x5d8a('0xd')]);}}));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x1a'),require('./api/user'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x1b'),require(_0x5d8a('0x1c')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x1d'),require(_0x5d8a('0x1e')));_0x4c3521[_0x5d8a('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x4c3521['use'](_0x5d8a('0x1f'),require(_0x5d8a('0x20')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x21'),require('./api/voiceQueue'));_0x4c3521['use'](_0x5d8a('0x22'),require('./api/voiceRecording'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x23'),require('./api/screenRecording'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x24'),require('./api/voiceMail'));_0x4c3521['use'](_0x5d8a('0x25'),require(_0x5d8a('0x26')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x27'),require('./api/voiceCallReport'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x28'),require(_0x5d8a('0x29')));_0x4c3521['use'](_0x5d8a('0x2a'),require(_0x5d8a('0x2b')));_0x4c3521[_0x5d8a('0x8')]('/api/voice/queues/reports',require(_0x5d8a('0x2c')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x2d'),require(_0x5d8a('0x2e')));_0x4c3521[_0x5d8a('0x8')]('/api/trunks',require(_0x5d8a('0x2f')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x30'),require('./api/voiceTransferReport'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x31'),require('./api/mailServerOut'));_0x4c3521['use']('/api/mail/accounts',require(_0x5d8a('0x32')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x33'),require(_0x5d8a('0x34')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x35'),require(_0x5d8a('0x36')));_0x4c3521[_0x5d8a('0x8')]('/api/mail/interactions',require(_0x5d8a('0x37')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x38'),require('./api/mailMessage'));_0x4c3521[_0x5d8a('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x39'),require(_0x5d8a('0x3a')));_0x4c3521[_0x5d8a('0x8')]('/api/dashboards',require('./api/dashboard'));_0x4c3521[_0x5d8a('0x8')]('/api/dashboards/items',require(_0x5d8a('0x3b')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x3c'),require('./api/faxAccount'));_0x4c3521['use'](_0x5d8a('0x3d'),require('./api/faxApplication'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x3e'),require('./api/faxInteraction'));_0x4c3521['use']('/api/fax/messages',require('./api/faxMessage'));_0x4c3521['use']('/api/fax/queues',require(_0x5d8a('0x3f')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x40'),require(_0x5d8a('0x41')));_0x4c3521['use'](_0x5d8a('0x42'),require(_0x5d8a('0x43')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x44'),require('./api/smsApplication'));_0x4c3521['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x4c3521['use'](_0x5d8a('0x45'),require(_0x5d8a('0x46')));_0x4c3521[_0x5d8a('0x8')]('/api/sms/queues',require(_0x5d8a('0x47')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x48'),require(_0x5d8a('0x49')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x4a'),require(_0x5d8a('0x4b')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x4c'),require(_0x5d8a('0x4d')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x4e'),require(_0x5d8a('0x4f')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x50'),require(_0x5d8a('0x51')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x52'),require(_0x5d8a('0x53')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x54'),require('./api/openchannelQueueReport'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x55'),require(_0x5d8a('0x56')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x57'),require(_0x5d8a('0x58')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x59'),require('./api/chatMessage'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x5a'),require(_0x5d8a('0x5b')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x5c'),require(_0x5d8a('0x5d')));_0x4c3521['use'](_0x5d8a('0x5e'),require(_0x5d8a('0x5f')));_0x4c3521[_0x5d8a('0x8')]('/api/chat/proactive_actions',require(_0x5d8a('0x60')));_0x4c3521[_0x5d8a('0x8')]('/api/cm/companies',require('./api/cmCompany'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x61'),require(_0x5d8a('0x62')));_0x4c3521[_0x5d8a('0x8')]('/api/cm/hopper',require(_0x5d8a('0x63')));_0x4c3521['use']('/api/cm/hopper_black',require(_0x5d8a('0x64')));_0x4c3521['use']('/api/cm/hopper_final',require(_0x5d8a('0x65')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x66'),require(_0x5d8a('0x67')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x68'),require('./api/cmCustomField'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x69'),require(_0x5d8a('0x6a')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x6b'),require(_0x5d8a('0x6c')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x6d'),require(_0x5d8a('0x6e')));_0x4c3521[_0x5d8a('0x8')]('/api/dispositions',require(_0x5d8a('0x6f')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x70'),require(_0x5d8a('0x71')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x72'),require(_0x5d8a('0x73')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x74'),require(_0x5d8a('0x75')));_0x4c3521[_0x5d8a('0x8')]('/api/cdr',require(_0x5d8a('0x76')));_0x4c3521[_0x5d8a('0x8')]('/api/voiceQueuesLog',require(_0x5d8a('0x77')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x78'),require(_0x5d8a('0x79')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x7a'),require('./api/sound'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x7b'),require('./api/tag'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x7c'),require(_0x5d8a('0x7d')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x7e'),require(_0x5d8a('0x7f')));_0x4c3521['use'](_0x5d8a('0x80'),require(_0x5d8a('0x81')));_0x4c3521[_0x5d8a('0x8')]('/api/integrations',require(_0x5d8a('0x82')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x83'),require(_0x5d8a('0x84')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x85'),require(_0x5d8a('0x86')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x87'),require(_0x5d8a('0x88')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x89'),require(_0x5d8a('0x8a')));_0x4c3521[_0x5d8a('0x8')]('/api/analytics/metrics',require(_0x5d8a('0x8b')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x8c'),require(_0x5d8a('0x8d')));_0x4c3521['use'](_0x5d8a('0x8e'),require(_0x5d8a('0x8f')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x90'),require('./api/intSalesforceAccount'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x91'),require(_0x5d8a('0x92')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x93'),require(_0x5d8a('0x94')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x95'),require(_0x5d8a('0x96')));_0x4c3521['use'](_0x5d8a('0x97'),require(_0x5d8a('0x98')));_0x4c3521[_0x5d8a('0x8')]('/api/integrations/sugarcrm/fields',require(_0x5d8a('0x99')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x9a'),require(_0x5d8a('0x9b')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x9c'),require(_0x5d8a('0x9d')));_0x4c3521[_0x5d8a('0x8')]('/api/integrations/desk/fields',require(_0x5d8a('0x9e')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x9f'),require('./api/intZohoAccount'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xa0'),require(_0x5d8a('0xa1')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xa2'),require(_0x5d8a('0xa3')));_0x4c3521[_0x5d8a('0x8')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4c3521['use']('/api/integrations/zendesk/configurations',require(_0x5d8a('0xa4')));_0x4c3521['use'](_0x5d8a('0xa5'),require('./api/intZendeskField'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xa6'),require(_0x5d8a('0xa7')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xa8'),require(_0x5d8a('0xa9')));_0x4c3521[_0x5d8a('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x4c3521['use'](_0x5d8a('0xaa'),require(_0x5d8a('0xab')));_0x4c3521['use'](_0x5d8a('0xac'),require(_0x5d8a('0xad')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xae'),require(_0x5d8a('0xaf')));_0x4c3521['use'](_0x5d8a('0xb0'),require(_0x5d8a('0xb1')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xb2'),require('./api/intServicenowConfiguration'));_0x4c3521['use'](_0x5d8a('0xb3'),require(_0x5d8a('0xb4')));_0x4c3521['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xb5'),require('./api/intDynamics365Configuration'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xb6'),require(_0x5d8a('0xb7')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xb8'),require(_0x5d8a('0xb9')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xba'),require(_0x5d8a('0xbb')));_0x4c3521['use'](_0x5d8a('0xbc'),require(_0x5d8a('0xbd')));_0x4c3521['use'](_0x5d8a('0xbe'),require(_0x5d8a('0xbf')));_0x4c3521[_0x5d8a('0x8')]('/api/chat/reports/queue',require(_0x5d8a('0xc0')));_0x4c3521['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xc1'),require(_0x5d8a('0xc2')));_0x4c3521[_0x5d8a('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x4c3521['use'](_0x5d8a('0xc3'),require('./api/jscriptySessionReport'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xc4'),require(_0x5d8a('0xc5')));_0x4c3521[_0x5d8a('0x8')]('/api/square/reports',require(_0x5d8a('0xc6')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xc7'),require('./api/squareReportDetail'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xc8'),require('./api/jscriptyProject'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xc9'),require(_0x5d8a('0xca')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xcb'),require('./api/squareOdbc'));_0x4c3521['use'](_0x5d8a('0xcc'),require(_0x5d8a('0xcd')));_0x4c3521[_0x5d8a('0x8')]('/api/square/recordings',require(_0x5d8a('0xce')));_0x4c3521['use'](_0x5d8a('0xcf'),require(_0x5d8a('0xd0')));_0x4c3521['use'](_0x5d8a('0xd1'),require(_0x5d8a('0xd2')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xd3'),require('./api/license'));_0x4c3521['use'](_0x5d8a('0xd4'),require(_0x5d8a('0xd5')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xd6'),require('./api/migration'));_0x4c3521['use'](_0x5d8a('0xd7'),require(_0x5d8a('0xd8')));_0x4c3521[_0x5d8a('0x8')]('/api/plugins',require(_0x5d8a('0xd9')));_0x4c3521[_0x5d8a('0x8')]('/api/mail/reports/transfer',require(_0x5d8a('0xda')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xdb'),require(_0x5d8a('0xdc')));_0x4c3521[_0x5d8a('0x8')]('/api/fax/reports/transfer',require(_0x5d8a('0xdd')));_0x4c3521['use']('/api/openchannel/reports/transfer',require(_0x5d8a('0xde')));_0x4c3521['use'](_0x5d8a('0xdf'),require(_0x5d8a('0xe0')));_0x4c3521[_0x5d8a('0x8')]('/api/cm/lists',require('./api/cmList'));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xe1'),require(_0x5d8a('0xe2')));_0x4c3521[_0x5d8a('0x8')]('/api/userProfiles',require(_0x5d8a('0xe3')));_0x4c3521['use'](_0x5d8a('0xe4'),require(_0x5d8a('0xe5')));_0x4c3521[_0x5d8a('0x8')]('/api/userProfile/resources',require(_0x5d8a('0xe6')));_0x4c3521['use'](_0x5d8a('0xe7'),require(_0x5d8a('0xe8')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xe9'),require(_0x5d8a('0xea')));_0x4c3521[_0x5d8a('0x8')]('/api/whatsapp/applications',require(_0x5d8a('0xeb')));_0x4c3521['use']('/api/whatsapp/interactions',require(_0x5d8a('0xec')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xed'),require(_0x5d8a('0xee')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xef'),require('./api/whatsappQueueReport'));_0x4c3521['use']('/api/whatsapp/reports/transfer',require(_0x5d8a('0xf0')));_0x4c3521['use'](_0x5d8a('0xf1'),require(_0x5d8a('0xf2')));_0x4c3521[_0x5d8a('0x8')]('/api/cloudProviders',require(_0x5d8a('0xf3')));_0x4c3521[_0x5d8a('0x8')]('/api/auth/local',require('./api/authLocal'));_0x4c3521['use'](_0x5d8a('0xf4'),require(_0x5d8a('0xf5')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xf6'),require(_0x5d8a('0xf7')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xf8'),require(_0x5d8a('0xf9')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xfa'),require(_0x5d8a('0xfb')));_0x4c3521[_0x5d8a('0x8')]('/api/system',require(_0x5d8a('0xfc')));_0x4c3521[_0x5d8a('0x8')]('/api/pm2',require(_0x5d8a('0xfd')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0xfe'),require(_0x5d8a('0xff')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x100'),express[_0x5d8a('0x101')](path[_0x5d8a('0x102')](config['root'],_0x5d8a('0x100'))));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x103'),express['static'](path['join'](config['root'],_0x5d8a('0x103'))));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x104'),express[_0x5d8a('0x101')](path[_0x5d8a('0x102')](config[_0x5d8a('0x105')],'/demo')));_0x4c3521[_0x5d8a('0x8')](_0x5d8a('0x106'),express[_0x5d8a('0x101')](path[_0x5d8a('0x102')](config[_0x5d8a('0x105')],_0x5d8a('0x107'),_0x5d8a('0x108'))));_0x4c3521[_0x5d8a('0x8')]('/plugins',express[_0x5d8a('0x101')](path['join'](config['root'],_0x5d8a('0x109'))));_0x4c3521[_0x5d8a('0x10a')](_0x5d8a('0x10b'))['get'](errors[0x194]);_0x4c3521[_0x5d8a('0x10a')]('/*')[_0x5d8a('0x10c')](function(_0x2e0c50,_0x5b5535){_0x5b5535[_0x5d8a('0x10d')](path[_0x5d8a('0x10e')](_0x4c3521[_0x5d8a('0x10c')](_0x5d8a('0x10f'))+'/index.html'));});}; \ No newline at end of file +var _0xfec8=['./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/configurations','/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/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./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/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','./errors','./config/environment','./config/logger','auth','default','use','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','url','statusCode','responseTime','user','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','name','agent_name','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/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/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports'];(function(_0x280e11,_0x21705f){var _0x58bb2a=function(_0x40ba62){while(--_0x40ba62){_0x280e11['push'](_0x280e11['shift']());}};_0x58bb2a(++_0x21705f);}(_0xfec8,0x1c1));var _0x8fec=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xfec8[_0x2d8d69];return _0x39ae22;};'use strict';var path=require(_0x8fec('0x0'));var express=require(_0x8fec('0x1'));var ewinston=require(_0x8fec('0x2'));var util=require('util');var errors=require(_0x8fec('0x3'));var config=require(_0x8fec('0x4'));var logger=require('./config/logger')('api');var authLogger=require(_0x8fec('0x5'))(_0x8fec('0x6'));exports[_0x8fec('0x7')]=function(_0x117306){_0x117306[_0x8fec('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3e33de,_0x18f689){return util[_0x8fec('0x9')](_0x8fec('0xa'),_0x3e33de[_0x8fec('0xb')],_0x3e33de[_0x8fec('0xc')][_0x8fec('0xd')]?_0x3e33de[_0x8fec('0xc')][_0x8fec('0xd')]:_0x3e33de['connection']['remoteAddress']||_0x3e33de['ip'],_0x3e33de[_0x8fec('0xe')],_0x18f689[_0x8fec('0xf')],_0x18f689[_0x8fec('0x10')],_0x3e33de[_0x8fec('0x11')]?_0x3e33de['user']['id']:null,_0x3e33de[_0x8fec('0x11')]?_0x3e33de[_0x8fec('0x11')]['name']:null,_0x3e33de[_0x8fec('0x11')]?_0x3e33de[_0x8fec('0x11')][_0x8fec('0x12')]:null);}}));_0x117306[_0x8fec('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2054e5,_0x3406d0){var _0x1db53d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2054e5[_0x8fec('0x13')]&&_0x2054e5['body'][_0x8fec('0x14')]&&_0x2054e5[_0x8fec('0x13')][_0x8fec('0x15')]){_0x1db53d=_0x8fec('0x16');}return util[_0x8fec('0x9')](_0x1db53d,_0x2054e5[_0x8fec('0xb')],_0x2054e5[_0x8fec('0xc')]['x-forwarded-for']?_0x2054e5[_0x8fec('0xc')][_0x8fec('0xd')]:_0x2054e5['connection'][_0x8fec('0x17')]||_0x2054e5['ip'],_0x2054e5[_0x8fec('0xe')],_0x3406d0[_0x8fec('0xf')],_0x3406d0[_0x8fec('0x10')],_0x2054e5[_0x8fec('0x11')]?_0x2054e5[_0x8fec('0x11')]['id']:null,_0x2054e5['user']?_0x2054e5['user'][_0x8fec('0x18')]:null,_0x2054e5[_0x8fec('0x11')]?_0x2054e5[_0x8fec('0x11')][_0x8fec('0x12')]:null,_0x2054e5['body']&&_0x2054e5[_0x8fec('0x13')]['device']?_0x2054e5[_0x8fec('0x13')]['device']:'other',_0x2054e5[_0x8fec('0x13')]&&_0x2054e5['body'][_0x8fec('0x15')]?_0x2054e5['body'][_0x8fec('0x15')]:'',_0x2054e5[_0x8fec('0x13')]&&_0x2054e5[_0x8fec('0x13')][_0x8fec('0x19')]?_0x2054e5['body'][_0x8fec('0x19')]:'');},'ignoreRoute':function(_0x4640d1){var _0x501f01=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x501f01['test'](_0x4640d1['url']);}}));_0x117306[_0x8fec('0x8')](_0x8fec('0x1a'),require(_0x8fec('0x1b')));_0x117306[_0x8fec('0x8')]('/api/voice/chanspy',require(_0x8fec('0x1c')));_0x117306[_0x8fec('0x8')](_0x8fec('0x1d'),require(_0x8fec('0x1e')));_0x117306[_0x8fec('0x8')](_0x8fec('0x1f'),require(_0x8fec('0x20')));_0x117306[_0x8fec('0x8')](_0x8fec('0x21'),require(_0x8fec('0x22')));_0x117306['use'](_0x8fec('0x23'),require('./api/voiceQueue'));_0x117306[_0x8fec('0x8')](_0x8fec('0x24'),require(_0x8fec('0x25')));_0x117306[_0x8fec('0x8')]('/api/screen/recordings',require(_0x8fec('0x26')));_0x117306['use'](_0x8fec('0x27'),require(_0x8fec('0x28')));_0x117306[_0x8fec('0x8')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x117306[_0x8fec('0x8')](_0x8fec('0x29'),require(_0x8fec('0x2a')));_0x117306['use'](_0x8fec('0x2b'),require(_0x8fec('0x2c')));_0x117306['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x117306[_0x8fec('0x8')](_0x8fec('0x2d'),require(_0x8fec('0x2e')));_0x117306['use'](_0x8fec('0x2f'),require(_0x8fec('0x30')));_0x117306[_0x8fec('0x8')](_0x8fec('0x31'),require(_0x8fec('0x32')));_0x117306[_0x8fec('0x8')](_0x8fec('0x33'),require('./api/voiceTransferReport'));_0x117306[_0x8fec('0x8')](_0x8fec('0x34'),require('./api/mailServerOut'));_0x117306[_0x8fec('0x8')]('/api/mail/accounts',require(_0x8fec('0x35')));_0x117306['use'](_0x8fec('0x36'),require(_0x8fec('0x37')));_0x117306['use'](_0x8fec('0x38'),require('./api/mailSubstatus'));_0x117306[_0x8fec('0x8')]('/api/mail/interactions',require(_0x8fec('0x39')));_0x117306[_0x8fec('0x8')](_0x8fec('0x3a'),require(_0x8fec('0x3b')));_0x117306[_0x8fec('0x8')](_0x8fec('0x3c'),require(_0x8fec('0x3d')));_0x117306['use'](_0x8fec('0x3e'),require('./api/mailQueueReport'));_0x117306['use'](_0x8fec('0x3f'),require(_0x8fec('0x40')));_0x117306['use'](_0x8fec('0x41'),require(_0x8fec('0x42')));_0x117306[_0x8fec('0x8')](_0x8fec('0x43'),require(_0x8fec('0x44')));_0x117306[_0x8fec('0x8')](_0x8fec('0x45'),require(_0x8fec('0x46')));_0x117306[_0x8fec('0x8')](_0x8fec('0x47'),require('./api/faxInteraction'));_0x117306[_0x8fec('0x8')](_0x8fec('0x48'),require(_0x8fec('0x49')));_0x117306[_0x8fec('0x8')](_0x8fec('0x4a'),require(_0x8fec('0x4b')));_0x117306['use'](_0x8fec('0x4c'),require(_0x8fec('0x4d')));_0x117306[_0x8fec('0x8')](_0x8fec('0x4e'),require(_0x8fec('0x4f')));_0x117306['use']('/api/sms/applications',require(_0x8fec('0x50')));_0x117306['use'](_0x8fec('0x51'),require(_0x8fec('0x52')));_0x117306['use'](_0x8fec('0x53'),require(_0x8fec('0x54')));_0x117306[_0x8fec('0x8')](_0x8fec('0x55'),require(_0x8fec('0x56')));_0x117306[_0x8fec('0x8')](_0x8fec('0x57'),require(_0x8fec('0x58')));_0x117306['use']('/api/openchannel/applications',require(_0x8fec('0x59')));_0x117306[_0x8fec('0x8')](_0x8fec('0x5a'),require('./api/openchannelInteraction'));_0x117306[_0x8fec('0x8')](_0x8fec('0x5b'),require(_0x8fec('0x5c')));_0x117306[_0x8fec('0x8')](_0x8fec('0x5d'),require('./api/openchannelQueue'));_0x117306['use'](_0x8fec('0x5e'),require(_0x8fec('0x5f')));_0x117306[_0x8fec('0x8')](_0x8fec('0x60'),require(_0x8fec('0x61')));_0x117306[_0x8fec('0x8')](_0x8fec('0x62'),require(_0x8fec('0x63')));_0x117306[_0x8fec('0x8')](_0x8fec('0x64'),require(_0x8fec('0x65')));_0x117306[_0x8fec('0x8')](_0x8fec('0x66'),require('./api/chatMessage'));_0x117306[_0x8fec('0x8')](_0x8fec('0x67'),require(_0x8fec('0x68')));_0x117306['use'](_0x8fec('0x69'),require(_0x8fec('0x6a')));_0x117306[_0x8fec('0x8')](_0x8fec('0x6b'),require('./api/chatGroup'));_0x117306[_0x8fec('0x8')](_0x8fec('0x6c'),require('./api/chatProactiveAction'));_0x117306[_0x8fec('0x8')](_0x8fec('0x6d'),require('./api/cmCompany'));_0x117306['use'](_0x8fec('0x6e'),require(_0x8fec('0x6f')));_0x117306[_0x8fec('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x117306[_0x8fec('0x8')](_0x8fec('0x70'),require(_0x8fec('0x71')));_0x117306[_0x8fec('0x8')](_0x8fec('0x72'),require('./api/cmHopperFinal'));_0x117306[_0x8fec('0x8')](_0x8fec('0x73'),require(_0x8fec('0x74')));_0x117306['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x117306['use']('/api/actions',require('./api/action'));_0x117306[_0x8fec('0x8')]('/api/automations',require(_0x8fec('0x75')));_0x117306[_0x8fec('0x8')](_0x8fec('0x76'),require('./api/cannedAnswer'));_0x117306[_0x8fec('0x8')](_0x8fec('0x77'),require(_0x8fec('0x78')));_0x117306[_0x8fec('0x8')](_0x8fec('0x79'),require(_0x8fec('0x7a')));_0x117306[_0x8fec('0x8')](_0x8fec('0x7b'),require('./api/interval'));_0x117306[_0x8fec('0x8')](_0x8fec('0x7c'),require(_0x8fec('0x7d')));_0x117306['use'](_0x8fec('0x7e'),require(_0x8fec('0x7f')));_0x117306[_0x8fec('0x8')](_0x8fec('0x80'),require(_0x8fec('0x81')));_0x117306['use'](_0x8fec('0x82'),require(_0x8fec('0x83')));_0x117306['use'](_0x8fec('0x84'),require(_0x8fec('0x85')));_0x117306['use']('/api/tags',require(_0x8fec('0x86')));_0x117306[_0x8fec('0x8')](_0x8fec('0x87'),require('./api/template'));_0x117306[_0x8fec('0x8')](_0x8fec('0x88'),require(_0x8fec('0x89')));_0x117306[_0x8fec('0x8')](_0x8fec('0x8a'),require(_0x8fec('0x8b')));_0x117306[_0x8fec('0x8')](_0x8fec('0x8c'),require(_0x8fec('0x8d')));_0x117306[_0x8fec('0x8')](_0x8fec('0x8e'),require(_0x8fec('0x8f')));_0x117306['use'](_0x8fec('0x90'),require(_0x8fec('0x91')));_0x117306['use'](_0x8fec('0x92'),require(_0x8fec('0x93')));_0x117306[_0x8fec('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x117306[_0x8fec('0x8')](_0x8fec('0x94'),require(_0x8fec('0x95')));_0x117306['use'](_0x8fec('0x96'),require(_0x8fec('0x97')));_0x117306['use'](_0x8fec('0x98'),require(_0x8fec('0x99')));_0x117306[_0x8fec('0x8')](_0x8fec('0x9a'),require(_0x8fec('0x9b')));_0x117306[_0x8fec('0x8')]('/api/integrations/salesforce/configurations',require(_0x8fec('0x9c')));_0x117306[_0x8fec('0x8')](_0x8fec('0x9d'),require(_0x8fec('0x9e')));_0x117306[_0x8fec('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x8fec('0x9f')));_0x117306[_0x8fec('0x8')](_0x8fec('0xa0'),require(_0x8fec('0xa1')));_0x117306[_0x8fec('0x8')]('/api/integrations/sugarcrm/fields',require(_0x8fec('0xa2')));_0x117306['use'](_0x8fec('0xa3'),require(_0x8fec('0xa4')));_0x117306['use'](_0x8fec('0xa5'),require(_0x8fec('0xa6')));_0x117306['use']('/api/integrations/desk/fields',require(_0x8fec('0xa7')));_0x117306['use'](_0x8fec('0xa8'),require(_0x8fec('0xa9')));_0x117306[_0x8fec('0x8')](_0x8fec('0xaa'),require(_0x8fec('0xab')));_0x117306[_0x8fec('0x8')](_0x8fec('0xac'),require('./api/intZohoField'));_0x117306[_0x8fec('0x8')](_0x8fec('0xad'),require(_0x8fec('0xae')));_0x117306[_0x8fec('0x8')](_0x8fec('0xaf'),require('./api/intZendeskConfiguration'));_0x117306[_0x8fec('0x8')]('/api/integrations/zendesk/fields',require(_0x8fec('0xb0')));_0x117306[_0x8fec('0x8')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x117306[_0x8fec('0x8')](_0x8fec('0xb1'),require(_0x8fec('0xb2')));_0x117306[_0x8fec('0x8')](_0x8fec('0xb3'),require('./api/intFreshdeskField'));_0x117306[_0x8fec('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x117306[_0x8fec('0x8')](_0x8fec('0xb4'),require('./api/intVtigerConfiguration'));_0x117306['use'](_0x8fec('0xb5'),require(_0x8fec('0xb6')));_0x117306[_0x8fec('0x8')](_0x8fec('0xb7'),require(_0x8fec('0xb8')));_0x117306[_0x8fec('0x8')](_0x8fec('0xb9'),require('./api/intServicenowConfiguration'));_0x117306[_0x8fec('0x8')](_0x8fec('0xba'),require(_0x8fec('0xbb')));_0x117306['use'](_0x8fec('0xbc'),require(_0x8fec('0xbd')));_0x117306['use'](_0x8fec('0xbe'),require(_0x8fec('0xbf')));_0x117306[_0x8fec('0x8')](_0x8fec('0xc0'),require(_0x8fec('0xc1')));_0x117306[_0x8fec('0x8')]('/api/integrations/freshsales/accounts',require(_0x8fec('0xc2')));_0x117306[_0x8fec('0x8')](_0x8fec('0xc3'),require('./api/intFreshsalesConfiguration'));_0x117306[_0x8fec('0x8')](_0x8fec('0xc4'),require(_0x8fec('0xc5')));_0x117306[_0x8fec('0x8')]('/api/networks',require(_0x8fec('0xc6')));_0x117306['use'](_0x8fec('0xc7'),require(_0x8fec('0xc8')));_0x117306['use'](_0x8fec('0xc9'),require('./api/chatInternalMessage'));_0x117306['use'](_0x8fec('0xca'),require(_0x8fec('0xcb')));_0x117306[_0x8fec('0x8')]('/api/jscripty/questions/reports',require(_0x8fec('0xcc')));_0x117306[_0x8fec('0x8')](_0x8fec('0xcd'),require('./api/jscriptySessionReport'));_0x117306['use'](_0x8fec('0xce'),require(_0x8fec('0xcf')));_0x117306[_0x8fec('0x8')](_0x8fec('0xd0'),require(_0x8fec('0xd1')));_0x117306[_0x8fec('0x8')](_0x8fec('0xd2'),require(_0x8fec('0xd3')));_0x117306['use'](_0x8fec('0xd4'),require(_0x8fec('0xd5')));_0x117306[_0x8fec('0x8')](_0x8fec('0xd6'),require(_0x8fec('0xd7')));_0x117306[_0x8fec('0x8')](_0x8fec('0xd8'),require('./api/squareOdbc'));_0x117306[_0x8fec('0x8')](_0x8fec('0xd9'),require(_0x8fec('0xda')));_0x117306[_0x8fec('0x8')](_0x8fec('0xdb'),require(_0x8fec('0xdc')));_0x117306[_0x8fec('0x8')](_0x8fec('0xdd'),require(_0x8fec('0xde')));_0x117306['use'](_0x8fec('0xdf'),require(_0x8fec('0xe0')));_0x117306[_0x8fec('0x8')]('/api/license',require(_0x8fec('0xe1')));_0x117306[_0x8fec('0x8')](_0x8fec('0xe2'),require(_0x8fec('0xe3')));_0x117306[_0x8fec('0x8')](_0x8fec('0xe4'),require('./api/migration'));_0x117306[_0x8fec('0x8')](_0x8fec('0xe5'),require(_0x8fec('0xe6')));_0x117306['use'](_0x8fec('0xe7'),require(_0x8fec('0xe8')));_0x117306[_0x8fec('0x8')](_0x8fec('0xe9'),require('./api/mailTransferReport'));_0x117306[_0x8fec('0x8')](_0x8fec('0xea'),require(_0x8fec('0xeb')));_0x117306['use'](_0x8fec('0xec'),require('./api/faxTransferReport'));_0x117306[_0x8fec('0x8')](_0x8fec('0xed'),require(_0x8fec('0xee')));_0x117306['use']('/api/sms/reports/transfer',require(_0x8fec('0xef')));_0x117306[_0x8fec('0x8')]('/api/cm/lists',require(_0x8fec('0xf0')));_0x117306['use'](_0x8fec('0xf1'),require(_0x8fec('0xf2')));_0x117306[_0x8fec('0x8')](_0x8fec('0xf3'),require(_0x8fec('0xf4')));_0x117306[_0x8fec('0x8')](_0x8fec('0xf5'),require(_0x8fec('0xf6')));_0x117306[_0x8fec('0x8')](_0x8fec('0xf7'),require(_0x8fec('0xf8')));_0x117306['use'](_0x8fec('0xf9'),require(_0x8fec('0xfa')));_0x117306[_0x8fec('0x8')](_0x8fec('0xfb'),require(_0x8fec('0xfc')));_0x117306[_0x8fec('0x8')](_0x8fec('0xfd'),require(_0x8fec('0xfe')));_0x117306[_0x8fec('0x8')]('/api/whatsapp/interactions',require(_0x8fec('0xff')));_0x117306[_0x8fec('0x8')](_0x8fec('0x100'),require(_0x8fec('0x101')));_0x117306[_0x8fec('0x8')](_0x8fec('0x102'),require(_0x8fec('0x103')));_0x117306[_0x8fec('0x8')](_0x8fec('0x104'),require(_0x8fec('0x105')));_0x117306[_0x8fec('0x8')](_0x8fec('0x106'),require('./api/whatsappQueue'));_0x117306[_0x8fec('0x8')](_0x8fec('0x107'),require(_0x8fec('0x108')));_0x117306[_0x8fec('0x8')](_0x8fec('0x109'),require('./api/authLocal'));_0x117306[_0x8fec('0x8')](_0x8fec('0x10a'),require(_0x8fec('0x10b')));_0x117306[_0x8fec('0x8')](_0x8fec('0x10c'),require(_0x8fec('0x10d')));_0x117306[_0x8fec('0x8')](_0x8fec('0x10e'),require(_0x8fec('0x10f')));_0x117306['use']('/api/version',require(_0x8fec('0x110')));_0x117306['use'](_0x8fec('0x111'),require(_0x8fec('0x112')));_0x117306[_0x8fec('0x8')](_0x8fec('0x113'),require(_0x8fec('0x114')));_0x117306[_0x8fec('0x8')](_0x8fec('0x115'),require(_0x8fec('0x116')));_0x117306[_0x8fec('0x8')]('/apidoc',express[_0x8fec('0x117')](path[_0x8fec('0x118')](config[_0x8fec('0x119')],_0x8fec('0x11a'))));_0x117306['use'](_0x8fec('0x11b'),express[_0x8fec('0x117')](path[_0x8fec('0x118')](config['root'],_0x8fec('0x11b'))));_0x117306['use'](_0x8fec('0x11c'),express[_0x8fec('0x117')](path['join'](config['root'],_0x8fec('0x11c'))));_0x117306['use'](_0x8fec('0x11d'),express[_0x8fec('0x117')](path[_0x8fec('0x118')](config[_0x8fec('0x119')],_0x8fec('0x11e'),_0x8fec('0x11f'))));_0x117306['use']('/plugins',express['static'](path[_0x8fec('0x118')](config[_0x8fec('0x119')],_0x8fec('0x120'))));_0x117306[_0x8fec('0x121')](_0x8fec('0x122'))[_0x8fec('0x123')](errors[0x194]);_0x117306[_0x8fec('0x121')]('/*')[_0x8fec('0x123')](function(_0x4bf7fd,_0x2ed32a){_0x2ed32a[_0x8fec('0x124')](path[_0x8fec('0x125')](_0x117306[_0x8fec('0x123')](_0x8fec('0x126'))+_0x8fec('0x127')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index dca0f11..d9610b9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2611=['../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x326021,_0x35cf8c){var _0x97b7b3=function(_0x2e49ba){while(--_0x2e49ba){_0x326021['push'](_0x326021['shift']());}};_0x97b7b3(++_0x35cf8c);}(_0x2611,0xb3));var _0x1261=function(_0x2e640e,_0x558ace){_0x2e640e=_0x2e640e-0x0;var _0x2e025a=_0x2611[_0x2e640e];return _0x2e025a;};'use strict';var jayson=require(_0x1261('0x0'));var BPromise=require(_0x1261('0x1'));var _=require(_0x1261('0x2'));var config=require(_0x1261('0x3'));exports['listen']=function(){return new BPromise(function(_0x1be2ba,_0x2e7cf1){var _0x497df0={};_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x5')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x6')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/voiceQueue/voiceQueue.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/voiceRecording/voiceRecording.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x7')));_0x497df0=_['merge'](_0x497df0,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x8')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x9')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0xa')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0xb')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0xc')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0xd')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0xe')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0xf')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x10')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/mailMessage/mailMessage.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x11')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x12')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x13')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/faxApplication/faxApplication.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x14')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x15')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x16')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x17')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x18')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/smsInteraction/smsInteraction.rpc'));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x19')));_0x497df0=_['merge'](_0x497df0,require('../api/smsQueue/smsQueue.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x1a')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x1b')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x1c')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x1d')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x1e')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/chatMessage/chatMessage.rpc'));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x1f')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x20')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x21')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x22')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x23')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x24')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x25')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x26')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x27')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x28')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x29')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x2a')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x2b')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x2c')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x2d')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x2e')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x2f')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x30')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x31')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x32')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x33')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x34')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x35')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x36')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x37')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x38')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x39')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x3a')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x3b')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require('../api/campaign/campaign.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x3c')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x3d')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x3e')));_0x497df0=_['merge'](_0x497df0,require(_0x1261('0x3f')));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x40')));_0x497df0=_['merge'](_0x497df0,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x497df0=_[_0x1261('0x4')](_0x497df0,require(_0x1261('0x41')));var _0x36a476=jayson[_0x1261('0x42')](_0x497df0)['http']();var _0x4b3af4=config['rpc'][_0x1261('0x43')]||config[_0x1261('0x43')]+0x1;var _0x10e30b=config[_0x1261('0x44')]['ip']||_0x1261('0x45');_0x36a476['on'](_0x1261('0x46'),function(_0x42d3c8){return _0x2e7cf1(_0x42d3c8);});_0x36a476[_0x1261('0x47')](_0x4b3af4,_0x10e30b,function(){console['log'](_0x1261('0x48'),_0x10e30b,_0x4b3af4);require('../config/triggers')[_0x1261('0x49')]();return _0x1be2ba('RPC\x20listening\x20on\x20'+_0x10e30b+':'+_0x4b3af4);});});}; \ No newline at end of file +var _0x7da2=['../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x12b300,_0x49afd8){var _0x3f2071=function(_0x528694){while(--_0x528694){_0x12b300['push'](_0x12b300['shift']());}};_0x3f2071(++_0x49afd8);}(_0x7da2,0x1f2));var _0x27da=function(_0x8cc0e9,_0x3e2658){_0x8cc0e9=_0x8cc0e9-0x0;var _0x3071aa=_0x7da2[_0x8cc0e9];return _0x3071aa;};'use strict';var jayson=require(_0x27da('0x0'));var BPromise=require(_0x27da('0x1'));var _=require(_0x27da('0x2'));var config=require('../config/environment');exports[_0x27da('0x3')]=function(){return new BPromise(function(_0x1c03c7,_0x56463b){var _0x4d0323={};_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x5')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/voiceExtension/voiceExtension.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x6')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x7')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x8')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x9')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0xa')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0xb')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0xc')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0xd')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0xe')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/mailServerIn/mailServerIn.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0xf')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/mailQueue/mailQueue.rpc'));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x10')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x11')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x12')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x13')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x14')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/faxApplication/faxApplication.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x15')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/faxMessage/faxMessage.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x16')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x17')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/smsAccount/smsAccount.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x18')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x19')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1a')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1b')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1c')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1d')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1e')));_0x4d0323=_['merge'](_0x4d0323,require('../api/chatInteraction/chatInteraction.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x1f')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x20')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/cmContact/cmContact.rpc'));_0x4d0323=_['merge'](_0x4d0323,require('../api/cmHopper/cmHopper.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x21')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x22')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x23')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x24')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x25')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x26')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x27')));_0x4d0323=_['merge'](_0x4d0323,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x28')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x29')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x2a')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x2b')));_0x4d0323=_['merge'](_0x4d0323,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x2c')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x2d')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x2e')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x2f')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x30')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x31')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x32')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x33')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x34')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/squareProject/squareProject.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x35')));_0x4d0323=_['merge'](_0x4d0323,require('../api/squareMessage/squareMessage.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x36')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x37')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/plugin/plugin.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x38')));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4d0323=_[_0x27da('0x4')](_0x4d0323,require(_0x27da('0x39')));_0x4d0323=_['merge'](_0x4d0323,require(_0x27da('0x3a')));var _0x1a390c=jayson[_0x27da('0x3b')](_0x4d0323)[_0x27da('0x3c')]();var _0x576314=config[_0x27da('0x3d')]['port']||config[_0x27da('0x3e')]+0x1;var _0x2b0b0e=config['rpc']['ip']||_0x27da('0x3f');_0x1a390c['on'](_0x27da('0x40'),function(_0x34632c){return _0x56463b(_0x34632c);});_0x1a390c[_0x27da('0x3')](_0x576314,_0x2b0b0e,function(){console[_0x27da('0x41')](_0x27da('0x42'),_0x2b0b0e,_0x576314);require(_0x27da('0x43'))['default']();return _0x1c03c7(_0x27da('0x44')+_0x2b0b0e+':'+_0x576314);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fbaac84..9609c67 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 _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xcb91[_0x5948dd];return _0xb1f8be;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0cf653e..7481428 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 _0xb7a8=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x4b5756,_0x3c0c96){var _0x55741a=function(_0x5ec933){while(--_0x5ec933){_0x4b5756['push'](_0x4b5756['shift']());}};_0x55741a(++_0x3c0c96);}(_0xb7a8,0xec));var _0x8b7a=function(_0x43b8c7,_0x533648){_0x43b8c7=_0x43b8c7-0x0;var _0x128ff7=_0xb7a8[_0x43b8c7];return _0x128ff7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8b7a('0x0'),'E_AGI_ARGUMENT_PORT':_0x8b7a('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x8b7a('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x8b7a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x8b7a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x8b7a('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x8b7a('0x6'),'E_AGI_COMMAND_EMPTY':_0x8b7a('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8b7a('0x8'),'E_AGI_IVR_ENTRY':_0x8b7a('0x9')};function AGIError(_0x42e4c1){var _0x42e4c1=_0x42e4c1||null,_0x4045d9=_0x4045d9||[],_0x3e7238=0x1,_0xec0881='';if(!error[_0x42e4c1]){_0x42e4c1=_0x8b7a('0xa');}_0x4045d9[_0x8b7a('0xb')](error[_0x42e4c1]);while(arguments[_0x3e7238]){_0x4045d9['push'](arguments[_0x3e7238]);_0x3e7238++;}_0xec0881=util[_0x8b7a('0xc')]['apply'](util,_0x4045d9);this[_0x8b7a('0xd')]=_0xec0881;this[_0x8b7a('0xe')]=_0x42e4c1;}module['exports']=AGIError; \ No newline at end of file +var _0x0cd6=['push','format','apply','message','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x4ad542,_0x38ddc0){var _0x45fdb4=function(_0x1dfeef){while(--_0x1dfeef){_0x4ad542['push'](_0x4ad542['shift']());}};_0x45fdb4(++_0x38ddc0);}(_0x0cd6,0x113));var _0x60cd=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x0cd6[_0x2d344f];return _0x2e796b;};'use strict';var util=require(_0x60cd('0x0'));var error={'E_AGI_UNDEFINED':_0x60cd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x60cd('0x2'),'E_AGI_SERVER_CLOSE':_0x60cd('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x60cd('0x4'),'E_AGI_SOCKET_ERROR':_0x60cd('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x60cd('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x60cd('0x7'),'E_AGI_IVR_ENTRY':_0x60cd('0x8')};function AGIError(_0x4e3293){var _0x4e3293=_0x4e3293||null,_0x4b66cd=_0x4b66cd||[],_0x1249cb=0x1,_0x2c973='';if(!error[_0x4e3293]){_0x4e3293=_0x60cd('0x9');}_0x4b66cd[_0x60cd('0xa')](error[_0x4e3293]);while(arguments[_0x1249cb]){_0x4b66cd[_0x60cd('0xa')](arguments[_0x1249cb]);_0x1249cb++;}_0x2c973=util[_0x60cd('0xb')][_0x60cd('0xc')](util,_0x4b66cd);this[_0x60cd('0xd')]=_0x2c973;this[_0x60cd('0xe')]=_0x4e3293;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index aede628..563f56b 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 _0x1eba=['traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','getVertex','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid'];(function(_0x334d4a,_0x4b517b){var _0x438a8e=function(_0x37b1d4){while(--_0x37b1d4){_0x334d4a['push'](_0x334d4a['shift']());}};_0x438a8e(++_0x4b517b);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x1eba[_0x3932eb];return _0x5316e5;};'use strict';var _=require(_0xa1eb('0x0'));var logger=require(_0xa1eb('0x1'))(_0xa1eb('0x2'));var verticesWithRetry=[_0xa1eb('0x3'),_0xa1eb('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0xa1eb('0x5')]={};this[_0xa1eb('0x6')]=0x0;};Graph[_0xa1eb('0x7')][_0xa1eb('0x8')]=function(_0x138789){this[_0xa1eb('0x9')][_0x138789['id']]=_0x138789;this[_0xa1eb('0x5')][_0x138789['id']]=[];};Graph[_0xa1eb('0x7')][_0xa1eb('0xa')]=function(_0x7d2982,_0x2aebb6,_0x9d7113){this['edges'][_0x7d2982][_0xa1eb('0xb')]({'target':_0x2aebb6,'condition':_0x9d7113});this['numberOfEdges']+=0x1;};Graph[_0xa1eb('0x7')]['size']=function(){return _[_0xa1eb('0xc')](this['vertices']);};Graph[_0xa1eb('0x7')]['relations']=function(){return this[_0xa1eb('0x6')];};Graph[_0xa1eb('0x7')][_0xa1eb('0xd')]=function(_0x5839d3){return this[_0xa1eb('0x9')][_0x5839d3];};Graph[_0xa1eb('0x7')]['traverseBFS']=function(_0x16a623,_0x4a3774){if(!this['vertices'][_0x16a623]){return logger[_0xa1eb('0xe')]('no\x20vertex\x20found');}var _0x25d058=_0x4a3774(this[_0xa1eb('0x9')][_0x16a623]);if(!_0x25d058){return logger[_0xa1eb('0xe')](_0xa1eb('0xf'));}if(this[_0xa1eb('0x5')][_0x16a623][_0xa1eb('0x10')]===0x0){return logger[_0xa1eb('0xe')](_0xa1eb('0x11'));}for(var _0x211e42=0x0,_0x4aa527=[],_0xbd6a6b=![];_0x211e42\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','length','source','target','value','getSquareProject','then','catch','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','sync','production','log','SQUAREROOT','start','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json'];(function(_0x116174,_0x26ee40){var _0x248031=function(_0x501f31){while(--_0x501f31){_0x116174['push'](_0x116174['shift']());}};_0x248031(++_0x26ee40);}(_0x0ebf,0x14f));var _0xf0eb=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x0ebf[_0xae1a83];return _0xdb9da8;};'use strict';var parser=require(_0xf0eb('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xf0eb('0x1'));var moment=require(_0xf0eb('0x2'));var config=require(_0xf0eb('0x3'));var logger=require(_0xf0eb('0x4'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xf0eb('0x5'));var mailRpc=require(_0xf0eb('0x6'));var Graph=require(_0xf0eb('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf0eb('0x8')]=_['defaults'](config['agi'],{'ip':_0xf0eb('0x9'),'port':0x11dd});function connectionHandler(_0x482bf4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x482bf4);agiHandler(_0x482bf4);}catch(_0x1b7d71){logger[_0xf0eb('0xa')](_0x1b7d71[_0xf0eb('0xb')]);}});});}function listeningHandler(){console['log'](_0xf0eb('0xc'),config[_0xf0eb('0x8')][_0xf0eb('0xd')]);logger['info'](util[_0xf0eb('0xe')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xf0eb('0x8')]['ip'],config[_0xf0eb('0x8')]['port']));}function errorHandler(_0x107ea5){if(_0x107ea5&&_0x107ea5['name']&&_0x107ea5[_0xf0eb('0xf')]){logger[_0xf0eb('0xa')](util[_0xf0eb('0xe')](_0xf0eb('0x10'),_0x107ea5[_0xf0eb('0x11')],_0x107ea5[_0xf0eb('0xf')]));}else{logger[_0xf0eb('0xa')](util['format']('[ERROR]\x20%s',_0x107ea5[_0xf0eb('0xb')]));}}function closeHandler(){logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')](_0xf0eb('0x13'),this[_0xf0eb('0x14')],this[_0xf0eb('0x15')],this[_0xf0eb('0x16')],this[_0xf0eb('0x17')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3eba7d){logger[_0xf0eb('0xa')](_0x3eba7d[_0xf0eb('0xb')]);}}function timeoutHandler(){logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf0eb('0x14')],this[_0xf0eb('0x15')],this[_0xf0eb('0x16')],this[_0xf0eb('0x17')],this[_0xf0eb('0x18')]));}function hangupHandler(){logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf0eb('0x14')],this['calleridname'],this[_0xf0eb('0x16')],this[_0xf0eb('0x17')],this['uniqueid']));this[_0xf0eb('0x19')]=!![];}function getRoot(_0x47ab73){return parser[_0xf0eb('0x1a')](_0x47ab73,{'object':!![]})[_0xf0eb('0x1b')][_0xf0eb('0x1c')];}function addVertex(_0x306eb2,_0x376525,_0x342141){_0x376525[_0xf0eb('0x1d')]=_0x342141;if(_0x376525[_0xf0eb('0x1e')]('retry')){_0x376525[_0xf0eb('0x1f')]=parseInt(_0x376525[_0xf0eb('0x20')],0xa);}_0x306eb2[_0xf0eb('0x21')](_[_0xf0eb('0x22')](_0x376525,_0xf0eb('0x23')));}function initGraph(_0x3f4e3f,_0x4f6669){var _0x4d5da4=new Graph();for(var _0x57ca4f in _0x3f4e3f){if(_0x3f4e3f[_0xf0eb('0x1e')](_0x57ca4f)){if(_['isArray'](_0x3f4e3f[_0x57ca4f])){for(var _0x34fc16=0x0;_0x34fc16<_0x3f4e3f[_0x57ca4f][_0xf0eb('0x24')];_0x34fc16+=0x1){addVertex(_0x4d5da4,_0x3f4e3f[_0x57ca4f][_0x34fc16],_0x57ca4f);}}else{addVertex(_0x4d5da4,_0x3f4e3f[_0x57ca4f],_0x57ca4f);}}}for(var _0x4e3049=0x0;_0x4e3049<_0x4f6669[_0xf0eb('0x24')];_0x4e3049+=0x1){if(_0x4f6669[_0x4e3049][_0xf0eb('0x25')]&&_0x4f6669[_0x4e3049][_0xf0eb('0x26')]){_0x4d5da4['addEdge'](_0x4f6669[_0x4e3049]['source'],_0x4f6669[_0x4e3049][_0xf0eb('0x26')],_0x4f6669[_0x4e3049][_0xf0eb('0x27')]);}}return _0x4d5da4;}function getSquareProject(_0x3b71b6,_0x40502f){rpc[_0xf0eb('0x28')](_0x3b71b6)[_0xf0eb('0x29')](function(_0x37bd4d){_0x40502f(null,_0x37bd4d);})[_0xf0eb('0x2a')](function(_0x32aad3){_0x40502f(null,_0x32aad3);});}function createSquareReport(_0x23f764,_0x44e10c){rpc['createSquareReport'](_0x23f764)[_0xf0eb('0x29')](function(_0xf807e0){if(_0x44e10c){_0x44e10c(null,_0xf807e0);}})[_0xf0eb('0x2a')](function(_0x51263c){if(_0x44e10c){_0x44e10c(null,_0x51263c);}});}function setChannelVariables(_0xa97e6b){for(var _0x14064a in _0xa97e6b){if(_0xa97e6b[_0xf0eb('0x1e')](_0x14064a)){if(_0x14064a[_0xf0eb('0x2b')](_0xf0eb('0x2c'))===0x0){_0xa97e6b[_0x14064a[_0xf0eb('0x2d')](0x4)]=_0xa97e6b[_0x14064a];delete _0xa97e6b[_0x14064a];}}}}function getLogFromObject(_0x253f89){return util['inspect'](_0x253f89,{'showHidden':![],'depth':null});}function agiHandler(_0x5dfb2f){var _0x1a2239,_0x8383a5,_0x1a328e,_0x332916,_0x2f09b4;logger[_0xf0eb('0x2e')](_0xf0eb('0x2f'),JSON[_0xf0eb('0x30')](_0x5dfb2f,null,0x2));logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dfb2f[_0xf0eb('0x14')],_0x5dfb2f[_0xf0eb('0x15')],_0x5dfb2f[_0xf0eb('0x16')],_0x5dfb2f[_0xf0eb('0x17')],_0x5dfb2f[_0xf0eb('0x18')]));_0x5dfb2f['on'](_0xf0eb('0xa'),errorHandler);_0x5dfb2f['on'](_0xf0eb('0x31'),closeHandler);_0x5dfb2f['on'](_0xf0eb('0x32'),timeoutHandler);_0x5dfb2f['evtHangup']=![];_0x5dfb2f['on'](_0xf0eb('0x33'),hangupHandler);var _0x248d8e=getSquareProject[_0xf0eb('0x34')](null,_0x5dfb2f[_0xf0eb('0x14')]);if(_0x248d8e){if(_0x248d8e[_0xf0eb('0x35')]){_0x1a2239=getRoot(_0x248d8e[_0xf0eb('0x35')]);console[_0xf0eb('0x36')](_0xf0eb('0x37'),_0x1a2239);if(_0x1a2239&&_0x1a2239[_0xf0eb('0x38')]){logger[_0xf0eb('0x2e')](_0xf0eb('0x1c'),JSON[_0xf0eb('0x30')](_0x1a2239,null,0x2));_0x5dfb2f['joinAt']=moment()[_0xf0eb('0xe')](_0xf0eb('0x39'));_0x8383a5=initGraph(_[_0xf0eb('0x22')](_0x1a2239,_0xf0eb('0x23')),_0x1a2239[_0xf0eb('0x23')]);_0x1a328e=new Vertices(_0x5dfb2f,rpc,mailRpc);logger['info'](util[_0xf0eb('0xe')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dfb2f[_0xf0eb('0x14')],_0x5dfb2f[_0xf0eb('0x15')],_0x5dfb2f['callerid'],_0x5dfb2f[_0xf0eb('0x17')],_0x5dfb2f[_0xf0eb('0x18')]));_0x8383a5[_0xf0eb('0x3a')](_0x1a2239[_0xf0eb('0x38')]['id'],function(_0x4296eb){try{_0x4296eb=_0x1a328e[_0xf0eb('0x3b')](_0x4296eb);logger[_0xf0eb('0x2e')](_0xf0eb('0x3c'),JSON[_0xf0eb('0x30')](_0x4296eb,null,0x2));if(_0x4296eb[_0xf0eb('0x1d')]===_0xf0eb('0x3d')){logger[_0xf0eb('0x12')](_0xf0eb('0x3e'));_0x5dfb2f['context']=_0x4296eb[_0xf0eb('0x3f')]||_0x5dfb2f[_0xf0eb('0x3f')];_0x5dfb2f[_0xf0eb('0x40')]=_0x4296eb[_0xf0eb('0x40')];_0x5dfb2f['priority']=_0x4296eb[_0xf0eb('0x41')]?_0x4296eb[_0xf0eb('0x41')]-0x1:0x1;return null;}else if(_0x4296eb&&_0x1a328e[_0x4296eb[_0xf0eb('0x1d')]]){_0x2f09b4=_0x1a328e[_0x4296eb[_0xf0eb('0x1d')]](_0x4296eb);logger[_0xf0eb('0x12')]('response',JSON[_0xf0eb('0x30')](_0x2f09b4,null,0x2));if(_0x2f09b4&&_0x2f09b4[_0xf0eb('0x42')]===AGI_CODE_SUCCESS&&_0x2f09b4[_0xf0eb('0x43')]!==AGI_RESULT_ERROR&&!_0x5dfb2f[_0xf0eb('0x19')]){logger[_0xf0eb('0x2e')](_0xf0eb('0x44'),getLogFromObject(_0x2f09b4));return _[_0xf0eb('0x45')](_0x2f09b4[_0xf0eb('0x43')])?null:_0x2f09b4[_0xf0eb('0x43')]['toString']();}else{logger[_0xf0eb('0xa')](_0xf0eb('0x44'),getLogFromObject(_0x2f09b4));return null;}}else{logger['error'](_0xf0eb('0x46'));return null;}}catch(_0xe92c22){logger[_0xf0eb('0xa')](_0xe92c22[_0xf0eb('0xb')]);return null;}});if(_0x1a2239[_0xf0eb('0x47')]){logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')](_0xf0eb('0x48'),_0x5dfb2f[_0xf0eb('0x14')],_0x5dfb2f['calleridname'],_0x5dfb2f[_0xf0eb('0x16')],_0x5dfb2f[_0xf0eb('0x17')],_0x5dfb2f[_0xf0eb('0x18')]));_0x8383a5[_0xf0eb('0x3a')](_0x1a2239[_0xf0eb('0x47')]['id'],function(_0x4d1a18){try{_0x4d1a18=_0x1a328e[_0xf0eb('0x3b')](_0x4d1a18);logger[_0xf0eb('0x2e')](_0xf0eb('0x3c'),JSON[_0xf0eb('0x30')](_0x4d1a18,null,0x2));if(_0x4d1a18&&_0x1a328e[_0x4d1a18[_0xf0eb('0x1d')]]){_0x2f09b4=_0x1a328e[_0x4d1a18[_0xf0eb('0x1d')]](_0x4d1a18);if(_0x2f09b4){logger[_0xf0eb('0x2e')](_0xf0eb('0x44'),getLogFromObject(_0x2f09b4));return _[_0xf0eb('0x45')](_0x2f09b4[_0xf0eb('0x43')])?null:_0x2f09b4[_0xf0eb('0x43')][_0xf0eb('0x49')]();}else{logger['error'](_0xf0eb('0x44'),getLogFromObject(_0x2f09b4));return null;}}else{logger[_0xf0eb('0xa')](_0xf0eb('0x46'));return null;}}catch(_0x49153e){logger[_0xf0eb('0xa')](_0x49153e[_0xf0eb('0xb')]);return null;}});}logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dfb2f['arg_1'],_0x5dfb2f[_0xf0eb('0x15')],_0x5dfb2f[_0xf0eb('0x16')],_0x5dfb2f[_0xf0eb('0x17')],_0x5dfb2f['uniqueid']));logger[_0xf0eb('0x12')](util[_0xf0eb('0xe')](_0xf0eb('0x4a'),_0x5dfb2f[_0xf0eb('0x3f')],_0x5dfb2f[_0xf0eb('0x40')],parseInt(_0x5dfb2f[_0xf0eb('0x41')],0xa)+0x1));_0x5dfb2f['continueAt'](_0x5dfb2f[_0xf0eb('0x3f')],_0x5dfb2f[_0xf0eb('0x40')],parseInt(_0x5dfb2f[_0xf0eb('0x41')],0xa)+0x1);_0x5dfb2f[_0xf0eb('0x31')]();}}else{logger[_0xf0eb('0xa')](util[_0xf0eb('0xe')]('Project\x20%s\x20not\x20published',_0x5dfb2f['arg_1']));_0x5dfb2f[_0xf0eb('0x4b')](_0x5dfb2f['context'],_0x5dfb2f[_0xf0eb('0x40')],parseInt(_0x5dfb2f[_0xf0eb('0x41')],0xa)+0x1);_0x5dfb2f['close']();}}else{logger[_0xf0eb('0xa')](util[_0xf0eb('0xe')]('Project\x20%s\x20not\x20found',_0x5dfb2f['arg_1']));_0x5dfb2f[_0xf0eb('0x4b')](_0x5dfb2f['context'],_0x5dfb2f[_0xf0eb('0x40')],parseInt(_0x5dfb2f[_0xf0eb('0x41')],0xa)+0x1);_0x5dfb2f[_0xf0eb('0x31')]();}}function main(){var _0x58a4a7;return utilLicense['getLicense']()[_0xf0eb('0x29')](function(_0x5b241e){if(_0x5b241e){if(_0x5b241e[_0xf0eb('0x4c')]){if(_0x5b241e[_0xf0eb('0x4d')]&&_0x5b241e[_0xf0eb('0x4d')]>0x0){logger['info'](util['format'](_0xf0eb('0x4e'),_0x5b241e['callysquare']));_0x58a4a7=_0x5b241e[_0xf0eb('0x4d')];}else{logger[_0xf0eb('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xf0eb('0x12')](_0xf0eb('0x4f'));_0x58a4a7=-0x1;}}})[_0xf0eb('0x2a')](function(_0x23bd11){logger[_0xf0eb('0xa')](_0xf0eb('0x50'),_0x23bd11[_0xf0eb('0xb')]);})['finally'](function(){var _0x1766d1=require(_0xf0eb('0x51'))(config[_0xf0eb('0x8')][_0xf0eb('0xd')],config[_0xf0eb('0x8')]['ip'],_0x58a4a7);_0x1766d1['on']('error',errorHandler);_0x1766d1['on'](_0xf0eb('0x52'),listeningHandler);_0x1766d1['on'](_0xf0eb('0x53'),connectionHandler);_0x1766d1['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x8442=['Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','lodash','syncho','util','moment','../../config/logger','agi','../../config/license/util','./rpc','./graph','defaults','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','log','SQUAREROOT','start','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published'];(function(_0x3aed78,_0x543bf4){var _0x589655=function(_0x5c5640){while(--_0x5c5640){_0x3aed78['push'](_0x3aed78['shift']());}};_0x589655(++_0x543bf4);}(_0x8442,0x118));var _0x2844=function(_0x43b6d7,_0x1d4625){_0x43b6d7=_0x43b6d7-0x0;var _0x2c346a=_0x8442[_0x43b6d7];return _0x2c346a;};'use strict';var parser=require('xml2json');var _=require(_0x2844('0x0'));var syncho=require(_0x2844('0x1'));var util=require(_0x2844('0x2'));var moment=require(_0x2844('0x3'));var config=require('../../config/environment');var logger=require(_0x2844('0x4'))(_0x2844('0x5'));var utilLicense=require(_0x2844('0x6'));var rpc=require(_0x2844('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x2844('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x2844('0x9')](config[_0x2844('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x290029){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x290029);agiHandler(_0x290029);}catch(_0x4110f5){logger[_0x2844('0xa')](_0x4110f5['stack']);}});});}function listeningHandler(){console['log'](_0x2844('0xb'),config['agi'][_0x2844('0xc')]);logger[_0x2844('0xd')](util[_0x2844('0xe')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2844('0x5')]['ip'],config['agi'][_0x2844('0xc')]));}function errorHandler(_0x31e83a){if(_0x31e83a&&_0x31e83a[_0x2844('0xf')]&&_0x31e83a['message']){logger[_0x2844('0xa')](util[_0x2844('0xe')](_0x2844('0x10'),_0x31e83a['name'],_0x31e83a['message']));}else{logger['error'](util['format'](_0x2844('0x11'),_0x31e83a[_0x2844('0x12')]));}}function closeHandler(){logger[_0x2844('0xd')](util[_0x2844('0xe')](_0x2844('0x13'),this[_0x2844('0x14')],this['calleridname'],this['callerid'],this['dnid'],this[_0x2844('0x15')]));try{createSquareReport(this);}catch(_0x31bdf6){logger[_0x2844('0xa')](_0x31bdf6[_0x2844('0x12')]);}}function timeoutHandler(){logger['info'](util['format'](_0x2844('0x16'),this[_0x2844('0x14')],this[_0x2844('0x17')],this[_0x2844('0x18')],this[_0x2844('0x19')],this[_0x2844('0x15')]));}function hangupHandler(){logger['info'](util[_0x2844('0xe')](_0x2844('0x1a'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this['uniqueid']));this[_0x2844('0x1b')]=!![];}function getRoot(_0x56e4f7){return parser[_0x2844('0x1c')](_0x56e4f7,{'object':!![]})[_0x2844('0x1d')][_0x2844('0x1e')];}function addVertex(_0x34749c,_0x391163,_0x20ed26){_0x391163[_0x2844('0x1f')]=_0x20ed26;if(_0x391163['hasOwnProperty'](_0x2844('0x20'))){_0x391163[_0x2844('0x21')]=parseInt(_0x391163[_0x2844('0x20')],0xa);}_0x34749c['addVertex'](_['omit'](_0x391163,_0x2844('0x22')));}function initGraph(_0x3523ea,_0x1b7cfc){var _0x3ba76c=new Graph();for(var _0x6b6d48 in _0x3523ea){if(_0x3523ea[_0x2844('0x23')](_0x6b6d48)){if(_[_0x2844('0x24')](_0x3523ea[_0x6b6d48])){for(var _0xfbc879=0x0;_0xfbc879<_0x3523ea[_0x6b6d48][_0x2844('0x25')];_0xfbc879+=0x1){addVertex(_0x3ba76c,_0x3523ea[_0x6b6d48][_0xfbc879],_0x6b6d48);}}else{addVertex(_0x3ba76c,_0x3523ea[_0x6b6d48],_0x6b6d48);}}}for(var _0x1ce57a=0x0;_0x1ce57a<_0x1b7cfc[_0x2844('0x25')];_0x1ce57a+=0x1){if(_0x1b7cfc[_0x1ce57a][_0x2844('0x26')]&&_0x1b7cfc[_0x1ce57a][_0x2844('0x27')]){_0x3ba76c[_0x2844('0x28')](_0x1b7cfc[_0x1ce57a][_0x2844('0x26')],_0x1b7cfc[_0x1ce57a][_0x2844('0x27')],_0x1b7cfc[_0x1ce57a][_0x2844('0x29')]);}}return _0x3ba76c;}function getSquareProject(_0x236708,_0x54feb1){rpc[_0x2844('0x2a')](_0x236708)[_0x2844('0x2b')](function(_0x151980){_0x54feb1(null,_0x151980);})[_0x2844('0x2c')](function(_0x4e5a1a){_0x54feb1(null,_0x4e5a1a);});}function createSquareReport(_0x14032b,_0x41d36c){rpc[_0x2844('0x2d')](_0x14032b)[_0x2844('0x2b')](function(_0x1ca026){if(_0x41d36c){_0x41d36c(null,_0x1ca026);}})[_0x2844('0x2c')](function(_0x3bcfbc){if(_0x41d36c){_0x41d36c(null,_0x3bcfbc);}});}function setChannelVariables(_0x2ecdd0){for(var _0xa4f0ef in _0x2ecdd0){if(_0x2ecdd0[_0x2844('0x23')](_0xa4f0ef)){if(_0xa4f0ef[_0x2844('0x2e')](_0x2844('0x2f'))===0x0){_0x2ecdd0[_0xa4f0ef[_0x2844('0x30')](0x4)]=_0x2ecdd0[_0xa4f0ef];delete _0x2ecdd0[_0xa4f0ef];}}}}function getLogFromObject(_0x29f7e7){return util[_0x2844('0x31')](_0x29f7e7,{'showHidden':![],'depth':null});}function agiHandler(_0x3157ee){var _0x48d2de,_0x1bf86a,_0x2e471a,_0x1b220b,_0xabff91;logger[_0x2844('0x32')](_0x2844('0x33'),JSON[_0x2844('0x34')](_0x3157ee,null,0x2));logger['info'](util[_0x2844('0xe')](_0x2844('0x35'),_0x3157ee['arg_1'],_0x3157ee[_0x2844('0x17')],_0x3157ee[_0x2844('0x18')],_0x3157ee[_0x2844('0x19')],_0x3157ee[_0x2844('0x15')]));_0x3157ee['on'](_0x2844('0xa'),errorHandler);_0x3157ee['on'](_0x2844('0x36'),closeHandler);_0x3157ee['on'](_0x2844('0x37'),timeoutHandler);_0x3157ee[_0x2844('0x1b')]=![];_0x3157ee['on'](_0x2844('0x38'),hangupHandler);var _0x2b0958=getSquareProject[_0x2844('0x39')](null,_0x3157ee[_0x2844('0x14')]);if(_0x2b0958){if(_0x2b0958[_0x2844('0x3a')]){_0x48d2de=getRoot(_0x2b0958[_0x2844('0x3a')]);console[_0x2844('0x3b')](_0x2844('0x3c'),_0x48d2de);if(_0x48d2de&&_0x48d2de[_0x2844('0x3d')]){logger['debug'](_0x2844('0x1e'),JSON[_0x2844('0x34')](_0x48d2de,null,0x2));_0x3157ee['joinAt']=moment()[_0x2844('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bf86a=initGraph(_[_0x2844('0x3e')](_0x48d2de,_0x2844('0x22')),_0x48d2de[_0x2844('0x22')]);_0x2e471a=new Vertices(_0x3157ee,rpc,mailRpc);logger['info'](util[_0x2844('0xe')](_0x2844('0x3f'),_0x3157ee[_0x2844('0x14')],_0x3157ee['calleridname'],_0x3157ee[_0x2844('0x18')],_0x3157ee[_0x2844('0x19')],_0x3157ee[_0x2844('0x15')]));_0x1bf86a[_0x2844('0x40')](_0x48d2de[_0x2844('0x3d')]['id'],function(_0x1c51ab){try{_0x1c51ab=_0x2e471a[_0x2844('0x41')](_0x1c51ab);logger[_0x2844('0x32')](_0x2844('0x42'),JSON[_0x2844('0x34')](_0x1c51ab,null,0x2));if(_0x1c51ab[_0x2844('0x1f')]===_0x2844('0x43')){logger['info'](_0x2844('0x44'));_0x3157ee[_0x2844('0x45')]=_0x1c51ab[_0x2844('0x45')]||_0x3157ee[_0x2844('0x45')];_0x3157ee[_0x2844('0x46')]=_0x1c51ab[_0x2844('0x46')];_0x3157ee['priority']=_0x1c51ab[_0x2844('0x47')]?_0x1c51ab[_0x2844('0x47')]-0x1:0x1;return null;}else if(_0x1c51ab&&_0x2e471a[_0x1c51ab[_0x2844('0x1f')]]){_0xabff91=_0x2e471a[_0x1c51ab['agicommand']](_0x1c51ab);logger[_0x2844('0xd')](_0x2844('0x48'),JSON['stringify'](_0xabff91,null,0x2));if(_0xabff91&&_0xabff91[_0x2844('0x49')]===AGI_CODE_SUCCESS&&_0xabff91[_0x2844('0x4a')]!==AGI_RESULT_ERROR&&!_0x3157ee[_0x2844('0x1b')]){logger[_0x2844('0x32')]('response',getLogFromObject(_0xabff91));return _[_0x2844('0x4b')](_0xabff91[_0x2844('0x4a')])?null:_0xabff91[_0x2844('0x4a')][_0x2844('0x4c')]();}else{logger[_0x2844('0xa')](_0x2844('0x48'),getLogFromObject(_0xabff91));return null;}}else{logger[_0x2844('0xa')](_0x2844('0x4d'));return null;}}catch(_0x18db27){logger[_0x2844('0xa')](_0x18db27[_0x2844('0x12')]);return null;}});if(_0x48d2de[_0x2844('0x4e')]){logger['info'](util['format'](_0x2844('0x4f'),_0x3157ee[_0x2844('0x14')],_0x3157ee[_0x2844('0x17')],_0x3157ee[_0x2844('0x18')],_0x3157ee[_0x2844('0x19')],_0x3157ee['uniqueid']));_0x1bf86a['traverseBFS'](_0x48d2de['finally']['id'],function(_0x3d1791){try{_0x3d1791=_0x2e471a[_0x2844('0x41')](_0x3d1791);logger['debug'](_0x2844('0x42'),JSON[_0x2844('0x34')](_0x3d1791,null,0x2));if(_0x3d1791&&_0x2e471a[_0x3d1791['agicommand']]){_0xabff91=_0x2e471a[_0x3d1791['agicommand']](_0x3d1791);if(_0xabff91){logger[_0x2844('0x32')](_0x2844('0x48'),getLogFromObject(_0xabff91));return _[_0x2844('0x4b')](_0xabff91[_0x2844('0x4a')])?null:_0xabff91['result'][_0x2844('0x4c')]();}else{logger[_0x2844('0xa')](_0x2844('0x48'),getLogFromObject(_0xabff91));return null;}}else{logger[_0x2844('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x318d43){logger[_0x2844('0xa')](_0x318d43[_0x2844('0x12')]);return null;}});}logger['info'](util[_0x2844('0xe')](_0x2844('0x50'),_0x3157ee[_0x2844('0x14')],_0x3157ee[_0x2844('0x17')],_0x3157ee[_0x2844('0x18')],_0x3157ee[_0x2844('0x19')],_0x3157ee['uniqueid']));logger[_0x2844('0xd')](util[_0x2844('0xe')](_0x2844('0x51'),_0x3157ee['context'],_0x3157ee[_0x2844('0x46')],parseInt(_0x3157ee[_0x2844('0x47')],0xa)+0x1));_0x3157ee[_0x2844('0x52')](_0x3157ee[_0x2844('0x45')],_0x3157ee[_0x2844('0x46')],parseInt(_0x3157ee[_0x2844('0x47')],0xa)+0x1);_0x3157ee['close']();}}else{logger['error'](util[_0x2844('0xe')](_0x2844('0x53'),_0x3157ee['arg_1']));_0x3157ee['continueAt'](_0x3157ee[_0x2844('0x45')],_0x3157ee[_0x2844('0x46')],parseInt(_0x3157ee[_0x2844('0x47')],0xa)+0x1);_0x3157ee[_0x2844('0x36')]();}}else{logger['error'](util[_0x2844('0xe')](_0x2844('0x54'),_0x3157ee['arg_1']));_0x3157ee[_0x2844('0x52')](_0x3157ee[_0x2844('0x45')],_0x3157ee['extension'],parseInt(_0x3157ee[_0x2844('0x47')],0xa)+0x1);_0x3157ee[_0x2844('0x36')]();}}function main(){var _0x437acb;return utilLicense['getLicense']()['then'](function(_0x218646){if(_0x218646){if(_0x218646[_0x2844('0x55')]){if(_0x218646['callysquare']&&_0x218646[_0x2844('0x56')]>0x0){logger[_0x2844('0xd')](util[_0x2844('0xe')]('[LICENSE]\x20CHANNELS:\x20%s',_0x218646[_0x2844('0x56')]));_0x437acb=_0x218646['callysquare'];}else{logger[_0x2844('0xd')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2844('0xd')](_0x2844('0x57'));_0x437acb=-0x1;}}})[_0x2844('0x2c')](function(_0x496cc0){logger[_0x2844('0xa')](_0x2844('0x58'),_0x496cc0[_0x2844('0x12')]);})['finally'](function(){var _0x5d518b=require(_0x2844('0x59'))(config['agi'][_0x2844('0xc')],config[_0x2844('0x5')]['ip'],_0x437acb);_0x5d518b['on'](_0x2844('0xa'),errorHandler);_0x5d518b['on'](_0x2844('0x5a'),listeningHandler);_0x5d518b['on']('connection',connectionHandler);_0x5d518b['on'](_0x2844('0x36'),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 9358b97..25cd4ff 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(_0x2456ba,_0x1e2012){var _0x3ec6ae=function(_0x303b24){while(--_0x303b24){_0x2456ba['push'](_0x2456ba['shift']());}};_0x3ec6ae(++_0x1e2012);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x2068d1,_0x479ec1){var _0x3c06be=function(_0x1136b5){while(--_0x1136b5){_0x2068d1['push'](_0x2068d1['shift']());}};_0x3c06be(++_0x479ec1);}(_0x34e8,0x12c));var _0x834e=function(_0x25380d,_0x2a077a){_0x25380d=_0x25380d-0x0;var _0x51ee1d=_0x34e8[_0x25380d];return _0x51ee1d;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 105b494..f2febd5 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3ce089,_0x1a4890){var _0x35b89d=function(_0x57f388){while(--_0x57f388){_0x3ce089['push'](_0x3ce089['shift']());}};_0x35b89d(++_0x1a4890);}(_0x7a54,0x106));var _0x47a5=function(_0x469fae,_0x51246a){_0x469fae=_0x469fae-0x0;var _0x4a70a3=_0x7a54[_0x469fae];return _0x4a70a3;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x25d4ee,_0xc95872){var _0x214a35=function(_0x4285a0){while(--_0x4285a0){_0x25d4ee['push'](_0x25d4ee['shift']());}};_0x214a35(++_0xc95872);}(_0xb10b,0x12a));var _0xbb10=function(_0x175d1e,_0x48ad7e){_0x175d1e=_0x175d1e-0x0;var _0x10aefc=_0xb10b[_0x175d1e];return _0x10aefc;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 81e0101..807a676 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 _0x4f08=['Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','http','then','error','message','result','catch','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name'];(function(_0x214a00,_0xb4b4ce){var _0xff540c=function(_0x251620){while(--_0x251620){_0x214a00['push'](_0x214a00['shift']());}};_0xff540c(++_0xb4b4ce);}(_0x4f08,0x194));var _0x84f0=function(_0x2aa87a,_0x4a251d){_0x2aa87a=_0x2aa87a-0x0;var _0x5b869b=_0x4f08[_0x2aa87a];return _0x5b869b;};'use strict';var BPromise=require(_0x84f0('0x0'));var moment=require(_0x84f0('0x1'));var _=require('lodash');var util=require(_0x84f0('0x2'));var jayson=require(_0x84f0('0x3'));var client=jayson['client'][_0x84f0('0x4')]({'port':0x2329});function request(_0x45a345,_0xa3f34f){return new BPromise(function(_0x5ce5cb,_0x2b6c5d){return client['request'](_0x45a345,_0xa3f34f)[_0x84f0('0x5')](function(_0x3a1161){if(_0x3a1161[_0x84f0('0x6')]){return _0x2b6c5d(_0x3a1161['error'][_0x84f0('0x7')]);}else{return _0x5ce5cb(_0x3a1161[_0x84f0('0x8')]);}})[_0x84f0('0x9')](function(_0x39058e){return _0x2b6c5d(_0x39058e);});});}exports[_0x84f0('0xa')]=function(_0x1b256f){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1b256f},'attributes':['production']}});};exports[_0x84f0('0xb')]=function(_0x13067f){return request(_0x84f0('0xc'),{'options':{'raw':![],'where':{'id':_0x13067f},'include':[{'model':_0x84f0('0xd'),'as':_0x84f0('0xe')}],'attributes':['id',_0x84f0('0xf'),_0x84f0('0x10')]}});};exports[_0x84f0('0x11')]=function(_0x379151){return request('ShowSquareProject',{'options':{'where':{'id':_0x379151},'attributes':[_0x84f0('0xf')]}});};exports['getVoiceQueueById']=function(_0x29a31c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x29a31c},'attributes':[_0x84f0('0xf')]}});};exports[_0x84f0('0x12')]=function(_0x278f4e){return request(_0x84f0('0x13'),{'options':{'where':{'id':_0x278f4e},'attributes':[_0x84f0('0xf')]}});};exports[_0x84f0('0x14')]=function(_0x4167f3){return request(_0x84f0('0x15'),{'options':{'where':{'id':_0x4167f3},'attributes':[_0x84f0('0x16')]}});};exports['getUserById']=function(_0xb65839){return request(_0x84f0('0x17'),{'options':{'where':{'id':_0xb65839},'attributes':[_0x84f0('0xf')]}});};exports['getTrunkById']=function(_0x4ac111){return request(_0x84f0('0x18'),{'options':{'where':{'id':_0x4ac111},'attributes':[_0x84f0('0xf')]}});};exports[_0x84f0('0x19')]=function(_0x40f536){return request(_0x84f0('0x1a'),{'options':{'where':{'id':_0x40f536},'attributes':[_0x84f0('0x1b')]}});};exports['getIntervalById']=function(_0x597519){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x597519},'include':[{'model':'Interval','as':_0x84f0('0x1c')}]}});};exports['getSmsAccountById']=function(_0x3353f9){return request(_0x84f0('0x1d'),{'options':{'where':{'id':_0x3353f9},'attributes':['id',_0x84f0('0xf')]}});};exports[_0x84f0('0x1e')]=function(_0x55ad0a){return request(_0x84f0('0x1f'),{'body':_0x55ad0a});};exports[_0x84f0('0x20')]=function(_0x2611cd){return request('CreateSquareDetailsReport',{'body':_0x2611cd});};exports['createSquareReport']=function(_0x2f46a0){return request(_0x84f0('0x21'),{'body':_[_0x84f0('0x22')](_0x2f46a0,{'project_name':_0x2f46a0[_0x84f0('0x23')],'prev_project_name':_0x2f46a0[_0x84f0('0x24')]||'','is_subproject':_0x2f46a0['arg_2']?!![]:![],'leaveAt':moment()[_0x84f0('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x1e4da9){return request(_0x84f0('0x26'),{'body':_0x1e4da9});};exports[_0x84f0('0x27')]=function(_0x3c9ac9){return request('CreateSquareMessage',{'body':_0x3c9ac9});};exports[_0x84f0('0x28')]=function(_0xdf332d){return request(_0x84f0('0x29'),{'options':{'raw':![],'where':{'phone':_0xdf332d[_0x84f0('0x2a')],'ListId':_0xdf332d[_0x84f0('0x2b')]}}})[_0x84f0('0x5')](function(_0x234b0f){if(_0x234b0f){return _0x234b0f;}return request(_0x84f0('0x2c'),{'body':_0xdf332d});});};exports[_0x84f0('0x2d')]=function(_0x4c1186){return request(_0x84f0('0x2e'),{'options':{'where':{'id':_0x4c1186},'attributes':['name']}});};exports[_0x84f0('0x2f')]=function(_0x4edc8b,_0x4f04ff){return request(_0x84f0('0x30'),{'body':{'interface':_0x4f04ff},'options':{'where':_0x4edc8b}});};exports['agentPause']=function(_0x30e559,_0x3e98db,_0x1294de){return request(_0x84f0('0x31'),{'body':{'type':_0x3e98db,'uniqueid':_0x1294de},'options':{'where':_0x30e559}});};exports[_0x84f0('0x32')]=function(_0x2f0164){return request(_0x84f0('0x33'),{'body':{},'options':{'where':_0x2f0164}});};exports[_0x84f0('0x34')]=function(_0xca82a7){return request(_0x84f0('0x35'),{'body':{},'options':{'where':_0xca82a7}});}; \ No newline at end of file +var _0xcd7f=['ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','UnpauseUser','bluebird','moment','lodash','http','then','error','message','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','name','email','getVoiceQueueById','ShowVariable','dsn','getUserById'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcd7f,0x16e));var _0xfcd7=function(_0x2fa1be,_0x5e646f){_0x2fa1be=_0x2fa1be-0x0;var _0x1e016c=_0xcd7f[_0x2fa1be];return _0x1e016c;};'use strict';var BPromise=require(_0xfcd7('0x0'));var moment=require(_0xfcd7('0x1'));var _=require(_0xfcd7('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson['client'][_0xfcd7('0x3')]({'port':0x2329});function request(_0x355263,_0x2555a3){return new BPromise(function(_0x45208c,_0x22d95c){return client['request'](_0x355263,_0x2555a3)[_0xfcd7('0x4')](function(_0x33f75b){if(_0x33f75b[_0xfcd7('0x5')]){return _0x22d95c(_0x33f75b[_0xfcd7('0x5')][_0xfcd7('0x6')]);}else{return _0x45208c(_0x33f75b['result']);}})['catch'](function(_0xc7c46e){return _0x22d95c(_0xc7c46e);});});}exports[_0xfcd7('0x7')]=function(_0x9136f0){return request(_0xfcd7('0x8'),{'options':{'raw':![],'where':{'name':_0x9136f0},'attributes':[_0xfcd7('0x9')]}});};exports[_0xfcd7('0xa')]=function(_0x2f20a1){return request(_0xfcd7('0xb'),{'options':{'raw':![],'where':{'id':_0x2f20a1},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xfcd7('0xc'),_0xfcd7('0xd')]}});};exports['getSquareProjectById']=function(_0x5969f9){return request(_0xfcd7('0x8'),{'options':{'where':{'id':_0x5969f9},'attributes':['name']}});};exports[_0xfcd7('0xe')]=function(_0x341d9d){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x341d9d},'attributes':[_0xfcd7('0xc')]}});};exports['getVariableById']=function(_0x1f0eda){return request(_0xfcd7('0xf'),{'options':{'where':{'id':_0x1f0eda},'attributes':[_0xfcd7('0xc')]}});};exports['getSquareOdbcById']=function(_0x26f09a){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x26f09a},'attributes':[_0xfcd7('0x10')]}});};exports[_0xfcd7('0x11')]=function(_0x9d4b8e){return request('ShowUser',{'options':{'where':{'id':_0x9d4b8e},'attributes':[_0xfcd7('0xc')]}});};exports['getTrunkById']=function(_0x1aca74){return request(_0xfcd7('0x12'),{'options':{'where':{'id':_0x1aca74},'attributes':[_0xfcd7('0xc')]}});};exports[_0xfcd7('0x13')]=function(_0x58916c){return request(_0xfcd7('0x14'),{'options':{'where':{'id':_0x58916c},'attributes':[_0xfcd7('0x15')]}});};exports[_0xfcd7('0x16')]=function(_0x4e1965){return request(_0xfcd7('0x17'),{'options':{'raw':![],'where':{'id':_0x4e1965},'include':[{'model':_0xfcd7('0x18'),'as':_0xfcd7('0x19')}]}});};exports[_0xfcd7('0x1a')]=function(_0x4f6521){return request(_0xfcd7('0x1b'),{'options':{'where':{'id':_0x4f6521},'attributes':['id','name']}});};exports[_0xfcd7('0x1c')]=function(_0x44a531){return request(_0xfcd7('0x1d'),{'body':_0x44a531});};exports['createSquareDetailsReport']=function(_0x503899){return request('CreateSquareDetailsReport',{'body':_0x503899});};exports[_0xfcd7('0x1e')]=function(_0x41fe14){return request('CreateSquareReport',{'body':_[_0xfcd7('0x1f')](_0x41fe14,{'project_name':_0x41fe14[_0xfcd7('0x20')],'prev_project_name':_0x41fe14['arg_2']||'','is_subproject':_0x41fe14[_0xfcd7('0x21')]?!![]:![],'leaveAt':moment()[_0xfcd7('0x22')](_0xfcd7('0x23'))})});};exports[_0xfcd7('0x24')]=function(_0x5b88ca){return request(_0xfcd7('0x25'),{'body':_0x5b88ca});};exports['createSquareMessage']=function(_0x57e177){return request(_0xfcd7('0x26'),{'body':_0x57e177});};exports[_0xfcd7('0x27')]=function(_0x2c0fdd){return request(_0xfcd7('0x28'),{'options':{'raw':![],'where':{'phone':_0x2c0fdd['phone'],'ListId':_0x2c0fdd[_0xfcd7('0x29')]}}})['then'](function(_0x42b1cd){if(_0x42b1cd){return _0x42b1cd;}return request(_0xfcd7('0x2a'),{'body':_0x2c0fdd});});};exports['getPauseById']=function(_0x306377){return request(_0xfcd7('0x2b'),{'options':{'where':{'id':_0x306377},'attributes':[_0xfcd7('0xc')]}});};exports['agentLogin']=function(_0x16f2d8,_0x3145b3){return request(_0xfcd7('0x2c'),{'body':{'interface':_0x3145b3},'options':{'where':_0x16f2d8}});};exports[_0xfcd7('0x2d')]=function(_0x1584c6,_0x59eb9a,_0x206337){return request(_0xfcd7('0x2e'),{'body':{'type':_0x59eb9a,'uniqueid':_0x206337},'options':{'where':_0x1584c6}});};exports['agentUnpause']=function(_0x15a91e){return request(_0xfcd7('0x2f'),{'body':{},'options':{'where':_0x15a91e}});};exports['agentLogout']=function(_0x3bbe73){return request('LogoutUser',{'body':{},'options':{'where':_0x3bbe73}});}; \ 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 db36d97..eb302f3 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 _0x207c=['./lex','exports'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x207c,0x1e8));var _0xc207=function(_0x19dd8a,_0x4af545){_0x19dd8a=_0x19dd8a-0x0;var _0x6245d3=_0x207c[_0x19dd8a];return _0x6245d3;};var polly=require('./polly');var lex=require(_0xc207('0x0'));module[_0xc207('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xaba6=['./polly','./lex'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xaba6,0xe2));var _0x6aba=function(_0x19a040,_0x2b1801){_0x19a040=_0x19a040-0x0;var _0x17974b=_0xaba6[_0x19a040];return _0x17974b;};var polly=require(_0x6aba('0x0'));var lex=require(_0x6aba('0x1'));module['exports']={'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 c5c2e15..9e7b9e9 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 _0x83d3=['./lib/api','exports'];(function(_0x247fbe,_0x3f1407){var _0x8232e7=function(_0x38a054){while(--_0x38a054){_0x247fbe['push'](_0x247fbe['shift']());}};_0x8232e7(++_0x3f1407);}(_0x83d3,0x17c));var _0x383d=function(_0x531ec4,_0x203380){_0x531ec4=_0x531ec4-0x0;var _0x43fd6f=_0x83d3[_0x531ec4];return _0x43fd6f;};'use strict';var lex=require(_0x383d('0x0'));module[_0x383d('0x1')]=function(_0x249fdb,_0x381df6,_0x37aa24,_0x5af289,_0x9287d4,_0x1184a6){return lex(_0x249fdb,_0x381df6,_0x37aa24,_0x5af289,_0x9287d4,_0x1184a6);}; \ No newline at end of file +var _0x073e=['exports','./lib/api'];(function(_0x2bd5de,_0x26a036){var _0x109d58=function(_0x2edd89){while(--_0x2edd89){_0x2bd5de['push'](_0x2bd5de['shift']());}};_0x109d58(++_0x26a036);}(_0x073e,0x181));var _0xe073=function(_0x2e9d42,_0x2c50e1){_0x2e9d42=_0x2e9d42-0x0;var _0x172852=_0x073e[_0x2e9d42];return _0x172852;};'use strict';var lex=require(_0xe073('0x0'));module[_0xe073('0x1')]=function(_0x876bb9,_0x358375,_0x4a6f42,_0x488838,_0x4e8df8,_0x3eff57){return lex(_0x876bb9,_0x358375,_0x4a6f42,_0x488838,_0x4e8df8,_0x3eff57);}; \ 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 c944aac..3988847 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 _0x80e0=['aws-sdk','postText','slots','hasOwnProperty','exports','LexRuntime','$LATEST','bluebird'];(function(_0x205232,_0x212415){var _0xefbcbc=function(_0x474b12){while(--_0x474b12){_0x205232['push'](_0x205232['shift']());}};_0xefbcbc(++_0x212415);}(_0x80e0,0x1a7));var _0x080e=function(_0x4ac85c,_0x4eb9d){_0x4ac85c=_0x4ac85c-0x0;var _0x5299c5=_0x80e0[_0x4ac85c];return _0x5299c5;};'use strict';var BPromise=require(_0x080e('0x0'));var AWS=require(_0x080e('0x1'));function lexResult(_0x324ec4,_0x16f8ce){return new BPromise(function(_0x1e7e0d,_0x2cb180){_0x324ec4[_0x080e('0x2')](_0x16f8ce,function(_0x57d17a,_0x93e2d1){if(_0x57d17a){_0x2cb180(_0x57d17a);}if(_0x93e2d1[_0x080e('0x3')]){for(const _0x43466d in _0x93e2d1[_0x080e('0x3')]){if(_0x93e2d1[_0x080e('0x3')][_0x080e('0x4')](_0x43466d)){var _0xcb66ba=_0x93e2d1[_0x080e('0x3')][_0x43466d];_0x93e2d1['slot_'+_0x43466d]=_0xcb66ba;}}}_0x1e7e0d(_0x93e2d1);});});}module[_0x080e('0x5')]=function(_0x318317,_0x46b526,_0x1ce64d,_0x2252bd,_0x1be5cc,_0x544fe3){var _0xbc9ee4=new AWS[(_0x080e('0x6'))]({'accessKeyId':_0x46b526,'secretAccessKey':_0x1ce64d,'region':_0x2252bd});var _0x47dc60={'botAlias':_0x080e('0x7'),'botName':_0x544fe3,'inputText':_0x1be5cc,'userId':_0x318317};return lexResult(_0xbc9ee4,_0x47dc60);}; \ No newline at end of file +var _0xab71=['$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xab71,0x190));var _0x1ab7=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xab71[_0x10d0f0];return _0x93e308;};'use strict';var BPromise=require(_0x1ab7('0x0'));var AWS=require(_0x1ab7('0x1'));function lexResult(_0x1ca712,_0x38173c){return new BPromise(function(_0x3b52fb,_0x1ac93e){_0x1ca712[_0x1ab7('0x2')](_0x38173c,function(_0x380cfe,_0x3c3f72){if(_0x380cfe){_0x1ac93e(_0x380cfe);}if(_0x3c3f72[_0x1ab7('0x3')]){for(const _0x30af35 in _0x3c3f72[_0x1ab7('0x3')]){if(_0x3c3f72[_0x1ab7('0x3')][_0x1ab7('0x4')](_0x30af35)){var _0x4fea43=_0x3c3f72[_0x1ab7('0x3')][_0x30af35];_0x3c3f72[_0x1ab7('0x5')+_0x30af35]=_0x4fea43;}}}_0x3b52fb(_0x3c3f72);});});}module['exports']=function(_0x4a2d96,_0x300ab5,_0x20c166,_0x33e468,_0xc358b2,_0x1a8f0a){var _0x4f0e3c=new AWS['LexRuntime']({'accessKeyId':_0x300ab5,'secretAccessKey':_0x20c166,'region':_0x33e468});var _0x4bbfba={'botAlias':_0x1ab7('0x6'),'botName':_0x1a8f0a,'inputText':_0xc358b2,'userId':_0x4a2d96};return lexResult(_0x4f0e3c,_0x4bbfba);}; \ 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 4ced05c..06b57d5 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 _0xebaa=['exports','./lib/api'];(function(_0x29d12d,_0x3d396e){var _0x375e82=function(_0x380d38){while(--_0x380d38){_0x29d12d['push'](_0x29d12d['shift']());}};_0x375e82(++_0x3d396e);}(_0xebaa,0x69));var _0xaeba=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xebaa[_0x4565bf];return _0x5610ba;};'use strict';var polly=require(_0xaeba('0x0'));module[_0xaeba('0x1')]=function(_0x39df27,_0x432488,_0x440775,_0x1ec011,_0x19e34e,_0x489999,_0x5816b3){return polly(_0x39df27,_0x432488,_0x440775,_0x1ec011,_0x19e34e,_0x489999,_0x5816b3);}; \ No newline at end of file +var _0xbe43=['./lib/api'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xbe43,0xbb));var _0x3be4=function(_0xbde76,_0x457361){_0xbde76=_0xbde76-0x0;var _0x132e31=_0xbe43[_0xbde76];return _0x132e31;};'use strict';var polly=require(_0x3be4('0x0'));module['exports']=function(_0x5869a9,_0x5d2a36,_0x47202a,_0x51708e,_0xcf6c63,_0x232aaa,_0x3c923b){return polly(_0x5869a9,_0x5d2a36,_0x47202a,_0x51708e,_0xcf6c63,_0x232aaa,_0x3c923b);}; \ 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 856a813..3aa0f57 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 _0x9fd5=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','synthesizeSpeech','AudioStream'];(function(_0x549eed,_0x4da585){var _0x5a7963=function(_0x25fbe7){while(--_0x25fbe7){_0x549eed['push'](_0x549eed['shift']());}};_0x5a7963(++_0x4da585);}(_0x9fd5,0x9e));var _0x59fd=function(_0x108002,_0x44025d){_0x108002=_0x108002-0x0;var _0x32d79a=_0x9fd5[_0x108002];return _0x32d79a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x5b14d2,_0x3b2955,_0x1b3db8){return new BPromise(function(_0x3a7929,_0x2356ab){_0x5b14d2[_0x59fd('0x0')](_0x3b2955,function(_0x3cfc8d,_0x37cc5d){if(_0x3cfc8d){_0x2356ab(_0x3cfc8d);}else if(_0x37cc5d){if(_0x37cc5d[_0x59fd('0x1')]instanceof Buffer){fs['writeFile'](_0x1b3db8,_0x37cc5d[_0x59fd('0x1')],function(_0x3b1dfe){if(_0x3b1dfe){_0x2356ab(_0x3b1dfe);}else{_0x3a7929();}});}else{_0x2356ab(new Error(_0x59fd('0x2')));}}else{_0x2356ab(new Error(_0x59fd('0x3')));}});});}module[_0x59fd('0x4')]=function(_0x4f354e,_0x11e62b,_0x2caf28,_0x46bc5c,_0x532636,_0x50fb3d,_0x35e066){var _0x3ec1ef=new AWS[(_0x59fd('0x5'))]({'accessKeyId':_0x4f354e,'secretAccessKey':_0x11e62b,'region':_0x2caf28});var _0x52a06b={'Text':_0x532636,'TextType':_0x50fb3d||_0x59fd('0x6'),'OutputFormat':_0x59fd('0x7'),'VoiceId':_0x46bc5c};return pollyResult(_0x3ec1ef,_0x52a06b,_0x35e066);}; \ No newline at end of file +var _0x0e00=['text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x1a3b43,_0x2aad9f){var _0x14cb2c=function(_0x45c573){while(--_0x45c573){_0x1a3b43['push'](_0x1a3b43['shift']());}};_0x14cb2c(++_0x2aad9f);}(_0x0e00,0xa7));var _0x00e0=function(_0x25caa5,_0x7d7df8){_0x25caa5=_0x25caa5-0x0;var _0x3be372=_0x0e00[_0x25caa5];return _0x3be372;};'use strict';var fs=require('fs');var path=require(_0x00e0('0x0'));var BPromise=require(_0x00e0('0x1'));var rs=require('randomstring');var AWS=require(_0x00e0('0x2'));function pollyResult(_0x5646e1,_0x4f0ba6,_0x12a348){return new BPromise(function(_0xfc1b65,_0x2f6ecb){_0x5646e1[_0x00e0('0x3')](_0x4f0ba6,function(_0x5930e9,_0x4cdfca){if(_0x5930e9){_0x2f6ecb(_0x5930e9);}else if(_0x4cdfca){if(_0x4cdfca[_0x00e0('0x4')]instanceof Buffer){fs[_0x00e0('0x5')](_0x12a348,_0x4cdfca['AudioStream'],function(_0x3a0fee){if(_0x3a0fee){_0x2f6ecb(_0x3a0fee);}else{_0xfc1b65();}});}else{_0x2f6ecb(new Error(_0x00e0('0x6')));}}else{_0x2f6ecb(new Error(_0x00e0('0x7')));}});});}module[_0x00e0('0x8')]=function(_0x17a3ed,_0x7e586b,_0x444939,_0x188737,_0xf5530a,_0x201894,_0x52ec07){var _0x2f4261=new AWS['Polly']({'accessKeyId':_0x17a3ed,'secretAccessKey':_0x7e586b,'region':_0x444939});var _0x193ada={'Text':_0xf5530a,'TextType':_0x201894||_0x00e0('0x9'),'OutputFormat':_0x00e0('0xa'),'VoiceId':_0x188737};return pollyResult(_0x2f4261,_0x193ada,_0x52ec07);}; \ 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 8e02bd7..abaa723 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 _0x56f7=['exports','./lib/api'];(function(_0x118733,_0x2bd820){var _0x4777af=function(_0x52886a){while(--_0x52886a){_0x118733['push'](_0x118733['shift']());}};_0x4777af(++_0x2bd820);}(_0x56f7,0xcf));var _0x756f=function(_0x212b78,_0x113070){_0x212b78=_0x212b78-0x0;var _0x129fe4=_0x56f7[_0x212b78];return _0x129fe4;};'use strict';var asr=require(_0x756f('0x0'));module[_0x756f('0x1')]=function(_0x49d9a1,_0x430727,_0x2c5903,_0x505f87){return asr(_0x49d9a1,_0x430727,_0x2c5903);}; \ No newline at end of file +var _0x96ff=['./lib/api','exports'];(function(_0x37c265,_0x1564d2){var _0x4aadea=function(_0x44ab82){while(--_0x44ab82){_0x37c265['push'](_0x37c265['shift']());}};_0x4aadea(++_0x1564d2);}(_0x96ff,0xbe));var _0xf96f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x96ff[_0xfae23b];return _0x200640;};'use strict';var asr=require(_0xf96f('0x0'));module[_0xf96f('0x1')]=function(_0x101822,_0x1a2f01,_0x36d023,_0x320868){return asr(_0x101822,_0x1a2f01,_0x36d023);}; \ 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 ac27f7e..59da18e 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 _0x1cf8=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length'];(function(_0x3ce9ec,_0x3338dd){var _0xc78043=function(_0x30a500){while(--_0x30a500){_0x3ce9ec['push'](_0x3ce9ec['shift']());}};_0xc78043(++_0x3338dd);}(_0x1cf8,0x1d7));var _0x81cf=function(_0x47327a,_0xa744ab){_0x47327a=_0x47327a-0x0;var _0x258c4c=_0x1cf8[_0x47327a];return _0x258c4c;};'use strict';var url=require('url');var BPromise=require(_0x81cf('0x0'));var fs=require('fs');var host=_0x81cf('0x1');module['exports']=function(_0x1b3c92,_0xe46c02,_0x455960){return new BPromise(function(_0x454705,_0x2c11ed){var _0x54ccb5;if(typeof _0x1b3c92!==_0x81cf('0x2')||_0x1b3c92['length']===0x0){return _0x2c11ed(_0x81cf('0x3'));}if(typeof _0xe46c02!==_0x81cf('0x2')||_0xe46c02[_0x81cf('0x4')]===0x0){return _0x2c11ed(_0x81cf('0x5'));}if(typeof _0x455960!==_0x81cf('0x6')&&(typeof _0x455960!=='string'||_0x455960['length']===0x0)){return _0x2c11ed(_0x81cf('0x7'));}try{_0x54ccb5=fs[_0x81cf('0x8')](_0x1b3c92)[_0x81cf('0x9')](_0x81cf('0xa'));}catch(_0x38494d){return _0x2c11ed(_0x38494d);}return _0x454705({'method':_0x81cf('0xb'),'uri':host+_0x81cf('0xc')+_0xe46c02,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x81cf('0xd'),'languageCode':_0x455960},'audio':{'content':_0x54ccb5}},'json':!![]});});}; \ No newline at end of file +var _0x8439=['/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x8439,0xa6));var _0x9843=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8439[_0x4a747d];return _0x3a5b5c;};'use strict';var url=require(_0x9843('0x0'));var BPromise=require(_0x9843('0x1'));var fs=require('fs');var host=_0x9843('0x2');module[_0x9843('0x3')]=function(_0x34d577,_0x4e8927,_0x35449c){return new BPromise(function(_0x2ae69e,_0x3244f0){var _0x446175;if(typeof _0x34d577!=='string'||_0x34d577[_0x9843('0x4')]===0x0){return _0x3244f0(_0x9843('0x5'));}if(typeof _0x4e8927!=='string'||_0x4e8927['length']===0x0){return _0x3244f0(_0x9843('0x6'));}if(typeof _0x35449c!==_0x9843('0x7')&&(typeof _0x35449c!==_0x9843('0x8')||_0x35449c[_0x9843('0x4')]===0x0)){return _0x3244f0(_0x9843('0x9'));}try{_0x446175=fs[_0x9843('0xa')](_0x34d577)[_0x9843('0xb')](_0x9843('0xc'));}catch(_0x4413f5){return _0x3244f0(_0x4413f5);}return _0x2ae69e({'method':_0x9843('0xd'),'uri':host+_0x9843('0xe')+_0x4e8927,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x35449c},'audio':{'content':_0x446175}},'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 47fc79c..810342f 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 _0x3162=['./asr'];(function(_0x29b75e,_0x31e5ef){var _0x1777e9=function(_0x5677ce){while(--_0x5677ce){_0x29b75e['push'](_0x29b75e['shift']());}};_0x1777e9(++_0x31e5ef);}(_0x3162,0xd0));var _0x2316=function(_0x4496d4,_0x35a23c){_0x4496d4=_0x4496d4-0x0;var _0x549149=_0x3162[_0x4496d4];return _0x549149;};var asr=require(_0x2316('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x71d5=['exports','./asr'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x71d5,0x109));var _0x571d=function(_0x2b71fa,_0x9f05b5){_0x2b71fa=_0x2b71fa-0x0;var _0x374c5a=_0x71d5[_0x2b71fa];return _0x374c5a;};var asr=require(_0x571d('0x0'));module[_0x571d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f5bdb5f..f09f1e5 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 _0x8985=['googleCloudTTS\x20path','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','resolvedQuery','action','actionIncomplete','status','code','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','dirName','path','http','https','url','bluebird','sox','request-promise','util','md5','./google','./aws','./tilde','./sestek','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','wav','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','POST','from','audioContent','generate','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8985,0x161));var _0x5898=function(_0x566e28,_0x2afe14){_0x566e28=_0x566e28-0x0;var _0x21c6fe=_0x8985[_0x566e28];return _0x21c6fe;};'use strict';var fs=require('fs');var path=require(_0x5898('0x0'));var http=require(_0x5898('0x1'));var https=require(_0x5898('0x2'));var urlParse=require(_0x5898('0x3'))['parse'];var BPromise=require(_0x5898('0x4'));var rs=require('randomstring');var sox=require(_0x5898('0x5'));var rp=require(_0x5898('0x6'));var util=require(_0x5898('0x7'));var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require('apiai-promise');var md5=require(_0x5898('0x8'));var google=require(_0x5898('0x9'));var aws=require(_0x5898('0xa'));var tilde=require(_0x5898('0xb'));var sestek=require(_0x5898('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x5898('0xd');function downloadFile(_0x27a79c,_0x598780){return new BPromise(function(_0x23dbc0,_0x1ca147){var _0x2b5650=urlParse(_0x27a79c);var _0x48d879=_0x2b5650[_0x5898('0xe')]===_0x5898('0xf')?https:http;var _0x1bf5fa={'host':_0x2b5650[_0x5898('0x10')],'path':_0x2b5650[_0x5898('0x0')],'headers':{'user-agent':_0x5898('0x11')}};_0x48d879['get'](_0x1bf5fa,function(_0x3a17c2){if(_0x3a17c2[_0x5898('0x12')]!==0xc8){logger[_0x5898('0x13')](_0x5898('0x14')+_0x27a79c+'\x20failed,\x20status\x20code\x20=\x20'+_0x3a17c2[_0x5898('0x12')]+'\x20('+_0x3a17c2[_0x5898('0x15')]+')');_0x1ca147(new Error(_0x5898('0x14')+_0x27a79c+_0x5898('0x16')+_0x3a17c2[_0x5898('0x12')]+'\x20('+_0x3a17c2[_0x5898('0x15')]+')'));return;}var _0xedb75d=fs[_0x5898('0x17')](_0x598780);_0xedb75d['on'](_0x5898('0x18'),function(){logger['info'](_0x5898('0x19'));_0xedb75d[_0x5898('0x1a')](_0x23dbc0);});_0xedb75d['on']('error',function(_0x224234){fs[_0x5898('0x1b')](_0x598780);logger[_0x5898('0x13')](_0x5898('0x1c'),_0x224234);_0x1ca147(_0x224234);});_0x3a17c2[_0x5898('0x1d')](_0xedb75d);})['on'](_0x5898('0x13'),function(_0x172675){logger['error'](_0x172675);_0x1ca147(_0x172675);})[_0x5898('0x1e')]();});}function uploadFile(_0x18f180){return new BPromise(function(_0x24ed52,_0x80951f){var _0x4fc134=urlParse(_0x18f180);var _0x46063f=_0x4fc134[_0x5898('0xe')]==='https:'?https:http;var _0x38fda8={'host':_0x4fc134[_0x5898('0x10')],'path':_0x4fc134[_0x5898('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x46063f[_0x5898('0x1f')](_0x38fda8,function(_0x14d206){if(_0x14d206[_0x5898('0x12')]!==0xc8){_0x80951f(new Error(_0x5898('0x14')+_0x18f180+'\x20failed,\x20status\x20code\x20=\x20'+_0x14d206['statusCode']+'\x20('+_0x14d206[_0x5898('0x15')]+')'));return;}var _0xfc3d95='';_0x14d206['on']('data',function(_0x438219){_0xfc3d95+=_0x438219;});_0x14d206['on'](_0x5898('0x1e'),function(){_0x24ed52(_0xfc3d95);});})['on']('error',function(_0x3a48d2){_0x80951f(_0x3a48d2);})[_0x5898('0x1e')]();});}function convertFile(_0x3a2116,_0x238aec){return new BPromise(function(_0x5382fd,_0x2b26c3){var _0x1b9611=sox['transcode'](_0x3a2116,_0x238aec,{'sampleRate':0x1f40,'format':_0x5898('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b9611['on'](_0x5898('0x13'),function(_0x47343b){logger['error']('error\x20convert',_0x47343b);_0x2b26c3(_0x47343b);});_0x1b9611['on'](_0x5898('0x1e'),function(){logger['info'](_0x5898('0x21'));_0x5382fd();});_0x1b9611[_0x5898('0x22')]();});}function base64Decode(_0x237935,_0x5cb32b){var _0x9b0236=path[_0x5898('0x23')](__dirname,_0x5898('0x24'),rs['generate'](0x4)+_0x5898('0x25'));fs[_0x5898('0x26')](_0x9b0236,_0x237935,_0x5898('0x27'));return convertFile(_0x9b0236,_0x5cb32b)[_0x5898('0x28')](function(){try{fs[_0x5898('0x1b')](_0x9b0236);fs[_0x5898('0x29')](_0x5cb32b,_0x5898('0x2a'));}catch(_0xd9c47d){logger[_0x5898('0x13')](_0xd9c47d);}return _0x5cb32b[_0x5898('0x2b')]('.')[0x0];});}function base64Encode(_0x4738f4){var _0x48463d=fs['readFileSync'](_0x4738f4);return new Buffer(_0x48463d)[_0x5898('0x2c')](_0x5898('0x27'));}exports[_0x5898('0x2d')]=function(_0x8e6ef8,_0x22cc5d,_0x20f93a,_0x435781,_0x23145c,_0x51d7ba){var _0x4b5b6d,_0x46ac6f;var _0x5910cc='https://texttospeech.googleapis.com/v1/';var _0x23b64b=_0x5898('0x2e')+_0x8e6ef8;var _0x5e7966={};if(_0x22cc5d==='ssml'){_0x5e7966[_0x5898('0x2f')]={'ssml':_0x20f93a};}else{_0x5e7966[_0x5898('0x2f')]={'text':_0x20f93a};};_0x5e7966[_0x5898('0x30')]={'languageCode':_0x435781,'ssmlGender':_0x23145c};_0x5e7966[_0x5898('0x31')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4c1071={'url':_0x5910cc+'text:synthesize'+_0x23b64b,'method':_0x5898('0x32'),'json':!![],'body':_0x5e7966};return rp(_0x4c1071)[_0x5898('0x28')](function(_0x250b5c){return new BPromise(function(_0x3baf21,_0x33ab8c){_0x4b5b6d=path[_0x5898('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0xceaa1=Buffer[_0x5898('0x33')](_0x250b5c[_0x5898('0x34')],_0x5898('0x27'));return fs['writeFile'](_0x4b5b6d,_0xceaa1,function(_0x1dff9f){_0x33ab8c(_0x1dff9f);},function(_0x405876){fs[_0x5898('0x29')](_0x4b5b6d,_0x5898('0x2a'));_0x3baf21(_0x405876);});});})[_0x5898('0x28')](function(_0x281052){_0x46ac6f=path[_0x5898('0x23')](__dirname,'tmp',rs[_0x5898('0x35')](0x4)+_0x5898('0x25'));return convertFile(_0x4b5b6d,_0x46ac6f);})['then'](function(){try{fs[_0x5898('0x1b')](_0x4b5b6d);fs[_0x5898('0x29')](_0x46ac6f,'777');}catch(_0x2087c6){logger['error'](_0x2087c6);}logger[_0x5898('0x36')](_0x5898('0x37'),_0x46ac6f[_0x5898('0x2b')]('.')[0x0]);return _0x46ac6f[_0x5898('0x2b')]('.')[0x0];});};exports[_0x5898('0x38')]=function(_0x3cf7d3,_0x39261b){var _0x10679d,_0x2c636a;return tts(_0x3cf7d3,_0x39261b||'en',0x1)[_0x5898('0x28')](function(_0x5a8d4e){logger[_0x5898('0x36')](_0x5a8d4e);_0x10679d=path['resolve'](__dirname,_0x5898('0x24'),rs[_0x5898('0x35')](0x4)+_0x5898('0x39'));return downloadFile(_0x5a8d4e,_0x10679d);})[_0x5898('0x28')](function(){_0x2c636a=path['resolve'](__dirname,_0x5898('0x24'),rs['generate'](0x4)+_0x5898('0x25'));return convertFile(_0x10679d,_0x2c636a);})[_0x5898('0x28')](function(){try{fs[_0x5898('0x1b')](_0x10679d);fs[_0x5898('0x29')](_0x2c636a,_0x5898('0x2a'));}catch(_0x4acbb0){logger[_0x5898('0x13')](_0x4acbb0);}logger['info'](_0x5898('0x3a'),_0x2c636a['split']('.')[0x0]);return _0x2c636a['split']('.')[0x0];});};exports[_0x5898('0x3b')]=function(_0x6980de,_0x1df388,_0x50bdce){return google[_0x5898('0x3c')](_0x6980de,_0x1df388,_0x50bdce)['then'](function(_0x48ebc5){logger[_0x5898('0x36')](_0x48ebc5['uri']);return rp(_0x48ebc5);})[_0x5898('0x28')](function(_0x4a34e8){var _0x16004c='';var _0x123344=0x0;try{fs['unlink'](_0x6980de);}catch(_0x5d99c0){logger[_0x5898('0x13')](_0x5d99c0);}if(_0x4a34e8&&_0x4a34e8[_0x5898('0x3d')]){_0x16004c=_0x4a34e8['results'][_0x5898('0x3e')](function(_0x1a8cb0){return _0x1a8cb0&&_0x1a8cb0[_0x5898('0x3f')][0x0]&&_0x1a8cb0[_0x5898('0x3f')][0x0]['transcript']?_0x1a8cb0[_0x5898('0x3f')][0x0]['transcript']:'';})[_0x5898('0x40')]('\x0a');_0x123344=_0x4a34e8[_0x5898('0x3d')][_0x5898('0x3e')](function(_0x5ea0cb){return _0x5ea0cb&&_0x5ea0cb['alternatives'][0x0]&&_0x5ea0cb[_0x5898('0x3f')][0x0][_0x5898('0x41')]?_0x5ea0cb[_0x5898('0x3f')][0x0][_0x5898('0x41')]:0x0;})[_0x5898('0x40')]('\x0a');}logger[_0x5898('0x36')](_0x5898('0x42'),_0x16004c);logger[_0x5898('0x36')](_0x5898('0x43'),_0x123344);return{'transcript':_0x16004c,'confidence':_0x123344};})[_0x5898('0x44')](function(_0xf1a58d){logger[_0x5898('0x13')](_0x5898('0x45'),_0xf1a58d['statusCode'],_0xf1a58d[_0x5898('0x46')],_0xf1a58d[_0x5898('0x47')]);});};exports[_0x5898('0x48')]=function(_0x4327fa,_0x30e4c5,_0xf3443c,_0x2df237){var _0x262a61=apiai(_0x30e4c5,{'language':_0x2df237||'en'});return _0x262a61['textRequest'](_0xf3443c,{'sessionId':md5(_0x4327fa)})[_0x5898('0x28')](function(_0x5d6aa1){logger[_0x5898('0x36')](JSON[_0x5898('0x49')](_0x5d6aa1));return{'source':_0x5d6aa1[_0x5898('0x4a')]['source'],'resolvedQuery':_0x5d6aa1['result'][_0x5898('0x4b')],'action':_0x5d6aa1['result'][_0x5898('0x4c')],'actionIncomplete':_0x5d6aa1[_0x5898('0x4a')][_0x5898('0x4d')],'speech':_0x5d6aa1[_0x5898('0x4a')]['fulfillment']['speech'],'score':_0x5d6aa1[_0x5898('0x4a')]['score'],'statusCode':_0x5d6aa1[_0x5898('0x4e')][_0x5898('0x4f')],'endConversation':_0x5d6aa1[_0x5898('0x4a')][_0x5898('0x50')]['endConversation']||![],'isFallbackIntent':_0x5d6aa1['result'][_0x5898('0x50')][_0x5898('0x51')]};});};exports[_0x5898('0x52')]=function(_0x2b53e9,_0x1ebdbd,_0x10fd4b,_0x4c7403){return tilde[_0x5898('0x3c')](_0x2b53e9,_0x1ebdbd,_0x10fd4b,_0x4c7403)[_0x5898('0x28')](function(_0x2b43c7){try{fs[_0x5898('0x1b')](_0x2b53e9);}catch(_0x543eec){logger['error'](_0x543eec);}logger['info'](_0x5898('0x53'),_0x2b43c7[_0x5898('0x54')]);logger[_0x5898('0x36')](_0x5898('0x55'),_0x2b43c7[_0x5898('0x41')]);return _0x2b43c7;});};exports[_0x5898('0x56')]=function(_0x36889,_0x214548,_0x4a53d5,_0x351da6,_0x242cbf,_0x5e3eab){var _0x53c407=path['resolve'](__dirname,_0x5898('0x24'),rs['generate'](0x4)+_0x5898('0x39'));var _0x51871d;return aws['polly'](_0x36889,_0x214548,_0x4a53d5,_0x351da6,_0x242cbf,_0x5e3eab,_0x53c407)[_0x5898('0x28')](function(){_0x51871d=path[_0x5898('0x23')](__dirname,_0x5898('0x24'),rs['generate'](0x4)+'.wav');return convertFile(_0x53c407,_0x51871d);})[_0x5898('0x28')](function(){try{fs[_0x5898('0x1b')](_0x53c407);fs[_0x5898('0x29')](_0x51871d,_0x5898('0x2a'));}catch(_0x1c73e8){logger['error'](_0x1c73e8);}return _0x51871d['split']('.')[0x0];});};exports['awsLex']=function(_0x1d9bad,_0x58522d,_0xbe0763,_0xce2bf3,_0x4f1624,_0x460946){return aws['lex'](_0x1d9bad,_0x58522d,_0xbe0763,_0xce2bf3,_0x4f1624,_0x460946)[_0x5898('0x28')](function(_0xf5c764){logger[_0x5898('0x36')](JSON[_0x5898('0x49')](_0xf5c764));return _0xf5c764;});};exports[_0x5898('0x57')]=function(_0x10a560,_0x2024ce,_0x4d0559,_0x14d4d7){var _0xc9bb3b=util[_0x5898('0x58')](_0x5898('0x59'),ISPEECH_API,_0x10a560,encodeURIComponent(_0x2024ce),_0x4d0559,_0x14d4d7);var _0x25483f=path['resolve'](__dirname,'tmp',rs[_0x5898('0x35')](0x4)+_0x5898('0x39'));var _0x2cc6b4;return downloadFile(_0xc9bb3b,_0x25483f)[_0x5898('0x28')](function(){_0x2cc6b4=path[_0x5898('0x23')](__dirname,_0x5898('0x24'),rs[_0x5898('0x35')](0x4)+'.wav');return convertFile(_0x25483f,_0x2cc6b4);})[_0x5898('0x28')](function(){try{fs[_0x5898('0x1b')](_0x25483f);fs[_0x5898('0x29')](_0x2cc6b4,_0x5898('0x2a'));}catch(_0xc802ad){logger[_0x5898('0x13')](_0xc802ad);}return _0x2cc6b4[_0x5898('0x2b')]('.')[0x0];});};exports[_0x5898('0x5a')]=function(_0x156443,_0x38253a,_0xb71fdd,_0x25a5ac){var _0x36b36a=util['format'](_0x5898('0x5b'),ISPEECH_API,_0x38253a,_0xb71fdd,base64Encode(_0x156443),_0x25a5ac?util[_0x5898('0x58')]('model=%s',encodeURIComponent(_0x25a5ac)):_0x5898('0x5c'));return uploadFile(_0x36b36a)[_0x5898('0x28')](function(_0x1d0da4){return querystring['parse'](_0x1d0da4);});};exports[_0x5898('0x5d')]=function(_0xa64e39,_0x257ecc){return sestek[_0x5898('0x5e')](_0xa64e39,_0x257ecc)[_0x5898('0x28')](function(_0x51253a){logger['info'](JSON['stringify'](_0x51253a));var _0x2bcb90={'speech':_0x51253a[_0x5898('0x5f')],'action':_0x51253a['channelData']?_0x51253a['channelData'][_0x5898('0x60')]:undefined,'actiondata':_0x51253a['channelData']?_0x51253a[_0x5898('0x61')][_0x5898('0x62')]:undefined};if(_0x51253a[_0x5898('0x61')]&&_0x51253a[_0x5898('0x61')][_0x5898('0x63')]){return base64Decode(_0x51253a[_0x5898('0x61')][_0x5898('0x63')][_0x5898('0x64')],path[_0x5898('0x23')](__dirname,_0x5898('0x24'),rs['generate'](0x4)+'.wav'))[_0x5898('0x28')](function(_0x5c1b04){_0x2bcb90['audiofile']=_0x5c1b04;return _0x2bcb90;});}return _0x2bcb90;});};exports[_0x5898('0x65')]=function(){return __dirname;}; \ No newline at end of file +var _0x22d9=['finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','generate','from','audioContent','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','speech','status','code','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','path','http','https','url','parse','bluebird','randomstring','request-promise','util','querystring','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','end','transcode','error\x20convert'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22d9,0x1ea));var _0x922d=function(_0x3d6af3,_0x257969){_0x3d6af3=_0x3d6af3-0x0;var _0x976478=_0x22d9[_0x3d6af3];return _0x976478;};'use strict';var fs=require('fs');var path=require(_0x922d('0x0'));var http=require(_0x922d('0x1'));var https=require(_0x922d('0x2'));var urlParse=require(_0x922d('0x3'))[_0x922d('0x4')];var BPromise=require(_0x922d('0x5'));var rs=require(_0x922d('0x6'));var sox=require('sox');var rp=require(_0x922d('0x7'));var util=require(_0x922d('0x8'));var querystring=require(_0x922d('0x9'));var tts=require('google-tts-api');var apiai=require('apiai-promise');var md5=require(_0x922d('0xa'));var google=require(_0x922d('0xb'));var aws=require(_0x922d('0xc'));var tilde=require(_0x922d('0xd'));var sestek=require(_0x922d('0xe'));var logger=require(_0x922d('0xf'))(_0x922d('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x86a7c9,_0x155a6e){return new BPromise(function(_0x192e76,_0x4d547e){var _0x2c6bbe=urlParse(_0x86a7c9);var _0x2cadf6=_0x2c6bbe[_0x922d('0x11')]===_0x922d('0x12')?https:http;var _0x22090c={'host':_0x2c6bbe['host'],'path':_0x2c6bbe[_0x922d('0x0')],'headers':{'user-agent':_0x922d('0x13')}};_0x2cadf6[_0x922d('0x14')](_0x22090c,function(_0x240626){if(_0x240626[_0x922d('0x15')]!==0xc8){logger[_0x922d('0x16')](_0x922d('0x17')+_0x86a7c9+_0x922d('0x18')+_0x240626[_0x922d('0x15')]+'\x20('+_0x240626[_0x922d('0x19')]+')');_0x4d547e(new Error(_0x922d('0x17')+_0x86a7c9+_0x922d('0x18')+_0x240626[_0x922d('0x15')]+'\x20('+_0x240626[_0x922d('0x19')]+')'));return;}var _0x46bacf=fs[_0x922d('0x1a')](_0x155a6e);_0x46bacf['on'](_0x922d('0x1b'),function(){logger[_0x922d('0x1c')](_0x922d('0x1d'));_0x46bacf['close'](_0x192e76);});_0x46bacf['on'](_0x922d('0x16'),function(_0x101ed4){fs[_0x922d('0x1e')](_0x155a6e);logger[_0x922d('0x16')]('download\x20error',_0x101ed4);_0x4d547e(_0x101ed4);});_0x240626[_0x922d('0x1f')](_0x46bacf);})['on']('error',function(_0x2da2c6){logger['error'](_0x2da2c6);_0x4d547e(_0x2da2c6);})[_0x922d('0x20')]();});}function uploadFile(_0x3aec18){return new BPromise(function(_0xf6c3d4,_0x3e6664){var _0x1a08d1=urlParse(_0x3aec18);var _0x21dbb7=_0x1a08d1[_0x922d('0x11')]==='https:'?https:http;var _0x136ea7={'host':_0x1a08d1['host'],'path':_0x1a08d1[_0x922d('0x0')],'headers':{'user-agent':_0x922d('0x13')}};_0x21dbb7[_0x922d('0x14')](_0x136ea7,function(_0x4f82f8){if(_0x4f82f8['statusCode']!==0xc8){_0x3e6664(new Error(_0x922d('0x17')+_0x3aec18+_0x922d('0x18')+_0x4f82f8[_0x922d('0x15')]+'\x20('+_0x4f82f8[_0x922d('0x19')]+')'));return;}var _0x281342='';_0x4f82f8['on']('data',function(_0xcb038b){_0x281342+=_0xcb038b;});_0x4f82f8['on'](_0x922d('0x20'),function(){_0xf6c3d4(_0x281342);});})['on'](_0x922d('0x16'),function(_0x2c7b6e){_0x3e6664(_0x2c7b6e);})[_0x922d('0x20')]();});}function convertFile(_0x5823a5,_0x4aa34d){return new BPromise(function(_0x5306d2,_0x37ce73){var _0x3e99be=sox[_0x922d('0x21')](_0x5823a5,_0x4aa34d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e99be['on'](_0x922d('0x16'),function(_0x4fff97){logger[_0x922d('0x16')](_0x922d('0x22'),_0x4fff97);_0x37ce73(_0x4fff97);});_0x3e99be['on'](_0x922d('0x20'),function(){logger['info'](_0x922d('0x23'));_0x5306d2();});_0x3e99be[_0x922d('0x24')]();});}function base64Decode(_0x3ce28a,_0x4a8ed6){var _0x19f90b=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+_0x922d('0x27'));fs[_0x922d('0x28')](_0x19f90b,_0x3ce28a,_0x922d('0x29'));return convertFile(_0x19f90b,_0x4a8ed6)[_0x922d('0x2a')](function(){try{fs[_0x922d('0x1e')](_0x19f90b);fs[_0x922d('0x2b')](_0x4a8ed6,_0x922d('0x2c'));}catch(_0x40fcb7){logger['error'](_0x40fcb7);}return _0x4a8ed6[_0x922d('0x2d')]('.')[0x0];});}function base64Encode(_0x4995ea){var _0x14cdf9=fs[_0x922d('0x2e')](_0x4995ea);return new Buffer(_0x14cdf9)[_0x922d('0x2f')](_0x922d('0x29'));}exports[_0x922d('0x30')]=function(_0x1e6e8b,_0x4391c7,_0x2f403c,_0x3bedb1,_0x88451f,_0x3a994e){var _0x2fde7f,_0x5f58ec;var _0x1b89e9=_0x922d('0x31');var _0x350a90=_0x922d('0x32')+_0x1e6e8b;var _0xbea64e={};if(_0x4391c7===_0x922d('0x33')){_0xbea64e['input']={'ssml':_0x2f403c};}else{_0xbea64e[_0x922d('0x34')]={'text':_0x2f403c};};_0xbea64e['voice']={'languageCode':_0x3bedb1,'ssmlGender':_0x88451f};_0xbea64e[_0x922d('0x35')]={'audioEncoding':_0x922d('0x36'),'sampleRateHertz':0x1f40};var _0xb4596b={'url':_0x1b89e9+'text:synthesize'+_0x350a90,'method':'POST','json':!![],'body':_0xbea64e};return rp(_0xb4596b)['then'](function(_0x107889){return new BPromise(function(_0x2df8a0,_0x5e0470){_0x2fde7f=path['resolve'](__dirname,_0x922d('0x26'),rs[_0x922d('0x37')](0x4)+'.mp3');var _0x4c2176=Buffer[_0x922d('0x38')](_0x107889[_0x922d('0x39')],_0x922d('0x29'));return fs['writeFile'](_0x2fde7f,_0x4c2176,function(_0x27f106){_0x5e0470(_0x27f106);},function(_0x335be5){fs[_0x922d('0x2b')](_0x2fde7f,_0x922d('0x2c'));_0x2df8a0(_0x335be5);});});})[_0x922d('0x2a')](function(_0x284a7f){_0x5f58ec=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+_0x922d('0x27'));return convertFile(_0x2fde7f,_0x5f58ec);})[_0x922d('0x2a')](function(){try{fs[_0x922d('0x1e')](_0x2fde7f);fs[_0x922d('0x2b')](_0x5f58ec,'777');}catch(_0x4701de){logger[_0x922d('0x16')](_0x4701de);}logger[_0x922d('0x1c')](_0x922d('0x3a'),_0x5f58ec[_0x922d('0x2d')]('.')[0x0]);return _0x5f58ec[_0x922d('0x2d')]('.')[0x0];});};exports[_0x922d('0x3b')]=function(_0x128b72,_0x2dba21){var _0x53fcee,_0x3f160b;return tts(_0x128b72,_0x2dba21||'en',0x1)[_0x922d('0x2a')](function(_0x17d8d1){logger['info'](_0x17d8d1);_0x53fcee=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs[_0x922d('0x37')](0x4)+'.mp3');return downloadFile(_0x17d8d1,_0x53fcee);})['then'](function(){_0x3f160b=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+_0x922d('0x27'));return convertFile(_0x53fcee,_0x3f160b);})['then'](function(){try{fs[_0x922d('0x1e')](_0x53fcee);fs[_0x922d('0x2b')](_0x3f160b,'777');}catch(_0x1986b5){logger[_0x922d('0x16')](_0x1986b5);}logger[_0x922d('0x1c')](_0x922d('0x3c'),_0x3f160b[_0x922d('0x2d')]('.')[0x0]);return _0x3f160b[_0x922d('0x2d')]('.')[0x0];});};exports[_0x922d('0x3d')]=function(_0x5b863a,_0x3f5eb6,_0x1bef50){return google[_0x922d('0x3e')](_0x5b863a,_0x3f5eb6,_0x1bef50)[_0x922d('0x2a')](function(_0x548b69){logger['info'](_0x548b69[_0x922d('0x3f')]);return rp(_0x548b69);})[_0x922d('0x2a')](function(_0x4d318d){var _0x5e72a9='';var _0x3d950a=0x0;try{fs[_0x922d('0x1e')](_0x5b863a);}catch(_0x331009){logger[_0x922d('0x16')](_0x331009);}if(_0x4d318d&&_0x4d318d[_0x922d('0x40')]){_0x5e72a9=_0x4d318d[_0x922d('0x40')][_0x922d('0x41')](function(_0x5ddce4){return _0x5ddce4&&_0x5ddce4[_0x922d('0x42')][0x0]&&_0x5ddce4[_0x922d('0x42')][0x0][_0x922d('0x43')]?_0x5ddce4['alternatives'][0x0][_0x922d('0x43')]:'';})[_0x922d('0x44')]('\x0a');_0x3d950a=_0x4d318d[_0x922d('0x40')][_0x922d('0x41')](function(_0x269265){return _0x269265&&_0x269265[_0x922d('0x42')][0x0]&&_0x269265['alternatives'][0x0][_0x922d('0x45')]?_0x269265['alternatives'][0x0][_0x922d('0x45')]:0x0;})['join']('\x0a');}logger[_0x922d('0x1c')](_0x922d('0x46'),_0x5e72a9);logger[_0x922d('0x1c')](_0x922d('0x47'),_0x3d950a);return{'transcript':_0x5e72a9,'confidence':_0x3d950a};})['catch'](function(_0x30fa09){logger['error'](_0x922d('0x48'),_0x30fa09[_0x922d('0x15')],_0x30fa09['name'],_0x30fa09[_0x922d('0x49')]);});};exports['googleDialogflow']=function(_0x458a9e,_0x252c8e,_0x57d614,_0x1805b6){var _0x8775ec=apiai(_0x252c8e,{'language':_0x1805b6||'en'});return _0x8775ec[_0x922d('0x4a')](_0x57d614,{'sessionId':md5(_0x458a9e)})['then'](function(_0x207c42){logger[_0x922d('0x1c')](JSON[_0x922d('0x4b')](_0x207c42));return{'source':_0x207c42[_0x922d('0x4c')][_0x922d('0x4d')],'resolvedQuery':_0x207c42[_0x922d('0x4c')][_0x922d('0x4e')],'action':_0x207c42[_0x922d('0x4c')]['action'],'actionIncomplete':_0x207c42[_0x922d('0x4c')][_0x922d('0x4f')],'speech':_0x207c42[_0x922d('0x4c')]['fulfillment'][_0x922d('0x50')],'score':_0x207c42[_0x922d('0x4c')]['score'],'statusCode':_0x207c42[_0x922d('0x51')][_0x922d('0x52')],'endConversation':_0x207c42[_0x922d('0x4c')][_0x922d('0x53')]['endConversation']||![],'isFallbackIntent':_0x207c42[_0x922d('0x4c')][_0x922d('0x53')][_0x922d('0x54')]};});};exports[_0x922d('0x55')]=function(_0x2b8f4c,_0x129b74,_0x31bc70,_0x16def4){return tilde[_0x922d('0x3e')](_0x2b8f4c,_0x129b74,_0x31bc70,_0x16def4)[_0x922d('0x2a')](function(_0x29f578){try{fs[_0x922d('0x1e')](_0x2b8f4c);}catch(_0x1dab48){logger[_0x922d('0x16')](_0x1dab48);}logger[_0x922d('0x1c')]('Tilde\x20ASR\x20transcription',_0x29f578[_0x922d('0x43')]);logger['info'](_0x922d('0x56'),_0x29f578[_0x922d('0x45')]);return _0x29f578;});};exports[_0x922d('0x57')]=function(_0xbaef38,_0x874a85,_0x2f051c,_0xbe4881,_0x1405d8,_0x22e2c4){var _0x548229=path['resolve'](__dirname,'tmp',rs[_0x922d('0x37')](0x4)+_0x922d('0x58'));var _0x55956a;return aws[_0x922d('0x59')](_0xbaef38,_0x874a85,_0x2f051c,_0xbe4881,_0x1405d8,_0x22e2c4,_0x548229)[_0x922d('0x2a')](function(){_0x55956a=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+_0x922d('0x27'));return convertFile(_0x548229,_0x55956a);})[_0x922d('0x2a')](function(){try{fs['unlink'](_0x548229);fs[_0x922d('0x2b')](_0x55956a,'777');}catch(_0x3d3c01){logger['error'](_0x3d3c01);}return _0x55956a['split']('.')[0x0];});};exports['awsLex']=function(_0x1d8c9c,_0x40ddb3,_0x5307f3,_0x4c334a,_0x1b3c22,_0x5a9b36){return aws['lex'](_0x1d8c9c,_0x40ddb3,_0x5307f3,_0x4c334a,_0x1b3c22,_0x5a9b36)[_0x922d('0x2a')](function(_0x187351){logger[_0x922d('0x1c')](JSON[_0x922d('0x4b')](_0x187351));return _0x187351;});};exports['ispeechTTS']=function(_0x127869,_0x3e72f4,_0xc4b4f0,_0x4e9f7e){var _0x1136c5=util['format'](_0x922d('0x5a'),ISPEECH_API,_0x127869,encodeURIComponent(_0x3e72f4),_0xc4b4f0,_0x4e9f7e);var _0x318c64=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs[_0x922d('0x37')](0x4)+_0x922d('0x58'));var _0x4bbbfd;return downloadFile(_0x1136c5,_0x318c64)[_0x922d('0x2a')](function(){_0x4bbbfd=path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x318c64,_0x4bbbfd);})[_0x922d('0x2a')](function(){try{fs['unlink'](_0x318c64);fs[_0x922d('0x2b')](_0x4bbbfd,_0x922d('0x2c'));}catch(_0x79da21){logger['error'](_0x79da21);}return _0x4bbbfd[_0x922d('0x2d')]('.')[0x0];});};exports[_0x922d('0x5b')]=function(_0x516c9f,_0x18647b,_0x4d9090,_0x5e5d6a){var _0x5e795c=util[_0x922d('0x5c')](_0x922d('0x5d'),ISPEECH_API,_0x18647b,_0x4d9090,base64Encode(_0x516c9f),_0x5e5d6a?util[_0x922d('0x5c')](_0x922d('0x5e'),encodeURIComponent(_0x5e5d6a)):_0x922d('0x5f'));return uploadFile(_0x5e795c)[_0x922d('0x2a')](function(_0x13cb0b){return querystring['parse'](_0x13cb0b);});};exports[_0x922d('0x60')]=function(_0x1a86fd,_0x1a8136){return sestek[_0x922d('0x61')](_0x1a86fd,_0x1a8136)[_0x922d('0x2a')](function(_0x21434e){logger[_0x922d('0x1c')](JSON[_0x922d('0x4b')](_0x21434e));var _0x54068d={'speech':_0x21434e[_0x922d('0x62')],'action':_0x21434e['channelData']?_0x21434e[_0x922d('0x63')][_0x922d('0x64')]:undefined,'actiondata':_0x21434e[_0x922d('0x63')]?_0x21434e[_0x922d('0x63')][_0x922d('0x65')]:undefined};if(_0x21434e[_0x922d('0x63')]&&_0x21434e[_0x922d('0x63')][_0x922d('0x66')]){return base64Decode(_0x21434e[_0x922d('0x63')][_0x922d('0x66')][_0x922d('0x67')],path[_0x922d('0x25')](__dirname,_0x922d('0x26'),rs['generate'](0x4)+_0x922d('0x27')))[_0x922d('0x2a')](function(_0x193db7){_0x54068d['audiofile']=_0x193db7;return _0x54068d;});}return _0x54068d;});};exports[_0x922d('0x68')]=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 57778cb..a198790 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 _0xa140=['exports','./nda'];(function(_0x11fd4e,_0x1a32ec){var _0x324371=function(_0x3f90a1){while(--_0x3f90a1){_0x11fd4e['push'](_0x11fd4e['shift']());}};_0x324371(++_0x1a32ec);}(_0xa140,0x1b5));var _0x0a14=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa140[_0x3e112d];return _0x531c31;};var nda=require(_0x0a14('0x0'));module[_0x0a14('0x1')]={'nda':nda}; \ No newline at end of file +var _0x37d6=['./nda'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x37d6,0x1a8));var _0x637d=function(_0x3ed430,_0x5fafab){_0x3ed430=_0x3ed430-0x0;var _0xae4a10=_0x37d6[_0x3ed430];return _0xae4a10;};var nda=require(_0x637d('0x0'));module['exports']={'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 f8e283c..e3bbc04 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 _0x8c54=['ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid','calleridname','dnid','extension','access_token','project','body','channelData'];(function(_0x4a8227,_0x27ab19){var _0x403b2c=function(_0x6e793d){while(--_0x6e793d){_0x4a8227['push'](_0x4a8227['shift']());}};_0x403b2c(++_0x27ab19);}(_0x8c54,0x1d9));var _0x48c5=function(_0x3e4e51,_0x233e0d){_0x3e4e51=_0x3e4e51-0x0;var _0xf98b5e=_0x8c54[_0x3e4e51];return _0xf98b5e;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0x48c5('0x0'));module[_0x48c5('0x1')]=function(_0x458817,_0x47e0ae){var _0x5e639a={'method':_0x48c5('0x2'),'uri':url[_0x48c5('0x3')](_0x47e0ae[_0x48c5('0x4')],_0x48c5('0x5')),'form':{'grant_type':'password','username':_0x47e0ae['username'],'password':_0x47e0ae[_0x48c5('0x6')]},'json':!![]};return rp(_0x5e639a)[_0x48c5('0x7')](function(_0x376651){var _0x320ba5={'method':_0x48c5('0x2'),'uri':url[_0x48c5('0x3')](_0x47e0ae[_0x48c5('0x8')],_0x48c5('0x9')),'body':{'type':_0x47e0ae[_0x48c5('0xa')]||'message','channelId':_0x48c5('0xb'),'conversation':{'id':_0x458817['uniqueid']},'from':{'id':_0x458817[_0x48c5('0xc')],'name':_0x458817[_0x48c5('0xd')]},'recipient':{'id':_0x458817[_0x48c5('0xe')],'name':_0x458817[_0x48c5('0xf')]},'text':_0x47e0ae['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x376651[_0x48c5('0x10')]},'json':!![]};if(_0x47e0ae[_0x48c5('0x11')]){_0x320ba5[_0x48c5('0x12')][_0x48c5('0x13')][_0x48c5('0x14')]=_0x47e0ae['project'];}if(_0x47e0ae['ndagenerate_audio']=='1'){_0x320ba5[_0x48c5('0x12')][_0x48c5('0x13')][_0x48c5('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x48c5('0x16')};}if(_0x47e0ae[_0x48c5('0x17')]){_0x320ba5[_0x48c5('0x12')][_0x48c5('0x13')][_0x48c5('0x18')]=_0x47e0ae['custom_action'];if(_0x47e0ae['custom_action_data']){_0x320ba5[_0x48c5('0x12')][_0x48c5('0x13')][_0x48c5('0x19')]=_0x47e0ae[_0x48c5('0x1a')];}}logger[_0x48c5('0x1b')](JSON[_0x48c5('0x1c')](_0x320ba5));return rp(_0x320ba5);});}; \ No newline at end of file +var _0xb537=['POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','calleridname','dnid','extension','project','channelData','ProjectName','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','request-promise','url','agi','exports'];(function(_0x168888,_0x1f8123){var _0x442a72=function(_0x247b8b){while(--_0x247b8b){_0x168888['push'](_0x168888['shift']());}};_0x442a72(++_0x1f8123);}(_0xb537,0x14c));var _0x7b53=function(_0x567f0b,_0x2e20b4){_0x567f0b=_0x567f0b-0x0;var _0x5b89bc=_0xb537[_0x567f0b];return _0x5b89bc;};'use strict';var rp=require(_0x7b53('0x0'));var url=require(_0x7b53('0x1'));var logger=require('../../../../../config/logger')(_0x7b53('0x2'));module[_0x7b53('0x3')]=function(_0x408156,_0x4146e4){var _0x20619d={'method':_0x7b53('0x4'),'uri':url[_0x7b53('0x5')](_0x4146e4['ndauth_url'],_0x7b53('0x6')),'form':{'grant_type':_0x7b53('0x7'),'username':_0x4146e4[_0x7b53('0x8')],'password':_0x4146e4[_0x7b53('0x7')]},'json':!![]};return rp(_0x20619d)[_0x7b53('0x9')](function(_0x567742){var _0x171845={'method':_0x7b53('0x4'),'uri':url['resolve'](_0x4146e4[_0x7b53('0xa')],_0x7b53('0xb')),'body':{'type':_0x4146e4['ndaactivity_type']||'message','channelId':_0x7b53('0xc'),'conversation':{'id':_0x408156[_0x7b53('0xd')]},'from':{'id':_0x408156[_0x7b53('0xe')],'name':_0x408156[_0x7b53('0xf')]},'recipient':{'id':_0x408156[_0x7b53('0x10')],'name':_0x408156[_0x7b53('0x11')]},'text':_0x4146e4['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x567742['access_token']},'json':!![]};if(_0x4146e4[_0x7b53('0x12')]){_0x171845['body'][_0x7b53('0x13')][_0x7b53('0x14')]=_0x4146e4['project'];}if(_0x4146e4['ndagenerate_audio']=='1'){_0x171845[_0x7b53('0x15')][_0x7b53('0x13')][_0x7b53('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7b53('0x17')};}if(_0x4146e4[_0x7b53('0x18')]){_0x171845[_0x7b53('0x15')][_0x7b53('0x13')][_0x7b53('0x19')]=_0x4146e4[_0x7b53('0x18')];if(_0x4146e4[_0x7b53('0x1a')]){_0x171845[_0x7b53('0x15')]['channelData']['CustomActionData']=_0x4146e4[_0x7b53('0x1a')];}}logger[_0x7b53('0x1b')](JSON['stringify'](_0x171845));return rp(_0x171845);});}; \ 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 892ae4f..675a99d 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 _0x016d=['exports'];(function(_0x180fa0,_0x59333c){var _0x5eb6be=function(_0x5cb1a1){while(--_0x5cb1a1){_0x180fa0['push'](_0x180fa0['shift']());}};_0x5eb6be(++_0x59333c);}(_0x016d,0x111));var _0xd016=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x016d[_0xa464c9];return _0x3d73c4;};'use strict';var asr=require('./lib/api');module[_0xd016('0x0')]=function(_0x25380e,_0x35f0f4,_0x42737b,_0xaa6637){return asr(_0x25380e,_0x35f0f4,_0x42737b,_0xaa6637);}; \ No newline at end of file +var _0x3a21=['./lib/api','exports'];(function(_0x697abd,_0x3415d8){var _0x419e65=function(_0x34ec32){while(--_0x34ec32){_0x697abd['push'](_0x697abd['shift']());}};_0x419e65(++_0x3415d8);}(_0x3a21,0x198));var _0x13a2=function(_0xe302be,_0x526050){_0xe302be=_0xe302be-0x0;var _0x50336a=_0x3a21[_0xe302be];return _0x50336a;};'use strict';var asr=require(_0x13a2('0x0'));module[_0x13a2('0x1')]=function(_0x2bb3b1,_0x2ee85c,_0x43d93d,_0x1eab84){return asr(_0x2bb3b1,_0x2ee85c,_0x43d93d,_0x1eab84);}; \ 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 f6168cd..9a62a5b 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 _0x3d02=['hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','send','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','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','Error\x20Tilde\x20ASR\x20socket','isNil','message','close','moment','../../../../../../config/logger','exports','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest'];(function(_0x1f19d9,_0x675592){var _0x1c71b7=function(_0x1d75f6){while(--_0x1d75f6){_0x1f19d9['push'](_0x1f19d9['shift']());}};_0x1c71b7(++_0x675592);}(_0x3d02,0x10a));var _0x23d0=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3d02[_0x4b7895];return _0x264180;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x23d0('0x0'));var crypto=require('crypto');var logger=require(_0x23d0('0x1'))('agi');module[_0x23d0('0x2')]=function(_0x18e5cb,_0x4e3a60,_0x35f634,_0xab52d6){return new BPromise(function(_0x3ada7f,_0x5b850b){logger['info']('Tilde\x20URI',_0xab52d6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1d9d7c=new WebSocket(_0xab52d6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x35cd51='';var _0x53be2a='0';var _0x15b319='1';var _0x343792=_0x23d0('0x3');function _0x1b235e(_0x673911){var _0x5e2652=crypto['createHash'](_0x23d0('0x4'));_0x5e2652['update'](_0x673911);return _0x5e2652[_0x23d0('0x5')](_0x23d0('0x6'));}function _0x3c5a04(){try{logger[_0x23d0('0x7')](_0x23d0('0x8'));var _0x19447e=moment()[_0x23d0('0x9')]();var _0x1c02ff=_0x1b235e(_0x19447e+_0x4e3a60+_0x35f634);_0x1d9d7c['send'](JSON[_0x23d0('0xa')]({'appID':_0x4e3a60,'timestamp':_0x19447e,'appKey':_0x1c02ff}));var _0x484313=fs[_0x23d0('0xb')](_0x18e5cb);_0x484313['on']('data',function(_0x23bcc0){_0x1d9d7c[_0x23d0('0xc')](_0x23bcc0);});_0x484313['on']('close',function(){_0x1d9d7c[_0x23d0('0xc')](_0x23d0('0xd'));});}catch(_0x24fdee){logger[_0x23d0('0xe')](_0x23d0('0xf'),JSON[_0x23d0('0xa')](_0x24fdee));_0x1d9d7c['terminate']();}}function _0x3ad245(_0x38fa22){try{if(_0x38fa22){var _0x168da6=JSON[_0x23d0('0x10')](_0x38fa22);switch(_0x168da6['status']){case 0x0:if(_0x168da6[_0x23d0('0x11')]){if(_0x168da6['result'][_0x23d0('0x12')]){logger[_0x23d0('0x7')](_0x23d0('0x13'),JSON[_0x23d0('0xa')](_0x168da6[_0x23d0('0x11')][_0x23d0('0x14')]));_0x35cd51=_0x168da6[_0x23d0('0x11')][_0x23d0('0x14')][0x0][_0x23d0('0x15')];_0x53be2a=_0x168da6['result']['hypotheses'][0x0][_0x23d0('0x16')];_0x15b319='0';_0x343792=_0x23d0('0x17');_0x1d9d7c[_0x23d0('0x18')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x15b319='1';_0x343792=_0x23d0('0x3');break;case 0x2:logger[_0x23d0('0x7')](_0x23d0('0x19'));_0x15b319='2';_0x343792=_0x23d0('0x19');break;case 0x9:logger[_0x23d0('0x7')](_0x23d0('0x1a'));_0x15b319='9';_0x343792=_0x23d0('0x1a');break;case 0xa:logger[_0x23d0('0x7')]('Authentication\x20failed.');_0x15b319='10';_0x343792=_0x23d0('0x1b');break;case 0xb:logger[_0x23d0('0x7')](_0x23d0('0x1c'));_0x15b319='11';_0x343792=_0x23d0('0x1c');}}}catch(_0x1152d9){logger[_0x23d0('0xe')](_0x23d0('0x1d'),JSON[_0x23d0('0xa')](_0x1152d9));_0x1d9d7c[_0x23d0('0x18')]();}}function _0x547b73(){logger[_0x23d0('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x3ada7f({'transcript':_0x35cd51,'confidence':_0x53be2a,'status':_0x15b319,'status_message':_0x343792});}function _0x4d4e30(_0x1dd5ed){logger[_0x23d0('0xe')](_0x23d0('0x1e'));if(!_[_0x23d0('0x1f')](_0x1dd5ed)){logger[_0x23d0('0xe')](_['isObject'](_0x1dd5ed)?JSON[_0x23d0('0xa')](_0x1dd5ed):_0x1dd5ed);}}_0x1d9d7c['on']('open',_0x3c5a04);_0x1d9d7c['on'](_0x23d0('0x20'),_0x3ad245);_0x1d9d7c['on'](_0x23d0('0x21'),_0x547b73);_0x1d9d7c['on']('error',_0x4d4e30);});}; \ No newline at end of file +var _0xf42e=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','lodash','moment','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','terminate'];(function(_0x31d3b8,_0xd47928){var _0x258cac=function(_0x5a2cc0){while(--_0x5a2cc0){_0x31d3b8['push'](_0x31d3b8['shift']());}};_0x258cac(++_0xd47928);}(_0xf42e,0x1ce));var _0xef42=function(_0x4fc67f,_0x383980){_0x4fc67f=_0x4fc67f-0x0;var _0x42bd3a=_0xf42e[_0x4fc67f];return _0x42bd3a;};'use strict';var BPromise=require('bluebird');var _=require(_0xef42('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xef42('0x1'));var crypto=require('crypto');var logger=require(_0xef42('0x2'))(_0xef42('0x3'));module['exports']=function(_0x47203b,_0x3c887d,_0x5e2c6a,_0xb017b0){return new BPromise(function(_0x58c827,_0x1ece8c){logger[_0xef42('0x4')](_0xef42('0x5'),_0xb017b0||_0xef42('0x6'));var _0x1b21e5=new WebSocket(_0xb017b0||_0xef42('0x6'),{'perMessageDeflate':![]});var _0x24bc3b='';var _0x5a1505='0';var _0x482e0d='1';var _0x6b2447=_0xef42('0x7');function _0x667dac(_0x2b11a6){var _0x58abdb=crypto[_0xef42('0x8')](_0xef42('0x9'));_0x58abdb[_0xef42('0xa')](_0x2b11a6);return _0x58abdb['digest']('hex');}function _0x4117e0(){try{logger[_0xef42('0x4')](_0xef42('0xb'));var _0x179b32=moment()[_0xef42('0xc')]();var _0x32d2c2=_0x667dac(_0x179b32+_0x3c887d+_0x5e2c6a);_0x1b21e5[_0xef42('0xd')](JSON[_0xef42('0xe')]({'appID':_0x3c887d,'timestamp':_0x179b32,'appKey':_0x32d2c2}));var _0x2c9618=fs[_0xef42('0xf')](_0x47203b);_0x2c9618['on'](_0xef42('0x10'),function(_0x298988){_0x1b21e5['send'](_0x298988);});_0x2c9618['on']('close',function(){_0x1b21e5[_0xef42('0xd')](_0xef42('0x11'));});}catch(_0x26c819){logger['error'](_0xef42('0x12'),JSON[_0xef42('0xe')](_0x26c819));_0x1b21e5['terminate']();}}function _0x47aa01(_0x10937e){try{if(_0x10937e){var _0x3cea68=JSON['parse'](_0x10937e);switch(_0x3cea68[_0xef42('0x13')]){case 0x0:if(_0x3cea68[_0xef42('0x14')]){if(_0x3cea68[_0xef42('0x14')][_0xef42('0x15')]){logger[_0xef42('0x4')](_0xef42('0x16'),JSON[_0xef42('0xe')](_0x3cea68['result']['hypotheses']));_0x24bc3b=_0x3cea68[_0xef42('0x14')]['hypotheses'][0x0][_0xef42('0x17')];_0x5a1505=_0x3cea68['result']['hypotheses'][0x0][_0xef42('0x18')];_0x482e0d='0';_0x6b2447='Success.';_0x1b21e5['terminate']();}}break;case 0x1:logger[_0xef42('0x4')](_0xef42('0x7'));_0x482e0d='1';_0x6b2447=_0xef42('0x7');break;case 0x2:logger['info'](_0xef42('0x19'));_0x482e0d='2';_0x6b2447='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xef42('0x1a'));_0x482e0d='9';_0x6b2447='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xef42('0x4')](_0xef42('0x1b'));_0x482e0d='10';_0x6b2447=_0xef42('0x1b');break;case 0xb:logger[_0xef42('0x4')](_0xef42('0x1c'));_0x482e0d='11';_0x6b2447=_0xef42('0x1c');}}}catch(_0x47b777){logger[_0xef42('0x1d')](_0xef42('0x1e'),JSON['stringify'](_0x47b777));_0x1b21e5[_0xef42('0x1f')]();}}function _0x119bb7(){logger[_0xef42('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x58c827({'transcript':_0x24bc3b,'confidence':_0x5a1505,'status':_0x482e0d,'status_message':_0x6b2447});}function _0x50e523(_0x1f057f){logger[_0xef42('0x1d')](_0xef42('0x20'));if(!_[_0xef42('0x21')](_0x1f057f)){logger[_0xef42('0x1d')](_[_0xef42('0x22')](_0x1f057f)?JSON['stringify'](_0x1f057f):_0x1f057f);}}_0x1b21e5['on'](_0xef42('0x23'),_0x4117e0);_0x1b21e5['on'](_0xef42('0x24'),_0x47aa01);_0x1b21e5['on'](_0xef42('0x25'),_0x119bb7);_0x1b21e5['on'](_0xef42('0x1d'),_0x50e523);});}; \ 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 e0fefac..f7f2cf3 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 _0x7899=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7899,0x167));var _0x9789=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x7899[_0x3b150c];return _0x5cd414;};var asr=require('./asr');module[_0x9789('0x0')]={'asr':asr}; \ No newline at end of file +var _0xeb36=['exports','./asr'];(function(_0x5618e7,_0x367e08){var _0x2c9839=function(_0xb08c3c){while(--_0xb08c3c){_0x5618e7['push'](_0x5618e7['shift']());}};_0x2c9839(++_0x367e08);}(_0xeb36,0x119));var _0x6eb3=function(_0x403553,_0x1ef52b){_0x403553=_0x403553-0x0;var _0x2c7e7f=_0xeb36[_0x403553];return _0x2c7e7f;};var asr=require(_0x6eb3('0x0'));module[_0x6eb3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 475e2cb..edd1683 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 _0x6873=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x6873,0xac));var _0x3687=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x6873[_0x403fc7];return _0x5d0827;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x3687('0x0'))[_0x3687('0x1')];var AGIError=require(_0x3687('0x2'));var AGIChannel=require(_0x3687('0x3'));var AGIServer=function(_0x3be8a1,_0x4bbecf,_0x247d96){var _0x591260=this,_0x3be8a1=_0x3be8a1||0x11dd,_0x4bbecf=_0x4bbecf||_0x3687('0x4'),_0x4ecd9e=null,_0x3ff2e3=0x0;EventEmitter[_0x3687('0x5')](_0x591260);function _0x1be8c0(){if(!_0x3be8a1){_0x591260[_0x3687('0x6')](_0x3687('0x7'),new AGIError(_0x3687('0x8')));return![];}_0x4ecd9e=net[_0x3687('0x9')]();_0x4ecd9e[_0x3687('0xa')](_0x3be8a1,_0x4bbecf);_0x4ecd9e['on']('listening',function(){_0x591260[_0x3687('0x6')](_0x3687('0xb'));});_0x4ecd9e['on']('connection',function(_0x3e81c1){_0x4ecd9e[_0x3687('0xc')](function(_0x1f138a,_0x3decbe){if(_0x1f138a){_0x591260[_0x3687('0x6')]('error',new AGIError(_0x3687('0xd'),_0x1f138a));}else if(_0x247d96&&_0x247d96<0x0){_0x591260[_0x3687('0x6')]('error',new AGIError(_0x3687('0xe')));_0x3e81c1[_0x3687('0xf')]();}else if(_0x247d96&&_0x247d96>0x0&&_0x247d96<_0x3decbe){_0x3ff2e3+=0x1;_0x591260[_0x3687('0x6')](_0x3687('0x7'),new AGIError(_0x3687('0x10'),_0x3ff2e3));_0x3e81c1[_0x3687('0xf')]();}else{var _0x15b481=new AGIChannel(_0x3e81c1);_0x15b481['on'](_0x3687('0x11'),function(){_0x591260[_0x3687('0x6')]('connection',_0x15b481);});}});});_0x4ecd9e['on'](_0x3687('0x7'),function(_0xe62468){_0x591260[_0x3687('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xe62468[_0x3687('0x12')]));});_0x4ecd9e['on'](_0x3687('0x13'),function(){_0x591260[_0x3687('0x6')](_0x3687('0x13'),new AGIError(_0x3687('0x14')));});}process[_0x3687('0x15')](function(){_0x1be8c0();});};util['inherits'](AGIServer,EventEmitter);module[_0x3687('0x16')]=function(_0x149320,_0xf8c3b,_0xbd6230){return new AGIServer(_0x149320,_0xf8c3b,_0xbd6230);}; \ No newline at end of file +var _0xf3dc=['E_AGI_SERVER_VOICE_DISABLED','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./error','./channel','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_ERROR'];(function(_0x2a9672,_0xf3a864){var _0x5c1537=function(_0x5cd80c){while(--_0x5cd80c){_0x2a9672['push'](_0x2a9672['shift']());}};_0x5c1537(++_0xf3a864);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x138208,_0x140722){_0x138208=_0x138208-0x0;var _0x4f93b5=_0xf3dc[_0x138208];return _0x4f93b5;};'use strict';var util=require(_0xcf3d('0x0'));var net=require(_0xcf3d('0x1'));var EventEmitter=require(_0xcf3d('0x2'))['EventEmitter'];var AGIError=require(_0xcf3d('0x3'));var AGIChannel=require(_0xcf3d('0x4'));var AGIServer=function(_0x42319d,_0x226c79,_0x17b83e){var _0x44b3da=this,_0x42319d=_0x42319d||0x11dd,_0x226c79=_0x226c79||'127.0.0.1',_0x55074b=null,_0x5b1441=0x0;EventEmitter['call'](_0x44b3da);function _0x1a69de(){if(!_0x42319d){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0x6'),new AGIError(_0xcf3d('0x7')));return![];}_0x55074b=net[_0xcf3d('0x8')]();_0x55074b[_0xcf3d('0x9')](_0x42319d,_0x226c79);_0x55074b['on'](_0xcf3d('0xa'),function(){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0xa'));});_0x55074b['on']('connection',function(_0x5b4a07){_0x55074b['getConnections'](function(_0x468f7e,_0x5047b9){if(_0x468f7e){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0x6'),new AGIError(_0xcf3d('0xb'),_0x468f7e));}else if(_0x17b83e&&_0x17b83e<0x0){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0x6'),new AGIError(_0xcf3d('0xc')));_0x5b4a07[_0xcf3d('0xd')]();}else if(_0x17b83e&&_0x17b83e>0x0&&_0x17b83e<_0x5047b9){_0x5b1441+=0x1;_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5b1441));_0x5b4a07['destroy']();}else{var _0x119e66=new AGIChannel(_0x5b4a07);_0x119e66['on'](_0xcf3d('0xe'),function(){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0xf'),_0x119e66);});}});});_0x55074b['on'](_0xcf3d('0x6'),function(_0x2b401e){_0x44b3da[_0xcf3d('0x5')](_0xcf3d('0x6'),new AGIError(_0xcf3d('0xb'),_0x2b401e[_0xcf3d('0x10')]));});_0x55074b['on']('close',function(){_0x44b3da['emit'](_0xcf3d('0x11'),new AGIError(_0xcf3d('0x12')));});}process['nextTick'](function(){_0x1a69de();});};util[_0xcf3d('0x13')](AGIServer,EventEmitter);module[_0xcf3d('0x14')]=function(_0x33d417,_0x18d5fb,_0x369c7a){return new AGIServer(_0x33d417,_0x18d5fb,_0x369c7a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c25d432..5871070 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 _0x6301=['beep','NOBEEP','recordFile','intKey','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','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','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','bcc','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','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','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','path','util','lodash','shelljs','odbc','moment','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','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','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','saveRestApiResult','isPlainObject','%s.%s','isArray','length','setVariable','split','extra','toString','getAndSetVariable','result','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','list_id','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','hiddendigitsnum','generate','substr','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','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s'];(function(_0x4e9a47,_0x275288){var _0x5865e3=function(_0x2934b0){while(--_0x2934b0){_0x4e9a47['push'](_0x4e9a47['shift']());}};_0x5865e3(++_0x275288);}(_0x6301,0x9e));var _0x1630=function(_0x2e3942,_0x175d6a){_0x2e3942=_0x2e3942-0x0;var _0x2bfb83=_0x6301[_0x2e3942];return _0x2bfb83;};'use strict';var fs=require('fs');var path=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var _=require(_0x1630('0x2'));var sh=require(_0x1630('0x3'));var odbc=require(_0x1630('0x4'))();var rs=require('randomstring');var moment=require(_0x1630('0x5'));var Mustache=require('mustache');var rp=require(_0x1630('0x6'));var logger=require(_0x1630('0x7'))(_0x1630('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x1630('0x9');var recursiveMapAttributes=[_0x1630('0xa'),_0x1630('0xb')];var verticesWithRetry=['menu',_0x1630('0xc'),_0x1630('0xd')];var AGIVertices=function(_0x5c3f0e,_0x389ec4,_0x5a8036){this['channel']=_0x5c3f0e;this[_0x1630('0xe')]=_0x389ec4;this[_0x1630('0xf')]=_0x5a8036;};AGIVertices[_0x1630('0x10')][_0x1630('0x11')]=function(_0x4b479d,_0x1db3f5){this[_0x1630('0xe')][_0x1630('0x12')](_0x4b479d)[_0x1630('0x13')](function(_0x325aaf){_0x1db3f5(null,_0x325aaf?_0x325aaf[_0x1630('0x14')]:![]);})[_0x1630('0x15')](function(_0x144105){_0x1db3f5(_0x144105);});};AGIVertices['prototype'][_0x1630('0x16')]=function(_0x3225c8,_0x56bced){this[_0x1630('0xe')][_0x1630('0x17')](_0x3225c8)[_0x1630('0x13')](function(_0x159db2){_0x56bced(null,_0x159db2?_0x159db2[_0x1630('0x14')]:![]);})['catch'](function(_0x635ac8){_0x56bced(_0x635ac8);});};AGIVertices[_0x1630('0x10')][_0x1630('0x18')]=function(_0x31ef6d,_0x42a5dd){this[_0x1630('0xe')][_0x1630('0x19')](_0x31ef6d)[_0x1630('0x13')](function(_0x4a7cae){_0x42a5dd(null,_0x4a7cae?_0x4a7cae[_0x1630('0x14')]:![]);})['catch'](function(_0x4d442d){_0x42a5dd(_0x4d442d);});};AGIVertices[_0x1630('0x10')][_0x1630('0x1a')]=function(_0x5f1031,_0x3fc800){this[_0x1630('0xe')][_0x1630('0x1b')](_0x5f1031)[_0x1630('0x13')](function(_0x3f41fa){_0x3fc800(null,_0x3f41fa?_0x3f41fa[_0x1630('0x1c')]:![]);})[_0x1630('0x15')](function(_0x4a16a4){_0x3fc800(_0x4a16a4);});};AGIVertices['prototype'][_0x1630('0x1d')]=function(_0x4fd678,_0x31126a){this[_0x1630('0xe')][_0x1630('0x1e')](_0x4fd678)[_0x1630('0x13')](function(_0x3ebd11){_0x31126a(null,_0x3ebd11?_0x3ebd11['name']:![]);})[_0x1630('0x15')](function(_0x2b2479){_0x31126a(_0x2b2479);});};AGIVertices[_0x1630('0x10')][_0x1630('0x1f')]=function(_0x149647,_0x1af6dc){this[_0x1630('0xe')][_0x1630('0x20')](_0x149647)['then'](function(_0x380d6e){_0x1af6dc(null,_0x380d6e?_0x380d6e[_0x1630('0x14')]:![]);})[_0x1630('0x15')](function(_0x381db1){_0x1af6dc(_0x381db1);});};AGIVertices[_0x1630('0x10')]['getSound']=function(_0x491150,_0x1eb92d){var _0x138e98=this;this[_0x1630('0xe')][_0x1630('0x21')](_0x491150)[_0x1630('0x13')](function(_0xb17c1e){_0x1eb92d(null,_0xb17c1e?_0x138e98[_0x1630('0x22')](_0xb17c1e[_0x1630('0x23')]):![]);})[_0x1630('0x15')](function(_0x43270e){_0x1eb92d(_0x43270e);});};AGIVertices[_0x1630('0x10')][_0x1630('0x24')]=function(_0x7cc557,_0x2cd8bf){this[_0x1630('0xe')]['getMailAccountById'](_0x7cc557)[_0x1630('0x13')](function(_0x55841b){_0x2cd8bf(null,_0x55841b?_0x55841b:![]);})[_0x1630('0x15')](function(_0x31cb70){_0x2cd8bf(_0x31cb70);});};AGIVertices[_0x1630('0x10')][_0x1630('0x25')]=function(_0x113546,_0x50afa4,_0x47037f){this['mailRpc']['sendMailMessage'](_0x113546,_0x50afa4)['then'](function(){_0x47037f(null);})['catch'](function(_0x4b4014){_0x47037f(_0x4b4014);});};AGIVertices[_0x1630('0x10')][_0x1630('0x26')]=function(_0x46b093,_0x5d34ae){this[_0x1630('0xe')][_0x1630('0x27')](_0x46b093)[_0x1630('0x13')](function(_0x1719bd){if(_0x1719bd){if(_0x1719bd['IntervalId']){_0x5d34ae(null,[_0x1719bd[_0x1630('0x28')]]);}else{_0x5d34ae(null,_[_0x1630('0x29')](_0x1719bd[_0x1630('0x2a')],'interval'));}}else{_0x5d34ae(null,![]);}})[_0x1630('0x15')](function(_0x381fa7){_0x5d34ae(_0x381fa7);});};AGIVertices[_0x1630('0x10')][_0x1630('0x22')]=function(_0x25f25b){return util[_0x1630('0x2b')](_0x1630('0x2c'),FILES_PATH,_0x25f25b);};AGIVertices[_0x1630('0x10')]['getQueryOdbc']=function(_0x76f6c,_0x3a25df,_0x3fe46){odbc['open'](_0x76f6c,function(_0x391d64){if(_0x391d64){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x391d64);_0x3fe46(_0x391d64);}else{logger[_0x1630('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x1630('0x2e')](_0x3a25df,function(_0x166f52,_0x325805){if(_0x166f52){logger['info'](_0x1630('0x2f'),_0x3a25df);_0x3fe46(_0x166f52);}else{logger[_0x1630('0x2d')](_0x1630('0x30'),_0x3a25df);odbc[_0x1630('0x31')](function(_0x11f7c7){if(_0x11f7c7){logger[_0x1630('0x32')](_0x1630('0x33'),_0x11f7c7);}_0x3fe46(null,_0x325805);});}});}});};AGIVertices[_0x1630('0x10')][_0x1630('0x34')]=function(_0x8128fc,_0x391556){this[_0x1630('0xe')][_0x1630('0x35')](_0x8128fc)[_0x1630('0x13')](function(_0x580bf2){_0x391556(null,_0x580bf2?_0x580bf2:![]);})[_0x1630('0x15')](function(_0x1aba4c){_0x391556(_0x1aba4c);});};AGIVertices[_0x1630('0x10')][_0x1630('0x36')]=function(_0x30905c,_0x376b75){this[_0x1630('0xe')][_0x1630('0x36')](_0x30905c)['then'](function(_0x5f2213){_0x376b75(null,_0x5f2213);})[_0x1630('0x15')](function(_0x587076){_0x376b75(_0x587076);});};AGIVertices[_0x1630('0x10')][_0x1630('0x37')]=function(_0x4ba564,_0x8643a7,_0x438863){this[_0x1630('0xe')][_0x1630('0x37')]({'uniqueid':this[_0x1630('0x38')][_0x1630('0x39')],'node':_0x4ba564[_0x1630('0x3a')],'application':_0x4ba564[_0x1630('0x3b')],'data':_0x8643a7||null,'project_name':this[_0x1630('0x38')]['arg_1'],'callerid':this[_0x1630('0x38')][_0x1630('0x3c')]})[_0x1630('0x13')](function(_0x54eeea){if(_0x438863){_0x438863(null,_0x54eeea);}})[_0x1630('0x15')](function(_0x5a0057){if(_0x438863){_0x438863(_0x5a0057);}});};AGIVertices[_0x1630('0x10')]['createSquareRecording']=function(_0x288482,_0x2595ef,_0x1e2e72,_0x70bdfa){this[_0x1630('0xe')][_0x1630('0x3d')]({'uniqueid':this[_0x1630('0x38')]['uniqueid'],'callerid':this[_0x1630('0x38')][_0x1630('0x3c')],'calleridname':this['channel']['calleridname'],'context':this[_0x1630('0x38')][_0x1630('0x3e')],'extension':this[_0x1630('0x38')][_0x1630('0x3f')],'priority':this[_0x1630('0x38')][_0x1630('0x40')],'accountcode':this[_0x1630('0x38')][_0x1630('0x41')],'dnid':this[_0x1630('0x38')][_0x1630('0x42')],'projectName':this[_0x1630('0x38')][_0x1630('0x43')],'saveName':_0x2595ef,'filename':_0x288482[_0x1630('0x44')]||_0x2595ef,'savePath':_0x1e2e72})[_0x1630('0x13')](function(_0x3115bb){_0x70bdfa(null,_0x3115bb);})[_0x1630('0x15')](function(_0x169d3e){_0x70bdfa(_0x169d3e);});};AGIVertices['prototype'][_0x1630('0x45')]=function(_0x2d12b1,_0x2dc1a8,_0x4df54b){this['rpc'][_0x1630('0x45')]({'uniqueid':this[_0x1630('0x38')][_0x1630('0x39')],'body':_0x2d12b1,'direction':_0x2dc1a8})[_0x1630('0x13')](function(_0x31e3b4){if(_0x4df54b){_0x4df54b(null,_0x31e3b4);}})[_0x1630('0x15')](function(_0x1668ec){if(_0x4df54b){_0x4df54b(_0x1668ec);}});};AGIVertices[_0x1630('0x10')][_0x1630('0x46')]=function(_0x1608eb,_0x61baa7){this[_0x1630('0xe')][_0x1630('0x46')]({'firstName':_[_0x1630('0x47')](_0x1608eb[_0x1630('0x14')])||_[_0x1630('0x48')](_0x1608eb[_0x1630('0x14')])?_0x1630('0x49')+Math[_0x1630('0x4a')]():_0x1608eb[_0x1630('0x14')],'lastName':_[_0x1630('0x47')](_0x1608eb[_0x1630('0x4b')])||_[_0x1630('0x48')](_0x1608eb[_0x1630('0x4b')])?null:_0x1608eb['lastName'],'phone':_0x1608eb['phone'],'ListId':_0x1608eb['list_id'],'scheduledat':_0x1608eb[_0x1630('0x4c')],'callbackUniqueid':this['channel'][_0x1630('0x39')],'tags':_0x1630('0x4d'),'description':_0x1630('0x4e')+_0x1608eb[_0x1630('0x4c')]['toString'](),'priority':_0x1608eb[_0x1630('0x4f')]})[_0x1630('0x13')](function(_0x52c817){_0x61baa7(null,_0x52c817);})[_0x1630('0x15')](function(_0x33a227){_0x61baa7(_0x33a227);});};AGIVertices['prototype'][_0x1630('0x50')]=function(_0x955c56,_0x49c027){this[_0x1630('0xe')]['getPauseById'](_0x955c56)['then'](function(_0x1d659e){_0x49c027(null,_0x1d659e?_0x1d659e[_0x1630('0x14')]:![]);})[_0x1630('0x15')](function(_0x560a12){_0x49c027(_0x560a12);});};AGIVertices[_0x1630('0x10')][_0x1630('0x51')]=function(_0x28bba4,_0x44f602,_0x47b09f){var _0x48deb3={'role':_0x1630('0x52')};_0x48deb3[_0x28bba4]=this['channel'][_0x1630('0x3c')];this[_0x1630('0xe')][_0x1630('0x51')](_0x48deb3,_0x44f602,this['channel']['uniqueid'])['then'](function(_0x55f56c){_0x47b09f(null,_[_0x1630('0x48')](_0x55f56c)?![]:!![]);})['catch'](function(_0x4c8416){logger['error'](_0x4c8416);_0x47b09f(null,![]);});};AGIVertices[_0x1630('0x10')][_0x1630('0x53')]=function(_0x80d3c7,_0x1cbf44){var _0x217271={'role':_0x1630('0x52')};_0x217271[_0x80d3c7]=this[_0x1630('0x38')][_0x1630('0x3c')];this['rpc'][_0x1630('0x53')](_0x217271)[_0x1630('0x13')](function(_0x49347){_0x1cbf44(null,_[_0x1630('0x48')](_0x49347)?![]:!![]);})[_0x1630('0x15')](function(_0x3070d7){logger[_0x1630('0x32')](_0x3070d7);_0x1cbf44(null,![]);});};AGIVertices[_0x1630('0x10')][_0x1630('0x54')]=function(_0xf354b,_0x279d58){var _0x3d9d49={'role':_0x1630('0x52')};_0x3d9d49[_0xf354b]=this['channel']['callerid'];this[_0x1630('0xe')]['agentLogout'](_0x3d9d49)[_0x1630('0x13')](function(_0x1cf938){_0x279d58(null,_[_0x1630('0x48')](_0x1cf938)?![]:!![]);})[_0x1630('0x15')](function(_0x4c3ed3){logger[_0x1630('0x32')](_0x4c3ed3);_0x279d58(null,![]);});};AGIVertices[_0x1630('0x10')][_0x1630('0x55')]=function(_0x3bb55c,_0x4a04c6){var _0x1ce7da={'role':_0x1630('0x52')};_0x1ce7da[_0x3bb55c]=this[_0x1630('0x38')][_0x1630('0x3c')];var _0x752539=_0x3bb55c!=_0x1630('0x56')?util[_0x1630('0x2b')]('%s/%s@from-sip/n',_0x1630('0x57'),this[_0x1630('0x38')][_0x1630('0x3c')]):undefined;this[_0x1630('0xe')][_0x1630('0x55')](_0x1ce7da,_0x752539)[_0x1630('0x13')](function(_0x204cf7){_0x4a04c6(null,_[_0x1630('0x48')](_0x204cf7)?![]:!![]);})['catch'](function(_0x4c6d4b){logger[_0x1630('0x32')](_0x4c6d4b);_0x4a04c6(null,![]);});};AGIVertices['prototype'][_0x1630('0x58')]=function(_0x40052d,_0x5075fa){sh['exec'](_['trim'](_0x40052d),function(_0x109d2f,_0x41a2aa){var _0x3138a5=_0x41a2aa['replace'](/(\r\n|\n|\r)/gm,'');_0x5075fa(null,_0x3138a5);});};AGIVertices[_0x1630('0x10')][_0x1630('0x59')]=function(_0x53d60b,_0x48c8f5){scripts[_0x1630('0x59')](_0x53d60b[_0x1630('0x5a')],_0x53d60b['google_cloud_tts_text_type']||_0x1630('0x5b'),_0x53d60b[_0x1630('0x5b')],_0x53d60b[_0x1630('0x5c')]||_0x1630('0x5d'),_0x53d60b[_0x1630('0x5e')]||_0x1630('0x5f'),_0x53d60b[_0x1630('0x60')]||_0x1630('0x61'))[_0x1630('0x13')](function(_0x47b311){_0x48c8f5(null,_0x47b311);})['catch'](function(_0x2b7a64){_0x48c8f5(_0x2b7a64);});};AGIVertices[_0x1630('0x10')][_0x1630('0x62')]=function(_0x3e44a0,_0x2f0801){scripts[_0x1630('0x62')](_0x3e44a0[_0x1630('0x5b')],_0x3e44a0[_0x1630('0x63')]||'en',0x1)[_0x1630('0x13')](function(_0x4109e1){_0x2f0801(null,_0x4109e1);})[_0x1630('0x15')](function(_0x182ffb){_0x2f0801(_0x182ffb);});};AGIVertices[_0x1630('0x10')][_0x1630('0x64')]=function(_0x3af828,_0x3d185f){var _0x4d1786={'uri':_0x3af828[_0x1630('0x65')],'method':_0x3af828[_0x1630('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3af828['timeout'])==='number'&&parseInt(_0x3af828[_0x1630('0x67')])>=0x1?parseInt(_0x3af828[_0x1630('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x1630('0x68')]([_0x1630('0x69'),_0x1630('0x6a')],_0x4d1786[_0x1630('0x66')]['toUpperCase']())){try{_0x4d1786[_0x1630('0x6b')]=_0x3af828[_0x1630('0xb')]?JSON[_0x1630('0x6c')](_0x3af828['rawBody']):{};}catch(_0x2d7ff1){logger['error'](_0x1630('0x6d'),_0x2d7ff1);}}try{_0x4d1786[_0x1630('0x6e')]=_0x3af828[_0x1630('0xa')]?JSON[_0x1630('0x6c')](_0x3af828[_0x1630('0xa')]):{};}catch(_0x4e74e6){logger[_0x1630('0x32')](_0x1630('0x6f'),_0x4e74e6);}if(_0x3af828[_0x1630('0x70')]){try{var _0x2d4492=require(_0x3af828[_0x1630('0x70')])[_0x1630('0x71')](this,_0x4d1786);_0x4d1786[_0x1630('0x72')]=Mustache[_0x1630('0x73')](_0x3af828['url'],_0x2d4492,{},['$$','$$']);if(_0x4d1786['headers']){_0x4d1786[_0x1630('0x6e')]=JSON['parse'](Mustache['render'](JSON[_0x1630('0x74')](_0x4d1786[_0x1630('0x6e')]),_0x2d4492,{},['$$','$$']));}if(_0x4d1786[_0x1630('0x6b')]){_0x4d1786[_0x1630('0x6b')]=JSON[_0x1630('0x6c')](Mustache[_0x1630('0x73')](JSON[_0x1630('0x74')](_0x4d1786[_0x1630('0x6b')]),_0x2d4492,{},['$$','$$']));}}catch(_0x269db3){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x269db3);}}rp(_0x4d1786)[_0x1630('0x13')](function(_0x2e98ae){var _0x37e591={'statusCode':_0x2e98ae['statusCode']||0xc8,'statusMessage':_0x2e98ae['statusMessage']||'OK','headers':_0x2e98ae['headers']||{},'body':_0x2e98ae[_0x1630('0x6b')]||{}};_0x3d185f(null,_0x37e591);})['catch'](function(_0x57b5b2){var _0x4e0b85={'statusCode':_0x57b5b2[_0x1630('0x75')]||0x1f4,'statusMessage':_0x57b5b2[_0x1630('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x57b5b2[_0x1630('0x77')]['headers']||{},'body':_0x57b5b2[_0x1630('0x77')][_0x1630('0x6b')]||{}};_0x3d185f(null,_0x4e0b85);});};AGIVertices['prototype'][_0x1630('0x78')]=function(_0x30a0cb,_0x43dc46){scripts[_0x1630('0x78')](this[_0x1630('0x38')][_0x1630('0x39')],_0x30a0cb['key'],_0x30a0cb[_0x1630('0x5b')],_0x30a0cb[_0x1630('0x79')]||'en')[_0x1630('0x13')](function(_0x2de852){_0x43dc46(null,_0x2de852);})[_0x1630('0x15')](function(_0x5bb95b){_0x43dc46(_0x5bb95b);});};AGIVertices[_0x1630('0x10')][_0x1630('0x7a')]=function(_0x5ab8d9,_0x36bc4c){scripts['sestekNDA'](this[_0x1630('0x38')],_0x5ab8d9)[_0x1630('0x13')](function(_0x4d8b73){_0x36bc4c(null,_0x4d8b73);})[_0x1630('0x15')](function(_0x5b4360){_0x36bc4c(_0x5b4360);});};AGIVertices[_0x1630('0x10')]['ispeechTTS']=function(_0x44576c,_0x5b4b90){scripts[_0x1630('0x7b')](_0x44576c[_0x1630('0x7c')],_0x44576c[_0x1630('0x5b')],_0x44576c[_0x1630('0x7d')]||_0x1630('0x5d'),_0x44576c['speed'])[_0x1630('0x13')](function(_0x252aa4){_0x5b4b90(null,_0x252aa4);})[_0x1630('0x15')](function(_0x5a2baf){_0x5b4b90(_0x5a2baf);});};AGIVertices[_0x1630('0x10')]['ispeechASR']=function(_0x5d6ea0,_0xab4706,_0x62f707){scripts[_0x1630('0x7e')](_0xab4706,_0x5d6ea0[_0x1630('0x7c')],_0x5d6ea0[_0x1630('0x7f')]||_0x1630('0x5d'),this[_0x1630('0x80')](_0x5d6ea0[_0x1630('0x81')])?_0x5d6ea0[_0x1630('0x81')]:undefined)[_0x1630('0x13')](function(_0x20100f){_0x62f707(null,_0x20100f);})[_0x1630('0x15')](function(_0xfbb26c){_0x62f707(_0xfbb26c);});};AGIVertices[_0x1630('0x10')][_0x1630('0x82')]=function(_0xab444f,_0x4a3b03){scripts['awsPolly'](_0xab444f[_0x1630('0x83')],_0xab444f[_0x1630('0x84')],_0xab444f[_0x1630('0x85')],_0xab444f[_0x1630('0x86')]||_0x1630('0x87'),_0xab444f[_0x1630('0x5b')],_0xab444f[_0x1630('0x88')]||_0x1630('0x5b'))[_0x1630('0x13')](function(_0x646fd0){_0x4a3b03(null,_0x646fd0);})[_0x1630('0x15')](function(_0x155605){_0x4a3b03(_0x155605);});};AGIVertices['prototype']['awsLex']=function(_0x2bcae3,_0x4fe299){scripts['awsLex'](this['channel']['uniqueid'],_0x2bcae3['aws_access_key_id'],_0x2bcae3['aws_secret_access_key'],_0x2bcae3[_0x1630('0x89')],_0x2bcae3[_0x1630('0x5b')],_0x2bcae3[_0x1630('0x8a')])[_0x1630('0x13')](function(_0x5aa890){_0x4fe299(null,_0x5aa890);})[_0x1630('0x15')](function(_0x3cfa31){_0x4fe299(_0x3cfa31);});};AGIVertices[_0x1630('0x10')][_0x1630('0x8b')]=function(_0x809f50,_0x66e811,_0x4c853d){scripts[_0x1630('0x8b')](_0x66e811,_0x809f50[_0x1630('0x7c')],_0x809f50[_0x1630('0x8c')]||'en-US')[_0x1630('0x13')](function(_0x42f310){_0x4c853d(null,_0x42f310);})[_0x1630('0x15')](function(_0x3a3531){_0x4c853d(_0x3a3531);});};AGIVertices['prototype'][_0x1630('0x8d')]=function(_0x2b26d8,_0x3e1290,_0x673bb2){scripts[_0x1630('0x8d')](_0x3e1290,_0x2b26d8[_0x1630('0x8e')],_0x2b26d8[_0x1630('0x8f')],_0x2b26d8[_0x1630('0x72')])[_0x1630('0x13')](function(_0x332e4f){_0x673bb2(null,_0x332e4f);})[_0x1630('0x15')](function(_0x1c5665){_0x673bb2(_0x1c5665);});};AGIVertices[_0x1630('0x10')][_0x1630('0x90')]=function(_0x34b4b6){var _0x6bf66e=_[_0x1630('0x68')](verticesWithRetry,_0x34b4b6[_0x1630('0x3b')])?_0x34b4b6:_[_0x1630('0x91')](_0x34b4b6);for(var _0xddc414 in _0x6bf66e){if(_0x6bf66e[_0x1630('0x92')](_0xddc414)){if(_0x6bf66e[_0xddc414]&&_[_0x1630('0x93')](_0x6bf66e[_0xddc414])){if(_['includes'](recursiveMapAttributes,_0xddc414)){_0x6bf66e[_0xddc414]=this[_0x1630('0x94')](_0x6bf66e[_0xddc414]);}else{_0x6bf66e[_0xddc414]=this[_0x1630('0x95')](_0x6bf66e[_0xddc414]);}}}}return _0x6bf66e;};AGIVertices[_0x1630('0x10')]['recursiveNodeIndex']=function(_0x4fb039){for(var _0x480c7e in _0x4fb039){if(_0x4fb039[_0x1630('0x92')](_0x480c7e)){if(_['isPlainObject'](_0x4fb039[_0x480c7e])){this[_0x1630('0x96')](_0x4fb039[_0x480c7e]);}else if(_['isArray'](_0x4fb039[_0x480c7e])){for(var _0x2f82ae=0x0;_0x2f82ae<_0x4fb039[_0x480c7e]['length'];_0x2f82ae++){this[_0x1630('0x96')](_0x4fb039[_0x480c7e][_0x2f82ae]);}}else if(_[_0x1630('0x93')](_0x4fb039[_0x480c7e])){_0x4fb039[_0x480c7e]=this[_0x1630('0x95')](_0x4fb039[_0x480c7e]);}}}};AGIVertices['prototype'][_0x1630('0x97')]=function(_0x50d1a9,_0x2517db){for(var _0x1ab1ca in _0x50d1a9){if(_0x50d1a9[_0x1630('0x92')](_0x1ab1ca)){if(_[_0x1630('0x98')](_0x50d1a9[_0x1ab1ca])){if(!_[_0x1630('0x47')](_0x50d1a9[_0x1ab1ca])){this[_0x1630('0x97')](_0x50d1a9[_0x1ab1ca],util[_0x1630('0x2b')](_0x1630('0x99'),_0x2517db,_0x1ab1ca));}}else if(_[_0x1630('0x9a')](_0x50d1a9[_0x1ab1ca])){for(var _0x6ae15c=0x0;_0x6ae15c<_0x50d1a9[_0x1ab1ca][_0x1630('0x9b')];_0x6ae15c++){this[_0x1630('0x97')](_0x50d1a9[_0x1ab1ca][_0x6ae15c],util[_0x1630('0x2b')](_0x1630('0x99'),_0x2517db,_0x1ab1ca+'['+_0x6ae15c+']'));}}else{if(!_[_0x1630('0x48')](_0x50d1a9[_0x1ab1ca])){this['channel'][_0x1630('0x9c')](util[_0x1630('0x2b')](_0x1630('0x99'),_0x2517db,_0x1ab1ca),_0x50d1a9[_0x1ab1ca]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x55e12d){try{var _0x3e5dea=JSON[_0x1630('0x6c')](_0x55e12d);this[_0x1630('0x96')](_0x3e5dea);return JSON[_0x1630('0x74')](_0x3e5dea);}catch(_0x36e7aa){return this['replaceAllVariables'](_0x55e12d);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x416e16){var _0x47f723=_0x416e16['split']('{');for(var _0x5459c2=0x1;_0x5459c2<_0x47f723[_0x1630('0x9b')];_0x5459c2+=0x1){var _0x30685d=_0x47f723[_0x5459c2][_0x1630('0x9d')]('}');if(_0x30685d[_0x1630('0x9b')]>0x1){_0x416e16=_0x416e16['replaceAll']('{'+_0x30685d[0x0]+'}',this[_0x1630('0x38')][_0x1630('0x11')](_0x30685d[0x0])[_0x1630('0x9e')]||_0x30685d[0x0]);}}if(_0x47f723['length']===0x1){return _0x416e16[_0x1630('0x9f')]();}return this[_0x1630('0x95')](_0x416e16);};AGIVertices['prototype'][_0x1630('0xa0')]=function(_0x416285,_0xf2f860){var _0x1d87ed=this[_0x1630('0x38')][_0x1630('0x11')](_0x416285);if(_0x1d87ed[_0x1630('0xa1')]===-0x1){return _0x1d87ed;}logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xf2f860,_0x1d87ed['extra']));return this[_0x1630('0x38')][_0x1630('0x9c')](_0xf2f860,_0x1d87ed[_0x1630('0x9e')]);};AGIVertices[_0x1630('0x10')][_0x1630('0x80')]=function(_0xf34b91){return _0xf34b91&&_0xf34b91!=='0'&&_0xf34b91!=='-1'&&_0xf34b91!=='';};AGIVertices[_0x1630('0x10')][_0x1630('0xa2')]=function(_0xb159e0){this[_0x1630('0x37')]['sync'](this,_0xb159e0,'-');_0xb159e0['retry']=_0xb159e0['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1630('0x10')][_0x1630('0xa3')]=function(_0x3a635c){logger[_0x1630('0x2d')](util['format'](_0x1630('0xa4'),_0x3a635c[_0x1630('0x3a')]));if(!this['isConfigured'](_0x3a635c[_0x1630('0x5b')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xa6'));}var _0x3a510e='\x22'+_0x3a635c[_0x1630('0x5b')]+'\x22';if(this[_0x1630('0x80')](_0x3a635c['options'])){_0x3a510e+=','+_0x3a635c['options'];}var _0x3e07ea=this[_0x1630('0x38')][_0x1630('0xa7')](_0x1630('0xa8'),_0x3a510e);if(_0x3e07ea['result']===-0x1){return _0x3e07ea;}return this[_0x1630('0x38')]['noop'](util['format'](_0x1630('0xa9'),_0x3a510e));};AGIVertices[_0x1630('0x10')][_0x1630('0xaa')]=function(_0x4917ea){logger['info'](util[_0x1630('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4917ea[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x4917ea['grammar'])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xab'));}var _0xebaf78=_0x4917ea[_0x1630('0xac')];if(this['isConfigured'](_0x4917ea[_0x1630('0x77')])){_0xebaf78+=','+_0x4917ea[_0x1630('0x77')];}var _0x496761=this[_0x1630('0x38')]['exec'](_0x1630('0xad'),_0xebaf78);if(_0x496761[_0x1630('0xa1')]===-0x1){return _0x496761;}var _0x375e2f=this['getAndSetVariable'](_0x1630('0xae'),_0x1630('0xaf'));if(_0x375e2f[_0x1630('0xa1')]===-0x1){return _0x375e2f;}var _0x51334a=this['getAndSetVariable'](_0x1630('0xb0'),_0x1630('0xb1'));if(_0x51334a[_0x1630('0xa1')]===-0x1){return _0x51334a;}var _0xd55a31=this[_0x1630('0xa0')](_0x1630('0xb2'),_0x1630('0xb3'));if(_0xd55a31[_0x1630('0xa1')]===-0x1){return _0xd55a31;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xb4'),_0xebaf78));};AGIVertices[_0x1630('0x10')][_0x1630('0x8')]=function(_0x4d111f){logger['info'](util[_0x1630('0x2b')](_0x1630('0xb5'),_0x4d111f['label']));return this[_0x1630('0x38')][_0x1630('0x8')]([_0x4d111f[_0x1630('0xb6')],_0x4d111f['args']]);};AGIVertices[_0x1630('0x10')][_0x1630('0xb7')]=function(_0x10e20f){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x10e20f[_0x1630('0x3a')]));if(this[_0x1630('0x80')](_0x10e20f[_0x1630('0x67')])){logger['info'](util[_0x1630('0x2b')](_0x1630('0xb8'),_0x10e20f[_0x1630('0x67')]));var _0x33469a=this['channel'][_0x1630('0xb9')](_0x10e20f[_0x1630('0x67')]);if(_0x33469a['result']===-0x1){return _0x33469a;}}return this[_0x1630('0x38')][_0x1630('0xb7')]();};AGIVertices[_0x1630('0x10')][_0x1630('0x4d')]=function(_0x336e91){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x336e91[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x336e91[_0x1630('0xba')])){return this['channel'][_0x1630('0x32')](_0x336e91,_0x1630('0xbb'));}_0x336e91[_0x1630('0x4c')]=moment();if(this[_0x1630('0x80')](_0x336e91['delay'])){_0x336e91[_0x1630('0x4c')]=moment()[_0x1630('0xbc')](_0x336e91[_0x1630('0xbd')],_0x1630('0xbe'));}if(!this[_0x1630('0x80')](_0x336e91[_0x1630('0x4f')])){_0x336e91[_0x1630('0x4f')]=0x2;}this['createCmContact'][_0x1630('0x71')](this,_0x336e91);return this[_0x1630('0x38')][_0x1630('0xa5')](util['format'](_0x1630('0xbf'),_0x336e91[_0x1630('0xc0')],_0x336e91[_0x1630('0xba')],_0x336e91['scheduledAt']));};AGIVertices[_0x1630('0x10')][_0x1630('0xc1')]=function(_0x181f97){logger['info'](util[_0x1630('0x2b')](_0x1630('0xc2'),_0x181f97[_0x1630('0x3a')]));var _0x46c608=this[_0x1630('0x38')]['exec'](_0x181f97[_0x1630('0xc3')],_0x181f97[_0x1630('0x77')]);if(_0x46c608[_0x1630('0xa1')]===-0x1){return _0x46c608;}return this['channel'][_0x1630('0xa5')](util['format'](_0x1630('0xc4'),_0x181f97[_0x1630('0xc3')],_0x181f97[_0x1630('0x77')]));};AGIVertices[_0x1630('0x10')]['lumenvoxtts']=function(_0x4e5924){logger['info'](util[_0x1630('0x2b')](_0x1630('0xc5'),_0x4e5924[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x4e5924[_0x1630('0x5b')])){return this['channel'][_0x1630('0xa5')](_0x1630('0xa6'));}var _0x268377='\x22'+_0x4e5924[_0x1630('0x5b')]+'\x22';if(this[_0x1630('0x80')](_0x4e5924[_0x1630('0x77')])){_0x268377+=','+_0x4e5924[_0x1630('0x77')];}var _0x41766a=this[_0x1630('0x38')]['exec'](_0x1630('0xa8'),_0x268377);if(_0x41766a[_0x1630('0xa1')]===-0x1){return _0x41766a;}return this['channel'][_0x1630('0xa5')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x268377));};AGIVertices['prototype'][_0x1630('0xc6')]=function(_0x422022){logger['info'](util[_0x1630('0x2b')](_0x1630('0xc7'),_0x422022[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x422022[_0x1630('0x5b')])){return this[_0x1630('0x38')]['noop'](_0x1630('0xa6'));}var _0x3b0b83='\x22'+_0x422022[_0x1630('0x5b')]+'\x22';if(this[_0x1630('0x80')](_0x422022['options'])){_0x3b0b83+=','+_0x422022[_0x1630('0x77')];}var _0x2fa44c=this[_0x1630('0x38')][_0x1630('0xa7')]('MRCPSynth',_0x3b0b83);if(_0x2fa44c[_0x1630('0xa1')]===-0x1){return _0x2fa44c;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3b0b83));};AGIVertices[_0x1630('0x10')]['lumenvoxasr']=function(_0x166871){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0xc8'),_0x166871[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x166871[_0x1630('0xac')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xab'));}var _0x2f5883=_0x166871[_0x1630('0xac')];if(this[_0x1630('0x80')](_0x166871[_0x1630('0x77')])){_0x2f5883+=','+_0x166871[_0x1630('0x77')];}var _0x2282fb=this['channel']['exec'](_0x1630('0xad'),_0x2f5883);if(_0x2282fb['result']===-0x1){return _0x2282fb;}var _0x2c3af9=this[_0x1630('0xa0')]('RECOG_CONFIDENCE()',_0x1630('0xc9'));if(_0x2c3af9['result']===-0x1){return _0x2c3af9;}var _0x3491bf=this[_0x1630('0xa0')](_0x1630('0xb0'),_0x1630('0xca'));if(_0x3491bf[_0x1630('0xa1')]===-0x1){return _0x3491bf;}var _0x47599a=this[_0x1630('0xa0')](_0x1630('0xb2'),_0x1630('0xcb'));if(_0x47599a[_0x1630('0xa1')]===-0x1){return _0x47599a;}return this[_0x1630('0x38')][_0x1630('0xa5')](util['format'](_0x1630('0xb4'),_0x2f5883));};AGIVertices['prototype'][_0x1630('0xcc')]=function(_0x3fcc8d){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0xcd'),_0x3fcc8d[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x3fcc8d['grammar'])){return this['channel'][_0x1630('0xa5')](_0x1630('0xab'));}var _0x50af09=_0x3fcc8d[_0x1630('0xac')];if(this[_0x1630('0x80')](_0x3fcc8d[_0x1630('0x77')])){_0x50af09+=','+_0x3fcc8d[_0x1630('0x77')];}var _0x2fc3e8=this[_0x1630('0x38')][_0x1630('0xa7')]('MRCPRecog',_0x50af09);if(_0x2fc3e8[_0x1630('0xa1')]===-0x1){return _0x2fc3e8;}var _0x57a4a2=this[_0x1630('0xa0')](_0x1630('0xae'),_0x1630('0xce'));if(_0x57a4a2[_0x1630('0xa1')]===-0x1){return _0x57a4a2;}var _0x10c497=this['getAndSetVariable'](_0x1630('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x10c497[_0x1630('0xa1')]===-0x1){return _0x10c497;}var _0x3b05cc=this['getAndSetVariable'](_0x1630('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x3b05cc[_0x1630('0xa1')]===-0x1){return _0x3b05cc;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xb4'),_0x50af09));};AGIVertices[_0x1630('0x10')]['database']=function(_0x26761f){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0xcf'),_0x26761f['label']));if(!this['isConfigured'](_0x26761f['odbc_id'])){return this['channel'][_0x1630('0x32')](_0x26761f,_0x1630('0xd0'));}var _0x1cc023=this[_0x1630('0x1a')][_0x1630('0x71')](this,_0x26761f[_0x1630('0xd1')]);if(!_0x1cc023){return this[_0x1630('0x38')][_0x1630('0x32')](_0x26761f,'no\x20odbc\x20database\x20found');}if(!this[_0x1630('0x80')](_0x26761f[_0x1630('0x2e')])){return this[_0x1630('0x38')]['error'](_0x26761f,'no\x20query\x20configured');}var _0x468676=_0x26761f[_0x1630('0x2e')][_0x1630('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x1630('0xa5')](util['format'](_0x1630('0xd3'),_0x468676));var _0x152a20=this['getQueryOdbc'][_0x1630('0x71')](this,_0x1cc023,_0x468676);this[_0x1630('0x37')][_0x1630('0x71')](this,_0x26761f,_0x468676);if(!this['isConfigured'](_0x26761f[_0x1630('0xd4')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xd5'));}var _0x58aea4=this['getVariable'][_0x1630('0x71')](this,_0x26761f[_0x1630('0xd4')]);if(!_0x58aea4){return this[_0x1630('0x38')][_0x1630('0x32')](_0x26761f,_0x1630('0xd6'));}var _0x24fd0a=this;_0x152a20[_0x1630('0xd7')](function(_0x39ea89,_0x207217){Object['keys'](_0x39ea89)[_0x1630('0xd7')](function(_0x28aa94){_0x24fd0a[_0x1630('0x38')][_0x1630('0x9c')](util[_0x1630('0x2b')](_0x1630('0xd8'),_0x58aea4,_0x207217,_0x28aa94),_0x39ea89[_0x28aa94]);});});this['channel'][_0x1630('0x9c')](util['format']('%s_ROWS_COUNT',_0x58aea4),_0x152a20[_0x1630('0x9b')]);return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xd9'),_0x58aea4));};AGIVertices[_0x1630('0x10')][_0x1630('0xda')]=function(_0x4c186f){logger[_0x1630('0xdb')](util[_0x1630('0x2b')](_0x1630('0xdc'),_0x4c186f[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x4c186f[_0x1630('0xdd')])){return this['channel'][_0x1630('0x32')](_0x4c186f,_0x1630('0xde'));}var _0x3137b5=this[_0x1630('0x1d')][_0x1630('0x71')](this,_0x4c186f[_0x1630('0xdd')]);if(!_0x3137b5){return this['channel']['error'](_0x4c186f,_0x1630('0xdf'));}var _0x5843d1=this[_0x1630('0x38')]['exec']('DIAL',[util[_0x1630('0x2b')](_0x1630('0xe0'),_0x3137b5),_0x4c186f[_0x1630('0x67')],_0x4c186f[_0x1630('0xe1')],_0x4c186f[_0x1630('0x65')]]);if(_0x5843d1[_0x1630('0xa1')]===-0x1){return _0x5843d1;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x1630('0x10')][_0x1630('0xe2')]=function(_0x5edc70){logger['info'](util[_0x1630('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5edc70[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x5edc70[_0x1630('0x7c')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xe3'));}if(!this['isConfigured'](_0x5edc70[_0x1630('0x5b')])){return this[_0x1630('0x38')]['noop'](_0x1630('0xa6'));}this['channel'][_0x1630('0xe4')]=!![];this[_0x1630('0x37')](_0x5edc70);this[_0x1630('0x45')](_0x5edc70[_0x1630('0x5b')],'in');this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xe5'),_0x5edc70['text']));var _0x5cb929=this[_0x1630('0x78')][_0x1630('0x71')](this,_0x5edc70);if(_0x5cb929){for(var _0x55fb2a in _0x5cb929){if(_0x5cb929[_0x1630('0x92')](_0x55fb2a)){this[_0x1630('0x38')][_0x1630('0x9c')](util[_0x1630('0x2b')](_0x1630('0xe6'),_0x55fb2a[_0x1630('0xe7')]()),_0x5cb929[_0x55fb2a]);}}this[_0x1630('0x45')](_0x5cb929[_0x1630('0xe8')],'out');return this[_0x1630('0x38')]['noop'](util[_0x1630('0x2b')](_0x1630('0xe9'),_0x5cb929['speech']));}return this[_0x1630('0x38')][_0x1630('0x32')](_0x5edc70,_0x1630('0xea'));};AGIVertices['prototype']['sesteknda']=function(_0x338abb){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0xeb'),_0x338abb[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x338abb[_0x1630('0xec')])){return this['channel']['noop'](_0x1630('0xed'));}if(!this[_0x1630('0x80')](_0x338abb['username'])){return this[_0x1630('0x38')][_0x1630('0xa5')]('no\x20username\x20configured');}if(!this[_0x1630('0x80')](_0x338abb['password'])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xee'));}if(!this[_0x1630('0x80')](_0x338abb[_0x1630('0xef')])){return this['channel'][_0x1630('0xa5')](_0x1630('0xa6'));}this[_0x1630('0x38')]['bot']=!![];this[_0x1630('0x37')](_0x338abb);this['createSquareMessage'](_0x338abb[_0x1630('0x5b')],'in');this[_0x1630('0x38')]['noop'](util[_0x1630('0x2b')](_0x1630('0xf0'),_0x338abb[_0x1630('0x5b')]));var _0x3641d8=this['sestekNDA'][_0x1630('0x71')](this,_0x338abb);if(_0x3641d8){for(var _0x2b3133 in _0x3641d8){if(_0x3641d8[_0x1630('0x92')](_0x2b3133)){this[_0x1630('0x38')]['setVariable'](util['format'](_0x1630('0xf1'),_0x2b3133[_0x1630('0xe7')]()),_0x3641d8[_0x2b3133]);}}this[_0x1630('0x45')](_0x3641d8[_0x1630('0xe8')],_0x1630('0xf2'));if(_0x3641d8[_0x1630('0xf3')]){this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x3641d8['audiofile']));var _0x1e7109=this[_0x1630('0x38')][_0x1630('0xf4')](_0x3641d8[_0x1630('0xf3')]);try{fs[_0x1630('0xf5')](_0x3641d8['audiofile']+_0x1630('0xf6'));}catch(_0x46cd43){logger['error'](_0x46cd43);}return _0x1e7109;}else{return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('SestekNDA\x20Result\x20%s',_0x3641d8[_0x1630('0xe8')]));}}return this[_0x1630('0x38')][_0x1630('0x32')](_0x338abb,_0x1630('0xf7'));};AGIVertices[_0x1630('0x10')]['end']=function(_0x4d6fb7){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0xf8'),_0x4d6fb7['label']));return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xf9'));};AGIVertices[_0x1630('0x10')]['ext_dial']=function(_0x3312b7){logger['info'](util[_0x1630('0x2b')](_0x1630('0xfa'),_0x3312b7[_0x1630('0x3a')]));var _0x578bfd='';if(_0x3312b7['trunk_id']){if(!this[_0x1630('0x80')](_0x3312b7[_0x1630('0xfb')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x3312b7,_0x1630('0xfc'));}else{var _0x42255a=parseInt(_0x3312b7[_0x1630('0xfb')],0xa);if(isNaN(_0x42255a)){_0x578bfd=_0x3312b7[_0x1630('0xfb')];}else{_0x578bfd=this[_0x1630('0x1f')][_0x1630('0x71')](this,_0x3312b7[_0x1630('0xfb')]);if(!_0x578bfd){return this[_0x1630('0x38')][_0x1630('0x32')](_0x3312b7,_0x1630('0xfd'));}}}}else if(_0x3312b7['trunk_name']){_0x578bfd=_0x3312b7[_0x1630('0xfe')];}else{return this[_0x1630('0x38')][_0x1630('0x32')](_0x3312b7,'no\x20trunk\x20selected');}var _0x4fca9a=this['channel'][_0x1630('0xa7')](_0x1630('0xff'),[util['format'](_0x1630('0x100'),_0x578bfd,_0x3312b7[_0x1630('0xc0')]),_0x3312b7[_0x1630('0x67')],_0x3312b7[_0x1630('0xe1')],_0x3312b7[_0x1630('0x65')]]);if(_0x4fca9a[_0x1630('0xa1')]===-0x1){return _0x4fca9a;}return this[_0x1630('0x38')][_0x1630('0xa5')](util['format'](_0x1630('0x101'),_0x1630('0xff')));};AGIVertices['prototype']['finally']=function(_0x996e8c){logger['info'](util[_0x1630('0x2b')](_0x1630('0x102'),_0x996e8c[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x103'));};AGIVertices[_0x1630('0x10')]['getdigits']=function(_0xd918ea){logger[_0x1630('0x2d')](util['format'](_0x1630('0x104'),_0xd918ea['label']));if(_0xd918ea[_0x1630('0x105')]===0x0){return this['maxRetry'](_0xd918ea);}_0xd918ea['retry']-=0x1;if(!this[_0x1630('0x80')](_0xd918ea[_0x1630('0x106')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0xd918ea,_0x1630('0x107'));}var _0x1ab540=this[_0x1630('0x108')][_0x1630('0x71')](this,_0xd918ea[_0x1630('0x106')]);if(!_0x1ab540){return this[_0x1630('0x38')]['error'](_0xd918ea,_0x1630('0x109'));}if(!this[_0x1630('0x80')](_0xd918ea['variable_id'])){return this['channel'][_0x1630('0x32')](_0x1630('0xd5'));}var _0x276d93=this[_0x1630('0x38')][_0x1630('0x10a')](_0x1ab540,_0xd918ea[_0x1630('0x10b')],_0xd918ea['maxdigit']);var _0x345ceb=_0x276d93['result']?_0x276d93[_0x1630('0xa1')][_0x1630('0x9f')]():'';logger['info']('test',JSON[_0x1630('0x74')](_0x276d93));if(_0x276d93[_0x1630('0xa1')]===-0x1){this[_0x1630('0x37')][_0x1630('0x71')](this,_0xd918ea,_0x345ceb);return _0x276d93;}else if(_0x276d93[_0x1630('0x9e')]===_0x1630('0x67')){_0x276d93[_0x1630('0xa1')]=_0x345ceb[_0x1630('0x9b')]>=parseInt(_0xd918ea['mindigit'])?'x':'i';}else{_0x276d93[_0x1630('0xa1')]=_0x345ceb[_0x1630('0x9b')]>=parseInt(_0xd918ea['mindigit'])&&_0x345ceb[_0x1630('0x9b')]<=parseInt(_0xd918ea[_0x1630('0x10c')])?'x':'i';}var _0x6e7aad=this[_0x1630('0x11')]['sync'](this,_0xd918ea[_0x1630('0xd4')]);if(!_0x6e7aad){return this[_0x1630('0x38')]['error'](_0xd918ea,'no\x20variable\x20found');}this[_0x1630('0x38')][_0x1630('0x9c')](_0x6e7aad,_0x345ceb);if(this[_0x1630('0x80')](_0xd918ea['hiddendigitsnum'])){var _0x122f5c=parseInt(_0xd918ea[_0x1630('0x10d')],0xa);var _0x3b9401=rs[_0x1630('0x10e')]({'charset':'*','length':_0x122f5c});var _0x4283f6=_0x345ceb[_0x1630('0x9b')];if(_0x4283f6>0x0){if(_0x4283f6>_0x122f5c){this[_0x1630('0x37')][_0x1630('0x71')](this,_0xd918ea,_0xd918ea['hiddendigitspos']==='first'?_0x3b9401+_0x345ceb[_0x1630('0x10f')](_0x122f5c):_0x345ceb[_0x1630('0x10f')](0x0,_0x4283f6-_0x122f5c)+_0x3b9401);}else{this[_0x1630('0x37')][_0x1630('0x71')](this,_0xd918ea,rs[_0x1630('0x10e')]({'charset':'*','length':_0x4283f6}));}}else{this[_0x1630('0x37')]['sync'](this,_0xd918ea,'');}}else{this[_0x1630('0x37')]['sync'](this,_0xd918ea,_0x345ceb);}return _0x276d93;};AGIVertices['prototype'][_0x1630('0xd')]=function(_0x1ee0d3){logger['info'](util[_0x1630('0x2b')](_0x1630('0x110'),_0x1ee0d3[_0x1630('0x3a')]));return this[_0x1630('0xc')](_0x1ee0d3);};AGIVertices['prototype']['goal']=function(_0x21163a){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x21163a[_0x1630('0x3a')]));this[_0x1630('0x37')][_0x1630('0x71')](this,_0x21163a,_0x21163a[_0x1630('0x111')]);return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x112'),_0x21163a[_0x1630('0x111')]));};AGIVertices[_0x1630('0x10')][_0x1630('0x113')]=function(_0x2870cc){logger['info'](util[_0x1630('0x2b')](_0x1630('0x114'),_0x2870cc[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x2870cc['aws_access_key_id'])||!this[_0x1630('0x80')](_0x2870cc[_0x1630('0x84')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x115'));}if(!this['isConfigured'](_0x2870cc[_0x1630('0x5b')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xa6'));}this['channel'][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x116'),_0x2870cc[_0x1630('0x5b')]));var _0x57894c=this[_0x1630('0x82')][_0x1630('0x71')](this,_0x2870cc);if(_0x57894c){this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x117'),_0x57894c));var _0x5c558a=this['channel']['streamFile'](_0x57894c);try{fs['unlink'](_0x57894c+_0x1630('0xf6'));}catch(_0x556aeb){logger[_0x1630('0x32')](_0x556aeb);}return _0x5c558a;}return this[_0x1630('0x38')][_0x1630('0x32')](_0x2870cc,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x1630('0x10')][_0x1630('0x118')]=function(_0x32abe0){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x119'),_0x32abe0[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x32abe0[_0x1630('0x83')])||!this[_0x1630('0x80')](_0x32abe0[_0x1630('0x84')])){return this['channel'][_0x1630('0xa5')](_0x1630('0x115'));}if(!this[_0x1630('0x80')](_0x32abe0['aws_bot_name'])){return this['channel'][_0x1630('0xa5')](_0x1630('0x11a'));}if(!this[_0x1630('0x80')](_0x32abe0[_0x1630('0x5b')])){return this[_0x1630('0x38')]['noop']('no\x20text\x20configured');}this[_0x1630('0x38')][_0x1630('0xe4')]=!![];this[_0x1630('0x37')](_0x32abe0);this[_0x1630('0x45')](_0x32abe0['text'],'in');this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x11b'),_0x32abe0[_0x1630('0x5b')]));var _0x450f4e=this[_0x1630('0x11c')][_0x1630('0x71')](this,_0x32abe0);if(_0x450f4e){for(var _0x221868 in _0x450f4e){if(_0x450f4e[_0x1630('0x92')](_0x221868)&&_['isString'](_0x450f4e[_0x221868])){this[_0x1630('0x38')]['setVariable'](util['format'](_0x1630('0x11d'),_0x221868[_0x1630('0xe7')]()),_0x450f4e[_0x221868]);}}if(_['isNil'](_0x450f4e[_0x1630('0x76')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x11e'));}else{this[_0x1630('0x45')](_0x450f4e[_0x1630('0x76')],'out');return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x11f'),_0x450f4e[_0x1630('0x76')]));}}return this[_0x1630('0x38')][_0x1630('0x32')](_0x32abe0,_0x1630('0x120'));};AGIVertices[_0x1630('0x10')][_0x1630('0x121')]=function(_0x3e8032){logger['info'](util[_0x1630('0x2b')](_0x1630('0x122'),_0x3e8032[_0x1630('0x3a')],_0x3e8032[_0x1630('0x67')]));if(!this[_0x1630('0x80')](_0x3e8032[_0x1630('0x7c')])){return this[_0x1630('0x38')]['noop'](_0x1630('0xe3'));}var _0x1790e0=_0x1630('0x123');var _0x3b7a01=util['format'](_0x1630('0x124'),FILES_PATH,rs[_0x1630('0x10e')](0x4));var _0x5bc068=util[_0x1630('0x2b')](_0x1630('0x99'),_0x3b7a01,_0x1790e0);var _0x43411a=!![];if(_0x3e8032[_0x1630('0x125')]===_0x1630('0x126')){_0x43411a=![];}var _0x52be64=this[_0x1630('0x38')][_0x1630('0x127')](_0x3b7a01,_0x1790e0,_0x3e8032[_0x1630('0x128')],_0x3e8032[_0x1630('0x67')],undefined,_0x43411a);if(_0x52be64['result']!==-0x1){this[_0x1630('0x38')][_0x1630('0xa5')](util['format']('google\x20%s\x20file\x20created',_0x5bc068));var _0x1d45f8=this[_0x1630('0x8b')][_0x1630('0x71')](this,_0x3e8032,_0x5bc068);if(_0x1d45f8){for(var _0x2952ca in _0x1d45f8){if(_0x1d45f8[_0x1630('0x92')](_0x2952ca)){this[_0x1630('0x38')][_0x1630('0x9c')](util['format']('GOOGLE_ASR_%s',_0x2952ca[_0x1630('0xe7')]()),_0x1d45f8[_0x2952ca]);}}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x129'),JSON['stringify'](_0x1d45f8)));}}return _0x52be64;};AGIVertices['prototype'][_0x1630('0x12a')]=function(_0x5b2635){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x12b'),_0x5b2635['label']));if(!this[_0x1630('0x80')](_0x5b2635['appid'])){return this['channel'][_0x1630('0xa5')](_0x1630('0x12c'));}if(!this[_0x1630('0x80')](_0x5b2635[_0x1630('0x8f')])){return this[_0x1630('0x38')]['noop'](_0x1630('0x12d'));}var _0x1f455e=_0x1630('0x123');var _0x2687f0=util[_0x1630('0x2b')](_0x1630('0x124'),FILES_PATH,rs['generate'](0x4));var _0x8df340=util['format'](_0x1630('0x99'),_0x2687f0,_0x1f455e);var _0x19e089=!![];if(_0x5b2635[_0x1630('0x125')]===_0x1630('0x126')){_0x19e089=![];}var _0x35ec90=this[_0x1630('0x38')][_0x1630('0x127')](_0x2687f0,_0x1f455e,_0x5b2635['intKey'],_0x5b2635[_0x1630('0x67')],undefined,_0x19e089);if(_0x35ec90[_0x1630('0xa1')]!==-0x1){this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x12e'),_0x8df340));var _0x175ad4=this[_0x1630('0x8d')][_0x1630('0x71')](this,_0x5b2635,_0x8df340);if(_0x175ad4){for(var _0x42cc35 in _0x175ad4){if(_0x175ad4['hasOwnProperty'](_0x42cc35)){this[_0x1630('0x38')]['setVariable'](util[_0x1630('0x2b')](_0x1630('0x12f'),_0x42cc35[_0x1630('0xe7')]()),_0x175ad4[_0x42cc35]);}}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x130'),JSON[_0x1630('0x74')](_0x175ad4)));}}return _0x35ec90;};AGIVertices[_0x1630('0x10')][_0x1630('0x131')]=function(_0x4eb68a){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x132'),_0x4eb68a[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0x133')](_0x4eb68a[_0x1630('0x3e')],_0x4eb68a[_0x1630('0x3f')],_0x4eb68a['priority']);};AGIVertices[_0x1630('0x10')][_0x1630('0x134')]=function(_0x50e614){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x50e614[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x50e614[_0x1630('0x135')])){return this['channel'][_0x1630('0x32')](_0x50e614,_0x1630('0x136'));}try{var _0x2740ac=eval(_0x50e614[_0x1630('0x135')])?_0x1630('0x137'):_0x1630('0x138');this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x139'),_0x50e614[_0x1630('0x135')],_0x2740ac));return{'code':0xc8,'result':_0x2740ac};}catch(_0x472ad0){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x1630('0x10')][_0x1630('0x13a')]=function(_0x596340){logger[_0x1630('0x2d')](util['format'](_0x1630('0x13b'),_0x596340['label']));if(!this[_0x1630('0x80')](_0x596340[_0x1630('0x13c')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x596340,_0x1630('0x13d'));}var _0x40d5b9=this[_0x1630('0x26')][_0x1630('0x71')](this,_0x596340[_0x1630('0x13c')]);if(!_0x40d5b9){return this[_0x1630('0x38')][_0x1630('0x32')](_0x596340,_0x1630('0x13e'));}for(var _0x1d3f9d=0x0;_0x1d3f9d<_0x40d5b9[_0x1630('0x9b')];_0x1d3f9d+=0x1){var _0x5a7678=this['channel'][_0x1630('0x11')](util[_0x1630('0x2b')]('IFTIME(%s?true:false)',_0x40d5b9[_0x1d3f9d]));if(_0x5a7678['result']===-0x1){return _0x5a7678;}logger['info'](util[_0x1630('0x2b')](_0x1630('0x13f'),_0x40d5b9[_0x1d3f9d],_0x5a7678[_0x1630('0x9e')]));if(_0x5a7678[_0x1630('0x9e')]===_0x1630('0x137')){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x13f'),_0x40d5b9[_0x1d3f9d],'true'));this[_0x1630('0x38')][_0x1630('0xa5')](util['format']('IFTIME\x20%s\x20%s',_0x40d5b9[_0x1d3f9d],_0x1630('0x137')));return{'code':0xc8,'result':_0x1630('0x137')};}else{logger[_0x1630('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x40d5b9[_0x1d3f9d],_0x1630('0x138')));this[_0x1630('0x38')]['noop'](util[_0x1630('0x2b')](_0x1630('0x13f'),_0x40d5b9[_0x1d3f9d],_0x1630('0x138')));}}return{'code':0xc8,'result':_0x1630('0x138')};};AGIVertices[_0x1630('0x10')][_0x1630('0x140')]=function(_0x4a1f8f){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x141'),_0x4a1f8f[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0x140')]();};AGIVertices['prototype'][_0x1630('0x142')]=function(_0x12d12a){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x143'),_0x12d12a[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x12d12a[_0x1630('0x7c')])){return this['channel']['noop'](_0x1630('0xe3'));}var _0x23f055=_0x1630('0x123');var _0x31daa8=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x1630('0x10e')](0x4));var _0x17346c=util['format'](_0x1630('0x99'),_0x31daa8,_0x23f055);var _0x4fa427=!![];if(_0x12d12a[_0x1630('0x125')]==='NOBEEP'){_0x4fa427=![];}var _0x24fa96=this[_0x1630('0x38')][_0x1630('0x127')](_0x31daa8,_0x23f055,_0x12d12a[_0x1630('0x128')],_0x12d12a[_0x1630('0x67')],undefined,_0x4fa427);if(_0x24fa96[_0x1630('0xa1')]!==-0x1){this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x144'),_0x17346c));var _0x2104f0=this[_0x1630('0x7e')][_0x1630('0x71')](this,_0x12d12a,_0x17346c);if(_0x2104f0){for(var _0x1478ae in _0x2104f0){if(_0x2104f0[_0x1630('0x92')](_0x1478ae)){this[_0x1630('0x38')][_0x1630('0x9c')](util['format'](_0x1630('0x145'),_0x1478ae[_0x1630('0xe7')]()),_0x2104f0[_0x1478ae]);}}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x146'),JSON[_0x1630('0x74')](_0x2104f0)));}}return _0x24fa96;};AGIVertices[_0x1630('0x10')][_0x1630('0x147')]=function(_0x5bba16){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x148'),_0x5bba16[_0x1630('0x3a')]));if(!this['isConfigured'](_0x5bba16[_0x1630('0x7c')])){return this['channel']['noop'](_0x1630('0xe3'));}if(!this[_0x1630('0x80')](_0x5bba16[_0x1630('0x5b')])){return this[_0x1630('0x38')][_0x1630('0xa5')]('no\x20text\x20configured');}this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x149'),_0x5bba16[_0x1630('0x5b')]));var _0x566fe4=this['ispeechTTS'][_0x1630('0x71')](this,_0x5bba16);if(_0x566fe4){this[_0x1630('0x38')]['noop'](util[_0x1630('0x2b')](_0x1630('0x144'),_0x566fe4));var _0x5e065d=this[_0x1630('0x38')][_0x1630('0xf4')](_0x566fe4,_0x5bba16[_0x1630('0x128')]);try{fs[_0x1630('0xf5')](_0x566fe4+'.wav');}catch(_0x2f0e2a){logger['error'](_0x2f0e2a);}return _0x5e065d;}return this[_0x1630('0x38')][_0x1630('0x32')](_0x5bba16,_0x1630('0x14a'));};AGIVertices['prototype'][_0x1630('0x14b')]=function(_0xac13d1){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x14c'),_0xac13d1[_0x1630('0x3a')]));if(!this['isConfigured'](_0xac13d1[_0x1630('0x14d')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0xac13d1,_0x1630('0x14e'));}logger[_0x1630('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1630('0x38')]['callerid'],_0xac13d1['findBy']));var _0x233ed3=this[_0x1630('0x55')][_0x1630('0x71')](this,_0xac13d1[_0x1630('0x14d')]);if(_0x233ed3){logger[_0x1630('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1630('0x38')][_0x1630('0x3c')],_0xac13d1['findBy']));this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x14f'),this[_0x1630('0x38')]['callerid'],_0xac13d1[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x150')};}else{logger[_0x1630('0x2d')](util['format'](_0x1630('0x151'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xac13d1[_0x1630('0x14d')]));this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x151'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xac13d1[_0x1630('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x1630('0x152')]=function(_0x19196d){logger[_0x1630('0x2d')](util['format'](_0x1630('0x153'),_0x19196d[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x19196d['findBy'])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x19196d,_0x1630('0x14e'));}logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x154'),this[_0x1630('0x38')]['callerid'],_0x19196d[_0x1630('0x14d')]));var _0x2088dd=this[_0x1630('0x54')][_0x1630('0x71')](this,_0x19196d['findBy']);if(_0x2088dd){logger[_0x1630('0x2d')](util['format'](_0x1630('0x14f'),this['channel'][_0x1630('0x3c')],_0x19196d[_0x1630('0x14d')]));this[_0x1630('0x38')][_0x1630('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1630('0x38')][_0x1630('0x3c')],_0x19196d[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x150')};}else{logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1630('0x38')]['callerid'],_0x19196d['findBy']));this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x151'),this['channel']['callerid'],_0x19196d[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x155')};}};AGIVertices['prototype'][_0x1630('0x156')]=function(_0x29162b){logger['info'](util[_0x1630('0x2b')](_0x1630('0x157'),_0x29162b[_0x1630('0x3a')]));if(!this['isConfigured'](_0x29162b[_0x1630('0x158')])){return this[_0x1630('0x38')]['error'](_0x29162b,'no\x20operation\x20configured');}this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('math\x20%s',_0x29162b[_0x1630('0x158')]));var _0x168381=eval(_0x29162b[_0x1630('0x158')]);if(!this[_0x1630('0x80')](_0x29162b['variable_id'])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xd5'));}var _0x3e22f4=this[_0x1630('0x11')][_0x1630('0x71')](this,_0x29162b[_0x1630('0xd4')]);if(!_0x3e22f4){return this['channel'][_0x1630('0x32')](_0x29162b,_0x1630('0xd6'));}if(_[_0x1630('0x9a')](_0x168381)){var _0x5064f3=this;_0x168381['forEach'](function(_0x205b63,_0x26d579){_0x5064f3[_0x1630('0x38')][_0x1630('0x9c')](util[_0x1630('0x2b')](_0x1630('0x159'),_0x3e22f4,_0x26d579),_0x205b63);});return this[_0x1630('0x38')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x3e22f4));}else{return this[_0x1630('0x38')][_0x1630('0x9c')](_0x3e22f4,_0x168381);}};AGIVertices['prototype'][_0x1630('0x15a')]=function(_0x4d2c68){logger[_0x1630('0x2d')](util['format'](_0x1630('0x15b'),_0x4d2c68['label']));if(_0x4d2c68[_0x1630('0x105')]===0x0){return this[_0x1630('0xa2')](_0x4d2c68);}_0x4d2c68[_0x1630('0x105')]-=0x1;if(!this[_0x1630('0x80')](_0x4d2c68['file_id'])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x4d2c68,_0x1630('0x107'));}var _0x129350=this['getSound'][_0x1630('0x71')](this,_0x4d2c68[_0x1630('0x106')]);if(!_0x129350){return this[_0x1630('0x38')][_0x1630('0x32')](_0x4d2c68,'no\x20file\x20audio\x20found');}var _0x5793ef=this[_0x1630('0x38')]['getData'](_0x129350,_0x4d2c68['response'],_0x4d2c68[_0x1630('0x15c')]);var _0x2985f5=_0x5793ef[_0x1630('0xa1')];if(_0x5793ef[_0x1630('0xa1')]===-0x1){this[_0x1630('0x37')][_0x1630('0x71')](this,_0x4d2c68,'-1');return _0x5793ef;}else if(_0x5793ef[_0x1630('0x9e')]==='timeout'){_0x5793ef[_0x1630('0xa1')]=_0x5793ef[_0x1630('0xa1')]['length']>0x0?_0x5793ef[_0x1630('0xa1')]:'t';}else if(_[_0x1630('0x47')](_0x5793ef[_0x1630('0xa1')])){_0x5793ef[_0x1630('0xa1')]='#';_0x2985f5='#';}if(!this['isConfigured'](_0x4d2c68[_0x1630('0xd4')])){this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xd5'));}else{var _0xd17860=this[_0x1630('0x11')][_0x1630('0x71')](this,_0x4d2c68[_0x1630('0xd4')]);if(!_0xd17860){return this['channel']['error'](_0x4d2c68,_0x1630('0xd6'));}this['channel'][_0x1630('0x9c')](_0xd17860,_0x2985f5);}this[_0x1630('0x37')][_0x1630('0x71')](this,_0x4d2c68,_0x2985f5);return _0x5793ef;};AGIVertices[_0x1630('0x10')][_0x1630('0xa5')]=function(_0x6c62b3){logger[_0x1630('0x2d')](util['format'](_0x1630('0x15d'),_0x6c62b3[_0x1630('0x3a')]));return this[_0x1630('0x38')]['noop'](_0x6c62b3[_0x1630('0x15e')]||_0x6c62b3[_0x1630('0x3a')]);};AGIVertices[_0x1630('0x10')]['pause']=function(_0x2e1700){logger[_0x1630('0x2d')](util['format'](_0x1630('0x15f'),_0x2e1700[_0x1630('0x3a')]));if(!this['isConfigured'](_0x2e1700[_0x1630('0x14d')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x2e1700,_0x1630('0x14e'));}logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x154'),this[_0x1630('0x38')]['callerid'],_0x2e1700['findBy']));var _0xbc3c23=this['getPause'][_0x1630('0x71')](this,_0x2e1700['pause_id']);var _0xe8b10a=this['agentPause']['sync'](this,_0x2e1700[_0x1630('0x14d')],_0xbc3c23);if(_0xe8b10a){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x14f'),this['channel'][_0x1630('0x3c')],_0x2e1700['findBy']));this['channel'][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x14f'),this[_0x1630('0x38')][_0x1630('0x3c')],_0x2e1700[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x150')};}else{logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x151'),this[_0x1630('0x38')][_0x1630('0x3c')],_0x2e1700[_0x1630('0x14d')]));this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x14f'),this['channel'][_0x1630('0x3c')],_0x2e1700[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x155')};}};AGIVertices[_0x1630('0x10')][_0x1630('0x160')]=function(_0x109de4){logger[_0x1630('0x2d')](util['format'](_0x1630('0x161'),_0x109de4[_0x1630('0x3a')]));if(!this['isConfigured'](_0x109de4['file_id'])){return this['channel'][_0x1630('0x32')](_0x109de4,'no\x20file\x20audio\x20selected');}var _0x57d0a3=this['getSound']['sync'](this,_0x109de4[_0x1630('0x106')]);if(!_0x57d0a3){return this[_0x1630('0x38')][_0x1630('0x32')](_0x109de4,'no\x20file\x20audio\x20found');}var _0x124f64=this['channel'][_0x1630('0xa7')](_0x1630('0x162'),[_0x57d0a3,_0x109de4[_0x1630('0xe1')]]);if(_0x124f64[_0x1630('0xa1')]===-0x1){return _0x124f64;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xc4'),'PLAYBACK',_0x57d0a3));};AGIVertices['prototype'][_0x1630('0x163')]=function(_0x59483d){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x164'),_0x59483d[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x59483d[_0x1630('0x165')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x59483d,'no\x20queue\x20selected');}var _0xf64783='';var _0x62af4f=parseInt(_0x59483d[_0x1630('0x165')],0xa);if(isNaN(_0x62af4f)){_0xf64783=_0x59483d[_0x1630('0x165')];}else{_0xf64783=this['getVoiceQueue'][_0x1630('0x71')](this,_0x59483d[_0x1630('0x165')]);if(!_0xf64783){return this['channel'][_0x1630('0x32')](_0x59483d,'no\x20queue\x20found');}}var _0x5b4d62='';if(this[_0x1630('0x80')](_0x59483d[_0x1630('0x106')])){var _0x59329f=this['getSound'][_0x1630('0x71')](this,_0x59483d['file_id']);if(_0x59329f){_0x5b4d62=_0x59329f;}}this['createSquareDetailsReport'][_0x1630('0x71')](this,_0x59483d,_0xf64783);if(_0x59483d['opts'][_0x1630('0x166')]('x')<0x0){_0x59483d[_0x1630('0xe1')]+='x';}if(_0x59483d['opts'][_0x1630('0x166')]('X')<0x0){_0x59483d[_0x1630('0xe1')]+='X';}this[_0x1630('0x38')][_0x1630('0x9c')](_0x1630('0x167'),_0xf64783?_0xf64783[_0x1630('0x168')]():'');var _0x30e6df=this['channel'][_0x1630('0xa7')](_0x1630('0x169'),[_0xf64783,_0x59483d['opts'],_0x59483d['url'],_0x5b4d62,_0x59483d['timeout'],_0x59483d[_0x1630('0x8')],_0x59483d[_0x1630('0x16a')],_0x59483d[_0x1630('0x16b')],'',_0x59483d['position']]);if(_0x30e6df[_0x1630('0xa1')]===-0x1){return _0x30e6df;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xc4'),_0x1630('0x169'),_0xf64783));};AGIVertices[_0x1630('0x10')][_0x1630('0x16c')]=function(_0x3109b4){logger['info'](util[_0x1630('0x2b')](_0x1630('0x16d'),_0x3109b4['label']));var _0x5849f3=_0x3109b4[_0x1630('0x16e')]||'wav';var _0x230070=util[_0x1630('0x2b')](_0x1630('0x16f'),this[_0x1630('0x38')][_0x1630('0x39')],rs['generate'](0x5));var _0x223497=util[_0x1630('0x2b')](_0x1630('0x170'),FILES_PATH,_0x230070,_0x5849f3);var _0x1d9a70=util[_0x1630('0x2b')](_0x1630('0x124'),FILES_PATH,_0x230070);this[_0x1630('0x3d')]['sync'](this,_0x3109b4,_0x230070,_0x223497);this['channel'][_0x1630('0x9c')](_0x1630('0x171'),_0x230070);logger['info'](_0x1630('0x172'),_0x1d9a70,_0x5849f3,_0x3109b4['escape_digits'],_0x3109b4[_0x1630('0x67')]);return this['channel'][_0x1630('0x127')](_0x1d9a70,_0x5849f3,_0x3109b4[_0x1630('0x173')],_0x3109b4['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x1630('0x174')]=function(_0x9f0a17){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x175'),_0x9f0a17[_0x1630('0x3a')]));if(!this['isConfigured'](_0x9f0a17[_0x1630('0x65')])){return this['channel'][_0x1630('0xa5')](_0x1630('0x176'));}var _0x379f16=this[_0x1630('0x64')]['sync'](this,_0x9f0a17);logger[_0x1630('0x2d')](util['format'](_0x1630('0x177'),util['inspect'](_0x379f16,{'showHidden':![],'depth':null})));if(!this[_0x1630('0x80')](_0x9f0a17[_0x1630('0xd4')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x178'));}var _0x3ab437=this[_0x1630('0x11')][_0x1630('0x71')](this,_0x9f0a17[_0x1630('0xd4')]);if(!_0x3ab437){return this[_0x1630('0x38')]['error'](_0x9f0a17,_0x1630('0xd6'));}this[_0x1630('0x38')][_0x1630('0x9c')](util[_0x1630('0x2b')]('%s_STATUS_CODE',_0x3ab437),_0x379f16[_0x1630('0x75')]?_0x379f16[_0x1630('0x75')]:_0x1630('0x179'));this[_0x1630('0x38')][_0x1630('0x9c')](util[_0x1630('0x2b')]('%s_STATUS_MESSAGE',_0x3ab437),_0x379f16['statusMessage']?_0x379f16['statusMessage']:'OK');if(_0x379f16[_0x1630('0x6b')]){try{this[_0x1630('0x97')](_0x379f16['body'],_0x3ab437);}catch(_0x1b233f){logger[_0x1630('0x32')](util[_0x1630('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3ab437));}}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xd9'),_0x3ab437));};AGIVertices['prototype'][_0x1630('0x17a')]=function(_0x4cea3d){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x17b'),_0x4cea3d[_0x1630('0x3a')]));return this[_0x1630('0x38')]['sayDigits'](_0x4cea3d[_0x1630('0x17c')][_0x1630('0xd2')](/\s+/g,''),_0x4cea3d[_0x1630('0x173')]);};AGIVertices[_0x1630('0x10')][_0x1630('0x17d')]=function(_0x3ee0ff){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x17e'),_0x3ee0ff[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0x17f')](_0x3ee0ff[_0x1630('0x180')][_0x1630('0xd2')](/\s+/g,''),_0x3ee0ff[_0x1630('0x173')]);};AGIVertices[_0x1630('0x10')][_0x1630('0x181')]=function(_0x504c3a){logger['info'](util[_0x1630('0x2b')](_0x1630('0x182'),_0x504c3a[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0x183')](_0x504c3a[_0x1630('0x5b')],_0x504c3a[_0x1630('0x173')]);};AGIVertices[_0x1630('0x10')][_0x1630('0x184')]=function(_0x291880){logger['info'](util[_0x1630('0x2b')](_0x1630('0x185'),_0x291880[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x291880[_0x1630('0x186')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x187'));}var _0x6e2c3d=this['getMailAccount']['sync'](this,_0x291880[_0x1630('0x186')]);if(!_0x6e2c3d||!_0x6e2c3d[_0x1630('0x188')]){return this[_0x1630('0x38')][_0x1630('0x32')](_0x291880,_0x1630('0x189'));}var _0x2bd8ca={'from':util['format'](_0x1630('0x18a'),_0x6e2c3d[_0x1630('0x14')],_0x6e2c3d[_0x1630('0x18b')]||_0x6e2c3d['Smtp']['user']),'to':_0x291880['to']||'','cc':_0x291880['cc']||'','bcc':_0x291880[_0x1630('0x18c')]||'','subject':_0x291880['subject'],'html':_0x291880[_0x1630('0x5b')],'text':_0x291880['text']};var _0x86d9e9={'tls':{'rejectUnauthorized':![]}};if(_0x6e2c3d['Smtp'][_0x1630('0x18d')]){_0x86d9e9['service']=_0x6e2c3d[_0x1630('0x188')][_0x1630('0x18d')];}else{_0x86d9e9[_0x1630('0x18e')]=_0x6e2c3d[_0x1630('0x188')][_0x1630('0x18e')];_0x86d9e9[_0x1630('0x18f')]=_0x6e2c3d[_0x1630('0x188')]['port'];_0x86d9e9[_0x1630('0x190')]=_0x6e2c3d[_0x1630('0x188')]['secure'];}if(_0x6e2c3d[_0x1630('0x188')][_0x1630('0x191')]){_0x86d9e9[_0x1630('0x192')]={'user':_0x6e2c3d[_0x1630('0x188')][_0x1630('0x193')],'pass':_0x6e2c3d['Smtp'][_0x1630('0x194')]};}if(this['isConfigured'](_0x291880[_0x1630('0x195')])){}logger['debug'](_0x1630('0x196'),JSON[_0x1630('0x74')](_0x2bd8ca));this[_0x1630('0x37')][_0x1630('0x71')](this,_0x291880,_0x291880[_0x1630('0x186')]);this['channel'][_0x1630('0xa5')](util['format'](_0x1630('0x197'),_0x6e2c3d[_0x1630('0x14')]));this[_0x1630('0x25')][_0x1630('0x71')](this,_0x86d9e9,_0x2bd8ca);return this['channel'][_0x1630('0xa5')](_0x1630('0x198'));};AGIVertices['prototype'][_0x1630('0x199')]=function(_0x1b65a7){logger[_0x1630('0x2d')](util['format'](_0x1630('0x19a'),_0x1b65a7[_0x1630('0x3a')]));return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x19b'));};AGIVertices['prototype'][_0x1630('0x19c')]=function(_0x3c8483){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x19d'),_0x3c8483[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x3c8483[_0x1630('0x19e')])){return this[_0x1630('0x38')][_0x1630('0xa5')]('no\x20sms\x20account\x20configured');}var _0x36b5c5=this[_0x1630('0x34')][_0x1630('0x71')](this,_0x3c8483[_0x1630('0x19e')]);if(!_0x36b5c5){return this[_0x1630('0x38')][_0x1630('0x32')](_0x3c8483,_0x1630('0x19f'));}var _0x2ee731={'body':_0x3c8483['sms_text'],'phone':_0x3c8483['to']||'','SmsAccountId':_0x36b5c5['id']};logger[_0x1630('0xdb')]('sendSMS\x20message',JSON[_0x1630('0x74')](_0x2ee731));this[_0x1630('0x37')][_0x1630('0x71')](this,_0x3c8483,_0x3c8483[_0x1630('0x19e')]);this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x1a0'),_0x36b5c5[_0x1630('0x14')]));this[_0x1630('0x36')][_0x1630('0x71')](this,_0x2ee731);return this[_0x1630('0x38')]['noop'](_0x1630('0x1a1'));};AGIVertices[_0x1630('0x10')][_0x1630('0x1a2')]=function(_0x4dbe0f){logger['info'](util['format'](_0x1630('0x1a3'),_0x4dbe0f[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0x4dbe0f[_0x1630('0xd4')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x4dbe0f,_0x1630('0x1a4'));}var _0xc8fae=this[_0x1630('0x11')]['sync'](this,_0x4dbe0f['variable_id']);if(!_0xc8fae){return this[_0x1630('0x38')]['error'](_0x4dbe0f,_0x1630('0xd6'));}return this['channel'][_0x1630('0x9c')](_0xc8fae,_0x4dbe0f[_0x1630('0x1a5')]);};AGIVertices[_0x1630('0x10')][_0x1630('0x1a6')]=function(_0x4ee6bc){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4ee6bc['label']));this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x1a7'));if(_0x4ee6bc[_0x1630('0xb7')]==='yes'){this[_0x1630('0x38')]['noop'](_0x1630('0x1a8'));return this[_0x1630('0x38')]['answer']();}return this['channel'][_0x1630('0xa5')](_0x1630('0x1a9'));};AGIVertices[_0x1630('0x10')][_0x1630('0x1aa')]=function(_0x33cb23){logger['info'](util[_0x1630('0x2b')](_0x1630('0x1ab'),_0x33cb23['label']));if(!this[_0x1630('0x80')](_0x33cb23[_0x1630('0x1ac')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0x33cb23,_0x1630('0x1ad'));}var _0x49dfe4=this[_0x1630('0x18')]['sync'](this,_0x33cb23[_0x1630('0x1ac')]);if(!this[_0x1630('0x80')](_0x49dfe4)){return this[_0x1630('0x38')]['error'](_0x33cb23,util[_0x1630('0x2b')](_0x1630('0x1ae'),_0x33cb23[_0x1630('0x1ac')]));}if(_0x49dfe4===this[_0x1630('0x38')][_0x1630('0x43')]){return this[_0x1630('0x38')][_0x1630('0x32')](_0x33cb23,_0x1630('0x1af'));}this[_0x1630('0x37')][_0x1630('0x71')](this,_0x33cb23,_0x49dfe4);var _0x4eb977=this['channel']['exec'](_0x1630('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x1630('0x8')]['host']||'127.0.0.1',_0x49dfe4,this[_0x1630('0x38')][_0x1630('0x43')]));if(_0x4eb977[_0x1630('0xa1')]===-0x1){return _0x4eb977;}return this['channel'][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xc4'),_0x1630('0x1b0'),_0x49dfe4));};AGIVertices[_0x1630('0x10')]['system']=function(_0x378aa2){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x1b1'),_0x378aa2[_0x1630('0x3a')]));var _0x356c02=this['shellCommand'][_0x1630('0x71')](this,_0x378aa2[_0x1630('0xb6')]);this[_0x1630('0x37')][_0x1630('0x71')](this,_0x378aa2,_0x378aa2[_0x1630('0xb6')]);if(this[_0x1630('0x80')](_0x378aa2['variable_id'])){var _0x438394=this['getVariable']['sync'](this,_0x378aa2[_0x1630('0xd4')]);if(_0x438394){this['channel'][_0x1630('0x9c')](_0x438394,_0x356c02);return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x1b2'),_0x378aa2[_0x1630('0xb6')],_0x438394));}}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x1b3'),_0x378aa2['command']));};AGIVertices[_0x1630('0x10')][_0x1630('0x1b4')]=function(_0x15ca33){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x1b5'),_0x15ca33[_0x1630('0x3a')]));_0x15ca33[_0x1630('0x5b')]=_0x15ca33[_0x1630('0x5b')][_0x1630('0xd2')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1630('0x80')](_0x15ca33['apiKey'])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0x1b6'));}if(!this[_0x1630('0x80')](_0x15ca33[_0x1630('0x5b')])){return this['channel'][_0x1630('0xa5')](_0x1630('0xa6'));}this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x15ca33['text']));var _0x5148d5=this[_0x1630('0x59')][_0x1630('0x71')](this,_0x15ca33);if(_0x5148d5){this['channel'][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x1b7'),_0x5148d5));var _0xff6f0d=this[_0x1630('0x38')][_0x1630('0xf4')](_0x5148d5);try{fs[_0x1630('0xf5')](_0x5148d5+'.wav');}catch(_0x28afe1){logger[_0x1630('0x32')](_0x28afe1);}return _0xff6f0d;}return this[_0x1630('0x38')][_0x1630('0x32')](_0x15ca33,_0x1630('0x1b8'));};AGIVertices['prototype'][_0x1630('0x1b9')]=function(_0x32a281){logger['info'](util[_0x1630('0x2b')](_0x1630('0x1ba'),_0x32a281['label']));_0x32a281['text']=_0x32a281[_0x1630('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x32a281[_0x1630('0x5b')])){return this[_0x1630('0x38')][_0x1630('0xa5')](_0x1630('0xa6'));}this['channel'][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x1bb'),_0x32a281[_0x1630('0x5b')]));var _0x21e1f9=this[_0x1630('0x62')]['sync'](this,_0x32a281);if(_0x21e1f9){this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x21e1f9));var _0x343508=this[_0x1630('0x38')]['streamFile'](_0x21e1f9);try{fs[_0x1630('0xf5')](_0x21e1f9+_0x1630('0xf6'));}catch(_0x4bb8d7){logger[_0x1630('0x32')](_0x4bb8d7);}return _0x343508;}return this[_0x1630('0x38')][_0x1630('0x32')](_0x32a281,_0x1630('0x1bc'));};AGIVertices[_0x1630('0x10')]['unpause']=function(_0xcbded7){logger['info'](util[_0x1630('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xcbded7[_0x1630('0x3a')]));if(!this[_0x1630('0x80')](_0xcbded7[_0x1630('0x14d')])){return this[_0x1630('0x38')][_0x1630('0x32')](_0xcbded7,'no\x20find\x20by\x20configured');}logger[_0x1630('0x2d')](util['format'](_0x1630('0x154'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xcbded7[_0x1630('0x14d')]));var _0x4b6df4=this['agentUnpause'][_0x1630('0x71')](this,_0xcbded7[_0x1630('0x14d')]);if(_0x4b6df4){logger['info'](util[_0x1630('0x2b')](_0x1630('0x14f'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xcbded7[_0x1630('0x14d')]));this['channel'][_0x1630('0xa5')](util['format'](_0x1630('0x14f'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xcbded7[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x150')};}else{logger['info'](util['format'](_0x1630('0x151'),this['channel'][_0x1630('0x3c')],_0xcbded7[_0x1630('0x14d')]));this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0x151'),this[_0x1630('0x38')][_0x1630('0x3c')],_0xcbded7[_0x1630('0x14d')]));return{'code':0xc8,'result':_0x1630('0x155')};}};AGIVertices[_0x1630('0x10')]['voicemail']=function(_0x1cf990){logger[_0x1630('0x2d')](util[_0x1630('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1cf990[_0x1630('0x3a')]));var _0x53d1ab=this[_0x1630('0x38')]['exec']('VOICEMAIL',[_0x1cf990[_0x1630('0x1bd')],_0x1cf990[_0x1630('0x77')]]);if(_0x53d1ab[_0x1630('0xa1')]===-0x1){return _0x53d1ab;}return this[_0x1630('0x38')][_0x1630('0xa5')](util[_0x1630('0x2b')](_0x1630('0xc4'),'VOICEMAIL',_0x1cf990[_0x1630('0x1bd')]));};AGIVertices[_0x1630('0x10')][_0x1630('0x1be')]=function(_0x2d8e2b){logger[_0x1630('0x2d')](util[_0x1630('0x2b')](_0x1630('0x1bf'),_0x2d8e2b['label']));if(!this[_0x1630('0x80')](_0x2d8e2b[_0x1630('0xd4')])){return this[_0x1630('0x38')]['error'](_0x2d8e2b,_0x1630('0x1a4'));}var _0x328335=this[_0x1630('0x11')][_0x1630('0x71')](this,_0x2d8e2b[_0x1630('0xd4')]);if(!_0x328335){return this[_0x1630('0x38')][_0x1630('0x32')](_0x2d8e2b,_0x1630('0xd6'));}var _0x3fb85f=this[_0x1630('0x38')]['getVariable'](_0x328335);return{'code':0xc8,'result':_0x3fb85f[_0x1630('0x9e')]?_0x3fb85f[_0x1630('0x9e')]:'-'};};String[_0x1630('0x10')][_0x1630('0x1c0')]=function(_0xbbeb8d,_0x1a8570){return this['split'](_0xbbeb8d)[_0x1630('0x1c1')](_0x1a8570);};module[_0x1630('0x1c2')]=AGIVertices; \ No newline at end of file +var _0x8c5c=['getTrunk','getTrunkById','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','Intervals','interval','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','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','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','format','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','languageCode','ssmlGender','MP3','text','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','parse','computedVariables','sync','uri','render','headers','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','.wav','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','escape_digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','debug','account_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','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://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Trying\x20Google\x20TTS\x20%s','googleTTS','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x8c5c,0x1a2));var _0xc8c5=function(_0x265be6,_0xd0aec6){_0x265be6=_0x265be6-0x0;var _0x37fbbc=_0x8c5c[_0x265be6];return _0x37fbbc;};'use strict';var fs=require('fs');var path=require(_0xc8c5('0x0'));var util=require(_0xc8c5('0x1'));var _=require(_0xc8c5('0x2'));var sh=require(_0xc8c5('0x3'));var odbc=require(_0xc8c5('0x4'))();var rs=require(_0xc8c5('0x5'));var moment=require(_0xc8c5('0x6'));var Mustache=require(_0xc8c5('0x7'));var rp=require(_0xc8c5('0x8'));var logger=require(_0xc8c5('0x9'))(_0xc8c5('0xa'));var config=require(_0xc8c5('0xb'));var scripts=require(_0xc8c5('0xc'));var FILES_PATH=_0xc8c5('0xd');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xc8c5('0xe'),_0xc8c5('0xf'),'getsecretdigits'];var AGIVertices=function(_0x318a38,_0x18dea8,_0x3e5275){this[_0xc8c5('0x10')]=_0x318a38;this[_0xc8c5('0x11')]=_0x18dea8;this[_0xc8c5('0x12')]=_0x3e5275;};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x14')]=function(_0x3db997,_0x2d40b7){this[_0xc8c5('0x11')][_0xc8c5('0x15')](_0x3db997)[_0xc8c5('0x16')](function(_0x2efb58){_0x2d40b7(null,_0x2efb58?_0x2efb58[_0xc8c5('0x17')]:![]);})[_0xc8c5('0x18')](function(_0x4dfbff){_0x2d40b7(_0x4dfbff);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x19')]=function(_0x52dba2,_0x34b321){this[_0xc8c5('0x11')]['getVoiceQueueById'](_0x52dba2)[_0xc8c5('0x16')](function(_0x3019bf){_0x34b321(null,_0x3019bf?_0x3019bf[_0xc8c5('0x17')]:![]);})[_0xc8c5('0x18')](function(_0x481fd6){_0x34b321(_0x481fd6);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1a')]=function(_0x31b778,_0x5b04a0){this[_0xc8c5('0x11')][_0xc8c5('0x1b')](_0x31b778)[_0xc8c5('0x16')](function(_0x2332a8){_0x5b04a0(null,_0x2332a8?_0x2332a8[_0xc8c5('0x17')]:![]);})['catch'](function(_0x428825){_0x5b04a0(_0x428825);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1c')]=function(_0x55fcd5,_0x38928e){this[_0xc8c5('0x11')][_0xc8c5('0x1d')](_0x55fcd5)[_0xc8c5('0x16')](function(_0x1b5db6){_0x38928e(null,_0x1b5db6?_0x1b5db6['dsn']:![]);})[_0xc8c5('0x18')](function(_0x26922d){_0x38928e(_0x26922d);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1e')]=function(_0x15a73f,_0x191cba){this[_0xc8c5('0x11')][_0xc8c5('0x1f')](_0x15a73f)[_0xc8c5('0x16')](function(_0x2080d4){_0x191cba(null,_0x2080d4?_0x2080d4[_0xc8c5('0x17')]:![]);})[_0xc8c5('0x18')](function(_0x55372a){_0x191cba(_0x55372a);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x20')]=function(_0x388e81,_0x44ef22){this[_0xc8c5('0x11')][_0xc8c5('0x21')](_0x388e81)[_0xc8c5('0x16')](function(_0x4dd188){_0x44ef22(null,_0x4dd188?_0x4dd188[_0xc8c5('0x17')]:![]);})[_0xc8c5('0x18')](function(_0x561360){_0x44ef22(_0x561360);});};AGIVertices[_0xc8c5('0x13')]['getSound']=function(_0x3d77d6,_0x6f1e9f){var _0x3d2e48=this;this['rpc']['getSoundById'](_0x3d77d6)['then'](function(_0x56f8ef){_0x6f1e9f(null,_0x56f8ef?_0x3d2e48['getSoundPath'](_0x56f8ef[_0xc8c5('0x22')]):![]);})[_0xc8c5('0x18')](function(_0x5e47b1){_0x6f1e9f(_0x5e47b1);});};AGIVertices['prototype'][_0xc8c5('0x23')]=function(_0x104ca6,_0x35e274){this[_0xc8c5('0x11')][_0xc8c5('0x24')](_0x104ca6)[_0xc8c5('0x16')](function(_0x4fee1e){_0x35e274(null,_0x4fee1e?_0x4fee1e:![]);})[_0xc8c5('0x18')](function(_0x1c252b){_0x35e274(_0x1c252b);});};AGIVertices[_0xc8c5('0x13')]['sendMailMessage']=function(_0x5765b1,_0x479fa5,_0x4f0775){this[_0xc8c5('0x12')]['sendMailMessage'](_0x5765b1,_0x479fa5)[_0xc8c5('0x16')](function(){_0x4f0775(null);})[_0xc8c5('0x18')](function(_0x4415ee){_0x4f0775(_0x4415ee);});};AGIVertices['prototype'][_0xc8c5('0x25')]=function(_0x169d63,_0xbc0d65){this[_0xc8c5('0x11')][_0xc8c5('0x26')](_0x169d63)[_0xc8c5('0x16')](function(_0x12cb71){if(_0x12cb71){if(_0x12cb71[_0xc8c5('0x27')]){_0xbc0d65(null,[_0x12cb71['interval']]);}else{_0xbc0d65(null,_['map'](_0x12cb71[_0xc8c5('0x28')],_0xc8c5('0x29')));}}else{_0xbc0d65(null,![]);}})[_0xc8c5('0x18')](function(_0x5b45d8){_0xbc0d65(_0x5b45d8);});};AGIVertices['prototype'][_0xc8c5('0x2a')]=function(_0x37ae9c){return util['format'](_0xc8c5('0x2b'),FILES_PATH,_0x37ae9c);};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x2c')]=function(_0x332a6d,_0x59a07b,_0xd2e694){odbc['open'](_0x332a6d,function(_0x974f25){if(_0x974f25){logger[_0xc8c5('0x2d')](_0xc8c5('0x2e'),_0x974f25);_0xd2e694(_0x974f25);}else{logger[_0xc8c5('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0xc8c5('0x30')](_0x59a07b,function(_0x2f895c,_0x52d7f7){if(_0x2f895c){logger[_0xc8c5('0x2f')](_0xc8c5('0x31'),_0x59a07b);_0xd2e694(_0x2f895c);}else{logger[_0xc8c5('0x2f')](_0xc8c5('0x32'),_0x59a07b);odbc[_0xc8c5('0x33')](function(_0x7f472a){if(_0x7f472a){logger[_0xc8c5('0x2d')](_0xc8c5('0x34'),_0x7f472a);}_0xd2e694(null,_0x52d7f7);});}});}});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x35')]=function(_0x53ff67,_0x2d1320){this[_0xc8c5('0x11')][_0xc8c5('0x36')](_0x53ff67)['then'](function(_0x3455ad){_0x2d1320(null,_0x3455ad?_0x3455ad:![]);})['catch'](function(_0x2df45c){_0x2d1320(_0x2df45c);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x37')]=function(_0x2ce0ba,_0x59ce8a){this[_0xc8c5('0x11')][_0xc8c5('0x37')](_0x2ce0ba)[_0xc8c5('0x16')](function(_0x55732f){_0x59ce8a(null,_0x55732f);})['catch'](function(_0x35ecb0){_0x59ce8a(_0x35ecb0);});};AGIVertices[_0xc8c5('0x13')]['createSquareDetailsReport']=function(_0x380b1c,_0x870558,_0x2442eb){this[_0xc8c5('0x11')][_0xc8c5('0x38')]({'uniqueid':this[_0xc8c5('0x10')][_0xc8c5('0x39')],'node':_0x380b1c[_0xc8c5('0x3a')],'application':_0x380b1c[_0xc8c5('0x3b')],'data':_0x870558||null,'project_name':this[_0xc8c5('0x10')][_0xc8c5('0x3c')],'callerid':this[_0xc8c5('0x10')]['callerid']})[_0xc8c5('0x16')](function(_0x9313b){if(_0x2442eb){_0x2442eb(null,_0x9313b);}})[_0xc8c5('0x18')](function(_0x33d258){if(_0x2442eb){_0x2442eb(_0x33d258);}});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x3d')]=function(_0x1d5d4f,_0x5bdb74,_0x59094d,_0x391d20){this['rpc'][_0xc8c5('0x3d')]({'uniqueid':this[_0xc8c5('0x10')]['uniqueid'],'callerid':this[_0xc8c5('0x10')][_0xc8c5('0x3e')],'calleridname':this['channel'][_0xc8c5('0x3f')],'context':this[_0xc8c5('0x10')]['context'],'extension':this[_0xc8c5('0x10')][_0xc8c5('0x40')],'priority':this[_0xc8c5('0x10')][_0xc8c5('0x41')],'accountcode':this[_0xc8c5('0x10')][_0xc8c5('0x42')],'dnid':this['channel'][_0xc8c5('0x43')],'projectName':this['channel'][_0xc8c5('0x3c')],'saveName':_0x5bdb74,'filename':_0x1d5d4f[_0xc8c5('0x44')]||_0x5bdb74,'savePath':_0x59094d})[_0xc8c5('0x16')](function(_0x340ade){_0x391d20(null,_0x340ade);})['catch'](function(_0x24646d){_0x391d20(_0x24646d);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x45')]=function(_0x26135f,_0x274b07,_0x4ebf1e){this['rpc'][_0xc8c5('0x45')]({'uniqueid':this[_0xc8c5('0x10')]['uniqueid'],'body':_0x26135f,'direction':_0x274b07})[_0xc8c5('0x16')](function(_0x160d6c){if(_0x4ebf1e){_0x4ebf1e(null,_0x160d6c);}})['catch'](function(_0x5d06f1){if(_0x4ebf1e){_0x4ebf1e(_0x5d06f1);}});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x46')]=function(_0x502f5b,_0x192df9){this[_0xc8c5('0x11')][_0xc8c5('0x46')]({'firstName':_[_0xc8c5('0x47')](_0x502f5b['name'])||_['isNil'](_0x502f5b[_0xc8c5('0x17')])?'callback_'+Math[_0xc8c5('0x48')]():_0x502f5b['name'],'lastName':_[_0xc8c5('0x47')](_0x502f5b[_0xc8c5('0x49')])||_[_0xc8c5('0x4a')](_0x502f5b['lastName'])?null:_0x502f5b['lastName'],'phone':_0x502f5b[_0xc8c5('0x4b')],'ListId':_0x502f5b[_0xc8c5('0x4c')],'scheduledat':_0x502f5b[_0xc8c5('0x4d')],'callbackUniqueid':this[_0xc8c5('0x10')][_0xc8c5('0x39')],'tags':_0xc8c5('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0x502f5b['scheduledAt'][_0xc8c5('0x4f')](),'priority':_0x502f5b[_0xc8c5('0x50')]})[_0xc8c5('0x16')](function(_0x275f99){_0x192df9(null,_0x275f99);})['catch'](function(_0x10f4a1){_0x192df9(_0x10f4a1);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x51')]=function(_0x5b5ccd,_0x25505e){this[_0xc8c5('0x11')][_0xc8c5('0x52')](_0x5b5ccd)[_0xc8c5('0x16')](function(_0x5da073){_0x25505e(null,_0x5da073?_0x5da073[_0xc8c5('0x17')]:![]);})[_0xc8c5('0x18')](function(_0x1518b9){_0x25505e(_0x1518b9);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x53')]=function(_0x3fc06c,_0x47f538,_0x287d9a){var _0x9cfb39={'role':'agent'};_0x9cfb39[_0x3fc06c]=this[_0xc8c5('0x10')][_0xc8c5('0x3e')];this['rpc'][_0xc8c5('0x53')](_0x9cfb39,_0x47f538,this[_0xc8c5('0x10')][_0xc8c5('0x39')])[_0xc8c5('0x16')](function(_0x1bf5a8){_0x287d9a(null,_['isNil'](_0x1bf5a8)?![]:!![]);})['catch'](function(_0x25d844){logger[_0xc8c5('0x2d')](_0x25d844);_0x287d9a(null,![]);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x54')]=function(_0x446a89,_0x4b37e9){var _0xf09a3d={'role':_0xc8c5('0x55')};_0xf09a3d[_0x446a89]=this[_0xc8c5('0x10')][_0xc8c5('0x3e')];this[_0xc8c5('0x11')][_0xc8c5('0x54')](_0xf09a3d)[_0xc8c5('0x16')](function(_0x57a115){_0x4b37e9(null,_[_0xc8c5('0x4a')](_0x57a115)?![]:!![]);})[_0xc8c5('0x18')](function(_0x5dd715){logger[_0xc8c5('0x2d')](_0x5dd715);_0x4b37e9(null,![]);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x56')]=function(_0x15ceb1,_0x5e42ca){var _0x231633={'role':_0xc8c5('0x55')};_0x231633[_0x15ceb1]=this[_0xc8c5('0x10')]['callerid'];this[_0xc8c5('0x11')][_0xc8c5('0x56')](_0x231633)[_0xc8c5('0x16')](function(_0x5acfa9){_0x5e42ca(null,_[_0xc8c5('0x4a')](_0x5acfa9)?![]:!![]);})['catch'](function(_0x255d02){logger[_0xc8c5('0x2d')](_0x255d02);_0x5e42ca(null,![]);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x57')]=function(_0x144be5,_0x367d08){var _0x24273f={'role':_0xc8c5('0x55')};_0x24273f[_0x144be5]=this[_0xc8c5('0x10')][_0xc8c5('0x3e')];var _0x5ae49a=_0x144be5!=_0xc8c5('0x58')?util[_0xc8c5('0x59')]('%s/%s@from-sip/n',_0xc8c5('0x5a'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')]):undefined;this[_0xc8c5('0x11')]['agentLogin'](_0x24273f,_0x5ae49a)[_0xc8c5('0x16')](function(_0x117ab2){_0x367d08(null,_[_0xc8c5('0x4a')](_0x117ab2)?![]:!![]);})[_0xc8c5('0x18')](function(_0x3e9999){logger[_0xc8c5('0x2d')](_0x3e9999);_0x367d08(null,![]);});};AGIVertices[_0xc8c5('0x13')]['shellCommand']=function(_0x1cf8cc,_0x3fb5fe){sh[_0xc8c5('0x5b')](_[_0xc8c5('0x5c')](_0x1cf8cc),function(_0xb3e3b9,_0x809d1d){var _0x1c38f8=_0x809d1d[_0xc8c5('0x5d')](/(\r\n|\n|\r)/gm,'');_0x3fb5fe(null,_0x1c38f8);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x5e')]=function(_0x3e75d2,_0x3e5e05){scripts['googleCloudTTS'](_0x3e75d2[_0xc8c5('0x5f')],_0x3e75d2['google_cloud_tts_text_type']||'text',_0x3e75d2['text'],_0x3e75d2[_0xc8c5('0x60')]||'en-US',_0x3e75d2[_0xc8c5('0x61')]||'MALE',_0x3e75d2['audioEncoding']||_0xc8c5('0x62'))[_0xc8c5('0x16')](function(_0x4d795f){_0x3e5e05(null,_0x4d795f);})['catch'](function(_0x403da8){_0x3e5e05(_0x403da8);});};AGIVertices[_0xc8c5('0x13')]['googleTTS']=function(_0x10a42d,_0x2b18e8){scripts['googleTTS'](_0x10a42d[_0xc8c5('0x63')],_0x10a42d[_0xc8c5('0x64')]||'en',0x1)['then'](function(_0x21374b){_0x2b18e8(null,_0x21374b);})[_0xc8c5('0x18')](function(_0x9b0dae){_0x2b18e8(_0x9b0dae);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x65')]=function(_0x4f8001,_0x49727d){var _0x542f41={'uri':_0x4f8001[_0xc8c5('0x66')],'method':_0x4f8001[_0xc8c5('0x67')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4f8001[_0xc8c5('0x68')])===_0xc8c5('0x69')&&parseInt(_0x4f8001[_0xc8c5('0x68')])>=0x1?parseInt(_0x4f8001['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xc8c5('0x6a')]([_0xc8c5('0x6b'),_0xc8c5('0x6c')],_0x542f41['method'][_0xc8c5('0x6d')]())){try{_0x542f41[_0xc8c5('0x6e')]=_0x4f8001[_0xc8c5('0x6f')]?JSON['parse'](_0x4f8001[_0xc8c5('0x6f')]):{};}catch(_0x4f8854){logger[_0xc8c5('0x2d')](_0xc8c5('0x70'),_0x4f8854);}}try{_0x542f41['headers']=_0x4f8001[_0xc8c5('0x71')]?JSON[_0xc8c5('0x72')](_0x4f8001[_0xc8c5('0x71')]):{};}catch(_0x5b5ecd){logger[_0xc8c5('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5b5ecd);}if(_0x4f8001[_0xc8c5('0x73')]){try{var _0x3082f2=require(_0x4f8001[_0xc8c5('0x73')])[_0xc8c5('0x74')](this,_0x542f41);_0x542f41[_0xc8c5('0x75')]=Mustache[_0xc8c5('0x76')](_0x4f8001['url'],_0x3082f2,{},['$$','$$']);if(_0x542f41[_0xc8c5('0x77')]){_0x542f41[_0xc8c5('0x77')]=JSON[_0xc8c5('0x72')](Mustache[_0xc8c5('0x76')](JSON[_0xc8c5('0x78')](_0x542f41[_0xc8c5('0x77')]),_0x3082f2,{},['$$','$$']));}if(_0x542f41[_0xc8c5('0x6e')]){_0x542f41[_0xc8c5('0x6e')]=JSON[_0xc8c5('0x72')](Mustache[_0xc8c5('0x76')](JSON[_0xc8c5('0x78')](_0x542f41[_0xc8c5('0x6e')]),_0x3082f2,{},['$$','$$']));}}catch(_0xab1e71){logger[_0xc8c5('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xab1e71);}}rp(_0x542f41)[_0xc8c5('0x16')](function(_0x58623c){var _0x212104={'statusCode':_0x58623c[_0xc8c5('0x79')]||0xc8,'statusMessage':_0x58623c['statusMessage']||'OK','headers':_0x58623c[_0xc8c5('0x77')]||{},'body':_0x58623c[_0xc8c5('0x6e')]||{}};_0x49727d(null,_0x212104);})[_0xc8c5('0x18')](function(_0x3ede01){var _0x3a4f2d={'statusCode':_0x3ede01[_0xc8c5('0x79')]||0x1f4,'statusMessage':_0x3ede01[_0xc8c5('0x7a')]||_0xc8c5('0x7b'),'headers':_0x3ede01['options']['headers']||{},'body':_0x3ede01[_0xc8c5('0x7c')]['body']||{}};_0x49727d(null,_0x3a4f2d);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x7d')]=function(_0x483df9,_0x4f4024){scripts['googleDialogflow'](this[_0xc8c5('0x10')][_0xc8c5('0x39')],_0x483df9[_0xc8c5('0x7e')],_0x483df9['text'],_0x483df9[_0xc8c5('0x7f')]||'en')[_0xc8c5('0x16')](function(_0x571aff){_0x4f4024(null,_0x571aff);})[_0xc8c5('0x18')](function(_0x21e830){_0x4f4024(_0x21e830);});};AGIVertices['prototype'][_0xc8c5('0x80')]=function(_0x55441f,_0x149909){scripts[_0xc8c5('0x80')](this[_0xc8c5('0x10')],_0x55441f)[_0xc8c5('0x16')](function(_0x3bcf7a){_0x149909(null,_0x3bcf7a);})[_0xc8c5('0x18')](function(_0x1e8802){_0x149909(_0x1e8802);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x81')]=function(_0x495a42,_0xf8f5c3){scripts[_0xc8c5('0x81')](_0x495a42['key'],_0x495a42['text'],_0x495a42[_0xc8c5('0x82')]||_0xc8c5('0x83'),_0x495a42[_0xc8c5('0x84')])[_0xc8c5('0x16')](function(_0x2c916a){_0xf8f5c3(null,_0x2c916a);})[_0xc8c5('0x18')](function(_0x2b5f2b){_0xf8f5c3(_0x2b5f2b);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x85')]=function(_0x398883,_0x476a96,_0x42c2fe){scripts[_0xc8c5('0x85')](_0x476a96,_0x398883[_0xc8c5('0x7e')],_0x398883[_0xc8c5('0x86')]||_0xc8c5('0x83'),this[_0xc8c5('0x87')](_0x398883[_0xc8c5('0x88')])?_0x398883[_0xc8c5('0x88')]:undefined)[_0xc8c5('0x16')](function(_0x574738){_0x42c2fe(null,_0x574738);})[_0xc8c5('0x18')](function(_0x1d2a8b){_0x42c2fe(_0x1d2a8b);});};AGIVertices['prototype']['awsPolly']=function(_0x1ea2b3,_0x1f7eb4){scripts[_0xc8c5('0x89')](_0x1ea2b3[_0xc8c5('0x8a')],_0x1ea2b3[_0xc8c5('0x8b')],_0x1ea2b3[_0xc8c5('0x8c')],_0x1ea2b3['aws_polly_voice']||_0xc8c5('0x8d'),_0x1ea2b3['text'],_0x1ea2b3['aws_text_type']||_0xc8c5('0x63'))[_0xc8c5('0x16')](function(_0x5e2058){_0x1f7eb4(null,_0x5e2058);})[_0xc8c5('0x18')](function(_0x158287){_0x1f7eb4(_0x158287);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x8e')]=function(_0x737cc7,_0xaf37ec){scripts[_0xc8c5('0x8e')](this[_0xc8c5('0x10')][_0xc8c5('0x39')],_0x737cc7[_0xc8c5('0x8a')],_0x737cc7[_0xc8c5('0x8b')],_0x737cc7['aws_lex_region'],_0x737cc7['text'],_0x737cc7['aws_bot_name'])[_0xc8c5('0x16')](function(_0x3f113c){_0xaf37ec(null,_0x3f113c);})[_0xc8c5('0x18')](function(_0x225bdd){_0xaf37ec(_0x225bdd);});};AGIVertices['prototype'][_0xc8c5('0x8f')]=function(_0x5c495a,_0x33546e,_0xe70ecc){scripts[_0xc8c5('0x8f')](_0x33546e,_0x5c495a[_0xc8c5('0x7e')],_0x5c495a[_0xc8c5('0x90')]||'en-US')[_0xc8c5('0x16')](function(_0x500efa){_0xe70ecc(null,_0x500efa);})['catch'](function(_0x4bd7f6){_0xe70ecc(_0x4bd7f6);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x91')]=function(_0x24f257,_0x204ee1,_0x3f057d){scripts[_0xc8c5('0x91')](_0x204ee1,_0x24f257[_0xc8c5('0x92')],_0x24f257['appsecret'],_0x24f257[_0xc8c5('0x75')])[_0xc8c5('0x16')](function(_0x5b7e26){_0x3f057d(null,_0x5b7e26);})['catch'](function(_0x1b6f7a){_0x3f057d(_0x1b6f7a);});};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x93')]=function(_0x12d6dd){var _0x41107f=_['includes'](verticesWithRetry,_0x12d6dd[_0xc8c5('0x3b')])?_0x12d6dd:_[_0xc8c5('0x94')](_0x12d6dd);for(var _0x2b690b in _0x41107f){if(_0x41107f[_0xc8c5('0x95')](_0x2b690b)){if(_0x41107f[_0x2b690b]&&_[_0xc8c5('0x96')](_0x41107f[_0x2b690b])){if(_['includes'](recursiveMapAttributes,_0x2b690b)){_0x41107f[_0x2b690b]=this[_0xc8c5('0x97')](_0x41107f[_0x2b690b]);}else{_0x41107f[_0x2b690b]=this[_0xc8c5('0x98')](_0x41107f[_0x2b690b]);}}}}return _0x41107f;};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x99')]=function(_0x1134f6){for(var _0x281c0e in _0x1134f6){if(_0x1134f6[_0xc8c5('0x95')](_0x281c0e)){if(_['isPlainObject'](_0x1134f6[_0x281c0e])){this[_0xc8c5('0x99')](_0x1134f6[_0x281c0e]);}else if(_[_0xc8c5('0x9a')](_0x1134f6[_0x281c0e])){for(var _0x25f127=0x0;_0x25f127<_0x1134f6[_0x281c0e][_0xc8c5('0x9b')];_0x25f127++){this['recursiveNodeIndex'](_0x1134f6[_0x281c0e][_0x25f127]);}}else if(_[_0xc8c5('0x96')](_0x1134f6[_0x281c0e])){_0x1134f6[_0x281c0e]=this['replaceAllVariables'](_0x1134f6[_0x281c0e]);}}}};AGIVertices['prototype'][_0xc8c5('0x9c')]=function(_0x466ab5,_0x1dc62d){for(var _0x347735 in _0x466ab5){if(_0x466ab5[_0xc8c5('0x95')](_0x347735)){if(_['isPlainObject'](_0x466ab5[_0x347735])){if(!_[_0xc8c5('0x47')](_0x466ab5[_0x347735])){this['saveRestApiResult'](_0x466ab5[_0x347735],util[_0xc8c5('0x59')](_0xc8c5('0x9d'),_0x1dc62d,_0x347735));}}else if(_[_0xc8c5('0x9a')](_0x466ab5[_0x347735])){for(var _0x394b6b=0x0;_0x394b6b<_0x466ab5[_0x347735][_0xc8c5('0x9b')];_0x394b6b++){this[_0xc8c5('0x9c')](_0x466ab5[_0x347735][_0x394b6b],util[_0xc8c5('0x59')]('%s.%s',_0x1dc62d,_0x347735+'['+_0x394b6b+']'));}}else{if(!_['isNil'](_0x466ab5[_0x347735])){this['channel'][_0xc8c5('0x9e')](util['format'](_0xc8c5('0x9d'),_0x1dc62d,_0x347735),_0x466ab5[_0x347735]);}}}}};AGIVertices['prototype'][_0xc8c5('0x97')]=function(_0x5811e2){try{var _0x292510=JSON['parse'](_0x5811e2);this[_0xc8c5('0x99')](_0x292510);return JSON[_0xc8c5('0x78')](_0x292510);}catch(_0x28af16){return this[_0xc8c5('0x98')](_0x5811e2);}};AGIVertices[_0xc8c5('0x13')]['replaceAllVariables']=function(_0x560f35){var _0x56eaea=_0x560f35[_0xc8c5('0x9f')]('{');for(var _0x4e3dbd=0x1;_0x4e3dbd<_0x56eaea[_0xc8c5('0x9b')];_0x4e3dbd+=0x1){var _0x34861d=_0x56eaea[_0x4e3dbd]['split']('}');if(_0x34861d['length']>0x1){_0x560f35=_0x560f35['replaceAll']('{'+_0x34861d[0x0]+'}',this[_0xc8c5('0x10')][_0xc8c5('0x14')](_0x34861d[0x0])[_0xc8c5('0xa0')]||_0x34861d[0x0]);}}if(_0x56eaea[_0xc8c5('0x9b')]===0x1){return _0x560f35['toString']();}return this[_0xc8c5('0x98')](_0x560f35);};AGIVertices[_0xc8c5('0x13')]['getAndSetVariable']=function(_0x2f7135,_0x1bc7fe){var _0x5477ee=this[_0xc8c5('0x10')][_0xc8c5('0x14')](_0x2f7135);if(_0x5477ee[_0xc8c5('0xa1')]===-0x1){return _0x5477ee;}logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xa2'),_0x1bc7fe,_0x5477ee[_0xc8c5('0xa0')]));return this[_0xc8c5('0x10')]['setVariable'](_0x1bc7fe,_0x5477ee['extra']);};AGIVertices['prototype'][_0xc8c5('0x87')]=function(_0x538425){return _0x538425&&_0x538425!=='0'&&_0x538425!=='-1'&&_0x538425!=='';};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xa3')]=function(_0x576426){this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x576426,'-');_0x576426['retry']=_0x576426['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xc8c5('0xa4')]=function(_0x5d35ef){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xa5'),_0x5d35ef['label']));if(!this[_0xc8c5('0x87')](_0x5d35ef[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}var _0x44c6d7='\x22'+_0x5d35ef[_0xc8c5('0x63')]+'\x22';if(this[_0xc8c5('0x87')](_0x5d35ef['options'])){_0x44c6d7+=','+_0x5d35ef[_0xc8c5('0x7c')];}var _0x3a5f76=this[_0xc8c5('0x10')]['exec']('MRCPSynth',_0x44c6d7);if(_0x3a5f76[_0xc8c5('0xa1')]===-0x1){return _0x3a5f76;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xa8'),_0x44c6d7));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xa9')]=function(_0x28e91c){logger['info'](util[_0xc8c5('0x59')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x28e91c['label']));if(!this['isConfigured'](_0x28e91c[_0xc8c5('0xaa')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20grammar\x20configured');}var _0x371257=_0x28e91c[_0xc8c5('0xaa')];if(this[_0xc8c5('0x87')](_0x28e91c[_0xc8c5('0x7c')])){_0x371257+=','+_0x28e91c[_0xc8c5('0x7c')];}var _0x5eea02=this['channel'][_0xc8c5('0x5b')](_0xc8c5('0xab'),_0x371257);if(_0x5eea02[_0xc8c5('0xa1')]===-0x1){return _0x5eea02;}var _0x5f4fd2=this['getAndSetVariable'](_0xc8c5('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x5f4fd2[_0xc8c5('0xa1')]===-0x1){return _0x5f4fd2;}var _0x51a8b7=this[_0xc8c5('0xad')](_0xc8c5('0xae'),'MRCP_RECOG_TRANSCRIPT');if(_0x51a8b7[_0xc8c5('0xa1')]===-0x1){return _0x51a8b7;}var _0x4f9264=this[_0xc8c5('0xad')](_0xc8c5('0xaf'),_0xc8c5('0xb0'));if(_0x4f9264[_0xc8c5('0xa1')]===-0x1){return _0x4f9264;}return this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xb1'),_0x371257));};AGIVertices['prototype'][_0xc8c5('0xa')]=function(_0x1fc576){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0xb2'),_0x1fc576[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')]['agi']([_0x1fc576[_0xc8c5('0xb3')],_0x1fc576[_0xc8c5('0xb4')]]);};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xb5')]=function(_0x4fac08){logger[_0xc8c5('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4fac08[_0xc8c5('0x3a')]));if(this[_0xc8c5('0x87')](_0x4fac08[_0xc8c5('0x68')])){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0xb6'),_0x4fac08[_0xc8c5('0x68')]));var _0x46998b=this['channel'][_0xc8c5('0xb7')](_0x4fac08[_0xc8c5('0x68')]);if(_0x46998b[_0xc8c5('0xa1')]===-0x1){return _0x46998b;}}return this['channel'][_0xc8c5('0xb5')]();};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x4e')]=function(_0x1aa106){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xb8'),_0x1aa106['label']));if(!this[_0xc8c5('0x87')](_0x1aa106[_0xc8c5('0x4c')])){return this['channel'][_0xc8c5('0x2d')](_0x1aa106,_0xc8c5('0xb9'));}_0x1aa106[_0xc8c5('0x4d')]=moment();if(this['isConfigured'](_0x1aa106['delay'])){_0x1aa106[_0xc8c5('0x4d')]=moment()[_0xc8c5('0xba')](_0x1aa106[_0xc8c5('0xbb')],_0xc8c5('0xbc'));}if(!this[_0xc8c5('0x87')](_0x1aa106[_0xc8c5('0x50')])){_0x1aa106[_0xc8c5('0x50')]=0x2;}this['createCmContact']['sync'](this,_0x1aa106);return this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xbd'),_0x1aa106[_0xc8c5('0x4b')],_0x1aa106['list_id'],_0x1aa106['scheduledAt']));};AGIVertices[_0xc8c5('0x13')]['custom_app']=function(_0x4d2a14){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0xbe'),_0x4d2a14[_0xc8c5('0x3a')]));var _0x362aba=this[_0xc8c5('0x10')][_0xc8c5('0x5b')](_0x4d2a14[_0xc8c5('0xbf')],_0x4d2a14[_0xc8c5('0x7c')]);if(_0x362aba[_0xc8c5('0xa1')]===-0x1){return _0x362aba;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xc0'),_0x4d2a14[_0xc8c5('0xbf')],_0x4d2a14['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x361e03){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xc1'),_0x361e03[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x361e03[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}var _0x52710e='\x22'+_0x361e03[_0xc8c5('0x63')]+'\x22';if(this[_0xc8c5('0x87')](_0x361e03[_0xc8c5('0x7c')])){_0x52710e+=','+_0x361e03['options'];}var _0x5adad4=this[_0xc8c5('0x10')][_0xc8c5('0x5b')](_0xc8c5('0xc2'),_0x52710e);if(_0x5adad4[_0xc8c5('0xa1')]===-0x1){return _0x5adad4;}return this[_0xc8c5('0x10')]['noop'](util['format'](_0xc8c5('0xa8'),_0x52710e));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xc3')]=function(_0x3adbd8){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3adbd8['label']));if(!this[_0xc8c5('0x87')](_0x3adbd8[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}var _0x3cb847='\x22'+_0x3adbd8[_0xc8c5('0x63')]+'\x22';if(this[_0xc8c5('0x87')](_0x3adbd8[_0xc8c5('0x7c')])){_0x3cb847+=','+_0x3adbd8['options'];}var _0x3cddd4=this[_0xc8c5('0x10')][_0xc8c5('0x5b')]('MRCPSynth',_0x3cb847);if(_0x3cddd4[_0xc8c5('0xa1')]===-0x1){return _0x3cddd4;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xa8'),_0x3cb847));};AGIVertices['prototype']['lumenvoxasr']=function(_0x18d8c7){logger[_0xc8c5('0x2f')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x18d8c7[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x18d8c7[_0xc8c5('0xaa')])){return this[_0xc8c5('0x10')]['noop']('no\x20grammar\x20configured');}var _0x318119=_0x18d8c7[_0xc8c5('0xaa')];if(this[_0xc8c5('0x87')](_0x18d8c7['options'])){_0x318119+=','+_0x18d8c7[_0xc8c5('0x7c')];}var _0x410def=this['channel'][_0xc8c5('0x5b')](_0xc8c5('0xab'),_0x318119);if(_0x410def[_0xc8c5('0xa1')]===-0x1){return _0x410def;}var _0x30c2e1=this['getAndSetVariable'](_0xc8c5('0xac'),_0xc8c5('0xc4'));if(_0x30c2e1[_0xc8c5('0xa1')]===-0x1){return _0x30c2e1;}var _0x3fffd0=this[_0xc8c5('0xad')](_0xc8c5('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3fffd0[_0xc8c5('0xa1')]===-0x1){return _0x3fffd0;}var _0x25792b=this[_0xc8c5('0xad')](_0xc8c5('0xaf'),_0xc8c5('0xc5'));if(_0x25792b['result']===-0x1){return _0x25792b;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xb1'),_0x318119));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xc6')]=function(_0x28bf92){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xc7'),_0x28bf92[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x28bf92[_0xc8c5('0xaa')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xc8'));}var _0x5dfcc5=_0x28bf92['grammar'];if(this[_0xc8c5('0x87')](_0x28bf92[_0xc8c5('0x7c')])){_0x5dfcc5+=','+_0x28bf92[_0xc8c5('0x7c')];}var _0x1942eb=this['channel'][_0xc8c5('0x5b')](_0xc8c5('0xab'),_0x5dfcc5);if(_0x1942eb[_0xc8c5('0xa1')]===-0x1){return _0x1942eb;}var _0x565c95=this[_0xc8c5('0xad')]('RECOG_CONFIDENCE()',_0xc8c5('0xc9'));if(_0x565c95[_0xc8c5('0xa1')]===-0x1){return _0x565c95;}var _0x301228=this[_0xc8c5('0xad')](_0xc8c5('0xae'),_0xc8c5('0xca'));if(_0x301228[_0xc8c5('0xa1')]===-0x1){return _0x301228;}var _0x171e0c=this['getAndSetVariable'](_0xc8c5('0xaf'),_0xc8c5('0xcb'));if(_0x171e0c[_0xc8c5('0xa1')]===-0x1){return _0x171e0c;}return this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0xb1'),_0x5dfcc5));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xcc')]=function(_0x1ed234){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1ed234[_0xc8c5('0x3a')]));if(!this['isConfigured'](_0x1ed234[_0xc8c5('0xcd')])){return this[_0xc8c5('0x10')]['error'](_0x1ed234,_0xc8c5('0xce'));}var _0x10254e=this[_0xc8c5('0x1c')][_0xc8c5('0x74')](this,_0x1ed234[_0xc8c5('0xcd')]);if(!_0x10254e){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x1ed234,'no\x20odbc\x20database\x20found');}if(!this[_0xc8c5('0x87')](_0x1ed234[_0xc8c5('0x30')])){return this[_0xc8c5('0x10')]['error'](_0x1ed234,_0xc8c5('0xcf'));}var _0x2cb05b=_0x1ed234['query'][_0xc8c5('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xc8c5('0x59')](_0xc8c5('0xd0'),_0x2cb05b));var _0x406b43=this[_0xc8c5('0x2c')][_0xc8c5('0x74')](this,_0x10254e,_0x2cb05b);this['createSquareDetailsReport'][_0xc8c5('0x74')](this,_0x1ed234,_0x2cb05b);if(!this['isConfigured'](_0x1ed234['variable_id'])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xd1'));}var _0x3fba98=this[_0xc8c5('0x14')]['sync'](this,_0x1ed234[_0xc8c5('0xd2')]);if(!_0x3fba98){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x1ed234,_0xc8c5('0xd3'));}var _0x5d41ad=this;_0x406b43[_0xc8c5('0xd4')](function(_0x5cf672,_0x306ab3){Object[_0xc8c5('0xd5')](_0x5cf672)[_0xc8c5('0xd4')](function(_0x2fa9fe){_0x5d41ad[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0xd6'),_0x3fba98,_0x306ab3,_0x2fa9fe),_0x5cf672[_0x2fa9fe]);});});this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')]('%s_ROWS_COUNT',_0x3fba98),_0x406b43['length']);return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util['format'](_0xc8c5('0xd7'),_0x3fba98));};AGIVertices[_0xc8c5('0x13')]['dial']=function(_0x2fa655){logger['debug'](util[_0xc8c5('0x59')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2fa655[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x2fa655[_0xc8c5('0xd8')])){return this[_0xc8c5('0x10')]['error'](_0x2fa655,_0xc8c5('0xd9'));}var _0x24214c=this[_0xc8c5('0x1e')][_0xc8c5('0x74')](this,_0x2fa655['sip_id']);if(!_0x24214c){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x2fa655,_0xc8c5('0xda'));}var _0x4eddfa=this['channel'][_0xc8c5('0x5b')]('DIAL',[util[_0xc8c5('0x59')](_0xc8c5('0xdb'),_0x24214c),_0x2fa655[_0xc8c5('0x68')],_0x2fa655[_0xc8c5('0xdc')],_0x2fa655['url']]);if(_0x4eddfa[_0xc8c5('0xa1')]===-0x1){return _0x4eddfa;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xdd'),_0xc8c5('0xde')));};AGIVertices['prototype'][_0xc8c5('0xdf')]=function(_0x4e171b){logger['info'](util['format'](_0xc8c5('0xe0'),_0x4e171b['label']));if(!this[_0xc8c5('0x87')](_0x4e171b[_0xc8c5('0x7e')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xe1'));}if(!this[_0xc8c5('0x87')](_0x4e171b[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20text\x20configured');}this[_0xc8c5('0x10')][_0xc8c5('0xe2')]=!![];this['createSquareDetailsReport'](_0x4e171b);this[_0xc8c5('0x45')](_0x4e171b['text'],'in');this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0xe3'),_0x4e171b[_0xc8c5('0x63')]));var _0x4aeaa8=this[_0xc8c5('0x7d')][_0xc8c5('0x74')](this,_0x4e171b);if(_0x4aeaa8){for(var _0x25ad35 in _0x4aeaa8){if(_0x4aeaa8[_0xc8c5('0x95')](_0x25ad35)){this['channel'][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0xe4'),_0x25ad35[_0xc8c5('0x6d')]()),_0x4aeaa8[_0x25ad35]);}}this[_0xc8c5('0x45')](_0x4aeaa8[_0xc8c5('0xe5')],_0xc8c5('0xe6'));return this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0xe7'),_0x4aeaa8[_0xc8c5('0xe5')]));}return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x4e171b,_0xc8c5('0xe8'));};AGIVertices['prototype'][_0xc8c5('0xe9')]=function(_0x5a1495){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0xea'),_0x5a1495['label']));if(!this[_0xc8c5('0x87')](_0x5a1495['ndauth_url'])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xeb'));}if(!this['isConfigured'](_0x5a1495['username'])){return this['channel']['noop'](_0xc8c5('0xec'));}if(!this[_0xc8c5('0x87')](_0x5a1495[_0xc8c5('0xed')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20password\x20configured');}if(!this[_0xc8c5('0x87')](_0x5a1495[_0xc8c5('0xee')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20text\x20configured');}this[_0xc8c5('0x10')][_0xc8c5('0xe2')]=!![];this['createSquareDetailsReport'](_0x5a1495);this[_0xc8c5('0x45')](_0x5a1495[_0xc8c5('0x63')],'in');this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xef'),_0x5a1495[_0xc8c5('0x63')]));var _0x2fbd2a=this[_0xc8c5('0x80')][_0xc8c5('0x74')](this,_0x5a1495);if(_0x2fbd2a){for(var _0x1fc713 in _0x2fbd2a){if(_0x2fbd2a[_0xc8c5('0x95')](_0x1fc713)){this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0xf0'),_0x1fc713[_0xc8c5('0x6d')]()),_0x2fbd2a[_0x1fc713]);}}this['createSquareMessage'](_0x2fbd2a[_0xc8c5('0xe5')],'out');if(_0x2fbd2a['audiofile']){this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0xf1'),_0x2fbd2a[_0xc8c5('0xf2')]));var _0x2ff07f=this['channel'][_0xc8c5('0xf3')](_0x2fbd2a[_0xc8c5('0xf2')]);try{fs[_0xc8c5('0xf4')](_0x2fbd2a[_0xc8c5('0xf2')]+'.wav');}catch(_0x419b56){logger['error'](_0x419b56);}return _0x2ff07f;}else{return this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xf5'),_0x2fbd2a[_0xc8c5('0xe5')]));}}return this[_0xc8c5('0x10')]['error'](_0x5a1495,_0xc8c5('0xf6'));};AGIVertices['prototype'][_0xc8c5('0xf7')]=function(_0x27a0c7){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0xf8'),_0x27a0c7[_0xc8c5('0x3a')]));return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xf7'));};AGIVertices[_0xc8c5('0x13')]['ext_dial']=function(_0x377893){logger['info'](util['format'](_0xc8c5('0xf9'),_0x377893['label']));var _0x58d31d='';if(_0x377893[_0xc8c5('0xfa')]){if(!this['isConfigured'](_0x377893[_0xc8c5('0xfa')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x377893,_0xc8c5('0xfb'));}else{var _0x4e5ffb=parseInt(_0x377893[_0xc8c5('0xfa')],0xa);if(isNaN(_0x4e5ffb)){_0x58d31d=_0x377893[_0xc8c5('0xfa')];}else{_0x58d31d=this[_0xc8c5('0x20')][_0xc8c5('0x74')](this,_0x377893[_0xc8c5('0xfa')]);if(!_0x58d31d){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x377893,_0xc8c5('0xfc'));}}}}else if(_0x377893[_0xc8c5('0xfd')]){_0x58d31d=_0x377893[_0xc8c5('0xfd')];}else{return this[_0xc8c5('0x10')]['error'](_0x377893,_0xc8c5('0xfb'));}var _0x4a5383=this[_0xc8c5('0x10')]['exec'](_0xc8c5('0xde'),[util[_0xc8c5('0x59')](_0xc8c5('0xfe'),_0x58d31d,_0x377893[_0xc8c5('0x4b')]),_0x377893[_0xc8c5('0x68')],_0x377893[_0xc8c5('0xdc')],_0x377893[_0xc8c5('0x66')]]);if(_0x4a5383[_0xc8c5('0xa1')]===-0x1){return _0x4a5383;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util['format'](_0xc8c5('0xdd'),'DIAL'));};AGIVertices['prototype'][_0xc8c5('0xff')]=function(_0x211cd3){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x100'),_0x211cd3['label']));return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xff'));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0xf')]=function(_0x25bebb){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x101'),_0x25bebb[_0xc8c5('0x3a')]));if(_0x25bebb['retry']===0x0){return this[_0xc8c5('0xa3')](_0x25bebb);}_0x25bebb['retry']-=0x1;if(!this[_0xc8c5('0x87')](_0x25bebb[_0xc8c5('0x102')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x25bebb,'no\x20file\x20audio\x20selected');}var _0x36c070=this[_0xc8c5('0x103')]['sync'](this,_0x25bebb[_0xc8c5('0x102')]);if(!_0x36c070){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x25bebb,_0xc8c5('0x104'));}if(!this[_0xc8c5('0x87')](_0x25bebb[_0xc8c5('0xd2')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2aad71=this['channel'][_0xc8c5('0x105')](_0x36c070,_0x25bebb[_0xc8c5('0x106')],_0x25bebb[_0xc8c5('0x107')]);var _0x188883=_0x2aad71[_0xc8c5('0xa1')]?_0x2aad71[_0xc8c5('0xa1')][_0xc8c5('0x4f')]():'';logger[_0xc8c5('0x2f')](_0xc8c5('0x108'),JSON['stringify'](_0x2aad71));if(_0x2aad71['result']===-0x1){this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x25bebb,_0x188883);return _0x2aad71;}else if(_0x2aad71[_0xc8c5('0xa0')]===_0xc8c5('0x68')){_0x2aad71[_0xc8c5('0xa1')]=_0x188883[_0xc8c5('0x9b')]>=parseInt(_0x25bebb[_0xc8c5('0x109')])?'x':'i';}else{_0x2aad71[_0xc8c5('0xa1')]=_0x188883[_0xc8c5('0x9b')]>=parseInt(_0x25bebb[_0xc8c5('0x109')])&&_0x188883['length']<=parseInt(_0x25bebb[_0xc8c5('0x107')])?'x':'i';}var _0x482c31=this[_0xc8c5('0x14')]['sync'](this,_0x25bebb['variable_id']);if(!_0x482c31){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x25bebb,_0xc8c5('0xd3'));}this[_0xc8c5('0x10')][_0xc8c5('0x9e')](_0x482c31,_0x188883);if(this[_0xc8c5('0x87')](_0x25bebb[_0xc8c5('0x10a')])){var _0x118b9d=parseInt(_0x25bebb[_0xc8c5('0x10a')],0xa);var _0x5dd233=rs[_0xc8c5('0x10b')]({'charset':'*','length':_0x118b9d});var _0x432fcc=_0x188883[_0xc8c5('0x9b')];if(_0x432fcc>0x0){if(_0x432fcc>_0x118b9d){this[_0xc8c5('0x38')]['sync'](this,_0x25bebb,_0x25bebb[_0xc8c5('0x10c')]===_0xc8c5('0x10d')?_0x5dd233+_0x188883[_0xc8c5('0x10e')](_0x118b9d):_0x188883[_0xc8c5('0x10e')](0x0,_0x432fcc-_0x118b9d)+_0x5dd233);}else{this['createSquareDetailsReport'][_0xc8c5('0x74')](this,_0x25bebb,rs[_0xc8c5('0x10b')]({'charset':'*','length':_0x432fcc}));}}else{this[_0xc8c5('0x38')]['sync'](this,_0x25bebb,'');}}else{this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x25bebb,_0x188883);}return _0x2aad71;};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x10f')]=function(_0x4c6d82){logger['info'](util[_0xc8c5('0x59')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4c6d82['label']));return this[_0xc8c5('0xf')](_0x4c6d82);};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x110')]=function(_0x4fc648){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x111'),_0x4fc648[_0xc8c5('0x3a')]));this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x4fc648,_0x4fc648[_0xc8c5('0x112')]);return this[_0xc8c5('0x10')]['noop'](util['format'](_0xc8c5('0x113'),_0x4fc648[_0xc8c5('0x112')]));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x114')]=function(_0x45777d){logger[_0xc8c5('0x2f')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x45777d[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x45777d['aws_access_key_id'])||!this[_0xc8c5('0x87')](_0x45777d[_0xc8c5('0x8b')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x115'));}if(!this[_0xc8c5('0x87')](_0x45777d[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}this[_0xc8c5('0x10')]['noop'](util['format'](_0xc8c5('0x116'),_0x45777d[_0xc8c5('0x63')]));var _0x1d1db6=this['awsPolly'][_0xc8c5('0x74')](this,_0x45777d);if(_0x1d1db6){this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0x117'),_0x1d1db6));var _0x402f31=this[_0xc8c5('0x10')][_0xc8c5('0xf3')](_0x1d1db6);try{fs[_0xc8c5('0xf4')](_0x1d1db6+'.wav');}catch(_0x5c053d){logger[_0xc8c5('0x2d')](_0x5c053d);}return _0x402f31;}return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x45777d,_0xc8c5('0x118'));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x119')]=function(_0x282af2){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x11a'),_0x282af2['label']));if(!this['isConfigured'](_0x282af2[_0xc8c5('0x8a')])||!this[_0xc8c5('0x87')](_0x282af2['aws_secret_access_key'])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0x115'));}if(!this[_0xc8c5('0x87')](_0x282af2['aws_bot_name'])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x11b'));}if(!this[_0xc8c5('0x87')](_0x282af2[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}this['channel'][_0xc8c5('0xe2')]=!![];this['createSquareDetailsReport'](_0x282af2);this[_0xc8c5('0x45')](_0x282af2['text'],'in');this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x11c'),_0x282af2['text']));var _0x282aea=this[_0xc8c5('0x8e')][_0xc8c5('0x74')](this,_0x282af2);if(_0x282aea){for(var _0x146e62 in _0x282aea){if(_0x282aea[_0xc8c5('0x95')](_0x146e62)&&_['isString'](_0x282aea[_0x146e62])){this[_0xc8c5('0x10')]['setVariable'](util[_0xc8c5('0x59')](_0xc8c5('0x11d'),_0x146e62[_0xc8c5('0x6d')]()),_0x282aea[_0x146e62]);}}if(_[_0xc8c5('0x4a')](_0x282aea[_0xc8c5('0x7a')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x11e'));}else{this[_0xc8c5('0x45')](_0x282aea[_0xc8c5('0x7a')],'out');return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x11f'),_0x282aea[_0xc8c5('0x7a')]));}}return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x282af2,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x120')]=function(_0x142348){logger['info'](util['format'](_0xc8c5('0x121'),_0x142348[_0xc8c5('0x3a')],_0x142348[_0xc8c5('0x68')]));if(!this['isConfigured'](_0x142348[_0xc8c5('0x7e')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xe1'));}var _0x3a6bf8='wav';var _0x57e7a4=util[_0xc8c5('0x59')](_0xc8c5('0x122'),FILES_PATH,rs[_0xc8c5('0x10b')](0x4));var _0x5201e0=util[_0xc8c5('0x59')]('%s.%s',_0x57e7a4,_0x3a6bf8);var _0x103622=!![];if(_0x142348[_0xc8c5('0x123')]===_0xc8c5('0x124')){_0x103622=![];}var _0x3959c6=this['channel'][_0xc8c5('0x125')](_0x57e7a4,_0x3a6bf8,_0x142348[_0xc8c5('0x126')],_0x142348[_0xc8c5('0x68')],undefined,_0x103622);if(_0x3959c6[_0xc8c5('0xa1')]!==-0x1){this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0x127'),_0x5201e0));var _0x240942=this[_0xc8c5('0x8f')][_0xc8c5('0x74')](this,_0x142348,_0x5201e0);if(_0x240942){for(var _0x263bc4 in _0x240942){if(_0x240942['hasOwnProperty'](_0x263bc4)){this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util['format'](_0xc8c5('0x128'),_0x263bc4[_0xc8c5('0x6d')]()),_0x240942[_0x263bc4]);}}return this['channel'][_0xc8c5('0xa6')](util['format'](_0xc8c5('0x129'),JSON[_0xc8c5('0x78')](_0x240942)));}}return _0x3959c6;};AGIVertices['prototype'][_0xc8c5('0x12a')]=function(_0x5cd21b){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5cd21b[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x5cd21b[_0xc8c5('0x92')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20appid\x20configured');}if(!this[_0xc8c5('0x87')](_0x5cd21b['appsecret'])){return this[_0xc8c5('0x10')]['noop']('no\x20appsecret\x20configured');}var _0x2fe533=_0xc8c5('0x12b');var _0xbd6adb=util[_0xc8c5('0x59')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x26ae0c=util[_0xc8c5('0x59')](_0xc8c5('0x9d'),_0xbd6adb,_0x2fe533);var _0x4bdc91=!![];if(_0x5cd21b[_0xc8c5('0x123')]==='NOBEEP'){_0x4bdc91=![];}var _0xd93b36=this['channel'][_0xc8c5('0x125')](_0xbd6adb,_0x2fe533,_0x5cd21b[_0xc8c5('0x126')],_0x5cd21b[_0xc8c5('0x68')],undefined,_0x4bdc91);if(_0xd93b36[_0xc8c5('0xa1')]!==-0x1){this['channel']['noop'](util[_0xc8c5('0x59')](_0xc8c5('0x12c'),_0x26ae0c));var _0x2f0441=this['tildeASR'][_0xc8c5('0x74')](this,_0x5cd21b,_0x26ae0c);if(_0x2f0441){for(var _0x5cf28e in _0x2f0441){if(_0x2f0441['hasOwnProperty'](_0x5cf28e)){this['channel'][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0x12d'),_0x5cf28e[_0xc8c5('0x6d')]()),_0x2f0441[_0x5cf28e]);}}return this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x12e'),JSON[_0xc8c5('0x78')](_0x2f0441)));}}return _0xd93b36;};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x12f')]=function(_0x11e848){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x130'),_0x11e848[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')][_0xc8c5('0x131')](_0x11e848[_0xc8c5('0x132')],_0x11e848[_0xc8c5('0x40')],_0x11e848['priority']);};AGIVertices['prototype'][_0xc8c5('0x133')]=function(_0x14073b){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x134'),_0x14073b[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x14073b[_0xc8c5('0x135')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x14073b,_0xc8c5('0x136'));}try{var _0x364b70=eval(_0x14073b[_0xc8c5('0x135')])?_0xc8c5('0x137'):_0xc8c5('0x138');this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')]('EVAL\x20CONDITION\x20%s\x20%s',_0x14073b[_0xc8c5('0x135')],_0x364b70));return{'code':0xc8,'result':_0x364b70};}catch(_0x498204){return{'code':0xc8,'result':_0xc8c5('0x138')};}};AGIVertices['prototype']['gotoiftime']=function(_0x490b26){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x139'),_0x490b26[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x490b26['interval_id'])){return this[_0xc8c5('0x10')]['error'](_0x490b26,_0xc8c5('0x13a'));}var _0x2cf644=this['getIntervals'][_0xc8c5('0x74')](this,_0x490b26[_0xc8c5('0x13b')]);if(!_0x2cf644){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x490b26,_0xc8c5('0x13c'));}for(var _0x5bbede=0x0;_0x5bbede<_0x2cf644['length'];_0x5bbede+=0x1){var _0x4218fb=this[_0xc8c5('0x10')]['getVariable'](util[_0xc8c5('0x59')]('IFTIME(%s?true:false)',_0x2cf644[_0x5bbede]));if(_0x4218fb['result']===-0x1){return _0x4218fb;}logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x13d'),_0x2cf644[_0x5bbede],_0x4218fb[_0xc8c5('0xa0')]));if(_0x4218fb[_0xc8c5('0xa0')]==='true'){logger['info'](util['format'](_0xc8c5('0x13d'),_0x2cf644[_0x5bbede],_0xc8c5('0x137')));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')]('IFTIME\x20%s\x20%s',_0x2cf644[_0x5bbede],'true'));return{'code':0xc8,'result':_0xc8c5('0x137')};}else{logger['info'](util['format'](_0xc8c5('0x13d'),_0x2cf644[_0x5bbede],_0xc8c5('0x138')));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x13d'),_0x2cf644[_0x5bbede],_0xc8c5('0x138')));}}return{'code':0xc8,'result':_0xc8c5('0x138')};};AGIVertices['prototype'][_0xc8c5('0x13e')]=function(_0xcb4209){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xcb4209['label']));return this[_0xc8c5('0x10')]['hangup']();};AGIVertices[_0xc8c5('0x13')]['ispeechasr']=function(_0x653a09){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x13f'),_0x653a09[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x653a09[_0xc8c5('0x7e')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xe1'));}var _0x291168=_0xc8c5('0x12b');var _0x93d3fb=util['format'](_0xc8c5('0x122'),FILES_PATH,rs['generate'](0x4));var _0x43df1f=util['format'](_0xc8c5('0x9d'),_0x93d3fb,_0x291168);var _0x5ad18b=!![];if(_0x653a09[_0xc8c5('0x123')]===_0xc8c5('0x124')){_0x5ad18b=![];}var _0x1062bb=this['channel'][_0xc8c5('0x125')](_0x93d3fb,_0x291168,_0x653a09['intKey'],_0x653a09[_0xc8c5('0x68')],undefined,_0x5ad18b);if(_0x1062bb[_0xc8c5('0xa1')]!==-0x1){this[_0xc8c5('0x10')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x43df1f));var _0x4c3c56=this['ispeechASR'][_0xc8c5('0x74')](this,_0x653a09,_0x43df1f);if(_0x4c3c56){for(var _0x44d269 in _0x4c3c56){if(_0x4c3c56[_0xc8c5('0x95')](_0x44d269)){this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0x140'),_0x44d269[_0xc8c5('0x6d')]()),_0x4c3c56[_0x44d269]);}}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x141'),JSON['stringify'](_0x4c3c56)));}}return _0x1062bb;};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x142')]=function(_0x1a481a){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x143'),_0x1a481a[_0xc8c5('0x3a')]));if(!this['isConfigured'](_0x1a481a[_0xc8c5('0x7e')])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xe1'));}if(!this[_0xc8c5('0x87')](_0x1a481a['text'])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')]('Trying\x20ispeech\x20TTS\x20%s',_0x1a481a[_0xc8c5('0x63')]));var _0x5126ff=this['ispeechTTS']['sync'](this,_0x1a481a);if(_0x5126ff){this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x144'),_0x5126ff));var _0x3ea5f6=this[_0xc8c5('0x10')]['streamFile'](_0x5126ff,_0x1a481a[_0xc8c5('0x126')]);try{fs[_0xc8c5('0xf4')](_0x5126ff+_0xc8c5('0x145'));}catch(_0x2e9042){logger[_0xc8c5('0x2d')](_0x2e9042);}return _0x3ea5f6;}return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x1a481a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x146')]=function(_0x5bc83e){logger[_0xc8c5('0x2f')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5bc83e[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x5bc83e[_0xc8c5('0x147')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x5bc83e,'no\x20find\x20by\x20configured');}logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x148'),this['channel'][_0xc8c5('0x3e')],_0x5bc83e['findBy']));var _0x15fe25=this['agentLogin'][_0xc8c5('0x74')](this,_0x5bc83e['findBy']);if(_0x15fe25){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this[_0xc8c5('0x10')]['callerid'],_0x5bc83e['findBy']));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this['channel'][_0xc8c5('0x3e')],_0x5bc83e[_0xc8c5('0x147')]));return{'code':0xc8,'result':_0xc8c5('0x14a')};}else{logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this['channel'][_0xc8c5('0x3e')],_0x5bc83e[_0xc8c5('0x147')]));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x5bc83e[_0xc8c5('0x147')]));return{'code':0xc8,'result':_0xc8c5('0x14c')};}};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x14d')]=function(_0x3f9020){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x14e'),_0x3f9020[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x3f9020[_0xc8c5('0x147')])){return this['channel'][_0xc8c5('0x2d')](_0x3f9020,_0xc8c5('0x14f'));}logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x148'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x3f9020[_0xc8c5('0x147')]));var _0x3bd9e0=this[_0xc8c5('0x56')][_0xc8c5('0x74')](this,_0x3f9020[_0xc8c5('0x147')]);if(_0x3bd9e0){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x3f9020[_0xc8c5('0x147')]));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x3f9020['findBy']));return{'code':0xc8,'result':_0xc8c5('0x14a')};}else{logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this[_0xc8c5('0x10')]['callerid'],_0x3f9020[_0xc8c5('0x147')]));this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this['channel'][_0xc8c5('0x3e')],_0x3f9020[_0xc8c5('0x147')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xc8c5('0x150')]=function(_0x56f912){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x151'),_0x56f912[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x56f912[_0xc8c5('0x152')])){return this['channel'][_0xc8c5('0x2d')](_0x56f912,'no\x20operation\x20configured');}this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')]('math\x20%s',_0x56f912[_0xc8c5('0x152')]));var _0x5d4891=eval(_0x56f912[_0xc8c5('0x152')]);if(!this[_0xc8c5('0x87')](_0x56f912[_0xc8c5('0xd2')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xd1'));}var _0x369e49=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x56f912[_0xc8c5('0xd2')]);if(!_0x369e49){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x56f912,_0xc8c5('0xd3'));}if(_[_0xc8c5('0x9a')](_0x5d4891)){var _0x43bb11=this;_0x5d4891['forEach'](function(_0x1b716d,_0x49b904){_0x43bb11[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')]('%s[%s]',_0x369e49,_0x49b904),_0x1b716d);});return this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')](_0xc8c5('0x153'),_0x369e49));}else{return this['channel']['setVariable'](_0x369e49,_0x5d4891);}};AGIVertices[_0xc8c5('0x13')]['menu']=function(_0x76a6ea){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x154'),_0x76a6ea[_0xc8c5('0x3a')]));if(_0x76a6ea[_0xc8c5('0x155')]===0x0){return this[_0xc8c5('0xa3')](_0x76a6ea);}_0x76a6ea[_0xc8c5('0x155')]-=0x1;if(!this[_0xc8c5('0x87')](_0x76a6ea['file_id'])){return this[_0xc8c5('0x10')]['error'](_0x76a6ea,_0xc8c5('0x156'));}var _0x34b359=this[_0xc8c5('0x103')][_0xc8c5('0x74')](this,_0x76a6ea[_0xc8c5('0x102')]);if(!_0x34b359){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x76a6ea,_0xc8c5('0x104'));}var _0x2f6485=this[_0xc8c5('0x10')][_0xc8c5('0x105')](_0x34b359,_0x76a6ea[_0xc8c5('0x106')],_0x76a6ea['digit']);var _0x51a60a=_0x2f6485['result'];if(_0x2f6485[_0xc8c5('0xa1')]===-0x1){this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x76a6ea,'-1');return _0x2f6485;}else if(_0x2f6485['extra']==='timeout'){_0x2f6485[_0xc8c5('0xa1')]=_0x2f6485[_0xc8c5('0xa1')][_0xc8c5('0x9b')]>0x0?_0x2f6485['result']:'t';}else if(_[_0xc8c5('0x47')](_0x2f6485[_0xc8c5('0xa1')])){_0x2f6485[_0xc8c5('0xa1')]='#';_0x51a60a='#';}if(!this[_0xc8c5('0x87')](_0x76a6ea[_0xc8c5('0xd2')])){this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0xd1'));}else{var _0x45c13b=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x76a6ea[_0xc8c5('0xd2')]);if(!_0x45c13b){return this['channel'][_0xc8c5('0x2d')](_0x76a6ea,'no\x20variable\x20found');}this[_0xc8c5('0x10')][_0xc8c5('0x9e')](_0x45c13b,_0x51a60a);}this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x76a6ea,_0x51a60a);return _0x2f6485;};AGIVertices['prototype']['noop']=function(_0x195d99){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x157'),_0x195d99[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0x195d99[_0xc8c5('0x158')]||_0x195d99[_0xc8c5('0x3a')]);};AGIVertices[_0xc8c5('0x13')]['pause']=function(_0x33ac90){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x159'),_0x33ac90['label']));if(!this[_0xc8c5('0x87')](_0x33ac90[_0xc8c5('0x147')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x33ac90,_0xc8c5('0x14f'));}logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x148'),this['channel'][_0xc8c5('0x3e')],_0x33ac90[_0xc8c5('0x147')]));var _0x11a93b=this[_0xc8c5('0x51')][_0xc8c5('0x74')](this,_0x33ac90[_0xc8c5('0x15a')]);var _0x243106=this[_0xc8c5('0x53')]['sync'](this,_0x33ac90['findBy'],_0x11a93b);if(_0x243106){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x33ac90[_0xc8c5('0x147')]));this['channel'][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this['channel'][_0xc8c5('0x3e')],_0x33ac90['findBy']));return{'code':0xc8,'result':_0xc8c5('0x14a')};}else{logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this['channel'][_0xc8c5('0x3e')],_0x33ac90[_0xc8c5('0x147')]));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x149'),this[_0xc8c5('0x10')]['callerid'],_0x33ac90[_0xc8c5('0x147')]));return{'code':0xc8,'result':_0xc8c5('0x14c')};}};AGIVertices[_0xc8c5('0x13')]['playback']=function(_0x6f7f37){logger['info'](util[_0xc8c5('0x59')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x6f7f37[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x6f7f37[_0xc8c5('0x102')])){return this['channel'][_0xc8c5('0x2d')](_0x6f7f37,_0xc8c5('0x156'));}var _0x2eab39=this['getSound'][_0xc8c5('0x74')](this,_0x6f7f37[_0xc8c5('0x102')]);if(!_0x2eab39){return this[_0xc8c5('0x10')]['error'](_0x6f7f37,'no\x20file\x20audio\x20found');}var _0x5c42d0=this['channel'][_0xc8c5('0x5b')](_0xc8c5('0x15b'),[_0x2eab39,_0x6f7f37[_0xc8c5('0xdc')]]);if(_0x5c42d0[_0xc8c5('0xa1')]===-0x1){return _0x5c42d0;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util['format'](_0xc8c5('0xc0'),_0xc8c5('0x15b'),_0x2eab39));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x15c')]=function(_0x173eac){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x15d'),_0x173eac[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x173eac[_0xc8c5('0x15e')])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x173eac,'no\x20queue\x20selected');}var _0x456256='';var _0x2b9379=parseInt(_0x173eac[_0xc8c5('0x15e')],0xa);if(isNaN(_0x2b9379)){_0x456256=_0x173eac[_0xc8c5('0x15e')];}else{_0x456256=this[_0xc8c5('0x19')]['sync'](this,_0x173eac[_0xc8c5('0x15e')]);if(!_0x456256){return this['channel'][_0xc8c5('0x2d')](_0x173eac,'no\x20queue\x20found');}}var _0x11afc5='';if(this[_0xc8c5('0x87')](_0x173eac[_0xc8c5('0x102')])){var _0x37995d=this[_0xc8c5('0x103')][_0xc8c5('0x74')](this,_0x173eac[_0xc8c5('0x102')]);if(_0x37995d){_0x11afc5=_0x37995d;}}this[_0xc8c5('0x38')]['sync'](this,_0x173eac,_0x456256);if(_0x173eac['opts']['indexOf']('x')<0x0){_0x173eac[_0xc8c5('0xdc')]+='x';}if(_0x173eac[_0xc8c5('0xdc')][_0xc8c5('0x15f')]('X')<0x0){_0x173eac[_0xc8c5('0xdc')]+='X';}this[_0xc8c5('0x10')][_0xc8c5('0x9e')](_0xc8c5('0x160'),_0x456256?_0x456256[_0xc8c5('0x161')]():'');var _0x3d1559=this[_0xc8c5('0x10')][_0xc8c5('0x5b')](_0xc8c5('0x162'),[_0x456256,_0x173eac['opts'],_0x173eac[_0xc8c5('0x66')],_0x11afc5,_0x173eac['timeout'],_0x173eac['agi'],_0x173eac[_0xc8c5('0x163')],_0x173eac[_0xc8c5('0x164')],'',_0x173eac[_0xc8c5('0x165')]]);if(_0x3d1559[_0xc8c5('0xa1')]===-0x1){return _0x3d1559;}return this[_0xc8c5('0x10')]['noop'](util['format'](_0xc8c5('0xc0'),_0xc8c5('0x162'),_0x456256));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x166')]=function(_0x18e549){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x18e549[_0xc8c5('0x3a')]));var _0xd75e38=_0x18e549[_0xc8c5('0x167')]||'wav';var _0x48b79c=util[_0xc8c5('0x59')](_0xc8c5('0x168'),this[_0xc8c5('0x10')][_0xc8c5('0x39')],rs[_0xc8c5('0x10b')](0x5));var _0x54a993=util[_0xc8c5('0x59')](_0xc8c5('0x169'),FILES_PATH,_0x48b79c,_0xd75e38);var _0x515403=util[_0xc8c5('0x59')](_0xc8c5('0x122'),FILES_PATH,_0x48b79c);this['createSquareRecording'][_0xc8c5('0x74')](this,_0x18e549,_0x48b79c,_0x54a993);this[_0xc8c5('0x10')][_0xc8c5('0x9e')](_0xc8c5('0x16a'),_0x48b79c);logger[_0xc8c5('0x2f')](_0xc8c5('0x16b'),_0x515403,_0xd75e38,_0x18e549['escape_digits'],_0x18e549['timeout']);return this[_0xc8c5('0x10')][_0xc8c5('0x125')](_0x515403,_0xd75e38,_0x18e549['escape_digits'],_0x18e549[_0xc8c5('0x68')],undefined,!![]);};AGIVertices[_0xc8c5('0x13')]['restapi']=function(_0x459e80){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x16c'),_0x459e80[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x459e80[_0xc8c5('0x66')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x16d'));}var _0x1aa6fb=this[_0xc8c5('0x65')][_0xc8c5('0x74')](this,_0x459e80);logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x16e'),util[_0xc8c5('0x16f')](_0x1aa6fb,{'showHidden':![],'depth':null})));if(!this[_0xc8c5('0x87')](_0x459e80['variable_id'])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x170'));}var _0x5aa7c8=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x459e80[_0xc8c5('0xd2')]);if(!_0x5aa7c8){return this[_0xc8c5('0x10')]['error'](_0x459e80,'no\x20variable\x20found');}this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util['format'](_0xc8c5('0x171'),_0x5aa7c8),_0x1aa6fb[_0xc8c5('0x79')]?_0x1aa6fb['statusCode']:_0xc8c5('0x172'));this[_0xc8c5('0x10')][_0xc8c5('0x9e')](util[_0xc8c5('0x59')](_0xc8c5('0x173'),_0x5aa7c8),_0x1aa6fb[_0xc8c5('0x174')]?_0x1aa6fb['statusMessage']:'OK');if(_0x1aa6fb[_0xc8c5('0x6e')]){try{this[_0xc8c5('0x9c')](_0x1aa6fb[_0xc8c5('0x6e')],_0x5aa7c8);}catch(_0x275bec){logger[_0xc8c5('0x2d')](util['format'](_0xc8c5('0x175'),_0x5aa7c8));}}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util['format']('variable\x20%s\x20set',_0x5aa7c8));};AGIVertices['prototype'][_0xc8c5('0x176')]=function(_0x3911f5){logger['info'](util[_0xc8c5('0x59')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3911f5[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')][_0xc8c5('0x177')](_0x3911f5[_0xc8c5('0x178')][_0xc8c5('0x5d')](/\s+/g,''),_0x3911f5[_0xc8c5('0x179')]);};AGIVertices['prototype']['saynumber']=function(_0x2410fc){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x17a'),_0x2410fc[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')][_0xc8c5('0x17b')](_0x2410fc[_0xc8c5('0x69')][_0xc8c5('0x5d')](/\s+/g,''),_0x2410fc[_0xc8c5('0x179')]);};AGIVertices[_0xc8c5('0x13')]['sayphonetic']=function(_0x2bd57c){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x17c'),_0x2bd57c[_0xc8c5('0x3a')]));return this[_0xc8c5('0x10')]['sayPhonetic'](_0x2bd57c[_0xc8c5('0x63')],_0x2bd57c[_0xc8c5('0x179')]);};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x17d')]=function(_0x5d3d6a){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x17e'),_0x5d3d6a[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x5d3d6a['account_id'])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x17f'));}var _0x14e25a=this[_0xc8c5('0x23')][_0xc8c5('0x74')](this,_0x5d3d6a['account_id']);if(!_0x14e25a||!_0x14e25a[_0xc8c5('0x180')]){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x5d3d6a,_0xc8c5('0x181'));}var _0x405360={'from':util[_0xc8c5('0x59')](_0xc8c5('0x182'),_0x14e25a['name'],_0x14e25a['email']||_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x183')]),'to':_0x5d3d6a['to']||'','cc':_0x5d3d6a['cc']||'','bcc':_0x5d3d6a[_0xc8c5('0x184')]||'','subject':_0x5d3d6a[_0xc8c5('0x185')],'html':_0x5d3d6a[_0xc8c5('0x63')],'text':_0x5d3d6a[_0xc8c5('0x63')]};var _0x4310e8={'tls':{'rejectUnauthorized':![]}};if(_0x14e25a[_0xc8c5('0x180')]['service']){_0x4310e8[_0xc8c5('0x186')]=_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x186')];}else{_0x4310e8[_0xc8c5('0x187')]=_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x187')];_0x4310e8['port']=_0x14e25a['Smtp'][_0xc8c5('0x188')];_0x4310e8[_0xc8c5('0x189')]=_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x189')];}if(_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x18a')]){_0x4310e8[_0xc8c5('0x18b')]={'user':_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x183')],'pass':_0x14e25a[_0xc8c5('0x180')][_0xc8c5('0x18c')]};}if(this[_0xc8c5('0x87')](_0x5d3d6a['template_id'])){}logger[_0xc8c5('0x18d')]('sendMail\x20message',JSON['stringify'](_0x405360));this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x5d3d6a,_0x5d3d6a[_0xc8c5('0x18e')]);this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util['format'](_0xc8c5('0x18f'),_0x14e25a['name']));this[_0xc8c5('0x190')][_0xc8c5('0x74')](this,_0x4310e8,_0x405360);return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x191'));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x192')]=function(_0xfd2117){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x193'),_0xfd2117['label']));return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x194')]=function(_0x218235){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x195'),_0x218235['label']));if(!this[_0xc8c5('0x87')](_0x218235[_0xc8c5('0x196')])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0x197'));}var _0x2e7d90=this['getSmsAccount'][_0xc8c5('0x74')](this,_0x218235['sms_account_id']);if(!_0x2e7d90){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x218235,_0xc8c5('0x198'));}var _0x957e84={'body':_0x218235['sms_text'],'phone':_0x218235['to']||'','SmsAccountId':_0x2e7d90['id']};logger[_0xc8c5('0x18d')]('sendSMS\x20message',JSON[_0xc8c5('0x78')](_0x957e84));this[_0xc8c5('0x38')]['sync'](this,_0x218235,_0x218235['sms_account_id']);this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x199'),_0x2e7d90[_0xc8c5('0x17')]));this[_0xc8c5('0x37')]['sync'](this,_0x957e84);return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x19a'));};AGIVertices[_0xc8c5('0x13')]['set']=function(_0x3eacd8){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x19b'),_0x3eacd8[_0xc8c5('0x3a')]));if(!this['isConfigured'](_0x3eacd8['variable_id'])){return this['channel']['error'](_0x3eacd8,_0xc8c5('0x19c'));}var _0x62820c=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x3eacd8['variable_id']);if(!_0x62820c){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x3eacd8,'no\x20variable\x20found');}return this[_0xc8c5('0x10')]['setVariable'](_0x62820c,_0x3eacd8[_0xc8c5('0x19d')]);};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x19e')]=function(_0x2d897e){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x19f'),_0x2d897e[_0xc8c5('0x3a')]));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x1a0'));if(_0x2d897e[_0xc8c5('0xb5')]===_0xc8c5('0x1a1')){this[_0xc8c5('0x10')][_0xc8c5('0xa6')](_0xc8c5('0x1a2'));return this[_0xc8c5('0x10')][_0xc8c5('0xb5')]();}return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0x1a3'));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1a4')]=function(_0x5afa8d){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x1a5'),_0x5afa8d[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x5afa8d['project_id'])){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x5afa8d,'no\x20subproject\x20selected');}var _0x1ec9fb=this[_0xc8c5('0x1a')]['sync'](this,_0x5afa8d[_0xc8c5('0x1a6')]);if(!this[_0xc8c5('0x87')](_0x1ec9fb)){return this['channel'][_0xc8c5('0x2d')](_0x5afa8d,util[_0xc8c5('0x59')](_0xc8c5('0x1a7'),_0x5afa8d[_0xc8c5('0x1a6')]));}if(_0x1ec9fb===this['channel'][_0xc8c5('0x3c')]){return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x5afa8d,_0xc8c5('0x1a8'));}this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x5afa8d,_0x1ec9fb);var _0x3ed093=this[_0xc8c5('0x10')]['exec']('AGI',util[_0xc8c5('0x59')](_0xc8c5('0x1a9'),config['agi'][_0xc8c5('0x187')]||_0xc8c5('0x1aa'),_0x1ec9fb,this[_0xc8c5('0x10')][_0xc8c5('0x3c')]));if(_0x3ed093[_0xc8c5('0xa1')]===-0x1){return _0x3ed093;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0xc0'),_0xc8c5('0x1ab'),_0x1ec9fb));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1ac')]=function(_0x1bee6e){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x1ad'),_0x1bee6e[_0xc8c5('0x3a')]));var _0x4991a9=this[_0xc8c5('0x1ae')][_0xc8c5('0x74')](this,_0x1bee6e[_0xc8c5('0xb3')]);this[_0xc8c5('0x38')][_0xc8c5('0x74')](this,_0x1bee6e,_0x1bee6e['command']);if(this[_0xc8c5('0x87')](_0x1bee6e[_0xc8c5('0xd2')])){var _0x3e31ad=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x1bee6e[_0xc8c5('0xd2')]);if(_0x3e31ad){this[_0xc8c5('0x10')]['setVariable'](_0x3e31ad,_0x4991a9);return this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1bee6e['command'],_0x3e31ad));}}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x1af'),_0x1bee6e[_0xc8c5('0xb3')]));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1b0')]=function(_0x43cfed){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x1b1'),_0x43cfed[_0xc8c5('0x3a')]));_0x43cfed[_0xc8c5('0x63')]=_0x43cfed[_0xc8c5('0x63')][_0xc8c5('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc8c5('0x87')](_0x43cfed[_0xc8c5('0x5f')])){return this[_0xc8c5('0x10')]['noop'](_0xc8c5('0x1b2'));}if(!this[_0xc8c5('0x87')](_0x43cfed[_0xc8c5('0x63')])){return this[_0xc8c5('0x10')][_0xc8c5('0xa6')]('no\x20text\x20configured');}this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x1b3'),_0x43cfed[_0xc8c5('0x63')]));var _0xc3fe94=this[_0xc8c5('0x5e')][_0xc8c5('0x74')](this,_0x43cfed);if(_0xc3fe94){this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x1b4'),_0xc3fe94));var _0xd7fd6e=this['channel'][_0xc8c5('0xf3')](_0xc3fe94);try{fs[_0xc8c5('0xf4')](_0xc3fe94+_0xc8c5('0x145'));}catch(_0xaff968){logger['error'](_0xaff968);}return _0xd7fd6e;}return this[_0xc8c5('0x10')][_0xc8c5('0x2d')](_0x43cfed,_0xc8c5('0x1b5'));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1b6')]=function(_0x2c2b9f){logger['info'](util[_0xc8c5('0x59')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2c2b9f[_0xc8c5('0x3a')]));_0x2c2b9f[_0xc8c5('0x63')]=_0x2c2b9f['text'][_0xc8c5('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2c2b9f[_0xc8c5('0x63')])){return this['channel'][_0xc8c5('0xa6')](_0xc8c5('0xa7'));}this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x1b7'),_0x2c2b9f[_0xc8c5('0x63')]));var _0x782567=this[_0xc8c5('0x1b8')][_0xc8c5('0x74')](this,_0x2c2b9f);if(_0x782567){this[_0xc8c5('0x10')]['noop'](util[_0xc8c5('0x59')]('Google\x20TTS\x20%s\x20file\x20created',_0x782567));var _0xee6c34=this[_0xc8c5('0x10')][_0xc8c5('0xf3')](_0x782567);try{fs[_0xc8c5('0xf4')](_0x782567+_0xc8c5('0x145'));}catch(_0x20e89c){logger['error'](_0x20e89c);}return _0xee6c34;}return this['channel'][_0xc8c5('0x2d')](_0x2c2b9f,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xc8c5('0x1b9')]=function(_0x5c0669){logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x1ba'),_0x5c0669['label']));if(!this[_0xc8c5('0x87')](_0x5c0669[_0xc8c5('0x147')])){return this[_0xc8c5('0x10')]['error'](_0x5c0669,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0xc8c5('0x148'),this[_0xc8c5('0x10')]['callerid'],_0x5c0669['findBy']));var _0x41f9a2=this[_0xc8c5('0x54')][_0xc8c5('0x74')](this,_0x5c0669[_0xc8c5('0x147')]);if(_0x41f9a2){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x149'),this['channel'][_0xc8c5('0x3e')],_0x5c0669['findBy']));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x5c0669[_0xc8c5('0x147')]));return{'code':0xc8,'result':_0xc8c5('0x14a')};}else{logger['info'](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x5c0669[_0xc8c5('0x147')]));this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')](_0xc8c5('0x14b'),this[_0xc8c5('0x10')][_0xc8c5('0x3e')],_0x5c0669[_0xc8c5('0x147')]));return{'code':0xc8,'result':_0xc8c5('0x14c')};}};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1bb')]=function(_0x2b9523){logger[_0xc8c5('0x2f')](util[_0xc8c5('0x59')](_0xc8c5('0x1bc'),_0x2b9523[_0xc8c5('0x3a')]));var _0x360cc5=this[_0xc8c5('0x10')][_0xc8c5('0x5b')](_0xc8c5('0x1bd'),[_0x2b9523[_0xc8c5('0x1be')],_0x2b9523[_0xc8c5('0x7c')]]);if(_0x360cc5[_0xc8c5('0xa1')]===-0x1){return _0x360cc5;}return this[_0xc8c5('0x10')][_0xc8c5('0xa6')](util[_0xc8c5('0x59')]('Executed\x20command\x20%s\x20%s',_0xc8c5('0x1bd'),_0x2b9523[_0xc8c5('0x1be')]));};AGIVertices[_0xc8c5('0x13')][_0xc8c5('0x1bf')]=function(_0x51309f){logger[_0xc8c5('0x2f')](util['format'](_0xc8c5('0x1c0'),_0x51309f[_0xc8c5('0x3a')]));if(!this[_0xc8c5('0x87')](_0x51309f[_0xc8c5('0xd2')])){return this[_0xc8c5('0x10')]['error'](_0x51309f,_0xc8c5('0x19c'));}var _0x5a8311=this[_0xc8c5('0x14')][_0xc8c5('0x74')](this,_0x51309f[_0xc8c5('0xd2')]);if(!_0x5a8311){return this[_0xc8c5('0x10')]['error'](_0x51309f,'no\x20variable\x20found');}var _0x1f0d66=this[_0xc8c5('0x10')][_0xc8c5('0x14')](_0x5a8311);return{'code':0xc8,'result':_0x1f0d66[_0xc8c5('0xa0')]?_0x1f0d66[_0xc8c5('0xa0')]:'-'};};String[_0xc8c5('0x13')]['replaceAll']=function(_0x115eed,_0x5dcc2){return this[_0xc8c5('0x9f')](_0x115eed)[_0xc8c5('0x1c1')](_0x5dcc2);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7c8fb89..f4d652b 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 _0x425d=['syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','name','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','message','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x425d,0x1e0));var _0xd425=function(_0x338523,_0x43deb7){_0x338523=_0x338523-0x0;var _0x4aa8ad=_0x425d[_0x338523];return _0x4aa8ad;};'use strict';var util=require(_0xd425('0x0'));var _=require('lodash');var moment=require(_0xd425('0x1'));var ami=require(_0xd425('0x2'));var logger=require(_0xd425('0x3'))(_0xd425('0x4'));var RpcUser=require(_0xd425('0x5'));var RpcVoiceAgentReport=require(_0xd425('0x6'));function Acw(_0x47043f){this['voiceQueues']=_0x47043f[_0xd425('0x7')];this[_0xd425('0x8')]=_0x47043f[_0xd425('0x8')];this[_0xd425('0x9')]=_0x47043f[_0xd425('0x9')];this[_0xd425('0xa')]={};ami['on']('agentconnect',this[_0xd425('0xb')][_0xd425('0xc')](this));ami['on'](_0xd425('0xd'),this[_0xd425('0xe')][_0xd425('0xc')](this));ami['on'](_0xd425('0xf'),this[_0xd425('0x10')][_0xd425('0xc')](this));ami['on'](_0xd425('0x11'),this[_0xd425('0x12')][_0xd425('0xc')](this));ami['on'](_0xd425('0x13'),this[_0xd425('0x14')][_0xd425('0xc')](this));ami['on'](_0xd425('0x15'),this[_0xd425('0x16')][_0xd425('0xc')](this));ami['on'](_0xd425('0x17'),this[_0xd425('0x18')][_0xd425('0xc')](this));}function getDiff(_0x51263f){var _0x27318c=moment()[_0xd425('0x19')](0x0);var _0x336dc3=moment(_0x51263f)['milliseconds'](0x0);return _0x27318c[_0xd425('0x1a')](_0x336dc3,_0xd425('0x1b'));}Acw[_0xd425('0x1c')][_0xd425('0x1d')]=function(_0x1fc822){try{var _0x538a0a=this;var _0x278626=this[_0xd425('0xa')][_0x1fc822][_0xd425('0x1e')];var _0x5dda0c=this['channels'][_0x1fc822][_0xd425('0x1f')];var _0x434d97=this[_0xd425('0x7')][_0x5dda0c];var _0x1155bc=![];var _0x4e88fa='ACW';if(_0x434d97['mandatoryDisposition']){if(_0x434d97['mandatoryDispositionPause'][_0xd425('0x20')]){_0x1155bc=!![];_0x4e88fa=_0x434d97[_0xd425('0x21')][_0xd425('0x20')];}}ami['Action']({'action':_0xd425('0x22'),'interface':_0x278626,'paused':!![],'reason':_0x4e88fa})[_0xd425('0x23')](function(_0x5f1e7e){if(_0x538a0a[_0xd425('0x8')][_0x278626]){return RpcUser[_0xd425('0x24')](_0x538a0a[_0xd425('0x8')][_0x278626]['id'])[_0xd425('0x23')](function(_0x3e93db){if(_0x3e93db&&!_0x3e93db[_0xd425('0x25')]){logger[_0xd425('0x26')](_0xd425('0x27'),_0x1fc822,_0x278626,_0x5dda0c);var _0x314201=_0x538a0a[_0xd425('0xa')][_0x1fc822][_0xd425('0x28')]&&_0x538a0a[_0xd425('0xa')][_0x1fc822]['destlinkedid']?_0x538a0a[_0xd425('0xa')][_0x1fc822][_0xd425('0x29')]:_0x1fc822;return RpcUser[_0xd425('0x2a')](_0x538a0a[_0xd425('0x8')][_0x278626],_0x4e88fa,_0x314201)[_0xd425('0x23')](function(_0x400dd7){if(!_0x1155bc){_0x538a0a[_0xd425('0x9')][_0x278626]={};logger['info'](_0xd425('0x2b'),_0x1fc822,_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')],_0x278626,_0x5dda0c);_0x538a0a['timers'][_0x278626][_0xd425('0x2d')]=setTimeout(_0x538a0a[_0xd425('0x2e')][_0xd425('0xc')](_0x538a0a,_0x278626),_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')]*0x3e8);_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2f')]=moment()[_0xd425('0x30')](_0xd425('0x31'));_0x538a0a[_0xd425('0x9')][_0x278626]['uniqueid']=_0x1fc822;_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x1f')]=_0x5dda0c;_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x32')]=function(){var _0x3275b1=getDiff(_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2f')]);clearTimeout(_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2d')]);_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3275b1},_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x33')],_0x278626)[_0xd425('0x23')](function(_0x21e0bd){logger[_0xd425('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x1fc822,_0x3275b1,_0x21e0bd);})[_0xd425('0x34')](function(_0x3badcc){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1fc822,_0x3badcc);});delete _0x538a0a['timers'][_0x278626];};}});}else{logger[_0xd425('0x26')](_0xd425('0x35'),_0x1fc822,_0x278626,_0x5dda0c);}});}})[_0xd425('0x34')](function(_0x2d586f){logger['error'](_0xd425('0x2b'),_0x1fc822,_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')],_0x278626,_0x5dda0c);})[_0xd425('0x36')](function(){delete _0x538a0a[_0xd425('0xa')][_0x1fc822];});}catch(_0x1e12f2){logger[_0xd425('0x37')]('[ACW][START]\x20%s',_0x1e12f2[_0xd425('0x38')]);}};Acw['prototype'][_0xd425('0x2e')]=function(_0x29cca9){try{var _0x36c8da=this;if(_0x36c8da['timers'][_0x29cca9]){_0x36c8da[_0xd425('0x9')][_0x29cca9][_0xd425('0x2d')]=![];var _0xbbb05f=_0x36c8da[_0xd425('0x9')][_0x29cca9]['uniqueid'];var _0x1d38fa=_0x36c8da[_0xd425('0x9')][_0x29cca9]['queue'];var _0x5d310e=_0x36c8da['voiceQueues'][_0x1d38fa][_0xd425('0x2c')];logger[_0xd425('0x26')](_0xd425('0x39'),_0x29cca9);RpcUser['saveUnpause'](this['agents'][_0x29cca9]);RpcVoiceAgentReport['update']({'acwtime':_0x5d310e,'agentacw':!![]},_0xbbb05f,_0x29cca9)[_0xd425('0x23')](function(_0x3f9090){logger[_0xd425('0x26')](_0xd425('0x3a'),_0xbbb05f,_0x5d310e,_0x3f9090);})[_0xd425('0x34')](function(_0x14f3be){logger[_0xd425('0x37')]('[%s][UPDATE][ERRORS:%s]',_0xbbb05f,_0x14f3be);});}else{logger[_0xd425('0x37')](_0xd425('0x3b'),_0x29cca9);if(_0x36c8da[_0xd425('0x9')]){logger['info'](_0xd425('0x3c'),JSON[_0xd425('0x3d')](_0x36c8da[_0xd425('0x9')]));}}}catch(_0x5dc4c4){logger[_0xd425('0x37')](_0xd425('0x3e'),_0x5dc4c4[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')]['syncAgentConnect']=function(_0x1e9be2){try{if(this[_0xd425('0x7')][_0x1e9be2[_0xd425('0x1f')]]&&(this[_0xd425('0x7')][_0x1e9be2[_0xd425('0x1f')]][_0xd425('0x4')]||this[_0xd425('0x7')][_0x1e9be2['queue']][_0xd425('0x3f')])){if(this[_0xd425('0x8')][_0x1e9be2['interface']]){this[_0xd425('0xa')][_0x1e9be2['uniqueid']]={'queue':_0x1e9be2['queue'],'interface':_0x1e9be2[_0xd425('0x1e')],'destlinkedid':_0x1e9be2['destlinkedid']};}}}catch(_0x1be60a){logger['error'](_0xd425('0x40'),_0x1be60a[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0x18')]=function(_0x4420d2){try{if(this['voiceQueues'][_0x4420d2[_0xd425('0x1f')]]&&(this['voiceQueues'][_0x4420d2[_0xd425('0x1f')]]['acw']||this[_0xd425('0x7')][_0x4420d2[_0xd425('0x1f')]][_0xd425('0x3f')])){if(this[_0xd425('0x8')][_0x4420d2[_0xd425('0x1e')]]){this['channels'][_0x4420d2[_0xd425('0x33')]]={'queue':_0x4420d2[_0xd425('0x1f')],'interface':_0x4420d2[_0xd425('0x1e')]};}}}catch(_0x4091a7){logger[_0xd425('0x37')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4091a7[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0xe')]=function(_0x2a2ab4){try{if(this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x33')]]&&_['isUndefined'](this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x33')]]['attended'])){logger[_0xd425('0x26')](_0xd425('0x41'),_0x2a2ab4[_0xd425('0x33')]);this[_0xd425('0x1d')](_0x2a2ab4['uniqueid']);}else if(this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x42')]]&&_[_0xd425('0x43')](this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x42')]]['attended'])){logger['info'](_0xd425('0x44'),_0x2a2ab4['linkedid']);this[_0xd425('0x1d')](_0x2a2ab4[_0xd425('0x42')]);}}catch(_0x5594f9){logger[_0xd425('0x37')]('[ACW][syncHangupRequest]\x20%s',_0x5594f9['message']);}};Acw[_0xd425('0x1c')][_0xd425('0x10')]=function(_0xe6451f){try{if(this[_0xd425('0xa')][_0xe6451f[_0xd425('0x33')]]&&this[_0xd425('0xa')][_0xe6451f[_0xd425('0x33')]][_0xd425('0x28')]){logger['info'](_0xd425('0x45'),_0xe6451f[_0xd425('0x33')]);this[_0xd425('0x1d')](_0xe6451f[_0xd425('0x33')]);}else if(this[_0xd425('0xa')][_0xe6451f[_0xd425('0x42')]]&&this[_0xd425('0xa')][_0xe6451f[_0xd425('0x42')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xe6451f[_0xd425('0x42')]);this[_0xd425('0x1d')](_0xe6451f[_0xd425('0x42')]);}}catch(_0x3c6b49){logger['error']('[ACW][syncHangup]\x20%s',_0x3c6b49['message']);}};Acw['prototype'][_0xd425('0x14')]=function(_0x44c5e4){try{if(!_['isNil'](this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x46')]])){this[_0xd425('0x1d')](_0x44c5e4['transfereeuniqueid']);if(this['channels'][_0x44c5e4[_0xd425('0x47')]]){this['channels'][_0x44c5e4['secondtransfereruniqueid']]['attended']=!![];this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x48')]]=this[_0xd425('0xa')][_0x44c5e4['secondtransfereruniqueid']];delete this[_0xd425('0xa')][_0x44c5e4['secondtransfereruniqueid']];}}else if(!_[_0xd425('0x49')](this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x48')]])){this[_0xd425('0x1d')](_0x44c5e4[_0xd425('0x48')]);if(this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]]){this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]]['attended']=!![];this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x46')]]=this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]];delete this['channels'][_0x44c5e4['origtransfereruniqueid']];}}}catch(_0x307e9a){logger[_0xd425('0x37')](_0xd425('0x4b'),_0x307e9a[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0x16')]=function(_0x28d1ec){try{if(this[_0xd425('0xa')][_0x28d1ec[_0xd425('0x4c')]]){logger[_0xd425('0x26')](_0xd425('0x4d'),JSON[_0xd425('0x3d')](_0x28d1ec[_0xd425('0x4c')]));this[_0xd425('0x1d')](_0x28d1ec['transfereruniqueid']);}else if(this[_0xd425('0xa')][_0x28d1ec[_0xd425('0x4e')]]){logger[_0xd425('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x28d1ec['transfererlinkedid']));this[_0xd425('0x1d')](_0x28d1ec[_0xd425('0x4e')]);}}catch(_0x27c60e){logger['error'](_0xd425('0x4f'),_0x27c60e['message']);}};Acw[_0xd425('0x1c')][_0xd425('0x12')]=function(_0x21d26e){try{if(this['voiceQueues'][_0x21d26e[_0xd425('0x1f')]]&&this[_0xd425('0x7')][_0x21d26e[_0xd425('0x1f')]][_0xd425('0x50')]===_0xd425('0x51')){if(this[_0xd425('0x8')][_0x21d26e[_0xd425('0x1e')]]){logger[_0xd425('0x26')](_0xd425('0x52'),_0x21d26e[_0xd425('0x33')],_0x21d26e[_0xd425('0x1e')],_0x21d26e[_0xd425('0x1f')]);return RpcUser[_0xd425('0x2a')](this[_0xd425('0x8')][_0x21d26e[_0xd425('0x1e')]],_0xd425('0x53'),_0x21d26e[_0xd425('0x33')]);}}}catch(_0x25cae6){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x25cae6[_0xd425('0x38')]);}};module['exports']=Acw; \ No newline at end of file +var _0x8ef6=['milliseconds','diff','seconds','prototype','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview'];(function(_0x38a211,_0x1c21ff){var _0x78f594=function(_0x2cd0f3){while(--_0x2cd0f3){_0x38a211['push'](_0x38a211['shift']());}};_0x78f594(++_0x1c21ff);}(_0x8ef6,0xf2));var _0x68ef=function(_0x42cff6,_0x379237){_0x42cff6=_0x42cff6-0x0;var _0x23997b=_0x8ef6[_0x42cff6];return _0x23997b;};'use strict';var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var ami=require(_0x68ef('0x3'));var logger=require(_0x68ef('0x4'))(_0x68ef('0x5'));var RpcUser=require(_0x68ef('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x27d0af){this[_0x68ef('0x7')]=_0x27d0af[_0x68ef('0x7')];this[_0x68ef('0x8')]=_0x27d0af['agents'];this['timers']=_0x27d0af[_0x68ef('0x9')];this[_0x68ef('0xa')]={};ami['on'](_0x68ef('0xb'),this['syncAgentConnect'][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xd'),this[_0x68ef('0xe')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xf'),this[_0x68ef('0x10')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x11'),this[_0x68ef('0x12')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x13'),this[_0x68ef('0x14')]['bind'](this));ami['on'](_0x68ef('0x15'),this[_0x68ef('0x16')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x17'),this[_0x68ef('0x18')][_0x68ef('0xc')](this));}function getDiff(_0x508671){var _0x3b48dd=moment()[_0x68ef('0x19')](0x0);var _0x2657c5=moment(_0x508671)['milliseconds'](0x0);return _0x3b48dd[_0x68ef('0x1a')](_0x2657c5,_0x68ef('0x1b'));}Acw[_0x68ef('0x1c')]['startAcw']=function(_0x35493d){try{var _0x37c4cc=this;var _0x3d1e90=this[_0x68ef('0xa')][_0x35493d]['interface'];var _0x2ada1c=this['channels'][_0x35493d]['queue'];var _0x2633c1=this[_0x68ef('0x7')][_0x2ada1c];var _0x4ade0d=![];var _0x527870=_0x68ef('0x1d');if(_0x2633c1[_0x68ef('0x1e')]){if(_0x2633c1[_0x68ef('0x1f')]['name']){_0x4ade0d=!![];_0x527870=_0x2633c1[_0x68ef('0x1f')][_0x68ef('0x20')];}}ami[_0x68ef('0x21')]({'action':'QueuePause','interface':_0x3d1e90,'paused':!![],'reason':_0x527870})[_0x68ef('0x22')](function(_0x3be4c0){if(_0x37c4cc['agents'][_0x3d1e90]){return RpcUser[_0x68ef('0x23')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90]['id'])[_0x68ef('0x22')](function(_0x5ddec7){if(_0x5ddec7&&!_0x5ddec7['voicePause']){logger['info'](_0x68ef('0x24'),_0x35493d,_0x3d1e90,_0x2ada1c);var _0x2023f2=_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x25')]&&_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]?_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]:_0x35493d;return RpcUser[_0x68ef('0x27')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90],_0x527870,_0x2023f2)['then'](function(_0x178460){if(!_0x4ade0d){_0x37c4cc['timers'][_0x3d1e90]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')],_0x3d1e90,_0x2ada1c);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]=setTimeout(_0x37c4cc['stopAcw']['bind'](_0x37c4cc,_0x3d1e90),_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')]*0x3e8);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2a')]=moment()[_0x68ef('0x2b')](_0x68ef('0x2c'));_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2d')]=_0x35493d;_0x37c4cc['timers'][_0x3d1e90][_0x68ef('0x2e')]=_0x2ada1c;_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2f')]=function(){var _0x4c25aa=getDiff(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['lastPauseAt']);clearTimeout(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]);_0x37c4cc['timers'][_0x3d1e90]['timer']=![];RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x4c25aa},_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['uniqueid'],_0x3d1e90)[_0x68ef('0x22')](function(_0x8c0a06){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0x35493d,_0x4c25aa,_0x8c0a06);})['catch'](function(_0x2c8bd0){logger[_0x68ef('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x35493d,_0x2c8bd0);});delete _0x37c4cc[_0x68ef('0x9')][_0x3d1e90];};}});}else{logger['info'](_0x68ef('0x34'),_0x35493d,_0x3d1e90,_0x2ada1c);}});}})[_0x68ef('0x35')](function(_0x4973c2){logger[_0x68ef('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c]['acwTimeout'],_0x3d1e90,_0x2ada1c);})[_0x68ef('0x36')](function(){delete _0x37c4cc[_0x68ef('0xa')][_0x35493d];});}catch(_0x798276){logger['error'](_0x68ef('0x37'),_0x798276['message']);}};Acw[_0x68ef('0x1c')]['stopAcw']=function(_0x474ffa){try{var _0x362ef1=this;if(_0x362ef1[_0x68ef('0x9')][_0x474ffa]){_0x362ef1[_0x68ef('0x9')][_0x474ffa][_0x68ef('0x29')]=![];var _0xefd1d=_0x362ef1['timers'][_0x474ffa][_0x68ef('0x2d')];var _0x15a6ab=_0x362ef1[_0x68ef('0x9')][_0x474ffa]['queue'];var _0x32eddd=_0x362ef1[_0x68ef('0x7')][_0x15a6ab][_0x68ef('0x28')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x474ffa);RpcUser[_0x68ef('0x38')](this[_0x68ef('0x8')][_0x474ffa]);RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x32eddd,'agentacw':!![]},_0xefd1d,_0x474ffa)[_0x68ef('0x22')](function(_0x401459){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0xefd1d,_0x32eddd,_0x401459);})['catch'](function(_0xaf7df1){logger[_0x68ef('0x33')](_0x68ef('0x39'),_0xefd1d,_0xaf7df1);});}else{logger[_0x68ef('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x474ffa);if(_0x362ef1[_0x68ef('0x9')]){logger[_0x68ef('0x31')](_0x68ef('0x3a'),JSON[_0x68ef('0x3b')](_0x362ef1[_0x68ef('0x9')]));}}}catch(_0x3b00ea){logger['error'](_0x68ef('0x3c'),_0x3b00ea[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x3e')]=function(_0x449f3c){try{if(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]&&(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]['acw']||this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x449f3c[_0x68ef('0x3f')]]){this[_0x68ef('0xa')][_0x449f3c[_0x68ef('0x2d')]]={'queue':_0x449f3c['queue'],'interface':_0x449f3c[_0x68ef('0x3f')],'destlinkedid':_0x449f3c['destlinkedid']};}}}catch(_0x13c088){logger[_0x68ef('0x33')](_0x68ef('0x40'),_0x13c088[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x18')]=function(_0x5a8231){try{if(this[_0x68ef('0x7')][_0x5a8231['queue']]&&(this[_0x68ef('0x7')][_0x5a8231[_0x68ef('0x2e')]][_0x68ef('0x5')]||this['voiceQueues'][_0x5a8231['queue']][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x5a8231['interface']]){this['channels'][_0x5a8231['uniqueid']]={'queue':_0x5a8231[_0x68ef('0x2e')],'interface':_0x5a8231[_0x68ef('0x3f')]};}}}catch(_0x173fb7){logger[_0x68ef('0x33')](_0x68ef('0x41'),_0x173fb7['message']);}};Acw['prototype'][_0x68ef('0xe')]=function(_0x21f064){try{if(this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]]&&_['isUndefined'](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]][_0x68ef('0x25')])){logger[_0x68ef('0x31')]('[%s][HANGUP:UNIQUEID]',_0x21f064['uniqueid']);this[_0x68ef('0x42')](_0x21f064[_0x68ef('0x2d')]);}else if(this['channels'][_0x21f064[_0x68ef('0x43')]]&&_[_0x68ef('0x44')](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x43')]][_0x68ef('0x25')])){logger['info'](_0x68ef('0x45'),_0x21f064[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x21f064['linkedid']);}}catch(_0x8ef51b){logger[_0x68ef('0x33')](_0x68ef('0x46'),_0x8ef51b['message']);}};Acw[_0x68ef('0x1c')]['syncHangup']=function(_0x574573){try{if(this[_0x68ef('0xa')][_0x574573['uniqueid']]&&this[_0x68ef('0xa')][_0x574573[_0x68ef('0x2d')]][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x47'),_0x574573[_0x68ef('0x2d')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x2d')]);}else if(this[_0x68ef('0xa')][_0x574573[_0x68ef('0x43')]]&&this['channels'][_0x574573['linkedid']][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x48'),_0x574573[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x43')]);}}catch(_0x15400c){logger[_0x68ef('0x33')](_0x68ef('0x49'),_0x15400c['message']);}};Acw['prototype'][_0x68ef('0x14')]=function(_0x5781c8){try{if(!_[_0x68ef('0x4a')](this['channels'][_0x5781c8[_0x68ef('0x4b')]])){this[_0x68ef('0x42')](_0x5781c8['transfereeuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']]){this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]]=this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']];delete this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]];}}else if(!_[_0x68ef('0x4a')](this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]])){this[_0x68ef('0x42')](_0x5781c8['transfertargetuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4e')]]){this['channels'][_0x5781c8[_0x68ef('0x4e')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8['transfereeuniqueid']]=this[_0x68ef('0xa')][_0x5781c8['origtransfereruniqueid']];delete this['channels'][_0x5781c8[_0x68ef('0x4e')]];}}}catch(_0x540da5){logger[_0x68ef('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x540da5[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x16')]=function(_0x3fbd39){try{if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x4f')]]){logger['info'](_0x68ef('0x50'),JSON['stringify'](_0x3fbd39[_0x68ef('0x4f')]));this['startAcw'](_0x3fbd39[_0x68ef('0x4f')]);}else if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x51')]]){logger[_0x68ef('0x31')](_0x68ef('0x52'),JSON[_0x68ef('0x3b')](_0x3fbd39[_0x68ef('0x51')]));this['startAcw'](_0x3fbd39[_0x68ef('0x51')]);}}catch(_0x11bab3){logger[_0x68ef('0x33')](_0x68ef('0x53'),_0x11bab3[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x12')]=function(_0x561e8d){try{if(this[_0x68ef('0x7')][_0x561e8d['queue']]&&this['voiceQueues'][_0x561e8d[_0x68ef('0x2e')]][_0x68ef('0x54')]===_0x68ef('0x55')){if(this[_0x68ef('0x8')][_0x561e8d['interface']]){logger[_0x68ef('0x31')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x561e8d[_0x68ef('0x2d')],_0x561e8d[_0x68ef('0x3f')],_0x561e8d[_0x68ef('0x2e')]);return RpcUser['savePause'](this['agents'][_0x561e8d[_0x68ef('0x3f')]],_0x68ef('0x56'),_0x561e8d[_0x68ef('0x2d')]);}}}catch(_0x454c6f){logger['error'](_0x68ef('0x57'),_0x454c6f[_0x68ef('0x3d')]);}};module[_0x68ef('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index deb2d5c..4b6420e 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 _0x747f=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted'];(function(_0x452c06,_0x2d6a45){var _0x3c4e54=function(_0x4ad95c){while(--_0x4ad95c){_0x452c06['push'](_0x452c06['shift']());}};_0x3c4e54(++_0x2d6a45);}(_0x747f,0x1e5));var _0xf747=function(_0x10fb09,_0x4a6958){_0x10fb09=_0x10fb09-0x0;var _0xb26b0f=_0x747f[_0x10fb09];return _0xb26b0f;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xf747('0x0'));var moment=require(_0xf747('0x1'));var util=require(_0xf747('0x2'));var _=require(_0xf747('0x3'));var logger=require(_0xf747('0x4'))(_0xf747('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xf747('0x6')]['port'],config[_0xf747('0x6')]['ip'],config[_0xf747('0x6')]['username'],config[_0xf747('0x6')][_0xf747('0x7')],!![]);ami[_0xf747('0x8')]();ami[_0xf747('0x9')]=BPromise[_0xf747('0xa')](ami['action']);function error(_0x2a91cb){logger[_0xf747('0xb')](util[_0xf747('0xc')](_0xf747('0xd'),config['asterisk'][_0xf747('0xe')],config[_0xf747('0x6')]['ip'],config[_0xf747('0x6')][_0xf747('0xf')],util[_0xf747('0x10')](_0x2a91cb,![],null)));}function close(){logger['error'](util['format'](_0xf747('0x11'),config['asterisk']['username'],config[_0xf747('0x6')]['ip'],config[_0xf747('0x6')][_0xf747('0xf')]));}ami[_0xf747('0x12')]=function(){return function(){return ami[_0xf747('0x9')]({'action':_0xf747('0x13')});};};ami[_0xf747('0x14')]=function(){return function(){return ami[_0xf747('0x9')]({'action':_0xf747('0x15')});};};ami[_0xf747('0x16')]=function(){return function(){return ami[_0xf747('0x9')]({'action':_0xf747('0x17')});};};ami[_0xf747('0x18')]=function(){return function(){return ami[_0xf747('0x9')]({'action':_0xf747('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xf747('0x9')]({'action':'coreshowchannels'});};};function connect(_0x24c271){logger['info'](util['format'](_0xf747('0x1a'),config['asterisk'][_0xf747('0xe')],config[_0xf747('0x6')]['ip'],config['asterisk'][_0xf747('0xf')]));ami[_0xf747('0x1b')]('error',error);ami[_0xf747('0x1b')](_0xf747('0x1c'),close);}ami['on'](_0xf747('0x1d'),connect);ami['on']('shutdown',function(_0x549ea2){logger[_0xf747('0x1e')](util[_0xf747('0xc')](_0xf747('0x1f'),config['asterisk'][_0xf747('0xe')],config[_0xf747('0x6')]['ip'],config[_0xf747('0x6')][_0xf747('0xf')],util[_0xf747('0x10')](_0x549ea2,![],null)));});ami['on'](_0xf747('0x20'),function(_0x45d1aa){logger['info'](util[_0xf747('0xc')](_0xf747('0x21'),config[_0xf747('0x6')]['username'],config['asterisk']['ip'],config[_0xf747('0x6')][_0xf747('0xf')]));return BPromise[_0xf747('0x22')]()['then'](ami[_0xf747('0x12')]())[_0xf747('0x23')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())[_0xf747('0x23')](ami[_0xf747('0x18')]())[_0xf747('0x23')](ami['actionCoreShowChannels']())['catch'](function(_0x261861){console[_0xf747('0x24')](_0x261861);});});ami[_0xf747('0x1b')](_0xf747('0xb'),error);ami[_0xf747('0x1b')](_0xf747('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0x67c1=['action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','actionCoreShowChannels','catch','log','close','exports','asterisk-manager','bluebird','moment','util','../../config/logger','../../config/environment','asterisk','port','username','password','Action','promisify'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x67c1,0xfe));var _0x167c=function(_0x406e21,_0x3fcd21){_0x406e21=_0x406e21-0x0;var _0x3d6ef2=_0x67c1[_0x406e21];return _0x3d6ef2;};'use strict';var Manager=require(_0x167c('0x0'));var BPromise=require(_0x167c('0x1'));var moment=require(_0x167c('0x2'));var util=require(_0x167c('0x3'));var _=require('lodash');var logger=require(_0x167c('0x4'))('ami');var config=require(_0x167c('0x5'));var ami=new Manager(config[_0x167c('0x6')][_0x167c('0x7')],config['asterisk']['ip'],config[_0x167c('0x6')][_0x167c('0x8')],config[_0x167c('0x6')][_0x167c('0x9')],!![]);ami['keepConnected']();ami[_0x167c('0xa')]=BPromise[_0x167c('0xb')](ami[_0x167c('0xc')]);function error(_0x21b218){logger['error'](util[_0x167c('0xd')](_0x167c('0xe'),config[_0x167c('0x6')][_0x167c('0x8')],config['asterisk']['ip'],config[_0x167c('0x6')][_0x167c('0x7')],util[_0x167c('0xf')](_0x21b218,![],null)));}function close(){logger[_0x167c('0x10')](util['format'](_0x167c('0x11'),config[_0x167c('0x6')][_0x167c('0x8')],config[_0x167c('0x6')]['ip'],config['asterisk']['port']));}ami[_0x167c('0x12')]=function(){return function(){return ami[_0x167c('0xa')]({'action':_0x167c('0x13')});};};ami[_0x167c('0x14')]=function(){return function(){return ami[_0x167c('0xa')]({'action':_0x167c('0x15')});};};ami[_0x167c('0x16')]=function(){return function(){return ami[_0x167c('0xa')]({'action':_0x167c('0x17')});};};ami[_0x167c('0x18')]=function(){return function(){return ami[_0x167c('0xa')]({'action':_0x167c('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x167c('0xa')]({'action':_0x167c('0x1a')});};};function connect(_0x4b65e6){logger[_0x167c('0x1b')](util[_0x167c('0xd')](_0x167c('0x1c'),config[_0x167c('0x6')][_0x167c('0x8')],config[_0x167c('0x6')]['ip'],config[_0x167c('0x6')][_0x167c('0x7')]));ami[_0x167c('0x1d')](_0x167c('0x10'),error);ami[_0x167c('0x1d')]('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x1c93d8){logger['info'](util['format'](_0x167c('0x1e'),config[_0x167c('0x6')]['username'],config['asterisk']['ip'],config[_0x167c('0x6')]['port'],util[_0x167c('0xf')](_0x1c93d8,![],null)));});ami['on'](_0x167c('0x1f'),function(_0x17c16d){logger[_0x167c('0x1b')](util[_0x167c('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x167c('0x6')]['username'],config['asterisk']['ip'],config[_0x167c('0x6')][_0x167c('0x7')]));return BPromise['resolve']()[_0x167c('0x20')](ami[_0x167c('0x12')]())[_0x167c('0x20')](ami['actionDeviceStateList']())[_0x167c('0x20')](ami[_0x167c('0x16')]())['then'](ami[_0x167c('0x18')]())[_0x167c('0x20')](ami[_0x167c('0x21')]())[_0x167c('0x22')](function(_0x2f6b2d){console[_0x167c('0x23')](_0x2f6b2d);});});ami[_0x167c('0x1d')](_0x167c('0x10'),error);ami[_0x167c('0x1d')](_0x167c('0x24'),close);module[_0x167c('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 99175d8..8c7fcd0 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 _0xc3f9=['client','http','Request','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x36e59b,_0x3ef537){var _0x2f8f16=function(_0xa38a22){while(--_0xa38a22){_0x36e59b['push'](_0x36e59b['shift']());}};_0x2f8f16(++_0x3ef537);}(_0xc3f9,0x1a1));var _0x9c3f=function(_0x473630,_0x1dafaa){_0x473630=_0x473630-0x0;var _0x233a3a=_0xc3f9[_0x473630];return _0x233a3a;};'use strict';var jayson=require(_0x9c3f('0x0'));var BPromise=require(_0x9c3f('0x1'));var logger=require(_0x9c3f('0x2'))('ami');var client=jayson[_0x9c3f('0x3')][_0x9c3f('0x4')]({'port':0x2329});client[_0x9c3f('0x5')]=function(_0x4fae86,_0x1f9663){return new BPromise(function(_0x167f5e,_0x576572){return client['request'](_0x4fae86,_0x1f9663)['then'](function(_0x51e897){logger[_0x9c3f('0x6')](_0x9c3f('0x7'),_0x9c3f('0x8'),_0x4fae86,_0x1f9663,_0x51e897);if(_0x51e897['error']){logger['error'](_0x9c3f('0x7'),_0x9c3f('0x8'),_0x4fae86,_0x51e897[_0x9c3f('0x9')][_0x9c3f('0xa')],_0x1f9663);return _0x576572(_0x51e897[_0x9c3f('0x9')]['message']);}else{return _0x167f5e(_0x51e897[_0x9c3f('0xb')]);}})[_0x9c3f('0xc')](function(_0x13b8d2){logger[_0x9c3f('0x9')](_0x9c3f('0x7'),_0x9c3f('0x8'),_0x4fae86,_0x13b8d2,_0x1f9663);return _0x576572(_0x13b8d2);});});};module[_0x9c3f('0xd')]=client; \ No newline at end of file +var _0x91bf=['Request','request','then','rpc','memberReport','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','http'];(function(_0x1d41f3,_0x3b8e49){var _0x499ad3=function(_0x180a8f){while(--_0x180a8f){_0x1d41f3['push'](_0x1d41f3['shift']());}};_0x499ad3(++_0x3b8e49);}(_0x91bf,0x168));var _0xf91b=function(_0x39a547,_0x34bb7d){_0x39a547=_0x39a547-0x0;var _0x40f29d=_0x91bf[_0x39a547];return _0x40f29d;};'use strict';var jayson=require(_0xf91b('0x0'));var BPromise=require(_0xf91b('0x1'));var logger=require(_0xf91b('0x2'))('ami');var client=jayson['client'][_0xf91b('0x3')]({'port':0x2329});client[_0xf91b('0x4')]=function(_0x124b16,_0x352c3e){return new BPromise(function(_0x4f66e7,_0x371fd0){return client[_0xf91b('0x5')](_0x124b16,_0x352c3e)[_0xf91b('0x6')](function(_0x49b3b4){logger['debug'](_0xf91b('0x7'),_0xf91b('0x8'),_0x124b16,_0x352c3e,_0x49b3b4);if(_0x49b3b4['error']){logger[_0xf91b('0x9')](_0xf91b('0x7'),_0xf91b('0x8'),_0x124b16,_0x49b3b4[_0xf91b('0x9')]['message'],_0x352c3e);return _0x371fd0(_0x49b3b4[_0xf91b('0x9')][_0xf91b('0xa')]);}else{return _0x4f66e7(_0x49b3b4['result']);}})[_0xf91b('0xb')](function(_0x24a9f5){logger[_0xf91b('0x9')]('rpc','memberReport',_0x124b16,_0x24a9f5,_0x352c3e);return _0x371fd0(_0x24a9f5);});});};module[_0xf91b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 76862db..302f9a6 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 _0x0427=['originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','queue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum'];(function(_0x55d6d9,_0x4b0d00){var _0x2cdb30=function(_0x4fc0dc){while(--_0x4fc0dc){_0x55d6d9['push'](_0x55d6d9['shift']());}};_0x2cdb30(++_0x4b0d00);}(_0x0427,0x137));var _0x7042=function(_0x54886d,_0x2f4796){_0x54886d=_0x54886d-0x0;var _0x791ba3=_0x0427[_0x54886d];return _0x791ba3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7042('0x0'));function checkNameSurname(_0x1fe4cf,_0x564d3d,_0x2afd71){var _0x7c5b2d='';if(!_[_0x7042('0x1')](_0x564d3d)&&_0x7042('0x2')===typeof _0x564d3d){_0x7c5b2d+=_0x564d3d;}if(!_[_0x7042('0x1')](_0x2afd71)&&_0x7042('0x2')===typeof _0x2afd71){_0x7c5b2d+='\x20'+_0x2afd71;}if(_0x7c5b2d!==''){return _0x7c5b2d;}return _0x1fe4cf;}function Action(_0x2c7c32,_0x53ab81,_0x37a35b){this[_0x7042('0x3')]=_0x2c7c32;this[_0x7042('0x4')]=_0x37a35b||undefined;this[_0x7042('0x5')]=checkNameSurname(_0x53ab81[_0x7042('0x6')][_0x7042('0x7')],_0x53ab81[_0x7042('0x6')][_0x7042('0x8')],_0x53ab81[_0x7042('0x6')]['lastName']);this[_0x7042('0x9')]=_0x53ab81['Contact']['phone'];this['queue']=_0x2c7c32['name'];this[_0x7042('0xa')]=_0x53ab81['active']||![];this[_0x7042('0xb')]=_0x2c7c32[_0x7042('0xb')];this[_0x7042('0xc')]=_0x2c7c32['dialQueueTimeout']||0x3;this['scheduledat']=_0x53ab81[_0x7042('0xd')];this[_0x7042('0xe')]=_0x53ab81[_0x7042('0xe')];this[_0x7042('0xf')]=_0x53ab81[_0x7042('0xf')];this[_0x7042('0x10')]=_0x53ab81['countnoanswerretry'];this[_0x7042('0x11')]=_0x53ab81[_0x7042('0x11')];this[_0x7042('0x12')]=_0x53ab81['countdropretry'];this[_0x7042('0x13')]=_0x53ab81[_0x7042('0x13')];this['countmachineretry']=_0x53ab81[_0x7042('0x14')];this['countagentrejectretry']=_0x53ab81['countagentrejectretry'];this[_0x7042('0x15')]=_0x53ab81[_0x7042('0x15')];this[_0x7042('0x16')]=_0x53ab81[_0x7042('0x16')];this[_0x7042('0x17')]=_0x53ab81['UserId'];this[_0x7042('0x18')]=_0x53ab81[_0x7042('0x18')];this[_0x7042('0x19')]=_0x53ab81[_0x7042('0x19')];this[_0x7042('0x1a')]=_0x53ab81['id'];this['ContactFirstName']=_0x53ab81[_0x7042('0x6')]['firstName']||'';this[_0x7042('0x1b')]=moment()['format'](_0x7042('0x1c'));this[_0x7042('0x1d')]=_0x53ab81[_0x7042('0x1d')];this[_0x7042('0x1e')]=_0x53ab81['callbackuniqueid'];this['callbackat']=_0x53ab81['callbackat'];this[_0x7042('0x1f')]=_0x53ab81[_0x7042('0x1f')];this[_0x7042('0x20')]='';this[_0x7042('0x21')]='';}Action['prototype'][_0x7042('0x22')]=function(){return util[_0x7042('0x23')](_0x7042('0x24'),this[_0x7042('0x5')],this[_0x7042('0x3')]['dialCutDigit']>0x0?this[_0x7042('0x9')][_0x7042('0x25')](this[_0x7042('0x3')][_0x7042('0x26')]):this[_0x7042('0x9')]);};Action[_0x7042('0x27')][_0x7042('0x28')]=function(){return this[_0x7042('0x29')];};module[_0x7042('0x2a')]=Action; \ No newline at end of file +var _0x8ba2=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','getQueue','util','lodash','moment','string','isNil','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x173935,_0x5f3824){var _0x4a61d7=function(_0x3f63e2){while(--_0x3f63e2){_0x173935['push'](_0x173935['shift']());}};_0x4a61d7(++_0x5f3824);}(_0x8ba2,0x13f));var _0x28ba=function(_0x17a200,_0x5a654a){_0x17a200=_0x17a200-0x0;var _0x5588c5=_0x8ba2[_0x17a200];return _0x5588c5;};'use strict';var util=require(_0x28ba('0x0'));var _=require(_0x28ba('0x1'));var moment=require(_0x28ba('0x2'));function checkNameSurname(_0x49a1cb,_0x443bb0,_0x10112a){var _0x259b9a='';if(!_['isNil'](_0x443bb0)&&_0x28ba('0x3')===typeof _0x443bb0){_0x259b9a+=_0x443bb0;}if(!_[_0x28ba('0x4')](_0x10112a)&&_0x28ba('0x3')===typeof _0x10112a){_0x259b9a+='\x20'+_0x10112a;}if(_0x259b9a!==''){return _0x259b9a;}return _0x49a1cb;}function Action(_0xe89367,_0x3d039d,_0x24cbfc){this['voiceQueue']=_0xe89367;this[_0x28ba('0x5')]=_0x24cbfc||undefined;this[_0x28ba('0x6')]=checkNameSurname(_0x3d039d[_0x28ba('0x7')]['phone'],_0x3d039d[_0x28ba('0x7')][_0x28ba('0x8')],_0x3d039d[_0x28ba('0x7')][_0x28ba('0x9')]);this[_0x28ba('0xa')]=_0x3d039d[_0x28ba('0x7')][_0x28ba('0xb')];this[_0x28ba('0xc')]=_0xe89367[_0x28ba('0x6')];this[_0x28ba('0xd')]=_0x3d039d['active']||![];this[_0x28ba('0xe')]=_0xe89367[_0x28ba('0xe')];this[_0x28ba('0xf')]=_0xe89367[_0x28ba('0xf')]||0x3;this[_0x28ba('0x10')]=_0x3d039d[_0x28ba('0x10')];this[_0x28ba('0x11')]=_0x3d039d['countbusyretry'];this[_0x28ba('0x12')]=_0x3d039d[_0x28ba('0x12')];this['countnoanswerretry']=_0x3d039d[_0x28ba('0x13')];this[_0x28ba('0x14')]=_0x3d039d[_0x28ba('0x14')];this[_0x28ba('0x15')]=_0x3d039d['countdropretry'];this[_0x28ba('0x16')]=_0x3d039d[_0x28ba('0x16')];this[_0x28ba('0x17')]=_0x3d039d[_0x28ba('0x17')];this[_0x28ba('0x18')]=_0x3d039d['countagentrejectretry'];this['ContactId']=_0x3d039d[_0x28ba('0x19')];this[_0x28ba('0x1a')]=_0x3d039d[_0x28ba('0x1a')];this[_0x28ba('0x1b')]=_0x3d039d[_0x28ba('0x1b')];this[_0x28ba('0x1c')]=_0x3d039d[_0x28ba('0x1c')];this[_0x28ba('0x1d')]=_0x3d039d[_0x28ba('0x1d')];this['idHopper']=_0x3d039d['id'];this['ContactFirstName']=_0x3d039d[_0x28ba('0x7')][_0x28ba('0x8')]||'';this['starttime']=moment()['format'](_0x28ba('0x1e'));this[_0x28ba('0x1f')]=_0x3d039d[_0x28ba('0x1f')];this[_0x28ba('0x20')]=_0x3d039d[_0x28ba('0x20')];this['callbackat']=_0x3d039d[_0x28ba('0x21')];this[_0x28ba('0x22')]=_0x3d039d[_0x28ba('0x22')];this[_0x28ba('0x23')]='';this[_0x28ba('0x24')]='';}Action[_0x28ba('0x25')]['getCaller']=function(){return util[_0x28ba('0x26')](_0x28ba('0x27'),this[_0x28ba('0x6')],this[_0x28ba('0x28')][_0x28ba('0x29')]>0x0?this[_0x28ba('0xa')]['substring'](this[_0x28ba('0x28')][_0x28ba('0x29')]):this['number']);};Action['prototype'][_0x28ba('0x2a')]=function(){return this[_0x28ba('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 7b53f38..ca68905 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 _0x5122=['originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','queue','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x5122,0xc0));var _0x2512=function(_0x998bfd,_0x5ef1da){_0x998bfd=_0x998bfd-0x0;var _0x4cd176=_0x5122[_0x998bfd];return _0x4cd176;};'use strict';var util=require(_0x2512('0x0'));var _=require(_0x2512('0x1'));var moment=require(_0x2512('0x2'));function getSeconds(_0x146d7e,_0x1c395d){var _0x374b5d=moment(_0x146d7e)[_0x2512('0x3')](0x0);var _0x1bf563=moment(_0x1c395d)['milliseconds'](0x0);return _0x374b5d['diff'](_0x1bf563,_0x2512('0x4'));}function AdditionalPhone(_0x493d5d){this['uniqueid']=_0x493d5d['uniqueid'];this[_0x2512('0x5')]=_0x493d5d['scheduledat']||undefined;this[_0x2512('0x6')]=_0x493d5d[_0x2512('0x6')];this[_0x2512('0x7')]=_0x493d5d[_0x2512('0x6')]===_0x2512('0x8')?'queue':_0x493d5d[_0x2512('0x6')];this[_0x2512('0x9')]=_0x493d5d[_0x2512('0x9')];this[_0x2512('0xa')]=_0x493d5d[_0x2512('0xa')];this[_0x2512('0xb')]=_0x493d5d['countnoanswerretry'];this[_0x2512('0xc')]=_0x493d5d[_0x2512('0x9')]+_0x493d5d[_0x2512('0xa')]+_0x493d5d[_0x2512('0xb')]+_0x493d5d['countnosuchnumberretry']+_0x493d5d['countdropretry']+_0x493d5d[_0x2512('0xd')]+_0x493d5d[_0x2512('0xe')]+_0x493d5d[_0x2512('0xf')];this[_0x2512('0x10')]=_0x493d5d[_0x2512('0x10')];this[_0x2512('0x11')]=_0x493d5d['countdropretry'];this[_0x2512('0xd')]=_0x493d5d[_0x2512('0xd')];this[_0x2512('0xe')]=_0x493d5d[_0x2512('0xe')];this[_0x2512('0xf')]=_0x493d5d[_0x2512('0xf')];this[_0x2512('0x12')]=_0x493d5d[_0x2512('0x12')];this[_0x2512('0x13')]=_0x493d5d[_0x2512('0x14')];this[_0x2512('0x15')]=_0x493d5d['number'];this[_0x2512('0x16')]=_0x493d5d[_0x2512('0x16')];this[_0x2512('0x17')]=_0x493d5d[_0x2512('0x17')];this[_0x2512('0x18')]=_0x493d5d[_0x2512('0x17')];this[_0x2512('0x19')]=getSeconds(_0x493d5d[_0x2512('0x17')],_0x493d5d[_0x2512('0x16')]);this[_0x2512('0x1a')]=0x0;this[_0x2512('0x1b')]=0x0;this[_0x2512('0x1c')]=_0x493d5d['callback'];this[_0x2512('0x1d')]=_0x493d5d[_0x2512('0x1d')];this['callbackat']=_0x493d5d[_0x2512('0x1e')];this[_0x2512('0x1f')]=_0x493d5d[_0x2512('0x1f')];this[_0x2512('0x20')]=_0x493d5d[_0x2512('0x20')];this[_0x2512('0x21')]=_0x493d5d[_0x2512('0x21')];this['UserId']=_0x493d5d[_0x2512('0x22')];this['VoiceQueueId']=_0x493d5d['VoiceQueueId'];this[_0x2512('0x23')]=_0x493d5d[_0x2512('0x23')];this['originatecalleridnum']=_0x493d5d['originatecalleridnum']||'';this[_0x2512('0x24')]=_0x493d5d[_0x2512('0x24')]||'';}module[_0x2512('0x25')]=History; \ No newline at end of file +var _0x9129=['countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x335e24,_0x3fbd76){var _0x3e3b08=function(_0x19ee98){while(--_0x19ee98){_0x335e24['push'](_0x335e24['shift']());}};_0x3e3b08(++_0x3fbd76);}(_0x9129,0x15a));var _0x9912=function(_0xf61129,_0x523668){_0xf61129=_0xf61129-0x0;var _0xefa38a=_0x9129[_0xf61129];return _0xefa38a;};'use strict';var util=require('util');var _=require(_0x9912('0x0'));var moment=require(_0x9912('0x1'));function getSeconds(_0x63de2d,_0x2e5eb5){var _0x2e9740=moment(_0x63de2d)[_0x9912('0x2')](0x0);var _0x1fafe6=moment(_0x2e5eb5)[_0x9912('0x2')](0x0);return _0x2e9740[_0x9912('0x3')](_0x1fafe6,_0x9912('0x4'));}function AdditionalPhone(_0x44882c){this[_0x9912('0x5')]=_0x44882c[_0x9912('0x5')];this[_0x9912('0x6')]=_0x44882c[_0x9912('0x6')]||undefined;this['type']=_0x44882c[_0x9912('0x7')];this[_0x9912('0x8')]=_0x44882c[_0x9912('0x7')]==='outbound'?_0x9912('0x9'):_0x44882c[_0x9912('0x7')];this[_0x9912('0xa')]=_0x44882c['countbusyretry'];this[_0x9912('0xb')]=_0x44882c['countcongestionretry'];this[_0x9912('0xc')]=_0x44882c['countnoanswerretry'];this['countglobal']=_0x44882c[_0x9912('0xa')]+_0x44882c[_0x9912('0xb')]+_0x44882c[_0x9912('0xc')]+_0x44882c[_0x9912('0xd')]+_0x44882c['countdropretry']+_0x44882c['countabandonedretry']+_0x44882c[_0x9912('0xe')]+_0x44882c[_0x9912('0xf')];this['countnosuchnumberretry']=_0x44882c[_0x9912('0xd')];this[_0x9912('0x10')]=_0x44882c[_0x9912('0x10')];this[_0x9912('0x11')]=_0x44882c[_0x9912('0x11')];this[_0x9912('0xe')]=_0x44882c[_0x9912('0xe')];this[_0x9912('0xf')]=_0x44882c['countagentrejectretry'];this[_0x9912('0x9')]=_0x44882c[_0x9912('0x9')];this[_0x9912('0x12')]=_0x44882c[_0x9912('0x13')];this['calleridnum']=_0x44882c[_0x9912('0x14')];this['starttime']=_0x44882c[_0x9912('0x15')];this[_0x9912('0x16')]=_0x44882c[_0x9912('0x16')];this[_0x9912('0x17')]=_0x44882c[_0x9912('0x16')];this['ringtime']=getSeconds(_0x44882c[_0x9912('0x16')],_0x44882c[_0x9912('0x15')]);this[_0x9912('0x18')]=0x0;this[_0x9912('0x19')]=0x0;this[_0x9912('0x1a')]=_0x44882c[_0x9912('0x1a')];this[_0x9912('0x1b')]=_0x44882c[_0x9912('0x1b')];this[_0x9912('0x1c')]=_0x44882c['callbackat'];this[_0x9912('0x1d')]=_0x44882c[_0x9912('0x1d')];this['ContactId']=_0x44882c['ContactId'];this[_0x9912('0x1e')]=_0x44882c['ListId'];this[_0x9912('0x1f')]=_0x44882c[_0x9912('0x1f')];this[_0x9912('0x20')]=_0x44882c[_0x9912('0x20')];this['CampaignId']=_0x44882c[_0x9912('0x21')];this['originatecalleridnum']=_0x44882c[_0x9912('0x22')]||'';this[_0x9912('0x23')]=_0x44882c[_0x9912('0x23')]||'';}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 2f92061..9db4c46 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 _0x4a79=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','answertime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','seconds','state','statedesc','scheduledat','type','campaigntype'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4a79,0x7b));var _0x94a7=function(_0x4f616b,_0x4cb423){_0x4f616b=_0x4f616b-0x0;var _0x1ef1c0=_0x4a79[_0x4f616b];return _0x1ef1c0;};'use strict';var util=require(_0x94a7('0x0'));var _=require(_0x94a7('0x1'));var moment=require(_0x94a7('0x2'));function getSeconds(_0x5f0e51,_0x87b21f){var _0x319851=moment(_0x5f0e51)['milliseconds'](0x0);var _0x2a3759=moment(_0x87b21f)['milliseconds'](0x0);return _0x319851['diff'](_0x2a3759,_0x94a7('0x3'));}function AgentComplete(_0x175ed2,_0x5a2649){this[_0x94a7('0x4')]=0x4;this[_0x94a7('0x5')]='Answer';this[_0x94a7('0x6')]=_0x175ed2['scheduledat'];this[_0x94a7('0x7')]=_0x175ed2[_0x94a7('0x7')];this[_0x94a7('0x8')]=_0x175ed2[_0x94a7('0x7')]===_0x94a7('0x9')?_0x94a7('0xa'):_0x175ed2['type'];this['countbusyretry']=_0x175ed2[_0x94a7('0xb')];this['countcongestionretry']=_0x175ed2[_0x94a7('0xc')];this['countnoanswerretry']=_0x175ed2[_0x94a7('0xd')];this[_0x94a7('0xe')]=_0x175ed2[_0x94a7('0xb')]+_0x175ed2['countcongestionretry']+_0x175ed2['countnoanswerretry']+_0x175ed2['countnosuchnumberretry']+_0x175ed2[_0x94a7('0xf')]+_0x175ed2[_0x94a7('0x10')]+_0x175ed2[_0x94a7('0x11')]+_0x175ed2[_0x94a7('0x12')];this[_0x94a7('0x13')]=_0x175ed2[_0x94a7('0x13')];this[_0x94a7('0xf')]=_0x175ed2[_0x94a7('0xf')];this['countabandonedretry']=_0x175ed2[_0x94a7('0x10')];this['countmachineretry']=_0x175ed2[_0x94a7('0x11')];this[_0x94a7('0x12')]=_0x175ed2[_0x94a7('0x12')];this[_0x94a7('0x14')]=_0x5a2649[_0x94a7('0x14')];this[_0x94a7('0x15')]=_0x175ed2[_0x94a7('0x16')];this['calleridnum']=_0x175ed2['number'];this['starttime']=_0x175ed2[_0x94a7('0x17')];this['responsetime']=_0x175ed2[_0x94a7('0x18')];this['answertime']=_0x175ed2['answertime'];this[_0x94a7('0x19')]=moment()['format'](_0x94a7('0x1a'));this[_0x94a7('0x1b')]=getSeconds(_0x175ed2['responsetime'],_0x175ed2['starttime']);this['holdtime']=getSeconds(_0x175ed2['answertime'],_0x175ed2['responsetime']);this[_0x94a7('0x1c')]=getSeconds(this['endtime'],_0x175ed2[_0x94a7('0x1d')]);this[_0x94a7('0xa')]=_0x5a2649['queue'];this[_0x94a7('0x1e')]=_0x5a2649[_0x94a7('0x1e')];this[_0x94a7('0x1f')]=_0x5a2649[_0x94a7('0x1f')];this[_0x94a7('0x20')]=_0x175ed2[_0x94a7('0x20')];this[_0x94a7('0x21')]=_0x175ed2[_0x94a7('0x21')];this['callbackat']=_0x175ed2[_0x94a7('0x22')];this[_0x94a7('0x23')]=_0x175ed2[_0x94a7('0x23')];this[_0x94a7('0x24')]=_0x175ed2[_0x94a7('0x24')];this[_0x94a7('0x25')]=_0x175ed2[_0x94a7('0x25')];this[_0x94a7('0x26')]=_0x175ed2[_0x94a7('0x26')];this[_0x94a7('0x27')]=_0x175ed2[_0x94a7('0x27')];this[_0x94a7('0x28')]=_0x175ed2[_0x94a7('0x28')];this[_0x94a7('0x29')]=_0x175ed2[_0x94a7('0x29')]||'';this['originatecalleridname']=_0x175ed2[_0x94a7('0x2a')]||'';}module[_0x94a7('0x2b')]=AgentComplete; \ No newline at end of file +var _0x400f=['statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x400f,0x1a0));var _0xf400=function(_0x204f74,_0x20cfb7){_0x204f74=_0x204f74-0x0;var _0x3063d6=_0x400f[_0x204f74];return _0x3063d6;};'use strict';var util=require(_0xf400('0x0'));var _=require(_0xf400('0x1'));var moment=require(_0xf400('0x2'));function getSeconds(_0x3a84d4,_0x43463d){var _0x45d881=moment(_0x3a84d4)[_0xf400('0x3')](0x0);var _0x2982c3=moment(_0x43463d)['milliseconds'](0x0);return _0x45d881[_0xf400('0x4')](_0x2982c3,_0xf400('0x5'));}function AgentComplete(_0x590fc2,_0x1fa738){this[_0xf400('0x6')]=0x4;this[_0xf400('0x7')]=_0xf400('0x8');this[_0xf400('0x9')]=_0x590fc2[_0xf400('0x9')];this[_0xf400('0xa')]=_0x590fc2[_0xf400('0xa')];this['campaigntype']=_0x590fc2['type']===_0xf400('0xb')?'queue':_0x590fc2[_0xf400('0xa')];this[_0xf400('0xc')]=_0x590fc2[_0xf400('0xc')];this[_0xf400('0xd')]=_0x590fc2[_0xf400('0xd')];this['countnoanswerretry']=_0x590fc2[_0xf400('0xe')];this[_0xf400('0xf')]=_0x590fc2[_0xf400('0xc')]+_0x590fc2[_0xf400('0xd')]+_0x590fc2[_0xf400('0xe')]+_0x590fc2[_0xf400('0x10')]+_0x590fc2[_0xf400('0x11')]+_0x590fc2[_0xf400('0x12')]+_0x590fc2[_0xf400('0x13')]+_0x590fc2[_0xf400('0x14')];this['countnosuchnumberretry']=_0x590fc2[_0xf400('0x10')];this[_0xf400('0x11')]=_0x590fc2[_0xf400('0x11')];this['countabandonedretry']=_0x590fc2[_0xf400('0x12')];this['countmachineretry']=_0x590fc2[_0xf400('0x13')];this[_0xf400('0x14')]=_0x590fc2[_0xf400('0x14')];this[_0xf400('0x15')]=_0x1fa738['uniqueid'];this['calleridname']=_0x590fc2[_0xf400('0x16')];this[_0xf400('0x17')]=_0x590fc2[_0xf400('0x18')];this[_0xf400('0x19')]=_0x590fc2['starttime'];this[_0xf400('0x1a')]=_0x590fc2[_0xf400('0x1a')];this['answertime']=_0x590fc2[_0xf400('0x1b')];this[_0xf400('0x1c')]=moment()[_0xf400('0x1d')](_0xf400('0x1e'));this[_0xf400('0x1f')]=getSeconds(_0x590fc2[_0xf400('0x1a')],_0x590fc2[_0xf400('0x19')]);this['holdtime']=getSeconds(_0x590fc2[_0xf400('0x1b')],_0x590fc2['responsetime']);this[_0xf400('0x20')]=getSeconds(this[_0xf400('0x1c')],_0x590fc2[_0xf400('0x1b')]);this[_0xf400('0x21')]=_0x1fa738[_0xf400('0x21')];this[_0xf400('0x22')]=_0x1fa738[_0xf400('0x22')];this['reason']=_0x1fa738[_0xf400('0x23')];this['callback']=_0x590fc2[_0xf400('0x24')];this[_0xf400('0x25')]=_0x590fc2[_0xf400('0x25')];this[_0xf400('0x26')]=_0x590fc2['callbackat'];this['recallme']=_0x590fc2['recallme'];this[_0xf400('0x27')]=_0x590fc2['ContactId'];this[_0xf400('0x28')]=_0x590fc2[_0xf400('0x28')];this[_0xf400('0x29')]=_0x590fc2[_0xf400('0x29')];this[_0xf400('0x2a')]=_0x590fc2['VoiceQueueId'];this[_0xf400('0x2b')]=_0x590fc2[_0xf400('0x2b')];this[_0xf400('0x2c')]=_0x590fc2[_0xf400('0x2c')]||'';this[_0xf400('0x2d')]=_0x590fc2[_0xf400('0x2d')]||'';}module[_0xf400('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index bf5bbfa..8279cb9 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 _0x9b0b=['VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x1ebc60,_0x1b2360){var _0x487371=function(_0x3ebc4c){while(--_0x3ebc4c){_0x1ebc60['push'](_0x1ebc60['shift']());}};_0x487371(++_0x1b2360);}(_0x9b0b,0x11c));var _0xb9b0=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x9b0b[_0x4521e3];return _0x46a272;};'use strict';var util=require(_0xb9b0('0x0'));var _=require(_0xb9b0('0x1'));var moment=require(_0xb9b0('0x2'));function getSeconds(_0x590803,_0x2f7660){var _0xa2dd65=moment(_0x590803)[_0xb9b0('0x3')](0x0);var _0x758884=moment(_0x2f7660)['milliseconds'](0x0);return _0xa2dd65[_0xb9b0('0x4')](_0x758884,_0xb9b0('0x5'));}function Final(_0x302e14){this[_0xb9b0('0x6')]=_0x302e14[_0xb9b0('0x6')];this[_0xb9b0('0x7')]=_0x302e14[_0xb9b0('0x7')];this[_0xb9b0('0x8')]=_0x302e14['type'];this[_0xb9b0('0x9')]=_0x302e14[_0xb9b0('0x8')]===_0xb9b0('0xa')?'queue':_0x302e14[_0xb9b0('0x8')];this['countbusyretry']=_0x302e14[_0xb9b0('0xb')];this[_0xb9b0('0xc')]=_0x302e14[_0xb9b0('0xc')];this[_0xb9b0('0xd')]=_0x302e14['countnoanswerretry'];this[_0xb9b0('0xe')]=_0x302e14[_0xb9b0('0xb')]+_0x302e14['countcongestionretry']+_0x302e14[_0xb9b0('0xd')]+_0x302e14[_0xb9b0('0xf')]+_0x302e14[_0xb9b0('0x10')]+_0x302e14[_0xb9b0('0x11')]+_0x302e14[_0xb9b0('0x12')]+_0x302e14[_0xb9b0('0x13')];this[_0xb9b0('0xf')]=_0x302e14['countnosuchnumberretry'];this['countdropretry']=_0x302e14[_0xb9b0('0x10')];this[_0xb9b0('0x11')]=_0x302e14['countabandonedretry'];this[_0xb9b0('0x12')]=_0x302e14[_0xb9b0('0x12')];this[_0xb9b0('0x13')]=_0x302e14['countagentrejectretry'];this[_0xb9b0('0x14')]=_0x302e14[_0xb9b0('0x14')];this[_0xb9b0('0x15')]=_0x302e14['calleridname'];this[_0xb9b0('0x16')]=_0x302e14['calleridnum'];this[_0xb9b0('0x17')]=_0x302e14[_0xb9b0('0x17')];this['responsetime']=_0x302e14['responsetime'];this[_0xb9b0('0x18')]=_0x302e14[_0xb9b0('0x19')];this[_0xb9b0('0x1a')]=_0x302e14[_0xb9b0('0x1a')]||0x0;this[_0xb9b0('0x1b')]=_0x302e14[_0xb9b0('0x1b')]||0x0;this[_0xb9b0('0x1c')]=_0x302e14['talktime']||0x0;this[_0xb9b0('0x1d')]=_0x302e14['callback'];this[_0xb9b0('0x1e')]=_0x302e14[_0xb9b0('0x1e')];this[_0xb9b0('0x1f')]=_0x302e14['callbackat'];this['recallme']=_0x302e14[_0xb9b0('0x20')];this[_0xb9b0('0x21')]=_0x302e14['ContactId'];this['ListId']=_0x302e14[_0xb9b0('0x22')];this[_0xb9b0('0x23')]=_0x302e14[_0xb9b0('0x23')];this[_0xb9b0('0x24')]=_0x302e14[_0xb9b0('0x24')];this['CampaignId']=_0x302e14['CampaignId'];this[_0xb9b0('0x25')]=_0x302e14[_0xb9b0('0x25')]||'';this['originatecalleridname']=_0x302e14[_0xb9b0('0x26')]||'';}module[_0xb9b0('0x27')]=Final; \ No newline at end of file +var _0xf36c=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x1ea94b,_0x3b2f5d){var _0x4dd649=function(_0x301493){while(--_0x301493){_0x1ea94b['push'](_0x1ea94b['shift']());}};_0x4dd649(++_0x3b2f5d);}(_0xf36c,0xe1));var _0xcf36=function(_0x248195,_0x5cad1b){_0x248195=_0x248195-0x0;var _0x308a65=_0xf36c[_0x248195];return _0x308a65;};'use strict';var util=require(_0xcf36('0x0'));var _=require(_0xcf36('0x1'));var moment=require(_0xcf36('0x2'));function getSeconds(_0x4e2ec8,_0x11a35a){var _0x5327a4=moment(_0x4e2ec8)[_0xcf36('0x3')](0x0);var _0xe9542e=moment(_0x11a35a)[_0xcf36('0x3')](0x0);return _0x5327a4[_0xcf36('0x4')](_0xe9542e,_0xcf36('0x5'));}function Final(_0xaaf974){this['uniqueid']=_0xaaf974[_0xcf36('0x6')];this[_0xcf36('0x7')]=_0xaaf974[_0xcf36('0x7')];this[_0xcf36('0x8')]=_0xaaf974['type'];this[_0xcf36('0x9')]=_0xaaf974[_0xcf36('0x8')]===_0xcf36('0xa')?_0xcf36('0xb'):_0xaaf974[_0xcf36('0x8')];this[_0xcf36('0xc')]=_0xaaf974[_0xcf36('0xc')];this[_0xcf36('0xd')]=_0xaaf974[_0xcf36('0xd')];this[_0xcf36('0xe')]=_0xaaf974[_0xcf36('0xe')];this['countglobal']=_0xaaf974[_0xcf36('0xc')]+_0xaaf974[_0xcf36('0xd')]+_0xaaf974[_0xcf36('0xe')]+_0xaaf974[_0xcf36('0xf')]+_0xaaf974[_0xcf36('0x10')]+_0xaaf974[_0xcf36('0x11')]+_0xaaf974['countmachineretry']+_0xaaf974[_0xcf36('0x12')];this[_0xcf36('0xf')]=_0xaaf974['countnosuchnumberretry'];this[_0xcf36('0x10')]=_0xaaf974['countdropretry'];this[_0xcf36('0x11')]=_0xaaf974[_0xcf36('0x11')];this[_0xcf36('0x13')]=_0xaaf974[_0xcf36('0x13')];this['countagentrejectretry']=_0xaaf974[_0xcf36('0x12')];this[_0xcf36('0xb')]=_0xaaf974[_0xcf36('0xb')];this[_0xcf36('0x14')]=_0xaaf974[_0xcf36('0x14')];this[_0xcf36('0x15')]=_0xaaf974[_0xcf36('0x15')];this[_0xcf36('0x16')]=_0xaaf974['starttime'];this[_0xcf36('0x17')]=_0xaaf974[_0xcf36('0x17')];this[_0xcf36('0x18')]=_0xaaf974[_0xcf36('0x17')];this[_0xcf36('0x19')]=_0xaaf974[_0xcf36('0x19')]||0x0;this['holdtime']=_0xaaf974[_0xcf36('0x1a')]||0x0;this[_0xcf36('0x1b')]=_0xaaf974[_0xcf36('0x1b')]||0x0;this[_0xcf36('0x1c')]=_0xaaf974[_0xcf36('0x1c')];this[_0xcf36('0x1d')]=_0xaaf974[_0xcf36('0x1d')];this[_0xcf36('0x1e')]=_0xaaf974['callbackat'];this[_0xcf36('0x1f')]=_0xaaf974[_0xcf36('0x1f')];this[_0xcf36('0x20')]=_0xaaf974[_0xcf36('0x20')];this['ListId']=_0xaaf974[_0xcf36('0x21')];this[_0xcf36('0x22')]=_0xaaf974[_0xcf36('0x22')];this['VoiceQueueId']=_0xaaf974[_0xcf36('0x23')];this[_0xcf36('0x24')]=_0xaaf974['CampaignId'];this[_0xcf36('0x25')]=_0xaaf974['originatecalleridnum']||'';this[_0xcf36('0x26')]=_0xaaf974[_0xcf36('0x26')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 324b016..d460f9c 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 _0xfbfb=['diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x1c83c9,_0x2a0efc){var _0x49c840=function(_0x2945e2){while(--_0x2945e2){_0x1c83c9['push'](_0x1c83c9['shift']());}};_0x49c840(++_0x2a0efc);}(_0xfbfb,0x15c));var _0xbfbf=function(_0x588f7a,_0x2abdef){_0x588f7a=_0x588f7a-0x0;var _0x2f53de=_0xfbfb[_0x588f7a];return _0x2f53de;};'use strict';var util=require(_0xbfbf('0x0'));var _=require(_0xbfbf('0x1'));var moment=require(_0xbfbf('0x2'));function getSeconds(_0x29f562,_0x6de49d){var _0x148492=moment(_0x29f562)['milliseconds'](0x0);var _0x4e0a12=moment(_0x6de49d)[_0xbfbf('0x3')](0x0);return _0x148492[_0xbfbf('0x4')](_0x4e0a12,_0xbfbf('0x5'));}function Hangup(_0x4e25a1,_0x182cf5){this[_0xbfbf('0x6')]=0x4;this[_0xbfbf('0x7')]='Answer';this[_0xbfbf('0x8')]=_0x4e25a1[_0xbfbf('0x8')];this[_0xbfbf('0x9')]=_0x4e25a1[_0xbfbf('0x9')];this[_0xbfbf('0xa')]=_0x4e25a1['type']===_0xbfbf('0xb')?_0xbfbf('0xc'):_0x4e25a1[_0xbfbf('0x9')];this[_0xbfbf('0xd')]=_0x4e25a1[_0xbfbf('0xd')];this[_0xbfbf('0xe')]=_0x4e25a1[_0xbfbf('0xe')];this[_0xbfbf('0xf')]=_0x4e25a1[_0xbfbf('0xf')];this[_0xbfbf('0x10')]=_0x4e25a1[_0xbfbf('0xd')]+_0x4e25a1[_0xbfbf('0xe')]+_0x4e25a1[_0xbfbf('0xf')]+_0x4e25a1[_0xbfbf('0x11')]+_0x4e25a1[_0xbfbf('0x12')]+_0x4e25a1[_0xbfbf('0x13')]+_0x4e25a1[_0xbfbf('0x14')]+_0x4e25a1[_0xbfbf('0x15')];this[_0xbfbf('0x11')]=_0x4e25a1[_0xbfbf('0x11')];this['countdropretry']=_0x4e25a1[_0xbfbf('0x12')];this[_0xbfbf('0x13')]=_0x4e25a1[_0xbfbf('0x13')];this[_0xbfbf('0x14')]=_0x4e25a1[_0xbfbf('0x14')];this[_0xbfbf('0x15')]=_0x4e25a1['countagentrejectretry'];this[_0xbfbf('0x16')]=_0x182cf5[_0xbfbf('0x16')];this['calleridname']=_0x4e25a1['name'];this['calleridnum']=_0x4e25a1[_0xbfbf('0x17')];this[_0xbfbf('0x18')]=_0x4e25a1[_0xbfbf('0x18')];this[_0xbfbf('0x19')]=_0x4e25a1[_0xbfbf('0x19')];this[_0xbfbf('0x1a')]=moment()[_0xbfbf('0x1b')](_0xbfbf('0x1c'));this[_0xbfbf('0x1d')]=getSeconds(_0x4e25a1[_0xbfbf('0x19')],_0x4e25a1['starttime']);this[_0xbfbf('0x1e')]=0x0;this['talktime']=getSeconds(this[_0xbfbf('0x1a')],_0x4e25a1[_0xbfbf('0x19')]);this[_0xbfbf('0xc')]=_0x4e25a1[_0xbfbf('0xc')];this[_0xbfbf('0x1f')]=_0xbfbf('0x20');this['reason']=_0x182cf5[_0xbfbf('0x21')];this['callback']=_0x4e25a1[_0xbfbf('0x22')];this[_0xbfbf('0x23')]=_0x4e25a1[_0xbfbf('0x23')];this[_0xbfbf('0x24')]=_0x4e25a1[_0xbfbf('0x24')];this[_0xbfbf('0x25')]=_0x4e25a1[_0xbfbf('0x25')];this[_0xbfbf('0x26')]=_0x4e25a1[_0xbfbf('0x26')];this[_0xbfbf('0x27')]=_0x4e25a1[_0xbfbf('0x27')];this[_0xbfbf('0x28')]=_0x4e25a1[_0xbfbf('0x28')];this[_0xbfbf('0x29')]=_0x4e25a1[_0xbfbf('0x29')];this[_0xbfbf('0x2a')]=_0x4e25a1[_0xbfbf('0x2a')];}module[_0xbfbf('0x2b')]=Hangup; \ No newline at end of file +var _0x8641=['countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x1dea5c,_0x34669b){var _0x5dfef2=function(_0xbbb754){while(--_0xbbb754){_0x1dea5c['push'](_0x1dea5c['shift']());}};_0x5dfef2(++_0x34669b);}(_0x8641,0x1d3));var _0x1864=function(_0x13b53d,_0x2d40c6){_0x13b53d=_0x13b53d-0x0;var _0x45c927=_0x8641[_0x13b53d];return _0x45c927;};'use strict';var util=require(_0x1864('0x0'));var _=require(_0x1864('0x1'));var moment=require(_0x1864('0x2'));function getSeconds(_0x398aa7,_0x4e9590){var _0x469b26=moment(_0x398aa7)['milliseconds'](0x0);var _0x55b05f=moment(_0x4e9590)[_0x1864('0x3')](0x0);return _0x469b26[_0x1864('0x4')](_0x55b05f,_0x1864('0x5'));}function Hangup(_0x422de4,_0x445e60){this['state']=0x4;this[_0x1864('0x6')]=_0x1864('0x7');this['scheduledat']=_0x422de4['scheduledat'];this['type']=_0x422de4[_0x1864('0x8')];this[_0x1864('0x9')]=_0x422de4[_0x1864('0x8')]===_0x1864('0xa')?_0x1864('0xb'):_0x422de4[_0x1864('0x8')];this['countbusyretry']=_0x422de4[_0x1864('0xc')];this[_0x1864('0xd')]=_0x422de4[_0x1864('0xd')];this[_0x1864('0xe')]=_0x422de4['countnoanswerretry'];this[_0x1864('0xf')]=_0x422de4['countbusyretry']+_0x422de4[_0x1864('0xd')]+_0x422de4['countnoanswerretry']+_0x422de4[_0x1864('0x10')]+_0x422de4['countdropretry']+_0x422de4[_0x1864('0x11')]+_0x422de4[_0x1864('0x12')]+_0x422de4[_0x1864('0x13')];this[_0x1864('0x10')]=_0x422de4['countnosuchnumberretry'];this[_0x1864('0x14')]=_0x422de4[_0x1864('0x14')];this['countabandonedretry']=_0x422de4['countabandonedretry'];this[_0x1864('0x12')]=_0x422de4[_0x1864('0x12')];this[_0x1864('0x13')]=_0x422de4[_0x1864('0x13')];this[_0x1864('0x15')]=_0x445e60[_0x1864('0x15')];this[_0x1864('0x16')]=_0x422de4[_0x1864('0x17')];this[_0x1864('0x18')]=_0x422de4[_0x1864('0x19')];this[_0x1864('0x1a')]=_0x422de4[_0x1864('0x1a')];this[_0x1864('0x1b')]=_0x422de4[_0x1864('0x1b')];this[_0x1864('0x1c')]=moment()[_0x1864('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x422de4['responsetime'],_0x422de4[_0x1864('0x1a')]);this['holdtime']=0x0;this[_0x1864('0x1e')]=getSeconds(this[_0x1864('0x1c')],_0x422de4[_0x1864('0x1b')]);this[_0x1864('0xb')]=_0x422de4[_0x1864('0xb')];this[_0x1864('0x1f')]='IVR';this[_0x1864('0x20')]=_0x445e60[_0x1864('0x21')];this[_0x1864('0x22')]=_0x422de4[_0x1864('0x22')];this[_0x1864('0x23')]=_0x422de4['callbackuniqueid'];this[_0x1864('0x24')]=_0x422de4['callbackat'];this[_0x1864('0x25')]=_0x422de4['recallme'];this[_0x1864('0x26')]=_0x422de4[_0x1864('0x26')];this[_0x1864('0x27')]=_0x422de4[_0x1864('0x27')];this['UserId']=_0x422de4[_0x1864('0x28')];this[_0x1864('0x29')]=_0x422de4[_0x1864('0x29')];this[_0x1864('0x2a')]=_0x422de4[_0x1864('0x2a')];}module[_0x1864('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6d7c77f..be98bed 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 _0xdbf7=['countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry'];(function(_0x371a1d,_0x3591f3){var _0x4ba340=function(_0x57cfbc){while(--_0x57cfbc){_0x371a1d['push'](_0x371a1d['shift']());}};_0x4ba340(++_0x3591f3);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x2d7ed7,_0x27d3e1){_0x2d7ed7=_0x2d7ed7-0x0;var _0x13f48f=_0xdbf7[_0x2d7ed7];return _0x13f48f;};'use strict';var util=require(_0x7dbf('0x0'));var _=require(_0x7dbf('0x1'));var moment=require(_0x7dbf('0x2'));function getSeconds(_0xfbf6d1,_0x14de15){var _0x2719ff=moment(_0xfbf6d1)[_0x7dbf('0x3')](0x0);var _0x7b931c=moment(_0x14de15)['milliseconds'](0x0);return _0x2719ff[_0x7dbf('0x4')](_0x7b931c,'seconds');}function History(_0x547183){this[_0x7dbf('0x5')]=_0x547183[_0x7dbf('0x5')];this[_0x7dbf('0x6')]=_0x547183[_0x7dbf('0x6')]||undefined;this[_0x7dbf('0x7')]=_0x547183[_0x7dbf('0x7')];this[_0x7dbf('0x8')]=_0x547183[_0x7dbf('0x7')]===_0x7dbf('0x9')?_0x7dbf('0xa'):_0x547183[_0x7dbf('0x7')];this[_0x7dbf('0xb')]=_0x547183[_0x7dbf('0xb')];this[_0x7dbf('0xc')]=_0x547183[_0x7dbf('0xc')];this['countnoanswerretry']=_0x547183[_0x7dbf('0xd')];this[_0x7dbf('0xe')]=_0x547183[_0x7dbf('0xb')]+_0x547183[_0x7dbf('0xc')]+_0x547183[_0x7dbf('0xd')]+_0x547183[_0x7dbf('0xf')]+_0x547183['countdropretry']+_0x547183[_0x7dbf('0x10')]+_0x547183['countmachineretry']+_0x547183['countagentrejectretry'];this['countnosuchnumberretry']=_0x547183['countnosuchnumberretry'];this[_0x7dbf('0x11')]=_0x547183[_0x7dbf('0x11')];this[_0x7dbf('0x10')]=_0x547183['countabandonedretry'];this[_0x7dbf('0x12')]=_0x547183[_0x7dbf('0x12')];this[_0x7dbf('0x13')]=_0x547183['countagentrejectretry'];this[_0x7dbf('0xa')]=_0x547183[_0x7dbf('0xa')];this[_0x7dbf('0x14')]=_0x547183[_0x7dbf('0x15')];this[_0x7dbf('0x16')]=_0x547183[_0x7dbf('0x17')];this[_0x7dbf('0x18')]=_0x547183['starttime'];this[_0x7dbf('0x19')]=_0x547183['responsetime'];this[_0x7dbf('0x1a')]=_0x547183['responsetime'];this[_0x7dbf('0x1b')]=getSeconds(_0x547183[_0x7dbf('0x19')],_0x547183[_0x7dbf('0x18')]);this[_0x7dbf('0x1c')]=0x0;this['talktime']=0x0;this[_0x7dbf('0x1d')]=_0x547183[_0x7dbf('0x1d')];this[_0x7dbf('0x1e')]=_0x547183['callbackuniqueid'];this[_0x7dbf('0x1f')]=_0x547183[_0x7dbf('0x1f')];this[_0x7dbf('0x20')]=_0x547183[_0x7dbf('0x20')];this[_0x7dbf('0x21')]=_0x547183['ContactId'];this[_0x7dbf('0x22')]=_0x547183[_0x7dbf('0x22')];this[_0x7dbf('0x23')]=_0x547183[_0x7dbf('0x23')];this['VoiceQueueId']=_0x547183[_0x7dbf('0x24')];this[_0x7dbf('0x25')]=_0x547183[_0x7dbf('0x25')];this[_0x7dbf('0x26')]=_0x547183[_0x7dbf('0x26')]||'';this[_0x7dbf('0x27')]=_0x547183[_0x7dbf('0x27')]||'';}module['exports']=History; \ No newline at end of file +var _0x0506=['diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x7bcad0,_0x4f283a){var _0x233003=function(_0x4aa46a){while(--_0x4aa46a){_0x7bcad0['push'](_0x7bcad0['shift']());}};_0x233003(++_0x4f283a);}(_0x0506,0x1d1));var _0x6050=function(_0x83c6f0,_0x365c76){_0x83c6f0=_0x83c6f0-0x0;var _0x4d9008=_0x0506[_0x83c6f0];return _0x4d9008;};'use strict';var util=require(_0x6050('0x0'));var _=require(_0x6050('0x1'));var moment=require(_0x6050('0x2'));function getSeconds(_0x5592e4,_0x52f82b){var _0x5139c7=moment(_0x5592e4)['milliseconds'](0x0);var _0x229b5f=moment(_0x52f82b)['milliseconds'](0x0);return _0x5139c7[_0x6050('0x3')](_0x229b5f,'seconds');}function History(_0x57de09){this[_0x6050('0x4')]=_0x57de09[_0x6050('0x4')];this[_0x6050('0x5')]=_0x57de09[_0x6050('0x5')]||undefined;this[_0x6050('0x6')]=_0x57de09[_0x6050('0x6')];this[_0x6050('0x7')]=_0x57de09[_0x6050('0x6')]==='outbound'?_0x6050('0x8'):_0x57de09['type'];this[_0x6050('0x9')]=_0x57de09[_0x6050('0x9')];this[_0x6050('0xa')]=_0x57de09[_0x6050('0xa')];this[_0x6050('0xb')]=_0x57de09[_0x6050('0xb')];this[_0x6050('0xc')]=_0x57de09[_0x6050('0x9')]+_0x57de09[_0x6050('0xa')]+_0x57de09[_0x6050('0xb')]+_0x57de09['countnosuchnumberretry']+_0x57de09[_0x6050('0xd')]+_0x57de09['countabandonedretry']+_0x57de09[_0x6050('0xe')]+_0x57de09[_0x6050('0xf')];this[_0x6050('0x10')]=_0x57de09[_0x6050('0x10')];this['countdropretry']=_0x57de09[_0x6050('0xd')];this['countabandonedretry']=_0x57de09[_0x6050('0x11')];this[_0x6050('0xe')]=_0x57de09[_0x6050('0xe')];this[_0x6050('0xf')]=_0x57de09[_0x6050('0xf')];this[_0x6050('0x8')]=_0x57de09[_0x6050('0x8')];this[_0x6050('0x12')]=_0x57de09[_0x6050('0x13')];this[_0x6050('0x14')]=_0x57de09[_0x6050('0x15')];this[_0x6050('0x16')]=_0x57de09['starttime'];this[_0x6050('0x17')]=_0x57de09[_0x6050('0x17')];this[_0x6050('0x18')]=_0x57de09['responsetime'];this['ringtime']=getSeconds(_0x57de09['responsetime'],_0x57de09['starttime']);this[_0x6050('0x19')]=0x0;this[_0x6050('0x1a')]=0x0;this['callback']=_0x57de09[_0x6050('0x1b')];this[_0x6050('0x1c')]=_0x57de09[_0x6050('0x1c')];this[_0x6050('0x1d')]=_0x57de09[_0x6050('0x1d')];this[_0x6050('0x1e')]=_0x57de09['recallme'];this[_0x6050('0x1f')]=_0x57de09[_0x6050('0x1f')];this[_0x6050('0x20')]=_0x57de09[_0x6050('0x20')];this[_0x6050('0x21')]=_0x57de09[_0x6050('0x21')];this[_0x6050('0x22')]=_0x57de09[_0x6050('0x22')];this['CampaignId']=_0x57de09[_0x6050('0x23')];this['originatecalleridnum']=_0x57de09[_0x6050('0x24')]||'';this[_0x6050('0x25')]=_0x57de09[_0x6050('0x25')]||'';}module[_0x6050('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ebd168a..71dde26 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 _0xe5c5=['contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','Trunk','callerid','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','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\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','isUndefined','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','enqueue','isNil','Action','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','hasOwnProperty','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','countagentrejectretry','reason19\x20machine....','minutes','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','dropreason','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','push','interval','indexOf','true','command','iftime\x20%s,%s','content','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','\x5cw{0,','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','tags','createdAt','updatedAt','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','responsetime','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','getVoiceQueueRtPauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','Contact.phone','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\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','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','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','lodash','bluebird','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions'];(function(_0x143356,_0xf23621){var _0x3a7b92=function(_0x2b3762){while(--_0x2b3762){_0x143356['push'](_0x143356['shift']());}};_0x3a7b92(++_0xf23621);}(_0xe5c5,0x1ea));var _0x5e5c=function(_0x4070c7,_0xdc0dea){_0x4070c7=_0x4070c7-0x0;var _0x56bf2d=_0xe5c5[_0x4070c7];return _0x56bf2d;};'use strict';var util=require('util');var _=require(_0x5e5c('0x0'));var BPromise=require(_0x5e5c('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x5e5c('0x2'));var Redis=require(_0x5e5c('0x3'));var ut=require(_0x5e5c('0x4'));var config=require(_0x5e5c('0x5'));var logger=require(_0x5e5c('0x6'))(_0x5e5c('0x7'));var loggerBooked=require(_0x5e5c('0x6'))(_0x5e5c('0x8'));var loggerPredictive=require(_0x5e5c('0x6'))('predictive');var loggerPredictiveCalls=require(_0x5e5c('0x6'))(_0x5e5c('0x9'));var loggerSyncQueueSummary=require(_0x5e5c('0x6'))(_0x5e5c('0xa'));var ami=require(_0x5e5c('0xb'));config[_0x5e5c('0xc')]=_[_0x5e5c('0xd')](config[_0x5e5c('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e5c('0xc')]));var cmHopper=require(_0x5e5c('0xe'));var cmHopperFinal=require(_0x5e5c('0xf'));var cmHopperHistory=require(_0x5e5c('0x10'));var cmHopperBlack=require(_0x5e5c('0x11'));var voiceQueueRt=require(_0x5e5c('0x12'));var Action=require('./action');var History=require(_0x5e5c('0x13'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x5e5c('0x14')][_0x5e5c('0x15')]||_0x5e5c('0x16');var strategy={'rrmemory':_0x5e5c('0x17'),'roundrobin':_0x5e5c('0x18')};var Sequence=function(){};Sequence[_0x5e5c('0x19')]['enqueue']=function(_0x29000e){this[_0x5e5c('0x1a')]=this['tail']?this[_0x5e5c('0x1a')][_0x5e5c('0x1b')](_0x29000e):_0x29000e();};function Dialer(_0x37c092,_0x45d6c6){this[_0x5e5c('0x1c')]=new Sequence();this[_0x5e5c('0x1d')]=_0x45d6c6;this[_0x5e5c('0x1e')]=_0x37c092[_0x5e5c('0x1e')];this['campaigns']=_0x37c092[_0x5e5c('0x1f')];this[_0x5e5c('0x20')]=_0x37c092['agents'];this[_0x5e5c('0x21')]=_0x37c092[_0x5e5c('0x21')];this[_0x5e5c('0x22')]=config['maxNumberOriginate']||0x2;this[_0x5e5c('0x23')]={};this[_0x5e5c('0x24')]={};this[_0x5e5c('0x25')]={};this[_0x5e5c('0x26')]={};this[_0x5e5c('0x27')]={};this[_0x5e5c('0x28')]={};this[_0x5e5c('0x29')]={};this[_0x5e5c('0x2a')]={};this[_0x5e5c('0x2b')]={};this[_0x5e5c('0x2c')]={};ami['on']('agentconnect',this[_0x5e5c('0x2d')][_0x5e5c('0x2e')](this));ami['on'](_0x5e5c('0x2f'),this['syncQueueCallerAbandon'][_0x5e5c('0x2e')](this));ami['on'](_0x5e5c('0x30'),this[_0x5e5c('0x31')][_0x5e5c('0x2e')](this));ami['on'](_0x5e5c('0x32'),this['syncAgentComplete']['bind'](this));ami['on'](_0x5e5c('0x33'),this[_0x5e5c('0xa')][_0x5e5c('0x2e')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x5e5c('0x34'),this[_0x5e5c('0x35')][_0x5e5c('0x2e')](this));ami['on'](_0x5e5c('0x36'),this[_0x5e5c('0x37')][_0x5e5c('0x2e')](this));ami['on']('queuemember',this['syncQueueMember'][_0x5e5c('0x2e')](this));ami['on'](_0x5e5c('0x38'),this[_0x5e5c('0x39')][_0x5e5c('0x2e')](this));this[_0x5e5c('0x3a')]();this[_0x5e5c('0x3b')]();}function isNotNull(_0x2c4fc3){return _0x2c4fc3!==null&&!_['isUndefined'](_0x2c4fc3);}function checkIsLoggedIn(_0x10f877,_0x4c7343){return function(){if(_0x4c7343<=0x0){_0x10f877[_0x5e5c('0x3c')]='AGENTS_NOT_LOGGED';throw _0x10f877[_0x5e5c('0x3d')]+_0x5e5c('0x3e');}};}function isActive(_0x52fc43){return _0x52fc43;}function checkIsActive(_0x13e9cf,_0x17b653){return function(){if(!isActive(_0x17b653)){_0x13e9cf['message']=_0x5e5c('0x3f');throw _0x13e9cf[_0x5e5c('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2f4c4e){return function(){if(!isNotNull(_0x2f4c4e['Interval'])){_0x2f4c4e[_0x5e5c('0x3c')]=_0x5e5c('0x40');throw _0x2f4c4e['name']+_0x5e5c('0x41');}if(!isNotNull(_0x2f4c4e[_0x5e5c('0x42')][_0x5e5c('0x43')])){_0x2f4c4e[_0x5e5c('0x3c')]=_0x5e5c('0x40');throw _0x2f4c4e['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x5e5c('0x44')](_0x2f4c4e[_0x5e5c('0x42')][_0x5e5c('0x43')]))){_0x2f4c4e[_0x5e5c('0x3c')]=_0x5e5c('0x40');throw _0x2f4c4e[_0x5e5c('0x3d')]+_0x5e5c('0x41');}};}function msgResponse(_0x1a616a,_0x1213e5,_0x393412){return{'action':_0x1a616a,'response':_0x1213e5,'message':_0x393412,'stack':_0x393412};}function myreject(_0x366f33){return function(_0x194b7f){return _0x366f33(msgResponse('[ifTime][Action]',_0x5e5c('0x45'),JSON[_0x5e5c('0x46')](_0x194b7f)));};}function getSeconds(_0x1001ca,_0xaeb54d){var _0x32fba1=moment(_0x1001ca)['milliseconds'](0x0);var _0x32a33d=moment(_0xaeb54d)[_0x5e5c('0x47')](0x0);return _0x32fba1[_0x5e5c('0x48')](_0x32a33d,_0x5e5c('0x49'));}function emit(_0x4e95e9,_0x58d3d5,_0x4b79e8){io['to'](_0x4e95e9)[_0x5e5c('0x4a')](_0x58d3d5,_0x4b79e8);}function emitVoiceQueueSummary(_0x3eaa80){if(_0x3eaa80[_0x5e5c('0x4b')]==='outbound'){var _0x11b6ba={'id':_0x3eaa80['id'],'name':_0x3eaa80[_0x5e5c('0x3d')],'strategy':_0x3eaa80[_0x5e5c('0x4c')],'answered':_0x3eaa80[_0x5e5c('0x4d')],'available':_0x3eaa80[_0x5e5c('0x4e')],'loggedIn':_0x3eaa80[_0x5e5c('0x4f')],'pTalking':_0x3eaa80[_0x5e5c('0x50')],'sumBillable':_0x3eaa80[_0x5e5c('0x51')],'sumDuration':_0x3eaa80[_0x5e5c('0x52')],'sumHoldTime':_0x3eaa80['sumHoldTime']||0x0,'talking':_0x3eaa80[_0x5e5c('0x53')],'total':_0x3eaa80['total'],'type':_0x3eaa80[_0x5e5c('0x4b')],'unmanaged':_0x3eaa80[_0x5e5c('0x54')],'abandoned':_0x3eaa80[_0x5e5c('0x55')],'waiting':_0x3eaa80['waiting'],'loggedInDb':_0x3eaa80[_0x5e5c('0x56')],'dialActive':_0x3eaa80[_0x5e5c('0x57')],'dialMethod':_0x3eaa80[_0x5e5c('0x58')],'dialOriginateCallerIdName':_0x3eaa80['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3eaa80['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3eaa80[_0x5e5c('0x59')],'dialPrefix':_0x3eaa80[_0x5e5c('0x5a')],'outboundAnswerAgiCallsDay':_0x3eaa80[_0x5e5c('0x5b')],'outboundAnswerCallsDay':_0x3eaa80[_0x5e5c('0x5c')],'outboundBlacklistCallsDay':_0x3eaa80[_0x5e5c('0x5d')],'outboundBusyCallsDay':_0x3eaa80[_0x5e5c('0x5e')],'outboundCongestionCallsDay':_0x3eaa80['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3eaa80['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3eaa80[_0x5e5c('0x5f')],'outboundDropCallsDayTimeout':_0x3eaa80[_0x5e5c('0x60')],'outboundNoAnswerCallsDay':_0x3eaa80[_0x5e5c('0x61')],'outboundNoSuchCallsDay':_0x3eaa80[_0x5e5c('0x62')],'outboundOriginateFailureCallsDay':_0x3eaa80[_0x5e5c('0x63')],'outboundReCallsDay':_0x3eaa80[_0x5e5c('0x64')],'outboundRejectCallsDay':_0x3eaa80[_0x5e5c('0x65')],'outboundUnknownCallsDay':_0x3eaa80['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3eaa80[_0x5e5c('0x66')],'predictiveIntervalAvgHoldtime':_0x3eaa80[_0x5e5c('0x67')],'predictiveIntervalAvgTalktime':_0x3eaa80[_0x5e5c('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x3eaa80[_0x5e5c('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x3eaa80[_0x5e5c('0x6a')],'predictiveIntervalErlangCalls':_0x3eaa80[_0x5e5c('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x3eaa80[_0x5e5c('0x6c')],'predictiveIntervalHitRate':_0x3eaa80[_0x5e5c('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x3eaa80[_0x5e5c('0x6e')],'predictiveIntervalPauses':_0x3eaa80[_0x5e5c('0x6f')],'predictiveIntervalAvailable':_0x3eaa80[_0x5e5c('0x70')],'predictiveIntervalTotalCalls':_0x3eaa80[_0x5e5c('0x71')],'message':_0x3eaa80[_0x5e5c('0x3c')],'originated':_0x3eaa80[_0x5e5c('0x72')],'erlangCalls':_0x3eaa80[_0x5e5c('0x73')],'erlangCallToSecond':_0x3eaa80['erlangCallToSecond'],'erlangAbandonmentRate':_0x3eaa80['erlangAbandonmentRate'],'erlangBusyFactor':_0x3eaa80['erlangBusyFactor'],'startPredictive':_0x3eaa80[_0x5e5c('0x28')],'startProgressive':_0x3eaa80[_0x5e5c('0x29')]};if(_0x3eaa80['Trunk']){_0x11b6ba[_0x5e5c('0x74')]={'id':_0x3eaa80[_0x5e5c('0x74')]['id'],'name':_0x3eaa80[_0x5e5c('0x74')]['name'],'active':_0x3eaa80[_0x5e5c('0x74')]['active'],'callerid':_0x3eaa80[_0x5e5c('0x74')][_0x5e5c('0x75')]};}if(_0x3eaa80[_0x5e5c('0x42')]){_0x11b6ba[_0x5e5c('0x42')]={'id':_0x3eaa80[_0x5e5c('0x42')]['id'],'name':_0x3eaa80[_0x5e5c('0x42')][_0x5e5c('0x3d')]};}var _0x9b6105=md5(JSON[_0x5e5c('0x46')](_0x11b6ba));if(_0x3eaa80[_0x5e5c('0x2')]!==_0x9b6105){_0x3eaa80['md5']=_0x9b6105;emit(util['format'](_0x5e5c('0x76'),_0x11b6ba['name']),'voice_queue:save',_0x11b6ba);}}}function emitCampaignSummary(_0x1e6e40){if(_0x1e6e40[_0x5e5c('0x4b')]===_0x5e5c('0x77')){emit(util[_0x5e5c('0x78')](_0x5e5c('0x79'),_0x1e6e40[_0x5e5c('0x3d')]),_0x5e5c('0x7a'),_0x1e6e40);}}function checkGetDataPredictive(_0x17e8b9){if(isNotNull(_0x17e8b9)){if(!_[_0x5e5c('0x44')](_0x17e8b9)){loggerPredictive['info'](_0x5e5c('0x7b'));loggerPredictive['info'](_0x5e5c('0x7c'),_0x17e8b9['predictiveIntervalTotalCalls']);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x7e'),_0x17e8b9[_0x5e5c('0x66')]);loggerPredictive['info'](_0x5e5c('0x7f'),_0x17e8b9[_0x5e5c('0x6a')]);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x80'),_0x17e8b9['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5e5c('0x7d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17e8b9[_0x5e5c('0x67')]);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x81'),_0x17e8b9['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x17e8b9[_0x5e5c('0x71')]>0x0){if(!_['isUndefined'](_0x17e8b9[_0x5e5c('0x68')])&&_0x17e8b9['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x82'));}if(!_['isUndefined'](_0x17e8b9[_0x5e5c('0x67')])&&_0x17e8b9[_0x5e5c('0x67')]>0x0){return!![];}else{loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x83'));}}else{loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x84'));}}else{loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x85'));}}else{loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x85'));}return![];}function mergeDataErlangB(_0x71601a){return function(_0x352eeb){loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x86'));loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x87'),_0x352eeb[_0x5e5c('0x73')]);loggerPredictive['info'](_0x5e5c('0x88'),_0x352eeb[_0x5e5c('0x89')]);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x8a'),_0x352eeb[_0x5e5c('0x8b')]);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x8c'),_0x352eeb[_0x5e5c('0x8d')]);loggerPredictive['info'](_0x5e5c('0x8a'),_0x352eeb[_0x5e5c('0x8b')]);loggerPredictive[_0x5e5c('0x7d')]('---------------------------');_['merge'](_0x71601a,_0x352eeb);};}function getDiff(_0x3e9892){var _0x3a59b8=moment()['milliseconds'](0x0);var _0x58d951=moment(_0x3e9892)[_0x5e5c('0x47')](0x0);return _0x3a59b8[_0x5e5c('0x48')](_0x58d951,'seconds');}function ifInterval(_0x34dba0,_0x168067){if(_['isUndefined'](_0x168067)){return![];}if(getDiff(_0x168067)<_0x34dba0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xeb13f8){if(isNotNull(_0xeb13f8)){if(!_[_0x5e5c('0x8e')](_0xeb13f8[_0x5e5c('0x29')])){_0xeb13f8[_0x5e5c('0x29')]=undefined;loggerPredictive[_0x5e5c('0x7d')](_0xeb13f8['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x5e5c('0x8e')](_0xeb13f8[_0x5e5c('0x28')])){_0xeb13f8[_0x5e5c('0x28')]=undefined;loggerPredictive[_0x5e5c('0x7d')](_0xeb13f8[_0x5e5c('0x3d')],_0x5e5c('0x8f'));}if(!_['isUndefined'](_0xeb13f8[_0x5e5c('0x90')])){clearInterval(_0xeb13f8['handlePredictive']);_0xeb13f8[_0x5e5c('0x90')]=undefined;loggerPredictive['info'](_0xeb13f8[_0x5e5c('0x3d')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1577a8,_0x2609d5){if(_0x2609d5===0x0){return 0x0;}var _0x219e14=0x1;for(var _0x55c2db=0x1;_0x55c2db<=_0x2609d5;_0x55c2db+=0x1){_0x219e14=0x1+_0x219e14*_0x55c2db/_0x1577a8;}return 0x1/_0x219e14;}function isVoiceQueueOutbound(_0x29c7dc){return _0x29c7dc===_0x5e5c('0x91');}function isNotPreview(_0xa31610){return _0xa31610!=='preview';}function isCampaignIvr(_0x26b203){return _0x26b203===_0x5e5c('0x77');}function getCallerId(_0x21593a,_0x29c4cd,_0x492fe5){if(!_[_0x5e5c('0x8e')](_0x492fe5)&&_0x5e5c('0x92')===typeof _0x492fe5&&!_['isEmpty'](_0x492fe5)){if(!_[_0x5e5c('0x8e')](_0x29c4cd)&&'string'===typeof _0x29c4cd&&!_[_0x5e5c('0x44')](_0x29c4cd)){return util[_0x5e5c('0x78')](_0x5e5c('0x93'),_0x29c4cd,_0x492fe5);}return util[_0x5e5c('0x78')](_0x5e5c('0x93'),_0x492fe5,_0x492fe5);}if(!_[_0x5e5c('0x8e')](_0x21593a)&&_0x5e5c('0x92')===typeof _0x21593a&&!_['isEmpty'](_0x21593a)){return _0x21593a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x200afe,_0x408bd0){return function(_0x4b0d9b){freeVariablesPredictive(_0x408bd0);emitVoiceQueueSummary(_0x408bd0);emitCampaignSummary(_0x408bd0);loggerSyncQueueSummary[_0x5e5c('0x94')](_0x200afe,util[_0x5e5c('0x95')](_0x4b0d9b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4da57d,_0x29fac3){return function(_0x22c805){loggerPredictive[_0x5e5c('0x94')](_0x29fac3[_0x5e5c('0x3d')],_0x4da57d);loggerPredictive['error'](_0x22c805[_0x5e5c('0x96')]);freeVariablesPredictive(_0x29fac3);};}function loggerCatch(_0x3158a0){return function(_0x3afa2c){logger['error'](_0x3158a0,util['inspect'](_0x3afa2c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x148490){return _0x148490&&!_[_0x5e5c('0x8e')](_0x148490)&&_0x148490[_0x5e5c('0x97')]>0x0;}function decremetOriginate(_0x366fb7){if(!_[_0x5e5c('0x8e')](_0x366fb7)&&_0x366fb7!==null){if(_0x366fb7['hasOwnProperty'](_0x5e5c('0x72'))){if(_0x366fb7[_0x5e5c('0x72')]>0x0){_0x366fb7[_0x5e5c('0x72')]-=0x1;}else{logger[_0x5e5c('0x94')](_0x5e5c('0x98'));}}}else{logger[_0x5e5c('0x94')](_0x5e5c('0x99'));}}function checkContactLowerLimitOriginate(_0x299f56,_0x27b812,_0x424399){if(_0x27b812>_0x424399){for(var _0x545d15=0x0;_0x545d15<_0x27b812-_0x424399;_0x545d15+=0x1){decremetOriginate(_0x299f56);}}}function loggerGetContactDialer(_0x4bc97c,_0x378a00,_0x1f6af4){return function(_0x3533af){checkContactLowerLimitOriginate(_0x378a00,_0x1f6af4,0x0);logger['error'](_0x4bc97c,util['inspect'](_0x3533af,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xbdc8fa){return function(_0x129129){if(isNotNull(_0x129129)&&isNotNull(_0x129129[0x0])){if(_0x129129[0x0][_0x5e5c('0x9a')]>0x0){_0xbdc8fa[_0x5e5c('0x3c')]=_0x5e5c('0x9b');logger[_0x5e5c('0x7d')](_0x5e5c('0x9c')+_0xbdc8fa[_0x5e5c('0x3d')],_0x129129[0x0][_0x5e5c('0x9a')],_0x5e5c('0x9d'));}else{_0xbdc8fa[_0x5e5c('0x3c')]=_0x5e5c('0x9e');logger['info'](_0x5e5c('0x9f')+_0xbdc8fa[_0x5e5c('0x3d')]);}}};}function notSendMessagesQueue(_0x466b6a){if(_0x466b6a[_0x5e5c('0xa0')]){freeVariablesPredictive(_0x466b6a);if(_0x466b6a[_0x5e5c('0x72')]===0x0&&_0x466b6a[_0x5e5c('0x53')]===0x0&&_0x466b6a['waiting']===0x0&&(_0x466b6a['pTalking']||0x0)===0x0){_0x466b6a[_0x5e5c('0xa0')]=![];_0x466b6a[_0x5e5c('0x4e')]=0x0;_0x466b6a[_0x5e5c('0x3c')]=_0x5e5c('0x3f');loggerSyncQueueSummary[_0x5e5c('0x94')](_0x5e5c('0xa1'),_0x466b6a['name'],_0x5e5c('0xa2'));}else{_0x466b6a['message']=_0x5e5c('0xa3');loggerSyncQueueSummary[_0x5e5c('0x94')](_0x5e5c('0xa1'),_0x466b6a['name'],_0x5e5c('0xa4'));}emitVoiceQueueSummary(_0x466b6a);}}function notSendMessagesCampaign(_0xf8fedf){if(_0xf8fedf[_0x5e5c('0xa0')]){if(_0xf8fedf[_0x5e5c('0x72')]===0x0){_0xf8fedf[_0x5e5c('0xa0')]=![];_0xf8fedf[_0x5e5c('0x3c')]=_0x5e5c('0x3f');loggerSyncQueueSummary['error'](_0x5e5c('0xa5'),_0xf8fedf[_0x5e5c('0x3d')],_0x5e5c('0xa2'));}else{_0xf8fedf[_0x5e5c('0x3c')]=_0x5e5c('0xa3');loggerSyncQueueSummary['error'](_0x5e5c('0xa5'),_0xf8fedf[_0x5e5c('0x3d')],_0x5e5c('0xa4'));}emitCampaignSummary(_0xf8fedf);}}function createObjHistory(_0x3590e5,_0x2e77b3,_0x342d43,_0x5304f9,_0x319fee){_0x3590e5['message']=_0x342d43;var _0x5240c6=new Action(_0x3590e5,_0x2e77b3);var _0x1911d0=new History(_0x5240c6);_0x1911d0[_0x5e5c('0xa6')]=_0x5304f9;_0x1911d0[_0x5e5c('0xa7')]=_0x319fee;_0x1911d0[_0x5e5c('0xa8')]=_0x5240c6[_0x5e5c('0xa9')];return _0x1911d0;}Dialer[_0x5e5c('0x19')]['loopClearZombieChannels']=function(){var _0x4a7ea7=this;setInterval(function(){_0x4a7ea7['clearZombieChannels'](_0x4a7ea7[_0x5e5c('0x26')],_0x5e5c('0xaa'));_0x4a7ea7[_0x5e5c('0xab')](_0x4a7ea7[_0x5e5c('0x24')],'[actions]');},0x32c8);};Dialer[_0x5e5c('0x19')][_0x5e5c('0xab')]=function(_0x6f9f37,_0x3116fe){var _0x1aad19=this;for(var _0x445c80 in _0x6f9f37){if(_0x6f9f37['hasOwnProperty'](_0x445c80)){this[_0x5e5c('0x1c')][_0x5e5c('0xac')](function(){if(!_[_0x5e5c('0xad')](_0x6f9f37[_0x445c80])){return ami[_0x5e5c('0xae')]({'action':'status','channel':_0x6f9f37[_0x445c80]['channel']})[_0x5e5c('0xaf')](function(_0x1f3893){if(_0x1f3893[_0x5e5c('0x3c')]===_0x5e5c('0xb0')){setTimeout(function(){if(_0x6f9f37[_0x445c80]&&_0x6f9f37[_0x445c80][_0x5e5c('0x4b')]!==_0x5e5c('0x77')){_0x1aad19[_0x5e5c('0xb1')](_0x1aad19[_0x5e5c('0x1e')][_0x6f9f37[_0x445c80][_0x5e5c('0xb2')]]);logger[_0x5e5c('0x94')]('[Dialer][checkChannel]',_0x3116fe,_0x445c80,_0x6f9f37[_0x445c80]['queue']);delete _0x6f9f37[_0x445c80];}if(_0x6f9f37[_0x445c80]&&_0x6f9f37[_0x445c80][_0x5e5c('0x4b')]===_0x5e5c('0x77')){_0x1aad19[_0x5e5c('0xb1')](_0x1aad19['campaigns'][_0x6f9f37[_0x445c80][_0x5e5c('0xb2')]]);logger[_0x5e5c('0x94')]('[Dialer][checkChannel][ivr]',_0x3116fe,_0x445c80,_0x6f9f37[_0x445c80][_0x5e5c('0xb2')]);delete _0x6f9f37[_0x445c80];}},0x2328);}});}});}}};Dialer[_0x5e5c('0x19')][_0x5e5c('0xb3')]=function(_0x4ecdea){return BPromise[_0x5e5c('0xb4')]()[_0x5e5c('0xb5')](cmHopper[_0x5e5c('0xb3')](_0x4ecdea))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xb6')));};Dialer['prototype'][_0x5e5c('0xb7')]=function(_0x189606){return BPromise['resolve']()[_0x5e5c('0xb5')](cmHopperBlack[_0x5e5c('0xb7')](_0x189606))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xb8')));};Dialer[_0x5e5c('0x19')]['checkIsBlackListIvr']=function(_0x1f808e){return BPromise[_0x5e5c('0xb4')]()[_0x5e5c('0xb5')](cmHopperBlack[_0x5e5c('0xb9')](_0x1f808e))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xba')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0xbb')]=function(_0x18b718){return BPromise['resolve']()[_0x5e5c('0xb5')](cmHopperHistory[_0x5e5c('0xbc')](_0x18b718))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xbd')));};Dialer['prototype'][_0x5e5c('0xbe')]=function(_0x35e691){return BPromise['resolve']()[_0x5e5c('0xb5')](cmHopper['rescheduleContact'](_0x35e691))['catch'](loggerCatch(_0x5e5c('0xbf')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0xc0')]=function(_0x3beb92,_0xead19a,_0x1cf0dd){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x3beb92,_0xead19a,_0x1cf0dd))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc1')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0xc2')]=function(_0x5522ac,_0x5794bf,_0x3952b3,_0x3241f7){return BPromise[_0x5e5c('0xb4')]()[_0x5e5c('0xb5')](cmHopper[_0x5e5c('0xc2')](_0x5522ac,_0x5794bf,_0x3952b3,_0x3241f7))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc3')));};Dialer['prototype'][_0x5e5c('0xc4')]=function(_0x1752ea,_0x1f3c10,_0x2a2f7c){return BPromise[_0x5e5c('0xb4')]()['then'](cmHopper['getContactDialerIvr'](_0x1752ea,_0x1f3c10,_0x2a2f7c))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc3')));};Dialer[_0x5e5c('0x19')]['getVoiceQueueRtPauses']=function(_0x21fe99){return BPromise[_0x5e5c('0xb4')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x21fe99))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc5')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0xc6')]=function(_0x27fdf7){return BPromise[_0x5e5c('0xb4')]()[_0x5e5c('0xb5')](cmHopper['moveContactManagedDialer'](_0x27fdf7))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc7')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0xc8')]=function(_0x55c8f9){return BPromise[_0x5e5c('0xb4')]()['then'](cmHopperHistory['createHistory'](_0x55c8f9))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xc9')));};Dialer['prototype']['updateOriginated']=function(_0x21d864){if(!_[_0x5e5c('0x8e')](_0x21d864)&&_0x21d864!==null){if(_0x21d864[_0x5e5c('0xca')]('originated')){if(_0x21d864['originated']>0x0){_0x21d864['originated']-=0x1;}else{logger[_0x5e5c('0x94')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5e5c('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x5e5c('0x19')][_0x5e5c('0xcb')]=function(_0x39f51e,_0x545082){var _0x189b8e=this;return function(_0x504039){_0x189b8e[_0x5e5c('0xb1')](_0x545082);logger[_0x5e5c('0x94')](_0x39f51e,util[_0x5e5c('0x95')](_0x504039,{'showHidden':![],'depth':null}));};};Dialer[_0x5e5c('0x19')][_0x5e5c('0xcc')]=function(_0x54b1db,_0x564404,_0x3f0004){var _0x3c4a2b={'state':0x19,'statedesc':_0x5e5c('0xcd')};this[_0x5e5c('0xb1')](_0x564404);this[_0x5e5c('0xce')](_[_0x5e5c('0xcf')](_0x3c4a2b,_[_0x5e5c('0xd0')](_0x3f0004,[_0x5e5c('0xd1'),_0x5e5c('0xd2'),'UserId',_0x5e5c('0xd3'),_0x5e5c('0xd4')])),_0x5e5c('0xd5'),_0x5e5c('0xd6'));logger['error'](_0x54b1db);};Dialer[_0x5e5c('0x19')][_0x5e5c('0xd7')]=function(_0x2eda63){return _0x2eda63===_0x5e5c('0xd8');};Dialer['prototype'][_0x5e5c('0xd9')]=function(_0x204a4e){return!_[_0x5e5c('0x8e')](_0x204a4e)&&_0x204a4e&&!_['isUndefined'](_0x204a4e[_0x5e5c('0x3d')])&&!_['isUndefined'](_0x204a4e[_0x5e5c('0xda')])&&_0x204a4e[_0x5e5c('0xda')]&&(this[_0x5e5c('0x21')][util[_0x5e5c('0x78')]('SIP/%s',_0x204a4e['name'])]['status']==='reachable'||this[_0x5e5c('0x21')][util[_0x5e5c('0x78')](_0x5e5c('0xdb'),_0x204a4e[_0x5e5c('0x3d')])][_0x5e5c('0xdc')]==='unmonitored');};Dialer['prototype'][_0x5e5c('0xce')]=function(_0x284711,_0x56c4a2,_0x5518df){this['createHistory'](_0x284711)[_0x5e5c('0xaf')](loggerCatch(_0x56c4a2));this['moveContactManagedDialer'](_0x284711)[_0x5e5c('0xaf')](loggerCatch(_0x5518df));};Dialer[_0x5e5c('0x19')][_0x5e5c('0x37')]=function(_0xdafe2b){var _0x843b0d=this[_0x5e5c('0x26')][_0xdafe2b[_0x5e5c('0xdd')]];var _0x20c423;if(!_[_0x5e5c('0xad')](_0xdafe2b)&&!_[_0x5e5c('0xad')](_0xdafe2b[_0x5e5c('0xde')])&&!_[_0x5e5c('0xad')](_0xdafe2b['variable'][_0x5e5c('0xdf')])&&_0xdafe2b[_0x5e5c('0xe0')]==='xcally-motion-dialer'&&_0x843b0d){if(_0x843b0d[_0x5e5c('0x4b')]!==_0x5e5c('0x77')&&this['voiceQueues'][_0x843b0d['queue']][_0x5e5c('0xe1')]&&_0xdafe2b['value']===_0x5e5c('0xe2')){delete this['uniqueId'][_0xdafe2b['uniqueid']];this[_0x5e5c('0xb1')](this['voiceQueues'][_0x843b0d['queue']]);this['voiceQueues'][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0x5c')]+=0x1;this[_0x5e5c('0x1e')][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0x5b')]+=0x1;_0x20c423=new Hangup(_0x843b0d,_0xdafe2b);_0x20c423[_0x5e5c('0xa6')]=0x12;_0x20c423[_0x5e5c('0xa7')]=_0x5e5c('0xe3');_0x20c423['membername']=_0x5e5c('0xe4');this[_0x5e5c('0xce')](_0x20c423,_0x5e5c('0xe5'),_0x5e5c('0xe6'));}if(_0x843b0d['type']!==_0x5e5c('0x77')&&this[_0x5e5c('0x1e')][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0xe1')]&&_0xdafe2b[_0x5e5c('0xe7')]===_0x5e5c('0xe8')){var _0x28e42b=this;return new BPromise(function(_0x23bf38,_0x360ab1){delete _0x28e42b['uniqueId'][_0xdafe2b[_0x5e5c('0xdd')]];_0x28e42b[_0x5e5c('0xb1')](_0x28e42b[_0x5e5c('0x1e')][_0x843b0d[_0x5e5c('0xb2')]]);_0x28e42b[_0x5e5c('0x1e')][_0x843b0d['queue']]['outboundAnswerCallsDay']+=0x1;_0x28e42b[_0x5e5c('0x1e')][_0x843b0d[_0x5e5c('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3059bb=_0x28e42b['voiceQueues'][_0x843b0d[_0x5e5c('0xb2')]];var _0x3806a7=new Hangup(_0x843b0d,_0xdafe2b);_0x3806a7[_0x5e5c('0xa6')]=0x13;_0x3806a7['statedesc']=_0x5e5c('0xe9');_0x3806a7[_0x5e5c('0xea')]=_0x5e5c('0xe4');_0x3806a7[_0x5e5c('0xeb')]+=0x1;_0x3806a7[_0x5e5c('0xec')]+=0x1;_0x3806a7[_0x5e5c('0xed')]=!![];_0x28e42b[_0x5e5c('0xc8')](_0x3806a7)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xee')));if(_0x3806a7['countbusyretry']+_0x3806a7['countcongestionretry']+_0x3806a7[_0x5e5c('0xef')]+_0x3806a7[_0x5e5c('0xf0')]+_0x3806a7[_0x5e5c('0xf1')]+_0x3806a7[_0x5e5c('0xf2')]+_0x3806a7[_0x5e5c('0xeb')]+_0x3806a7['countagentrejectretry']>=_0x3059bb[_0x5e5c('0xf3')]){_0x28e42b[_0x5e5c('0xf4')](_0x3806a7,_0x23bf38,_0x360ab1,'reason19\x20machine....');}else{if(_0x3806a7[_0x5e5c('0xeb')]>=_0x3059bb[_0x5e5c('0xf5')]){_0x28e42b[_0x5e5c('0xf6')](_0x3806a7,_0x23bf38,_0x360ab1,_0x5e5c('0xf7'));}else{_0x28e42b[_0x5e5c('0xbe')]({'active':![],'countmachineretry':_0x3806a7['countmachineretry'],'scheduledat':moment()[_0x5e5c('0xf8')](_0x3059bb[_0x5e5c('0xf9')],'minutes')[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x3806a7['ContactId'],'ListId':_0x3806a7[_0x5e5c('0xd2')],'VoiceQueueId':_0x3806a7[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3806a7[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xfb')));_0x23bf38({'reschedule':0x1});}}});}if(_0x843b0d['type']===_0x5e5c('0x77')&&this['campaigns'][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0xe1')]&&_0xdafe2b[_0x5e5c('0xe7')]===_0x5e5c('0xe2')){delete this[_0x5e5c('0x26')][_0xdafe2b['uniqueid']];this[_0x5e5c('0xb1')](this[_0x5e5c('0x1f')][_0x843b0d[_0x5e5c('0xb2')]]);_0x20c423=new Hangup(_0x843b0d,_0xdafe2b);_0x20c423[_0x5e5c('0xa6')]=0x12;_0x20c423['statedesc']='HangupInAMD';_0x20c423[_0x5e5c('0xea')]=_0x5e5c('0xe4');this[_0x5e5c('0xce')](_0x20c423,_0x5e5c('0xfc'),_0x5e5c('0xfd'));}if(_0x843b0d[_0x5e5c('0x4b')]===_0x5e5c('0x77')&&this[_0x5e5c('0x1f')][_0x843b0d[_0x5e5c('0xb2')]]['dialAMDActive']&&_0xdafe2b[_0x5e5c('0xe7')]===_0x5e5c('0xe8')){var _0x28e42b=this;return new BPromise(function(_0x18504f,_0xbe4cd8){delete _0x28e42b[_0x5e5c('0x26')][_0xdafe2b[_0x5e5c('0xdd')]];_0x28e42b[_0x5e5c('0xb1')](_0x28e42b[_0x5e5c('0x1f')][_0x843b0d[_0x5e5c('0xb2')]]);_0x28e42b[_0x5e5c('0x1f')][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0x5c')]+=0x1;_0x28e42b['campaigns'][_0x843b0d[_0x5e5c('0xb2')]][_0x5e5c('0x5b')]+=0x1;var _0x1ff4ed=_0x28e42b['campaigns'][_0x843b0d[_0x5e5c('0xb2')]];var _0x49fe0e=new Hangup(_0x843b0d,_0xdafe2b);_0x49fe0e['state']=0x13;_0x49fe0e['statedesc']=_0x5e5c('0xe9');_0x49fe0e['membername']=_0x5e5c('0xe4');_0x49fe0e[_0x5e5c('0xeb')]+=0x1;_0x49fe0e[_0x5e5c('0xec')]+=0x1;_0x49fe0e[_0x5e5c('0xed')]=!![];_0x28e42b[_0x5e5c('0xc8')](_0x49fe0e)['catch'](loggerCatch(_0x5e5c('0xee')));if(_0x49fe0e[_0x5e5c('0xfe')]+_0x49fe0e[_0x5e5c('0xff')]+_0x49fe0e[_0x5e5c('0xef')]+_0x49fe0e['countnosuchnumberretry']+_0x49fe0e[_0x5e5c('0xf1')]+_0x49fe0e[_0x5e5c('0xf2')]+_0x49fe0e['countmachineretry']+_0x49fe0e[_0x5e5c('0x100')]>=_0x1ff4ed[_0x5e5c('0xf3')]){_0x28e42b[_0x5e5c('0xf4')](_0x49fe0e,_0x18504f,_0xbe4cd8,_0x5e5c('0x101'));}else{if(_0x49fe0e[_0x5e5c('0xeb')]>=_0x1ff4ed[_0x5e5c('0xf5')]){_0x28e42b[_0x5e5c('0xf6')](_0x49fe0e,_0x18504f,_0xbe4cd8,_0x5e5c('0xf7'));}else{_0x28e42b[_0x5e5c('0xbe')]({'active':![],'countmachineretry':_0x49fe0e[_0x5e5c('0xeb')],'scheduledat':moment()[_0x5e5c('0xf8')](_0x1ff4ed['dialMachineRetryFrequency'],_0x5e5c('0x102'))['format'](_0x5e5c('0xfa')),'ContactId':_0x49fe0e['ContactId'],'ListId':_0x49fe0e['ListId'],'VoiceQueueId':_0x49fe0e[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x49fe0e[_0x5e5c('0xd4')]||undefined})['catch'](loggerCatch(_0x5e5c('0xfb')));_0x18504f({'reschedule':0x1});}}});}}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x103')]=function(_0x55b7e5){var _0x2334f5=this[_0x5e5c('0x26')][_0x55b7e5[_0x5e5c('0xdd')]];var _0x3d57b1=this;var _0x335f95;if(_0x2334f5&&_0x2334f5[_0x5e5c('0x4b')]===_0x5e5c('0x77')){delete this[_0x5e5c('0x26')][_0x55b7e5[_0x5e5c('0xdd')]];this['updateOriginated'](this[_0x5e5c('0x1f')][_0x2334f5['queue']]);this[_0x5e5c('0x1f')][_0x2334f5[_0x5e5c('0xb2')]][_0x5e5c('0x104')]+=0x1;_0x335f95=new Hangup(_0x2334f5,_0x55b7e5);this[_0x5e5c('0xc8')](_0x335f95)[_0x5e5c('0xaf')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x5e5c('0xc6')](_0x335f95)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x105')));}if(_0x2334f5&&_0x2334f5['type']!=='ivr'&&isNotNull(this[_0x5e5c('0x1e')][_0x2334f5['queue']]['dialQueueProject'])){delete this[_0x5e5c('0x26')][_0x55b7e5[_0x5e5c('0xdd')]];this['updateOriginated'](this[_0x5e5c('0x1e')][_0x2334f5[_0x5e5c('0xb2')]]);this[_0x5e5c('0x1e')][_0x2334f5[_0x5e5c('0xb2')]][_0x5e5c('0x5c')]+=0x1;this[_0x5e5c('0x1e')][_0x2334f5[_0x5e5c('0xb2')]][_0x5e5c('0x5b')]+=0x1;_0x335f95=new Hangup(_0x2334f5,_0x55b7e5);_0x335f95[_0x5e5c('0xa6')]=0x10;_0x335f95['statedesc']=_0x5e5c('0x106');_0x335f95[_0x5e5c('0xea')]='AGI';this[_0x5e5c('0xc8')](_0x335f95)['catch'](loggerCatch(_0x5e5c('0x107')));this[_0x5e5c('0xc6')](_0x335f95)[_0x5e5c('0xaf')](loggerCatch('[syncHangupIvr]'));}if(_0x2334f5&&_0x2334f5[_0x5e5c('0x4b')]!==_0x5e5c('0x77')&&!isNotNull(this['voiceQueues'][_0x2334f5['queue']][_0x5e5c('0x108')])){delete this[_0x5e5c('0x26')][_0x55b7e5[_0x5e5c('0xdd')]];this[_0x5e5c('0xb1')](this['voiceQueues'][_0x2334f5['queue']]);this[_0x5e5c('0x1e')][_0x2334f5[_0x5e5c('0xb2')]][_0x5e5c('0x109')]+=0x1;_0x335f95=new Hangup(_0x2334f5,_0x55b7e5);_0x335f95[_0x5e5c('0xa6')]=0xc;_0x335f95[_0x5e5c('0xa7')]=_0x55b7e5[_0x5e5c('0x10a')];_0x335f95[_0x5e5c('0xea')]=_0x5e5c('0x10b');this['createHistory'](_0x335f95)[_0x5e5c('0xaf')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x5e5c('0xc6')](_0x335f95)[_0x5e5c('0xaf')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x10c')]=function(_0x2b66be){var _0x5bb951=this[_0x5e5c('0x26')][_0x2b66be[_0x5e5c('0xdd')]];var _0x7b714c=this;if(this[_0x5e5c('0x1e')][_0x2b66be[_0x5e5c('0xb2')]]){if(_0x5bb951&&_0x5bb951['type']!==_0x5e5c('0x77')){delete this[_0x5e5c('0x26')][_0x2b66be[_0x5e5c('0xdd')]];this[_0x5e5c('0x1e')][_0x2b66be[_0x5e5c('0xb2')]][_0x5e5c('0x5c')]+=0x1;var _0x2fd327=new AgentComplete(_0x5bb951,_0x2b66be);if(_0x2b66be[_0x5e5c('0x10d')]==='agent'){_0x2fd327[_0x5e5c('0x10e')]=this[_0x5e5c('0x1e')][_0x2b66be[_0x5e5c('0xb2')]]['dialQueueProject2']&&this['voiceQueues'][_0x2b66be['queue']]['dialAgiAfterHangupAgent']?moment()['format'](_0x5e5c('0xfa')):undefined;}this['createHistory'](_0x2fd327)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x5e5c('0xc6')](_0x2fd327)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x10f')));}}};Dialer['prototype'][_0x5e5c('0x2d')]=function(_0x3b46c9){if(this['voiceQueues'][_0x3b46c9[_0x5e5c('0xb2')]]){if(this[_0x5e5c('0x26')][_0x3b46c9['uniqueid']]&&this[_0x5e5c('0x26')][_0x3b46c9[_0x5e5c('0xdd')]]['type']!==_0x5e5c('0x77')){this[_0x5e5c('0xb1')](this[_0x5e5c('0x1e')][_0x3b46c9['queue']]);this[_0x5e5c('0x26')][_0x3b46c9[_0x5e5c('0xdd')]]['answertime']=moment()['format'](_0x5e5c('0xfa'));}}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x110')]=function(_0x10a363){this[_0x5e5c('0xc8')](_0x10a363)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x111')));this['moveContactManagedDialer'](_0x10a363)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x112')));};Dialer[_0x5e5c('0x19')][_0x5e5c('0x113')]=function(_0x3872fe){var _0x623e28=this[_0x5e5c('0x26')][_0x3872fe[_0x5e5c('0xdd')]];var _0x170c75=this;if(this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]]){if(_0x623e28&&_0x623e28[_0x5e5c('0x4b')]!==_0x5e5c('0x77')){delete this[_0x5e5c('0x26')][_0x3872fe['uniqueid']];this['updateOriginated'](this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]]);_0x623e28['droptime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x157a82=new QueueCallerAbandon(_0x623e28,_0x3872fe);if(getSeconds(_0x623e28[_0x5e5c('0x114')],_0x623e28['responsetime'])>=_0x623e28[_0x5e5c('0x115')]){this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x5e5c('0x1e')][_0x3872fe['queue']][_0x5e5c('0x60')]+=0x1;this[_0x5e5c('0x1e')][_0x3872fe['queue']][_0x5e5c('0x6c')]+=0x1;_0x157a82[_0x5e5c('0xa6')]=0xa;_0x157a82['statedesc']='Drop';_0x157a82[_0x5e5c('0x116')]='TIMEOUT';_0x157a82['agiafterat']=this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]][_0x5e5c('0x117')]?moment()[_0x5e5c('0x78')](_0x5e5c('0xfa')):undefined;_0x157a82['countdropretry']+=0x1;_0x157a82[_0x5e5c('0xec')]+=0x1;if(_0x157a82[_0x5e5c('0xf1')]>=this[_0x5e5c('0x1e')][_0x3872fe['queue']][_0x5e5c('0x118')]){this[_0x5e5c('0x110')](_0x157a82);}else{this[_0x5e5c('0xbe')]({'active':![],'countdropretry':_0x157a82[_0x5e5c('0xf1')],'scheduledat':moment()[_0x5e5c('0xf8')](this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]][_0x5e5c('0x119')],_0x5e5c('0x102'))[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x623e28['ContactId'],'ListId':_0x623e28['ListId'],'VoiceQueueId':_0x623e28[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x623e28[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x11a')));var _0x4c02ec=new History(_0x157a82);_0x4c02ec['state']=0xa;_0x4c02ec[_0x5e5c('0xa7')]=_0x5e5c('0x11b');_0x4c02ec[_0x5e5c('0xa9')]=moment()[_0x5e5c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c02ec[_0x5e5c('0xa8')]=_0x4c02ec['starttime'];_0x4c02ec[_0x5e5c('0x11c')]=_0x157a82[_0x5e5c('0x11c')];_0x4c02ec['calleridnum']=_0x157a82['calleridnum'];this[_0x5e5c('0xc8')](_0x4c02ec)['catch'](loggerCatch(_0x5e5c('0x11d')));}}else{this['voiceQueues'][_0x3872fe[_0x5e5c('0xb2')]][_0x5e5c('0x69')]+=0x1;this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x157a82['state']=0xb;_0x157a82[_0x5e5c('0xa7')]=_0x5e5c('0x11e');_0x157a82[_0x5e5c('0x116')]='CALLEREXIT';_0x157a82['countabandonedretry']+=0x1;_0x157a82['countglobal']+=0x1;if(_0x157a82['countabandonedretry']>=this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]][_0x5e5c('0x11f')]){this['queueCallerAbandonCreateState'](_0x157a82);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x157a82[_0x5e5c('0xf2')],'scheduledat':moment()[_0x5e5c('0xf8')](this[_0x5e5c('0x1e')][_0x3872fe[_0x5e5c('0xb2')]][_0x5e5c('0x120')],'minutes')[_0x5e5c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x623e28[_0x5e5c('0xd1')],'ListId':_0x623e28[_0x5e5c('0xd2')],'VoiceQueueId':_0x623e28['VoiceQueueId']||undefined,'CampaignId':_0x623e28[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x121')));var _0x4c02ec=new History(_0x157a82);_0x4c02ec['state']=0xb;_0x4c02ec[_0x5e5c('0xa7')]=_0x5e5c('0x11e');_0x4c02ec[_0x5e5c('0xa9')]=moment()[_0x5e5c('0x78')](_0x5e5c('0xfa'));_0x4c02ec['endtime']=_0x4c02ec[_0x5e5c('0xa9')];_0x4c02ec['calleridname']=_0x157a82[_0x5e5c('0x11c')];_0x4c02ec[_0x5e5c('0x122')]=_0x157a82['calleridnum'];this[_0x5e5c('0xc8')](_0x4c02ec)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x123')));}}}}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x35')]=function(_0x1221a7){if(this[_0x5e5c('0x24')][_0x1221a7[_0x5e5c('0xdd')]]){this[_0x5e5c('0x24')][_0x1221a7[_0x5e5c('0xdd')]][_0x5e5c('0x124')]=_0x1221a7['channel'];}if(this[_0x5e5c('0x26')][_0x1221a7[_0x5e5c('0xdd')]]){this[_0x5e5c('0x26')][_0x1221a7[_0x5e5c('0xdd')]][_0x5e5c('0x124')]=_0x1221a7[_0x5e5c('0x124')];}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x125')]=function(_0x22f67b){if(strategy[this[_0x5e5c('0x1e')][this['actions'][_0x22f67b['actionid']][_0x5e5c('0xb2')]][_0x5e5c('0x4c')]]===_0x5e5c('0x18')){if(this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]]&&_[_0x5e5c('0xad')](this[_0x5e5c('0x24')][_0x22f67b['actionid']][_0x5e5c('0x127')])&&_0x22f67b[_0x5e5c('0xdc')]==='1'&&_0x22f67b['paused']==='0'){if(this[_0x5e5c('0x20')][_0x22f67b['stateinterface']]){if(!this['agents'][_0x22f67b['stateinterface']][_0x5e5c('0x127')]){this[_0x5e5c('0x20')][_0x22f67b[_0x5e5c('0x128')]]['locked']=!![];this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]][_0x5e5c('0x127')]=!![];this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]][_0x5e5c('0x128')]=_0x22f67b['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]][_0x5e5c('0xb2')]][_0x5e5c('0x4c')]]||_0x5e5c('0x17'))==='rrmemory'){if(this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]]){if(this['agents'][_0x22f67b[_0x5e5c('0x128')]]){this['actions'][_0x22f67b[_0x5e5c('0x126')]]['stateinterface']=_0x22f67b['stateinterface'];if(_[_0x5e5c('0xad')](this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]][_0x5e5c('0xb2')]])){this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]]['queue']]=[];}this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x22f67b[_0x5e5c('0x126')]]['queue']]['push'](_[_0x5e5c('0xcf')](_[_0x5e5c('0xd0')](this['actions'][_0x22f67b['actionid']],[_0x5e5c('0x129'),'stateinterface']),{'status':_0x22f67b['status'],'paused':_0x22f67b['paused']}));}}}};function unlockQueueStatus(_0x38affa,_0x51ca7a){setTimeout(function(){if(_[_0x5e5c('0x8e')](_0x38affa[_0x5e5c('0x12a')])){loggerBooked['error'](_0x5e5c('0x12b'),_0x51ca7a);}_0x38affa['queueStatusComplete']=!![];loggerBooked[_0x5e5c('0x7d')](_0x5e5c('0x12c'),_0x51ca7a,JSON[_0x5e5c('0x46')](_['pick'](_0x38affa,['name',_0x5e5c('0x12a')])));},0x1f3);}Dialer[_0x5e5c('0x19')][_0x5e5c('0x39')]=function(_0x4d3bfa){var _0x1aa641=this;var _0x55522e=_0x1aa641[_0x5e5c('0x1e')][_0x1aa641[_0x5e5c('0x24')][_0x4d3bfa['actionid']]['queue']];if(strategy[this[_0x5e5c('0x1e')][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['queue']][_0x5e5c('0x4c')]]==='roundrobin'){if(this[_0x5e5c('0x24')][_0x4d3bfa['actionid']]&&this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0x128')]){this['preview'][_0x5e5c('0x12d')](this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['idHopper'],this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0x128')])[_0x5e5c('0xaf')](function(_0x30e386){logger['error'](_0x5e5c('0x12e'),util[_0x5e5c('0x95')](_0x30e386,{'showHidden':![],'depth':null}));})[_0x5e5c('0x1b')](function(){_0x1aa641[_0x5e5c('0xb1')](_0x1aa641[_0x5e5c('0x1e')][_0x1aa641[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['queue']]);_0x1aa641[_0x5e5c('0x20')][_0x1aa641[_0x5e5c('0x24')][_0x4d3bfa['actionid']][_0x5e5c('0x128')]][_0x5e5c('0x127')]=![];delete _0x1aa641[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]];unlockQueueStatus(_0x55522e);});}else{this[_0x5e5c('0xb1')](this[_0x5e5c('0x1e')][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4d3bfa['actionid']][_0x5e5c('0xd1')],'ListId':this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xd2')],'VoiceQueueId':this[_0x5e5c('0x24')][_0x4d3bfa['actionid']][_0x5e5c('0xd3')]||undefined,'CampaignId':this['actions'][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x12f')));delete this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]];unlockQueueStatus(_0x55522e);}}else if((strategy[this['voiceQueues'][this['actions'][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]][_0x5e5c('0x4c')]]||_0x5e5c('0x17'))==='rrmemory'){var _0x573a79;if(this[_0x5e5c('0x24')][_0x4d3bfa['actionid']]&&!_[_0x5e5c('0x44')](this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['queue']])){if(this['queueBookedRR'][_0x1aa641[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]]){this[_0x5e5c('0x2c')][_0x1aa641[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]]=this[_0x5e5c('0x2c')][this['actions'][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]]?this[_0x5e5c('0x2c')][this[_0x5e5c('0x24')][_0x4d3bfa['actionid']][_0x5e5c('0xb2')]]:this['queueBooked'][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]]?this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]]['queue']][_0x5e5c('0x130')]||0x0:0x0;}this[_0x5e5c('0x2b')][this[_0x5e5c('0x24')][_0x4d3bfa[_0x5e5c('0x126')]][_0x5e5c('0xb2')]][_0x5e5c('0x130')]=this['queueBookedRR'][this['actions'][_0x4d3bfa['actionid']][_0x5e5c('0xb2')]];for(var _0x3f0fc8=0x0;_0x3f0fc8=0x0?!![]:![];})[_0x5e5c('0xaf')](myreject(_0x2719d3)));}}else{_0x1c5c69[_0x5e5c('0x145')](ami[_0x5e5c('0xae')]({'action':_0x5e5c('0x149'),'command':util['format'](_0x5e5c('0x14a'),_0x310d9d,!_[_0x5e5c('0x8e')](config[_0x5e5c('0x143')][_0x3e04c2])?_0x3e04c2:'')})[_0x5e5c('0xb5')](function(_0x4341a6){return _0x4341a6[_0x5e5c('0x14b')][_0x5e5c('0x147')]('true')>=0x0?!![]:![];})[_0x5e5c('0xaf')](myreject(_0x2719d3)));}BPromise['all'](_0x1c5c69)['then'](function(_0xc47a94){var _0x385d34=_['some'](_0xc47a94);if(_0x385d34){return _0x407a7b(_0x385d34);}else{_0x9666fa[_0x5e5c('0x3c')]=_0x415ed5?_0x5e5c('0x14c'):_0x5e5c('0x14d');return _0x2719d3(msgResponse(_0x5e5c('0x14e'),_0x5e5c('0x13f'),_0x5e5c('0x14f')+_0x415ed5+'\x20'+_0x2e9473+_0x5e5c('0x150')+util['inspect'](_0x310d9d,{'showHidden':![],'depth':null})+_0x5e5c('0x151')+_0x3e04c2));}})['catch'](function(_0x1d7450){return _0x2719d3(msgResponse('ifTime',_0x5e5c('0x13f'),JSON[_0x5e5c('0x46')](_0x1d7450)));});});};Dialer['prototype']['checkDialMethod']=function(_0x18f899){var _0x54b577=this;return function(){switch(_0x18f899['dialMethod']){case _0x5e5c('0x152'):freeVariablesPredictive(_0x18f899);_0x54b577[_0x5e5c('0x153')](_0x18f899,0x1);break;case'power':freeVariablesPredictive(_0x18f899);_0x54b577['handlePower'](_0x18f899,_0x18f899[_0x5e5c('0x154')]);break;case'predictive':_0x54b577[_0x5e5c('0x155')](_0x18f899);break;case _0x5e5c('0x8'):freeVariablesPredictive(_0x18f899);_0x54b577[_0x5e5c('0x153')](_0x18f899,0x1);break;default:freeVariablesPredictive(_0x18f899);logger[_0x5e5c('0x94')](_0x5e5c('0x156'),_0x18f899[_0x5e5c('0x3d')],_0x5e5c('0x157'));}};};Dialer['prototype'][_0x5e5c('0x158')]=function(_0x2056d7){var _0x4f9760=this;return function(){_0x4f9760[_0x5e5c('0x159')](_0x2056d7);};};Dialer[_0x5e5c('0x19')]['syncQueueSummary']=function(_0x39c464){var _0x2a9ce3=this;if(isNotPreview(_0x39c464[_0x5e5c('0x58')])){if(isVoiceQueueOutbound(_0x39c464[_0x5e5c('0x4b')])&&isActive(_0x39c464['dialActive'])){_0x39c464[_0x5e5c('0xa0')]=!![];BPromise[_0x5e5c('0xb4')]()['then'](checkIsLoggedIn(_0x39c464,_0x39c464[_0x5e5c('0x4f')]))[_0x5e5c('0xb5')](checkIsActive(_0x39c464,_0x39c464[_0x5e5c('0x57')]))[_0x5e5c('0xb5')](checkInterval(_0x39c464))[_0x5e5c('0xb5')](_0x2a9ce3[_0x5e5c('0x15a')](_0x39c464))[_0x5e5c('0xb5')](_0x2a9ce3[_0x5e5c('0x13c')](_0x39c464[_0x5e5c('0x15b')],_0x39c464['dialTimezone'],_0x39c464[_0x5e5c('0x3d')],_0x39c464))[_0x5e5c('0xb5')](_0x2a9ce3[_0x5e5c('0x13e')](_0x39c464[_0x5e5c('0x42')],_0x39c464[_0x5e5c('0x15c')],_0x39c464[_0x5e5c('0x3d')],_0x39c464))[_0x5e5c('0xb5')](_0x2a9ce3['checkDialMethod'](_0x39c464))[_0x5e5c('0xaf')](loggerCatchQueueSummary(_0x5e5c('0x15d'),_0x39c464));}else{notSendMessagesQueue(_0x39c464);}}else{freeVariablesPredictive(_0x39c464);}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x15e')]=function(){var _0x88cd8c=this;var _0x3b8e43;for(var _0x10a9dd in this[_0x5e5c('0x1f')]){if(this[_0x5e5c('0x1f')]['hasOwnProperty'](_0x10a9dd)){_0x3b8e43=this[_0x5e5c('0x1f')][_0x10a9dd];if(isCampaignIvr(_0x3b8e43[_0x5e5c('0x4b')])&&isActive(_0x3b8e43[_0x5e5c('0xda')])){_0x3b8e43[_0x5e5c('0xa0')]=!![];BPromise[_0x5e5c('0xb4')]()[_0x5e5c('0xb5')](checkIsActive(_0x3b8e43,_0x3b8e43[_0x5e5c('0xda')]))[_0x5e5c('0xb5')](checkInterval(_0x3b8e43))[_0x5e5c('0xb5')](_0x88cd8c[_0x5e5c('0x15a')](_0x3b8e43))[_0x5e5c('0xb5')](_0x88cd8c['checkIfTime'](_0x3b8e43[_0x5e5c('0x15b')],_0x3b8e43['dialTimezone'],_0x3b8e43[_0x5e5c('0x3d')],_0x3b8e43))['then'](_0x88cd8c[_0x5e5c('0x13e')](_0x3b8e43[_0x5e5c('0x42')],_0x3b8e43[_0x5e5c('0x15c')],_0x3b8e43[_0x5e5c('0x3d')],_0x3b8e43))[_0x5e5c('0xb5')](_0x88cd8c[_0x5e5c('0x158')](_0x3b8e43))[_0x5e5c('0xaf')](loggerCatchQueueSummary('[syncCampaigns]',_0x3b8e43));}else{notSendMessagesCampaign(_0x3b8e43);}}}};function getCallerIdRandom(_0x5386b7,_0x4818ca){var _0x196b1d,_0xc39ed,_0x43c357;if(_0x4818ca<=0x0){_0x4818ca=0x1;}_0x196b1d=new RegExp(_0x5e5c('0x15f')+_0x4818ca+'}$');_0xc39ed=Math['pow'](0xa,_0x4818ca-0x1);_0x43c357=Math['pow'](0xa,_0x4818ca)-0x1;return util[_0x5e5c('0x78')]('%s',_[_0x5e5c('0x160')](_0x5386b7,_0x196b1d,_[_0x5e5c('0x161')](_0xc39ed,_0x43c357)));}function extractCalleridName(_0x3794fc){var _0x249cad=_0x3794fc[_0x5e5c('0x162')](/"(.*?)"/);return _0x249cad?_0x249cad[0x1]:_0x3794fc;}function extractCalleridNumber(_0x2c84bc){var _0x32e3e5=_0x2c84bc['match'](/<(.*?)>/);return _0x32e3e5?_0x32e3e5[0x1]:_0x2c84bc;}Dialer[_0x5e5c('0x19')][_0x5e5c('0x163')]=function(_0x124b90,_0x8ca58d){var _0x46d4e8=this;var _0x5073a3=uuid['v4']();this[_0x5e5c('0x24')][_0x5073a3]=new Action(_0x124b90,_0x8ca58d,_0x5073a3);return new BPromise(function(_0x2f6f11,_0x1a76f3){if(_[_0x5e5c('0x8e')](_0x124b90)&&_0x5e5c('0x164')!==typeof _0x124b90){return _0x1a76f3(msgResponse(_0x5e5c('0x165'),'Failure',_0x5e5c('0x166')));}if(_[_0x5e5c('0x8e')](_0x8ca58d[_0x5e5c('0x167')]['phone'])||_0x8ca58d['Contact'][_0x5e5c('0x168')]===null){return _0x1a76f3(msgResponse(_0x5e5c('0x165'),_0x5e5c('0x13f'),_0x5e5c('0x169')));}var _0x4a0a0e={'XMD-CALLERID':_0x46d4e8[_0x5e5c('0x24')][_0x5073a3][_0x5e5c('0x16a')](),'XMD-AGI':_0x124b90[_0x5e5c('0x108')]?util['format'](_0x5e5c('0x16b'),ipAgi,_0x124b90[_0x5e5c('0x108')]):_0x5e5c('0x16c'),'XMD-AGIAFTER':_0x124b90[_0x5e5c('0x117')]?util[_0x5e5c('0x78')](_0x5e5c('0x16b'),ipAgi,_0x124b90['dialQueueProject2']):_0x5e5c('0x16c'),'XMD-QUEUE':_0x124b90[_0x5e5c('0x4b')]===_0x5e5c('0x91')?util[_0x5e5c('0x78')](_0x5e5c('0x16d'),_0x124b90[_0x5e5c('0x3d')],_0x124b90[_0x5e5c('0x16e')]||'',_0x124b90[_0x5e5c('0x16f')]?'c':'',_0x124b90[_0x5e5c('0x115')]||0x3):'NONE','XMD-CONTACTID':_0x8ca58d[_0x5e5c('0xd1')],'XMD-CDRTYPE':_0x5e5c('0x7'),'CALLERID(all)':_0x46d4e8['actions'][_0x5073a3][_0x5e5c('0x16a')](),'XMD-AMD':_0x124b90[_0x5e5c('0xe1')]?_0x5e5c('0x170'):_0x5e5c('0x16c'),'XMD-DESTINATION':_0x5e5c('0x171')};if(_0x124b90['dialAMDActive']){_0x4a0a0e['XMD-AMDINITIALSILENCE']=_0x124b90['dialAMDInitialSilence']||0x9c4;_0x4a0a0e[_0x5e5c('0x172')]=_0x124b90['dialAMDGreeting']||0x5dc;_0x4a0a0e[_0x5e5c('0x173')]=_0x124b90[_0x5e5c('0x174')]||0x320;_0x4a0a0e['XMD-AMDTOTALANALYSISTIME']=_0x124b90[_0x5e5c('0x175')]||0x1388;_0x4a0a0e[_0x5e5c('0x176')]=_0x124b90['dialAMDMinWordLength']||0x64;_0x4a0a0e[_0x5e5c('0x177')]=_0x124b90[_0x5e5c('0x178')]||0x32;_0x4a0a0e[_0x5e5c('0x179')]=_0x124b90[_0x5e5c('0x17a')]||0x3;_0x4a0a0e['XMD-AMDSILENCETHRESHOLD']=_0x124b90[_0x5e5c('0x17b')]||0x100;_0x4a0a0e[_0x5e5c('0x17c')]=_0x124b90['dialAMDMaximumWordLength']||0x1388;}if(_0x124b90[_0x5e5c('0x4b')]===_0x5e5c('0x91')){_0x4a0a0e['XMD-VOICEQUEUEID']=_0x8ca58d[_0x5e5c('0xd3')];}else{_0x4a0a0e['XMD-CAMPAIGNID']=_0x8ca58d[_0x5e5c('0xd4')];}for(var _0x12872b in _0x8ca58d[_0x5e5c('0x167')]){if(_0x8ca58d['Contact'][_0x5e5c('0xca')](_0x12872b)){if(isNotNull(_0x8ca58d[_0x5e5c('0x167')][_0x12872b])&&_0x12872b!=='id'&&_0x12872b!==_0x5e5c('0x17d')&&_0x12872b!==_0x5e5c('0x17e')&&_0x12872b!==_0x5e5c('0x17f')){_0x4a0a0e[util[_0x5e5c('0x78')]('%s%s',_0x5e5c('0x180'),_['toUpper'](_0x12872b))]=_0x8ca58d[_0x5e5c('0x167')][_0x12872b];}}}var _0x109b65=_0x46d4e8[_0x5e5c('0xd9')](_0x124b90['Trunk'])?getCallerId(_0x124b90['Trunk'][_0x5e5c('0x75')],_0x124b90[_0x5e5c('0x181')],_0x124b90[_0x5e5c('0x182')]>0x0?getCallerIdRandom(_0x124b90['dialOriginateCallerIdNumber'],_0x124b90[_0x5e5c('0x182')]):_0x124b90[_0x5e5c('0x183')]):getCallerId(_[_0x5e5c('0xad')](_0x124b90[_0x5e5c('0x13a')])?_0x124b90[_0x5e5c('0x74')][_0x5e5c('0x75')]:_0x124b90[_0x5e5c('0x13a')][_0x5e5c('0x75')],_0x124b90[_0x5e5c('0x181')],_0x124b90[_0x5e5c('0x182')]>0x0?getCallerIdRandom(_0x124b90['dialOriginateCallerIdNumber'],_0x124b90[_0x5e5c('0x182')]):_0x124b90[_0x5e5c('0x183')]);if(_0x109b65){_0x4a0a0e[_0x5e5c('0x184')]=_0x46d4e8[_0x5e5c('0x24')][_0x5073a3][_0x5e5c('0x185')]=extractCalleridName(_0x109b65);_0x4a0a0e[_0x5e5c('0x186')]=_0x46d4e8[_0x5e5c('0x24')][_0x5073a3][_0x5e5c('0x187')]=extractCalleridNumber(_0x109b65);}return ami[_0x5e5c('0xae')]({'actionid':_0x5073a3,'action':_0x5e5c('0x165'),'channel':_0x46d4e8['isTrunkReachable'](_0x124b90[_0x5e5c('0x74')])?util[_0x5e5c('0x78')]('SIP/%s/%s%s',_0x124b90[_0x5e5c('0x74')][_0x5e5c('0x3d')],isNotNull(_0x124b90[_0x5e5c('0x5a')])?_0x124b90[_0x5e5c('0x5a')][_0x5e5c('0x188')]()||'':'',_0x124b90[_0x5e5c('0x189')]>0x0?_0x8ca58d[_0x5e5c('0x167')][_0x5e5c('0x168')][_0x5e5c('0x18a')](_0x124b90[_0x5e5c('0x189')]):_0x8ca58d['Contact'][_0x5e5c('0x168')]):util[_0x5e5c('0x78')]('SIP/%s/%s%s',_['isNil'](_0x124b90[_0x5e5c('0x13a')])?_0x124b90[_0x5e5c('0x74')][_0x5e5c('0x3d')]:_0x124b90[_0x5e5c('0x13a')][_0x5e5c('0x3d')],isNotNull(_0x124b90[_0x5e5c('0x5a')])?_0x124b90['dialPrefix'][_0x5e5c('0x188')]()||'':'',_0x124b90['dialCutDigit']>0x0?_0x8ca58d[_0x5e5c('0x167')][_0x5e5c('0x168')][_0x5e5c('0x18a')](_0x124b90[_0x5e5c('0x189')]):_0x8ca58d[_0x5e5c('0x167')][_0x5e5c('0x168')]),'callerid':_0x109b65,'Exten':'xcally-motion-dialer','Context':_0x5e5c('0x18b'),'Priority':'1','variable':_0x4a0a0e,'timeout':(_0x124b90[_0x5e5c('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5073a3})['then'](function(_0xa7b6a8){return _0x2f6f11(_0xa7b6a8);})[_0x5e5c('0xaf')](function(_0x303bb7){_0x124b90[_0x5e5c('0x63')]+=0x1;var _0x52cad0=new History(_0x46d4e8['actions'][_0x5073a3]);logger[_0x5e5c('0x94')](util[_0x5e5c('0x78')](_0x5e5c('0x18c'),JSON[_0x5e5c('0x46')](_0x303bb7)));_0x52cad0['state']=0xe;_0x52cad0[_0x5e5c('0xa7')]=_0x5e5c('0x18d');_0x52cad0[_0x5e5c('0xa9')]=moment()[_0x5e5c('0x78')](_0x5e5c('0xfa'));_0x52cad0[_0x5e5c('0xa8')]=_0x52cad0[_0x5e5c('0xa9')];_0x46d4e8[_0x5e5c('0xc8')](_0x52cad0)[_0x5e5c('0xaf')](loggerCatch('[originate][error]'));_0x46d4e8[_0x5e5c('0xc6')](_0x52cad0)['catch'](loggerCatch('[originate][error]'))[_0x5e5c('0x1b')](function(){delete _0x46d4e8[_0x5e5c('0x24')][_0x5073a3];return _0x1a76f3(msgResponse('originate',_0x5e5c('0x45'),_0x5e5c('0x18e')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x19ee0c){var _0x506f9b=this[_0x5e5c('0x24')][_0x19ee0c[_0x5e5c('0x126')]];var _0x5499a4=this;if(_0x506f9b){delete this[_0x5e5c('0x24')][_0x19ee0c[_0x5e5c('0x126')]];_0x506f9b[_0x5e5c('0x18f')]=moment()[_0x5e5c('0x78')](_0x5e5c('0xfa'));var _0x1f9ea2=_0x506f9b[_0x5e5c('0x4b')]===_0x5e5c('0x77')?this[_0x5e5c('0x1f')][_0x506f9b[_0x5e5c('0xb2')]]:this[_0x5e5c('0x1e')][_0x506f9b['getQueue']()];if(!this[_0x5e5c('0xd7')](_0x19ee0c[_0x5e5c('0x190')])){this[_0x5e5c('0xb1')](_0x1f9ea2);return this['callProgressDetecting'](_0x506f9b,_0x1f9ea2,_0x19ee0c)[_0x5e5c('0xb5')](function(_0x1825bf){})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x191')));}else{this[_0x5e5c('0x26')][_0x19ee0c[_0x5e5c('0xdd')]]=_0x506f9b;}}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x192')]=function(_0x153cbf,_0x2b62e9,_0x38bbbb){var _0x3ca772=new History(_0x2b62e9);if(_0x3ca772['countbusyretry']+_0x3ca772[_0x5e5c('0xff')]+_0x3ca772[_0x5e5c('0xef')]+_0x3ca772['countnosuchnumberretry']+_0x3ca772[_0x5e5c('0xf1')]+_0x3ca772[_0x5e5c('0xf2')]+_0x3ca772['countmachineretry']+_0x3ca772[_0x5e5c('0x100')]>=_0x38bbbb[_0x5e5c('0xf3')]-0x1){return!![];}switch(_0x153cbf){case 0x3:if(_0x3ca772['countnoanswerretry']>=_0x38bbbb[_0x5e5c('0x193')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3ca772['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb['dialNoAnswerRetryFrequency'],_0x5e5c('0x102'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x3ca772[_0x5e5c('0xfe')]>=_0x38bbbb[_0x5e5c('0x194')]-0x1){return!![];}else{this[_0x5e5c('0xbe')]({'active':![],'countbusyretry':_0x3ca772[_0x5e5c('0xfe')]+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb[_0x5e5c('0x195')],_0x5e5c('0x102'))[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772['CampaignId']||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x196')));}break;case 0x8:if(_0x3ca772[_0x5e5c('0xff')]>=_0x38bbbb[_0x5e5c('0x197')]-0x1){return!![];}else{this[_0x5e5c('0xbe')]({'active':![],'countcongestionretry':_0x3ca772[_0x5e5c('0xff')]+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb['dialCongestionRetryFrequency'],_0x5e5c('0x102'))[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772['CampaignId']||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x198')));}break;case 0x0:if(_0x3ca772['countnosuchnumberretry']>=_0x38bbbb['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3ca772['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x38bbbb[_0x5e5c('0x199')],_0x5e5c('0x102'))[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x19a')));}break;case 0xa:if(_0x3ca772[_0x5e5c('0xf1')]>=_0x38bbbb['dialDropMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3ca772[_0x5e5c('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x38bbbb['dialDropRetryFrequency'],_0x5e5c('0x102'))['format'](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772['ListId'],'VoiceQueueId':_0x3ca772['VoiceQueueId']||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x11a')));}break;case 0xb:if(_0x3ca772[_0x5e5c('0xf2')]>=_0x38bbbb['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x5e5c('0xbe')]({'active':![],'countabandonedretry':_0x3ca772[_0x5e5c('0xf2')]+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb[_0x5e5c('0x120')],_0x5e5c('0x102'))[_0x5e5c('0x78')](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772['VoiceQueueId']||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x3ca772[_0x5e5c('0xeb')]>=_0x38bbbb[_0x5e5c('0xf5')]-0x1){return!![];}else{this[_0x5e5c('0xbe')]({'active':![],'countmachineretry':_0x3ca772[_0x5e5c('0xeb')]+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb['dialMachineRetryFrequency'],_0x5e5c('0x102'))['format'](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xfb')));}break;case 0x14:if(_0x3ca772[_0x5e5c('0x100')]>=_0x38bbbb['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x5e5c('0xbe')]({'active':![],'countagentrejectretry':_0x3ca772[_0x5e5c('0x100')]+=0x1,'scheduledat':moment()[_0x5e5c('0xf8')](_0x38bbbb['dialAgentRejectRetryFrequency'],_0x5e5c('0x102'))['format'](_0x5e5c('0xfa')),'ContactId':_0x3ca772[_0x5e5c('0xd1')],'ListId':_0x3ca772[_0x5e5c('0xd2')],'VoiceQueueId':_0x3ca772[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x3ca772[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x19b')));}break;default:return!![];}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x19c')]=function(_0x617843,_0x23e6eb,_0xa6d40){var _0x4b18c6=this;var _0xc6c346=new History(_0x617843);return new BPromise(function(_0x1e2566,_0x43b6aa){if(_[_0x5e5c('0x8e')](_0x23e6eb)&&_0x5e5c('0x164')!==typeof _0x23e6eb){return _0x43b6aa(msgResponse(_0x5e5c('0x19d'),_0x5e5c('0x13f'),_0x5e5c('0x19e')));}if(_[_0x5e5c('0x8e')](_0xa6d40)&&_0x5e5c('0x164')!==typeof _0xa6d40){return _0x43b6aa(msgResponse(_0x5e5c('0x19d'),_0x5e5c('0x13f'),_0x5e5c('0x19f')));}switch(_0xa6d40[_0x5e5c('0x10d')]){case'0':_0x23e6eb['outboundNoSuchCallsDay']+=0x1;_0xc6c346['state']=0x0;_0xc6c346[_0x5e5c('0xa7')]='NoSuchNumber';_0xc6c346['countnosuchnumberretry']+=0x1;_0xc6c346[_0x5e5c('0xec')]+=0x1;ami[_0x5e5c('0x4a')](_0x5e5c('0x1a0'),ut[_0x5e5c('0x1a1')](_0x617843,_0x5e5c('0x1a2')));_0x4b18c6['createHistory'](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xee')));if(_0x4b18c6[_0x5e5c('0x192')](0x0,_0x617843,_0x23e6eb)){if(_0xc6c346[_0x5e5c('0xf0')]>=_0x23e6eb[_0x5e5c('0x1a3')]){_0x4b18c6['createStateFinal'](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1a4'));}else{_0x4b18c6[_0x5e5c('0xf4')](_0xc6c346,_0x1e2566,_0x43b6aa,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x23e6eb[_0x5e5c('0x61')]+=0x1;_0xc6c346[_0x5e5c('0xa6')]=0x3;_0xc6c346['statedesc']=_0x5e5c('0x1a5');_0xc6c346[_0x5e5c('0xef')]+=0x1;_0xc6c346[_0x5e5c('0xec')]+=0x1;ami[_0x5e5c('0x4a')](_0x5e5c('0x1a6'),ut[_0x5e5c('0x1a1')](_0x617843,_0x5e5c('0x1a7')));_0x4b18c6[_0x5e5c('0xc8')](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1a8')));if(_0x4b18c6[_0x5e5c('0x192')](0x3,_0x617843,_0x23e6eb)){if(_0xc6c346[_0x5e5c('0xef')]>=_0x23e6eb['dialNoAnswerMaxRetry']){_0x4b18c6[_0x5e5c('0xf6')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1a9'));}else{_0x4b18c6['stateGlobal'](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1a9'));}}break;case'5':_0x23e6eb['outboundBusyCallsDay']+=0x1;_0xc6c346[_0x5e5c('0xa6')]=0x5;_0xc6c346['statedesc']=_0x5e5c('0x1aa');_0xc6c346[_0x5e5c('0xfe')]+=0x1;_0xc6c346[_0x5e5c('0xec')]+=0x1;ami[_0x5e5c('0x4a')](_0x5e5c('0x1ab'),ut[_0x5e5c('0x1a1')](_0x617843,'busy'));_0x4b18c6[_0x5e5c('0xc8')](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1ac')));if(_0x4b18c6['checkRetriveMax'](0x5,_0x617843,_0x23e6eb)){if(_0xc6c346[_0x5e5c('0xfe')]>=_0x23e6eb[_0x5e5c('0x194')]){_0x4b18c6[_0x5e5c('0xf6')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1ad'));}else{_0x4b18c6['stateGlobal'](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1ad'));}}break;case'8':_0x23e6eb[_0x5e5c('0x1ae')]+=0x1;_0xc6c346[_0x5e5c('0xa6')]=0x8;_0xc6c346[_0x5e5c('0xa7')]=_0x5e5c('0x1af');_0xc6c346['countcongestionretry']+=0x1;_0xc6c346['countglobal']+=0x1;ami[_0x5e5c('0x4a')](_0x5e5c('0x1b0'),ut[_0x5e5c('0x1a1')](_0x617843,_0x5e5c('0x1b1')));_0x4b18c6['createHistory'](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1b2')));if(_0x4b18c6[_0x5e5c('0x192')](0x8,_0x617843,_0x23e6eb)){if(_0xc6c346['countcongestionretry']>=_0x23e6eb[_0x5e5c('0x197')]){_0x4b18c6[_0x5e5c('0xf6')](_0xc6c346,_0x1e2566,_0x43b6aa,'reason\x208\x20congestion');}else{_0x4b18c6[_0x5e5c('0xf4')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1b3'));}}break;case'11':_0x23e6eb[_0x5e5c('0x1b4')]+=0x1;_0xc6c346['state']=0xb;_0xc6c346[_0x5e5c('0xa7')]='Abandoned';_0xc6c346[_0x5e5c('0xf2')]+=0x1;_0xc6c346[_0x5e5c('0xec')]+=0x1;_0x4b18c6[_0x5e5c('0xc8')](_0xc6c346)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4b18c6[_0x5e5c('0x192')](0xb,_0x617843,_0x23e6eb)){if(_0xc6c346[_0x5e5c('0xf2')]>=_0x23e6eb[_0x5e5c('0x11f')]){_0x4b18c6[_0x5e5c('0xf6')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1b5'));}else{_0x4b18c6[_0x5e5c('0xf4')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1b5'));}}break;case'20':_0x23e6eb[_0x5e5c('0x65')]+=0x1;_0xc6c346['state']=0x14;_0xc6c346[_0x5e5c('0xa7')]=_0x5e5c('0x1b6');_0xc6c346[_0x5e5c('0x100')]+=0x1;_0xc6c346['countglobal']+=0x1;ami[_0x5e5c('0x4a')]('custom:agentreject',ut[_0x5e5c('0x1a1')](_0x617843,_0x5e5c('0x1b7')));_0x4b18c6[_0x5e5c('0xc8')](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1b8')));if(_0x4b18c6[_0x5e5c('0x192')](0x14,_0x617843,_0x23e6eb)){if(_0xc6c346[_0x5e5c('0x100')]>=_0x23e6eb[_0x5e5c('0x1b9')]){_0x4b18c6[_0x5e5c('0xf6')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1ba'));}else{_0x4b18c6[_0x5e5c('0xf4')](_0xc6c346,_0x1e2566,_0x43b6aa,_0x5e5c('0x1ba'));}}break;default:_0x23e6eb[_0x5e5c('0x109')]+=0x1;_0xc6c346[_0x5e5c('0xa6')]=0xc;_0xc6c346[_0x5e5c('0xa7')]=_0xa6d40[_0x5e5c('0x10d')];_0x4b18c6['createHistory'](_0xc6c346)[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1bb')));if(_0x4b18c6[_0x5e5c('0x192')](_0xa6d40[_0x5e5c('0x10d')],_0x617843,_0x23e6eb)){if(_0xc6c346['countbusyretry']+_0xc6c346[_0x5e5c('0xff')]+_0xc6c346[_0x5e5c('0xef')]+_0xc6c346[_0x5e5c('0xf0')]+_0xc6c346[_0x5e5c('0xf1')]+_0xc6c346[_0x5e5c('0xf2')]+_0xc6c346['countmachineretry']+_0xc6c346[_0x5e5c('0x100')]>=_0x23e6eb[_0x5e5c('0xf3')]){_0x4b18c6[_0x5e5c('0xf4')](_0xc6c346,_0x1e2566,_0x43b6aa,_0xa6d40[_0x5e5c('0x10d')]);}else{_0x4b18c6['createStateFinal'](_0xc6c346,_0x1e2566,_0x43b6aa,_0xa6d40['reason']);}}}});};Dialer[_0x5e5c('0x19')][_0x5e5c('0xf4')]=function(_0x5b01f4,_0x283ff9,_0x546d8c,_0xfe73aa){var _0x5bfc50=new Final(_0x5b01f4);_0x5bfc50[_0x5e5c('0xa6')]=0xf;_0x5bfc50['statedesc']=_0x5e5c('0x1bc');this[_0x5e5c('0xf6')](_0x5bfc50,_0x283ff9,_0x546d8c,_0xfe73aa);};Dialer['prototype']['createStateFinal']=function(_0xea304d,_0x1aa962,_0x253383,_0x5eac5f){this['moveContactManagedDialer'](_0xea304d)['then'](function(_0x1531e1){return _0x1aa962(msgResponse(_0x5e5c('0x19d'),_0x5e5c('0xd8'),_0x5eac5f));})[_0x5e5c('0xaf')](function(_0x2459f6){return _0x253383(msgResponse(_0x5e5c('0x1bd'),'Failure',_0x5e5c('0x1be')));});};Dialer[_0x5e5c('0x19')]['predictive']=function(_0x4054f9){var _0x12ec84=this;var _0x553451=_0x4054f9['dialPredictiveOptimizationPercentage']/0x64;var _0x57a318=_0x4054f9[_0x5e5c('0x60')]/(_0x4054f9['outboundDropCallsDayTimeout']+_0x4054f9[_0x5e5c('0x5c')]);var _0x2a1c21=Math[_0x5e5c('0x1bf')](_0x4054f9[_0x5e5c('0x70')]*(_0x4054f9[_0x5e5c('0x1c0')]/0x64));var _0x138b25=Math['round'](_0x4054f9[_0x5e5c('0x70')]*(_0x4054f9[_0x5e5c('0x1c1')]/0x64));var _0x33adb3=_0x4054f9[_0x5e5c('0x4e')]+_0x4054f9[_0x5e5c('0x53')];var _0x5345dd=Math[_0x5e5c('0x1c2')](_0x4054f9['erlangCalls']*_0x4054f9['erlangAbandonmentRate']*_0x4054f9[_0x5e5c('0x6d')]*_0x4054f9[_0x5e5c('0x6e')]);if(_[_0x5e5c('0x8e')](_0x4054f9[_0x5e5c('0x29')])){if(!_[_0x5e5c('0x8e')](_0x4054f9[_0x5e5c('0x28')])){_0x4054f9[_0x5e5c('0x28')]=undefined;loggerPredictive[_0x5e5c('0x94')]('[startMethodPredictive][StartProgressive]',_0x5e5c('0x1c3'));}if(!_[_0x5e5c('0x8e')](_0x4054f9[_0x5e5c('0x90')])){loggerPredictive['error'](_0x5e5c('0x1c4'),_0x5e5c('0x1c5'));clearInterval(_0x4054f9[_0x5e5c('0x90')]);_0x4054f9[_0x5e5c('0x90')]=undefined;}_0x4054f9['startProgressive']=moment()['format'](_0x5e5c('0xfa'));loggerPredictive[_0x5e5c('0x7d')](_0x4054f9['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4054f9['startProgressive']);this[_0x5e5c('0x153')](_0x4054f9,0x1);}else if(ifInterval(_0x4054f9['dialPredictiveInterval'],_0x4054f9[_0x5e5c('0x29')])){this[_0x5e5c('0x153')](_0x4054f9,0x1);loggerPredictiveCalls[_0x5e5c('0x7d')](_0x5e5c('0x1c6'),_0x4054f9[_0x5e5c('0x29')],_0x4054f9[_0x5e5c('0x3d')]);_0x4054f9[_0x5e5c('0x73')]=0x0;_0x4054f9[_0x5e5c('0x6c')]=0x0;}else if(_0x553451<_0x57a318&&_0x4054f9[_0x5e5c('0x1c7')]==='dropRate'){freeVariablesPredictive(_0x4054f9);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x1c8'),'Dropped\x20calls\x20day',_0x57a318,_0x5e5c('0x29'),_0x4054f9[_0x5e5c('0x3d')]);}else if(_0x5345dd<_0x4054f9[_0x5e5c('0x6c')]&&_0x4054f9[_0x5e5c('0x1c7')]==='dropRate'){freeVariablesPredictive(_0x4054f9);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x1c9'),_0x5e5c('0x1ca'),_0x5345dd,_0x5e5c('0x1cb'),_0x4054f9['predictiveIntervalErlangCallsDroppedCalls'],_0x5e5c('0x29'),_0x4054f9[_0x5e5c('0x3d')]);}else if(!ifInterval(_0x4054f9[_0x5e5c('0x1cc')],_0x4054f9[_0x5e5c('0x29')])&&_['isUndefined'](_0x4054f9[_0x5e5c('0x28')])&&!_[_0x5e5c('0x8e')](_0x4054f9[_0x5e5c('0x29')])){_0x4054f9[_0x5e5c('0x28')]=moment()['format'](_0x5e5c('0xfa'));loggerPredictive['info'](_0x4054f9[_0x5e5c('0x3d')],_0x5e5c('0x1cd'),_0x4054f9[_0x5e5c('0x28')]);this['averageHandleTime'](_0x4054f9[_0x5e5c('0x1cc')])[_0x5e5c('0xb5')](this['getDataPredictive'](_0x4054f9))['then'](mergeDataErlangB(_0x4054f9))['then'](this['startMethodPredictive'](_0x4054f9))[_0x5e5c('0xaf')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4054f9));}else if(!ifInterval(_0x4054f9[_0x5e5c('0x1cc')],_0x4054f9[_0x5e5c('0x28')])){_0x4054f9[_0x5e5c('0x6c')]=0x0;_0x4054f9[_0x5e5c('0x28')]=moment()[_0x5e5c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4054f9[_0x5e5c('0x3d')],_0x5e5c('0x1ce'),_0x4054f9[_0x5e5c('0x28')]);clearInterval(_0x4054f9[_0x5e5c('0x90')]);_0x4054f9[_0x5e5c('0x90')]=undefined;this['averageHandleTime'](_0x4054f9[_0x5e5c('0x1cc')])[_0x5e5c('0xb5')](this[_0x5e5c('0x1cf')](_0x4054f9))[_0x5e5c('0xb5')](mergeDataErlangB(_0x4054f9))[_0x5e5c('0xb5')](this[_0x5e5c('0x1d0')](_0x4054f9))[_0x5e5c('0xaf')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4054f9));}else if(_0x4054f9['predictiveIntervalAvailable']&&_0x33adb3<_0x4054f9[_0x5e5c('0x70')]-_0x138b25){freeVariablesPredictive(_0x4054f9);loggerPredictive[_0x5e5c('0x7d')](_0x4054f9[_0x5e5c('0x3d')],_0x5e5c('0x1d1'),_0x33adb3,')\x20are\x20less\x20than\x20threshold\x20(',_0x4054f9['predictiveIntervalAvailable'],'-',_0x138b25,'=',_0x4054f9[_0x5e5c('0x70')]-_0x138b25,')');}else if(_0x4054f9[_0x5e5c('0x70')]&&_0x33adb3>_0x4054f9[_0x5e5c('0x70')]+_0x2a1c21){freeVariablesPredictive(_0x4054f9);loggerPredictive[_0x5e5c('0x7d')](_0x4054f9['name'],_0x5e5c('0x1d1'),_0x33adb3,_0x5e5c('0x1d2'),_0x4054f9['predictiveIntervalAvailable'],'+',_0x2a1c21,'=',_0x4054f9['predictiveIntervalAvailable']+_0x2a1c21,')');}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1cf')]=function(_0x4781f4){var _0x2f43b0=this;return function(_0x10ddb9){return new BPromise(function(_0xab90ec,_0x30ac5a){_[_0x5e5c('0xcf')](_0x4781f4,_0x10ddb9[0x0]);if(checkGetDataPredictive(_0x10ddb9[0x0])){var _0x1f1850=_0x4781f4['predictiveIntervalAvailable']=_0x4781f4[_0x5e5c('0x53')]+_0x4781f4[_0x5e5c('0x4e')];var _0x2ad71f=_0x4781f4['dialPredictiveInterval']*0x3c;var _0x35e9cd=_0x10ddb9[0x0][_0x5e5c('0x68')]+_0x10ddb9[0x0][_0x5e5c('0x67')];var _0x358a84=(_0x10ddb9[0x0][_0x5e5c('0x66')]+_0x10ddb9[0x0][_0x5e5c('0x6a')]+_0x10ddb9[0x0][_0x5e5c('0x69')])/_0x10ddb9[0x0][_0x5e5c('0x71')];_0x4781f4['predictiveIntervalHitRate']=_0x358a84>0x0?_0x358a84:0x1;switch(_0x4781f4[_0x5e5c('0x1c7')]){case _0x5e5c('0x1d3'):var _0x1c707c=_0x4781f4[_0x5e5c('0x1d4')]/0x64;return _0x2f43b0[_0x5e5c('0x1d5')](_0x1f1850,_0x2ad71f,_0x35e9cd,_0x358a84,_0x1c707c)['then'](function(_0x574ce3){return _0xab90ec(_0x574ce3);});case _0x5e5c('0x1d6'):var _0x5a3b64=_0x4781f4[_0x5e5c('0x1d4')]/0x64;return _0x2f43b0[_0x5e5c('0x1d7')](_0x1f1850,_0x2ad71f,_0x35e9cd,_0x358a84,_0x5a3b64)[_0x5e5c('0xb5')](function(_0xf45e8a){return _0xab90ec(_0xf45e8a);});default:return _0x30ac5a(msgResponse('[getDataPredictive]',_0x5e5c('0x13f'),_0x5e5c('0x1d8')));}}else{return _0x30ac5a(msgResponse(_0x5e5c('0x1d9'),'Failure',_0x5e5c('0x1da')));}});};};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1db')]=function(_0x22887f){var _0x3dc366=this;return function(_0x107245){return new BPromise(function(_0x3d9b8e,_0xeeabf3){_[_0x5e5c('0xcf')](_0x22887f,_0x107245[0x0]);if(checkGetDataPredictive(_0x107245[0x0])){loggerPredictive[_0x5e5c('0x7d')](JSON[_0x5e5c('0x46')](_0x107245[0x0]));if(_0x22887f[_0x5e5c('0x1c7')]===_0x5e5c('0x1d3')){return _0x3dc366['getVoiceQueueRtPauses'](_0x22887f['id'])[_0x5e5c('0xb5')](function(_0x264347){var _0x2a3118=_0x22887f['loggedIn']-_0x264347[0x0][_0x5e5c('0x1dc')];var _0x6856aa=_0x22887f[_0x5e5c('0x1cc')]*0x3c;var _0x58c7a3=_0x107245[0x0][_0x5e5c('0x68')]+_0x107245[0x0][_0x5e5c('0x67')];var _0x132696=(_0x107245[0x0][_0x5e5c('0x66')]+_0x107245[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x107245[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x107245[0x0][_0x5e5c('0x71')];var _0x16639d=_0x22887f[_0x5e5c('0x1d4')]/0x64;_0x22887f[_0x5e5c('0x6f')]=_0x264347[0x0]['outboundQueuePauses']||0x0;_0x22887f['predictiveIntervalHitRate']=_0x132696>0x0?_0x132696:0x1;return _0x3dc366[_0x5e5c('0x1d5')](_0x2a3118,_0x6856aa,_0x58c7a3,_0x132696,_0x16639d);})[_0x5e5c('0xb5')](function(_0x22d7ab){return _0x3d9b8e(_0x22d7ab);})['catch'](function(_0x3dfeff){return _0xeeabf3(msgResponse('[CatchErlangB]',_0x5e5c('0x13f'),JSON[_0x5e5c('0x46')](_0x3dfeff)));});}if(_0x22887f[_0x5e5c('0x1c7')]==='agentBusyFactor'){return _0x3dc366[_0x5e5c('0x1dd')](_0x22887f['id'])[_0x5e5c('0xb5')](function(_0x3b49b4){var _0xbef6ba=_0x22887f[_0x5e5c('0x4f')]-_0x3b49b4[0x0]['outboundQueuePauses'];var _0x29b711=_0x22887f[_0x5e5c('0x1cc')]*0x3c;var _0x3d6dfd=_0x107245[0x0][_0x5e5c('0x68')]+_0x107245[0x0][_0x5e5c('0x67')];var _0x2107b2=(_0x107245[0x0][_0x5e5c('0x66')]+_0x107245[0x0][_0x5e5c('0x6a')]+_0x107245[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x107245[0x0]['predictiveIntervalTotalCalls'];var _0x477ad5=_0x22887f[_0x5e5c('0x1d4')]/0x64;_0x22887f[_0x5e5c('0x6f')]=_0x3b49b4[0x0][_0x5e5c('0x1dc')]||0x0;_0x22887f['predictiveIntervalHitRate']=_0x2107b2>0x0?_0x2107b2:0x1;return _0x3dc366[_0x5e5c('0x1d7')](_0xbef6ba,_0x29b711,_0x3d6dfd,_0x2107b2,_0x477ad5);})[_0x5e5c('0xb5')](function(_0x36ee15){return _0x3d9b8e(_0x36ee15);})['catch'](function(_0x15e2c8){return _0xeeabf3(msgResponse(_0x5e5c('0x1de'),'Failure',JSON[_0x5e5c('0x46')](_0x15e2c8)));});}}else{return _0xeeabf3(msgResponse(_0x5e5c('0x1d9'),'Failure',_0x5e5c('0x1da')));}});};};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1d0')]=function(_0x2fdfd2){var _0x33eb2f=this;return function(){var _0xcef9fb=0x0;var _0x2ac78c=Math[_0x5e5c('0x1c2')](_0x2fdfd2[_0x5e5c('0x89')]*0x3e8);if(_0x2ac78c>0x0){_0x2ac78c=_0x2ac78c<0x64?0x64:_0x2ac78c;loggerPredictive['info'](_0x2fdfd2['name'],_0x5e5c('0x1df'),_0x2ac78c,'milliseconds');_0x2fdfd2[_0x5e5c('0x90')]=setInterval(function(){_0x33eb2f[_0x5e5c('0x90')](_0x2fdfd2);loggerPredictiveCalls[_0x5e5c('0x7d')]('[handlePredictive]',_0xcef9fb+=0x1);},_0x2ac78c);}else{loggerPredictive[_0x5e5c('0x7d')](_0x2fdfd2[_0x5e5c('0x3d')],_0x5e5c('0x1e0'));}};};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1e1')]=function(_0x3b700a,_0x383875){var _0x9c50ea=this;return function(_0x469970){if(_['isEmpty'](_0x469970)){if(_['isNil'](_0x383875[_0x5e5c('0x1e2')])||!_0x383875[_0x5e5c('0x1e3')]){if(_0x3b700a['dialMethod']===_0x5e5c('0x8')){_0x3b700a[_0x5e5c('0x12a')]=_['isUndefined'](_0x3b700a['queueStatusComplete'])?!![]:_0x3b700a['queueStatusComplete'];var _0x20ce99=uuid['v4']();_0x9c50ea[_0x5e5c('0x24')][_0x20ce99]=new Action(_0x3b700a,_0x383875,_0x20ce99);loggerBooked['info'](_0x5e5c('0x1e4'),_0x20ce99,'queueStatusComplete:\x20',JSON['stringify'](_0x3b700a[_0x5e5c('0x12a')]),_0x5e5c('0x1e5'),_0x3b700a[_0x5e5c('0x3d')]);if(_0x3b700a[_0x5e5c('0x12a')]){_0x3b700a[_0x5e5c('0x12a')]=![];_0x9c50ea['queueBooked'][_0x9c50ea[_0x5e5c('0x24')][_0x20ce99]['queue']]=[];ami['Action']({'actionid':_0x20ce99,'action':_0x5e5c('0x1e6'),'queue':_0x3b700a['name']})['catch'](function(_0x4bef2c){_0x9c50ea[_0x5e5c('0xb1')](_0x3b700a);_0x9c50ea['rescheduleContact']({'active':![],'ContactId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99][_0x5e5c('0xd1')],'ListId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99][_0x5e5c('0xd2')],'VoiceQueueId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99]['VoiceQueueId']||undefined,'CampaignId':_0x9c50ea['actions'][_0x20ce99][_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x9c50ea[_0x5e5c('0x24')][_0x20ce99];});}else{loggerBooked['info'](_0x5e5c('0x1e7'),JSON[_0x5e5c('0x46')](_0x3b700a[_0x5e5c('0x12a')]),_0x5e5c('0x1e5'),_0x3b700a[_0x5e5c('0x3d')]);_0x9c50ea['updateOriginated'](_0x3b700a);_0x9c50ea['rescheduleContact']({'active':![],'ContactId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99][_0x5e5c('0xd1')],'ListId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99]['ListId'],'VoiceQueueId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99][_0x5e5c('0xd3')]||undefined,'CampaignId':_0x9c50ea[_0x5e5c('0x24')][_0x20ce99][_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1e8')));delete _0x9c50ea[_0x5e5c('0x24')][_0x20ce99];}}else{return _0x9c50ea[_0x5e5c('0x163')](_0x3b700a,_0x383875);}}else{if(getDiff(_0x383875[_0x5e5c('0x1e9')])<_0x3b700a['dialRecallMeTimeout']*0x3c){if(_0x383875[_0x5e5c('0x1ea')]&&!_0x383875[_0x5e5c('0x1ea')][_0x5e5c('0x1eb')]){_0x9c50ea['preview']['run'](_0x383875['id'])[_0x5e5c('0x1b')](function(){_0x9c50ea[_0x5e5c('0xb1')](_0x3b700a);});}else{_0x9c50ea['unlockContact']({'active':![]},_0x383875['id'],0x1)['finally'](function(){console[_0x5e5c('0x1ec')]('Contact\x20updated');_0x9c50ea[_0x5e5c('0xb1')](_0x3b700a);});}}else{_0x3b700a[_0x5e5c('0x64')]+=0x1;_0x9c50ea[_0x5e5c('0xb1')](_0x3b700a);if(_0x3b700a[_0x5e5c('0x1ed')]){_0x9c50ea['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x383875[_0x5e5c('0xd1')],'ListId':_0x383875[_0x5e5c('0xd2')],'VoiceQueueId':_0x383875[_0x5e5c('0xd3')]||undefined,'CampaignId':_0x383875[_0x5e5c('0xd4')]||undefined})[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0x1ee')));_0x9c50ea[_0x5e5c('0xc8')](createObjHistory(_0x3b700a,_0x383875,_0x5e5c('0x1ef'),0x17,'RecallInQueue'))[_0x5e5c('0xaf')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x9c50ea[_0x5e5c('0xce')](createObjHistory(_0x3b700a,_0x383875,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x5e5c('0x1f0'),_0x5e5c('0x1f1'));}}}}else{_0x3b700a['outboundBlacklistCallsDay']+=0x1;_0x9c50ea[_0x5e5c('0xce')](createObjHistory(_0x3b700a,_0x383875,'BLACKLIST',0xd,_0x5e5c('0x1f2')),'[Originate][historyBlacklist]',_0x5e5c('0x1f3'));throw'inBlackList';}};};Dialer[_0x5e5c('0x19')]['handleIvr']=function(_0x3023d6){var _0x53f991=this;var _0xec39d9=[];var _0xf36da5=_0x3023d6['limitCalls']-_0x3023d6['originated']-_0x3023d6[_0x5e5c('0x1f4')];emitCampaignSummary(_0x3023d6);if(_0xf36da5>0x0){if(_0xf36da5>this[_0x5e5c('0x22')]){_0xf36da5=this['maxNumberOriginate'];}_0x3023d6[_0x5e5c('0x1f4')]+=_0xf36da5;this['getContactDialerIvr'](_0x3023d6['id'],_0xf36da5,_0x3023d6[_0x5e5c('0x1f5')])[_0x5e5c('0xb5')](function(_0x1a6349){_0x3023d6[_0x5e5c('0x1f4')]-=_0xf36da5;_0x3023d6[_0x5e5c('0x1f4')]=_0x3023d6[_0x5e5c('0x1f4')]>0x0?_0x3023d6[_0x5e5c('0x1f4')]:0x0;if(!checkContactEmpty(_0x1a6349)){_0x3023d6[_0x5e5c('0x3c')]=_0x5e5c('0x9e');logger[_0x5e5c('0x7d')]('[getContactCampaign2][Empty]'+_0x3023d6[_0x5e5c('0x3d')]);}else{_0x3023d6[_0x5e5c('0x72')]+=_0x1a6349[_0x5e5c('0x97')];_0x3023d6['message']=_0x5e5c('0x1f6');for(var _0x3491ef=0x0;_0x3491ef<_0x1a6349['length'];_0x3491ef+=0x1){_0x3023d6[_0x5e5c('0x1f7')]+=0x1;if(_[_0x5e5c('0xad')](_0x1a6349[_0x3491ef])||_[_0x5e5c('0xad')](_0x1a6349[_0x3491ef][_0x5e5c('0x167')])||_[_0x5e5c('0xad')](_0x1a6349[_0x3491ef][_0x5e5c('0x167')][_0x5e5c('0x168')])){_0x53f991[_0x5e5c('0xcc')]('[actionOriginate]\x20',_0x3023d6,_0x1a6349[_0x3491ef]);}else{_0x53f991[_0x5e5c('0xb9')](_['pick'](_0x1a6349[_0x3491ef],['CampaignId',_0x5e5c('0x1f8')]))[_0x5e5c('0xb5')](_0x53f991['checkContactBlack'](_0x3023d6,_0x1a6349[_0x3491ef]))[_0x5e5c('0xaf')](_0x53f991[_0x5e5c('0xcb')]('[actionOriginateIvr]\x20',_0x3023d6));}}}})[_0x5e5c('0xaf')](loggerGetContactDialer('[getContactCampaign2]',_0x3023d6,_0xf36da5));}};Dialer['prototype'][_0x5e5c('0x153')]=function(_0x2fa233,_0x1cc861){var _0x38fa1e=this;var _0x26631e=[];var _0x3f7fec=_0x1cc861>=0x1?_0x1cc861:0x1;var _0xfa29b6=[];if(_0x2fa233[_0x5e5c('0x58')]==='booked'){_0x3f7fec=0x1;}var _0x3fd80c=Math['floor'](_0x2fa233['available']*_0x3f7fec)-_0x2fa233[_0x5e5c('0x72')]-_0x2fa233['temp'];emitVoiceQueueSummary(_0x2fa233);if(_0x2fa233[_0x5e5c('0x1f9')]>0x0){var _0x25fd34=_0x2fa233['dialLimitQueue']-_0x2fa233[_0x5e5c('0x72')]-_0x2fa233['talking']-_0x2fa233['temp']-_0x2fa233[_0x5e5c('0x50')];if(_0x3fd80c>_0x25fd34){_0x3fd80c=_0x25fd34;}}if(_0x3fd80c>0x0){if(_0x2fa233[_0x5e5c('0x58')]===_0x5e5c('0x8')){_0x3fd80c=0x1;}if(_0x3fd80c>this[_0x5e5c('0x22')]){_0x3fd80c=this['maxNumberOriginate'];}_0x2fa233[_0x5e5c('0x1f4')]+=_0x3fd80c;for(var _0x44f9de in this[_0x5e5c('0x20')]){if(this[_0x5e5c('0x20')][_0x5e5c('0xca')](_0x44f9de)){if(this[_0x5e5c('0x20')][_0x44f9de]['state']===_0x5e5c('0x1fa')&&this[_0x5e5c('0x20')][_0x44f9de][_0x5e5c('0xdc')]===_0x5e5c('0x1fb')){_0x26631e['push'](this['agents'][_0x44f9de]['id']);}}}this['getContactDialer'](_0x2fa233['id'],_0x26631e,_0x3fd80c,_0x2fa233[_0x5e5c('0x1f5')])['then'](function(_0x18fdb7){_0x2fa233['temp']-=_0x3fd80c;_0x2fa233['temp']=_0x2fa233[_0x5e5c('0x1f4')]>0x0?_0x2fa233['temp']:0x0;if(!checkContactEmpty(_0x18fdb7)){_0x38fa1e[_0x5e5c('0xb3')](_0x2fa233)[_0x5e5c('0xb5')](sendMessageReschedule(_0x2fa233))[_0x5e5c('0xaf')](loggerCatch('[countReScheduled]\x20'));}else{_0x2fa233[_0x5e5c('0x72')]+=_0x18fdb7[_0x5e5c('0x97')];_0x2fa233[_0x5e5c('0x3c')]=_0x2fa233[_0x5e5c('0x58')]==='booked'?_0x5e5c('0x170'):_0x5e5c('0x1f6');for(var _0x9ec23=0x0;_0x9ec23<_0x18fdb7[_0x5e5c('0x97')];_0x9ec23+=0x1){if(_['isNil'](_0x18fdb7[_0x9ec23])||_[_0x5e5c('0xad')](_0x18fdb7[_0x9ec23][_0x5e5c('0x167')])||_[_0x5e5c('0xad')](_0x18fdb7[_0x9ec23][_0x5e5c('0x167')][_0x5e5c('0x168')])){_0x38fa1e[_0x5e5c('0xcc')](_0x5e5c('0x1fc'),_0x2fa233,_0x18fdb7[_0x9ec23]);}else{_0x38fa1e[_0x5e5c('0xb7')](_[_0x5e5c('0xd0')](_0x18fdb7[_0x9ec23],['VoiceQueueId','Contact.phone']))['then'](_0x38fa1e[_0x5e5c('0x1e1')](_0x2fa233,_0x18fdb7[_0x9ec23]))[_0x5e5c('0xaf')](_0x38fa1e[_0x5e5c('0xcb')](_0x5e5c('0x1fc'),_0x2fa233));}}}})[_0x5e5c('0xaf')](loggerGetContactDialer('[getContactDialer2]',_0x2fa233,_0x3fd80c));}};Dialer['prototype'][_0x5e5c('0x90')]=function(_0x4b3bbf){var _0x4d4ef2=this;if(_0x4b3bbf[_0x5e5c('0x1f9')]>0x0){var _0x252338=_0x4b3bbf[_0x5e5c('0x1f9')]-_0x4b3bbf[_0x5e5c('0x72')]-_0x4b3bbf[_0x5e5c('0x53')];if(_0x252338>0x0){this[_0x5e5c('0x1fd')](_0x4b3bbf);}else{loggerPredictiveCalls[_0x5e5c('0x7d')](_0x5e5c('0x1fe'));}}else{this[_0x5e5c('0x1fd')](_0x4b3bbf);}};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1fd')]=function(_0x279218){var _0x3ddaf8=this;var _0x417f17=[];_0x279218['originated']+=0x1;for(var _0xcd9bba in this[_0x5e5c('0x20')]){if(this[_0x5e5c('0x20')][_0x5e5c('0xca')](_0xcd9bba)){if(this[_0x5e5c('0x20')][_0xcd9bba][_0x5e5c('0xa6')]==='not_inuse'&&this[_0x5e5c('0x20')][_0xcd9bba][_0x5e5c('0xdc')]==='reachable'){_0x417f17[_0x5e5c('0x145')](this['agents'][_0xcd9bba]['id']);}}}this[_0x5e5c('0xc2')](_0x279218['id'],_0x417f17,0x1,_0x279218[_0x5e5c('0x1f5')])[_0x5e5c('0xb5')](function(_0x5a44f9){if(!checkContactEmpty(_0x5a44f9)){checkContactLowerLimitOriginate(_0x279218,0x1,0x0);_0x3ddaf8[_0x5e5c('0xb3')](_0x279218)['then'](sendMessageReschedule(_0x279218))[_0x5e5c('0xaf')](loggerCatch(_0x5e5c('0xb6')));}else{_0x279218[_0x5e5c('0x3c')]='RUNNING';if(_['isNil'](_0x5a44f9[0x0])||_[_0x5e5c('0xad')](_0x5a44f9[0x0][_0x5e5c('0x167')])||_[_0x5e5c('0xad')](_0x5a44f9[0x0]['Contact']['phone'])){_0x3ddaf8[_0x5e5c('0xcc')](_0x5e5c('0x1fc'),_0x279218,_0x5a44f9[0x0]);}else{_0x3ddaf8[_0x5e5c('0xb7')](_['pick'](_0x5a44f9[0x0],[_0x5e5c('0xd3'),'Contact.phone']))[_0x5e5c('0xb5')](_0x3ddaf8['checkContactBlack'](_0x279218,_0x5a44f9[0x0]))['catch'](_0x3ddaf8[_0x5e5c('0xcb')](_0x5e5c('0x1ff'),_0x279218));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x279218,0x1));emitVoiceQueueSummary(_0x279218);};Dialer['prototype'][_0x5e5c('0x1d5')]=function(_0xd6aaed,_0x1a51e9,_0x2e1707,_0x530ca5,_0x17c087,_0x1a80fa){loggerPredictive[_0x5e5c('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x200'),_0xd6aaed);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a51e9);loggerPredictive[_0x5e5c('0x7d')]('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',_0x2e1707);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x201'),_0x530ca5);loggerPredictive[_0x5e5c('0x7d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17c087);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x202'));return new BPromise(function(_0x5dd9f8,_0x4f351e){if(_0xd6aaed<=0x0||isNaN(_0xd6aaed)){return _0x4f351e(msgResponse(_0x5e5c('0x203'),'Error',_0x5e5c('0x204')+_0xd6aaed));}if(_0x2e1707<=0x0||isNaN(_0x2e1707)){return _0x4f351e(msgResponse(_0x5e5c('0x203'),_0x5e5c('0x45'),_0x5e5c('0x205')+_0x2e1707));}if(_0x530ca5<=0x0||isNaN(_0x530ca5)){return _0x4f351e(msgResponse(_0x5e5c('0x203'),'Error',_0x5e5c('0x206')+_0x530ca5));}if(_0x1a51e9<=0x0||isNaN(_0x1a51e9)){return _0x4f351e(msgResponse(_0x5e5c('0x203'),_0x5e5c('0x45'),_0x5e5c('0x207')+_0x1a51e9));}if(_0x17c087<=0x0||isNaN(_0x17c087)){return _0x4f351e(msgResponse(_0x5e5c('0x203'),_0x5e5c('0x45'),_0x5e5c('0x208')+_0x17c087));}_0x1a80fa=_0x1a80fa||0x0;var _0x327c3b=0x1/_0x2e1707;var _0x1df411=0x0;var _0x231c87=0x0;var _0x2382d7=0x0;var _0x203ab6=0x0;for(var _0x211db0=0x0;_0x2382d7<_0x17c087;_0x211db0+=0x1){_0x231c87=_0x211db0/_0x1a51e9;_0x1df411=(_0x530ca5*_0x231c87+_0x1a80fa)/_0x327c3b;_0x2382d7=erlangb(_0x1df411,_0xd6aaed);_0x203ab6=_0x1df411/_0xd6aaed*(0x1-erlangb(_0x1df411,_0xd6aaed));}return _0x5dd9f8({'erlangCalls':_0x211db0,'erlangCallToSecond':_0x1a51e9/_0x211db0,'erlangAbandonmentRate':_0x2382d7,'erlangBusyFactor':_0x203ab6});});};Dialer[_0x5e5c('0x19')][_0x5e5c('0x1d7')]=function(_0x175037,_0x5b05de,_0x1aa7a0,_0x20ef21,_0x58aff4,_0x5934fe){loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x209'));loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x200'),_0x175037);loggerPredictive['info'](_0x5e5c('0x20a'),_0x5b05de);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x20b'),_0x1aa7a0);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x201'),_0x20ef21);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x20c'),_0x58aff4);loggerPredictive[_0x5e5c('0x7d')](_0x5e5c('0x202'));return new BPromise(function(_0x5aa6b2,_0x2f8cbd){if(_0x175037<=0x0||isNaN(_0x175037)){return _0x2f8cbd(msgResponse('[busyFactor]',_0x5e5c('0x45'),_0x5e5c('0x204')+_0x175037));}if(_0x1aa7a0<=0x0||isNaN(_0x1aa7a0)){return _0x2f8cbd(msgResponse(_0x5e5c('0x20d'),'Error',_0x5e5c('0x205')+_0x1aa7a0));}if(_0x20ef21<=0x0||isNaN(_0x20ef21)){return _0x2f8cbd(msgResponse(_0x5e5c('0x20d'),'Error','p\x20=\x20'+_0x20ef21));}if(_0x5b05de<=0x0||isNaN(_0x5b05de)){return _0x2f8cbd(msgResponse(_0x5e5c('0x20d'),'Error',_0x5e5c('0x207')+_0x5b05de));}if(_0x58aff4<=0x0||isNaN(_0x58aff4)){return _0x2f8cbd(msgResponse(_0x5e5c('0x20d'),'Error','Umin\x20=\x20'+_0x58aff4));}_0x5934fe=_0x5934fe||0x0;var _0x170e86=0x1/_0x1aa7a0;var _0x105347=0x0;var _0x11cf3e=0x0;var _0x1de281=0x0;var _0x180384=0x0;for(var _0x576fdc=0x0;_0x180384<_0x58aff4;_0x576fdc+=0x1){_0x11cf3e=_0x576fdc/_0x5b05de;_0x105347=(_0x20ef21*_0x11cf3e+_0x5934fe)/_0x170e86;_0x1de281=erlangb(_0x105347,_0x175037);_0x180384=_0x105347/_0x175037*(0x1-erlangb(_0x105347,_0x175037));}return _0x5aa6b2({'erlangCalls':_0x576fdc,'erlangCallToSecond':_0x5b05de/_0x576fdc,'erlangAbandonmentRate':_0x1de281,'erlangBusyFactor':_0x180384});});};module[_0x5e5c('0x20e')]=Dialer; \ No newline at end of file +var _0x7d2a=['Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','state','membername','[syncHangupInAMD]','dialAMDActive','MACHINE','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','Machine','stateGlobal','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','[syncHangupIvr][createHistory]','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','stringify','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','syncCampaigns','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','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(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','unlockContact','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','lodash','bluebird','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','loggedIn','pTalking','talking','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice_queue:save','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x2d70d5,_0x5b4129){var _0x3011e1=function(_0x350c8c){while(--_0x350c8c){_0x2d70d5['push'](_0x2d70d5['shift']());}};_0x3011e1(++_0x5b4129);}(_0x7d2a,0x192));var _0xa7d2=function(_0x328100,_0x460f7b){_0x328100=_0x328100-0x0;var _0x2f9c0e=_0x7d2a[_0x328100];return _0x2f9c0e;};'use strict';var util=require('util');var _=require(_0xa7d2('0x0'));var BPromise=require(_0xa7d2('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xa7d2('0x2'));var Redis=require(_0xa7d2('0x3'));var ut=require(_0xa7d2('0x4'));var config=require(_0xa7d2('0x5'));var logger=require(_0xa7d2('0x6'))(_0xa7d2('0x7'));var loggerBooked=require(_0xa7d2('0x6'))('booked');var loggerPredictive=require(_0xa7d2('0x6'))(_0xa7d2('0x8'));var loggerPredictiveCalls=require(_0xa7d2('0x6'))(_0xa7d2('0x9'));var loggerSyncQueueSummary=require(_0xa7d2('0x6'))(_0xa7d2('0xa'));var ami=require(_0xa7d2('0xb'));config[_0xa7d2('0xc')]=_['defaults'](config[_0xa7d2('0xc')],{'host':_0xa7d2('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa7d2('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xa7d2('0xe'));var cmHopperBlack=require(_0xa7d2('0xf'));var voiceQueueRt=require(_0xa7d2('0x10'));var Action=require(_0xa7d2('0x11'));var History=require('./history');var Final=require(_0xa7d2('0x12'));var AgentComplete=require(_0xa7d2('0x13'));var QueueCallerAbandon=require(_0xa7d2('0x14'));var Hangup=require('./hangup');var ipAgi=process['env'][_0xa7d2('0x15')]||_0xa7d2('0x16');var strategy={'rrmemory':_0xa7d2('0x17'),'roundrobin':_0xa7d2('0x18')};var Sequence=function(){};Sequence['prototype'][_0xa7d2('0x19')]=function(_0xd87928){this[_0xa7d2('0x1a')]=this[_0xa7d2('0x1a')]?this[_0xa7d2('0x1a')][_0xa7d2('0x1b')](_0xd87928):_0xd87928();};function Dialer(_0x4435b9,_0x2cc492){this[_0xa7d2('0x1c')]=new Sequence();this[_0xa7d2('0x1d')]=_0x2cc492;this[_0xa7d2('0x1e')]=_0x4435b9[_0xa7d2('0x1e')];this[_0xa7d2('0x1f')]=_0x4435b9[_0xa7d2('0x1f')];this[_0xa7d2('0x20')]=_0x4435b9['agents'];this[_0xa7d2('0x21')]=_0x4435b9['trunks'];this[_0xa7d2('0x22')]=config[_0xa7d2('0x22')]||0x2;this[_0xa7d2('0x23')]={};this[_0xa7d2('0x24')]={};this[_0xa7d2('0x25')]={};this[_0xa7d2('0x26')]={};this['optionPredictive']={};this[_0xa7d2('0x27')]={};this[_0xa7d2('0x28')]={};this[_0xa7d2('0x29')]={};this[_0xa7d2('0x2a')]={};this[_0xa7d2('0x2b')]={};ami['on']('agentconnect',this[_0xa7d2('0x2c')][_0xa7d2('0x2d')](this));ami['on'](_0xa7d2('0x2e'),this[_0xa7d2('0x2f')]['bind'](this));ami['on'](_0xa7d2('0x30'),this[_0xa7d2('0x31')][_0xa7d2('0x2d')](this));ami['on'](_0xa7d2('0x32'),this[_0xa7d2('0x33')][_0xa7d2('0x2d')](this));ami['on'](_0xa7d2('0x34'),this[_0xa7d2('0xa')][_0xa7d2('0x2d')](this));ami['on'](_0xa7d2('0x35'),this[_0xa7d2('0x36')][_0xa7d2('0x2d')](this));ami['on']('newexten',this[_0xa7d2('0x37')][_0xa7d2('0x2d')](this));ami['on']('varset',this[_0xa7d2('0x38')][_0xa7d2('0x2d')](this));ami['on'](_0xa7d2('0x39'),this[_0xa7d2('0x3a')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xa7d2('0x3b')][_0xa7d2('0x2d')](this));this[_0xa7d2('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0xfab951){return _0xfab951!==null&&!_[_0xa7d2('0x3d')](_0xfab951);}function checkIsLoggedIn(_0x101a4a,_0xe13ee2){return function(){if(_0xe13ee2<=0x0){_0x101a4a[_0xa7d2('0x3e')]=_0xa7d2('0x3f');throw _0x101a4a['name']+_0xa7d2('0x40');}};}function isActive(_0x7954f){return _0x7954f;}function checkIsActive(_0x5ca76b,_0x2b8ae5){return function(){if(!isActive(_0x2b8ae5)){_0x5ca76b['message']='NOT_ACTIVE';throw _0x5ca76b[_0xa7d2('0x41')]+_0xa7d2('0x42');}};}function checkInterval(_0x512da7){return function(){if(!isNotNull(_0x512da7[_0xa7d2('0x43')])){_0x512da7[_0xa7d2('0x3e')]=_0xa7d2('0x44');throw _0x512da7[_0xa7d2('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x512da7[_0xa7d2('0x43')][_0xa7d2('0x45')])){_0x512da7[_0xa7d2('0x3e')]='INTERVAL_IS_NULL';throw _0x512da7[_0xa7d2('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa7d2('0x46')](_0x512da7['Interval'][_0xa7d2('0x45')]))){_0x512da7['message']='INTERVAL_IS_NULL';throw _0x512da7[_0xa7d2('0x41')]+_0xa7d2('0x47');}};}function msgResponse(_0x210ba5,_0x4f4e87,_0x127c03){return{'action':_0x210ba5,'response':_0x4f4e87,'message':_0x127c03,'stack':_0x127c03};}function myreject(_0x5de9ea){return function(_0x1215c3){return _0x5de9ea(msgResponse(_0xa7d2('0x48'),_0xa7d2('0x49'),JSON['stringify'](_0x1215c3)));};}function getSeconds(_0x219d48,_0x5894ce){var _0x10c5ac=moment(_0x219d48)[_0xa7d2('0x4a')](0x0);var _0x518659=moment(_0x5894ce)['milliseconds'](0x0);return _0x10c5ac[_0xa7d2('0x4b')](_0x518659,_0xa7d2('0x4c'));}function emit(_0x2640cb,_0x785dd4,_0x8deb07){io['to'](_0x2640cb)[_0xa7d2('0x4d')](_0x785dd4,_0x8deb07);}function emitVoiceQueueSummary(_0x332b29){if(_0x332b29[_0xa7d2('0x4e')]===_0xa7d2('0x4f')){var _0x28bc2f={'id':_0x332b29['id'],'name':_0x332b29[_0xa7d2('0x41')],'strategy':_0x332b29[_0xa7d2('0x50')],'answered':_0x332b29['answered'],'available':_0x332b29['available'],'loggedIn':_0x332b29[_0xa7d2('0x51')],'pTalking':_0x332b29[_0xa7d2('0x52')],'sumBillable':_0x332b29['sumBillable'],'sumDuration':_0x332b29['sumDuration'],'sumHoldTime':_0x332b29['sumHoldTime']||0x0,'talking':_0x332b29[_0xa7d2('0x53')],'total':_0x332b29['total'],'type':_0x332b29[_0xa7d2('0x4e')],'unmanaged':_0x332b29[_0xa7d2('0x54')],'abandoned':_0x332b29['abandoned'],'waiting':_0x332b29['waiting'],'loggedInDb':_0x332b29[_0xa7d2('0x55')],'dialActive':_0x332b29[_0xa7d2('0x56')],'dialMethod':_0x332b29['dialMethod'],'dialOriginateCallerIdName':_0x332b29[_0xa7d2('0x57')],'dialOriginateCallerIdNumber':_0x332b29[_0xa7d2('0x58')],'dialOriginateTimeout':_0x332b29[_0xa7d2('0x59')],'dialPrefix':_0x332b29[_0xa7d2('0x5a')],'outboundAnswerAgiCallsDay':_0x332b29[_0xa7d2('0x5b')],'outboundAnswerCallsDay':_0x332b29[_0xa7d2('0x5c')],'outboundBlacklistCallsDay':_0x332b29[_0xa7d2('0x5d')],'outboundBusyCallsDay':_0x332b29[_0xa7d2('0x5e')],'outboundCongestionCallsDay':_0x332b29[_0xa7d2('0x5f')],'outboundDropCallsDayACS':_0x332b29[_0xa7d2('0x60')],'outboundDropCallsDayCallersExit':_0x332b29[_0xa7d2('0x61')],'outboundDropCallsDayTimeout':_0x332b29['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x332b29[_0xa7d2('0x62')],'outboundNoSuchCallsDay':_0x332b29[_0xa7d2('0x63')],'outboundOriginateFailureCallsDay':_0x332b29[_0xa7d2('0x64')],'outboundReCallsDay':_0x332b29[_0xa7d2('0x65')],'outboundRejectCallsDay':_0x332b29[_0xa7d2('0x66')],'outboundUnknownCallsDay':_0x332b29[_0xa7d2('0x67')],'predictiveIntervalAnsweredCalls':_0x332b29['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x332b29[_0xa7d2('0x68')],'predictiveIntervalAvgTalktime':_0x332b29[_0xa7d2('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x332b29['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x332b29['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x332b29[_0xa7d2('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x332b29[_0xa7d2('0x6b')],'predictiveIntervalHitRate':_0x332b29[_0xa7d2('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x332b29[_0xa7d2('0x6d')],'predictiveIntervalPauses':_0x332b29[_0xa7d2('0x6e')],'predictiveIntervalAvailable':_0x332b29[_0xa7d2('0x6f')],'predictiveIntervalTotalCalls':_0x332b29[_0xa7d2('0x70')],'message':_0x332b29[_0xa7d2('0x3e')],'originated':_0x332b29['originated'],'erlangCalls':_0x332b29[_0xa7d2('0x71')],'erlangCallToSecond':_0x332b29['erlangCallToSecond'],'erlangAbandonmentRate':_0x332b29[_0xa7d2('0x72')],'erlangBusyFactor':_0x332b29[_0xa7d2('0x73')],'startPredictive':_0x332b29[_0xa7d2('0x27')],'startProgressive':_0x332b29[_0xa7d2('0x28')]};if(_0x332b29[_0xa7d2('0x74')]){_0x28bc2f[_0xa7d2('0x74')]={'id':_0x332b29[_0xa7d2('0x74')]['id'],'name':_0x332b29[_0xa7d2('0x74')][_0xa7d2('0x41')],'active':_0x332b29['Trunk'][_0xa7d2('0x75')],'callerid':_0x332b29[_0xa7d2('0x74')][_0xa7d2('0x76')]};}if(_0x332b29[_0xa7d2('0x43')]){_0x28bc2f[_0xa7d2('0x43')]={'id':_0x332b29[_0xa7d2('0x43')]['id'],'name':_0x332b29[_0xa7d2('0x43')][_0xa7d2('0x41')]};}var _0x89aacd=md5(JSON['stringify'](_0x28bc2f));if(_0x332b29[_0xa7d2('0x2')]!==_0x89aacd){_0x332b29[_0xa7d2('0x2')]=_0x89aacd;emit(util[_0xa7d2('0x77')]('voice:queue:%s',_0x28bc2f[_0xa7d2('0x41')]),_0xa7d2('0x78'),_0x28bc2f);}}}function emitCampaignSummary(_0x59b5c9){if(_0x59b5c9[_0xa7d2('0x4e')]==='ivr'){emit(util[_0xa7d2('0x77')]('campaign:ivr:%s',_0x59b5c9[_0xa7d2('0x41')]),_0xa7d2('0x79'),_0x59b5c9);}}function checkGetDataPredictive(_0x178c89){if(isNotNull(_0x178c89)){if(!_[_0xa7d2('0x46')](_0x178c89)){loggerPredictive['info'](_0xa7d2('0x7a'));loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x7c'),_0x178c89['predictiveIntervalTotalCalls']);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x7d'),_0x178c89[_0xa7d2('0x7e')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x178c89[_0xa7d2('0x7f')]);loggerPredictive['info'](_0xa7d2('0x80'),_0x178c89[_0xa7d2('0x81')]);loggerPredictive[_0xa7d2('0x7b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x178c89[_0xa7d2('0x68')]);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x82'),_0x178c89[_0xa7d2('0x69')]);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x83'));if(_0x178c89[_0xa7d2('0x70')]>0x0){if(!_['isUndefined'](_0x178c89['predictiveIntervalAvgTalktime'])&&_0x178c89[_0xa7d2('0x69')]>0x0){return!![];}else{loggerPredictive['info'](_0xa7d2('0x84'));}if(!_['isUndefined'](_0x178c89[_0xa7d2('0x68')])&&_0x178c89[_0xa7d2('0x68')]>0x0){return!![];}else{loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x85'));}}else{loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x86'));}}else{loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x87'));}}else{loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x87'));}return![];}function mergeDataErlangB(_0x560919){return function(_0xe5b604){loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x88'));loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x89'),_0xe5b604[_0xa7d2('0x71')]);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x8a'),_0xe5b604[_0xa7d2('0x8b')]);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x8c'),_0xe5b604['erlangAbandonmentRate']);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x8d'),_0xe5b604[_0xa7d2('0x73')]);loggerPredictive['info'](_0xa7d2('0x8c'),_0xe5b604[_0xa7d2('0x72')]);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x83'));_[_0xa7d2('0x8e')](_0x560919,_0xe5b604);};}function getDiff(_0x24688b){var _0x495d6d=moment()[_0xa7d2('0x4a')](0x0);var _0x288f1c=moment(_0x24688b)[_0xa7d2('0x4a')](0x0);return _0x495d6d[_0xa7d2('0x4b')](_0x288f1c,_0xa7d2('0x4c'));}function ifInterval(_0x30dd23,_0xf5aee4){if(_[_0xa7d2('0x3d')](_0xf5aee4)){return![];}if(getDiff(_0xf5aee4)<_0x30dd23*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3905ef){if(isNotNull(_0x3905ef)){if(!_[_0xa7d2('0x3d')](_0x3905ef[_0xa7d2('0x28')])){_0x3905ef[_0xa7d2('0x28')]=undefined;loggerPredictive[_0xa7d2('0x7b')](_0x3905ef[_0xa7d2('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xa7d2('0x3d')](_0x3905ef[_0xa7d2('0x27')])){_0x3905ef[_0xa7d2('0x27')]=undefined;loggerPredictive[_0xa7d2('0x7b')](_0x3905ef[_0xa7d2('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xa7d2('0x3d')](_0x3905ef[_0xa7d2('0x8f')])){clearInterval(_0x3905ef[_0xa7d2('0x8f')]);_0x3905ef[_0xa7d2('0x8f')]=undefined;loggerPredictive[_0xa7d2('0x7b')](_0x3905ef[_0xa7d2('0x41')],_0xa7d2('0x90'));}}}function erlangb(_0x551b48,_0x27574e){if(_0x27574e===0x0){return 0x0;}var _0x1e2952=0x1;for(var _0x20b223=0x1;_0x20b223<=_0x27574e;_0x20b223+=0x1){_0x1e2952=0x1+_0x1e2952*_0x20b223/_0x551b48;}return 0x1/_0x1e2952;}function isVoiceQueueOutbound(_0x13944a){return _0x13944a==='outbound';}function isNotPreview(_0x40dec7){return _0x40dec7!==_0xa7d2('0x1d');}function isCampaignIvr(_0x250f68){return _0x250f68===_0xa7d2('0x91');}function getCallerId(_0x187770,_0x1d31fa,_0x39e986){if(!_['isUndefined'](_0x39e986)&&_0xa7d2('0x92')===typeof _0x39e986&&!_[_0xa7d2('0x46')](_0x39e986)){if(!_[_0xa7d2('0x3d')](_0x1d31fa)&&'string'===typeof _0x1d31fa&&!_[_0xa7d2('0x46')](_0x1d31fa)){return util[_0xa7d2('0x77')](_0xa7d2('0x93'),_0x1d31fa,_0x39e986);}return util['format']('\x22%s\x22\x20<%s>',_0x39e986,_0x39e986);}if(!_['isUndefined'](_0x187770)&&_0xa7d2('0x92')===typeof _0x187770&&!_[_0xa7d2('0x46')](_0x187770)){return _0x187770;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1dfb03,_0x4a0e92){return function(_0x442852){freeVariablesPredictive(_0x4a0e92);emitVoiceQueueSummary(_0x4a0e92);emitCampaignSummary(_0x4a0e92);loggerSyncQueueSummary[_0xa7d2('0x94')](_0x1dfb03,util[_0xa7d2('0x95')](_0x442852,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1823f3,_0xa0af51){return function(_0x31f8cc){loggerPredictive['error'](_0xa0af51['name'],_0x1823f3);loggerPredictive[_0xa7d2('0x94')](_0x31f8cc[_0xa7d2('0x96')]);freeVariablesPredictive(_0xa0af51);};}function loggerCatch(_0x3c4477){return function(_0xf2c1cf){logger[_0xa7d2('0x94')](_0x3c4477,util['inspect'](_0xf2c1cf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xc82eb1){return _0xc82eb1&&!_[_0xa7d2('0x3d')](_0xc82eb1)&&_0xc82eb1[_0xa7d2('0x97')]>0x0;}function decremetOriginate(_0x6d94d0){if(!_[_0xa7d2('0x3d')](_0x6d94d0)&&_0x6d94d0!==null){if(_0x6d94d0[_0xa7d2('0x98')](_0xa7d2('0x99'))){if(_0x6d94d0['originated']>0x0){_0x6d94d0[_0xa7d2('0x99')]-=0x1;}else{logger[_0xa7d2('0x94')](_0xa7d2('0x9a'));}}}else{logger[_0xa7d2('0x94')](_0xa7d2('0x9b'));}}function checkContactLowerLimitOriginate(_0x428af3,_0x23ec81,_0x310e5a){if(_0x23ec81>_0x310e5a){for(var _0x328c6f=0x0;_0x328c6f<_0x23ec81-_0x310e5a;_0x328c6f+=0x1){decremetOriginate(_0x428af3);}}}function loggerGetContactDialer(_0x87c6d8,_0xf1f303,_0x535709){return function(_0x59b43f){checkContactLowerLimitOriginate(_0xf1f303,_0x535709,0x0);logger[_0xa7d2('0x94')](_0x87c6d8,util[_0xa7d2('0x95')](_0x59b43f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5dd028){return function(_0x753341){if(isNotNull(_0x753341)&&isNotNull(_0x753341[0x0])){if(_0x753341[0x0]['contactsRescheduled']>0x0){_0x5dd028[_0xa7d2('0x3e')]=_0xa7d2('0x9c');logger['info']('[getContactDialer2][ReScheduled]'+_0x5dd028[_0xa7d2('0x41')],_0x753341[0x0][_0xa7d2('0x9d')],'contacts');}else{_0x5dd028[_0xa7d2('0x3e')]=_0xa7d2('0x9e');logger[_0xa7d2('0x7b')](_0xa7d2('0x9f')+_0x5dd028[_0xa7d2('0x41')]);}}};}function notSendMessagesQueue(_0x2b5c46){if(_0x2b5c46[_0xa7d2('0xa0')]){freeVariablesPredictive(_0x2b5c46);if(_0x2b5c46['originated']===0x0&&_0x2b5c46[_0xa7d2('0x53')]===0x0&&_0x2b5c46[_0xa7d2('0xa1')]===0x0&&(_0x2b5c46[_0xa7d2('0x52')]||0x0)===0x0){_0x2b5c46[_0xa7d2('0xa0')]=![];_0x2b5c46['available']=0x0;_0x2b5c46['message']=_0xa7d2('0xa2');loggerSyncQueueSummary['error'](_0xa7d2('0xa3'),_0x2b5c46[_0xa7d2('0x41')],'is\x20not\x20active');}else{_0x2b5c46['message']=_0xa7d2('0xa4');loggerSyncQueueSummary[_0xa7d2('0x94')](_0xa7d2('0xa3'),_0x2b5c46['name'],_0xa7d2('0xa5'));}emitVoiceQueueSummary(_0x2b5c46);}}function notSendMessagesCampaign(_0xab422f){if(_0xab422f['sendMessageOneNotActive']){if(_0xab422f['originated']===0x0){_0xab422f['sendMessageOneNotActive']=![];_0xab422f[_0xa7d2('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xa7d2('0x94')](_0xa7d2('0xa6'),_0xab422f[_0xa7d2('0x41')],_0xa7d2('0xa7'));}else{_0xab422f[_0xa7d2('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xa7d2('0xa6'),_0xab422f[_0xa7d2('0x41')],_0xa7d2('0xa5'));}emitCampaignSummary(_0xab422f);}}function createObjHistory(_0x2d69bf,_0x5ef3a8,_0x554871,_0x157962,_0x58b99c){_0x2d69bf['message']=_0x554871;var _0x378468=new Action(_0x2d69bf,_0x5ef3a8);var _0x2169a2=new History(_0x378468);_0x2169a2['state']=_0x157962;_0x2169a2[_0xa7d2('0xa8')]=_0x58b99c;_0x2169a2[_0xa7d2('0xa9')]=_0x378468[_0xa7d2('0xaa')];return _0x2169a2;}Dialer[_0xa7d2('0xab')][_0xa7d2('0xac')]=function(){var _0x503ae0=this;setInterval(function(){_0x503ae0[_0xa7d2('0xad')](_0x503ae0['uniqueId'],_0xa7d2('0xae'));_0x503ae0[_0xa7d2('0xad')](_0x503ae0[_0xa7d2('0x24')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x4cb6cb,_0x55568f){var _0x4323b7=this;for(var _0x8300d4 in _0x4cb6cb){if(_0x4cb6cb[_0xa7d2('0x98')](_0x8300d4)){this[_0xa7d2('0x1c')][_0xa7d2('0x19')](function(){if(!_[_0xa7d2('0xaf')](_0x4cb6cb[_0x8300d4])){return ami[_0xa7d2('0xb0')]({'action':_0xa7d2('0xb1'),'channel':_0x4cb6cb[_0x8300d4][_0xa7d2('0xb2')]})[_0xa7d2('0xb3')](function(_0x541248){if(_0x541248[_0xa7d2('0x3e')]===_0xa7d2('0xb4')){setTimeout(function(){if(_0x4cb6cb[_0x8300d4]&&_0x4cb6cb[_0x8300d4][_0xa7d2('0x4e')]!==_0xa7d2('0x91')){_0x4323b7[_0xa7d2('0xb5')](_0x4323b7[_0xa7d2('0x1e')][_0x4cb6cb[_0x8300d4]['queue']]);logger['error'](_0xa7d2('0xb6'),_0x55568f,_0x8300d4,_0x4cb6cb[_0x8300d4][_0xa7d2('0xb7')]);delete _0x4cb6cb[_0x8300d4];}if(_0x4cb6cb[_0x8300d4]&&_0x4cb6cb[_0x8300d4]['type']===_0xa7d2('0x91')){_0x4323b7[_0xa7d2('0xb5')](_0x4323b7[_0xa7d2('0x1f')][_0x4cb6cb[_0x8300d4][_0xa7d2('0xb7')]]);logger[_0xa7d2('0x94')](_0xa7d2('0xb8'),_0x55568f,_0x8300d4,_0x4cb6cb[_0x8300d4][_0xa7d2('0xb7')]);delete _0x4cb6cb[_0x8300d4];}},0x2328);}});}});}}};Dialer[_0xa7d2('0xab')][_0xa7d2('0xb9')]=function(_0x547b3e){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper[_0xa7d2('0xb9')](_0x547b3e))['catch'](loggerCatch(_0xa7d2('0xbc')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xbd')]=function(_0x444de9){return BPromise[_0xa7d2('0xba')]()['then'](cmHopperBlack[_0xa7d2('0xbd')](_0x444de9))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xbe')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xbf')]=function(_0x292274){return BPromise[_0xa7d2('0xba')]()['then'](cmHopperBlack[_0xa7d2('0xbf')](_0x292274))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc0')));};Dialer[_0xa7d2('0xab')]['averageHandleTime']=function(_0x59cd09){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x59cd09))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc1')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xc2')]=function(_0x2c7efa){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper[_0xa7d2('0xc2')](_0x2c7efa))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc3')));};Dialer[_0xa7d2('0xab')]['unlockContact']=function(_0x3bdc73,_0x186f53,_0x5146b9){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper['unlockContact'](_0x3bdc73,_0x186f53,_0x5146b9))['catch'](loggerCatch(_0xa7d2('0xc4')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xc5')]=function(_0x2c0c2f,_0xbf0955,_0x1e1df5,_0x35e9f2){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper[_0xa7d2('0xc5')](_0x2c0c2f,_0xbf0955,_0x1e1df5,_0x35e9f2))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc6')));};Dialer['prototype'][_0xa7d2('0xc7')]=function(_0x189bbd,_0x1565c5,_0xa04d21){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper['getContactDialerIvr'](_0x189bbd,_0x1565c5,_0xa04d21))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc6')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xc8')]=function(_0x46b6d6){return BPromise['resolve']()[_0xa7d2('0xbb')](voiceQueueRt[_0xa7d2('0xc8')](_0x46b6d6))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xc9')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xca')]=function(_0x4f8a21){return BPromise[_0xa7d2('0xba')]()[_0xa7d2('0xbb')](cmHopper['moveContactManagedDialer'](_0x4f8a21))['catch'](loggerCatch(_0xa7d2('0xcb')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xcc')]=function(_0x46fbfd){return BPromise['resolve']()[_0xa7d2('0xbb')](cmHopperHistory[_0xa7d2('0xcc')](_0x46fbfd))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xcd')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0xb5')]=function(_0x22a302){if(!_[_0xa7d2('0x3d')](_0x22a302)&&_0x22a302!==null){if(_0x22a302[_0xa7d2('0x98')](_0xa7d2('0x99'))){if(_0x22a302[_0xa7d2('0x99')]>0x0){_0x22a302[_0xa7d2('0x99')]-=0x1;}else{logger['error'](_0xa7d2('0xce'));}}}else{logger['error'](_0xa7d2('0xcf'));}};Dialer['prototype'][_0xa7d2('0xd0')]=function(_0xc81b90,_0x5ed713){var _0x43cc7d=this;return function(_0x1767e0){_0x43cc7d[_0xa7d2('0xb5')](_0x5ed713);logger[_0xa7d2('0x94')](_0xc81b90,util['inspect'](_0x1767e0,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xa7d2('0xd1')]=function(_0x131cb2,_0x790574,_0x283ef1){var _0x187838={'state':0x19,'statedesc':_0xa7d2('0xd2')};this[_0xa7d2('0xb5')](_0x790574);this[_0xa7d2('0xd3')](_[_0xa7d2('0x8e')](_0x187838,_[_0xa7d2('0xd4')](_0x283ef1,[_0xa7d2('0xd5'),_0xa7d2('0xd6'),_0xa7d2('0xd7'),_0xa7d2('0xd8'),_0xa7d2('0xd9')])),_0xa7d2('0xda'),_0xa7d2('0xdb'));logger[_0xa7d2('0x94')](_0x131cb2);};Dialer[_0xa7d2('0xab')][_0xa7d2('0xdc')]=function(_0x16e6d5){return _0x16e6d5===_0xa7d2('0xdd');};Dialer['prototype'][_0xa7d2('0xde')]=function(_0x369151){return!_[_0xa7d2('0x3d')](_0x369151)&&_0x369151&&!_[_0xa7d2('0x3d')](_0x369151[_0xa7d2('0x41')])&&!_[_0xa7d2('0x3d')](_0x369151[_0xa7d2('0x75')])&&_0x369151[_0xa7d2('0x75')]&&(this[_0xa7d2('0x21')][util['format'](_0xa7d2('0xdf'),_0x369151[_0xa7d2('0x41')])][_0xa7d2('0xb1')]==='reachable'||this[_0xa7d2('0x21')][util[_0xa7d2('0x77')](_0xa7d2('0xdf'),_0x369151[_0xa7d2('0x41')])]['status']==='unmonitored');};Dialer['prototype'][_0xa7d2('0xd3')]=function(_0xc2444f,_0x5ab14c,_0x232243){this[_0xa7d2('0xcc')](_0xc2444f)['catch'](loggerCatch(_0x5ab14c));this[_0xa7d2('0xca')](_0xc2444f)[_0xa7d2('0xb3')](loggerCatch(_0x232243));};Dialer['prototype']['syncVarSet']=function(_0x13c9bd){var _0x15c28b=this[_0xa7d2('0x26')][_0x13c9bd[_0xa7d2('0xe0')]];var _0x2187d8;if(!_[_0xa7d2('0xaf')](_0x13c9bd)&&!_['isNil'](_0x13c9bd['variable'])&&!_[_0xa7d2('0xaf')](_0x13c9bd[_0xa7d2('0xe1')][_0xa7d2('0xe2')])&&_0x13c9bd[_0xa7d2('0xe3')]===_0xa7d2('0xe4')&&_0x15c28b){if(_0x15c28b['type']!==_0xa7d2('0x91')&&this[_0xa7d2('0x1e')][_0x15c28b[_0xa7d2('0xb7')]]['dialAMDActive']&&_0x13c9bd[_0xa7d2('0xe5')]===_0xa7d2('0xe6')){delete this['uniqueId'][_0x13c9bd['uniqueid']];this[_0xa7d2('0xb5')](this[_0xa7d2('0x1e')][_0x15c28b[_0xa7d2('0xb7')]]);this['voiceQueues'][_0x15c28b[_0xa7d2('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0xa7d2('0x1e')][_0x15c28b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x2187d8=new Hangup(_0x15c28b,_0x13c9bd);_0x2187d8[_0xa7d2('0xe7')]=0x12;_0x2187d8[_0xa7d2('0xa8')]='HangupInAMD';_0x2187d8[_0xa7d2('0xe8')]='AMD';this[_0xa7d2('0xd3')](_0x2187d8,'[syncHangupInAMD][createHistory]',_0xa7d2('0xe9'));}if(_0x15c28b['type']!==_0xa7d2('0x91')&&this['voiceQueues'][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0xea')]&&_0x13c9bd[_0xa7d2('0xe5')]===_0xa7d2('0xeb')){var _0x2b8996=this;return new BPromise(function(_0x4a12d4,_0x44a775){delete _0x2b8996[_0xa7d2('0x26')][_0x13c9bd['uniqueid']];_0x2b8996['updateOriginated'](_0x2b8996[_0xa7d2('0x1e')][_0x15c28b['queue']]);_0x2b8996[_0xa7d2('0x1e')][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0x5c')]+=0x1;_0x2b8996[_0xa7d2('0x1e')][_0x15c28b['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x138e31=_0x2b8996[_0xa7d2('0x1e')][_0x15c28b[_0xa7d2('0xb7')]];var _0x4479d0=new Hangup(_0x15c28b,_0x13c9bd);_0x4479d0[_0xa7d2('0xe7')]=0x13;_0x4479d0['statedesc']='Machine';_0x4479d0[_0xa7d2('0xe8')]=_0xa7d2('0xec');_0x4479d0['countmachineretry']+=0x1;_0x4479d0[_0xa7d2('0xed')]+=0x1;_0x4479d0[_0xa7d2('0xee')]=!![];_0x2b8996['createHistory'](_0x4479d0)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xef')));if(_0x4479d0[_0xa7d2('0xf0')]+_0x4479d0[_0xa7d2('0xf1')]+_0x4479d0[_0xa7d2('0xf2')]+_0x4479d0[_0xa7d2('0xf3')]+_0x4479d0['countdropretry']+_0x4479d0[_0xa7d2('0xf4')]+_0x4479d0[_0xa7d2('0xf5')]+_0x4479d0[_0xa7d2('0xf6')]>=_0x138e31[_0xa7d2('0xf7')]){_0x2b8996['stateGlobal'](_0x4479d0,_0x4a12d4,_0x44a775,_0xa7d2('0xf8'));}else{if(_0x4479d0[_0xa7d2('0xf5')]>=_0x138e31[_0xa7d2('0xf9')]){_0x2b8996['createStateFinal'](_0x4479d0,_0x4a12d4,_0x44a775,_0xa7d2('0xfa'));}else{_0x2b8996[_0xa7d2('0xc2')]({'active':![],'countmachineretry':_0x4479d0[_0xa7d2('0xf5')],'scheduledat':moment()[_0xa7d2('0xfb')](_0x138e31[_0xa7d2('0xfc')],_0xa7d2('0xfd'))['format'](_0xa7d2('0xfe')),'ContactId':_0x4479d0[_0xa7d2('0xd5')],'ListId':_0x4479d0['ListId'],'VoiceQueueId':_0x4479d0[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x4479d0[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xff')));_0x4a12d4({'reschedule':0x1});}}});}if(_0x15c28b[_0xa7d2('0x4e')]===_0xa7d2('0x91')&&this[_0xa7d2('0x1f')][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0xea')]&&_0x13c9bd[_0xa7d2('0xe5')]===_0xa7d2('0xe6')){delete this[_0xa7d2('0x26')][_0x13c9bd['uniqueid']];this[_0xa7d2('0xb5')](this[_0xa7d2('0x1f')][_0x15c28b['queue']]);_0x2187d8=new Hangup(_0x15c28b,_0x13c9bd);_0x2187d8[_0xa7d2('0xe7')]=0x12;_0x2187d8['statedesc']=_0xa7d2('0x100');_0x2187d8[_0xa7d2('0xe8')]=_0xa7d2('0xec');this[_0xa7d2('0xd3')](_0x2187d8,'[syncHangupInAMDIvr][createHistory]',_0xa7d2('0x101'));}if(_0x15c28b['type']===_0xa7d2('0x91')&&this[_0xa7d2('0x1f')][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0xea')]&&_0x13c9bd[_0xa7d2('0xe5')]===_0xa7d2('0xeb')){var _0x2b8996=this;return new BPromise(function(_0x59d0c9,_0xd9727e){delete _0x2b8996['uniqueId'][_0x13c9bd[_0xa7d2('0xe0')]];_0x2b8996['updateOriginated'](_0x2b8996[_0xa7d2('0x1f')][_0x15c28b['queue']]);_0x2b8996[_0xa7d2('0x1f')][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0x5c')]+=0x1;_0x2b8996[_0xa7d2('0x1f')][_0x15c28b[_0xa7d2('0xb7')]][_0xa7d2('0x5b')]+=0x1;var _0x363144=_0x2b8996[_0xa7d2('0x1f')][_0x15c28b[_0xa7d2('0xb7')]];var _0x4a807f=new Hangup(_0x15c28b,_0x13c9bd);_0x4a807f[_0xa7d2('0xe7')]=0x13;_0x4a807f[_0xa7d2('0xa8')]=_0xa7d2('0x102');_0x4a807f[_0xa7d2('0xe8')]=_0xa7d2('0xec');_0x4a807f[_0xa7d2('0xf5')]+=0x1;_0x4a807f[_0xa7d2('0xed')]+=0x1;_0x4a807f[_0xa7d2('0xee')]=!![];_0x2b8996[_0xa7d2('0xcc')](_0x4a807f)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xef')));if(_0x4a807f[_0xa7d2('0xf0')]+_0x4a807f[_0xa7d2('0xf1')]+_0x4a807f['countnoanswerretry']+_0x4a807f[_0xa7d2('0xf3')]+_0x4a807f['countdropretry']+_0x4a807f[_0xa7d2('0xf4')]+_0x4a807f[_0xa7d2('0xf5')]+_0x4a807f['countagentrejectretry']>=_0x363144[_0xa7d2('0xf7')]){_0x2b8996[_0xa7d2('0x103')](_0x4a807f,_0x59d0c9,_0xd9727e,_0xa7d2('0xf8'));}else{if(_0x4a807f['countmachineretry']>=_0x363144[_0xa7d2('0xf9')]){_0x2b8996[_0xa7d2('0x104')](_0x4a807f,_0x59d0c9,_0xd9727e,_0xa7d2('0xfa'));}else{_0x2b8996['rescheduleContact']({'active':![],'countmachineretry':_0x4a807f[_0xa7d2('0xf5')],'scheduledat':moment()['add'](_0x363144[_0xa7d2('0xfc')],_0xa7d2('0xfd'))[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x4a807f[_0xa7d2('0xd5')],'ListId':_0x4a807f['ListId'],'VoiceQueueId':_0x4a807f['VoiceQueueId']||undefined,'CampaignId':_0x4a807f['CampaignId']||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xff')));_0x59d0c9({'reschedule':0x1});}}});}}};Dialer[_0xa7d2('0xab')]['syncHangup']=function(_0x428429){var _0x21c197=this[_0xa7d2('0x26')][_0x428429[_0xa7d2('0xe0')]];var _0x48d42b=this;var _0xc0ecd2;if(_0x21c197&&_0x21c197[_0xa7d2('0x4e')]===_0xa7d2('0x91')){delete this[_0xa7d2('0x26')][_0x428429[_0xa7d2('0xe0')]];this[_0xa7d2('0xb5')](this[_0xa7d2('0x1f')][_0x21c197['queue']]);this[_0xa7d2('0x1f')][_0x21c197['queue']][_0xa7d2('0x105')]+=0x1;_0xc0ecd2=new Hangup(_0x21c197,_0x428429);this[_0xa7d2('0xcc')](_0xc0ecd2)[_0xa7d2('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa7d2('0xca')](_0xc0ecd2)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x106')));}if(_0x21c197&&_0x21c197['type']!==_0xa7d2('0x91')&&isNotNull(this[_0xa7d2('0x1e')][_0x21c197['queue']][_0xa7d2('0x107')])){delete this[_0xa7d2('0x26')][_0x428429[_0xa7d2('0xe0')]];this['updateOriginated'](this['voiceQueues'][_0x21c197[_0xa7d2('0xb7')]]);this[_0xa7d2('0x1e')][_0x21c197[_0xa7d2('0xb7')]][_0xa7d2('0x5c')]+=0x1;this[_0xa7d2('0x1e')][_0x21c197[_0xa7d2('0xb7')]][_0xa7d2('0x5b')]+=0x1;_0xc0ecd2=new Hangup(_0x21c197,_0x428429);_0xc0ecd2['state']=0x10;_0xc0ecd2[_0xa7d2('0xa8')]=_0xa7d2('0x108');_0xc0ecd2[_0xa7d2('0xe8')]='AGI';this[_0xa7d2('0xcc')](_0xc0ecd2)[_0xa7d2('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa7d2('0xca')](_0xc0ecd2)['catch'](loggerCatch(_0xa7d2('0x106')));}if(_0x21c197&&_0x21c197[_0xa7d2('0x4e')]!==_0xa7d2('0x91')&&!isNotNull(this[_0xa7d2('0x1e')][_0x21c197['queue']][_0xa7d2('0x107')])){delete this[_0xa7d2('0x26')][_0x428429[_0xa7d2('0xe0')]];this['updateOriginated'](this[_0xa7d2('0x1e')][_0x21c197[_0xa7d2('0xb7')]]);this[_0xa7d2('0x1e')][_0x21c197[_0xa7d2('0xb7')]][_0xa7d2('0x67')]+=0x1;_0xc0ecd2=new Hangup(_0x21c197,_0x428429);_0xc0ecd2[_0xa7d2('0xe7')]=0xc;_0xc0ecd2[_0xa7d2('0xa8')]=_0x428429[_0xa7d2('0x109')];_0xc0ecd2['membername']='Unknow';this[_0xa7d2('0xcc')](_0xc0ecd2)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x10a')));this[_0xa7d2('0xca')](_0xc0ecd2)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x106')));}};Dialer[_0xa7d2('0xab')]['syncAgentComplete']=function(_0x2ddd55){var _0x3d521e=this['uniqueId'][_0x2ddd55[_0xa7d2('0xe0')]];var _0x2a93ac=this;if(this[_0xa7d2('0x1e')][_0x2ddd55['queue']]){if(_0x3d521e&&_0x3d521e[_0xa7d2('0x4e')]!==_0xa7d2('0x91')){delete this['uniqueId'][_0x2ddd55[_0xa7d2('0xe0')]];this[_0xa7d2('0x1e')][_0x2ddd55['queue']][_0xa7d2('0x5c')]+=0x1;var _0x1e7f63=new AgentComplete(_0x3d521e,_0x2ddd55);if(_0x2ddd55[_0xa7d2('0x10b')]===_0xa7d2('0x10c')){_0x1e7f63[_0xa7d2('0x10d')]=this['voiceQueues'][_0x2ddd55[_0xa7d2('0xb7')]][_0xa7d2('0x10e')]&&this[_0xa7d2('0x1e')][_0x2ddd55[_0xa7d2('0xb7')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xa7d2('0xfe')):undefined;}this[_0xa7d2('0xcc')](_0x1e7f63)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x10f')));this['moveContactManagedDialer'](_0x1e7f63)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x110')));}}};Dialer[_0xa7d2('0xab')][_0xa7d2('0x2c')]=function(_0x160d82){if(this[_0xa7d2('0x1e')][_0x160d82[_0xa7d2('0xb7')]]){if(this[_0xa7d2('0x26')][_0x160d82[_0xa7d2('0xe0')]]&&this['uniqueId'][_0x160d82['uniqueid']][_0xa7d2('0x4e')]!==_0xa7d2('0x91')){this[_0xa7d2('0xb5')](this[_0xa7d2('0x1e')][_0x160d82[_0xa7d2('0xb7')]]);this['uniqueId'][_0x160d82[_0xa7d2('0xe0')]][_0xa7d2('0x111')]=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));}}};Dialer['prototype'][_0xa7d2('0x112')]=function(_0x571f7d){this[_0xa7d2('0xcc')](_0x571f7d)['catch'](loggerCatch(_0xa7d2('0x10f')));this[_0xa7d2('0xca')](_0x571f7d)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x113')));};Dialer[_0xa7d2('0xab')][_0xa7d2('0x2f')]=function(_0x11a836){var _0x256376=this[_0xa7d2('0x26')][_0x11a836[_0xa7d2('0xe0')]];var _0x467a00=this;if(this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]]){if(_0x256376&&_0x256376[_0xa7d2('0x4e')]!==_0xa7d2('0x91')){delete this[_0xa7d2('0x26')][_0x11a836[_0xa7d2('0xe0')]];this[_0xa7d2('0xb5')](this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]]);_0x256376[_0xa7d2('0x114')]=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));var _0x371319=new QueueCallerAbandon(_0x256376,_0x11a836);if(getSeconds(_0x256376['droptime'],_0x256376[_0xa7d2('0x115')])>=_0x256376[_0xa7d2('0x116')]){this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x7f')]+=0x1;this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x117')]+=0x1;this['voiceQueues'][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x6b')]+=0x1;_0x371319[_0xa7d2('0xe7')]=0xa;_0x371319[_0xa7d2('0xa8')]=_0xa7d2('0x118');_0x371319[_0xa7d2('0x119')]=_0xa7d2('0x11a');_0x371319[_0xa7d2('0x10d')]=this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x10e')]?moment()['format'](_0xa7d2('0xfe')):undefined;_0x371319[_0xa7d2('0x11b')]+=0x1;_0x371319[_0xa7d2('0xed')]+=0x1;if(_0x371319[_0xa7d2('0x11b')]>=this['voiceQueues'][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x11c')]){this[_0xa7d2('0x112')](_0x371319);}else{this[_0xa7d2('0xc2')]({'active':![],'countdropretry':_0x371319[_0xa7d2('0x11b')],'scheduledat':moment()[_0xa7d2('0xfb')](this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x11d')],_0xa7d2('0xfd'))[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x256376['ContactId'],'ListId':_0x256376[_0xa7d2('0xd6')],'VoiceQueueId':_0x256376[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x256376[_0xa7d2('0xd9')]||undefined})['catch'](loggerCatch(_0xa7d2('0x11e')));var _0x10f4e3=new History(_0x371319);_0x10f4e3[_0xa7d2('0xe7')]=0xa;_0x10f4e3[_0xa7d2('0xa8')]=_0xa7d2('0x118');_0x10f4e3[_0xa7d2('0xaa')]=moment()['format'](_0xa7d2('0xfe'));_0x10f4e3[_0xa7d2('0xa9')]=_0x10f4e3['starttime'];_0x10f4e3[_0xa7d2('0x11f')]=_0x371319[_0xa7d2('0x11f')];_0x10f4e3[_0xa7d2('0x120')]=_0x371319[_0xa7d2('0x120')];this['createHistory'](_0x10f4e3)[_0xa7d2('0xb3')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xa7d2('0x1e')][_0x11a836['queue']][_0xa7d2('0x81')]+=0x1;this[_0xa7d2('0x1e')][_0x11a836['queue']][_0xa7d2('0x61')]+=0x1;_0x371319[_0xa7d2('0xe7')]=0xb;_0x371319['statedesc']=_0xa7d2('0x121');_0x371319[_0xa7d2('0x119')]=_0xa7d2('0x122');_0x371319['countabandonedretry']+=0x1;_0x371319[_0xa7d2('0xed')]+=0x1;if(_0x371319[_0xa7d2('0xf4')]>=this[_0xa7d2('0x1e')][_0x11a836[_0xa7d2('0xb7')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x371319);}else{this[_0xa7d2('0xc2')]({'active':![],'countabandonedretry':_0x371319[_0xa7d2('0xf4')],'scheduledat':moment()[_0xa7d2('0xfb')](this['voiceQueues'][_0x11a836[_0xa7d2('0xb7')]][_0xa7d2('0x123')],_0xa7d2('0xfd'))[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x256376[_0xa7d2('0xd5')],'ListId':_0x256376['ListId'],'VoiceQueueId':_0x256376[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x256376[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x124')));var _0x10f4e3=new History(_0x371319);_0x10f4e3['state']=0xb;_0x10f4e3[_0xa7d2('0xa8')]=_0xa7d2('0x121');_0x10f4e3[_0xa7d2('0xaa')]=moment()['format'](_0xa7d2('0xfe'));_0x10f4e3[_0xa7d2('0xa9')]=_0x10f4e3[_0xa7d2('0xaa')];_0x10f4e3[_0xa7d2('0x11f')]=_0x371319['calleridname'];_0x10f4e3[_0xa7d2('0x120')]=_0x371319[_0xa7d2('0x120')];this[_0xa7d2('0xcc')](_0x10f4e3)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x125')));}}}}};Dialer[_0xa7d2('0xab')][_0xa7d2('0x37')]=function(_0x15b172){if(this[_0xa7d2('0x24')][_0x15b172['uniqueid']]){this[_0xa7d2('0x24')][_0x15b172[_0xa7d2('0xe0')]][_0xa7d2('0xb2')]=_0x15b172[_0xa7d2('0xb2')];}if(this[_0xa7d2('0x26')][_0x15b172[_0xa7d2('0xe0')]]){this[_0xa7d2('0x26')][_0x15b172[_0xa7d2('0xe0')]][_0xa7d2('0xb2')]=_0x15b172[_0xa7d2('0xb2')];}};Dialer['prototype'][_0xa7d2('0x3a')]=function(_0x3883f2){if(strategy[this[_0xa7d2('0x1e')][this['actions'][_0x3883f2['actionid']][_0xa7d2('0xb7')]]['strategy']]===_0xa7d2('0x18')){if(this[_0xa7d2('0x24')][_0x3883f2['actionid']]&&_[_0xa7d2('0xaf')](this['actions'][_0x3883f2[_0xa7d2('0x126')]][_0xa7d2('0x127')])&&_0x3883f2[_0xa7d2('0xb1')]==='1'&&_0x3883f2[_0xa7d2('0x128')]==='0'){if(this[_0xa7d2('0x20')][_0x3883f2['stateinterface']]){if(!this[_0xa7d2('0x20')][_0x3883f2[_0xa7d2('0x129')]][_0xa7d2('0x127')]){this[_0xa7d2('0x20')][_0x3883f2['stateinterface']][_0xa7d2('0x127')]=!![];this[_0xa7d2('0x24')][_0x3883f2['actionid']][_0xa7d2('0x127')]=!![];this[_0xa7d2('0x24')][_0x3883f2[_0xa7d2('0x126')]]['stateinterface']=_0x3883f2[_0xa7d2('0x129')];}}}}else if((strategy[this[_0xa7d2('0x1e')][this[_0xa7d2('0x24')][_0x3883f2['actionid']][_0xa7d2('0xb7')]][_0xa7d2('0x50')]]||_0xa7d2('0x17'))===_0xa7d2('0x17')){if(this['actions'][_0x3883f2[_0xa7d2('0x126')]]){if(this['agents'][_0x3883f2[_0xa7d2('0x129')]]){this[_0xa7d2('0x24')][_0x3883f2[_0xa7d2('0x126')]]['stateinterface']=_0x3883f2[_0xa7d2('0x129')];if(_[_0xa7d2('0xaf')](this[_0xa7d2('0x2a')][this[_0xa7d2('0x24')][_0x3883f2[_0xa7d2('0x126')]][_0xa7d2('0xb7')]])){this[_0xa7d2('0x2a')][this[_0xa7d2('0x24')][_0x3883f2[_0xa7d2('0x126')]]['queue']]=[];}this[_0xa7d2('0x2a')][this[_0xa7d2('0x24')][_0x3883f2[_0xa7d2('0x126')]][_0xa7d2('0xb7')]][_0xa7d2('0x12a')](_[_0xa7d2('0x8e')](_[_0xa7d2('0xd4')](this[_0xa7d2('0x24')][_0x3883f2['actionid']],[_0xa7d2('0x12b'),_0xa7d2('0x129')]),{'status':_0x3883f2['status'],'paused':_0x3883f2[_0xa7d2('0x128')]}));}}}};function unlockQueueStatus(_0x306e8c,_0x97603d){setTimeout(function(){if(_[_0xa7d2('0x3d')](_0x306e8c['queueStatusComplete'])){loggerBooked[_0xa7d2('0x94')]('[unlockQueueStatus][undefined]',_0x97603d);}_0x306e8c[_0xa7d2('0x12c')]=!![];loggerBooked[_0xa7d2('0x7b')]('[booked][unlockQueueStatus]',_0x97603d,JSON[_0xa7d2('0x12d')](_[_0xa7d2('0xd4')](_0x306e8c,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0xa7d2('0xab')][_0xa7d2('0x3b')]=function(_0x9b56b4){var _0x2b67fb=this;var _0x101d40=_0x2b67fb[_0xa7d2('0x1e')][_0x2b67fb[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]];if(strategy[this[_0xa7d2('0x1e')][this[_0xa7d2('0x24')][_0x9b56b4['actionid']][_0xa7d2('0xb7')]][_0xa7d2('0x50')]]==='roundrobin'){if(this[_0xa7d2('0x24')][_0x9b56b4['actionid']]&&this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0x129')]){this[_0xa7d2('0x1d')]['run'](this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0x12b')],this['actions'][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0x129')])[_0xa7d2('0xb3')](function(_0x4e5065){logger[_0xa7d2('0x94')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xa7d2('0x95')](_0x4e5065,{'showHidden':![],'depth':null}));})[_0xa7d2('0x1b')](function(){_0x2b67fb[_0xa7d2('0xb5')](_0x2b67fb['voiceQueues'][_0x2b67fb[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]]['queue']]);_0x2b67fb[_0xa7d2('0x20')][_0x2b67fb[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0x129')]][_0xa7d2('0x127')]=![];delete _0x2b67fb[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]];unlockQueueStatus(_0x101d40);});}else{this[_0xa7d2('0xb5')](this[_0xa7d2('0x1e')][this['actions'][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]);this[_0xa7d2('0xc2')]({'active':![],'ContactId':this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xd5')],'ListId':this[_0xa7d2('0x24')][_0x9b56b4['actionid']]['ListId'],'VoiceQueueId':this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xd8')]||undefined,'CampaignId':this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]]['CampaignId']||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x12e')));delete this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]];unlockQueueStatus(_0x101d40);}}else if((strategy[this[_0xa7d2('0x1e')][this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]][_0xa7d2('0x50')]]||_0xa7d2('0x17'))===_0xa7d2('0x17')){var _0x278928;if(this[_0xa7d2('0x24')][_0x9b56b4['actionid']]&&!_[_0xa7d2('0x46')](this[_0xa7d2('0x2a')][this[_0xa7d2('0x24')][_0x9b56b4['actionid']][_0xa7d2('0xb7')]])){if(this[_0xa7d2('0x2b')][_0x2b67fb[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]){this[_0xa7d2('0x2b')][_0x2b67fb['actions'][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]=this['queueBookedRR'][this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]?this[_0xa7d2('0x2b')][this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]:this['queueBooked'][this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]?this[_0xa7d2('0x2a')][this[_0xa7d2('0x24')][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]][_0xa7d2('0x12f')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x9b56b4[_0xa7d2('0x126')]][_0xa7d2('0xb7')]]['_rr']=this[_0xa7d2('0x2b')][this[_0xa7d2('0x24')][_0x9b56b4['actionid']][_0xa7d2('0xb7')]];for(var _0x413783=0x0;_0x413783=0x0?!![]:![];})[_0xa7d2('0xb3')](myreject(_0x324157)));}}else{_0xda0fc2['push'](ami[_0xa7d2('0xb0')]({'action':_0xa7d2('0x144'),'command':util[_0xa7d2('0x77')](_0xa7d2('0x145'),_0x5c4f63,!_[_0xa7d2('0x3d')](config[_0xa7d2('0x141')][_0x6f604f])?_0x6f604f:'')})['then'](function(_0x484c40){return _0x484c40[_0xa7d2('0x147')][_0xa7d2('0x148')](_0xa7d2('0x149'))>=0x0?!![]:![];})['catch'](myreject(_0x324157)));}BPromise['all'](_0xda0fc2)[_0xa7d2('0xbb')](function(_0x526045){var _0x4e6fb3=_[_0xa7d2('0x14a')](_0x526045);if(_0x4e6fb3){return _0x44b84f(_0x4e6fb3);}else{_0xf51e0['message']=_0x65a960?'GLOBAL_INTERVAL_IS_OVERTIME':_0xa7d2('0x14b');return _0x324157(msgResponse(_0xa7d2('0x14c'),_0xa7d2('0x13e'),_0xa7d2('0x14d')+_0x65a960+'\x20'+_0x4c2c43+_0xa7d2('0x14e')+util[_0xa7d2('0x95')](_0x5c4f63,{'showHidden':![],'depth':null})+_0xa7d2('0x14f')+_0x6f604f));}})[_0xa7d2('0xb3')](function(_0x1a64b3){return _0x324157(msgResponse('ifTime',_0xa7d2('0x13e'),JSON[_0xa7d2('0x12d')](_0x1a64b3)));});});};Dialer[_0xa7d2('0xab')][_0xa7d2('0x150')]=function(_0x44e98f){var _0x5d2543=this;return function(){switch(_0x44e98f[_0xa7d2('0x151')]){case _0xa7d2('0x152'):freeVariablesPredictive(_0x44e98f);_0x5d2543['handlePower'](_0x44e98f,0x1);break;case _0xa7d2('0x153'):freeVariablesPredictive(_0x44e98f);_0x5d2543[_0xa7d2('0x154')](_0x44e98f,_0x44e98f[_0xa7d2('0x155')]);break;case'predictive':_0x5d2543[_0xa7d2('0x8')](_0x44e98f);break;case _0xa7d2('0x156'):freeVariablesPredictive(_0x44e98f);_0x5d2543[_0xa7d2('0x154')](_0x44e98f,0x1);break;default:freeVariablesPredictive(_0x44e98f);logger['error']('Queue',_0x44e98f['name'],'method\x20not\x20recognized');}};};Dialer[_0xa7d2('0xab')][_0xa7d2('0x157')]=function(_0x52f878){var _0x5cd836=this;return function(){_0x5cd836[_0xa7d2('0x158')](_0x52f878);};};Dialer[_0xa7d2('0xab')][_0xa7d2('0xa')]=function(_0x1657ee){var _0x580c76=this;if(isNotPreview(_0x1657ee['dialMethod'])){if(isVoiceQueueOutbound(_0x1657ee[_0xa7d2('0x4e')])&&isActive(_0x1657ee[_0xa7d2('0x56')])){_0x1657ee['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xa7d2('0xbb')](checkIsLoggedIn(_0x1657ee,_0x1657ee[_0xa7d2('0x51')]))[_0xa7d2('0xbb')](checkIsActive(_0x1657ee,_0x1657ee[_0xa7d2('0x56')]))[_0xa7d2('0xbb')](checkInterval(_0x1657ee))[_0xa7d2('0xbb')](_0x580c76['checkIsTrunkReachable'](_0x1657ee))[_0xa7d2('0xbb')](_0x580c76['checkIfTime'](_0x1657ee[_0xa7d2('0x159')],_0x1657ee['dialTimezone'],_0x1657ee[_0xa7d2('0x41')],_0x1657ee))[_0xa7d2('0xbb')](_0x580c76[_0xa7d2('0x15a')](_0x1657ee['Interval'],_0x1657ee[_0xa7d2('0x15b')],_0x1657ee[_0xa7d2('0x41')],_0x1657ee))[_0xa7d2('0xbb')](_0x580c76[_0xa7d2('0x150')](_0x1657ee))['catch'](loggerCatchQueueSummary(_0xa7d2('0x15c'),_0x1657ee));}else{notSendMessagesQueue(_0x1657ee);}}else{freeVariablesPredictive(_0x1657ee);}};Dialer['prototype'][_0xa7d2('0x15d')]=function(){var _0x5546a0=this;var _0x420ab4;for(var _0x18262e in this['campaigns']){if(this[_0xa7d2('0x1f')][_0xa7d2('0x98')](_0x18262e)){_0x420ab4=this[_0xa7d2('0x1f')][_0x18262e];if(isCampaignIvr(_0x420ab4['type'])&&isActive(_0x420ab4['active'])){_0x420ab4[_0xa7d2('0xa0')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x420ab4,_0x420ab4[_0xa7d2('0x75')]))['then'](checkInterval(_0x420ab4))[_0xa7d2('0xbb')](_0x5546a0[_0xa7d2('0x15e')](_0x420ab4))['then'](_0x5546a0[_0xa7d2('0x13c')](_0x420ab4['dialGlobalInterval'],_0x420ab4[_0xa7d2('0x15b')],_0x420ab4[_0xa7d2('0x41')],_0x420ab4))[_0xa7d2('0xbb')](_0x5546a0[_0xa7d2('0x15a')](_0x420ab4[_0xa7d2('0x43')],_0x420ab4[_0xa7d2('0x15b')],_0x420ab4[_0xa7d2('0x41')],_0x420ab4))['then'](_0x5546a0['launchHandleIvr'](_0x420ab4))[_0xa7d2('0xb3')](loggerCatchQueueSummary(_0xa7d2('0x15f'),_0x420ab4));}else{notSendMessagesCampaign(_0x420ab4);}}}};function getCallerIdRandom(_0x388a28,_0x5155db){var _0x29da47,_0x2df808,_0x145cfe;if(_0x5155db<=0x0){_0x5155db=0x1;}_0x29da47=new RegExp(_0xa7d2('0x160')+_0x5155db+'}$');_0x2df808=Math[_0xa7d2('0x161')](0xa,_0x5155db-0x1);_0x145cfe=Math['pow'](0xa,_0x5155db)-0x1;return util['format']('%s',_[_0xa7d2('0x162')](_0x388a28,_0x29da47,_[_0xa7d2('0x163')](_0x2df808,_0x145cfe)));}function extractCalleridName(_0x4c5226){var _0x54f922=_0x4c5226[_0xa7d2('0x164')](/"(.*?)"/);return _0x54f922?_0x54f922[0x1]:_0x4c5226;}function extractCalleridNumber(_0x28f586){var _0x597b38=_0x28f586['match'](/<(.*?)>/);return _0x597b38?_0x597b38[0x1]:_0x28f586;}Dialer[_0xa7d2('0xab')][_0xa7d2('0x165')]=function(_0x4c2fc6,_0x234f33){var _0x5ddbc9=this;var _0x527c3c=uuid['v4']();this[_0xa7d2('0x24')][_0x527c3c]=new Action(_0x4c2fc6,_0x234f33,_0x527c3c);return new BPromise(function(_0x1f61f4,_0x5564f6){if(_[_0xa7d2('0x3d')](_0x4c2fc6)&&_0xa7d2('0x166')!==typeof _0x4c2fc6){return _0x5564f6(msgResponse('originate',_0xa7d2('0x13e'),_0xa7d2('0x167')));}if(_['isUndefined'](_0x234f33['Contact'][_0xa7d2('0x168')])||_0x234f33[_0xa7d2('0x169')]['phone']===null){return _0x5564f6(msgResponse(_0xa7d2('0x16a'),_0xa7d2('0x13e'),_0xa7d2('0x16b')));}var _0x285c7d={'XMD-CALLERID':_0x5ddbc9[_0xa7d2('0x24')][_0x527c3c][_0xa7d2('0x16c')](),'XMD-AGI':_0x4c2fc6['dialQueueProject']?util[_0xa7d2('0x77')](_0xa7d2('0x16d'),ipAgi,_0x4c2fc6['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x4c2fc6[_0xa7d2('0x10e')]?util[_0xa7d2('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4c2fc6[_0xa7d2('0x10e')]):_0xa7d2('0x16e'),'XMD-QUEUE':_0x4c2fc6[_0xa7d2('0x4e')]==='outbound'?util[_0xa7d2('0x77')](_0xa7d2('0x16f'),_0x4c2fc6[_0xa7d2('0x41')],_0x4c2fc6[_0xa7d2('0x170')]||'',_0x4c2fc6['dialAgiAfterHangupAgent']?'c':'',_0x4c2fc6['dialQueueTimeout']||0x3):_0xa7d2('0x16e'),'XMD-CONTACTID':_0x234f33[_0xa7d2('0xd5')],'XMD-CDRTYPE':_0xa7d2('0x7'),'CALLERID(all)':_0x5ddbc9[_0xa7d2('0x24')][_0x527c3c][_0xa7d2('0x16c')](),'XMD-AMD':_0x4c2fc6[_0xa7d2('0xea')]?'ACTIVE':_0xa7d2('0x16e'),'XMD-DESTINATION':_0xa7d2('0xe4')};if(_0x4c2fc6['dialAMDActive']){_0x285c7d['XMD-AMDINITIALSILENCE']=_0x4c2fc6[_0xa7d2('0x171')]||0x9c4;_0x285c7d[_0xa7d2('0x172')]=_0x4c2fc6[_0xa7d2('0x173')]||0x5dc;_0x285c7d[_0xa7d2('0x174')]=_0x4c2fc6['dialAMDAfterGreetingSilence']||0x320;_0x285c7d['XMD-AMDTOTALANALYSISTIME']=_0x4c2fc6[_0xa7d2('0x175')]||0x1388;_0x285c7d[_0xa7d2('0x176')]=_0x4c2fc6[_0xa7d2('0x177')]||0x64;_0x285c7d['XMD-AMDBETWEENWORDSSILENCE']=_0x4c2fc6[_0xa7d2('0x178')]||0x32;_0x285c7d[_0xa7d2('0x179')]=_0x4c2fc6[_0xa7d2('0x17a')]||0x3;_0x285c7d[_0xa7d2('0x17b')]=_0x4c2fc6['dialAMDSilenceThreshold']||0x100;_0x285c7d['XMD-AMDMAXIMUMWORDLENGTH']=_0x4c2fc6[_0xa7d2('0x17c')]||0x1388;}if(_0x4c2fc6[_0xa7d2('0x4e')]===_0xa7d2('0x4f')){_0x285c7d[_0xa7d2('0x17d')]=_0x234f33[_0xa7d2('0xd8')];}else{_0x285c7d['XMD-CAMPAIGNID']=_0x234f33[_0xa7d2('0xd9')];}for(var _0x2de07 in _0x234f33[_0xa7d2('0x169')]){if(_0x234f33[_0xa7d2('0x169')][_0xa7d2('0x98')](_0x2de07)){if(isNotNull(_0x234f33[_0xa7d2('0x169')][_0x2de07])&&_0x2de07!=='id'&&_0x2de07!==_0xa7d2('0x17e')&&_0x2de07!==_0xa7d2('0x17f')&&_0x2de07!==_0xa7d2('0x180')){_0x285c7d[util[_0xa7d2('0x77')]('%s%s',_0xa7d2('0x181'),_['toUpper'](_0x2de07))]=_0x234f33['Contact'][_0x2de07];}}}var _0x186ba6=_0x5ddbc9['isTrunkReachable'](_0x4c2fc6['Trunk'])?getCallerId(_0x4c2fc6[_0xa7d2('0x74')]['callerid'],_0x4c2fc6[_0xa7d2('0x57')],_0x4c2fc6[_0xa7d2('0x182')]>0x0?getCallerIdRandom(_0x4c2fc6[_0xa7d2('0x58')],_0x4c2fc6['dialRandomLastDigitCallerIdNumber']):_0x4c2fc6['dialOriginateCallerIdNumber']):getCallerId(_[_0xa7d2('0xaf')](_0x4c2fc6['TrunkBackup'])?_0x4c2fc6[_0xa7d2('0x74')]['callerid']:_0x4c2fc6['TrunkBackup'][_0xa7d2('0x76')],_0x4c2fc6[_0xa7d2('0x57')],_0x4c2fc6[_0xa7d2('0x182')]>0x0?getCallerIdRandom(_0x4c2fc6[_0xa7d2('0x58')],_0x4c2fc6['dialRandomLastDigitCallerIdNumber']):_0x4c2fc6[_0xa7d2('0x58')]);if(_0x186ba6){_0x285c7d[_0xa7d2('0x183')]=_0x5ddbc9[_0xa7d2('0x24')][_0x527c3c][_0xa7d2('0x184')]=extractCalleridName(_0x186ba6);_0x285c7d[_0xa7d2('0x185')]=_0x5ddbc9[_0xa7d2('0x24')][_0x527c3c][_0xa7d2('0x186')]=extractCalleridNumber(_0x186ba6);}return ami[_0xa7d2('0xb0')]({'actionid':_0x527c3c,'action':_0xa7d2('0x16a'),'channel':_0x5ddbc9[_0xa7d2('0xde')](_0x4c2fc6[_0xa7d2('0x74')])?util[_0xa7d2('0x77')](_0xa7d2('0x187'),_0x4c2fc6[_0xa7d2('0x74')][_0xa7d2('0x41')],isNotNull(_0x4c2fc6[_0xa7d2('0x5a')])?_0x4c2fc6[_0xa7d2('0x5a')][_0xa7d2('0x188')]()||'':'',_0x4c2fc6['dialCutDigit']>0x0?_0x234f33[_0xa7d2('0x169')][_0xa7d2('0x168')][_0xa7d2('0x189')](_0x4c2fc6[_0xa7d2('0x18a')]):_0x234f33['Contact'][_0xa7d2('0x168')]):util[_0xa7d2('0x77')](_0xa7d2('0x187'),_[_0xa7d2('0xaf')](_0x4c2fc6['TrunkBackup'])?_0x4c2fc6[_0xa7d2('0x74')][_0xa7d2('0x41')]:_0x4c2fc6[_0xa7d2('0x139')][_0xa7d2('0x41')],isNotNull(_0x4c2fc6[_0xa7d2('0x5a')])?_0x4c2fc6[_0xa7d2('0x5a')][_0xa7d2('0x188')]()||'':'',_0x4c2fc6[_0xa7d2('0x18a')]>0x0?_0x234f33[_0xa7d2('0x169')][_0xa7d2('0x168')][_0xa7d2('0x189')](_0x4c2fc6[_0xa7d2('0x18a')]):_0x234f33[_0xa7d2('0x169')][_0xa7d2('0x168')]),'callerid':_0x186ba6,'Exten':_0xa7d2('0xe4'),'Context':_0xa7d2('0x18b'),'Priority':'1','variable':_0x285c7d,'timeout':(_0x4c2fc6[_0xa7d2('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x527c3c})[_0xa7d2('0xbb')](function(_0x58442e){return _0x1f61f4(_0x58442e);})[_0xa7d2('0xb3')](function(_0x380b33){_0x4c2fc6[_0xa7d2('0x64')]+=0x1;var _0x31ab3f=new History(_0x5ddbc9[_0xa7d2('0x24')][_0x527c3c]);logger[_0xa7d2('0x94')](util['format'](_0xa7d2('0x18c'),JSON['stringify'](_0x380b33)));_0x31ab3f[_0xa7d2('0xe7')]=0xe;_0x31ab3f[_0xa7d2('0xa8')]=_0xa7d2('0x18d');_0x31ab3f[_0xa7d2('0xaa')]=moment()[_0xa7d2('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x31ab3f['endtime']=_0x31ab3f['starttime'];_0x5ddbc9['createHistory'](_0x31ab3f)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x18e')));_0x5ddbc9['moveContactManagedDialer'](_0x31ab3f)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x18e')))[_0xa7d2('0x1b')](function(){delete _0x5ddbc9['actions'][_0x527c3c];return _0x5564f6(msgResponse(_0xa7d2('0x16a'),'Error',_0xa7d2('0x18f')));});});});};Dialer[_0xa7d2('0xab')][_0xa7d2('0x31')]=function(_0xef77c9){var _0x2b571a=this[_0xa7d2('0x24')][_0xef77c9[_0xa7d2('0x126')]];var _0x9e0979=this;if(_0x2b571a){delete this['actions'][_0xef77c9[_0xa7d2('0x126')]];_0x2b571a[_0xa7d2('0x115')]=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));var _0x5aebc4=_0x2b571a[_0xa7d2('0x4e')]==='ivr'?this[_0xa7d2('0x1f')][_0x2b571a[_0xa7d2('0xb7')]]:this['voiceQueues'][_0x2b571a[_0xa7d2('0x190')]()];if(!this[_0xa7d2('0xdc')](_0xef77c9['response'])){this['updateOriginated'](_0x5aebc4);return this['callProgressDetecting'](_0x2b571a,_0x5aebc4,_0xef77c9)[_0xa7d2('0xbb')](function(_0x1c947e){})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x191')));}else{this['uniqueId'][_0xef77c9[_0xa7d2('0xe0')]]=_0x2b571a;}}};Dialer[_0xa7d2('0xab')]['checkRetriveMax']=function(_0x406d91,_0x306206,_0x46c6b8){var _0x410d60=new History(_0x306206);if(_0x410d60[_0xa7d2('0xf0')]+_0x410d60[_0xa7d2('0xf1')]+_0x410d60[_0xa7d2('0xf2')]+_0x410d60[_0xa7d2('0xf3')]+_0x410d60['countdropretry']+_0x410d60['countabandonedretry']+_0x410d60[_0xa7d2('0xf5')]+_0x410d60[_0xa7d2('0xf6')]>=_0x46c6b8[_0xa7d2('0xf7')]-0x1){return!![];}switch(_0x406d91){case 0x3:if(_0x410d60[_0xa7d2('0xf2')]>=_0x46c6b8[_0xa7d2('0x192')]-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countnoanswerretry':_0x410d60['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8['dialNoAnswerRetryFrequency'],_0xa7d2('0xfd'))['format'](_0xa7d2('0xfe')),'ContactId':_0x410d60[_0xa7d2('0xd5')],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x410d60[_0xa7d2('0xf0')]>=_0x46c6b8['dialBusyMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x410d60[_0xa7d2('0xf0')]+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8[_0xa7d2('0x193')],'minutes')[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x410d60[_0xa7d2('0xd5')],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60['VoiceQueueId']||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x410d60[_0xa7d2('0xf1')]>=_0x46c6b8[_0xa7d2('0x194')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x410d60[_0xa7d2('0xf1')]+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8[_0xa7d2('0x195')],_0xa7d2('0xfd'))[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x410d60['ContactId'],'ListId':_0x410d60['ListId'],'VoiceQueueId':_0x410d60['VoiceQueueId']||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})['catch'](loggerCatch(_0xa7d2('0x196')));}break;case 0x0:if(_0x410d60[_0xa7d2('0xf3')]>=_0x46c6b8[_0xa7d2('0x197')]-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countnosuchnumberretry':_0x410d60['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8[_0xa7d2('0x198')],_0xa7d2('0xfd'))[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x410d60[_0xa7d2('0xd5')],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x199')));}break;case 0xa:if(_0x410d60['countdropretry']>=_0x46c6b8[_0xa7d2('0x11c')]-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countdropretry':_0x410d60[_0xa7d2('0x11b')]+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8[_0xa7d2('0x11d')],_0xa7d2('0xfd'))['format'](_0xa7d2('0xfe')),'ContactId':_0x410d60[_0xa7d2('0xd5')],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x11e')));}break;case 0xb:if(_0x410d60['countabandonedretry']>=_0x46c6b8['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countabandonedretry':_0x410d60[_0xa7d2('0xf4')]+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8[_0xa7d2('0x123')],'minutes')[_0xa7d2('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x410d60['ContactId'],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x124')));}break;case 0x13:if(_0x410d60[_0xa7d2('0xf5')]>=_0x46c6b8[_0xa7d2('0xf9')]-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countmachineretry':_0x410d60[_0xa7d2('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x46c6b8[_0xa7d2('0xfc')],_0xa7d2('0xfd'))['format'](_0xa7d2('0xfe')),'ContactId':_0x410d60[_0xa7d2('0xd5')],'ListId':_0x410d60['ListId'],'VoiceQueueId':_0x410d60[_0xa7d2('0xd8')]||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xff')));}break;case 0x14:if(_0x410d60[_0xa7d2('0xf6')]>=_0x46c6b8['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0xa7d2('0xc2')]({'active':![],'countagentrejectretry':_0x410d60[_0xa7d2('0xf6')]+=0x1,'scheduledat':moment()[_0xa7d2('0xfb')](_0x46c6b8['dialAgentRejectRetryFrequency'],'minutes')[_0xa7d2('0x77')](_0xa7d2('0xfe')),'ContactId':_0x410d60['ContactId'],'ListId':_0x410d60[_0xa7d2('0xd6')],'VoiceQueueId':_0x410d60['VoiceQueueId']||undefined,'CampaignId':_0x410d60[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x19a')));}break;default:return!![];}};Dialer[_0xa7d2('0xab')]['callProgressDetecting']=function(_0x4ec923,_0x3ffda0,_0x41c0a6){var _0x7fadb0=this;var _0x26dfb5=new History(_0x4ec923);return new BPromise(function(_0x2e0364,_0x5c7c9){if(_[_0xa7d2('0x3d')](_0x3ffda0)&&_0xa7d2('0x166')!==typeof _0x3ffda0){return _0x5c7c9(msgResponse(_0xa7d2('0x19b'),'Failure','entity\x20is\x20undefine'));}if(_[_0xa7d2('0x3d')](_0x41c0a6)&&_0xa7d2('0x166')!==typeof _0x41c0a6){return _0x5c7c9(msgResponse('[callProgressDetecting]','Failure',_0xa7d2('0x19c')));}switch(_0x41c0a6[_0xa7d2('0x10b')]){case'0':_0x3ffda0[_0xa7d2('0x63')]+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0x0;_0x26dfb5['statedesc']=_0xa7d2('0x19d');_0x26dfb5[_0xa7d2('0xf3')]+=0x1;_0x26dfb5[_0xa7d2('0xed')]+=0x1;ami[_0xa7d2('0x4d')](_0xa7d2('0x19e'),ut[_0xa7d2('0x19f')](_0x4ec923,_0xa7d2('0x1a0')));_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xef')));if(_0x7fadb0[_0xa7d2('0x1a1')](0x0,_0x4ec923,_0x3ffda0)){if(_0x26dfb5[_0xa7d2('0xf3')]>=_0x3ffda0[_0xa7d2('0x197')]){_0x7fadb0['createStateFinal'](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a2'));}else{_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a2'));}}break;case'3':_0x3ffda0['outboundNoAnswerCallsDay']+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0x3;_0x26dfb5[_0xa7d2('0xa8')]=_0xa7d2('0x1a3');_0x26dfb5[_0xa7d2('0xf2')]+=0x1;_0x26dfb5['countglobal']+=0x1;ami['emit']('custom:agentnoanswer',ut[_0xa7d2('0x19f')](_0x4ec923,'noanswer'));_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x7fadb0[_0xa7d2('0x1a1')](0x3,_0x4ec923,_0x3ffda0)){if(_0x26dfb5[_0xa7d2('0xf2')]>=_0x3ffda0[_0xa7d2('0x192')]){_0x7fadb0[_0xa7d2('0x104')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a4'));}else{_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a4'));}}break;case'5':_0x3ffda0['outboundBusyCallsDay']+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0x5;_0x26dfb5[_0xa7d2('0xa8')]='Busy';_0x26dfb5[_0xa7d2('0xf0')]+=0x1;_0x26dfb5[_0xa7d2('0xed')]+=0x1;ami[_0xa7d2('0x4d')](_0xa7d2('0x1a5'),ut['buildObj'](_0x4ec923,'busy'));_0x7fadb0['createHistory'](_0x26dfb5)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x1a6')));if(_0x7fadb0[_0xa7d2('0x1a1')](0x5,_0x4ec923,_0x3ffda0)){if(_0x26dfb5[_0xa7d2('0xf0')]>=_0x3ffda0['dialBusyMaxRetry']){_0x7fadb0[_0xa7d2('0x104')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a7'));}else{_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1a7'));}}break;case'8':_0x3ffda0[_0xa7d2('0x5f')]+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0x8;_0x26dfb5['statedesc']=_0xa7d2('0x1a8');_0x26dfb5['countcongestionretry']+=0x1;_0x26dfb5[_0xa7d2('0xed')]+=0x1;ami[_0xa7d2('0x4d')](_0xa7d2('0x1a9'),ut['buildObj'](_0x4ec923,_0xa7d2('0x1aa')));_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)[_0xa7d2('0xb3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x7fadb0['checkRetriveMax'](0x8,_0x4ec923,_0x3ffda0)){if(_0x26dfb5[_0xa7d2('0xf1')]>=_0x3ffda0['dialCongestionMaxRetry']){_0x7fadb0[_0xa7d2('0x104')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1ab'));}else{_0x7fadb0['stateGlobal'](_0x26dfb5,_0x2e0364,_0x5c7c9,'reason\x208\x20congestion');}}break;case'11':_0x3ffda0[_0xa7d2('0x1ac')]+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0xb;_0x26dfb5[_0xa7d2('0xa8')]='Abandoned';_0x26dfb5[_0xa7d2('0xf4')]+=0x1;_0x26dfb5['countglobal']+=0x1;_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x125')));if(_0x7fadb0[_0xa7d2('0x1a1')](0xb,_0x4ec923,_0x3ffda0)){if(_0x26dfb5[_0xa7d2('0xf4')]>=_0x3ffda0[_0xa7d2('0x1ad')]){_0x7fadb0[_0xa7d2('0x104')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1ae'));}else{_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1ae'));}}break;case'20':_0x3ffda0['outboundRejectCallsDay']+=0x1;_0x26dfb5['state']=0x14;_0x26dfb5['statedesc']=_0xa7d2('0x1af');_0x26dfb5[_0xa7d2('0xf6')]+=0x1;_0x26dfb5[_0xa7d2('0xed')]+=0x1;ami[_0xa7d2('0x4d')](_0xa7d2('0x1b0'),ut['buildObj'](_0x4ec923,_0xa7d2('0x1b1')));_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)[_0xa7d2('0xb3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x7fadb0['checkRetriveMax'](0x14,_0x4ec923,_0x3ffda0)){if(_0x26dfb5['countagentrejectretry']>=_0x3ffda0[_0xa7d2('0x1b2')]){_0x7fadb0['createStateFinal'](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1b3'));}else{_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0xa7d2('0x1b3'));}}break;default:_0x3ffda0[_0xa7d2('0x67')]+=0x1;_0x26dfb5[_0xa7d2('0xe7')]=0xc;_0x26dfb5[_0xa7d2('0xa8')]=_0x41c0a6[_0xa7d2('0x10b')];_0x7fadb0[_0xa7d2('0xcc')](_0x26dfb5)['catch'](loggerCatch(_0xa7d2('0x1b4')));if(_0x7fadb0[_0xa7d2('0x1a1')](_0x41c0a6['reason'],_0x4ec923,_0x3ffda0)){if(_0x26dfb5['countbusyretry']+_0x26dfb5[_0xa7d2('0xf1')]+_0x26dfb5[_0xa7d2('0xf2')]+_0x26dfb5[_0xa7d2('0xf3')]+_0x26dfb5[_0xa7d2('0x11b')]+_0x26dfb5[_0xa7d2('0xf4')]+_0x26dfb5[_0xa7d2('0xf5')]+_0x26dfb5[_0xa7d2('0xf6')]>=_0x3ffda0[_0xa7d2('0xf7')]){_0x7fadb0[_0xa7d2('0x103')](_0x26dfb5,_0x2e0364,_0x5c7c9,_0x41c0a6['reason']);}else{_0x7fadb0['createStateFinal'](_0x26dfb5,_0x2e0364,_0x5c7c9,_0x41c0a6[_0xa7d2('0x10b')]);}}}});};Dialer[_0xa7d2('0xab')]['stateGlobal']=function(_0x1cdcb0,_0x31118c,_0x400527,_0x1d018a){var _0x19ead1=new Final(_0x1cdcb0);_0x19ead1['state']=0xf;_0x19ead1[_0xa7d2('0xa8')]=_0xa7d2('0x1b5');this[_0xa7d2('0x104')](_0x19ead1,_0x31118c,_0x400527,_0x1d018a);};Dialer[_0xa7d2('0xab')][_0xa7d2('0x104')]=function(_0x14c166,_0xc04663,_0x219be9,_0xf3f19e){this[_0xa7d2('0xca')](_0x14c166)[_0xa7d2('0xbb')](function(_0x23c6b0){return _0xc04663(msgResponse(_0xa7d2('0x19b'),'Success',_0xf3f19e));})['catch'](function(_0x51f9a8){return _0x219be9(msgResponse(_0xa7d2('0x1b6'),_0xa7d2('0x13e'),_0xa7d2('0x1b7')));});};Dialer[_0xa7d2('0xab')][_0xa7d2('0x8')]=function(_0x2127c8){var _0x1315fc=this;var _0x9780ad=_0x2127c8[_0xa7d2('0x1b8')]/0x64;var _0x4b71b8=_0x2127c8[_0xa7d2('0x117')]/(_0x2127c8[_0xa7d2('0x117')]+_0x2127c8[_0xa7d2('0x5c')]);var _0x18a258=Math[_0xa7d2('0x1b9')](_0x2127c8[_0xa7d2('0x6f')]*(_0x2127c8[_0xa7d2('0x1ba')]/0x64));var _0x3e35d1=Math[_0xa7d2('0x1b9')](_0x2127c8[_0xa7d2('0x6f')]*(_0x2127c8[_0xa7d2('0x1bb')]/0x64));var _0x4891ba=_0x2127c8[_0xa7d2('0x1bc')]+_0x2127c8['talking'];var _0x21bb22=Math[_0xa7d2('0x1bd')](_0x2127c8[_0xa7d2('0x71')]*_0x2127c8[_0xa7d2('0x72')]*_0x2127c8[_0xa7d2('0x6c')]*_0x2127c8[_0xa7d2('0x6d')]);if(_[_0xa7d2('0x3d')](_0x2127c8[_0xa7d2('0x28')])){if(!_[_0xa7d2('0x3d')](_0x2127c8[_0xa7d2('0x27')])){_0x2127c8[_0xa7d2('0x27')]=undefined;loggerPredictive[_0xa7d2('0x94')](_0xa7d2('0x1be'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa7d2('0x3d')](_0x2127c8[_0xa7d2('0x8f')])){loggerPredictive[_0xa7d2('0x94')](_0xa7d2('0x1be'),_0xa7d2('0x1bf'));clearInterval(_0x2127c8['handlePredictive']);_0x2127c8[_0xa7d2('0x8f')]=undefined;}_0x2127c8['startProgressive']=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));loggerPredictive[_0xa7d2('0x7b')](_0x2127c8[_0xa7d2('0x41')],_0xa7d2('0x1c0'),_0x2127c8[_0xa7d2('0x28')]);this['handlePower'](_0x2127c8,0x1);}else if(ifInterval(_0x2127c8[_0xa7d2('0x1c1')],_0x2127c8['startProgressive'])){this['handlePower'](_0x2127c8,0x1);loggerPredictiveCalls['info'](_0xa7d2('0x1c2'),_0x2127c8['startProgressive'],_0x2127c8['name']);_0x2127c8['erlangCalls']=0x0;_0x2127c8[_0xa7d2('0x6b')]=0x0;}else if(_0x9780ad<_0x4b71b8&&_0x2127c8[_0xa7d2('0x1c3')]==='dropRate'){freeVariablesPredictive(_0x2127c8);loggerPredictive[_0xa7d2('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xa7d2('0x1c4'),_0x4b71b8,_0xa7d2('0x28'),_0x2127c8[_0xa7d2('0x41')]);}else if(_0x21bb22<_0x2127c8[_0xa7d2('0x6b')]&&_0x2127c8[_0xa7d2('0x1c3')]===_0xa7d2('0x1c5')){freeVariablesPredictive(_0x2127c8);loggerPredictive['info'](_0xa7d2('0x1c6'),_0xa7d2('0x1c7'),_0x21bb22,'Drop\x20in\x20this\x20interval',_0x2127c8[_0xa7d2('0x6b')],'startProgressive',_0x2127c8[_0xa7d2('0x41')]);}else if(!ifInterval(_0x2127c8['dialPredictiveInterval'],_0x2127c8[_0xa7d2('0x28')])&&_['isUndefined'](_0x2127c8[_0xa7d2('0x27')])&&!_[_0xa7d2('0x3d')](_0x2127c8[_0xa7d2('0x28')])){_0x2127c8[_0xa7d2('0x27')]=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));loggerPredictive[_0xa7d2('0x7b')](_0x2127c8['name'],_0xa7d2('0x1c8'),_0x2127c8[_0xa7d2('0x27')]);this[_0xa7d2('0x1c9')](_0x2127c8[_0xa7d2('0x1c1')])['then'](this[_0xa7d2('0x1ca')](_0x2127c8))[_0xa7d2('0xbb')](mergeDataErlangB(_0x2127c8))[_0xa7d2('0xbb')](this[_0xa7d2('0x1cb')](_0x2127c8))['catch'](loggerCatchPredictive(_0xa7d2('0x1cc'),_0x2127c8));}else if(!ifInterval(_0x2127c8[_0xa7d2('0x1c1')],_0x2127c8[_0xa7d2('0x27')])){_0x2127c8['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2127c8['startPredictive']=moment()[_0xa7d2('0x77')](_0xa7d2('0xfe'));loggerPredictive[_0xa7d2('0x7b')](_0x2127c8[_0xa7d2('0x41')],_0xa7d2('0x1cd'),_0x2127c8[_0xa7d2('0x27')]);clearInterval(_0x2127c8[_0xa7d2('0x8f')]);_0x2127c8[_0xa7d2('0x8f')]=undefined;this[_0xa7d2('0x1c9')](_0x2127c8['dialPredictiveInterval'])[_0xa7d2('0xbb')](this[_0xa7d2('0x1ca')](_0x2127c8))[_0xa7d2('0xbb')](mergeDataErlangB(_0x2127c8))[_0xa7d2('0xbb')](this['startMethodPredictive'](_0x2127c8))[_0xa7d2('0xb3')](loggerCatchPredictive(_0xa7d2('0x1ce'),_0x2127c8));}else if(_0x2127c8[_0xa7d2('0x6f')]&&_0x4891ba<_0x2127c8[_0xa7d2('0x6f')]-_0x3e35d1){freeVariablesPredictive(_0x2127c8);loggerPredictive['info'](_0x2127c8[_0xa7d2('0x41')],_0xa7d2('0x1cf'),_0x4891ba,_0xa7d2('0x1d0'),_0x2127c8[_0xa7d2('0x6f')],'-',_0x3e35d1,'=',_0x2127c8[_0xa7d2('0x6f')]-_0x3e35d1,')');}else if(_0x2127c8[_0xa7d2('0x6f')]&&_0x4891ba>_0x2127c8['predictiveIntervalAvailable']+_0x18a258){freeVariablesPredictive(_0x2127c8);loggerPredictive[_0xa7d2('0x7b')](_0x2127c8[_0xa7d2('0x41')],_0xa7d2('0x1cf'),_0x4891ba,')\x20are\x20more\x20than\x20threshold\x20(',_0x2127c8[_0xa7d2('0x6f')],'+',_0x18a258,'=',_0x2127c8[_0xa7d2('0x6f')]+_0x18a258,')');}};Dialer['prototype']['getDataPredictive']=function(_0x41709d){var _0x4e288e=this;return function(_0x51ee33){return new BPromise(function(_0x1c8de8,_0x7df7d0){_[_0xa7d2('0x8e')](_0x41709d,_0x51ee33[0x0]);if(checkGetDataPredictive(_0x51ee33[0x0])){var _0x244be1=_0x41709d[_0xa7d2('0x6f')]=_0x41709d[_0xa7d2('0x53')]+_0x41709d[_0xa7d2('0x1bc')];var _0x4126d3=_0x41709d[_0xa7d2('0x1c1')]*0x3c;var _0xb65c20=_0x51ee33[0x0][_0xa7d2('0x69')]+_0x51ee33[0x0][_0xa7d2('0x68')];var _0x5b421f=(_0x51ee33[0x0]['predictiveIntervalAnsweredCalls']+_0x51ee33[0x0][_0xa7d2('0x7f')]+_0x51ee33[0x0][_0xa7d2('0x81')])/_0x51ee33[0x0][_0xa7d2('0x70')];_0x41709d[_0xa7d2('0x6c')]=_0x5b421f>0x0?_0x5b421f:0x1;switch(_0x41709d[_0xa7d2('0x1c3')]){case _0xa7d2('0x1c5'):var _0x2b6e44=_0x41709d[_0xa7d2('0x1b8')]/0x64;return _0x4e288e['abandonmentRate'](_0x244be1,_0x4126d3,_0xb65c20,_0x5b421f,_0x2b6e44)[_0xa7d2('0xbb')](function(_0x504f22){return _0x1c8de8(_0x504f22);});case _0xa7d2('0x1d1'):var _0x4d3277=_0x41709d[_0xa7d2('0x1b8')]/0x64;return _0x4e288e[_0xa7d2('0x1d2')](_0x244be1,_0x4126d3,_0xb65c20,_0x5b421f,_0x4d3277)['then'](function(_0x39915b){return _0x1c8de8(_0x39915b);});default:return _0x7df7d0(msgResponse(_0xa7d2('0x1d3'),_0xa7d2('0x13e'),_0xa7d2('0x1d4')));}}else{return _0x7df7d0(msgResponse(_0xa7d2('0x1d3'),'Failure',_0xa7d2('0x1d5')));}});};};Dialer['prototype'][_0xa7d2('0x1d6')]=function(_0x3aa236){var _0x33132c=this;return function(_0x2a8d7a){return new BPromise(function(_0x383ca3,_0x34ea3b){_[_0xa7d2('0x8e')](_0x3aa236,_0x2a8d7a[0x0]);if(checkGetDataPredictive(_0x2a8d7a[0x0])){loggerPredictive[_0xa7d2('0x7b')](JSON[_0xa7d2('0x12d')](_0x2a8d7a[0x0]));if(_0x3aa236[_0xa7d2('0x1c3')]===_0xa7d2('0x1c5')){return _0x33132c[_0xa7d2('0xc8')](_0x3aa236['id'])[_0xa7d2('0xbb')](function(_0x1e36b7){var _0x3a5068=_0x3aa236[_0xa7d2('0x51')]-_0x1e36b7[0x0][_0xa7d2('0x1d7')];var _0xff972b=_0x3aa236[_0xa7d2('0x1c1')]*0x3c;var _0x4a8644=_0x2a8d7a[0x0][_0xa7d2('0x69')]+_0x2a8d7a[0x0][_0xa7d2('0x68')];var _0x117701=(_0x2a8d7a[0x0][_0xa7d2('0x7e')]+_0x2a8d7a[0x0][_0xa7d2('0x7f')]+_0x2a8d7a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a8d7a[0x0][_0xa7d2('0x70')];var _0x1bcfd1=_0x3aa236['dialPredictiveOptimizationPercentage']/0x64;_0x3aa236['predictiveIntervalPauses']=_0x1e36b7[0x0]['outboundQueuePauses']||0x0;_0x3aa236['predictiveIntervalHitRate']=_0x117701>0x0?_0x117701:0x1;return _0x33132c[_0xa7d2('0x1d8')](_0x3a5068,_0xff972b,_0x4a8644,_0x117701,_0x1bcfd1);})[_0xa7d2('0xbb')](function(_0xe919bf){return _0x383ca3(_0xe919bf);})['catch'](function(_0x381c1d){return _0x34ea3b(msgResponse(_0xa7d2('0x1d9'),_0xa7d2('0x13e'),JSON[_0xa7d2('0x12d')](_0x381c1d)));});}if(_0x3aa236[_0xa7d2('0x1c3')]===_0xa7d2('0x1d1')){return _0x33132c[_0xa7d2('0xc8')](_0x3aa236['id'])[_0xa7d2('0xbb')](function(_0x25fb14){var _0x2a1d8f=_0x3aa236[_0xa7d2('0x51')]-_0x25fb14[0x0][_0xa7d2('0x1d7')];var _0x2cd40a=_0x3aa236[_0xa7d2('0x1c1')]*0x3c;var _0x2eeea4=_0x2a8d7a[0x0][_0xa7d2('0x69')]+_0x2a8d7a[0x0][_0xa7d2('0x68')];var _0x2ba6d1=(_0x2a8d7a[0x0][_0xa7d2('0x7e')]+_0x2a8d7a[0x0][_0xa7d2('0x7f')]+_0x2a8d7a[0x0][_0xa7d2('0x81')])/_0x2a8d7a[0x0][_0xa7d2('0x70')];var _0x44fce3=_0x3aa236['dialPredictiveOptimizationPercentage']/0x64;_0x3aa236['predictiveIntervalPauses']=_0x25fb14[0x0][_0xa7d2('0x1d7')]||0x0;_0x3aa236['predictiveIntervalHitRate']=_0x2ba6d1>0x0?_0x2ba6d1:0x1;return _0x33132c[_0xa7d2('0x1d2')](_0x2a1d8f,_0x2cd40a,_0x2eeea4,_0x2ba6d1,_0x44fce3);})[_0xa7d2('0xbb')](function(_0x881bf9){return _0x383ca3(_0x881bf9);})[_0xa7d2('0xb3')](function(_0x2aa19f){return _0x34ea3b(msgResponse(_0xa7d2('0x1d9'),_0xa7d2('0x13e'),JSON['stringify'](_0x2aa19f)));});}}else{return _0x34ea3b(msgResponse(_0xa7d2('0x1d3'),_0xa7d2('0x13e'),_0xa7d2('0x1d5')));}});};};Dialer[_0xa7d2('0xab')][_0xa7d2('0x1cb')]=function(_0x32279c){var _0x6bf0a4=this;return function(){var _0x29c92=0x0;var _0x25ee67=Math[_0xa7d2('0x1bd')](_0x32279c[_0xa7d2('0x8b')]*0x3e8);if(_0x25ee67>0x0){_0x25ee67=_0x25ee67<0x64?0x64:_0x25ee67;loggerPredictive[_0xa7d2('0x7b')](_0x32279c[_0xa7d2('0x41')],_0xa7d2('0x1da'),_0x25ee67,_0xa7d2('0x4a'));_0x32279c[_0xa7d2('0x8f')]=setInterval(function(){_0x6bf0a4[_0xa7d2('0x8f')](_0x32279c);loggerPredictiveCalls[_0xa7d2('0x7b')](_0xa7d2('0x1db'),_0x29c92+=0x1);},_0x25ee67);}else{loggerPredictive[_0xa7d2('0x7b')](_0x32279c[_0xa7d2('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0xae71bc,_0xcc9275){var _0x5b2bee=this;return function(_0x33cafc){if(_['isEmpty'](_0x33cafc)){if(_[_0xa7d2('0xaf')](_0xcc9275[_0xa7d2('0xd7')])||!_0xcc9275[_0xa7d2('0x1dc')]){if(_0xae71bc['dialMethod']===_0xa7d2('0x156')){_0xae71bc['queueStatusComplete']=_[_0xa7d2('0x3d')](_0xae71bc[_0xa7d2('0x12c')])?!![]:_0xae71bc[_0xa7d2('0x12c')];var _0x13d5f8=uuid['v4']();_0x5b2bee[_0xa7d2('0x24')][_0x13d5f8]=new Action(_0xae71bc,_0xcc9275,_0x13d5f8);loggerBooked[_0xa7d2('0x7b')](_0xa7d2('0x1dd'),_0x13d5f8,_0xa7d2('0x1de'),JSON[_0xa7d2('0x12d')](_0xae71bc[_0xa7d2('0x12c')]),_0xa7d2('0x1df'),_0xae71bc['name']);if(_0xae71bc[_0xa7d2('0x12c')]){_0xae71bc[_0xa7d2('0x12c')]=![];_0x5b2bee[_0xa7d2('0x2a')][_0x5b2bee[_0xa7d2('0x24')][_0x13d5f8][_0xa7d2('0xb7')]]=[];ami[_0xa7d2('0xb0')]({'actionid':_0x13d5f8,'action':_0xa7d2('0x1e0'),'queue':_0xae71bc['name']})[_0xa7d2('0xb3')](function(_0x42ddd1){_0x5b2bee['updateOriginated'](_0xae71bc);_0x5b2bee[_0xa7d2('0xc2')]({'active':![],'ContactId':_0x5b2bee[_0xa7d2('0x24')][_0x13d5f8][_0xa7d2('0xd5')],'ListId':_0x5b2bee['actions'][_0x13d5f8][_0xa7d2('0xd6')],'VoiceQueueId':_0x5b2bee['actions'][_0x13d5f8][_0xa7d2('0xd8')]||undefined,'CampaignId':_0x5b2bee['actions'][_0x13d5f8][_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5b2bee[_0xa7d2('0x24')][_0x13d5f8];});}else{loggerBooked[_0xa7d2('0x7b')](_0xa7d2('0x1e1'),JSON[_0xa7d2('0x12d')](_0xae71bc[_0xa7d2('0x12c')]),_0xa7d2('0x1df'),_0xae71bc[_0xa7d2('0x41')]);_0x5b2bee['updateOriginated'](_0xae71bc);_0x5b2bee[_0xa7d2('0xc2')]({'active':![],'ContactId':_0x5b2bee[_0xa7d2('0x24')][_0x13d5f8]['ContactId'],'ListId':_0x5b2bee[_0xa7d2('0x24')][_0x13d5f8][_0xa7d2('0xd6')],'VoiceQueueId':_0x5b2bee['actions'][_0x13d5f8][_0xa7d2('0xd8')]||undefined,'CampaignId':_0x5b2bee['actions'][_0x13d5f8]['CampaignId']||undefined})[_0xa7d2('0xb3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5b2bee[_0xa7d2('0x24')][_0x13d5f8];}}else{return _0x5b2bee[_0xa7d2('0x165')](_0xae71bc,_0xcc9275);}}else{if(getDiff(_0xcc9275[_0xa7d2('0x1e2')])<_0xae71bc[_0xa7d2('0x1e3')]*0x3c){if(_0xcc9275[_0xa7d2('0x1e4')]&&!_0xcc9275[_0xa7d2('0x1e4')][_0xa7d2('0x1e5')]){_0x5b2bee['preview'][_0xa7d2('0x1e6')](_0xcc9275['id'])[_0xa7d2('0x1b')](function(){_0x5b2bee['updateOriginated'](_0xae71bc);});}else{_0x5b2bee[_0xa7d2('0x1e7')]({'active':![]},_0xcc9275['id'],0x1)[_0xa7d2('0x1b')](function(){console[_0xa7d2('0x1e8')](_0xa7d2('0x1e9'));_0x5b2bee[_0xa7d2('0xb5')](_0xae71bc);});}}else{_0xae71bc[_0xa7d2('0x65')]+=0x1;_0x5b2bee[_0xa7d2('0xb5')](_0xae71bc);if(_0xae71bc[_0xa7d2('0x1ea')]){_0x5b2bee[_0xa7d2('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xcc9275['ContactId'],'ListId':_0xcc9275[_0xa7d2('0xd6')],'VoiceQueueId':_0xcc9275[_0xa7d2('0xd8')]||undefined,'CampaignId':_0xcc9275[_0xa7d2('0xd9')]||undefined})[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0x1eb')));_0x5b2bee[_0xa7d2('0xcc')](createObjHistory(_0xae71bc,_0xcc9275,_0xa7d2('0x1ec'),0x17,_0xa7d2('0x1ed')))[_0xa7d2('0xb3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5b2bee[_0xa7d2('0xd3')](createObjHistory(_0xae71bc,_0xcc9275,_0xa7d2('0x1ee'),0x16,'RecallFailedTimeout'),_0xa7d2('0x1ef'),_0xa7d2('0x1f0'));}}}}else{_0xae71bc['outboundBlacklistCallsDay']+=0x1;_0x5b2bee[_0xa7d2('0xd3')](createObjHistory(_0xae71bc,_0xcc9275,'BLACKLIST',0xd,_0xa7d2('0x1f1')),'[Originate][historyBlacklist]',_0xa7d2('0x1f2'));throw'inBlackList';}};};Dialer[_0xa7d2('0xab')][_0xa7d2('0x158')]=function(_0x453ed3){var _0x560c5c=this;var _0x2389b2=[];var _0x403d71=_0x453ed3['limitCalls']-_0x453ed3['originated']-_0x453ed3[_0xa7d2('0x1f3')];emitCampaignSummary(_0x453ed3);if(_0x403d71>0x0){if(_0x403d71>this[_0xa7d2('0x22')]){_0x403d71=this[_0xa7d2('0x22')];}_0x453ed3[_0xa7d2('0x1f3')]+=_0x403d71;this['getContactDialerIvr'](_0x453ed3['id'],_0x403d71,_0x453ed3[_0xa7d2('0x1f4')])[_0xa7d2('0xbb')](function(_0x2e53c3){_0x453ed3['temp']-=_0x403d71;_0x453ed3[_0xa7d2('0x1f3')]=_0x453ed3['temp']>0x0?_0x453ed3['temp']:0x0;if(!checkContactEmpty(_0x2e53c3)){_0x453ed3[_0xa7d2('0x3e')]=_0xa7d2('0x9e');logger[_0xa7d2('0x7b')](_0xa7d2('0x1f5')+_0x453ed3[_0xa7d2('0x41')]);}else{_0x453ed3['originated']+=_0x2e53c3[_0xa7d2('0x97')];_0x453ed3['message']='RUNNING';for(var _0x1fcfad=0x0;_0x1fcfad<_0x2e53c3[_0xa7d2('0x97')];_0x1fcfad+=0x1){_0x453ed3[_0xa7d2('0x1f6')]+=0x1;if(_[_0xa7d2('0xaf')](_0x2e53c3[_0x1fcfad])||_[_0xa7d2('0xaf')](_0x2e53c3[_0x1fcfad][_0xa7d2('0x169')])||_['isNil'](_0x2e53c3[_0x1fcfad]['Contact'][_0xa7d2('0x168')])){_0x560c5c[_0xa7d2('0xd1')](_0xa7d2('0x1f7'),_0x453ed3,_0x2e53c3[_0x1fcfad]);}else{_0x560c5c[_0xa7d2('0xbf')](_[_0xa7d2('0xd4')](_0x2e53c3[_0x1fcfad],['CampaignId',_0xa7d2('0x1f8')]))['then'](_0x560c5c[_0xa7d2('0x1f9')](_0x453ed3,_0x2e53c3[_0x1fcfad]))[_0xa7d2('0xb3')](_0x560c5c[_0xa7d2('0xd0')](_0xa7d2('0x1fa'),_0x453ed3));}}}})[_0xa7d2('0xb3')](loggerGetContactDialer(_0xa7d2('0x1fb'),_0x453ed3,_0x403d71));}};Dialer[_0xa7d2('0xab')][_0xa7d2('0x154')]=function(_0xc6b43a,_0x41dedc){var _0x36ce76=this;var _0x22fd4e=[];var _0x13dc58=_0x41dedc>=0x1?_0x41dedc:0x1;var _0x5e9bd4=[];if(_0xc6b43a[_0xa7d2('0x151')]===_0xa7d2('0x156')){_0x13dc58=0x1;}var _0x2435e1=Math[_0xa7d2('0x1bd')](_0xc6b43a['available']*_0x13dc58)-_0xc6b43a[_0xa7d2('0x99')]-_0xc6b43a[_0xa7d2('0x1f3')];emitVoiceQueueSummary(_0xc6b43a);if(_0xc6b43a['dialLimitQueue']>0x0){var _0x283eee=_0xc6b43a[_0xa7d2('0x1fc')]-_0xc6b43a[_0xa7d2('0x99')]-_0xc6b43a[_0xa7d2('0x53')]-_0xc6b43a[_0xa7d2('0x1f3')]-_0xc6b43a[_0xa7d2('0x52')];if(_0x2435e1>_0x283eee){_0x2435e1=_0x283eee;}}if(_0x2435e1>0x0){if(_0xc6b43a['dialMethod']==='booked'){_0x2435e1=0x1;}if(_0x2435e1>this['maxNumberOriginate']){_0x2435e1=this[_0xa7d2('0x22')];}_0xc6b43a[_0xa7d2('0x1f3')]+=_0x2435e1;for(var _0x477b6c in this[_0xa7d2('0x20')]){if(this[_0xa7d2('0x20')][_0xa7d2('0x98')](_0x477b6c)){if(this['agents'][_0x477b6c]['state']===_0xa7d2('0x1fd')&&this[_0xa7d2('0x20')][_0x477b6c][_0xa7d2('0xb1')]===_0xa7d2('0x1fe')){_0x22fd4e['push'](this[_0xa7d2('0x20')][_0x477b6c]['id']);}}}this[_0xa7d2('0xc5')](_0xc6b43a['id'],_0x22fd4e,_0x2435e1,_0xc6b43a['dialOrderByScheduledAt'])[_0xa7d2('0xbb')](function(_0x2287b3){_0xc6b43a[_0xa7d2('0x1f3')]-=_0x2435e1;_0xc6b43a[_0xa7d2('0x1f3')]=_0xc6b43a[_0xa7d2('0x1f3')]>0x0?_0xc6b43a[_0xa7d2('0x1f3')]:0x0;if(!checkContactEmpty(_0x2287b3)){_0x36ce76['countReScheduled'](_0xc6b43a)[_0xa7d2('0xbb')](sendMessageReschedule(_0xc6b43a))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xbc')));}else{_0xc6b43a[_0xa7d2('0x99')]+=_0x2287b3[_0xa7d2('0x97')];_0xc6b43a[_0xa7d2('0x3e')]=_0xc6b43a['dialMethod']===_0xa7d2('0x156')?'ACTIVE':_0xa7d2('0x1ff');for(var _0x4db3c1=0x0;_0x4db3c1<_0x2287b3['length'];_0x4db3c1+=0x1){if(_['isNil'](_0x2287b3[_0x4db3c1])||_[_0xa7d2('0xaf')](_0x2287b3[_0x4db3c1][_0xa7d2('0x169')])||_[_0xa7d2('0xaf')](_0x2287b3[_0x4db3c1]['Contact']['phone'])){_0x36ce76[_0xa7d2('0xd1')](_0xa7d2('0x1f7'),_0xc6b43a,_0x2287b3[_0x4db3c1]);}else{_0x36ce76[_0xa7d2('0xbd')](_[_0xa7d2('0xd4')](_0x2287b3[_0x4db3c1],['VoiceQueueId',_0xa7d2('0x1f8')]))[_0xa7d2('0xbb')](_0x36ce76[_0xa7d2('0x1f9')](_0xc6b43a,_0x2287b3[_0x4db3c1]))[_0xa7d2('0xb3')](_0x36ce76['loggerHandler']('[actionOriginate]\x20',_0xc6b43a));}}}})[_0xa7d2('0xb3')](loggerGetContactDialer('[getContactDialer2]',_0xc6b43a,_0x2435e1));}};Dialer[_0xa7d2('0xab')]['handlePredictive']=function(_0x47df58){var _0x48c04e=this;if(_0x47df58[_0xa7d2('0x1fc')]>0x0){var _0x25b2e7=_0x47df58[_0xa7d2('0x1fc')]-_0x47df58['originated']-_0x47df58[_0xa7d2('0x53')];if(_0x25b2e7>0x0){this[_0xa7d2('0x200')](_0x47df58);}else{loggerPredictiveCalls['info'](_0xa7d2('0x201'));}}else{this[_0xa7d2('0x200')](_0x47df58);}};Dialer['prototype'][_0xa7d2('0x200')]=function(_0x440259){var _0x3c9501=this;var _0x224fe0=[];_0x440259[_0xa7d2('0x99')]+=0x1;for(var _0x51d3d6 in this[_0xa7d2('0x20')]){if(this['agents'][_0xa7d2('0x98')](_0x51d3d6)){if(this['agents'][_0x51d3d6][_0xa7d2('0xe7')]===_0xa7d2('0x1fd')&&this['agents'][_0x51d3d6][_0xa7d2('0xb1')]===_0xa7d2('0x1fe')){_0x224fe0[_0xa7d2('0x12a')](this[_0xa7d2('0x20')][_0x51d3d6]['id']);}}}this[_0xa7d2('0xc5')](_0x440259['id'],_0x224fe0,0x1,_0x440259[_0xa7d2('0x1f4')])[_0xa7d2('0xbb')](function(_0x2f1d36){if(!checkContactEmpty(_0x2f1d36)){checkContactLowerLimitOriginate(_0x440259,0x1,0x0);_0x3c9501[_0xa7d2('0xb9')](_0x440259)['then'](sendMessageReschedule(_0x440259))[_0xa7d2('0xb3')](loggerCatch(_0xa7d2('0xbc')));}else{_0x440259[_0xa7d2('0x3e')]=_0xa7d2('0x1ff');if(_['isNil'](_0x2f1d36[0x0])||_[_0xa7d2('0xaf')](_0x2f1d36[0x0]['Contact'])||_['isNil'](_0x2f1d36[0x0][_0xa7d2('0x169')][_0xa7d2('0x168')])){_0x3c9501[_0xa7d2('0xd1')]('[actionOriginate]\x20',_0x440259,_0x2f1d36[0x0]);}else{_0x3c9501[_0xa7d2('0xbd')](_[_0xa7d2('0xd4')](_0x2f1d36[0x0],[_0xa7d2('0xd8'),_0xa7d2('0x1f8')]))[_0xa7d2('0xbb')](_0x3c9501['checkContactBlack'](_0x440259,_0x2f1d36[0x0]))[_0xa7d2('0xb3')](_0x3c9501[_0xa7d2('0xd0')]('[actionOriginatePredictive]\x20',_0x440259));}}})[_0xa7d2('0xb3')](loggerGetContactDialer(_0xa7d2('0x202'),_0x440259,0x1));emitVoiceQueueSummary(_0x440259);};Dialer['prototype']['abandonmentRate']=function(_0xbda14e,_0x3a1aa5,_0x50e09e,_0x5d0872,_0x453442,_0xf05926){loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x203'));loggerPredictive[_0xa7d2('0x7b')]('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',_0xbda14e);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x204'),_0x3a1aa5);loggerPredictive[_0xa7d2('0x7b')]('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',_0x50e09e);loggerPredictive['info'](_0xa7d2('0x205'),_0x5d0872);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x206'),_0x453442);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x83'));return new BPromise(function(_0xdd0460,_0x99f6b4){if(_0xbda14e<=0x0||isNaN(_0xbda14e)){return _0x99f6b4(msgResponse(_0xa7d2('0x207'),_0xa7d2('0x49'),_0xa7d2('0x208')+_0xbda14e));}if(_0x50e09e<=0x0||isNaN(_0x50e09e)){return _0x99f6b4(msgResponse('[abandonmentRate]',_0xa7d2('0x49'),_0xa7d2('0x209')+_0x50e09e));}if(_0x5d0872<=0x0||isNaN(_0x5d0872)){return _0x99f6b4(msgResponse(_0xa7d2('0x207'),_0xa7d2('0x49'),_0xa7d2('0x20a')+_0x5d0872));}if(_0x3a1aa5<=0x0||isNaN(_0x3a1aa5)){return _0x99f6b4(msgResponse(_0xa7d2('0x207'),_0xa7d2('0x49'),_0xa7d2('0x20b')+_0x3a1aa5));}if(_0x453442<=0x0||isNaN(_0x453442)){return _0x99f6b4(msgResponse(_0xa7d2('0x207'),'Error',_0xa7d2('0x20c')+_0x453442));}_0xf05926=_0xf05926||0x0;var _0x5643f5=0x1/_0x50e09e;var _0x1d92ff=0x0;var _0x289b2a=0x0;var _0xeb5c48=0x0;var _0xa11ee2=0x0;for(var _0x29cf47=0x0;_0xeb5c48<_0x453442;_0x29cf47+=0x1){_0x289b2a=_0x29cf47/_0x3a1aa5;_0x1d92ff=(_0x5d0872*_0x289b2a+_0xf05926)/_0x5643f5;_0xeb5c48=erlangb(_0x1d92ff,_0xbda14e);_0xa11ee2=_0x1d92ff/_0xbda14e*(0x1-erlangb(_0x1d92ff,_0xbda14e));}return _0xdd0460({'erlangCalls':_0x29cf47,'erlangCallToSecond':_0x3a1aa5/_0x29cf47,'erlangAbandonmentRate':_0xeb5c48,'erlangBusyFactor':_0xa11ee2});});};Dialer[_0xa7d2('0xab')]['busyFactor']=function(_0x1f6822,_0x7c8f00,_0x25b5be,_0x5cdb38,_0x228bb3,_0x4b43ee){loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x20d'));loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x20e'),_0x1f6822);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7c8f00);loggerPredictive['info']('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',_0x25b5be);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x205'),_0x5cdb38);loggerPredictive[_0xa7d2('0x7b')](_0xa7d2('0x20f'),_0x228bb3);loggerPredictive['info'](_0xa7d2('0x83'));return new BPromise(function(_0x2aa4b1,_0x1a1c84){if(_0x1f6822<=0x0||isNaN(_0x1f6822)){return _0x1a1c84(msgResponse(_0xa7d2('0x210'),_0xa7d2('0x49'),_0xa7d2('0x208')+_0x1f6822));}if(_0x25b5be<=0x0||isNaN(_0x25b5be)){return _0x1a1c84(msgResponse(_0xa7d2('0x210'),_0xa7d2('0x49'),'Ts\x20=\x20'+_0x25b5be));}if(_0x5cdb38<=0x0||isNaN(_0x5cdb38)){return _0x1a1c84(msgResponse('[busyFactor]',_0xa7d2('0x49'),'p\x20=\x20'+_0x5cdb38));}if(_0x7c8f00<=0x0||isNaN(_0x7c8f00)){return _0x1a1c84(msgResponse(_0xa7d2('0x210'),_0xa7d2('0x49'),_0xa7d2('0x20b')+_0x7c8f00));}if(_0x228bb3<=0x0||isNaN(_0x228bb3)){return _0x1a1c84(msgResponse(_0xa7d2('0x210'),_0xa7d2('0x49'),_0xa7d2('0x211')+_0x228bb3));}_0x4b43ee=_0x4b43ee||0x0;var _0x2f6184=0x1/_0x25b5be;var _0x51ac64=0x0;var _0x117099=0x0;var _0x55cb1f=0x0;var _0x13d60a=0x0;for(var _0x205f98=0x0;_0x13d60a<_0x228bb3;_0x205f98+=0x1){_0x117099=_0x205f98/_0x7c8f00;_0x51ac64=(_0x5cdb38*_0x117099+_0x4b43ee)/_0x2f6184;_0x55cb1f=erlangb(_0x51ac64,_0x1f6822);_0x13d60a=_0x51ac64/_0x1f6822*(0x1-erlangb(_0x51ac64,_0x1f6822));}return _0x2aa4b1({'erlangCalls':_0x205f98,'erlangCallToSecond':_0x7c8f00/_0x205f98,'erlangAbandonmentRate':_0x55cb1f,'erlangBusyFactor':_0x13d60a});});};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 11cdcc5..c293a73 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 _0xb212=['ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime'];(function(_0x520b97,_0x55828c){var _0x21f435=function(_0x470d9f){while(--_0x470d9f){_0x520b97['push'](_0x520b97['shift']());}};_0x21f435(++_0x55828c);}(_0xb212,0x66));var _0x2b21=function(_0x3a57fa,_0x49ed8a){_0x3a57fa=_0x3a57fa-0x0;var _0x54909c=_0xb212[_0x3a57fa];return _0x54909c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2b21('0x0'));function getSeconds(_0x4e6f0e,_0x117182){var _0x301b7e=moment(_0x4e6f0e)[_0x2b21('0x1')](0x0);var _0x566b83=moment(_0x117182)[_0x2b21('0x1')](0x0);return _0x301b7e[_0x2b21('0x2')](_0x566b83,_0x2b21('0x3'));}function QueueCallerAbandon(_0x4b6118,_0x506067){this[_0x2b21('0x4')]=_0x4b6118['scheduledat'];this[_0x2b21('0x5')]=_0x4b6118['type'];this[_0x2b21('0x6')]=_0x4b6118['type']===_0x2b21('0x7')?_0x2b21('0x8'):_0x4b6118[_0x2b21('0x5')];this[_0x2b21('0x9')]=_0x4b6118[_0x2b21('0x9')];this['countcongestionretry']=_0x4b6118['countcongestionretry'];this[_0x2b21('0xa')]=_0x4b6118[_0x2b21('0xa')];this['countglobal']=_0x4b6118[_0x2b21('0x9')]+_0x4b6118['countcongestionretry']+_0x4b6118[_0x2b21('0xa')]+_0x4b6118[_0x2b21('0xb')]+_0x4b6118[_0x2b21('0xc')]+_0x4b6118[_0x2b21('0xd')]+_0x4b6118[_0x2b21('0xe')]+_0x4b6118['countagentrejectretry'];this[_0x2b21('0xb')]=_0x4b6118[_0x2b21('0xb')];this[_0x2b21('0xc')]=_0x4b6118[_0x2b21('0xc')];this[_0x2b21('0xd')]=_0x4b6118[_0x2b21('0xd')];this[_0x2b21('0xe')]=_0x4b6118[_0x2b21('0xe')];this[_0x2b21('0xf')]=_0x4b6118['countagentrejectretry'];this['uniqueid']=_0x506067[_0x2b21('0x10')];this[_0x2b21('0x11')]=_0x4b6118[_0x2b21('0x12')];this[_0x2b21('0x13')]=_0x4b6118['number'];this[_0x2b21('0x14')]=_0x4b6118['starttime'];this[_0x2b21('0x15')]=_0x4b6118[_0x2b21('0x15')];this[_0x2b21('0x16')]=_0x4b6118[_0x2b21('0x16')];this[_0x2b21('0x17')]=this[_0x2b21('0x16')];this[_0x2b21('0x18')]=getSeconds(_0x4b6118[_0x2b21('0x15')],_0x4b6118[_0x2b21('0x14')]);this[_0x2b21('0x19')]=getSeconds(this[_0x2b21('0x16')],_0x4b6118[_0x2b21('0x15')]);this[_0x2b21('0x1a')]=0x0;this[_0x2b21('0x8')]=_0x506067['queue'];this[_0x2b21('0x1b')]=_0x506067[_0x2b21('0x1c')];this['reason']=_0x506067[_0x2b21('0x1d')];this[_0x2b21('0x1e')]=_0x4b6118[_0x2b21('0x1e')];this[_0x2b21('0x1f')]=_0x4b6118[_0x2b21('0x1f')];this[_0x2b21('0x20')]=_0x4b6118[_0x2b21('0x20')];this[_0x2b21('0x21')]=_0x4b6118['recallme'];this[_0x2b21('0x22')]=_0x4b6118[_0x2b21('0x22')];this[_0x2b21('0x23')]=_0x4b6118['ListId'];this[_0x2b21('0x24')]=_0x4b6118['UserId'];this[_0x2b21('0x25')]=_0x4b6118[_0x2b21('0x25')];this[_0x2b21('0x26')]=_0x4b6118['CampaignId'];this[_0x2b21('0x27')]=_0x4b6118['originatecalleridnum']||'';this[_0x2b21('0x28')]=_0x4b6118[_0x2b21('0x28')]||'';}module[_0x2b21('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x34e1=['starttime','responsetime','droptime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum'];(function(_0x257c00,_0x4c1f3f){var _0x124bc6=function(_0x58cde2){while(--_0x58cde2){_0x257c00['push'](_0x257c00['shift']());}};_0x124bc6(++_0x4c1f3f);}(_0x34e1,0x1e6));var _0x134e=function(_0x310f36,_0x103424){_0x310f36=_0x310f36-0x0;var _0x5dae22=_0x34e1[_0x310f36];return _0x5dae22;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x134e('0x0'));function getSeconds(_0x2cd63b,_0xfff1d2){var _0x4e50e7=moment(_0x2cd63b)[_0x134e('0x1')](0x0);var _0x2c4f98=moment(_0xfff1d2)[_0x134e('0x1')](0x0);return _0x4e50e7['diff'](_0x2c4f98,_0x134e('0x2'));}function QueueCallerAbandon(_0x240d43,_0x556a84){this[_0x134e('0x3')]=_0x240d43['scheduledat'];this['type']=_0x240d43[_0x134e('0x4')];this[_0x134e('0x5')]=_0x240d43[_0x134e('0x4')]===_0x134e('0x6')?_0x134e('0x7'):_0x240d43[_0x134e('0x4')];this['countbusyretry']=_0x240d43[_0x134e('0x8')];this[_0x134e('0x9')]=_0x240d43['countcongestionretry'];this[_0x134e('0xa')]=_0x240d43[_0x134e('0xa')];this[_0x134e('0xb')]=_0x240d43[_0x134e('0x8')]+_0x240d43[_0x134e('0x9')]+_0x240d43['countnoanswerretry']+_0x240d43['countnosuchnumberretry']+_0x240d43[_0x134e('0xc')]+_0x240d43[_0x134e('0xd')]+_0x240d43[_0x134e('0xe')]+_0x240d43[_0x134e('0xf')];this[_0x134e('0x10')]=_0x240d43[_0x134e('0x10')];this[_0x134e('0xc')]=_0x240d43['countdropretry'];this['countabandonedretry']=_0x240d43[_0x134e('0xd')];this[_0x134e('0xe')]=_0x240d43['countmachineretry'];this[_0x134e('0xf')]=_0x240d43['countagentrejectretry'];this[_0x134e('0x11')]=_0x556a84[_0x134e('0x11')];this[_0x134e('0x12')]=_0x240d43[_0x134e('0x13')];this[_0x134e('0x14')]=_0x240d43['number'];this[_0x134e('0x15')]=_0x240d43[_0x134e('0x15')];this[_0x134e('0x16')]=_0x240d43[_0x134e('0x16')];this[_0x134e('0x17')]=_0x240d43[_0x134e('0x17')];this['endtime']=this[_0x134e('0x17')];this[_0x134e('0x18')]=getSeconds(_0x240d43[_0x134e('0x16')],_0x240d43[_0x134e('0x15')]);this['holdtime']=getSeconds(this['droptime'],_0x240d43['responsetime']);this[_0x134e('0x19')]=0x0;this[_0x134e('0x7')]=_0x556a84[_0x134e('0x7')];this['membername']=_0x556a84[_0x134e('0x1a')];this[_0x134e('0x1b')]=_0x556a84[_0x134e('0x1b')];this['callback']=_0x240d43[_0x134e('0x1c')];this[_0x134e('0x1d')]=_0x240d43[_0x134e('0x1d')];this[_0x134e('0x1e')]=_0x240d43[_0x134e('0x1e')];this[_0x134e('0x1f')]=_0x240d43[_0x134e('0x1f')];this['ContactId']=_0x240d43[_0x134e('0x20')];this['ListId']=_0x240d43[_0x134e('0x21')];this[_0x134e('0x22')]=_0x240d43[_0x134e('0x22')];this['VoiceQueueId']=_0x240d43[_0x134e('0x23')];this[_0x134e('0x24')]=_0x240d43[_0x134e('0x24')];this['originatecalleridnum']=_0x240d43[_0x134e('0x25')]||'';this[_0x134e('0x26')]=_0x240d43[_0x134e('0x26')]||'';}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 79cc0ec..63d6eee 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 _0xd77e=['%s/%s/%s','tech','Trunk','name','headerinfo','path','AttachmentId','util','lodash','uniqueid','channel'];(function(_0xae5042,_0xbfb77e){var _0x4ed3fd=function(_0x25afec){while(--_0x25afec){_0xae5042['push'](_0xae5042['shift']());}};_0x4ed3fd(++_0xbfb77e);}(_0xd77e,0x75));var _0xed77=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd77e[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xed77('0x0'));var _=require(_0xed77('0x1'));var moment=require('moment');function Action(_0x496eaa,_0x17cfab,_0x13504e){this[_0xed77('0x2')]=_0x496eaa||undefined;this[_0xed77('0x3')]=util['format'](_0xed77('0x4'),_0x17cfab[_0xed77('0x5')],_0x17cfab[_0xed77('0x6')][_0xed77('0x7')],_0x13504e['fax']);this['localstationid']=_0x17cfab['localstationid'];this[_0xed77('0x8')]=_0x17cfab['headerinfo'];this[_0xed77('0x9')]=_0x13504e['path'];this[_0xed77('0xa')]=_0x13504e[_0xed77('0xa')];}module['exports']=Action; \ No newline at end of file +var _0x72c2=['lodash','moment','channel','format','%s/%s/%s','tech','name','localstationid','headerinfo','path','AttachmentId','exports','util'];(function(_0x22143f,_0x233d99){var _0x3e077d=function(_0x554e7a){while(--_0x554e7a){_0x22143f['push'](_0x22143f['shift']());}};_0x3e077d(++_0x233d99);}(_0x72c2,0x103));var _0x272c=function(_0x5323d8,_0xe99c61){_0x5323d8=_0x5323d8-0x0;var _0x410d99=_0x72c2[_0x5323d8];return _0x410d99;};'use strict';var util=require(_0x272c('0x0'));var _=require(_0x272c('0x1'));var moment=require(_0x272c('0x2'));function Action(_0x58c5fb,_0x5808be,_0x4d4fb9){this['uniqueid']=_0x58c5fb||undefined;this[_0x272c('0x3')]=util[_0x272c('0x4')](_0x272c('0x5'),_0x5808be[_0x272c('0x6')],_0x5808be['Trunk'][_0x272c('0x7')],_0x4d4fb9['fax']);this[_0x272c('0x8')]=_0x5808be['localstationid'];this[_0x272c('0x9')]=_0x5808be[_0x272c('0x9')];this[_0x272c('0xa')]=_0x4d4fb9[_0x272c('0xa')];this[_0x272c('0xb')]=_0x4d4fb9[_0x272c('0xb')];}module[_0x272c('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 45738b5..02823ad 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 _0xb39f=['remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','prototype','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename'];(function(_0x5e0b41,_0x20ee58){var _0x30358=function(_0x1984b0){while(--_0x1984b0){_0x5e0b41['push'](_0x5e0b41['shift']());}};_0x30358(++_0x20ee58);}(_0xb39f,0x1b5));var _0xfb39=function(_0x1e2875,_0xe124a6){_0x1e2875=_0x1e2875-0x0;var _0x5d467b=_0xb39f[_0x1e2875];return _0x5d467b;};'use strict';var util=require(_0xfb39('0x0'));var _=require(_0xfb39('0x1'));var BPromise=require(_0xfb39('0x2'));var uuid=require(_0xfb39('0x3'));var moment=require(_0xfb39('0x4'));var path=require(_0xfb39('0x5'));var tiff2pdf=require(_0xfb39('0x6'));var gs=require(_0xfb39('0x7'));var logger=require(_0xfb39('0x8'))(_0xfb39('0x9'));var ami=require('../ami');var rpcDb=require(_0xfb39('0xa'));var Channel=require(_0xfb39('0xb'));var ut=require('./util/util');var Action=require(_0xfb39('0xc'));var faxAccount=require(_0xfb39('0xd'));var attachment=require(_0xfb39('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x36a1cb){this['channels']={};this['faxAccounts']=_0x36a1cb[_0xfb39('0xf')];this[_0xfb39('0x10')]=_0x36a1cb[_0xfb39('0x10')];this['actions']={};ami['on']('newchannel',this[_0xfb39('0x11')][_0xfb39('0x12')](this));ami['on'](_0xfb39('0x13'),this[_0xfb39('0x14')][_0xfb39('0x12')](this));ami['on'](_0xfb39('0x15'),this[_0xfb39('0x16')][_0xfb39('0x12')](this));ami['on'](_0xfb39('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xfb39('0x18'),this[_0xfb39('0x19')][_0xfb39('0x12')](this));ami['on']('receivefax',this[_0xfb39('0x1a')][_0xfb39('0x12')](this));ami['on'](_0xfb39('0x1b'),this['syncHangup'][_0xfb39('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xfb39('0x12')](this));}Fax[_0xfb39('0x1c')][_0xfb39('0x11')]=function(_0x4704bd){if(_0x4704bd[_0xfb39('0x1d')]==='from-voip-provider'){for(var _0x4bcfe8 in this[_0xfb39('0xf')]){if(this[_0xfb39('0xf')][_0xfb39('0x1e')](_0x4bcfe8)){if(_0x4704bd[_0xfb39('0x1f')]===this[_0xfb39('0xf')][_0x4bcfe8][_0xfb39('0x20')]){this[_0xfb39('0x21')][_0x4704bd[_0xfb39('0x22')]]={};this['channels'][_0x4704bd[_0xfb39('0x22')]][_0xfb39('0x23')]=_0x4704bd[_0xfb39('0x23')];this[_0xfb39('0x21')][_0x4704bd[_0xfb39('0x22')]]['id']=this[_0xfb39('0xf')][_0x4bcfe8]['id'];this[_0xfb39('0x21')][_0x4704bd[_0xfb39('0x22')]][_0xfb39('0x24')]=this[_0xfb39('0xf')][_0x4bcfe8][_0xfb39('0x24')];logger[_0xfb39('0x25')](_0x4704bd[_0xfb39('0x22')],_0xfb39('0x26'));}}}}if(this[_0xfb39('0x27')][_0x4704bd[_0xfb39('0x22')]]){this[_0xfb39('0x21')][_0x4704bd['uniqueid']]={};this[_0xfb39('0x21')][_0x4704bd[_0xfb39('0x22')]][_0xfb39('0x23')]=_0x4704bd[_0xfb39('0x23')];logger['info'](_0x4704bd[_0xfb39('0x22')],_0xfb39('0x26'));}};Fax['prototype'][_0xfb39('0x14')]=function(_0x2726f3){if(this[_0xfb39('0x21')][_0x2726f3[_0xfb39('0x22')]]){for(var _0x2b22ad in _0x2726f3[_0xfb39('0x28')]){if(_0x2726f3[_0xfb39('0x28')][_0xfb39('0x1e')](_0x2b22ad)){this[_0xfb39('0x21')][_0x2726f3[_0xfb39('0x22')]][_0x2b22ad]=_0x2726f3[_0xfb39('0x29')];}}}};Fax[_0xfb39('0x1c')][_0xfb39('0x16')]=function(_0x488406){if(this[_0xfb39('0x21')][_0x488406[_0xfb39('0x22')]]){this[_0xfb39('0x21')][_0x488406['uniqueid']][_0xfb39('0x2a')]=_0x488406[_0xfb39('0x2a')];this['channels'][_0x488406[_0xfb39('0x22')]]['channelstatedesc']=_0x488406[_0xfb39('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x51b7f4){if(this[_0xfb39('0x21')][_0x51b7f4[_0xfb39('0x22')]]){for(var _0x1f012a in _0x51b7f4[_0xfb39('0x28')]){if(_0x51b7f4['variable'][_0xfb39('0x1e')](_0x1f012a)){this[_0xfb39('0x21')][_0x51b7f4[_0xfb39('0x22')]][_0x1f012a]=_0x51b7f4['value'];}}}};Fax['prototype'][_0xfb39('0x19')]=function(_0xbf6875){if(this[_0xfb39('0x21')][_0xbf6875[_0xfb39('0x22')]]){this[_0xfb39('0x21')][_0xbf6875[_0xfb39('0x22')]][_0xfb39('0x2c')]=_0xbf6875['operation'];this['channels'][_0xbf6875[_0xfb39('0x22')]]['status']=_0xbf6875[_0xfb39('0x2d')];this[_0xfb39('0x21')][_0xbf6875[_0xfb39('0x22')]][_0xfb39('0x20')]=_0xbf6875[_0xfb39('0x20')];this[_0xfb39('0x21')][_0xbf6875[_0xfb39('0x22')]][_0xfb39('0x2e')]=_0xbf6875[_0xfb39('0x2e')];logger[_0xfb39('0x25')](_0xbf6875[_0xfb39('0x22')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xfb39('0x1a')]=function(_0x1a9677){var _0x5174bd=this;if(this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]]){var _0x1620c3=this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]]['id'];this['channels'][_0x1a9677[_0xfb39('0x22')]][_0xfb39('0x2f')]=_0x1a9677[_0xfb39('0x2f')];this['channels'][_0x1a9677['uniqueid']][_0xfb39('0x30')]=_0x1a9677['pagestransferred'];this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]][_0xfb39('0x20')]=_0x1a9677['localstationid'];this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]][_0xfb39('0x31')]=_0x1a9677[_0xfb39('0x31')];this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]][_0xfb39('0x32')]=_0x1a9677[_0xfb39('0x32')];this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]]['filename']=_0x1a9677[_0xfb39('0x2e')];this[_0xfb39('0x21')][_0x1a9677['uniqueid']][_0xfb39('0x33')]=_0x1a9677[_0xfb39('0x33')];if(this[_0xfb39('0x21')][_0x1a9677[_0xfb39('0x22')]][_0xfb39('0x30')]>0x0){tiff2pdf(_0x1a9677[_0xfb39('0x2e')],_0xfb39('0x34'),function(_0x1e8762){logger['info'](_0x1a9677[_0xfb39('0x22')],'\x20result\x20conversion\x20file\x20',_0x1e8762['message']);attachment[_0xfb39('0x35')]({'name':path[_0xfb39('0x36')](_0x1a9677[_0xfb39('0x2e')])[_0xfb39('0x24')],'basename':path[_0xfb39('0x36')](_0x1a9677[_0xfb39('0x2e')])[_0xfb39('0x24')]+'.pdf','type':_0xfb39('0x37')})[_0xfb39('0x38')](function(_0x250c69){faxAccount[_0xfb39('0x39')](_0x1620c3,{'from':_0x1a9677[_0xfb39('0x33')],'mapKey':'fax','body':path['parse'](_0x1a9677[_0xfb39('0x2e')])[_0xfb39('0x24')]+_0xfb39('0x3a'),'AttachmentId':_0x250c69['id']})[_0xfb39('0x3b')](function(_0x4a6894){logger[_0xfb39('0x3c')](_0x1a9677[_0xfb39('0x22')],_0xfb39('0x3d'),JSON[_0xfb39('0x3e')](_0x4a6894));});})['catch'](function(_0x17bbe4){logger['error'](_0x1a9677[_0xfb39('0x22')],_0xfb39('0x3f'),JSON[_0xfb39('0x3e')](_0x17bbe4));});});}logger['info'](_0x1a9677[_0xfb39('0x22')],_0xfb39('0x3f'));}};Fax[_0xfb39('0x1c')][_0xfb39('0x40')]=function(_0x3bdf50){if(this[_0xfb39('0x27')][_0x3bdf50[_0xfb39('0x22')]]){_[_0xfb39('0x41')](this[_0xfb39('0x21')][_0x3bdf50[_0xfb39('0x22')]],_[_0xfb39('0x42')](_0x3bdf50,[_0xfb39('0x43'),_0xfb39('0x44')]));}};function updateStatus(_0x3bf9df){if(_0x3bf9df[_0xfb39('0x45')]){faxMessage[_0xfb39('0x46')](_0x3bf9df[_0xfb39('0x45')],{'failMessage':_0xfb39('0x47')})[_0xfb39('0x38')](function(_0x1b70ee){ut['logger'](_0xfb39('0x48'),_0x1b70ee);})[_0xfb39('0x3b')](function(_0x326b30){ut[_0xfb39('0x49')](_0xfb39('0x4a'),_0x326b30);});}else{ut[_0xfb39('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfb39('0x1c')][_0xfb39('0x4b')]=function(_0x7ed38c,_0x144353,_0x488ef7){var _0x3b88e8=this;var _0x155f07={};if(_0x144353){_0x155f07={'read':_0x144353};}else{_0x155f07={'failMessage':_0x488ef7};}if(this[_0xfb39('0x27')][_0x7ed38c][_0xfb39('0x45')]){faxMessage[_0xfb39('0x46')](this[_0xfb39('0x27')][_0x7ed38c][_0xfb39('0x45')],_0x155f07)[_0xfb39('0x38')](function(_0x48fbaa){ut['logger'](_0xfb39('0x4c'),_0x48fbaa);})[_0xfb39('0x3b')](function(_0x4a7ffb){ut[_0xfb39('0x49')](_0xfb39('0x4d'),_0x4a7ffb);})['finally'](function(){delete _0x3b88e8[_0xfb39('0x21')][_0x7ed38c];delete _0x3b88e8['actions'][_0x7ed38c];});}else{ut[_0xfb39('0x49')](_0xfb39('0x4e'));delete this['channels'][_0x7ed38c];delete this[_0xfb39('0x27')][_0x7ed38c];}};Fax[_0xfb39('0x1c')][_0xfb39('0x4f')]=function(_0x2d57e1){var _0x95f82f=this;if(this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]]){if(this['actions'][_0x2d57e1[_0xfb39('0x22')]]){this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]]['id']=this[_0xfb39('0x27')][_0x2d57e1[_0xfb39('0x22')]]['id'];this['channels'][_0x2d57e1['uniqueid']][_0xfb39('0x24')]=this[_0xfb39('0x27')][_0x2d57e1[_0xfb39('0x22')]][_0xfb39('0x24')];}logger[_0xfb39('0x25')](_0x2d57e1['uniqueid'],this['actions'][_0x2d57e1['uniqueid']]?_0xfb39('0x50'):_0xfb39('0x51'),JSON['stringify'](this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]]));if(this[_0xfb39('0x27')][_0x2d57e1['uniqueid']]){if(this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]][_0xfb39('0x52')]>0x0&&this['channels'][_0x2d57e1[_0xfb39('0x22')]][_0xfb39('0x18')]===_0xfb39('0x53')){this['updateStatus'](_0x2d57e1[_0xfb39('0x22')],!![]);}else{this[_0xfb39('0x4b')](_0x2d57e1[_0xfb39('0x22')],![],this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]][_0xfb39('0x54')]?_0xfb39('0x55')+this[_0xfb39('0x21')][_0x2d57e1[_0xfb39('0x22')]]['faxstatusstring']:_0xfb39('0x56'));}}}};Fax[_0xfb39('0x1c')][_0xfb39('0x57')]=function(_0x47e74d){var _0x511f75=this;return new BPromise(function(_0x201462,_0xd31bee){_0x511f75[_0xfb39('0x58')](_0x47e74d,_0x511f75[_0xfb39('0xf')][_0x47e74d[_0xfb39('0x59')]])[_0xfb39('0x38')](function(_0x36581c){ut[_0xfb39('0x49')](_0xfb39('0x5a'),_0x36581c);_0x201462(ut[_0xfb39('0x5b')]('Fax\x20received'));})[_0xfb39('0x3b')](function(_0x4132fa){ut[_0xfb39('0x49')](_0xfb39('0x5c'),_0x4132fa);updateStatus(_0x47e74d);_0xd31bee(ut['message'](_0xfb39('0x5d')));});});};Fax['prototype'][_0xfb39('0x5e')]=function(_0x544d9b){var _0x16db45=this;return new BPromise(function(_0x119697,_0x4a6d65){var _0x5a2f20=_0x16db45[_0xfb39('0x5f')](_0x16db45['faxAccounts'][_0x544d9b[_0xfb39('0x59')]]['Trunk'],_0x544d9b);if(_0x5a2f20[_0xfb39('0x60')]){_0x119697(ut[_0xfb39('0x5b')]('Trunk\x20Reachable'));}else{_0x4a6d65(ut[_0xfb39('0x5b')](_0x5a2f20[_0xfb39('0x5b')]));}});};function originate(_0x7e3980,_0x21ca9f,_0x3113a0){return new BPromise(function(_0x552274,_0x243752){if(_0x3113a0){var _0xec2e82=util[_0xfb39('0x61')](_0xfb39('0x62'),path['parse'](_0x7e3980['path'])[_0xfb39('0x24')],_0x7e3980['path']);gs[_0xfb39('0x63')](_0xec2e82)[_0xfb39('0x38')](function(){_0x7e3980[_0xfb39('0x5')]=util[_0xfb39('0x61')](_0xfb39('0x64'),path['parse'](_0x7e3980['path'])[_0xfb39('0x65')],path[_0xfb39('0x36')](_0x7e3980[_0xfb39('0x5')])[_0xfb39('0x24')]);_0x21ca9f[_0xfb39('0x66')]=_0x7e3980[_0xfb39('0x5')];ut[_0xfb39('0x49')](_0xfb39('0x67'),'');ami['Action'](ut['variablesAction'](_0x7e3980,_0x21ca9f))[_0xfb39('0x38')](function(_0x2ae4c6){_0x552274(_0x2ae4c6);})[_0xfb39('0x3b')](function(_0x5dac6d){_0x243752(_0x5dac6d);});})[_0xfb39('0x3b')](function(_0x46fa56){_0x243752(_0x46fa56);});}else{ami[_0xfb39('0x68')](ut['variablesAction'](_0x7e3980,_0x21ca9f))['then'](function(_0x252f98){_0x552274(_0x252f98);})[_0xfb39('0x3b')](function(_0x2f20c8){_0x243752(_0x2f20c8);});}});}Fax[_0xfb39('0x1c')][_0xfb39('0x58')]=function(_0x29183e,_0xa524da){var _0x42b0ff=this;return new BPromise(function(_0x2f69ab,_0x362cf6){var _0x2201e1=uuid['v4']();var _0x391279=ut[_0xfb39('0x69')](_0x29183e,_0xa524da);_0x42b0ff['actions'][_0x2201e1]=new Action(_0x2201e1,_0xa524da,_0x29183e);var _0x450539=_0x42b0ff['actions'][_0x2201e1];if(path[_0xfb39('0x36')](_0x29183e[_0xfb39('0x5')])[_0xfb39('0x6a')]===_0xfb39('0x3a')){originate(_0x450539,_0x391279,!![])[_0xfb39('0x38')](function(_0x4d6ba5){_0x2f69ab(_0x4d6ba5);})[_0xfb39('0x3b')](function(_0x10a31c){_0x362cf6(_0x10a31c);});}else{originate(_0x450539,_0x391279,![])[_0xfb39('0x38')](function(_0x1decae){_0x2f69ab(_0x1decae);})[_0xfb39('0x3b')](function(_0x379dd9){_0x362cf6(_0x379dd9);});}});};Fax[_0xfb39('0x1c')]['isTrunkReachable']=function(_0x39ee20){return!_[_0xfb39('0x6b')](_0x39ee20)&&!_[_0xfb39('0x6b')](_0x39ee20[_0xfb39('0x24')])&&!_['isNil'](_0x39ee20[_0xfb39('0x6c')])&&_0x39ee20[_0xfb39('0x6c')]&&!_[_0xfb39('0x6b')](this['trunks'][util[_0xfb39('0x61')](_0xfb39('0x6d'),_0x39ee20[_0xfb39('0x24')])])&&!_['isNil'](this['trunks'][util[_0xfb39('0x61')]('SIP/%s',_0x39ee20[_0xfb39('0x24')])][_0xfb39('0x2d')])&&(this[_0xfb39('0x10')][util[_0xfb39('0x61')](_0xfb39('0x6d'),_0x39ee20[_0xfb39('0x24')])]['status']==='reachable'||this[_0xfb39('0x10')][util[_0xfb39('0x61')](_0xfb39('0x6d'),_0x39ee20[_0xfb39('0x24')])][_0xfb39('0x2d')]===_0xfb39('0x6e'));};Fax[_0xfb39('0x1c')][_0xfb39('0x5f')]=function(_0x194748,_0x19334e){if(!this[_0xfb39('0x6f')](_0x194748)){ut[_0xfb39('0x49')](_0xfb39('0x70'),_[_0xfb39('0x6b')](_0x194748)?'':_0x194748[_0xfb39('0x24')]+_0xfb39('0x71'));return{'isValid':![],'message':_0xfb39('0x72')};}if(_[_0xfb39('0x6b')](_0x19334e[_0xfb39('0x9')])){ut['logger'](_0xfb39('0x73'),JSON[_0xfb39('0x3e')](_0x19334e));return{'isValid':![],'message':_0xfb39('0x74')};}if(_[_0xfb39('0x6b')](_0x19334e['path'])){ut[_0xfb39('0x49')](_0xfb39('0x75'),JSON[_0xfb39('0x3e')](_0x19334e));return{'isValid':![],'message':_0xfb39('0x76')};}return{'isValid':!![],'message':_0xfb39('0x77')};};module[_0xfb39('0x78')]=Fax; \ No newline at end of file +var _0x1d3a=['update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','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','Is\x20Valid','exports','util','lodash','moment','path','./util/gs','../../../config/logger','fax','../ami','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId'];(function(_0x58391a,_0x3cc666){var _0xe02c18=function(_0x5c1887){while(--_0x5c1887){_0x58391a['push'](_0x58391a['shift']());}};_0xe02c18(++_0x3cc666);}(_0x1d3a,0x18f));var _0xa1d3=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x1d3a[_0x1b6c6d];return _0x290d9d;};'use strict';var util=require(_0xa1d3('0x0'));var _=require(_0xa1d3('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xa1d3('0x2'));var path=require(_0xa1d3('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xa1d3('0x4'));var logger=require(_0xa1d3('0x5'))(_0xa1d3('0x6'));var ami=require(_0xa1d3('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xa1d3('0x8'));var Action=require('./action');var faxAccount=require(_0xa1d3('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xa1d3('0xa'));function Fax(_0x4ddbfb){this[_0xa1d3('0xb')]={};this[_0xa1d3('0xc')]=_0x4ddbfb[_0xa1d3('0xc')];this[_0xa1d3('0xd')]=_0x4ddbfb[_0xa1d3('0xd')];this[_0xa1d3('0xe')]={};ami['on'](_0xa1d3('0xf'),this['syncNewchannel'][_0xa1d3('0x10')](this));ami['on'](_0xa1d3('0x11'),this[_0xa1d3('0x12')]['bind'](this));ami['on'](_0xa1d3('0x13'),this['syncNewState'][_0xa1d3('0x10')](this));ami['on'](_0xa1d3('0x14'),this[_0xa1d3('0x15')][_0xa1d3('0x10')](this));ami['on'](_0xa1d3('0x16'),this[_0xa1d3('0x17')][_0xa1d3('0x10')](this));ami['on'](_0xa1d3('0x18'),this['syncReceiveFax']['bind'](this));ami['on'](_0xa1d3('0x19'),this['syncHangup'][_0xa1d3('0x10')](this));ami['on'](_0xa1d3('0x1a'),this['syncOriginateResponse']['bind'](this));}Fax['prototype'][_0xa1d3('0x1b')]=function(_0x4b5fd0){if(_0x4b5fd0[_0xa1d3('0x1c')]==='from-voip-provider'){for(var _0xf356dc in this[_0xa1d3('0xc')]){if(this[_0xa1d3('0xc')][_0xa1d3('0x1d')](_0xf356dc)){if(_0x4b5fd0[_0xa1d3('0x1e')]===this[_0xa1d3('0xc')][_0xf356dc]['localstationid']){this[_0xa1d3('0xb')][_0x4b5fd0[_0xa1d3('0x1f')]]={};this[_0xa1d3('0xb')][_0x4b5fd0[_0xa1d3('0x1f')]][_0xa1d3('0x20')]=_0x4b5fd0[_0xa1d3('0x20')];this[_0xa1d3('0xb')][_0x4b5fd0['uniqueid']]['id']=this[_0xa1d3('0xc')][_0xf356dc]['id'];this['channels'][_0x4b5fd0[_0xa1d3('0x1f')]][_0xa1d3('0x21')]=this[_0xa1d3('0xc')][_0xf356dc][_0xa1d3('0x21')];logger[_0xa1d3('0x22')](_0x4b5fd0['uniqueid'],_0xa1d3('0x23'));}}}}if(this[_0xa1d3('0xe')][_0x4b5fd0[_0xa1d3('0x1f')]]){this[_0xa1d3('0xb')][_0x4b5fd0['uniqueid']]={};this['channels'][_0x4b5fd0[_0xa1d3('0x1f')]]['channel']=_0x4b5fd0[_0xa1d3('0x20')];logger[_0xa1d3('0x22')](_0x4b5fd0[_0xa1d3('0x1f')],_0xa1d3('0x23'));}};Fax[_0xa1d3('0x24')][_0xa1d3('0x12')]=function(_0x3d4667){if(this[_0xa1d3('0xb')][_0x3d4667[_0xa1d3('0x1f')]]){for(var _0x3f5899 in _0x3d4667[_0xa1d3('0x25')]){if(_0x3d4667[_0xa1d3('0x25')][_0xa1d3('0x1d')](_0x3f5899)){this[_0xa1d3('0xb')][_0x3d4667[_0xa1d3('0x1f')]][_0x3f5899]=_0x3d4667[_0xa1d3('0x26')];}}}};Fax[_0xa1d3('0x24')]['syncNewState']=function(_0xc0170c){if(this['channels'][_0xc0170c[_0xa1d3('0x1f')]]){this[_0xa1d3('0xb')][_0xc0170c[_0xa1d3('0x1f')]][_0xa1d3('0x27')]=_0xc0170c[_0xa1d3('0x27')];this['channels'][_0xc0170c[_0xa1d3('0x1f')]][_0xa1d3('0x28')]=_0xc0170c[_0xa1d3('0x28')];}};Fax['prototype']['syncNewExten']=function(_0x51c8a8){if(this[_0xa1d3('0xb')][_0x51c8a8[_0xa1d3('0x1f')]]){for(var _0x271ce0 in _0x51c8a8[_0xa1d3('0x25')]){if(_0x51c8a8[_0xa1d3('0x25')][_0xa1d3('0x1d')](_0x271ce0)){this[_0xa1d3('0xb')][_0x51c8a8[_0xa1d3('0x1f')]][_0x271ce0]=_0x51c8a8[_0xa1d3('0x26')];}}}};Fax[_0xa1d3('0x24')][_0xa1d3('0x17')]=function(_0xa9f809){if(this[_0xa1d3('0xb')][_0xa9f809[_0xa1d3('0x1f')]]){this[_0xa1d3('0xb')][_0xa9f809[_0xa1d3('0x1f')]][_0xa1d3('0x29')]=_0xa9f809[_0xa1d3('0x29')];this[_0xa1d3('0xb')][_0xa9f809['uniqueid']][_0xa1d3('0x2a')]=_0xa9f809[_0xa1d3('0x2a')];this[_0xa1d3('0xb')][_0xa9f809[_0xa1d3('0x1f')]][_0xa1d3('0x2b')]=_0xa9f809[_0xa1d3('0x2b')];this[_0xa1d3('0xb')][_0xa9f809[_0xa1d3('0x1f')]][_0xa1d3('0x2c')]=_0xa9f809[_0xa1d3('0x2c')];logger[_0xa1d3('0x22')](_0xa9f809[_0xa1d3('0x1f')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x502526){var _0x4bab12=this;if(this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]]){var _0xeced7=this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]]['id'];this[_0xa1d3('0xb')][_0x502526['uniqueid']][_0xa1d3('0x2d')]=_0x502526[_0xa1d3('0x2d')];this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]]['pagestransferred']=_0x502526[_0xa1d3('0x2e')];this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]][_0xa1d3('0x2b')]=_0x502526[_0xa1d3('0x2b')];this[_0xa1d3('0xb')][_0x502526['uniqueid']][_0xa1d3('0x2f')]=_0x502526[_0xa1d3('0x2f')];this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]][_0xa1d3('0x30')]=_0x502526[_0xa1d3('0x30')];this['channels'][_0x502526[_0xa1d3('0x1f')]][_0xa1d3('0x2c')]=_0x502526['filename'];this[_0xa1d3('0xb')][_0x502526[_0xa1d3('0x1f')]][_0xa1d3('0x31')]=_0x502526[_0xa1d3('0x31')];if(this[_0xa1d3('0xb')][_0x502526['uniqueid']][_0xa1d3('0x2e')]>0x0){tiff2pdf(_0x502526[_0xa1d3('0x2c')],_0xa1d3('0x32'),function(_0x5b7c93){logger[_0xa1d3('0x22')](_0x502526[_0xa1d3('0x1f')],_0xa1d3('0x33'),_0x5b7c93[_0xa1d3('0x34')]);attachment[_0xa1d3('0x35')]({'name':path[_0xa1d3('0x36')](_0x502526['filename'])[_0xa1d3('0x21')],'basename':path[_0xa1d3('0x36')](_0x502526[_0xa1d3('0x2c')])[_0xa1d3('0x21')]+_0xa1d3('0x37'),'type':_0xa1d3('0x38')})[_0xa1d3('0x39')](function(_0x451166){faxAccount[_0xa1d3('0x3a')](_0xeced7,{'from':_0x502526[_0xa1d3('0x31')],'mapKey':_0xa1d3('0x6'),'body':path['parse'](_0x502526['filename'])['name']+_0xa1d3('0x37'),'AttachmentId':_0x451166['id']})[_0xa1d3('0x3b')](function(_0xb841a5){logger[_0xa1d3('0x3c')](_0x502526[_0xa1d3('0x1f')],_0xa1d3('0x3d'),JSON[_0xa1d3('0x3e')](_0xb841a5));});})[_0xa1d3('0x3b')](function(_0xb4a9aa){logger[_0xa1d3('0x3c')](_0x502526[_0xa1d3('0x1f')],'\x20receiveFax\x20',JSON[_0xa1d3('0x3e')](_0xb4a9aa));});});}logger['info'](_0x502526[_0xa1d3('0x1f')],_0xa1d3('0x3f'));}};Fax[_0xa1d3('0x24')]['syncOriginateResponse']=function(_0x1100ff){if(this[_0xa1d3('0xe')][_0x1100ff['uniqueid']]){_[_0xa1d3('0x40')](this[_0xa1d3('0xb')][_0x1100ff['uniqueid']],_[_0xa1d3('0x41')](_0x1100ff,[_0xa1d3('0x42'),_0xa1d3('0x43')]));}};function updateStatus(_0x2b7ffb){if(_0x2b7ffb[_0xa1d3('0x44')]){faxMessage[_0xa1d3('0x45')](_0x2b7ffb[_0xa1d3('0x44')],{'failMessage':_0xa1d3('0x46')})['then'](function(_0x46ed20){ut[_0xa1d3('0x47')](_0xa1d3('0x48'),_0x46ed20);})[_0xa1d3('0x3b')](function(_0x40c6af){ut[_0xa1d3('0x47')](_0xa1d3('0x49'),_0x40c6af);});}else{ut[_0xa1d3('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xa1d3('0x24')][_0xa1d3('0x4a')]=function(_0x1adc6e,_0x2a36fd,_0x228eec){var _0x4e90b6=this;var _0x33d9d7={};if(_0x2a36fd){_0x33d9d7={'read':_0x2a36fd};}else{_0x33d9d7={'failMessage':_0x228eec};}if(this['actions'][_0x1adc6e][_0xa1d3('0x44')]){faxMessage[_0xa1d3('0x45')](this[_0xa1d3('0xe')][_0x1adc6e]['AttachmentId'],_0x33d9d7)[_0xa1d3('0x39')](function(_0x2188d6){ut['logger'](_0xa1d3('0x4b'),_0x2188d6);})[_0xa1d3('0x3b')](function(_0x4a937f){ut[_0xa1d3('0x47')](_0xa1d3('0x4c'),_0x4a937f);})[_0xa1d3('0x4d')](function(){delete _0x4e90b6[_0xa1d3('0xb')][_0x1adc6e];delete _0x4e90b6[_0xa1d3('0xe')][_0x1adc6e];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x1adc6e];delete this[_0xa1d3('0xe')][_0x1adc6e];}};Fax['prototype'][_0xa1d3('0x4e')]=function(_0x5e3558){var _0x4f24c8=this;if(this['channels'][_0x5e3558[_0xa1d3('0x1f')]]){if(this[_0xa1d3('0xe')][_0x5e3558['uniqueid']]){this[_0xa1d3('0xb')][_0x5e3558[_0xa1d3('0x1f')]]['id']=this[_0xa1d3('0xe')][_0x5e3558[_0xa1d3('0x1f')]]['id'];this[_0xa1d3('0xb')][_0x5e3558[_0xa1d3('0x1f')]]['name']=this[_0xa1d3('0xe')][_0x5e3558[_0xa1d3('0x1f')]][_0xa1d3('0x21')];}logger[_0xa1d3('0x22')](_0x5e3558[_0xa1d3('0x1f')],this[_0xa1d3('0xe')][_0x5e3558[_0xa1d3('0x1f')]]?_0xa1d3('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xa1d3('0x3e')](this[_0xa1d3('0xb')][_0x5e3558['uniqueid']]));if(this[_0xa1d3('0xe')][_0x5e3558['uniqueid']]){if(this[_0xa1d3('0xb')][_0x5e3558['uniqueid']][_0xa1d3('0x50')]>0x0&&this[_0xa1d3('0xb')][_0x5e3558[_0xa1d3('0x1f')]][_0xa1d3('0x16')]===_0xa1d3('0x51')){this['updateStatus'](_0x5e3558['uniqueid'],!![]);}else{this[_0xa1d3('0x4a')](_0x5e3558[_0xa1d3('0x1f')],![],this['channels'][_0x5e3558['uniqueid']][_0xa1d3('0x52')]?_0xa1d3('0x53')+this[_0xa1d3('0xb')][_0x5e3558[_0xa1d3('0x1f')]]['faxstatusstring']:_0xa1d3('0x54'));}}}};Fax['prototype']['send']=function(_0x577be1){var _0x18c99f=this;return new BPromise(function(_0x173de5,_0x322482){_0x18c99f[_0xa1d3('0x55')](_0x577be1,_0x18c99f[_0xa1d3('0xc')][_0x577be1['FaxAccountId']])[_0xa1d3('0x39')](function(_0x142a16){ut[_0xa1d3('0x47')](_0xa1d3('0x56'),_0x142a16);_0x173de5(ut[_0xa1d3('0x34')](_0xa1d3('0x57')));})[_0xa1d3('0x3b')](function(_0x1faf00){ut[_0xa1d3('0x47')](_0xa1d3('0x58'),_0x1faf00);updateStatus(_0x577be1);_0x322482(ut[_0xa1d3('0x34')](_0xa1d3('0x59')));});});};Fax['prototype'][_0xa1d3('0x5a')]=function(_0x3cba18){var _0x1996fb=this;return new BPromise(function(_0x8cfd68,_0x598299){var _0x323d3d=_0x1996fb['checkTrunk'](_0x1996fb['faxAccounts'][_0x3cba18[_0xa1d3('0x5b')]][_0xa1d3('0x5c')],_0x3cba18);if(_0x323d3d[_0xa1d3('0x5d')]){_0x8cfd68(ut[_0xa1d3('0x34')]('Trunk\x20Reachable'));}else{_0x598299(ut[_0xa1d3('0x34')](_0x323d3d[_0xa1d3('0x34')]));}});};function originate(_0x361c8c,_0x4f01df,_0x1b6647){return new BPromise(function(_0x15a054,_0xf72b46){if(_0x1b6647){var _0x2cb63a=util[_0xa1d3('0x5e')](_0xa1d3('0x5f'),path['parse'](_0x361c8c[_0xa1d3('0x3')])[_0xa1d3('0x21')],_0x361c8c[_0xa1d3('0x3')]);gs[_0xa1d3('0x60')](_0x2cb63a)[_0xa1d3('0x39')](function(){_0x361c8c['path']=util['format']('%s/%s.tif',path[_0xa1d3('0x36')](_0x361c8c[_0xa1d3('0x3')])[_0xa1d3('0x61')],path[_0xa1d3('0x36')](_0x361c8c[_0xa1d3('0x3')])[_0xa1d3('0x21')]);_0x4f01df[_0xa1d3('0x62')]=_0x361c8c[_0xa1d3('0x3')];ut[_0xa1d3('0x47')](_0xa1d3('0x63'),'');ami[_0xa1d3('0x64')](ut[_0xa1d3('0x65')](_0x361c8c,_0x4f01df))[_0xa1d3('0x39')](function(_0x416f58){_0x15a054(_0x416f58);})['catch'](function(_0x368bbc){_0xf72b46(_0x368bbc);});})[_0xa1d3('0x3b')](function(_0x5c1f44){_0xf72b46(_0x5c1f44);});}else{ami[_0xa1d3('0x64')](ut[_0xa1d3('0x65')](_0x361c8c,_0x4f01df))[_0xa1d3('0x39')](function(_0x177724){_0x15a054(_0x177724);})[_0xa1d3('0x3b')](function(_0x1b1252){_0xf72b46(_0x1b1252);});}});}Fax[_0xa1d3('0x24')][_0xa1d3('0x55')]=function(_0x5f1111,_0x56dde3){var _0x30f580=this;return new BPromise(function(_0x123bb5,_0x157904){var _0x3c35e5=uuid['v4']();var _0x20de9b=ut[_0xa1d3('0x66')](_0x5f1111,_0x56dde3);_0x30f580[_0xa1d3('0xe')][_0x3c35e5]=new Action(_0x3c35e5,_0x56dde3,_0x5f1111);var _0x559f63=_0x30f580['actions'][_0x3c35e5];if(path[_0xa1d3('0x36')](_0x5f1111[_0xa1d3('0x3')])['ext']===_0xa1d3('0x37')){originate(_0x559f63,_0x20de9b,!![])[_0xa1d3('0x39')](function(_0x1c3114){_0x123bb5(_0x1c3114);})[_0xa1d3('0x3b')](function(_0x4c1bc4){_0x157904(_0x4c1bc4);});}else{originate(_0x559f63,_0x20de9b,![])[_0xa1d3('0x39')](function(_0x243ae6){_0x123bb5(_0x243ae6);})[_0xa1d3('0x3b')](function(_0x5981c2){_0x157904(_0x5981c2);});}});};Fax[_0xa1d3('0x24')][_0xa1d3('0x67')]=function(_0x518e39){return!_['isNil'](_0x518e39)&&!_[_0xa1d3('0x68')](_0x518e39['name'])&&!_['isNil'](_0x518e39[_0xa1d3('0x69')])&&_0x518e39[_0xa1d3('0x69')]&&!_['isNil'](this['trunks'][util[_0xa1d3('0x5e')](_0xa1d3('0x6a'),_0x518e39[_0xa1d3('0x21')])])&&!_[_0xa1d3('0x68')](this[_0xa1d3('0xd')][util[_0xa1d3('0x5e')]('SIP/%s',_0x518e39[_0xa1d3('0x21')])][_0xa1d3('0x2a')])&&(this['trunks'][util[_0xa1d3('0x5e')](_0xa1d3('0x6a'),_0x518e39[_0xa1d3('0x21')])]['status']===_0xa1d3('0x6b')||this[_0xa1d3('0xd')][util[_0xa1d3('0x5e')]('SIP/%s',_0x518e39[_0xa1d3('0x21')])][_0xa1d3('0x2a')]==='unmonitored');};Fax[_0xa1d3('0x24')]['checkTrunk']=function(_0x246487,_0x2ef75f){if(!this[_0xa1d3('0x67')](_0x246487)){ut[_0xa1d3('0x47')](_0xa1d3('0x6c'),_[_0xa1d3('0x68')](_0x246487)?'':_0x246487[_0xa1d3('0x21')]+_0xa1d3('0x6d'));return{'isValid':![],'message':_0xa1d3('0x6e')};}if(_['isNil'](_0x2ef75f[_0xa1d3('0x6')])){ut[_0xa1d3('0x47')](_0xa1d3('0x6f'),JSON['stringify'](_0x2ef75f));return{'isValid':![],'message':_0xa1d3('0x70')};}if(_[_0xa1d3('0x68')](_0x2ef75f[_0xa1d3('0x3')])){ut[_0xa1d3('0x47')](_0xa1d3('0x71'),JSON['stringify'](_0x2ef75f));return{'isValid':![],'message':_0xa1d3('0x72')};}return{'isValid':!![],'message':_0xa1d3('0x73')};};module[_0xa1d3('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3fe4e23..11d5515 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 _0xa9f2=['preview','lodash','../rpc/faxAccount','notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x5c2056,_0x16d13c){var _0x228b67=function(_0x3b5945){while(--_0x3b5945){_0x5c2056['push'](_0x5c2056['shift']());}};_0x228b67(++_0x16d13c);}(_0xa9f2,0x1bf));var _0x2a9f=function(_0x18fc26,_0x7aa40){_0x18fc26=_0x18fc26-0x0;var _0xa382fc=_0xa9f2[_0x18fc26];return _0xa382fc;};'use strict';var util=require(_0x2a9f('0x0'));var BPromise=require(_0x2a9f('0x1'));var logger=require(_0x2a9f('0x2'))(_0x2a9f('0x3'));var _=require(_0x2a9f('0x4'));var faxAccount=require(_0x2a9f('0x5'));function loggerCatch(_0x521989){return function(_0xbd4704){logger['error'](_0x521989,util['inspect'](_0xbd4704,{'showHidden':![],'depth':null}));};}exports[_0x2a9f('0x6')]=function(_0x2e401e,_0x17df66){return BPromise[_0x2a9f('0x7')]()['then'](faxAccount[_0x2a9f('0x6')](_0x2e401e,_0x17df66))['catch'](loggerCatch(_0x2a9f('0x8')));}; \ No newline at end of file +var _0xc33c=['../rpc/faxAccount','error','inspect','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x1f7334,_0x758e59){var _0x28b9bd=function(_0x1cb292){while(--_0x1cb292){_0x1f7334['push'](_0x1f7334['shift']());}};_0x28b9bd(++_0x758e59);}(_0xc33c,0x19d));var _0xcc33=function(_0xc47532,_0x1ecff3){_0xc47532=_0xc47532-0x0;var _0x2fc846=_0xc33c[_0xc47532];return _0x2fc846;};'use strict';var util=require(_0xcc33('0x0'));var BPromise=require(_0xcc33('0x1'));var logger=require(_0xcc33('0x2'))(_0xcc33('0x3'));var _=require(_0xcc33('0x4'));var faxAccount=require(_0xcc33('0x5'));function loggerCatch(_0x114c7e){return function(_0x24964f){logger[_0xcc33('0x6')](_0x114c7e,util[_0xcc33('0x7')](_0x24964f,{'showHidden':![],'depth':null}));};}exports[_0xcc33('0x8')]=function(_0xef5769,_0x3f9662){return BPromise['resolve']()['then'](faxAccount[_0xcc33('0x8')](_0xef5769,_0x3f9662))[_0xcc33('0x9')](loggerCatch(_0xcc33('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e37e52e..27d4a3b 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 _0x4db4=['exec','execute','info','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process'];(function(_0x309fe2,_0x443033){var _0x5ebdd2=function(_0x7a1ea6){while(--_0x7a1ea6){_0x309fe2['push'](_0x309fe2['shift']());}};_0x5ebdd2(++_0x443033);}(_0x4db4,0x83));var _0x44db=function(_0x3acc91,_0x5a28ad){_0x3acc91=_0x3acc91-0x0;var _0x48cc8e=_0x4db4[_0x3acc91];return _0x48cc8e;};'use strict';var util=require('util');var logger=require(_0x44db('0x0'))(_0x44db('0x1'));var BPromise=require(_0x44db('0x2'));var exec=require(_0x44db('0x3'))[_0x44db('0x4')];exports[_0x44db('0x5')]=function(_0x1c69ef){return new BPromise(function(_0x2b68ac,_0x314441){exec(_0x1c69ef,function(_0x5aac23,_0x158b17,_0x11e378){logger['info']('Exec\x20gs',_0x158b17);if(_0x5aac23){logger[_0x44db('0x6')]('Exec\x20gs',_0x44db('0x7'),util[_0x44db('0x8')](_0x5aac23,{'showHidden':![],'depth':null}),_0x158b17,_0x11e378);_0x314441(_0x5aac23);}_0x2b68ac(_0x158b17);});});}; \ No newline at end of file +var _0x5120=['exec','Exec\x20gs','info','inspect','util','bluebird','child_process'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5120,0x7b));var _0x0512=function(_0x467e9a,_0x3f060b){_0x467e9a=_0x467e9a-0x0;var _0x54ab51=_0x5120[_0x467e9a];return _0x54ab51;};'use strict';var util=require(_0x0512('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x0512('0x1'));var exec=require(_0x0512('0x2'))[_0x0512('0x3')];exports['execute']=function(_0x46bd19){return new BPromise(function(_0x517e9b,_0x3e1322){exec(_0x46bd19,function(_0x588e06,_0x32d6a5,_0x424f94){logger['info'](_0x0512('0x4'),_0x32d6a5);if(_0x588e06){logger[_0x0512('0x5')](_0x0512('0x4'),'\x20Error\x20:',util[_0x0512('0x6')](_0x588e06,{'showHidden':![],'depth':null}),_0x32d6a5,_0x424f94);_0x3e1322(_0x588e06);}_0x517e9b(_0x32d6a5);});});}; \ 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 cf2f5d3..53dadd7 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 _0xc6d8=['path','variablesAction','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','moment','fax','info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x4d22f4,_0x1b5bd6){var _0x4047be=function(_0x3501a1){while(--_0x3501a1){_0x4d22f4['push'](_0x4d22f4['shift']());}};_0x4047be(++_0x1b5bd6);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x427cce,_0x718314){_0x427cce=_0x427cce-0x0;var _0x283078=_0xc6d8[_0x427cce];return _0x283078;};'use strict';var util=require(_0x8c6d('0x0'));var _=require('lodash');var moment=require(_0x8c6d('0x1'));var logger=require('../../../../config/logger')(_0x8c6d('0x2'));exports['message']=function(_0x292852){return{'message':_0x292852};};exports['logger']=function(_0x5b6b04,_0x352b8c){logger[_0x8c6d('0x3')](_0x5b6b04,util[_0x8c6d('0x4')](_0x352b8c,{'showHidden':![],'depth':null}));};exports[_0x8c6d('0x5')]=function(_0x3c265c,_0x2dbb52){var _0x98cae4={'XMF-ECM':_0x2dbb52['ecm'],'XMF-HEADERINFO':_0x2dbb52[_0x8c6d('0x6')],'XMF-MINRATE':_0x2dbb52[_0x8c6d('0x7')],'XMF-MAXRATE':_0x2dbb52[_0x8c6d('0x8')],'XMF-MODEM':util['format'](_0x8c6d('0x9'),_0x2dbb52[_0x8c6d('0xa')]),'XMF-GATEWAY':_0x2dbb52[_0x8c6d('0xb')],'XMF-FAXDETECT':_0x2dbb52[_0x8c6d('0xc')],'XMF-T38TIMEOUT':_0x2dbb52[_0x8c6d('0xd')],'XMF-LOCALSTATIONID':_0x2dbb52[_0x8c6d('0xe')],'XMF-PATH':_0x3c265c[_0x8c6d('0xf')]};return _0x98cae4;};exports[_0x8c6d('0x10')]=function(_0x50af75,_0x36d6fb){return{'actionid':_0x50af75['uniqueid'],'action':'originate','channel':_0x50af75[_0x8c6d('0x11')],'Exten':_0x8c6d('0x12'),'Context':_0x8c6d('0x13'),'Priority':'1','callerid':util[_0x8c6d('0x14')](_0x8c6d('0x15'),_0x50af75[_0x8c6d('0x6')]?_0x50af75[_0x8c6d('0x6')]:'',_0x50af75[_0x8c6d('0xe')]),'variable':_0x36d6fb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x50af75[_0x8c6d('0x16')]};}; \ No newline at end of file +var _0xa902=['gateway','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xa902,0x8d));var _0x2a90=function(_0x57960e,_0x2415e0){_0x57960e=_0x57960e-0x0;var _0x3cf54e=_0xa902[_0x57960e];return _0x3cf54e;};'use strict';var util=require(_0x2a90('0x0'));var _=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var logger=require(_0x2a90('0x3'))(_0x2a90('0x4'));exports['message']=function(_0x2da982){return{'message':_0x2da982};};exports['logger']=function(_0x4961c2,_0x169808){logger[_0x2a90('0x5')](_0x4961c2,util[_0x2a90('0x6')](_0x169808,{'showHidden':![],'depth':null}));};exports[_0x2a90('0x7')]=function(_0x4a32c7,_0x25bcfc){var _0x58369a={'XMF-ECM':_0x25bcfc[_0x2a90('0x8')],'XMF-HEADERINFO':_0x25bcfc['headerinfo'],'XMF-MINRATE':_0x25bcfc['minrate'],'XMF-MAXRATE':_0x25bcfc[_0x2a90('0x9')],'XMF-MODEM':util[_0x2a90('0xa')](_0x2a90('0xb'),_0x25bcfc[_0x2a90('0xc')]),'XMF-GATEWAY':_0x25bcfc[_0x2a90('0xd')],'XMF-FAXDETECT':_0x25bcfc['faxdetect'],'XMF-T38TIMEOUT':_0x25bcfc[_0x2a90('0xe')],'XMF-LOCALSTATIONID':_0x25bcfc[_0x2a90('0xf')],'XMF-PATH':_0x4a32c7[_0x2a90('0x10')]};return _0x58369a;};exports[_0x2a90('0x11')]=function(_0x541e22,_0x40e6aa){return{'actionid':_0x541e22['uniqueid'],'action':_0x2a90('0x12'),'channel':_0x541e22['channel'],'Exten':_0x2a90('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x2a90('0xa')](_0x2a90('0x14'),_0x541e22[_0x2a90('0x15')]?_0x541e22['headerinfo']:'',_0x541e22['localstationid']),'variable':_0x40e6aa,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x541e22['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 36a7aae..70c5140 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 _0x4456=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','sync','catch','bluebird','moment','./server','./report','./acw','./trigger','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x3ada29,_0x50f2fc){var _0x297a54=function(_0x940448){while(--_0x940448){_0x3ada29['push'](_0x3ada29['shift']());}};_0x297a54(++_0x50f2fc);}(_0x4456,0x1b1));var _0x6445=function(_0x2deb24,_0xb9eab3){_0x2deb24=_0x2deb24-0x0;var _0x6f6f35=_0x4456[_0x2deb24];return _0x6f6f35;};'use strict';var BPromise=require(_0x6445('0x0'));var util=require('util');var moment=require(_0x6445('0x1'));var server=require(_0x6445('0x2'));var Realtime=require('./realtime');var Report=require(_0x6445('0x3'));var Acw=require(_0x6445('0x4'));var Trigger=require(_0x6445('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x6445('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6445('0x7'));var voiceCallReport=require(_0x6445('0x8'));var trunk=require(_0x6445('0x9'));var trigger=require(_0x6445('0xa'));var template=require(_0x6445('0xb'));var cmHopperHistory=require(_0x6445('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x6445('0xd'));var faxAccount=require(_0x6445('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x6445('0xf'));var desk=require(_0x6445('0x10'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6445('0x11'));var freshsales=require(_0x6445('0x12'));var servicenow=require(_0x6445('0x13'));var dynamics365=require(_0x6445('0x14'));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()[_0x6445('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6445('0x15')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6445('0x16')]()[_0x6445('0x17')](user[_0x6445('0x18')]())['then'](realtime[_0x6445('0x19')]())[_0x6445('0x17')](user['getTelephones']())[_0x6445('0x17')](realtime[_0x6445('0x1a')]())[_0x6445('0x17')](trunk[_0x6445('0x1b')]())['then'](realtime[_0x6445('0x1c')]())[_0x6445('0x17')](voiceQueue[_0x6445('0x1d')]())[_0x6445('0x17')](realtime['initVoiceQueues']())[_0x6445('0x17')](trigger[_0x6445('0x1e')]())[_0x6445('0x17')](realtime['initTriggers']())[_0x6445('0x17')](template[_0x6445('0x1f')]())['then'](realtime[_0x6445('0x20')]())[_0x6445('0x17')](zendesk[_0x6445('0x21')]())['then'](realtime['initZendeskAccounts']())[_0x6445('0x17')](salesforce[_0x6445('0x22')]())[_0x6445('0x17')](realtime[_0x6445('0x23')]())[_0x6445('0x17')](sugarcrm[_0x6445('0x24')]())[_0x6445('0x17')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x6445('0x25')]())[_0x6445('0x17')](realtime[_0x6445('0x26')]())['then'](desk[_0x6445('0x27')]())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x6445('0x28')]())['then'](realtime[_0x6445('0x29')]())[_0x6445('0x17')](vtiger['getVtigerAccounts']())[_0x6445('0x17')](realtime[_0x6445('0x2a')]())[_0x6445('0x17')](freshsales[_0x6445('0x2b')]())[_0x6445('0x17')](realtime[_0x6445('0x2c')]())['then'](servicenow[_0x6445('0x2d')]())['then'](realtime[_0x6445('0x2e')]())[_0x6445('0x17')](dynamics365[_0x6445('0x2f')]())[_0x6445('0x17')](realtime[_0x6445('0x30')]())[_0x6445('0x17')](campaign[_0x6445('0x31')]())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0x6445('0x32')]())[_0x6445('0x17')](realtime[_0x6445('0x33')]())[_0x6445('0x17')](faxAccount['getFaxAccounts']())['then'](realtime[_0x6445('0x34')]())[_0x6445('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x6445('0x16')]()['then'](voiceQueueReport[_0x6445('0x35')]())['then'](realtime['initVoiceQueueReports']())[_0x6445('0x17')](cmHopperHistory[_0x6445('0x36')]())['then'](realtime[_0x6445('0x37')]())['then'](cmHopperHistory[_0x6445('0x38')]())[_0x6445('0x17')](realtime[_0x6445('0x39')]())[_0x6445('0x17')](voiceCallReport['getVoiceCallReports']())[_0x6445('0x17')](realtime[_0x6445('0x3a')]())[_0x6445('0x17')](function(_0x3b7d84){})['catch'](function(_0x148d70){console['log'](_0x148d70);});}function main(){return server['listen'](realtime,preview,fax)[_0x6445('0x17')](function(_0x344619){return initRealtime();})[_0x6445('0x17')](function(){return initParams();})[_0x6445('0x17')](function(){report[_0x6445('0x3b')]();setInterval(initRealtime,0x1388);})[_0x6445('0x3c')](function(_0x22bbaa){console['log'](_0x22bbaa);});}main(); \ No newline at end of file +var _0x426e=['util','moment','./realtime','./report','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x426e,0xb7));var _0xe426=function(_0x2f58ea,_0x2c8f38){_0x2f58ea=_0x2f58ea-0x0;var _0x514770=_0x426e[_0x2f58ea];return _0x514770;};'use strict';var BPromise=require('bluebird');var util=require(_0xe426('0x0'));var moment=require(_0xe426('0x1'));var server=require('./server');var Realtime=require(_0xe426('0x2'));var Report=require(_0xe426('0x3'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xe426('0x4'));var Preview=require(_0xe426('0x5'));var Fax=require(_0xe426('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xe426('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe426('0x8'));var trigger=require(_0xe426('0x9'));var template=require('./rpc/template');var cmHopperHistory=require(_0xe426('0xa'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe426('0xb'));var faxAccount=require(_0xe426('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xe426('0xd'));var sugarcrm=require(_0xe426('0xe'));var freshdesk=require(_0xe426('0xf'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xe426('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe426('0x11'));var dynamics365=require(_0xe426('0x12'));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()[_0xe426('0x13')](_0xe426('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe426('0x13')](_0xe426('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe426('0x15')](user[_0xe426('0x16')]())[_0xe426('0x15')](realtime[_0xe426('0x17')]())[_0xe426('0x15')](user[_0xe426('0x18')]())[_0xe426('0x15')](realtime[_0xe426('0x19')]())[_0xe426('0x15')](trunk[_0xe426('0x1a')]())[_0xe426('0x15')](realtime[_0xe426('0x1b')]())[_0xe426('0x15')](voiceQueue['getVoiceQueues']())[_0xe426('0x15')](realtime['initVoiceQueues']())[_0xe426('0x15')](trigger['getTriggers']())['then'](realtime['initTriggers']())[_0xe426('0x15')](template['getTemplates']())[_0xe426('0x15')](realtime['initTemplates']())[_0xe426('0x15')](zendesk[_0xe426('0x1c')]())[_0xe426('0x15')](realtime[_0xe426('0x1d')]())[_0xe426('0x15')](salesforce[_0xe426('0x1e')]())[_0xe426('0x15')](realtime[_0xe426('0x1f')]())[_0xe426('0x15')](sugarcrm[_0xe426('0x20')]())['then'](realtime[_0xe426('0x21')]())['then'](freshdesk[_0xe426('0x22')]())[_0xe426('0x15')](realtime[_0xe426('0x23')]())[_0xe426('0x15')](desk['getDeskAccounts']())['then'](realtime[_0xe426('0x24')]())[_0xe426('0x15')](zoho[_0xe426('0x25')]())[_0xe426('0x15')](realtime[_0xe426('0x26')]())[_0xe426('0x15')](vtiger[_0xe426('0x27')]())[_0xe426('0x15')](realtime[_0xe426('0x28')]())[_0xe426('0x15')](freshsales[_0xe426('0x29')]())[_0xe426('0x15')](realtime[_0xe426('0x2a')]())[_0xe426('0x15')](servicenow[_0xe426('0x2b')]())[_0xe426('0x15')](realtime[_0xe426('0x2c')]())['then'](dynamics365['getDynamics365Accounts']())[_0xe426('0x15')](realtime['initDynamics365Accounts']())[_0xe426('0x15')](campaign[_0xe426('0x2d')]())[_0xe426('0x15')](realtime[_0xe426('0x2e')]())[_0xe426('0x15')](voiceExtension[_0xe426('0x2f')]())[_0xe426('0x15')](realtime[_0xe426('0x30')]())['then'](faxAccount[_0xe426('0x31')]())[_0xe426('0x15')](realtime['initFaxAccounts']())[_0xe426('0x15')](function(){return realtime;});}function initParams(){return BPromise[_0xe426('0x32')]()[_0xe426('0x15')](voiceQueueReport[_0xe426('0x33')]())[_0xe426('0x15')](realtime[_0xe426('0x34')]())[_0xe426('0x15')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe426('0x15')](realtime['initVoiceQueueHopperHistory']())[_0xe426('0x15')](cmHopperHistory[_0xe426('0x35')]())[_0xe426('0x15')](realtime[_0xe426('0x36')]())[_0xe426('0x15')](voiceCallReport[_0xe426('0x37')]())[_0xe426('0x15')](realtime[_0xe426('0x38')]())[_0xe426('0x15')](function(_0x43071f){})[_0xe426('0x39')](function(_0x154434){console['log'](_0x154434);});}function main(){return server[_0xe426('0x3a')](realtime,preview,fax)['then'](function(_0x4d622d){return initRealtime();})[_0xe426('0x15')](function(){return initParams();})[_0xe426('0x15')](function(){report[_0xe426('0x3b')]();setInterval(initRealtime,0x1388);})[_0xe426('0x39')](function(_0x5dbfaf){console[_0xe426('0x3c')](_0x5dbfaf);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 8b62b6b..d28e457 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 _0x437b=['unknown','stateTime','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','not_inuse','idle','inuse','talking','toNumber','format','status','stringify','emit','user:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state'];(function(_0x1cd460,_0x542b78){var _0x30b597=function(_0x95240c){while(--_0x95240c){_0x1cd460['push'](_0x1cd460['shift']());}};_0x30b597(++_0x542b78);}(_0x437b,0x11c));var _0xb437=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x437b[_0x3358ba];return _0x296e73;};'use strict';var _=require(_0xb437('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xb437('0x1'));var Redis=require('ioredis');var config=require(_0xb437('0x2'));config[_0xb437('0x3')]=_[_0xb437('0x4')](config[_0xb437('0x3')],{'host':_0xb437('0x5'),'port':0x18eb});var io=require(_0xb437('0x6'))(new Redis(config[_0xb437('0x3')]));function Agent(_0x3436f5){this['id']=_0x3436f5['id']||0x0;this[_0xb437('0x7')]=_0x3436f5[_0xb437('0x7')]||'';this['email']=_0x3436f5[_0xb437('0x8')]||'';this[_0xb437('0x9')]=_0x3436f5['accountcode']||'';this[_0xb437('0xa')]=_0x3436f5[_0xb437('0xa')]||'';this[_0xb437('0xb')]=_0xb437('0xc');this[_0xb437('0xd')]=0x0;this['status']=_0xb437('0xc');this[_0xb437('0xe')]='';this[_0xb437('0xf')]='';this[_0xb437('0x10')]='';this[_0xb437('0x11')]='';this['online']=_0x3436f5[_0xb437('0x12')]||![];this[_0xb437('0x13')]=_0xb437('0xc');this[_0xb437('0x14')]=0x0;this[_0xb437('0x15')]='';this[_0xb437('0x16')]='';this[_0xb437('0x17')]=![];this[_0xb437('0x18')]=![];this[_0xb437('0x1')]='';}Agent[_0xb437('0x19')]['updateStatusRealtime']=function(_0x574581){var _0x51b399;if(_0x574581&&_0x574581[_0xb437('0xb')]){_0x51b399=_0x574581[_0xb437('0xb')]['toLowerCase']();switch(_0x51b399){case _0xb437('0x1a'):_0x51b399=_0xb437('0x1b');break;case _0xb437('0x1c'):_0x51b399=_0xb437('0x1d');break;}}if(_0x51b399&&this[_0xb437('0x13')]!==_0x51b399||_0x574581['statePause']){this[_0xb437('0x14')]=_[_0xb437('0x1e')](moment()[_0xb437('0x1f')]('x'));}if(_0x51b399){this[_0xb437('0x13')]=_0x51b399;}var _0x5ca0d1={'id':this['id'],'name':this[_0xb437('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xb437('0xa')],'state':this[_0xb437('0xb')],'stateTime':this[_0xb437('0xd')],'status':this[_0xb437('0x20')],'address':this[_0xb437('0xe')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xb437('0x15')],'voiceStatusQueue':this[_0xb437('0x16')],'interface':this[_0xb437('0x11')],'onhold':this[_0xb437('0x17')]};var _0x1b3c47=md5(JSON[_0xb437('0x21')](_0x5ca0d1));if(this[_0xb437('0x1')]!==_0x1b3c47){this['md5']=_0x1b3c47;io['to'](util[_0xb437('0x1f')]('user:%s',_0x5ca0d1['name']))[_0xb437('0x22')](_0xb437('0x23'),_0x5ca0d1);}};module[_0xb437('0x24')]=Agent; \ No newline at end of file +var _0x6cd7=['ioredis','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','onhold','stringify','format','user:%s','emit','user:save','lodash','util','moment'];(function(_0x89588c,_0x39ad5e){var _0x5b1908=function(_0x41dd68){while(--_0x41dd68){_0x89588c['push'](_0x89588c['shift']());}};_0x5b1908(++_0x39ad5e);}(_0x6cd7,0xdb));var _0x76cd=function(_0x120b1e,_0x4d2bec){_0x120b1e=_0x120b1e-0x0;var _0x186859=_0x6cd7[_0x120b1e];return _0x186859;};'use strict';var _=require(_0x76cd('0x0'));var util=require(_0x76cd('0x1'));var moment=require(_0x76cd('0x2'));var md5=require('md5');var Redis=require(_0x76cd('0x3'));var config=require('../../../config/environment');config[_0x76cd('0x4')]=_[_0x76cd('0x5')](config[_0x76cd('0x4')],{'host':_0x76cd('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76cd('0x4')]));function Agent(_0xa14cec){this['id']=_0xa14cec['id']||0x0;this[_0x76cd('0x7')]=_0xa14cec['name']||'';this[_0x76cd('0x8')]=_0xa14cec['email']||'';this['accountcode']=_0xa14cec[_0x76cd('0x9')]||'';this[_0x76cd('0xa')]=_0xa14cec['fullname']||'';this[_0x76cd('0xb')]=_0x76cd('0xc');this[_0x76cd('0xd')]=0x0;this['status']=_0x76cd('0xc');this[_0x76cd('0xe')]='';this[_0x76cd('0xf')]='';this['mobile']='';this[_0x76cd('0x10')]='';this[_0x76cd('0x11')]=_0xa14cec[_0x76cd('0x11')]||![];this[_0x76cd('0x12')]=_0x76cd('0xc');this[_0x76cd('0x13')]=0x0;this[_0x76cd('0x14')]='';this[_0x76cd('0x15')]='';this['onhold']=![];this[_0x76cd('0x16')]=![];this[_0x76cd('0x17')]='';}Agent[_0x76cd('0x18')][_0x76cd('0x19')]=function(_0x3a77df){var _0x3e6200;if(_0x3a77df&&_0x3a77df[_0x76cd('0xb')]){_0x3e6200=_0x3a77df['state']['toLowerCase']();switch(_0x3e6200){case _0x76cd('0x1a'):_0x3e6200='idle';break;case _0x76cd('0x1b'):_0x3e6200=_0x76cd('0x1c');break;}}if(_0x3e6200&&this[_0x76cd('0x12')]!==_0x3e6200||_0x3a77df[_0x76cd('0x1d')]){this[_0x76cd('0x13')]=_[_0x76cd('0x1e')](moment()['format']('x'));}if(_0x3e6200){this[_0x76cd('0x12')]=_0x3e6200;}var _0x32505b={'id':this['id'],'name':this[_0x76cd('0x7')],'email':this[_0x76cd('0x8')],'accountcode':this[_0x76cd('0x9')],'fullname':this['fullname'],'state':this[_0x76cd('0xb')],'stateTime':this[_0x76cd('0xd')],'status':this['status'],'address':this['address'],'online':this[_0x76cd('0x11')],'voiceStatus':this[_0x76cd('0x12')],'voiceStatusTime':this[_0x76cd('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x76cd('0x15')],'interface':this[_0x76cd('0x10')],'onhold':this[_0x76cd('0x1f')]};var _0x1873b8=md5(JSON[_0x76cd('0x20')](_0x32505b));if(this[_0x76cd('0x17')]!==_0x1873b8){this[_0x76cd('0x17')]=_0x1873b8;io['to'](util[_0x76cd('0x21')](_0x76cd('0x22'),_0x32505b['name']))[_0x76cd('0x23')](_0x76cd('0x24'),_0x32505b);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2ed702f..a7b1a5c 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 _0x1b1c=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x4a61fd,_0x59c968){var _0x371daa=function(_0x35d1be){while(--_0x35d1be){_0x4a61fd['push'](_0x4a61fd['shift']());}};_0x371daa(++_0x59c968);}(_0x1b1c,0x112));var _0xc1b1=function(_0x26cb03,_0x38d271){_0x26cb03=_0x26cb03-0x0;var _0x5b7ac9=_0x1b1c[_0x26cb03];return _0x5b7ac9;};'use strict';function Campaign(_0x15f530){this['id']=_0x15f530['id']||0x0;this['name']=_0x15f530[_0xc1b1('0x0')]||'';this['type']=_0x15f530[_0xc1b1('0x1')]||_0xc1b1('0x2');this[_0xc1b1('0x3')]=0x0;this[_0xc1b1('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xc1b1('0x5')]=!![];this[_0xc1b1('0x6')]=_0x15f530['active'];this[_0xc1b1('0x7')]=_0x15f530[_0xc1b1('0x7')];this[_0xc1b1('0x8')]=_0x15f530['dialTimezone']||null;this[_0xc1b1('0x9')]=_0x15f530[_0xc1b1('0x9')]?_0x15f530[_0xc1b1('0x9')]:null;this['dialOriginateCallerIdName']=_0x15f530['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x15f530[_0xc1b1('0xa')];this[_0xc1b1('0xb')]=_0x15f530[_0xc1b1('0xb')]||0x1e;this[_0xc1b1('0xc')]=_0x15f530[_0xc1b1('0xc')];this[_0xc1b1('0xd')]=_0x15f530[_0xc1b1('0xd')];this[_0xc1b1('0xe')]=_0x15f530[_0xc1b1('0xe')];this['dialBusyRetryFrequency']=_0x15f530[_0xc1b1('0xf')];this['dialNoAnswerMaxRetry']=_0x15f530[_0xc1b1('0x10')];this[_0xc1b1('0x11')]=_0x15f530[_0xc1b1('0x11')];this[_0xc1b1('0x12')]=_0x15f530['dialGlobalMaxRetry'];this[_0xc1b1('0x13')]=_0x15f530['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x15f530[_0xc1b1('0x14')]||0x96;this['dialDropMaxRetry']=_0x15f530[_0xc1b1('0x15')]||0x3;this['dialDropRetryFrequency']=_0x15f530[_0xc1b1('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x15f530[_0xc1b1('0x17')]||0x3;this[_0xc1b1('0x18')]=_0x15f530[_0xc1b1('0x18')]||0x96;this[_0xc1b1('0x19')]=_0x15f530[_0xc1b1('0x19')]||0x3;this[_0xc1b1('0x1a')]=_0x15f530[_0xc1b1('0x1a')]||0x96;this[_0xc1b1('0x1b')]=_0x15f530['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x15f530[_0xc1b1('0x1c')]||0x96;this[_0xc1b1('0x1d')]=_0x15f530[_0xc1b1('0x1d')]||_0xc1b1('0x1e');this[_0xc1b1('0x1f')]=_0x15f530['dialPrefix']||undefined;this[_0xc1b1('0x20')]=_0x15f530[_0xc1b1('0x20')]||undefined;this['dialCutDigit']=_0x15f530[_0xc1b1('0x21')]||undefined;this['TrunkBackup']=_0x15f530['TrunkBackup']?_0x15f530[_0xc1b1('0x22')]:undefined;this[_0xc1b1('0x23')]=_0x15f530[_0xc1b1('0x23')]?_0x15f530[_0xc1b1('0x23')]:undefined;this[_0xc1b1('0x24')]=_0x15f530[_0xc1b1('0x24')]?_0x15f530[_0xc1b1('0x24')]:undefined;this[_0xc1b1('0x25')]=_0x15f530[_0xc1b1('0x25')]?_0x15f530[_0xc1b1('0x25')]:undefined;this['dialQueueProject']=_0x15f530['SquareProject']?_0x15f530['SquareProject']['name']:undefined;this['dialAMDActive']=_0x15f530[_0xc1b1('0x26')]||![];this['dialAMDInitialSilence']=_0x15f530[_0xc1b1('0x27')];this[_0xc1b1('0x28')]=_0x15f530[_0xc1b1('0x28')];this[_0xc1b1('0x29')]=_0x15f530[_0xc1b1('0x29')];this[_0xc1b1('0x2a')]=_0x15f530[_0xc1b1('0x2a')];this[_0xc1b1('0x2b')]=_0x15f530['dialAMDMinWordLength'];this[_0xc1b1('0x2c')]=_0x15f530[_0xc1b1('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x15f530[_0xc1b1('0x2d')];this['dialAMDSilenceThreshold']=_0x15f530[_0xc1b1('0x2e')];this[_0xc1b1('0x2f')]=_0x15f530[_0xc1b1('0x2f')];}module['exports']=Campaign; \ No newline at end of file +var _0xe7d0=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x58dc0a,_0x1e193f){var _0x4c88b5=function(_0x39f636){while(--_0x39f636){_0x58dc0a['push'](_0x58dc0a['shift']());}};_0x4c88b5(++_0x1e193f);}(_0xe7d0,0x78));var _0x0e7d=function(_0x579b74,_0x1331eb){_0x579b74=_0x579b74-0x0;var _0x1b5eee=_0xe7d0[_0x579b74];return _0x1b5eee;};'use strict';function Campaign(_0x1cfb7b){this['id']=_0x1cfb7b['id']||0x0;this[_0x0e7d('0x0')]=_0x1cfb7b['name']||'';this[_0x0e7d('0x1')]=_0x1cfb7b['type']||'campaign';this[_0x0e7d('0x2')]=0x0;this[_0x0e7d('0x3')]=0x0;this[_0x0e7d('0x4')]=0x0;this[_0x0e7d('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0e7d('0x6')]=_0x1cfb7b['active'];this[_0x0e7d('0x7')]=_0x1cfb7b[_0x0e7d('0x7')];this[_0x0e7d('0x8')]=_0x1cfb7b[_0x0e7d('0x8')]||null;this[_0x0e7d('0x9')]=_0x1cfb7b[_0x0e7d('0x9')]?_0x1cfb7b[_0x0e7d('0x9')]:null;this[_0x0e7d('0xa')]=_0x1cfb7b['dialOriginateCallerIdName'];this[_0x0e7d('0xb')]=_0x1cfb7b['dialOriginateCallerIdNumber'];this[_0x0e7d('0xc')]=_0x1cfb7b[_0x0e7d('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x1cfb7b['dialCongestionMaxRetry'];this[_0x0e7d('0xd')]=_0x1cfb7b[_0x0e7d('0xd')];this[_0x0e7d('0xe')]=_0x1cfb7b[_0x0e7d('0xe')];this['dialBusyRetryFrequency']=_0x1cfb7b['dialBusyRetryFrequency'];this[_0x0e7d('0xf')]=_0x1cfb7b['dialNoAnswerMaxRetry'];this[_0x0e7d('0x10')]=_0x1cfb7b[_0x0e7d('0x10')];this['dialGlobalMaxRetry']=_0x1cfb7b[_0x0e7d('0x11')];this['dialNoSuchNumberMaxRetry']=_0x1cfb7b['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1cfb7b[_0x0e7d('0x12')]||0x96;this['dialDropMaxRetry']=_0x1cfb7b[_0x0e7d('0x13')]||0x3;this[_0x0e7d('0x14')]=_0x1cfb7b['dialDropRetryFrequency']||0x96;this[_0x0e7d('0x15')]=_0x1cfb7b[_0x0e7d('0x15')]||0x3;this[_0x0e7d('0x16')]=_0x1cfb7b[_0x0e7d('0x16')]||0x96;this[_0x0e7d('0x17')]=_0x1cfb7b[_0x0e7d('0x17')]||0x3;this['dialMachineRetryFrequency']=_0x1cfb7b[_0x0e7d('0x18')]||0x96;this[_0x0e7d('0x19')]=_0x1cfb7b[_0x0e7d('0x19')]||0x3;this[_0x0e7d('0x1a')]=_0x1cfb7b[_0x0e7d('0x1a')]||0x96;this[_0x0e7d('0x1b')]=_0x1cfb7b[_0x0e7d('0x1b')]||_0x0e7d('0x1c');this[_0x0e7d('0x1d')]=_0x1cfb7b[_0x0e7d('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1cfb7b['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1cfb7b[_0x0e7d('0x1e')]||undefined;this['TrunkBackup']=_0x1cfb7b[_0x0e7d('0x1f')]?_0x1cfb7b[_0x0e7d('0x1f')]:undefined;this[_0x0e7d('0x20')]=_0x1cfb7b[_0x0e7d('0x20')]?_0x1cfb7b['Trunk']:undefined;this['Interval']=_0x1cfb7b[_0x0e7d('0x21')]?_0x1cfb7b[_0x0e7d('0x21')]:undefined;this[_0x0e7d('0x22')]=_0x1cfb7b[_0x0e7d('0x22')]?_0x1cfb7b[_0x0e7d('0x22')]:undefined;this[_0x0e7d('0x23')]=_0x1cfb7b[_0x0e7d('0x22')]?_0x1cfb7b[_0x0e7d('0x22')][_0x0e7d('0x0')]:undefined;this[_0x0e7d('0x24')]=_0x1cfb7b[_0x0e7d('0x24')]||![];this[_0x0e7d('0x25')]=_0x1cfb7b['dialAMDInitialSilence'];this[_0x0e7d('0x26')]=_0x1cfb7b[_0x0e7d('0x26')];this[_0x0e7d('0x27')]=_0x1cfb7b[_0x0e7d('0x27')];this[_0x0e7d('0x28')]=_0x1cfb7b['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x1cfb7b[_0x0e7d('0x29')];this[_0x0e7d('0x2a')]=_0x1cfb7b[_0x0e7d('0x2a')];this[_0x0e7d('0x2b')]=_0x1cfb7b['dialAMDMaximumNumberOfWords'];this[_0x0e7d('0x2c')]=_0x1cfb7b[_0x0e7d('0x2c')];this[_0x0e7d('0x2d')]=_0x1cfb7b[_0x0e7d('0x2d')];}module[_0x0e7d('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e18fd9f..0826ea0 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 _0xdec3=['uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','monitor','monitorFilename','monitors','transfercalleridnum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xdec3,0x89));var _0x3dec=function(_0x211af2,_0x1cc8ae){_0x211af2=_0x211af2-0x0;var _0x1bbe2f=_0xdec3[_0x211af2];return _0x1bbe2f;};'use strict';function Channel(){this[_0x3dec('0x0')]=null;this['channel']='';this[_0x3dec('0x1')]='';this[_0x3dec('0x2')]=0x0;this[_0x3dec('0x3')]='';this['connectedlinenum']=undefined;this[_0x3dec('0x4')]=undefined;this[_0x3dec('0x5')]=0x0;this[_0x3dec('0x6')]='';this[_0x3dec('0x7')]=0x0;this['linkedid']=0x0;this[_0x3dec('0x8')]=0x0;this[_0x3dec('0x9')]=![];this[_0x3dec('0xa')]=null;this[_0x3dec('0xb')]=null;this[_0x3dec('0xc')]=![];this[_0x3dec('0xd')]=![];this[_0x3dec('0xe')]='';this['lastdata']='';this[_0x3dec('0xf')]=0x0;this[_0x3dec('0x10')]=0x0;this['holdtime']=0x0;this[_0x3dec('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0x3dec('0x12')]=![];this[_0x3dec('0x13')]=null;this['queue']=null;this[_0x3dec('0x14')]=[];this[_0x3dec('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x3dec('0x16')]=0x0;}module[_0x3dec('0x17')]=Channel; \ No newline at end of file +var _0x7a02=['duration','holdtime','type','tag','disposition','monitorFilename','queue','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata'];(function(_0x22f5a9,_0x6e2508){var _0x5a8577=function(_0xa876bd){while(--_0xa876bd){_0x22f5a9['push'](_0x22f5a9['shift']());}};_0x5a8577(++_0x6e2508);}(_0x7a02,0x1ba));var _0x27a0=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7a02[_0x4e676e];return _0x336a3c;};'use strict';function Channel(){this['starttime']=null;this[_0x27a0('0x0')]='';this[_0x27a0('0x1')]='';this[_0x27a0('0x2')]=0x0;this[_0x27a0('0x3')]='';this[_0x27a0('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x27a0('0x5')]=0x0;this[_0x27a0('0x6')]='';this[_0x27a0('0x7')]=0x0;this[_0x27a0('0x8')]=0x0;this[_0x27a0('0x9')]=0x0;this[_0x27a0('0xa')]=![];this[_0x27a0('0xb')]=null;this[_0x27a0('0xc')]=null;this[_0x27a0('0xd')]=![];this[_0x27a0('0xe')]=![];this[_0x27a0('0xf')]='';this[_0x27a0('0x10')]='';this[_0x27a0('0x11')]=0x0;this['billableseconds']=0x0;this[_0x27a0('0x12')]=0x0;this[_0x27a0('0x13')]=null;this[_0x27a0('0x14')]=null;this[_0x27a0('0x15')]=null;this['monitor']=![];this[_0x27a0('0x16')]=null;this[_0x27a0('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x27a0('0x18')]=undefined;this[_0x27a0('0x19')]=0x0;}module[_0x27a0('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0a90264..0936fef 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 _0x6dc0=['name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6dc0,0x18c));var _0x06dc=function(_0x486867,_0x52a530){_0x486867=_0x486867-0x0;var _0x3d3c99=_0x6dc0[_0x486867];return _0x3d3c99;};'use strict';function DeskAccount(_0x18f656){this['id']=_0x18f656['id']||0x0;this['name']=_0x18f656[_0x06dc('0x0')]||'';this[_0x06dc('0x1')]=_0x18f656[_0x06dc('0x1')]||'';this[_0x06dc('0x2')]=_0x18f656[_0x06dc('0x2')]||'';this['authType']=_0x18f656['authType']||'';this[_0x06dc('0x3')]=_0x18f656[_0x06dc('0x3')]||'';this['consumerKey']=_0x18f656[_0x06dc('0x4')]||'';this[_0x06dc('0x5')]=_0x18f656['consumerSecret']||'';this[_0x06dc('0x6')]=_0x18f656['token']||'';this[_0x06dc('0x7')]=_0x18f656[_0x06dc('0x7')]||'';this[_0x06dc('0x8')]=_0x18f656[_0x06dc('0x8')]||'';this[_0x06dc('0x9')]=_0x18f656['serverUrl']||'';this[_0x06dc('0xa')]=_0x18f656['Configurations']||{};}module[_0x06dc('0xb')]=DeskAccount; \ No newline at end of file +var _0x2a3a=['consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','authType','password'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x1943bb,_0x5a09ff){_0x1943bb=_0x1943bb-0x0;var _0x488d64=_0x2a3a[_0x1943bb];return _0x488d64;};'use strict';function DeskAccount(_0x330d91){this['id']=_0x330d91['id']||0x0;this[_0xa2a3('0x0')]=_0x330d91[_0xa2a3('0x0')]||'';this[_0xa2a3('0x1')]=_0x330d91[_0xa2a3('0x1')]||'';this['remoteUri']=_0x330d91['remoteUri']||'';this[_0xa2a3('0x2')]=_0x330d91[_0xa2a3('0x2')]||'';this[_0xa2a3('0x3')]=_0x330d91[_0xa2a3('0x3')]||'';this[_0xa2a3('0x4')]=_0x330d91[_0xa2a3('0x4')]||'';this[_0xa2a3('0x5')]=_0x330d91['consumerSecret']||'';this[_0xa2a3('0x6')]=_0x330d91[_0xa2a3('0x6')]||'';this[_0xa2a3('0x7')]=_0x330d91['tokenSecret']||'';this['type']=_0x330d91['type']||'';this[_0xa2a3('0x8')]=_0x330d91[_0xa2a3('0x8')]||'';this[_0xa2a3('0x9')]=_0x330d91['Configurations']||{};}module[_0xa2a3('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f61fc48..0c22d90 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 _0x93b1=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x51931c,_0x14dea7){var _0x5f33ee=function(_0x3b5cab){while(--_0x3b5cab){_0x51931c['push'](_0x51931c['shift']());}};_0x5f33ee(++_0x14dea7);}(_0x93b1,0x1a2));var _0x193b=function(_0x56c4da,_0x25cd95){_0x56c4da=_0x56c4da-0x0;var _0x202427=_0x93b1[_0x56c4da];return _0x202427;};'use strict';function Dynamics365Account(_0x31336e){this['id']=_0x31336e['id']||0x0;this[_0x193b('0x0')]=_0x31336e['name']||'';this['username']=_0x31336e[_0x193b('0x1')]||'';this[_0x193b('0x2')]=_0x31336e[_0x193b('0x2')]||'';this[_0x193b('0x3')]=_0x31336e[_0x193b('0x3')]||'';this[_0x193b('0x4')]=_0x31336e[_0x193b('0x4')]||'';this[_0x193b('0x5')]=_0x31336e[_0x193b('0x5')]||'';this[_0x193b('0x6')]=_0x31336e['clientSecret']||{};this[_0x193b('0x7')]=_0x31336e['serverUrl']||'';this[_0x193b('0x8')]=_0x31336e[_0x193b('0x8')]||{};}module[_0x193b('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x0bc1=['remoteUri','clientId','serverUrl','Configurations','name','username','password'];(function(_0x5badc8,_0x34c456){var _0x5ab89a=function(_0x2e3f42){while(--_0x2e3f42){_0x5badc8['push'](_0x5badc8['shift']());}};_0x5ab89a(++_0x34c456);}(_0x0bc1,0xd6));var _0x10bc=function(_0x286229,_0x5d09b1){_0x286229=_0x286229-0x0;var _0x44a211=_0x0bc1[_0x286229];return _0x44a211;};'use strict';function Dynamics365Account(_0x30edd2){this['id']=_0x30edd2['id']||0x0;this[_0x10bc('0x0')]=_0x30edd2[_0x10bc('0x0')]||'';this[_0x10bc('0x1')]=_0x30edd2[_0x10bc('0x1')]||'';this[_0x10bc('0x2')]=_0x30edd2[_0x10bc('0x2')]||'';this[_0x10bc('0x3')]=_0x30edd2[_0x10bc('0x3')]||'';this['tenantId']=_0x30edd2['tenantId']||'';this[_0x10bc('0x4')]=_0x30edd2[_0x10bc('0x4')]||'';this['clientSecret']=_0x30edd2['clientSecret']||{};this[_0x10bc('0x5')]=_0x30edd2[_0x10bc('0x5')]||'';this[_0x10bc('0x6')]=_0x30edd2['Configurations']||{};}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 9ca1f32..bdeb8d8 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 _0xe451=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x21d3fb,_0x435f31){var _0x4efebb=function(_0x6c766b){while(--_0x6c766b){_0x21d3fb['push'](_0x21d3fb['shift']());}};_0x4efebb(++_0x435f31);}(_0xe451,0x12c));var _0x1e45=function(_0x1dcf37,_0x150062){_0x1dcf37=_0x1dcf37-0x0;var _0x4323ea=_0xe451[_0x1dcf37];return _0x4323ea;};'use strict';function FaxAccount(_0x43d386){this['id']=_0x43d386['id']||0x0;this[_0x1e45('0x0')]=_0x43d386[_0x1e45('0x0')]||'';this[_0x1e45('0x1')]=_0x43d386[_0x1e45('0x1')];this[_0x1e45('0x2')]=_0x43d386[_0x1e45('0x2')];this[_0x1e45('0x3')]=_0x43d386['headerinfo'];this[_0x1e45('0x4')]=_0x43d386[_0x1e45('0x4')];this[_0x1e45('0x5')]=_0x43d386[_0x1e45('0x5')]||0x960;this[_0x1e45('0x6')]=_0x43d386['maxrate']||0x3840;this[_0x1e45('0x7')]=_0x43d386[_0x1e45('0x7')]||'v17,v27,v29';this[_0x1e45('0x8')]=_0x43d386[_0x1e45('0x8')]||'no';this['faxdetect']=_0x43d386[_0x1e45('0x9')]||'no';this[_0x1e45('0xa')]=_0x43d386[_0x1e45('0xa')]||0x1388;this[_0x1e45('0xb')]=_0x43d386[_0x1e45('0xb')]||'SIP';this[_0x1e45('0xc')]=_0x43d386['Trunk']?_0x43d386['Trunk']:undefined;this[_0x1e45('0xd')]=_0x43d386[_0x1e45('0xd')];this[_0x1e45('0xe')]=_0x43d386['key'];}module[_0x1e45('0xf')]=FaxAccount; \ No newline at end of file +var _0x351b=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x31a35a,_0x1bb748){var _0x5046de=function(_0x5bdeef){while(--_0x5bdeef){_0x31a35a['push'](_0x31a35a['shift']());}};_0x5046de(++_0x1bb748);}(_0x351b,0xcf));var _0xb351=function(_0x318b8d,_0x13a638){_0x318b8d=_0x318b8d-0x0;var _0x974e6d=_0x351b[_0x318b8d];return _0x974e6d;};'use strict';function FaxAccount(_0x47ea25){this['id']=_0x47ea25['id']||0x0;this[_0xb351('0x0')]=_0x47ea25['name']||'';this[_0xb351('0x1')]=_0x47ea25[_0xb351('0x1')];this[_0xb351('0x2')]=_0x47ea25[_0xb351('0x2')];this['headerinfo']=_0x47ea25[_0xb351('0x3')];this[_0xb351('0x4')]=_0x47ea25['localstationid'];this[_0xb351('0x5')]=_0x47ea25[_0xb351('0x5')]||0x960;this[_0xb351('0x6')]=_0x47ea25[_0xb351('0x6')]||0x3840;this[_0xb351('0x7')]=_0x47ea25[_0xb351('0x7')]||_0xb351('0x8');this[_0xb351('0x9')]=_0x47ea25[_0xb351('0x9')]||'no';this[_0xb351('0xa')]=_0x47ea25[_0xb351('0xa')]||'no';this[_0xb351('0xb')]=_0x47ea25[_0xb351('0xb')]||0x1388;this[_0xb351('0xc')]=_0x47ea25[_0xb351('0xc')]||_0xb351('0xd');this[_0xb351('0xe')]=_0x47ea25[_0xb351('0xe')]?_0x47ea25['Trunk']:undefined;this['ListId']=_0x47ea25[_0xb351('0xf')];this[_0xb351('0x10')]=_0x47ea25['key'];}module[_0xb351('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index a4750d5..f342c3e 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 _0x2d84=['token','remoteUri','serverUrl','Configurations','exports','username','apiKey'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2d84,0x7c));var _0x42d8=function(_0x48c115,_0x24f3c5){_0x48c115=_0x48c115-0x0;var _0x3fc864=_0x2d84[_0x48c115];return _0x3fc864;};'use strict';function FreshdeskAccount(_0x532d65){this['id']=_0x532d65['id']||0x0;this['name']=_0x532d65['name']||'';this[_0x42d8('0x0')]=_0x532d65['username']||'';this[_0x42d8('0x1')]=_0x532d65[_0x42d8('0x2')]||'';this[_0x42d8('0x3')]=_0x532d65[_0x42d8('0x3')]||'';this[_0x42d8('0x4')]=_0x532d65[_0x42d8('0x4')]||'';this[_0x42d8('0x5')]=_0x532d65[_0x42d8('0x5')]||{};}module[_0x42d8('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xc346=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x5c0b22,_0x56d46a){var _0x16a8a6=function(_0x268ef6){while(--_0x268ef6){_0x5c0b22['push'](_0x5c0b22['shift']());}};_0x16a8a6(++_0x56d46a);}(_0xc346,0x131));var _0x6c34=function(_0x3d7382,_0x5d5b62){_0x3d7382=_0x3d7382-0x0;var _0x5bc07c=_0xc346[_0x3d7382];return _0x5bc07c;};'use strict';function FreshdeskAccount(_0x2e5274){this['id']=_0x2e5274['id']||0x0;this[_0x6c34('0x0')]=_0x2e5274[_0x6c34('0x0')]||'';this[_0x6c34('0x1')]=_0x2e5274[_0x6c34('0x1')]||'';this['apiKey']=_0x2e5274[_0x6c34('0x2')]||'';this['remoteUri']=_0x2e5274[_0x6c34('0x3')]||'';this[_0x6c34('0x4')]=_0x2e5274[_0x6c34('0x4')]||'';this[_0x6c34('0x5')]=_0x2e5274[_0x6c34('0x5')]||{};}module[_0x6c34('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 165560a..1b66488 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 _0x9fdc=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0xc5ab36,_0x4bc984){var _0x2a2a89=function(_0x242724){while(--_0x242724){_0xc5ab36['push'](_0xc5ab36['shift']());}};_0x2a2a89(++_0x4bc984);}(_0x9fdc,0x112));var _0xc9fd=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x9fdc[_0x2f62aa];return _0x1a341f;};'use strict';function FreshsalesAccount(_0x4a6712){this['id']=_0x4a6712['id']||0x0;this['name']=_0x4a6712[_0xc9fd('0x0')]||'';this[_0xc9fd('0x1')]=_0x4a6712['username']||'';this[_0xc9fd('0x2')]=_0x4a6712[_0xc9fd('0x3')]||'';this['remoteUri']=_0x4a6712[_0xc9fd('0x4')]||'';this['serverUrl']=_0x4a6712[_0xc9fd('0x5')]||'';this[_0xc9fd('0x6')]=_0x4a6712[_0xc9fd('0x6')]||{};}module[_0xc9fd('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x054f=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x054f,0x181));var _0xf054=function(_0x424049,_0x659d37){_0x424049=_0x424049-0x0;var _0x4ebc1c=_0x054f[_0x424049];return _0x4ebc1c;};'use strict';function FreshsalesAccount(_0x1bd4cf){this['id']=_0x1bd4cf['id']||0x0;this[_0xf054('0x0')]=_0x1bd4cf['name']||'';this['username']=_0x1bd4cf[_0xf054('0x1')]||'';this[_0xf054('0x2')]=_0x1bd4cf[_0xf054('0x3')]||'';this[_0xf054('0x4')]=_0x1bd4cf[_0xf054('0x4')]||'';this['serverUrl']=_0x1bd4cf[_0xf054('0x5')]||'';this[_0xf054('0x6')]=_0x1bd4cf[_0xf054('0x6')]||{};}module[_0xf054('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 7b21860..71f94b8 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 _0x0f3d=['holdtime','exports','type','uniqueid','calleridnum','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority'];(function(_0x504f7c,_0x48de8a){var _0x3b634a=function(_0x4e2479){while(--_0x4e2479){_0x504f7c['push'](_0x504f7c['shift']());}};_0x3b634a(++_0x48de8a);}(_0x0f3d,0xb2));var _0xd0f3=function(_0xdc912b,_0x31a93b){_0xdc912b=_0xdc912b-0x0;var _0x503e19=_0x0f3d[_0xdc912b];return _0x503e19;};'use strict';function QueueReport(){this[_0xd0f3('0x0')]='inbound';this[_0xd0f3('0x1')]='';this[_0xd0f3('0x2')]='';this['calleridname']='';this['queue']='';this[_0xd0f3('0x3')]=null;this['queuecallerleaveAt']=null;this[_0xd0f3('0x4')]=0x1;this[_0xd0f3('0x5')]=0x1;this[_0xd0f3('0x6')]=![];this[_0xd0f3('0x7')]=null;this[_0xd0f3('0x8')]=![];this[_0xd0f3('0x9')]=null;this[_0xd0f3('0xa')]=![];this[_0xd0f3('0xb')]=null;this[_0xd0f3('0xc')]=0x1;this[_0xd0f3('0xd')]='';this[_0xd0f3('0xe')]='';this[_0xd0f3('0xf')]='';this[_0xd0f3('0x10')]='';this[_0xd0f3('0x11')]='';this[_0xd0f3('0x12')]='';this[_0xd0f3('0x13')]='';this[_0xd0f3('0x14')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['mohtime']=0x0;this['variables']={};}module[_0xd0f3('0x15')]=QueueReport; \ No newline at end of file +var _0xdc6f=['queuecallerjoinAt','queuecallerleaveAt','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','accountcode','context','exten','priority','holdtime','assigned','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue'];(function(_0x5d7b38,_0xa9b657){var _0x4fca1d=function(_0x5504bc){while(--_0x5504bc){_0x5d7b38['push'](_0x5d7b38['shift']());}};_0x4fca1d(++_0xa9b657);}(_0xdc6f,0x15f));var _0xfdc6=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0xdc6f[_0x58803c];return _0xf95b9b;};'use strict';function QueueReport(){this[_0xfdc6('0x0')]=_0xfdc6('0x1');this[_0xfdc6('0x2')]='';this[_0xfdc6('0x3')]='';this[_0xfdc6('0x4')]='';this[_0xfdc6('0x5')]='';this[_0xfdc6('0x6')]=null;this[_0xfdc6('0x7')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xfdc6('0x8')]=null;this[_0xfdc6('0x9')]=![];this[_0xfdc6('0xa')]=null;this[_0xfdc6('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xfdc6('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xfdc6('0xd')]='';this[_0xfdc6('0xe')]='';this[_0xfdc6('0xf')]='';this[_0xfdc6('0x10')]='';this[_0xfdc6('0x11')]=0x0;this[_0xfdc6('0x12')]=![];this['lastAssignedTo']='';this[_0xfdc6('0x13')]=0x0;this[_0xfdc6('0x14')]={};}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 4855b9f..04739e1 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 _0x6b89=['password','clientId','clientSecret','securityToken','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6b89,0xce));var _0x96b8=function(_0x156818,_0xbf0fb){_0x156818=_0x156818-0x0;var _0x102234=_0x6b89[_0x156818];return _0x102234;};'use strict';function SalesforceAccount(_0x52d30b){this['id']=_0x52d30b['id']||0x0;this[_0x96b8('0x0')]=_0x52d30b[_0x96b8('0x0')]||'';this['username']=_0x52d30b[_0x96b8('0x1')]||'';this[_0x96b8('0x2')]=_0x52d30b[_0x96b8('0x2')]||'';this[_0x96b8('0x3')]=_0x52d30b[_0x96b8('0x3')]||'';this[_0x96b8('0x4')]=_0x52d30b[_0x96b8('0x4')]||'';this[_0x96b8('0x5')]=_0x52d30b['clientSecret']||'';this[_0x96b8('0x6')]=_0x52d30b[_0x96b8('0x6')]||'';this['type']=_0x52d30b['type']||_0x96b8('0x7');this[_0x96b8('0x8')]=_0x52d30b['serverUrl']||'';this[_0x96b8('0x9')]=_0x52d30b['Configurations']||{};}module[_0x96b8('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xa84c=['serverUrl','Configurations','name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xa84c,0x156));var _0xca84=function(_0x470137,_0x41829f){_0x470137=_0x470137-0x0;var _0x3737e0=_0xa84c[_0x470137];return _0x3737e0;};'use strict';function SalesforceAccount(_0x137552){this['id']=_0x137552['id']||0x0;this['name']=_0x137552[_0xca84('0x0')]||'';this[_0xca84('0x1')]=_0x137552['username']||'';this[_0xca84('0x2')]=_0x137552['remoteUri']||'';this['password']=_0x137552['password']||'';this[_0xca84('0x3')]=_0x137552['clientId']||'';this[_0xca84('0x4')]=_0x137552[_0xca84('0x4')]||'';this['securityToken']=_0x137552[_0xca84('0x5')]||'';this[_0xca84('0x6')]=_0x137552['type']||_0xca84('0x7');this[_0xca84('0x8')]=_0x137552['serverUrl']||'';this['Configurations']=_0x137552[_0xca84('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ace8218..736deed 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 _0xe2d3=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x302a0b,_0x59628e){var _0x30805c=function(_0x50f416){while(--_0x50f416){_0x302a0b['push'](_0x302a0b['shift']());}};_0x30805c(++_0x59628e);}(_0xe2d3,0x1eb));var _0x3e2d=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xe2d3[_0x3005d5];return _0x547c7e;};'use strict';function ServicenowAccount(_0x7b3b37){this['id']=_0x7b3b37['id']||0x0;this[_0x3e2d('0x0')]=_0x7b3b37['name']||'';this[_0x3e2d('0x1')]=_0x7b3b37['username']||'';this[_0x3e2d('0x2')]=_0x7b3b37['password']||'';this[_0x3e2d('0x3')]=_0x7b3b37[_0x3e2d('0x3')]||'';this['serverUrl']=_0x7b3b37[_0x3e2d('0x4')]||'';this['Configurations']=_0x7b3b37[_0x3e2d('0x5')]||{};}module[_0x3e2d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8b55=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x8b55,0x154));var _0x58b5=function(_0x8998d0,_0x3e2894){_0x8998d0=_0x8998d0-0x0;var _0x567477=_0x8b55[_0x8998d0];return _0x567477;};'use strict';function ServicenowAccount(_0x4bda83){this['id']=_0x4bda83['id']||0x0;this[_0x58b5('0x0')]=_0x4bda83[_0x58b5('0x0')]||'';this[_0x58b5('0x1')]=_0x4bda83['username']||'';this[_0x58b5('0x2')]=_0x4bda83[_0x58b5('0x2')]||'';this['remoteUri']=_0x4bda83[_0x58b5('0x3')]||'';this['serverUrl']=_0x4bda83[_0x58b5('0x4')]||'';this[_0x58b5('0x5')]=_0x4bda83[_0x58b5('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3e03769..409c01e 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 _0x4850=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x17c27e,_0x25483a){var _0x167fe2=function(_0xea2366){while(--_0xea2366){_0x17c27e['push'](_0x17c27e['shift']());}};_0x167fe2(++_0x25483a);}(_0x4850,0x12f));var _0x0485=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4850[_0x2641f9];return _0x585741;};'use strict';function SugarcrmAccount(_0x40a884){this['id']=_0x40a884['id']||0x0;this[_0x0485('0x0')]=_0x40a884[_0x0485('0x0')]||'';this[_0x0485('0x1')]=_0x40a884[_0x0485('0x1')]||'';this[_0x0485('0x2')]=_0x40a884[_0x0485('0x2')]||'';this[_0x0485('0x3')]=_0x40a884[_0x0485('0x3')]||'';this['serverUrl']=_0x40a884[_0x0485('0x4')]||'';this['Configurations']=_0x40a884['Configurations']||{};}module[_0x0485('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x50c2=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x57e812,_0x42b81b){var _0x48925c=function(_0x389cf7){while(--_0x389cf7){_0x57e812['push'](_0x57e812['shift']());}};_0x48925c(++_0x42b81b);}(_0x50c2,0xb7));var _0x250c=function(_0x304862,_0x232048){_0x304862=_0x304862-0x0;var _0x3d339c=_0x50c2[_0x304862];return _0x3d339c;};'use strict';function SugarcrmAccount(_0x27f316){this['id']=_0x27f316['id']||0x0;this[_0x250c('0x0')]=_0x27f316[_0x250c('0x0')]||'';this[_0x250c('0x1')]=_0x27f316['username']||'';this[_0x250c('0x2')]=_0x27f316['password']||'';this[_0x250c('0x3')]=_0x27f316[_0x250c('0x3')]||'';this[_0x250c('0x4')]=_0x27f316[_0x250c('0x4')]||'';this[_0x250c('0x5')]=_0x27f316[_0x250c('0x5')]||{};}module[_0x250c('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 30a9496..107f8e4 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 _0x2379=['state','stateTime','status','unknown','address','name','accountcode'];(function(_0x5a0543,_0x5b13e8){var _0x412b22=function(_0x524458){while(--_0x524458){_0x5a0543['push'](_0x5a0543['shift']());}};_0x412b22(++_0x5b13e8);}(_0x2379,0xf3));var _0x9237=function(_0x45a22c,_0x287d04){_0x45a22c=_0x45a22c-0x0;var _0x395356=_0x2379[_0x45a22c];return _0x395356;};'use strict';function Telephone(_0x212412){this['id']=_0x212412['id']||0x0;this[_0x9237('0x0')]=_0x212412[_0x9237('0x0')]||'';this[_0x9237('0x1')]=_0x212412[_0x9237('0x1')]||'';this[_0x9237('0x2')]='unknown';this[_0x9237('0x3')]=0x0;this[_0x9237('0x4')]=_0x9237('0x5');this[_0x9237('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x561d=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x561d,0x18b));var _0xd561=function(_0x5c1806,_0x587637){_0x5c1806=_0x5c1806-0x0;var _0x10d84c=_0x561d[_0x5c1806];return _0x10d84c;};'use strict';function Telephone(_0x3afb3b){this['id']=_0x3afb3b['id']||0x0;this[_0xd561('0x0')]=_0x3afb3b[_0xd561('0x0')]||'';this['accountcode']=_0x3afb3b[_0xd561('0x1')]||'';this[_0xd561('0x2')]=_0xd561('0x3');this[_0xd561('0x4')]=0x0;this[_0xd561('0x5')]=_0xd561('0x3');this['address']='';}module[_0xd561('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 4a6bb9f..80bcc18 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 _0x9b0f=['html','name'];(function(_0x1fbefb,_0x185587){var _0x1b3188=function(_0x1867b6){while(--_0x1867b6){_0x1fbefb['push'](_0x1fbefb['shift']());}};_0x1b3188(++_0x185587);}(_0x9b0f,0x167));var _0xf9b0=function(_0x349f69,_0x2138e5){_0x349f69=_0x349f69-0x0;var _0x174511=_0x9b0f[_0x349f69];return _0x174511;};'use strict';function template(_0x1dc7a0){this['id']=_0x1dc7a0['id']||0x0;this['name']=_0x1dc7a0[_0xf9b0('0x0')]||'';this[_0xf9b0('0x1')]=_0x1dc7a0[_0xf9b0('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xe484=['exports','name','html'];(function(_0x3a5f74,_0x8b2de8){var _0x488507=function(_0x51eeb8){while(--_0x51eeb8){_0x3a5f74['push'](_0x3a5f74['shift']());}};_0x488507(++_0x8b2de8);}(_0xe484,0x118));var _0x4e48=function(_0x26da0a,_0x578b3e){_0x26da0a=_0x26da0a-0x0;var _0x4e4b3f=_0xe484[_0x26da0a];return _0x4e4b3f;};'use strict';function template(_0x28ecb4){this['id']=_0x28ecb4['id']||0x0;this[_0x4e48('0x0')]=_0x28ecb4[_0x4e48('0x0')]||'';this[_0x4e48('0x1')]=_0x28ecb4[_0x4e48('0x1')]||'';}module[_0x4e48('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 08b3233..3380b69 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x2d4fc0,_0x540ac2){var _0x2e1fb4=function(_0xfdf24){while(--_0xfdf24){_0x2d4fc0['push'](_0x2d4fc0['shift']());}};_0x2e1fb4(++_0x540ac2);}(_0x3e74,0x175));var _0x43e7=function(_0x4f52ef,_0x21662e){_0x4f52ef=_0x4f52ef-0x0;var _0x3f82f6=_0x3e74[_0x4f52ef];return _0x3f82f6;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x1cdcab,_0x17a516){var _0x4393d0=function(_0x53b841){while(--_0x53b841){_0x1cdcab['push'](_0x1cdcab['shift']());}};_0x4393d0(++_0x17a516);}(_0x34e8,0x12c));var _0x834e=function(_0x3d41bc,_0x217d24){_0x3d41bc=_0x3d41bc-0x0;var _0x2539d5=_0x34e8[_0x3d41bc];return _0x2539d5;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 888f21e..2952252 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 _0x08ee=['active','name','state','unknown','stateTime','status','registry','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x08ee,0x168));var _0xe08e=function(_0x5ba705,_0x55fef3){_0x5ba705=_0x5ba705-0x0;var _0x567b3d=_0x08ee[_0x5ba705];return _0x567b3d;};'use strict';function Trunk(_0x1f230e){this['id']=_0x1f230e['id']||0x0;this['active']=_0x1f230e[_0xe08e('0x0')]||![];this['name']=_0x1f230e[_0xe08e('0x1')]||'';this[_0xe08e('0x2')]=_0xe08e('0x3');this[_0xe08e('0x4')]=0x0;this[_0xe08e('0x5')]=_0xe08e('0x3');this[_0xe08e('0x6')]=_0x1f230e['registry']&&_0x1f230e[_0xe08e('0x6')]['indexOf'](':')?_0x1f230e[_0xe08e('0x6')]['split'](':')[0x0]:'';this[_0xe08e('0x7')]='';this[_0xe08e('0x8')]='';this[_0xe08e('0x9')]='';this[_0xe08e('0xa')]='';this[_0xe08e('0xb')]='';this[_0xe08e('0xc')]='unknown';this[_0xe08e('0xd')]='';this[_0xe08e('0xe')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xca66=['stateRegistry','registrationtime','address','exports','name','state','stateTime','unknown','registry','indexOf','split','host','port','domainport','refresh'];(function(_0x497881,_0x58f248){var _0x1cc3b4=function(_0x1f6c64){while(--_0x1f6c64){_0x497881['push'](_0x497881['shift']());}};_0x1cc3b4(++_0x58f248);}(_0xca66,0x8b));var _0x6ca6=function(_0x12fda7,_0x3712cb){_0x12fda7=_0x12fda7-0x0;var _0x3895e8=_0xca66[_0x12fda7];return _0x3895e8;};'use strict';function Trunk(_0x340985){this['id']=_0x340985['id']||0x0;this['active']=_0x340985['active']||![];this[_0x6ca6('0x0')]=_0x340985[_0x6ca6('0x0')]||'';this[_0x6ca6('0x1')]='unknown';this[_0x6ca6('0x2')]=0x0;this['status']=_0x6ca6('0x3');this['registry']=_0x340985[_0x6ca6('0x4')]&&_0x340985[_0x6ca6('0x4')][_0x6ca6('0x5')](':')?_0x340985[_0x6ca6('0x4')][_0x6ca6('0x6')](':')[0x0]:'';this[_0x6ca6('0x7')]='';this[_0x6ca6('0x8')]='';this['domain']='';this[_0x6ca6('0x9')]='';this[_0x6ca6('0xa')]='';this[_0x6ca6('0xb')]=_0x6ca6('0x3');this[_0x6ca6('0xc')]='';this[_0x6ca6('0xd')]='';}module[_0x6ca6('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f7232a7..a7bc154 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 _0x00fb=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x1b0022,_0x451097){var _0x14925f=function(_0x307a4c){while(--_0x307a4c){_0x1b0022['push'](_0x1b0022['shift']());}};_0x14925f(++_0x451097);}(_0x00fb,0xed));var _0xb00f=function(_0xe336e0,_0x18f796){_0xe336e0=_0xe336e0-0x0;var _0x19d2c6=_0x00fb[_0xe336e0];return _0x19d2c6;};'use strict';function voiceExtension(_0x28ce4f){this['id']=_0x28ce4f['id']||0x0;this[_0xb00f('0x0')]=_0x28ce4f[_0xb00f('0x0')]||'';this[_0xb00f('0x1')]=_0x28ce4f[_0xb00f('0x1')]||'none';this[_0xb00f('0x2')]=_0x28ce4f[_0xb00f('0x2')]||![];}module[_0xb00f('0x3')]=voiceExtension; \ No newline at end of file +var _0xab98=['exports','recordingFormat','none'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xab98,0x160));var _0x8ab9=function(_0x539c64,_0xd92e34){_0x539c64=_0x539c64-0x0;var _0x1afe77=_0xab98[_0x539c64];return _0x1afe77;};'use strict';function voiceExtension(_0x319790){this['id']=_0x319790['id']||0x0;this['exten']=_0x319790['exten']||'';this[_0x8ab9('0x0')]=_0x319790[_0x8ab9('0x0')]||_0x8ab9('0x1');this['mandatoryDisposition']=_0x319790['mandatoryDisposition']||![];}module[_0x8ab9('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 7d30a65..6165d7a 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 _0x8ed6=['strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','invalid','ringing','ringinuse','onhold','wav','rrmemory','roundrobin','name','monitor_format','waiting','talking','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x8ed6,0x116));var _0x68ed=function(_0x133c71,_0x4e6cb3){_0x133c71=_0x133c71-0x0;var _0x1387d8=_0x8ed6[_0x133c71];return _0x1387d8;};'use strict';var statusDesc=['unknown','not_inuse','inuse','busy',_0x68ed('0x0'),'unavailable',_0x68ed('0x1'),_0x68ed('0x2'),_0x68ed('0x3')];var monitorFormat={'wav':_0x68ed('0x4'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x68ed('0x5'),'roundrobin':_0x68ed('0x6')};function VoiceQueue(_0x59e600){this['id']=_0x59e600['id']||0x0;this[_0x68ed('0x7')]=_0x59e600[_0x68ed('0x7')]||'';this[_0x68ed('0x8')]=_0x59e600[_0x68ed('0x8')]||'';this['type']=_0x59e600['type']||'inbound';this[_0x68ed('0x9')]=0x0;this[_0x68ed('0xa')]=0x0;this['total']=0x0;this[_0x68ed('0xb')]=0x0;this[_0x68ed('0xc')]=0x0;this['sumHoldTime']=0x0;this[_0x68ed('0xd')]=0x0;this[_0x68ed('0xe')]=0x0;this[_0x68ed('0xf')]=0x0;this[_0x68ed('0x10')]=0x0;this[_0x68ed('0x11')]=0x0;this['acw']=_0x59e600[_0x68ed('0x12')]||![];this[_0x68ed('0x13')]=_0x59e600[_0x68ed('0x13')]||0xa;this[_0x68ed('0x14')]=_0x59e600[_0x68ed('0x14')]||'no';this['sendMessageOneNotActive']=!![];this[_0x68ed('0x15')]='';this[_0x68ed('0x16')]=0x0;this[_0x68ed('0x17')]=0x0;this[_0x68ed('0x18')]=_0x59e600['dialTimezone']||null;this[_0x68ed('0x19')]=_0x59e600[_0x68ed('0x19')]?_0x59e600[_0x68ed('0x19')]:null;this['dialActive']=_0x59e600[_0x68ed('0x1a')];this[_0x68ed('0x1b')]=_0x59e600[_0x68ed('0x1b')]||'progressive';this['dialLimitChannel']=_0x59e600[_0x68ed('0x1c')]||0x0;this[_0x68ed('0x1d')]=_0x59e600[_0x68ed('0x1d')]||0x0;this[_0x68ed('0x1e')]=_0x59e600[_0x68ed('0x1e')]||0x1;this[_0x68ed('0x1f')]=_0x59e600[_0x68ed('0x1f')]||_0x68ed('0x20');this[_0x68ed('0x21')]=_0x59e600[_0x68ed('0x21')]||0.03;this[_0x68ed('0x22')]=_0x59e600[_0x68ed('0x22')]||0x258;this[_0x68ed('0x23')]=_0x59e600[_0x68ed('0x23')]||'anonymous';this[_0x68ed('0x24')]=_0x59e600[_0x68ed('0x24')]||'anonymous';this['dialOriginateTimeout']=_0x59e600[_0x68ed('0x25')]||0x1e;this['dialQueueOptions']=_0x59e600['dialQueueOptions']||_0x68ed('0x26');this[_0x68ed('0x27')]=_0x59e600['dialQueueTimeout']||0x3;this[_0x68ed('0x28')]=_0x59e600[_0x68ed('0x28')]||undefined;this[_0x68ed('0x29')]=_0x59e600[_0x68ed('0x29')]||0x3;this[_0x68ed('0x2a')]=_0x59e600[_0x68ed('0x2a')]||0x96;this[_0x68ed('0x2b')]=_0x59e600[_0x68ed('0x2b')]||0x3;this['dialBusyRetryFrequency']=_0x59e600[_0x68ed('0x2c')]||0x96;this['dialNoAnswerMaxRetry']=_0x59e600[_0x68ed('0x2d')]||0x3;this[_0x68ed('0x2e')]=_0x59e600[_0x68ed('0x2e')]||0x96;this[_0x68ed('0x2f')]=_0x59e600[_0x68ed('0x2f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x59e600[_0x68ed('0x30')]||0x96;this['dialDropMaxRetry']=_0x59e600['dialDropMaxRetry']||0x3;this[_0x68ed('0x31')]=_0x59e600[_0x68ed('0x31')]||0x96;this[_0x68ed('0x32')]=_0x59e600[_0x68ed('0x32')]||0x3;this[_0x68ed('0x33')]=_0x59e600[_0x68ed('0x33')]||0x96;this['dialMachineMaxRetry']=_0x59e600[_0x68ed('0x34')]||0x3;this[_0x68ed('0x35')]=_0x59e600[_0x68ed('0x35')]||0x96;this[_0x68ed('0x36')]=_0x59e600[_0x68ed('0x36')]||0x3;this[_0x68ed('0x37')]=_0x59e600[_0x68ed('0x37')]||0x96;this['dialGlobalMaxRetry']=_0x59e600[_0x68ed('0x38')]||0x4;this['Trunk']=_0x59e600[_0x68ed('0x39')]?_0x59e600[_0x68ed('0x39')]:undefined;this[_0x68ed('0x3a')]=_0x59e600['TrunkBackup']?_0x59e600[_0x68ed('0x3a')]:undefined;this[_0x68ed('0x3b')]=_0x59e600[_0x68ed('0x3b')]||undefined;this[_0x68ed('0x3c')]=_0x59e600[_0x68ed('0x3c')]?_0x59e600['Interval']:undefined;this[_0x68ed('0x3d')]=_0x59e600[_0x68ed('0x3d')]||'DESC';this[_0x68ed('0x3e')]=_0x59e600[_0x68ed('0x3e')]||undefined;this[_0x68ed('0x3f')]=_0x59e600[_0x68ed('0x3f')]||undefined;this['strategy']=strategy[_0x59e600[_0x68ed('0x40')]]||'rrmemory';this[_0x68ed('0x41')]=!![];this[_0x68ed('0x42')]=_0x59e600[_0x68ed('0x42')]||![];this['dialAMDInitialSilence']=_0x59e600['dialAMDInitialSilence'];this[_0x68ed('0x43')]=_0x59e600[_0x68ed('0x43')];this[_0x68ed('0x44')]=_0x59e600['dialAMDAfterGreetingSilence'];this[_0x68ed('0x45')]=_0x59e600['dialAMDTotalAnalysisTime'];this[_0x68ed('0x46')]=_0x59e600[_0x68ed('0x46')];this[_0x68ed('0x47')]=_0x59e600['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x59e600[_0x68ed('0x48')];this[_0x68ed('0x49')]=_0x59e600['dialAMDSilenceThreshold'];this[_0x68ed('0x4a')]=_0x59e600['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x68ed('0x4b')]=0x0;this[_0x68ed('0x4c')]=_0x59e600[_0x68ed('0x4c')];this[_0x68ed('0x4d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x68ed('0x4e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x68ed('0x4f')]=0x0;this[_0x68ed('0x50')]=0x0;this[_0x68ed('0x51')]=0x0;this[_0x68ed('0x52')]=0x0;this[_0x68ed('0x53')]=0x0;this[_0x68ed('0x54')]=0x0;this[_0x68ed('0x55')]=0x0;this[_0x68ed('0x56')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x68ed('0x57')]=undefined;this[_0x68ed('0x58')]=undefined;this[_0x68ed('0x59')]=undefined;this[_0x68ed('0x5a')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x68ed('0x5b')]=0x0;this[_0x68ed('0x5c')]=0x0;this[_0x68ed('0x5d')]=0x0;this[_0x68ed('0x5e')]=0x0;this[_0x68ed('0x5f')]=0x0;this[_0x68ed('0x60')]=0x0;this[_0x68ed('0x61')]=_0x59e600['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x59e600[_0x68ed('0x62')]||0xa;this[_0x68ed('0x63')]=0x0;this[_0x68ed('0x64')]=0x0;this[_0x68ed('0x65')]=0x1;this[_0x68ed('0x66')]=0x0;this[_0x68ed('0x67')]=0x0;this[_0x68ed('0x68')]=0x0;this[_0x68ed('0x69')]=0x0;this[_0x68ed('0x6a')]=_0x59e600[_0x68ed('0x6a')]||0x1e;this[_0x68ed('0x6b')]=_0x59e600[_0x68ed('0x6b')]||![];this[_0x68ed('0x6c')]=_0x59e600[_0x68ed('0x6c')]||undefined;this['dialAgiAfterHangupClient']=_0x59e600[_0x68ed('0x6d')]||![];this[_0x68ed('0x6e')]=_0x59e600[_0x68ed('0x6e')]||![];this[_0x68ed('0x8')]=monitorFormat[_0x59e600[_0x68ed('0x8')]]?monitorFormat[_0x59e600[_0x68ed('0x8')]]:undefined;this[_0x68ed('0x6f')]=_0x59e600[_0x68ed('0x6f')]||![];this[_0x68ed('0x70')]=_0x59e600[_0x68ed('0x70')]?_0x59e600[_0x68ed('0x70')]:undefined;}module[_0x68ed('0x71')]=VoiceQueue; \ No newline at end of file +var _0xcd96=['originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','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','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','onhold','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message'];(function(_0x1ceec0,_0x5b50b5){var _0x1c955c=function(_0x1b5127){while(--_0x1b5127){_0x1ceec0['push'](_0x1ceec0['shift']());}};_0x1c955c(++_0x5b50b5);}(_0xcd96,0xdb));var _0x6cd9=function(_0x4057f9,_0x17c5b5){_0x4057f9=_0x4057f9-0x0;var _0x5552b7=_0xcd96[_0x4057f9];return _0x5552b7;};'use strict';var statusDesc=[_0x6cd9('0x0'),_0x6cd9('0x1'),_0x6cd9('0x2'),_0x6cd9('0x3'),_0x6cd9('0x4'),_0x6cd9('0x5'),'ringing','ringinuse',_0x6cd9('0x6')];var monitorFormat={'wav':'wav','wav49':_0x6cd9('0x7'),'gsm':_0x6cd9('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6cd9('0x9')};function VoiceQueue(_0x51fd7e){this['id']=_0x51fd7e['id']||0x0;this['name']=_0x51fd7e[_0x6cd9('0xa')]||'';this[_0x6cd9('0xb')]=_0x51fd7e[_0x6cd9('0xb')]||'';this[_0x6cd9('0xc')]=_0x51fd7e[_0x6cd9('0xc')]||_0x6cd9('0xd');this[_0x6cd9('0xe')]=0x0;this[_0x6cd9('0xf')]=0x0;this[_0x6cd9('0x10')]=0x0;this['answered']=0x0;this[_0x6cd9('0x11')]=0x0;this[_0x6cd9('0x12')]=0x0;this[_0x6cd9('0x13')]=0x0;this[_0x6cd9('0x14')]=0x0;this[_0x6cd9('0x15')]=0x0;this[_0x6cd9('0x16')]=0x0;this[_0x6cd9('0x17')]=0x0;this['acw']=_0x51fd7e[_0x6cd9('0x18')]||![];this[_0x6cd9('0x19')]=_0x51fd7e[_0x6cd9('0x19')]||0xa;this[_0x6cd9('0x1a')]=_0x51fd7e['autopause']||'no';this[_0x6cd9('0x1b')]=!![];this[_0x6cd9('0x1c')]='';this[_0x6cd9('0x1d')]=0x0;this[_0x6cd9('0x1e')]=0x0;this[_0x6cd9('0x1f')]=_0x51fd7e[_0x6cd9('0x1f')]||null;this[_0x6cd9('0x20')]=_0x51fd7e[_0x6cd9('0x20')]?_0x51fd7e[_0x6cd9('0x20')]:null;this[_0x6cd9('0x21')]=_0x51fd7e['dialActive'];this['dialMethod']=_0x51fd7e[_0x6cd9('0x22')]||_0x6cd9('0x23');this['dialLimitChannel']=_0x51fd7e[_0x6cd9('0x24')]||0x0;this[_0x6cd9('0x25')]=_0x51fd7e[_0x6cd9('0x25')]||0x0;this[_0x6cd9('0x26')]=_0x51fd7e[_0x6cd9('0x26')]||0x1;this[_0x6cd9('0x27')]=_0x51fd7e[_0x6cd9('0x27')]||_0x6cd9('0x28');this[_0x6cd9('0x29')]=_0x51fd7e[_0x6cd9('0x29')]||0.03;this[_0x6cd9('0x2a')]=_0x51fd7e[_0x6cd9('0x2a')]||0x258;this['dialOriginateCallerIdName']=_0x51fd7e[_0x6cd9('0x2b')]||_0x6cd9('0x2c');this[_0x6cd9('0x2d')]=_0x51fd7e[_0x6cd9('0x2d')]||_0x6cd9('0x2c');this[_0x6cd9('0x2e')]=_0x51fd7e[_0x6cd9('0x2e')]||0x1e;this[_0x6cd9('0x2f')]=_0x51fd7e[_0x6cd9('0x2f')]||_0x6cd9('0x30');this[_0x6cd9('0x31')]=_0x51fd7e[_0x6cd9('0x31')]||0x3;this[_0x6cd9('0x32')]=_0x51fd7e['dialQueueProject']||undefined;this[_0x6cd9('0x33')]=_0x51fd7e[_0x6cd9('0x33')]||0x3;this['dialCongestionRetryFrequency']=_0x51fd7e[_0x6cd9('0x34')]||0x96;this['dialBusyMaxRetry']=_0x51fd7e['dialBusyMaxRetry']||0x3;this[_0x6cd9('0x35')]=_0x51fd7e['dialBusyRetryFrequency']||0x96;this[_0x6cd9('0x36')]=_0x51fd7e[_0x6cd9('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x51fd7e[_0x6cd9('0x37')]||0x96;this[_0x6cd9('0x38')]=_0x51fd7e[_0x6cd9('0x38')]||0x3;this[_0x6cd9('0x39')]=_0x51fd7e[_0x6cd9('0x39')]||0x96;this[_0x6cd9('0x3a')]=_0x51fd7e[_0x6cd9('0x3a')]||0x3;this[_0x6cd9('0x3b')]=_0x51fd7e[_0x6cd9('0x3b')]||0x96;this[_0x6cd9('0x3c')]=_0x51fd7e[_0x6cd9('0x3c')]||0x3;this[_0x6cd9('0x3d')]=_0x51fd7e[_0x6cd9('0x3d')]||0x96;this[_0x6cd9('0x3e')]=_0x51fd7e['dialMachineMaxRetry']||0x3;this[_0x6cd9('0x3f')]=_0x51fd7e[_0x6cd9('0x3f')]||0x96;this[_0x6cd9('0x40')]=_0x51fd7e[_0x6cd9('0x40')]||0x3;this[_0x6cd9('0x41')]=_0x51fd7e['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x51fd7e[_0x6cd9('0x42')]||0x4;this[_0x6cd9('0x43')]=_0x51fd7e[_0x6cd9('0x43')]?_0x51fd7e['Trunk']:undefined;this[_0x6cd9('0x44')]=_0x51fd7e[_0x6cd9('0x44')]?_0x51fd7e[_0x6cd9('0x44')]:undefined;this[_0x6cd9('0x45')]=_0x51fd7e[_0x6cd9('0x45')]||undefined;this[_0x6cd9('0x46')]=_0x51fd7e[_0x6cd9('0x46')]?_0x51fd7e['Interval']:undefined;this['dialOrderByScheduledAt']=_0x51fd7e[_0x6cd9('0x47')]||'DESC';this[_0x6cd9('0x48')]=_0x51fd7e[_0x6cd9('0x48')]||undefined;this[_0x6cd9('0x49')]=_0x51fd7e[_0x6cd9('0x49')]||undefined;this['strategy']=strategy[_0x51fd7e[_0x6cd9('0x4a')]]||'rrmemory';this[_0x6cd9('0x4b')]=!![];this[_0x6cd9('0x4c')]=_0x51fd7e[_0x6cd9('0x4c')]||![];this[_0x6cd9('0x4d')]=_0x51fd7e[_0x6cd9('0x4d')];this[_0x6cd9('0x4e')]=_0x51fd7e[_0x6cd9('0x4e')];this['dialAMDAfterGreetingSilence']=_0x51fd7e[_0x6cd9('0x4f')];this[_0x6cd9('0x50')]=_0x51fd7e['dialAMDTotalAnalysisTime'];this[_0x6cd9('0x51')]=_0x51fd7e[_0x6cd9('0x51')];this[_0x6cd9('0x52')]=_0x51fd7e[_0x6cd9('0x52')];this[_0x6cd9('0x53')]=_0x51fd7e[_0x6cd9('0x53')];this[_0x6cd9('0x54')]=_0x51fd7e[_0x6cd9('0x54')];this['dialAMDMaximumWordLength']=_0x51fd7e[_0x6cd9('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x6cd9('0x56')]=0x0;this[_0x6cd9('0x57')]=_0x51fd7e['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x6cd9('0x58')]=0x0;this[_0x6cd9('0x59')]=0x0;this[_0x6cd9('0x5a')]=0x0;this[_0x6cd9('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6cd9('0x5c')]=0x0;this[_0x6cd9('0x5d')]=0x0;this[_0x6cd9('0x5e')]=0x0;this[_0x6cd9('0x5f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6cd9('0x60')]=0x0;this[_0x6cd9('0x61')]=0x0;this[_0x6cd9('0x62')]=undefined;this[_0x6cd9('0x63')]=undefined;this['handlePredictive']=undefined;this[_0x6cd9('0x64')]=1.05;this[_0x6cd9('0x65')]=0x0;this[_0x6cd9('0x66')]=0x0;this[_0x6cd9('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x6cd9('0x68')]=0x0;this[_0x6cd9('0x69')]=0x0;this[_0x6cd9('0x6a')]=_0x51fd7e[_0x6cd9('0x6b')]||0x14;this[_0x6cd9('0x6c')]=_0x51fd7e[_0x6cd9('0x6b')]||0xa;this[_0x6cd9('0x6d')]=0x0;this[_0x6cd9('0x6e')]=0x0;this[_0x6cd9('0x6f')]=0x1;this[_0x6cd9('0x70')]=0x0;this[_0x6cd9('0x71')]=0x0;this[_0x6cd9('0x72')]=0x0;this[_0x6cd9('0x73')]=0x0;this[_0x6cd9('0x74')]=_0x51fd7e['dialRecallMeTimeout']||0x1e;this[_0x6cd9('0x75')]=_0x51fd7e[_0x6cd9('0x75')]||![];this[_0x6cd9('0x76')]=_0x51fd7e[_0x6cd9('0x76')]||undefined;this[_0x6cd9('0x77')]=_0x51fd7e['dialAgiAfterHangupClient']||![];this[_0x6cd9('0x78')]=_0x51fd7e['dialAgiAfterHangupAgent']||![];this[_0x6cd9('0xb')]=monitorFormat[_0x51fd7e[_0x6cd9('0xb')]]?monitorFormat[_0x51fd7e[_0x6cd9('0xb')]]:undefined;this[_0x6cd9('0x79')]=_0x51fd7e['mandatoryDisposition']||![];this[_0x6cd9('0x7a')]=_0x51fd7e[_0x6cd9('0x7a')]?_0x51fd7e['mandatoryDispositionPause']:undefined;}module[_0x6cd9('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a84b314..35688ea 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 _0x7b8c=['serverUrl','Configurations','exports','username','accessKey','remoteUri'];(function(_0x313b33,_0x4026b5){var _0x421a06=function(_0x591033){while(--_0x591033){_0x313b33['push'](_0x313b33['shift']());}};_0x421a06(++_0x4026b5);}(_0x7b8c,0x16b));var _0xc7b8=function(_0x11b596,_0x5d0b54){_0x11b596=_0x11b596-0x0;var _0x47f2f3=_0x7b8c[_0x11b596];return _0x47f2f3;};'use strict';function VtigerAccount(_0x1c4fb9){this['id']=_0x1c4fb9['id']||0x0;this['name']=_0x1c4fb9['name']||'';this[_0xc7b8('0x0')]=_0x1c4fb9[_0xc7b8('0x0')]||'';this['accessKey']=_0x1c4fb9[_0xc7b8('0x1')]||'';this[_0xc7b8('0x2')]=_0x1c4fb9[_0xc7b8('0x2')]||'';this['serverUrl']=_0x1c4fb9[_0xc7b8('0x3')]||'';this[_0xc7b8('0x4')]=_0x1c4fb9['Configurations']||{};}module[_0xc7b8('0x5')]=VtigerAccount; \ No newline at end of file +var _0x42ce=['Configurations','exports','name','username','accessKey','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42ce,0x194));var _0xe42c=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0x42ce[_0x5b7606];return _0x186584;};'use strict';function VtigerAccount(_0x3ace9c){this['id']=_0x3ace9c['id']||0x0;this['name']=_0x3ace9c[_0xe42c('0x0')]||'';this[_0xe42c('0x1')]=_0x3ace9c['username']||'';this[_0xe42c('0x2')]=_0x3ace9c[_0xe42c('0x2')]||'';this['remoteUri']=_0x3ace9c['remoteUri']||'';this[_0xe42c('0x3')]=_0x3ace9c[_0xe42c('0x3')]||'';this[_0xe42c('0x4')]=_0x3ace9c[_0xe42c('0x4')]||{};}module[_0xe42c('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5f7418e..4c3402e 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x4a3a61,_0x6cb8c6){_0x4a3a61=_0x4a3a61-0x0;var _0x3b4697=_0xdb28[_0x4a3a61];return _0x3b4697;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0x0b0e[_0x34a14d];return _0x2015f2;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index dce386c..1260d26 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 _0x70e3=['clientSecret','serverUrl','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x203fe6,_0x1e0faf){var _0xec6f5=function(_0x3f3868){while(--_0x3f3868){_0x203fe6['push'](_0x203fe6['shift']());}};_0xec6f5(++_0x1e0faf);}(_0x70e3,0x9d));var _0x370e=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x70e3[_0x1d558c];return _0x15767d;};'use strict';function ZohoAccount(_0x34d6d1){this['id']=_0x34d6d1['id']||0x0;this[_0x370e('0x0')]=_0x34d6d1[_0x370e('0x0')]||'';this[_0x370e('0x1')]=_0x34d6d1['description']||'';this[_0x370e('0x2')]=_0x34d6d1[_0x370e('0x2')]||'';this[_0x370e('0x3')]=_0x34d6d1['zone']||'';this[_0x370e('0x4')]=_0x34d6d1[_0x370e('0x4')]||'';this[_0x370e('0x5')]=_0x34d6d1[_0x370e('0x5')]||'';this['serverUrl']=_0x34d6d1[_0x370e('0x6')]||'';this['code']=_0x34d6d1['code']||'';this['refreshToken']=_0x34d6d1[_0x370e('0x7')]||'';this['Configurations']=_0x34d6d1[_0x370e('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xe027=['Configurations','exports','name','description','host','zone','clientId','serverUrl','code','refreshToken'];(function(_0x58a845,_0x4029a2){var _0x22b8d5=function(_0x4dbbfe){while(--_0x4dbbfe){_0x58a845['push'](_0x58a845['shift']());}};_0x22b8d5(++_0x4029a2);}(_0xe027,0x106));var _0x7e02=function(_0x414c03,_0x394573){_0x414c03=_0x414c03-0x0;var _0x2a99ea=_0xe027[_0x414c03];return _0x2a99ea;};'use strict';function ZohoAccount(_0x5b8a9d){this['id']=_0x5b8a9d['id']||0x0;this[_0x7e02('0x0')]=_0x5b8a9d[_0x7e02('0x0')]||'';this[_0x7e02('0x1')]=_0x5b8a9d[_0x7e02('0x1')]||'';this[_0x7e02('0x2')]=_0x5b8a9d[_0x7e02('0x2')]||'';this[_0x7e02('0x3')]=_0x5b8a9d[_0x7e02('0x3')]||'';this[_0x7e02('0x4')]=_0x5b8a9d[_0x7e02('0x4')]||'';this['clientSecret']=_0x5b8a9d['clientSecret']||'';this[_0x7e02('0x5')]=_0x5b8a9d['serverUrl']||'';this[_0x7e02('0x6')]=_0x5b8a9d['code']||'';this['refreshToken']=_0x5b8a9d[_0x7e02('0x7')]||'';this['Configurations']=_0x5b8a9d[_0x7e02('0x8')]||{};}module[_0x7e02('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 35921b0..91acd9b 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 _0x3b26=['uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string'];(function(_0x2a1b05,_0x560cd2){var _0x14afb4=function(_0x493da8){while(--_0x493da8){_0x2a1b05['push'](_0x2a1b05['shift']());}};_0x14afb4(++_0x560cd2);}(_0x3b26,0x7d));var _0x63b2=function(_0x4cccf9,_0x1405b9){_0x4cccf9=_0x4cccf9-0x0;var _0x273b78=_0x3b26[_0x4cccf9];return _0x273b78;};'use strict';var util=require(_0x63b2('0x0'));var _=require(_0x63b2('0x1'));var moment=require('moment');function checkNameSurname(_0x12433e,_0x175bde,_0x25be85){var _0x21304c='';if(!_[_0x63b2('0x2')](_0x175bde)&&_0x63b2('0x3')===typeof _0x175bde){_0x21304c+=_0x175bde;}if(!_[_0x63b2('0x2')](_0x25be85)&&_0x63b2('0x3')===typeof _0x25be85){_0x21304c+='\x20'+_0x25be85;}if(_0x21304c!==''){return _0x21304c;}return _0x12433e;}function Action(_0x277cc4,_0x125b4c,_0x222b60,_0x39b43e,_0x3912b7){this[_0x63b2('0x4')]=_0x222b60||undefined;this[_0x63b2('0x5')]=_0x277cc4['id'];this[_0x63b2('0x6')]=_0x125b4c[_0x63b2('0x7')];this[_0x63b2('0x8')]=_0x125b4c[_0x63b2('0x8')];this[_0x63b2('0x9')]=_0x63b2('0x6');this[_0x63b2('0xa')]=![];this[_0x63b2('0xb')]=_[_0x63b2('0x2')](_0x277cc4[_0x63b2('0xc')])?undefined:_0x277cc4['Agent'][_0x63b2('0x7')];this[_0x63b2('0xd')]=this['membername']?util[_0x63b2('0xe')](_0x63b2('0xf'),this[_0x63b2('0xb')]):_0x39b43e||undefined;this['calleridname']=checkNameSurname(_0x277cc4[_0x63b2('0x10')]['phone'],_0x277cc4[_0x63b2('0x10')][_0x63b2('0x11')],_0x277cc4[_0x63b2('0x10')][_0x63b2('0x12')]);this['active']=_0x277cc4[_0x63b2('0x13')]||![];this[_0x63b2('0x14')]=_0x277cc4[_0x63b2('0x10')]['phone'];this['scheduledat']=_0x277cc4[_0x63b2('0x15')];this[_0x63b2('0x16')]=_0x277cc4['countbusyretry']||0x0;this['countcongestionretry']=_0x277cc4[_0x63b2('0x17')]||0x0;this['countnoanswerretry']=_0x277cc4['countnoanswerretry']||0x0;this[_0x63b2('0x18')]=(_0x277cc4['countbusyretry']||0x0)+(_0x277cc4[_0x63b2('0x17')]||0x0)+(_0x277cc4[_0x63b2('0x19')]||0x0)+(_0x277cc4[_0x63b2('0x1a')]||0x0)+(_0x277cc4[_0x63b2('0x1b')]||0x0)+(_0x277cc4[_0x63b2('0x1c')]||0x0)+(_0x277cc4['countmachineretry']||0x0)+(_0x277cc4[_0x63b2('0x1d')]||0x0);this['countnosuchnumberretry']=_0x277cc4[_0x63b2('0x1a')]||0x0;this[_0x63b2('0x1b')]=_0x277cc4[_0x63b2('0x1b')]||0x0;this['countabandonedretry']=_0x277cc4[_0x63b2('0x1c')]||0x0;this[_0x63b2('0x1e')]=_0x277cc4[_0x63b2('0x1e')]||0x0;this['countagentrejectretry']=_0x277cc4[_0x63b2('0x1d')]||0x0;this[_0x63b2('0x1f')]=_0x277cc4[_0x63b2('0x1f')];this['callbackuniqueid']=_0x277cc4['callbackuniqueid'];this['callbackat']=_0x277cc4['callbackat'];this[_0x63b2('0x20')]=_0x277cc4['recallme'];this[_0x63b2('0x21')]=_0x277cc4[_0x63b2('0x21')];this[_0x63b2('0x22')]=_0x277cc4[_0x63b2('0x22')];this[_0x63b2('0x23')]=_[_0x63b2('0x2')](_0x277cc4[_0x63b2('0xc')])?_0x277cc4[_0x63b2('0x23')]:_0x277cc4[_0x63b2('0xc')]['id'];this[_0x63b2('0x24')]=_0x277cc4[_0x63b2('0x24')];this[_0x63b2('0x25')]='';this['originatecalleridname']='';}Action[_0x63b2('0x26')][_0x63b2('0x27')]=function(){return util['format'](_0x63b2('0x28'),this['calleridname'],this[_0x63b2('0x29')]);};module[_0x63b2('0x2a')]=Action; \ No newline at end of file +var _0xe713=['exports','lodash','moment','isNil','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','format','number'];(function(_0x5afd9c,_0x2b05e5){var _0x58e114=function(_0x221bce){while(--_0x221bce){_0x5afd9c['push'](_0x5afd9c['shift']());}};_0x58e114(++_0x2b05e5);}(_0xe713,0x1af));var _0x3e71=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0xe713[_0x312abc];return _0x314298;};'use strict';var util=require('util');var _=require(_0x3e71('0x0'));var moment=require(_0x3e71('0x1'));function checkNameSurname(_0xda182e,_0x7d9c18,_0x14a0e8){var _0x31c4f3='';if(!_[_0x3e71('0x2')](_0x7d9c18)&&'string'===typeof _0x7d9c18){_0x31c4f3+=_0x7d9c18;}if(!_[_0x3e71('0x2')](_0x14a0e8)&&'string'===typeof _0x14a0e8){_0x31c4f3+='\x20'+_0x14a0e8;}if(_0x31c4f3!==''){return _0x31c4f3;}return _0xda182e;}function Action(_0x293fb2,_0xd1fb2a,_0x2dfbbd,_0x4574ec,_0x11f7a7){this[_0x3e71('0x3')]=_0x2dfbbd||undefined;this[_0x3e71('0x4')]=_0x293fb2['id'];this['queue']=_0xd1fb2a[_0x3e71('0x5')];this['type']=_0xd1fb2a[_0x3e71('0x6')];this[_0x3e71('0x7')]=_0x3e71('0x8');this[_0x3e71('0x9')]=![];this[_0x3e71('0xa')]=_['isNil'](_0x293fb2[_0x3e71('0xb')])?undefined:_0x293fb2['Agent'][_0x3e71('0x5')];this[_0x3e71('0xc')]=this[_0x3e71('0xa')]?util['format'](_0x3e71('0xd'),this['membername']):_0x4574ec||undefined;this[_0x3e71('0xe')]=checkNameSurname(_0x293fb2[_0x3e71('0xf')][_0x3e71('0x10')],_0x293fb2[_0x3e71('0xf')]['firstName'],_0x293fb2[_0x3e71('0xf')]['lastName']);this[_0x3e71('0x11')]=_0x293fb2[_0x3e71('0x11')]||![];this[_0x3e71('0x12')]=_0x293fb2[_0x3e71('0xf')]['phone'];this[_0x3e71('0x13')]=_0x293fb2[_0x3e71('0x13')];this[_0x3e71('0x14')]=_0x293fb2[_0x3e71('0x14')]||0x0;this[_0x3e71('0x15')]=_0x293fb2['countcongestionretry']||0x0;this[_0x3e71('0x16')]=_0x293fb2[_0x3e71('0x16')]||0x0;this[_0x3e71('0x17')]=(_0x293fb2[_0x3e71('0x14')]||0x0)+(_0x293fb2[_0x3e71('0x15')]||0x0)+(_0x293fb2[_0x3e71('0x16')]||0x0)+(_0x293fb2[_0x3e71('0x18')]||0x0)+(_0x293fb2['countdropretry']||0x0)+(_0x293fb2[_0x3e71('0x19')]||0x0)+(_0x293fb2['countmachineretry']||0x0)+(_0x293fb2[_0x3e71('0x1a')]||0x0);this['countnosuchnumberretry']=_0x293fb2[_0x3e71('0x18')]||0x0;this[_0x3e71('0x1b')]=_0x293fb2[_0x3e71('0x1b')]||0x0;this[_0x3e71('0x19')]=_0x293fb2[_0x3e71('0x19')]||0x0;this[_0x3e71('0x1c')]=_0x293fb2[_0x3e71('0x1c')]||0x0;this[_0x3e71('0x1a')]=_0x293fb2[_0x3e71('0x1a')]||0x0;this[_0x3e71('0x1d')]=_0x293fb2[_0x3e71('0x1d')];this[_0x3e71('0x1e')]=_0x293fb2[_0x3e71('0x1e')];this['callbackat']=_0x293fb2[_0x3e71('0x1f')];this[_0x3e71('0x20')]=_0x293fb2[_0x3e71('0x20')];this[_0x3e71('0x21')]=_0x293fb2[_0x3e71('0x21')];this[_0x3e71('0x22')]=_0x293fb2[_0x3e71('0x22')];this[_0x3e71('0x23')]=_['isNil'](_0x293fb2['Agent'])?_0x293fb2[_0x3e71('0x23')]:_0x293fb2[_0x3e71('0xb')]['id'];this[_0x3e71('0x24')]=_0x293fb2[_0x3e71('0x24')];this[_0x3e71('0x25')]='';this['originatecalleridname']='';}Action[_0x3e71('0x26')][_0x3e71('0x27')]=function(){return util[_0x3e71('0x28')]('\x22%s\x22\x20<%s>',this[_0x3e71('0xe')],this[_0x3e71('0x29')]);};module[_0x3e71('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0a87524..de1e5ee 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 _0xcd01=['dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','getContactRecallMe','agentReadyId','length','getDiff','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','responsetime','[syncHangup][talking][increment]','custom:agentconnect','connect','acw','buildAcw','buildObj','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','uniqueid','\x20Queue','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','isFailure','idContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned'];(function(_0x1c9f19,_0x212d83){var _0x5d8710=function(_0x17b23d){while(--_0x17b23d){_0x1c9f19['push'](_0x1c9f19['shift']());}};_0x5d8710(++_0x212d83);}(_0xcd01,0x11b));var _0x1cd0=function(_0x1a4950,_0x53b0f7){_0x1a4950=_0x1a4950-0x0;var _0x4787d5=_0xcd01[_0x1a4950];return _0x4787d5;};'use strict';var util=require(_0x1cd0('0x0'));var _=require(_0x1cd0('0x1'));var BPromise=require('bluebird');var uuid=require(_0x1cd0('0x2'));var moment=require(_0x1cd0('0x3'));var md5=require(_0x1cd0('0x4'));var Redis=require('ioredis');var config=require(_0x1cd0('0x5'));var logger=require(_0x1cd0('0x6'))(_0x1cd0('0x7'));var loggerAction=require(_0x1cd0('0x6'))(_0x1cd0('0x8'));var ami=require(_0x1cd0('0x9'));var rpcDb=require(_0x1cd0('0xa'));var Action=require('./action');var ut=require(_0x1cd0('0xb'));config[_0x1cd0('0xc')]=_[_0x1cd0('0xd')](config[_0x1cd0('0xc')],{'host':_0x1cd0('0xe'),'port':0x18eb});var io=require(_0x1cd0('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1cd0('0x10')][_0x1cd0('0x11')]=function(_0x1ec313){this['tail']=this[_0x1cd0('0x12')]?this[_0x1cd0('0x12')][_0x1cd0('0x13')](_0x1ec313):_0x1ec313();};function Preview(_0x37896e){this[_0x1cd0('0x14')]=new Sequence();this[_0x1cd0('0x15')]=_0x37896e[_0x1cd0('0x16')];this['trunks']=_0x37896e[_0x1cd0('0x17')];this[_0x1cd0('0x18')]={};this['agents']=_0x37896e[_0x1cd0('0x19')];this['clockClearZombieChannels']=0x0;ami['on'](_0x1cd0('0x1a'),this[_0x1cd0('0x1b')]['bind'](this));ami['on'](_0x1cd0('0x1c'),this[_0x1cd0('0x1d')]['bind'](this));ami['on'](_0x1cd0('0x1e'),this[_0x1cd0('0x1f')][_0x1cd0('0x20')](this));ami['on'](_0x1cd0('0x21'),this[_0x1cd0('0x22')]['bind'](this));ami['on'](_0x1cd0('0x23'),this[_0x1cd0('0x24')]['bind'](this));ami['on'](_0x1cd0('0x25'),this[_0x1cd0('0x26')][_0x1cd0('0x20')](this));ami['on'](_0x1cd0('0x27'),this[_0x1cd0('0x28')][_0x1cd0('0x20')](this));ami['on'](_0x1cd0('0x29'),this[_0x1cd0('0x2a')][_0x1cd0('0x20')](this));this[_0x1cd0('0x2b')](this[_0x1cd0('0x15')]);}function emit(_0x179e1b,_0x1c17b8,_0x264875){io['to'](_0x179e1b)[_0x1cd0('0x2c')](_0x1c17b8,_0x264875);}function emitCampaignPreview(_0xbcd922){if(_0xbcd922[_0x1cd0('0x2d')]===_0x1cd0('0x2e')){var _0xf445f1={'id':_0xbcd922['id'],'name':_0xbcd922[_0x1cd0('0x2f')],'strategy':_0xbcd922['strategy'],'answered':_0xbcd922[_0x1cd0('0x30')],'available':_0xbcd922[_0x1cd0('0x31')],'loggedIn':_0xbcd922[_0x1cd0('0x32')],'pTalking':_0xbcd922[_0x1cd0('0x33')],'sumBillable':_0xbcd922[_0x1cd0('0x34')],'sumDuration':_0xbcd922['sumDuration'],'sumHoldTime':_0xbcd922[_0x1cd0('0x35')]||0x0,'talking':_0xbcd922[_0x1cd0('0x36')],'total':_0xbcd922[_0x1cd0('0x37')],'type':_0xbcd922[_0x1cd0('0x2d')],'unmanaged':_0xbcd922['unmanaged'],'abandoned':_0xbcd922[_0x1cd0('0x38')],'waiting':_0xbcd922['waiting'],'loggedInDb':_0xbcd922['loggedInDb'],'dialActive':_0xbcd922[_0x1cd0('0x39')],'dialMethod':_0xbcd922[_0x1cd0('0x3a')],'dialOriginateCallerIdName':_0xbcd922['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xbcd922[_0x1cd0('0x3b')],'dialOriginateTimeout':_0xbcd922[_0x1cd0('0x3c')],'dialPrefix':_0xbcd922['dialPrefix'],'outboundAnswerAgiCallsDay':_0xbcd922[_0x1cd0('0x3d')],'outboundAnswerCallsDay':_0xbcd922[_0x1cd0('0x3e')],'outboundBlacklistCallsDay':_0xbcd922[_0x1cd0('0x3f')],'outboundBusyCallsDay':_0xbcd922[_0x1cd0('0x40')],'outboundCongestionCallsDay':_0xbcd922[_0x1cd0('0x41')],'outboundDropCallsDayACS':_0xbcd922['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xbcd922[_0x1cd0('0x42')],'outboundDropCallsDayTimeout':_0xbcd922[_0x1cd0('0x43')],'outboundNoAnswerCallsDay':_0xbcd922[_0x1cd0('0x44')],'outboundNoSuchCallsDay':_0xbcd922['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xbcd922[_0x1cd0('0x45')],'outboundReCallsDay':_0xbcd922[_0x1cd0('0x46')],'outboundRejectCallsDay':_0xbcd922[_0x1cd0('0x47')],'outboundUnknownCallsDay':_0xbcd922[_0x1cd0('0x48')],'outboundAbandonedCallsDay':_0xbcd922[_0x1cd0('0x49')],'predictiveIntervalAnsweredCalls':_0xbcd922[_0x1cd0('0x4a')],'predictiveIntervalAvgHoldtime':_0xbcd922[_0x1cd0('0x4b')],'predictiveIntervalAvgTalktime':_0xbcd922[_0x1cd0('0x4c')],'predictiveIntervalDroppedCallsCallersExit':_0xbcd922[_0x1cd0('0x4d')],'predictiveIntervalDroppedCallsTimeout':_0xbcd922[_0x1cd0('0x4e')],'predictiveIntervalErlangCalls':_0xbcd922[_0x1cd0('0x4f')],'predictiveIntervalErlangCallsDroppedCalls':_0xbcd922[_0x1cd0('0x50')],'predictiveIntervalHitRate':_0xbcd922[_0x1cd0('0x51')],'predictiveIntervalMultiplicativeFactor':_0xbcd922[_0x1cd0('0x52')],'predictiveIntervalPauses':_0xbcd922['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xbcd922[_0x1cd0('0x53')],'predictiveIntervalTotalCalls':_0xbcd922['predictiveIntervalTotalCalls'],'message':_0xbcd922['message'],'originated':_0xbcd922[_0x1cd0('0x54')],'erlangCalls':_0xbcd922[_0x1cd0('0x55')],'erlangCallToSecond':_0xbcd922[_0x1cd0('0x56')],'erlangAbandonmentRate':_0xbcd922[_0x1cd0('0x57')],'erlangBusyFactor':_0xbcd922['erlangBusyFactor'],'startPredictive':_0xbcd922[_0x1cd0('0x58')],'startProgressive':_0xbcd922[_0x1cd0('0x59')]};if(_0xbcd922[_0x1cd0('0x5a')]){_0xf445f1['Trunk']={'id':_0xbcd922[_0x1cd0('0x5a')]['id'],'name':_0xbcd922[_0x1cd0('0x5a')]['name'],'active':_0xbcd922[_0x1cd0('0x5a')][_0x1cd0('0x5b')],'callerid':_0xbcd922['Trunk'][_0x1cd0('0x5c')]};}if(_0xbcd922[_0x1cd0('0x5d')]){_0xf445f1[_0x1cd0('0x5d')]={'id':_0xbcd922[_0x1cd0('0x5d')]['id'],'name':_0xbcd922[_0x1cd0('0x5d')][_0x1cd0('0x2f')]};}var _0x36e891=md5(JSON[_0x1cd0('0x5e')](_0xf445f1));if(_0xbcd922[_0x1cd0('0x4')]!==_0x36e891){_0xbcd922['md5']=_0x36e891;emit(util[_0x1cd0('0x5f')](_0x1cd0('0x60'),_0xf445f1[_0x1cd0('0x2f')]),_0x1cd0('0x61'),_0xf445f1);}}}function emitVoiceQueueChannelRemove(_0xe36106){logger[_0x1cd0('0x62')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0xe36106));emit(util[_0x1cd0('0x5f')](_0x1cd0('0x60'),_0xe36106['name']),_0x1cd0('0x63'),_0xe36106);}function notSendMessagesQueue(_0x537352){if(_0x537352[_0x1cd0('0x64')]){if(_0x537352[_0x1cd0('0x54')]===0x0&&_0x537352[_0x1cd0('0x33')]===0x0){_0x537352[_0x1cd0('0x64')]=![];_0x537352[_0x1cd0('0x31')]=0x0;_0x537352[_0x1cd0('0x65')]=0x0;_0x537352[_0x1cd0('0x66')]='NOT_ACTIVE';ut[_0x1cd0('0x67')](_0x1cd0('0x68'),_0x537352[_0x1cd0('0x2f')]+_0x1cd0('0x69'));}else{_0x537352[_0x1cd0('0x66')]=_0x1cd0('0x6a');ut[_0x1cd0('0x67')](_0x1cd0('0x68'),_0x537352['name']+_0x1cd0('0x6b'));}emitCampaignPreview(_0x537352);}}Preview[_0x1cd0('0x10')][_0x1cd0('0x2b')]=function(){var _0x567128=this;setInterval(function(){_0x567128[_0x1cd0('0x6c')]();},0x7cf);};Preview['prototype'][_0x1cd0('0x6c')]=function(){var _0x23727b=this[_0x1cd0('0x15')];this[_0x1cd0('0x6d')]+=0x1;for(var _0x5ec6a3 in _0x23727b){if(_0x23727b[_0x1cd0('0x6e')](_0x5ec6a3)&&(_0x23727b[_0x5ec6a3]['dialMethod']===_0x1cd0('0x7')||_0x23727b[_0x5ec6a3][_0x1cd0('0x3a')]===_0x1cd0('0x6f'))&&_0x23727b[_0x5ec6a3]['type']==='outbound'){if(this[_0x1cd0('0x6d')]>0x7){this[_0x1cd0('0x6d')]=0x0;this[_0x1cd0('0x70')]();}}if(_0x23727b['hasOwnProperty'](_0x5ec6a3)&&_0x23727b[_0x5ec6a3]['dialMethod']==='preview'&&_0x23727b[_0x5ec6a3][_0x1cd0('0x2d')]===_0x1cd0('0x2e')){if(_0x23727b[_0x5ec6a3][_0x1cd0('0x39')]){this[_0x1cd0('0x71')](_0x23727b[_0x5ec6a3]);this[_0x1cd0('0x72')](_0x23727b[_0x5ec6a3]);}else{notSendMessagesQueue(_0x23727b[_0x5ec6a3]);}}}};Preview['prototype'][_0x1cd0('0x73')]=function(_0x55025c){var _0x34b4e9=this;this['sequence'][_0x1cd0('0x11')](function(){if(!_[_0x1cd0('0x74')](_0x34b4e9[_0x1cd0('0x18')][_0x55025c])){loggerAction['info'](_0x1cd0('0x75'),_0x55025c,'Queue',_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x76')],_0x1cd0('0x77'),JSON[_0x1cd0('0x5e')](_0x34b4e9['campaignsPreview'][_0x34b4e9[_0x1cd0('0x18')][_0x55025c]['queue']][_0x1cd0('0x54')]),_0x1cd0('0x78'),JSON[_0x1cd0('0x5e')](_0x34b4e9[_0x1cd0('0x15')][_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x76')]]['pTalking']),JSON[_0x1cd0('0x5e')](_0x34b4e9['actions'][_0x55025c][_0x1cd0('0x79')]),JSON[_0x1cd0('0x5e')](_[_0x1cd0('0x7a')](_0x34b4e9[_0x1cd0('0x18')][_0x55025c],[_0x1cd0('0x7b'),_0x1cd0('0x7c'),_0x1cd0('0x7d'),_0x1cd0('0x7e')])));return ami[_0x1cd0('0x7f')]({'action':_0x1cd0('0x80'),'channel':_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x81')]})[_0x1cd0('0x82')](function(_0x499517){if(_0x499517[_0x1cd0('0x66')]===_0x1cd0('0x83')){setTimeout(function(){if(_0x34b4e9['actions'][_0x55025c]){ut[_0x1cd0('0x84')](_0x34b4e9[_0x1cd0('0x15')][_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x76')]],_0x1cd0('0x85'));if(_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x79')]===!![]){ut[_0x1cd0('0x86')](_0x34b4e9[_0x1cd0('0x15')][_0x34b4e9['actions'][_0x55025c][_0x1cd0('0x76')]],_0x1cd0('0x85'));ut[_0x1cd0('0x87')]('[Dialer][checkChannel][pTalking][Preview]'+_0x55025c,_0x34b4e9[_0x1cd0('0x18')][_0x55025c][_0x1cd0('0x76')]);}ut[_0x1cd0('0x87')]('[Dialer][checkChannel][Preview]'+_0x55025c,_0x34b4e9[_0x1cd0('0x18')][_0x55025c]['queue']);delete _0x34b4e9['actions'][_0x55025c];}},0x2328);}});}});};Preview[_0x1cd0('0x10')][_0x1cd0('0x70')]=function(){var _0x5a114c=this;loggerAction[_0x1cd0('0x62')]('[action]',_['size'](this[_0x1cd0('0x18')]));for(var _0x3f8ec9 in this['actions']){if(_0x5a114c[_0x1cd0('0x18')]['hasOwnProperty'](_0x3f8ec9)){_0x5a114c[_0x1cd0('0x73')](_0x3f8ec9);}}};Preview[_0x1cd0('0x10')][_0x1cd0('0x72')]=function(_0x1b7b49){var _0x438fe6=this;rpcDb[_0x1cd0('0x88')](_0x1b7b49['id'],ut[_0x1cd0('0x89')](this['agents']))['then'](function(_0x57e2ea){if(!_['isNil'](_0x57e2ea)){for(var _0x201e33=0x0;_0x201e33<_0x57e2ea[_0x1cd0('0x8a')];_0x201e33+=0x1){if(ut[_0x1cd0('0x8b')](_0x57e2ea[_0x201e33]['scheduledat'])<_0x1b7b49['dialRecallMeTimeout']*0x3c){if(_0x57e2ea[_0x201e33][_0x1cd0('0x8c')]&&!_0x57e2ea[_0x201e33][_0x1cd0('0x8c')][_0x1cd0('0x8d')]){_0x438fe6[_0x1cd0('0x8e')](_0x57e2ea[_0x201e33]['id'])[_0x1cd0('0x8f')](ut[_0x1cd0('0x90')](_0x1cd0('0x91')))['catch'](ut['logger2'](_0x1cd0('0x91')));}else{rpcDb[_0x1cd0('0x92')](_0x57e2ea[_0x201e33]['id']);}}else{var _0x2148bf=new Action(_0x57e2ea[_0x201e33],_0x1b7b49);_0x2148bf[_0x1cd0('0x93')]=moment()[_0x1cd0('0x5f')](_0x1cd0('0x94'));_0x1b7b49[_0x1cd0('0x46')]+=0x1;ut[_0x1cd0('0x95')](_0x2148bf,0x17,_0x1cd0('0x96'));if(_0x1b7b49[_0x1cd0('0x97')]){rpcDb[_0x1cd0('0x98')](ut[_0x1cd0('0x99')](_0x57e2ea[_0x201e33]));rpcDb[_0x1cd0('0x9a')](_0x2148bf,_0x1cd0('0x9b'));}else{ut['logCustomer'](_0x2148bf,0x16,_0x1cd0('0x9c'));rpcDb['createCustomerHistory'](_0x2148bf,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x2148bf,_0x1cd0('0x9d'));}}}}})['catch'](ut[_0x1cd0('0x90')](_0x1cd0('0x9e')));};Preview[_0x1cd0('0x10')][_0x1cd0('0x71')]=function(_0x38fc02){_0x38fc02[_0x1cd0('0x64')]=!![];if(ut[_0x1cd0('0x9f')](_0x38fc02[_0x1cd0('0x32')])){_0x38fc02[_0x1cd0('0x66')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x1cd0('0xa0')](_0x38fc02[_0x1cd0('0x39')])){_0x38fc02[_0x1cd0('0x66')]='NOT_ACTIVE';}else if(!this[_0x1cd0('0xa1')](_0x38fc02['Trunk'])){if(!this[_0x1cd0('0xa1')](_0x38fc02['TrunkBackup'])){_0x38fc02[_0x1cd0('0x66')]=_0x1cd0('0xa2');}else{_0x38fc02[_0x1cd0('0x66')]=_0x1cd0('0xa3');}}else{_0x38fc02[_0x1cd0('0x66')]=_0x1cd0('0xa3');}emitCampaignPreview(_0x38fc02);};Preview[_0x1cd0('0x10')]['callProgressDetectingCustomer']=function(_0x1471a4,_0x2b7cf5,_0x1b4147){var _0x318d14=this;var _0x5a257f=this[_0x1cd0('0x18')][_0x2b7cf5];var _0x3ea342=this['campaignsPreview'][_0x5a257f[_0x1cd0('0x76')]];var _0x3d8262;if(_0x3ea342){switch(_0x1b4147){case'1':_0x3ea342[_0x1cd0('0xa4')]+=0x1;_0x5a257f[_0x1cd0('0xa5')]+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x0,_0x1cd0('0xa8'));ami[_0x1cd0('0x2c')]('custom:agentnosuchnumber',ut['buildObj'](_0x5a257f,'nosuchnumber'));rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xa9'));if(ut[_0x1cd0('0xa7')](_0x5a257f)>=_0x3ea342['dialGlobalMaxRetry']){_0x3d8262=ut['cloneAction'](_0x5a257f,0xf,'Global');rpcDb[_0x1cd0('0xaa')](_0x3d8262,_0x1cd0('0xab'));}else{if(_0x5a257f[_0x1cd0('0xa5')]>=_0x3ea342[_0x1cd0('0xac')]){rpcDb[_0x1cd0('0xaa')](_0x5a257f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xa5'),_0x3ea342[_0x1cd0('0xae')]),_0x5a257f[_0x1cd0('0xaf')],_0x5a257f['activeContact']);}}delete this['actions'][_0x1471a4[_0x1cd0('0xb0')]];break;case'ANSWER':var _0x33bad1=moment()[_0x1cd0('0x5f')](_0x1cd0('0x94'));_0x5a257f[_0x1cd0('0xb1')]=_0x33bad1;_0x5a257f['answertime']=_0x33bad1;_0x5a257f[_0x1cd0('0x79')]=!![];_0x3ea342[_0x1cd0('0x33')]+=0x1;logger[_0x1cd0('0x62')](_0x1cd0('0xb2'),_0x5a257f['uniqueid'],'\x20Queue',_0x3ea342[_0x1cd0('0x2f')],_0x1cd0('0x78'),_0x3ea342[_0x1cd0('0x33')]);ami['emit'](_0x1cd0('0xb3'),ut['buildObj'](_0x5a257f,_0x1cd0('0xb4')));if(_0x3ea342[_0x1cd0('0xb5')]){ami[_0x1cd0('0x2c')]('custom:agentConnectPreview',ut[_0x1cd0('0xb6')](_0x5a257f));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x1cd0('0xb7')](_0x5a257f,_0x1cd0('0xb8')));emitVoiceQueueChannelRemove(ut[_0x1cd0('0xb7')](_0x5a257f,'complete'));_0x3ea342['outboundAnswerCallsDay']+=0x1;_0x3ea342[_0x1cd0('0x37')]+=0x1;_0x3ea342['answered']+=0x1;ut['decrementTalkink'](_0x3ea342,_0x1cd0('0xb9'));_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x4,'Answer');rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xba'));rpcDb[_0x1cd0('0xaa')](_0x5a257f,_0x1cd0('0xbb'));rpcDb[_0x1cd0('0xbc')](_0x5a257f);_0x3ea342[_0x1cd0('0xbd')]+=_0x5a257f[_0x1cd0('0xbe')];_0x3ea342[_0x1cd0('0x34')]+=_0x5a257f[_0x1cd0('0xbe')];logger[_0x1cd0('0x62')]('[syncHangup][talking][decrement]',_0x5a257f[_0x1cd0('0xbf')],_0x1cd0('0xc0'),_0x3ea342[_0x1cd0('0x2f')],_0x1cd0('0x78'),_0x3ea342['pTalking']);delete this[_0x1cd0('0x18')][_0x1471a4[_0x1cd0('0xb0')]];break;case'BUSY':_0x3ea342[_0x1cd0('0x40')]+=0x1;_0x5a257f['countbusyretry']+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x5,'Busy');ami[_0x1cd0('0x2c')](_0x1cd0('0xc1'),ut[_0x1cd0('0xb7')](_0x5a257f,'busy'));rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xc2'));if(ut[_0x1cd0('0xa7')](_0x5a257f)>=_0x3ea342[_0x1cd0('0xc3')]){_0x3d8262=ut[_0x1cd0('0xc4')](_0x5a257f,0xf,_0x1cd0('0xc5'));rpcDb['createCustomerFinal'](_0x3d8262,_0x1cd0('0xc6'));}else{if(_0x5a257f[_0x1cd0('0xc7')]>=_0x3ea342[_0x1cd0('0xc8')]){rpcDb[_0x1cd0('0xaa')](_0x5a257f,_0x1cd0('0xc2'));}else{rpcDb[_0x1cd0('0xc9')](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xc7'),_0x3ea342[_0x1cd0('0xca')]),_0x5a257f['unlockAgent'],_0x5a257f[_0x1cd0('0xcb')]);}}break;case _0x1cd0('0xcc'):_0x3ea342[_0x1cd0('0x44')]+=0x1;_0x5a257f[_0x1cd0('0xcd')]+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x3,_0x1cd0('0xce'));ami[_0x1cd0('0x2c')](_0x1cd0('0xcf'),ut[_0x1cd0('0xb7')](_0x5a257f,_0x1cd0('0xd0')));rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xd1'));if(ut[_0x1cd0('0xa7')](_0x5a257f)>=_0x3ea342[_0x1cd0('0xc3')]){_0x3d8262=ut[_0x1cd0('0xc4')](_0x5a257f,0xf,'Global');rpcDb[_0x1cd0('0xaa')](_0x3d8262,_0x1cd0('0xd2'));}else{if(_0x5a257f[_0x1cd0('0xcd')]>=_0x3ea342[_0x1cd0('0xd3')]){rpcDb[_0x1cd0('0xaa')](_0x5a257f,_0x1cd0('0xd1'));}else{rpcDb[_0x1cd0('0xc9')](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xcd'),_0x3ea342['dialNoAnswerRetryFrequency']),_0x5a257f[_0x1cd0('0xaf')],_0x5a257f[_0x1cd0('0xcb')]);}}break;case _0x1cd0('0xd4'):_0x3ea342[_0x1cd0('0x41')]+=0x1;_0x5a257f[_0x1cd0('0xd5')]+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut['totalGlobal'](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x8,_0x1cd0('0xd6'));ami[_0x1cd0('0x2c')]('custom:agentcongestion',ut[_0x1cd0('0xb7')](_0x5a257f,_0x1cd0('0xd7')));rpcDb[_0x1cd0('0x9a')](_0x5a257f,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x1cd0('0xa7')](_0x5a257f)>=_0x3ea342[_0x1cd0('0xc3')]){_0x3d8262=ut[_0x1cd0('0xc4')](_0x5a257f,0xf,_0x1cd0('0xc5'));rpcDb[_0x1cd0('0xaa')](_0x3d8262,_0x1cd0('0xd8'));}else{if(_0x5a257f[_0x1cd0('0xd5')]>=_0x3ea342['dialCongestionMaxRetry']){rpcDb[_0x1cd0('0xaa')](_0x5a257f,_0x1cd0('0xd9'));}else{rpcDb[_0x1cd0('0xc9')](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xd5'),_0x3ea342[_0x1cd0('0xca')]),_0x5a257f['unlockAgent'],_0x5a257f[_0x1cd0('0xcb')]);}}break;case _0x1cd0('0xda'):_0x3ea342[_0x1cd0('0x47')]+=0x1;_0x5a257f[_0x1cd0('0xdb')]+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0x14,_0x1cd0('0xdc'));ami[_0x1cd0('0x2c')](_0x1cd0('0xdd'),ut[_0x1cd0('0xb7')](_0x5a257f,_0x1cd0('0xde')));rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xdf'));if(ut['totalGlobal'](_0x5a257f)>=_0x3ea342['dialGlobalMaxRetry']){_0x3d8262=ut[_0x1cd0('0xc4')](_0x5a257f,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x3d8262,_0x1cd0('0xe0'));}else{if(_0x5a257f[_0x1cd0('0xdb')]>=_0x3ea342['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x5a257f,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x1cd0('0xc9')](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xdb'),_0x3ea342['dialAgentRejectRetryFrequency']),_0x5a257f[_0x1cd0('0xaf')],_0x5a257f[_0x1cd0('0xcb')]);}}break;case _0x1cd0('0xe1'):_0x3ea342['outboundAbandonedCallsDay']+=0x1;_0x5a257f['countabandonedretry']+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut['totalGlobal'](_0x5a257f);ut['logCustomer'](_0x5a257f,0xb,_0x1cd0('0xe2'));rpcDb[_0x1cd0('0x9a')](_0x5a257f,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x5a257f)>=_0x3ea342['dialGlobalMaxRetry']){_0x3d8262=ut[_0x1cd0('0xc4')](_0x5a257f,0xf,'Global');rpcDb[_0x1cd0('0xaa')](_0x3d8262,_0x1cd0('0xe3'));}else{if(_0x5a257f[_0x1cd0('0xe4')]>=_0x3ea342[_0x1cd0('0xe5')]){rpcDb['createCustomerFinal'](_0x5a257f,_0x1cd0('0xe3'));}else{rpcDb[_0x1cd0('0xc9')](ut[_0x1cd0('0xad')](_0x5a257f,_0x1cd0('0xe6'),_0x3ea342[_0x1cd0('0xe7')]),_0x5a257f[_0x1cd0('0xaf')],_0x5a257f[_0x1cd0('0xcb')]);}}break;default:if(_0x5a257f['dialAnswer']){ut['decrementTalkink'](_0x3ea342,_0x1cd0('0xe8'));ut[_0x1cd0('0x87')](_0x1cd0('0xe9')+_0x3ea342['name'],_0x1471a4);}_0x3ea342[_0x1cd0('0x48')]+=0x1;_0x5a257f[_0x1cd0('0xa6')]=ut[_0x1cd0('0xa7')](_0x5a257f);ut[_0x1cd0('0x95')](_0x5a257f,0xc,_0x1471a4[_0x1cd0('0xea')]||_0x1471a4[_0x1cd0('0xeb')]);rpcDb[_0x1cd0('0x9a')](_0x5a257f,_0x1cd0('0xec'));if(ut[_0x1cd0('0xa7')](_0x5a257f)>=_0x3ea342[_0x1cd0('0xc3')]){_0x3d8262=ut['cloneAction'](_0x5a257f,0xf,'Global');rpcDb[_0x1cd0('0xaa')](_0x3d8262,_0x1cd0('0xed'));}else{rpcDb['createCustomerFinal'](_0x5a257f,_0x1cd0('0xed'));}delete this['actions'][_0x1471a4[_0x1cd0('0xb0')]];}if(!(_0x5a257f[_0x1cd0('0x79')]&&_0x1b4147==='16')){ut[_0x1cd0('0x84')](_0x3ea342,_0x1cd0('0xee'));logger[_0x1cd0('0x62')]('[originated][decrement][callProgressDetectingCustomer]',_0x5a257f[_0x1cd0('0xbf')],'\x20Queue',_0x3ea342['name'],'originated:\x20',_0x3ea342[_0x1cd0('0x54')]);}if(_0x1b4147!==_0x1cd0('0xef')){delete this['actions'][_0x1471a4[_0x1cd0('0xb0')]];delete this[_0x1cd0('0x18')][_0x1471a4['destlinkedid']];}}};Preview[_0x1cd0('0x10')][_0x1cd0('0xf0')]=function(_0xaca211,_0x5bda46,_0x6b15a0){if(_['isUndefined'](_0x5bda46)&&_0x1cd0('0xf1')!==typeof _0x5bda46){return;}if(_[_0x1cd0('0xf2')](_0x6b15a0)&&'object'!==typeof _0x6b15a0){return;}switch(_0x6b15a0[_0x1cd0('0xf3')]){case'0':ut[_0x1cd0('0xf4')](_0xaca211,0x0,_0x1cd0('0xa8'));rpcDb[_0x1cd0('0xf5')](_0xaca211,_0x1cd0('0xf6'));break;case'3':ut[_0x1cd0('0xf4')](_0xaca211,0x3,_0x1cd0('0xce'));rpcDb[_0x1cd0('0xf5')](_0xaca211,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x1cd0('0xf4')](_0xaca211,0x5,'Busy');rpcDb[_0x1cd0('0xf5')](_0xaca211,_0x1cd0('0xf7'));break;case'8':ut[_0x1cd0('0xf4')](_0xaca211,0x8,_0x1cd0('0xd6'));rpcDb['createAgentHistory'](_0xaca211,_0x1cd0('0xf8'));break;case'22':ut[_0x1cd0('0xf4')](_0xaca211,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0xaca211,_0x1cd0('0xf9'));break;default:ut['logAgent'](_0xaca211,0xc,_0x6b15a0['reason']);rpcDb[_0x1cd0('0xf5')](_0xaca211,_0x1cd0('0xf8'));}ut[_0x1cd0('0x84')](_0x5bda46,_0x1cd0('0xfa'));logger['info'](_0x1cd0('0xfb'),_0xaca211['uniqueid'],_0x1cd0('0xc0'),_0x5bda46['name'],_0x1cd0('0x77'),_0x5bda46[_0x1cd0('0x54')]);delete this[_0x1cd0('0x18')][_0xaca211['uniqueid']];};Preview[_0x1cd0('0x10')][_0x1cd0('0xfc')]=function(_0x1d2ec9,_0x3d32cd,_0x4147eb,_0x28f11e,_0x532c6a){var _0x43733e=this;return new BPromise(function(_0x4ce284,_0x5351db){if(_['isNil'](_0x3d32cd)||_[_0x1cd0('0x74')](_0x3d32cd[_0x1cd0('0xfd')])||_[_0x1cd0('0x74')](_0x3d32cd[_0x1cd0('0xfd')]['phone'])||_[_0x1cd0('0x74')](_0x3d32cd['VoiceQueueId'])){_0x5351db(ut[_0x1cd0('0x66')](_0x1cd0('0xfe'),_0x28f11e,_0x532c6a));return;}var _0x40583b=uuid['v4']();var _0x128a0b=_0x43733e['campaignsPreview'][_0x3d32cd[_0x1cd0('0xff')][_0x1cd0('0x2f')]];var _0x2325e4=_0x4147eb?_0x43733e[_0x1cd0('0x19')][_0x4147eb]['id']:undefined;_0x43733e[_0x1cd0('0x18')][_0x40583b]=new Action(_0x3d32cd,_0x128a0b,_0x40583b,_0x4147eb,_0x2325e4);var _0x27cf1a=_0x43733e[_0x1cd0('0x18')][_0x40583b];_0x27cf1a['unlockAgent']=_0x28f11e;_0x27cf1a[_0x1cd0('0xcb')]=_0x532c6a;_0x27cf1a['lookAgent']=_0x4147eb;if(_['isEmpty'](_0x1d2ec9)){_0x43733e[_0x1cd0('0x100')](_0x27cf1a,_0x128a0b,_0x3d32cd,_0x4147eb)[_0x1cd0('0x8f')](function(_0x190857){logger[_0x1cd0('0x62')](_0x1cd0('0x101'),_0x1cd0('0x102')+_0x27cf1a[_0x1cd0('0x76')]+_0x1cd0('0x103')+_0x27cf1a['idContact'],JSON[_0x1cd0('0x5e')](_0x190857));ami[_0x1cd0('0x2c')](_0x1cd0('0x104'),ut[_0x1cd0('0xb7')](_0x27cf1a,_0x1cd0('0x105')));_0x4ce284(ut[_0x1cd0('0x66')](_0x1cd0('0x106')));})[_0x1cd0('0x82')](function(_0x2d7667){ut[_0x1cd0('0x67')](_0x1cd0('0x107'),_0x2d7667);_0x5351db(ut[_0x1cd0('0x66')]('Call\x20failed',_0x28f11e,_0x532c6a));});}else{_0x128a0b[_0x1cd0('0x3f')]+=0x1;ut[_0x1cd0('0x108')](_0x27cf1a);rpcDb[_0x1cd0('0x109')](_0x27cf1a,_0x1cd0('0x10a'));delete _0x43733e[_0x1cd0('0x18')][_0x40583b];_0x5351db(ut[_0x1cd0('0x66')](_0x1cd0('0x10b'),_0x28f11e,_0x532c6a));}});};Preview[_0x1cd0('0x10')][_0x1cd0('0xa1')]=function(_0x4147a8){return!_[_0x1cd0('0x74')](_0x4147a8)&&!_[_0x1cd0('0x74')](_0x4147a8['name'])&&!_[_0x1cd0('0x74')](_0x4147a8[_0x1cd0('0x5b')])&&_0x4147a8['active']&&!_['isNil'](this[_0x1cd0('0x17')][util[_0x1cd0('0x5f')](_0x1cd0('0x10c'),_0x4147a8[_0x1cd0('0x2f')])])&&!_[_0x1cd0('0x74')](this[_0x1cd0('0x17')][util['format'](_0x1cd0('0x10c'),_0x4147a8['name'])][_0x1cd0('0x80')])&&(this[_0x1cd0('0x17')][util[_0x1cd0('0x5f')](_0x1cd0('0x10c'),_0x4147a8[_0x1cd0('0x2f')])][_0x1cd0('0x80')]===_0x1cd0('0x10d')||this[_0x1cd0('0x17')][util[_0x1cd0('0x5f')](_0x1cd0('0x10c'),_0x4147a8[_0x1cd0('0x2f')])]['status']===_0x1cd0('0x10e'));};Preview[_0x1cd0('0x10')][_0x1cd0('0x8e')]=function(_0x447e5c,_0x1ac7d7){var _0x3b8b48=this;return new BPromise(function(_0x1c2d75,_0x58a65f){_0x3b8b48[_0x1cd0('0x10f')](_0x447e5c,_0x1ac7d7)[_0x1cd0('0x8f')](function(_0xa0f481){_0x1c2d75(_[_0x1cd0('0x7a')](_0xa0f481,[_0x1cd0('0x66')]));})[_0x1cd0('0x82')](function(_0xa5581f){if(_0xa5581f[_0x1cd0('0x110')]){rpcDb[_0x1cd0('0x111')](_0x447e5c);}if(_0xa5581f['active']){rpcDb[_0x1cd0('0x92')](_0x447e5c);}_0x58a65f(_['pick'](_0xa5581f,[_0x1cd0('0x66')]));});});};Preview[_0x1cd0('0x10')]['execRun']=function(_0x1d75f9,_0x3a6219){var _0x1ac815=this;return new BPromise(function(_0x184901,_0x4f9fed){var _0x58d8e3,_0x30c80e;rpcDb['getContactPreview'](_0x1d75f9)[_0x1cd0('0x8f')](function(_0x153a37){if(!_[_0x1cd0('0x74')](_0x153a37[0x0])){_0x30c80e=_0x153a37[0x0]['recallme']?![]:!![];_0x58d8e3=_0x153a37[0x0][_0x1cd0('0x112')]?!![]:![];_0x58d8e3=_0x3a6219?!![]:_0x58d8e3;}var _0x14dc38=_0x1ac815['validateContact'](_0x153a37);if(_0x14dc38[_0x1cd0('0x113')]){rpcDb[_0x1cd0('0x114')](_['pick'](_0x153a37[0x0],[_0x1cd0('0x7d'),_0x1cd0('0x115')]))[_0x1cd0('0x8f')](function(_0x288665){_0x1ac815[_0x1cd0('0xfc')](_0x288665,_0x153a37[0x0],_0x3a6219,_0x30c80e,_0x58d8e3)[_0x1cd0('0x8f')](function(_0x2cfec8){_0x184901(_0x2cfec8);})[_0x1cd0('0x82')](function(_0x5a493a){_0x4f9fed(_0x5a493a);});})[_0x1cd0('0x82')](function(_0x28f926){ut[_0x1cd0('0x67')](_0x1cd0('0x116'),_0x28f926);_0x4f9fed(ut[_0x1cd0('0x66')]('Call\x20unsuccessful',_0x30c80e,_0x58d8e3));});}else{_0x4f9fed(ut['message'](_0x14dc38['message'],_0x30c80e,_0x58d8e3));}})[_0x1cd0('0x82')](function(_0x1039a3){ut[_0x1cd0('0x67')](_0x1cd0('0x117'),_0x1039a3);_0x4f9fed(ut[_0x1cd0('0x66')](_0x1cd0('0x118'),![],!![]));});});};Preview['prototype'][_0x1cd0('0x119')]=function(_0x3c55ba){if(_[_0x1cd0('0x74')](_0x3c55ba)||_[_0x1cd0('0x11a')](_0x3c55ba)||!_[_0x1cd0('0x74')](_0x3c55ba[0x0][_0x1cd0('0x8c')])&&_[_0x1cd0('0x74')](_0x3c55ba[0x0]['Agent']['name'])){ut[_0x1cd0('0x67')](_0x1cd0('0x11b'),_0x3c55ba);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x208fd3=this[_0x1cd0('0x15')][_0x3c55ba[0x0][_0x1cd0('0xff')][_0x1cd0('0x2f')]];_0x208fd3[_0x1cd0('0x66')]=_0x1cd0('0xa3');if(_[_0x1cd0('0x74')](_0x208fd3)){ut['logger'](_0x1cd0('0x11c'),_0x208fd3);return{'isValid':![],'message':_0x1cd0('0x11d')};}if(!this[_0x1cd0('0xa1')](_0x208fd3['Trunk'])){ut[_0x1cd0('0x67')](_0x1cd0('0x11e'),_0x1cd0('0x11f')+_0x208fd3[_0x1cd0('0x2f')]+_0x1cd0('0x120'));if(!this[_0x1cd0('0xa1')](_0x208fd3[_0x1cd0('0x121')])){ut[_0x1cd0('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x208fd3[_0x1cd0('0x2f')]+_0x1cd0('0x122'));return{'isValid':![],'message':_0x1cd0('0x123')};}}if(!ut[_0x1cd0('0xa0')](_0x208fd3[_0x1cd0('0x39')])){ut[_0x1cd0('0x67')](_0x1cd0('0x124'),_0x208fd3[_0x1cd0('0x2f')]+_0x1cd0('0x125'));return{'isValid':![],'message':_0x1cd0('0x11f')+_0x208fd3[_0x1cd0('0x2f')]+_0x1cd0('0x125')};}return{'isValid':!![],'message':_0x1cd0('0x126')};};Preview[_0x1cd0('0x10')][_0x1cd0('0x100')]=function(_0x26052e,_0x45be40,_0x2f51c1,_0x153aad){var _0x3c8237=this;return new BPromise(function(_0x344881,_0x807a66){var _0x13f7e7=_0x26052e[_0x1cd0('0xbf')];var _0x1144db=_0x3c8237[_0x1cd0('0xa1')](_0x45be40[_0x1cd0('0x5a')])?util[_0x1cd0('0x5f')](_0x1cd0('0x127'),_0x45be40[_0x1cd0('0x5a')]['name'],_[_0x1cd0('0x74')](_0x45be40['dialPrefix'])?'':_0x45be40[_0x1cd0('0x128')][_0x1cd0('0x129')]()||'',_0x45be40[_0x1cd0('0x12a')]>0x0?_0x2f51c1[_0x1cd0('0xfd')][_0x1cd0('0x12b')]['substring'](_0x45be40[_0x1cd0('0x12a')]):_0x2f51c1['Contact'][_0x1cd0('0x12b')]):util[_0x1cd0('0x5f')]('SIP/%s/%s%s',_[_0x1cd0('0x74')](_0x45be40['TrunkBackup'])?_0x45be40[_0x1cd0('0x5a')][_0x1cd0('0x2f')]:_0x45be40[_0x1cd0('0x121')]['name'],_['isNil'](_0x45be40['dialPrefix'])?'':_0x45be40['dialPrefix'][_0x1cd0('0x129')]()||'',_0x45be40['dialCutDigit']>0x0?_0x2f51c1[_0x1cd0('0xfd')][_0x1cd0('0x12b')]['substring'](_0x45be40[_0x1cd0('0x12a')]):_0x2f51c1['Contact'][_0x1cd0('0x12b')]);var _0x57ec98=_0x3c8237['isTrunkReachable'](_0x45be40[_0x1cd0('0x5a')])?ut['getCallerId'](_0x45be40['Trunk'][_0x1cd0('0x5c')],_0x45be40[_0x1cd0('0x12c')],_0x45be40['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x1cd0('0x12d')](_0x45be40[_0x1cd0('0x3b')],_0x45be40[_0x1cd0('0x12e')]):_0x45be40[_0x1cd0('0x3b')]):ut['getCallerId'](_[_0x1cd0('0x74')](_0x45be40[_0x1cd0('0x121')])?_0x45be40['Trunk']['callerid']:_0x45be40['TrunkBackup']['callerid'],_0x45be40['dialOriginateCallerIdName'],_0x45be40['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x45be40['dialOriginateCallerIdNumber'],_0x45be40['dialRandomLastDigitCallerIdNumber']):_0x45be40[_0x1cd0('0x3b')]);if(_0x57ec98){_0x26052e[_0x1cd0('0x12f')]=ut['extractCalleridName'](_0x57ec98);_0x26052e[_0x1cd0('0x130')]=ut[_0x1cd0('0x131')](_0x57ec98);}var _0x15fb1e=ut['addVariables'](_0x45be40,_0x2f51c1,_0x1144db,_0x57ec98,_0x13f7e7,_0x26052e);_[_0x1cd0('0x132')](_0x26052e,ut[_0x1cd0('0x133')](_0x15fb1e));_0x26052e[_0x1cd0('0x93')]=moment()[_0x1cd0('0x5f')](_0x1cd0('0x94'));ami[_0x1cd0('0x7f')](ut[_0x1cd0('0x134')](_0x26052e,_0x45be40,_0x15fb1e,_0x26052e[_0x1cd0('0xcb')],_0x153aad))[_0x1cd0('0x8f')](function(_0x3d20a3){_0x45be40[_0x1cd0('0x54')]+=0x1;logger['info']('[originated][increment]',_0x13f7e7,_0x1cd0('0xc0'),_0x45be40[_0x1cd0('0x2f')],_0x1cd0('0x77'),_0x45be40[_0x1cd0('0x54')]);_0x344881(_0x3d20a3);})[_0x1cd0('0x82')](function(_0x437e84){ut[_0x1cd0('0xf4')](_0x26052e,0xe,_0x1cd0('0x135'));rpcDb['createAgentHistory'](_0x26052e,_0x1cd0('0x136'));_0x807a66(_0x437e84);});});};Preview[_0x1cd0('0x10')][_0x1cd0('0x24')]=function(_0x47f97f){if(this[_0x1cd0('0x18')][_0x47f97f[_0x1cd0('0xb0')]]){this['actions'][_0x47f97f['linkedid']][_0x1cd0('0x81')]=_0x47f97f[_0x1cd0('0x81')];}};Preview[_0x1cd0('0x10')][_0x1cd0('0x1b')]=function(_0x495182){var _0x3bdc69=this;var _0x18b192=this['actions'][_0x495182[_0x1cd0('0x137')]];if(_0x18b192){if(_0x18b192[_0x1cd0('0x138')]&&this[_0x1cd0('0x19')][_0x18b192[_0x1cd0('0x138')]]){ut['logLookAgent'](_0x18b192,this[_0x1cd0('0x19')][_0x18b192[_0x1cd0('0x138')]][_0x1cd0('0x2f')],this['agents'][_0x18b192['lookAgent']]['id']);}var _0x10d682=_['clone'](_0x18b192);_0x10d682[_0x1cd0('0xb1')]=moment()[_0x1cd0('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c2aac=_0x3bdc69[_0x1cd0('0x15')][_0x18b192['queue']];if(ut[_0x1cd0('0x139')](_0x495182['response'])){if(_0x18b192['unlockAgent']){rpcDb['unlockContact'](_0x18b192['idContact']);}if(_0x18b192[_0x1cd0('0xcb')]){rpcDb[_0x1cd0('0x92')](_0x18b192[_0x1cd0('0x13a')]);}ami[_0x1cd0('0x2c')](_0x1cd0('0x13b'),ut['buildObj'](_0x18b192,_0x1cd0('0x13c')));this[_0x1cd0('0xf0')](_0x10d682,_0x1c2aac,_0x495182);}else{_0x18b192['starttime']=moment()[_0x1cd0('0x5f')](_0x1cd0('0x94'));ut[_0x1cd0('0xf4')](_0x10d682,0x4,_0x1cd0('0x13d'));rpcDb['createAgentHistory'](_0x10d682,_0x1cd0('0x13e'));}}};Preview[_0x1cd0('0x10')][_0x1cd0('0x1d')]=function(_0x2c24f6){var _0x5c3341=this;var _0x544d54=this[_0x1cd0('0x18')][_0x2c24f6[_0x1cd0('0xb0')]];var _0x4cdc11;if(_0x544d54){_0x4cdc11=this['campaignsPreview'][_0x544d54[_0x1cd0('0x76')]];logger[_0x1cd0('0x62')](_0x1cd0('0x13f'),_0x2c24f6['linkedid'],'\x20Queue',_0x4cdc11['name'],_0x1cd0('0x78'),_0x4cdc11[_0x1cd0('0x33')]);}if(this[_0x1cd0('0x18')][_0x2c24f6[_0x1cd0('0xb0')]]&&_0x2c24f6[_0x1cd0('0xb0')]!==_0x2c24f6[_0x1cd0('0xbf')]){if(_0x2c24f6[_0x1cd0('0x140')]==='16'&&this['actions'][_0x2c24f6['linkedid']]['dialAnswer']){this[_0x1cd0('0x141')](_0x2c24f6,_0x2c24f6[_0x1cd0('0xb0')],_0x2c24f6[_0x1cd0('0x140')]);}else if(this[_0x1cd0('0x18')][_0x2c24f6[_0x1cd0('0xb0')]]['dialAnswer']){logger[_0x1cd0('0x62')](_0x1cd0('0x142'),_0x2c24f6['linkedid'],_0x2c24f6[_0x1cd0('0x140')],_0x1cd0('0xc0'),_0x4cdc11[_0x1cd0('0x2f')],'pTalking:\x20',_0x4cdc11[_0x1cd0('0x33')]);this['callProgressDetectingCustomer'](_0x2c24f6,_0x2c24f6['linkedid'],_0x2c24f6[_0x1cd0('0x140')]);}}else if(_0x544d54&&_['isNil'](_0x544d54[_0x1cd0('0x143')])&&_0x4cdc11[_0x1cd0('0x144')]&&_0x2c24f6['linkedid']===_0x2c24f6['uniqueid']&&_[_0x1cd0('0x74')](_0x2c24f6[_0x1cd0('0xf3')])&&_0x2c24f6[_0x1cd0('0x140')]==='16'&&_0x2c24f6[_0x1cd0('0x145')]==='6'&&_[_0x1cd0('0xf2')](_0x544d54[_0x1cd0('0x146')])){if(_0x544d54[_0x1cd0('0xaf')]){rpcDb['unlockContact'](_0x544d54[_0x1cd0('0x13a')]);}if(_0x544d54[_0x1cd0('0xcb')]){rpcDb[_0x1cd0('0x92')](_0x544d54[_0x1cd0('0x13a')]);}_0x2c24f6['reason']='22';this[_0x1cd0('0xf0')](_0x544d54,_0x4cdc11,_0x2c24f6);}else if(_0x544d54&&_0x544d54[_0x1cd0('0x146')]){if(_0x2c24f6[_0x1cd0('0x140')]==='16'&&this['actions'][_0x2c24f6[_0x1cd0('0xb0')]][_0x1cd0('0x79')]){logger[_0x1cd0('0x62')](_0x1cd0('0x147'),_0x2c24f6['linkedid'],_0x2c24f6[_0x1cd0('0x140')],_0x1cd0('0xc0'),_0x4cdc11[_0x1cd0('0x2f')],_0x1cd0('0x78'),_0x4cdc11['pTalking']);this['callProgressDetectingCustomer'](_0x2c24f6,_0x2c24f6[_0x1cd0('0xb0')],_0x2c24f6[_0x1cd0('0x140')]);}else if(this[_0x1cd0('0x18')][_0x2c24f6[_0x1cd0('0xb0')]]['dialAnswer']){logger[_0x1cd0('0x62')](_0x1cd0('0x142'),_0x2c24f6[_0x1cd0('0xb0')],_0x2c24f6[_0x1cd0('0x140')],_0x1cd0('0xc0'),_0x4cdc11[_0x1cd0('0x2f')],'pTalking:\x20',_0x4cdc11['pTalking']);this['callProgressDetectingCustomer'](_0x2c24f6,_0x2c24f6[_0x1cd0('0xb0')],_0x2c24f6[_0x1cd0('0x140')]);}}};Preview['prototype'][_0x1cd0('0x22')]=function(_0x189b2c){if(this[_0x1cd0('0x18')][_0x189b2c[_0x1cd0('0x148')]]&&_0x189b2c[_0x1cd0('0x148')]!==_0x189b2c[_0x1cd0('0x149')]){this[_0x1cd0('0x141')](_0x189b2c,_0x189b2c['destlinkedid'],_0x189b2c[_0x1cd0('0xeb')]);}};Preview[_0x1cd0('0x10')][_0x1cd0('0x1f')]=function(_0x2655bd){if(this[_0x1cd0('0x18')][_0x2655bd[_0x1cd0('0xb0')]]&&_0x2655bd['linkedid']!==_0x2655bd[_0x1cd0('0xbf')]&&!this[_0x1cd0('0x18')][_0x2655bd['linkedid']][_0x1cd0('0x79')]){if(_0x2655bd[_0x1cd0('0x140')]==='1'){this[_0x1cd0('0x141')](_0x2655bd,_0x2655bd[_0x1cd0('0xb0')],_0x2655bd[_0x1cd0('0x140')]);}}};Preview[_0x1cd0('0x10')][_0x1cd0('0x14a')]=function(_0x53be29,_0x459ca5,_0x6c0abf){if(this[_0x1cd0('0x18')][_0x53be29]){if(_[_0x1cd0('0x74')](this[_0x1cd0('0x18')][_0x53be29][_0x1cd0('0x14b')])){this['actions'][_0x53be29][_0x1cd0('0x14b')]={};}this[_0x1cd0('0x18')][_0x53be29][_0x1cd0('0x14b')][_0x459ca5]=_0x6c0abf;}};Preview['prototype'][_0x1cd0('0x26')]=function(_0x2535d1){try{if(!_[_0x1cd0('0x74')](_0x2535d1)){if(ut[_0x1cd0('0x14c')](_[_0x1cd0('0x14d')](_0x2535d1[_0x1cd0('0x14e')])[0x0])){this[_0x1cd0('0x14a')](_0x2535d1['uniqueid'],_['keys'](_0x2535d1[_0x1cd0('0x14e')])[0x0],_0x2535d1[_0x1cd0('0x14f')]);}}}catch(_0x5bffcb){logger[_0x1cd0('0x150')]('[syncVarSet][Preview]',util[_0x1cd0('0x151')](_0x5bffcb,{'showHidden':![],'depth':null}));}};Preview[_0x1cd0('0x10')][_0x1cd0('0x28')]=function(_0x294cac){if(_0x294cac){if(this[_0x1cd0('0x18')][_0x294cac['transfertargetlinkedid']]){this['actions'][_0x294cac[_0x1cd0('0x152')]][_0x1cd0('0x146')]=!![];}}};Preview[_0x1cd0('0x10')]['syncBlindTransfer']=function(_0x18eba5){if(_0x18eba5){if(this[_0x1cd0('0x18')][_0x18eba5[_0x1cd0('0x153')]]){this['actions'][_0x18eba5['transfererlinkedid']][_0x1cd0('0x146')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x4ec2=['syncBlindTransfer','loopCampaigns','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','agentReadyId','then','getDiff','Agent','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','emit','custom:agentConnectPreview','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','syncHangup','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4ec2,0x12a));var _0x24ec=function(_0x1a43c1,_0x2b7e46){_0x1a43c1=_0x1a43c1-0x0;var _0x558430=_0x4ec2[_0x1a43c1];return _0x558430;};'use strict';var util=require(_0x24ec('0x0'));var _=require(_0x24ec('0x1'));var BPromise=require(_0x24ec('0x2'));var uuid=require(_0x24ec('0x3'));var moment=require(_0x24ec('0x4'));var md5=require(_0x24ec('0x5'));var Redis=require(_0x24ec('0x6'));var config=require('../../../config/environment');var logger=require(_0x24ec('0x7'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x24ec('0x8'));var rpcDb=require(_0x24ec('0x9'));var Action=require(_0x24ec('0xa'));var ut=require('./util/util');config[_0x24ec('0xb')]=_[_0x24ec('0xc')](config[_0x24ec('0xb')],{'host':_0x24ec('0xd'),'port':0x18eb});var io=require(_0x24ec('0xe'))(new Redis(config[_0x24ec('0xb')]));var Sequence=function(){};Sequence[_0x24ec('0xf')][_0x24ec('0x10')]=function(_0x8cb2c6){this[_0x24ec('0x11')]=this['tail']?this[_0x24ec('0x11')][_0x24ec('0x12')](_0x8cb2c6):_0x8cb2c6();};function Preview(_0x2559d7){this['sequence']=new Sequence();this[_0x24ec('0x13')]=_0x2559d7[_0x24ec('0x14')];this[_0x24ec('0x15')]=_0x2559d7[_0x24ec('0x15')];this[_0x24ec('0x16')]={};this['agents']=_0x2559d7[_0x24ec('0x17')];this[_0x24ec('0x18')]=0x0;ami['on'](_0x24ec('0x19'),this[_0x24ec('0x1a')][_0x24ec('0x1b')](this));ami['on'](_0x24ec('0x1c'),this['syncHangup'][_0x24ec('0x1b')](this));ami['on'](_0x24ec('0x1d'),this[_0x24ec('0x1e')][_0x24ec('0x1b')](this));ami['on']('dialend',this[_0x24ec('0x1f')][_0x24ec('0x1b')](this));ami['on'](_0x24ec('0x20'),this[_0x24ec('0x21')][_0x24ec('0x1b')](this));ami['on'](_0x24ec('0x22'),this[_0x24ec('0x23')]['bind'](this));ami['on'](_0x24ec('0x24'),this[_0x24ec('0x25')][_0x24ec('0x1b')](this));ami['on'](_0x24ec('0x26'),this[_0x24ec('0x27')][_0x24ec('0x1b')](this));this[_0x24ec('0x28')](this['campaignsPreview']);}function emit(_0x3f44eb,_0x2c31de,_0x51b4af){io['to'](_0x3f44eb)['emit'](_0x2c31de,_0x51b4af);}function emitCampaignPreview(_0x152b47){if(_0x152b47['type']==='outbound'){var _0x4c2b00={'id':_0x152b47['id'],'name':_0x152b47['name'],'strategy':_0x152b47['strategy'],'answered':_0x152b47['answered'],'available':_0x152b47[_0x24ec('0x29')],'loggedIn':_0x152b47[_0x24ec('0x2a')],'pTalking':_0x152b47[_0x24ec('0x2b')],'sumBillable':_0x152b47[_0x24ec('0x2c')],'sumDuration':_0x152b47[_0x24ec('0x2d')],'sumHoldTime':_0x152b47[_0x24ec('0x2e')]||0x0,'talking':_0x152b47[_0x24ec('0x2f')],'total':_0x152b47[_0x24ec('0x30')],'type':_0x152b47['type'],'unmanaged':_0x152b47[_0x24ec('0x31')],'abandoned':_0x152b47[_0x24ec('0x32')],'waiting':_0x152b47[_0x24ec('0x33')],'loggedInDb':_0x152b47[_0x24ec('0x34')],'dialActive':_0x152b47[_0x24ec('0x35')],'dialMethod':_0x152b47['dialMethod'],'dialOriginateCallerIdName':_0x152b47['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x152b47['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x152b47['dialOriginateTimeout'],'dialPrefix':_0x152b47['dialPrefix'],'outboundAnswerAgiCallsDay':_0x152b47[_0x24ec('0x36')],'outboundAnswerCallsDay':_0x152b47[_0x24ec('0x37')],'outboundBlacklistCallsDay':_0x152b47[_0x24ec('0x38')],'outboundBusyCallsDay':_0x152b47[_0x24ec('0x39')],'outboundCongestionCallsDay':_0x152b47[_0x24ec('0x3a')],'outboundDropCallsDayACS':_0x152b47['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x152b47[_0x24ec('0x3b')],'outboundDropCallsDayTimeout':_0x152b47[_0x24ec('0x3c')],'outboundNoAnswerCallsDay':_0x152b47[_0x24ec('0x3d')],'outboundNoSuchCallsDay':_0x152b47[_0x24ec('0x3e')],'outboundOriginateFailureCallsDay':_0x152b47[_0x24ec('0x3f')],'outboundReCallsDay':_0x152b47[_0x24ec('0x40')],'outboundRejectCallsDay':_0x152b47[_0x24ec('0x41')],'outboundUnknownCallsDay':_0x152b47['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x152b47[_0x24ec('0x42')],'predictiveIntervalAnsweredCalls':_0x152b47['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x152b47[_0x24ec('0x43')],'predictiveIntervalAvgTalktime':_0x152b47[_0x24ec('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x152b47[_0x24ec('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x152b47[_0x24ec('0x46')],'predictiveIntervalErlangCalls':_0x152b47[_0x24ec('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x152b47[_0x24ec('0x48')],'predictiveIntervalHitRate':_0x152b47[_0x24ec('0x49')],'predictiveIntervalMultiplicativeFactor':_0x152b47[_0x24ec('0x4a')],'predictiveIntervalPauses':_0x152b47[_0x24ec('0x4b')],'predictiveIntervalAvailable':_0x152b47['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x152b47[_0x24ec('0x4c')],'message':_0x152b47['message'],'originated':_0x152b47[_0x24ec('0x4d')],'erlangCalls':_0x152b47['erlangCalls'],'erlangCallToSecond':_0x152b47['erlangCallToSecond'],'erlangAbandonmentRate':_0x152b47[_0x24ec('0x4e')],'erlangBusyFactor':_0x152b47[_0x24ec('0x4f')],'startPredictive':_0x152b47[_0x24ec('0x50')],'startProgressive':_0x152b47[_0x24ec('0x51')]};if(_0x152b47[_0x24ec('0x52')]){_0x4c2b00[_0x24ec('0x52')]={'id':_0x152b47[_0x24ec('0x52')]['id'],'name':_0x152b47[_0x24ec('0x52')][_0x24ec('0x53')],'active':_0x152b47[_0x24ec('0x52')][_0x24ec('0x54')],'callerid':_0x152b47[_0x24ec('0x52')][_0x24ec('0x55')]};}if(_0x152b47[_0x24ec('0x56')]){_0x4c2b00['Interval']={'id':_0x152b47[_0x24ec('0x56')]['id'],'name':_0x152b47[_0x24ec('0x56')]['name']};}var _0xbdc363=md5(JSON[_0x24ec('0x57')](_0x4c2b00));if(_0x152b47['md5']!==_0xbdc363){_0x152b47['md5']=_0xbdc363;emit(util[_0x24ec('0x58')](_0x24ec('0x59'),_0x4c2b00[_0x24ec('0x53')]),_0x24ec('0x5a'),_0x4c2b00);}}}function emitVoiceQueueChannelRemove(_0x1f134b){logger[_0x24ec('0x5b')](_0x24ec('0x5c'),JSON['stringify'](_0x1f134b));emit(util[_0x24ec('0x58')]('voice:queue:%s',_0x1f134b[_0x24ec('0x53')]),_0x24ec('0x5d'),_0x1f134b);}function notSendMessagesQueue(_0x905592){if(_0x905592[_0x24ec('0x5e')]){if(_0x905592[_0x24ec('0x4d')]===0x0&&_0x905592[_0x24ec('0x2b')]===0x0){_0x905592[_0x24ec('0x5e')]=![];_0x905592[_0x24ec('0x29')]=0x0;_0x905592[_0x24ec('0x5f')]=0x0;_0x905592[_0x24ec('0x60')]=_0x24ec('0x61');ut[_0x24ec('0x62')](_0x24ec('0x63'),_0x905592['name']+_0x24ec('0x64'));}else{_0x905592['message']=_0x24ec('0x65');ut[_0x24ec('0x62')](_0x24ec('0x63'),_0x905592[_0x24ec('0x53')]+_0x24ec('0x66'));}emitCampaignPreview(_0x905592);}}Preview[_0x24ec('0xf')][_0x24ec('0x28')]=function(){var _0x39f641=this;setInterval(function(){_0x39f641[_0x24ec('0x67')]();},0x7cf);};Preview['prototype'][_0x24ec('0x67')]=function(){var _0x7c71d0=this[_0x24ec('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x1ddf83 in _0x7c71d0){if(_0x7c71d0[_0x24ec('0x68')](_0x1ddf83)&&(_0x7c71d0[_0x1ddf83][_0x24ec('0x69')]===_0x24ec('0x6a')||_0x7c71d0[_0x1ddf83]['dialMethod']===_0x24ec('0x6b'))&&_0x7c71d0[_0x1ddf83][_0x24ec('0x6c')]===_0x24ec('0x6d')){if(this['clockClearZombieChannels']>0x7){this[_0x24ec('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x7c71d0[_0x24ec('0x68')](_0x1ddf83)&&_0x7c71d0[_0x1ddf83][_0x24ec('0x69')]===_0x24ec('0x6a')&&_0x7c71d0[_0x1ddf83][_0x24ec('0x6c')]===_0x24ec('0x6d')){if(_0x7c71d0[_0x1ddf83][_0x24ec('0x35')]){this['setMessage'](_0x7c71d0[_0x1ddf83]);this[_0x24ec('0x6e')](_0x7c71d0[_0x1ddf83]);}else{notSendMessagesQueue(_0x7c71d0[_0x1ddf83]);}}}};Preview['prototype'][_0x24ec('0x6f')]=function(_0x10cc21){var _0x1586a9=this;this[_0x24ec('0x70')]['enqueue'](function(){if(!_[_0x24ec('0x71')](_0x1586a9[_0x24ec('0x16')][_0x10cc21])){loggerAction['info'](_0x24ec('0x72'),_0x10cc21,_0x24ec('0x73'),_0x1586a9[_0x24ec('0x16')][_0x10cc21][_0x24ec('0x74')],_0x24ec('0x75'),JSON[_0x24ec('0x57')](_0x1586a9[_0x24ec('0x13')][_0x1586a9[_0x24ec('0x16')][_0x10cc21][_0x24ec('0x74')]][_0x24ec('0x4d')]),_0x24ec('0x76'),JSON[_0x24ec('0x57')](_0x1586a9['campaignsPreview'][_0x1586a9['actions'][_0x10cc21][_0x24ec('0x74')]]['pTalking']),JSON[_0x24ec('0x57')](_0x1586a9[_0x24ec('0x16')][_0x10cc21]['dialAnswer']),JSON[_0x24ec('0x57')](_[_0x24ec('0x77')](_0x1586a9[_0x24ec('0x16')][_0x10cc21],[_0x24ec('0x78'),'UserId',_0x24ec('0x79'),_0x24ec('0x7a')])));return ami[_0x24ec('0x7b')]({'action':_0x24ec('0x7c'),'channel':_0x1586a9['actions'][_0x10cc21][_0x24ec('0x7d')]})[_0x24ec('0x7e')](function(_0x3853f9){if(_0x3853f9[_0x24ec('0x60')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1586a9['actions'][_0x10cc21]){ut[_0x24ec('0x7f')](_0x1586a9['campaignsPreview'][_0x1586a9[_0x24ec('0x16')][_0x10cc21][_0x24ec('0x74')]],'[clearZombieChannel]');if(_0x1586a9[_0x24ec('0x16')][_0x10cc21][_0x24ec('0x80')]===!![]){ut[_0x24ec('0x81')](_0x1586a9[_0x24ec('0x13')][_0x1586a9[_0x24ec('0x16')][_0x10cc21]['queue']],_0x24ec('0x82'));ut[_0x24ec('0x83')](_0x24ec('0x84')+_0x10cc21,_0x1586a9[_0x24ec('0x16')][_0x10cc21][_0x24ec('0x74')]);}ut[_0x24ec('0x83')](_0x24ec('0x85')+_0x10cc21,_0x1586a9['actions'][_0x10cc21][_0x24ec('0x74')]);delete _0x1586a9[_0x24ec('0x16')][_0x10cc21];}},0x2328);}});}});};Preview['prototype'][_0x24ec('0x86')]=function(){var _0x4691a4=this;loggerAction[_0x24ec('0x5b')]('[action]',_[_0x24ec('0x87')](this[_0x24ec('0x16')]));for(var _0x461a45 in this['actions']){if(_0x4691a4[_0x24ec('0x16')]['hasOwnProperty'](_0x461a45)){_0x4691a4[_0x24ec('0x6f')](_0x461a45);}}};Preview['prototype']['recallMe']=function(_0x1d7843){var _0x2b9d27=this;rpcDb['getContactRecallMe'](_0x1d7843['id'],ut[_0x24ec('0x88')](this['agents']))[_0x24ec('0x89')](function(_0x7595de){if(!_[_0x24ec('0x71')](_0x7595de)){for(var _0x5bc6e5=0x0;_0x5bc6e5<_0x7595de['length'];_0x5bc6e5+=0x1){if(ut[_0x24ec('0x8a')](_0x7595de[_0x5bc6e5]['scheduledat'])<_0x1d7843['dialRecallMeTimeout']*0x3c){if(_0x7595de[_0x5bc6e5]['Agent']&&!_0x7595de[_0x5bc6e5][_0x24ec('0x8b')]['voicePause']){_0x2b9d27[_0x24ec('0x8c')](_0x7595de[_0x5bc6e5]['id'])[_0x24ec('0x89')](ut[_0x24ec('0x8d')](_0x24ec('0x8e')))[_0x24ec('0x7e')](ut[_0x24ec('0x8d')](_0x24ec('0x8e')));}else{rpcDb[_0x24ec('0x8f')](_0x7595de[_0x5bc6e5]['id']);}}else{var _0x580a03=new Action(_0x7595de[_0x5bc6e5],_0x1d7843);_0x580a03[_0x24ec('0x90')]=moment()[_0x24ec('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d7843['outboundReCallsDay']+=0x1;ut[_0x24ec('0x91')](_0x580a03,0x17,_0x24ec('0x92'));if(_0x1d7843['dialRecallInQueue']){rpcDb[_0x24ec('0x93')](ut[_0x24ec('0x94')](_0x7595de[_0x5bc6e5]));rpcDb[_0x24ec('0x95')](_0x580a03,_0x24ec('0x96'));}else{ut[_0x24ec('0x91')](_0x580a03,0x16,_0x24ec('0x97'));rpcDb['createCustomerHistory'](_0x580a03,_0x24ec('0x98'));rpcDb[_0x24ec('0x99')](_0x580a03,_0x24ec('0x98'));}}}}})[_0x24ec('0x7e')](ut[_0x24ec('0x8d')](_0x24ec('0x9a')));};Preview['prototype'][_0x24ec('0x9b')]=function(_0x236400){_0x236400[_0x24ec('0x5e')]=!![];if(ut['IsNotLoggedIn'](_0x236400[_0x24ec('0x2a')])){_0x236400[_0x24ec('0x60')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x236400[_0x24ec('0x35')])){_0x236400['message']='NOT_ACTIVE';}else if(!this[_0x24ec('0x9c')](_0x236400[_0x24ec('0x52')])){if(!this[_0x24ec('0x9c')](_0x236400[_0x24ec('0x9d')])){_0x236400[_0x24ec('0x60')]=_0x24ec('0x9e');}else{_0x236400[_0x24ec('0x60')]='ACTIVE';}}else{_0x236400['message']=_0x24ec('0x9f');}emitCampaignPreview(_0x236400);};Preview[_0x24ec('0xf')][_0x24ec('0xa0')]=function(_0xa84a65,_0xf22866,_0x255ec1){var _0x21e624=this;var _0x4f93b3=this[_0x24ec('0x16')][_0xf22866];var _0x11ee98=this[_0x24ec('0x13')][_0x4f93b3['queue']];var _0x5e2843;if(_0x11ee98){switch(_0x255ec1){case'1':_0x11ee98[_0x24ec('0x3e')]+=0x1;_0x4f93b3[_0x24ec('0xa1')]+=0x1;_0x4f93b3[_0x24ec('0xa2')]=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0x0,_0x24ec('0xa4'));ami['emit'](_0x24ec('0xa5'),ut[_0x24ec('0xa6')](_0x4f93b3,'nosuchnumber'));rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xa7'));if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98['dialGlobalMaxRetry']){_0x5e2843=ut[_0x24ec('0xa8')](_0x4f93b3,0xf,_0x24ec('0xa9'));rpcDb[_0x24ec('0x99')](_0x5e2843,_0x24ec('0xaa'));}else{if(_0x4f93b3[_0x24ec('0xa1')]>=_0x11ee98[_0x24ec('0xab')]){rpcDb[_0x24ec('0x99')](_0x4f93b3,_0x24ec('0xaa'));}else{rpcDb[_0x24ec('0xac')](ut['scheduledAt'](_0x4f93b3,_0x24ec('0xa1'),_0x11ee98[_0x24ec('0xad')]),_0x4f93b3[_0x24ec('0xae')],_0x4f93b3[_0x24ec('0xaf')]);}}delete this['actions'][_0xa84a65[_0x24ec('0xb0')]];break;case _0x24ec('0xb1'):var _0x35a47f=moment()[_0x24ec('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f93b3[_0x24ec('0xb2')]=_0x35a47f;_0x4f93b3[_0x24ec('0xb3')]=_0x35a47f;_0x4f93b3[_0x24ec('0x80')]=!![];_0x11ee98['pTalking']+=0x1;logger[_0x24ec('0x5b')](_0x24ec('0xb4'),_0x4f93b3[_0x24ec('0xb5')],_0x24ec('0xb6'),_0x11ee98[_0x24ec('0x53')],_0x24ec('0x76'),_0x11ee98['pTalking']);ami['emit'](_0x24ec('0xb7'),ut[_0x24ec('0xa6')](_0x4f93b3,_0x24ec('0xb8')));if(_0x11ee98[_0x24ec('0xb9')]){ami[_0x24ec('0xba')](_0x24ec('0xbb'),ut['buildAcw'](_0x4f93b3));}break;case'16':ami[_0x24ec('0xba')]('custom:agentcomplete',ut['buildObj'](_0x4f93b3,_0x24ec('0xbc')));emitVoiceQueueChannelRemove(ut[_0x24ec('0xa6')](_0x4f93b3,'complete'));_0x11ee98[_0x24ec('0x37')]+=0x1;_0x11ee98['total']+=0x1;_0x11ee98[_0x24ec('0xbd')]+=0x1;ut[_0x24ec('0x81')](_0x11ee98,'[16]');_0x4f93b3[_0x24ec('0xa2')]=ut[_0x24ec('0xa3')](_0x4f93b3);ut['logCustomer'](_0x4f93b3,0x4,_0x24ec('0xbe'));rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xbf'));rpcDb[_0x24ec('0x99')](_0x4f93b3,_0x24ec('0xc0'));rpcDb['crateCustomerReportQueue'](_0x4f93b3);_0x11ee98[_0x24ec('0x2d')]+=_0x4f93b3[_0x24ec('0xc1')];_0x11ee98['sumBillable']+=_0x4f93b3['talktime'];logger[_0x24ec('0x5b')]('[syncHangup][talking][decrement]',_0x4f93b3[_0x24ec('0xb5')],'\x20Queue',_0x11ee98['name'],_0x24ec('0x76'),_0x11ee98[_0x24ec('0x2b')]);delete this[_0x24ec('0x16')][_0xa84a65[_0x24ec('0xb0')]];break;case _0x24ec('0xc2'):_0x11ee98[_0x24ec('0x39')]+=0x1;_0x4f93b3[_0x24ec('0xc3')]+=0x1;_0x4f93b3[_0x24ec('0xa2')]=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0x5,_0x24ec('0xc4'));ami['emit'](_0x24ec('0xc5'),ut['buildObj'](_0x4f93b3,_0x24ec('0xc6')));rpcDb['createCustomerHistory'](_0x4f93b3,_0x24ec('0xc7'));if(ut['totalGlobal'](_0x4f93b3)>=_0x11ee98[_0x24ec('0xc8')]){_0x5e2843=ut[_0x24ec('0xa8')](_0x4f93b3,0xf,_0x24ec('0xa9'));rpcDb[_0x24ec('0x99')](_0x5e2843,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4f93b3[_0x24ec('0xc3')]>=_0x11ee98[_0x24ec('0xc9')]){rpcDb[_0x24ec('0x99')](_0x4f93b3,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x24ec('0xac')](ut[_0x24ec('0xca')](_0x4f93b3,_0x24ec('0xc3'),_0x11ee98[_0x24ec('0xcb')]),_0x4f93b3[_0x24ec('0xae')],_0x4f93b3[_0x24ec('0xaf')]);}}break;case _0x24ec('0xcc'):_0x11ee98['outboundNoAnswerCallsDay']+=0x1;_0x4f93b3[_0x24ec('0xcd')]+=0x1;_0x4f93b3['countglobal']=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0x3,'NoAnswer');ami[_0x24ec('0xba')](_0x24ec('0xce'),ut['buildObj'](_0x4f93b3,_0x24ec('0xcf')));rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xd0'));if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98[_0x24ec('0xc8')]){_0x5e2843=ut[_0x24ec('0xa8')](_0x4f93b3,0xf,_0x24ec('0xa9'));rpcDb['createCustomerFinal'](_0x5e2843,_0x24ec('0xd1'));}else{if(_0x4f93b3[_0x24ec('0xcd')]>=_0x11ee98['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x4f93b3,_0x24ec('0xd0'));}else{rpcDb[_0x24ec('0xac')](ut[_0x24ec('0xca')](_0x4f93b3,_0x24ec('0xcd'),_0x11ee98[_0x24ec('0xd2')]),_0x4f93b3[_0x24ec('0xae')],_0x4f93b3[_0x24ec('0xaf')]);}}break;case'CONGESTION':_0x11ee98['outboundCongestionCallsDay']+=0x1;_0x4f93b3['countcongestionretry']+=0x1;_0x4f93b3[_0x24ec('0xa2')]=ut['totalGlobal'](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0x8,_0x24ec('0xd3'));ami[_0x24ec('0xba')](_0x24ec('0xd4'),ut[_0x24ec('0xa6')](_0x4f93b3,_0x24ec('0xd5')));rpcDb[_0x24ec('0x95')](_0x4f93b3,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98['dialGlobalMaxRetry']){_0x5e2843=ut['cloneAction'](_0x4f93b3,0xf,'Global');rpcDb[_0x24ec('0x99')](_0x5e2843,_0x24ec('0xd6'));}else{if(_0x4f93b3['countcongestionretry']>=_0x11ee98['dialCongestionMaxRetry']){rpcDb[_0x24ec('0x99')](_0x4f93b3,_0x24ec('0xd7'));}else{rpcDb[_0x24ec('0xac')](ut[_0x24ec('0xca')](_0x4f93b3,_0x24ec('0xd8'),_0x11ee98[_0x24ec('0xcb')]),_0x4f93b3[_0x24ec('0xae')],_0x4f93b3[_0x24ec('0xaf')]);}}break;case _0x24ec('0xd9'):_0x11ee98[_0x24ec('0x41')]+=0x1;_0x4f93b3[_0x24ec('0xda')]+=0x1;_0x4f93b3['countglobal']=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0x14,'AgentReject');ami[_0x24ec('0xba')](_0x24ec('0xdb'),ut['buildObj'](_0x4f93b3,_0x24ec('0xdc')));rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xdd'));if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98['dialGlobalMaxRetry']){_0x5e2843=ut['cloneAction'](_0x4f93b3,0x14,_0x24ec('0xde'));rpcDb[_0x24ec('0x99')](_0x5e2843,_0x24ec('0xdf'));}else{if(_0x4f93b3[_0x24ec('0xda')]>=_0x11ee98[_0x24ec('0xe0')]){rpcDb['createCustomerFinal'](_0x4f93b3,_0x24ec('0xdf'));}else{rpcDb[_0x24ec('0xac')](ut[_0x24ec('0xca')](_0x4f93b3,_0x24ec('0xda'),_0x11ee98[_0x24ec('0xe1')]),_0x4f93b3[_0x24ec('0xae')],_0x4f93b3[_0x24ec('0xaf')]);}}break;case _0x24ec('0xe2'):_0x11ee98[_0x24ec('0x42')]+=0x1;_0x4f93b3['countabandonedretry']+=0x1;_0x4f93b3[_0x24ec('0xa2')]=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0xb,_0x24ec('0xe3'));rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xe4'));if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98['dialGlobalMaxRetry']){_0x5e2843=ut[_0x24ec('0xa8')](_0x4f93b3,0xf,_0x24ec('0xa9'));rpcDb[_0x24ec('0x99')](_0x5e2843,_0x24ec('0xe4'));}else{if(_0x4f93b3[_0x24ec('0xe5')]>=_0x11ee98[_0x24ec('0xe6')]){rpcDb[_0x24ec('0x99')](_0x4f93b3,_0x24ec('0xe4'));}else{rpcDb['rescheduleContact'](ut[_0x24ec('0xca')](_0x4f93b3,'countabandonedretry',_0x11ee98[_0x24ec('0xe7')]),_0x4f93b3['unlockAgent'],_0x4f93b3[_0x24ec('0xaf')]);}}break;default:if(_0x4f93b3[_0x24ec('0x80')]){ut[_0x24ec('0x81')](_0x11ee98,'[default]');ut['loggerError'](_0x24ec('0xe8')+_0x11ee98['name'],_0xa84a65);}_0x11ee98['outboundUnknownCallsDay']+=0x1;_0x4f93b3['countglobal']=ut[_0x24ec('0xa3')](_0x4f93b3);ut[_0x24ec('0x91')](_0x4f93b3,0xc,_0xa84a65['cause-txt']||_0xa84a65[_0x24ec('0xe9')]);rpcDb[_0x24ec('0x95')](_0x4f93b3,_0x24ec('0xea'));if(ut[_0x24ec('0xa3')](_0x4f93b3)>=_0x11ee98[_0x24ec('0xc8')]){_0x5e2843=ut['cloneAction'](_0x4f93b3,0xf,_0x24ec('0xa9'));rpcDb[_0x24ec('0x99')](_0x5e2843,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x24ec('0x99')](_0x4f93b3,_0x24ec('0xeb'));}delete this[_0x24ec('0x16')][_0xa84a65['linkedid']];}if(!(_0x4f93b3[_0x24ec('0x80')]&&_0x255ec1==='16')){ut['updateOriginated'](_0x11ee98,'[callProgressDetectingCustomer]');logger[_0x24ec('0x5b')](_0x24ec('0xec'),_0x4f93b3['uniqueid'],_0x24ec('0xb6'),_0x11ee98[_0x24ec('0x53')],_0x24ec('0x75'),_0x11ee98[_0x24ec('0x4d')]);}if(_0x255ec1!==_0x24ec('0xb1')){delete this['actions'][_0xa84a65[_0x24ec('0xb0')]];delete this[_0x24ec('0x16')][_0xa84a65['destlinkedid']];}}};Preview['prototype'][_0x24ec('0xed')]=function(_0x11beb2,_0xee68d5,_0x191112){if(_['isUndefined'](_0xee68d5)&&'object'!==typeof _0xee68d5){return;}if(_[_0x24ec('0xee')](_0x191112)&&_0x24ec('0xef')!==typeof _0x191112){return;}switch(_0x191112[_0x24ec('0xf0')]){case'0':ut[_0x24ec('0xf1')](_0x11beb2,0x0,'NoSuchNumber');rpcDb[_0x24ec('0xf2')](_0x11beb2,_0x24ec('0xf3'));break;case'3':ut[_0x24ec('0xf1')](_0x11beb2,0x3,_0x24ec('0xf4'));rpcDb[_0x24ec('0xf2')](_0x11beb2,_0x24ec('0xf5'));break;case'5':ut['logAgent'](_0x11beb2,0x5,'Busy');rpcDb[_0x24ec('0xf2')](_0x11beb2,_0x24ec('0xf6'));break;case'8':ut[_0x24ec('0xf1')](_0x11beb2,0x8,'Congestion');rpcDb[_0x24ec('0xf2')](_0x11beb2,_0x24ec('0xf7'));break;case'22':ut[_0x24ec('0xf1')](_0x11beb2,0x16,_0x24ec('0xf8'));rpcDb[_0x24ec('0xf2')](_0x11beb2,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x24ec('0xf1')](_0x11beb2,0xc,_0x191112['reason']);rpcDb[_0x24ec('0xf2')](_0x11beb2,'[callProgressDetectingAgent][logCongestion]');}ut[_0x24ec('0x7f')](_0xee68d5,_0x24ec('0xf9'));logger[_0x24ec('0x5b')](_0x24ec('0xfa'),_0x11beb2[_0x24ec('0xb5')],'\x20Queue',_0xee68d5[_0x24ec('0x53')],_0x24ec('0x75'),_0xee68d5[_0x24ec('0x4d')]);delete this[_0x24ec('0x16')][_0x11beb2[_0x24ec('0xb5')]];};Preview['prototype'][_0x24ec('0xfb')]=function(_0x1fb1d0,_0x5cd243,_0x5cd85f,_0x44285d,_0x5cbf61){var _0x1e93cc=this;return new BPromise(function(_0x561a71,_0xab8bd9){if(_[_0x24ec('0x71')](_0x5cd243)||_[_0x24ec('0x71')](_0x5cd243['Contact'])||_[_0x24ec('0x71')](_0x5cd243[_0x24ec('0xfc')][_0x24ec('0xfd')])||_[_0x24ec('0x71')](_0x5cd243['VoiceQueueId'])){_0xab8bd9(ut[_0x24ec('0x60')](_0x24ec('0xfe'),_0x44285d,_0x5cbf61));return;}var _0xf0af2c=uuid['v4']();var _0x2ca90b=_0x1e93cc['campaignsPreview'][_0x5cd243[_0x24ec('0x73')][_0x24ec('0x53')]];var _0x49a1a0=_0x5cd85f?_0x1e93cc['agents'][_0x5cd85f]['id']:undefined;_0x1e93cc['actions'][_0xf0af2c]=new Action(_0x5cd243,_0x2ca90b,_0xf0af2c,_0x5cd85f,_0x49a1a0);var _0x4563fb=_0x1e93cc[_0x24ec('0x16')][_0xf0af2c];_0x4563fb[_0x24ec('0xae')]=_0x44285d;_0x4563fb['activeContact']=_0x5cbf61;_0x4563fb[_0x24ec('0xff')]=_0x5cd85f;if(_[_0x24ec('0x100')](_0x1fb1d0)){_0x1e93cc[_0x24ec('0x101')](_0x4563fb,_0x2ca90b,_0x5cd243,_0x5cd85f)[_0x24ec('0x89')](function(_0x2bc7ec){logger[_0x24ec('0x5b')]('[Preview][execCall][success]',_0x24ec('0x102')+_0x4563fb['queue']+_0x24ec('0x103')+_0x4563fb[_0x24ec('0x104')],JSON[_0x24ec('0x57')](_0x2bc7ec));ami[_0x24ec('0xba')](_0x24ec('0x105'),ut[_0x24ec('0xa6')](_0x4563fb,_0x24ec('0x106')));_0x561a71(ut[_0x24ec('0x60')](_0x24ec('0x107')));})[_0x24ec('0x7e')](function(_0x427235){ut[_0x24ec('0x62')](_0x24ec('0x108'),_0x427235);_0xab8bd9(ut[_0x24ec('0x60')](_0x24ec('0x109'),_0x44285d,_0x5cbf61));});}else{_0x2ca90b[_0x24ec('0x38')]+=0x1;ut['logBlacklist'](_0x4563fb);rpcDb[_0x24ec('0x10a')](_0x4563fb,_0x24ec('0x10b'));delete _0x1e93cc[_0x24ec('0x16')][_0xf0af2c];_0xab8bd9(ut['message']('Contact\x20in\x20black\x20List',_0x44285d,_0x5cbf61));}});};Preview[_0x24ec('0xf')]['isTrunkReachable']=function(_0x55c95e){return!_['isNil'](_0x55c95e)&&!_[_0x24ec('0x71')](_0x55c95e[_0x24ec('0x53')])&&!_[_0x24ec('0x71')](_0x55c95e['active'])&&_0x55c95e[_0x24ec('0x54')]&&!_[_0x24ec('0x71')](this[_0x24ec('0x15')][util[_0x24ec('0x58')]('SIP/%s',_0x55c95e[_0x24ec('0x53')])])&&!_['isNil'](this[_0x24ec('0x15')][util[_0x24ec('0x58')](_0x24ec('0x10c'),_0x55c95e[_0x24ec('0x53')])]['status'])&&(this[_0x24ec('0x15')][util[_0x24ec('0x58')](_0x24ec('0x10c'),_0x55c95e[_0x24ec('0x53')])][_0x24ec('0x7c')]==='reachable'||this['trunks'][util[_0x24ec('0x58')](_0x24ec('0x10c'),_0x55c95e['name'])][_0x24ec('0x7c')]===_0x24ec('0x10d'));};Preview['prototype'][_0x24ec('0x8c')]=function(_0x5ebf99,_0x8e7f76){var _0x365119=this;return new BPromise(function(_0x2546af,_0x2e51bd){_0x365119[_0x24ec('0x10e')](_0x5ebf99,_0x8e7f76)[_0x24ec('0x89')](function(_0x462360){_0x2546af(_['pick'](_0x462360,[_0x24ec('0x60')]));})[_0x24ec('0x7e')](function(_0x231394){if(_0x231394[_0x24ec('0x10f')]){rpcDb[_0x24ec('0x110')](_0x5ebf99);}if(_0x231394[_0x24ec('0x54')]){rpcDb[_0x24ec('0x8f')](_0x5ebf99);}_0x2e51bd(_[_0x24ec('0x77')](_0x231394,[_0x24ec('0x60')]));});});};Preview[_0x24ec('0xf')][_0x24ec('0x10e')]=function(_0xac80ab,_0x37e6b0){var _0x1fec4a=this;return new BPromise(function(_0x46e9b4,_0xf00172){var _0x2fbb80,_0x3c1036;rpcDb[_0x24ec('0x111')](_0xac80ab)['then'](function(_0x262e36){if(!_[_0x24ec('0x71')](_0x262e36[0x0])){_0x3c1036=_0x262e36[0x0]['recallme']?![]:!![];_0x2fbb80=_0x262e36[0x0][_0x24ec('0x112')]?!![]:![];_0x2fbb80=_0x37e6b0?!![]:_0x2fbb80;}var _0x498515=_0x1fec4a[_0x24ec('0x113')](_0x262e36);if(_0x498515[_0x24ec('0x114')]){rpcDb[_0x24ec('0x115')](_['pick'](_0x262e36[0x0],[_0x24ec('0x79'),_0x24ec('0x116')]))[_0x24ec('0x89')](function(_0x1c2a14){_0x1fec4a['checkInBlack'](_0x1c2a14,_0x262e36[0x0],_0x37e6b0,_0x3c1036,_0x2fbb80)['then'](function(_0xa69eb3){_0x46e9b4(_0xa69eb3);})[_0x24ec('0x7e')](function(_0xd2f374){_0xf00172(_0xd2f374);});})['catch'](function(_0x140afb){ut['logger'](_0x24ec('0x117'),_0x140afb);_0xf00172(ut[_0x24ec('0x60')](_0x24ec('0x118'),_0x3c1036,_0x2fbb80));});}else{_0xf00172(ut[_0x24ec('0x60')](_0x498515[_0x24ec('0x60')],_0x3c1036,_0x2fbb80));}})[_0x24ec('0x7e')](function(_0x578563){ut[_0x24ec('0x62')](_0x24ec('0x119'),_0x578563);_0xf00172(ut[_0x24ec('0x60')](_0x24ec('0x118'),![],!![]));});});};Preview[_0x24ec('0xf')]['validateContact']=function(_0x29809c){if(_[_0x24ec('0x71')](_0x29809c)||_[_0x24ec('0x100')](_0x29809c)||!_[_0x24ec('0x71')](_0x29809c[0x0][_0x24ec('0x8b')])&&_[_0x24ec('0x71')](_0x29809c[0x0][_0x24ec('0x8b')][_0x24ec('0x53')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x29809c);return{'isValid':![],'message':_0x24ec('0x11a')};}var _0x39f64e=this[_0x24ec('0x13')][_0x29809c[0x0][_0x24ec('0x73')]['name']];_0x39f64e['message']=_0x24ec('0x9f');if(_[_0x24ec('0x71')](_0x39f64e)){ut[_0x24ec('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0x39f64e);return{'isValid':![],'message':_0x24ec('0x11b')};}if(!this['isTrunkReachable'](_0x39f64e[_0x24ec('0x52')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x24ec('0x11c')+_0x39f64e[_0x24ec('0x53')]+_0x24ec('0x11d'));if(!this[_0x24ec('0x9c')](_0x39f64e[_0x24ec('0x9d')])){ut[_0x24ec('0x62')](_0x24ec('0x11e'),_0x39f64e['name']+_0x24ec('0x11f'));return{'isValid':![],'message':_0x24ec('0x120')};}}if(!ut[_0x24ec('0x121')](_0x39f64e['dialActive'])){ut[_0x24ec('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x39f64e[_0x24ec('0x53')]+_0x24ec('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x39f64e[_0x24ec('0x53')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x24ec('0x123')};};Preview[_0x24ec('0xf')][_0x24ec('0x101')]=function(_0x3d833e,_0x5c1e18,_0x405aaa,_0x1a9761){var _0x29f3d4=this;return new BPromise(function(_0xe60385,_0x46d4ab){var _0xc1592e=_0x3d833e[_0x24ec('0xb5')];var _0x388a6c=_0x29f3d4[_0x24ec('0x9c')](_0x5c1e18['Trunk'])?util[_0x24ec('0x58')]('SIP/%s/%s%s',_0x5c1e18[_0x24ec('0x52')]['name'],_[_0x24ec('0x71')](_0x5c1e18[_0x24ec('0x124')])?'':_0x5c1e18[_0x24ec('0x124')]['trim']()||'',_0x5c1e18[_0x24ec('0x125')]>0x0?_0x405aaa[_0x24ec('0xfc')][_0x24ec('0xfd')][_0x24ec('0x126')](_0x5c1e18[_0x24ec('0x125')]):_0x405aaa[_0x24ec('0xfc')][_0x24ec('0xfd')]):util[_0x24ec('0x58')](_0x24ec('0x127'),_['isNil'](_0x5c1e18[_0x24ec('0x9d')])?_0x5c1e18[_0x24ec('0x52')]['name']:_0x5c1e18[_0x24ec('0x9d')][_0x24ec('0x53')],_[_0x24ec('0x71')](_0x5c1e18[_0x24ec('0x124')])?'':_0x5c1e18[_0x24ec('0x124')][_0x24ec('0x128')]()||'',_0x5c1e18[_0x24ec('0x125')]>0x0?_0x405aaa['Contact'][_0x24ec('0xfd')][_0x24ec('0x126')](_0x5c1e18[_0x24ec('0x125')]):_0x405aaa[_0x24ec('0xfc')][_0x24ec('0xfd')]);var _0x518c00=_0x29f3d4[_0x24ec('0x9c')](_0x5c1e18[_0x24ec('0x52')])?ut[_0x24ec('0x129')](_0x5c1e18[_0x24ec('0x52')]['callerid'],_0x5c1e18[_0x24ec('0x12a')],_0x5c1e18[_0x24ec('0x12b')]>0x0?ut[_0x24ec('0x12c')](_0x5c1e18[_0x24ec('0x12d')],_0x5c1e18[_0x24ec('0x12b')]):_0x5c1e18['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x24ec('0x71')](_0x5c1e18[_0x24ec('0x9d')])?_0x5c1e18[_0x24ec('0x52')][_0x24ec('0x55')]:_0x5c1e18['TrunkBackup']['callerid'],_0x5c1e18['dialOriginateCallerIdName'],_0x5c1e18[_0x24ec('0x12b')]>0x0?ut[_0x24ec('0x12c')](_0x5c1e18['dialOriginateCallerIdNumber'],_0x5c1e18[_0x24ec('0x12b')]):_0x5c1e18[_0x24ec('0x12d')]);if(_0x518c00){_0x3d833e['originatecalleridname']=ut['extractCalleridName'](_0x518c00);_0x3d833e[_0x24ec('0x12e')]=ut['extractCalleridNumber'](_0x518c00);}var _0x443710=ut[_0x24ec('0x12f')](_0x5c1e18,_0x405aaa,_0x388a6c,_0x518c00,_0xc1592e,_0x3d833e);_[_0x24ec('0x130')](_0x3d833e,ut[_0x24ec('0x131')](_0x443710));_0x3d833e[_0x24ec('0x90')]=moment()[_0x24ec('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x24ec('0x7b')](ut[_0x24ec('0x132')](_0x3d833e,_0x5c1e18,_0x443710,_0x3d833e[_0x24ec('0xaf')],_0x1a9761))['then'](function(_0x37f7f1){_0x5c1e18[_0x24ec('0x4d')]+=0x1;logger[_0x24ec('0x5b')](_0x24ec('0x133'),_0xc1592e,_0x24ec('0xb6'),_0x5c1e18['name'],_0x24ec('0x75'),_0x5c1e18[_0x24ec('0x4d')]);_0xe60385(_0x37f7f1);})[_0x24ec('0x7e')](function(_0x3dee15){ut['logAgent'](_0x3d833e,0xe,_0x24ec('0x134'));rpcDb[_0x24ec('0xf2')](_0x3d833e,'[originateFailure][logOriginateFailure]');_0x46d4ab(_0x3dee15);});});};Preview[_0x24ec('0xf')][_0x24ec('0x21')]=function(_0x3279f7){if(this[_0x24ec('0x16')][_0x3279f7['linkedid']]){this[_0x24ec('0x16')][_0x3279f7[_0x24ec('0xb0')]]['channel']=_0x3279f7[_0x24ec('0x7d')];}};Preview[_0x24ec('0xf')][_0x24ec('0x1a')]=function(_0x32e80d){var _0x990d52=this;var _0x2c0c27=this[_0x24ec('0x16')][_0x32e80d[_0x24ec('0x135')]];if(_0x2c0c27){if(_0x2c0c27[_0x24ec('0xff')]&&this[_0x24ec('0x17')][_0x2c0c27[_0x24ec('0xff')]]){ut['logLookAgent'](_0x2c0c27,this['agents'][_0x2c0c27[_0x24ec('0xff')]][_0x24ec('0x53')],this[_0x24ec('0x17')][_0x2c0c27[_0x24ec('0xff')]]['id']);}var _0x27efd2=_[_0x24ec('0x136')](_0x2c0c27);_0x27efd2[_0x24ec('0xb2')]=moment()[_0x24ec('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5a73=_0x990d52['campaignsPreview'][_0x2c0c27['queue']];if(ut[_0x24ec('0x137')](_0x32e80d[_0x24ec('0x138')])){if(_0x2c0c27[_0x24ec('0xae')]){rpcDb['unlockContact'](_0x2c0c27[_0x24ec('0x104')]);}if(_0x2c0c27[_0x24ec('0xaf')]){rpcDb[_0x24ec('0x8f')](_0x2c0c27['idContact']);}ami[_0x24ec('0xba')](_0x24ec('0x139'),ut[_0x24ec('0xa6')](_0x2c0c27,_0x24ec('0x13a')));this[_0x24ec('0xed')](_0x27efd2,_0x3b5a73,_0x32e80d);}else{_0x2c0c27['starttime']=moment()[_0x24ec('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x27efd2,0x4,'Answer');rpcDb[_0x24ec('0xf2')](_0x27efd2,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x24ec('0xf')][_0x24ec('0x13b')]=function(_0x370332){var _0x215f27=this;var _0x2b4406=this['actions'][_0x370332[_0x24ec('0xb0')]];var _0x30c65f;if(_0x2b4406){_0x30c65f=this[_0x24ec('0x13')][_0x2b4406[_0x24ec('0x74')]];logger[_0x24ec('0x5b')]('[syncHangup][talking]',_0x370332[_0x24ec('0xb0')],_0x24ec('0xb6'),_0x30c65f[_0x24ec('0x53')],_0x24ec('0x76'),_0x30c65f['pTalking']);}if(this[_0x24ec('0x16')][_0x370332[_0x24ec('0xb0')]]&&_0x370332[_0x24ec('0xb0')]!==_0x370332['uniqueid']){if(_0x370332[_0x24ec('0x13c')]==='16'&&this['actions'][_0x370332[_0x24ec('0xb0')]][_0x24ec('0x80')]){this[_0x24ec('0xa0')](_0x370332,_0x370332[_0x24ec('0xb0')],_0x370332[_0x24ec('0x13c')]);}else if(this[_0x24ec('0x16')][_0x370332[_0x24ec('0xb0')]][_0x24ec('0x80')]){logger[_0x24ec('0x5b')]('[syncHangup][talking][cause]',_0x370332[_0x24ec('0xb0')],_0x370332['cause'],'\x20Queue',_0x30c65f[_0x24ec('0x53')],_0x24ec('0x76'),_0x30c65f[_0x24ec('0x2b')]);this[_0x24ec('0xa0')](_0x370332,_0x370332[_0x24ec('0xb0')],_0x370332[_0x24ec('0x13c')]);}}else if(_0x2b4406&&_[_0x24ec('0x71')](_0x2b4406[_0x24ec('0x13d')])&&_0x30c65f[_0x24ec('0x13e')]&&_0x370332[_0x24ec('0xb0')]===_0x370332['uniqueid']&&_[_0x24ec('0x71')](_0x370332[_0x24ec('0xf0')])&&_0x370332[_0x24ec('0x13c')]==='16'&&_0x370332[_0x24ec('0x13f')]==='6'&&_[_0x24ec('0xee')](_0x2b4406[_0x24ec('0x140')])){if(_0x2b4406[_0x24ec('0xae')]){rpcDb['unlockContact'](_0x2b4406[_0x24ec('0x104')]);}if(_0x2b4406[_0x24ec('0xaf')]){rpcDb[_0x24ec('0x8f')](_0x2b4406[_0x24ec('0x104')]);}_0x370332['reason']='22';this[_0x24ec('0xed')](_0x2b4406,_0x30c65f,_0x370332);}else if(_0x2b4406&&_0x2b4406[_0x24ec('0x140')]){if(_0x370332['cause']==='16'&&this[_0x24ec('0x16')][_0x370332[_0x24ec('0xb0')]][_0x24ec('0x80')]){logger[_0x24ec('0x5b')](_0x24ec('0x141'),_0x370332[_0x24ec('0xb0')],_0x370332[_0x24ec('0x13c')],_0x24ec('0xb6'),_0x30c65f[_0x24ec('0x53')],'pTalking:\x20',_0x30c65f['pTalking']);this[_0x24ec('0xa0')](_0x370332,_0x370332[_0x24ec('0xb0')],_0x370332['cause']);}else if(this[_0x24ec('0x16')][_0x370332[_0x24ec('0xb0')]][_0x24ec('0x80')]){logger[_0x24ec('0x5b')](_0x24ec('0x142'),_0x370332[_0x24ec('0xb0')],_0x370332[_0x24ec('0x13c')],_0x24ec('0xb6'),_0x30c65f[_0x24ec('0x53')],'pTalking:\x20',_0x30c65f[_0x24ec('0x2b')]);this['callProgressDetectingCustomer'](_0x370332,_0x370332['linkedid'],_0x370332['cause']);}}};Preview[_0x24ec('0xf')][_0x24ec('0x1f')]=function(_0x44e23c){if(this[_0x24ec('0x16')][_0x44e23c['destlinkedid']]&&_0x44e23c[_0x24ec('0x143')]!==_0x44e23c[_0x24ec('0x144')]){this['callProgressDetectingCustomer'](_0x44e23c,_0x44e23c[_0x24ec('0x143')],_0x44e23c['dialstatus']);}};Preview['prototype'][_0x24ec('0x1e')]=function(_0x576860){if(this[_0x24ec('0x16')][_0x576860['linkedid']]&&_0x576860[_0x24ec('0xb0')]!==_0x576860['uniqueid']&&!this[_0x24ec('0x16')][_0x576860['linkedid']][_0x24ec('0x80')]){if(_0x576860[_0x24ec('0x13c')]==='1'){this[_0x24ec('0xa0')](_0x576860,_0x576860[_0x24ec('0xb0')],_0x576860[_0x24ec('0x13c')]);}}};Preview[_0x24ec('0xf')][_0x24ec('0x145')]=function(_0xb32490,_0xa28217,_0x107d71){if(this[_0x24ec('0x16')][_0xb32490]){if(_['isNil'](this['actions'][_0xb32490][_0x24ec('0x146')])){this[_0x24ec('0x16')][_0xb32490][_0x24ec('0x146')]={};}this[_0x24ec('0x16')][_0xb32490][_0x24ec('0x146')][_0xa28217]=_0x107d71;}};Preview['prototype'][_0x24ec('0x23')]=function(_0x1ceabf){try{if(!_[_0x24ec('0x71')](_0x1ceabf)){if(ut[_0x24ec('0x147')](_[_0x24ec('0x148')](_0x1ceabf[_0x24ec('0x149')])[0x0])){this[_0x24ec('0x145')](_0x1ceabf['uniqueid'],_[_0x24ec('0x148')](_0x1ceabf[_0x24ec('0x149')])[0x0],_0x1ceabf[_0x24ec('0x14a')]);}}}catch(_0x5ab32d){logger[_0x24ec('0x14b')](_0x24ec('0x14c'),util[_0x24ec('0x14d')](_0x5ab32d,{'showHidden':![],'depth':null}));}};Preview[_0x24ec('0xf')][_0x24ec('0x25')]=function(_0x24a504){if(_0x24a504){if(this[_0x24ec('0x16')][_0x24a504[_0x24ec('0x14e')]]){this[_0x24ec('0x16')][_0x24a504[_0x24ec('0x14e')]]['transfer']=!![];}}};Preview[_0x24ec('0xf')]['syncBlindTransfer']=function(_0xf681bd){if(_0xf681bd){if(this['actions'][_0xf681bd[_0x24ec('0x14f')]]){this['actions'][_0xf681bd['transfererlinkedid']][_0x24ec('0x140')]=!![];}}};module[_0x24ec('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 46266f6..8ff6083 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 _0x5178=['inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error'];(function(_0x173a49,_0x53b49f){var _0x123847=function(_0x89799){while(--_0x89799){_0x173a49['push'](_0x173a49['shift']());}};_0x123847(++_0x53b49f);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var BPromise=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var _=require(_0x8517('0x3'));var cmHopper=require(_0x8517('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8517('0x5'));var voiceQueueRt=require(_0x8517('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8517('0x7'));function loggerCatch(_0x58ed7e){return function(_0x13ba05){logger[_0x8517('0x8')](_0x58ed7e,util[_0x8517('0x9')](_0x13ba05,{'showHidden':![],'depth':null}));};}function create(_0x10f918){return BPromise[_0x8517('0xa')]()['then'](cmHopperHistory[_0x8517('0xb')](_0x10f918))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2d15fa){return BPromise[_0x8517('0xa')]()['then'](agentReportPreview[_0x8517('0xb')](_0x2d15fa))[_0x8517('0xc')](loggerCatch(_0x8517('0xd')));}function moveContact(_0x3be6b0){return BPromise[_0x8517('0xa')]()[_0x8517('0xe')](cmHopper[_0x8517('0xf')](_0x3be6b0,!![]))[_0x8517('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8517('0x10')]=function(_0x7f429a){return BPromise[_0x8517('0xa')]()[_0x8517('0xe')](cmHopperBlack[_0x8517('0x10')](_0x7f429a))['catch'](loggerCatch(_0x8517('0x11')));};exports[_0x8517('0x12')]=function(_0x126e0b){return BPromise[_0x8517('0xa')]()[_0x8517('0xe')](cmHopper[_0x8517('0x12')](_0x126e0b))[_0x8517('0xc')](loggerCatch(_0x8517('0x13')));};exports[_0x8517('0xb')]=function(_0x2953dd,_0x22b687){create(_0x2953dd)[_0x8517('0xc')](loggerCatch(_0x22b687));moveContact(_0x2953dd)['catch'](loggerCatch(_0x22b687));};exports[_0x8517('0x14')]=function(_0x100b76,_0x38e0f3){createAgent(_0x100b76)[_0x8517('0xc')](loggerCatch(_0x38e0f3));};exports[_0x8517('0x15')]=function(_0x24ca7e,_0x1bfbc1){create(_0x24ca7e)['catch'](loggerCatch(_0x1bfbc1));};exports[_0x8517('0x16')]=function(_0x4cd0a5,_0x564571){moveContact(_0x4cd0a5)[_0x8517('0xc')](loggerCatch(_0x564571));};exports[_0x8517('0x17')]=function(_0xf35d95,_0x180d8d,_0x238d75){if(_0x180d8d){_0xf35d95[_0x8517('0x18')]=null;}if(_0x238d75){_0xf35d95['active']=![];}return BPromise['resolve']()[_0x8517('0xe')](cmHopper[_0x8517('0x17')](_0xf35d95))[_0x8517('0xc')](loggerCatch(_0x8517('0x19')));};exports[_0x8517('0x1a')]=function(_0x2e6e47){return BPromise['resolve']()[_0x8517('0xe')](cmHopper[_0x8517('0x1a')](_0x2e6e47))['catch'](loggerCatch(_0x8517('0x1b')));};exports[_0x8517('0x1c')]=function(_0x42c779){return BPromise['resolve']()[_0x8517('0xe')](cmHopper['unlockContact']({'UserId':null},_0x42c779,0x1))[_0x8517('0xc')](loggerCatch(_0x8517('0x1d')));};exports[_0x8517('0x1e')]=function(_0x2b0c19){return BPromise[_0x8517('0xa')]()[_0x8517('0xe')](cmHopper['unlockContact']({'active':![]},_0x2b0c19,0x1))[_0x8517('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x8517('0x1f')]=function(_0x70ee9d){var _0x243fda={};_0x243fda[_0x8517('0x20')]=_0x70ee9d[_0x8517('0x20')];_0x243fda[_0x8517('0x21')]=_0x70ee9d['uniqueid'];_0x243fda[_0x8517('0x22')]=_0x70ee9d['calleridnum'];_0x243fda[_0x8517('0x23')]=_0x70ee9d[_0x8517('0x23')];_0x243fda[_0x8517('0x24')]=_0x70ee9d[_0x8517('0x24')];_0x243fda[_0x8517('0x25')]=_0x70ee9d[_0x8517('0x26')];_0x243fda[_0x8517('0x27')]=_0x70ee9d[_0x8517('0x26')];_0x243fda[_0x8517('0x28')]=0x1;_0x243fda['queuecallercompleteAt']=_0x70ee9d[_0x8517('0x29')];_0x243fda[_0x8517('0x2a')]=_0x70ee9d[_0x8517('0x2b')];_0x243fda['context']='from-sip';_0x243fda['exten']=_0x8517('0x2c');_0x243fda[_0x8517('0x2d')]=0x0;_0x243fda[_0x8517('0x2e')]=0x1;_0x243fda[_0x8517('0x2f')]=_0x70ee9d[_0x8517('0x2b')];_0x243fda[_0x8517('0x30')]='COMPLETED';return BPromise[_0x8517('0xa')]()[_0x8517('0xe')](voiceQueueReport[_0x8517('0x31')](_0x243fda))['catch'](loggerCatch(_0x8517('0x32')));};exports['getContactRecallMe']=function(_0x1253ef,_0x1e71ec){return BPromise['resolve']()['then'](cmHopper[_0x8517('0x33')](_0x1253ef,_0x1e71ec))[_0x8517('0xc')](loggerCatch(_0x8517('0x34')));};exports[_0x8517('0x35')]=function(_0x4f93bd){return BPromise['resolve']()[_0x8517('0xe')](cmHopper[_0x8517('0x17')](_0x4f93bd,!![],!![]))[_0x8517('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5fd1=['[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact'];(function(_0x35c768,_0x47803a){var _0x4491a2=function(_0x4ebcc2){while(--_0x4ebcc2){_0x35c768['push'](_0x35c768['shift']());}};_0x4491a2(++_0x47803a);}(_0x5fd1,0x155));var _0x15fd=function(_0x23879e,_0x9c0082){_0x23879e=_0x23879e-0x0;var _0x39c4fa=_0x5fd1[_0x23879e];return _0x39c4fa;};'use strict';var util=require(_0x15fd('0x0'));var BPromise=require('bluebird');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var _=require(_0x15fd('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x15fd('0x4'));var cmHopperBlack=require(_0x15fd('0x5'));var voiceQueueRt=require(_0x15fd('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x15fd('0x7'));function loggerCatch(_0x386441){return function(_0x18450c){logger[_0x15fd('0x8')](_0x386441,util[_0x15fd('0x9')](_0x18450c,{'showHidden':![],'depth':null}));};}function create(_0x534e63){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopperHistory[_0x15fd('0xc')](_0x534e63))['catch'](loggerCatch(_0x15fd('0xd')));}function createAgent(_0x5c9c63){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](agentReportPreview['createHistory'](_0x5c9c63))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3dd2af){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0xe')](_0x3dd2af,!![]))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x10')));}exports[_0x15fd('0x11')]=function(_0x2660db){return BPromise[_0x15fd('0xa')]()['then'](cmHopperBlack['checkIsBlackList'](_0x2660db))['catch'](loggerCatch(_0x15fd('0x12')));};exports[_0x15fd('0x13')]=function(_0x624e9b){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x13')](_0x624e9b))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x14')));};exports['createHistory']=function(_0x4c7080,_0x25f139){create(_0x4c7080)['catch'](loggerCatch(_0x25f139));moveContact(_0x4c7080)[_0x15fd('0xf')](loggerCatch(_0x25f139));};exports['createAgentHistory']=function(_0x917fe4,_0x318f47){createAgent(_0x917fe4)[_0x15fd('0xf')](loggerCatch(_0x318f47));};exports['createCustomerHistory']=function(_0x367c36,_0x2ad0de){create(_0x367c36)[_0x15fd('0xf')](loggerCatch(_0x2ad0de));};exports[_0x15fd('0x15')]=function(_0x2fb919,_0x36a90e){moveContact(_0x2fb919)[_0x15fd('0xf')](loggerCatch(_0x36a90e));};exports[_0x15fd('0x16')]=function(_0x1b8b9f,_0x1eab55,_0x3ff307){if(_0x1eab55){_0x1b8b9f['UserId']=null;}if(_0x3ff307){_0x1b8b9f['active']=![];}return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x16')](_0x1b8b9f))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x17')));};exports[_0x15fd('0x18')]=function(_0x2073da){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper[_0x15fd('0x18')](_0x2073da))[_0x15fd('0xf')](loggerCatch('[countReScheduled]\x20'));};exports[_0x15fd('0x19')]=function(_0x49062f){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x19')]({'UserId':null},_0x49062f,0x1))['catch'](loggerCatch(_0x15fd('0x1a')));};exports[_0x15fd('0x1b')]=function(_0x24c541){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper['unlockContact']({'active':![]},_0x24c541,0x1))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x1c')));};exports[_0x15fd('0x1d')]=function(_0x27d2c4){var _0x233ed3={};_0x233ed3[_0x15fd('0x1e')]=_0x27d2c4[_0x15fd('0x1e')];_0x233ed3[_0x15fd('0x1f')]=_0x27d2c4[_0x15fd('0x1f')];_0x233ed3[_0x15fd('0x20')]=_0x27d2c4[_0x15fd('0x20')];_0x233ed3['calleridname']=_0x27d2c4[_0x15fd('0x21')];_0x233ed3[_0x15fd('0x22')]=_0x27d2c4['queue'];_0x233ed3[_0x15fd('0x23')]=_0x27d2c4[_0x15fd('0x24')];_0x233ed3['queuecallerleaveAt']=_0x27d2c4[_0x15fd('0x24')];_0x233ed3[_0x15fd('0x25')]=0x1;_0x233ed3['queuecallercompleteAt']=_0x27d2c4[_0x15fd('0x26')];_0x233ed3[_0x15fd('0x27')]=_0x27d2c4[_0x15fd('0x28')];_0x233ed3[_0x15fd('0x29')]=_0x15fd('0x2a');_0x233ed3[_0x15fd('0x2b')]='xcally-motion-preview';_0x233ed3[_0x15fd('0x2c')]=0x0;_0x233ed3[_0x15fd('0x2d')]=0x1;_0x233ed3[_0x15fd('0x2e')]=_0x27d2c4[_0x15fd('0x28')];_0x233ed3['queuecallerexitreason']=_0x15fd('0x2f');return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](voiceQueueReport[_0x15fd('0x30')](_0x233ed3))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x31')));};exports['getContactRecallMe']=function(_0x3b80a6,_0xaae2d0){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper[_0x15fd('0x32')](_0x3b80a6,_0xaae2d0))[_0x15fd('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x15fd('0x33')]=function(_0x309851){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x16')](_0x309851,!![],!![]))[_0x15fd('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 1c3abc0..c12ac8e 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 _0xfd58=['type','campaigntype','channelAgent','countcongestionretry','countglobal','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','interface','buildAcw','queue','status','reachable','push','diff','createBody','CampaignId','filterKey','idContact'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xfd58,0xb3));var _0x8fd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd58[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8fd5('0x0'));var _=require(_0x8fd5('0x1'));var moment=require('moment');var logger=require(_0x8fd5('0x2'))(_0x8fd5('0x3'));var ipAgi=process['env'][_0x8fd5('0x4')]||_0x8fd5('0x5');function getSeconds(_0x469f42,_0x347959){var _0x4d6793=moment(_0x469f42)[_0x8fd5('0x6')](0x0);var _0x20bccc=moment(_0x347959)[_0x8fd5('0x6')](0x0);return _0x4d6793['diff'](_0x20bccc,_0x8fd5('0x7'));}exports[_0x8fd5('0x8')]=function(_0x273344){return function(_0x1042a1){logger[_0x8fd5('0x9')](_0x273344,util['inspect'](_0x1042a1,{'showHidden':![],'depth':null}));};};exports[_0x8fd5('0xa')]=function(_0x5cf6d3,_0x4db571){logger[_0x8fd5('0xb')](_0x5cf6d3,util[_0x8fd5('0xc')](_0x4db571,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2b8942,_0x346492){logger['error'](_0x2b8942,util[_0x8fd5('0xc')](_0x346492,{'showHidden':![],'depth':null}));};exports[_0x8fd5('0xd')]=function(_0x532a9e){return function(_0x34de34){logger[_0x8fd5('0xb')](_0x532a9e,util[_0x8fd5('0xc')](_0x34de34,{'showHidden':![],'depth':null}));};};exports[_0x8fd5('0xe')]=function(_0x50771f,_0x5a80e4,_0x4815ab){return{'message':_0x50771f,'unlock':_0x5a80e4,'active':_0x4815ab};};exports[_0x8fd5('0xf')]=function(_0x1c60c5,_0x3f66d8,_0x141ccb){if(!_[_0x8fd5('0x10')](_0x141ccb)&&_0x8fd5('0x11')===typeof _0x141ccb&&!_[_0x8fd5('0x12')](_0x141ccb)){if(!_[_0x8fd5('0x10')](_0x3f66d8)&&_0x8fd5('0x11')===typeof _0x3f66d8&&!_[_0x8fd5('0x12')](_0x3f66d8)){return util['format'](_0x8fd5('0x13'),_0x3f66d8,_0x141ccb);}return util[_0x8fd5('0x14')](_0x8fd5('0x13'),_0x141ccb,_0x141ccb);}if(!_['isUndefined'](_0x1c60c5)&&'string'===typeof _0x1c60c5&&!_['isEmpty'](_0x1c60c5)){return _0x1c60c5;}return _0x8fd5('0x15');};exports[_0x8fd5('0x16')]=function(_0x45fcfb){if(_[_0x8fd5('0x17')](_0x45fcfb)){return![];}return _0x45fcfb;};exports[_0x8fd5('0x18')]=function(_0x495ef7,_0x52d076,_0x186fdc,_0x4980fa,_0xaee3a7,_0x29e3c1){var _0x43f4ba={'XMD-QUEUE':_0x52d076[_0x8fd5('0x19')]?_0x52d076['Queue']['name']:'','XMD-CALLERID':_0x4980fa,'XMD-CALLERID-PREVIEW':_0x29e3c1?util['format'](_0x8fd5('0x13'),_0x29e3c1['calleridname'],_0x29e3c1[_0x8fd5('0x1a')]):_0x4980fa,'XMD-DIALID':_0xaee3a7,'XMD-CONTACTID':_0x52d076[_0x8fd5('0x1b')],'XMD-CDRTYPE':_0x8fd5('0x1c'),'CALLERID(all)':_0x4980fa,'XMD-VOICEQUEUEID':_0x52d076[_0x8fd5('0x1d')],'XMD-DIALCHANNEL':_0x186fdc,'XMD-DIALTIMEOUT':_0x495ef7['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8fd5('0x14')](_0x8fd5('0x1e'),_0x495ef7[_0x8fd5('0x1f')]?'g':'',_[_0x8fd5('0x12')](_0x495ef7[_0x8fd5('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x495ef7[_0x8fd5('0x21')]||'','XMD-AGI':_0x495ef7[_0x8fd5('0x22')]?util[_0x8fd5('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x495ef7[_0x8fd5('0x22')]):_0x8fd5('0x23'),'XMD-AGIAFTER':_0x495ef7[_0x8fd5('0x1f')]?util['format'](_0x8fd5('0x24'),ipAgi,_0x495ef7[_0x8fd5('0x1f')]):_0x8fd5('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x29e3c1?_0x29e3c1[_0x8fd5('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x29e3c1?_0x29e3c1['originatecalleridname']:'','XMD-DESTINATION':_0x8fd5('0x26')};if(!_[_0x8fd5('0x12')](_0x495ef7['monitor_format'])){_0x43f4ba[util[_0x8fd5('0x14')]('%s',_0x8fd5('0x27'))]=_0x495ef7[_0x8fd5('0x20')];_0x43f4ba[util[_0x8fd5('0x14')]('%s',_0x8fd5('0x28'))]=_0xaee3a7;}if(_0x52d076&&_0x52d076[_0x8fd5('0x29')]){for(var _0x56fe65 in _0x52d076[_0x8fd5('0x29')]){if(_0x52d076[_0x8fd5('0x29')][_0x8fd5('0x2a')](_0x56fe65)){if(!_['isNil'](_0x52d076[_0x8fd5('0x29')][_0x56fe65])&&_0x56fe65!=='id'&&_0x56fe65!==_0x8fd5('0x2b')&&_0x56fe65!==_0x8fd5('0x2c')&&_0x56fe65!==_0x8fd5('0x2d')){_0x43f4ba[util['format']('%s%s','XMD-',_['toUpper'](_0x56fe65))]=_0x52d076[_0x8fd5('0x29')][_0x56fe65];}}}}return _0x43f4ba;};exports[_0x8fd5('0x2e')]=function(_0x428391){var _0x2b6765={};for(var _0x4b50cc in _0x428391){if(_0x428391[_0x8fd5('0x2a')](_0x4b50cc)){_0x2b6765[util[_0x8fd5('0x14')]('%s',_[_0x8fd5('0x2f')](_0x4b50cc))]=_0x428391[_0x4b50cc];}}return{'variables':_0x2b6765};};exports[_0x8fd5('0x30')]=function(_0x3e4d43,_0x479589){if(!_[_0x8fd5('0x17')](_0x3e4d43)){if(_0x3e4d43[_0x8fd5('0x2a')](_0x8fd5('0x31'))){if(_0x3e4d43[_0x8fd5('0x31')]>0x0){_0x3e4d43[_0x8fd5('0x31')]-=0x1;}else{logger[_0x8fd5('0x9')](_0x8fd5('0x32'),_0x479589);}}}else{logger[_0x8fd5('0x9')](_0x8fd5('0x33'),_0x479589);}};exports[_0x8fd5('0x34')]=function(_0x544b4b){var _0x23203a=moment()['format'](_0x8fd5('0x35'));_0x544b4b[_0x8fd5('0x36')]=0xd;_0x544b4b[_0x8fd5('0x37')]=_0x8fd5('0x38');_0x544b4b[_0x8fd5('0x39')]=_0x23203a;_0x544b4b[_0x8fd5('0x3a')]=_0x23203a;_0x544b4b['endtime']=_0x23203a;};exports[_0x8fd5('0x3b')]=function(_0x1ecd7d,_0x58a9df,_0x582967){var _0x4b8988=moment()[_0x8fd5('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ecd7d['state']=_0x58a9df;_0x1ecd7d['statedesc']=_0x582967;_0x1ecd7d[_0x8fd5('0x3a')]=_0x4b8988;_0x1ecd7d[_0x8fd5('0x3c')]=getSeconds(_0x1ecd7d['responsetime'],_0x1ecd7d[_0x8fd5('0x39')]);};exports[_0x8fd5('0x3d')]=function(_0x4109b9,_0x579438,_0x273f8d){_0x4109b9[_0x8fd5('0x3e')]=_0x579438;_0x4109b9[_0x8fd5('0x3f')]=_0x273f8d;};exports[_0x8fd5('0x40')]=function(_0x40762f,_0xb1e8f7,_0xa33424){var _0x1fec7d=moment()[_0x8fd5('0x14')](_0x8fd5('0x35'));_0x40762f['state']=_0xb1e8f7;_0x40762f[_0x8fd5('0x37')]=_0xa33424;_0x40762f[_0x8fd5('0x3a')]=_0x40762f[_0x8fd5('0x3a')]?_0x40762f['responsetime']:_0x1fec7d;_0x40762f['endtime']=_0x40762f[_0x8fd5('0x41')]?_0x40762f[_0x8fd5('0x41')]:_0x1fec7d;_0x40762f[_0x8fd5('0x3c')]=getSeconds(_0x40762f[_0x8fd5('0x3a')]||0x0,_0x40762f['starttime']||0x0);_0x40762f[_0x8fd5('0x42')]=_0x40762f['answertime']?getSeconds(_0x40762f[_0x8fd5('0x41')],_0x40762f[_0x8fd5('0x43')]):0x0;};exports['isFailure']=function(_0x2c04dc){return _0x2c04dc===_0x8fd5('0x44');};exports[_0x8fd5('0x45')]=function(_0x4a5adf,_0x13483d,_0x31484b,_0x5c2e03,_0x218b86){var _0x23f2af=_0x5c2e03?'RECALL':_0x4a5adf['calleridname'];_0x23f2af=_0x218b86?_0x8fd5('0x46'):_0x23f2af;return{'actionid':_0x4a5adf[_0x8fd5('0x47')],'action':_0x8fd5('0x48'),'channel':_0x4a5adf['channelAgent'],'callerid':util[_0x8fd5('0x14')](_0x8fd5('0x13'),_0x23f2af,_0x4a5adf['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x8fd5('0x49'),'Priority':'1','variable':_0x31484b,'timeout':(_0x13483d[_0x8fd5('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4a5adf[_0x8fd5('0x47')]};};exports[_0x8fd5('0x4b')]=function(_0x2c0386){return _0x2c0386['countbusyretry']+_0x2c0386['countcongestionretry']+_0x2c0386[_0x8fd5('0x4c')]+_0x2c0386[_0x8fd5('0x4d')]+_0x2c0386[_0x8fd5('0x4e')];};exports[_0x8fd5('0x4f')]=function(_0xf4a5de){var _0x1aacc9=_[_0x8fd5('0x50')](_0xf4a5de);_0x1aacc9['state']=0xf;_0x1aacc9[_0x8fd5('0x37')]=_0x8fd5('0x51');return _0x1aacc9;};exports['scheduledAt']=function(_0x1c2183,_0x45a28a,_0x4b19aa){var _0x7d4a64={};_0x7d4a64[_0x45a28a]=_0x1c2183[_0x45a28a];_0x7d4a64[_0x8fd5('0x52')]=![];_0x7d4a64[_0x8fd5('0x53')]=moment()[_0x8fd5('0x54')](_0x4b19aa,_0x8fd5('0x55'))[_0x8fd5('0x14')](_0x8fd5('0x35'));_0x7d4a64['ContactId']=_0x1c2183[_0x8fd5('0x1b')];_0x7d4a64['ListId']=_0x1c2183[_0x8fd5('0x56')];_0x7d4a64[_0x8fd5('0x1d')]=_0x1c2183[_0x8fd5('0x1d')]||undefined;return _0x7d4a64;};exports[_0x8fd5('0x57')]=function(_0x507ed1,_0xba6f55){if(!_['isNil'](_0x507ed1)){if(_0x507ed1[_0x8fd5('0x58')]>0x0){_0x507ed1[_0x8fd5('0x58')]-=0x1;}else{logger[_0x8fd5('0x9')](_0xba6f55,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x8fd5('0x9')](_0xba6f55,_0x8fd5('0x59'));}};exports[_0x8fd5('0x5a')]=function(_0x3d28bd){if(_0x3d28bd<=0x0){return!![];}return![];};exports[_0x8fd5('0x5b')]=function(_0x3b5fbd,_0x46ea1a){_0x3b5fbd[_0x8fd5('0x5c')]=_0x46ea1a;_0x3b5fbd[_0x8fd5('0x5d')]=_0x3b5fbd['queue'];_0x3b5fbd[_0x8fd5('0x5e')]=_0x3b5fbd['channelAgent'];return _0x3b5fbd;};exports[_0x8fd5('0x5f')]=function(_0x13f458){var _0x350bec={};_0x350bec[_0x8fd5('0x60')]=_0x13f458[_0x8fd5('0x60')];_0x350bec['interface']=_0x13f458['channelAgent'];_0x350bec['uniqueid']=_0x13f458['uniqueid'];return _0x350bec;};exports['agentReadyId']=function(_0x585f4b){var _0x3d84eb=[];for(var _0x282a51 in _0x585f4b){if(_0x585f4b[_0x8fd5('0x2a')](_0x282a51)){if(!_['isNil'](_0x585f4b[_0x282a51])&&_0x585f4b[_0x282a51][_0x8fd5('0x36')]==='not_inuse'&&_0x585f4b[_0x282a51][_0x8fd5('0x61')]===_0x8fd5('0x62')){_0x3d84eb[_0x8fd5('0x63')](_0x585f4b[_0x282a51]['id']);}}}return _0x3d84eb;};exports['getDiff']=function(_0x380223){var _0x263c4c=moment()[_0x8fd5('0x6')](0x0);var _0x1b4afb=moment(_0x380223)[_0x8fd5('0x6')](0x0);return _0x263c4c[_0x8fd5('0x64')](_0x1b4afb,_0x8fd5('0x7'));};exports[_0x8fd5('0x65')]=function(_0x47857d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x47857d[_0x8fd5('0x1b')],'ListId':_0x47857d[_0x8fd5('0x56')],'VoiceQueueId':_0x47857d[_0x8fd5('0x1d')]||undefined,'CampaignId':_0x47857d[_0x8fd5('0x66')]||undefined};};exports[_0x8fd5('0x67')]=function(_0x43f79d){if(_0x43f79d==='uniqueid'||_0x43f79d===_0x8fd5('0x68')||_0x43f79d===_0x8fd5('0x60')||_0x43f79d===_0x8fd5('0x69')||_0x43f79d===_0x8fd5('0x6a')||_0x43f79d==='dialAnswer'||_0x43f79d===_0x8fd5('0x3e')||_0x43f79d===_0x8fd5('0x6b')||_0x43f79d==='calleridname'||_0x43f79d==='active'||_0x43f79d===_0x8fd5('0x1a')||_0x43f79d==='scheduledat'||_0x43f79d==='countbusyretry'||_0x43f79d===_0x8fd5('0x6c')||_0x43f79d==='countnoanswerretry'||_0x43f79d===_0x8fd5('0x6d')||_0x43f79d==='callback'||_0x43f79d===_0x8fd5('0x6e')||_0x43f79d===_0x8fd5('0x6f')||_0x43f79d===_0x8fd5('0x70')||_0x43f79d===_0x8fd5('0x1b')||_0x43f79d===_0x8fd5('0x56')||_0x43f79d==='UserId'||_0x43f79d==='VoiceQueueId'||_0x43f79d==='sipcallid'||_0x43f79d==='xmd-voicequeueid'||_0x43f79d===_0x8fd5('0x71')||_0x43f79d===_0x8fd5('0x72')||_0x43f79d===_0x8fd5('0x73')||_0x43f79d===_0x8fd5('0x74')||_0x43f79d===_0x8fd5('0x75')||_0x43f79d===_0x8fd5('0x76')||_0x43f79d===_0x8fd5('0x77')||_0x43f79d===_0x8fd5('0x78')||_0x43f79d===_0x8fd5('0x79')||_0x43f79d===_0x8fd5('0x7a')||_0x43f79d===_0x8fd5('0x7b')||_0x43f79d===_0x8fd5('0x7c')||_0x43f79d==='xmd-agi'||_0x43f79d===_0x8fd5('0x7d')||_0x43f79d==='rtpaudioqosbridged'||_0x43f79d===_0x8fd5('0x7e')||_0x43f79d===_0x8fd5('0x7f')||_0x43f79d===_0x8fd5('0x80')||_0x43f79d===_0x8fd5('0x81')||_0x43f79d===_0x8fd5('0x82')||_0x43f79d===_0x8fd5('0x83')||_0x43f79d==='rtpaudioqos'||_0x43f79d===_0x8fd5('0x84')||_0x43f79d==='rtpaudioqosjitter'||_0x43f79d===_0x8fd5('0x7f')||_0x43f79d===_0x8fd5('0x80')||_0x43f79d===_0x8fd5('0x81')||_0x43f79d===_0x8fd5('0x82')||_0x43f79d==='rtpaudioqosrttbridged'||_0x43f79d===_0x8fd5('0x85')||_0x43f79d===_0x8fd5('0x86')||_0x43f79d===_0x8fd5('0x36')||_0x43f79d===_0x8fd5('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4cf428,_0x2ede87){var _0x461e7c,_0xa32e99,_0x458ed6;if(_0x2ede87<=0x0){_0x2ede87=0x1;}_0x461e7c=new RegExp(_0x8fd5('0x87')+_0x2ede87+'}$');_0xa32e99=Math[_0x8fd5('0x88')](0xa,_0x2ede87-0x1);_0x458ed6=Math['pow'](0xa,_0x2ede87)-0x1;return util[_0x8fd5('0x14')]('%s',_[_0x8fd5('0x89')](_0x4cf428,_0x461e7c,_[_0x8fd5('0x8a')](_0xa32e99,_0x458ed6)));};exports[_0x8fd5('0x8b')]=function(_0x179b91){var _0x2f6930=_0x179b91[_0x8fd5('0x8c')](/"(.*?)"/);return _0x2f6930?_0x2f6930[0x1]:_0x179b91;};exports[_0x8fd5('0x8d')]=function(_0x208e58){var _0x4bf770=_0x208e58[_0x8fd5('0x8c')](/<(.*?)>/);return _0x4bf770?_0x4bf770[0x1]:_0x208e58;}; \ No newline at end of file +var _0xc74c=['from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','ContactId','CampaignId','filterKey','idContact','type','campaigntype','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent'];(function(_0xf86fd8,_0x46c382){var _0x32942a=function(_0x1c47e1){while(--_0x1c47e1){_0xf86fd8['push'](_0xf86fd8['shift']());}};_0x32942a(++_0x46c382);}(_0xc74c,0x163));var _0xcc74=function(_0x11e7b2,_0x5a919c){_0x11e7b2=_0x11e7b2-0x0;var _0x3f12a5=_0xc74c[_0x11e7b2];return _0x3f12a5;};'use strict';var util=require(_0xcc74('0x0'));var _=require(_0xcc74('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xcc74('0x2'));var ipAgi=process[_0xcc74('0x3')]['XCALLY_IP_AGI']||_0xcc74('0x4');function getSeconds(_0x3284bd,_0x2c284b){var _0x105019=moment(_0x3284bd)[_0xcc74('0x5')](0x0);var _0x23c249=moment(_0x2c284b)[_0xcc74('0x5')](0x0);return _0x105019['diff'](_0x23c249,_0xcc74('0x6'));}exports[_0xcc74('0x7')]=function(_0x1eb886){return function(_0x473308){logger[_0xcc74('0x8')](_0x1eb886,util['inspect'](_0x473308,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0xad246b,_0x1aeb8f){logger[_0xcc74('0x9')](_0xad246b,util['inspect'](_0x1aeb8f,{'showHidden':![],'depth':null}));};exports[_0xcc74('0xa')]=function(_0x3c5829,_0x314704){logger['error'](_0x3c5829,util[_0xcc74('0xb')](_0x314704,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3183f4){return function(_0x4b3988){logger['info'](_0x3183f4,util['inspect'](_0x4b3988,{'showHidden':![],'depth':null}));};};exports[_0xcc74('0xc')]=function(_0x2c5dd0,_0x34e984,_0x104853){return{'message':_0x2c5dd0,'unlock':_0x34e984,'active':_0x104853};};exports[_0xcc74('0xd')]=function(_0x59eff4,_0xe4aaaa,_0x3b3ed8){if(!_[_0xcc74('0xe')](_0x3b3ed8)&&_0xcc74('0xf')===typeof _0x3b3ed8&&!_[_0xcc74('0x10')](_0x3b3ed8)){if(!_['isUndefined'](_0xe4aaaa)&&_0xcc74('0xf')===typeof _0xe4aaaa&&!_[_0xcc74('0x10')](_0xe4aaaa)){return util[_0xcc74('0x11')](_0xcc74('0x12'),_0xe4aaaa,_0x3b3ed8);}return util[_0xcc74('0x11')](_0xcc74('0x12'),_0x3b3ed8,_0x3b3ed8);}if(!_[_0xcc74('0xe')](_0x59eff4)&&_0xcc74('0xf')===typeof _0x59eff4&&!_[_0xcc74('0x10')](_0x59eff4)){return _0x59eff4;}return'\x22\x22\x20<>';};exports[_0xcc74('0x13')]=function(_0x175751){if(_[_0xcc74('0x14')](_0x175751)){return![];}return _0x175751;};exports[_0xcc74('0x15')]=function(_0x2f084f,_0x1b5f8f,_0x5b48a2,_0x379342,_0xa7fcba,_0x483baf){var _0x17a3aa={'XMD-QUEUE':_0x1b5f8f[_0xcc74('0x16')]?_0x1b5f8f[_0xcc74('0x16')]['name']:'','XMD-CALLERID':_0x379342,'XMD-CALLERID-PREVIEW':_0x483baf?util[_0xcc74('0x11')](_0xcc74('0x12'),_0x483baf[_0xcc74('0x17')],_0x483baf[_0xcc74('0x18')]):_0x379342,'XMD-DIALID':_0xa7fcba,'XMD-CONTACTID':_0x1b5f8f['ContactId'],'XMD-CDRTYPE':_0xcc74('0x19'),'CALLERID(all)':_0x379342,'XMD-VOICEQUEUEID':_0x1b5f8f[_0xcc74('0x1a')],'XMD-DIALCHANNEL':_0x5b48a2,'XMD-DIALTIMEOUT':_0x2f084f[_0xcc74('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xcc74('0x1c'),_0x2f084f[_0xcc74('0x1d')]?'g':'',_[_0xcc74('0x10')](_0x2f084f['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2f084f['dialPreviewUrl']||'','XMD-AGI':_0x2f084f[_0xcc74('0x1e')]?util[_0xcc74('0x11')](_0xcc74('0x1f'),ipAgi,_0x2f084f[_0xcc74('0x1e')]):_0xcc74('0x20'),'XMD-AGIAFTER':_0x2f084f[_0xcc74('0x1d')]?util['format'](_0xcc74('0x1f'),ipAgi,_0x2f084f[_0xcc74('0x1d')]):_0xcc74('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x483baf?_0x483baf[_0xcc74('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x483baf?_0x483baf['originatecalleridname']:'','XMD-DESTINATION':_0xcc74('0x22')};if(!_[_0xcc74('0x10')](_0x2f084f[_0xcc74('0x23')])){_0x17a3aa[util[_0xcc74('0x11')]('%s',_0xcc74('0x24'))]=_0x2f084f[_0xcc74('0x23')];_0x17a3aa[util['format']('%s',_0xcc74('0x25'))]=_0xa7fcba;}if(_0x1b5f8f&&_0x1b5f8f['Contact']){for(var _0x3faeab in _0x1b5f8f[_0xcc74('0x26')]){if(_0x1b5f8f[_0xcc74('0x26')][_0xcc74('0x27')](_0x3faeab)){if(!_[_0xcc74('0x14')](_0x1b5f8f[_0xcc74('0x26')][_0x3faeab])&&_0x3faeab!=='id'&&_0x3faeab!=='tags'&&_0x3faeab!=='createdAt'&&_0x3faeab!==_0xcc74('0x28')){_0x17a3aa[util[_0xcc74('0x11')](_0xcc74('0x29'),'XMD-',_[_0xcc74('0x2a')](_0x3faeab))]=_0x1b5f8f[_0xcc74('0x26')][_0x3faeab];}}}}return _0x17a3aa;};exports['toLowerVariables']=function(_0x53e0e6){var _0x6e42b0={};for(var _0x2c84ca in _0x53e0e6){if(_0x53e0e6['hasOwnProperty'](_0x2c84ca)){_0x6e42b0[util[_0xcc74('0x11')]('%s',_[_0xcc74('0x2b')](_0x2c84ca))]=_0x53e0e6[_0x2c84ca];}}return{'variables':_0x6e42b0};};exports[_0xcc74('0x2c')]=function(_0x2928a4,_0x2ef3e6){if(!_[_0xcc74('0x14')](_0x2928a4)){if(_0x2928a4['hasOwnProperty'](_0xcc74('0x2d'))){if(_0x2928a4[_0xcc74('0x2d')]>0x0){_0x2928a4[_0xcc74('0x2d')]-=0x1;}else{logger[_0xcc74('0x8')](_0xcc74('0x2e'),_0x2ef3e6);}}}else{logger[_0xcc74('0x8')](_0xcc74('0x2f'),_0x2ef3e6);}};exports['logBlacklist']=function(_0x3d6cd7){var _0x5a4c40=moment()[_0xcc74('0x11')](_0xcc74('0x30'));_0x3d6cd7[_0xcc74('0x31')]=0xd;_0x3d6cd7[_0xcc74('0x32')]=_0xcc74('0x33');_0x3d6cd7[_0xcc74('0x34')]=_0x5a4c40;_0x3d6cd7[_0xcc74('0x35')]=_0x5a4c40;_0x3d6cd7[_0xcc74('0x36')]=_0x5a4c40;};exports[_0xcc74('0x37')]=function(_0xe2a612,_0x1d4142,_0x44180c){var _0x483986=moment()[_0xcc74('0x11')](_0xcc74('0x30'));_0xe2a612['state']=_0x1d4142;_0xe2a612[_0xcc74('0x32')]=_0x44180c;_0xe2a612[_0xcc74('0x35')]=_0x483986;_0xe2a612[_0xcc74('0x38')]=getSeconds(_0xe2a612[_0xcc74('0x35')],_0xe2a612[_0xcc74('0x34')]);};exports['logLookAgent']=function(_0x26c5dc,_0x545433,_0x23a1e9){_0x26c5dc[_0xcc74('0x39')]=_0x545433;_0x26c5dc[_0xcc74('0x3a')]=_0x23a1e9;};exports['logCustomer']=function(_0x128f3d,_0x42cbe3,_0x4333eb){var _0x2c5cb1=moment()[_0xcc74('0x11')](_0xcc74('0x30'));_0x128f3d[_0xcc74('0x31')]=_0x42cbe3;_0x128f3d[_0xcc74('0x32')]=_0x4333eb;_0x128f3d[_0xcc74('0x35')]=_0x128f3d['responsetime']?_0x128f3d[_0xcc74('0x35')]:_0x2c5cb1;_0x128f3d[_0xcc74('0x36')]=_0x128f3d[_0xcc74('0x36')]?_0x128f3d[_0xcc74('0x36')]:_0x2c5cb1;_0x128f3d[_0xcc74('0x38')]=getSeconds(_0x128f3d[_0xcc74('0x35')]||0x0,_0x128f3d[_0xcc74('0x34')]||0x0);_0x128f3d[_0xcc74('0x3b')]=_0x128f3d[_0xcc74('0x3c')]?getSeconds(_0x128f3d[_0xcc74('0x36')],_0x128f3d['answertime']):0x0;};exports[_0xcc74('0x3d')]=function(_0x32e6f7){return _0x32e6f7===_0xcc74('0x3e');};exports[_0xcc74('0x3f')]=function(_0x3549a8,_0x18cf4e,_0x53751b,_0xdf9838,_0x3bd226){var _0x1b5270=_0xdf9838?_0xcc74('0x40'):_0x3549a8['calleridname'];_0x1b5270=_0x3bd226?'BOOKED':_0x1b5270;return{'actionid':_0x3549a8[_0xcc74('0x41')],'action':_0xcc74('0x42'),'channel':_0x3549a8[_0xcc74('0x43')],'callerid':util[_0xcc74('0x11')](_0xcc74('0x12'),_0x1b5270,_0x3549a8[_0xcc74('0x18')]),'Exten':'xcally-motion-preview','Context':_0xcc74('0x44'),'Priority':'1','variable':_0x53751b,'timeout':(_0x18cf4e[_0xcc74('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3549a8[_0xcc74('0x41')]};};exports[_0xcc74('0x46')]=function(_0x172d58){return _0x172d58['countbusyretry']+_0x172d58['countcongestionretry']+_0x172d58[_0xcc74('0x47')]+_0x172d58[_0xcc74('0x48')]+_0x172d58[_0xcc74('0x49')];};exports[_0xcc74('0x4a')]=function(_0xcfe8f6){var _0x9cfa3c=_['clone'](_0xcfe8f6);_0x9cfa3c['state']=0xf;_0x9cfa3c['statedesc']=_0xcc74('0x4b');return _0x9cfa3c;};exports['scheduledAt']=function(_0x39e560,_0x32b67c,_0x1581cc){var _0x4b6cf1={};_0x4b6cf1[_0x32b67c]=_0x39e560[_0x32b67c];_0x4b6cf1[_0xcc74('0x4c')]=![];_0x4b6cf1[_0xcc74('0x4d')]=moment()[_0xcc74('0x4e')](_0x1581cc,_0xcc74('0x4f'))[_0xcc74('0x11')](_0xcc74('0x30'));_0x4b6cf1['ContactId']=_0x39e560['ContactId'];_0x4b6cf1['ListId']=_0x39e560[_0xcc74('0x50')];_0x4b6cf1['VoiceQueueId']=_0x39e560[_0xcc74('0x1a')]||undefined;return _0x4b6cf1;};exports[_0xcc74('0x51')]=function(_0x19a2d7,_0x260a54){if(!_[_0xcc74('0x14')](_0x19a2d7)){if(_0x19a2d7[_0xcc74('0x52')]>0x0){_0x19a2d7[_0xcc74('0x52')]-=0x1;}else{logger[_0xcc74('0x8')](_0x260a54,_0xcc74('0x53'));}}else{logger[_0xcc74('0x8')](_0x260a54,_0xcc74('0x54'));}};exports[_0xcc74('0x55')]=function(_0x899f3c){if(_0x899f3c<=0x0){return!![];}return![];};exports[_0xcc74('0x56')]=function(_0x26df57,_0x15f506){_0x26df57[_0xcc74('0x57')]=_0x15f506;_0x26df57[_0xcc74('0x58')]=_0x26df57[_0xcc74('0x59')];_0x26df57[_0xcc74('0x5a')]=_0x26df57[_0xcc74('0x43')];return _0x26df57;};exports[_0xcc74('0x5b')]=function(_0x512349){var _0x1c4faf={};_0x1c4faf['queue']=_0x512349['queue'];_0x1c4faf['interface']=_0x512349[_0xcc74('0x43')];_0x1c4faf[_0xcc74('0x41')]=_0x512349[_0xcc74('0x41')];return _0x1c4faf;};exports[_0xcc74('0x5c')]=function(_0x20ea88){var _0x445627=[];for(var _0x4be0e2 in _0x20ea88){if(_0x20ea88['hasOwnProperty'](_0x4be0e2)){if(!_['isNil'](_0x20ea88[_0x4be0e2])&&_0x20ea88[_0x4be0e2]['state']===_0xcc74('0x5d')&&_0x20ea88[_0x4be0e2][_0xcc74('0x5e')]===_0xcc74('0x5f')){_0x445627[_0xcc74('0x60')](_0x20ea88[_0x4be0e2]['id']);}}}return _0x445627;};exports['getDiff']=function(_0x24dce4){var _0x282d37=moment()[_0xcc74('0x5')](0x0);var _0x3e392e=moment(_0x24dce4)['milliseconds'](0x0);return _0x282d37['diff'](_0x3e392e,_0xcc74('0x6'));};exports[_0xcc74('0x61')]=function(_0xd75fe7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xd75fe7[_0xcc74('0x62')],'ListId':_0xd75fe7[_0xcc74('0x50')],'VoiceQueueId':_0xd75fe7[_0xcc74('0x1a')]||undefined,'CampaignId':_0xd75fe7[_0xcc74('0x63')]||undefined};};exports[_0xcc74('0x64')]=function(_0x2a717d){if(_0x2a717d===_0xcc74('0x41')||_0x2a717d===_0xcc74('0x65')||_0x2a717d===_0xcc74('0x59')||_0x2a717d===_0xcc74('0x66')||_0x2a717d===_0xcc74('0x67')||_0x2a717d==='dialAnswer'||_0x2a717d===_0xcc74('0x39')||_0x2a717d==='channelAgent'||_0x2a717d===_0xcc74('0x17')||_0x2a717d==='active'||_0x2a717d==='calleridnum'||_0x2a717d===_0xcc74('0x4d')||_0x2a717d===_0xcc74('0x68')||_0x2a717d===_0xcc74('0x69')||_0x2a717d==='countnoanswerretry'||_0x2a717d===_0xcc74('0x6a')||_0x2a717d===_0xcc74('0x6b')||_0x2a717d===_0xcc74('0x6c')||_0x2a717d===_0xcc74('0x6d')||_0x2a717d===_0xcc74('0x6e')||_0x2a717d===_0xcc74('0x62')||_0x2a717d===_0xcc74('0x50')||_0x2a717d===_0xcc74('0x3a')||_0x2a717d==='VoiceQueueId'||_0x2a717d===_0xcc74('0x6f')||_0x2a717d===_0xcc74('0x70')||_0x2a717d===_0xcc74('0x71')||_0x2a717d===_0xcc74('0x72')||_0x2a717d===_0xcc74('0x73')||_0x2a717d===_0xcc74('0x74')||_0x2a717d===_0xcc74('0x75')||_0x2a717d==='xmd-dialoptions'||_0x2a717d===_0xcc74('0x76')||_0x2a717d===_0xcc74('0x77')||_0x2a717d===_0xcc74('0x78')||_0x2a717d===_0xcc74('0x79')||_0x2a717d==='xmd-callerid'||_0x2a717d===_0xcc74('0x7a')||_0x2a717d===_0xcc74('0x7b')||_0x2a717d==='rtpaudioqos'||_0x2a717d===_0xcc74('0x7c')||_0x2a717d===_0xcc74('0x7d')||_0x2a717d==='rtpaudioqosjitterbridged'||_0x2a717d===_0xcc74('0x7e')||_0x2a717d==='rtpaudioqoslossbridged'||_0x2a717d===_0xcc74('0x7f')||_0x2a717d===_0xcc74('0x80')||_0x2a717d===_0xcc74('0x81')||_0x2a717d==='rtpaudioqosbridged'||_0x2a717d===_0xcc74('0x7d')||_0x2a717d===_0xcc74('0x82')||_0x2a717d===_0xcc74('0x7e')||_0x2a717d===_0xcc74('0x83')||_0x2a717d===_0xcc74('0x7f')||_0x2a717d===_0xcc74('0x80')||_0x2a717d===_0xcc74('0x84')||_0x2a717d===_0xcc74('0x85')||_0x2a717d===_0xcc74('0x31')||_0x2a717d===_0xcc74('0x32')){return![];}return!![];};exports[_0xcc74('0x86')]=function(_0x575af0,_0x2b06d2){var _0x2628ed,_0x8758fd,_0x3dbc24;if(_0x2b06d2<=0x0){_0x2b06d2=0x1;}_0x2628ed=new RegExp(_0xcc74('0x87')+_0x2b06d2+'}$');_0x8758fd=Math[_0xcc74('0x88')](0xa,_0x2b06d2-0x1);_0x3dbc24=Math[_0xcc74('0x88')](0xa,_0x2b06d2)-0x1;return util[_0xcc74('0x11')]('%s',_['replace'](_0x575af0,_0x2628ed,_[_0xcc74('0x89')](_0x8758fd,_0x3dbc24)));};exports[_0xcc74('0x8a')]=function(_0x2a62fc){var _0xc0139b=_0x2a62fc[_0xcc74('0x8b')](/"(.*?)"/);return _0xc0139b?_0xc0139b[0x1]:_0x2a62fc;};exports[_0xcc74('0x8c')]=function(_0x28096f){var _0x4a634d=_0x28096f[_0xcc74('0x8b')](/<(.*?)>/);return _0x4a634d?_0x4a634d[0x1]:_0x28096f;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0763998..4bf68f9 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(_0x1ff299,_0x451182){var _0x2232a4=function(_0x10aa5e){while(--_0x10aa5e){_0x1ff299['push'](_0x1ff299['shift']());}};_0x2232a4(++_0x451182);}(_0x5f2f,0x73));var _0xf5f2=function(_0x248155,_0x2f7cdd){_0x248155=_0x248155-0x0;var _0x12aeb9=_0x5f2f[_0x248155];return _0x12aeb9;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x264646,_0xf732be){var _0x136632=function(_0xdda9bd){while(--_0xdda9bd){_0x264646['push'](_0x264646['shift']());}};_0x136632(++_0xf732be);}(_0x7a54,0x106));var _0x47a5=function(_0x3a7b1f,_0x7b62d8){_0x3a7b1f=_0x3a7b1f-0x0;var _0xa981d5=_0x7a54[_0x3a7b1f];return _0xa981d5;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6b75ce8..7baca56 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 _0x4522=['../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','format','SIP/%s','name','hasOwnProperty','mapKeys','isNil','interface','total','answered','sumHoldTime','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumDuration','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','isUndefined','length','initTrunks','trunks','initVoiceQueues','voiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','seconds','initVoiceCallReports','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','initFaxAccounts','faxAccounts','exports','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount'];(function(_0x3fb401,_0x47588d){var _0x1bfd72=function(_0x414c99){while(--_0x414c99){_0x3fb401['push'](_0x3fb401['shift']());}};_0x1bfd72(++_0x47588d);}(_0x4522,0x1a0));var _0x2452=function(_0x1ddef3,_0x381fb6){_0x1ddef3=_0x1ddef3-0x0;var _0x4c9970=_0x4522[_0x1ddef3];return _0x4c9970;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x2452('0x0'));var moment=require(_0x2452('0x1'));var Agent=require(_0x2452('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2452('0x3'));var VoiceQueue=require(_0x2452('0x4'));var Trigger=require(_0x2452('0x5'));var Template=require(_0x2452('0x6'));var Campaign=require(_0x2452('0x7'));var VoiceExtension=require(_0x2452('0x8'));var ZendeskAccount=require(_0x2452('0x9'));var SalesforceAccount=require(_0x2452('0xa'));var FreshdeskAccount=require(_0x2452('0xb'));var SugarcrmAccount=require(_0x2452('0xc'));var ZohoAccount=require(_0x2452('0xd'));var DeskAccount=require(_0x2452('0xe'));var VtigerAccount=require(_0x2452('0xf'));var ServicenowAccount=require(_0x2452('0x10'));var Dynamics365Account=require(_0x2452('0x11'));var FreshsalesAccount=require(_0x2452('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x2452('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0x2452('0x14')]={};this[_0x2452('0x15')]={};this[_0x2452('0x16')]={};this[_0x2452('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2452('0x18')]={};this[_0x2452('0x19')]={};this[_0x2452('0x1a')]={};this[_0x2452('0x1b')]={};this['timers']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2452('0x1c')]={};this['freshdeskAccounts']={};this[_0x2452('0x1d')]={};this['deskAccounts']={};this[_0x2452('0x1e')]={};this[_0x2452('0x1f')]={};this['dynamics365Accounts']={};this[_0x2452('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x3dd8cc,_0x734b88,_0x461d2b){var _0xdede20=_['mapKeys'](_0x3dd8cc,function(_0x2108e4,_0x16e33a){return _0x2108e4[_0x461d2b];});for(var _0x59d89a in _0x734b88){if(_0x734b88['hasOwnProperty'](_0x59d89a)){if(!_0xdede20[_0x59d89a]){delete _0x734b88[_0x59d89a];}}}}function freeIsNotKeySip(_0x1bfb44,_0x37c6a6){var _0x377c12=_['mapKeys'](_0x1bfb44,function(_0x914d2b,_0x467963){return util[_0x2452('0x21')](_0x2452('0x22'),_0x914d2b[_0x2452('0x23')]);});for(var _0x1c70cb in _0x37c6a6){if(_0x37c6a6[_0x2452('0x24')](_0x1c70cb)){if(!_0x377c12[_0x1c70cb]){delete _0x37c6a6[_0x1c70cb];}}}}function freeIsNotKeyAgent(_0xea452e,_0x5e921d){var _0x48f356=_[_0x2452('0x25')](_0xea452e,function(_0x32dfe7,_0x4bb3ff){var _0x17d0a0=_[_0x2452('0x26')](_0x32dfe7[_0x2452('0x27')])?util[_0x2452('0x21')](_0x2452('0x22'),_0x32dfe7[_0x2452('0x23')]):_0x32dfe7[_0x2452('0x27')];return _0x17d0a0;});for(var _0x543b06 in _0x5e921d){if(_0x5e921d[_0x2452('0x24')](_0x543b06)){if(!_0x48f356[_0x543b06]){delete _0x5e921d[_0x543b06];}}}}function clearVoiceCallReports(_0x27d049){_0x27d049[_0x2452('0x28')]=0x0;_0x27d049[_0x2452('0x29')]=0x0;_0x27d049[_0x2452('0x2a')]=0x0;_0x27d049['sumDuration']=0x0;_0x27d049['sumBillable']=0x0;}function clearCampaigns(_0x295be0){if(!_[_0x2452('0x2b')](_0x295be0)){for(var _0x46fcbb in _0x295be0){if(_0x295be0[_0x2452('0x24')](_0x46fcbb)){_0x295be0[_0x46fcbb][_0x2452('0x2c')]=0x0;_0x295be0[_0x46fcbb]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3fba00){if(!_[_0x2452('0x2b')](_0x3fba00)){for(var _0x5e9184 in _0x3fba00){if(_0x3fba00['hasOwnProperty'](_0x5e9184)){_0x3fba00[_0x5e9184][_0x2452('0x28')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x29')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x2d')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x2e')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x2a')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x2f')]=0x0;_0x3fba00[_0x5e9184]['sumBillable']=0x0;_0x3fba00[_0x5e9184]['outboundAnswerAgiCallsDay']=0x0;_0x3fba00[_0x5e9184][_0x2452('0x30')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x31')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x32')]=0x0;_0x3fba00[_0x5e9184]['outboundNoSuchCallsDay']=0x0;_0x3fba00[_0x5e9184][_0x2452('0x33')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x34')]=0x0;_0x3fba00[_0x5e9184]['outboundDropCallsDayCallersExit']=0x0;_0x3fba00[_0x5e9184][_0x2452('0x35')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x36')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x37')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x38')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x39')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x3a')]=0x0;_0x3fba00[_0x5e9184][_0x2452('0x3b')]=!![];}}}}Realtime[_0x2452('0x3c')][_0x2452('0x3d')]=function(_0x3afc9c,_0x304ab7){for(var _0x16c54a in _0x304ab7){if(_0x3afc9c[_0x2452('0x24')](_0x16c54a)){_0x3afc9c[_0x16c54a]=_0x304ab7[_0x16c54a];}}};Realtime['prototype'][_0x2452('0x3e')]=function(){var _0x1689cd=this;return function(_0x4cd7e2){if(_0x4cd7e2){freeIsNotKeyAgent(_0x4cd7e2,_0x1689cd[_0x2452('0x3f')]);for(var _0x48dc9a=0x0,_0x2c6843={},_0x3fd5d6={};_0x48dc9a<_0x4cd7e2['length'];_0x48dc9a+=0x1){_0x2c6843=_0x4cd7e2[_0x48dc9a];var _0x645722=_[_0x2452('0x26')](_0x2c6843[_0x2452('0x27')])?util['format'](_0x2452('0x22'),_0x2c6843[_0x2452('0x23')]):_0x2c6843['interface'];if(_[_0x2452('0x40')](_0x1689cd[_0x2452('0x3f')][_0x645722])){_0x1689cd[_0x2452('0x3f')][_0x645722]=new Agent(_0x2c6843);}else{_0x1689cd[_0x2452('0x3d')](_0x1689cd[_0x2452('0x3f')][_0x645722],_0x2c6843);}}}return _0x1689cd['agents'];};};Realtime['prototype']['initTelephones']=function(){var _0x1df280=this;return function(_0x36bd19){if(_0x36bd19){freeIsNotKeySip(_0x36bd19,_0x1df280[_0x2452('0x13')]);for(var _0x24db0e=0x0,_0x408b92={},_0x4c4c45={};_0x24db0e<_0x36bd19[_0x2452('0x41')];_0x24db0e+=0x1){_0x408b92=_0x36bd19[_0x24db0e];if(_['isUndefined'](_0x1df280['telephones'][util[_0x2452('0x21')]('SIP/%s',_0x408b92[_0x2452('0x23')])])){_0x1df280[_0x2452('0x13')][util['format'](_0x2452('0x22'),_0x408b92[_0x2452('0x23')])]=new Telephone(_0x408b92);}else{_0x1df280[_0x2452('0x3d')](_0x1df280[_0x2452('0x13')][util[_0x2452('0x21')](_0x2452('0x22'),_0x408b92[_0x2452('0x23')])],_0x408b92);}}}return _0x1df280[_0x2452('0x13')];};};Realtime['prototype'][_0x2452('0x42')]=function(){var _0x52c6b6=this;return function(_0xaea800){if(_0xaea800){freeIsNotKeySip(_0xaea800,_0x52c6b6[_0x2452('0x43')]);for(var _0x56bd34=0x0,_0x3a76ce={},_0x11ab26={};_0x56bd34<_0xaea800[_0x2452('0x41')];_0x56bd34+=0x1){_0x3a76ce=_0xaea800[_0x56bd34];if(_[_0x2452('0x40')](_0x52c6b6[_0x2452('0x43')][util['format'](_0x2452('0x22'),_0x3a76ce[_0x2452('0x23')])])){_0x52c6b6['trunks'][util[_0x2452('0x21')](_0x2452('0x22'),_0x3a76ce[_0x2452('0x23')])]=new Trunk(_0x3a76ce);}else{_0x52c6b6[_0x2452('0x3d')](_0x52c6b6['trunks'][util[_0x2452('0x21')](_0x2452('0x22'),_0x3a76ce[_0x2452('0x23')])],_0x3a76ce);}}}return _0x52c6b6[_0x2452('0x43')];};};Realtime[_0x2452('0x3c')][_0x2452('0x44')]=function(){var _0x4e30f5=this;return function(_0x17d42c){if(_0x17d42c){freeIsNotKey(_0x17d42c,_0x4e30f5['voiceQueues'],_0x2452('0x23'));for(var _0x2c3b1f=0x0,_0x4ffd51={},_0x49626f={};_0x2c3b1f<_0x17d42c['length'];_0x2c3b1f+=0x1){_0x4ffd51=_0x17d42c[_0x2c3b1f];if(_['isUndefined'](_0x4e30f5[_0x2452('0x45')][_0x4ffd51['name']])){_0x4e30f5[_0x2452('0x45')][_0x4ffd51['name']]=new VoiceQueue(_0x4ffd51);}else{_0x4e30f5[_0x2452('0x3d')](_0x4e30f5[_0x2452('0x45')][_0x4ffd51['name']],_0x4ffd51);}}}return _0x4e30f5['voiceQueues'];};};Realtime[_0x2452('0x3c')]['initTriggers']=function(){var _0x596b65=this;return function(_0x1cb30a){if(_0x1cb30a){freeIsNotKey(_0x1cb30a,_0x596b65[_0x2452('0x14')],'id');for(var _0x382ee3=0x0,_0x57f815={},_0x491089={};_0x382ee3<_0x1cb30a[_0x2452('0x41')];_0x382ee3+=0x1){_0x57f815=_0x1cb30a[_0x382ee3];if(_[_0x2452('0x40')](_0x596b65[_0x2452('0x14')][_0x57f815['id']])){_0x596b65[_0x2452('0x14')][_0x57f815['id']]=new Trigger(_0x57f815);}else{_0x596b65[_0x2452('0x3d')](_0x596b65['triggers'][_0x57f815['id']],_0x57f815);}}}return _0x596b65[_0x2452('0x14')];};};Realtime['prototype'][_0x2452('0x46')]=function(){var _0x53fd05=this;return function(_0x454666){if(_0x454666){freeIsNotKey(_0x454666,_0x53fd05[_0x2452('0x16')],'id');for(var _0x536536=0x0,_0x44b7aa={},_0x49e542={};_0x536536<_0x454666[_0x2452('0x41')];_0x536536+=0x1){_0x44b7aa=_0x454666[_0x536536];if(_['isUndefined'](_0x53fd05['templates'][_0x44b7aa['id']])){_0x53fd05['templates'][_0x44b7aa['id']]=new Template(_0x44b7aa);}else{_0x53fd05[_0x2452('0x3d')](_0x53fd05[_0x2452('0x16')][_0x44b7aa['id']],_0x44b7aa);}}}return _0x53fd05[_0x2452('0x16')];};};Realtime['prototype'][_0x2452('0x47')]=function(){var _0x39ceba=this;return function(_0xa96d55){if(_0xa96d55){freeIsNotKey(_0xa96d55,_0x39ceba[_0x2452('0x48')],'id');for(var _0x14c8e0=0x0,_0x5ccc11={},_0x43507c={};_0x14c8e0<_0xa96d55['length'];_0x14c8e0+=0x1){_0x5ccc11=_0xa96d55[_0x14c8e0];if(_[_0x2452('0x40')](_0x39ceba[_0x2452('0x48')][_0x5ccc11['id']])){_0x39ceba[_0x2452('0x48')][_0x5ccc11['id']]=new ZendeskAccount(_0x5ccc11);}else{_0x39ceba[_0x2452('0x3d')](_0x39ceba[_0x2452('0x48')][_0x5ccc11['id']],_0x5ccc11);}}}return _0x39ceba[_0x2452('0x48')];};};Realtime[_0x2452('0x3c')][_0x2452('0x49')]=function(){var _0x3629d3=this;return function(_0x4ec01a){if(_0x4ec01a){freeIsNotKey(_0x4ec01a,_0x3629d3[_0x2452('0x4a')],'id');for(var _0x595f9f=0x0,_0x2d9e86={},_0x594845={};_0x595f9f<_0x4ec01a[_0x2452('0x41')];_0x595f9f+=0x1){_0x2d9e86=_0x4ec01a[_0x595f9f];if(_[_0x2452('0x40')](_0x3629d3['salesforceAccounts'][_0x2d9e86['id']])){_0x3629d3[_0x2452('0x4a')][_0x2d9e86['id']]=new SalesforceAccount(_0x2d9e86);}else{_0x3629d3[_0x2452('0x3d')](_0x3629d3[_0x2452('0x4a')][_0x2d9e86['id']],_0x2d9e86);}}}return _0x3629d3[_0x2452('0x4a')];};};Realtime[_0x2452('0x3c')][_0x2452('0x4b')]=function(){var _0x3b32a6=this;return function(_0x2a3ec1){if(_0x2a3ec1){freeIsNotKey(_0x2a3ec1,_0x3b32a6[_0x2452('0x4c')],'id');for(var _0x207df7=0x0,_0x44ae1f={},_0x4c203f={};_0x207df7<_0x2a3ec1[_0x2452('0x41')];_0x207df7+=0x1){_0x44ae1f=_0x2a3ec1[_0x207df7];if(_['isUndefined'](_0x3b32a6[_0x2452('0x4c')][_0x44ae1f['id']])){_0x3b32a6['freshdeskAccounts'][_0x44ae1f['id']]=new FreshdeskAccount(_0x44ae1f);}else{_0x3b32a6[_0x2452('0x3d')](_0x3b32a6[_0x2452('0x4c')][_0x44ae1f['id']],_0x44ae1f);}}}return _0x3b32a6[_0x2452('0x4c')];};};Realtime[_0x2452('0x3c')][_0x2452('0x4d')]=function(){var _0x3b3a5a=this;return function(_0x2c2bce){if(_0x2c2bce){freeIsNotKey(_0x2c2bce,_0x3b3a5a[_0x2452('0x1d')],'id');for(var _0x3740b4=0x0,_0x2d615e={},_0x1def15={};_0x3740b4<_0x2c2bce['length'];_0x3740b4+=0x1){_0x2d615e=_0x2c2bce[_0x3740b4];if(_[_0x2452('0x40')](_0x3b3a5a[_0x2452('0x1d')][_0x2d615e['id']])){_0x3b3a5a[_0x2452('0x1d')][_0x2d615e['id']]=new ZohoAccount(_0x2d615e);}else{_0x3b3a5a[_0x2452('0x3d')](_0x3b3a5a[_0x2452('0x1d')][_0x2d615e['id']],_0x2d615e);}}}return _0x3b3a5a[_0x2452('0x1d')];};};Realtime['prototype'][_0x2452('0x4e')]=function(){var _0x41aba2=this;return function(_0x4bce9e){if(_0x4bce9e){freeIsNotKey(_0x4bce9e,_0x41aba2[_0x2452('0x4f')],'id');for(var _0x3a64fc=0x0,_0x1b8e8b={},_0x234468={};_0x3a64fc<_0x4bce9e[_0x2452('0x41')];_0x3a64fc+=0x1){_0x1b8e8b=_0x4bce9e[_0x3a64fc];if(_[_0x2452('0x40')](_0x41aba2[_0x2452('0x4f')][_0x1b8e8b['id']])){_0x41aba2[_0x2452('0x4f')][_0x1b8e8b['id']]=new DeskAccount(_0x1b8e8b);}else{_0x41aba2[_0x2452('0x3d')](_0x41aba2[_0x2452('0x4f')][_0x1b8e8b['id']],_0x1b8e8b);}}}return _0x41aba2[_0x2452('0x4f')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x288bbc=this;return function(_0x4c41f9){if(_0x4c41f9){freeIsNotKey(_0x4c41f9,_0x288bbc[_0x2452('0x1c')],'id');for(var _0x37332c=0x0,_0x192788={},_0x17b1ec={};_0x37332c<_0x4c41f9[_0x2452('0x41')];_0x37332c+=0x1){_0x192788=_0x4c41f9[_0x37332c];if(_[_0x2452('0x40')](_0x288bbc['sugarcrmAccounts'][_0x192788['id']])){_0x288bbc['sugarcrmAccounts'][_0x192788['id']]=new SugarcrmAccount(_0x192788);}else{_0x288bbc[_0x2452('0x3d')](_0x288bbc['sugarcrmAccounts'][_0x192788['id']],_0x192788);}}}return _0x288bbc[_0x2452('0x1c')];};};Realtime['prototype'][_0x2452('0x50')]=function(){var _0x226ddd=this;return function(_0x10edc0){if(_0x10edc0){freeIsNotKey(_0x10edc0,_0x226ddd[_0x2452('0x1e')],'id');for(var _0x4b9f76=0x0,_0x501d15={},_0x505d5a={};_0x4b9f76<_0x10edc0[_0x2452('0x41')];_0x4b9f76+=0x1){_0x501d15=_0x10edc0[_0x4b9f76];if(_[_0x2452('0x40')](_0x226ddd['vtigerAccounts'][_0x501d15['id']])){_0x226ddd['vtigerAccounts'][_0x501d15['id']]=new VtigerAccount(_0x501d15);}else{_0x226ddd['mergeFromDatabase'](_0x226ddd['vtigerAccounts'][_0x501d15['id']],_0x501d15);}}}return _0x226ddd['vtigerAccounts'];};};Realtime[_0x2452('0x3c')]['initServicenowAccounts']=function(){var _0x513815=this;return function(_0x31e47b){if(_0x31e47b){freeIsNotKey(_0x31e47b,_0x513815[_0x2452('0x1f')],'id');for(var _0x3ce2e0=0x0,_0x6cf3d0={},_0x24318a={};_0x3ce2e0<_0x31e47b[_0x2452('0x41')];_0x3ce2e0+=0x1){_0x6cf3d0=_0x31e47b[_0x3ce2e0];if(_['isUndefined'](_0x513815[_0x2452('0x1f')][_0x6cf3d0['id']])){_0x513815[_0x2452('0x1f')][_0x6cf3d0['id']]=new ServicenowAccount(_0x6cf3d0);}else{_0x513815[_0x2452('0x3d')](_0x513815['servicenowAccounts'][_0x6cf3d0['id']],_0x6cf3d0);}}}return _0x513815['servicenowAccounts'];};};Realtime[_0x2452('0x3c')][_0x2452('0x51')]=function(){var _0x292b67=this;return function(_0x1dec54){if(_0x1dec54){freeIsNotKey(_0x1dec54,_0x292b67[_0x2452('0x52')],'id');for(var _0x336fc6=0x0,_0x4dd13d={},_0x2b2033={};_0x336fc6<_0x1dec54['length'];_0x336fc6+=0x1){_0x4dd13d=_0x1dec54[_0x336fc6];if(_[_0x2452('0x40')](_0x292b67[_0x2452('0x52')][_0x4dd13d['id']])){_0x292b67[_0x2452('0x52')][_0x4dd13d['id']]=new Dynamics365Account(_0x4dd13d);}else{_0x292b67[_0x2452('0x3d')](_0x292b67['dynamics365Accounts'][_0x4dd13d['id']],_0x4dd13d);}}}return _0x292b67[_0x2452('0x52')];};};Realtime[_0x2452('0x3c')]['initFreshsalesAccounts']=function(){var _0x20f796=this;return function(_0x8927c4){if(_0x8927c4){freeIsNotKey(_0x8927c4,_0x20f796[_0x2452('0x20')],'id');for(var _0x3c96d9=0x0,_0x19cf40={},_0x23cf93={};_0x3c96d9<_0x8927c4[_0x2452('0x41')];_0x3c96d9+=0x1){_0x19cf40=_0x8927c4[_0x3c96d9];if(_[_0x2452('0x40')](_0x20f796['freshsalesAccounts'][_0x19cf40['id']])){_0x20f796['freshsalesAccounts'][_0x19cf40['id']]=new FreshsalesAccount(_0x19cf40);}else{_0x20f796[_0x2452('0x3d')](_0x20f796[_0x2452('0x20')][_0x19cf40['id']],_0x19cf40);}}}return _0x20f796[_0x2452('0x20')];};};Realtime[_0x2452('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x19d376=this;return function(_0x1ce631){for(var _0x2101f3=0x0;_0x2101f3<_0x1ce631[_0x2452('0x41')];_0x2101f3+=0x1){_['merge'](_0x19d376[_0x2452('0x45')][_0x1ce631[_0x2101f3][_0x2452('0x23')]],_0x1ce631[_0x2101f3]);}return _0x19d376[_0x2452('0x45')];};};Realtime[_0x2452('0x3c')]['initVoiceQueueReports']=function(){var _0x48fe8f=this;return function(_0x21f3ca){clearVoiceQueues(_0x48fe8f[_0x2452('0x45')]);if(_0x21f3ca){_0x21f3ca=_['groupBy'](_0x21f3ca,_0x2452('0x53'));for(var _0xe02ef1 in _0x21f3ca){if(_0x21f3ca[_0x2452('0x24')](_0xe02ef1)){var _0x19b52b={};for(var _0x11b4da=0x0;_0x11b4da<_0x21f3ca[_0xe02ef1][_0x2452('0x41')];_0x11b4da+=0x1){var _0x1e9f1a=_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x54')];if(_0x48fe8f[_0x2452('0x45')][_0x1e9f1a]){if(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x55')]){_0x48fe8f[_0x2452('0x45')][_0x1e9f1a][_0x2452('0x2d')]+=0x1;}if(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x56')]){_0x48fe8f[_0x2452('0x45')][_0x1e9f1a][_0x2452('0x2e')]+=0x1;}_0x48fe8f[_0x2452('0x45')][_0x1e9f1a]['sumHoldTime']+=moment(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x57')])[_0x2452('0x58')](moment(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x59')]),'seconds')||0x0;if(_0x11b4da===_0x21f3ca[_0xe02ef1]['length']-0x1){_0x48fe8f['voiceQueues'][_0x1e9f1a][_0x2452('0x2f')]+=moment(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x5a')]||_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x5b')]||_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x5c')])['diff'](moment(_0x21f3ca[_0xe02ef1][_0x11b4da]['queuecallerjoinAt']),'seconds')||0x0;_0x48fe8f[_0x2452('0x45')][_0x1e9f1a]['total']+=0x1;if(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x5d')]){_0x48fe8f['voiceQueues'][_0x1e9f1a][_0x2452('0x29')]+=0x1;_0x48fe8f['voiceQueues'][_0x1e9f1a][_0x2452('0x5e')]+=moment(_0x21f3ca[_0xe02ef1][_0x11b4da]['queuecallercompleteAt'])[_0x2452('0x58')](moment(_0x21f3ca[_0xe02ef1][_0x11b4da][_0x2452('0x57')]),_0x2452('0x5f'))||0x0;}}else{_0x48fe8f[_0x2452('0x45')][_0x1e9f1a][_0x2452('0x2f')]+=_0x48fe8f['voiceQueues'][_0x1e9f1a][_0x2452('0x2a')]||0x0;}}}}}}return _0x48fe8f[_0x2452('0x45')];};};Realtime[_0x2452('0x3c')][_0x2452('0x60')]=function(){var _0x285407=this;return function(_0x46810e){clearVoiceCallReports(_0x285407[_0x2452('0x17')]);if(_0x46810e){for(var _0x229a3e=0x0;_0x229a3e<_0x46810e[_0x2452('0x41')];_0x229a3e+=0x1){_0x285407[_0x2452('0x17')][_0x2452('0x28')]+=0x1;_0x285407['outbound'][_0x2452('0x2f')]+=_0x46810e[_0x229a3e]['duration'];if(_0x46810e[_0x229a3e][_0x2452('0x61')]==='ANSWERED'){_0x285407['outbound']['answered']+=0x1;_0x285407['outbound']['sumHoldTime']+=_0x46810e[_0x229a3e]['duration']-_0x46810e[_0x229a3e][_0x2452('0x62')]||0x0;_0x285407[_0x2452('0x17')][_0x2452('0x5e')]+=_0x46810e[_0x229a3e]['billableseconds'];}}}return _0x285407['outbound'];};};Realtime['prototype'][_0x2452('0x63')]=function(){var _0x2167dc=this;return function(_0x16f979){if(_0x16f979){freeIsNotKey(_0x16f979,_0x2167dc[_0x2452('0x15')],_0x2452('0x23'));for(var _0x5cbc70=0x0,_0x3454e3={};_0x5cbc70<_0x16f979['length'];_0x5cbc70+=0x1){_0x3454e3=_0x16f979[_0x5cbc70];if(_[_0x2452('0x40')](_0x2167dc[_0x2452('0x15')][_0x3454e3['name']])){_0x2167dc[_0x2452('0x15')][_0x3454e3[_0x2452('0x23')]]=new Campaign(_0x3454e3);}else{_0x2167dc[_0x2452('0x3d')](_0x2167dc[_0x2452('0x15')][_0x3454e3['name']],_0x3454e3);_0x2167dc[_0x2452('0x15')][_0x3454e3['name']][_0x2452('0x64')]=_0x3454e3[_0x2452('0x65')]?_0x3454e3[_0x2452('0x65')][_0x2452('0x23')]:undefined;}}}return _0x2167dc[_0x2452('0x15')];};};Realtime['prototype'][_0x2452('0x66')]=function(){var _0x20ae3c=this;return function(_0x29682){if(_0x29682){freeIsNotKey(_0x29682,_0x20ae3c[_0x2452('0x18')],'id');for(var _0x52fc60=0x0,_0x11dbd6={};_0x52fc60<_0x29682[_0x2452('0x41')];_0x52fc60+=0x1){_0x11dbd6=_0x29682[_0x52fc60];if(_[_0x2452('0x40')](_0x20ae3c[_0x2452('0x18')][_0x11dbd6['id']])){_0x20ae3c[_0x2452('0x18')][_0x11dbd6['id']]=new VoiceExtension(_0x11dbd6);}else{_0x20ae3c[_0x2452('0x3d')](_0x20ae3c[_0x2452('0x18')][_0x11dbd6['id']],_0x11dbd6);}}}return _0x20ae3c['voiceExtensions'];};};Realtime[_0x2452('0x3c')]['initCampaignHopperHistory']=function(){var _0x5233e1=this;return function(_0x5b3d1d){clearCampaigns(_0x5233e1[_0x2452('0x15')]);for(var _0x1361b3=0x0;_0x1361b3<_0x5b3d1d[_0x2452('0x41')];_0x1361b3+=0x1){_[_0x2452('0x67')](_0x5233e1[_0x2452('0x15')][_0x5b3d1d[_0x1361b3][_0x2452('0x23')]],_0x5b3d1d[_0x1361b3]);}return _0x5233e1[_0x2452('0x15')];};};Realtime[_0x2452('0x3c')][_0x2452('0x68')]=function(){var _0x4d182d=this;return function(_0x4c85ef){if(_0x4c85ef){freeIsNotKey(_0x4c85ef,_0x4d182d['faxAccounts'],'id');for(var _0x28c8a8=0x0,_0x4ea941={},_0x54f1c3={};_0x28c8a8<_0x4c85ef[_0x2452('0x41')];_0x28c8a8+=0x1){_0x4ea941=_0x4c85ef[_0x28c8a8];if(_[_0x2452('0x40')](_0x4d182d[_0x2452('0x69')][_0x4ea941['id']])){_0x4d182d[_0x2452('0x69')][_0x4ea941['id']]=new FaxAccount(_0x4ea941);}else{_0x4d182d[_0x2452('0x3d')](_0x4d182d['faxAccounts'][_0x4ea941['id']],_0x4ea941);}}}return _0x4d182d[_0x2452('0x69')];};};module[_0x2452('0x6a')]=Realtime; \ No newline at end of file +var _0x7f8b=['isNil','mergeFromDatabase','initTelephones','initTrunks','trunks','isUndefined','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','mapKeys','format','name','hasOwnProperty','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7f8b,0x10b));var _0xb7f8=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x7f8b[_0x1b6c6d];return _0x290d9d;};'use strict';var BPromise=require(_0xb7f8('0x0'));var util=require(_0xb7f8('0x1'));var _=require(_0xb7f8('0x2'));var moment=require('moment');var Agent=require(_0xb7f8('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xb7f8('0x4'));var VoiceQueue=require(_0xb7f8('0x5'));var Trigger=require(_0xb7f8('0x6'));var Template=require(_0xb7f8('0x7'));var Campaign=require(_0xb7f8('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xb7f8('0x9'));var SalesforceAccount=require(_0xb7f8('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xb7f8('0xb'));var DeskAccount=require(_0xb7f8('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xb7f8('0xd'));var Dynamics365Account=require(_0xb7f8('0xe'));var FreshsalesAccount=require(_0xb7f8('0xf'));var FaxAccount=require(_0xb7f8('0x10'));var Realtime=function(){this[_0xb7f8('0x11')]={};this[_0xb7f8('0x12')]={};this['trunks']={};this[_0xb7f8('0x13')]={};this['triggers']={};this['campaigns']={};this[_0xb7f8('0x14')]={};this[_0xb7f8('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xb7f8('0x16')]={};this['queueChannels']={};this[_0xb7f8('0x17')]={};this[_0xb7f8('0x18')]={};this[_0xb7f8('0x19')]={};this[_0xb7f8('0x1a')]={};this[_0xb7f8('0x1b')]={};this['freshdeskAccounts']={};this[_0xb7f8('0x1c')]={};this['deskAccounts']={};this[_0xb7f8('0x1d')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xb7f8('0x1e')]={};this[_0xb7f8('0x1f')]={};};function freeIsNotKey(_0x1788f5,_0x4a555c,_0x52945c){var _0x2ef46a=_[_0xb7f8('0x20')](_0x1788f5,function(_0x338518,_0x2061c0){return _0x338518[_0x52945c];});for(var _0x222fd8 in _0x4a555c){if(_0x4a555c['hasOwnProperty'](_0x222fd8)){if(!_0x2ef46a[_0x222fd8]){delete _0x4a555c[_0x222fd8];}}}}function freeIsNotKeySip(_0xfd50ce,_0x1d73fb){var _0x40dc9c=_[_0xb7f8('0x20')](_0xfd50ce,function(_0x4bb4e7,_0x24156b){return util[_0xb7f8('0x21')]('SIP/%s',_0x4bb4e7[_0xb7f8('0x22')]);});for(var _0x403984 in _0x1d73fb){if(_0x1d73fb[_0xb7f8('0x23')](_0x403984)){if(!_0x40dc9c[_0x403984]){delete _0x1d73fb[_0x403984];}}}}function freeIsNotKeyAgent(_0x54654e,_0x3c6dc6){var _0x7abea4=_['mapKeys'](_0x54654e,function(_0x349f84,_0x5b7715){var _0x403434=_['isNil'](_0x349f84[_0xb7f8('0x24')])?util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0x349f84['name']):_0x349f84[_0xb7f8('0x24')];return _0x403434;});for(var _0xa7aef8 in _0x3c6dc6){if(_0x3c6dc6[_0xb7f8('0x23')](_0xa7aef8)){if(!_0x7abea4[_0xa7aef8]){delete _0x3c6dc6[_0xa7aef8];}}}}function clearVoiceCallReports(_0x7df557){_0x7df557[_0xb7f8('0x26')]=0x0;_0x7df557[_0xb7f8('0x27')]=0x0;_0x7df557[_0xb7f8('0x28')]=0x0;_0x7df557[_0xb7f8('0x29')]=0x0;_0x7df557[_0xb7f8('0x2a')]=0x0;}function clearCampaigns(_0x3b8991){if(!_[_0xb7f8('0x2b')](_0x3b8991)){for(var _0x11b0c4 in _0x3b8991){if(_0x3b8991[_0xb7f8('0x23')](_0x11b0c4)){_0x3b8991[_0x11b0c4]['ivrTotalCallsDays']=0x0;_0x3b8991[_0x11b0c4][_0xb7f8('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x26b787){if(!_[_0xb7f8('0x2b')](_0x26b787)){for(var _0x253816 in _0x26b787){if(_0x26b787[_0xb7f8('0x23')](_0x253816)){_0x26b787[_0x253816][_0xb7f8('0x26')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x27')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x2d')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x2e')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x28')]=0x0;_0x26b787[_0x253816]['sumDuration']=0x0;_0x26b787[_0x253816][_0xb7f8('0x2a')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x2f')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x30')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x31')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x32')]=0x0;_0x26b787[_0x253816]['outboundNoSuchCallsDay']=0x0;_0x26b787[_0x253816][_0xb7f8('0x33')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x34')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x35')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x36')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x37')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x38')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x39')]=0x0;_0x26b787[_0x253816]['outboundAnswerAgiCallsDay']=0x0;_0x26b787[_0x253816][_0xb7f8('0x3a')]=0x0;_0x26b787[_0x253816][_0xb7f8('0x3b')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4bb636,_0x3e6e68){for(var _0x4f3ac3 in _0x3e6e68){if(_0x4bb636[_0xb7f8('0x23')](_0x4f3ac3)){_0x4bb636[_0x4f3ac3]=_0x3e6e68[_0x4f3ac3];}}};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x3d')]=function(){var _0x4a4d7e=this;return function(_0x55640e){if(_0x55640e){freeIsNotKeyAgent(_0x55640e,_0x4a4d7e[_0xb7f8('0x11')]);for(var _0x1078aa=0x0,_0x4ca0db={},_0x3f67d4={};_0x1078aa<_0x55640e[_0xb7f8('0x3e')];_0x1078aa+=0x1){_0x4ca0db=_0x55640e[_0x1078aa];var _0x39eb62=_[_0xb7f8('0x3f')](_0x4ca0db[_0xb7f8('0x24')])?util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0x4ca0db[_0xb7f8('0x22')]):_0x4ca0db[_0xb7f8('0x24')];if(_['isUndefined'](_0x4a4d7e[_0xb7f8('0x11')][_0x39eb62])){_0x4a4d7e[_0xb7f8('0x11')][_0x39eb62]=new Agent(_0x4ca0db);}else{_0x4a4d7e[_0xb7f8('0x40')](_0x4a4d7e['agents'][_0x39eb62],_0x4ca0db);}}}return _0x4a4d7e[_0xb7f8('0x11')];};};Realtime['prototype'][_0xb7f8('0x41')]=function(){var _0x1efcd8=this;return function(_0x318cbe){if(_0x318cbe){freeIsNotKeySip(_0x318cbe,_0x1efcd8[_0xb7f8('0x12')]);for(var _0x4c73a2=0x0,_0x2f6722={},_0x248832={};_0x4c73a2<_0x318cbe[_0xb7f8('0x3e')];_0x4c73a2+=0x1){_0x2f6722=_0x318cbe[_0x4c73a2];if(_['isUndefined'](_0x1efcd8[_0xb7f8('0x12')][util['format'](_0xb7f8('0x25'),_0x2f6722[_0xb7f8('0x22')])])){_0x1efcd8[_0xb7f8('0x12')][util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0x2f6722[_0xb7f8('0x22')])]=new Telephone(_0x2f6722);}else{_0x1efcd8[_0xb7f8('0x40')](_0x1efcd8['telephones'][util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0x2f6722['name'])],_0x2f6722);}}}return _0x1efcd8[_0xb7f8('0x12')];};};Realtime['prototype'][_0xb7f8('0x42')]=function(){var _0x5aed61=this;return function(_0x3fbe9e){if(_0x3fbe9e){freeIsNotKeySip(_0x3fbe9e,_0x5aed61[_0xb7f8('0x43')]);for(var _0x184617=0x0,_0xb32c52={},_0x395a5b={};_0x184617<_0x3fbe9e[_0xb7f8('0x3e')];_0x184617+=0x1){_0xb32c52=_0x3fbe9e[_0x184617];if(_[_0xb7f8('0x44')](_0x5aed61[_0xb7f8('0x43')][util['format'](_0xb7f8('0x25'),_0xb32c52[_0xb7f8('0x22')])])){_0x5aed61[_0xb7f8('0x43')][util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0xb32c52[_0xb7f8('0x22')])]=new Trunk(_0xb32c52);}else{_0x5aed61['mergeFromDatabase'](_0x5aed61[_0xb7f8('0x43')][util[_0xb7f8('0x21')](_0xb7f8('0x25'),_0xb32c52[_0xb7f8('0x22')])],_0xb32c52);}}}return _0x5aed61['trunks'];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x45')]=function(){var _0x13bded=this;return function(_0x484aa2){if(_0x484aa2){freeIsNotKey(_0x484aa2,_0x13bded[_0xb7f8('0x13')],_0xb7f8('0x22'));for(var _0x1e8538=0x0,_0x5c7e26={},_0x47677a={};_0x1e8538<_0x484aa2[_0xb7f8('0x3e')];_0x1e8538+=0x1){_0x5c7e26=_0x484aa2[_0x1e8538];if(_['isUndefined'](_0x13bded['voiceQueues'][_0x5c7e26['name']])){_0x13bded[_0xb7f8('0x13')][_0x5c7e26[_0xb7f8('0x22')]]=new VoiceQueue(_0x5c7e26);}else{_0x13bded[_0xb7f8('0x40')](_0x13bded[_0xb7f8('0x13')][_0x5c7e26['name']],_0x5c7e26);}}}return _0x13bded['voiceQueues'];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x46')]=function(){var _0x44ff7f=this;return function(_0x405e5f){if(_0x405e5f){freeIsNotKey(_0x405e5f,_0x44ff7f[_0xb7f8('0x47')],'id');for(var _0x57433f=0x0,_0x2a4827={},_0x3b4929={};_0x57433f<_0x405e5f[_0xb7f8('0x3e')];_0x57433f+=0x1){_0x2a4827=_0x405e5f[_0x57433f];if(_[_0xb7f8('0x44')](_0x44ff7f['triggers'][_0x2a4827['id']])){_0x44ff7f[_0xb7f8('0x47')][_0x2a4827['id']]=new Trigger(_0x2a4827);}else{_0x44ff7f[_0xb7f8('0x40')](_0x44ff7f[_0xb7f8('0x47')][_0x2a4827['id']],_0x2a4827);}}}return _0x44ff7f[_0xb7f8('0x47')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x48')]=function(){var _0xe9293f=this;return function(_0x5776d5){if(_0x5776d5){freeIsNotKey(_0x5776d5,_0xe9293f['templates'],'id');for(var _0x160c16=0x0,_0x245807={},_0x4b90b4={};_0x160c16<_0x5776d5['length'];_0x160c16+=0x1){_0x245807=_0x5776d5[_0x160c16];if(_[_0xb7f8('0x44')](_0xe9293f[_0xb7f8('0x14')][_0x245807['id']])){_0xe9293f[_0xb7f8('0x14')][_0x245807['id']]=new Template(_0x245807);}else{_0xe9293f[_0xb7f8('0x40')](_0xe9293f['templates'][_0x245807['id']],_0x245807);}}}return _0xe9293f[_0xb7f8('0x14')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x49')]=function(){var _0x652070=this;return function(_0x3c15de){if(_0x3c15de){freeIsNotKey(_0x3c15de,_0x652070[_0xb7f8('0x19')],'id');for(var _0x1995ea=0x0,_0x2bae58={},_0x39a135={};_0x1995ea<_0x3c15de[_0xb7f8('0x3e')];_0x1995ea+=0x1){_0x2bae58=_0x3c15de[_0x1995ea];if(_[_0xb7f8('0x44')](_0x652070[_0xb7f8('0x19')][_0x2bae58['id']])){_0x652070[_0xb7f8('0x19')][_0x2bae58['id']]=new ZendeskAccount(_0x2bae58);}else{_0x652070[_0xb7f8('0x40')](_0x652070[_0xb7f8('0x19')][_0x2bae58['id']],_0x2bae58);}}}return _0x652070['zendeskAccounts'];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x4a')]=function(){var _0x569106=this;return function(_0x3cfa62){if(_0x3cfa62){freeIsNotKey(_0x3cfa62,_0x569106[_0xb7f8('0x1a')],'id');for(var _0x4bd0c4=0x0,_0x327fce={},_0x2c43d3={};_0x4bd0c4<_0x3cfa62[_0xb7f8('0x3e')];_0x4bd0c4+=0x1){_0x327fce=_0x3cfa62[_0x4bd0c4];if(_['isUndefined'](_0x569106[_0xb7f8('0x1a')][_0x327fce['id']])){_0x569106[_0xb7f8('0x1a')][_0x327fce['id']]=new SalesforceAccount(_0x327fce);}else{_0x569106[_0xb7f8('0x40')](_0x569106['salesforceAccounts'][_0x327fce['id']],_0x327fce);}}}return _0x569106[_0xb7f8('0x1a')];};};Realtime[_0xb7f8('0x3c')]['initFreshdeskAccounts']=function(){var _0xf4fbf5=this;return function(_0x400ea9){if(_0x400ea9){freeIsNotKey(_0x400ea9,_0xf4fbf5[_0xb7f8('0x4b')],'id');for(var _0x3e6d52=0x0,_0x3b211b={},_0x17f148={};_0x3e6d52<_0x400ea9[_0xb7f8('0x3e')];_0x3e6d52+=0x1){_0x3b211b=_0x400ea9[_0x3e6d52];if(_[_0xb7f8('0x44')](_0xf4fbf5[_0xb7f8('0x4b')][_0x3b211b['id']])){_0xf4fbf5[_0xb7f8('0x4b')][_0x3b211b['id']]=new FreshdeskAccount(_0x3b211b);}else{_0xf4fbf5['mergeFromDatabase'](_0xf4fbf5['freshdeskAccounts'][_0x3b211b['id']],_0x3b211b);}}}return _0xf4fbf5[_0xb7f8('0x4b')];};};Realtime[_0xb7f8('0x3c')]['initZohoAccounts']=function(){var _0x40d99e=this;return function(_0xd95cf0){if(_0xd95cf0){freeIsNotKey(_0xd95cf0,_0x40d99e[_0xb7f8('0x1c')],'id');for(var _0x3bc3a0=0x0,_0x5e9cb5={},_0x328873={};_0x3bc3a0<_0xd95cf0[_0xb7f8('0x3e')];_0x3bc3a0+=0x1){_0x5e9cb5=_0xd95cf0[_0x3bc3a0];if(_[_0xb7f8('0x44')](_0x40d99e[_0xb7f8('0x1c')][_0x5e9cb5['id']])){_0x40d99e[_0xb7f8('0x1c')][_0x5e9cb5['id']]=new ZohoAccount(_0x5e9cb5);}else{_0x40d99e['mergeFromDatabase'](_0x40d99e[_0xb7f8('0x1c')][_0x5e9cb5['id']],_0x5e9cb5);}}}return _0x40d99e[_0xb7f8('0x1c')];};};Realtime[_0xb7f8('0x3c')]['initDeskAccounts']=function(){var _0x51cb0f=this;return function(_0x99a368){if(_0x99a368){freeIsNotKey(_0x99a368,_0x51cb0f['deskAccounts'],'id');for(var _0x291f41=0x0,_0x5a56e9={},_0x38473f={};_0x291f41<_0x99a368[_0xb7f8('0x3e')];_0x291f41+=0x1){_0x5a56e9=_0x99a368[_0x291f41];if(_[_0xb7f8('0x44')](_0x51cb0f[_0xb7f8('0x4c')][_0x5a56e9['id']])){_0x51cb0f[_0xb7f8('0x4c')][_0x5a56e9['id']]=new DeskAccount(_0x5a56e9);}else{_0x51cb0f['mergeFromDatabase'](_0x51cb0f['deskAccounts'][_0x5a56e9['id']],_0x5a56e9);}}}return _0x51cb0f[_0xb7f8('0x4c')];};};Realtime[_0xb7f8('0x3c')]['initSugarcrmAccounts']=function(){var _0x551920=this;return function(_0xd73411){if(_0xd73411){freeIsNotKey(_0xd73411,_0x551920['sugarcrmAccounts'],'id');for(var _0x2d232a=0x0,_0x4f32fa={},_0x48606b={};_0x2d232a<_0xd73411[_0xb7f8('0x3e')];_0x2d232a+=0x1){_0x4f32fa=_0xd73411[_0x2d232a];if(_['isUndefined'](_0x551920['sugarcrmAccounts'][_0x4f32fa['id']])){_0x551920[_0xb7f8('0x1b')][_0x4f32fa['id']]=new SugarcrmAccount(_0x4f32fa);}else{_0x551920[_0xb7f8('0x40')](_0x551920[_0xb7f8('0x1b')][_0x4f32fa['id']],_0x4f32fa);}}}return _0x551920[_0xb7f8('0x1b')];};};Realtime['prototype'][_0xb7f8('0x4d')]=function(){var _0x518d7b=this;return function(_0x35737d){if(_0x35737d){freeIsNotKey(_0x35737d,_0x518d7b[_0xb7f8('0x1d')],'id');for(var _0x94f028=0x0,_0x57209d={},_0x44d7ee={};_0x94f028<_0x35737d[_0xb7f8('0x3e')];_0x94f028+=0x1){_0x57209d=_0x35737d[_0x94f028];if(_[_0xb7f8('0x44')](_0x518d7b[_0xb7f8('0x1d')][_0x57209d['id']])){_0x518d7b['vtigerAccounts'][_0x57209d['id']]=new VtigerAccount(_0x57209d);}else{_0x518d7b[_0xb7f8('0x40')](_0x518d7b[_0xb7f8('0x1d')][_0x57209d['id']],_0x57209d);}}}return _0x518d7b[_0xb7f8('0x1d')];};};Realtime['prototype'][_0xb7f8('0x4e')]=function(){var _0x286fd1=this;return function(_0x594b40){if(_0x594b40){freeIsNotKey(_0x594b40,_0x286fd1[_0xb7f8('0x4f')],'id');for(var _0x5027c6=0x0,_0x139dff={},_0x3378ff={};_0x5027c6<_0x594b40[_0xb7f8('0x3e')];_0x5027c6+=0x1){_0x139dff=_0x594b40[_0x5027c6];if(_[_0xb7f8('0x44')](_0x286fd1[_0xb7f8('0x4f')][_0x139dff['id']])){_0x286fd1[_0xb7f8('0x4f')][_0x139dff['id']]=new ServicenowAccount(_0x139dff);}else{_0x286fd1['mergeFromDatabase'](_0x286fd1[_0xb7f8('0x4f')][_0x139dff['id']],_0x139dff);}}}return _0x286fd1[_0xb7f8('0x4f')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x50')]=function(){var _0x13e2b3=this;return function(_0x44a462){if(_0x44a462){freeIsNotKey(_0x44a462,_0x13e2b3[_0xb7f8('0x51')],'id');for(var _0x45eeb2=0x0,_0x225662={},_0x5cdeed={};_0x45eeb2<_0x44a462[_0xb7f8('0x3e')];_0x45eeb2+=0x1){_0x225662=_0x44a462[_0x45eeb2];if(_[_0xb7f8('0x44')](_0x13e2b3[_0xb7f8('0x51')][_0x225662['id']])){_0x13e2b3['dynamics365Accounts'][_0x225662['id']]=new Dynamics365Account(_0x225662);}else{_0x13e2b3[_0xb7f8('0x40')](_0x13e2b3['dynamics365Accounts'][_0x225662['id']],_0x225662);}}}return _0x13e2b3[_0xb7f8('0x51')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x52')]=function(){var _0xf94f62=this;return function(_0x4fc165){if(_0x4fc165){freeIsNotKey(_0x4fc165,_0xf94f62[_0xb7f8('0x1e')],'id');for(var _0x457592=0x0,_0x6b86d4={},_0x1b7a51={};_0x457592<_0x4fc165['length'];_0x457592+=0x1){_0x6b86d4=_0x4fc165[_0x457592];if(_[_0xb7f8('0x44')](_0xf94f62['freshsalesAccounts'][_0x6b86d4['id']])){_0xf94f62[_0xb7f8('0x1e')][_0x6b86d4['id']]=new FreshsalesAccount(_0x6b86d4);}else{_0xf94f62['mergeFromDatabase'](_0xf94f62['freshsalesAccounts'][_0x6b86d4['id']],_0x6b86d4);}}}return _0xf94f62['freshsalesAccounts'];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x53')]=function(){var _0x53c95b=this;return function(_0x2b9694){for(var _0x254c40=0x0;_0x254c40<_0x2b9694[_0xb7f8('0x3e')];_0x254c40+=0x1){_[_0xb7f8('0x54')](_0x53c95b[_0xb7f8('0x13')][_0x2b9694[_0x254c40][_0xb7f8('0x22')]],_0x2b9694[_0x254c40]);}return _0x53c95b[_0xb7f8('0x13')];};};Realtime[_0xb7f8('0x3c')]['initVoiceQueueReports']=function(){var _0x5d119f=this;return function(_0x433d81){clearVoiceQueues(_0x5d119f[_0xb7f8('0x13')]);if(_0x433d81){_0x433d81=_[_0xb7f8('0x55')](_0x433d81,_0xb7f8('0x56'));for(var _0xc6ed3f in _0x433d81){if(_0x433d81[_0xb7f8('0x23')](_0xc6ed3f)){var _0x31528d={};for(var _0x1c9eac=0x0;_0x1c9eac<_0x433d81[_0xc6ed3f][_0xb7f8('0x3e')];_0x1c9eac+=0x1){var _0x41b123=_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x57')];if(_0x5d119f[_0xb7f8('0x13')][_0x41b123]){if(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x58')]){_0x5d119f[_0xb7f8('0x13')][_0x41b123][_0xb7f8('0x2d')]+=0x1;}if(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x59')]){_0x5d119f['voiceQueues'][_0x41b123][_0xb7f8('0x2e')]+=0x1;}_0x5d119f[_0xb7f8('0x13')][_0x41b123][_0xb7f8('0x28')]+=moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5a')])[_0xb7f8('0x5b')](moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5c')]),'seconds')||0x0;if(_0x1c9eac===_0x433d81[_0xc6ed3f][_0xb7f8('0x3e')]-0x1){_0x5d119f[_0xb7f8('0x13')][_0x41b123][_0xb7f8('0x29')]+=moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5d')]||_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5e')]||_0x433d81[_0xc6ed3f][_0x1c9eac]['queuecallerexitAt'])[_0xb7f8('0x5b')](moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5c')]),_0xb7f8('0x5f'))||0x0;_0x5d119f['voiceQueues'][_0x41b123][_0xb7f8('0x26')]+=0x1;if(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x60')]){_0x5d119f[_0xb7f8('0x13')][_0x41b123]['answered']+=0x1;_0x5d119f[_0xb7f8('0x13')][_0x41b123][_0xb7f8('0x2a')]+=moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5d')])['diff'](moment(_0x433d81[_0xc6ed3f][_0x1c9eac][_0xb7f8('0x5a')]),_0xb7f8('0x5f'))||0x0;}}else{_0x5d119f[_0xb7f8('0x13')][_0x41b123][_0xb7f8('0x29')]+=_0x5d119f['voiceQueues'][_0x41b123][_0xb7f8('0x28')]||0x0;}}}}}}return _0x5d119f[_0xb7f8('0x13')];};};Realtime['prototype'][_0xb7f8('0x61')]=function(){var _0x59d6cf=this;return function(_0x2630ac){clearVoiceCallReports(_0x59d6cf['outbound']);if(_0x2630ac){for(var _0x1ecda4=0x0;_0x1ecda4<_0x2630ac[_0xb7f8('0x3e')];_0x1ecda4+=0x1){_0x59d6cf[_0xb7f8('0x15')]['total']+=0x1;_0x59d6cf[_0xb7f8('0x15')][_0xb7f8('0x29')]+=_0x2630ac[_0x1ecda4][_0xb7f8('0x62')];if(_0x2630ac[_0x1ecda4]['disposition']===_0xb7f8('0x63')){_0x59d6cf[_0xb7f8('0x15')]['answered']+=0x1;_0x59d6cf[_0xb7f8('0x15')][_0xb7f8('0x28')]+=_0x2630ac[_0x1ecda4]['duration']-_0x2630ac[_0x1ecda4][_0xb7f8('0x64')]||0x0;_0x59d6cf[_0xb7f8('0x15')][_0xb7f8('0x2a')]+=_0x2630ac[_0x1ecda4][_0xb7f8('0x64')];}}}return _0x59d6cf[_0xb7f8('0x15')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x65')]=function(){var _0x441ae7=this;return function(_0x309362){if(_0x309362){freeIsNotKey(_0x309362,_0x441ae7['campaigns'],_0xb7f8('0x22'));for(var _0x15e7c0=0x0,_0x3131df={};_0x15e7c0<_0x309362[_0xb7f8('0x3e')];_0x15e7c0+=0x1){_0x3131df=_0x309362[_0x15e7c0];if(_[_0xb7f8('0x44')](_0x441ae7['campaigns'][_0x3131df[_0xb7f8('0x22')]])){_0x441ae7[_0xb7f8('0x66')][_0x3131df[_0xb7f8('0x22')]]=new Campaign(_0x3131df);}else{_0x441ae7[_0xb7f8('0x40')](_0x441ae7[_0xb7f8('0x66')][_0x3131df[_0xb7f8('0x22')]],_0x3131df);_0x441ae7['campaigns'][_0x3131df[_0xb7f8('0x22')]][_0xb7f8('0x67')]=_0x3131df[_0xb7f8('0x68')]?_0x3131df[_0xb7f8('0x68')][_0xb7f8('0x22')]:undefined;}}}return _0x441ae7[_0xb7f8('0x66')];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x69')]=function(){var _0x1952e3=this;return function(_0x5851cc){if(_0x5851cc){freeIsNotKey(_0x5851cc,_0x1952e3[_0xb7f8('0x6a')],'id');for(var _0x3164b8=0x0,_0xe8a45={};_0x3164b8<_0x5851cc[_0xb7f8('0x3e')];_0x3164b8+=0x1){_0xe8a45=_0x5851cc[_0x3164b8];if(_[_0xb7f8('0x44')](_0x1952e3[_0xb7f8('0x6a')][_0xe8a45['id']])){_0x1952e3[_0xb7f8('0x6a')][_0xe8a45['id']]=new VoiceExtension(_0xe8a45);}else{_0x1952e3[_0xb7f8('0x40')](_0x1952e3['voiceExtensions'][_0xe8a45['id']],_0xe8a45);}}}return _0x1952e3[_0xb7f8('0x6a')];};};Realtime['prototype'][_0xb7f8('0x6b')]=function(){var _0x19a3f9=this;return function(_0x144421){clearCampaigns(_0x19a3f9['campaigns']);for(var _0x436080=0x0;_0x436080<_0x144421[_0xb7f8('0x3e')];_0x436080+=0x1){_[_0xb7f8('0x54')](_0x19a3f9[_0xb7f8('0x66')][_0x144421[_0x436080][_0xb7f8('0x22')]],_0x144421[_0x436080]);}return _0x19a3f9['campaigns'];};};Realtime[_0xb7f8('0x3c')][_0xb7f8('0x6c')]=function(){var _0x2ec009=this;return function(_0x54ac95){if(_0x54ac95){freeIsNotKey(_0x54ac95,_0x2ec009[_0xb7f8('0x1f')],'id');for(var _0x282fd8=0x0,_0x4de32b={},_0x3b531e={};_0x282fd8<_0x54ac95[_0xb7f8('0x3e')];_0x282fd8+=0x1){_0x4de32b=_0x54ac95[_0x282fd8];if(_[_0xb7f8('0x44')](_0x2ec009[_0xb7f8('0x1f')][_0x4de32b['id']])){_0x2ec009[_0xb7f8('0x1f')][_0x4de32b['id']]=new FaxAccount(_0x4de32b);}else{_0x2ec009['mergeFromDatabase'](_0x2ec009[_0xb7f8('0x1f')][_0x4de32b['id']],_0x4de32b);}}}return _0x2ec009[_0xb7f8('0x1f')];};};module[_0xb7f8('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 28ae660..4d075b2 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 _0x49b6=['ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','accountcode','name','isNil','find','format','SIP/%s','findAgent','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','phone','bluebird','lodash','../../../config/environment','../../../config/logger'];(function(_0x491ec2,_0x540c00){var _0x1748db=function(_0x5a6258){while(--_0x5a6258){_0x491ec2['push'](_0x491ec2['shift']());}};_0x1748db(++_0x540c00);}(_0x49b6,0x187));var _0x649b=function(_0x30f020,_0x7d2cfa){_0x30f020=_0x30f020-0x0;var _0x3933c0=_0x49b6[_0x30f020];return _0x3933c0;};'use strict';var BPromise=require(_0x649b('0x0'));var _=require(_0x649b('0x1'));var moment=require('moment');var util=require('util');var config=require(_0x649b('0x2'));var logger=require(_0x649b('0x3'))(_0x649b('0x4'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x649b('0x5'));var RpcVoiceDialReport=require(_0x649b('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x649b('0x7'));var RpcVoiceRecording=require(_0x649b('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x649b('0x9'));var VoiceCallReport=require(_0x649b('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x649b('0xb'));var UserReport=require(_0x649b('0xc'));function Report(_0x1ec5ec){this[_0x649b('0xd')]=_0x1ec5ec;this[_0x649b('0xe')]=_0x1ec5ec[_0x649b('0xe')];this[_0x649b('0xf')]=_0x1ec5ec['telephones'];}Report[_0x649b('0x10')][_0x649b('0x11')]=function(_0x39b77f){var _0x178be0=new VoiceQueueReport(this[_0x649b('0xd')]);var _0x4959bd=new VoiceAgentReport(this[_0x649b('0xd')]);var _0x189ab8=new VoiceDialReport(this[_0x649b('0xd')]);var _0x527e72=new VoiceCallReport(this['realtime']);var _0x330615=new UserReport(this[_0x649b('0xd')]);if(config[_0x649b('0x12')]&&config[_0x649b('0x12')]['disabled']){ami['on'](_0x649b('0x13'),this[_0x649b('0x14')][_0x649b('0x15')](this));ami['on'](_0x649b('0x16'),this[_0x649b('0x17')][_0x649b('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x649b('0x18')][_0x649b('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x649b('0x19')][_0x649b('0x15')](this));ami['on']('blindtransfer',this[_0x649b('0x1a')][_0x649b('0x15')](this));ami['on'](_0x649b('0x1b'),this[_0x649b('0x1c')][_0x649b('0x15')](this));}};Report[_0x649b('0x10')]['findAgent']=function(_0x4119cb){var _0x4395b4=undefined;_0x4395b4=_['find'](this[_0x649b('0xe')],function(_0x40bfd2){return _0x40bfd2[_0x649b('0x1d')]==_0x4119cb||_0x40bfd2[_0x649b('0x1e')]==_0x4119cb;});if(_[_0x649b('0x1f')](_0x4395b4)){var _0x2d3ea3=_[_0x649b('0x20')](this['telephones'],function(_0x28bf04){return _0x28bf04[_0x649b('0x1d')]==_0x4119cb||_0x28bf04[_0x649b('0x1e')]==_0x4119cb;});if(_0x2d3ea3){_0x4395b4=_[_0x649b('0x20')](this[_0x649b('0xe')],function(_0x4e1b0e){return _0x4e1b0e['interface']==util[_0x649b('0x21')](_0x649b('0x22'),_0x2d3ea3[_0x649b('0x1e')]);});}}return _0x4395b4;};Report[_0x649b('0x10')][_0x649b('0x14')]=function(_0x40f9c6){for(var _0x2dc4bb=0x0;_0x2dc4bb<_0x40f9c6['length'];_0x2dc4bb+=0x1){var _0x257339=this[_0x649b('0x23')](_0x40f9c6[_0x2dc4bb][_0x649b('0x24')]);if(_0x257339){_0x40f9c6[_0x2dc4bb][_0x649b('0x1d')]=_0x257339[_0x649b('0x1d')];_0x40f9c6[_0x2dc4bb][_0x649b('0x25')]=!![];_0x40f9c6[_0x2dc4bb][_0x649b('0x26')]=_0x257339[_0x649b('0x1e')];_0x40f9c6[_0x2dc4bb]['interface']=_[_0x649b('0x1f')](_0x257339[_0x649b('0x27')])?util['format'](_0x649b('0x22'),_0x257339[_0x649b('0x1e')]):_0x257339['interface'];if(_0x40f9c6[_0x2dc4bb][_0x649b('0x28')]){_0x40f9c6[_0x2dc4bb]['queuecallercompleteAt']=moment()[_0x649b('0x21')](_0x649b('0x29'));}if(_0x40f9c6[_0x2dc4bb][_0x649b('0x2a')]){_0x40f9c6[_0x2dc4bb][_0x649b('0x2b')]=moment()['format'](_0x649b('0x29'));}RpcMemberReport[_0x649b('0x14')](_0x40f9c6[_0x2dc4bb]);}RpcVoiceQueueReport[_0x649b('0x2c')](_0x40f9c6[_0x2dc4bb]);}};function extractCalleridNumber(_0x46e099){var _0xb568ab=_0x46e099[_0x649b('0x2d')](/<(.*?)>/);return _0xb568ab?_0xb568ab[0x1]:_0x46e099;}Report['prototype'][_0x649b('0x17')]=function(_0x2dc1f8){_0x2dc1f8[_0x649b('0x2e')]=_0x2dc1f8[_0x649b('0x2e')]||_0x2dc1f8['exten'];if(_0x2dc1f8[_0x649b('0x2f')]=='dialer'){_0x2dc1f8[_0x649b('0x30')]=_0x649b('0x31');_0x2dc1f8[_0x649b('0x32')]=_0x2dc1f8[_0x649b('0x31')];if(_0x2dc1f8[_0x649b('0x33')]==_0x649b('0x34')){_0x2dc1f8['accountcode']='';_0x2dc1f8[_0x649b('0x2e')]=extractCalleridNumber(_0x2dc1f8[_0x649b('0x35')]);}else if(_0x2dc1f8[_0x649b('0x33')]==_0x649b('0x36')){if(_0x2dc1f8[_0x649b('0x2e')]==_0x649b('0x37')){_0x2dc1f8['destination']=extractCalleridNumber(_0x2dc1f8['calleridpreview']);_0x2dc1f8[_0x649b('0x38')]=_0x2dc1f8[_0x649b('0x39')];_0x2dc1f8[_0x649b('0x3a')]=[_0x2dc1f8[_0x649b('0x3b')],_0x2dc1f8[_0x649b('0x3b')]=_0x2dc1f8[_0x649b('0x3a')]][0x0];_0x2dc1f8['callerid']=_0x2dc1f8[_0x649b('0x3c')];}else{_0x2dc1f8[_0x649b('0x2e')]=_0x2dc1f8[_0x649b('0x38')];_0x2dc1f8[_0x649b('0x38')]=_0x2dc1f8[_0x649b('0x39')];if(_0x2dc1f8[_0x649b('0x3d')]==_0x649b('0x3e')){_0x2dc1f8['accountcode']=_0x2dc1f8[_0x649b('0x24')];}else{_0x2dc1f8[_0x649b('0x1d')]='';}}}}else{_0x2dc1f8[_0x649b('0x35')]=util[_0x649b('0x21')](_0x649b('0x3f'),_0x2dc1f8[_0x649b('0x40')],_0x2dc1f8[_0x649b('0x38')]);}RpcVoiceCallReport['create'](_0x2dc1f8);if(_0x2dc1f8[_0x649b('0x41')]){for(var _0xb80338=0x0;_0xb80338<_0x2dc1f8[_0x649b('0x42')]['length'];_0xb80338+=0x1){_0x2dc1f8['monitorFilename']=_0x2dc1f8[_0x649b('0x42')][_0xb80338][_0x649b('0x43')];_0x2dc1f8[_0x649b('0x44')]=_0x2dc1f8[_0x649b('0x42')][_0xb80338]['createdAt'];if(_0x2dc1f8[_0x649b('0x45')]==_0x649b('0x37')){_0x2dc1f8[_0x649b('0x38')]=_0x2dc1f8['connectedlinenum'];_0x2dc1f8['calleridname']=_0x2dc1f8[_0x649b('0x46')];_0x2dc1f8[_0x649b('0x24')]=_0x2dc1f8[_0x649b('0x1d')];_0x2dc1f8[_0x649b('0x46')]=_0x2dc1f8[_0x649b('0x47')];_0x2dc1f8['exten']=_0x2dc1f8[_0x649b('0x39')];}else if(_0x2dc1f8[_0x649b('0x45')]==_0x649b('0x48')){_0x2dc1f8[_0x649b('0x38')]=_0x2dc1f8[_0x649b('0x2e')];_0x2dc1f8[_0x649b('0x45')]=_0x2dc1f8[_0x649b('0x39')];}RpcVoiceRecording[_0x649b('0x2c')](_0x2dc1f8);}}};Report[_0x649b('0x10')]['voiceAgentReport']=function(_0x256c7d){if(_[_0x649b('0x49')](_0x256c7d)){_0x256c7d[_0x649b('0x4a')](function(_0x16ca7b){RpcVoiceAgentReport[_0x649b('0x2c')](_0x16ca7b);});}else{RpcVoiceAgentReport[_0x649b('0x2c')](_0x256c7d);}};Report[_0x649b('0x10')]['voiceDialReport']=function(_0x26f60e){RpcVoiceDialReport['create'](_0x26f60e);var _0xe82f94=undefined;var _0x10247f=_0x26f60e[_0x649b('0x3b')];if(_[_0x649b('0x4b')](_0x10247f,'Local')){var _0x6cde75=_0x10247f[_0x649b('0x4c')](_0x10247f[_0x649b('0x4d')]('/')+0x1,_0x10247f[_0x649b('0x4d')]('@'));_0xe82f94=_[_0x649b('0x20')](this['agents'],function(_0x236828){return _0x236828['mobile']==_0x6cde75||_0x236828[_0x649b('0x4e')]==_0x6cde75||_0x236828[_0x649b('0x1d')]==_0x6cde75;});}else{var _0x6cde75=_0x10247f[_0x649b('0x4c')](_0x10247f['indexOf']('/')+0x1,_0x10247f['lastIndexOf']('-'));_0xe82f94=this[_0x649b('0x23')](_0x6cde75);}if(_0xe82f94){_0x26f60e[_0x649b('0x27')]=_[_0x649b('0x1f')](_0xe82f94[_0x649b('0x27')])?util[_0x649b('0x21')]('SIP/%s',_0xe82f94['name']):_0xe82f94[_0x649b('0x27')];_0x26f60e[_0x649b('0x47')]=_0xe82f94['name'];_0x26f60e['accountcode']=_0xe82f94['accountcode'];RpcMemberReport[_0x649b('0x19')](_0x26f60e);}};Report['prototype'][_0x649b('0x1a')]=function(_0x3c8f03){RpcVoiceTransferReport['blindTransfer'](_0x3c8f03);};Report['prototype'][_0x649b('0x1c')]=function(_0x4c7a08){RpcVoiceTransferReport['attendedTransfer'](_0x4c7a08);};module['exports']=Report; \ No newline at end of file +var _0x8ef6=['monitorFilename','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','lastIndexOf','blindTransfer','exports','bluebird','lodash','moment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','attendedTransfer','find','accountcode','isNil','interface','SIP/%s','name','length','findAgent','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors'];(function(_0x3bbc66,_0x3520cc){var _0x20cd57=function(_0x2eb0c6){while(--_0x2eb0c6){_0x3bbc66['push'](_0x3bbc66['shift']());}};_0x20cd57(++_0x3520cc);}(_0x8ef6,0x15a));var _0x68ef=function(_0x102511,_0x28a00b){_0x102511=_0x102511-0x0;var _0x429e00=_0x8ef6[_0x102511];return _0x429e00;};'use strict';var BPromise=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var util=require('util');var config=require('../../../config/environment');var logger=require(_0x68ef('0x3'))(_0x68ef('0x4'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x68ef('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x68ef('0x6'));var RpcMemberReport=require(_0x68ef('0x7'));var RpcVoiceQueueReport=require(_0x68ef('0x8'));var RpcVoiceRecording=require(_0x68ef('0x9'));var RpcVoiceTransferReport=require(_0x68ef('0xa'));var VoiceQueueReport=require(_0x68ef('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x68ef('0xc'));var UserReport=require('./userReport');function Report(_0x508f27){this['realtime']=_0x508f27;this[_0x68ef('0xd')]=_0x508f27[_0x68ef('0xd')];this[_0x68ef('0xe')]=_0x508f27[_0x68ef('0xe')];}Report[_0x68ef('0xf')][_0x68ef('0x10')]=function(_0x21bf39){var _0x27c7f2=new VoiceQueueReport(this[_0x68ef('0x11')]);var _0x2eadd3=new VoiceAgentReport(this['realtime']);var _0x5eecf8=new VoiceDialReport(this[_0x68ef('0x11')]);var _0x68e7e8=new VoiceCallReport(this[_0x68ef('0x11')]);var _0x413415=new UserReport(this[_0x68ef('0x11')]);if(config[_0x68ef('0x12')]&&config[_0x68ef('0x12')][_0x68ef('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x68ef('0x14')][_0x68ef('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x68ef('0x16')]['bind'](this));ami['on'](_0x68ef('0x17'),this['voiceAgentReport'][_0x68ef('0x15')](this));ami['on'](_0x68ef('0x18'),this['voiceDialReport'][_0x68ef('0x15')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x68ef('0x15')](this));ami['on']('attendedtransfer',this[_0x68ef('0x19')][_0x68ef('0x15')](this));}};Report['prototype']['findAgent']=function(_0x1acffa){var _0x4df7fd=undefined;_0x4df7fd=_[_0x68ef('0x1a')](this[_0x68ef('0xd')],function(_0x27f94b){return _0x27f94b[_0x68ef('0x1b')]==_0x1acffa||_0x27f94b['name']==_0x1acffa;});if(_[_0x68ef('0x1c')](_0x4df7fd)){var _0x3ca329=_['find'](this[_0x68ef('0xe')],function(_0x5c6b60){return _0x5c6b60[_0x68ef('0x1b')]==_0x1acffa||_0x5c6b60['name']==_0x1acffa;});if(_0x3ca329){_0x4df7fd=_['find'](this['agents'],function(_0x5d206d){return _0x5d206d[_0x68ef('0x1d')]==util['format'](_0x68ef('0x1e'),_0x3ca329[_0x68ef('0x1f')]);});}}return _0x4df7fd;};Report['prototype'][_0x68ef('0x14')]=function(_0x4f4b80){for(var _0x1cb1d7=0x0;_0x1cb1d7<_0x4f4b80[_0x68ef('0x20')];_0x1cb1d7+=0x1){var _0x1e87fd=this[_0x68ef('0x21')](_0x4f4b80[_0x1cb1d7]['connectedlinenum']);if(_0x1e87fd){_0x4f4b80[_0x1cb1d7]['accountcode']=_0x1e87fd[_0x68ef('0x1b')];_0x4f4b80[_0x1cb1d7][_0x68ef('0x22')]=!![];_0x4f4b80[_0x1cb1d7][_0x68ef('0x23')]=_0x1e87fd[_0x68ef('0x1f')];_0x4f4b80[_0x1cb1d7][_0x68ef('0x1d')]=_[_0x68ef('0x1c')](_0x1e87fd[_0x68ef('0x1d')])?util[_0x68ef('0x24')](_0x68ef('0x1e'),_0x1e87fd[_0x68ef('0x1f')]):_0x1e87fd[_0x68ef('0x1d')];if(_0x4f4b80[_0x1cb1d7][_0x68ef('0x25')]){_0x4f4b80[_0x1cb1d7][_0x68ef('0x26')]=moment()[_0x68ef('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f4b80[_0x1cb1d7]['queuecallerexit']){_0x4f4b80[_0x1cb1d7][_0x68ef('0x27')]=moment()[_0x68ef('0x24')](_0x68ef('0x28'));}RpcMemberReport[_0x68ef('0x14')](_0x4f4b80[_0x1cb1d7]);}RpcVoiceQueueReport[_0x68ef('0x29')](_0x4f4b80[_0x1cb1d7]);}};function extractCalleridNumber(_0x1fc9d6){var _0x1bd697=_0x1fc9d6[_0x68ef('0x2a')](/<(.*?)>/);return _0x1bd697?_0x1bd697[0x1]:_0x1fc9d6;}Report['prototype'][_0x68ef('0x16')]=function(_0x3aa077){_0x3aa077[_0x68ef('0x2b')]=_0x3aa077[_0x68ef('0x2b')]||_0x3aa077[_0x68ef('0x2c')];if(_0x3aa077[_0x68ef('0x2d')]==_0x68ef('0x2e')){_0x3aa077[_0x68ef('0x2f')]='queue';_0x3aa077[_0x68ef('0x30')]=_0x3aa077[_0x68ef('0x31')];if(_0x3aa077[_0x68ef('0x32')]=='from-voip-provider'){_0x3aa077[_0x68ef('0x1b')]='';_0x3aa077[_0x68ef('0x2b')]=extractCalleridNumber(_0x3aa077[_0x68ef('0x33')]);}else if(_0x3aa077['context']==_0x68ef('0x34')){if(_0x3aa077['destination']==_0x68ef('0x35')){_0x3aa077[_0x68ef('0x2b')]=extractCalleridNumber(_0x3aa077[_0x68ef('0x36')]);_0x3aa077[_0x68ef('0x37')]=_0x3aa077[_0x68ef('0x38')];_0x3aa077['destinationchannel']=[_0x3aa077[_0x68ef('0x39')],_0x3aa077[_0x68ef('0x39')]=_0x3aa077['destinationchannel']][0x0];_0x3aa077['callerid']=_0x3aa077['calleridpreview'];}else{_0x3aa077[_0x68ef('0x2b')]=_0x3aa077[_0x68ef('0x37')];_0x3aa077[_0x68ef('0x37')]=_0x3aa077['originatecalleridnum'];if(_0x3aa077[_0x68ef('0x3a')]==_0x68ef('0x3b')){_0x3aa077[_0x68ef('0x1b')]=_0x3aa077['connectedlinenum'];}else{_0x3aa077[_0x68ef('0x1b')]='';}}}}else{_0x3aa077[_0x68ef('0x33')]=util['format'](_0x68ef('0x3c'),_0x3aa077[_0x68ef('0x3d')],_0x3aa077['calleridnum']);}RpcVoiceCallReport[_0x68ef('0x29')](_0x3aa077);if(_0x3aa077[_0x68ef('0x3e')]){for(var _0xe45624=0x0;_0xe45624<_0x3aa077[_0x68ef('0x3f')][_0x68ef('0x20')];_0xe45624+=0x1){_0x3aa077[_0x68ef('0x40')]=_0x3aa077[_0x68ef('0x3f')][_0xe45624][_0x68ef('0x41')];_0x3aa077[_0x68ef('0x42')]=_0x3aa077[_0x68ef('0x3f')][_0xe45624]['createdAt'];if(_0x3aa077[_0x68ef('0x2c')]=='xcally-motion-preview'){_0x3aa077[_0x68ef('0x37')]=_0x3aa077[_0x68ef('0x43')];_0x3aa077[_0x68ef('0x3d')]=_0x3aa077[_0x68ef('0x44')];_0x3aa077[_0x68ef('0x43')]=_0x3aa077['accountcode'];_0x3aa077[_0x68ef('0x44')]=_0x3aa077[_0x68ef('0x45')];_0x3aa077[_0x68ef('0x2c')]=_0x3aa077[_0x68ef('0x38')];}else if(_0x3aa077[_0x68ef('0x2c')]==_0x68ef('0x46')){_0x3aa077[_0x68ef('0x37')]=_0x3aa077['destination'];_0x3aa077[_0x68ef('0x2c')]=_0x3aa077['originatecalleridnum'];}RpcVoiceRecording[_0x68ef('0x29')](_0x3aa077);}}};Report[_0x68ef('0xf')][_0x68ef('0x47')]=function(_0x5bca1c){if(_[_0x68ef('0x48')](_0x5bca1c)){_0x5bca1c[_0x68ef('0x49')](function(_0x30f061){RpcVoiceAgentReport[_0x68ef('0x29')](_0x30f061);});}else{RpcVoiceAgentReport[_0x68ef('0x29')](_0x5bca1c);}};Report['prototype'][_0x68ef('0x4a')]=function(_0x5d2bdf){RpcVoiceDialReport[_0x68ef('0x29')](_0x5d2bdf);var _0x417a41=undefined;var _0x244661=_0x5d2bdf[_0x68ef('0x39')];if(_[_0x68ef('0x4b')](_0x244661,_0x68ef('0x4c'))){var _0x4c0211=_0x244661[_0x68ef('0x4d')](_0x244661['indexOf']('/')+0x1,_0x244661['indexOf']('@'));_0x417a41=_['find'](this[_0x68ef('0xd')],function(_0x5eda4d){return _0x5eda4d['mobile']==_0x4c0211||_0x5eda4d['phone']==_0x4c0211||_0x5eda4d[_0x68ef('0x1b')]==_0x4c0211;});}else{var _0x4c0211=_0x244661[_0x68ef('0x4d')](_0x244661[_0x68ef('0x4e')]('/')+0x1,_0x244661[_0x68ef('0x4f')]('-'));_0x417a41=this[_0x68ef('0x21')](_0x4c0211);}if(_0x417a41){_0x5d2bdf['interface']=_[_0x68ef('0x1c')](_0x417a41[_0x68ef('0x1d')])?util[_0x68ef('0x24')](_0x68ef('0x1e'),_0x417a41['name']):_0x417a41[_0x68ef('0x1d')];_0x5d2bdf[_0x68ef('0x45')]=_0x417a41[_0x68ef('0x1f')];_0x5d2bdf[_0x68ef('0x1b')]=_0x417a41[_0x68ef('0x1b')];RpcMemberReport[_0x68ef('0x4a')](_0x5d2bdf);}};Report[_0x68ef('0xf')][_0x68ef('0x50')]=function(_0x32ef84){RpcVoiceTransferReport[_0x68ef('0x50')](_0x32ef84);};Report['prototype']['attendedTransfer']=function(_0x582fdd){RpcVoiceTransferReport[_0x68ef('0x19')](_0x582fdd);};module[_0x68ef('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 4cadef5..6a53d78 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 _0x7e89=['updateStatusRealtime','telephone:%s','name','trunk:save','Queue','Local','substring','indexOf','phone','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','peerstatus','status','address','telephone:save','[syncPeerStatus][UserReport]','exports','bluebird','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','syncDeviceState','loopSyncRealTimeShow','resolve','then','catch','inspect','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','isNotNull','isUndefined','prototype','emit','find','username','merge','omit','event','actionid','state','format','trunk:%s','error','[syncRegistry][UserReport]','device','toLowerCase','inuse','local','stateTime','toNumber'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0x7e89,0xd9));var _0x97e8=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x7e89[_0x46ae5a];return _0x434986;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x97e8('0x0'));var util=require('util');var Redis=require(_0x97e8('0x1'));var config=require(_0x97e8('0x2'));var logger=require(_0x97e8('0x3'))(_0x97e8('0x4'));var ami=require(_0x97e8('0x5'));config[_0x97e8('0x6')]=_[_0x97e8('0x7')](config[_0x97e8('0x6')],{'host':_0x97e8('0x8'),'port':0x18eb});var io=require(_0x97e8('0x9'))(new Redis(config[_0x97e8('0x6')]));function UserReport(_0x3a15bc){this['trunks']=_0x3a15bc[_0x97e8('0xa')];this[_0x97e8('0xb')]=_0x3a15bc[_0x97e8('0xb')];this['telephones']=_0x3a15bc[_0x97e8('0xc')];ami['on'](_0x97e8('0xd'),this['syncRegistry'][_0x97e8('0xe')](this));ami['on']('registry',this[_0x97e8('0xf')][_0x97e8('0xe')](this));ami['on'](_0x97e8('0x10'),this[_0x97e8('0x11')][_0x97e8('0xe')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x97e8('0xe')](this));this[_0x97e8('0x12')]();return BPromise[_0x97e8('0x13')]()[_0x97e8('0x14')](ami['actionSipShowRegistry']())[_0x97e8('0x14')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())[_0x97e8('0x15')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x4bef7c){return function(_0xf75a1e){logger['error'](_0x4bef7c,util[_0x97e8('0x16')](_0xf75a1e,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0x97e8('0x13')]()[_0x97e8('0x14')](ami[_0x97e8('0x17')]())['then'](ami['actionDeviceStateList']())[_0x97e8('0x14')](ami[_0x97e8('0x18')]())[_0x97e8('0x15')](loggerCatch(_0x97e8('0x19')));},0x32c8);};UserReport['prototype'][_0x97e8('0x1a')]=function(_0x3d6a3d){return _0x3d6a3d!==null&&!_[_0x97e8('0x1b')](_0x3d6a3d);};UserReport[_0x97e8('0x1c')][_0x97e8('0x1d')]=function(_0x574486,_0x4c9be9,_0x107afd){io['to'](_0x574486)[_0x97e8('0x1d')](_0x4c9be9,_0x107afd);};UserReport[_0x97e8('0x1c')][_0x97e8('0xf')]=function(_0x38d9fe){try{if(this[_0x97e8('0x1a')](_0x38d9fe)){var _0x1eae62=_[_0x97e8('0x1e')](this[_0x97e8('0xa')],{'registry':_0x38d9fe[_0x97e8('0x1f')]});if(_0x1eae62){_0x38d9fe['stateRegistry']=_0x38d9fe['state'];_[_0x97e8('0x20')](_0x1eae62,_[_0x97e8('0x21')](_0x38d9fe,[_0x97e8('0x22'),_0x97e8('0x23'),_0x97e8('0x1f'),_0x97e8('0x24')]));this[_0x97e8('0x1d')](util[_0x97e8('0x25')](_0x97e8('0x26'),_0x1eae62['name']),'trunk:save',_0x1eae62);}}}catch(_0x5e17e7){logger[_0x97e8('0x27')](_0x97e8('0x28'),util[_0x97e8('0x16')](_0x5e17e7,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x97e8('0x11')]=function(_0x59167b){try{if(this[_0x97e8('0x1a')](_0x59167b)){if(this[_0x97e8('0xb')][_0x59167b[_0x97e8('0x29')]]){if(!this[_0x97e8('0xb')][_0x59167b[_0x97e8('0x29')]]['local']||_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]()==_0x97e8('0x2b')){this[_0x97e8('0xb')][_0x59167b[_0x97e8('0x29')]][_0x97e8('0x2c')]=![];if(this[_0x97e8('0xb')][_0x59167b['device']][_0x97e8('0x24')]!==_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]()){this[_0x97e8('0xb')][_0x59167b[_0x97e8('0x29')]][_0x97e8('0x2d')]=_[_0x97e8('0x2e')](moment()[_0x97e8('0x25')]('x'));}this[_0x97e8('0xb')][_0x59167b['device']][_0x97e8('0x24')]=_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]();this[_0x97e8('0xb')][_0x59167b['device']][_0x97e8('0x2f')](_0x59167b);}}else if(this[_0x97e8('0xc')][_0x59167b[_0x97e8('0x29')]]){if(this['telephones'][_0x59167b[_0x97e8('0x29')]]['state']!==_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]()){this[_0x97e8('0xc')][_0x59167b[_0x97e8('0x29')]][_0x97e8('0x2d')]=_[_0x97e8('0x2e')](moment()['format']('x'));}this[_0x97e8('0xc')][_0x59167b[_0x97e8('0x29')]][_0x97e8('0x24')]=_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]();this[_0x97e8('0x1d')](util[_0x97e8('0x25')](_0x97e8('0x30'),this[_0x97e8('0xc')][_0x59167b['device']][_0x97e8('0x31')]),'telephone:save',this[_0x97e8('0xc')][_0x59167b[_0x97e8('0x29')]]);}else if(this[_0x97e8('0xa')][_0x59167b[_0x97e8('0x29')]]){if(this['trunks'][_0x59167b[_0x97e8('0x29')]]['state']!==_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]()){this[_0x97e8('0xa')][_0x59167b[_0x97e8('0x29')]]['stateTime']=_['toNumber'](moment()[_0x97e8('0x25')]('x'));}this[_0x97e8('0xa')][_0x59167b[_0x97e8('0x29')]][_0x97e8('0x24')]=_0x59167b['state']['toLowerCase']();this['emit'](util['format'](_0x97e8('0x26'),this[_0x97e8('0xa')][_0x59167b['device']][_0x97e8('0x31')]),_0x97e8('0x32'),this['trunks'][_0x59167b[_0x97e8('0x29')]]);}else if(_['startsWith'](_0x59167b[_0x97e8('0x29')],_0x97e8('0x33'))){}else if(_['startsWith'](_0x59167b['device'],_0x97e8('0x34'))){var _0x1ff224=_0x59167b[_0x97e8('0x29')];var _0x14b174=_0x1ff224[_0x97e8('0x35')](_0x1ff224[_0x97e8('0x36')]('/')+0x1,_0x1ff224['indexOf']('@'));var _0xc2845f=_['find'](this[_0x97e8('0xb')],function(_0x2c8f79){return _0x2c8f79['mobile']==_0x14b174||_0x2c8f79[_0x97e8('0x37')]==_0x14b174||_0x2c8f79[_0x97e8('0x38')]==_0x14b174;});if(_0xc2845f){if(_0xc2845f[_0x97e8('0x24')]!==_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]()){_0xc2845f[_0x97e8('0x2d')]=_[_0x97e8('0x2e')](moment()['format']('x'));}_0xc2845f[_0x97e8('0x24')]=_0x59167b[_0x97e8('0x24')][_0x97e8('0x2a')]();_0xc2845f[_0x97e8('0x2c')]=!![];_0xc2845f[_0x97e8('0x2f')](_0x59167b);}}else{}}}catch(_0x539dd4){logger['error'](_0x97e8('0x39'),util[_0x97e8('0x16')](_0x539dd4,{'showHidden':![],'depth':null}));}};UserReport[_0x97e8('0x1c')][_0x97e8('0x3a')]=function(_0x31e4d4){try{if(this[_0x97e8('0x1a')](_0x31e4d4)&&this[_0x97e8('0x1a')](_0x31e4d4['peerstatus'])){if(this[_0x97e8('0xb')][_0x31e4d4[_0x97e8('0x3b')]]){if(!this[_0x97e8('0xb')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x2c')]||_0x31e4d4[_0x97e8('0x3c')]['toLowerCase']()=='registered'){this[_0x97e8('0xb')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x2c')]=![];this[_0x97e8('0xb')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x3d')]=_0x31e4d4[_0x97e8('0x3c')]['toLowerCase']();this[_0x97e8('0xb')][_0x31e4d4['peer']]['address']=_0x31e4d4[_0x97e8('0x3e')];this[_0x97e8('0xb')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x2f')](_0x31e4d4);}}else if(this[_0x97e8('0xc')][_0x31e4d4[_0x97e8('0x3b')]]){this['telephones'][_0x31e4d4[_0x97e8('0x3b')]]['status']=_0x31e4d4[_0x97e8('0x3c')]['toLowerCase']();this[_0x97e8('0xc')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x3e')]=_0x31e4d4[_0x97e8('0x3e')];this[_0x97e8('0x1d')](util[_0x97e8('0x25')](_0x97e8('0x30'),this[_0x97e8('0xc')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x31')]),_0x97e8('0x3f'),this['telephones'][_0x31e4d4[_0x97e8('0x3b')]]);}else if(this['trunks'][_0x31e4d4[_0x97e8('0x3b')]]){this[_0x97e8('0xa')][_0x31e4d4['peer']][_0x97e8('0x3d')]=_0x31e4d4[_0x97e8('0x3c')][_0x97e8('0x2a')]();this[_0x97e8('0xa')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x3e')]=_0x31e4d4[_0x97e8('0x3e')];this['emit'](util['format'](_0x97e8('0x26'),this[_0x97e8('0xa')][_0x31e4d4[_0x97e8('0x3b')]][_0x97e8('0x31')]),_0x97e8('0x32'),this[_0x97e8('0xa')][_0x31e4d4['peer']]);}else{}}}catch(_0x3c770d){logger['error'](_0x97e8('0x40'),util[_0x97e8('0x16')](_0x3c770d,{'showHidden':![],'depth':null}));}};module[_0x97e8('0x41')]=UserReport; \ No newline at end of file +var _0xbc3b=['../ami','defaults','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','state','error','[syncRegistry][UserReport]','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','name','telephone:save','trunk:%s','trunk:save','startsWith','Queue','Local','substring','indexOf','[syncDeviceState][UserReport]','syncPeerStatus','peerstatus','peer','address','status','inspect','exports','moment','bluebird','ioredis','../../../config/environment','ami'];(function(_0x39c907,_0x4c78e){var _0x36409e=function(_0x35272d){while(--_0x35272d){_0x39c907['push'](_0x39c907['shift']());}};_0x36409e(++_0x4c78e);}(_0xbc3b,0x198));var _0xbbc3=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xbc3b[_0x40d8d7];return _0x3454cc;};'use strict';var _=require('lodash');var moment=require(_0xbbc3('0x0'));var BPromise=require(_0xbbc3('0x1'));var util=require('util');var Redis=require(_0xbbc3('0x2'));var config=require(_0xbbc3('0x3'));var logger=require('../../../config/logger')(_0xbbc3('0x4'));var ami=require(_0xbbc3('0x5'));config['redis']=_[_0xbbc3('0x6')](config[_0xbbc3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xbbc3('0x8'))(new Redis(config[_0xbbc3('0x7')]));function UserReport(_0x4beb58){this[_0xbbc3('0x9')]=_0x4beb58['trunks'];this[_0xbbc3('0xa')]=_0x4beb58[_0xbbc3('0xa')];this[_0xbbc3('0xb')]=_0x4beb58['telephones'];ami['on'](_0xbbc3('0xc'),this[_0xbbc3('0xd')][_0xbbc3('0xe')](this));ami['on'](_0xbbc3('0xf'),this[_0xbbc3('0xd')][_0xbbc3('0xe')](this));ami['on'](_0xbbc3('0x10'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this['syncPeerStatus'][_0xbbc3('0xe')](this));this['loopSyncRealTimeShow']();return BPromise['resolve']()[_0xbbc3('0x11')](ami['actionSipShowRegistry']())[_0xbbc3('0x11')](ami[_0xbbc3('0x12')]())[_0xbbc3('0x11')](ami[_0xbbc3('0x13')]())[_0xbbc3('0x14')](loggerCatch(_0xbbc3('0x15')));}function loggerCatch(_0x1f89e5){return function(_0x55d9d3){logger['error'](_0x1f89e5,util['inspect'](_0x55d9d3,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0xbbc3('0x11')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xbbc3('0x11')](ami[_0xbbc3('0x13')]())[_0xbbc3('0x14')](loggerCatch(_0xbbc3('0x15')));},0x32c8);};UserReport[_0xbbc3('0x16')][_0xbbc3('0x17')]=function(_0x5f4d2d){return _0x5f4d2d!==null&&!_[_0xbbc3('0x18')](_0x5f4d2d);};UserReport['prototype']['emit']=function(_0xe11fe1,_0x54244a,_0x5f2632){io['to'](_0xe11fe1)[_0xbbc3('0x19')](_0x54244a,_0x5f2632);};UserReport[_0xbbc3('0x16')]['syncRegistry']=function(_0x1275fc){try{if(this[_0xbbc3('0x17')](_0x1275fc)){var _0x45d3bc=_[_0xbbc3('0x1a')](this[_0xbbc3('0x9')],{'registry':_0x1275fc[_0xbbc3('0x1b')]});if(_0x45d3bc){_0x1275fc[_0xbbc3('0x1c')]=_0x1275fc[_0xbbc3('0x1d')];_['merge'](_0x45d3bc,_['omit'](_0x1275fc,['event','actionid',_0xbbc3('0x1b'),_0xbbc3('0x1d')]));this[_0xbbc3('0x19')](util['format']('trunk:%s',_0x45d3bc['name']),'trunk:save',_0x45d3bc);}}}catch(_0x5f3e70){logger[_0xbbc3('0x1e')](_0xbbc3('0x1f'),util['inspect'](_0x5f3e70,{'showHidden':![],'depth':null}));}};UserReport[_0xbbc3('0x16')][_0xbbc3('0x20')]=function(_0x531ac4){try{if(this[_0xbbc3('0x17')](_0x531ac4)){if(this[_0xbbc3('0xa')][_0x531ac4[_0xbbc3('0x21')]]){if(!this['agents'][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x22')]||_0x531ac4['state'][_0xbbc3('0x23')]()==_0xbbc3('0x24')){this[_0xbbc3('0xa')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x22')]=![];if(this[_0xbbc3('0xa')][_0x531ac4['device']]['state']!==_0x531ac4['state'][_0xbbc3('0x23')]()){this[_0xbbc3('0xa')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x25')]=_[_0xbbc3('0x26')](moment()[_0xbbc3('0x27')]('x'));}this[_0xbbc3('0xa')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x1d')]=_0x531ac4['state'][_0xbbc3('0x23')]();this['agents'][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x28')](_0x531ac4);}}else if(this[_0xbbc3('0xb')][_0x531ac4[_0xbbc3('0x21')]]){if(this['telephones'][_0x531ac4['device']]['state']!==_0x531ac4['state']['toLowerCase']()){this[_0xbbc3('0xb')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x25')]=_[_0xbbc3('0x26')](moment()[_0xbbc3('0x27')]('x'));}this[_0xbbc3('0xb')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x1d')]=_0x531ac4['state'][_0xbbc3('0x23')]();this[_0xbbc3('0x19')](util[_0xbbc3('0x27')](_0xbbc3('0x29'),this[_0xbbc3('0xb')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x2a')]),_0xbbc3('0x2b'),this[_0xbbc3('0xb')][_0x531ac4[_0xbbc3('0x21')]]);}else if(this[_0xbbc3('0x9')][_0x531ac4[_0xbbc3('0x21')]]){if(this[_0xbbc3('0x9')][_0x531ac4[_0xbbc3('0x21')]]['state']!==_0x531ac4[_0xbbc3('0x1d')][_0xbbc3('0x23')]()){this[_0xbbc3('0x9')][_0x531ac4[_0xbbc3('0x21')]][_0xbbc3('0x25')]=_['toNumber'](moment()[_0xbbc3('0x27')]('x'));}this['trunks'][_0x531ac4['device']][_0xbbc3('0x1d')]=_0x531ac4[_0xbbc3('0x1d')][_0xbbc3('0x23')]();this[_0xbbc3('0x19')](util[_0xbbc3('0x27')](_0xbbc3('0x2c'),this[_0xbbc3('0x9')][_0x531ac4[_0xbbc3('0x21')]]['name']),_0xbbc3('0x2d'),this[_0xbbc3('0x9')][_0x531ac4[_0xbbc3('0x21')]]);}else if(_[_0xbbc3('0x2e')](_0x531ac4['device'],_0xbbc3('0x2f'))){}else if(_[_0xbbc3('0x2e')](_0x531ac4['device'],_0xbbc3('0x30'))){var _0x40ab21=_0x531ac4[_0xbbc3('0x21')];var _0x2e2242=_0x40ab21[_0xbbc3('0x31')](_0x40ab21['indexOf']('/')+0x1,_0x40ab21[_0xbbc3('0x32')]('@'));var _0x434637=_[_0xbbc3('0x1a')](this[_0xbbc3('0xa')],function(_0x37c80f){return _0x37c80f['mobile']==_0x2e2242||_0x37c80f['phone']==_0x2e2242||_0x37c80f['accountcode']==_0x2e2242;});if(_0x434637){if(_0x434637[_0xbbc3('0x1d')]!==_0x531ac4['state']['toLowerCase']()){_0x434637[_0xbbc3('0x25')]=_['toNumber'](moment()[_0xbbc3('0x27')]('x'));}_0x434637[_0xbbc3('0x1d')]=_0x531ac4['state'][_0xbbc3('0x23')]();_0x434637[_0xbbc3('0x22')]=!![];_0x434637[_0xbbc3('0x28')](_0x531ac4);}}else{}}}catch(_0xa2bd2a){logger[_0xbbc3('0x1e')](_0xbbc3('0x33'),util['inspect'](_0xa2bd2a,{'showHidden':![],'depth':null}));}};UserReport[_0xbbc3('0x16')][_0xbbc3('0x34')]=function(_0x4f3124){try{if(this[_0xbbc3('0x17')](_0x4f3124)&&this[_0xbbc3('0x17')](_0x4f3124[_0xbbc3('0x35')])){if(this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]]){if(!this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x22')]||_0x4f3124[_0xbbc3('0x35')][_0xbbc3('0x23')]()=='registered'){this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]]['local']=![];this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]]['status']=_0x4f3124['peerstatus'][_0xbbc3('0x23')]();this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x37')]=_0x4f3124[_0xbbc3('0x37')];this[_0xbbc3('0xa')][_0x4f3124[_0xbbc3('0x36')]]['updateStatusRealtime'](_0x4f3124);}}else if(this['telephones'][_0x4f3124[_0xbbc3('0x36')]]){this[_0xbbc3('0xb')][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x38')]=_0x4f3124['peerstatus'][_0xbbc3('0x23')]();this[_0xbbc3('0xb')][_0x4f3124['peer']][_0xbbc3('0x37')]=_0x4f3124[_0xbbc3('0x37')];this[_0xbbc3('0x19')](util[_0xbbc3('0x27')](_0xbbc3('0x29'),this['telephones'][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x2a')]),_0xbbc3('0x2b'),this[_0xbbc3('0xb')][_0x4f3124[_0xbbc3('0x36')]]);}else if(this[_0xbbc3('0x9')][_0x4f3124[_0xbbc3('0x36')]]){this['trunks'][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x38')]=_0x4f3124[_0xbbc3('0x35')][_0xbbc3('0x23')]();this[_0xbbc3('0x9')][_0x4f3124[_0xbbc3('0x36')]]['address']=_0x4f3124['address'];this[_0xbbc3('0x19')](util[_0xbbc3('0x27')]('trunk:%s',this['trunks'][_0x4f3124[_0xbbc3('0x36')]][_0xbbc3('0x2a')]),_0xbbc3('0x2d'),this[_0xbbc3('0x9')][_0x4f3124[_0xbbc3('0x36')]]);}else{}}}catch(_0x474508){logger[_0xbbc3('0x1e')]('[syncPeerStatus][UserReport]',util[_0xbbc3('0x39')](_0x474508,{'showHidden':![],'depth':null}));}};module[_0xbbc3('0x3a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 49f39c4..2461d46 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 _0x4992=['blindtransfer','emit','prototype','isNotNull','isUndefined','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','event','privilege','custom:agentcalled','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','syncAgentConnect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','pick','custom:agentconnect','agentringnoanswerAt','reason','answeredelsewheredestinationuniqueid','error','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','transfer','agent','acw','agentacw','omit','destconnectedlinenum','user:%s','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','complete','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','diff','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x4992,0x1c5));var _0x2499=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x4992[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x2499('0x0'));var moment=require(_0x2499('0x1'));var util=require(_0x2499('0x2'));var Redis=require('ioredis');var config=require(_0x2499('0x3'));var logger=require(_0x2499('0x4'))(_0x2499('0x5'));var ami=require(_0x2499('0x6'));config[_0x2499('0x7')]=_[_0x2499('0x8')](config[_0x2499('0x7')],{'host':_0x2499('0x9'),'port':0x18eb});var io=require(_0x2499('0xa'))(new Redis(config[_0x2499('0x7')]));function VoiceAgentReport(_0x20edaf){this['channels']={};this['voiceQueues']=_0x20edaf[_0x2499('0xb')];this[_0x2499('0xc')]=_0x20edaf[_0x2499('0xc')];this[_0x2499('0xd')]={};ami['on'](_0x2499('0xe'),this[_0x2499('0xf')][_0x2499('0x10')](this));ami['on'](_0x2499('0x11'),this['syncAgentConnect'][_0x2499('0x10')](this));ami['on'](_0x2499('0x12'),this[_0x2499('0x13')]['bind'](this));ami['on']('queuecallerabandon',this[_0x2499('0x14')]['bind'](this));ami['on'](_0x2499('0x15'),this[_0x2499('0x16')][_0x2499('0x10')](this));ami['on'](_0x2499('0x17'),this[_0x2499('0x18')][_0x2499('0x10')](this));ami['on'](_0x2499('0x19'),this[_0x2499('0x1a')]['bind'](this));ami['on'](_0x2499('0x1b'),this[_0x2499('0x1c')]['bind'](this));ami['on'](_0x2499('0x1d'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x2499('0x1e'),this['syncAttendedTransfer'][_0x2499('0x10')](this));ami['on'](_0x2499('0x1f'),this['syncBlindTransfer'][_0x2499('0x10')](this));}VoiceAgentReport['prototype'][_0x2499('0x20')]=function(_0x1ffd86,_0x34ffa7,_0x4815e7){io['to'](_0x1ffd86)[_0x2499('0x20')](_0x34ffa7,_0x4815e7);};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x22')]=function(_0x13c4c6){return _0x13c4c6!==null&&!_[_0x2499('0x23')](_0x13c4c6);};VoiceAgentReport[_0x2499('0x21')][_0x2499('0xf')]=function(_0x5888d7){try{if(this[_0x2499('0x22')](_0x5888d7)){if(_[_0x2499('0x23')](this['channels'][_0x5888d7['uniqueid']])){this[_0x2499('0x24')][_0x5888d7['uniqueid']]={};}if(_[_0x2499('0x23')](this[_0x2499('0x24')][_0x5888d7[_0x2499('0x25')]][_0x5888d7[_0x2499('0x26')]])){this[_0x2499('0x24')][_0x5888d7[_0x2499('0x25')]][_0x5888d7[_0x2499('0x26')]]={'agentcalledAt':moment()[_0x2499('0x27')](_0x2499('0x28')),'lastevent':_0x2499('0x29'),'variables':this['variables'][_0x5888d7[_0x2499('0x25')]],'type':this[_0x2499('0xb')][_0x5888d7[_0x2499('0x2a')]]?this[_0x2499('0xb')][_0x5888d7[_0x2499('0x2a')]]['type']||_0x2499('0x2b'):'inbound'};}_['merge'](this[_0x2499('0x24')][_0x5888d7[_0x2499('0x25')]][_0x5888d7[_0x2499('0x26')]],_['omit'](_0x5888d7,[_0x2499('0x2c'),_0x2499('0x2d')]));ami[_0x2499('0x20')](_0x2499('0x2e'),this[_0x2499('0x24')][_0x5888d7[_0x2499('0x25')]][_0x5888d7['destuniqueid']]);this[_0x2499('0x20')](util[_0x2499('0x27')]('user:%s',_0x5888d7[_0x2499('0x2f')]),_0x2499('0x30'),this[_0x2499('0x24')][_0x5888d7['uniqueid']][_0x5888d7[_0x2499('0x26')]]);}}catch(_0x524b41){logger['error'](_0x2499('0x31'),util[_0x2499('0x32')](_0x524b41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x33')]=function(_0x544e91){try{if(this[_0x2499('0x22')](_0x544e91)){if(this['channels'][_0x544e91[_0x2499('0x25')]]){for(var _0x240d73 in this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]]){if(this['channels'][_0x544e91[_0x2499('0x25')]][_0x2499('0x34')](_0x240d73)){if(_0x544e91[_0x2499('0x26')]===_0x240d73){this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x35')]=moment()['format'](_0x2499('0x28'));this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x36')]=_0x2499('0x37');this[_0x2499('0x24')][_0x544e91['uniqueid']][_0x240d73]['holdtime']=_0x544e91[_0x2499('0x38')];this[_0x2499('0x24')][_0x544e91['uniqueid']][_0x240d73][_0x2499('0x39')]=_0x544e91[_0x2499('0x39')];this['channels'][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x3a')]=_0x544e91[_0x2499('0x3a')];this[_0x2499('0x24')][_0x544e91['uniqueid']][_0x240d73][_0x2499('0x3b')]=_0x544e91['destchannelstate'];this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x3c')]=_0x544e91[_0x2499('0x3c')];_[_0x2499('0x3d')](this[_0x2499('0xc')][_0x544e91[_0x2499('0x3e')]],_[_0x2499('0x3f')](_0x544e91,[_0x2499('0x2a'),'destconnectedlinenum']));this[_0x2499('0x20')](util[_0x2499('0x27')]('user:%s',_0x544e91[_0x2499('0x2f')]),'user:agentconnect',this['channels'][_0x544e91[_0x2499('0x25')]][_0x544e91['destuniqueid']]);ami['emit'](_0x2499('0x40'),this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73]);}else if(!this[_0x2499('0x24')][_0x544e91['uniqueid']][_0x240d73][_0x2499('0x12')]&&!this['channels'][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x15')]){this['channels'][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x12')]=!![];this['channels'][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x41')]=moment()[_0x2499('0x27')](_0x2499('0x28'));this['channels'][_0x544e91['uniqueid']][_0x240d73][_0x2499('0x42')]='answered_elsewhere';this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x36')]='answered_elsewhere';this['channels'][_0x544e91[_0x2499('0x25')]][_0x240d73][_0x2499('0x43')]=_0x544e91[_0x2499('0x26')];this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73]['answeredelsewheremembername']=_0x544e91[_0x2499('0x2f')];ami[_0x2499('0x20')]('custom:agentansweredelsewhere',this[_0x2499('0x24')][_0x544e91[_0x2499('0x25')]][_0x240d73]);}}}}}}catch(_0x1b6aa6){logger[_0x2499('0x44')](_0x2499('0x45'),util['inspect'](_0x1b6aa6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x13')]=function(_0x337711){try{if(this['isNotNull'](_0x337711)){if(this[_0x2499('0x24')][_0x337711['uniqueid']]&&this[_0x2499('0x24')][_0x337711[_0x2499('0x25')]][_0x337711[_0x2499('0x26')]]){this['channels'][_0x337711[_0x2499('0x25')]][_0x337711['destuniqueid']][_0x2499('0x12')]=!![];this[_0x2499('0x24')][_0x337711[_0x2499('0x25')]][_0x337711['destuniqueid']][_0x2499('0x41')]=moment()['format'](_0x2499('0x28'));this[_0x2499('0x24')][_0x337711[_0x2499('0x25')]][_0x337711[_0x2499('0x26')]][_0x2499('0x42')]='rejected';this['channels'][_0x337711['uniqueid']][_0x337711[_0x2499('0x26')]]['lastevent']=_0x2499('0x46');ami[_0x2499('0x20')](_0x2499('0x47'),this[_0x2499('0x24')][_0x337711[_0x2499('0x25')]][_0x337711['destuniqueid']]);}}}catch(_0x4ea684){logger[_0x2499('0x44')](_0x2499('0x48'),util[_0x2499('0x32')](_0x4ea684,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x14')]=function(_0x35a46c){try{if(this[_0x2499('0x22')](_0x35a46c)){if(this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]]){for(var _0x141601 in this['channels'][_0x35a46c[_0x2499('0x25')]]){if(this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]]['hasOwnProperty'](_0x141601)&&!this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601][_0x2499('0x12')]&&!this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601][_0x2499('0x15')]){this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601]['agentringnoanswer']=!![];this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601][_0x2499('0x41')]=moment()[_0x2499('0x27')](_0x2499('0x28'));this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601][_0x2499('0x42')]=_0x2499('0x49');this[_0x2499('0x24')][_0x35a46c[_0x2499('0x25')]][_0x141601][_0x2499('0x36')]=_0x2499('0x49');ami[_0x2499('0x20')](_0x2499('0x4a'),this['channels'][_0x35a46c[_0x2499('0x25')]][_0x141601]);}}}}}catch(_0x403901){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x403901,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x16')]=function(_0x4edc60){try{if(this[_0x2499('0x22')](_0x4edc60)){if(this[_0x2499('0x24')][_0x4edc60[_0x2499('0x25')]]){for(var _0x23a7cb in this[_0x2499('0x24')][_0x4edc60[_0x2499('0x25')]]){if(this[_0x2499('0x24')][_0x4edc60['uniqueid']][_0x2499('0x34')](_0x23a7cb)){if(this['channels'][_0x4edc60[_0x2499('0x25')]][_0x23a7cb]['agentconnectAt']&&!this[_0x2499('0x24')][_0x4edc60[_0x2499('0x25')]][_0x23a7cb][_0x2499('0x15')]){this['channels'][_0x4edc60[_0x2499('0x25')]][_0x23a7cb][_0x2499('0x15')]=!![];this['channels'][_0x4edc60[_0x2499('0x25')]][_0x23a7cb][_0x2499('0x4b')]=moment()['format'](_0x2499('0x28'));this[_0x2499('0x24')][_0x4edc60['uniqueid']][_0x23a7cb][_0x2499('0x36')]='complete';this[_0x2499('0x24')][_0x4edc60['uniqueid']][_0x23a7cb]['talktime']=_0x4edc60['talktime'];this[_0x2499('0x24')][_0x4edc60['uniqueid']][_0x23a7cb][_0x2499('0x42')]=_0x4edc60[_0x2499('0x42')]==_0x2499('0x4c')?_0x2499('0x4d'):_0x4edc60[_0x2499('0x42')];if(this[_0x2499('0xb')][_0x4edc60[_0x2499('0x2a')]]&&this[_0x2499('0xb')][_0x4edc60[_0x2499('0x2a')]][_0x2499('0x4e')]){this[_0x2499('0x24')][_0x4edc60[_0x2499('0x25')]][_0x23a7cb][_0x2499('0x4f')]=!![];this[_0x2499('0x24')][_0x4edc60['uniqueid']][_0x23a7cb]['acwtime']=this[_0x2499('0xb')][_0x4edc60[_0x2499('0x2a')]]['acwTimeout'];}this[_0x2499('0xc')][_0x4edc60[_0x2499('0x3e')]]=_[_0x2499('0x50')](this['agents'][_0x4edc60[_0x2499('0x3e')]],[_0x2499('0x2a'),_0x2499('0x51')]);this[_0x2499('0x20')](util[_0x2499('0x27')](_0x2499('0x52'),_0x4edc60['membername']),_0x2499('0x53'),this[_0x2499('0x24')][_0x4edc60[_0x2499('0x25')]][_0x23a7cb]);ami[_0x2499('0x20')](_0x2499('0x54'),this['channels'][_0x4edc60[_0x2499('0x25')]][_0x23a7cb]);}}}}}}catch(_0x255b92){logger['error'](_0x2499('0x55'),util[_0x2499('0x32')](_0x255b92,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x18')]=function(_0x2701a9){try{if(this[_0x2499('0x22')](_0x2701a9)){this[_0x2499('0x56')](_0x2701a9[_0x2499('0x25')],_['keys'](_0x2701a9[_0x2499('0x57')])[0x0],_0x2701a9[_0x2499('0x58')]);if(this[_0x2499('0x24')][_0x2701a9['uniqueid']]){for(var _0x29b080 in this[_0x2499('0x24')][_0x2701a9[_0x2499('0x25')]]){if(this[_0x2499('0x24')][_0x2701a9[_0x2499('0x25')]][_0x2499('0x34')](_0x29b080)){if(_[_0x2499('0x23')](this[_0x2499('0x24')][_0x2701a9[_0x2499('0x25')]][_0x29b080][_0x2499('0xd')])){this['channels'][_0x2701a9[_0x2499('0x25')]][_0x29b080][_0x2499('0xd')]={};}this[_0x2499('0x24')][_0x2701a9[_0x2499('0x25')]][_0x29b080][_0x2499('0xd')]=this[_0x2499('0xd')][_0x2701a9['uniqueid']];}}}}}catch(_0x5a3272){logger[_0x2499('0x44')]('[syncVarSet][VoiceAgentReport]',util['inspect'](_0x5a3272,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x27aea6,_0x4f5525,_0x3c237b){var _0x58fb4c=['rtpaudioqos',_0x2499('0x59'),_0x2499('0x5a'),'rtpaudioqosjitterbridged',_0x2499('0x5b'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x2499('0x5c'),_0x2499('0x5d'),'sipuri',_0x2499('0x5e'),_0x2499('0x5f'),'membercalls',_0x2499('0x60'),_0x2499('0x61'),_0x2499('0x62'),_0x2499('0x2f'),_0x2499('0x63'),'memberrealtime'];if(!_[_0x2499('0x64')](_0x4f5525)&&!_[_0x2499('0x65')](_0x58fb4c,_0x4f5525)){if(_[_0x2499('0x23')](this[_0x2499('0xd')][_0x27aea6])){this[_0x2499('0xd')][_0x27aea6]={};}this[_0x2499('0xd')][_0x27aea6][_0x4f5525]=_0x3c237b;}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x1a')]=function(_0x86a57){try{if(this['isNotNull'](_0x86a57)){if(this['channels'][_0x86a57[_0x2499('0x25')]]){for(var _0x3b4db0 in this[_0x2499('0x24')][_0x86a57[_0x2499('0x25')]]){if(this[_0x2499('0x24')][_0x86a57['uniqueid']][_0x2499('0x34')](_0x3b4db0)){if(this[_0x2499('0x24')][_0x86a57[_0x2499('0x25')]][_0x3b4db0]['reason']==_0x2499('0x4c')&&this[_0x2499('0x24')][_0x86a57[_0x2499('0x25')]][_0x3b4db0][_0x2499('0x15')]){this[_0x2499('0x24')][_0x86a57['uniqueid']][_0x3b4db0]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit'](_0x2499('0x66'),_[_0x2499('0x67')](this[_0x2499('0x24')][_0x86a57[_0x2499('0x25')]]));delete this[_0x2499('0x24')][_0x86a57[_0x2499('0x25')]];}if(this[_0x2499('0xd')][_0x86a57[_0x2499('0x25')]]){delete this[_0x2499('0xd')][_0x86a57[_0x2499('0x25')]];}}}catch(_0x1c2451){logger[_0x2499('0x44')](_0x2499('0x68'),util[_0x2499('0x32')](_0x1c2451,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x69')]=function(_0x3503e8){try{if(this[_0x2499('0x22')](_0x3503e8)){if(this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]]){for(var _0x68d160 in this['channels'][_0x3503e8[_0x2499('0x6a')]]){if(this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]]['hasOwnProperty'](_0x68d160)){if(_0x3503e8[_0x2499('0x6b')]===_0x68d160){var _0x51198a=moment();this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]][_0x68d160][_0x2499('0x15')]=!![];this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]][_0x68d160]['agentcompleteAt']=moment()[_0x2499('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]][_0x68d160][_0x2499('0x42')]=_0x2499('0x4c');this['channels'][_0x3503e8[_0x2499('0x6a')]][_0x68d160][_0x2499('0x36')]=_0x2499('0x6c');this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]][_0x68d160]['talktime']=_0x51198a['diff'](this['channels'][_0x3503e8[_0x2499('0x6a')]][_0x68d160][_0x2499('0x35')],_0x2499('0x6d'));}}}}if(this['channels'][_0x3503e8[_0x2499('0x6e')]]){var _0x3af588=this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6e')]];this[_0x2499('0x24')][_0x3503e8['secondtransfereruniqueid']]=this['channels'][_0x3503e8[_0x2499('0x6a')]];this[_0x2499('0x24')][_0x3503e8[_0x2499('0x6a')]]=_0x3af588;}}}catch(_0x2b56eb){logger[_0x2499('0x44')](_0x2499('0x6f'),util[_0x2499('0x32')](_0x2b56eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2499('0x21')][_0x2499('0x70')]=function(_0x198429){try{if(this[_0x2499('0x22')](_0x198429)){if(this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]]){for(var _0x5212d7 in this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]]){if(this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]]['hasOwnProperty'](_0x5212d7)){if(_0x198429['transfereruniqueid']===_0x5212d7){var _0x3a425d=moment();this[_0x2499('0x24')][_0x198429['transfereeuniqueid']][_0x5212d7]['agentcomplete']=!![];this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]][_0x5212d7][_0x2499('0x4b')]=_0x3a425d;this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]][_0x5212d7][_0x2499('0x42')]=_0x2499('0x4c');this[_0x2499('0x24')][_0x198429['transfereeuniqueid']][_0x5212d7]['lastevent']='complete';this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]][_0x5212d7]['talktime']=_0x3a425d[_0x2499('0x71')](this[_0x2499('0x24')][_0x198429[_0x2499('0x6a')]][_0x5212d7][_0x2499('0x35')],_0x2499('0x6d'));}}}}}}catch(_0x3efef0){logger[_0x2499('0x44')](_0x2499('0x72'),util[_0x2499('0x32')](_0x3efef0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2499('0x1c')]=function(_0x36507c){var _0x468a14='';try{if(this[_0x2499('0x22')](_0x36507c)){if(_0x36507c[_0x2499('0x73')]){_0x468a14=_0x36507c[_0x2499('0x73')][_0x2499('0x74')](0x0,_0x36507c[_0x2499('0x73')][_0x2499('0x75')]('-'));if(this[_0x2499('0xc')][_0x468a14]){this[_0x2499('0xc')][_0x468a14]['onhold']=!![];}}}}catch(_0x107f96){logger[_0x2499('0x44')](_0x2499('0x76'),util[_0x2499('0x32')](_0x107f96,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x521bc9){var _0x5964bb='';try{if(this['isNotNull'](_0x521bc9)){if(_0x521bc9['channel']){_0x5964bb=_0x521bc9[_0x2499('0x73')][_0x2499('0x74')](0x0,_0x521bc9[_0x2499('0x73')]['lastIndexOf']('-'));if(this[_0x2499('0xc')][_0x5964bb]){this[_0x2499('0xc')][_0x5964bb][_0x2499('0x77')]=![];}}}}catch(_0x260081){logger['error']('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x2499('0x32')](_0x260081,{'showHidden':![],'depth':null}));}};module[_0x2499('0x78')]=VoiceAgentReport; \ No newline at end of file +var _0x56aa=['bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','error','inspect','hasOwnProperty','lastevent','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:%s','membername','custom:agentconnect','agentcomplete','agentringnoanswerAt','reason','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','complete','talktime','transfer','agent','acw','acwtime','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','diff','substring','channel','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect'];(function(_0x85b75b,_0x4b2c57){var _0x3d68ab=function(_0x3be2c8){while(--_0x3be2c8){_0x85b75b['push'](_0x85b75b['shift']());}};_0x3d68ab(++_0x4b2c57);}(_0x56aa,0xe4));var _0xa56a=function(_0x2d80af,_0xfdfd5b){_0x2d80af=_0x2d80af-0x0;var _0x4917c6=_0x56aa[_0x2d80af];return _0x4917c6;};'use strict';var _=require(_0xa56a('0x0'));var moment=require('moment');var util=require(_0xa56a('0x1'));var Redis=require(_0xa56a('0x2'));var config=require(_0xa56a('0x3'));var logger=require(_0xa56a('0x4'))(_0xa56a('0x5'));var ami=require(_0xa56a('0x6'));config[_0xa56a('0x7')]=_[_0xa56a('0x8')](config[_0xa56a('0x7')],{'host':_0xa56a('0x9'),'port':0x18eb});var io=require(_0xa56a('0xa'))(new Redis(config[_0xa56a('0x7')]));function VoiceAgentReport(_0x7a8700){this[_0xa56a('0xb')]={};this[_0xa56a('0xc')]=_0x7a8700[_0xa56a('0xc')];this['agents']=_0x7a8700[_0xa56a('0xd')];this[_0xa56a('0xe')]={};ami['on'](_0xa56a('0xf'),this[_0xa56a('0x10')]['bind'](this));ami['on'](_0xa56a('0x11'),this['syncAgentConnect'][_0xa56a('0x12')](this));ami['on'](_0xa56a('0x13'),this[_0xa56a('0x14')]['bind'](this));ami['on'](_0xa56a('0x15'),this[_0xa56a('0x16')][_0xa56a('0x12')](this));ami['on']('agentcomplete',this[_0xa56a('0x17')][_0xa56a('0x12')](this));ami['on'](_0xa56a('0x18'),this[_0xa56a('0x19')][_0xa56a('0x12')](this));ami['on']('hangup',this[_0xa56a('0x1a')][_0xa56a('0x12')](this));ami['on']('musiconholdstart',this[_0xa56a('0x1b')][_0xa56a('0x12')](this));ami['on'](_0xa56a('0x1c'),this[_0xa56a('0x1d')]['bind'](this));ami['on'](_0xa56a('0x1e'),this[_0xa56a('0x1f')][_0xa56a('0x12')](this));ami['on'](_0xa56a('0x20'),this[_0xa56a('0x21')][_0xa56a('0x12')](this));}VoiceAgentReport['prototype'][_0xa56a('0x22')]=function(_0xb43a6b,_0xc8d07b,_0x156abe){io['to'](_0xb43a6b)[_0xa56a('0x22')](_0xc8d07b,_0x156abe);};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x24')]=function(_0x34e5de){return _0x34e5de!==null&&!_[_0xa56a('0x25')](_0x34e5de);};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x10')]=function(_0x530193){try{if(this['isNotNull'](_0x530193)){if(_[_0xa56a('0x25')](this[_0xa56a('0xb')][_0x530193[_0xa56a('0x26')]])){this[_0xa56a('0xb')][_0x530193[_0xa56a('0x26')]]={};}if(_[_0xa56a('0x25')](this[_0xa56a('0xb')][_0x530193['uniqueid']][_0x530193[_0xa56a('0x27')]])){this[_0xa56a('0xb')][_0x530193['uniqueid']][_0x530193[_0xa56a('0x27')]]={'agentcalledAt':moment()[_0xa56a('0x28')](_0xa56a('0x29')),'lastevent':_0xa56a('0x2a'),'variables':this[_0xa56a('0xe')][_0x530193[_0xa56a('0x26')]],'type':this['voiceQueues'][_0x530193[_0xa56a('0x2b')]]?this['voiceQueues'][_0x530193[_0xa56a('0x2b')]][_0xa56a('0x2c')]||'inbound':_0xa56a('0x2d')};}_[_0xa56a('0x2e')](this[_0xa56a('0xb')][_0x530193[_0xa56a('0x26')]][_0x530193['destuniqueid']],_[_0xa56a('0x2f')](_0x530193,[_0xa56a('0x30'),_0xa56a('0x31')]));ami[_0xa56a('0x22')](_0xa56a('0x32'),this[_0xa56a('0xb')][_0x530193[_0xa56a('0x26')]][_0x530193[_0xa56a('0x27')]]);this[_0xa56a('0x22')](util[_0xa56a('0x28')]('user:%s',_0x530193['membername']),'user:called',this[_0xa56a('0xb')][_0x530193[_0xa56a('0x26')]][_0x530193[_0xa56a('0x27')]]);}}catch(_0x30fcaa){logger[_0xa56a('0x33')]('[syncAgentCalled][VoiceAgentReport]',util[_0xa56a('0x34')](_0x30fcaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')]['syncAgentConnect']=function(_0x20a369){try{if(this[_0xa56a('0x24')](_0x20a369)){if(this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]]){for(var _0x2b49b7 in this['channels'][_0x20a369[_0xa56a('0x26')]]){if(this[_0xa56a('0xb')][_0x20a369['uniqueid']][_0xa56a('0x35')](_0x2b49b7)){if(_0x20a369[_0xa56a('0x27')]===_0x2b49b7){this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7]['agentconnectAt']=moment()['format'](_0xa56a('0x29'));this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x36')]='connect';this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7]['holdtime']=_0x20a369['holdtime'];this[_0xa56a('0xb')][_0x20a369['uniqueid']][_0x2b49b7][_0xa56a('0x37')]=_0x20a369['connectedlinenum'];this[_0xa56a('0xb')][_0x20a369['uniqueid']][_0x2b49b7][_0xa56a('0x38')]=_0x20a369[_0xa56a('0x38')];this['channels'][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x39')]=_0x20a369['destchannelstate'];this['channels'][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x3a')]=_0x20a369[_0xa56a('0x3a')];_['merge'](this['agents'][_0x20a369[_0xa56a('0x3b')]],_[_0xa56a('0x3c')](_0x20a369,[_0xa56a('0x2b'),'destconnectedlinenum']));this[_0xa56a('0x22')](util[_0xa56a('0x28')](_0xa56a('0x3d'),_0x20a369[_0xa56a('0x3e')]),'user:agentconnect',this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x20a369['destuniqueid']]);ami[_0xa56a('0x22')](_0xa56a('0x3f'),this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7]);}else if(!this[_0xa56a('0xb')][_0x20a369['uniqueid']][_0x2b49b7][_0xa56a('0x13')]&&!this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x40')]){this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x13')]=!![];this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x41')]=moment()[_0xa56a('0x28')](_0xa56a('0x29'));this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x42')]='answered_elsewhere';this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x36')]='answered_elsewhere';this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7]['answeredelsewheredestinationuniqueid']=_0x20a369[_0xa56a('0x27')];this[_0xa56a('0xb')][_0x20a369[_0xa56a('0x26')]][_0x2b49b7][_0xa56a('0x43')]=_0x20a369[_0xa56a('0x3e')];ami[_0xa56a('0x22')](_0xa56a('0x44'),this['channels'][_0x20a369[_0xa56a('0x26')]][_0x2b49b7]);}}}}}}catch(_0x415b4d){logger[_0xa56a('0x33')](_0xa56a('0x45'),util[_0xa56a('0x34')](_0x415b4d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x14')]=function(_0x51708b){try{if(this[_0xa56a('0x24')](_0x51708b)){if(this[_0xa56a('0xb')][_0x51708b[_0xa56a('0x26')]]&&this[_0xa56a('0xb')][_0x51708b['uniqueid']][_0x51708b[_0xa56a('0x27')]]){this['channels'][_0x51708b[_0xa56a('0x26')]][_0x51708b[_0xa56a('0x27')]]['agentringnoanswer']=!![];this[_0xa56a('0xb')][_0x51708b['uniqueid']][_0x51708b[_0xa56a('0x27')]][_0xa56a('0x41')]=moment()[_0xa56a('0x28')](_0xa56a('0x29'));this[_0xa56a('0xb')][_0x51708b[_0xa56a('0x26')]][_0x51708b[_0xa56a('0x27')]][_0xa56a('0x42')]=_0xa56a('0x46');this[_0xa56a('0xb')][_0x51708b[_0xa56a('0x26')]][_0x51708b[_0xa56a('0x27')]]['lastevent']='rejected';ami['emit'](_0xa56a('0x47'),this[_0xa56a('0xb')][_0x51708b['uniqueid']][_0x51708b[_0xa56a('0x27')]]);}}}catch(_0x5aac2f){logger['error'](_0xa56a('0x48'),util[_0xa56a('0x34')](_0x5aac2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x16')]=function(_0x2ee96b){try{if(this['isNotNull'](_0x2ee96b)){if(this['channels'][_0x2ee96b[_0xa56a('0x26')]]){for(var _0x20492a in this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]]){if(this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0xa56a('0x35')](_0x20492a)&&!this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a]['agentringnoanswer']&&!this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a][_0xa56a('0x40')]){this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a][_0xa56a('0x13')]=!![];this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a]['agentringnoanswerAt']=moment()[_0xa56a('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a][_0xa56a('0x42')]=_0xa56a('0x49');this['channels'][_0x2ee96b[_0xa56a('0x26')]][_0x20492a]['lastevent']=_0xa56a('0x49');ami[_0xa56a('0x22')](_0xa56a('0x4a'),this[_0xa56a('0xb')][_0x2ee96b[_0xa56a('0x26')]][_0x20492a]);}}}}}catch(_0x5f3c29){logger[_0xa56a('0x33')](_0xa56a('0x4b'),util[_0xa56a('0x34')](_0x5f3c29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x17')]=function(_0x4ab9f5){try{if(this[_0xa56a('0x24')](_0x4ab9f5)){if(this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]]){for(var _0x1c5c9e in this[_0xa56a('0xb')][_0x4ab9f5['uniqueid']]){if(this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0xa56a('0x35')](_0x1c5c9e)){if(this['channels'][_0x4ab9f5['uniqueid']][_0x1c5c9e][_0xa56a('0x4c')]&&!this['channels'][_0x4ab9f5['uniqueid']][_0x1c5c9e]['agentcomplete']){this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e]['agentcomplete']=!![];this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e]['agentcompleteAt']=moment()[_0xa56a('0x28')](_0xa56a('0x29'));this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e][_0xa56a('0x36')]=_0xa56a('0x4d');this['channels'][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e][_0xa56a('0x4e')]=_0x4ab9f5[_0xa56a('0x4e')];this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e]['reason']=_0x4ab9f5[_0xa56a('0x42')]==_0xa56a('0x4f')?_0xa56a('0x50'):_0x4ab9f5[_0xa56a('0x42')];if(this[_0xa56a('0xc')][_0x4ab9f5['queue']]&&this[_0xa56a('0xc')][_0x4ab9f5[_0xa56a('0x2b')]][_0xa56a('0x51')]){this[_0xa56a('0xb')][_0x4ab9f5['uniqueid']][_0x1c5c9e]['agentacw']=!![];this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e][_0xa56a('0x52')]=this['voiceQueues'][_0x4ab9f5['queue']]['acwTimeout'];}this[_0xa56a('0xd')][_0x4ab9f5[_0xa56a('0x3b')]]=_['omit'](this[_0xa56a('0xd')][_0x4ab9f5['interface']],[_0xa56a('0x2b'),_0xa56a('0x53')]);this['emit'](util[_0xa56a('0x28')]('user:%s',_0x4ab9f5[_0xa56a('0x3e')]),_0xa56a('0x54'),this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e]);ami['emit'](_0xa56a('0x55'),this[_0xa56a('0xb')][_0x4ab9f5[_0xa56a('0x26')]][_0x1c5c9e]);}}}}}}catch(_0x5a176c){logger[_0xa56a('0x33')](_0xa56a('0x56'),util[_0xa56a('0x34')](_0x5a176c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x19')]=function(_0x4afaa4){try{if(this[_0xa56a('0x24')](_0x4afaa4)){this[_0xa56a('0x57')](_0x4afaa4[_0xa56a('0x26')],_[_0xa56a('0x58')](_0x4afaa4[_0xa56a('0x59')])[0x0],_0x4afaa4[_0xa56a('0x5a')]);if(this['channels'][_0x4afaa4['uniqueid']]){for(var _0x32a5eb in this[_0xa56a('0xb')][_0x4afaa4[_0xa56a('0x26')]]){if(this[_0xa56a('0xb')][_0x4afaa4[_0xa56a('0x26')]][_0xa56a('0x35')](_0x32a5eb)){if(_[_0xa56a('0x25')](this[_0xa56a('0xb')][_0x4afaa4[_0xa56a('0x26')]][_0x32a5eb][_0xa56a('0xe')])){this[_0xa56a('0xb')][_0x4afaa4[_0xa56a('0x26')]][_0x32a5eb][_0xa56a('0xe')]={};}this[_0xa56a('0xb')][_0x4afaa4[_0xa56a('0x26')]][_0x32a5eb]['variables']=this['variables'][_0x4afaa4['uniqueid']];}}}}}catch(_0x345689){logger[_0xa56a('0x33')](_0xa56a('0x5b'),util[_0xa56a('0x34')](_0x345689,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x57')]=function(_0xeffd76,_0xc054a9,_0x3f2330){var _0x11bbe6=['rtpaudioqos',_0xa56a('0x5c'),_0xa56a('0x5d'),_0xa56a('0x5e'),_0xa56a('0x5f'),'rtpaudioqoslossbridged',_0xa56a('0x60'),'rtpaudioqosrttbridged',_0xa56a('0x61'),_0xa56a('0x62'),_0xa56a('0x63'),_0xa56a('0x64'),_0xa56a('0x65'),'memberdynamic',_0xa56a('0x66'),_0xa56a('0x67'),'membername','memberpenalty',_0xa56a('0x68')];if(!_[_0xa56a('0x69')](_0xc054a9)&&!_[_0xa56a('0x6a')](_0x11bbe6,_0xc054a9)){if(_['isUndefined'](this['variables'][_0xeffd76])){this['variables'][_0xeffd76]={};}this[_0xa56a('0xe')][_0xeffd76][_0xc054a9]=_0x3f2330;}};VoiceAgentReport[_0xa56a('0x23')][_0xa56a('0x1a')]=function(_0x5eef05){try{if(this['isNotNull'](_0x5eef05)){if(this['channels'][_0x5eef05[_0xa56a('0x26')]]){for(var _0xd945eb in this[_0xa56a('0xb')][_0x5eef05['uniqueid']]){if(this['channels'][_0x5eef05['uniqueid']][_0xa56a('0x35')](_0xd945eb)){if(this['channels'][_0x5eef05[_0xa56a('0x26')]][_0xd945eb][_0xa56a('0x42')]=='transfer'&&this[_0xa56a('0xb')][_0x5eef05['uniqueid']][_0xd945eb]['agentcomplete']){this['channels'][_0x5eef05[_0xa56a('0x26')]][_0xd945eb][_0xa56a('0x6b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0xa56a('0x22')](_0xa56a('0x6c'),_[_0xa56a('0x6d')](this[_0xa56a('0xb')][_0x5eef05['uniqueid']]));delete this[_0xa56a('0xb')][_0x5eef05['uniqueid']];}if(this[_0xa56a('0xe')][_0x5eef05[_0xa56a('0x26')]]){delete this[_0xa56a('0xe')][_0x5eef05[_0xa56a('0x26')]];}}}catch(_0x470c8b){logger[_0xa56a('0x33')](_0xa56a('0x6e'),util['inspect'](_0x470c8b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')]['syncAttendedTransfer']=function(_0x475a16){try{if(this[_0xa56a('0x24')](_0x475a16)){if(this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]]){for(var _0x5e8e61 in this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]]){if(this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]][_0xa56a('0x35')](_0x5e8e61)){if(_0x475a16['origtransfereruniqueid']===_0x5e8e61){var _0x2233da=moment();this['channels'][_0x475a16['transfereeuniqueid']][_0x5e8e61]['agentcomplete']=!![];this['channels'][_0x475a16[_0xa56a('0x6f')]][_0x5e8e61][_0xa56a('0x6b')]=moment()[_0xa56a('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]][_0x5e8e61][_0xa56a('0x42')]=_0xa56a('0x4f');this['channels'][_0x475a16[_0xa56a('0x6f')]][_0x5e8e61][_0xa56a('0x36')]='complete';this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]][_0x5e8e61]['talktime']=_0x2233da['diff'](this['channels'][_0x475a16['transfereeuniqueid']][_0x5e8e61][_0xa56a('0x4c')],_0xa56a('0x70'));}}}}if(this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x71')]]){var _0x422f89=this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x71')]];this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x71')]]=this[_0xa56a('0xb')][_0x475a16['transfereeuniqueid']];this[_0xa56a('0xb')][_0x475a16[_0xa56a('0x6f')]]=_0x422f89;}}}catch(_0x41db2a){logger['error'](_0xa56a('0x72'),util['inspect'](_0x41db2a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')]['syncBlindTransfer']=function(_0x555083){try{if(this[_0xa56a('0x24')](_0x555083)){if(this['channels'][_0x555083[_0xa56a('0x6f')]]){for(var _0x3cdb9a in this[_0xa56a('0xb')][_0x555083[_0xa56a('0x6f')]]){if(this[_0xa56a('0xb')][_0x555083['transfereeuniqueid']][_0xa56a('0x35')](_0x3cdb9a)){if(_0x555083[_0xa56a('0x73')]===_0x3cdb9a){var _0x4edd8c=moment();this['channels'][_0x555083[_0xa56a('0x6f')]][_0x3cdb9a][_0xa56a('0x40')]=!![];this[_0xa56a('0xb')][_0x555083[_0xa56a('0x6f')]][_0x3cdb9a][_0xa56a('0x6b')]=_0x4edd8c;this[_0xa56a('0xb')][_0x555083[_0xa56a('0x6f')]][_0x3cdb9a][_0xa56a('0x42')]=_0xa56a('0x4f');this[_0xa56a('0xb')][_0x555083[_0xa56a('0x6f')]][_0x3cdb9a][_0xa56a('0x36')]=_0xa56a('0x4d');this[_0xa56a('0xb')][_0x555083['transfereeuniqueid']][_0x3cdb9a][_0xa56a('0x4e')]=_0x4edd8c[_0xa56a('0x74')](this[_0xa56a('0xb')][_0x555083[_0xa56a('0x6f')]][_0x3cdb9a]['agentconnectAt'],_0xa56a('0x70'));}}}}}}catch(_0x370ad7){logger[_0xa56a('0x33')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xa56a('0x34')](_0x370ad7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56a('0x23')]['syncMusicOnHoldStart']=function(_0x20302d){var _0x2d25b2='';try{if(this[_0xa56a('0x24')](_0x20302d)){if(_0x20302d['channel']){_0x2d25b2=_0x20302d['channel'][_0xa56a('0x75')](0x0,_0x20302d[_0xa56a('0x76')][_0xa56a('0x77')]('-'));if(this['agents'][_0x2d25b2]){this['agents'][_0x2d25b2][_0xa56a('0x78')]=!![];}}}}catch(_0xbde7ba){logger[_0xa56a('0x33')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xa56a('0x34')](_0xbde7ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x5c33f6){var _0x12e325='';try{if(this[_0xa56a('0x24')](_0x5c33f6)){if(_0x5c33f6[_0xa56a('0x76')]){_0x12e325=_0x5c33f6[_0xa56a('0x76')][_0xa56a('0x75')](0x0,_0x5c33f6['channel'][_0xa56a('0x77')]('-'));if(this[_0xa56a('0xd')][_0x12e325]){this['agents'][_0x12e325][_0xa56a('0x78')]=![];}}}}catch(_0x4244cf){logger[_0xa56a('0x33')](_0xa56a('0x79'),util[_0xa56a('0x34')](_0x4244cf,{'showHidden':![],'depth':null}));}};module[_0xa56a('0x7a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ac7fc81..f0572e3 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 _0x6990=['OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','pick','context','from-sip','split','destconnectedlinenum','exten','format','user:%s','name','accountcode','inspect','application','toLowerCase','applicationdata','appdata','duration','seconds','disposition','includes','lastapplication','lastdata','set','cdr(','match','[syncNewExten][VoiceCallReport]','channelstate','answered','diff','calleridnum','connectedlinenum','connectedlinename','destinationchannel','UserId','[syncNewState][VoiceCallReport]','endsWith','.wav49','replace','.WAV','monitorFilename','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','xmd-phone','xmd-callerid','value','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','billableseconds','answertime','omit','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','merge','keys','error','[syncNewCallerId][VoiceCallReport]','channel'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x6990,0x199));var _0x0699=function(_0x33e613,_0x40561a){_0x33e613=_0x33e613-0x0;var _0x3367fc=_0x6990[_0x33e613];return _0x3367fc;};'use strict';var BPromise=require(_0x0699('0x0'));var _=require(_0x0699('0x1'));var moment=require(_0x0699('0x2'));var util=require(_0x0699('0x3'));var path=require(_0x0699('0x4'));var Redis=require('ioredis');var config=require(_0x0699('0x5'));var logger=require(_0x0699('0x6'))(_0x0699('0x7'));var ami=require(_0x0699('0x8'));var Channel=require(_0x0699('0x9'));var statusDesc=[_0x0699('0xa'),_0x0699('0xb'),_0x0699('0xc'),_0x0699('0xd'),_0x0699('0xe'),_0x0699('0xf'),_0x0699('0x10'),_0x0699('0x11'),_0x0699('0x12')];var applications=['set',_0x0699('0x13'),_0x0699('0x14'),'dial','playback',_0x0699('0x15')];var dispositions=['NO\x20ANSWER',_0x0699('0x16'),'FAILED',_0x0699('0x17'),'NO\x20ANSWER',_0x0699('0x17'),_0x0699('0x18'),_0x0699('0x19'),_0x0699('0x16'),_0x0699('0x16'),'FAILED'];var actions={};config[_0x0699('0x1a')]=_[_0x0699('0x1b')](config[_0x0699('0x1a')],{'host':_0x0699('0x1c'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0699('0x1a')]));function VoiceCallReport(_0x4d4abf){this[_0x0699('0x1d')]=_0x4d4abf[_0x0699('0x1d')];this[_0x0699('0x1e')]=_0x4d4abf[_0x0699('0x1e')];ami['on'](_0x0699('0x1f'),this[_0x0699('0x20')][_0x0699('0x21')](this));ami['on'](_0x0699('0x22'),this['syncNewExten'][_0x0699('0x21')](this));ami['on'](_0x0699('0x23'),this[_0x0699('0x24')]['bind'](this));ami['on'](_0x0699('0x25'),this[_0x0699('0x26')]['bind'](this));ami['on'](_0x0699('0x27'),this['syncVarSet'][_0x0699('0x21')](this));ami['on'](_0x0699('0x28'),this['syncHangup']['bind'](this));ami['on'](_0x0699('0x29'),this[_0x0699('0x2a')][_0x0699('0x21')](this));ami['on']('attendedtransfer',this[_0x0699('0x2b')][_0x0699('0x21')](this));ami['on'](_0x0699('0x2c'),this[_0x0699('0x2d')][_0x0699('0x21')](this));ami['on'](_0x0699('0x2e'),this[_0x0699('0x2f')]['bind'](this));ami['on']('musiconholdstop',this[_0x0699('0x30')][_0x0699('0x21')](this));return BPromise[_0x0699('0x31')]()[_0x0699('0x32')](ami[_0x0699('0x33')]())[_0x0699('0x34')](function(_0x199c85){console[_0x0699('0x35')](_0x199c85);});}VoiceCallReport[_0x0699('0x36')][_0x0699('0x37')]=function(_0x4e6654){return _0x4e6654!==null&&!_[_0x0699('0x38')](_0x4e6654);};VoiceCallReport['prototype'][_0x0699('0x39')]=function(_0x3739bf,_0x14f09d,_0x45a59c){io['to'](_0x3739bf)[_0x0699('0x39')](_0x14f09d,_0x45a59c);};VoiceCallReport[_0x0699('0x36')][_0x0699('0x2a')]=function(_0x56ebae){try{if(this[_0x0699('0x37')](_0x56ebae)){if(_0x56ebae['uniqueid']===_0x56ebae[_0x0699('0x3a')]){if(!_[_0x0699('0x38')](this['channels'][_0x56ebae[_0x0699('0x3b')]])){_[_0x0699('0x3c')](this['channels'][_0x56ebae['uniqueid']],_['pick'](_0x56ebae,_[_0x0699('0x3d')](this[_0x0699('0x1d')][_0x56ebae['uniqueid']])));}}}}catch(_0x2a52b9){logger[_0x0699('0x3e')](_0x0699('0x3f'),util['inspect'](_0x2a52b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')][_0x0699('0x24')]=function(_0x4a9311){try{if(this[_0x0699('0x37')](_0x4a9311)){if(_0x4a9311['uniqueid']===_0x4a9311[_0x0699('0x3a')]&&_0x4a9311[_0x0699('0x40')]!=_0x0699('0x41')){if(_[_0x0699('0x38')](this[_0x0699('0x1d')][_0x4a9311['uniqueid']])){this[_0x0699('0x1d')][_0x4a9311[_0x0699('0x3b')]]=new Channel();this[_0x0699('0x1d')][_0x4a9311[_0x0699('0x3b')]][_0x0699('0x42')]=moment()['format'](_0x0699('0x43'));this['channels'][_0x4a9311[_0x0699('0x3b')]]['disposition']=dispositions[_[_0x0699('0x44')](_0x4a9311['channelstate'])];_['merge'](this[_0x0699('0x1d')][_0x4a9311['uniqueid']],_[_0x0699('0x45')](_0x4a9311,_[_0x0699('0x3d')](this[_0x0699('0x1d')][_0x4a9311[_0x0699('0x3b')]])));if(_0x4a9311[_0x0699('0x46')]===_0x0699('0x47')){if(this[_0x0699('0x1e')][_0x4a9311[_0x0699('0x40')]['split']('-')[0x0]]){this['agents'][_0x4a9311[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]][_0x0699('0x49')]=_0x4a9311[_0x0699('0x4a')];this['emit'](util[_0x0699('0x4b')](_0x0699('0x4c'),this[_0x0699('0x1e')][_0x4a9311['channel'][_0x0699('0x48')]('-')[0x0]][_0x0699('0x4d')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x4a9311[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]][_0x0699('0x4e')],'destconnectedlinenum':_0x4a9311[_0x0699('0x4a')]});}}}}}}catch(_0x45d33b){logger[_0x0699('0x3e')]('[syncNewChannel][VoiceCallReport]',util[_0x0699('0x4f')](_0x45d33b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')][_0x0699('0x20')]=function(_0x2d3fc9){try{if(this[_0x0699('0x37')](_0x2d3fc9)){if(_0x2d3fc9[_0x0699('0x3b')]===_0x2d3fc9[_0x0699('0x3a')]&&_0x2d3fc9['exten']!='h'&&_0x2d3fc9[_0x0699('0x40')]!=_0x0699('0x41')){_0x2d3fc9[_0x0699('0x50')]=_0x2d3fc9['application'][_0x0699('0x51')]();_0x2d3fc9[_0x0699('0x52')]=(_0x2d3fc9[_0x0699('0x53')]||_0x2d3fc9[_0x0699('0x52')])[_0x0699('0x51')]();if(_[_0x0699('0x38')](this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]])){this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]]=new Channel();this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]][_0x0699('0x42')]=_0x2d3fc9['duration']?moment()['subtract'](moment['duration'](_0x2d3fc9[_0x0699('0x54')])[_0x0699('0x55')](),_0x0699('0x55'))[_0x0699('0x4b')](_0x0699('0x43')):moment()[_0x0699('0x4b')](_0x0699('0x43'));this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]][_0x0699('0x56')]=_0x0699('0x17');}_['merge'](this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]],_[_0x0699('0x45')](_0x2d3fc9,_[_0x0699('0x3d')](this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]])));if(_[_0x0699('0x57')](applications,_0x2d3fc9['application'])){this[_0x0699('0x1d')][_0x2d3fc9['uniqueid']][_0x0699('0x58')]=_0x2d3fc9[_0x0699('0x50')];this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]][_0x0699('0x59')]=_0x2d3fc9[_0x0699('0x52')];if(_0x2d3fc9[_0x0699('0x50')]===_0x0699('0x5a')&&_['startsWith'](_0x2d3fc9[_0x0699('0x52')],_0x0699('0x5b'))){var _0x1421d5=_0x2d3fc9[_0x0699('0x52')][_0x0699('0x48')]('=');var _0x2e82d6=_0x1421d5[0x0][_0x0699('0x5c')](/cdr\((.*)\)/);if(_0x2e82d6){this[_0x0699('0x1d')][_0x2d3fc9[_0x0699('0x3b')]][_0x2e82d6[0x1]]=_0x1421d5[0x1];}}else if(_0x2d3fc9[_0x0699('0x50')]==='queue'){this['channels'][_0x2d3fc9[_0x0699('0x3b')]][_0x0699('0x13')]=_0x2d3fc9[_0x0699('0x52')][_0x0699('0x48')](',')[0x0];}}}}}catch(_0x3214db){logger[_0x0699('0x3e')](_0x0699('0x5d'),util[_0x0699('0x4f')](_0x3214db,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0699('0x26')]=function(_0x424e7b){try{if(this[_0x0699('0x37')](_0x424e7b)){if(_0x424e7b[_0x0699('0x3b')]!==_0x424e7b[_0x0699('0x3a')]){if(this['channels'][_0x424e7b[_0x0699('0x3a')]]){if(_0x424e7b[_0x0699('0x5e')]==='6'){if(!this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x5f')]){var _0x296898=moment();this[_0x0699('0x1d')][_0x424e7b['linkedid']][_0x0699('0x5f')]=!![];this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]]['answertime']=_0x296898['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x0699('0x1d')][_0x424e7b['linkedid']][_0x0699('0x42')]){this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]]['holdtime']=_0x296898[_0x0699('0x60')](this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x42')],_0x0699('0x55'));}}this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x3a')]=_0x424e7b['uniqueid'];if(_0x424e7b[_0x0699('0x61')]!=='xcally-motion-preview'){this['channels'][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x62')]=_0x424e7b[_0x0699('0x61')];}this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x63')]=_0x424e7b['calleridname'];this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3a')]][_0x0699('0x64')]=_0x424e7b[_0x0699('0x40')];this[_0x0699('0x1d')][_0x424e7b['linkedid']][_0x0699('0x56')]=dispositions[_[_0x0699('0x44')](_0x424e7b['channelstate'])];if(this[_0x0699('0x1e')][_0x424e7b['channel'][_0x0699('0x48')]('-')[0x0]]){this[_0x0699('0x1d')][_0x424e7b['linkedid']][_0x0699('0x65')]=this[_0x0699('0x1e')][_0x424e7b[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]]['id'];this['channels'][_0x424e7b[_0x0699('0x3a')]]['membername']=this[_0x0699('0x1e')][_0x424e7b[_0x0699('0x40')]['split']('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x424e7b[_0x0699('0x3b')]]){if(_0x424e7b['channelstate']==='6'){if(this[_0x0699('0x1e')][_0x424e7b[_0x0699('0x40')]['split']('-')[0x0]]){this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3b')]][_0x0699('0x65')]=this[_0x0699('0x1e')][_0x424e7b[_0x0699('0x40')]['split']('-')[0x0]]['id'];this[_0x0699('0x1d')][_0x424e7b[_0x0699('0x3b')]]['membername']=this['agents'][_0x424e7b['channel']['split']('-')[0x0]][_0x0699('0x4d')];}}}}}}catch(_0x31ce72){logger['error'](_0x0699('0x66'),util[_0x0699('0x4f')](_0x31ce72,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')]['syncMixMonitorFilename']=function(_0x11f0c3,_0x1f0767){if(this[_0x0699('0x1d')][_0x11f0c3]){this[_0x0699('0x1d')][_0x11f0c3]['monitor']=!![];if(_[_0x0699('0x67')](_0x1f0767,_0x0699('0x68'))){_0x1f0767=_0x1f0767[_0x0699('0x69')]('.wav49',_0x0699('0x6a'));}this[_0x0699('0x1d')][_0x11f0c3][_0x0699('0x6b')]=_0x1f0767;var _0x363571=_['find'](this['channels'][_0x11f0c3]['monitors'],{'filename':_0x1f0767});if(_[_0x0699('0x6c')](_0x363571)){this[_0x0699('0x1d')][_0x11f0c3][_0x0699('0x6d')][_0x0699('0x6e')]({'filename':_0x1f0767,'createdAt':moment()[_0x0699('0x4b')](_0x0699('0x43')),'mixmonitorid':'','status':_0x0699('0x6f')});}}};VoiceCallReport[_0x0699('0x36')]['syncVarSet']=function(_0x35679b){try{if(this[_0x0699('0x37')](_0x35679b)){if(this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]]&&_0x35679b[_0x0699('0x40')]!=_0x0699('0x41')){if(this[_0x0699('0x37')](_0x35679b['variable'])){if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')][_0x0699('0x71')])){this[_0x0699('0x72')](_0x35679b[_0x0699('0x3b')],_0x35679b['value']);}else if(this[_0x0699('0x37')](_0x35679b['variable'][_0x0699('0x73')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]][_0x0699('0x61')]=_0x35679b['value'];}else if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')][_0x0699('0x74')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]]['callerid']=_0x35679b[_0x0699('0x75')];}else if(this[_0x0699('0x37')](_0x35679b['variable'][_0x0699('0x76')])){this['channels'][_0x35679b[_0x0699('0x3b')]][_0x0699('0x77')]=_0x35679b[_0x0699('0x75')];}else if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')]['xmd-queue'])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]]['queue']=_0x35679b[_0x0699('0x75')]['split'](',')[0x0];}else if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')][_0x0699('0x78')])){this['channels'][_0x35679b[_0x0699('0x3b')]][_0x0699('0x79')]=_0x35679b[_0x0699('0x75')];}else if(this['isNotNull'](_0x35679b['variable'][_0x0699('0x7a')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]][_0x0699('0x7b')]=_0x35679b['value'];}else if(this['isNotNull'](_0x35679b[_0x0699('0x70')][_0x0699('0x7c')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]][_0x0699('0x7d')]=_0x35679b['value'];}else if(this[_0x0699('0x37')](_0x35679b['variable'][_0x0699('0x7e')])){this['channels'][_0x35679b[_0x0699('0x3b')]][_0x0699('0x13')]=_0x35679b['value'];}else if(this['isNotNull'](_0x35679b[_0x0699('0x70')][_0x0699('0x7f')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3b')]][_0x0699('0x80')]=_0x35679b[_0x0699('0x75')];}}}else if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')][_0x0699('0x71')])){if(_0x35679b[_0x0699('0x75')]){var _0x5665c2=path[_0x0699('0x81')](_0x35679b[_0x0699('0x75')])[_0x0699('0x4d')];this[_0x0699('0x72')](_0x5665c2,_0x35679b[_0x0699('0x75')]);}}else if(this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3a')]]){if(this[_0x0699('0x37')](_0x35679b[_0x0699('0x70')])){if(this['isNotNull'](_0x35679b[_0x0699('0x70')][_0x0699('0x7f')])){this[_0x0699('0x1d')][_0x35679b[_0x0699('0x3a')]][_0x0699('0x82')]=_0x35679b[_0x0699('0x75')];}}}}}catch(_0x39125c){logger[_0x0699('0x3e')](_0x0699('0x83'),util[_0x0699('0x4f')](_0x39125c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')][_0x0699('0x84')]=function(_0x2c6e8a){try{if(this[_0x0699('0x37')](_0x2c6e8a)){if(this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]]){var _0xcb08ba=moment();this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]][_0x0699('0x85')]=_0xcb08ba['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]][_0x0699('0x54')]=_0xcb08ba[_0x0699('0x60')](this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]]['starttime'],'seconds');if(this[_0x0699('0x1d')][_0x2c6e8a['uniqueid']][_0x0699('0x5f')]){this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]][_0x0699('0x86')]=_0xcb08ba[_0x0699('0x60')](this['channels'][_0x2c6e8a[_0x0699('0x3b')]][_0x0699('0x87')],_0x0699('0x55'));this['channels'][_0x2c6e8a[_0x0699('0x3b')]]['holdtime']=this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]][_0x0699('0x54')]-this['channels'][_0x2c6e8a[_0x0699('0x3b')]]['billableseconds'];}if(_0x2c6e8a['context']===_0x0699('0x47')){if(this['agents'][_0x2c6e8a['channel'][_0x0699('0x48')]('-')[0x0]]){this['agents'][_0x2c6e8a[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]]=_[_0x0699('0x88')](this[_0x0699('0x1e')][_0x2c6e8a[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]],['destconnectedlinenum']);this[_0x0699('0x39')](util[_0x0699('0x4b')](_0x0699('0x4c'),this['agents'][_0x2c6e8a[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]][_0x0699('0x4d')]),'user:agentcomplete',{'destaccountcode':this[_0x0699('0x1e')][_0x2c6e8a[_0x0699('0x40')][_0x0699('0x48')]('-')[0x0]][_0x0699('0x4e')]});}}ami['emit'](_0x0699('0x89'),this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]]);delete this[_0x0699('0x1d')][_0x2c6e8a[_0x0699('0x3b')]];}}}catch(_0x415963){logger[_0x0699('0x3e')](_0x0699('0x8a'),util[_0x0699('0x4f')](_0x415963,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0699('0x2b')]=function(_0x1b0de1){try{if(this[_0x0699('0x37')](_0x1b0de1)){if(this['channels'][_0x1b0de1['transfereeuniqueid']]){this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8b')]]['transfercalleridnum']=_0x1b0de1[_0x0699('0x8c')];this[_0x0699('0x1d')][_0x1b0de1['transfereeuniqueid']][_0x0699('0x8d')]=_0x1b0de1['transfertargetcalleridnum'];if(this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8e')]]){var _0x3789f6=this['channels'][_0x1b0de1[_0x0699('0x8e')]];this['channels'][_0x1b0de1['secondtransfereruniqueid']]=this[_0x0699('0x1d')][_0x1b0de1['transfereeuniqueid']];this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8b')]]=_0x3789f6;}}else if(this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8f')]]){this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8f')]][_0x0699('0x90')]=_0x1b0de1[_0x0699('0x8c')];this[_0x0699('0x1d')][_0x1b0de1['transfertargetuniqueid']]['transferconnectedlinenum']=_0x1b0de1[_0x0699('0x91')];if(this['channels'][_0x1b0de1[_0x0699('0x92')]]){var _0x3789f6=this['channels'][_0x1b0de1['origtransfereruniqueid']];this['channels'][_0x1b0de1['origtransfereruniqueid']]=this['channels'][_0x1b0de1[_0x0699('0x8f')]];this[_0x0699('0x1d')][_0x1b0de1[_0x0699('0x8f')]]=_0x3789f6;}}}}catch(_0x381d9c){logger[_0x0699('0x3e')](_0x0699('0x93'),util[_0x0699('0x4f')](_0x381d9c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')]['syncBlindTransfer']=function(_0x12df3c){try{if(this['isNotNull'](_0x12df3c)){if(this[_0x0699('0x1d')][_0x12df3c[_0x0699('0x8b')]]){this[_0x0699('0x1d')][_0x12df3c[_0x0699('0x8b')]]['transfercalleridnum']=_0x12df3c[_0x0699('0x94')];this[_0x0699('0x1d')][_0x12df3c[_0x0699('0x8b')]][_0x0699('0x8d')]=_0x12df3c[_0x0699('0x95')];this[_0x0699('0x84')]({'event':_0x0699('0x96'),'uniqueid':_0x12df3c[_0x0699('0x8b')],'context':_0x12df3c[_0x0699('0x46')],'channel':_0x12df3c[_0x0699('0x97')]});}}}catch(_0x3b9ec7){logger[_0x0699('0x3e')](_0x0699('0x98'),util[_0x0699('0x4f')](_0x3b9ec7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0699('0x2f')]=function(_0xc20ad0){try{if(this[_0x0699('0x37')](_0xc20ad0)){if(this[_0x0699('0x1d')][_0xc20ad0['uniqueid']]){if(!_['isNil'](this['channels'][_0xc20ad0['uniqueid']]['answertime'])){this['channels'][_0xc20ad0[_0x0699('0x3b')]][_0x0699('0x99')]=moment()[_0x0699('0x4b')](_0x0699('0x43'));}}}}catch(_0x57aa79){logger[_0x0699('0x3e')](_0x0699('0x9a'),util[_0x0699('0x4f')](_0x57aa79,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0699('0x36')][_0x0699('0x30')]=function(_0x46931b){try{if(this[_0x0699('0x37')](_0x46931b)){if(this['channels'][_0x46931b[_0x0699('0x3b')]]){if(!_[_0x0699('0x6c')](this[_0x0699('0x1d')][_0x46931b[_0x0699('0x3b')]][_0x0699('0x99')])){this['channels'][_0x46931b[_0x0699('0x3b')]][_0x0699('0x9b')]+=moment()[_0x0699('0x9c')](0x0)[_0x0699('0x60')](this[_0x0699('0x1d')][_0x46931b[_0x0699('0x3b')]][_0x0699('0x99')],'seconds');delete this['channels'][_0x46931b[_0x0699('0x3b')]][_0x0699('0x99')];}}}}catch(_0x24f46e){logger[_0x0699('0x3e')](_0x0699('0x9d'),util[_0x0699('0x4f')](_0x24f46e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xc2b8=['not_inuse','busy','invalid','unavailable','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','varset','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','isUndefined','prototype','syncNewCallerId','uniqueid','linkedid','pick','keys','error','syncNewChannel','isNotNull','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','from-sip','split','exten','emit','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','duration','subtract','seconds','disposition','merge','lastapplication','lastdata','applicationdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','holdtime','diff','calleridnum','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','inspect','monitor','.wav49','replace','monitorFilename','find','isNil','push','rec','syncVarSet','variable','mixmonitor_filename','value','xmd-phone','callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../model/channel','unknown'];(function(_0x5b20ef,_0x15f3aa){var _0xd04a72=function(_0x3dd367){while(--_0x3dd367){_0x5b20ef['push'](_0x5b20ef['shift']());}};_0xd04a72(++_0x15f3aa);}(_0xc2b8,0x1ab));var _0x8c2b=function(_0x3bd139,_0x52a505){_0x3bd139=_0x3bd139-0x0;var _0xa9342a=_0xc2b8[_0x3bd139];return _0xa9342a;};'use strict';var BPromise=require(_0x8c2b('0x0'));var _=require('lodash');var moment=require(_0x8c2b('0x1'));var util=require(_0x8c2b('0x2'));var path=require(_0x8c2b('0x3'));var Redis=require(_0x8c2b('0x4'));var config=require(_0x8c2b('0x5'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');var Channel=require(_0x8c2b('0x6'));var statusDesc=[_0x8c2b('0x7'),_0x8c2b('0x8'),'inuse',_0x8c2b('0x9'),_0x8c2b('0xa'),_0x8c2b('0xb'),'ringing','ringinuse',_0x8c2b('0xc')];var applications=[_0x8c2b('0xd'),_0x8c2b('0xe'),_0x8c2b('0xf'),_0x8c2b('0x10'),_0x8c2b('0x11'),_0x8c2b('0x12')];var dispositions=[_0x8c2b('0x13'),_0x8c2b('0x14'),_0x8c2b('0x14'),_0x8c2b('0x13'),_0x8c2b('0x13'),'NO\x20ANSWER','ANSWERED',_0x8c2b('0x15'),_0x8c2b('0x14'),'FAILED',_0x8c2b('0x14')];var actions={};config[_0x8c2b('0x16')]=_[_0x8c2b('0x17')](config[_0x8c2b('0x16')],{'host':_0x8c2b('0x18'),'port':0x18eb});var io=require(_0x8c2b('0x19'))(new Redis(config[_0x8c2b('0x16')]));function VoiceCallReport(_0xdba0d8){this['channels']=_0xdba0d8[_0x8c2b('0x1a')];this['agents']=_0xdba0d8[_0x8c2b('0x1b')];ami['on'](_0x8c2b('0x1c'),this[_0x8c2b('0x1d')][_0x8c2b('0x1e')](this));ami['on'](_0x8c2b('0x1f'),this[_0x8c2b('0x1d')]['bind'](this));ami['on'](_0x8c2b('0x20'),this['syncNewChannel'][_0x8c2b('0x1e')](this));ami['on'](_0x8c2b('0x21'),this['syncNewState'][_0x8c2b('0x1e')](this));ami['on'](_0x8c2b('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0x8c2b('0x23'),this[_0x8c2b('0x24')]['bind'](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x8c2b('0x1e')](this));ami['on'](_0x8c2b('0x25'),this[_0x8c2b('0x26')][_0x8c2b('0x1e')](this));ami['on']('blindtransfer',this[_0x8c2b('0x27')][_0x8c2b('0x1e')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x8c2b('0x1e')](this));ami['on']('musiconholdstop',this[_0x8c2b('0x28')][_0x8c2b('0x1e')](this));return BPromise[_0x8c2b('0x29')]()[_0x8c2b('0x2a')](ami[_0x8c2b('0x2b')]())[_0x8c2b('0x2c')](function(_0x57e26f){console[_0x8c2b('0x2d')](_0x57e26f);});}VoiceCallReport['prototype']['isNotNull']=function(_0x524c03){return _0x524c03!==null&&!_[_0x8c2b('0x2e')](_0x524c03);};VoiceCallReport[_0x8c2b('0x2f')]['emit']=function(_0x522b0d,_0x16df23,_0x189098){io['to'](_0x522b0d)['emit'](_0x16df23,_0x189098);};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x30')]=function(_0x1fc968){try{if(this['isNotNull'](_0x1fc968)){if(_0x1fc968[_0x8c2b('0x31')]===_0x1fc968[_0x8c2b('0x32')]){if(!_[_0x8c2b('0x2e')](this[_0x8c2b('0x1a')][_0x1fc968[_0x8c2b('0x31')]])){_['merge'](this[_0x8c2b('0x1a')][_0x1fc968[_0x8c2b('0x31')]],_[_0x8c2b('0x33')](_0x1fc968,_[_0x8c2b('0x34')](this[_0x8c2b('0x1a')][_0x1fc968['uniqueid']])));}}}}catch(_0x41c40e){logger[_0x8c2b('0x35')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x41c40e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x36')]=function(_0x10eccf){try{if(this[_0x8c2b('0x37')](_0x10eccf)){if(_0x10eccf['uniqueid']===_0x10eccf[_0x8c2b('0x32')]&&_0x10eccf[_0x8c2b('0x38')]!=_0x8c2b('0x39')){if(_[_0x8c2b('0x2e')](this['channels'][_0x10eccf[_0x8c2b('0x31')]])){this[_0x8c2b('0x1a')][_0x10eccf['uniqueid']]=new Channel();this['channels'][_0x10eccf[_0x8c2b('0x31')]][_0x8c2b('0x3a')]=moment()[_0x8c2b('0x3b')](_0x8c2b('0x3c'));this['channels'][_0x10eccf[_0x8c2b('0x31')]]['disposition']=dispositions[_[_0x8c2b('0x3d')](_0x10eccf[_0x8c2b('0x3e')])];_['merge'](this[_0x8c2b('0x1a')][_0x10eccf[_0x8c2b('0x31')]],_[_0x8c2b('0x33')](_0x10eccf,_[_0x8c2b('0x34')](this[_0x8c2b('0x1a')][_0x10eccf[_0x8c2b('0x31')]])));if(_0x10eccf[_0x8c2b('0x3f')]===_0x8c2b('0x40')){if(this['agents'][_0x10eccf[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]]){this[_0x8c2b('0x1b')][_0x10eccf['channel'][_0x8c2b('0x41')]('-')[0x0]]['destconnectedlinenum']=_0x10eccf[_0x8c2b('0x42')];this[_0x8c2b('0x43')](util[_0x8c2b('0x3b')](_0x8c2b('0x44'),this[_0x8c2b('0x1b')][_0x10eccf[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]][_0x8c2b('0x45')]),'user:agentconnect',{'destaccountcode':this[_0x8c2b('0x1b')][_0x10eccf['channel'][_0x8c2b('0x41')]('-')[0x0]][_0x8c2b('0x46')],'destconnectedlinenum':_0x10eccf[_0x8c2b('0x42')]});}}}}}}catch(_0x2d79fa){logger[_0x8c2b('0x35')](_0x8c2b('0x47'),util['inspect'](_0x2d79fa,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x4ebaeb){try{if(this[_0x8c2b('0x37')](_0x4ebaeb)){if(_0x4ebaeb['uniqueid']===_0x4ebaeb[_0x8c2b('0x32')]&&_0x4ebaeb[_0x8c2b('0x42')]!='h'&&_0x4ebaeb[_0x8c2b('0x38')]!=_0x8c2b('0x39')){_0x4ebaeb[_0x8c2b('0x48')]=_0x4ebaeb['application'][_0x8c2b('0x49')]();_0x4ebaeb['applicationdata']=(_0x4ebaeb[_0x8c2b('0x4a')]||_0x4ebaeb['applicationdata'])['toLowerCase']();if(_[_0x8c2b('0x2e')](this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]])){this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]]=new Channel();this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]][_0x8c2b('0x3a')]=_0x4ebaeb[_0x8c2b('0x4b')]?moment()[_0x8c2b('0x4c')](moment[_0x8c2b('0x4b')](_0x4ebaeb[_0x8c2b('0x4b')])[_0x8c2b('0x4d')](),_0x8c2b('0x4d'))[_0x8c2b('0x3b')](_0x8c2b('0x3c')):moment()[_0x8c2b('0x3b')](_0x8c2b('0x3c'));this[_0x8c2b('0x1a')][_0x4ebaeb['uniqueid']][_0x8c2b('0x4e')]='NO\x20ANSWER';}_[_0x8c2b('0x4f')](this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]],_['pick'](_0x4ebaeb,_[_0x8c2b('0x34')](this['channels'][_0x4ebaeb['uniqueid']])));if(_['includes'](applications,_0x4ebaeb[_0x8c2b('0x48')])){this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]][_0x8c2b('0x50')]=_0x4ebaeb[_0x8c2b('0x48')];this['channels'][_0x4ebaeb[_0x8c2b('0x31')]][_0x8c2b('0x51')]=_0x4ebaeb[_0x8c2b('0x52')];if(_0x4ebaeb[_0x8c2b('0x48')]==='set'&&_[_0x8c2b('0x53')](_0x4ebaeb[_0x8c2b('0x52')],_0x8c2b('0x54'))){var _0x568da9=_0x4ebaeb[_0x8c2b('0x52')][_0x8c2b('0x41')]('=');var _0x5e776=_0x568da9[0x0][_0x8c2b('0x55')](/cdr\((.*)\)/);if(_0x5e776){this[_0x8c2b('0x1a')][_0x4ebaeb[_0x8c2b('0x31')]][_0x5e776[0x1]]=_0x568da9[0x1];}}else if(_0x4ebaeb[_0x8c2b('0x48')]===_0x8c2b('0xe')){this[_0x8c2b('0x1a')][_0x4ebaeb['uniqueid']][_0x8c2b('0xe')]=_0x4ebaeb[_0x8c2b('0x52')][_0x8c2b('0x41')](',')[0x0];}}}}}catch(_0x5b5834){logger['error'](_0x8c2b('0x56'),util['inspect'](_0x5b5834,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x57')]=function(_0x1ed51b){try{if(this[_0x8c2b('0x37')](_0x1ed51b)){if(_0x1ed51b[_0x8c2b('0x31')]!==_0x1ed51b['linkedid']){if(this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]]){if(_0x1ed51b[_0x8c2b('0x3e')]==='6'){if(!this[_0x8c2b('0x1a')][_0x1ed51b['linkedid']][_0x8c2b('0x58')]){var _0x4b565d=moment();this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x58')]=!![];this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x59')]=_0x4b565d[_0x8c2b('0x3b')](_0x8c2b('0x3c'));if(this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x3a')]){this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x5a')]=_0x4b565d[_0x8c2b('0x5b')](this[_0x8c2b('0x1a')][_0x1ed51b['linkedid']][_0x8c2b('0x3a')],_0x8c2b('0x4d'));}}this['channels'][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x32')]=_0x1ed51b[_0x8c2b('0x31')];if(_0x1ed51b[_0x8c2b('0x5c')]!=='xcally-motion-preview'){this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x5d')]=_0x1ed51b[_0x8c2b('0x5c')];}this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x5e')]=_0x1ed51b[_0x8c2b('0x5f')];this[_0x8c2b('0x1a')][_0x1ed51b['linkedid']][_0x8c2b('0x60')]=_0x1ed51b['channel'];this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x4e')]=dispositions[_['toNumber'](_0x1ed51b[_0x8c2b('0x3e')])];if(this[_0x8c2b('0x1b')][_0x1ed51b[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]]){this[_0x8c2b('0x1a')][_0x1ed51b[_0x8c2b('0x32')]][_0x8c2b('0x61')]=this[_0x8c2b('0x1b')][_0x1ed51b[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]]['id'];this['channels'][_0x1ed51b['linkedid']][_0x8c2b('0x62')]=this[_0x8c2b('0x1b')][_0x1ed51b[_0x8c2b('0x38')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x8c2b('0x1a')][_0x1ed51b['uniqueid']]){if(_0x1ed51b[_0x8c2b('0x3e')]==='6'){if(this['agents'][_0x1ed51b[_0x8c2b('0x38')]['split']('-')[0x0]]){this[_0x8c2b('0x1a')][_0x1ed51b['uniqueid']][_0x8c2b('0x61')]=this[_0x8c2b('0x1b')][_0x1ed51b[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]]['id'];this['channels'][_0x1ed51b[_0x8c2b('0x31')]]['membername']=this[_0x8c2b('0x1b')][_0x1ed51b[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]][_0x8c2b('0x45')];}}}}}}catch(_0xc8e2e2){logger[_0x8c2b('0x35')]('[syncNewState][VoiceCallReport]',util[_0x8c2b('0x63')](_0xc8e2e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')]['syncMixMonitorFilename']=function(_0x49c9eb,_0x104a47){if(this[_0x8c2b('0x1a')][_0x49c9eb]){this['channels'][_0x49c9eb][_0x8c2b('0x64')]=!![];if(_['endsWith'](_0x104a47,_0x8c2b('0x65'))){_0x104a47=_0x104a47[_0x8c2b('0x66')](_0x8c2b('0x65'),'.WAV');}this[_0x8c2b('0x1a')][_0x49c9eb][_0x8c2b('0x67')]=_0x104a47;var _0x65f309=_[_0x8c2b('0x68')](this['channels'][_0x49c9eb]['monitors'],{'filename':_0x104a47});if(_[_0x8c2b('0x69')](_0x65f309)){this[_0x8c2b('0x1a')][_0x49c9eb]['monitors'][_0x8c2b('0x6a')]({'filename':_0x104a47,'createdAt':moment()[_0x8c2b('0x3b')](_0x8c2b('0x3c')),'mixmonitorid':'','status':_0x8c2b('0x6b')});}}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x6c')]=function(_0x277c19){try{if(this[_0x8c2b('0x37')](_0x277c19)){if(this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]]&&_0x277c19['channel']!=_0x8c2b('0x39')){if(this[_0x8c2b('0x37')](_0x277c19['variable'])){if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x6e')])){this['syncMixMonitorFilename'](_0x277c19[_0x8c2b('0x31')],_0x277c19[_0x8c2b('0x6f')]);}else if(this[_0x8c2b('0x37')](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x70')])){this['channels'][_0x277c19[_0x8c2b('0x31')]]['calleridnum']=_0x277c19[_0x8c2b('0x6f')];}else if(this[_0x8c2b('0x37')](_0x277c19[_0x8c2b('0x6d')]['xmd-callerid'])){this['channels'][_0x277c19[_0x8c2b('0x31')]][_0x8c2b('0x71')]=_0x277c19[_0x8c2b('0x6f')];}else if(this[_0x8c2b('0x37')](_0x277c19[_0x8c2b('0x6d')]['xmd-cdrtype'])){this[_0x8c2b('0x1a')][_0x277c19['uniqueid']]['type']=_0x277c19[_0x8c2b('0x6f')];}else if(this[_0x8c2b('0x37')](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x72')])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]][_0x8c2b('0xe')]=_0x277c19['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x73')])){this['channels'][_0x277c19['uniqueid']][_0x8c2b('0x74')]=_0x277c19[_0x8c2b('0x6f')];}else if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x75')])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]][_0x8c2b('0x76')]=_0x277c19[_0x8c2b('0x6f')];}else if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x77')])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]]['calleridpreview']=_0x277c19['value'];}else if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')]['xmcs-queue'])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]]['queue']=_0x277c19[_0x8c2b('0x6f')];}else if(this[_0x8c2b('0x37')](_0x277c19[_0x8c2b('0x6d')][_0x8c2b('0x78')])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x31')]][_0x8c2b('0x79')]=_0x277c19[_0x8c2b('0x6f')];}}}else if(this['isNotNull'](_0x277c19[_0x8c2b('0x6d')]['mixmonitor_filename'])){if(_0x277c19[_0x8c2b('0x6f')]){var _0x5f356a=path[_0x8c2b('0x7a')](_0x277c19[_0x8c2b('0x6f')])[_0x8c2b('0x45')];this['syncMixMonitorFilename'](_0x5f356a,_0x277c19[_0x8c2b('0x6f')]);}}else if(this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x32')]]){if(this[_0x8c2b('0x37')](_0x277c19['variable'])){if(this[_0x8c2b('0x37')](_0x277c19['variable']['sipcallid'])){this[_0x8c2b('0x1a')][_0x277c19[_0x8c2b('0x32')]]['sipcalllinkedid']=_0x277c19[_0x8c2b('0x6f')];}}}}}catch(_0x2f5261){logger[_0x8c2b('0x35')](_0x8c2b('0x7b'),util['inspect'](_0x2f5261,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x24')]=function(_0x440643){try{if(this[_0x8c2b('0x37')](_0x440643)){if(this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]]){var _0x156e6e=moment();this[_0x8c2b('0x1a')][_0x440643['uniqueid']]['endtime']=_0x156e6e[_0x8c2b('0x3b')](_0x8c2b('0x3c'));this[_0x8c2b('0x1a')][_0x440643['uniqueid']][_0x8c2b('0x4b')]=_0x156e6e[_0x8c2b('0x5b')](this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]][_0x8c2b('0x3a')],'seconds');if(this[_0x8c2b('0x1a')][_0x440643['uniqueid']]['answered']){this[_0x8c2b('0x1a')][_0x440643['uniqueid']][_0x8c2b('0x7c')]=_0x156e6e[_0x8c2b('0x5b')](this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]][_0x8c2b('0x59')],'seconds');this['channels'][_0x440643['uniqueid']][_0x8c2b('0x5a')]=this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]][_0x8c2b('0x4b')]-this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]]['billableseconds'];}if(_0x440643[_0x8c2b('0x3f')]===_0x8c2b('0x40')){if(this[_0x8c2b('0x1b')][_0x440643[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]]){this[_0x8c2b('0x1b')][_0x440643['channel'][_0x8c2b('0x41')]('-')[0x0]]=_[_0x8c2b('0x7d')](this[_0x8c2b('0x1b')][_0x440643['channel'][_0x8c2b('0x41')]('-')[0x0]],['destconnectedlinenum']);this[_0x8c2b('0x43')](util[_0x8c2b('0x3b')](_0x8c2b('0x44'),this[_0x8c2b('0x1b')][_0x440643[_0x8c2b('0x38')][_0x8c2b('0x41')]('-')[0x0]][_0x8c2b('0x45')]),_0x8c2b('0x7e'),{'destaccountcode':this[_0x8c2b('0x1b')][_0x440643[_0x8c2b('0x38')]['split']('-')[0x0]][_0x8c2b('0x46')]});}}ami['emit'](_0x8c2b('0x7f'),this['channels'][_0x440643[_0x8c2b('0x31')]]);delete this[_0x8c2b('0x1a')][_0x440643[_0x8c2b('0x31')]];}}}catch(_0xa2f800){logger[_0x8c2b('0x35')](_0x8c2b('0x80'),util['inspect'](_0xa2f800,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')]['syncAttendedTransfer']=function(_0x216643){try{if(this[_0x8c2b('0x37')](_0x216643)){if(this[_0x8c2b('0x1a')][_0x216643['transfereeuniqueid']]){this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x81')]][_0x8c2b('0x82')]=_0x216643[_0x8c2b('0x83')];this['channels'][_0x216643[_0x8c2b('0x81')]][_0x8c2b('0x84')]=_0x216643[_0x8c2b('0x85')];if(this['channels'][_0x216643[_0x8c2b('0x86')]]){var _0x1d81cb=this['channels'][_0x216643[_0x8c2b('0x86')]];this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x86')]]=this['channels'][_0x216643[_0x8c2b('0x81')]];this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x81')]]=_0x1d81cb;}}else if(this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x87')]]){this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x87')]][_0x8c2b('0x82')]=_0x216643['origtransferercalleridnum'];this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x87')]][_0x8c2b('0x84')]=_0x216643[_0x8c2b('0x85')];if(this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x88')]]){var _0x1d81cb=this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x88')]];this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x88')]]=this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x87')]];this[_0x8c2b('0x1a')][_0x216643[_0x8c2b('0x87')]]=_0x1d81cb;}}}}catch(_0x31570c){logger['error'](_0x8c2b('0x89'),util[_0x8c2b('0x63')](_0x31570c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x27')]=function(_0x296c5c){try{if(this[_0x8c2b('0x37')](_0x296c5c)){if(this[_0x8c2b('0x1a')][_0x296c5c[_0x8c2b('0x81')]]){this[_0x8c2b('0x1a')][_0x296c5c['transfereeuniqueid']][_0x8c2b('0x82')]=_0x296c5c['transfereecalleridnum'];this[_0x8c2b('0x1a')][_0x296c5c[_0x8c2b('0x81')]][_0x8c2b('0x84')]=_0x296c5c[_0x8c2b('0x8a')];this[_0x8c2b('0x24')]({'event':'BlindTransfer','uniqueid':_0x296c5c['transfereeuniqueid'],'context':_0x296c5c['context'],'channel':_0x296c5c['transfererchannel']});}}}catch(_0x21908f){logger['error'](_0x8c2b('0x8b'),util[_0x8c2b('0x63')](_0x21908f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x8c')]=function(_0x27eedb){try{if(this[_0x8c2b('0x37')](_0x27eedb)){if(this[_0x8c2b('0x1a')][_0x27eedb['uniqueid']]){if(!_[_0x8c2b('0x69')](this[_0x8c2b('0x1a')][_0x27eedb[_0x8c2b('0x31')]][_0x8c2b('0x59')])){this['channels'][_0x27eedb[_0x8c2b('0x31')]]['mohstarttime']=moment()[_0x8c2b('0x3b')](_0x8c2b('0x3c'));}}}}catch(_0x3fe35a){logger[_0x8c2b('0x35')](_0x8c2b('0x8d'),util[_0x8c2b('0x63')](_0x3fe35a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8c2b('0x2f')][_0x8c2b('0x28')]=function(_0x242d3e){try{if(this['isNotNull'](_0x242d3e)){if(this[_0x8c2b('0x1a')][_0x242d3e['uniqueid']]){if(!_[_0x8c2b('0x69')](this[_0x8c2b('0x1a')][_0x242d3e[_0x8c2b('0x31')]]['mohstarttime'])){this[_0x8c2b('0x1a')][_0x242d3e[_0x8c2b('0x31')]][_0x8c2b('0x8e')]+=moment()[_0x8c2b('0x8f')](0x0)[_0x8c2b('0x5b')](this[_0x8c2b('0x1a')][_0x242d3e[_0x8c2b('0x31')]]['mohstarttime'],_0x8c2b('0x4d'));delete this[_0x8c2b('0x1a')][_0x242d3e[_0x8c2b('0x31')]]['mohstarttime'];}}}}catch(_0x1312b3){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x8c2b('0x63')](_0x1312b3,{'showHidden':![],'depth':null}));}};module[_0x8c2b('0x90')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 7d056d0..3dd81a8 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 _0xb425=['voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','inspect','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege'];(function(_0x4f962f,_0x120dff){var _0x209caa=function(_0x44af43){while(--_0x44af43){_0x4f962f['push'](_0x4f962f['shift']());}};_0x209caa(++_0x120dff);}(_0xb425,0x1ed));var _0x5b42=function(_0x40b610,_0x155ec5){_0x40b610=_0x40b610-0x0;var _0x117e71=_0xb425[_0x40b610];return _0x117e71;};'use strict';var _=require('lodash');var moment=require(_0x5b42('0x0'));var util=require(_0x5b42('0x1'));var Redis=require(_0x5b42('0x2'));var config=require(_0x5b42('0x3'));var logger=require(_0x5b42('0x4'))(_0x5b42('0x5'));var ami=require(_0x5b42('0x6'));config[_0x5b42('0x7')]=_[_0x5b42('0x8')](config[_0x5b42('0x7')],{'host':_0x5b42('0x9'),'port':0x18eb});var io=require(_0x5b42('0xa'))(new Redis(config[_0x5b42('0x7')]));function VoiceDialReport(_0xa89f52){this[_0x5b42('0xb')]=_0xa89f52[_0x5b42('0xc')];this[_0x5b42('0xd')]=_0xa89f52['outbound'];this[_0x5b42('0xe')]={};ami['on'](_0x5b42('0xf'),this[_0x5b42('0x10')][_0x5b42('0x11')](this));ami['on']('dialend',this[_0x5b42('0x12')][_0x5b42('0x11')](this));ami['on'](_0x5b42('0x13'),this[_0x5b42('0x14')]['bind'](this));ami['on'](_0x5b42('0x15'),this['syncHangup'][_0x5b42('0x11')](this));}VoiceDialReport[_0x5b42('0x16')][_0x5b42('0x17')]=function(_0x2f8bd4){return _0x2f8bd4!==null&&!_[_0x5b42('0x18')](_0x2f8bd4);};VoiceDialReport[_0x5b42('0x16')][_0x5b42('0x19')]=function(_0x453b4b,_0x1988aa,_0x304e4e){io['to'](_0x453b4b)[_0x5b42('0x19')](_0x1988aa,_0x304e4e);};VoiceDialReport['prototype'][_0x5b42('0x10')]=function(_0x5b637d){try{if(this[_0x5b42('0x17')](_0x5b637d)){if(this['channels'][_0x5b637d[_0x5b42('0x1a')]]){_['merge'](this[_0x5b42('0xb')][_0x5b637d[_0x5b42('0x1a')]],{'starttime':moment()[_0x5b42('0x1b')](_0x5b42('0x1c')),'lastevent':'called','interface':_0x5b637d[_0x5b42('0x1d')][_0x5b42('0x1e')](0x0,_0x5b637d[_0x5b42('0x1d')][_0x5b42('0x1f')]('-')),'membername':_0x5b637d[_0x5b42('0x1d')]['substring'](_0x5b637d['channel'][_0x5b42('0x1f')]('/')+0x1,_0x5b637d['channel'][_0x5b42('0x1f')]('-'))},_[_0x5b42('0x20')](_0x5b637d,[_0x5b42('0x21'),_0x5b42('0x22')]));this['emit'](_0x5b42('0x23'),_0x5b42('0x24'),this[_0x5b42('0xb')][_0x5b637d[_0x5b42('0x1a')]]);ami[_0x5b42('0x19')](_0x5b42('0x25'),this[_0x5b42('0xb')][_0x5b637d[_0x5b42('0x1a')]]);}}}catch(_0x49aae6){logger['error'](_0x5b42('0x26'),util['inspect'](_0x49aae6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5b42('0x16')]['syncDialEnd']=function(_0x8430df){try{if(this['isNotNull'](_0x8430df)){if(this['channels'][_0x8430df[_0x5b42('0x1a')]]){this[_0x5b42('0xb')][_0x8430df[_0x5b42('0x1a')]][_0x5b42('0x27')]=_0x8430df[_0x5b42('0x27')];if(_0x8430df[_0x5b42('0x27')]===_0x5b42('0x28')){this[_0x5b42('0xb')][_0x8430df[_0x5b42('0x1a')]]['connectedlinenum']=_0x8430df[_0x5b42('0x29')];this[_0x5b42('0xb')][_0x8430df[_0x5b42('0x1a')]][_0x5b42('0x2a')]=_0x8430df[_0x5b42('0x2a')];this['channels'][_0x8430df['uniqueid']][_0x5b42('0x2b')]=moment()[_0x5b42('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x8430df['uniqueid']][_0x5b42('0x2c')]=_0x5b42('0x2d');ami[_0x5b42('0x19')]('custom:dialconnect',this[_0x5b42('0xb')][_0x8430df[_0x5b42('0x1a')]]);}this[_0x5b42('0x19')](_0x5b42('0x23'),_0x5b42('0x24'),this[_0x5b42('0xb')][_0x8430df['uniqueid']]);}}}catch(_0x11d864){logger[_0x5b42('0x2e')](_0x5b42('0x2f'),util['inspect'](_0x11d864,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5b42('0x14')]=function(_0x5ee1ba){try{if(this[_0x5b42('0x17')](_0x5ee1ba)){this[_0x5b42('0x30')](_0x5ee1ba[_0x5b42('0x1a')],_[_0x5b42('0x31')](_0x5ee1ba[_0x5b42('0x32')])[0x0],_0x5ee1ba[_0x5b42('0x33')]);if(this[_0x5b42('0x17')](_0x5ee1ba[_0x5b42('0x32')])&&this[_0x5b42('0x17')](_0x5ee1ba['variable'][_0x5b42('0x34')])){if(_[_0x5b42('0x18')](this['channels'][_0x5ee1ba['uniqueid']])){this[_0x5b42('0xb')][_0x5ee1ba[_0x5b42('0x1a')]]={'routeId':_0x5ee1ba[_0x5b42('0x33')],'variables':this[_0x5b42('0xe')][_0x5ee1ba[_0x5b42('0x1a')]]};this[_0x5b42('0x19')](_0x5b42('0x23'),_0x5b42('0x24'),this[_0x5b42('0xb')][_0x5ee1ba[_0x5b42('0x1a')]]);}}}}catch(_0x3ab473){logger[_0x5b42('0x2e')](_0x5b42('0x35'),util[_0x5b42('0x36')](_0x3ab473,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5b42('0x16')][_0x5b42('0x30')]=function(_0x5463c3,_0x49990c,_0x2c0064){var _0x510dd9=[_0x5b42('0x37'),'rtpaudioqosbridged',_0x5b42('0x38'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x5b42('0x39'),_0x5b42('0x3a'),'rtpaudioqosrttbridged',_0x5b42('0x3b'),'sipuri','bridgepeer',_0x5b42('0x3c'),_0x5b42('0x3d'),'memberdynamic',_0x5b42('0x3e'),_0x5b42('0x3f'),'membername',_0x5b42('0x40'),_0x5b42('0x41')];if(!_[_0x5b42('0x42')](_0x49990c)&&!_[_0x5b42('0x43')](_0x510dd9,_0x49990c)){if(_[_0x5b42('0x18')](this[_0x5b42('0xe')][_0x5463c3])){this[_0x5b42('0xe')][_0x5463c3]={};}this[_0x5b42('0xe')][_0x5463c3][_0x49990c]=_0x2c0064;}};VoiceDialReport[_0x5b42('0x16')][_0x5b42('0x44')]=function(_0x158d7f){try{if(this['isNotNull'](_0x158d7f)){if(this[_0x5b42('0xb')][_0x158d7f['uniqueid']]){this[_0x5b42('0xb')][_0x158d7f['uniqueid']][_0x5b42('0x45')]=moment()[_0x5b42('0x1b')](_0x5b42('0x1c'));this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x46')]=moment(this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x45')])[_0x5b42('0x47')](this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x48')],_0x5b42('0x49'));this['channels'][_0x158d7f['uniqueid']][_0x5b42('0x2c')]=_0x5b42('0x4a');this[_0x5b42('0xd')][_0x5b42('0x4b')]+=0x1;if(this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x2b')]){this[_0x5b42('0xd')][_0x5b42('0x4c')]+=0x1;this[_0x5b42('0xb')][_0x158d7f['uniqueid']][_0x5b42('0x4d')]=moment(this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x2b')])[_0x5b42('0x47')](this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x48')],_0x5b42('0x49'));this['channels'][_0x158d7f['uniqueid']][_0x5b42('0x4e')]=moment(this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]['endtime'])[_0x5b42('0x47')](this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]['answertime'],_0x5b42('0x49'));this[_0x5b42('0xd')]['sumHoldTime']+=this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x4d')]||0x0;this['outbound'][_0x5b42('0x4f')]+=this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]['billableseconds'];}this[_0x5b42('0xd')]['sumDuration']+=this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]][_0x5b42('0x46')];ami[_0x5b42('0x19')](_0x5b42('0x50'),this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]);ami[_0x5b42('0x19')](_0x5b42('0x51'),this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]);this[_0x5b42('0x19')]('voice:outbound','voice_outbound:save',this[_0x5b42('0xd')]);logger[_0x5b42('0x52')](_0x5b42('0x53'),JSON[_0x5b42('0x54')](this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]));this[_0x5b42('0x19')]('voice:outbound',_0x5b42('0x55'),this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]]);delete this[_0x5b42('0xb')][_0x158d7f[_0x5b42('0x1a')]];}if(this[_0x5b42('0xe')][_0x158d7f[_0x5b42('0x1a')]]){delete this['variables'][_0x158d7f[_0x5b42('0x1a')]];}}}catch(_0x19a94b){logger[_0x5b42('0x2e')](_0x5b42('0x56'),util[_0x5b42('0x36')](_0x19a94b,{'showHidden':![],'depth':null}));}};module[_0x5b42('0x57')]=VoiceDialReport; \ No newline at end of file +var _0x06a5=['dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinename','answertime','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','endtime','duration','diff','starttime','seconds','lastevent','complete','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','error','[syncHangup][VoiceDialReport]','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06a5,0xfd));var _0x506a=function(_0x420502,_0x2d21a9){_0x420502=_0x420502-0x0;var _0x726649=_0x06a5[_0x420502];return _0x726649;};'use strict';var _=require(_0x506a('0x0'));var moment=require('moment');var util=require(_0x506a('0x1'));var Redis=require('ioredis');var config=require(_0x506a('0x2'));var logger=require(_0x506a('0x3'))(_0x506a('0x4'));var ami=require(_0x506a('0x5'));config[_0x506a('0x6')]=_[_0x506a('0x7')](config['redis'],{'host':_0x506a('0x8'),'port':0x18eb});var io=require(_0x506a('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x15c63c){this[_0x506a('0xa')]=_0x15c63c[_0x506a('0xb')];this[_0x506a('0xc')]=_0x15c63c[_0x506a('0xc')];this[_0x506a('0xd')]={};ami['on'](_0x506a('0xe'),this[_0x506a('0xf')][_0x506a('0x10')](this));ami['on']('dialend',this[_0x506a('0x11')][_0x506a('0x10')](this));ami['on'](_0x506a('0x12'),this[_0x506a('0x13')][_0x506a('0x10')](this));ami['on'](_0x506a('0x14'),this[_0x506a('0x15')][_0x506a('0x10')](this));}VoiceDialReport[_0x506a('0x16')][_0x506a('0x17')]=function(_0x422fb8){return _0x422fb8!==null&&!_[_0x506a('0x18')](_0x422fb8);};VoiceDialReport['prototype'][_0x506a('0x19')]=function(_0x25346c,_0x3ab627,_0x264a0d){io['to'](_0x25346c)['emit'](_0x3ab627,_0x264a0d);};VoiceDialReport[_0x506a('0x16')][_0x506a('0xf')]=function(_0x53fccf){try{if(this[_0x506a('0x17')](_0x53fccf)){if(this[_0x506a('0xa')][_0x53fccf[_0x506a('0x1a')]]){_[_0x506a('0x1b')](this[_0x506a('0xa')][_0x53fccf[_0x506a('0x1a')]],{'starttime':moment()[_0x506a('0x1c')](_0x506a('0x1d')),'lastevent':_0x506a('0x1e'),'interface':_0x53fccf['channel']['substring'](0x0,_0x53fccf[_0x506a('0x1f')]['lastIndexOf']('-')),'membername':_0x53fccf[_0x506a('0x1f')][_0x506a('0x20')](_0x53fccf['channel'][_0x506a('0x21')]('/')+0x1,_0x53fccf[_0x506a('0x1f')][_0x506a('0x21')]('-'))},_[_0x506a('0x22')](_0x53fccf,[_0x506a('0x23'),_0x506a('0x24')]));this['emit'](_0x506a('0x25'),_0x506a('0x26'),this['channels'][_0x53fccf['uniqueid']]);ami['emit'](_0x506a('0x27'),this['channels'][_0x53fccf[_0x506a('0x1a')]]);}}}catch(_0xe9c9bd){logger['error'](_0x506a('0x28'),util[_0x506a('0x29')](_0xe9c9bd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x506a('0x16')][_0x506a('0x11')]=function(_0x5136c1){try{if(this['isNotNull'](_0x5136c1)){if(this[_0x506a('0xa')][_0x5136c1[_0x506a('0x1a')]]){this[_0x506a('0xa')][_0x5136c1[_0x506a('0x1a')]][_0x506a('0x2a')]=_0x5136c1[_0x506a('0x2a')];if(_0x5136c1[_0x506a('0x2a')]===_0x506a('0x2b')){this['channels'][_0x5136c1[_0x506a('0x1a')]]['connectedlinenum']=_0x5136c1['connectedlinenum'];this['channels'][_0x5136c1[_0x506a('0x1a')]][_0x506a('0x2c')]=_0x5136c1[_0x506a('0x2c')];this[_0x506a('0xa')][_0x5136c1['uniqueid']][_0x506a('0x2d')]=moment()[_0x506a('0x1c')](_0x506a('0x1d'));this[_0x506a('0xa')][_0x5136c1['uniqueid']]['lastevent']=_0x506a('0x2e');ami[_0x506a('0x19')]('custom:dialconnect',this['channels'][_0x5136c1['uniqueid']]);}this[_0x506a('0x19')](_0x506a('0x25'),_0x506a('0x26'),this[_0x506a('0xa')][_0x5136c1[_0x506a('0x1a')]]);}}}catch(_0x357465){logger['error'](_0x506a('0x2f'),util[_0x506a('0x29')](_0x357465,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x506a('0x16')][_0x506a('0x13')]=function(_0x111e5b){try{if(this[_0x506a('0x17')](_0x111e5b)){this[_0x506a('0x30')](_0x111e5b[_0x506a('0x1a')],_[_0x506a('0x31')](_0x111e5b[_0x506a('0x32')])[0x0],_0x111e5b[_0x506a('0x33')]);if(this[_0x506a('0x17')](_0x111e5b[_0x506a('0x32')])&&this[_0x506a('0x17')](_0x111e5b['variable']['outboundrouteid'])){if(_[_0x506a('0x18')](this[_0x506a('0xa')][_0x111e5b[_0x506a('0x1a')]])){this[_0x506a('0xa')][_0x111e5b[_0x506a('0x1a')]]={'routeId':_0x111e5b[_0x506a('0x33')],'variables':this[_0x506a('0xd')][_0x111e5b[_0x506a('0x1a')]]};this['emit'](_0x506a('0x25'),'voice_outbound_channel:save',this[_0x506a('0xa')][_0x111e5b[_0x506a('0x1a')]]);}}}}catch(_0x217820){logger['error']('[syncVarSet][VoiceDialReport]',util['inspect'](_0x217820,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x506a('0x30')]=function(_0x367fc0,_0x4523de,_0x21dc81){var _0x289c75=[_0x506a('0x34'),_0x506a('0x35'),_0x506a('0x36'),_0x506a('0x37'),_0x506a('0x38'),_0x506a('0x39'),_0x506a('0x3a'),_0x506a('0x3b'),_0x506a('0x3c'),_0x506a('0x3d'),_0x506a('0x3e'),_0x506a('0x3f'),_0x506a('0x40'),'memberdynamic',_0x506a('0x41'),_0x506a('0x42'),'membername',_0x506a('0x43'),_0x506a('0x44')];if(!_['isNil'](_0x4523de)&&!_[_0x506a('0x45')](_0x289c75,_0x4523de)){if(_['isUndefined'](this['variables'][_0x367fc0])){this[_0x506a('0xd')][_0x367fc0]={};}this[_0x506a('0xd')][_0x367fc0][_0x4523de]=_0x21dc81;}};VoiceDialReport[_0x506a('0x16')][_0x506a('0x15')]=function(_0x5d84e9){try{if(this['isNotNull'](_0x5d84e9)){if(this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]){this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x46')]=moment()['format'](_0x506a('0x1d'));this['channels'][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x47')]=moment(this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]['endtime'])[_0x506a('0x48')](this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x49')],_0x506a('0x4a'));this[_0x506a('0xa')][_0x5d84e9['uniqueid']][_0x506a('0x4b')]=_0x506a('0x4c');this['outbound']['total']+=0x1;if(this['channels'][_0x5d84e9[_0x506a('0x1a')]]['answertime']){this[_0x506a('0xc')][_0x506a('0x4d')]+=0x1;this['channels'][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x4e')]=moment(this[_0x506a('0xa')][_0x5d84e9['uniqueid']][_0x506a('0x2d')])[_0x506a('0x48')](this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]['starttime'],_0x506a('0x4a'));this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]['billableseconds']=moment(this[_0x506a('0xa')][_0x5d84e9['uniqueid']][_0x506a('0x46')])[_0x506a('0x48')](this['channels'][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x2d')],_0x506a('0x4a'));this[_0x506a('0xc')][_0x506a('0x4f')]+=this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x4e')]||0x0;this[_0x506a('0xc')][_0x506a('0x50')]+=this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x51')];}this[_0x506a('0xc')][_0x506a('0x52')]+=this['channels'][_0x5d84e9[_0x506a('0x1a')]][_0x506a('0x47')];ami[_0x506a('0x19')](_0x506a('0x53'),this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]);ami[_0x506a('0x19')](_0x506a('0x54'),this[_0x506a('0xa')][_0x5d84e9[_0x506a('0x1a')]]);this[_0x506a('0x19')]('voice:outbound',_0x506a('0x55'),this['outbound']);logger['info'](_0x506a('0x56'),JSON['stringify'](this['channels'][_0x5d84e9[_0x506a('0x1a')]]));this[_0x506a('0x19')](_0x506a('0x25'),'voice_outbound_channel:remove',this[_0x506a('0xa')][_0x5d84e9['uniqueid']]);delete this[_0x506a('0xa')][_0x5d84e9['uniqueid']];}if(this[_0x506a('0xd')][_0x5d84e9[_0x506a('0x1a')]]){delete this[_0x506a('0xd')][_0x5d84e9[_0x506a('0x1a')]];}}}catch(_0x2fb028){logger[_0x506a('0x57')](_0x506a('0x58'),util['inspect'](_0x2fb028,{'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 3ce2719..7758c74 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 _0x3d0b=['channel','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','error','[FullyBooted]\x20clear\x20realtime','voiceQueues','emitVoiceQueueChannelRemove','inspect','emit','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumHoldTime','abandoned','Trunk','active','callerid','Interval','stringify','voice_queue:save','isNotNull','loopQueueShow','clearZombieChannels','queues','catch','[queues]','loopQueueSummary','flagQueueSummary','then','[queuesummary]','countBy','queue','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','isUndefined','uniqueid','queuecallerjoinAt','position','merge','pick','keys','push','emitVoiceQueueChannelSave','last','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallercomplete','queuecallerexitreason','syncAgentComplete','queuecallerabandonAt','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','queuestatus','TIMEOUT','timeout','custom:timeout','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','unmanaged','diff','seconds','total','milliseconds','lastevent','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','switch','transfertargetuniqueid','origtransfererexten','ATTENDEDTRANSFER','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','context','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','bluebird','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','syncVarSet','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','isNil','Action','status'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x3d0b,0x93));var _0xb3d0=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0x3d0b[_0x289874];return _0x2f8bbb;};'use strict';var _=require(_0xb3d0('0x0'));var moment=require(_0xb3d0('0x1'));var BPromise=require(_0xb3d0('0x2'));var util=require('util');var md5=require(_0xb3d0('0x3'));var Redis=require(_0xb3d0('0x4'));var config=require(_0xb3d0('0x5'));var logger=require('../../../config/logger')(_0xb3d0('0x6'));var ami=require(_0xb3d0('0x7'));var QueueReport=require(_0xb3d0('0x8'));config[_0xb3d0('0x9')]=_[_0xb3d0('0xa')](config['redis'],{'host':_0xb3d0('0xb'),'port':0x18eb});var io=require(_0xb3d0('0xc'))(new Redis(config[_0xb3d0('0x9')]));var Sequence=function(){};Sequence[_0xb3d0('0xd')][_0xb3d0('0xe')]=function(_0x1a6fd5){this[_0xb3d0('0xf')]=this['tail']?this[_0xb3d0('0xf')]['finally'](_0x1a6fd5):_0x1a6fd5();};function VoiceQueueReport(_0x2d7a23){this[_0xb3d0('0x10')]=new Sequence();this[_0xb3d0('0x11')]={};this[_0xb3d0('0x12')]=_0x2d7a23[_0xb3d0('0x12')];this[_0xb3d0('0x13')]=_0x2d7a23[_0xb3d0('0x14')];this['voiceQueues']=_0x2d7a23['voiceQueues'];this['flagQueueSummary']=!![];this[_0xb3d0('0x15')]=_0x2d7a23[_0xb3d0('0x15')];this[_0xb3d0('0x16')]={};ami['on'](_0xb3d0('0x17'),this[_0xb3d0('0x18')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x1a'),this[_0xb3d0('0x1b')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x1c'),this[_0xb3d0('0x1d')]['bind'](this));ami['on'](_0xb3d0('0x1e'),this[_0xb3d0('0x1f')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x20'),this[_0xb3d0('0x21')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x22'),this['syncAgentComplete'][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x23'),this[_0xb3d0('0x24')][_0xb3d0('0x19')](this));ami['on']('varset',this[_0xb3d0('0x25')][_0xb3d0('0x19')](this));ami['on']('hangup',this[_0xb3d0('0x26')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x27'),this[_0xb3d0('0x28')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x29'),this[_0xb3d0('0x2a')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x2b'),this[_0xb3d0('0x2c')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x2d'),this[_0xb3d0('0x2e')][_0xb3d0('0x19')](this));ami['on'](_0xb3d0('0x2f'),this['syncBlindTransfer'][_0xb3d0('0x19')](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x27a4c0){return _0x27a4c0!==null&&!_['isUndefined'](_0x27a4c0);}function clearChannels(_0x4fe4e5){if(!_['isEmpty'](_0x4fe4e5)){for(var _0x4065fc in _0x4fe4e5){if(_0x4fe4e5['hasOwnProperty'](_0x4065fc)){delete _0x4fe4e5[_0x4065fc];}}}}function clearCampaigns(_0x4537e6){if(!_[_0xb3d0('0x30')](_0x4537e6)){for(var _0x530a0e in _0x4537e6){if(_0x4537e6[_0xb3d0('0x31')](_0x530a0e)){_0x4537e6[_0x530a0e][_0xb3d0('0x32')]=0x0;}}}}function clearVoiceQueues(_0x8e0df4){if(!_['isEmpty'](_0x8e0df4)){for(var _0x3279fa in _0x8e0df4){if(_0x8e0df4[_0xb3d0('0x31')](_0x3279fa)){_0x8e0df4[_0x3279fa]['originated']=0x0;_0x8e0df4[_0x3279fa][_0xb3d0('0x33')]=0x0;_0x8e0df4[_0x3279fa][_0xb3d0('0x34')]=0x0;_0x8e0df4[_0x3279fa][_0xb3d0('0x35')]=0x0;_0x8e0df4[_0x3279fa][_0xb3d0('0x36')]=!![];}}}}function clearAgentBooked(_0x3eee94){if(!_['isEmpty'](_0x3eee94)){for(var _0x49e829 in _0x3eee94){if(_0x3eee94[_0xb3d0('0x31')](_0x49e829)){_0x3eee94[_0x49e829]['unlockRR']=!![];}}}}VoiceQueueReport[_0xb3d0('0xd')]['clearZombieChannels']=function(){var _0x5d8283=this;for(var _0x423566 in this[_0xb3d0('0x13')]){if(this['channels'][_0xb3d0('0x31')](_0x423566)&&!this[_0xb3d0('0x13')][_0x423566]['switch']){this['sequence'][_0xb3d0('0xe')](function(){if(!_[_0xb3d0('0x37')](_0x5d8283['channels'][_0x423566])){return ami[_0xb3d0('0x38')]({'action':_0xb3d0('0x39'),'channel':_0x5d8283['channels'][_0x423566][_0xb3d0('0x3a')]})['catch'](function(_0x4cc265){if(_0x4cc265[_0xb3d0('0x3b')]===_0xb3d0('0x3c')){setTimeout(function(){if(_0x5d8283['channels'][_0x423566]){delete _0x5d8283[_0xb3d0('0x13')][_0x423566];logger['error'](_0xb3d0('0x3d'),_0x423566);}if(_0x5d8283[_0xb3d0('0x11')][_0x423566]){delete _0x5d8283[_0xb3d0('0x11')][_0x423566];logger['error'](_0xb3d0('0x3e'),_0x423566);}if(_0x5d8283[_0xb3d0('0x16')][_0x423566]){delete _0x5d8283['variables'][_0x423566];logger[_0xb3d0('0x3f')]('[voiceQueueReport][checkVariables]',_0x423566);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xb3d0('0x3f')](_0xb3d0('0x40'));clearChannels(this['channels']);this['clearQueueReport'](this[_0xb3d0('0x11')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xb3d0('0x41')]);clearCampaigns(this[_0xb3d0('0x15')]);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x30c4ec){var _0x582554=this;if(!_['isEmpty'](_0x30c4ec)){for(var _0x39896f in _0x30c4ec){if(_0x30c4ec[_0xb3d0('0x31')](_0x39896f)){_0x582554[_0xb3d0('0x42')](_0x30c4ec[_0x39896f]);delete _0x30c4ec[_0x39896f];}}}};function loggerCatch(_0x4ac2d7){return function(_0xd3ba25){logger[_0xb3d0('0x3f')](_0x4ac2d7,util[_0xb3d0('0x43')](_0xd3ba25,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0xb3d0('0x44')]=function(_0x267db6,_0x183e46,_0x23fe86){io['to'](_0x267db6)[_0xb3d0('0x44')](_0x183e46,_0x23fe86);};VoiceQueueReport[_0xb3d0('0xd')]['emitVoiceQueueChannelSave']=function(_0x298694){this[_0xb3d0('0x44')](util[_0xb3d0('0x45')](_0xb3d0('0x46'),_0x298694[_0xb3d0('0x47')]),_0xb3d0('0x48'),_0x298694);};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x42')]=function(_0x3f2517){logger[_0xb3d0('0x49')](_0xb3d0('0x4a'),JSON['stringify'](_0x3f2517));this[_0xb3d0('0x44')](util['format'](_0xb3d0('0x46'),_0x3f2517[_0xb3d0('0x47')]),_0xb3d0('0x4b'),_0x3f2517);};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x4c')]=function(_0x2c327a){if(_0x2c327a[_0xb3d0('0x4d')]===_0xb3d0('0x4e')){var _0x3433cd={'id':_0x2c327a['id'],'name':_0x2c327a[_0xb3d0('0x47')],'strategy':_0x2c327a[_0xb3d0('0x4f')],'answered':_0x2c327a[_0xb3d0('0x50')],'available':_0x2c327a[_0xb3d0('0x51')],'loggedIn':_0x2c327a[_0xb3d0('0x52')],'pTalking':_0x2c327a[_0xb3d0('0x34')],'sumBillable':_0x2c327a['sumBillable'],'sumDuration':_0x2c327a['sumDuration'],'sumHoldTime':_0x2c327a[_0xb3d0('0x53')]||0x0,'talking':_0x2c327a[_0xb3d0('0x33')],'total':_0x2c327a['total'],'type':_0x2c327a[_0xb3d0('0x4d')],'unmanaged':_0x2c327a['unmanaged'],'abandoned':_0x2c327a[_0xb3d0('0x54')],'waiting':_0x2c327a[_0xb3d0('0x35')]};if(_0x2c327a[_0xb3d0('0x55')]){_0x3433cd['Trunk']={'id':_0x2c327a[_0xb3d0('0x55')]['id'],'name':_0x2c327a[_0xb3d0('0x55')][_0xb3d0('0x47')],'active':_0x2c327a[_0xb3d0('0x55')][_0xb3d0('0x56')],'callerid':_0x2c327a[_0xb3d0('0x55')][_0xb3d0('0x57')]};}if(_0x2c327a['Interval']){_0x3433cd[_0xb3d0('0x58')]={'id':_0x2c327a[_0xb3d0('0x58')]['id'],'name':_0x2c327a[_0xb3d0('0x58')][_0xb3d0('0x47')]};}var _0x30f425=md5(JSON[_0xb3d0('0x59')](_0x3433cd));if(_0x2c327a[_0xb3d0('0x3')]!==_0x30f425){_0x2c327a['md5']=_0x30f425;this['emit'](util[_0xb3d0('0x45')](_0xb3d0('0x46'),_0x3433cd[_0xb3d0('0x47')]),_0xb3d0('0x5a'),_0x3433cd);}}};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x5b')]=function(_0x4cb524){return _0x4cb524!==null&&!_['isUndefined'](_0x4cb524);};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x5c')]=function(){var _0x44dcea=this;setInterval(function(){_0x44dcea[_0xb3d0('0x5d')]();ami['Action']({'action':_0xb3d0('0x5e')})[_0xb3d0('0x5f')](loggerCatch(_0xb3d0('0x60')));},0x2710);};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x61')]=function(){var _0x33ea2a=this;setInterval(function(){if(_0x33ea2a[_0xb3d0('0x62')]){return ami[_0xb3d0('0x38')]({'action':_0xb3d0('0x17')})[_0xb3d0('0x63')](function(_0x4ddab4){_0x33ea2a[_0xb3d0('0x62')]=![];})[_0xb3d0('0x5f')](loggerCatch(_0xb3d0('0x64')));}},0x3e8);};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x18')]=function(_0x8a92ae){try{if(this['isNotNull'](_0x8a92ae)&&this['isNotNull'](_0x8a92ae['queue'])){if(this[_0xb3d0('0x41')][_0x8a92ae['queue']]){var _0x3422ff=_[_0xb3d0('0x65')](this[_0xb3d0('0x13')],_0xb3d0('0x66'))[_0x8a92ae['queue']]||0x0;var _0x1300c4=_0x3422ff-_0x8a92ae[_0xb3d0('0x67')];if(this['voiceQueues'][_0x8a92ae[_0xb3d0('0x66')]][_0xb3d0('0x35')]!==_['toNumber'](_0x8a92ae['callers'])||this[_0xb3d0('0x41')][_0x8a92ae['queue']][_0xb3d0('0x52')]!==_[_0xb3d0('0x68')](_0x8a92ae[_0xb3d0('0x69')])||this[_0xb3d0('0x41')][_0x8a92ae['queue']][_0xb3d0('0x51')]!==_[_0xb3d0('0x68')](_0x8a92ae['available'])||this[_0xb3d0('0x41')][_0x8a92ae['queue']][_0xb3d0('0x33')]!==_0x1300c4){this[_0xb3d0('0x41')][_0x8a92ae[_0xb3d0('0x66')]][_0xb3d0('0x35')]=_['toNumber'](_0x8a92ae[_0xb3d0('0x67')]);this[_0xb3d0('0x41')][_0x8a92ae[_0xb3d0('0x66')]][_0xb3d0('0x52')]=_['toNumber'](_0x8a92ae[_0xb3d0('0x69')]);this[_0xb3d0('0x41')][_0x8a92ae[_0xb3d0('0x66')]][_0xb3d0('0x51')]=_['toNumber'](_0x8a92ae[_0xb3d0('0x51')]);this[_0xb3d0('0x41')][_0x8a92ae[_0xb3d0('0x66')]]['talking']=_0x1300c4>0x0?_0x1300c4:0x0;this[_0xb3d0('0x41')][_0x8a92ae['queue']][_0xb3d0('0x33')]=this[_0xb3d0('0x41')][_0x8a92ae[_0xb3d0('0x66')]][_0xb3d0('0x33')]>_[_0xb3d0('0x68')](_0x8a92ae['loggedin'])?_[_0xb3d0('0x68')](_0x8a92ae['loggedin']):this['voiceQueues'][_0x8a92ae['queue']]['talking'];this['emitVoiceQueueSummary'](this[_0xb3d0('0x41')][_0x8a92ae['queue']]);}ami['emit'](_0xb3d0('0x6a'),this[_0xb3d0('0x41')][_0x8a92ae['queue']]);}}}catch(_0x11a3d7){logger[_0xb3d0('0x3f')](_0xb3d0('0x6b'),util[_0xb3d0('0x43')](_0x11a3d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x1b')]=function(_0xb2999d){this[_0xb3d0('0x62')]=!![];};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x6c')]=function(_0x1040f0){};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x1d')]=function(_0x432dfc){try{if(this[_0xb3d0('0x5b')](_0x432dfc)){if(_[_0xb3d0('0x6d')](this[_0xb3d0('0x11')][_0x432dfc[_0xb3d0('0x6e')]])){this[_0xb3d0('0x11')][_0x432dfc[_0xb3d0('0x6e')]]=[];this[_0xb3d0('0x13')][_0x432dfc[_0xb3d0('0x6e')]]={};}var _0x2891da=new QueueReport();_0x2891da['name']=_0x432dfc[_0xb3d0('0x66')];_0x2891da['type']=this[_0xb3d0('0x41')][_0x2891da[_0xb3d0('0x47')]]&&this[_0xb3d0('0x41')][_0x2891da[_0xb3d0('0x47')]][_0xb3d0('0x4d')]?this[_0xb3d0('0x41')][_0x2891da['name']][_0xb3d0('0x4d')]||'inbound':_0xb3d0('0x4e');_0x2891da['queue']=_0x432dfc[_0xb3d0('0x66')];_0x2891da[_0xb3d0('0x6f')]=moment()[_0xb3d0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2891da[_0xb3d0('0x70')]=_0x432dfc[_0xb3d0('0x70')];_0x2891da['count']=_0x432dfc['count'];_[_0xb3d0('0x71')](_0x2891da,_[_0xb3d0('0x72')](_0x432dfc,_[_0xb3d0('0x73')](_0x2891da)));this[_0xb3d0('0x11')][_0x432dfc[_0xb3d0('0x6e')]][_0xb3d0('0x74')](_0x2891da);this['channels'][_0x432dfc['uniqueid']]=_0x2891da;this[_0xb3d0('0x75')](_0x2891da);}}catch(_0x38f4f4){logger[_0xb3d0('0x3f')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xb3d0('0x43')](_0x38f4f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb3d0('0x1f')]=function(_0x1349c4){try{if(this[_0xb3d0('0x5b')](_0x1349c4)){if(this[_0xb3d0('0x11')][_0x1349c4[_0xb3d0('0x6e')]]){var _0x26176b=_[_0xb3d0('0x76')](this['queueReports'][_0x1349c4[_0xb3d0('0x6e')]]);_0x26176b['queuecallercomplete']=![];_0x26176b['queuecallercompleteAt']=null;_0x26176b[_0xb3d0('0x77')]=_0x1349c4[_0xb3d0('0x77')];_0x26176b['originalposition']=_0x1349c4[_0xb3d0('0x78')];_0x26176b[_0xb3d0('0x1e')]=!![];_0x26176b['queuecallerabandonAt']=moment()[_0xb3d0('0x45')](_0xb3d0('0x79'));_0x26176b['queuecallerexitreason']=_0xb3d0('0x7a');_0x26176b['lastAssignedTo']=null;this[_0xb3d0('0x13')][_0x1349c4['uniqueid']]=_0x26176b;this[_0xb3d0('0x42')](_0x26176b);}}}catch(_0x1859c1){logger[_0xb3d0('0x3f')](_0xb3d0('0x7b'),util[_0xb3d0('0x43')](_0x1859c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb3d0('0x21')]=function(_0x56fa22){try{if(this[_0xb3d0('0x5b')](_0x56fa22)){if(this[_0xb3d0('0x11')][_0x56fa22[_0xb3d0('0x6e')]]){var _0x5a941a=_['last'](this[_0xb3d0('0x11')][_0x56fa22[_0xb3d0('0x6e')]]);_0x5a941a[_0xb3d0('0x7c')]=moment()[_0xb3d0('0x45')](_0xb3d0('0x79'));_0x5a941a[_0xb3d0('0x7d')]=_0x56fa22[_0xb3d0('0x7d')];_0x5a941a[_0xb3d0('0x7e')]=_0x56fa22[_0xb3d0('0x7e')];this['channels'][_0x56fa22[_0xb3d0('0x6e')]]=_0x5a941a;this[_0xb3d0('0x75')](_0x5a941a);}}}catch(_0x4c711c){logger['error'](_0xb3d0('0x7f'),util['inspect'](_0x4c711c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb3d0('0x24')]=function(_0x1a9208){try{if(this[_0xb3d0('0x5b')](_0x1a9208)){if(this['queueReports'][_0x1a9208[_0xb3d0('0x6e')]]){var _0x204837=_[_0xb3d0('0x76')](this[_0xb3d0('0x11')][_0x1a9208[_0xb3d0('0x6e')]]);_0x204837[_0xb3d0('0x80')]=!![];_0x204837[_0xb3d0('0x81')]='COMPLETEDBYAGENT';}}}catch(_0x331fb9){logger[_0xb3d0('0x3f')]('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x331fb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb3d0('0x82')]=function(_0x478106){try{if(this[_0xb3d0('0x5b')](_0x478106)){if(this[_0xb3d0('0x11')][_0x478106[_0xb3d0('0x6e')]]){var _0x5c5bfb=_['last'](this[_0xb3d0('0x11')][_0x478106[_0xb3d0('0x6e')]]);_0x5c5bfb[_0xb3d0('0x1e')]=![];_0x5c5bfb[_0xb3d0('0x83')]=null;_0x5c5bfb['assigned']=!![];_0x5c5bfb[_0xb3d0('0x84')]=_0x478106[_0xb3d0('0x85')];_0x5c5bfb[_0xb3d0('0x77')]=_0x478106[_0xb3d0('0x77')];_0x5c5bfb[_0xb3d0('0x80')]=!![];_0x5c5bfb[_0xb3d0('0x86')]=![];_0x5c5bfb[_0xb3d0('0x87')]=null;if(!_0x5c5bfb[_0xb3d0('0x88')]){if(_0x478106[_0xb3d0('0x89')]=='transfer'){_0x5c5bfb['queuecallerexitreason']=_0xb3d0('0x8a');}else{if(_[_0xb3d0('0x8b')](_0x478106[_0xb3d0('0x3a')][_0xb3d0('0x8c')](),'local/')){if(this[_0xb3d0('0x11')][_0x478106['linkedid']]){var _0x51840e=_['last'](this[_0xb3d0('0x11')][_0x478106[_0xb3d0('0x8d')]]);_0x51840e[_0xb3d0('0x80')]=![];_0x51840e['queuecallerexit']=!![];_0x51840e[_0xb3d0('0x87')]=moment(_0x5c5bfb[_0xb3d0('0x6f')])[_0xb3d0('0x8e')](_0x478106['holdtime'],'seconds')['format'](_0xb3d0('0x79'));_0x51840e[_0xb3d0('0x81')]=_0xb3d0('0x8f');_0x51840e['transfer']=!![];_0x51840e[_0xb3d0('0x90')]=_0xb3d0('0x91');_0x51840e[_0xb3d0('0x92')]=_0x478106[_0xb3d0('0x93')];_0x51840e[_0xb3d0('0x94')]=_0x478106[_0xb3d0('0x6e')];var _0x2583b7=this['queueReports'][_0x478106[_0xb3d0('0x8d')]];this['queueReports'][_0x478106[_0xb3d0('0x8d')]]=this[_0xb3d0('0x11')][_0x478106[_0xb3d0('0x6e')]];this[_0xb3d0('0x11')][_0x478106['uniqueid']]=_0x2583b7;}}else{_0x5c5bfb[_0xb3d0('0x81')]='COMPLETEDBY'+_0x478106[_0xb3d0('0x89')][_0xb3d0('0x95')]();}}}this[_0xb3d0('0x13')][_0x478106[_0xb3d0('0x6e')]]=_0x5c5bfb;this[_0xb3d0('0x42')](_0x5c5bfb);}}}catch(_0x1d6f19){logger[_0xb3d0('0x3f')](_0xb3d0('0x96'),util[_0xb3d0('0x43')](_0x1d6f19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb3d0('0xd')]['syncVarSet']=function(_0x179d18){try{if(this[_0xb3d0('0x5b')](_0x179d18)){this[_0xb3d0('0x97')](_0x179d18[_0xb3d0('0x6e')],_['keys'](_0x179d18['variable'])[0x0],_0x179d18['value']);if(this['queueReports'][_0x179d18[_0xb3d0('0x6e')]]){var _0x2af88e=_['last'](this[_0xb3d0('0x11')][_0x179d18[_0xb3d0('0x6e')]]);if(_0x2af88e){if(this[_0xb3d0('0x5b')](_0x179d18[_0xb3d0('0x98')])&&this[_0xb3d0('0x5b')](_0x179d18[_0xb3d0('0x98')][_0xb3d0('0x99')])){switch(_0x179d18['value']){case'CONTINUE':_0x2af88e[_0xb3d0('0x86')]=![];_0x2af88e[_0xb3d0('0x87')]=null;break;case _0xb3d0('0x9a'):_0x2af88e['lastevent']=_0xb3d0('0x9b');ami[_0xb3d0('0x44')](_0xb3d0('0x9c'),_0x2af88e);break;default:_0x2af88e[_0xb3d0('0x86')]=!![];_0x2af88e[_0xb3d0('0x87')]=moment()[_0xb3d0('0x45')](_0xb3d0('0x79'));_0x2af88e[_0xb3d0('0x7c')]=moment()[_0xb3d0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2af88e[_0xb3d0('0x1e')]=![];_0x2af88e['queuecallerabandonAt']=null;_0x2af88e[_0xb3d0('0x81')]=_0x179d18['value'];this[_0xb3d0('0x13')][_0x179d18[_0xb3d0('0x6e')]]=_0x2af88e;this[_0xb3d0('0x42')](_0x2af88e);}else if(this[_0xb3d0('0x5b')](_0x179d18['variable'])&&this[_0xb3d0('0x5b')](_0x179d18[_0xb3d0('0x98')][_0xb3d0('0x9d')])){if(!_0x2af88e[_0xb3d0('0x1e')]){_0x2af88e[_0xb3d0('0x86')]=!![];_0x2af88e[_0xb3d0('0x87')]=moment()[_0xb3d0('0x45')](_0xb3d0('0x79'));_0x2af88e[_0xb3d0('0x81')]=_0xb3d0('0x9e');_0x2af88e[_0xb3d0('0x7c')]=moment()[_0xb3d0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb3d0('0x13')][_0x179d18['uniqueid']]=_0x2af88e;}}_0x2af88e[_0xb3d0('0x16')]=this[_0xb3d0('0x16')][_0x179d18['uniqueid']];}}}}catch(_0x3a070f){logger[_0xb3d0('0x3f')](_0xb3d0('0x9f'),util['inspect'](_0x3a070f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x97')]=function(_0x190226,_0x2a3d65,_0x24112e){var _0xb3f4e9=[_0xb3d0('0xa0'),_0xb3d0('0xa1'),_0xb3d0('0xa2'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xb3d0('0xa3'),_0xb3d0('0xa4'),_0xb3d0('0xa5'),_0xb3d0('0xa6'),_0xb3d0('0xa7'),_0xb3d0('0xa8'),_0xb3d0('0xa9'),_0xb3d0('0xaa'),_0xb3d0('0xab'),_0xb3d0('0xac'),_0xb3d0('0xad'),_0xb3d0('0x85'),_0xb3d0('0xae'),_0xb3d0('0xaf')];if(!_['isNil'](_0x2a3d65)&&!_[_0xb3d0('0xb0')](_0xb3f4e9,_0x2a3d65)){if(_[_0xb3d0('0x6d')](this[_0xb3d0('0x16')][_0x190226])){this[_0xb3d0('0x16')][_0x190226]={};}this['variables'][_0x190226][_0x2a3d65]=_0x24112e;}};VoiceQueueReport[_0xb3d0('0xd')][_0xb3d0('0x26')]=function(_0x377293){try{if(this[_0xb3d0('0x5b')](_0x377293)){if(this['queueReports'][_0x377293[_0xb3d0('0x6e')]]){for(var _0x1f7f35=0x0,_0x36d014={};_0x1f7f350x0?_0x513848:0x0;this[_0x0f5e('0x14')][_0x55ba96['queue']][_0x0f5e('0x2f')]=this[_0x0f5e('0x14')][_0x55ba96[_0x0f5e('0x5b')]][_0x0f5e('0x2f')]>_[_0x0f5e('0x5d')](_0x55ba96[_0x0f5e('0x5e')])?_[_0x0f5e('0x5d')](_0x55ba96['loggedin']):this[_0x0f5e('0x14')][_0x55ba96[_0x0f5e('0x5b')]][_0x0f5e('0x2f')];this['emitVoiceQueueSummary'](this[_0x0f5e('0x14')][_0x55ba96[_0x0f5e('0x5b')]]);}ami['emit'](_0x0f5e('0x60'),this[_0x0f5e('0x14')][_0x55ba96[_0x0f5e('0x5b')]]);}}}catch(_0x4cb2fe){logger[_0x0f5e('0x3b')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x4cb2fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')]['syncQueueSummaryComplete']=function(_0x31bdd8){this[_0x0f5e('0x15')]=!![];};VoiceQueueReport[_0x0f5e('0xd')][_0x0f5e('0x61')]=function(_0x366b23){};VoiceQueueReport['prototype'][_0x0f5e('0x1c')]=function(_0x2d7a6f){try{if(this[_0x0f5e('0x57')](_0x2d7a6f)){if(_[_0x0f5e('0x2b')](this['queueReports'][_0x2d7a6f[_0x0f5e('0x62')]])){this[_0x0f5e('0x11')][_0x2d7a6f[_0x0f5e('0x62')]]=[];this[_0x0f5e('0x13')][_0x2d7a6f[_0x0f5e('0x62')]]={};}var _0x1a8734=new QueueReport();_0x1a8734[_0x0f5e('0x44')]=_0x2d7a6f[_0x0f5e('0x5b')];_0x1a8734[_0x0f5e('0x49')]=this[_0x0f5e('0x14')][_0x1a8734[_0x0f5e('0x44')]]&&this[_0x0f5e('0x14')][_0x1a8734[_0x0f5e('0x44')]][_0x0f5e('0x49')]?this['voiceQueues'][_0x1a8734[_0x0f5e('0x44')]][_0x0f5e('0x49')]||'inbound':_0x0f5e('0x63');_0x1a8734[_0x0f5e('0x5b')]=_0x2d7a6f[_0x0f5e('0x5b')];_0x1a8734[_0x0f5e('0x64')]=moment()[_0x0f5e('0x43')](_0x0f5e('0x65'));_0x1a8734[_0x0f5e('0x66')]=_0x2d7a6f['position'];_0x1a8734['count']=_0x2d7a6f[_0x0f5e('0x67')];_[_0x0f5e('0x68')](_0x1a8734,_[_0x0f5e('0x69')](_0x2d7a6f,_[_0x0f5e('0x6a')](_0x1a8734)));this[_0x0f5e('0x11')][_0x2d7a6f[_0x0f5e('0x62')]][_0x0f5e('0x6b')](_0x1a8734);this[_0x0f5e('0x13')][_0x2d7a6f[_0x0f5e('0x62')]]=_0x1a8734;this['emitVoiceQueueChannelSave'](_0x1a8734);}}catch(_0x31a1ca){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x0f5e('0x40')](_0x31a1ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')][_0x0f5e('0x1e')]=function(_0x453f71){try{if(this[_0x0f5e('0x57')](_0x453f71)){if(this[_0x0f5e('0x11')][_0x453f71[_0x0f5e('0x62')]]){var _0x478b68=_[_0x0f5e('0x6c')](this[_0x0f5e('0x11')][_0x453f71[_0x0f5e('0x62')]]);_0x478b68[_0x0f5e('0x6d')]=![];_0x478b68[_0x0f5e('0x6e')]=null;_0x478b68[_0x0f5e('0x6f')]=_0x453f71['holdtime'];_0x478b68[_0x0f5e('0x70')]=_0x453f71[_0x0f5e('0x70')];_0x478b68['queuecallerabandon']=!![];_0x478b68[_0x0f5e('0x71')]=moment()[_0x0f5e('0x43')](_0x0f5e('0x65'));_0x478b68['queuecallerexitreason']=_0x0f5e('0x72');_0x478b68[_0x0f5e('0x73')]=null;this[_0x0f5e('0x13')][_0x453f71[_0x0f5e('0x62')]]=_0x478b68;this[_0x0f5e('0x3f')](_0x478b68);}}}catch(_0x466e0a){logger[_0x0f5e('0x3b')](_0x0f5e('0x74'),util[_0x0f5e('0x40')](_0x466e0a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')][_0x0f5e('0x75')]=function(_0x2a06dd){try{if(this['isNotNull'](_0x2a06dd)){if(this[_0x0f5e('0x11')][_0x2a06dd[_0x0f5e('0x62')]]){var _0x27f4fd=_[_0x0f5e('0x6c')](this['queueReports'][_0x2a06dd[_0x0f5e('0x62')]]);_0x27f4fd[_0x0f5e('0x76')]=moment()[_0x0f5e('0x43')](_0x0f5e('0x65'));_0x27f4fd['connectedlinenum']=_0x2a06dd[_0x0f5e('0x77')];_0x27f4fd[_0x0f5e('0x78')]=_0x2a06dd[_0x0f5e('0x78')];this[_0x0f5e('0x13')][_0x2a06dd['uniqueid']]=_0x27f4fd;this[_0x0f5e('0x42')](_0x27f4fd);}}}catch(_0x3efcb8){logger['error'](_0x0f5e('0x79'),util[_0x0f5e('0x40')](_0x3efcb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')]['syncAgentConnect']=function(_0x528b9b){try{if(this[_0x0f5e('0x57')](_0x528b9b)){if(this[_0x0f5e('0x11')][_0x528b9b[_0x0f5e('0x62')]]){var _0x48eb90=_[_0x0f5e('0x6c')](this[_0x0f5e('0x11')][_0x528b9b[_0x0f5e('0x62')]]);_0x48eb90[_0x0f5e('0x6d')]=!![];_0x48eb90[_0x0f5e('0x7a')]=_0x0f5e('0x7b');}}}catch(_0x5f3535){logger[_0x0f5e('0x3b')](_0x0f5e('0x7c'),util[_0x0f5e('0x40')](_0x5f3535,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0f5e('0x7d')]=function(_0x18b8c7){try{if(this[_0x0f5e('0x57')](_0x18b8c7)){if(this[_0x0f5e('0x11')][_0x18b8c7[_0x0f5e('0x62')]]){var _0x4e1f2a=_[_0x0f5e('0x6c')](this[_0x0f5e('0x11')][_0x18b8c7[_0x0f5e('0x62')]]);_0x4e1f2a['queuecallerabandon']=![];_0x4e1f2a['queuecallerabandonAt']=null;_0x4e1f2a['assigned']=!![];_0x4e1f2a['lastAssignedTo']=_0x18b8c7[_0x0f5e('0x7e')];_0x4e1f2a[_0x0f5e('0x6f')]=_0x18b8c7['holdtime'];_0x4e1f2a[_0x0f5e('0x6d')]=!![];_0x4e1f2a[_0x0f5e('0x7f')]=![];_0x4e1f2a[_0x0f5e('0x80')]=null;if(!_0x4e1f2a[_0x0f5e('0x81')]){if(_0x18b8c7[_0x0f5e('0x82')]==_0x0f5e('0x81')){_0x4e1f2a[_0x0f5e('0x7a')]='COMPLETED';}else{if(_[_0x0f5e('0x83')](_0x18b8c7[_0x0f5e('0x38')][_0x0f5e('0x84')](),_0x0f5e('0x85'))){if(this[_0x0f5e('0x11')][_0x18b8c7[_0x0f5e('0x86')]]){var _0x1d3984=_['last'](this[_0x0f5e('0x11')][_0x18b8c7[_0x0f5e('0x86')]]);_0x1d3984[_0x0f5e('0x6d')]=![];_0x1d3984[_0x0f5e('0x7f')]=!![];_0x1d3984[_0x0f5e('0x80')]=moment(_0x4e1f2a[_0x0f5e('0x64')])[_0x0f5e('0x87')](_0x18b8c7['holdtime'],_0x0f5e('0x88'))[_0x0f5e('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d3984['queuecallerexitreason']=_0x0f5e('0x89');_0x1d3984['transfer']=!![];_0x1d3984[_0x0f5e('0x8a')]=_0x0f5e('0x8b');_0x1d3984['transferexten']=_0x18b8c7[_0x0f5e('0x8c')];_0x1d3984[_0x0f5e('0x8d')]=_0x18b8c7[_0x0f5e('0x62')];var _0x13f649=this['queueReports'][_0x18b8c7[_0x0f5e('0x86')]];this[_0x0f5e('0x11')][_0x18b8c7[_0x0f5e('0x86')]]=this['queueReports'][_0x18b8c7[_0x0f5e('0x62')]];this[_0x0f5e('0x11')][_0x18b8c7['uniqueid']]=_0x13f649;}}else{_0x4e1f2a[_0x0f5e('0x7a')]=_0x0f5e('0x8e')+_0x18b8c7['reason'][_0x0f5e('0x8f')]();}}}this[_0x0f5e('0x13')][_0x18b8c7['uniqueid']]=_0x4e1f2a;this[_0x0f5e('0x3f')](_0x4e1f2a);}}}catch(_0x569389){logger[_0x0f5e('0x3b')](_0x0f5e('0x90'),util[_0x0f5e('0x40')](_0x569389,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')][_0x0f5e('0x23')]=function(_0x47ee93){try{if(this[_0x0f5e('0x57')](_0x47ee93)){this['addVariable'](_0x47ee93[_0x0f5e('0x62')],_['keys'](_0x47ee93[_0x0f5e('0x91')])[0x0],_0x47ee93[_0x0f5e('0x92')]);if(this[_0x0f5e('0x11')][_0x47ee93[_0x0f5e('0x62')]]){var _0xa7b5a3=_[_0x0f5e('0x6c')](this['queueReports'][_0x47ee93[_0x0f5e('0x62')]]);if(_0xa7b5a3){if(this[_0x0f5e('0x57')](_0x47ee93[_0x0f5e('0x91')])&&this[_0x0f5e('0x57')](_0x47ee93[_0x0f5e('0x91')][_0x0f5e('0x93')])){switch(_0x47ee93[_0x0f5e('0x92')]){case'CONTINUE':_0xa7b5a3['queuecallerexit']=![];_0xa7b5a3[_0x0f5e('0x80')]=null;break;case _0x0f5e('0x94'):_0xa7b5a3[_0x0f5e('0x95')]=_0x0f5e('0x96');ami['emit'](_0x0f5e('0x97'),_0xa7b5a3);break;default:_0xa7b5a3['queuecallerexit']=!![];_0xa7b5a3[_0x0f5e('0x80')]=moment()['format'](_0x0f5e('0x65'));_0xa7b5a3[_0x0f5e('0x76')]=moment()[_0x0f5e('0x43')](_0x0f5e('0x65'));}_0xa7b5a3[_0x0f5e('0x1d')]=![];_0xa7b5a3[_0x0f5e('0x71')]=null;_0xa7b5a3['queuecallerexitreason']=_0x47ee93[_0x0f5e('0x92')];this[_0x0f5e('0x13')][_0x47ee93[_0x0f5e('0x62')]]=_0xa7b5a3;this[_0x0f5e('0x3f')](_0xa7b5a3);}else if(this['isNotNull'](_0x47ee93['variable'])&&this[_0x0f5e('0x57')](_0x47ee93[_0x0f5e('0x91')]['queueposition'])){if(!_0xa7b5a3[_0x0f5e('0x1d')]){_0xa7b5a3[_0x0f5e('0x7f')]=!![];_0xa7b5a3[_0x0f5e('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xa7b5a3[_0x0f5e('0x7a')]='EXITWITHKEY';_0xa7b5a3[_0x0f5e('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0f5e('0x13')][_0x47ee93[_0x0f5e('0x62')]]=_0xa7b5a3;}}_0xa7b5a3[_0x0f5e('0x3d')]=this[_0x0f5e('0x3d')][_0x47ee93[_0x0f5e('0x62')]];}}}}catch(_0x3b409e){logger[_0x0f5e('0x3b')](_0x0f5e('0x98'),util[_0x0f5e('0x40')](_0x3b409e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f5e('0xd')][_0x0f5e('0x99')]=function(_0x7d245e,_0x14717a,_0x293d85){var _0x26c856=['rtpaudioqos',_0x0f5e('0x9a'),_0x0f5e('0x9b'),_0x0f5e('0x9c'),_0x0f5e('0x9d'),_0x0f5e('0x9e'),_0x0f5e('0x9f'),'rtpaudioqosrttbridged','sipcallid',_0x0f5e('0xa0'),_0x0f5e('0xa1'),'bridgepvtcallid',_0x0f5e('0xa2'),_0x0f5e('0xa3'),_0x0f5e('0xa4'),'memberlastcall',_0x0f5e('0x7e'),_0x0f5e('0xa5'),'memberrealtime'];if(!_[_0x0f5e('0x35')](_0x14717a)&&!_[_0x0f5e('0xa6')](_0x26c856,_0x14717a)){if(_[_0x0f5e('0x2b')](this[_0x0f5e('0x3d')][_0x7d245e])){this[_0x0f5e('0x3d')][_0x7d245e]={};}this[_0x0f5e('0x3d')][_0x7d245e][_0x14717a]=_0x293d85;}};VoiceQueueReport['prototype'][_0x0f5e('0x25')]=function(_0x5518){try{if(this['isNotNull'](_0x5518)){if(this['queueReports'][_0x5518[_0x0f5e('0x62')]]){for(var _0x1b5ee8=0x0,_0x2a7c31={};_0x1b5ee8=0x0?moment(_0x4dbf16['endtime'])['diff'](_0x4dbf16[_0x8a33('0x1a')],_0x8a33('0xb')):null,'data1':'outbound','data2':_0x4dbf16[_0x8a33('0x11')],'data3':_0x4dbf16[_0x8a33('0xe')],'data4':_0x4dbf16['dialstring']||null,'role':_0x8a33('0x10'),'internal':_0x4dbf16['accountcode']?_[_0x8a33('0x12')](_0x4dbf16[_0x8a33('0x11')]):undefined,'uniqueid':_0x4dbf16[_0x8a33('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xc82b=['TALKING','queuecallerleaveAt','diff','inbound','exten','queue','accountcode','toNumber','voiceDialReport','starttime','endtime','seconds','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','interface'];(function(_0x404cd1,_0x3346da){var _0x44351d=function(_0x2867db){while(--_0x2867db){_0x404cd1['push'](_0x404cd1['shift']());}};_0x44351d(++_0x3346da);}(_0xc82b,0x1b5));var _0xbc82=function(_0x2e7a35,_0x30dd10){_0x2e7a35=_0x2e7a35-0x0;var _0x14a276=_0xc82b[_0x2e7a35];return _0x14a276;};'use strict';var moment=require(_0xbc82('0x0'));var _=require(_0xbc82('0x1'));var util=require(_0xbc82('0x2'));var client=require(_0xbc82('0x3'));exports['voiceQueueReport']=function(_0x5213ea){var _0x41696a=_0x5213ea[_0xbc82('0x4')]||_0x5213ea[_0xbc82('0x5')];return client[_0xbc82('0x6')](_0xbc82('0x7'),{'body':{'channel':_0xbc82('0x8'),'membername':_0x5213ea[_0xbc82('0x9')],'interface':_[_0xbc82('0xa')](_0x5213ea['interface'])?util[_0xbc82('0xb')]('SIP/%s',_0x5213ea[_0xbc82('0x9')]):_0x5213ea[_0xbc82('0xc')],'type':_0xbc82('0xd'),'enterAt':_0x5213ea[_0xbc82('0xe')],'exitAt':_0x41696a,'duration':moment(_0x41696a)[_0xbc82('0xf')](_0x5213ea['queuecallerleaveAt'],'seconds'),'data1':_0xbc82('0x10'),'data2':_0x5213ea['calleridnum'],'data3':_0x5213ea[_0xbc82('0x11')],'data4':null,'data5':_0x5213ea[_0xbc82('0x12')],'role':'agent','internal':_0x5213ea[_0xbc82('0x13')]?_[_0xbc82('0x14')](_0x5213ea[_0xbc82('0x13')]):undefined,'uniqueid':_0x5213ea['uniqueid']},'log':_0xbc82('0x7')});};exports[_0xbc82('0x15')]=function(_0x438e8d){return client[_0xbc82('0x6')](_0xbc82('0x7'),{'body':{'channel':_0xbc82('0x8'),'membername':_0x438e8d['membername'],'interface':_0x438e8d[_0xbc82('0xc')],'type':_0xbc82('0xd'),'enterAt':_0x438e8d[_0xbc82('0x16')],'exitAt':_0x438e8d[_0xbc82('0x17')],'duration':moment(_0x438e8d[_0xbc82('0x17')])[_0xbc82('0xf')](_0x438e8d[_0xbc82('0x16')],_0xbc82('0x18'))>=0x0?moment(_0x438e8d[_0xbc82('0x17')])['diff'](_0x438e8d['starttime'],_0xbc82('0x18')):null,'data1':'outbound','data2':_0x438e8d[_0xbc82('0x13')],'data3':_0x438e8d[_0xbc82('0x11')],'data4':_0x438e8d['dialstring']||null,'role':'agent','internal':_0x438e8d[_0xbc82('0x13')]?_[_0xbc82('0x14')](_0x438e8d[_0xbc82('0x13')]):undefined,'uniqueid':_0x438e8d['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bb633f4..2f5c4b6 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 _0x00b3=['name','GetTemplate','getTemplates','Request'];(function(_0x2e3d39,_0x549ca2){var _0x2d9eb4=function(_0x2c95b5){while(--_0x2c95b5){_0x2e3d39['push'](_0x2e3d39['shift']());}};_0x2d9eb4(++_0x549ca2);}(_0x00b3,0x17a));var _0x300b=function(_0x495b57,_0x1549f5){_0x495b57=_0x495b57-0x0;var _0x16d903=_0x00b3[_0x495b57];return _0x16d903;};'use strict';var client=require('../client');exports[_0x300b('0x0')]=function(_0x173881){return function(_0x2b426a){return client[_0x300b('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x300b('0x2'),'html']},'log':_0x300b('0x3')});};}; \ No newline at end of file +var _0x8d05=['html','GetTemplate','../client','getTemplates','Request'];(function(_0x24037d,_0x24ec65){var _0x3ac9ba=function(_0x2bdc25){while(--_0x2bdc25){_0x24037d['push'](_0x24037d['shift']());}};_0x3ac9ba(++_0x24ec65);}(_0x8d05,0xe8));var _0x58d0=function(_0x142903,_0x3c119a){_0x142903=_0x142903-0x0;var _0x50cfeb=_0x8d05[_0x142903];return _0x50cfeb;};'use strict';var client=require(_0x58d0('0x0'));exports[_0x58d0('0x1')]=function(_0x163911){return function(_0x3a0a55){return client[_0x58d0('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x58d0('0x3')]},'log':_0x58d0('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b619971..ba7fa71 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 _0x30c6=['data1','data2','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','value','action'];(function(_0x2adb04,_0x4d4356){var _0x3c1bca=function(_0x5e3b88){while(--_0x5e3b88){_0x2adb04['push'](_0x2adb04['shift']());}};_0x3c1bca(++_0x4d4356);}(_0x30c6,0xf6));var _0x630c=function(_0x343f7c,_0x2e73fd){_0x343f7c=_0x343f7c-0x0;var _0x39d0b4=_0x30c6[_0x343f7c];return _0x39d0b4;};'use strict';var client=require('../client');exports[_0x630c('0x0')]=function(_0x54b5bf){return function(_0x2bb269){return client[_0x630c('0x1')](_0x630c('0x2'),{'options':{'raw':![],'attributes':['id',_0x630c('0x3'),'channel','status'],'include':[{'model':_0x630c('0x4'),'as':_0x630c('0x5'),'attributes':['id',_0x630c('0x6'),'operator','value']},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x630c('0x6'),_0x630c('0x7'),_0x630c('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x630c('0x9'),_0x630c('0xa'),_0x630c('0xb'),'data3',_0x630c('0xc'),_0x630c('0xd'),_0x630c('0xe'),_0x630c('0xf')]}]},'log':_0x630c('0x2')});};}; \ No newline at end of file +var _0xd7f4=['operator','value','AnyConditions','Actions','action','data1','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xd7f4,0x83));var _0x4d7f=function(_0x249000,_0x48a009){_0x249000=_0x249000-0x0;var _0xee9615=_0xd7f4[_0x249000];return _0xee9615;};'use strict';var client=require(_0x4d7f('0x0'));exports[_0x4d7f('0x1')]=function(_0x3637bc){return function(_0x567dce){return client['Request'](_0x4d7f('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d7f('0x3'),_0x4d7f('0x4'),_0x4d7f('0x5')],'include':[{'model':_0x4d7f('0x6'),'as':_0x4d7f('0x7'),'attributes':['id',_0x4d7f('0x8'),_0x4d7f('0x9'),_0x4d7f('0xa')]},{'model':_0x4d7f('0x6'),'as':_0x4d7f('0xb'),'attributes':['id',_0x4d7f('0x8'),_0x4d7f('0x9'),_0x4d7f('0xa')]},{'model':'Action','as':_0x4d7f('0xc'),'attributes':['id',_0x4d7f('0xd'),_0x4d7f('0xe'),_0x4d7f('0xf'),_0x4d7f('0x10'),_0x4d7f('0x11'),'data5',_0x4d7f('0x12'),_0x4d7f('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 75c16ee..6c2f990 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 _0xd9b9=['GetTrunk','getTrunks','name','registry'];(function(_0x87a8c7,_0x17f3e2){var _0x24b181=function(_0x31908e){while(--_0x31908e){_0x87a8c7['push'](_0x87a8c7['shift']());}};_0x24b181(++_0x17f3e2);}(_0xd9b9,0x85));var _0x9d9b=function(_0x3b883b,_0x5e0e2e){_0x3b883b=_0x3b883b-0x0;var _0x36ceb9=_0xd9b9[_0x3b883b];return _0x36ceb9;};'use strict';var client=require('../client');exports[_0x9d9b('0x0')]=function(_0xe60372){return function(_0xf1b04f){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9d9b('0x1'),_0x9d9b('0x2')]},'log':_0x9d9b('0x3')});};}; \ No newline at end of file +var _0xd6c7=['getTrunks','Request','GetTrunk','registry'];(function(_0x924086,_0x280766){var _0x252410=function(_0x35b77b){while(--_0x35b77b){_0x924086['push'](_0x924086['shift']());}};_0x252410(++_0x280766);}(_0xd6c7,0x64));var _0x7d6c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6c7[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x7d6c('0x0')]=function(_0x5d2e80){return function(_0x1f228e){return client[_0x7d6c('0x1')](_0x7d6c('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7d6c('0x3')]},'log':_0x7d6c('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 94f6322..77db26e 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 _0xe7d8=['lastPauseAt','voicePause','phone','interface','getTelephones','telephone','savePause','Request','PauseUser','UnpauseUser','getAgent','ShowUser','agent','../client','getAgents','GetUser','name','email','accountcode','fullname','online','lastLoginAt'];(function(_0x19903b,_0x3f6ef2){var _0x5a5eca=function(_0x350c16){while(--_0x350c16){_0x19903b['push'](_0x19903b['shift']());}};_0x5a5eca(++_0x3f6ef2);}(_0xe7d8,0x115));var _0x8e7d=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0xe7d8[_0x131585];return _0x1fcca2;};'use strict';var client=require(_0x8e7d('0x0'));exports[_0x8e7d('0x1')]=function(){return function(){return client['Request'](_0x8e7d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x8e7d('0x3'),_0x8e7d('0x4'),_0x8e7d('0x5'),_0x8e7d('0x6'),_0x8e7d('0x7'),_0x8e7d('0x8'),'pauseType',_0x8e7d('0x9'),_0x8e7d('0xa'),_0x8e7d('0xb'),'mobile',_0x8e7d('0xc')]},'log':_0x8e7d('0x1')});};};exports[_0x8e7d('0xd')]=function(){return function(){return client['Request'](_0x8e7d('0x2'),{'options':{'raw':!![],'where':{'role':_0x8e7d('0xe')},'attributes':['id',_0x8e7d('0x3'),_0x8e7d('0x5'),'internal']},'log':'getTelephones'});};};exports[_0x8e7d('0xf')]=function(_0x408406,_0x163499,_0x4bc721){return client[_0x8e7d('0x10')](_0x8e7d('0x11'),{'body':{'type':_0x163499,'uniqueid':_0x4bc721},'options':{'where':{'id':_0x408406['id']}},'log':_0x8e7d('0xf')});};exports['saveUnpause']=function(_0x4749da){return client['Request'](_0x8e7d('0x12'),{'body':{},'options':{'where':{'id':_0x4749da['id']}},'log':_0x8e7d('0xf')});};exports[_0x8e7d('0x13')]=function(_0x44c69e){return client['Request'](_0x8e7d('0x14'),{'options':{'raw':![],'where':{'role':_0x8e7d('0x15'),'id':_0x44c69e},'attributes':['id',_0x8e7d('0x3'),'email',_0x8e7d('0x5'),'fullname','online','lastLoginAt','pauseType',_0x8e7d('0x9'),_0x8e7d('0xa'),_0x8e7d('0xc')]},'log':_0x8e7d('0x13')});}; \ No newline at end of file +var _0xde2b=['voicePause','mobile','interface','getTelephones','GetUser','telephone','name','internal','savePause','PauseUser','getAgent','ShowUser','accountcode','pauseType','../client','getAgents','Request','agent','email','fullname','online','lastLoginAt','lastPauseAt'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xde2b,0x150));var _0xbde2=function(_0xb42b87,_0x3048a8){_0xb42b87=_0xb42b87-0x0;var _0x26e871=_0xde2b[_0xb42b87];return _0x26e871;};'use strict';var client=require(_0xbde2('0x0'));exports[_0xbde2('0x1')]=function(){return function(){return client[_0xbde2('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0xbde2('0x3')},'attributes':['id','name',_0xbde2('0x4'),'accountcode',_0xbde2('0x5'),_0xbde2('0x6'),_0xbde2('0x7'),'pauseType',_0xbde2('0x8'),_0xbde2('0x9'),'phone',_0xbde2('0xa'),_0xbde2('0xb')]},'log':_0xbde2('0x1')});};};exports[_0xbde2('0xc')]=function(){return function(){return client['Request'](_0xbde2('0xd'),{'options':{'raw':!![],'where':{'role':_0xbde2('0xe')},'attributes':['id',_0xbde2('0xf'),'accountcode',_0xbde2('0x10')]},'log':'getTelephones'});};};exports[_0xbde2('0x11')]=function(_0x433873,_0x21c8cf,_0x1473e6){return client['Request'](_0xbde2('0x12'),{'body':{'type':_0x21c8cf,'uniqueid':_0x1473e6},'options':{'where':{'id':_0x433873['id']}},'log':_0xbde2('0x11')});};exports['saveUnpause']=function(_0x613ab9){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x613ab9['id']}},'log':_0xbde2('0x11')});};exports[_0xbde2('0x13')]=function(_0x1b3c90){return client[_0xbde2('0x2')](_0xbde2('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x1b3c90},'attributes':['id',_0xbde2('0xf'),'email',_0xbde2('0x15'),_0xbde2('0x5'),_0xbde2('0x6'),'lastLoginAt',_0xbde2('0x16'),_0xbde2('0x8'),'voicePause',_0xbde2('0xb')]},'log':_0xbde2('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6a30aca..bea88f2 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 _0xff2e=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x3d96af,_0xf5148d){var _0x2a1676=function(_0x2a7a60){while(--_0x2a7a60){_0x3d96af['push'](_0x3d96af['shift']());}};_0x2a1676(++_0xf5148d);}(_0xff2e,0x198));var _0xeff2=function(_0x210d8b,_0x2d861c){_0x210d8b=_0x210d8b-0x0;var _0x3a6d7f=_0xff2e[_0x210d8b];return _0x3a6d7f;};'use strict';var client=require('../client');exports['create']=function(_0x46935f){return client['Request']('CreateVoiceAgentReport',{'body':_0x46935f,'log':_0xeff2('0x0')});};exports[_0xeff2('0x1')]=function(_0x4da4e5,_0x53c7c7,_0x4b727e){return client[_0xeff2('0x2')](_0xeff2('0x3'),{'body':_0x4da4e5,'options':{'where':{'uniqueid':_0x53c7c7,'interface':_0x4b727e,'agentcomplete':!![]}},'log':_0xeff2('0x3')});}; \ No newline at end of file +var _0x70c2=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0xc7923d,_0x193a83){var _0x105058=function(_0x474cbd){while(--_0x474cbd){_0xc7923d['push'](_0xc7923d['shift']());}};_0x105058(++_0x193a83);}(_0x70c2,0xb8));var _0x270c=function(_0x3017d3,_0x2629a5){_0x3017d3=_0x3017d3-0x0;var _0x54d39a=_0x70c2[_0x3017d3];return _0x54d39a;};'use strict';var client=require(_0x270c('0x0'));exports['create']=function(_0x4eb0fc){return client[_0x270c('0x1')](_0x270c('0x2'),{'body':_0x4eb0fc,'log':_0x270c('0x2')});};exports[_0x270c('0x3')]=function(_0x27a9c2,_0x576e4d,_0xd1e8b2){return client[_0x270c('0x1')](_0x270c('0x4'),{'body':_0x27a9c2,'options':{'where':{'uniqueid':_0x576e4d,'interface':_0xd1e8b2,'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 c299012..dc1ec30 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 _0x38a0=['lodash','../client','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x5695aa,_0x5a0b67){var _0x48cd20=function(_0x4e6d7f){while(--_0x4e6d7f){_0x5695aa['push'](_0x5695aa['shift']());}};_0x48cd20(++_0x5a0b67);}(_0x38a0,0x11e));var _0x038a=function(_0x49b461,_0x5a3eb7){_0x49b461=_0x49b461-0x0;var _0x281fb9=_0x38a0[_0x49b461];return _0x281fb9;};'use strict';var moment=require(_0x038a('0x0'));var util=require(_0x038a('0x1'));var _=require(_0x038a('0x2'));var client=require(_0x038a('0x3'));exports['create']=function(_0x1f394e){return client[_0x038a('0x4')](_0x038a('0x5'),{'body':_['merge'](_0x1f394e,{'source':_0x1f394e[_0x038a('0x6')],'destinationcontext':_0x1f394e[_0x038a('0x7')],'callerid':_0x1f394e['callerid'],'amaflags':_0x038a('0x8')}),'log':_0x038a('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x038a('0x4')](_0x038a('0x9'),{'options':{'where':{'type':[_0x038a('0xa')],'createdAt':{'$between':[moment()[_0x038a('0xb')]('day')[_0x038a('0xc')](_0x038a('0xd')),moment()[_0x038a('0xe')]('day')[_0x038a('0xc')](_0x038a('0xd'))]}},'attributes':[_0x038a('0xf'),'disposition','duration',_0x038a('0x10')]},'log':_0x038a('0x11')});};}; \ No newline at end of file +var _0xdd96=['duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type'];(function(_0x78699f,_0x9b5e13){var _0x26bfc7=function(_0x2fbc27){while(--_0x2fbc27){_0x78699f['push'](_0x78699f['shift']());}};_0x26bfc7(++_0x9b5e13);}(_0xdd96,0x1e7));var _0x6dd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd96[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x6dd9('0x0'));var util=require(_0x6dd9('0x1'));var _=require(_0x6dd9('0x2'));var client=require(_0x6dd9('0x3'));exports[_0x6dd9('0x4')]=function(_0x4b7467){return client[_0x6dd9('0x5')](_0x6dd9('0x6'),{'body':_['merge'](_0x4b7467,{'source':_0x4b7467['calleridnum'],'destinationcontext':_0x4b7467[_0x6dd9('0x7')],'callerid':_0x4b7467[_0x6dd9('0x8')],'amaflags':_0x6dd9('0x9')}),'log':_0x6dd9('0x6')});};exports[_0x6dd9('0xa')]=function(){return function(){return client[_0x6dd9('0x5')](_0x6dd9('0xb'),{'options':{'where':{'type':[_0x6dd9('0xc')],'createdAt':{'$between':[moment()[_0x6dd9('0xd')](_0x6dd9('0xe'))['format'](_0x6dd9('0xf')),moment()[_0x6dd9('0x10')]('day')[_0x6dd9('0x11')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x6dd9('0x12'),'disposition',_0x6dd9('0x13'),_0x6dd9('0x14')]},'log':_0x6dd9('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c60edb4..3983cb0 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 _0xe994=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4623f2,_0x2f47fd){var _0x24eaad=function(_0x3413db){while(--_0x3413db){_0x4623f2['push'](_0x4623f2['shift']());}};_0x24eaad(++_0x2f47fd);}(_0xe994,0x185));var _0x4e99=function(_0x34951f,_0x277327){_0x34951f=_0x34951f-0x0;var _0x487db1=_0xe994[_0x34951f];return _0x487db1;};'use strict';var client=require(_0x4e99('0x0'));exports[_0x4e99('0x1')]=function(_0x3c76e8){return client[_0x4e99('0x2')](_0x4e99('0x3'),{'body':_0x3c76e8,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x00dc=['Request','CreateVoiceDialReport','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x00dc,0x1a0));var _0xc00d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00dc[_0x1facfa];return _0x9ec701;};'use strict';var client=require('../client');exports[_0xc00d('0x0')]=function(_0x2213e3){return client[_0xc00d('0x1')](_0xc00d('0x2'),{'body':_0x2213e3,'log':_0xc00d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c40c38d..1d3c34e 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 _0xae88=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x137da3,_0xa6277a){var _0x1ac46c=function(_0x49e68b){while(--_0x49e68b){_0x137da3['push'](_0x137da3['shift']());}};_0x1ac46c(++_0xa6277a);}(_0xae88,0xa1));var _0x8ae8=function(_0x5c7833,_0xe8625b){_0x5c7833=_0x5c7833-0x0;var _0xe8414e=_0xae88[_0x5c7833];return _0xe8414e;};'use strict';var client=require(_0x8ae8('0x0'));exports[_0x8ae8('0x1')]=function(){return function(){return client[_0x8ae8('0x2')](_0x8ae8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8ae8('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x8ae8('0x1')});};}; \ No newline at end of file +var _0x1abc=['Request','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x2e890c,_0x5e44ac){var _0x58a8ec=function(_0x4fcb27){while(--_0x4fcb27){_0x2e890c['push'](_0x2e890c['shift']());}};_0x58a8ec(++_0x5e44ac);}(_0x1abc,0x107));var _0xc1ab=function(_0x37ea17,_0x58c122){_0x37ea17=_0x37ea17-0x0;var _0x4c6387=_0x1abc[_0x37ea17];return _0x4c6387;};'use strict';var client=require(_0xc1ab('0x0'));exports[_0xc1ab('0x1')]=function(){return function(){return client[_0xc1ab('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xc1ab('0x3'),_0xc1ab('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index aa68afa..785ffad 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 _0xb77d=['active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xb77d,0x12d));var _0xdb77=function(_0x21bcd6,_0x31ef4f){_0x21bcd6=_0x21bcd6-0x0;var _0x5077d5=_0xb77d[_0x21bcd6];return _0x5077d5;};'use strict';var client=require(_0xdb77('0x0'));exports[_0xdb77('0x1')]=function(){return function(){return client[_0xdb77('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xdb77('0x3'),_0xdb77('0x4'),_0xdb77('0x5'),_0xdb77('0x6'),_0xdb77('0x7'),_0xdb77('0x8'),_0xdb77('0x9'),'dialMethod',_0xdb77('0xa'),_0xdb77('0xb'),'dialPowerLevel','dialPredictiveOptimization',_0xdb77('0xc'),_0xdb77('0xd'),_0xdb77('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0xdb77('0xf'),_0xdb77('0x10'),_0xdb77('0x11'),_0xdb77('0x12'),'dialBusyRetryFrequency',_0xdb77('0x13'),_0xdb77('0x14'),'dialGlobalMaxRetry',_0xdb77('0x15'),_0xdb77('0x16'),'dialPrefix',_0xdb77('0x17'),_0xdb77('0x18'),_0xdb77('0x19'),_0xdb77('0x1a'),_0xdb77('0x1b'),_0xdb77('0x1c'),_0xdb77('0x1d'),_0xdb77('0x1e'),_0xdb77('0x1f'),'dialAMDSilenceThreshold',_0xdb77('0x20'),_0xdb77('0x21'),'dialRecallMeTimeout',_0xdb77('0x22'),_0xdb77('0x23'),_0xdb77('0x24'),_0xdb77('0x25'),_0xdb77('0x26'),_0xdb77('0x7'),_0xdb77('0x27'),'dialRandomLastDigitCallerIdNumber',_0xdb77('0x28'),'dialNoSuchNumberMaxRetry',_0xdb77('0x29'),_0xdb77('0x2a'),_0xdb77('0x2b'),_0xdb77('0x2c'),_0xdb77('0x2d'),_0xdb77('0x2e'),'dialMachineRetryFrequency',_0xdb77('0x2f'),'dialAgentRejectRetryFrequency',_0xdb77('0x30'),_0xdb77('0x31'),_0xdb77('0x32')],'include':[{'model':'Trunk','as':_0xdb77('0x33'),'attributes':['id',_0xdb77('0x3'),_0xdb77('0x34'),_0xdb77('0x35')]},{'model':'Pause','as':_0xdb77('0x36'),'attributes':['id',_0xdb77('0x3')]},{'model':'Trunk','as':_0xdb77('0x37'),'attributes':['id',_0xdb77('0x3'),_0xdb77('0x34'),'active']},{'model':'Interval','as':_0xdb77('0x38'),'attributes':['id',_0xdb77('0x3')],'include':[{'model':_0xdb77('0x38'),'as':_0xdb77('0x39'),'attributes':['id',_0xdb77('0x3'),_0xdb77('0x3a')]}]}]},'log':_0xdb77('0x1')});};}; \ No newline at end of file +var _0xad40=['dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x2aa1cb,_0x4f2395){var _0x3cd621=function(_0x3e6b4a){while(--_0x3e6b4a){_0x2aa1cb['push'](_0x2aa1cb['shift']());}};_0x3cd621(++_0x4f2395);}(_0xad40,0x14b));var _0x0ad4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xad40[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x0ad4('0x0'));exports[_0x0ad4('0x1')]=function(){return function(){return client[_0x0ad4('0x2')](_0x0ad4('0x3'),{'options':{'raw':![],'attributes':['id',_0x0ad4('0x4'),_0x0ad4('0x5'),_0x0ad4('0x6'),_0x0ad4('0x7'),_0x0ad4('0x8'),_0x0ad4('0x9'),_0x0ad4('0xa'),_0x0ad4('0xb'),_0x0ad4('0xc'),'dialLimitQueue',_0x0ad4('0xd'),_0x0ad4('0xe'),_0x0ad4('0xf'),'dialPredictiveInterval',_0x0ad4('0x10'),_0x0ad4('0x11'),_0x0ad4('0x12'),_0x0ad4('0x13'),_0x0ad4('0x14'),_0x0ad4('0x15'),'dialCongestionMaxRetry',_0x0ad4('0x16'),_0x0ad4('0x17'),'dialBusyRetryFrequency',_0x0ad4('0x18'),_0x0ad4('0x19'),'dialGlobalMaxRetry','dialTimezone',_0x0ad4('0x1a'),_0x0ad4('0x1b'),_0x0ad4('0x1c'),_0x0ad4('0x1d'),'dialAMDInitialSilence',_0x0ad4('0x1e'),_0x0ad4('0x1f'),_0x0ad4('0x20'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x0ad4('0x21'),_0x0ad4('0x22'),_0x0ad4('0x23'),_0x0ad4('0x24'),'dialRecallMeTimeout',_0x0ad4('0x25'),_0x0ad4('0x26'),_0x0ad4('0x27'),_0x0ad4('0x28'),_0x0ad4('0x29'),_0x0ad4('0x8'),_0x0ad4('0x2a'),_0x0ad4('0x2b'),_0x0ad4('0x2c'),_0x0ad4('0x2d'),'dialNoSuchNumberRetryFrequency',_0x0ad4('0x2e'),_0x0ad4('0x2f'),_0x0ad4('0x30'),_0x0ad4('0x31'),_0x0ad4('0x32'),_0x0ad4('0x33'),_0x0ad4('0x34'),_0x0ad4('0x35'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x0ad4('0x36')],'include':[{'model':_0x0ad4('0x37'),'as':'Trunk','attributes':['id',_0x0ad4('0x4'),_0x0ad4('0x38'),_0x0ad4('0x39')]},{'model':_0x0ad4('0x3a'),'as':_0x0ad4('0x3b'),'attributes':['id','name']},{'model':_0x0ad4('0x37'),'as':_0x0ad4('0x3c'),'attributes':['id',_0x0ad4('0x4'),'callerid',_0x0ad4('0x39')]},{'model':_0x0ad4('0x3d'),'as':_0x0ad4('0x3d'),'attributes':['id','name'],'include':[{'model':_0x0ad4('0x3d'),'as':_0x0ad4('0x3e'),'attributes':['id',_0x0ad4('0x4'),_0x0ad4('0x3f')]}]}]},'log':_0x0ad4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 9a9b78a..0f0e790 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 _0xc30f=['create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client'];(function(_0x4bc479,_0x50aec4){var _0x4dedbe=function(_0x471314){while(--_0x471314){_0x4bc479['push'](_0x4bc479['shift']());}};_0x4dedbe(++_0x50aec4);}(_0xc30f,0x1a1));var _0xfc30=function(_0x1920ec,_0x4d5de1){_0x1920ec=_0x1920ec-0x0;var _0x3c6d1d=_0xc30f[_0x1920ec];return _0x3c6d1d;};'use strict';var moment=require(_0xfc30('0x0'));var _=require(_0xfc30('0x1'));var client=require(_0xfc30('0x2'));exports[_0xfc30('0x3')]=function(_0x4d5137){return client[_0xfc30('0x4')]('CreateVoiceQueueReport',{'body':_0x4d5137,'log':_0xfc30('0x5')});};exports[_0xfc30('0x6')]=function(){return function(){return client['Request'](_0xfc30('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')['format'](_0xfc30('0x8')),moment()[_0xfc30('0x9')](_0xfc30('0xa'))[_0xfc30('0xb')](_0xfc30('0x8'))]}},'attributes':[_0xfc30('0xc'),_0xfc30('0xd'),_0xfc30('0xe'),_0xfc30('0xf'),_0xfc30('0x10'),_0xfc30('0x11'),'queuecallerexit','queuecallerexitAt',_0xfc30('0x12'),_0xfc30('0x13')]},'log':_0xfc30('0x14')});};}; \ No newline at end of file +var _0x0f0c=['queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue','queuecallercomplete','queuecallercompleteAt'];(function(_0x174e28,_0x2204a0){var _0x5d5d48=function(_0x5e8a14){while(--_0x5e8a14){_0x174e28['push'](_0x174e28['shift']());}};_0x5d5d48(++_0x2204a0);}(_0x0f0c,0x1d8));var _0xc0f0=function(_0x2605e7,_0x236140){_0x2605e7=_0x2605e7-0x0;var _0x1982c3=_0x0f0c[_0x2605e7];return _0x1982c3;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0xc0f0('0x0'));exports['create']=function(_0x4ebebb){return client[_0xc0f0('0x1')]('CreateVoiceQueueReport',{'body':_0x4ebebb,'log':_0xc0f0('0x2')});};exports[_0xc0f0('0x3')]=function(){return function(){return client[_0xc0f0('0x1')](_0xc0f0('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xc0f0('0x5')]('day')[_0xc0f0('0x6')](_0xc0f0('0x7')),moment()[_0xc0f0('0x8')](_0xc0f0('0x9'))[_0xc0f0('0x6')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xc0f0('0xa'),_0xc0f0('0xb'),'queuecallerjoinAt','queuecallerleaveAt',_0xc0f0('0xc'),_0xc0f0('0xd'),_0xc0f0('0xe'),_0xc0f0('0xf'),'queuecallerabandon',_0xc0f0('0x10')]},'log':_0xc0f0('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 47ba171..79c9bb0 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 _0xb7b4=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0xbc7e18,_0x286cbb){var _0x3b9814=function(_0x160f11){while(--_0x160f11){_0xbc7e18['push'](_0xbc7e18['shift']());}};_0x3b9814(++_0x286cbb);}(_0xb7b4,0x19b));var _0x4b7b=function(_0x2f4727,_0x2bce9a){_0x2f4727=_0x2f4727-0x0;var _0x14faf5=_0xb7b4[_0x2f4727];return _0x14faf5;};'use strict';var client=require(_0x4b7b('0x0'));exports[_0x4b7b('0x1')]=function(_0x3b7b0){return function(){return client[_0x4b7b('0x2')](_0x4b7b('0x3'),{'options':{'where':{'VoiceQueueId':_0x3b7b0,'paused':!![]},'raw':!![]},'log':_0x4b7b('0x1')});};}; \ No newline at end of file +var _0xfff6=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x36eec6,_0x281738){var _0x59b716=function(_0x2385ca){while(--_0x2385ca){_0x36eec6['push'](_0x36eec6['shift']());}};_0x59b716(++_0x281738);}(_0xfff6,0x1a5));var _0x6fff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfff6[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x6fff('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4c3c7a){return function(){return client[_0x6fff('0x1')](_0x6fff('0x2'),{'options':{'where':{'VoiceQueueId':_0x4c3c7a,'paused':!![]},'raw':!![]},'log':_0x6fff('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 2220246..6f8a89d 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 _0xf1ee=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','Request'];(function(_0x2118f2,_0x294cfa){var _0x4769df=function(_0x220f09){while(--_0x220f09){_0x2118f2['push'](_0x2118f2['shift']());}};_0x4769df(++_0x294cfa);}(_0xf1ee,0x1cb));var _0xef1e=function(_0x4d7393,_0x2589fc){_0x4d7393=_0x4d7393-0x0;var _0x503422=_0xf1ee[_0x4d7393];return _0x503422;};'use strict';var _=require(_0xef1e('0x0'));var client=require(_0xef1e('0x1'));exports['create']=function(_0x4b550d){return client[_0xef1e('0x2')](_0xef1e('0x3'),{'body':_[_0xef1e('0x4')](_0x4b550d,{'value':_0x4b550d[_0xef1e('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xe42f=['monitorFilename','CreateVoiceRecording','lodash','../client','create','Request'];(function(_0x348fec,_0x486f87){var _0x5914c7=function(_0xed01d5){while(--_0xed01d5){_0x348fec['push'](_0x348fec['shift']());}};_0x5914c7(++_0x486f87);}(_0xe42f,0x19a));var _0xfe42=function(_0x45e7e7,_0x10e163){_0x45e7e7=_0x45e7e7-0x0;var _0x5ed7e6=_0xe42f[_0x45e7e7];return _0x5ed7e6;};'use strict';var _=require(_0xfe42('0x0'));var client=require(_0xfe42('0x1'));exports[_0xfe42('0x2')]=function(_0x353588){return client[_0xfe42('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x353588,{'value':_0x353588[_0xfe42('0x4')]}),'log':_0xfe42('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5675303..01a7a3a 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 _0xe580=['transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridname'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe580,0x137));var _0x0e58=function(_0x3cd3e2,_0x51eb04){_0x3cd3e2=_0x3cd3e2-0x0;var _0xb55fc8=_0xe580[_0x3cd3e2];return _0xb55fc8;};'use strict';var client=require(_0x0e58('0x0'));exports['blindTransfer']=function(_0x3bdaf9){return client[_0x0e58('0x1')](_0x0e58('0x2'),{'body':{'result':_0x3bdaf9[_0x0e58('0x3')],'transfererchannel':_0x3bdaf9[_0x0e58('0x4')],'transferercalleridnum':_0x3bdaf9[_0x0e58('0x5')],'transferercalleridname':_0x3bdaf9[_0x0e58('0x6')],'transfererconnectedlinenum':_0x3bdaf9[_0x0e58('0x7')],'transfererconnectedlinename':_0x3bdaf9[_0x0e58('0x8')],'transfereraccountcode':_0x3bdaf9[_0x0e58('0x9')],'transferercontext':_0x3bdaf9[_0x0e58('0xa')],'transfererexten':_0x3bdaf9['transfererexten'],'transfererlinkedid':_0x3bdaf9['transfererlinkedid'],'transfereechannel':_0x3bdaf9[_0x0e58('0xb')],'transfereecalleridnum':_0x3bdaf9['transfereecalleridnum'],'transfereecalleridname':_0x3bdaf9[_0x0e58('0xc')],'transfereeconnectedlinenum':_0x3bdaf9['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3bdaf9[_0x0e58('0xd')],'transfereeaccountcode':_0x3bdaf9[_0x0e58('0xe')],'transfereecontext':_0x3bdaf9[_0x0e58('0xf')],'transfereeexten':_0x3bdaf9['transfereeexten'],'transfereelinkedid':_0x3bdaf9[_0x0e58('0x10')],'isexternal':_0x3bdaf9[_0x0e58('0x11')],'context':_0x3bdaf9[_0x0e58('0x12')],'extension':_0x3bdaf9['extension'],'type':_0x0e58('0x13')},'log':_0x0e58('0x2')});};exports[_0x0e58('0x14')]=function(_0x474ed7){return client[_0x0e58('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x474ed7[_0x0e58('0x3')],'transfererchannel':_0x474ed7['origtransfererchannel'],'transferercalleridnum':_0x474ed7[_0x0e58('0x15')],'transferercalleridname':_0x474ed7[_0x0e58('0x16')],'transfererconnectedlinenum':_0x474ed7[_0x0e58('0x17')],'transfererconnectedlinename':_0x474ed7[_0x0e58('0x18')],'transfereraccountcode':_0x474ed7[_0x0e58('0x19')],'transferercontext':_0x474ed7['secondtransferercontext'],'transfererexten':_0x474ed7[_0x0e58('0x1a')],'transfererlinkedid':_0x474ed7['origtransfererlinkedid'],'transfereechannel':_0x474ed7[_0x0e58('0x1b')],'transfereecalleridnum':_0x474ed7[_0x0e58('0x1c')],'transfereecalleridname':_0x474ed7[_0x0e58('0x1d')],'transfereeconnectedlinenum':_0x474ed7[_0x0e58('0x1e')],'transfereeconnectedlinename':_0x474ed7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x474ed7[_0x0e58('0x1f')],'transfereecontext':_0x474ed7['transfertargetcontext'],'transfereeexten':_0x474ed7['transfertargetexten'],'transfereelinkedid':_0x474ed7[_0x0e58('0x20')],'isexternal':_0x474ed7[_0x0e58('0x11')],'context':_0x474ed7[_0x0e58('0x21')],'extension':_0x474ed7[_0x0e58('0x22')],'type':_0x0e58('0x23')},'log':_0x0e58('0x2')});}; \ No newline at end of file +var _0xa699=['transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0xa699,0x13c));var _0x9a69=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xa699[_0x6a0266];return _0x309e00;};'use strict';var client=require(_0x9a69('0x0'));exports[_0x9a69('0x1')]=function(_0x4c5ebe){return client[_0x9a69('0x2')](_0x9a69('0x3'),{'body':{'result':_0x4c5ebe[_0x9a69('0x4')],'transfererchannel':_0x4c5ebe[_0x9a69('0x5')],'transferercalleridnum':_0x4c5ebe[_0x9a69('0x6')],'transferercalleridname':_0x4c5ebe[_0x9a69('0x7')],'transfererconnectedlinenum':_0x4c5ebe[_0x9a69('0x8')],'transfererconnectedlinename':_0x4c5ebe[_0x9a69('0x9')],'transfereraccountcode':_0x4c5ebe[_0x9a69('0xa')],'transferercontext':_0x4c5ebe[_0x9a69('0xb')],'transfererexten':_0x4c5ebe[_0x9a69('0xc')],'transfererlinkedid':_0x4c5ebe[_0x9a69('0xd')],'transfereechannel':_0x4c5ebe[_0x9a69('0xe')],'transfereecalleridnum':_0x4c5ebe[_0x9a69('0xf')],'transfereecalleridname':_0x4c5ebe[_0x9a69('0x10')],'transfereeconnectedlinenum':_0x4c5ebe[_0x9a69('0x11')],'transfereeconnectedlinename':_0x4c5ebe[_0x9a69('0x12')],'transfereeaccountcode':_0x4c5ebe[_0x9a69('0x13')],'transfereecontext':_0x4c5ebe[_0x9a69('0x14')],'transfereeexten':_0x4c5ebe[_0x9a69('0x15')],'transfereelinkedid':_0x4c5ebe[_0x9a69('0x16')],'isexternal':_0x4c5ebe[_0x9a69('0x17')],'context':_0x4c5ebe[_0x9a69('0x18')],'extension':_0x4c5ebe[_0x9a69('0x19')],'type':_0x9a69('0x1a')},'log':_0x9a69('0x3')});};exports['attendedTransfer']=function(_0x534cbe){return client[_0x9a69('0x2')](_0x9a69('0x3'),{'body':{'result':_0x534cbe[_0x9a69('0x4')],'transfererchannel':_0x534cbe['origtransfererchannel'],'transferercalleridnum':_0x534cbe['origtransferercalleridnum'],'transferercalleridname':_0x534cbe[_0x9a69('0x1b')],'transfererconnectedlinenum':_0x534cbe[_0x9a69('0x1c')],'transfererconnectedlinename':_0x534cbe[_0x9a69('0x1d')],'transfereraccountcode':_0x534cbe[_0x9a69('0x1e')],'transferercontext':_0x534cbe[_0x9a69('0x1f')],'transfererexten':_0x534cbe[_0x9a69('0x20')],'transfererlinkedid':_0x534cbe[_0x9a69('0x21')],'transfereechannel':_0x534cbe[_0x9a69('0x22')],'transfereecalleridnum':_0x534cbe['transfertargetcalleridnum'],'transfereecalleridname':_0x534cbe[_0x9a69('0x23')],'transfereeconnectedlinenum':_0x534cbe['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x534cbe[_0x9a69('0x24')],'transfereeaccountcode':_0x534cbe[_0x9a69('0x25')],'transfereecontext':_0x534cbe['transfertargetcontext'],'transfereeexten':_0x534cbe['transfertargetexten'],'transfereelinkedid':_0x534cbe[_0x9a69('0x26')],'isexternal':_0x534cbe[_0x9a69('0x17')],'context':_0x534cbe[_0x9a69('0x27')],'extension':_0x534cbe[_0x9a69('0x28')],'type':_0x9a69('0x29')},'log':_0x9a69('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0599059..434f637 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 _0xe21f=['values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','action','Action','then','message','join','command','Command','voiceQueues','strategy','answered','available','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','channels','length','voicechannel','map','find','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','/var/spool/asterisk/monitor/'];(function(_0x430847,_0x30619a){var _0x24f607=function(_0x295e3f){while(--_0x295e3f){_0x430847['push'](_0x430847['shift']());}};_0x24f607(++_0x30619a);}(_0xe21f,0x11e));var _0xfe21=function(_0x141246,_0x25f8fc){_0x141246=_0x141246-0x0;var _0x41727e=_0xe21f[_0x141246];return _0x41727e;};'use strict';var _=require(_0xfe21('0x0'));var util=require(_0xfe21('0x1'));var jayson=require(_0xfe21('0x2'));var schema=require(_0xfe21('0x3'));var BPromise=require(_0xfe21('0x4'));var moment=require(_0xfe21('0x5'));var config=require(_0xfe21('0x6'));var properties=require('../properties');var ami=require(_0xfe21('0x7'));exports[_0xfe21('0x8')]=function(_0x47e6d4,_0x53be3b,_0x398fd2){return new BPromise(function(_0x359a05,_0x48435a){var _0x59c3ba={'QueuePause':function(_0x89abbe){return new Promise(function(_0x1174e7,_0x152191){var _0x3c2626=util[_0xfe21('0x9')](_0xfe21('0xa'),_0xfe21('0xb'),_0x89abbe[_0xfe21('0xc')]);if(_0x47e6d4[_0xfe21('0xd')]&&_0x47e6d4['timers'][_0x3c2626]&&_0x47e6d4[_0xfe21('0xd')][_0x3c2626][_0xfe21('0xe')]){_0x47e6d4[_0xfe21('0xd')][_0x3c2626][_0xfe21('0xf')]();}if(_0x47e6d4[_0xfe21('0x10')][_0x3c2626]){_0x47e6d4[_0xfe21('0x10')][_0x3c2626][_0xfe21('0x11')]({'statePause':_0x89abbe[_0xfe21('0x12')]?!![]:![]});}_0x1174e7({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x59e877){var _0x5b8756=this;return new Promise(function(_0x4c301d,_0x5c1ded){if(ami[_0xfe21('0x13')]()==![]){return _0x5c1ded(_0x5b8756[_0xfe21('0x14')](0x1f4,[config[_0xfe21('0x15')]['ip'],config['asterisk'][_0xfe21('0x16')],_0xfe21('0x17')]['join']('\x20')));}_0x59e877=_[_0xfe21('0x18')](_0x59e877,_[_0xfe21('0x19')](properties['module']));_0x59e877[_0xfe21('0x1a')]='Reload';return ami[_0xfe21('0x1b')](_0x59e877)[_0xfe21('0x1c')](function(_0x9da82c){_0x4c301d({'code':0xc8,'message':_0x9da82c[_0xfe21('0x1d')]});})['catch'](function(_0xc55c4b){_0x5c1ded(_0x5b8756[_0xfe21('0x14')](0x1f5,_0xc55c4b[_0xfe21('0x1d')]));});});},'Command':function(_0x12a158){var _0x4883a4=this;return new Promise(function(_0x2a3aa0,_0x435d0b){if(ami[_0xfe21('0x13')]()==![]){return _0x435d0b(_0x4883a4[_0xfe21('0x14')](0x1f4,[config[_0xfe21('0x15')]['ip'],config[_0xfe21('0x15')][_0xfe21('0x16')],_0xfe21('0x17')][_0xfe21('0x1e')]('\x20')));}_0x12a158=_['pick'](_0x12a158,_0xfe21('0x1f'));_0x12a158[_0xfe21('0x1a')]=_0xfe21('0x20');return ami[_0xfe21('0x1b')](_0x12a158)[_0xfe21('0x1c')](function(_0x219bae){_0x2a3aa0({'code':0xc8,'message':_0x219bae['content']});})['catch'](function(_0x4e7883){_0x435d0b(_0x4883a4['error'](0x1f5,_0x4e7883[_0xfe21('0x1d')]));});});},'VoiceQueues':function(_0x2bcf8b){return new Promise(function(_0x2511f0,_0xabcc10){var _0x350a84=[];for(var _0xb813e4 in _0x47e6d4[_0xfe21('0x21')]){if(_0x47e6d4[_0xfe21('0x21')]['hasOwnProperty'](_0xb813e4)){var _0x21704b=_0x47e6d4['voiceQueues'][_0xb813e4];var _0x571cdd={'id':_0x21704b['id'],'name':_0x21704b['name'],'strategy':_0x21704b[_0xfe21('0x22')],'answered':_0x21704b[_0xfe21('0x23')],'available':_0x21704b[_0xfe21('0x24')],'loggedIn':_0x21704b['loggedIn'],'pTalking':_0x21704b[_0xfe21('0x25')],'sumBillable':_0x21704b[_0xfe21('0x26')],'sumDuration':_0x21704b['sumDuration'],'sumHoldTime':_0x21704b[_0xfe21('0x27')]||0x0,'talking':_0x21704b['talking'],'total':_0x21704b[_0xfe21('0x28')],'type':_0x21704b[_0xfe21('0x29')],'unmanaged':_0x21704b[_0xfe21('0x2a')],'abandoned':_0x21704b[_0xfe21('0x2b')],'waiting':_0x21704b[_0xfe21('0x2c')],'loggedInDb':_0x21704b[_0xfe21('0x2d')]};if(_0x21704b[_0xfe21('0x29')]==='outbound'){_0x571cdd[_0xfe21('0x2e')]=_0x21704b[_0xfe21('0x2e')];_0x571cdd[_0xfe21('0x2f')]=_0x21704b[_0xfe21('0x2f')];_0x571cdd['dialOriginateCallerIdName']=_0x21704b[_0xfe21('0x30')];_0x571cdd['dialOriginateCallerIdNumber']=_0x21704b[_0xfe21('0x31')];_0x571cdd[_0xfe21('0x32')]=_0x21704b[_0xfe21('0x32')];_0x571cdd['dialPrefix']=_0x21704b[_0xfe21('0x33')];_0x571cdd['outboundAnswerAgiCallsDay']=_0x21704b[_0xfe21('0x34')];_0x571cdd[_0xfe21('0x35')]=_0x21704b[_0xfe21('0x35')];_0x571cdd['outboundBlacklistCallsDay']=_0x21704b[_0xfe21('0x36')];_0x571cdd[_0xfe21('0x37')]=_0x21704b[_0xfe21('0x37')];_0x571cdd['outboundCongestionCallsDay']=_0x21704b[_0xfe21('0x38')];_0x571cdd[_0xfe21('0x39')]=_0x21704b[_0xfe21('0x39')];_0x571cdd[_0xfe21('0x3a')]=_0x21704b[_0xfe21('0x3a')];_0x571cdd[_0xfe21('0x3b')]=_0x21704b['outboundDropCallsDayTimeout'];_0x571cdd[_0xfe21('0x3c')]=_0x21704b[_0xfe21('0x3c')];_0x571cdd[_0xfe21('0x3d')]=_0x21704b[_0xfe21('0x3d')];_0x571cdd[_0xfe21('0x3e')]=_0x21704b[_0xfe21('0x3e')];_0x571cdd['outboundReCallsDay']=_0x21704b['outboundReCallsDay'];_0x571cdd[_0xfe21('0x3f')]=_0x21704b['outboundRejectCallsDay'];_0x571cdd[_0xfe21('0x40')]=_0x21704b[_0xfe21('0x40')];_0x571cdd[_0xfe21('0x41')]=_0x21704b['predictiveIntervalAnsweredCalls'];_0x571cdd[_0xfe21('0x42')]=_0x21704b['predictiveIntervalAvgHoldtime'];_0x571cdd[_0xfe21('0x43')]=_0x21704b['predictiveIntervalAvgTalktime'];_0x571cdd['predictiveIntervalDroppedCallsCallersExit']=_0x21704b['predictiveIntervalDroppedCallsCallersExit'];_0x571cdd[_0xfe21('0x44')]=_0x21704b[_0xfe21('0x44')];_0x571cdd[_0xfe21('0x45')]=_0x21704b['predictiveIntervalErlangCalls'];_0x571cdd[_0xfe21('0x46')]=_0x21704b[_0xfe21('0x46')];_0x571cdd[_0xfe21('0x47')]=_0x21704b[_0xfe21('0x47')];_0x571cdd[_0xfe21('0x48')]=_0x21704b['predictiveIntervalMultiplicativeFactor'];_0x571cdd[_0xfe21('0x49')]=_0x21704b[_0xfe21('0x49')];_0x571cdd[_0xfe21('0x4a')]=_0x21704b[_0xfe21('0x4a')];_0x571cdd[_0xfe21('0x4b')]=_0x21704b[_0xfe21('0x4b')];_0x571cdd['message']=_0x21704b[_0xfe21('0x1d')];_0x571cdd[_0xfe21('0x4c')]=_0x21704b[_0xfe21('0x4c')];_0x571cdd['erlangCalls']=_0x21704b['erlangCalls'];_0x571cdd[_0xfe21('0x4d')]=_0x21704b['erlangCallToSecond'];_0x571cdd[_0xfe21('0x4e')]=_0x21704b['erlangAbandonmentRate'];_0x571cdd[_0xfe21('0x4f')]=_0x21704b[_0xfe21('0x4f')];_0x571cdd[_0xfe21('0x50')]=_0x21704b['startPredictive'];_0x571cdd[_0xfe21('0x51')]=_0x21704b[_0xfe21('0x51')];}if(_0x21704b['Trunk']){_0x571cdd[_0xfe21('0x52')]={'id':_0x21704b[_0xfe21('0x52')]['id'],'name':_0x21704b['Trunk'][_0xfe21('0xc')],'active':_0x21704b[_0xfe21('0x52')][_0xfe21('0x53')],'callerid':_0x21704b[_0xfe21('0x52')][_0xfe21('0x54')]};}if(_0x21704b[_0xfe21('0x55')]){_0x571cdd[_0xfe21('0x55')]={'id':_0x21704b[_0xfe21('0x55')]['id'],'name':_0x21704b[_0xfe21('0x55')]['name']};}_0x350a84[_0xfe21('0x56')](_0x571cdd);}}_0x2511f0({'count':_0x350a84['length'],'rows':_0x350a84});});},'VoiceChannels':function(_0xfe7b3e){return new Promise(function(_0x51bd1e,_0xa0cea8){var _0x1d4c8f=_['values'](_0x47e6d4[_0xfe21('0x57')]);_0x51bd1e({'count':_0x1d4c8f[_0xfe21('0x58')],'rows':_0x1d4c8f});});},'VoiceChannelMixMonitor':function(_0x5abf4d){var _0x4fb001=this;return new Promise(function(_0x20ceab,_0x24726e){if(ami[_0xfe21('0x13')]()==![]){return _0x24726e(_0x4fb001[_0xfe21('0x14')](0x1f4,[config[_0xfe21('0x15')]['ip'],config[_0xfe21('0x15')][_0xfe21('0x16')],_0xfe21('0x17')]['join']('\x20')));}var _0x4b4c1e=schema(properties[_0xfe21('0x59')])[_0xfe21('0x3')](_0x5abf4d);if(_0x4b4c1e[_0xfe21('0x58')]>0x0){return _0x24726e(_0x4fb001[_0xfe21('0x14')](0x1f4,_[_0xfe21('0x5a')](_0x4b4c1e,'message')[_0xfe21('0x1e')](',\x20')));}var _0x3995ae=_[_0xfe21('0x5b')](_0x47e6d4[_0xfe21('0x57')],{'uniqueid':_0x5abf4d['uniqueid']});if(_0x3995ae&&_0x3995ae[_0xfe21('0x5c')]){var _0x230491=util[_0xfe21('0x9')](_0xfe21('0x5d'),_0x5abf4d[_0xfe21('0x5e')]||_0x5abf4d[_0xfe21('0x5f')],_0x5abf4d[_0xfe21('0x9')]||_0xfe21('0x60'));return ami['Action']({'action':_0xfe21('0x61'),'channel':_0x3995ae[_0xfe21('0x5c')],'file':_0x230491,'options':_0xfe21('0x62')})[_0xfe21('0x1c')](function(_0x9e8602){var _0x27c08a=_[_0xfe21('0x5b')](_0x3995ae[_0xfe21('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x230491[_0xfe21('0x64')]()});if(_['isNil'](_0x27c08a)){_0x3995ae[_0xfe21('0x63')][_0xfe21('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x230491[_0xfe21('0x64')](),'createdAt':moment()[_0xfe21('0x9')](_0xfe21('0x65')),'mixmonitorid':_0x9e8602[_0xfe21('0x66')],'status':_0xfe21('0x67')});}else{_0x27c08a['mixmonitorid']=_0x9e8602[_0xfe21('0x66')];_0x27c08a[_0xfe21('0x68')]=_0xfe21('0x67');}_0x20ceab({'code':0xc8,'message':[_0x5abf4d[_0xfe21('0x5f')],_0xfe21('0x69'),_0x9e8602[_0xfe21('0x66')]][_0xfe21('0x1e')]('\x20'),'mixmonitorid':_0x9e8602[_0xfe21('0x66')]});})[_0xfe21('0x6a')](function(_0x13e4e1){_0x24726e(_0x4fb001[_0xfe21('0x14')](0x1f5,[_0x5abf4d[_0xfe21('0x5f')],_0x13e4e1[_0xfe21('0x1d')][_0xfe21('0x64')]()][_0xfe21('0x1e')]('\x20')));});}else{return _0x24726e(_0x4fb001[_0xfe21('0x14')](0x1f5,_0xfe21('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x1d4e3e){var _0x501d23=this;return new Promise(function(_0x30f6ca,_0x372c69){if(ami[_0xfe21('0x13')]()==![]){return _0x372c69(_0x501d23['error'](0x1f4,[config[_0xfe21('0x15')]['ip'],config['asterisk'][_0xfe21('0x16')],_0xfe21('0x17')][_0xfe21('0x1e')]('\x20')));}var _0x3b8bdf=schema(properties[_0xfe21('0x59')])[_0xfe21('0x3')](_0x1d4e3e);if(_0x3b8bdf[_0xfe21('0x58')]>0x0){return _0x372c69(_0x501d23[_0xfe21('0x14')](0x1f4,_['map'](_0x3b8bdf,_0xfe21('0x1d'))[_0xfe21('0x1e')](',\x20')));}var _0x15b4d2=_[_0xfe21('0x5b')](_0x47e6d4[_0xfe21('0x57')],{'uniqueid':_0x1d4e3e['uniqueid']});if(_0x15b4d2){return BPromise[_0xfe21('0x6c')]()[_0xfe21('0x1c')](function(){if(_0x15b4d2[_0xfe21('0x5c')]){return ami[_0xfe21('0x1b')]({'action':_0xfe21('0x6d'),'channel':_0x15b4d2[_0xfe21('0x5c')],'mixmonitorid':_0x1d4e3e['mixmonitorid']})[_0xfe21('0x6a')](function(_0x2ea41e){});}})['then'](function(){if(_0x15b4d2['destinationchannel']){return ami['Action']({'action':_0xfe21('0x6d'),'channel':_0x15b4d2[_0xfe21('0x6e')],'mixmonitorid':_0x1d4e3e[_0xfe21('0x66')]})[_0xfe21('0x6a')](function(_0x47aa55){});}})[_0xfe21('0x1c')](function(_0x54c561){var _0x586469=_[_0xfe21('0x5b')](_0x15b4d2['monitors'],{'mixmonitorid':_0x1d4e3e[_0xfe21('0x66')]});if(_0x586469){_0x586469['status']=_0xfe21('0x6f');}})['then'](function(){var _0x1e642e=util[_0xfe21('0x9')](_0xfe21('0x5d'),_0x1d4e3e['filename']||_0x1d4e3e[_0xfe21('0x5f')],_0x1d4e3e[_0xfe21('0x9')]||_0xfe21('0x60'));var _0x37d290=_['find'](_0x15b4d2[_0xfe21('0x63')],{'filename':_0xfe21('0x70')+_0x1e642e[_0xfe21('0x64')]()});if(_0x37d290){_0x37d290[_0xfe21('0x68')]='stop';}})[_0xfe21('0x1c')](function(){_0x30f6ca({'code':0xc8,'message':[_0x1d4e3e[_0xfe21('0x5f')],'StopMixMonitor\x20Success'][_0xfe21('0x1e')]('\x20')});})['catch'](function(_0xdad8fd){_0x372c69(_0x501d23[_0xfe21('0x14')](0x1f5,[_0x1d4e3e[_0xfe21('0x5f')],_0xdad8fd[_0xfe21('0x1d')][_0xfe21('0x64')]()]['join']('\x20')));});}else{return _0x372c69(_0x501d23['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x31ba43){return new Promise(function(_0x536da2,_0x174d61){var _0x27b942=_[_0xfe21('0x71')](_0x47e6d4[_0xfe21('0x72')]);_0x536da2({'count':_0x27b942[_0xfe21('0x58')],'rows':_0x27b942});});},'VoiceQueuesChannel':function(_0x644e77){var _0x33c7d7=this;return new Promise(function(_0x3554ef,_0x492448){var _0x9a4994=schema(properties['voicequeuechannel'])[_0xfe21('0x3')](_0x644e77);if(_0x9a4994['length']>0x0){return _0x492448(_0x33c7d7['error'](0x1f4,_[_0xfe21('0x5a')](_0x9a4994,_0xfe21('0x1d'))[_0xfe21('0x1e')](',\x20')));}var _0x1d623f=_[_0xfe21('0x5b')](_0x47e6d4['queueChannels'],{'uniqueid':_0x644e77[_0xfe21('0x5f')]});if(_0x1d623f){_0x3554ef(_0x1d623f);}else{return _0x492448(_0x33c7d7[_0xfe21('0x14')](0x1f5,_0xfe21('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x17333c){var _0x4bf0de=this;return new Promise(function(_0x8c8c5d,_0x16cc77){if(ami['isConnected']()==![]){return _0x16cc77(_0x4bf0de[_0xfe21('0x14')](0x1f4,[config[_0xfe21('0x15')]['ip'],config[_0xfe21('0x15')][_0xfe21('0x16')],'ami\x20disconnected']['join']('\x20')));}var _0x179fa7=schema(properties[_0xfe21('0x73')])[_0xfe21('0x3')](_0x17333c);if(_0x179fa7[_0xfe21('0x58')]>0x0){return _0x16cc77(_0x4bf0de[_0xfe21('0x14')](0x1f4,_['map'](_0x179fa7,_0xfe21('0x1d'))[_0xfe21('0x1e')](',\x20')));}var _0x2e984f=_[_0xfe21('0x5b')](_0x47e6d4[_0xfe21('0x72')],{'uniqueid':_0x17333c['uniqueid']});if(_0x2e984f&&_0x2e984f[_0xfe21('0x5c')]){return ami[_0xfe21('0x1b')]({'action':_0xfe21('0x74'),'channel':_0x2e984f[_0xfe21('0x5c')]})[_0xfe21('0x1c')](function(_0x67e40e){_0x8c8c5d({'code':0xc8,'message':[_0x17333c['uniqueid'],_0x67e40e[_0xfe21('0x1d')][_0xfe21('0x64')]()]['join']('\x20')});})[_0xfe21('0x6a')](function(_0x7a29f3){_0x16cc77(_0x4bf0de[_0xfe21('0x14')](0x1f5,[_0x17333c[_0xfe21('0x5f')],_0x7a29f3[_0xfe21('0x1d')][_0xfe21('0x64')]()]['join']('\x20')));});}else{return _0x16cc77(_0x4bf0de[_0xfe21('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x383940){var _0x380ec6=this;return new Promise(function(_0x490d3e,_0x264137){if(ami[_0xfe21('0x13')]()==![]){return _0x264137(_0x380ec6[_0xfe21('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xfe21('0x15')][_0xfe21('0x16')],_0xfe21('0x17')][_0xfe21('0x1e')]('\x20')));}var _0x230a40=schema(properties[_0xfe21('0x75')])[_0xfe21('0x3')](_0x383940);if(_0x230a40[_0xfe21('0x58')]>0x0){return _0x264137(_0x380ec6[_0xfe21('0x14')](0x1f4,_[_0xfe21('0x5a')](_0x230a40,_0xfe21('0x1d'))['join'](',\x20')));}var _0x1015b2=_['find'](_0x47e6d4['queueChannels'],{'uniqueid':_0x383940[_0xfe21('0x5f')]});if(_0x1015b2&&_0x1015b2['channel']){return ami['Action']({'action':_0xfe21('0x76'),'channel':_0x1015b2['channel'],'exten':_0x383940['exten'],'context':_0x383940[_0xfe21('0x77')]||_0x1015b2['context'],'priority':0x1})[_0xfe21('0x1c')](function(_0xaa27d5){_0x490d3e({'code':0xc8,'message':[_0x383940[_0xfe21('0x5f')],_0xaa27d5['message']['toLowerCase']()][_0xfe21('0x1e')]('\x20')});})[_0xfe21('0x6a')](function(_0x4971e6){_0x264137(_0x380ec6[_0xfe21('0x14')](0x1f5,[_0x383940[_0xfe21('0x5f')],_0x4971e6[_0xfe21('0x1d')][_0xfe21('0x64')]()][_0xfe21('0x1e')]('\x20')));});}else{return _0x264137(_0x380ec6[_0xfe21('0x14')](0x1f5,_0xfe21('0x6b')));}});},'Agents':function(_0x3987f2){return new Promise(function(_0x5a295a,_0x4c94e8){var _0x164bba=_[_0xfe21('0x71')](_0x47e6d4[_0xfe21('0x10')]);_0x5a295a({'count':_0x164bba['length'],'rows':_0x164bba});});},'Telephones':function(_0x4d9fe0){return new Promise(function(_0x5f1ddb,_0x3f8d3d){var _0x424691=_[_0xfe21('0x71')](_0x47e6d4[_0xfe21('0x78')]);_0x5f1ddb({'count':_0x424691[_0xfe21('0x58')],'rows':_0x424691});});},'Trunks':function(_0x104a73){return new Promise(function(_0x13b609,_0x3eafcb){var _0x256a6b=_[_0xfe21('0x71')](_0x47e6d4[_0xfe21('0x79')]);_0x13b609({'count':_0x256a6b[_0xfe21('0x58')],'rows':_0x256a6b});});},'OutboundChannels':function(_0x12766d){return new Promise(function(_0x2f5955,_0x3a8abe){var _0x2d426b=_['values'](_0x47e6d4[_0xfe21('0x7a')]);_0x2f5955({'count':_0x2d426b['length'],'rows':_0x2d426b});});},'Outbound':function(_0x5071b6){return new Promise(function(_0x573fd9,_0x334ce){_0x573fd9(_0x47e6d4[_0xfe21('0x7b')]);});},'Campaigns':function(_0x7b942b){return new Promise(function(_0x1d9f2f,_0x3b763d){var _0x8f1c91=_[_0xfe21('0x71')](_0x47e6d4['campaigns']);_0x1d9f2f({'count':_0x8f1c91[_0xfe21('0x58')],'rows':_0x8f1c91});});},'VoiceQueuesPreview':function(_0x1161ca){var _0x1bdf20=this;return new Promise(function(_0x469eb3,_0x320370){_0x53be3b[_0xfe21('0x7c')](_0x1161ca['id'])['then'](function(_0x1ff021){_0x469eb3({'code':0xc8,'message':_0x1ff021['message']});})[_0xfe21('0x6a')](function(_0x552dbc){_0x320370(_0x1bdf20[_0xfe21('0x14')](0x1f4,_0x552dbc[_0xfe21('0x1d')]));});});},'EventManager':function(_0x2099b3){var _0x3953a1=this;return new Promise(function(_0x16b974,_0x5b6d8f){if(!_0x2099b3[_0xfe21('0x7d')]){return _0x5b6d8f(_0x3953a1[_0xfe21('0x14')](0x1f4,_0xfe21('0x7e')));}ami[_0xfe21('0x7f')](_0xfe21('0x80')+_0x2099b3[_0xfe21('0x7d')],_0x2099b3['message']);_0x16b974({'code':0xc8,'message':_0x2099b3});});},'FaxAccounts':function(_0x4b35e6){return new Promise(function(_0x32e872,_0x56eda4){var _0x4c1532=_[_0xfe21('0x71')](_0x47e6d4['faxAccounts']);_0x32e872({'count':_0x4c1532['length'],'rows':_0x4c1532});});},'SendFax':function(_0x5a62b6){var _0x333b56=this;return new Promise(function(_0x1e86ab,_0x2ddc8b){_0x398fd2['send'](_0x5a62b6)[_0xfe21('0x1c')](function(_0x39ef58){_0x1e86ab({'code':0xc8,'message':_0x39ef58[_0xfe21('0x1d')]});})[_0xfe21('0x6a')](function(_0x462131){_0x2ddc8b(_0x333b56['error'](0x1f4,_0x462131[_0xfe21('0x1d')]));});});},'CheckAfterSend':function(_0x2fee17){var _0x47bbae=this;return new Promise(function(_0x4f1589,_0x48f4ae){_0x398fd2['checkAfterSend'](_0x2fee17)[_0xfe21('0x1c')](function(_0x27dee9){_0x4f1589({'code':0xc8,'message':_0x27dee9[_0xfe21('0x1d')]});})[_0xfe21('0x6a')](function(_0x32189f){_0x48f4ae(_0x47bbae[_0xfe21('0x14')](0x1f4,_0x32189f[_0xfe21('0x1d')]));});});}};var _0x34e953=jayson['server'](_0x59c3ba)[_0xfe21('0x81')]();_0x34e953['on'](_0xfe21('0x14'),function(_0x2b0fca){return _0x48435a(_0x2b0fca);});_0x34e953['listen'](0x232a,_0xfe21('0x82'),function(){console['log'](_0xfe21('0x83'),0x232a);return _0x359a05(_0xfe21('0x84')+0x232a);});});}; \ No newline at end of file +var _0x2484=['erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','Interval','push','length','values','channels','username','ami\x20disconnected','validate','map','find','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','join','keys','module','Reload','Action','then','message','pick','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','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','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls'];(function(_0x4dfecb,_0x8d2259){var _0x4fc85c=function(_0x10bcf7){while(--_0x10bcf7){_0x4dfecb['push'](_0x4dfecb['shift']());}};_0x4fc85c(++_0x8d2259);}(_0x2484,0x14a));var _0x4248=function(_0x42b02c,_0x5c7b99){_0x42b02c=_0x42b02c-0x0;var _0x105518=_0x2484[_0x42b02c];return _0x105518;};'use strict';var _=require(_0x4248('0x0'));var util=require(_0x4248('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x4248('0x2'));var moment=require(_0x4248('0x3'));var config=require(_0x4248('0x4'));var properties=require('../properties');var ami=require(_0x4248('0x5'));exports[_0x4248('0x6')]=function(_0x31b69c,_0x2d93f4,_0xef83a5){return new BPromise(function(_0x110e68,_0x398f2){var _0x4da4d8={'QueuePause':function(_0x12df30){return new Promise(function(_0x578373,_0x35fe41){var _0x3a1036=util[_0x4248('0x7')](_0x4248('0x8'),_0x4248('0x9'),_0x12df30[_0x4248('0xa')]);if(_0x31b69c[_0x4248('0xb')]&&_0x31b69c[_0x4248('0xb')][_0x3a1036]&&_0x31b69c[_0x4248('0xb')][_0x3a1036][_0x4248('0xc')]){_0x31b69c[_0x4248('0xb')][_0x3a1036][_0x4248('0xd')]();}if(_0x31b69c[_0x4248('0xe')][_0x3a1036]){_0x31b69c[_0x4248('0xe')][_0x3a1036][_0x4248('0xf')]({'statePause':_0x12df30[_0x4248('0x10')]?!![]:![]});}_0x578373({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x427e23){var _0x344faa=this;return new Promise(function(_0x483d76,_0x135208){if(ami[_0x4248('0x11')]()==![]){return _0x135208(_0x344faa[_0x4248('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x4248('0x13')]['username'],'ami\x20disconnected'][_0x4248('0x14')]('\x20')));}_0x427e23=_['pick'](_0x427e23,_[_0x4248('0x15')](properties[_0x4248('0x16')]));_0x427e23['action']=_0x4248('0x17');return ami[_0x4248('0x18')](_0x427e23)[_0x4248('0x19')](function(_0xf0325){_0x483d76({'code':0xc8,'message':_0xf0325[_0x4248('0x1a')]});})['catch'](function(_0x36ecc7){_0x135208(_0x344faa[_0x4248('0x12')](0x1f5,_0x36ecc7[_0x4248('0x1a')]));});});},'Command':function(_0x52f6e7){var _0x5ea24c=this;return new Promise(function(_0x16fddf,_0x5668ec){if(ami[_0x4248('0x11')]()==![]){return _0x5668ec(_0x5ea24c[_0x4248('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x4248('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x52f6e7=_[_0x4248('0x1b')](_0x52f6e7,'command');_0x52f6e7['action']='Command';return ami[_0x4248('0x18')](_0x52f6e7)[_0x4248('0x19')](function(_0x1a5da2){_0x16fddf({'code':0xc8,'message':_0x1a5da2[_0x4248('0x1c')]});})['catch'](function(_0x130a59){_0x5668ec(_0x5ea24c[_0x4248('0x12')](0x1f5,_0x130a59[_0x4248('0x1a')]));});});},'VoiceQueues':function(_0x454ee3){return new Promise(function(_0x14cebc,_0x35fd5a){var _0x10abb5=[];for(var _0x5dcf9c in _0x31b69c['voiceQueues']){if(_0x31b69c[_0x4248('0x1d')][_0x4248('0x1e')](_0x5dcf9c)){var _0x2ec0fa=_0x31b69c[_0x4248('0x1d')][_0x5dcf9c];var _0x160efd={'id':_0x2ec0fa['id'],'name':_0x2ec0fa['name'],'strategy':_0x2ec0fa[_0x4248('0x1f')],'answered':_0x2ec0fa['answered'],'available':_0x2ec0fa['available'],'loggedIn':_0x2ec0fa[_0x4248('0x20')],'pTalking':_0x2ec0fa[_0x4248('0x21')],'sumBillable':_0x2ec0fa[_0x4248('0x22')],'sumDuration':_0x2ec0fa[_0x4248('0x23')],'sumHoldTime':_0x2ec0fa[_0x4248('0x24')]||0x0,'talking':_0x2ec0fa[_0x4248('0x25')],'total':_0x2ec0fa['total'],'type':_0x2ec0fa[_0x4248('0x26')],'unmanaged':_0x2ec0fa[_0x4248('0x27')],'abandoned':_0x2ec0fa[_0x4248('0x28')],'waiting':_0x2ec0fa[_0x4248('0x29')],'loggedInDb':_0x2ec0fa[_0x4248('0x2a')]};if(_0x2ec0fa[_0x4248('0x26')]===_0x4248('0x2b')){_0x160efd['dialActive']=_0x2ec0fa[_0x4248('0x2c')];_0x160efd['dialMethod']=_0x2ec0fa[_0x4248('0x2d')];_0x160efd[_0x4248('0x2e')]=_0x2ec0fa[_0x4248('0x2e')];_0x160efd[_0x4248('0x2f')]=_0x2ec0fa['dialOriginateCallerIdNumber'];_0x160efd['dialOriginateTimeout']=_0x2ec0fa[_0x4248('0x30')];_0x160efd[_0x4248('0x31')]=_0x2ec0fa[_0x4248('0x31')];_0x160efd[_0x4248('0x32')]=_0x2ec0fa[_0x4248('0x32')];_0x160efd[_0x4248('0x33')]=_0x2ec0fa['outboundAnswerCallsDay'];_0x160efd[_0x4248('0x34')]=_0x2ec0fa[_0x4248('0x34')];_0x160efd[_0x4248('0x35')]=_0x2ec0fa[_0x4248('0x35')];_0x160efd[_0x4248('0x36')]=_0x2ec0fa[_0x4248('0x36')];_0x160efd[_0x4248('0x37')]=_0x2ec0fa[_0x4248('0x37')];_0x160efd[_0x4248('0x38')]=_0x2ec0fa[_0x4248('0x38')];_0x160efd[_0x4248('0x39')]=_0x2ec0fa[_0x4248('0x39')];_0x160efd[_0x4248('0x3a')]=_0x2ec0fa[_0x4248('0x3a')];_0x160efd[_0x4248('0x3b')]=_0x2ec0fa[_0x4248('0x3b')];_0x160efd['outboundOriginateFailureCallsDay']=_0x2ec0fa[_0x4248('0x3c')];_0x160efd[_0x4248('0x3d')]=_0x2ec0fa['outboundReCallsDay'];_0x160efd[_0x4248('0x3e')]=_0x2ec0fa['outboundRejectCallsDay'];_0x160efd[_0x4248('0x3f')]=_0x2ec0fa[_0x4248('0x3f')];_0x160efd[_0x4248('0x40')]=_0x2ec0fa['predictiveIntervalAnsweredCalls'];_0x160efd[_0x4248('0x41')]=_0x2ec0fa[_0x4248('0x41')];_0x160efd[_0x4248('0x42')]=_0x2ec0fa[_0x4248('0x42')];_0x160efd[_0x4248('0x43')]=_0x2ec0fa[_0x4248('0x43')];_0x160efd['predictiveIntervalDroppedCallsTimeout']=_0x2ec0fa[_0x4248('0x44')];_0x160efd[_0x4248('0x45')]=_0x2ec0fa['predictiveIntervalErlangCalls'];_0x160efd['predictiveIntervalErlangCallsDroppedCalls']=_0x2ec0fa[_0x4248('0x46')];_0x160efd[_0x4248('0x47')]=_0x2ec0fa[_0x4248('0x47')];_0x160efd[_0x4248('0x48')]=_0x2ec0fa[_0x4248('0x48')];_0x160efd[_0x4248('0x49')]=_0x2ec0fa[_0x4248('0x49')];_0x160efd[_0x4248('0x4a')]=_0x2ec0fa[_0x4248('0x4a')];_0x160efd[_0x4248('0x4b')]=_0x2ec0fa[_0x4248('0x4b')];_0x160efd['message']=_0x2ec0fa['message'];_0x160efd[_0x4248('0x4c')]=_0x2ec0fa[_0x4248('0x4c')];_0x160efd[_0x4248('0x4d')]=_0x2ec0fa[_0x4248('0x4d')];_0x160efd[_0x4248('0x4e')]=_0x2ec0fa[_0x4248('0x4e')];_0x160efd[_0x4248('0x4f')]=_0x2ec0fa[_0x4248('0x4f')];_0x160efd['erlangBusyFactor']=_0x2ec0fa['erlangBusyFactor'];_0x160efd['startPredictive']=_0x2ec0fa['startPredictive'];_0x160efd[_0x4248('0x50')]=_0x2ec0fa[_0x4248('0x50')];}if(_0x2ec0fa[_0x4248('0x51')]){_0x160efd[_0x4248('0x51')]={'id':_0x2ec0fa['Trunk']['id'],'name':_0x2ec0fa[_0x4248('0x51')][_0x4248('0xa')],'active':_0x2ec0fa[_0x4248('0x51')]['active'],'callerid':_0x2ec0fa['Trunk']['callerid']};}if(_0x2ec0fa[_0x4248('0x52')]){_0x160efd[_0x4248('0x52')]={'id':_0x2ec0fa[_0x4248('0x52')]['id'],'name':_0x2ec0fa[_0x4248('0x52')][_0x4248('0xa')]};}_0x10abb5[_0x4248('0x53')](_0x160efd);}}_0x14cebc({'count':_0x10abb5[_0x4248('0x54')],'rows':_0x10abb5});});},'VoiceChannels':function(_0x984c1c){return new Promise(function(_0x5d3a72,_0x241d99){var _0xebb2a=_[_0x4248('0x55')](_0x31b69c[_0x4248('0x56')]);_0x5d3a72({'count':_0xebb2a[_0x4248('0x54')],'rows':_0xebb2a});});},'VoiceChannelMixMonitor':function(_0x23dbb8){var _0x591e1a=this;return new Promise(function(_0x1548ff,_0x15502f){if(ami['isConnected']()==![]){return _0x15502f(_0x591e1a['error'](0x1f4,[config[_0x4248('0x13')]['ip'],config['asterisk'][_0x4248('0x57')],_0x4248('0x58')][_0x4248('0x14')]('\x20')));}var _0x79bb8f=schema(properties['voicechannel'])[_0x4248('0x59')](_0x23dbb8);if(_0x79bb8f[_0x4248('0x54')]>0x0){return _0x15502f(_0x591e1a[_0x4248('0x12')](0x1f4,_[_0x4248('0x5a')](_0x79bb8f,_0x4248('0x1a'))['join'](',\x20')));}var _0x47385c=_[_0x4248('0x5b')](_0x31b69c[_0x4248('0x56')],{'uniqueid':_0x23dbb8['uniqueid']});if(_0x47385c&&_0x47385c[_0x4248('0x5c')]){var _0x9fb269=util[_0x4248('0x7')](_0x4248('0x5d'),_0x23dbb8[_0x4248('0x5e')]||_0x23dbb8[_0x4248('0x5f')],_0x23dbb8[_0x4248('0x7')]||'wav');return ami[_0x4248('0x18')]({'action':_0x4248('0x60'),'channel':_0x47385c[_0x4248('0x5c')],'file':_0x9fb269,'options':_0x4248('0x61')})[_0x4248('0x19')](function(_0x508504){var _0x7bb3f4=_['find'](_0x47385c[_0x4248('0x62')],{'filename':_0x4248('0x63')+_0x9fb269[_0x4248('0x64')]()});if(_[_0x4248('0x65')](_0x7bb3f4)){_0x47385c[_0x4248('0x62')][_0x4248('0x53')]({'filename':_0x4248('0x63')+_0x9fb269[_0x4248('0x64')](),'createdAt':moment()[_0x4248('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x508504[_0x4248('0x66')],'status':_0x4248('0x67')});}else{_0x7bb3f4[_0x4248('0x66')]=_0x508504['mixmonitorid'];_0x7bb3f4[_0x4248('0x68')]=_0x4248('0x67');}_0x1548ff({'code':0xc8,'message':[_0x23dbb8['uniqueid'],_0x4248('0x69'),_0x508504[_0x4248('0x66')]][_0x4248('0x14')]('\x20'),'mixmonitorid':_0x508504[_0x4248('0x66')]});})[_0x4248('0x6a')](function(_0x5381a8){_0x15502f(_0x591e1a[_0x4248('0x12')](0x1f5,[_0x23dbb8[_0x4248('0x5f')],_0x5381a8['message'][_0x4248('0x64')]()][_0x4248('0x14')]('\x20')));});}else{return _0x15502f(_0x591e1a[_0x4248('0x12')](0x1f5,_0x4248('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x406bca){var _0x2681e9=this;return new Promise(function(_0x7eae9f,_0x4dda3a){if(ami[_0x4248('0x11')]()==![]){return _0x4dda3a(_0x2681e9['error'](0x1f4,[config[_0x4248('0x13')]['ip'],config[_0x4248('0x13')][_0x4248('0x57')],_0x4248('0x58')]['join']('\x20')));}var _0x5043e2=schema(properties['voicechannel'])[_0x4248('0x59')](_0x406bca);if(_0x5043e2['length']>0x0){return _0x4dda3a(_0x2681e9[_0x4248('0x12')](0x1f4,_['map'](_0x5043e2,'message')[_0x4248('0x14')](',\x20')));}var _0x130582=_['find'](_0x31b69c[_0x4248('0x56')],{'uniqueid':_0x406bca[_0x4248('0x5f')]});if(_0x130582){return BPromise[_0x4248('0x6c')]()[_0x4248('0x19')](function(){if(_0x130582[_0x4248('0x5c')]){return ami['Action']({'action':_0x4248('0x6d'),'channel':_0x130582[_0x4248('0x5c')],'mixmonitorid':_0x406bca[_0x4248('0x66')]})['catch'](function(_0x5b03bd){});}})[_0x4248('0x19')](function(){if(_0x130582[_0x4248('0x6e')]){return ami[_0x4248('0x18')]({'action':_0x4248('0x6d'),'channel':_0x130582[_0x4248('0x6e')],'mixmonitorid':_0x406bca['mixmonitorid']})[_0x4248('0x6a')](function(_0x19f338){});}})[_0x4248('0x19')](function(_0x5617f5){var _0x3b8f4b=_[_0x4248('0x5b')](_0x130582[_0x4248('0x62')],{'mixmonitorid':_0x406bca[_0x4248('0x66')]});if(_0x3b8f4b){_0x3b8f4b[_0x4248('0x68')]=_0x4248('0x6f');}})[_0x4248('0x19')](function(){var _0x389f1f=util[_0x4248('0x7')](_0x4248('0x5d'),_0x406bca[_0x4248('0x5e')]||_0x406bca['uniqueid'],_0x406bca[_0x4248('0x7')]||_0x4248('0x70'));var _0x2b8f61=_[_0x4248('0x5b')](_0x130582['monitors'],{'filename':_0x4248('0x63')+_0x389f1f[_0x4248('0x64')]()});if(_0x2b8f61){_0x2b8f61[_0x4248('0x68')]='stop';}})[_0x4248('0x19')](function(){_0x7eae9f({'code':0xc8,'message':[_0x406bca[_0x4248('0x5f')],_0x4248('0x71')][_0x4248('0x14')]('\x20')});})[_0x4248('0x6a')](function(_0x24a226){_0x4dda3a(_0x2681e9[_0x4248('0x12')](0x1f5,[_0x406bca['uniqueid'],_0x24a226['message'][_0x4248('0x64')]()]['join']('\x20')));});}else{return _0x4dda3a(_0x2681e9['error'](0x1f5,_0x4248('0x6b')));}});},'VoiceQueuesChannels':function(_0x3fab1d){return new Promise(function(_0x3564c0,_0x1f1be9){var _0x39f7cd=_['values'](_0x31b69c[_0x4248('0x72')]);_0x3564c0({'count':_0x39f7cd[_0x4248('0x54')],'rows':_0x39f7cd});});},'VoiceQueuesChannel':function(_0x4d6002){var _0x33602c=this;return new Promise(function(_0x2426ac,_0x5c6a6a){var _0x571c7e=schema(properties[_0x4248('0x73')])[_0x4248('0x59')](_0x4d6002);if(_0x571c7e[_0x4248('0x54')]>0x0){return _0x5c6a6a(_0x33602c[_0x4248('0x12')](0x1f4,_[_0x4248('0x5a')](_0x571c7e,'message')[_0x4248('0x14')](',\x20')));}var _0x2e7ea0=_[_0x4248('0x5b')](_0x31b69c['queueChannels'],{'uniqueid':_0x4d6002[_0x4248('0x5f')]});if(_0x2e7ea0){_0x2426ac(_0x2e7ea0);}else{return _0x5c6a6a(_0x33602c['error'](0x1f5,_0x4248('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x3e5581){var _0x4c6131=this;return new Promise(function(_0x1b03d0,_0x1d4d3f){if(ami[_0x4248('0x11')]()==![]){return _0x1d4d3f(_0x4c6131[_0x4248('0x12')](0x1f4,[config[_0x4248('0x13')]['ip'],config['asterisk'][_0x4248('0x57')],_0x4248('0x58')][_0x4248('0x14')]('\x20')));}var _0x34f89b=schema(properties[_0x4248('0x74')])[_0x4248('0x59')](_0x3e5581);if(_0x34f89b[_0x4248('0x54')]>0x0){return _0x1d4d3f(_0x4c6131['error'](0x1f4,_[_0x4248('0x5a')](_0x34f89b,_0x4248('0x1a'))[_0x4248('0x14')](',\x20')));}var _0x2a0035=_['find'](_0x31b69c['queueChannels'],{'uniqueid':_0x3e5581['uniqueid']});if(_0x2a0035&&_0x2a0035[_0x4248('0x5c')]){return ami[_0x4248('0x18')]({'action':_0x4248('0x75'),'channel':_0x2a0035['channel']})[_0x4248('0x19')](function(_0x39d0ee){_0x1b03d0({'code':0xc8,'message':[_0x3e5581['uniqueid'],_0x39d0ee[_0x4248('0x1a')][_0x4248('0x64')]()][_0x4248('0x14')]('\x20')});})['catch'](function(_0x4fa74d){_0x1d4d3f(_0x4c6131[_0x4248('0x12')](0x1f5,[_0x3e5581[_0x4248('0x5f')],_0x4fa74d[_0x4248('0x1a')][_0x4248('0x64')]()][_0x4248('0x14')]('\x20')));});}else{return _0x1d4d3f(_0x4c6131['error'](0x1f5,_0x4248('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0xdadbf6){var _0x16e06c=this;return new Promise(function(_0x31f62c,_0xde3975){if(ami[_0x4248('0x11')]()==![]){return _0xde3975(_0x16e06c['error'](0x1f4,[config['asterisk']['ip'],config[_0x4248('0x13')]['username'],'ami\x20disconnected'][_0x4248('0x14')]('\x20')));}var _0xfc3747=schema(properties[_0x4248('0x76')])['validate'](_0xdadbf6);if(_0xfc3747[_0x4248('0x54')]>0x0){return _0xde3975(_0x16e06c['error'](0x1f4,_[_0x4248('0x5a')](_0xfc3747,'message')['join'](',\x20')));}var _0x4ead1c=_[_0x4248('0x5b')](_0x31b69c[_0x4248('0x72')],{'uniqueid':_0xdadbf6[_0x4248('0x5f')]});if(_0x4ead1c&&_0x4ead1c[_0x4248('0x5c')]){return ami[_0x4248('0x18')]({'action':_0x4248('0x77'),'channel':_0x4ead1c[_0x4248('0x5c')],'exten':_0xdadbf6[_0x4248('0x78')],'context':_0xdadbf6[_0x4248('0x79')]||_0x4ead1c[_0x4248('0x79')],'priority':0x1})[_0x4248('0x19')](function(_0x409c28){_0x31f62c({'code':0xc8,'message':[_0xdadbf6[_0x4248('0x5f')],_0x409c28[_0x4248('0x1a')][_0x4248('0x64')]()][_0x4248('0x14')]('\x20')});})[_0x4248('0x6a')](function(_0x4b5b8d){_0xde3975(_0x16e06c['error'](0x1f5,[_0xdadbf6[_0x4248('0x5f')],_0x4b5b8d[_0x4248('0x1a')][_0x4248('0x64')]()][_0x4248('0x14')]('\x20')));});}else{return _0xde3975(_0x16e06c[_0x4248('0x12')](0x1f5,_0x4248('0x6b')));}});},'Agents':function(_0x352f58){return new Promise(function(_0xcecad2,_0x430edb){var _0x1e21ef=_['values'](_0x31b69c[_0x4248('0xe')]);_0xcecad2({'count':_0x1e21ef[_0x4248('0x54')],'rows':_0x1e21ef});});},'Telephones':function(_0x587a61){return new Promise(function(_0x5e569c,_0x1db3a5){var _0x47550b=_[_0x4248('0x55')](_0x31b69c[_0x4248('0x7a')]);_0x5e569c({'count':_0x47550b[_0x4248('0x54')],'rows':_0x47550b});});},'Trunks':function(_0x366543){return new Promise(function(_0x558c1c,_0x500b80){var _0x1cd5bf=_['values'](_0x31b69c[_0x4248('0x7b')]);_0x558c1c({'count':_0x1cd5bf[_0x4248('0x54')],'rows':_0x1cd5bf});});},'OutboundChannels':function(_0xae07b5){return new Promise(function(_0x36ee1b,_0x3763c3){var _0xf5d37e=_[_0x4248('0x55')](_0x31b69c[_0x4248('0x7c')]);_0x36ee1b({'count':_0xf5d37e[_0x4248('0x54')],'rows':_0xf5d37e});});},'Outbound':function(_0x143682){return new Promise(function(_0x58ab13,_0x5e1cf4){_0x58ab13(_0x31b69c['outbound']);});},'Campaigns':function(_0x409294){return new Promise(function(_0x291aae,_0x1043cf){var _0x4d76d9=_[_0x4248('0x55')](_0x31b69c[_0x4248('0x7d')]);_0x291aae({'count':_0x4d76d9['length'],'rows':_0x4d76d9});});},'VoiceQueuesPreview':function(_0x4d6a33){var _0x26a1ea=this;return new Promise(function(_0x2caa29,_0xd6ed8d){_0x2d93f4[_0x4248('0x7e')](_0x4d6a33['id'])['then'](function(_0x567c2b){_0x2caa29({'code':0xc8,'message':_0x567c2b[_0x4248('0x1a')]});})[_0x4248('0x6a')](function(_0x557354){_0xd6ed8d(_0x26a1ea[_0x4248('0x12')](0x1f4,_0x557354['message']));});});},'EventManager':function(_0x228a52){var _0x19517b=this;return new Promise(function(_0x489dda,_0xbd114c){if(!_0x228a52['event']){return _0xbd114c(_0x19517b[_0x4248('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0x228a52[_0x4248('0x7f')],_0x228a52[_0x4248('0x1a')]);_0x489dda({'code':0xc8,'message':_0x228a52});});},'FaxAccounts':function(_0x110abb){return new Promise(function(_0x346b5b,_0x17087f){var _0x7f53d5=_[_0x4248('0x55')](_0x31b69c['faxAccounts']);_0x346b5b({'count':_0x7f53d5[_0x4248('0x54')],'rows':_0x7f53d5});});},'SendFax':function(_0x469248){var _0x44ef5d=this;return new Promise(function(_0x9c560e,_0x381f48){_0xef83a5[_0x4248('0x80')](_0x469248)[_0x4248('0x19')](function(_0x421211){_0x9c560e({'code':0xc8,'message':_0x421211[_0x4248('0x1a')]});})[_0x4248('0x6a')](function(_0x2bfa9e){_0x381f48(_0x44ef5d['error'](0x1f4,_0x2bfa9e[_0x4248('0x1a')]));});});},'CheckAfterSend':function(_0xfd1a07){var _0x4df346=this;return new Promise(function(_0x3548c8,_0x11fb71){_0xef83a5[_0x4248('0x81')](_0xfd1a07)[_0x4248('0x19')](function(_0x384855){_0x3548c8({'code':0xc8,'message':_0x384855[_0x4248('0x1a')]});})[_0x4248('0x6a')](function(_0x3d2679){_0x11fb71(_0x4df346[_0x4248('0x12')](0x1f4,_0x3d2679[_0x4248('0x1a')]));});});}};var _0x1288fa=jayson[_0x4248('0x82')](_0x4da4d8)[_0x4248('0x83')]();_0x1288fa['on'](_0x4248('0x12'),function(_0x198494){return _0x398f2(_0x198494);});_0x1288fa[_0x4248('0x6')](0x232a,_0x4248('0x84'),function(){console[_0x4248('0x85')](_0x4248('0x86'),0x232a);return _0x110e68(_0x4248('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index ed2869a..4ac6b0d 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 _0xa0df=['[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','autoCreate','data1','calleridnum','isNil','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','showContact','omit','xmd-contactid2','user:%s','name','format','trigger:%s','action','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','error'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xa0df,0x1f1));var _0xfa0d=function(_0x34eb03,_0x506c2c){_0x34eb03=_0x34eb03-0x0;var _0x427145=_0xa0df[_0x34eb03];return _0x427145;};'use strict';var BPromise=require(_0xfa0d('0x0'));var util=require(_0xfa0d('0x1'));var _=require(_0xfa0d('0x2'));var Redis=require(_0xfa0d('0x3'));var config=require(_0xfa0d('0x4'));var logger=require(_0xfa0d('0x5'))(_0xfa0d('0x6'));var cmContactRpc=require(_0xfa0d('0x7'));config[_0xfa0d('0x8')]=_['defaults'](config[_0xfa0d('0x8')],{'host':_0xfa0d('0x9'),'port':0x18eb});var io=require(_0xfa0d('0xa'))(new Redis(config[_0xfa0d('0x8')]));function emit(_0x229361,_0x447e65,_0x44e123,_0x21a9e5){logger[_0xfa0d('0xb')](_0xfa0d('0xc'),_0x229361,'',_0x447e65,_0x44e123,JSON[_0xfa0d('0xd')](_0x21a9e5));io['to'](_0x447e65)[_0xfa0d('0xe')](_0x44e123,_0x21a9e5);}exports['exec']=function(_0xcd43c1,_0x46d419,_0x3b7d7f){_0x3b7d7f[_0xfa0d('0xf')]=0x0;if(_0x46d419['data2']&&parseInt(_0x46d419['data2'],0xa)){var _0x20baca={'ListId':parseInt(_0x46d419[_0xfa0d('0x10')],0xa),'phone':_0x3b7d7f[_0xfa0d('0x11')]};if(_[_0xfa0d('0x12')](_0x3b7d7f[_0xfa0d('0x13')])){_0x20baca[_0xfa0d('0x14')]=_0x3b7d7f[_0xfa0d('0x15')]&&_0x3b7d7f[_0xfa0d('0x15')]!==_0xfa0d('0x16')?_0x3b7d7f[_0xfa0d('0x15')]:_0x3b7d7f[_0xfa0d('0x11')]||_0x3b7d7f['uniqueid'];}else{_0x20baca[_0xfa0d('0x14')]=_0x3b7d7f[_0xfa0d('0x17')]&&_0x3b7d7f[_0xfa0d('0x17')]!==_0xfa0d('0x16')?_0x3b7d7f[_0xfa0d('0x17')]:_0x3b7d7f[_0xfa0d('0x18')]||_0x3b7d7f[_0xfa0d('0x19')];_0x20baca[_0xfa0d('0x1a')]=_0x3b7d7f[_0xfa0d('0x17')]&&_0x3b7d7f[_0xfa0d('0x17')]!==_0xfa0d('0x16')?_0x3b7d7f[_0xfa0d('0x17')]:_0x3b7d7f[_0xfa0d('0x18')]||_0x3b7d7f[_0xfa0d('0x19')];}BPromise[_0xfa0d('0x1b')]()[_0xfa0d('0x1c')](cmContactRpc[_0xfa0d('0x1d')]({'where':_[_0xfa0d('0x1e')](_0x20baca,['firstName'])}))['then'](function(_0x3cf3c9){if(_0x3cf3c9){logger[_0xfa0d('0xb')]('[%s][%s]\x20Contact\x20found:%s',_0x3b7d7f[_0xfa0d('0x19')],'',_0x3cf3c9['id']);if(_0xcd43c1){_0x3b7d7f[_0xfa0d('0x1f')]=_0x3cf3c9['id'];emit(_0x3b7d7f[_0xfa0d('0x19')],util['format'](_0xfa0d('0x20'),_0xcd43c1[_0xfa0d('0x21')]),util[_0xfa0d('0x22')](_0xfa0d('0x23'),_0x46d419[_0xfa0d('0x24')][_0xfa0d('0x25')]()),_[_0xfa0d('0x26')](_0x3b7d7f,{'ListId':parseInt(_0x46d419['data1'],0xa)}));}return;}else{logger[_0xfa0d('0xb')](_0xfa0d('0x27'),_0x3b7d7f['uniqueid'],'');return BPromise[_0xfa0d('0x1b')]()[_0xfa0d('0x1c')](cmContactRpc[_0xfa0d('0x28')](_0x20baca));}})[_0xfa0d('0x1c')](function(_0x32657c){if(_0x32657c){logger[_0xfa0d('0xb')](_0xfa0d('0x29'),_0x3b7d7f[_0xfa0d('0x19')],'',_0x32657c['id']);if(_0xcd43c1){_0x3b7d7f[_0xfa0d('0x1f')]=_0x32657c['id'];emit(_0x3b7d7f[_0xfa0d('0x19')],util['format'](_0xfa0d('0x20'),_0xcd43c1[_0xfa0d('0x21')]),util[_0xfa0d('0x22')](_0xfa0d('0x23'),_0x46d419['action']['toLowerCase']()),_[_0xfa0d('0x26')](_0x3b7d7f,{'ListId':parseInt(_0x46d419[_0xfa0d('0x10')],0xa)}));}}})['catch'](function(_0x3832cf){logger[_0xfa0d('0x2a')](_0xfa0d('0x2b'),_0x3b7d7f['uniqueid'],'',JSON[_0xfa0d('0xd')](_0x3832cf));});}else{if(_0xcd43c1){logger[_0xfa0d('0xb')](_0xfa0d('0x2c'),_0x3b7d7f[_0xfa0d('0x19')],'');emit(_0x3b7d7f[_0xfa0d('0x19')],util[_0xfa0d('0x22')](_0xfa0d('0x20'),_0xcd43c1['name']),util[_0xfa0d('0x22')](_0xfa0d('0x23'),_0x46d419[_0xfa0d('0x24')][_0xfa0d('0x25')]()),_[_0xfa0d('0x26')]({'ListId':parseInt(_0x46d419[_0xfa0d('0x10')],0xa)},_0x3b7d7f));}}}; \ No newline at end of file +var _0xd557=['format','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','user:%s','toLowerCase','bluebird','util','lodash','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','defaults','localhost','info','[%s][%s]','stringify','emit','exec','autoCreate','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','phone','destcalleridnum','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','name','trigger:%s','action','merge','[%s][%s]\x20Contact\x20not\x20found','[%s][%s]\x20Contact\x20created:%s'];(function(_0x34fe77,_0x165cab){var _0x1a5e26=function(_0x46d9a6){while(--_0x46d9a6){_0x34fe77['push'](_0x34fe77['shift']());}};_0x1a5e26(++_0x165cab);}(_0xd557,0x18a));var _0x7d55=function(_0x3def09,_0x301f45){_0x3def09=_0x3def09-0x0;var _0x3a6c16=_0xd557[_0x3def09];return _0x3a6c16;};'use strict';var BPromise=require(_0x7d55('0x0'));var util=require(_0x7d55('0x1'));var _=require(_0x7d55('0x2'));var Redis=require(_0x7d55('0x3'));var config=require(_0x7d55('0x4'));var logger=require('../../../../config/logger')(_0x7d55('0x5'));var cmContactRpc=require(_0x7d55('0x6'));config['redis']=_[_0x7d55('0x7')](config['redis'],{'host':_0x7d55('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x353fd9,_0x556884,_0x2511e0,_0x1487a3){logger[_0x7d55('0x9')](_0x7d55('0xa'),_0x353fd9,'',_0x556884,_0x2511e0,JSON[_0x7d55('0xb')](_0x1487a3));io['to'](_0x556884)[_0x7d55('0xc')](_0x2511e0,_0x1487a3);}exports[_0x7d55('0xd')]=function(_0x2dd177,_0x5bf6f7,_0x2fed93){_0x2fed93[_0x7d55('0xe')]=0x0;if(_0x5bf6f7['data2']&&parseInt(_0x5bf6f7['data2'],0xa)){var _0x304dd0={'ListId':parseInt(_0x5bf6f7[_0x7d55('0xf')],0xa),'phone':_0x2fed93[_0x7d55('0x10')]};if(_['isNil'](_0x2fed93[_0x7d55('0x11')])){_0x304dd0[_0x7d55('0x12')]=_0x2fed93[_0x7d55('0x13')]&&_0x2fed93['calleridname']!==_0x7d55('0x14')?_0x2fed93[_0x7d55('0x13')]:_0x2fed93[_0x7d55('0x10')]||_0x2fed93[_0x7d55('0x15')];}else{_0x304dd0[_0x7d55('0x12')]=_0x2fed93[_0x7d55('0x16')]&&_0x2fed93[_0x7d55('0x16')]!==_0x7d55('0x14')?_0x2fed93[_0x7d55('0x16')]:_0x2fed93['destcalleridnum']||_0x2fed93[_0x7d55('0x15')];_0x304dd0[_0x7d55('0x17')]=_0x2fed93[_0x7d55('0x16')]&&_0x2fed93[_0x7d55('0x16')]!==''?_0x2fed93[_0x7d55('0x16')]:_0x2fed93[_0x7d55('0x18')]||_0x2fed93[_0x7d55('0x15')];}BPromise['resolve']()[_0x7d55('0x19')](cmContactRpc[_0x7d55('0x1a')]({'where':_[_0x7d55('0x1b')](_0x304dd0,[_0x7d55('0x12')])}))[_0x7d55('0x19')](function(_0xd39a92){if(_0xd39a92){logger[_0x7d55('0x9')](_0x7d55('0x1c'),_0x2fed93[_0x7d55('0x15')],'',_0xd39a92['id']);if(_0x2dd177){_0x2fed93[_0x7d55('0x1d')]=_0xd39a92['id'];emit(_0x2fed93[_0x7d55('0x15')],util['format']('user:%s',_0x2dd177[_0x7d55('0x1e')]),util['format'](_0x7d55('0x1f'),_0x5bf6f7[_0x7d55('0x20')]['toLowerCase']()),_[_0x7d55('0x21')](_0x2fed93,{'ListId':parseInt(_0x5bf6f7['data1'],0xa)}));}return;}else{logger[_0x7d55('0x9')](_0x7d55('0x22'),_0x2fed93[_0x7d55('0x15')],'');return BPromise['resolve']()[_0x7d55('0x19')](cmContactRpc['createContact'](_0x304dd0));}})[_0x7d55('0x19')](function(_0x4804fe){if(_0x4804fe){logger['info'](_0x7d55('0x23'),_0x2fed93[_0x7d55('0x15')],'',_0x4804fe['id']);if(_0x2dd177){_0x2fed93[_0x7d55('0x1d')]=_0x4804fe['id'];emit(_0x2fed93['uniqueid'],util[_0x7d55('0x24')]('user:%s',_0x2dd177['name']),util[_0x7d55('0x24')](_0x7d55('0x1f'),_0x5bf6f7['action']['toLowerCase']()),_[_0x7d55('0x21')](_0x2fed93,{'ListId':parseInt(_0x5bf6f7[_0x7d55('0xf')],0xa)}));}}})[_0x7d55('0x25')](function(_0x2c901d){logger[_0x7d55('0x26')](_0x7d55('0x27'),_0x2fed93[_0x7d55('0x15')],'',JSON[_0x7d55('0xb')](_0x2c901d));});}else{if(_0x2dd177){logger[_0x7d55('0x9')](_0x7d55('0x28'),_0x2fed93[_0x7d55('0x15')],'');emit(_0x2fed93[_0x7d55('0x15')],util[_0x7d55('0x24')](_0x7d55('0x29'),_0x2dd177[_0x7d55('0x1e')]),util[_0x7d55('0x24')](_0x7d55('0x1f'),_0x5bf6f7[_0x7d55('0x20')][_0x7d55('0x2a')]()),_['merge']({'ListId':parseInt(_0x5bf6f7[_0x7d55('0xf')],0xa)},_0x2fed93));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 27e5d27..60b1846 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 _0xed8b=['message','event','membername','lastevent','routeId','util','lodash','url','mustache','./integration','./cmContact','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnoanswer','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:rejectmessage','info','stringify','prototype','clone','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','action','toLowerCase','motionbar','browser','popup','data2','template\x20not\x20found','uri','buildUri','isNil','data3','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','emit','format','user:%s','trigger:%s:%s','data1','jscripty','name','trigger:%s','contactmanager','integration','exec','queue','urlforward','script','parse','render','query','search','replace','length','every','checkConditions','channel','AnyConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId'];(function(_0x4a445b,_0x6a00ae){var _0x49d57a=function(_0x3a1a1c){while(--_0x3a1a1c){_0x4a445b['push'](_0x4a445b['shift']());}};_0x49d57a(++_0x6a00ae);}(_0xed8b,0x158));var _0xbed8=function(_0x28d6dc,_0x308af1){_0x28d6dc=_0x28d6dc-0x0;var _0x271d64=_0xed8b[_0x28d6dc];return _0x271d64;};'use strict';var util=require(_0xbed8('0x0'));var _=require(_0xbed8('0x1'));var url=require(_0xbed8('0x2'));var Mustache=require(_0xbed8('0x3'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0xbed8('0x4'));var cmContact=require(_0xbed8('0x5'));var script=require('./script');var cmContactRpc=require(_0xbed8('0x6'));var config=require(_0xbed8('0x7'));var logger=require(_0xbed8('0x8'))(_0xbed8('0x9'));var ami=require(_0xbed8('0xa'));config[_0xbed8('0xb')]=_[_0xbed8('0xc')](config[_0xbed8('0xb')],{'host':_0xbed8('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbed8('0xb')]));var operators={'equals':function(_0x4b4801,_0x4ac6e9){return _0x4b4801==_0x4ac6e9;},'not_equals':function(_0xc2156d,_0x3ffa6a){return _0xc2156d!=_0x3ffa6a;}};var barAndWebActions=['popup',_0xbed8('0x2'),_0xbed8('0xe')];function Trigger(_0x36f5a8){this['triggers']=_0x36f5a8[_0xbed8('0xf')];this[_0xbed8('0x10')]=_0x36f5a8[_0xbed8('0x10')];this[_0xbed8('0x11')]=_0x36f5a8['voiceQueues'];this['templates']=_0x36f5a8[_0xbed8('0x12')];this[_0xbed8('0x13')]=_0x36f5a8[_0xbed8('0x13')];this[_0xbed8('0x14')]=_0x36f5a8['zendeskAccounts'];this[_0xbed8('0x15')]=_0x36f5a8['freshdeskAccounts'];this[_0xbed8('0x16')]=_0x36f5a8[_0xbed8('0x16')];this[_0xbed8('0x17')]=_0x36f5a8[_0xbed8('0x17')];this['zohoAccounts']=_0x36f5a8['zohoAccounts'];this['deskAccounts']=_0x36f5a8[_0xbed8('0x18')];this[_0xbed8('0x19')]=_0x36f5a8[_0xbed8('0x19')];this[_0xbed8('0x1a')]=_0x36f5a8['servicenowAccounts'];this[_0xbed8('0x1b')]=_0x36f5a8['dynamics365Accounts'];this[_0xbed8('0x1c')]=_0x36f5a8[_0xbed8('0x1c')];this[_0xbed8('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xbed8('0x15')],'sugarcrm':this[_0xbed8('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xbed8('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xbed8('0x1b')],'freshsales':this[_0xbed8('0x1c')],'servicenow':this[_0xbed8('0x1a')]};ami['on'](_0xbed8('0x1e'),this[_0xbed8('0x1f')]['bind'](this));ami['on']('custom:agentconnect',this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on']('custom:agentringnoanswer',this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x21'),this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on']('custom:agentnosuchnumber',this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x22'),this[_0xbed8('0x1f')]['bind'](this));ami['on']('custom:agentbusy',this[_0xbed8('0x1f')]['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent']['bind'](this));ami['on'](_0xbed8('0x23'),this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x24'),this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x25'),this[_0xbed8('0x1f')]['bind'](this));ami['on'](_0xbed8('0x26'),this['syncAgentDial'][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x27'),this[_0xbed8('0x28')][_0xbed8('0x20')](this));ami['on']('custom:dialend',this[_0xbed8('0x28')][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x29'),this[_0xbed8('0x1f')]['bind'](this));ami['on'](_0xbed8('0x2a'),this['syncCustomEvent'][_0xbed8('0x20')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xbed8('0x20')](this));ami['on'](_0xbed8('0x2b'),this[_0xbed8('0x1f')][_0xbed8('0x20')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xbed8('0x2c'),this[_0xbed8('0x1f')][_0xbed8('0x20')](this));}Trigger['prototype']['emit']=function(_0x13eabe,_0xb75dbc,_0xc48ce5){logger[_0xbed8('0x2d')](_0x13eabe,_0xb75dbc,JSON[_0xbed8('0x2e')](_0xc48ce5));io['to'](_0x13eabe)['emit'](_0xb75dbc,_0xc48ce5);};Trigger[_0xbed8('0x2f')][_0xbed8('0x1f')]=function(_0x5afd63){var _0x1447c4=_[_0xbed8('0x30')](_0x5afd63);this[_0xbed8('0x31')](_0x1447c4);};Trigger['prototype'][_0xbed8('0x28')]=function(_0x6099ad){if(this['agents'][_0x6099ad[_0xbed8('0x32')]]){this[_0xbed8('0x1f')](_0x6099ad);}};Trigger[_0xbed8('0x2f')][_0xbed8('0x31')]=function(_0x74ca78){var _0x106482;for(var _0x5db509 in this['triggers']){if(this[_0xbed8('0xf')][_0xbed8('0x33')](_0x5db509)){if(this[_0xbed8('0xf')][_0x5db509]['status']){_0x106482=this[_0xbed8('0x34')](this['triggers'][_0x5db509],_0x74ca78);if(_0x106482){_[_0xbed8('0x35')](_0x74ca78,_0x74ca78[_0xbed8('0x36')]);for(var _0x57cc8e=0x0,_0x400cf6,_0x35798d,_0x37b5b0;_0x57cc8e0x0){_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(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 697d902..0905458 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 _0x2f84=['4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','systemuserid','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','calleridnum','/systemusers(','Bearer\x20','headers','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','destcalleridnum','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','string','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','Fields','phonecall','phonecalls','Subjects','/contacts(','queue','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid'];(function(_0x471ae2,_0x432b83){var _0xf3c37d=function(_0x71a9ef){while(--_0x71a9ef){_0x471ae2['push'](_0x471ae2['shift']());}};_0xf3c37d(++_0x432b83);}(_0x2f84,0x1c9));var _0x42f8=function(_0x505c32,_0x2643e5){_0x505c32=_0x505c32-0x0;var _0x1a280f=_0x2f84[_0x505c32];return _0x1a280f;};'use strict';var _=require(_0x42f8('0x0'));var BPromise=require('bluebird');var rp=require(_0x42f8('0x1'));var util=require(_0x42f8('0x2'));var intUtil=require(_0x42f8('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x42f8('0x4'))(_0x42f8('0x5'));var config=require(_0x42f8('0x6'));config[_0x42f8('0x7')]=_[_0x42f8('0x8')](config[_0x42f8('0x7')],{'host':_0x42f8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x42f8('0x7')]));function getAuthToken(_0x475a4c,_0x4a356e,_0x449330){var _0x5b88ce={'method':_0x42f8('0xa'),'uri':_0x4a356e,'form':{'client_id':_0x475a4c[_0x42f8('0xb')],'resource':_0x475a4c[_0x42f8('0xc')],'username':_0x475a4c[_0x42f8('0xd')],'password':_0x475a4c[_0x42f8('0xe')],'grant_type':_0x42f8('0xe'),'client_secret':_0x475a4c[_0x42f8('0xf')]},'json':!![]};return rp(_0x5b88ce)['then'](function(_0x202555){return _0x202555[_0x42f8('0x10')];})[_0x42f8('0x11')](function(_0x584d41){logger[_0x42f8('0x12')]('['+[_0x449330['toUpperCase']()]+_0x42f8('0x13'));return _0x584d41[_0x42f8('0x14')];});}function getUser(_0x1cf2bd,_0x41ce5e,_0xf182be,_0x395d99,_0x59bde3,_0x17472b){return new BPromise(function(_0x3eb775,_0x3fa7b){return getAuthToken(_0x41ce5e,_0x395d99,_0x17472b)[_0x42f8('0x15')](function(_0x2e7214){var _0x5f53f3={'method':'GET','uri':_0x59bde3+_0x42f8('0x16'),'headers':{'Authorization':'Bearer\x20'+_0x2e7214,'OData-Version':_0x42f8('0x17')},'json':!![]};return rp(_0x5f53f3);})[_0x42f8('0x15')](function(_0x2bc7a2){var _0x339315=_0x2bc7a2[_0x42f8('0x18')];var _0x9fe69a=![];var _0x536475=null;if(!_[_0x42f8('0x19')](_0xf182be)){if(intUtil[_0x42f8('0x1a')](_0xf182be[_0x42f8('0x1b')])){_0x1cf2bd[_0x42f8('0x1c')]=_0xf182be[_0x42f8('0x1b')];for(_0x536475=0x0;_0x536475<_0x339315[_0x42f8('0x1d')];_0x536475++){if(_0x339315[_0x536475][_0x42f8('0x1e')]===_0xf182be['email']&&!_0x339315[_0x536475][_0x42f8('0x1f')]){_0x9fe69a=!![];logger['info']('['+[_0x17472b['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x339315[_0x536475][_0x42f8('0x20')]+'!');_0x1cf2bd['userId']=_0x339315[_0x536475][_0x42f8('0x20')];}}}}if(!_0x9fe69a){logger[_0x42f8('0x21')]('['+[_0x17472b[_0x42f8('0x22')]()]+_0x42f8('0x23'));_0x1cf2bd[_0x42f8('0x1c')]=_0x41ce5e[_0x42f8('0xd')];for(_0x536475=0x0;_0x536475<_0x339315['length'];_0x536475++){if(_0x339315[_0x536475][_0x42f8('0x1e')]===_0x41ce5e[_0x42f8('0xd')]){_0x1cf2bd[_0x42f8('0x24')]=_0x339315[_0x536475][_0x42f8('0x20')];}}}_0x3eb775(_0x1cf2bd);})[_0x42f8('0x11')](function(_0x158547){_0x3fa7b(_0x158547[_0x42f8('0x14')]);});});}function createEndUser(_0x5778f0,_0x555504,_0x4834d0,_0x3b0456,_0x365fd5,_0x23b09e){return new BPromise(function(_0xf1c19,_0x293380){return getAuthToken(_0x555504,_0x4834d0,_0x23b09e)[_0x42f8('0x15')](function(_0x24f7aa){var _0x8b0eb2=_0x23b09e[_0x42f8('0x25')]()==='outbound'?_0x365fd5['destcalleridnum']:_0x365fd5[_0x42f8('0x26')];var _0x202ccc={'method':_0x42f8('0xa'),'uri':_0x3b0456+'contacts','body':{'telephone1':_0x8b0eb2,'fullname':_0x8b0eb2,'firstname':_0x8b0eb2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x42f8('0x27')+_0x5778f0[_0x42f8('0x24')]+')'},'headers':{'Authorization':_0x42f8('0x28')+_0x24f7aa,'OData-Version':_0x42f8('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x202ccc);})[_0x42f8('0x15')](function(_0xc1648){var _0x5353c1=_0xc1648[_0x42f8('0x29')]['odata-entityid'];var _0x43e986=_0x5353c1[_0x42f8('0x2a')](_0x5353c1[_0x42f8('0x2b')]('(')+0x1,_0x5353c1[_0x42f8('0x2b')](')'));_0x5778f0[_0x42f8('0x2c')]=_0x43e986;_0xf1c19(_0x5778f0);})[_0x42f8('0x11')](function(_0xc44544){_0x293380(_0xc44544[_0x42f8('0x14')]);});});}function getEndUser(_0x1fd916,_0x600d80,_0x25c80a,_0x293770,_0x51e516,_0x4cc4b2){return new BPromise(function(_0x5b7622,_0x104b9a){return getAuthToken(_0x600d80,_0x25c80a,_0x4cc4b2)[_0x42f8('0x15')](function(_0x71a14b){var _0x3d0b1e={'method':_0x42f8('0x2d'),'uri':_0x293770+_0x42f8('0x2e'),'headers':{'Authorization':_0x42f8('0x28')+_0x71a14b,'If-None-Match':null,'OData-Version':_0x42f8('0x17')},'json':!![]};return rp(_0x3d0b1e);})[_0x42f8('0x15')](function(_0x2573b1){var _0x45ae66=null;if(_0x2573b1){var _0x3091aa=_0x2573b1[_0x42f8('0x18')];var _0x521301=![];for(_0x45ae66=0x0;_0x45ae66<_0x3091aa[_0x42f8('0x1d')];_0x45ae66++){var _0x17ac53=_0x4cc4b2[_0x42f8('0x25')]()==='outbound'?_0x51e516[_0x42f8('0x2f')]:_0x51e516[_0x42f8('0x26')];if(_0x3091aa[_0x45ae66]['telephone1']===_0x17ac53){_0x521301=!![];_0x1fd916[_0x42f8('0x2c')]=_0x3091aa[_0x45ae66][_0x42f8('0x30')];}}if(_0x521301){_0x5b7622(_0x1fd916);}else{return createEndUser(_0x1fd916,_0x600d80,_0x25c80a,_0x293770,_0x51e516,_0x4cc4b2)[_0x42f8('0x15')](function(_0x50e5b6){logger[_0x42f8('0x21')]('['+[_0x4cc4b2[_0x42f8('0x22')]()]+_0x42f8('0x31'),_0x50e5b6[_0x42f8('0x2c')]);_0x5b7622(_0x50e5b6);});}}else{return createEndUser(_0x1fd916,_0x600d80,_0x25c80a,_0x293770,_0x51e516,_0x4cc4b2)['then'](function(_0x27f0f7){logger[_0x42f8('0x21')]('['+[_0x4cc4b2[_0x42f8('0x22')]()]+_0x42f8('0x32'),_0x27f0f7[_0x42f8('0x2c')]);_0x5b7622(_0x27f0f7);});}});});}function getCustomFields(_0x2de9e9,_0x3eddf1,_0x5e35ac){var _0x316991={};if(_0x2de9e9[_0x42f8('0x1d')]>0x0){_['forEach'](_0x2de9e9,function(_0x4f51c2){if(_0x4f51c2['type']===_0x42f8('0x33')&&_0x4f51c2['nameField']&&!_0x4f51c2['customField']){var _0x516470=_0x4f51c2['idField'][_0x42f8('0x25')]();var _0x54494f=_0x516470[_0x42f8('0x2a')](0x0,_0x516470[_0x42f8('0x34')]('_'));var _0x1d1190=_0x516470[_0x42f8('0x2a')](_0x516470['indexOf']('_')+0x1);if(_0x54494f===_0x5e35ac){_0x316991[_0x1d1190]=_0x4f51c2[_0x42f8('0x35')];}}});}return _0x316991;}function getTicket(_0x3ec6f0,_0x6b346d,_0x5f10d5,_0x34d4a4,_0x414a8a,_0x4468af,_0x5ce8fa){return new BPromise(function(_0x15afdf,_0x2827f6){var _0x2eba12;return getAuthToken(_0x6b346d,_0x5f10d5,_0x5ce8fa)['then'](function(_0x41719f){if(_0x4468af[_0x42f8('0x36')]===_0x42f8('0x37')){_0x2eba12={'method':'POST','uri':_0x34d4a4+_0x42f8('0x38'),'body':Object[_0x42f8('0x39')]({},{'title':intUtil[_0x42f8('0x3a')](_0x4468af['Subjects'],_0x414a8a,'\x20'),'description':intUtil[_0x42f8('0x3a')](_0x4468af[_0x42f8('0x3b')],_0x414a8a,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x3ec6f0[_0x42f8('0x2c')]+')','ownerid@odata.bind':_0x42f8('0x27')+_0x3ec6f0[_0x42f8('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x4468af[_0x42f8('0x3c')],_0x414a8a,_0x4468af[_0x42f8('0x36')])),'headers':{'Authorization':_0x42f8('0x28')+_0x41719f,'OData-Version':_0x42f8('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4468af[_0x42f8('0x36')]===_0x42f8('0x3d')){_0x2eba12={'method':_0x42f8('0xa'),'uri':_0x34d4a4+_0x42f8('0x3e'),'body':Object[_0x42f8('0x39')]({},{'subject':intUtil[_0x42f8('0x3a')](_0x4468af[_0x42f8('0x3f')],_0x414a8a,'\x20'),'phonenumber':String(_0x414a8a[_0x42f8('0x26')]),'description':intUtil[_0x42f8('0x3a')](_0x4468af['Descriptions'],_0x414a8a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x42f8('0x40')+_0x3ec6f0[_0x42f8('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x3ec6f0['userId']+')','directioncode':_0x3ec6f0['callDirection']===_0x42f8('0x41')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x42f8('0x27')+_0x3ec6f0['userId']+')','participationtypemask':_0x3ec6f0[_0x42f8('0x42')]===_0x42f8('0x41')?0x2:0x1},{'partyid_contact@odata.bind':_0x42f8('0x40')+_0x3ec6f0[_0x42f8('0x2c')]+')','participationtypemask':_0x3ec6f0[_0x42f8('0x42')]===_0x42f8('0x41')?0x1:0x2}]},getCustomFields(_0x4468af['Fields'],_0x414a8a,_0x4468af[_0x42f8('0x36')])),'headers':{'Authorization':'Bearer\x20'+_0x41719f,'OData-Version':_0x42f8('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2eba12);})[_0x42f8('0x15')](function(_0x2cd3dd){var _0x4159b5=_0x2cd3dd[_0x42f8('0x29')]['odata-entityid'];var _0x2244df=_0x4159b5['substring'](_0x4159b5[_0x42f8('0x2b')]('(')+0x1,_0x4159b5[_0x42f8('0x2b')](')'));_0x3ec6f0[_0x42f8('0x43')]=_0x2244df;_0x15afdf(_0x3ec6f0);})[_0x42f8('0x11')](function(_0xfba364){_0x2827f6(_0xfba364[_0x42f8('0x14')]);});});}function emit(_0x15b439,_0x5560c2,_0x533f40,_0x2dba16){var _0x1090ef={'uri':util[_0x42f8('0x44')](_0x42f8('0x45'),_0x15b439,_0x533f40,_0x2dba16)};io['to'](util[_0x42f8('0x44')](_0x42f8('0x46'),_0x5560c2))[_0x42f8('0x47')](_0x42f8('0x48'),_0x1090ef);}exports['cs']=function(_0x20e4e0,_0x564550,_0x11535f,_0x2c3c69,_0x88be50,_0x3bd005,_0x883d0,_0x45d888){var _0x498d35={};_0x3bd005['remoteUri']=intUtil[_0x42f8('0x49')](_0x3bd005['remoteUri']);_0x3bd005[_0x42f8('0x4a')]=intUtil[_0x42f8('0x49')](_0x3bd005['serverUrl']);_0x498d35[_0x42f8('0x42')]=_0x45d888===_0x42f8('0x41')||_0x45d888==='unmanaged'?_0x42f8('0x41'):_0x42f8('0x4b');var _0x1b1738=util[_0x42f8('0x44')](_0x42f8('0x4c'),_0x3bd005[_0x42f8('0xc')]);var _0x16c1f7=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x3bd005['tenantId']);var _0x514a10=util[_0x42f8('0x44')](_0x42f8('0x4d'),_0x3bd005[_0x42f8('0x4a')],_0x564550[_0x42f8('0x4e')],md5(_0x564550['uniqueid']));if(_0x88be50&&_0x88be50[_0x42f8('0x4f')]){logger['info']('[QUEUE]',_0x42f8('0x50'));_0x564550['recordingURL']=_0x514a10;}else if(_0x883d0&&_0x883d0['recordingFormat']&&_0x883d0[_0x42f8('0x51')]!==_0x42f8('0x52')){logger['info'](_0x42f8('0x53'),_0x42f8('0x50'));_0x564550[_0x42f8('0x54')]=_0x514a10;}else{_0x564550[_0x42f8('0x54')]='';}return getUser(_0x498d35,_0x3bd005,_0x2c3c69,_0x16c1f7,_0x1b1738,_0x45d888)[_0x42f8('0x15')](function(_0x1c7a74){logger[_0x42f8('0x21')]('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x55'),_0x1c7a74['userId']);logger['info']('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x56'),_0x1c7a74['userEmail']);return getEndUser(_0x1c7a74,_0x3bd005,_0x16c1f7,_0x1b1738,_0x564550,_0x45d888);})['then'](function(_0x3b9b2a){logger[_0x42f8('0x21')]('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x57'),_0x3b9b2a[_0x42f8('0x2c')]);logger['info']('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x58'),_0x564550['calleridnum']);return getTicket(_0x3b9b2a,_0x3bd005,_0x16c1f7,_0x1b1738,_0x564550,_0x11535f,_0x45d888);})[_0x42f8('0x15')](function(_0x52dba1){logger[_0x42f8('0x21')](util['format']('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x59'),_0x11535f[_0x42f8('0x36')],_0x52dba1[_0x42f8('0x43')]));logger[_0x42f8('0x21')](util[_0x42f8('0x44')]('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x5a'),_0x45d888));if(_0x45d888!==_0x42f8('0x5b')){logger['info']('['+_0x45d888[_0x42f8('0x22')]()+']',_0x42f8('0x5c'));emit(_0x3bd005[_0x42f8('0xc')],_0x2c3c69[_0x42f8('0x5d')],_0x11535f[_0x42f8('0x36')],_0x52dba1[_0x42f8('0x43')]);}})['catch'](function(_0x3780bb){logger[_0x42f8('0x12')]('['+_0x45d888[_0x42f8('0x22')]()+_0x42f8('0x5e'),util[_0x42f8('0x5f')](_0x3780bb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5c00=['callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','outbound','%s/api/data/v9.0/','remoteUri','tenantId','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','systemuserid','userId','userEmail','toLowerCase','destcalleridnum','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','Bearer\x20','calleridnum','telephone1','contactid',']\x20Enduser\x20Created!','nameField','indexOf','content','incident','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','assign'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x5c00,0x1e5));var _0x05c0=function(_0x128641,_0x1ec4c1){_0x128641=_0x128641-0x0;var _0x228d4c=_0x5c00[_0x128641];return _0x228d4c;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var intUtil=require(_0x05c0('0x2'));var md5=require(_0x05c0('0x3'));var Redis=require(_0x05c0('0x4'));var logger=require('../../../../config/logger')(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));config[_0x05c0('0x7')]=_[_0x05c0('0x8')](config[_0x05c0('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x05c0('0x9'))(new Redis(config[_0x05c0('0x7')]));function getAuthToken(_0x1a31a9,_0x4bac13,_0x54b67d){var _0x42a659={'method':_0x05c0('0xa'),'uri':_0x4bac13,'form':{'client_id':_0x1a31a9[_0x05c0('0xb')],'resource':_0x1a31a9['remoteUri'],'username':_0x1a31a9[_0x05c0('0xc')],'password':_0x1a31a9[_0x05c0('0xd')],'grant_type':'password','client_secret':_0x1a31a9['clientSecret']},'json':!![]};return rp(_0x42a659)[_0x05c0('0xe')](function(_0x421707){return _0x421707[_0x05c0('0xf')];})[_0x05c0('0x10')](function(_0x597efd){logger[_0x05c0('0x11')]('['+[_0x54b67d[_0x05c0('0x12')]()]+_0x05c0('0x13'));return _0x597efd[_0x05c0('0x14')];});}function getUser(_0x1345cf,_0x14d880,_0x3bfb22,_0x3f2fe5,_0x72b9cf,_0x2d85f1){return new BPromise(function(_0x13e08b,_0x49629b){return getAuthToken(_0x14d880,_0x3f2fe5,_0x2d85f1)['then'](function(_0x13c752){var _0x334a7c={'method':_0x05c0('0x15'),'uri':_0x72b9cf+_0x05c0('0x16'),'headers':{'Authorization':'Bearer\x20'+_0x13c752,'OData-Version':'4.0'},'json':!![]};return rp(_0x334a7c);})[_0x05c0('0xe')](function(_0xb7485f){var _0x40ed42=_0xb7485f['value'];var _0x95cde7=![];var _0x177243=null;if(!_[_0x05c0('0x17')](_0x3bfb22)){if(intUtil[_0x05c0('0x18')](_0x3bfb22[_0x05c0('0x19')])){_0x1345cf['userEmail']=_0x3bfb22[_0x05c0('0x19')];for(_0x177243=0x0;_0x177243<_0x40ed42[_0x05c0('0x1a')];_0x177243++){if(_0x40ed42[_0x177243][_0x05c0('0x1b')]===_0x3bfb22['email']&&!_0x40ed42[_0x177243][_0x05c0('0x1c')]){_0x95cde7=!![];logger[_0x05c0('0x1d')]('['+[_0x2d85f1[_0x05c0('0x12')]()]+']\x20Agent\x20found\x20'+_0x40ed42[_0x177243][_0x05c0('0x1e')]+'!');_0x1345cf[_0x05c0('0x1f')]=_0x40ed42[_0x177243][_0x05c0('0x1e')];}}}}if(!_0x95cde7){logger['info']('['+[_0x2d85f1[_0x05c0('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1345cf[_0x05c0('0x20')]=_0x14d880[_0x05c0('0xc')];for(_0x177243=0x0;_0x177243<_0x40ed42[_0x05c0('0x1a')];_0x177243++){if(_0x40ed42[_0x177243][_0x05c0('0x1b')]===_0x14d880['username']){_0x1345cf['userId']=_0x40ed42[_0x177243][_0x05c0('0x1e')];}}}_0x13e08b(_0x1345cf);})[_0x05c0('0x10')](function(_0x36aab5){_0x49629b(_0x36aab5[_0x05c0('0x14')]);});});}function createEndUser(_0x403eb4,_0x233d56,_0x2b11a5,_0x38d004,_0x1f70b4,_0x337b55){return new BPromise(function(_0x47ee45,_0x35ba10){return getAuthToken(_0x233d56,_0x2b11a5,_0x337b55)[_0x05c0('0xe')](function(_0x3ed7be){var _0x19d91e=_0x337b55[_0x05c0('0x21')]()==='outbound'?_0x1f70b4[_0x05c0('0x22')]:_0x1f70b4['calleridnum'];var _0x12db01={'method':'POST','uri':_0x38d004+'contacts','body':{'telephone1':_0x19d91e,'fullname':_0x19d91e,'firstname':_0x19d91e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x05c0('0x23')+_0x403eb4[_0x05c0('0x1f')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3ed7be,'OData-Version':_0x05c0('0x24')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x12db01);})[_0x05c0('0xe')](function(_0x38b32d){var _0x4f5347=_0x38b32d[_0x05c0('0x25')][_0x05c0('0x26')];var _0x1027d8=_0x4f5347[_0x05c0('0x27')](_0x4f5347[_0x05c0('0x28')]('(')+0x1,_0x4f5347[_0x05c0('0x28')](')'));_0x403eb4[_0x05c0('0x29')]=_0x1027d8;_0x47ee45(_0x403eb4);})[_0x05c0('0x10')](function(_0x5d6f6b){_0x35ba10(_0x5d6f6b['message']);});});}function getEndUser(_0x13ff10,_0x3f655a,_0x15da7c,_0x121b03,_0x4c4111,_0x15fc6b){return new BPromise(function(_0x2426d7,_0x4c7d8b){return getAuthToken(_0x3f655a,_0x15da7c,_0x15fc6b)[_0x05c0('0xe')](function(_0x545231){var _0x25571f={'method':_0x05c0('0x15'),'uri':_0x121b03+_0x05c0('0x2a'),'headers':{'Authorization':_0x05c0('0x2b')+_0x545231,'If-None-Match':null,'OData-Version':_0x05c0('0x24')},'json':!![]};return rp(_0x25571f);})[_0x05c0('0xe')](function(_0x439bae){var _0x5651a4=null;if(_0x439bae){var _0x12d326=_0x439bae['value'];var _0x46321d=![];for(_0x5651a4=0x0;_0x5651a4<_0x12d326['length'];_0x5651a4++){var _0x22ded2=_0x15fc6b[_0x05c0('0x21')]()==='outbound'?_0x4c4111[_0x05c0('0x22')]:_0x4c4111[_0x05c0('0x2c')];if(_0x12d326[_0x5651a4][_0x05c0('0x2d')]===_0x22ded2){_0x46321d=!![];_0x13ff10[_0x05c0('0x29')]=_0x12d326[_0x5651a4][_0x05c0('0x2e')];}}if(_0x46321d){_0x2426d7(_0x13ff10);}else{return createEndUser(_0x13ff10,_0x3f655a,_0x15da7c,_0x121b03,_0x4c4111,_0x15fc6b)[_0x05c0('0xe')](function(_0x7b10e7){logger[_0x05c0('0x1d')]('['+[_0x15fc6b[_0x05c0('0x12')]()]+']\x20Enduser\x20created!',_0x7b10e7['enduserId']);_0x2426d7(_0x7b10e7);});}}else{return createEndUser(_0x13ff10,_0x3f655a,_0x15da7c,_0x121b03,_0x4c4111,_0x15fc6b)['then'](function(_0x4fc5f2){logger[_0x05c0('0x1d')]('['+[_0x15fc6b[_0x05c0('0x12')]()]+_0x05c0('0x2f'),_0x4fc5f2[_0x05c0('0x29')]);_0x2426d7(_0x4fc5f2);});}});});}function getCustomFields(_0x6cd6d2,_0x1279b8,_0x405b9e){var _0x3c1bb0={};if(_0x6cd6d2['length']>0x0){_['forEach'](_0x6cd6d2,function(_0x3b168d){if(_0x3b168d['type']==='string'&&_0x3b168d[_0x05c0('0x30')]&&!_0x3b168d['customField']){var _0x532e6d=_0x3b168d['idField'][_0x05c0('0x21')]();var _0x54b6fb=_0x532e6d[_0x05c0('0x27')](0x0,_0x532e6d[_0x05c0('0x31')]('_'));var _0x1a2589=_0x532e6d[_0x05c0('0x27')](_0x532e6d['indexOf']('_')+0x1);if(_0x54b6fb===_0x405b9e){_0x3c1bb0[_0x1a2589]=_0x3b168d[_0x05c0('0x32')];}}});}return _0x3c1bb0;}function getTicket(_0x3eee66,_0x5e4c20,_0x13fd9a,_0x1169f6,_0x1f0e94,_0xc3bf50,_0x2a2298){return new BPromise(function(_0x400188,_0x1063ed){var _0xf51748;return getAuthToken(_0x5e4c20,_0x13fd9a,_0x2a2298)['then'](function(_0x31971b){if(_0xc3bf50['ticketType']===_0x05c0('0x33')){_0xf51748={'method':_0x05c0('0xa'),'uri':_0x1169f6+'incidents','body':Object['assign']({},{'title':intUtil[_0x05c0('0x34')](_0xc3bf50[_0x05c0('0x35')],_0x1f0e94,'\x20'),'description':intUtil[_0x05c0('0x34')](_0xc3bf50[_0x05c0('0x36')],_0x1f0e94,'\x0a'),'customerid_contact@odata.bind':_0x05c0('0x37')+_0x3eee66[_0x05c0('0x29')]+')','ownerid@odata.bind':_0x05c0('0x23')+_0x3eee66[_0x05c0('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0xc3bf50[_0x05c0('0x38')],_0x1f0e94,_0xc3bf50['ticketType'])),'headers':{'Authorization':_0x05c0('0x2b')+_0x31971b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xc3bf50[_0x05c0('0x39')]===_0x05c0('0x3a')){_0xf51748={'method':'POST','uri':_0x1169f6+_0x05c0('0x3b'),'body':Object[_0x05c0('0x3c')]({},{'subject':intUtil['getString'](_0xc3bf50[_0x05c0('0x35')],_0x1f0e94,'\x20'),'phonenumber':String(_0x1f0e94[_0x05c0('0x2c')]),'description':intUtil[_0x05c0('0x34')](_0xc3bf50['Descriptions'],_0x1f0e94,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x3eee66[_0x05c0('0x29')]+')','ownerid@odata.bind':_0x05c0('0x23')+_0x3eee66[_0x05c0('0x1f')]+')','directioncode':_0x3eee66[_0x05c0('0x3d')]===_0x05c0('0x3e')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x05c0('0x23')+_0x3eee66[_0x05c0('0x1f')]+')','participationtypemask':_0x3eee66['callDirection']===_0x05c0('0x3e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3eee66[_0x05c0('0x29')]+')','participationtypemask':_0x3eee66[_0x05c0('0x3d')]===_0x05c0('0x3e')?0x1:0x2}]},getCustomFields(_0xc3bf50['Fields'],_0x1f0e94,_0xc3bf50[_0x05c0('0x39')])),'headers':{'Authorization':_0x05c0('0x2b')+_0x31971b,'OData-Version':_0x05c0('0x24')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xf51748);})[_0x05c0('0xe')](function(_0x352d53){var _0x455bfb=_0x352d53[_0x05c0('0x25')][_0x05c0('0x26')];var _0x3a5d86=_0x455bfb[_0x05c0('0x27')](_0x455bfb[_0x05c0('0x28')]('(')+0x1,_0x455bfb['lastIndexOf'](')'));_0x3eee66[_0x05c0('0x3f')]=_0x3a5d86;_0x400188(_0x3eee66);})['catch'](function(_0x560697){_0x1063ed(_0x560697['message']);});});}function emit(_0x5df757,_0x3c6a05,_0x3342c0,_0x53ab0d){var _0x1a727b={'uri':util[_0x05c0('0x40')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5df757,_0x3342c0,_0x53ab0d)};io['to'](util[_0x05c0('0x40')](_0x05c0('0x41'),_0x3c6a05))[_0x05c0('0x42')](_0x05c0('0x43'),_0x1a727b);}exports['cs']=function(_0x100082,_0x454de9,_0x337b90,_0x335a5d,_0x12902f,_0x4ce431,_0x53fd8c,_0x4fff08){var _0x2a88e3={};_0x4ce431['remoteUri']=intUtil[_0x05c0('0x44')](_0x4ce431['remoteUri']);_0x4ce431['serverUrl']=intUtil[_0x05c0('0x44')](_0x4ce431['serverUrl']);_0x2a88e3[_0x05c0('0x3d')]=_0x4fff08===_0x05c0('0x3e')||_0x4fff08===_0x05c0('0x45')?_0x05c0('0x3e'):_0x05c0('0x46');var _0x427875=util[_0x05c0('0x40')](_0x05c0('0x47'),_0x4ce431[_0x05c0('0x48')]);var _0x2791d6=util[_0x05c0('0x40')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4ce431[_0x05c0('0x49')]);var _0x6cb950=util[_0x05c0('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ce431[_0x05c0('0x4a')],_0x454de9[_0x05c0('0x4b')],md5(_0x454de9[_0x05c0('0x4b')]));if(_0x12902f&&_0x12902f[_0x05c0('0x4c')]){logger[_0x05c0('0x1d')](_0x05c0('0x4d'),'Recording\x20is\x20enabled!');_0x454de9[_0x05c0('0x4e')]=_0x6cb950;}else if(_0x53fd8c&&_0x53fd8c[_0x05c0('0x4f')]&&_0x53fd8c[_0x05c0('0x4f')]!==_0x05c0('0x50')){logger[_0x05c0('0x1d')](_0x05c0('0x51'),_0x05c0('0x52'));_0x454de9[_0x05c0('0x4e')]=_0x6cb950;}else{_0x454de9[_0x05c0('0x4e')]='';}return getUser(_0x2a88e3,_0x4ce431,_0x335a5d,_0x2791d6,_0x427875,_0x4fff08)['then'](function(_0x1f3f41){logger[_0x05c0('0x1d')]('['+_0x4fff08[_0x05c0('0x12')]()+_0x05c0('0x53'),_0x1f3f41[_0x05c0('0x1f')]);logger[_0x05c0('0x1d')]('['+_0x4fff08[_0x05c0('0x12')]()+_0x05c0('0x54'),_0x1f3f41[_0x05c0('0x20')]);return getEndUser(_0x1f3f41,_0x4ce431,_0x2791d6,_0x427875,_0x454de9,_0x4fff08);})[_0x05c0('0xe')](function(_0x3e4c6f){logger[_0x05c0('0x1d')]('['+_0x4fff08['toUpperCase']()+_0x05c0('0x55'),_0x3e4c6f['enduserId']);logger[_0x05c0('0x1d')]('['+_0x4fff08[_0x05c0('0x12')]()+_0x05c0('0x56'),_0x454de9['calleridnum']);return getTicket(_0x3e4c6f,_0x4ce431,_0x2791d6,_0x427875,_0x454de9,_0x337b90,_0x4fff08);})['then'](function(_0x330c71){logger[_0x05c0('0x1d')](util[_0x05c0('0x40')]('['+_0x4fff08['toUpperCase']()+_0x05c0('0x57'),_0x337b90[_0x05c0('0x39')],_0x330c71[_0x05c0('0x3f')]));logger[_0x05c0('0x1d')](util[_0x05c0('0x40')]('['+_0x4fff08[_0x05c0('0x12')]()+_0x05c0('0x58'),_0x4fff08));if(_0x4fff08!==_0x05c0('0x45')){logger[_0x05c0('0x1d')]('['+_0x4fff08[_0x05c0('0x12')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4ce431[_0x05c0('0x48')],_0x335a5d['name'],_0x337b90[_0x05c0('0x39')],_0x330c71['ticketId']);}})['catch'](function(_0x561d56){logger['error']('['+_0x4fff08[_0x05c0('0x12')]()+_0x05c0('0x59'),util[_0x05c0('0x5a')](_0x561d56,{'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 887688b..799f7b3 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 _0x80d4=['%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','calleridnum','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','
','name','mapValues','keyBy','custom_fields','value','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','base64','debug','stringify','GET','map','type','nameField','customField','toLowerCase','content','toString','string','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x80d4,0x178));var _0x480d=function(_0x2de06e,_0x120bdc){_0x2de06e=_0x2de06e-0x0;var _0x3c4cad=_0x80d4[_0x2de06e];return _0x3c4cad;};'use strict';var _=require(_0x480d('0x0'));var rp=require(_0x480d('0x1'));var md5=require(_0x480d('0x2'));var util=require(_0x480d('0x3'));var Redis=require(_0x480d('0x4'));var intUtil=require(_0x480d('0x5'));var config=require(_0x480d('0x6'));var logger=require(_0x480d('0x7'))(_0x480d('0x8'));config[_0x480d('0x9')]=_['defaults'](config[_0x480d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x480d('0xa'))(new Redis(config[_0x480d('0x9')]));var headers={'Content-Type':_0x480d('0xb'),'Accept':_0x480d('0xb')};function emit(_0x278149,_0x501578,_0x572086){io['to'](_0x278149)[_0x480d('0xc')](_0x501578,_0x572086);}function getTicket(_0x284164,_0x18a8a3,_0x1258a8,_0x4ee652,_0x3b7e33){logger['info'](_0x480d('0xd'));var _0x32d2b4=_['merge']({'responder_id':_0x18a8a3['id'],'requester_id':_0x1258a8['id'],'name':util[_0x480d('0xe')](_0x480d('0xf'),_0x3b7e33[_0x480d('0x10')]),'phone':_0x3b7e33['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4ee652[_0x480d('0x11')],_0x3b7e33,'\x20'),'description':intUtil[_0x480d('0x12')](_0x4ee652[_0x480d('0x13')],_0x3b7e33,_0x480d('0x14')),'tags':getTags(_0x4ee652['Tags'],_0x480d('0x15'))},getCustomFields(_0x4ee652['Fields'],_0x3b7e33));_0x32d2b4['custom_fields']=_[_0x480d('0x16')](_[_0x480d('0x17')](_0x32d2b4[_0x480d('0x18')],'id'),_0x480d('0x19'));return request({'uri':util[_0x480d('0xe')]('%s/api/v2/tickets',_0x284164['remoteUri']),'method':_0x480d('0x1a'),'body':_0x32d2b4})[_0x480d('0x1b')](function(_0x51b160){logger[_0x480d('0x1c')](_0x480d('0x1d'));return _0x51b160;});}function getUser(_0xe3e266,_0x189aa6){if(intUtil[_0x480d('0x1e')](_0x189aa6)){return request({'uri':util[_0x480d('0xe')](_0x480d('0x1f'),_0xe3e266[_0x480d('0x20')]),'qs':{'email':_0x189aa6}})[_0x480d('0x1b')](function(_0x27c76b){if(_0x27c76b[_0x480d('0x21')]){logger[_0x480d('0x1c')](_0x480d('0x22'));return _[_0x480d('0x23')](_0x27c76b,function(_0x2a68){return _0x2a68[_0x480d('0x24')][_0x480d('0x25')]===_0x189aa6;});}else{logger['info'](_0x480d('0x26'));return request({'uri':util['format'](_0x480d('0x27'),_0xe3e266['remoteUri'])})[_0x480d('0x1b')](function(_0x395a42){logger[_0x480d('0x1c')](_0x480d('0x28'));return _0x395a42;});}});}else{logger[_0x480d('0x1c')](_0x480d('0x29'));return request({'uri':util['format'](_0x480d('0x27'),_0xe3e266['remoteUri'])})[_0x480d('0x1b')](function(_0x5405c7){logger[_0x480d('0x1c')](_0x480d('0x28'));return _0x5405c7;});}}function getEndUser(_0xf73565,_0x3fb13b,_0x46ccad){logger[_0x480d('0x1c')](_0x480d('0x2a'),_0x46ccad);return request({'uri':util[_0x480d('0xe')]('%s/api/v2/contacts',_0xf73565['remoteUri']),'qs':{'phone':_0x46ccad}})[_0x480d('0x1b')](function(_0x343bda){if(_0x343bda[_0x480d('0x21')]){logger[_0x480d('0x1c')](_0x480d('0x2b'));return _[_0x480d('0x23')](_0x343bda,{'phone':_0x46ccad});}else{logger[_0x480d('0x1c')](_0x480d('0x2c'));return request({'uri':util['format'](_0x480d('0x2d'),_0xf73565[_0x480d('0x20')]),'method':_0x480d('0x1a'),'body':{'name':_0x3fb13b,'phone':_0x46ccad}})[_0x480d('0x1b')](function(_0x15e863){logger[_0x480d('0x1c')]('Enduser\x20created.');return _0x15e863;});}});}function getAuth(_0x2c6fc3){return util[_0x480d('0xe')](_0x480d('0x2e'),new Buffer(_0x2c6fc3[_0x480d('0x2f')]+':X')['toString'](_0x480d('0x30')));}function request(_0x2f0c2d){logger[_0x480d('0x31')]('[HTTP]',JSON[_0x480d('0x32')](_0x2f0c2d));return rp(_['defaults'](_0x2f0c2d,{'method':_0x480d('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x1d8107,_0x30a8fe){var _0x24e1e1=[];if(_0x1d8107&&_0x1d8107[_0x480d('0x21')]>0x0){_0x24e1e1=_[_0x480d('0x34')](_0x1d8107,_0x30a8fe);}return _0x24e1e1;}function getCustomFields(_0x5d71b,_0x322f21){var _0x763817=[];var _0x1b81d2={'custom_fields':[]};if(_0x5d71b['length']>0x0){_['forEach'](_0x5d71b,function(_0x49e378){if(_0x49e378[_0x480d('0x35')]==='string'&&_0x49e378[_0x480d('0x36')]&&!_0x49e378[_0x480d('0x37')]){_0x1b81d2[_0x49e378[_0x480d('0x36')][_0x480d('0x38')]()]=_0x49e378[_0x480d('0x39')][_0x480d('0x3a')]();}else if(_0x49e378[_0x480d('0x35')]===_0x480d('0x3b')&&_0x49e378[_0x480d('0x3c')]&&_0x49e378[_0x480d('0x37')]){_0x1b81d2[_0x480d('0x18')][_0x480d('0x3d')]({'id':_0x49e378[_0x480d('0x3c')],'value':_0x49e378[_0x480d('0x39')]['toString']()});}else if(_0x49e378[_0x480d('0x35')]==='variable'&&_0x49e378['variableName']&&_0x49e378[_0x480d('0x3c')]&&_0x49e378[_0x480d('0x37')]){_0x322f21[_0x49e378[_0x480d('0x3e')]]&&_0x1b81d2[_0x480d('0x18')][_0x480d('0x3d')]({'id':_0x49e378[_0x480d('0x3c')],'value':_0x322f21[_0x49e378[_0x480d('0x3e')]][_0x480d('0x3a')]()});}else if(_0x49e378['type']===_0x480d('0x3f')&&_0x49e378[_0x480d('0x40')]&&_0x49e378[_0x480d('0x40')][_0x480d('0x15')]&&_0x49e378[_0x480d('0x3c')]&&_0x49e378[_0x480d('0x37')]){_0x322f21[_0x49e378[_0x480d('0x40')]['name'][_0x480d('0x38')]()]&&_0x1b81d2[_0x480d('0x18')][_0x480d('0x3d')]({'id':_0x49e378[_0x480d('0x3c')],'value':_0x322f21[_0x49e378[_0x480d('0x40')][_0x480d('0x15')]['toLowerCase']()]['toString']()});}});}return _0x1b81d2;}exports[_0x480d('0x41')]=function(_0x2fb1a1,_0x4c86e9,_0x2eb721,_0x5969b8,_0x557517,_0x4fe793){var _0x3dbfa6,_0x1ed519;_0x4fe793[_0x480d('0x20')]=intUtil[_0x480d('0x42')](_0x4fe793[_0x480d('0x20')]);_0x4fe793[_0x480d('0x43')]=intUtil[_0x480d('0x42')](_0x4fe793['serverUrl']);if(_0x557517&&_0x557517[_0x480d('0x44')]){logger[_0x480d('0x1c')](_0x480d('0x45'),_0x480d('0x46'));_0x4c86e9[_0x480d('0x47')]=util[_0x480d('0xe')](_0x480d('0x48'),_0x4fe793[_0x480d('0x43')],_0x4c86e9[_0x480d('0x49')],md5(_0x4c86e9['uniqueid']));}else{_0x4c86e9[_0x480d('0x47')]='';}headers['Authorization']=getAuth(_0x4fe793);return getUser(_0x4fe793,_0x5969b8[_0x480d('0x25')])['then'](function(_0x2c7e12){_0x3dbfa6=_0x2c7e12;logger[_0x480d('0x1c')](_0x480d('0x4a'),_0x3dbfa6['id']);return getEndUser(_0x4fe793,_0x4c86e9[_0x480d('0x10')],_0x4c86e9['calleridnum']);})['then'](function(_0x4e7f20){_0x1ed519=_0x4e7f20;logger[_0x480d('0x1c')](_0x480d('0x4b'),_0x1ed519['id']);return getTicket(_0x4fe793,_0x3dbfa6,_0x1ed519,_0x2eb721,_0x4c86e9);})[_0x480d('0x1b')](function(_0x139b4f){if(_0x139b4f&&_0x139b4f['id']){logger[_0x480d('0x1c')]('Ticket\x20created!');logger[_0x480d('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x139b4f['id']);logger[_0x480d('0x1c')](_0x480d('0x45'),_0x480d('0x4c'));emit(util['format'](_0x480d('0x4d'),_0x5969b8[_0x480d('0x15')]),_0x480d('0x4e'),{'uri':util[_0x480d('0xe')](_0x480d('0x4f'),_0x4fe793[_0x480d('0x20')],_0x139b4f['id'])});}})[_0x480d('0x50')](function(_0x31a905){logger[_0x480d('0x51')](_0x480d('0x45'),JSON[_0x480d('0x32')](_0x31a905));});};exports['outbound']=function(_0x39c427,_0x48a43b,_0xd4a9af,_0x57c1f3,_0x1a459b,_0x7c4cd1,_0xe02855){var _0x4d8669,_0x388bfd;_0x7c4cd1['remoteUri']=intUtil[_0x480d('0x42')](_0x7c4cd1[_0x480d('0x20')]);_0x7c4cd1[_0x480d('0x43')]=intUtil['stripTrailingSlash'](_0x7c4cd1['serverUrl']);if(_0xe02855&&_0xe02855[_0x480d('0x52')]&&_0xe02855[_0x480d('0x52')]!==_0x480d('0x53')){logger[_0x480d('0x1c')](_0x480d('0x54'),'Recording\x20is\x20enabled!');_0x48a43b['recordingURL']=util[_0x480d('0xe')](_0x480d('0x48'),_0x7c4cd1[_0x480d('0x43')],_0x48a43b[_0x480d('0x49')],md5(_0x48a43b[_0x480d('0x49')]));}headers[_0x480d('0x55')]=getAuth(_0x7c4cd1);return getUser(_0x7c4cd1,_0x57c1f3['email'])['then'](function(_0x128164){_0x4d8669=_0x128164;logger['info'](_0x480d('0x4a'),_0x4d8669['id']);return getEndUser(_0x7c4cd1,_0x48a43b['destcalleridname'],_0x48a43b[_0x480d('0x56')]);})[_0x480d('0x1b')](function(_0x1bb693){_0x388bfd=_0x1bb693;logger[_0x480d('0x1c')](_0x480d('0x4b'),_0x388bfd['id']);return getTicket(_0x7c4cd1,_0x4d8669,_0x388bfd,_0xd4a9af,_0x48a43b);})[_0x480d('0x1b')](function(_0x48a81c){if(_0x48a81c&&_0x48a81c['id']){logger[_0x480d('0x1c')](_0x480d('0x1d'));logger[_0x480d('0x1c')](_0x480d('0x57'),_0x48a81c['id']);logger[_0x480d('0x1c')](_0x480d('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x480d('0xe')]('user:%s',_0x57c1f3[_0x480d('0x15')]),'trigger:browser:url',{'uri':util[_0x480d('0xe')](_0x480d('0x4f'),_0x7c4cd1[_0x480d('0x20')],_0x48a81c['id'])});}})[_0x480d('0x50')](function(_0x1d735b){logger[_0x480d('0x51')](_0x480d('0x54'),JSON[_0x480d('0x32')](_0x1d735b));});};exports[_0x480d('0x58')]=function(_0x3c9bd5,_0x8d3ad3,_0x22dca3,_0x5607cb,_0x413d48,_0x132f8c){var _0x174b99,_0x2aa320;_0x132f8c['remoteUri']=intUtil[_0x480d('0x42')](_0x132f8c['remoteUri']);_0x132f8c['serverUrl']=intUtil['stripTrailingSlash'](_0x132f8c['serverUrl']);if(_0x413d48&&_0x413d48[_0x480d('0x44')]){logger['info']('['+_0x8d3ad3['lastevent']['toUpperCase']()+']',_0x480d('0x46'));_0x8d3ad3[_0x480d('0x47')]=util[_0x480d('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x132f8c['serverUrl'],_0x8d3ad3[_0x480d('0x49')],md5(_0x8d3ad3[_0x480d('0x49')]));}else{_0x8d3ad3[_0x480d('0x47')]='';}headers[_0x480d('0x55')]=getAuth(_0x132f8c);return getUser(_0x132f8c,'')[_0x480d('0x1b')](function(_0x203c48){_0x174b99=_0x203c48;logger['info'](_0x480d('0x4a'),_0x174b99['id']);return getEndUser(_0x132f8c,_0x8d3ad3['calleridname'],_0x8d3ad3[_0x480d('0x59')]);})[_0x480d('0x1b')](function(_0x36578f){_0x2aa320=_0x36578f;logger[_0x480d('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x2aa320['id']);return getTicket(_0x132f8c,_0x174b99,_0x2aa320,_0x22dca3,_0x8d3ad3);})[_0x480d('0x1b')](function(_0x5954a6){if(_0x5954a6){logger[_0x480d('0x1c')](_0x480d('0x1d'));logger[_0x480d('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x5954a6['id']);}})[_0x480d('0x50')](function(_0x3dda51){logger[_0x480d('0x51')]('['+_0x8d3ad3[_0x480d('0x5a')]['toUpperCase']()+']',JSON['stringify'](_0x3dda51));});}; \ No newline at end of file +var _0xb8ba=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Ticket\x20created!','[OUTBOUND]','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','lastevent','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','mapValues','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET','map','string','nameField','toLowerCase','type','idField','push','content','variable','variableName','customField','customVariable','Variable','queue','serverUrl','stripTrailingSlash'];(function(_0x5116c8,_0x4db281){var _0x5129b0=function(_0x1b8429){while(--_0x1b8429){_0x5116c8['push'](_0x5116c8['shift']());}};_0x5129b0(++_0x4db281);}(_0xb8ba,0x18e));var _0xab8b=function(_0x2fb051,_0x444de1){_0x2fb051=_0x2fb051-0x0;var _0x5aa57d=_0xb8ba[_0x2fb051];return _0x5aa57d;};'use strict';var _=require('lodash');var rp=require(_0xab8b('0x0'));var md5=require(_0xab8b('0x1'));var util=require(_0xab8b('0x2'));var Redis=require(_0xab8b('0x3'));var intUtil=require('./util');var config=require(_0xab8b('0x4'));var logger=require(_0xab8b('0x5'))(_0xab8b('0x6'));config[_0xab8b('0x7')]=_[_0xab8b('0x8')](config[_0xab8b('0x7')],{'host':_0xab8b('0x9'),'port':0x18eb});var io=require(_0xab8b('0xa'))(new Redis(config[_0xab8b('0x7')]));var headers={'Content-Type':_0xab8b('0xb'),'Accept':_0xab8b('0xb')};function emit(_0x5ba518,_0xeb844b,_0x1f430f){io['to'](_0x5ba518)[_0xab8b('0xc')](_0xeb844b,_0x1f430f);}function getTicket(_0xf140fb,_0x252269,_0x34cbb2,_0x16576c,_0x38a9d9){logger[_0xab8b('0xd')](_0xab8b('0xe'));var _0x332059=_[_0xab8b('0xf')]({'responder_id':_0x252269['id'],'requester_id':_0x34cbb2['id'],'name':util[_0xab8b('0x10')](_0xab8b('0x11'),_0x38a9d9[_0xab8b('0x12')]),'phone':_0x38a9d9[_0xab8b('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xab8b('0x14')](_0x16576c['Subjects'],_0x38a9d9,'\x20'),'description':intUtil['getString'](_0x16576c[_0xab8b('0x15')],_0x38a9d9,_0xab8b('0x16')),'tags':getTags(_0x16576c[_0xab8b('0x17')],_0xab8b('0x18'))},getCustomFields(_0x16576c[_0xab8b('0x19')],_0x38a9d9));_0x332059['custom_fields']=_[_0xab8b('0x1a')](_['keyBy'](_0x332059[_0xab8b('0x1b')],'id'),_0xab8b('0x1c'));return request({'uri':util[_0xab8b('0x10')](_0xab8b('0x1d'),_0xf140fb[_0xab8b('0x1e')]),'method':_0xab8b('0x1f'),'body':_0x332059})[_0xab8b('0x20')](function(_0x4b9af4){logger[_0xab8b('0xd')]('Ticket\x20created!');return _0x4b9af4;});}function getUser(_0x53ab24,_0x33a52f){if(intUtil['validateEmail'](_0x33a52f)){return request({'uri':util[_0xab8b('0x10')]('%s/api/v2/agents',_0x53ab24[_0xab8b('0x1e')]),'qs':{'email':_0x33a52f}})[_0xab8b('0x20')](function(_0x188649){if(_0x188649[_0xab8b('0x21')]){logger['info'](_0xab8b('0x22'));return _[_0xab8b('0x23')](_0x188649,function(_0x58b9b3){return _0x58b9b3['contact'][_0xab8b('0x24')]===_0x33a52f;});}else{logger[_0xab8b('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xab8b('0x10')](_0xab8b('0x25'),_0x53ab24[_0xab8b('0x1e')])})[_0xab8b('0x20')](function(_0x422275){logger[_0xab8b('0xd')](_0xab8b('0x26'));return _0x422275;});}});}else{logger[_0xab8b('0xd')](_0xab8b('0x27'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x53ab24['remoteUri'])})['then'](function(_0x3d08d5){logger[_0xab8b('0xd')](_0xab8b('0x26'));return _0x3d08d5;});}}function getEndUser(_0x3e6d4c,_0xab6272,_0x4980e4){logger[_0xab8b('0xd')](_0xab8b('0x28'),_0x4980e4);return request({'uri':util[_0xab8b('0x10')]('%s/api/v2/contacts',_0x3e6d4c[_0xab8b('0x1e')]),'qs':{'phone':_0x4980e4}})[_0xab8b('0x20')](function(_0x219369){if(_0x219369[_0xab8b('0x21')]){logger['info'](_0xab8b('0x29'));return _[_0xab8b('0x23')](_0x219369,{'phone':_0x4980e4});}else{logger['info'](_0xab8b('0x2a'));return request({'uri':util[_0xab8b('0x10')](_0xab8b('0x2b'),_0x3e6d4c[_0xab8b('0x1e')]),'method':_0xab8b('0x1f'),'body':{'name':_0xab6272,'phone':_0x4980e4}})['then'](function(_0x4d93dc){logger['info'](_0xab8b('0x2c'));return _0x4d93dc;});}});}function getAuth(_0x5e995d){return util[_0xab8b('0x10')](_0xab8b('0x2d'),new Buffer(_0x5e995d[_0xab8b('0x2e')]+':X')[_0xab8b('0x2f')](_0xab8b('0x30')));}function request(_0x1538d0){logger['debug'](_0xab8b('0x31'),JSON['stringify'](_0x1538d0));return rp(_[_0xab8b('0x8')](_0x1538d0,{'method':_0xab8b('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x56d9c4,_0x4391b7){var _0x2c5d21=[];if(_0x56d9c4&&_0x56d9c4[_0xab8b('0x21')]>0x0){_0x2c5d21=_[_0xab8b('0x33')](_0x56d9c4,_0x4391b7);}return _0x2c5d21;}function getCustomFields(_0x6989d7,_0x578dc9){var _0x422679=[];var _0x1537db={'custom_fields':[]};if(_0x6989d7['length']>0x0){_['forEach'](_0x6989d7,function(_0x1480e0){if(_0x1480e0['type']===_0xab8b('0x34')&&_0x1480e0[_0xab8b('0x35')]&&!_0x1480e0['customField']){_0x1537db[_0x1480e0[_0xab8b('0x35')][_0xab8b('0x36')]()]=_0x1480e0['content'][_0xab8b('0x2f')]();}else if(_0x1480e0[_0xab8b('0x37')]===_0xab8b('0x34')&&_0x1480e0[_0xab8b('0x38')]&&_0x1480e0['customField']){_0x1537db[_0xab8b('0x1b')][_0xab8b('0x39')]({'id':_0x1480e0['idField'],'value':_0x1480e0[_0xab8b('0x3a')][_0xab8b('0x2f')]()});}else if(_0x1480e0['type']===_0xab8b('0x3b')&&_0x1480e0[_0xab8b('0x3c')]&&_0x1480e0[_0xab8b('0x38')]&&_0x1480e0[_0xab8b('0x3d')]){_0x578dc9[_0x1480e0[_0xab8b('0x3c')]]&&_0x1537db['custom_fields'][_0xab8b('0x39')]({'id':_0x1480e0[_0xab8b('0x38')],'value':_0x578dc9[_0x1480e0['variableName']][_0xab8b('0x2f')]()});}else if(_0x1480e0[_0xab8b('0x37')]===_0xab8b('0x3e')&&_0x1480e0[_0xab8b('0x3f')]&&_0x1480e0[_0xab8b('0x3f')][_0xab8b('0x18')]&&_0x1480e0[_0xab8b('0x38')]&&_0x1480e0[_0xab8b('0x3d')]){_0x578dc9[_0x1480e0[_0xab8b('0x3f')][_0xab8b('0x18')][_0xab8b('0x36')]()]&&_0x1537db[_0xab8b('0x1b')][_0xab8b('0x39')]({'id':_0x1480e0[_0xab8b('0x38')],'value':_0x578dc9[_0x1480e0['Variable'][_0xab8b('0x18')][_0xab8b('0x36')]()][_0xab8b('0x2f')]()});}});}return _0x1537db;}exports[_0xab8b('0x40')]=function(_0xf389f7,_0x5e7c35,_0x1bc41c,_0x15476e,_0xb75e4c,_0x2cbd0c){var _0x3fb950,_0x547074;_0x2cbd0c['remoteUri']=intUtil['stripTrailingSlash'](_0x2cbd0c[_0xab8b('0x1e')]);_0x2cbd0c[_0xab8b('0x41')]=intUtil[_0xab8b('0x42')](_0x2cbd0c[_0xab8b('0x41')]);if(_0xb75e4c&&_0xb75e4c['monitor_format']){logger[_0xab8b('0xd')](_0xab8b('0x43'),_0xab8b('0x44'));_0x5e7c35[_0xab8b('0x45')]=util[_0xab8b('0x10')](_0xab8b('0x46'),_0x2cbd0c[_0xab8b('0x41')],_0x5e7c35[_0xab8b('0x47')],md5(_0x5e7c35[_0xab8b('0x47')]));}else{_0x5e7c35['recordingURL']='';}headers[_0xab8b('0x48')]=getAuth(_0x2cbd0c);return getUser(_0x2cbd0c,_0x15476e['email'])['then'](function(_0x5c2433){_0x3fb950=_0x5c2433;logger[_0xab8b('0xd')](_0xab8b('0x49'),_0x3fb950['id']);return getEndUser(_0x2cbd0c,_0x5e7c35[_0xab8b('0x12')],_0x5e7c35['calleridnum']);})[_0xab8b('0x20')](function(_0x9c2249){_0x547074=_0x9c2249;logger['info'](_0xab8b('0x4a'),_0x547074['id']);return getTicket(_0x2cbd0c,_0x3fb950,_0x547074,_0x1bc41c,_0x5e7c35);})[_0xab8b('0x20')](function(_0xa17167){if(_0xa17167&&_0xa17167['id']){logger[_0xab8b('0xd')]('Ticket\x20created!');logger[_0xab8b('0xd')](_0xab8b('0x4b'),_0xa17167['id']);logger['info'](_0xab8b('0x43'),_0xab8b('0x4c'));emit(util[_0xab8b('0x10')](_0xab8b('0x4d'),_0x15476e[_0xab8b('0x18')]),'trigger:browser:url',{'uri':util[_0xab8b('0x10')]('%s/helpdesk/tickets/%d',_0x2cbd0c[_0xab8b('0x1e')],_0xa17167['id'])});}})[_0xab8b('0x4e')](function(_0x179ccb){logger[_0xab8b('0x4f')]('[QUEUE]',JSON[_0xab8b('0x50')](_0x179ccb));});};exports[_0xab8b('0x51')]=function(_0x2ac281,_0x4d1e67,_0x39436c,_0x5e495c,_0x4885bd,_0x344757,_0x3ede86){var _0x4d0e3a,_0x102478;_0x344757[_0xab8b('0x1e')]=intUtil[_0xab8b('0x42')](_0x344757['remoteUri']);_0x344757['serverUrl']=intUtil[_0xab8b('0x42')](_0x344757[_0xab8b('0x41')]);if(_0x3ede86&&_0x3ede86['recordingFormat']&&_0x3ede86[_0xab8b('0x52')]!==_0xab8b('0x53')){logger[_0xab8b('0xd')]('[OUTBOUND]',_0xab8b('0x44'));_0x4d1e67[_0xab8b('0x45')]=util['format'](_0xab8b('0x46'),_0x344757[_0xab8b('0x41')],_0x4d1e67[_0xab8b('0x47')],md5(_0x4d1e67[_0xab8b('0x47')]));}headers[_0xab8b('0x48')]=getAuth(_0x344757);return getUser(_0x344757,_0x5e495c[_0xab8b('0x24')])[_0xab8b('0x20')](function(_0x2ddd88){_0x4d0e3a=_0x2ddd88;logger['info'](_0xab8b('0x49'),_0x4d0e3a['id']);return getEndUser(_0x344757,_0x4d1e67[_0xab8b('0x54')],_0x4d1e67[_0xab8b('0x55')]);})[_0xab8b('0x20')](function(_0x45d3fa){_0x102478=_0x45d3fa;logger[_0xab8b('0xd')](_0xab8b('0x4a'),_0x102478['id']);return getTicket(_0x344757,_0x4d0e3a,_0x102478,_0x39436c,_0x4d1e67);})[_0xab8b('0x20')](function(_0x5186ee){if(_0x5186ee&&_0x5186ee['id']){logger[_0xab8b('0xd')](_0xab8b('0x56'));logger['info'](_0xab8b('0x4b'),_0x5186ee['id']);logger['info'](_0xab8b('0x57'),_0xab8b('0x4c'));emit(util[_0xab8b('0x10')](_0xab8b('0x4d'),_0x5e495c[_0xab8b('0x18')]),_0xab8b('0x58'),{'uri':util['format'](_0xab8b('0x59'),_0x344757[_0xab8b('0x1e')],_0x5186ee['id'])});}})['catch'](function(_0x592ab9){logger['error'](_0xab8b('0x57'),JSON[_0xab8b('0x50')](_0x592ab9));});};exports[_0xab8b('0x5a')]=function(_0x5540ca,_0x3f8254,_0x35a370,_0x73e98a,_0x2524a1,_0x48aac1){var _0x4efff7,_0x4b5944;_0x48aac1[_0xab8b('0x1e')]=intUtil[_0xab8b('0x42')](_0x48aac1['remoteUri']);_0x48aac1[_0xab8b('0x41')]=intUtil[_0xab8b('0x42')](_0x48aac1['serverUrl']);if(_0x2524a1&&_0x2524a1['monitor_format']){logger[_0xab8b('0xd')]('['+_0x3f8254['lastevent'][_0xab8b('0x5b')]()+']',_0xab8b('0x44'));_0x3f8254[_0xab8b('0x45')]=util[_0xab8b('0x10')](_0xab8b('0x46'),_0x48aac1[_0xab8b('0x41')],_0x3f8254[_0xab8b('0x47')],md5(_0x3f8254['uniqueid']));}else{_0x3f8254[_0xab8b('0x45')]='';}headers[_0xab8b('0x48')]=getAuth(_0x48aac1);return getUser(_0x48aac1,'')[_0xab8b('0x20')](function(_0x4097ec){_0x4efff7=_0x4097ec;logger[_0xab8b('0xd')](_0xab8b('0x49'),_0x4efff7['id']);return getEndUser(_0x48aac1,_0x3f8254[_0xab8b('0x12')],_0x3f8254['calleridnum']);})[_0xab8b('0x20')](function(_0x1a01a5){_0x4b5944=_0x1a01a5;logger[_0xab8b('0xd')](_0xab8b('0x4a'),_0x4b5944['id']);return getTicket(_0x48aac1,_0x4efff7,_0x4b5944,_0x35a370,_0x3f8254);})['then'](function(_0x41e051){if(_0x41e051){logger[_0xab8b('0xd')](_0xab8b('0x56'));logger[_0xab8b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x41e051['id']);}})[_0xab8b('0x4e')](function(_0x5a44a5){logger['error']('['+_0x3f8254[_0xab8b('0x5c')][_0xab8b('0x5b')]()+']',JSON['stringify'](_0x5a44a5));});}; \ 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 aee6702..aac90ce 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 _0x9e07=['/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','userEmail','length','User\x20found:','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','contactNumber','contacts','find','mobile_number','endUserId','Contact\x20created:','POST'];(function(_0x16aa6e,_0x351c15){var _0x558b22=function(_0x30a6c0){while(--_0x30a6c0){_0x16aa6e['push'](_0x16aa6e['shift']());}};_0x558b22(++_0x351c15);}(_0x9e07,0x1cf));var _0x79e0=function(_0x4502b6,_0x53188c){_0x4502b6=_0x4502b6-0x0;var _0x40a04b=_0x9e07[_0x4502b6];return _0x40a04b;};'use strict';var _=require(_0x79e0('0x0'));var rp=require(_0x79e0('0x1'));var md5=require('md5');var util=require(_0x79e0('0x2'));var moment=require(_0x79e0('0x3'));var Promise=require(_0x79e0('0x4'));var Redis=require(_0x79e0('0x5'));var intUtil=require('./util');var config=require(_0x79e0('0x6'));var logger=require(_0x79e0('0x7'))(_0x79e0('0x8'));config['redis']=_[_0x79e0('0x9')](config[_0x79e0('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x79e0('0xb'))(new Redis(config['redis']));function getAdminId(_0x445b8c,_0x6b7585,_0x1316d7,_0x2e3b72){return new Promise(function(_0x58a0bd,_0x19da7f){var _0x583191=![];var _0x57657f={'method':_0x79e0('0xc'),'uri':_0x2e3b72+_0x79e0('0xd'),'json':!![]};_0x57657f['headers']=_0x1316d7;logger[_0x79e0('0xe')](_0x79e0('0xf'));return rp(_0x57657f)[_0x79e0('0x10')](function(_0x4445c3){if(_0x4445c3){var _0x5710d8=_0x4445c3['users'];var _0x12fee4=null;for(_0x12fee4=0x0;_0x12fee4<_0x5710d8['length'];_0x12fee4++){if(_0x5710d8[_0x12fee4][_0x79e0('0x11')]===_0x445b8c[_0x79e0('0x12')]){_0x445b8c[_0x79e0('0x13')]=_0x5710d8[_0x12fee4]['id'];_0x583191=!![];}}if(_0x583191){logger[_0x79e0('0xe')](_0x79e0('0x14'),_0x445b8c[_0x79e0('0x13')]);_0x58a0bd(_0x445b8c);}else{_0x19da7f({'statusCode':0x194,'message':_0x79e0('0x15')});}}else{_0x19da7f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x79e0('0x16')](function(_0x16f93f){logger[_0x79e0('0x17')]('['+[_0x6b7585[_0x79e0('0x18')]()]+']',_0x16f93f[_0x79e0('0x19')]);_0x19da7f(_0x16f93f);});});}function getUser(_0x296f1e,_0x43685c,_0x95c6cb){return function(_0x4554e6){return new Promise(function(_0x49a7ee,_0x173a4e){var _0x2a1169={'method':_0x79e0('0xc'),'uri':_0x95c6cb+_0x79e0('0xd'),'json':!![]};_0x2a1169[_0x79e0('0x1a')]=_0x43685c;logger[_0x79e0('0xe')](_0x79e0('0x1b'));return rp(_0x2a1169)[_0x79e0('0x10')](function(_0xcb4907){if(_0xcb4907){var _0x2b8ba4=_0xcb4907['users'];var _0x254fc4=![];var _0x6f594=null;if(_0x4554e6[_0x79e0('0x1c')]!==null){logger[_0x79e0('0xe')]('Getting\x20user\x20with\x20email',_0x4554e6['agentEmail']);_0x4554e6[_0x79e0('0x1d')]=_0x4554e6[_0x79e0('0x1c')];for(_0x6f594=0x0;_0x6f594<_0x2b8ba4[_0x79e0('0x1e')];_0x6f594++){if(_0x2b8ba4[_0x6f594][_0x79e0('0x11')]===_0x4554e6[_0x79e0('0x1c')]){_0x254fc4=!![];_0x4554e6['userId']=_0x2b8ba4[_0x6f594]['id'];logger[_0x79e0('0xe')](_0x79e0('0x1f'),_0x4554e6[_0x79e0('0x20')]);}}}if(!_0x254fc4){logger[_0x79e0('0xe')](_0x79e0('0x21'));_0x4554e6['userEmail']=_0x4554e6[_0x79e0('0x12')];_0x4554e6[_0x79e0('0x20')]=_0x4554e6[_0x79e0('0x13')];_0x254fc4=!![];}if(_0x254fc4){_0x49a7ee(_0x4554e6);}else{_0x173a4e({'statusCode':0x194,'message':_0x79e0('0x15')});}}else{_0x173a4e({'statusCode':0x194,'message':_0x79e0('0x15')});}})['catch'](function(_0x42c902){logger[_0x79e0('0x17')]('['+[_0x296f1e[_0x79e0('0x18')]()]+']',_0x42c902[_0x79e0('0x19')]);_0x173a4e(_0x42c902);});});};}function getEndUser(_0x47321c,_0x337bba,_0xd273ea){return function(_0x29c6f5){return new Promise(function(_0x343da3,_0x2a3cc6){var _0x15b7fe=0x0;var _0x31a872={'method':'GET','uri':_0xd273ea+_0x79e0('0x22'),'json':!![]};_0x31a872[_0x79e0('0x1a')]=_0x337bba;logger[_0x79e0('0xe')](_0x79e0('0x23'));return rp(_0x31a872)[_0x79e0('0x10')](function(_0x5e0178){_0x5e0178['filters'][_0x79e0('0x24')](function(_0x19f73f){if(_0x19f73f['name']===_0x79e0('0x25')){_0x15b7fe=_0x19f73f['id'];}});})[_0x79e0('0x10')](function(){logger[_0x79e0('0xe')](_0x79e0('0x26'));var _0x189f59={'method':_0x79e0('0xc'),'uri':_0xd273ea+_0x79e0('0x27')+_0x15b7fe,'json':!![]};_0x189f59[_0x79e0('0x1a')]=_0x337bba;return rp(_0x189f59);})['then'](function(_0x5f2951){logger[_0x79e0('0xe')]('Searching\x20contact\x20with\x20phone',_0x29c6f5[_0x79e0('0x28')]);if(_0x5f2951[_0x79e0('0x29')][_0x79e0('0x1e')]>0x0){var _0x1a8a67=_[_0x79e0('0x2a')](_0x5f2951[_0x79e0('0x29')],function(_0x418946){if(_0x418946['work_number']===_0x29c6f5[_0x79e0('0x28')]||_0x418946[_0x79e0('0x2b')]===_0x29c6f5[_0x79e0('0x28')]){return _0x418946;}});if(_0x1a8a67){_0x29c6f5['endUserId']=_0x1a8a67['id'];logger[_0x79e0('0xe')]('Contact\x20found:',_0x29c6f5[_0x79e0('0x2c')]);_0x343da3(_0x29c6f5);}else{return createEndUser(_0x29c6f5,_0x47321c,_0x337bba,_0xd273ea)[_0x79e0('0x10')](function(_0x38f1a7){logger['info'](_0x79e0('0x2d'),_0x29c6f5['endUserId']);_0x343da3(_0x38f1a7);});}}else{return createEndUser(_0x29c6f5,_0x47321c,_0x337bba,_0xd273ea)[_0x79e0('0x10')](function(_0x239865){logger['info'](_0x79e0('0x2d'),_0x29c6f5[_0x79e0('0x2c')]);_0x343da3(_0x239865);});}})[_0x79e0('0x16')](function(_0xf997f6){throw new Error(_0xf997f6[_0x79e0('0x19')]);});});};}function createEndUser(_0x1401be,_0x106f2e,_0x5fcd3e,_0x1affa1){return new Promise(function(_0x3f57f0,_0x2066c5){var _0x26f9b7=moment();var _0x6aea19={'method':_0x79e0('0x2e'),'uri':_0x1affa1+_0x79e0('0x2f'),'body':{'contact':{'last_name':_0x1401be['contactNumber'],'work_number':_0x1401be[_0x79e0('0x28')],'mobile_number':_0x1401be[_0x79e0('0x28')],'owner_id':_0x1401be[_0x79e0('0x20')],'created_at':_0x26f9b7['format'](_0x79e0('0x30'))}},'json':!![]};_0x6aea19['headers']=_0x5fcd3e;logger[_0x79e0('0xe')](_0x79e0('0x31'));return rp(_0x6aea19)[_0x79e0('0x10')](function(_0x4a81e1){_0x1401be[_0x79e0('0x2c')]=_0x4a81e1[_0x79e0('0x32')]['id'];_0x3f57f0(_0x1401be);})['catch'](function(_0x4986ff){logger[_0x79e0('0x17')]('['+[_0x106f2e['toUpperCase']()]+']',_0x4986ff[_0x79e0('0x19')]);_0x2066c5(_0x4986ff['message']);});});}function getTicket(_0x1fe669,_0x67c868,_0x3c3d8c,_0x121e7b,_0x5be817){return function(_0x29423e){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x423ca2,_0x3f2e08){var _0x417408=moment();var _0x5ca5d9={'method':_0x79e0('0x2e'),'uri':_0x3c3d8c+'/api/tasks','body':{'title':intUtil['getString'](_0x121e7b['Subjects'],_0x5be817,'\x20'),'description':intUtil[_0x79e0('0x33')](_0x121e7b[_0x79e0('0x34')],_0x5be817,'\x0a'),'owner_id':_0x29423e['userId'],'creater_id':_0x29423e[_0x79e0('0x13')],'targetable_id':_0x29423e[_0x79e0('0x2c')],'targetable_type':_0x79e0('0x35'),'created_at':_0x417408[_0x79e0('0x36')](_0x79e0('0x30')),'due_date':_0x417408[_0x79e0('0x37')](0x1e,'m')['format'](_0x79e0('0x30'))},'json':!![]};_0x5ca5d9['headers']=_0x67c868;return rp(_0x5ca5d9)['then'](function(_0x28e0e0){_0x29423e[_0x79e0('0x38')]=_0x28e0e0[_0x79e0('0x39')]['id'];logger[_0x79e0('0xe')](_0x79e0('0x3a'),_0x29423e[_0x79e0('0x38')]);_0x423ca2(_0x29423e);})[_0x79e0('0x16')](function(_0x16b689){logger['error']('['+[_0x1fe669[_0x79e0('0x18')]()]+']',_0x16b689[_0x79e0('0x19')]);_0x3f2e08(_0x16b689['message']);});});};}function emit(_0x27537b,_0x3846e0,_0x52e500){var _0x5860c4={'uri':_0x27537b+_0x79e0('0x3b')+_0x52e500};io['to'](util['format'](_0x79e0('0x3c'),_0x3846e0))['emit'](_0x79e0('0x3d'),_0x5860c4);}exports['cs']=function(_0x42a15c,_0x3ae1fc,_0x100c1e,_0x2c59e5,_0x138b0e,_0x4e923d,_0x241819,_0x2948ad){var _0x196d9e={};var _0x464007={'Authorization':_0x79e0('0x3e')+_0x4e923d[_0x79e0('0x3f')]};_0x4e923d[_0x79e0('0x40')]=intUtil[_0x79e0('0x41')](_0x4e923d[_0x79e0('0x40')]);_0x4e923d['serverUrl']=intUtil[_0x79e0('0x41')](_0x4e923d[_0x79e0('0x42')]);var _0x46a2f7=_0x4e923d[_0x79e0('0x40')];_0x196d9e[_0x79e0('0x12')]=_0x4e923d[_0x79e0('0x43')];_0x196d9e[_0x79e0('0x28')]=_0x2948ad[_0x79e0('0x44')]()===_0x79e0('0x45')?_0x3ae1fc[_0x79e0('0x46')]:_0x3ae1fc['calleridnum'];_0x196d9e[_0x79e0('0x47')]=_0x2948ad===_0x79e0('0x48')||_0x2948ad===_0x79e0('0x49')?_0x79e0('0x48'):_0x79e0('0x45');if(_0x2c59e5){_0x196d9e[_0x79e0('0x1c')]=_0x2c59e5['email'];}var _0x277016=util[_0x79e0('0x36')](_0x79e0('0x4a'),_0x4e923d[_0x79e0('0x42')],_0x3ae1fc[_0x79e0('0x4b')],md5(_0x3ae1fc[_0x79e0('0x4b')]));if(_0x138b0e&&_0x138b0e['monitor_format']){logger[_0x79e0('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3ae1fc[_0x79e0('0x4c')]=_0x277016;}else if(_0x241819&&_0x241819[_0x79e0('0x4d')]&&_0x241819[_0x79e0('0x4d')]!==_0x79e0('0x4e')){logger[_0x79e0('0xe')]('[OUTBOUND]',_0x79e0('0x4f'));_0x3ae1fc[_0x79e0('0x4c')]=_0x277016;}else{_0x3ae1fc[_0x79e0('0x4c')]='';}return getAdminId(_0x196d9e,_0x2948ad,_0x464007,_0x46a2f7)[_0x79e0('0x10')](getUser(_0x2948ad,_0x464007,_0x46a2f7))['then'](getEndUser(_0x2948ad,_0x464007,_0x46a2f7))[_0x79e0('0x10')](getTicket(_0x2948ad,_0x464007,_0x46a2f7,_0x100c1e,_0x3ae1fc))[_0x79e0('0x10')](function(_0x5f7394){logger[_0x79e0('0xe')](util[_0x79e0('0x36')](_0x79e0('0x50'),_0x5f7394[_0x79e0('0x38')]));if(_0x2948ad!==_0x79e0('0x49')){logger[_0x79e0('0xe')]('['+[_0x2948ad[_0x79e0('0x18')]()]+']',_0x79e0('0x51'));emit(_0x46a2f7,_0x2c59e5[_0x79e0('0x52')],_0x5f7394[_0x79e0('0x2c')]);}})['catch'](function(_0x90d67d){logger[_0x79e0('0x17')]('['+[_0x2948ad[_0x79e0('0x18')]()]+_0x79e0('0x53'),util[_0x79e0('0x54')](_0x90d67d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x61bb=['find','work_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','/contacts/','remoteUri','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','./util','../../../../config/logger','freshsales','defaults','redis','localhost','/api/selector/owners','headers','info','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','then','agentEmail','userEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','Searching\x20contact\x20with\x20phone','contactNumber','contacts'];(function(_0x220a9f,_0x45e138){var _0x1a5f8f=function(_0x3d16f2){while(--_0x3d16f2){_0x220a9f['push'](_0x220a9f['shift']());}};_0x1a5f8f(++_0x45e138);}(_0x61bb,0x1b1));var _0xb61b=function(_0x295c8d,_0x3e507e){_0x295c8d=_0x295c8d-0x0;var _0x55539a=_0x61bb[_0x295c8d];return _0x55539a;};'use strict';var _=require(_0xb61b('0x0'));var rp=require(_0xb61b('0x1'));var md5=require('md5');var util=require(_0xb61b('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xb61b('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb61b('0x4'))(_0xb61b('0x5'));config['redis']=_[_0xb61b('0x6')](config[_0xb61b('0x7')],{'host':_0xb61b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x9d6919,_0x13f80f,_0xc42040,_0x11ce50){return new Promise(function(_0x1e8260,_0x90a726){var _0x314f37=![];var _0x143e6d={'method':'GET','uri':_0x11ce50+_0xb61b('0x9'),'json':!![]};_0x143e6d[_0xb61b('0xa')]=_0xc42040;logger[_0xb61b('0xb')]('Getting\x20admin\x20information');return rp(_0x143e6d)['then'](function(_0x4509f0){if(_0x4509f0){var _0x5805cf=_0x4509f0['users'];var _0x4e9e29=null;for(_0x4e9e29=0x0;_0x4e9e29<_0x5805cf[_0xb61b('0xc')];_0x4e9e29++){if(_0x5805cf[_0x4e9e29]['email']===_0x9d6919[_0xb61b('0xd')]){_0x9d6919[_0xb61b('0xe')]=_0x5805cf[_0x4e9e29]['id'];_0x314f37=!![];}}if(_0x314f37){logger['info'](_0xb61b('0xf'),_0x9d6919[_0xb61b('0xe')]);_0x1e8260(_0x9d6919);}else{_0x90a726({'statusCode':0x194,'message':_0xb61b('0x10')});}}else{_0x90a726({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb61b('0x11')](function(_0x5f0a9b){logger[_0xb61b('0x12')]('['+[_0x13f80f[_0xb61b('0x13')]()]+']',_0x5f0a9b[_0xb61b('0x14')]);_0x90a726(_0x5f0a9b);});});}function getUser(_0x3b323d,_0x182755,_0xd028a2){return function(_0x5d10ad){return new Promise(function(_0x53745d,_0x2e4f44){var _0x5bffc6={'method':_0xb61b('0x15'),'uri':_0xd028a2+_0xb61b('0x9'),'json':!![]};_0x5bffc6[_0xb61b('0xa')]=_0x182755;logger[_0xb61b('0xb')]('Getting\x20user\x20list');return rp(_0x5bffc6)[_0xb61b('0x16')](function(_0x2cb6bd){if(_0x2cb6bd){var _0x4a33f0=_0x2cb6bd['users'];var _0x176a9f=![];var _0x4c6433=null;if(_0x5d10ad[_0xb61b('0x17')]!==null){logger[_0xb61b('0xb')]('Getting\x20user\x20with\x20email',_0x5d10ad[_0xb61b('0x17')]);_0x5d10ad[_0xb61b('0x18')]=_0x5d10ad[_0xb61b('0x17')];for(_0x4c6433=0x0;_0x4c6433<_0x4a33f0[_0xb61b('0xc')];_0x4c6433++){if(_0x4a33f0[_0x4c6433]['email']===_0x5d10ad[_0xb61b('0x17')]){_0x176a9f=!![];_0x5d10ad[_0xb61b('0x19')]=_0x4a33f0[_0x4c6433]['id'];logger[_0xb61b('0xb')]('User\x20found:',_0x5d10ad[_0xb61b('0x19')]);}}}if(!_0x176a9f){logger[_0xb61b('0xb')](_0xb61b('0x1a'));_0x5d10ad[_0xb61b('0x18')]=_0x5d10ad[_0xb61b('0xd')];_0x5d10ad[_0xb61b('0x19')]=_0x5d10ad[_0xb61b('0xe')];_0x176a9f=!![];}if(_0x176a9f){_0x53745d(_0x5d10ad);}else{_0x2e4f44({'statusCode':0x194,'message':_0xb61b('0x10')});}}else{_0x2e4f44({'statusCode':0x194,'message':_0xb61b('0x10')});}})[_0xb61b('0x11')](function(_0x2167d6){logger[_0xb61b('0x12')]('['+[_0x3b323d[_0xb61b('0x13')]()]+']',_0x2167d6[_0xb61b('0x14')]);_0x2e4f44(_0x2167d6);});});};}function getEndUser(_0x17b052,_0x4580b3,_0x9c5829){return function(_0x16b743){return new Promise(function(_0x472e86,_0x2cd379){var _0x21daf4=0x0;var _0x33b525={'method':_0xb61b('0x15'),'uri':_0x9c5829+_0xb61b('0x1b'),'json':!![]};_0x33b525['headers']=_0x4580b3;logger[_0xb61b('0xb')](_0xb61b('0x1c'));return rp(_0x33b525)['then'](function(_0x3a5f39){_0x3a5f39[_0xb61b('0x1d')]['forEach'](function(_0x558b7b){if(_0x558b7b[_0xb61b('0x1e')]===_0xb61b('0x1f')){_0x21daf4=_0x558b7b['id'];}});})[_0xb61b('0x16')](function(){logger['info']('Getting\x20contact\x20list');var _0x41f23e={'method':'GET','uri':_0x9c5829+'/api/contacts/view/'+_0x21daf4,'json':!![]};_0x41f23e['headers']=_0x4580b3;return rp(_0x41f23e);})[_0xb61b('0x16')](function(_0x294905){logger[_0xb61b('0xb')](_0xb61b('0x20'),_0x16b743[_0xb61b('0x21')]);if(_0x294905[_0xb61b('0x22')][_0xb61b('0xc')]>0x0){var _0x1d366f=_[_0xb61b('0x23')](_0x294905[_0xb61b('0x22')],function(_0x3844f0){if(_0x3844f0[_0xb61b('0x24')]===_0x16b743[_0xb61b('0x21')]||_0x3844f0['mobile_number']===_0x16b743[_0xb61b('0x21')]){return _0x3844f0;}});if(_0x1d366f){_0x16b743[_0xb61b('0x25')]=_0x1d366f['id'];logger[_0xb61b('0xb')](_0xb61b('0x26'),_0x16b743[_0xb61b('0x25')]);_0x472e86(_0x16b743);}else{return createEndUser(_0x16b743,_0x17b052,_0x4580b3,_0x9c5829)[_0xb61b('0x16')](function(_0x5b0574){logger['info'](_0xb61b('0x27'),_0x16b743['endUserId']);_0x472e86(_0x5b0574);});}}else{return createEndUser(_0x16b743,_0x17b052,_0x4580b3,_0x9c5829)[_0xb61b('0x16')](function(_0x27358c){logger[_0xb61b('0xb')](_0xb61b('0x27'),_0x16b743[_0xb61b('0x25')]);_0x472e86(_0x27358c);});}})[_0xb61b('0x11')](function(_0xe921ee){throw new Error(_0xe921ee['message']);});});};}function createEndUser(_0x130ac9,_0x357a0c,_0x372e5a,_0x2e6cde){return new Promise(function(_0x4ea110,_0x30b259){var _0x478534=moment();var _0x482897={'method':'POST','uri':_0x2e6cde+_0xb61b('0x28'),'body':{'contact':{'last_name':_0x130ac9['contactNumber'],'work_number':_0x130ac9[_0xb61b('0x21')],'mobile_number':_0x130ac9['contactNumber'],'owner_id':_0x130ac9[_0xb61b('0x19')],'created_at':_0x478534[_0xb61b('0x29')](_0xb61b('0x2a'))}},'json':!![]};_0x482897[_0xb61b('0xa')]=_0x372e5a;logger[_0xb61b('0xb')](_0xb61b('0x2b'));return rp(_0x482897)[_0xb61b('0x16')](function(_0x28d473){_0x130ac9[_0xb61b('0x25')]=_0x28d473[_0xb61b('0x2c')]['id'];_0x4ea110(_0x130ac9);})['catch'](function(_0x216f71){logger[_0xb61b('0x12')]('['+[_0x357a0c[_0xb61b('0x13')]()]+']',_0x216f71['message']);_0x30b259(_0x216f71[_0xb61b('0x14')]);});});}function getTicket(_0x52123d,_0x1527bb,_0x421b2a,_0x1a8bbc,_0x2037fd){return function(_0x4b4ba0){logger[_0xb61b('0xb')](_0xb61b('0x2d'));return new Promise(function(_0x3f60c6,_0x103fa5){var _0x321aaf=moment();var _0x483ff8={'method':_0xb61b('0x2e'),'uri':_0x421b2a+'/api/tasks','body':{'title':intUtil[_0xb61b('0x2f')](_0x1a8bbc[_0xb61b('0x30')],_0x2037fd,'\x20'),'description':intUtil['getString'](_0x1a8bbc[_0xb61b('0x31')],_0x2037fd,'\x0a'),'owner_id':_0x4b4ba0[_0xb61b('0x19')],'creater_id':_0x4b4ba0[_0xb61b('0xe')],'targetable_id':_0x4b4ba0[_0xb61b('0x25')],'targetable_type':'Contact','created_at':_0x321aaf[_0xb61b('0x29')](_0xb61b('0x2a')),'due_date':_0x321aaf[_0xb61b('0x32')](0x1e,'m')[_0xb61b('0x29')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x483ff8[_0xb61b('0xa')]=_0x1527bb;return rp(_0x483ff8)[_0xb61b('0x16')](function(_0x4497fc){_0x4b4ba0['ticketId']=_0x4497fc[_0xb61b('0x33')]['id'];logger[_0xb61b('0xb')](_0xb61b('0x34'),_0x4b4ba0[_0xb61b('0x35')]);_0x3f60c6(_0x4b4ba0);})[_0xb61b('0x11')](function(_0x33571a){logger[_0xb61b('0x12')]('['+[_0x52123d['toUpperCase']()]+']',_0x33571a[_0xb61b('0x14')]);_0x103fa5(_0x33571a[_0xb61b('0x14')]);});});};}function emit(_0x2895b2,_0x41140d,_0x4d692e){var _0xb90886={'uri':_0x2895b2+_0xb61b('0x36')+_0x4d692e};io['to'](util[_0xb61b('0x29')]('user:%s',_0x41140d))['emit']('trigger:browser:url',_0xb90886);}exports['cs']=function(_0x29756c,_0x18ad35,_0x2a3a8c,_0x1c4f1c,_0x587dc8,_0x6943f0,_0x175f94,_0x46b344){var _0x9e54f4={};var _0xf1842d={'Authorization':'Token\x20token='+_0x6943f0['apiKey']};_0x6943f0['remoteUri']=intUtil['stripTrailingSlash'](_0x6943f0[_0xb61b('0x37')]);_0x6943f0['serverUrl']=intUtil[_0xb61b('0x38')](_0x6943f0['serverUrl']);var _0x3c571f=_0x6943f0[_0xb61b('0x37')];_0x9e54f4[_0xb61b('0xd')]=_0x6943f0[_0xb61b('0x39')];_0x9e54f4[_0xb61b('0x21')]=_0x46b344['toLowerCase']()===_0xb61b('0x3a')?_0x18ad35[_0xb61b('0x3b')]:_0x18ad35[_0xb61b('0x3c')];_0x9e54f4[_0xb61b('0x3d')]=_0x46b344===_0xb61b('0x3e')||_0x46b344===_0xb61b('0x3f')?_0xb61b('0x3e'):_0xb61b('0x3a');if(_0x1c4f1c){_0x9e54f4[_0xb61b('0x17')]=_0x1c4f1c[_0xb61b('0x40')];}var _0x40160d=util[_0xb61b('0x29')](_0xb61b('0x41'),_0x6943f0[_0xb61b('0x42')],_0x18ad35['uniqueid'],md5(_0x18ad35['uniqueid']));if(_0x587dc8&&_0x587dc8[_0xb61b('0x43')]){logger[_0xb61b('0xb')](_0xb61b('0x44'),_0xb61b('0x45'));_0x18ad35['recordingURL']=_0x40160d;}else if(_0x175f94&&_0x175f94[_0xb61b('0x46')]&&_0x175f94['recordingFormat']!==_0xb61b('0x47')){logger[_0xb61b('0xb')](_0xb61b('0x48'),_0xb61b('0x45'));_0x18ad35['recordingURL']=_0x40160d;}else{_0x18ad35[_0xb61b('0x49')]='';}return getAdminId(_0x9e54f4,_0x46b344,_0xf1842d,_0x3c571f)[_0xb61b('0x16')](getUser(_0x46b344,_0xf1842d,_0x3c571f))[_0xb61b('0x16')](getEndUser(_0x46b344,_0xf1842d,_0x3c571f))[_0xb61b('0x16')](getTicket(_0x46b344,_0xf1842d,_0x3c571f,_0x2a3a8c,_0x18ad35))[_0xb61b('0x16')](function(_0x2f05c6){logger['info'](util['format'](_0xb61b('0x4a'),_0x2f05c6[_0xb61b('0x35')]));if(_0x46b344!=='unmanaged'){logger['info']('['+[_0x46b344[_0xb61b('0x13')]()]+']',_0xb61b('0x4b'));emit(_0x3c571f,_0x1c4f1c[_0xb61b('0x1e')],_0x2f05c6[_0xb61b('0x25')]);}})[_0xb61b('0x11')](function(_0xd9eb20){logger[_0xb61b('0x12')]('['+[_0x46b344[_0xb61b('0x13')]()]+_0xb61b('0x4c'),util[_0xb61b('0x4d')](_0xd9eb20,{'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 fe053db..e3c2811 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 _0x757a=['EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk','servicenow','unknown\x20integration','data1','error','[EXEC]','../../../../config/logger','format','data2','util','./zendesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x3d2d7f,_0x21d281){var _0xe068d8=function(_0x48085e){while(--_0x48085e){_0x3d2d7f['push'](_0x3d2d7f['shift']());}};_0xe068d8(++_0x21d281);}(_0x757a,0xde));var _0xa757=function(_0x43c7bb,_0x252cd3){_0x43c7bb=_0x43c7bb-0x0;var _0x2db2e6=_0x757a[_0x43c7bb];return _0x2db2e6;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var zendesk=require(_0xa757('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xa757('0x2'));var desk=require(_0xa757('0x3'));var vtiger=require(_0xa757('0x4'));var servicenow=require(_0xa757('0x5'));var dynamics365=require(_0xa757('0x6'));var freshsales=require(_0xa757('0x7'));var integrations=['zendesk',_0xa757('0x8'),_0xa757('0x9'),'freshdesk',_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'),_0xa757('0xd'),_0xa757('0xe'),'servicenow'];exports[_0xa757('0xf')]=function(_0x2ca96f,_0x32f0ec,_0x3e2c9a,_0xb7610b,_0x188ad5,_0x17408b){if(_0x3e2c9a){if(_['includes'](integrations,_0x2ca96f['data1']['toLowerCase']())){try{var _0x56acfb=null;var _0x4db68e='';var _0x421040=_0x3e2c9a[_0x2ca96f['data1']['toLowerCase']()];if(_0x421040){var _0x2ed0d2=_0x421040[_0x2ca96f['data2']];if(_0x2ed0d2){var _0x481508=_[_0xa757('0x10')](_0x2ed0d2[_0xa757('0x11')],{'id':parseInt(_0x2ca96f[_0xa757('0x12')],0xa)});if(_0x481508){if(_0xb7610b){if(_0x188ad5&&_0x32f0ec[_0xa757('0x13')]){_0x4db68e=_0xa757('0x13');}else if(_0x32f0ec[_0xa757('0x14')]){_0x4db68e=_0xa757('0x15');}else{console[_0xa757('0x16')](_0xa757('0x17'),_0x32f0ec);}}else{_0x4db68e=_0xa757('0x18');}switch(_0x2ca96f['data1'][_0xa757('0x19')]()){case _0xa757('0x1a'):zendesk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0x8'):salesforce[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case'sugarcrm':sugarcrm[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case'freshdesk':freshdesk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xa'):zoho[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xb'):desk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xc'):vtiger[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xe'):freshsales['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;case _0xa757('0x1b'):servicenow['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;case _0xa757('0xd'):dynamics365['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;default:console['log'](_0xa757('0x1c'));}}else{_0x56acfb=require('../../../../config/logger')(_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')]());_0x56acfb[_0xa757('0x1e')](_0xa757('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')](),_0x2ca96f[_0xa757('0x12')]));}}else{_0x56acfb=require(_0xa757('0x20'))(_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')]());_0x56acfb[_0xa757('0x1e')](_0xa757('0x1f'),util[_0xa757('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x2ca96f[_0xa757('0x1d')]['toLowerCase'](),_0x2ca96f[_0xa757('0x22')]));}}else{}}catch(_0x47903b){console[_0xa757('0x1e')](_0x47903b);}}}}; \ No newline at end of file +var _0xd7d1=['desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','unmanaged','salesforce','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3d7a29,_0x10e72a){_0x3d7a29=_0x3d7a29-0x0;var _0x3a3101=_0xd7d1[_0x3d7a29];return _0x3a3101;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var zendesk=require(_0x1d7d('0x2'));var salesforce=require(_0x1d7d('0x3'));var sugarcrm=require(_0x1d7d('0x4'));var freshdesk=require(_0x1d7d('0x5'));var zoho=require(_0x1d7d('0x6'));var desk=require(_0x1d7d('0x7'));var vtiger=require(_0x1d7d('0x8'));var servicenow=require(_0x1d7d('0x9'));var dynamics365=require(_0x1d7d('0xa'));var freshsales=require(_0x1d7d('0xb'));var integrations=[_0x1d7d('0xc'),'salesforce',_0x1d7d('0xd'),_0x1d7d('0xe'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12'),_0x1d7d('0x13'),_0x1d7d('0x14')];exports[_0x1d7d('0x15')]=function(_0x8b258b,_0x2765fe,_0x547f7b,_0xe6b9eb,_0x4c6809,_0x3cbca9){if(_0x547f7b){if(_[_0x1d7d('0x16')](integrations,_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]())){try{var _0x5c7445=null;var _0x11b83f='';var _0x5ae1c9=_0x547f7b[_0x8b258b['data1'][_0x1d7d('0x18')]()];if(_0x5ae1c9){var _0x4049be=_0x5ae1c9[_0x8b258b['data2']];if(_0x4049be){var _0x55dba7=_[_0x1d7d('0x19')](_0x4049be[_0x1d7d('0x1a')],{'id':parseInt(_0x8b258b[_0x1d7d('0x1b')],0xa)});if(_0x55dba7){if(_0xe6b9eb){if(_0x4c6809&&_0x2765fe[_0x1d7d('0x1c')]){_0x11b83f=_0x1d7d('0x1c');}else if(_0x2765fe['routeId']){_0x11b83f=_0x1d7d('0x1d');}else{console[_0x1d7d('0x1e')]('EVENT\x20UNKNOWN',_0x2765fe);}}else{_0x11b83f=_0x1d7d('0x1f');}switch(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]()){case _0x1d7d('0xc'):zendesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x20'):salesforce[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'sugarcrm':sugarcrm[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xe'):freshdesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xf'):zoho[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'desk':desk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'vtiger':vtiger[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x13'):freshsales['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x14'):servicenow['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x12'):dynamics365['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;default:console[_0x1d7d('0x1e')](_0x1d7d('0x21'));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b['data1'][_0x1d7d('0x18')]());_0x5c7445[_0x1d7d('0x23')](_0x1d7d('0x24'),util['format'](_0x1d7d('0x25'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b['data3']));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]());_0x5c7445['error'](_0x1d7d('0x24'),util[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b[_0x1d7d('0x28')]));}}else{}}catch(_0x151198){console['error'](_0x151198);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index fc9d534..78407a9 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 _0x3598=['localhost','emit','ticketType','Task','assign','utc','Subjects','getString','Descriptions','WhoId','Case','ContactId','sobject','isNil','validateEmail','User','find','execute','then','info','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','moduleCreate','Company','No\x20Company','upperFirst','create','forEach','type','string','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis'];(function(_0x26749a,_0x3cb1f1){var _0x616a2d=function(_0x28d6a0){while(--_0x28d6a0){_0x26749a['push'](_0x26749a['shift']());}};_0x616a2d(++_0x3cb1f1);}(_0x3598,0x13d));var _0x8359=function(_0x4091fd,_0x30fac2){_0x4091fd=_0x4091fd-0x0;var _0x2e8827=_0x3598[_0x4091fd];return _0x2e8827;};'use strict';var _=require(_0x8359('0x0'));var rp=require(_0x8359('0x1'));var moment=require(_0x8359('0x2'));var BPromise=require(_0x8359('0x3'));var md5=require('md5');var jsforce=require(_0x8359('0x4'));var util=require(_0x8359('0x5'));var Redis=require(_0x8359('0x6'));var intUtil=require(_0x8359('0x7'));var config=require(_0x8359('0x8'));var logger=require(_0x8359('0x9'))(_0x8359('0xa'));config['redis']=_[_0x8359('0xb')](config[_0x8359('0xc')],{'host':_0x8359('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xa9a2c8,_0xd558c5,_0x2eb954){io['to'](_0xa9a2c8)[_0x8359('0xe')](_0xd558c5,_0x2eb954);}function getTicket(_0x22be17,_0x5d15db,_0x407611,_0x110021,_0x44c1c7,_0x3e77a3,_0x2ca442,_0x356874){var _0x32747e={};if(_0x110021[_0x8359('0xf')]===_0x8359('0x10')){_0x32747e=Object[_0x8359('0x11')]({},{'OwnerId':_0x5d15db['id'],'ActivityDate':moment[_0x8359('0x12')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x110021[_0x8359('0x13')],_0x44c1c7,'\x20'),'Description':intUtil[_0x8359('0x14')](_0x110021[_0x8359('0x15')],_0x44c1c7,'\x0a')},getCustomFields(_0x3e77a3,_0x44c1c7));if(_0x407611){_0x32747e[_0x8359('0x16')]=_0x407611['id'];}}else if(_0x110021['ticketType']===_0x8359('0x17')){_0x32747e=Object[_0x8359('0x11')]({},{'OwnerId':_0x5d15db['id'],'Subject':intUtil[_0x8359('0x14')](_0x110021[_0x8359('0x13')],_0x44c1c7,'\x20'),'Description':intUtil[_0x8359('0x14')](_0x110021[_0x8359('0x15')],_0x44c1c7,'\x0a')},getCustomFields(_0x3e77a3,_0x44c1c7));if(_0x407611){_0x32747e[_0x8359('0x18')]=_0x407611['id'];}}return _0x2ca442[_0x8359('0x19')](_0x110021['ticketType'])['create'](_0x32747e);}function getUser(_0x2df903,_0x10af4b,_0x30b21b){if(!_[_0x8359('0x1a')](_0x10af4b)&&intUtil[_0x8359('0x1b')](_0x10af4b)){var _0x1ad6b1={'Email':_0x10af4b};var _0x43dba4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x30b21b['sobject'](_0x8359('0x1c'))[_0x8359('0x1d')](_0x1ad6b1,_0x43dba4)[_0x8359('0x1e')]()[_0x8359('0x1f')](function(_0x373d3e){if(_0x373d3e['length']){var _0x2495ae=_[_0x8359('0x1d')](_0x373d3e,function(_0x217a0d){return _0x217a0d['Email']===_0x10af4b;});if(_0x2495ae){logger[_0x8359('0x20')](_0x8359('0x21'),_0x10af4b);return BPromise[_0x8359('0x22')]({'id':_0x2495ae['Id'],'name':_0x2495ae[_0x8359('0x23')]});}}else{logger[_0x8359('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x10af4b);return _0x30b21b['identity']()[_0x8359('0x1f')](function(_0x52dd67){return BPromise[_0x8359('0x22')]({'id':_0x52dd67[_0x8359('0x24')],'name':_0x52dd67[_0x8359('0x25')]});});}});}else{logger[_0x8359('0x20')](_0x8359('0x26'),_0x10af4b);return _0x30b21b[_0x8359('0x27')]()[_0x8359('0x1f')](function(_0x16ad3c){return BPromise['resolve']({'id':_0x16ad3c[_0x8359('0x24')],'name':_0x16ad3c[_0x8359('0x25')]});});}}function getEndUser(_0x41880a,_0x1008c2,_0x4aa80f,_0x219f66,_0x46bac8){var _0x1f8fed={'Phone':_0x219f66};var _0x1aef6f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8359('0x22')]()[_0x8359('0x1f')](function(){if(_0x1008c2['ticketType']===_0x8359('0x10')){logger[_0x8359('0x20')](_0x8359('0x28'),_0x219f66,_0x1008c2[_0x8359('0x29')]);switch(_0x1008c2[_0x8359('0x29')]){case _0x8359('0x2a'):return _0x46bac8['sobject']('Contact')[_0x8359('0x1d')](_0x1f8fed,_0x1aef6f)[_0x8359('0x1e')]()[_0x8359('0x1f')](function(_0x56a3d2){if(_0x56a3d2&&_0x56a3d2[_0x8359('0x2b')]){return _0x56a3d2;}else{return _0x46bac8[_0x8359('0x19')](_0x8359('0x2c'))[_0x8359('0x1d')](_0x1f8fed,_0x1aef6f);}});case _0x8359('0x2d'):return _0x46bac8['sobject'](_0x8359('0x2e'))['find'](_0x1f8fed,_0x1aef6f)[_0x8359('0x1e')]();case _0x8359('0x2f'):return _0x46bac8[_0x8359('0x19')](_0x8359('0x2c'))[_0x8359('0x1d')](_0x1f8fed,_0x1aef6f);default:return null;}}else if(_0x1008c2[_0x8359('0xf')]===_0x8359('0x17')){logger[_0x8359('0x20')](_0x8359('0x28'),_0x219f66,_0x8359('0x2d'));return _0x46bac8[_0x8359('0x19')](_0x8359('0x2e'))[_0x8359('0x1d')](_0x1f8fed,_0x1aef6f)['execute']();}})['then'](function(_0x715038){if(_0x715038&&_0x715038[_0x8359('0x2b')]){var _0x8dd237=_[_0x8359('0x1d')](_0x715038,function(_0x5c0c12){return _0x5c0c12['Phone']===_0x219f66;});if(_0x8dd237){return BPromise[_0x8359('0x22')]({'id':_0x8dd237['Id'],'name':_0x8dd237['Name'],'phone':_0x8dd237[_0x8359('0x30')]});}}})[_0x8359('0x1f')](function(_0x4f8e63){if(_0x4f8e63){logger[_0x8359('0x20')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x219f66);return BPromise[_0x8359('0x22')](_0x4f8e63);}else{logger[_0x8359('0x20')](_0x8359('0x31'),_0x219f66);var _0x1dad7b={'LastName':_0x4aa80f!==_0x8359('0x32')?_0x4aa80f:util['format']('Caller\x20-\x20%s',_0x219f66),'Phone':_0x219f66};if(_0x1008c2[_0x8359('0x33')]){if(_0x1008c2['moduleCreate']===_0x8359('0x2d')){logger[_0x8359('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x219f66,_0x1008c2[_0x8359('0x33')]);}else if(_0x1008c2[_0x8359('0x33')]===_0x8359('0x2f')&&_0x1008c2[_0x8359('0xf')]===_0x8359('0x10')){logger[_0x8359('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x219f66,_0x1008c2[_0x8359('0x33')]);_0x1dad7b[_0x8359('0x34')]=_0x8359('0x35');}else{return null;}}return _0x46bac8['sobject'](_[_0x8359('0x36')](_0x1008c2[_0x8359('0x33')]))[_0x8359('0x37')](_0x1dad7b);}});}function getCustomFields(_0x99ad0a,_0x42cd58){var _0x30a209={};if(_0x99ad0a[_0x8359('0x2b')]>0x0){_[_0x8359('0x38')](_0x99ad0a,function(_0x41f546){if(_0x41f546[_0x8359('0x39')]===_0x8359('0x3a')&&_0x41f546[_0x8359('0x3b')]){_0x30a209[_0x41f546[_0x8359('0x3b')]]=_0x41f546[_0x8359('0x3c')]['toString']();}else if(_0x41f546['type']==='variable'&&_0x41f546[_0x8359('0x3d')]&&_0x41f546['idField']){_0x42cd58[_0x41f546[_0x8359('0x3d')]]&&(_0x30a209[_0x41f546['idField']]=_0x42cd58[_0x41f546[_0x8359('0x3d')]][_0x8359('0x3e')]());}else if(_0x41f546[_0x8359('0x39')]===_0x8359('0x3f')&&_0x41f546[_0x8359('0x40')]&&_0x41f546[_0x8359('0x40')][_0x8359('0x41')]&&_0x41f546[_0x8359('0x3b')]){_0x42cd58[_0x41f546[_0x8359('0x40')][_0x8359('0x41')][_0x8359('0x42')]()]&&(_0x30a209[_0x41f546['idField']]=_0x42cd58[_0x41f546[_0x8359('0x40')][_0x8359('0x41')]['toLowerCase']()][_0x8359('0x3e')]());}});}return _0x30a209;}function getConnection(_0x27dd3c){var _0x5e7469=_0x27dd3c[_0x8359('0x43')][_0x8359('0x44')](_0x27dd3c['securityToken']);var _0x42d4f1=new jsforce[(_0x8359('0x45'))]({'oauth2':{'loginUrl':_0x27dd3c['remoteUri']||'https://login.salesforce.com','clientId':_0x27dd3c[_0x8359('0x46')],'clientSecret':_0x27dd3c['clientSecret']}});return _0x42d4f1[_0x8359('0x47')](_0x27dd3c[_0x8359('0x48')],_0x5e7469)[_0x8359('0x1f')](function(){logger[_0x8359('0x20')](_0x8359('0x49'));return _0x42d4f1;});}exports[_0x8359('0x4a')]=function(_0x586581,_0x30f71f,_0x3b1000,_0x56fb4d,_0x169423,_0xe6f6e5){var _0x2efb36,_0x34888a,_0xa750d0,_0x4e10c9;_0xe6f6e5['serverUrl']=intUtil[_0x8359('0x4b')](_0xe6f6e5[_0x8359('0x4c')]);_0xe6f6e5['remoteUri']=intUtil[_0x8359('0x4b')](_0xe6f6e5[_0x8359('0x4d')]);if(_0x169423&&_0x169423[_0x8359('0x4e')]){logger[_0x8359('0x20')](_0x8359('0x4f'),'Recording\x20is\x20enabled!');_0x30f71f['recordingURL']=util[_0x8359('0x50')](_0x8359('0x51'),_0xe6f6e5[_0x8359('0x4c')],_0x30f71f[_0x8359('0x52')],md5(_0x30f71f['uniqueid']));}else{_0x30f71f[_0x8359('0x53')]='';}return getConnection(_0xe6f6e5)['then'](function(_0x3090e5){_0x4e10c9=_0x3090e5;return getUser(_0xe6f6e5,_0x56fb4d[_0x8359('0x54')],_0x4e10c9);})[_0x8359('0x1f')](function(_0x2f0ac7){_0x2efb36=_0x2f0ac7;return getEndUser(_0xe6f6e5,_0x3b1000,_0x30f71f[_0x8359('0x55')],_0x30f71f['calleridnum'],_0x4e10c9);})[_0x8359('0x1f')](function(_0x43171a){_0x34888a=_0x43171a;return getTicket(_0xe6f6e5,_0x2efb36,_0x34888a,_0x3b1000,_0x30f71f,_0x3b1000['Fields'],_0x4e10c9,_0x8359('0x4a'));})[_0x8359('0x1f')](function(_0x28af92){_0xa750d0=_0x28af92;logger[_0x8359('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0xa750d0['id']);logger[_0x8359('0x20')](_0x8359('0x56'),_0xa750d0['id'],_0x56fb4d[_0x8359('0x41')],_0xe6f6e5[_0x8359('0x39')]);switch(_0xe6f6e5['type']){case _0x8359('0x57'):emit(util[_0x8359('0x50')]('user:%s',_0x56fb4d['name']),'trigger:salesforce:display',{'recordId':_0xa750d0['id']});break;case'newTab':emit(util[_0x8359('0x50')](_0x8359('0x58'),_0x56fb4d[_0x8359('0x41')]),'trigger:browser:url',{'uri':util[_0x8359('0x50')](_0x8359('0x59'),_0x4e10c9[_0x8359('0x5a')],_0xa750d0['id'])});break;default:logger[_0x8359('0x5b')](_0x8359('0x5c'));}})[_0x8359('0x5d')](function(_0x36bc64){logger[_0x8359('0x5b')](_0x8359('0x4f'),JSON[_0x8359('0x5e')](_0x36bc64));});};exports[_0x8359('0x5f')]=function(_0x7251e,_0x564b9c,_0xdb7cae,_0x3887f1,_0x4994fd,_0x37cea3,_0x4412db){var _0x4ac86e,_0x3dbee6,_0x574b45,_0x3f8451;_0x37cea3[_0x8359('0x4c')]=intUtil[_0x8359('0x4b')](_0x37cea3[_0x8359('0x4c')]);_0x37cea3[_0x8359('0x4d')]=intUtil[_0x8359('0x4b')](_0x37cea3[_0x8359('0x4d')]);if(_0x4412db&&_0x4412db[_0x8359('0x60')]&&_0x4412db[_0x8359('0x60')]!==_0x8359('0x61')){logger[_0x8359('0x20')](_0x8359('0x62'),_0x8359('0x63'));_0x564b9c[_0x8359('0x53')]=util[_0x8359('0x50')](_0x8359('0x51'),_0x37cea3[_0x8359('0x4c')],_0x564b9c[_0x8359('0x52')],md5(_0x564b9c[_0x8359('0x52')]));}return getConnection(_0x37cea3)[_0x8359('0x1f')](function(_0x390bea){_0x3f8451=_0x390bea;return getUser(_0x37cea3,_0x3887f1[_0x8359('0x54')],_0x3f8451);})[_0x8359('0x1f')](function(_0x4a5eea){_0x4ac86e=_0x4a5eea;return getEndUser(_0x37cea3,_0xdb7cae,_0x564b9c[_0x8359('0x64')],_0x564b9c[_0x8359('0x65')],_0x3f8451);})[_0x8359('0x1f')](function(_0x5f036d){_0x3dbee6=_0x5f036d;return getTicket(_0x37cea3,_0x4ac86e,_0x3dbee6,_0xdb7cae,_0x564b9c,_0xdb7cae[_0x8359('0x66')],_0x3f8451,_0x8359('0x5f'));})[_0x8359('0x1f')](function(_0x4c0e33){_0x574b45=_0x4c0e33;logger[_0x8359('0x20')](_0x8359('0x67'),_0x574b45['id']);logger[_0x8359('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x574b45['id'],_0x3887f1[_0x8359('0x41')],_0x37cea3['type']);switch(_0x37cea3[_0x8359('0x39')]){case'integrationTab':emit(util[_0x8359('0x50')](_0x8359('0x58'),_0x3887f1[_0x8359('0x41')]),_0x8359('0x68'),{'recordId':_0x574b45['id']});break;case'newTab':emit(util[_0x8359('0x50')](_0x8359('0x58'),_0x3887f1[_0x8359('0x41')]),_0x8359('0x69'),{'uri':util['format']('%s/%s/e',_0x3f8451[_0x8359('0x5a')],_0x574b45['id'])});break;default:logger[_0x8359('0x5b')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x587e32){logger[_0x8359('0x5b')](_0x8359('0x62'),JSON[_0x8359('0x5e')](_0x587e32));});};exports[_0x8359('0x6a')]=function(_0x28bcf5,_0x2d243a,_0x268cc0,_0x314cea,_0x1f8726,_0x5154a6){var _0x2c9de6,_0xc1b044,_0xcd221,_0x53d79b;_0x5154a6[_0x8359('0x4c')]=intUtil[_0x8359('0x4b')](_0x5154a6[_0x8359('0x4c')]);_0x5154a6[_0x8359('0x4d')]=intUtil[_0x8359('0x4b')](_0x5154a6[_0x8359('0x4d')]);if(_0x1f8726&&_0x1f8726[_0x8359('0x4e')]){logger['info']('['+_0x2d243a[_0x8359('0x6b')][_0x8359('0x6c')]()+']','Recording\x20is\x20enabled!');_0x2d243a['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5154a6[_0x8359('0x4c')],_0x2d243a[_0x8359('0x52')],md5(_0x2d243a[_0x8359('0x52')]));}else{_0x2d243a['recordingURL']='';}return getConnection(_0x5154a6)[_0x8359('0x1f')](function(_0x1fdf00){_0x53d79b=_0x1fdf00;if(!_[_0x8359('0x1a')](_0x314cea)){return getUser(_0x5154a6,_0x314cea[_0x8359('0x41')],_0x53d79b);}else{return getUser(_0x5154a6,null,_0x53d79b);}})[_0x8359('0x1f')](function(_0x4e1a68){_0x2c9de6=_0x4e1a68;return getEndUser(_0x5154a6,_0x268cc0,_0x2d243a['calleridname'],_0x2d243a[_0x8359('0x6d')],_0x53d79b);})[_0x8359('0x1f')](function(_0x22a3d5){_0xc1b044=_0x22a3d5;return getTicket(_0x5154a6,_0x2c9de6,_0xc1b044,_0x268cc0,_0x2d243a,_0x268cc0[_0x8359('0x66')],_0x53d79b);})['then'](function(_0x22b6b9){_0xcd221=_0x22b6b9;logger[_0x8359('0x20')]('['+_0x2d243a[_0x8359('0x6b')][_0x8359('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0xcd221['id']);logger[_0x8359('0x20')]('['+_0x2d243a['lastevent'][_0x8359('0x6c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x5154a6[_0x8359('0x39')]);})['catch'](function(_0x57064a){logger[_0x8359('0x5b')]('['+_0x2d243a['lastevent'][_0x8359('0x6c')]()+']',JSON[_0x8359('0x5e')](_0x57064a));});}; \ No newline at end of file +var _0xd868=['identity','display_name','user_id','moduleSearch','contact_lead','contact','lead','Lead','Contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.'];(function(_0xe4c012,_0x571ff6){var _0x18391c=function(_0x3b36f5){while(--_0x3b36f5){_0xe4c012['push'](_0xe4c012['shift']());}};_0x18391c(++_0x571ff6);}(_0xd868,0xb2));var _0x8d86=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xd868[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x8d86('0x0'));var rp=require('request-promise');var moment=require(_0x8d86('0x1'));var BPromise=require(_0x8d86('0x2'));var md5=require(_0x8d86('0x3'));var jsforce=require('jsforce');var util=require(_0x8d86('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8d86('0x5'));var logger=require(_0x8d86('0x6'))(_0x8d86('0x7'));config[_0x8d86('0x8')]=_[_0x8d86('0x9')](config[_0x8d86('0x8')],{'host':_0x8d86('0xa'),'port':0x18eb});var io=require(_0x8d86('0xb'))(new Redis(config[_0x8d86('0x8')]));function emit(_0x2e1b37,_0x329170,_0x3529d5){io['to'](_0x2e1b37)[_0x8d86('0xc')](_0x329170,_0x3529d5);}function getTicket(_0x4986b5,_0x2e19a7,_0x1f3726,_0x291308,_0x3000c4,_0x4e89e8,_0x3130db,_0x2b302c){var _0x615577={};if(_0x291308[_0x8d86('0xd')]===_0x8d86('0xe')){_0x615577=Object['assign']({},{'OwnerId':_0x2e19a7['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x8d86('0xf')](_0x291308[_0x8d86('0x10')],_0x3000c4,'\x20'),'Description':intUtil['getString'](_0x291308[_0x8d86('0x11')],_0x3000c4,'\x0a')},getCustomFields(_0x4e89e8,_0x3000c4));if(_0x1f3726){_0x615577[_0x8d86('0x12')]=_0x1f3726['id'];}}else if(_0x291308[_0x8d86('0xd')]===_0x8d86('0x13')){_0x615577=Object['assign']({},{'OwnerId':_0x2e19a7['id'],'Subject':intUtil[_0x8d86('0xf')](_0x291308['Subjects'],_0x3000c4,'\x20'),'Description':intUtil[_0x8d86('0xf')](_0x291308['Descriptions'],_0x3000c4,'\x0a')},getCustomFields(_0x4e89e8,_0x3000c4));if(_0x1f3726){_0x615577[_0x8d86('0x14')]=_0x1f3726['id'];}}return _0x3130db[_0x8d86('0x15')](_0x291308[_0x8d86('0xd')])[_0x8d86('0x16')](_0x615577);}function getUser(_0x49d71d,_0x1d892f,_0x2f7b97){if(!_[_0x8d86('0x17')](_0x1d892f)&&intUtil[_0x8d86('0x18')](_0x1d892f)){var _0x22a51b={'Email':_0x1d892f};var _0x1e0b72={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2f7b97['sobject'](_0x8d86('0x19'))[_0x8d86('0x1a')](_0x22a51b,_0x1e0b72)[_0x8d86('0x1b')]()[_0x8d86('0x1c')](function(_0x528ed6){if(_0x528ed6[_0x8d86('0x1d')]){var _0x18c9ba=_[_0x8d86('0x1a')](_0x528ed6,function(_0x7f0efd){return _0x7f0efd[_0x8d86('0x1e')]===_0x1d892f;});if(_0x18c9ba){logger['info'](_0x8d86('0x1f'),_0x1d892f);return BPromise[_0x8d86('0x20')]({'id':_0x18c9ba['Id'],'name':_0x18c9ba[_0x8d86('0x21')]});}}else{logger[_0x8d86('0x22')](_0x8d86('0x23'),_0x1d892f);return _0x2f7b97[_0x8d86('0x24')]()[_0x8d86('0x1c')](function(_0x51f27d){return BPromise['resolve']({'id':_0x51f27d['user_id'],'name':_0x51f27d[_0x8d86('0x25')]});});}});}else{logger[_0x8d86('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1d892f);return _0x2f7b97[_0x8d86('0x24')]()[_0x8d86('0x1c')](function(_0x26e3b5){return BPromise['resolve']({'id':_0x26e3b5[_0x8d86('0x26')],'name':_0x26e3b5['display_name']});});}}function getEndUser(_0x7f42dc,_0x3f44fc,_0x554c30,_0x5f59ca,_0x3db3f7){var _0x5af8e9={'Phone':_0x5f59ca};var _0x1f70e3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8d86('0x20')]()[_0x8d86('0x1c')](function(){if(_0x3f44fc[_0x8d86('0xd')]===_0x8d86('0xe')){logger[_0x8d86('0x22')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5f59ca,_0x3f44fc[_0x8d86('0x27')]);switch(_0x3f44fc['moduleSearch']){case _0x8d86('0x28'):return _0x3db3f7[_0x8d86('0x15')]('Contact')[_0x8d86('0x1a')](_0x5af8e9,_0x1f70e3)[_0x8d86('0x1b')]()[_0x8d86('0x1c')](function(_0x15ea8b){if(_0x15ea8b&&_0x15ea8b['length']){return _0x15ea8b;}else{return _0x3db3f7[_0x8d86('0x15')]('Lead')[_0x8d86('0x1a')](_0x5af8e9,_0x1f70e3);}});case _0x8d86('0x29'):return _0x3db3f7['sobject']('Contact')[_0x8d86('0x1a')](_0x5af8e9,_0x1f70e3)[_0x8d86('0x1b')]();case _0x8d86('0x2a'):return _0x3db3f7[_0x8d86('0x15')](_0x8d86('0x2b'))['find'](_0x5af8e9,_0x1f70e3);default:return null;}}else if(_0x3f44fc[_0x8d86('0xd')]===_0x8d86('0x13')){logger[_0x8d86('0x22')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5f59ca,_0x8d86('0x29'));return _0x3db3f7['sobject'](_0x8d86('0x2c'))[_0x8d86('0x1a')](_0x5af8e9,_0x1f70e3)[_0x8d86('0x1b')]();}})['then'](function(_0x522e2b){if(_0x522e2b&&_0x522e2b[_0x8d86('0x1d')]){var _0x201608=_['find'](_0x522e2b,function(_0x5b24ad){return _0x5b24ad[_0x8d86('0x2d')]===_0x5f59ca;});if(_0x201608){return BPromise[_0x8d86('0x20')]({'id':_0x201608['Id'],'name':_0x201608[_0x8d86('0x21')],'phone':_0x201608[_0x8d86('0x2d')]});}}})[_0x8d86('0x1c')](function(_0x362c7e){if(_0x362c7e){logger[_0x8d86('0x22')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x5f59ca);return BPromise['resolve'](_0x362c7e);}else{logger['info'](_0x8d86('0x2e'),_0x5f59ca);var _0x47e471={'LastName':_0x554c30!==''?_0x554c30:util[_0x8d86('0x2f')](_0x8d86('0x30'),_0x5f59ca),'Phone':_0x5f59ca};if(_0x3f44fc[_0x8d86('0x31')]){if(_0x3f44fc['moduleCreate']===_0x8d86('0x29')){logger[_0x8d86('0x22')](_0x8d86('0x32'),_0x5f59ca,_0x3f44fc['moduleCreate']);}else if(_0x3f44fc[_0x8d86('0x31')]===_0x8d86('0x2a')&&_0x3f44fc[_0x8d86('0xd')]===_0x8d86('0xe')){logger[_0x8d86('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5f59ca,_0x3f44fc[_0x8d86('0x31')]);_0x47e471[_0x8d86('0x33')]=_0x8d86('0x34');}else{return null;}}return _0x3db3f7['sobject'](_[_0x8d86('0x35')](_0x3f44fc[_0x8d86('0x31')]))['create'](_0x47e471);}});}function getCustomFields(_0x51cb5f,_0x2cf658){var _0x1a4bcf={};if(_0x51cb5f[_0x8d86('0x1d')]>0x0){_['forEach'](_0x51cb5f,function(_0x29e818){if(_0x29e818[_0x8d86('0x36')]===_0x8d86('0x37')&&_0x29e818[_0x8d86('0x38')]){_0x1a4bcf[_0x29e818[_0x8d86('0x38')]]=_0x29e818[_0x8d86('0x39')][_0x8d86('0x3a')]();}else if(_0x29e818[_0x8d86('0x36')]==='variable'&&_0x29e818['variableName']&&_0x29e818[_0x8d86('0x38')]){_0x2cf658[_0x29e818[_0x8d86('0x3b')]]&&(_0x1a4bcf[_0x29e818['idField']]=_0x2cf658[_0x29e818[_0x8d86('0x3b')]][_0x8d86('0x3a')]());}else if(_0x29e818[_0x8d86('0x36')]===_0x8d86('0x3c')&&_0x29e818[_0x8d86('0x3d')]&&_0x29e818['Variable'][_0x8d86('0x3e')]&&_0x29e818[_0x8d86('0x38')]){_0x2cf658[_0x29e818['Variable'][_0x8d86('0x3e')][_0x8d86('0x3f')]()]&&(_0x1a4bcf[_0x29e818[_0x8d86('0x38')]]=_0x2cf658[_0x29e818[_0x8d86('0x3d')]['name']['toLowerCase']()][_0x8d86('0x3a')]());}});}return _0x1a4bcf;}function getConnection(_0x58bdf2){var _0xb50296=_0x58bdf2[_0x8d86('0x40')][_0x8d86('0x41')](_0x58bdf2['securityToken']);var _0x18d8cc=new jsforce['Connection']({'oauth2':{'loginUrl':_0x58bdf2[_0x8d86('0x42')]||_0x8d86('0x43'),'clientId':_0x58bdf2[_0x8d86('0x44')],'clientSecret':_0x58bdf2[_0x8d86('0x45')]}});return _0x18d8cc[_0x8d86('0x46')](_0x58bdf2[_0x8d86('0x47')],_0xb50296)[_0x8d86('0x1c')](function(){logger[_0x8d86('0x22')]('Connection\x20established.');return _0x18d8cc;});}exports[_0x8d86('0x48')]=function(_0x5d59c3,_0x3cac94,_0xe5c85e,_0x200e96,_0x18fa3a,_0x3accfe){var _0x42b5f4,_0xa004ec,_0x50e78a,_0x505294;_0x3accfe[_0x8d86('0x49')]=intUtil[_0x8d86('0x4a')](_0x3accfe[_0x8d86('0x49')]);_0x3accfe[_0x8d86('0x42')]=intUtil[_0x8d86('0x4a')](_0x3accfe[_0x8d86('0x42')]);if(_0x18fa3a&&_0x18fa3a[_0x8d86('0x4b')]){logger[_0x8d86('0x22')](_0x8d86('0x4c'),_0x8d86('0x4d'));_0x3cac94[_0x8d86('0x4e')]=util[_0x8d86('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3accfe['serverUrl'],_0x3cac94[_0x8d86('0x4f')],md5(_0x3cac94['uniqueid']));}else{_0x3cac94[_0x8d86('0x4e')]='';}return getConnection(_0x3accfe)['then'](function(_0x11cfd4){_0x505294=_0x11cfd4;return getUser(_0x3accfe,_0x200e96['email'],_0x505294);})[_0x8d86('0x1c')](function(_0x89a881){_0x42b5f4=_0x89a881;return getEndUser(_0x3accfe,_0xe5c85e,_0x3cac94[_0x8d86('0x50')],_0x3cac94[_0x8d86('0x51')],_0x505294);})['then'](function(_0x4b7923){_0xa004ec=_0x4b7923;return getTicket(_0x3accfe,_0x42b5f4,_0xa004ec,_0xe5c85e,_0x3cac94,_0xe5c85e['Fields'],_0x505294,'queue');})['then'](function(_0x3f799b){_0x50e78a=_0x3f799b;logger['info'](_0x8d86('0x52'),_0x50e78a['id']);logger[_0x8d86('0x22')](_0x8d86('0x53'),_0x50e78a['id'],_0x200e96[_0x8d86('0x3e')],_0x3accfe['type']);switch(_0x3accfe[_0x8d86('0x36')]){case _0x8d86('0x54'):emit(util[_0x8d86('0x2f')]('user:%s',_0x200e96['name']),_0x8d86('0x55'),{'recordId':_0x50e78a['id']});break;case _0x8d86('0x56'):emit(util[_0x8d86('0x2f')](_0x8d86('0x57'),_0x200e96[_0x8d86('0x3e')]),_0x8d86('0x58'),{'uri':util['format']('%s/%s/e',_0x505294[_0x8d86('0x59')],_0x50e78a['id'])});break;default:logger[_0x8d86('0x5a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8d86('0x5b')](function(_0x48e200){logger[_0x8d86('0x5a')](_0x8d86('0x4c'),JSON['stringify'](_0x48e200));});};exports['outbound']=function(_0x3e0812,_0x2c8532,_0x3b9129,_0x165fce,_0x456b2d,_0x400995,_0xd37505){var _0x629086,_0x1ec2a6,_0x19c322,_0x39703d;_0x400995[_0x8d86('0x49')]=intUtil[_0x8d86('0x4a')](_0x400995[_0x8d86('0x49')]);_0x400995[_0x8d86('0x42')]=intUtil['stripTrailingSlash'](_0x400995[_0x8d86('0x42')]);if(_0xd37505&&_0xd37505['recordingFormat']&&_0xd37505['recordingFormat']!==_0x8d86('0x5c')){logger[_0x8d86('0x22')](_0x8d86('0x5d'),_0x8d86('0x4d'));_0x2c8532[_0x8d86('0x4e')]=util['format'](_0x8d86('0x5e'),_0x400995['serverUrl'],_0x2c8532[_0x8d86('0x4f')],md5(_0x2c8532[_0x8d86('0x4f')]));}return getConnection(_0x400995)[_0x8d86('0x1c')](function(_0xda2a01){_0x39703d=_0xda2a01;return getUser(_0x400995,_0x165fce[_0x8d86('0x5f')],_0x39703d);})[_0x8d86('0x1c')](function(_0x591df1){_0x629086=_0x591df1;return getEndUser(_0x400995,_0x3b9129,_0x2c8532[_0x8d86('0x60')],_0x2c8532['destcalleridnum'],_0x39703d);})[_0x8d86('0x1c')](function(_0x5b7c13){_0x1ec2a6=_0x5b7c13;return getTicket(_0x400995,_0x629086,_0x1ec2a6,_0x3b9129,_0x2c8532,_0x3b9129[_0x8d86('0x61')],_0x39703d,_0x8d86('0x62'));})['then'](function(_0x28bca9){_0x19c322=_0x28bca9;logger['info'](_0x8d86('0x63'),_0x19c322['id']);logger['info'](_0x8d86('0x64'),_0x19c322['id'],_0x165fce[_0x8d86('0x3e')],_0x400995[_0x8d86('0x36')]);switch(_0x400995[_0x8d86('0x36')]){case _0x8d86('0x54'):emit(util[_0x8d86('0x2f')](_0x8d86('0x57'),_0x165fce[_0x8d86('0x3e')]),_0x8d86('0x55'),{'recordId':_0x19c322['id']});break;case _0x8d86('0x56'):emit(util['format'](_0x8d86('0x57'),_0x165fce[_0x8d86('0x3e')]),_0x8d86('0x58'),{'uri':util[_0x8d86('0x2f')](_0x8d86('0x65'),_0x39703d[_0x8d86('0x59')],_0x19c322['id'])});break;default:logger[_0x8d86('0x5a')](_0x8d86('0x5d'),_0x8d86('0x66'));}})[_0x8d86('0x5b')](function(_0x22360f){logger[_0x8d86('0x5a')](_0x8d86('0x5d'),JSON[_0x8d86('0x67')](_0x22360f));});};exports['unmanaged']=function(_0x352afc,_0x4aeaaa,_0x3e2cc1,_0x58d080,_0x364dbc,_0x247784){var _0x5771f1,_0x70ed61,_0xddc654,_0x21ae38;_0x247784[_0x8d86('0x49')]=intUtil['stripTrailingSlash'](_0x247784[_0x8d86('0x49')]);_0x247784[_0x8d86('0x42')]=intUtil[_0x8d86('0x4a')](_0x247784['remoteUri']);if(_0x364dbc&&_0x364dbc['monitor_format']){logger[_0x8d86('0x22')]('['+_0x4aeaaa['lastevent'][_0x8d86('0x68')]()+']',_0x8d86('0x4d'));_0x4aeaaa[_0x8d86('0x4e')]=util[_0x8d86('0x2f')](_0x8d86('0x5e'),_0x247784[_0x8d86('0x49')],_0x4aeaaa[_0x8d86('0x4f')],md5(_0x4aeaaa[_0x8d86('0x4f')]));}else{_0x4aeaaa[_0x8d86('0x4e')]='';}return getConnection(_0x247784)['then'](function(_0x19e25b){_0x21ae38=_0x19e25b;if(!_[_0x8d86('0x17')](_0x58d080)){return getUser(_0x247784,_0x58d080[_0x8d86('0x3e')],_0x21ae38);}else{return getUser(_0x247784,null,_0x21ae38);}})[_0x8d86('0x1c')](function(_0x34ce3c){_0x5771f1=_0x34ce3c;return getEndUser(_0x247784,_0x3e2cc1,_0x4aeaaa[_0x8d86('0x50')],_0x4aeaaa[_0x8d86('0x51')],_0x21ae38);})[_0x8d86('0x1c')](function(_0x2ebe9f){_0x70ed61=_0x2ebe9f;return getTicket(_0x247784,_0x5771f1,_0x70ed61,_0x3e2cc1,_0x4aeaaa,_0x3e2cc1['Fields'],_0x21ae38);})['then'](function(_0x4f6c4f){_0xddc654=_0x4f6c4f;logger[_0x8d86('0x22')]('['+_0x4aeaaa['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0xddc654['id']);logger[_0x8d86('0x22')]('['+_0x4aeaaa[_0x8d86('0x69')][_0x8d86('0x68')]()+_0x8d86('0x6a'),_0x247784[_0x8d86('0x36')]);})[_0x8d86('0x5b')](function(_0x225ffc){logger[_0x8d86('0x5a')]('['+_0x4aeaaa['lastevent'][_0x8d86('0x68')]()+']',JSON[_0x8d86('0x67')](_0x225ffc));});}; \ 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 a5f20af..b2735a3 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x14d992,_0xa6ea84){var _0x10a29f=function(_0x44b93f){while(--_0x44b93f){_0x14d992['push'](_0x14d992['shift']());}};_0x10a29f(++_0xa6ea84);}(_0x5fc3,0xa8));var _0x35fc=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x5fc3[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x49d95d,_0x1800e5){var _0x2334a8=function(_0x2e41b9){while(--_0x2e41b9){_0x49d95d['push'](_0x49d95d['shift']());}};_0x2334a8(++_0x1800e5);}(_0x1261,0x144));var _0x1126=function(_0x439662,_0x5defdb){_0x439662=_0x439662-0x0;var _0x251ec4=_0x1261[_0x439662];return _0x251ec4;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 13f5700..daafc5c 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 _0x8561=['get_entry_list','Employees','user_name','length','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','map','forEach','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','contacts','version','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','lastevent','Inbound','toUpperCase','request-promise','bluebird','util','./util','../../../../config/logger','redis','defaults','socket.io-emitter','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name'];(function(_0x499099,_0x4139dd){var _0x2c6bd4=function(_0x4f81ac){while(--_0x4f81ac){_0x499099['push'](_0x499099['shift']());}};_0x2c6bd4(++_0x4139dd);}(_0x8561,0x1b2));var _0x1856=function(_0x16f4fd,_0x3f5bcc){_0x16f4fd=_0x16f4fd-0x0;var _0x22cf4f=_0x8561[_0x16f4fd];return _0x22cf4f;};'use strict';var _=require('lodash');var rp=require(_0x1856('0x0'));var BPromise=require(_0x1856('0x1'));var md5=require('md5');var util=require(_0x1856('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1856('0x3'));var config=require('../../../../config/environment');var logger=require(_0x1856('0x4'))('sugarcrm');config[_0x1856('0x5')]=_[_0x1856('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1856('0x7'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x1c79b0,_0x567852,_0x4c19c5){io['to'](_0x1c79b0)['emit'](_0x567852,_0x4c19c5);}function getTicket(_0x5c3bc5,_0x1bfad8,_0x3e47b3,_0x510505,_0x55fe85,_0x97f276,_0x5a16bb,_0x342f95){logger[_0x1856('0x8')](_0x1856('0x9'));var _0x5bae90=new Date();var _0x17c611=[{'name':_0x1856('0xa'),'value':intUtil['getString'](_0x510505[_0x1856('0xb')],_0x55fe85,'\x20')},{'name':_0x1856('0xc'),'value':_0x1bfad8['id']},{'name':_0x1856('0xd'),'value':_0x1bfad8['id']},{'name':'description','value':intUtil[_0x1856('0xe')](_0x510505[_0x1856('0xf')],_0x55fe85,'\x0a')},{'name':_0x1856('0x10'),'value':_0x5bae90['toISOString']()[_0x1856('0x11')](0x0,0x13)[_0x1856('0x12')]('T','\x20')},{'name':_0x1856('0x13'),'value':'0'},{'name':_0x1856('0x14'),'value':'15'},{'name':_0x1856('0x15'),'value':_0x3e47b3['id']},{'name':_0x1856('0x16'),'value':_0x1856('0x17')},{'name':'parent_name','value':_0x3e47b3['name']},{'name':_0x1856('0x18'),'value':_0x342f95}];if(_0x97f276['length']){_['forEach'](_0x97f276,function(_0x1de74a){if(_0x55fe85[_0x1de74a[_0x1856('0x19')]]){_0x17c611['push']({'name':_0x1de74a['idField'],'value':_0x55fe85[_0x1de74a[_0x1856('0x19')]]});}});}return request({'form':{'method':_0x1856('0x1a'),'input_type':_0x1856('0x1b'),'response_type':_0x1856('0x1b'),'rest_data':JSON[_0x1856('0x1c')]({'session':_0x5a16bb['id'],'module_name':_0x1856('0x1d'),'name_value_list':_0x17c611})}});}function getAuth(_0x47e94c){return util[_0x1856('0x1e')](_0x1856('0x1f'),new Buffer(_0x47e94c[_0x1856('0x20')]+':X')[_0x1856('0x21')](_0x1856('0x22')));}function getServerInfo(_0x988cd2){return request({'form':{'method':_0x1856('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1856('0x1c')]({'session':_0x988cd2['id']})}});}function getUser(_0x31df72,_0x31dc64,_0x4b867e){if(!_[_0x1856('0x24')](_0x31dc64)){logger[_0x1856('0x8')](_0x1856('0x25'),_0x31dc64);return request({'form':{'method':_0x1856('0x26'),'input_type':'JSON','response_type':_0x1856('0x1b'),'rest_data':JSON[_0x1856('0x1c')]({'session':_0x4b867e['id'],'module_name':_0x1856('0x27'),'query':util[_0x1856('0x1e')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x31dc64),'order_by':'','offset':'0','select_fields':['id',_0x1856('0xa'),_0x1856('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x353d7d){if(_0x353d7d['entry_list'][_0x1856('0x29')]){var _0x4bf237=_[_0x1856('0x2a')](_0x353d7d[_0x1856('0x2b')],function(_0x1416b3){return _0x1416b3[_0x1856('0x2c')]['user_name'][_0x1856('0x2d')]===_0x31dc64;});if(_0x4bf237){logger[_0x1856('0x8')](_0x1856('0x2e'));return BPromise[_0x1856('0x2f')]({'id':_0x4bf237[_0x1856('0x2c')]['id'][_0x1856('0x2d')],'name':_0x4bf237['name_value_list'][_0x1856('0xa')][_0x1856('0x2d')]});}}logger[_0x1856('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1856('0x2f')]({'id':_0x4b867e[_0x1856('0x2c')][_0x1856('0x30')]['value'],'name':_0x4b867e[_0x1856('0x2c')]['user_name'][_0x1856('0x2d')]});});}else{logger[_0x1856('0x8')](_0x1856('0x31'));return BPromise[_0x1856('0x2f')]({'id':_0x4b867e[_0x1856('0x2c')][_0x1856('0x30')][_0x1856('0x2d')],'name':_0x4b867e['name_value_list'][_0x1856('0x28')][_0x1856('0x2d')]});}}function getEndUser(_0x32b201,_0x1ab4c6,_0x1da4db,_0x4bb7de){logger[_0x1856('0x8')](_0x1856('0x32'),_0x1da4db);return request({'form':{'method':_0x1856('0x26'),'input_type':'JSON','response_type':_0x1856('0x1b'),'rest_data':JSON[_0x1856('0x1c')]({'session':_0x4bb7de['id'],'module_name':_0x1856('0x17'),'query':util[_0x1856('0x1e')](_0x1856('0x33'),_0x1da4db),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x7aa22e){if(_0x7aa22e['entry_list'][_0x1856('0x29')]){var _0x3d3a1e=_['find'](_0x7aa22e['entry_list'],function(_0x20b3f9){return _0x20b3f9[_0x1856('0x2c')][_0x1856('0x34')][_0x1856('0x2d')]===_0x1da4db;});if(_0x3d3a1e){logger['info'](_0x1856('0x35'));return BPromise[_0x1856('0x2f')]({'id':_0x3d3a1e[_0x1856('0x2c')]['id'][_0x1856('0x2d')],'name':_0x3d3a1e[_0x1856('0x2c')][_0x1856('0xa')][_0x1856('0x2d')],'phone':_0x3d3a1e['name_value_list'][_0x1856('0x34')][_0x1856('0x2d')]});}}else{logger['info'](_0x1856('0x36'));return request({'form':{'method':_0x1856('0x1a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1856('0x1c')]({'session':_0x4bb7de['id'],'module_name':_0x1856('0x17'),'name_value_list':[{'name':_0x1856('0x37'),'value':_0x1ab4c6!==_0x1856('0x38')?_0x1ab4c6:util[_0x1856('0x1e')](_0x1856('0x39'),_0x1da4db)},{'name':'phone_home','value':_0x1da4db}]})}})[_0x1856('0x3a')](function(_0x5f1606){logger[_0x1856('0x8')](_0x1856('0x3b'));return BPromise['resolve']({'id':_0x5f1606['id'],'name':_0x5f1606[_0x1856('0x2b')][_0x1856('0x37')][_0x1856('0x2d')],'phone':_0x5f1606[_0x1856('0x2b')][_0x1856('0x34')][_0x1856('0x2d')]});});}});}function request(_0xf534ab){logger['debug']('[HTTP]',JSON[_0x1856('0x1c')](_0xf534ab));return rp(_['merge'](def,_0xf534ab));}function getTags(_0x490daf,_0x41b4b7){var _0x5d448b=[];if(_0x490daf&&_0x490daf['length']>0x0){_0x5d448b=_[_0x1856('0x3c')](_0x490daf,_0x41b4b7);}return _0x5d448b;}function getCustomFields(_0x9a69f1,_0x4c2cb){var _0x37080f=[];var _0x621d30={'custom_fields':[]};if(_0x9a69f1[_0x1856('0x29')]>0x0){_[_0x1856('0x3d')](_0x9a69f1,function(_0x28c38c){if(_0x28c38c[_0x1856('0x3e')]===_0x1856('0x3f')&&_0x28c38c['nameField']&&!_0x28c38c[_0x1856('0x40')]){_0x621d30[_0x28c38c[_0x1856('0x41')][_0x1856('0x42')]()]=_0x28c38c[_0x1856('0x43')][_0x1856('0x21')]();}else if(_0x28c38c['type']===_0x1856('0x3f')&&_0x28c38c[_0x1856('0x44')]&&_0x28c38c[_0x1856('0x40')]){_0x621d30[_0x1856('0x45')][_0x1856('0x46')]({'id':_0x28c38c['idField'],'value':_0x28c38c[_0x1856('0x43')][_0x1856('0x21')]()});}else if(_0x28c38c[_0x1856('0x3e')]==='variable'&&_0x28c38c['variableName']&&_0x28c38c['idField']&&_0x28c38c[_0x1856('0x40')]){_0x4c2cb[_0x28c38c[_0x1856('0x19')]]&&_0x621d30[_0x1856('0x45')][_0x1856('0x46')]({'id':_0x28c38c[_0x1856('0x44')],'value':_0x4c2cb[_0x28c38c['variableName']][_0x1856('0x21')]()});}else if(_0x28c38c[_0x1856('0x3e')]===_0x1856('0x47')&&_0x28c38c[_0x1856('0x48')]&&_0x28c38c['Variable'][_0x1856('0xa')]&&_0x28c38c[_0x1856('0x44')]&&_0x28c38c['customField']){_0x4c2cb[_0x28c38c[_0x1856('0x48')][_0x1856('0xa')][_0x1856('0x42')]()]&&_0x621d30[_0x1856('0x45')][_0x1856('0x46')]({'id':_0x28c38c[_0x1856('0x44')],'value':_0x4c2cb[_0x28c38c[_0x1856('0x48')][_0x1856('0xa')]['toLowerCase']()][_0x1856('0x21')]()});}});}return _0x621d30;}function getConnection(_0x57d374){return request({'method':'POST','form':{'method':_0x1856('0x49'),'input_type':'JSON','response_type':_0x1856('0x1b'),'rest_data':JSON[_0x1856('0x1c')]({'user_auth':{'user_name':_0x57d374[_0x1856('0x4a')],'password':_0x57d374[_0x1856('0x4b')],'encryption':_0x1856('0x4c')},'application':_0x1856('0x4d')})}})['then'](function(_0x174653){var _0x9617c4=_0x174653;if(_0x9617c4['id']){def['sessionID']=_0x9617c4['id'];return BPromise[_0x1856('0x2f')](_0x9617c4);}else{throw new Error(util[_0x1856('0x1e')](_0x1856('0x4e'),_0x57d374['id']));}});}function setRelationship(_0x1ca5a0,_0x5beae8,_0x1dfe52,_0x3d849e){return request({'form':{'method':_0x1856('0x4f'),'input_type':_0x1856('0x1b'),'response_type':_0x1856('0x1b'),'rest_data':JSON[_0x1856('0x1c')]({'session':_0x1ca5a0['id'],'module_name':'Calls','module_id':_0x1dfe52['id'],'link_field_name':_0x3d849e,'related_ids':[_0x5beae8['id']]})}});}exports['queue']=function(_0x16dd88,_0x1ad7fe,_0x544d0a,_0x3dd26b,_0x391e32,_0x15d3b4){var _0xa2457c,_0x30068d,_0x593e60,_0x59d5f4;_0x15d3b4[_0x1856('0x50')]=intUtil[_0x1856('0x51')](_0x15d3b4[_0x1856('0x50')]);_0x15d3b4[_0x1856('0x52')]=intUtil[_0x1856('0x51')](_0x15d3b4[_0x1856('0x52')]);def[_0x1856('0x53')]=util['format'](_0x1856('0x54'),_0x15d3b4[_0x1856('0x50')]);if(_0x391e32&&_0x391e32['monitor_format']){logger[_0x1856('0x8')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1ad7fe[_0x1856('0x55')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15d3b4['serverUrl'],_0x1ad7fe[_0x1856('0x56')],md5(_0x1ad7fe[_0x1856('0x56')]));}else{_0x1ad7fe[_0x1856('0x55')]='';}return getConnection(_0x15d3b4)[_0x1856('0x3a')](function(_0x162f4c){_0x59d5f4=_0x162f4c;return getUser(_0x15d3b4,_0x3dd26b[_0x1856('0xa')],_0x59d5f4);})[_0x1856('0x3a')](function(_0x53eee2){_0xa2457c=_0x53eee2;logger[_0x1856('0x8')](_0x1856('0x57'),_0xa2457c['id']);return getEndUser(_0x15d3b4,_0x1ad7fe[_0x1856('0x58')],_0x1ad7fe[_0x1856('0x59')],_0x59d5f4);})[_0x1856('0x3a')](function(_0x1e3ba7){_0x30068d=_0x1e3ba7;logger[_0x1856('0x8')]('The\x20Enduser\x20ID\x20is:',_0x30068d['id']);return getTicket(_0x15d3b4,_0xa2457c,_0x30068d,_0x544d0a,_0x1ad7fe,_0x544d0a[_0x1856('0x5a')],_0x59d5f4,'Inbound');})[_0x1856('0x3a')](function(_0xe9006b){_0x593e60=_0xe9006b;logger[_0x1856('0x8')]('Ticket\x20created!');logger['info'](_0x1856('0x5b'),_0x593e60['id']);return setRelationship(_0x59d5f4,_0xa2457c,_0x593e60,'users');})['then'](function(){return setRelationship(_0x59d5f4,_0x30068d,_0x593e60,_0x1856('0x5c'));})[_0x1856('0x3a')](function(){return getServerInfo(_0x59d5f4);})[_0x1856('0x3a')](function(_0x5c92f5){var _0x23102e=parseInt(_0x5c92f5[_0x1856('0x5d')]['charAt'](0x0));var _0x18d5b3=util[_0x1856('0x1e')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x15d3b4[_0x1856('0x50')],_0x593e60['id']);if(_0x23102e>0x6){_0x18d5b3=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x15d3b4[_0x1856('0x50')],_0x593e60['id']);}logger[_0x1856('0x8')](_0x1856('0x5e'),_0x1856('0x5f'));emit(util[_0x1856('0x1e')](_0x1856('0x60'),_0x3dd26b[_0x1856('0xa')]),'trigger:browser:url',{'uri':_0x18d5b3});})[_0x1856('0x61')](function(_0x19f1b7){logger[_0x1856('0x62')](_0x1856('0x5e'),JSON[_0x1856('0x1c')](_0x19f1b7));});};exports[_0x1856('0x63')]=function(_0x5d4452,_0x60c701,_0x4cfb38,_0x1759e6,_0x179470,_0x454bec,_0x2eb1ab){var _0x1cb324,_0x480b2e,_0x45d8b6,_0x351bdd;_0x454bec[_0x1856('0x50')]=intUtil['stripTrailingSlash'](_0x454bec[_0x1856('0x50')]);_0x454bec[_0x1856('0x52')]=intUtil['stripTrailingSlash'](_0x454bec[_0x1856('0x52')]);def[_0x1856('0x53')]=util['format'](_0x1856('0x54'),_0x454bec[_0x1856('0x50')]);if(_0x2eb1ab&&_0x2eb1ab[_0x1856('0x64')]&&_0x2eb1ab[_0x1856('0x64')]!==_0x1856('0x65')){logger[_0x1856('0x8')](_0x1856('0x66'),_0x1856('0x67'));_0x60c701[_0x1856('0x55')]=util[_0x1856('0x1e')](_0x1856('0x68'),_0x454bec[_0x1856('0x52')],_0x60c701['uniqueid'],md5(_0x60c701[_0x1856('0x56')]));}return getConnection(_0x454bec)['then'](function(_0x4503ec){_0x351bdd=_0x4503ec;return getUser(_0x454bec,_0x1759e6[_0x1856('0xa')],_0x351bdd);})['then'](function(_0x44c28c){_0x1cb324=_0x44c28c;logger[_0x1856('0x8')](_0x1856('0x57'),_0x1cb324['id']);return getEndUser(_0x454bec,_0x60c701[_0x1856('0x69')],_0x60c701[_0x1856('0x6a')],_0x351bdd);})['then'](function(_0x36f31a){_0x480b2e=_0x36f31a;logger[_0x1856('0x8')]('The\x20Enduser\x20ID\x20is:',_0x480b2e['id']);return getTicket(_0x454bec,_0x1cb324,_0x480b2e,_0x4cfb38,_0x60c701,_0x4cfb38['Fields'],_0x351bdd,_0x1856('0x6b'));})[_0x1856('0x3a')](function(_0x3309f2){_0x45d8b6=_0x3309f2;logger['info'](_0x1856('0x6c'));logger[_0x1856('0x8')](_0x1856('0x5b'),_0x45d8b6['id']);return setRelationship(_0x351bdd,_0x1cb324,_0x45d8b6,_0x1856('0x6d'));})[_0x1856('0x3a')](function(){return setRelationship(_0x351bdd,_0x480b2e,_0x45d8b6,_0x1856('0x5c'));})[_0x1856('0x3a')](function(){return getServerInfo(_0x351bdd);})['then'](function(_0x6c2ec8){var _0x27dfce=parseInt(_0x6c2ec8[_0x1856('0x5d')][_0x1856('0x6e')](0x0));var _0x2065a7=util['format'](_0x1856('0x6f'),_0x454bec['remoteUri'],_0x45d8b6['id']);if(_0x27dfce>0x6){_0x2065a7=util['format'](_0x1856('0x70'),_0x454bec['remoteUri'],_0x45d8b6['id']);}logger['info']('[OUTBOUND]',_0x1856('0x5f'));emit(util[_0x1856('0x1e')](_0x1856('0x60'),_0x1759e6['name']),_0x1856('0x71'),{'uri':_0x2065a7});})['catch'](function(_0x1b15df){logger[_0x1856('0x62')](_0x1856('0x66'),JSON[_0x1856('0x1c')](_0x1b15df));});};exports[_0x1856('0x72')]=function(_0x13487e,_0x2e8a7a,_0x5165f9,_0x47a0ca,_0x179d5f,_0x2e5c86){var _0x116855,_0x417109,_0x44b0da,_0xaf08f8;_0x2e5c86[_0x1856('0x50')]=intUtil[_0x1856('0x51')](_0x2e5c86[_0x1856('0x50')]);_0x2e5c86[_0x1856('0x52')]=intUtil[_0x1856('0x51')](_0x2e5c86[_0x1856('0x52')]);def['uri']=util[_0x1856('0x1e')](_0x1856('0x54'),_0x2e5c86[_0x1856('0x50')]);if(_0x179d5f&&_0x179d5f['monitor_format']){logger['info']('['+_0x2e8a7a[_0x1856('0x73')]['toUpperCase']()+']',_0x1856('0x67'));_0x2e8a7a[_0x1856('0x55')]=util[_0x1856('0x1e')](_0x1856('0x68'),_0x2e5c86[_0x1856('0x52')],_0x2e8a7a['uniqueid'],md5(_0x2e8a7a['uniqueid']));}else{_0x2e8a7a[_0x1856('0x55')]='';}return getConnection(_0x2e5c86)[_0x1856('0x3a')](function(_0x2c754b){_0xaf08f8=_0x2c754b;if(!_[_0x1856('0x24')](_0x47a0ca)){return getUser(_0x2e5c86,_0x47a0ca[_0x1856('0xa')],_0xaf08f8);}else{return getUser(_0x2e5c86,null,_0xaf08f8);}})['then'](function(_0x37ae2e){_0x116855=_0x37ae2e;logger[_0x1856('0x8')](_0x1856('0x57'),_0x116855['id']);return getEndUser(_0x2e5c86,_0x2e8a7a[_0x1856('0x58')],_0x2e8a7a['calleridnum'],_0xaf08f8);})[_0x1856('0x3a')](function(_0x5bbd91){_0x417109=_0x5bbd91;logger['info']('The\x20Enduser\x20ID\x20is:',_0x417109['id']);return getTicket(_0x2e5c86,_0x116855,_0x417109,_0x5165f9,_0x2e8a7a,_0x5165f9['Fields'],_0xaf08f8,_0x1856('0x74'));})['then'](function(_0x1852f2){_0x44b0da=_0x1852f2;logger[_0x1856('0x8')](_0x1856('0x6c'));logger[_0x1856('0x8')](_0x1856('0x5b'),_0x44b0da['id']);return setRelationship(_0xaf08f8,_0x116855,_0x44b0da,_0x1856('0x6d'));})[_0x1856('0x3a')](function(){return setRelationship(_0xaf08f8,_0x417109,_0x44b0da,_0x1856('0x5c'));})['then'](function(){return getServerInfo(_0xaf08f8);})[_0x1856('0x61')](function(_0x232c57){logger['error']('['+_0x2e8a7a[_0x1856('0x73')][_0x1856('0x75')]()+']',JSON[_0x1856('0x1c')](_0x232c57));});}; \ No newline at end of file +var _0x7096=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','version','user:%s','unmanaged','toUpperCase','lastevent','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','replace','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','customField','nameField','toLowerCase','content','string','custom_fields','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x241b4b,_0x206d5a){var _0x2220d0=function(_0x319241){while(--_0x319241){_0x241b4b['push'](_0x241b4b['shift']());}};_0x2220d0(++_0x206d5a);}(_0x7096,0x10c));var _0x6709=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7096[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var rp=require(_0x6709('0x0'));var BPromise=require('bluebird');var md5=require(_0x6709('0x1'));var util=require('util');var Redis=require(_0x6709('0x2'));var intUtil=require(_0x6709('0x3'));var config=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));config[_0x6709('0x7')]=_[_0x6709('0x8')](config[_0x6709('0x7')],{'host':_0x6709('0x9'),'port':0x18eb});var io=require(_0x6709('0xa'))(new Redis(config[_0x6709('0x7')]));var def={'method':_0x6709('0xb'),'json':!![]};function emit(_0x30147f,_0x513ab6,_0x5af380){io['to'](_0x30147f)[_0x6709('0xc')](_0x513ab6,_0x5af380);}function getTicket(_0x2d8c0b,_0xbcb47,_0x1aa476,_0x12eea2,_0x426ea1,_0x5de1fa,_0x5b9f26,_0x329aa9){logger[_0x6709('0xd')](_0x6709('0xe'));var _0x84e9e6=new Date();var _0x31ac88=[{'name':_0x6709('0xf'),'value':intUtil[_0x6709('0x10')](_0x12eea2[_0x6709('0x11')],_0x426ea1,'\x20')},{'name':'assigned_user_id','value':_0xbcb47['id']},{'name':_0x6709('0x12'),'value':_0xbcb47['id']},{'name':_0x6709('0x13'),'value':intUtil[_0x6709('0x10')](_0x12eea2[_0x6709('0x14')],_0x426ea1,'\x0a')},{'name':'date_start','value':_0x84e9e6[_0x6709('0x15')]()['slice'](0x0,0x13)[_0x6709('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x6709('0x17'),'value':'15'},{'name':_0x6709('0x18'),'value':_0x1aa476['id']},{'name':_0x6709('0x19'),'value':_0x6709('0x1a')},{'name':'parent_name','value':_0x1aa476['name']},{'name':'direction','value':_0x329aa9}];if(_0x5de1fa[_0x6709('0x1b')]){_[_0x6709('0x1c')](_0x5de1fa,function(_0x4a732e){if(_0x426ea1[_0x4a732e[_0x6709('0x1d')]]){_0x31ac88[_0x6709('0x1e')]({'name':_0x4a732e[_0x6709('0x1f')],'value':_0x426ea1[_0x4a732e['variableName']]});}});}return request({'form':{'method':_0x6709('0x20'),'input_type':_0x6709('0x21'),'response_type':_0x6709('0x21'),'rest_data':JSON[_0x6709('0x22')]({'session':_0x5b9f26['id'],'module_name':'Calls','name_value_list':_0x31ac88})}});}function getAuth(_0x3c4971){return util[_0x6709('0x23')](_0x6709('0x24'),new Buffer(_0x3c4971[_0x6709('0x25')]+':X')[_0x6709('0x26')](_0x6709('0x27')));}function getServerInfo(_0x45921e){return request({'form':{'method':_0x6709('0x28'),'input_type':_0x6709('0x21'),'response_type':_0x6709('0x21'),'rest_data':JSON[_0x6709('0x22')]({'session':_0x45921e['id']})}});}function getUser(_0xa36371,_0x5cf48b,_0x29f25f){if(!_[_0x6709('0x29')](_0x5cf48b)){logger[_0x6709('0xd')]('Getting\x20agent\x20with\x20name',_0x5cf48b);return request({'form':{'method':_0x6709('0x2a'),'input_type':_0x6709('0x21'),'response_type':_0x6709('0x21'),'rest_data':JSON[_0x6709('0x22')]({'session':_0x29f25f['id'],'module_name':'Employees','query':util[_0x6709('0x23')](_0x6709('0x2b'),_0x5cf48b),'order_by':'','offset':'0','select_fields':['id','name',_0x6709('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6709('0x2d')](function(_0x5dbb87){if(_0x5dbb87[_0x6709('0x2e')][_0x6709('0x1b')]){var _0x50ada6=_[_0x6709('0x2f')](_0x5dbb87['entry_list'],function(_0x46a325){return _0x46a325[_0x6709('0x30')]['user_name'][_0x6709('0x31')]===_0x5cf48b;});if(_0x50ada6){logger['info'](_0x6709('0x32'));return BPromise[_0x6709('0x33')]({'id':_0x50ada6['name_value_list']['id'][_0x6709('0x31')],'name':_0x50ada6['name_value_list'][_0x6709('0xf')][_0x6709('0x31')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6709('0x33')]({'id':_0x29f25f[_0x6709('0x30')][_0x6709('0x34')][_0x6709('0x31')],'name':_0x29f25f[_0x6709('0x30')][_0x6709('0x2c')][_0x6709('0x31')]});});}else{logger[_0x6709('0xd')](_0x6709('0x35'));return BPromise['resolve']({'id':_0x29f25f[_0x6709('0x30')][_0x6709('0x34')][_0x6709('0x31')],'name':_0x29f25f[_0x6709('0x30')]['user_name'][_0x6709('0x31')]});}}function getEndUser(_0x1da95d,_0x124e01,_0x1bd075,_0x4fd344){logger[_0x6709('0xd')](_0x6709('0x36'),_0x1bd075);return request({'form':{'method':'get_entry_list','input_type':_0x6709('0x21'),'response_type':_0x6709('0x21'),'rest_data':JSON['stringify']({'session':_0x4fd344['id'],'module_name':_0x6709('0x1a'),'query':util[_0x6709('0x23')](_0x6709('0x37'),_0x1bd075),'order_by':'','offset':'0','select_fields':['id',_0x6709('0xf'),_0x6709('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6709('0x2d')](function(_0x2cd68b){if(_0x2cd68b['entry_list'][_0x6709('0x1b')]){var _0x34df09=_['find'](_0x2cd68b[_0x6709('0x2e')],function(_0x12ca63){return _0x12ca63[_0x6709('0x30')][_0x6709('0x38')][_0x6709('0x31')]===_0x1bd075;});if(_0x34df09){logger[_0x6709('0xd')]('Enduser\x20found!');return BPromise[_0x6709('0x33')]({'id':_0x34df09['name_value_list']['id'][_0x6709('0x31')],'name':_0x34df09[_0x6709('0x30')][_0x6709('0xf')]['value'],'phone':_0x34df09[_0x6709('0x30')][_0x6709('0x38')][_0x6709('0x31')]});}}else{logger[_0x6709('0xd')](_0x6709('0x39'));return request({'form':{'method':_0x6709('0x20'),'input_type':_0x6709('0x21'),'response_type':'JSON','rest_data':JSON[_0x6709('0x22')]({'session':_0x4fd344['id'],'module_name':_0x6709('0x1a'),'name_value_list':[{'name':_0x6709('0x3a'),'value':_0x124e01!==_0x6709('0x3b')?_0x124e01:util[_0x6709('0x23')](_0x6709('0x3c'),_0x1bd075)},{'name':_0x6709('0x38'),'value':_0x1bd075}]})}})['then'](function(_0x5abb53){logger[_0x6709('0xd')](_0x6709('0x3d'));return BPromise[_0x6709('0x33')]({'id':_0x5abb53['id'],'name':_0x5abb53[_0x6709('0x2e')]['first_name']['value'],'phone':_0x5abb53['entry_list'][_0x6709('0x38')][_0x6709('0x31')]});});}});}function request(_0x54f74e){logger[_0x6709('0x3e')](_0x6709('0x3f'),JSON['stringify'](_0x54f74e));return rp(_['merge'](def,_0x54f74e));}function getTags(_0x2b24b3,_0x2a4445){var _0xdc9898=[];if(_0x2b24b3&&_0x2b24b3[_0x6709('0x1b')]>0x0){_0xdc9898=_[_0x6709('0x40')](_0x2b24b3,_0x2a4445);}return _0xdc9898;}function getCustomFields(_0x47c88c,_0x5a8fc5){var _0x4d93e4=[];var _0x26e871={'custom_fields':[]};if(_0x47c88c[_0x6709('0x1b')]>0x0){_[_0x6709('0x1c')](_0x47c88c,function(_0x5d5d80){if(_0x5d5d80[_0x6709('0x41')]==='string'&&_0x5d5d80['nameField']&&!_0x5d5d80[_0x6709('0x42')]){_0x26e871[_0x5d5d80[_0x6709('0x43')][_0x6709('0x44')]()]=_0x5d5d80[_0x6709('0x45')][_0x6709('0x26')]();}else if(_0x5d5d80[_0x6709('0x41')]===_0x6709('0x46')&&_0x5d5d80[_0x6709('0x1f')]&&_0x5d5d80[_0x6709('0x42')]){_0x26e871[_0x6709('0x47')][_0x6709('0x1e')]({'id':_0x5d5d80[_0x6709('0x1f')],'value':_0x5d5d80[_0x6709('0x45')][_0x6709('0x26')]()});}else if(_0x5d5d80[_0x6709('0x41')]==='variable'&&_0x5d5d80[_0x6709('0x1d')]&&_0x5d5d80['idField']&&_0x5d5d80['customField']){_0x5a8fc5[_0x5d5d80[_0x6709('0x1d')]]&&_0x26e871[_0x6709('0x47')][_0x6709('0x1e')]({'id':_0x5d5d80[_0x6709('0x1f')],'value':_0x5a8fc5[_0x5d5d80[_0x6709('0x1d')]][_0x6709('0x26')]()});}else if(_0x5d5d80[_0x6709('0x41')]===_0x6709('0x48')&&_0x5d5d80['Variable']&&_0x5d5d80[_0x6709('0x49')][_0x6709('0xf')]&&_0x5d5d80[_0x6709('0x1f')]&&_0x5d5d80[_0x6709('0x42')]){_0x5a8fc5[_0x5d5d80['Variable'][_0x6709('0xf')]['toLowerCase']()]&&_0x26e871[_0x6709('0x47')][_0x6709('0x1e')]({'id':_0x5d5d80[_0x6709('0x1f')],'value':_0x5a8fc5[_0x5d5d80[_0x6709('0x49')][_0x6709('0xf')]['toLowerCase']()][_0x6709('0x26')]()});}});}return _0x26e871;}function getConnection(_0x63bf25){return request({'method':_0x6709('0xb'),'form':{'method':_0x6709('0x4a'),'input_type':_0x6709('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x63bf25[_0x6709('0x4b')],'password':_0x63bf25['password'],'encryption':'PLAIN'},'application':_0x6709('0x4c')})}})[_0x6709('0x2d')](function(_0x1bf824){var _0x341635=_0x1bf824;if(_0x341635['id']){def[_0x6709('0x4d')]=_0x341635['id'];return BPromise[_0x6709('0x33')](_0x341635);}else{throw new Error(util[_0x6709('0x23')](_0x6709('0x4e'),_0x63bf25['id']));}});}function setRelationship(_0x12cc06,_0x420ca6,_0x3c6d1f,_0x4d4ff9){return request({'form':{'method':_0x6709('0x4f'),'input_type':_0x6709('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x12cc06['id'],'module_name':_0x6709('0x50'),'module_id':_0x3c6d1f['id'],'link_field_name':_0x4d4ff9,'related_ids':[_0x420ca6['id']]})}});}exports[_0x6709('0x51')]=function(_0x14bdd3,_0x1875e3,_0x521e83,_0x3dea08,_0x492bca,_0x1f838d){var _0x1a7244,_0xadd1ea,_0xeec99c,_0x23f166;_0x1f838d['remoteUri']=intUtil['stripTrailingSlash'](_0x1f838d[_0x6709('0x52')]);_0x1f838d[_0x6709('0x53')]=intUtil['stripTrailingSlash'](_0x1f838d[_0x6709('0x53')]);def[_0x6709('0x54')]=util['format'](_0x6709('0x55'),_0x1f838d[_0x6709('0x52')]);if(_0x492bca&&_0x492bca[_0x6709('0x56')]){logger[_0x6709('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1875e3[_0x6709('0x57')]=util['format'](_0x6709('0x58'),_0x1f838d[_0x6709('0x53')],_0x1875e3[_0x6709('0x59')],md5(_0x1875e3['uniqueid']));}else{_0x1875e3[_0x6709('0x57')]='';}return getConnection(_0x1f838d)['then'](function(_0x50c812){_0x23f166=_0x50c812;return getUser(_0x1f838d,_0x3dea08[_0x6709('0xf')],_0x23f166);})['then'](function(_0x124199){_0x1a7244=_0x124199;logger['info'](_0x6709('0x5a'),_0x1a7244['id']);return getEndUser(_0x1f838d,_0x1875e3[_0x6709('0x5b')],_0x1875e3[_0x6709('0x5c')],_0x23f166);})[_0x6709('0x2d')](function(_0x5bc444){_0xadd1ea=_0x5bc444;logger[_0x6709('0xd')](_0x6709('0x5d'),_0xadd1ea['id']);return getTicket(_0x1f838d,_0x1a7244,_0xadd1ea,_0x521e83,_0x1875e3,_0x521e83[_0x6709('0x5e')],_0x23f166,_0x6709('0x5f'));})[_0x6709('0x2d')](function(_0x3d4d1c){_0xeec99c=_0x3d4d1c;logger[_0x6709('0xd')]('Ticket\x20created!');logger[_0x6709('0xd')](_0x6709('0x60'),_0xeec99c['id']);return setRelationship(_0x23f166,_0x1a7244,_0xeec99c,_0x6709('0x61'));})[_0x6709('0x2d')](function(){return setRelationship(_0x23f166,_0xadd1ea,_0xeec99c,_0x6709('0x62'));})[_0x6709('0x2d')](function(){return getServerInfo(_0x23f166);})[_0x6709('0x2d')](function(_0x250bcd){var _0x36b514=parseInt(_0x250bcd['version'][_0x6709('0x63')](0x0));var _0x122080=util['format'](_0x6709('0x64'),_0x1f838d[_0x6709('0x52')],_0xeec99c['id']);if(_0x36b514>0x6){_0x122080=util[_0x6709('0x23')](_0x6709('0x65'),_0x1f838d[_0x6709('0x52')],_0xeec99c['id']);}logger[_0x6709('0xd')](_0x6709('0x66'),_0x6709('0x67'));emit(util[_0x6709('0x23')]('user:%s',_0x3dea08[_0x6709('0xf')]),_0x6709('0x68'),{'uri':_0x122080});})[_0x6709('0x69')](function(_0x379020){logger[_0x6709('0x6a')](_0x6709('0x66'),JSON[_0x6709('0x22')](_0x379020));});};exports[_0x6709('0x6b')]=function(_0x316108,_0x1355fd,_0x458bab,_0x53e0b9,_0x319b7e,_0x47f73e,_0x566d6d){var _0x336b01,_0xc65c7d,_0xeeee92,_0x426875;_0x47f73e[_0x6709('0x52')]=intUtil[_0x6709('0x6c')](_0x47f73e[_0x6709('0x52')]);_0x47f73e['serverUrl']=intUtil['stripTrailingSlash'](_0x47f73e[_0x6709('0x53')]);def['uri']=util[_0x6709('0x23')]('%s/service/v4_1/rest.php',_0x47f73e[_0x6709('0x52')]);if(_0x566d6d&&_0x566d6d[_0x6709('0x6d')]&&_0x566d6d['recordingFormat']!=='none'){logger['info'](_0x6709('0x6e'),_0x6709('0x6f'));_0x1355fd[_0x6709('0x57')]=util[_0x6709('0x23')](_0x6709('0x58'),_0x47f73e[_0x6709('0x53')],_0x1355fd[_0x6709('0x59')],md5(_0x1355fd[_0x6709('0x59')]));}return getConnection(_0x47f73e)[_0x6709('0x2d')](function(_0x398c12){_0x426875=_0x398c12;return getUser(_0x47f73e,_0x53e0b9[_0x6709('0xf')],_0x426875);})[_0x6709('0x2d')](function(_0xde3469){_0x336b01=_0xde3469;logger['info'](_0x6709('0x5a'),_0x336b01['id']);return getEndUser(_0x47f73e,_0x1355fd[_0x6709('0x70')],_0x1355fd[_0x6709('0x71')],_0x426875);})[_0x6709('0x2d')](function(_0x5ca0c5){_0xc65c7d=_0x5ca0c5;logger['info'](_0x6709('0x5d'),_0xc65c7d['id']);return getTicket(_0x47f73e,_0x336b01,_0xc65c7d,_0x458bab,_0x1355fd,_0x458bab['Fields'],_0x426875,'Outbound');})[_0x6709('0x2d')](function(_0x3b19ae){_0xeeee92=_0x3b19ae;logger['info'](_0x6709('0x72'));logger[_0x6709('0xd')](_0x6709('0x60'),_0xeeee92['id']);return setRelationship(_0x426875,_0x336b01,_0xeeee92,_0x6709('0x61'));})[_0x6709('0x2d')](function(){return setRelationship(_0x426875,_0xc65c7d,_0xeeee92,'contacts');})['then'](function(){return getServerInfo(_0x426875);})[_0x6709('0x2d')](function(_0x3f34a2){var _0x5906aa=parseInt(_0x3f34a2[_0x6709('0x73')][_0x6709('0x63')](0x0));var _0x1c90d7=util['format'](_0x6709('0x64'),_0x47f73e[_0x6709('0x52')],_0xeeee92['id']);if(_0x5906aa>0x6){_0x1c90d7=util[_0x6709('0x23')](_0x6709('0x65'),_0x47f73e['remoteUri'],_0xeeee92['id']);}logger['info'](_0x6709('0x6e'),_0x6709('0x67'));emit(util[_0x6709('0x23')](_0x6709('0x74'),_0x53e0b9[_0x6709('0xf')]),'trigger:browser:url',{'uri':_0x1c90d7});})[_0x6709('0x69')](function(_0x3e8e5c){logger['error'](_0x6709('0x6e'),JSON[_0x6709('0x22')](_0x3e8e5c));});};exports[_0x6709('0x75')]=function(_0x3c4de2,_0x1e8269,_0x48ca93,_0x1fc443,_0x5dcbbb,_0x31cc76){var _0x5ae7e5,_0x1a16c4,_0x5841c7,_0x25b11d;_0x31cc76[_0x6709('0x52')]=intUtil['stripTrailingSlash'](_0x31cc76[_0x6709('0x52')]);_0x31cc76[_0x6709('0x53')]=intUtil[_0x6709('0x6c')](_0x31cc76[_0x6709('0x53')]);def[_0x6709('0x54')]=util[_0x6709('0x23')]('%s/service/v4_1/rest.php',_0x31cc76[_0x6709('0x52')]);if(_0x5dcbbb&&_0x5dcbbb[_0x6709('0x56')]){logger[_0x6709('0xd')]('['+_0x1e8269['lastevent'][_0x6709('0x76')]()+']',_0x6709('0x6f'));_0x1e8269['recordingURL']=util[_0x6709('0x23')](_0x6709('0x58'),_0x31cc76[_0x6709('0x53')],_0x1e8269['uniqueid'],md5(_0x1e8269[_0x6709('0x59')]));}else{_0x1e8269[_0x6709('0x57')]='';}return getConnection(_0x31cc76)[_0x6709('0x2d')](function(_0x5c8564){_0x25b11d=_0x5c8564;if(!_[_0x6709('0x29')](_0x1fc443)){return getUser(_0x31cc76,_0x1fc443[_0x6709('0xf')],_0x25b11d);}else{return getUser(_0x31cc76,null,_0x25b11d);}})[_0x6709('0x2d')](function(_0xe71391){_0x5ae7e5=_0xe71391;logger[_0x6709('0xd')](_0x6709('0x5a'),_0x5ae7e5['id']);return getEndUser(_0x31cc76,_0x1e8269['calleridname'],_0x1e8269[_0x6709('0x5c')],_0x25b11d);})[_0x6709('0x2d')](function(_0x4a7f02){_0x1a16c4=_0x4a7f02;logger[_0x6709('0xd')](_0x6709('0x5d'),_0x1a16c4['id']);return getTicket(_0x31cc76,_0x5ae7e5,_0x1a16c4,_0x48ca93,_0x1e8269,_0x48ca93[_0x6709('0x5e')],_0x25b11d,'Inbound');})[_0x6709('0x2d')](function(_0x4358fa){_0x5841c7=_0x4358fa;logger[_0x6709('0xd')](_0x6709('0x72'));logger[_0x6709('0xd')](_0x6709('0x60'),_0x5841c7['id']);return setRelationship(_0x25b11d,_0x5ae7e5,_0x5841c7,_0x6709('0x61'));})['then'](function(){return setRelationship(_0x25b11d,_0x1a16c4,_0x5841c7,_0x6709('0x62'));})[_0x6709('0x2d')](function(){return getServerInfo(_0x25b11d);})[_0x6709('0x69')](function(_0x184063){logger[_0x6709('0x6a')]('['+_0x1e8269[_0x6709('0x77')][_0x6709('0x76')]()+']',JSON['stringify'](_0x184063));});}; \ 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 bf2f203..7eb8835 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 _0x981d=['%s:\x20%s','keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','content','variableName','push','toString','customVariable','name','toLowerCase','Variable','key','format','variable'];(function(_0x197500,_0x2c7696){var _0x50099c=function(_0x3dcb0f){while(--_0x3dcb0f){_0x197500['push'](_0x197500['shift']());}};_0x50099c(++_0x2c7696);}(_0x981d,0xc6));var _0xd981=function(_0x356f77,_0x597098){_0x356f77=_0x356f77-0x0;var _0x3eb949=_0x981d[_0x356f77];return _0x3eb949;};'use strict';var _=require(_0xd981('0x0'));var util=require(_0xd981('0x1'));exports[_0xd981('0x2')]=function(_0x1032ff,_0x206d65,_0x349fa0){var _0x202691=[];if(_0x1032ff[_0xd981('0x3')]>0x0){var _0x532a21=_[_0xd981('0x4')](_0x1032ff,['id']);for(var _0x5cd2b3=0x0;_0x5cd2b3<_0x532a21[_0xd981('0x3')];_0x5cd2b3++){var _0x4b5003=_0x532a21[_0x5cd2b3];if(_0x4b5003[_0xd981('0x5')]===_0xd981('0x6')){_0x202691['push'](_0x4b5003[_0xd981('0x7')]);}else if(_0x4b5003[_0xd981('0x5')]==='variable'&&_0x4b5003[_0xd981('0x8')]){_0x206d65[_0x4b5003[_0xd981('0x8')]]&&_0x202691[_0xd981('0x9')](_0x206d65[_0x4b5003['variableName']][_0xd981('0xa')]());}else if(_0x4b5003['type']===_0xd981('0xb')&&_0x4b5003['Variable']&&_0x4b5003['Variable'][_0xd981('0xc')]){_0x206d65[_0x4b5003['Variable']['name'][_0xd981('0xd')]()]&&_0x202691['push'](_0x206d65[_0x4b5003[_0xd981('0xe')][_0xd981('0xc')]['toLowerCase']()]['toString']());}else if(_0x4b5003[_0xd981('0x5')]==='keyValue'){if(_0x4b5003['keyType']===_0xd981('0x6')&&_0x4b5003[_0xd981('0xf')]){_0x202691['push'](util[_0xd981('0x10')]('%s:\x20%s',_0x4b5003['key'],_0x4b5003['keyContent']));}else if(_0x4b5003['keyType']===_0xd981('0x11')&&_0x4b5003[_0xd981('0x8')]&&_0x4b5003['key']){_0x206d65[_0x4b5003['variableName']]&&_0x202691[_0xd981('0x9')](util[_0xd981('0x10')](_0xd981('0x12'),_0x4b5003['key'],_0x206d65[_0x4b5003[_0xd981('0x8')]]));}else if(_0x4b5003[_0xd981('0x13')]==='customVariable'&&_0x4b5003[_0xd981('0xe')]&&_0x4b5003[_0xd981('0xe')][_0xd981('0xc')]&&_0x4b5003[_0xd981('0xf')]){_0x206d65[_0x4b5003['Variable']['name'][_0xd981('0xd')]()]&&_0x202691[_0xd981('0x9')](util[_0xd981('0x10')]('%s:\x20%s',_0x4b5003[_0xd981('0xf')],_0x206d65[_0x4b5003['Variable'][_0xd981('0xc')][_0xd981('0xd')]()]));}}}}return _0x202691[_0xd981('0x14')](_0x349fa0);};exports[_0xd981('0x15')]=function(_0x449e46){var _0x3d0f7f=_0x449e46['slice'](-0x1);if(_0x3d0f7f==='/'){_0x449e46=_0x449e46[_0xd981('0x16')](0x0,_0x449e46[_0xd981('0x17')](_0x3d0f7f));}return _0x449e46;};exports[_0xd981('0x18')]=function(_0x11277a){if(!_[_0xd981('0x19')](_0x11277a)&&_0x11277a!==''){var _0x2e5adf=/^(([^<>()\[\]\\.,;:\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 _0x2e5adf[_0xd981('0x1a')](String(_0x11277a)[_0xd981('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x17e7=['keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','toLowerCase','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','type','string','push','content','variableName','customVariable','Variable','name','toString'];(function(_0x3a677b,_0x41d64a){var _0xe411c0=function(_0x4efc75){while(--_0x4efc75){_0x3a677b['push'](_0x3a677b['shift']());}};_0xe411c0(++_0x41d64a);}(_0x17e7,0x1eb));var _0x717e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x17e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x717e('0x0'));exports[_0x717e('0x1')]=function(_0x3955cc,_0x4533cc,_0xbc5dd7){var _0x495ce8=[];if(_0x3955cc[_0x717e('0x2')]>0x0){var _0x51177b=_[_0x717e('0x3')](_0x3955cc,['id']);for(var _0x2404aa=0x0;_0x2404aa<_0x51177b[_0x717e('0x2')];_0x2404aa++){var _0xa260c7=_0x51177b[_0x2404aa];if(_0xa260c7[_0x717e('0x4')]===_0x717e('0x5')){_0x495ce8[_0x717e('0x6')](_0xa260c7[_0x717e('0x7')]);}else if(_0xa260c7[_0x717e('0x4')]==='variable'&&_0xa260c7[_0x717e('0x8')]){_0x4533cc[_0xa260c7[_0x717e('0x8')]]&&_0x495ce8['push'](_0x4533cc[_0xa260c7[_0x717e('0x8')]]['toString']());}else if(_0xa260c7['type']===_0x717e('0x9')&&_0xa260c7[_0x717e('0xa')]&&_0xa260c7[_0x717e('0xa')][_0x717e('0xb')]){_0x4533cc[_0xa260c7[_0x717e('0xa')]['name']['toLowerCase']()]&&_0x495ce8[_0x717e('0x6')](_0x4533cc[_0xa260c7[_0x717e('0xa')][_0x717e('0xb')]['toLowerCase']()][_0x717e('0xc')]());}else if(_0xa260c7[_0x717e('0x4')]===_0x717e('0xd')){if(_0xa260c7[_0x717e('0xe')]===_0x717e('0x5')&&_0xa260c7[_0x717e('0xf')]){_0x495ce8['push'](util[_0x717e('0x10')](_0x717e('0x11'),_0xa260c7[_0x717e('0xf')],_0xa260c7[_0x717e('0x12')]));}else if(_0xa260c7[_0x717e('0xe')]===_0x717e('0x13')&&_0xa260c7[_0x717e('0x8')]&&_0xa260c7[_0x717e('0xf')]){_0x4533cc[_0xa260c7[_0x717e('0x8')]]&&_0x495ce8[_0x717e('0x6')](util['format'](_0x717e('0x11'),_0xa260c7[_0x717e('0xf')],_0x4533cc[_0xa260c7[_0x717e('0x8')]]));}else if(_0xa260c7[_0x717e('0xe')]===_0x717e('0x9')&&_0xa260c7[_0x717e('0xa')]&&_0xa260c7['Variable'][_0x717e('0xb')]&&_0xa260c7['key']){_0x4533cc[_0xa260c7[_0x717e('0xa')]['name']['toLowerCase']()]&&_0x495ce8['push'](util[_0x717e('0x10')](_0x717e('0x11'),_0xa260c7[_0x717e('0xf')],_0x4533cc[_0xa260c7[_0x717e('0xa')]['name'][_0x717e('0x14')]()]));}}}}return _0x495ce8[_0x717e('0x15')](_0xbc5dd7);};exports[_0x717e('0x16')]=function(_0x23d79b){var _0x23288d=_0x23d79b['slice'](-0x1);if(_0x23288d==='/'){_0x23d79b=_0x23d79b[_0x717e('0x17')](0x0,_0x23d79b[_0x717e('0x18')](_0x23288d));}return _0x23d79b;};exports[_0x717e('0x19')]=function(_0x151ab2){if(!_[_0x717e('0x1a')](_0x151ab2)&&_0x151ab2!==''){var _0xa68a34=/^(([^<>()\[\]\\.,;:\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 _0xa68a34[_0x717e('0x1b')](String(_0x151ab2)[_0x717e('0x14')]());}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 eb64a9d..dc8504a 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 _0x0b6c=['user:%s','trigger:browser:url','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[OUTBOUND]','unmanaged','lastevent','calleridnum','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','type','string','idField','content','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','getString','Subjects','Descriptions','POST','format','remoteUri','create','sessionName','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','admin','getUser','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x3d193b,_0x41b77f){var _0xcecbea=function(_0x17f0a9){while(--_0x17f0a9){_0x3d193b['push'](_0x3d193b['shift']());}};_0xcecbea(++_0x41b77f);}(_0x0b6c,0x74));var _0xc0b6=function(_0x553af9,_0x44f58d){_0x553af9=_0x553af9-0x0;var _0x3d0b5a=_0x0b6c[_0x553af9];return _0x3d0b5a;};'use strict';var _=require(_0xc0b6('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xc0b6('0x1'));var util=require(_0xc0b6('0x2'));var Redis=require(_0xc0b6('0x3'));var intUtil=require(_0xc0b6('0x4'));var config=require(_0xc0b6('0x5'));var logger=require(_0xc0b6('0x6'))(_0xc0b6('0x7'));config['redis']=_['defaults'](config[_0xc0b6('0x8')],{'host':_0xc0b6('0x9'),'port':0x18eb});var io=require(_0xc0b6('0xa'))(new Redis(config[_0xc0b6('0x8')]));function emit(_0x42c7d1,_0xfa83ea,_0x194ad1){io['to'](_0x42c7d1)[_0xc0b6('0xb')](_0xfa83ea,_0x194ad1);}function getCustomFields(_0x1a8914,_0xe27346){var _0x3914ee={};if(_0x1a8914[_0xc0b6('0xc')]>0x0){_['forEach'](_0x1a8914,function(_0xf9d1d5){if(_0xf9d1d5[_0xc0b6('0xd')]===_0xc0b6('0xe')&&_0xf9d1d5[_0xc0b6('0xf')]){_0x3914ee[_0xf9d1d5[_0xc0b6('0xf')]]=_0xf9d1d5[_0xc0b6('0x10')]['toString']();}else if(_0xf9d1d5[_0xc0b6('0xd')]===_0xc0b6('0x11')&&_0xf9d1d5[_0xc0b6('0x12')]&&_0xf9d1d5[_0xc0b6('0xf')]&&_0xe27346[_0xf9d1d5[_0xc0b6('0x12')]]){_0x3914ee[_0xf9d1d5[_0xc0b6('0xf')]]=_0xe27346[_0xf9d1d5[_0xc0b6('0x12')]]['toString']();}else if(_0xf9d1d5[_0xc0b6('0xd')]==='customVariable'&&_0xf9d1d5[_0xc0b6('0x13')]&&_0xf9d1d5[_0xc0b6('0x13')][_0xc0b6('0x14')]&&_0xf9d1d5[_0xc0b6('0xf')]&&_0xe27346[_0xf9d1d5['Variable'][_0xc0b6('0x14')][_0xc0b6('0x15')]()]){_0x3914ee[_0xf9d1d5['idField']]=_0xe27346[_0xf9d1d5[_0xc0b6('0x13')][_0xc0b6('0x14')][_0xc0b6('0x15')]()]['toString']();}});}return _0x3914ee;}function createTicket(_0x1a2f10,_0x5a5b6f,_0x2b3cd4,_0x1096fd,_0x31e1db,_0x224407,_0x2623d5){logger[_0xc0b6('0x16')](_0xc0b6('0x17'));var _0x576c29=_[_0xc0b6('0x18')]({'parent_id':'','assigned_user_id':_0x5a5b6f['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0xc0b6('0x19')](_0x1096fd[_0xc0b6('0x1a')],_0x31e1db,'\x20'),'description':intUtil[_0xc0b6('0x19')](_0x1096fd[_0xc0b6('0x1b')],_0x31e1db,'\x0a'),'contact_id':_0x2b3cd4['id']},getCustomFields(_0x224407,_0x31e1db));var _0x45d77a={'method':_0xc0b6('0x1c'),'uri':util[_0xc0b6('0x1d')]('%s/webservice.php',_0x1a2f10[_0xc0b6('0x1e')]),'form':{'operation':_0xc0b6('0x1f'),'username':_0x1a2f10['username'],'sessionName':_0x2623d5[_0xc0b6('0x20')],'elementType':'HelpDesk','element':JSON[_0xc0b6('0x21')](_0x576c29)},'json':!![]};return request(_0x45d77a)[_0xc0b6('0x22')](function(_0x1d0252){if(_0x1d0252[_0xc0b6('0x23')]){return BPromise[_0xc0b6('0x24')]({'id':_0x1d0252[_0xc0b6('0x25')]['id']});}else{throw new Error(util[_0xc0b6('0x1d')](_0xc0b6('0x26'),JSON[_0xc0b6('0x21')](_0x1d0252[_0xc0b6('0x27')])));}})[_0xc0b6('0x28')](function(_0x59b5fd){var _0x40efab=_0x59b5fd[_0xc0b6('0x29')]||0x1f4;logger['error'](_0xc0b6('0x2a'),_0xc0b6('0x2b'),_0x40efab,JSON[_0xc0b6('0x21')](_0x59b5fd));});}function getUser(_0x4eea28,_0x1ce7f8,_0x3c67fc){if(intUtil[_0xc0b6('0x2c')](_0x1ce7f8)){logger[_0xc0b6('0x16')](_0xc0b6('0x2d'),_0x1ce7f8);return request({'method':_0xc0b6('0x2e'),'uri':util['format'](_0xc0b6('0x2f'),_0x4eea28['remoteUri']),'qs':{'operation':'query','username':_0x4eea28['username'],'sessionName':_0x3c67fc[_0xc0b6('0x20')],'query':util[_0xc0b6('0x1d')](_0xc0b6('0x30'),_0x1ce7f8)},'json':!![]})['then'](function(_0x8f439b){if(_0x8f439b[_0xc0b6('0x23')]&&_0x8f439b['result'][_0xc0b6('0xc')]){logger[_0xc0b6('0x16')](_0xc0b6('0x31'));return BPromise[_0xc0b6('0x24')]({'id':_0x8f439b[_0xc0b6('0x25')][0x0]['id'],'email':_0x8f439b['result'][0x0]['email1'],'name':_0x8f439b[_0xc0b6('0x25')][0x0][_0xc0b6('0x32')]+'\x20'+_0x8f439b['result'][_0xc0b6('0x33')]});}else{logger[_0xc0b6('0x16')](_0xc0b6('0x34'));return BPromise['resolve']({'id':_0x3c67fc[_0xc0b6('0x35')],'email':_0x4eea28[_0xc0b6('0x36')],'name':_0xc0b6('0x37')});}})[_0xc0b6('0x28')](function(_0x5b3ba7){var _0x165dbf=_0x5b3ba7[_0xc0b6('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xc0b6('0x38'),_0x165dbf,JSON[_0xc0b6('0x21')](_0x5b3ba7));});}else{logger[_0xc0b6('0x16')](_0xc0b6('0x34'));return BPromise[_0xc0b6('0x24')]({'id':_0x3c67fc[_0xc0b6('0x35')],'email':_0x4eea28[_0xc0b6('0x36')],'name':_0xc0b6('0x37')})[_0xc0b6('0x28')](function(_0x4aec94){var _0x2b91c7=_0x4aec94[_0xc0b6('0x29')]||0x1f4;logger[_0xc0b6('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc0b6('0x38'),_0x2b91c7,JSON[_0xc0b6('0x21')](_0x4aec94));});}}function getEndUser(_0x263e9e,_0x560048,_0x18df9d,_0x32ecd1){logger[_0xc0b6('0x16')]('Searching\x20end\x20user\x20with\x20phone',_0x18df9d);return request({'method':_0xc0b6('0x2e'),'uri':util['format'](_0xc0b6('0x2f'),_0x263e9e[_0xc0b6('0x1e')]),'qs':{'operation':_0xc0b6('0x39'),'username':_0x263e9e[_0xc0b6('0x36')],'sessionName':_0x32ecd1[_0xc0b6('0x20')],'query':util[_0xc0b6('0x1d')](_0xc0b6('0x3a'),_0x18df9d,_0x18df9d,_0x18df9d,_0x18df9d,_0x18df9d)},'json':!![]})[_0xc0b6('0x22')](function(_0x4c8497){if(_0x4c8497[_0xc0b6('0x23')]&&_0x4c8497[_0xc0b6('0x25')][_0xc0b6('0xc')]){logger[_0xc0b6('0x16')](_0xc0b6('0x3b'));return BPromise[_0xc0b6('0x24')]({'id':_0x4c8497[_0xc0b6('0x25')][0x0]['id'],'name':_0x4c8497[_0xc0b6('0x25')][0x0][_0xc0b6('0x3c')]+'\x20'+_0x4c8497[_0xc0b6('0x25')][0x0]['lastname'],'phone':_0x18df9d});}else{logger[_0xc0b6('0x16')](_0xc0b6('0x3d'));return request({'method':'POST','uri':util[_0xc0b6('0x1d')](_0xc0b6('0x2f'),_0x263e9e[_0xc0b6('0x1e')]),'form':{'operation':_0xc0b6('0x1f'),'sessionName':_0x32ecd1[_0xc0b6('0x20')],'elementType':_0xc0b6('0x3e'),'element':JSON[_0xc0b6('0x21')]({'lastname':_0x560048,'phone':_0x18df9d,'assigned_user_id':'\x20'})},'json':!![]})[_0xc0b6('0x22')](function(_0x4f29a2){logger[_0xc0b6('0x16')](_0xc0b6('0x3f'));return BPromise[_0xc0b6('0x24')]({'id':_0x4f29a2[_0xc0b6('0x25')]['id'],'name':_0x4f29a2[_0xc0b6('0x25')]['lastname'],'phone':_0x4f29a2[_0xc0b6('0x25')][_0xc0b6('0x40')]});})['catch'](function(_0x5e4ca7){var _0x11a6f5=_0x5e4ca7[_0xc0b6('0x29')]||0x1f4;logger[_0xc0b6('0x27')](_0xc0b6('0x2a'),_0xc0b6('0x41'),_0x11a6f5,JSON[_0xc0b6('0x21')](_0x5e4ca7));});}});}function getConnection(_0x18b2cb){var _0x3941fb=_0x18b2cb[_0xc0b6('0x36')];var _0x45a8fb=_0x18b2cb[_0xc0b6('0x42')];return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x18b2cb[_0xc0b6('0x1e')]),'qs':{'operation':_0xc0b6('0x43'),'username':_0x3941fb},'json':!![]})['then'](function(_0x5a8de2){if(_0x5a8de2['success']){return request({'method':'POST','uri':util['format'](_0xc0b6('0x2f'),_0x18b2cb[_0xc0b6('0x1e')]),'form':{'operation':_0xc0b6('0x44'),'username':_0x3941fb,'accessKey':md5(_0x5a8de2['result']['token']+_0x45a8fb)},'json':!![]});}})['then'](function(_0x46d507){if(_0x46d507[_0xc0b6('0x23')]){return BPromise['resolve'](_0x46d507[_0xc0b6('0x25')]);}else{throw new Error(util[_0xc0b6('0x1d')](_0xc0b6('0x45'),_0x18b2cb['id']));}})[_0xc0b6('0x28')](function(_0x1ef044){var _0x24e2c9=_0x1ef044[_0xc0b6('0x29')]||0x1f4;logger[_0xc0b6('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc0b6('0x46'),_0x24e2c9,JSON['stringify'](_0x1ef044));});}function request(_0x257dd4){logger['info']('[HTTP]',JSON[_0xc0b6('0x21')](_0x257dd4));return rp(_0x257dd4);}exports[_0xc0b6('0x47')]=function(_0x28dd4a,_0x1d887b,_0x28c92b,_0x39e0e6,_0x4dd7f0,_0x2478ce){var _0x17f9fb,_0x376ce2,_0x166c1c,_0x326475;_0x2478ce[_0xc0b6('0x1e')]=intUtil[_0xc0b6('0x48')](_0x2478ce[_0xc0b6('0x1e')]);if(_0x4dd7f0&&_0x4dd7f0[_0xc0b6('0x49')]){logger[_0xc0b6('0x16')](_0xc0b6('0x4a'),'Recording\x20is\x20enabled!');_0x1d887b[_0xc0b6('0x4b')]=util[_0xc0b6('0x1d')](_0xc0b6('0x4c'),_0x2478ce[_0xc0b6('0x4d')],_0x1d887b[_0xc0b6('0x4e')],md5(_0x1d887b[_0xc0b6('0x4e')]));}else{_0x1d887b[_0xc0b6('0x4b')]='';}return getConnection(_0x2478ce)['then'](function(_0x1bb696){_0x326475=_0x1bb696;return getUser(_0x2478ce,_0x39e0e6[_0xc0b6('0x4f')],_0x326475);})[_0xc0b6('0x22')](function(_0x215333){_0x17f9fb=_0x215333;logger[_0xc0b6('0x16')](_0xc0b6('0x50'),_0x17f9fb['id']);return getEndUser(_0x2478ce,_0x1d887b[_0xc0b6('0x51')],_0x1d887b['calleridnum'],_0x326475);})[_0xc0b6('0x22')](function(_0x21c4d7){_0x376ce2=_0x21c4d7;logger[_0xc0b6('0x16')](_0xc0b6('0x52'),_0x376ce2['id']);return createTicket(_0x2478ce,_0x17f9fb,_0x376ce2,_0x28c92b,_0x1d887b,_0x28c92b['Fields'],_0x326475);})[_0xc0b6('0x22')](function(_0x2e82d0){_0x166c1c=_0x2e82d0;logger['info'](_0xc0b6('0x53'));logger[_0xc0b6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x166c1c['id']);var _0x2a1ced=util[_0xc0b6('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x2478ce['remoteUri'],_[_0xc0b6('0x54')](_0x166c1c['id'],'x')[0x1]);logger[_0xc0b6('0x16')](_0xc0b6('0x4a'),_0xc0b6('0x55'));emit(util['format'](_0xc0b6('0x56'),_0x39e0e6['name']),_0xc0b6('0x57'),{'uri':_0x2a1ced});})['catch'](function(_0x487e2a){logger[_0xc0b6('0x27')](_0xc0b6('0x4a'),JSON[_0xc0b6('0x21')](_0x487e2a));});};exports['outbound']=function(_0x1977f1,_0x2b88bc,_0x3bfa69,_0x48a79f,_0x463601,_0xd34bc7,_0xffb8c){var _0x35635f,_0x226e42,_0x42938b,_0x15aa07;_0xd34bc7[_0xc0b6('0x1e')]=intUtil[_0xc0b6('0x48')](_0xd34bc7['remoteUri']);_0xd34bc7['serverUrl']=intUtil['stripTrailingSlash'](_0xd34bc7[_0xc0b6('0x4d')]);if(_0xffb8c&&_0xffb8c[_0xc0b6('0x58')]&&_0xffb8c[_0xc0b6('0x58')]!==_0xc0b6('0x59')){logger[_0xc0b6('0x16')]('[OUTBOUND]',_0xc0b6('0x5a'));_0x2b88bc[_0xc0b6('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd34bc7[_0xc0b6('0x4d')],_0x2b88bc['uniqueid'],md5(_0x2b88bc[_0xc0b6('0x4e')]));}return getConnection(_0xd34bc7)['then'](function(_0x3a892b){_0x15aa07=_0x3a892b;return getUser(_0xd34bc7,_0x48a79f[_0xc0b6('0x4f')],_0x15aa07);})[_0xc0b6('0x22')](function(_0x1a0c93){_0x35635f=_0x1a0c93;logger[_0xc0b6('0x16')](_0xc0b6('0x50'),_0x35635f['id']);return getEndUser(_0xd34bc7,_0x2b88bc[_0xc0b6('0x5b')],_0x2b88bc[_0xc0b6('0x5c')],_0x15aa07);})['then'](function(_0x3ac008){_0x226e42=_0x3ac008;logger[_0xc0b6('0x16')](_0xc0b6('0x52'),_0x226e42['id']);return createTicket(_0xd34bc7,_0x35635f,_0x226e42,_0x3bfa69,_0x2b88bc,_0x3bfa69[_0xc0b6('0x5d')],_0x15aa07);})['then'](function(_0x3d1712){_0x42938b=_0x3d1712;logger[_0xc0b6('0x16')]('Ticket\x20created!');logger[_0xc0b6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x42938b['id']);var _0x2965c4=util[_0xc0b6('0x1d')](_0xc0b6('0x5e'),_0xd34bc7['remoteUri'],_[_0xc0b6('0x54')](_0x42938b['id'],'x')[0x1]);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc0b6('0x1d')](_0xc0b6('0x56'),_0x48a79f[_0xc0b6('0x14')]),_0xc0b6('0x57'),{'uri':_0x2965c4});})[_0xc0b6('0x28')](function(_0x5f32b8){logger[_0xc0b6('0x27')](_0xc0b6('0x5f'),JSON['stringify'](_0x5f32b8));});};exports[_0xc0b6('0x60')]=function(_0x33a1b9,_0x405ab6,_0x5a155b,_0x38363f,_0x5c828a,_0x442f48){var _0x5f35f9,_0x32bda8,_0x33d16e,_0x4e62a0;_0x442f48[_0xc0b6('0x1e')]=intUtil[_0xc0b6('0x48')](_0x442f48[_0xc0b6('0x1e')]);_0x442f48[_0xc0b6('0x4d')]=intUtil[_0xc0b6('0x48')](_0x442f48[_0xc0b6('0x4d')]);if(_0x5c828a&&_0x5c828a['monitor_format']){logger[_0xc0b6('0x16')]('['+_0x405ab6[_0xc0b6('0x61')]['toUpperCase']()+']',_0xc0b6('0x5a'));_0x405ab6['recordingURL']=util[_0xc0b6('0x1d')](_0xc0b6('0x4c'),_0x442f48[_0xc0b6('0x4d')],_0x405ab6[_0xc0b6('0x4e')],md5(_0x405ab6['uniqueid']));}else{_0x405ab6[_0xc0b6('0x4b')]='';}return getConnection(_0x442f48)[_0xc0b6('0x22')](function(_0x29fe56){_0x4e62a0=_0x29fe56;return getUser(_0x442f48,'',_0x4e62a0);})[_0xc0b6('0x22')](function(_0x4748d8){_0x5f35f9=_0x4748d8;logger[_0xc0b6('0x16')](_0xc0b6('0x50'),_0x5f35f9['id']);return getEndUser(_0x442f48,_0x405ab6[_0xc0b6('0x51')],_0x405ab6[_0xc0b6('0x62')],_0x4e62a0);})[_0xc0b6('0x22')](function(_0x2f63c5){_0x32bda8=_0x2f63c5;logger[_0xc0b6('0x16')](_0xc0b6('0x52'),_0x32bda8['id']);return createTicket(_0x442f48,_0x5f35f9,_0x32bda8,_0x5a155b,_0x405ab6,_0x5a155b['Fields'],_0x4e62a0);})[_0xc0b6('0x22')](function(_0x49ad22){_0x33d16e=_0x49ad22;logger[_0xc0b6('0x16')](_0xc0b6('0x53'));logger[_0xc0b6('0x16')](_0xc0b6('0x63'),_0x33d16e['id']);})['catch'](function(_0x1923b6){logger[_0xc0b6('0x27')]('['+_0x405ab6[_0xc0b6('0x61')][_0xc0b6('0x64')]()+']',JSON[_0xc0b6('0x21')](_0x1923b6));});}; \ No newline at end of file +var _0xd361=['%s/webservice.php','remoteUri','sessionName','HelpDesk','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','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','[vTiger],\x20%s,\x20%s,\x20%s','stringify','Searching\x20end\x20user\x20with\x20phone','then','Enduser\x20found!','firstname','lastname','create','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd361,0x187));var _0x1d36=function(_0x2def1d,_0x5b2888){_0x2def1d=_0x2def1d-0x0;var _0x139b72=_0xd361[_0x2def1d];return _0x139b72;};'use strict';var _=require(_0x1d36('0x0'));var rp=require(_0x1d36('0x1'));var BPromise=require(_0x1d36('0x2'));var md5=require('md5');var util=require(_0x1d36('0x3'));var Redis=require(_0x1d36('0x4'));var intUtil=require(_0x1d36('0x5'));var config=require(_0x1d36('0x6'));var logger=require('../../../../config/logger')(_0x1d36('0x7'));config[_0x1d36('0x8')]=_['defaults'](config[_0x1d36('0x8')],{'host':_0x1d36('0x9'),'port':0x18eb});var io=require(_0x1d36('0xa'))(new Redis(config[_0x1d36('0x8')]));function emit(_0x5af888,_0x369b96,_0x2a224f){io['to'](_0x5af888)[_0x1d36('0xb')](_0x369b96,_0x2a224f);}function getCustomFields(_0x59e956,_0x193f4b){var _0x561861={};if(_0x59e956[_0x1d36('0xc')]>0x0){_[_0x1d36('0xd')](_0x59e956,function(_0x44f15a){if(_0x44f15a[_0x1d36('0xe')]===_0x1d36('0xf')&&_0x44f15a['idField']){_0x561861[_0x44f15a[_0x1d36('0x10')]]=_0x44f15a[_0x1d36('0x11')][_0x1d36('0x12')]();}else if(_0x44f15a['type']==='variable'&&_0x44f15a[_0x1d36('0x13')]&&_0x44f15a[_0x1d36('0x10')]&&_0x193f4b[_0x44f15a[_0x1d36('0x13')]]){_0x561861[_0x44f15a[_0x1d36('0x10')]]=_0x193f4b[_0x44f15a[_0x1d36('0x13')]][_0x1d36('0x12')]();}else if(_0x44f15a[_0x1d36('0xe')]===_0x1d36('0x14')&&_0x44f15a[_0x1d36('0x15')]&&_0x44f15a['Variable'][_0x1d36('0x16')]&&_0x44f15a[_0x1d36('0x10')]&&_0x193f4b[_0x44f15a[_0x1d36('0x15')][_0x1d36('0x16')]['toLowerCase']()]){_0x561861[_0x44f15a[_0x1d36('0x10')]]=_0x193f4b[_0x44f15a[_0x1d36('0x15')][_0x1d36('0x16')][_0x1d36('0x17')]()][_0x1d36('0x12')]();}});}return _0x561861;}function createTicket(_0x204e65,_0x2834f4,_0x4873bc,_0x119a71,_0x2979bc,_0x1751d3,_0x471666){logger[_0x1d36('0x18')](_0x1d36('0x19'));var _0xe68c9a=_[_0x1d36('0x1a')]({'parent_id':'','assigned_user_id':_0x2834f4['id'],'ticketpriorities':'Normal','ticketstatus':_0x1d36('0x1b'),'ticket_title':intUtil[_0x1d36('0x1c')](_0x119a71[_0x1d36('0x1d')],_0x2979bc,'\x20'),'description':intUtil['getString'](_0x119a71[_0x1d36('0x1e')],_0x2979bc,'\x0a'),'contact_id':_0x4873bc['id']},getCustomFields(_0x1751d3,_0x2979bc));var _0x2fe036={'method':_0x1d36('0x1f'),'uri':util[_0x1d36('0x20')](_0x1d36('0x21'),_0x204e65[_0x1d36('0x22')]),'form':{'operation':'create','username':_0x204e65['username'],'sessionName':_0x471666[_0x1d36('0x23')],'elementType':_0x1d36('0x24'),'element':JSON['stringify'](_0xe68c9a)},'json':!![]};return request(_0x2fe036)['then'](function(_0x55362b){if(_0x55362b[_0x1d36('0x25')]){return BPromise[_0x1d36('0x26')]({'id':_0x55362b[_0x1d36('0x27')]['id']});}else{throw new Error(util[_0x1d36('0x20')](_0x1d36('0x28'),JSON['stringify'](_0x55362b['error'])));}})[_0x1d36('0x29')](function(_0x37a024){var _0x262df6=_0x37a024[_0x1d36('0x2a')]||0x1f4;logger[_0x1d36('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x1d36('0x2c'),_0x262df6,JSON['stringify'](_0x37a024));});}function getUser(_0x4e5b09,_0x2a6638,_0x1de799){if(intUtil[_0x1d36('0x2d')](_0x2a6638)){logger[_0x1d36('0x18')](_0x1d36('0x2e'),_0x2a6638);return request({'method':_0x1d36('0x2f'),'uri':util[_0x1d36('0x20')](_0x1d36('0x21'),_0x4e5b09[_0x1d36('0x22')]),'qs':{'operation':_0x1d36('0x30'),'username':_0x4e5b09[_0x1d36('0x31')],'sessionName':_0x1de799['sessionName'],'query':util['format'](_0x1d36('0x32'),_0x2a6638)},'json':!![]})['then'](function(_0x56e68b){if(_0x56e68b[_0x1d36('0x25')]&&_0x56e68b[_0x1d36('0x27')][_0x1d36('0xc')]){logger[_0x1d36('0x18')](_0x1d36('0x33'));return BPromise[_0x1d36('0x26')]({'id':_0x56e68b[_0x1d36('0x27')][0x0]['id'],'email':_0x56e68b[_0x1d36('0x27')][0x0][_0x1d36('0x34')],'name':_0x56e68b[_0x1d36('0x27')][0x0]['first_name']+'\x20'+_0x56e68b[_0x1d36('0x27')][_0x1d36('0x35')]});}else{logger[_0x1d36('0x18')](_0x1d36('0x36'));return BPromise[_0x1d36('0x26')]({'id':_0x1de799[_0x1d36('0x37')],'email':_0x4e5b09[_0x1d36('0x31')],'name':_0x1d36('0x38')});}})['catch'](function(_0x18aa47){var _0x33f12c=_0x18aa47[_0x1d36('0x2a')]||0x1f4;logger[_0x1d36('0x2b')](_0x1d36('0x39'),'getUser',_0x33f12c,JSON['stringify'](_0x18aa47));});}else{logger[_0x1d36('0x18')](_0x1d36('0x36'));return BPromise['resolve']({'id':_0x1de799[_0x1d36('0x37')],'email':_0x4e5b09[_0x1d36('0x31')],'name':_0x1d36('0x38')})[_0x1d36('0x29')](function(_0x193d17){var _0x2143dc=_0x193d17['statusCode']||0x1f4;logger[_0x1d36('0x2b')](_0x1d36('0x39'),'getUser',_0x2143dc,JSON[_0x1d36('0x3a')](_0x193d17));});}}function getEndUser(_0x273ade,_0x2ea6d3,_0x5c5c14,_0x284839){logger['info'](_0x1d36('0x3b'),_0x5c5c14);return request({'method':_0x1d36('0x2f'),'uri':util[_0x1d36('0x20')](_0x1d36('0x21'),_0x273ade['remoteUri']),'qs':{'operation':_0x1d36('0x30'),'username':_0x273ade[_0x1d36('0x31')],'sessionName':_0x284839[_0x1d36('0x23')],'query':util[_0x1d36('0x20')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x5c5c14,_0x5c5c14,_0x5c5c14,_0x5c5c14,_0x5c5c14)},'json':!![]})[_0x1d36('0x3c')](function(_0x51982c){if(_0x51982c['success']&&_0x51982c[_0x1d36('0x27')]['length']){logger[_0x1d36('0x18')](_0x1d36('0x3d'));return BPromise['resolve']({'id':_0x51982c[_0x1d36('0x27')][0x0]['id'],'name':_0x51982c[_0x1d36('0x27')][0x0][_0x1d36('0x3e')]+'\x20'+_0x51982c[_0x1d36('0x27')][0x0][_0x1d36('0x3f')],'phone':_0x5c5c14});}else{logger[_0x1d36('0x18')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x1d36('0x1f'),'uri':util[_0x1d36('0x20')]('%s/webservice.php',_0x273ade['remoteUri']),'form':{'operation':_0x1d36('0x40'),'sessionName':_0x284839[_0x1d36('0x23')],'elementType':_0x1d36('0x41'),'element':JSON['stringify']({'lastname':_0x2ea6d3,'phone':_0x5c5c14,'assigned_user_id':'\x20'})},'json':!![]})[_0x1d36('0x3c')](function(_0x1ff828){logger['info'](_0x1d36('0x42'));return BPromise['resolve']({'id':_0x1ff828[_0x1d36('0x27')]['id'],'name':_0x1ff828[_0x1d36('0x27')][_0x1d36('0x3f')],'phone':_0x1ff828[_0x1d36('0x27')][_0x1d36('0x43')]});})[_0x1d36('0x29')](function(_0x578f13){var _0x258e18=_0x578f13[_0x1d36('0x2a')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x1d36('0x44'),_0x258e18,JSON['stringify'](_0x578f13));});}});}function getConnection(_0x113613){var _0x1e2aac=_0x113613[_0x1d36('0x31')];var _0x43ab86=_0x113613[_0x1d36('0x45')];return request({'method':'GET','uri':util[_0x1d36('0x20')](_0x1d36('0x21'),_0x113613[_0x1d36('0x22')]),'qs':{'operation':_0x1d36('0x46'),'username':_0x1e2aac},'json':!![]})[_0x1d36('0x3c')](function(_0x30becf){if(_0x30becf[_0x1d36('0x25')]){return request({'method':_0x1d36('0x1f'),'uri':util['format']('%s/webservice.php',_0x113613[_0x1d36('0x22')]),'form':{'operation':_0x1d36('0x47'),'username':_0x1e2aac,'accessKey':md5(_0x30becf['result'][_0x1d36('0x48')]+_0x43ab86)},'json':!![]});}})[_0x1d36('0x3c')](function(_0xa35816){if(_0xa35816[_0x1d36('0x25')]){return BPromise[_0x1d36('0x26')](_0xa35816[_0x1d36('0x27')]);}else{throw new Error(util[_0x1d36('0x20')](_0x1d36('0x49'),_0x113613['id']));}})[_0x1d36('0x29')](function(_0x2de222){var _0x5cf6fa=_0x2de222[_0x1d36('0x2a')]||0x1f4;logger[_0x1d36('0x2b')](_0x1d36('0x39'),_0x1d36('0x4a'),_0x5cf6fa,JSON[_0x1d36('0x3a')](_0x2de222));});}function request(_0x439c44){logger[_0x1d36('0x18')](_0x1d36('0x4b'),JSON[_0x1d36('0x3a')](_0x439c44));return rp(_0x439c44);}exports[_0x1d36('0x4c')]=function(_0xce3ff0,_0x26b1e4,_0x3e0b9a,_0x31480b,_0x58d5fc,_0x2342a9){var _0xe9b42d,_0x484da3,_0x50254e,_0x19021b;_0x2342a9[_0x1d36('0x22')]=intUtil['stripTrailingSlash'](_0x2342a9[_0x1d36('0x22')]);if(_0x58d5fc&&_0x58d5fc[_0x1d36('0x4d')]){logger[_0x1d36('0x18')](_0x1d36('0x4e'),'Recording\x20is\x20enabled!');_0x26b1e4['recordingURL']=util['format'](_0x1d36('0x4f'),_0x2342a9['serverUrl'],_0x26b1e4[_0x1d36('0x50')],md5(_0x26b1e4[_0x1d36('0x50')]));}else{_0x26b1e4[_0x1d36('0x51')]='';}return getConnection(_0x2342a9)[_0x1d36('0x3c')](function(_0xb5782b){_0x19021b=_0xb5782b;return getUser(_0x2342a9,_0x31480b[_0x1d36('0x52')],_0x19021b);})[_0x1d36('0x3c')](function(_0x593bb2){_0xe9b42d=_0x593bb2;logger[_0x1d36('0x18')](_0x1d36('0x53'),_0xe9b42d['id']);return getEndUser(_0x2342a9,_0x26b1e4['calleridname'],_0x26b1e4['calleridnum'],_0x19021b);})['then'](function(_0x571c34){_0x484da3=_0x571c34;logger[_0x1d36('0x18')](_0x1d36('0x54'),_0x484da3['id']);return createTicket(_0x2342a9,_0xe9b42d,_0x484da3,_0x3e0b9a,_0x26b1e4,_0x3e0b9a['Fields'],_0x19021b);})['then'](function(_0x97bf64){_0x50254e=_0x97bf64;logger[_0x1d36('0x18')](_0x1d36('0x55'));logger['info'](_0x1d36('0x56'),_0x50254e['id']);var _0x3d061e=util[_0x1d36('0x20')](_0x1d36('0x57'),_0x2342a9[_0x1d36('0x22')],_[_0x1d36('0x58')](_0x50254e['id'],'x')[0x1]);logger[_0x1d36('0x18')](_0x1d36('0x4e'),_0x1d36('0x59'));emit(util['format'](_0x1d36('0x5a'),_0x31480b[_0x1d36('0x16')]),_0x1d36('0x5b'),{'uri':_0x3d061e});})[_0x1d36('0x29')](function(_0x3802fe){logger[_0x1d36('0x2b')]('[QUEUE]',JSON['stringify'](_0x3802fe));});};exports[_0x1d36('0x5c')]=function(_0x4121c8,_0x526f5b,_0xdffb58,_0x10e6c7,_0x12f147,_0x1ea072,_0x29497d){var _0x48206e,_0x3a9aba,_0x3377b8,_0x147986;_0x1ea072[_0x1d36('0x22')]=intUtil[_0x1d36('0x5d')](_0x1ea072[_0x1d36('0x22')]);_0x1ea072['serverUrl']=intUtil['stripTrailingSlash'](_0x1ea072[_0x1d36('0x5e')]);if(_0x29497d&&_0x29497d[_0x1d36('0x5f')]&&_0x29497d[_0x1d36('0x5f')]!==_0x1d36('0x60')){logger['info'](_0x1d36('0x61'),_0x1d36('0x62'));_0x526f5b[_0x1d36('0x51')]=util[_0x1d36('0x20')](_0x1d36('0x4f'),_0x1ea072[_0x1d36('0x5e')],_0x526f5b[_0x1d36('0x50')],md5(_0x526f5b[_0x1d36('0x50')]));}return getConnection(_0x1ea072)['then'](function(_0x4b5af6){_0x147986=_0x4b5af6;return getUser(_0x1ea072,_0x10e6c7['email'],_0x147986);})[_0x1d36('0x3c')](function(_0x176071){_0x48206e=_0x176071;logger[_0x1d36('0x18')](_0x1d36('0x53'),_0x48206e['id']);return getEndUser(_0x1ea072,_0x526f5b[_0x1d36('0x63')],_0x526f5b[_0x1d36('0x64')],_0x147986);})['then'](function(_0x2a96ed){_0x3a9aba=_0x2a96ed;logger['info'](_0x1d36('0x54'),_0x3a9aba['id']);return createTicket(_0x1ea072,_0x48206e,_0x3a9aba,_0xdffb58,_0x526f5b,_0xdffb58['Fields'],_0x147986);})[_0x1d36('0x3c')](function(_0x3cf3a6){_0x3377b8=_0x3cf3a6;logger['info'](_0x1d36('0x55'));logger['info'](_0x1d36('0x56'),_0x3377b8['id']);var _0x4bde57=util[_0x1d36('0x20')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ea072['remoteUri'],_[_0x1d36('0x58')](_0x3377b8['id'],'x')[0x1]);logger[_0x1d36('0x18')](_0x1d36('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1d36('0x5a'),_0x10e6c7[_0x1d36('0x16')]),_0x1d36('0x5b'),{'uri':_0x4bde57});})[_0x1d36('0x29')](function(_0x20dcb0){logger['error'](_0x1d36('0x61'),JSON[_0x1d36('0x3a')](_0x20dcb0));});};exports[_0x1d36('0x65')]=function(_0x4fb539,_0x40de01,_0x2fa1ce,_0x2e0fb3,_0x266dd6,_0x5b1118){var _0x32180c,_0xfe698a,_0x1ddfad,_0x228770;_0x5b1118[_0x1d36('0x22')]=intUtil[_0x1d36('0x5d')](_0x5b1118['remoteUri']);_0x5b1118['serverUrl']=intUtil['stripTrailingSlash'](_0x5b1118['serverUrl']);if(_0x266dd6&&_0x266dd6[_0x1d36('0x4d')]){logger[_0x1d36('0x18')]('['+_0x40de01[_0x1d36('0x66')][_0x1d36('0x67')]()+']',_0x1d36('0x62'));_0x40de01['recordingURL']=util[_0x1d36('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b1118['serverUrl'],_0x40de01[_0x1d36('0x50')],md5(_0x40de01[_0x1d36('0x50')]));}else{_0x40de01[_0x1d36('0x51')]='';}return getConnection(_0x5b1118)[_0x1d36('0x3c')](function(_0x4582ba){_0x228770=_0x4582ba;return getUser(_0x5b1118,'',_0x228770);})['then'](function(_0x216ce2){_0x32180c=_0x216ce2;logger['info'](_0x1d36('0x53'),_0x32180c['id']);return getEndUser(_0x5b1118,_0x40de01[_0x1d36('0x68')],_0x40de01[_0x1d36('0x69')],_0x228770);})[_0x1d36('0x3c')](function(_0xd25540){_0xfe698a=_0xd25540;logger[_0x1d36('0x18')](_0x1d36('0x54'),_0xfe698a['id']);return createTicket(_0x5b1118,_0x32180c,_0xfe698a,_0x2fa1ce,_0x40de01,_0x2fa1ce['Fields'],_0x228770);})['then'](function(_0x2b18de){_0x1ddfad=_0x2b18de;logger['info'](_0x1d36('0x55'));logger[_0x1d36('0x18')](_0x1d36('0x56'),_0x1ddfad['id']);})['catch'](function(_0x47ac86){logger['error']('['+_0x40de01[_0x1d36('0x66')][_0x1d36('0x67')]()+']',JSON[_0x1d36('0x3a')](_0x47ac86));});}; \ 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 dfb7d91..7d8f41d 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 _0x9b9b=['type','string','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','length','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach'];(function(_0x494088,_0x31a588){var _0x3cf38d=function(_0x2392c6){while(--_0x2392c6){_0x494088['push'](_0x494088['shift']());}};_0x3cf38d(++_0x31a588);}(_0x9b9b,0x114));var _0xb9b9=function(_0x26f03d,_0x4866c2){_0x26f03d=_0x26f03d-0x0;var _0x42dc9f=_0x9b9b[_0x26f03d];return _0x42dc9f;};'use strict';var _=require('lodash');var rp=require(_0xb9b9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xb9b9('0x1'));var intUtil=require(_0xb9b9('0x2'));var config=require(_0xb9b9('0x3'));var logger=require(_0xb9b9('0x4'))(_0xb9b9('0x5'));config[_0xb9b9('0x6')]=_[_0xb9b9('0x7')](config[_0xb9b9('0x6')],{'host':_0xb9b9('0x8'),'port':0x18eb});var io=require(_0xb9b9('0x9'))(new Redis(config[_0xb9b9('0x6')]));function emit(_0x3ef9c1,_0x5be5bc,_0x297cb6){io['to'](_0x3ef9c1)[_0xb9b9('0xa')](_0x5be5bc,_0x297cb6);}var headers={'Content-Type':_0xb9b9('0xb'),'Accept':'application/json'};function getTicket(_0x4a645a,_0x2f6ff1,_0x139301,_0x127d29,_0x47fe6d){logger[_0xb9b9('0xc')](_0xb9b9('0xd'));return request({'uri':util[_0xb9b9('0xe')]('%s/tickets.json',_0x4a645a[_0xb9b9('0xf')]),'method':_0xb9b9('0x10'),'body':{'ticket':_[_0xb9b9('0x11')]({'requester_id':_0x139301['id'],'submitter_id':_0x2f6ff1?_0x2f6ff1['id']:undefined,'assignee_id':_0x2f6ff1?_0x2f6ff1['id']:undefined,'tags':getTags(_0x127d29[_0xb9b9('0x12')],_0xb9b9('0x13')),'subject':intUtil[_0xb9b9('0x14')](_0x127d29['Subjects'],_0x47fe6d,'\x20'),'description':intUtil['getString'](_0x127d29[_0xb9b9('0x15')],_0x47fe6d,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x127d29[_0xb9b9('0x15')],_0x47fe6d,'\x0a')}},getCustomFields(_0x127d29['Fields'],_0x47fe6d))}})[_0xb9b9('0x16')](function(_0x23bac9){logger[_0xb9b9('0xc')](_0xb9b9('0x17'));return _0x23bac9[_0xb9b9('0x18')];});}function getUser(_0x3fd09c,_0x42a55f){if(intUtil[_0xb9b9('0x19')](_0x42a55f)){logger['info'](_0xb9b9('0x1a'),_0x42a55f);return request({'uri':util['format'](_0xb9b9('0x1b'),_0x3fd09c[_0xb9b9('0xf')]),'qs':{'query':util[_0xb9b9('0xe')](_0xb9b9('0x1c'),_0x42a55f)}})['then'](function(_0x25d04f){if(_0x25d04f[_0xb9b9('0x1d')]){logger[_0xb9b9('0xc')](_0xb9b9('0x1e'));return _[_0xb9b9('0x1f')](_0x25d04f[_0xb9b9('0x20')],{'email':_0x42a55f,'role':_0xb9b9('0x21')});}else{logger[_0xb9b9('0xc')](_0xb9b9('0x22'));return request({'uri':util[_0xb9b9('0xe')](_0xb9b9('0x23'),_0x3fd09c[_0xb9b9('0xf')])})[_0xb9b9('0x16')](function(_0x4e33a0){logger[_0xb9b9('0xc')](_0xb9b9('0x24'));return _0x4e33a0[_0xb9b9('0x25')];});}});}else{logger['info'](_0xb9b9('0x22'));return request({'uri':util[_0xb9b9('0xe')]('%s/users/me.json',_0x3fd09c[_0xb9b9('0xf')])})[_0xb9b9('0x16')](function(_0x30371b){logger[_0xb9b9('0xc')](_0xb9b9('0x24'));return _0x30371b['user'];});}}function getEndUser(_0x4dfa3f,_0x33ab82,_0x426f2c){logger['info'](_0xb9b9('0x26'),_0x426f2c);return request({'uri':util[_0xb9b9('0xe')](_0xb9b9('0x1b'),_0x4dfa3f[_0xb9b9('0xf')]),'qs':{'query':util[_0xb9b9('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x426f2c)}})[_0xb9b9('0x16')](function(_0x554850){var _0x1e0c5e;if(_0x554850[_0xb9b9('0x20')]['length']){_0x554850[_0xb9b9('0x20')]=_[_0xb9b9('0x27')](_0x554850[_0xb9b9('0x20')],{'suspended':![],'role':'end-user'});if(_0x554850[_0xb9b9('0x20')][_0xb9b9('0x28')]){_0x1e0c5e=_[_0xb9b9('0x29')](_0x554850[_0xb9b9('0x20')]);}}if(_0x1e0c5e){logger['info'](_0xb9b9('0x2a'));return _0x1e0c5e;}else{logger[_0xb9b9('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb9b9('0xe')](_0xb9b9('0x2b'),_0x4dfa3f[_0xb9b9('0xf')]),'method':_0xb9b9('0x10'),'body':{'user':{'role':'end-user','name':util[_0xb9b9('0xe')](_0xb9b9('0x2c'),_0x33ab82||_0x426f2c),'phone':_0x426f2c}}})[_0xb9b9('0x16')](function(_0x2f68c5){logger['info'](_0xb9b9('0x2d'));return _0x2f68c5[_0xb9b9('0x25')];});}});}function getAuth(_0x532fa4){var _0x126fe2;if(_0x532fa4[_0xb9b9('0x2e')]===_0xb9b9('0x2f')){_0x126fe2=util[_0xb9b9('0xe')](_0xb9b9('0x30'),_0x532fa4[_0xb9b9('0x31')],_0x532fa4['password']);}else if(_0x532fa4[_0xb9b9('0x2e')]===_0xb9b9('0x32')){_0x126fe2=util['format'](_0xb9b9('0x33'),_0x532fa4[_0xb9b9('0x31')],_0x532fa4[_0xb9b9('0x32')]);}return util['format'](_0xb9b9('0x34'),new Buffer(_0x126fe2)['toString'](_0xb9b9('0x35')));}function request(_0x599b4b){logger[_0xb9b9('0x36')](_0xb9b9('0x37'),JSON[_0xb9b9('0x38')](_0x599b4b));return rp(_[_0xb9b9('0x7')](_0x599b4b,{'method':_0xb9b9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x76f4d4,_0x394c20){var _0x4960e1=[];if(_0x76f4d4&&_0x76f4d4['length']>0x0){_0x4960e1=_[_0xb9b9('0x3a')](_0x76f4d4,_0x394c20);}return _0x4960e1;}function getCustomFields(_0x134d6c,_0xec7bcf){var _0x53cbf9=[];var _0x29c60f={'custom_fields':[]};if(_0x134d6c['length']>0x0){_[_0xb9b9('0x3b')](_0x134d6c,function(_0x4147df){if(_0x4147df[_0xb9b9('0x3c')]===_0xb9b9('0x3d')&&_0x4147df[_0xb9b9('0x3e')]&&!_0x4147df[_0xb9b9('0x3f')]){_0x29c60f[_0x4147df[_0xb9b9('0x3e')][_0xb9b9('0x40')]()]=_0x4147df[_0xb9b9('0x41')][_0xb9b9('0x42')]();}else if(_0x4147df['type']===_0xb9b9('0x3d')&&_0x4147df[_0xb9b9('0x43')]&&_0x4147df[_0xb9b9('0x3f')]){_0x29c60f[_0xb9b9('0x44')][_0xb9b9('0x45')]({'id':_0x4147df[_0xb9b9('0x43')],'value':_0x4147df[_0xb9b9('0x41')][_0xb9b9('0x42')]()});}else if(_0x4147df[_0xb9b9('0x3c')]===_0xb9b9('0x46')&&_0x4147df['variableName']&&_0x4147df[_0xb9b9('0x43')]&&_0x4147df[_0xb9b9('0x3f')]){_0xec7bcf[_0x4147df[_0xb9b9('0x47')]]&&_0x29c60f[_0xb9b9('0x44')]['push']({'id':_0x4147df[_0xb9b9('0x43')],'value':_0xec7bcf[_0x4147df['variableName']]['toString']()});}else if(_0x4147df[_0xb9b9('0x3c')]===_0xb9b9('0x48')&&_0x4147df['Variable']&&_0x4147df['Variable'][_0xb9b9('0x13')]&&_0x4147df[_0xb9b9('0x43')]&&_0x4147df[_0xb9b9('0x3f')]){_0xec7bcf[_0x4147df[_0xb9b9('0x49')]['name'][_0xb9b9('0x40')]()]&&_0x29c60f[_0xb9b9('0x44')][_0xb9b9('0x45')]({'id':_0x4147df['idField'],'value':_0xec7bcf[_0x4147df['Variable'][_0xb9b9('0x13')]['toLowerCase']()][_0xb9b9('0x42')]()});}});}return _0x29c60f;}exports[_0xb9b9('0x4a')]=function(_0x204a4e,_0x2bf6f9,_0x512aa2,_0x23248b,_0x4651b9,_0x3ba768){var _0x44ce7c,_0x2af5bf;_0x3ba768[_0xb9b9('0xf')]=intUtil[_0xb9b9('0x4b')](_0x3ba768[_0xb9b9('0xf')]);_0x3ba768[_0xb9b9('0x4c')]=intUtil[_0xb9b9('0x4b')](_0x3ba768[_0xb9b9('0x4c')]);if(_0x4651b9&&_0x4651b9[_0xb9b9('0x4d')]){logger['info'](_0xb9b9('0x4e'),'Recording\x20is\x20enabled!');_0x2bf6f9[_0xb9b9('0x4f')]=util[_0xb9b9('0xe')](_0xb9b9('0x50'),_0x3ba768[_0xb9b9('0x4c')],_0x2bf6f9['uniqueid'],md5(_0x2bf6f9[_0xb9b9('0x51')]));}else{_0x2bf6f9['recordingURL']='';}headers[_0xb9b9('0x52')]=getAuth(_0x3ba768);return getUser(_0x3ba768,_0x23248b[_0xb9b9('0x53')])[_0xb9b9('0x16')](function(_0x1b68fb){_0x44ce7c=_0x1b68fb;logger[_0xb9b9('0xc')](_0xb9b9('0x54'),_0x44ce7c['id']);return getEndUser(_0x3ba768,_0x2bf6f9[_0xb9b9('0x55')],_0x2bf6f9[_0xb9b9('0x56')]);})[_0xb9b9('0x16')](function(_0x42a6d6){_0x2af5bf=_0x42a6d6;logger[_0xb9b9('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2af5bf['id']);return getTicket(_0x3ba768,_0x44ce7c,_0x2af5bf,_0x512aa2,_0x2bf6f9);})['then'](function(_0x4da7d8){if(_0x4da7d8){logger[_0xb9b9('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4da7d8['id']);switch(_0x3ba768[_0xb9b9('0x3c')]){case _0xb9b9('0x57'):logger[_0xb9b9('0xc')](_0xb9b9('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb9b9('0xe')](_0xb9b9('0x58'),_0x3ba768['remoteUri'],_0x44ce7c['id'],_0x4da7d8['id']),'method':_0xb9b9('0x10')});case _0xb9b9('0x59'):logger['info']('[QUEUE]',_0xb9b9('0x5a'));emit(util[_0xb9b9('0xe')](_0xb9b9('0x5b'),_0x23248b['name']),_0xb9b9('0x5c'),{'uri':util[_0xb9b9('0xe')]('%s/agent/tickets/%s',_0x3ba768[_0xb9b9('0xf')],_0x4da7d8['id'])});break;default:logger[_0xb9b9('0x5d')](_0xb9b9('0x4e'),_0xb9b9('0x5e'));}}})['catch'](function(_0x2a49d8){logger[_0xb9b9('0x5d')](_0xb9b9('0x5f'),util['inspect'](_0x2a49d8,{'showHidden':!![],'depth':null}));});};exports[_0xb9b9('0x60')]=function(_0x2e6db1,_0x446783,_0x46eec3,_0x1e88f1,_0x49956d,_0x5b6016,_0x37b2bf){var _0x26fb86,_0x3dbb31;_0x5b6016[_0xb9b9('0xf')]=intUtil[_0xb9b9('0x4b')](_0x5b6016['remoteUri']);_0x5b6016[_0xb9b9('0x4c')]=intUtil[_0xb9b9('0x4b')](_0x5b6016[_0xb9b9('0x4c')]);if(_0x37b2bf&&_0x37b2bf[_0xb9b9('0x61')]&&_0x37b2bf[_0xb9b9('0x61')]!=='none'){logger[_0xb9b9('0xc')](_0xb9b9('0x62'),_0xb9b9('0x63'));_0x446783[_0xb9b9('0x4f')]=util['format'](_0xb9b9('0x50'),_0x5b6016['serverUrl'],_0x446783[_0xb9b9('0x51')],md5(_0x446783[_0xb9b9('0x51')]));}headers[_0xb9b9('0x52')]=getAuth(_0x5b6016);return getUser(_0x5b6016,_0x1e88f1[_0xb9b9('0x53')])[_0xb9b9('0x16')](function(_0xc3d21){_0x26fb86=_0xc3d21;logger[_0xb9b9('0xc')](_0xb9b9('0x54'),_0x26fb86['id']);return getEndUser(_0x5b6016,_0x446783[_0xb9b9('0x64')],_0x446783[_0xb9b9('0x65')]);})['then'](function(_0xac7b51){_0x3dbb31=_0xac7b51;logger[_0xb9b9('0xc')](_0xb9b9('0x66'),_0x3dbb31['id']);return getTicket(_0x5b6016,_0x26fb86,_0x3dbb31,_0x46eec3,_0x446783);})['then'](function(_0x446a17){if(_0x446a17){logger[_0xb9b9('0xc')](_0xb9b9('0x67'),_0x446a17['id']);switch(_0x5b6016[_0xb9b9('0x3c')]){case _0xb9b9('0x57'):logger[_0xb9b9('0xc')]('[OUTBOUND]',_0xb9b9('0x68'));return request({'uri':util[_0xb9b9('0xe')](_0xb9b9('0x58'),_0x5b6016[_0xb9b9('0xf')],_0x26fb86['id'],_0x446a17['id']),'method':_0xb9b9('0x10')});case _0xb9b9('0x59'):logger[_0xb9b9('0xc')](_0xb9b9('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb9b9('0xe')](_0xb9b9('0x5b'),_0x1e88f1[_0xb9b9('0x13')]),'trigger:browser:url',{'uri':util[_0xb9b9('0xe')](_0xb9b9('0x69'),_0x5b6016['remoteUri'],_0x446a17['id'])});break;default:logger[_0xb9b9('0x5d')](_0xb9b9('0x62'),_0xb9b9('0x5e'));}}})[_0xb9b9('0x6a')](function(_0x3e9eb2){logger[_0xb9b9('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb9b9('0x6b')](_0x3e9eb2,{'showHidden':!![],'depth':null}));});};exports[_0xb9b9('0x6c')]=function(_0xff2dc0,_0x21ed42,_0x2bd379,_0x528322,_0x4a7536,_0x393206){var _0x34b138,_0x171ebc;_0x393206['remoteUri']=intUtil[_0xb9b9('0x4b')](_0x393206['remoteUri']);_0x393206[_0xb9b9('0x4c')]=intUtil[_0xb9b9('0x4b')](_0x393206[_0xb9b9('0x4c')]);if(_0x4a7536&&_0x4a7536[_0xb9b9('0x4d')]){logger[_0xb9b9('0xc')]('['+_0x21ed42[_0xb9b9('0x6d')][_0xb9b9('0x6e')]()+']','Recording\x20is\x20enabled!');_0x21ed42['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x393206['serverUrl'],_0x21ed42[_0xb9b9('0x51')],md5(_0x21ed42[_0xb9b9('0x51')]));}else{_0x21ed42[_0xb9b9('0x4f')]='';}headers[_0xb9b9('0x52')]=getAuth(_0x393206);return getUser(_0x393206)[_0xb9b9('0x16')](function(_0x529b44){_0x34b138=_0x529b44;logger[_0xb9b9('0xc')]('The\x20User\x20ID\x20is:',_0x34b138['id']);return getEndUser(_0x393206,_0x21ed42[_0xb9b9('0x55')],_0x21ed42[_0xb9b9('0x56')]);})[_0xb9b9('0x16')](function(_0xb54f42){_0x171ebc=_0xb54f42;logger['info']('The\x20Enduser\x20ID\x20is:',_0x171ebc['id']);return getTicket(_0x393206,_0x34b138,_0x171ebc,_0x2bd379,_0x21ed42);})[_0xb9b9('0x16')](function(_0x7aeebf){if(_0x7aeebf){logger[_0xb9b9('0xc')](_0xb9b9('0x67'),_0x7aeebf['id']);}})[_0xb9b9('0x6a')](function(_0x4d7eac){logger['error']('['+_0x21ed42[_0xb9b9('0x6d')][_0xb9b9('0x6e')]()+']'+_0xb9b9('0x6f'),util[_0xb9b9('0x6b')](_0x4d7eac,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2504=['inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','recordingURL','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','[HTTP]','stringify','GET','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x2504,0xee));var _0x4250=function(_0x328a57,_0x41c8fe){_0x328a57=_0x328a57-0x0;var _0x4eaebf=_0x2504[_0x328a57];return _0x4eaebf;};'use strict';var _=require(_0x4250('0x0'));var rp=require(_0x4250('0x1'));var md5=require(_0x4250('0x2'));var util=require(_0x4250('0x3'));var Redis=require(_0x4250('0x4'));var intUtil=require(_0x4250('0x5'));var config=require(_0x4250('0x6'));var logger=require(_0x4250('0x7'))(_0x4250('0x8'));config[_0x4250('0x9')]=_[_0x4250('0xa')](config[_0x4250('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4250('0xb'))(new Redis(config['redis']));function emit(_0x5a5286,_0x370998,_0x477312){io['to'](_0x5a5286)[_0x4250('0xc')](_0x370998,_0x477312);}var headers={'Content-Type':_0x4250('0xd'),'Accept':_0x4250('0xd')};function getTicket(_0x51ea6f,_0x1016b9,_0x49bf26,_0x2de8a7,_0x2ff5ca){logger['info'](_0x4250('0xe'));return request({'uri':util['format']('%s/tickets.json',_0x51ea6f[_0x4250('0xf')]),'method':_0x4250('0x10'),'body':{'ticket':_[_0x4250('0x11')]({'requester_id':_0x49bf26['id'],'submitter_id':_0x1016b9?_0x1016b9['id']:undefined,'assignee_id':_0x1016b9?_0x1016b9['id']:undefined,'tags':getTags(_0x2de8a7[_0x4250('0x12')],_0x4250('0x13')),'subject':intUtil['getString'](_0x2de8a7[_0x4250('0x14')],_0x2ff5ca,'\x20'),'description':intUtil[_0x4250('0x15')](_0x2de8a7[_0x4250('0x16')],_0x2ff5ca,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4250('0x15')](_0x2de8a7[_0x4250('0x16')],_0x2ff5ca,'\x0a')}},getCustomFields(_0x2de8a7[_0x4250('0x17')],_0x2ff5ca))}})['then'](function(_0x9aa450){logger[_0x4250('0x18')](_0x4250('0x19'));return _0x9aa450[_0x4250('0x1a')];});}function getUser(_0x2979cd,_0x9907b4){if(intUtil[_0x4250('0x1b')](_0x9907b4)){logger['info'](_0x4250('0x1c'),_0x9907b4);return request({'uri':util[_0x4250('0x1d')](_0x4250('0x1e'),_0x2979cd[_0x4250('0xf')]),'qs':{'query':util[_0x4250('0x1d')](_0x4250('0x1f'),_0x9907b4)}})[_0x4250('0x20')](function(_0x508bc3){if(_0x508bc3[_0x4250('0x21')]){logger['info']('Agent\x20found!');return _[_0x4250('0x22')](_0x508bc3[_0x4250('0x23')],{'email':_0x9907b4,'role':_0x4250('0x24')});}else{logger[_0x4250('0x18')](_0x4250('0x25'));return request({'uri':util[_0x4250('0x1d')](_0x4250('0x26'),_0x2979cd[_0x4250('0xf')])})[_0x4250('0x20')](function(_0x3818c0){logger[_0x4250('0x18')](_0x4250('0x27'));return _0x3818c0['user'];});}});}else{logger[_0x4250('0x18')](_0x4250('0x25'));return request({'uri':util[_0x4250('0x1d')]('%s/users/me.json',_0x2979cd['remoteUri'])})[_0x4250('0x20')](function(_0x91c0d6){logger[_0x4250('0x18')](_0x4250('0x27'));return _0x91c0d6[_0x4250('0x28')];});}}function getEndUser(_0x5cb4fe,_0x431d01,_0x24169c){logger[_0x4250('0x18')]('Searching\x20enduser\x20with\x20phone',_0x24169c);return request({'uri':util['format'](_0x4250('0x1e'),_0x5cb4fe['remoteUri']),'qs':{'query':util[_0x4250('0x1d')](_0x4250('0x29'),_0x24169c)}})[_0x4250('0x20')](function(_0x2cdfdf){var _0xb82299;if(_0x2cdfdf['results'][_0x4250('0x2a')]){_0x2cdfdf[_0x4250('0x23')]=_['filter'](_0x2cdfdf[_0x4250('0x23')],{'suspended':![],'role':'end-user'});if(_0x2cdfdf[_0x4250('0x23')]['length']){_0xb82299=_['first'](_0x2cdfdf[_0x4250('0x23')]);}}if(_0xb82299){logger['info'](_0x4250('0x2b'));return _0xb82299;}else{logger[_0x4250('0x18')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4250('0x1d')](_0x4250('0x2c'),_0x5cb4fe['remoteUri']),'method':_0x4250('0x10'),'body':{'user':{'role':_0x4250('0x2d'),'name':util['format'](_0x4250('0x2e'),_0x431d01||_0x24169c),'phone':_0x24169c}}})[_0x4250('0x20')](function(_0x11ea78){logger[_0x4250('0x18')](_0x4250('0x2f'));return _0x11ea78[_0x4250('0x28')];});}});}function getAuth(_0x2b68bb){var _0x99ac9e;if(_0x2b68bb[_0x4250('0x30')]===_0x4250('0x31')){_0x99ac9e=util[_0x4250('0x1d')](_0x4250('0x32'),_0x2b68bb[_0x4250('0x33')],_0x2b68bb['password']);}else if(_0x2b68bb[_0x4250('0x30')]==='token'){_0x99ac9e=util[_0x4250('0x1d')](_0x4250('0x34'),_0x2b68bb['username'],_0x2b68bb[_0x4250('0x35')]);}return util[_0x4250('0x1d')](_0x4250('0x36'),new Buffer(_0x99ac9e)[_0x4250('0x37')]('base64'));}function request(_0x4c08c7){logger['debug'](_0x4250('0x38'),JSON[_0x4250('0x39')](_0x4c08c7));return rp(_['defaults'](_0x4c08c7,{'method':_0x4250('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x1f40bd,_0x3f2ef7){var _0x13d997=[];if(_0x1f40bd&&_0x1f40bd[_0x4250('0x2a')]>0x0){_0x13d997=_['map'](_0x1f40bd,_0x3f2ef7);}return _0x13d997;}function getCustomFields(_0x16f3f3,_0x4798bf){var _0x50b446=[];var _0xb15c48={'custom_fields':[]};if(_0x16f3f3['length']>0x0){_[_0x4250('0x3b')](_0x16f3f3,function(_0x285e7c){if(_0x285e7c[_0x4250('0x3c')]==='string'&&_0x285e7c[_0x4250('0x3d')]&&!_0x285e7c[_0x4250('0x3e')]){_0xb15c48[_0x285e7c[_0x4250('0x3d')][_0x4250('0x3f')]()]=_0x285e7c[_0x4250('0x40')]['toString']();}else if(_0x285e7c[_0x4250('0x3c')]===_0x4250('0x41')&&_0x285e7c[_0x4250('0x42')]&&_0x285e7c[_0x4250('0x3e')]){_0xb15c48[_0x4250('0x43')][_0x4250('0x44')]({'id':_0x285e7c['idField'],'value':_0x285e7c[_0x4250('0x40')]['toString']()});}else if(_0x285e7c[_0x4250('0x3c')]===_0x4250('0x45')&&_0x285e7c[_0x4250('0x46')]&&_0x285e7c[_0x4250('0x42')]&&_0x285e7c[_0x4250('0x3e')]){_0x4798bf[_0x285e7c[_0x4250('0x46')]]&&_0xb15c48['custom_fields']['push']({'id':_0x285e7c['idField'],'value':_0x4798bf[_0x285e7c[_0x4250('0x46')]][_0x4250('0x37')]()});}else if(_0x285e7c[_0x4250('0x3c')]==='customVariable'&&_0x285e7c[_0x4250('0x47')]&&_0x285e7c[_0x4250('0x47')][_0x4250('0x13')]&&_0x285e7c['idField']&&_0x285e7c[_0x4250('0x3e')]){_0x4798bf[_0x285e7c[_0x4250('0x47')][_0x4250('0x13')][_0x4250('0x3f')]()]&&_0xb15c48['custom_fields']['push']({'id':_0x285e7c[_0x4250('0x42')],'value':_0x4798bf[_0x285e7c[_0x4250('0x47')][_0x4250('0x13')][_0x4250('0x3f')]()][_0x4250('0x37')]()});}});}return _0xb15c48;}exports['queue']=function(_0x207a53,_0x5a0002,_0x234e02,_0x415f6b,_0x5fffa5,_0x527381){var _0x27637b,_0x173efa;_0x527381[_0x4250('0xf')]=intUtil['stripTrailingSlash'](_0x527381['remoteUri']);_0x527381['serverUrl']=intUtil[_0x4250('0x48')](_0x527381[_0x4250('0x49')]);if(_0x5fffa5&&_0x5fffa5[_0x4250('0x4a')]){logger[_0x4250('0x18')](_0x4250('0x4b'),_0x4250('0x4c'));_0x5a0002['recordingURL']=util[_0x4250('0x1d')](_0x4250('0x4d'),_0x527381[_0x4250('0x49')],_0x5a0002['uniqueid'],md5(_0x5a0002[_0x4250('0x4e')]));}else{_0x5a0002['recordingURL']='';}headers['Authorization']=getAuth(_0x527381);return getUser(_0x527381,_0x415f6b[_0x4250('0x4f')])[_0x4250('0x20')](function(_0xe02e0f){_0x27637b=_0xe02e0f;logger[_0x4250('0x18')](_0x4250('0x50'),_0x27637b['id']);return getEndUser(_0x527381,_0x5a0002[_0x4250('0x51')],_0x5a0002['calleridnum']);})[_0x4250('0x20')](function(_0x566664){_0x173efa=_0x566664;logger[_0x4250('0x18')](_0x4250('0x52'),_0x173efa['id']);return getTicket(_0x527381,_0x27637b,_0x173efa,_0x234e02,_0x5a0002);})[_0x4250('0x20')](function(_0x544048){if(_0x544048){logger[_0x4250('0x18')](_0x4250('0x53'),_0x544048['id']);switch(_0x527381['type']){case'integrationTab':logger['info'](_0x4250('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x4250('0x54'),_0x527381[_0x4250('0xf')],_0x27637b['id'],_0x544048['id']),'method':_0x4250('0x10')});case _0x4250('0x55'):logger[_0x4250('0x18')]('[QUEUE]',_0x4250('0x56'));emit(util[_0x4250('0x1d')](_0x4250('0x57'),_0x415f6b[_0x4250('0x13')]),'trigger:browser:url',{'uri':util[_0x4250('0x1d')](_0x4250('0x58'),_0x527381['remoteUri'],_0x544048['id'])});break;default:logger[_0x4250('0x59')](_0x4250('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4250('0x5a')](function(_0x1076ea){logger[_0x4250('0x59')](_0x4250('0x5b'),util[_0x4250('0x5c')](_0x1076ea,{'showHidden':!![],'depth':null}));});};exports[_0x4250('0x5d')]=function(_0x2b7789,_0x4e64d4,_0x2ea3d0,_0x39e9f5,_0x6094fb,_0x513cd6,_0x53f944){var _0x27fe0f,_0x4199a4;_0x513cd6['remoteUri']=intUtil[_0x4250('0x48')](_0x513cd6[_0x4250('0xf')]);_0x513cd6[_0x4250('0x49')]=intUtil['stripTrailingSlash'](_0x513cd6[_0x4250('0x49')]);if(_0x53f944&&_0x53f944[_0x4250('0x5e')]&&_0x53f944['recordingFormat']!==_0x4250('0x5f')){logger[_0x4250('0x18')](_0x4250('0x60'),'Recording\x20is\x20enabled!');_0x4e64d4['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513cd6[_0x4250('0x49')],_0x4e64d4['uniqueid'],md5(_0x4e64d4[_0x4250('0x4e')]));}headers[_0x4250('0x61')]=getAuth(_0x513cd6);return getUser(_0x513cd6,_0x39e9f5[_0x4250('0x4f')])['then'](function(_0x4bad4e){_0x27fe0f=_0x4bad4e;logger[_0x4250('0x18')](_0x4250('0x50'),_0x27fe0f['id']);return getEndUser(_0x513cd6,_0x4e64d4[_0x4250('0x62')],_0x4e64d4['destcalleridnum']);})[_0x4250('0x20')](function(_0x273657){_0x4199a4=_0x273657;logger[_0x4250('0x18')](_0x4250('0x52'),_0x4199a4['id']);return getTicket(_0x513cd6,_0x27fe0f,_0x4199a4,_0x2ea3d0,_0x4e64d4);})['then'](function(_0x1efa10){if(_0x1efa10){logger['info'](_0x4250('0x53'),_0x1efa10['id']);switch(_0x513cd6[_0x4250('0x3c')]){case _0x4250('0x63'):logger['info'](_0x4250('0x60'),_0x4250('0x64'));return request({'uri':util[_0x4250('0x1d')](_0x4250('0x54'),_0x513cd6[_0x4250('0xf')],_0x27fe0f['id'],_0x1efa10['id']),'method':_0x4250('0x10')});case _0x4250('0x55'):logger[_0x4250('0x18')](_0x4250('0x60'),_0x4250('0x56'));emit(util[_0x4250('0x1d')](_0x4250('0x57'),_0x39e9f5['name']),_0x4250('0x65'),{'uri':util[_0x4250('0x1d')](_0x4250('0x58'),_0x513cd6[_0x4250('0xf')],_0x1efa10['id'])});break;default:logger[_0x4250('0x59')]('[OUTBOUND]',_0x4250('0x66'));}}})['catch'](function(_0x11fa9e){logger[_0x4250('0x59')](_0x4250('0x67'),util[_0x4250('0x5c')](_0x11fa9e,{'showHidden':!![],'depth':null}));});};exports[_0x4250('0x68')]=function(_0x4c1691,_0x39212f,_0x3163aa,_0x2979fc,_0x4309c5,_0x392912){var _0x242c99,_0x4db788;_0x392912[_0x4250('0xf')]=intUtil[_0x4250('0x48')](_0x392912[_0x4250('0xf')]);_0x392912[_0x4250('0x49')]=intUtil['stripTrailingSlash'](_0x392912[_0x4250('0x49')]);if(_0x4309c5&&_0x4309c5[_0x4250('0x4a')]){logger[_0x4250('0x18')]('['+_0x39212f['lastevent'][_0x4250('0x69')]()+']',_0x4250('0x4c'));_0x39212f[_0x4250('0x6a')]=util[_0x4250('0x1d')](_0x4250('0x4d'),_0x392912[_0x4250('0x49')],_0x39212f['uniqueid'],md5(_0x39212f[_0x4250('0x4e')]));}else{_0x39212f[_0x4250('0x6a')]='';}headers[_0x4250('0x61')]=getAuth(_0x392912);return getUser(_0x392912)['then'](function(_0x53b5ab){_0x242c99=_0x53b5ab;logger['info']('The\x20User\x20ID\x20is:',_0x242c99['id']);return getEndUser(_0x392912,_0x39212f['calleridname'],_0x39212f[_0x4250('0x6b')]);})[_0x4250('0x20')](function(_0x2ccef2){_0x4db788=_0x2ccef2;logger[_0x4250('0x18')]('The\x20Enduser\x20ID\x20is:',_0x4db788['id']);return getTicket(_0x392912,_0x242c99,_0x4db788,_0x3163aa,_0x39212f);})['then'](function(_0x3d69ef){if(_0x3d69ef){logger[_0x4250('0x18')](_0x4250('0x53'),_0x3d69ef['id']);}})[_0x4250('0x5a')](function(_0x5c4c81){logger['error']('['+_0x39212f[_0x4250('0x6c')][_0x4250('0x69')]()+']'+_0x4250('0x6d'),util['inspect'](_0x5c4c81,{'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 a6e551a..e7b45b3 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 _0x4965=['/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','Called','Call_Result','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id=','calleridname','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x4965,0x16e));var _0x5496=function(_0x499227,_0x3a8c2c){_0x499227=_0x499227-0x0;var _0xec1c0a=_0x4965[_0x499227];return _0xec1c0a;};'use strict';var _=require(_0x5496('0x0'));var rp=require(_0x5496('0x1'));var md5=require(_0x5496('0x2'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x5496('0x3'));var BPromise=require('bluebird');var config=require(_0x5496('0x4'));var logger=require(_0x5496('0x5'))(_0x5496('0x6'));config['redis']=_[_0x5496('0x7')](config[_0x5496('0x8')],{'host':_0x5496('0x9'),'port':0x18eb});var io=require(_0x5496('0xa'))(new Redis(config['redis']));function emit(_0x3086c8,_0x4d0e7a,_0xfe89fe){io['to'](_0x3086c8)[_0x5496('0xb')](_0x4d0e7a,_0xfe89fe);}function request(_0x3c100f){logger['debug'](_0x5496('0xc'),JSON[_0x5496('0xd')](_0x3c100f));return rp(_0x3c100f);}function getCustomFields(_0x42f073,_0x13f202){var _0x3b1818={};if(_0x42f073[_0x5496('0xe')]>0x0){_[_0x5496('0xf')](_0x42f073,function(_0x22b366){if(_0x22b366[_0x5496('0x10')]===_0x5496('0x11')&&_0x22b366[_0x5496('0x12')]){_0x3b1818[_0x22b366[_0x5496('0x12')]]=_0x22b366[_0x5496('0x13')][_0x5496('0x14')]();}else if(_0x22b366[_0x5496('0x10')]==='variable'&&_0x22b366[_0x5496('0x15')]&&_0x22b366[_0x5496('0x12')]&&_0x13f202[_0x22b366[_0x5496('0x15')]]){_0x3b1818[_0x22b366[_0x5496('0x12')]]=_0x13f202[_0x22b366[_0x5496('0x15')]][_0x5496('0x14')]();}else if(_0x22b366[_0x5496('0x10')]===_0x5496('0x16')&&_0x22b366['Variable']&&_0x22b366['Variable'][_0x5496('0x17')]&&_0x22b366[_0x5496('0x12')]&&_0x13f202[_0x22b366[_0x5496('0x18')][_0x5496('0x17')][_0x5496('0x19')]()]){_0x3b1818[_0x22b366[_0x5496('0x12')]]=_0x13f202[_0x22b366[_0x5496('0x18')][_0x5496('0x17')][_0x5496('0x19')]()]['toString']();}});}return _0x3b1818;}function getName(_0x49ad94){if(_0x49ad94[_0x5496('0x1a')]('\x20')>0x0){var _0x1258f8=_0x49ad94[_0x5496('0x1b')](/ (.+)/);if(_0x1258f8[0x1]){return _0x1258f8;}}return[_0x49ad94,_0x49ad94];}var accountsTokens={};function getAccessToken(_0x2cd842){return new Promise(function(_0x4d2a9d,_0x701eca){if(!_[_0x5496('0x1c')](accountsTokens[_0x2cd842['id']])&&!_['isNil'](accountsTokens[_0x2cd842['id']][_0x5496('0x1d')])){if(moment()[_0x5496('0x1e')](accountsTokens[_0x2cd842['id']][_0x5496('0x1f')])){_0x4d2a9d(accountsTokens[_0x2cd842['id']][_0x5496('0x1d')]);}}var _0x23bd12;switch(_0x2cd842[_0x5496('0x20')]){case'US':_0x23bd12=_0x5496('0x21');break;case'AU':_0x23bd12=_0x5496('0x22');break;case'EU':_0x23bd12=_0x5496('0x23');break;case'IN':_0x23bd12=_0x5496('0x24');break;case'CN':_0x23bd12=_0x5496('0x25');break;default:_0x23bd12=_0x5496('0x23');break;}var _0x385134={'method':'POST','uri':_0x23bd12+_0x5496('0x26'),'qs':{'refresh_token':_0x2cd842['refreshToken'],'client_id':_0x2cd842['clientId'],'client_secret':_0x2cd842['clientSecret'],'grant_type':_0x5496('0x27')},'json':!![]};return rp(_0x385134)[_0x5496('0x28')](function(_0x4067de){accountsTokens[_0x2cd842['id']]={'access_token':_0x4067de[_0x5496('0x1d')],'expires_in':moment()[_0x5496('0x29')](_0x4067de[_0x5496('0x1f')],_0x5496('0x2a'))};_0x4d2a9d(_0x4067de[_0x5496('0x1d')]);})[_0x5496('0x2b')](function(_0x2c7a37){logger['error'](_0x5496('0x2c'),_0x2c7a37[_0x5496('0x2d')]);_0x701eca(_0x2c7a37);});});}function getUser(_0x519bd7,_0x802f78,_0x1ff1a0,_0x119a56){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0x5496('0x2e'),_0x802f78),'qs':{'type':_0x5496('0x2f')},'headers':{'Authorization':_0x5496('0x30')+_0x519bd7},'json':!![]})[_0x5496('0x28')](function(_0x87702b){if(_0x87702b[_0x5496('0x31')]){var _0x59811c=-0x1;if(_[_0x5496('0x32')](_0x87702b[_0x5496('0x31')])){if(!_['isNil'](_0x119a56)){_0x59811c=_[_0x5496('0x33')](_0x87702b[_0x5496('0x31')],function(_0xf1b3cf){return _0xf1b3cf[_0x5496('0x34')]===_0x119a56;});}if(_0x59811c>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x5496('0x35')](_0x5496('0x36'));_0x59811c=_[_0x5496('0x33')](_0x87702b[_0x5496('0x31')],function(_0x21e431){return _0x21e431[_0x5496('0x37')][_0x5496('0x17')]==='Administrator';});}return _0x87702b['users'][_0x59811c];}else{if(_0x87702b[_0x5496('0x38')]['profile'][_0x5496('0x17')]===_0x5496('0x39')){logger[_0x5496('0x35')](_0x5496('0x36'));user=_0x87702b[_0x5496('0x38')];return user;}else{logger['error'](_0x5496('0x3a'),JSON['stringify'](_0x87702b));throw new Error(_0x5496('0x3b')+JSON[_0x5496('0xd')](_0x87702b));}}}else{logger['error'](_0x5496('0x3a'),JSON[_0x5496('0xd')](_0x87702b));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5496('0xd')](_0x87702b));}})[_0x5496('0x2b')](function(_0xd0ed63){console[_0x5496('0x3c')](_0xd0ed63);});}function getZohoUser(_0x539fc0,_0x505d9b){return new BPromise(function(_0x48bfbe,_0x410a0e){request(_0x539fc0)['then'](function(_0x5a0d30){var _0x121279=null;if(_0x5a0d30){_0x121279=_0x5a0d30[_0x5496('0x3d')][0x0];_0x121279['enduserType']=_0x505d9b;}_0x48bfbe(_0x121279);})[_0x5496('0x2b')](function(_0x2426b8){_0x410a0e(_0x2426b8);});});}function createEndUser(_0x54e727,_0x3d3eb8,_0x20a1a4,_0x46332e,_0x3d86c6,_0x1af21b){var _0x20a1a4=getName(_0x20a1a4);return request({'method':'POST','uri':_0x5496('0x3e')+_0x3d3eb8+_0x5496('0x3f')+_['startCase'](_0x1af21b[_0x5496('0x40')])+'s','body':{'data':[{'Last_Name':_0x20a1a4[0x1],'First_Name':_0x20a1a4[0x0],'Phone':_0x46332e,'Owner':{'name':!_[_0x5496('0x1c')](_0x3d86c6['role'][_0x5496('0x17')])?_0x3d86c6[_0x5496('0x41')][_0x5496('0x17')]:!_[_0x5496('0x1c')](_0x3d86c6[_0x5496('0x42')])?_0x3d86c6[_0x5496('0x42')]+'\x20'+_0x3d86c6[_0x5496('0x43')]:_0x3d86c6['last_name'],'id':_0x3d86c6['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x54e727},'json':!![]})[_0x5496('0x28')](function(_0x4314b1){if(_0x4314b1&&_0x4314b1[_0x5496('0x3d')][0x0][_0x5496('0x44')]===_0x5496('0x45')){var _0x1578fb=_0x4314b1[_0x5496('0x3d')][0x0][_0x5496('0x46')];_0x1578fb[_0x5496('0x47')]=_[_0x5496('0x48')](_0x1af21b[_0x5496('0x40')])+'s';return _0x1578fb;}logger['error'](_0x5496('0x3a'),JSON[_0x5496('0xd')](data));throw new Error(_0x5496('0x49')+JSON[_0x5496('0xd')](data));})[_0x5496('0x2b')](function(_0x1e83ea){console[_0x5496('0x4a')]('CREATE\x20ERROR',_0x1e83ea);});}function getEndUser(_0x5c7f03,_0x101aff,_0x13a04c,_0x44ab7c,_0x3b9e02,_0x47a5ed,_0x3d6bff){var _0x2e82e0={'method':_0x5496('0x4b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5c7f03},'json':!![]};switch(_0x3d6bff[_0x5496('0x4c')]){case _0x5496('0x4d'):_0x2e82e0[_0x5496('0x4e')]=_0x5496('0x3e')+_0x101aff+_0x5496('0x4f')+_0x3b9e02+'))';return getZohoUser(_0x2e82e0,_0x5496('0x50'))[_0x5496('0x28')](function(_0x2f2648){if(_0x2f2648)return _0x2f2648;_0x2e82e0[_0x5496('0x4e')]=_0x5496('0x3e')+_0x101aff+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3b9e02+'))';return getZohoUser(_0x2e82e0,_0x5496('0x51'))[_0x5496('0x28')](function(_0xf5011a){if(_0xf5011a)return _0xf5011a;if(_0x3d6bff[_0x5496('0x40')]!=_0x5496('0x52')){return createEndUser(_0x5c7f03,_0x101aff,_0x44ab7c,_0x3b9e02,_0x47a5ed,_0x3d6bff);}else{return{};}});});break;case _0x5496('0x53'):_0x2e82e0[_0x5496('0x4e')]=_0x5496('0x3e')+_0x101aff+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3b9e02+'))';return getZohoUser(_0x2e82e0,'Contacts')[_0x5496('0x28')](function(_0x22a79f){if(_0x22a79f)return _0x22a79f;if(_0x3d6bff[_0x5496('0x40')]!=_0x5496('0x52')){return createEndUser(_0x5c7f03,_0x101aff,_0x44ab7c,_0x3b9e02,_0x47a5ed,_0x3d6bff);}else{return{};}});break;case'lead':_0x2e82e0[_0x5496('0x4e')]=_0x5496('0x3e')+_0x101aff+_0x5496('0x54')+_0x3b9e02+'))';return getZohoUser(_0x2e82e0,_0x5496('0x51'))[_0x5496('0x28')](function(_0xa3701c){if(_0xa3701c)return _0xa3701c;if(_0x3d6bff[_0x5496('0x40')]!=_0x5496('0x52')){return createEndUser(_0x5c7f03,_0x101aff,_0x44ab7c,_0x3b9e02,_0x47a5ed,_0x3d6bff);}else{return{};}});break;}}function getCall(_0x132674,_0x1b5e4a,_0x1ffbc5,_0x1445b3,_0x5df52b,_0x12e603,_0x383be3,_0x16486f){logger[_0x5496('0x35')](_0x5496('0x55'));var _0x43268c={};_0x43268c[_0x5496('0x56')]={'name':!_['isNil'](_0x1445b3[_0x5496('0x41')][_0x5496('0x17')])&&!_['isNil'](_0x1445b3[_0x5496('0x37')][_0x5496('0x17')])&&_0x1445b3[_0x5496('0x37')][_0x5496('0x17')]===_0x5496('0x57')?_0x1445b3[_0x5496('0x41')][_0x5496('0x17')]:!_[_0x5496('0x1c')](_0x1445b3[_0x5496('0x42')])?_0x1445b3[_0x5496('0x42')]+'\x20'+_0x1445b3[_0x5496('0x43')]:_0x1445b3[_0x5496('0x43')],'id':_0x1445b3['id']};_0x43268c[_0x5496('0x58')]=intUtil[_0x5496('0x59')](_0x12e603[_0x5496('0x5a')],_0x383be3,'\x20');_0x43268c['Description']=intUtil[_0x5496('0x59')](_0x12e603[_0x5496('0x5b')],_0x383be3,'\x0a');if(_0x5df52b[_0x5496('0x47')]===_0x5496('0x50')){_0x43268c['Who_Id']={'name':!_['isNil'](_0x5df52b[_0x5496('0x5c')])?_0x5df52b[_0x5496('0x5c')]:!_[_0x5496('0x1c')](_0x5df52b[_0x5496('0x5d')])?_0x5df52b[_0x5496('0x5d')]+'\x20'+_0x5df52b[_0x5496('0x5e')]:_0x5df52b[_0x5496('0x5e')],'id':_0x5df52b['id']};}if(_0x5df52b['enduserType']===_0x5496('0x51')){_0x43268c[_0x5496('0x5f')]={'name':!_[_0x5496('0x1c')](_0x5df52b[_0x5496('0x5c')])?_0x5df52b[_0x5496('0x5c')]:!_[_0x5496('0x1c')](_0x5df52b[_0x5496('0x5d')])?_0x5df52b[_0x5496('0x5d')]+'\x20'+_0x5df52b[_0x5496('0x5e')]:_0x5df52b[_0x5496('0x5e')],'id':_0x5df52b['id']};_0x43268c['$se_module']=_[_0x5496('0x48')](_0x5df52b[_0x5496('0x47')]);}if(_0x383be3[_0x5496('0x60')]){_0x43268c[_0x5496('0x61')]=moment[_0x5496('0x62')](parseInt(_0x383be3[_0x5496('0x60')])*0x3e8)['format'](_0x5496('0x63'));}else if(_0x383be3[_0x5496('0x64')]&&_0x383be3[_0x5496('0x65')]){_0x43268c['Call_Duration']=moment['utc'](moment(_0x383be3['endtime'],_0x5496('0x66'))[_0x5496('0x67')](moment(_0x383be3[_0x5496('0x68')],_0x5496('0x66'))))[_0x5496('0x69')](_0x5496('0x63'));}switch(_0x383be3[_0x5496('0x6a')]){case _0x5496('0x6b'):_0x43268c['Call_Result']=_0x5496('0x6c');break;case'complete':case'connect':_0x43268c[_0x5496('0x6d')]=_0x5496('0x6e');break;case _0x5496('0x6f'):_0x43268c[_0x5496('0x6d')]=_0x5496('0x70');break;case'abandoned':_0x43268c[_0x5496('0x6d')]=_0x5496('0x71');break;case'timeout':_0x43268c[_0x5496('0x6d')]=_0x5496('0x72');default:}_0x43268c[_0x5496('0x73')]=(_0x16486f===_0x5496('0x74')?moment(_0x383be3[_0x5496('0x68')])[_0x5496('0x69')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x383be3['agentcalledAt'])[_0x5496('0x69')](_0x5496('0x66')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x43268c[_0x5496('0x75')]=_0x16486f||_0x5496('0x76');_0x43268c=_[_0x5496('0x77')](_0x43268c,getCustomFields(_0x12e603[_0x5496('0x78')],_0x383be3));return request({'method':_0x5496('0x79'),'uri':'https://www.zohoapis.'+_0x1b5e4a+_0x5496('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x132674},'body':{'data':[_0x43268c]},'json':!![]})[_0x5496('0x28')](function(_0x56e4f9){if(_0x56e4f9&&_0x56e4f9[_0x5496('0x3d')][0x0][_0x5496('0x44')]===_0x5496('0x45')){logger[_0x5496('0x35')]('Call\x20created!');return{'id':_0x56e4f9[_0x5496('0x3d')][0x0][_0x5496('0x46')]['id']};}})[_0x5496('0x2b')](function(_0x30f477){logger[_0x5496('0x35')]('err',_0x30f477['stack']);console['log'](_0x5496('0x7b'),_0x30f477);});}exports[_0x5496('0x7c')]=function(_0x143b32,_0x45712e,_0x109071,_0x4d9b94,_0x35da96,_0x11c663){var _0x270ac4,_0x57c676,_0x5de3d0;_0x11c663[_0x5496('0x7d')]=intUtil[_0x5496('0x7e')](_0x11c663[_0x5496('0x7d')]);_0x11c663[_0x5496('0x7f')]=intUtil[_0x5496('0x7e')](_0x11c663[_0x5496('0x7f')]);if(_0x35da96&&_0x35da96['monitor_format']){logger[_0x5496('0x35')]('[QUEUE]',_0x5496('0x80'));_0x45712e[_0x5496('0x81')]=_0x11c663[_0x5496('0x7f')]+_0x5496('0x82')+_0x45712e[_0x5496('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x45712e[_0x5496('0x83')]);}else{_0x45712e[_0x5496('0x81')]='';}var _0x471478=_0x11c663[_0x5496('0x7d')]===_0x5496('0x84')?'eu':_0x5496('0x85');return getAccessToken(_0x11c663)['then'](function(_0xd5f310){_0x5de3d0=_0xd5f310;return getUser(_0x5de3d0,_0x471478,_0x11c663,_0x4d9b94['email']);})['then'](function(_0x4195bc){_0x270ac4=_0x4195bc;logger[_0x5496('0x35')](_0x5496('0x86'),_0x270ac4['id']);return getEndUser(_0x5de3d0,_0x471478,_0x11c663,_0x45712e['calleridname'],_0x45712e[_0x5496('0x87')],_0x270ac4,_0x109071);})[_0x5496('0x28')](function(_0x1451f8){_0x57c676=_0x1451f8;return getCall(_0x5de3d0,_0x471478,_0x11c663,_0x270ac4,_0x57c676,_0x109071,_0x45712e,_0x5496('0x76'));})[_0x5496('0x28')](function(_0xceae92){if(_0xceae92){logger[_0x5496('0x35')](_0x5496('0x88'),_0xceae92['id']);logger[_0x5496('0x35')](_0x5496('0x89'),_0x5496('0x8a'));emit(util['format']('user:%s',_0x4d9b94['name']),_0x5496('0x8b'),{'uri':_0x5496('0x8c')+_0x11c663[_0x5496('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0xceae92['id']});}})[_0x5496('0x2b')](function(_0x2b70c5){logger[_0x5496('0x3c')](_0x5496('0x89'),JSON[_0x5496('0xd')](_0x2b70c5));});};exports[_0x5496('0x74')]=function(_0x4e59d3,_0x2f99ab,_0x31ced2,_0x249f04,_0x26176b,_0x4dfcfe,_0x192751){var _0x367e83,_0x2ee1d4,_0x3fdb18;_0x4dfcfe[_0x5496('0x7d')]=intUtil[_0x5496('0x7e')](_0x4dfcfe[_0x5496('0x7d')]);_0x4dfcfe[_0x5496('0x7f')]=intUtil[_0x5496('0x7e')](_0x4dfcfe[_0x5496('0x7f')]);if(_0x192751&&_0x192751[_0x5496('0x8d')]&&_0x192751['recordingFormat']!=='none'){logger[_0x5496('0x35')](_0x5496('0x8e'),_0x5496('0x80'));_0x2f99ab[_0x5496('0x81')]=_0x4dfcfe[_0x5496('0x7f')]+_0x5496('0x82')+_0x2f99ab[_0x5496('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x2f99ab[_0x5496('0x83')]);}var _0x34796b=_0x4dfcfe[_0x5496('0x7d')]===_0x5496('0x84')?'eu':_0x5496('0x85');return getAccessToken(_0x4dfcfe)[_0x5496('0x28')](function(_0x14723c){_0x3fdb18=_0x14723c;return getUser(_0x3fdb18,_0x34796b,_0x4dfcfe,_0x249f04[_0x5496('0x34')]);})['then'](function(_0x264135){_0x367e83=_0x264135;logger['info'](_0x5496('0x86'),_0x367e83['id']);return getEndUser(_0x3fdb18,_0x34796b,_0x4dfcfe,_0x2f99ab[_0x5496('0x8f')],_0x2f99ab[_0x5496('0x90')],_0x367e83,_0x31ced2);})[_0x5496('0x28')](function(_0x5e7d34){_0x2ee1d4=_0x5e7d34;return getCall(_0x3fdb18,_0x34796b,_0x4dfcfe,_0x367e83,_0x2ee1d4,_0x31ced2,_0x2f99ab,_0x5496('0x91'));})[_0x5496('0x28')](function(_0x4cbd54){if(_0x4cbd54){logger[_0x5496('0x35')]('The\x20Call\x20ID\x20is:',_0x4cbd54['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5496('0x69')](_0x5496('0x92'),_0x249f04[_0x5496('0x17')]),'trigger:browser:url',{'uri':_0x5496('0x8c')+_0x4dfcfe[_0x5496('0x7d')]+_0x5496('0x93')+_0x4cbd54['id']});}})[_0x5496('0x2b')](function(_0x485cd0){logger[_0x5496('0x3c')](_0x5496('0x8e'),JSON[_0x5496('0xd')](_0x485cd0));});};exports['unmanaged']=function(_0x33cf9c,_0x3475df,_0x458772,_0xf9177a,_0x149a87,_0x4bb18d){var _0x3489d4,_0x2c7cb5,_0xdc4e74;_0x4bb18d[_0x5496('0x7d')]=intUtil[_0x5496('0x7e')](_0x4bb18d[_0x5496('0x7d')]);_0x4bb18d[_0x5496('0x7f')]=intUtil[_0x5496('0x7e')](_0x4bb18d[_0x5496('0x7f')]);if(_0x149a87&&_0x149a87['monitor_format']){logger['info']('['+_0x3475df[_0x5496('0x6a')]['toUpperCase']()+']',_0x5496('0x80'));_0x3475df[_0x5496('0x81')]=_0x4bb18d[_0x5496('0x7f')]+_0x5496('0x82')+_0x3475df[_0x5496('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x3475df['uniqueid']);}else{_0x3475df[_0x5496('0x81')]='';}var _0x1fbeca=_0x4bb18d[_0x5496('0x7d')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4bb18d)[_0x5496('0x28')](function(_0x5f4a83){_0xdc4e74=_0x5f4a83;return getUser(_0xdc4e74,_0x1fbeca,_0x4bb18d);})[_0x5496('0x28')](function(_0x38e42e){_0x3489d4=_0x38e42e;logger['info'](_0x5496('0x86'),_0x3489d4['id']);return getEndUser(_0xdc4e74,_0x1fbeca,_0x4bb18d,_0x3475df[_0x5496('0x94')],_0x3475df[_0x5496('0x87')],_0x3489d4,_0x458772);})['then'](function(_0x349ae0){_0x2c7cb5=_0x349ae0;return getCall(_0xdc4e74,_0x1fbeca,_0x4bb18d,_0x3489d4,_0x2c7cb5,_0x458772,_0x3475df,_0x5496('0x76'));})['then'](function(_0x320bb4){if(_0x320bb4){logger[_0x5496('0x35')](_0x5496('0x88'),_0x320bb4['id']);}})[_0x5496('0x2b')](function(_0x4ff860){logger['error']('['+_0x3475df[_0x5496('0x6a')][_0x5496('0x95')]()+']',JSON[_0x5496('0xd')](_0x4ff860));});}; \ No newline at end of file +var _0x552c=['/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','toUpperCase','request-promise','md5','util','./util','zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','type','idField','content','toString','variableName','Variable','name','toLowerCase','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','user','The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','isNil','first_name','last_name','code','SUCCESS','details','Error:\x20','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x552c,0xa0));var _0xc552=function(_0x2dc367,_0x591c8a){_0x2dc367=_0x2dc367-0x0;var _0x14845a=_0x552c[_0x2dc367];return _0x14845a;};'use strict';var _=require('lodash');var rp=require(_0xc552('0x0'));var md5=require(_0xc552('0x1'));var util=require(_0xc552('0x2'));var intUtil=require(_0xc552('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xc552('0x4'));config[_0xc552('0x5')]=_[_0xc552('0x6')](config[_0xc552('0x5')],{'host':_0xc552('0x7'),'port':0x18eb});var io=require(_0xc552('0x8'))(new Redis(config[_0xc552('0x5')]));function emit(_0x3cb4d3,_0x568306,_0x3cc194){io['to'](_0x3cb4d3)['emit'](_0x568306,_0x3cc194);}function request(_0x437317){logger['debug'](_0xc552('0x9'),JSON[_0xc552('0xa')](_0x437317));return rp(_0x437317);}function getCustomFields(_0x327fb4,_0x35c271){var _0x551374={};if(_0x327fb4[_0xc552('0xb')]>0x0){_[_0xc552('0xc')](_0x327fb4,function(_0x31791d){if(_0x31791d[_0xc552('0xd')]==='string'&&_0x31791d[_0xc552('0xe')]){_0x551374[_0x31791d[_0xc552('0xe')]]=_0x31791d[_0xc552('0xf')][_0xc552('0x10')]();}else if(_0x31791d[_0xc552('0xd')]==='variable'&&_0x31791d[_0xc552('0x11')]&&_0x31791d[_0xc552('0xe')]&&_0x35c271[_0x31791d[_0xc552('0x11')]]){_0x551374[_0x31791d['idField']]=_0x35c271[_0x31791d[_0xc552('0x11')]]['toString']();}else if(_0x31791d[_0xc552('0xd')]==='customVariable'&&_0x31791d[_0xc552('0x12')]&&_0x31791d[_0xc552('0x12')][_0xc552('0x13')]&&_0x31791d[_0xc552('0xe')]&&_0x35c271[_0x31791d[_0xc552('0x12')]['name'][_0xc552('0x14')]()]){_0x551374[_0x31791d['idField']]=_0x35c271[_0x31791d[_0xc552('0x12')]['name'][_0xc552('0x14')]()][_0xc552('0x10')]();}});}return _0x551374;}function getName(_0x1e4edc){if(_0x1e4edc['indexOf']('\x20')>0x0){var _0xa0055e=_0x1e4edc[_0xc552('0x15')](/ (.+)/);if(_0xa0055e[0x1]){return _0xa0055e;}}return[_0x1e4edc,_0x1e4edc];}var accountsTokens={};function getAccessToken(_0x4a61c5){return new Promise(function(_0x4760ef,_0x8c7fca){if(!_['isNil'](accountsTokens[_0x4a61c5['id']])&&!_['isNil'](accountsTokens[_0x4a61c5['id']][_0xc552('0x16')])){if(moment()[_0xc552('0x17')](accountsTokens[_0x4a61c5['id']][_0xc552('0x18')])){_0x4760ef(accountsTokens[_0x4a61c5['id']]['access_token']);}}var _0x231bda;switch(_0x4a61c5[_0xc552('0x19')]){case'US':_0x231bda=_0xc552('0x1a');break;case'AU':_0x231bda=_0xc552('0x1b');break;case'EU':_0x231bda=_0xc552('0x1c');break;case'IN':_0x231bda=_0xc552('0x1d');break;case'CN':_0x231bda='https://accounts.zoho.com.cn';break;default:_0x231bda=_0xc552('0x1c');break;}var _0x2419de={'method':_0xc552('0x1e'),'uri':_0x231bda+_0xc552('0x1f'),'qs':{'refresh_token':_0x4a61c5['refreshToken'],'client_id':_0x4a61c5[_0xc552('0x20')],'client_secret':_0x4a61c5['clientSecret'],'grant_type':_0xc552('0x21')},'json':!![]};return rp(_0x2419de)[_0xc552('0x22')](function(_0x48e6e3){accountsTokens[_0x4a61c5['id']]={'access_token':_0x48e6e3[_0xc552('0x16')],'expires_in':moment()['add'](_0x48e6e3[_0xc552('0x18')],_0xc552('0x23'))};_0x4760ef(_0x48e6e3[_0xc552('0x16')]);})['catch'](function(_0x5a5edc){logger[_0xc552('0x24')](_0xc552('0x25'),_0x5a5edc[_0xc552('0x26')]);_0x8c7fca(_0x5a5edc);});});}function getUser(_0xd8d84d,_0x1043be,_0x447f1d,_0x4c463a){logger[_0xc552('0x27')](_0xc552('0x28'));return request({'method':'GET','uri':util[_0xc552('0x29')](_0xc552('0x2a'),_0x1043be),'qs':{'type':_0xc552('0x2b')},'headers':{'Authorization':_0xc552('0x2c')+_0xd8d84d},'json':!![]})[_0xc552('0x22')](function(_0x4a2ccb){if(_0x4a2ccb[_0xc552('0x2d')]){var _0x9aa416=-0x1;if(_[_0xc552('0x2e')](_0x4a2ccb[_0xc552('0x2d')])){if(!_['isNil'](_0x4c463a)){_0x9aa416=_[_0xc552('0x2f')](_0x4a2ccb[_0xc552('0x2d')],function(_0x58750b){return _0x58750b[_0xc552('0x30')]===_0x4c463a;});}if(_0x9aa416>=0x0){logger[_0xc552('0x27')](_0xc552('0x31'));}else{logger[_0xc552('0x27')]('Using\x20the\x20admin\x20account!');_0x9aa416=_[_0xc552('0x2f')](_0x4a2ccb[_0xc552('0x2d')],function(_0x3bab58){return _0x3bab58[_0xc552('0x32')]['name']==='Administrator';});}return _0x4a2ccb[_0xc552('0x2d')][_0x9aa416];}else{if(_0x4a2ccb[_0xc552('0x33')][_0xc552('0x32')][_0xc552('0x13')]==='Administrator'){logger[_0xc552('0x27')]('Using\x20the\x20admin\x20account!');user=_0x4a2ccb[_0xc552('0x33')];return user;}else{logger['error'](_0xc552('0x34'),JSON[_0xc552('0xa')](_0x4a2ccb));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc552('0xa')](_0x4a2ccb));}}}else{logger['error'](_0xc552('0x34'),JSON['stringify'](_0x4a2ccb));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x4a2ccb));}})[_0xc552('0x35')](function(_0x4a8ecc){console[_0xc552('0x24')](_0x4a8ecc);});}function getZohoUser(_0x4a62ff,_0x3c2c10){return new BPromise(function(_0x36db75,_0x3d98da){request(_0x4a62ff)['then'](function(_0x4f655a){var _0x33743b=null;if(_0x4f655a){_0x33743b=_0x4f655a[_0xc552('0x36')][0x0];_0x33743b[_0xc552('0x37')]=_0x3c2c10;}_0x36db75(_0x33743b);})['catch'](function(_0x392b22){_0x3d98da(_0x392b22);});});}function createEndUser(_0x5332dd,_0x6ad3e7,_0x73dfe,_0x518821,_0x559192,_0x55fd51){var _0x73dfe=getName(_0x73dfe);return request({'method':_0xc552('0x1e'),'uri':_0xc552('0x38')+_0x6ad3e7+_0xc552('0x39')+_[_0xc552('0x3a')](_0x55fd51[_0xc552('0x3b')])+'s','body':{'data':[{'Last_Name':_0x73dfe[0x1],'First_Name':_0x73dfe[0x0],'Phone':_0x518821,'Owner':{'name':!_['isNil'](_0x559192['role'][_0xc552('0x13')])?_0x559192[_0xc552('0x3c')][_0xc552('0x13')]:!_[_0xc552('0x3d')](_0x559192[_0xc552('0x3e')])?_0x559192[_0xc552('0x3e')]+'\x20'+_0x559192[_0xc552('0x3f')]:_0x559192[_0xc552('0x3f')],'id':_0x559192['id']}}]},'headers':{'Authorization':_0xc552('0x2c')+_0x5332dd},'json':!![]})[_0xc552('0x22')](function(_0x480511){if(_0x480511&&_0x480511[_0xc552('0x36')][0x0][_0xc552('0x40')]===_0xc552('0x41')){var _0x5cb286=_0x480511[_0xc552('0x36')][0x0][_0xc552('0x42')];_0x5cb286[_0xc552('0x37')]=_[_0xc552('0x3a')](_0x55fd51[_0xc552('0x3b')])+'s';return _0x5cb286;}logger[_0xc552('0x24')](_0xc552('0x34'),JSON[_0xc552('0xa')](data));throw new Error(_0xc552('0x43')+JSON[_0xc552('0xa')](data));})[_0xc552('0x35')](function(_0xf8b475){console['log']('CREATE\x20ERROR',_0xf8b475);});}function getEndUser(_0x25b6ce,_0x5d893e,_0xd2be1c,_0x3c7f38,_0x244b63,_0x5a7e41,_0x16d3cd){var _0x4c997b={'method':'GET','uri':'','headers':{'Authorization':_0xc552('0x2c')+_0x25b6ce},'json':!![]};switch(_0x16d3cd[_0xc552('0x44')]){case _0xc552('0x45'):_0x4c997b['uri']='https://www.zohoapis.'+_0x5d893e+_0xc552('0x46')+_0x244b63+'))';return getZohoUser(_0x4c997b,_0xc552('0x47'))[_0xc552('0x22')](function(_0x2c589b){if(_0x2c589b)return _0x2c589b;_0x4c997b[_0xc552('0x48')]='https://www.zohoapis.'+_0x5d893e+_0xc552('0x49')+_0x244b63+'))';return getZohoUser(_0x4c997b,_0xc552('0x4a'))[_0xc552('0x22')](function(_0x5b4e9d){if(_0x5b4e9d)return _0x5b4e9d;if(_0x16d3cd['moduleCreate']!=_0xc552('0x4b')){return createEndUser(_0x25b6ce,_0x5d893e,_0x3c7f38,_0x244b63,_0x5a7e41,_0x16d3cd);}else{return{};}});});break;case'contact':_0x4c997b['uri']=_0xc552('0x38')+_0x5d893e+_0xc552('0x46')+_0x244b63+'))';return getZohoUser(_0x4c997b,_0xc552('0x47'))[_0xc552('0x22')](function(_0x1ed39a){if(_0x1ed39a)return _0x1ed39a;if(_0x16d3cd[_0xc552('0x3b')]!=_0xc552('0x4b')){return createEndUser(_0x25b6ce,_0x5d893e,_0x3c7f38,_0x244b63,_0x5a7e41,_0x16d3cd);}else{return{};}});break;case'lead':_0x4c997b['uri']=_0xc552('0x38')+_0x5d893e+_0xc552('0x49')+_0x244b63+'))';return getZohoUser(_0x4c997b,'Leads')[_0xc552('0x22')](function(_0x1d2884){if(_0x1d2884)return _0x1d2884;if(_0x16d3cd['moduleCreate']!='nothing'){return createEndUser(_0x25b6ce,_0x5d893e,_0x3c7f38,_0x244b63,_0x5a7e41,_0x16d3cd);}else{return{};}});break;}}function getCall(_0x3ae4c5,_0x4ce394,_0x196346,_0x1c580d,_0x1608a4,_0x395b32,_0x1f01b8,_0x2728cf){logger[_0xc552('0x27')](_0xc552('0x4c'));var _0x30d5c2={};_0x30d5c2[_0xc552('0x4d')]={'name':!_[_0xc552('0x3d')](_0x1c580d[_0xc552('0x3c')][_0xc552('0x13')])&&!_['isNil'](_0x1c580d['profile'][_0xc552('0x13')])&&_0x1c580d[_0xc552('0x32')][_0xc552('0x13')]===_0xc552('0x4e')?_0x1c580d['role'][_0xc552('0x13')]:!_['isNil'](_0x1c580d['first_name'])?_0x1c580d[_0xc552('0x3e')]+'\x20'+_0x1c580d['last_name']:_0x1c580d[_0xc552('0x3f')],'id':_0x1c580d['id']};_0x30d5c2[_0xc552('0x4f')]=intUtil[_0xc552('0x50')](_0x395b32[_0xc552('0x51')],_0x1f01b8,'\x20');_0x30d5c2['Description']=intUtil[_0xc552('0x50')](_0x395b32[_0xc552('0x52')],_0x1f01b8,'\x0a');if(_0x1608a4['enduserType']==='Contacts'){_0x30d5c2['Who_Id']={'name':!_[_0xc552('0x3d')](_0x1608a4[_0xc552('0x53')])?_0x1608a4[_0xc552('0x53')]:!_[_0xc552('0x3d')](_0x1608a4[_0xc552('0x54')])?_0x1608a4[_0xc552('0x54')]+'\x20'+_0x1608a4['Last_Name']:_0x1608a4['Last_Name'],'id':_0x1608a4['id']};}if(_0x1608a4[_0xc552('0x37')]==='Leads'){_0x30d5c2['What_Id']={'name':!_[_0xc552('0x3d')](_0x1608a4[_0xc552('0x53')])?_0x1608a4[_0xc552('0x53')]:!_[_0xc552('0x3d')](_0x1608a4[_0xc552('0x54')])?_0x1608a4[_0xc552('0x54')]+'\x20'+_0x1608a4[_0xc552('0x55')]:_0x1608a4[_0xc552('0x55')],'id':_0x1608a4['id']};_0x30d5c2[_0xc552('0x56')]=_[_0xc552('0x3a')](_0x1608a4[_0xc552('0x37')]);}if(_0x1f01b8[_0xc552('0x57')]){_0x30d5c2[_0xc552('0x58')]=moment[_0xc552('0x59')](parseInt(_0x1f01b8['talktime'])*0x3e8)[_0xc552('0x29')](_0xc552('0x5a'));}else if(_0x1f01b8[_0xc552('0x5b')]&&_0x1f01b8[_0xc552('0x5c')]){_0x30d5c2[_0xc552('0x58')]=moment[_0xc552('0x59')](moment(_0x1f01b8[_0xc552('0x5c')],_0xc552('0x5d'))[_0xc552('0x5e')](moment(_0x1f01b8[_0xc552('0x5f')],'YYYY-MM-DDTHH:mm:ss')))[_0xc552('0x29')](_0xc552('0x5a'));}switch(_0x1f01b8[_0xc552('0x60')]){case _0xc552('0x61'):_0x30d5c2[_0xc552('0x62')]=_0xc552('0x63');break;case _0xc552('0x64'):case _0xc552('0x65'):_0x30d5c2['Call_Result']='Answered';break;case _0xc552('0x66'):_0x30d5c2[_0xc552('0x62')]=_0xc552('0x67');break;case'abandoned':_0x30d5c2[_0xc552('0x62')]='Abandoned';break;case _0xc552('0x68'):_0x30d5c2[_0xc552('0x62')]=_0xc552('0x69');default:}_0x30d5c2['Call_Start_Time']=(_0x2728cf===_0xc552('0x6a')?moment(_0x1f01b8['starttime'])['format'](_0xc552('0x5d')):moment(_0x1f01b8[_0xc552('0x6b')])[_0xc552('0x29')](_0xc552('0x5d')))||moment()['format'](_0xc552('0x5d'));_0x30d5c2[_0xc552('0x6c')]=_0x2728cf||_0xc552('0x6d');_0x30d5c2=_[_0xc552('0x6e')](_0x30d5c2,getCustomFields(_0x395b32['Fields'],_0x1f01b8));return request({'method':_0xc552('0x1e'),'uri':_0xc552('0x38')+_0x4ce394+_0xc552('0x6f'),'headers':{'Authorization':_0xc552('0x2c')+_0x3ae4c5},'body':{'data':[_0x30d5c2]},'json':!![]})['then'](function(_0x19a85f){if(_0x19a85f&&_0x19a85f[_0xc552('0x36')][0x0][_0xc552('0x40')]===_0xc552('0x41')){logger[_0xc552('0x27')](_0xc552('0x70'));return{'id':_0x19a85f[_0xc552('0x36')][0x0][_0xc552('0x42')]['id']};}})[_0xc552('0x35')](function(_0x1dfd3f){logger[_0xc552('0x27')](_0xc552('0x71'),_0x1dfd3f['stack']);console[_0xc552('0x72')]('err',_0x1dfd3f);});}exports['queue']=function(_0x1ef42c,_0x2f835d,_0x498d96,_0x2eb866,_0x2a1636,_0x3d52b4){var _0x5c8f9e,_0x595328,_0x2cf8b2;_0x3d52b4[_0xc552('0x73')]=intUtil[_0xc552('0x74')](_0x3d52b4[_0xc552('0x73')]);_0x3d52b4[_0xc552('0x75')]=intUtil[_0xc552('0x74')](_0x3d52b4['serverUrl']);if(_0x2a1636&&_0x2a1636[_0xc552('0x76')]){logger[_0xc552('0x27')](_0xc552('0x77'),_0xc552('0x78'));_0x2f835d[_0xc552('0x79')]=_0x3d52b4[_0xc552('0x75')]+_0xc552('0x7a')+_0x2f835d[_0xc552('0x7b')]+_0xc552('0x7c')+md5(_0x2f835d[_0xc552('0x7b')]);}else{_0x2f835d[_0xc552('0x79')]='';}var _0x1e1f06=_0x3d52b4[_0xc552('0x73')]===_0xc552('0x7d')?'eu':_0xc552('0x7e');return getAccessToken(_0x3d52b4)[_0xc552('0x22')](function(_0x43632d){_0x2cf8b2=_0x43632d;return getUser(_0x2cf8b2,_0x1e1f06,_0x3d52b4,_0x2eb866['email']);})[_0xc552('0x22')](function(_0x31d749){_0x5c8f9e=_0x31d749;logger[_0xc552('0x27')](_0xc552('0x7f'),_0x5c8f9e['id']);return getEndUser(_0x2cf8b2,_0x1e1f06,_0x3d52b4,_0x2f835d[_0xc552('0x80')],_0x2f835d[_0xc552('0x81')],_0x5c8f9e,_0x498d96);})[_0xc552('0x22')](function(_0x323e6f){_0x595328=_0x323e6f;return getCall(_0x2cf8b2,_0x1e1f06,_0x3d52b4,_0x5c8f9e,_0x595328,_0x498d96,_0x2f835d,'Inbound');})[_0xc552('0x22')](function(_0x455604){if(_0x455604){logger['info'](_0xc552('0x82'),_0x455604['id']);logger[_0xc552('0x27')]('[QUEUE]',_0xc552('0x83'));emit(util[_0xc552('0x29')](_0xc552('0x84'),_0x2eb866[_0xc552('0x13')]),_0xc552('0x85'),{'uri':_0xc552('0x86')+_0x3d52b4[_0xc552('0x73')]+_0xc552('0x87')+_0x455604['id']});}})[_0xc552('0x35')](function(_0x145e45){logger[_0xc552('0x24')]('[QUEUE]',JSON['stringify'](_0x145e45));});};exports[_0xc552('0x6a')]=function(_0x5b0136,_0x38725a,_0x16f04a,_0x5b5236,_0x2ffbe4,_0x4447d1,_0x2d78a9){var _0x31cb3d,_0x10d5e6,_0x577fb1;_0x4447d1[_0xc552('0x73')]=intUtil['stripTrailingSlash'](_0x4447d1[_0xc552('0x73')]);_0x4447d1['serverUrl']=intUtil['stripTrailingSlash'](_0x4447d1[_0xc552('0x75')]);if(_0x2d78a9&&_0x2d78a9[_0xc552('0x88')]&&_0x2d78a9[_0xc552('0x88')]!==_0xc552('0x89')){logger[_0xc552('0x27')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x38725a[_0xc552('0x79')]=_0x4447d1[_0xc552('0x75')]+_0xc552('0x7a')+_0x38725a[_0xc552('0x7b')]+_0xc552('0x7c')+md5(_0x38725a[_0xc552('0x7b')]);}var _0x9ff6ab=_0x4447d1[_0xc552('0x73')]===_0xc552('0x7d')?'eu':'com';return getAccessToken(_0x4447d1)['then'](function(_0x45ec7e){_0x577fb1=_0x45ec7e;return getUser(_0x577fb1,_0x9ff6ab,_0x4447d1,_0x5b5236[_0xc552('0x30')]);})[_0xc552('0x22')](function(_0x34433c){_0x31cb3d=_0x34433c;logger[_0xc552('0x27')](_0xc552('0x7f'),_0x31cb3d['id']);return getEndUser(_0x577fb1,_0x9ff6ab,_0x4447d1,_0x38725a[_0xc552('0x8a')],_0x38725a[_0xc552('0x8b')],_0x31cb3d,_0x16f04a);})[_0xc552('0x22')](function(_0x24e72c){_0x10d5e6=_0x24e72c;return getCall(_0x577fb1,_0x9ff6ab,_0x4447d1,_0x31cb3d,_0x10d5e6,_0x16f04a,_0x38725a,'Outbound');})[_0xc552('0x22')](function(_0x52b702){if(_0x52b702){logger[_0xc552('0x27')](_0xc552('0x82'),_0x52b702['id']);logger[_0xc552('0x27')]('[OUTBOUND]',_0xc552('0x83'));emit(util[_0xc552('0x29')](_0xc552('0x84'),_0x5b5236['name']),_0xc552('0x85'),{'uri':_0xc552('0x86')+_0x4447d1[_0xc552('0x73')]+_0xc552('0x87')+_0x52b702['id']});}})['catch'](function(_0x118e78){logger['error']('[OUTBOUND]',JSON[_0xc552('0xa')](_0x118e78));});};exports['unmanaged']=function(_0x2a614d,_0x1a99c1,_0x40f4b3,_0x8fa1b,_0xa1df66,_0x585260){var _0x581e9f,_0x333b09,_0x584bd5;_0x585260['host']=intUtil[_0xc552('0x74')](_0x585260[_0xc552('0x73')]);_0x585260[_0xc552('0x75')]=intUtil['stripTrailingSlash'](_0x585260['serverUrl']);if(_0xa1df66&&_0xa1df66[_0xc552('0x76')]){logger[_0xc552('0x27')]('['+_0x1a99c1[_0xc552('0x60')][_0xc552('0x8c')]()+']',_0xc552('0x78'));_0x1a99c1['recordingURL']=_0x585260['serverUrl']+_0xc552('0x7a')+_0x1a99c1[_0xc552('0x7b')]+'/downloads?type=uniqueid&token='+md5(_0x1a99c1[_0xc552('0x7b')]);}else{_0x1a99c1[_0xc552('0x79')]='';}var _0x5387b9=_0x585260[_0xc552('0x73')]===_0xc552('0x7d')?'eu':_0xc552('0x7e');return getAccessToken(_0x585260)[_0xc552('0x22')](function(_0x24c013){_0x584bd5=_0x24c013;return getUser(_0x584bd5,_0x5387b9,_0x585260);})[_0xc552('0x22')](function(_0x2380ec){_0x581e9f=_0x2380ec;logger[_0xc552('0x27')](_0xc552('0x7f'),_0x581e9f['id']);return getEndUser(_0x584bd5,_0x5387b9,_0x585260,_0x1a99c1['calleridname'],_0x1a99c1[_0xc552('0x81')],_0x581e9f,_0x40f4b3);})['then'](function(_0x5a6da6){_0x333b09=_0x5a6da6;return getCall(_0x584bd5,_0x5387b9,_0x585260,_0x581e9f,_0x333b09,_0x40f4b3,_0x1a99c1,_0xc552('0x6d'));})[_0xc552('0x22')](function(_0x191bc5){if(_0x191bc5){logger[_0xc552('0x27')](_0xc552('0x82'),_0x191bc5['id']);}})[_0xc552('0x35')](function(_0x2cfae5){logger['error']('['+_0x1a99c1[_0xc552('0x60')][_0xc552('0x8c')]()+']',JSON['stringify'](_0x2cfae5));});}; \ 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 4bff048..7bbfcf9 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(_0xd03e68,_0x13b64d){var _0x5c0ade=function(_0xe0c71d){while(--_0xe0c71d){_0xd03e68['push'](_0xd03e68['shift']());}};_0x5c0ade(++_0x13b64d);}(_0x7a54,0x106));var _0x47a5=function(_0x2ecf01,_0x47bf0c){_0x2ecf01=_0x2ecf01-0x0;var _0x51ad38=_0x7a54[_0x2ecf01];return _0x51ad38;};'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(_0x160366,_0x124b03){var _0x2f7cbb=function(_0x97e0e1){while(--_0x97e0e1){_0x160366['push'](_0x160366['shift']());}};_0x2f7cbb(++_0x124b03);}(_0x7a54,0x106));var _0x47a5=function(_0x17935e,_0x4e48a0){_0x17935e=_0x17935e-0x0;var _0x500090=_0x7a54[_0x17935e];return _0x500090;};'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 d291e2c..11fe2ad 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 _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(_0x23eb9e,_0x3e2b04){var _0x1184f4=function(_0x31ba4f){while(--_0x31ba4f){_0x23eb9e['push'](_0x23eb9e['shift']());}};_0x1184f4(++_0x3e2b04);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1dd53e,_0x3653a2){_0x1dd53e=_0x1dd53e-0x0;var _0xa39c4c=_0x5f2f[_0x1dd53e];return _0xa39c4c;};'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 +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(_0x52919c,_0x5dc34c){var _0x18f6ba=function(_0x96f587){while(--_0x96f587){_0x52919c['push'](_0x52919c['shift']());}};_0x18f6ba(++_0x5dc34c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fe5cf,_0x2e8875){_0x3fe5cf=_0x3fe5cf-0x0;var _0x34f616=_0x5f2f[_0x3fe5cf];return _0x34f616;};'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 011ec7e..95ba50c 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 _0x7bae=['then','debug','rpc','error','message','result','catch','../../config/logger','routing','http','request'];(function(_0x10c327,_0x271f4c){var _0x190ced=function(_0x212ef7){while(--_0x212ef7){_0x10c327['push'](_0x10c327['shift']());}};_0x190ced(++_0x271f4c);}(_0x7bae,0x13b));var _0xe7ba=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x7bae[_0xdea41a];return _0x15d0d8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var client=jayson['client'][_0xe7ba('0x2')]({'port':0x2329});client['Request']=function(_0x120efa,_0x10908b){return new BPromise(function(_0x166acb,_0x2276df){return client[_0xe7ba('0x3')](_0x120efa,_0x10908b)[_0xe7ba('0x4')](function(_0x2d31df){logger[_0xe7ba('0x5')](_0xe7ba('0x6'),_0xe7ba('0x1'),_0x120efa,_0x10908b,_0x2d31df);if(_0x2d31df[_0xe7ba('0x7')]){logger[_0xe7ba('0x7')](_0xe7ba('0x6'),_0xe7ba('0x1'),_0x120efa,_0x2d31df['error'][_0xe7ba('0x8')],_0x10908b);return _0x2276df(_0x2d31df[_0xe7ba('0x7')][_0xe7ba('0x8')]);}else{return _0x166acb(_0x2d31df[_0xe7ba('0x9')]);}})[_0xe7ba('0xa')](function(_0x1672f0){logger[_0xe7ba('0x7')](_0xe7ba('0x6'),_0xe7ba('0x1'),_0x120efa,_0x1672f0,_0x10908b);return _0x2276df(_0x1672f0);});});};module['exports']=client; \ No newline at end of file +var _0x34aa=['error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc'];(function(_0x2e65dc,_0x79dc84){var _0x24db4f=function(_0x3474ff){while(--_0x3474ff){_0x2e65dc['push'](_0x2e65dc['shift']());}};_0x24db4f(++_0x79dc84);}(_0x34aa,0x171));var _0xa34a=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x34aa[_0x4de877];return _0xb2cfeb;};'use strict';var jayson=require(_0xa34a('0x0'));var BPromise=require('bluebird');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var client=jayson[_0xa34a('0x3')][_0xa34a('0x4')]({'port':0x2329});client['Request']=function(_0x1d7a4f,_0x30f3a2){return new BPromise(function(_0x284561,_0x1db413){return client[_0xa34a('0x5')](_0x1d7a4f,_0x30f3a2)[_0xa34a('0x6')](function(_0x27349c){logger[_0xa34a('0x7')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x30f3a2,_0x27349c);if(_0x27349c[_0xa34a('0x9')]){logger['error'](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x27349c[_0xa34a('0x9')][_0xa34a('0xa')],_0x30f3a2);return _0x1db413(_0x27349c[_0xa34a('0x9')]['message']);}else{return _0x284561(_0x27349c[_0xa34a('0xb')]);}})[_0xa34a('0xc')](function(_0x1c8e32){logger[_0xa34a('0x9')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x1c8e32,_0x30f3a2);return _0x1db413(_0x1c8e32);});});};module[_0xa34a('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f58be3a..ab238e5 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 _0xbd18=['./realtime','./rpc/mailAccount','getMailAccounts','then','refresh','mailAccounts','listen','Setting','loginMailFrequency','bluebird','./server'];(function(_0x3351bf,_0x1acad8){var _0x535d15=function(_0x22518d){while(--_0x22518d){_0x3351bf['push'](_0x3351bf['shift']());}};_0x535d15(++_0x1acad8);}(_0xbd18,0x195));var _0x8bd1=function(_0x26093,_0x41c064){_0x26093=_0x26093-0x0;var _0x31f98=_0xbd18[_0x26093];return _0x31f98;};'use strict';var BPromise=require(_0x8bd1('0x0'));var server=require(_0x8bd1('0x1'));var Realtime=require(_0x8bd1('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x8bd1('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x8bd1('0x4')]())[_0x8bd1('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0x8bd1('0x6')](realtime[_0x8bd1('0x7')]);return realtime;});}function main(){return server[_0x8bd1('0x8')](realtime,email)[_0x8bd1('0x5')](function(_0x49254d){return initRealtime();})[_0x8bd1('0x5')](function(_0x2bfac3){return db[_0x8bd1('0x9')]['findOne']({'attributes':['id',_0x8bd1('0xa')],'raw':!![]});})[_0x8bd1('0x5')](function(_0x9610e1){return setInterval(initRealtime,_0x9610e1[_0x8bd1('0xa')]*0x3e8);})['catch'](function(_0x434cf1){console['log'](_0x434cf1);});}main(); \ No newline at end of file +var _0x5183=['refresh','mailAccounts','Setting','loginMailFrequency','catch','log','bluebird','./server','./realtime','../../mysqldb','resolve','then','getMailAccounts'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x5183,0x13e));var _0x3518=function(_0x4f4c19,_0x41cfff){_0x4f4c19=_0x4f4c19-0x0;var _0x51990a=_0x5183[_0x4f4c19];return _0x51990a;};'use strict';var BPromise=require(_0x3518('0x0'));var server=require(_0x3518('0x1'));var Realtime=require(_0x3518('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x3518('0x3'))['db'];function initRealtime(){return BPromise[_0x3518('0x4')]()[_0x3518('0x5')](mailAccount[_0x3518('0x6')]())['then'](realtime['initMailAccounts']())[_0x3518('0x5')](function(){email[_0x3518('0x7')](realtime[_0x3518('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x488c52){return initRealtime();})[_0x3518('0x5')](function(_0x33e66c){return db[_0x3518('0x9')]['findOne']({'attributes':['id',_0x3518('0xa')],'raw':!![]});})['then'](function(_0x16931f){return setInterval(initRealtime,_0x16931f[_0x3518('0xa')]*0x3e8);})[_0x3518('0xb')](function(_0x568f06){console[_0x3518('0xc')](_0x568f06);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8c613f1..3ed354c 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 _0x68a9=['verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','mailAccount:update','active','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','Smtp','then'];(function(_0x5a3ff3,_0x24cd48){var _0x451b71=function(_0x109d70){while(--_0x109d70){_0x5a3ff3['push'](_0x5a3ff3['shift']());}};_0x451b71(++_0x24cd48);}(_0x68a9,0x192));var _0x968a=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x68a9[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x968a('0x0'));var moment=require(_0x968a('0x1'));var BPromise=require(_0x968a('0x2'));var md5=require(_0x968a('0x3'));var Redis=require(_0x968a('0x4'));var config=require(_0x968a('0x5'));var logger=require(_0x968a('0x6'))(_0x968a('0x7'));config[_0x968a('0x8')]=_['defaults'](config[_0x968a('0x8')],{'host':_0x968a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x968a('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x234cbd){logger[_0x968a('0xa')]('start\x20email\x20channel');this[_0x968a('0xb')]=_0x234cbd[_0x968a('0xb')];this[_0x968a('0xc')]={};this[_0x968a('0xd')]=new EmailSmtp();}EmailChannel[_0x968a('0xe')][_0x968a('0xf')]=function(_0x53f680){var _0x2e7330=this['mailAccounts'][_0x53f680];var _0x4f17a1={'id':_0x2e7330['id'],'name':_0x2e7330[_0x968a('0x10')],'key':_0x2e7330[_0x968a('0x11')],'active':_0x2e7330['active'],'Imap':{'status':_0x2e7330[_0x968a('0x12')][_0x968a('0x13')],'messageStatus':_0x2e7330[_0x968a('0x12')][_0x968a('0x14')],'total':_0x2e7330[_0x968a('0x12')]['total']}};if(_[_0x968a('0x15')](md5Accounts[_0x53f680])){md5Accounts[_0x53f680]={};}var _0x3848a3=md5(JSON['stringify'](_0x4f17a1));if(md5Accounts[_0x53f680][_0x968a('0x3')]!==_0x3848a3){md5Accounts[_0x53f680]['md5']=_0x3848a3;io[_0x968a('0xf')](_0x968a('0x16'),_0x4f17a1);}};EmailChannel['prototype']['refresh']=function(_0x50f051){for(var _0xcada98 in _0x50f051){if(_0x50f051['hasOwnProperty'](_0xcada98)){if(_0x50f051[_0xcada98]['Imap']&&_0x50f051[_0xcada98][_0x968a('0x17')]){var _0x59f9a2=_0x50f051[_0xcada98][_0x968a('0x12')];if(!this['imapAccounts']['hasOwnProperty'](_0x59f9a2['id'])){this[_0x968a('0xc')][_0x59f9a2['id']]=new EmailImap(_0x59f9a2,_0x50f051[_0xcada98][_0x968a('0x7')]);this[_0x968a('0xc')][_0x59f9a2['id']]['on'](_0x968a('0x18'),this[_0x968a('0x19')][_0x968a('0x1a')](this,_0xcada98));this[_0x968a('0xc')][_0x59f9a2['id']]['on']('email',this[_0x968a('0x1b')][_0x968a('0x1a')](this,_0xcada98));this['imapAccounts'][_0x59f9a2['id']]['on']('end',this[_0x968a('0x1c')][_0x968a('0x1a')](this,_0xcada98));this[_0x968a('0xc')][_0x59f9a2['id']]['on'](_0x968a('0x1d'),this[_0x968a('0x1e')][_0x968a('0x1a')](this,_0xcada98));}}else{if(_[_0x968a('0x15')](this[_0x968a('0xb')][_0xcada98][_0x968a('0x12')])){this[_0x968a('0xb')][_0xcada98][_0x968a('0x12')]={};}this['mailAccounts'][_0xcada98][_0x968a('0x12')][_0x968a('0x13')]=_0x968a('0x1f');this[_0x968a('0xb')][_0xcada98][_0x968a('0x12')][_0x968a('0x14')]='';this[_0x968a('0xf')](_0xcada98);}}}};EmailChannel[_0x968a('0xe')][_0x968a('0x19')]=function(_0x426a6b,_0xb34aed){if(this[_0x968a('0xb')][_0x426a6b]){this[_0x968a('0xb')][_0x426a6b][_0x968a('0x12')][_0x968a('0x13')]=_0x968a('0x20');this[_0x968a('0xb')][_0x426a6b][_0x968a('0x12')][_0x968a('0x14')]=_0xb34aed['name'];if(_0xb34aed[_0x968a('0x21')]){this[_0x968a('0xb')][_0x426a6b][_0x968a('0x12')][_0x968a('0x22')]=_0xb34aed[_0x968a('0x21')][_0x968a('0x22')];}return this['emit'](_0x426a6b);}};EmailChannel['prototype'][_0x968a('0x1b')]=function(_0x2f898c,_0x1a4ac8){logger[_0x968a('0xa')](_0x968a('0x23'),_0x1a4ac8[_0x968a('0x24')],_0x1a4ac8[_0x968a('0x25')],_0x1a4ac8[_0x968a('0x26')],_0x2f898c);if(this[_0x968a('0xb')][_0x2f898c]){return mailAccount[_0x968a('0x27')](_0x2f898c,_0x1a4ac8)['then'](function(_0x1550d9){if(_0x1550d9){logger['info'](_0x968a('0x28'));}})['catch'](function(_0x209162){logger[_0x968a('0x1d')](_0x968a('0x29'),JSON[_0x968a('0x2a')](_0x209162));});}};EmailChannel[_0x968a('0xe')]['handleImapEnd']=function(_0x1ced19){if(this[_0x968a('0xb')][_0x1ced19]&&this['mailAccounts'][_0x1ced19][_0x968a('0x12')]){if(this['imapAccounts'][this[_0x968a('0xb')][_0x1ced19]['Imap']['id']]){delete this[_0x968a('0xc')][this[_0x968a('0xb')][_0x1ced19][_0x968a('0x12')]['id']];}this[_0x968a('0xb')][_0x1ced19][_0x968a('0x12')][_0x968a('0x2b')]=moment();this[_0x968a('0xf')](_0x1ced19);}};EmailChannel[_0x968a('0xe')][_0x968a('0x1e')]=function(_0x21d52d,_0x2bba4a){if(this[_0x968a('0xb')][_0x21d52d]){this['mailAccounts'][_0x21d52d][_0x968a('0x12')][_0x968a('0x13')]=_0x968a('0x1d');this['mailAccounts'][_0x21d52d][_0x968a('0x12')]['messageStatus']=_0x2bba4a;return this[_0x968a('0xf')](_0x21d52d);}};EmailChannel[_0x968a('0xe')][_0x968a('0x2c')]=function(_0x2fa2e8,_0x3387c3){return this[_0x968a('0xd')][_0x968a('0x2d')](_0x2fa2e8,_0x3387c3);};EmailChannel[_0x968a('0xe')]['verifySmtp']=function(_0x128b87){var _0x2c1c25=this;if(this[_0x968a('0xb')][_0x128b87['id']]){if(_['isNil'](this[_0x968a('0xb')][_0x128b87['id']][_0x968a('0x2e')])){this[_0x968a('0xb')][_0x128b87['id']][_0x968a('0x2e')]={};}this[_0x968a('0xb')][_0x128b87['id']][_0x968a('0x2e')][_0x968a('0x2b')]=moment();return new BPromise(function(_0x350fbf,_0x364b82){return _0x2c1c25[_0x968a('0xd')]['verify'](_0x128b87)[_0x968a('0x2f')](function(_0x2446bd){_0x2c1c25[_0x968a('0xb')][_0x128b87['id']][_0x968a('0x2e')][_0x968a('0x13')]=_0x968a('0x30');_0x2c1c25[_0x968a('0xb')][_0x128b87['id']]['Smtp'][_0x968a('0x14')]='';_0x2c1c25['emit'](_0x128b87['id']);_0x350fbf(_0x2446bd);})['catch'](function(_0x2c1bc0){_0x2c1c25[_0x968a('0xb')][_0x128b87['id']][_0x968a('0x2e')][_0x968a('0x13')]='error';_0x2c1c25[_0x968a('0xb')][_0x128b87['id']]['Smtp'][_0x968a('0x14')]=_0x2c1bc0;_0x2c1c25[_0x968a('0xf')](_0x128b87['id']);_0x364b82(_0x2c1bc0);});});}return this[_0x968a('0xd')]['verify'](_0x128b87);};module[_0x968a('0x31')]=EmailChannel; \ No newline at end of file +var _0x921c=['exports','lodash','moment','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','refresh','hasOwnProperty','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','Smtp','lastSync','smtp','verify','then','verified'];(function(_0x52bbe0,_0x16c552){var _0x762bd2=function(_0x2ed4d1){while(--_0x2ed4d1){_0x52bbe0['push'](_0x52bbe0['shift']());}};_0x762bd2(++_0x16c552);}(_0x921c,0x13f));var _0xc921=function(_0xa4c552,_0x399d95){_0xa4c552=_0xa4c552-0x0;var _0x52c2a0=_0x921c[_0xa4c552];return _0x52c2a0;};'use strict';var _=require(_0xc921('0x0'));var moment=require(_0xc921('0x1'));var BPromise=require('bluebird');var md5=require(_0xc921('0x2'));var Redis=require(_0xc921('0x3'));var config=require(_0xc921('0x4'));var logger=require('../../../config/logger')(_0xc921('0x5'));config[_0xc921('0x6')]=_[_0xc921('0x7')](config[_0xc921('0x6')],{'host':_0xc921('0x8'),'port':0x18eb});var io=require(_0xc921('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xc921('0xa'));var EmailSmtp=require(_0xc921('0xb'));var mailAccount=require(_0xc921('0xc'));var md5Accounts={};function EmailChannel(_0x18a125){logger[_0xc921('0xd')](_0xc921('0xe'));this[_0xc921('0xf')]=_0x18a125['mailAccounts'];this[_0xc921('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xc921('0x11')][_0xc921('0x12')]=function(_0x59fc7a){var _0x5abef6=this['mailAccounts'][_0x59fc7a];var _0x1463c9={'id':_0x5abef6['id'],'name':_0x5abef6['name'],'key':_0x5abef6[_0xc921('0x13')],'active':_0x5abef6[_0xc921('0x14')],'Imap':{'status':_0x5abef6[_0xc921('0x15')][_0xc921('0x16')],'messageStatus':_0x5abef6[_0xc921('0x15')][_0xc921('0x17')],'total':_0x5abef6[_0xc921('0x15')][_0xc921('0x18')]}};if(_[_0xc921('0x19')](md5Accounts[_0x59fc7a])){md5Accounts[_0x59fc7a]={};}var _0x566fcc=md5(JSON['stringify'](_0x1463c9));if(md5Accounts[_0x59fc7a]['md5']!==_0x566fcc){md5Accounts[_0x59fc7a][_0xc921('0x2')]=_0x566fcc;io['emit']('mailAccount:update',_0x1463c9);}};EmailChannel[_0xc921('0x11')][_0xc921('0x1a')]=function(_0x3680a3){for(var _0x1a4223 in _0x3680a3){if(_0x3680a3[_0xc921('0x1b')](_0x1a4223)){if(_0x3680a3[_0x1a4223][_0xc921('0x15')]&&_0x3680a3[_0x1a4223][_0xc921('0x14')]){var _0x42611a=_0x3680a3[_0x1a4223]['Imap'];if(!this[_0xc921('0x10')]['hasOwnProperty'](_0x42611a['id'])){this[_0xc921('0x10')][_0x42611a['id']]=new EmailImap(_0x42611a,_0x3680a3[_0x1a4223][_0xc921('0x5')]);this[_0xc921('0x10')][_0x42611a['id']]['on'](_0xc921('0x1c'),this[_0xc921('0x1d')]['bind'](this,_0x1a4223));this['imapAccounts'][_0x42611a['id']]['on'](_0xc921('0x5'),this[_0xc921('0x1e')]['bind'](this,_0x1a4223));this['imapAccounts'][_0x42611a['id']]['on'](_0xc921('0x1f'),this[_0xc921('0x20')][_0xc921('0x21')](this,_0x1a4223));this[_0xc921('0x10')][_0x42611a['id']]['on'](_0xc921('0x22'),this[_0xc921('0x23')]['bind'](this,_0x1a4223));}}else{if(_[_0xc921('0x19')](this['mailAccounts'][_0x1a4223][_0xc921('0x15')])){this[_0xc921('0xf')][_0x1a4223][_0xc921('0x15')]={};}this[_0xc921('0xf')][_0x1a4223][_0xc921('0x15')][_0xc921('0x16')]='disabled';this[_0xc921('0xf')][_0x1a4223][_0xc921('0x15')][_0xc921('0x17')]='';this[_0xc921('0x12')](_0x1a4223);}}}};EmailChannel[_0xc921('0x11')][_0xc921('0x1d')]=function(_0x4dd677,_0x467a78){if(this[_0xc921('0xf')][_0x4dd677]){this[_0xc921('0xf')][_0x4dd677][_0xc921('0x15')][_0xc921('0x16')]='connected';this['mailAccounts'][_0x4dd677]['Imap']['messageStatus']=_0x467a78[_0xc921('0x24')];if(_0x467a78[_0xc921('0x25')]){this[_0xc921('0xf')][_0x4dd677][_0xc921('0x15')][_0xc921('0x18')]=_0x467a78[_0xc921('0x25')][_0xc921('0x18')];}return this[_0xc921('0x12')](_0x4dd677);}};EmailChannel[_0xc921('0x11')][_0xc921('0x1e')]=function(_0x57a9af,_0x4e245e){logger['info'](_0xc921('0x26'),_0x4e245e[_0xc921('0x27')],_0x4e245e[_0xc921('0x28')],_0x4e245e['from'],_0x57a9af);if(this[_0xc921('0xf')][_0x57a9af]){return mailAccount['notify'](_0x57a9af,_0x4e245e)['then'](function(_0x54ac60){if(_0x54ac60){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xc921('0x29')](function(_0x4aaa8e){logger[_0xc921('0x22')](_0xc921('0x2a'),JSON[_0xc921('0x2b')](_0x4aaa8e));});}};EmailChannel[_0xc921('0x11')][_0xc921('0x20')]=function(_0x3ebf04){if(this[_0xc921('0xf')][_0x3ebf04]&&this['mailAccounts'][_0x3ebf04][_0xc921('0x15')]){if(this[_0xc921('0x10')][this[_0xc921('0xf')][_0x3ebf04][_0xc921('0x15')]['id']]){delete this[_0xc921('0x10')][this[_0xc921('0xf')][_0x3ebf04]['Imap']['id']];}this['mailAccounts'][_0x3ebf04][_0xc921('0x15')]['lastSync']=moment();this[_0xc921('0x12')](_0x3ebf04);}};EmailChannel[_0xc921('0x11')][_0xc921('0x23')]=function(_0x336e7a,_0xa1f82f){if(this[_0xc921('0xf')][_0x336e7a]){this[_0xc921('0xf')][_0x336e7a][_0xc921('0x15')]['status']=_0xc921('0x22');this[_0xc921('0xf')][_0x336e7a][_0xc921('0x15')][_0xc921('0x17')]=_0xa1f82f;return this[_0xc921('0x12')](_0x336e7a);}};EmailChannel[_0xc921('0x11')][_0xc921('0x2c')]=function(_0x5aa446,_0x48cf71){return this['smtp'][_0xc921('0x2d')](_0x5aa446,_0x48cf71);};EmailChannel['prototype']['verifySmtp']=function(_0x3e4fd6){var _0x5981cd=this;if(this[_0xc921('0xf')][_0x3e4fd6['id']]){if(_['isNil'](this[_0xc921('0xf')][_0x3e4fd6['id']][_0xc921('0x2e')])){this[_0xc921('0xf')][_0x3e4fd6['id']][_0xc921('0x2e')]={};}this[_0xc921('0xf')][_0x3e4fd6['id']]['Smtp'][_0xc921('0x2f')]=moment();return new BPromise(function(_0x48a12a,_0x5265a9){return _0x5981cd[_0xc921('0x30')][_0xc921('0x31')](_0x3e4fd6)[_0xc921('0x32')](function(_0x5ef1bc){_0x5981cd['mailAccounts'][_0x3e4fd6['id']][_0xc921('0x2e')][_0xc921('0x16')]=_0xc921('0x33');_0x5981cd[_0xc921('0xf')][_0x3e4fd6['id']][_0xc921('0x2e')]['messageStatus']='';_0x5981cd[_0xc921('0x12')](_0x3e4fd6['id']);_0x48a12a(_0x5ef1bc);})[_0xc921('0x29')](function(_0x49d2cb){_0x5981cd['mailAccounts'][_0x3e4fd6['id']][_0xc921('0x2e')][_0xc921('0x16')]=_0xc921('0x22');_0x5981cd[_0xc921('0xf')][_0x3e4fd6['id']]['Smtp']['messageStatus']=_0x49d2cb;_0x5981cd[_0xc921('0x12')](_0x3e4fd6['id']);_0x5265a9(_0x49d2cb);});});}return this[_0xc921('0x30')][_0xc921('0x31')](_0x3e4fd6);};module[_0xc921('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 08d8e77..707e098 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 _0xdc9f=['openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','exports','path','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','imap','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','password','getHost','anonymous@xcally.com'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdc9f,0x9c));var _0xfdc9=function(_0x1f72d2,_0x268155){_0x1f72d2=_0x1f72d2-0x0;var _0x82628c=_0xdc9f[_0x1f72d2];return _0x82628c;};'use strict';var fs=require('fs');var path=require(_0xfdc9('0x0'));var util=require(_0xfdc9('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0xfdc9('0x2'))[_0xfdc9('0x3')];var Iconv=require(_0xfdc9('0x4'))[_0xfdc9('0x5')];var EventEmitter=require(_0xfdc9('0x6'))[_0xfdc9('0x7')];var utils=require(_0xfdc9('0x8'));var logger=require('../../../config/logger')(_0xfdc9('0x9'));function EmailImap(_0x7ae1c6,_0x46a9d3){this[_0xfdc9('0xa')]='INBOX';this[_0xfdc9('0xb')]=this[_0xfdc9('0xc')](_0x7ae1c6,_0x46a9d3);this[_0xfdc9('0xd')]=new Imap(this[_0xfdc9('0xb')]);this[_0xfdc9('0xd')][_0xfdc9('0xe')](_0xfdc9('0xf'),this[_0xfdc9('0x10')]['bind'](this));this['imap'][_0xfdc9('0xe')](_0xfdc9('0x11'),this[_0xfdc9('0x12')][_0xfdc9('0x13')](this));this[_0xfdc9('0xd')]['on'](_0xfdc9('0x14'),this[_0xfdc9('0x15')][_0xfdc9('0x13')](this));this[_0xfdc9('0xd')][_0xfdc9('0x16')]();}util[_0xfdc9('0x17')](EmailImap,EventEmitter);EmailImap[_0xfdc9('0x18')]['getAccount']=function(_0x252279,_0x56c26f){var _0x34e3b9={'connTimeout':_0x252279[_0xfdc9('0x19')]?_0x252279['connTimeout']*0x3e8:0x2710,'authTimeout':_0x252279[_0xfdc9('0x1a')]?_0x252279['authTimeout']*0x3e8:0x1388};if(_[_0xfdc9('0x1b')](_0x252279[_0xfdc9('0x1c')])){if(_0x252279[_0xfdc9('0x1d')]){_0x34e3b9[_0xfdc9('0x1e')]=_0x252279['user'];_0x34e3b9['password']=_0x252279['password'];}_0x34e3b9[_0xfdc9('0x1f')]=_0x252279[_0xfdc9('0x1f')];_0x34e3b9[_0xfdc9('0x20')]=_0x252279[_0xfdc9('0x20')]||0x3e1;if(_0x252279[_0xfdc9('0x21')]){_0x34e3b9[_0xfdc9('0x21')]=!![];}else{_0x34e3b9[_0xfdc9('0x21')]=![];_0x34e3b9[_0xfdc9('0x22')]=_0xfdc9('0x23');}}else{_0x34e3b9[_0xfdc9('0x1e')]=_0x252279[_0xfdc9('0x1e')];_0x34e3b9[_0xfdc9('0x24')]=_0x252279[_0xfdc9('0x24')];_0x34e3b9['host']=utils[_0xfdc9('0x25')](_0x252279[_0xfdc9('0x1c')]);_0x34e3b9[_0xfdc9('0x20')]=0x3e1;_0x34e3b9[_0xfdc9('0x21')]=!![];}_0x34e3b9[_0xfdc9('0x9')]=_0x56c26f||_0x252279[_0xfdc9('0x1e')]||_0xfdc9('0x26');return _0x34e3b9;};EmailImap['prototype']['handleReady']=function(){this['imap'][_0xfdc9('0x27')](this['mailbox'],![],this[_0xfdc9('0x28')][_0xfdc9('0x13')](this));};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x28')]=function(_0x2b130f,_0x494397){if(_0x2b130f){this[_0xfdc9('0x15')](_0x2b130f,!![]);}else{this['emit'](_0xfdc9('0x29'),_0x494397);this[_0xfdc9('0x2a')]();}};EmailImap[_0xfdc9('0x18')]['handleCloseBox']=function(_0x462267){if(_0x462267){this[_0xfdc9('0x15')](_0x462267,!![]);}else{this[_0xfdc9('0xd')][_0xfdc9('0x11')]();}};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x2a')]=function(){this['imap'][_0xfdc9('0x2b')]([_0xfdc9('0x2c')],this[_0xfdc9('0x2d')][_0xfdc9('0x13')](this));};EmailImap['prototype'][_0xfdc9('0x2d')]=function(_0x504921,_0x1c5303){if(_0x504921){this[_0xfdc9('0x15')](_0x504921,!![]);}else{if(_0x1c5303['length']){try{var _0x347947=this[_0xfdc9('0xd')][_0xfdc9('0x2e')](_0x1c5303,{'bodies':'','markSeen':!![]});_0x347947['on'](_0xfdc9('0x2f'),this[_0xfdc9('0x30')][_0xfdc9('0x13')](this));_0x347947['once'](_0xfdc9('0x14'),this[_0xfdc9('0x31')][_0xfdc9('0x13')](this));_0x347947[_0xfdc9('0xe')](_0xfdc9('0x11'),this[_0xfdc9('0x32')][_0xfdc9('0x13')](this));}catch(_0x57c858){logger['error'](_0x57c858);}}else{this[_0xfdc9('0xd')][_0xfdc9('0x33')](!![],this[_0xfdc9('0x34')][_0xfdc9('0x13')](this));}}};EmailImap[_0xfdc9('0x18')]['handleFetchMessage']=function(_0x47ef5d,_0x469835){_0x47ef5d['on'](_0xfdc9('0x35'),this[_0xfdc9('0x36')]['bind'](this));_0x47ef5d[_0xfdc9('0xe')](_0xfdc9('0x37'),this[_0xfdc9('0x38')][_0xfdc9('0x13')](this));_0x47ef5d[_0xfdc9('0xe')](_0xfdc9('0x11'),this[_0xfdc9('0x39')]['bind'](this));};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x36')]=function(_0x12e460,_0x2467bd){simpleParser(_0x12e460,{'Iconv':Iconv},this[_0xfdc9('0x3a')]['bind'](this));};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x38')]=function(_0x311130){};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x39')]=function(){};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x3a')]=function(_0x29d228,_0x46f74c){if(_0x29d228){logger[_0xfdc9('0x14')](_0x29d228);}else{var _0x12fd62=this;utils[_0xfdc9('0x3b')](this['account'],_0x46f74c,function(_0x3137d1){_0x12fd62[_0xfdc9('0x3c')]('email',_0x3137d1);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xfdc9('0x33')](!![],this[_0xfdc9('0x34')]['bind'](this));};EmailImap['prototype'][_0xfdc9('0x31')]=function(_0x5bdb4f){this[_0xfdc9('0x15')](_0x5bdb4f);this['imap'][_0xfdc9('0x33')](!![],this[_0xfdc9('0x34')]['bind'](this));};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x12')]=function(){this['emit'](_0xfdc9('0x11'));};EmailImap[_0xfdc9('0x18')][_0xfdc9('0x15')]=function(_0x50ba0e,_0x3d8082){logger[_0xfdc9('0x14')](_0xfdc9('0x15'),this[_0xfdc9('0xb')][_0xfdc9('0x9')],JSON[_0xfdc9('0x3d')](_0x50ba0e));var _0x221f85='';if(_0x50ba0e){if(_0x50ba0e[_0xfdc9('0x3e')]){_0x221f85=_0x50ba0e[_0xfdc9('0x3e')];}else{for(var _0x449d5a in _0x50ba0e){if(_0x50ba0e[_0xfdc9('0x3f')](_0x449d5a)){_0x221f85+=_['upperFirst'](_0x449d5a)+':\x20'+_0x50ba0e[_0x449d5a]+'\x0a';}}}}if(_0x3d8082){this['imap'][_0xfdc9('0x11')]();}else{this['emit']('error',_0x221f85);this['emit'](_0xfdc9('0x11'));}};module[_0xfdc9('0x40')]=EmailImap; \ No newline at end of file +var _0x8994=['box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','exports','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit'];(function(_0x21595e,_0x554025){var _0x13a181=function(_0x4e1603){while(--_0x4e1603){_0x21595e['push'](_0x21595e['shift']());}};_0x13a181(++_0x554025);}(_0x8994,0x17c));var _0x4899=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8994[_0x16b9ed];return _0x66b1f8;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4899('0x0'));var Imap=require(_0x4899('0x1'));var _=require(_0x4899('0x2'));var rs=require(_0x4899('0x3'));var simpleParser=require(_0x4899('0x4'))[_0x4899('0x5')];var Iconv=require('iconv')[_0x4899('0x6')];var EventEmitter=require('events')[_0x4899('0x7')];var utils=require(_0x4899('0x8'));var logger=require(_0x4899('0x9'))(_0x4899('0xa'));function EmailImap(_0x1d0286,_0x1b7447){this['mailbox']=_0x4899('0xb');this[_0x4899('0xc')]=this[_0x4899('0xd')](_0x1d0286,_0x1b7447);this[_0x4899('0x1')]=new Imap(this['account']);this['imap']['once'](_0x4899('0xe'),this[_0x4899('0xf')][_0x4899('0x10')](this));this[_0x4899('0x1')][_0x4899('0x11')](_0x4899('0x12'),this[_0x4899('0x13')][_0x4899('0x10')](this));this[_0x4899('0x1')]['on'](_0x4899('0x14'),this[_0x4899('0x15')][_0x4899('0x10')](this));this['imap'][_0x4899('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x4899('0x17')][_0x4899('0xd')]=function(_0x333f40,_0x42d01a){var _0x2029a6={'connTimeout':_0x333f40[_0x4899('0x18')]?_0x333f40[_0x4899('0x18')]*0x3e8:0x2710,'authTimeout':_0x333f40[_0x4899('0x19')]?_0x333f40['authTimeout']*0x3e8:0x1388};if(_[_0x4899('0x1a')](_0x333f40[_0x4899('0x1b')])){if(_0x333f40['authentication']){_0x2029a6[_0x4899('0x1c')]=_0x333f40[_0x4899('0x1c')];_0x2029a6[_0x4899('0x1d')]=_0x333f40[_0x4899('0x1d')];}_0x2029a6['host']=_0x333f40[_0x4899('0x1e')];_0x2029a6[_0x4899('0x1f')]=_0x333f40[_0x4899('0x1f')]||0x3e1;if(_0x333f40['tls']){_0x2029a6['tls']=!![];}else{_0x2029a6[_0x4899('0x20')]=![];_0x2029a6[_0x4899('0x21')]='required';}}else{_0x2029a6[_0x4899('0x1c')]=_0x333f40[_0x4899('0x1c')];_0x2029a6[_0x4899('0x1d')]=_0x333f40['password'];_0x2029a6[_0x4899('0x1e')]=utils[_0x4899('0x22')](_0x333f40[_0x4899('0x1b')]);_0x2029a6[_0x4899('0x1f')]=0x3e1;_0x2029a6[_0x4899('0x20')]=!![];}_0x2029a6[_0x4899('0xa')]=_0x42d01a||_0x333f40['user']||_0x4899('0x23');return _0x2029a6;};EmailImap['prototype']['handleReady']=function(){this[_0x4899('0x1')][_0x4899('0x24')](this[_0x4899('0x25')],![],this[_0x4899('0x26')][_0x4899('0x10')](this));};EmailImap[_0x4899('0x17')][_0x4899('0x26')]=function(_0x591535,_0x5c0dbf){if(_0x591535){this[_0x4899('0x15')](_0x591535,!![]);}else{this[_0x4899('0x27')](_0x4899('0x28'),_0x5c0dbf);this[_0x4899('0x29')]();}};EmailImap[_0x4899('0x17')][_0x4899('0x2a')]=function(_0x14b00a){if(_0x14b00a){this[_0x4899('0x15')](_0x14b00a,!![]);}else{this[_0x4899('0x1')][_0x4899('0x12')]();}};EmailImap[_0x4899('0x17')][_0x4899('0x29')]=function(){this[_0x4899('0x1')][_0x4899('0x2b')]([_0x4899('0x2c')],this[_0x4899('0x2d')]['bind'](this));};EmailImap['prototype'][_0x4899('0x2d')]=function(_0x85a824,_0x28b328){if(_0x85a824){this[_0x4899('0x15')](_0x85a824,!![]);}else{if(_0x28b328['length']){try{var _0x2092f4=this['imap']['fetch'](_0x28b328,{'bodies':'','markSeen':!![]});_0x2092f4['on'](_0x4899('0x2e'),this[_0x4899('0x2f')]['bind'](this));_0x2092f4[_0x4899('0x11')](_0x4899('0x14'),this[_0x4899('0x30')]['bind'](this));_0x2092f4['once'](_0x4899('0x12'),this[_0x4899('0x31')]['bind'](this));}catch(_0x4014db){logger['error'](_0x4014db);}}else{this[_0x4899('0x1')][_0x4899('0x32')](!![],this['handleCloseBox'][_0x4899('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4bdfce,_0x157d1d){_0x4bdfce['on'](_0x4899('0x33'),this[_0x4899('0x34')][_0x4899('0x10')](this));_0x4bdfce[_0x4899('0x11')]('attributes',this[_0x4899('0x35')]['bind'](this));_0x4bdfce['once']('end',this[_0x4899('0x36')][_0x4899('0x10')](this));};EmailImap[_0x4899('0x17')][_0x4899('0x34')]=function(_0x24ed99,_0x2383b4){simpleParser(_0x24ed99,{'Iconv':Iconv},this['handleSimpleParser'][_0x4899('0x10')](this));};EmailImap[_0x4899('0x17')][_0x4899('0x35')]=function(_0x2cedd3){};EmailImap[_0x4899('0x17')][_0x4899('0x36')]=function(){};EmailImap[_0x4899('0x17')][_0x4899('0x37')]=function(_0x170f5b,_0x11e267){if(_0x170f5b){logger['error'](_0x170f5b);}else{var _0x542fe6=this;utils['parser'](this[_0x4899('0xc')],_0x11e267,function(_0x3a9b12){_0x542fe6[_0x4899('0x27')](_0x4899('0xa'),_0x3a9b12);});}};EmailImap[_0x4899('0x17')][_0x4899('0x31')]=function(){this['imap'][_0x4899('0x32')](!![],this[_0x4899('0x2a')][_0x4899('0x10')](this));};EmailImap[_0x4899('0x17')][_0x4899('0x30')]=function(_0x1b18df){this[_0x4899('0x15')](_0x1b18df);this[_0x4899('0x1')][_0x4899('0x32')](!![],this[_0x4899('0x2a')]['bind'](this));};EmailImap[_0x4899('0x17')][_0x4899('0x13')]=function(){this['emit'](_0x4899('0x12'));};EmailImap['prototype'][_0x4899('0x15')]=function(_0x5e9aa4,_0x5f0070){logger['error'](_0x4899('0x15'),this[_0x4899('0xc')][_0x4899('0xa')],JSON[_0x4899('0x38')](_0x5e9aa4));var _0x1613fa='';if(_0x5e9aa4){if(_0x5e9aa4[_0x4899('0x39')]){_0x1613fa=_0x5e9aa4[_0x4899('0x39')];}else{for(var _0x5ee850 in _0x5e9aa4){if(_0x5e9aa4[_0x4899('0x3a')](_0x5ee850)){_0x1613fa+=_['upperFirst'](_0x5ee850)+':\x20'+_0x5e9aa4[_0x5ee850]+'\x0a';}}}}if(_0x5f0070){this[_0x4899('0x1')]['end']();}else{this[_0x4899('0x27')](_0x4899('0x14'),_0x1613fa);this['emit'](_0x4899('0x12'));}};module[_0x4899('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 877e5ec..7f189d2 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 _0xa851=['compile','sendMail','toString','verify','exports','nodemailer','bluebird','prototype','send','createTransport'];(function(_0x2732ab,_0x2e5bec){var _0x24e2ef=function(_0x1e178a){while(--_0x1e178a){_0x2732ab['push'](_0x2732ab['shift']());}};_0x24e2ef(++_0x2e5bec);}(_0xa851,0xa5));var _0x1a85=function(_0xfb02c9,_0x43c274){_0xfb02c9=_0xfb02c9-0x0;var _0x9afb71=_0xa851[_0xfb02c9];return _0x9afb71;};'use strict';var nodemailer=require(_0x1a85('0x0'));var BPromise=require(_0x1a85('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x1a85('0x2')][_0x1a85('0x3')]=function(_0x32e2c7,_0x330576){return new BPromise(function(_0x31653e,_0x41b085){var _0x12b10d=nodemailer[_0x1a85('0x4')](_0x32e2c7);_0x12b10d['use'](_0x1a85('0x5'),inlineBase64());_0x12b10d[_0x1a85('0x6')](_0x330576,function(_0x178175,_0x3ff17d){if(_0x178175){_0x41b085(_0x178175[_0x1a85('0x7')]());}else{_0x31653e(_0x3ff17d);}});});};EmailSmtp[_0x1a85('0x2')][_0x1a85('0x8')]=function(_0x4fb1fd){return new BPromise(function(_0x203cca,_0x288b06){var _0x5985ad=nodemailer[_0x1a85('0x4')](_0x4fb1fd);_0x5985ad[_0x1a85('0x8')](function(_0x1fcfb8,_0x2b370e){if(_0x1fcfb8){_0x288b06(_0x1fcfb8[_0x1a85('0x7')]());}else{if(_0x2b370e){_0x203cca(_0x2b370e);}else{_0x288b06('Not\x20verifired');}}});});};module[_0x1a85('0x9')]=EmailSmtp; \ No newline at end of file +var _0x5e1f=['prototype','verify','createTransport','toString','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','send','use','compile','sendMail'];(function(_0x4ac0fa,_0x1ad870){var _0xac2124=function(_0x3b96ad){while(--_0x3b96ad){_0x4ac0fa['push'](_0x4ac0fa['shift']());}};_0xac2124(++_0x1ad870);}(_0x5e1f,0x126));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xf5e1('0x0'));var inlineBase64=require(_0xf5e1('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xf5e1('0x2')]=function(_0x262601,_0x466551){return new BPromise(function(_0x2780bd,_0x16c3ec){var _0x2738c9=nodemailer['createTransport'](_0x262601);_0x2738c9[_0xf5e1('0x3')](_0xf5e1('0x4'),inlineBase64());_0x2738c9[_0xf5e1('0x5')](_0x466551,function(_0x28d84b,_0x50cfd4){if(_0x28d84b){_0x16c3ec(_0x28d84b['toString']());}else{_0x2780bd(_0x50cfd4);}});});};EmailSmtp[_0xf5e1('0x6')][_0xf5e1('0x7')]=function(_0x4f7b0a){return new BPromise(function(_0x110fb0,_0x4b95eb){var _0x529041=nodemailer[_0xf5e1('0x8')](_0x4f7b0a);_0x529041[_0xf5e1('0x7')](function(_0x252c20,_0x494999){if(_0x252c20){_0x4b95eb(_0x252c20[_0xf5e1('0x9')]());}else{if(_0x494999){_0x110fb0(_0x494999);}else{_0x4b95eb(_0xf5e1('0xa'));}}});});};module[_0xf5e1('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1a6bbc4..4ae040b 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 _0xee31=['gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','@xcally.com','name','split','length','slice','join','Anonymous','pop','anonymous','generate','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0xbf7e6,_0x4531c4){var _0x47ab90=function(_0x4982f1){while(--_0x4982f1){_0xbf7e6['push'](_0xbf7e6['shift']());}};_0x47ab90(++_0x4531c4);}(_0xee31,0x1ce));var _0x1ee3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xee31[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x1ee3('0x0'));var moment=require(_0x1ee3('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x1ee3('0x2'));var util=require('util');var tnef=require(_0x1ee3('0x3'));var logger=require(_0x1ee3('0x4'))(_0x1ee3('0x5'));var config=require(_0x1ee3('0x6'));function getAddress(_0x233f2b){var _0xdae163=_[_0x1ee3('0x7')](_0x233f2b[_0x1ee3('0x8')]);return _0xdae163&&_0xdae163[_0x1ee3('0x9')]?_0xdae163[_0x1ee3('0x9')]:'anonymous'+random['generate'](0x6)+_0x1ee3('0xa');}function getFirstName(_0x5285f0){var _0x42930c=_[_0x1ee3('0x7')](_0x5285f0[_0x1ee3('0x8')]);if(_0x42930c&&_0x42930c[_0x1ee3('0xb')]){var _0x417ea1=_0x42930c[_0x1ee3('0xb')][_0x1ee3('0xc')](/\s+/);return _0x417ea1[_0x1ee3('0xd')]?_0x417ea1[_0x1ee3('0xe')](0x0,-0x1)[_0x1ee3('0xf')]('\x20'):_0x42930c['name'];}return _0x1ee3('0x10');}function getLastName(_0x2e9c0d){var _0x511b1a=_[_0x1ee3('0x7')](_0x2e9c0d['value']);if(_0x511b1a&&_0x511b1a[_0x1ee3('0xb')]){var _0x473e03=_0x511b1a[_0x1ee3('0xb')][_0x1ee3('0xc')](/\s+/);return _0x473e03[_0x1ee3('0xd')]>0x1?_0x473e03[_0x1ee3('0x11')]():'';}return'';}function getMails(_0x19102b,_0x563ead){var _0x2295ff='';for(var _0x58fd76=0x0;_0x58fd76<_0x563ead[_0x1ee3('0x8')][_0x1ee3('0xd')];_0x58fd76+=0x1){if(_0x563ead[_0x1ee3('0x8')][_0x58fd76][_0x1ee3('0x9')]!==_0x19102b){if(!_['isEmpty'](_0x2295ff)){_0x2295ff+=',';}_0x2295ff+=_0x563ead[_0x1ee3('0x8')][_0x58fd76]['name']||_0x563ead[_0x1ee3('0x8')][_0x58fd76][_0x1ee3('0x9')]||'';_0x2295ff+='\x20<';_0x2295ff+=_0x563ead[_0x1ee3('0x8')][_0x58fd76][_0x1ee3('0x9')]?_0x563ead[_0x1ee3('0x8')][_0x58fd76][_0x1ee3('0x9')]:_0x1ee3('0x12')+random[_0x1ee3('0x13')](0x6)+'@xcally.com';_0x2295ff+='>';}}return _0x2295ff;}function parseEmail(_0x227701,_0x353971,_0x3ba751){if(_0x353971[_0x1ee3('0x14')]){var _0x1b4c44=/)<[^<]*)*<\/script>/gi;while(_0x1b4c44['test'](_0x353971[_0x1ee3('0x14')])){_0x353971[_0x1ee3('0x14')]=_0x353971['html'][_0x1ee3('0x15')](_0x1b4c44,'');}_0x3ba751[_0x1ee3('0x16')]=_0x353971[_0x1ee3('0x14')];}else{_0x3ba751[_0x1ee3('0x16')]=_0x353971[_0x1ee3('0x17')];}if(_0x3ba751[_0x1ee3('0x16')]){_0x3ba751[_0x1ee3('0x16')]=_0x3ba751[_0x1ee3('0x16')][_0x1ee3('0x15')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','pop'];(function(_0xbed10f,_0x278000){var _0x2c3dda=function(_0x20c9fa){while(--_0x20c9fa){_0xbed10f['push'](_0xbed10f['shift']());}};_0x2c3dda(++_0x278000);}(_0x7fbd,0xbd));var _0xd7fb=function(_0x4d26f3,_0x3e1615){_0x4d26f3=_0x4d26f3-0x0;var _0x3accb7=_0x7fbd[_0x4d26f3];return _0x3accb7;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xd7fb('0x0'));var fs=require('fs');var path=require(_0xd7fb('0x1'));var util=require(_0xd7fb('0x2'));var tnef=require(_0xd7fb('0x3'));var logger=require(_0xd7fb('0x4'))('email');var config=require(_0xd7fb('0x5'));function getAddress(_0x1f99a7){var _0x2c9bb8=_[_0xd7fb('0x6')](_0x1f99a7[_0xd7fb('0x7')]);return _0x2c9bb8&&_0x2c9bb8[_0xd7fb('0x8')]?_0x2c9bb8[_0xd7fb('0x8')]:_0xd7fb('0x9')+random[_0xd7fb('0xa')](0x6)+_0xd7fb('0xb');}function getFirstName(_0x402dd9){var _0x3c24d4=_[_0xd7fb('0x6')](_0x402dd9[_0xd7fb('0x7')]);if(_0x3c24d4&&_0x3c24d4['name']){var _0xa9290a=_0x3c24d4[_0xd7fb('0xc')][_0xd7fb('0xd')](/\s+/);return _0xa9290a[_0xd7fb('0xe')]?_0xa9290a[_0xd7fb('0xf')](0x0,-0x1)[_0xd7fb('0x10')]('\x20'):_0x3c24d4[_0xd7fb('0xc')];}return'Anonymous';}function getLastName(_0x54f302){var _0x207831=_[_0xd7fb('0x6')](_0x54f302[_0xd7fb('0x7')]);if(_0x207831&&_0x207831[_0xd7fb('0xc')]){var _0xcb2ea7=_0x207831[_0xd7fb('0xc')][_0xd7fb('0xd')](/\s+/);return _0xcb2ea7['length']>0x1?_0xcb2ea7[_0xd7fb('0x11')]():'';}return'';}function getMails(_0x214c7c,_0x206834){var _0x55483f='';for(var _0x13f192=0x0;_0x13f192<_0x206834[_0xd7fb('0x7')][_0xd7fb('0xe')];_0x13f192+=0x1){if(_0x206834['value'][_0x13f192][_0xd7fb('0x8')]!==_0x214c7c){if(!_['isEmpty'](_0x55483f)){_0x55483f+=',';}_0x55483f+=_0x206834[_0xd7fb('0x7')][_0x13f192][_0xd7fb('0xc')]||_0x206834[_0xd7fb('0x7')][_0x13f192][_0xd7fb('0x8')]||'';_0x55483f+='\x20<';_0x55483f+=_0x206834['value'][_0x13f192][_0xd7fb('0x8')]?_0x206834[_0xd7fb('0x7')][_0x13f192][_0xd7fb('0x8')]:_0xd7fb('0x9')+random['generate'](0x6)+_0xd7fb('0xb');_0x55483f+='>';}}return _0x55483f;}function parseEmail(_0x924217,_0x315067,_0x5a97b5){if(_0x315067['html']){var _0x565c7=/)<[^<]*)*<\/script>/gi;while(_0x565c7[_0xd7fb('0x12')](_0x315067[_0xd7fb('0x13')])){_0x315067[_0xd7fb('0x13')]=_0x315067[_0xd7fb('0x13')][_0xd7fb('0x14')](_0x565c7,'');}_0x5a97b5[_0xd7fb('0x15')]=_0x315067[_0xd7fb('0x13')];}else{_0x5a97b5[_0xd7fb('0x15')]=_0x315067[_0xd7fb('0x16')];}if(_0x5a97b5[_0xd7fb('0x15')]){_0x5a97b5[_0xd7fb('0x15')]=_0x5a97b5[_0xd7fb('0x15')][_0xd7fb('0x14')](/0x0){if(this[_0x34c6b8+_0x4d84('0x29')]>0x0&&this[_0x34c6b8+_0x4d84('0x28')]>=this[_0x34c6b8+'Capacity']){return _0x4d84('0x2a');}else{return'working';}}else{return _0x4d84('0x2b');}};Agent['prototype']['updateRealtime']=function(){var _0x5c616b=[_0x4d84('0x2c'),_0x4d84('0x2d'),_0x4d84('0x2e'),_0x4d84('0x2f'),'sms',_0x4d84('0x30')];for(var _0x487ef9=0x0;_0x487ef9<_0x5c616b[_0x4d84('0x31')];_0x487ef9+=0x1){var _0x35276a=this['getChannelStatus'](_0x5c616b[_0x487ef9]);if(this[_0x5c616b[_0x487ef9]+_0x4d84('0x32')]!==_0x35276a){this[_0x5c616b[_0x487ef9]+_0x4d84('0x33')]=_[_0x4d84('0x34')](moment()[_0x4d84('0x35')]('x'));}this[_0x5c616b[_0x487ef9]+_0x4d84('0x32')]=_0x35276a;}var _0x5e794c={'id':this['id'],'name':this[_0x4d84('0x7')],'online':this[_0x4d84('0x8')],'voicePause':this[_0x4d84('0x36')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x4d84('0xc')],'faxPause':this[_0x4d84('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4d84('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x4d84('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4d84('0x14')],'mailCapacity':this[_0x4d84('0x15')],'mailCurrentCapacity':this[_0x4d84('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4d84('0x17')],'faxCapacity':this[_0x4d84('0x18')],'faxCurrentCapacity':this[_0x4d84('0x37')],'smsStatus':this[_0x4d84('0x19')],'smsStatusTime':this[_0x4d84('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4d84('0x38')],'whatsappStatus':this[_0x4d84('0x1c')],'whatsappStatusTime':this[_0x4d84('0x1d')],'whatsappCapacity':this[_0x4d84('0x1e')],'whatsappCurrentCapacity':this[_0x4d84('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x38450f=md5(JSON['stringify'](_0x5e794c));if(this[_0x4d84('0x25')]!==_0x38450f){this[_0x4d84('0x25')]=_0x38450f;io['emit'](_0x4d84('0x39'),_0x5e794c);}};module['exports']=Agent; \ No newline at end of file +var _0x390a=['busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','working','chat','openchannel','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','chatStatus','faxStatus','faxStatusTime','whatsappCurrentCapacity','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity'];(function(_0x40f095,_0x5ed119){var _0x53c87b=function(_0x44f9db){while(--_0x44f9db){_0x40f095['push'](_0x40f095['shift']());}};_0x53c87b(++_0x5ed119);}(_0x390a,0xc9));var _0xa390=function(_0x1eedae,_0x1fefce){_0x1eedae=_0x1eedae-0x0;var _0x5c59d4=_0x390a[_0x1eedae];return _0x5c59d4;};'use strict';var _=require(_0xa390('0x0'));var moment=require(_0xa390('0x1'));var md5=require(_0xa390('0x2'));var Redis=require(_0xa390('0x3'));var config=require('../../../config/environment');config[_0xa390('0x4')]=_[_0xa390('0x5')](config[_0xa390('0x4')],{'host':_0xa390('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa390('0x4')]));function Agent(_0x2a4193){this['id']=_0x2a4193['id']||0x0;this[_0xa390('0x7')]=_0x2a4193['name']||'';this[_0xa390('0x8')]=_0x2a4193[_0xa390('0x8')]||!![];this['voicePause']=_0x2a4193['voicePause']||![];this[_0xa390('0x9')]=_0x2a4193[_0xa390('0x9')]||![];this[_0xa390('0xa')]=_0x2a4193[_0xa390('0xa')]||![];this[_0xa390('0xb')]=_0x2a4193['faxPause']||![];this['smsPause']=_0x2a4193[_0xa390('0xc')]||![];this[_0xa390('0xd')]=_0x2a4193[_0xa390('0xd')]||![];this['chatStatus']=_0xa390('0xe');this[_0xa390('0xf')]=0x0;this['chatCapacity']=_0x2a4193[_0xa390('0x10')]||0x0;this[_0xa390('0x11')]=0x0;this['mailStatus']='unknown';this[_0xa390('0x12')]=0x0;this[_0xa390('0x13')]=_0x2a4193['mailCapacity']||0x0;this[_0xa390('0x14')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0xa390('0x15')]=_0x2a4193['faxCapacity']||0x0;this[_0xa390('0x16')]=0x0;this[_0xa390('0x17')]='unknown';this[_0xa390('0x18')]=0x0;this[_0xa390('0x19')]=_0x2a4193['smsCapacity']||0x0;this[_0xa390('0x1a')]=0x0;this['whatsappStatus']=_0xa390('0xe');this[_0xa390('0x1b')]=0x0;this[_0xa390('0x1c')]=_0x2a4193[_0xa390('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xa390('0x1d')]='unknown';this['openchannelStatusTime']=0x0;this[_0xa390('0x1e')]=_0x2a4193[_0xa390('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xa390('0x1f')]=![];this[_0xa390('0x20')]=undefined;this['md5']='';this[_0xa390('0x21')]();}Agent[_0xa390('0x22')]['getChannelStatus']=function(_0x5222bd){if(this[_0x5222bd+_0xa390('0x23')]>0x0){if(this[_0x5222bd+_0xa390('0x24')]>0x0&&this[_0x5222bd+_0xa390('0x23')]>=this[_0x5222bd+'Capacity']){return'maxcapacity';}else{return _0xa390('0x25');}}else{return'idle';}};Agent[_0xa390('0x22')][_0xa390('0x21')]=function(){var _0x2aeb9f=['mail',_0xa390('0x26'),_0xa390('0x27'),_0xa390('0x28'),'sms',_0xa390('0x29')];for(var _0x5a92bd=0x0;_0x5a92bd<_0x2aeb9f[_0xa390('0x2a')];_0x5a92bd+=0x1){var _0x506cac=this[_0xa390('0x2b')](_0x2aeb9f[_0x5a92bd]);if(this[_0x2aeb9f[_0x5a92bd]+_0xa390('0x2c')]!==_0x506cac){this[_0x2aeb9f[_0x5a92bd]+_0xa390('0x2d')]=_[_0xa390('0x2e')](moment()[_0xa390('0x2f')]('x'));}this[_0x2aeb9f[_0x5a92bd]+_0xa390('0x2c')]=_0x506cac;}var _0x55e360={'id':this['id'],'name':this['name'],'online':this[_0xa390('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xa390('0x9')],'mailPause':this[_0xa390('0xa')],'smsPause':this[_0xa390('0xc')],'faxPause':this[_0xa390('0xb')],'openchannelPause':this[_0xa390('0xd')],'chatStatus':this[_0xa390('0x30')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xa390('0x10')],'chatCurrentCapacity':this[_0xa390('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xa390('0x12')],'mailCapacity':this[_0xa390('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xa390('0x31')],'faxStatusTime':this[_0xa390('0x32')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xa390('0x16')],'smsStatus':this[_0xa390('0x17')],'smsStatusTime':this[_0xa390('0x18')],'smsCapacity':this[_0xa390('0x19')],'smsCurrentCapacity':this[_0xa390('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xa390('0x1c')],'whatsappCurrentCapacity':this[_0xa390('0x33')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa390('0x34')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xa390('0x35')],'busy':this[_0xa390('0x1f')],'busyQueue':this[_0xa390('0x20')]};var _0x23a12a=md5(JSON[_0xa390('0x36')](_0x55e360));if(this[_0xa390('0x2')]!==_0x23a12a){this[_0xa390('0x2')]=_0x23a12a;io[_0xa390('0x37')](_0xa390('0x38'),_0x55e360);}};module[_0xa390('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0b2dda7..f631096 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 _0xbde6=['prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','emit','chat_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime'];(function(_0x5a36ed,_0x24a410){var _0xe20881=function(_0x468566){while(--_0x468566){_0x5a36ed['push'](_0x5a36ed['shift']());}};_0xe20881(++_0x24a410);}(_0xbde6,0x15a));var _0x6bde=function(_0x1964b9,_0x2b7339){_0x1964b9=_0x1964b9-0x0;var _0x4f918b=_0xbde6[_0x1964b9];return _0x4f918b;};'use strict';var _=require(_0x6bde('0x0'));var md5=require('md5');var util=require(_0x6bde('0x1'));var Redis=require(_0x6bde('0x2'));var config=require('../../../config/environment');config[_0x6bde('0x3')]=_[_0x6bde('0x4')](config[_0x6bde('0x3')],{'host':_0x6bde('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x6f2864){this['id']=_0x6f2864['id']||0x0;this['name']=_0x6f2864[_0x6bde('0x6')]||'';this['timeout']=_0x6f2864[_0x6bde('0x7')]||0xa;this[_0x6bde('0x8')]=_0x6f2864['strategy']||_0x6bde('0x9');this[_0x6bde('0xa')]=_0x6f2864[_0x6bde('0xa')];this['mapAgentsId']={};this[_0x6bde('0xb')]=0x0;this['md5']='';this[_0x6bde('0xc')]();this[_0x6bde('0xd')]();}ChatQueue[_0x6bde('0xe')][_0x6bde('0xc')]=function(){var _0x45b933=this[_0x6bde('0xf')][_0x6bde('0x10')];this['mapAgentsId']=_[_0x6bde('0x11')](this['Agents'],'id');this[_0x6bde('0xf')][_0x6bde('0x10')]=_0x45b933;};ChatQueue[_0x6bde('0xe')][_0x6bde('0xd')]=function(){this[_0x6bde('0x12')]=0x0;this[_0x6bde('0x13')]=0x0;for(var _0x505a03=0x0;_0x505a03=0x0?this[_0x6bde('0x17')]:0x0;var _0x47f0ce={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6bde('0x12')],'name':this['name'],'paused':this[_0x6bde('0x13')],'waiting':this[_0x6bde('0xb')]};var _0x568a7c=md5(JSON[_0x6bde('0x18')](_0x47f0ce));if(this['md5']!==_0x568a7c){this[_0x6bde('0x19')]=_0x568a7c;io['to'](util[_0x6bde('0x1a')]('chat:queue:%s',_0x47f0ce['name']))[_0x6bde('0x1b')](_0x6bde('0x1c'),_0x47f0ce);}};module[_0x6bde('0x1d')]=ChatQueue; \ No newline at end of file +var _0x8f42=['localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x41d8f6,_0x320836){var _0x16bb8f=function(_0x272944){while(--_0x272944){_0x41d8f6['push'](_0x41d8f6['shift']());}};_0x16bb8f(++_0x320836);}(_0x8f42,0x1ae));var _0x28f4=function(_0x292434,_0x9a1d0e){_0x292434=_0x292434-0x0;var _0x3cce65=_0x8f42[_0x292434];return _0x3cce65;};'use strict';var _=require(_0x28f4('0x0'));var md5=require(_0x28f4('0x1'));var util=require(_0x28f4('0x2'));var Redis=require(_0x28f4('0x3'));var config=require('../../../config/environment');config[_0x28f4('0x4')]=_['defaults'](config[_0x28f4('0x4')],{'host':_0x28f4('0x5'),'port':0x18eb});var io=require(_0x28f4('0x6'))(new Redis(config[_0x28f4('0x4')]));function ChatQueue(_0x236c64){this['id']=_0x236c64['id']||0x0;this[_0x28f4('0x7')]=_0x236c64[_0x28f4('0x7')]||'';this[_0x28f4('0x8')]=_0x236c64['timeout']||0xa;this['strategy']=_0x236c64['strategy']||_0x28f4('0x9');this[_0x28f4('0xa')]=_0x236c64[_0x28f4('0xa')];this[_0x28f4('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x28f4('0xc')]();}ChatQueue[_0x28f4('0xd')][_0x28f4('0xe')]=function(){var _0x4cc19d=this['mapAgentsId'][_0x28f4('0xf')];this[_0x28f4('0xb')]=_[_0x28f4('0x10')](this[_0x28f4('0xa')],'id');this[_0x28f4('0xb')]['_rr']=_0x4cc19d;};ChatQueue[_0x28f4('0xd')][_0x28f4('0xc')]=function(){this[_0x28f4('0x11')]=0x0;this[_0x28f4('0x12')]=0x0;for(var _0x584a9a=0x0;_0x584a9a=0x0?this['available']:0x0;var _0x443bfc={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x28f4('0x12')],'waiting':this[_0x28f4('0x17')]};var _0x2e8e4c=md5(JSON['stringify'](_0x443bfc));if(this[_0x28f4('0x1')]!==_0x2e8e4c){this[_0x28f4('0x1')]=_0x2e8e4c;io['to'](util[_0x28f4('0x18')](_0x28f4('0x19'),_0x443bfc['name']))[_0x28f4('0x1a')](_0x28f4('0x1b'),_0x443bfc);}};module[_0x28f4('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6f678d8..2188785 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(_0x407cdd,_0x459b2f){var _0x271449=function(_0x56edaf){while(--_0x56edaf){_0x407cdd['push'](_0x407cdd['shift']());}};_0x271449(++_0x459b2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x1e723e,_0x319137){var _0x4edb9c=function(_0x180896){while(--_0x180896){_0x1e723e['push'](_0x1e723e['shift']());}};_0x4edb9c(++_0x319137);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 8bd6f38..c48acad 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 _0xde82=['Intervals','name'];(function(_0x158b28,_0x292083){var _0x4fa88e=function(_0x1a6e8a){while(--_0x1a6e8a){_0x158b28['push'](_0x158b28['shift']());}};_0x4fa88e(++_0x292083);}(_0xde82,0x91));var _0x2de8=function(_0x1e1254,_0xc0492a){_0x1e1254=_0x1e1254-0x0;var _0x34e473=_0xde82[_0x1e1254];return _0x34e473;};'use strict';function Interval(_0x4efe2b){this['id']=_0x4efe2b['id']||0x0;this[_0x2de8('0x0')]=_0x4efe2b[_0x2de8('0x0')]||'';this[_0x2de8('0x1')]=_0x4efe2b['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xa1b8=['exports','name','Intervals'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa1b8,0x163));var _0x8a1b=function(_0x42dcd6,_0x437b3a){_0x42dcd6=_0x42dcd6-0x0;var _0x5eadb1=_0xa1b8[_0x42dcd6];return _0x5eadb1;};'use strict';function Interval(_0xdb478f){this['id']=_0xdb478f['id']||0x0;this['name']=_0xdb478f[_0x8a1b('0x0')]||'';this[_0x8a1b('0x1')]=_0xdb478f[_0x8a1b('0x1')]||{};}module[_0x8a1b('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 588d7d7..126178d 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 _0xa2fa=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa2fa,0x95));var _0xaa2f=function(_0xc1e968,_0x4a8fc5){_0xc1e968=_0xc1e968-0x0;var _0x29de11=_0xa2fa[_0xc1e968];return _0x29de11;};'use strict';var _=require(_0xaa2f('0x0'));var md5=require(_0xaa2f('0x1'));var util=require(_0xaa2f('0x2'));var Redis=require(_0xaa2f('0x3'));var config=require(_0xaa2f('0x4'));config['redis']=_[_0xaa2f('0x5')](config[_0xaa2f('0x6')],{'host':_0xaa2f('0x7'),'port':0x18eb});var io=require(_0xaa2f('0x8'))(new Redis(config[_0xaa2f('0x6')]));function MailQueue(_0x28bb71){this['id']=_0x28bb71['id']||0x0;this['name']=_0x28bb71[_0xaa2f('0x9')]||'';this[_0xaa2f('0xa')]=_0x28bb71['timeout']||0xa;this[_0xaa2f('0xb')]=_0x28bb71[_0xaa2f('0xb')]||_0xaa2f('0xc');this[_0xaa2f('0xd')]=_0x28bb71[_0xaa2f('0xd')];this[_0xaa2f('0xe')]={};this[_0xaa2f('0xf')]=0x0;this[_0xaa2f('0x1')]='';this['updateRouting']();this[_0xaa2f('0x10')]();}MailQueue[_0xaa2f('0x11')][_0xaa2f('0x12')]=function(){var _0x336fed=this[_0xaa2f('0xe')][_0xaa2f('0x13')];this[_0xaa2f('0xe')]=_[_0xaa2f('0x14')](this[_0xaa2f('0xd')],'id');this[_0xaa2f('0xe')][_0xaa2f('0x13')]=_0x336fed;};MailQueue[_0xaa2f('0x11')]['updateRealtime']=function(){this[_0xaa2f('0x15')]=0x0;this[_0xaa2f('0x16')]=0x0;for(var _0x9a0e59=0x0;_0x9a0e59=0x0?this[_0xaa2f('0x1a')]:0x0;var _0x28359d={'id':this['id'],'available':this[_0xaa2f('0x1a')],'loggedIn':this[_0xaa2f('0x15')],'name':this[_0xaa2f('0x9')],'paused':this[_0xaa2f('0x16')],'waiting':this[_0xaa2f('0xf')]};var _0x2f65af=md5(JSON[_0xaa2f('0x1b')](_0x28359d));if(this[_0xaa2f('0x1')]!==_0x2f65af){this[_0xaa2f('0x1')]=_0x2f65af;io['to'](util['format'](_0xaa2f('0x1c'),_0x28359d[_0xaa2f('0x9')]))[_0xaa2f('0x1d')](_0xaa2f('0x1e'),_0x28359d);}};module['exports']=MailQueue; \ No newline at end of file +var _0x8bd6=['waiting','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','online','mailPause','paused','available'];(function(_0xc9a118,_0x15cd82){var _0x168d93=function(_0x18ace5){while(--_0x18ace5){_0xc9a118['push'](_0xc9a118['shift']());}};_0x168d93(++_0x15cd82);}(_0x8bd6,0x144));var _0x68bd=function(_0x234cc6,_0x2549a4){_0x234cc6=_0x234cc6-0x0;var _0x23c048=_0x8bd6[_0x234cc6];return _0x23c048;};'use strict';var _=require(_0x68bd('0x0'));var md5=require(_0x68bd('0x1'));var util=require(_0x68bd('0x2'));var Redis=require(_0x68bd('0x3'));var config=require(_0x68bd('0x4'));config[_0x68bd('0x5')]=_[_0x68bd('0x6')](config[_0x68bd('0x5')],{'host':_0x68bd('0x7'),'port':0x18eb});var io=require(_0x68bd('0x8'))(new Redis(config[_0x68bd('0x5')]));function MailQueue(_0x1206fe){this['id']=_0x1206fe['id']||0x0;this[_0x68bd('0x9')]=_0x1206fe[_0x68bd('0x9')]||'';this[_0x68bd('0xa')]=_0x1206fe[_0x68bd('0xa')]||0xa;this[_0x68bd('0xb')]=_0x1206fe[_0x68bd('0xb')]||'beepall';this['Agents']=_0x1206fe['Agents'];this[_0x68bd('0xc')]={};this['waiting']=0x0;this[_0x68bd('0x1')]='';this[_0x68bd('0xd')]();this[_0x68bd('0xe')]();}MailQueue[_0x68bd('0xf')][_0x68bd('0xd')]=function(){var _0x50b2c6=this[_0x68bd('0xc')][_0x68bd('0x10')];this[_0x68bd('0xc')]=_[_0x68bd('0x11')](this[_0x68bd('0x12')],'id');this[_0x68bd('0xc')]['_rr']=_0x50b2c6;};MailQueue[_0x68bd('0xf')][_0x68bd('0xe')]=function(){this[_0x68bd('0x13')]=0x0;this['paused']=0x0;for(var _0x3aa7c8=0x0;_0x3aa7c8=0x0?this['available']:0x0;var _0x1551f0={'id':this['id'],'available':this[_0x68bd('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x68bd('0x9')],'paused':this[_0x68bd('0x16')],'waiting':this[_0x68bd('0x18')]};var _0x422766=md5(JSON['stringify'](_0x1551f0));if(this[_0x68bd('0x1')]!==_0x422766){this[_0x68bd('0x1')]=_0x422766;io['to'](util[_0x68bd('0x19')](_0x68bd('0x1a'),_0x1551f0[_0x68bd('0x9')]))[_0x68bd('0x1b')](_0x68bd('0x1c'),_0x1551f0);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 60fe91f..dfa6fa8 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 _0x96e8=['prototype','_rr','map','loggedIn','paused','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1af1de,_0x595ad6){var _0x1d1738=function(_0x2c1569){while(--_0x2c1569){_0x1af1de['push'](_0x1af1de['shift']());}};_0x1d1738(++_0x595ad6);}(_0x96e8,0x68));var _0x896e=function(_0xd7b45a,_0x4fe0f0){_0xd7b45a=_0xd7b45a-0x0;var _0x16c83e=_0x96e8[_0xd7b45a];return _0x16c83e;};'use strict';var _=require(_0x896e('0x0'));var md5=require(_0x896e('0x1'));var util=require('util');var Redis=require(_0x896e('0x2'));var config=require(_0x896e('0x3'));config[_0x896e('0x4')]=_[_0x896e('0x5')](config[_0x896e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x896e('0x6'))(new Redis(config[_0x896e('0x4')]));function OpenchannelQueue(_0x5e70b3){this['id']=_0x5e70b3['id']||0x0;this[_0x896e('0x7')]=_0x5e70b3['name']||'';this[_0x896e('0x8')]=_0x5e70b3['timeout']||0xa;this[_0x896e('0x9')]=_0x5e70b3[_0x896e('0x9')]||_0x896e('0xa');this[_0x896e('0xb')]=_0x5e70b3[_0x896e('0xb')];this[_0x896e('0xc')]={};this[_0x896e('0xd')]=0x0;this[_0x896e('0x1')]='';this[_0x896e('0xe')]();this[_0x896e('0xf')]();}OpenchannelQueue[_0x896e('0x10')][_0x896e('0xe')]=function(){var _0x1d7143=this[_0x896e('0xc')][_0x896e('0x11')];this[_0x896e('0xc')]=_[_0x896e('0x12')](this[_0x896e('0xb')],'id');this[_0x896e('0xc')]['_rr']=_0x1d7143;};OpenchannelQueue[_0x896e('0x10')][_0x896e('0xf')]=function(){this[_0x896e('0x13')]=0x0;this[_0x896e('0x14')]=0x0;for(var _0xa406ae=0x0;_0xa406ae=0x0?this[_0x896e('0x17')]:0x0;var _0xcea723={'id':this['id'],'available':this[_0x896e('0x17')],'loggedIn':this[_0x896e('0x13')],'name':this[_0x896e('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x535301=md5(JSON[_0x896e('0x18')](_0xcea723));if(this['md5']!==_0x535301){this[_0x896e('0x1')]=_0x535301;io['to'](util[_0x896e('0x19')](_0x896e('0x1a'),_0xcea723[_0x896e('0x7')]))[_0x896e('0x1b')](_0x896e('0x1c'),_0xcea723);}};module[_0x896e('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x8f1e=['name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','openchannelPause','paused','available','waiting','stringify','format','openchannel:queue:%s','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x3c27df,_0xc6d32b){var _0x56f1f0=function(_0x2dfcd2){while(--_0x2dfcd2){_0x3c27df['push'](_0x3c27df['shift']());}};_0x56f1f0(++_0xc6d32b);}(_0x8f1e,0xfd));var _0xe8f1=function(_0x3ae642,_0x3c14cb){_0x3ae642=_0x3ae642-0x0;var _0x3e6417=_0x8f1e[_0x3ae642];return _0x3e6417;};'use strict';var _=require(_0xe8f1('0x0'));var md5=require(_0xe8f1('0x1'));var util=require(_0xe8f1('0x2'));var Redis=require(_0xe8f1('0x3'));var config=require(_0xe8f1('0x4'));config[_0xe8f1('0x5')]=_[_0xe8f1('0x6')](config[_0xe8f1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe8f1('0x7'))(new Redis(config['redis']));function OpenchannelQueue(_0x844a7e){this['id']=_0x844a7e['id']||0x0;this[_0xe8f1('0x8')]=_0x844a7e[_0xe8f1('0x8')]||'';this[_0xe8f1('0x9')]=_0x844a7e[_0xe8f1('0x9')]||0xa;this['strategy']=_0x844a7e[_0xe8f1('0xa')]||_0xe8f1('0xb');this[_0xe8f1('0xc')]=_0x844a7e[_0xe8f1('0xc')];this[_0xe8f1('0xd')]={};this['waiting']=0x0;this[_0xe8f1('0x1')]='';this[_0xe8f1('0xe')]();this[_0xe8f1('0xf')]();}OpenchannelQueue[_0xe8f1('0x10')][_0xe8f1('0xe')]=function(){var _0x207b41=this[_0xe8f1('0xd')][_0xe8f1('0x11')];this[_0xe8f1('0xd')]=_[_0xe8f1('0x12')](this[_0xe8f1('0xc')],'id');this['mapAgentsId'][_0xe8f1('0x11')]=_0x207b41;};OpenchannelQueue[_0xe8f1('0x10')]['updateRealtime']=function(){this[_0xe8f1('0x13')]=0x0;this['paused']=0x0;for(var _0x4798db=0x0;_0x4798db=0x0?this[_0xe8f1('0x17')]:0x0;var _0x304700={'id':this['id'],'available':this[_0xe8f1('0x17')],'loggedIn':this[_0xe8f1('0x13')],'name':this[_0xe8f1('0x8')],'paused':this[_0xe8f1('0x16')],'waiting':this[_0xe8f1('0x18')]};var _0x41707a=md5(JSON[_0xe8f1('0x19')](_0x304700));if(this[_0xe8f1('0x1')]!==_0x41707a){this[_0xe8f1('0x1')]=_0x41707a;io['to'](util[_0xe8f1('0x1a')](_0xe8f1('0x1b'),_0x304700[_0xe8f1('0x8')]))['emit'](_0xe8f1('0x1c'),_0x304700);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e8ed87f..709e39e 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x5c8dc8,_0x5c9989){var _0xfb512d=function(_0x4cdb27){while(--_0x4cdb27){_0x5c8dc8['push'](_0x5c8dc8['shift']());}};_0xfb512d(++_0x5c9989);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _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(_0x2ba902,_0x83aa4e){var _0x16f6b0=function(_0x23c65e){while(--_0x23c65e){_0x2ba902['push'](_0x2ba902['shift']());}};_0x16f6b0(++_0x83aa4e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index db842d2..3397e99 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 _0xcaea=['beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','util','ioredis','defaults','redis','localhost','name','timeout','strategy'];(function(_0x69ea92,_0x14506b){var _0x45b8ea=function(_0x2a33c0){while(--_0x2a33c0){_0x69ea92['push'](_0x69ea92['shift']());}};_0x45b8ea(++_0x14506b);}(_0xcaea,0x74));var _0xacae=function(_0xd2b73b,_0x9e4e0){_0xd2b73b=_0xd2b73b-0x0;var _0x214f40=_0xcaea[_0xd2b73b];return _0x214f40;};'use strict';var _=require('lodash');var md5=require(_0xacae('0x0'));var util=require(_0xacae('0x1'));var Redis=require(_0xacae('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xacae('0x3')](config[_0xacae('0x4')],{'host':_0xacae('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xacae('0x4')]));function WhatsappQueue(_0x291af0){this['id']=_0x291af0['id']||0x0;this['name']=_0x291af0[_0xacae('0x6')]||'';this[_0xacae('0x7')]=_0x291af0[_0xacae('0x7')]||0xa;this['strategy']=_0x291af0[_0xacae('0x8')]||_0xacae('0x9');this[_0xacae('0xa')]=_0x291af0[_0xacae('0xa')];this[_0xacae('0xb')]={};this[_0xacae('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xacae('0xd')]();}WhatsappQueue[_0xacae('0xe')]['updateRouting']=function(){var _0x259166=this[_0xacae('0xb')]['_rr'];this[_0xacae('0xb')]=_['map'](this[_0xacae('0xa')],'id');this[_0xacae('0xb')][_0xacae('0xf')]=_0x259166;};WhatsappQueue[_0xacae('0xe')][_0xacae('0xd')]=function(){this[_0xacae('0x10')]=0x0;this[_0xacae('0x11')]=0x0;for(var _0x489b87=0x0;_0x489b87=0x0?this[_0xacae('0x13')]:0x0;var _0x447760={'id':this['id'],'available':this[_0xacae('0x13')],'loggedIn':this[_0xacae('0x10')],'name':this[_0xacae('0x6')],'paused':this[_0xacae('0x11')],'waiting':this[_0xacae('0xc')]};var _0x4b3399=md5(JSON[_0xacae('0x14')](_0x447760));if(this['md5']!==_0x4b3399){this['md5']=_0x4b3399;io['to'](util[_0xacae('0x15')](_0xacae('0x16'),_0x447760[_0xacae('0x6')]))[_0xacae('0x17')](_0xacae('0x18'),_0x447760);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x6de9=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x6de9,0x191));var _0x96de=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6de9[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x96de('0x0'));var md5=require(_0x96de('0x1'));var util=require('util');var Redis=require(_0x96de('0x2'));var config=require(_0x96de('0x3'));config[_0x96de('0x4')]=_[_0x96de('0x5')](config[_0x96de('0x4')],{'host':_0x96de('0x6'),'port':0x18eb});var io=require(_0x96de('0x7'))(new Redis(config[_0x96de('0x4')]));function WhatsappQueue(_0x18a6f2){this['id']=_0x18a6f2['id']||0x0;this[_0x96de('0x8')]=_0x18a6f2['name']||'';this[_0x96de('0x9')]=_0x18a6f2[_0x96de('0x9')]||0xa;this['strategy']=_0x18a6f2[_0x96de('0xa')]||_0x96de('0xb');this[_0x96de('0xc')]=_0x18a6f2[_0x96de('0xc')];this['mapAgentsId']={};this[_0x96de('0xd')]=0x0;this[_0x96de('0x1')]='';this['updateRouting']();this[_0x96de('0xe')]();}WhatsappQueue[_0x96de('0xf')]['updateRouting']=function(){var _0xab73f3=this[_0x96de('0x10')]['_rr'];this['mapAgentsId']=_[_0x96de('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x96de('0x12')]=_0xab73f3;};WhatsappQueue[_0x96de('0xf')][_0x96de('0xe')]=function(){this[_0x96de('0x13')]=0x0;this[_0x96de('0x14')]=0x0;for(var _0x414c8f=0x0;_0x414c8f=0x0?this['available']:0x0;var _0x48de62={'id':this['id'],'available':this[_0x96de('0x18')],'loggedIn':this[_0x96de('0x13')],'name':this[_0x96de('0x8')],'paused':this[_0x96de('0x14')],'waiting':this[_0x96de('0xd')]};var _0x57cf7b=md5(JSON['stringify'](_0x48de62));if(this[_0x96de('0x1')]!==_0x57cf7b){this[_0x96de('0x1')]=_0x57cf7b;io['to'](util[_0x96de('0x19')](_0x96de('0x1a'),_0x48de62['name']))[_0x96de('0x1b')]('whatsapp_queue:save',_0x48de62);}};module[_0x96de('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4ea3c7f..f13354e 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 _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x137ab9,_0x27999a){_0x137ab9=_0x137ab9-0x0;var _0x3e16ae=_0x8ef6[_0x137ab9];return _0x3e16ae;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file +var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x466b5a,_0x4ec46b){var _0x3017bb=function(_0x26a116){while(--_0x26a116){_0x466b5a['push'](_0x466b5a['shift']());}};_0x3017bb(++_0x4ec46b);}(_0xa41a,0x6b));var _0xaa41=function(_0x3784f6,_0x711e5f){_0x3784f6=_0x3784f6-0x0;var _0x34a580=_0xa41a[_0x3784f6];return _0x34a580;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index da3a35d..58bc6f7 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 _0x3fd8=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0xcc79e7,_0x11cbae){var _0x49f078=function(_0x471d71){while(--_0x471d71){_0xcc79e7['push'](_0xcc79e7['shift']());}};_0x49f078(++_0x11cbae);}(_0x3fd8,0xd9));var _0x83fd=function(_0x47f10e,_0x17019d){_0x47f10e=_0x47f10e-0x0;var _0x512315=_0x3fd8[_0x47f10e];return _0x512315;};'use strict';var client=require(_0x83fd('0x0'));exports[_0x83fd('0x1')]=function(_0x2bdf3b,_0x2c04be){return client[_0x83fd('0x2')](_0x83fd('0x3'),{'body':_0x2c04be,'options':{'where':{'id':_0x2bdf3b}},'log':_0x83fd('0x4')});};exports[_0x83fd('0x5')]=function(_0xc69bf7,_0x3a98c6){return client[_0x83fd('0x2')]('AddTagsToChatInteraction',{'body':_0x3a98c6,'options':{'where':{'id':_0xc69bf7}},'log':_0x83fd('0x6')});}; \ No newline at end of file +var _0x8a61=['addTags','Request','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x3e682d,_0x1870a5){var _0x156869=function(_0x4e622f){while(--_0x4e622f){_0x3e682d['push'](_0x3e682d['shift']());}};_0x156869(++_0x1870a5);}(_0x8a61,0x1d7));var _0x18a6=function(_0x38d4cc,_0x1ebdda){_0x38d4cc=_0x38d4cc-0x0;var _0x4cd150=_0x8a61[_0x38d4cc];return _0x4cd150;};'use strict';var client=require(_0x18a6('0x0'));exports[_0x18a6('0x1')]=function(_0x4e1cb2,_0x36ec64){return client['Request'](_0x18a6('0x2'),{'body':_0x36ec64,'options':{'where':{'id':_0x4e1cb2}},'log':'updateChatInteraction'});};exports[_0x18a6('0x3')]=function(_0x3b7222,_0x52a847){return client[_0x18a6('0x4')]('AddTagsToChatInteraction',{'body':_0x52a847,'options':{'where':{'id':_0x3b7222}},'log':_0x18a6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b551c22..5223eea 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 _0x42dd=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x42dd,0x95));var _0xd42d=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x42dd[_0x341e0f];return _0x59555a;};'use strict';var client=require(_0xd42d('0x0'));exports[_0xd42d('0x1')]=function(_0x12a3bc){return client[_0xd42d('0x2')](_0xd42d('0x3'),{'body':_0x12a3bc,'log':_0xd42d('0x4')});}; \ No newline at end of file +var _0x200c=['create','Request','CreateChatMessage','../client'];(function(_0x1fc430,_0x783dc8){var _0x463a73=function(_0x3aac5b){while(--_0x3aac5b){_0x1fc430['push'](_0x1fc430['shift']());}};_0x463a73(++_0x783dc8);}(_0x200c,0x153));var _0xc200=function(_0x5678c5,_0xd93998){_0x5678c5=_0x5678c5-0x0;var _0x4d0602=_0x200c[_0x5678c5];return _0x4d0602;};'use strict';var client=require(_0xc200('0x0'));exports[_0xc200('0x1')]=function(_0x213b82){return client[_0xc200('0x2')](_0xc200('0x3'),{'body':_0x213b82,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 94599fb..d42f6f0 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 _0x4378=['online','getChatQueues','GetChatQueue','name','User'];(function(_0x54648e,_0x465f8d){var _0x36418c=function(_0x22d319){while(--_0x22d319){_0x54648e['push'](_0x54648e['shift']());}};_0x36418c(++_0x465f8d);}(_0x4378,0x8d));var _0x8437=function(_0x1d9fd2,_0x2d6e67){_0x1d9fd2=_0x1d9fd2-0x0;var _0x4a168b=_0x4378[_0x1d9fd2];return _0x4a168b;};'use strict';var client=require('../client');exports[_0x8437('0x0')]=function(){return function(){return client['Request'](_0x8437('0x1'),{'options':{'raw':![],'attributes':['id',_0x8437('0x2'),'timeout','strategy'],'include':[{'model':_0x8437('0x3'),'as':'Agents','attributes':['id',_0x8437('0x2'),_0x8437('0x4'),'chatPause']}]},'log':_0x8437('0x0')});};}; \ No newline at end of file +var _0x8001=['Agents','online','chatPause','../client','Request','GetChatQueue','name','timeout','User'];(function(_0x36bf46,_0x431548){var _0xe34422=function(_0x2295c4){while(--_0x2295c4){_0x36bf46['push'](_0x36bf46['shift']());}};_0xe34422(++_0x431548);}(_0x8001,0x1d7));var _0x1800=function(_0x4c4b7a,_0x4bf299){_0x4c4b7a=_0x4c4b7a-0x0;var _0x204d99=_0x8001[_0x4c4b7a];return _0x204d99;};'use strict';var client=require(_0x1800('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x1800('0x1')](_0x1800('0x2'),{'options':{'raw':![],'attributes':['id',_0x1800('0x3'),_0x1800('0x4'),'strategy'],'include':[{'model':_0x1800('0x5'),'as':_0x1800('0x6'),'attributes':['id',_0x1800('0x3'),_0x1800('0x7'),_0x1800('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index fce201f..c5f7390 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 _0x7a2c=['UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update','DESC'];(function(_0x26bc98,_0x231708){var _0x5314d6=function(_0xabbfaa){while(--_0xabbfaa){_0x26bc98['push'](_0x26bc98['shift']());}};_0x5314d6(++_0x231708);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x363a65,_0x4f3c9e){_0x363a65=_0x363a65-0x0;var _0x215ba4=_0x7a2c[_0x363a65];return _0x215ba4;};'use strict';var client=require(_0xc7a2('0x0'));exports['create']=function(_0x1bb849){return client[_0xc7a2('0x1')](_0xc7a2('0x2'),{'body':_0x1bb849,'log':_0xc7a2('0x2')});};exports[_0xc7a2('0x3')]=function(_0x2abba8,_0x3f2b0d){return client[_0xc7a2('0x1')]('UpdateChatQueueReport',{'body':_0x3f2b0d,'options':{'where':{'uniqueid':_0x2abba8},'order':[['id',_0xc7a2('0x4')]],'limit':0x1},'log':_0xc7a2('0x5')});}; \ No newline at end of file +var _0x303a=['DESC','../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x273177,_0x525aa8){var _0x466751=function(_0xd8c89a){while(--_0xd8c89a){_0x273177['push'](_0x273177['shift']());}};_0x466751(++_0x525aa8);}(_0x303a,0x1a0));var _0xa303=function(_0xd5fd5c,_0x3e2a66){_0xd5fd5c=_0xd5fd5c-0x0;var _0x3b0663=_0x303a[_0xd5fd5c];return _0x3b0663;};'use strict';var client=require(_0xa303('0x0'));exports['create']=function(_0x387608){return client[_0xa303('0x1')](_0xa303('0x2'),{'body':_0x387608,'log':_0xa303('0x2')});};exports['update']=function(_0x46c56b,_0x26b47c){return client[_0xa303('0x1')](_0xa303('0x3'),{'body':_0x26b47c,'options':{'where':{'uniqueid':_0x46c56b},'order':[['id',_0xa303('0x4')]],'limit':0x1},'log':_0xa303('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2e10541..ed95a94 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 _0x958e=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x2ac7ac,_0x119b8a){var _0x24429b=function(_0x1162f4){while(--_0x1162f4){_0x2ac7ac['push'](_0x2ac7ac['shift']());}};_0x24429b(++_0x119b8a);}(_0x958e,0x16d));var _0xe958=function(_0x131f9c,_0x79d26a){_0x131f9c=_0x131f9c-0x0;var _0x3ee17b=_0x958e[_0x131f9c];return _0x3ee17b;};'use strict';var client=require(_0xe958('0x0'));exports[_0xe958('0x1')]=function(_0x529c00,_0x128166){return client['Request'](_0xe958('0x2'),{'body':_0x128166,'options':{'where':{'id':_0x529c00}},'log':_0xe958('0x3')});};exports[_0xe958('0x4')]=function(_0x25a221,_0x23db4c){return client[_0xe958('0x5')](_0xe958('0x6'),{'body':_0x23db4c,'options':{'where':{'id':_0x25a221}},'log':_0xe958('0x7')});}; \ No newline at end of file +var _0x6dfc=['update','updateFaxInteraction','addTags','Request','addTagsToFaxInteraction'];(function(_0x5b1534,_0x3506f5){var _0x2d559a=function(_0x4bbb22){while(--_0x4bbb22){_0x5b1534['push'](_0x5b1534['shift']());}};_0x2d559a(++_0x3506f5);}(_0x6dfc,0xeb));var _0xc6df=function(_0x52285a,_0x4392e2){_0x52285a=_0x52285a-0x0;var _0x22417c=_0x6dfc[_0x52285a];return _0x22417c;};'use strict';var client=require('../client');exports[_0xc6df('0x0')]=function(_0x27509a,_0x285e2c){return client['Request']('UpdateFaxInteraction',{'body':_0x285e2c,'options':{'where':{'id':_0x27509a}},'log':_0xc6df('0x1')});};exports[_0xc6df('0x2')]=function(_0x65b7cd,_0x22a880){return client[_0xc6df('0x3')]('AddTagsToFaxInteraction',{'body':_0x22a880,'options':{'where':{'id':_0x65b7cd}},'log':_0xc6df('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index adf3f81..c0e748d 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 _0x7e03=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x7e03,0x96));var _0x37e0=function(_0x55ad7c,_0x3f6e9d){_0x55ad7c=_0x55ad7c-0x0;var _0xeffaba=_0x7e03[_0x55ad7c];return _0xeffaba;};'use strict';var client=require(_0x37e0('0x0'));exports[_0x37e0('0x1')]=function(_0xdac586){return client[_0x37e0('0x2')](_0x37e0('0x3'),{'body':_0xdac586,'log':_0x37e0('0x4')});}; \ No newline at end of file +var _0xbfd9=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0xbfd9,0xdc));var _0x9bfd=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xbfd9[_0x33032e];return _0x13316b;};'use strict';var client=require(_0x9bfd('0x0'));exports['create']=function(_0x191535){return client[_0x9bfd('0x1')](_0x9bfd('0x2'),{'body':_0x191535,'log':_0x9bfd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 05ff531..b5f0bef 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 _0xc0cb=['Agents','faxPause','getFaxQueues','../client','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x24d2ea,_0x1c798a){var _0x41e5d8=function(_0x34ac1d){while(--_0x34ac1d){_0x24d2ea['push'](_0x24d2ea['shift']());}};_0x41e5d8(++_0x1c798a);}(_0xc0cb,0xc0));var _0xbc0c=function(_0x30e979,_0x554b01){_0x30e979=_0x30e979-0x0;var _0x523983=_0xc0cb[_0x30e979];return _0x523983;};'use strict';var client=require(_0xbc0c('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xbc0c('0x1')](_0xbc0c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbc0c('0x3'),_0xbc0c('0x4')],'include':[{'model':_0xbc0c('0x5'),'as':_0xbc0c('0x6'),'attributes':['id','name','online',_0xbc0c('0x7')]}]},'log':_0xbc0c('0x8')});};}; \ No newline at end of file +var _0xa68b=['Agents','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x3cf150,_0x178cb5){var _0x931f8b=function(_0x40a693){while(--_0x40a693){_0x3cf150['push'](_0x3cf150['shift']());}};_0x931f8b(++_0x178cb5);}(_0xa68b,0x17b));var _0xba68=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xa68b[_0x5c6994];return _0x1d5c84;};'use strict';var client=require(_0xba68('0x0'));exports[_0xba68('0x1')]=function(){return function(){return client[_0xba68('0x2')](_0xba68('0x3'),{'options':{'raw':![],'attributes':['id',_0xba68('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0xba68('0x5'),'attributes':['id','name','online','faxPause']}]},'log':_0xba68('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 18eeca0..12ad3e5 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 _0xef8b=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x4ab702,_0x2ab5f0){var _0x50ab0f=function(_0x207906){while(--_0x207906){_0x4ab702['push'](_0x4ab702['shift']());}};_0x50ab0f(++_0x2ab5f0);}(_0xef8b,0x192));var _0xbef8=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0xef8b[_0x156a77];return _0x32398a;};'use strict';var client=require('../client');exports[_0xbef8('0x0')]=function(_0x2c70dc){return client[_0xbef8('0x1')](_0xbef8('0x2'),{'body':_0x2c70dc,'log':_0xbef8('0x2')});};exports[_0xbef8('0x3')]=function(_0x336519,_0x224dd2){return client[_0xbef8('0x1')](_0xbef8('0x4'),{'body':_0x224dd2,'options':{'where':{'uniqueid':_0x336519},'order':[['id',_0xbef8('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xfa27=['UpdateFaxQueueReport','DESC','Request','update'];(function(_0x2ac6de,_0x4e7563){var _0x2834ff=function(_0xf89bcc){while(--_0xf89bcc){_0x2ac6de['push'](_0x2ac6de['shift']());}};_0x2834ff(++_0x4e7563);}(_0xfa27,0x1b2));var _0x7fa2=function(_0x2ddc2a,_0x5654b9){_0x2ddc2a=_0x2ddc2a-0x0;var _0x513fcb=_0xfa27[_0x2ddc2a];return _0x513fcb;};'use strict';var client=require('../client');exports['create']=function(_0x26c4d5){return client[_0x7fa2('0x0')]('CreateFaxQueueReport',{'body':_0x26c4d5,'log':'CreateFaxQueueReport'});};exports[_0x7fa2('0x1')]=function(_0x56d898,_0x1d0ad1){return client[_0x7fa2('0x0')](_0x7fa2('0x2'),{'body':_0x1d0ad1,'options':{'where':{'uniqueid':_0x56d898},'order':[['id',_0x7fa2('0x3')]],'limit':0x1},'log':_0x7fa2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 0dfffc7..443394e 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 _0x793b=['GetInterval','name','Intervals','../client','getIntervals','Request'];(function(_0x15ce40,_0x3df9af){var _0xedf0d9=function(_0x37a96a){while(--_0x37a96a){_0x15ce40['push'](_0x15ce40['shift']());}};_0xedf0d9(++_0x3df9af);}(_0x793b,0x189));var _0xb793=function(_0x20d323,_0x3c98cd){_0x20d323=_0x20d323-0x0;var _0x32352c=_0x793b[_0x20d323];return _0x32352c;};'use strict';var client=require(_0xb793('0x0'));exports[_0xb793('0x1')]=function(){return function(){return client[_0xb793('0x2')](_0xb793('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb793('0x4')],'include':[{'model':'Interval','as':_0xb793('0x5'),'attributes':['id',_0xb793('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x1eba=['GetInterval','name','interval','../client','getIntervals','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x1eba[_0x39bc44];return _0x2916d8;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(){return function(){return client[_0xa1eb('0x2')](_0xa1eb('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa1eb('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa1eb('0x4'),_0xa1eb('0x5')]}]},'log':_0xa1eb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ab8f7ff..b65ee2b 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 _0x5b98=['Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x3bfe61,_0x2ac258){var _0x63964c=function(_0x59ce33){while(--_0x59ce33){_0x3bfe61['push'](_0x3bfe61['shift']());}};_0x63964c(++_0x2ac258);}(_0x5b98,0xb3));var _0x85b9=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x5b98[_0x1d87fc];return _0x492b56;};'use strict';var client=require(_0x85b9('0x0'));exports['update']=function(_0x20bf8e,_0x51bc91){return client[_0x85b9('0x1')](_0x85b9('0x2'),{'body':_0x51bc91,'options':{'where':{'id':_0x20bf8e}},'log':_0x85b9('0x3')});};exports['addTags']=function(_0x232a3,_0x463e50){return client[_0x85b9('0x1')](_0x85b9('0x4'),{'body':_0x463e50,'options':{'where':{'id':_0x232a3}},'log':_0x85b9('0x5')});}; \ No newline at end of file +var _0x424e=['Request','UpdateMailInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0x424e,0xb8));var _0xe424=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x424e[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require('../client');exports[_0xe424('0x0')]=function(_0x598f0b,_0xb4a2be){return client[_0xe424('0x1')](_0xe424('0x2'),{'body':_0xb4a2be,'options':{'where':{'id':_0x598f0b}},'log':'updateMailInteraction'});};exports[_0xe424('0x3')]=function(_0x374882,_0x5490e1){return client[_0xe424('0x1')]('AddTagsToMailInteraction',{'body':_0x5490e1,'options':{'where':{'id':_0x374882}},'log':_0xe424('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 234dfb3..b3f5ed5 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 _0x8f8e=['Request','CreateMailMessage','../client','create'];(function(_0x19694c,_0x472a1d){var _0x27a528=function(_0x6067c6){while(--_0x6067c6){_0x19694c['push'](_0x19694c['shift']());}};_0x27a528(++_0x472a1d);}(_0x8f8e,0x66));var _0xe8f8=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x8f8e[_0x47a349];return _0x18ab75;};'use strict';var client=require(_0xe8f8('0x0'));exports[_0xe8f8('0x1')]=function(_0xce40e2){return client[_0xe8f8('0x2')](_0xe8f8('0x3'),{'body':_0xce40e2,'log':'createMailMessage'});}; \ No newline at end of file +var _0x7597=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x9aac9c,_0x333dc6){var _0x2f25ec=function(_0x1ac211){while(--_0x1ac211){_0x9aac9c['push'](_0x9aac9c['shift']());}};_0x2f25ec(++_0x333dc6);}(_0x7597,0x13d));var _0x7759=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x7597[_0x82129b];return _0x2ae5dc;};'use strict';var client=require('../client');exports[_0x7759('0x0')]=function(_0x4e4055){return client[_0x7759('0x1')](_0x7759('0x2'),{'body':_0x4e4055,'log':_0x7759('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e3532c0..93d2e2c 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 _0x9cfa=['Request','GetMailQueue','name','timeout','strategy','Agents','mailPause','../client','getMailQueues'];(function(_0x4ce025,_0x8b7eb0){var _0x1116ab=function(_0x4a6959){while(--_0x4a6959){_0x4ce025['push'](_0x4ce025['shift']());}};_0x1116ab(++_0x8b7eb0);}(_0x9cfa,0x6a));var _0xa9cf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9cfa[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xa9cf('0x0'));exports[_0xa9cf('0x1')]=function(){return function(){return client[_0xa9cf('0x2')](_0xa9cf('0x3'),{'options':{'raw':![],'attributes':['id',_0xa9cf('0x4'),_0xa9cf('0x5'),_0xa9cf('0x6')],'include':[{'model':'User','as':_0xa9cf('0x7'),'attributes':['id',_0xa9cf('0x4'),'online',_0xa9cf('0x8')]}]},'log':_0xa9cf('0x1')});};}; \ No newline at end of file +var _0x2463=['strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue','name','timeout'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0x2463,0x9b));var _0x3246=function(_0x3a041f,_0x1c2e64){_0x3a041f=_0x3a041f-0x0;var _0xbdf5a=_0x2463[_0x3a041f];return _0xbdf5a;};'use strict';var client=require(_0x3246('0x0'));exports[_0x3246('0x1')]=function(){return function(){return client['Request'](_0x3246('0x2'),{'options':{'raw':![],'attributes':['id',_0x3246('0x3'),_0x3246('0x4'),_0x3246('0x5')],'include':[{'model':_0x3246('0x6'),'as':_0x3246('0x7'),'attributes':['id',_0x3246('0x3'),_0x3246('0x8'),_0x3246('0x9')]}]},'log':_0x3246('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 687cd77..17a6645 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 _0x3ef4=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ef4,0x164));var _0x43ef=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x3ef4[_0x101134];return _0xc47acc;};'use strict';var client=require(_0x43ef('0x0'));exports[_0x43ef('0x1')]=function(_0x25ca4f){return client[_0x43ef('0x2')](_0x43ef('0x3'),{'body':_0x25ca4f,'log':_0x43ef('0x3')});};exports[_0x43ef('0x4')]=function(_0x3e7555,_0x21d434){return client[_0x43ef('0x2')](_0x43ef('0x5'),{'body':_0x21d434,'options':{'where':{'uniqueid':_0x3e7555},'order':[['id',_0x43ef('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xff7d=['../client','CreateMailQueueReport','Request','UpdateMailQueueReport','DESC'];(function(_0x22bfb8,_0x3f40ae){var _0x3e6fda=function(_0x53cdc8){while(--_0x53cdc8){_0x22bfb8['push'](_0x22bfb8['shift']());}};_0x3e6fda(++_0x3f40ae);}(_0xff7d,0x12c));var _0xdff7=function(_0x398c88,_0x104928){_0x398c88=_0x398c88-0x0;var _0x3f3438=_0xff7d[_0x398c88];return _0x3f3438;};'use strict';var client=require(_0xdff7('0x0'));exports['create']=function(_0x4d8b4b){return client['Request']('CreateMailQueueReport',{'body':_0x4d8b4b,'log':_0xdff7('0x1')});};exports['update']=function(_0x4ce926,_0x267bed){return client[_0xdff7('0x2')](_0xdff7('0x3'),{'body':_0x267bed,'options':{'where':{'uniqueid':_0x4ce926},'order':[['id',_0xdff7('0x4')]],'limit':0x1},'log':_0xdff7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d22d78c..a489e00 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 _0x2232=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x2232,0x68));var _0x2223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2232[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2223('0x0'));exports[_0x2223('0x1')]=function(_0x16b0a2,_0x43cc13){return client[_0x2223('0x2')](_0x2223('0x3'),{'body':_0x43cc13,'options':{'where':{'id':_0x16b0a2}},'log':_0x2223('0x4')});};exports[_0x2223('0x5')]=function(_0x988370,_0x5cc654){return client[_0x2223('0x2')](_0x2223('0x6'),{'body':_0x5cc654,'options':{'where':{'id':_0x988370}},'log':_0x2223('0x7')});}; \ No newline at end of file +var _0x0600=['../client','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0600,0x78));var _0x0060=function(_0x57bb3a,_0x237ede){_0x57bb3a=_0x57bb3a-0x0;var _0x5decaa=_0x0600[_0x57bb3a];return _0x5decaa;};'use strict';var client=require(_0x0060('0x0'));exports['update']=function(_0x309b84,_0x1ce822){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x1ce822,'options':{'where':{'id':_0x309b84}},'log':_0x0060('0x1')});};exports[_0x0060('0x2')]=function(_0x434281,_0x20b032){return client[_0x0060('0x3')](_0x0060('0x4'),{'body':_0x20b032,'options':{'where':{'id':_0x434281}},'log':_0x0060('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4e510f0..fc6bf90 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(_0x104dc6,_0x2d7cee){var _0x2a8742=function(_0xbc2f07){while(--_0xbc2f07){_0x104dc6['push'](_0x104dc6['shift']());}};_0x2a8742(++_0x2d7cee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xcb91[_0x25a42a];return _0x1129b1;};'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 _0x9f62=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x208527,_0x3c23e6){var _0x51f933=function(_0x137472){while(--_0x137472){_0x208527['push'](_0x208527['shift']());}};_0x51f933(++_0x3c23e6);}(_0x9f62,0x154));var _0x29f6=function(_0x11f68e,_0x4e0696){_0x11f68e=_0x11f68e-0x0;var _0x4eb26b=_0x9f62[_0x11f68e];return _0x4eb26b;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0x4ce7cb,'log':_0x29f6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 9b58eac..eef62da 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 _0x8747=['timeout','strategy','User','Agents','name','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x25a45a,_0x156e4b){var _0x237f87=function(_0x17c9e5){while(--_0x17c9e5){_0x25a45a['push'](_0x25a45a['shift']());}};_0x237f87(++_0x156e4b);}(_0x8747,0x1ed));var _0x7874=function(_0x177e72,_0x28bf32){_0x177e72=_0x177e72-0x0;var _0x392698=_0x8747[_0x177e72];return _0x392698;};'use strict';var client=require(_0x7874('0x0'));exports[_0x7874('0x1')]=function(){return function(){return client['Request'](_0x7874('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7874('0x3'),_0x7874('0x4')],'include':[{'model':_0x7874('0x5'),'as':_0x7874('0x6'),'attributes':['id',_0x7874('0x7'),'online','openchannelPause']}]},'log':_0x7874('0x1')});};}; \ No newline at end of file +var _0x1d43=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','online'];(function(_0xce0cd3,_0x4a9599){var _0x3561da=function(_0x1b85a9){while(--_0x1b85a9){_0xce0cd3['push'](_0xce0cd3['shift']());}};_0x3561da(++_0x4a9599);}(_0x1d43,0x118));var _0x31d4=function(_0x1a8c21,_0xb5fc11){_0x1a8c21=_0x1a8c21-0x0;var _0x1ebd0e=_0x1d43[_0x1a8c21];return _0x1ebd0e;};'use strict';var client=require(_0x31d4('0x0'));exports[_0x31d4('0x1')]=function(){return function(){return client[_0x31d4('0x2')](_0x31d4('0x3'),{'options':{'raw':![],'attributes':['id',_0x31d4('0x4'),'timeout',_0x31d4('0x5')],'include':[{'model':_0x31d4('0x6'),'as':'Agents','attributes':['id',_0x31d4('0x4'),_0x31d4('0x7'),_0x31d4('0x8')]}]},'log':_0x31d4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 67dfe2a..1626e30 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 _0x8db8=['UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x4dd11a,_0x5517d7){var _0x366497=function(_0x39af92){while(--_0x39af92){_0x4dd11a['push'](_0x4dd11a['shift']());}};_0x366497(++_0x5517d7);}(_0x8db8,0xda));var _0x88db=function(_0x159d7,_0x5b9c30){_0x159d7=_0x159d7-0x0;var _0xdd4d9d=_0x8db8[_0x159d7];return _0xdd4d9d;};'use strict';var client=require(_0x88db('0x0'));exports[_0x88db('0x1')]=function(_0x5c4cc8){return client['Request'](_0x88db('0x2'),{'body':_0x5c4cc8,'log':_0x88db('0x2')});};exports[_0x88db('0x3')]=function(_0x25e729,_0x33a640){return client['Request'](_0x88db('0x4'),{'body':_0x33a640,'options':{'where':{'uniqueid':_0x25e729},'order':[['id',_0x88db('0x5')]],'limit':0x1},'log':_0x88db('0x4')});}; \ No newline at end of file +var _0xc585=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc585,0x157));var _0x5c58=function(_0x5f3408,_0x1a7929){_0x5f3408=_0x5f3408-0x0;var _0x1a8817=_0xc585[_0x5f3408];return _0x1a8817;};'use strict';var client=require(_0x5c58('0x0'));exports[_0x5c58('0x1')]=function(_0x500016){return client[_0x5c58('0x2')](_0x5c58('0x3'),{'body':_0x500016,'log':_0x5c58('0x3')});};exports[_0x5c58('0x4')]=function(_0x244e71,_0x5f9258){return client[_0x5c58('0x2')](_0x5c58('0x5'),{'body':_0x5f9258,'options':{'where':{'uniqueid':_0x244e71},'order':[['id',_0x5c58('0x6')]],'limit':0x1},'log':_0x5c58('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c4b53d8..505b95f 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 _0x7f90=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f90,0x1c5));var _0x07f9=function(_0x333818,_0x28e5fb){_0x333818=_0x333818-0x0;var _0x2a595c=_0x7f90[_0x333818];return _0x2a595c;};'use strict';var client=require('../client');exports[_0x07f9('0x0')]=function(_0x491861,_0x48cc71){return client[_0x07f9('0x1')]('UpdateSmsInteraction',{'body':_0x48cc71,'options':{'where':{'id':_0x491861}},'log':_0x07f9('0x2')});};exports['addTags']=function(_0x4502e3,_0xb1156b){return client[_0x07f9('0x1')](_0x07f9('0x3'),{'body':_0xb1156b,'options':{'where':{'id':_0x4502e3}},'log':_0x07f9('0x4')});}; \ No newline at end of file +var _0xa209=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xa209,0xba));var _0x9a20=function(_0x2b94f,_0xd0bf70){_0x2b94f=_0x2b94f-0x0;var _0x4c30f0=_0xa209[_0x2b94f];return _0x4c30f0;};'use strict';var client=require(_0x9a20('0x0'));exports[_0x9a20('0x1')]=function(_0x575f42,_0x2e588a){return client[_0x9a20('0x2')](_0x9a20('0x3'),{'body':_0x2e588a,'options':{'where':{'id':_0x575f42}},'log':_0x9a20('0x4')});};exports[_0x9a20('0x5')]=function(_0x1c7f7a,_0x4a27a1){return client[_0x9a20('0x2')](_0x9a20('0x6'),{'body':_0x4a27a1,'options':{'where':{'id':_0x1c7f7a}},'log':_0x9a20('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3b6a7d9..ca877f3 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 _0xe9ad=['Request','createSmsMessage','../client','create'];(function(_0x33ab93,_0x47d555){var _0x175093=function(_0x18de2c){while(--_0x18de2c){_0x33ab93['push'](_0x33ab93['shift']());}};_0x175093(++_0x47d555);}(_0xe9ad,0x1be));var _0xde9a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe9ad[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xde9a('0x0'));exports[_0xde9a('0x1')]=function(_0x4736a0){return client[_0xde9a('0x2')]('CreateSmsMessage',{'body':_0x4736a0,'log':_0xde9a('0x3')});}; \ No newline at end of file +var _0x9ff4=['CreateSmsMessage','../client','create','Request'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9ff4,0x1ad));var _0x49ff=function(_0x26153c,_0x4c55cf){_0x26153c=_0x26153c-0x0;var _0xfd455d=_0x9ff4[_0x26153c];return _0xfd455d;};'use strict';var client=require(_0x49ff('0x0'));exports[_0x49ff('0x1')]=function(_0x5174a1){return client[_0x49ff('0x2')](_0x49ff('0x3'),{'body':_0x5174a1,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a228841..94bd40f 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 _0x0837=['name','timeout','User','Agents','smsPause','../client','Request'];(function(_0x575bee,_0x3b33ac){var _0xc11356=function(_0x3e1444){while(--_0x3e1444){_0x575bee['push'](_0x575bee['shift']());}};_0xc11356(++_0x3b33ac);}(_0x0837,0x1e1));var _0x7083=function(_0x320356,_0x4b134b){_0x320356=_0x320356-0x0;var _0x126377=_0x0837[_0x320356];return _0x126377;};'use strict';var client=require(_0x7083('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7083('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7083('0x2'),_0x7083('0x3'),'strategy'],'include':[{'model':_0x7083('0x4'),'as':_0x7083('0x5'),'attributes':['id','name','online',_0x7083('0x6')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa973=['name','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','User'];(function(_0x12428e,_0x130d18){var _0x37f4ba=function(_0x10a049){while(--_0x10a049){_0x12428e['push'](_0x12428e['shift']());}};_0x37f4ba(++_0x130d18);}(_0xa973,0x73));var _0x3a97=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0xa973[_0x47c902];return _0x1ad6a0;};'use strict';var client=require(_0x3a97('0x0'));exports[_0x3a97('0x1')]=function(){return function(){return client[_0x3a97('0x2')](_0x3a97('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x3a97('0x4'),'as':'Agents','attributes':['id',_0x3a97('0x5'),_0x3a97('0x6'),_0x3a97('0x7')]}]},'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 8d8a7dd..ca2f951 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 _0x0b2f=['CreateSmsQueueReport','DESC','UpdateSmsQueueReport','../client','Request'];(function(_0x24de7b,_0x1e079a){var _0x36ea49=function(_0xcdbccd){while(--_0xcdbccd){_0x24de7b['push'](_0x24de7b['shift']());}};_0x36ea49(++_0x1e079a);}(_0x0b2f,0x1f2));var _0xf0b2=function(_0x18dc33,_0x180807){_0x18dc33=_0x18dc33-0x0;var _0x3d1822=_0x0b2f[_0x18dc33];return _0x3d1822;};'use strict';var client=require(_0xf0b2('0x0'));exports['create']=function(_0x2a0efe){return client[_0xf0b2('0x1')](_0xf0b2('0x2'),{'body':_0x2a0efe,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x578d6a,_0x1d7c89){return client[_0xf0b2('0x1')]('UpdateSmsQueueReport',{'body':_0x1d7c89,'options':{'where':{'uniqueid':_0x578d6a},'order':[['id',_0xf0b2('0x3')]],'limit':0x1},'log':_0xf0b2('0x4')});}; \ No newline at end of file +var _0x8ac5=['DESC','UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ac5,0x105));var _0x58ac=function(_0x33b991,_0x12cebc){_0x33b991=_0x33b991-0x0;var _0x17e4e9=_0x8ac5[_0x33b991];return _0x17e4e9;};'use strict';var client=require(_0x58ac('0x0'));exports[_0x58ac('0x1')]=function(_0xff25a2){return client[_0x58ac('0x2')](_0x58ac('0x3'),{'body':_0xff25a2,'log':_0x58ac('0x3')});};exports[_0x58ac('0x4')]=function(_0x276bc0,_0x474fa3){return client[_0x58ac('0x2')]('UpdateSmsQueueReport',{'body':_0x474fa3,'options':{'where':{'uniqueid':_0x276bc0},'order':[['id',_0x58ac('0x5')]],'limit':0x1},'log':_0x58ac('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 13e46a4..f6f96e2 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 _0xac75=['online','pauseType','lastPauseAt','chatPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','GetUser','agent'];(function(_0x5d63c1,_0x23a4fb){var _0x2c6808=function(_0x4145b2){while(--_0x4145b2){_0x5d63c1['push'](_0x5d63c1['shift']());}};_0x2c6808(++_0x23a4fb);}(_0xac75,0x11c));var _0x5ac7=function(_0x951ca,_0x27a7ec){_0x951ca=_0x951ca-0x0;var _0x6a80e5=_0xac75[_0x951ca];return _0x6a80e5;};'use strict';var client=require(_0x5ac7('0x0'));exports[_0x5ac7('0x1')]=function(){return function(){return client['Request'](_0x5ac7('0x2'),{'options':{'raw':!![],'where':{'role':_0x5ac7('0x3')},'attributes':['id','name',_0x5ac7('0x4'),_0x5ac7('0x5'),_0x5ac7('0x6'),'voicePause',_0x5ac7('0x7'),'mailPause',_0x5ac7('0x8'),_0x5ac7('0x9'),_0x5ac7('0xa'),_0x5ac7('0xb'),_0x5ac7('0xc'),'mailCapacity',_0x5ac7('0xd'),_0x5ac7('0xe'),'whatsappCapacity',_0x5ac7('0xf')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x127c=['openchannelCapacity','../client','getAgents','Request','GetUser','name','online','lastPauseAt','voicePause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity'];(function(_0x4ebe1d,_0x5505f1){var _0x3658fd=function(_0x581cd6){while(--_0x581cd6){_0x4ebe1d['push'](_0x4ebe1d['shift']());}};_0x3658fd(++_0x5505f1);}(_0x127c,0xb5));var _0xc127=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x127c[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xc127('0x0'));exports[_0xc127('0x1')]=function(){return function(){return client[_0xc127('0x2')](_0xc127('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xc127('0x4'),_0xc127('0x5'),'pauseType',_0xc127('0x6'),_0xc127('0x7'),'chatPause','mailPause',_0xc127('0x8'),_0xc127('0x9'),_0xc127('0xa'),_0xc127('0xb'),_0xc127('0xc'),_0xc127('0xd'),_0xc127('0xe'),_0xc127('0xf'),_0xc127('0x10'),_0xc127('0x11')]},'log':_0xc127('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 2d45bb1..7de9a3f 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 _0x35aa=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request'];(function(_0x563eb4,_0x29bbae){var _0x97db86=function(_0x5f144f){while(--_0x5f144f){_0x563eb4['push'](_0x563eb4['shift']());}};_0x97db86(++_0x29bbae);}(_0x35aa,0xbe));var _0xa35a=function(_0x16fbbc,_0x54a1ee){_0x16fbbc=_0x16fbbc-0x0;var _0x300a0d=_0x35aa[_0x16fbbc];return _0x300a0d;};'use strict';var client=require('../client');exports[_0xa35a('0x0')]=function(_0x2d2970,_0x9a3c63){return client[_0xa35a('0x1')]('UpdateWhatsappInteraction',{'body':_0x9a3c63,'options':{'where':{'id':_0x2d2970}},'log':_0xa35a('0x2')});};exports[_0xa35a('0x3')]=function(_0x24cc2,_0x11f841){return client[_0xa35a('0x1')](_0xa35a('0x4'),{'body':_0x11f841,'options':{'where':{'id':_0x24cc2}},'log':_0xa35a('0x5')});}; \ No newline at end of file +var _0x6c6f=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x366c14,_0x11e818){var _0x1c3b80=function(_0x180b9f){while(--_0x180b9f){_0x366c14['push'](_0x366c14['shift']());}};_0x1c3b80(++_0x11e818);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x34b24a,_0x42a97f){_0x34b24a=_0x34b24a-0x0;var _0x2b03cd=_0x6c6f[_0x34b24a];return _0x2b03cd;};'use strict';var client=require(_0xf6c6('0x0'));exports[_0xf6c6('0x1')]=function(_0x312daa,_0x1215b6){return client[_0xf6c6('0x2')](_0xf6c6('0x3'),{'body':_0x1215b6,'options':{'where':{'id':_0x312daa}},'log':_0xf6c6('0x4')});};exports[_0xf6c6('0x5')]=function(_0x36fcd2,_0xa1183){return client[_0xf6c6('0x2')]('AddTagsToWhatsappInteraction',{'body':_0xa1183,'options':{'where':{'id':_0x36fcd2}},'log':_0xf6c6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2adc3f5..d97b319 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 _0xe2ad=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5751be,_0x54cefa){var _0x3dbe60=function(_0x2404b2){while(--_0x2404b2){_0x5751be['push'](_0x5751be['shift']());}};_0x3dbe60(++_0x54cefa);}(_0xe2ad,0x1bd));var _0xde2a=function(_0x35e69d,_0x5c4058){_0x35e69d=_0x35e69d-0x0;var _0x9f7a0c=_0xe2ad[_0x35e69d];return _0x9f7a0c;};'use strict';var client=require(_0xde2a('0x0'));exports[_0xde2a('0x1')]=function(_0x447f5e){return client[_0xde2a('0x2')](_0xde2a('0x3'),{'body':_0x447f5e,'log':_0xde2a('0x4')});}; \ No newline at end of file +var _0x23d3=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x44e9ca,_0xd83494){var _0x3fed89=function(_0xb1a8e){while(--_0xb1a8e){_0x44e9ca['push'](_0x44e9ca['shift']());}};_0x3fed89(++_0xd83494);}(_0x23d3,0xbf));var _0x323d=function(_0x46ab36,_0x10839e){_0x46ab36=_0x46ab36-0x0;var _0x5e4905=_0x23d3[_0x46ab36];return _0x5e4905;};'use strict';var client=require(_0x323d('0x0'));exports['create']=function(_0xf4b981){return client[_0x323d('0x1')](_0x323d('0x2'),{'body':_0xf4b981,'log':_0x323d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c85e1a2..d0dd26f 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 _0x19e1=['User','name','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','strategy'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x19e1,0x163));var _0x119e=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x19e1[_0x2714ec];return _0x2608e5;};'use strict';var client=require(_0x119e('0x0'));exports[_0x119e('0x1')]=function(){return function(){return client[_0x119e('0x2')](_0x119e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x119e('0x4')],'include':[{'model':_0x119e('0x5'),'as':'Agents','attributes':['id',_0x119e('0x6'),_0x119e('0x7'),'whatsappPause']}]},'log':_0x119e('0x1')});};}; \ No newline at end of file +var _0x236c=['getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause'];(function(_0x7e1b6b,_0x4ad71d){var _0x2b086f=function(_0x5c24de){while(--_0x5c24de){_0x7e1b6b['push'](_0x7e1b6b['shift']());}};_0x2b086f(++_0x4ad71d);}(_0x236c,0x155));var _0xc236=function(_0x3fb5f5,_0x3534e3){_0x3fb5f5=_0x3fb5f5-0x0;var _0x3e7745=_0x236c[_0x3fb5f5];return _0x3e7745;};'use strict';var client=require(_0xc236('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc236('0x1')](_0xc236('0x2'),{'options':{'raw':![],'attributes':['id',_0xc236('0x3'),_0xc236('0x4'),_0xc236('0x5')],'include':[{'model':'User','as':_0xc236('0x6'),'attributes':['id',_0xc236('0x3'),_0xc236('0x7'),_0xc236('0x8')]}]},'log':_0xc236('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f250e44..ad1e993 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 _0xbd0a=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0xc31185,_0x28f0fe){var _0x103b8e=function(_0xf3b4cd){while(--_0xf3b4cd){_0xc31185['push'](_0xc31185['shift']());}};_0x103b8e(++_0x28f0fe);}(_0xbd0a,0x108));var _0xabd0=function(_0x1a236a,_0x139f72){_0x1a236a=_0x1a236a-0x0;var _0x33dd2f=_0xbd0a[_0x1a236a];return _0x33dd2f;};'use strict';var client=require(_0xabd0('0x0'));exports[_0xabd0('0x1')]=function(_0x3e9ee7){return client['Request'](_0xabd0('0x2'),{'body':_0x3e9ee7,'log':_0xabd0('0x2')});};exports[_0xabd0('0x3')]=function(_0xf3af3c,_0x423bf5){return client[_0xabd0('0x4')](_0xabd0('0x5'),{'body':_0x423bf5,'options':{'where':{'uniqueid':_0xf3af3c},'order':[['id',_0xabd0('0x6')]],'limit':0x1},'log':_0xabd0('0x5')});}; \ No newline at end of file +var _0xf4bf=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport'];(function(_0x357b21,_0x548fae){var _0xf26a57=function(_0x5ba679){while(--_0x5ba679){_0x357b21['push'](_0x357b21['shift']());}};_0xf26a57(++_0x548fae);}(_0xf4bf,0x139));var _0xff4b=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xf4bf[_0x47568e];return _0x33815b;};'use strict';var client=require(_0xff4b('0x0'));exports['create']=function(_0x2fc8e5){return client[_0xff4b('0x1')](_0xff4b('0x2'),{'body':_0x2fc8e5,'log':_0xff4b('0x2')});};exports['update']=function(_0x360275,_0x4e46e3){return client[_0xff4b('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4e46e3,'options':{'where':{'uniqueid':_0x360275},'order':[['id','DESC']],'limit':0x1},'log':_0xff4b('0x3')});}; \ 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 273669f..1ad55d5 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 _0x21ad=['message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','map'];(function(_0x1acff7,_0x3fe243){var _0x1bc1aa=function(_0x50b11a){while(--_0x50b11a){_0x1acff7['push'](_0x1acff7['shift']());}};_0x1bc1aa(++_0x3fe243);}(_0x21ad,0x15e));var _0xd21a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x21ad[_0x4b369d];return _0x571a98;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xd21a('0x0'));var seqqueue=require(_0xd21a('0x1'));var logger=require('../../../../config/logger')(_0xd21a('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd21a('0x3'),'required':!![],'message':_0xd21a('0x4')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x26ed20,_0x578ecf,_0x3b4879){return logger['info'](util[_0xd21a('0x5')](_0xd21a('0x6'),_0x26ed20,_0x578ecf[_0xd21a('0x7')],_0x3b4879));}function handleFindAgent(_0x315c81){return function(_0x4df9a3){return _0x4df9a3[_0xd21a('0x7')][_0xd21a('0x8')]()===_0x315c81[_0xd21a('0x8')]();};}exports['consequence']=function(_0x202bc6,_0x3d01a1,_0x228777,_0x12023a){return function(_0x187ed3){try{var _0x420711={'name':_0x3d01a1[0x0],'timeout':_0x3d01a1[0x1]};var _0x2130eb=queue[_0xd21a('0x9')](_0x420711,{'typecast':!![]});if(_0x2130eb[_0xd21a('0xa')]){logger[_0xd21a('0xb')]('[%s][AGENT]\x20%s',_0x202bc6,_[_0xd21a('0xc')](_0x2130eb,_0xd21a('0xd'))[_0xd21a('0xe')](',\x20'));_0x187ed3[_0xd21a('0xf')]();}else{var _0x4bc8fd=_[_0xd21a('0x10')](_0x228777[_0xd21a('0x11')],handleFindAgent(_0x420711[_0xd21a('0x7')]));if(_0x4bc8fd){var _0x1e5420=(_0x420711[_0xd21a('0x12')]||0xa)*0x3e8;var _0x2539f6,_0x3511eb;var _0x1673ff=seqqueue[_0xd21a('0x13')](_0x1e5420);_0x1673ff['id']=_0x202bc6;_0x1673ff[_0xd21a('0x14')]=_0x1e5420;_0x1673ff[_0xd21a('0x15')]=_0x12023a[_0xd21a('0x15')];writeLog(_0x202bc6,_0x4bc8fd,util[_0xd21a('0x5')](_0xd21a('0x16'),_0x1e5420));_0x228777[_0xd21a('0x17')][_0x202bc6]['on'](_0xd21a('0x18'),function(){logger[_0xd21a('0x19')](_0xd21a('0x1a'),_0x202bc6);clearTimeout(_0x3511eb);_0x3511eb=undefined;_0x1673ff['close']();if(_0x228777[_0xd21a('0x17')][_0x202bc6]){delete _0x228777[_0xd21a('0x17')][_0x202bc6];}_0x187ed3[_0xd21a('0xf')]();});_0x228777['rules'][_0x202bc6]['on'](_0xd21a('0x1b'),function(){if(_0x228777[_0xd21a('0x17')][_0x202bc6]){delete _0x228777[_0xd21a('0x17')][_0x202bc6];}});_0x3511eb=setTimeout(function(){logger[_0xd21a('0x19')]('[%s][AGENT]\x20ROUTING\x20END',_0x202bc6);clearTimeout(_0x3511eb);_0x1673ff['close']();_0x187ed3[_0xd21a('0x1c')]();},_0x1e5420);strategy[_0xd21a('0x1d')](_0x1673ff,_0x4bc8fd,_0x228777,_0x12023a);}else{logger[_0xd21a('0xb')](_0xd21a('0x1e'),_0x202bc6,_0x420711['name']);_0x187ed3[_0xd21a('0xf')]();}}}catch(_0x4ddd37){console['log'](_0x4ddd37);logger['error'](_0xd21a('0x1f'),_0x202bc6,_0x4ddd37[_0xd21a('0x20')]);_0x187ed3['stop']();}};}; \ No newline at end of file +var _0x5ac5=['createQueue','channel','START:%s','rules','stop','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout'];(function(_0x2a38f7,_0x3ccdbc){var _0x3a9471=function(_0x544899){while(--_0x544899){_0x2a38f7['push'](_0x2a38f7['shift']());}};_0x3a9471(++_0x3ccdbc);}(_0x5ac5,0x169));var _0x55ac=function(_0x2d0d97,_0x2d9560){_0x2d0d97=_0x2d0d97-0x0;var _0xfb96e9=_0x5ac5[_0x2d0d97];return _0xfb96e9;};'use strict';var schema=require('validate');var _=require(_0x55ac('0x0'));var util=require(_0x55ac('0x1'));var seqqueue=require(_0x55ac('0x2'));var logger=require(_0x55ac('0x3'))(_0x55ac('0x4'));var strategy=require(_0x55ac('0x5'));var queue=schema({'name':{'type':_0x55ac('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x55ac('0x7')}});function writeLog(_0x311113,_0x58c8b4,_0xa65d51){return logger[_0x55ac('0x8')](util[_0x55ac('0x9')](_0x55ac('0xa'),_0x311113,_0x58c8b4[_0x55ac('0xb')],_0xa65d51));}function handleFindAgent(_0x29f578){return function(_0x4cb83c){return _0x4cb83c[_0x55ac('0xb')][_0x55ac('0xc')]()===_0x29f578[_0x55ac('0xc')]();};}exports['consequence']=function(_0x3e3581,_0x44f1d7,_0x2d7f0a,_0x357ec0){return function(_0x2678ee){try{var _0x4e076a={'name':_0x44f1d7[0x0],'timeout':_0x44f1d7[0x1]};var _0x579768=queue[_0x55ac('0xd')](_0x4e076a,{'typecast':!![]});if(_0x579768[_0x55ac('0xe')]){logger[_0x55ac('0xf')](_0x55ac('0x10'),_0x3e3581,_[_0x55ac('0x11')](_0x579768,_0x55ac('0x12'))[_0x55ac('0x13')](',\x20'));_0x2678ee['stop']();}else{var _0x1969bc=_[_0x55ac('0x14')](_0x2d7f0a[_0x55ac('0x15')],handleFindAgent(_0x4e076a['name']));if(_0x1969bc){var _0x1cef0a=(_0x4e076a[_0x55ac('0x16')]||0xa)*0x3e8;var _0x2ac515,_0x56eaaf;var _0x3af512=seqqueue[_0x55ac('0x17')](_0x1cef0a);_0x3af512['id']=_0x3e3581;_0x3af512['atimeout']=_0x1cef0a;_0x3af512[_0x55ac('0x18')]=_0x357ec0[_0x55ac('0x18')];writeLog(_0x3e3581,_0x1969bc,util[_0x55ac('0x9')](_0x55ac('0x19'),_0x1cef0a));_0x2d7f0a[_0x55ac('0x1a')][_0x3e3581]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3e3581);clearTimeout(_0x56eaaf);_0x56eaaf=undefined;_0x3af512['close']();if(_0x2d7f0a['rules'][_0x3e3581]){delete _0x2d7f0a['rules'][_0x3e3581];}_0x2678ee[_0x55ac('0x1b')]();});_0x2d7f0a[_0x55ac('0x1a')][_0x3e3581]['on']('complete',function(){if(_0x2d7f0a['rules'][_0x3e3581]){delete _0x2d7f0a[_0x55ac('0x1a')][_0x3e3581];}});_0x56eaaf=setTimeout(function(){logger[_0x55ac('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x3e3581);clearTimeout(_0x56eaaf);_0x3af512[_0x55ac('0x1c')]();_0x2678ee['next']();},_0x1cef0a);strategy[_0x55ac('0x1d')](_0x3af512,_0x1969bc,_0x2d7f0a,_0x357ec0);}else{logger[_0x55ac('0xf')](_0x55ac('0x1e'),_0x3e3581,_0x4e076a[_0x55ac('0xb')]);_0x2678ee[_0x55ac('0x1b')]();}}}catch(_0x172da8){console[_0x55ac('0x1f')](_0x172da8);logger[_0x55ac('0xf')]('[%s][QUEUE]\x20%s',_0x3e3581,_0x172da8['stack']);_0x2678ee[_0x55ac('0x1b')]();}};}; \ 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 adb3a2b..35c8ed8 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 _0x687b=['LexRuntime','$LATEST','channel','postText','message','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x323e32,_0x3ed8c8){var _0x4596a7=function(_0x31dc43){while(--_0x31dc43){_0x323e32['push'](_0x323e32['shift']());}};_0x4596a7(++_0x3ed8c8);}(_0x687b,0x14a));var _0xb687=function(_0x47ee00,_0x256539){_0x47ee00=_0x47ee00-0x0;var _0x3d35f9=_0x687b[_0x47ee00];return _0x3d35f9;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var AWS=require(_0xb687('0x2'));var utils=require(_0xb687('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xb687('0x4')),'openchannelMessage':require(_0xb687('0x5')),'mailMessage':require(_0xb687('0x6')),'smsMessage':require(_0xb687('0x7')),'faxMessage':require(_0xb687('0x8')),'whatsappMessage':require(_0xb687('0x9'))};exports[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return function(_0x27b750){try{if(!_['isNil'](this[_0xb687('0xb')][_0xb687('0xc')])){logger['info'](_0xb687('0xd'),_0xf43a1f,_0xb687('0xe'));return _0x27b750[_0xb687('0xf')]();}var _0x15dc9a={'ContactId':this[_0xb687('0x10')]['id'],'sentAt':moment()[_0xb687('0x11')](_0xb687('0x12')),'direction':_0xb687('0x13')};var _0x5e61e=this['channel'];if(_0x5e61e===_0xb687('0x14')){_0x15dc9a[_0xb687('0x15')]=this[_0xb687('0x16')]['id'];}else{_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+'AccountId']=this['account']['id'];}_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+_0xb687('0x18')]=this['interaction']['id'];if(this[_0xb687('0xb')][_0xb687('0x19')]){var _0x1f1f35=_0x47ffea[0x4];if(!_[_0xb687('0x1a')](_0x1f1f35)){_0x15dc9a[_0xb687('0x1b')]=utils[_0xb687('0x1c')](_0x1f1f35,this);return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x2c7a18){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a['body']);})[_0xb687('0x21')](function(_0x328301){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON['stringify'](_0x328301));})[_0xb687('0x23')](function(){logger[_0xb687('0x20')](_0xb687('0x24'),_0xf43a1f);_0x27b750['stop']();});}else{logger[_0xb687('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf43a1f);_0x27b750[_0xb687('0x25')]();}}else{var _0x243236=this;var _0x170dc0=new AWS[(_0xb687('0x26'))]({'accessKeyId':_0x47ffea[0x0],'secretAccessKey':_0x47ffea[0x1],'region':_0x47ffea[0x2]});var _0x49d5a1={'botAlias':_0xb687('0x27'),'botName':_0x47ffea[0x3],'inputText':this['message'][_0xb687('0x1b')],'userId':this[_0xb687('0x28')]+':'+this[_0xb687('0xb')]['id']['toString']()};_0x170dc0[_0xb687('0x29')](_0x49d5a1,function(_0x491623,_0xa95e91){if(_0x491623){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,_0x491623[_0xb687('0x2a')]);_0x27b750[_0xb687('0xf')]();}else if(_0xa95e91&&_0xa95e91[_0xb687('0x2a')]){_0x243236['body'][_0xb687('0x2b')]=_0xa95e91;_0x15dc9a[_0xb687('0x1b')]=_0xa95e91[_0xb687('0x2a')];return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x17ff2b){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a[_0xb687('0x1b')]);if(_0xa95e91['dialogState']==_0xb687('0x2c')){_0x27b750[_0xb687('0xf')]();}else{_0x27b750[_0xb687('0x25')]();}})[_0xb687('0x21')](function(_0x2e5c8d){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON[_0xb687('0x2d')](_0x2e5c8d));_0x27b750['next']();});}else{_0x27b750[_0xb687('0xf')]();}});}}catch(_0x40f35c){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,JSON[_0xb687('0x2d')](_0x40f35c));_0x27b750[_0xb687('0x25')]();}};}; \ 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(_0x372ae1,_0x111d17){var _0x5c983f=function(_0xe2cc66){while(--_0xe2cc66){_0x372ae1['push'](_0x372ae1['shift']());}};_0x5c983f(++_0x111d17);}(_0xba34,0x119));var _0x4ba3=function(_0x321dd6,_0x3d48f9){_0x321dd6=_0x321dd6-0x0;var _0x3c1f84=_0xba34[_0x321dd6];return _0x3c1f84;};'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 e09a90b..fccb29b 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 _0x767f=['next','stop','lodash','moment','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','created','info','Autoreply\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','interaction','Message','Smtp','service','host','port','secure','auth','pass','messageId','html','','body','','sendMailMessage','then','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally'];(function(_0x297f9a,_0x5b53c7){var _0x48e60f=function(_0x24afb6){while(--_0x24afb6){_0x297f9a['push'](_0x297f9a['shift']());}};_0x48e60f(++_0x5b53c7);}(_0x767f,0xd6));var _0xf767=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x767f[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xf767('0x0'));var moment=require(_0xf767('0x1'));var utils=require('./utils');var logger=require(_0xf767('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf767('0x3')),'mailMessage':require(_0xf767('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf767('0x5')),'whatsappMessage':require(_0xf767('0x6'))};var mailRpc=require(_0xf767('0x7'));exports['consequence']=function(_0x3a0a0d,_0x567fd4){return function(_0x4f002b){try{if(_0x567fd4[0x0]==='1'&&(_[_0xf767('0x8')](this['interaction'][_0xf767('0x9')])||!this['interaction']['created'])){logger[_0xf767('0xa')]('[%s][AUTOREPLY]\x20%s',_0x3a0a0d,_0xf767('0xb'));return _0x4f002b['next']();}var _0x3a913c=this[_0xf767('0xc')];var _0x185878={'body':utils['getMustacheRender'](_0x567fd4[0x1],this),'ContactId':this[_0xf767('0xd')]['id'],'sentAt':moment()[_0xf767('0xe')](_0xf767('0xf')),'direction':'out'};if(this[_0xf767('0x10')]){_0x185878['to']=this['message'][_0xf767('0x11')]||'';_0x185878['cc']=this[_0xf767('0x10')]['cc']||'';_0x185878[_0xf767('0x11')]=this['message']['to']||'';_0x185878[_0xf767('0x12')]=this[_0xf767('0x10')][_0xf767('0x12')]||'';_0x185878['read']=!![];if(this[_0xf767('0x10')][_0xf767('0x13')]){_0x185878['subject']='';_0x185878[_0xf767('0x13')]+=_[_0xf767('0x14')](this[_0xf767('0x10')][_0xf767('0x13')],'Re:')?'':_0xf767('0x15');_0x185878[_0xf767('0x13')]+=this[_0xf767('0x10')][_0xf767('0x13')];}}if(this[_0xf767('0xc')]===_0xf767('0x16')){_0x185878[_0xf767('0x17')]=this[_0xf767('0x18')]['id'];}else{_0x185878[_[_0xf767('0x19')](this[_0xf767('0xc')])+'AccountId']=this['account']['id'];}_0x185878[_[_0xf767('0x19')](this['channel'])+'InteractionId']=this[_0xf767('0x1a')]['id'];if(rpc[this[_0xf767('0xc')]+_0xf767('0x1b')]){if(this[_0xf767('0xc')]==='mail'){var _0x4dbeae={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xf767('0x1c')][_0xf767('0x1d')]){_0x4dbeae[_0xf767('0x1d')]=this[_0xf767('0x18')][_0xf767('0x1c')]['service'];}else{_0x4dbeae[_0xf767('0x1e')]=this[_0xf767('0x18')]['Smtp'][_0xf767('0x1e')];_0x4dbeae[_0xf767('0x1f')]=this['account'][_0xf767('0x1c')][_0xf767('0x1f')];_0x4dbeae['secure']=this['account']['Smtp'][_0xf767('0x20')];}if(this[_0xf767('0x18')][_0xf767('0x1c')]['authentication']){_0x4dbeae[_0xf767('0x21')]={'user':this[_0xf767('0x18')][_0xf767('0x1c')]['user'],'pass':this['account']['Smtp'][_0xf767('0x22')]};}_0x185878['inReplyTo']=this['message'][_0xf767('0x23')];_0x185878[_0xf767('0x24')]=_0xf767('0x25')+_['replace'](_0x185878[_0xf767('0x26')],_0xf767('0x27'),_0xf767('0x28'))+_0xf767('0x29');return mailRpc[_0xf767('0x2a')](_0x4dbeae,_0x185878)[_0xf767('0x2b')](function(_0x4f95f2){logger[_0xf767('0xa')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3a0a0d);_0x185878[_0xf767('0x23')]=_0x4f95f2[_0xf767('0x10')][_0xf767('0x23')];return rpc[_0x3a913c+_0xf767('0x1b')][_0xf767('0x2c')](_0x185878);})[_0xf767('0x2b')](function(_0x57c588){logger['info'](_0xf767('0x2d'),_0x3a0a0d,JSON[_0xf767('0x2e')](_0x57c588));})[_0xf767('0x2f')](function(_0x41516f){logger[_0xf767('0x30')](_0xf767('0x31'),_0x3a0a0d,JSON[_0xf767('0x2e')](_0x41516f));})[_0xf767('0x32')](function(){_0x4f002b[_0xf767('0x33')]();});}else{return rpc[this[_0xf767('0xc')]+_0xf767('0x1b')][_0xf767('0x2c')](_0x185878)[_0xf767('0x2b')](function(_0x232e50){logger['info'](_0xf767('0x2d'),_0x3a0a0d,_0x185878[_0xf767('0x26')]);})[_0xf767('0x2f')](function(_0xb0a946){logger[_0xf767('0x30')](_0xf767('0x2d'),_0x3a0a0d,JSON[_0xf767('0x2e')](_0xb0a946));})[_0xf767('0x32')](function(){_0x4f002b['next']();});}}}catch(_0x9a78dc){logger[_0xf767('0x30')](_0xf767('0x2d'),_0x3a0a0d,JSON['stringify'](_0x9a78dc));_0x4f002b[_0xf767('0x34')]();}};}; \ No newline at end of file +var _0x6d3f=['AccountId','InteractionId','Message','service','Smtp','host','secure','authentication','user','pass','inReplyTo','messageId','','replace','';return mailRpc[_0xf6d3('0x2e')](_0x2c3ed7,_0x3b70b8)['then'](function(_0x19b369){logger['info'](_0xf6d3('0x2f'),_0x240279);_0x3b70b8[_0xf6d3('0x29')]=_0x19b369[_0xf6d3('0x14')][_0xf6d3('0x29')];return rpc[_0x100a3f+'Message'][_0xf6d3('0x30')](_0x3b70b8);})[_0xf6d3('0x31')](function(_0x1964a1){logger['info'](_0xf6d3('0xe'),_0x240279,JSON[_0xf6d3('0x32')](_0x1964a1));})['catch'](function(_0x5310d0){logger[_0xf6d3('0x33')]('[RPC][%s][AUTOREPLY]\x20%s',_0x240279,JSON[_0xf6d3('0x32')](_0x5310d0));})['finally'](function(){_0x5cc770[_0xf6d3('0x34')]();});}else{return rpc[this[_0xf6d3('0x10')]+_0xf6d3('0x20')][_0xf6d3('0x30')](_0x3b70b8)[_0xf6d3('0x31')](function(_0x116266){logger[_0xf6d3('0xd')]('[%s][AUTOREPLY]\x20%s',_0x240279,_0x3b70b8['body']);})[_0xf6d3('0x35')](function(_0x11f1ad){logger['error'](_0xf6d3('0xe'),_0x240279,JSON['stringify'](_0x11f1ad));})[_0xf6d3('0x36')](function(){_0x5cc770[_0xf6d3('0x34')]();});}}}catch(_0x59bce0){logger[_0xf6d3('0x33')](_0xf6d3('0xe'),_0x240279,JSON[_0xf6d3('0x32')](_0x59bce0));_0x5cc770[_0xf6d3('0x37')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3920969..955a4ed 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79bf=['../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x79bf,0x1df));var _0xf79b=function(_0x18ccd6,_0x1098e8){_0x18ccd6=_0x18ccd6-0x0;var _0x587d2c=_0x79bf[_0x18ccd6];return _0x587d2c;};'use strict';var moment=require('moment');var logger=require(_0xf79b('0x0'))('routing');var rpc={'chatInteraction':require(_0xf79b('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf79b('0x2')),'mailInteraction':require(_0xf79b('0x3')),'faxInteraction':require(_0xf79b('0x4')),'whatsappInteraction':require(_0xf79b('0x5'))};exports[_0xf79b('0x6')]=function(_0x8b298,_0x128ef8,_0x5de87a,_0x377b85){return function(_0x44e02b){try{logger[_0xf79b('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x8b298,_0x128ef8[0x0]);var _0x290738={'closed':0x1,'closedAt':moment()[_0xf79b('0x8')](_0xf79b('0x9')),'closeReason':_0xf79b('0xa'),'disposition':_0x128ef8[0x0]};if(rpc[_0x377b85['channel']+'Interaction']){rpc[_0x377b85[_0xf79b('0xb')]+_0xf79b('0xc')][_0xf79b('0xd')](_0x377b85[_0xf79b('0xe')]['id'],_0x290738)[_0xf79b('0xf')](function(_0x19fe44){logger[_0xf79b('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x8b298,_0x377b85[_0xf79b('0xe')]['id']);})[_0xf79b('0x10')](function(_0x1e7c75){logger[_0xf79b('0x11')](_0xf79b('0x12'),_0x8b298,JSON[_0xf79b('0x13')](_0x1e7c75));})[_0xf79b('0x14')](function(){_0x44e02b[_0xf79b('0x15')]();});}}catch(_0x1ac99c){logger[_0xf79b('0x11')](_0xf79b('0x12'),_0x8b298,JSON[_0xf79b('0x13')](_0x1ac99c));_0x44e02b['stop']();}};}; \ No newline at end of file +var _0xf69d=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf69d,0xd3));var _0xdf69=function(_0x2f7c87,_0xfad43c){_0x2f7c87=_0x2f7c87-0x0;var _0xc83a49=_0xf69d[_0x2f7c87];return _0xc83a49;};'use strict';var moment=require(_0xdf69('0x0'));var logger=require(_0xdf69('0x1'))(_0xdf69('0x2'));var rpc={'chatInteraction':require(_0xdf69('0x3')),'openchannelInteraction':require(_0xdf69('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xdf69('0x5')),'faxInteraction':require(_0xdf69('0x6')),'whatsappInteraction':require(_0xdf69('0x7'))};exports[_0xdf69('0x8')]=function(_0x177ff7,_0x18ce2b,_0x2d456f,_0x465b1b){return function(_0x1d2501){try{logger[_0xdf69('0x9')](_0xdf69('0xa'),_0x177ff7,_0x18ce2b[0x0]);var _0xc1b77e={'closed':0x1,'closedAt':moment()[_0xdf69('0xb')](_0xdf69('0xc')),'closeReason':_0xdf69('0xd'),'disposition':_0x18ce2b[0x0]};if(rpc[_0x465b1b[_0xdf69('0xe')]+_0xdf69('0xf')]){rpc[_0x465b1b['channel']+_0xdf69('0xf')][_0xdf69('0x10')](_0x465b1b[_0xdf69('0x11')]['id'],_0xc1b77e)[_0xdf69('0x12')](function(_0x43ce3d){logger[_0xdf69('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x177ff7,_0x465b1b['interaction']['id']);})['catch'](function(_0x5df98a){logger[_0xdf69('0x13')](_0xdf69('0x14'),_0x177ff7,JSON[_0xdf69('0x15')](_0x5df98a));})[_0xdf69('0x16')](function(){_0x1d2501[_0xdf69('0x17')]();});}}catch(_0x38aee2){logger['error'](_0xdf69('0x14'),_0x177ff7,JSON[_0xdf69('0x15')](_0x38aee2));_0x1d2501[_0xdf69('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 17d398b..f59f5c3 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf4d=['AccountId','InteractionId','created','body','create','catch','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','result','fulfillment','Message','metadata','endConversation','stringify','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','chat','ChatWebsiteId','account','upperFirst'];(function(_0x55c908,_0x5b8d4a){var _0x182c3a=function(_0x43c39c){while(--_0x43c39c){_0x55c908['push'](_0x55c908['shift']());}};_0x182c3a(++_0x5b8d4a);}(_0xdf4d,0x16a));var _0xddf4=function(_0x2bfd84,_0x1b455c){_0x2bfd84=_0x2bfd84-0x0;var _0x143f36=_0xdf4d[_0x2bfd84];return _0x143f36;};'use strict';var _=require(_0xddf4('0x0'));var moment=require(_0xddf4('0x1'));var apiai=require(_0xddf4('0x2'));var md5=require(_0xddf4('0x3'));var utils=require(_0xddf4('0x4'));var logger=require(_0xddf4('0x5'))(_0xddf4('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xddf4('0x7')),'mailMessage':require(_0xddf4('0x8')),'smsMessage':require(_0xddf4('0x9')),'faxMessage':require(_0xddf4('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x5e1204,_0xc2ed9f){return function(_0x346087){try{if(!_[_0xddf4('0xb')](this[_0xddf4('0xc')]['UserId'])){logger[_0xddf4('0xd')](_0xddf4('0xe'),_0x5e1204,_0xddf4('0xf'));return _0x346087[_0xddf4('0x10')]();}var _0x1047c7={'ContactId':this[_0xddf4('0x11')]['id'],'sentAt':moment()[_0xddf4('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xddf4('0x13')};var _0x43834a=this[_0xddf4('0x14')];if(_0x43834a===_0xddf4('0x15')){_0x1047c7[_0xddf4('0x16')]=this[_0xddf4('0x17')]['id'];}else{_0x1047c7[_[_0xddf4('0x18')](_0x43834a)+_0xddf4('0x19')]=this['account']['id'];}_0x1047c7[_[_0xddf4('0x18')](_0x43834a)+_0xddf4('0x1a')]=this['interaction']['id'];if(this[_0xddf4('0xc')][_0xddf4('0x1b')]){var _0x1fbbc0=_0xc2ed9f[0x2];if(!_['isEmpty'](_0x1fbbc0)){_0x1047c7[_0xddf4('0x1c')]=utils['getMustacheRender'](_0x1fbbc0,this);return rpc[_0x43834a+'Message'][_0xddf4('0x1d')](_0x1047c7)['then'](function(_0x529361){logger[_0xddf4('0xd')](_0xddf4('0xe'),_0x5e1204,_0x1047c7[_0xddf4('0x1c')]);})[_0xddf4('0x1e')](function(_0x38a212){logger['error'](_0xddf4('0xe'),_0x5e1204,JSON['stringify'](_0x38a212));})['finally'](function(){logger[_0xddf4('0xd')](_0xddf4('0x1f'),_0x5e1204);_0x346087[_0xddf4('0x20')]();});}else{logger[_0xddf4('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5e1204);_0x346087['stop']();}}else{var _0x30ef97=this;var _0x3bbeea=apiai(_0xc2ed9f[0x0],{'language':_0xc2ed9f[0x1]||'en'});return _0x3bbeea[_0xddf4('0x21')](this[_0xddf4('0x22')][_0xddf4('0x1c')],{'sessionId':md5(this['interaction']['id'])})[_0xddf4('0x23')](function(_0x3e957b){_0x30ef97[_0xddf4('0x1c')]['dialogflow']=_0x3e957b;_0x1047c7[_0xddf4('0x1c')]=_0x3e957b[_0xddf4('0x24')][_0xddf4('0x25')]['speech'];return rpc[_0x43834a+_0xddf4('0x26')]['create'](_0x1047c7)[_0xddf4('0x23')](function(_0x254e68){logger[_0xddf4('0xd')](_0xddf4('0xe'),_0x5e1204,_0x1047c7[_0xddf4('0x1c')]);if(_0x3e957b['result'][_0xddf4('0x27')][_0xddf4('0x28')]){_0x346087['next']();}else{_0x346087[_0xddf4('0x20')]();}})[_0xddf4('0x1e')](function(_0x2be5dc){logger['error'](_0xddf4('0xe'),_0x5e1204,JSON[_0xddf4('0x29')](_0x2be5dc));_0x346087['next']();});})[_0xddf4('0x1e')](function(_0x538fc7){logger[_0xddf4('0x2a')](_0xddf4('0xe'),_0x5e1204,_0x538fc7['message']);_0x346087[_0xddf4('0x10')]();});}}catch(_0xdc112b){logger['error'](_0xddf4('0xe'),_0x5e1204,JSON[_0xddf4('0x29')](_0xdc112b));_0x346087[_0xddf4('0x20')]();}};}; \ No newline at end of file +var _0x9626=['YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','then','fulfillment','speech','result','stringify','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x19c39d,_0xf0c59d){var _0x51a303=function(_0x2ae3a0){while(--_0x2ae3a0){_0x19c39d['push'](_0x19c39d['shift']());}};_0x51a303(++_0xf0c59d);}(_0x9626,0x15f));var _0x6962=function(_0xeef10f,_0x4fad05){_0xeef10f=_0xeef10f-0x0;var _0x338ad8=_0x9626[_0xeef10f];return _0x338ad8;};'use strict';var _=require(_0x6962('0x0'));var moment=require(_0x6962('0x1'));var apiai=require(_0x6962('0x2'));var md5=require(_0x6962('0x3'));var utils=require(_0x6962('0x4'));var logger=require(_0x6962('0x5'))(_0x6962('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6962('0x7')),'smsMessage':require(_0x6962('0x8')),'faxMessage':require(_0x6962('0x9')),'whatsappMessage':require(_0x6962('0xa'))};exports['consequence']=function(_0x2e4ee7,_0xfa901a){return function(_0xddf2c5){try{if(!_[_0x6962('0xb')](this[_0x6962('0xc')][_0x6962('0xd')])){logger[_0x6962('0xe')](_0x6962('0xf'),_0x2e4ee7,_0x6962('0x10'));return _0xddf2c5[_0x6962('0x11')]();}var _0x413fe8={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x6962('0x12')),'direction':_0x6962('0x13')};var _0x479d33=this['channel'];if(_0x479d33===_0x6962('0x14')){_0x413fe8[_0x6962('0x15')]=this[_0x6962('0x16')]['id'];}else{_0x413fe8[_[_0x6962('0x17')](_0x479d33)+_0x6962('0x18')]=this[_0x6962('0x16')]['id'];}_0x413fe8[_['upperFirst'](_0x479d33)+_0x6962('0x19')]=this[_0x6962('0xc')]['id'];if(this['interaction']['created']){var _0x19a8ba=_0xfa901a[0x2];if(!_[_0x6962('0x1a')](_0x19a8ba)){_0x413fe8[_0x6962('0x1b')]=utils['getMustacheRender'](_0x19a8ba,this);return rpc[_0x479d33+_0x6962('0x1c')][_0x6962('0x1d')](_0x413fe8)['then'](function(_0x4d21cd){logger['info'](_0x6962('0xf'),_0x2e4ee7,_0x413fe8[_0x6962('0x1b')]);})[_0x6962('0x1e')](function(_0x17483b){logger[_0x6962('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x2e4ee7,JSON['stringify'](_0x17483b));})[_0x6962('0x20')](function(){logger['info'](_0x6962('0x21'),_0x2e4ee7);_0xddf2c5[_0x6962('0x22')]();});}else{logger[_0x6962('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2e4ee7);_0xddf2c5[_0x6962('0x22')]();}}else{var _0x31aed0=this;var _0x586843=apiai(_0xfa901a[0x0],{'language':_0xfa901a[0x1]||'en'});return _0x586843['textRequest'](this[_0x6962('0x23')]['body'],{'sessionId':md5(this[_0x6962('0xc')]['id'])})[_0x6962('0x24')](function(_0x4f6720){_0x31aed0[_0x6962('0x1b')]['dialogflow']=_0x4f6720;_0x413fe8[_0x6962('0x1b')]=_0x4f6720['result'][_0x6962('0x25')][_0x6962('0x26')];return rpc[_0x479d33+_0x6962('0x1c')][_0x6962('0x1d')](_0x413fe8)['then'](function(_0x13b849){logger['info'](_0x6962('0xf'),_0x2e4ee7,_0x413fe8[_0x6962('0x1b')]);if(_0x4f6720[_0x6962('0x27')]['metadata']['endConversation']){_0xddf2c5[_0x6962('0x11')]();}else{_0xddf2c5[_0x6962('0x22')]();}})['catch'](function(_0x1d1c29){logger[_0x6962('0x1f')](_0x6962('0xf'),_0x2e4ee7,JSON[_0x6962('0x28')](_0x1d1c29));_0xddf2c5['next']();});})[_0x6962('0x1e')](function(_0x5ee169){logger[_0x6962('0x1f')](_0x6962('0xf'),_0x2e4ee7,_0x5ee169['message']);_0xddf2c5[_0x6962('0x11')]();});}}catch(_0x4821b9){logger[_0x6962('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x2e4ee7,JSON['stringify'](_0x4821b9));_0xddf2c5[_0x6962('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 3596d32..6ca52d2 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a89=['getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','condition','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x1b1f73,_0x21998d){var _0x21a2eb=function(_0x5f1153){while(--_0x5f1153){_0x1b1f73['push'](_0x1b1f73['shift']());}};_0x21a2eb(++_0x21998d);}(_0x6a89,0x1b4));var _0x96a8=function(_0x4ba9e7,_0x56ad60){_0x4ba9e7=_0x4ba9e7-0x0;var _0x58a745=_0x6a89[_0x4ba9e7];return _0x58a745;};'use strict';var schema=require(_0x96a8('0x0'));var _=require(_0x96a8('0x1'));var htmlToText=require(_0x96a8('0x2'));var utils=require(_0x96a8('0x3'));var logger=require(_0x96a8('0x4'))(_0x96a8('0x5'));var gotoif=schema({'condition':{'type':_0x96a8('0x6'),'required':!![],'message':_0x96a8('0x7')},'priorityTrue':{'type':'number','message':_0x96a8('0x8')},'priorityFalse':{'type':_0x96a8('0x9'),'message':_0x96a8('0xa')}});exports[_0x96a8('0xb')]=function(_0x25fe0d,_0x4b2bc3){return function(_0x2abe1d){try{var _0x1e6ddd={'condition':htmlToText['fromString'](utils[_0x96a8('0xc')](_0x4b2bc3[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b2bc3[0x1],'priorityFalse':_0x4b2bc3[0x2]};var _0x12c01b=gotoif[_0x96a8('0x0')](_0x1e6ddd,{'typecast':!![]});if(_0x12c01b[_0x96a8('0xd')]){logger[_0x96a8('0xe')](_0x96a8('0xf'),_0x25fe0d,_[_0x96a8('0x10')](_0x12c01b,'message')['join'](',\x20'));_0x2abe1d['stop']();}else{try{var _0x2ba9a7=eval('('+_0x1e6ddd[_0x96a8('0x11')]+')');var _0x2164b0=_0x2ba9a7?_0x1e6ddd['priorityTrue']:_0x1e6ddd[_0x96a8('0x12')];logger[_0x96a8('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x25fe0d,_0x1e6ddd[_0x96a8('0x11')],_0x2ba9a7,_0x2164b0||'next');if(_0x2164b0){var _0x383063=_[_0x96a8('0x14')](_0x2abe1d[_0x96a8('0x15')](),{'p':_0x2164b0});if(_0x383063>=0x0){logger['info'](_0x96a8('0x16'),_0x25fe0d,_0x2164b0||_0x96a8('0x17'),_0x383063);_0x2abe1d[_0x96a8('0x17')](_0x383063);}else{logger[_0x96a8('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x25fe0d,_0x2164b0||_0x96a8('0x17'));_0x2abe1d[_0x96a8('0x18')]();}}else{_0x2abe1d[_0x96a8('0x17')]();}}catch(_0x51ddf9){logger[_0x96a8('0xe')](_0x96a8('0x19'),_0x25fe0d,_0x51ddf9[_0x96a8('0x1a')]);_0x2abe1d[_0x96a8('0x18')]();}}}catch(_0x2bd1fc){logger[_0x96a8('0xe')](_0x96a8('0xf'),_0x25fe0d,JSON[_0x96a8('0x1b')](_0x2bd1fc));_0x2abe1d[_0x96a8('0x18')]();}};}; \ No newline at end of file +var _0x2956=['./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','html-to-text'];(function(_0x45c9be,_0x102b25){var _0x42e9f1=function(_0x36eae6){while(--_0x36eae6){_0x45c9be['push'](_0x45c9be['shift']());}};_0x42e9f1(++_0x102b25);}(_0x2956,0x1ec));var _0x6295=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x2956[_0x1895b7];return _0x1aecdc;};'use strict';var schema=require(_0x6295('0x0'));var _=require('lodash');var htmlToText=require(_0x6295('0x1'));var utils=require(_0x6295('0x2'));var logger=require(_0x6295('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x6295('0x4'),'required':!![],'message':_0x6295('0x5')},'priorityTrue':{'type':_0x6295('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x6295('0x6'),'message':_0x6295('0x7')}});exports[_0x6295('0x8')]=function(_0x661c6b,_0x3f5c0f){return function(_0x480bf3){try{var _0x4f133f={'condition':htmlToText[_0x6295('0x9')](utils[_0x6295('0xa')](_0x3f5c0f[0x0],this),{'wordwrap':![]})[_0x6295('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3f5c0f[0x1],'priorityFalse':_0x3f5c0f[0x2]};var _0x1f7896=gotoif['validate'](_0x4f133f,{'typecast':!![]});if(_0x1f7896[_0x6295('0xc')]){logger[_0x6295('0xd')]('[%s][GOTOIF]\x20%s',_0x661c6b,_['map'](_0x1f7896,_0x6295('0xe'))[_0x6295('0xf')](',\x20'));_0x480bf3[_0x6295('0x10')]();}else{try{var _0x20d1e6=eval('('+_0x4f133f[_0x6295('0x11')]+')');var _0x45c7ea=_0x20d1e6?_0x4f133f['priorityTrue']:_0x4f133f[_0x6295('0x12')];logger[_0x6295('0x13')](_0x6295('0x14'),_0x661c6b,_0x4f133f[_0x6295('0x11')],_0x20d1e6,_0x45c7ea||_0x6295('0x15'));if(_0x45c7ea){var _0xa2d047=_[_0x6295('0x16')](_0x480bf3['rules'](),{'p':_0x45c7ea});if(_0xa2d047>=0x0){logger[_0x6295('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x661c6b,_0x45c7ea||_0x6295('0x15'),_0xa2d047);_0x480bf3[_0x6295('0x15')](_0xa2d047);}else{logger[_0x6295('0x13')](_0x6295('0x17'),_0x661c6b,_0x45c7ea||_0x6295('0x15'));_0x480bf3['stop']();}}else{_0x480bf3[_0x6295('0x15')]();}}catch(_0x53655e){logger[_0x6295('0xd')](_0x6295('0x18'),_0x661c6b,_0x53655e[_0x6295('0xe')]);_0x480bf3[_0x6295('0x10')]();}}}catch(_0x3dd243){logger[_0x6295('0xd')](_0x6295('0x19'),_0x661c6b,JSON['stringify'](_0x3dd243));_0x480bf3[_0x6295('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 dbcb1fc..6e00cf3 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 _0x7ac9=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x122126,_0x5af737){var _0xbfa176=function(_0x2a7cb8){while(--_0x2a7cb8){_0x122126['push'](_0x122126['shift']());}};_0xbfa176(++_0x5af737);}(_0x7ac9,0x76));var _0x97ac=function(_0x2b620c,_0x44b95c){_0x2b620c=_0x2b620c-0x0;var _0x10429f=_0x7ac9[_0x2b620c];return _0x10429f;};'use strict';var schema=require(_0x97ac('0x0'));var _=require(_0x97ac('0x1'));var logger=require(_0x97ac('0x2'))(_0x97ac('0x3'));var gotop=schema({'priority':{'type':_0x97ac('0x4'),'required':!![],'message':_0x97ac('0x5')}});exports[_0x97ac('0x6')]=function(_0x904f56,_0x551a11){return function(_0x5d8681){try{var _0x4f51d2={'priority':_0x551a11[0x0]};var _0x2182c9=gotop[_0x97ac('0x0')](_0x4f51d2,{'typecast':!![]});if(_0x2182c9[_0x97ac('0x7')]){logger[_0x97ac('0x8')](_0x97ac('0x9'),_0x904f56,_[_0x97ac('0xa')](_0x2182c9,_0x97ac('0xb'))[_0x97ac('0xc')](',\x20'));_0x5d8681[_0x97ac('0xd')]();}else{logger[_0x97ac('0xe')](_0x97ac('0xf'),_0x904f56,_0x4f51d2[_0x97ac('0x10')]);if(_0x4f51d2[_0x97ac('0x10')]){var _0x26fc73=_[_0x97ac('0x11')](_0x5d8681[_0x97ac('0x12')](),{'p':_0x4f51d2[_0x97ac('0x10')]});if(_0x26fc73>=0x0){logger[_0x97ac('0xe')](_0x97ac('0x13'),_0x904f56,_0x4f51d2[_0x97ac('0x10')]||_0x97ac('0x14'),_0x26fc73);_0x5d8681[_0x97ac('0x14')](_0x26fc73);}else{logger[_0x97ac('0xe')](_0x97ac('0x15'),_0x904f56,_0x4f51d2['priority']||_0x97ac('0x14'));_0x5d8681[_0x97ac('0xd')]();}}else{_0x5d8681[_0x97ac('0x14')]();}}}catch(_0x8decb3){logger[_0x97ac('0x8')]('[%s][GOTOP]\x20%s',_0x904f56,JSON[_0x97ac('0x16')](_0x8decb3));_0x5d8681[_0x97ac('0xd')]();}};}; \ No newline at end of file +var _0xf8fe=['message','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','validate','lodash','../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map'];(function(_0x266bb6,_0x385e7a){var _0x256a87=function(_0x1d3788){while(--_0x1d3788){_0x266bb6['push'](_0x266bb6['shift']());}};_0x256a87(++_0x385e7a);}(_0xf8fe,0x1d2));var _0xef8f=function(_0x5d0764,_0xa9379c){_0x5d0764=_0x5d0764-0x0;var _0x3e783d=_0xf8fe[_0x5d0764];return _0x3e783d;};'use strict';var schema=require(_0xef8f('0x0'));var _=require(_0xef8f('0x1'));var logger=require(_0xef8f('0x2'))(_0xef8f('0x3'));var gotop=schema({'priority':{'type':_0xef8f('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xef8f('0x5')]=function(_0x278528,_0x4cd6cb){return function(_0x267d3a){try{var _0x673e1b={'priority':_0x4cd6cb[0x0]};var _0x495da5=gotop[_0xef8f('0x0')](_0x673e1b,{'typecast':!![]});if(_0x495da5['length']){logger[_0xef8f('0x6')](_0xef8f('0x7'),_0x278528,_[_0xef8f('0x8')](_0x495da5,_0xef8f('0x9'))['join'](',\x20'));_0x267d3a['stop']();}else{logger[_0xef8f('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x278528,_0x673e1b[_0xef8f('0xb')]);if(_0x673e1b[_0xef8f('0xb')]){var _0xcd32be=_[_0xef8f('0xc')](_0x267d3a[_0xef8f('0xd')](),{'p':_0x673e1b[_0xef8f('0xb')]});if(_0xcd32be>=0x0){logger[_0xef8f('0xa')](_0xef8f('0xe'),_0x278528,_0x673e1b[_0xef8f('0xb')]||_0xef8f('0xf'),_0xcd32be);_0x267d3a[_0xef8f('0xf')](_0xcd32be);}else{logger[_0xef8f('0xa')](_0xef8f('0x10'),_0x278528,_0x673e1b['priority']||_0xef8f('0xf'));_0x267d3a['stop']();}}else{_0x267d3a[_0xef8f('0xf')]();}}}catch(_0x48e16d){logger[_0xef8f('0x6')]('[%s][GOTOP]\x20%s',_0x278528,JSON[_0xef8f('0x11')](_0x48e16d));_0x267d3a[_0xef8f('0x12')]();}};}; \ 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 f08572e..305c337 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 _0x093c=['consequence','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','info','next','catch','[%s][MESSAGE]\x20%s','stringify','error','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x093c,0x1a9));var _0xc093=function(_0x520a7a,_0x2cc9d2){_0x520a7a=_0x520a7a-0x0;var _0x4aa096=_0x093c[_0x520a7a];return _0x4aa096;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xc093('0x0'));var rpc={'chatMessage':require(_0xc093('0x1')),'openchannelMessage':require(_0xc093('0x2')),'mailMessage':require(_0xc093('0x3')),'smsMessage':require(_0xc093('0x4')),'faxMessage':require(_0xc093('0x5')),'whatsappMessage':require(_0xc093('0x6'))};exports[_0xc093('0x7')]=function(_0x55968f,_0x2232a4){return function(_0x16d17b){try{var _0x38f832={'body':utils['getMustacheRender'](_0x2232a4[0x0],this),'ContactId':this['contact']['id']};if(this[_0xc093('0x8')]===_0xc093('0x9')){_0x38f832[_0xc093('0xa')]=this['account']['id'];}else{_0x38f832[_[_0xc093('0xb')](this['channel'])+_0xc093('0xc')]=this[_0xc093('0xd')]['id'];}_0x38f832[_['upperFirst'](this['channel'])+_0xc093('0xe')]=this[_0xc093('0xf')]['id'];if(rpc[this[_0xc093('0x8')]+_0xc093('0x10')]){return rpc[this[_0xc093('0x8')]+_0xc093('0x10')]['create'](_0x38f832)['then'](function(_0x132a36){logger[_0xc093('0x11')]('[%s][MESSAGE]\x20%s',_0x55968f,_0x38f832['body']);_0x16d17b[_0xc093('0x12')]();})[_0xc093('0x13')](function(_0x2e1f6c){logger['error'](_0xc093('0x14'),_0x55968f,JSON[_0xc093('0x15')](_0x2e1f6c));_0x16d17b['stop']();});}}catch(_0x657a70){logger[_0xc093('0x16')]('[%s][MESSAGE]\x20%s',_0x55968f,JSON['stringify'](_0x657a70));_0x16d17b[_0xc093('0x17')]();}};}; \ No newline at end of file +var _0x9238=['AccountId','account','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','chat','ChatWebsiteId','upperFirst','channel'];(function(_0xbed107,_0x1e4460){var _0x43ce5b=function(_0x3b0fd1){while(--_0x3b0fd1){_0xbed107['push'](_0xbed107['shift']());}};_0x43ce5b(++_0x1e4460);}(_0x9238,0x11f));var _0x8923=function(_0x22412c,_0x2df6cb){_0x22412c=_0x22412c-0x0;var _0x2ed53f=_0x9238[_0x22412c];return _0x2ed53f;};'use strict';var _=require('lodash');var utils=require(_0x8923('0x0'));var logger=require('../../../../config/logger')(_0x8923('0x1'));var rpc={'chatMessage':require(_0x8923('0x2')),'openchannelMessage':require(_0x8923('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8923('0x4')),'faxMessage':require(_0x8923('0x5')),'whatsappMessage':require(_0x8923('0x6'))};exports[_0x8923('0x7')]=function(_0x4daff1,_0x1a24d7){return function(_0x3303df){try{var _0xad92df={'body':utils[_0x8923('0x8')](_0x1a24d7[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x8923('0x9')){_0xad92df[_0x8923('0xa')]=this['account']['id'];}else{_0xad92df[_[_0x8923('0xb')](this[_0x8923('0xc')])+_0x8923('0xd')]=this[_0x8923('0xe')]['id'];}_0xad92df[_[_0x8923('0xb')](this[_0x8923('0xc')])+_0x8923('0xf')]=this[_0x8923('0x10')]['id'];if(rpc[this[_0x8923('0xc')]+'Message']){return rpc[this[_0x8923('0xc')]+_0x8923('0x11')]['create'](_0xad92df)['then'](function(_0x37aff2){logger[_0x8923('0x12')](_0x8923('0x13'),_0x4daff1,_0xad92df[_0x8923('0x14')]);_0x3303df[_0x8923('0x15')]();})[_0x8923('0x16')](function(_0x2595bb){logger[_0x8923('0x17')]('[%s][MESSAGE]\x20%s',_0x4daff1,JSON[_0x8923('0x18')](_0x2595bb));_0x3303df['stop']();});}}catch(_0x3bab19){logger[_0x8923('0x17')](_0x8923('0x13'),_0x4daff1,JSON[_0x8923('0x18')](_0x3bab19));_0x3303df['stop']();}};}; \ 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 76520c9..9655cf3 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 _0x9991=['./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x9991,0x14a));var _0x1999=function(_0x270900,_0x1bcae0){_0x270900=_0x270900-0x0;var _0x52587d=_0x9991[_0x270900];return _0x52587d;};'use strict';var utils=require(_0x1999('0x0'));var logger=require(_0x1999('0x1'))(_0x1999('0x2'));exports[_0x1999('0x3')]=function(_0x450127,_0x5dd093){return function(_0x11c66b){try{logger['info'](_0x1999('0x4'),_0x450127,utils[_0x1999('0x5')](_0x5dd093[0x0],this));_0x11c66b[_0x1999('0x6')]();}catch(_0x237249){logger[_0x1999('0x7')](_0x1999('0x4'),_0x450127,JSON[_0x1999('0x8')](_0x237249));_0x11c66b[_0x1999('0x9')]();}};}; \ No newline at end of file +var _0x5c35=['next','stringify','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x220062,_0x3de97b){var _0xa30ce=function(_0x507d75){while(--_0x507d75){_0x220062['push'](_0x220062['shift']());}};_0xa30ce(++_0x3de97b);}(_0x5c35,0x1bb));var _0x55c3=function(_0x42740f,_0x292052){_0x42740f=_0x42740f-0x0;var _0x15b10e=_0x5c35[_0x42740f];return _0x15b10e;};'use strict';var utils=require('./utils');var logger=require(_0x55c3('0x0'))('routing');exports[_0x55c3('0x1')]=function(_0x1c08c0,_0x146247){return function(_0x23fa9e){try{logger[_0x55c3('0x2')](_0x55c3('0x3'),_0x1c08c0,utils[_0x55c3('0x4')](_0x146247[0x0],this));_0x23fa9e[_0x55c3('0x5')]();}catch(_0x41fea6){logger['error'](_0x55c3('0x3'),_0x1c08c0,JSON[_0x55c3('0x6')](_0x41fea6));_0x23fa9e[_0x55c3('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f9bf0f6..c4d2486 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 _0x34e8=['../../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','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x465fe1,_0x1f50e1){var _0x56eddd=function(_0x14f346){while(--_0x14f346){_0x465fe1['push'](_0x465fe1['shift']());}};_0x56eddd(++_0x1f50e1);}(_0x34e8,0x12c));var _0x834e=function(_0x89d4f3,_0x49405e){_0x89d4f3=_0x89d4f3-0x0;var _0x45a3b8=_0x34e8[_0x89d4f3];return _0x45a3b8;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x35f704,_0x2fb3b3){var _0xa307a3=function(_0x35ceee){while(--_0x35ceee){_0x35f704['push'](_0x35f704['shift']());}};_0xa307a3(++_0x2fb3b3);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 23c43aa..a39df7b 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 _0x4d23=['isAgentAvailable','busy','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleTimeout','prototype','handleRun','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x3caa84,_0x7e8d4e){var _0x5235bd=function(_0x194834){while(--_0x194834){_0x3caa84['push'](_0x3caa84['shift']());}};_0x5235bd(++_0x7e8d4e);}(_0x4d23,0x12c));var _0x34d2=function(_0x58f959,_0x161339){_0x58f959=_0x58f959-0x0;var _0x29810f=_0x4d23[_0x58f959];return _0x29810f;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x34d2('0x0'));var logger=require(_0x34d2('0x1'))(_0x34d2('0x2'));var Agent=function(_0x2acdcc,_0x11b1c6,_0x2489aa,_0x7cf8af){this[_0x34d2('0x3')]=uuid['v4']();this[_0x34d2('0x4')]=_0x2acdcc;this[_0x34d2('0x5')]=_0x11b1c6;this[_0x34d2('0x6')]=_0x2489aa;this['routing']=_0x7cf8af;this[_0x34d2('0x4')][_0x34d2('0x7')](this['handleRun']['bind'](this),this['handleTimeout'][_0x34d2('0x8')](this));this[_0x34d2('0x4')]['on'](_0x34d2('0x9'),this[_0x34d2('0xa')][_0x34d2('0x8')](this));this[_0x34d2('0x4')]['on']('drained',this['handleDrained'][_0x34d2('0x8')](this));};Agent[_0x34d2('0xb')][_0x34d2('0x7')]=function(){this[_0x34d2('0x4')]['push'](this[_0x34d2('0xc')]['bind'](this),this[_0x34d2('0xa')]['bind'](this));};Agent['prototype'][_0x34d2('0xd')]=function(){this[_0x34d2('0xa')](!![]);};Agent[_0x34d2('0xb')][_0x34d2('0xc')]=function(_0x154423){logger[_0x34d2('0xe')](_0x34d2('0xf'),this['squeue']['id'],this[_0x34d2('0x5')]['id']);if(_[_0x34d2('0x10')](this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']])){logger['info'](_0x34d2('0x12'),this[_0x34d2('0x4')]['id'],this[_0x34d2('0x5')]['id']);setTimeout(this[_0x34d2('0x7')][_0x34d2('0x8')](this),0x3e8);}else{if(this[_0x34d2('0x2')][_0x34d2('0x13')]||util[_0x34d2('0x14')](this['squeue']['id'],this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']],this['squeue']['channel'],![])){this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']][_0x34d2('0x15')]=!![];this['realtime'][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']][_0x34d2('0x16')]=undefined;util[_0x34d2('0x17')](this[_0x34d2('0x3')],this[_0x34d2('0x4')]['id'],this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']],null,this[_0x34d2('0x2')]);util['writeLog'](this[_0x34d2('0x4')]['id'],this['realtime']['agents'][this[_0x34d2('0x5')]['id']],_0x34d2('0x18')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x34d2('0xe')](_0x34d2('0x19'),this[_0x34d2('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x34d2('0x8')](this),0x3e8);}}};Agent[_0x34d2('0xb')]['handleTimeout']=function(_0x136c6e){if(_['isNil'](this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']])){return logger[_0x34d2('0xe')](_0x34d2('0x12'),this[_0x34d2('0x4')]['id'],this[_0x34d2('0x5')]['id']);}else{logger['info'](_0x34d2('0x1a'),this[_0x34d2('0x4')]['id'],this[_0x34d2('0x5')]['id']);util[_0x34d2('0x1b')](this['notificationId'],this[_0x34d2('0x4')]['id'],this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']],null,this[_0x34d2('0x2')]);this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']][_0x34d2('0x15')]=![];this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']][_0x34d2('0x16')]=undefined;util[_0x34d2('0x1c')](this[_0x34d2('0x4')]['id'],this[_0x34d2('0x6')][_0x34d2('0x11')][this[_0x34d2('0x5')]['id']],_0x136c6e?_0x34d2('0x1d'):_0x34d2('0x1e'));}if(!_0x136c6e){setTimeout(this[_0x34d2('0x7')][_0x34d2('0x8')](this),0x3e8);}};function agent(_0x27b832,_0x2017d6,_0x5b6b2d,_0xe50c1a){return new Agent(_0x27b832,_0x2017d6,_0x5b6b2d,_0xe50c1a);}module[_0x34d2('0x1f')]=agent; \ No newline at end of file +var _0xa9b7=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','isNil','agents','push','forcedOwnership','isAgentAvailable','channel','busy','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime'];(function(_0x1c0680,_0x341710){var _0x1d195f=function(_0x24b1b0){while(--_0x24b1b0){_0x1c0680['push'](_0x1c0680['shift']());}};_0x1d195f(++_0x341710);}(_0xa9b7,0x18a));var _0x7a9b=function(_0x1be07a,_0x50e359){_0x1be07a=_0x1be07a-0x0;var _0x5b7ed5=_0xa9b7[_0x1be07a];return _0x5b7ed5;};'use strict';var _=require(_0x7a9b('0x0'));var uuid=require(_0x7a9b('0x1'));var util=require(_0x7a9b('0x2'));var logger=require(_0x7a9b('0x3'))(_0x7a9b('0x4'));var Agent=function(_0x178381,_0x1653ed,_0x267483,_0x537938){this[_0x7a9b('0x5')]=uuid['v4']();this[_0x7a9b('0x6')]=_0x178381;this[_0x7a9b('0x7')]=_0x1653ed;this[_0x7a9b('0x8')]=_0x267483;this[_0x7a9b('0x4')]=_0x537938;this['squeue']['push'](this[_0x7a9b('0x9')][_0x7a9b('0xa')](this),this[_0x7a9b('0xb')][_0x7a9b('0xa')](this));this[_0x7a9b('0x6')]['on'](_0x7a9b('0xc'),this['handleTimeout'][_0x7a9b('0xa')](this));this[_0x7a9b('0x6')]['on'](_0x7a9b('0xd'),this[_0x7a9b('0xe')][_0x7a9b('0xa')](this));};Agent[_0x7a9b('0xf')]['push']=function(){this[_0x7a9b('0x6')]['push'](this['handleRun'][_0x7a9b('0xa')](this),this[_0x7a9b('0xb')]['bind'](this));};Agent['prototype'][_0x7a9b('0xe')]=function(){this[_0x7a9b('0xb')](!![]);};Agent[_0x7a9b('0xf')]['handleRun']=function(_0x1227d1){logger[_0x7a9b('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x7a9b('0x6')]['id'],this['agent']['id']);if(_[_0x7a9b('0x11')](this['realtime'][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7a9b('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x7a9b('0x13')][_0x7a9b('0xa')](this),0x3e8);}else{if(this[_0x7a9b('0x4')][_0x7a9b('0x14')]||util[_0x7a9b('0x15')](this[_0x7a9b('0x6')]['id'],this[_0x7a9b('0x8')][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']],this['squeue'][_0x7a9b('0x16')],![])){this[_0x7a9b('0x8')]['agents'][this[_0x7a9b('0x7')]['id']][_0x7a9b('0x17')]=!![];this[_0x7a9b('0x8')]['agents'][this[_0x7a9b('0x7')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this[_0x7a9b('0x6')]['id'],this[_0x7a9b('0x8')][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']],null,this[_0x7a9b('0x4')]);util[_0x7a9b('0x18')](this['squeue']['id'],this[_0x7a9b('0x8')]['agents'][this[_0x7a9b('0x7')]['id']],_0x7a9b('0x19')+(this['routing'][_0x7a9b('0x14')]?_0x7a9b('0x1a'):''));}else{logger[_0x7a9b('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x7a9b('0x6')]['id'],this[_0x7a9b('0x7')]['id']);setTimeout(this['push'][_0x7a9b('0xa')](this),0x3e8);}}};Agent[_0x7a9b('0xf')]['handleTimeout']=function(_0x2dc3e2){if(_[_0x7a9b('0x11')](this['realtime'][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']])){return logger[_0x7a9b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7a9b('0x6')]['id'],this[_0x7a9b('0x7')]['id']);}else{logger[_0x7a9b('0x10')](_0x7a9b('0x1b'),this[_0x7a9b('0x6')]['id'],this[_0x7a9b('0x7')]['id']);util[_0x7a9b('0x1c')](this[_0x7a9b('0x5')],this[_0x7a9b('0x6')]['id'],this['realtime'][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']],null,this[_0x7a9b('0x4')]);this[_0x7a9b('0x8')][_0x7a9b('0x12')][this['agent']['id']][_0x7a9b('0x17')]=![];this[_0x7a9b('0x8')][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']][_0x7a9b('0x1d')]=undefined;util[_0x7a9b('0x18')](this['squeue']['id'],this[_0x7a9b('0x8')][_0x7a9b('0x12')][this[_0x7a9b('0x7')]['id']],_0x2dc3e2?_0x7a9b('0x1e'):'TIMEOUT');}if(!_0x2dc3e2){setTimeout(this[_0x7a9b('0x13')]['bind'](this),0x3e8);}};function agent(_0x5a41e4,_0x550a26,_0x5f4320,_0x185e6b){return new Agent(_0x5a41e4,_0x550a26,_0x5f4320,_0x185e6b);}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 88c9040..0d68690 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 _0x3c86=['../../../../../config/logger','routing','queue','handleRun','bind','handleTimeout','squeue','timeout','drained','handleDrained','push','prototype','isNil','Agents','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','notificationId','[%s][QUEUE]\x20EMPTY','length','STOP','TIMEOUT','busy','exports','lodash','uuid','./util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3c86,0x168));var _0x63c8=function(_0x218549,_0x8e520b){_0x218549=_0x218549-0x0;var _0xf5c348=_0x3c86[_0x218549];return _0xf5c348;};'use strict';var _=require(_0x63c8('0x0'));var uuid=require(_0x63c8('0x1'));var util=require(_0x63c8('0x2'));var logger=require(_0x63c8('0x3'))(_0x63c8('0x4'));var Beepall=function(_0x4f5ae2,_0x55fa5c,_0x2f30a5,_0x34f276){this['notificationId']=uuid['v4']();this['squeue']=_0x4f5ae2;this[_0x63c8('0x5')]=_0x55fa5c;this['realtime']=_0x2f30a5;this[_0x63c8('0x4')]=_0x34f276;this['squeue']['push'](this[_0x63c8('0x6')][_0x63c8('0x7')](this),this[_0x63c8('0x8')][_0x63c8('0x7')](this));this[_0x63c8('0x9')]['on'](_0x63c8('0xa'),this[_0x63c8('0x8')][_0x63c8('0x7')](this));this[_0x63c8('0x9')]['on'](_0x63c8('0xb'),this[_0x63c8('0xc')][_0x63c8('0x7')](this));};Beepall['prototype']['push']=function(){this[_0x63c8('0x9')][_0x63c8('0xd')](this['handleRun']['bind'](this),this[_0x63c8('0x8')]['bind'](this));};Beepall[_0x63c8('0xe')][_0x63c8('0xc')]=function(_0x52fe5f){this[_0x63c8('0x8')](!![]);};Beepall[_0x63c8('0xe')][_0x63c8('0x6')]=function(_0x16a89d){var _0x5c32e3=!![];if(!_[_0x63c8('0xf')](this['queue'])&&!_[_0x63c8('0xf')](this[_0x63c8('0x5')][_0x63c8('0x10')])&&this[_0x63c8('0x5')]['Agents']['length']>0x0){for(var _0x4f76ca=0x0,_0x21392a;_0x4f76ca0x0){for(var _0x4cf808=0x0,_0x157a00;_0x4cf8080x0&&_0x2d2120[_0x237e45+'CurrentCapacity']>=_0x2d2120[_0x237e45+_0x75bb('0x1c')]){writeLog(_0x3ecfe1,_0x2d2120,_0x237e45['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x75bb('0x1f')]=function(_0x46edee,_0x59769b,_0x136fb7,_0x6b6052,_0x596401){return sendNotification(!![],_0x46edee,_0x59769b,_0x136fb7,_0x6b6052,_0x596401);};exports['hideNotification']=function(_0x1c308b,_0x4e21d8,_0x4e7866,_0x434116,_0x391b89){return sendNotification(![],_0x1c308b,_0x4e21d8,_0x4e7866,_0x434116,_0x391b89);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x9265=['hasOwnProperty','CurrentCapacity','showNotification','hideNotification','lodash','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity'];(function(_0x33fcff,_0x364059){var _0x260532=function(_0x2b08b0){while(--_0x2b08b0){_0x33fcff['push'](_0x33fcff['shift']());}};_0x260532(++_0x364059);}(_0x9265,0x1dd));var _0x5926=function(_0x31398a,_0x4a4125){_0x31398a=_0x31398a-0x0;var _0x170508=_0x9265[_0x31398a];return _0x170508;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require(_0x5926('0x1'));var Redis=require(_0x5926('0x2'));var config=require(_0x5926('0x3'));var logger=require(_0x5926('0x4'))(_0x5926('0x5'));config[_0x5926('0x6')]=_[_0x5926('0x7')](config[_0x5926('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5926('0x8'))(new Redis(config[_0x5926('0x6')]));function emit(_0x1412e6,_0x48c92a,_0xf199be){io['to'](_0x1412e6)[_0x5926('0x9')](_0x48c92a,_0xf199be);}function sendNotification(_0x41e435,_0x2e8480,_0x4596b5,_0x1fb97c,_0x1bb852,_0x2414ed){io['to'](util[_0x5926('0xa')](_0x5926('0xb'),_0x1fb97c[_0x5926('0xc')]))['emit'](_0x5926('0xd'),_0x1fb97c);var _0x4b707d=_0x2414ed||{};var _0x539ea9=_0x4596b5[_0x5926('0xe')]('.');var _0x507a42={'uniqueid':_0x2e8480,'channel':_0x539ea9[0x0],'id':_0x539ea9[0x1],'title':_0x539ea9[0x0]+_0x5926('0xf'),'interactionId':_0x539ea9[0x2],'queue':_0x1bb852?_0x1bb852[_0x5926('0xc')]:null,'sound':_0x4b707d[_0x5926('0x10')][_0x5926('0x11')],'shake':_0x4b707d[_0x5926('0x10')][_0x5926('0x12')]};try{if(!_0x4b707d[_0x5926('0x13')]){_0x4b707d[_0x5926('0x13')]={};}if(_0x1bb852){_0x4b707d[_0x5926('0x13')]['queue']=_0x1bb852;}else if(_0x4b707d[_0x5926('0x13')][_0x5926('0x14')]){delete _0x4b707d[_0x5926('0x13')][_0x5926('0x14')];}_0x507a42[_0x5926('0x15')]=utils['getMustacheRender'](_0x4b707d[_0x5926('0x10')][_0x5926('0x16')],_0x4b707d);}catch(_0x393363){_0x507a42[_0x5926('0x15')]=_0x5926('0x17');logger[_0x5926('0x18')](util[_0x5926('0xa')](_0x5926('0x19'),_0x2e8480,_0x393363['message']));}io['to'](util[_0x5926('0xa')](_0x5926('0xb'),_0x1fb97c['name']))[_0x5926('0x9')](util[_0x5926('0xa')](_0x5926('0x1a'),_0x41e435?_0x5926('0x1b'):_0x5926('0x1c')),_0x507a42);}function writeLog(_0x3d67b3,_0x53eb2c,_0x3605fa){return logger[_0x5926('0x1d')](util[_0x5926('0xa')](_0x5926('0x1e'),_0x3d67b3,_0x53eb2c[_0x5926('0xc')],_0x3605fa));}exports[_0x5926('0x1f')]=function(_0x2dab0e,_0x27d392,_0x3ccbd6,_0x2867fa){if(_0x27d392[_0x5926('0x20')]){writeLog(_0x2dab0e,_0x27d392,_0x5926('0x21'));return![];}if(!_0x27d392[_0x5926('0x22')]){writeLog(_0x2dab0e,_0x27d392,_0x5926('0x23'));return![];}if(_0x27d392[_0x3ccbd6+_0x5926('0x24')]){writeLog(_0x2dab0e,_0x27d392,_0x5926('0x25'));return![];}if(_0x2867fa&&_0x27d392['hasOwnProperty'](_0x3ccbd6+_0x5926('0x26'))&&_0x27d392[_0x5926('0x27')](_0x3ccbd6+'CurrentCapacity')){if(_0x27d392[_0x3ccbd6+'Capacity']>0x0&&_0x27d392[_0x3ccbd6+_0x5926('0x28')]>=_0x27d392[_0x3ccbd6+_0x5926('0x26')]){writeLog(_0x2dab0e,_0x27d392,_0x3ccbd6['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5926('0x29')]=function(_0x4eaf1a,_0x5d3baa,_0x4d4e20,_0x59c735,_0x3832ef){return sendNotification(!![],_0x4eaf1a,_0x5d3baa,_0x4d4e20,_0x59c735,_0x3832ef);};exports[_0x5926('0x2a')]=function(_0x117d75,_0x483c71,_0x51ae75,_0x24caa4,_0x481356){return sendNotification(![],_0x117d75,_0x483c71,_0x51ae75,_0x24caa4,_0x481356);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 6a508ff..398d1df 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 _0xff1a=['validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','stringify'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xff1a,0x6c));var _0xaff1=function(_0xae541d,_0xa6e54b){_0xae541d=_0xae541d-0x0;var _0x55cac7=_0xff1a[_0xae541d];return _0x55cac7;};'use strict';var schema=require(_0xaff1('0x0'));var sh=require(_0xaff1('0x1'));var _=require(_0xaff1('0x2'));var utils=require(_0xaff1('0x3'));var logger=require('../../../../config/logger')(_0xaff1('0x4'));var system=schema({'command':{'type':_0xaff1('0x5'),'required':!![],'message':_0xaff1('0x6')}});exports['consequence']=function(_0x374123,_0x397c3c){return function(_0x403b8a){try{var _0x14eb4e={'command':_0x397c3c[0x0]};var _0x508fcb=system[_0xaff1('0x0')](_0x14eb4e,{'typecast':!![]});if(_0x508fcb[_0xaff1('0x7')]){logger['error'](_0xaff1('0x8'),_0x374123,_[_0xaff1('0x9')](_0x508fcb,_0xaff1('0xa'))[_0xaff1('0xb')](',\x20'));logger[_0xaff1('0xc')](_0xaff1('0xd'),_0x374123);_0x403b8a[_0xaff1('0xe')]();}else{var _0x5155b3=this;var _0x503b75=utils[_0xaff1('0xf')](_0x397c3c[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x374123,_0x503b75);sh[_0xaff1('0x10')](_[_0xaff1('0x11')](_0x503b75),function(_0x1a375d,_0x5b26f6){logger[_0xaff1('0xc')](_0xaff1('0x12'),_0x374123,_0x1a375d);if(_0x1a375d==0x0){var _0x4d578c=_0x5b26f6[_0xaff1('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xaff1('0x14')](_0x397c3c[0x1])||_[_0xaff1('0x15')](_0x397c3c[0x1])){logger[_0xaff1('0xc')](_0xaff1('0x16'),_0x374123);_0x5155b3['body'][_0x397c3c[0x1]]=_0x4d578c;}else{logger[_0xaff1('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x374123,_0x397c3c[0x1],_0x4d578c);_0x5155b3[_0xaff1('0x17')][_0x397c3c[0x1]]=_0x4d578c;}}_0x403b8a[_0xaff1('0xe')]();});}}catch(_0x2d1039){logger[_0xaff1('0x18')](_0xaff1('0x8'),_0x374123,_[_0xaff1('0x19')](_0x2d1039)?JSON[_0xaff1('0x1a')](_0x2d1039):_0x2d1039);logger[_0xaff1('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x374123);_0x403b8a[_0xaff1('0xe')]();}};}; \ No newline at end of file +var _0xfbf4=['isNil','isEmpty','body','next','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf4,0x13b));var _0x4fbf=function(_0x187feb,_0x4e248c){_0x187feb=_0x187feb-0x0;var _0x4705c2=_0xfbf4[_0x187feb];return _0x4705c2;};'use strict';var schema=require(_0x4fbf('0x0'));var sh=require(_0x4fbf('0x1'));var _=require(_0x4fbf('0x2'));var utils=require(_0x4fbf('0x3'));var logger=require(_0x4fbf('0x4'))(_0x4fbf('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x2317ec,_0x4e8f18){return function(_0x35ff4f){try{var _0x18a67c={'command':_0x4e8f18[0x0]};var _0x4ab698=system[_0x4fbf('0x0')](_0x18a67c,{'typecast':!![]});if(_0x4ab698[_0x4fbf('0x6')]){logger['error'](_0x4fbf('0x7'),_0x2317ec,_['map'](_0x4ab698,_0x4fbf('0x8'))['join'](',\x20'));logger[_0x4fbf('0x9')](_0x4fbf('0xa'),_0x2317ec);_0x35ff4f['next']();}else{var _0x246c3c=this;var _0x22db1c=utils[_0x4fbf('0xb')](_0x4e8f18[0x0],this);logger[_0x4fbf('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2317ec,_0x22db1c);sh[_0x4fbf('0xc')](_['trim'](_0x22db1c),function(_0x35db24,_0x372f12){logger['info'](_0x4fbf('0xd'),_0x2317ec,_0x35db24);if(_0x35db24==0x0){var _0x3c7436=_0x372f12[_0x4fbf('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x4fbf('0xf')](_0x4e8f18[0x1])||_[_0x4fbf('0x10')](_0x4e8f18[0x1])){logger[_0x4fbf('0x9')]('[%s][SYSTEM]\x20no\x20variable',_0x2317ec);_0x246c3c[_0x4fbf('0x11')][_0x4e8f18[0x1]]=_0x3c7436;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2317ec,_0x4e8f18[0x1],_0x3c7436);_0x246c3c[_0x4fbf('0x11')][_0x4e8f18[0x1]]=_0x3c7436;}}_0x35ff4f[_0x4fbf('0x12')]();});}}catch(_0x50907d){logger[_0x4fbf('0x13')](_0x4fbf('0x7'),_0x2317ec,_[_0x4fbf('0x14')](_0x50907d)?JSON[_0x4fbf('0x15')](_0x50907d):_0x50907d);logger['info'](_0x4fbf('0xa'),_0x2317ec);_0x35ff4f[_0x4fbf('0x12')]();}};}; \ 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 2279889..4615c16 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 _0x3342=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3342,0x16d));var _0x2334=function(_0x3468ec,_0x1b3446){_0x3468ec=_0x3468ec-0x0;var _0x526185=_0x3342[_0x3468ec];return _0x526185;};'use strict';var schema=require('validate');var _=require(_0x2334('0x0'));var rpc={'chatInteraction':require(_0x2334('0x1')),'openchannelInteraction':require(_0x2334('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2334('0x3')),'faxInteraction':require(_0x2334('0x4')),'whatsappInteraction':require(_0x2334('0x5'))};var logger=require(_0x2334('0x6'))(_0x2334('0x7'));var tag=schema({'tag':{'type':_0x2334('0x8'),'required':!![],'message':_0x2334('0x9')}});exports[_0x2334('0xa')]=function(_0x28fbd1,_0x23bc86,_0x1e45cb,_0x3ee9e3){return function(_0x24350a){try{var _0x311e23={'tag':_0x23bc86[0x0]};var _0x55d098=tag[_0x2334('0xb')](_0x311e23,{'typecast':!![]});if(_0x55d098[_0x2334('0xc')]){logger[_0x2334('0xd')](_0x2334('0xe'),_0x28fbd1,_[_0x2334('0xf')](_0x55d098,_0x2334('0x10'))[_0x2334('0x11')](',\x20'));logger[_0x2334('0x12')](_0x2334('0x13'),_0x28fbd1);_0x24350a[_0x2334('0x14')]();}else{var _0x49c8aa={'ids':[_0x23bc86[0x0]]};if(rpc[_0x3ee9e3[_0x2334('0x15')]+'Interaction']){rpc[_0x3ee9e3['channel']+_0x2334('0x16')][_0x2334('0x17')](_0x3ee9e3[_0x2334('0x18')]['id'],_0x49c8aa)[_0x2334('0x19')](function(_0x2e8249){logger[_0x2334('0x12')](_0x2334('0x1a'),_0x28fbd1,_0x23bc86[0x1],_0x3ee9e3['channel'],_0x3ee9e3[_0x2334('0x18')]['id']);})['catch'](function(_0x47f648){logger['error'](_0x2334('0xe'),_0x28fbd1,JSON['stringify'](_0x47f648));logger[_0x2334('0x12')](_0x2334('0x13'),_0x28fbd1);})[_0x2334('0x1b')](function(){_0x24350a[_0x2334('0x14')]();});}}}catch(_0x1d821b){logger['error'](_0x2334('0xe'),_0x28fbd1,_[_0x2334('0x1c')](_0x1d821b)?JSON[_0x2334('0x1d')](_0x1d821b):_0x1d821b);logger[_0x2334('0x12')](_0x2334('0x13'),_0x28fbd1);_0x24350a['next']();}};}; \ No newline at end of file +var _0xbef5=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xbef5,0x154));var _0x5bef=function(_0x3a1fa0,_0x4decc7){_0x3a1fa0=_0x3a1fa0-0x0;var _0x2dea9b=_0xbef5[_0x3a1fa0];return _0x2dea9b;};'use strict';var schema=require(_0x5bef('0x0'));var _=require(_0x5bef('0x1'));var rpc={'chatInteraction':require(_0x5bef('0x2')),'openchannelInteraction':require(_0x5bef('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5bef('0x4')),'faxInteraction':require(_0x5bef('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5bef('0x6'))(_0x5bef('0x7'));var tag=schema({'tag':{'type':_0x5bef('0x8'),'required':!![],'message':_0x5bef('0x9')}});exports[_0x5bef('0xa')]=function(_0x16bb1c,_0x33f635,_0x20a1cf,_0x700318){return function(_0x24ca9d){try{var _0x3f6ff0={'tag':_0x33f635[0x0]};var _0x52003f=tag[_0x5bef('0x0')](_0x3f6ff0,{'typecast':!![]});if(_0x52003f[_0x5bef('0xb')]){logger[_0x5bef('0xc')](_0x5bef('0xd'),_0x16bb1c,_[_0x5bef('0xe')](_0x52003f,_0x5bef('0xf'))[_0x5bef('0x10')](',\x20'));logger[_0x5bef('0x11')](_0x5bef('0x12'),_0x16bb1c);_0x24ca9d[_0x5bef('0x13')]();}else{var _0x140337={'ids':[_0x33f635[0x0]]};if(rpc[_0x700318[_0x5bef('0x14')]+_0x5bef('0x15')]){rpc[_0x700318[_0x5bef('0x14')]+_0x5bef('0x15')]['addTags'](_0x700318[_0x5bef('0x16')]['id'],_0x140337)[_0x5bef('0x17')](function(_0x1fe614){logger[_0x5bef('0x11')](_0x5bef('0x18'),_0x16bb1c,_0x33f635[0x1],_0x700318[_0x5bef('0x14')],_0x700318[_0x5bef('0x16')]['id']);})[_0x5bef('0x19')](function(_0x1d9b20){logger[_0x5bef('0xc')](_0x5bef('0xd'),_0x16bb1c,JSON[_0x5bef('0x1a')](_0x1d9b20));logger[_0x5bef('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x16bb1c);})['finally'](function(){_0x24ca9d[_0x5bef('0x13')]();});}}}catch(_0x49cd98){logger[_0x5bef('0xc')](_0x5bef('0xd'),_0x16bb1c,_[_0x5bef('0x1b')](_0x49cd98)?JSON[_0x5bef('0x1a')](_0x49cd98):_0x49cd98);logger[_0x5bef('0x11')](_0x5bef('0x12'),_0x16bb1c);_0x24ca9d[_0x5bef('0x13')]();}};}; \ 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 9bbcc71..10dc5b4 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 _0x0a9a=['interaction','list','lodash','render','merge','contact','message'];(function(_0x5a3d65,_0x2a0ad8){var _0x5f1d6b=function(_0x15c1a8){while(--_0x15c1a8){_0x5a3d65['push'](_0x5a3d65['shift']());}};_0x5f1d6b(++_0x2a0ad8);}(_0x0a9a,0x183));var _0xa0a9=function(_0x56f616,_0x56b793){_0x56f616=_0x56f616-0x0;var _0x35dcf2=_0x0a9a[_0x56f616];return _0x35dcf2;};'use strict';var Mustache=require('mustache');var _=require(_0xa0a9('0x0'));module['exports']={'getMustacheRender':function(_0x3b1a40,_0x3cff22){return Mustache[_0xa0a9('0x1')](_0x3b1a40,_[_0xa0a9('0x2')](_0x3cff22['body'],{'contact':_0x3cff22[_0xa0a9('0x3')],'message':_0x3cff22[_0xa0a9('0x4')],'account':_0x3cff22['account'],'interaction':_0x3cff22[_0xa0a9('0x5')],'list':_0x3cff22[_0xa0a9('0x6')]}))||'';}}; \ No newline at end of file +var _0xb2ef=['render','merge','contact','message','account','interaction','list','mustache','lodash','exports'];(function(_0x53ebc4,_0x2c21a7){var _0x48ee81=function(_0xc2fb9){while(--_0xc2fb9){_0x53ebc4['push'](_0x53ebc4['shift']());}};_0x48ee81(++_0x2c21a7);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x5887b3,_0x10c76e){_0x5887b3=_0x5887b3-0x0;var _0x547b6b=_0xb2ef[_0x5887b3];return _0x547b6b;};'use strict';var Mustache=require(_0xfb2e('0x0'));var _=require(_0xfb2e('0x1'));module[_0xfb2e('0x2')]={'getMustacheRender':function(_0x4a8080,_0x1e4d1c){return Mustache[_0xfb2e('0x3')](_0x4a8080,_[_0xfb2e('0x4')](_0x1e4d1c['body'],{'contact':_0x1e4d1c[_0xfb2e('0x5')],'message':_0x1e4d1c[_0xfb2e('0x6')],'account':_0x1e4d1c[_0xfb2e('0x7')],'interaction':_0x1e4d1c[_0xfb2e('0x8')],'list':_0x1e4d1c[_0xfb2e('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8984c86..2c44d2c 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 _0xcac9=['priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','TagId','%s:%s:%s','./interval','condition','intervals','./applications/'];(function(_0x3cf349,_0x103264){var _0x332600=function(_0x1c9bed){while(--_0x1c9bed){_0x3cf349['push'](_0x3cf349['shift']());}};_0x332600(++_0x103264);}(_0xcac9,0x199));var _0x9cac=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xcac9[_0x10d670];return _0x20d6f8;};'use strict';var _=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var path=require(_0x9cac('0x2'));var fs=require('fs');var jayson=require(_0x9cac('0x3'));var BPromise=require('bluebird');var uuid=require(_0x9cac('0x4'));var config=require('../../../config/environment');var logger=require(_0x9cac('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x9cac('0x6')),'mailQueueReport':require(_0x9cac('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9cac('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x9cac('0x9'))};var RuleEngine=require(_0x9cac('0xa'));function getId(_0x1566e3,_0x28faa9,_0x5c9165){return util['format']('%s.%s.%s',_0x1566e3,_0x28faa9||0x0,_0x5c9165||0x0);}function getIntervals(_0x9cc6ab,_0x4de1e9){var _0x5d4469=[];if(!_[_0x9cac('0xb')](_0x4de1e9[_0x9cac('0xc')])&&!_[_0x9cac('0xb')](_0x9cc6ab[_0x4de1e9[_0x9cac('0xc')]])&&!_[_0x9cac('0xb')](_0x9cc6ab[_0x4de1e9[_0x9cac('0xc')]][_0x9cac('0xd')])){_0x5d4469=_[_0x9cac('0xe')](_0x9cc6ab[_0x4de1e9[_0x9cac('0xc')]][_0x9cac('0xd')],_0x9cac('0xf'));}else if(!_[_0x9cac('0xb')](_0x4de1e9['interval'])){_0x5d4469=[_0x4de1e9['interval']];}return _0x5d4469;}exports['listen']=function(_0x56813d){_0x56813d[_0x9cac('0x10')]={};return new BPromise(function(_0x2ebff6,_0x471b7d){var _0x5d29c5={'Start':function(_0x4ed8fa){var _0x59e01d=this;return new Promise(function(_0xbdac46,_0x2ef10a){if(_0x4ed8fa){try{var _0x9c05c8=[];var _0x574230=getId(_0x4ed8fa[_0x9cac('0x11')],_0x4ed8fa[_0x9cac('0x12')]?_0x4ed8fa['message']['id']:0x0,_0x4ed8fa['interaction']?_0x4ed8fa[_0x9cac('0x13')]['id']:0x0);if(_0x4ed8fa[_0x9cac('0x14')]&&_[_0x9cac('0x15')](_0x4ed8fa[_0x9cac('0x14')])&&_0x4ed8fa['applications'][_0x9cac('0x16')]){for(var _0x8e4f4f=0x0;_0x8e4f4f<_0x4ed8fa['applications'][_0x9cac('0x16')];_0x8e4f4f+=0x1){var _0xe67d38=_0x4ed8fa[_0x9cac('0x14')][_0x8e4f4f];if(fs[_0x9cac('0x17')](path[_0x9cac('0x18')](__dirname,_0x9cac('0x14'),_0xe67d38[_0x9cac('0x19')]+_0x9cac('0x1a')))){var _0x374013=[];switch(_0xe67d38['app'][_0x9cac('0x1b')]()){case _0x9cac('0x1c'):var _0x2d680c=_0xe67d38[_0x9cac('0x1d')][_0x9cac('0x1e')](',');_0x374013[_0x9cac('0x1f')](_0x2d680c[0x0]);_0x374013['push'](_0x2d680c[_0x9cac('0x20')](0x1,_0x2d680c['length'])[_0x9cac('0x18')](','));break;case _0x9cac('0x21'):var _0xa671cd=_0xe67d38[_0x9cac('0x1d')]['split'](',');_0x374013[_0x9cac('0x1f')](_0xa671cd[0x0]);_0x374013[_0x9cac('0x1f')](_0xa671cd[0x1]);_0x374013[_0x9cac('0x1f')](_0xa671cd['slice'](0x2,_0xa671cd[_0x9cac('0x16')])[_0x9cac('0x18')](','));break;case _0x9cac('0x22'):var _0x53c278=_0xe67d38[_0x9cac('0x1d')][_0x9cac('0x1e')](',');_0x374013['push'](_0x53c278[0x0]);_0x374013['push'](_0x53c278[0x1]);_0x374013[_0x9cac('0x1f')](_0x53c278[0x2]);_0x374013['push'](_0x53c278[0x3]);_0x374013[_0x9cac('0x1f')](_0x53c278[_0x9cac('0x20')](0x4,_0x53c278[_0x9cac('0x16')])[_0x9cac('0x18')](','));break;case _0x9cac('0x12'):_0x374013[_0x9cac('0x1f')](_0xe67d38[_0x9cac('0x1d')]);break;case'tag':_0x374013[_0x9cac('0x1f')](_0xe67d38[_0x9cac('0x23')]);_0x374013[_0x9cac('0x1f')](_0xe67d38[_0x9cac('0x1d')]);break;default:_0x374013=_[_0x9cac('0xb')](_0xe67d38[_0x9cac('0x1d')])?[]:_0xe67d38[_0x9cac('0x1d')][_0x9cac('0x1e')](',');}var _0x5130e2={'id':util['format'](_0x9cac('0x24'),_0x574230,_0xe67d38['id'],_0xe67d38[_0x9cac('0x19')]),'condition':require(_0x9cac('0x25'))[_0x9cac('0x26')](_0x574230,getIntervals(_0x56813d[_0x9cac('0x27')],_0xe67d38),_0x56813d),'consequence':require(_0x9cac('0x28')+_0xe67d38['app'])['consequence'](_0x574230,_0x374013,_0x56813d,_0x4ed8fa),'p':_0xe67d38[_0x9cac('0x29')]||0x0};logger[_0x9cac('0x2a')](_0x9cac('0x2b'),_0x5130e2['id'],_0x9cac('0x2c'),getIntervals(_0x56813d['intervals'],_0xe67d38)[_0x9cac('0x18')](_0x9cac('0x2d')));_0x9c05c8[_0x9cac('0x1f')](_0x5130e2);}else{logger[_0x9cac('0x2e')](_0x9cac('0x2f'),path[_0x9cac('0x18')](__dirname,_0x9cac('0x14'),_0xe67d38['app']+'.js'));}}_0x56813d[_0x9cac('0x10')][_0x574230]=new RuleEngine(_0x9c05c8);_0x56813d[_0x9cac('0x10')][_0x574230][_0x9cac('0x30')](_0x4ed8fa,function(_0x24d7c6){logger[_0x9cac('0x2a')]('Applications\x20executed',JSON[_0x9cac('0x31')](_0x24d7c6[_0x9cac('0x32')]));if(_0x56813d[_0x9cac('0x10')][_0x574230]){_0x56813d['rules'][_0x574230][_0x9cac('0x33')](_0x9cac('0x34'));}});return _0xbdac46({'code':0xc8,'message':_0x4ed8fa});}else{logger[_0x9cac('0x2a')](_0x9cac('0x35'));return _0xbdac46({'code':0xc8,'message':_0x4ed8fa});}}catch(_0x25c030){logger[_0x9cac('0x2e')](_0x25c030[_0x9cac('0x36')]);return _0x2ef10a(_0x59e01d[_0x9cac('0x2e')](0x1f4,_0x25c030));}}return _0x2ef10a(_0x9cac('0x37'));});},'AcceptMessage':function(_0x3198da){var _0x4117c6=this;return new Promise(function(_0x142262,_0x2d258e){if(_0x3198da[_0x9cac('0x12')]&&_0x3198da['message']['id']){try{var _0x4a48ce=getId(_0x3198da[_0x9cac('0x11')],_0x3198da[_0x9cac('0x12')]?_0x3198da[_0x9cac('0x12')]['id']:0x0,_0x3198da['interaction']?_0x3198da[_0x9cac('0x13')]['id']:0x0);if(_0x56813d[_0x9cac('0x10')][_0x4a48ce]){_0x56813d[_0x9cac('0x10')][_0x4a48ce][_0x9cac('0x33')](_0x9cac('0x38'));if(rpc[_0x3198da[_0x9cac('0x11')]+'QueueReport']){rpc[_0x3198da[_0x9cac('0x11')]+'QueueReport'][_0x9cac('0x39')](_0x4a48ce,{'UserId':_0x3198da[_0x9cac('0x12')][_0x9cac('0x3a')]})[_0x9cac('0x3b')](function(_0x2853c1){logger[_0x9cac('0x2e')](_0x9cac('0x3c'));});}}return _0x142262({'code':0xc8,'message':_0x3198da});}catch(_0x5cc044){logger[_0x9cac('0x2e')](_0x5cc044['stack']);return _0x2d258e(_0x4117c6[_0x9cac('0x2e')](0x1f4,_0x5cc044));}}logger['error'](_0x9cac('0x3d'));return _0x2d258e(_0x4117c6['error'](0x1f4,_0x9cac('0x3d')));});},'RejectMessage':function(_0x12a0a4){var _0xc45d12=this;return new Promise(function(_0x43fb51,_0x11a1b6){if(_0x12a0a4[_0x9cac('0x3e')]&&_0x12a0a4['agent']['id']){try{if(_0x56813d[_0x9cac('0x3f')][_0x12a0a4[_0x9cac('0x3e')]['id']]){_0x56813d['agents'][_0x12a0a4['agent']['id']][_0x9cac('0x40')]=![];_0x56813d[_0x9cac('0x3f')][_0x12a0a4[_0x9cac('0x3e')]['id']][_0x9cac('0x41')]=undefined;}return _0x43fb51({'code':0xc8,'message':_0x12a0a4});}catch(_0x5b042f){logger[_0x9cac('0x2e')](_0x5b042f[_0x9cac('0x36')]);return _0x11a1b6(_0xc45d12[_0x9cac('0x2e')](0x1f4,_0x5b042f));}}logger[_0x9cac('0x2e')]('message\x20is\x20empty');return _0x11a1b6(_0xc45d12[_0x9cac('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x58ef35){var _0x12dbdc=this;return new Promise(function(_0x54d41f,_0xa25613){if(_0x58ef35['channel']&&_0x58ef35[_0x9cac('0x13')]&&_0x58ef35[_0x9cac('0x13')]['id']){try{var _0x198492=getId(_0x58ef35[_0x9cac('0x11')],_0x58ef35[_0x9cac('0x12')]?_0x58ef35['message']['id']:0x0,_0x58ef35[_0x9cac('0x13')]?_0x58ef35[_0x9cac('0x13')]['id']:0x0);if(_0x56813d['rules'][_0x198492]){_0x56813d[_0x9cac('0x10')][_0x198492][_0x9cac('0x33')]('end');}return _0x54d41f({'code':0xc8,'message':_0x58ef35});}catch(_0x17a1f6){logger['error'](_0x17a1f6['stack']);return _0xa25613(_0x12dbdc[_0x9cac('0x2e')](0x1f4,_0x17a1f6));}}logger[_0x9cac('0x2e')]('message\x20is\x20empty');return _0xa25613(_0x12dbdc[_0x9cac('0x2e')](0x1f4,_0x9cac('0x3d')));});},'AgentCapacity':function(_0x192e1a){var _0x50eac1=this;return new Promise(function(_0x5b6e98,_0x2a9875){if(_0x56813d[_0x9cac('0x3f')][_0x9cac('0x42')](_0x192e1a['id'])){for(var _0x12d93b in _0x192e1a[_0x9cac('0x43')]){if(_0x192e1a[_0x9cac('0x43')]['hasOwnProperty'](_0x12d93b)){if(_0x56813d['agents'][_0x192e1a['id']][_0x9cac('0x42')](_0x12d93b+_0x9cac('0x44'))){_0x56813d[_0x9cac('0x3f')][_0x192e1a['id']][_0x12d93b+_0x9cac('0x44')]=parseInt(_0x192e1a[_0x9cac('0x43')][_0x12d93b],0xa);}}}_0x56813d[_0x9cac('0x3f')][_0x192e1a['id']][_0x9cac('0x45')]();return _0x5b6e98({'code':0xc8,'message':_0x56813d[_0x9cac('0x3f')][_0x192e1a['id']]});}else{return _0x2a9875(_0x50eac1[_0x9cac('0x2e')](0x1f4,_0x9cac('0x46')));}});},'Agents':function(_0x29dcf0){return new Promise(function(_0x2be5fb,_0x39f7ba){var _0x28c8f0=_['values'](_0x56813d[_0x9cac('0x3f')]);_0x2be5fb({'count':_0x28c8f0[_0x9cac('0x16')],'rows':_0x28c8f0});});},'ChatQueues':function(_0x13ef26){return new Promise(function(_0x553fe8,_0x210690){var _0x17c6c7=[];for(var _0xf0eb6c in _0x56813d[_0x9cac('0x47')]){if(_0x56813d[_0x9cac('0x47')][_0x9cac('0x42')](_0xf0eb6c)){var _0x4b0ee7=_0x56813d[_0x9cac('0x47')][_0xf0eb6c];var _0xa7c977={'id':_0x4b0ee7['id'],'available':_0x4b0ee7['available'],'loggedIn':_0x4b0ee7[_0x9cac('0x48')],'name':_0x4b0ee7[_0x9cac('0x49')],'paused':_0x4b0ee7[_0x9cac('0x4a')],'waiting':_0x4b0ee7[_0x9cac('0x4b')]};_0x17c6c7[_0x9cac('0x1f')](_0xa7c977);}}_0x553fe8({'count':_0x17c6c7[_0x9cac('0x16')],'rows':_0x17c6c7});});},'MailQueues':function(_0x4404a5){return new Promise(function(_0x2ada7b,_0x5450f6){var _0x729365=[];for(var _0x440020 in _0x56813d[_0x9cac('0x4c')]){if(_0x56813d[_0x9cac('0x4c')][_0x9cac('0x42')](_0x440020)){var _0x45a1f3=_0x56813d['mailQueues'][_0x440020];var _0x4ed389={'id':_0x45a1f3['id'],'available':_0x45a1f3['available'],'loggedIn':_0x45a1f3[_0x9cac('0x48')],'name':_0x45a1f3['name'],'paused':_0x45a1f3['paused'],'waiting':_0x45a1f3[_0x9cac('0x4b')]};_0x729365[_0x9cac('0x1f')](_0x4ed389);}}_0x2ada7b({'count':_0x729365[_0x9cac('0x16')],'rows':_0x729365});});},'OpenchannelQueues':function(_0xc24b8b){return new Promise(function(_0xaa428d,_0x3cdf96){var _0x2b3dbb=[];for(var _0x2313b6 in _0x56813d[_0x9cac('0x4d')]){if(_0x56813d[_0x9cac('0x4d')]['hasOwnProperty'](_0x2313b6)){var _0x2c4ae0=_0x56813d[_0x9cac('0x4d')][_0x2313b6];var _0x13e33d={'id':_0x2c4ae0['id'],'available':_0x2c4ae0[_0x9cac('0x4e')],'loggedIn':_0x2c4ae0[_0x9cac('0x48')],'name':_0x2c4ae0[_0x9cac('0x49')],'paused':_0x2c4ae0['paused'],'waiting':_0x2c4ae0[_0x9cac('0x4b')]};_0x2b3dbb[_0x9cac('0x1f')](_0x13e33d);}}_0xaa428d({'count':_0x2b3dbb[_0x9cac('0x16')],'rows':_0x2b3dbb});});},'SmsQueues':function(_0x288133){return new Promise(function(_0x453b98,_0x3ed65f){var _0x21eb10=[];for(var _0x261b13 in _0x56813d[_0x9cac('0x4f')]){if(_0x56813d[_0x9cac('0x4f')][_0x9cac('0x42')](_0x261b13)){var _0x2fd54d=_0x56813d[_0x9cac('0x4f')][_0x261b13];var _0x33071f={'id':_0x2fd54d['id'],'available':_0x2fd54d[_0x9cac('0x4e')],'loggedIn':_0x2fd54d[_0x9cac('0x48')],'name':_0x2fd54d['name'],'paused':_0x2fd54d[_0x9cac('0x4a')],'waiting':_0x2fd54d[_0x9cac('0x4b')]};_0x21eb10[_0x9cac('0x1f')](_0x33071f);}}_0x453b98({'count':_0x21eb10['length'],'rows':_0x21eb10});});},'FaxQueues':function(_0x4a15c6){return new Promise(function(_0x179b65,_0x5acbf5){var _0x1795e9=[];for(var _0x498fc7 in _0x56813d['faxQueues']){if(_0x56813d['faxQueues'][_0x9cac('0x42')](_0x498fc7)){var _0x4d946b=_0x56813d[_0x9cac('0x50')][_0x498fc7];var _0x28530a={'id':_0x4d946b['id'],'available':_0x4d946b[_0x9cac('0x4e')],'loggedIn':_0x4d946b['loggedIn'],'name':_0x4d946b[_0x9cac('0x49')],'paused':_0x4d946b[_0x9cac('0x4a')],'waiting':_0x4d946b[_0x9cac('0x4b')]};_0x1795e9[_0x9cac('0x1f')](_0x28530a);}}_0x179b65({'count':_0x1795e9[_0x9cac('0x16')],'rows':_0x1795e9});});},'WhatsappQueues':function(_0x1bcc0e){return new Promise(function(_0x238b42,_0x68bb02){var _0x5ae0ec=[];for(var _0x4c94be in _0x56813d[_0x9cac('0x51')]){if(_0x56813d[_0x9cac('0x51')][_0x9cac('0x42')](_0x4c94be)){var _0x2b05bb=_0x56813d['whatsappQueues'][_0x4c94be];var _0x565569={'id':_0x2b05bb['id'],'available':_0x2b05bb[_0x9cac('0x4e')],'loggedIn':_0x2b05bb[_0x9cac('0x48')],'name':_0x2b05bb[_0x9cac('0x49')],'paused':_0x2b05bb[_0x9cac('0x4a')],'waiting':_0x2b05bb[_0x9cac('0x4b')]};_0x5ae0ec[_0x9cac('0x1f')](_0x565569);}}_0x238b42({'count':_0x5ae0ec[_0x9cac('0x16')],'rows':_0x5ae0ec});});},'ChatQueuesWaitingInteractions':function(_0x74485d){return new Promise(function(_0x36d686,_0x4a7ad6){var _0x4e520b=_[_0x9cac('0x52')](_0x56813d['chatQueuesWaitingInteractions']);_0x36d686({'count':_0x4e520b[_0x9cac('0x16')],'rows':_0x4e520b});});},'MailQueuesWaitingInteractions':function(_0x1d2fec){return new Promise(function(_0x52de8e,_0x173bab){var _0x2551b3=_[_0x9cac('0x52')](_0x56813d['mailQueuesWaitingInteractions']);_0x52de8e({'count':_0x2551b3[_0x9cac('0x16')],'rows':_0x2551b3});});},'OpenchannelQueuesWaitingInteractions':function(_0x3d3249){return new Promise(function(_0x4431dd,_0xe35a38){var _0x852e9a=_[_0x9cac('0x52')](_0x56813d[_0x9cac('0x53')]);_0x4431dd({'count':_0x852e9a[_0x9cac('0x16')],'rows':_0x852e9a});});},'SmsQueuesWaitingInteractions':function(_0x2f3b73){return new Promise(function(_0xf5d63,_0x58975e){var _0x5e44b9=_['values'](_0x56813d[_0x9cac('0x54')]);_0xf5d63({'count':_0x5e44b9[_0x9cac('0x16')],'rows':_0x5e44b9});});},'FaxQueuesWaitingInteractions':function(_0x1690eb){return new Promise(function(_0x4a650a,_0x5caa11){var _0x2480ee=_[_0x9cac('0x52')](_0x56813d[_0x9cac('0x55')]);_0x4a650a({'count':_0x2480ee['length'],'rows':_0x2480ee});});},'WhatsappQueuesWaitingInteractions':function(_0x550155){return new Promise(function(_0x2eee5a,_0x3d1857){var _0x27f9db=_[_0x9cac('0x52')](_0x56813d['whatsappQueuesWaitingInteractions']);_0x2eee5a({'count':_0x27f9db[_0x9cac('0x16')],'rows':_0x27f9db});});}};var _0x47ecb1=jayson['server'](_0x5d29c5)['http']();_0x47ecb1['on']('error',function(_0xa32547){logger[_0x9cac('0x2e')](JSON[_0x9cac('0x31')](_0xa32547));return _0x471b7d(_0xa32547);});_0x47ecb1[_0x9cac('0x56')](0x232c,_0x9cac('0x57'),function(){console[_0x9cac('0x58')](_0x9cac('0x59'),0x232c);return _0x2ebff6('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xa4b3=['../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','%s:%s:%s','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','interaction','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agents','agent','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','uuid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4b3,0xb4));var _0x3a4b=function(_0x1fdca6,_0x4985df){_0x1fdca6=_0x1fdca6-0x0;var _0xad87d=_0xa4b3[_0x1fdca6];return _0xad87d;};'use strict';var _=require('lodash');var util=require(_0x3a4b('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x3a4b('0x1'));var BPromise=require(_0x3a4b('0x2'));var uuid=require(_0x3a4b('0x3'));var config=require(_0x3a4b('0x4'));var logger=require(_0x3a4b('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x3a4b('0x6')),'mailQueueReport':require(_0x3a4b('0x7')),'chatQueueReport':require(_0x3a4b('0x8')),'smsQueueReport':require(_0x3a4b('0x9')),'faxQueueReport':require(_0x3a4b('0xa')),'whatsappQueueReport':require(_0x3a4b('0xb'))};var RuleEngine=require(_0x3a4b('0xc'));function getId(_0x1c20ac,_0x46c65c,_0x51c0df){return util[_0x3a4b('0xd')](_0x3a4b('0xe'),_0x1c20ac,_0x46c65c||0x0,_0x51c0df||0x0);}function getIntervals(_0x44fa1a,_0x47d3be){var _0x4e0f4d=[];if(!_[_0x3a4b('0xf')](_0x47d3be[_0x3a4b('0x10')])&&!_[_0x3a4b('0xf')](_0x44fa1a[_0x47d3be[_0x3a4b('0x10')]])&&!_[_0x3a4b('0xf')](_0x44fa1a[_0x47d3be[_0x3a4b('0x10')]][_0x3a4b('0x11')])){_0x4e0f4d=_[_0x3a4b('0x12')](_0x44fa1a[_0x47d3be[_0x3a4b('0x10')]][_0x3a4b('0x11')],_0x3a4b('0x13'));}else if(!_['isNil'](_0x47d3be[_0x3a4b('0x13')])){_0x4e0f4d=[_0x47d3be[_0x3a4b('0x13')]];}return _0x4e0f4d;}exports[_0x3a4b('0x14')]=function(_0x16cf8a){_0x16cf8a[_0x3a4b('0x15')]={};return new BPromise(function(_0x2bdf58,_0x366f81){var _0x1dc6ba={'Start':function(_0x3661d6){var _0x1b67b2=this;return new Promise(function(_0x3e1167,_0x164cc4){if(_0x3661d6){try{var _0x5bca83=[];var _0x4eb37e=getId(_0x3661d6[_0x3a4b('0x16')],_0x3661d6[_0x3a4b('0x17')]?_0x3661d6['message']['id']:0x0,_0x3661d6['interaction']?_0x3661d6['interaction']['id']:0x0);if(_0x3661d6['applications']&&_[_0x3a4b('0x18')](_0x3661d6['applications'])&&_0x3661d6[_0x3a4b('0x19')][_0x3a4b('0x1a')]){for(var _0x5f3c8a=0x0;_0x5f3c8a<_0x3661d6[_0x3a4b('0x19')][_0x3a4b('0x1a')];_0x5f3c8a+=0x1){var _0xf66974=_0x3661d6['applications'][_0x5f3c8a];if(fs['existsSync'](path[_0x3a4b('0x1b')](__dirname,_0x3a4b('0x19'),_0xf66974[_0x3a4b('0x1c')]+_0x3a4b('0x1d')))){var _0x41569d=[];switch(_0xf66974[_0x3a4b('0x1c')][_0x3a4b('0x1e')]()){case _0x3a4b('0x1f'):var _0x31ba77=_0xf66974[_0x3a4b('0x20')]['split'](',');_0x41569d[_0x3a4b('0x21')](_0x31ba77[0x0]);_0x41569d[_0x3a4b('0x21')](_0x31ba77[_0x3a4b('0x22')](0x1,_0x31ba77['length'])[_0x3a4b('0x1b')](','));break;case _0x3a4b('0x23'):var _0x54793c=_0xf66974[_0x3a4b('0x20')][_0x3a4b('0x24')](',');_0x41569d['push'](_0x54793c[0x0]);_0x41569d['push'](_0x54793c[0x1]);_0x41569d[_0x3a4b('0x21')](_0x54793c[_0x3a4b('0x22')](0x2,_0x54793c[_0x3a4b('0x1a')])[_0x3a4b('0x1b')](','));break;case'amazonlex':var _0x44b728=_0xf66974['appdata'][_0x3a4b('0x24')](',');_0x41569d[_0x3a4b('0x21')](_0x44b728[0x0]);_0x41569d[_0x3a4b('0x21')](_0x44b728[0x1]);_0x41569d[_0x3a4b('0x21')](_0x44b728[0x2]);_0x41569d['push'](_0x44b728[0x3]);_0x41569d['push'](_0x44b728[_0x3a4b('0x22')](0x4,_0x44b728['length'])[_0x3a4b('0x1b')](','));break;case _0x3a4b('0x17'):_0x41569d[_0x3a4b('0x21')](_0xf66974[_0x3a4b('0x20')]);break;case'tag':_0x41569d[_0x3a4b('0x21')](_0xf66974['TagId']);_0x41569d[_0x3a4b('0x21')](_0xf66974[_0x3a4b('0x20')]);break;default:_0x41569d=_[_0x3a4b('0xf')](_0xf66974[_0x3a4b('0x20')])?[]:_0xf66974[_0x3a4b('0x20')][_0x3a4b('0x24')](',');}var _0x349476={'id':util[_0x3a4b('0xd')](_0x3a4b('0x25'),_0x4eb37e,_0xf66974['id'],_0xf66974[_0x3a4b('0x1c')]),'condition':require('./interval')[_0x3a4b('0x26')](_0x4eb37e,getIntervals(_0x16cf8a[_0x3a4b('0x27')],_0xf66974),_0x16cf8a),'consequence':require(_0x3a4b('0x28')+_0xf66974[_0x3a4b('0x1c')])['consequence'](_0x4eb37e,_0x41569d,_0x16cf8a,_0x3661d6),'p':_0xf66974[_0x3a4b('0x29')]||0x0};logger[_0x3a4b('0x2a')](_0x3a4b('0x2b'),_0x349476['id'],_0x3a4b('0x2c'),getIntervals(_0x16cf8a['intervals'],_0xf66974)[_0x3a4b('0x1b')](_0x3a4b('0x2d')));_0x5bca83[_0x3a4b('0x21')](_0x349476);}else{logger[_0x3a4b('0x2e')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3a4b('0x1b')](__dirname,_0x3a4b('0x19'),_0xf66974['app']+_0x3a4b('0x1d')));}}_0x16cf8a[_0x3a4b('0x15')][_0x4eb37e]=new RuleEngine(_0x5bca83);_0x16cf8a[_0x3a4b('0x15')][_0x4eb37e][_0x3a4b('0x2f')](_0x3661d6,function(_0x2c77a4){logger[_0x3a4b('0x2a')](_0x3a4b('0x30'),JSON[_0x3a4b('0x31')](_0x2c77a4[_0x3a4b('0x32')]));if(_0x16cf8a[_0x3a4b('0x15')][_0x4eb37e]){_0x16cf8a[_0x3a4b('0x15')][_0x4eb37e][_0x3a4b('0x33')](_0x3a4b('0x34'));}});return _0x3e1167({'code':0xc8,'message':_0x3661d6});}else{logger[_0x3a4b('0x2a')](_0x3a4b('0x35'));return _0x3e1167({'code':0xc8,'message':_0x3661d6});}}catch(_0x56e3f9){logger[_0x3a4b('0x2e')](_0x56e3f9['stack']);return _0x164cc4(_0x1b67b2[_0x3a4b('0x2e')](0x1f4,_0x56e3f9));}}return _0x164cc4('routing\x20is\x20empty');});},'AcceptMessage':function(_0x518619){var _0x1e40f7=this;return new Promise(function(_0x603796,_0x461156){if(_0x518619[_0x3a4b('0x17')]&&_0x518619[_0x3a4b('0x17')]['id']){try{var _0x1a9c7d=getId(_0x518619['channel'],_0x518619[_0x3a4b('0x17')]?_0x518619[_0x3a4b('0x17')]['id']:0x0,_0x518619[_0x3a4b('0x36')]?_0x518619[_0x3a4b('0x36')]['id']:0x0);if(_0x16cf8a[_0x3a4b('0x15')][_0x1a9c7d]){_0x16cf8a['rules'][_0x1a9c7d][_0x3a4b('0x33')](_0x3a4b('0x37'));if(rpc[_0x518619[_0x3a4b('0x16')]+_0x3a4b('0x38')]){rpc[_0x518619[_0x3a4b('0x16')]+'QueueReport'][_0x3a4b('0x39')](_0x1a9c7d,{'UserId':_0x518619[_0x3a4b('0x17')][_0x3a4b('0x3a')]})[_0x3a4b('0x3b')](function(_0x423660){logger[_0x3a4b('0x2e')](_0x3a4b('0x3c'));});}}return _0x603796({'code':0xc8,'message':_0x518619});}catch(_0x237d3e){logger[_0x3a4b('0x2e')](_0x237d3e[_0x3a4b('0x3d')]);return _0x461156(_0x1e40f7[_0x3a4b('0x2e')](0x1f4,_0x237d3e));}}logger[_0x3a4b('0x2e')]('message\x20is\x20empty');return _0x461156(_0x1e40f7[_0x3a4b('0x2e')](0x1f4,_0x3a4b('0x3e')));});},'RejectMessage':function(_0xe43112){var _0x2087cb=this;return new Promise(function(_0x40a583,_0x1c96ae){if(_0xe43112['agent']&&_0xe43112['agent']['id']){try{if(_0x16cf8a[_0x3a4b('0x3f')][_0xe43112[_0x3a4b('0x40')]['id']]){_0x16cf8a[_0x3a4b('0x3f')][_0xe43112['agent']['id']][_0x3a4b('0x41')]=![];_0x16cf8a[_0x3a4b('0x3f')][_0xe43112[_0x3a4b('0x40')]['id']][_0x3a4b('0x42')]=undefined;}return _0x40a583({'code':0xc8,'message':_0xe43112});}catch(_0xe46b8d){logger[_0x3a4b('0x2e')](_0xe46b8d[_0x3a4b('0x3d')]);return _0x1c96ae(_0x2087cb['error'](0x1f4,_0xe46b8d));}}logger[_0x3a4b('0x2e')](_0x3a4b('0x3e'));return _0x1c96ae(_0x2087cb[_0x3a4b('0x2e')](0x1f4,_0x3a4b('0x3e')));});},'AbandonInteraction':function(_0x38b9f1){var _0x11026d=this;return new Promise(function(_0x22c117,_0x52d398){if(_0x38b9f1[_0x3a4b('0x16')]&&_0x38b9f1[_0x3a4b('0x36')]&&_0x38b9f1['interaction']['id']){try{var _0x66bd23=getId(_0x38b9f1['channel'],_0x38b9f1['message']?_0x38b9f1[_0x3a4b('0x17')]['id']:0x0,_0x38b9f1['interaction']?_0x38b9f1[_0x3a4b('0x36')]['id']:0x0);if(_0x16cf8a[_0x3a4b('0x15')][_0x66bd23]){_0x16cf8a[_0x3a4b('0x15')][_0x66bd23]['emit'](_0x3a4b('0x37'));}return _0x22c117({'code':0xc8,'message':_0x38b9f1});}catch(_0x2ff538){logger['error'](_0x2ff538[_0x3a4b('0x3d')]);return _0x52d398(_0x11026d[_0x3a4b('0x2e')](0x1f4,_0x2ff538));}}logger[_0x3a4b('0x2e')]('message\x20is\x20empty');return _0x52d398(_0x11026d[_0x3a4b('0x2e')](0x1f4,_0x3a4b('0x3e')));});},'AgentCapacity':function(_0x579224){var _0x41a5c2=this;return new Promise(function(_0x1b1356,_0x1104e3){if(_0x16cf8a[_0x3a4b('0x3f')][_0x3a4b('0x43')](_0x579224['id'])){for(var _0x4bc780 in _0x579224[_0x3a4b('0x44')]){if(_0x579224[_0x3a4b('0x44')]['hasOwnProperty'](_0x4bc780)){if(_0x16cf8a[_0x3a4b('0x3f')][_0x579224['id']][_0x3a4b('0x43')](_0x4bc780+_0x3a4b('0x45'))){_0x16cf8a[_0x3a4b('0x3f')][_0x579224['id']][_0x4bc780+_0x3a4b('0x45')]=parseInt(_0x579224['capacity'][_0x4bc780],0xa);}}}_0x16cf8a[_0x3a4b('0x3f')][_0x579224['id']]['updateRealtime']();return _0x1b1356({'code':0xc8,'message':_0x16cf8a[_0x3a4b('0x3f')][_0x579224['id']]});}else{return _0x1104e3(_0x41a5c2[_0x3a4b('0x2e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2f3d67){return new Promise(function(_0x4afcc0,_0x26238c){var _0x2b27b8=_['values'](_0x16cf8a[_0x3a4b('0x3f')]);_0x4afcc0({'count':_0x2b27b8[_0x3a4b('0x1a')],'rows':_0x2b27b8});});},'ChatQueues':function(_0x1af82e){return new Promise(function(_0x353fe6,_0x72ff6b){var _0x27775a=[];for(var _0x7fc4fe in _0x16cf8a['chatQueues']){if(_0x16cf8a['chatQueues'][_0x3a4b('0x43')](_0x7fc4fe)){var _0x344e8f=_0x16cf8a[_0x3a4b('0x46')][_0x7fc4fe];var _0x34685a={'id':_0x344e8f['id'],'available':_0x344e8f['available'],'loggedIn':_0x344e8f[_0x3a4b('0x47')],'name':_0x344e8f['name'],'paused':_0x344e8f[_0x3a4b('0x48')],'waiting':_0x344e8f[_0x3a4b('0x49')]};_0x27775a['push'](_0x34685a);}}_0x353fe6({'count':_0x27775a[_0x3a4b('0x1a')],'rows':_0x27775a});});},'MailQueues':function(_0x3ef8ca){return new Promise(function(_0x4f8f3c,_0x260531){var _0x2f067a=[];for(var _0x358b01 in _0x16cf8a[_0x3a4b('0x4a')]){if(_0x16cf8a['mailQueues']['hasOwnProperty'](_0x358b01)){var _0x131f35=_0x16cf8a[_0x3a4b('0x4a')][_0x358b01];var _0x54c581={'id':_0x131f35['id'],'available':_0x131f35[_0x3a4b('0x4b')],'loggedIn':_0x131f35[_0x3a4b('0x47')],'name':_0x131f35[_0x3a4b('0x4c')],'paused':_0x131f35['paused'],'waiting':_0x131f35[_0x3a4b('0x49')]};_0x2f067a['push'](_0x54c581);}}_0x4f8f3c({'count':_0x2f067a['length'],'rows':_0x2f067a});});},'OpenchannelQueues':function(_0x4927bd){return new Promise(function(_0x24b842,_0x1999f3){var _0x22b3c2=[];for(var _0x515648 in _0x16cf8a[_0x3a4b('0x4d')]){if(_0x16cf8a[_0x3a4b('0x4d')][_0x3a4b('0x43')](_0x515648)){var _0x35a438=_0x16cf8a[_0x3a4b('0x4d')][_0x515648];var _0x573adb={'id':_0x35a438['id'],'available':_0x35a438[_0x3a4b('0x4b')],'loggedIn':_0x35a438[_0x3a4b('0x47')],'name':_0x35a438[_0x3a4b('0x4c')],'paused':_0x35a438[_0x3a4b('0x48')],'waiting':_0x35a438[_0x3a4b('0x49')]};_0x22b3c2[_0x3a4b('0x21')](_0x573adb);}}_0x24b842({'count':_0x22b3c2[_0x3a4b('0x1a')],'rows':_0x22b3c2});});},'SmsQueues':function(_0x270fcc){return new Promise(function(_0x26d0c1,_0x1057fc){var _0x4b3d79=[];for(var _0x4feb74 in _0x16cf8a['smsQueues']){if(_0x16cf8a[_0x3a4b('0x4e')][_0x3a4b('0x43')](_0x4feb74)){var _0x5a1602=_0x16cf8a['smsQueues'][_0x4feb74];var _0x310999={'id':_0x5a1602['id'],'available':_0x5a1602[_0x3a4b('0x4b')],'loggedIn':_0x5a1602[_0x3a4b('0x47')],'name':_0x5a1602[_0x3a4b('0x4c')],'paused':_0x5a1602[_0x3a4b('0x48')],'waiting':_0x5a1602[_0x3a4b('0x49')]};_0x4b3d79[_0x3a4b('0x21')](_0x310999);}}_0x26d0c1({'count':_0x4b3d79[_0x3a4b('0x1a')],'rows':_0x4b3d79});});},'FaxQueues':function(_0x1b7f71){return new Promise(function(_0x4ae178,_0x5d39dd){var _0x2309db=[];for(var _0x1bc779 in _0x16cf8a['faxQueues']){if(_0x16cf8a['faxQueues'][_0x3a4b('0x43')](_0x1bc779)){var _0x48a849=_0x16cf8a['faxQueues'][_0x1bc779];var _0xcbba0={'id':_0x48a849['id'],'available':_0x48a849[_0x3a4b('0x4b')],'loggedIn':_0x48a849[_0x3a4b('0x47')],'name':_0x48a849[_0x3a4b('0x4c')],'paused':_0x48a849[_0x3a4b('0x48')],'waiting':_0x48a849['waiting']};_0x2309db[_0x3a4b('0x21')](_0xcbba0);}}_0x4ae178({'count':_0x2309db[_0x3a4b('0x1a')],'rows':_0x2309db});});},'WhatsappQueues':function(_0x5b3ee3){return new Promise(function(_0x1518f0,_0x1a0755){var _0x561602=[];for(var _0x112459 in _0x16cf8a['whatsappQueues']){if(_0x16cf8a[_0x3a4b('0x4f')][_0x3a4b('0x43')](_0x112459)){var _0x228bc4=_0x16cf8a[_0x3a4b('0x4f')][_0x112459];var _0x31a379={'id':_0x228bc4['id'],'available':_0x228bc4[_0x3a4b('0x4b')],'loggedIn':_0x228bc4['loggedIn'],'name':_0x228bc4['name'],'paused':_0x228bc4[_0x3a4b('0x48')],'waiting':_0x228bc4[_0x3a4b('0x49')]};_0x561602[_0x3a4b('0x21')](_0x31a379);}}_0x1518f0({'count':_0x561602[_0x3a4b('0x1a')],'rows':_0x561602});});},'ChatQueuesWaitingInteractions':function(_0x3170aa){return new Promise(function(_0x4a57d0,_0x586720){var _0x41dd62=_[_0x3a4b('0x50')](_0x16cf8a[_0x3a4b('0x51')]);_0x4a57d0({'count':_0x41dd62[_0x3a4b('0x1a')],'rows':_0x41dd62});});},'MailQueuesWaitingInteractions':function(_0x4d33cc){return new Promise(function(_0x965310,_0x3a7927){var _0x33b16f=_['values'](_0x16cf8a[_0x3a4b('0x52')]);_0x965310({'count':_0x33b16f[_0x3a4b('0x1a')],'rows':_0x33b16f});});},'OpenchannelQueuesWaitingInteractions':function(_0x6a1b6c){return new Promise(function(_0x43724a,_0x5265a6){var _0x4050b1=_['values'](_0x16cf8a[_0x3a4b('0x53')]);_0x43724a({'count':_0x4050b1[_0x3a4b('0x1a')],'rows':_0x4050b1});});},'SmsQueuesWaitingInteractions':function(_0x32acb0){return new Promise(function(_0x4931bc,_0x5ca191){var _0x1d851b=_[_0x3a4b('0x50')](_0x16cf8a[_0x3a4b('0x54')]);_0x4931bc({'count':_0x1d851b['length'],'rows':_0x1d851b});});},'FaxQueuesWaitingInteractions':function(_0x495bcf){return new Promise(function(_0x574c8a,_0xd16684){var _0x50806d=_['values'](_0x16cf8a['faxQueuesWaitingInteractions']);_0x574c8a({'count':_0x50806d[_0x3a4b('0x1a')],'rows':_0x50806d});});},'WhatsappQueuesWaitingInteractions':function(_0x55326e){return new Promise(function(_0x4396f3,_0x479381){var _0x44d939=_[_0x3a4b('0x50')](_0x16cf8a[_0x3a4b('0x55')]);_0x4396f3({'count':_0x44d939['length'],'rows':_0x44d939});});}};var _0x580ce5=jayson[_0x3a4b('0x56')](_0x1dc6ba)[_0x3a4b('0x57')]();_0x580ce5['on']('error',function(_0x353ba6){logger[_0x3a4b('0x2e')](JSON[_0x3a4b('0x31')](_0x353ba6));return _0x366f81(_0x353ba6);});_0x580ce5[_0x3a4b('0x14')](0x232c,_0x3a4b('0x58'),function(){console[_0x3a4b('0x59')](_0x3a4b('0x5a'),0x232c);return _0x2bdf58(_0x3a4b('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c74e927..a4e7fda 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 _0x9089=['error','catch','condition','rules','info','length','push','Command','format','iftime\x20%s','message','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then'];(function(_0x5ec407,_0x392526){var _0x5d1dd5=function(_0x2158c1){while(--_0x2158c1){_0x5ec407['push'](_0x5ec407['shift']());}};_0x5d1dd5(++_0x392526);}(_0x9089,0x136));var _0x9908=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x9089[_0x311f44];return _0x46f1e6;};'use strict';var util=require(_0x9908('0x0'));var BPromise=require(_0x9908('0x1'));var jayson=require(_0x9908('0x2'));var _=require('lodash');var logger=require(_0x9908('0x3'))(_0x9908('0x4'));var client=jayson[_0x9908('0x5')][_0x9908('0x6')]({'port':0x232a});function request(_0x5e71ee,_0x3a8946){return new BPromise(function(_0x3c6b97,_0x7751fc){return client[_0x9908('0x7')](_0x5e71ee,_0x3a8946)[_0x9908('0x8')](function(_0x3cf9a8){if(_0x3cf9a8[_0x9908('0x9')]){return _0x7751fc(_0x3cf9a8[_0x9908('0x9')]['message']);}else{return _0x3c6b97(_0x3cf9a8['result']);}})[_0x9908('0xa')](function(_0x24d1c6){return _0x7751fc(_0x24d1c6);});});}exports[_0x9908('0xb')]=function(_0x324c04,_0x317826,_0x27df03){return function(_0xe05115){if(_0x27df03[_0x9908('0xc')]&&!_0x27df03['rules'][_0x324c04]){logger[_0x9908('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x324c04);return _0xe05115['stop']();}var _0x229b8b=[];for(var _0xddeaed=0x0;_0xddeaed<_0x317826[_0x9908('0xe')];_0xddeaed+=0x1){_0x229b8b[_0x9908('0xf')](request(_0x9908('0x10'),{'command':util[_0x9908('0x11')](_0x9908('0x12'),_0x317826[_0xddeaed])})[_0x9908('0x8')](function(_0x26b191){return _0x26b191&&_0x26b191[_0x9908('0x13')]&&_0x26b191[_0x9908('0x13')]['indexOf'](_0x9908('0x14'))>=0x0?!![]:![];})[_0x9908('0xa')](function(_0x52153b){logger[_0x9908('0x9')]('[%s][INTERVAL]\x20%s',_0x324c04,_0x317826[_0xddeaed]);}));}BPromise[_0x9908('0x15')](_0x229b8b)[_0x9908('0x8')](function(_0x17e519){var _0x21732b=_[_0x9908('0x16')](_0x17e519);logger[_0x9908('0xd')](_0x9908('0x17'),_0x324c04,_0x317826[_0x9908('0x18')](_0x9908('0x19')),_0x21732b);_0xe05115[_0x9908('0x1a')](_0x21732b);})['catch'](function(_0x27ca80){console['log'](_0x27ca80);logger[_0x9908('0x9')](_0x9908('0x17'),_0x324c04,_0x317826[_0x9908('0x18')](_0x9908('0x19')),_0x27ca80[_0x9908('0x1b')]);_0xe05115[_0x9908('0x1c')]();});};}; \ No newline at end of file +var _0xb42e=['some','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20','stack','util','jayson/promise','lodash','../../../config/logger','client','http','request','error','catch','condition','info','stop','length','push','Command','iftime\x20%s','then','message','indexOf','true','all'];(function(_0x5ea24f,_0x3bd868){var _0x112afb=function(_0x530fda){while(--_0x530fda){_0x5ea24f['push'](_0x5ea24f['shift']());}};_0x112afb(++_0x3bd868);}(_0xb42e,0x1e3));var _0xeb42=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xb42e[_0x2077c2];return _0x312f9f;};'use strict';var util=require(_0xeb42('0x0'));var BPromise=require('bluebird');var jayson=require(_0xeb42('0x1'));var _=require(_0xeb42('0x2'));var logger=require(_0xeb42('0x3'))('routing');var client=jayson[_0xeb42('0x4')][_0xeb42('0x5')]({'port':0x232a});function request(_0x3a74db,_0x11f16b){return new BPromise(function(_0x59fdfc,_0x1bf032){return client[_0xeb42('0x6')](_0x3a74db,_0x11f16b)['then'](function(_0x52f8a8){if(_0x52f8a8[_0xeb42('0x7')]){return _0x1bf032(_0x52f8a8['error']['message']);}else{return _0x59fdfc(_0x52f8a8['result']);}})[_0xeb42('0x8')](function(_0x29a12b){return _0x1bf032(_0x29a12b);});});}exports[_0xeb42('0x9')]=function(_0x17f696,_0x392710,_0x125650){return function(_0x3f9141){if(_0x125650['rules']&&!_0x125650['rules'][_0x17f696]){logger[_0xeb42('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x17f696);return _0x3f9141[_0xeb42('0xb')]();}var _0xc5dea3=[];for(var _0x5a4209=0x0;_0x5a4209<_0x392710[_0xeb42('0xc')];_0x5a4209+=0x1){_0xc5dea3[_0xeb42('0xd')](request(_0xeb42('0xe'),{'command':util['format'](_0xeb42('0xf'),_0x392710[_0x5a4209])})[_0xeb42('0x10')](function(_0x43fc3b){return _0x43fc3b&&_0x43fc3b[_0xeb42('0x11')]&&_0x43fc3b[_0xeb42('0x11')][_0xeb42('0x12')](_0xeb42('0x13'))>=0x0?!![]:![];})[_0xeb42('0x8')](function(_0x1c1b06){logger[_0xeb42('0x7')]('[%s][INTERVAL]\x20%s',_0x17f696,_0x392710[_0x5a4209]);}));}BPromise[_0xeb42('0x14')](_0xc5dea3)[_0xeb42('0x10')](function(_0x49ab0b){var _0x180588=_[_0xeb42('0x15')](_0x49ab0b);logger[_0xeb42('0xa')](_0xeb42('0x16'),_0x17f696,_0x392710['join']('\x20|\x20'),_0x180588);_0x3f9141[_0xeb42('0x17')](_0x180588);})[_0xeb42('0x8')](function(_0xacc92f){console[_0xeb42('0x18')](_0xacc92f);logger[_0xeb42('0x7')](_0xeb42('0x16'),_0x17f696,_0x392710[_0xeb42('0x19')](_0xeb42('0x1a')),_0xacc92f[_0xeb42('0x1b')]);_0x3f9141[_0xeb42('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d00290e..483ee93 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 _0xee64=['blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','clone','hangup','rejected','indexOf','splice','diffTime','agent','lodash','util','info','uniqueid','channel','queue','interface','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','abandoned','reason','agentconnect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','agentcompleteAt','agentconnectAt','complete'];(function(_0xa9dc6f,_0x27d8f0){var _0x201588=function(_0x4a8de8){while(--_0x4a8de8){_0xa9dc6f['push'](_0xa9dc6f['shift']());}};_0x201588(++_0x27d8f0);}(_0xee64,0x1ca));var _0x4ee6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xee64[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4ee6('0x0'));var util=require(_0x4ee6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x172954,_0x3745d9){utils[_0x4ee6('0x2')](util['format']('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x172954[_0x4ee6('0x3')],_0x172954[_0x4ee6('0x4')],_0x172954[_0x4ee6('0x5')],_0x172954['membername'],_0x172954[_0x4ee6('0x6')],_0x172954['calleridnum'],_0x172954[_0x4ee6('0x7')],_0x172954[_0x4ee6('0x8')]));if(_0x172954[_0x4ee6('0x5')]){utils['getVoiceQueueByName'](_0x172954['queue'])[_0x4ee6('0x9')](function(_0x5185b4){if(_0x5185b4){_0x172954['type']=_0x5185b4[_0x4ee6('0xa')];_0x172954['agentacw']=_0x172954[_0x4ee6('0xb')]?_0x5185b4[_0x4ee6('0xc')]:![];_0x172954[_0x4ee6('0xd')]=_0x172954[_0x4ee6('0xe')]?_0x5185b4[_0x4ee6('0xf')]:0x0;}utils['request'](_0x4ee6('0x10'),_0x172954);});}else{utils[_0x4ee6('0x11')](_0x4ee6('0x10'),_0x172954);}if(_0x3745d9){delete transfers[_0x172954[_0x4ee6('0x3')]];}else{delete agents[_0x172954[_0x4ee6('0x12')]];}}exports[_0x4ee6('0x13')]=function(_0x186e98){try{agents[_0x186e98[_0x4ee6('0x12')]]=_0x186e98;agents[_0x186e98['destuniqueid']][_0x4ee6('0x14')]=utils[_0x4ee6('0x15')]();agents[_0x186e98[_0x4ee6('0x12')]][_0x4ee6('0x8')]=_0x4ee6('0x16');agents[_0x186e98['destuniqueid']][_0x4ee6('0x7')]=null;agents[_0x186e98[_0x4ee6('0x12')]]['connectedlinename']=null;}catch(_0x3f03c8){utils[_0x4ee6('0x17')](_0x3f03c8[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x19')]=function(_0x3052ab){try{if(!_['isNil'](agents[_0x3052ab[_0x4ee6('0x12')]])){agents[_0x3052ab[_0x4ee6('0x12')]][_0x4ee6('0x19')]=!![];agents[_0x3052ab[_0x4ee6('0x12')]][_0x4ee6('0x1a')]=utils[_0x4ee6('0x15')]();agents[_0x3052ab[_0x4ee6('0x12')]][_0x4ee6('0x8')]=_0x4ee6('0x1b');agents[_0x3052ab['destuniqueid']]['reason']=_0x4ee6('0x1b');agents[_0x3052ab[_0x4ee6('0x12')]][_0x4ee6('0x1c')]=_0x3052ab[_0x4ee6('0x1d')]?parseInt(_0x3052ab['ringtime'])/0x3e8:0x0;agents[_0x3052ab['destuniqueid']][_0x4ee6('0x1e')]=0x0;unanswered[_0x4ee6('0x1f')](_0x3052ab[_0x4ee6('0x12')]);}}catch(_0x4f088e){utils[_0x4ee6('0x17')](_0x4f088e[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x20')]=function(_0x2fe65d){try{_[_0x4ee6('0x21')](agents,function(_0x319ec2,_0x90d9ec){if(_0x319ec2['uniqueid']==_0x2fe65d['uniqueid']&&!_[_0x4ee6('0x22')](unanswered,_0x319ec2['destuniqueid'])){_0x319ec2[_0x4ee6('0x19')]=!![];_0x319ec2[_0x4ee6('0x1a')]=utils['now']();_0x319ec2['lastevent']=_0x4ee6('0x23');_0x319ec2[_0x4ee6('0x24')]=_0x4ee6('0x23');_0x319ec2[_0x4ee6('0x1c')]=_0x2fe65d[_0x4ee6('0x1c')];_0x319ec2[_0x4ee6('0x1e')]=0x0;writeDB(_0x319ec2);}});}catch(_0x10adab){utils[_0x4ee6('0x17')](_0x10adab['stack']);}};exports[_0x4ee6('0x25')]=function(_0x580d18){try{if(agents[_0x580d18[_0x4ee6('0x12')]]){agents[_0x580d18[_0x4ee6('0x12')]]['agentconnectAt']=utils[_0x4ee6('0x15')]();agents[_0x580d18['destuniqueid']]['connectedlinenum']=_0x580d18[_0x4ee6('0x7')];agents[_0x580d18[_0x4ee6('0x12')]][_0x4ee6('0x26')]=_0x580d18[_0x4ee6('0x26')];agents[_0x580d18[_0x4ee6('0x12')]][_0x4ee6('0x1c')]=_0x580d18['ringtime'];agents[_0x580d18[_0x4ee6('0x12')]][_0x4ee6('0x8')]='connect';_[_0x4ee6('0x21')](agents,function(_0x2522e6,_0x5b9f4a){if(_0x2522e6[_0x4ee6('0x12')]!=_0x580d18[_0x4ee6('0x12')]&&_0x2522e6[_0x4ee6('0x3')]==_0x580d18[_0x4ee6('0x3')]){_0x2522e6['talktime']=0x0;_0x2522e6[_0x4ee6('0x1c')]=_0x580d18[_0x4ee6('0x1d')];_0x2522e6[_0x4ee6('0x19')]=!![];_0x2522e6[_0x4ee6('0x1a')]=utils['now']();_0x2522e6[_0x4ee6('0x8')]='answered_elsewhere';_0x2522e6[_0x4ee6('0x24')]=_0x4ee6('0x27');_0x2522e6[_0x4ee6('0x28')]=_0x580d18['destuniqueid'];_0x2522e6[_0x4ee6('0x29')]=_0x580d18['membername'];writeDB(_0x2522e6);}});}}catch(_0x3cfe7d){utils[_0x4ee6('0x17')](_0x3cfe7d[_0x4ee6('0x18')]);}};exports[_0x4ee6('0xb')]=function(_0x1af26f){try{if(!_[_0x4ee6('0x2a')](agents[_0x1af26f[_0x4ee6('0x12')]])){agents[_0x1af26f[_0x4ee6('0x12')]]['agentcomplete']=!![];agents[_0x1af26f[_0x4ee6('0x12')]][_0x4ee6('0x2b')]=utils[_0x4ee6('0x15')]();agents[_0x1af26f[_0x4ee6('0x12')]][_0x4ee6('0x1e')]=utils['diffTime'](agents[_0x1af26f[_0x4ee6('0x12')]]['agentcompleteAt'],agents[_0x1af26f[_0x4ee6('0x12')]][_0x4ee6('0x2c')]);agents[_0x1af26f[_0x4ee6('0x12')]]['reason']=_0x1af26f[_0x4ee6('0x24')];agents[_0x1af26f[_0x4ee6('0x12')]][_0x4ee6('0x8')]=_0x4ee6('0x2d');writeDB(agents[_0x1af26f[_0x4ee6('0x12')]]);}}catch(_0x19a411){utils[_0x4ee6('0x17')](_0x19a411[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x2e')]=function(_0x16b42e){try{if(!_['isNil'](agents[_0x16b42e[_0x4ee6('0x2f')]])){agents[_0x16b42e[_0x4ee6('0x2f')]][_0x4ee6('0x30')]=!![];agents[_0x16b42e[_0x4ee6('0x2f')]][_0x4ee6('0x31')]=_0x4ee6('0x32');agents[_0x16b42e[_0x4ee6('0x2f')]]['transferexten']=_0x16b42e[_0x4ee6('0x33')];agents[_0x16b42e['transfereruniqueid']]['transferuniqueid']=agents[_0x16b42e[_0x4ee6('0x2f')]][_0x4ee6('0x3')];}}catch(_0x943e18){utils['error'](_0x943e18[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x34')]=function(_0x428cf9){try{if(_0x428cf9[_0x4ee6('0x35')]==_0x428cf9[_0x4ee6('0x36')]){if(!_[_0x4ee6('0x2a')](agents[_0x428cf9[_0x4ee6('0x37')]])){agents[_0x428cf9[_0x4ee6('0x37')]][_0x4ee6('0x30')]=!![];agents[_0x428cf9['secondtransfereruniqueid']][_0x4ee6('0x31')]=_0x4ee6('0x38');agents[_0x428cf9[_0x4ee6('0x37')]]['transferexten']=_0x428cf9[_0x4ee6('0x39')];agents[_0x428cf9['secondtransfereruniqueid']][_0x4ee6('0x3a')]=_0x428cf9[_0x4ee6('0x35')];}if(_0x428cf9[_0x4ee6('0x3b')]&&agents[_0x428cf9[_0x4ee6('0x3b')]]){agents[_0x428cf9['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x428cf9[_0x4ee6('0x3b')]]=_['clone'](agents[_0x428cf9[_0x4ee6('0x3b')]]);transfers[_0x428cf9['transfereeuniqueid']][_0x4ee6('0x3c')]=agents[_0x428cf9['secondtransfereruniqueid']][_0x4ee6('0x3c')];transfers[_0x428cf9[_0x4ee6('0x3b')]][_0x4ee6('0x3d')]=agents[_0x428cf9[_0x4ee6('0x37')]]['calleridname'];transfers[_0x428cf9[_0x4ee6('0x3b')]][_0x4ee6('0x14')]=utils[_0x4ee6('0x15')]();transfers[_0x428cf9[_0x4ee6('0x3b')]]['agentconnectAt']=utils[_0x4ee6('0x15')]();transfers[_0x428cf9[_0x4ee6('0x3b')]]['holdtime']=0x0;transfers[_0x428cf9[_0x4ee6('0x3b')]][_0x4ee6('0x3e')]=0x2;}}else if(_0x428cf9[_0x4ee6('0x37')]==_0x428cf9['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x428cf9[_0x4ee6('0x35')]])){agents[_0x428cf9[_0x4ee6('0x35')]]['transfer']=!![];agents[_0x428cf9[_0x4ee6('0x35')]][_0x4ee6('0x31')]=_0x4ee6('0x38');agents[_0x428cf9[_0x4ee6('0x35')]]['transferexten']=_0x428cf9[_0x4ee6('0x3f')];agents[_0x428cf9[_0x4ee6('0x35')]]['transferuniqueid']=_0x428cf9[_0x4ee6('0x37')];}if(_0x428cf9[_0x4ee6('0x40')]&&agents[_0x428cf9[_0x4ee6('0x40')]]){agents[_0x428cf9['transfertargetuniqueid']][_0x4ee6('0x3e')]=0x1;transfers[_0x428cf9[_0x4ee6('0x40')]]=_[_0x4ee6('0x41')](agents[_0x428cf9[_0x4ee6('0x40')]]);transfers[_0x428cf9[_0x4ee6('0x40')]][_0x4ee6('0x3c')]=agents[_0x428cf9[_0x4ee6('0x35')]][_0x4ee6('0x3c')];transfers[_0x428cf9[_0x4ee6('0x40')]][_0x4ee6('0x3d')]=agents[_0x428cf9[_0x4ee6('0x35')]]['calleridname'];transfers[_0x428cf9['transfertargetuniqueid']][_0x4ee6('0x14')]=utils['now']();transfers[_0x428cf9[_0x4ee6('0x40')]]['agentconnectAt']=utils['now']();transfers[_0x428cf9[_0x4ee6('0x40')]][_0x4ee6('0x1c')]=0x0;transfers[_0x428cf9['transfertargetuniqueid']][_0x4ee6('0x3e')]=0x2;}}}catch(_0x55c7ae){utils[_0x4ee6('0x17')](_0x55c7ae[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x42')]=function(_0xea8c3a){try{if(agents[_0xea8c3a['uniqueid']]&&agents[_0xea8c3a['uniqueid']]['reason']===_0x4ee6('0x1b')){if(_0xea8c3a['cause']==='21'){agents[_0xea8c3a[_0x4ee6('0x3')]]['reason']=_0x4ee6('0x43');agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x8')]=_0x4ee6('0x43');}writeDB(agents[_0xea8c3a[_0x4ee6('0x3')]]);var _0x36ec3d=unanswered[_0x4ee6('0x44')](_0xea8c3a['uniqueid']);if(_0x36ec3d>-0x1)unanswered[_0x4ee6('0x45')](_0x36ec3d,0x1);}if(transfers[_0xea8c3a[_0x4ee6('0x3')]]){transfers[_0xea8c3a['uniqueid']][_0x4ee6('0xb')]=!![];transfers[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x2b')]=utils[_0x4ee6('0x15')]();transfers[_0xea8c3a['uniqueid']][_0x4ee6('0x1e')]=utils[_0x4ee6('0x46')](transfers[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x2b')],transfers[_0xea8c3a[_0x4ee6('0x3')]]['agentconnectAt']);transfers[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x24')]=_0x4ee6('0x47');transfers[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x8')]=_0x4ee6('0x2d');writeDB(transfers[_0xea8c3a[_0x4ee6('0x3')]],!![]);}if(agents[_0xea8c3a['uniqueid']]&&agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x2c')]){agents[_0xea8c3a['uniqueid']][_0x4ee6('0xb')]=!![];agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x2b')]=utils[_0x4ee6('0x15')]();agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x1e')]=utils['diffTime'](agents[_0xea8c3a[_0x4ee6('0x3')]]['agentcompleteAt'],agents[_0xea8c3a[_0x4ee6('0x3')]]['agentconnectAt']);agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x24')]=agents[_0xea8c3a[_0x4ee6('0x3')]]['transfer']?_0x4ee6('0x30'):_0x4ee6('0x47');agents[_0xea8c3a[_0x4ee6('0x3')]][_0x4ee6('0x8')]='complete';writeDB(agents[_0xea8c3a[_0x4ee6('0x3')]]);}}catch(_0x552ba4){utils['error'](_0x552ba4[_0x4ee6('0x18')]);}}; \ No newline at end of file +var _0x9513=['queuecallerabandon','forIn','includes','abandoned','holdtime','agentconnect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','transfer','blind','transferexten','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','agent','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','error'];(function(_0x2f3fa9,_0x52e248){var _0x16bc28=function(_0x47d1e0){while(--_0x47d1e0){_0x2f3fa9['push'](_0x2f3fa9['shift']());}};_0x16bc28(++_0x52e248);}(_0x9513,0x1ba));var _0x3951=function(_0xa4e5d1,_0xb470b3){_0xa4e5d1=_0xa4e5d1-0x0;var _0x4c0150=_0x9513[_0xa4e5d1];return _0x4c0150;};'use strict';var _=require('lodash');var util=require(_0x3951('0x0'));var utils=require(_0x3951('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x365131,_0x3d2152){utils['info'](util[_0x3951('0x2')](_0x3951('0x3'),_0x365131[_0x3951('0x4')],_0x365131['channel'],_0x365131[_0x3951('0x5')],_0x365131[_0x3951('0x6')],_0x365131[_0x3951('0x7')],_0x365131[_0x3951('0x8')],_0x365131[_0x3951('0x9')],_0x365131[_0x3951('0xa')]));if(_0x365131[_0x3951('0x5')]){utils[_0x3951('0xb')](_0x365131['queue'])[_0x3951('0xc')](function(_0x5ea8fd){if(_0x5ea8fd){_0x365131[_0x3951('0xd')]=_0x5ea8fd[_0x3951('0xd')];_0x365131[_0x3951('0xe')]=_0x365131[_0x3951('0xf')]?_0x5ea8fd[_0x3951('0x10')]:![];_0x365131['acwtime']=_0x365131['agentacw']?_0x5ea8fd[_0x3951('0x11')]:0x0;}utils[_0x3951('0x12')]('CreateVoiceAgentReport',_0x365131);});}else{utils['request'](_0x3951('0x13'),_0x365131);}if(_0x3d2152){delete transfers[_0x365131['uniqueid']];}else{delete agents[_0x365131[_0x3951('0x14')]];}}exports[_0x3951('0x15')]=function(_0x5c349c){try{agents[_0x5c349c[_0x3951('0x14')]]=_0x5c349c;agents[_0x5c349c[_0x3951('0x14')]][_0x3951('0x16')]=utils[_0x3951('0x17')]();agents[_0x5c349c[_0x3951('0x14')]]['lastevent']='called';agents[_0x5c349c[_0x3951('0x14')]][_0x3951('0x9')]=null;agents[_0x5c349c[_0x3951('0x14')]][_0x3951('0x18')]=null;}catch(_0x31fd6d){utils['error'](_0x31fd6d[_0x3951('0x19')]);}};exports[_0x3951('0x1a')]=function(_0x2d3cdb){try{if(!_[_0x3951('0x1b')](agents[_0x2d3cdb[_0x3951('0x14')]])){agents[_0x2d3cdb[_0x3951('0x14')]]['agentringnoanswer']=!![];agents[_0x2d3cdb[_0x3951('0x14')]][_0x3951('0x1c')]=utils[_0x3951('0x17')]();agents[_0x2d3cdb[_0x3951('0x14')]][_0x3951('0xa')]=_0x3951('0x1d');agents[_0x2d3cdb[_0x3951('0x14')]][_0x3951('0x1e')]=_0x3951('0x1d');agents[_0x2d3cdb[_0x3951('0x14')]]['holdtime']=_0x2d3cdb[_0x3951('0x1f')]?parseInt(_0x2d3cdb[_0x3951('0x1f')])/0x3e8:0x0;agents[_0x2d3cdb[_0x3951('0x14')]][_0x3951('0x20')]=0x0;unanswered['push'](_0x2d3cdb[_0x3951('0x14')]);}}catch(_0x25a312){utils[_0x3951('0x21')](_0x25a312[_0x3951('0x19')]);}};exports[_0x3951('0x22')]=function(_0x53519c){try{_[_0x3951('0x23')](agents,function(_0x94447a,_0x3f895f){if(_0x94447a[_0x3951('0x4')]==_0x53519c[_0x3951('0x4')]&&!_[_0x3951('0x24')](unanswered,_0x94447a['destuniqueid'])){_0x94447a[_0x3951('0x1a')]=!![];_0x94447a['agentringnoanswerAt']=utils[_0x3951('0x17')]();_0x94447a['lastevent']=_0x3951('0x25');_0x94447a[_0x3951('0x1e')]='abandoned';_0x94447a[_0x3951('0x26')]=_0x53519c[_0x3951('0x26')];_0x94447a[_0x3951('0x20')]=0x0;writeDB(_0x94447a);}});}catch(_0x340103){utils['error'](_0x340103[_0x3951('0x19')]);}};exports[_0x3951('0x27')]=function(_0x48fd53){try{if(agents[_0x48fd53[_0x3951('0x14')]]){agents[_0x48fd53[_0x3951('0x14')]]['agentconnectAt']=utils[_0x3951('0x17')]();agents[_0x48fd53[_0x3951('0x14')]][_0x3951('0x9')]=_0x48fd53['connectedlinenum'];agents[_0x48fd53[_0x3951('0x14')]][_0x3951('0x18')]=_0x48fd53['connectedlinename'];agents[_0x48fd53[_0x3951('0x14')]][_0x3951('0x26')]=_0x48fd53[_0x3951('0x1f')];agents[_0x48fd53[_0x3951('0x14')]][_0x3951('0xa')]=_0x3951('0x28');_[_0x3951('0x23')](agents,function(_0x3cc037,_0x226ae8){if(_0x3cc037['destuniqueid']!=_0x48fd53[_0x3951('0x14')]&&_0x3cc037[_0x3951('0x4')]==_0x48fd53[_0x3951('0x4')]){_0x3cc037[_0x3951('0x20')]=0x0;_0x3cc037[_0x3951('0x26')]=_0x48fd53[_0x3951('0x1f')];_0x3cc037[_0x3951('0x1a')]=!![];_0x3cc037['agentringnoanswerAt']=utils[_0x3951('0x17')]();_0x3cc037['lastevent']='answered_elsewhere';_0x3cc037[_0x3951('0x1e')]=_0x3951('0x29');_0x3cc037[_0x3951('0x2a')]=_0x48fd53[_0x3951('0x14')];_0x3cc037['answeredelsewheremembername']=_0x48fd53[_0x3951('0x6')];writeDB(_0x3cc037);}});}}catch(_0x1b1448){utils[_0x3951('0x21')](_0x1b1448[_0x3951('0x19')]);}};exports['agentcomplete']=function(_0x375121){try{if(!_[_0x3951('0x1b')](agents[_0x375121[_0x3951('0x14')]])){agents[_0x375121['destuniqueid']][_0x3951('0xf')]=!![];agents[_0x375121[_0x3951('0x14')]][_0x3951('0x2b')]=utils[_0x3951('0x17')]();agents[_0x375121[_0x3951('0x14')]][_0x3951('0x20')]=utils[_0x3951('0x2c')](agents[_0x375121[_0x3951('0x14')]]['agentcompleteAt'],agents[_0x375121['destuniqueid']][_0x3951('0x2d')]);agents[_0x375121[_0x3951('0x14')]][_0x3951('0x1e')]=_0x375121[_0x3951('0x1e')];agents[_0x375121[_0x3951('0x14')]][_0x3951('0xa')]=_0x3951('0x2e');writeDB(agents[_0x375121['destuniqueid']]);}}catch(_0x2b22dd){utils[_0x3951('0x21')](_0x2b22dd[_0x3951('0x19')]);}};exports['blindtransfer']=function(_0x1b044c){try{if(!_[_0x3951('0x1b')](agents[_0x1b044c[_0x3951('0x2f')]])){agents[_0x1b044c['transfereruniqueid']][_0x3951('0x30')]=!![];agents[_0x1b044c[_0x3951('0x2f')]]['transfertype']=_0x3951('0x31');agents[_0x1b044c['transfereruniqueid']][_0x3951('0x32')]=_0x1b044c['extension'];agents[_0x1b044c[_0x3951('0x2f')]]['transferuniqueid']=agents[_0x1b044c[_0x3951('0x2f')]]['uniqueid'];}}catch(_0x58dc61){utils['error'](_0x58dc61['stack']);}};exports[_0x3951('0x33')]=function(_0x3b15d3){try{if(_0x3b15d3[_0x3951('0x34')]==_0x3b15d3['origtransfererlinkedid']){if(!_[_0x3951('0x1b')](agents[_0x3b15d3['secondtransfereruniqueid']])){agents[_0x3b15d3[_0x3951('0x35')]][_0x3951('0x30')]=!![];agents[_0x3b15d3[_0x3951('0x35')]][_0x3951('0x36')]='ATTENDED';agents[_0x3b15d3['secondtransfereruniqueid']][_0x3951('0x32')]=_0x3b15d3[_0x3951('0x37')];agents[_0x3b15d3[_0x3951('0x35')]]['transferuniqueid']=_0x3b15d3[_0x3951('0x34')];}if(_0x3b15d3[_0x3951('0x38')]&&agents[_0x3b15d3[_0x3951('0x38')]]){agents[_0x3b15d3[_0x3951('0x38')]][_0x3951('0x39')]=0x1;transfers[_0x3b15d3['transfereeuniqueid']]=_[_0x3951('0x3a')](agents[_0x3b15d3[_0x3951('0x38')]]);transfers[_0x3b15d3[_0x3951('0x38')]][_0x3951('0x8')]=agents[_0x3b15d3[_0x3951('0x35')]]['calleridnum'];transfers[_0x3b15d3[_0x3951('0x38')]]['calleridname']=agents[_0x3b15d3[_0x3951('0x35')]][_0x3951('0x3b')];transfers[_0x3b15d3[_0x3951('0x38')]][_0x3951('0x16')]=utils[_0x3951('0x17')]();transfers[_0x3b15d3['transfereeuniqueid']]['agentconnectAt']=utils[_0x3951('0x17')]();transfers[_0x3b15d3[_0x3951('0x38')]][_0x3951('0x26')]=0x0;transfers[_0x3b15d3[_0x3951('0x38')]][_0x3951('0x39')]=0x2;}}else if(_0x3b15d3['secondtransfereruniqueid']==_0x3b15d3[_0x3951('0x3c')]){if(!_[_0x3951('0x1b')](agents[_0x3b15d3[_0x3951('0x34')]])){agents[_0x3b15d3[_0x3951('0x34')]][_0x3951('0x30')]=!![];agents[_0x3b15d3['origtransfereruniqueid']]['transfertype']=_0x3951('0x3d');agents[_0x3b15d3[_0x3951('0x34')]][_0x3951('0x32')]=_0x3b15d3[_0x3951('0x3e')];agents[_0x3b15d3[_0x3951('0x34')]]['transferuniqueid']=_0x3b15d3[_0x3951('0x35')];}if(_0x3b15d3[_0x3951('0x3f')]&&agents[_0x3b15d3[_0x3951('0x3f')]]){agents[_0x3b15d3['transfertargetuniqueid']][_0x3951('0x39')]=0x1;transfers[_0x3b15d3[_0x3951('0x3f')]]=_[_0x3951('0x3a')](agents[_0x3b15d3[_0x3951('0x3f')]]);transfers[_0x3b15d3[_0x3951('0x3f')]][_0x3951('0x8')]=agents[_0x3b15d3['origtransfereruniqueid']][_0x3951('0x8')];transfers[_0x3b15d3[_0x3951('0x3f')]]['calleridname']=agents[_0x3b15d3[_0x3951('0x34')]][_0x3951('0x3b')];transfers[_0x3b15d3['transfertargetuniqueid']][_0x3951('0x16')]=utils[_0x3951('0x17')]();transfers[_0x3b15d3[_0x3951('0x3f')]][_0x3951('0x2d')]=utils[_0x3951('0x17')]();transfers[_0x3b15d3[_0x3951('0x3f')]]['holdtime']=0x0;transfers[_0x3b15d3[_0x3951('0x3f')]][_0x3951('0x39')]=0x2;}}}catch(_0x235bde){utils[_0x3951('0x21')](_0x235bde[_0x3951('0x19')]);}};exports['hangup']=function(_0x9080f8){try{if(agents[_0x9080f8['uniqueid']]&&agents[_0x9080f8['uniqueid']][_0x3951('0x1e')]===_0x3951('0x1d')){if(_0x9080f8[_0x3951('0x40')]==='21'){agents[_0x9080f8[_0x3951('0x4')]][_0x3951('0x1e')]='rejected';agents[_0x9080f8['uniqueid']]['lastevent']=_0x3951('0x41');}writeDB(agents[_0x9080f8['uniqueid']]);var _0x39a035=unanswered[_0x3951('0x42')](_0x9080f8[_0x3951('0x4')]);if(_0x39a035>-0x1)unanswered['splice'](_0x39a035,0x1);}if(transfers[_0x9080f8[_0x3951('0x4')]]){transfers[_0x9080f8['uniqueid']][_0x3951('0xf')]=!![];transfers[_0x9080f8[_0x3951('0x4')]][_0x3951('0x2b')]=utils[_0x3951('0x17')]();transfers[_0x9080f8[_0x3951('0x4')]][_0x3951('0x20')]=utils[_0x3951('0x2c')](transfers[_0x9080f8['uniqueid']][_0x3951('0x2b')],transfers[_0x9080f8[_0x3951('0x4')]][_0x3951('0x2d')]);transfers[_0x9080f8[_0x3951('0x4')]][_0x3951('0x1e')]=_0x3951('0x43');transfers[_0x9080f8['uniqueid']][_0x3951('0xa')]=_0x3951('0x2e');writeDB(transfers[_0x9080f8[_0x3951('0x4')]],!![]);}if(agents[_0x9080f8['uniqueid']]&&agents[_0x9080f8[_0x3951('0x4')]][_0x3951('0x2d')]){agents[_0x9080f8['uniqueid']]['agentcomplete']=!![];agents[_0x9080f8[_0x3951('0x4')]]['agentcompleteAt']=utils[_0x3951('0x17')]();agents[_0x9080f8[_0x3951('0x4')]][_0x3951('0x20')]=utils['diffTime'](agents[_0x9080f8[_0x3951('0x4')]][_0x3951('0x2b')],agents[_0x9080f8['uniqueid']][_0x3951('0x2d')]);agents[_0x9080f8['uniqueid']][_0x3951('0x1e')]=agents[_0x9080f8['uniqueid']][_0x3951('0x30')]?'transfer':_0x3951('0x43');agents[_0x9080f8['uniqueid']][_0x3951('0xa')]=_0x3951('0x2e');writeDB(agents[_0x9080f8[_0x3951('0x4')]]);}}catch(_0x4c3b12){utils['error'](_0x4c3b12['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 39ecaec..aa86ca4 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 _0x3e05=['split','substring','includes','hangup','noop','execif','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','destination','callerid','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','stack','newstate','channelstate','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','error','endtime','diffTime','starttime','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','source','value','variable','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','application','toLowerCase','set','startsWith','appdata','cdr'];(function(_0x3915c3,_0x2d7ebf){var _0xd746a6=function(_0x14b185){while(--_0x14b185){_0x3915c3['push'](_0x3915c3['shift']());}};_0xd746a6(++_0x2d7ebf);}(_0x3e05,0x140));var _0x53e0=function(_0xd3ef98,_0x803256){_0xd3ef98=_0xd3ef98-0x0;var _0x28b0af=_0x3e05[_0xd3ef98];return _0x28b0af;};'use strict';var _=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var utils=require(_0x53e0('0x2'));var dispositions=[_0x53e0('0x3'),_0x53e0('0x4'),_0x53e0('0x4'),_0x53e0('0x3'),'NO\x20ANSWER',_0x53e0('0x3'),_0x53e0('0x5'),'BUSY','FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x4e7789){utils['info'](util[_0x53e0('0x6')](_0x53e0('0x7'),_0x4e7789['uniqueid'],_0x4e7789[_0x53e0('0x8')],_0x4e7789['type'],_0x4e7789['accountcode'],_0x4e7789['source'],_0x4e7789[_0x53e0('0x9')],_0x4e7789[_0x53e0('0xa')],_0x4e7789['disposition']));if(_0x4e7789['accountcode']){utils['getUserByInternal'](_0x4e7789[_0x53e0('0xb')])[_0x53e0('0xc')](function(_0x5f2333){if(_0x5f2333){_0x4e7789[_0x53e0('0xd')]=_0x5f2333['id'];}utils[_0x53e0('0xe')]('CreateVoiceCallReport',_0x4e7789);});}else{utils['request'](_0x53e0('0xf'),_0x4e7789);}if(channels[_0x4e7789[_0x53e0('0x10')]]){delete channels[_0x4e7789[_0x53e0('0x10')]];}}exports[_0x53e0('0x11')]=function(_0x53857e){try{if(_0x53857e[_0x53e0('0x10')]==_0x53857e[_0x53e0('0x12')]&&_0x53857e[_0x53e0('0x8')]!=_0x53e0('0x13')){channels[_0x53857e[_0x53e0('0x10')]]={'uniqueid':_0x53857e[_0x53e0('0x10')],'accountcode':_0x53857e['accountcode'],'source':_0x53857e[_0x53e0('0x14')],'destination':_0x53857e['exten'],'destinationcontext':_0x53857e[_0x53e0('0x15')],'channel':_0x53857e[_0x53e0('0x8')],'starttime':utils[_0x53e0('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x53e0('0x17')};}}catch(_0x127959){utils['error'](_0x127959[_0x53e0('0x18')]);}};exports[_0x53e0('0x19')]=function(_0x4bf55b){try{if(!_['isNil'](channels[_0x4bf55b[_0x53e0('0x10')]])&&_0x4bf55b[_0x53e0('0x1a')]==0x6){if(_[_0x53e0('0x1b')](channels[_0x4bf55b['uniqueid']][_0x53e0('0x1c')])){channels[_0x4bf55b[_0x53e0('0x10')]]['systemanswertime']=utils[_0x53e0('0x16')]();}}else if(!_[_0x53e0('0x1b')](channels[_0x4bf55b[_0x53e0('0x12')]])&&_0x4bf55b[_0x53e0('0x1a')]==0x6&&_0x4bf55b['context']!=_0x53e0('0x1d')){channels[_0x4bf55b[_0x53e0('0x12')]]['accountcode']=_0x4bf55b[_0x53e0('0xb')];channels[_0x4bf55b[_0x53e0('0x12')]][_0x53e0('0x1e')]=_0x4bf55b[_0x53e0('0x8')];if(_[_0x53e0('0x1b')](channels[_0x4bf55b[_0x53e0('0x12')]][_0x53e0('0x1f')])){channels[_0x4bf55b[_0x53e0('0x12')]][_0x53e0('0x1f')]=utils[_0x53e0('0x16')]();}channels[_0x4bf55b['linkedid']][_0x53e0('0x20')]=dispositions[_[_0x53e0('0x21')](_0x4bf55b[_0x53e0('0x1a')])]||_0x53e0('0x5');}}catch(_0x2a6b29){utils[_0x53e0('0x22')](_0x2a6b29[_0x53e0('0x18')]);}};exports['hangup']=function(_0x5da710){try{if(!_[_0x53e0('0x1b')](channels[_0x5da710[_0x53e0('0x10')]])){if(_[_0x53e0('0x1b')](channels[_0x5da710[_0x53e0('0x10')]]['callerid'])){channels[_0x5da710['uniqueid']][_0x53e0('0xa')]=_0x5da710['calleridname']+'\x20<'+_0x5da710[_0x53e0('0x14')]+'>';}channels[_0x5da710['uniqueid']][_0x53e0('0x23')]=utils[_0x53e0('0x16')]();channels[_0x5da710[_0x53e0('0x10')]]['duration']=utils[_0x53e0('0x24')](channels[_0x5da710[_0x53e0('0x10')]]['endtime'],channels[_0x5da710[_0x53e0('0x10')]][_0x53e0('0x25')]);channels[_0x5da710[_0x53e0('0x10')]]['billableseconds']=channels[_0x5da710[_0x53e0('0x10')]][_0x53e0('0x1f')]?utils[_0x53e0('0x24')](channels[_0x5da710['uniqueid']]['endtime'],channels[_0x5da710[_0x53e0('0x10')]][_0x53e0('0x1f')]):0x0;writeDB(channels[_0x5da710[_0x53e0('0x10')]]);}}catch(_0x37887f){utils['error'](_0x37887f[_0x53e0('0x18')]);}};exports['attendedtransfer']=function(_0x46d7a8){try{if(!_['isNil'](channels[_0x46d7a8['localtwolinkedid']])){if(channels[_0x46d7a8[_0x53e0('0x26')]][_0x53e0('0x8')]==_0x46d7a8[_0x53e0('0x27')]){channels[_0x46d7a8[_0x53e0('0x26')]][_0x53e0('0x1e')]=_0x46d7a8[_0x53e0('0x28')];channels[_0x46d7a8[_0x53e0('0x26')]][_0x53e0('0x29')]=_0x53e0('0x2a');}else if(channels[_0x46d7a8['localtwolinkedid']]['channel']=_0x46d7a8[_0x53e0('0x2b')]){channels[_0x46d7a8[_0x53e0('0x26')]][_0x53e0('0x1e')]=_0x46d7a8[_0x53e0('0x2c')];channels[_0x46d7a8[_0x53e0('0x26')]][_0x53e0('0x29')]=_0x53e0('0x2a');}}}catch(_0x5b07b6){utils['error'](_0x5b07b6[_0x53e0('0x18')]);}};exports[_0x53e0('0x2d')]=function(_0x5f288e){try{if(!_[_0x53e0('0x1b')](channels[_0x5f288e['uniqueid']])){channels[_0x5f288e[_0x53e0('0x10')]][_0x53e0('0x2e')]=utils[_0x53e0('0x16')]();}}catch(_0x150d9c){utils[_0x53e0('0x22')](_0x150d9c[_0x53e0('0x18')]);}};exports['musiconholdstop']=function(_0x38b594){try{if(!_[_0x53e0('0x1b')](channels[_0x38b594['uniqueid']])){if(!_[_0x53e0('0x1b')](channels[_0x38b594['uniqueid']][_0x53e0('0x2e')])){channels[_0x38b594['uniqueid']][_0x53e0('0x2f')]+=utils[_0x53e0('0x24')](utils[_0x53e0('0x16')](),channels[_0x38b594[_0x53e0('0x10')]][_0x53e0('0x2e')]);delete channels[_0x38b594[_0x53e0('0x10')]][_0x53e0('0x2e')];}}}catch(_0x29080e){utils[_0x53e0('0x22')](_0x29080e[_0x53e0('0x18')]);}};exports[_0x53e0('0x30')]=function(_0xee7849){try{if(!_['isNil'](channels[_0xee7849[_0x53e0('0x10')]])){if(!_[_0x53e0('0x1b')](_0xee7849['variable'][_0x53e0('0x31')])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0x32')]=_0xee7849[_0x53e0('0x33')];}if(!_['isNil'](_0xee7849[_0x53e0('0x34')]['xmd-phone'])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0x9')]=_0xee7849[_0x53e0('0x33')];channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0xa')]='\x22'+_0xee7849[_0x53e0('0x33')]+'\x22\x20<'+_0xee7849[_0x53e0('0x33')]+'>';}if(!_[_0x53e0('0x1b')](_0xee7849[_0x53e0('0x34')][_0x53e0('0x35')])||!_[_0x53e0('0x1b')](_0xee7849[_0x53e0('0x34')][_0x53e0('0x36')])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0xa')]=_0xee7849['value'];}if(!_[_0x53e0('0x1b')](_0xee7849[_0x53e0('0x34')][_0x53e0('0x37')])||!_[_0x53e0('0x1b')](_0xee7849[_0x53e0('0x34')][_0x53e0('0x38')])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0x39')]='Queue';channels[_0xee7849['uniqueid']]['lastdata']=_0xee7849['value'];channels[_0xee7849[_0x53e0('0x10')]]['queue']=!![];}if(!_[_0x53e0('0x1b')](_0xee7849[_0x53e0('0x34')][_0x53e0('0x3a')])){channels[_0xee7849[_0x53e0('0x10')]]['ContactId']=_0xee7849[_0x53e0('0x33')];}if(!_['isNil'](_0xee7849[_0x53e0('0x34')][_0x53e0('0x3b')])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0x3c')]=_0xee7849[_0x53e0('0x33')];}if(!_['isNil'](_0xee7849['variable'][_0x53e0('0x3d')])){channels[_0xee7849[_0x53e0('0x10')]][_0x53e0('0x3e')]=_0xee7849['value'];}if(!_['isNil'](_0xee7849[_0x53e0('0x34')][_0x53e0('0x3f')])){channels[_0xee7849[_0x53e0('0x10')]]['sipcallid']=_0xee7849[_0x53e0('0x33')];}}}catch(_0x5bf6d2){utils['error'](_0x5bf6d2['stack']);}};exports['newexten']=function(_0x3854ac){try{if(!_[_0x53e0('0x1b')](channels[_0x3854ac[_0x53e0('0x10')]])){if(_0x3854ac[_0x53e0('0x40')][_0x53e0('0x41')]()==_0x53e0('0x42')&&_[_0x53e0('0x43')](_0x3854ac[_0x53e0('0x44')][_0x53e0('0x41')](),_0x53e0('0x45'))){var _0x12a834=_0x3854ac[_0x53e0('0x44')][_0x53e0('0x46')]('=');var _0x1a3adb=_0x12a834[0x0][_0x53e0('0x47')](_0x12a834[0x0]['lastIndexOf']('(')+0x1,_0x12a834[0x0]['lastIndexOf'](')'));var _0x45610a=_0x12a834[0x1];channels[_0x3854ac[_0x53e0('0x10')]][_0x1a3adb]=_0x45610a;}if(!_[_0x53e0('0x48')]([_0x53e0('0x49'),_0x53e0('0x4a'),_0x53e0('0x4b'),'set',_0x53e0('0x4c')],_0x3854ac['application'][_0x53e0('0x41')]())){channels[_0x3854ac[_0x53e0('0x10')]][_0x53e0('0x39')]=_0x3854ac[_0x53e0('0x40')];channels[_0x3854ac[_0x53e0('0x10')]][_0x53e0('0x4d')]=_0x3854ac[_0x53e0('0x44')];}}}catch(_0x1fbad9){utils['error'](_0x1fbad9['stack']);}}; \ No newline at end of file +var _0xaa7a=['substring','lastIndexOf','includes','noop','set','gotoif','toLowerCase','lodash','util','./utils','NO\x20ANSWER','FAILED','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','callerid','disposition','then','UserId','CreateVoiceCallReport','uniqueid','linkedid','exten','now','DOCUMENTATION','error','stack','newstate','isNil','channelstate','transfer','answertime','toNumber','ANSWERED','hangup','calleridnum','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','value','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','startsWith','appdata','split'];(function(_0x1ec730,_0x241084){var _0x248c65=function(_0x41cece){while(--_0x41cece){_0x1ec730['push'](_0x1ec730['shift']());}};_0x248c65(++_0x241084);}(_0xaa7a,0xe8));var _0xaaa7=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xaa7a[_0x510b98];return _0x45e775;};'use strict';var _=require(_0xaaa7('0x0'));var util=require(_0xaaa7('0x1'));var utils=require(_0xaaa7('0x2'));var dispositions=[_0xaaa7('0x3'),_0xaaa7('0x4'),_0xaaa7('0x4'),_0xaaa7('0x3'),_0xaaa7('0x3'),_0xaaa7('0x3'),'ANSWERED','BUSY',_0xaaa7('0x4'),_0xaaa7('0x4'),'FAILED'];var channels={};function writeDB(_0x54e8ab){utils['info'](util['format'](_0xaaa7('0x5'),_0x54e8ab['uniqueid'],_0x54e8ab[_0xaaa7('0x6')],_0x54e8ab[_0xaaa7('0x7')],_0x54e8ab[_0xaaa7('0x8')],_0x54e8ab[_0xaaa7('0x9')],_0x54e8ab[_0xaaa7('0xa')],_0x54e8ab[_0xaaa7('0xb')],_0x54e8ab[_0xaaa7('0xc')]));if(_0x54e8ab[_0xaaa7('0x8')]){utils['getUserByInternal'](_0x54e8ab[_0xaaa7('0x8')])[_0xaaa7('0xd')](function(_0x21a286){if(_0x21a286){_0x54e8ab[_0xaaa7('0xe')]=_0x21a286['id'];}utils['request'](_0xaaa7('0xf'),_0x54e8ab);});}else{utils['request'](_0xaaa7('0xf'),_0x54e8ab);}if(channels[_0x54e8ab['uniqueid']]){delete channels[_0x54e8ab[_0xaaa7('0x10')]];}}exports['newchannel']=function(_0x196b06){try{if(_0x196b06[_0xaaa7('0x10')]==_0x196b06[_0xaaa7('0x11')]&&_0x196b06[_0xaaa7('0x6')]!='OutgoingSpoolFailed'){channels[_0x196b06['uniqueid']]={'uniqueid':_0x196b06['uniqueid'],'accountcode':_0x196b06[_0xaaa7('0x8')],'source':_0x196b06['calleridnum'],'destination':_0x196b06[_0xaaa7('0x12')],'destinationcontext':_0x196b06['context'],'channel':_0x196b06[_0xaaa7('0x6')],'starttime':utils[_0xaaa7('0x13')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xaaa7('0x14')};}}catch(_0xe25bdb){utils[_0xaaa7('0x15')](_0xe25bdb[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x17')]=function(_0x121429){try{if(!_[_0xaaa7('0x18')](channels[_0x121429[_0xaaa7('0x10')]])&&_0x121429[_0xaaa7('0x19')]==0x6){if(_[_0xaaa7('0x18')](channels[_0x121429[_0xaaa7('0x10')]]['systemanswertime'])){channels[_0x121429[_0xaaa7('0x10')]]['systemanswertime']=utils[_0xaaa7('0x13')]();}}else if(!_[_0xaaa7('0x18')](channels[_0x121429['linkedid']])&&_0x121429[_0xaaa7('0x19')]==0x6&&_0x121429['context']!=_0xaaa7('0x1a')){channels[_0x121429[_0xaaa7('0x11')]][_0xaaa7('0x8')]=_0x121429[_0xaaa7('0x8')];channels[_0x121429[_0xaaa7('0x11')]]['destinationchannel']=_0x121429['channel'];if(_['isNil'](channels[_0x121429[_0xaaa7('0x11')]][_0xaaa7('0x1b')])){channels[_0x121429['linkedid']]['answertime']=utils['now']();}channels[_0x121429[_0xaaa7('0x11')]][_0xaaa7('0xc')]=dispositions[_[_0xaaa7('0x1c')](_0x121429[_0xaaa7('0x19')])]||_0xaaa7('0x1d');}}catch(_0xd7adf9){utils[_0xaaa7('0x15')](_0xd7adf9[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x1e')]=function(_0x522f1a){try{if(!_[_0xaaa7('0x18')](channels[_0x522f1a[_0xaaa7('0x10')]])){if(_[_0xaaa7('0x18')](channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0xb')])){channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0xb')]=_0x522f1a['calleridname']+'\x20<'+_0x522f1a[_0xaaa7('0x1f')]+'>';}channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x20')]=utils[_0xaaa7('0x13')]();channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x21')]=utils[_0xaaa7('0x22')](channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x20')],channels[_0x522f1a[_0xaaa7('0x10')]]['starttime']);channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x23')]=channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x1b')]?utils[_0xaaa7('0x22')](channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x20')],channels[_0x522f1a[_0xaaa7('0x10')]][_0xaaa7('0x1b')]):0x0;writeDB(channels[_0x522f1a[_0xaaa7('0x10')]]);}}catch(_0x468e8f){utils['error'](_0x468e8f[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x24')]=function(_0x12ba88){try{if(!_[_0xaaa7('0x18')](channels[_0x12ba88[_0xaaa7('0x25')]])){if(channels[_0x12ba88[_0xaaa7('0x25')]][_0xaaa7('0x6')]==_0x12ba88[_0xaaa7('0x26')]){channels[_0x12ba88['localtwolinkedid']][_0xaaa7('0x27')]=_0x12ba88[_0xaaa7('0x28')];channels[_0x12ba88[_0xaaa7('0x25')]][_0xaaa7('0x29')]=_0xaaa7('0x2a');}else if(channels[_0x12ba88[_0xaaa7('0x25')]][_0xaaa7('0x6')]=_0x12ba88[_0xaaa7('0x2b')]){channels[_0x12ba88['localtwolinkedid']][_0xaaa7('0x27')]=_0x12ba88[_0xaaa7('0x2c')];channels[_0x12ba88[_0xaaa7('0x25')]][_0xaaa7('0x29')]=_0xaaa7('0x2a');}}}catch(_0x3be1e0){utils[_0xaaa7('0x15')](_0x3be1e0[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x2d')]=function(_0x29a053){try{if(!_[_0xaaa7('0x18')](channels[_0x29a053['uniqueid']])){channels[_0x29a053[_0xaaa7('0x10')]][_0xaaa7('0x2e')]=utils[_0xaaa7('0x13')]();}}catch(_0x24a742){utils[_0xaaa7('0x15')](_0x24a742[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x2f')]=function(_0x5e30b8){try{if(!_[_0xaaa7('0x18')](channels[_0x5e30b8['uniqueid']])){if(!_[_0xaaa7('0x18')](channels[_0x5e30b8[_0xaaa7('0x10')]][_0xaaa7('0x2e')])){channels[_0x5e30b8[_0xaaa7('0x10')]]['mohtime']+=utils[_0xaaa7('0x22')](utils[_0xaaa7('0x13')](),channels[_0x5e30b8['uniqueid']][_0xaaa7('0x2e')]);delete channels[_0x5e30b8['uniqueid']][_0xaaa7('0x2e')];}}}catch(_0x3e8320){utils['error'](_0x3e8320[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x30')]=function(_0x55aa5b){try{if(!_[_0xaaa7('0x18')](channels[_0x55aa5b[_0xaaa7('0x10')]])){if(!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')]['xmd-originatecalleridnum'])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x9')]=_0x55aa5b[_0xaaa7('0x32')];}if(!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')]['xmd-phone'])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0xa')]=_0x55aa5b['value'];channels[_0x55aa5b['uniqueid']][_0xaaa7('0xb')]='\x22'+_0x55aa5b[_0xaaa7('0x32')]+'\x22\x20<'+_0x55aa5b['value']+'>';}if(!_['isNil'](_0x55aa5b[_0xaaa7('0x31')]['xmd-callerid-preview'])||!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')][_0xaaa7('0x33')])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0xb')]=_0x55aa5b[_0xaaa7('0x32')];}if(!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')][_0xaaa7('0x34')])||!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')][_0xaaa7('0x35')])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x36')]='Queue';channels[_0x55aa5b['uniqueid']][_0xaaa7('0x37')]=_0x55aa5b[_0xaaa7('0x32')];channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x38')]=!![];}if(!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')][_0xaaa7('0x39')])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x3a')]=_0x55aa5b[_0xaaa7('0x32')];}if(!_[_0xaaa7('0x18')](_0x55aa5b['variable'][_0xaaa7('0x3b')])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x7')]=_0x55aa5b[_0xaaa7('0x32')];}if(!_['isNil'](_0x55aa5b['variable'][_0xaaa7('0x3c')])){channels[_0x55aa5b[_0xaaa7('0x10')]][_0xaaa7('0x3d')]=_0x55aa5b[_0xaaa7('0x32')];}if(!_[_0xaaa7('0x18')](_0x55aa5b[_0xaaa7('0x31')][_0xaaa7('0x3e')])){channels[_0x55aa5b['uniqueid']][_0xaaa7('0x3e')]=_0x55aa5b[_0xaaa7('0x32')];}}}catch(_0x5add78){utils[_0xaaa7('0x15')](_0x5add78[_0xaaa7('0x16')]);}};exports[_0xaaa7('0x3f')]=function(_0x18780e){try{if(!_['isNil'](channels[_0x18780e[_0xaaa7('0x10')]])){if(_0x18780e[_0xaaa7('0x40')]['toLowerCase']()=='set'&&_[_0xaaa7('0x41')](_0x18780e[_0xaaa7('0x42')]['toLowerCase'](),'cdr')){var _0x11e796=_0x18780e[_0xaaa7('0x42')][_0xaaa7('0x43')]('=');var _0x254519=_0x11e796[0x0][_0xaaa7('0x44')](_0x11e796[0x0][_0xaaa7('0x45')]('(')+0x1,_0x11e796[0x0]['lastIndexOf'](')'));var _0x3848b4=_0x11e796[0x1];channels[_0x18780e[_0xaaa7('0x10')]][_0x254519]=_0x3848b4;}if(!_[_0xaaa7('0x46')]([_0xaaa7('0x1e'),_0xaaa7('0x47'),'execif',_0xaaa7('0x48'),_0xaaa7('0x49')],_0x18780e['application'][_0xaaa7('0x4a')]())){channels[_0x18780e['uniqueid']][_0xaaa7('0x36')]=_0x18780e['application'];channels[_0x18780e[_0xaaa7('0x10')]]['lastdata']=_0x18780e[_0xaaa7('0x42')];}}}catch(_0x27274e){utils[_0xaaa7('0x15')](_0x27274e[_0xaaa7('0x16')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9f0f942..f85eb81 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 _0x7fbe=['close','managerevent','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error'];(function(_0x768ae3,_0x58e5cc){var _0x124619=function(_0x2b5fcd){while(--_0x2b5fcd){_0x768ae3['push'](_0x768ae3['shift']());}};_0x124619(++_0x58e5cc);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x50bca7,_0xb23979){_0x50bca7=_0x50bca7-0x0;var _0x40e5ee=_0x7fbe[_0x50bca7];return _0x40e5ee;};'use strict';var utils=require('./utils');var _=require('lodash');exports[_0xe7fb('0x0')]=function(){utils[_0xe7fb('0x1')](_0xe7fb('0x2'));};exports[_0xe7fb('0x3')]=function(){utils[_0xe7fb('0x1')](_0xe7fb('0x4'));};exports[_0xe7fb('0x5')]=function(){utils[_0xe7fb('0x1')](_0xe7fb('0x6'));};exports[_0xe7fb('0x7')]=function(_0x290172){utils[_0xe7fb('0x7')](_0x290172);};exports[_0xe7fb('0x8')]=function(){utils[_0xe7fb('0x1')]('CLOSE');};exports[_0xe7fb('0x9')]=function(_0x228f6b){}; \ No newline at end of file +var _0xb138=['FULLYBOOTED','error','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED','shutdown','fullybooted'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xb138,0x1dd));var _0x8b13=function(_0x37f065,_0x5bdd02){_0x37f065=_0x37f065-0x0;var _0x4bc31e=_0xb138[_0x37f065];return _0x4bc31e;};'use strict';var utils=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));exports[_0x8b13('0x2')]=function(){utils[_0x8b13('0x3')](_0x8b13('0x4'));};exports[_0x8b13('0x5')]=function(){utils[_0x8b13('0x3')]('SHUTDOWN');};exports[_0x8b13('0x6')]=function(){utils[_0x8b13('0x3')](_0x8b13('0x7'));};exports['error']=function(_0xd19a0f){utils[_0x8b13('0x8')](_0xd19a0f);};exports['close']=function(){utils[_0x8b13('0x3')](_0x8b13('0x9'));};exports[_0x8b13('0xa')]=function(_0x498832){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 369a336..41a6b77 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 _0x8bc6=['error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','starttime','lastevent','dialend','assign','answertime','now','connect','hangup','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','info','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','newexten','set','startsWith','appdata','toLowerCase'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x8bc6,0xc4));var _0x68bc=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x8bc6[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x68bc('0x0'));var util=require(_0x68bc('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x37b5d7){utils[_0x68bc('0x2')](util['format'](_0x68bc('0x3'),_0x37b5d7[_0x68bc('0x4')],_0x37b5d7[_0x68bc('0x5')],_0x37b5d7[_0x68bc('0x6')],_0x37b5d7['calleridnum'],_0x37b5d7[_0x68bc('0x7')],_0x37b5d7[_0x68bc('0x8')]));utils['request']('CreateVoiceDialReport',_0x37b5d7);delete dials[_0x37b5d7[_0x68bc('0x4')]];}exports[_0x68bc('0x9')]=function(_0x1ae657){try{if(_0x1ae657['application']['toLowerCase']()==_0x68bc('0xa')&&_[_0x68bc('0xb')](_0x1ae657[_0x68bc('0xc')][_0x68bc('0xd')](),'cdr(routeid)')){var _0x3429ca=_0x1ae657['appdata']['split']('=');dials[_0x1ae657[_0x68bc('0x4')]]={'routeId':_0x3429ca[0x1]};}}catch(_0x3c8485){utils[_0x68bc('0xe')](_0x3c8485[_0x68bc('0xf')]);}};exports[_0x68bc('0x10')]=function(_0x3c44d7){try{if(!_[_0x68bc('0x11')](_0x3c44d7[_0x68bc('0x12')][_0x68bc('0x13')])){dials[_0x3c44d7[_0x68bc('0x4')]]={'routeId':_0x3c44d7[_0x68bc('0x14')]};}}catch(_0x2807ee){utils[_0x68bc('0xe')](_0x2807ee[_0x68bc('0xf')]);}};exports[_0x68bc('0x15')]=function(_0x464dd9){try{if(!_[_0x68bc('0x11')](dials[_0x464dd9[_0x68bc('0x4')]])){dials[_0x464dd9[_0x68bc('0x4')]]=_['assign'](dials[_0x464dd9[_0x68bc('0x4')]],_0x464dd9);dials[_0x464dd9[_0x68bc('0x4')]][_0x68bc('0x16')]=utils['now']();dials[_0x464dd9[_0x68bc('0x4')]][_0x68bc('0x17')]='called';}}catch(_0x46c5a6){utils[_0x68bc('0xe')](_0x46c5a6[_0x68bc('0xf')]);}};exports[_0x68bc('0x18')]=function(_0x272020){try{if(!_[_0x68bc('0x11')](dials[_0x272020['uniqueid']])){dials[_0x272020['uniqueid']][_0x68bc('0x8')]=_0x272020[_0x68bc('0x8')];if(_0x272020[_0x68bc('0x8')]=='ANSWER'){dials[_0x272020[_0x68bc('0x4')]]=_[_0x68bc('0x19')](dials[_0x272020[_0x68bc('0x4')]],_0x272020);dials[_0x272020[_0x68bc('0x4')]][_0x68bc('0x1a')]=utils[_0x68bc('0x1b')]();dials[_0x272020[_0x68bc('0x4')]]['lastevent']=_0x68bc('0x1c');}}}catch(_0x3a413b){utils[_0x68bc('0xe')](_0x3a413b[_0x68bc('0xf')]);}};exports[_0x68bc('0x1d')]=function(_0x1e9a35){try{if(!_[_0x68bc('0x11')](dials[_0x1e9a35[_0x68bc('0x4')]])){dials[_0x1e9a35[_0x68bc('0x4')]]=_[_0x68bc('0x19')](dials[_0x1e9a35[_0x68bc('0x4')]],{'endtime':utils['now'](),'lastevent':_0x68bc('0x1e')});dials[_0x1e9a35[_0x68bc('0x4')]]['duration']=utils[_0x68bc('0x1f')](dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x20')],dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x16')]);dials[_0x1e9a35['uniqueid']][_0x68bc('0x21')]=utils['diffTime'](dials[_0x1e9a35[_0x68bc('0x4')]]['answertime']||dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x20')],dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x16')]);dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x22')]=dials[_0x1e9a35[_0x68bc('0x4')]][_0x68bc('0x1a')]?utils[_0x68bc('0x1f')](dials[_0x1e9a35[_0x68bc('0x4')]]['endtime'],dials[_0x1e9a35['uniqueid']]['answertime']):0x0;writeDB(dials[_0x1e9a35[_0x68bc('0x4')]]);}}catch(_0x34f80b){utils[_0x68bc('0xe')](_0x34f80b[_0x68bc('0xf')]);}}; \ No newline at end of file +var _0x9ff3=['toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','isNil','variable','outboundrouteid','stack','starttime','now','lastevent','dialend','dialstatus','assign','answertime','connect','hangup','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','newexten'];(function(_0x261ae7,_0x16a2d5){var _0x5999ba=function(_0x54868a){while(--_0x54868a){_0x261ae7['push'](_0x261ae7['shift']());}};_0x5999ba(++_0x16a2d5);}(_0x9ff3,0x104));var _0x39ff=function(_0x4472fd,_0x3158eb){_0x4472fd=_0x4472fd-0x0;var _0x23e05e=_0x9ff3[_0x4472fd];return _0x23e05e;};'use strict';var _=require(_0x39ff('0x0'));var util=require(_0x39ff('0x1'));var utils=require(_0x39ff('0x2'));var dials={};function writeDB(_0x575aa0){utils[_0x39ff('0x3')](util[_0x39ff('0x4')](_0x39ff('0x5'),_0x575aa0[_0x39ff('0x6')],_0x575aa0[_0x39ff('0x7')],_0x575aa0[_0x39ff('0x8')],_0x575aa0[_0x39ff('0x9')],_0x575aa0[_0x39ff('0xa')],_0x575aa0['dialstatus']));utils[_0x39ff('0xb')]('CreateVoiceDialReport',_0x575aa0);delete dials[_0x575aa0[_0x39ff('0x6')]];}exports[_0x39ff('0xc')]=function(_0xe8bdff){try{if(_0xe8bdff['application'][_0x39ff('0xd')]()==_0x39ff('0xe')&&_[_0x39ff('0xf')](_0xe8bdff[_0x39ff('0x10')][_0x39ff('0xd')](),_0x39ff('0x11'))){var _0x45c56d=_0xe8bdff[_0x39ff('0x10')][_0x39ff('0x12')]('=');dials[_0xe8bdff[_0x39ff('0x6')]]={'routeId':_0x45c56d[0x1]};}}catch(_0x56a00c){utils[_0x39ff('0x13')](_0x56a00c['stack']);}};exports['varset']=function(_0x352ebf){try{if(!_[_0x39ff('0x14')](_0x352ebf[_0x39ff('0x15')][_0x39ff('0x16')])){dials[_0x352ebf['uniqueid']]={'routeId':_0x352ebf['value']};}}catch(_0x1a5dcf){utils[_0x39ff('0x13')](_0x1a5dcf[_0x39ff('0x17')]);}};exports['dialbegin']=function(_0x1f3890){try{if(!_[_0x39ff('0x14')](dials[_0x1f3890[_0x39ff('0x6')]])){dials[_0x1f3890['uniqueid']]=_['assign'](dials[_0x1f3890[_0x39ff('0x6')]],_0x1f3890);dials[_0x1f3890[_0x39ff('0x6')]][_0x39ff('0x18')]=utils[_0x39ff('0x19')]();dials[_0x1f3890[_0x39ff('0x6')]][_0x39ff('0x1a')]='called';}}catch(_0x1df667){utils[_0x39ff('0x13')](_0x1df667[_0x39ff('0x17')]);}};exports[_0x39ff('0x1b')]=function(_0x22348a){try{if(!_[_0x39ff('0x14')](dials[_0x22348a[_0x39ff('0x6')]])){dials[_0x22348a[_0x39ff('0x6')]][_0x39ff('0x1c')]=_0x22348a[_0x39ff('0x1c')];if(_0x22348a[_0x39ff('0x1c')]=='ANSWER'){dials[_0x22348a[_0x39ff('0x6')]]=_[_0x39ff('0x1d')](dials[_0x22348a['uniqueid']],_0x22348a);dials[_0x22348a[_0x39ff('0x6')]][_0x39ff('0x1e')]=utils[_0x39ff('0x19')]();dials[_0x22348a[_0x39ff('0x6')]][_0x39ff('0x1a')]=_0x39ff('0x1f');}}}catch(_0x453e1f){utils[_0x39ff('0x13')](_0x453e1f[_0x39ff('0x17')]);}};exports[_0x39ff('0x20')]=function(_0x293dc0){try{if(!_[_0x39ff('0x14')](dials[_0x293dc0['uniqueid']])){dials[_0x293dc0[_0x39ff('0x6')]]=_[_0x39ff('0x1d')](dials[_0x293dc0[_0x39ff('0x6')]],{'endtime':utils[_0x39ff('0x19')](),'lastevent':_0x39ff('0x21')});dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x22')]=utils[_0x39ff('0x23')](dials[_0x293dc0['uniqueid']][_0x39ff('0x24')],dials[_0x293dc0['uniqueid']][_0x39ff('0x18')]);dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x25')]=utils[_0x39ff('0x23')](dials[_0x293dc0['uniqueid']]['answertime']||dials[_0x293dc0['uniqueid']][_0x39ff('0x24')],dials[_0x293dc0['uniqueid']][_0x39ff('0x18')]);dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x26')]=dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x1e')]?utils['diffTime'](dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x24')],dials[_0x293dc0[_0x39ff('0x6')]][_0x39ff('0x1e')]):0x0;writeDB(dials[_0x293dc0[_0x39ff('0x6')]]);}}catch(_0x4e66eb){utils[_0x39ff('0x13')](_0x4e66eb[_0x39ff('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ac37cf3..4933bbe 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 _0x5ee3=['shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','./utils','asterisk','username','password','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x9854ff,_0x36d049){var _0x367261=function(_0x3b43f9){while(--_0x3b43f9){_0x9854ff['push'](_0x9854ff['shift']());}};_0x367261(++_0x36d049);}(_0x5ee3,0x12a));var _0x35ee=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5ee3[_0x328534];return _0x2796c0;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x35ee('0x0'));var ami=new AsteriskManager(config[_0x35ee('0x1')]['port'],config[_0x35ee('0x1')]['ip'],config[_0x35ee('0x1')][_0x35ee('0x2')],config[_0x35ee('0x1')][_0x35ee('0x3')],!![]);ami['keepConnected']();if(config['xdr']&&config['xdr'][_0x35ee('0x4')]){utils[_0x35ee('0x5')](_0x35ee('0x6'));}else{var agents=require('./agents.controller');var calls=require(_0x35ee('0x7'));var queues=require(_0x35ee('0x8'));var recordings=require('./recordings.controller');var members=require(_0x35ee('0x9'));var dials=require(_0x35ee('0xa'));var transfers=require(_0x35ee('0xb'));var core=require(_0x35ee('0xc'));ami['on'](_0x35ee('0xd'),core[_0x35ee('0xd')]);ami['on'](_0x35ee('0xe'),core[_0x35ee('0xe')]);ami['on'](_0x35ee('0xf'),core['fullybooted']);ami['on'](_0x35ee('0x10'),core['error']);ami['on'](_0x35ee('0x11'),core[_0x35ee('0x11')]);ami['on'](_0x35ee('0x12'),core[_0x35ee('0x12')]);ami['on']('devicestatechange',function(_0x2307ec){try{members[_0x35ee('0x13')](_0x2307ec);}catch(_0x438c99){utils[_0x35ee('0x10')](_0x438c99);}});ami['on']('agentcalled',function(_0x7d5c98){try{agents[_0x35ee('0x14')](_0x7d5c98);}catch(_0x4d7820){utils[_0x35ee('0x10')](_0x4d7820);}});ami['on'](_0x35ee('0x15'),function(_0x3a2cba){try{agents[_0x35ee('0x15')](_0x3a2cba);}catch(_0x129e80){utils[_0x35ee('0x10')](_0x129e80);}});ami['on'](_0x35ee('0x16'),function(_0x65ab12){try{agents[_0x35ee('0x16')](_0x65ab12);queues['agentconnect'](_0x65ab12);}catch(_0x3073ef){utils[_0x35ee('0x10')](_0x3073ef);}});ami['on']('agentcomplete',function(_0x126f54){try{agents['agentcomplete'](_0x126f54);queues[_0x35ee('0x17')](_0x126f54);members[_0x35ee('0x17')](_0x126f54);}catch(_0x1275cf){utils['error'](_0x1275cf);}});ami['on'](_0x35ee('0x18'),function(_0x40d0ac){try{agents['queuecallerabandon'](_0x40d0ac);queues['queuecallerabandon'](_0x40d0ac);}catch(_0x494cbf){utils[_0x35ee('0x10')](_0x494cbf);}});ami['on']('queuecallerjoin',function(_0x175dd6){try{queues[_0x35ee('0x19')](_0x175dd6);recordings[_0x35ee('0x19')](_0x175dd6);}catch(_0x3d38b1){utils['error'](_0x3d38b1);}});ami['on'](_0x35ee('0x1a'),function(_0x1de9b8){try{queues[_0x35ee('0x1a')](_0x1de9b8);}catch(_0x59fda5){utils[_0x35ee('0x10')](_0x59fda5);}});ami['on'](_0x35ee('0x1b'),function(_0x57c201){try{queues['musiconholdstart'](_0x57c201);calls[_0x35ee('0x1b')](_0x57c201);}catch(_0x334a46){utils[_0x35ee('0x10')](_0x334a46);}});ami['on'](_0x35ee('0x1c'),function(_0x4c9d0f){try{queues[_0x35ee('0x1c')](_0x4c9d0f);calls[_0x35ee('0x1c')](_0x4c9d0f);}catch(_0x3d3875){utils['error'](_0x3d3875);}});ami['on'](_0x35ee('0x1d'),function(_0x599c5c){try{calls['newstate'](_0x599c5c);recordings[_0x35ee('0x1d')](_0x599c5c);}catch(_0x3f214d){utils[_0x35ee('0x10')](_0x3f214d);}});ami['on']('hangup',function(_0x2359e0){try{calls['hangup'](_0x2359e0);recordings[_0x35ee('0x1e')](_0x2359e0);dials[_0x35ee('0x1e')](_0x2359e0);agents['hangup'](_0x2359e0);queues[_0x35ee('0x1e')](_0x2359e0);}catch(_0x1473b5){utils[_0x35ee('0x10')](_0x1473b5);}});ami['on'](_0x35ee('0x1f'),function(_0x40e6cc){try{members[_0x35ee('0x1f')](_0x40e6cc);}catch(_0x3141f2){utils[_0x35ee('0x10')](_0x3141f2);}});ami['on'](_0x35ee('0x20'),function(_0x537f1b){try{queues['blindtransfer'](_0x537f1b);agents[_0x35ee('0x20')](_0x537f1b);transfers[_0x35ee('0x20')](_0x537f1b);}catch(_0x16f754){utils[_0x35ee('0x10')](_0x16f754);}});ami['on'](_0x35ee('0x21'),function(_0x2a3dc5){try{queues['attendedtransfer'](_0x2a3dc5);transfers[_0x35ee('0x21')](_0x2a3dc5);agents[_0x35ee('0x21')](_0x2a3dc5);calls[_0x35ee('0x21')](_0x2a3dc5);}catch(_0x4bc936){utils[_0x35ee('0x10')](_0x4bc936);}});ami['on']('varset',function(_0x54c1ed){try{queues[_0x35ee('0x22')](_0x54c1ed);recordings['varset'](_0x54c1ed);calls[_0x35ee('0x22')](_0x54c1ed);dials[_0x35ee('0x22')](_0x54c1ed);}catch(_0x19838d){utils[_0x35ee('0x10')](_0x19838d);}});ami['on'](_0x35ee('0x23'),function(_0x2c7134){try{calls[_0x35ee('0x23')](_0x2c7134);recordings['newexten'](_0x2c7134);dials['newexten'](_0x2c7134);}catch(_0x54cea1){utils[_0x35ee('0x10')](_0x54cea1);}});ami['on'](_0x35ee('0x24'),function(_0x28d68f){try{calls[_0x35ee('0x24')](_0x28d68f);recordings[_0x35ee('0x24')](_0x28d68f);}catch(_0xc8349){utils[_0x35ee('0x10')](_0xc8349);}});ami['on'](_0x35ee('0x25'),function(_0x26e166){try{dials[_0x35ee('0x25')](_0x26e166);}catch(_0x5c46f4){utils[_0x35ee('0x10')](_0x5c46f4);}});ami['on']('dialend',function(_0x4f1281){try{dials[_0x35ee('0x26')](_0x4f1281);}catch(_0x42c7da){utils[_0x35ee('0x10')](_0x42c7da);}});} \ No newline at end of file +var _0x88a6=['agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x472189,_0x39b4d1){var _0x6ec7f2=function(_0x199a93){while(--_0x199a93){_0x472189['push'](_0x472189['shift']());}};_0x6ec7f2(++_0x39b4d1);}(_0x88a6,0xea));var _0x688a=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0x88a6[_0x3727a9];return _0xa16806;};var AsteriskManager=require(_0x688a('0x0'));var config=require(_0x688a('0x1'));var utils=require(_0x688a('0x2'));var ami=new AsteriskManager(config[_0x688a('0x3')][_0x688a('0x4')],config[_0x688a('0x3')]['ip'],config[_0x688a('0x3')][_0x688a('0x5')],config['asterisk'][_0x688a('0x6')],!![]);ami[_0x688a('0x7')]();if(config['xdr']&&config[_0x688a('0x8')][_0x688a('0x9')]){utils[_0x688a('0xa')](_0x688a('0xb'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x688a('0xc'));var recordings=require('./recordings.controller');var members=require(_0x688a('0xd'));var dials=require(_0x688a('0xe'));var transfers=require(_0x688a('0xf'));var core=require(_0x688a('0x10'));ami['on']('connect',core[_0x688a('0x11')]);ami['on'](_0x688a('0x12'),core[_0x688a('0x12')]);ami['on']('fullybooted',core[_0x688a('0x13')]);ami['on']('error',core[_0x688a('0x14')]);ami['on'](_0x688a('0x15'),core['close']);ami['on'](_0x688a('0x16'),core[_0x688a('0x16')]);ami['on'](_0x688a('0x17'),function(_0x6a6dbf){try{members[_0x688a('0x17')](_0x6a6dbf);}catch(_0x12c6b5){utils['error'](_0x12c6b5);}});ami['on']('agentcalled',function(_0x30fa8d){try{agents[_0x688a('0x18')](_0x30fa8d);}catch(_0x23d3e7){utils[_0x688a('0x14')](_0x23d3e7);}});ami['on'](_0x688a('0x19'),function(_0x525298){try{agents[_0x688a('0x19')](_0x525298);}catch(_0x21246a){utils[_0x688a('0x14')](_0x21246a);}});ami['on'](_0x688a('0x1a'),function(_0xdff6b2){try{agents[_0x688a('0x1a')](_0xdff6b2);queues[_0x688a('0x1a')](_0xdff6b2);}catch(_0x550527){utils['error'](_0x550527);}});ami['on'](_0x688a('0x1b'),function(_0x192c6b){try{agents['agentcomplete'](_0x192c6b);queues[_0x688a('0x1b')](_0x192c6b);members[_0x688a('0x1b')](_0x192c6b);}catch(_0x1ca70b){utils[_0x688a('0x14')](_0x1ca70b);}});ami['on'](_0x688a('0x1c'),function(_0x30ce9f){try{agents[_0x688a('0x1c')](_0x30ce9f);queues['queuecallerabandon'](_0x30ce9f);}catch(_0x63ec8d){utils[_0x688a('0x14')](_0x63ec8d);}});ami['on']('queuecallerjoin',function(_0x2a6571){try{queues[_0x688a('0x1d')](_0x2a6571);recordings[_0x688a('0x1d')](_0x2a6571);}catch(_0x35d0a3){utils[_0x688a('0x14')](_0x35d0a3);}});ami['on'](_0x688a('0x1e'),function(_0x538a99){try{queues['queuecallerleave'](_0x538a99);}catch(_0x1925b2){utils[_0x688a('0x14')](_0x1925b2);}});ami['on'](_0x688a('0x1f'),function(_0x8b63fc){try{queues[_0x688a('0x1f')](_0x8b63fc);calls[_0x688a('0x1f')](_0x8b63fc);}catch(_0x3d62b9){utils['error'](_0x3d62b9);}});ami['on'](_0x688a('0x20'),function(_0x2ad443){try{queues['musiconholdstop'](_0x2ad443);calls[_0x688a('0x20')](_0x2ad443);}catch(_0x25a1f7){utils['error'](_0x25a1f7);}});ami['on'](_0x688a('0x21'),function(_0x13d969){try{calls[_0x688a('0x21')](_0x13d969);recordings['newstate'](_0x13d969);}catch(_0x588edf){utils[_0x688a('0x14')](_0x588edf);}});ami['on'](_0x688a('0x22'),function(_0x351366){try{calls[_0x688a('0x22')](_0x351366);recordings[_0x688a('0x22')](_0x351366);dials[_0x688a('0x22')](_0x351366);agents['hangup'](_0x351366);queues[_0x688a('0x22')](_0x351366);}catch(_0x39c7b0){utils['error'](_0x39c7b0);}});ami['on'](_0x688a('0x23'),function(_0x37d507){try{members[_0x688a('0x23')](_0x37d507);}catch(_0xf40d60){utils[_0x688a('0x14')](_0xf40d60);}});ami['on'](_0x688a('0x24'),function(_0x54d592){try{queues[_0x688a('0x24')](_0x54d592);agents['blindtransfer'](_0x54d592);transfers[_0x688a('0x24')](_0x54d592);}catch(_0x189a71){utils[_0x688a('0x14')](_0x189a71);}});ami['on'](_0x688a('0x25'),function(_0x4a9096){try{queues[_0x688a('0x25')](_0x4a9096);transfers[_0x688a('0x25')](_0x4a9096);agents['attendedtransfer'](_0x4a9096);calls[_0x688a('0x25')](_0x4a9096);}catch(_0x5bbe8f){utils[_0x688a('0x14')](_0x5bbe8f);}});ami['on'](_0x688a('0x26'),function(_0x186b64){try{queues[_0x688a('0x26')](_0x186b64);recordings['varset'](_0x186b64);calls[_0x688a('0x26')](_0x186b64);dials[_0x688a('0x26')](_0x186b64);}catch(_0x408d7d){utils['error'](_0x408d7d);}});ami['on'](_0x688a('0x27'),function(_0x454f99){try{calls['newexten'](_0x454f99);recordings[_0x688a('0x27')](_0x454f99);dials['newexten'](_0x454f99);}catch(_0x28d3f0){utils[_0x688a('0x14')](_0x28d3f0);}});ami['on'](_0x688a('0x28'),function(_0x151c12){try{calls[_0x688a('0x28')](_0x151c12);recordings[_0x688a('0x28')](_0x151c12);}catch(_0x585474){utils[_0x688a('0x14')](_0x585474);}});ami['on'](_0x688a('0x29'),function(_0x45a76c){try{dials['dialbegin'](_0x45a76c);}catch(_0x219e71){utils[_0x688a('0x14')](_0x219e71);}});ami['on'](_0x688a('0x2a'),function(_0x4e2464){try{dials[_0x688a('0x2a')](_0x4e2464);}catch(_0x6f58e2){utils['error'](_0x6f58e2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 32059cb..49d859e 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 _0xc184=['CreateMemberReport','split','error','some','state','BUSY','device','voice','TALKING','now','agent','exitAt','duration','enterAt','agentcomplete','isNil','assign','queue','cdr','data1','source','data3','destination','destinationchannel','data2','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','membername','type','then','name','internal','request'];(function(_0x1d5044,_0x20d8bd){var _0x4440e3=function(_0x547753){while(--_0x547753){_0x1d5044['push'](_0x1d5044['shift']());}};_0x4440e3(++_0x20d8bd);}(_0xc184,0xdc));var _0x4c18=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xc184[_0x3b16e1];return _0x311d1b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x4c18('0x0'));var members={};var exclude=[_0x4c18('0x1'),_0x4c18('0x2')];function writeDB(_0x457d39){utils[_0x4c18('0x3')](util['format'](_0x4c18('0x4'),_0x457d39[_0x4c18('0x5')],_0x457d39[_0x4c18('0x6')],_0x457d39[_0x4c18('0x7')],_0x457d39['data2'],_0x457d39[_0x4c18('0x8')],_0x457d39[_0x4c18('0x9')]));if(_0x457d39[_0x4c18('0x6')]){utils['getUserByInterface'](_0x457d39[_0x4c18('0x6')])[_0x4c18('0xa')](function(_0x1e1744){if(_0x1e1744){_0x457d39['membername']=_0x1e1744[_0x4c18('0xb')];_0x457d39[_0x4c18('0xc')]=_0x1e1744[_0x4c18('0xc')];utils[_0x4c18('0xd')](_0x4c18('0xe'),_0x457d39);}else{utils['getUserByName'](_0x457d39[_0x4c18('0x6')][_0x4c18('0xf')]('/')[0x1])[_0x4c18('0xa')](function(_0x9f78f1){if(_0x9f78f1){_0x457d39[_0x4c18('0x8')]=_0x9f78f1[_0x4c18('0xb')];_0x457d39[_0x4c18('0xc')]=_0x9f78f1[_0x4c18('0xc')];utils[_0x4c18('0xd')](_0x4c18('0xe'),_0x457d39);}});}})['catch'](function(_0x2f2290){utils[_0x4c18('0x10')](_0x2f2290);});}delete members[_0x457d39['interface']];}function startsWith(_0x2243aa,_0x19dd41){return _[_0x4c18('0x11')](_0x2243aa,function(_0x4862ca){return _['startsWith'](_0x19dd41,_0x4862ca);});}exports['devicestatechange']=function(_0x48ff5d){switch(_0x48ff5d[_0x4c18('0x12')]){case'INUSE':case _0x4c18('0x13'):if(!startsWith(exclude,_0x48ff5d[_0x4c18('0x14')])){members[_0x48ff5d[_0x4c18('0x14')]]={'channel':_0x4c18('0x15'),'interface':_0x48ff5d[_0x4c18('0x14')],'type':_0x4c18('0x16'),'enterAt':utils[_0x4c18('0x17')](),'role':_0x4c18('0x18')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x48ff5d['device']])){members[_0x48ff5d['device']][_0x4c18('0x19')]=utils[_0x4c18('0x17')]();members[_0x48ff5d['device']][_0x4c18('0x1a')]=utils['diffTime'](members[_0x48ff5d[_0x4c18('0x14')]]['exitAt'],members[_0x48ff5d[_0x4c18('0x14')]][_0x4c18('0x1b')]);if(members[_0x48ff5d[_0x4c18('0x14')]][_0x4c18('0x5')]){writeDB(members[_0x48ff5d['device']]);}}default:break;}};exports[_0x4c18('0x1c')]=function(_0x3bf17b){if(!_[_0x4c18('0x1d')](members[_0x3bf17b['interface']])){members[_0x3bf17b[_0x4c18('0x6')]]=_[_0x4c18('0x1e')](members[_0x3bf17b[_0x4c18('0x6')]],{'data4':_0x3bf17b[_0x4c18('0x1f')],'uniqueid':_0x3bf17b[_0x4c18('0x5')]});}};exports[_0x4c18('0x20')]=function(_0x49ca7c){if(_0x49ca7c[_0x4c18('0x7')]){var _0x58e067=_0x49ca7c['channel'][_0x4c18('0xf')]('-')[0x0];if(!_[_0x4c18('0x1d')](members[_0x58e067])){members[_0x58e067]=_[_0x4c18('0x1e')](members[_0x58e067],{'data1':members[_0x58e067][_0x4c18('0x21')]||_0x49ca7c[_0x4c18('0x9')],'data2':members[_0x58e067]['data2']||_0x49ca7c[_0x4c18('0x22')],'data3':members[_0x58e067][_0x4c18('0x23')]||_0x49ca7c[_0x4c18('0x24')],'uniqueid':members[_0x58e067][_0x4c18('0x5')]||_0x49ca7c[_0x4c18('0x5')]});if(members[_0x58e067]['exitAt']){writeDB(members[_0x58e067]);}}}if(_0x49ca7c['destinationchannel']){var _0x367983=_0x49ca7c[_0x4c18('0x25')][_0x4c18('0xf')]('-')[0x0];if(!_[_0x4c18('0x1d')](members[_0x367983])){members[_0x367983]=_[_0x4c18('0x1e')](members[_0x367983],{'data1':members[_0x367983]['data1']||_0x49ca7c[_0x4c18('0x9')],'data2':members[_0x367983][_0x4c18('0x26')]||_0x49ca7c[_0x4c18('0x22')],'data3':members[_0x367983][_0x4c18('0x23')]||_0x49ca7c[_0x4c18('0x24')],'uniqueid':members[_0x367983]['uniqueid']||_0x49ca7c['uniqueid']});if(members[_0x367983][_0x4c18('0x19')]){writeDB(members[_0x367983]);}}}}; \ No newline at end of file +var _0x0a5a=['request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','state','INUSE','device','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','enterAt','agentcomplete','assign','queue','data1','source','data3','destination','uniqueid','exitAt','destinationchannel','data2','util','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','type','getUserByInterface','then','membername','name','internal'];(function(_0x4315b1,_0x160c06){var _0x12a1a9=function(_0x1c0abf){while(--_0x1c0abf){_0x4315b1['push'](_0x4315b1['shift']());}};_0x12a1a9(++_0x160c06);}(_0x0a5a,0x77));var _0xa0a5=function(_0x297bf4,_0x35eb38){_0x297bf4=_0x297bf4-0x0;var _0x536526=_0x0a5a[_0x297bf4];return _0x536526;};'use strict';var _=require('lodash');var util=require(_0xa0a5('0x0'));var utils=require('./utils');var members={};var exclude=[_0xa0a5('0x1'),_0xa0a5('0x2')];function writeDB(_0x2616bc){utils[_0xa0a5('0x3')](util['format'](_0xa0a5('0x4'),_0x2616bc['uniqueid'],_0x2616bc[_0xa0a5('0x5')],_0x2616bc[_0xa0a5('0x6')],_0x2616bc['data2'],_0x2616bc['membername'],_0x2616bc[_0xa0a5('0x7')]));if(_0x2616bc[_0xa0a5('0x5')]){utils[_0xa0a5('0x8')](_0x2616bc['interface'])[_0xa0a5('0x9')](function(_0x12cc66){if(_0x12cc66){_0x2616bc[_0xa0a5('0xa')]=_0x12cc66[_0xa0a5('0xb')];_0x2616bc[_0xa0a5('0xc')]=_0x12cc66[_0xa0a5('0xc')];utils[_0xa0a5('0xd')](_0xa0a5('0xe'),_0x2616bc);}else{utils[_0xa0a5('0xf')](_0x2616bc['interface'][_0xa0a5('0x10')]('/')[0x1])[_0xa0a5('0x9')](function(_0x2935dd){if(_0x2935dd){_0x2616bc['membername']=_0x2935dd[_0xa0a5('0xb')];_0x2616bc[_0xa0a5('0xc')]=_0x2935dd['internal'];utils[_0xa0a5('0xd')](_0xa0a5('0xe'),_0x2616bc);}});}})[_0xa0a5('0x11')](function(_0x520dd5){utils[_0xa0a5('0x12')](_0x520dd5);});}delete members[_0x2616bc[_0xa0a5('0x5')]];}function startsWith(_0xdb5925,_0x55837e){return _[_0xa0a5('0x13')](_0xdb5925,function(_0x25ba34){return _[_0xa0a5('0x14')](_0x55837e,_0x25ba34);});}exports[_0xa0a5('0x15')]=function(_0x4ed15b){switch(_0x4ed15b[_0xa0a5('0x16')]){case _0xa0a5('0x17'):case'BUSY':if(!startsWith(exclude,_0x4ed15b[_0xa0a5('0x18')])){members[_0x4ed15b[_0xa0a5('0x18')]]={'channel':'voice','interface':_0x4ed15b[_0xa0a5('0x18')],'type':_0xa0a5('0x19'),'enterAt':utils[_0xa0a5('0x1a')](),'role':_0xa0a5('0x1b')};}break;case _0xa0a5('0x1c'):if(!_[_0xa0a5('0x1d')](members[_0x4ed15b['device']])){members[_0x4ed15b['device']]['exitAt']=utils[_0xa0a5('0x1a')]();members[_0x4ed15b[_0xa0a5('0x18')]][_0xa0a5('0x1e')]=utils[_0xa0a5('0x1f')](members[_0x4ed15b[_0xa0a5('0x18')]]['exitAt'],members[_0x4ed15b[_0xa0a5('0x18')]][_0xa0a5('0x20')]);if(members[_0x4ed15b[_0xa0a5('0x18')]]['uniqueid']){writeDB(members[_0x4ed15b[_0xa0a5('0x18')]]);}}default:break;}};exports[_0xa0a5('0x21')]=function(_0x2643ca){if(!_['isNil'](members[_0x2643ca[_0xa0a5('0x5')]])){members[_0x2643ca[_0xa0a5('0x5')]]=_[_0xa0a5('0x22')](members[_0x2643ca[_0xa0a5('0x5')]],{'data4':_0x2643ca[_0xa0a5('0x23')],'uniqueid':_0x2643ca['uniqueid']});}};exports['cdr']=function(_0x54a19a){if(_0x54a19a[_0xa0a5('0x6')]){var _0x151f02=_0x54a19a[_0xa0a5('0x6')][_0xa0a5('0x10')]('-')[0x0];if(!_[_0xa0a5('0x1d')](members[_0x151f02])){members[_0x151f02]=_[_0xa0a5('0x22')](members[_0x151f02],{'data1':members[_0x151f02][_0xa0a5('0x24')]||_0x54a19a[_0xa0a5('0x7')],'data2':members[_0x151f02]['data2']||_0x54a19a[_0xa0a5('0x25')],'data3':members[_0x151f02][_0xa0a5('0x26')]||_0x54a19a[_0xa0a5('0x27')],'uniqueid':members[_0x151f02][_0xa0a5('0x28')]||_0x54a19a[_0xa0a5('0x28')]});if(members[_0x151f02][_0xa0a5('0x29')]){writeDB(members[_0x151f02]);}}}if(_0x54a19a[_0xa0a5('0x2a')]){var _0x97f398=_0x54a19a['destinationchannel'][_0xa0a5('0x10')]('-')[0x0];if(!_[_0xa0a5('0x1d')](members[_0x97f398])){members[_0x97f398]=_[_0xa0a5('0x22')](members[_0x97f398],{'data1':members[_0x97f398][_0xa0a5('0x24')]||_0x54a19a[_0xa0a5('0x7')],'data2':members[_0x97f398][_0xa0a5('0x2b')]||_0x54a19a[_0xa0a5('0x25')],'data3':members[_0x97f398][_0xa0a5('0x26')]||_0x54a19a[_0xa0a5('0x27')],'uniqueid':members[_0x97f398]['uniqueid']||_0x54a19a[_0xa0a5('0x28')]});if(members[_0x97f398]['exitAt']){writeDB(members[_0x97f398]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f3c1cb1..d0022ba 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 _0x2899=['calleridname','mohtime','secondtransfereruniqueid','transfertype','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','queuecallerabandon','assigned','destaccountcode','membername','reason','transfer','TRANSFER','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid'];(function(_0x247902,_0x26d9ca){var _0x4f8697=function(_0x4d2dec){while(--_0x4d2dec){_0x247902['push'](_0x247902['shift']());}};_0x4f8697(++_0x26d9ca);}(_0x2899,0x9b));var _0x9289=function(_0x19268d,_0x528597){_0x19268d=_0x19268d-0x0;var _0x1f84cc=_0x2899[_0x19268d];return _0x1f84cc;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x3d0bfd){utils['info'](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x3d0bfd[_0x9289('0x0')],_0x3d0bfd[_0x9289('0x1')],_0x3d0bfd[_0x9289('0x2')],_0x3d0bfd[_0x9289('0x3')],_0x3d0bfd[_0x9289('0x4')],_0x3d0bfd[_0x9289('0x5')],_0x3d0bfd[_0x9289('0x6')]));if(_0x3d0bfd[_0x9289('0x2')]){utils[_0x9289('0x7')](_0x3d0bfd[_0x9289('0x2')])['then'](function(_0x31c0c3){if(_0x31c0c3){_0x3d0bfd['type']=_0x31c0c3['type'];}utils[_0x9289('0x8')](_0x9289('0x9'),_0x3d0bfd);});}else{utils[_0x9289('0x8')]('CreateVoiceQueueReport',_0x3d0bfd);}if(_0x3d0bfd[_0x9289('0xa')]){delete queues[_0x3d0bfd[_0x9289('0xa')]];}else{delete queues[_0x3d0bfd[_0x9289('0x0')]];}}exports[_0x9289('0xb')]=function(_0x315b25){queues[_0x315b25[_0x9289('0x0')]]=_[_0x9289('0xc')](_0x315b25,{'originalposition':_0x315b25[_0x9289('0xd')],'queuecallerjoinAt':utils[_0x9289('0xe')](),'mohtime':0x0});};exports['hangup']=function(_0x12ca6e){if(!_['isNil'](queues[_0x12ca6e[_0x9289('0x0')]])){if(queues[_0x12ca6e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x12ca6e['uniqueid']]['queuecallerabandon']&&!queues[_0x12ca6e['uniqueid']][_0x9289('0xf')]){queues[_0x12ca6e[_0x9289('0x0')]][_0x9289('0x10')]=!![];queues[_0x12ca6e['uniqueid']][_0x9289('0x11')]=utils['now']();queues[_0x12ca6e[_0x9289('0x0')]][_0x9289('0x6')]=_0x9289('0x12');}writeDB(queues[_0x12ca6e[_0x9289('0x0')]]);}else{if(queues[_0x12ca6e[_0x9289('0x0')]][_0x9289('0xa')]){queues[queues[_0x12ca6e[_0x9289('0x0')]]['transfereduniqueid']]=queues[_0x12ca6e[_0x9289('0x0')]];queues[queues[_0x12ca6e[_0x9289('0x0')]][_0x9289('0xa')]][_0x9289('0x13')]=0x2;delete queues[_0x12ca6e['uniqueid']];}}}};exports[_0x9289('0x14')]=function(_0x430bdb){if(!_[_0x9289('0x15')](_0x430bdb[_0x9289('0x16')][_0x9289('0x17')])&&_0x430bdb[_0x9289('0x18')][_0x9289('0x19')]()!==_0x9289('0x1a')){if(!_[_0x9289('0x15')](queues[_0x430bdb[_0x9289('0x0')]])){queues[_0x430bdb[_0x9289('0x0')]]['queuecallerabandon']=![];queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0x1b')]=null;queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0xf')]=!![];queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0x1c')]=utils[_0x9289('0xe')]();queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0x6')]=_0x430bdb['value']['toUpperCase']();writeDB(queues[_0x430bdb['uniqueid']]);}}else if(!_['isNil'](_0x430bdb[_0x9289('0x16')][_0x9289('0x1d')])){if(!_[_0x9289('0x15')](queues[_0x430bdb['uniqueid']])&&!queues[_0x430bdb['uniqueid']]['queuecallerabandon']){queues[_0x430bdb['uniqueid']]['queuecallerabandon']=![];queues[_0x430bdb['uniqueid']][_0x9289('0x1b')]=null;queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0xf')]=!![];queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0x1c')]=utils[_0x9289('0xe')]();queues[_0x430bdb[_0x9289('0x0')]][_0x9289('0x6')]=_0x9289('0x1e');}}};exports['queuecallerabandon']=function(_0x59e62b){if(!_[_0x9289('0x15')](queues[_0x59e62b[_0x9289('0x0')]])){queues[_0x59e62b['uniqueid']][_0x9289('0xf')]=![];queues[_0x59e62b['uniqueid']][_0x9289('0x1c')]=null;queues[_0x59e62b[_0x9289('0x0')]]['queuecallerabandon']=!![];queues[_0x59e62b[_0x9289('0x0')]][_0x9289('0x1b')]=utils[_0x9289('0xe')]();queues[_0x59e62b[_0x9289('0x0')]][_0x9289('0x6')]='ABANDONED';}};exports[_0x9289('0x1f')]=function(_0x2f0c52){if(!_[_0x9289('0x15')](queues[_0x2f0c52[_0x9289('0x0')]])){queues[_0x2f0c52[_0x9289('0x0')]][_0x9289('0x1f')]=!![];queues[_0x2f0c52[_0x9289('0x0')]]['queuecallerleaveAt']=utils['now']();queues[_0x2f0c52[_0x9289('0x0')]][_0x9289('0x20')]=utils[_0x9289('0x21')](queues[_0x2f0c52[_0x9289('0x0')]][_0x9289('0x22')],queues[_0x2f0c52[_0x9289('0x0')]][_0x9289('0x23')]);queues[_0x2f0c52['uniqueid']][_0x9289('0xd')]=_0x2f0c52[_0x9289('0xd')];queues[_0x2f0c52['uniqueid']][_0x9289('0x24')]=_0x2f0c52[_0x9289('0x24')];queues[_0x2f0c52[_0x9289('0x0')]][_0x9289('0x25')]=_0x2f0c52['connectedlinenum'];queues[_0x2f0c52[_0x9289('0x0')]]['connectedlinename']=_0x2f0c52[_0x9289('0x26')];}};exports[_0x9289('0x27')]=function(_0x513823){if(!_[_0x9289('0x15')](queues[_0x513823[_0x9289('0x0')]])){queues[_0x513823[_0x9289('0x0')]][_0x9289('0x28')]=![];queues[_0x513823[_0x9289('0x0')]][_0x9289('0x28')]=![];queues[_0x513823[_0x9289('0x0')]]['queuecallerabandonAt']=null;queues[_0x513823['uniqueid']][_0x9289('0xf')]=![];queues[_0x513823[_0x9289('0x0')]][_0x9289('0x6')]=null;queues[_0x513823['uniqueid']]['queuecallerexitAt']=null;queues[_0x513823[_0x9289('0x0')]][_0x9289('0x29')]=!![];queues[_0x513823[_0x9289('0x0')]][_0x9289('0x5')]=_0x513823[_0x9289('0x2a')];queues[_0x513823['uniqueid']][_0x9289('0x3')]=_0x513823[_0x9289('0x2b')];}};exports['agentcomplete']=function(_0x49c7b9){if(!_['isNil'](queues[_0x49c7b9[_0x9289('0x0')]])){if(queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0x22')]){queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0x28')]=![];queues[_0x49c7b9[_0x9289('0x0')]]['queuecallerabandon']=![];queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0x1b')]=null;queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0xf')]=![];queues[_0x49c7b9['uniqueid']][_0x9289('0x1c')]=null;queues[_0x49c7b9['uniqueid']]['assigned']=!![];queues[_0x49c7b9['uniqueid']][_0x9289('0x3')]=_0x49c7b9[_0x9289('0x2b')];queues[_0x49c7b9['uniqueid']][_0x9289('0x10')]=!![];queues[_0x49c7b9['uniqueid']][_0x9289('0x11')]=utils['now']();if(_0x49c7b9[_0x9289('0x2c')]==_0x9289('0x2d')){if(!queues[_0x49c7b9[_0x9289('0x0')]]['transfer']){queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0x6')]=_0x9289('0x2e');}}else{queues[_0x49c7b9[_0x9289('0x0')]][_0x9289('0x6')]='COMPLETEDBY'+_0x49c7b9['reason'][_0x9289('0x19')]();}writeDB(queues[_0x49c7b9[_0x9289('0x0')]]);}}};exports['blindtransfer']=function(_0xdb0524){if(!_[_0x9289('0x15')](queues[_0xdb0524[_0x9289('0x2f')]])){queues[_0xdb0524[_0x9289('0x2f')]][_0x9289('0x2d')]=!![];queues[_0xdb0524[_0x9289('0x2f')]]['transfertype']=_0x9289('0x30');queues[_0xdb0524[_0x9289('0x2f')]]['transferexten']=_0xdb0524[_0x9289('0x31')];queues[_0xdb0524[_0x9289('0x2f')]][_0x9289('0x32')]=_0xdb0524[_0x9289('0x2f')];queues[_0xdb0524[_0x9289('0x2f')]][_0x9289('0x6')]=_0x9289('0x33');}};exports['attendedtransfer']=function(_0x34b6e8){try{if(_0x34b6e8[_0x9289('0x34')]==_0x34b6e8[_0x9289('0x35')]){if(!_[_0x9289('0x15')](queues[_0x34b6e8[_0x9289('0x36')]])){queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x2d')]=!![];queues[_0x34b6e8['secondtransfererlinkedid']]['transfertype']=_0x9289('0x37');queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x38')]=_0x34b6e8['origtransfererexten'];queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x32')]=_0x34b6e8['origtransfereruniqueid'];queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x6')]=_0x9289('0x39');}if(!_[_0x9289('0x15')](queues[_0x34b6e8[_0x9289('0x35')]])){if(_0x34b6e8[_0x9289('0x3a')]&&queues[_0x34b6e8[_0x9289('0x3a')]]){queues[_0x34b6e8[_0x9289('0x3a')]][_0x9289('0x13')]=0x1;queues[_0x34b6e8[_0x9289('0x2f')]]=_[_0x9289('0x3b')](queues[_0x34b6e8[_0x9289('0x3a')]]);queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0xa')]=_0x34b6e8[_0x9289('0x3c')];queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x13')]=0x2;queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x4')]=queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x4')];queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x3d')]=queues[_0x34b6e8[_0x9289('0x36')]][_0x9289('0x3d')];queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x23')]=utils[_0x9289('0xe')]();queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x22')]=utils[_0x9289('0xe')]();queues[_0x34b6e8[_0x9289('0x2f')]][_0x9289('0x20')]=0x0;queues[_0x34b6e8['transfereeuniqueid']][_0x9289('0x3e')]=0x0;}else{queues[_0x34b6e8[_0x9289('0x35')]][_0x9289('0xa')]=_0x34b6e8[_0x9289('0x36')];}}}else if(_0x34b6e8[_0x9289('0x3f')]==_0x34b6e8[_0x9289('0x36')]){if(!_[_0x9289('0x15')](queues[_0x34b6e8[_0x9289('0x35')]])){queues[_0x34b6e8['origtransfererlinkedid']][_0x9289('0x2d')]=!![];queues[_0x34b6e8[_0x9289('0x35')]][_0x9289('0x40')]=_0x9289('0x37');queues[_0x34b6e8[_0x9289('0x35')]][_0x9289('0x38')]=_0x34b6e8[_0x9289('0x41')];queues[_0x34b6e8[_0x9289('0x35')]][_0x9289('0x32')]=_0x34b6e8[_0x9289('0x3f')];queues[_0x34b6e8[_0x9289('0x35')]][_0x9289('0x6')]=_0x9289('0x39');}if(!_[_0x9289('0x15')](queues[_0x34b6e8['secondtransfererlinkedid']])){if(_0x34b6e8[_0x9289('0x42')]&&queues[_0x34b6e8[_0x9289('0x42')]]){queues[_0x34b6e8[_0x9289('0x42')]][_0x9289('0x13')]=0x1;queues[_0x34b6e8[_0x9289('0x3c')]]=_['clone'](queues[_0x34b6e8['transfertargetlinkedid']]);queues[_0x34b6e8['transfertargetuniqueid']]['transfereduniqueid']=_0x34b6e8[_0x9289('0x3c')];queues[_0x34b6e8[_0x9289('0x3c')]][_0x9289('0x13')]=0x2;queues[_0x34b6e8[_0x9289('0x3c')]]['calleridnum']=queues[_0x34b6e8['origtransfererlinkedid']][_0x9289('0x4')];queues[_0x34b6e8[_0x9289('0x3c')]][_0x9289('0x3d')]=queues[_0x34b6e8[_0x9289('0x35')]]['calleridname'];queues[_0x34b6e8['transfertargetuniqueid']][_0x9289('0x23')]=utils[_0x9289('0xe')]();queues[_0x34b6e8[_0x9289('0x3c')]][_0x9289('0x22')]=utils[_0x9289('0xe')]();queues[_0x34b6e8[_0x9289('0x3c')]][_0x9289('0x20')]=0x0;queues[_0x34b6e8[_0x9289('0x3c')]][_0x9289('0x3e')]=0x0;}else{queues[_0x34b6e8[_0x9289('0x36')]]['transfereduniqueid']=_0x34b6e8['origtransfererlinkedid'];}}}}catch(_0x22f198){utils[_0x9289('0x43')](_0x22f198[_0x9289('0x44')]);}};exports[_0x9289('0x45')]=function(_0xf08522){if(!_[_0x9289('0x15')](queues[_0xf08522['uniqueid']])){queues[_0xf08522['uniqueid']]['musiconholdstartAt']=utils[_0x9289('0xe')]();}};exports[_0x9289('0x46')]=function(_0xa696fc){if(!_[_0x9289('0x15')](queues[_0xa696fc[_0x9289('0x0')]])){if(!_[_0x9289('0x15')](queues[_0xa696fc[_0x9289('0x0')]][_0x9289('0x47')])){queues[_0xa696fc[_0x9289('0x0')]][_0x9289('0x3e')]+=utils[_0x9289('0x21')](utils['now'](),queues[_0xa696fc[_0x9289('0x0')]][_0x9289('0x47')]);delete queues[_0xa696fc[_0x9289('0x0')]][_0x9289('0x47')];}}}; \ No newline at end of file +var _0x8a0e=['secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','error','stack','musiconholdstop','musiconholdstartAt','lodash','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','secondtransfererlinkedid','ATTENDED','origtransfererexten','origtransfereruniqueid','origtransfererlinkedid','transfereelinkedid','calleridname','mohtime','secondtransfereruniqueid'];(function(_0x5c366,_0x38ab24){var _0x2141b6=function(_0x113cf3){while(--_0x113cf3){_0x5c366['push'](_0x5c366['shift']());}};_0x2141b6(++_0x38ab24);}(_0x8a0e,0x13c));var _0xe8a0=function(_0x2f4dd1,_0xee1f){_0x2f4dd1=_0x2f4dd1-0x0;var _0x3d7d0d=_0x8a0e[_0x2f4dd1];return _0x3d7d0d;};'use strict';var _=require(_0xe8a0('0x0'));var util=require(_0xe8a0('0x1'));var utils=require(_0xe8a0('0x2'));var queues={};function writeDB(_0x472a36){utils['info'](util[_0xe8a0('0x3')](_0xe8a0('0x4'),_0x472a36[_0xe8a0('0x5')],_0x472a36[_0xe8a0('0x6')],_0x472a36['queue'],_0x472a36['lastAssignedTo'],_0x472a36[_0xe8a0('0x7')],_0x472a36[_0xe8a0('0x8')],_0x472a36[_0xe8a0('0x9')]));if(_0x472a36[_0xe8a0('0xa')]){utils[_0xe8a0('0xb')](_0x472a36[_0xe8a0('0xa')])['then'](function(_0x12c417){if(_0x12c417){_0x472a36[_0xe8a0('0xc')]=_0x12c417[_0xe8a0('0xc')];}utils[_0xe8a0('0xd')](_0xe8a0('0xe'),_0x472a36);});}else{utils[_0xe8a0('0xd')](_0xe8a0('0xe'),_0x472a36);}if(_0x472a36[_0xe8a0('0xf')]){delete queues[_0x472a36['transfereduniqueid']];}else{delete queues[_0x472a36['uniqueid']];}}exports[_0xe8a0('0x10')]=function(_0x276b1e){queues[_0x276b1e[_0xe8a0('0x5')]]=_[_0xe8a0('0x11')](_0x276b1e,{'originalposition':_0x276b1e[_0xe8a0('0x12')],'queuecallerjoinAt':utils[_0xe8a0('0x13')](),'mohtime':0x0});};exports[_0xe8a0('0x14')]=function(_0x5affd9){if(!_[_0xe8a0('0x15')](queues[_0x5affd9[_0xe8a0('0x5')]])){if(queues[_0x5affd9[_0xe8a0('0x5')]][_0xe8a0('0x16')]){if(!queues[_0x5affd9['uniqueid']][_0xe8a0('0x17')]&&!queues[_0x5affd9['uniqueid']][_0xe8a0('0x18')]){queues[_0x5affd9['uniqueid']][_0xe8a0('0x19')]=!![];queues[_0x5affd9[_0xe8a0('0x5')]]['queuecallercompleteAt']=utils[_0xe8a0('0x13')]();queues[_0x5affd9[_0xe8a0('0x5')]][_0xe8a0('0x9')]='COMPLETEDBYAGENT';}writeDB(queues[_0x5affd9[_0xe8a0('0x5')]]);}else{if(queues[_0x5affd9['uniqueid']][_0xe8a0('0xf')]){queues[queues[_0x5affd9[_0xe8a0('0x5')]][_0xe8a0('0xf')]]=queues[_0x5affd9[_0xe8a0('0x5')]];queues[queues[_0x5affd9['uniqueid']][_0xe8a0('0xf')]][_0xe8a0('0x1a')]=0x2;delete queues[_0x5affd9[_0xe8a0('0x5')]];}}}};exports[_0xe8a0('0x1b')]=function(_0x5f4897){if(!_['isNil'](_0x5f4897[_0xe8a0('0x1c')][_0xe8a0('0x1d')])&&_0x5f4897[_0xe8a0('0x1e')][_0xe8a0('0x1f')]()!==_0xe8a0('0x20')){if(!_[_0xe8a0('0x15')](queues[_0x5f4897[_0xe8a0('0x5')]])){queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x17')]=![];queues[_0x5f4897[_0xe8a0('0x5')]]['queuecallerabandonAt']=null;queues[_0x5f4897[_0xe8a0('0x5')]]['queuecallerexit']=!![];queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x21')]=utils['now']();queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x9')]=_0x5f4897[_0xe8a0('0x1e')][_0xe8a0('0x1f')]();writeDB(queues[_0x5f4897[_0xe8a0('0x5')]]);}}else if(!_[_0xe8a0('0x15')](_0x5f4897['variable']['queueposition'])){if(!_[_0xe8a0('0x15')](queues[_0x5f4897[_0xe8a0('0x5')]])&&!queues[_0x5f4897['uniqueid']][_0xe8a0('0x17')]){queues[_0x5f4897[_0xe8a0('0x5')]]['queuecallerabandon']=![];queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x22')]=null;queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x18')]=!![];queues[_0x5f4897[_0xe8a0('0x5')]]['queuecallerexitAt']=utils[_0xe8a0('0x13')]();queues[_0x5f4897[_0xe8a0('0x5')]][_0xe8a0('0x9')]='EXITWITHKEY';}}};exports[_0xe8a0('0x17')]=function(_0x10988c){if(!_[_0xe8a0('0x15')](queues[_0x10988c[_0xe8a0('0x5')]])){queues[_0x10988c[_0xe8a0('0x5')]][_0xe8a0('0x18')]=![];queues[_0x10988c['uniqueid']][_0xe8a0('0x21')]=null;queues[_0x10988c[_0xe8a0('0x5')]]['queuecallerabandon']=!![];queues[_0x10988c[_0xe8a0('0x5')]][_0xe8a0('0x22')]=utils[_0xe8a0('0x13')]();queues[_0x10988c[_0xe8a0('0x5')]][_0xe8a0('0x9')]=_0xe8a0('0x23');}};exports[_0xe8a0('0x24')]=function(_0x1e652c){if(!_[_0xe8a0('0x15')](queues[_0x1e652c[_0xe8a0('0x5')]])){queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x24')]=!![];queues[_0x1e652c['uniqueid']][_0xe8a0('0x16')]=utils[_0xe8a0('0x13')]();queues[_0x1e652c['uniqueid']][_0xe8a0('0x25')]=utils[_0xe8a0('0x26')](queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x16')],queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x27')]);queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x12')]=_0x1e652c[_0xe8a0('0x12')];queues[_0x1e652c[_0xe8a0('0x5')]]['count']=_0x1e652c['count'];queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x28')]=_0x1e652c[_0xe8a0('0x28')];queues[_0x1e652c[_0xe8a0('0x5')]][_0xe8a0('0x29')]=_0x1e652c['connectedlinename'];}};exports[_0xe8a0('0x2a')]=function(_0x1eac43){if(!_[_0xe8a0('0x15')](queues[_0x1eac43['uniqueid']])){queues[_0x1eac43[_0xe8a0('0x5')]][_0xe8a0('0x17')]=![];queues[_0x1eac43[_0xe8a0('0x5')]]['queuecallerabandon']=![];queues[_0x1eac43['uniqueid']][_0xe8a0('0x22')]=null;queues[_0x1eac43['uniqueid']][_0xe8a0('0x18')]=![];queues[_0x1eac43['uniqueid']][_0xe8a0('0x9')]=null;queues[_0x1eac43[_0xe8a0('0x5')]][_0xe8a0('0x21')]=null;queues[_0x1eac43[_0xe8a0('0x5')]][_0xe8a0('0x2b')]=!![];queues[_0x1eac43[_0xe8a0('0x5')]]['accountcode']=_0x1eac43[_0xe8a0('0x2c')];queues[_0x1eac43[_0xe8a0('0x5')]][_0xe8a0('0x2d')]=_0x1eac43[_0xe8a0('0x2e')];}};exports[_0xe8a0('0x2f')]=function(_0x2b055b){if(!_[_0xe8a0('0x15')](queues[_0x2b055b[_0xe8a0('0x5')]])){if(queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x16')]){queues[_0x2b055b[_0xe8a0('0x5')]]['queuecallerabandon']=![];queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x17')]=![];queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x22')]=null;queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x18')]=![];queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x21')]=null;queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x2b')]=!![];queues[_0x2b055b['uniqueid']][_0xe8a0('0x2d')]=_0x2b055b[_0xe8a0('0x2e')];queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x19')]=!![];queues[_0x2b055b['uniqueid']]['queuecallercompleteAt']=utils[_0xe8a0('0x13')]();if(_0x2b055b[_0xe8a0('0x30')]==_0xe8a0('0x31')){if(!queues[_0x2b055b['uniqueid']][_0xe8a0('0x31')]){queues[_0x2b055b[_0xe8a0('0x5')]][_0xe8a0('0x9')]=_0xe8a0('0x32');}}else{queues[_0x2b055b['uniqueid']][_0xe8a0('0x9')]=_0xe8a0('0x33')+_0x2b055b[_0xe8a0('0x30')]['toUpperCase']();}writeDB(queues[_0x2b055b['uniqueid']]);}}};exports['blindtransfer']=function(_0x362ed3){if(!_[_0xe8a0('0x15')](queues[_0x362ed3[_0xe8a0('0x34')]])){queues[_0x362ed3[_0xe8a0('0x34')]][_0xe8a0('0x31')]=!![];queues[_0x362ed3['transfereeuniqueid']][_0xe8a0('0x35')]=_0xe8a0('0x36');queues[_0x362ed3[_0xe8a0('0x34')]][_0xe8a0('0x37')]=_0x362ed3[_0xe8a0('0x38')];queues[_0x362ed3[_0xe8a0('0x34')]][_0xe8a0('0x39')]=_0x362ed3[_0xe8a0('0x34')];queues[_0x362ed3[_0xe8a0('0x34')]][_0xe8a0('0x9')]=_0xe8a0('0x3a');}};exports[_0xe8a0('0x3b')]=function(_0x47709b){try{if(_0x47709b['origtransfereruniqueid']==_0x47709b['origtransfererlinkedid']){if(!_[_0xe8a0('0x15')](queues[_0x47709b[_0xe8a0('0x3c')]])){queues[_0x47709b[_0xe8a0('0x3c')]]['transfer']=!![];queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0x35')]=_0xe8a0('0x3d');queues[_0x47709b[_0xe8a0('0x3c')]]['transferexten']=_0x47709b[_0xe8a0('0x3e')];queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0x39')]=_0x47709b[_0xe8a0('0x3f')];queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x47709b[_0xe8a0('0x40')]])){if(_0x47709b[_0xe8a0('0x41')]&&queues[_0x47709b[_0xe8a0('0x41')]]){queues[_0x47709b[_0xe8a0('0x41')]][_0xe8a0('0x1a')]=0x1;queues[_0x47709b[_0xe8a0('0x34')]]=_['clone'](queues[_0x47709b['transfereelinkedid']]);queues[_0x47709b[_0xe8a0('0x34')]][_0xe8a0('0xf')]=_0x47709b['transfertargetuniqueid'];queues[_0x47709b[_0xe8a0('0x34')]]['queuecallerenterreason']=0x2;queues[_0x47709b[_0xe8a0('0x34')]]['calleridnum']=queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0x7')];queues[_0x47709b[_0xe8a0('0x34')]][_0xe8a0('0x42')]=queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0x42')];queues[_0x47709b['transfereeuniqueid']][_0xe8a0('0x27')]=utils[_0xe8a0('0x13')]();queues[_0x47709b[_0xe8a0('0x34')]][_0xe8a0('0x16')]=utils[_0xe8a0('0x13')]();queues[_0x47709b[_0xe8a0('0x34')]]['holdtime']=0x0;queues[_0x47709b[_0xe8a0('0x34')]][_0xe8a0('0x43')]=0x0;}else{queues[_0x47709b[_0xe8a0('0x40')]][_0xe8a0('0xf')]=_0x47709b[_0xe8a0('0x3c')];}}}else if(_0x47709b[_0xe8a0('0x44')]==_0x47709b['secondtransfererlinkedid']){if(!_[_0xe8a0('0x15')](queues[_0x47709b['origtransfererlinkedid']])){queues[_0x47709b[_0xe8a0('0x40')]][_0xe8a0('0x31')]=!![];queues[_0x47709b[_0xe8a0('0x40')]]['transfertype']=_0xe8a0('0x3d');queues[_0x47709b[_0xe8a0('0x40')]][_0xe8a0('0x37')]=_0x47709b[_0xe8a0('0x45')];queues[_0x47709b['origtransfererlinkedid']][_0xe8a0('0x39')]=_0x47709b[_0xe8a0('0x44')];queues[_0x47709b[_0xe8a0('0x40')]][_0xe8a0('0x9')]=_0xe8a0('0x46');}if(!_[_0xe8a0('0x15')](queues[_0x47709b[_0xe8a0('0x3c')]])){if(_0x47709b[_0xe8a0('0x47')]&&queues[_0x47709b['transfertargetlinkedid']]){queues[_0x47709b['transfertargetlinkedid']][_0xe8a0('0x1a')]=0x1;queues[_0x47709b[_0xe8a0('0x48')]]=_['clone'](queues[_0x47709b['transfertargetlinkedid']]);queues[_0x47709b['transfertargetuniqueid']]['transfereduniqueid']=_0x47709b[_0xe8a0('0x48')];queues[_0x47709b[_0xe8a0('0x48')]][_0xe8a0('0x1a')]=0x2;queues[_0x47709b[_0xe8a0('0x48')]][_0xe8a0('0x7')]=queues[_0x47709b[_0xe8a0('0x40')]][_0xe8a0('0x7')];queues[_0x47709b['transfertargetuniqueid']][_0xe8a0('0x42')]=queues[_0x47709b['origtransfererlinkedid']][_0xe8a0('0x42')];queues[_0x47709b[_0xe8a0('0x48')]][_0xe8a0('0x27')]=utils[_0xe8a0('0x13')]();queues[_0x47709b[_0xe8a0('0x48')]]['queuecallerleaveAt']=utils[_0xe8a0('0x13')]();queues[_0x47709b[_0xe8a0('0x48')]][_0xe8a0('0x25')]=0x0;queues[_0x47709b[_0xe8a0('0x48')]][_0xe8a0('0x43')]=0x0;}else{queues[_0x47709b[_0xe8a0('0x3c')]][_0xe8a0('0xf')]=_0x47709b[_0xe8a0('0x40')];}}}}catch(_0xdfdba9){utils[_0xe8a0('0x49')](_0xdfdba9[_0xe8a0('0x4a')]);}};exports['musiconholdstart']=function(_0x573f1c){if(!_[_0xe8a0('0x15')](queues[_0x573f1c[_0xe8a0('0x5')]])){queues[_0x573f1c['uniqueid']]['musiconholdstartAt']=utils[_0xe8a0('0x13')]();}};exports[_0xe8a0('0x4b')]=function(_0x4a2c8e){if(!_[_0xe8a0('0x15')](queues[_0x4a2c8e[_0xe8a0('0x5')]])){if(!_[_0xe8a0('0x15')](queues[_0x4a2c8e['uniqueid']][_0xe8a0('0x4c')])){queues[_0x4a2c8e['uniqueid']][_0xe8a0('0x43')]+=utils['diffTime'](utils[_0xe8a0('0x13')](),queues[_0x4a2c8e['uniqueid']][_0xe8a0('0x4c')]);delete queues[_0x4a2c8e[_0xe8a0('0x5')]][_0xe8a0('0x4c')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f2d6a52..050f0ac 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x293fb5,_0x4c38bf){var _0x2a82ef=function(_0x3f91cc){while(--_0x3f91cc){_0x293fb5['push'](_0x293fb5['shift']());}};_0x2a82ef(++_0x4c38bf);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file +var _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bc5ac51..f29c20c 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 _0x64b0=['TRANSFER|%s','request','CreateVoiceTransferReport','type','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format'];(function(_0x69f8aa,_0x450e60){var _0x364ac1=function(_0x31adea){while(--_0x31adea){_0x69f8aa['push'](_0x69f8aa['shift']());}};_0x364ac1(++_0x450e60);}(_0x64b0,0x74));var _0x064b=function(_0x51128a,_0x40b285){_0x51128a=_0x51128a-0x0;var _0x4779ba=_0x64b0[_0x51128a];return _0x4779ba;};'use strict';var _=require(_0x064b('0x0'));var util=require(_0x064b('0x1'));var utils=require(_0x064b('0x2'));function writeDB(_0x509d48){utils['info'](util[_0x064b('0x3')](_0x064b('0x4'),_0x509d48['type']));utils[_0x064b('0x5')](_0x064b('0x6'),_0x509d48);}exports['blindtransfer']=function(_0x34d773){try{_0x34d773[_0x064b('0x7')]='blind';writeDB(_0x34d773);}catch(_0x93087c){utils[_0x064b('0x8')](_0x93087c[_0x064b('0x9')]);}};exports[_0x064b('0xa')]=function(_0x5e077f){try{_0x5e077f=_[_0x064b('0xb')](_0x5e077f,{'transfererchannel':_0x5e077f[_0x064b('0xc')],'transferercalleridnum':_0x5e077f[_0x064b('0xd')],'transferercalleridname':_0x5e077f[_0x064b('0xe')],'transfererconnectedlinenum':_0x5e077f[_0x064b('0xf')],'transfererconnectedlinename':_0x5e077f[_0x064b('0x10')],'transfereraccountcode':_0x5e077f[_0x064b('0x11')],'transferercontext':_0x5e077f[_0x064b('0x12')],'transfererexten':_0x5e077f['secondtransfererexten'],'transfererlinkedid':_0x5e077f[_0x064b('0x13')],'context':_0x5e077f['origtransferercontext'],'extension':_0x5e077f[_0x064b('0x14')],'type':_0x064b('0x15')});if(_['isNil'](_0x5e077f[_0x064b('0x16')])){_0x5e077f=_[_0x064b('0xb')](_0x5e077f,{'transfereechannel':_0x5e077f[_0x064b('0x17')],'transfereecalleridnum':_0x5e077f[_0x064b('0x18')],'transfereecalleridname':_0x5e077f[_0x064b('0x19')],'transfereeconnectedlinenum':_0x5e077f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5e077f[_0x064b('0x1a')],'transfereeaccountcode':_0x5e077f[_0x064b('0x1b')],'transfereecontext':_0x5e077f['transfertargetcontext'],'transfereeexten':_0x5e077f[_0x064b('0x1c')],'transfereelinkedid':_0x5e077f[_0x064b('0x1d')]});}writeDB(_0x5e077f);}catch(_0x3460d4){utils[_0x064b('0x8')](_0x3460d4[_0x064b('0x9')]);}}; \ No newline at end of file +var _0x7fa9=['transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','stack','lodash','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fa9,0x76));var _0x97fa=function(_0x384555,_0x2c6fd2){_0x384555=_0x384555-0x0;var _0x5579b1=_0x7fa9[_0x384555];return _0x5579b1;};'use strict';var _=require(_0x97fa('0x0'));var util=require('util');var utils=require(_0x97fa('0x1'));function writeDB(_0x3332cb){utils[_0x97fa('0x2')](util[_0x97fa('0x3')](_0x97fa('0x4'),_0x3332cb[_0x97fa('0x5')]));utils[_0x97fa('0x6')]('CreateVoiceTransferReport',_0x3332cb);}exports[_0x97fa('0x7')]=function(_0x5aca95){try{_0x5aca95['type']='blind';writeDB(_0x5aca95);}catch(_0xad32f4){utils[_0x97fa('0x8')](_0xad32f4['stack']);}};exports[_0x97fa('0x9')]=function(_0x5cc252){try{_0x5cc252=_[_0x97fa('0xa')](_0x5cc252,{'transfererchannel':_0x5cc252[_0x97fa('0xb')],'transferercalleridnum':_0x5cc252[_0x97fa('0xc')],'transferercalleridname':_0x5cc252[_0x97fa('0xd')],'transfererconnectedlinenum':_0x5cc252[_0x97fa('0xe')],'transfererconnectedlinename':_0x5cc252['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5cc252[_0x97fa('0xf')],'transferercontext':_0x5cc252['secondtransferercontext'],'transfererexten':_0x5cc252['secondtransfererexten'],'transfererlinkedid':_0x5cc252[_0x97fa('0x10')],'context':_0x5cc252[_0x97fa('0x11')],'extension':_0x5cc252['origtransfererexten'],'type':_0x97fa('0x12')});if(_['isNil'](_0x5cc252[_0x97fa('0x13')])){_0x5cc252=_[_0x97fa('0xa')](_0x5cc252,{'transfereechannel':_0x5cc252[_0x97fa('0x14')],'transfereecalleridnum':_0x5cc252[_0x97fa('0x15')],'transfereecalleridname':_0x5cc252[_0x97fa('0x16')],'transfereeconnectedlinenum':_0x5cc252['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5cc252['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5cc252[_0x97fa('0x17')],'transfereecontext':_0x5cc252[_0x97fa('0x18')],'transfereeexten':_0x5cc252[_0x97fa('0x19')],'transfereelinkedid':_0x5cc252[_0x97fa('0x1a')]});}writeDB(_0x5cc252);}catch(_0x1b03fc){utils['error'](_0x1b03fc[_0x97fa('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 764bae1..ddbf369 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 _0x167d=['length','FOUND','NOTFOUND','result','getUserByInternal','catch','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','xdr','info','debug','stringify','error','request','then','stack','GetUser','name','interface'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0x167d,0x1d1));var _0xd167=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x167d[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xd167('0x0'));var moment=require(_0xd167('0x1'));var BPromise=require(_0xd167('0x2'));var client=jayson[_0xd167('0x3')][_0xd167('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xd167('0x5'));exports['info']=function(_0x1c6bd0){logger[_0xd167('0x6')](_0x1c6bd0);};exports[_0xd167('0x7')]=function(_0x48164e){logger['debug'](JSON[_0xd167('0x8')](_0x48164e));};exports[_0xd167('0x9')]=function(_0x23d229){logger['error'](_0x23d229['stack']);};exports[_0xd167('0xa')]=function(_0x328436,_0x48ed28){return client[_0xd167('0xa')](_0x328436,{'body':_0x48ed28})[_0xd167('0xb')](function(_0x2a495f){logger[_0xd167('0x7')](JSON[_0xd167('0x8')](_0x2a495f));})['catch'](function(_0x1249b7){logger['error'](_0x1249b7[_0xd167('0xc')]);});};function getUser(_0x558cf2){return client['request'](_0xd167('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xd167('0xe'),_0xd167('0xf')],'where':_0x558cf2,'limit':0x1}})[_0xd167('0xb')](function(_0x3acb79){logger[_0xd167('0x6')]('GETUSER|'+JSON['stringify'](_0x558cf2)+'|'+(_0x3acb79['result'][_0xd167('0x10')]?_0xd167('0x11'):_0xd167('0x12')));return _0x3acb79[_0xd167('0x13')][_0xd167('0x10')]?_0x3acb79['result'][0x0]:null;});}exports[_0xd167('0x14')]=function(_0x528d8e){return new BPromise(function(_0x3a264b,_0x26b14a){if(_0x528d8e){return getUser({'internal':_0x528d8e})['then'](function(_0x5a1b43){return _0x3a264b(_0x5a1b43);})[_0xd167('0x15')](function(_0x16b651){logger[_0xd167('0x9')](_0x16b651[_0xd167('0xc')]);return _0x3a264b(null);});}else{return _0x3a264b(null);}});};exports[_0xd167('0x16')]=function(_0x204ba0){return new BPromise(function(_0x2017c0,_0x4adde2){if(_0x204ba0){return getUser({'interface':_0x204ba0})[_0xd167('0xb')](function(_0x4cbe11){return _0x2017c0(_0x4cbe11);})['catch'](function(_0x20153c){logger['error'](_0x20153c[_0xd167('0xc')]);return _0x2017c0(null);});}else{return _0x2017c0(null);}});};exports['getUserByName']=function(_0x3e3524){return new BPromise(function(_0x2f0676,_0xf3f764){if(_0x3e3524){return getUser({'name':_0x3e3524})[_0xd167('0xb')](function(_0x274fd1){return _0x2f0676(_0x274fd1);})[_0xd167('0x15')](function(_0x44d0a2){logger[_0xd167('0x9')](_0x44d0a2[_0xd167('0xc')]);return _0x2f0676(null);});}else{return _0x2f0676(null);}});};exports[_0xd167('0x17')]=function(_0x34f808){return new BPromise(function(_0x5f430b,_0x2ed83f){if(_0x34f808){return client[_0xd167('0xa')](_0xd167('0x18'),{'options':{'raw':!![],'attributes':['id',_0xd167('0xe'),_0xd167('0x19'),_0xd167('0x1a'),'acwTimeout'],'where':{'name':_0x34f808},'limit':0x1}})[_0xd167('0xb')](function(_0x35b347){logger[_0xd167('0x6')]('GETVOICEQUEUEBYNAME|'+_0x34f808+'|'+(_0x35b347[_0xd167('0x13')][_0xd167('0x10')]?_0xd167('0x11'):'NOTFOUND'));return _0x5f430b(_0x35b347[_0xd167('0x13')]['length']?_0x35b347[_0xd167('0x13')][0x0]:null);})[_0xd167('0x15')](function(_0x542c3e){logger[_0xd167('0x9')](_0x542c3e[_0xd167('0xc')]);return _0x5f430b(null);});}else{return _0x5f430b(null);}});};exports['addTime']=function(_0x5352cb,_0x1a807e){return moment(_0x5352cb)[_0xd167('0x1b')](_0x1a807e,'seconds')[_0xd167('0x1c')](_0xd167('0x1d'));};exports['subtractTime']=function(_0x422a54,_0x451e21){return moment(_0x422a54)[_0xd167('0x1e')](_0x451e21,_0xd167('0x1f'))[_0xd167('0x1c')](_0xd167('0x1d'));};exports[_0xd167('0x20')]=function(_0x39c440,_0x1113da){return moment(_0x39c440)[_0xd167('0x21')](moment(_0x1113da),_0xd167('0x1f'));};exports[_0xd167('0x22')]=function(_0x1896b9,_0x5e6cce){return parseInt(_0x1896b9,0xa)+parseInt(_0x5e6cce,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x41dbc4,_0x5444db){if(_0x5444db){return moment(_0x41dbc4)[_0xd167('0x23')](_0x5444db);}else{return!![];}};exports[_0xd167('0x24')]=function(_0x202ddf,_0x52901f){if(_0x52901f){return moment(_0x202ddf)[_0xd167('0x24')](_0x52901f);}else if(_0x202ddf){return!![];}else{return![];}}; \ No newline at end of file +var _0xeef7=['internal','name','interface','length','NOTFOUND','result','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0xeef7,0x108));var _0x7eef=function(_0x481590,_0x167746){_0x481590=_0x481590-0x0;var _0x447376=_0xeef7[_0x481590];return _0x447376;};'use strict';var jayson=require(_0x7eef('0x0'));var moment=require(_0x7eef('0x1'));var BPromise=require(_0x7eef('0x2'));var client=jayson[_0x7eef('0x3')][_0x7eef('0x4')]({'port':0x2329});var logger=require(_0x7eef('0x5'))(_0x7eef('0x6'));exports['info']=function(_0x303f24){logger[_0x7eef('0x7')](_0x303f24);};exports[_0x7eef('0x8')]=function(_0x6fce27){logger[_0x7eef('0x8')](JSON[_0x7eef('0x9')](_0x6fce27));};exports[_0x7eef('0xa')]=function(_0x559302){logger['error'](_0x559302[_0x7eef('0xb')]);};exports[_0x7eef('0xc')]=function(_0x560aa8,_0x2e4d90){return client['request'](_0x560aa8,{'body':_0x2e4d90})[_0x7eef('0xd')](function(_0x1b52ee){logger['debug'](JSON['stringify'](_0x1b52ee));})[_0x7eef('0xe')](function(_0x232776){logger[_0x7eef('0xa')](_0x232776[_0x7eef('0xb')]);});};function getUser(_0x2c77ba){return client[_0x7eef('0xc')](_0x7eef('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7eef('0x10'),_0x7eef('0x11'),_0x7eef('0x12')],'where':_0x2c77ba,'limit':0x1}})[_0x7eef('0xd')](function(_0x1c2b65){logger[_0x7eef('0x7')]('GETUSER|'+JSON['stringify'](_0x2c77ba)+'|'+(_0x1c2b65['result'][_0x7eef('0x13')]?'FOUND':_0x7eef('0x14')));return _0x1c2b65[_0x7eef('0x15')][_0x7eef('0x13')]?_0x1c2b65[_0x7eef('0x15')][0x0]:null;});}exports['getUserByInternal']=function(_0xbd56dc){return new BPromise(function(_0x2fae43,_0x2454cc){if(_0xbd56dc){return getUser({'internal':_0xbd56dc})[_0x7eef('0xd')](function(_0x5bdbff){return _0x2fae43(_0x5bdbff);})[_0x7eef('0xe')](function(_0x424070){logger[_0x7eef('0xa')](_0x424070['stack']);return _0x2fae43(null);});}else{return _0x2fae43(null);}});};exports[_0x7eef('0x16')]=function(_0x3fe726){return new BPromise(function(_0x597ee7,_0x3ae260){if(_0x3fe726){return getUser({'interface':_0x3fe726})[_0x7eef('0xd')](function(_0x66f6a5){return _0x597ee7(_0x66f6a5);})[_0x7eef('0xe')](function(_0x4e601d){logger['error'](_0x4e601d[_0x7eef('0xb')]);return _0x597ee7(null);});}else{return _0x597ee7(null);}});};exports['getUserByName']=function(_0x4c7483){return new BPromise(function(_0x5ce98a,_0x19b322){if(_0x4c7483){return getUser({'name':_0x4c7483})[_0x7eef('0xd')](function(_0x2b92ca){return _0x5ce98a(_0x2b92ca);})[_0x7eef('0xe')](function(_0x59393a){logger['error'](_0x59393a[_0x7eef('0xb')]);return _0x5ce98a(null);});}else{return _0x5ce98a(null);}});};exports[_0x7eef('0x17')]=function(_0x5db1ee){return new BPromise(function(_0x22484c,_0x439dfb){if(_0x5db1ee){return client[_0x7eef('0xc')](_0x7eef('0x18'),{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x7eef('0x19')],'where':{'name':_0x5db1ee},'limit':0x1}})['then'](function(_0x2a0d0b){logger[_0x7eef('0x7')](_0x7eef('0x1a')+_0x5db1ee+'|'+(_0x2a0d0b[_0x7eef('0x15')][_0x7eef('0x13')]?_0x7eef('0x1b'):_0x7eef('0x14')));return _0x22484c(_0x2a0d0b[_0x7eef('0x15')]['length']?_0x2a0d0b[_0x7eef('0x15')][0x0]:null);})[_0x7eef('0xe')](function(_0xbdb27){logger[_0x7eef('0xa')](_0xbdb27[_0x7eef('0xb')]);return _0x22484c(null);});}else{return _0x22484c(null);}});};exports[_0x7eef('0x1c')]=function(_0x1bfde4,_0x28fad8){return moment(_0x1bfde4)[_0x7eef('0x1d')](_0x28fad8,_0x7eef('0x1e'))['format'](_0x7eef('0x1f'));};exports[_0x7eef('0x20')]=function(_0x15a22c,_0x2a6adb){return moment(_0x15a22c)[_0x7eef('0x21')](_0x2a6adb,'seconds')[_0x7eef('0x22')](_0x7eef('0x1f'));};exports[_0x7eef('0x23')]=function(_0x270244,_0x352984){return moment(_0x270244)['diff'](moment(_0x352984),_0x7eef('0x1e'));};exports[_0x7eef('0x24')]=function(_0x5bca7f,_0x1f2e9d){return parseInt(_0x5bca7f,0xa)+parseInt(_0x1f2e9d,0xa);};exports[_0x7eef('0x25')]=function(){return moment()[_0x7eef('0x22')](_0x7eef('0x1f'));};exports[_0x7eef('0x26')]=function(_0x164f49,_0x117406){if(_0x117406){return moment(_0x164f49)[_0x7eef('0x26')](_0x117406);}else{return!![];}};exports[_0x7eef('0x27')]=function(_0x4cfd4c,_0x3b7896){if(_0x3b7896){return moment(_0x4cfd4c)[_0x7eef('0x27')](_0x3b7896);}else if(_0x4cfd4c){return!![];}else{return![];}}; \ No newline at end of file